diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 75dd65cbd..24bcb6a4e 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -49,8 +49,6 @@ jobs: include: - language: javascript-typescript build-mode: none - - language: python - build-mode: none # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' # Use `c-cpp` to analyze code written in C, C++ or both # Use 'java-kotlin' to analyze code written in Java, Kotlin or both diff --git a/.gitignore b/.gitignore index 023cb896b..16ce968fa 100644 --- a/.gitignore +++ b/.gitignore @@ -57,9 +57,6 @@ typings/ # dotenv environment variables file .env -# parcel-bundler caches -.parcel-cache - # built files **/src/**/*.js docs/**/*.map @@ -80,9 +77,3 @@ _site dist !docs/dist - -__pycache__ -python/jupyter-widget/lib -python/jupyter-widget/docs -python/jupyter-widget/sanddance/nbextension -streamlit_sanddance.egg-info \ No newline at end of file diff --git a/docker-jekyll-local/Dockerfile b/docker-jekyll-local/Dockerfile new file mode 100644 index 000000000..b877f6d8c --- /dev/null +++ b/docker-jekyll-local/Dockerfile @@ -0,0 +1,13 @@ +FROM jekyll/jekyll:4.2.2 + +WORKDIR /srv/jekyll + +# Copy the docs directory +COPY docs/ ./ + +# Install dependencies +RUN bundle install + +EXPOSE 4000 + +CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "--port", "4000"] diff --git a/docker-jekyll-local/README.md b/docker-jekyll-local/README.md new file mode 100644 index 000000000..5fa9f7d39 --- /dev/null +++ b/docker-jekyll-local/README.md @@ -0,0 +1,34 @@ +# Jekyll Local Development with Docker + +This repository includes Docker setup for running Jekyll locally to preview the GitHub Pages site. + +## Quick Start + +### Start Jekyll +```bash +cd docker-jekyll-local +docker-compose up +``` + +### View your site +Open http://localhost:4000/SandDance/ in your browser + +### Stop Jekyll +Type ctrl-C in the terminal running `docker-compose up` + +## Other useful commands + +### Rebuild after changes +```bash +cd docker-jekyll-local +docker-compose build +``` + +## Files + +- `docker-jekyll-local/Dockerfile` - Jekyll container setup for local development +- `docker-jekyll-local/docker-compose.yml` - Container orchestration for local development +- `docs/Gemfile` - Jekyll dependencies (same as GitHub Pages) +- `docs/_config.yml` - Jekyll configuration + +The setup uses the same `github-pages` gem as GitHub Pages to ensure compatibility. diff --git a/docker-jekyll-local/docker-compose.yml b/docker-jekyll-local/docker-compose.yml new file mode 100644 index 000000000..c4ef06ab3 --- /dev/null +++ b/docker-jekyll-local/docker-compose.yml @@ -0,0 +1,10 @@ +services: + jekyll: + build: + context: .. + dockerfile: docker-jekyll-local/Dockerfile + ports: + - "4000:4000" + volumes: + - ../docs:/srv/jekyll + command: bundle exec jekyll serve --host 0.0.0.0 --port 4000 --force_polling \ No newline at end of file diff --git a/docs/Gemfile b/docs/Gemfile new file mode 100644 index 000000000..3a00aa5a1 --- /dev/null +++ b/docs/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +gem "github-pages", group: :jekyll_plugins +gem "webrick", "~> 1.7" diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock new file mode 100644 index 000000000..afb111fda --- /dev/null +++ b/docs/Gemfile.lock @@ -0,0 +1,281 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (7.2.2.2) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + benchmark (0.4.1) + bigdecimal (3.2.2) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + colorator (1.1.0) + commonmarker (0.23.11) + concurrent-ruby (1.3.5) + connection_pool (2.5.3) + csv (3.3.5) + dnsruby (1.72.4) + base64 (~> 0.2.0) + logger (~> 1.6.5) + simpleidn (~> 0.2.1) + drb (2.2.3) + em-websocket (0.5.3) + eventmachine (>= 0.12.9) + http_parser.rb (~> 0) + ethon (0.15.0) + ffi (>= 1.15.0) + eventmachine (1.2.7) + execjs (2.10.0) + faraday (2.13.4) + faraday-net_http (>= 2.0, < 3.5) + json + logger + faraday-net_http (3.4.1) + net-http (>= 0.5.0) + ffi (1.17.2-x86_64-linux-musl) + forwardable-extended (2.6.0) + gemoji (4.1.0) + github-pages (232) + github-pages-health-check (= 1.18.2) + jekyll (= 3.10.0) + jekyll-avatar (= 0.8.0) + jekyll-coffeescript (= 1.2.2) + jekyll-commonmark-ghpages (= 0.5.1) + jekyll-default-layout (= 0.1.5) + jekyll-feed (= 0.17.0) + jekyll-gist (= 1.5.0) + jekyll-github-metadata (= 2.16.1) + jekyll-include-cache (= 0.2.1) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) + jekyll-paginate (= 1.1.0) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.6.1) + jekyll-remote-theme (= 0.4.3) + jekyll-sass-converter (= 1.5.2) + jekyll-seo-tag (= 2.8.0) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.2.0) + jekyll-theme-cayman (= 0.2.0) + jekyll-theme-dinky (= 0.2.0) + jekyll-theme-hacker (= 0.2.0) + jekyll-theme-leap-day (= 0.2.0) + jekyll-theme-merlot (= 0.2.0) + jekyll-theme-midnight (= 0.2.0) + jekyll-theme-minimal (= 0.2.0) + jekyll-theme-modernist (= 0.2.0) + jekyll-theme-primer (= 0.6.0) + jekyll-theme-slate (= 0.2.0) + jekyll-theme-tactile (= 0.2.0) + jekyll-theme-time-machine (= 0.2.0) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.13.0) + kramdown (= 2.4.0) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.4) + mercenary (~> 0.3) + minima (= 2.5.1) + nokogiri (>= 1.16.2, < 2.0) + rouge (= 3.30.0) + terminal-table (~> 1.4) + webrick (~> 1.8) + github-pages-health-check (1.18.2) + addressable (~> 2.3) + dnsruby (~> 1.60) + octokit (>= 4, < 8) + public_suffix (>= 3.0, < 6.0) + typhoeus (~> 1.3) + html-pipeline (2.14.3) + activesupport (>= 2) + nokogiri (>= 1.4) + http_parser.rb (0.8.0) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + jekyll (3.10.0) + addressable (~> 2.4) + colorator (~> 1.0) + csv (~> 3.0) + em-websocket (~> 0.5) + i18n (>= 0.7, < 2) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 2.0) + kramdown (>= 1.17, < 3) + liquid (~> 4.0) + mercenary (~> 0.3.3) + pathutil (~> 0.9) + rouge (>= 1.7, < 4) + safe_yaml (~> 1.0) + webrick (>= 1.0) + jekyll-avatar (0.8.0) + jekyll (>= 3.0, < 5.0) + jekyll-coffeescript (1.2.2) + coffee-script (~> 2.2) + coffee-script-source (~> 1.12) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.5.1) + commonmarker (>= 0.23.7, < 1.1.0) + jekyll (>= 3.9, < 4.0) + jekyll-commonmark (~> 1.4.0) + rouge (>= 2.0, < 5.0) + jekyll-default-layout (0.1.5) + jekyll (>= 3.0, < 5.0) + jekyll-feed (0.17.0) + jekyll (>= 3.7, < 5.0) + jekyll-gist (1.5.0) + octokit (~> 4.2) + jekyll-github-metadata (2.16.1) + jekyll (>= 3.4, < 5.0) + octokit (>= 4, < 7, != 4.4.0) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) + jekyll-mentions (1.6.0) + html-pipeline (~> 2.3) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) + jekyll-paginate (1.1.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.6.1) + jekyll (>= 3.3, < 5.0) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) + jekyll-sass-converter (1.5.2) + sass (~> 3.4) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-cayman (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-dinky (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-hacker (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-leap-day (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-merlot (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-midnight (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-minimal (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-modernist (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-primer (0.6.0) + jekyll (> 3.5, < 5.0) + jekyll-github-metadata (~> 2.9) + jekyll-seo-tag (~> 2.0) + jekyll-theme-slate (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-tactile (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-theme-time-machine (0.2.0) + jekyll (> 3.5, < 5.0) + jekyll-seo-tag (~> 2.0) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) + jekyll-watch (2.2.1) + listen (~> 3.0) + jemoji (0.13.0) + gemoji (>= 3, < 5) + html-pipeline (~> 2.2) + jekyll (>= 3.0, < 5.0) + json (2.13.2) + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (4.0.4) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.6) + mercenary (0.3.6) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) + jekyll-feed (~> 0.9) + jekyll-seo-tag (~> 2.1) + minitest (5.25.5) + net-http (0.6.0) + uri + nokogiri (1.18.9-x86_64-linux-musl) + racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + pathutil (0.16.2) + forwardable-extended (~> 2.6) + public_suffix (5.1.1) + racc (1.8.1) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rexml (3.4.2) + rouge (3.30.0) + rubyzip (2.4.1) + safe_yaml (1.0.5) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + securerandom (0.4.1) + simpleidn (0.2.3) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + typhoeus (1.5.0) + ethon (>= 0.9.0, < 0.16.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (1.8.0) + uri (1.0.3) + webrick (1.9.1) + +PLATFORMS + x86_64-linux-musl + +DEPENDENCIES + github-pages + webrick (~> 1.7) + +BUNDLED WITH + 2.3.25 diff --git a/docs/app/js/sanddance-app.js b/docs/app/js/sanddance-app.js index bfeb0fd18..cdba06e5a 100644 --- a/docs/app/js/sanddance-app.js +++ b/docs/app/js/sanddance-app.js @@ -1,17600 +1,8447 @@ -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles - -(function ( - modules, - entry, - mainEntry, - parcelRequireName, - externals, - distDir, - publicUrl, - devServer -) { - /* eslint-disable no-undef */ - var globalObject = - typeof globalThis !== 'undefined' - ? globalThis - : typeof self !== 'undefined' - ? self - : typeof window !== 'undefined' - ? window - : typeof global !== 'undefined' - ? global - : {}; - /* eslint-enable no-undef */ - - // Save the require from previous bundle to this closure if any - var previousRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - - var importMap = previousRequire.i || {}; - var cache = previousRequire.cache || {}; - // Do not use `require` to prevent Webpack from trying to bundle this call - var nodeRequire = - typeof module !== 'undefined' && - typeof module.require === 'function' && - module.require.bind(module); - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - if (externals[name]) { - return externals[name]; - } - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error("Cannot find module '" + name + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = (cache[name] = new newRequire.Module(name)); - - modules[name][0].call( - module.exports, - localRequire, - module, - module.exports, - globalObject - ); +(function(global2, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.React, global2.ReactDOM)); +})(this, (function(React, ReactDOM) { + "use strict"; + function _interopNamespaceDefault(e) { + const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } }); + if (e) { + for (const k in e) { + if (k !== "default") { + const d2 = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d2.get ? d2 : { + enumerable: true, + get: () => e[k] + }); + } + } } - - return cache[name].exports; - - function localRequire(x) { - var res = localRequire.resolve(x); - return res === false ? {} : newRequire(res); - } - - function resolve(x) { - var id = modules[name][1][x]; - return id != null ? id : x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.require = nodeRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.distDir = distDir; - newRequire.publicUrl = publicUrl; - newRequire.devServer = devServer; - newRequire.i = importMap; - newRequire.register = function (id, exports) { - modules[id] = [ - function (require, module) { - module.exports = exports; - }, - {}, - ]; + n.default = e; + return Object.freeze(n); + } + const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React); + const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM); + const FieldNames = { + Active: "__SandDance__Active", + Collapsed: "__SandDance__Collapsed", + Contains: "__SandDance__Contains", + Count: "__SandDance__Count", + Sum: "__SandDance__Sum", + SumOfCount: "__SandDance__CountSum", + SumOfSum: "__SandDance__SumSum", + Selected: "__SandDance__Selected", + First: "__SandDance__First", + Last: "__SandDance__Last", + Top: "__SandDance__Top", + TopColor: "__SandDance__TopColor", + TopIndex: "__SandDance__TopIndex", + PowerBISelectionId: "__SandDance__PowerBISelectionId", + FacetSearch: "__SandDance__FacetSearch", + FacetTitle: "__SandDance__FacetTitle", + Ordinal: "__SandDance__Ordinal", + WrapCol: "__SandDance__WrapCol", + WrapRow: "__SandDance__WrapRow", + Value: "__SandDance__Value", + OffsetX: "__SandDance__X", + OffsetY: "__SandDance__Y", + OffsetHeight: "__SandDance__H", + OffsetWidth: "__SandDance__W" }; - - // Only insert newRequire.load when it is actually used. - // The code in this file is linted against ES5, so dynamic import is not allowed. - // INSERT_LOAD_HERE - - Object.defineProperty(newRequire, 'root', { - get: function () { - return globalObject[parcelRequireName]; - }, - }); - - globalObject[parcelRequireName] = newRequire; - - for (var i = 0; i < entry.length; i++) { - newRequire(entry[i]); - } - - if (mainEntry) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(mainEntry); - - // CommonJS - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === 'function' && define.amd) { - define(function () { - return mainExports; - }); + const ScaleNames = { + Color: "scale_color", + X: "scale_x", + Y: "scale_y", + Z: "scale_z" + }; + const SignalNames = { + ViewportWidth: "ViewportWidth", + ViewportHeight: "ViewportHeight", + MinCellWidth: "MinCellWidth", + MinCellHeight: "MinCellHeight", + PlotOffsetLeft: "PlotOffsetLeft", + PlotOffsetTop: "PlotOffsetTop", + PlotOffsetBottom: "PlotOffsetBottom", + PlotOffsetRight: "PlotOffsetRight", + PlotHeightIn: "PlotHeightIn", + PlotWidthIn: "PlotWidthIn", + PlotHeightOut: "PlotHeightOut", + PlotWidthOut: "PlotWidthOut", + ColorBinCount: "RoleColor_BinCountSignal", + ColorReverse: "RoleColor_ReverseSignal", + FacetAxesAdjustX: "RoleFacet_AxesAdjustSignalX", + FacetAxesAdjustY: "RoleFacet_AxesAdjustSignalY", + FacetBins: "RoleFacet_BinsSignal", + FacetVBins: "RoleFacetV_BinsSignal", + FacetPaddingTop: "FacetPaddingTop", + FacetPaddingBottom: "FacetPaddingBottom", + FacetPaddingLeft: "FacetPaddingLeft", + MarkOpacity: "Mark_OpacitySignal", + PointScale: "Chart_PointScaleSignal", + TextAngleX: "Text_AngleXSignal", + TextAngleY: "Text_AngleYSignal", + TextScale: "Text_ScaleSignal", + TextSize: "Text_SizeSignal", + TextTitleSize: "Text_TitleSizeSignal", + TreeMapMethod: "Chart_TreeMapMethodSignal", + XBins: "RoleX_BinsSignal", + YBins: "RoleY_BinsSignal", + ZHeight: "RoleZ_HeightSignal", + ZGrounded: "RoleZ_Grounded", + ZProportion: "RoleZ_ProportionSignal" + }; + const Other = "__Other"; + const ColorScaleNone = "none"; + const defaultBins = 10; + const maxbins = 100; + const minBarBandWidth = 15; + const minFacetWidth = 140; + const minFacetHeight = 180; + const facetPaddingLeft = 40; + const facetPaddingTop = 40; + const facetPaddingBottom = 40; + const facetPaddingRight = 40; + const axesLabelLimit = 100; + const axesTitleLimit = 100; + const axesTitlePaddingX = 30; + const axesTitlePaddingY = 60; + const axesTitlePaddingFacetX = 69; + const axesTitlePaddingFacetY = 92; + const axesOffsetX = 120; + const axesOffsetY = 120; + const scatterSizedDiv = 20; + const debounce$1 = 250; + function allowNoneForSize(specContext) { + switch (specContext.insight.totalStyle) { + case "sum-strip": + case "sum-strip-percent": + case "sum-treemap": + return false; + default: + return true; } } -})({"bxQeC":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var _base = require("./base"); -var _fluentUIComponents = require("./fluentUIComponents"); -var _sanddanceApp = require("./sanddanceApp"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -var _reactDom = require("react-dom"); -var _vega = require("vega"); -(0, _base.use)((0, _fluentUIComponents.fluentUI), _vega); -const staticContent = Array.from(document.querySelectorAll('a.sanddance-app-static-content')); -const dataSets = staticContent.filter((f)=>f.id).map((n)=>{ - const forData = staticContent.filter((f)=>f.dataset['for'] === n.id)[0]; - return { - dataSourceType: 'sample', - id: n.id, - displayName: n.dataset['displayName'], - dataUrl: n.href, - type: n.dataset['type'], - snapshotsUrl: forData ? forData.href : null - }; -}); -let explorer; -const undef = "undefined"; -_reactDom.render(_react.createElement((0, _sanddanceApp.SandDanceApp), { - setTheme: typeof setTheme !== undef && setTheme, - darkTheme: typeof darkTheme !== undef && darkTheme, - insights: typeof insights !== undef && insights, - initialOptions: typeof options !== undef && options, - themeColors: typeof themeColors !== undef && themeColors, - dataSources: dataSets, - mounted: (app)=>{ - explorer = app.explorer; - } -}), document.getElementById('app')); -const z = 'z'.charCodeAt(0); -const Z = 'Z'.charCodeAt(0); -document.onkeyup = (e)=>{ - //look for CTRL Z or CTRL SHIFT Z - if (e.ctrlKey && (e.keyCode === z || e.keyCode === Z)) { - if (e.shiftKey) explorer.redo(); - else explorer.undo(); - } -}; -window['SandDanceApp'] = { - explorer, - SandDanceExplorer: _sanddanceExplorer -}; - -},{"./base":"4CyyC","./fluentUIComponents":"dtgCh","./sanddanceApp":"7pzEo","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","react-dom":"1a3X3","vega":"75mIL"}],"4CyyC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param fluentUI FluentUI React library. - * @param vega Vega library. - * @param deck @deck.gl/core library. - * @param layers @deck.gl/layers library. - * @param luma @luma.gl/core library. - */ parcelHelpers.export(exports, "use", ()=>use); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -var _reactDom = require("react-dom"); -const base = { - fluentUI: null -}; -function use(fluentUI, vega) { - _sanddanceExplorer.use(fluentUI, _react, _reactDom, vega); - base.fluentUI = fluentUI; -} - -},{"@msrvida/sanddance-explorer":"cEojs","react":"jGrId","react-dom":"1a3X3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEojs":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getEmbedHTML", ()=>(0, _dataExporter.getEmbedHTML)); -parcelHelpers.export(exports, "SideTabId", ()=>(0, _interfaces.SideTabId)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "capabilities", ()=>(0, _canvas.capabilities)); -parcelHelpers.export(exports, "getColorSettingsFromThemePalette", ()=>(0, _themes.getColorSettingsFromThemePalette)); -parcelHelpers.export(exports, "themePalettes", ()=>(0, _themes.themePalettes)); -parcelHelpers.export(exports, "SandDance", ()=>(0, _sanddanceReact.SandDance)); -parcelHelpers.export(exports, "util", ()=>(0, _sanddanceReact.util)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "controls", ()=>_controls); -parcelHelpers.export(exports, "SandDanceReact", ()=>_sanddanceReact); -var _controls = require("./controls"); -var _dataExporter = require("./controls/dataExporter"); -var _interfaces = require("./interfaces"); -var _base = require("./base"); -var _canvas = require("./canvas"); -var _themes = require("./themes"); -var _explorer = require("./explorer"); -parcelHelpers.exportAll(_explorer, exports); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _version = require("./version"); - -},{"./controls":"j1PTB","./controls/dataExporter":"7XSio","./interfaces":"k3BwW","./base":"3TPz5","./canvas":"55nq5","./themes":"g7FJh","./explorer":"cQRoj","@msrvida/sanddance-react":"lPyTZ","./version":"CFT5Q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j1PTB":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _dialog = require("./dialog"); -parcelHelpers.exportAll(_dialog, exports); - -},{"./dialog":"OQi9w","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"OQi9w":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dialog", ()=>Dialog); -var _base = require("../base"); -var _language = require("../language"); -function Dialog(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Dialog, Object.assign({}, props, { - dialogContentProps: Object.assign({ - type: (0, _base.base).fluentUI.DialogType.normal, - title: props.title - }, props.dialogContentProps) - }), (0, _base.base).react.createElement("div", { - onKeyUp: (e)=>{ - e.nativeEvent.stopImmediatePropagation(); - } - }, props.children), (0, _base.base).react.createElement((0, _base.base).fluentUI.DialogFooter, null, props.buttons, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - iconProps: { - iconName: 'Cancel' - }, - onClick: props.onDismiss, - text: (0, _language.strings).buttonClose - }))); -} - -},{"../base":"3TPz5","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3TPz5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param fluentUI FluentUI React library. - * @param react React library. - * @param vega Vega library. - * @param deck @deck.gl/core library. - * @param layers @deck.gl/layers library. - * @param luma @luma.gl/core library. - */ parcelHelpers.export(exports, "use", ()=>use); -var _backgroundImageEditor = require("./dialogs/backgroundImageEditor"); -var _clickableTextLayer = require("./clickableTextLayer"); -var _columnTypeChanger = require("./controls/columnTypeChanger"); -var _dataExporter = require("./controls/dataExporter"); -var _chart = require("./dialogs/chart"); -var _search = require("./dialogs/search"); -var _settings = require("./dialogs/settings"); -var _snapshotEditor = require("./dialogs/snapshotEditor"); -var _snapshots = require("./dialogs/snapshots"); -var _transition = require("./dialogs/transition"); -var _explorer = require("./explorer"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _renderer = require("./controls/renderer"); -const base = { - fluentUI: null, - react: null, - reactDOM: null -}; -function use(fluentUI, react, reactDOM, vega) { - (0, _sanddanceReact.use)(react, reactDOM, vega); - base.fluentUI = fluentUI; - base.react = react; - base.reactDOM = reactDOM; - //inform React that we are using a dynamic base class - (0, _backgroundImageEditor.BackgroundImageEditor).prototype = react.Component.prototype; - (0, _chart.Chart).prototype = react.Component.prototype; - (0, _columnTypeChanger.ColumnTypeChanger).prototype = react.Component.prototype; - (0, _dataExporter.DataExportPicker).prototype = react.Component.prototype; - (0, _explorer.Explorer).prototype = react.Component.prototype; - (0, _clickableTextLayer.PositionedColumnMap).prototype = react.Component.prototype; - (0, _renderer.Renderer).prototype = react.Component.prototype; - (0, _search.Search).prototype = react.Component.prototype; - (0, _snapshotEditor.SnapshotEditor).prototype = react.Component.prototype; - (0, _snapshots.Snapshots).prototype = react.Component.prototype; - (0, _settings.Settings).prototype = react.Component.prototype; - (0, _transition.TransitionEditor).prototype = react.Component.prototype; -} - -},{"./dialogs/backgroundImageEditor":"hTdbK","./clickableTextLayer":"2iqEH","./controls/columnTypeChanger":"7dBYz","./controls/dataExporter":"7XSio","./dialogs/chart":"dwBpS","./dialogs/search":"eXzPo","./dialogs/settings":"2xbhO","./dialogs/snapshotEditor":"g29jp","./dialogs/snapshots":"sTI5I","./dialogs/transition":"3tDGl","./explorer":"cQRoj","@msrvida/sanddance-react":"lPyTZ","./controls/renderer":"4tj9B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hTdbK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BackgroundImageEditor", ()=>BackgroundImageEditor); -parcelHelpers.export(exports, "setInsightBackgroundImage", ()=>setInsightBackgroundImage); -var _base = require("../base"); -var _dialog = require("../controls/dialog"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -var _iconButton = require("../controls/iconButton"); -var _columns = require("../columns"); -function _BackgroundImageEditor(_props) { - class __BackgroundImageEditor extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - backgroundImageColumnBounds: [], - readyToApply: false, - hidden: true - }; - } - show(insightColumns) { - const { explorer, quantitativeColumns } = this.props; - if (!quantitativeColumns.length) //TODO show error - return; - const xCol = quantitativeColumns.filter((c)=>c.name === insightColumns.x)[0]; - const yCol = quantitativeColumns.filter((c)=>c.name === insightColumns.y)[0]; - let backgroundImageColumnBounds; - if (explorer.imageHolder.backgroundImageColumnBounds.length < quantitativeColumns.length * 4) backgroundImageColumnBounds = (0, _columns.getBackgroundImageColumnBounds)(explorer.state.dataContent.columns); - else backgroundImageColumnBounds = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(explorer.imageHolder.backgroundImageColumnBounds); - const newState = { - hidden: false, - xCol, - yCol, - backgroundImageColumnBounds - }; - !xCol || yCol; - this.setState(newState); - this.checkReady(); - } - render() { - const { props, state } = this; - const { explorer } = props; - return (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: state.hidden, - onDismiss: ()=>this.setState({ - hidden: true, - backgroundImageFileFormatError: null - }), - modalProps: { - containerClassName: 'sanddance-background-image-dialog' - }, - dialogContentProps: { - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelBackgroundImageDialogTitle, - subText: (0, _language.strings).labelBackgroundImageSubtext - }, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 'apply', - iconProps: { - iconName: 'Photo2Add' - }, - text: (0, _language.strings).buttonApply, - onClick: ()=>this.applyImage(true), - disabled: !state.readyToApply - }) - ] - }, explorer.imageHolder.img ? (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, (0, _base.base).react.createElement("img", { - src: explorer.imageHolder.img.src - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: 'remove', - iconProps: { - iconName: 'Photo2Remove' - }, - text: (0, _language.strings).buttonRemove, - onClick: ()=>{ - explorer.imageHolder.img = null; - this.applyImage(false); - this.setState({ - readyToApply: false - }); - } - })) : (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, (0, _base.base).react.createElement("input", { - type: "file", - onChange: (e)=>this.readBackgroundImage(e) - }), state.backgroundImageFileFormatError && (0, _base.base).react.createElement("div", { - className: "error" - }, state.backgroundImageFileFormatError)), this.inputForColumn(state.xCol, 'X axis', 'x', (0, _language.strings).labelBackgroundLeft, (0, _language.strings).labelBackgroundRight), this.inputForColumn(state.yCol, 'Y axis', 'y', (0, _language.strings).labelBackgroundBottom, (0, _language.strings).labelBackgroundTop)); - } - inputForColumn(column, label, dimension, minLabel, maxLabel) { - const { props, state } = this; - const fieldInput = (label, dataExtent, getDefault)=>{ - const bounds = state.backgroundImageColumnBounds.filter((b)=>b.columnName === (column === null || column === void 0 ? void 0 : column.name) && b.dimension === dimension && b.dataExtent === dataExtent)[0]; - if (!bounds) return null; - return (0, _base.base).react.createElement("div", { - className: 'axis-bound-field' - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: label, - onChange: (e, value)=>{ - const numericValue = +value; - bounds.stringValue = value; - bounds.valid = !(!value || isNaN(numericValue)); - if (bounds.valid) bounds.numericValue = numericValue; - this.setState({ - backgroundImageColumnBounds: [ - ...state.backgroundImageColumnBounds - ] - }); - this.checkReady(); - }, - value: bounds.stringValue, - errorMessage: bounds.valid ? null : (0, _language.strings).errorNumericValue, - onRenderSuffix: (a)=>{ - return (0, _base.base).react.createElement((0, _iconButton.IconButton), { - iconName: 'ScaleVolume', - themePalette: props.themePalette, - title: 'Use data extent' //TODO - , - onClick: ()=>{ - bounds.numericValue = getDefault(); - bounds.stringValue = bounds.numericValue.toString(); - bounds.valid = true; - this.setState({ - backgroundImageColumnBounds: [ - ...state.backgroundImageColumnBounds - ] - }); - this.checkReady(); - } - }); - } - })); - }; - return (0, _base.base).react.createElement("div", { - className: 'axis-bounds' - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Dropdown, { - label: label, - options: props.quantitativeColumns.map((c)=>{ - const option = { - key: c.name, - text: c.name - }; - return option; - }), - onChange: (e, o)=>{ - const newState = { - readyToApply: false - }; - const newColumn = props.quantitativeColumns.filter((c)=>c.name === o.key)[0]; - switch(dimension){ - case 'x': - newState.xCol = newColumn; - break; - case 'y': - newState.yCol = newColumn; - break; - } - this.setState(newState); - this.checkReady(); - }, - selectedKey: column === null || column === void 0 ? void 0 : column.name - }), (0, _base.base).react.createElement("div", { - className: 'axis-bound-fields' - }, fieldInput(minLabel, 'min', ()=>column.stats.min), fieldInput(maxLabel, 'max', ()=>column.stats.max))); - } - readBackgroundImage(e) { - if (e.target.files) { - const file = e.target.files[0]; - const reader = new FileReader(); - reader.onload = ()=>{ - const img = new Image(); - img.onerror = ()=>{ - this.setState({ - backgroundImageFileFormatError: (0, _language.strings).errorImageFormat - }); - }; - img.onload = ()=>{ - //success - const { src, height, width } = img; - this.props.explorer.imageHolder.img = { - src, - height, - width - }; - this.checkReady(); - }; - try { - img.src = reader.result; - } catch (e) { - this.setState({ - backgroundImageFileFormatError: (0, _language.strings).errorImageFormat - }); - } - }; - reader.readAsDataURL(file); - } - } - checkReady() { - //allow state to resolve - setTimeout(()=>{ - const { state, props } = this; - const { explorer } = props; - const { backgroundImageColumnBounds } = state; - let valid = true; - const dimensions = [ - 'x', - 'y' - ]; - const dataExtents = [ - 'max', - 'min' - ]; - [ - state.xCol, - state.yCol - ].forEach((c)=>dimensions.forEach((dimension)=>dataExtents.forEach((dataExtent)=>{ - const bounds = backgroundImageColumnBounds.filter((b)=>b.columnName === c.name && b.dataExtent === dataExtent && b.dimension === dimension)[0]; - if (!bounds.valid) valid = false; - }))); - const readyToApply = explorer.imageHolder.img && valid; //TODO if not already applied - this.setState({ - readyToApply - }); - }, 0); + function barchartH(specContext) { + var _a2, _b2, _c2, _d2; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes + }; + const x2 = { title: null }; + const axisScales = { + x: x2, + y: { title: (_a2 = specColumns.y) === null || _a2 === void 0 ? void 0 : _a2.name }, + z: { title: (_b2 = specColumns.z) === null || _b2 === void 0 ? void 0 : _b2.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight; + if (totalStyle === "sum-strip-percent") { + x2.aggregate = "percent"; + x2.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "left", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + x2.aggregate = "sum"; + x2.title = language.sum; + const treemapProps = { + corner: "top-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + x2.aggregate = "sum"; + x2.title = language.sum; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + x2.aggregate = "count"; + x2.title = language.count; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; } - applyImage(showBackgroundImage) { - const { props, state } = this; - const { explorer } = props; - explorer.imageHolder.showBackgroundImage = showBackgroundImage; - explorer.imageHolder.backgroundImageColumnBounds = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(state.backgroundImageColumnBounds); - if (showBackgroundImage) switch(props.chart){ - case 'density': - case 'scatterplot': - case 'stacks': - break; - default: - //TODO use xcol & ycol - //make sure x & y are numeric - explorer.changeChartType('scatterplot'); - return; - } - explorer.forceUpdate(); + default: { + x2.aggregate = "count"; + x2.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "down-right", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; } + } } - return new __BackgroundImageEditor(_props); -} -const BackgroundImageEditor = _BackgroundImageEditor; -function setInsightBackgroundImage(insight, imageHolder, columns) { - if (!imageHolder.showBackgroundImage || !columns.x || !columns.y) return; - const { backgroundImageColumnBounds } = imageHolder; - const xBounds = backgroundImageColumnBounds.filter((b)=>b.columnName === columns.x && b.dimension === 'x'); - const yBounds = backgroundImageColumnBounds.filter((b)=>b.columnName === columns.y && b.dimension === 'y'); - if (!xBounds.length || !yBounds.length) return; - const allBounds = [ - ...xBounds, - ...yBounds - ]; - for(let i = 0; i < allBounds.length; i++){ - if (!allBounds[i].valid) return; - } - const bottom = yBounds.filter((b)=>b.dataExtent === 'min')[0]; - const left = xBounds.filter((b)=>b.dataExtent === 'min')[0]; - const right = xBounds.filter((b)=>b.dataExtent === 'max')[0]; - const top = yBounds.filter((b)=>b.dataExtent === 'max')[0]; - const all = [ - bottom, - left, - right, - top - ]; - for(let i = 0; i < all.length; i++){ - if (!all[i]) return; - } - const { src, height, width } = imageHolder.img; - insight.backgroundImage = { - url: src, - size: { - height, - width - }, - extents: { - bottom: bottom.numericValue, - left: left.numericValue, - right: right.numericValue, - top: top.numericValue - } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "y", + binnable: true, + axisSelection: ((_c2 = specColumns.y) === null || _c2 === void 0 ? void 0 : _c2.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_d2 = specColumns.z) === null || _d2 === void 0 ? void 0 : _d2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } }; - insight.size = insight.backgroundImage.size; -} - -},{"../base":"3TPz5","../controls/dialog":"OQi9w","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","../controls/iconButton":"6pZiK","../columns":"7ZE4v","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPyTZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Viewer", ()=>(0, _viewer.Viewer)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "SandDance", ()=>_sanddance); -parcelHelpers.export(exports, "util", ()=>_util); -var _sanddance = require("@msrvida/sanddance"); -var _util = require("./util"); -var _viewer = require("./viewer"); -var _base = require("./base"); -var _version = require("./version"); - -},{"@msrvida/sanddance":"ganM8","./util":"71zHd","./viewer":"2yfj3","./base":"e2btd","./version":"g42QN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ganM8":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "colorSchemes", ()=>(0, _colorSchemes.colorSchemes)); -parcelHelpers.export(exports, "constants", ()=>_constants); -parcelHelpers.export(exports, "searchExpression", ()=>_searchExpression); -parcelHelpers.export(exports, "specs", ()=>_sanddanceSpecs); -parcelHelpers.export(exports, "types", ()=>_types); -parcelHelpers.export(exports, "use", ()=>use); -parcelHelpers.export(exports, "util", ()=>_util); -parcelHelpers.export(exports, "VegaMorphCharts", ()=>_vegaMorphcharts); -parcelHelpers.export(exports, "Viewer", ()=>(0, _viewer.Viewer)); -var _constants = require("./constants"); -var _searchExpression = require("@msrvida/search-expression"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _types = require("./types"); -var _util = require("./util"); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _colorSchemes = require("./colorSchemes"); -var _viewer = require("./viewer"); -var _version = require("./version"); -const use = (0, _vegaMorphcharts.use); - -},{"./constants":"ix2qh","@msrvida/search-expression":"4F93b","@msrvida/sanddance-specs":"aOvSr","./types":"bD3z1","./util":"g08sL","@msrvida/vega-morphcharts":"9Sd5M","./colorSchemes":"iDNR0","./viewer":"9IMa3","./version":"7m9yM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ix2qh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorScaleNone", ()=>(0, _sanddanceSpecs.ColorScaleNone)); -parcelHelpers.export(exports, "FieldNames", ()=>(0, _sanddanceSpecs.FieldNames)); -parcelHelpers.export(exports, "ScaleNames", ()=>(0, _sanddanceSpecs.ScaleNames)); -parcelHelpers.export(exports, "SignalNames", ()=>(0, _sanddanceSpecs.SignalNames)); -parcelHelpers.export(exports, "GL_ORDINAL", ()=>GL_ORDINAL); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -const GL_ORDINAL = 'GL_ORDINAL'; - -},{"@msrvida/sanddance-specs":"aOvSr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aOvSr":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _build = require("./build"); -parcelHelpers.exportAll(_build, exports); -var _constants = require("./constants"); -parcelHelpers.exportAll(_constants, exports); -var _inference = require("./inference"); -parcelHelpers.exportAll(_inference, exports); -var _interfaces = require("./interfaces"); -parcelHelpers.exportAll(_interfaces, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./build":"dNBKI","./constants":"22TRA","./inference":"aEiKQ","./interfaces":"d6Ht8","./types":"1NHSP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dNBKI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "build", ()=>build); -var _charts = require("./charts"); -var _inference = require("./inference"); -var _specBuilder = require("./specBuilder"); -function build(specContext, currData) { - const { specColumns } = specContext; - const columns = [ - specColumns.color, - specColumns.facet, - specColumns.facetV, - specColumns.group, - specColumns.size, - specColumns.sort, - specColumns.x, - specColumns.y, - specColumns.z - ]; - (0, _inference.inferAll)(columns, currData); - const specBuilderProps = (0, _charts.getSpecBuilderPropsForChart)(specContext); - const specBuilder = new (0, _specBuilder.SpecBuilder)(specBuilderProps, specContext); - let specResult; - if (specBuilder) { - try { - const errors = specBuilder.validate(); - if (errors.length) specResult = { - errors, - specCapabilities: specBuilderProps.specCapabilities, - vegaSpec: null - }; - else specResult = specBuilder.build(); - } catch (e) { - specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [ - e.stack - ] - }; + } + function barchartV(specContext) { + var _a2, _b2; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes + }; + const y2 = { title: null }; + const axisScales = { + x: { title: specColumns.x && specColumns.x.name }, + y: y2, + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight; + if (totalStyle === "sum-strip-percent") { + y2.aggregate = "percent"; + y2.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "bottom", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + y2.aggregate = "sum"; + y2.title = language.sum; + const treemapProps = { + corner: "bottom-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + y2.aggregate = "sum"; + y2.title = language.sum; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + y2.aggregate = "count"; + y2.title = language.count; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; } - if (!specResult.errors) { - const data0 = specResult.vegaSpec.data[0]; - data0.values = currData; + default: { + y2.aggregate = "count"; + y2.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-up", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; } - } else specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [ - `could not build spec for ${specContext.insight.chart}` + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "z", + axisSelection: ((_b2 = specColumns.z) === null || _b2 === void 0 ? void 0 : _b2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } ] + } }; - return specResult; -} - -},{"./charts":"gjBpZ","./inference":"aEiKQ","./specBuilder":"h5flx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gjBpZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSpecBuilderPropsForChart", ()=>getSpecBuilderPropsForChart); -var _barchartH = require("./barchartH"); -var _barchartHDefault = parcelHelpers.interopDefault(_barchartH); -var _barchartV = require("./barchartV"); -var _barchartVDefault = parcelHelpers.interopDefault(_barchartV); -var _density = require("./density"); -var _densityDefault = parcelHelpers.interopDefault(_density); -var _grid = require("./grid"); -var _gridDefault = parcelHelpers.interopDefault(_grid); -var _scatterplot = require("./scatterplot"); -var _scatterplotDefault = parcelHelpers.interopDefault(_scatterplot); -var _stacks = require("./stacks"); -var _stacksDefault = parcelHelpers.interopDefault(_stacks); -var _strips = require("./strips"); -var _stripsDefault = parcelHelpers.interopDefault(_strips); -var _treemap = require("./treemap"); -var _treemapDefault = parcelHelpers.interopDefault(_treemap); -var _facetLayout = require("../facetLayout"); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -const map = { - barchart: (0, _barchartVDefault.default), - barchartH: (0, _barchartHDefault.default), - barchartV: (0, _barchartVDefault.default), - density: (0, _densityDefault.default), - grid: (0, _gridDefault.default), - scatterplot: (0, _scatterplotDefault.default), - stacks: (0, _stacksDefault.default), - strips: (0, _stripsDefault.default), - treemap: (0, _treemapDefault.default) -}; -function getSpecBuilderPropsForChart(specContext) { + } + function density(specContext) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; const { insight, specColumns, specViewOptions } = specContext; - const fn = map[insight.chart]; - if (fn) { - const props = fn(specContext); - if (insight.columns.facet) { - const discreteFacetColumn = { - column: specColumns.facet, - defaultBins: (0, _defaults.defaultBins), - maxbins: (0, _defaults.maxbins), - maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, - maxbinsSignalName: (0, _constants.SignalNames).FacetBins - }; - const discreteFacetVColumn = { - column: specColumns.facetV, - defaultBins: (0, _defaults.defaultBins), - maxbins: (0, _defaults.maxbins), - maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, - maxbinsSignalName: (0, _constants.SignalNames).FacetVBins - }; - const { facetLayout, layoutPair } = (0, _facetLayout.getFacetLayout)(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); - props.layouts.unshift(layoutPair); - props.facetLayout = facetLayout; - props.collapseFacetAxes = specViewOptions.collapseFacetAxes; - } - return props; - } -} - -},{"./barchartH":"36QjZ","./barchartV":"6xzC3","./density":"3nLmY","./grid":"8jSVp","./scatterplot":"cktKX","./stacks":"7r3BC","./strips":"8tBSJ","./treemap":"3rGzu","../facetLayout":"5wBmI","../constants":"22TRA","../defaults":"jpVjH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"36QjZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes + const axisScales = { + x: { title: (_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.name }, + y: { title: (_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.name }, + z: { title: (_c2 = specColumns.z) === null || _c2 === void 0 ? void 0 : _c2.name } + }; + const backgroundImage = ((_d2 = specColumns.x) === null || _d2 === void 0 ? void 0 : _d2.quantitative) && ((_e2 = specColumns.y) === null || _e2 === void 0 ? void 0 : _e2.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } + }; + const aggProps = { + onBuild: null, + aggregation: null, + sumBy: specColumns.size + }; + const layouts = [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "AggregateSquare", + props: aggProps + } + ]; + const { totalStyle, view } = insight; + switch (totalStyle) { + case "sum-treemap": { + aggProps.aggregation = "sum"; + const treemapProps = { + corner: "bottom-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view }; - const x = { - title: null + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + aggProps.aggregation = "sum"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view }; - const axisScales = { - x, - y: { - title: (_a = specColumns.y) === null || _a === void 0 ? void 0 : _a.name - }, - z: { - title: (_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.name - } + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + aggProps.aggregation = "count"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view }; - const layouts = [ - { - layoutType: 'Band', - props: bandProps - } - ]; - const { totalStyle, view } = insight; - if (totalStyle === 'sum-strip-percent') { - x.aggregate = 'percent'; - x.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: 'left', - globalAggregateMaxExtentSignal: 'aggMaxExtent', - globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: 'AggregateContainer', - props: aggProps - }); - switch(totalStyle){ - case 'sum-treemap': - { - x.aggregate = 'sum'; - x.title = language.sum; - const treemapProps = { - corner: 'top-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - x.aggregate = 'sum'; - x.title = language.sum; - const stripProps = { - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - x.aggregate = 'count'; - x.title = language.count; - const stripProps = { - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - x.aggregate = 'count'; - x.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'down-right', - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: 'y', - binnable: true, - axisSelection: ((_c = specColumns.y) === null || _c === void 0 ? void 0 : _c.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'z', - axisSelection: ((_d = specColumns.z) === null || _d === void 0 ? void 0 : _d.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + default: { + aggProps.aggregation = "count"; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + maxGroupedUnits: null, + maxGroupedFillSize: null, + showAxes, + view + }; + aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled) => { + squareProps.maxGroupedUnits = aggMaxExtent; + squareProps.maxGroupedFillSize = aggMaxExtentScaled; }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"22TRA","../defaults":"jpVjH","../size":"h7gMN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"22TRA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FieldNames", ()=>FieldNames); -parcelHelpers.export(exports, "ScaleNames", ()=>ScaleNames); -parcelHelpers.export(exports, "SignalNames", ()=>SignalNames); -parcelHelpers.export(exports, "Other", ()=>Other); -parcelHelpers.export(exports, "ColorScaleNone", ()=>ColorScaleNone); -const FieldNames = { - Active: '__SandDance__Active', - Collapsed: '__SandDance__Collapsed', - Contains: '__SandDance__Contains', - Count: '__SandDance__Count', - Sum: '__SandDance__Sum', - SumOfCount: '__SandDance__CountSum', - SumOfSum: '__SandDance__SumSum', - Selected: '__SandDance__Selected', - First: '__SandDance__First', - Last: '__SandDance__Last', - Top: '__SandDance__Top', - TopColor: '__SandDance__TopColor', - TopIndex: '__SandDance__TopIndex', - PowerBISelectionId: '__SandDance__PowerBISelectionId', - FacetSearch: '__SandDance__FacetSearch', - FacetTitle: '__SandDance__FacetTitle', - Ordinal: '__SandDance__Ordinal', - WrapCol: '__SandDance__WrapCol', - WrapRow: '__SandDance__WrapRow', - Value: '__SandDance__Value', - OffsetX: '__SandDance__X', - OffsetY: '__SandDance__Y', - OffsetHeight: '__SandDance__H', - OffsetWidth: '__SandDance__W' -}; -const ScaleNames = { - Color: 'scale_color', - X: 'scale_x', - Y: 'scale_y', - Z: 'scale_z' -}; -const SignalNames = { - ViewportWidth: 'ViewportWidth', - ViewportHeight: 'ViewportHeight', - MinCellWidth: 'MinCellWidth', - MinCellHeight: 'MinCellHeight', - PlotOffsetLeft: 'PlotOffsetLeft', - PlotOffsetTop: 'PlotOffsetTop', - PlotOffsetBottom: 'PlotOffsetBottom', - PlotOffsetRight: 'PlotOffsetRight', - PlotHeightIn: 'PlotHeightIn', - PlotWidthIn: 'PlotWidthIn', - PlotHeightOut: 'PlotHeightOut', - PlotWidthOut: 'PlotWidthOut', - ColorBinCount: 'RoleColor_BinCountSignal', - ColorReverse: 'RoleColor_ReverseSignal', - FacetAxesAdjustX: 'RoleFacet_AxesAdjustSignalX', - FacetAxesAdjustY: 'RoleFacet_AxesAdjustSignalY', - FacetBins: 'RoleFacet_BinsSignal', - FacetVBins: 'RoleFacetV_BinsSignal', - FacetPaddingTop: 'FacetPaddingTop', - FacetPaddingBottom: 'FacetPaddingBottom', - FacetPaddingLeft: 'FacetPaddingLeft', - MarkOpacity: 'Mark_OpacitySignal', - PointScale: 'Chart_PointScaleSignal', - TextAngleX: 'Text_AngleXSignal', - TextAngleY: 'Text_AngleYSignal', - TextScale: 'Text_ScaleSignal', - TextSize: 'Text_SizeSignal', - TextTitleSize: 'Text_TitleSizeSignal', - TreeMapMethod: 'Chart_TreeMapMethodSignal', - XBins: 'RoleX_BinsSignal', - YBins: 'RoleY_BinsSignal', - ZHeight: 'RoleZ_HeightSignal', - ZGrounded: 'RoleZ_Grounded', - ZProportion: 'RoleZ_ProportionSignal' -}; -const Other = '__Other'; -const ColorScaleNone = 'none'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j7FRh":[function(require,module,exports,__globalThis) { -exports.interopDefault = function(a) { - return a && a.__esModule ? a : { - default: a - }; -}; -exports.defineInteropFlag = function(a) { - Object.defineProperty(a, '__esModule', { - value: true - }); -}; -exports.exportAll = function(source, dest) { - Object.keys(source).forEach(function(key) { - if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return; - Object.defineProperty(dest, key, { - enumerable: true, - get: function() { - return source[key]; - } + layouts.push({ + layoutType: "Square", + props: squareProps }); - }); - return dest; -}; -exports.export = function(dest, destName, get) { - Object.defineProperty(dest, destName, { - enumerable: true, - get: get - }); -}; - -},{}],"jpVjH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ //TODO move these to options -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultBins", ()=>defaultBins); -parcelHelpers.export(exports, "maxbins", ()=>maxbins); -parcelHelpers.export(exports, "minBarBandWidth", ()=>minBarBandWidth); -parcelHelpers.export(exports, "minFacetWidth", ()=>minFacetWidth); -parcelHelpers.export(exports, "minFacetHeight", ()=>minFacetHeight); -parcelHelpers.export(exports, "facetPaddingLeft", ()=>facetPaddingLeft); -parcelHelpers.export(exports, "facetPaddingTop", ()=>facetPaddingTop); -parcelHelpers.export(exports, "facetPaddingBottom", ()=>facetPaddingBottom); -parcelHelpers.export(exports, "facetPaddingRight", ()=>facetPaddingRight); -parcelHelpers.export(exports, "axesLabelLimit", ()=>axesLabelLimit); -parcelHelpers.export(exports, "axesTitleLimit", ()=>axesTitleLimit); -parcelHelpers.export(exports, "axesTitlePaddingX", ()=>axesTitlePaddingX); -parcelHelpers.export(exports, "axesTitlePaddingY", ()=>axesTitlePaddingY); -parcelHelpers.export(exports, "axesTitlePaddingFacetX", ()=>axesTitlePaddingFacetX); -parcelHelpers.export(exports, "axesTitlePaddingFacetY", ()=>axesTitlePaddingFacetY); -parcelHelpers.export(exports, "axesOffsetX", ()=>axesOffsetX); -parcelHelpers.export(exports, "axesOffsetY", ()=>axesOffsetY); -parcelHelpers.export(exports, "scatterSizedMin", ()=>scatterSizedMin); -parcelHelpers.export(exports, "scatterSizedDiv", ()=>scatterSizedDiv); -parcelHelpers.export(exports, "debounce", ()=>debounce); -const defaultBins = 10; -const maxbins = 100; -const minBarBandWidth = 15; -const minFacetWidth = 140; -const minFacetHeight = 180; -const facetPaddingLeft = 40; -const facetPaddingTop = 40; -const facetPaddingBottom = 40; -const facetPaddingRight = 40; -const axesLabelLimit = 100; -const axesTitleLimit = 100; -const axesTitlePaddingX = 30; -const axesTitlePaddingY = 60; -const axesTitlePaddingFacetX = 69; -const axesTitlePaddingFacetY = 92; -const axesOffsetX = 120; -const axesOffsetY = 120; -const scatterSizedMin = 10; -const scatterSizedDiv = 20; -const debounce = 250; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7gMN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "allowNoneForSize", ()=>allowNoneForSize); -function allowNoneForSize(specContext) { - switch(specContext.insight.totalStyle){ - case 'sum-strip': - case 'sum-strip-percent': - case 'sum-treemap': - return false; - default: - //if totalStyle is blank, count is assumed - return true; + break; + } } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6xzC3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes - }; - const y = { - title: null - }; - const axisScales = { - x: { - title: specColumns.x && specColumns.x.name - }, - y, - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = [ - { - layoutType: 'Band', - props: bandProps - } - ]; - const { totalStyle, view } = insight; - if (totalStyle === 'sum-strip-percent') { - y.aggregate = 'percent'; - y.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: 'descending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: 'bottom', - globalAggregateMaxExtentSignal: 'aggMaxExtent', - globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: 'AggregateContainer', - props: aggProps - }); - switch(totalStyle){ - case 'sum-treemap': - { - y.aggregate = 'sum'; - y.title = language.sum; - const treemapProps = { - corner: 'bottom-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - y.aggregate = 'sum'; - y.title = language.sum; - const stripProps = { - sortOrder: 'descending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - y.aggregate = 'count'; - y.title = language.count; - const stripProps = { - sortOrder: 'descending', - orientation: 'vertical', - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - y.aggregate = 'count'; - y.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-up', - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'z', - axisSelection: ((_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"22TRA","../defaults":"jpVjH","../size":"h7gMN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3nLmY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { - title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name - }, - y: { - title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name - }, - z: { - title: (_c = specColumns.z) === null || _c === void 0 ? void 0 : _c.name - } - }; - const backgroundImage = ((_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.top, - min: backgroundImage.extents.bottom - } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.right, - min: backgroundImage.extents.left - } - }; - const aggProps = { - onBuild: null, - aggregation: null, - sumBy: specColumns.size - }; - const layouts = [ - { - layoutType: 'Band', - props: vBandProps - }, - { - layoutType: 'Band', - props: hBandProps - }, - { - layoutType: 'AggregateSquare', - props: aggProps - } - ]; - const { totalStyle, view } = insight; - switch(totalStyle){ - case 'sum-treemap': - { - aggProps.aggregation = 'sum'; - const treemapProps = { - corner: 'bottom-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - aggProps.aggregation = 'sum'; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - aggProps.aggregation = 'count'; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - aggProps.aggregation = 'count'; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-down', - z: specColumns.z, - maxGroupedUnits: null, - maxGroupedFillSize: null, - showAxes, - view - }; - aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled)=>{ - squareProps.maxGroupedUnits = aggMaxExtent; - squareProps.maxGroupedFillSize = aggMaxExtentScaled; - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - return { - axisScales, - layouts, - specCapabilities: { - backgroundImage: true, - countsAndSums: true, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'y', - binnable: true, - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'z', - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"22TRA","../defaults":"jpVjH","../size":"h7gMN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8jSVp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns } = specContext; - const { view } = insight; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-down', - z: specColumns.z, - collapseYHeight: true, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - return { - axisScales, - layouts: [ - { - layoutType: 'Square', - props: squareProps - } - ], - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cktKX":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const backgroundImageExtents = ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative) && ((_c = insight.backgroundImage) === null || _c === void 0 ? void 0 : _c.extents); - const scatterProps = { - x: specColumns.x, - y: specColumns.y, - z: specColumns.z, - size: specColumns.size, - scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, - zGrounded: specViewOptions.language.zGrounded, - backgroundImageExtents, - showAxes: !(backgroundImageExtents || insight.hideAxes), - view: insight.view - }; - const axisScales = { - x: { - title: (_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.name - }, - y: { - title: (_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.name - }, - z: { - title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name - } - }; - return { - axisScales, - layouts: [ - { - layoutType: 'Scatter', - props: scatterProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: 'x', - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact' - }, - { - role: 'y', - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact' - }, - { - role: 'z', - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: false - }, - { - role: 'color', - allowNone: true - }, - { - role: 'size', - excludeCategoric: true, - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ], - signals: [ - (0, _constants.SignalNames).PointScale, - (0, _constants.SignalNames).ZGrounded - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7r3BC":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { - title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name - }, - y: { - title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name - }, - z: { - title: specViewOptions.language.count - } - }; - const backgroundImage = ((_c = specColumns.x) === null || _c === void 0 ? void 0 : _c.quantitative) && ((_d = specColumns.y) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = insight.backgroundImage) === null || _e === void 0 ? void 0 : _e.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.top, - min: backgroundImage.extents.bottom - } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.right, - min: backgroundImage.extents.left - } - }; - const stackProps = { - sort: specColumns.sort, - showAxes - }; - return { - axisScales, - customZScale: true, - layouts: [ - { - layoutType: 'Band', - props: vBandProps - }, - { - layoutType: 'Band', - props: hBandProps - }, - { - layoutType: 'Stack', - props: stackProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'y', - binnable: true, - axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _defaults = require("../defaults"); -var _constants = require("../constants"); - -},{"../defaults":"jpVjH","../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8tBSJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns } = specContext; - const { view } = insight; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: specColumns.size ? 'sum' : 'count' - }; - const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; - const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; - const props = { - dock: 'top', - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: 'AggregateContainer', - props - }); - } - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'size', - allowNone: true, - excludeCategoric: true - }, - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rGzu":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns, specViewOptions } = specContext; - const { view } = insight; - const treemapProps = { - corner: 'top-left', - group: specColumns.group, - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: 'sum' - }; - const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; - const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; - const props = { - dock: 'top', - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: 'AggregateContainer', - props - }); - } - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'size', - excludeCategoric: true - }, - { - role: 'group', - allowNone: true - }, - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ], - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5wBmI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getFacetLayout", ()=>getFacetLayout); -var _defaults = require("./defaults"); -function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { - let layoutPair; - const groupby = facetColumn; - const plotPadding = { - x: 0, - y: 0 - }; - let facetPadding; - switch(facetStyle){ - case 'cross': - { - const props = { - axisTextColor, - colRowTitles: true, - groupbyX: groupby, - groupbyY: facetVColumn - }; - layoutPair = { - layoutType: 'Cross', - props - }; - facetPadding = { - bottom: (0, _defaults.facetPaddingBottom), - left: (0, _defaults.facetPaddingLeft), - top: 0 - }; - plotPadding.y = (0, _defaults.facetPaddingTop); - plotPadding.x = (0, _defaults.facetPaddingRight); - break; - } - case 'wrap': - default: - { - const props = { - axisTextColor, - cellTitles: true, - groupby - }; - layoutPair = { - layoutType: 'Wrap', - props - }; - facetPadding = { - bottom: (0, _defaults.facetPaddingBottom), - left: (0, _defaults.facetPaddingLeft), - top: (0, _defaults.facetPaddingTop) - }; - break; - } - } - const facetLayout = { - facetPadding, - plotPadding - }; - return { - layoutPair, - facetLayout - }; -} - -},{"./defaults":"jpVjH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aEiKQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnsFromData", ()=>(0, _dataInference.getColumnsFromData)); -parcelHelpers.export(exports, "getStats", ()=>(0, _dataInference.getStats)); -parcelHelpers.export(exports, "inferAll", ()=>(0, _dataInference.inferAll)); -/** - * Get columns associated with each Insight role. - * @param insight Insight to specify column roles. - * @param columns Array of Columns inferred from the data. - */ parcelHelpers.export(exports, "getSpecColumns", ()=>getSpecColumns); -var _dataInference = require("@msrvida/data-inference"); -function getSpecColumns(insight, columns) { - function getColumnByName(name) { - return columns.filter((c)=>c.name === name)[0]; - } - return { - color: getColumnByName(insight.columns && insight.columns.color), - facet: getColumnByName(insight.columns && insight.columns.facet), - facetV: getColumnByName(insight.columns && insight.columns.facetV), - group: getColumnByName(insight.columns && insight.columns.group), - size: getColumnByName(insight.columns && insight.columns.size), - sort: getColumnByName(insight.columns && insight.columns.sort), - uid: getColumnByName(insight.columns && insight.columns.uid), - x: getColumnByName(insight.columns && insight.columns.x), - y: getColumnByName(insight.columns && insight.columns.y), - z: getColumnByName(insight.columns && insight.columns.z) - }; -} - -},{"@msrvida/data-inference":"wjoyE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"wjoyE":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _color = require("./color"); -parcelHelpers.exportAll(_color, exports); -var _inference = require("./inference"); -parcelHelpers.exportAll(_inference, exports); -var _numeric = require("./numeric"); -parcelHelpers.exportAll(_numeric, exports); -var _stats = require("./stats"); -parcelHelpers.exportAll(_stats, exports); -var _summary = require("./summary"); -parcelHelpers.exportAll(_summary, exports); - -},{"./color":"jS4V7","./inference":"2vdcV","./numeric":"hDLgJ","./stats":"jRSDf","./summary":"4Nkk9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jS4V7":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isColor", ()=>isColor); -parcelHelpers.export(exports, "checkIsColorData", ()=>checkIsColorData); -var _d3Color = require("d3-color"); -function isColor(cssColorSpecifier) { - return !!(0, _d3Color.color)(cssColorSpecifier); -} -function checkIsColorData(data, column) { - if (!column.stats.hasColorData) { - column.isColorData = false; - return; - } - for(let i = 0; i < data.length; i++)if (!isColor(data[i][column.name])) { - column.isColorData = false; - return; - } - column.isColorData = true; -} - -},{"d3-color":"37LNF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"37LNF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "color", ()=>(0, _colorJsDefault.default)); -parcelHelpers.export(exports, "rgb", ()=>(0, _colorJs.rgb)); -parcelHelpers.export(exports, "hsl", ()=>(0, _colorJs.hsl)); -parcelHelpers.export(exports, "lab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "hcl", ()=>(0, _labJs.hcl)); -parcelHelpers.export(exports, "lch", ()=>(0, _labJs.lch)); -parcelHelpers.export(exports, "gray", ()=>(0, _labJs.gray)); -parcelHelpers.export(exports, "cubehelix", ()=>(0, _cubehelixJsDefault.default)); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); - -},{"./color.js":"1ttKl","./lab.js":"1NJbB","./cubehelix.js":"ddL6Z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1ttKl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -parcelHelpers.export(exports, "darker", ()=>darker); -parcelHelpers.export(exports, "brighter", ()=>brighter); -parcelHelpers.export(exports, "default", ()=>color); -parcelHelpers.export(exports, "rgbConvert", ()=>rgbConvert); -parcelHelpers.export(exports, "rgb", ()=>rgb); -parcelHelpers.export(exports, "Rgb", ()=>Rgb); -parcelHelpers.export(exports, "hslConvert", ()=>hslConvert); -parcelHelpers.export(exports, "hsl", ()=>hsl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -function Color() {} -var darker = 0.7; -var brighter = 1 / darker; -var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); -var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 -}; -(0, _defineJsDefault.default)(Color, color, { - copy (channels) { - return Object.assign(new this.constructor, this, channels); - }, - displayable () { - return this.rgb().displayable(); - }, - hex: color_formatHex, - formatHex: color_formatHex, - formatHex8: color_formatHex8, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb -}); -function color_formatHex() { - return this.rgb().formatHex(); -} -function color_formatHex8() { - return this.rgb().formatHex8(); -} -function color_formatHsl() { - return hslConvert(this).formatHsl(); -} -function color_formatRgb() { - return this.rgb().formatRgb(); -} -function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 - : null // invalid hex - ) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; -} -function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); -} -function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); -} -function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); -} -function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} -function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Rgb, rgb, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb () { - return this; - }, - clamp () { - return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); - }, - displayable () { - return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; - }, - hex: rgb_formatHex, - formatHex: rgb_formatHex, - formatHex8: rgb_formatHex8, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb -})); -function rgb_formatHex() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; -} -function rgb_formatHex8() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; -} -function rgb_formatRgb() { - const a = clampa(this.opacity); - return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; -} -function clampa(opacity) { - return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); -} -function clampi(value) { - return Math.max(0, Math.min(255, Math.round(value) || 0)); -} -function hex(value) { - value = clampi(value); - return (value < 16 ? "0" : "") + value.toString(16); -} -function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); -} -function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else s = l > 0 && l < 1 ? 0 : h; - return new Hsl(h, s, l, o.opacity); -} -function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} -function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Hsl, hsl, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; - return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); - }, - clamp () { - return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); - }, - displayable () { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; - }, - formatHsl () { - const a = clampa(this.opacity); - return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; - } -})); -function clamph(value) { - value = (value || 0) % 360; - return value < 0 ? value + 360 : value; -} -function clampt(value) { - return Math.max(0, Math.min(1, value || 0)); -} -/* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; -} - -},{"./define.js":"kwMap","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwMap":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - }); -parcelHelpers.export(exports, "extend", ()=>extend); -function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for(var key in definition)prototype[key] = definition[key]; - return prototype; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NJbB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gray", ()=>gray); -parcelHelpers.export(exports, "default", ()=>lab); -parcelHelpers.export(exports, "Lab", ()=>Lab); -parcelHelpers.export(exports, "lch", ()=>lch); -parcelHelpers.export(exports, "hcl", ()=>hcl); -parcelHelpers.export(exports, "Hcl", ()=>Hcl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -// https://observablehq.com/@mbostock/lab-and-rgb -const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; -function labConvert(o) { - if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); - if (o instanceof Hcl) return hcl2lab(o); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; - else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); - } - return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); -} -function gray(l, opacity) { - return new Lab(l, 0, 0, opacity == null ? 1 : opacity); -} -function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} -function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Lab, lab, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker (k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb () { - var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = Zn * lab2xyz(z); - return new (0, _colorJs.Rgb)(lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity); - } -})); -function xyz2lab(t) { - return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; -} -function lab2xyz(t) { - return t > t1 ? t * t * t : t2 * (t - t0); -} -function lrgb2rgb(x) { - return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); -} -function hclConvert(o) { - if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); - if (!(o instanceof Lab)) o = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = Math.atan2(o.b, o.a) * (0, _mathJs.degrees); - return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); -} -function lch(l, c, h, opacity) { - return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; -} -function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * (0, _mathJs.radians); - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); -} -(0, _defineJsDefault.default)(Hcl, hcl, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker (k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb () { - return hcl2lab(this).rgb(); - } -})); - -},{"./define.js":"kwMap","./color.js":"1ttKl","./math.js":"k7vm2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k7vm2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "degrees", ()=>degrees); -const radians = Math.PI / 180; -const degrees = 180 / Math.PI; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ddL6Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cubehelix); -parcelHelpers.export(exports, "Cubehelix", ()=>Cubehelix); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -var A = -0.14861, B = 1.78277, C = -0.29227, D = -0.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; -function cubehelixConvert(o) { - if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * (0, _mathJs.degrees) - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); -} -function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} -function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Cubehelix, cubehelix, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - k = k == null ? (0, _colorJs.brighter) : Math.pow((0, _colorJs.brighter), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? (0, _colorJs.darker) : Math.pow((0, _colorJs.darker), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = isNaN(this.h) ? 0 : (this.h + 120) * (0, _mathJs.radians), l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); - return new (0, _colorJs.Rgb)(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); - } -})); - -},{"./define.js":"kwMap","./color.js":"1ttKl","./math.js":"k7vm2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2vdcV":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Derive column metadata from the data array. - * @param data Array of data objects. - */ parcelHelpers.export(exports, "getColumnsFromData", ()=>getColumnsFromData); -/** - * Populate columns with type inferences and stats. - * @param columns Array of columns. - * @param data Array of data objects. - */ parcelHelpers.export(exports, "inferAll", ()=>inferAll); -var _color = require("./color"); -var _numeric = require("./numeric"); -var _stats = require("./stats"); -function getColumnsFromData(inferTypesFn, data, columnTypes) { - const sample = data[0]; - const fields = sample ? Object.keys(sample) : []; - const inferences = Object.assign(Object.assign({}, inferTypesFn(data, fields)), columnTypes); - const columns = fields.map((name)=>{ - const column = { - name, - type: inferences[name] - }; - return column; - }); - inferAll(columns, data); - return columns; -} -function inferAll(columns, data) { - columns.forEach((column)=>{ - if (column) { - if (typeof column.quantitative !== 'boolean') column.quantitative = (0, _numeric.isQuantitative)(column); - if (!column.stats) column.stats = (0, _stats.getStats)(data, column); - // hex codes, ex. #003300, are parsed as dates - if ((column.type === 'date' || column.type === 'string') && typeof column.isColorData !== 'boolean') (0, _color.checkIsColorData)(data, column); - } - }); -} - -},{"./color":"jS4V7","./numeric":"hDLgJ","./stats":"jRSDf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hDLgJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isQuantitative", ()=>isQuantitative); -parcelHelpers.export(exports, "detectNegative", ()=>detectNegative); -parcelHelpers.export(exports, "detectSequentialColumn", ()=>detectSequentialColumn); -function isQuantitative(column) { - return column.type === 'number' || column.type === 'integer'; -} -function detectNegative(columnName, data) { - for(let i = 1; i < data.length; i++){ - const value = columnName == null ? data[i] : data[i][columnName]; - if (value < 0) return true; - } - return false; -} -function detectSequentialColumn(columnName, data) { - if (data.length < 2) return false; - for(let i = 1; i < data.length; i++){ - const curr = columnName == null ? data[i] : data[i][columnName]; - const prev = columnName == null ? data[i - 1] : data[i - 1][columnName]; - if (curr !== prev + 1) return false; - } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jRSDf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStats", ()=>getStats); -var _color = require("./color"); -var _numeric = require("./numeric"); -function getStats(data, ...args) { - let columnName; - let columnType; - let columnQuantitative; - let distinctValuesCallback; - if (args.length <= 2) { - const column = args[0]; - columnName = column.name; - columnType = column.type; - columnQuantitative = column.quantitative; - distinctValuesCallback = args[1]; - } else { - columnName = args[0]; - columnType = args[1]; - columnQuantitative = args[2]; - distinctValuesCallback = args[3]; - } - const distinctMap = {}; - const stats = { - nonNull: 0, - distinctValueCount: null, - max: null, - mean: null, - min: null - }; - const columnIsString = columnType === 'string'; - let sum = 0; - for(let i = 0; i < data.length; i++){ - const row = data[i]; - const value = columnName == null ? row : row[columnName]; - if (columnIsString) { - if (value !== '') stats.nonNull++; - } else if (value != null) stats.nonNull++; - const num = +value; - distinctMap[value] = true; - if (!isNaN(num)) { - if (stats.max === null || num > stats.max) stats.max = num; - if (stats.min === null || num < stats.min) stats.min = num; - sum += num; - } - // hex codes, ex. #003300, are parsed as dates - if ((columnType === 'date' || columnIsString) && !stats.hasColorData && (0, _color.isColor)(value)) stats.hasColorData = true; - } - if (columnQuantitative) { - stats.mean = data.length > 0 && sum / data.length; - stats.hasNegative = (0, _numeric.detectNegative)(columnName, data); - if (columnType === 'integer') stats.isSequential = (0, _numeric.detectSequentialColumn)(columnName, data); - } - const distinctValues = Object.keys(distinctMap); - if (distinctValuesCallback) { - distinctValues.sort(); - distinctValuesCallback(distinctValues); - } - stats.distinctValueCount = distinctValues.length; - return stats; -} - -},{"./color":"jS4V7","./numeric":"hDLgJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Nkk9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "pandasSimulation", ()=>pandasSimulation); -class Table { - constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = 'right'){ - this.columns = columns; - this.rows = rows; - this.maxWidth = maxWidth; - this.underlineHeaders = underlineHeaders; - this.align = align; - // Calculate maximum width for each column - this.columnWidths = this.columns.map((col, idx)=>Math.max(col.length, ...this.rows.map((row)=>{ - var _a; - return ((_a = row[idx]) === null || _a === void 0 ? void 0 : _a.length) || 0; - }))); - } - createSpaces(num) { - return ' '.repeat(num); - } - groupColumns() { - let cumulativeWidth = 0; - const columnGroups = []; - let currentGroup = []; - this.columns.forEach((col, idx)=>{ - const columnSpace = this.columnWidths[idx] + 1; // account for one space between columns - if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { - columnGroups.push(currentGroup); - cumulativeWidth = columnSpace; - currentGroup = [ - col - ]; - } else { - cumulativeWidth += columnSpace; - currentGroup.push(col); - } - }); - if (currentGroup.length > 0) columnGroups.push(currentGroup); - return columnGroups; - } - formatRow(row, group) { - return group.map((col)=>{ - const idx = this.columns.indexOf(col); - const cellValue = row[idx] == null ? '' : row[idx].toString(); - return this.align === 'right' ? cellValue.padStart(this.columnWidths[idx], ' ') : cellValue.padEnd(this.columnWidths[idx], ' '); - }).join(this.createSpaces(1)); - } - formatHeader(group) { - return group.map((col)=>{ - const idx = this.columns.indexOf(col); - return this.align === 'right' ? col.padStart(this.columnWidths[idx], ' ') : col.padEnd(this.columnWidths[idx], ' '); - }).join(this.createSpaces(1)); - } - underlineHeader(group) { - return group.map((col)=>'-'.repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); - } - render() { - const output = []; - const columnGroups = this.groupColumns(); - columnGroups.forEach((group, groupIndex)=>{ - const headerRow = this.formatHeader(group); - let section = headerRow + (groupIndex < columnGroups.length - 1 ? ' \\' : '') + '\n'; - if (this.underlineHeaders) section += this.underlineHeader(group) + '\n'; - this.rows.forEach((row)=>{ - section += this.formatRow(row, group) + '\n'; - }); - output.push(section); - if (groupIndex < columnGroups.length - 1) output.push('\n'); - }); - return output.join(''); - } -} -var pandasSimulation; -(function(pandasSimulation) { - // Mapping TypeScript types to Python-like dtypes - const typeMapping = { - boolean: 'bool', - number: 'float64', - date: 'datetime64[ns]', - string: 'object', - integer: 'int64' - }; - function head(columns, data, maxWidth = 80) { - const numRows = 5; // Number of rows as in `head(5)` from pandas - const top = data.slice(0, numRows); // Get the top `numRows` rows - // Create a "fake" row number column - const rowNumbers = Array.from({ - length: numRows - }, (_, i)=>(i + 1).toString()); - // Extract column names and rows for the table - const columnNames = [ - '' - ].concat(columns.map((col)=>col.name)); - const rows = top.map((row, i)=>[ - rowNumbers[i] - ].concat(columns.map((col)=>{ - var _a; - return ((_a = row[col.name]) === null || _a === void 0 ? void 0 : _a.toString()) || ''; - }))); - // Create and render the table with right alignment - const table = new Table(columnNames, rows, maxWidth, false, 'right'); // Right alignment - return table.render(); - } - pandasSimulation.head = head; - function info(columns, data, maxWidth = 80) { - const numRows = data.length; - const output = []; - // Summary header - output.push(''); - output.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); - output.push(`Data columns (total ${columns.length} columns):\n`); - // Column headers and details - const columnHeaders = [ - '#', - 'Column', - 'Non-Null Count', - 'Dtype' - ]; - const rows = columns.map((col, idx)=>{ - const nonNullCount = col.stats.nonNull.toString(); - const dtype = typeMapping[col.type] || 'unknown'; - return [ - idx.toString(), - col.name, - `${nonNullCount} non-null`, - dtype - ]; - }); - // Create and render the table with left alignment and header underline - const table = new Table(columnHeaders, rows, maxWidth, true, 'left'); // Left alignment - output.push(table.render()); - // Memory usage estimation - const memoryUsage = columns.reduce((total, col)=>{ - var _a; - const exampleValue = (_a = data.find((row)=>row[col.name] != null)) === null || _a === void 0 ? void 0 : _a[col.name]; - if (exampleValue == null) return total; - const size = new Blob([ - exampleValue.toString() - ]).size; - return total + size * numRows; - }, 0); - output.push(`\ndtypes: ${columns.filter((col)=>col.type === 'number').length} float64, ` + `${columns.filter((col)=>col.type === 'integer').length} int64, ` + `${columns.filter((col)=>col.type === 'string').length} object`); - output.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); - return output.join('\n'); - } - pandasSimulation.info = info; -})(pandasSimulation || (pandasSimulation = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h5flx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SpecBuilder", ()=>SpecBuilder); -var _axes = require("./axes"); -var _color = require("./color"); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -var _facetTitle = require("./facetTitle"); -var _fill = require("./fill"); -var _globalScope = require("./globalScope"); -var _scope = require("./scope"); -var _signals = require("./signals"); -var _index = require("./layouts/index"); -var _image = require("./image"); -class SpecBuilder { - constructor(props, specContext){ - this.props = props; - this.specContext = specContext; - this.globalSignals = { - facetAxesAdjustX: { - name: (0, _constants.SignalNames).FacetAxesAdjustX, - update: props.facetLayout && props.collapseFacetAxes ? (0, _defaults.facetPaddingLeft).toString() : '0' - }, - facetAxesAdjustY: { - name: (0, _constants.SignalNames).FacetAxesAdjustY, - update: props.facetLayout && props.collapseFacetAxes ? (0, _defaults.facetPaddingBottom).toString() : '0' - }, - minCellWidth: { - name: (0, _constants.SignalNames).MinCellWidth, - update: `${0, _defaults.minFacetWidth}` - }, - minCellHeight: { - name: (0, _constants.SignalNames).MinCellHeight, - update: `${0, _defaults.minFacetHeight}` - }, - plotOffsetLeft: { - name: (0, _constants.SignalNames).PlotOffsetLeft, - update: '0' - }, - plotOffsetTop: { - name: (0, _constants.SignalNames).PlotOffsetTop, - update: '0' - }, - plotOffsetBottom: { - name: (0, _constants.SignalNames).PlotOffsetBottom, - update: '0' - }, - plotOffsetRight: { - name: (0, _constants.SignalNames).PlotOffsetRight, - update: '0' - }, - plotHeightOut: { - name: (0, _constants.SignalNames).PlotHeightOut, - update: (0, _constants.SignalNames).PlotHeightIn - }, - plotWidthOut: { - name: (0, _constants.SignalNames).PlotWidthOut, - update: (0, _constants.SignalNames).PlotWidthIn - } - }; - } - validate() { - const { specContext } = this; - const { specCapabilities } = this.props; - const { roles } = specCapabilities; - const required = roles.filter((r)=>{ - switch(typeof r.allowNone){ - case 'boolean': - return !r.allowNone; - case 'undefined': - return true; - case 'function': - return !r.allowNone(specContext); - } - }); - const numeric = roles.filter((r)=>r.excludeCategoric); - const errors = required.map((r)=>{ - if (specContext.specColumns[r.role]) return null; - else return `Field ${r.role} is required.`; - }).concat(numeric.map((r)=>{ - if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) return `Field ${r.role} must be quantitative.`; - else return null; - })).filter(Boolean); - const { backgroundImage } = specContext.insight; - if (backgroundImage && !backgroundImage.extents) errors.push('BackgroundImage must have extents.'); - return errors; - } - build() { - var _a, _b; - const { globalSignals, specContext } = this; - const { facetLayout, specCapabilities } = this.props; - const { insight, specColumns, specViewOptions } = specContext; - const dataName = 'data_source'; - const { vegaSpec, groupMark } = this.initSpec(dataName); - const { topColorField, colorDataName } = (0, _color.addColor)({ - scope: vegaSpec, - dataName, - specContext, - scaleName: (0, _constants.ScaleNames).Color, - legendDataName: 'data_legend', - topLookupName: 'data_topcolorlookup', - colorReverseSignalName: (0, _constants.SignalNames).ColorReverse - }); - const globalScope = new (0, _globalScope.GlobalScope)({ - dataName: colorDataName, - markGroup: groupMark, - scope: vegaSpec, - signals: globalSignals - }); - if (facetLayout) { - (0, _scope.addSignals)(vegaSpec, { - name: (0, _constants.SignalNames).FacetPaddingBottom, - update: `${facetLayout.facetPadding.bottom}` - }, { - name: (0, _constants.SignalNames).FacetPaddingLeft, - update: `${facetLayout.facetPadding.left}` - }, { - name: (0, _constants.SignalNames).FacetPaddingTop, - update: `${facetLayout.facetPadding.top}` - }); - globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; - globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; - } - const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope)=>{ - if (facetLayout && i === 0) globalScope.zSize = innerScope.offsets.h; - }); - if (specResult) return specResult; - if (allGlobalScales.length > 0) { - const plotHeightOut = globalSignals.plotHeightOut.name; - const plotWidthOut = globalSignals.plotWidthOut.name; - const colTitleScale = { - type: 'linear', - name: 'scale_facet_col_title', - domain: [ - 0, - 1 - ], - range: [ - 0, - { - signal: plotWidthOut - } - ] - }; - const rowTitleScale = { - type: 'linear', - name: 'scale_facet_row_title', - domain: [ - 0, - 1 - ], - range: [ - { - signal: plotHeightOut - }, - 0 - ] - }; - const facetScope = facetLayout ? firstScope : null; - const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; - //TODO if capability and numeric x,y - if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative)) { - //backgroundGroup.encode.update.fill = { value: 'pink' } - if (!backgroundGroup.marks) backgroundGroup.marks = []; - const imageMark = (0, _image.getImageMark)(insight.backgroundImage, allGlobalScales); - backgroundGroup.marks.unshift(imageMark); - } - const axesScopes = facetLayout ? (0, _facetTitle.addFacetAxesGroupMarks)({ - globalScope: globalScope.scope, - plotScope: groupMark, - facetScope, - colTitleScale, - rowTitleScale, - colSeqName: 'data_FacetCellColTitles', - rowSeqName: 'data_FacetCellRowTitles' - }) : { - main: [ - { - scope: groupMark, - lines: true, - labels: true, - title: true - } - ] - }; - (0, _axes.addGlobalAxes)({ - globalScope, - allGlobalScales, - axisScales: this.props.axisScales, - plotOffsetSignals: { - x: globalSignals.plotOffsetLeft, - y: globalSignals.plotOffsetBottom - }, - axesOffsets: { - x: (0, _defaults.axesOffsetX), - y: (0, _defaults.axesOffsetY) - }, - axesTitlePadding: facetLayout ? { - x: (0, _defaults.axesTitlePaddingFacetX), - y: (0, _defaults.axesTitlePaddingFacetY) - } : { - x: (0, _defaults.axesTitlePaddingX), - y: (0, _defaults.axesTitlePaddingY) - }, - labelBaseline: { - x: 'top', - y: 'middle' - }, - specColumns, - specViewOptions, - axesScopes, - hideZAxis: !!facetLayout, - view: insight.view - }); - } - //add mark to the final scope - if (finalScope.mark) { - const { update } = finalScope.mark.encode; - const outputDataName = 'output'; - finalScope.mark.from.data = outputDataName; - (0, _scope.addData)(globalScope.markGroup, { - name: outputDataName, - source: globalScope.markDataName, - transform: [ - { - type: 'formula', - expr: finalScope.offsets.x, - as: (0, _constants.FieldNames).OffsetX - }, - { - type: 'formula', - expr: finalScope.offsets.y, - as: (0, _constants.FieldNames).OffsetY - } - ] - }); - update.x = { - field: (0, _constants.FieldNames).OffsetX - }; - update.y = { - field: (0, _constants.FieldNames).OffsetY - }; - allEncodingRules.forEach((map)=>{ - for(const key in map)if (update[key]) { - const arrIn = map[key]; - if (!Array.isArray(update[key])) { - const value = update[key]; - const arrOut = []; - update[key] = arrOut; - arrIn.forEach((rule)=>arrOut.push(rule)); - arrOut.push(value); - } else { - const arrOut = update[key]; - arrIn.forEach((rule)=>arrOut.unshift(rule)); - } - } - }); - update.fill = (0, _fill.fill)(specContext, topColorField, (0, _constants.ScaleNames).Color); - update.opacity = (0, _fill.opacity)(specContext); - } - return { - specCapabilities, - vegaSpec - }; - } - initSpec(dataName) { - const { globalSignals } = this; - const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; - const { specContext } = this; - const { insight } = specContext; - const groupMark = { - type: 'group', - //style: 'cell', - encode: { - update: { - x: { - signal: `${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).FacetAxesAdjustX}` - }, - y: { - signal: (0, _constants.SignalNames).PlotOffsetTop - }, - height: { - signal: `${(0, _constants.SignalNames).PlotHeightOut} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - width: { - signal: `${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).FacetAxesAdjustX}` - } - } - } - }; - const inputDataname = 'input'; - const vegaSpec = { - $schema: 'https://vega.github.io/schema/vega/v5.json', - //style: 'cell', - data: [ - { - name: inputDataname - }, - { - name: dataName, - source: inputDataname, - transform: [] - } - ], - marks: [ - groupMark - ], - signals: (0, _signals.textSignals)(specContext, (0, _constants.SignalNames).ViewportHeight).concat([ - minCellWidth, - minCellHeight, - { - name: (0, _constants.SignalNames).ViewportHeight, - update: `max(${(0, _constants.SignalNames).MinCellHeight}, ${insight.size.height})` - }, - { - name: (0, _constants.SignalNames).ViewportWidth, - update: `max(${(0, _constants.SignalNames).MinCellWidth}, ${insight.size.width})` - }, - plotOffsetLeft, - plotOffsetTop, - plotOffsetBottom, - plotOffsetRight, - facetAxesAdjustX, - facetAxesAdjustY, - { - name: (0, _constants.SignalNames).PlotHeightIn, - update: `${(0, _constants.SignalNames).ViewportHeight} - ${(0, _constants.SignalNames).PlotOffsetBottom} + ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - { - name: (0, _constants.SignalNames).PlotWidthIn, - update: `${(0, _constants.SignalNames).ViewportWidth} - ${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).PlotOffsetRight}` - }, - plotHeightOut, - plotWidthOut, - { - name: 'height', - update: `${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).PlotHeightOut} + ${(0, _constants.SignalNames).PlotOffsetBottom} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - { - name: 'width', - update: `${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).PlotOffsetLeft} + ${(0, _constants.SignalNames).PlotOffsetRight}` - } - ]) - }; - return { - vegaSpec, - groupMark - }; - } - iterateLayouts(globalScope, onLayoutBuild) { - let specResult; - let parentScope = { - sizeSignals: globalScope.sizeSignals, - offsets: globalScope.offsets - }; - let firstScope; - let childScope; - const groupings = []; - const { layouts, specCapabilities } = this.props; - const allGlobalScales = []; - const allEncodingRules = []; - for(let i = 0; i < layouts.length; i++){ - if (!parentScope) continue; - const buildProps = { - globalScope, - parentScope, - axesScales: this.props.axisScales, - groupings, - id: i - }; - const layout = this.createLayout(layouts[i], buildProps); - try { - childScope = layout.build(); - childScope.id = i; - const groupby = layout.getGrouping(); - if (groupby) groupings.push({ - id: i, - groupby, - fieldOps: [ - { - field: null, - op: 'count', - as: (0, _constants.FieldNames).Count - } - ] - }); - const sumOp = layout.getAggregateSumOp(); - if (sumOp) groupings[groupings.length - 1].fieldOps.push(sumOp); - onLayoutBuild(i, childScope); - } catch (e) { - specResult = { - errors: [ - e.stack - ], - specCapabilities, - vegaSpec: null - }; - break; - } - if (childScope && childScope.globalScales) allGlobalScales.push(childScope.globalScales); - if (childScope.encodingRuleMap) allEncodingRules.push(childScope.encodingRuleMap); - if (i === 0) firstScope = childScope; - parentScope = childScope; - } - return { - firstScope, - finalScope: parentScope, - specResult, - allGlobalScales, - allEncodingRules - }; - } - createLayout(layoutPair, buildProps) { - const { layoutType, props } = layoutPair; - const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); - const layoutClass = (0, _index.layoutClasses)[layoutType]; - const layout = new layoutClass(layoutBuildProps); - layout.id = buildProps.id; - return layout; - } -} - -},{"./axes":"iTLIR","./color":"gKKJ5","./constants":"22TRA","./defaults":"jpVjH","./facetTitle":"a1RbZ","./fill":"aaLsK","./globalScope":"iaGl2","./scope":"9ojhQ","./signals":"Bq6BR","./layouts/index":"i7uNc","./image":"akfUH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iTLIR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addGlobalAxes", ()=>addGlobalAxes); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -var _scope = require("./scope"); -function addGlobalAxes(props) { - const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; - const { scope } = globalScope; - allGlobalScales.forEach((globalScales)=>{ - const { scales } = globalScales; - for(const xyz in scales){ - const _scales = scales[xyz]; - if (_scales) { - (0, _scope.addScales)(scope, ..._scales); - let { showAxes } = globalScales; - let zindex = undefined; - if (xyz === 'z') { - showAxes = false; - if (props.view === '3d' && specViewOptions.zAxisOptions && !props.hideZAxis) { - if (specViewOptions.zAxisOptions.showZAxis) { - showAxes = true; - zindex = specViewOptions.zAxisOptions.zIndex; - } - } - } - if (showAxes && axisScales) { - const axisScale = axisScales[xyz]; - if (axisScale) { - const lineColor = specViewOptions.colors.axisLine; - const horizontal = xyz === 'x'; - const column = specColumns[xyz] || { - quantitative: true - }; - const title = axisScale.title; - const props = { - title, - horizontal, - column, - specViewOptions, - lineColor, - titlePadding: axesTitlePadding[xyz], - labelBaseline: labelBaseline[xyz], - zindex - }; - axesScopes['main'].forEach((a)=>(0, _scope.addAxes)(a.scope, createAxis(Object.assign(Object.assign({}, props), { - scale: a.scale || _scales[0], - showTitle: a.title, - showLabels: a.labels, - showLines: a.lines - })))); - if (axesScopes[xyz]) axesScopes[xyz].forEach((a)=>(0, _scope.addAxes)(a.scope, createAxis(Object.assign(Object.assign({}, props), { - scale: a.scale || _scales[0], - showTitle: a.title, - showLabels: a.labels, - showLines: a.lines - })))); - if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { - const plotOffsetSignal = plotOffsetSignals[xyz]; - plotOffsetSignal.update = `${axesOffsets[xyz]}`; - } - } - } - } - } - }); -} -function createAxis(props) { - const { column, horizontal, labelBaseline, lineColor, scale, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; - const axis = Object.assign(Object.assign(Object.assign(Object.assign({ - zindex, - scale: scale.name, - orient: horizontal ? 'bottom' : 'left', - domain: showLines, - ticks: showLines - }, showLines && { - domainColor: lineColor, - tickColor: lineColor, - tickSize: specViewOptions.tickSize - }), showTitle && { - title, - titleAlign: horizontal ? 'left' : 'right', - titleAngle: { - signal: horizontal ? (0, _constants.SignalNames).TextAngleX : (0, _constants.SignalNames).TextAngleY - }, - titleColor: specViewOptions.colors.axisText, - titleFontSize: { - signal: (0, _constants.SignalNames).TextTitleSize - }, - titleLimit: (0, _defaults.axesTitleLimit), - titlePadding - }), { - labels: showLabels - }), showLabels && { - labelAlign: horizontal ? 'left' : 'right', - labelBaseline, - labelAngle: { - signal: horizontal ? (0, _constants.SignalNames).TextAngleX : (0, _constants.SignalNames).TextAngleY - }, - labelColor: specViewOptions.colors.axisText, - labelFontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - labelLimit: (0, _defaults.axesLabelLimit) - }); - if (column.quantitative) axis.format = '~r'; - return axis; -} - -},{"./constants":"22TRA","./defaults":"jpVjH","./scope":"9ojhQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ojhQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addAxes", ()=>addAxes); -parcelHelpers.export(exports, "addData", ()=>addData); -parcelHelpers.export(exports, "addMarks", ()=>addMarks); -parcelHelpers.export(exports, "addScales", ()=>addScales); -parcelHelpers.export(exports, "addSignals", ()=>addSignals); -parcelHelpers.export(exports, "addTransforms", ()=>addTransforms); -parcelHelpers.export(exports, "getDataByName", ()=>getDataByName); -parcelHelpers.export(exports, "getGroupBy", ()=>getGroupBy); -parcelHelpers.export(exports, "addOffsets", ()=>addOffsets); -function addAxes(scope, ...axes) { - if (!axes || !axes.length) return; - if (!scope.axes) scope.axes = []; - scope.axes.push(...axes.filter(Boolean)); -} -function addData(scope, ...datas) { - if (!datas || !datas.length) return; - if (!scope.data) scope.data = []; - scope.data.push(...datas.filter(Boolean)); -} -function addMarks(scope, ...marks) { - if (!marks || !marks.length) return; - if (!scope.marks) scope.marks = []; - scope.marks.push(...marks.filter(Boolean)); -} -function addScales(scope, ...scales) { - if (!scales || !scales.length) return; - if (!scope.scales) scope.scales = []; - scope.scales.push(...scales.filter(Boolean)); -} -function addSignals(scope, ...signals) { - if (!signals || !signals.length) return; - if (!scope.signals) scope.signals = []; - scope.signals.push(...signals.filter(Boolean)); -} -function addTransforms(data, ...transforms) { - if (!transforms || !transforms.length) return; - if (!data.transform) data.transform = []; - data.transform.push(...transforms.filter(Boolean)); -} -function getDataByName(data, dataName) { - for(let i = 0; i < data.length; i++){ - if (data[i].name === dataName) return { - data: data[i], - index: i - }; - } -} -function getGroupBy(groupings) { - const groupby = groupings.map((g)=>g.groupby); - return groupby.reduce((acc, val)=>acc.concat(val), []); -} -function addOffsets(...offsets) { - return offsets.filter(Boolean).join(' + '); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gKKJ5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addColor", ()=>addColor); -var _scope = require("./scope"); -var _scales = require("./scales"); -var _signals = require("./signals"); -var _constants = require("./constants"); -var _legends = require("./legends"); -var _top = require("./top"); -function addColor(props) { - const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; - let colorDataName = dataName; - const { insight, specColumns, specViewOptions } = specContext; - const legends = (0, _legends.getLegends)(specContext, scaleName); - if (legends) scope.legends = legends; - const categoricalColor = specColumns.color && !specColumns.color.quantitative; - if (categoricalColor) { - (0, _scope.addData)(scope, ...(0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, (0, _constants.FieldNames).TopColor, (0, _constants.FieldNames).TopIndex)); - colorDataName = legendDataName; - } - if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) { - if (specColumns.color.quantitative) (0, _scope.addScales)(scope, (0, _scales.binnableColorScale)(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); - else (0, _scope.addScales)(scope, { - name: scaleName, - type: 'ordinal', - domain: { - data: colorDataName, - field: (0, _constants.FieldNames).TopColor, - sort: true - }, - range: { - scheme: insight.scheme || (0, _constants.ColorScaleNone) - }, - reverse: { - signal: colorReverseSignalName - } - }); - } - (0, _scope.addSignals)(scope, (0, _signals.colorBinCountSignal)(specContext), (0, _signals.colorReverseSignal)(specContext)); - return { - topColorField: (0, _constants.FieldNames).TopColor, - colorDataName - }; -} - -},{"./scope":"9ojhQ","./scales":"feLP9","./signals":"Bq6BR","./constants":"22TRA","./legends":"7TJVK","./top":"83rkq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"feLP9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "linearScale", ()=>linearScale); -parcelHelpers.export(exports, "pointScale", ()=>pointScale); -parcelHelpers.export(exports, "binnableColorScale", ()=>binnableColorScale); -var _constants = require("./constants"); -var _expr = require("./expr"); -function linearScale(scaleName, domain, range, reverse, zero, nice = true) { - const scale = { - name: scaleName, - type: 'linear', - range, - round: true, - reverse, - domain, - zero, - nice - }; - return scale; -} -function pointScale(scaleName, data, range, field, reverse) { - const scale = { - name: scaleName, - type: 'point', - range, - domain: { - data, - field: (0, _expr.safeFieldName)(field), - sort: true - }, - padding: 0.5 - }; - if (reverse !== undefined) scale.reverse = reverse; - return scale; -} -function binnableColorScale(scaleName, colorBin, data, field, scheme) { - scheme = scheme || (0, _constants.ColorScaleNone); - const domain = { - data, - field: (0, _expr.safeFieldName)(field) - }; - const range = { - scheme - }; - const reverse = { - signal: (0, _constants.SignalNames).ColorReverse - }; - if (colorBin !== 'continuous') range.count = { - signal: (0, _constants.SignalNames).ColorBinCount - }; - switch(colorBin){ - case 'continuous': - { - const sequentialScale = { - name: scaleName, - type: 'linear', - domain, - range, - reverse - }; - return sequentialScale; - } - case 'quantile': - { - const quantileScale = { - name: scaleName, - type: 'quantile', - domain, - range, - reverse - }; - return quantileScale; - } - default: - { - const quantizeScale = { - name: scaleName, - type: 'quantize', - domain, - range, - reverse - }; - return quantizeScale; - } - } -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eSi6o":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * Make sure that the field name is accessible via Vega's Field type - * https://vega.github.io/vega/docs/types/#Field - * examples: "source.x", "target['x']", "[my.field]" - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "safeFieldName", ()=>safeFieldName); -/** - * Make sure the field name is usable in a Vega expression - */ parcelHelpers.export(exports, "exprSafeFieldName", ()=>exprSafeFieldName); -function safeFieldName(field) { - return field.replace(/\\/g, '\\\\') //escape backslashes - .replace(/'/g, '\\\'') //escape single quotes - .replace(/"/g, '\\"') //escape double quotes - .replace(/\./g, '\\.') //escape periods - .replace(/\[/g, '\\[') //escape left square brackets - .replace(/\]/g, '\\]') //escape right square brackets - ; -} -function exprSafeFieldName(field) { - //remove whitespace, period, accessors and logical modifiers - return field.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ''); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Bq6BR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultZProportion", ()=>defaultZProportion); -parcelHelpers.export(exports, "textSignals", ()=>textSignals); -parcelHelpers.export(exports, "colorBinCountSignal", ()=>colorBinCountSignal); -parcelHelpers.export(exports, "colorReverseSignal", ()=>colorReverseSignal); -parcelHelpers.export(exports, "modifySignal", ()=>modifySignal); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -const defaultZProportion = 0.6; -function textSignals(context, heightSignal) { - const { specViewOptions } = context; - const signals = [ - { - name: (0, _constants.SignalNames).ZProportion, - value: defaultZProportion, - bind: { - name: specViewOptions.language.zScaleProportion, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.1, - max: 2, - step: 0.1 - } - }, - { - name: (0, _constants.SignalNames).ZHeight, - update: `${heightSignal} * ${(0, _constants.SignalNames).ZProportion}` - }, - { - name: (0, _constants.SignalNames).TextScale, - value: 1.2, - bind: { - name: specViewOptions.language.textScaleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.5, - max: 2, - step: 0.1 - } - }, - { - name: (0, _constants.SignalNames).TextSize, - update: `${(0, _constants.SignalNames).TextScale} * 10` - }, - { - name: (0, _constants.SignalNames).TextTitleSize, - update: `${(0, _constants.SignalNames).TextScale} * 15` - }, - { - name: (0, _constants.SignalNames).TextAngleX, - value: 30, - bind: { - name: specViewOptions.language.xAxisTextAngleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0, - max: 90, - step: 1 - } - }, - { - name: (0, _constants.SignalNames).TextAngleY, - value: 0, - bind: { - name: specViewOptions.language.yAxisTextAngleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: -90, - max: 0, - step: 1 - } - }, - { - name: (0, _constants.SignalNames).MarkOpacity, - value: 1, - bind: { - name: specViewOptions.language.markOpacitySignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.1, - max: 1, - step: 0.05 - } - } - ]; - return signals; -} -function colorBinCountSignal(context) { - const { specViewOptions } = context; - const signal = { - name: (0, _constants.SignalNames).ColorBinCount, - value: 7, - bind: { - name: specViewOptions.language.colorBinCount, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: specViewOptions.maxLegends + 1, - step: 1 - } - }; - return signal; -} -function colorReverseSignal(context) { - const { specViewOptions } = context; - const signal = { - name: (0, _constants.SignalNames).ColorReverse, - value: false, - bind: { - name: specViewOptions.language.colorReverse, - input: 'checkbox' - } - }; - return signal; -} -function modifySignal(s, fn, update) { - s.update = `${fn}((${s.update}), (${update}))`; -} - -},{"./constants":"22TRA","./defaults":"jpVjH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7TJVK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getLegends", ()=>getLegends); -function legend(column, fill) { - const legend = { - orient: 'none', - title: column.name, - fill, - encode: { - symbols: { - update: { - shape: { - value: 'square' - } - } - } - } - }; - if (column.quantitative) { - legend.type = 'symbol'; - legend.format = '~r'; - } - return legend; -} -function getLegends(context, fill) { - const { specColumns, insight } = context; - if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) return [ - legend(specColumns.color, fill) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"83rkq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "topLookup", ()=>topLookup); -var _constants = require("./constants"); -var _expr = require("./expr"); -function topLookup(column, count, source, legend, lookupName, fieldName, indexName) { - const data = [ - { - name: lookupName, - source, - transform: [ - { - type: 'aggregate', - groupby: [ - (0, _expr.safeFieldName)(column.name) - ] - }, - { - type: 'window', - ops: [ - 'count' - ], - as: [ - indexName - ] - }, - { - type: 'filter', - expr: `datum[${JSON.stringify(indexName)}] <= ${count}` - } - ] - }, - { - name: legend, - source, - transform: [ - { - type: 'lookup', - from: lookupName, - key: (0, _expr.safeFieldName)(column.name), - fields: [ - column.name - ].map((0, _expr.safeFieldName)), - values: [ - column.name - ].map((0, _expr.safeFieldName)), - as: [ - fieldName - ] - }, - { - type: 'formula', - expr: `datum[${JSON.stringify(fieldName)}] == null ? '${(0, _constants.Other)}' : datum[${JSON.stringify(fieldName)}]`, - as: fieldName - } - ] - } - ]; - return data; -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a1RbZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addFacetColRowTitles", ()=>addFacetColRowTitles); -parcelHelpers.export(exports, "addFacetCellTitles", ()=>addFacetCellTitles); -parcelHelpers.export(exports, "addFacetAxesGroupMarks", ()=>addFacetAxesGroupMarks); -parcelHelpers.export(exports, "facetRowHeaderFooter", ()=>facetRowHeaderFooter); -parcelHelpers.export(exports, "facetColumnHeaderFooter", ()=>facetColumnHeaderFooter); -var _scope = require("./scope"); -var _constants = require("./constants"); -function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { - const titleSignal = `parent[${JSON.stringify((0, _constants.FieldNames).FacetTitle)}]`; - const index = `datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1`; - const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index); - const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index); - (0, _scope.addMarks)(globalScope, col.header, row.footer); - (0, _scope.addMarks)(col.header, { - type: 'text', - encode: { - enter: { - align: { - value: 'center' - }, - baseline: { - value: 'middle' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - x: { - signal: `${sizeSignals.layoutWidth} / 2` - }, - limit: { - signal: sizeSignals.layoutWidth - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - text: { - signal: titleSignal - } - } - } - }); - (0, _scope.addMarks)(row.footer, { - type: 'text', - encode: { - enter: { - align: { - value: 'left' - }, - baseline: { - value: 'middle' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - y: { - signal: `${sizeSignals.layoutHeight} / 2` - }, - limit: { - signal: (0, _constants.SignalNames).PlotOffsetRight - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - text: { - signal: titleSignal - } - } - } - }); -} -function addFacetCellTitles(scope, sizeSignals, axisTextColor) { - (0, _scope.addMarks)(scope, { - type: 'text', - encode: { - enter: { - align: { - value: 'center' - }, - baseline: { - value: 'bottom' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - x: { - signal: `(${sizeSignals.layoutWidth}) / 2` - }, - text: { - signal: `parent[${JSON.stringify((0, _constants.FieldNames).FacetTitle)}]` - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - limit: { - signal: sizeSignals.layoutWidth - }, - y: { - signal: `-${(0, _constants.SignalNames).FacetPaddingTop} / 2` - } - } - } - }); -} -function addFacetAxesGroupMarks(props) { - const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; - const { sizeSignals } = facetScope; - const colSequence = createSequence(colSeqName, sizeSignals.colCount); - const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); - const index = 'datum.data'; - const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index); - const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index); - (0, _scope.addData)(globalScope, colSequence, rowSequence); - (0, _scope.addMarks)(globalScope, col.footer, row.header); - (0, _scope.addScales)(globalScope, colTitleScale, rowTitleScale); - const map = { - main: [ - { - scope: facetScope.facetScope, - lines: true, - labels: false, - title: false - } - ], - x: [ - { - scope: col.footer, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: colTitleScale, - lines: false, - labels: false, - title: true - } - ], - y: [ - { - scope: row.header, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: rowTitleScale, - lines: false, - labels: false, - title: true - } - ] - }; - return map; -} -function facetRowHeaderFooter(data, sizeSignals, index) { - const rowFn = (xSignal)=>{ - return { - type: 'group', - from: { - data - }, - encode: { - update: { - x: { - signal: xSignal - }, - y: { - signal: `${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).FacetPaddingTop} + (${index}) * (${sizeSignals.layoutHeight} + ${(0, _constants.SignalNames).FacetPaddingTop} + ${(0, _constants.SignalNames).FacetPaddingBottom})` - }, - height: { - signal: sizeSignals.layoutHeight - } - } - } - }; - }; - const header = rowFn((0, _constants.SignalNames).PlotOffsetLeft); - const footer = rowFn(`${(0, _constants.SignalNames).PlotOffsetLeft} + ${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).PlotOffsetRight} / 2`); - return { - header, - footer - }; -} -function facetColumnHeaderFooter(data, sizeSignals, index) { - const colFn = (ySignal)=>{ - return { - type: 'group', - from: { - data - }, - encode: { - update: { - x: { - signal: `(${index}) * (${sizeSignals.layoutWidth} + ${(0, _constants.SignalNames).FacetPaddingLeft}) + ${(0, _constants.SignalNames).FacetPaddingLeft} + ${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).FacetAxesAdjustX}` - }, - y: { - signal: `${ySignal} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - width: { - signal: sizeSignals.layoutWidth - } - } - } - }; - }; - //create group marks based on data sequences - const header = colFn(`${(0, _constants.SignalNames).PlotOffsetTop} / 2`); - const footer = colFn(`${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).PlotHeightOut}`); - return { - header, - footer - }; -} -function createSequence(dataName, countSignal) { - return { - name: dataName, - transform: [ - { - type: 'sequence', - start: 0, - stop: { - signal: countSignal - } - } - ] - }; -} - -},{"./scope":"9ojhQ","./constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aaLsK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fill", ()=>fill); -parcelHelpers.export(exports, "opacity", ()=>opacity); -var _constants = require("./constants"); -var _expr = require("./expr"); -function fill(context, colorFieldName, scale) { - const { specColumns, insight, specViewOptions } = context; - const colorColumn = specColumns.color; - return colorColumn ? colorColumn.isColorData || insight.directColor ? { - field: (0, _expr.safeFieldName)(colorColumn.name) - } : { - scale, - field: colorColumn.quantitative ? (0, _expr.safeFieldName)(colorColumn.name) : colorFieldName - } : { - value: specViewOptions.colors.defaultCube - }; -} -function opacity(context) { - const result = { - signal: (0, _constants.SignalNames).MarkOpacity - }; - return result; -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iaGl2":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GlobalScope", ()=>GlobalScope); -var _constants = require("./constants"); -var _scope = require("./scope"); -class GlobalScope { - constructor(props){ - const { dataName, markGroup, scope, signals } = props; - this.scope = scope; - this._markGroup = markGroup; - this.signals = signals; - this.data = (0, _scope.getDataByName)(scope.data, dataName).data; - this._markDataName = dataName; - this.offsets = { - x: '0', - y: '0', - h: (0, _constants.SignalNames).PlotHeightIn, - w: (0, _constants.SignalNames).PlotWidthIn - }; - this.sizeSignals = { - layoutHeight: (0, _constants.SignalNames).PlotHeightIn, - layoutWidth: (0, _constants.SignalNames).PlotWidthIn - }; - this.zSize = (0, _constants.SignalNames).PlotHeightIn; - } - get markDataName() { - return this._markDataName; - } - setMarkDataName(markDataName) { - this._markDataName = markDataName; - } - get markGroup() { - return this._markGroup; - } - setMarkGroup(markGroup) { - this._markGroup = markGroup; - } -} - -},{"./constants":"22TRA","./scope":"9ojhQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i7uNc":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "layoutClasses", ()=>layoutClasses); -var _aggregateContainer = require("./aggregateContainer"); -var _aggregateSquare = require("./aggregateSquare"); -var _band = require("./band"); -var _cross = require("./cross"); -var _scatter = require("./scatter"); -var _square = require("./square"); -var _stack = require("./stack"); -var _strip = require("./strip"); -var _treemap = require("./treemap"); -var _wrap = require("./wrap"); -const layoutClasses = { - AggregateContainer: (0, _aggregateContainer.AggregateContainer), - AggregateSquare: (0, _aggregateSquare.AggregateSquare), - Band: (0, _band.Band), - Cross: (0, _cross.Cross), - Scatter: (0, _scatter.Scatter), - Square: (0, _square.Square), - Stack: (0, _stack.Stack), - Strip: (0, _strip.Strip), - Treemap: (0, _treemap.Treemap), - Wrap: (0, _wrap.Wrap) -}; - -},{"./aggregateContainer":"23lsA","./aggregateSquare":"ksGXP","./band":"3pFuA","./cross":"iXWbC","./scatter":"eLCwq","./square":"5vsTh","./stack":"l09WI","./strip":"7mPSq","./treemap":"caw7y","./wrap":"iDL5r","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"23lsA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AggregateContainer", ()=>AggregateContainer); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class AggregateContainer extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const a = this.aggregation = this.getAggregation(); - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a}_extent`, - scale: `scale_${p}`, - extentData: `data_${p}_extent`, - offsets: `data_${p}_offsets` - }; - } - getAggregateSumOp() { - if (this.aggregation === 'sum') { - const fieldOp = { - field: (0, _expr.safeFieldName)(this.props.sumBy.name), - op: 'sum', - as: (0, _constants.FieldNames).Sum - }; - return fieldOp; - } - } - build() { - const { aggregation, names, props } = this; - const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; - (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), { - as: [ - names.aggregateField - ] - }), { - type: 'extent', - field: (0, _expr.safeFieldName)(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - (0, _scope.addSignals)(globalScope.scope, { - name: props.globalAggregateMaxExtentSignal, - update: `${names.globalAggregateExtentSignal}[1]` - }); - const horizontal = dock === 'left'; - const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; - const offsets = { - x: parentScope.offsets.x, - y: (0, _scope.addOffsets)(parentScope.offsets.y, dock === 'bottom' ? groupScaled : ''), - h: horizontal ? parentScope.offsets.h : dock === 'top' ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, - w: horizontal ? groupScaled : parentScope.offsets.w - }; - const scale = { - type: 'linear', - name: names.scale, - domain: [ - 0, - { - signal: props.globalAggregateMaxExtentSignal - } - ], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ], - nice: niceScale, - zero: true, - reverse: dock === 'top' - }; - const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; - (0, _scope.addSignals)(globalScope.scope, { - name: props.globalAggregateMaxExtentScaledSignal, - update: dock === 'bottom' ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue - }); - return { - offsets, - sizeSignals: horizontal ? { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: null - } : { - layoutHeight: null, - layoutWidth: parentScope.sizeSignals.layoutWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? [ - scale - ] : undefined, - y: horizontal ? undefined : [ - scale - ] - } - }, - encodingRuleMap: horizontal ? { - x: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.x - } - ], - width: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } : { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: dock === 'top' ? parentScope.offsets.y : (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.offsets.h) - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: 'joinaggregate', - groupby: groupby.map((0, _expr.safeFieldName)), - ops: [ - aggregation - ] - }; - if (aggregation === 'sum') trans.fields = [ - this.props.sumBy.name - ].map((0, _expr.safeFieldName)); - return trans; - } - getAggregation() { - const { props } = this; - let s; - if (props.dock === 'left') s = props.axesScales.x; - else s = props.axesScales.y; - switch(s.aggregate){ - case 'sum': - return 'sum'; - default: - return 'count'; - } - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i2QIi":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Layout", ()=>Layout); -class Layout { - constructor(props){ - this.props = props; - this.id = props.id; - } - getGrouping() { - return null; - } - getAggregateSumOp() { - return null; - } - build() { - throw 'Not implemented'; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ef2qR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "testForCollapseSelection", ()=>testForCollapseSelection); -var _constants = require("./constants"); -function testForCollapseSelection() { - return `datum.${(0, _constants.FieldNames).Collapsed}`; -} - -},{"./constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ksGXP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AggregateSquare", ()=>AggregateSquare); -var _layout = require("./layout"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class AggregateSquare extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const a = this.props.aggregation; - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a}_extent`, - extentData: `data_${p}_extent` - }; - } - build() { - const { names, props } = this; - const { aggregation, globalScope, groupings, onBuild, parentScope } = props; - const { sizeSignals } = parentScope; - (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), { - as: [ - names.aggregateField - ] - }), { - type: 'extent', - field: (0, _expr.safeFieldName)(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; - const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; - const squareMaxArea = `(${[ - squareMaxSide, - squareMaxSide - ].join(' * ')})`; - const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; - const squareArea = `(${[ - squareMaxArea, - shrinkRatio - ].join(' * ')})`; - const squareSide = `sqrt(${squareArea})`; - const localAggregateMaxExtentScaled = squareSide; - onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), - h: squareSide, - w: squareSide - }; - return { - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: offsets.y - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: 'joinaggregate', - groupby: groupby.map((0, _expr.safeFieldName)), - ops: [ - aggregation - ] - }; - if (aggregation === 'sum') trans.fields = [ - this.props.sumBy.name - ].map((0, _expr.safeFieldName)); - return trans; - } -} - -},{"./layout":"i2QIi","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3pFuA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bandScaleLinearSuffix", ()=>bandScaleLinearSuffix); -parcelHelpers.export(exports, "Band", ()=>Band); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _signals = require("../signals"); -var _scales = require("../scales"); -const bandScaleLinearSuffix = '_linear'; -class Band extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `band_${this.id}`; - this.names = { - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - bandWidth: `${p}_bandwidth`, - accumulative: `${p}_accumulative` - }; - this.bin = (0, _bin.binnable)(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); - } - getGrouping() { - return this.bin.fields; - } - build() { - const { bin, names, props } = this; - const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; - const binField = bin.fields[0]; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - } - //TODO don't add this, use existing dataset - (0, _scope.addData)(globalScope.scope, { - name: names.accumulative, - source: bin.fullScaleDataname, - transform: [ - { - type: 'aggregate', - groupby: this.getGrouping().map((0, _expr.safeFieldName)), - ops: [ - 'count' - ] - } - ] - }); - const horizontal = orientation === 'horizontal'; - const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; - (0, _signals.modifySignal)(minCellSignal, 'max', `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); - (0, _scope.addSignals)(globalScope.scope, { - name: names.bandWidth, - update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` - }); - const scale = this.getScale(bin, horizontal); - if (props.outerSignalExtents && bin.native === false) //add a linear scale for use by background image - (0, _scope.addScales)(globalScope.scope, (0, _scales.linearScale)(scale.name + bandScaleLinearSuffix, { - signal: bin.extentSignal - }, scale.range, scale.reverse, false, false)); - let encodingRuleMap; - if (!props.excludeEncodingRuleMap) encodingRuleMap = horizontal ? { - x: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.x - } - ], - width: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } : { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.offsets.h) - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - }; - return { - offsets: this.getOffset(horizontal, binField), - sizeSignals: horizontal ? { - layoutHeight: names.bandWidth, - layoutWidth: parentScope.sizeSignals.layoutWidth - } : { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: names.bandWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? undefined : [ - scale - ], - y: horizontal ? [ - scale - ] : undefined - } - }, - encodingRuleMap - }; - } - getOffset(horizontal, binField) { - const { names, props } = this; - const { parentScope } = props; - return { - x: (0, _scope.addOffsets)(parentScope.offsets.x, horizontal ? '' : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ''), - h: horizontal ? names.bandWidth : parentScope.offsets.h, - w: horizontal ? parentScope.offsets.w : names.bandWidth - }; - } - getScale(bin, horizontal) { - const { names } = this; - const { parentScope } = this.props; - const binField = (0, _expr.safeFieldName)(bin.fields[0]); - let bandScale; - if (horizontal) bandScale = { - type: 'band', - name: names.yScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutHeight - } - ], - padding: 0.1, - domain: { - data: bin.domainDataName, - field: binField, - sort: true - }, - reverse: true - }; - else bandScale = { - type: 'band', - name: names.xScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ], - padding: 0.1, - domain: { - data: bin.domainDataName, - field: binField, - sort: true - } - }; - return bandScale; - } -} - -},{"./layout":"i2QIi","../bin":"2ZuOQ","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../signals":"Bq6BR","../scales":"feLP9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2ZuOQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "binnable", ()=>binnable); -parcelHelpers.export(exports, "outerExtentSignal", ()=>outerExtentSignal); -parcelHelpers.export(exports, "shouldBeIntegralBinStep", ()=>shouldBeIntegralBinStep); -var _constants = require("./constants"); -var _expr = require("./expr"); -var _defaults = require("./defaults"); -var _transforms = require("./transforms"); -function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { - const { column, defaultBins, maxbins, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; - if (column.quantitative) { - const field = `${prefix}_bin_${(0, _expr.exprSafeFieldName)(column.name)}`; - const fieldEnd = `${field}_end`; - const binSignal = `${field}_bins`; - const dataExtentSignal = `${field}_bin_extent`; - const dataExtentSpanSignal = `${field}_bin_extent_span`; - const outerSignal = `${field}_outer_extent`; - domainDataName = `${field}_sequence`; //override the data name - const extentTransform = (0, _transforms.dataExtent)(column, dataExtentSignal); - let imageSignal; - if (outerSignalExtents) imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); - const maxbinsSignal = { - name: maxbinsSignalName, - value: defaultBins, - bind: { - name: maxbinsSignalDisplayName, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: maxbins, - step: 1 - } - }; - const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; - const binTransform = { - type: 'bin', - field: (0, _expr.safeFieldName)(column.name), - as: [ - field, - fieldEnd - ], - signal: binSignal, - extent: { - signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` - }, - minstep: shouldBeIntegralBinStep(column) ? 1 : 0, - maxbins: { - signal: maxbinsSignalName - } - }; - const dataSequence = { - name: domainDataName, - transform: [ - { - type: 'sequence', - start: { - signal: `${binSignal}.start` - }, - stop: { - signal: `${binSignal}.stop` - }, - step: { - signal: `${binSignal}.step` - } - }, - { - type: 'formula', - expr: 'datum.data', - as: field - }, - { - type: 'formula', - expr: `datum.data + ${binSignal}.step`, - as: fieldEnd - }, - { - type: 'window', - ops: [ - 'row_number' - ], - as: [ - (0, _constants.FieldNames).Ordinal - ] - }, - { - type: 'formula', - expr: `datum.data === ${binSignal}.start`, - as: (0, _constants.FieldNames).First - }, - { - type: 'formula', - expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, - as: (0, _constants.FieldNames).Last - }, - { - // when there is only one bin, use only first sequence element - type: 'filter', - expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify((0, _constants.FieldNames).First)}] : true` - } - ] - }; - const signals = [ - maxbinsSignal, - { - name: dataExtentSpanSignal, - update: `${extentSignal}[1] - ${extentSignal}[0]` - } - ]; - if (imageSignal) signals.push(imageSignal); - const augmentBinnable = { - discreteColumn, - native: false, - transforms: [ - extentTransform, - binTransform - ], - fields: [ - field, - fieldEnd - ], - binSignal, - extentSignal, - dataSequence, - domainDataName, - signals, - fullScaleDataname: dataSequence.name - }; - return augmentBinnable; - } else { - const nativeBinnable = { - discreteColumn, - native: true, - fields: [ - column.name - ], - domainDataName, - fullScaleDataname: domainDataName - }; - return nativeBinnable; - } -} -function outerExtentSignal(name, min, max, dataExtent) { - return { - name, - update: `[min(${min}, ${dataExtent}[0]), max(${max}, ${dataExtent}[1])]` - }; -} -function shouldBeIntegralBinStep(column) { - //prevent Vega from showing ".5" steps between integer scale values - return column.quantitative && column.type === 'integer' && column.stats.max - column.stats.min <= 7; -} - -},{"./constants":"22TRA","./expr":"eSi6o","./defaults":"jpVjH","./transforms":"iZfe4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iZfe4":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dataExtent", ()=>dataExtent); -var _expr = require("./expr"); -function dataExtent(column, signal) { - return { - type: 'extent', - field: (0, _expr.safeFieldName)(column.name), - signal - }; -} - -},{"./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iXWbC":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cross", ()=>Cross); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _constants = require("../constants"); -var _facetSearch = require("../facetSearch"); -var _facetTitle = require("../facetTitle"); -var _ordinal = require("../ordinal"); -var _scope = require("../scope"); -var _signals = require("../signals"); -class Cross extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `cross_${this.id}`; - this.binX = (0, _bin.binnable)(`${p}_x`, props.globalScope.data.name, props.groupbyX); - this.binY = (0, _bin.binnable)(`${p}_y`, props.globalScope.data.name, props.groupbyY); - this.names = { - facetDataName: `data_${p}_facet`, - searchUnion: `data_${p}_search`, - dimScale: `scale_${p}`, - dimCount: `${p}_count`, - dimCategorical: `data_${p}_cat`, - dimCellSize: `${p}_cell_size`, - dimCellSizeCalc: `${p}_cell_calc` - }; - } - getGrouping() { - return this.binX.fields.concat(this.binY.fields); - } - build() { - const { binX, binY, names, prefix, props } = this; - const { axisTextColor, colRowTitles, globalScope, parentScope } = props; - const titles = { - x: { - dataName: null, - quantitative: null - }, - y: { - dataName: null, - quantitative: null - } - }; - const dx = { - dim: 'x', - bin: binX, - sortOrder: 'ascending', - size: parentScope.sizeSignals.layoutWidth, - layout: parentScope.sizeSignals.layoutWidth, - min: globalScope.signals.minCellWidth.name, - out: globalScope.signals.plotWidthOut, - offset: (0, _constants.SignalNames).FacetPaddingLeft, - padding: (0, _constants.SignalNames).FacetPaddingLeft, - dataOut: null, - scaleName: null, - position: null - }; - const dy = { - dim: 'y', - bin: binY, - sortOrder: 'ascending', - size: parentScope.sizeSignals.layoutHeight, - layout: parentScope.sizeSignals.layoutHeight, - min: globalScope.signals.minCellHeight.name, - out: globalScope.signals.plotHeightOut, - offset: (0, _constants.SignalNames).FacetPaddingTop, - padding: `(${(0, _constants.SignalNames).FacetPaddingTop} + ${(0, _constants.SignalNames).FacetPaddingBottom})`, - dataOut: null, - scaleName: null, - position: null - }; - const dimensions = [ - dx, - dy - ]; - dimensions.forEach((d)=>{ - const { bin, dim, padding, sortOrder } = d; - let data; - let dataName; - let countSignal; - let scale; - const titleSource = titles[dim]; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - (0, _scope.addTransforms)(bin.dataSequence, { - type: 'formula', - expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, - as: (0, _constants.FieldNames).Contains - }); - data = bin.dataSequence; - dataName = bin.dataSequence.name; - countSignal = `length(data(${JSON.stringify(dataName)}))`; - scale = (0, _ordinal.ordinalScale)(dataName, `${names.dimScale}_${dim}`, bin.fields); - titleSource.dataName = bin.dataSequence.name; - } else { - dataName = globalScope.markDataName; - const ord = (0, _ordinal.createOrdinals)(dataName, `${prefix}_${dim}`, bin.fields, sortOrder); - data = ord.data; - (0, _scope.addData)(globalScope.scope, ord.data); - countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; - scale = ord.scale; - titleSource.dataName = ord.data.name; - } - titleSource.quantitative = bin.discreteColumn.column.quantitative; - d.dataOut = data; - d.scaleName = scale.name; - (0, _scope.addTransforms)(data, { - type: 'formula', - expr: (0, _facetSearch.serializeAsVegaExpression)(bin, (0, _constants.FieldNames).First, (0, _constants.FieldNames).Last), - as: (0, _constants.FieldNames).FacetSearch - }, { - type: 'formula', - expr: (0, _facetSearch.displayBin)(bin), - as: (0, _constants.FieldNames).FacetTitle - }); - (0, _scope.addScales)(globalScope.scope, scale); - const count = `${names.dimCount}_${dim}`; - const calc = `${names.dimCellSizeCalc}_${dim}`; - const size = `${names.dimCellSize}_${dim}`; - (0, _scope.addSignals)(globalScope.scope, { - name: count, - update: countSignal - }); - (0, _scope.addSignals)(globalScope.scope, { - name: calc, - update: `${d.layout} / ${count}` - }, { - name: size, - update: `max(${d.min}, (${calc} - ${padding}))` - }); - (0, _signals.modifySignal)(d.out, 'max', `((${size} + ${padding}) * ${count})`); - d.position = this.dimensionOffset(d); - }); - const groupRow = { - type: 'group', - encode: { - update: { - y: { - signal: dy.position - } - } - }, - from: { - data: dy.dataOut.name - }, - data: [ - { - name: names.searchUnion, - source: dx.dataOut.name, - transform: [ - { - type: 'formula', - expr: `[datum[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}], merge(parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}], { clause: '&&'})]`, - as: (0, _constants.FieldNames).FacetSearch - } - ] - } - ] - }; - const groupCol = { - style: 'cell', - name: prefix, - type: 'group', - encode: { - update: { - height: { - signal: `${names.dimCellSize}_y` - }, - width: { - signal: `${names.dimCellSize}_x` - }, - x: { - signal: dx.position - } - } - }, - from: { - data: names.searchUnion - } - }; - (0, _scope.addMarks)(globalScope.markGroup, groupRow); - (0, _scope.addMarks)(groupRow, groupCol); - const offsets = { - x: this.dimensionOffset(dx), - y: this.dimensionOffset(dy), - h: `${names.dimCellSize}_y`, - w: `${names.dimCellSize}_x` - }; - const sizeSignals = { - layoutHeight: `${names.dimCellSize}_y`, - layoutWidth: `${names.dimCellSize}_x`, - colCount: `${names.dimCount}_x`, - rowCount: `${names.dimCount}_y` - }; - if (colRowTitles) (0, _facetTitle.addFacetColRowTitles)(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); - return { - facetScope: groupCol, - offsets, - sizeSignals, - titles - }; - } - dimensionOffset(d) { - const { names } = this; - return `${d.offset} + (scale(${JSON.stringify(d.scaleName)}, datum[${JSON.stringify(d.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d.dim} + ${d.padding})`; - } -} - -},{"./layout":"i2QIi","../bin":"2ZuOQ","../constants":"22TRA","../facetSearch":"7jRmp","../facetTitle":"a1RbZ","../ordinal":"hxe8x","../scope":"9ojhQ","../signals":"Bq6BR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7jRmp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "displayBin", ()=>displayBin); -parcelHelpers.export(exports, "serializeAsVegaExpression", ()=>serializeAsVegaExpression); -function displayBin(bin) { - const val = (index)=>`datum[${JSON.stringify(bin.fields[index])}]`; - return bin.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); -} -function obj(nameValues, clause) { - if (clause) nameValues = [ - clause, - ...nameValues - ]; - return `{${nameValues.join()}}`; -} -function serializeAsVegaExpression(bin, firstFieldName, lastFieldName, clause) { - if (bin.discreteColumn.column.quantitative) { - const low = [ - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'>=\'', - `value:datum[${JSON.stringify(bin.fields[0])}]` - ]; - const high = [ - 'clause:\'&&\'', - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'<\'', - `value:datum[${JSON.stringify(bin.fields[1])}]` - ]; - return obj([ - `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]` - ], clause); - } else { - const exact = [ - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'==\'', - `value:datum[${JSON.stringify(bin.fields[0])}]` - ]; - return obj([ - `expressions:[${obj(exact)}]` - ], clause); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hxe8x":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createOrdinals", ()=>createOrdinals); -parcelHelpers.export(exports, "ordinalScale", ()=>ordinalScale); -var _constants = require("./constants"); -var _expr = require("./expr"); -function createOrdinals(source, prefix, binFields, sortOrder) { - const _binFields = binFields.map((0, _expr.safeFieldName)); - const dataName = `${prefix}_bin_order`; - const data = { - name: dataName, - source, - transform: [ - { - type: 'aggregate', - groupby: _binFields - }, - { - type: 'collect', - sort: { - field: _binFields, - order: _binFields.map((f)=>sortOrder) - } - }, - { - type: 'window', - ops: [ - 'row_number' - ], - as: [ - (0, _constants.FieldNames).Ordinal - ] - } - ] - }; - return { - data, - scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) - }; -} -function ordinalScale(dataName, scaleName, binFields) { - return { - type: 'ordinal', - name: scaleName, - domain: { - data: dataName, - field: (0, _expr.safeFieldName)(binFields[0]) - }, - range: { - data: dataName, - field: (0, _constants.FieldNames).Ordinal - } - }; -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eLCwq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scatter", ()=>Scatter); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _expr = require("../expr"); -var _scales = require("../scales"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _transforms = require("../transforms"); -var _bin = require("../bin"); -class Scatter extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `scatter_${this.id}`; - this.names = { - aggregateData: `data_${p}_aggregate`, - markData: `data_${p}_mark`, - xDataExtent: `${p}_xDataExtent`, - yDataExtent: `${p}_yDataExtent`, - xExtent: `${p}_xExtent`, - yExtent: `${p}_yExtent`, - sizeExtent: `${p}_sizeExtent`, - sizeRange: `${p}_sizeRange`, - sizeScale: `${p}_sizeScale`, - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x, y, z, zGrounded } = props; - const qsize = size && size.quantitative && size; - (0, _scope.addSignals)(globalScope.scope, { - name: (0, _constants.SignalNames).PointScale, - value: 5, - bind: { - name: scatterPointScaleDisplay, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: 10, - step: 0.1 - } - }, { - name: (0, _constants.SignalNames).ZGrounded, - value: false, - bind: { - name: zGrounded, - input: 'checkbox' - } - }); - if (backgroundImageExtents) { - (0, _scope.addTransforms)(globalScope.data, (0, _transforms.dataExtent)(x, names.xDataExtent), (0, _transforms.dataExtent)(y, names.yDataExtent)); - const xSignal = (0, _bin.outerExtentSignal)(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); - const ySignal = (0, _bin.outerExtentSignal)(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); - (0, _scope.addSignals)(globalScope.scope, xSignal, ySignal); - } - if (qsize) { - (0, _scope.addTransforms)(globalScope.data, { - type: 'extent', - field: (0, _expr.safeFieldName)(qsize.name), - signal: names.sizeExtent - }); - (0, _scope.addScales)(globalScope.scope, { - name: names.sizeScale, - type: 'pow', - exponent: 0.5, - domain: [ - 0, - { - signal: `${names.sizeExtent}[1]` - } - ], - range: [ - 0, - { - signal: names.sizeRange - } - ] - }); - (0, _scope.addSignals)(globalScope.scope, { - name: names.sizeRange, - update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${(0, _defaults.scatterSizedDiv)}` - }); - } - (0, _scope.addData)(globalScope.scope, { - name: names.markData, - source: globalScope.markDataName, - transform: [ - x, - y, - z - ].map((c)=>{ - if (!c || !c.quantitative) return; - const t = { - type: 'filter', - expr: `isValid(datum[${JSON.stringify(c.name)}])` - }; - return t; - }).filter(Boolean) - }); - globalScope.setMarkDataName(names.markData); - const globalScales = { - showAxes, - scales: {} - }; - const zValue = z ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z.name)}])` : null; - const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${(0, _constants.SignalNames).PointScale}` : (0, _constants.SignalNames).PointScale; - const update = Object.assign({ - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: sizeValueSignal - } - ], - width: { - signal: sizeValueSignal - } - }, z && { - z: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: `${(0, _constants.SignalNames).ZGrounded} ? 0 : ${zValue}` - } - ], - zindex: [ - { - signal: `${(0, _constants.SignalNames).ZGrounded} ? 0 : ${zValue}` - } - ], - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: view === '3d' ? `${(0, _constants.SignalNames).ZGrounded} ? ${zValue} : ${sizeValueSignal}` : '0' - } - ] - }); - const columnSignals = [ - { - column: x, - xyz: 'x', - scaleName: names.xScale, - domain: backgroundImageExtents ? { - signal: names.xExtent - } : { - data: globalScope.data.name, - field: (0, _expr.safeFieldName)(x.name) - }, - reverse: false, - signal: parentScope.sizeSignals.layoutWidth - }, - { - column: y, - xyz: 'y', - scaleName: names.yScale, - domain: backgroundImageExtents ? { - signal: names.yExtent - } : { - data: globalScope.data.name, - field: (0, _expr.safeFieldName)(y.name) - }, - reverse: true, - signal: parentScope.sizeSignals.layoutHeight - }, - { - column: z, - xyz: 'z', - scaleName: names.zScale, - domain: { - data: globalScope.data.name, - field: z ? (0, _expr.safeFieldName)(z.name) : null - }, - reverse: false, - signal: view === '3d' ? `(${globalScope.zSize}) * ${(0, _constants.SignalNames).ZProportion}` : `10 * ${(0, _constants.SignalNames).ZProportion}` - } - ]; - columnSignals.forEach((cs)=>{ - const { column, domain, reverse, scaleName, signal, xyz } = cs; - if (!column) return; - let scale; - if (column.quantitative) { - scale = (0, _scales.linearScale)(scaleName, domain, [ - 0, - { - signal - } - ], reverse, false, showAxes); - if ((0, _bin.shouldBeIntegralBinStep)(column)) scale.bins = { - step: 1 - }; - } else scale = (0, _scales.pointScale)(scaleName, globalScope.data.name, [ - 0, - { - signal - } - ], column.name, reverse); - globalScales.scales[xyz] = [ - scale - ]; - }); - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - return { - offsets: { - x: (0, _scope.addOffsets)(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x.name)}])`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y.name)}]) - ${sizeValueSignal}`), - h: sizeValueSignal, - w: sizeValueSignal - }, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - globalScales, - mark, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) - } - ] - } - }; - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../defaults":"jpVjH","../expr":"eSi6o","../scales":"feLP9","../scope":"9ojhQ","../selection":"ef2qR","../transforms":"iZfe4","../bin":"2ZuOQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5vsTh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Square", ()=>Square); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Square extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `square_${this.id}`; - this.names = { - bandWidth: this.getBandWidth(), - maxGroupField: `${p}_max_group`, - maxGroupSignal: `${p}_max_grouping`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - (0, _scope.addTransforms)(globalScope.data, Object.assign({ - type: 'stack', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - as: [ - names.stack0, - names.stack1 - ] - }, sortBy && { - sort: { - field: (0, _expr.safeFieldName)(sortBy.name), - order: 'ascending' - } - })); - const { gap, levelSize, size, squaresPerBand } = this.addSignals(); - const heightSignal = { - signal: fillDirection === 'down-right' ? size : levelSize - }; - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update: Object.assign({ - height: collapseYHeight ? [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - heightSignal - ] : heightSignal, - width: { - signal: fillDirection === 'down-right' ? levelSize : size - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - const { tx, ty } = this.transformXY(gap, levelSize, squaresPerBand); - return Object.assign(Object.assign(Object.assign({}, z && { - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - } - }), { - offsets: { - x: (0, _scope.addOffsets)(parentScope.offsets.x, tx.expr), - y: (0, _scope.addOffsets)(parentScope.offsets.y, ty.expr), - h: size, - w: size - }, - mark, - sizeSignals: { - layoutHeight: size, - layoutWidth: size - } - }), collapseYHeight && { - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.y - } - ] - } - }); - } - getBandWidth() { - const { offsets } = this.props.parentScope; - switch(this.props.fillDirection){ - case 'down-right': - return offsets.h; - default: - return offsets.w; - } - } - addSignals() { - const { names, props } = this; - const { fillDirection, globalScope, groupings, parentScope } = props; - let { maxGroupedFillSize, maxGroupedUnits } = props; - if (!maxGroupedUnits) { - if (groupings) { - (0, _scope.addTransforms)(globalScope.data, { - type: 'joinaggregate', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - ops: [ - 'count' - ], - as: [ - names.maxGroupField - ] - }, { - type: 'extent', - field: names.maxGroupField, - signal: names.maxGroupSignal - }); - maxGroupedUnits = `(${names.maxGroupSignal}[1])`; - } else maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; - } - if (!maxGroupedFillSize) maxGroupedFillSize = fillDirection === 'down-right' ? parentScope.offsets.w : parentScope.offsets.h; - const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; - const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; - const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; - const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; - const levels = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; - const levelSize = `(((${maxGroupedFillSize}) / ${levels}) - ${gap})`; - return { - gap, - levelSize, - size, - squaresPerBand - }; - } - transformXY(gap, levelSize, squaresPerBand) { - const { names, prefix } = this; - const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; - const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; - const { fillDirection, parentScope } = this.props; - const tx = { - type: 'formula', - expr: null, - as: `${prefix}_${(0, _constants.FieldNames).OffsetX}` - }; - const ty = { - type: 'formula', - expr: null, - as: `${prefix}_${(0, _constants.FieldNames).OffsetY}` - }; - switch(fillDirection){ - case 'down-right': - tx.expr = `${level} * (${levelSize} + ${gap})`; - ty.expr = compartment; - break; - case 'right-up': - tx.expr = compartment; - ty.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; - break; - case 'right-down': - default: - tx.expr = compartment; - ty.expr = `${level} * (${levelSize} + ${gap})`; - break; - } - return { - tx, - ty - }; - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../zBase":"iUpjg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUpjg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addZScale", ()=>addZScale); -var _constants = require("./constants"); -var _scales = require("./scales"); -var _expr = require("./expr"); -function addZScale(z, zSize, dataName, zScaleName) { - if (z) { - const zRange = [ - 0, - { - signal: `(${zSize}) * ${(0, _constants.SignalNames).ZProportion}` - } - ]; - const scale = z.quantitative ? (0, _scales.linearScale)(zScaleName, { - data: dataName, - field: (0, _expr.safeFieldName)(z.name) - }, zRange, false, true) : (0, _scales.pointScale)(zScaleName, dataName, zRange, z.name, false); - return scale; - } -} - -},{"./constants":"22TRA","./scales":"feLP9","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l09WI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Stack", ()=>Stack); -var _layout = require("./layout"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class Stack extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `stack_${this.id}`; - this.names = { - cube: `${p}_cube`, - globalDataName: `data_${p}_count`, - globalExtent: `${p}_global_extent`, - levelDataName: `data_${p}_level`, - count: `${p}_count`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - sequence: `data_${p}_sequence`, - sides: `${p}_sides`, - size: `${p}_size`, - squared: `${p}_squared`, - maxCount: `${p}_maxCount`, - maxLevels: `${p}_maxLevels`, - zScale: `${p}_zScale` - }; - } - build() { - const { names, props } = this; - const { globalScope, groupings, parentScope, showAxes, sort } = props; - const { sizeSignals } = parentScope; - (0, _scope.addTransforms)(globalScope.data, { - type: 'joinaggregate', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - ops: [ - 'count' - ], - as: [ - names.count - ] - }, { - type: 'extent', - field: names.count, - signal: names.globalExtent - }, Object.assign({ - type: 'stack', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - as: [ - names.stack0, - names.stack1 - ] - }, sort && { - sort: { - field: (0, _expr.safeFieldName)(sort.name), - order: 'ascending' - } - })); - (0, _scope.addData)(globalScope.scope, { - name: names.sequence, - transform: [ - { - type: 'sequence', - start: 1, - stop: { - signal: `sqrt(${names.globalExtent}[1])` - } - }, - { - type: 'formula', - expr: 'datum.data * datum.data', - as: 'squared' - }, - { - type: 'formula', - expr: `ceil(${names.globalExtent}[1] / datum.squared)`, - as: 'maxlevels' - }, - { - type: 'formula', - expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, - as: 'side' - }, - { - type: 'formula', - expr: 'datum.side * datum.maxlevels + datum.maxlevels - 1', - as: 'sidecubeheight' - }, - { - type: 'formula', - expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, - as: 'heightmatch' - }, - { - type: 'collect', - sort: { - field: 'heightmatch', - order: 'ascending' - } - }, - { - type: 'window', - ops: [ - 'row_number' - ] - }, - { - type: 'filter', - expr: 'datum.row_number === 1' - } - ] - }); - (0, _scope.addSignals)(globalScope.scope, { - name: names.size, - update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` - }, { - name: names.squared, - update: `data('${names.sequence}')[0].squared` - }, { - name: names.sides, - update: `sqrt(${names.squared})` - }, { - name: names.cube, - update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` - }, { - name: names.maxLevels, - update: `data('${names.sequence}')[0].maxlevels` - }, { - name: names.maxCount, - update: `${names.maxLevels} * ${names.squared}` - }); - const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; - const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; - const cubeX = `(${layerOrdinal} % ${names.sides})`; - const cubeY = `floor(${layerOrdinal} / ${names.sides})`; - const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; - const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), - h: names.size, - w: names.size - }; - const mark = { - type: 'rect', - from: { - data: this.names.levelDataName - }, - encode: { - update: { - z: { - signal: `${zLevel} * (${names.cube} + 1)` - }, - height: { - signal: names.cube - }, - width: { - signal: names.cube - }, - depth: { - signal: names.cube - } - } - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - const zScale = { - type: 'linear', - name: names.zScale, - domain: [ - 0, - { - signal: names.maxCount - } - ], - range: [ - 0, - { - signal: `${names.maxLevels} * (${names.cube} + 1) - 1` - } - ], - nice: false - }; - return { - offsets, - mark, - sizeSignals: { - layoutHeight: names.size, - layoutWidth: names.size - }, - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - }, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.y - } - ], - z: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ], - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } -} - -},{"./layout":"i2QIi","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7mPSq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Strip", ()=>Strip); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Strip extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `strip_${this.id}`; - this.names = { - firstField: `${p}${(0, _constants.FieldNames).First}`, - lastField: `${p}${(0, _constants.FieldNames).Last}`, - valueField: `${p}${(0, _constants.FieldNames).Value}`, - scale: `scale_${p}`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort, sortOrder, parentScope, view, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - const horizontal = orientation === 'horizontal'; - const transform = []; - if (sort) transform.push({ - type: 'collect', - sort: { - field: (0, _expr.safeFieldName)(sort.name), - order: sortOrder - } - }); - let stackField; - if (size) { - stackField = size.name; - transform.push({ - type: 'filter', - expr: `datum[${JSON.stringify(size.name)}] > 0` - }); - } else { - stackField = names.valueField; - transform.push({ - type: 'formula', - expr: '1', - as: stackField - }); - } - const stackTransform = { - type: 'stack', - field: (0, _expr.safeFieldName)(stackField), - offset: 'normalize', - as: [ - names.firstField, - names.lastField - ] - }; - if (groupings.length) stackTransform.groupby = (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)); - transform.push(stackTransform); - (0, _scope.addTransforms)(globalScope.data, ...transform); - const span = [ - names.lastField, - names.firstField - ].map((f)=>`datum[${JSON.stringify(f)}]`).join(' - '); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ''), - y: (0, _scope.addOffsets)(parentScope.offsets.y, horizontal ? '' : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), - h: horizontal ? parentScope.offsets.h : `(${span}) * (${parentScope.offsets.h})`, - w: horizontal ? `(${span}) * (${parentScope.offsets.w})` : parentScope.offsets.w - }; - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update: Object.assign({ - height: { - signal: offsets.h - }, - width: { - signal: offsets.w - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - let percentageScale; - if (addPercentageScale) percentageScale = [ - { - type: 'linear', - name: names.scale, - domain: [ - 0, - 100 - ], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ] - } - ]; - return { - globalScales: { - showAxes, - scales: { - x: horizontal ? percentageScale : undefined, - y: horizontal ? undefined : percentageScale, - z: zScale && [ - zScale - ] - } - }, - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - mark - }; - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../zBase":"iUpjg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"caw7y":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Treemap", ()=>Treemap); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Treemap extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `treemap_${this.id}`; - this.names = { - dataName: `data_${p}`, - dataHeightWidth: `data_${p}_hw`, - dataExtents: `data_${p}_extents`, - dataFacet: `data_${p}_facet`, - dataFacetMark: `data_${p}_facetMark`, - fieldChildren: `${p}_children`, - fieldDepth: `${p}_depth`, - fieldX0: `${p}_x0`, - fieldX1: `${p}_x1`, - fieldY0: `${p}_y0`, - fieldY1: `${p}_y1`, - fieldHeight: `${p}_h`, - fieldWidth: `${p}_w`, - heightExtent: `${p}_heightExtent`, - widthExtent: `${p}_widthExtent`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, props } = this; - const { globalScope, parentScope, showAxes, treeMapMethod, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, fn(names.fieldX0)), - y: (0, _scope.addOffsets)(parentScope.offsets.y, fn(names.fieldY0)), - h: subtract(names.fieldY1, names.fieldY0), - w: subtract(names.fieldX1, names.fieldX0) - }; - const mark = this.transformedMark(offsets); - (0, _scope.addSignals)(globalScope.scope, { - name: (0, _constants.SignalNames).TreeMapMethod, - value: 'squarify', - bind: { - name: treeMapMethod, - input: 'select', - options: [ - 'squarify', - 'binary' - ] - } - }); - return Object.assign(Object.assign({}, z && { - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - } - }), { - mark, - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - } - }); - } - transformedMark(offsets) { - const { names, props } = this; - const { globalScope, groupings, parentScope } = props; - if (groupings.length) { - //treemap transform can't have it's boundary size grouped, so we need to facet the data. - (0, _scope.addData)(globalScope.scope, { - name: names.dataHeightWidth, - source: globalScope.markDataName, - transform: [ - { - type: 'formula', - expr: parentScope.offsets.h, - as: names.fieldHeight - }, - { - type: 'formula', - expr: parentScope.offsets.w, - as: names.fieldWidth - } - ] - }); - const treemapData = { - name: names.dataFacetMark, - source: names.dataFacet - }; - const facets = { - type: 'group', - from: { - facet: { - name: names.dataFacet, - data: names.dataHeightWidth, - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)) - } - }, - data: [ - { - name: names.dataExtents, - source: names.dataFacet, - transform: [ - { - type: 'extent', - field: names.fieldHeight, - signal: names.heightExtent - }, - { - type: 'extent', - field: names.fieldWidth, - signal: names.widthExtent - } - ] - }, - treemapData - ] - }; - globalScope.setMarkDataName(names.dataFacetMark); - (0, _scope.addMarks)(globalScope.markGroup, facets); - //assign new markgroup after adding mark to original group - globalScope.setMarkGroup(facets); - this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); - return this.addMark(offsets, facets, globalScope.markDataName); - } else { - this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); - return this.addMark(offsets, globalScope.markGroup, globalScope.markDataName); - } - } - addMark(offsets, markParent, markDataName) { - const { names, prefix, props } = this; - const { view, z } = props; - const mark = { - name: prefix, - type: 'rect', - from: { - data: markDataName - }, - encode: { - update: Object.assign({ - width: { - signal: offsets.w - }, - height: { - signal: offsets.h - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(markParent, mark); - return mark; - } - treemapTransform(treemapData, widthSignal, heightSignal) { - const { names, props } = this; - const { group, size } = props; - (0, _scope.addTransforms)(treemapData, { - type: 'filter', - expr: `datum[${JSON.stringify(size.name)}] > 0` - }, { - type: 'nest', - keys: [ - group && group.name || '__NONE__' - ] - }, { - type: 'treemap', - field: (0, _expr.safeFieldName)(size.name), - sort: { - field: 'value', - order: 'descending' - }, - round: true, - method: { - signal: (0, _constants.SignalNames).TreeMapMethod - }, - paddingInner: 1, - paddingOuter: 0, - size: [ - { - signal: widthSignal - }, - { - signal: heightSignal - } - ], - as: [ - names.fieldX0, - names.fieldY0, - names.fieldX1, - names.fieldY1, - names.fieldDepth, - names.fieldChildren - ] - }); - } -} -function fn(n) { - return `datum[${JSON.stringify(n)}]`; -} -function subtract(...fields) { - return fields.map((n)=>fn(n)).join(' - '); -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../zBase":"iUpjg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iDL5r":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Wrap", ()=>Wrap); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _facetSearch = require("../facetSearch"); -var _facetTitle = require("../facetTitle"); -var _ordinal = require("../ordinal"); -var _scope = require("../scope"); -var _signals = require("../signals"); -class Wrap extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `wrap_${this.id}`; - this.bin = (0, _bin.binnable)(this.prefix, props.globalScope.data.name, props.groupby); - this.names = { - outputData: `data_${p}_out`, - rowColumnDataName: `data_${p}_row_col`, - cellHeight: `${p}_cellHeight`, - cellWidth: `${p}_cellWidth`, - fits: `${p}_fits`, - target: `${p}_target`, - minArea: `${p}_minArea`, - aspect: `${p}_aspect`, - minAspect: `${p}_minAspect`, - idealAspect: `${p}_idealAspect`, - dataLength: `${p}_dataLength`, - rxc0: `${p}_rxc0`, - rxc1: `${p}_rxc1`, - rxc2: `${p}_rxc2`, - rxc: `${p}_rxc`, - growColCount: `${p}_growColCount`, - growCellWidth: `${p}_growCellWidth`, - fitsArea: `${p}_fitsArea`, - colCount: `${p}_colCount` - }; + return { + axisScales, + layouts, + specCapabilities: { + backgroundImage: true, + countsAndSums: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function grid(specContext) { + var _a2; + const { insight, specColumns } = specContext; + const { view } = insight; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + collapseYHeight: true, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + return { + axisScales, + layouts: [ + { + layoutType: "Square", + props: squareProps + } + ], + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "z", + axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function scatterplot(specContext) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; + const { insight, specColumns, specViewOptions } = specContext; + const backgroundImageExtents = ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) && ((_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.quantitative) && ((_c2 = insight.backgroundImage) === null || _c2 === void 0 ? void 0 : _c2.extents); + const scatterProps = { + x: specColumns.x, + y: specColumns.y, + z: specColumns.z, + size: specColumns.size, + scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, + zGrounded: specViewOptions.language.zGrounded, + backgroundImageExtents, + showAxes: !(backgroundImageExtents || insight.hideAxes), + view: insight.view + }; + const axisScales = { + x: { title: (_d2 = specColumns.x) === null || _d2 === void 0 ? void 0 : _d2.name }, + y: { title: (_e2 = specColumns.y) === null || _e2 === void 0 ? void 0 : _e2.name }, + z: { title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name } + }; + return { + axisScales, + layouts: [ + { + layoutType: "Scatter", + props: scatterProps + } + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact" + }, + { + role: "y", + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact" + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: false + }, + { + role: "color", + allowNone: true + }, + { + role: "size", + excludeCategoric: true, + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.PointScale, SignalNames.ZGrounded] + } + }; + } + function stacks(specContext) { + var _a2, _b2, _c2, _d2, _e2, _f, _g; + const { insight, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.name }, + y: { title: (_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.name }, + z: { title: specViewOptions.language.count } + }; + const backgroundImage = ((_c2 = specColumns.x) === null || _c2 === void 0 ? void 0 : _c2.quantitative) && ((_d2 = specColumns.y) === null || _d2 === void 0 ? void 0 : _d2.quantitative) && ((_e2 = insight.backgroundImage) === null || _e2 === void 0 ? void 0 : _e2.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } + }; + const stackProps = { + sort: specColumns.sort, + showAxes + }; + return { + axisScales, + customZScale: true, + layouts: [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "Stack", + props: stackProps + } + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function strips(specContext) { + var _a2; + const { insight, specColumns } = specContext; + const { view } = insight; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: specColumns.size ? "sum" : "count" + }; + const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; + const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); } - getGrouping() { - return this.bin.fields; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + allowNone: true, + //size by none is a count + excludeCategoric: true + }, + { + role: "z", + axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function treemap$1(specContext) { + var _a2; + const { insight, specColumns, specViewOptions } = specContext; + const { view } = insight; + const treemapProps = { + corner: "top-left", + group: specColumns.group, + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: "sum" + }; + const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; + const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); } - build() { - const { bin, names, prefix, props } = this; - const { axisTextColor, cellTitles, globalScope, parentScope } = props; - let ordinalBinData; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - (0, _scope.addTransforms)(bin.dataSequence, { - type: 'formula', - expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, - as: (0, _constants.FieldNames).Contains - }); - ordinalBinData = bin.dataSequence.name; - } else { - const ord = (0, _ordinal.createOrdinals)(globalScope.data.name, prefix, bin.fields, 'ascending'); - (0, _scope.addData)(globalScope.scope, ord.data); - ordinalBinData = ord.data.name; - } - (0, _scope.addData)(globalScope.scope, { - name: names.rxc0, - transform: [ - { - type: 'sequence', - start: 1, - stop: { - signal: `ceil(sqrt(${names.dataLength})) + 1` - } - }, - { - type: 'formula', - expr: `ceil(${names.dataLength} / datum.data)`, - as: 'complement' - } - ] - }, { - name: names.rxc1, - source: names.rxc0, - transform: [ - { - type: 'project', - fields: [ - 'data' - ], - as: [ - 'cols' - ] - } - ] - }, { - name: names.rxc2, - source: names.rxc0, - transform: [ - { - type: 'project', - fields: [ - 'complement' - ], - as: [ - 'cols' - ] - } - ] - }, { - name: names.rxc, - source: [ - names.rxc1, - names.rxc2 - ], - transform: [ - { - type: 'formula', - expr: `ceil(${names.dataLength} / datum.cols)`, - as: 'rows' - }, - { - type: 'formula', - expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, - as: 'cellw' - }, - { - type: 'formula', - expr: `datum.cols === 1 ? max(datum.cellw, ${(0, _constants.SignalNames).MinCellWidth}) : datum.cellw`, - as: 'cellw' - }, - { - type: 'formula', - expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, - as: 'cellh' - }, - { - type: 'formula', - expr: `datum.rows === 1 ? max(datum.cellh, ${(0, _constants.SignalNames).MinCellHeight}) : datum.cellh`, - as: 'cellh' - }, - { - type: 'formula', - expr: `(datum.cellw >= ${(0, _constants.SignalNames).MinCellWidth} && datum.cellh >= ${(0, _constants.SignalNames).MinCellHeight})`, - as: 'meetsmin' - }, - { - type: 'filter', - expr: 'datum.meetsmin' - }, - { - type: 'formula', - expr: 'datum.cellw / datum.cellh', - as: names.aspect - }, - { - type: 'formula', - expr: `abs(datum.${names.aspect} - ${names.target})`, - as: names.idealAspect - }, - { - type: 'formula', - expr: `${names.dataLength} / (datum.cols * datum.rows)`, - as: 'coverage' - }, - { - type: 'collect', - sort: { - field: [ - names.idealAspect, - 'coverage' - ], - order: [ - 'ascending', - 'descending' - ] - } - } - ] - }, { - name: names.rowColumnDataName, - source: ordinalBinData, - transform: [ - { - type: 'formula', - expr: `floor((datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1) / ${names.colCount})`, - as: (0, _constants.FieldNames).WrapRow - }, - { - type: 'formula', - expr: `(datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1) % ${names.colCount}`, - as: (0, _constants.FieldNames).WrapCol - }, - { - type: 'formula', - expr: (0, _facetSearch.serializeAsVegaExpression)(bin, (0, _constants.FieldNames).First, (0, _constants.FieldNames).Last), - as: (0, _constants.FieldNames).FacetSearch - }, - { - type: 'formula', - expr: (0, _facetSearch.displayBin)(bin), - as: (0, _constants.FieldNames).FacetTitle - } - ] - }); - const dataOut = { - name: names.outputData, - source: globalScope.data.name, - transform: [ - { - type: 'lookup', - from: names.rowColumnDataName, - key: (0, _expr.safeFieldName)(bin.fields[0]), - fields: [ - bin.fields[0] - ].map((0, _expr.safeFieldName)), - values: [ - (0, _constants.FieldNames).WrapRow, - (0, _constants.FieldNames).WrapCol - ] - } - ] - }; - (0, _scope.addData)(globalScope.scope, dataOut); - globalScope.setMarkDataName(names.outputData); - (0, _scope.addSignals)(globalScope.scope, { - name: names.minAspect, - update: `${(0, _constants.SignalNames).MinCellWidth} / ${(0, _constants.SignalNames).MinCellHeight}` - }, { - name: names.target, - update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}` - }, { - name: names.minArea, - update: `${(0, _constants.SignalNames).MinCellWidth}*${(0, _constants.SignalNames).MinCellHeight}` - }, { - name: names.aspect, - update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` - }, { - name: names.dataLength, - update: `data(${JSON.stringify(ordinalBinData)}).length` - }, { - name: names.growColCount, - update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${(0, _constants.SignalNames).MinCellWidth}), 1)` - }, { - name: names.growCellWidth, - update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` - }, { - name: names.fitsArea, - update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` - }, { - name: names.fits, - update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` - }, { - name: names.colCount, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` - }, { - name: names.cellWidth, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` - }, { - name: names.cellHeight, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${(0, _constants.SignalNames).MinCellHeight}` - }); - (0, _signals.modifySignal)(globalScope.signals.plotHeightOut, 'max', `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); - (0, _signals.modifySignal)(globalScope.signals.plotWidthOut, 'max', `(${names.cellWidth} * ${names.colCount})`); - const signalH = [ - names.cellHeight, - (0, _constants.SignalNames).FacetPaddingTop, - (0, _constants.SignalNames).FacetPaddingBottom - ].join(' - '); - const signalW = [ - names.cellWidth, - (0, _constants.SignalNames).FacetPaddingLeft - ].join(' - '); - const signalX = (0, _scope.addOffsets)(parentScope.offsets.x, `datum[${JSON.stringify((0, _constants.FieldNames).WrapCol)}] * ${names.cellWidth}`, (0, _constants.SignalNames).FacetPaddingLeft); - const signalY = (0, _scope.addOffsets)(parentScope.offsets.y, `datum[${JSON.stringify((0, _constants.FieldNames).WrapRow)}] * ${names.cellHeight}`, (0, _constants.SignalNames).FacetPaddingTop); - const update = { - height: { - signal: signalH - }, - width: { - signal: signalW - }, - x: { - signal: signalX - }, - y: { - signal: signalY - } - }; - const offsets = { - x: signalX, - y: signalY, - h: signalH, - w: signalW - }; - const group = { - style: 'cell', - name: prefix, - type: 'group', - from: { - data: names.rowColumnDataName - }, - encode: { - update - } - }; - (0, _scope.addMarks)(globalScope.markGroup, group); - const sizeSignals = { - layoutHeight: `(${names.cellHeight} - ${(0, _constants.SignalNames).FacetPaddingTop} - ${(0, _constants.SignalNames).FacetPaddingBottom})`, - layoutWidth: `(${names.cellWidth} - ${(0, _constants.SignalNames).FacetPaddingLeft})`, - colCount: names.colCount, - rowCount: `ceil(${names.dataLength} / ${names.colCount})` - }; - if (cellTitles) (0, _facetTitle.addFacetCellTitles)(group, sizeSignals, axisTextColor); - return { - facetScope: group, - sizeSignals, - offsets + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + excludeCategoric: true + }, + { + role: "group", + allowNone: true + }, + { + role: "z", + axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.TreeMapMethod] + } + }; + } + function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { + let layoutPair; + const groupby = facetColumn; + const plotPadding = { + x: 0, + y: 0 + }; + let facetPadding; + switch (facetStyle) { + case "cross": { + const props = { + axisTextColor, + colRowTitles: true, + groupbyX: groupby, + groupbyY: facetVColumn + }; + layoutPair = { + layoutType: "Cross", + props + }; + facetPadding = { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: 0 + }; + plotPadding.y = facetPaddingTop; + plotPadding.x = facetPaddingRight; + break; + } + case "wrap": + default: { + const props = { + axisTextColor, + cellTitles: true, + groupby + }; + layoutPair = { + layoutType: "Wrap", + props + }; + facetPadding = { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: facetPaddingTop }; + break; + } } -} - -},{"./layout":"i2QIi","../bin":"2ZuOQ","../constants":"22TRA","../expr":"eSi6o","../facetSearch":"7jRmp","../facetTitle":"a1RbZ","../ordinal":"hxe8x","../scope":"9ojhQ","../signals":"Bq6BR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"akfUH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getImageMark", ()=>getImageMark); -var _band = require("./layouts/band"); -function getImageMark(backgroundImage, allGlobalScales) { - const xScale = allGlobalScales.filter((s)=>s.scales.x)[0].scales.x[0]; - const yScale = allGlobalScales.filter((s)=>s.scales.y)[0].scales.y[0]; - const [xScaleName, yScaleName] = [ - xScale, - yScale - ].map((s)=>s.name + (xScale.type === 'band' ? (0, _band.bandScaleLinearSuffix) : '')); + const facetLayout = { + facetPadding, + plotPadding + }; return { - type: 'image', - encode: { - update: { - url: { - value: backgroundImage.url - }, - aspect: { - value: false - }, - baseline: { - value: 'bottom' - }, - height: { - signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) - }, - y: { - signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) - }, - width: { - signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) - }, - x: { - signal: getScaledValue(xScaleName, backgroundImage.extents.left) - } - } - } + layoutPair, + facetLayout }; -} -function getScaledSpan(scaleName, low, high) { - return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; -} -function getScaledValue(scaleName, value) { - return `scale('${scaleName}', ${value})`; -} - -},{"./layouts/band":"3pFuA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d6Ht8":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NHSP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4F93b":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _compare = require("./compare"); -parcelHelpers.exportAll(_compare, exports); -var _exec = require("./exec"); -parcelHelpers.exportAll(_exec, exports); -var _group = require("./group"); -parcelHelpers.exportAll(_group, exports); -var _invert = require("./invert"); -parcelHelpers.exportAll(_invert, exports); -var _narrow = require("./narrow"); -parcelHelpers.exportAll(_narrow, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./compare":"lDdGy","./exec":"ekkGf","./group":"4OkbD","./invert":"DMPkf","./narrow":"jhXKW","./types":"eHpZP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lDdGy":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "compareExpression", ()=>compareExpression); -parcelHelpers.export(exports, "compareGroup", ()=>compareGroup); -parcelHelpers.export(exports, "compare", ()=>compare); -parcelHelpers.export(exports, "startsWith", ()=>startsWith); -var _group = require("./group"); -const expressionKeys = Object.keys({ - clause: null, - name: null, - operator: null, - value: null -}); -function compareExpression(a, b) { - if (a && b) for(let k = 0; k < expressionKeys.length; k++){ - const key = expressionKeys[k]; - if (a[key] != b[key]) return false; - } - else return !a && !b; - return true; -} -const groupKeys = Object.keys({ - clause: null -}); -function compareGroup(a, b) { - for(let k = 0; k < groupKeys.length; k++){ - const key = groupKeys[k]; - if (a[key] != b[key]) return false; - } - if (!a.expressions && !b.expressions) return true; - if (!a.expressions || !b.expressions) return false; - if (a.expressions.length != b.expressions.length) return false; - for(let i = 0; i < a.expressions.length; i++){ - if (!compareExpression(a.expressions[i], b.expressions[i])) return false; + } + const map$4 = { + barchart: barchartV, + barchartH, + barchartV, + density, + grid, + scatterplot, + stacks, + strips, + treemap: treemap$1 + }; + function getSpecBuilderPropsForChart(specContext) { + const { insight, specColumns, specViewOptions } = specContext; + const fn2 = map$4[insight.chart]; + if (fn2) { + const props = fn2(specContext); + if (insight.columns.facet) { + const discreteFacetColumn = { + column: specColumns.facet, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, + maxbinsSignalName: SignalNames.FacetBins + }; + const discreteFacetVColumn = { + column: specColumns.facetV, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, + maxbinsSignalName: SignalNames.FacetVBins + }; + const { facetLayout, layoutPair } = getFacetLayout(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); + props.layouts.unshift(layoutPair); + props.facetLayout = facetLayout; + props.collapseFacetAxes = specViewOptions.collapseFacetAxes; + } + return props; } - return true; -} -function compare(a, b) { - if (a == b) return true; - if (!a || !b) return false; - const arrs = [ - a, - b - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [arrA, arrB] = arrs; - if (arrA.length != arrB.length) return false; - for(let i = 0; i < arrA.length; i++){ - if (!compareGroup(arrA[i], arrB[i])) return false; + } + function define2(constructor, factory, prototype2) { + constructor.prototype = factory.prototype = prototype2; + prototype2.constructor = constructor; + } + function extend$1(parent, definition2) { + var prototype2 = Object.create(parent.prototype); + for (var key2 in definition2) prototype2[key2] = definition2[key2]; + return prototype2; + } + function Color$2() { + } + var darker = 0.7; + var brighter = 1 / darker; + var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + var named = { + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 + }; + define2(Color$2, color$2, { + copy(channels) { + return Object.assign(new this.constructor(), this, channels); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, + // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + function color_formatHex() { + return this.rgb().formatHex(); + } + function color_formatHex8() { + return this.rgb().formatHex8(); + } + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + function color_formatRgb() { + return this.rgb().formatRgb(); + } + function color$2(format2) { + var m2, l; + format2 = (format2 + "").trim().toLowerCase(); + return (m2 = reHex.exec(format2)) ? (l = m2[1].length, m2 = parseInt(m2[1], 16), l === 6 ? rgbn(m2) : l === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; + } + function rgbn(n) { + return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); + } + function rgba(r, g, b2, a2) { + if (a2 <= 0) r = g = b2 = NaN; + return new Rgb(r, g, b2, a2); + } + function rgbConvert(o) { + if (!(o instanceof Color$2)) o = color$2(o); + if (!o) return new Rgb(); + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } + function rgb$1(r, g, b2, opacity2) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b2, opacity2 == null ? 1 : opacity2); + } + function Rgb(r, g, b2, opacity2) { + this.r = +r; + this.g = +g; + this.b = +b2; + this.opacity = +opacity2; + } + define2(Rgb, rgb$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); + }, + hex: rgb_formatHex, + // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + function rgb_formatRgb() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`; + } + function clampa(opacity2) { + return isNaN(opacity2) ? 1 : Math.max(0, Math.min(1, opacity2)); + } + function clampi(value2) { + return Math.max(0, Math.min(255, Math.round(value2) || 0)); + } + function hex(value2) { + value2 = clampi(value2); + return (value2 < 16 ? "0" : "") + value2.toString(16); + } + function hsla(h2, s2, l, a2) { + if (a2 <= 0) h2 = s2 = l = NaN; + else if (l <= 0 || l >= 1) h2 = s2 = NaN; + else if (s2 <= 0) h2 = NaN; + return new Hsl(h2, s2, l, a2); + } + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color$2)) o = color$2(o); + if (!o) return new Hsl(); + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, min2 = Math.min(r, g, b2), max2 = Math.max(r, g, b2), h2 = NaN, s2 = max2 - min2, l = (max2 + min2) / 2; + if (s2) { + if (r === max2) h2 = (g - b2) / s2 + (g < b2) * 6; + else if (g === max2) h2 = (b2 - r) / s2 + 2; + else h2 = (r - g) / s2 + 4; + s2 /= l < 0.5 ? max2 + min2 : 2 - max2 - min2; + h2 *= 60; + } else { + s2 = l > 0 && l < 1 ? 0 : h2; } - return true; -} -function startsWith(whole, part) { - if (!part) return true; - const arrs = [ - whole, - part - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [wholeArray, partArray] = arrs; - if (partArray.length > wholeArray.length) return false; - for(let i = 0; i < partArray.length; i++){ - if (!compareGroup(wholeArray[i], partArray[i])) return false; + return new Hsl(h2, s2, l, o.opacity); + } + function hsl$1(h2, s2, l, opacity2) { + return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l, opacity2 == null ? 1 : opacity2); + } + function Hsl(h2, s2, l, opacity2) { + this.h = +h2; + this.s = +s2; + this.l = +l; + this.opacity = +opacity2; + } + define2(Hsl, hsl$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s2, m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2), + hsl2rgb(h2, m1, m2), + hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2), + this.opacity + ); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); + }, + formatHsl() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`; + } + })); + function clamph(value2) { + value2 = (value2 || 0) % 360; + return value2 < 0 ? value2 + 360 : value2; + } + function clampt(value2) { + return Math.max(0, Math.min(1, value2 || 0)); + } + function hsl2rgb(h2, m1, m2) { + return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255; + } + const radians$1 = Math.PI / 180; + const degrees$2 = 180 / Math.PI; + const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0$2 = 4 / 29, t1$1 = 6 / 29, t2 = 3 * t1$1 * t1$1, t3 = t1$1 * t1$1 * t1$1; + function labConvert(o) { + if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); + if (o instanceof Hcl) return hcl2lab(o); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b2 = rgb2lrgb(o.b), y2 = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b2) / Yn), x2, z2; + if (r === g && g === b2) x2 = z2 = y2; + else { + x2 = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b2) / Xn); + z2 = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b2) / Zn); } - return true; -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4OkbD":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isSearchExpressionGroup", ()=>isSearchExpressionGroup); -parcelHelpers.export(exports, "createGroupFromExpression", ()=>createGroupFromExpression); -parcelHelpers.export(exports, "ensureSearchExpressionGroupArray", ()=>ensureSearchExpressionGroupArray); -function isSearchExpressionGroup(search) { - if (!search) return false; - return !!search.expressions; -} -function createGroupFromExpression(input) { - const output = { - expressions: [ - input - ] - }; - return output; -} -function ensureSearchExpressionGroupArray(search) { - if (Array.isArray(search)) return [ - ...search - ]; - else if (isSearchExpressionGroup(search)) return [ - search - ]; - else return [ - createGroupFromExpression(search) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ekkGf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Exec", ()=>Exec); -var _group = require("./group"); -function valueToBoolean(value) { - if (typeof value === 'string') switch(value.toLowerCase()){ - case 'true': - return true; - case 'false': - return false; + return new Lab(116 * y2 - 16, 500 * (x2 - y2), 200 * (y2 - z2), o.opacity); + } + function lab$1(l, a2, b2, opacity2) { + return arguments.length === 1 ? labConvert(l) : new Lab(l, a2, b2, opacity2 == null ? 1 : opacity2); + } + function Lab(l, a2, b2, opacity2) { + this.l = +l; + this.a = +a2; + this.b = +b2; + this.opacity = +opacity2; + } + define2(Lab, lab$1, extend$1(Color$2, { + brighter(k) { + return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + darker(k) { + return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + rgb() { + var y2 = (this.l + 16) / 116, x2 = isNaN(this.a) ? y2 : y2 + this.a / 500, z2 = isNaN(this.b) ? y2 : y2 - this.b / 200; + x2 = Xn * lab2xyz(x2); + y2 = Yn * lab2xyz(y2); + z2 = Zn * lab2xyz(z2); + return new Rgb( + lrgb2rgb(3.1338561 * x2 - 1.6168667 * y2 - 0.4906146 * z2), + lrgb2rgb(-0.9787684 * x2 + 1.9161415 * y2 + 0.033454 * z2), + lrgb2rgb(0.0719453 * x2 - 0.2289914 * y2 + 1.4052427 * z2), + this.opacity + ); } - return !!value; -} -function valueToString(value) { - if (value == null) return ''; - switch(typeof value){ - case 'string': - return value; - case 'boolean': - case 'number': - return value.toString(); - } - return ''; -} -function isStringOperation(ex) { - switch(ex.operator){ - case 'contains': - case '!contains': - case 'starts': - case '!starts': - return true; + })); + function xyz2lab(t) { + return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$2; + } + function lab2xyz(t) { + return t > t1$1 ? t * t * t : t2 * (t - t0$2); + } + function lrgb2rgb(x2) { + return 255 * (x2 <= 31308e-7 ? 12.92 * x2 : 1.055 * Math.pow(x2, 1 / 2.4) - 0.055); + } + function rgb2lrgb(x2) { + return (x2 /= 255) <= 0.04045 ? x2 / 12.92 : Math.pow((x2 + 0.055) / 1.055, 2.4); + } + function hclConvert(o) { + if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); + if (!(o instanceof Lab)) o = labConvert(o); + if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); + var h2 = Math.atan2(o.b, o.a) * degrees$2; + return new Hcl(h2 < 0 ? h2 + 360 : h2, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); + } + function hcl$1(h2, c2, l, opacity2) { + return arguments.length === 1 ? hclConvert(h2) : new Hcl(h2, c2, l, opacity2 == null ? 1 : opacity2); + } + function Hcl(h2, c2, l, opacity2) { + this.h = +h2; + this.c = +c2; + this.l = +l; + this.opacity = +opacity2; + } + function hcl2lab(o) { + if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); + var h2 = o.h * radians$1; + return new Lab(o.l, Math.cos(h2) * o.c, Math.sin(h2) * o.c, o.opacity); + } + define2(Hcl, hcl$1, extend$1(Color$2, { + brighter(k) { + return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); + }, + darker(k) { + return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); + }, + rgb() { + return hcl2lab(this).rgb(); } - return false; -} -function isnullorEmpty(value) { - if (value == null) return true; //double equal sign to also catch undefined - if (typeof value === 'string' && value.length === 0) return true; - return false; -} -class Exec { - constructor(search, columns){ - this.columns = columns; - this.groups = (0, _group.ensureSearchExpressionGroupArray)(search).map((g)=>{ - const expressions = g.expressions.filter(Boolean); - expressions.forEach((ex)=>{ - ex.column = this.getColumn(ex.name); - ex.valueBool = valueToBoolean(ex.value); - ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); - ex.stringOperation = isStringOperation(ex); - }); - const group = Object.assign(Object.assign({}, g), { - expressions - }); - return group; - }); + })); + var A = -0.14861, B$1 = 1.78277, C$1 = -0.29227, D$1 = -0.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C$1 - D$1 * A; + function cubehelixConvert(o) { + if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, l = (BC_DA * b2 + ED * r - EB * g) / (BC_DA + ED - EB), bl2 = b2 - l, k = (E * (g - l) - C$1 * bl2) / D$1, s2 = Math.sqrt(k * k + bl2 * bl2) / (E * l * (1 - l)), h2 = s2 ? Math.atan2(k, bl2) * degrees$2 - 120 : NaN; + return new Cubehelix(h2 < 0 ? h2 + 360 : h2, s2, l, o.opacity); + } + function cubehelix$1(h2, s2, l, opacity2) { + return arguments.length === 1 ? cubehelixConvert(h2) : new Cubehelix(h2, s2, l, opacity2 == null ? 1 : opacity2); + } + function Cubehelix(h2, s2, l, opacity2) { + this.h = +h2; + this.s = +s2; + this.l = +l; + this.opacity = +opacity2; + } + define2(Cubehelix, cubehelix$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = isNaN(this.h) ? 0 : (this.h + 120) * radians$1, l = +this.l, a2 = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh2 = Math.cos(h2), sinh2 = Math.sin(h2); + return new Rgb( + 255 * (l + a2 * (A * cosh2 + B$1 * sinh2)), + 255 * (l + a2 * (C$1 * cosh2 + D$1 * sinh2)), + 255 * (l + a2 * (E * cosh2)), + this.opacity + ); } - getColumn(name) { - for(let i = 0; i < this.columns.length; i++){ - if (this.columns[i].name == name) return this.columns[i]; - } - } - runExpressionOnColumn(datum, ex) { - const actualDataValue = datum[ex.name]; - if (ex.operator === 'isnullorEmpty') return isnullorEmpty(actualDataValue); - else if (ex.operator === '!isnullorEmpty') return !isnullorEmpty(actualDataValue); - let dataValue = actualDataValue; - let expressionValue = ex.value; - if (ex.column) { - if (ex.column.type === 'string' || ex.stringOperation) { - dataValue = valueToString(actualDataValue).toLocaleLowerCase(); - expressionValue = ex.valueLow; - } else if (ex.column.type === 'boolean') { - dataValue = valueToBoolean(actualDataValue); - expressionValue = ex.valueBool; - } else if (ex.column.quantitative) { - dataValue = +actualDataValue; - expressionValue = +ex.value; - } - } - switch(ex.operator){ - case '!=': - return dataValue != expressionValue; - case '<': - return dataValue < expressionValue; - case '<=': - return dataValue <= expressionValue; - case '==': - return dataValue == expressionValue; - case '>': - return dataValue > expressionValue; - case '>=': - return dataValue >= expressionValue; - case 'contains': - return dataValue.indexOf(expressionValue) >= 0; - case '!contains': - return dataValue.indexOf(expressionValue) < 0; - case 'starts': - return dataValue.indexOf(expressionValue) == 0; - case '!starts': - return dataValue.indexOf(expressionValue) !== 0; - } - } - runExpression(datum, ex) { - if (ex.name == null) { - //run on all columns - const group = { - expressions: this.columns.map((column, i)=>{ - const ex2 = Object.assign(Object.assign({}, ex), { - column, - name: column.name - }); - if (i) ex2.clause = '||'; - return ex2; - }) - }; - return this.runGroup(datum, group); - } else return this.runExpressionOnColumn(datum, ex); - } - runGroup(datum, group) { - let accumulator = this.runExpression(datum, group.expressions[0]); - for(let i = 1; i < group.expressions.length; i++){ - const ex = group.expressions[i]; - switch(ex.clause){ - case '&&': - accumulator = accumulator && this.runExpression(datum, ex); - break; - case '||': - accumulator = accumulator || this.runExpression(datum, ex); - break; - } - } - return accumulator; + })); + function isColor(cssColorSpecifier) { + return !!color$2(cssColorSpecifier); + } + function checkIsColorData(data2, column) { + if (!column.stats.hasColorData) { + column.isColorData = false; + return; } - run(datum) { - let accumulator = this.runGroup(datum, this.groups[0]); - for(let i = 1; i < this.groups.length; i++){ - const group = this.groups[i]; - switch(group.clause){ - case '&&': - accumulator = accumulator && this.runGroup(datum, group); - break; - case '||': - accumulator = accumulator || this.runGroup(datum, group); - break; - } - } - return accumulator; - } -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"DMPkf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "invert", ()=>invert); -var _group = require("./group"); -function invertSearchExpressionGroup(input) { - //this only works if all expressions in this group have the same clause - const output = { - expressions: input.expressions.map(invertSearchExpression) - }; - if (input.clause) output.clause = invertedClauses[input.clause]; - return output; -} -const invertedOperators = { - '!=': '==', - '==': '!=', - '<': '>=', - '>=': '<', - '<=': '>', - '>': '<=', - '!contains': 'contains', - 'contains': '!contains', - '!isnullorEmpty': 'isnullorEmpty', - 'isnullorEmpty': '!isnullorEmpty', - '!starts': 'starts', - 'starts': '!starts' -}; -const invertedClauses = { - '&&': '||', - '||': '&&' -}; -function invertSearchExpression(input) { - const operator = invertedOperators[input.operator]; - const output = Object.assign(Object.assign({}, input), { - operator - }); - if (input.clause) output.clause = invertedClauses[input.clause]; - return output; -} -function invert(search) { - if (Array.isArray(search)) return search.map(invertSearchExpressionGroup); - else if ((0, _group.isSearchExpressionGroup)(search)) return invertSearchExpressionGroup(search); - else return invertSearchExpression(search); -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jhXKW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "narrow", ()=>narrow); -var _group = require("./group"); -function narrow(a, b) { - if (!a) return b; - const arrs = [ - a, - b - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [arrA, arrB] = arrs; - arrB[0].clause = '&&'; - return arrA.concat(arrB); -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eHpZP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bD3z1":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g08sL":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnsFromData", ()=>(0, _sanddanceSpecs.getColumnsFromData)); -parcelHelpers.export(exports, "getStats", ()=>(0, _sanddanceSpecs.getStats)); -parcelHelpers.export(exports, "inferAll", ()=>(0, _sanddanceSpecs.inferAll)); -parcelHelpers.export(exports, "getPresenterStyle", ()=>(0, _defaults.getPresenterStyle)); -parcelHelpers.export(exports, "isInternalFieldName", ()=>isInternalFieldName); -var _constants = require("./constants"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _defaults = require("./defaults"); -function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { - if (includeVegaMorphChartsFields) { - if (columnName === (0, _constants.GL_ORDINAL)) return true; + for (let i = 0; i < data2.length; i++) { + if (!isColor(data2[i][column.name])) { + column.isColorData = false; + return; + } } - for(const f in 0, _constants.FieldNames){ - if (columnName === (0, _constants.FieldNames)[f]) return true; + column.isColorData = true; + } + function isQuantitative(column) { + return column.type === "number" || column.type === "integer"; + } + function detectNegative(columnName, data2) { + for (let i = 1; i < data2.length; i++) { + const value2 = columnName == null ? data2[i] : data2[i][columnName]; + if (value2 < 0) + return true; } return false; -} - -},{"./constants":"ix2qh","@msrvida/sanddance-specs":"aOvSr","./defaults":"7bMd0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7bMd0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultViewerOptions", ()=>defaultViewerOptions); -parcelHelpers.export(exports, "getPresenterStyle", ()=>getPresenterStyle); -parcelHelpers.export(exports, "cssPrefix", ()=>cssPrefix); -parcelHelpers.export(exports, "dualColorSchemeColors", ()=>dualColorSchemeColors); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -const { defaultPresenterStyle } = _vegaMorphcharts.defaults; -const defaultViewerOptions = { - colors: { - activeCube: 'purple', - defaultCube: _vegaMorphcharts.util.colorToString(defaultPresenterStyle.defaultCubeColor), - hoveredCube: _vegaMorphcharts.util.colorToString(defaultPresenterStyle.highlightColor), - selectedCube: 'yellow', - axisSelectHighlight: _vegaMorphcharts.util.colorToString([ - 128, - 128, - 128, - 128 - ]), - axisLine: '#000', - axisText: '#000', - gridLine: '#CCC', - backgroundColor: '#FFF' - }, - language: { - headers: { - chart: 'Chart', - details: 'Details', - legend: 'Legend', - selection: 'Select & Filter' - }, - bing: 'bing', - newColorMap: 'remap color to filtered items', - oldColorMap: 'keep same colors', - deselect: 'deselect', - exclude: 'exclude', - isolate: 'isolate', - legendOther: 'other', - nextDetail: '>', - previousDetail: '<', - reset: 'reset', - colorBinCount: 'Color bin count', - colorReverse: 'Color reverse', - count: 'Count', - percent: 'Percent', - sum: 'Sum', - scatterPointScale: 'Point scale', - FacetMaxBins: 'Facet max bins', - FacetVMaxBins: 'Cross facet max bins', - XMaxBins: 'X axis max bins', - YMaxBins: 'Y axis max bins', - XGridSize: 'X grid size', - YGridSize: 'Y grid size', - InnerPaddingSize: 'Inner padding size', - OuterPaddingSize: 'Outer padding size', - treeMapMethod: 'Treemap layout', - facetColumns: 'Facet columns', - facetRows: 'Facet rows', - markOpacitySignal: 'Mark opacity', - textScaleSignal: 'Text scale', - xAxisTextAngleSignal: 'X axis text angle', - yAxisTextAngleSignal: 'Y axis text angle', - zGrounded: 'Z grounded', - zScaleProportion: 'Z scale proportion to Y', - selectionCount: (count)=>`${count} items selected` - }, - maxLegends: 19, - onError: (errors)=>{ - //console.log(`UnitVisViewer errors: ${errors.join('\n')}`); - }, - filterRenderingTimerPadding: 200, - selectionPolygonZ: -1, - tickSize: 10 -}; -function getPresenterStyle(options) { - const style = { - cssPrefix, - fontFamily: options.fontFamily, - defaultCubeColor: _vegaMorphcharts.util.colorFromString(options.colors.defaultCube) - }; - if (options.colors.hoveredCube) style.highlightColor = _vegaMorphcharts.util.colorFromString(options.colors.hoveredCube); - //if (options.lightSettings) { - // style.lightSettings = options.lightSettings; - //} - return style; -} -const cssPrefix = 'sanddance-'; -const dualColorSchemeColors = { - black: '#212121', - gray: '#D2D2D2', - blue: '#0060F0', - green: '#00C000', - orange: '#FF9900', - red: '#E00000' -}; - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Sd5M":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>(0, _base.base)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "Presenter", ()=>(0, _presenter.Presenter)); -parcelHelpers.export(exports, "ViewGl", ()=>(0, _viewGl.ViewGl)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "controls", ()=>_controls); -parcelHelpers.export(exports, "defaults", ()=>_defaults); -parcelHelpers.export(exports, "types", ()=>_types); -parcelHelpers.export(exports, "util", ()=>_util); -var _controls = require("./exports/controls"); -var _types = require("./exports/types"); -var _util = require("./exports/util"); -var _defaults = require("./defaults"); -var _base = require("./base"); -var _presenter = require("./presenter"); -var _viewGl = require("./vega-classes/viewGl"); -var _enums = require("./enums"); -parcelHelpers.exportAll(_enums, exports); -var _version = require("./version"); - -},{"./exports/controls":"7DYOW","./exports/types":"jWJzt","./exports/util":"iZ1f5","./defaults":"4Q1zd","./base":"hIePf","./presenter":"9yYY0","./vega-classes/viewGl":"3abZO","./enums":"hnVHt","./version":"eMVZG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7DYOW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize variables for documentation -parcelHelpers.export(exports, "Table", ()=>(0, _controls.Table)); -var _controls = require("../controls"); - -},{"../controls":"9lm1L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9lm1L":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -var _tsxCreateElement = require("tsx-create-element"); -const KeyCodes = { - ENTER: 'Enter' -}; -const Table = (props)=>{ - return (0, _tsxCreateElement.createElement)("table", { - className: props.className - }, props.children, props.rows.map((row, i)=>(0, _tsxCreateElement.createElement)("tr", { - className: props.rowClassName || '', - onClick: (e)=>props.onRowClick && props.onRowClick(e, i), - tabIndex: props.onRowClick ? 0 : -1, - onKeyUp: (e)=>{ - if (e.key === KeyCodes.ENTER && props.onRowClick) props.onRowClick(e, i); - } - }, row.cells.map((cell, i)=>(0, _tsxCreateElement.createElement)("td", { - className: cell.className || '', - title: cell.title || '' - }, cell.content))))); -}; - -},{"tsx-create-element":"dPDUq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dPDUq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createElement", ()=>createElement); -parcelHelpers.export(exports, "addChild", ()=>addChild); -parcelHelpers.export(exports, "mount", ()=>mount); -parcelHelpers.export(exports, "findElementByChildPositions", ()=>findElementByChildPositions); -parcelHelpers.export(exports, "focusActiveElement", ()=>focusActiveElement); -parcelHelpers.export(exports, "setActiveElement", ()=>setActiveElement); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>getActiveElementInfo); -var _htmlTags = require("html-tags"); -var _svgTags = require("svg-tags"); -const htmlTagArray = _htmlTags.default || _htmlTags; -const svgTagArray = _svgTags.default || _svgTags; -/** - * Decamelizes a string with/without a custom separator (hyphen by default). - * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript - * - * @param str String in camelcase - * @param separator Separator for the new decamelized string. - */ function decamelize(str, separator = '-') { - return str.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2').replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2').toLowerCase(); -} -function createElement(tag, attrs, ...children) { - if (typeof tag === 'function') { - const fn = tag; - const props = attrs; - props.children = children; - return fn(props); + } + function detectSequentialColumn(columnName, data2) { + if (data2.length < 2) + return false; + for (let i = 1; i < data2.length; i++) { + const curr = columnName == null ? data2[i] : data2[i][columnName]; + const prev = columnName == null ? data2[i - 1] : data2[i - 1][columnName]; + if (curr !== prev + 1) + return false; + } + return true; + } + function getStats(data2, ...args) { + let columnName; + let columnType; + let columnQuantitative; + let distinctValuesCallback; + if (args.length <= 2) { + const column = args[0]; + columnName = column.name; + columnType = column.type; + columnQuantitative = column.quantitative; + distinctValuesCallback = args[1]; } else { - const ns = tagNamespace(tag); - const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); - const map = attrs; - let ref; - for(let name in map)if (name && map.hasOwnProperty(name)) { - let value = map[name]; - if (name === 'className' && value !== void 0) setAttribute(el, ns, 'class', value.toString()); - else if (name === 'disabled' && !value) ; - else if (value === null || value === undefined) continue; - else if (value === true) setAttribute(el, ns, name, name); - else if (typeof value === 'function') { - if (name === 'ref') ref = value; - else el[name.toLowerCase()] = value; - } else if (typeof value === 'object') setAttribute(el, ns, name, flatten(value)); - else setAttribute(el, ns, name, value.toString()); - } - if (children && children.length > 0) appendChildren(el, children); - if (ref) ref(el); - return el; + columnName = args[0]; + columnType = args[1]; + columnQuantitative = args[2]; + distinctValuesCallback = args[3]; } -} -function setAttribute(el, ns, name, value) { - if (ns) el.setAttributeNS(null, name, value); - else el.setAttribute(name, value); -} -function flatten(o) { - const arr = []; - for(let prop in o)arr.push(`${decamelize(prop, '-')}:${o[prop]}`); - return arr.join(';'); -} -function addChild(parentElement, child) { - if (child === null || child === undefined || typeof child === "boolean") return; - else if (Array.isArray(child)) appendChildren(parentElement, child); - else if (isElement(child)) parentElement.appendChild(child); - else parentElement.appendChild(document.createTextNode(child.toString())); -} -function appendChildren(parentElement, children) { - children.forEach((child)=>addChild(parentElement, child)); -} -function isElement(el) { - //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType - return !!el.nodeType; -} -function mount(element, container) { - container.innerHTML = ''; - if (element) addChild(container, element); -} -function findElementByChildPositions(childPositions, container) { - let element = container || document.body; - let childPosition; - while(element && childPositions.length){ - childPosition = childPositions.shift(); - element = element.children.item(childPosition); - } - if (element) return element; -} -function focusActiveElement(element, activeElementInfo) { - element.focus(); - element.scrollTop = activeElementInfo.scrollTop; - const input = element; - if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); -} -function setActiveElement(activeElementInfo, container) { - if (activeElementInfo) { - const element = findElementByChildPositions(activeElementInfo.childPositions, container); - if (element) focusActiveElement(element, activeElementInfo); + const distinctMap = {}; + const stats = { + nonNull: 0, + distinctValueCount: null, + max: null, + mean: null, + min: null + }; + const columnIsString = columnType === "string"; + let sum2 = 0; + for (let i = 0; i < data2.length; i++) { + const row = data2[i]; + const value2 = columnName == null ? row : row[columnName]; + if (columnIsString) { + if (value2 !== "") { + stats.nonNull++; + } + } else if (value2 != null) { + stats.nonNull++; + } + const num = +value2; + distinctMap[value2] = true; + if (!isNaN(num)) { + if (stats.max === null || num > stats.max) { + stats.max = num; + } + if (stats.min === null || num < stats.min) { + stats.min = num; + } + sum2 += num; + } + if ((columnType === "date" || columnIsString) && !stats.hasColorData && isColor(value2)) { + stats.hasColorData = true; + } } -} -function getActiveElementInfo(container) { - let element = document.activeElement; - const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element; - const activeElementInfo = { - childPositions: [], - scrollTop, - selectionDirection, - selectionEnd, - selectionStart - }; - while(element && element !== document.body && element !== container){ - activeElementInfo.childPositions.unshift(getChildPosition(element)); - element = element.parentElement; - } - if ((element === document.body || element === container) && activeElementInfo.childPositions.length) return activeElementInfo; -} -function getChildPosition(element) { - let childPosition = 0; - while(element = element.previousElementSibling)childPosition++; - return childPosition; -} -function tagNamespace(tag) { - //issue: this won't disambiguate certain tags which exist in both svg and html: , ... - if (tag === 'svg' || svgTagArray.indexOf(tag) >= 0 && !(htmlTagArray.indexOf(tag) >= 0)) return "http://www.w3.org/2000/svg"; -} - -},{"html-tags":"d5cAX","svg-tags":"kuFQD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d5cAX":[function(require,module,exports,__globalThis) { -'use strict'; -module.exports = require("6c9bf1ded7f8a5a1"); - -},{"6c9bf1ded7f8a5a1":"6OgGY"}],"6OgGY":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"abbr\",\"address\",\"area\",\"article\",\"aside\",\"audio\",\"b\",\"base\",\"bdi\",\"bdo\",\"blockquote\",\"body\",\"br\",\"button\",\"canvas\",\"caption\",\"cite\",\"code\",\"col\",\"colgroup\",\"data\",\"datalist\",\"dd\",\"del\",\"details\",\"dfn\",\"dialog\",\"div\",\"dl\",\"dt\",\"em\",\"embed\",\"fieldset\",\"figcaption\",\"figure\",\"footer\",\"form\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"header\",\"hgroup\",\"hr\",\"html\",\"i\",\"iframe\",\"img\",\"input\",\"ins\",\"kbd\",\"keygen\",\"label\",\"legend\",\"li\",\"link\",\"main\",\"map\",\"mark\",\"math\",\"menu\",\"menuitem\",\"meta\",\"meter\",\"nav\",\"noscript\",\"object\",\"ol\",\"optgroup\",\"option\",\"output\",\"p\",\"param\",\"picture\",\"pre\",\"progress\",\"q\",\"rb\",\"rp\",\"rt\",\"rtc\",\"ruby\",\"s\",\"samp\",\"script\",\"section\",\"select\",\"slot\",\"small\",\"source\",\"span\",\"strong\",\"style\",\"sub\",\"summary\",\"sup\",\"svg\",\"table\",\"tbody\",\"td\",\"template\",\"textarea\",\"tfoot\",\"th\",\"thead\",\"time\",\"title\",\"tr\",\"track\",\"u\",\"ul\",\"var\",\"video\",\"wbr\"]"); - -},{}],"kuFQD":[function(require,module,exports,__globalThis) { -module.exports = require("8c03a2b8d2417863"); - -},{"8c03a2b8d2417863":"d3wrv"}],"d3wrv":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"altGlyph\",\"altGlyphDef\",\"altGlyphItem\",\"animate\",\"animateColor\",\"animateMotion\",\"animateTransform\",\"circle\",\"clipPath\",\"color-profile\",\"cursor\",\"defs\",\"desc\",\"ellipse\",\"feBlend\",\"feColorMatrix\",\"feComponentTransfer\",\"feComposite\",\"feConvolveMatrix\",\"feDiffuseLighting\",\"feDisplacementMap\",\"feDistantLight\",\"feFlood\",\"feFuncA\",\"feFuncB\",\"feFuncG\",\"feFuncR\",\"feGaussianBlur\",\"feImage\",\"feMerge\",\"feMergeNode\",\"feMorphology\",\"feOffset\",\"fePointLight\",\"feSpecularLighting\",\"feSpotLight\",\"feTile\",\"feTurbulence\",\"filter\",\"font\",\"font-face\",\"font-face-format\",\"font-face-name\",\"font-face-src\",\"font-face-uri\",\"foreignObject\",\"g\",\"glyph\",\"glyphRef\",\"hkern\",\"image\",\"line\",\"linearGradient\",\"marker\",\"mask\",\"metadata\",\"missing-glyph\",\"mpath\",\"path\",\"pattern\",\"polygon\",\"polyline\",\"radialGradient\",\"rect\",\"script\",\"set\",\"stop\",\"style\",\"svg\",\"switch\",\"symbol\",\"text\",\"textPath\",\"title\",\"tref\",\"tspan\",\"use\",\"view\",\"vkern\"]"); - -},{}],"jWJzt":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize interfaces for documentation -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _interfaces.MorphChartsCore)); -var _interfaces = require("../interfaces"); - -},{"../interfaces":"5p3aO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5p3aO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _morphcharts.Core)); -var _morphcharts = require("morphcharts"); - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9s7CR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Core", ()=>(0, _mainJs.Core)); -parcelHelpers.export(exports, "ModelView", ()=>(0, _mainJs.ModelView)); -parcelHelpers.export(exports, "SingleTouchAction", ()=>(0, _mainJs.SingleTouchAction)); -parcelHelpers.export(exports, "UnitType", ()=>(0, _mainJs.UnitType)); -parcelHelpers.export(exports, "Theme", ()=>(0, _mainJs.Theme)); -parcelHelpers.export(exports, "PickType", ()=>(0, _mainJs.PickType)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _mainJs.SelectionMode)); -parcelHelpers.export(exports, "HighlightMode", ()=>(0, _mainJs.HighlightMode)); -parcelHelpers.export(exports, "FilterMode", ()=>(0, _mainJs.FilterMode)); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>(0, _mainJs.AxesTextOrientation)); -parcelHelpers.export(exports, "Orientation", ()=>(0, _mainJs.Orientation)); -parcelHelpers.export(exports, "StereoMode", ()=>(0, _mainJs.StereoMode)); -parcelHelpers.export(exports, "RenderMode", ()=>(0, _mainJs.RenderMode)); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>(0, _mainJs.HorizontalAlignment)); -parcelHelpers.export(exports, "VerticalAlignment", ()=>(0, _mainJs.VerticalAlignment)); -parcelHelpers.export(exports, "LogLevel", ()=>(0, _mainJs.LogLevel)); -parcelHelpers.export(exports, "AxesVisibility", ()=>(0, _mainJs.AxesVisibility)); -parcelHelpers.export(exports, "Edge2D", ()=>(0, _mainJs.Edge2D)); -parcelHelpers.export(exports, "Edge3D", ()=>(0, _mainJs.Edge3D)); -parcelHelpers.export(exports, "Face2D", ()=>(0, _mainJs.Face2D)); -parcelHelpers.export(exports, "Face3D", ()=>(0, _mainJs.Face3D)); -parcelHelpers.export(exports, "PaletteName", ()=>(0, _paletteJs.PaletteName)); -parcelHelpers.export(exports, "PaletteResources", ()=>(0, _paletteJs.PaletteResources)); -parcelHelpers.export(exports, "PaletteType", ()=>(0, _paletteJs.PaletteType)); -parcelHelpers.export(exports, "Config", ()=>(0, _configJs.Config)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -parcelHelpers.export(exports, "Colors", ()=>(0, _colorsJs.Colors)); -parcelHelpers.export(exports, "Font", ()=>(0, _fontJs.Font)); -parcelHelpers.export(exports, "FontRasterizer", ()=>(0, _fontJs.FontRasterizer)); -parcelHelpers.export(exports, "FontAtlas", ()=>(0, _fontJs.FontAtlas)); -parcelHelpers.export(exports, "Map", ()=>(0, _mapJs.Map)); -parcelHelpers.export(exports, "MapRasterizer", ()=>(0, _mapJs.MapRasterizer)); -parcelHelpers.export(exports, "MapAtlas", ()=>(0, _mapJs.MapAtlas)); -parcelHelpers.export(exports, "Icons", ()=>(0, _iconsJs.Icons)); -parcelHelpers.export(exports, "IconsRasterizer", ()=>(0, _iconsJs.IconsRasterizer)); -parcelHelpers.export(exports, "IconsAtlas", ()=>(0, _iconsJs.IconsAtlas)); -parcelHelpers.export(exports, "Components", ()=>_indexJs); -parcelHelpers.export(exports, "Axes", ()=>_indexJs1); -parcelHelpers.export(exports, "Helpers", ()=>_indexJs2); -parcelHelpers.export(exports, "Layouts", ()=>_indexJs3); -parcelHelpers.export(exports, "Input", ()=>_indexJs4); -parcelHelpers.export(exports, "Providers", ()=>_indexJs5); -parcelHelpers.export(exports, "Meshes", ()=>_indexJs6); -parcelHelpers.export(exports, "Renderers", ()=>_indexJs7); -parcelHelpers.export(exports, "Tables", ()=>_indexJs8); -parcelHelpers.export(exports, "Cameras", ()=>_indexJs9); -var _mainJs = require("./main.js"); -var _paletteJs = require("./palette.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _colorsJs = require("./colors.js"); -var _fontJs = require("./font.js"); -var _mapJs = require("./map.js"); -var _iconsJs = require("./icons.js"); -var _indexJs = require("./components/index.js"); -var _indexJs1 = require("./components/axes/index.js"); -var _indexJs2 = require("./helpers/index.js"); -var _indexJs3 = require("./layouts/index.js"); -var _indexJs4 = require("./input/index.js"); -var _indexJs5 = require("./providers/index.js"); -var _indexJs6 = require("./meshes/index.js"); -var _indexJs7 = require("./renderers/index.js"); -var _indexJs8 = require("./tables/index.js"); -var _indexJs9 = require("./cameras/index.js"); - -},{"./main.js":"f421K","./palette.js":"hZb65","./config.js":"bCTP3","./constants.js":"lD0bG","./colors.js":"cYEeU","./font.js":"ibkbS","./map.js":"5JhCv","./icons.js":"lPq9g","./components/index.js":"5C4Hk","./components/axes/index.js":"eiGCN","./helpers/index.js":"9v1at","./layouts/index.js":"duBHP","./input/index.js":"flmwt","./providers/index.js":"hACG3","./meshes/index.js":"6XXZT","./renderers/index.js":"1IHvF","./tables/index.js":"dUaaI","./cameras/index.js":"h7YGk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f421K":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ModelView", ()=>ModelView); -parcelHelpers.export(exports, "Core", ()=>Core); -parcelHelpers.export(exports, "CameraMode", ()=>CameraMode); -parcelHelpers.export(exports, "StereoMode", ()=>StereoMode); -parcelHelpers.export(exports, "SelectionMode", ()=>SelectionMode); -parcelHelpers.export(exports, "FilterMode", ()=>FilterMode); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>HorizontalAlignment); -parcelHelpers.export(exports, "VerticalAlignment", ()=>VerticalAlignment); -parcelHelpers.export(exports, "TextAlignment", ()=>TextAlignment); -parcelHelpers.export(exports, "Orientation", ()=>Orientation); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>AxesTextOrientation); -parcelHelpers.export(exports, "AxesVisibility", ()=>AxesVisibility); -parcelHelpers.export(exports, "PickType", ()=>PickType); -parcelHelpers.export(exports, "Theme", ()=>Theme); -parcelHelpers.export(exports, "HighlightMode", ()=>HighlightMode); -parcelHelpers.export(exports, "UnitType", ()=>UnitType); -parcelHelpers.export(exports, "SingleTouchAction", ()=>SingleTouchAction); -parcelHelpers.export(exports, "MouseWheelAction", ()=>MouseWheelAction); -parcelHelpers.export(exports, "LogLevel", ()=>LogLevel); -parcelHelpers.export(exports, "Edge2D", ()=>Edge2D); -parcelHelpers.export(exports, "Face2D", ()=>Face2D); -parcelHelpers.export(exports, "Edge3D", ()=>Edge3D); -parcelHelpers.export(exports, "Face3D", ()=>Face3D); -parcelHelpers.export(exports, "HexOrientation", ()=>HexOrientation); -parcelHelpers.export(exports, "RenderMode", ()=>RenderMode); -var _glMatrix = require("gl-matrix"); -var _altazimuthJs = require("./cameras/altazimuth.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _debugJs = require("./debug.js"); -var _fpsJs = require("./fps.js"); -var _angleJs = require("./helpers/angle.js"); -var _paletteJs = require("./palette.js"); -var _controllerJs = require("./components/controller.js"); -var _matrixJs = require("./helpers/matrix.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _fontJs = require("./font.js"); -var _vertexJs = require("./vertex.js"); -var _managerJs = require("./input/manager.js"); -var _logJs = require("./log.js"); -var _mathJs = require("./helpers/math.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + if (columnQuantitative) { + stats.mean = data2.length > 0 && sum2 / data2.length; + stats.hasNegative = detectNegative(columnName, data2); + if (columnType === "integer") { + stats.isSequential = detectSequentialColumn(columnName, data2); + } } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } + const distinctValues = Object.keys(distinctMap); + if (distinctValuesCallback) { + distinctValues.sort(); + distinctValuesCallback(distinctValues); + } + stats.distinctValueCount = distinctValues.length; + return stats; + } + function getColumnsFromData(inferTypesFn, data2, columnTypes) { + const sample = data2[0]; + const fields = sample ? Object.keys(sample) : []; + const inferences = Object.assign(Object.assign({}, inferTypesFn(data2, fields)), columnTypes); + const columns = fields.map((name) => { + const column = { + name, + type: inferences[name] + }; + return column; + }); + inferAll(columns, data2); + return columns; + } + function inferAll(columns, data2) { + columns.forEach((column) => { + if (column) { + if (typeof column.quantitative !== "boolean") { + column.quantitative = isQuantitative(column); } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + if (!column.stats) { + column.stats = getStats(data2, column); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + if ((column.type === "date" || column.type === "string") && typeof column.isColorData !== "boolean") { + checkIsColorData(data2, column); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } }); -}; -class ModelView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - this.manipulationOrigin = (0, _glMatrix.vec3).create(); - this.rotation = (0, _glMatrix.quat).create(); - (0, _glMatrix.vec3).set(this.position, 0, 0, -core.config.modelDistance); - this.scale = core.config.modelSize; - } -} -class Core { - get container() { - return this._container; - } - get started() { - return this._started; - } - get debugText() { - return this._debugText; - } - get log() { - return this._log; - } - get totalFrames() { - return this._fps.totalFrames; - } - get camera() { - return this._camera; - } - set camera(value) { - this._camera = value; - } - getModelRotation(value) { - (0, _glMatrix.quat).copy(value, this._modelRotation); - } - setModelRotation(value, isSmooth) { - (0, _glMatrix.quat).copy(this._modelRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - getModelScale() { - return this._modelScale[0]; - } - setModelScale(value, isSmooth) { - (0, _glMatrix.vec3).set(this._modelScale, value, value, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); - } - getModelManipulationOrigin(value) { - (0, _glMatrix.vec3).copy(value, this._modelManipulationOrigin); + } + let Table$2 = class Table { + constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = "right") { + this.columns = columns; + this.rows = rows; + this.maxWidth = maxWidth; + this.underlineHeaders = underlineHeaders; + this.align = align; + this.columnWidths = this.columns.map((col, idx) => Math.max(col.length, ...this.rows.map((row) => { + var _a2; + return ((_a2 = row[idx]) === null || _a2 === void 0 ? void 0 : _a2.length) || 0; + }))); } - setModelManipulationOrigin(value) { - this._updateManipulationOrigin(value); + createSpaces(num) { + return " ".repeat(num); } - getModelPosition(value) { - (0, _glMatrix.vec3).copy(value, this._modelPosition); + groupColumns() { + let cumulativeWidth = 0; + const columnGroups = []; + let currentGroup = []; + this.columns.forEach((col, idx) => { + const columnSpace = this.columnWidths[idx] + 1; + if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { + columnGroups.push(currentGroup); + cumulativeWidth = columnSpace; + currentGroup = [col]; + } else { + cumulativeWidth += columnSpace; + currentGroup.push(col); + } + }); + if (currentGroup.length > 0) { + columnGroups.push(currentGroup); + } + return columnGroups; } - setModelPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._modelPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); + formatRow(row, group2) { + return group2.map((col) => { + const idx = this.columns.indexOf(col); + const cellValue = row[idx] == null ? "" : row[idx].toString(); + return this.align === "right" ? cellValue.padStart(this.columnWidths[idx], " ") : cellValue.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); } - get webXRSession() { - return this._webXRSession; + formatHeader(group2) { + return group2.map((col) => { + const idx = this.columns.indexOf(col); + return this.align === "right" ? col.padStart(this.columnWidths[idx], " ") : col.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); } - get renderer() { - return this._renderer; + underlineHeader(group2) { + return group2.map((col) => "-".repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); } - set renderer(renderer) { - if (this._renderer == renderer) return; - if (this._renderer) { - this.stop(); - this._renderer.remove(); - } - if (!renderer.isInitialized) renderer.initialize(this); - if (this._renderer) { - renderer.transitionTime = this._renderer.transitionTime; - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const previousTransitionBuffer = this._renderer.transitionBuffers[i]; - const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); - transitionBuffer.copyFrom(previousTransitionBuffer); - renderer.transitionBuffers.push(transitionBuffer); - } - const currentAxes = this._renderer.currentAxes; - if (currentAxes) { - renderer.currentAxes = []; - for(let i = 0; i < currentAxes.length; i++){ - const axesVisual = currentAxes[i]; - const axes = axesVisual.axes; - if (axes instanceof (0, _cartesian3DJs.Cartesian3dAxes)) { - const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); - renderer.currentAxes.push(cartesian3dAxesVisual); - } else if (axes instanceof (0, _cartesian2DJs.Cartesian2dAxes)) renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); - } - } - const labelSets = this._renderer.labelSets; - if (labelSets) { - renderer.labelSets = []; - for(let i = 0; i < labelSets.length; i++)renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); - } - const images = this._renderer.images; - if (images) { - renderer.images = []; - for(let i = 0; i < images.length; i++)renderer.images.push(renderer.createImageVisual(images[i].image)); - } - const fonts = this._renderer.fonts; - if (fonts) for(const key in fonts){ - const font = fonts[key].font; - renderer.fonts[font.name] = renderer.createFontVisual(font); - } - } else renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); - if (this._renderer) this._renderer.finalize(); - this._renderer = renderer; - this._fps.reset(); - this.start(); + render() { + const output2 = []; + const columnGroups = this.groupColumns(); + columnGroups.forEach((group2, groupIndex) => { + const headerRow = this.formatHeader(group2); + let section = headerRow + (groupIndex < columnGroups.length - 1 ? " \\" : "") + "\n"; + if (this.underlineHeaders) { + section += this.underlineHeader(group2) + "\n"; + } + this.rows.forEach((row) => { + section += this.formatRow(row, group2) + "\n"; + }); + output2.push(section); + if (groupIndex < columnGroups.length - 1) { + output2.push("\n"); + } + }); + return output2.join(""); } - get font() { - return this._font; + }; + var pandasSimulation; + (function(pandasSimulation2) { + const typeMapping = { + boolean: "bool", + number: "float64", + // Assuming 'number' is used for floating-point numbers + date: "datetime64[ns]", + string: "object", + integer: "int64" + }; + function head(columns, data2, maxWidth = 80) { + const numRows = 5; + const top = data2.slice(0, numRows); + const rowNumbers = Array.from({ length: numRows }, (_, i) => (i + 1).toString()); + const columnNames = [""].concat(columns.map((col) => col.name)); + const rows = top.map((row, i) => [rowNumbers[i]].concat(columns.map((col) => { + var _a2; + return ((_a2 = row[col.name]) === null || _a2 === void 0 ? void 0 : _a2.toString()) || ""; + }))); + const table = new Table$2(columnNames, rows, maxWidth, false, "right"); + return table.render(); + } + pandasSimulation2.head = head; + function info2(columns, data2, maxWidth = 80) { + const numRows = data2.length; + const output2 = []; + output2.push("<class 'pandas.core.frame.DataFrame'>"); + output2.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); + output2.push(`Data columns (total ${columns.length} columns): +`); + const columnHeaders = ["#", "Column", "Non-Null Count", "Dtype"]; + const rows = columns.map((col, idx) => { + const nonNullCount = col.stats.nonNull.toString(); + const dtype = typeMapping[col.type] || "unknown"; + return [idx.toString(), col.name, `${nonNullCount} non-null`, dtype]; + }); + const table = new Table$2(columnHeaders, rows, maxWidth, true, "left"); + output2.push(table.render()); + const memoryUsage = columns.reduce((total, col) => { + var _a2; + const exampleValue = (_a2 = data2.find((row) => row[col.name] != null)) === null || _a2 === void 0 ? void 0 : _a2[col.name]; + if (exampleValue == null) + return total; + const size = new Blob([exampleValue.toString()]).size; + return total + size * numRows; + }, 0); + output2.push(` +dtypes: ${columns.filter((col) => col.type === "number").length} float64, ${columns.filter((col) => col.type === "integer").length} int64, ${columns.filter((col) => col.type === "string").length} object`); + output2.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); + return output2.join("\n"); + } + pandasSimulation2.info = info2; + })(pandasSimulation || (pandasSimulation = {})); + function getSpecColumns(insight, columns) { + function getColumnByName(name) { + return columns.filter((c2) => c2.name === name)[0]; } - get paletteResources() { - return this._paletteResources; + return { + color: getColumnByName(insight.columns && insight.columns.color), + facet: getColumnByName(insight.columns && insight.columns.facet), + facetV: getColumnByName(insight.columns && insight.columns.facetV), + group: getColumnByName(insight.columns && insight.columns.group), + size: getColumnByName(insight.columns && insight.columns.size), + sort: getColumnByName(insight.columns && insight.columns.sort), + uid: getColumnByName(insight.columns && insight.columns.uid), + x: getColumnByName(insight.columns && insight.columns.x), + y: getColumnByName(insight.columns && insight.columns.y), + z: getColumnByName(insight.columns && insight.columns.z) + }; + } + function addAxes(scope, ...axes) { + if (!axes || !axes.length) + return; + if (!scope.axes) + scope.axes = []; + scope.axes.push(...axes.filter(Boolean)); + } + function addData(scope, ...datas) { + if (!datas || !datas.length) + return; + if (!scope.data) + scope.data = []; + scope.data.push(...datas.filter(Boolean)); + } + function addMarks(scope, ...marks) { + if (!marks || !marks.length) + return; + if (!scope.marks) + scope.marks = []; + scope.marks.push(...marks.filter(Boolean)); + } + function addScales(scope, ...scales2) { + if (!scales2 || !scales2.length) + return; + if (!scope.scales) + scope.scales = []; + scope.scales.push(...scales2.filter(Boolean)); + } + function addSignals(scope, ...signals) { + if (!signals || !signals.length) + return; + if (!scope.signals) + scope.signals = []; + scope.signals.push(...signals.filter(Boolean)); + } + function addTransforms(data2, ...transforms2) { + if (!transforms2 || !transforms2.length) + return; + if (!data2.transform) + data2.transform = []; + data2.transform.push(...transforms2.filter(Boolean)); + } + function getDataByName(data2, dataName) { + for (let i = 0; i < data2.length; i++) { + if (data2[i].name === dataName) + return { data: data2[i], index: i }; } - get config() { - return this._config; + } + function getGroupBy(groupings) { + const groupby = groupings.map((g) => g.groupby); + return groupby.reduce((acc, val) => acc.concat(val), []); + } + function addOffsets(...offsets2) { + return offsets2.filter(Boolean).join(" + "); + } + function addGlobalAxes(props) { + const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; + const { scope } = globalScope; + allGlobalScales.forEach((globalScales) => { + const { scales: scales2 } = globalScales; + for (const xyz in scales2) { + const _scales = scales2[xyz]; + if (_scales) { + addScales(scope, ..._scales); + let { showAxes } = globalScales; + let zindex = void 0; + if (xyz === "z") { + showAxes = false; + if (props.view === "3d" && specViewOptions.zAxisOptions && !props.hideZAxis) { + if (specViewOptions.zAxisOptions.showZAxis) { + showAxes = true; + zindex = specViewOptions.zAxisOptions.zIndex; + } + } + } + if (showAxes && axisScales) { + const axisScale = axisScales[xyz]; + if (axisScale) { + const lineColor = specViewOptions.colors.axisLine; + const horizontal = xyz === "x"; + const column = specColumns[xyz] || { quantitative: true }; + const title = axisScale.title; + const props2 = { + title, + horizontal, + column, + specViewOptions, + lineColor, + titlePadding: axesTitlePadding[xyz], + labelBaseline: labelBaseline[xyz], + zindex + }; + axesScopes["main"].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); + if (axesScopes[xyz]) { + axesScopes[xyz].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); + } + if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { + const plotOffsetSignal = plotOffsetSignals[xyz]; + plotOffsetSignal.update = `${axesOffsets[xyz]}`; + } + } + } + } + } + }); + } + function createAxis(props) { + const { column, horizontal, labelBaseline, lineColor, scale: scale2, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; + const axis = Object.assign(Object.assign(Object.assign(Object.assign({ zindex, scale: scale2.name, orient: horizontal ? "bottom" : "left", domain: showLines, ticks: showLines }, showLines && { + domainColor: lineColor, + tickColor: lineColor, + tickSize: specViewOptions.tickSize + }), showTitle && { + title, + titleAlign: horizontal ? "left" : "right", + titleAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY + }, + titleColor: specViewOptions.colors.axisText, + titleFontSize: { + signal: SignalNames.TextTitleSize + }, + titleLimit: axesTitleLimit, + titlePadding + }), { labels: showLabels }), showLabels && { + labelAlign: horizontal ? "left" : "right", + labelBaseline, + labelAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY + }, + labelColor: specViewOptions.colors.axisText, + labelFontSize: { + signal: SignalNames.TextSize + }, + labelLimit: axesLabelLimit + }); + if (column.quantitative) { + axis.format = "~r"; } - get inputManager() { - return this._inputManager; - } - constructor(options){ - (0, _glMatrix.glMatrix).setMatrixArrayType(Array); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat4 = (0, _glMatrix.mat4).create(); - this._container = options && options.container ? options.container : document.body; - this._config = new (0, _configJs.Config)(this); - this._log = new (0, _logJs.Log)(this); - this._debugText = new (0, _debugJs.DebugText)(); - this._inputManager = options && options.useInputManager === false ? null : new (0, _managerJs.Manager)(this); - const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { - fontAtlas: new (0, _fontJs.FontAtlas)(256, 512), - fontSize: 24, - border: 3, - fontFamily: "\"segoe ui semibold\", sans-serif", - fontWeight: "normal", - fontStyle: "normal", - baseline: "alphabetic", - maxDistance: 8, - edgeValue: 0xc0 - }; - const fontRasterizer = new (0, _fontJs.FontRasterizer)(this, fontRasterizerOptions); - this._font = fontRasterizer.font; - this._paletteResources = new (0, _paletteJs.PaletteResources)(); - this._previousTime = 0; - this._fps = new (0, _fpsJs.Fps)(this); - this._modelMMatrix = (0, _glMatrix.mat4).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelRotation = (0, _glMatrix.quat).create(); - this._modelScale = (0, _glMatrix.vec3).create(); - this._smoothedModelPosition = (0, _glMatrix.vec3).create(); - this._smoothedModelRotation = (0, _glMatrix.quat).create(); - this._smoothedModelScale = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._camera = new (0, _altazimuthJs.AltAzimuthCamera)(this); - this.resetModel(false); + return axis; + } + function safeFieldName(field2) { + return field2.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"').replace(/\./g, "\\.").replace(/\[/g, "\\[").replace(/\]/g, "\\]"); + } + function exprSafeFieldName(field2) { + return field2.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ""); + } + function linearScale(scaleName, domain2, range2, reverse2, zero2, nice2 = true) { + const scale2 = { + name: scaleName, + type: "linear", + range: range2, + round: true, + reverse: reverse2, + domain: domain2, + zero: zero2, + nice: nice2 + }; + return scale2; + } + function pointScale(scaleName, data2, range2, field2, reverse2) { + const scale2 = { + name: scaleName, + type: "point", + range: range2, + domain: { + data: data2, + field: safeFieldName(field2), + sort: true + }, + padding: 0.5 + }; + if (reverse2 !== void 0) { + scale2.reverse = reverse2; } - getView(view) { - this.getModelPosition(view.position); - this.getModelRotation(view.rotation); - view.scale = this.getModelScale(); + return scale2; + } + function binnableColorScale(scaleName, colorBin, data2, field2, scheme2) { + scheme2 = scheme2 || ColorScaleNone; + const domain2 = { + data: data2, + field: safeFieldName(field2) + }; + const range2 = { + scheme: scheme2 + }; + const reverse2 = { signal: SignalNames.ColorReverse }; + if (colorBin !== "continuous") { + range2.count = { signal: SignalNames.ColorBinCount }; + } + switch (colorBin) { + case "continuous": { + const sequentialScale = { + name: scaleName, + type: "linear", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return sequentialScale; + } + case "quantile": { + const quantileScale = { + name: scaleName, + type: "quantile", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return quantileScale; + } + default: { + const quantizeScale = { + name: scaleName, + type: "quantize", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return quantizeScale; + } } - setView(view, isSmooth) { - this.setModelPosition(view.position, isSmooth); - this.setModelRotation(view.rotation, isSmooth); - this.setModelScale(view.scale, isSmooth); + } + const defaultZProportion = 0.6; + function textSignals(context2, heightSignal) { + const { specViewOptions } = context2; + const signals = [ + { + name: SignalNames.ZProportion, + value: defaultZProportion, + bind: { + name: specViewOptions.language.zScaleProportion, + debounce: debounce$1, + input: "range", + min: 0.1, + max: 2, + step: 0.1 + } + }, + { + name: SignalNames.ZHeight, + update: `${heightSignal} * ${SignalNames.ZProportion}` + }, + { + name: SignalNames.TextScale, + value: 1.2, + bind: { + name: specViewOptions.language.textScaleSignal, + debounce: debounce$1, + input: "range", + min: 0.5, + max: 2, + step: 0.1 + } + }, + { + name: SignalNames.TextSize, + update: `${SignalNames.TextScale} * 10` + }, + { + name: SignalNames.TextTitleSize, + update: `${SignalNames.TextScale} * 15` + }, + { + name: SignalNames.TextAngleX, + value: 30, + bind: { + name: specViewOptions.language.xAxisTextAngleSignal, + debounce: debounce$1, + input: "range", + min: 0, + max: 90, + step: 1 + } + }, + { + name: SignalNames.TextAngleY, + value: 0, + bind: { + name: specViewOptions.language.yAxisTextAngleSignal, + debounce: debounce$1, + input: "range", + min: -90, + max: 0, + step: 1 + } + }, + { + name: SignalNames.MarkOpacity, + value: 1, + bind: { + name: specViewOptions.language.markOpacitySignal, + debounce: debounce$1, + input: "range", + min: 0.1, + max: 1, + step: 0.05 + } + } + ]; + return signals; + } + function colorBinCountSignal(context2) { + const { specViewOptions } = context2; + const signal = { + name: SignalNames.ColorBinCount, + value: 7, + bind: { + name: specViewOptions.language.colorBinCount, + debounce: debounce$1, + input: "range", + min: 1, + max: specViewOptions.maxLegends + 1, + step: 1 + } + }; + return signal; + } + function colorReverseSignal(context2) { + const { specViewOptions } = context2; + const signal = { + name: SignalNames.ColorReverse, + value: false, + bind: { + name: specViewOptions.language.colorReverse, + input: "checkbox" + } + }; + return signal; + } + function modifySignal(s2, fn2, update2) { + s2.update = `${fn2}((${s2.update}), (${update2}))`; + } + function legend(column, fill2) { + const legend2 = { + orient: "none", + title: column.name, + fill: fill2, + encode: { + symbols: { + update: { + shape: { + value: "square" + } + } + } + } + }; + if (column.quantitative) { + legend2.type = "symbol"; + legend2.format = "~r"; } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setModelPosition(this._vec3, false); - (0, _glMatrix.quat).slerp(this._quat, from.rotation, to.rotation, time); - this.setModelRotation(this._quat, false); - this.setModelScale((0, _mathJs.MathHelper).lerp(from.scale, to.scale, time), false); + return legend2; + } + function getLegends(context2, fill2) { + const { specColumns, insight } = context2; + if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) { + return [legend(specColumns.color, fill2)]; } - resetModel(isSmooth) { - (0, _glMatrix.vec3).set(this._modelPosition, 0, 0, -this._config.modelDistance); - (0, _glMatrix.vec3).set(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); - (0, _glMatrix.quat).set(this._modelRotation, 0, 0, 0, 1); - if (!isSmooth) this._syncSmooth(); + } + function topLookup(column, count2, source2, legend2, lookupName, fieldName, indexName) { + const data2 = [ + { + name: lookupName, + source: source2, + transform: [ + { + type: "aggregate", + groupby: [safeFieldName(column.name)] + }, + { + type: "window", + ops: ["count"], + as: [indexName] + }, + { + type: "filter", + expr: `datum[${JSON.stringify(indexName)}] <= ${count2}` + } + ] + }, + { + name: legend2, + source: source2, + transform: [ + { + type: "lookup", + from: lookupName, + key: safeFieldName(column.name), + fields: [column.name].map(safeFieldName), + values: [column.name].map(safeFieldName), + as: [fieldName] + }, + { + type: "formula", + expr: `datum[${JSON.stringify(fieldName)}] == null ? '${Other}' : datum[${JSON.stringify(fieldName)}]`, + as: fieldName + } + ] + } + ]; + return data2; + } + function addColor(props) { + const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; + let colorDataName = dataName; + const { insight, specColumns, specViewOptions } = specContext; + const legends = getLegends(specContext, scaleName); + if (legends) { + scope.legends = legends; } - resetManipulationOrigin() { - if (!(0, _glMatrix.vec3).exactEquals(this._modelManipulationOrigin, (0, _constantsJs.Constants).VECTOR3_ZERO)) this._updateManipulationOrigin((0, _constantsJs.Constants).VECTOR3_ZERO); + const categoricalColor = specColumns.color && !specColumns.color.quantitative; + if (categoricalColor) { + addData(scope, ...topLookup(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, FieldNames.TopColor, FieldNames.TopIndex)); + colorDataName = legendDataName; } - reset(isSmooth) { - this.resetModel(isSmooth); - this.resetManipulationOrigin(); - this._camera.reset(isSmooth); + if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) { + if (specColumns.color.quantitative) { + addScales(scope, binnableColorScale(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); + } else { + addScales(scope, { + name: scaleName, + type: "ordinal", + domain: { + data: colorDataName, + field: FieldNames.TopColor, + sort: true + }, + range: { + scheme: insight.scheme || ColorScaleNone + }, + reverse: { signal: colorReverseSignalName } + }); + } } - start() { - if (!this._started && this._renderer) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - this._started = true; - this._log.write(LogLevel.info, "render loop started"); - if (this.startCallback) this.startCallback(); + addSignals(scope, colorBinCountSignal(specContext), colorReverseSignal(specContext)); + return { topColorField: FieldNames.TopColor, colorDataName }; + } + function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { + const titleSignal = `parent[${JSON.stringify(FieldNames.FacetTitle)}]`; + const index2 = `datum[${JSON.stringify(FieldNames.Ordinal)}] - 1`; + const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index2); + const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index2); + addMarks(globalScope, col.header, row.footer); + addMarks(col.header, { + type: "text", + encode: { + enter: { + align: { + value: "center" + }, + baseline: { + value: "middle" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + x: { + signal: `${sizeSignals.layoutWidth} / 2` + }, + limit: { + signal: sizeSignals.layoutWidth + }, + fontSize: { + signal: SignalNames.TextSize + }, + text: { + signal: titleSignal + } + } + } + }); + addMarks(row.footer, { + type: "text", + encode: { + enter: { + align: { + value: "left" + }, + baseline: { + value: "middle" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + y: { + signal: `${sizeSignals.layoutHeight} / 2` + }, + limit: { + signal: SignalNames.PlotOffsetRight + }, + fontSize: { + signal: SignalNames.TextSize + }, + text: { + signal: titleSignal + } + } + } + }); + } + function addFacetCellTitles(scope, sizeSignals, axisTextColor) { + addMarks(scope, { + type: "text", + encode: { + enter: { + align: { + value: "center" + }, + baseline: { + value: "bottom" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + x: { + signal: `(${sizeSignals.layoutWidth}) / 2` + }, + text: { + signal: `parent[${JSON.stringify(FieldNames.FacetTitle)}]` + }, + fontSize: { + signal: SignalNames.TextSize + }, + limit: { + signal: sizeSignals.layoutWidth + }, + y: { + signal: `-${SignalNames.FacetPaddingTop} / 2` + } + } + } + }); + } + function addFacetAxesGroupMarks(props) { + const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; + const { sizeSignals } = facetScope; + const colSequence = createSequence(colSeqName, sizeSignals.colCount); + const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); + const index2 = "datum.data"; + const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index2); + const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index2); + addData(globalScope, colSequence, rowSequence); + addMarks(globalScope, col.footer, row.header); + addScales(globalScope, colTitleScale, rowTitleScale); + const map2 = { + main: [ + { + scope: facetScope.facetScope, + lines: true, + labels: false, + title: false } - } - stop() { - if (this._started) { - this._started = false; - if (this._windowAnimationFrame != null) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - this._log.write(LogLevel.info, "render loop stopped"); - } - if (this.stopCallback) this.stopCallback(); + ], + x: [ + { + scope: col.footer, + lines: true, + labels: true, + title: false + }, + { + scope: plotScope, + scale: colTitleScale, + lines: false, + labels: false, + title: true + } + ], + y: [ + { + scope: row.header, + lines: true, + labels: true, + title: false + }, + { + scope: plotScope, + scale: rowTitleScale, + lines: false, + labels: false, + title: true + } + ] + }; + return map2; + } + function facetRowHeaderFooter(data2, sizeSignals, index2) { + const rowFn = (xSignal) => { + return { + type: "group", + from: { data: data2 }, + encode: { + update: { + x: { signal: xSignal }, + y: { + signal: `${SignalNames.PlotOffsetTop} + ${SignalNames.FacetPaddingTop} + (${index2}) * (${sizeSignals.layoutHeight} + ${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})` + }, + height: { signal: sizeSignals.layoutHeight } + } + } + }; + }; + const header = rowFn(SignalNames.PlotOffsetLeft); + const footer = rowFn(`${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetRight} / 2`); + return { header, footer }; + } + function facetColumnHeaderFooter(data2, sizeSignals, index2) { + const colFn = (ySignal) => { + return { + type: "group", + from: { data: data2 }, + encode: { + update: { + x: { + signal: `(${index2}) * (${sizeSignals.layoutWidth} + ${SignalNames.FacetPaddingLeft}) + ${SignalNames.FacetPaddingLeft} + ${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` + }, + y: { signal: `${ySignal} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: sizeSignals.layoutWidth } + } + } + }; + }; + const header = colFn(`${SignalNames.PlotOffsetTop} / 2`); + const footer = colFn(`${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut}`); + return { header, footer }; + } + function createSequence(dataName, countSignal) { + return { + name: dataName, + transform: [ + { + type: "sequence", + start: 0, + stop: { + signal: countSignal + } } + ] + }; + } + function fill$1(context2, colorFieldName, scale2) { + const { specColumns, insight, specViewOptions } = context2; + const colorColumn = specColumns.color; + return colorColumn ? colorColumn.isColorData || insight.directColor ? { + field: safeFieldName(colorColumn.name) + } : { + scale: scale2, + field: colorColumn.quantitative ? safeFieldName(colorColumn.name) : colorFieldName + } : { + value: specViewOptions.colors.defaultCube + }; + } + function opacity(context2) { + const result = { + signal: SignalNames.MarkOpacity + }; + return result; + } + class GlobalScope { + constructor(props) { + const { dataName, markGroup, scope, signals } = props; + this.scope = scope; + this._markGroup = markGroup; + this.signals = signals; + this.data = getDataByName(scope.data, dataName).data; + this._markDataName = dataName; + this.offsets = { + x: "0", + y: "0", + h: SignalNames.PlotHeightIn, + w: SignalNames.PlotWidthIn + }; + this.sizeSignals = { + layoutHeight: SignalNames.PlotHeightIn, + layoutWidth: SignalNames.PlotWidthIn + }; + this.zSize = SignalNames.PlotHeightIn; } - checkWebXRSupport() { - const xrSystem = navigator.xr; - if (xrSystem) xrSystem.isSessionSupported("immersive-vr").then((supported)=>{ - if (supported) { - this._log.write(LogLevel.info, "WebXR supported"); - if (this.webXRSupportedCallback) this.webXRSupportedCallback(); - } - }); + get markDataName() { + return this._markDataName; } - requestWebXRSession() { - if (this._webXRSession) this._webXRSession.end(); - else navigator.xr.requestSession("immersive-vr").then((session)=>this._webXRSessionStarted(session)); + setMarkDataName(markDataName) { + this._markDataName = markDataName; } - _webXRSessionStarted(session) { - if (this.webXRSessionStartedCallback) this.webXRSessionStartedCallback(); - this._webXRSession = session; - session.onend = ()=>this._webXRSessionEnded(); - this._renderer.initializeWebXR(session).then(()=>{ - if (this._windowAnimationFrame) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - } - session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - }); - session.oninputsourceschange = (event)=>this._webXRInputSourcesChanged(event); + get markGroup() { + return this._markGroup; } - _webXRSessionEnded() { - if (this.webXRSessionEndedCallback) this.webXRSessionEndedCallback(); - this._webXRSession = null; - this._renderer.controllers.length = 0; - this.start(); - } - _webXRInputSourcesChanged(event) { - if (event.added.length > 0) { - const added = event.added[0]; - if (added.targetRayMode == "tracked-pointer") { - const profiles = added.profiles; - const handedness = added.handedness; - if (this.webXRInputSourceRequestCallback) this.webXRInputSourceRequestCallback(profiles, handedness, (response)=>{ - const options = { - profiles: profiles, - handedness: handedness, - obj: response.obj, - texture: response.texture - }; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - }, (e)=>{ - this._log.write(LogLevel.error, e); - }); - else { - const options = {}; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - } - } - } - if (event.removed.length > 0) this.renderer.controllers.length = 0; + setMarkGroup(markGroup) { + this._markGroup = markGroup; } - _tick(currentTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - let elapsedTime = currentTime - this._previousTime; - this._previousTime = currentTime; - if (elapsedTime > 0) { - this.update(elapsedTime, xrFrame); - yield this.render(elapsedTime, xrFrame); - } - if (xrFrame) xrFrame.session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - else if (this._started) this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - }); + } + class Layout { + constructor(props) { + this.props = props; + this.id = props.id; } - update(elapsedTime, xrFrame) { - this._renderer.setSize(elapsedTime); - if (this.updateCallback) this.updateCallback(elapsedTime, xrFrame); - if (this._config.isDebugVisible) this._debugText.clear(); - this._fps.update(elapsedTime); - if (this._inputManager) { - this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; - this._inputManager.update(elapsedTime, xrFrame); - } - let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); - amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); - amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); - this._renderer.mMatrix = this._modelMMatrix; - if (this._config.isDebugVisible) { - this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); - this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); - this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); - this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); - this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); - this._debugText.addLine(`cam fov ${Math.round((0, _angleJs.AngleHelper).radiansToDegrees(this._config.fov))}`); - this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); - } - if (!xrFrame) { - this._camera.width = this._renderer.width; - this._camera.height = this._renderer.height; - this._camera.modelMMatrix = this._modelMMatrix; - this._camera.modelPosition = this._smoothedModelPosition; - this._camera.modelRotation = this._smoothedModelRotation; - this._camera.modelScale = this._smoothedModelScale; - this._camera.modelManipulationOrigin = this._modelManipulationOrigin; - this._camera.update(elapsedTime); - this._renderer.vMatrices = this._camera.vMatrices; - this._renderer.mvMatrices = this._camera.mvMatrices; - this._renderer.pMatrices = this._camera.pMatrices; - this._renderer.inverseVMatrices = this._camera.inverseVMatrices; - this._renderer.inversePMatrices = this._camera.inversePMatrices; - } - this._renderer.prepare(xrFrame); - if (!xrFrame && this._config.stereoMode == StereoMode.none) this._renderer.pickPMatrix = this._camera.pMatrices[0]; - else { - const fov = (0, _matrixJs.MatrixHelper).fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); - (0, _glMatrix.mat4).perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); - this._renderer.pickPMatrix = this._mat4; - } - if (this._renderer.isInitialized) this._renderer.update(elapsedTime); + getGrouping() { + return null; } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - this._fps.render(); - if (this._renderer.isInitialized) { - yield this._renderer.render(elapsedTime, xrFrame); - if (this.afterRenderCallback) this.afterRenderCallback(); - } - }); + getAggregateSumOp() { + return null; } - _syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); - (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - _updateManipulationOrigin(position) { - this._log.write(LogLevel.info, `manipulation origin ${position[0].toFixed(3)},${position[1].toFixed(3)},${position[2].toFixed(3)}`); - this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).copy(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).transformMat4(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); - (0, _glMatrix.vec3).subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - if (this.manipulationOriginChangedCallback) { - const result = { - x: position[0], - y: position[1], - z: position[2] - }; - this.manipulationOriginChangedCallback(result); - } - } - pickLasso(x0, y0, x1, y1, pickType) { - const inverseMMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).invert(inverseMMatrix, this._modelMMatrix); - const sets = []; - const nearPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const farPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const directions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._camera.unproject(nearPositions[0], x0, y1, -1); - this._camera.unproject(farPositions[0], x0, y1, 1); - this._camera.unproject(nearPositions[1], x1, y1, -1); - this._camera.unproject(farPositions[1], x1, y1, 1); - this._camera.unproject(nearPositions[2], x1, y0, -1); - this._camera.unproject(farPositions[2], x1, y0, 1); - this._camera.unproject(nearPositions[3], x0, y0, -1); - this._camera.unproject(farPositions[3], x0, y0, 1); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).transformMat4(nearPositions[i], nearPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).transformMat4(farPositions[i], farPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).subtract(directions[i], farPositions[i], nearPositions[i]); - (0, _glMatrix.vec3).normalize(directions[i], directions[i]); - } - const normals = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const d = []; - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).cross(normals[i], directions[(i + 1) % 4], directions[i]); - (0, _glMatrix.vec3).normalize(normals[i], normals[i]); - d.push(-(0, _glMatrix.vec3).dot(normals[i], nearPositions[i])); - } - if (pickType == PickType.data) { - const translation = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const transitionBuffer = this._renderer.transitionBuffers[i]; - const set = new Set(); - if (transitionBuffer.isVisible) { - const start = window.performance.now(); - const currentBuffer = transitionBuffer.currentBuffer; - const lookup = currentBuffer.lookup; - for(let j = 0; j < currentBuffer.length; j++){ - const id = currentBuffer.ids[j]; - const index = lookup[id]; - if (index != null) { - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, index, translation); - let isInside = true; - for(let k = 0; k < 4; k++){ - let distance = (0, _glMatrix.vec3).dot(normals[k], translation); - distance += d[k]; - if (distance < 0) { - isInside = false; - break; - } - } - if (isInside) set.add(id); - } - } - if (set.size > 0) this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set.size} ${Math.round(window.performance.now() - start)}ms`); - } - sets.push(set); - } - } - return sets; + build() { + throw "Not implemented"; } -} -const CameraMode = { - orbit: "orbit", - altAzimuth: "altAzimuth" -}; -const StereoMode = { - none: "none", - split: "split", - anaglyph: "anaglyph", - left: "left", - right: "right" -}; -const SelectionMode = { - new: "new", - add: "add", - subtract: "subtract", - intersect: "intersect" -}; -const FilterMode = { - isolate: "isolate", - exclude: "exclude" -}; -const HorizontalAlignment = { - left: "left", - center: "center", - right: "right" -}; -const VerticalAlignment = { - top: "top", - center: "center", - bottom: "bottom" -}; -const TextAlignment = { - left: "left", - center: "center", - right: "right" -}; -const Orientation = { - horizontal: "horizontal", - vertical: "vertical" -}; -const AxesTextOrientation = { - parallel: "parallel", - perpendicular: "perpendicular" -}; -const AxesVisibility = { - none: "none", - current: "current", - previous: "previous" -}; -const PickType = { - none: 0, - data: 1, - label: 2, - axesDivision: 3, - axesTitle: 4, - axesLabel: 5, - axesHeading: 6 -}; -const Theme = { - dark: "dark", - light: "light" -}; -const HighlightMode = { - luminance: "luminance", - color: "color" -}; -const UnitType = { - block: "block", - blockSdf: "blockSdf", - boxFrameSdf: "boxFrameSdf", - sphere: "sphere", - sphereSdf: "sphereSdf", - cylinder: "cylinder", - cylinderSdf: "cylinderSdf", - hexPrism: "hexPrism", - hexPrismSdf: "hexPrismSdf", - sdf: "sdf", - disk: "disk", - ringSdf: "ringSdf" -}; -const SingleTouchAction = { - none: "none", - translate: "translate", - rotate: "rotate", - lasso: "lasso" -}; -const MouseWheelAction = { - none: "none", - zoom: "zoom", - rotateY: "rotateY" -}; -const LogLevel = { - trace: 0, - debug: 1, - info: 2, - warn: 3, - error: 4 -}; -const Edge2D = { - top: 0, - right: 1, - bottom: 2, - left: 3 -}; -const Face2D = { - front: 0, - back: 1 -}; -const Edge3D = { - topFront: 0, - topRight: 1, - topBack: 2, - topLeft: 3, - bottomFront: 4, - bottomRight: 5, - bottomBack: 6, - bottomLeft: 7, - frontRight: 8, - backRight: 9, - backLeft: 10, - frontLeft: 11 -}; -const Face3D = { - top: 0, - right: 1, - bottom: 2, - left: 3, - front: 4, - back: 5 -}; -const HexOrientation = { - pointyTop: "pointyTop", - flatTop: "flatTop" -}; -const RenderMode = { - color: "color", - hdr: "hdr", - depth: "depth", - normal: "normal", - segment: "segment", - edge: "edge" -}; - -},{"gl-matrix":"5x28d","./cameras/altazimuth.js":"gRqOf","./config.js":"bCTP3","./constants.js":"lD0bG","./debug.js":"eYPBQ","./fps.js":"9OHgw","./helpers/angle.js":"53hwW","./palette.js":"hZb65","./components/controller.js":"f5tIG","./helpers/matrix.js":"7gWc5","./components/axes/cartesian3d.js":"jfjef","./components/axes/cartesian2d.js":"d0jS2","./font.js":"ibkbS","./vertex.js":"4J2YE","./input/manager.js":"8nDg6","./log.js":"c6yiP","./helpers/math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5x28d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "glMatrix", ()=>_commonJs); -parcelHelpers.export(exports, "mat2", ()=>_mat2Js); -parcelHelpers.export(exports, "mat2d", ()=>_mat2DJs); -parcelHelpers.export(exports, "mat3", ()=>_mat3Js); -parcelHelpers.export(exports, "mat4", ()=>_mat4Js); -parcelHelpers.export(exports, "quat", ()=>_quatJs); -parcelHelpers.export(exports, "quat2", ()=>_quat2Js); -parcelHelpers.export(exports, "vec2", ()=>_vec2Js); -parcelHelpers.export(exports, "vec3", ()=>_vec3Js); -parcelHelpers.export(exports, "vec4", ()=>_vec4Js); -var _commonJs = require("./common.js"); -var _mat2Js = require("./mat2.js"); -var _mat2DJs = require("./mat2d.js"); -var _mat3Js = require("./mat3.js"); -var _mat4Js = require("./mat4.js"); -var _quatJs = require("./quat.js"); -var _quat2Js = require("./quat2.js"); -var _vec2Js = require("./vec2.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); - -},{"./common.js":"7GML7","./mat2.js":false,"./mat2d.js":false,"./mat3.js":"80EZI","./mat4.js":"e5zmM","./quat.js":"2chmr","./quat2.js":false,"./vec2.js":"eovGI","./vec3.js":"9zs5l","./vec4.js":"ao75m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7GML7":[function(require,module,exports,__globalThis) { -/** - * Common utilities - * @module glMatrix - */ // Configuration Constants -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "EPSILON", ()=>EPSILON); -parcelHelpers.export(exports, "ARRAY_TYPE", ()=>ARRAY_TYPE); -parcelHelpers.export(exports, "RANDOM", ()=>RANDOM); -/** - * Sets the type of array used when creating new vectors and matrices - * - * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array - */ parcelHelpers.export(exports, "setMatrixArrayType", ()=>setMatrixArrayType); -/** - * Convert Degree To Radian - * - * @param {Number} a Angle in Degrees - */ parcelHelpers.export(exports, "toRadian", ()=>toRadian); -/** - * Tests whether or not the arguments have approximately the same value, within an absolute - * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less - * than or equal to 1.0, and a relative tolerance is used for larger values) - * - * @param {Number} a The first number to test. - * @param {Number} b The second number to test. - * @returns {Boolean} True if the numbers are approximately equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -var EPSILON = 0.000001; -var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; -var RANDOM = Math.random; -function setMatrixArrayType(type) { - ARRAY_TYPE = type; -} -var degree = Math.PI / 180; -function toRadian(a) { - return a * degree; -} -function equals(a, b) { - return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b)); -} -if (!Math.hypot) Math.hypot = function() { - var y = 0, i = arguments.length; - while(i--)y += arguments[i] * arguments[i]; - return Math.sqrt(y); -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"80EZI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3x3 Matrix - * @module mat3 - */ /** - * Creates a new identity mat3 - * - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param {mat3} out the receiving 3x3 matrix - * @param {ReadonlyMat4} a the source 4x4 matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromMat4", ()=>fromMat4); -/** - * Creates a new mat3 initialized with values from an existing matrix - * - * @param {ReadonlyMat3} a matrix to clone - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat3 to another - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat3 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} A new mat3 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat3 to the given values - * - * @param {mat3} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat3 to the identity matrix - * - * @param {mat3} out the receiving matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat3 - * - * @param {ReadonlyMat3} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat3 by the given vector - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to translate - * @param {ReadonlyVec2} v vector to translate by - * @returns {mat3} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Rotates a mat3 by the given angle - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Scales the mat3 by the dimensions in the given vec2 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {ReadonlyVec2} v the vec2 to scale the matrix by - * @returns {mat3} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.translate(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Translation vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a given angle - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.rotate(dest, dest, rad); - * - * @param {mat3} out mat3 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.scale(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Scaling vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Copies the values from a mat2d into a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat2d} a the matrix to copy - * @returns {mat3} out - **/ parcelHelpers.export(exports, "fromMat2d", ()=>fromMat2d); -/** - * Calculates a 3x3 matrix from the given quaternion - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "normalFromMat4", ()=>normalFromMat4); -/** - * Generates a 2D projection matrix with the given bounds - * - * @param {mat3} out mat3 frustum matrix will be written into - * @param {number} width Width of your gl context - * @param {number} height Height of gl context - * @returns {mat3} out - */ parcelHelpers.export(exports, "projection", ()=>projection); -/** - * Returns a string representation of a mat3 - * - * @param {ReadonlyMat3} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat3 - * - * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat3's after multiplying each element of the second operand by a scalar value. - * - * @param {mat3} out the receiving vector - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(9); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; + } + function testForCollapseSelection() { + return `datum.${FieldNames.Collapsed}`; + } + class AggregateContainer extends Layout { + constructor(props) { + super(props); + this.props = props; + const a2 = this.aggregation = this.getAggregation(); + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a2}_extent`, + scale: `scale_${p}`, + extentData: `data_${p}_extent`, + offsets: `data_${p}_offsets` + }; } - out[0] = 1; - out[4] = 1; - out[8] = 1; - return out; -} -function fromMat4(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; - return out; -} -function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) { - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; - return out; -} -function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a12 = a[5]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a01; - out[5] = a[7]; - out[6] = a02; - out[7] = a12; - } else { - out[0] = a[0]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a[1]; - out[4] = a[4]; - out[5] = a[7]; - out[6] = a[2]; - out[7] = a[5]; - out[8] = a[8]; + getAggregateSumOp() { + if (this.aggregation === "sum") { + const fieldOp = { + field: safeFieldName(this.props.sumBy.name), + op: "sum", + as: FieldNames.Sum + }; + return fieldOp; + } } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b01 = a22 * a11 - a12 * a21; - var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21; - if (!det) return null; - det = 1.0 / det; - out[0] = b01 * det; - out[1] = (-a22 * a01 + a02 * a21) * det; - out[2] = (a12 * a01 - a02 * a11) * det; - out[3] = b11 * det; - out[4] = (a22 * a00 - a02 * a20) * det; - out[5] = (-a12 * a00 + a02 * a10) * det; - out[6] = b21 * det; - out[7] = (-a21 * a00 + a01 * a20) * det; - out[8] = (a11 * a00 - a01 * a10) * det; - return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - out[0] = a11 * a22 - a12 * a21; - out[1] = a02 * a21 - a01 * a22; - out[2] = a01 * a12 - a02 * a11; - out[3] = a12 * a20 - a10 * a22; - out[4] = a00 * a22 - a02 * a20; - out[5] = a02 * a10 - a00 * a12; - out[6] = a10 * a21 - a11 * a20; - out[7] = a01 * a20 - a00 * a21; - out[8] = a00 * a11 - a01 * a10; - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b00 = b[0], b01 = b[1], b02 = b[2]; - var b10 = b[3], b11 = b[4], b12 = b[5]; - var b20 = b[6], b21 = b[7], b22 = b[8]; - out[0] = b00 * a00 + b01 * a10 + b02 * a20; - out[1] = b00 * a01 + b01 * a11 + b02 * a21; - out[2] = b00 * a02 + b01 * a12 + b02 * a22; - out[3] = b10 * a00 + b11 * a10 + b12 * a20; - out[4] = b10 * a01 + b11 * a11 + b12 * a21; - out[5] = b10 * a02 + b11 * a12 + b12 * a22; - out[6] = b20 * a00 + b21 * a10 + b22 * a20; - out[7] = b20 * a01 + b21 * a11 + b22 * a21; - out[8] = b20 * a02 + b21 * a12 + b22 * a22; - return out; -} -function translate(out, a, v) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], x = v[0], y = v[1]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a10; - out[4] = a11; - out[5] = a12; - out[6] = x * a00 + y * a10 + a20; - out[7] = x * a01 + y * a11 + a21; - out[8] = x * a02 + y * a12 + a22; - return out; -} -function rotate(out, a, rad) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], s = Math.sin(rad), c = Math.cos(rad); - out[0] = c * a00 + s * a10; - out[1] = c * a01 + s * a11; - out[2] = c * a02 + s * a12; - out[3] = c * a10 - s * a00; - out[4] = c * a11 - s * a01; - out[5] = c * a12 - s * a02; - out[6] = a20; - out[7] = a21; - out[8] = a22; - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1]; - out[0] = x * a[0]; - out[1] = x * a[1]; - out[2] = x * a[2]; - out[3] = y * a[3]; - out[4] = y * a[4]; - out[5] = y * a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = v[0]; - out[7] = v[1]; - out[8] = 1; - return out; -} -function fromRotation(out, rad) { - var s = Math.sin(rad), c = Math.cos(rad); - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = -s; - out[4] = c; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = v[1]; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromMat2d(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = 0; - out[3] = a[2]; - out[4] = a[3]; - out[5] = 0; - out[6] = a[4]; - out[7] = a[5]; - out[8] = 1; - return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - yy - zz; - out[3] = yx - wz; - out[6] = zx + wy; - out[1] = yx + wz; - out[4] = 1 - xx - zz; - out[7] = zy - wx; - out[2] = zx - wy; - out[5] = zy + wx; - out[8] = 1 - xx - yy; - return out; -} -function normalFromMat4(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - return out; -} -function projection(out, width, height) { - out[0] = 2 / width; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = -2 / height; - out[5] = 0; - out[6] = -1; - out[7] = 1; - out[8] = 1; - return out; -} -function str(a) { - return "mat3(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; - return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7], a8 = a[8]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e5zmM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied. - * @module mat4 - */ /** - * Creates a new identity mat4 - * - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new mat4 initialized with values from an existing matrix - * - * @param {ReadonlyMat4} a matrix to clone - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat4 to another - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat4 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} A new mat4 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat4 to the given values - * - * @param {mat4} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat4 to the identity matrix - * - * @param {mat4} out the receiving matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat4 - * - * @param {ReadonlyMat4} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat4s - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat4 by the given vector - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to translate - * @param {ReadonlyVec3} v vector to translate by - * @returns {mat4} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Scales the mat4 by the dimensions in the given vec3 not using vectorization - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {ReadonlyVec3} v the vec3 to scale the matrix by - * @returns {mat4} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Rotates a mat4 by the given angle around the given axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Rotates a matrix by the given angle around the X axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a matrix by the given angle around the Y axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a matrix by the given angle around the Z axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.scale(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Creates a matrix from a given angle around a given axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotate(dest, dest, rad, axis); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from the given angle around the X axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateX(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromXRotation", ()=>fromXRotation); -/** - * Creates a matrix from the given angle around the Y axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateY(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromYRotation", ()=>fromYRotation); -/** - * Creates a matrix from the given angle around the Z axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateZ(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromZRotation", ()=>fromZRotation); -/** - * Creates a matrix from a quaternion rotation and vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslation", ()=>fromRotationTranslation); -/** - * Creates a new mat4 from a dual quat. - * - * @param {mat4} out Matrix - * @param {ReadonlyQuat2} a Dual Quaternion - * @returns {mat4} mat4 receiving operation result - */ parcelHelpers.export(exports, "fromQuat2", ()=>fromQuat2); -/** - * Returns the translation vector component of a transformation - * matrix. If a matrix is built with fromRotationTranslation, - * the returned vector will be the same as the translation vector - * originally supplied. - * @param {vec3} out Vector to receive translation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getTranslation", ()=>getTranslation); -/** - * Returns the scaling factor component of a transformation - * matrix. If a matrix is built with fromRotationTranslationScale - * with a normalized Quaternion paramter, the returned vector will be - * the same as the scaling vector - * originally supplied. - * @param {vec3} out Vector to receive scaling factor component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getScaling", ()=>getScaling); -/** - * Returns a quaternion representing the rotational component - * of a transformation matrix. If a matrix is built with - * fromRotationTranslation, the returned quaternion will be the - * same as the quaternion originally supplied. - * @param {quat} out Quaternion to receive the rotation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {quat} out - */ parcelHelpers.export(exports, "getRotation", ()=>getRotation); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScale", ()=>fromRotationTranslationScale); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @param {ReadonlyVec3} o The origin vector around which to scale and rotate - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScaleOrigin", ()=>fromRotationTranslationScaleOrigin); -/** - * Calculates a 4x4 matrix from the given quaternion - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Generates a frustum matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Number} left Left bound of the frustum - * @param {Number} right Right bound of the frustum - * @param {Number} bottom Bottom bound of the frustum - * @param {Number} top Top bound of the frustum - * @param {Number} near Near bound of the frustum - * @param {Number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "frustum", ()=>frustum); -/** - * Generates a perspective projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveNO", ()=>perspectiveNO); -parcelHelpers.export(exports, "perspective", ()=>perspective); -/** - * Generates a perspective projection matrix suitable for WebGPU with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveZO", ()=>perspectiveZO); -/** - * Generates a perspective projection matrix with the given field of view. - * This is primarily useful for generating projection matrices to be used - * with the still experiemental WebVR API. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveFromFieldOfView", ()=>perspectiveFromFieldOfView); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoNO", ()=>orthoNO); -parcelHelpers.export(exports, "ortho", ()=>ortho); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoZO", ()=>orthoZO); -/** - * Generates a look-at matrix with the given eye position, focal point, and up axis. - * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "lookAt", ()=>lookAt); -/** - * Generates a matrix that makes something look at something else. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "targetTo", ()=>targetTo); -/** - * Returns a string representation of a mat4 - * - * @param {ReadonlyMat4} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat4 - * - * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat4's - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat4's after multiplying each element of the second operand by a scalar value. - * - * @param {mat4} out the receiving vector - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(16); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; + build() { + const { aggregation, names, props } = this; + const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentSignal, + update: `${names.globalAggregateExtentSignal}[1]` + }); + const horizontal = dock === "left"; + const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; + const offsets2 = { + x: parentScope.offsets.x, + y: addOffsets(parentScope.offsets.y, dock === "bottom" ? groupScaled : ""), + h: horizontal ? parentScope.offsets.h : dock === "top" ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, + w: horizontal ? groupScaled : parentScope.offsets.w + }; + const scale2 = { + type: "linear", + name: names.scale, + domain: [ + 0, + { + signal: props.globalAggregateMaxExtentSignal + } + ], + range: horizontal ? [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ] : [ + { + signal: parentScope.sizeSignals.layoutHeight + }, + 0 + ], + nice: niceScale, + zero: true, + reverse: dock === "top" + }; + const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentScaledSignal, + update: dock === "bottom" ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue + }); + return { + offsets: offsets2, + sizeSignals: horizontal ? { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: null + } : { + layoutHeight: null, + layoutWidth: parentScope.sizeSignals.layoutWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? [scale2] : void 0, + y: horizontal ? void 0 : [scale2] + } + }, + encodingRuleMap: horizontal ? { + x: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.x + }], + width: [{ + test: testForCollapseSelection(), + value: 0 + }] + } : { + y: [{ + test: testForCollapseSelection(), + signal: dock === "top" ? parentScope.offsets.y : addOffsets(parentScope.offsets.y, parentScope.offsets.h) + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; } - out[0] = 1; - out[5] = 1; - out[10] = 1; - out[15] = 1; - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; -} -function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; -} -function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a03 = a[3]; - var a12 = a[6], a13 = a[7]; - var a23 = a[11]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a01; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a02; - out[9] = a12; - out[11] = a[14]; - out[12] = a03; - out[13] = a13; - out[14] = a23; - } else { - out[0] = a[0]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a[1]; - out[5] = a[5]; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a[2]; - out[9] = a[6]; - out[10] = a[10]; - out[11] = a[14]; - out[12] = a[3]; - out[13] = a[7]; - out[14] = a[11]; - out[15] = a[15]; + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); - out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); - out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); - out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); - out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); - out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); - out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); - out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - return out; -} -function translate(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - if (a === out) { - out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - } else { - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a03; - out[4] = a10; - out[5] = a11; - out[6] = a12; - out[7] = a13; - out[8] = a20; - out[9] = a21; - out[10] = a22; - out[11] = a23; - out[12] = a00 * x + a10 * y + a20 * z + a[12]; - out[13] = a01 * x + a11 * y + a21 * z + a[13]; - out[14] = a02 * x + a12 * y + a22 * z + a[14]; - out[15] = a03 * x + a13 * y + a23 * z + a[15]; + getAggregation() { + const { props } = this; + let s2; + if (props.dock === "left") { + s2 = props.axesScales.x; + } else { + s2 = props.axesScales.y; + } + switch (s2.aggregate) { + case "sum": + return "sum"; + default: + return "count"; + } } - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - out[0] = a[0] * x; - out[1] = a[1] * x; - out[2] = a[2] * x; - out[3] = a[3] * x; - out[4] = a[4] * y; - out[5] = a[5] * y; - out[6] = a[6] * y; - out[7] = a[7] * y; - out[8] = a[8] * z; - out[9] = a[9] * z; - out[10] = a[10] * z; - out[11] = a[11] * z; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function rotate(out, a, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - var b00, b01, b02; - var b10, b11, b12; - var b20, b21, b22; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; // Construct the elements of the rotation matrix - b00 = x * x * t + c; - b01 = y * x * t + z * s; - b02 = z * x * t - y * s; - b10 = x * y * t - z * s; - b11 = y * y * t + c; - b12 = z * y * t + x * s; - b20 = x * z * t + y * s; - b21 = y * z * t - x * s; - b22 = z * z * t + c; // Perform rotation-specific matrix multiplication - out[0] = a00 * b00 + a10 * b01 + a20 * b02; - out[1] = a01 * b00 + a11 * b01 + a21 * b02; - out[2] = a02 * b00 + a12 * b01 + a22 * b02; - out[3] = a03 * b00 + a13 * b01 + a23 * b02; - out[4] = a00 * b10 + a10 * b11 + a20 * b12; - out[5] = a01 * b10 + a11 * b11 + a21 * b12; - out[6] = a02 * b10 + a12 * b11 + a22 * b12; - out[7] = a03 * b10 + a13 * b11 + a23 * b12; - out[8] = a00 * b20 + a10 * b21 + a20 * b22; - out[9] = a01 * b20 + a11 * b21 + a21 * b22; - out[10] = a02 * b20 + a12 * b21 + a22 * b22; - out[11] = a03 * b20 + a13 * b21 + a23 * b22; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; + } + class AggregateSquare extends Layout { + constructor(props) { + super(props); + this.props = props; + const a2 = this.props.aggregation; + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a2}_extent`, + extentData: `data_${p}_extent` + }; } - return out; -} -function rotateX(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[4] = a10 * c + a20 * s; - out[5] = a11 * c + a21 * s; - out[6] = a12 * c + a22 * s; - out[7] = a13 * c + a23 * s; - out[8] = a20 * c - a10 * s; - out[9] = a21 * c - a11 * s; - out[10] = a22 * c - a12 * s; - out[11] = a23 * c - a13 * s; - return out; -} -function rotateY(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c - a20 * s; - out[1] = a01 * c - a21 * s; - out[2] = a02 * c - a22 * s; - out[3] = a03 * c - a23 * s; - out[8] = a00 * s + a20 * c; - out[9] = a01 * s + a21 * c; - out[10] = a02 * s + a22 * c; - out[11] = a03 * s + a23 * c; - return out; -} -function rotateZ(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c + a10 * s; - out[1] = a01 * c + a11 * s; - out[2] = a02 * c + a12 * s; - out[3] = a03 * c + a13 * s; - out[4] = a10 * c - a00 * s; - out[5] = a11 * c - a01 * s; - out[6] = a12 * c - a02 * s; - out[7] = a13 * c - a03 * s; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = v[1]; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = v[2]; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotation(out, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; // Perform rotation-specific matrix multiplication - out[0] = x * x * t + c; - out[1] = y * x * t + z * s; - out[2] = z * x * t - y * s; - out[3] = 0; - out[4] = x * y * t - z * s; - out[5] = y * y * t + c; - out[6] = z * y * t + x * s; - out[7] = 0; - out[8] = x * z * t + y * s; - out[9] = y * z * t - x * s; - out[10] = z * z * t + c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromXRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = c; - out[6] = s; - out[7] = 0; - out[8] = 0; - out[9] = -s; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromYRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = 0; - out[2] = -s; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = s; - out[9] = 0; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromZRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = 0; - out[4] = -s; - out[5] = c; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotationTranslation(out, q, v) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromQuat2(out, a) { - var translation = new _commonJs.ARRAY_TYPE(3); - var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7]; - var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense - if (magnitude > 0) { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + build() { + const { names, props } = this; + const { aggregation, globalScope, groupings, onBuild, parentScope } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; + const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; + const squareMaxArea = `(${[squareMaxSide, squareMaxSide].join(" * ")})`; + const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; + const squareArea = `(${[squareMaxArea, shrinkRatio].join(" * ")})`; + const squareSide = `sqrt(${squareArea})`; + const localAggregateMaxExtentScaled = squareSide; + onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), + y: addOffsets(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), + h: squareSide, + w: squareSide + }; + return { + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: offsets2.y + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; + } + } + function dataExtent(column, signal) { + return { + type: "extent", + field: safeFieldName(column.name), + signal + }; + } + function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { + const { column, defaultBins: defaultBins2, maxbins: maxbins2, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; + if (column.quantitative) { + const field2 = `${prefix}_bin_${exprSafeFieldName(column.name)}`; + const fieldEnd = `${field2}_end`; + const binSignal = `${field2}_bins`; + const dataExtentSignal = `${field2}_bin_extent`; + const dataExtentSpanSignal = `${field2}_bin_extent_span`; + const outerSignal = `${field2}_outer_extent`; + domainDataName = `${field2}_sequence`; + const extentTransform = dataExtent(column, dataExtentSignal); + let imageSignal; + if (outerSignalExtents) { + imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); + } + const maxbinsSignal = { + name: maxbinsSignalName, + value: defaultBins2, + bind: { + name: maxbinsSignalDisplayName, + debounce: debounce$1, + input: "range", + min: 1, + max: maxbins2, + step: 1 + } + }; + const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; + const binTransform = { + type: "bin", + field: safeFieldName(column.name), + as: [ + field2, + fieldEnd + ], + signal: binSignal, + extent: { + signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` + //add a tiny bit to the upper extent to force the extra bin - https://github.com/vega/vega/issues/2899 + }, + minstep: shouldBeIntegralBinStep(column) ? 1 : 0, + maxbins: { + signal: maxbinsSignalName + } + }; + const dataSequence = { + name: domainDataName, + transform: [ + { + type: "sequence", + start: { + signal: `${binSignal}.start` + }, + stop: { + signal: `${binSignal}.stop` + }, + step: { + signal: `${binSignal}.step` + } + }, + { + type: "formula", + expr: "datum.data", + as: field2 + }, + { + type: "formula", + expr: `datum.data + ${binSignal}.step`, + as: fieldEnd + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.start`, + as: FieldNames.First + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, + as: FieldNames.Last + }, + { + // when there is only one bin, use only first sequence element + type: "filter", + expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify(FieldNames.First)}] : true` + } + ] + }; + const signals = [ + maxbinsSignal, + { + name: dataExtentSpanSignal, + update: `${extentSignal}[1] - ${extentSignal}[0]` + } + ]; + if (imageSignal) { + signals.push(imageSignal); + } + const augmentBinnable = { + discreteColumn, + native: false, + transforms: [extentTransform, binTransform], + fields: [field2, fieldEnd], + binSignal, + extentSignal, + dataSequence, + domainDataName, + signals, + fullScaleDataname: dataSequence.name + }; + return augmentBinnable; } else { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + const nativeBinnable = { + discreteColumn, + native: true, + fields: [column.name], + domainDataName, + fullScaleDataname: domainDataName + }; + return nativeBinnable; + } + } + function outerExtentSignal(name, min2, max2, dataExtent2) { + return { + name, + update: `[min(${min2}, ${dataExtent2}[0]), max(${max2}, ${dataExtent2}[1])]` + }; + } + function shouldBeIntegralBinStep(column) { + return column.quantitative && (column.type === "integer" && column.stats.max - column.stats.min <= 7); + } + const bandScaleLinearSuffix = "_linear"; + let Band$1 = class Band extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `band_${this.id}`; + this.names = { + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + bandWidth: `${p}_bandwidth`, + accumulative: `${p}_accumulative` + }; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); + } + getGrouping() { + return this.bin.fields; + } + build() { + const { bin: bin2, names, props } = this; + const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; + const binField = bin2.fields[0]; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + } + addData(globalScope.scope, { + name: names.accumulative, + source: bin2.fullScaleDataname, + transform: [ + { + type: "aggregate", + groupby: this.getGrouping().map(safeFieldName), + ops: ["count"] + } + ] + }); + const horizontal = orientation === "horizontal"; + const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; + modifySignal(minCellSignal, "max", `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); + addSignals(globalScope.scope, { + name: names.bandWidth, + update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` + }); + const scale2 = this.getScale(bin2, horizontal); + if (props.outerSignalExtents && bin2.native === false) { + addScales(globalScope.scope, linearScale(scale2.name + bandScaleLinearSuffix, { signal: bin2.extentSignal }, scale2.range, scale2.reverse, false, false)); + } + let encodingRuleMap; + if (!props.excludeEncodingRuleMap) { + encodingRuleMap = horizontal ? { + x: [ + { + test: testForCollapseSelection(), + signal: parentScope.offsets.x + } + ], + width: [ + { + test: testForCollapseSelection(), + value: 0 + } + ] + } : { + y: [ + { + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.offsets.h) + } + ], + height: [ + { + test: testForCollapseSelection(), + value: 0 + } + ] + }; + } + return { + offsets: this.getOffset(horizontal, binField), + sizeSignals: horizontal ? { + layoutHeight: names.bandWidth, + layoutWidth: parentScope.sizeSignals.layoutWidth + } : { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: names.bandWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? void 0 : [scale2], + y: horizontal ? [scale2] : void 0 + } + }, + encodingRuleMap + }; } - fromRotationTranslation(out, a, translation); - return out; -} -function getTranslation(out, mat) { - out[0] = mat[12]; - out[1] = mat[13]; - out[2] = mat[14]; - return out; -} -function getScaling(out, mat) { - var m11 = mat[0]; - var m12 = mat[1]; - var m13 = mat[2]; - var m21 = mat[4]; - var m22 = mat[5]; - var m23 = mat[6]; - var m31 = mat[8]; - var m32 = mat[9]; - var m33 = mat[10]; - out[0] = Math.hypot(m11, m12, m13); - out[1] = Math.hypot(m21, m22, m23); - out[2] = Math.hypot(m31, m32, m33); - return out; -} -function getRotation(out, mat) { - var scaling = new _commonJs.ARRAY_TYPE(3); - getScaling(scaling, mat); - var is1 = 1 / scaling[0]; - var is2 = 1 / scaling[1]; - var is3 = 1 / scaling[2]; - var sm11 = mat[0] * is1; - var sm12 = mat[1] * is2; - var sm13 = mat[2] * is3; - var sm21 = mat[4] * is1; - var sm22 = mat[5] * is2; - var sm23 = mat[6] * is3; - var sm31 = mat[8] * is1; - var sm32 = mat[9] * is2; - var sm33 = mat[10] * is3; - var trace = sm11 + sm22 + sm33; - var S = 0; - if (trace > 0) { - S = Math.sqrt(trace + 1.0) * 2; - out[3] = 0.25 * S; - out[0] = (sm23 - sm32) / S; - out[1] = (sm31 - sm13) / S; - out[2] = (sm12 - sm21) / S; - } else if (sm11 > sm22 && sm11 > sm33) { - S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; - out[3] = (sm23 - sm32) / S; - out[0] = 0.25 * S; - out[1] = (sm12 + sm21) / S; - out[2] = (sm31 + sm13) / S; - } else if (sm22 > sm33) { - S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; - out[3] = (sm31 - sm13) / S; - out[0] = (sm12 + sm21) / S; - out[1] = 0.25 * S; - out[2] = (sm23 + sm32) / S; - } else { - S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; - out[3] = (sm12 - sm21) / S; - out[0] = (sm31 + sm13) / S; - out[1] = (sm23 + sm32) / S; - out[2] = 0.25 * S; + getOffset(horizontal, binField) { + const { names, props } = this; + const { parentScope } = props; + return { + x: addOffsets(parentScope.offsets.x, horizontal ? "" : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), + y: addOffsets(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ""), + h: horizontal ? names.bandWidth : parentScope.offsets.h, + w: horizontal ? parentScope.offsets.w : names.bandWidth + }; + } + getScale(bin2, horizontal) { + const { names } = this; + const { parentScope } = this.props; + const binField = safeFieldName(bin2.fields[0]); + let bandScale; + if (horizontal) { + bandScale = { + type: "band", + name: names.yScale, + range: [ + 0, + { + signal: parentScope.sizeSignals.layoutHeight + } + ], + padding: 0.1, + domain: { + data: bin2.domainDataName, + field: binField, + sort: true + }, + reverse: true + }; + } else { + bandScale = { + type: "band", + name: names.xScale, + range: [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ], + padding: 0.1, + domain: { + data: bin2.domainDataName, + field: binField, + sort: true + } + }; + } + return bandScale; } - return out; -} -function fromRotationTranslationScale(out, q, v, s) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - out[0] = (1 - (yy + zz)) * sx; - out[1] = (xy + wz) * sx; - out[2] = (xz - wy) * sx; - out[3] = 0; - out[4] = (xy - wz) * sy; - out[5] = (1 - (xx + zz)) * sy; - out[6] = (yz + wx) * sy; - out[7] = 0; - out[8] = (xz + wy) * sz; - out[9] = (yz - wx) * sz; - out[10] = (1 - (xx + yy)) * sz; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromRotationTranslationScaleOrigin(out, q, v, s, o) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - var ox = o[0]; - var oy = o[1]; - var oz = o[2]; - var out0 = (1 - (yy + zz)) * sx; - var out1 = (xy + wz) * sx; - var out2 = (xz - wy) * sx; - var out4 = (xy - wz) * sy; - var out5 = (1 - (xx + zz)) * sy; - var out6 = (yz + wx) * sy; - var out8 = (xz + wy) * sz; - var out9 = (yz - wx) * sz; - var out10 = (1 - (xx + yy)) * sz; - out[0] = out0; - out[1] = out1; - out[2] = out2; - out[3] = 0; - out[4] = out4; - out[5] = out5; - out[6] = out6; - out[7] = 0; - out[8] = out8; - out[9] = out9; - out[10] = out10; - out[11] = 0; - out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); - out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); - out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); - out[15] = 1; - return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - yy - zz; - out[1] = yx + wz; - out[2] = zx - wy; - out[3] = 0; - out[4] = yx - wz; - out[5] = 1 - xx - zz; - out[6] = zy + wx; - out[7] = 0; - out[8] = zx + wy; - out[9] = zy - wx; - out[10] = 1 - xx - yy; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function frustum(out, left, right, bottom, top, near, far) { - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - out[0] = near * 2 * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = near * 2 * tb; - out[6] = 0; - out[7] = 0; - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = far * near * 2 * nf; - out[15] = 0; - return out; -} -function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = (far + near) * nf; - out[14] = 2 * far * near * nf; + }; + function displayBin(bin2) { + const val = (index2) => `datum[${JSON.stringify(bin2.fields[index2])}]`; + return bin2.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); + } + function obj(nameValues, clause) { + return `{${nameValues.join()}}`; + } + function serializeAsVegaExpression(bin2, firstFieldName, lastFieldName, clause) { + if (bin2.discreteColumn.column.quantitative) { + const low = [ + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'>='", + `value:datum[${JSON.stringify(bin2.fields[0])}]` + ]; + const high = [ + "clause:'&&'", + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'<'", + `value:datum[${JSON.stringify(bin2.fields[1])}]` + ]; + return obj([ + `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]` + ]); } else { - out[10] = -1; - out[14] = -2 * near; + const exact = [ + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'=='", + `value:datum[${JSON.stringify(bin2.fields[0])}]` + ]; + return obj([ + `expressions:[${obj(exact)}]` + ]); } - return out; -} -var perspective = perspectiveNO; -function perspectiveZO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = far * nf; - out[14] = far * near * nf; - } else { - out[10] = -1; - out[14] = -near; + } + function createOrdinals(source2, prefix, binFields, sortOrder) { + const _binFields = binFields.map(safeFieldName); + const dataName = `${prefix}_bin_order`; + const data2 = { + name: dataName, + source: source2, + transform: [ + { + type: "aggregate", + groupby: _binFields + }, + { + type: "collect", + sort: { + field: _binFields, + order: _binFields.map((f) => sortOrder) + } + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + } + ] + }; + return { + data: data2, + scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) + }; + } + function ordinalScale(dataName, scaleName, binFields) { + return { + type: "ordinal", + name: scaleName, + domain: { + data: dataName, + field: safeFieldName(binFields[0]) + }, + range: { + data: dataName, + field: FieldNames.Ordinal + } + }; + } + let Cross$1 = class Cross extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `cross_${this.id}`; + this.binX = binnable(`${p}_x`, props.globalScope.data.name, props.groupbyX); + this.binY = binnable(`${p}_y`, props.globalScope.data.name, props.groupbyY); + this.names = { + facetDataName: `data_${p}_facet`, + searchUnion: `data_${p}_search`, + dimScale: `scale_${p}`, + dimCount: `${p}_count`, + dimCategorical: `data_${p}_cat`, + dimCellSize: `${p}_cell_size`, + dimCellSizeCalc: `${p}_cell_calc` + }; } - return out; -} -function perspectiveFromFieldOfView(out, fov, near, far) { - var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0); - var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0); - var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0); - var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0); - var xScale = 2.0 / (leftTan + rightTan); - var yScale = 2.0 / (upTan + downTan); - out[0] = xScale; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - out[4] = 0.0; - out[5] = yScale; - out[6] = 0.0; - out[7] = 0.0; - out[8] = -((leftTan - rightTan) * xScale * 0.5); - out[9] = (upTan - downTan) * yScale * 0.5; - out[10] = far / (near - far); - out[11] = -1; - out[12] = 0.0; - out[13] = 0.0; - out[14] = far * near / (near - far); - out[15] = 0.0; - return out; -} -function orthoNO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - return out; -} -var ortho = orthoNO; -function orthoZO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = near * nf; - out[15] = 1; - return out; -} -function lookAt(out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; - var eyex = eye[0]; - var eyey = eye[1]; - var eyez = eye[2]; - var upx = up[0]; - var upy = up[1]; - var upz = up[2]; - var centerx = center[0]; - var centery = center[1]; - var centerz = center[2]; - if (Math.abs(eyex - centerx) < _commonJs.EPSILON && Math.abs(eyey - centery) < _commonJs.EPSILON && Math.abs(eyez - centerz) < _commonJs.EPSILON) return identity(out); - z0 = eyex - centerx; - z1 = eyey - centery; - z2 = eyez - centerz; - len = 1 / Math.hypot(z0, z1, z2); - z0 *= len; - z1 *= len; - z2 *= len; - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len = Math.hypot(x0, x1, x2); - if (!len) { - x0 = 0; - x1 = 0; - x2 = 0; - } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - len = Math.hypot(y0, y1, y2); - if (!len) { - y0 = 0; - y1 = 0; - y2 = 0; - } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - return out; -} -function targetTo(out, eye, target, up) { - var eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2]; - var z0 = eyex - target[0], z1 = eyey - target[1], z2 = eyez - target[2]; - var len = z0 * z0 + z1 * z1 + z2 * z2; - if (len > 0) { - len = 1 / Math.sqrt(len); - z0 *= len; - z1 *= len; - z2 *= len; - } - var x0 = upy * z2 - upz * z1, x1 = upz * z0 - upx * z2, x2 = upx * z1 - upy * z0; - len = x0 * x0 + x1 * x1 + x2 * x2; - if (len > 0) { - len = 1 / Math.sqrt(len); - x0 *= len; - x1 *= len; - x2 *= len; - } - out[0] = x0; - out[1] = x1; - out[2] = x2; - out[3] = 0; - out[4] = z1 * x2 - z2 * x1; - out[5] = z2 * x0 - z0 * x2; - out[6] = z0 * x1 - z1 * x0; - out[7] = 0; - out[8] = z0; - out[9] = z1; - out[10] = z2; - out[11] = 0; - out[12] = eyex; - out[13] = eyey; - out[14] = eyez; - out[15] = 1; - return out; -} -function str(a) { - return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - out[9] = a[9] + b[9]; - out[10] = a[10] + b[10]; - out[11] = a[11] + b[11]; - out[12] = a[12] + b[12]; - out[13] = a[13] + b[13]; - out[14] = a[14] + b[14]; - out[15] = a[15] + b[15]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - out[9] = a[9] - b[9]; - out[10] = a[10] - b[10]; - out[11] = a[11] - b[11]; - out[12] = a[12] - b[12]; - out[13] = a[13] - b[13]; - out[14] = a[14] - b[14]; - out[15] = a[15] - b[15]; - return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - out[9] = a[9] * b; - out[10] = a[10] * b; - out[11] = a[11] * b; - out[12] = a[12] * b; - out[13] = a[13] * b; - out[14] = a[14] * b; - out[15] = a[15] * b; - return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; - out[9] = a[9] + b[9] * scale; - out[10] = a[10] + b[10] * scale; - out[11] = a[11] + b[11] * scale; - out[12] = a[12] + b[12] * scale; - out[13] = a[13] + b[13] * scale; - out[14] = a[14] + b[14] * scale; - out[15] = a[15] + b[15] * scale; - return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7]; - var a8 = a[8], a9 = a[9], a10 = a[10], a11 = a[11]; - var a12 = a[12], a13 = a[13], a14 = a[14], a15 = a[15]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - var b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7]; - var b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11]; - var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2chmr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Quaternion - * @module quat - */ /** - * Creates a new identity quat - * - * @returns {quat} a new quaternion - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Set a quat to the identity quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Sets a quat from the given angle and rotation axis, - * then returns it. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyVec3} axis the axis around which to rotate - * @param {Number} rad the angle in radians - * @returns {quat} out - **/ parcelHelpers.export(exports, "setAxisAngle", ()=>setAxisAngle); -/** - * Gets the rotation axis and angle for a given - * quaternion. If a quaternion is created with - * setAxisAngle, this method will return the same - * values as providied in the original parameter list - * OR functionally equivalent values. - * Example: The quaternion formed by axis [0, 0, 1] and - * angle -90 is the same as the quaternion formed by - * [0, 0, 1] and 270. This method favors the latter. - * @param {vec3} out_axis Vector receiving the axis of rotation - * @param {ReadonlyQuat} q Quaternion to be decomposed - * @return {Number} Angle, in radians, of the rotation - */ parcelHelpers.export(exports, "getAxisAngle", ()=>getAxisAngle); -/** - * Gets the angular distance between two unit quaternions - * - * @param {ReadonlyQuat} a Origin unit quaternion - * @param {ReadonlyQuat} b Destination unit quaternion - * @return {Number} Angle, in radians, between the two quaternions - */ parcelHelpers.export(exports, "getAngle", ()=>getAngle); -/** - * Multiplies two quat's - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @returns {quat} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Rotates a quaternion by the given angle about the X axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a quaternion by the given angle about the Y axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a quaternion by the given angle about the Z axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Calculates the W component of a quat from the X, Y, and Z components. - * Assumes that quaternion is 1 unit in length. - * Any existing W component will be ignored. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate W component of - * @returns {quat} out - */ parcelHelpers.export(exports, "calculateW", ()=>calculateW); -/** - * Calculate the exponential of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "exp", ()=>exp); -/** - * Calculate the natural logarithm of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "ln", ()=>ln); -/** - * Calculate the scalar power of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @param {Number} b amount to scale the quaternion by - * @returns {quat} out - */ parcelHelpers.export(exports, "pow", ()=>pow); -/** - * Performs a spherical linear interpolation between two quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {quat} out - */ parcelHelpers.export(exports, "slerp", ()=>slerp); -/** - * Generates a random unit quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Calculates the inverse of a quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate inverse of - * @returns {quat} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate conjugate of - * @returns {quat} out - */ parcelHelpers.export(exports, "conjugate", ()=>conjugate); -/** - * Creates a quaternion from the given 3x3 rotation matrix. - * - * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyMat3} m rotation matrix - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromMat3", ()=>fromMat3); -/** - * Creates a quaternion from the given euler angle x, y, z. - * - * @param {quat} out the receiving quaternion - * @param {x} Angle to rotate around X axis in degrees. - * @param {y} Angle to rotate around Y axis in degrees. - * @param {z} Angle to rotate around Z axis in degrees. - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromEuler", ()=>fromEuler); -/** - * Returns a string representation of a quatenion - * - * @param {ReadonlyQuat} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "fromValues", ()=>fromValues); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "set", ()=>set); -parcelHelpers.export(exports, "add", ()=>add); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "dot", ()=>dot); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "length", ()=>length); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "normalize", ()=>normalize); -parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "rotationTo", ()=>rotationTo); -parcelHelpers.export(exports, "sqlerp", ()=>sqlerp); -parcelHelpers.export(exports, "setAxes", ()=>setAxes); -var _commonJs = require("./common.js"); -var _mat3Js = require("./mat3.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; + getGrouping() { + return this.binX.fields.concat(this.binY.fields); + } + build() { + const { binX, binY, names, prefix, props } = this; + const { axisTextColor, colRowTitles, globalScope, parentScope } = props; + const titles = { x: { dataName: null, quantitative: null }, y: { dataName: null, quantitative: null } }; + const dx = { + dim: "x", + bin: binX, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutWidth, + layout: parentScope.sizeSignals.layoutWidth, + min: globalScope.signals.minCellWidth.name, + out: globalScope.signals.plotWidthOut, + offset: SignalNames.FacetPaddingLeft, + padding: SignalNames.FacetPaddingLeft, + dataOut: null, + scaleName: null, + position: null + }; + const dy = { + dim: "y", + bin: binY, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutHeight, + layout: parentScope.sizeSignals.layoutHeight, + min: globalScope.signals.minCellHeight.name, + out: globalScope.signals.plotHeightOut, + offset: SignalNames.FacetPaddingTop, + padding: `(${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})`, + dataOut: null, + scaleName: null, + position: null + }; + const dimensions = [dx, dy]; + dimensions.forEach((d2) => { + const { bin: bin2, dim, padding: padding2, sortOrder } = d2; + let data2; + let dataName; + let countSignal; + let scale2; + const titleSource = titles[dim]; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + addTransforms(bin2.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, + as: FieldNames.Contains + }); + data2 = bin2.dataSequence; + dataName = bin2.dataSequence.name; + countSignal = `length(data(${JSON.stringify(dataName)}))`; + scale2 = ordinalScale(dataName, `${names.dimScale}_${dim}`, bin2.fields); + titleSource.dataName = bin2.dataSequence.name; + } else { + dataName = globalScope.markDataName; + const ord = createOrdinals(dataName, `${prefix}_${dim}`, bin2.fields, sortOrder); + data2 = ord.data; + addData(globalScope.scope, ord.data); + countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; + scale2 = ord.scale; + titleSource.dataName = ord.data.name; + } + titleSource.quantitative = bin2.discreteColumn.column.quantitative; + d2.dataOut = data2; + d2.scaleName = scale2.name; + addTransforms(data2, { + type: "formula", + expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch + }, { + type: "formula", + expr: displayBin(bin2), + as: FieldNames.FacetTitle + }); + addScales(globalScope.scope, scale2); + const count2 = `${names.dimCount}_${dim}`; + const calc = `${names.dimCellSizeCalc}_${dim}`; + const size = `${names.dimCellSize}_${dim}`; + addSignals(globalScope.scope, { name: count2, update: countSignal }); + addSignals(globalScope.scope, { + name: calc, + update: `${d2.layout} / ${count2}` + }, { + name: size, + update: `max(${d2.min}, (${calc} - ${padding2}))` + }); + modifySignal(d2.out, "max", `((${size} + ${padding2}) * ${count2})`); + d2.position = this.dimensionOffset(d2); + }); + const groupRow = { + type: "group", + encode: { + update: { + y: { + signal: dy.position + } + } + }, + from: { + data: dy.dataOut.name + }, + data: [ + { + name: names.searchUnion, + source: dx.dataOut.name, + transform: [ + { + type: "formula", + expr: `[datum[${JSON.stringify(FieldNames.FacetSearch)}], merge(parent[${JSON.stringify(FieldNames.FacetSearch)}], { clause: '&&'})]`, + as: FieldNames.FacetSearch + } + ] + } + ] + }; + const groupCol = { + style: "cell", + name: prefix, + type: "group", + encode: { + update: { + height: { + signal: `${names.dimCellSize}_y` + }, + width: { + signal: `${names.dimCellSize}_x` + }, + x: { + signal: dx.position + } + } + }, + from: { + data: names.searchUnion + } + }; + addMarks(globalScope.markGroup, groupRow); + addMarks(groupRow, groupCol); + const offsets2 = { + x: this.dimensionOffset(dx), + y: this.dimensionOffset(dy), + h: `${names.dimCellSize}_y`, + w: `${names.dimCellSize}_x` + }; + const sizeSignals = { + layoutHeight: `${names.dimCellSize}_y`, + layoutWidth: `${names.dimCellSize}_x`, + colCount: `${names.dimCount}_x`, + rowCount: `${names.dimCount}_y` + }; + if (colRowTitles) { + addFacetColRowTitles(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); + } + return { + facetScope: groupCol, + offsets: offsets2, + sizeSignals, + titles + }; + } + dimensionOffset(d2) { + const { names } = this; + return `${d2.offset} + (scale(${JSON.stringify(d2.scaleName)}, datum[${JSON.stringify(d2.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d2.dim} + ${d2.padding})`; + } + }; + let Scatter$1 = class Scatter extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `scatter_${this.id}`; + this.names = { + aggregateData: `data_${p}_aggregate`, + markData: `data_${p}_mark`, + xDataExtent: `${p}_xDataExtent`, + yDataExtent: `${p}_yDataExtent`, + xExtent: `${p}_xExtent`, + yExtent: `${p}_yExtent`, + sizeExtent: `${p}_sizeExtent`, + sizeRange: `${p}_sizeRange`, + sizeScale: `${p}_sizeScale`, + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + zScale: `scale_${p}_z` + }; } - out[3] = 1; - return out; -} -function identity(out) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; -} -function setAxisAngle(out, axis, rad) { - rad = rad * 0.5; - var s = Math.sin(rad); - out[0] = s * axis[0]; - out[1] = s * axis[1]; - out[2] = s * axis[2]; - out[3] = Math.cos(rad); - return out; -} -function getAxisAngle(out_axis, q) { - var rad = Math.acos(q[3]) * 2.0; - var s = Math.sin(rad / 2.0); - if (s > _commonJs.EPSILON) { - out_axis[0] = q[0] / s; - out_axis[1] = q[1] / s; - out_axis[2] = q[2] / s; - } else { - // If s is zero, return any axis (no rotation - axis does not matter) - out_axis[0] = 1; - out_axis[1] = 0; - out_axis[2] = 0; - } - return rad; -} -function getAngle(a, b) { - var dotproduct = dot(a, b); - return Math.acos(2 * dotproduct * dotproduct - 1); -} -function multiply(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - out[0] = ax * bw + aw * bx + ay * bz - az * by; - out[1] = ay * bw + aw * by + az * bx - ax * bz; - out[2] = az * bw + aw * bz + ax * by - ay * bx; - out[3] = aw * bw - ax * bx - ay * by - az * bz; - return out; -} -function rotateX(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + aw * bx; - out[1] = ay * bw + az * bx; - out[2] = az * bw - ay * bx; - out[3] = aw * bw - ax * bx; - return out; -} -function rotateY(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var by = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw - az * by; - out[1] = ay * bw + aw * by; - out[2] = az * bw + ax * by; - out[3] = aw * bw - ay * by; - return out; -} -function rotateZ(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bz = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + ay * bz; - out[1] = ay * bw - ax * bz; - out[2] = az * bw + aw * bz; - out[3] = aw * bw - az * bz; - return out; -} -function calculateW(out, a) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); - return out; -} -function exp(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var et = Math.exp(w); - var s = r > 0 ? et * Math.sin(r) / r : 0; - out[0] = x * s; - out[1] = y * s; - out[2] = z * s; - out[3] = et * Math.cos(r); - return out; -} -function ln(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var t = r > 0 ? Math.atan2(r, w) / r : 0; - out[0] = x * t; - out[1] = y * t; - out[2] = z * t; - out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); - return out; -} -function pow(out, a, b) { - ln(out, a); - scale(out, out, b); - exp(out, out); - return out; -} -function slerp(out, a, b, t) { - // benchmarks: - // http://jsperf.com/quaternion-slerp-implementations - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - var omega, cosom, sinom, scale0, scale1; // calc cosine - cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) - if (cosom < 0.0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } // calculate coefficients - if (1.0 - cosom > _commonJs.EPSILON) { - // standard case (slerp) - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } else { - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - scale0 = 1.0 - t; - scale1 = t; - } // calculate final values - out[0] = scale0 * ax + scale1 * bx; - out[1] = scale0 * ay + scale1 * by; - out[2] = scale0 * az + scale1 * bz; - out[3] = scale0 * aw + scale1 * bw; - return out; -} -function random(out) { - // Implementation of http://planning.cs.uiuc.edu/node198.html - // TODO: Calling random 3 times is probably not the fastest solution - var u1 = _commonJs.RANDOM(); - var u2 = _commonJs.RANDOM(); - var u3 = _commonJs.RANDOM(); - var sqrt1MinusU1 = Math.sqrt(1 - u1); - var sqrtU1 = Math.sqrt(u1); - out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); - out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); - out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); - out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); - return out; -} -function invert(out, a) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - out[0] = -a0 * invDot; - out[1] = -a1 * invDot; - out[2] = -a2 * invDot; - out[3] = a3 * invDot; - return out; -} -function conjugate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a[3]; - return out; -} -function fromMat3(out, m) { - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var fTrace = m[0] + m[4] + m[8]; - var fRoot; - if (fTrace > 0.0) { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w - out[3] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; // 1/(4w) - out[0] = (m[5] - m[7]) * fRoot; - out[1] = (m[6] - m[2]) * fRoot; - out[2] = (m[1] - m[3]) * fRoot; - } else { - // |w| <= 1/2 - var i = 0; - if (m[4] > m[0]) i = 1; - if (m[8] > m[i * 3 + i]) i = 2; - var j = (i + 1) % 3; - var k = (i + 2) % 3; - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; - out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + build() { + const { names, prefix, props } = this; + const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x: x2, y: y2, z: z2, zGrounded } = props; + const qsize = size && size.quantitative && size; + addSignals(globalScope.scope, { + name: SignalNames.PointScale, + value: 5, + bind: { + name: scatterPointScaleDisplay, + debounce: debounce$1, + input: "range", + min: 1, + max: 10, + step: 0.1 + } + }, { + name: SignalNames.ZGrounded, + value: false, + bind: { + name: zGrounded, + input: "checkbox" + } + }); + if (backgroundImageExtents) { + addTransforms(globalScope.data, dataExtent(x2, names.xDataExtent), dataExtent(y2, names.yDataExtent)); + const xSignal = outerExtentSignal(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); + const ySignal = outerExtentSignal(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); + addSignals(globalScope.scope, xSignal, ySignal); + } + if (qsize) { + addTransforms(globalScope.data, { + type: "extent", + field: safeFieldName(qsize.name), + signal: names.sizeExtent + }); + addScales(globalScope.scope, { + name: names.sizeScale, + type: "pow", + exponent: 0.5, + domain: [0, { signal: `${names.sizeExtent}[1]` }], + range: [0, { signal: names.sizeRange }] + }); + addSignals(globalScope.scope, { + name: names.sizeRange, + update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${scatterSizedDiv}` + }); + } + addData(globalScope.scope, { + name: names.markData, + source: globalScope.markDataName, + transform: [x2, y2, z2].map((c2) => { + if (!c2 || !c2.quantitative) + return; + const t = { + type: "filter", + expr: `isValid(datum[${JSON.stringify(c2.name)}])` + }; + return t; + }).filter(Boolean) + }); + globalScope.setMarkDataName(names.markData); + const globalScales = { showAxes, scales: {} }; + const zValue = z2 ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z2.name)}])` : null; + const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${SignalNames.PointScale}` : SignalNames.PointScale; + const update2 = Object.assign({ height: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: sizeValueSignal + } + ], width: { + signal: sizeValueSignal + } }, z2 && { + z: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` + } + ], + zindex: [ + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` + } + ], + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: view === "3d" ? `${SignalNames.ZGrounded} ? ${zValue} : ${sizeValueSignal}` : "0" + } + ] + }); + const columnSignals = [ + { + column: x2, + xyz: "x", + scaleName: names.xScale, + domain: backgroundImageExtents ? { + signal: names.xExtent + } : { + data: globalScope.data.name, + field: safeFieldName(x2.name) + }, + reverse: false, + signal: parentScope.sizeSignals.layoutWidth + }, + { + column: y2, + xyz: "y", + scaleName: names.yScale, + domain: backgroundImageExtents ? { + signal: names.yExtent + } : { + data: globalScope.data.name, + field: safeFieldName(y2.name) + }, + reverse: true, + signal: parentScope.sizeSignals.layoutHeight + }, + { + column: z2, + xyz: "z", + scaleName: names.zScale, + domain: { + data: globalScope.data.name, + field: z2 ? safeFieldName(z2.name) : null + }, + reverse: false, + signal: view === "3d" ? `(${globalScope.zSize}) * ${SignalNames.ZProportion}` : `10 * ${SignalNames.ZProportion}` + } + ]; + columnSignals.forEach((cs) => { + const { column, domain: domain2, reverse: reverse2, scaleName, signal, xyz } = cs; + if (!column) + return; + let scale2; + if (column.quantitative) { + scale2 = linearScale(scaleName, domain2, [0, { signal }], reverse2, false, showAxes); + if (shouldBeIntegralBinStep(column)) { + scale2.bins = { step: 1 }; + } + } else { + scale2 = pointScale(scaleName, globalScope.data.name, [0, { signal }], column.name, reverse2); + } + globalScales.scales[xyz] = [scale2]; + }); + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { update: update2 } + }; + addMarks(globalScope.markGroup, mark); + return { + offsets: { + x: addOffsets(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x2.name)}])`), + y: addOffsets(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y2.name)}]) - ${sizeValueSignal}`), + h: sizeValueSignal, + w: sizeValueSignal + }, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + globalScales, + mark, + encodingRuleMap: { + y: [ + { + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) + } + ] + } + }; } - return out; -} -function fromEuler(out, x, y, z) { - var halfToRad = 0.5 * Math.PI / 180.0; - x *= halfToRad; - y *= halfToRad; - z *= halfToRad; - var sx = Math.sin(x); - var cx = Math.cos(x); - var sy = Math.sin(y); - var cy = Math.cos(y); - var sz = Math.sin(z); - var cz = Math.cos(z); - out[0] = sx * cy * cz - cx * sy * sz; - out[1] = cx * sy * cz + sx * cy * sz; - out[2] = cx * cy * sz - sx * sy * cz; - out[3] = cx * cy * cz + sx * sy * sz; - return out; -} -function str(a) { - return "quat(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -var clone = _vec4Js.clone; -var fromValues = _vec4Js.fromValues; -var copy = _vec4Js.copy; -var set = _vec4Js.set; -var add = _vec4Js.add; -var mul = multiply; -var scale = _vec4Js.scale; -var dot = _vec4Js.dot; -var lerp = _vec4Js.lerp; -var length = _vec4Js.length; -var len = length; -var squaredLength = _vec4Js.squaredLength; -var sqrLen = squaredLength; -var normalize = _vec4Js.normalize; -var exactEquals = _vec4Js.exactEquals; -var equals = _vec4Js.equals; -var rotationTo = function() { - var tmpvec3 = _vec3Js.create(); - var xUnitVec3 = _vec3Js.fromValues(1, 0, 0); - var yUnitVec3 = _vec3Js.fromValues(0, 1, 0); - return function(out, a, b) { - var dot = _vec3Js.dot(a, b); - if (dot < -0.999999) { - _vec3Js.cross(tmpvec3, xUnitVec3, a); - if (_vec3Js.len(tmpvec3) < 0.000001) _vec3Js.cross(tmpvec3, yUnitVec3, a); - _vec3Js.normalize(tmpvec3, tmpvec3); - setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; + }; + function addZScale(z2, zSize, dataName, zScaleName) { + if (z2) { + const zRange = [0, { signal: `(${zSize}) * ${SignalNames.ZProportion}` }]; + const scale2 = z2.quantitative ? linearScale(zScaleName, { + data: dataName, + field: safeFieldName(z2.name) + }, zRange, false, true) : pointScale(zScaleName, dataName, zRange, z2.name, false); + return scale2; + } + } + class Square extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `square_${this.id}`; + this.names = { + bandWidth: this.getBandWidth(), + maxGroupField: `${p}_max_group`, + maxGroupSignal: `${p}_max_grouping`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, prefix, props } = this; + const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z: z2 } = props; + const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); + addTransforms(globalScope.data, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sortBy && { + sort: { + field: safeFieldName(sortBy.name), + order: "ascending" + } + })); + const { gap, levelSize, size, squaresPerBand } = this.addSignals(); + const heightSignal = { + signal: fillDirection === "down-right" ? size : levelSize + }; + const mark = { + name: prefix, + type: "rect", + from: { + data: globalScope.markDataName + }, + encode: { + update: Object.assign({ height: collapseYHeight ? [ + { + test: testForCollapseSelection(), + value: 0 + }, + heightSignal + ] : heightSignal, width: { + signal: fillDirection === "down-right" ? levelSize : size + } }, z2 && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z2.name) + } : { + value: 0 + } + ] + }) + } + }; + addMarks(globalScope.markGroup, mark); + const { tx: tx2, ty: ty2 } = this.transformXY(gap, levelSize, squaresPerBand); + return Object.assign(Object.assign(Object.assign({}, z2 && { + globalScales: { + showAxes, + scales: { + z: [zScale] + } + } + }), { offsets: { + x: addOffsets(parentScope.offsets.x, tx2.expr), + y: addOffsets(parentScope.offsets.y, ty2.expr), + h: size, + w: size + }, mark, sizeSignals: { + layoutHeight: size, + layoutWidth: size + } }), collapseYHeight && { + encodingRuleMap: { + y: [ + { + test: testForCollapseSelection(), + signal: parentScope.offsets.y + } + ] + } + }); + } + getBandWidth() { + const { offsets: offsets2 } = this.props.parentScope; + switch (this.props.fillDirection) { + case "down-right": + return offsets2.h; + default: + return offsets2.w; + } + } + addSignals() { + const { names, props } = this; + const { fillDirection, globalScope, groupings, parentScope } = props; + let { maxGroupedFillSize, maxGroupedUnits } = props; + if (!maxGroupedUnits) { + if (groupings) { + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.maxGroupField] + }, { + type: "extent", + field: names.maxGroupField, + signal: names.maxGroupSignal + }); + maxGroupedUnits = `(${names.maxGroupSignal}[1])`; } else { - _vec3Js.cross(tmpvec3, a, b); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot; - return normalize(out, out); - } - }; -}(); -var sqlerp = function() { - var temp1 = create(); - var temp2 = create(); - return function(out, a, b, c, d, t) { - slerp(temp1, a, d, t); - slerp(temp2, b, c, t); - slerp(out, temp1, temp2, 2 * t * (1 - t)); - return out; - }; -}(); -var setAxes = function() { - var matr = _mat3Js.create(); - return function(out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - return normalize(out, fromMat3(out, matr)); - }; -}(); - -},{"./common.js":"7GML7","./mat3.js":"80EZI","./vec3.js":"9zs5l","./vec4.js":"ao75m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9zs5l":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3 Dimensional Vector - * @module vec3 - */ /** - * Creates a new, empty vec3 - * - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec3 initialized with values from an existing vector - * - * @param {ReadonlyVec3} a vector to clone - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Calculates the length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Creates a new vec3 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec3 to another - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the source vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec3 to the given values - * - * @param {vec3} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to ceil - * @returns {vec3} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to floor - * @returns {vec3} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to round - * @returns {vec3} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec3 by a scalar number - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec3} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec3} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the squared length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to negate - * @returns {vec3} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to invert - * @returns {vec3} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to normalize - * @returns {vec3} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Performs a hermite interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "hermite", ()=>hermite); -/** - * Performs a bezier interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "bezier", ()=>bezier); -/** - * Generates a random vector with the given scale - * - * @param {vec3} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec3} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec3 with a mat3. - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat3} m the 3x3 matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec3 with a quat - * Can also be used for dual quaternions. (Multiply it with the real part) - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Rotate a 3D vector around the x-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotate a 3D vector around the y-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotate a 3D vector around the z-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Get the angle between two 3D vectors - * @param {ReadonlyVec3} a The first operand - * @param {ReadonlyVec3} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec3 to zero - * - * @param {vec3} out the receiving vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec3} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(3); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; + maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; + } + } + if (!maxGroupedFillSize) { + maxGroupedFillSize = fillDirection === "down-right" ? parentScope.offsets.w : parentScope.offsets.h; + } + const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; + const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; + const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; + const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; + const levels2 = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; + const levelSize = `(((${maxGroupedFillSize}) / ${levels2}) - ${gap})`; + return { gap, levelSize, size, squaresPerBand }; } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return Math.hypot(x, y, z); -} -function fromValues(x, y, z) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function set(out, x, y, z) { - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return Math.hypot(x, y, z); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return x * x + y * y + z * z; -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return x * x + y * y + z * z; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var len = x * x + y * y + z * z; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cross(out, a, b) { - var ax = a[0], ay = a[1], az = a[2]; - var bx = b[0], by = b[1], bz = b[2]; - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - return out; -} -function hermite(out, a, b, c, d, t) { - var factorTimes2 = t * t; - var factor1 = factorTimes2 * (2 * t - 3) + 1; - var factor2 = factorTimes2 * (t - 2) + t; - var factor3 = factorTimes2 * (t - 1); - var factor4 = factorTimes2 * (3 - 2 * t); - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function bezier(out, a, b, c, d, t) { - var inverseFactor = 1 - t; - var inverseFactorTimesTwo = inverseFactor * inverseFactor; - var factorTimes2 = t * t; - var factor1 = inverseFactorTimesTwo * inverseFactor; - var factor2 = 3 * t * inverseFactorTimesTwo; - var factor3 = 3 * factorTimes2 * inverseFactor; - var factor4 = factorTimes2 * t; - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - var z = _commonJs.RANDOM() * 2.0 - 1.0; - var zScale = Math.sqrt(1.0 - z * z) * scale; - out[0] = Math.cos(r) * zScale; - out[1] = Math.sin(r) * zScale; - out[2] = z * scale; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - var w = m[3] * x + m[7] * y + m[11] * z + m[15]; - w = w || 1.0; - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x * m[0] + y * m[3] + z * m[6]; - out[1] = x * m[1] + y * m[4] + z * m[7]; - out[2] = x * m[2] + y * m[5] + z * m[8]; - return out; -} -function transformQuat(out, a, q) { - // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; - var x = a[0], y = a[1], z = a[2]; // var qvec = [qx, qy, qz]; - // var uv = vec3.cross([], qvec, a); - var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); - var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; // vec3.scale(uuv, uuv, 2); - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; - return out; -} -function rotateX(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateY(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateZ(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function angle(a, b) { - var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b) / mag; - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - return out; -} -function str(a) { - return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2]; - var b0 = b[0], b1 = b[1], b2 = b[2]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 3; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - } - return a; - }; -}(); - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ao75m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4 Dimensional Vector - * @module vec4 - */ /** - * Creates a new, empty vec4 - * - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec4 initialized with values from an existing vector - * - * @param {ReadonlyVec4} a vector to clone - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec4 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec4 to another - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the source vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec4 to the given values - * - * @param {vec4} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to ceil - * @returns {vec4} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to floor - * @returns {vec4} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to round - * @returns {vec4} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec4 by a scalar number - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec4} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec4's after scaling the second operand by a scalar value - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec4} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to negate - * @returns {vec4} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to invert - * @returns {vec4} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to normalize - * @returns {vec4} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Returns the cross-product of three vectors in a 4-dimensional space - * - * @param {ReadonlyVec4} result the receiving vector - * @param {ReadonlyVec4} U the first vector - * @param {ReadonlyVec4} V the second vector - * @param {ReadonlyVec4} W the third vector - * @returns {vec4} result - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec4} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec4} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec4} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec4 with a mat4. - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec4 with a quat - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Set the components of a vec4 to zero - * - * @param {vec4} out the receiving vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec4} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; + transformXY(gap, levelSize, squaresPerBand) { + const { names, prefix } = this; + const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; + const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; + const { fillDirection, parentScope } = this.props; + const tx2 = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetX}` + }; + const ty2 = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetY}` + }; + switch (fillDirection) { + case "down-right": { + tx2.expr = `${level} * (${levelSize} + ${gap})`; + ty2.expr = compartment; + break; + } + case "right-up": { + tx2.expr = compartment; + ty2.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; + break; + } + case "right-down": + default: { + tx2.expr = compartment; + ty2.expr = `${level} * (${levelSize} + ${gap})`; + break; + } + } + return { tx: tx2, ty: ty2 }; } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function fromValues(x, y, z, w) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function set(out, x, y, z, w) { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - out[3] = a[3] * b[3]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - out[3] = a[3] / b[3]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - out[3] = Math.ceil(a[3]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - out[3] = Math.floor(a[3]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - out[3] = Math.min(a[3], b[3]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - out[3] = Math.max(a[3], b[3]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - out[3] = Math.round(a[3]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return Math.hypot(x, y, z, w); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return x * x + y * y + z * z + w * w; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return Math.hypot(x, y, z, w); -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return x * x + y * y + z * z + w * w; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = -a[3]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - out[3] = 1.0 / a[3]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - var len = x * x + y * y + z * z + w * w; - if (len > 0) len = 1 / Math.sqrt(len); - out[0] = x * len; - out[1] = y * len; - out[2] = z * len; - out[3] = w * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; -} -function cross(out, u, v, w) { - var A = v[0] * w[1] - v[1] * w[0], B = v[0] * w[2] - v[2] * w[0], C = v[0] * w[3] - v[3] * w[0], D = v[1] * w[2] - v[2] * w[1], E = v[1] * w[3] - v[3] * w[1], F = v[2] * w[3] - v[3] * w[2]; - var G = u[0]; - var H = u[1]; - var I = u[2]; - var J = u[3]; - out[0] = H * F - I * E + J * D; - out[1] = -(G * F) + I * C - J * B; - out[2] = G * E - H * C + J * A; - out[3] = -(G * D) + H * B - I * A; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - var aw = a[3]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - out[3] = aw + t * (b[3] - aw); - return out; -} -function random(out, scale) { - scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a - // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. - // http://projecteuclid.org/euclid.aoms/1177692644; - var v1, v2, v3, v4; - var s1, s2; - do { - v1 = _commonJs.RANDOM() * 2 - 1; - v2 = _commonJs.RANDOM() * 2 - 1; - s1 = v1 * v1 + v2 * v2; - }while (s1 >= 1); - do { - v3 = _commonJs.RANDOM() * 2 - 1; - v4 = _commonJs.RANDOM() * 2 - 1; - s2 = v3 * v3 + v4 * v4; - }while (s2 >= 1); - var d = Math.sqrt((1 - s1) / s2); - out[0] = scale * v1; - out[1] = scale * v2; - out[2] = scale * v3 * d; - out[3] = scale * v4 * d; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return out; -} -function transformQuat(out, a, q) { - var x = a[0], y = a[1], z = a[2]; - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; - out[3] = a[3]; - return out; -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - return out; -} -function str(a) { - return "vec4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 4; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - vec[3] = a[i + 3]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - a[i + 3] = vec[3]; - } - return a; - }; -}(); - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eovGI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 2 Dimensional Vector - * @module vec2 - */ /** - * Creates a new, empty vec2 - * - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec2 initialized with values from an existing vector - * - * @param {ReadonlyVec2} a vector to clone - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec2 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec2 to another - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the source vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec2 to the given values - * - * @param {vec2} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to ceil - * @returns {vec2} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to floor - * @returns {vec2} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to round - * @returns {vec2} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec2 by a scalar number - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec2} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec2's after scaling the second operand by a scalar value - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec2} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to negate - * @returns {vec2} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to invert - * @returns {vec2} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to normalize - * @returns {vec2} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec2's - * Note that the cross product must by definition produce a 3D vector - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec2} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec2} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec2} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec2 with a mat2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2", ()=>transformMat2); -/** - * Transforms the vec2 with a mat2d - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2d} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2d", ()=>transformMat2d); -/** - * Transforms the vec2 with a mat3 - * 3rd vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat3} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec2 with a mat4 - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Rotate a 2D vector - * @param {vec2} out The receiving vec2 - * @param {ReadonlyVec2} a The vec2 point to rotate - * @param {ReadonlyVec2} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec2} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Get the angle between two 2D vectors - * @param {ReadonlyVec2} a The first operand - * @param {ReadonlyVec2} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec2 to zero - * - * @param {vec2} out the receiving vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec2} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(2); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; + } + let Stack$1 = class Stack extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `stack_${this.id}`; + this.names = { + cube: `${p}_cube`, + globalDataName: `data_${p}_count`, + globalExtent: `${p}_global_extent`, + levelDataName: `data_${p}_level`, + count: `${p}_count`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + sequence: `data_${p}_sequence`, + sides: `${p}_sides`, + size: `${p}_size`, + squared: `${p}_squared`, + maxCount: `${p}_maxCount`, + maxLevels: `${p}_maxLevels`, + zScale: `${p}_zScale` + }; } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function fromValues(x, y) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = x; - out[1] = y; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function set(out, x, y) { - out[0] = x; - out[1] = y; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return Math.hypot(x, y); -} -function squaredDistance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return x * x + y * y; -} -function length(a) { - var x = a[0], y = a[1]; - return Math.hypot(x, y); -} -function squaredLength(a) { - var x = a[0], y = a[1]; - return x * x + y * y; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - return out; -} -function normalize(out, a) { - var x = a[0], y = a[1]; - var len = x * x + y * y; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1]; -} -function cross(out, a, b) { - var z = a[0] * b[1] - a[1] * b[0]; - out[0] = out[1] = 0; - out[2] = z; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0], ay = a[1]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - out[0] = Math.cos(r) * scale; - out[1] = Math.sin(r) * scale; - return out; -} -function transformMat2(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y; - out[1] = m[1] * x + m[3] * y; - return out; -} -function transformMat2d(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y + m[4]; - out[1] = m[1] * x + m[3] * y + m[5]; - return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[3] * y + m[6]; - out[1] = m[1] * x + m[4] * y + m[7]; - return out; -} -function transformMat4(out, a, m) { - var x = a[0]; - var y = a[1]; - out[0] = m[0] * x + m[4] * y + m[12]; - out[1] = m[1] * x + m[5] * y + m[13]; - return out; -} -function rotate(out, a, b, rad) { - //Translate point to the origin - var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); //perform rotation and translate to correct position - out[0] = p0 * cosC - p1 * sinC + b[0]; - out[1] = p0 * sinC + p1 * cosC + b[1]; - return out; -} -function angle(a, b) { - var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], // mag is the product of the magnitudes of a and b - mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), // mag &&.. short circuits if mag == 0 - cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - return out; -} -function str(a) { - return "vec2(" + a[0] + ", " + a[1] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1]; - var b0 = b[0], b1 = b[1]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)); -} -var len = length; -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 2; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - } - return a; - }; -}(); - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gRqOf":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>AltAzimuthCameraView); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>AltAzimuthCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _cameraJs = require("./camera.js"); -class AltAzimuthCameraView extends (0, _cameraJs.CameraView) { - constructor(core){ - super(core); - this.fov = core.config.fov; - this.altitude = 0; - this.azimuth = 0; - } -} -class AltAzimuthCamera extends (0, _cameraJs.CameraBase) { - getView(view) { - super.getView(view); - view.altitude = this.altitude; - view.azimuth = this.azimuth; - view.fov = this._core.config.fov; + build() { + const { names, props } = this; + const { globalScope, groupings, parentScope, showAxes, sort: sort2 } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.count] + }, { + type: "extent", + field: names.count, + signal: names.globalExtent + }, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sort2 && { + sort: { + field: safeFieldName(sort2.name), + order: "ascending" + } + })); + addData(globalScope.scope, { + name: names.sequence, + transform: [ + { + type: "sequence", + start: 1, + stop: { + signal: `sqrt(${names.globalExtent}[1])` + } + }, + { + type: "formula", + expr: "datum.data * datum.data", + as: "squared" + }, + { + type: "formula", + expr: `ceil(${names.globalExtent}[1] / datum.squared)`, + as: "maxlevels" + }, + { + type: "formula", + expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, + as: "side" + }, + { + type: "formula", + expr: "datum.side * datum.maxlevels + datum.maxlevels - 1", + as: "sidecubeheight" + }, + { + type: "formula", + expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, + as: "heightmatch" + }, + { + type: "collect", + sort: { + field: "heightmatch", + order: "ascending" + } + }, + { + type: "window", + ops: ["row_number"] + }, + { + type: "filter", + expr: "datum.row_number === 1" + } + ] + }); + addSignals(globalScope.scope, { + name: names.size, + update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` + }, { + name: names.squared, + update: `data('${names.sequence}')[0].squared` + }, { + name: names.sides, + update: `sqrt(${names.squared})` + }, { + name: names.cube, + update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` + }, { + name: names.maxLevels, + update: `data('${names.sequence}')[0].maxlevels` + }, { + name: names.maxCount, + update: `${names.maxLevels} * ${names.squared}` + }); + const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; + const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; + const cubeX = `(${layerOrdinal} % ${names.sides})`; + const cubeY = `floor(${layerOrdinal} / ${names.sides})`; + const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; + const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; + const offsets2 = { + x: addOffsets(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), + y: addOffsets(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), + h: names.size, + w: names.size + }; + const mark = { + type: "rect", + from: { data: this.names.levelDataName }, + encode: { + update: { + z: { + signal: `${zLevel} * (${names.cube} + 1)` + }, + height: { + signal: names.cube + }, + width: { + signal: names.cube + }, + depth: { + signal: names.cube + } + } + } + }; + addMarks(globalScope.markGroup, mark); + const zScale = { + type: "linear", + name: names.zScale, + domain: [ + 0, + { + signal: names.maxCount + } + ], + range: [ + 0, + { + signal: `${names.maxLevels} * (${names.cube} + 1) - 1` + } + ], + nice: false + }; + return { + offsets: offsets2, + mark, + sizeSignals: { + layoutHeight: names.size, + layoutWidth: names.size + }, + globalScales: { + showAxes, + scales: { + z: [zScale] + } + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.y + }], + z: [{ + test: testForCollapseSelection(), + value: 0 + }], + depth: [{ + test: testForCollapseSelection(), + value: 0 + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; } - setView(view, isSmooth) { - super.setView(view, isSmooth); - this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); - this._core.config.fov = view.fov; + }; + class Strip extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `strip_${this.id}`; + this.names = { + firstField: `${p}${FieldNames.First}`, + lastField: `${p}${FieldNames.Last}`, + valueField: `${p}${FieldNames.Value}`, + scale: `scale_${p}`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, prefix, props } = this; + const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort: sort2, sortOrder, parentScope, view, z: z2 } = props; + const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); + const horizontal = orientation === "horizontal"; + const transform2 = []; + if (sort2) { + transform2.push({ + type: "collect", + sort: { + field: safeFieldName(sort2.name), + order: sortOrder + } + }); + } + let stackField; + if (size) { + stackField = size.name; + transform2.push({ + type: "filter", + expr: `datum[${JSON.stringify(size.name)}] > 0` + }); + } else { + stackField = names.valueField; + transform2.push({ + type: "formula", + expr: "1", + as: stackField + }); + } + const stackTransform = { + type: "stack", + field: safeFieldName(stackField), + offset: "normalize", + as: [names.firstField, names.lastField] + }; + if (groupings.length) { + stackTransform.groupby = getGroupBy(groupings).map(safeFieldName); + } + transform2.push(stackTransform); + addTransforms(globalScope.data, ...transform2); + const span2 = [names.lastField, names.firstField].map((f) => `datum[${JSON.stringify(f)}]`).join(" - "); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ""), + y: addOffsets(parentScope.offsets.y, horizontal ? "" : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), + h: horizontal ? parentScope.offsets.h : `(${span2}) * (${parentScope.offsets.h})`, + w: horizontal ? `(${span2}) * (${parentScope.offsets.w})` : parentScope.offsets.w + }; + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { + update: Object.assign({ height: { + signal: offsets2.h + }, width: { + signal: offsets2.w + } }, z2 && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z2.name) + } : { + value: 0 + } + ] + }) + } + }; + addMarks(globalScope.markGroup, mark); + let percentageScale; + if (addPercentageScale) { + percentageScale = [{ + type: "linear", + name: names.scale, + domain: [0, 100], + range: horizontal ? [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ] : [ + { + signal: parentScope.sizeSignals.layoutHeight + }, + 0 + ] + }]; + } + return { + globalScales: { + showAxes, + scales: { + x: horizontal ? percentageScale : void 0, + y: horizontal ? void 0 : percentageScale, + z: zScale && [zScale] + } + }, + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + mark + }; + } + } + let Treemap$1 = class Treemap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `treemap_${this.id}`; + this.names = { + dataName: `data_${p}`, + dataHeightWidth: `data_${p}_hw`, + dataExtents: `data_${p}_extents`, + dataFacet: `data_${p}_facet`, + dataFacetMark: `data_${p}_facetMark`, + fieldChildren: `${p}_children`, + fieldDepth: `${p}_depth`, + fieldX0: `${p}_x0`, + fieldX1: `${p}_x1`, + fieldY0: `${p}_y0`, + fieldY1: `${p}_y1`, + fieldHeight: `${p}_h`, + fieldWidth: `${p}_w`, + heightExtent: `${p}_heightExtent`, + widthExtent: `${p}_widthExtent`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, props } = this; + const { globalScope, parentScope, showAxes, treeMapMethod, z: z2 } = props; + const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, fn(names.fieldX0)), + y: addOffsets(parentScope.offsets.y, fn(names.fieldY0)), + h: subtract$1(names.fieldY1, names.fieldY0), + w: subtract$1(names.fieldX1, names.fieldX0) + }; + const mark = this.transformedMark(offsets2); + addSignals(globalScope.scope, { + name: SignalNames.TreeMapMethod, + value: "squarify", + bind: { + name: treeMapMethod, + input: "select", + options: [ + "squarify", + "binary" + ] + } + }); + return Object.assign(Object.assign({}, z2 && { + globalScales: { + showAxes, + scales: { + z: [zScale] + } + } + }), { + mark, + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + } + }); } - lerpView(from, to, time) { - super.lerpView(from, to, time); - this.setAltAzimuth((0, _mathJs.MathHelper).lerp(from.altitude, to.altitude, time), (0, _mathJs.MathHelper).lerp(from.azimuth, to.azimuth, time), false); - this._core.config.fov = (0, _mathJs.MathHelper).lerp(from.fov, to.fov, time); + transformedMark(offsets2) { + const { names, props } = this; + const { globalScope, groupings, parentScope } = props; + if (groupings.length) { + addData(globalScope.scope, { + name: names.dataHeightWidth, + source: globalScope.markDataName, + transform: [ + { + type: "formula", + expr: parentScope.offsets.h, + as: names.fieldHeight + }, + { + type: "formula", + expr: parentScope.offsets.w, + as: names.fieldWidth + } + ] + }); + const treemapData = { + name: names.dataFacetMark, + source: names.dataFacet + }; + const facets = { + type: "group", + from: { + facet: { + name: names.dataFacet, + data: names.dataHeightWidth, + groupby: getGroupBy(groupings).map(safeFieldName) + } + }, + data: [ + { + name: names.dataExtents, + source: names.dataFacet, + transform: [ + { + type: "extent", + field: names.fieldHeight, + signal: names.heightExtent + }, + { + type: "extent", + field: names.fieldWidth, + signal: names.widthExtent + } + ] + }, + treemapData + ] + }; + globalScope.setMarkDataName(names.dataFacetMark); + addMarks(globalScope.markGroup, facets); + globalScope.setMarkGroup(facets); + this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); + return this.addMark(offsets2, facets, globalScope.markDataName); + } else { + this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); + return this.addMark(offsets2, globalScope.markGroup, globalScope.markDataName); + } } - update(elapsedTime) { - super.update(elapsedTime); - if (this._core.config.isDebugVisible) { - const altitude = (0, _angleJs.AngleHelper).radiansToDegrees(this.altitude); - const azimuth = (0, _angleJs.AngleHelper).radiansToDegrees(this.azimuth); - this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); - this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + addMark(offsets2, markParent, markDataName) { + const { names, prefix, props } = this; + const { view, z: z2 } = props; + const mark = { + name: prefix, + type: "rect", + from: { data: markDataName }, + encode: { + update: Object.assign({ width: { + signal: offsets2.w + }, height: { + signal: offsets2.h + } }, z2 && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z2.name) + } : { + value: 0 + } + ] + }) } + }; + addMarks(markParent, mark); + return mark; } - get altitude() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITY, this._up, this._right); + treemapTransform(treemapData, widthSignal, heightSignal) { + const { names, props } = this; + const { group: group2, size } = props; + addTransforms(treemapData, { + type: "filter", + expr: `datum[${JSON.stringify(size.name)}] > 0` + }, { + type: "nest", + keys: [group2 && group2.name || "__NONE__"] + }, { + type: "treemap", + field: safeFieldName(size.name), + sort: { field: "value", order: "descending" }, + round: true, + method: { signal: SignalNames.TreeMapMethod }, + paddingInner: 1, + paddingOuter: 0, + size: [ + { signal: widthSignal }, + { signal: heightSignal } + ], + as: [ + names.fieldX0, + names.fieldY0, + names.fieldX1, + names.fieldY1, + names.fieldDepth, + names.fieldChildren + ] + }); } - get azimuth() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITX, this._right, this._up); + }; + function fn(n) { + return `datum[${JSON.stringify(n)}]`; + } + function subtract$1(...fields) { + return fields.map((n) => fn(n)).join(" - "); + } + class Wrap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `wrap_${this.id}`; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby); + this.names = { + outputData: `data_${p}_out`, + rowColumnDataName: `data_${p}_row_col`, + cellHeight: `${p}_cellHeight`, + cellWidth: `${p}_cellWidth`, + fits: `${p}_fits`, + target: `${p}_target`, + minArea: `${p}_minArea`, + aspect: `${p}_aspect`, + minAspect: `${p}_minAspect`, + idealAspect: `${p}_idealAspect`, + dataLength: `${p}_dataLength`, + rxc0: `${p}_rxc0`, + rxc1: `${p}_rxc1`, + rxc2: `${p}_rxc2`, + rxc: `${p}_rxc`, + growColCount: `${p}_growColCount`, + growCellWidth: `${p}_growCellWidth`, + fitsArea: `${p}_fitsArea`, + colCount: `${p}_colCount` + }; } - setAltAzimuth(altitude, azimuth, isSmooth) { - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, altitude); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, azimuth); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - if (!isSmooth) this.syncSmooth(); + getGrouping() { + return this.bin.fields; } - rotate(translationDelta) { - const length = Math.min(this.width, this.height); - let angle = translationDelta[1] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - angle = translationDelta[0] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/angle.js":"53hwW","../helpers/math.js":"f65d0","./camera.js":"h35rS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lD0bG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -var _glMatrix = require("gl-matrix"); -class Constants { -} -Constants.TWO_PI = 6.283185307179586; -Constants.PI = 3.141592653589793; -Constants.PI_OVER_TWO = 1.5707963267948966; -Constants.PI_OVER_THREE = 1.0471975511965976; -Constants.PI_OVER_FOUR = 0.7853981633974483; -Constants.PI_OVER_SIX = 0.5235987755982988; -Constants.LOG_2 = 0.6931471805599453; -Constants.RADIANS_PER_DEGREE = 0.017453292519943295; -Constants.DEGREES_PER_RADIAN = 57.29577951308232; -Constants.ROOT_TWO = 1.4142135623730951; -Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; -Constants.ROOT_THREE = 1.7320508075688772; -Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; -Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; -Constants.VECTOR2_ZERO = (0, _glMatrix.vec2).fromValues(0, 0); -Constants.VECTOR2_ONE = (0, _glMatrix.vec2).fromValues(1, 1); -Constants.VECTOR2_UNITX = (0, _glMatrix.vec2).fromValues(1, 0); -Constants.VECTOR2_UNITY = (0, _glMatrix.vec2).fromValues(0, 1); -Constants.VECTOR3_ZERO = (0, _glMatrix.vec3).fromValues(0, 0, 0); -Constants.VECTOR3_ONE = (0, _glMatrix.vec3).fromValues(1, 1, 1); -Constants.VECTOR3_UNITX = (0, _glMatrix.vec3).fromValues(1, 0, 0); -Constants.VECTOR3_UNITY = (0, _glMatrix.vec3).fromValues(0, 1, 0); -Constants.VECTOR3_UNITZ = (0, _glMatrix.vec3).fromValues(0, 0, 1); -Constants.VECTOR3_REFLECTX = (0, _glMatrix.vec3).fromValues(1, -1, -1); -Constants.VECTOR3_REFLECTY = (0, _glMatrix.vec3).fromValues(-1, 1, -1); -Constants.VECTOR3_REFLECTZ = (0, _glMatrix.vec3).fromValues(-1, -1, 1); -Constants.VECTOR4_ZERO = (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); -Constants.VECTOR4_ONE = (0, _glMatrix.vec4).fromValues(1, 1, 1, 1); -Constants.VECTOR4_UNITX = (0, _glMatrix.vec4).fromValues(1, 0, 0, 0); -Constants.VECTOR4_UNITY = (0, _glMatrix.vec4).fromValues(0, 1, 0, 0); -Constants.VECTOR4_UNITZ = (0, _glMatrix.vec4).fromValues(0, 0, 1, 0); -Constants.VECTOR4_UNITW = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); -Constants.MAT3_IDENTITY = (0, _glMatrix.mat3).create(); -Constants.MAT4_IDENTITY = (0, _glMatrix.mat4).create(); -Constants.MAT4_ROTATION_MINUS_90 = (0, _glMatrix.mat4).fromValues(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); -Constants.QUAT_IDENTITY = (0, _glMatrix.quat).create(); -Constants.QUAT_ROTATEX_PLUS_90 = (0, _glMatrix.quat).fromValues(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEX_MINUS_90 = (0, _glMatrix.quat).fromValues(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_PLUS_90 = (0, _glMatrix.quat).fromValues(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_MINUS_90 = (0, _glMatrix.quat).fromValues(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_PLUS_90 = (0, _glMatrix.quat).fromValues(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_MINUS_90 = (0, _glMatrix.quat).fromValues(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.MILLISECONDS_PER_DAY = 86400000; - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"53hwW":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>AngleHelper); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("./math.js"); -var _constantsJs = require("../constants.js"); -class AngleHelper { - static degreesToRadians(degrees) { - return degrees * (0, _constantsJs.Constants).RADIANS_PER_DEGREE; - } - static radiansToDegrees(radians) { - return radians * (0, _constantsJs.Constants).DEGREES_PER_RADIAN; - } - static wrapAngle(angle) { - if (angle > (0, _constantsJs.Constants).PI) angle = angle - (0, _constantsJs.Constants).TWO_PI; - else if (angle < -(0, _constantsJs.Constants).PI) angle += (0, _constantsJs.Constants).TWO_PI; - return angle; - } - static sphericalToCartesian(altitude, longitude, latitude, result) { - latitude = AngleHelper.degreesToRadians(latitude); - longitude = AngleHelper.degreesToRadians(longitude); - const scale = Math.cos(latitude); - result[0] = altitude * scale * Math.sin(longitude); - result[1] = altitude * Math.sin(latitude); - result[2] = altitude * scale * Math.cos(longitude); - } - static cartesianToSpherical(x, y, z, result) { - result[0] = Math.atan2(x, z); - result[1] = Math.asin(y); + build() { + const { bin: bin2, names, prefix, props } = this; + const { axisTextColor, cellTitles, globalScope, parentScope } = props; + let ordinalBinData; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + addTransforms(bin2.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, + as: FieldNames.Contains + }); + ordinalBinData = bin2.dataSequence.name; + } else { + const ord = createOrdinals(globalScope.data.name, prefix, bin2.fields, "ascending"); + addData(globalScope.scope, ord.data); + ordinalBinData = ord.data.name; + } + addData(globalScope.scope, { + name: names.rxc0, + transform: [ + { + type: "sequence", + start: 1, + stop: { + signal: `ceil(sqrt(${names.dataLength})) + 1` + } + }, + { + type: "formula", + expr: `ceil(${names.dataLength} / datum.data)`, + as: "complement" + } + ] + }, { + name: names.rxc1, + source: names.rxc0, + transform: [ + { + type: "project", + fields: ["data"], + as: ["cols"] + } + ] + }, { + name: names.rxc2, + source: names.rxc0, + transform: [ + { + type: "project", + fields: ["complement"], + as: ["cols"] + } + ] + }, { + name: names.rxc, + source: [names.rxc1, names.rxc2], + transform: [ + { + type: "formula", + expr: `ceil(${names.dataLength} / datum.cols)`, + as: "rows" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, + as: "cellw" + }, + { + type: "formula", + expr: `datum.cols === 1 ? max(datum.cellw, ${SignalNames.MinCellWidth}) : datum.cellw`, + as: "cellw" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, + as: "cellh" + }, + { + type: "formula", + expr: `datum.rows === 1 ? max(datum.cellh, ${SignalNames.MinCellHeight}) : datum.cellh`, + as: "cellh" + }, + { + type: "formula", + expr: `(datum.cellw >= ${SignalNames.MinCellWidth} && datum.cellh >= ${SignalNames.MinCellHeight})`, + as: "meetsmin" + }, + { + type: "filter", + expr: "datum.meetsmin" + }, + { + type: "formula", + expr: "datum.cellw / datum.cellh", + as: names.aspect + }, + { + type: "formula", + expr: `abs(datum.${names.aspect} - ${names.target})`, + as: names.idealAspect + }, + { + type: "formula", + expr: `${names.dataLength} / (datum.cols * datum.rows)`, + as: "coverage" + }, + { + type: "collect", + sort: { + field: [names.idealAspect, "coverage"], + order: ["ascending", "descending"] + } + } + ] + }, { + name: names.rowColumnDataName, + source: ordinalBinData, + transform: [ + { + type: "formula", + expr: `floor((datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) / ${names.colCount})`, + as: FieldNames.WrapRow + }, + { + type: "formula", + expr: `(datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) % ${names.colCount}`, + as: FieldNames.WrapCol + }, + { + type: "formula", + expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch + }, + { + type: "formula", + expr: displayBin(bin2), + as: FieldNames.FacetTitle + } + ] + }); + const dataOut = { + name: names.outputData, + source: globalScope.data.name, + transform: [ + { + type: "lookup", + from: names.rowColumnDataName, + key: safeFieldName(bin2.fields[0]), + fields: [bin2.fields[0]].map(safeFieldName), + values: [FieldNames.WrapRow, FieldNames.WrapCol] + } + ] + }; + addData(globalScope.scope, dataOut); + globalScope.setMarkDataName(names.outputData); + addSignals(globalScope.scope, { + name: names.minAspect, + update: `${SignalNames.MinCellWidth} / ${SignalNames.MinCellHeight}` + }, { + name: names.target, + update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}` + }, { + name: names.minArea, + update: `${SignalNames.MinCellWidth}*${SignalNames.MinCellHeight}` + }, { + name: names.aspect, + update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` + }, { + name: names.dataLength, + update: `data(${JSON.stringify(ordinalBinData)}).length` + }, { + name: names.growColCount, + update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${SignalNames.MinCellWidth}), 1)` + }, { + name: names.growCellWidth, + update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` + }, { + name: names.fitsArea, + update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` + }, { + name: names.fits, + update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` + }, { + name: names.colCount, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` + }, { + name: names.cellWidth, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` + }, { + name: names.cellHeight, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${SignalNames.MinCellHeight}` + }); + modifySignal(globalScope.signals.plotHeightOut, "max", `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); + modifySignal(globalScope.signals.plotWidthOut, "max", `(${names.cellWidth} * ${names.colCount})`); + const signalH = [names.cellHeight, SignalNames.FacetPaddingTop, SignalNames.FacetPaddingBottom].join(" - "); + const signalW = [names.cellWidth, SignalNames.FacetPaddingLeft].join(" - "); + const signalX = addOffsets(parentScope.offsets.x, `datum[${JSON.stringify(FieldNames.WrapCol)}] * ${names.cellWidth}`, SignalNames.FacetPaddingLeft); + const signalY = addOffsets(parentScope.offsets.y, `datum[${JSON.stringify(FieldNames.WrapRow)}] * ${names.cellHeight}`, SignalNames.FacetPaddingTop); + const update2 = { + height: { + signal: signalH + }, + width: { + signal: signalW + }, + x: { + signal: signalX + }, + y: { + signal: signalY + } + }; + const offsets2 = { + x: signalX, + y: signalY, + h: signalH, + w: signalW + }; + const group2 = { + style: "cell", + name: prefix, + type: "group", + from: { + data: names.rowColumnDataName + }, + encode: { update: update2 } + }; + addMarks(globalScope.markGroup, group2); + const sizeSignals = { + layoutHeight: `(${names.cellHeight} - ${SignalNames.FacetPaddingTop} - ${SignalNames.FacetPaddingBottom})`, + layoutWidth: `(${names.cellWidth} - ${SignalNames.FacetPaddingLeft})`, + colCount: names.colCount, + rowCount: `ceil(${names.dataLength} / ${names.colCount})` + }; + if (cellTitles) { + addFacetCellTitles(group2, sizeSignals, axisTextColor); + } + return { + facetScope: group2, + sizeSignals, + offsets: offsets2 + }; } - static angleBetweenVectors(from, to) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - return Math.acos(dot); + } + const layoutClasses = { + AggregateContainer, + AggregateSquare, + Band: Band$1, + Cross: Cross$1, + Scatter: Scatter$1, + Square, + Stack: Stack$1, + Strip, + Treemap: Treemap$1, + Wrap + }; + function getImageMark(backgroundImage, allGlobalScales) { + const xScale = allGlobalScales.filter((s2) => s2.scales.x)[0].scales.x[0]; + const yScale = allGlobalScales.filter((s2) => s2.scales.y)[0].scales.y[0]; + const [xScaleName, yScaleName] = [xScale, yScale].map((s2) => s2.name + (xScale.type === "band" ? bandScaleLinearSuffix : "")); + return { + type: "image", + encode: { + update: { + url: { + value: backgroundImage.url + }, + aspect: { + value: false + }, + baseline: { + value: "bottom" + }, + height: { + signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) + }, + y: { + signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) + }, + width: { + signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) + }, + x: { + signal: getScaledValue(xScaleName, backgroundImage.extents.left) + } } + } + }; + } + function getScaledSpan(scaleName, low, high) { + return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; + } + function getScaledValue(scaleName, value2) { + return `scale('${scaleName}', ${value2})`; + } + class SpecBuilder { + constructor(props, specContext) { + this.props = props; + this.specContext = specContext; + this.globalSignals = { + facetAxesAdjustX: { name: SignalNames.FacetAxesAdjustX, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingLeft.toString() : "0" }, + facetAxesAdjustY: { name: SignalNames.FacetAxesAdjustY, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingBottom.toString() : "0" }, + minCellWidth: { + name: SignalNames.MinCellWidth, + update: `${minFacetWidth}` + }, + minCellHeight: { name: SignalNames.MinCellHeight, update: `${minFacetHeight}` }, + plotOffsetLeft: { name: SignalNames.PlotOffsetLeft, update: "0" }, + plotOffsetTop: { name: SignalNames.PlotOffsetTop, update: "0" }, + plotOffsetBottom: { name: SignalNames.PlotOffsetBottom, update: "0" }, + plotOffsetRight: { name: SignalNames.PlotOffsetRight, update: "0" }, + plotHeightOut: { name: SignalNames.PlotHeightOut, update: SignalNames.PlotHeightIn }, + plotWidthOut: { name: SignalNames.PlotWidthOut, update: SignalNames.PlotWidthIn } + }; } - static signedAngleBetweenVectors(from, to, up) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - let angle = Math.acos(dot); - (0, _glMatrix.vec3).cross(AngleHelper._vec3, from, to); - if ((0, _glMatrix.vec3).dot(AngleHelper._vec3, up) < 0) angle = -angle; - return angle; - } - } -} -AngleHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","./math.js":"f65d0","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f65d0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MathHelper", ()=>MathHelper); -parcelHelpers.export(exports, "PseudoRandom", ()=>PseudoRandom); -class MathHelper { - static simpleLinearRegression(points) { - const n = points.length; - let sumX = 0; - let sumY = 0; - let sumXY = 0; - let sumXX = 0; - for(let i = 0; i < n; i++){ - sumX += points[i].x; - sumY += points[i].y; - sumXY += points[i].x * points[i].y; - sumXX += points[i].x * points[i].x; - } - const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); - const yIntercept = (sumY - slope * sumX) / n; - return { - slope, - yIntercept - }; - } - static clamp(value, min, max) { - return Math.max(Math.min(value, max), min); + validate() { + const { specContext } = this; + const { specCapabilities } = this.props; + const { roles } = specCapabilities; + const required2 = roles.filter((r) => { + switch (typeof r.allowNone) { + case "boolean": + return !r.allowNone; + case "undefined": + return true; + case "function": + return !r.allowNone(specContext); + } + }); + const numeric = roles.filter((r) => r.excludeCategoric); + const errors = required2.map((r) => { + if (specContext.specColumns[r.role]) { + return null; + } else { + return `Field ${r.role} is required.`; + } + }).concat(numeric.map((r) => { + if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) { + return `Field ${r.role} must be quantitative.`; + } else { + return null; + } + })).filter(Boolean); + const { backgroundImage } = specContext.insight; + if (backgroundImage && !backgroundImage.extents) { + errors.push("BackgroundImage must have extents."); + } + return errors; } - static lerp(value1, value2, amount) { - return value1 + (value2 - value1) * amount; + build() { + var _a2, _b2; + const { globalSignals, specContext } = this; + const { facetLayout, specCapabilities } = this.props; + const { insight, specColumns, specViewOptions } = specContext; + const dataName = "data_source"; + const { vegaSpec, groupMark } = this.initSpec(dataName); + const { topColorField, colorDataName } = addColor({ + scope: vegaSpec, + dataName, + specContext, + scaleName: ScaleNames.Color, + legendDataName: "data_legend", + topLookupName: "data_topcolorlookup", + colorReverseSignalName: SignalNames.ColorReverse + }); + const globalScope = new GlobalScope({ + dataName: colorDataName, + markGroup: groupMark, + scope: vegaSpec, + signals: globalSignals + }); + if (facetLayout) { + addSignals(vegaSpec, { + name: SignalNames.FacetPaddingBottom, + update: `${facetLayout.facetPadding.bottom}` + }, { + name: SignalNames.FacetPaddingLeft, + update: `${facetLayout.facetPadding.left}` + }, { + name: SignalNames.FacetPaddingTop, + update: `${facetLayout.facetPadding.top}` + }); + globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; + globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; + } + const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope) => { + if (facetLayout && i === 0) { + globalScope.zSize = innerScope.offsets.h; + } + }); + if (specResult) { + return specResult; + } + if (allGlobalScales.length > 0) { + const plotHeightOut = globalSignals.plotHeightOut.name; + const plotWidthOut = globalSignals.plotWidthOut.name; + const colTitleScale = { + type: "linear", + name: "scale_facet_col_title", + domain: [0, 1], + range: [0, { signal: plotWidthOut }] + }; + const rowTitleScale = { + type: "linear", + name: "scale_facet_row_title", + domain: [0, 1], + range: [{ signal: plotHeightOut }, 0] + }; + const facetScope = facetLayout ? firstScope : null; + const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; + if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) && ((_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.quantitative)) { + if (!backgroundGroup.marks) { + backgroundGroup.marks = []; + } + const imageMark = getImageMark(insight.backgroundImage, allGlobalScales); + backgroundGroup.marks.unshift(imageMark); + } + const axesScopes = facetLayout ? addFacetAxesGroupMarks({ + globalScope: globalScope.scope, + plotScope: groupMark, + facetScope, + colTitleScale, + rowTitleScale, + colSeqName: "data_FacetCellColTitles", + rowSeqName: "data_FacetCellRowTitles" + }) : { + main: [{ + scope: groupMark, + lines: true, + labels: true, + title: true + }] + }; + addGlobalAxes({ + globalScope, + allGlobalScales, + axisScales: this.props.axisScales, + plotOffsetSignals: { x: globalSignals.plotOffsetLeft, y: globalSignals.plotOffsetBottom }, + axesOffsets: { x: axesOffsetX, y: axesOffsetY }, + axesTitlePadding: facetLayout ? { x: axesTitlePaddingFacetX, y: axesTitlePaddingFacetY } : { x: axesTitlePaddingX, y: axesTitlePaddingY }, + labelBaseline: { x: "top", y: "middle" }, + specColumns, + specViewOptions, + axesScopes, + hideZAxis: !!facetLayout, + view: insight.view + }); + } + if (finalScope.mark) { + const { update: update2 } = finalScope.mark.encode; + const outputDataName = "output"; + finalScope.mark.from.data = outputDataName; + addData(globalScope.markGroup, { + name: outputDataName, + source: globalScope.markDataName, + transform: [ + { + type: "formula", + expr: finalScope.offsets.x, + as: FieldNames.OffsetX + }, + { + type: "formula", + expr: finalScope.offsets.y, + as: FieldNames.OffsetY + } + ] + }); + update2.x = { + field: FieldNames.OffsetX + }; + update2.y = { + field: FieldNames.OffsetY + }; + allEncodingRules.forEach((map2) => { + for (const key2 in map2) { + if (update2[key2]) { + const arrIn = map2[key2]; + if (!Array.isArray(update2[key2])) { + const value2 = update2[key2]; + const arrOut = []; + update2[key2] = arrOut; + arrIn.forEach((rule2) => arrOut.push(rule2)); + arrOut.push(value2); + } else { + const arrOut = update2[key2]; + arrIn.forEach((rule2) => arrOut.unshift(rule2)); + } + } + } + }); + update2.fill = fill$1(specContext, topColorField, ScaleNames.Color); + update2.opacity = opacity(); + } + return { + specCapabilities, + vegaSpec + }; } - static normalize(value, min, max, from = 0, to = 1) { - return max - min == 0 ? 0 : Math.max(Math.min((to - from) * (value - min) / (max - min) + from, to), from); + initSpec(dataName) { + const { globalSignals } = this; + const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; + const { specContext } = this; + const { insight } = specContext; + const groupMark = { + type: "group", + //style: 'cell', + encode: { + update: { + x: { signal: `${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, + y: { signal: SignalNames.PlotOffsetTop }, + height: { signal: `${SignalNames.PlotHeightOut} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: `${SignalNames.PlotWidthOut} + ${SignalNames.FacetAxesAdjustX}` } + } + } + }; + const inputDataname = "input"; + const vegaSpec = { + $schema: "https://vega.github.io/schema/vega/v5.json", + //style: 'cell', + data: [{ name: inputDataname }, { name: dataName, source: inputDataname, transform: [] }], + marks: [groupMark], + signals: textSignals(specContext, SignalNames.ViewportHeight).concat([ + minCellWidth, + minCellHeight, + { + name: SignalNames.ViewportHeight, + update: `max(${SignalNames.MinCellHeight}, ${insight.size.height})` + }, + { + name: SignalNames.ViewportWidth, + update: `max(${SignalNames.MinCellWidth}, ${insight.size.width})` + }, + plotOffsetLeft, + plotOffsetTop, + plotOffsetBottom, + plotOffsetRight, + facetAxesAdjustX, + facetAxesAdjustY, + { + name: SignalNames.PlotHeightIn, + update: `${SignalNames.ViewportHeight} - ${SignalNames.PlotOffsetBottom} + ${SignalNames.FacetAxesAdjustY}` + }, + { + name: SignalNames.PlotWidthIn, + update: `${SignalNames.ViewportWidth} - ${SignalNames.PlotOffsetLeft} - ${SignalNames.PlotOffsetRight}` + }, + plotHeightOut, + plotWidthOut, + { + name: "height", + update: `${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut} + ${SignalNames.PlotOffsetBottom} - ${SignalNames.FacetAxesAdjustY}` + }, + { + name: "width", + update: `${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotOffsetRight}` + } + ]) + }; + return { vegaSpec, groupMark }; } - static splitExponent(value, result) { - let exponent = Math.round(Math.log10(Math.abs(value))); - let coefficient = value / Math.pow(10, exponent); - if (coefficient < 1) { - coefficient *= 10; - exponent--; + iterateLayouts(globalScope, onLayoutBuild) { + let specResult; + let parentScope = { + sizeSignals: globalScope.sizeSignals, + offsets: globalScope.offsets + }; + let firstScope; + let childScope; + const groupings = []; + const { layouts, specCapabilities } = this.props; + const allGlobalScales = []; + const allEncodingRules = []; + for (let i = 0; i < layouts.length; i++) { + if (!parentScope) + continue; + const buildProps = { + globalScope, + parentScope, + axesScales: this.props.axisScales, + groupings, + id: i + }; + const layout = this.createLayout(layouts[i], buildProps); + try { + childScope = layout.build(); + childScope.id = i; + const groupby = layout.getGrouping(); + if (groupby) { + groupings.push({ + id: i, + groupby, + fieldOps: [ + { field: null, op: "count", as: FieldNames.Count } + ] + }); + } + const sumOp = layout.getAggregateSumOp(); + if (sumOp) { + groupings[groupings.length - 1].fieldOps.push(sumOp); + } + onLayoutBuild(i, childScope); + } catch (e) { + specResult = { + errors: [e.stack], + specCapabilities, + vegaSpec: null + }; + break; + } + if (childScope && childScope.globalScales) { + allGlobalScales.push(childScope.globalScales); } - result[0] = coefficient; - result[1] = exponent; + if (childScope.encodingRuleMap) { + allEncodingRules.push(childScope.encodingRuleMap); + } + if (i === 0) { + firstScope = childScope; + } + parentScope = childScope; + } + return { firstScope, finalScope: parentScope, specResult, allGlobalScales, allEncodingRules }; } - static combineExponent(mantissa, exponent) { - return mantissa * Math.pow(10, exponent); + createLayout(layoutPair, buildProps) { + const { layoutType, props } = layoutPair; + const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); + const layoutClass = layoutClasses[layoutType]; + const layout = new layoutClass(layoutBuildProps); + layout.id = buildProps.id; + return layout; } - static isPowerOf2(value) { - return (value & value - 1) == 0; + } + function build(specContext, currData) { + const { specColumns } = specContext; + const columns = [ + specColumns.color, + specColumns.facet, + specColumns.facetV, + specColumns.group, + specColumns.size, + specColumns.sort, + specColumns.x, + specColumns.y, + specColumns.z + ]; + inferAll(columns, currData); + const specBuilderProps = getSpecBuilderPropsForChart(specContext); + const specBuilder = new SpecBuilder(specBuilderProps, specContext); + let specResult; + if (specBuilder) { + try { + const errors = specBuilder.validate(); + if (errors.length) { + specResult = { + errors, + specCapabilities: specBuilderProps.specCapabilities, + vegaSpec: null + }; + } else { + specResult = specBuilder.build(); + } + } catch (e) { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [e.stack] + }; + } + if (!specResult.errors) { + const data0 = specResult.vegaSpec.data[0]; + data0.values = currData; + } + } else { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [`could not build spec for ${specContext.insight.chart}`] + }; } -} -class PseudoRandom { - constructor(seed){ - this._seed = seed % 2147483647; - if (this._seed <= 0) this._seed += 2147483646; + return specResult; + } + const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + ColorScaleNone, + FieldNames, + Other, + ScaleNames, + SignalNames, + build, + getColumnsFromData, + getSpecColumns, + getStats, + inferAll + }, Symbol.toStringTag, { value: "Module" })); + const GL_ORDINAL = "GL_ORDINAL"; + const constants$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + ColorScaleNone, + FieldNames, + GL_ORDINAL, + ScaleNames, + SignalNames + }, Symbol.toStringTag, { value: "Module" })); + function isSearchExpressionGroup(search) { + if (!search) { + return false; } - next() { - return this._seed = this._seed * 16807 % 2147483647; + return !!search.expressions; + } + function createGroupFromExpression(input) { + const output2 = { + expressions: [input] + }; + return output2; + } + function ensureSearchExpressionGroupArray(search) { + if (Array.isArray(search)) { + return [...search]; + } else if (isSearchExpressionGroup(search)) { + return [search]; + } else { + return [createGroupFromExpression(search)]; } - nextFloat() { - return (this.next() - 1) / 2147483646; - } - nextInteger(min, max) { - return Math.floor(this.nextFloat() * (max - min + 1) + min); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h35rS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraView", ()=>CameraView); -parcelHelpers.export(exports, "CameraBase", ()=>CameraBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _constantsJs = require("../constants.js"); -class CameraView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - } -} -class CameraBase { - getView(view) { - this.getPosition(view.position); + } + const expressionKeys = Object.keys({ + clause: null, + name: null, + operator: null, + value: null + }); + function compareExpression(a2, b2) { + if (a2 && b2) { + for (let k = 0; k < expressionKeys.length; k++) { + const key2 = expressionKeys[k]; + if (a2[key2] != b2[key2]) + return false; + } + } else { + return !a2 && !b2; } - setView(view, isSmooth) { - this.setPosition(view.position, isSmooth); + return true; + } + const groupKeys = Object.keys({ + clause: null + }); + function compareGroup$1(a2, b2) { + for (let k = 0; k < groupKeys.length; k++) { + const key2 = groupKeys[k]; + if (a2[key2] != b2[key2]) + return false; } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setPosition(this._vec3, false); + if (!a2.expressions && !b2.expressions) + return true; + if (!a2.expressions || !b2.expressions) + return false; + if (a2.expressions.length != b2.expressions.length) + return false; + for (let i = 0; i < a2.expressions.length; i++) { + if (!compareExpression(a2.expressions[i], b2.expressions[i])) + return false; } - get vMatrices() { - return this._vMatrices; + return true; + } + function compare$4(a2, b2) { + if (a2 == b2) + return true; + if (!a2 || !b2) + return false; + const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); + const [arrA, arrB] = arrs; + if (arrA.length != arrB.length) + return false; + for (let i = 0; i < arrA.length; i++) { + if (!compareGroup$1(arrA[i], arrB[i])) + return false; } - get inverseVMatrices() { - return this._inverseVMatrices; + return true; + } + function startsWith(whole, part) { + if (!part) + return true; + const arrs = [whole, part].map(ensureSearchExpressionGroupArray); + const [wholeArray, partArray] = arrs; + if (partArray.length > wholeArray.length) + return false; + for (let i = 0; i < partArray.length; i++) { + if (!compareGroup$1(wholeArray[i], partArray[i])) + return false; } - get mvMatrices() { - return this._mvMatrices; + return true; + } + function valueToBoolean(value2) { + if (typeof value2 === "string") { + switch (value2.toLowerCase()) { + case "true": + return true; + case "false": + return false; + } } - get pMatrices() { - return this._pMatrices; + return !!value2; + } + function valueToString(value2) { + if (value2 == null) { + return ""; + } + switch (typeof value2) { + case "string": + return value2; + case "boolean": + case "number": + return value2.toString(); + } + return ""; + } + function isStringOperation(ex) { + switch (ex.operator) { + case "contains": + case "!contains": + case "starts": + case "!starts": + return true; } - get inversePMatrices() { - return this._inversePMatrices; + return false; + } + function isnullorEmpty(value2) { + if (value2 == null) + return true; + if (typeof value2 === "string" && value2.length === 0) + return true; + return false; + } + class Exec { + constructor(search, columns) { + this.columns = columns; + this.groups = ensureSearchExpressionGroupArray(search).map((g) => { + const expressions = g.expressions.filter(Boolean); + expressions.forEach((ex) => { + ex.column = this.getColumn(ex.name); + ex.valueBool = valueToBoolean(ex.value); + ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); + ex.stringOperation = isStringOperation(ex); + }); + const group2 = Object.assign(Object.assign({}, g), { expressions }); + return group2; + }); } - get pickVMatrix() { - return this._pickVMatrix; + getColumn(name) { + for (let i = 0; i < this.columns.length; i++) { + if (this.columns[i].name == name) { + return this.columns[i]; + } + } } - get rMatrix() { - return this._mat3; - } - getOrbit(value) { - (0, _glMatrix.quat).copy(value, this._orbitRotation); - } - setOrbit(value, isSmooth) { - (0, _glMatrix.quat).copy(this._orbitRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, value); - } - getPosition(value) { - (0, _glMatrix.vec3).copy(value, this._cameraPosition); - } - setPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, value); - } - constructor(core){ - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this.modelPosition = (0, _glMatrix.vec3).create(); - this.modelScale = (0, _glMatrix.vec3).create(); - this.modelRotation = (0, _glMatrix.quat).create(); - this._orbitRotation = (0, _glMatrix.quat).create(); - this._orbitDirection = (0, _glMatrix.quat).create(); - this._smoothedOrbitRotation = (0, _glMatrix.quat).create(); - this._smoothedCameraPosition = (0, _glMatrix.vec3).create(); - this._smoothedCameraRotation = (0, _glMatrix.quat).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.quat).create(); - this._combinedPosition = (0, _glMatrix.vec3).create(); - this._combinedRotation = (0, _glMatrix.quat).create(); - this._leftToRightEye = (0, _glMatrix.vec3).create(); - this._pickVMatrix = (0, _glMatrix.mat4).create(); - this._eyePositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._vMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._pMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inverseVMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inversePMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; + runExpressionOnColumn(datum2, ex) { + const actualDataValue = datum2[ex.name]; + if (ex.operator === "isnullorEmpty") { + return isnullorEmpty(actualDataValue); + } else if (ex.operator === "!isnullorEmpty") { + return !isnullorEmpty(actualDataValue); + } + let dataValue = actualDataValue; + let expressionValue = ex.value; + if (ex.column) { + if (ex.column.type === "string" || ex.stringOperation) { + dataValue = valueToString(actualDataValue).toLocaleLowerCase(); + expressionValue = ex.valueLow; + } else if (ex.column.type === "boolean") { + dataValue = valueToBoolean(actualDataValue); + expressionValue = ex.valueBool; + } else if (ex.column.quantitative) { + dataValue = +actualDataValue; + expressionValue = +ex.value; + } + } + switch (ex.operator) { + case "!=": + return dataValue != expressionValue; + case "<": + return dataValue < expressionValue; + case "<=": + return dataValue <= expressionValue; + case "==": + return dataValue == expressionValue; + case ">": + return dataValue > expressionValue; + case ">=": + return dataValue >= expressionValue; + case "contains": + return dataValue.indexOf(expressionValue) >= 0; + case "!contains": + return dataValue.indexOf(expressionValue) < 0; + case "starts": + return dataValue.indexOf(expressionValue) == 0; + case "!starts": + return dataValue.indexOf(expressionValue) !== 0; + } } - reset(isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.quat).copy(this._cameraRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).copy(this._orbitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (!isSmooth) this.syncSmooth(); + runExpression(datum2, ex) { + if (ex.name == null) { + const group2 = { + expressions: this.columns.map((column, i) => { + const ex2 = Object.assign(Object.assign({}, ex), { column, name: column.name }); + if (i) { + ex2.clause = "||"; + } + return ex2; + }) + }; + return this.runGroup(datum2, group2); + } else { + return this.runExpressionOnColumn(datum2, ex); + } } - update(elapsedTime) { - let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); - amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); - (0, _glMatrix.quat).slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); - const epsilon = 0.000001; - let x; - let y; - let z; - let w; - x = this._smoothedCameraPosition[0] - this._cameraPosition[0]; - y = this._smoothedCameraPosition[1] - this._cameraPosition[1]; - z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - x = this._smoothedCameraRotation[0] - this._cameraRotation[0]; - y = this._smoothedCameraRotation[1] - this._cameraRotation[1]; - z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; - w = this._smoothedCameraRotation[3] - this._cameraRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - x = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; - y = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; - z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; - w = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); - (0, _glMatrix.quat).normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); - (0, _glMatrix.quat).normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); - (0, _glMatrix.quat).conjugate(this._orbitDirection, this._smoothedOrbitRotation); - (0, _glMatrix.vec3).transformMat4(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); - (0, _glMatrix.vec3).transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); - (0, _glMatrix.vec3).add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); - (0, _glMatrix.quat).multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); - (0, _glMatrix.mat3).fromQuat(this._mat3, this._combinedRotation); - this._right[0] = this._mat3[0]; - this._right[1] = this._mat3[1]; - this._right[2] = this._mat3[2]; - this._up[0] = this._mat3[3]; - this._up[1] = this._mat3[4]; - this._up[2] = this._mat3[5]; - this._forward[0] = this._mat3[6]; - this._forward[1] = this._mat3[7]; - this._forward[2] = this._mat3[8]; - const view = this._vMatrices[0]; - view[0] = this._right[0]; - view[1] = this._up[0]; - view[2] = this._forward[0]; - view[4] = this._right[1]; - view[5] = this._up[1]; - view[6] = this._forward[1]; - view[8] = this._right[2]; - view[9] = this._up[2]; - view[10] = this._forward[2]; - view[12] = -(0, _glMatrix.vec3).dot(this._right, this._combinedPosition); - view[13] = -(0, _glMatrix.vec3).dot(this._up, this._combinedPosition); - view[14] = -(0, _glMatrix.vec3).dot(this._forward, this._combinedPosition); - const aspectRatio = this.width / this.height; - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).none) { - if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - const left = -aspectRatio * top; - const right = aspectRatio * top; - const width = right - left; - const height = top - bottom; - const tileWidth = width / this._core.config.tilesX; - const tileHeight = height / this._core.config.tilesY; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); - } else (0, _glMatrix.mat4).perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this.vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this.pMatrices[0]); - } else { - (0, _glMatrix.vec3).cross(this._leftToRightEye, this._forward, this._up); - (0, _glMatrix.vec3).normalize(this._leftToRightEye, this._leftToRightEye); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); - this._vMatrices[0][12] += this._core.config.ipd * 0.5; - (0, _glMatrix.mat4).copy(this._vMatrices[1], this._vMatrices[0]); - this._vMatrices[1][12] -= this._core.config.ipd; - const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - let left = -aspectRatio * top + frustumShift; - let right = aspectRatio * top + frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - left = -aspectRatio * top - frustumShift; - right = aspectRatio * top - frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).multiply(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this._vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this._pMatrices[0]); - (0, _glMatrix.mat4).copy(this._inverseVMatrices[1], this._inverseVMatrices[0]); - this._inverseVMatrices[1][12] += this._core.config.ipd; - (0, _glMatrix.mat4).invert(this._inversePMatrices[1], this._pMatrices[1]); + runGroup(datum2, group2) { + let accumulator = this.runExpression(datum2, group2.expressions[0]); + for (let i = 1; i < group2.expressions.length; i++) { + const ex = group2.expressions[i]; + switch (ex.clause) { + case "&&": + accumulator = accumulator && this.runExpression(datum2, ex); + break; + case "||": + accumulator = accumulator || this.runExpression(datum2, ex); + break; } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } + return accumulator; + } + run(datum2) { + let accumulator = this.runGroup(datum2, this.groups[0]); + for (let i = 1; i < this.groups.length; i++) { + const group2 = this.groups[i]; + switch (group2.clause) { + case "&&": + accumulator = accumulator && this.runGroup(datum2, group2); + break; + case "||": + accumulator = accumulator || this.runGroup(datum2, group2); + break; } + } + return accumulator; } - _zoom(direction, distance) { - (0, _glMatrix.vec3).scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance); - } - rotate(translationDelta) {} - zoom(zoomDelta, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - const distance = zoomDelta * (0, _glMatrix.vec3).distance(this._combinedPosition, this.modelPosition); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._zoom(this._vec3, distance); - } - _twist(axis, angle) {} - twist(angle, x, y) {} - updatePickVMatrix(x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.mat4).lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); - } - syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); + } + function invertSearchExpressionGroup(input) { + const output2 = { + expressions: input.expressions.map(invertSearchExpression) + }; + if (input.clause) { + output2.clause = invertedClauses[input.clause]; } - updateModelManipulationOrigin(from, to) { - const a = (0, _glMatrix.vec3).create(); - const b = (0, _glMatrix.vec3).create(); - const c = (0, _glMatrix.vec3).create(); - const d = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformMat4(a, from, this.modelMMatrix); - (0, _glMatrix.vec3).transformMat4(b, to, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(a, this._cameraPosition, a); - (0, _glMatrix.vec3).subtract(b, this._cameraPosition, b); - (0, _glMatrix.vec3).transformQuat(c, a, this._orbitDirection); - (0, _glMatrix.vec3).transformQuat(d, b, this._orbitDirection); - (0, _glMatrix.vec3).subtract(c, c, a); - (0, _glMatrix.vec3).subtract(d, d, b); - (0, _glMatrix.vec3).subtract(this._vec3, c, d); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).add(this._cameraPosition, this._cameraPosition, this._vec3); - (0, _glMatrix.vec3).add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); - } - unproject(position, x, y, z) { - (0, _glMatrix.vec3).set(position, 2 * x / this.width - 1, 1 - 2 * y / this.height, z); - (0, _glMatrix.vec3).transformMat4(position, position, this._inversePMatrices[0]); - (0, _glMatrix.vec3).transformMat4(position, position, this._inverseVMatrices[0]); + return output2; + } + const invertedOperators = { + "!=": "==", + "==": "!=", + "<": ">=", + ">=": "<", + "<=": ">", + ">": "<=", + "!contains": "contains", + "contains": "!contains", + "!isnullorEmpty": "isnullorEmpty", + "isnullorEmpty": "!isnullorEmpty", + "!starts": "starts", + "starts": "!starts" + }; + const invertedClauses = { + "&&": "||", + "||": "&&" + }; + function invertSearchExpression(input) { + const operator2 = invertedOperators[input.operator]; + const output2 = Object.assign(Object.assign({}, input), { operator: operator2 }); + if (input.clause) { + output2.clause = invertedClauses[input.clause]; } - translate(translationDelta) { - const distance = (0, _glMatrix.vec3).distance(this.modelPosition, this._combinedPosition); - const height = 2 * Math.tan(this._core.config.fov / 2) * distance / this.height; - (0, _glMatrix.vec3).set(this._vec3, height * translationDelta[0], -height * translationDelta[1], 0); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).subtract(this._cameraPosition, this._cameraPosition, this._vec3); - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bCTP3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _mainJs = require("./main.js"); -var _angleJs = require("./helpers/angle.js"); -class Config { - constructor(core){ - this.reset(); + return output2; + } + function invert$2(search) { + if (Array.isArray(search)) { + return search.map(invertSearchExpressionGroup); + } else if (isSearchExpressionGroup(search)) { + return invertSearchExpressionGroup(search); + } else { + return invertSearchExpression(search); } - reset() { - this.isDebugVisible = false; - this.logLevel = (0, _mainJs.LogLevel).warn; - this.shaderPath = "shaders"; - this.fontPath = "fonts"; - this.modelDistance = 0.5; - this.modelSize = 0.25; - this.stereoMode = (0, _mainJs.StereoMode).none; - this.ipd = 0.06; - this.screenDistance = 0.5; - this.fov = (0, _angleJs.AngleHelper).degreesToRadians(30); - this.nearPlane = 0.01; - this.farPlane = 100; - this.pickWidth = 512; - this.pickHeight = 512; - this.pickHoldDelay = 1000; - this.pickSelectDelay = 100; - this.resizeMinimumDelay = 250; - this.rotationSmoothing = 0.02; - this.positionSmoothing = 0.02; - this.focusSmoothing = 0.01; - this.scaleSmoothing = 0.02; - this.mouseWheelZoomScale = -0.002; - this.mouseWheelRotationScale = -0.002; - this.dragToleranceSquared = 100; - this.manipulatorMinRelativeDistanceSquared = 100; - this.isMultiTouchEnabled = true; - this.isMultiTouchZoomEnabled = true; - this.isMultiTouchTwistEnabled = true; - this.isMultiTouchRotateEnabled = true; - this.isMultiTouchTranslateEnabled = true; - this.multiTouchZoomScale = 1; - this.cameraMinDistance = 0.1; - this.cameraMaxDistance = 10; - this.xrControllerRayColor = (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5); - this.xrControllerProfile = "windows-mixed-reality"; - this.xrControllerHandedness = "right"; - this.paletteColor = new Uint8Array([ - 0x80, - 0x80, - 0x80, - 0 - ]); - this.textColor = (0, _glMatrix.vec3).create(); - this.textHoverColor = (0, _glMatrix.vec3).create(); - this.textBorderColor = (0, _glMatrix.vec3).create(); - this.textBorderWidth = 0x18 / 0xff; - this.identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - this.axesTextLabelMaxGlyphs = 32; - this.axesTextColor = (0, _glMatrix.vec3).create(); - this.axesTextBorderColor = (0, _glMatrix.vec3).create(); - this.axesTextHoverColor = (0, _glMatrix.vec3).create(); - this.axesTextLabelMajorSize = 0.03; - this.axesTextLabelMinorSize = 0.02; - this.axesTextTitleMaxGlyphs = 127; - this.axesTextTitleSize = 0.05; - this.axesTextHeadingMaxGlyphs = 128; - this.axesTextHeadingSize = 0.075; - this.axesTextTitleLineHeight = 1.5; - this.axesTextHeadingLineHeight = 1.5; - this.axesTextLabelLineHeight = 1.5; - this.axesGridMajorThickness = 0.0002; - this.axesGridMinorThickness = 0.0001; - this.axesGridZeroThickness = 0.002; - this.axesGridPickDivisionHeight = 0.025; - this.axesGridBackgroundColor = (0, _glMatrix.vec3).create(); - this.axesGridHighlightColor = (0, _glMatrix.vec3).create(); - this.axesGridMinorColor = (0, _glMatrix.vec3).create(); - this.axesGridMajorColor = (0, _glMatrix.vec3).create(); - this.axesGridZeroColor = (0, _glMatrix.vec3).create(); - this.axesGridDefaultDivisions = 10; - this.keyTitleMaxGlyphs = 64; - this.keyLabelMaxGlyphs = 64; - this.selectionColor = (0, _glMatrix.vec3).create(); - this.hoverColor = (0, _glMatrix.vec3).create(); - this.activeColor = (0, _glMatrix.vec3).create(); - this.highlightMode = (0, _mainJs.HighlightMode).color; - this.lassoThickness = 4; - this.lassoDashWidth = 2; - this.lassoColor = (0, _glMatrix.vec3).create(); - this.minCubifiedTreeMapSlice = 0.01; - this.sdfBuffer = 0xc0; - this.sdfBorder = 0x0; - this.forceDirectIsEnabled = false; - this.forceDirectAttraction = 1; - this.forceDirectRepulsion = 1; - this.forceDirectGravity = 1; - this.forceDirectInterval = 0.1; - this.forceDirectMaxDistance = 0.1; - this.forceDirectTheta = 1; - this.forceDirectIterationsPerLayout = 1; - this.forceDirectEdgeWeightPower = 1; - this.forceDirectLockX = false; - this.forceDirectLockY = false; - this.forceDirectLockZ = false; - this.transitionDuration = 400; - this.transitionStaggering = 100; - this.transitionView = true; - this.isTransitionPickingEnabled = false; - this.backgroundColor = (0, _glMatrix.vec4).create(); - this.theme = (0, _mainJs.Theme).light; - this.renderMode = (0, _mainJs.RenderMode).color; - this.tilesX = 1; - this.tilesY = 1; - this.tileOffsetX = 0; - this.tileOffsetY = 0; + } + function narrow(a2, b2) { + if (!a2) { + return b2; } - get theme() { - return this._theme; - } - set theme(value) { - if (this._theme != value) { - this._theme = value; - switch(value){ - case (0, _mainJs.Theme).dark: - (0, _glMatrix.vec4).set(this.backgroundColor, 0, 0, 0, 1); - (0, _glMatrix.vec3).set(this.textColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.textHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.04, 0.04, 0.04); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.05, 0.05, 0.05); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.05, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.9, 0.9, 0.9); - break; - case (0, _mainJs.Theme).light: - (0, _glMatrix.vec4).set(this.backgroundColor, 1, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.textHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.textBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.925, 0.925, 0.925); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.8, 0.8, 0.8); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.7, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.1, 0.1, 0.1); - break; + const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); + const [arrA, arrB] = arrs; + arrB[0].clause = "&&"; + return arrA.concat(arrB); + } + const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Exec, + compare: compare$4, + compareExpression, + compareGroup: compareGroup$1, + createGroupFromExpression, + ensureSearchExpressionGroupArray, + invert: invert$2, + isSearchExpressionGroup, + narrow, + startsWith + }, Symbol.toStringTag, { value: "Module" })); + const types$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null + }, Symbol.toStringTag, { value: "Module" })); + const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + function decamelize(str, separator = "-") { + return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2").toLowerCase(); + } + function createElement(tag, attrs, ...children2) { + if (typeof tag === "function") { + const fn2 = tag; + let props = attrs; + if (props === null || props === void 0) { + props = { children: children2 }; + } else { + props.children = children2; + } + return fn2(props); + } else { + const ns = tag === "svg" ? SVG_NAMESPACE : null; + const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); + const map2 = attrs; + let ref2; + for (let name in map2) { + if (name && map2.hasOwnProperty(name)) { + let value2 = map2[name]; + if (name === "className" && value2 !== void 0) { + setAttribute$1(el, ns, "class", value2.toString()); + } else if (name === "disabled" && !value2) ; + else if (value2 === null || value2 === void 0) { + continue; + } else if (value2 === true) { + setAttribute$1(el, ns, name, name); + } else if (typeof value2 === "function") { + if (name === "ref") { + ref2 = value2; + } else { + el[name.toLowerCase()] = value2; } - if (this.themeChangedCallback) this.themeChangedCallback(this._theme); - } - } -} - -},{"gl-matrix":"5x28d","./constants.js":"lD0bG","./main.js":"f421K","./helpers/angle.js":"53hwW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eYPBQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugText", ()=>DebugText); -class DebugText { - get text() { - return this._text; + } else if (typeof value2 === "object") { + setAttribute$1(el, ns, name, flatten$1(value2)); + } else { + setAttribute$1(el, ns, name, value2.toString()); + } + } + } + if (children2 && children2.length > 0) { + appendChildren(el, children2); + } + if (ref2) { + ref2(el); + } + return el; } - constructor(){ - this.clear(); + } + function setAttribute$1(el, ns, name, value2) { + if (ns) { + el.setAttributeNS(null, name, value2); + } else { + el.setAttribute(name, value2); } - clear() { - this._text = ""; - } - addLine(value) { - this._text += value + "\n"; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9OHgw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fps", ()=>Fps); -class Fps { - get frameCounter() { - return this._frameCounter; + } + function flatten$1(o) { + const arr = []; + for (let prop in o) + arr.push(`${decamelize(prop, "-")}:${o[prop]}`); + return arr.join(";"); + } + function isInsideForeignObject(element2) { + let current = element2; + while (current) { + if (current.tagName.toLowerCase() === "foreignobject") { + return true; + } + current = current.parentElement; + } + return false; + } + function recreateWithSvgNamespace(element2) { + const svgElement = document.createElementNS(SVG_NAMESPACE, element2.tagName.toLowerCase()); + for (let i = 0; i < element2.attributes.length; i++) { + const attr2 = element2.attributes[i]; + svgElement.setAttributeNS(null, attr2.name, attr2.value); + } + const eventProperties = [ + "onclick", + "onmousedown", + "onmouseup", + "onmouseover", + "onmouseout", + "onmousemove", + "onkeydown", + "onkeyup", + "onkeypress", + "onfocus", + "onblur" + ]; + for (const prop of eventProperties) { + if (element2[prop]) { + svgElement[prop] = element2[prop]; + } } - get totalFrames() { - return this._totalFrames; + for (let i = 0; i < element2.childNodes.length; i++) { + const child = element2.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) { + svgElement.appendChild(recreateWithSvgNamespace(child)); + } else { + svgElement.appendChild(child.cloneNode(true)); + } } - constructor(core){ - this._core = core; - this._totalFrames = 0; - this.reset(); + return svgElement; + } + function addChild(parentElement, child) { + if (child === null || child === void 0 || typeof child === "boolean") { + return; + } else if (Array.isArray(child)) { + appendChildren(parentElement, child); + } else if (isElement(child)) { + const childEl = child; + if (parentElement.namespaceURI === SVG_NAMESPACE && childEl.namespaceURI !== SVG_NAMESPACE && childEl.tagName.toLowerCase() !== "foreignobject" && !isInsideForeignObject(parentElement)) { + const recreated = recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } else { + parentElement.appendChild(childEl); + } + } else { + parentElement.appendChild(document.createTextNode(child.toString())); } - update(elapsedTime) { - this._elapsedTime += elapsedTime; - if (this._elapsedTime > 1000) { - this._elapsedTime -= 1000; - this._fps = this._frameCounter; - this._frameCounter = 0; - } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`fps ${this._fps}`); + } + function appendChildren(parentElement, children2) { + children2.forEach((child) => addChild(parentElement, child)); + } + function isElement(el) { + return !!el.nodeType; + } + function mount(element2, container) { + container.innerHTML = ""; + if (element2) { + addChild(container, element2); } - render() { - this._frameCounter++; - this._totalFrames++; + } + function findElementByChildPositions(childPositions, container) { + let element2 = container || document.body; + let childPosition; + while (element2 && childPositions.length) { + childPosition = childPositions.shift(); + element2 = element2.children.item(childPosition); } - reset() { - this._fps = 0; - this._frameCounter = 0; - this._elapsedTime = 0; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hZb65":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteType", ()=>PaletteType); -parcelHelpers.export(exports, "PaletteName", ()=>PaletteName); -parcelHelpers.export(exports, "PaletteResources", ()=>PaletteResources); -parcelHelpers.export(exports, "PaletteBase", ()=>PaletteBase); -parcelHelpers.export(exports, "Palette", ()=>Palette); -const PaletteType = { - sequentialsinglehue: "sequentialsinglehue", - sequentialmultihue: "sequentialmultihue", - diverging: "diverging", - qualitative: "qualitative" -}; -const PaletteName = { - blues: "blues", - greens: "greens", - greys: "greys", - oranges: "oranges", - purples: "purples", - reds: "reds", - viridis: "viridis", - inferno: "inferno", - magma: "magma", - plasma: "plasma", - bluegreen: "bluegreen", - bluepurple: "bluepurple", - greenblue: "greenblue", - orangered: "orangered", - purpleblue: "purpleblue", - purplebluegreen: "purplebluegreen", - purplered: "purplered", - redpurple: "redpurple", - yellowgreen: "yellowgreen", - yellowgreenblue: "yellowgreenblue", - yelloworangebrown: "yelloworangebrown", - yelloworangered: "yelloworangered", - brownbluegreen: "brownbluegreen", - pinkyellowgreen: "pinkyellowgreen", - purplegreen: "purplegreen", - purpleorange: "purpleorange", - redblue: "redblue", - redgrey: "redgrey", - redyellowblue: "redyellowblue", - redyellowgreen: "redyellowgreen", - spectral: "spectral", - accent: "accent", - dark2: "dark2", - paired: "paired", - pastel1: "pastel1", - pastel2: "pastel2", - set1: "set1", - set2: "set2", - set3: "set3" -}; -class PaletteResources { - constructor(){ - this.palettes = { - "blues": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 251, - 255, - 222, - 235, - 247, - 198, - 219, - 239, - 158, - 202, - 225, - 107, - 174, - 214, - 66, - 146, - 198, - 33, - 113, - 181, - 8, - 81, - 156, - 8, - 48, - 107 - ]) - }, - "greens": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 252, - 245, - 229, - 245, - 224, - 199, - 233, - 192, - 161, - 217, - 155, - 116, - 196, - 118, - 65, - 171, - 93, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "greys": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 255, - 255, - 240, - 240, - 240, - 217, - 217, - 217, - 189, - 189, - 189, - 150, - 150, - 150, - 115, - 115, - 115, - 82, - 82, - 82, - 37, - 37, - 37, - 0, - 0, - 0 - ]) - }, - "oranges": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 235, - 254, - 230, - 206, - 253, - 208, - 162, - 253, - 174, - 107, - 253, - 141, - 60, - 241, - 105, - 19, - 217, - 72, - 1, - 166, - 54, - 3, - 127, - 39, - 4 - ]) - }, - "purples": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 252, - 251, - 253, - 239, - 237, - 245, - 218, - 218, - 235, - 188, - 189, - 220, - 158, - 154, - 200, - 128, - 125, - 186, - 106, - 81, - 163, - 84, - 39, - 143, - 63, - 0, - 125 - ]) - }, - "reds": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 240, - 254, - 224, - 210, - 252, - 187, - 161, - 252, - 146, - 114, - 251, - 106, - 74, - 239, - 59, - 44, - 203, - 24, - 29, - 165, - 15, - 21, - 103, - 0, - 13 - ]) - }, - "viridis": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x48, - 0x25, - 0x75, - 0x41, - 0x44, - 0x87, - 0x35, - 0x60, - 0x8d, - 0x2a, - 0x78, - 0x8e, - 0x21, - 0x91, - 0x8d, - 0x22, - 0xa8, - 0x84, - 0x43, - 0xbf, - 0x71, - 0x7a, - 0xd1, - 0x51, - 0xbc, - 0xdf, - 0x27 - ]) - }, - "inferno": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x17, - 0x0c, - 0x3b, - 0x42, - 0x0a, - 0x68, - 0x6b, - 0x17, - 0x6e, - 0x93, - 0x26, - 0x67, - 0xbb, - 0x37, - 0x55, - 0xdd, - 0x51, - 0x3a, - 0xf3, - 0x77, - 0x1a, - 0xfc, - 0xa5, - 0x0a, - 0xf6, - 0xd6, - 0x45 - ]) - }, - "magma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x15, - 0x0e, - 0x37, - 0x3b, - 0x0f, - 0x70, - 0x65, - 0x1a, - 0x80, - 0x8c, - 0x29, - 0x81, - 0xb6, - 0x37, - 0x7a, - 0xde, - 0x49, - 0x68, - 0xf7, - 0x6f, - 0x5c, - 0xfe, - 0x9f, - 0x6d, - 0xfe, - 0xce, - 0x91 - ]) - }, - "plasma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x42, - 0x03, - 0x9d, - 0x6a, - 0x00, - 0xa8, - 0x90, - 0x0d, - 0xa4, - 0xb1, - 0x2a, - 0x90, - 0xcb, - 0x47, - 0x79, - 0xe1, - 0x64, - 0x62, - 0xf2, - 0x83, - 0x4c, - 0xfc, - 0xa6, - 0x36, - 0xfc, - 0xce, - 0x25 - ]) - }, - "bluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 229, - 245, - 249, - 204, - 236, - 230, - 153, - 216, - 201, - 102, - 194, - 164, - 65, - 174, - 118, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "bluepurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 224, - 236, - 244, - 191, - 211, - 230, - 158, - 188, - 218, - 140, - 150, - 198, - 140, - 107, - 177, - 136, - 65, - 157, - 129, - 15, - 124, - 77, - 0, - 75 - ]) - }, - "greenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 240, - 224, - 243, - 219, - 204, - 235, - 197, - 168, - 221, - 181, - 123, - 204, - 196, - 78, - 179, - 211, - 43, - 140, - 190, - 8, - 104, - 172, - 8, - 64, - 129 - ]) - }, - "orangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 236, - 254, - 232, - 200, - 253, - 212, - 158, - 253, - 187, - 132, - 252, - 141, - 89, - 239, - 101, - 72, - 215, - 48, - 31, - 179, - 0, - 0, - 127, - 0, - 0 - ]) - }, - "purpleblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 231, - 242, - 208, - 209, - 230, - 166, - 189, - 219, - 116, - 169, - 207, - 54, - 144, - 192, - 5, - 112, - 176, - 4, - 90, - 141, - 2, - 56, - 88 - ]) - }, - "purplebluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 226, - 240, - 208, - 209, - 230, - 166, - 189, - 219, - 103, - 169, - 207, - 54, - 144, - 192, - 2, - 129, - 138, - 1, - 108, - 89, - 1, - 70, - 54 - ]) - }, - "purplered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 244, - 249, - 231, - 225, - 239, - 212, - 185, - 218, - 201, - 148, - 199, - 223, - 101, - 176, - 231, - 41, - 138, - 206, - 18, - 86, - 152, - 0, - 67, - 103, - 0, - 31 - ]) - }, - "redpurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 243, - 253, - 224, - 221, - 252, - 197, - 192, - 250, - 159, - 181, - 247, - 104, - 161, - 221, - 52, - 151, - 174, - 1, - 126, - 122, - 1, - 119, - 73, - 0, - 106 - ]) - }, - "yellowgreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 247, - 252, - 185, - 217, - 240, - 163, - 173, - 221, - 142, - 120, - 198, - 121, - 65, - 171, - 93, - 35, - 132, - 67, - 0, - 104, - 55, - 0, - 69, - 41 - ]) - }, - "yellowgreenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 217, - 237, - 248, - 177, - 199, - 233, - 180, - 127, - 205, - 187, - 65, - 182, - 196, - 29, - 145, - 192, - 34, - 94, - 168, - 37, - 52, - 148, - 8, - 29, - 88 - ]) - }, - "yelloworangebrown": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 255, - 247, - 188, - 254, - 227, - 145, - 254, - 196, - 79, - 254, - 153, - 41, - 236, - 112, - 20, - 204, - 76, - 2, - 153, - 52, - 4, - 102, - 37, - 6 - ]) - }, - "yelloworangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 204, - 255, - 237, - 160, - 254, - 217, - 118, - 254, - 178, - 76, - 253, - 141, - 60, - 252, - 78, - 42, - 227, - 26, - 28, - 189, - 0, - 38, - 128, - 0, - 38 - ]) - }, - "brownbluegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 84, - 48, - 5, - 140, - 81, - 10, - 191, - 129, - 45, - 223, - 194, - 125, - 246, - 232, - 195, - 245, - 245, - 245, - 199, - 234, - 229, - 128, - 205, - 193, - 53, - 151, - 143, - 1, - 102, - 94, - 0, - 60, - 48 - ]) - }, - "pinkyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 142, - 1, - 82, - 197, - 27, - 125, - 222, - 119, - 174, - 241, - 182, - 218, - 253, - 224, - 239, - 247, - 247, - 247, - 230, - 245, - 208, - 184, - 225, - 134, - 127, - 188, - 65, - 77, - 146, - 33, - 39, - 100, - 25 - ]) - }, - "purplegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 64, - 0, - 75, - 118, - 42, - 131, - 153, - 112, - 171, - 194, - 165, - 207, - 231, - 212, - 232, - 247, - 247, - 247, - 217, - 240, - 211, - 166, - 219, - 160, - 90, - 174, - 97, - 27, - 120, - 55, - 0, - 68, - 27 - ]) - }, - "purpleorange": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 127, - 59, - 8, - 179, - 88, - 6, - 224, - 130, - 20, - 253, - 184, - 99, - 254, - 224, - 182, - 247, - 247, - 247, - 216, - 218, - 235, - 178, - 171, - 210, - 128, - 115, - 172, - 84, - 39, - 136, - 45, - 0, - 75 - ]) - }, - "redblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 247, - 247, - 247, - 209, - 229, - 240, - 146, - 197, - 222, - 67, - 147, - 195, - 33, - 102, - 172, - 5, - 48, - 97 - ]) - }, - "redgrey": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 255, - 255, - 255, - 224, - 224, - 224, - 186, - 186, - 186, - 135, - 135, - 135, - 77, - 77, - 77, - 26, - 26, - 26 - ]) - }, - "redyellowblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 144, - 255, - 255, - 191, - 224, - 243, - 248, - 171, - 217, - 233, - 116, - 173, - 209, - 69, - 117, - 180, - 49, - 54, - 149 - ]) - }, - "redyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 217, - 239, - 139, - 166, - 217, - 106, - 102, - 189, - 99, - 26, - 152, - 80, - 0, - 104, - 55 - ]) - }, - "spectral": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 158, - 1, - 66, - 213, - 62, - 79, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 230, - 245, - 152, - 171, - 221, - 164, - 102, - 194, - 165, - 50, - 136, - 189, - 94, - 79, - 162 - ]) - }, - "accent": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 127, - 201, - 127, - 190, - 174, - 212, - 253, - 192, - 134, - 255, - 255, - 153, - 56, - 108, - 176, - 240, - 2, - 127, - 191, - 91, - 23, - 102, - 102, - 102 - ]) - }, - "dark2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 27, - 158, - 119, - 217, - 95, - 2, - 117, - 112, - 179, - 231, - 41, - 138, - 102, - 166, - 30, - 230, - 171, - 2, - 166, - 118, - 29, - 102, - 102, - 102 - ]) - }, - "paired": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 166, - 206, - 227, - 31, - 120, - 180, - 178, - 223, - 138, - 51, - 160, - 44, - 251, - 154, - 153, - 227, - 26, - 28, - 253, - 191, - 111, - 255, - 127, - 0, - 202, - 178, - 214, - 106, - 61, - 154, - 255, - 255, - 153, - 177, - 89, - 40 - ]) - }, - "pastel1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 251, - 180, - 174, - 179, - 205, - 227, - 204, - 235, - 197, - 222, - 203, - 228, - 254, - 217, - 166, - 255, - 255, - 204, - 229, - 216, - 189, - 253, - 218, - 236, - 242, - 242, - 242 - ]) - }, - "pastel2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 179, - 226, - 205, - 253, - 205, - 172, - 203, - 213, - 232, - 244, - 202, - 228, - 230, - 245, - 201, - 255, - 242, - 174, - 241, - 226, - 204, - 204, - 204, - 204 - ]) - }, - "set1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 228, - 26, - 28, - 55, - 126, - 184, - 77, - 175, - 74, - 152, - 78, - 163, - 255, - 127, - 0, - 255, - 255, - 51, - 166, - 86, - 40, - 247, - 129, - 191, - 153, - 153, - 153 - ]) - }, - "set2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 102, - 194, - 165, - 252, - 141, - 98, - 141, - 160, - 203, - 231, - 138, - 195, - 166, - 216, - 84, - 255, - 217, - 47, - 229, - 196, - 148, - 179, - 179, - 179 - ]) - }, - "set3": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 141, - 211, - 199, - 255, - 255, - 179, - 190, - 186, - 218, - 251, - 128, - 114, - 128, - 177, - 211, - 253, - 180, - 98, - 179, - 222, - 105, - 252, - 205, - 229, - 217, - 217, - 217, - 188, - 128, - 189, - 204, - 235, - 197, - 255, - 237, - 111 - ]) - } - }; + if (element2) { + return element2; } -} -class PaletteBase { - get colors() { - return this._colors; + } + function focusActiveElement(element2, activeElementInfo) { + element2.focus(); + element2.scrollTop = activeElementInfo.scrollTop; + const input = element2; + if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) { + input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); } - set colors(value) { - if (this._colors != value) { - this._colors = value; - this._changed = true; - } + } + function setActiveElement(activeElementInfo, container) { + if (activeElementInfo) { + const element2 = findElementByChildPositions(activeElementInfo.childPositions, container); + if (element2) { + focusActiveElement(element2, activeElementInfo); + } } - constructor(){ - this._colors = null; + } + function getActiveElementInfo(container) { + let element2 = document.activeElement; + const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element2; + const activeElementInfo = { + childPositions: [], + scrollTop, + selectionDirection, + selectionEnd, + selectionStart + }; + while (element2 && element2 !== document.body && element2 !== container) { + activeElementInfo.childPositions.unshift(getChildPosition(element2)); + element2 = element2.parentElement; + } + if ((element2 === document.body || element2 === container) && activeElementInfo.childPositions.length) + return activeElementInfo; + } + function getChildPosition(element2) { + let childPosition = 0; + while (element2 = element2.previousElementSibling) + childPosition++; + return childPosition; + } + const KeyCodes$2 = { + ENTER: "Enter" + }; + const Table$1 = (props) => { + return createElement( + "table", + { className: props.className }, + props.children, + props.rows.map((row, i) => createElement("tr", { className: props.rowClassName || "", onClick: (e) => props.onRowClick && props.onRowClick(e, i), tabIndex: props.onRowClick ? 0 : -1, onKeyUp: (e) => { + if (e.key === KeyCodes$2.ENTER && props.onRowClick) { + props.onRowClick(e, i); + } + } }, row.cells.map((cell2, i2) => createElement("td", { className: cell2.className || "", title: cell2.title || "" }, cell2.content)))) + ); + }; + const controls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Table: Table$1 + }, Symbol.toStringTag, { value: "Module" })); + var EPSILON$3 = 1e-6; + var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + function setMatrixArrayType(type2) { + ARRAY_TYPE = type2; + } + function create$8() { + var out = new ARRAY_TYPE(9); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; } - copyFrom(palette) { - if (palette.colors) this.colors = new Uint8Array(palette.colors); - else this.colors = null; - } - update() {} -} -class Palette extends PaletteBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f5tIG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -parcelHelpers.export(exports, "Controller", ()=>Controller); -var _mainJs = require("../main.js"); -var _objJs = require("../helpers/obj.js"); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class ControllerVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(controller){ - this.controller = controller; - } -} -class Controller { - get isInitialized() { - return this._isInitialized; + out[0] = 1; + out[4] = 1; + out[8] = 1; + return out; + } + function fromMat4(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[4]; + out[4] = a2[5]; + out[5] = a2[6]; + out[6] = a2[8]; + out[7] = a2[9]; + out[8] = a2[10]; + return out; + } + function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { + var out = new ARRAY_TYPE(9); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m10; + out[4] = m11; + out[5] = m12; + out[6] = m20; + out[7] = m21; + out[8] = m22; + return out; + } + function fromQuat$1(out, q) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z2 * x22; + var zy = z2 * y22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + function create$7() { + var out = new ARRAY_TYPE(16); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; } - get mMatrix() { - return this._mMatrix; + out[0] = 1; + out[5] = 1; + out[10] = 1; + out[15] = 1; + return out; + } + function copy$7(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + out[4] = a2[4]; + out[5] = a2[5]; + out[6] = a2[6]; + out[7] = a2[7]; + out[8] = a2[8]; + out[9] = a2[9]; + out[10] = a2[10]; + out[11] = a2[11]; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; + return out; + } + function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + var out = new ARRAY_TYPE(16); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m03; + out[4] = m10; + out[5] = m11; + out[6] = m12; + out[7] = m13; + out[8] = m20; + out[9] = m21; + out[10] = m22; + out[11] = m23; + out[12] = m30; + out[13] = m31; + out[14] = m32; + out[15] = m33; + return out; + } + function identity$8(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + function invert$1(out, a2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; } - get indexCount() { - return this._indexCount; + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + function multiply$2(out, a2, b2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3]; + out[0] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[4]; + b1 = b2[5]; + b22 = b2[6]; + b3 = b2[7]; + out[4] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[8]; + b1 = b2[9]; + b22 = b2[10]; + b3 = b2[11]; + out[8] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[12]; + b1 = b2[13]; + b22 = b2[14]; + b3 = b2[15]; + out[12] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + return out; + } + function translate$2(out, a2, v) { + var x2 = v[0], y2 = v[1], z2 = v[2]; + var a00, a01, a02, a03; + var a10, a11, a12, a13; + var a20, a21, a22, a23; + if (a2 === out) { + out[12] = a2[0] * x2 + a2[4] * y2 + a2[8] * z2 + a2[12]; + out[13] = a2[1] * x2 + a2[5] * y2 + a2[9] * z2 + a2[13]; + out[14] = a2[2] * x2 + a2[6] * y2 + a2[10] * z2 + a2[14]; + out[15] = a2[3] * x2 + a2[7] * y2 + a2[11] * z2 + a2[15]; + } else { + a00 = a2[0]; + a01 = a2[1]; + a02 = a2[2]; + a03 = a2[3]; + a10 = a2[4]; + a11 = a2[5]; + a12 = a2[6]; + a13 = a2[7]; + a20 = a2[8]; + a21 = a2[9]; + a22 = a2[10]; + a23 = a2[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x2 + a10 * y2 + a20 * z2 + a2[12]; + out[13] = a01 * x2 + a11 * y2 + a21 * z2 + a2[13]; + out[14] = a02 * x2 + a12 * y2 + a22 * z2 + a2[14]; + out[15] = a03 * x2 + a13 * y2 + a23 * z2 + a2[15]; } - get vertices() { - return this._vertices; + return out; + } + function scale$6(out, a2, v) { + var x2 = v[0], y2 = v[1], z2 = v[2]; + out[0] = a2[0] * x2; + out[1] = a2[1] * x2; + out[2] = a2[2] * x2; + out[3] = a2[3] * x2; + out[4] = a2[4] * y2; + out[5] = a2[5] * y2; + out[6] = a2[6] * y2; + out[7] = a2[7] * y2; + out[8] = a2[8] * z2; + out[9] = a2[9] * z2; + out[10] = a2[10] * z2; + out[11] = a2[11] * z2; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; + return out; + } + function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + function fromRotationTranslationScale(out, q, v, s2) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z22; + var yy = y2 * y22; + var yz = y2 * z22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + var sx = s2[0]; + var sy = s2[1]; + var sz2 = s2[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz2; + out[9] = (yz - wx) * sz2; + out[10] = (1 - (xx + yy)) * sz2; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + function fromRotationTranslationScaleOrigin(out, q, v, s2, o) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z22; + var yy = y2 * y22; + var yz = y2 * z22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + var sx = s2[0]; + var sy = s2[1]; + var sz2 = s2[2]; + var ox = o[0]; + var oy = o[1]; + var oz = o[2]; + var out0 = (1 - (yy + zz)) * sx; + var out1 = (xy + wz) * sx; + var out2 = (xz - wy) * sx; + var out4 = (xy - wz) * sy; + var out5 = (1 - (xx + zz)) * sy; + var out6 = (yz + wx) * sy; + var out8 = (xz + wy) * sz2; + var out9 = (yz - wx) * sz2; + var out10 = (1 - (xx + yy)) * sz2; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + function fromQuat(out, q) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z2 * x22; + var zy = z2 * y22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near * 2 * nf; + out[15] = 0; + return out; + } + function perspectiveNO(out, fovy, aspect, near, far) { + var f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; } - get indices() { - return this._indices; + return out; + } + var perspective = perspectiveNO; + function lookAt(out, eye, center, up) { + var x02, x12, x2, y02, y12, y2, z02, z1, z2, len2; + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var centerx = center[0]; + var centery = center[1]; + var centerz = center[2]; + if (Math.abs(eyex - centerx) < EPSILON$3 && Math.abs(eyey - centery) < EPSILON$3 && Math.abs(eyez - centerz) < EPSILON$3) { + return identity$8(out); } - get texture() { - return this._texture; + z02 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + len2 = 1 / Math.sqrt(z02 * z02 + z1 * z1 + z2 * z2); + z02 *= len2; + z1 *= len2; + z2 *= len2; + x02 = upy * z2 - upz * z1; + x12 = upz * z02 - upx * z2; + x2 = upx * z1 - upy * z02; + len2 = Math.sqrt(x02 * x02 + x12 * x12 + x2 * x2); + if (!len2) { + x02 = 0; + x12 = 0; + x2 = 0; + } else { + len2 = 1 / len2; + x02 *= len2; + x12 *= len2; + x2 *= len2; + } + y02 = z1 * x2 - z2 * x12; + y12 = z2 * x02 - z02 * x2; + y2 = z02 * x12 - z1 * x02; + len2 = Math.sqrt(y02 * y02 + y12 * y12 + y2 * y2); + if (!len2) { + y02 = 0; + y12 = 0; + y2 = 0; + } else { + len2 = 1 / len2; + y02 *= len2; + y12 *= len2; + y2 *= len2; + } + out[0] = x02; + out[1] = y02; + out[2] = z02; + out[3] = 0; + out[4] = x12; + out[5] = y12; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x02 * eyex + x12 * eyey + x2 * eyez); + out[13] = -(y02 * eyex + y12 * eyey + y2 * eyez); + out[14] = -(z02 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + var mul = multiply$2; + function create$6() { + var out = new ARRAY_TYPE(3); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; } - get rayMMatrix() { - return this._rayMMatrix; + return out; + } + function clone$4(a2) { + var out = new ARRAY_TYPE(3); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function length$1(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2); + } + function fromValues$3(x2, y2, z2) { + var out = new ARRAY_TYPE(3); + out[0] = x2; + out[1] = y2; + out[2] = z2; + return out; + } + function copy$6(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function set$8(out, x2, y2, z2) { + out[0] = x2; + out[1] = y2; + out[2] = z2; + return out; + } + function add$4(out, a2, b2) { + out[0] = a2[0] + b2[0]; + out[1] = a2[1] + b2[1]; + out[2] = a2[2] + b2[2]; + return out; + } + function subtract(out, a2, b2) { + out[0] = a2[0] - b2[0]; + out[1] = a2[1] - b2[1]; + out[2] = a2[2] - b2[2]; + return out; + } + function multiply$1(out, a2, b2) { + out[0] = a2[0] * b2[0]; + out[1] = a2[1] * b2[1]; + out[2] = a2[2] * b2[2]; + return out; + } + function min$3(out, a2, b2) { + out[0] = Math.min(a2[0], b2[0]); + out[1] = Math.min(a2[1], b2[1]); + out[2] = Math.min(a2[2], b2[2]); + return out; + } + function max$3(out, a2, b2) { + out[0] = Math.max(a2[0], b2[0]); + out[1] = Math.max(a2[1], b2[1]); + out[2] = Math.max(a2[2], b2[2]); + return out; + } + function scale$5(out, a2, b2) { + out[0] = a2[0] * b2; + out[1] = a2[1] * b2; + out[2] = a2[2] * b2; + return out; + } + function scaleAndAdd(out, a2, b2, scale2) { + out[0] = a2[0] + b2[0] * scale2; + out[1] = a2[1] + b2[1] * scale2; + out[2] = a2[2] + b2[2] * scale2; + return out; + } + function distance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z2 = b2[2] - a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2); + } + function squaredDistance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z2 = b2[2] - a2[2]; + return x2 * x2 + y2 * y2 + z2 * z2; + } + function squaredLength(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + return x2 * x2 + y2 * y2 + z2 * z2; + } + function negate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + return out; + } + function normalize$5(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + var len2 = x2 * x2 + y2 * y2 + z2 * z2; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = a2[0] * len2; + out[1] = a2[1] * len2; + out[2] = a2[2] * len2; + return out; + } + function dot$1(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cross$1(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2]; + var bx = b2[0], by = b2[1], bz = b2[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + function lerp$1(out, a2, b2, t) { + var ax = a2[0]; + var ay = a2[1]; + var az = a2[2]; + out[0] = ax + t * (b2[0] - ax); + out[1] = ay + t * (b2[1] - ay); + out[2] = az + t * (b2[2] - az); + return out; + } + function transformMat4$2(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z2 = a2[2]; + var w2 = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15]; + w2 = w2 || 1; + out[0] = (m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12]) / w2; + out[1] = (m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13]) / w2; + out[2] = (m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14]) / w2; + return out; + } + function transformMat3(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z2 = a2[2]; + out[0] = x2 * m2[0] + y2 * m2[3] + z2 * m2[6]; + out[1] = x2 * m2[1] + y2 * m2[4] + z2 * m2[7]; + out[2] = x2 * m2[2] + y2 * m2[5] + z2 * m2[8]; + return out; + } + function transformQuat(out, a2, q) { + var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; + var vx = a2[0], vy = a2[1], vz = a2[2]; + var tx2 = qy * vz - qz * vy; + var ty2 = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + tx2 = tx2 + tx2; + ty2 = ty2 + ty2; + tz = tz + tz; + out[0] = vx + qw * tx2 + qy * tz - qz * ty2; + out[1] = vy + qw * ty2 + qz * tx2 - qx * tz; + out[2] = vz + qw * tz + qx * ty2 - qy * tx2; + return out; + } + function exactEquals$1(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2]; + } + function equals$2(a2, b2) { + var a0 = a2[0], a1 = a2[1], a22 = a2[2]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2]; + return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b22) <= EPSILON$3 * Math.max(1, Math.abs(a22), Math.abs(b22)); + } + var len = length$1; + (function() { + var vec2 = create$6(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 3; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + } + return a2; + }; + })(); + function create$5() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; } - get rayIndexCount() { - return this._rayIndexCount; + return out; + } + function clone$3(a2) { + var out = new ARRAY_TYPE(4); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + return out; + } + function fromValues$2(x2, y2, z2, w2) { + var out = new ARRAY_TYPE(4); + out[0] = x2; + out[1] = y2; + out[2] = z2; + out[3] = w2; + return out; + } + function copy$5(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + return out; + } + function set$7(out, x2, y2, z2, w2) { + out[0] = x2; + out[1] = y2; + out[2] = z2; + out[3] = w2; + return out; + } + function normalize$4(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + var w2 = a2[3]; + var len2 = x2 * x2 + y2 * y2 + z2 * z2 + w2 * w2; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = x2 * len2; + out[1] = y2 * len2; + out[2] = z2 * len2; + out[3] = w2 * len2; + return out; + } + function dot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2] + a2[3] * b2[3]; + } + function transformMat4$1(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z2 = a2[2], w2 = a2[3]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12] * w2; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13] * w2; + out[2] = m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14] * w2; + out[3] = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15] * w2; + return out; + } + function exactEquals(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2] && a2[3] === b2[3]; + } + (function() { + var vec2 = create$5(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 4; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + vec2[3] = a2[i + 3]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + a2[i + 3] = vec2[3]; + } + return a2; + }; + })(); + function create$4() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; } - get rayVertices() { - return this._rayVertices; + out[3] = 1; + return out; + } + function setAxisAngle(out, axis, rad) { + rad = rad * 0.5; + var s2 = Math.sin(rad); + out[0] = s2 * axis[0]; + out[1] = s2 * axis[1]; + out[2] = s2 * axis[2]; + out[3] = Math.cos(rad); + return out; + } + function multiply(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + function rotateX(out, a2, rad) { + rad *= 0.5; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = Math.sin(rad), bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + function rotateY(out, a2, rad) { + rad *= 0.5; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var by = Math.sin(rad), bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + function slerp(out, a2, b2, t) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; + var omega, cosom, sinom, scale0, scale1; + cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > EPSILON$3) { + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; } - get rayIndices() { - return this._rayIndices; + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + function conjugate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + out[3] = a2[3]; + return out; + } + function fromMat3(out, m2) { + var fTrace = m2[0] + m2[4] + m2[8]; + var fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m2[5] - m2[7]) * fRoot; + out[1] = (m2[6] - m2[2]) * fRoot; + out[2] = (m2[1] - m2[3]) * fRoot; + } else { + var i = 0; + if (m2[4] > m2[0]) i = 1; + if (m2[8] > m2[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m2[i * 3 + i] - m2[j * 3 + j] - m2[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m2[j * 3 + k] - m2[k * 3 + j]) * fRoot; + out[j] = (m2[j * 3 + i] + m2[i * 3 + j]) * fRoot; + out[k] = (m2[k * 3 + i] + m2[i * 3 + k]) * fRoot; } - constructor(core, options){ - this._cubeObj = `o Cube -v 1.000000 -1.000000 -1.000000 -v 1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 -0.999999 -v 0.999999 1.000000 1.000001 -v -1.000000 1.000000 1.000000 -v -1.000000 1.000000 -1.000000 -vt 1.000000 0.333333 -vt 1.000000 0.666667 -vt 0.666667 0.666667 -vt 0.666667 0.333333 -vt 0.666667 0.000000 -vt 0.000000 0.333333 -vt 0.000000 0.000000 -vt 0.333333 0.000000 -vt 0.333333 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.666667 -vt 0.333333 0.333333 -vt 0.333333 0.666667 -vt 1.000000 0.000000 -vn 0.000000 -1.000000 0.000000 -vn 0.000000 1.000000 0.000000 -vn 1.000000 0.000000 0.000000 -vn -0.000000 0.000000 1.000000 -vn -1.000000 -0.000000 -0.000000 -vn 0.000000 0.000000 -1.000000 -s off -f 2/1/1 3/2/1 4/3/1 -f 8/1/2 7/4/2 6/5/2 -f 5/6/3 6/7/3 2/8/3 -f 6/8/4 7/5/4 3/4/4 -f 3/9/5 7/10/5 8/11/5 -f 1/12/6 4/13/6 8/11/6 -f 1/4/1 2/1/1 4/3/1 -f 5/14/2 8/1/2 6/5/2 -f 1/12/3 5/6/3 2/8/3 -f 2/12/4 6/8/4 3/4/4 -f 4/13/5 3/9/5 8/11/5 -f 5/6/6 1/12/6 8/11/6`; - this._core = core; - this._obj = options.obj; - this._texture = options.texture || new ImageData(new Uint8ClampedArray([ - 0, - 0, - 0, - 255 - ]), 1, 1); + return out; + } + var clone$2 = clone$3; + var fromValues$1 = fromValues$2; + var copy$4 = copy$5; + var set$6 = set$7; + var normalize$3 = normalize$4; + function equals$1(a2, b2) { + return Math.abs(dot(a2, b2)) >= 1 - EPSILON$3; + } + var rotationTo = (function() { + var tmpvec3 = create$6(); + var xUnitVec3 = fromValues$3(1, 0, 0); + var yUnitVec3 = fromValues$3(0, 1, 0); + return function(out, a2, b2) { + var dot2 = dot$1(a2, b2); + if (dot2 < -0.999999) { + cross$1(tmpvec3, xUnitVec3, a2); + if (len(tmpvec3) < 1e-6) cross$1(tmpvec3, yUnitVec3, a2); + normalize$5(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); + return out; + } else if (dot2 > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + cross$1(tmpvec3, a2, b2); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot2; + return normalize$3(out, out); + } + }; + })(); + (function() { + var temp1 = create$4(); + var temp2 = create$4(); + return function(out, a2, b2, c2, d2, t) { + slerp(temp1, a2, d2, t); + slerp(temp2, b2, c2, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + })(); + (function() { + var matr = create$8(); + return function(out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize$3(out, fromMat3(out, matr)); + }; + })(); + function create$3() { + var out = new ARRAY_TYPE(2); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; } - initialize() { - const _vec3 = (0, _glMatrix.vec3).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - const objMesh = new (0, _objJs.ObjHelper)(this._core).read(this._obj || this._cubeObj); - if (!this._obj) { - this.useRayPose = true; - const modelThickness = 0.02; - const modelLength = 0.1; - (0, _glMatrix.vec3).set(_vec3, modelThickness, modelThickness, modelLength); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, 1); - (0, _glMatrix.mat4).translate(this._mMatrix, this._mMatrix, _vec3); - } - this._vertices = objMesh.vertices; - this._indices = objMesh.indices; - this._indexCount = objMesh.indexCount; - this._rayMMatrix = (0, _glMatrix.mat4).create(); - const rayVertices = (0, _cubeJs.Cube).POSITIONS; - this._rayVertices = new ArrayBuffer((0, _vertexJs.PositionColorVertex).SIZE_BYTES * rayVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const rayVerticesView = new DataView(this._rayVertices); - const rayIndices = (0, _cubeJs.Cube).INDICES; - this._rayIndices = new Uint16Array(rayIndices); - const rayVertexCount = rayVertices.length / (0, _vertexJs.PositionVertex).SIZE; - this._rayIndexCount = rayIndices.length; - for(let i = 0; i < rayVertexCount; i++){ - (0, _glMatrix.vec3).set(_vec3, rayVertices[i * (0, _vertexJs.PositionVertex).SIZE], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _vertexJs.PositionColorVertex).setPosition(rayVerticesView, i, _vec3); - (0, _vertexJs.PositionColorVertex).setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); - } - const rayThickness = 0.0025; - const rayLength = 10; - (0, _glMatrix.vec3).set(_vec3, rayThickness, rayThickness, rayLength); - (0, _glMatrix.mat4).fromScaling(this._rayMMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, -0.5); - (0, _glMatrix.mat4).translate(this._rayMMatrix, this._rayMMatrix, _vec3); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "controller initialized"); - } - update(elapsedTime) {} -} - -},{"../main.js":"f421K","../helpers/obj.js":"kBT24","gl-matrix":"5x28d","../meshes/cube.js":"79I5N","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBT24":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ObjMesh", ()=>ObjMesh); -parcelHelpers.export(exports, "ObjHelper", ()=>ObjHelper); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class ObjMesh { -} -class ObjHelper { - constructor(core){ - this._core = core; - } - read(data) { - const start = window.performance.now(); - const indices = []; - const positions = []; - const normals = []; - const texCoords = []; - const meshes = []; - const indexOffsets = []; - const indexCounts = []; - const faceLookup = {}; - const lines = data.split("\n"); - let faceCount = 0; - for(let i = 0; i < lines.length; i++){ - const parts = lines[i].trim().split(" "); - if (parts.length > 0) switch(parts[0]){ - case "o": - meshes.push(parts[1]); - indexOffsets.push(indices.length); - break; - case "v": - positions.push(parseFloat(parts[1])); - positions.push(parseFloat(parts[2])); - positions.push(parseFloat(parts[3])); - break; - case "vt": - texCoords.push(parseFloat(parts[1])); - texCoords.push(parseFloat(parts[2])); - break; - case "vn": - normals.push(parseFloat(parts[1])); - normals.push(parseFloat(parts[2])); - normals.push(parseFloat(parts[3])); - break; - case "f": - for(let i = 0; i < parts.length - 1; i++){ - const part = parts[i + 1]; - if (faceLookup[part] == undefined) faceLookup[part] = faceCount++; - indices.push(faceLookup[part]); - } - break; - case "usemtl": - case "mtllib": - default: - break; - } - } - for(let i = 0; i < meshes.length - 1; i++)indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); - indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * Object.keys(faceLookup).length); - const dataView = new DataView(vertices); - let minX = Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let minZ = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - let maxZ = -Number.MAX_VALUE; - const faces = Object.keys(faceLookup); - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - let hasTexCoords, hasNormals; - if (faces.length > 0) { - const faceParts = faces[0].split("/"); - hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); - hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); - } - for(let i = 0; i < faces.length; i++){ - const faceParts = faces[i].split("/"); - let index = (parseInt(faceParts[0]) - 1) * 3; - const x = positions[index]; - const y = positions[index + 1]; - const z = positions[index + 2]; - (0, _glMatrix.vec3).set(_vec3, x, y, z); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(dataView, i, _vec3); - minX = Math.min(x, minX); - minY = Math.min(y, minY); - minZ = Math.min(z, minZ); - maxX = Math.max(x, maxX); - maxY = Math.max(y, maxY); - maxZ = Math.max(z, maxZ); - if (hasNormals) { - index = (parseInt(faceParts[2]) - 1) * 3; - (0, _glMatrix.vec3).set(_vec3, normals[index], normals[index + 1], normals[index + 2]); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(dataView, i, _vec3); - } - if (hasTexCoords) { - index = (parseInt(faceParts[1]) - 1) * 2; - (0, _glMatrix.vec2).set(_vec2, texCoords[index], texCoords[index + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(dataView, i, _vec2); - } - } - const originX = (minX + maxX) / 2; - const originY = (minY + maxY) / 2; - const originZ = (minZ + maxZ) / 2; - const objMesh = new ObjMesh(); - objMesh.vertices = vertices; - objMesh.indices = new Uint16Array(indices); - objMesh.meshes = meshes; - objMesh.indexOffsets = indexOffsets; - objMesh.indexCounts = indexCounts; - objMesh.indexCount = indices.length; - objMesh.minX = minX; - objMesh.minY = minY; - objMesh.minZ = minZ; - objMesh.maxX = maxX; - objMesh.maxY = maxY; - objMesh.maxZ = maxZ; - objMesh.originX = originX; - objMesh.originY = originY; - objMesh.originZ = originZ; - this._core.log.write((0, _mainJs.LogLevel).info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); - return objMesh; - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4J2YE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PositionVertex", ()=>PositionVertex); -parcelHelpers.export(exports, "PositionColorVertex", ()=>PositionColorVertex); -parcelHelpers.export(exports, "PositionTextureVertex", ()=>PositionTextureVertex); -parcelHelpers.export(exports, "PositionTexturePickVertex", ()=>PositionTexturePickVertex); -parcelHelpers.export(exports, "PositionNormalVertex", ()=>PositionNormalVertex); -parcelHelpers.export(exports, "PositionNormalColorVertex", ()=>PositionNormalColorVertex); -parcelHelpers.export(exports, "PositionNormalTextureVertex", ()=>PositionNormalTextureVertex); -parcelHelpers.export(exports, "PickGridVertex", ()=>PickGridVertex); -parcelHelpers.export(exports, "UnitVertex", ()=>UnitVertex); -var _glMatrix = require("gl-matrix"); -class PositionVertex { - static getPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - (0, _glMatrix.vec3).set(value, buffer[offset], buffer[offset + 1], buffer[offset + 2]); - } - static setPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - buffer[offset] = value[0]; - buffer[offset + 1] = value[1]; - buffer[offset + 2] = value[2]; - } -} -PositionVertex.SIZE = 3; -PositionVertex.SIZE_BYTES = 12; -class PositionColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionColorVertex.SIZE_BYTES = 16; -PositionColorVertex.POSITION_OFFSET_BYTES = 0; -PositionColorVertex.COLOR_OFFSET_BYTES = 12; -class PositionTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionTextureVertex.SIZE_BYTES = 16; -PositionTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; -class PositionTexturePickVertex { - static getPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } -} -PositionTexturePickVertex.SIZE_BYTES = 20; -PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; -PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; -PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; -class PositionNormalVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } -} -PositionNormalVertex.SIZE_BYTES = 16; -PositionNormalVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalVertex.NORMAL_OFFSET_BYTES = 12; -class PositionNormalColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionNormalColorVertex.SIZE_BYTES = 20; -PositionNormalColorVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalColorVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalColorVertex.COLOR_OFFSET_BYTES = 16; -class PositionNormalTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionNormalTextureVertex.SIZE_BYTES = 20; -PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; -class PickGridVertex { - static getTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF, bufferView.getUint16(offset + 4, true) / 0xFFFF, bufferView.getUint16(offset + 6, true) / 0xFFFF); - } - static setBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - bufferView.setUint16(offset + 4, value[2] * 0xFFFF, true); - bufferView.setUint16(offset + 6, value[3] * 0xFFFF, true); - } -} -PickGridVertex.SIZE_BYTES = 32; -PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; -PickGridVertex.NORMAL_OFFSET_BYTES = 12; -PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; -PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; -PickGridVertex.BOUNDS_OFFSET_BYTES = 24; -class UnitVertex { - static getIdHover(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, true); - } - static setIdHover(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, value, true); + return out; + } + function clone$1(a2) { + var out = new ARRAY_TYPE(2); + out[0] = a2[0]; + out[1] = a2[1]; + return out; + } + function fromValues(x2, y2) { + var out = new ARRAY_TYPE(2); + out[0] = x2; + out[1] = y2; + return out; + } + function copy$3(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + return out; + } + function set$5(out, x2, y2) { + out[0] = x2; + out[1] = y2; + return out; + } + function transformMat4(out, a2, m2) { + var x2 = a2[0]; + var y2 = a2[1]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[12]; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[13]; + return out; + } + function equals(a2, b2) { + var a0 = a2[0], a1 = a2[1]; + var b0 = b2[0], b1 = b2[1]; + return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + (function() { + var vec2 = create$3(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 2; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + } + return a2; + }; + })(); + let Constants$1 = class Constants { + }; + Constants$1.TWO_PI = 6.283185307179586; + Constants$1.PI = 3.141592653589793; + Constants$1.PI_OVER_TWO = 1.5707963267948966; + Constants$1.PI_OVER_THREE = 1.0471975511965976; + Constants$1.PI_OVER_FOUR = 0.7853981633974483; + Constants$1.PI_OVER_SIX = 0.5235987755982988; + Constants$1.LOG_2 = 0.6931471805599453; + Constants$1.RADIANS_PER_DEGREE = 0.017453292519943295; + Constants$1.DEGREES_PER_RADIAN = 57.29577951308232; + Constants$1.ROOT_TWO = 1.4142135623730951; + Constants$1.ROOT_TWO_OVER_TWO = 0.7071067811865476; + Constants$1.ROOT_THREE = 1.7320508075688772; + Constants$1.ROOT_THREE_OVER_TWO = 0.8660254037844386; + Constants$1.ROOT_THREE_OVER_THREE = 0.5773502691896257; + Constants$1.VECTOR2_ZERO = fromValues(0, 0); + Constants$1.VECTOR2_ONE = fromValues(1, 1); + Constants$1.VECTOR2_UNITX = fromValues(1, 0); + Constants$1.VECTOR2_UNITY = fromValues(0, 1); + Constants$1.VECTOR3_ZERO = fromValues$3(0, 0, 0); + Constants$1.VECTOR3_ONE = fromValues$3(1, 1, 1); + Constants$1.VECTOR3_UNITX = fromValues$3(1, 0, 0); + Constants$1.VECTOR3_UNITY = fromValues$3(0, 1, 0); + Constants$1.VECTOR3_UNITZ = fromValues$3(0, 0, 1); + Constants$1.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); + Constants$1.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); + Constants$1.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); + Constants$1.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); + Constants$1.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); + Constants$1.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); + Constants$1.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); + Constants$1.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); + Constants$1.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); + Constants$1.MAT3_IDENTITY = create$8(); + Constants$1.MAT4_IDENTITY = create$7(); + Constants$1.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + Constants$1.QUAT_IDENTITY = create$4(); + Constants$1.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants$1.ROOT_TWO_OVER_TWO, 0, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants$1.ROOT_TWO_OVER_TWO, 0, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.MILLISECONDS_PER_DAY = 864e5; + class MathHelper { + static simpleLinearRegression(points2) { + const n = points2.length; + let sumX = 0; + let sumY = 0; + let sumXY = 0; + let sumXX = 0; + for (let i = 0; i < n; i++) { + sumX += points2[i].x; + sumY += points2[i].y; + sumXY += points2[i].x * points2[i].y; + sumXX += points2[i].x * points2[i].x; + } + const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); + const yIntercept = (sumY - slope * sumX) / n; + return { slope, yIntercept }; } - static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); + static clamp(value2, min2, max2) { + return Math.max(Math.min(value2, max2), min2); } - static getTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + static lerp(value1, value2, amount) { + return value1 + (value2 - value1) * amount; } - static setTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + static normalize(value2, min2, max2, from = 0, to = 1) { + return max2 - min2 == 0 ? 0 : Math.max(Math.min((to - from) * (value2 - min2) / (max2 - min2) + from, to), from); } - static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + static splitExponent(value2, result) { + let exponent2 = Math.round(Math.log10(Math.abs(value2))); + let coefficient = value2 / Math.pow(10, exponent2); + if (coefficient < 1) { + coefficient *= 10; + exponent2--; + } + result[0] = coefficient; + result[1] = exponent2; } - static getColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF); + static combineExponent(mantissa, exponent2) { + return mantissa * Math.pow(10, exponent2); } - static setColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); + static isPowerOf2(value2) { + return (value2 & value2 - 1) == 0; } - static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; - toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); - toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + } + class PseudoRandom { + constructor(seed) { + this._seed = seed % 2147483647; + if (this._seed <= 0) + this._seed += 2147483646; } - static getOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true)); + next() { + return this._seed = this._seed * 16807 % 2147483647; } - static setOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); + nextFloat() { + return (this.next() - 1) / 2147483646; } - static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + nextInteger(min2, max2) { + return Math.floor(this.nextFloat() * (max2 - min2 + 1) + min2); } - static getScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + class AngleHelper { + static degreesToRadians(degrees2) { + return degrees2 * Constants$1.RADIANS_PER_DEGREE; + } + static radiansToDegrees(radians2) { + return radians2 * Constants$1.DEGREES_PER_RADIAN; + } + static wrapAngle(angle2) { + if (angle2 > Constants$1.PI) + angle2 = angle2 - Constants$1.TWO_PI; + else if (angle2 < -Constants$1.PI) + angle2 += Constants$1.TWO_PI; + return angle2; + } + static sphericalToCartesian(altitude, longitude2, latitude, result) { + latitude = AngleHelper.degreesToRadians(latitude); + longitude2 = AngleHelper.degreesToRadians(longitude2); + const scale2 = Math.cos(latitude); + result[0] = altitude * scale2 * Math.sin(longitude2); + result[1] = altitude * Math.sin(latitude); + result[2] = altitude * scale2 * Math.cos(longitude2); + } + static cartesianToSpherical(x2, y2, z2, result) { + result[0] = Math.atan2(x2, z2); + result[1] = Math.asin(y2); } - static setScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + static angleBetweenVectors(from, to) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + return Math.acos(dot2); + } } - static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + static signedAngleBetweenVectors(from, to, up) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + let angle2 = Math.acos(dot2); + cross$1(AngleHelper._vec3, from, to); + if (dot$1(AngleHelper._vec3, up) < 0) { + angle2 = -angle2; + } + return angle2; + } } - static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + } + AngleHelper._vec3 = create$6(); + class CameraBase { + getView(view) { + this.getPosition(view.position); } - static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getSelected(bufferView, index) { - return bufferView.getInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES) / 0x7F; - } - static setSelected(bufferView, index, value) { - bufferView.setInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES, value * 0x7F); + setView(view, isSmooth) { + this.setPosition(view.position, isSmooth); } - static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); + lerpView(from, to, time2) { + lerp$1(this._vec3, from.position, to.position, time2); + this.setPosition(this._vec3, false); } - static getRounding(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, true); + get vMatrices() { + return this._vMatrices; } - static setRounding(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, value, true); + get inverseVMatrices() { + return this._inverseVMatrices; } - static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); + get mvMatrices() { + return this._mvMatrices; } - static getParameter1(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, true); + get pMatrices() { + return this._pMatrices; } - static setParameter1(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, value, true); + get inversePMatrices() { + return this._inversePMatrices; } - static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); + get pickVMatrix() { + return this._pickVMatrix; } - static getParameter2(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, true); + get rMatrix() { + return this._mat3; } - static setParameter2(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, value, true); + getOrbit(value2) { + copy$4(value2, this._orbitRotation); } - static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); + setOrbit(value2, isSmooth) { + copy$4(this._orbitRotation, value2); + if (!isSmooth) { + copy$4(this._smoothedOrbitRotation, value2); + } } - static getMaterial(bufferView, index) { - return bufferView.getUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES); + getPosition(value2) { + copy$6(value2, this._cameraPosition); } - static setMaterial(bufferView, index, value) { - bufferView.setUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES, value); + setPosition(value2, isSmooth) { + copy$6(this._cameraPosition, value2); + if (!isSmooth) { + copy$6(this._smoothedCameraPosition, value2); + } } - static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); + constructor(core) { + this._core = core; + this._vec3 = create$6(); + this._quat = create$4(); + this._mat3 = create$8(); + this._right = create$6(); + this._up = create$6(); + this._forward = create$6(); + this._modelManipulationOrigin = create$6(); + this.modelPosition = create$6(); + this.modelScale = create$6(); + this.modelRotation = create$4(); + this._orbitRotation = create$4(); + this._orbitDirection = create$4(); + this._smoothedOrbitRotation = create$4(); + this._smoothedCameraPosition = create$6(); + this._smoothedCameraRotation = create$4(); + this._cameraPosition = create$6(); + this._cameraRotation = create$4(); + this._combinedPosition = create$6(); + this._combinedRotation = create$4(); + this._leftToRightEye = create$6(); + this._pickVMatrix = create$7(); + this._eyePositions = [create$6(), create$6()]; + this._vMatrices = [create$7(), create$7()]; + this._mvMatrices = [create$7(), create$7()]; + this._pMatrices = [create$7(), create$7()]; + this._inverseVMatrices = [create$7(), create$7()]; + this._inversePMatrices = [create$7(), create$7()]; } - static getTexture(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES); + reset(isSmooth) { + copy$6(this._cameraPosition, Constants$1.VECTOR3_ZERO); + copy$4(this._cameraRotation, Constants$1.QUAT_IDENTITY); + copy$4(this._orbitRotation, Constants$1.QUAT_IDENTITY); + if (!isSmooth) { + this.syncSmooth(); + } } - static setTexture(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES, value); + update(elapsedTime) { + let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); + lerp$1(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); + amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); + slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); + slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); + const epsilon3 = 1e-6; + let x2; + let y2; + let z2; + let w2; + x2 = this._smoothedCameraPosition[0] - this._cameraPosition[0]; + y2 = this._smoothedCameraPosition[1] - this._cameraPosition[1]; + z2 = this._smoothedCameraPosition[2] - this._cameraPosition[2]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3) { + copy$6(this._smoothedCameraPosition, this._cameraPosition); + } + x2 = this._smoothedCameraRotation[0] - this._cameraRotation[0]; + y2 = this._smoothedCameraRotation[1] - this._cameraRotation[1]; + z2 = this._smoothedCameraRotation[2] - this._cameraRotation[2]; + w2 = this._smoothedCameraRotation[3] - this._cameraRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$4(this._smoothedCameraRotation, this._cameraRotation); + } + x2 = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; + y2 = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; + z2 = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; + w2 = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$4(this._smoothedOrbitRotation, this._orbitRotation); + } + normalize$3(this._smoothedCameraRotation, this._smoothedCameraRotation); + normalize$3(this._smoothedOrbitRotation, this._smoothedOrbitRotation); + conjugate(this._orbitDirection, this._smoothedOrbitRotation); + transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); + subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); + transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); + add$4(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); + multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); + fromQuat$1(this._mat3, this._combinedRotation); + this._right[0] = this._mat3[0]; + this._right[1] = this._mat3[1]; + this._right[2] = this._mat3[2]; + this._up[0] = this._mat3[3]; + this._up[1] = this._mat3[4]; + this._up[2] = this._mat3[5]; + this._forward[0] = this._mat3[6]; + this._forward[1] = this._mat3[7]; + this._forward[2] = this._mat3[8]; + const view = this._vMatrices[0]; + view[0] = this._right[0]; + view[1] = this._up[0]; + view[2] = this._forward[0]; + view[4] = this._right[1]; + view[5] = this._up[1]; + view[6] = this._forward[1]; + view[8] = this._right[2]; + view[9] = this._up[2]; + view[10] = this._forward[2]; + view[12] = -dot$1(this._right, this._combinedPosition); + view[13] = -dot$1(this._up, this._combinedPosition); + view[14] = -dot$1(this._forward, this._combinedPosition); + const aspectRatio = this.width / this.height; + if (this._core.config.stereoMode == StereoMode.none) { + if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + const left = -aspectRatio * top; + const right = aspectRatio * top; + const width2 = right - left; + const height2 = top - bottom; + const tileWidth = width2 / this._core.config.tilesX; + const tileHeight = height2 / this._core.config.tilesY; + frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); + } else { + perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); + } + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + invert$1(this._inverseVMatrices[0], this.vMatrices[0]); + invert$1(this._inversePMatrices[0], this.pMatrices[0]); + } else { + cross$1(this._leftToRightEye, this._forward, this._up); + normalize$5(this._leftToRightEye, this._leftToRightEye); + scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); + scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); + this._vMatrices[0][12] += this._core.config.ipd * 0.5; + copy$7(this._vMatrices[1], this._vMatrices[0]); + this._vMatrices[1][12] -= this._core.config.ipd; + const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + let left = -aspectRatio * top + frustumShift; + let right = aspectRatio * top + frustumShift; + frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + left = -aspectRatio * top - frustumShift; + right = aspectRatio * top - frustumShift; + frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); + invert$1(this._inverseVMatrices[0], this._vMatrices[0]); + invert$1(this._inversePMatrices[0], this._pMatrices[0]); + copy$7(this._inverseVMatrices[1], this._inverseVMatrices[0]); + this._inverseVMatrices[1][12] += this._core.config.ipd; + invert$1(this._inversePMatrices[1], this._pMatrices[1]); + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } } - static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); + _zoom(direction, distance2) { + scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance2); } - static getSdfBuffer(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES); + rotate(translationDelta) { } - static setSdfBuffer(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES, value); + zoom(zoomDelta, x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + normalize$5(this._vec3, this._vec3); + const distance$1 = zoomDelta * distance(this._combinedPosition, this.modelPosition); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + this._zoom(this._vec3, distance$1); } - static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); + _twist(axis, angle2) { } - static getSdfBorder(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES); + twist(angle2, x2, y2) { } - static setSdfBorder(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES, value); + updatePickVMatrix(x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); } - static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); - } -} -UnitVertex.SIZE_BYTES = 92; -UnitVertex.ID_HOVER_OFFSET_BYTES = 0; -UnitVertex.ID_COLOR_OFFSET_BYTES = 4; -UnitVertex.ORDER_OFFSET_BYTES = 8; -UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; -UnitVertex.SELECTED_OFFSET_BYTES = 80; -UnitVertex.TRANSLATION_OFFSET_BYTES = 16; -UnitVertex.COLOR_OFFSET_BYTES = 28; -UnitVertex.MATERIAL_OFFSET_BYTES = 30; -UnitVertex.SCALE_OFFSET_BYTES = 32; -UnitVertex.ROUNDING_OFFSET_BYTES = 44; -UnitVertex.ROTATION_OFFSET_BYTES = 48; -UnitVertex.TEXCOORD_OFFSET_BYTES = 64; -UnitVertex.TEXTURE_OFFSET_BYTES = 81; -UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; -UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; -UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; -UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"79I5N":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class Cube { -} -Cube.POSITIONS = new Float32Array([ - -0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - 0.5, - -0.5, - 0.5, - -0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - -0.5, - -0.5, - -0.5 -]); -Cube.INDICES = new Uint16Array([ - 5, - 4, - 1, - 0, - 3, - 4, - 7, - 5, - 6, - 1, - 2, - 3, - 6, - 7 -]); -Cube.CUBE_MAP_INDICES = new Uint16Array([ - 2, - 3, - 1, - 0, - 4, - 3, - 7, - 2, - 6, - 1, - 5, - 4, - 6, - 7 -]); -Cube.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Cube.FACE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0.0, 0.5, 0.0), - (0, _glMatrix.vec3).fromValues(0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, -0.5, 0.0), - (0, _glMatrix.vec3).fromValues(-0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, 0.5), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, -0.5) -]; -Cube.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, -1, 0, 1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, -1, 0, 1, 0, 1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, 1, 0, -1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, 1, 0, 1, 0, -1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Cube.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, 0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0.5) -]; -Cube.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; -Cube.EDGE_CORNERS = [ - [ - 0, - 1 - ], - [ - 1, - 5 - ], - [ - 4, - 5 - ], - [ - 0, - 4 - ], - [ - 2, - 3 - ], - [ - 2, - 6 - ], - [ - 6, - 7 - ], - [ - 3, - 7 - ], - [ - 1, - 2 - ], - [ - 5, - 6 - ], - [ - 4, - 7 - ], - [ - 0, - 3 - ] -]; -Cube.EDGE_FACES = [ - [ - 0, - 4 - ], - [ - 0, - 1 - ], - [ - 0, - 5 - ], - [ - 0, - 3 - ], - [ - 2, - 4 - ], - [ - 2, - 1 - ], - [ - 2, - 5 - ], - [ - 2, - 3 - ], - [ - 1, - 4 - ], - [ - 1, - 5 - ], - [ - 3, - 5 - ], - [ - 3, - 4 - ] -]; -Cube.EDGE_AXIS = [ - 0, - 2, - 0, - 2, - 0, - 2, - 0, - 2, - 1, - 1, - 1, - 1 -]; -Cube.AXIS_EDGES = [ - [ - 0, - 2, - 4, - 6 - ], - [ - 8, - 9, - 10, - 11 - ], - [ - 1, - 3, - 5, - 7 - ] -]; -Cube.AXIS_FACES = [ - [ - 1, - 3 - ], - [ - 0, - 2 - ], - [ - 4, - 5 - ] -]; -Cube.OPPOSITE_FACES = [ - 2, - 3, - 0, - 1, - 5, - 4 -]; -Cube.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Cube.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7gWc5":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MatrixHelper", ()=>MatrixHelper); -class MatrixHelper { - static fieldOfViewFromProjectionMatrix(p) { - return 2 * Math.atan(1 / p[5]); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jfjef":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>Cartesian3dAxesHelper); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>Cartesian3dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _cubeJs = require("../../meshes/cube.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian3dAxesHelper { - static create(core, options) { - const cartesian3dAxes = new Cartesian3dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const minValueZ = options.minValueZ === undefined ? 0 : options.minValueZ; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const maxValueZ = options.maxValueZ === undefined ? 1 : options.maxValueZ; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian3dAxes.minBoundsX = minBoundsX; - cartesian3dAxes.minBoundsY = minBoundsY; - cartesian3dAxes.minBoundsZ = minBoundsZ; - cartesian3dAxes.maxBoundsX = maxBoundsX; - cartesian3dAxes.maxBoundsY = maxBoundsY; - cartesian3dAxes.maxBoundsZ = maxBoundsZ; - cartesian3dAxes.scalingX = scaling; - cartesian3dAxes.scalingY = scaling; - cartesian3dAxes.scalingZ = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, Math.max(maxBoundsY - minBoundsY, maxBoundsZ - minBoundsZ)); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY, - options.divisionsZ == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsZ - minBoundsZ) / maxLength), 1) : options.divisionsZ - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY, - options.minorGridlinesZ == undefined ? 2 : options.minorGridlinesZ - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY, - options.labelMajorSizeZ === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeZ - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY, - options.labelMinorSizeZ === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeZ - ]; - cartesian3dAxes.isDiscreteX = options.isDiscreteX; - cartesian3dAxes.isDiscreteY = options.isDiscreteY; - cartesian3dAxes.isDiscreteZ = options.isDiscreteZ; - cartesian3dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY, - options.isDivisionPickingEnabledZ - ]; - const isLabelPickingEnabledArray = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY, - options.isLabelPickingEnabledZ - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY, - options.reverseZ - ]; - const labelsArray = [ - options.labelsX, - options.labelsY, - options.labelsZ - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY, - options.labelOrientationZ - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const areTicksVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY, - options.arePickDivisionsVisibleZ - ]; - const minValueArray = [ - minValueX, - minValueY, - minValueZ - ]; - const maxValueArray = [ - maxValueX, - maxValueY, - maxValueZ - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY, - options.isDiscreteZ - ]; - const titleArray = [ - options.titleX, - options.titleY, - options.titleZ - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY, - options.titleSizeZ - ]; - const headingArray = [ - options.headingX, - options.headingY, - options.headingZ - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY, - options.headingSizeZ - ]; - for(let axisId = 0; axisId < 3; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian3dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian3dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian3dAxes.setLabels(axisId, discreteAxis.labels); - cartesian3dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian3dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian3dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian3dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian3dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabels(axisId, continuousAxis.labels); - cartesian3dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian3dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian3dAxes.setLabelSizes(axisId, labelSizes); - cartesian3dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian3dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian3dAxes.setTitle(axisId, titleArray[axisId]); - cartesian3dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian3dAxes.setHeading(axisId, headingArray[axisId]); - cartesian3dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian3dAxes.arePickDivisionsVisible[axisId] = areTicksVisibleArray[axisId] === undefined ? true : areTicksVisibleArray[axisId]; - cartesian3dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian3dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabledArray[axisId]; - cartesian3dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian3dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian3dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian3dAxes; - } -} -class Cartesian3dAxes extends (0, _axesJs.AxesBase) { - get size() { - return this._size; + syncSmooth() { + copy$6(this._smoothedCameraPosition, this._cameraPosition); + copy$4(this._smoothedCameraRotation, this._cameraRotation); + copy$4(this._smoothedOrbitRotation, this._orbitRotation); } - get isDiscreteX() { - return this._isDiscrete[0]; + updateModelManipulationOrigin(from, to) { + const a2 = create$6(); + const b2 = create$6(); + const c2 = create$6(); + const d2 = create$6(); + transformMat4$2(a2, from, this.modelMMatrix); + transformMat4$2(b2, to, this.modelMMatrix); + subtract(a2, this._cameraPosition, a2); + subtract(b2, this._cameraPosition, b2); + transformQuat(c2, a2, this._orbitDirection); + transformQuat(d2, b2, this._orbitDirection); + subtract(c2, c2, a2); + subtract(d2, d2, b2); + subtract(this._vec3, c2, d2); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + add$4(this._cameraPosition, this._cameraPosition, this._vec3); + add$4(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); + } + unproject(position2, x2, y2, z2) { + set$8(position2, 2 * x2 / this.width - 1, 1 - 2 * y2 / this.height, z2); + transformMat4$2(position2, position2, this._inversePMatrices[0]); + transformMat4$2(position2, position2, this._inverseVMatrices[0]); } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } + translate(translationDelta) { + const distance$1 = distance(this.modelPosition, this._combinedPosition); + const height2 = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; + set$8(this._vec3, height2 * translationDelta[0], -height2 * translationDelta[1], 0); + transformQuat(this._vec3, this._vec3, this._combinedRotation); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + subtract(this._cameraPosition, this._cameraPosition, this._vec3); } - get isDiscreteY() { - return this._isDiscrete[1]; + } + class AltAzimuthCamera extends CameraBase { + getView(view) { + super.getView(view); + view.altitude = this.altitude; + view.azimuth = this.azimuth; + view.fov = this._core.config.fov; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } + setView(view, isSmooth) { + super.setView(view, isSmooth); + this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); + this._core.config.fov = view.fov; } - get isDiscreteZ() { - return this._isDiscrete[2]; + lerpView(from, to, time2) { + super.lerpView(from, to, time2); + this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time2), MathHelper.lerp(from.azimuth, to.azimuth, time2), false); + this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time2); } - set isDiscreteZ(value) { - if (value != this._isDiscrete[2]) { - this._isDiscrete[2] = value; - this._hasChanged = true; - } + update(elapsedTime) { + super.update(elapsedTime); + if (this._core.config.isDebugVisible) { + const altitude = AngleHelper.radiansToDegrees(this.altitude); + const azimuth = AngleHelper.radiansToDegrees(this.azimuth); + this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); + this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + } } - get minBoundsX() { - return this._minBoundsX; + get altitude() { + transformQuat(this._up, Constants$1.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants$1.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants$1.VECTOR3_UNITY, this._up, this._right); } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + get azimuth() { + transformQuat(this._up, Constants$1.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants$1.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants$1.VECTOR3_UNITX, this._right, this._up); } - get maxBoundsX() { - return this._maxBoundsX; + setAltAzimuth(altitude, azimuth, isSmooth) { + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITX, altitude); + multiply(this._orbitRotation, this._quat, Constants$1.QUAT_IDENTITY); + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITY, azimuth); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + if (!isSmooth) { + this.syncSmooth(); + } } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + rotate(translationDelta) { + const length2 = Math.min(this.width, this.height); + let angle2 = translationDelta[1] * Constants$1.PI / length2; + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITX, angle2); + multiply(this._orbitRotation, this._quat, this._orbitRotation); + angle2 = translationDelta[0] * Constants$1.PI / length2; + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITY, angle2); + multiply(this._orbitRotation, this._orbitRotation, this._quat); } - get minBoundsY() { - return this._minBoundsY; + } + let Config$2 = class Config { + constructor(core) { + this.reset(); } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; + reset() { + this.isDebugVisible = false; + this.logLevel = LogLevel.warn; + this.shaderPath = "shaders"; + this.fontPath = "fonts"; + this.modelDistance = 0.5; + this.modelSize = 0.25; + this.stereoMode = StereoMode.none; + this.ipd = 0.06; + this.screenDistance = 0.5; + this.fov = AngleHelper.degreesToRadians(30); + this.nearPlane = 0.01; + this.farPlane = 100; + this.pickWidth = 512; + this.pickHeight = 512; + this.pickHoldDelay = 1e3; + this.pickSelectDelay = 100; + this.resizeMinimumDelay = 250; + this.rotationSmoothing = 0.02; + this.positionSmoothing = 0.02; + this.focusSmoothing = 0.01; + this.scaleSmoothing = 0.02; + this.mouseWheelZoomScale = -2e-3; + this.mouseWheelRotationScale = -2e-3; + this.dragToleranceSquared = 100; + this.manipulatorMinRelativeDistanceSquared = 100; + this.isMultiTouchEnabled = true; + this.isMultiTouchZoomEnabled = true; + this.isMultiTouchTwistEnabled = true; + this.isMultiTouchRotateEnabled = true; + this.isMultiTouchTranslateEnabled = true; + this.multiTouchZoomScale = 1; + this.cameraMinDistance = 0.1; + this.cameraMaxDistance = 10; + this.xrControllerRayColor = fromValues$3(0.5, 0.5, 0.5); + this.xrControllerProfile = "windows-mixed-reality"; + this.xrControllerHandedness = "right"; + this.paletteColor = new Uint8Array([128, 128, 128, 0]); + this.textColor = create$6(); + this.textHoverColor = create$6(); + this.textBorderColor = create$6(); + this.textBorderWidth = 24 / 255; + this.identityRotation = Constants$1.VECTOR3_UNITY; + this.axesTextLabelMaxGlyphs = 32; + this.axesTextColor = create$6(); + this.axesTextBorderColor = create$6(); + this.axesTextHoverColor = create$6(); + this.axesTextLabelMajorSize = 0.03; + this.axesTextLabelMinorSize = 0.02; + this.axesTextTitleMaxGlyphs = 127; + this.axesTextTitleSize = 0.05; + this.axesTextHeadingMaxGlyphs = 128; + this.axesTextHeadingSize = 0.075; + this.axesTextTitleLineHeight = 1.5; + this.axesTextHeadingLineHeight = 1.5; + this.axesTextLabelLineHeight = 1.5; + this.axesGridMajorThickness = 2e-4; + this.axesGridMinorThickness = 1e-4; + this.axesGridZeroThickness = 2e-3; + this.axesGridPickDivisionHeight = 0.025; + this.axesGridBackgroundColor = create$6(); + this.axesGridHighlightColor = create$6(); + this.axesGridMinorColor = create$6(); + this.axesGridMajorColor = create$6(); + this.axesGridZeroColor = create$6(); + this.axesGridDefaultDivisions = 10; + this.keyTitleMaxGlyphs = 64; + this.keyLabelMaxGlyphs = 64; + this.selectionColor = create$6(); + this.hoverColor = create$6(); + this.activeColor = create$6(); + this.highlightMode = HighlightMode.color; + this.lassoThickness = 4; + this.lassoDashWidth = 2; + this.lassoColor = create$6(); + this.minCubifiedTreeMapSlice = 0.01; + this.sdfBuffer = 192; + this.sdfBorder = 0; + this.forceDirectIsEnabled = false; + this.forceDirectAttraction = 1; + this.forceDirectRepulsion = 1; + this.forceDirectGravity = 1; + this.forceDirectInterval = 0.1; + this.forceDirectMaxDistance = 0.1; + this.forceDirectTheta = 1; + this.forceDirectIterationsPerLayout = 1; + this.forceDirectEdgeWeightPower = 1; + this.forceDirectLockX = false; + this.forceDirectLockY = false; + this.forceDirectLockZ = false; + this.transitionDuration = 400; + this.transitionStaggering = 100; + this.transitionView = true; + this.isTransitionPickingEnabled = false; + this.backgroundColor = create$5(); + this.theme = Theme.light; + this.ambientColor = create$6(); + this.renderMode = RenderMode.color; + this.tilesX = 1; + this.tilesY = 1; + this.tileOffsetX = 0; + this.tileOffsetY = 0; + } + get theme() { + return this._theme; + } + set theme(value2) { + if (this._theme != value2) { + this._theme = value2; + switch (value2) { + case Theme.dark: + set$7(this.backgroundColor, 0, 0, 0, 1); + set$8(this.textColor, 0.9, 0.9, 0.9); + set$8(this.textHoverColor, 1, 1, 1); + set$8(this.textBorderColor, 0, 0, 0); + set$8(this.axesTextColor, 0.9, 0.9, 0.9); + set$8(this.axesTextBorderColor, 0, 0, 0); + set$8(this.axesTextHoverColor, 1, 1, 1); + set$8(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); + set$8(this.axesGridHighlightColor, 0.04, 0.04, 0.04); + set$8(this.axesGridMinorColor, 0.05, 0.05, 0.05); + set$8(this.axesGridMajorColor, 0.1, 0.1, 0.1); + set$8(this.axesGridZeroColor, 0.05, 0.1, 0.1); + set$8(this.selectionColor, 1, 1, 0); + set$8(this.hoverColor, 1, 0, 1); + set$8(this.activeColor, 0, 1, 1); + set$8(this.lassoColor, 0.9, 0.9, 0.9); + break; + case Theme.light: + set$7(this.backgroundColor, 1, 1, 1, 1); + set$8(this.textColor, 0, 0, 0); + set$8(this.textHoverColor, 0.1, 0.1, 0.1); + set$8(this.textBorderColor, 1, 1, 1); + set$8(this.axesTextColor, 0, 0, 0); + set$8(this.axesTextBorderColor, 1, 1, 1); + set$8(this.axesTextHoverColor, 0.1, 0.1, 0.1); + set$8(this.axesGridBackgroundColor, 1, 1, 1); + set$8(this.axesGridHighlightColor, 0.925, 0.925, 0.925); + set$8(this.axesGridMinorColor, 0.9, 0.9, 0.9); + set$8(this.axesGridMajorColor, 0.8, 0.8, 0.8); + set$8(this.axesGridZeroColor, 0.7, 0.9, 0.9); + set$8(this.selectionColor, 1, 1, 0); + set$8(this.hoverColor, 1, 0, 1); + set$8(this.activeColor, 0, 1, 1); + set$8(this.lassoColor, 0.1, 0.1, 0.1); + break; + } + if (this.themeChangedCallback) { + this.themeChangedCallback(this._theme); } + } + } + }; + class DebugText { + get text() { + return this._text; + } + constructor() { + this.clear(); + } + clear() { + this._text = ""; + } + addLine(value2) { + this._text += value2 + "\n"; + } + } + class Fps { + get frameCounter() { + return this._frameCounter; + } + get totalFrames() { + return this._totalFrames; + } + constructor(core) { + this._core = core; + this._totalFrames = 0; + this.reset(); + } + update(elapsedTime) { + this._elapsedTime += elapsedTime; + if (this._elapsedTime > 1e3) { + this._elapsedTime -= 1e3; + this._fps = this._frameCounter; + this._frameCounter = 0; + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`fps ${this._fps}`); + } + } + render() { + this._frameCounter++; + this._totalFrames++; + } + reset() { + this._fps = 0; + this._frameCounter = 0; + this._elapsedTime = 0; } - get maxBoundsY() { - return this._maxBoundsY; + } + const PaletteType = { + sequentialsinglehue: "sequentialsinglehue", + sequentialmultihue: "sequentialmultihue", + diverging: "diverging", + qualitative: "qualitative" + }; + class PaletteResources { + constructor() { + this.palettes = { + "blues": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 251, 255, 222, 235, 247, 198, 219, 239, 158, 202, 225, 107, 174, 214, 66, 146, 198, 33, 113, 181, 8, 81, 156, 8, 48, 107]) }, + "greens": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 252, 245, 229, 245, 224, 199, 233, 192, 161, 217, 155, 116, 196, 118, 65, 171, 93, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "greys": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 255, 255, 240, 240, 240, 217, 217, 217, 189, 189, 189, 150, 150, 150, 115, 115, 115, 82, 82, 82, 37, 37, 37, 0, 0, 0]) }, + "oranges": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 235, 254, 230, 206, 253, 208, 162, 253, 174, 107, 253, 141, 60, 241, 105, 19, 217, 72, 1, 166, 54, 3, 127, 39, 4]) }, + "purples": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([252, 251, 253, 239, 237, 245, 218, 218, 235, 188, 189, 220, 158, 154, 200, 128, 125, 186, 106, 81, 163, 84, 39, 143, 63, 0, 125]) }, + "reds": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 240, 254, 224, 210, 252, 187, 161, 252, 146, 114, 251, 106, 74, 239, 59, 44, 203, 24, 29, 165, 15, 21, 103, 0, 13]) }, + "viridis": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([72, 37, 117, 65, 68, 135, 53, 96, 141, 42, 120, 142, 33, 145, 141, 34, 168, 132, 67, 191, 113, 122, 209, 81, 188, 223, 39]) }, + "inferno": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([23, 12, 59, 66, 10, 104, 107, 23, 110, 147, 38, 103, 187, 55, 85, 221, 81, 58, 243, 119, 26, 252, 165, 10, 246, 214, 69]) }, + "magma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([21, 14, 55, 59, 15, 112, 101, 26, 128, 140, 41, 129, 182, 55, 122, 222, 73, 104, 247, 111, 92, 254, 159, 109, 254, 206, 145]) }, + "plasma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([66, 3, 157, 106, 0, 168, 144, 13, 164, 177, 42, 144, 203, 71, 121, 225, 100, 98, 242, 131, 76, 252, 166, 54, 252, 206, 37]) }, + "bluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 229, 245, 249, 204, 236, 230, 153, 216, 201, 102, 194, 164, 65, 174, 118, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "bluepurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 224, 236, 244, 191, 211, 230, 158, 188, 218, 140, 150, 198, 140, 107, 177, 136, 65, 157, 129, 15, 124, 77, 0, 75]) }, + "greenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 240, 224, 243, 219, 204, 235, 197, 168, 221, 181, 123, 204, 196, 78, 179, 211, 43, 140, 190, 8, 104, 172, 8, 64, 129]) }, + "orangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 236, 254, 232, 200, 253, 212, 158, 253, 187, 132, 252, 141, 89, 239, 101, 72, 215, 48, 31, 179, 0, 0, 127, 0, 0]) }, + "purpleblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 231, 242, 208, 209, 230, 166, 189, 219, 116, 169, 207, 54, 144, 192, 5, 112, 176, 4, 90, 141, 2, 56, 88]) }, + "purplebluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 226, 240, 208, 209, 230, 166, 189, 219, 103, 169, 207, 54, 144, 192, 2, 129, 138, 1, 108, 89, 1, 70, 54]) }, + "purplered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 244, 249, 231, 225, 239, 212, 185, 218, 201, 148, 199, 223, 101, 176, 231, 41, 138, 206, 18, 86, 152, 0, 67, 103, 0, 31]) }, + "redpurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 243, 253, 224, 221, 252, 197, 192, 250, 159, 181, 247, 104, 161, 221, 52, 151, 174, 1, 126, 122, 1, 119, 73, 0, 106]) }, + "yellowgreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 247, 252, 185, 217, 240, 163, 173, 221, 142, 120, 198, 121, 65, 171, 93, 35, 132, 67, 0, 104, 55, 0, 69, 41]) }, + "yellowgreenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 217, 237, 248, 177, 199, 233, 180, 127, 205, 187, 65, 182, 196, 29, 145, 192, 34, 94, 168, 37, 52, 148, 8, 29, 88]) }, + "yelloworangebrown": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 255, 247, 188, 254, 227, 145, 254, 196, 79, 254, 153, 41, 236, 112, 20, 204, 76, 2, 153, 52, 4, 102, 37, 6]) }, + "yelloworangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 204, 255, 237, 160, 254, 217, 118, 254, 178, 76, 253, 141, 60, 252, 78, 42, 227, 26, 28, 189, 0, 38, 128, 0, 38]) }, + "brownbluegreen": { type: PaletteType.diverging, colors: new Uint8Array([84, 48, 5, 140, 81, 10, 191, 129, 45, 223, 194, 125, 246, 232, 195, 245, 245, 245, 199, 234, 229, 128, 205, 193, 53, 151, 143, 1, 102, 94, 0, 60, 48]) }, + "pinkyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([142, 1, 82, 197, 27, 125, 222, 119, 174, 241, 182, 218, 253, 224, 239, 247, 247, 247, 230, 245, 208, 184, 225, 134, 127, 188, 65, 77, 146, 33, 39, 100, 25]) }, + "purplegreen": { type: PaletteType.diverging, colors: new Uint8Array([64, 0, 75, 118, 42, 131, 153, 112, 171, 194, 165, 207, 231, 212, 232, 247, 247, 247, 217, 240, 211, 166, 219, 160, 90, 174, 97, 27, 120, 55, 0, 68, 27]) }, + "purpleorange": { type: PaletteType.diverging, colors: new Uint8Array([127, 59, 8, 179, 88, 6, 224, 130, 20, 253, 184, 99, 254, 224, 182, 247, 247, 247, 216, 218, 235, 178, 171, 210, 128, 115, 172, 84, 39, 136, 45, 0, 75]) }, + "redblue": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 247, 247, 247, 209, 229, 240, 146, 197, 222, 67, 147, 195, 33, 102, 172, 5, 48, 97]) }, + "redgrey": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 255, 255, 255, 224, 224, 224, 186, 186, 186, 135, 135, 135, 77, 77, 77, 26, 26, 26]) }, + "redyellowblue": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 144, 255, 255, 191, 224, 243, 248, 171, 217, 233, 116, 173, 209, 69, 117, 180, 49, 54, 149]) }, + "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, + "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, + "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, + "category10": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 255, 127, 14, 44, 160, 44, 214, 39, 40, 148, 103, 189, 140, 86, 75, 227, 119, 194, 127, 127, 127, 188, 189, 34, 23, 190, 207]) }, + "category20": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 174, 199, 232, 255, 127, 14, 255, 187, 120, 44, 160, 44, 152, 223, 138, 214, 39, 40, 255, 152, 150, 148, 103, 189, 197, 176, 213, 140, 86, 75, 196, 156, 148, 227, 119, 194, 247, 182, 210, 127, 127, 127, 199, 199, 199, 188, 189, 34, 219, 219, 141, 23, 190, 207, 158, 218, 229]) }, + "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, + "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, + "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, + "pastel2": { type: PaletteType.qualitative, colors: new Uint8Array([179, 226, 205, 253, 205, 172, 203, 213, 232, 244, 202, 228, 230, 245, 201, 255, 242, 174, 241, 226, 204, 204, 204, 204]) }, + "set1": { type: PaletteType.qualitative, colors: new Uint8Array([228, 26, 28, 55, 126, 184, 77, 175, 74, 152, 78, 163, 255, 127, 0, 255, 255, 51, 166, 86, 40, 247, 129, 191, 153, 153, 153]) }, + "set2": { type: PaletteType.qualitative, colors: new Uint8Array([102, 194, 165, 252, 141, 98, 141, 160, 203, 231, 138, 195, 166, 216, 84, 255, 217, 47, 229, 196, 148, 179, 179, 179]) }, + "set3": { type: PaletteType.qualitative, colors: new Uint8Array([141, 211, 199, 255, 255, 179, 190, 186, 218, 251, 128, 114, 128, 177, 211, 253, 180, 98, 179, 222, 105, 252, 205, 229, 217, 217, 217, 188, 128, 189, 204, 235, 197, 255, 237, 111]) } + }; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + } + class PaletteBase { + get colors() { + return this._colors; } - get minBoundsZ() { - return this._minBoundsZ; + set colors(value2) { + if (this._colors != value2) { + this._colors = value2; + this._changed = true; + } } - set minBoundsZ(value) { - if (value != this._minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } + constructor() { + this._colors = null; } - get maxBoundsZ() { - return this._maxBoundsZ; + copyFrom(palette) { + if (palette.colors) { + this.colors = new Uint8Array(palette.colors); + } else { + this.colors = null; + } } - set maxBoundsZ(value) { - if (value != this._minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + update() { } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; + } + let Palette$3 = class Palette extends PaletteBase { + }; + class PositionVertex { + static getPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + set$8(value2, buffer[offset2], buffer[offset2 + 1], buffer[offset2 + 2]); } - getIsForwardFace(index) { - return this._isForwardFace[index]; + static setPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + buffer[offset2] = value2[0]; + buffer[offset2 + 1] = value2[1]; + buffer[offset2 + 2] = value2[2]; } - get textVertices() { - return this._textVertices; + } + PositionVertex.SIZE = 3; + PositionVertex.SIZE_BYTES = 12; + class PositionColorVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set$8(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255); + } + static setColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); } - get textIndices() { - return this._textIndices; + } + PositionColorVertex.SIZE_BYTES = 16; + PositionColorVertex.POSITION_OFFSET_BYTES = 0; + PositionColorVertex.COLOR_OFFSET_BYTES = 12; + class PositionTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; + } + PositionTextureVertex.SIZE_BYTES = 16; + PositionTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; + class PositionTexturePickVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } + } + PositionTexturePickVertex.SIZE_BYTES = 20; + PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; + PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; + PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; + class PositionNormalTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$8(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } + } + PositionNormalTextureVertex.SIZE_BYTES = 20; + PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; + PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; + class PickGridVertex { + static getTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$8(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + set$7(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535, bufferView.getUint16(offset2 + 4, true) / 65535, bufferView.getUint16(offset2 + 6, true) / 65535); + } + static setBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + bufferView.setUint16(offset2 + 4, value2[2] * 65535, true); + bufferView.setUint16(offset2 + 6, value2[3] * 65535, true); } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } + } + PickGridVertex.SIZE_BYTES = 32; + PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; + PickGridVertex.NORMAL_OFFSET_BYTES = 12; + PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; + PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; + PickGridVertex.BOUNDS_OFFSET_BYTES = 24; + class UnitVertex { + static getIdHover(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, true); + } + static setIdHover(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, value2, true); } - getLabelOrientation(index) { - return this._orientations[index]; + static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } + static getTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; + static setTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; + static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; + static getColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set$5(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255); } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } + static setColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } + static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; + static getOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + set$5(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true)); } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; + static setOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; + static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } + static getScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } + static setScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; + static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + set$6(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; + static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + set$6(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; + static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getSelected(bufferView, index2) { + return bufferView.getInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES) / 127; + } + static setSelected(bufferView, index2, value2) { + bufferView.setInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES, value2 * 127); } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; + static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; + static getRounding(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, true); } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; + static setRounding(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, value2, true); } - get gridVertices() { - return this._gridVertices; + static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); } - get gridIndices() { - return this._gridIndices; + static getParameter1(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, true); } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; + static setParameter1(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, value2, true); } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; + static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; + static getParameter2(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, true); } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; + static setParameter2(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, value2, true); } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; + static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; + static getMaterial(bufferView, index2) { + return bufferView.getUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES); } - getGridTicksScale(index) { - return this._gridTicksScales[index]; + static setMaterial(bufferView, index2, value2) { + bufferView.setUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES, value2); } - getGridFaceZero(index) { - return this._gridFaceZeros[index]; + static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; + static getTexture(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES); } - getGridFaceMinorGridlines(index) { - return this._gridFaceMinorGridlines[index]; + static setTexture(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES, value2); } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + static getSdfBuffer(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES); } - get scalingX() { - return this._scalingX; + static setSdfBuffer(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES, value2); } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); } - get scalingY() { - return this._scalingY; + static getSdfBorder(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES); } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } + static setSdfBorder(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES, value2); } - get scalingZ() { - return this._scalingZ; + static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); + } + static getMatId(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES, value2); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint16(offset2) / 255; + value2[1] = bufferView.getUint16(offset2 + 2) / 255; + value2[2] = bufferView.getUint16(offset2 + 4) / 255; + } + static setMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 255); + bufferView.setUint16(offset2 + 2, value2[1] * 255); + bufferView.setUint16(offset2 + 4, value2[2] * 255); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatFuzz(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatGloss(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, value2, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value2, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint8(offset2) / 255; + value2[1] = bufferView.getUint8(offset2 + 1) / 255; + value2[2] = bufferView.getUint8(offset2 + 2) / 255; + value2[3] = bufferView.getUint8(offset2 + 3) / 255; + } + static setSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); } - set scalingZ(value) { - if (value != this._scalingZ) { - this._scalingZ = value; - this._hasChanged = true; + } + UnitVertex.SIZE_BYTES = 120; + UnitVertex.ID_HOVER_OFFSET_BYTES = 0; + UnitVertex.ID_COLOR_OFFSET_BYTES = 4; + UnitVertex.ORDER_OFFSET_BYTES = 8; + UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; + UnitVertex.SELECTED_OFFSET_BYTES = 80; + UnitVertex.TRANSLATION_OFFSET_BYTES = 16; + UnitVertex.COLOR_OFFSET_BYTES = 28; + UnitVertex.MATERIAL_OFFSET_BYTES = 30; + UnitVertex.SCALE_OFFSET_BYTES = 32; + UnitVertex.ROUNDING_OFFSET_BYTES = 44; + UnitVertex.ROTATION_OFFSET_BYTES = 48; + UnitVertex.TEXCOORD_OFFSET_BYTES = 64; + UnitVertex.TEXTURE_OFFSET_BYTES = 81; + UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; + UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; + UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; + UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; + UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; + UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; + UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; + UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; + UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; + UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; + UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; + class ObjMesh { + } + class ObjHelper { + constructor(core) { + this._core = core; + } + read(data2) { + const start = window.performance.now(); + const indices = []; + const positions2 = []; + const normals = []; + const texCoords = []; + const meshes = []; + const indexOffsets = []; + const indexCounts = []; + const faceLookup = {}; + const lines = data2.split("\n"); + let faceCount = 0; + for (let i = 0; i < lines.length; i++) { + const parts = lines[i].trim().split(" "); + if (parts.length > 0) { + switch (parts[0]) { + case "o": + meshes.push(parts[1]); + indexOffsets.push(indices.length); + break; + case "v": + positions2.push(parseFloat(parts[1])); + positions2.push(parseFloat(parts[2])); + positions2.push(parseFloat(parts[3])); + break; + case "vt": + texCoords.push(parseFloat(parts[1])); + texCoords.push(parseFloat(parts[2])); + break; + case "vn": + normals.push(parseFloat(parts[1])); + normals.push(parseFloat(parts[2])); + normals.push(parseFloat(parts[3])); + break; + case "f": + for (let i2 = 0; i2 < parts.length - 1; i2++) { + const part = parts[i2 + 1]; + if (faceLookup[part] == void 0) { + faceLookup[part] = faceCount++; + } + indices.push(faceLookup[part]); + } + break; + } + } + } + for (let i = 0; i < meshes.length - 1; i++) { + indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); + } + indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); + const dataView = new DataView(vertices); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let minZ2 = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY2 = -Number.MAX_VALUE; + let maxZ = -Number.MAX_VALUE; + const faces = Object.keys(faceLookup); + const _vec2 = create$3(); + const _vec3 = create$6(); + let hasTexCoords, hasNormals; + if (faces.length > 0) { + const faceParts = faces[0].split("/"); + hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); + hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); + } + for (let i = 0; i < faces.length; i++) { + const faceParts = faces[i].split("/"); + let index2 = (parseInt(faceParts[0]) - 1) * 3; + const x2 = positions2[index2]; + const y2 = positions2[index2 + 1]; + const z2 = positions2[index2 + 2]; + set$8(_vec3, x2, y2, z2); + PositionNormalTextureVertex.setPosition(dataView, i, _vec3); + minX = Math.min(x2, minX); + minY = Math.min(y2, minY); + minZ2 = Math.min(z2, minZ2); + maxX = Math.max(x2, maxX); + maxY2 = Math.max(y2, maxY2); + maxZ = Math.max(z2, maxZ); + if (hasNormals) { + index2 = (parseInt(faceParts[2]) - 1) * 3; + set$8(_vec3, normals[index2], normals[index2 + 1], normals[index2 + 2]); + PositionNormalTextureVertex.setNormal(dataView, i, _vec3); + } + if (hasTexCoords) { + index2 = (parseInt(faceParts[1]) - 1) * 2; + set$5(_vec2, texCoords[index2], texCoords[index2 + 1]); + PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); } + } + const originX = (minX + maxX) / 2; + const originY = (minY + maxY2) / 2; + const originZ = (minZ2 + maxZ) / 2; + const objMesh = new ObjMesh(); + objMesh.vertices = vertices; + objMesh.indices = new Uint16Array(indices); + objMesh.meshes = meshes; + objMesh.indexOffsets = indexOffsets; + objMesh.indexCounts = indexCounts; + objMesh.indexCount = indices.length; + objMesh.minX = minX; + objMesh.minY = minY; + objMesh.minZ = minZ2; + objMesh.maxX = maxX; + objMesh.maxY = maxY2; + objMesh.maxZ = maxZ; + objMesh.originX = originX; + objMesh.originY = originY; + objMesh.originZ = originZ; + this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); + return objMesh; } - get offsetX() { - return this._offset[12]; + } + class Cube { + } + Cube.POSITIONS = new Float32Array([ + -0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + 0.5, + -0.5, + 0.5, + -0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + -0.5, + -0.5, + -0.5 + ]); + Cube.INDICES = new Uint16Array([5, 4, 1, 0, 3, 4, 7, 5, 6, 1, 2, 3, 6, 7]); + Cube.CUBE_MAP_INDICES = new Uint16Array([2, 3, 1, 0, 4, 3, 7, 2, 6, 1, 5, 4, 6, 7]); + Cube.FACE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Cube.FACE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0), + fromValues$3(0, 0, 0.5), + fromValues$3(0, 0, -0.5) + ]; + Cube.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), + fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), + fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), + fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Cube.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0.5), + fromValues$3(0.5, 0.5, 0), + fromValues$3(0, 0.5, -0.5), + fromValues$3(-0.5, 0.5, 0), + fromValues$3(0, -0.5, 0.5), + fromValues$3(0.5, -0.5, 0), + fromValues$3(0, -0.5, -0.5), + fromValues$3(-0.5, -0.5, 0), + fromValues$3(0.5, 0, 0.5), + fromValues$3(0.5, 0, -0.5), + fromValues$3(-0.5, 0, -0.5), + fromValues$3(-0.5, 0, 0.5) + ]; + Cube.EDGE_NORMALS = [ + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO) + ]; + Cube.EDGE_CORNERS = [ + [0, 1], + [1, 5], + [4, 5], + [0, 4], + [2, 3], + [2, 6], + [6, 7], + [3, 7], + [1, 2], + [5, 6], + [4, 7], + [0, 3] + ]; + Cube.EDGE_FACES = [ + [0, 4], + [0, 1], + [0, 5], + [0, 3], + [2, 4], + [2, 1], + [2, 5], + [2, 3], + [1, 4], + [1, 5], + [3, 5], + [3, 4] + ]; + Cube.EDGE_AXIS = [ + 0, + 2, + 0, + 2, + 0, + 2, + 0, + 2, + 1, + 1, + 1, + 1 + ]; + Cube.AXIS_EDGES = [ + [0, 2, 4, 6], + [8, 9, 10, 11], + [1, 3, 5, 7] + ]; + Cube.AXIS_FACES = [ + [1, 3], + [0, 2], + [4, 5] + ]; + Cube.OPPOSITE_FACES = [ + 2, + 3, + 0, + 1, + 5, + 4 + ]; + Cube.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0) + ]; + Cube.EDGE_FORWARDS = [ + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO) + ]; + let ControllerVisual$1 = class ControllerVisual { + render(elapsedTime, xrFrame) { } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; + update(elapsedTime) { } - get offsetY() { - return this._offset[13]; + constructor(controller) { + this.controller = controller; } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; + }; + class Controller { + get isInitialized() { + return this._isInitialized; } - get offsetZ() { - return this._offset[14]; - } - set offsetZ(value) { - if (value != this._offset[14]) this._offset[14] = value; - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._minBoundsZ = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._maxBoundsZ = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 6; i++)this._isForwardFace.push(false); - for(let i = 0; i < 12; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 12; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 3; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 3; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 3; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 12; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 6; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = []; - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = []; - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 3; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridFaceZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridFaceMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - } - for(let i = 0; i < 6; i++){ - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 12; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _cubeJs.Cube).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _cubeJs.Cube).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _cubeJs.Cube).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIVES[i], (0, _cubeJs.Cube).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null, - null - ]; - this._toValues = [ - null, - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false, - false - ]; - this.isAxisReversed = [ - false, - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._scalingZ = 1; - this._offset = (0, _glMatrix.mat4).create(); + get mMatrix() { + return this._mMatrix; } - initialize() { - this._isInitialized = true; + get indexCount() { + return this._indexCount; } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._size[2] *= this._scalingZ / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); - } - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 6; faceId++){ - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).FACE_POSITIONS[faceId], this._size); - (0, _glMatrix.vec3).transformMat4(this._forward, this._vec3, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 12; edgeId++){ - const faceIds = (0, _cubeJs.Cube).EDGE_FACES[edgeId]; - const forward1 = this._isForwardFace[faceIds[0]]; - const forward2 = this._isForwardFace[faceIds[1]]; - const outsideEdge = forward1 != forward2; - this._isOutsideEdge[edgeId] = outsideEdge; - if (outsideEdge) this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _cubeJs.Cube).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 3; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - for(let axisId = 0; axisId < 3; axisId++)if (this.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - (0, _glMatrix.vec2).set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - if (this._size[axisId] > 0) (0, _glMatrix.mat4).translate(gridFaceMMatrix, gridFaceMMatrix, (0, _cubeJs.Cube).FACE_POSITIONS[faceId]); - } - } - } - for(let axisId = 0; axisId < 3; axisId++)for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId]) { - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); - } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); - } - } - } + get vertices() { + return this._vertices; } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; + get indices() { + return this._indices; } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; + get texture() { + return this._texture; } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; + get rayMMatrix() { + return this._rayMMatrix; } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 3; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); - } - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } + get rayIndexCount() { + return this._rayIndexCount; } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 3; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } + get rayVertices() { + return this._rayVertices; } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; + get rayIndices() { + return this._rayIndices; } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../main.js":"f421K","./axes.js":"8Tmim","../../meshes/quad.js":"3PqJr","../../meshes/cube.js":"79I5N","../../vertex.js":"4J2YE","../../helpers/axes.js":"99ajO","../../helpers/text.js":"fG2oi","../../helpers/pick.js":"1t2sb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Tmim":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisual", ()=>AxesVisual); -parcelHelpers.export(exports, "AxesBase", ()=>AxesBase); -var _glMatrix = require("gl-matrix"); -class AxesVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(axes){ - this.axes = axes; - } -} -class AxesBase { - get isInitialized() { - return this._isInitialized; + constructor(core, options2) { + this._cubeObj = `o Cube +v 1.000000 -1.000000 -1.000000 +v 1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 -1.000000 +v 1.000000 1.000000 -0.999999 +v 0.999999 1.000000 1.000001 +v -1.000000 1.000000 1.000000 +v -1.000000 1.000000 -1.000000 +vt 1.000000 0.333333 +vt 1.000000 0.666667 +vt 0.666667 0.666667 +vt 0.666667 0.333333 +vt 0.666667 0.000000 +vt 0.000000 0.333333 +vt 0.000000 0.000000 +vt 0.333333 0.000000 +vt 0.333333 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.666667 +vt 0.333333 0.333333 +vt 0.333333 0.666667 +vt 1.000000 0.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn -0.000000 0.000000 1.000000 +vn -1.000000 -0.000000 -0.000000 +vn 0.000000 0.000000 -1.000000 +s off +f 2/1/1 3/2/1 4/3/1 +f 8/1/2 7/4/2 6/5/2 +f 5/6/3 6/7/3 2/8/3 +f 6/8/4 7/5/4 3/4/4 +f 3/9/5 7/10/5 8/11/5 +f 1/12/6 4/13/6 8/11/6 +f 1/4/1 2/1/1 4/3/1 +f 5/14/2 8/1/2 6/5/2 +f 1/12/3 5/6/3 2/8/3 +f 2/12/4 6/8/4 3/4/4 +f 4/13/5 3/9/5 8/11/5 +f 5/6/6 1/12/6 8/11/6`; + this._core = core; + this._obj = options2.obj; + this._texture = options2.texture || new ImageData(new Uint8ClampedArray([0, 0, 0, 255]), 1, 1); } - set vMatrix(value) { - this._vMatrix = value; + initialize() { + const _vec3 = create$6(); + this._mMatrix = create$7(); + const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); + if (!this._obj) { + this.useRayPose = true; + const modelThickness = 0.02; + const modelLength = 0.1; + set$8(_vec3, modelThickness, modelThickness, modelLength); + fromScaling(this._mMatrix, _vec3); + set$8(_vec3, 0, 0, 1); + translate$2(this._mMatrix, this._mMatrix, _vec3); + } + this._vertices = objMesh.vertices; + this._indices = objMesh.indices; + this._indexCount = objMesh.indexCount; + this._rayMMatrix = create$7(); + const rayVertices = Cube.POSITIONS; + this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); + const rayVerticesView = new DataView(this._rayVertices); + const rayIndices = Cube.INDICES; + this._rayIndices = new Uint16Array(rayIndices); + const rayVertexCount = rayVertices.length / PositionVertex.SIZE; + this._rayIndexCount = rayIndices.length; + for (let i = 0; i < rayVertexCount; i++) { + set$8(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); + PositionColorVertex.setPosition(rayVerticesView, i, _vec3); + PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); + } + const rayThickness = 25e-4; + const rayLength = 10; + set$8(_vec3, rayThickness, rayThickness, rayLength); + fromScaling(this._rayMMatrix, _vec3); + set$8(_vec3, 0, 0, -0.5); + translate$2(this._rayMMatrix, this._rayMMatrix, _vec3); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "controller initialized"); } - pickGrid(id) { - const offset = id * 3; - return { - divisionX: this._pickGrid[offset] - 1, - divisionY: this._pickGrid[offset + 1] - 1, - divisionZ: this._pickGrid[offset + 2] - 1 - }; + update(elapsedTime) { } - pickTitle(id) { - return { - axis: this._pickTitle[id] - }; + } + class MatrixHelper { + static fieldOfViewFromProjectionMatrix(p) { + return 2 * Math.atan(1 / p[5]); } - pickLabel(id) { - const offset = id * 2; - return { - axis: this._pickLabel[offset], - label: this._pickLabel[offset + 1] - }; + } + class AxesVisual { + render(elapsedTime, xrFrame) { } - pickHeading(id) { - return { - axis: this._pickHeading[id] - }; + update(elapsedTime) { } - getFromValues(index) { - return this._fromValues[index]; + constructor(axes) { + this.axes = axes; } - setFromValues(index, value) { - if (this._fromValues[index] != value) { - this._fromValues[index] = value; - this._hasChanged = true; - } + } + class AxesBase { + get isInitialized() { + return this._isInitialized; + } + set vMatrix(value2) { + this._vMatrix = value2; + } + pickGrid(id2) { + const offset2 = id2 * 3; + return { + divisionX: this._pickGrid[offset2] - 1, + divisionY: this._pickGrid[offset2 + 1] - 1, + divisionZ: this._pickGrid[offset2 + 2] - 1 + }; + } + pickTitle(id2) { + return { axis: this._pickTitle[id2] }; + } + pickLabel(id2) { + const offset2 = id2 * 2; + return { + axis: this._pickLabel[offset2], + label: this._pickLabel[offset2 + 1] + }; + } + pickHeading(id2) { + return { axis: this._pickHeading[id2] }; + } + getFromValues(index2) { + return this._fromValues[index2]; + } + setFromValues(index2, value2) { + if (this._fromValues[index2] != value2) { + this._fromValues[index2] = value2; + this._hasChanged = true; + } } - getToValues(index) { - return this._toValues[index]; + getToValues(index2) { + return this._toValues[index2]; } - setToValues(index, value) { - if (this._toValues[index] != value) { - this._toValues[index] = value; - this._hasChanged = true; - } + setToValues(index2, value2) { + if (this._toValues[index2] != value2) { + this._toValues[index2] = value2; + this._hasChanged = true; + } } get font() { - return this._font; + return this._font; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } get gridPickDivisionHeight() { - return this._gridPickDivisionHeight; - } - set gridPickDivisionHeight(value) { - if (this._gridPickDivisionHeight != value) { - this._gridPickDivisionHeight = value; - this._hasChanged = true; - } - } - constructor(core){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._mvMatrix = (0, _glMatrix.mat4).create(); - this._textMetric = { - maxTop: 0, - width: 0, - maxHeight: 0 - }; - this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; - this.textBorderWidth = core.config.textBorderWidth; - this.gamma = 0; - this.gridMajorThickness = core.config.axesGridMajorThickness; - this.gridMinorThickness = core.config.axesGridMinorThickness; - this.gridZeroThickness = core.config.axesGridZeroThickness; - this._font = core.font; - this.isGridPickingEnabled = false; - } - update(elapsedTime) {} -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3PqJr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -parcelHelpers.export(exports, "Grid", ()=>Grid); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -class Quad { - static positions(transform) { - const positions = new Float32Array(12); - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).set(position, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - positions[i * 3] = position[0]; - positions[i * 3 + 1] = position[1]; - positions[i * 3 + 2] = position[2]; - } - return positions; - } - static textured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - static normalTextured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal3 = (0, _glMatrix.vec3).create(); - const normal4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _glMatrix.vec4).set(normal4, 0.0, 0.0, 1.0, 0.0); - (0, _glMatrix.vec4).transformMat4(normal4, normal4, transform); - (0, _glMatrix.vec3).set(normal3, normal4[0], normal4[1], normal4[2]); - (0, _glMatrix.vec3).normalize(normal3, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } -} -Quad.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Quad.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0) -]; -Quad.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0) -]; -Quad.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Quad.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, 0, -1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.AXIS_EDGES = [ - [ - 0, - 2 - ], - [ - 1, - 3 - ] -]; -Quad.POSITIONS = new Float32Array([ + return this._gridPickDivisionHeight; + } + set gridPickDivisionHeight(value2) { + if (this._gridPickDivisionHeight != value2) { + this._gridPickDivisionHeight = value2; + this._hasChanged = true; + } + } + constructor(core) { + this._core = core; + this._mMatrix = create$7(); + this._mvMatrix = create$7(); + this._textMetric = { maxTop: 0, width: 0, maxHeight: 0 }; + this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; + this.textBorderWidth = core.config.textBorderWidth; + this.gamma = 0; + this.gridMajorThickness = core.config.axesGridMajorThickness; + this.gridMinorThickness = core.config.axesGridMinorThickness; + this.gridZeroThickness = core.config.axesGridZeroThickness; + this._font = core.font; + this.isGridPickingEnabled = false; + } + update(elapsedTime) { + } + } + let Quad$3 = class Quad { + static positions(transform2) { + const positions2 = new Float32Array(12); + const position2 = create$6(); + for (let i = 0; i < 4; i++) { + set$8(position2, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); + transformMat4$2(position2, position2, transform2); + positions2[i * 3] = position2[0]; + positions2[i * 3 + 1] = position2[1]; + positions2[i * 3 + 2] = position2[2]; + } + return positions2; + } + static textured(transform2, texTransform = Constants$1.MAT4_IDENTITY) { + const positions2 = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions2.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$6(); + const texCoord = create$3(); + for (let i = 0; i < positions2.length / PositionVertex.SIZE; i++) { + set$8(position2, positions2[i * PositionVertex.SIZE], positions2[i * PositionVertex.SIZE + 1], positions2[i * PositionVertex.SIZE + 2]); + set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionTextureVertex.setPosition(verticesView, i, position2); + PositionTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + static normalTextured(transform2, texTransform = Constants$1.MAT4_IDENTITY) { + const positions2 = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions2.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$6(); + const texCoord = create$3(); + const normal3 = create$6(); + const normal4 = create$5(); + for (let i = 0; i < positions2.length / PositionVertex.SIZE; i++) { + set$8(position2, positions2[i * PositionVertex.SIZE], positions2[i * PositionVertex.SIZE + 1], positions2[i * PositionVertex.SIZE + 2]); + set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionNormalTextureVertex.setPosition(verticesView, i, position2); + set$7(normal4, 0, 0, 1, 0); + transformMat4$1(normal4, normal4, transform2); + set$8(normal3, normal4[0], normal4[1], normal4[2]); + normalize$5(normal3, normal3); + PositionNormalTextureVertex.setNormal(verticesView, i, normal3); + PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + }; + Quad$3.FACE_NORMALS = [ + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$3.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Quad$3.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0) + ]; + Quad$3.EDGE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0) + ]; + Quad$3.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0) + ]; + Quad$3.EDGE_FORWARDS = [ + fromValues$3(0, 0, -1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$3.AXIS_EDGES = [ + [0, 2], + [1, 3] + ]; + Quad$3.POSITIONS = new Float32Array([ -0.5, 0.5, 0, @@ -17607,23958 +8454,13859 @@ Quad.POSITIONS = new Float32Array([ 0.5, -0.5, 0 -]); -Quad.INDICES = new Uint16Array([ - 0, - 2, - 1, - 1, - 2, - 3 -]); -Quad.TEX_COORDS = new Float32Array([ - 0, - 1, - 1, - 1, - 0, - 0, - 1, - 0 -]); -class Grid { - static positions(cols, rows, transform) { - const vertices = new Float32Array((cols + 1) * (rows + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec3).set(position, col / cols - 0.5, 0.5 - row / rows, 0); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - return vertices; - } - static indices(cols, rows) { - const indices = new Uint16Array(cols * rows * 6); - let index = 0; - for(let row = 0; row < rows; row++)for(let col = 0; col < cols; col++){ - indices[index++] = col + row * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1) + 1; - } - return indices; - } - static textured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static normalTextured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, index, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static _texCoords(cols, rows, transform) { - const texCoords = new Float32Array((cols + 1) * (rows + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec2).set(texCoord, col / cols, 1 - row / rows); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"99ajO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisHelper", ()=>AxisHelper); -class AxisHelper { - static continuous(options) { - const labels = []; - const positions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - for(let i = 0; i <= options.divisions; i++){ - positions.push(options.divisions == 0 ? 0.5 : i / options.divisions); - const value = options.divisions == 0 ? (options.min + options.max) / 2 : options.min + i * (options.max - options.min) / options.divisions; - labels.push(label(value)); - if (i == 0) fromValues.push(options.min); - else if (i < options.divisions) { - toValues.push(value); - fromValues.push(value); - } - } - toValues.push(options.max); - return { - labels: labels, - positions: positions, - fromValues: fromValues, - toValues: toValues - }; - } - static discrete(options) { - const divisions = options.maxDivisions !== undefined ? Math.min(options.divisions, options.maxDivisions) : options.divisions; - const divisionStep = 1 / options.divisions; - const labelStep = 1 / divisions; - const valueStep = (options.max - options.min + 1) / options.divisions; - let nextDivision, toValue, nextPosition; - const labels = []; - const labelPositions = []; - const tickPositions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - const fromToLabel = options.fromToLabel || ((fromValue, toValue)=>{ - return `${label(fromValue)}-${label(toValue)}`; - }); - for(let i = 0; i < divisions; i++){ - const division = Math.round(i * labelStep / divisionStep); - const tickPosition = division / options.divisions; - const fromValue = options.min + Math.ceil(division * valueStep); - if (i == divisions - 1) { - nextDivision = divisions; - nextPosition = 1; - toValue = options.max; - } else { - nextDivision = Math.round((i + 1) * labelStep / divisionStep); - nextPosition = nextDivision / options.divisions; - toValue = options.min + Math.ceil(nextDivision * valueStep) - 1; - } - labelPositions.push((tickPosition + nextPosition) / 2); - labels.push(fromValue == toValue ? label(fromValue) : fromToLabel(fromValue, toValue)); - fromValues.push(fromValue); - toValues.push(toValue); - tickPositions.push(tickPosition); + ]); + Quad$3.INDICES = new Uint16Array([0, 2, 1, 1, 2, 3]); + Quad$3.TEX_COORDS = new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]); + class TextHelper { + static truncate(text2, length2) { + return text2.length > length2 ? `${text2.substr(0, length2 - 1)}…` : text2; + } + static measure(font2, text2, size) { + size.width = 0; + let maxDescent = 0; + for (const char of text2) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; } - tickPositions.push(1); - return { - labels: labels, - labelPositions: labelPositions, - tickPositions: tickPositions, - fromValues: fromValues, - toValues: toValues - }; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fG2oi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextHelper", ()=>TextHelper); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -class TextHelper { - static truncate(text, length) { - return text.length > length ? `${text.substr(0, length - 1)}\u{2026}` : text; - } - static measure(font, text, size) { - size.width = 0; - let maxDescent = 0; - for (const char of text){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - size.width += glyph.advance; - size.maxTop = Math.max(glyph.top, size.maxTop); - maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + size.width += glyph.advance; + size.maxTop = Math.max(glyph.top, size.maxTop); + maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + } + size.maxHeight = size.maxTop + maxDescent; + } + static wrap(font2, text2, maxWidth) { + const lines = []; + let width2 = 0; + let start = 0; + let lastBreakingChar = -1; + let widthAfterLastBreakingChar = 0; + for (let i = 0; i < text2.length; i++) { + let char = text2.charAt(i); + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + width2 += glyph.advance; + if (char == " " || char == "-") { + widthAfterLastBreakingChar = width2; + lastBreakingChar = i; + } + if (width2 > maxWidth) { + if (lastBreakingChar == -1) { + lines.push(text2.substring(start, i)); + start = i; + width2 += glyph.advance; + } else { + lines.push(text2.substring(start, lastBreakingChar)); + start = lastBreakingChar + 1; + width2 -= widthAfterLastBreakingChar; + widthAfterLastBreakingChar = 0; + lastBreakingChar = -1; + } } - size.maxHeight = size.maxTop + maxDescent; + } + lines.push(text2.substring(start, text2.length)); + return lines; } - static wrap(font, text, maxWidth) { - const lines = []; - let width = 0; - let start = 0; - let lastBreakingChar = -1; - let widthAfterLastBreakingChar = 0; - for(let i = 0; i < text.length; i++){ - let char = text.charAt(i); - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - width += glyph.advance; - if (char == " " || char == "-") { - widthAfterLastBreakingChar = width; - lastBreakingChar = i; - } - if (width > maxWidth) { - if (lastBreakingChar == -1) { - lines.push(text.substring(start, i)); - start = i; - width += glyph.advance; - } else { - lines.push(text.substring(start, lastBreakingChar)); - start = lastBreakingChar + 1; - width -= widthAfterLastBreakingChar; - widthAfterLastBreakingChar = 0; - lastBreakingChar = -1; - } - } - } - lines.push(text.substring(start, text.length)); - return lines; + static addString(font2, text2, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + for (const char of text2) { + this.addGlyph(font2, char, vertices, indices, index2++, position2, scale2, offset2, rotation2, idColor); + } } - static addString(font, text, vertices, indices, index, position, scale, offset, rotation, idColor) { - for (const char of text)this.addGlyph(font, char, vertices, indices, index++, position, scale, offset, rotation, idColor); + static addGlyph(font2, char, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + const vertexOffset = index2 * 4; + const width2 = glyph.width * scale2; + const height2 = glyph.height * scale2; + const top = glyph.top * scale2; + const border = font2.border * scale2; + const x02 = offset2[0] - border; + const x12 = offset2[0] + width2 + border; + const y02 = offset2[1] + top + border; + const y12 = offset2[1] + top - height2 - border; + const z02 = offset2[2]; + set$8(this._topLeft, x02, y02, z02); + set$8(this._topRight, x12, y02, z02); + set$8(this._bottomLeft, x02, y12, z02); + set$8(this._bottomRight, x12, y12, z02); + if (rotation2) { + transformQuat(this._topLeft, this._topLeft, rotation2); + transformQuat(this._topRight, this._topRight, rotation2); + transformQuat(this._bottomLeft, this._bottomLeft, rotation2); + transformQuat(this._bottomRight, this._bottomRight, rotation2); + } + add$4(this._vec3, this._topLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); + add$4(this._vec3, this._topRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); + add$4(this._vec3, this._bottomLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); + add$4(this._vec3, this._bottomRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); + set$5(this._vec2, glyph.u0, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); + set$5(this._vec2, glyph.u1, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); + set$5(this._vec2, glyph.u0, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); + set$5(this._vec2, glyph.u1, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); + offset2[0] += glyph.advance * scale2; + const indexTemplate = Quad$3.INDICES; + const indexOffset = index2 * 6; + for (let i = 0; i < 6; i++) { + indices[indexOffset + i] = indexTemplate[i] + vertexOffset; + } } - static addGlyph(font, char, vertices, indices, index, position, scale, offset, rotation, idColor) { - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const vertexOffset = index * 4; - const width = glyph.width * scale; - const height = glyph.height * scale; - const top = glyph.top * scale; - const border = font.border * scale; - const x0 = offset[0] - border; - const x1 = offset[0] + width + border; - const y0 = offset[1] + top + border; - const y1 = offset[1] + top - height - border; - const z0 = offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (rotation) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, rotation); - } - (0, _glMatrix.vec3).add(this._vec3, this._topLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._topRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 1, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 2, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 3, this._vec3); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 1, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 2, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 3, this._vec2); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 1, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 2, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 3, idColor); - offset[0] += glyph.advance * scale; - const indexTemplate = (0, _quadJs.Quad).INDICES; - const indexOffset = index * 6; - for(let i = 0; i < 6; i++)indices[indexOffset + i] = indexTemplate[i] + vertexOffset; - } -} -TextHelper._vec2 = (0, _glMatrix.vec2).create(); -TextHelper._vec3 = (0, _glMatrix.vec3).create(); -TextHelper._topLeft = (0, _glMatrix.vec3).create(); -TextHelper._topRight = (0, _glMatrix.vec3).create(); -TextHelper._bottomLeft = (0, _glMatrix.vec3).create(); -TextHelper._bottomRight = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","../vertex.js":"4J2YE","../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1t2sb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickHelper", ()=>PickHelper); -class PickHelper { + } + TextHelper._vec2 = create$3(); + TextHelper._vec3 = create$6(); + TextHelper._topLeft = create$6(); + TextHelper._topRight = create$6(); + TextHelper._bottomLeft = create$6(); + TextHelper._bottomRight = create$6(); + class PickHelper { static nextPickId() { - return this._pickId++; - } - static encodeNumber(number, type, color) { - const encoded = number | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16); - } - static encodeVec3(vec3, type, color) { - const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeVec3(color, axes) { - axes[0] = color[0]; - axes[1] = color[1]; - axes[2] = color[2]; - } - static encodeType(type) { - return type << 24; - } - static decodeType(color) { - return color[3]; - } - static float32ToVec4(number, color) { - color[0] = ((number & 0xFF) >>> 0) / 0xFF; - color[1] = ((number & 0xFF00) >>> 8) / 0xFF; - color[2] = ((number & 0xFF0000) >>> 16) / 0xFF; - color[3] = ((number & 0xFF000000) >>> 24) / 0xFF; - } - static uint8ArrayToNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16) + (color[3] << 24); - } -} -PickHelper._pickId = 1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d0jS2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>Cartesian2dAxesHelper); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>Cartesian2dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian2dAxesHelper { - static create(core, options) { - const cartesian2dAxes = new Cartesian2dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian2dAxes.minBoundsX = minBoundsX; - cartesian2dAxes.minBoundsY = minBoundsY; - cartesian2dAxes.maxBoundsX = maxBoundsX; - cartesian2dAxes.maxBoundsY = maxBoundsY; - cartesian2dAxes.scalingX = scaling; - cartesian2dAxes.scalingY = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, maxBoundsY - minBoundsY); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY - ]; - cartesian2dAxes.isDiscreteX = options.isDiscreteX; - cartesian2dAxes.isDiscreteY = options.isDiscreteY; - cartesian2dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY - ]; - const isLabelPickingEnabled = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY - ]; - const labelsArray = [ - options.labelsX, - options.labelsY - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const arePickDivisionsVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY - ]; - const minValueArray = [ - minValueX, - minValueY - ]; - const maxValueArray = [ - maxValueX, - maxValueY - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY - ]; - const titleArray = [ - options.titleX, - options.titleY - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY - ]; - const headingArray = [ - options.headingX, - options.headingY - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY - ]; - for(let axisId = 0; axisId < 2; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian2dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian2dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian2dAxes.setLabels(axisId, discreteAxis.labels); - cartesian2dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian2dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian2dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian2dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian2dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabels(axisId, continuousAxis.labels); - cartesian2dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian2dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian2dAxes.setLabelSizes(axisId, labelSizes); - cartesian2dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian2dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian2dAxes.setTitle(axisId, titleArray[axisId]); - cartesian2dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian2dAxes.setHeading(axisId, headingArray[axisId]); - cartesian2dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian2dAxes.arePickDivisionsVisible[axisId] = arePickDivisionsVisibleArray[axisId] === undefined ? true : arePickDivisionsVisibleArray[axisId]; - cartesian2dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian2dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabled[axisId]; - cartesian2dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian2dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian2dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian2dAxes; - } -} -class Cartesian2dAxes extends (0, _axesJs.AxesBase) { + return this._pickId++; + } + static encodeNumber(number2, type2, color2) { + const encoded = number2 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16); + } + static encodeVec3(vec3, type2, color2) { + const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeVec3(color2, axes) { + axes[0] = color2[0]; + axes[1] = color2[1]; + axes[2] = color2[2]; + } + static encodeType(type2) { + return type2 << 24; + } + static decodeType(color2) { + return color2[3]; + } + static float32ToVec4(number2, color2) { + color2[0] = ((number2 & 255) >>> 0) / 255; + color2[1] = ((number2 & 65280) >>> 8) / 255; + color2[2] = ((number2 & 16711680) >>> 16) / 255; + color2[3] = ((number2 & 4278190080) >>> 24) / 255; + } + static uint8ArrayToNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16) + (color2[3] << 24); + } + } + PickHelper._pickId = 1; + class Cartesian3dAxes extends AxesBase { get size() { - return this._size; + return this._size; } get isDiscreteX() { - return this._isDiscrete[0]; + return this._isDiscrete[0]; } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } get isDiscreteY() { - return this._isDiscrete[1]; + return this._isDiscrete[1]; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } + } + get isDiscreteZ() { + return this._isDiscrete[2]; + } + set isDiscreteZ(value2) { + if (value2 != this._isDiscrete[2]) { + this._isDiscrete[2] = value2; + this._hasChanged = true; + } } get minBoundsX() { - return this._minBoundsX; + return this._minBoundsX; } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } get maxBoundsX() { - return this._maxBoundsX; + return this._maxBoundsX; } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } get minBoundsY() { - return this._minBoundsY; + return this._minBoundsY; } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } get maxBoundsY() { - return this._maxBoundsY; + return this._maxBoundsY; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; + get minBoundsZ() { + return this._minBoundsZ; + } + set minBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._minBoundsZ = value2; + this._hasChanged = true; + } + } + get maxBoundsZ() { + return this._maxBoundsZ; + } + set maxBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } + } + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; } - getIsForwardFace(index) { - return this._isForwardFace[index]; + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } get textVertices() { - return this._textVertices; + return this._textVertices; } get textIndices() { - return this._textIndices; + return this._textIndices; } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } - getLabelOrientation(index) { - return this._orientations[index]; + getLabelOrientation(index2) { + return this._orientations[index2]; } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } get gridVertices() { - return this._gridVertices; + return this._gridVertices; } get gridIndices() { - return this._gridIndices; + return this._gridIndices; } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; } - getGridTicksScale(index) { - return this._gridTicksScales[index]; + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; + getGridFaceZero(index2) { + return this._gridFaceZeros[index2]; } - get gridFaceZero() { - return this._gridFaceZeros; + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; } - get gridFaceMinorGridlines() { - return this._gridFaceMinorGridlines; + getGridFaceMinorGridlines(index2) { + return this._gridFaceMinorGridlines[index2]; } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } } get scalingX() { - return this._scalingX; + return this._scalingX; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } } get scalingY() { - return this._scalingY; + return this._scalingY; } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } + } + get scalingZ() { + return this._scalingZ; + } + set scalingZ(value2) { + if (value2 != this._scalingZ) { + this._scalingZ = value2; + this._hasChanged = true; + } } get offsetX() { - return this._offset[12]; + return this._offset[12]; } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } } get offsetY() { - return this._offset[13]; - } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; - } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._rMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromQuat(this._rMatrix, value); - } - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 2; i++)this._isForwardFace.push(false); - for(let i = 0; i < 4; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 4; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 2; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 2; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 2; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 4; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 2; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = (0, _glMatrix.vec2).create(); - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = (0, _glMatrix.vec2).create(); - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 2; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 4; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _quadJs.Quad).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _quadJs.Quad).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _quadJs.Quad).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _quadJs.Quad).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _quadJs.Quad).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _quadJs.Quad).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _quadJs.Quad).EDGE_POSITIVES[i], (0, _quadJs.Quad).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null - ]; - this._toValues = [ - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false - ]; - this.isAxisReversed = [ - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._offset = (0, _glMatrix.mat4).create(); + return this._offset[13]; + } + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } + } + get offsetZ() { + return this._offset[14]; + } + set offsetZ(value2) { + if (value2 != this._offset[14]) { + this._offset[14] = value2; + } + } + constructor(core) { + super(core); + this._size = create$6(); + this._translation = create$6(); + this._normal = create$6(); + this._forward = create$6(); + this._right = create$6(); + this._up = create$6(); + this._texCoord = create$3(); + this._bounds = create$5(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mat3 = create$8(); + this._isDiscrete = [false, false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._minBoundsZ = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._maxBoundsZ = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 6; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 12; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$6(); + this._textPosition = create$6(); + this._distances = []; + for (let i = 0; i < 12; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 3; i++) { + this._maxLabelSize.push(create$3()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._labelMMatrices.push(create$7()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 3; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._titleMMatrices.push(create$7()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 3; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._headingMMatrices.push(create$7()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$6(); + this._edgePositive = create$6(); + this._edgeNormal = create$6(); + this._edgeNormalTemp = create$6(); + this._edgePositiveTemp = create$6(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 12; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$6()); + this._edgeHorizontalUp.push(create$6()); + this._edgeHorizontalForward.push(create$6()); + this._edgeVerticalRight.push(create$6()); + this._edgeVerticalUp.push(create$6()); + this._edgeVerticalForward.push(create$6()); + } + this.isFaceVisible = []; + for (let i = 0; i < 6; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$3.INDICES; + this.zero = create$6(); + this._gridTicksZeros = []; + this._gridFaceZeros = []; + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = []; + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$6(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 3; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create$3()); + this._gridFaceZeros.push(create$3()); + this._gridTicksMinorGridlines.push(create$3()); + this._gridFaceMinorGridlines.push(create$3()); + this._gridTicksScales.push(create$6()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + } + for (let i = 0; i < 6; i++) { + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$7()); + } + for (let i = 0; i < 12; i++) { + this._gridTicksMMatrices.push(create$7()); + this._gridTicksRotations.push(create$7()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Cube.EDGE_POSITIVES[i][0]; + _mat4[1] = Cube.EDGE_POSITIVES[i][1]; + _mat4[2] = Cube.EDGE_POSITIVES[i][2]; + _mat4[4] = Cube.EDGE_NORMALS[i][0]; + _mat4[5] = Cube.EDGE_NORMALS[i][1]; + _mat4[6] = Cube.EDGE_NORMALS[i][2]; + cross$1(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null, null]; + this._toValues = [null, null, null]; + this.isDivisionPickingEnabled = [false, false, false]; + this.isLabelPickingEnabled = [false, false, false]; + this.isTitlePickingEnabled = [false, false, false]; + this.isHeadingPickingEnabled = [false, false, false]; + this.isAxisReversed = [false, false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._scalingZ = 1; + this._offset = create$7(); } initialize() { - this._isInitialized = true; + this._isInitialized = true; } update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); - const maxBounds = Math.max(this._size[0], this._size[1]); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); - } - if (this._rMatrix) { - (0, _glMatrix.mat4).mul(this._mMatrix, this.mMatrix, this._rMatrix); - (0, _glMatrix.mat4).mul(this._mMatrix, this._mMatrix, this._offset); - } else (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 2; faceId++){ - (0, _glMatrix.vec3).transformMat4(this._forward, (0, _constantsJs.Constants).VECTOR3_ZERO, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 4; edgeId++){ - this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _quadJs.Quad).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 2; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); + const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._size[2] *= this._scalingZ / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); + } + multiply$2(this._mMatrix, this.mMatrix, this._offset); + this._mvMatrix = create$7(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 6; faceId++) { + multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); + transformMat4$2(this._forward, this._vec3, this._mvMatrix); + transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 12; edgeId++) { + const faceIds = Cube.EDGE_FACES[edgeId]; + const forward1 = this._isForwardFace[faceIds[0]]; + const forward2 = this._isForwardFace[faceIds[1]]; + const outsideEdge = forward1 != forward2; + this._isOutsideEdge[edgeId] = outsideEdge; + if (outsideEdge) { + this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; + } + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$1.VECTOR3_REFLECTX); } + scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } } - (0, _glMatrix.vec2).set(this._gridFaceZeros, this.zero[0], this.zero[1]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); - for(let faceId = 0; faceId < 2; faceId++)if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - } - for(let axisId = 0; axisId < 2; axisId++)for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); + } + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + set$5(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); + set$5(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + if (this._size[axisId] > 0) { + translate$2(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); + } + } + } + } + for (let axisId = 0; axisId < 3; axisId++) { + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId]) { + multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$5(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross$1(this._right, Constants$1.VECTOR3_UNITY, this._forward); + normalize$5(this._right, this._right); + cross$1(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); + copy$6(this._edgeNormalTemp, this._edgeNormal); + copy$6(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$6(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$6(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$6(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$6(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } } + } } + } } _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; - } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { const right = this._edgeHorizontalRight[edgeId]; const up = this._edgeHorizontalUp[edgeId]; const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants$1.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; + } + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; } _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 2; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - const axisId = 2; - this._gridFaceScale[axisId] = 1; - for(let faceId = 0; faceId < 2; faceId++)offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId = 0; axisId < 3; axisId++) { + const width2 = size[axisId]; + set$8(this._gridTicksScales[axisId], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset2); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } + this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; + } } _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 2; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 3; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._labels[axisId]) { + const width2 = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set$5(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._titles[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._headings[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; } + } } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (position2 - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (position2 - 0.5) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } - return glyphOffset; - } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (0.5 - position2) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (0.5 - position2) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; } + break; } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$6(); + const positions2 = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const right = isAxisReversed ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$7(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../main.js":"f421K","./axes.js":"8Tmim","../../meshes/quad.js":"3PqJr","../../vertex.js":"4J2YE","../../helpers/axes.js":"99ajO","../../helpers/text.js":"fG2oi","../../helpers/pick.js":"1t2sb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ibkbS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Glyph", ()=>Glyph); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -parcelHelpers.export(exports, "Font", ()=>Font); -parcelHelpers.export(exports, "FontAtlas", ()=>FontAtlas); -parcelHelpers.export(exports, "FontRasterizer", ()=>FontRasterizer); -parcelHelpers.export(exports, "GlyphRasterizer", ()=>GlyphRasterizer); -var _mainJs = require("./main.js"); -class Glyph { - toJSON() { - return { - key: this.key, - char: this.char, - width: this.width, - height: this.height, - top: this.top, - left: this.left, - advance: this.advance, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$8(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$6(); + negate(this._normal, Cube.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$7(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } -} -class FontVisual { - update() {} - constructor(font){ - this.font = font; + } + class Cartesian2dAxes extends AxesBase { + get size() { + return this._size; } -} -class Font { - get atlas() { - return this._rasterizer.fontAtlas; + get isDiscreteX() { + return this._isDiscrete[0]; } - get count() { - return this._chars.size; + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._chars = new Set(); - this._previousSize = 0; - this.glyphs = {}; + get isDiscreteY() { + return this._isDiscrete[1]; } - addGlyph(char) { - if (!this._chars.has(char)) { - this._chars.add(char); - this._rasterizer.draw(char); - this._hasChanged = true; - } + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); - this._previousSize = this._chars.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } + get minBoundsX() { + return this._minBoundsX; } - toJSON() { - const glyphs = []; - for(let key in this.glyphs){ - const glyph = this.glyphs[key]; - glyphs.push(glyph.toJSON()); - } - return { - name: this.name, - size: this.size, - border: this.border, - glyphs: glyphs, - edgeValue: this.edgeValue - }; + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } -} -class FontAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class FontRasterizer { - get font() { - return this._font; + get maxBoundsX() { + return this._maxBoundsX; } - get fontAtlas() { - return this._fontAtlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontAtlas = options.fontAtlas; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._font = new Font(core, this); - this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); - this._font.size = this._fontSize; - this._font.border = this._border; - this._font.edgeValue = this._edgeValue; - const glyphRasterizerOptions = { - baseline: this._baseline, - border: this._border, - edgeValue: this._edgeValue, - fontFamily: this._fontFamily, - fontSize: this._fontSize, - fontStyle: this._fontStyle, - fontWeight: this._fontWeight, - maxDistance: this._maxDistance - }; - this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - draw(char) { - const glyph = this._glyphRasterizer.draw(char); - const texWidth = glyph.width + 2 * this._border; - const texHeight = glyph.height + 2 * this._border; - const width = this._fontAtlas.imageData.width; - const height = this._fontAtlas.imageData.height; - if (this._fontAtlas.x + texWidth > width) this._fontAtlas.x = 0; - let y = 0; - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)y = Math.max(y, this._fontAtlas.top[x]); - if (y + texHeight > height) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._font.name} height overflow`); - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)this._fontAtlas.top[x] = y + texHeight; - glyph.u0 = this._fontAtlas.x / width; - glyph.v0 = y / height; - glyph.u1 = (this._fontAtlas.x + texWidth) / width; - glyph.v1 = (y + texHeight) / height; - this._font.glyphs[char] = glyph; - for(let i = 0; i < glyph.distances.length; i++){ - const distance = glyph.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._fontAtlas.x + dataX + (y + dataY) * width) * 4; - this._fontAtlas.imageData.data[offset + 0] = distance; - this._fontAtlas.imageData.data[offset + 1] = distance; - this._fontAtlas.imageData.data[offset + 2] = distance; - this._fontAtlas.imageData.data[offset + 3] = 0xff; - } - this._fontAtlas.x += texWidth; - } -} -class GlyphRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._size = this._fontSize + this._border * 2; - this._size += this._border * 2; - this._gridOuter = new Float64Array(this._size * this._size); - this._gridInner = new Float64Array(this._size * this._size); - this._f = new Float64Array(this._size); - this._z = new Float64Array(this._size + 1); - this._v = new Uint16Array(this._size); - const canvas = document.createElement("canvas"); - canvas.width = canvas.height = this._size; - this._context = canvas.getContext("2d", { - willReadFrequently: true - }); - this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; - this._context.textBaseline = this._baseline; - this._context.textAlign = "left"; - this._context.fillStyle = "black"; - this._core.log.write((0, _mainJs.LogLevel).info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); + get minBoundsY() { + return this._minBoundsY; } - draw(char) { - const textMetrics = this._context.measureText(char); - const glyphLeft = 0; - const glyphTop = Math.floor(textMetrics.actualBoundingBoxAscent); - let glyphWidth = Math.ceil(textMetrics.actualBoundingBoxRight); - let glyphHeight = Math.ceil(textMetrics.actualBoundingBoxAscent) + Math.ceil(textMetrics.actualBoundingBoxDescent); - glyphWidth = Math.min(this._size - this._border, glyphWidth); - glyphHeight = Math.min(this._size - this._border, glyphHeight); - const width = glyphWidth + 2 * this._border; - const height = glyphHeight + 2 * this._border; - const length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const glyph = new Glyph(); - glyph.char = char; - glyph.key = char.codePointAt(0); - glyph.distances = distances; - glyph.gradientsX = gradientsX; - glyph.gradientsY = gradientsY; - glyph.pixels = pixels; - glyph.width = glyphWidth; - glyph.height = glyphHeight; - glyph.top = glyphTop; - glyph.left = glyphLeft; - glyph.advance = textMetrics.width; - if (glyphWidth == 0 || glyphHeight == 0) return glyph; - this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); - this._context.fillText(char, this._border, this._border + glyphTop); - const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < glyphHeight; y++)for(let x = 0; x < glyphWidth; x++){ - const a = imgData.data[4 * (y * glyphWidth + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - pixels[j] = 0xff; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return glyph; + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8nDg6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manager", ()=>Manager); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _animationJs = require("../helpers/animation.js"); -var _constantsJs = require("../constants.js"); -var _keyboardJs = require("./keyboard.js"); -class Manager { - constructor(core){ - this._manipulators = {}; - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._manipulationProcessor = new (0, _manipulationprocessorJs.ManipulationProcessor)(core); - this._manipulators = {}; - this._pointers = new (0, _pointersJs.Pointers)(core, this._manipulators); - this._pointers.initialize(core.container); - this._mouseWheel = new (0, _mousewheelJs.MouseWheel)(core); - this._mouseWheel.initialize(core.container); - this._keyboard = new (0, _keyboardJs.Keyboard)(core); - this._keyboard.initialize(core.container); - this.isPickingEnabled = true; - this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; - this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; - this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; - this.pickHoldDelay = this._core.config.pickHoldDelay; - this.pickSelectDelay = this._core.config.pickSelectDelay; - const rightButton = 2; - this.singleTouchAction = (manipulator)=>{ - if (manipulator.type == "mouse" && manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _mainJs.SingleTouchAction).translate; - else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton) return (0, _mainJs.SingleTouchAction).lasso; - else return (0, _mainJs.SingleTouchAction).rotate; - }; - this.mouseWheelAction = (keyboard)=>{ - if (this._keyboard.isKeyDown("Control")) return (0, _mainJs.MouseWheelAction).rotateY; - else return (0, _mainJs.MouseWheelAction).zoom; - }; - this.lassoPickType = (0, _mainJs.PickType).data; - this._thumbstickX = 0; - this._previousControllerButtonPressed = [ - false, - false, - false, - false - ]; - this._quat0 = (0, _glMatrix.quat).create(); - this._quat1 = (0, _glMatrix.quat).create(); + get maxBoundsY() { + return this._maxBoundsY; } - update(elapsedTime, xrFrame) { - if (xrFrame) { - const inputSources = this._core.webXRSession.inputSources; - if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { - const inputSource = inputSources[0]; - const controllerVisual = this._core.renderer.controllers[0]; - if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { - const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); - if (gripPose) controllerVisual.mMatrix = gripPose.transform.matrix; - const gamepad = inputSource.gamepad; - this._core.renderer.isPickingEnabled = false; - const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); - if (rayPose) { - controllerVisual.rayMMatrix = rayPose.transform.matrix; - if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { - this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; - this._core.renderer.isPickingEnabled = true; - } - } - const threshold = 0.2; - const dampening = Math.min(0.015 * elapsedTime, 1); - this._thumbstickX = (0, _animationJs.AnimationHelper).damp(this._thumbstickX, gamepad.axes[2], threshold, dampening); - if (this._thumbstickX != 0) { - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); - this._core.getModelRotation(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat0, this._quat1); - this._core.setModelRotation(this._quat1, true); - } - if (gamepad.buttons[2].pressed) { - if (!this._previousControllerButtonPressed[2]) { - this._previousControllerButtonPressed[2] = true; - if (this.controllerButtonPressedCallback) this.controllerButtonPressedCallback(2); - } - } else this._previousControllerButtonPressed[2] = false; - } - } - } else { - const camera = this._core.camera; - this._manipulationProcessor.update(elapsedTime, this._manipulators); - this._pointers.update(elapsedTime); - this._mouseWheel.update(elapsedTime); - this._keyboard.update(elapsedTime); - if (this._mouseWheel.delta != 0) switch(this.mouseWheelAction(this._keyboard)){ - case (0, _mainJs.MouseWheelAction).zoom: - if (this._pointers.hoverX, this._pointers.hoverY) camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); - break; - case (0, _mainJs.MouseWheelAction).rotateY: - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); - camera.getOrbit(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat1, this._quat0); - camera.setOrbit(this._quat1, true); - break; - } - const count = this._manipulationProcessor.count; - if (count == 0) { - if (this._isLassoPicking) { - this._isLassoPicking = false; - this._core.renderer.isLassoPicking = false; - const x0 = Math.min(this._lassoX0, this._lassoX1); - const y0 = Math.min(this._lassoY0, this._lassoY1); - const x1 = Math.max(this._lassoX0, this._lassoX1); - const y1 = Math.max(this._lassoY0, this._lassoY1); - if (x1 - x0 > 0 && y1 - y0 > 0) { - const sets = this._core.pickLasso(x0, y0, x1, y1, this.lassoPickType); - const result = { - x0: x0, - y0: y0, - x1: x1, - y1: y1, - pickType: this.lassoPickType, - ids: sets, - manipulator: this._manipulator - }; - this.pickLassoCallback(result); - } - } - } else if (count == 1) { - const translationDelta = this._manipulationProcessor.translationDelta; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - const manipulators = this._manipulationProcessor.manipulators; - for(const key in manipulators){ - const manipulator = manipulators[key]; - switch(this.singleTouchAction(manipulator)){ - case (0, _mainJs.SingleTouchAction).rotate: - camera.rotate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).translate: - camera.translate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).lasso: - if (this.pickLassoCallback) { - if (!this._isLassoPicking) { - this._isLassoPicking = true; - this._core.renderer.isLassoPicking = true; - this._lassoX0 = manipulator.position[0]; - this._lassoY0 = manipulator.position[1]; - } - this._lassoX1 = manipulator.position[0]; - this._lassoY1 = manipulator.position[1]; - this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); - this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); - } - break; - } - break; - } - } - } else { - const translationDelta = this._manipulationProcessor.translationDelta; - const camera = this._core.camera; - if (translationDelta[0] != 0 || translationDelta[1] != 0) camera.translate(translationDelta); - if (this._manipulationProcessor.scaleDelta != 0) { - const distance = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; - camera.zoom(distance, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this._manipulationProcessor.twistDelta != 0) camera.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { - const camera = this._core.camera; - const renderer = this._core.renderer; - if (renderer.isCapturingPickImage) { - camera.updatePickVMatrix(renderer.width / 2, renderer.height / 2); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - this._pickedTime = 0; - } else if (this._pointers.hoverId > -1) { - const pickingX = this._pointers.hoverX; - const pickingY = this._pointers.hoverY; - camera.updatePickVMatrix(pickingX, pickingY); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - if (this._pickedId != renderer.pickedId) { - this._pickedId = renderer.pickedId; - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 1) { - this._pickedTime += elapsedTime; - for(const key in this._manipulators){ - this._manipulator = this._manipulators[key]; - break; - } - } - if (this._pickedTime > 0) switch(renderer.pickedType){ - case (0, _mainJs.PickType).data: - if (this._pickedTime > this.pickHoldDelay) { - renderer.getVertexPosition(this._vec3, this._pickedId); - this._core.setModelManipulationOrigin(this._vec3); - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.transitionBuffers.length; i++){ - const transitionBuffer = renderer.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - transitionBuffer: i, - id: id, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked id ${result.id}, transition buffer ${i}`); - if (this.pickItemCallback) this.pickItemCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).label: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.labelSets.length; i++){ - const labelSet = renderer.labelSets[i].label; - const id = labelSet.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - label: id, - set: i, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, set ${result.set}`); - if (this.pickLabelSetCallback) this.pickLabelSetCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesDivision: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickGridLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickGrid(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); - if (this.pickAxesGridCallback) this.pickAxesGridCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesTitle: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickTitleLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickTitle(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked title ${result.axis}, axes ${result.axes}`); - if (this.pickAxesTitleCallback) this.pickAxesTitleCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesLabel: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickLabelLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickLabel(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); - if (this.pickAxesLabelCallback) this.pickAxesLabelCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesHeading: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickHeadingLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickHeading(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked heading ${result.axis}, axes ${result.axes}`); - if (this.pickAxesHeadingCallback) this.pickAxesHeadingCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - } - } else { - renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } else { - this._core.renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); - this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); - } - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","./manipulationprocessor.js":"20HDq","./mousewheel.js":"dfHmP","./pointers.js":"7LFJO","../helpers/animation.js":"02nn8","../constants.js":"lD0bG","./keyboard.js":"fXys0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"20HDq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>ManipulationProcessor); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("../helpers/math.js"); -var _angleJs = require("../helpers/angle.js"); -class ManipulationProcessor { - get manipulators() { - return this._manipulators; + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - get count() { - return this._count; + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; } - get isDragging() { - return this._isDragging; - } - constructor(core){ - this._core = core; - this._count = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._previousCentroid = (0, _glMatrix.vec3).create(); - this._relativePositionToCentroid = (0, _glMatrix.vec3).create(); - this._directionToCentroid = (0, _glMatrix.vec3).create(); - this._previousDirectionToCentroid = (0, _glMatrix.vec3).create(); - this._manipulators = {}; - this._removedManipulators = []; - this.cumulativeTranslation = (0, _glMatrix.vec3).create(); - this.translationDelta = (0, _glMatrix.vec3).create(); - this.centroid = (0, _glMatrix.vec3).create(); - this.maxScale = Number.MAX_VALUE; - this.twistAxis = (0, _glMatrix.vec3).fromValues(0, 0, 1); - this.initialize(); + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } - update(elapsedTime, manipulators) { - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (!manipulators[manipulator.id]) { - if (this.removeManipulator) this.removeManipulator(manipulator); - this._removedManipulators.push(manipulator.id); - } - } - if (this._removedManipulators.length > 0) { - for(let i = 0; i < this._removedManipulators.length; i++){ - delete this._manipulators[this._removedManipulators[i]]; - this._count--; - } - this._removedManipulators = []; - } - for(const key in manipulators){ - const manipulator = manipulators[key]; - if (!this._manipulators[manipulator.id]) { - if (!this.addManipulator || this.addManipulator(manipulator)) { - (0, _glMatrix.vec3).copy(manipulator.initialPosition, manipulator.position); - this._manipulators[manipulator.id] = manipulator; - this._count++; - } - } - } - (0, _glMatrix.vec3).set(this.translationDelta, 0, 0, 0); - this.scaleDelta = 0; - this.twistDelta = 0; - if (this._count > 0) { - if (this._previousCount > 0) { - if (this.prepareManipulation) this.prepareManipulation(); - this._process(); - if (this.processManipulation) this.processManipulation(elapsedTime); - } else { - this.initialize(); - if (this.beginManipulation) this.beginManipulation(); - } - } else { - if (this._previousCount > 0) { - if (this.endManipulation) this.endManipulation(); - } - } - this._isDragging = this._count == 1 && (0, _glMatrix.vec3).squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; - this._previousCount = this._count; + get textVertices() { + return this._textVertices; } - initialize() { - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - (0, _glMatrix.vec3).set(this.cumulativeTranslation, 0, 0, 0); - this.cumulativeScale = 1; - this.cumulativeTwist = 0; + get textIndices() { + return this._textIndices; } - _process() { - if (this._previousCount > 0) { - let persisted = 0; - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) persisted++; - } - const removed = this._previousCount - persisted; - if (persisted > 0) { - if (removed > 0) (0, _glMatrix.vec3).copy(this._centroid, this._previousCentroid); - else { - (0, _glMatrix.vec3).set(this._centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) (0, _glMatrix.vec3).add(this._centroid, this._centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this._centroid, this._centroid, 1 / persisted); - } - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) { - manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, (0, _glMatrix.vec3).squaredDistance(manipulator.position, manipulator.initialPosition)); - (0, _glMatrix.vec3).add(this.translationDelta, this.translationDelta, manipulator.position); - (0, _glMatrix.vec3).subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); - (0, _glMatrix.vec3).subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); - const distanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(this._relativePositionToCentroid); - if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) this.scaleDelta += 1; - else { - const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); - const previousDistanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(manipulator.previousPositionRelativeToCentroid); - const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); - this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; - (0, _glMatrix.vec3).scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); - (0, _glMatrix.vec3).scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); - this.twistDelta += (0, _angleJs.AngleHelper).signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); - } - } - } - (0, _glMatrix.vec3).scale(this.translationDelta, this.translationDelta, 1 / persisted); - (0, _glMatrix.vec3).add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); - this.scaleDelta /= persisted; - this.cumulativeScale = (0, _mathJs.MathHelper).clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); - this.scaleDelta -= 1; - this.twistDelta /= persisted; - this.cumulativeTwist += this.twistDelta; - } - } - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).add(this.centroid, this.centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this.centroid, this.centroid, 1 / this._count); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); - } - (0, _glMatrix.vec3).copy(this._previousCentroid, this.centroid); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - manipulator.isPersisted = true; - (0, _glMatrix.vec3).copy(manipulator.previousPosition, manipulator.position); - (0, _glMatrix.vec3).copy(manipulator.previousRotationAxis, manipulator.rotationAxis); - (0, _glMatrix.vec3).copy(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); - } - } -} - -},{"gl-matrix":"5x28d","../helpers/math.js":"f65d0","../helpers/angle.js":"53hwW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfHmP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MouseWheel", ()=>MouseWheel); -class MouseWheel { - constructor(core){ - this._core = core; - this._previousTotal = 0; - this.total = 0; - } - initialize(element) { - element.addEventListener("wheel", (e)=>{ - e.preventDefault(); - const wheelEvent = e; - this.total += wheelEvent.deltaY; - }, { - passive: false - }); + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - update(elapsedTime) { - const total = this.total; - this.delta = total - this._previousTotal; - this._previousTotal = total; - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7LFJO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Pointers", ()=>Pointers); -var _manipulatorJs = require("../input/manipulator.js"); -class Pointers { - get hoverX() { - return this._hoverX; + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } - get hoverY() { - return this._hoverY; + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } - get hoverId() { - return this._hoverId; + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } - constructor(core, manipulators){ - this._core = core; - this._manipulators = manipulators; + getLabelOrientation(index2) { + return this._orientations[index2]; } - initialize(element) { - this._element = element; - element.addEventListener("pointerdown", (e)=>this._handlePointerDown(e), { - passive: true - }); - element.addEventListener("pointermove", (e)=>this._handlePointerMove(e), { - passive: true - }); - element.addEventListener("pointerup", (e)=>this._handlePointerUp(e), { - passive: true - }); - element.addEventListener("pointercancel", (e)=>this._handlePointerCancel(e), { - passive: true - }); - element.addEventListener("pointerleave", (e)=>this._handlePointerLeave(e), { - passive: true - }); - element.addEventListener("pointerout", (e)=>this._handlePointerOut(e), { - passive: true - }); + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); - this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); - } + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - _handlePointerDown(e) { - this._element.focus(); - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const manipulator = new (0, _manipulatorJs.Manipulator)(); - const id = e.pointerId; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - manipulator.id = id; - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.type = e.pointerType; - manipulator.button = e.button; - manipulator.shiftKey = e.shiftKey; - manipulator.ctrlKey = e.ctrlKey; - manipulator.altKey = e.altKey; - manipulator.event = e; - this._manipulators[id] = manipulator; - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } - _handlePointerMove(e) { - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - const id = e.pointerId; - const manipulator = this._manipulators[id]; - if (manipulator) { - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.event = e; - } - switch(e.pointerType){ - case "mouse": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - break; - case "pen": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - this._tiltX = e.tiltX; - this._tiltY = e.tiltY; - this._twist = e.twist; - break; - } + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } - _handlePointerUp(e) { - const manipulator = this._manipulators[e.pointerId]; - if (manipulator) manipulator.event = e; - this._remove(e.pointerId); + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } - _handlePointerCancel(e) { - this._remove(e.pointerId); + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } - _handlePointerLeave(e) { - this._resetHover(); - this._remove(e.pointerId); + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; } - _handlePointerOut(e) { - this._resetHover(); - this._remove(e.pointerId); + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; } - _resetHover() { - this._hoverId = null; - this._hoverX = null; - this._hoverY = null; + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - _remove(pointerId) { - const manipulator = this._manipulators[pointerId]; - if (manipulator) delete this._manipulators[pointerId]; - } -} - -},{"../input/manipulator.js":"bYqKJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bYqKJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manipulator", ()=>Manipulator); -var _glMatrix = require("gl-matrix"); -class Manipulator { - constructor(){ - this.pickedIndex = 0; - this.maxTranslationSquared = 0; - this.initialPosition = (0, _glMatrix.vec3).create(); - this.position = (0, _glMatrix.vec3).create(); - this.previousPosition = (0, _glMatrix.vec3).create(); - this.holdOrigin = (0, _glMatrix.vec3).create(); - this.positionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.previousPositionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.rotationAxis = (0, _glMatrix.vec3).create(); - this.previousRotationAxis = (0, _glMatrix.vec3).create(); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"02nn8":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationHelper", ()=>AnimationHelper); -var _mathJs = require("./math.js"); -class AnimationHelper { - static smoothStep(value) { - return value * value * (3 - 2 * value); - } - static damp(value, target, threshold, dampening) { - if (Math.abs(target) < threshold) return (0, _mathJs.MathHelper).lerp(value, 0, dampening); - else return (0, _mathJs.MathHelper).lerp(value, target, dampening); - } -} - -},{"./math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fXys0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>Keyboard); -class Keyboard { - constructor(core){ - this._core = core; - this._pressedKeys = new Set(); - this._previousPressedKeys = new Set(); - } - initialize(element) { - element.addEventListener("keydown", (e)=>{ - this._handleKeyDown(e); - }, false); - element.addEventListener("keyup", (e)=>{ - this._handleKeyUp(e); - }, false); + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } - isKeyDown(key) { - return this._pressedKeys.has(key); + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - wasKeyReleased(key) { - if (this._pressedKeys.has(key)) { - if (!this._previousPressedKeys.has(key)) { - this._previousPressedKeys.add(key); - return true; - } - } else this._previousPressedKeys.delete(key); - return false; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - _handleKeyDown(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (!this._pressedKeys.has(key)) this._pressedKeys.add(key); + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - _handleKeyUp(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (this._pressedKeys.has(key)) this._pressedKeys.delete(key); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c6yiP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Log", ()=>Log); -var _mainJs = require("./main.js"); -class Log { - constructor(core){ - this._core = core; - } - write(level, value) { - if (level >= this._core.config.logLevel) switch(level){ - case (0, _mainJs.LogLevel).trace: - console.trace(value); - break; - case (0, _mainJs.LogLevel).debug: - console.debug(value); - break; - case (0, _mainJs.LogLevel).info: - console.info(value); - break; - case (0, _mainJs.LogLevel).warn: - console.warn(value); - break; - case (0, _mainJs.LogLevel).error: - console.error(value); - break; - } + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } -} - -},{"./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cYEeU":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Colors", ()=>Colors); -var _glMatrix = require("gl-matrix"); -class Colors { -} -Colors.MediumVioletRed = (0, _glMatrix.vec3).fromValues(0xc7, 0x15, 0x85); -Colors.DeepPink = (0, _glMatrix.vec3).fromValues(0xff, 0x14, 0x93); -Colors.PaleVioletRed = (0, _glMatrix.vec3).fromValues(0xdb, 0x70, 0x93); -Colors.HotPink = (0, _glMatrix.vec3).fromValues(0xff, 0x69, 0xb4); -Colors.LightPink = (0, _glMatrix.vec3).fromValues(0xff, 0xb6, 0xc1); -Colors.Pink = (0, _glMatrix.vec3).fromValues(0xff, 0xc0, 0xcb); -Colors.DarkRed = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x00); -Colors.Red = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0x00); -Colors.Firebrick = (0, _glMatrix.vec3).fromValues(0xb2, 0x22, 0x22); -Colors.Crimson = (0, _glMatrix.vec3).fromValues(0xdc, 0x14, 0x3c); -Colors.IndianRed = (0, _glMatrix.vec3).fromValues(0xcd, 0x5c, 0x5c); -Colors.LightCoral = (0, _glMatrix.vec3).fromValues(0xf0, 0x80, 0x80); -Colors.Salmon = (0, _glMatrix.vec3).fromValues(0xfa, 0x80, 0x72); -Colors.DarkSalmon = (0, _glMatrix.vec3).fromValues(0xe9, 0x96, 0x7a); -Colors.LightSalmon = (0, _glMatrix.vec3).fromValues(0xff, 0xa0, 0x7a); -Colors.OrangeRed = (0, _glMatrix.vec3).fromValues(0xff, 0x45, 0x00); -Colors.Tomato = (0, _glMatrix.vec3).fromValues(0xff, 0x63, 0x47); -Colors.DarkOrange = (0, _glMatrix.vec3).fromValues(0xff, 0x8c, 0x00); -Colors.Coral = (0, _glMatrix.vec3).fromValues(0xff, 0x7f, 0x50); -Colors.Orange = (0, _glMatrix.vec3).fromValues(0xff, 0xa5, 0x00); -Colors.DarkKhaki = (0, _glMatrix.vec3).fromValues(0xbd, 0xb7, 0x6b); -Colors.Gold = (0, _glMatrix.vec3).fromValues(0xff, 0xd7, 0x00); -Colors.Khaki = (0, _glMatrix.vec3).fromValues(0xf0, 0xe6, 0x8c); -Colors.PeachPuff = (0, _glMatrix.vec3).fromValues(0xff, 0xda, 0xb9); -Colors.Yellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0x00); -Colors.PaleGoldenrod = (0, _glMatrix.vec3).fromValues(0xee, 0xe8, 0xaa); -Colors.Moccasin = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xb5); -Colors.PapayaWhip = (0, _glMatrix.vec3).fromValues(0xff, 0xef, 0xd5); -Colors.LightGoldenrodYellow = (0, _glMatrix.vec3).fromValues(0xfa, 0xfa, 0xd2); -Colors.LemonChiffon = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xcd); -Colors.LightYellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xe0); -Colors.Maroon = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x00); -Colors.Brown = (0, _glMatrix.vec3).fromValues(0xa5, 0x2a, 0x2a); -Colors.SaddleBrown = (0, _glMatrix.vec3).fromValues(0x8b, 0x45, 0x13); -Colors.Sienna = (0, _glMatrix.vec3).fromValues(0xa0, 0x52, 0x2d); -Colors.Chocolate = (0, _glMatrix.vec3).fromValues(0xd2, 0x69, 0x1e); -Colors.DarkGoldenrod = (0, _glMatrix.vec3).fromValues(0xb8, 0x86, 0x0b); -Colors.Peru = (0, _glMatrix.vec3).fromValues(0xcd, 0x85, 0x3f); -Colors.RosyBrown = (0, _glMatrix.vec3).fromValues(0xbc, 0x8f, 0x8f); -Colors.Goldenrod = (0, _glMatrix.vec3).fromValues(0xda, 0xa5, 0x20); -Colors.SandyBrown = (0, _glMatrix.vec3).fromValues(0xf4, 0xa4, 0x60); -Colors.Tan = (0, _glMatrix.vec3).fromValues(0xd2, 0xb4, 0x8c); -Colors.Burlywood = (0, _glMatrix.vec3).fromValues(0xde, 0xb8, 0x87); -Colors.Wheat = (0, _glMatrix.vec3).fromValues(0xf5, 0xde, 0xb3); -Colors.NavajoWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xde, 0xad); -Colors.Bisque = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xc4); -Colors.BlanchedAlmond = (0, _glMatrix.vec3).fromValues(0xff, 0xeb, 0xcd); -Colors.Cornsilk = (0, _glMatrix.vec3).fromValues(0xff, 0xf8, 0xdc); -Colors.DarkGreen = (0, _glMatrix.vec3).fromValues(0x00, 0x64, 0x00); -Colors.Green = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x00); -Colors.DarkOliveGreen = (0, _glMatrix.vec3).fromValues(0x55, 0x6b, 0x2f); -Colors.ForestGreen = (0, _glMatrix.vec3).fromValues(0x22, 0x8b, 0x22); -Colors.SeaGreen = (0, _glMatrix.vec3).fromValues(0x2e, 0x8b, 0x57); -Colors.Olive = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x00); -Colors.OliveDrab = (0, _glMatrix.vec3).fromValues(0x6b, 0x8e, 0x23); -Colors.MediumSeaGreen = (0, _glMatrix.vec3).fromValues(0x3c, 0xb3, 0x71); -Colors.LimeGreen = (0, _glMatrix.vec3).fromValues(0x32, 0xcd, 0x32); -Colors.Lime = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x00); -Colors.SpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x7f); -Colors.MediumSpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xfa, 0x9a); -Colors.DarkSeaGreen = (0, _glMatrix.vec3).fromValues(0x8f, 0xbc, 0x8f); -Colors.MediumAquamarine = (0, _glMatrix.vec3).fromValues(0x66, 0xcd, 0xaa); -Colors.YellowGreen = (0, _glMatrix.vec3).fromValues(0x9a, 0xcd, 0x32); -Colors.LawnGreen = (0, _glMatrix.vec3).fromValues(0x7c, 0xfc, 0x00); -Colors.Chartreuse = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0x00); -Colors.LightGreen = (0, _glMatrix.vec3).fromValues(0x90, 0xee, 0x90); -Colors.GreenYellow = (0, _glMatrix.vec3).fromValues(0xad, 0xff, 0x2f); -Colors.PaleGreen = (0, _glMatrix.vec3).fromValues(0x98, 0xfb, 0x98); -Colors.Teal = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x80); -Colors.DarkCyan = (0, _glMatrix.vec3).fromValues(0x00, 0x8b, 0x8b); -Colors.LightSeaGreen = (0, _glMatrix.vec3).fromValues(0x20, 0xb2, 0xaa); -Colors.CadetBlue = (0, _glMatrix.vec3).fromValues(0x5f, 0x9e, 0xa0); -Colors.DarkTurquoise = (0, _glMatrix.vec3).fromValues(0x00, 0xce, 0xd1); -Colors.MediumTurquoise = (0, _glMatrix.vec3).fromValues(0x48, 0xd1, 0xcc); -Colors.Turquoise = (0, _glMatrix.vec3).fromValues(0x40, 0xe0, 0xd0); -Colors.Aqua = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Cyan = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Aquamarine = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0xd4); -Colors.PaleTurquoise = (0, _glMatrix.vec3).fromValues(0xaf, 0xee, 0xee); -Colors.LightCyan = (0, _glMatrix.vec3).fromValues(0xe0, 0xff, 0xff); -Colors.Navy = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x80); -Colors.DarkBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x8b); -Colors.MediumBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xcd); -Colors.Blue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xff); -Colors.MidnightBlue = (0, _glMatrix.vec3).fromValues(0x19, 0x19, 0x70); -Colors.RoyalBlue = (0, _glMatrix.vec3).fromValues(0x41, 0x69, 0xe1); -Colors.SteelBlue = (0, _glMatrix.vec3).fromValues(0x46, 0x82, 0xb4); -Colors.DodgerBlue = (0, _glMatrix.vec3).fromValues(0x1e, 0x90, 0xff); -Colors.DeepSkyBlue = (0, _glMatrix.vec3).fromValues(0x00, 0xbf, 0xff); -Colors.CornflowerBlue = (0, _glMatrix.vec3).fromValues(0x64, 0x95, 0xed); -Colors.SkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xeb); -Colors.LightSkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xfa); -Colors.LightSteelBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xc4, 0xde); -Colors.LightBlue = (0, _glMatrix.vec3).fromValues(0xad, 0xd8, 0xe6); -Colors.PowderBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xe0, 0xe6); -Colors.Indigo = (0, _glMatrix.vec3).fromValues(0x4b, 0x00, 0x82); -Colors.Purple = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x80); -Colors.DarkMagenta = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x8b); -Colors.DarkViolet = (0, _glMatrix.vec3).fromValues(0x94, 0x00, 0xd3); -Colors.DarkSlateBlue = (0, _glMatrix.vec3).fromValues(0x48, 0x3d, 0x8b); -Colors.BlueViolet = (0, _glMatrix.vec3).fromValues(0x8a, 0x2b, 0xe2); -Colors.DarkOrchid = (0, _glMatrix.vec3).fromValues(0x99, 0x32, 0xcc); -Colors.Fuchsia = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.Magenta = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.SlateBlue = (0, _glMatrix.vec3).fromValues(0x6a, 0x5a, 0xcd); -Colors.MediumSlateBlue = (0, _glMatrix.vec3).fromValues(0x7b, 0x68, 0xee); -Colors.MediumOrchid = (0, _glMatrix.vec3).fromValues(0xba, 0x55, 0xd3); -Colors.MediumPurple = (0, _glMatrix.vec3).fromValues(0x93, 0x70, 0xdb); -Colors.Orchid = (0, _glMatrix.vec3).fromValues(0xda, 0x70, 0xd6); -Colors.Violet = (0, _glMatrix.vec3).fromValues(0xee, 0x82, 0xee); -Colors.Plum = (0, _glMatrix.vec3).fromValues(0xdd, 0xa0, 0xdd); -Colors.Thistle = (0, _glMatrix.vec3).fromValues(0xd8, 0xbf, 0xd8); -Colors.Lavender = (0, _glMatrix.vec3).fromValues(0xe6, 0xe6, 0xfa); -Colors.MistyRose = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xe1); -Colors.AntiqueWhite = (0, _glMatrix.vec3).fromValues(0xfa, 0xeb, 0xd7); -Colors.Linen = (0, _glMatrix.vec3).fromValues(0xfa, 0xf0, 0xe6); -Colors.Beige = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xdc); -Colors.WhiteSmoke = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xf5); -Colors.LavenderBlush = (0, _glMatrix.vec3).fromValues(0xff, 0xf0, 0xf5); -Colors.OldLace = (0, _glMatrix.vec3).fromValues(0xfd, 0xf5, 0xe6); -Colors.AliceBlue = (0, _glMatrix.vec3).fromValues(0xf0, 0xf8, 0xff); -Colors.Seashell = (0, _glMatrix.vec3).fromValues(0xff, 0xf5, 0xee); -Colors.GhostWhite = (0, _glMatrix.vec3).fromValues(0xf8, 0xf8, 0xff); -Colors.Honeydew = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xf0); -Colors.FloralWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xf0); -Colors.Azure = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xff); -Colors.MintCream = (0, _glMatrix.vec3).fromValues(0xf5, 0xff, 0xfa); -Colors.Snow = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xfa); -Colors.Ivory = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xf0); -Colors.White = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xff); -Colors.Black = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x00); -Colors.DarkSlateGray = (0, _glMatrix.vec3).fromValues(0x2f, 0x4f, 0x4f); -Colors.DimGray = (0, _glMatrix.vec3).fromValues(0x69, 0x69, 0x69); -Colors.SlateGray = (0, _glMatrix.vec3).fromValues(0x70, 0x80, 0x90); -Colors.Gray = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x80); -Colors.LightSlateGray = (0, _glMatrix.vec3).fromValues(0x77, 0x88, 0x99); -Colors.DarkGray = (0, _glMatrix.vec3).fromValues(0xa9, 0xa9, 0xa9); -Colors.Silver = (0, _glMatrix.vec3).fromValues(0xc0, 0xc0, 0xc0); -Colors.LightGray = (0, _glMatrix.vec3).fromValues(0xd3, 0xd3, 0xd3); -Colors.Gainsboro = (0, _glMatrix.vec3).fromValues(0xdc, 0xdc, 0xdc); -Colors.Copper = (0, _glMatrix.vec3).fromValues(0xb8, 0x73, 0x33); -Colors.Bronze = (0, _glMatrix.vec3).fromValues(0xcd, 0x7f, 0x32); -Colors.Steel = (0, _glMatrix.vec3).fromValues(0xce, 0xd2, 0xd7); -Colors.Platinum = (0, _glMatrix.vec3).fromValues(0xe5, 0xe4, 0xe2); -Colors.Gunmetal = (0, _glMatrix.vec3).fromValues(0x5c, 0x5d, 0x5b); -Colors.Titanium = (0, _glMatrix.vec3).fromValues(0x87, 0x86, 0x81); -Colors.RoseGold = (0, _glMatrix.vec3).fromValues(0xcb, 0xa3, 0xb2); -Colors.AquaGlass = (0, _glMatrix.vec3).fromValues(0xd2, 0xe8, 0xdf); -Colors.BlueGlass = (0, _glMatrix.vec3).fromValues(0xc7, 0xe3, 0xe1); - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5JhCv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MapItem", ()=>MapItem); -parcelHelpers.export(exports, "MapVisual", ()=>MapVisual); -parcelHelpers.export(exports, "Map", ()=>Map); -parcelHelpers.export(exports, "MapAtlas", ()=>MapAtlas); -parcelHelpers.export(exports, "MapRasterizer", ()=>MapRasterizer); -parcelHelpers.export(exports, "GeoJSONRasterizer", ()=>GeoJSONRasterizer); -var _mapJs = require("./helpers/map.js"); -var _mainJs = require("./main.js"); -class MapItem { - toJSON() { - return { - key: this.key, - scale: this.scale, - minLat: this.minLat, - maxLat: this.maxLat, - minLon: this.minLon, - maxLon: this.maxLon, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } -} -class MapVisual { - update() {} - constructor(map){ - this.map = map; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } -} -class Map { - get atlas() { - return this._rasterizer.atlas; + get gridVertices() { + return this._gridVertices; } - get count() { - return this._keys.size; - } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; - } - add(key) { - if (!this._keys.has(key)) { - if (this._rasterizer.draw(key) !== null) { - this._keys.add(key); - this._hasChanged = true; - } - } + get gridIndices() { + return this._gridIndices; } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); - } - return { - key: this.key, - items: items - }; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } -} -class MapAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class MapRasterizer { - get map() { - return this._map; + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - get atlas() { - return this._atlas; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - get scale() { - return this._scale; - } - set scale(value) { - this._scale = value; - this._geoJSONRasterizer.scale = value; - } - get geoJSON() { - return this._geoJSON; - } - set geoJSON(value) { - this._geoJSON = value; - this._geoJSONRasterizer.geoJSON = value; - } - get property() { - return this._property; - } - set property(value) { - this._property = value; - this._geoJSONRasterizer.property = value; - } - get mapProjection() { - return this._mapProjection; - } - set mapProjection(value) { - this._mapProjection = value; - this._geoJSONRasterizer.mapProjection = value; - } - get scaleFactor() { - return this._scaleFactor; - } - set scaleFactor(value) { - this._scaleFactor = value; - this._geoJSONRasterizer.scaleFactor = this._scaleFactor; - } - get minLongitude() { - return this._minLogitude; - } - set minLongitude(value) { - this._minLogitude = value; - this._geoJSONRasterizer.minLongitude = this._minLogitude; - } - get maxLongitude() { - return this._maxLongitude; - } - set maxLongitude(value) { - this._maxLongitude = value; - this._geoJSONRasterizer.maxLongitude = this._maxLongitude; - } - get minLatitude() { - return this._minLatitude; - } - set minLatitude(value) { - this._minLatitude = value; - this._geoJSONRasterizer.minLatitude = this._minLatitude; - } - get maxLatitude() { - return this._maxLatitude; - } - set maxLatitude(value) { - this._maxLatitude = value; - this._geoJSONRasterizer.maxLatitude = this._maxLatitude; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._mapProjection = options.mapProjection; - this._map = new Map(core, this); - this._map.key = this._key; - const geoJSONRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance, - geoJSON: this._geoJSON, - scale: this._scale, - property: this._property, - mapProjection: this._mapProjection - }; - this._geoJSONRasterizer = new GeoJSONRasterizer(core, geoJSONRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `map rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key) { - const item = this._geoJSONRasterizer.draw(key); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._map.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._map.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; - } - this._atlas.x += texWidth; - } - return item; + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; + } + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; + } + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; + } + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; + } + get gridFaceZero() { + return this._gridFaceZeros; + } + get gridFaceMinorGridlines() { + return this._gridFaceMinorGridlines; + } + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; } -} -class GeoJSONRasterizer { - get scale() { - return this._scale; + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } } - set scale(value) { - this._scale = value; + get scalingX() { + return this._scalingX; } - get geoJSON() { - return this._geoJSON; + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } } - set geoJSON(value) { - this._geoJSON = value; + get scalingY() { + return this._scalingY; } - get property() { - return this._property; + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } } - set property(value) { - this._property = value; + get offsetX() { + return this._offset[12]; } - get mapProjection() { - return this._mapProjection; + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } } - set mapProjection(value) { - this._mapProjection = value; + get offsetY() { + return this._offset[13]; } - get scaleFactor() { - return this._scaleFactor; + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } } - set scaleFactor(value) { - this._scaleFactor = value; + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._rMatrix = create$7(); + fromQuat(this._rMatrix, value2); + } } - get minLongitude() { - return this._minLongitude; + constructor(core) { + super(core); + this._size = create$6(); + this._translation = create$6(); + this._normal = create$6(); + this._forward = create$6(); + this._right = create$6(); + this._up = create$6(); + this._texCoord = create$3(); + this._bounds = create$5(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mat3 = create$8(); + this._isDiscrete = [false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 2; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 4; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$6(); + this._textPosition = create$6(); + this._distances = []; + for (let i = 0; i < 4; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 2; i++) { + this._maxLabelSize.push(create$3()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._labelMMatrices.push(create$7()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 2; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._titleMMatrices.push(create$7()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 2; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._headingMMatrices.push(create$7()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$6(); + this._edgePositive = create$6(); + this._edgeNormal = create$6(); + this._edgeNormalTemp = create$6(); + this._edgePositiveTemp = create$6(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 4; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$6()); + this._edgeHorizontalUp.push(create$6()); + this._edgeHorizontalForward.push(create$6()); + this._edgeVerticalRight.push(create$6()); + this._edgeVerticalUp.push(create$6()); + this._edgeVerticalForward.push(create$6()); + } + this.isFaceVisible = []; + for (let i = 0; i < 2; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$3.INDICES; + this.zero = create$6(); + this._gridTicksZeros = []; + this._gridFaceZeros = create$3(); + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = create$3(); + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$6(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 2; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create$3()); + this._gridTicksMinorGridlines.push(create$3()); + this._gridTicksScales.push(create$6()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$7()); + } + for (let i = 0; i < 4; i++) { + this._gridTicksMMatrices.push(create$7()); + this._gridTicksRotations.push(create$7()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Quad$3.EDGE_POSITIVES[i][0]; + _mat4[1] = Quad$3.EDGE_POSITIVES[i][1]; + _mat4[2] = Quad$3.EDGE_POSITIVES[i][2]; + _mat4[4] = Quad$3.EDGE_NORMALS[i][0]; + _mat4[5] = Quad$3.EDGE_NORMALS[i][1]; + _mat4[6] = Quad$3.EDGE_NORMALS[i][2]; + cross$1(this._vec3, Quad$3.EDGE_POSITIVES[i], Quad$3.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null]; + this._toValues = [null, null]; + this.isDivisionPickingEnabled = [false, false]; + this.isLabelPickingEnabled = [false, false]; + this.isTitlePickingEnabled = [false, false]; + this.isHeadingPickingEnabled = [false, false]; + this.isAxisReversed = [false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._offset = create$7(); } - set minLongitude(value) { - this._minLongitude = value; + initialize() { + this._isInitialized = true; } - get maxLongitude() { - return this._maxLongitude; + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); + const maxBounds = Math.max(this._size[0], this._size[1]); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); + } + if (this._rMatrix) { + mul(this._mMatrix, this.mMatrix, this._rMatrix); + mul(this._mMatrix, this._mMatrix, this._offset); + } else { + multiply$2(this._mMatrix, this.mMatrix, this._offset); + } + this._mvMatrix = create$7(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 2; faceId++) { + transformMat4$2(this._forward, Constants$1.VECTOR3_ZERO, this._mvMatrix); + transformMat3(this._normal, Quad$3.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 4; edgeId++) { + this._isForwardEdge[edgeId] = dot$1(Quad$3.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 2; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$1.VECTOR3_REFLECTX); + } + scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } + } + } + } + set$5(this._gridFaceZeros, this.zero[0], this.zero[1]); + set$5(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); + for (let faceId = 0; faceId < 2; faceId++) { + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + } + } + for (let axisId = 0; axisId < 2; axisId++) { + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + multiply$1(this._edgePosition, Quad$3.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$5(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross$1(this._right, Constants$1.VECTOR3_UNITY, this._forward); + normalize$5(this._right, this._right); + cross$1(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Quad$3.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Quad$3.EDGE_POSITIVES[edgeId], this._mat3); + copy$6(this._edgeNormalTemp, this._edgeNormal); + copy$6(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$6(edgeHorizontalUp, Quad$3.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Quad$3.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$6(edgeHorizontalRight, Quad$3.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Quad$3.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$6(edgeVerticalUp, Quad$3.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Quad$3.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$6(edgeVerticalRight, Quad$3.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Quad$3.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } + } + } + } } - set maxLongitude(value) { - this._maxLongitude = value; + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants$1.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; } - get minLatitude() { - return this._minLatitude; + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } - set minLatitude(value) { - this._minLatitude = value; + _updateHeading(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; } - get maxLatitude() { - return this._maxLatitude; + _updateGrids(size) { + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId2 = 0; axisId2 < 2; axisId2++) { + const width2 = size[axisId2]; + set$8(this._gridTicksScales[axisId2], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId2, this._gridVerticesView, this._gridIndices, offset2); + this._gridFaceScale[axisId2] = size[axisId2] == 0 ? 1 : size[axisId2]; + } + const axisId = 2; + this._gridFaceScale[axisId] = 1; + for (let faceId = 0; faceId < 2; faceId++) { + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } } - set maxLatitude(value) { - this._maxLatitude = value; + _updateText(size) { + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 2; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._labels[axisId]) { + const width2 = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set$5(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._titles[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._headings[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._mapProjection = options.mapProjection; - this._lonLat = [ - 0, - 0 - ]; - this._geoJSONHelper = new (0, _mapJs.GeoJSONHelper)(); - this._core.log.write((0, _mainJs.LogLevel).info, `geoJSON rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key) { - let feature = this._geoJSONHelper.feature(this._geoJSON, this._property, key); - if (feature) { - let geometry = feature.geometry; - const clip = { - minLon: this._minLongitude, - maxLon: this._maxLongitude, - minLat: this._minLatitude, - maxLat: this._maxLatitude - }; - const bounds = this._geoJSONHelper.bounds(geometry, clip, this._mapProjection); - if (bounds) { - let minX = bounds.minX; - let maxX = bounds.maxX; - let minY = bounds.minY; - let maxY = bounds.maxY; - let sizeX = bounds.maxX - bounds.minX; - let sizeY = bounds.maxY - bounds.minY; - if (sizeX > 0 && sizeY > 0) { - const scale = this._scale * this._scaleFactor; - sizeX = Math.ceil(sizeX * scale); - sizeY = Math.ceil(sizeY * scale); - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new MapItem(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - item.minLon = minX; - item.maxLon = maxX; - item.minLat = minY; - item.maxLat = maxY; - item.scale = this._scaleFactor; - ctx.clearRect(this._border, this._border, sizeX, sizeY); - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.coordinates.length; k++){ - const inner = polygon.coordinates[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.length; k++){ - const inner = polygon[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - } - break; - } - const imgData = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return item; - } + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (position2 - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (position2 - 0.5) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } - if (!feature) this._core.log.write((0, _mainJs.LogLevel).warn, `geoJSON rasterizer ${key} not found`); - return null; - } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./helpers/map.js":"27ECm","./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"27ECm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MercatorHelper", ()=>MercatorHelper); -parcelHelpers.export(exports, "AlbersHelper", ()=>AlbersHelper); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>GeoJSONHelper); -var _mathJs = require("./math.js"); -var _angleJs = require("./angle.js"); -var _constantsJs = require("../constants.js"); -class MercatorHelper { - constructor(){ - this.minLatitude = -85.05112878; - this.maxLatitude = 85.05112878; - this.minLongitude = -180; - this.maxLongitude = 180; - this.minX = -1; - this.minY = -1; - this.maxX = 1; - this.maxY = 1; - } - project(longitude, latitude, xy) { - const x = longitude / 180; - latitude = (0, _mathJs.MathHelper).clamp(latitude, this.minLatitude, this.maxLatitude); - latitude = (0, _angleJs.AngleHelper).degreesToRadians(latitude); - const sinLatitude = Math.sin(latitude); - let y = Math.log((1 + sinLatitude) / (1 - sinLatitude)) / 2; - y = (0, _mathJs.MathHelper).clamp(y / Math.PI, this.minY, this.maxY); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const longitude = x * 180; - y *= Math.PI; - let latitude = (0, _constantsJs.Constants).PI_OVER_TWO - 2 * Math.atan(Math.exp(-y)); - latitude = (0, _angleJs.AngleHelper).radiansToDegrees(latitude); - lonLat[0] = longitude; - lonLat[1] = latitude; - } -} -class AlbersHelper { - constructor(){ - this._phi1 = 29.5; - this._phi2 = 45.5; - this._lat0 = 37.5; - this._lon0 = -96; - } - get standardParallel1() { - return this._phi1; - } - set standardParallel1(value) { - this._phi1 = value; - } - get standardParallel2() { - return this._phi2; - } - set standardParallel2(value) { - this._phi2 = value; - } - get latitudeOfOrigin() { - return this._lat0; - } - set latitudeOfOrigin(value) { - this._lat0 = value; - } - get centralMeridian() { - return this._lon0; - } - set centralMeridian(value) { - this._lon0 = value; - } - project(lon, lat, xy) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - lat = (0, _angleJs.AngleHelper).degreesToRadians(lat); - lon = (0, _angleJs.AngleHelper).degreesToRadians(lon); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - const theta = n * (lon - lon0); - const p = Math.sqrt(C - 2 * n * Math.sin(lat)) / n; - const x = p * Math.sin(theta); - const y = p0 - p * Math.cos(theta); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - let theta = Math.atan(x / Math.abs(p0 - y) * Math.sign(p0 - y)); - if ((p0 - y) * n < 0) theta -= Math.PI * Math.sign(x) * Math.sign(p0 - y); - const p = Math.sqrt(x * x + Math.pow(p0 - y, 2)); - const lon = lon0 + theta / n; - const lat = Math.asin((C - p * p * n * n) / (2 * n)); - lonLat[0] = (0, _angleJs.AngleHelper).radiansToDegrees(lon); - lonLat[1] = (0, _angleJs.AngleHelper).radiansToDegrees(lat); - } -} -class GeoJSONHelper { - constructor(){ - this._lonLat = [ - 0, - 0 - ]; - } - feature(geoJSON, property, key) { - for(let i = 0; i < geoJSON.features.length; i++){ - let feature = geoJSON.features[i]; - if (feature.properties[property] == key) return feature; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (0.5 - position2) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (0.5 - position2) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; + } + break; } - return null; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; } - bounds(geometry, clip, projection) { - let minX = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } - } - break; + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$6(); + const positions2 = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const right = isAxisReversed ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$7(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; } - if (minX == Number.MAX_VALUE) { - minX = 0; - maxX = 0; - minY = 0; - maxY = 0; + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$8(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$6(); + negate(this._normal, Quad$3.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$7(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } } - return { - minX: minX, - maxX: maxX, - minY: minY, - maxY: maxY - }; + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } -} - -},{"./math.js":"f65d0","./angle.js":"53hwW","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPq9g":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Icon", ()=>Icon); -parcelHelpers.export(exports, "IconsVisual", ()=>IconsVisual); -parcelHelpers.export(exports, "Icons", ()=>Icons); -parcelHelpers.export(exports, "IconsAtlas", ()=>IconsAtlas); -parcelHelpers.export(exports, "IconsRasterizer", ()=>IconsRasterizer); -parcelHelpers.export(exports, "IconRasterizer", ()=>IconRasterizer); -var _mainJs = require("./main.js"); -class Icon { + } + class Glyph { toJSON() { - return { - key: this.key, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + return { + key: this.key, + char: this.char, + width: this.width, + height: this.height, + top: this.top, + left: this.left, + advance: this.advance, + u0: this.u0, + v0: this.v0, + u1: this.u1, + v1: this.v1 + }; } -} -class IconsVisual { - update() {} - constructor(icons){ - this.icons = icons; + } + let FontVisual$2 = class FontVisual { + update() { } -} -class Icons { + constructor(font2) { + this.font = font2; + } + }; + class Font { get atlas() { - return this._rasterizer.atlas; + return this._rasterizer.fontAtlas; } get count() { - return this._keys.size; + return this._chars.size; } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; + constructor(core, rasterizer) { + this._core = core; + this._rasterizer = rasterizer; + this._chars = /* @__PURE__ */ new Set(); + this._previousSize = 0; + this.glyphs = {}; } - add(key, imgData) { - if (!this._keys.has(key)) { - this._keys.add(key); - this._rasterizer.draw(key, imgData); - } + addGlyph(char) { + if (!this._chars.has(char)) { + this._chars.add(char); + this._rasterizer.draw(char); + this._hasChanged = true; + } } update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); + if (this._hasChanged) { + this._hasChanged = false; + this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); + this._previousSize = this._chars.size; + if (this.hasChangedCallback) { + this.hasChangedCallback(); } + } } toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); - } - return { - key: this.key, - items: items - }; - } -} -class IconsAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class IconsRasterizer { - get icons() { - return this._icons; + const glyphs = []; + for (let key2 in this.glyphs) { + const glyph = this.glyphs[key2]; + glyphs.push(glyph.toJSON()); + } + return { + name: this.name, + size: this.size, + border: this.border, + glyphs, + edgeValue: this.edgeValue + }; } - get atlas() { - return this._atlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._icons = new Icons(core, this); - this._icons.key = this._key; - const iconRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance - }; - this._iconRasterizer = new IconRasterizer(core, iconRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `icons rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData) { - const item = this._iconRasterizer.draw(key, imgData); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._icons.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._icons.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; - } - this._atlas.x += texWidth; - } - } -} -class IconRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._core.log.write((0, _mainJs.LogLevel).info, `icon rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData0) { - const sizeX = imgData0.width; - const sizeY = imgData0.height; - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new Icon(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - ctx.clearRect(this._border, this._border, sizeX, sizeY); - ctx.putImageData(imgData0, this._border, this._border); - const imgData1 = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData1.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return item; + } + class FontAtlas { + constructor(width2, height2) { + const canvas = document.createElement("canvas"); + canvas.width = width2; + canvas.height = height2; + const context2 = canvas.getContext("2d"); + context2.clearRect(0, 0, width2, height2); + this.imageData = context2.getImageData(0, 0, width2, height2); + this.x = 0; + this.top = new Uint16Array(width2); } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5C4Hk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Controller", ()=>(0, _controllerJs.Controller)); -parcelHelpers.export(exports, "ControllerVisual", ()=>(0, _controllerJs.ControllerVisual)); -parcelHelpers.export(exports, "Label", ()=>(0, _labelsJs.Label)); -parcelHelpers.export(exports, "LabelVisual", ()=>(0, _labelsJs.LabelVisual)); -parcelHelpers.export(exports, "LabelSet", ()=>(0, _labelsJs.LabelSet)); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>(0, _labelsJs.TransitionLabelSet)); -parcelHelpers.export(exports, "LabelSetVisual", ()=>(0, _labelsJs.LabelSetVisual)); -parcelHelpers.export(exports, "ImageVisual", ()=>(0, _imageJs.ImageVisual)); -parcelHelpers.export(exports, "ImageQuad", ()=>(0, _imageJs.ImageQuad)); -parcelHelpers.export(exports, "ImageSphere", ()=>(0, _imageJs.ImageSphere)); -parcelHelpers.export(exports, "NominalKey", ()=>(0, _keysJs.NominalKey)); -var _controllerJs = require("./controller.js"); -var _labelsJs = require("./labels.js"); -var _imageJs = require("./image.js"); -var _keysJs = require("./keys.js"); - -},{"./controller.js":"f5tIG","./labels.js":"PwNrz","./image.js":"kwtZG","./keys.js":"bmBQh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"PwNrz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -parcelHelpers.export(exports, "LabelBase", ()=>LabelBase); -parcelHelpers.export(exports, "Label", ()=>Label); -parcelHelpers.export(exports, "LabelSet", ()=>LabelSet); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>TransitionLabelSet); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -var _pickJs = require("../helpers/pick.js"); -var _mathJs = require("../helpers/math.js"); -class LabelVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(label){ - this.label = label; - } -} -class LabelSetVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(labelSet){ - this.label = labelSet; - } -} -class LabelBase { - get material() { - return this._material; + } + class FontRasterizer { + get font() { + return this._font; } - get vertices() { - return this._vertices; + get fontAtlas() { + return this._fontAtlas; + } + constructor(core, options2) { + let start = performance.now(); + this._core = core; + this._fontAtlas = options2.fontAtlas; + this._fontSize = options2.fontSize; + this._border = options2.border; + this._fontFamily = options2.fontFamily; + this._fontWeight = options2.fontWeight; + this._fontStyle = options2.fontStyle; + this._baseline = options2.baseline; + this._maxDistance = options2.maxDistance; + this._edgeValue = options2.edgeValue; + this._font = new Font(core, this); + this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); + this._font.size = this._fontSize; + this._font.border = this._border; + this._font.edgeValue = this._edgeValue; + const glyphRasterizerOptions = { + baseline: this._baseline, + border: this._border, + edgeValue: this._edgeValue, + fontFamily: this._fontFamily, + fontSize: this._fontSize, + fontStyle: this._fontStyle, + fontWeight: this._fontWeight, + maxDistance: this._maxDistance + }; + this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); + this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); } - get verticesView() { - return this._verticesView; + draw(char) { + const glyph = this._glyphRasterizer.draw(char); + const texWidth = glyph.width + 2 * this._border; + const texHeight = glyph.height + 2 * this._border; + const width2 = this._fontAtlas.imageData.width; + const height2 = this._fontAtlas.imageData.height; + if (this._fontAtlas.x + texWidth > width2) { + this._fontAtlas.x = 0; + } + let y2 = 0; + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + y2 = Math.max(y2, this._fontAtlas.top[x2]); + } + if (y2 + texHeight > height2) { + this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); + } + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + this._fontAtlas.top[x2] = y2 + texHeight; + } + glyph.u0 = this._fontAtlas.x / width2; + glyph.v0 = y2 / height2; + glyph.u1 = (this._fontAtlas.x + texWidth) / width2; + glyph.v1 = (y2 + texHeight) / height2; + this._font.glyphs[char] = glyph; + for (let i = 0; i < glyph.distances.length; i++) { + const distance2 = glyph.distances[i]; + const dataX = i % texWidth; + const dataY = Math.floor(i / texWidth); + const offset2 = (this._fontAtlas.x + dataX + (y2 + dataY) * width2) * 4; + this._fontAtlas.imageData.data[offset2 + 0] = distance2; + this._fontAtlas.imageData.data[offset2 + 1] = distance2; + this._fontAtlas.imageData.data[offset2 + 2] = distance2; + this._fontAtlas.imageData.data[offset2 + 3] = 255; + } + this._fontAtlas.x += texWidth; } - get indices() { - return this._indices; + } + class GlyphRasterizer { + constructor(core, options2) { + let start = performance.now(); + this._core = core; + this._fontSize = options2.fontSize; + this._border = options2.border; + this._fontFamily = options2.fontFamily; + this._fontWeight = options2.fontWeight; + this._fontStyle = options2.fontStyle; + this._baseline = options2.baseline; + this._maxDistance = options2.maxDistance; + this._edgeValue = options2.edgeValue; + this._size = this._fontSize + this._border * 2; + this._size += this._border * 2; + this._gridOuter = new Float64Array(this._size * this._size); + this._gridInner = new Float64Array(this._size * this._size); + this._f = new Float64Array(this._size); + this._z = new Float64Array(this._size + 1); + this._v = new Uint16Array(this._size); + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = this._size; + this._context = canvas.getContext("2d", { willReadFrequently: true }); + this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; + this._context.textBaseline = this._baseline; + this._context.textAlign = "left"; + this._context.fillStyle = "black"; + this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); } - get indexCount() { - return this._indexCount; + draw(char) { + const textMetrics2 = this._context.measureText(char); + const glyphLeft = 0; + const glyphTop = Math.floor(textMetrics2.actualBoundingBoxAscent); + let glyphWidth = Math.ceil(textMetrics2.actualBoundingBoxRight); + let glyphHeight = Math.ceil(textMetrics2.actualBoundingBoxAscent) + Math.ceil(textMetrics2.actualBoundingBoxDescent); + glyphWidth = Math.min(this._size - this._border, glyphWidth); + glyphHeight = Math.min(this._size - this._border, glyphHeight); + const width2 = glyphWidth + 2 * this._border; + const height2 = glyphHeight + 2 * this._border; + const length2 = width2 * height2; + const distances = new Uint8ClampedArray(length2); + const gradientsX = new Uint8ClampedArray(length2); + const gradientsY = new Uint8ClampedArray(length2); + const pixels = new Uint8ClampedArray(length2); + const glyph = new Glyph(); + glyph.char = char; + glyph.key = char.codePointAt(0); + glyph.distances = distances; + glyph.gradientsX = gradientsX; + glyph.gradientsY = gradientsY; + glyph.pixels = pixels; + glyph.width = glyphWidth; + glyph.height = glyphHeight; + glyph.top = glyphTop; + glyph.left = glyphLeft; + glyph.advance = textMetrics2.width; + if (glyphWidth == 0 || glyphHeight == 0) { + return glyph; + } + this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); + this._context.fillText(char, this._border, this._border + glyphTop); + const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); + for (let i = 0; i < length2; i++) { + this._gridOuter[i] = Number.MAX_VALUE; + this._gridInner[i] = 0; + } + for (let y2 = 0; y2 < glyphHeight; y2++) { + for (let x2 = 0; x2 < glyphWidth; x2++) { + const a2 = imgData.data[4 * (y2 * glyphWidth + x2) + 3] / 255; + if (a2 > 0) { + const j = (y2 + this._border) * width2 + x2 + this._border; + if (a2 == 1) { + this._gridOuter[j] = 0; + this._gridInner[j] = Number.MAX_VALUE; + } else { + const d2 = 0.5 - a2; + this._gridOuter[j] = d2 > 0 ? d2 * d2 : 0; + this._gridInner[j] = d2 < 0 ? d2 * d2 : 0; + pixels[j] = 255; + } + } + } + } + this._edt(this._gridOuter, 0, 0, width2, height2, width2, this._f, this._v, this._z); + this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width2, this._f, this._v, this._z); + const distances2 = new Float32Array(length2); + for (let i = 0; i < length2; i++) { + const distance2 = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); + distances[i] = Math.round(this._edgeValue - distance2 * 255 / this._maxDistance); + distances2[i] = distance2; + } + for (let i = 0; i < length2; i++) { + const x2 = i % width2; + const y2 = Math.floor(i / width2); + const d2 = distances2[i]; + const sign2 = d2 < 0 ? -1 : 1; + const x02 = x2 > 0 ? distances2[i - 1] : Number.MAX_VALUE; + const x12 = x2 < width2 - 1 ? distances2[i + 1] : Number.MAX_VALUE; + const y02 = y2 > 0 ? distances2[i - width2] : Number.MAX_VALUE; + const y12 = y2 < height2 - 1 ? distances2[i + width2] : Number.MAX_VALUE; + let gradientX = sign2 * x02 < sign2 * x12 ? d2 - x02 : x12 - d2; + let gradientY = sign2 * y02 < sign2 * y12 ? y02 - d2 : d2 - y12; + gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 255); + gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 255); + } + return glyph; + } + _edt(data2, x02, y02, width2, height2, gridSize, f, v, z2) { + for (let x2 = x02; x2 < x02 + width2; x2++) + this._edt1d(data2, y02 * gridSize + x2, gridSize, height2, f, v, z2); + for (let y2 = y02; y2 < y02 + height2; y2++) + this._edt1d(data2, y2 * gridSize + x02, 1, width2, f, v, z2); + } + _edt1d(grid2, offset2, stride, n, f, v, z2) { + v[0] = 0; + z2[0] = -Number.MAX_VALUE; + z2[1] = Number.MAX_VALUE; + f[0] = grid2[offset2]; + for (let q = 1, k = 0, s2 = 0; q < n; q++) { + f[q] = grid2[offset2 + q * stride]; + const q2 = q * q; + do { + const r = v[k]; + s2 = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; + } while (s2 <= z2[k] && --k > -1); + k++; + v[k] = q; + z2[k] = s2; + z2[k + 1] = Number.MAX_VALUE; + } + for (let q = 0, k = 0; q < n; q++) { + while (z2[k + 1] < q) { + k++; + } + const r = v[k]; + const qr = q - r; + grid2[offset2 + q * stride] = f[r] + qr * qr; + } } - get isInitialized() { - return this._isInitialized; + } + class ManipulationProcessor { + get manipulators() { + return this._manipulators; } - get mMatrix() { - return this._mMatrix; + get count() { + return this._count; } - get scale() { - return this._scale; + get isDragging() { + return this._isDragging; + } + constructor(core) { + this._core = core; + this._count = 0; + this._centroid = create$6(); + this._previousCentroid = create$6(); + this._relativePositionToCentroid = create$6(); + this._directionToCentroid = create$6(); + this._previousDirectionToCentroid = create$6(); + this._manipulators = {}; + this._removedManipulators = []; + this.cumulativeTranslation = create$6(); + this.translationDelta = create$6(); + this.centroid = create$6(); + this.maxScale = Number.MAX_VALUE; + this.twistAxis = fromValues$3(0, 0, 1); + this.initialize(); } - set scale(value) { - if (this._scale != value) { - this._scale = value; - this._hasChanged = true; + update(elapsedTime, manipulators) { + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (!manipulators[manipulator.id]) { + if (this.removeManipulator) { + this.removeManipulator(manipulator); + } + this._removedManipulators.push(manipulator.id); + } + } + if (this._removedManipulators.length > 0) { + for (let i = 0; i < this._removedManipulators.length; i++) { + delete this._manipulators[this._removedManipulators[i]]; + this._count--; + } + this._removedManipulators = []; + } + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + if (!this._manipulators[manipulator.id]) { + if (!this.addManipulator || this.addManipulator(manipulator)) { + copy$6(manipulator.initialPosition, manipulator.position); + this._manipulators[manipulator.id] = manipulator; + this._count++; + } + } + } + set$8(this.translationDelta, 0, 0, 0); + this.scaleDelta = 0; + this.twistDelta = 0; + if (this._count > 0) { + if (this._previousCount > 0) { + if (this.prepareManipulation) { + this.prepareManipulation(); + } + this._process(); + if (this.processManipulation) { + this.processManipulation(elapsedTime); + } + } else { + this.initialize(); + if (this.beginManipulation) { + this.beginManipulation(); + } + } + } else { + if (this._previousCount > 0) { + if (this.endManipulation) { + this.endManipulation(); + } } + } + this._isDragging = this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; + this._previousCount = this._count; } - get font() { - return this._font; + initialize() { + set$8(this.centroid, 0, 0, 0); + set$8(this.cumulativeTranslation, 0, 0, 0); + this.cumulativeScale = 1; + this.cumulativeTwist = 0; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; + _process() { + if (this._previousCount > 0) { + let persisted = 0; + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + persisted++; + } + } + const removed = this._previousCount - persisted; + if (persisted > 0) { + if (removed > 0) { + copy$6(this._centroid, this._previousCentroid); + } else { + set$8(this._centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + add$4(this._centroid, this._centroid, manipulator.position); + } + } + scale$5(this._centroid, this._centroid, 1 / persisted); + } + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); + add$4(this.translationDelta, this.translationDelta, manipulator.position); + subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); + subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); + const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); + if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) { + this.scaleDelta += 1; + } else { + const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); + const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); + const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); + this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; + scale$5(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); + scale$5(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); + this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); + } + } + } + scale$5(this.translationDelta, this.translationDelta, 1 / persisted); + add$4(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); + this.scaleDelta /= persisted; + this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); + this.scaleDelta -= 1; + this.twistDelta /= persisted; + this.cumulativeTwist += this.twistDelta; } + } + set$8(this.centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + add$4(this.centroid, this.centroid, manipulator.position); + } + scale$5(this.centroid, this.centroid, 1 / this._count); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); + } + copy$6(this._previousCentroid, this.centroid); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + manipulator.isPersisted = true; + copy$6(manipulator.previousPosition, manipulator.position); + copy$6(manipulator.previousRotationAxis, manipulator.rotationAxis); + copy$6(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); + } } - get rotation() { - return this._rotation; + } + class MouseWheel { + constructor(core) { + this._core = core; + this._previousTotal = 0; + this.total = 0; + } + initialize(element2) { + element2.addEventListener("wheel", (e) => { + e.preventDefault(); + const wheelEvent = e; + this.total += wheelEvent.deltaY; + }, { passive: false }); } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._hasChanged = true; - } + update(elapsedTime) { + const total = this.total; + this.delta = total - this._previousTotal; + this._previousTotal = total; + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); + } } - set reverseX(value) { - if (this._reverseX != value) { - this._reverseX = value; - this._hasChanged = true; - } + } + class Manipulator { + constructor() { + this.pickedIndex = 0; + this.maxTranslationSquared = 0; + this.initialPosition = create$6(); + this.position = create$6(); + this.previousPosition = create$6(); + this.holdOrigin = create$6(); + this.positionRelativeToCentroid = create$6(); + this.previousPositionRelativeToCentroid = create$6(); + this.rotationAxis = create$6(); + this.previousRotationAxis = create$6(); } - set reverseY(value) { - if (this._reverseY != value) { - this._reverseY = value; - this._hasChanged = true; - } + } + class Pointers { + get hoverX() { + return this._hoverX; } - set reverseZ(value) { - if (this._reverseZ != value) { - this._reverseZ = value; - this._hasChanged = true; - } + get hoverY() { + return this._hoverY; } - get horizontalAlignment() { - return this._horizontalAlignment; + get hoverId() { + return this._hoverId; } - set horizontalAlignment(value) { - if (this._horizontalAlignment != value) { - this._horizontalAlignment = value; - this._hasChanged = true; - } + constructor(core, manipulators) { + this._core = core; + this._manipulators = manipulators; } - get verticalAlignment() { - return this._verticalAlignment; + initialize(element2) { + this._element = element2; + element2.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); + element2.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); + element2.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); + element2.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); + element2.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); + element2.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); } - set verticalAlignment(value) { - if (this._verticalAlignment != value) { - this._verticalAlignment = value; - this._hasChanged = true; - } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); + this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); + } } - get offsetX() { - return this._offsetX; + _handlePointerDown(e) { + this._element.focus(); + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const manipulator = new Manipulator(); + const id2 = e.pointerId; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + manipulator.id = id2; + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.type = e.pointerType; + manipulator.button = e.button; + manipulator.shiftKey = e.shiftKey; + manipulator.ctrlKey = e.ctrlKey; + manipulator.altKey = e.altKey; + manipulator.event = e; + this._manipulators[id2] = manipulator; + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; } - set offsetX(value) { - if (this._offsetX != value) { - this._offsetX = value; - this._hasChanged = true; - } + _handlePointerMove(e) { + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + const id2 = e.pointerId; + const manipulator = this._manipulators[id2]; + if (manipulator) { + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.event = e; + } + switch (e.pointerType) { + case "mouse": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + break; + case "pen": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + this._tiltX = e.tiltX; + this._tiltY = e.tiltY; + this._twist = e.twist; + break; + } } - get offsetY() { - return this._offsetY; + _handlePointerUp(e) { + const manipulator = this._manipulators[e.pointerId]; + if (manipulator) { + manipulator.event = e; + } + this._remove(e.pointerId); } - set offsetY(value) { - if (this._offsetY != value) { - this._offsetY = value; - this._hasChanged = true; - } + _handlePointerCancel(e) { + this._remove(e.pointerId); } - get offsetZ() { - return this._offsetZ; + _handlePointerLeave(e) { + this._resetHover(); + this._remove(e.pointerId); } - set offsetZ(value) { - if (this._offsetZ != value) { - this._offsetZ = value; - this._hasChanged = true; - } + _handlePointerOut(e) { + this._resetHover(); + this._remove(e.pointerId); } - get maxGlyphTop() { - return this._maxGlyphTop; + _resetHover() { + this._hoverId = null; + this._hoverX = null; + this._hoverY = null; } - set maxGlyphTop(value) { - if (this._maxGlyphTop != value) { - this._maxGlyphTop = value; - this._hasChanged = true; - } + _remove(pointerId) { + const manipulator = this._manipulators[pointerId]; + if (manipulator) { + delete this._manipulators[pointerId]; + } } - get maxGlyphHeight() { - return this._maxGlyphHeight; - } - set maxGlyphHeight(value) { - if (this._maxGlyphHeight != value) { - this._maxGlyphHeight = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._offset = (0, _glMatrix.vec3).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - this._indexCount = 0; - this._maxGlyphs = options.maxGlyphs; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this.scale = options.scale ? options.scale : 1; - this.offsetX = options.offsetX ? options.offsetX : 0; - this.offsetY = options.offsetY ? options.offsetY : 0; - this.offsetZ = options.offsetZ ? options.offsetZ : 0; - this.reverseX = options.reverseX; - this.reverseY = options.reverseY; - this.reverseZ = options.reverseZ; - this.rotation = options.rotation; - this.maxGlyphTop = options.maxGlyphTop; - this.horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - this.verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - this._material = options.material; - this.borderWidth = core.config.textBorderWidth; - this.gamma = 0; + } + class AnimationHelper { + static smoothStep(value2) { + return value2 * value2 * (3 - 2 * value2); + } + static damp(value2, target2, threshold2, dampening) { + if (Math.abs(target2) < threshold2) { + return MathHelper.lerp(value2, 0, dampening); + } else { + return MathHelper.lerp(value2, target2, dampening); + } } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * this._maxGlyphs * 4); - this._verticesView = new DataView(this._vertices); - this._indices = new Uint32Array(this._maxGlyphs * 6); - this._isInitialized = true; + } + class Keyboard { + constructor(core) { + this._core = core; + this._pressedKeys = /* @__PURE__ */ new Set(); + this._previousPressedKeys = /* @__PURE__ */ new Set(); + } + initialize(element2) { + element2.addEventListener("keydown", (e) => { + this._handleKeyDown(e); + }, false); + element2.addEventListener("keyup", (e) => { + this._handleKeyUp(e); + }, false); + } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + } } - update(elapsedTime) {} -} -class Label extends LabelBase { - get textAlignment() { - return this._textAlignment; + isKeyDown(key2) { + return this._pressedKeys.has(key2); } - set textAlignment(value) { - if (this._textAlignment != value) { - this._textAlignment = value; - this._hasChanged = true; + wasKeyReleased(key2) { + if (this._pressedKeys.has(key2)) { + if (!this._previousPressedKeys.has(key2)) { + this._previousPressedKeys.add(key2); + return true; } + } else { + this._previousPressedKeys.delete(key2); + } + return false; } - get text() { - return this._text; + _handleKeyDown(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (!this._pressedKeys.has(key2)) { + this._pressedKeys.add(key2); + } } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; - } + _handleKeyUp(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (this._pressedKeys.has(key2)) { + this._pressedKeys.delete(key2); + } } - constructor(core, options){ - super(core, options); - this._font = options.font || core.font; - this._text = options.text; - this._textAlignment = options.textAlignment === undefined ? (0, _mainJs.TextAlignment).left : options.textAlignment; + } + class Manager { + constructor(core) { + this._manipulators = {}; + this._core = core; + this._vec3 = create$6(); + this._manipulationProcessor = new ManipulationProcessor(core); + this._manipulators = {}; + this._pointers = new Pointers(core, this._manipulators); + this._pointers.initialize(core.container); + this._mouseWheel = new MouseWheel(core); + this._mouseWheel.initialize(core.container); + this._keyboard = new Keyboard(core); + this._keyboard.initialize(core.container); + this.isPickingEnabled = true; + this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; + this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; + this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; + this.pickHoldDelay = this._core.config.pickHoldDelay; + this.pickSelectDelay = this._core.config.pickSelectDelay; + const rightButton2 = 2; + this.singleTouchAction = (manipulator) => { + if (manipulator.type == "mouse" && manipulator.button == rightButton2 || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.translate; + } else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton2) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.rotate; + } + }; + this.mouseWheelAction = (keyboard) => { + if (this._keyboard.isKeyDown("Control")) { + return MouseWheelAction.rotateY; + } else { + return MouseWheelAction.zoom; + } + }; + this.lassoPickType = PickType.data; + this._thumbstickX = 0; + this._previousControllerButtonPressed = [false, false, false, false]; + this._quat0 = create$4(); + this._quat1 = create$4(); } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - if (!this._text) { - this._indexCount = 0; - this.width = 0; - this.height = 0; - } else { - const widths = []; - const truncated = []; - let maxWidth = 0; - let maxGlyphHeight = 0; - let maxGlyphTop = 0; - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - widths.push(this._textMetric.width); - maxWidth = Math.max(this._textMetric.width, maxWidth); - maxGlyphHeight = Math.max(this._textMetric.maxHeight, maxGlyphHeight); - maxGlyphTop = Math.max(this._textMetric.maxTop, maxGlyphTop); - glyphs += text.length; - truncated.push(text); - if (glyphs >= this._maxGlyphs) break; - } - if (this._maxGlyphHeight) maxGlyphHeight = this._maxGlyphHeight; - if (this._maxGlyphTop) maxGlyphTop = this._maxGlyphTop; - const lineHeight = this._font.size; - const height = truncated.length * lineHeight; - switch(this._horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._originX = this._offsetX + maxWidth / 2; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._originX = this._offsetX; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._originX = this._offsetX - maxWidth / 2; - break; + update(elapsedTime, xrFrame) { + if (xrFrame) { + const inputSources = this._core.webXRSession.inputSources; + if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { + const inputSource = inputSources[0]; + const controllerVisual = this._core.renderer.controllers[0]; + if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { + const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); + if (gripPose) { + controllerVisual.mMatrix = gripPose.transform.matrix; + } + const gamepad = inputSource.gamepad; + this._core.renderer.isPickingEnabled = false; + const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); + if (rayPose) { + controllerVisual.rayMMatrix = rayPose.transform.matrix; + if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { + this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; + this._core.renderer.isPickingEnabled = true; + } + } + const threshold2 = 0.2; + const dampening = Math.min(0.015 * elapsedTime, 1); + this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold2, dampening); + if (this._thumbstickX != 0) { + setAxisAngle(this._quat0, Constants$1.VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); + this._core.getModelRotation(this._quat1); + multiply(this._quat1, this._quat0, this._quat1); + this._core.setModelRotation(this._quat1, true); + } + if (gamepad.buttons[2].pressed) { + if (!this._previousControllerButtonPressed[2]) { + this._previousControllerButtonPressed[2] = true; + if (this.controllerButtonPressedCallback) { + this.controllerButtonPressedCallback(2); } - switch(this._verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._originY = this._offsetY - height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._originY = this._offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._originY = this._offsetY + height / 2; - break; + } + } else { + this._previousControllerButtonPressed[2] = false; + } + } + } + } else { + const camera = this._core.camera; + this._manipulationProcessor.update(elapsedTime, this._manipulators); + this._pointers.update(elapsedTime); + this._mouseWheel.update(elapsedTime); + this._keyboard.update(elapsedTime); + if (this._mouseWheel.delta != 0) { + switch (this.mouseWheelAction(this._keyboard)) { + case MouseWheelAction.zoom: + if (this._pointers.hoverX, this._pointers.hoverY) { + camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); + } + break; + case MouseWheelAction.rotateY: + setAxisAngle(this._quat0, Constants$1.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); + camera.getOrbit(this._quat1); + multiply(this._quat1, this._quat1, this._quat0); + camera.setOrbit(this._quat1, true); + break; + } + } + const count2 = this._manipulationProcessor.count; + if (count2 == 0) { + if (this._isLassoPicking) { + this._isLassoPicking = false; + this._core.renderer.isLassoPicking = false; + const x02 = Math.min(this._lassoX0, this._lassoX1); + const y02 = Math.min(this._lassoY0, this._lassoY1); + const x12 = Math.max(this._lassoX0, this._lassoX1); + const y12 = Math.max(this._lassoY0, this._lassoY1); + if (x12 - x02 > 0 && y12 - y02 > 0) { + const sets = this._core.pickLasso(x02, y02, x12, y12, this.lassoPickType); + const result = { + x0: x02, + y0: y02, + x1: x12, + y1: y12, + pickType: this.lassoPickType, + ids: sets, + manipulator: this._manipulator + }; + this.pickLassoCallback(result); + } + } + } else if (count2 == 1) { + const translationDelta = this._manipulationProcessor.translationDelta; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + const manipulators = this._manipulationProcessor.manipulators; + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + switch (this.singleTouchAction(manipulator)) { + case SingleTouchAction.rotate: + camera.rotate(translationDelta); + break; + case SingleTouchAction.translate: + camera.translate(translationDelta); + break; + case SingleTouchAction.lasso: + if (this.pickLassoCallback) { + if (!this._isLassoPicking) { + this._isLassoPicking = true; + this._core.renderer.isLassoPicking = true; + this._lassoX0 = manipulator.position[0]; + this._lassoY0 = manipulator.position[1]; + } + this._lassoX1 = manipulator.position[0]; + this._lassoY1 = manipulator.position[1]; + this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); + this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); + } + break; + } + break; + } + } + } else { + const translationDelta = this._manipulationProcessor.translationDelta; + const camera2 = this._core.camera; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + camera2.translate(translationDelta); + } + if (this._manipulationProcessor.scaleDelta != 0) { + const distance2 = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; + camera2.zoom(distance2, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + if (this._manipulationProcessor.twistDelta != 0) { + camera2.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + } + if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { + const camera2 = this._core.camera; + const renderer = this._core.renderer; + if (renderer.isCapturingPickImage) { + camera2.updatePickVMatrix(renderer.width / 2, renderer.height / 2); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + this._pickedTime = 0; + } else if (this._pointers.hoverId > -1) { + const pickingX = this._pointers.hoverX; + const pickingY = this._pointers.hoverY; + camera2.updatePickVMatrix(pickingX, pickingY); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + if (this._pickedId != renderer.pickedId) { + this._pickedId = renderer.pickedId; + this._pickedTime = 0; + } else { + if (this._manipulationProcessor.count == 1) { + this._pickedTime += elapsedTime; + for (const key2 in this._manipulators) { + this._manipulator = this._manipulators[key2]; + break; } - glyphs = 0; - for(let i = 0; i < truncated.length; i++){ - switch(this._textAlignment){ - case (0, _mainJs.TextAlignment).left: - this._offset[0] = this._originX - maxWidth / 2; - break; - case (0, _mainJs.TextAlignment).center: - this._offset[0] = this._originX - widths[i] / 2; - break; - case (0, _mainJs.TextAlignment).right: - this._offset[0] = this._originX + maxWidth / 2 - widths[i]; - break; + } + } + if (this._pickedTime > 0) { + switch (renderer.pickedType) { + case PickType.data: + if (this._pickedTime > this.pickHoldDelay) { + renderer.getVertexPosition(this._vec3, this._pickedId); + this._core.setModelManipulationOrigin(this._vec3); + this._pickedTime = 0; + } else if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.transitionBuffers.length; i++) { + const transitionBuffer = renderer.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + transitionBuffer: i, + id: id2, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); + if (this.pickItemCallback) { + this.pickItemCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.label: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.labelSets.length; i++) { + const labelSet = renderer.labelSets[i].label; + const id2 = labelSet.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + label: id2, + set: i, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); + if (this.pickLabelSetCallback) { + this.pickLabelSetCallback(result); + } + break; + } + } } - this._offset[1] = this._originY + height / 2 - i * lineHeight - lineHeight / 2 - maxGlyphTop / 2; - const pickingId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickingId, (0, _mainJs.PickType).label, this._vec4); - const text = truncated[i]; - if (text.length > 0) { - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, (0, _constantsJs.Constants).VECTOR3_ZERO, 1, this._offset, null, this._vec4); - glyphs += text.length; + this._pickedTime = 0; + } + break; + case PickType.axesDivision: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickGridLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickGrid(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); + if (this.pickAxesGridCallback) { + this.pickAxesGridCallback(result); + } + break; + } + } } - } - const scaling = this._scale / this._font.size; - this.width = maxWidth * scaling; - this.height = height * scaling; - this._indexCount = glyphs * 6; - (0, _glMatrix.vec3).set(this._vec3, scaling, scaling, scaling); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, this._vec3); - if (this.hasChangedCallback) this.hasChangedCallback(); - } + this._pickedTime = 0; + } + break; + case PickType.axesTitle: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickTitleLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickTitle(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); + if (this.pickAxesTitleCallback) { + this.pickAxesTitleCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesLabel: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickLabelLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickLabel(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); + if (this.pickAxesLabelCallback) { + this.pickAxesLabelCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesHeading: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickHeadingLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickHeading(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); + if (this.pickAxesHeadingCallback) { + this.pickAxesHeadingCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + } + } + } else { + renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } else { + this._core.renderer.isPickingEnabled = false; + this._pickedTime = 0; } + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); + this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); + } } -} -class LabelSet extends LabelBase { - get materials() { - return this._materials; - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; + } + let Log$1 = class Log { + constructor(core) { + this._core = core; + } + write(level, value2) { + if (level >= this._core.config.logLevel) { + switch (level) { + case LogLevel.trace: + console.trace(value2); + break; + case LogLevel.debug: + console.debug(value2); + break; + case LogLevel.info: + console.info(value2); + break; + case LogLevel.warn: + console.warn(value2); + break; + case LogLevel.error: + console.error(value2); + break; } + } } - get minBoundsY() { - return this._minBoundsY; + }; + var __awaiter$4 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Core { + get container() { + return this._container; } - get maxBoundsX() { - return this._maxBoundsX; + get started() { + return this._started; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + get debugText() { + return this._debugText; } - get maxBoundsY() { - return this._maxBoundsY; + get log() { + return this._log; } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } + get totalFrames() { + return this._fps.totalFrames; } - get maxBoundsZ() { - return this._maxBoundsZ; + get camera() { + return this._camera; } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + set camera(value2) { + this._camera = value2; } - get positionsX() { - return this._positionsX; + getModelRotation(value2) { + copy$4(value2, this._modelRotation); } - set positionsX(value) { - if (this._positionsX != value) { - this._positionsX = value; - this._hasChanged = true; - } + setModelRotation(value2, isSmooth) { + copy$4(this._modelRotation, value2); + if (!isSmooth) { + copy$4(this._smoothedModelRotation, this._modelRotation); + } } - get positionsY() { - return this._positionsY; + getModelScale() { + return this._modelScale[0]; } - set positionsY(value) { - if (this._positionsY != value) { - this._positionsY = value; - this._hasChanged = true; - } + setModelScale(value2, isSmooth) { + set$8(this._modelScale, value2, value2, value2); + if (!isSmooth) { + copy$6(this._smoothedModelScale, this._modelScale); + } } - get positionsZ() { - return this._positionsZ; + getModelManipulationOrigin(value2) { + copy$6(value2, this._modelManipulationOrigin); } - set positionsZ(value) { - if (this._positionsZ != value) { - this._positionsZ = value; - this._hasChanged = true; - } + setModelManipulationOrigin(value2) { + this._updateManipulationOrigin(value2); } - get positionScalingX() { - return this._positionScalingX; + getModelPosition(value2) { + copy$6(value2, this._modelPosition); } - set positionScalingX(value) { - if (this._positionScalingX != value) { - this._positionScalingX = value; - this._hasChanged = true; - } + setModelPosition(value2, isSmooth) { + copy$6(this._modelPosition, value2); + if (!isSmooth) { + copy$6(this._smoothedModelPosition, this._modelPosition); + } } - get positionScalingY() { - return this._positionScalingY; + get webXRSession() { + return this._webXRSession; } - set positionScalingY(value) { - if (this._positionScalingY != value) { - this._positionScalingY = value; - this._hasChanged = true; - } + get renderer() { + return this._renderer; } - get positionScalingZ() { - return this._positionScalingZ; + set renderer(renderer) { + if (this._renderer == renderer) { + return; + } + if (this._renderer) { + this.stop(); + this._renderer.remove(); + } + if (!renderer.isInitialized) { + renderer.initialize(this); + } + if (this._renderer) { + renderer.transitionTime = this._renderer.transitionTime; + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const previousTransitionBuffer = this._renderer.transitionBuffers[i]; + const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); + transitionBuffer.copyFrom(previousTransitionBuffer); + renderer.transitionBuffers.push(transitionBuffer); + } + const currentAxes = this._renderer.currentAxes; + if (currentAxes) { + renderer.currentAxes = []; + for (let i = 0; i < currentAxes.length; i++) { + const axesVisual = currentAxes[i]; + const axes = axesVisual.axes; + if (axes instanceof Cartesian3dAxes) { + const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); + renderer.currentAxes.push(cartesian3dAxesVisual); + } else if (axes instanceof Cartesian2dAxes) { + renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); + } + } + } + const labelSets = this._renderer.labelSets; + if (labelSets) { + renderer.labelSets = []; + for (let i = 0; i < labelSets.length; i++) { + renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); + } + } + const images = this._renderer.images; + if (images) { + renderer.images = []; + for (let i = 0; i < images.length; i++) { + renderer.images.push(renderer.createImageVisual(images[i].image)); + } + } + const fonts = this._renderer.fonts; + if (fonts) { + for (const key2 in fonts) { + const font2 = fonts[key2].font; + renderer.fonts[font2.name] = renderer.createFontVisual(font2); + } + } + } else { + renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); + } + if (this._renderer) { + this._renderer.finalize(); + } + this._renderer = renderer; + this._fps.reset(); + this.start(); } - set positionScalingZ(value) { - if (this._positionScalingZ != value) { - this._positionScalingZ = value; - this._hasChanged = true; - } + get font() { + return this._font; } - get rotations() { - return this._rotations; + get paletteResources() { + return this._paletteResources; } - set rotations(value) { - if (this._rotations != value) { - this._rotations = value; - this._hasChanged = true; - } + get config() { + return this._config; } - get offsetsX() { - return this._offsetsX; + get inputManager() { + return this._inputManager; + } + constructor(options2) { + setMatrixArrayType(Array); + this._vec3 = create$6(); + this._quat = create$4(); + this._mat4 = create$7(); + this._container = options2 && options2.container ? options2.container : document.body; + this._config = new Config$2(this); + this._log = new Log$1(this); + this._debugText = new DebugText(); + this._inputManager = options2 && options2.useInputManager === false ? null : new Manager(this); + const fontRasterizerOptions = options2 && options2.fontRasterizerOptions ? options2.fontRasterizerOptions : { + fontAtlas: new FontAtlas(256, 512), + fontSize: 24, + border: 3, + fontFamily: '"segoe ui semibold", sans-serif', + fontWeight: "normal", + fontStyle: "normal", + baseline: "alphabetic", + maxDistance: 8, + edgeValue: 192 + }; + const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); + this._font = fontRasterizer.font; + this._paletteResources = new PaletteResources(); + this._previousTime = 0; + this._fps = new Fps(this); + this._modelMMatrix = create$7(); + this._modelPosition = create$6(); + this._modelRotation = create$4(); + this._modelScale = create$6(); + this._smoothedModelPosition = create$6(); + this._smoothedModelRotation = create$4(); + this._smoothedModelScale = create$6(); + this._modelManipulationOrigin = create$6(); + this._camera = new AltAzimuthCamera(this); + this.resetModel(false); } - set offsetsX(value) { - if (this._offsetsX != value) { - this._offsetsX = value; - this._hasChanged = true; - } + getView(view) { + this.getModelPosition(view.position); + this.getModelRotation(view.rotation); + view.scale = this.getModelScale(); } - get offsetsY() { - return this._offsetsY; + setView(view, isSmooth) { + this.setModelPosition(view.position, isSmooth); + this.setModelRotation(view.rotation, isSmooth); + this.setModelScale(view.scale, isSmooth); } - set offsetsY(value) { - if (this._offsetsY != value) { - this._offsetsY = value; - this._hasChanged = true; - } + lerpView(from, to, time2) { + lerp$1(this._vec3, from.position, to.position, time2); + this.setModelPosition(this._vec3, false); + slerp(this._quat, from.rotation, to.rotation, time2); + this.setModelRotation(this._quat, false); + this.setModelScale(MathHelper.lerp(from.scale, to.scale, time2), false); } - get offsetsZ() { - return this._offsetsZ; + resetModel(isSmooth) { + set$8(this._modelPosition, 0, 0, -this._config.modelDistance); + set$8(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); + set$6(this._modelRotation, 0, 0, 0, 1); + if (!isSmooth) { + this._syncSmooth(); + } } - set offsetsZ(value) { - if (this._offsetsZ != value) { - this._offsetsZ = value; - this._hasChanged = true; - } + resetManipulationOrigin() { + if (!exactEquals$1(this._modelManipulationOrigin, Constants$1.VECTOR3_ZERO)) { + this._updateManipulationOrigin(Constants$1.VECTOR3_ZERO); + } } - get offsetScalingX() { - return this._offsetScalingX; + reset(isSmooth) { + this.resetModel(isSmooth); + this.resetManipulationOrigin(); + this._camera.reset(isSmooth); } - set offsetScalingX(value) { - if (this._offsetScalingX != value) { - this._offsetScalingX = value; - this._hasChanged = true; + start() { + if (!this._started && this._renderer) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + this._started = true; + this._log.write(LogLevel.info, "render loop started"); + if (this.startCallback) { + this.startCallback(); } + } } - get offsetScalingY() { - return this._offsetScalingY; - } - set offsetScalingY(value) { - if (this._offsetScalingY != value) { - this._offsetScalingY = value; - this._hasChanged = true; + stop() { + if (this._started) { + this._started = false; + if (this._windowAnimationFrame != null) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + this._log.write(LogLevel.info, "render loop stopped"); } - } - get offsetScalingZ() { - return this._offsetScalingZ; - } - set offsetScalingZ(value) { - if (this._offsetScalingZ != value) { - this._offsetScalingZ = value; - this._hasChanged = true; + if (this.stopCallback) { + this.stopCallback(); } + } } - get text() { - return this._text; + checkWebXRSupport() { + const xrSystem = navigator.xr; + if (xrSystem) { + xrSystem.isSessionSupported("immersive-vr").then((supported) => { + if (supported) { + this._log.write(LogLevel.info, "WebXR supported"); + if (this.webXRSupportedCallback) { + this.webXRSupportedCallback(); + } + } + }); + } } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; - } + requestWebXRSession() { + if (this._webXRSession) { + this._webXRSession.end(); + } else { + navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); + } } - get horizontalAlignments() { - return this._horizontalAlignments; + _webXRSessionStarted(session) { + if (this.webXRSessionStartedCallback) { + this.webXRSessionStartedCallback(); + } + this._webXRSession = session; + session.onend = () => this._webXRSessionEnded(); + this._renderer.initializeWebXR(session).then(() => { + if (this._windowAnimationFrame) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + } + session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + }); + session.oninputsourceschange = (event2) => this._webXRInputSourcesChanged(event2); } - set horizontalAlignments(value) { - if (this._horizontalAlignments != value) { - this._horizontalAlignments = value; - this._hasChanged = true; + _webXRSessionEnded() { + if (this.webXRSessionEndedCallback) { + this.webXRSessionEndedCallback(); + } + this._webXRSession = null; + this._renderer.controllers.length = 0; + this.start(); + } + _webXRInputSourcesChanged(event2) { + if (event2.added.length > 0) { + const added = event2.added[0]; + if (added.targetRayMode == "tracked-pointer") { + const profiles = added.profiles; + const handedness = added.handedness; + if (this.webXRInputSourceRequestCallback) { + this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { + const options2 = { + profiles, + handedness, + obj: response.obj, + texture: response.texture + }; + const controller = new Controller(this, options2); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + }, (e) => { + this._log.write(LogLevel.error, e); + }); + } else { + const options2 = {}; + const controller = new Controller(this, options2); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + } } + } + if (event2.removed.length > 0) { + this.renderer.controllers.length = 0; + } } - get verticalAlignments() { - return this._verticalAlignments; - } - set verticalAlignments(value) { - if (this._verticalAlignments != value) { - this._verticalAlignments = value; - this._hasChanged = true; + _tick(currentTime, xrFrame) { + return __awaiter$4(this, void 0, void 0, function* () { + let elapsedTime = currentTime - this._previousTime; + this._previousTime = currentTime; + if (elapsedTime > 0) { + this.update(elapsedTime, xrFrame); + yield this.render(elapsedTime, xrFrame); + } + if (xrFrame) { + xrFrame.session.requestAnimationFrame((currentTime2, xrframe) => this._tick(currentTime2, xrframe)); + } else if (this._started) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime2) => this._tick(currentTime2)); } + }); } - get scales() { - return this._scales; + update(elapsedTime, xrFrame) { + this._renderer.setSize(elapsedTime); + if (this.updateCallback) { + this.updateCallback(elapsedTime, xrFrame); + } + if (this._config.isDebugVisible) { + this._debugText.clear(); + } + this._fps.update(elapsedTime); + if (this._inputManager) { + this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; + this._inputManager.update(elapsedTime, xrFrame); + } + let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); + lerp$1(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); + amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); + slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); + amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); + lerp$1(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); + fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); + this._renderer.mMatrix = this._modelMMatrix; + if (this._config.isDebugVisible) { + this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); + this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); + this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); + this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); + this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); + this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); + this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); + } + if (!xrFrame) { + this._camera.width = this._renderer.width; + this._camera.height = this._renderer.height; + this._camera.modelMMatrix = this._modelMMatrix; + this._camera.modelPosition = this._smoothedModelPosition; + this._camera.modelRotation = this._smoothedModelRotation; + this._camera.modelScale = this._smoothedModelScale; + this._camera.modelManipulationOrigin = this._modelManipulationOrigin; + this._camera.update(elapsedTime); + this._renderer.vMatrices = this._camera.vMatrices; + this._renderer.mvMatrices = this._camera.mvMatrices; + this._renderer.pMatrices = this._camera.pMatrices; + this._renderer.inverseVMatrices = this._camera.inverseVMatrices; + this._renderer.inversePMatrices = this._camera.inversePMatrices; + } + this._renderer.prepare(xrFrame); + if (!xrFrame && this._config.stereoMode == StereoMode.none) { + this._renderer.pickPMatrix = this._camera.pMatrices[0]; + } else { + const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); + perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); + this._renderer.pickPMatrix = this._mat4; + } + if (this._renderer.isInitialized) { + this._renderer.update(elapsedTime); + } } - set scales(value) { - if (this._scales != value) { - this._scales = value; - this._hasChanged = true; + render(elapsedTime, xrFrame) { + return __awaiter$4(this, void 0, void 0, function* () { + this._fps.render(); + if (this._renderer.isInitialized) { + yield this._renderer.render(elapsedTime, xrFrame); + if (this.afterRenderCallback) { + this.afterRenderCallback(); + } } + }); } - get scalesScaling() { - return this._scalesScaling; - } - set scalesScaling(value) { - if (this._scalesScaling != value) { - this._scalesScaling = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._quat = (0, _glMatrix.quat).create(); - this._materials = options.materials; - this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - this._font = options.font || core.font; - this.text = options.text; - this.positionsX = options.positionsX; - this.positionsY = options.positionsY; - this.positionsZ = options.positionsZ; - this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - this.rotations = options.rotations; - this.offsetsX = options.offsetsX; - this.offsetsY = options.offsetsY; - this.offsetsZ = options.offsetsZ; - this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - if (options.horizontalAlignments) this.horizontalAlignments = options.horizontalAlignments; - if (options.verticalAlignments) this.verticalAlignments = options.verticalAlignments; - if (options.scales) this.scales = options.scales; - this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; + _syncSmooth() { + copy$6(this._smoothedModelPosition, this._modelPosition); + copy$6(this._smoothedModelScale, this._modelScale); + copy$4(this._smoothedModelRotation, this._modelRotation); + } + _updateManipulationOrigin(position2) { + this._log.write(LogLevel.info, `manipulation origin ${position2[0].toFixed(3)},${position2[1].toFixed(3)},${position2[2].toFixed(3)}`); + this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position2); + copy$6(this._modelManipulationOrigin, position2); + transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); + subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); + copy$6(this._smoothedModelPosition, this._modelPosition); + if (this.manipulationOriginChangedCallback) { + const result = { + x: position2[0], + y: position2[1], + z: position2[2] + }; + this.manipulationOriginChangedCallback(result); + } } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.pickIdLookup = {}; - if (!this._text) this._indexCount = 0; - else { - const start = window.performance.now(); - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; - const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; - const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; - if (this._rotation) (0, _glMatrix.quat).set(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; - const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; - const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - const scale = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const lineHeight = this._font.size * scale; - const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale; - const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = offsetX - width; - break; - } - const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = offsetY + lineHeight / 2; - break; - } - this._offset[1] -= maxGlyphTop / 2; - this._offset[2] = offsetZ; - let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; - let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; - let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; - if (this._reverseX) positionX = this.minBoundsX + this.maxBoundsX - positionX; - if (this._reverseY) positionY = this.minBoundsY + this.maxBoundsY - positionY; - if (this._reverseZ) positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; - (0, _glMatrix.vec3).set(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); - if (this._rotations) (0, _glMatrix.quat).set(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = i; - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, this._vec3, scale, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); - glyphs += text.length; - if (glyphs >= this._maxGlyphs) { - glyphs = this._maxGlyphs; - break; - } + pickLasso(x02, y02, x12, y12, pickType) { + const inverseMMatrix = create$7(); + invert$1(inverseMMatrix, this._modelMMatrix); + const sets = []; + const nearPositions = [create$6(), create$6(), create$6(), create$6()]; + const farPositions = [create$6(), create$6(), create$6(), create$6()]; + const directions = [create$6(), create$6(), create$6(), create$6()]; + this._camera.unproject(nearPositions[0], x02, y12, -1); + this._camera.unproject(farPositions[0], x02, y12, 1); + this._camera.unproject(nearPositions[1], x12, y12, -1); + this._camera.unproject(farPositions[1], x12, y12, 1); + this._camera.unproject(nearPositions[2], x12, y02, -1); + this._camera.unproject(farPositions[2], x12, y02, 1); + this._camera.unproject(nearPositions[3], x02, y02, -1); + this._camera.unproject(farPositions[3], x02, y02, 1); + for (let i = 0; i < 4; i++) { + transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); + transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); + subtract(directions[i], farPositions[i], nearPositions[i]); + normalize$5(directions[i], directions[i]); + } + const normals = [create$6(), create$6(), create$6(), create$6()]; + const d2 = []; + for (let i = 0; i < 4; i++) { + cross$1(normals[i], directions[(i + 1) % 4], directions[i]); + normalize$5(normals[i], normals[i]); + d2.push(-dot$1(normals[i], nearPositions[i])); + } + if (pickType == PickType.data) { + const translation = create$6(); + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const transitionBuffer = this._renderer.transitionBuffers[i]; + const set2 = /* @__PURE__ */ new Set(); + if (transitionBuffer.isVisible) { + const start = window.performance.now(); + const currentBuffer = transitionBuffer.currentBuffer; + const lookup2 = currentBuffer.lookup; + for (let j = 0; j < currentBuffer.length; j++) { + const id2 = currentBuffer.ids[j]; + const index2 = lookup2[id2]; + if (index2 != null) { + UnitVertex.getTranslation(currentBuffer.dataView, index2, translation); + let isInside = true; + for (let k = 0; k < 4; k++) { + let distance2 = dot$1(normals[k], translation); + distance2 += d2[k]; + if (distance2 < 0) { + isInside = false; + break; + } } - this._indexCount = glyphs * 6; - this._core.log.write((0, _mainJs.LogLevel).info, `label set updated ${Math.round(window.performance.now() - start)}ms`); - if (this.hasChangedCallback) this.hasChangedCallback(); + if (isInside) { + set2.add(id2); + } + } + } + if (set2.size > 0) { + this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set2.size} ${Math.round(window.performance.now() - start)}ms`); } + } + sets.push(set2); } + } + return sets; + } + } + const StereoMode = { + none: "none", + split: "split", + anaglyph: "anaglyph", + left: "left", + right: "right" + }; + const HorizontalAlignment = { + left: "left", + center: "center", + right: "right" + }; + const VerticalAlignment = { + top: "top", + center: "center", + bottom: "bottom" + }; + const AxesTextOrientation = { + parallel: "parallel", + perpendicular: "perpendicular" + }; + const AxesVisibility = { + none: "none", + current: "current", + previous: "previous" + }; + const PickType = { + none: 0, + data: 1, + label: 2, + axesDivision: 3, + axesTitle: 4, + axesLabel: 5, + axesHeading: 6 + }; + const Theme = { + dark: "dark", + light: "light" + }; + const HighlightMode = { + luminance: "luminance", + color: "color" + }; + const UnitType = { + block: "block", + blockSdf: "blockSdf", + sphere: "sphere", + sphereSdf: "sphereSdf", + cylinder: "cylinder", + cylinderSdf: "cylinderSdf", + hexPrism: "hexPrism", + hexPrismSdf: "hexPrismSdf", + sdf: "sdf", + disk: "disk", + ringSdf: "ringSdf" + }; + const SingleTouchAction = { + translate: "translate", + rotate: "rotate", + lasso: "lasso" + }; + const MouseWheelAction = { + zoom: "zoom", + rotateY: "rotateY" + }; + const LogLevel = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4 + }; + const Edge3D = { + topFront: 0, + topRight: 1, + topBack: 2, + bottomRight: 5, + frontRight: 8, + backRight: 9 + }; + const RenderMode = { + color: "color" + }; + let LabelSetVisual$2 = class LabelSetVisual { + render(elapsedTime, xrFrame) { } -} -class TransitionLabelSet { - constructor(core){ - this._core = core; - this._vec2 = (0, _glMatrix.vec2).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._quat = (0, _glMatrix.quat).create(); - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this._topLeft = (0, _glMatrix.vec3).create(); - this._topRight = (0, _glMatrix.vec3).create(); - this._bottomLeft = (0, _glMatrix.vec3).create(); - this._bottomRight = (0, _glMatrix.vec3).create(); - this._offset = (0, _glMatrix.vec3).create(); + update(elapsedTime) { } - update(buffer, labelIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.text.length : options.count; - const dataView = buffer.dataView; - const minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - const minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - const minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - const maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - const maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - const maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - const positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - const positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - const positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - const offsetX = options.offsetX ? options.offsetX : 0; - const offsetY = options.offsetY ? options.offsetY : 0; - const offsetZ = options.offsetZ ? options.offsetZ : 0; - const offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - const offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - const offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const scale = options.scale ? options.scale : 1; - const scalesScaling = options.scalesScaling ? options.scalesScaling : 1; - const font = options.font || this._core.font; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const modelSizeX = maxBoundsX - minBoundsX; - const modelSizeY = maxBoundsY - minBoundsY; - const modelSizeZ = maxBoundsZ - minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (minBoundsX + maxBoundsX) / 2; - const modelOriginY = (minBoundsY + maxBoundsY) / 2; - const modelOriginZ = (minBoundsZ + maxBoundsZ) / 2; - if (options.rotation) { - this._quat[0] = options.rotation[0]; - this._quat[1] = options.rotation[1]; - this._quat[2] = options.rotation[2]; - this._quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(this._quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - this.pickIdLookup = {}; - for(let i = 0; i < count; i++){ - const labelIndex = labelIds[i + offset]; - const _offsetX = (options.offsetsX ? options.offsetsX[labelIndex] / 2 : offsetX) * boundsScaling * offsetScalingX; - const _offsetY = (options.offsetsY ? options.offsetsY[labelIndex] / 2 : offsetY) * boundsScaling * offsetScalingY; - const _offsetZ = (options.offsetsZ ? options.offsetsZ[labelIndex] / 2 : offsetZ) * boundsScaling * offsetScalingZ; - const label = options.text[labelIndex]; - const _scale = (options.scales ? options.scales[labelIndex] * scalesScaling : scale) * boundsScaling / font.size; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width * _scale; - const lineHeight = font.size * _scale; - const _maxGlyphTop = (options.maxGlyphTop ? options.maxGlyphTop : this._textMetric.maxTop) * _scale; - const _horizontalAlignment = options.horizontalAlignments ? options.horizontalAlignments[labelIndex] : horizontalAlignment; - switch(_horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = _offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = _offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = _offsetX - width; - break; - } - const _verticalAlignment = options.verticalAlignments ? options.verticalAlignments[labelIndex] : verticalAlignment; - switch(_verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = _offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = _offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = _offsetY + lineHeight / 2; - break; - } - this._offset[1] -= _maxGlyphTop / 2; - this._offset[2] = _offsetZ; - let positionX = options.positionsX ? options.positionsX[labelIndex] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[labelIndex] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[labelIndex] * positionScalingZ : 0; - if (options.reverseX) positionX = minBoundsX + maxBoundsX - positionX; - if (options.reverseY) positionY = minBoundsY + maxBoundsY - positionY; - if (options.reverseZ) positionZ = minBoundsZ + maxBoundsZ - positionZ; - positionX = (positionX - modelOriginX) * boundsScaling; - positionY = (positionY - modelOriginY) * boundsScaling; - positionZ = (positionZ - modelOriginZ) * boundsScaling; - if (options.rotations) (0, _glMatrix.quat).set(this._quat, options.rotations[labelIndex * 4], options.rotations[labelIndex * 4 + 1], options.rotations[labelIndex * 4 + 2], options.rotations[labelIndex * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = labelIndex; - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[labelIndex], minOrder, maxOrder, 0, 1); - this._vec2[0] = orderReverse ? 1 - order : order; - } else this._vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) this._vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[labelIndex], minStaggerOrder, maxStaggerOrder, 0, 1); - this._vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else this._vec2[1] = count == 1 ? 0 : i / (count - 1); - let glyphIndex = options.glyphOffsets[labelIndex]; - for (const char of label){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const width = glyph.width * _scale; - const height = glyph.height * _scale; - const top = glyph.top * _scale; - const border = font.border * _scale; - const x0 = this._offset[0] - border; - const x1 = this._offset[0] + width + border; - const y0 = this._offset[1] + top + border; - const y1 = this._offset[1] + top - height - border; - const z0 = this._offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (options.rotation || options.rotations) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, this._quat); - } - (0, _vertexJs.UnitVertex).setRotation(dataView, glyphIndex, this._quat); - this._vec3[0] = positionX + (this._topLeft[0] + this._bottomRight[0]) / 2; - this._vec3[1] = positionY + (this._topLeft[1] + this._bottomRight[1]) / 2; - this._vec3[2] = positionZ + (this._topLeft[2] + this._bottomRight[2]) / 2; - (0, _vertexJs.UnitVertex).setTranslation(dataView, glyphIndex, this._vec3); - this._vec3[0] = Math.abs(x1 - x0); - this._vec3[1] = Math.abs(y1 - y0); - this._vec3[2] = 0.001; - (0, _vertexJs.UnitVertex).setScale(dataView, glyphIndex, this._vec3); - this._vec4[0] = glyph.u0; - this._vec4[1] = glyph.v0; - this._vec4[2] = glyph.u1; - this._vec4[3] = glyph.v1; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, glyphIndex, this._vec4); - (0, _vertexJs.UnitVertex).setIdHover(dataView, glyphIndex, options.hover ? options.hover[labelIndex] : labelIndex); - (0, _vertexJs.UnitVertex).setOrder(dataView, glyphIndex, this._vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, glyphIndex, options.material ? options.material : options.materials ? options.materials[labelIndex] : 0); - (0, _vertexJs.UnitVertex).setTexture(dataView, glyphIndex, 1); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, glyphIndex, this._core.config.sdfBuffer); - this._offset[0] += glyph.advance * _scale; - glyphIndex++; - } - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../helpers/text.js":"fG2oi","../constants.js":"lD0bG","../vertex.js":"4J2YE","../helpers/pick.js":"1t2sb","../helpers/math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwtZG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -parcelHelpers.export(exports, "ImageBase", ()=>ImageBase); -parcelHelpers.export(exports, "ImageQuad", ()=>ImageQuad); -parcelHelpers.export(exports, "ImageSphere", ()=>ImageSphere); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -var _sphereJs = require("../meshes/sphere.js"); -var _constantsJs = require("../constants.js"); -class ImageVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(image){ - this.image = image; - } -} -class ImageBase { + constructor(labelSet) { + this.label = labelSet; + } + }; + let LabelBase$1 = class LabelBase { get material() { - return this._material; + return this._material; } get vertices() { - return this._vertices; + return this._vertices; + } + get verticesView() { + return this._verticesView; } get indices() { - return this._indices; + return this._indices; } get indexCount() { - return this._indexCount; + return this._indexCount; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get mMatrix() { - return this._mMatrix; + return this._mMatrix; } - get imageData() { - return this._imageData; + get materialType() { + return this._materialType; } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._hasChanged = true; - } + get materialColor() { + return this._materialColor; } - get rotation() { - return this._rotation; + get materialFuzz() { + return this._materialFuzz; } - set rotation(value) { - if (!(0, _glMatrix.quat).equals(this._rotation, value)) { - (0, _glMatrix.quat).copy(this._rotation, value); - this._hasChanged = true; - } + get materialGloss() { + return this._materialGloss; } - get position() { - return this._position; + get segmentColor() { + return this._segmentColor; } - set position(value) { - if (!(0, _glMatrix.vec3).equals(this._position, value)) { - (0, _glMatrix.vec3).copy(this._position, value); - this._hasChanged = true; - } + get scale() { + return this._scale; } - get texCoord0() { - return this._texCoord0; + set scale(value2) { + if (this._scale != value2) { + this._scale = value2; + this._hasChanged = true; + } } - set texCoord0(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord0, value)) { - (0, _glMatrix.vec2).copy(this._texCoord0, value); - this._hasChanged = true; - } + get font() { + return this._font; } - get texCoord1() { - return this._texCoord1; + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } - set texCoord1(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord1, value)) { - (0, _glMatrix.vec2).copy(this._texCoord1, value); - this._hasChanged = true; - } + get rotation() { + return this._rotation; } - get minBoundsX() { - return this._minBoundsX; + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._hasChanged = true; + } } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; - } + set reverseX(value2) { + if (this._reverseX != value2) { + this._reverseX = value2; + this._hasChanged = true; + } } - get minBoundsY() { - return this._minBoundsY; + set reverseY(value2) { + if (this._reverseY != value2) { + this._reverseY = value2; + this._hasChanged = true; + } } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; - } + set reverseZ(value2) { + if (this._reverseZ != value2) { + this._reverseZ = value2; + this._hasChanged = true; + } } - get minBoundsZ() { - return this._minBoundsZ; + get horizontalAlignment() { + return this._horizontalAlignment; } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } + set horizontalAlignment(value2) { + if (this._horizontalAlignment != value2) { + this._horizontalAlignment = value2; + this._hasChanged = true; + } } - get maxBoundsX() { - return this._maxBoundsX; + get verticalAlignment() { + return this._verticalAlignment; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + set verticalAlignment(value2) { + if (this._verticalAlignment != value2) { + this._verticalAlignment = value2; + this._hasChanged = true; + } } - get maxBoundsY() { - return this._maxBoundsY; + get offsetX() { + return this._offsetX; } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } + set offsetX(value2) { + if (this._offsetX != value2) { + this._offsetX = value2; + this._hasChanged = true; + } } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._origin = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._scale = (0, _glMatrix.vec3).create(); - this._transform = (0, _glMatrix.mat4).create(); - this._imageData = options.imageData; - this._minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - this._minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - this._minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - this._maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - this._maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - this._maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - this._position = options.position ? (0, _glMatrix.vec3).clone(options.position) : (0, _glMatrix.vec3).create(); - this._rotation = options.rotation ? (0, _glMatrix.quat).clone(options.rotation) : (0, _glMatrix.quat).create(); - this._texCoord0 = options.texCoord0 ? (0, _glMatrix.vec2).clone(options.texCoord0) : (0, _glMatrix.vec2).fromValues(0, 0); - this._texCoord1 = options.texCoord1 ? (0, _glMatrix.vec2).clone(options.texCoord1) : (0, _glMatrix.vec2).fromValues(1, 1); - this._material = options.material === undefined ? -1 : options.material; + get offsetY() { + return this._offsetY; + } + set offsetY(value2) { + if (this._offsetY != value2) { + this._offsetY = value2; this._hasChanged = true; + } } -} -class ImageQuad extends ImageBase { - get width() { - return this._width; + get offsetZ() { + return this._offsetZ; } - set width(value) { - if (this._width != value) { - this._width = value; - this._hasChanged = true; - } + set offsetZ(value2) { + if (this._offsetZ != value2) { + this._offsetZ = value2; + this._hasChanged = true; + } } - get height() { - return this._height; + get maxGlyphTop() { + return this._maxGlyphTop; } - set height(value) { - if (this._height != value) { - this._height = value; - this._hasChanged = true; - } + set maxGlyphTop(value2) { + if (this._maxGlyphTop != value2) { + this._maxGlyphTop = value2; + this._hasChanged = true; + } } - constructor(core, options){ - super(core, options); - this._width = options.width === undefined ? 1 : options.width; - this._height = options.height === undefined ? 1 : options.height; - this._texTransform = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).translate(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(0, 1, 0)); - (0, _glMatrix.mat4).scale(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(1, -1, 1)); + get maxGlyphHeight() { + return this._maxGlyphHeight; } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * 4); - this._indices = (0, _quadJs.Quad).INDICES; - this._indexCount = this._indices.length; - this._isInitialized = true; + set maxGlyphHeight(value2) { + if (this._maxGlyphHeight != value2) { + this._maxGlyphHeight = value2; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(this._translation, this._position, this._origin); - (0, _glMatrix.vec3).scale(this._translation, this._translation, boundsScaling); - (0, _glMatrix.vec3).set(this._scale, this._width, this._height, 1); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); - this._verticesView = (0, _quadJs.Quad).normalTextured(this._transform, this._texTransform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} -class ImageSphere extends ImageBase { - get radius() { - return this._radius; - } - set radius(value) { - if (this._radius != value) { - this._radius = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._radius = options.radius === undefined ? 0.5 : options.radius; - this._slices = options.slices === undefined ? 72 : options.slices; - this._stacks = options.stacks === undefined ? 36 : options.stacks; + constructor(core, options2) { + this._core = core; + this._offset = create$6(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mMatrix = create$7(); + this._indexCount = 0; + this._maxGlyphs = options2.maxGlyphs; + this._textMetric = { width: 0, maxHeight: 0, maxTop: 0 }; + this.scale = options2.scale ? options2.scale : 1; + this.offsetX = options2.offsetX ? options2.offsetX : 0; + this.offsetY = options2.offsetY ? options2.offsetY : 0; + this.offsetZ = options2.offsetZ ? options2.offsetZ : 0; + this.reverseX = options2.reverseX; + this.reverseY = options2.reverseY; + this.reverseZ = options2.reverseZ; + this.rotation = options2.rotation; + this.maxGlyphTop = options2.maxGlyphTop; + this.horizontalAlignment = options2.horizontalAlignment === void 0 ? HorizontalAlignment.center : options2.horizontalAlignment; + this.verticalAlignment = options2.verticalAlignment === void 0 ? VerticalAlignment.center : options2.verticalAlignment; + this._material = options2.material; + this.borderWidth = core.config.textBorderWidth; + this.gamma = 0; + this._materialType = options2.materialType || 0; + this._materialColor = options2.materialColor || core.config.textColor; + this._materialFuzz = options2.materialFuzz || 0; + this._materialGloss = options2.materialGloss || 0; + this._segmentColor = options2.segmentColor; } initialize() { - this._sphere = new (0, _sphereJs.Sphere)(this._core); - this._vertices = this._sphere.normalTextured(this._slices, this._stacks, (0, _constantsJs.Constants).MAT4_IDENTITY).buffer; - this._indices = this._sphere.indices(this._slices, this._stacks); - this._indexCount = this._indices.length; - this._isInitialized = true; + this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); + this._verticesView = new DataView(this._vertices); + this._indices = new Uint32Array(this._maxGlyphs * 6); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).set(this._scale, this._radius, this._radius, this._radius); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._transform, this._rotation, this._position, this._scale, this._origin); - this._verticesView = this._sphere.normalTextured(this._slices, this._stacks, this._transform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"5x28d","../vertex.js":"4J2YE","../meshes/quad.js":"3PqJr","../meshes/sphere.js":"aj6T2","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aj6T2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sphere", ()=>Sphere); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _vertexJs = require("../vertex.js"); -class Sphere { - constructor(core){} - positions(slices, stacks, transform) { - const vertices = new Float32Array((slices + 1) * (stacks + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++){ - const latitude = 90 - 180 * stack / stacks; - for(let slice = 0; slice <= slices; slice++){ - const longitude = 360 * slice / slices - 180; - (0, _angleJs.AngleHelper).sphericalToCartesian(1, longitude, latitude, position); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - } - return vertices; - } - indices(slices, stacks) { - const indices = new Uint16Array(slices * stacks * 6); - let index = 0; - for(let stack = 0; stack < stacks; stack++){ - const top = stack * (slices + 1); - const bottom = (stack + 1) * (slices + 1); - for(let slice = 0; slice < slices; slice++){ - if (stack != 0) { - indices[index++] = top + slice; - indices[index++] = bottom + slice; - indices[index++] = top + slice + 1; - } - if (stack != stacks - 1) { - indices[index++] = top + slice + 1; - indices[index++] = bottom + slice; - indices[index++] = bottom + slice + 1; - } - } - } - return indices; - } - textured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - normalTextured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal = (0, _glMatrix.vec3).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - (0, _glMatrix.vec3).set(normal, position[0] - transform[12], position[1] - transform[13], position[2] - transform[14]); - (0, _glMatrix.vec3).normalize(normal, normal); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal); - } - return verticesView; - } - _texCoords(slices, stacks, transform) { - const texCoords = new Float32Array((slices + 1) * (stacks + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++)for(let slice = 0; slice <= slices; slice++){ - (0, _glMatrix.vec2).set(texCoord, slice / slices, stack / stacks); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/angle.js":"53hwW","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmBQh":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyVisual", ()=>KeyVisual); -parcelHelpers.export(exports, "KeyBase", ()=>KeyBase); -parcelHelpers.export(exports, "NominalKey", ()=>NominalKey); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _scatterJs = require("../layouts/scatter.js"); -var _mathJs = require("../helpers/math.js"); -var _labelsJs = require("./labels.js"); -class KeyVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(key){ - this.key = key; - } -} -class KeyBase { - get isInitialized() { - return this._isInitialized; - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value) { - if (value != this.minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } - } - get maxBoundsX() { - return this._maxBoundsX; - } - set maxBoundsX(value) { - if (value != this.minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } - } - get minBoundsY() { - return this._minBoundsY; - } - set minBoundsY(value) { - if (value != this.minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } - } - get maxBoundsY() { - return this._maxBoundsY; - } - set maxBoundsY(value) { - if (value != this.minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value) { - if (value != this.minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } - } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value) { - if (value != this.minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - get unitType() { - return this._unitType; - } - set unitType(value) { - if (this._unitType != value) { - this._unitType = value; - this._hasChanged = true; - } - } - get palette() { - return this._palette; - } - set palette(value) { - if (this._palette != value) { - this._palette = value; - this._hasChanged = true; - } } + }; + class LabelSet extends LabelBase$1 { get materials() { - return this._materials; - } - set materials(value) { - if (this._materials != value) { - this._materials = value; - this._hasChanged = true; - } - } - get sizesX() { - return this._sizesX; + return this._materials; } - set sizesX(value) { - if (this._sizesX != value) { - this._sizesX = value; - this._hasChanged = true; - } - } - get sizesY() { - return this._sizesY; - } - set sizesY(value) { - if (this._sizesY != value) { - this._sizesY = value; - this._hasChanged = true; - } - } - get sizesZ() { - return this._sizesZ; - } - set sizesZ(value) { - if (this._sizesZ != value) { - this._sizesZ = value; - this._hasChanged = true; - } - } - get spacing() { - return this._spacing; + get materialTypes() { + return this._materialTypes; } - set spacing(value) { - if (this._spacing != value) { - this._spacing = value; - this._hasChanged = true; - } - } - get textVertices() { - return this._textVertices; - } - get textIndices() { - return this._textIndices; - } - get labelMMatrix() { - return this._labelMMatrix; + get materialColors() { + return this._materialColors; } - set labelPositions(value) { - if (this._labelPositions != value) { - this._labelPositions = value; - this._hasChanged = true; - } + get materialFuzzes() { + return this._materialFuzzes; } - set labels(value) { - if (this._labels != value) { - this._labels = value; - this._hasChanged = true; - } + get materialGlosses() { + return this._materialGlosses; } - set labelSize(value) { - if (this._labelSize != value) { - this._labelSize = value; - this._hasChanged = true; - } + get segmentColors() { + return this._segmentColors; } - get labelOrientation() { - return this._orientation; + get minBoundsX() { + return this._minBoundsX; } - set labelOrientation(value) { - if (this._orientation != value) { - this._orientation = value; - this._hasChanged = true; - } + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - get titleIndexCount() { - return this._titleIndexCount; + get minBoundsY() { + return this._minBoundsY; } - get titleIndexOffset() { - return this._titleIndexOffset; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - get titleMMatrix() { - return this._titleMMatrix; + get minBoundsZ() { + return this._minBoundsZ; } - set title(value) { - if (this._title != value) { - this._title = value; - this._hasChanged = true; - } + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - set titleSize(value) { - if (this._titleSize != value) { - this._titleSize = value; - this._hasChanged = true; - } + get maxBoundsX() { + return this._maxBoundsX; } - constructor(core, options){ - this._core = core; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - initialize() { - this._isInitialized = true; + get maxBoundsY() { + return this._maxBoundsY; } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._size[0], this._size[1]), this._size[2]); - (0, _glMatrix.vec3).scale(this._size, this._size, 1 / maxBounds); - this._update(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `key updated ${Math.round(window.performance.now() - start)}ms`); - } - } + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - _update(size) {} -} -class NominalKey extends KeyBase { - constructor(core, options){ - super(core, options); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 0 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 0 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 0 : options.maxBoundsZ; - const positionX = options.positionX === undefined ? 0 : options.positionX; - const positionY = options.positionY === undefined ? 0 : options.positionY; - const positionZ = options.positionZ === undefined ? 0 : options.positionZ; - const sizeX = options.sizeX === undefined ? 1 : options.sizeX; - const sizeY = options.sizeY === undefined ? 1 : options.sizeY; - const sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - const spacing = options.spacing === undefined ? 1 : options.spacing; - const labelScale = options.labelScale === undefined ? 1 : options.labelScale; - const labelMaxGlyphs = options.labelMaxGlyphs === undefined ? this._core.config.keyLabelMaxGlyphs : options.labelMaxGlyphs; - const titleScale = options.titleScale === undefined ? 1 : options.titleScale; - const titleMaxGlyphs = options.titleMaxGlyphs === undefined ? this._core.config.keyTitleMaxGlyphs : options.titleMaxGlyphs; - const font = options.font ? options.font : this._core.font; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const orientation = options.orientation === undefined ? (0, _mainJs.Orientation).horizontal : options.orientation; - const labelPosition = options.labelPosition === undefined ? (0, _mainJs.Edge2D).right : options.labelPosition; - const labelOrientation = options.labelOrientation === undefined ? (0, _mainJs.Orientation).horizontal : options.labelOrientation; - const rotation = (0, _glMatrix.quat).create(); - let count = options.values.length; - const ids = new Uint32Array(count); - let minValue = Number.MAX_VALUE; - let maxValue = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - ids[i] = i; - const value = options.values[i]; - minValue = Math.min(minValue, value); - maxValue = Math.max(maxValue, value); - } - const materialIds = new Uint32Array(count); - for(let i = 0; i < count; i++)materialIds[i] = (0, _mathJs.MathHelper).normalize(options.values[i], minValue, maxValue, 0, options.palette.length / 4 - 1); - let glyphCount = 0; - let totalLabelWidth = 0; - let maxLabelWidth = 0; - for(let i = 0; i < count; i++){ - const label = (0, _textJs.TextHelper).truncate(options.labels[i], labelMaxGlyphs); - glyphCount += label.length; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width; - totalLabelWidth += width; - maxLabelWidth = Math.max(width, maxLabelWidth); - } - let titleWidth = 0; - let title; - if (options.title) { - title = (0, _textJs.TextHelper).truncate(options.title, titleMaxGlyphs); - glyphCount += title.length; - (0, _textJs.TextHelper).measure(font, title, this._textMetric); - titleWidth = this._textMetric.width; - } - let width; - let height; - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - case (0, _mainJs.Orientation).vertical: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - } - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - width = Math.max(sizeX * count + spacing * (count - 1) + totalLabelWidth, titleWidth); - height = sizeY; - if (options.title) height += titleScale; - break; - case (0, _mainJs.Orientation).vertical: - width = Math.max(sizeX + labelScale / 2 + maxLabelWidth, titleWidth); - height = sizeY * count + spacing * (count - 1); - if (options.title) height += titleScale; - break; - } - let originX = positionX; - let originY = positionY; - let originZ = positionZ; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).center: - break; - case (0, _mainJs.HorizontalAlignment).left: - originX += width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - originX -= width / 2; - break; - } - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).bottom: - originY += height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - break; - case (0, _mainJs.VerticalAlignment).top: - originY -= height / 2; - break; - } - const positionsX = new Float64Array(count); - const positionsY = new Float64Array(count); - const positionsZ = new Float64Array(count); - for(let i = 0; i < count; i++){ - positionsX[i] = originX - width / 2 + sizeX / 2; - positionsY[i] = originY + height / 2 - i * (sizeY + spacing); - positionsZ[i] = originZ + sizeZ / 2; - } - const scatter = new (0, _scatterJs.Scatter)(this._core); - const scatterLayoutOptions = { - positionsX: positionsX, - positionsY: positionsY, - positionsZ: positionsZ - }; - scatter.layout(this._transitionBuffer.currentBuffer, ids, scatterLayoutOptions); - const scatterVertexOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - colors: options.values, - minColor: minValue, - maxColor: maxValue, - sizeScalingX: sizeX, - sizeScalingY: sizeY, - sizeScalingZ: sizeZ, - materials: materialIds - }; - scatter.update(this._transitionBuffer.currentBuffer, ids, scatterVertexOptions); - const labelSetOptions = { - text: options.labels, - maxGlyphs: glyphCount, - scale: labelScale, - font: font - }; - const labelSet = new (0, _labelsJs.LabelSet)(this._core, labelSetOptions); - if (options.title) count++; - const labelPositionsX = new Float64Array(count); - const labelPositionsY = new Float64Array(count); - const labelPositionsZ = new Float64Array(count); - for(let i = 0; i < (options.title ? count - 1 : count); i++){ - labelPositionsX[i] = originX - width / 2 + sizeX + labelScale / 2; - labelPositionsY[i] = positionsY[i]; - labelPositionsZ[i] = originZ; - } - options.title; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - labelSet.positionsX = positionsX; - labelSet.positionsY = positionsY; - labelSet.positionsZ = positionsZ; - labelSet.rotation = new Float64Array([ - rotation[0], - rotation[1], - rotation[2], - rotation[3] - ]); - labelSet.horizontalAlignment = (0, _mainJs.HorizontalAlignment).left; - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../helpers/text.js":"fG2oi","../layouts/scatter.js":"bwpY2","../helpers/math.js":"f65d0","./labels.js":"PwNrz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bwpY2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scatter", ()=>Scatter); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Scatter extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[id] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const sizesX = options.sizes ? options.sizes : options.sizesX; - const sizesY = options.sizes ? options.sizes : options.sizesY; - const sizesZ = options.sizes ? options.sizes : options.sizesZ; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - if (options.rotation) { - _quat[0] = options.rotation[0]; - _quat[1] = options.rotation[1]; - _quat[2] = options.rotation[2]; - _quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id]) : 1) * sizeScalingX, minSize) * this._boundsScaling; - _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id]) : 1) * sizeScalingY, minSize) * this._boundsScaling; - _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - if (options.rotations) { - _quat[0] = options.rotations[id * 4]; - _quat[1] = options.rotations[id * 4 + 1]; - _quat[2] = options.rotations[id * 4 + 2]; - _quat[3] = options.rotations[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - } else (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setParameter1(dataView, index, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id] : 0); - (0, _vertexJs.UnitVertex).setParameter2(dataView, index, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id] : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kYBiT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LayoutBase", ()=>LayoutBase); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _boundsJs = require("../helpers/bounds.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class LayoutBase { - get facetScaling() { - return this._facetScaling; + get maxBoundsZ() { + return this._maxBoundsZ; } - offsetX(facetCoordX) { - return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - offsetY(facetCoordY) { - return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; + get positionsX() { + return this._positionsX; } - offsetZ(facetCoordZ) { - return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; - } - constructor(core){ - this._core = core; - this.modelOriginX = 0; - this.modelOriginY = 0; - this.modelOriginZ = 0; - this.minModelBoundsX = 0; - this.minModelBoundsY = 0; - this.minModelBoundsZ = 0; - this.maxModelBoundsX = 0; - this.maxModelBoundsY = 0; - this.maxModelBoundsZ = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._facetSpacingX = 0; - this._facetSpacingY = 0; - this._facetSpacingZ = 0; - this._facetSizeX = 0; - this._facetSizeY = 0; - this._facetSizeZ = 0; - this._facetsX = 1; - this._facetsY = 1; - this._facetsZ = 1; - } - _updateModelBounds(options) { - this.minModelBoundsX = options.minBoundsX === undefined ? this.minLayoutBoundsX : options.minBoundsX; - this.minModelBoundsY = options.minBoundsY === undefined ? this.minLayoutBoundsY : options.minBoundsY; - this.minModelBoundsZ = options.minBoundsZ === undefined ? this.minLayoutBoundsZ : options.minBoundsZ; - this.maxModelBoundsX = options.maxBoundsX === undefined ? this.maxLayoutBoundsX : options.maxBoundsX; - this.maxModelBoundsY = options.maxBoundsY === undefined ? this.maxLayoutBoundsY : options.maxBoundsY; - this.maxModelBoundsZ = options.maxBoundsZ === undefined ? this.maxLayoutBoundsZ : options.maxBoundsZ; - this._isFacetted = options.facetsX !== undefined && options.facetsX > 1 && options.facetCoordsX != null || options.facetsY !== undefined && options.facetsY > 1 && options.facetCoordsY != null || options.facetsZ !== undefined && options.facetsZ > 1 && options.facetCoordsZ != null; - this._facetSpacingX = options.facetSpacingX === undefined ? 0 : options.facetSpacingX; - this._facetSpacingY = options.facetSpacingY === undefined ? 0 : options.facetSpacingY; - this._facetSpacingZ = options.facetSpacingZ === undefined ? 0 : options.facetSpacingZ; - let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._facetSizeX = modelSizeX; - this._facetSizeY = modelSizeY; - this._facetSizeZ = modelSizeZ; - this._facetsX = options.facetCoordsX ? options.facetsX : 1; - this._facetsY = options.facetCoordsY ? options.facetsY : 1; - this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; - this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; - this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; - this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; - this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); - this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); - this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); - this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; - this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; - this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; - modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; - this._facetScaling = maxBounds / this._maxBounds; + set positionsX(value2) { + if (this._positionsX != value2) { + this._positionsX = value2; + this._hasChanged = true; + } } - resetCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = undefined; - this.minCumulativeLayoutBoundsY = undefined; - this.minCumulativeLayoutBoundsZ = undefined; - this.maxCumulativeLayoutBoundsX = undefined; - this.maxCumulativeLayoutBoundsY = undefined; - this.maxCumulativeLayoutBoundsZ = undefined; + get positionsY() { + return this._positionsY; } - _updateCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === undefined ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); - this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === undefined ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); - this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === undefined ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); - this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === undefined ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); - this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === undefined ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); - this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === undefined ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); + set positionsY(value2) { + if (this._positionsY != value2) { + this._positionsY = value2; + this._hasChanged = true; + } } - unitToModelSize(unitSize) { - return unitSize / this._boundsScaling; + get positionsZ() { + return this._positionsZ; } - unitToModelPositionX(unitPositionX) { - return this.unitToModelSize(unitPositionX) + this.modelOriginX; + set positionsZ(value2) { + if (this._positionsZ != value2) { + this._positionsZ = value2; + this._hasChanged = true; + } } - unitToModelPositionY(unitPositionY) { - return this.unitToModelSize(unitPositionY) + this.modelOriginY; + get positionScalingX() { + return this._positionScalingX; } - unitToModelPositionZ(unitPositionZ) { - return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; + set positionScalingX(value2) { + if (this._positionScalingX != value2) { + this._positionScalingX = value2; + this._hasChanged = true; + } } - unitToModelPosition(unitPosition, modelPosition) { - modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); - modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); - modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); + get positionScalingY() { + return this._positionScalingY; } - modelToUnitSize(modelSize) { - return modelSize * this._boundsScaling; + set positionScalingY(value2) { + if (this._positionScalingY != value2) { + this._positionScalingY = value2; + this._hasChanged = true; + } } - modelToUnitPositionX(modelPositionX) { - return (modelPositionX - this.modelOriginX) * this._boundsScaling; + get positionScalingZ() { + return this._positionScalingZ; } - modelToUnitPositionY(modelPositionY) { - return (modelPositionY - this.modelOriginY) * this._boundsScaling; + set positionScalingZ(value2) { + if (this._positionScalingZ != value2) { + this._positionScalingZ = value2; + this._hasChanged = true; + } } - modelToUnitPositionZ(modelPositionZ) { - return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + get rotations() { + return this._rotations; } - modelToUnitPosition(modelPosition, unitPosition) { - unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); - unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); - unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); - } - inclusiveUnitBounds(buffer, ids, unitType, offset, count, minBounds, maxBounds) { - (0, _glMatrix.vec3).set(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const unitScale = (0, _glMatrix.vec3).create(); - const unitRotation = (0, _glMatrix.quat).create(); - const unitTranslation = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - const dataView = buffer.dataView; - let minBounds0; - let maxBounds0; - let minBounds1; - let maxBounds1; - switch(unitType){ - case (0, _mainJs.UnitType).sphere: - case (0, _mainJs.UnitType).sphereSdf: - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const radius = unitScale[0] / 2; - minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius); - minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius); - minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius); - maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius); - maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius); - maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius); - } - break; - case (0, _mainJs.UnitType).hexPrism: - case (0, _mainJs.UnitType).hexPrismSdf: - case (0, _mainJs.UnitType).block: - case (0, _mainJs.UnitType).blockSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - minBounds1 = (0, _glMatrix.vec3).create(); - maxBounds1 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; - minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; - minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; - maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; - maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; - maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; - (0, _boundsJs.BoundsHelper).rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds1); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds1); - } - break; - case (0, _mainJs.UnitType).cylinder: - case (0, _mainJs.UnitType).cylinderSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - const pa = (0, _glMatrix.vec3).create(); - const pb = (0, _glMatrix.vec3).create(); - const identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - let ca; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const length = unitScale[1]; - const radius = Math.max(unitScale[0], unitScale[2]); - if (length != 0 && radius != 0) { - if ((0, _glMatrix.quat).equals(unitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY)) ca = identityRotation; - else { - ca = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca, identityRotation, unitRotation); - } - (0, _glMatrix.vec3).scaleAndAdd(pa, unitTranslation, ca, -length * 0.5); - (0, _glMatrix.vec3).scaleAndAdd(pb, unitTranslation, ca, length * 0.5); - (0, _boundsJs.BoundsHelper).cylinder(pa, pb, radius, minBounds0, maxBounds0); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds0); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds0); - } - } - break; - } + set rotations(value2) { + if (this._rotations != value2) { + this._rotations = value2; + this._hasChanged = true; + } } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/bounds.js":"beD2A","../main.js":"f421K","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"beD2A":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BoundsHelper", ()=>BoundsHelper); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -class BoundsHelper { - static rotateBounds(minBounds, maxBounds, rotation, rotatedMinBounds, rotatedMaxBounds, offset) { - const sizeX = maxBounds[0] - minBounds[0]; - const sizeY = maxBounds[1] - minBounds[1]; - const sizeZ = maxBounds[2] - minBounds[2]; - const min = rotatedMinBounds; - const max = rotatedMaxBounds; - (0, _glMatrix.vec3).set(min, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(max, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const vertices = (0, _cubeJs.Cube).POSITIONS; - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).add(position, position, offset); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).subtract(position, position, offset); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).add(position, minBounds, maxBounds); - (0, _glMatrix.vec3).scale(position, position, 0.5); - (0, _glMatrix.vec3).add(min, min, position); - (0, _glMatrix.vec3).add(max, max, position); - } - static cylinder(pa, pb, radius, minBounds, maxBounds) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - minBounds[0] = Math.min(pa[0] - ex, pb[0] - ex); - minBounds[1] = Math.min(pa[1] - ey, pb[1] - ey); - minBounds[2] = Math.min(pa[2] - ez, pb[2] - ez); - maxBounds[0] = Math.max(pa[0] + ex, pb[0] + ex); - maxBounds[1] = Math.max(pa[1] + ey, pb[1] + ey); - maxBounds[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"5x28d","../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eiGCN":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesBase", ()=>(0, _axesJs.AxesBase)); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>(0, _cartesian2DJs.Cartesian2dAxes)); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>(0, _cartesian2DJs.Cartesian2dAxesHelper)); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>(0, _cartesian3DJs.Cartesian3dAxes)); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>(0, _cartesian3DJs.Cartesian3dAxesHelper)); -var _axesJs = require("./axes.js"); -var _cartesian2DJs = require("./cartesian2d.js"); -var _cartesian3DJs = require("./cartesian3d.js"); - -},{"./axes.js":"8Tmim","./cartesian2d.js":"d0jS2","./cartesian3d.js":"jfjef","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9v1at":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>(0, _angleJs.AngleHelper)); -parcelHelpers.export(exports, "AnimationHelper", ()=>(0, _animationJs.AnimationHelper)); -parcelHelpers.export(exports, "ArrayHelper", ()=>(0, _arrayJs.ArrayHelper)); -parcelHelpers.export(exports, "AxisHelper", ()=>(0, _axesJs.AxisHelper)); -parcelHelpers.export(exports, "Base64Helper", ()=>(0, _base64Js.Base64Helper)); -parcelHelpers.export(exports, "BinHelper", ()=>(0, _binJs.BinHelper)); -parcelHelpers.export(exports, "ColorHelper", ()=>(0, _colorJs.ColorHelper)); -parcelHelpers.export(exports, "CsvHelper", ()=>(0, _csvJs.CsvHelper)); -parcelHelpers.export(exports, "FacetHelper", ()=>(0, _facetJs.FacetHelper)); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>(0, _forcedirectJs.ForceDirectHelper)); -parcelHelpers.export(exports, "HexHelper", ()=>(0, _hexJs.HexHelper)); -parcelHelpers.export(exports, "HexBinHelper", ()=>(0, _hexbinJs.HexBinHelper)); -parcelHelpers.export(exports, "LineHelper", ()=>(0, _lineJs.LineHelper)); -parcelHelpers.export(exports, "MathHelper", ()=>(0, _mathJs.MathHelper)); -parcelHelpers.export(exports, "PseudoRandom", ()=>(0, _mathJs.PseudoRandom)); -parcelHelpers.export(exports, "MatrixHelper", ()=>(0, _matrixJs.MatrixHelper)); -parcelHelpers.export(exports, "MercatorHelper", ()=>(0, _mapJs.MercatorHelper)); -parcelHelpers.export(exports, "AlbersHelper", ()=>(0, _mapJs.AlbersHelper)); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>(0, _mapJs.GeoJSONHelper)); -parcelHelpers.export(exports, "OctTreeHelper", ()=>(0, _octtreeJs.OctTreeHelper)); -parcelHelpers.export(exports, "PaletteHelper", ()=>(0, _paletteJs.PaletteHelper)); -parcelHelpers.export(exports, "PathHelper", ()=>(0, _pathJs.PathHelper)); -parcelHelpers.export(exports, "PickHelper", ()=>(0, _pickJs.PickHelper)); -parcelHelpers.export(exports, "TableHelper", ()=>(0, _tableJs.TableHelper)); -parcelHelpers.export(exports, "TextHelper", ()=>(0, _textJs.TextHelper)); -parcelHelpers.export(exports, "TextureHelper", ()=>(0, _textureJs.TextureHelper)); -parcelHelpers.export(exports, "TreeHelper", ()=>(0, _treeJs.TreeHelper)); -parcelHelpers.export(exports, "SetHelper", ()=>(0, _setJs.SetHelper)); -parcelHelpers.export(exports, "SdfHelper", ()=>(0, _sdfJs.SdfHelper)); -parcelHelpers.export(exports, "VectorHelper", ()=>(0, _vectorJs.VectorHelper)); -var _angleJs = require("./angle.js"); -var _animationJs = require("./animation.js"); -var _arrayJs = require("./array.js"); -var _axesJs = require("./axes.js"); -var _base64Js = require("./base64.js"); -var _binJs = require("./bin.js"); -var _colorJs = require("./color.js"); -var _csvJs = require("./csv.js"); -var _facetJs = require("./facet.js"); -var _forcedirectJs = require("./forcedirect.js"); -var _hexJs = require("./hex.js"); -var _hexbinJs = require("./hexbin.js"); -var _lineJs = require("./line.js"); -var _mathJs = require("./math.js"); -var _matrixJs = require("./matrix.js"); -var _mapJs = require("./map.js"); -var _octtreeJs = require("./octtree.js"); -var _paletteJs = require("./palette.js"); -var _pathJs = require("./path.js"); -var _pickJs = require("./pick.js"); -var _tableJs = require("./table.js"); -var _textJs = require("./text.js"); -var _textureJs = require("./texture.js"); -var _treeJs = require("./tree.js"); -var _setJs = require("./set.js"); -var _sdfJs = require("./sdf.js"); -var _vectorJs = require("./vector.js"); - -},{"./angle.js":"53hwW","./animation.js":"02nn8","./array.js":"9Rnft","./axes.js":"99ajO","./base64.js":"e5eoY","./bin.js":"5rVTq","./color.js":"4LgMf","./csv.js":"g6LJR","./facet.js":"iYn0I","./forcedirect.js":"gazw2","./hex.js":"ahk7A","./hexbin.js":"bm0M4","./line.js":"iEeyT","./math.js":"f65d0","./matrix.js":"7gWc5","./map.js":"27ECm","./octtree.js":"lv4D9","./palette.js":"7fuDW","./path.js":"dvdia","./pick.js":"1t2sb","./table.js":"cn0Qv","./text.js":"fG2oi","./texture.js":"bUoBU","./tree.js":"4ts5g","./set.js":"7s3Z5","./sdf.js":"2PdqK","./vector.js":"2r8XP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Rnft":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ArrayHelper", ()=>ArrayHelper); -class ArrayHelper { - static minIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) { - index = ~index; - index = Math.max(0, index); - } else while(index > 0 && orderedValues[index - 1] == value)index--; - return index; - } - static maxIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) index = ~index - 1; - else { - while(index < length - 1 && orderedValues[index + 1] == value)index++; - index = Math.min(length, index); - } - return index; - } - static binarySearch(array, index, length, value) { - let low = index; - let high = index + length - 1; - while(low <= high){ - const mid = low + (high - low >> 1); - if (array[mid] == value) return mid; - if (array[mid] <= value) low = mid + 1; - else high = mid - 1; - } - return ~low; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e5eoY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Base64Helper", ()=>Base64Helper); -class Base64Helper { - uint6ToB64(nUint6) { - return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65; - } - base64EncArr(aBytes) { - let nMod3 = 2; - let sB64Enc = ""; - let nLen = aBytes.byteLength; - let nUint24 = 0; - for(let nIdx = 0; nIdx < nLen; nIdx++){ - nMod3 = nIdx % 3; - if (nIdx > 0 && nIdx * 4 / 3 % 76 === 0) sB64Enc += "\r\n"; - nUint24 |= aBytes.getUint8(nIdx) << (16 >>> nMod3 & 24); - if (nMod3 === 2 || aBytes.byteLength - nIdx === 1) { - sB64Enc += String.fromCharCode(this.uint6ToB64(nUint24 >>> 18 & 63), this.uint6ToB64(nUint24 >>> 12 & 63), this.uint6ToB64(nUint24 >>> 6 & 63), this.uint6ToB64(nUint24 & 63)); - nUint24 = 0; - } - } - return sB64Enc.substring(0, sB64Enc.length - 2 + nMod3) + (nMod3 === 2 ? "" : nMod3 === 1 ? "=" : "=="); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5rVTq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BinHelper", ()=>BinHelper); -class BinHelper { - static quantile(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const itemsPerBin = count / options.bins; - let bin = 0; - if (options.froms && options.tos) { - const firstId = options.ids[offset]; - options.froms[0] = options.values[firstId]; - } - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - if (i > Math.floor(itemsPerBin * (bin + 1))) { - bin++; - if (options.froms && options.tos) { - options.tos[bin - 1] = options.values[id]; - const nextId = options.ids[i + offset + 1]; - options.froms[bin] = options.values[nextId]; - } - } - options.binIds[id] = bin; - } - if (options.froms && options.tos) { - const lastId = options.ids[count - 1 + offset]; - options.tos[options.bins - 1] = options.values[lastId]; - } - return Math.floor(itemsPerBin); - } - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const counts = options.counts ? options.counts : new Float64Array(options.bins); - let minValue = options.minValue; - let maxValue = options.maxValue; - if (options.isDiscrete || maxValue == minValue) { - minValue -= 0.5; - maxValue += 0.5; - } - const binSize = (maxValue - minValue) / options.bins; - let maxCount = 0; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - const value = options.values[id]; - const binId = Math.max(Math.min(Math.floor((value - minValue) / binSize), options.bins - 1), 0); - options.binIds[id] = binId; - counts[binId]++; - maxCount = Math.max(counts[binId], maxCount); - } - if (options.froms && options.tos) { - for(let i = 0; i < options.bins; i++)if (options.isDiscrete || maxValue == minValue) { - options.froms[i] = Math.ceil(minValue + binSize * i); - options.tos[i] = Math.floor(minValue + binSize * (i + 1)); - } else { - options.froms[i] = minValue + binSize * i; - options.tos[i] = minValue + binSize * (i + 1); - } - } - return maxCount; - } - static maxBins(minValue, maxValue, isDiscrete, maxBins) { - if (isDiscrete) return Math.min(maxValue - minValue + 1, maxBins); - else return maxBins; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4LgMf":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorHelper", ()=>ColorHelper); -var _glMatrix = require("gl-matrix"); -class ColorHelper { - static luminance(rgb) { - return rgb[0] * ColorHelper.LUMINANCE[0] + rgb[1] * ColorHelper.LUMINANCE[1] + rgb[2] * ColorHelper.LUMINANCE[2]; - } - static rgbToHex(r, g, b) { - const r2 = `0${Math.round(r * 255).toString(16)}`; - const g2 = `0${Math.round(g * 255).toString(16)}`; - const b2 = `0${Math.round(b * 255).toString(16)}`; - return `#${r2.substr(r2.length - 2, 2)}${g2.substr(g2.length - 2, 2)}${b2.substr(b2.length - 2, 2)}`; - } - static rgbToHsv(r, g, b, hsv) { - let h, s, v, delta; - const min = Math.min(Math.min(r, g), b); - const max = Math.max(Math.max(r, g), b); - delta = max - min; - v = max; - if (delta == 0) { - h = -1; - if (max == 0) s = -1; - else s = 0; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - s = delta / max; - if (r == max) h = (g - b) / delta; - else if (g == max) h = 2 + (b - r) / delta; - else h = 4 + (r - g) / delta; - h *= 60; - if (h < 0) h += 360; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - static hsvToRgb(h, s, v, rgb) { - let sextant, r, g, b; - if (s == 0) { - r = g = b = v; - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } - let frac, p, q, t; - h %= 360; - h /= 60; - sextant = Math.floor(h); - frac = h - sextant; - p = v * (1 - s); - q = v * (1 - s * frac); - t = v * (1 - s * (1 - frac)); - switch(sextant){ - case 0: - r = v; - g = t; - b = p; - break; - case 1: - r = q; - g = v; - b = p; - break; - case 2: - r = p; - g = v; - b = t; - break; - case 3: - r = p; - g = q; - b = v; - break; - case 4: - r = t; - g = p; - b = v; - break; - default: - r = v; - g = p; - b = q; - break; - } - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } -} -ColorHelper.LUMINANCE = (0, _glMatrix.vec3).fromValues(0.2126, 0.7152, 0.0722); - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g6LJR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CsvHelper", ()=>CsvHelper); -var _mainJs = require("../main.js"); -class CsvHelper { - constructor(core){ - this.QUOTE = '"'; - this.DELIMETER = ','; - this.LINE_BREAKS = [ - '\n', - '\r' - ]; - this._core = core; + get offsetsX() { + return this._offsetsX; } - readline(text, row) { - return this.read(text, row, 1)[0]; + set offsetsX(value2) { + if (this._offsetsX != value2) { + this._offsetsX = value2; + this._hasChanged = true; + } } - read(text, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const rows = []; - let rowBuffer = []; - let row = 0; - let columnBuffer = ""; - let quoted = false; - for(let i = 0; i < text.length; i++){ - const char = text.charAt(i); - if (char == this.QUOTE) { - if (text.charAt(i + 1) == this.QUOTE) { - i++; - columnBuffer += this.QUOTE; - } else quoted = !quoted; - } else if (quoted) columnBuffer += char; - else { - if (char == this.DELIMETER) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - } else if (this.LINE_BREAKS.indexOf(char) > -1) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - while(this.LINE_BREAKS.indexOf(text.charAt(i + 1)) > -1)i++; - if (row++ >= firstRow) rows.push(rowBuffer); - rowBuffer = []; - if (rows.length == maxRows) break; - } else columnBuffer += char; - } - } - if (columnBuffer != "") rowBuffer.push(columnBuffer); - if (rowBuffer.length > 0) rows.push(rowBuffer); - if (maxRows > 1) this._core.log.write((0, _mainJs.LogLevel).info, `csv ${rows.length} rows ${Math.round(window.performance.now() - start)}ms`); - return rows; - } - writeLine(data) { - let text = ""; - for(let i = 0; i < data.length; i++){ - let column = data[i]; - if (column) { - const quotes = column.indexOf(this.DELIMETER) > -1 || column.indexOf(this.QUOTE) > -1; - column = column.replace(/"/g, '""'); - if (quotes) column = `${this.QUOTE}${column}${this.QUOTE}`; - } - text += column; - if (i < data.length - 1) text += this.DELIMETER; - } - return text; - } - writeAsJavaScriptArray(headings, data) { - let text = "[["; - for (let column of headings)text += `"${column}",`; - text = text.slice(0, -1); - text += "]\n"; - let row; - for(let i = 0; i < data.length; i++){ - const line = data[i]; - row = "["; - for(let j = 0; j < line.length; j++){ - const column = line[j]; - row += `"${column.replace(/"/g, '\\"')}",`; - } - row = row.slice(0, -1); - row += "],\n"; - text += row; - } - text += "];"; - return text; - } -} - -},{"../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iYn0I":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FacetHelper", ()=>FacetHelper); -var _mainJs = require("../main.js"); -class FacetHelper { - constructor(core){ - this._core = core; - } - split1d(ids, facetsX, valuesX, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, undefined, undefined, valuesX, null, null, orderedIds, facetIds, offsets, counts); - } - split2d(ids, facetsX, facetsY, valuesX, valuesY, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, facetsY, undefined, valuesX, valuesY, null, orderedIds, facetIds, offsets, counts); - } - split3d(ids, facetsX, facetsY, facetsZ, valuesX, valuesY, valuesZ, orderedIds, facetIds, offsets, counts) { - if (valuesX && facetIds.length != valuesX.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesX"); - if (valuesY && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - if (valuesZ && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - const start = window.performance.now(); - if (facetsX === undefined) facetsX = 1; - if (facetsY === undefined) facetsY = 1; - if (facetsZ === undefined) facetsZ = 1; - const maxFacetId = facetsX * facetsY * facetsZ - 1; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const valueX = valuesX ? valuesX[id] : 0; - const valueY = valuesY ? valuesY[id] : 0; - const valueZ = valuesZ ? valuesZ[id] : 0; - const facetId = valueX + valueY * facetsX + valueZ * facetsX * facetsZ; - facetIds[id] = facetId; - if (facetId > maxFacetId) this._core.log.write((0, _mainJs.LogLevel).warn, "facet overflow"); - counts[facetId]++; - } - let offset = 0; - for(let i = 0; i < offsets.length; i++){ - const count = counts[i]; - offsets[i] = offset; - offset += count; - } - const tempOffsets = new Uint32Array(offsets); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const facetId = facetIds[id]; - offset = tempOffsets[facetId]++; - orderedIds[offset] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet split ${Math.round(window.performance.now() - start)}ms`); - } - wrap1d(ids, values, columns, coordsX, coordsY) { - const start = window.performance.now(); - let rows = 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const value = values[id]; - coordsX[id] = value % columns; - const row = Math.floor(value / columns); - coordsY[id] = row; - rows = Math.max(row, rows); - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet wrap ${Math.round(window.performance.now() - start)}ms`); - return rows + 1; + get offsetsY() { + return this._offsetsY; } -} - -},{"../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gazw2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>ForceDirectHelper); -var _octtreeJs = require("./octtree.js"); -class ForceDirectHelper { - set gravity(value) { - this._gravity = value; - } - get gravity() { - return this._gravity; - } - set attraction(value) { - this._attraction = value; - } - get attraction() { - return this._attraction; - } - set repulsion(value) { - this._repulsion = value; - } - get repulsion() { - return this._repulsion; - } - set interval(value) { - this._interval = value; - } - get interval() { - return this._interval; - } - set maxDistance(value) { - this._maxDistance = value; - } - get maxDistance() { - return this._maxDistance; - } - set iterationsPerLayout(value) { - this._iteractionsPerLayout = value; - } - get iterationsPerLayout() { - return this._iteractionsPerLayout; - } - set edgeWeightPower(value) { - this._edgeWeightPower = value; - } - get edgeWeightPower() { - return this._edgeWeightPower; - } - set theta(value) { - this._theta = value; - } - get theta() { - return this._theta; - } - get iterations() { - return this._totalIterations; - } - get totalRepulsion() { - return this._totalRepulsion; - } - get nodePositionsX() { - return this._nodePositionsX; - } - get nodePositionsY() { - return this._nodePositionsY; - } - get nodePositionsZ() { - return this._nodePositionsZ; - } - get lockX() { - return this._lockX; - } - set lockX(value) { - this._lockX = value; - } - get lockY() { - return this._lockY; - } - set lockY(value) { - this._lockY = value; - } - get lockZ() { - return this._lockZ; - } - set lockZ(value) { - this._lockZ = value; - } - constructor(options){ - this._forcesX = new Float64Array(options.nodeIds.length); - this._forcesY = new Float64Array(options.nodeIds.length); - this._forcesZ = new Float64Array(options.nodeIds.length); - this._totalIterations = 0; - this._totalRepulsion = 0; - this._repulsion = options.repulsion || 1; - this._attraction = options.attraction || 1; - this._gravity = options.gravity || 1; - this._interval = options.interval || 1; - this._maxDistance = options.maxDistance || 1; - this._iteractionsPerLayout = options.iterationsPerLayout || 1; - this._theta = options.theta || 1; - this._nodeIds = options.nodeIds; - this._nodePositionsX = options.nodePositionsX; - this._nodePositionsY = options.nodePositionsY; - this._nodePositionsZ = options.nodePositionsZ; - this._nodeWeights = options.nodeWeights || new Float64Array(this._nodeIds.length).fill(1); - this._edgeIds = options.edgeIds; - this._edgeFromIds = options.edgeFromIds; - this._edgeToIds = options.edgeToIds; - this._edgeWeights = options.edgeWeights || new Float64Array(this._edgeIds.length).fill(1); - this._edgeWeightPower = options.edgeWeightPower || 1; + set offsetsY(value2) { + if (this._offsetsY != value2) { + this._offsetsY = value2; + this._hasChanged = true; + } } - layout() { - this._minBoundsX = Number.MAX_VALUE; - this._minBoundsY = Number.MAX_VALUE; - this._minBoundsZ = Number.MAX_VALUE; - this._maxBoundsX = -Number.MAX_VALUE; - this._maxBoundsY = -Number.MAX_VALUE; - this._maxBoundsZ = -Number.MAX_VALUE; - for(let i = 0; i < this._nodeIds.length; i++){ - this._minBoundsX = Math.min(this._minBoundsX, this._nodePositionsX[i]); - this._minBoundsY = Math.min(this._minBoundsY, this._nodePositionsY[i]); - this._minBoundsZ = Math.min(this._minBoundsZ, this._nodePositionsZ[i]); - this._maxBoundsX = Math.max(this._maxBoundsX, this._nodePositionsX[i]); - this._maxBoundsY = Math.max(this._maxBoundsY, this._nodePositionsY[i]); - this._maxBoundsZ = Math.max(this._maxBoundsZ, this._nodePositionsZ[i]); - } - for(let iteration = 0; iteration < this._iteractionsPerLayout; iteration++){ - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forcesX[id] = 0; - this._forcesY[id] = 0; - this._forcesZ[id] = 0; - } - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - let dx = this._nodePositionsX[id]; - let dy = this._nodePositionsY[id]; - let dz = this._nodePositionsZ[id]; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -this._nodeWeights[id] * this._gravity; - this._forcesX[id] += magnitude * dx; - this._forcesY[id] += magnitude * dy; - this._forcesZ[id] += magnitude * dz; - } - } - for(let i = 0; i < this._edgeIds.length; i++){ - const id = this._edgeIds[i]; - const fromId = this._edgeFromIds[id]; - const toId = this._edgeToIds[id]; - const x1 = this._nodePositionsX[fromId]; - const y1 = this._nodePositionsY[fromId]; - const z1 = this._nodePositionsZ[fromId]; - const x2 = this._nodePositionsX[toId]; - const y2 = this._nodePositionsY[toId]; - const z2 = this._nodePositionsZ[toId]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -distance * this._attraction * Math.pow(this._edgeWeights[id], this._edgeWeightPower); - this._forcesX[fromId] += magnitude * dx; - this._forcesY[fromId] += magnitude * dy; - this._forcesZ[fromId] += magnitude * dz; - this._forcesX[toId] -= magnitude * dx; - this._forcesY[toId] -= magnitude * dy; - this._forcesZ[toId] -= magnitude * dz; - } - } - const minBounds = Math.min(Math.min(this._minBoundsX, this._minBoundsY), this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._maxBoundsX, this._maxBoundsY), this._maxBoundsZ); - const size = maxBounds - minBounds; - const maxLevel = 10; - const minBoundsX = minBounds; - const minBoundsY = minBounds; - const minBoundsZ = minBounds; - const maxBoundsX = maxBounds; - const maxBoundsY = maxBounds; - const maxBoundsZ = maxBounds; - const octTreeOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - maxLevel: maxLevel, - ids: this._nodeIds, - positionsX: this._nodePositionsX, - positionsY: this._nodePositionsY, - positionsZ: this._nodePositionsZ, - masses: this._nodeWeights - }; - const octTree = new (0, _octtreeJs.OctTreeHelper)(octTreeOptions); - this._totalRepulsion = 0; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forceX = 0; - this._forceY = 0; - this._forceZ = 0; - this.calculateRepulsion(octTree.root, id); - this._forcesX[id] += this._forceX; - this._forcesY[id] += this._forceY; - this._forcesZ[id] += this._forceZ; - this._totalRepulsion += Math.sqrt(this._forceX * this._forceX + this._forceY * this._forceY + this._forceZ * this._forceZ); - } - const timeSquared = this._interval * this._interval; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - const mass = this._nodeWeights[id]; - const ax = this._forcesX[id] / mass; - const ay = this._forcesY[id] / mass; - const az = this._forcesZ[id] / mass; - let dx = ax * timeSquared / 2; - let dy = ay * timeSquared / 2; - let dz = az * timeSquared / 2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - const distance = Math.sqrt(distanceSquared); - if (distance > this._maxDistance * size) { - dx *= this._maxDistance * size / distance; - dy *= this._maxDistance * size / distance; - dz *= this._maxDistance * size / distance; - } - if (!this._lockX) this._nodePositionsX[id] += dx; - if (!this._lockY) this._nodePositionsY[id] += dy; - if (!this._lockZ) this._nodePositionsZ[id] += dz; - } - } - if (this.layoutCallback) this.layoutCallback(); - } - calculateRepulsion(parent, id1) { - const x1 = this._nodePositionsX[id1]; - const y1 = this._nodePositionsY[id1]; - const z1 = this._nodePositionsZ[id1]; - for(let k = 0; k < parent.children.length; k++){ - const child = parent.children[k]; - if (!child.children) for(let i = 0; i < child.ids.length; i++){ - const id2 = child.ids[i]; - if (id1 != id2) { - const x2 = this._nodePositionsX[id2]; - const y2 = this._nodePositionsY[id2]; - const z2 = this._nodePositionsZ[id2]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - let distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = this._repulsion * this._nodeWeights[id1] * this._nodeWeights[id2] / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } - } - } - else { - let dx = x1 - child.centerOfMassX; - let dy = y1 - child.centerOfMassY; - let dz = z1 - child.centerOfMassZ; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const width = child.maxBoundsX - child.minBoundsX; - if (width / distance < this._theta) { - const magnitude = this._repulsion * this._nodeWeights[id1] * child.mass / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } else this.calculateRepulsion(child, id1); - } - } - } + get offsetsZ() { + return this._offsetsZ; } -} - -},{"./octtree.js":"lv4D9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lv4D9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OctTreeNode", ()=>OctTreeNode); -parcelHelpers.export(exports, "OctTreeHelper", ()=>OctTreeHelper); -class OctTreeNode { -} -class OctTreeHelper { - constructor(options){ - this._ids = options.ids; - this._positionsX = options.positionsX; - this._positionsY = options.positionsY; - this._positionsZ = options.positionsZ; - this._masses = options.masses; - this._maxLevel = options.maxLevel; - this.root = new OctTreeNode(); - this.root.minBoundsX = options.minBoundsX; - this.root.minBoundsY = options.minBoundsY; - this.root.minBoundsZ = options.minBoundsZ; - this.root.maxBoundsX = options.maxBoundsX; - this.root.maxBoundsY = options.maxBoundsY; - this.root.maxBoundsZ = options.maxBoundsZ; - this.root.level = 0; - this.root.octKey = ""; - this._buildTree(this.root, this._ids); - } - _buildTree(parent, ids) { - const centerX = (parent.minBoundsX + parent.maxBoundsX) / 2; - const centerY = (parent.minBoundsY + parent.maxBoundsY) / 2; - const centerZ = (parent.minBoundsZ + parent.maxBoundsZ) / 2; - const minBoundsX = []; - const minBoundsY = []; - const minBoundsZ = []; - const maxBoundsX = []; - const maxBoundsY = []; - const maxBoundsZ = []; - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - const masses = new Float64Array(8); - const centerOfMassesX = new Float64Array(8); - const centerOfMassesY = new Float64Array(8); - const centerOfMassesZ = new Float64Array(8); - const buckets = [ - [], - [], - [], - [], - [], - [], - [], - [] - ]; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const x = this._positionsX[index]; - const y = this._positionsY[index]; - const z = this._positionsZ[index]; - const mass = this._masses[index]; - for(let j = 0; j < 8; j++)if (minBoundsX[j] <= x && maxBoundsX[j] >= x && minBoundsY[j] <= y && maxBoundsY[j] >= y && minBoundsZ[j] <= z && maxBoundsZ[j] >= z) { - buckets[j].push(index); - masses[j] += mass; - centerOfMassesX[j] += x * mass; - centerOfMassesY[j] += y * mass; - centerOfMassesZ[j] += z * mass; - break; - } - } - parent.children = []; - for(let i = 0; i < 8; i++)if (buckets[i].length > 0) { - const child = new OctTreeNode(); - child.minBoundsX = minBoundsX[i]; - child.minBoundsY = minBoundsY[i]; - child.minBoundsZ = minBoundsZ[i]; - child.maxBoundsX = maxBoundsX[i]; - child.maxBoundsY = maxBoundsY[i]; - child.maxBoundsZ = maxBoundsZ[i]; - child.mass = masses[i]; - child.centerOfMassX = centerOfMassesX[i] / masses[i]; - child.centerOfMassY = centerOfMassesY[i] / masses[i]; - child.centerOfMassZ = centerOfMassesZ[i] / masses[i]; - child.level = parent.level + 1; - child.octKey += i.toString(); - child.parent = parent; - child.ids = new Uint32Array(buckets[i]); - parent.children.push(child); - if (child.ids.length > 1 && child.level < this._maxLevel) this._buildTree(child, child.ids); - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ahk7A":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexHelper", ()=>HexHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _angleJs = require("./angle.js"); -class HexHelper { - static width(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return (0, _constantsJs.Constants).ROOT_THREE * size; - else return 2 * size; - } - static height(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return 2 * size; - else return (0, _constantsJs.Constants).ROOT_THREE * size; - } - static pointyHexCorner(center, size, i, position) { - const angle = (0, _angleJs.AngleHelper).degreesToRadians(60 * i - 30); - position[0] = center[0] + size * Math.cos(angle); - position[1] = center[1] + size * Math.sin(angle); - } - static cubeToAxial(cube, hex) { - hex[0] = cube[0]; - hex[1] = cube[2]; - } - static axialToCube(hex, cube) { - const x = hex[0]; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static cubeToOddr(cube, hex) { - const col = cube[0] + (cube[2] - (cube[2] & 1)) / 2; - const row = cube[2]; - hex[0] = col; - hex[1] = row; - } - static oddrToCube(hex, cube) { - const x = hex[0] - (hex[1] - (hex[1] & 1)) / 2; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static pointyHexToPixel(hex, size, point) { - point[0] = size * ((0, _constantsJs.Constants).ROOT_THREE * hex[0] + (0, _constantsJs.Constants).ROOT_THREE / 2 * hex[1]); - point[1] = size * (1.5 * hex[1]); - } - static pixelToPointyHex(point, size, hex) { - hex[0] = ((0, _constantsJs.Constants).ROOT_THREE / 3 * point[0] - 1 / 3 * point[1]) / size; - hex[1] = 2 / 3 * point[1] / size; - this.hexRound(hex, hex); - } - static hexRound(hex, hexRound) { - const cube = this._vec3; - this.axialToCube(hex, cube); - this.cubeRound(cube, cube); - this.cubeToAxial(cube, hexRound); - } - static cubeRound(cube, cubeRound) { - let rx = Math.round(cube[0]); - let ry = Math.round(cube[1]); - let rz = Math.round(cube[2]); - const x_diff = Math.abs(rx - cube[0]); - const y_diff = Math.abs(ry - cube[1]); - const z_diff = Math.abs(rz - cube[2]); - if (x_diff > y_diff && x_diff > z_diff) rx = -ry - rz; - else if (y_diff > z_diff) ry = -rx - rz; - else rz = -rx - ry; - cubeRound[0] = rx; - cubeRound[1] = ry; - cubeRound[2] = rz; - } -} -HexHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../main.js":"f421K","./angle.js":"53hwW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bm0M4":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexBinHelper", ()=>HexBinHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _hexJs = require("./hex.js"); -class HexBinHelper { - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const width = (options.maxValueX - options.minValueX) / options.binsX; - const minValueX = options.minValueX - width / 2; - const binsX = options.binsX + 1; - const size = width / (0, _constantsJs.Constants).ROOT_THREE; - const height = 2 * size; - const heightBetweenCenters = 3 * height / 4; - const binsY = Math.ceil((options.maxValueY - options.minValueY) / heightBetweenCenters) + 1; - const minValueY = options.minValueY; - const minQ = -Math.floor(binsY / 2); - const maxBins = (binsX - minQ) * binsY; - const binCounts = new Float64Array(maxBins); - const binLookup = new Uint32Array(maxBins); - const point = (0, _glMatrix.vec2).create(); - const hex = (0, _glMatrix.vec2).create(); - let nonEmptyBins = 0; - let minCount = Number.MAX_VALUE; - let maxCount = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - point[0] = options.valuesX[id] - minValueX; - point[1] = options.valuesY[id] - minValueY; - (0, _hexJs.HexHelper).pixelToPointyHex(point, size, hex); - const q = hex[0] - minQ; - const r = hex[1]; - const binId = q + r * (binsX - minQ); - if (binCounts[binId] == 0) { - binLookup[binId] = nonEmptyBins; - nonEmptyBins++; - } - binCounts[binId]++; - options.binIds[id] = binId; - minCount = Math.min(minCount, binCounts[binId]); - maxCount = Math.max(maxCount, binCounts[binId]); - } - const positionsX = new Float64Array(nonEmptyBins); - const positionsY = new Float64Array(nonEmptyBins); - const counts = new Uint32Array(nonEmptyBins); - const lookup = {}; - for(let i = 0; i < maxBins; i++){ - const count = binCounts[i]; - if (count > 0) { - const index = binLookup[i]; - lookup[i] = index; - counts[index] = count; - const q = i % (binsX - minQ); - const r = Math.floor(i / (binsX - minQ)); - hex[0] = q + minQ; - hex[1] = r; - (0, _hexJs.HexHelper).pointyHexToPixel(hex, size, point); - positionsX[index] = point[0] + minValueX; - positionsY[index] = point[1] + minValueY; - } - } - const result = { - binIds: options.binIds, - positionsX: positionsX, - positionsY: positionsY, - counts: counts, - minCount: minCount, - maxCount: maxCount, - orientation: (0, _mainJs.HexOrientation).pointyTop, - size: size, - lookup: lookup, - binsY: binsY - }; - return result; + set offsetsZ(value2) { + if (this._offsetsZ != value2) { + this._offsetsZ = value2; + this._hasChanged = true; + } } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../main.js":"f421K","./hex.js":"ahk7A","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iEeyT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LineHelper", ()=>LineHelper); -var _mainJs = require("../main.js"); -class LineHelper { - constructor(core){ - this._core = core; - } - connect(orderedIds, series, toIds, offset = 0, count = orderedIds.length) { - const start = window.performance.now(); - const lines = new Set(); - const lookup = {}; - for(let i = offset; i < count; i++){ - const id = orderedIds[i + offset]; - const value = series[id]; - const fromId = lookup[value]; - if (fromId != null) { - toIds[fromId] = id; - lines.add(value); - } - lookup[value] = id; - toIds[id] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `${lines.size} lines connected ${Math.round(window.performance.now() - start)}ms`); - return lines.size; - } -} - -},{"../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7fuDW":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteHelper", ()=>PaletteHelper); -var _glMatrix = require("gl-matrix"); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -class PaletteHelper { - static resample(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < divisionsOut; i++){ - const positionOut = (i + 0.5) / divisionsOut; - const positionIn = positionOut * (divisionsIn - 1); - const stepIn = Math.floor(positionIn); - const fractIn = positionIn - stepIn; - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3], colorsIn[(stepIn + 1) * 3], fractIn); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 1], colorsIn[(stepIn + 1) * 3 + 1], fractIn); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 2], colorsIn[(stepIn + 1) * 3 + 2], fractIn); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static truncate(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < Math.min(divisionsIn, divisionsOut); i++){ - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = colorsIn[i * 3]; - colorsOut[j * 4 + 1] = colorsIn[i * 3 + 1]; - colorsOut[j * 4 + 2] = colorsIn[i * 3 + 2]; - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static resampleStops(stops, divisions, reverse) { - const colorsOut = new Uint8Array(divisions * 4); - let from = 0; - let to = 0; - for(let i = 0; i < divisions; i++){ - const positionOut = (i + 0.5) / divisions; - while(stops[from].position < positionOut && from < stops.length - 1)from++; - from = Math.max(from - 1, 0); - to = Math.min(from + 1, stops.length - 1); - const fromStop = stops[from]; - const toStop = stops[to]; - const fract = from == to ? 0 : (positionOut - fromStop.position) / (toStop.position - fromStop.position); - const j = reverse ? divisions - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(fromStop.r, toStop.r, fract); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(fromStop.g, toStop.g, fract); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(fromStop.b, toStop.b, fract); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static lerpRgb(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - colors[i * 4] = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - colors[i * 4 + 1] = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - colors[i * 4 + 2] = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - colors[i * 4 + 3] = 0xff; - } - return colors; - } - static lerpHsv(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - const h = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - const s = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - const v = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - (0, _colorJs.ColorHelper).hsvToRgb(h, s, v, PaletteHelper._rgb); - colors[i * 4] = PaletteHelper._rgb[0] * 0xff; - colors[i * 4 + 1] = PaletteHelper._rgb[1] * 0xff; - colors[i * 4 + 2] = PaletteHelper._rgb[2] * 0xff; - colors[i * 4 + 3] = 0xff; - } - return colors; - } -} -PaletteHelper._rgb = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","./color.js":"4LgMf","./math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dvdia":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PathHelper", ()=>PathHelper); -class PathHelper { - static getFilenameWithoutExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1) return path; - else { - const start = path.lastIndexOf('/') == -1 ? 0 : path.lastIndexOf('/') + 1; - return path.substring(start, dot); - } + get offsetScalingX() { + return this._offsetScalingX; } - static getExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1 || dot == path.length - 1) return null; - else return path.substring(dot + 1, path.length); + set offsetScalingX(value2) { + if (this._offsetScalingX != value2) { + this._offsetScalingX = value2; + this._hasChanged = true; + } } - static getFilename(path) { - if (path.lastIndexOf('/') == -1) return path; - else { - const start = path.lastIndexOf('/') + 1; - return path.substring(start, path.length); - } + get offsetScalingY() { + return this._offsetScalingY; } - static getPath(path) { - if (path.lastIndexOf('/') == -1) return ""; - else return path.substring(0, path.lastIndexOf('/')); + set offsetScalingY(value2) { + if (this._offsetScalingY != value2) { + this._offsetScalingY = value2; + this._hasChanged = true; + } } - static combine(first, second) { - const seperator = first.lastIndexOf('/') == first.length - 1; - if (second.indexOf('/') == 0) { - if (seperator) return first.substring(0, first.length - 1) + second; - else return first + second; - } else { - if (seperator) return first + second; - else return first + '/' + second; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cn0Qv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TableHelper", ()=>TableHelper); -var _mainJs = require("../main.js"); -var _tableJs = require("../tables/table.js"); -class TableHelper { - constructor(core){ - this._core = core; - } - compatibleTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const types = []; - const integers = []; - let values = data[firstRow]; - let parsedFloat, parsedDate; - for(let i = 0; i < values.length; i++){ - const value = values[i]; - parsedFloat = Number(value); - parsedDate = Date.parse(value); - let integer = false; - let type; - if (!isNaN(parsedFloat)) { - type = (0, _tableJs.ColumnType).float; - integer = Number.isSafeInteger(parsedFloat); - } else if (!isNaN(parsedDate)) type = (0, _tableJs.ColumnType).date; - else type = (0, _tableJs.ColumnType).string; - types.push(type); - integers.push(integer); - } - for(let i = firstRow + 1; i < Math.min(data.length, firstRow + maxRows); i++){ - values = data[i]; - for(let j = 0; j < values.length; j++)if (types[j] != (0, _tableJs.ColumnType).string) { - const value = values[j]; - parsedFloat = Number(value); - if (types[j] == (0, _tableJs.ColumnType).float) { - if (isNaN(parsedFloat)) { - types[j] = (0, _tableJs.ColumnType).string; - integers[j] = false; - } else if (integers[j]) integers[j] = Number.isSafeInteger(parsedFloat); - } else if (types[j] == (0, _tableJs.ColumnType).date) { - parsedDate = Date.parse(value); - if (isNaN(parsedDate)) types[j] = (0, _tableJs.ColumnType).string; - } - } - } - const compatibleTypes = []; - for(let i = 0; i < types.length; i++){ - let compatible = types[i] | (0, _tableJs.ColumnType).string; - if (integers[i]) compatible |= (0, _tableJs.ColumnType).integer; - compatibleTypes.push(compatible); - } - this._core.log.write((0, _mainJs.LogLevel).info, `compatible types ${Math.round(window.performance.now() - start)}ms`); - return compatibleTypes; - } - inferTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const columnTypes = []; - const compatibleTypes = this.compatibleTypes(data, firstRow, maxRows); - for(let i = 0; i < compatibleTypes.length; i++){ - let columnType; - const compatibleType = compatibleTypes[i]; - if (compatibleType & (0, _tableJs.ColumnType).integer) columnType = (0, _tableJs.ColumnType).integer; - else if (compatibleType & (0, _tableJs.ColumnType).float) columnType = (0, _tableJs.ColumnType).float; - else if (compatibleType & (0, _tableJs.ColumnType).date) columnType = (0, _tableJs.ColumnType).date; - else columnType = (0, _tableJs.ColumnType).string; - columnTypes.push(columnType); - } - return columnTypes; - } - convertToObject(table) { - const headings = table.headings; - const jsonObject = []; - for(let i = 0; i < table.all.ids.length; i++){ - const row = {}; - for(let j = 0; j < headings.length; j++){ - const column = headings[j]; - const value = table.all.columnValues(j)[i]; - switch(table.getColumnType(j)){ - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - row[column] = value; - break; - case (0, _tableJs.ColumnType).string: - case (0, _tableJs.ColumnType).date: - default: - row[column] = table.data[i][j]; - break; - } - jsonObject.push(row); - } - } - return jsonObject; - } -} - -},{"../main.js":"f421K","../tables/table.js":"1Nyfw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Nyfw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -parcelHelpers.export(exports, "ColumnType", ()=>ColumnType); -var _filterJs = require("./filter.js"); -class Table { - get data() { - return this._data; - } - get headings() { - return this._headings; - } - get all() { - return this._all; + get offsetScalingZ() { + return this._offsetScalingZ; } - get isInitialized() { - return this._isInitialized; + set offsetScalingZ(value2) { + if (this._offsetScalingZ != value2) { + this._offsetScalingZ = value2; + this._hasChanged = true; + } } - get filter() { - return this._filter; + get text() { + return this._text; } - set filter(value) { - if (this._filter !== value) { - this._filter = value; - if (this.filterChangedCallback) this.filterChangedCallback(); - } + set text(value2) { + if (this._text != value2) { + this._text = value2; + this._hasChanged = true; + } } - getColumnType(column) { - return this._columnTypes[column]; + get horizontalAlignments() { + return this._horizontalAlignments; } - isColumnDiscrete(column) { - return (this._columnTypes[column] & ColumnType.discrete) > 0; + set horizontalAlignments(value2) { + if (this._horizontalAlignments != value2) { + this._horizontalAlignments = value2; + this._hasChanged = true; + } } - isColumnNumeric(column) { - return (this._columnTypes[column] & ColumnType.numeric) > 0; + get verticalAlignments() { + return this._verticalAlignments; } - isColumnContinuous(column) { - return (this._columnTypes[column] & ColumnType.continuous) > 0; + set verticalAlignments(value2) { + if (this._verticalAlignments != value2) { + this._verticalAlignments = value2; + this._hasChanged = true; + } } - constructor(core, headings, data, columnTypes){ - this._core = core; - this._headings = headings; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = Array(columnTypes.length).fill(null); - const indices = new Uint32Array(data.length); - for(let i = 0; i < indices.length; i++)indices[i] = i; - this._all = new (0, _filterJs.Filter)(core, indices, data, headings, columnTypes, this._numericValues); - this._isInitialized = true; + get scales() { + return this._scales; } - createFilter(ids) { - return new (0, _filterJs.Filter)(this._core, ids, this._data, this._headings, this._columnTypes, this._numericValues); + set scales(value2) { + if (this._scales != value2) { + this._scales = value2; + this._hasChanged = true; + } } -} -const ColumnType = { - none: 0, - float: 1, - integer: 2, - string: 4, - date: 8, - continuous: 9, - discrete: 6, - numeric: 11 -}; - -},{"./filter.js":"b6FuS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b6FuS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Filter", ()=>Filter); -var _mainJs = require("../main.js"); -var _tableJs = require("./table.js"); -class Filter { - get ids() { - return this._ids; - } - constructor(core, ids, data, headings, columnTypes, numericValues){ - this._core = core; - this._ids = ids; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = numericValues; - this._stringValues = Array(columnTypes.length).fill(null); - this._hasMinMaxValues = Array(columnTypes.length).fill(false); - this._minValues = Array(columnTypes.length).fill(0); - this._maxValues = Array(columnTypes.length).fill(0); - this._distinctStrings = Array(columnTypes.length).fill(null); - this._orderedIds = Array(columnTypes.length).fill(null); - this._orderedValues = Array(columnTypes.length).fill(null); - } - columnValues(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) return this._createStringValues(column); - else return this._createNumericValues(column); - } - minValue(column) { - this._createMinMaxValues(column); - return this._minValues[column]; - } - maxValue(column) { - this._createMinMaxValues(column); - return this._maxValues[column]; - } - distinctStrings(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - return this._distinctStrings[column]; - } else return null; - } - toJSON(ids, columns) { - const rows = []; - for(let i = 0; i < ids.length; i++){ - const rowIndex = ids[i]; - const row = []; - for(let j = 0; j < columns.length; j++){ - const columnIndex = columns[j]; - switch(this._columnTypes[columnIndex]){ - case (0, _tableJs.ColumnType).date: - case (0, _tableJs.ColumnType).string: - row.push(this._data[rowIndex][columnIndex]); - break; - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - const numericValues = this._createNumericValues(columnIndex); - row.push(numericValues[rowIndex]); - break; - } - } - rows.push(row); - } - return JSON.stringify(rows); + get scalesScaling() { + return this._scalesScaling; } - orderedIds(column) { - if (!this._orderedIds[column]) { - const start = window.performance.now(); - const orderedIds = new Uint32Array(this._ids); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - orderedIds.sort(function(a, b) { - return values[a] - values[b]; - }); - this._orderedIds[column] = orderedIds; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered ids ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedIds[column]; + set scalesScaling(value2) { + if (this._scalesScaling != value2) { + this._scalesScaling = value2; + this._hasChanged = true; + } } - orderedValues(column) { - if (!this._orderedValues[column]) { - const start = window.performance.now(); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - const orderedIds = this.orderedIds(column); - const orderedValues = new Float64Array(this._ids.length); - for(let i = 0; i < this._ids.length; i++)orderedValues[i] = values[orderedIds[i]]; - this._orderedValues[column] = orderedValues; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered values ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedValues[column]; - } - distinctStringsOrdered(ids, column, stringValues) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - const distinctStrings = []; - const distinctStringValues = {}; - const set = new Set(); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const string = this._data[id][column]; - let value; - if (!set.has(string)) { - distinctStrings.push(string); - value = set.size; - distinctStringValues[string] = value; - set.add(string); - } else value = distinctStringValues[string]; - stringValues[id] = value; - } - return distinctStrings; - } else return null; - } - _createMinMaxValues(column) { - if (!this._hasMinMaxValues[column]) { - const type = this._columnTypes[column]; - let min, max; - if (type == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - min = 0; - max = this._distinctStrings[column].length - 1; - } else { - const numericValues = this._createNumericValues(column); - min = Number.MAX_VALUE; - max = -Number.MAX_VALUE; - for(let i = 0; i < this._ids.length; i++){ - const id = this._ids[i]; - const value = numericValues[id]; - min = Math.min(min, value); - max = Math.max(max, value); - } - } - this._minValues[column] = min; - this._maxValues[column] = max; - this._hasMinMaxValues[column] = true; - } - } - _createNumericValues(column) { - if (!this._numericValues[column]) { - const numericValues = new Float64Array(this._data.length); - const type = this._columnTypes[column]; - if (type == (0, _tableJs.ColumnType).float) for(let i = 0; i < this._data.length; i++){ - const value = parseFloat(this._data[i][column]); - numericValues[i] = value; - } - else if (type == (0, _tableJs.ColumnType).integer) for(let i = 0; i < this._data.length; i++){ - const value = parseInt(this._data[i][column]); - numericValues[i] = value; - } - else if (type == (0, _tableJs.ColumnType).date) for(let i = 0; i < this._data.length; i++){ - const value = Date.parse(this._data[i][column]); - numericValues[i] = value; - } - this._numericValues[column] = numericValues; - } - return this._numericValues[column]; - } - _createStringValues(column) { - if (!this._stringValues[column]) { - this._stringValues[column] = new Float64Array(this._data.length); - this._distinctStrings[column] = this.distinctStringsOrdered(this._ids, column, this._stringValues[column]); - this._minValues[column] = 0; - this._maxValues[column] = this._distinctStrings[column].length - 1; - this._hasMinMaxValues[column] = true; - } - return this._stringValues[column]; - } -} - -},{"../main.js":"f421K","./table.js":"1Nyfw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bUoBU":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureHelper", ()=>TextureHelper); -var _mathJs = require("./math.js"); -class TextureHelper { - static create(gl, width, height, format, type, filter, bytes, internalFormat = format) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, bytes); - return texture; - } - static fromImage(gl, image, mipmaps, filter) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - if (mipmaps && (0, _mathJs.MathHelper).isPowerOf2(image.width) && (0, _mathJs.MathHelper).isPowerOf2(image.height)) gl.generateMipmap(gl.TEXTURE_2D); - else { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - } - gl.bindTexture(gl.TEXTURE_2D, null); - return texture; + constructor(core, options2) { + super(core, options2); + this._quat = create$4(); + this._materials = options2.materials; + this._materialType = options2.materialType; + this._materialColor = options2.materialColors ? null : options2.materialColor || core.config.textColor; + this._materialColors = options2.materialColors; + this.minBoundsX = options2.minBoundsX ? options2.minBoundsX : 0; + this.minBoundsY = options2.minBoundsY ? options2.minBoundsY : 0; + this.minBoundsZ = options2.minBoundsZ ? options2.minBoundsZ : 0; + this.maxBoundsX = options2.maxBoundsX ? options2.maxBoundsX : 1; + this.maxBoundsY = options2.maxBoundsY ? options2.maxBoundsY : 1; + this.maxBoundsZ = options2.maxBoundsZ ? options2.maxBoundsZ : 1; + this._font = options2.font || core.font; + this.text = options2.text; + this.positionsX = options2.positionsX; + this.positionsY = options2.positionsY; + this.positionsZ = options2.positionsZ; + this.positionScalingX = options2.positionScalingX ? options2.positionScalingX : 1; + this.positionScalingY = options2.positionScalingY ? options2.positionScalingY : 1; + this.positionScalingZ = options2.positionScalingZ ? options2.positionScalingZ : 1; + this.rotations = options2.rotations; + this.offsetsX = options2.offsetsX; + this.offsetsY = options2.offsetsY; + this.offsetsZ = options2.offsetsZ; + this.offsetScalingX = options2.offsetScalingX ? options2.offsetScalingX : 1; + this.offsetScalingY = options2.offsetScalingY ? options2.offsetScalingY : 1; + this.offsetScalingZ = options2.offsetScalingZ ? options2.offsetScalingZ : 1; + if (options2.horizontalAlignments) + this.horizontalAlignments = options2.horizontalAlignments; + if (options2.verticalAlignments) + this.verticalAlignments = options2.verticalAlignments; + if (options2.scales) + this.scales = options2.scales; + this.scalesScaling = options2.scalesScaling ? options2.scalesScaling : 1; } - static cubemapFromImages(gl, images) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); - const targets = [ - gl.TEXTURE_CUBE_MAP_POSITIVE_X, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X, - gl.TEXTURE_CUBE_MAP_POSITIVE_Y, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, - gl.TEXTURE_CUBE_MAP_POSITIVE_Z, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Z - ]; - for(let i = 0; i < 6; i++){ - gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - } - gl.generateMipmap(gl.TEXTURE_CUBE_MAP); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); - return texture; - } -} - -},{"./math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4ts5g":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TreeHelper", ()=>TreeHelper); -class TreeHelper { - static parentChildren(ids, parentIds, childIds) { - const rootIds = []; - const degrees = new Uint32Array(ids.length); - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const parentId = parentIds[index]; - const childId = childIds[index]; - indices[childId] = index; - if (children[parentId] === undefined) { - children[parentId] = []; - degrees[index] = 1; + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.pickIdLookup = {}; + if (!this._text) { + this._indexCount = 0; + } else { + const start = window.performance.now(); + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; + const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; + const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; + if (this._rotation) { + set$6(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); + } + let glyphs = 0; + for (let i = 0; i < this._text.length; i++) { + const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; + const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; + const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; + const text2 = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); + const scale2 = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const lineHeight2 = this._font.size * scale2; + const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale2; + const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; + switch (horizontalAlignment) { + case HorizontalAlignment.left: + this._offset[0] = offsetX; + break; + case HorizontalAlignment.center: + this._offset[0] = offsetX - width2 / 2; + break; + case HorizontalAlignment.right: + this._offset[0] = offsetX - width2; + break; } - if (parentId < 0 || parentId == childId) rootIds.push(parentId); - else { - children[parentId].push(childId); - degrees[index]++; + const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; + switch (verticalAlignment) { + case VerticalAlignment.top: + this._offset[1] = offsetY - lineHeight2 / 2; + break; + case VerticalAlignment.center: + this._offset[1] = offsetY; + break; + case VerticalAlignment.bottom: + this._offset[1] = offsetY + lineHeight2 / 2; + break; } + this._offset[1] -= maxGlyphTop / 2; + this._offset[2] = offsetZ; + let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; + let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; + let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; + if (this._reverseX) { + positionX = this.minBoundsX + this.maxBoundsX - positionX; + } + if (this._reverseY) { + positionY = this.minBoundsY + this.maxBoundsY - positionY; + } + if (this._reverseZ) { + positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; + } + set$8(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); + if (this._rotations) { + set$6(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.label, this._vec4); + this.pickIdLookup[pickId] = i; + TextHelper.addString(this._font, text2, this._verticesView, this._indices, glyphs, this._vec3, scale2, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); + glyphs += text2.length; + if (glyphs >= this._maxGlyphs) { + glyphs = this._maxGlyphs; + break; + } + } + this._indexCount = glyphs * 6; + this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } } - return { - rootIds: rootIds, - indices: indices, - children: children, - degrees: degrees - }; + } } - static tree(rootId, indices, children, positions, widths, descendents) { - let nextId = 0; - const idsArray = []; - let maxDescendents = 0; - const buildTree = (parentId)=>{ - const index = indices[parentId]; - idsArray.push(index); - const childIds = children[parentId]; - if (childIds !== undefined) { - const start = nextId; - let total = 0; - for(let i = 0; i < childIds.length; i++){ - buildTree(childIds[i]); - total += descendents[indices[childIds[i]]] + 1; - } - const end = nextId - 1; - positions[index] = (start + end) / 2; - descendents[index] = total; - maxDescendents = Math.max(maxDescendents, total); - widths[index] = end - start + 1; - } else { - widths[index] = 1; - positions[index] = nextId++; - } - }; - buildTree(rootId); - const maxPosition = nextId - 1; - return { - ids: new Uint32Array(idsArray), - maxDescendents: maxDescendents, - maxPosition: maxPosition - }; + } + let ImageVisual$2 = class ImageVisual { + render(elapsedTime, xrFrame) { } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7s3Z5":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SetHelper", ()=>SetHelper); -class SetHelper { - static new(a, b) { - a.clear(); - for (let item of b)a.add(item); - } - static union(a, b) { - for (let item of b)a.add(item); - } - static intersection(a, b) { - const c = new Set(b); - for (let item of a)if (!c.has(item)) a.delete(item); - for (let item of b)if (!a.has(item)) a.delete(item); - } - static symmetricDifference(a, b) { - for (let item of b)if (a.has(item)) a.delete(item); - else a.add(item); - } - static difference(a, b) { - for (let item of b)a.delete(item); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2PdqK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfHelper", ()=>SdfHelper); -class SdfHelper { - static _circle(px, py, r) { - return Math.sqrt(px * px + py * py) - r; - } - static _box(px, py, bx, by) { - const dx0 = Math.abs(px) - bx; - const dy0 = Math.abs(py) - by; - const dx1 = Math.max(dx0, 0); - const dy1 = Math.max(dy0, 0); - return Math.sqrt(dx1 * dx1 + dy1 * dy1) + Math.min(Math.max(dx0, dy0), 0); - } - static _create(width, height, edge, sdf) { - const pixels = new Uint8ClampedArray(width * height * 4); - for(let y = 0; y < height; y++)for(let x = 0; x < width; x++){ - const d = edge - sdf(x - width / 2, y - height / 2); - const offset = (x + y * height) * 4; - pixels[offset] = d; - pixels[offset + 1] = d; - pixels[offset + 2] = d; - pixels[offset + 3] = 0xff; - } - return new ImageData(pixels, width, height); - } - static circle(imageWidth, imageHeight, radius, edgeValue) { - const sdf = (x, y)=>this._circle(x, y, radius); - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } - static box(imageWidth, imageHeight, boxWidth, boxHeight, edgeValue, rounding = 0) { - const sdf = (x, y)=>this._box(x, y, boxWidth - rounding, boxHeight - rounding) - rounding; - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2r8XP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VectorHelper", ()=>VectorHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class VectorHelper { - static orthonormalBasis(n, b1, b2) { - if (n[0] > 0.9) (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITY); - else (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITX); - (0, _glMatrix.vec3).scaleAndAdd(b1, b1, n, -(0, _glMatrix.vec3).dot(b1, n)); - (0, _glMatrix.vec3).normalize(b1, b1); - (0, _glMatrix.vec3).cross(b2, n, b1); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"duBHP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>(0, _barJs.Bar)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Line", ()=>(0, _lineJs.Line)); -parcelHelpers.export(exports, "Tree", ()=>(0, _treeJs.Tree)); -parcelHelpers.export(exports, "PythagorasTree", ()=>(0, _treeJs.PythagorasTree)); -parcelHelpers.export(exports, "Scatter", ()=>(0, _scatterJs.Scatter)); -parcelHelpers.export(exports, "Sheet", ()=>(0, _sheetJs.Sheet)); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>(0, _treemapJs.SquarifiedTreeMap)); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>(0, _treemapJs.CubifiedTreeMap)); -parcelHelpers.export(exports, "Stack", ()=>(0, _stackJs.Stack)); -parcelHelpers.export(exports, "StackTreeMap", ()=>(0, _stackJs.StackTreeMap)); -var _barJs = require("./bar.js"); -var _cubeJs = require("./cube.js"); -var _lineJs = require("./line.js"); -var _treeJs = require("./tree.js"); -var _scatterJs = require("./scatter.js"); -var _sheetJs = require("./sheet.js"); -var _treemapJs = require("./treemap.js"); -var _stackJs = require("./stack.js"); - -},{"./bar.js":"6wdpr","./cube.js":"g6aRn","./line.js":"a7d6z","./tree.js":"2Odry","./scatter.js":"bwpY2","./sheet.js":"fGQjs","./treemap.js":"1HzJp","./stack.js":"f8244","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6wdpr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>Bar); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Bar extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const heightScaling = options.heightScaling === undefined ? 1 : options.heightScaling; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const paddingX = options.paddingX == undefined ? 0 : options.paddingX * positionScalingX; - const paddingZ = options.paddingZ == undefined ? 0 : options.paddingZ * positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - let positionX, positionY, positionZ; - let sizeX, sizeY, sizeZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(options.heights ? options.heights[id] * heightScaling : heightScaling, minHeight); - positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - positionY = height / 2; - positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - sizeX = (options.sizeX === undefined ? options.sizesX ? options.sizesX[id] : 1 : options.sizeX) * positionScalingX; - sizeY = Math.abs(height); - sizeZ = (options.sizeZ === undefined ? options.sizesZ ? options.sizesZ[id] : 1 : options.sizeZ) * positionScalingZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX - sizeX / 2); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY - sizeY / 2); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ - sizeZ / 2); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX + sizeX / 2); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY + sizeY / 2); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ + sizeZ / 2); - this._sizes[index * 3] = Math.max(sizeX - paddingX, 0); - this._sizes[index * 3 + 1] = sizeY; - this._sizes[index * 3 + 2] = Math.max(sizeZ - paddingZ, 0); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g6aRn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Cube extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.cbrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / (side * side)); - const z = Math.floor((i - y * side * side) / side); - const x = i - y * side * side - z * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = z; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, z); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - _vec2[0] = color; - _vec2[1] = color; - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a7d6z":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Line", ()=>Line); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Line extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const offsetScaling = options.offsetScaling === undefined ? 1 : options.offsetScaling; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - this._rotations = new Float32Array(buffer.length * 4); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const direction = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; - let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; - let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; - let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; - let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; - let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; - if (fromId == toId) { - this._sizes[index * 3] = 0; - this._sizes[index * 3 + 1] = 0; - this._sizes[index * 3 + 2] = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - } else { - direction[0] = toPositionX - fromPositionX; - direction[1] = toPositionY - fromPositionY; - direction[2] = toPositionZ - fromPositionZ; - let length = (0, _glMatrix.vec3).length(direction); - (0, _glMatrix.vec3).scale(direction, direction, 1 / length); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, direction); - this._rotations[index * 4] = _quat[0]; - this._rotations[index * 4 + 1] = _quat[1]; - this._rotations[index * 4 + 2] = _quat[2]; - this._rotations[index * 4 + 3] = _quat[3]; - if (options.offsets) { - const fromOffset = options.offsets[fromId] * offsetScaling / 2; - const toOffset = options.offsets[toId] * offsetScaling / 2; - toPositionX -= direction[0] * toOffset; - toPositionY -= direction[1] * toOffset; - toPositionZ -= direction[2] * toOffset; - fromPositionX += direction[0] * fromOffset; - fromPositionY += direction[1] * fromOffset; - fromPositionZ += direction[2] * fromOffset; - length = Math.max(length - toOffset - fromOffset, minSize); - } - this._sizes[index * 3 + 1] = Math.max(length * sizeScalingY, minSize); - if (options.lineSizes) { - this._sizes[index * 3] = Math.max(options.lineSizes[id] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.lineSizes[id] * sizeScalingZ, minSize); - } else if (options.endSizes) { - this._sizes[index * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); - } else { - this._sizes[index * 3] = sizeScalingX; - this._sizes[index * 3 + 2] = sizeScalingZ; - } - } - _vec3[0] = (fromPositionX + toPositionX) / 2; - _vec3[1] = (fromPositionY + toPositionY) / 2; - _vec3[2] = (fromPositionZ + toPositionZ) / 2; - this._positions[index * 3] = _vec3[0]; - this._positions[index * 3 + 1] = _vec3[1]; - this._positions[index * 3 + 2] = _vec3[2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const endMinColor = options.endMinColor === undefined ? 0 : options.endMinColor; - const endMaxColor = options.endMaxColor === undefined ? 1 : options.endMaxColor; - const lineMinColor = options.lineMinColor === undefined ? 0 : options.lineMinColor; - const lineMaxColor = options.lineMaxColor === undefined ? 1 : options.lineMaxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - let size; - if (options.endColors) { - size = 1 / (endMaxColor - endMinColor + 1); - const fromColor = (0, _mathJs.MathHelper).normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - const toColor = (0, _mathJs.MathHelper).normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, fromColor, toColor); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else if (options.lineColors) { - size = 1 / (lineMaxColor - lineMinColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.lineColors[id], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Odry":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PythagorasTree", ()=>PythagorasTree); -parcelHelpers.export(exports, "Tree", ()=>Tree); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class PythagorasTree extends (0, _layoutJs.LayoutBase) { - get levels() { - return this._levels; - } - get maxLevel() { - return this._maxLevel; - } - get volumes() { - return this._volumes; - } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentTranslation = (0, _glMatrix.vec3).create(); - this._parentScale = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - } - static calculateTotalVertices(level) { - return (2 << level) - 1; - } - static calculateMaxLevel(vertices) { - return Math.ceil(Math.log2(vertices + 1)) - 1; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const scalingX = options.scalingX === undefined ? 1 : options.scalingX; - const scalingY = options.scalingY === undefined ? 1 : options.scalingY; - const scalingZ = options.scalingZ === undefined ? 1 : options.scalingZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._levels = new Uint32Array(buffer.length); - this._volumes = new Float64Array(buffer.length); - } - this._maxLevel = PythagorasTree.calculateMaxLevel(ids.length); - const lookup = buffer.lookup; - const id = ids[0]; - const index = lookup[id]; - this._levels[index] = 0; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3] = scalingX; - this._sizes[index * 3 + 1] = scalingY; - this._sizes[index * 3 + 2] = scalingZ; - this._volumes[index] = scalingX * scalingY * scalingZ; - this._count = 1; - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(index, ids, lookup, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentIndex, ids, lookup, pseudoRandom) { - const parentLevel = this._levels[parentIndex]; - if (parentLevel < this._maxLevel && this._count < ids.length) { - let angle = this._angle + (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - this._parentTranslation[0] = this._positions[parentIndex * 3]; - this._parentTranslation[1] = this._positions[parentIndex * 3 + 1]; - this._parentTranslation[2] = this._positions[parentIndex * 3 + 2]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - this._parentScale[0] = this._sizes[parentIndex * 3]; - this._parentScale[1] = this._sizes[parentIndex * 3 + 1]; - this._parentScale[2] = this._sizes[parentIndex * 3 + 2]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - const childId1 = ids[this._count++]; - const childIndex1 = lookup[childId1]; - let cos = Math.cos(angle); - this._sizes[childIndex1 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex1 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex1 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex1 * 4] = this._childRotation[0]; - this._rotations[childIndex1 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex1 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex1 * 4 + 3] = this._childRotation[3]; - const halfparentScaleX = this._parentScale[0] * 0.5; - const halfparentScaleY = this._parentScale[1] * 0.5; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos + this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos + this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos + this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY - this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY - this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY - this._parentRight[2] * halfparentScaleX; - this._positions[childIndex1 * 3] = childTranslationX; - this._positions[childIndex1 * 3 + 1] = childTranslationY; - this._positions[childIndex1 * 3 + 2] = childTranslationZ; - this._levels[childIndex1] = parentLevel + 1; - this._volumes[childIndex1] = this._sizes[childIndex1 * 3] * this._sizes[childIndex1 * 3 + 1] * this._sizes[childIndex1 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (this._count < ids.length) { - const childId2 = ids[this._count++]; - const childIndex2 = lookup[childId2]; - cos = Math.cos((0, _constantsJs.Constants).PI_OVER_TWO - angle); - this._sizes[childIndex2 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex2 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex2 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle - (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex2 * 4] = this._childRotation[0]; - this._rotations[childIndex2 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex2 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex2 * 4 + 3] = this._childRotation[3]; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos - this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos - this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos - this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY + this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY + this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY + this._parentRight[2] * halfparentScaleX; - this._positions[childIndex2 * 3] = childTranslationX; - this._positions[childIndex2 * 3 + 1] = childTranslationY; - this._positions[childIndex2 * 3 + 2] = childTranslationZ; - this._levels[childIndex2] = parentLevel + 1; - this._volumes[childIndex2] = this._sizes[childIndex2 * 3] * this._sizes[childIndex2 * 3 + 1] * this._sizes[childIndex2 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - this._branch(childIndex1, ids, lookup, pseudoRandom); - this._branch(childIndex2, ids, lookup, pseudoRandom); - } - } + update(elapsedTime) { } -} -class Tree extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; + constructor(image2) { + this.image = image2; } - getPositionY(index) { - return this._positions[index * 3 + 1]; + }; + let ImageBase$1 = class ImageBase { + get material() { + return this._material; } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + get vertices() { + return this._vertices; } - getSizeX(index) { - return this._sizes[index * 3]; + get indices() { + return this._indices; } - getSizeY(index) { - return this._sizes[index * 3 + 1]; + get indexCount() { + return this._indexCount; } - getSizeZ(index) { - return this._sizes[index * 3 + 2]; + get isInitialized() { + return this._isInitialized; } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); + get mMatrix() { + return this._mMatrix; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const rootId = options.rootId; - this._sizeX = options.sizeX === undefined ? 1 : options.sizeX; - this._sizeY = options.sizeY === undefined ? 1 : options.sizeY; - this._sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._lengthScaling = options.lengthScaling === undefined ? 1 : options.lengthScaling; - this._thicknessScaling = options.thicknessScaling === undefined ? 1 : options.thicknessScaling; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - this._randomSplit = options.randomSplit === undefined ? 0 : options.randomSplit; - this._randomLengthScaling = options.randomLengthScaling === undefined ? 0 : options.randomLengthScaling; - this._randomThicknessScaling = options.randomThicknessScaling === undefined ? 0 : options.randomThicknessScaling; - this._minLength = options.minLength === undefined ? 0 : options.minLength; - this._minThickness = options.minThickness === undefined ? 0 : options.minThickness; - this._lengthScalings = options.lengthScalings; - this._thicknessScalings = options.thicknessScalings; - this._splitAngles = options.splitAngles; - this._angles = options.angles; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._parentRights = new Float64Array(buffer.length * 3); - this._parentUps = new Float64Array(buffer.length * 3); - this._parentForwards = new Float64Array(buffer.length * 3); - this._parentTwists = new Float64Array(buffer.length * 4); - } - const lookup = buffer.lookup; - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - const parentId = options.parentIds[index]; - const childId = options.childIds[index]; - indices[childId] = index; - if (childId === rootId) children[rootId] = []; - else { - if (children[parentId] === undefined) children[parentId] = []; - children[parentId].push(childId); - } - } - const index = indices[rootId]; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3 + 1] = this._sizeY; - this._sizes[index * 3] = this._sizeX; - this._sizes[index * 3 + 2] = this._sizeZ; - if (this._lengthScalings) { - this._lengthScaling = this._lengthScalings[index]; - this._sizes[index * 3 + 1] *= this._lengthScaling; - } - if (this._thicknessScalings) { - this._thicknessScaling = this._thicknessScalings[index]; - this._sizes[index * 3] *= this._thicknessScaling; - this._sizes[index * 3 + 2] *= this._thicknessScaling; - } - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(rootId, indices, children, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentId, indices, children, pseudoRandom) { - const childIds = children[parentId]; - const parentIndex = indices[parentId]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - this._parentUps[parentIndex * 3] = this._parentUp[0]; - this._parentUps[parentIndex * 3 + 1] = this._parentUp[1]; - this._parentUps[parentIndex * 3 + 2] = this._parentUp[2]; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - this._parentTwists[parentIndex * 4] = this._parentTwist[0]; - this._parentTwists[parentIndex * 4 + 1] = this._parentTwist[1]; - this._parentTwists[parentIndex * 4 + 2] = this._parentTwist[2]; - this._parentTwists[parentIndex * 4 + 3] = this._parentTwist[3]; - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - this._parentRights[parentIndex * 3] = this._parentRight[0]; - this._parentRights[parentIndex * 3 + 1] = this._parentRight[1]; - this._parentRights[parentIndex * 3 + 2] = this._parentRight[2]; - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - this._parentForwards[parentIndex * 3] = this._parentForward[0]; - this._parentForwards[parentIndex * 3 + 1] = this._parentForward[1]; - this._parentForwards[parentIndex * 3 + 2] = this._parentForward[2]; - for(let i = 0; i < childIds.length; i++){ - const childId = childIds[i]; - const childIndex = indices[childId]; - const parentScaleX = this._sizes[parentIndex * 3]; - const parentScaleY = this._sizes[parentIndex * 3 + 1]; - const parentScaleZ = this._sizes[parentIndex * 3 + 2]; - this._parentUp[0] = this._parentUps[parentIndex * 3]; - this._parentUp[1] = this._parentUps[parentIndex * 3 + 1]; - this._parentUp[2] = this._parentUps[parentIndex * 3 + 2]; - this._parentTwist[0] = this._parentTwists[parentIndex * 4]; - this._parentTwist[1] = this._parentTwists[parentIndex * 4 + 1]; - this._parentTwist[2] = this._parentTwists[parentIndex * 4 + 2]; - this._parentTwist[3] = this._parentTwists[parentIndex * 4 + 3]; - if (this._lengthScalings) { - const lengthScale = this._lengthScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(this._sizeY * lengthScale, this._minLength); - } else { - const lengthScale = this._lengthScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(parentScaleY * lengthScale, this._minLength); - } - if (this._thicknessScalings) { - const thicknessScale = this._thicknessScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(this._sizeX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(this._sizeZ * thicknessScale, this._minThickness); - } else { - const thicknessScale = this._thicknessScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(parentScaleX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(parentScaleZ * thicknessScale, this._minThickness); - } - let split; - if (this._splitAngles) split = this._splitAngles[childIndex]; - else split = (0, _constantsJs.Constants).TWO_PI * i / childIds.length; - split += (pseudoRandom.nextFloat() * 2 - 1) * this._randomSplit; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, split); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - let angle; - if (this._angles) angle = this._angles[childIndex]; - else angle = this._angle; - angle += (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._childRotation, this._quat); - this._rotations[childIndex * 4] = this._childRotation[0]; - this._rotations[childIndex * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex * 4 + 3] = this._childRotation[3]; - const halfParentScaleY = parentScaleY * 0.5; - const halfChildScaleY = this._sizes[childIndex * 3 + 1] * 0.5; - (0, _glMatrix.vec3).transformQuat(this._vec3, (0, _constantsJs.Constants).VECTOR3_UNITY, this._childRotation); - const childTranslationX = this._positions[parentIndex * 3] + this._parentUp[0] * halfParentScaleY + this._vec3[0] * halfChildScaleY; - const childTranslationY = this._positions[parentIndex * 3 + 1] + this._parentUp[1] * halfParentScaleY + this._vec3[1] * halfChildScaleY; - const childTranslationZ = this._positions[parentIndex * 3 + 2] + this._parentUp[2] * halfParentScaleY + this._vec3[2] * halfChildScaleY; - this._positions[childIndex * 3] = childTranslationX; - this._positions[childIndex * 3 + 1] = childTranslationY; - this._positions[childIndex * 3 + 2] = childTranslationZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (children[childId]) this._branch(childId, indices, children, pseudoRandom); - } - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/angle.js":"53hwW","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fGQjs":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sheet", ()=>Sheet); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Sheet extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.sqrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / side); - const x = i - y * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = 0; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1HzJp":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>SquarifiedTreeMap); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>CubifiedTreeMap); -parcelHelpers.export(exports, "TreeMapHelper", ()=>TreeMapHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class SquarifiedTreeMap extends (0, _layoutJs.LayoutBase) { - get positionsX() { - return this._positionsX; + get imageData() { + return this._imageData; } - get positionsY() { - return this._positionsY; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._hasChanged = true; + } } - get sizesX() { - return this._sizesX; + get rotation() { + return this._rotation; } - get sizesY() { - return this._sizesY; + set rotation(value2) { + if (!equals$1(this._rotation, value2)) { + copy$4(this._rotation, value2); + this._hasChanged = true; + } } - layout(buffer, ids, options) { - const start = window.performance.now(); - const size = options.size == undefined ? 1 : options.size; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } else if (size <= 0) return; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - } - TreeMapHelper.squarifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, sizeX, sizeY, buffer.lookup); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const heights = options.heights; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - let maxHeight; - if (heights) { - maxHeight = 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - maxHeight = Math.max(heights[id], maxHeight); - } - } else maxHeight = 1; - const heightScaling = (this.maxLayoutBoundsZ - this.minLayoutBoundsZ) / maxHeight; - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(heights ? heights[id] * heightScaling : heightScaling, minHeight); - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this.minLayoutBoundsZ + height / 2; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = height * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class CubifiedTreeMap extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - const sizeZ = this.maxLayoutBoundsZ - this.minLayoutBoundsZ; - const minHeight = this._core.config.minCubifiedTreeMapSlice / sizeY; - const side = Math.sqrt(sizeX * sizeZ); - const total = options.sizes ? TreeMapHelper.totalSize(ids, options.sizes, offset, offset + count - 1) : count; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - } - TreeMapHelper.cubifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, this.minLayoutBoundsZ, sizeX, sizeY, sizeZ, side, total, minHeight, isTopToBottom, buffer.lookup); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TreeMapHelper { - static squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - if (from > to) return; - if (to - from < 2) { - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup); - return; - } - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - const a = sizes ? sizes[ids[to]] / totalSize : 1 / totalSize; - let b = a; - let mid = to; - if (width < height) { - while(mid > from){ - const aspect = TreeMapHelper._aspect(height, width, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(height, width, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width, height * b, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x, y + height * b, width, height * (1 - b), lookup); - } else { - while(mid > from){ - const aspect = TreeMapHelper._aspect(width, height, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(width, height, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width * b, height, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x + width * b, y, width * (1 - b), height, lookup); - } + get position() { + return this._position; } - static totalSize(ids, sizes, from, to) { - let size = 0; - for(let i = from; i <= to; i++)size += sizes[ids[i]]; - return size; + set position(value2) { + if (!equals$2(this._position, value2)) { + copy$6(this._position, value2); + this._hasChanged = true; + } } - static _sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - let a = 0; - for(let i = to; i >= from; i--){ - const id = ids[i]; - const index = lookup[id]; - const b = sizes ? sizes[id] / totalSize : 1 / totalSize; - if (width > height) { - sizesY[index] = height; - sizesX[index] = width * b; - positionsY[index] = y + height / 2; - positionsX[index] = x + width * a + width * b / 2; - } else { - sizesX[index] = width; - sizesY[index] = height * b; - positionsX[index] = x + width / 2; - positionsY[index] = y + height * a + height * b / 2; - } - a += b; - } - } - static _aspect(big, small, a, b) { - const x = big * b / (small * a / b); - if (x < 1) return 1 / x; - return x; - } - static cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, to, x, y, z, width, height, depth, side, total, minHeight, isTopToBottom, lookup) { - if (from > to) return; - let sliceHeight = 0; - let sliceTotal = 0; - let previousAspect = 0; - let mid = to; - while(mid >= from){ - const itemSize = sizes ? sizes[ids[mid]] : 1; - sliceTotal += itemSize; - sliceHeight = height * sliceTotal / total; - const remainingHeight = height - sliceHeight; - if (remainingHeight < minHeight) { - mid = from; - const totalSize = sizes ? this.totalSize(ids, sizes, mid, to) : to - from + 1; - sliceHeight = height * totalSize / total; - break; - } - const itemSide = Math.sqrt(itemSize / sliceTotal) * side; - const aspect = itemSide > sliceHeight ? sliceHeight / itemSide : itemSide / sliceHeight; - if (aspect < previousAspect || mid == from) break; - previousAspect = aspect; - mid--; - } - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsZ, sizesX, sizesZ, mid, to, x, z, width, depth, lookup); - for(let j = mid; j <= to; j++){ - const id = ids[j]; - const index = lookup[id]; - sizesY[index] = Math.max(sliceHeight, 0.01); - positionsY[index] = isTopToBottom ? positionsY[index] = y + sliceHeight / 2 : y + height - sliceHeight / 2; - } - TreeMapHelper.cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, mid - 1, x, isTopToBottom ? y + sliceHeight : y, z, width, height - sliceHeight, depth, side, total - sliceTotal, minHeight, isTopToBottom, lookup); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8244":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "StackBase", ()=>StackBase); -parcelHelpers.export(exports, "Stack", ()=>Stack); -parcelHelpers.export(exports, "StackTreeMap", ()=>StackTreeMap); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _vertexJs = require("../vertex.js"); -var _treemapJs = require("./treemap.js"); -var _layoutJs = require("./layout.js"); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -class StackBase extends (0, _layoutJs.LayoutBase) { - get maxCount() { - return this._maxCount; - } - get levels() { - return this._levels; - } - get binCounts() { - return this._binCounts; - } - getPositionX(index) { - return this._positionsX[index]; - } - getPositionY(index) { - return this._positionsY[index]; - } - getPositionZ(index) { - return this._positionsZ[index]; - } -} -class Stack extends StackBase { - get maxLevel() { - return this._maxLevel; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - this._maxLevel = 0; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - this._height = options.height == undefined ? 1 : options.height; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._levels = new Uint32Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinLevel = 0; - let positionX, positionY, positionZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - const binCount = this._binCounts[binId]; - const level = Math.floor(binCount / sizeX / sizeZ); - this._levels[index] = level; - const levelCount = binCount - level * sizeX * sizeZ; - const itemZ = Math.floor(levelCount / sizeX); - const itemX = levelCount - itemZ * sizeX; - positionX = spacingX / 2 + binIdX * (sizeX + spacingX) + itemX + 0.5; - positionY = this._height * (level + 0.5); - positionZ = spacingZ / 2 + binIdZ * (sizeZ + spacingZ) + itemZ + 0.5; - this._positionsX[index] = positionX; - this._positionsY[index] = positionY; - this._positionsZ[index] = positionZ; - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - maxBinLevel = Math.max(maxBinLevel, level); - } - this._maxLevel = maxBinLevel + 1; - this._maxCount = maxBinCount; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = this._maxLevel * this._height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 - padding : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (this._height - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class StackTreeMap extends StackBase { - get maxTotal() { - return this._maxTotal; - } - get binGroupIds() { - return this._binGroupIds; - } - getSizeX(index) { - return this._sizesX[index]; - } - getSizeY(index) { - return this._sizesY[index]; - } - getSizeZ(index) { - return this._sizesZ[index]; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const isNormalized = options.isNormalized === undefined ? false : options.isNormalized; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const maxHeight = options.maxHeight === undefined ? 0 : options.maxHeight; - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - this._binIds = new Uint32Array(buffer.length); - this._binGroupIds = new Float64Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - this._binTotals = new Float64Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinTotal = 0; - let height; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - this._binIds[index] = binId; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - this._binTotals[binId] += options.sizes ? options.sizes[id] : 1; - maxBinTotal = Math.max(maxBinTotal, this._binTotals[binId]); - } - if (maxHeight - minHeight > 0) height = maxHeight - minHeight; - else height = Math.ceil(maxBinCount / sizeX / sizeZ); - if (!this._orderedIds || this._orderedIds.length < buffer.length) this._orderedIds = new Uint32Array(buffer.length); - let ids2; - if (options.groupIds || options.sizes) { - if (count == ids.length) this._ids = new Uint32Array(ids); - else { - this._ids = new Uint32Array(count); - for(let i = 0; i < count; i++)this._ids[i] = ids[offset + i]; - } - if (options.groupIds && options.sizes) { - this._ids.sort(function(a, b) { - return options.groupIds[a] == options.groupIds[b] ? options.sizes[a] - options.sizes[b] : options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.groupIds) { - this._ids.sort(function(a, b) { - return options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.sizes) { - this._ids.sort(function(a, b) { - return options.sizes[a] - options.sizes[b]; - }); - ids2 = this._ids; - } - } else ids2 = ids; - const binOffsets = new Uint32Array(this._binCounts.length); - let binOffset = 0; - for(let i = 0; i < this._binCounts.length; i++){ - const binCount = this._binCounts[i]; - binOffsets[i] = binOffset; - binOffset += binCount; - } - for(let i = 0; i < count; i++){ - const id = ids2[i]; - const index = lookup[id]; - const binId = this._binIds[index]; - binOffset = binOffsets[binId]++; - this._orderedIds[binOffset + offset] = id; - } - const minSliceHeight = this._core.config.minCubifiedTreeMapSlice * height; - const side = Math.sqrt(sizeX * sizeZ); - let from = offset; - let isLastInGroup = false; - let isLastInBin = false; - let groupCount = 0; - let groupTotal = 0; - let positionY = 0; - for(let i = 0; i < count; i++){ - const id = this._orderedIds[i + offset]; - const index = lookup[id]; - groupCount++; - groupTotal += options.sizes ? options.sizes[id] : 1; - const binId = this._binIds[index]; - const groupId = options.groupIds ? options.groupIds[id] : 0; - if (i == count - 1) { - isLastInBin = true; - isLastInGroup = true; - } else { - const nextId = this._orderedIds[i + 1 + offset]; - const nextIndex = lookup[nextId]; - const nextBinId = this._binIds[nextIndex]; - const nextGroupId = options.groupIds ? options.groupIds[nextId] : 0; - isLastInBin = binId != nextBinId; - isLastInGroup = groupId != nextGroupId; - } - if (isLastInBin || isLastInGroup) { - const mid = i + offset; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - let groupValue, binValue; - if (options.sizes) { - groupValue = groupTotal; - binValue = isNormalized ? this._binTotals[binId] : maxBinTotal; - } else { - groupValue = groupCount; - binValue = isNormalized ? this._binCounts[binId] : maxBinCount; - } - const groupHeight = height * groupValue / binValue; - if (sizeZ == 1) { - const positionX = spacingX / 2 + binIdX * (sizeX + spacingX); - (0, _treemapJs.TreeMapHelper).squarifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, from, mid, positionX, positionY, sizeX, groupHeight, lookup); - const isRightToLeft = true; - for(let i = from; i <= mid; i++){ - const id = this._orderedIds[i]; - const index = lookup[id]; - this._sizesZ[index] = sizeZ; - this._positionsZ[index] = (binIdZ + 0.5) * (sizeZ + spacingZ); - if (isRightToLeft) this._positionsX[index] = positionX + sizeX - this._positionsX[index] + positionX; - if (!isTopToBottom) this._positionsY[index] = positionY + groupHeight - this._positionsY[index] + positionY; - } - } else (0, _treemapJs.TreeMapHelper).cubifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, from, mid, spacingX / 2 + binIdX * (sizeX + spacingX), positionY, spacingZ / 2 + binIdZ * (sizeZ + spacingZ), sizeX, groupHeight, sizeZ, side, groupValue, minSliceHeight, isTopToBottom, lookup); - if (isLastInGroup) { - isLastInGroup = false; - positionY += groupHeight; - } - if (isLastInBin) { - isLastInBin = false; - positionY = 0; - } - groupCount = 0; - groupTotal = 0; - from = mid + 1; - } - } - this._maxCount = maxBinCount; - this._maxTotal = maxBinTotal; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"../constants.js":"lD0bG","../helpers/math.js":"f65d0","../vertex.js":"4J2YE","./treemap.js":"1HzJp","./layout.js":"kYBiT","gl-matrix":"5x28d","../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flmwt":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>(0, _keyboardJs.Keyboard)); -parcelHelpers.export(exports, "MouseWheel", ()=>(0, _mousewheelJs.MouseWheel)); -parcelHelpers.export(exports, "Pointers", ()=>(0, _pointersJs.Pointers)); -parcelHelpers.export(exports, "Manipulator", ()=>(0, _manipulatorJs.Manipulator)); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>(0, _manipulationprocessorJs.ManipulationProcessor)); -parcelHelpers.export(exports, "Manager", ()=>(0, _managerJs.Manager)); -var _keyboardJs = require("./keyboard.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _manipulatorJs = require("./manipulator.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _managerJs = require("./manager.js"); - -},{"./keyboard.js":"fXys0","./mousewheel.js":"dfHmP","./pointers.js":"7LFJO","./manipulator.js":"bYqKJ","./manipulationprocessor.js":"20HDq","./manager.js":"8nDg6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hACG3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>(0, _fileJs.LocalFile)); -parcelHelpers.export(exports, "XmlHttp", ()=>(0, _xmlHttpJs.XmlHttp)); -var _fileJs = require("./file.js"); -var _xmlHttpJs = require("./xmlHttp.js"); - -},{"./file.js":"kwLAM","./xmlHttp.js":"49880","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwLAM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>LocalFile); -class LocalFile { - constructor(core){} - loadText(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - completed(text); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsText(file); + get texCoord0() { + return this._texCoord0; } - loadImage(file, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - image.src = text; - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsDataURL(file); + set texCoord0(value2) { + if (!equals(this._texCoord0, value2)) { + copy$3(this._texCoord0, value2); + this._hasChanged = true; + } } - loadArrayBuffer(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const arrayBuffer = event.target.result; - completed(arrayBuffer); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsArrayBuffer(file); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49880":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "XmlHttp", ()=>XmlHttp); -class XmlHttp { - constructor(core){} - loadText(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.responseText); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } - loadImage(url, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - image.src = url; - } - loadArrayBuffer(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.responseType = "arraybuffer"; - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.response); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6XXZT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>(0, _quadJs.Quad)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Sphere", ()=>(0, _sphereJs.Sphere)); -var _quadJs = require("./quad.js"); -var _cubeJs = require("./cube.js"); -var _sphereJs = require("./sphere.js"); - -},{"./quad.js":"3PqJr","./cube.js":"79I5N","./sphere.js":"aj6T2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1IHvF":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererBase", ()=>(0, _rendererJs.RendererBase)); -parcelHelpers.export(exports, "Basic", ()=>_indexJs); -parcelHelpers.export(exports, "Advanced", ()=>_indexJs1); -parcelHelpers.export(exports, "RayTraceWebGPU", ()=>_indexJs2); -var _rendererJs = require("./renderer.js"); -var _indexJs = require("./basic/index.js"); -var _indexJs1 = require("./advanced/index.js"); -var _indexJs2 = require("./raytracewebgpu/index.js"); - -},{"./renderer.js":"8zmPQ","./basic/index.js":"fYCHg","./advanced/index.js":"gKCQy","./raytracewebgpu/index.js":"2SNte","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8zmPQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererConfig", ()=>RendererConfig); -parcelHelpers.export(exports, "RendererBase", ()=>RendererBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _axesJs = require("../components/axes/axes.js"); -var _bufferJs = require("../buffer.js"); -var _vertexJs = require("../vertex.js"); -var _labelsJs = require("../components/labels.js"); -var _debugJs = require("../components/debug.js"); -var _controllerJs = require("../components/controller.js"); -var _imageJs = require("../components/image.js"); -var _fontJs = require("../font.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + get texCoord1() { + return this._texCoord1; } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class RendererConfig { - reset() {} -} -class RendererBase { - get isInitialized() { - return this._isInitialized; + set texCoord1(value2) { + if (!equals(this._texCoord1, value2)) { + copy$3(this._texCoord1, value2); + this._hasChanged = true; + } } - get config() { - return this._config; + get minBoundsX() { + return this._minBoundsX; } - get devicePixelRatio() { - return this._devicePixelRatio; + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - get width() { - return this._canvas.width; + get minBoundsY() { + return this._minBoundsY; } - set width(value) { - this._options.width = value; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - get height() { - return this._canvas.height; + get minBoundsZ() { + return this._minBoundsZ; } - set height(value) { - this._options.height = value; + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - get webXRReferenceSpace() { - return this._webXRReferenceSpace; + get maxBoundsX() { + return this._maxBoundsX; } - get pickedType() { - return this._pickedType; + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - get pickedId() { - return this._pickedId; + get maxBoundsY() { + return this._maxBoundsY; } - get isCapturingPickImage() { - return this._isCapturingPickImage; + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - capturePickImage() { - this._isCapturingPickImage = true; + get maxBoundsZ() { + return this._maxBoundsZ; } - get backgroundColor() { - return this._backgroundColor; + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - set backgroundColor(value) { - if (!(0, _glMatrix.vec4).exactEquals(value, this._backgroundColor)) this._backgroundColor = value; + constructor(core, options2) { + this._core = core; + this._mMatrix = create$7(); + this._origin = create$6(); + this._translation = create$6(); + this._scale = create$6(); + this._transform = create$7(); + this._imageData = options2.imageData; + this._minBoundsX = options2.minBoundsX === void 0 ? 0 : options2.minBoundsX; + this._minBoundsY = options2.minBoundsY === void 0 ? 0 : options2.minBoundsY; + this._minBoundsZ = options2.minBoundsZ === void 0 ? 0 : options2.minBoundsZ; + this._maxBoundsX = options2.maxBoundsX === void 0 ? 1 : options2.maxBoundsX; + this._maxBoundsY = options2.maxBoundsY === void 0 ? 1 : options2.maxBoundsY; + this._maxBoundsZ = options2.maxBoundsZ === void 0 ? 1 : options2.maxBoundsZ; + this._position = options2.position ? clone$4(options2.position) : create$6(); + this._rotation = options2.rotation ? clone$2(options2.rotation) : create$4(); + this._texCoord0 = options2.texCoord0 ? clone$1(options2.texCoord0) : fromValues(0, 0); + this._texCoord1 = options2.texCoord1 ? clone$1(options2.texCoord1) : fromValues(1, 1); + this._material = options2.material === void 0 ? -1 : options2.material; + this._hasChanged = true; } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + }; + class ImageQuad extends ImageBase$1 { + get width() { + return this._width; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set width(value2) { + if (this._width != value2) { + this._width = value2; + this._hasChanged = true; + } } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + get height() { + return this._height; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set height(value2) { + if (this._height != value2) { + this._height = value2; + this._hasChanged = true; + } } - swapAxes() { - this._isAxes1Current = !this._isAxes1Current; + constructor(core, options2) { + super(core, options2); + this._width = options2.width === void 0 ? 1 : options2.width; + this._height = options2.height === void 0 ? 1 : options2.height; + this._texTransform = create$7(); + translate$2(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); + scale$6(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); } - createCartesian2dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + initialize() { + this._vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); + this._indices = Quad$3.INDICES; + this._indexCount = this._indices.length; + this._isInitialized = true; } - createCartesian3dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + set$8(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); + subtract(this._translation, this._position, this._origin); + scale$5(this._translation, this._translation, boundsScaling); + set$8(this._scale, this._width, this._height, 1); + scale$5(this._scale, this._scale, boundsScaling); + fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); + this._verticesView = Quad$3.normalTextured(this._transform, this._texTransform); + this._vertices = this._verticesView.buffer; + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + } } - _createDebugAxesVisual(debugAxes) { - return null; + } + class BoundsHelper { + static rotateBounds(minBounds, maxBounds, rotation2, rotatedMinBounds, rotatedMaxBounds, offset2) { + const sizeX = maxBounds[0] - minBounds[0]; + const sizeY = maxBounds[1] - minBounds[1]; + const sizeZ = maxBounds[2] - minBounds[2]; + const min2 = rotatedMinBounds; + const max2 = rotatedMaxBounds; + set$8(min2, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$8(max2, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const vertices = Cube.POSITIONS; + const position2 = create$6(); + for (let i = 0; i < 8; i++) { + set$8(position2, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); + add$4(position2, position2, offset2); + transformQuat(position2, position2, rotation2); + subtract(position2, position2, offset2); + min$3(min2, min2, position2); + max$3(max2, max2, position2); + } + add$4(position2, minBounds, maxBounds); + scale$5(position2, position2, 0.5); + add$4(min2, min2, position2); + add$4(max2, max2, position2); + } + static cylinder(pa2, pb, radius2, minBounds, maxBounds) { + const a2 = create$6(); + subtract(a2, pb, pa2); + const aa = dot$1(a2, a2); + const ex = radius2 * Math.sqrt(1 - a2[0] * a2[0] / aa); + const ey = radius2 * Math.sqrt(1 - a2[1] * a2[1] / aa); + const ez = radius2 * Math.sqrt(1 - a2[2] * a2[2] / aa); + minBounds[0] = Math.min(pa2[0] - ex, pb[0] - ex); + minBounds[1] = Math.min(pa2[1] - ey, pb[1] - ey); + minBounds[2] = Math.min(pa2[2] - ez, pb[2] - ez); + maxBounds[0] = Math.max(pa2[0] + ex, pb[0] + ex); + maxBounds[1] = Math.max(pa2[1] + ey, pb[1] + ey); + maxBounds[2] = Math.max(pa2[2] + ez, pb[2] + ez); } - createLabelSetVisual(labelSet) { - return new (0, _labelsJs.LabelSetVisual)(labelSet); + } + class LayoutBase { + get facetScaling() { + return this._facetScaling; } - createControllerVisual(controller) { - return new (0, _controllerJs.ControllerVisual)(controller); + offsetX(facetCoordX) { + return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; } - createTransitionBuffer(ids) { - return new (0, _bufferJs.TransitionBuffer)(this._core, ids); + offsetY(facetCoordY) { + return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; } - createImageVisual(image) { - return new (0, _imageJs.ImageVisual)(image); + offsetZ(facetCoordZ) { + return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; + } + constructor(core) { + this._core = core; + this.modelOriginX = 0; + this.modelOriginY = 0; + this.modelOriginZ = 0; + this.minModelBoundsX = 0; + this.minModelBoundsY = 0; + this.minModelBoundsZ = 0; + this.maxModelBoundsX = 0; + this.maxModelBoundsY = 0; + this.maxModelBoundsZ = 0; + this.minLayoutBoundsX = 0; + this.minLayoutBoundsY = 0; + this.minLayoutBoundsZ = 0; + this.maxLayoutBoundsX = 0; + this.maxLayoutBoundsY = 0; + this.maxLayoutBoundsZ = 0; + this._facetSpacingX = 0; + this._facetSpacingY = 0; + this._facetSpacingZ = 0; + this._facetSizeX = 0; + this._facetSizeY = 0; + this._facetSizeZ = 0; + this._facetsX = 1; + this._facetsY = 1; + this._facetsZ = 1; + } + _updateModelBounds(options2) { + this.minModelBoundsX = options2.minBoundsX === void 0 ? this.minLayoutBoundsX : options2.minBoundsX; + this.minModelBoundsY = options2.minBoundsY === void 0 ? this.minLayoutBoundsY : options2.minBoundsY; + this.minModelBoundsZ = options2.minBoundsZ === void 0 ? this.minLayoutBoundsZ : options2.minBoundsZ; + this.maxModelBoundsX = options2.maxBoundsX === void 0 ? this.maxLayoutBoundsX : options2.maxBoundsX; + this.maxModelBoundsY = options2.maxBoundsY === void 0 ? this.maxLayoutBoundsY : options2.maxBoundsY; + this.maxModelBoundsZ = options2.maxBoundsZ === void 0 ? this.maxLayoutBoundsZ : options2.maxBoundsZ; + this._isFacetted = options2.facetsX !== void 0 && options2.facetsX > 1 && options2.facetCoordsX != null || options2.facetsY !== void 0 && options2.facetsY > 1 && options2.facetCoordsY != null || options2.facetsZ !== void 0 && options2.facetsZ > 1 && options2.facetCoordsZ != null; + this._facetSpacingX = options2.facetSpacingX === void 0 ? 0 : options2.facetSpacingX; + this._facetSpacingY = options2.facetSpacingY === void 0 ? 0 : options2.facetSpacingY; + this._facetSpacingZ = options2.facetSpacingZ === void 0 ? 0 : options2.facetSpacingZ; + let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._facetSizeX = modelSizeX; + this._facetSizeY = modelSizeY; + this._facetSizeZ = modelSizeZ; + this._facetsX = options2.facetCoordsX ? options2.facetsX : 1; + this._facetsY = options2.facetCoordsY ? options2.facetsY : 1; + this._facetsZ = options2.facetCoordsZ ? options2.facetsZ : 1; + this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; + this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; + this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; + this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); + this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); + this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); + this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; + this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; + this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; + modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; + this._facetScaling = maxBounds / this._maxBounds; } - createFontVisual(font) { - return new (0, _fontJs.FontVisual)(font); + resetCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = void 0; + this.minCumulativeLayoutBoundsY = void 0; + this.minCumulativeLayoutBoundsZ = void 0; + this.maxCumulativeLayoutBoundsX = void 0; + this.maxCumulativeLayoutBoundsY = void 0; + this.maxCumulativeLayoutBoundsZ = void 0; } - constructor(options){ - this._options = options; - this.fonts = {}; + _updateCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === void 0 ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); + this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === void 0 ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); + this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === void 0 ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); + this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === void 0 ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); + this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === void 0 ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); + this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === void 0 ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); } - get isWebXRSupported() { - return false; + unitToModelSize(unitSize) { + return unitSize / this._boundsScaling; } - initialize(core) { - this._core = core; - this._canvas = document.createElement("canvas"); - const contextmenu = this._options && this._options.contextmenu; - if (!contextmenu) this._canvas.addEventListener("contextmenu", (e)=>{ - e.preventDefault(); - }); - this._canvas.tabIndex = this._core.container.tabIndex; - this._canvas.style.display = "block"; - this._canvas.style.touchAction = "none"; - this._core.container.appendChild(this._canvas); - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this.pickPMatrix = (0, _glMatrix.mat4).create(); - this.axesVisibility = (0, _mainJs.AxesVisibility).current; - this._debugAxes = new (0, _debugJs.DebugAxes)(); - this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); - this.transitionTime = 1; - this.transitionBuffers = []; - this.areLabelsVisible = true; - this.labelSets = []; - this.controllers = []; - this.areImagesVisible = true; - this.images = []; - this._viewports = [ - new DOMRect(), - new DOMRect() - ]; - this.isPickingEnabled = false; - this._pickedType = (0, _mainJs.PickType).none; - this._pickedId = 0; - this._lassoMMatrix = (0, _glMatrix.mat4).create(); - this._lassoThickness = (0, _glMatrix.vec2).create(); - this._resizeMinimumDelay = -1; - this._previousResizeWidth = -1; - this._previousResizeHeight = -1; + unitToModelPositionX(unitPositionX) { + return this.unitToModelSize(unitPositionX) + this.modelOriginX; } - remove() { - this._core.container.removeChild(this._canvas); + unitToModelPositionY(unitPositionY) { + return this.unitToModelSize(unitPositionY) + this.modelOriginY; } - finalize() { - this._isInitialized = false; + unitToModelPositionZ(unitPositionZ) { + return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; } - setSize(elapsedTime) { - if (this._options && this._options.width && this._options.height) { - this._devicePixelRatio = 1; - this._resizeWidth = this._options.width; - this._resizeHeight = this._options.height; - } else { - this._devicePixelRatio = window.devicePixelRatio || 1; - this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; - this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; - } - if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { - this._previousResizeWidth = this._resizeWidth; - this._previousResizeHeight = this._resizeHeight; - this._isResizing = true; - this._resizeElapsedTime = elapsedTime; - } - if (this._isResizing) { - if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { - this._isResizing = false; - this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; - this._resize(this._resizeWidth, this._resizeHeight); - } else this._resizeElapsedTime += elapsedTime; - } - } - _resize(width, height) { - this._canvas.style.width = `${Math.floor(width / this._devicePixelRatio)}px`; - this._canvas.style.height = `${Math.floor(height / this._devicePixelRatio)}px`; - width = Math.floor(width); - height = Math.floor(height); - this._canvas.width = width; - this._canvas.height = height; + unitToModelPosition(unitPosition, modelPosition) { + modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); + modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); + modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); } - update(elapsedTime) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousPalette; - const current = transitionBuffer.currentPalette; - if (previous) previous.update(); - if (current) current.update(); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousAtlas; - const current = transitionBuffer.currentAtlas; - if (previous) previous.update(); - if (current) current.update(); - } - } - if (this._core.config.isDebugVisible) { - if (this._debugAxesVisual) { - this._debugAxesVisual.mMatrix = this.mMatrix; - this._debugAxesVisual.vMatrices = this.vMatrices; - this._debugAxesVisual.pMatrices = this.pMatrices; - this._debugAxesVisual.viewports = this._viewports; - this._debugAxesVisual.viewportOffset = this._viewportOffset; - this._debugAxesVisual.viewportCount = this._viewportCount; - } + modelToUnitSize(modelSize) { + return modelSize * this._boundsScaling; + } + modelToUnitPositionX(modelPositionX) { + return (modelPositionX - this.modelOriginX) * this._boundsScaling; + } + modelToUnitPositionY(modelPositionY) { + return (modelPositionY - this.modelOriginY) * this._boundsScaling; + } + modelToUnitPositionZ(modelPositionZ) { + return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + } + modelToUnitPosition(modelPosition, unitPosition) { + unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); + unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); + unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); + } + inclusiveUnitBounds(buffer, ids, unitType, offset2, count2, minBounds, maxBounds) { + set$8(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$8(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const unitScale = create$6(); + const unitRotation = create$4(); + const unitTranslation = create$6(); + const lookup2 = buffer.lookup; + const dataView = buffer.dataView; + let minBounds0; + let maxBounds0; + let minBounds1; + let maxBounds1; + switch (unitType) { + case UnitType.sphere: + case UnitType.sphereSdf: + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getScale(dataView, index2, unitScale); + const radius2 = unitScale[0] / 2; + minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius2); + minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius2); + minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius2); + maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius2); + maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius2); + maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius2); + } + break; + case UnitType.hexPrism: + case UnitType.hexPrismSdf: + case UnitType.block: + case UnitType.blockSdf: + minBounds0 = create$6(); + maxBounds0 = create$6(); + minBounds1 = create$6(); + maxBounds1 = create$6(); + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; + minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; + minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; + maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; + maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; + maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; + BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants$1.VECTOR3_ZERO); + min$3(minBounds, minBounds, minBounds1); + max$3(maxBounds, maxBounds, maxBounds1); + } + break; + case UnitType.cylinder: + case UnitType.cylinderSdf: + minBounds0 = create$6(); + maxBounds0 = create$6(); + const pa2 = create$6(); + const pb = create$6(); + const identityRotation = Constants$1.VECTOR3_UNITY; + let ca; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + const length2 = unitScale[1]; + const radius2 = Math.max(unitScale[0], unitScale[2]); + if (length2 != 0 && radius2 != 0) { + if (equals$1(unitRotation, Constants$1.QUAT_IDENTITY)) { + ca = identityRotation; + } else { + ca = create$6(); + transformQuat(ca, identityRotation, unitRotation); + } + scaleAndAdd(pa2, unitTranslation, ca, -length2 * 0.5); + scaleAndAdd(pb, unitTranslation, ca, length2 * 0.5); + BoundsHelper.cylinder(pa2, pb, radius2, minBounds0, maxBounds0); + min$3(minBounds, minBounds, minBounds0); + max$3(maxBounds, maxBounds, maxBounds0); + } + } + break; + } + } + } + class Scatter extends LayoutBase { + layout(buffer, ids, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const positionScalingX = options2.positionScalingX === void 0 ? 1 : options2.positionScalingX; + const positionScalingY = options2.positionScalingY === void 0 ? 1 : options2.positionScalingY; + const positionScalingZ = options2.positionScalingZ === void 0 ? 1 : options2.positionScalingZ; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = options2.positionsX ? options2.positionsX[id2] * positionScalingX : 0; + let positionY = options2.positionsY ? options2.positionsY[id2] * positionScalingY : 0; + let positionZ = options2.positionsZ ? options2.positionsZ[id2] * positionScalingZ : 0; + this._positions[index2 * 3] = positionX; + this._positions[index2 * 3 + 1] = positionY; + this._positions[index2 * 3 + 2] = positionZ; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const dataView = buffer.dataView; + const _vec2 = create$3(); + const _vec3 = create$6(); + const _vec4 = create$5(); + const _quat = create$4(); + const sizeScalingX = options2.sizeScaling === void 0 ? options2.sizeScalingX === void 0 ? 1 : options2.sizeScalingX : options2.sizeScaling; + const sizeScalingY = options2.sizeScaling === void 0 ? options2.sizeScalingY === void 0 ? 1 : options2.sizeScalingY : options2.sizeScaling; + const sizeScalingZ = options2.sizeScaling === void 0 ? options2.sizeScalingZ === void 0 ? 1 : options2.sizeScalingZ : options2.sizeScaling; + const sizesX = options2.sizes ? options2.sizes : options2.sizesX; + const sizesY = options2.sizes ? options2.sizes : options2.sizesY; + const sizesZ = options2.sizes ? options2.sizes : options2.sizesZ; + const minSize = options2.minSize === void 0 ? 0 : options2.minSize; + const minColor = options2.minColor === void 0 ? 0 : options2.minColor; + const maxColor = options2.maxColor === void 0 ? 1 : options2.maxColor; + const minOrder = options2.minOrder === void 0 ? 0 : options2.minOrder; + const maxOrder = options2.maxOrder === void 0 ? 1 : options2.maxOrder; + const orderReverse = options2.orderReverse === void 0 ? false : options2.orderReverse; + const minStaggerOrder = options2.minStaggerOrder === void 0 ? 0 : options2.minStaggerOrder; + const maxStaggerOrder = options2.maxStaggerOrder === void 0 ? 1 : options2.maxStaggerOrder; + const staggerOrderReverse = options2.staggerOrderReverse === void 0 ? false : options2.staggerOrderReverse; + const reverseX = options2.reverseX === void 0 ? false : options2.reverseX; + const reverseY = options2.reverseY === void 0 ? false : options2.reverseY; + const reverseZ = options2.reverseZ === void 0 ? false : options2.reverseZ; + this._updateModelBounds(options2); + if (options2.rotation) { + _quat[0] = options2.rotation[0]; + _quat[1] = options2.rotation[1]; + _quat[2] = options2.rotation[2]; + _quat[3] = options2.rotation[3]; + } else { + rotationTo(_quat, this._core.config.identityRotation, Constants$1.VECTOR3_UNITY); + } + if (options2.texCoord) { + _vec4[0] = options2.texCoord[0]; + _vec4[1] = options2.texCoord[1]; + _vec4[2] = options2.texCoord[2]; + _vec4[3] = options2.texCoord[3]; + } + const lookup2 = buffer.lookup; + const selection = options2.selected && options2.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options2.facetCoordsX ? options2.facetCoordsX[id2] : 0; + const facetY = options2.facetCoordsY ? options2.facetCoordsY[id2] : 0; + const facetZ = options2.facetCoordsZ ? options2.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id2]) : 1) * sizeScalingX, minSize) * this._boundsScaling; + _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id2]) : 1) * sizeScalingY, minSize) * this._boundsScaling; + _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id2]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + if (options2.rotations) { + _quat[0] = options2.rotations[id2 * 4]; + _quat[1] = options2.rotations[id2 * 4 + 1]; + _quat[2] = options2.rotations[id2 * 4 + 2]; + _quat[3] = options2.rotations[id2 * 4 + 3]; + UnitVertex.setRotation(dataView, index2, _quat); + } else { + UnitVertex.setRotation(dataView, index2, _quat); + } + if (options2.colors) { + const size = 1 / (maxColor - minColor + 1); + const color2 = MathHelper.normalize(options2.colors[id2], minColor, maxColor, size / 2, 1 - size / 2); + if (options2.colors1) { + const color1 = MathHelper.normalize(options2.colors1[id2], minColor, maxColor, size / 2, 1 - size / 2); + set$5(_vec2, color2, color1); + } else { + set$5(_vec2, color2, color2); + } + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants$1.VECTOR2_ONE); } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - this.labelSets[i].label.update(elapsedTime); - labelSetVisual.mMatrix = this.mMatrix; - labelSetVisual.vMatrices = this.vMatrices; - labelSetVisual.pMatrices = this.pMatrices; - labelSetVisual.isPickingEnabled = this.isPickingEnabled; - labelSetVisual.pickPMatrix = this.pickPMatrix; - labelSetVisual.pickVMatrix = this.pickVMatrix; - labelSetVisual.viewports = this._viewports; - labelSetVisual.viewportOffset = this._viewportOffset; - labelSetVisual.viewportCount = this._viewportCount; - labelSetVisual.update(elapsedTime); - } + UnitVertex.setIdHover(dataView, index2, options2.hover ? options2.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options2.selected.has(id2) ? 1 : -1 : 0); + if (options2.order !== void 0) { + const order = MathHelper.normalize(options2.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual && imageVisual.isVisible) { - const image = this.images[i].image; - image.update(elapsedTime); - imageVisual.mMatrix = this.mMatrix; - imageVisual.vMatrices = this.vMatrices; - imageVisual.pMatrices = this.pMatrices; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.pickPMatrix = this.pickPMatrix; - imageVisual.pickVMatrix = this.pickVMatrix; - imageVisual.viewports = this._viewports; - imageVisual.viewportOffset = this._viewportOffset; - imageVisual.viewportCount = this._viewportCount; - imageVisual.update(elapsedTime); - } + if (options2.staggerOrder !== void 0) { + _vec2[1] = options2.staggerOrder; + } else if (options2.staggerOrders) { + const stagger = MathHelper.normalize(options2.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options2.material ? options2.material : options2.materials ? options2.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options2.rounding ? options2.rounding * this._boundsScaling : options2.roundings ? options2.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setParameter1(dataView, index2, options2.parameter1 ? options2.parameter1 : options2.parameters1 ? options2.parameters1[id2] : 0); + UnitVertex.setParameter2(dataView, index2, options2.parameter2 ? options2.parameter2 : options2.parameters2 ? options2.parameters2[id2] : 0); + UnitVertex.setSdfBuffer(dataView, index2, options2.sdfBuffer ? options2.sdfBuffer : options2.sdfBuffers ? options2.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options2.sdfBorder ? options2.sdfBorder : options2.sdfBorders ? options2.sdfBorders[id2] : this._core.config.sdfBorder); + if (options2.texCoords) { + _vec4[0] = options2.texCoords[id2 * 4]; + _vec4[1] = options2.texCoords[id2 * 4 + 1]; + _vec4[2] = options2.texCoords[id2 * 4 + 2]; + _vec4[3] = options2.texCoords[id2 * 4 + 3]; + UnitVertex.setTexCoord(dataView, index2, _vec4); + } else { + UnitVertex.setTexCoord(dataView, index2, _vec4); + } + UnitVertex.setMatId(dataView, index2, options2.materialType ? options2.materialType : options2.materialTypes ? options2.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options2.materialColor ? options2.materialColor : options2.materialColors ? [options2.materialColors[id2 * 3], options2.materialColors[id2 * 3 + 1], options2.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options2.materialFuzz ? options2.materialFuzz : options2.materialFuzzes ? options2.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options2.materialGloss ? options2.materialGloss : options2.materialGlosses ? options2.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options2.materialDensity ? options2.materialDensity : options2.materialDensities ? options2.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options2.materialRefractiveIndex ? options2.materialRefractiveIndex : options2.materialRefractiveIndices ? options2.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options2.segmentColor ? options2.segmentColor : options2.segmentColors ? [options2.segmentColors[id2 * 4], options2.segmentColors[id2 * 4 + 1], options2.segmentColors[id2 * 4 + 2], options2.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + } + fromValues$3(0.2126, 0.7152, 0.0722); + create$6(); + create$6(); + class PathHelper { + static getFilenameWithoutExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") == -1 ? 0 : path2.lastIndexOf("/") + 1; + return path2.substring(start, dot2); + } + } + static getExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1 || dot2 == path2.length - 1) { + return null; + } else { + return path2.substring(dot2 + 1, path2.length); + } + } + static getFilename(path2) { + if (path2.lastIndexOf("/") == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") + 1; + return path2.substring(start, path2.length); + } + } + static getPath(path2) { + if (path2.lastIndexOf("/") == -1) { + return ""; + } else { + return path2.substring(0, path2.lastIndexOf("/")); + } + } + static combine(first, second2) { + const seperator = first.lastIndexOf("/") == first.length - 1; + if (second2.indexOf("/") == 0) { + if (seperator) { + return first.substring(0, first.length - 1) + second2; + } else { + return first + second2; } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - const controller = this.controllers[i].controller; - controller.update(elapsedTime); - controllerVisual.vMatrices = this.vMatrices; - controllerVisual.inverseVMatrices = this.vMatrices; - controllerVisual.pMatrices = this.pMatrices; - controllerVisual.viewports = this._viewports; - controllerVisual.viewportOffset = this._viewportOffset; - controllerVisual.viewportCount = this._viewportCount; - controllerVisual.update(elapsedTime); - } + } else { + if (seperator) { + return first + second2; + } else { + return first + "/" + second2; } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - const axes = axesVisual.axes; - axes.mMatrix = this.mMatrix; - axes.vMatrix = this.vMatrices[0]; - axes.update(elapsedTime); - axesVisual.vMatrices = this.vMatrices; - axesVisual.pMatrices = this.pMatrices; - axesVisual.isPickingEnabled = this.isPickingEnabled; - axesVisual.pickPMatrix = this.pickPMatrix; - axesVisual.pickVMatrix = this.pickVMatrix; - axesVisual.viewports = this._viewports; - axesVisual.viewportOffset = this._viewportOffset; - axesVisual.viewportCount = this._viewportCount; - axesVisual.update(elapsedTime); - } + } + } + } + class TextureHelper { + static create(gl, width2, height2, format2, type2, filter2, bytes, internalFormat = format2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width2, height2, 0, format2, type2, bytes); + return texture; + } + static fromImage(gl, image2, mipmaps, filter2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image2); + if (mipmaps && MathHelper.isPowerOf2(image2.width) && MathHelper.isPowerOf2(image2.height)) + gl.generateMipmap(gl.TEXTURE_2D); + else { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + } + gl.bindTexture(gl.TEXTURE_2D, null); + return texture; + } + static cubemapFromImages(gl, images) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + const targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (let i = 0; i < 6; i++) { + gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + return texture; + } + } + class Line extends LayoutBase { + layout(buffer, ids, fromIds, toIds, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const positionScalingX = options2.positionScalingX === void 0 ? 1 : options2.positionScalingX; + const positionScalingY = options2.positionScalingY === void 0 ? 1 : options2.positionScalingY; + const positionScalingZ = options2.positionScalingZ === void 0 ? 1 : options2.positionScalingZ; + const sizeScalingX = options2.sizeScaling === void 0 ? options2.sizeScalingX === void 0 ? 1 : options2.sizeScalingX : options2.sizeScaling; + const sizeScalingY = options2.sizeScaling === void 0 ? options2.sizeScalingY === void 0 ? 1 : options2.sizeScalingY : options2.sizeScaling; + const sizeScalingZ = options2.sizeScaling === void 0 ? options2.sizeScalingZ === void 0 ? 1 : options2.sizeScalingZ : options2.sizeScaling; + const minSize = options2.minSize === void 0 ? 0 : options2.minSize; + const offsetScaling = options2.offsetScaling === void 0 ? 1 : options2.offsetScaling; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + this._sizes = new Float32Array(buffer.length * 3); + this._rotations = new Float32Array(buffer.length * 4); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const _vec3 = create$6(); + const _quat = create$4(); + const direction = create$6(); + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let toPositionX = options2.positionsX ? options2.positionsX[toId] * positionScalingX : 0; + let toPositionY = options2.positionsY ? options2.positionsY[toId] * positionScalingY : 0; + let toPositionZ = options2.positionsZ ? options2.positionsZ[toId] * positionScalingZ : 0; + let fromPositionX = options2.positionsX ? options2.positionsX[fromId] * positionScalingX : 0; + let fromPositionY = options2.positionsY ? options2.positionsY[fromId] * positionScalingY : 0; + let fromPositionZ = options2.positionsZ ? options2.positionsZ[fromId] * positionScalingZ : 0; + if (fromId == toId) { + this._sizes[index2 * 3] = 0; + this._sizes[index2 * 3 + 1] = 0; + this._sizes[index2 * 3 + 2] = 0; + this._rotations[index2 * 4] = 0; + this._rotations[index2 * 4 + 1] = 0; + this._rotations[index2 * 4 + 2] = 0; + this._rotations[index2 * 4 + 3] = 1; + } else { + direction[0] = toPositionX - fromPositionX; + direction[1] = toPositionY - fromPositionY; + direction[2] = toPositionZ - fromPositionZ; + let length2 = length$1(direction); + scale$5(direction, direction, 1 / length2); + rotationTo(_quat, this._core.config.identityRotation, direction); + this._rotations[index2 * 4] = _quat[0]; + this._rotations[index2 * 4 + 1] = _quat[1]; + this._rotations[index2 * 4 + 2] = _quat[2]; + this._rotations[index2 * 4 + 3] = _quat[3]; + if (options2.offsets) { + const fromOffset = options2.offsets[fromId] * offsetScaling / 2; + const toOffset = options2.offsets[toId] * offsetScaling / 2; + toPositionX -= direction[0] * toOffset; + toPositionY -= direction[1] * toOffset; + toPositionZ -= direction[2] * toOffset; + fromPositionX += direction[0] * fromOffset; + fromPositionY += direction[1] * fromOffset; + fromPositionZ += direction[2] * fromOffset; + length2 = Math.max(length2 - toOffset - fromOffset, minSize); + } + this._sizes[index2 * 3 + 1] = Math.max(length2 * sizeScalingY, minSize); + if (options2.lineSizes) { + this._sizes[index2 * 3] = Math.max(options2.lineSizes[id2] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options2.lineSizes[id2] * sizeScalingZ, minSize); + } else if (options2.endSizes) { + this._sizes[index2 * 3] = Math.max(options2.endSizes[fromId] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options2.endSizes[toId] * sizeScalingZ, minSize); + } else { + this._sizes[index2 * 3] = sizeScalingX; + this._sizes[index2 * 3 + 2] = sizeScalingZ; + } + } + _vec3[0] = (fromPositionX + toPositionX) / 2; + _vec3[1] = (fromPositionY + toPositionY) / 2; + _vec3[2] = (fromPositionZ + toPositionZ) / 2; + this._positions[index2 * 3] = _vec3[0]; + this._positions[index2 * 3 + 1] = _vec3[1]; + this._positions[index2 * 3 + 2] = _vec3[2]; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, fromIds, toIds, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const dataView = buffer.dataView; + const _vec2 = create$3(); + const _vec3 = create$6(); + const _quat = create$4(); + const endMinColor = options2.endMinColor === void 0 ? 0 : options2.endMinColor; + const endMaxColor = options2.endMaxColor === void 0 ? 1 : options2.endMaxColor; + const lineMinColor = options2.lineMinColor === void 0 ? 0 : options2.lineMinColor; + const lineMaxColor = options2.lineMaxColor === void 0 ? 1 : options2.lineMaxColor; + const minOrder = options2.minOrder === void 0 ? 0 : options2.minOrder; + const maxOrder = options2.maxOrder === void 0 ? 1 : options2.maxOrder; + const orderReverse = options2.orderReverse === void 0 ? false : options2.orderReverse; + const minStaggerOrder = options2.minStaggerOrder === void 0 ? 0 : options2.minStaggerOrder; + const maxStaggerOrder = options2.maxStaggerOrder === void 0 ? 1 : options2.maxStaggerOrder; + const staggerOrderReverse = options2.staggerOrderReverse === void 0 ? false : options2.staggerOrderReverse; + const reverseX = options2.reverseX === void 0 ? false : options2.reverseX; + const reverseY = options2.reverseY === void 0 ? false : options2.reverseY; + const reverseZ = options2.reverseZ === void 0 ? false : options2.reverseZ; + this._updateModelBounds(options2); + const lookup2 = buffer.lookup; + const selection = options2.selected && options2.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options2.facetCoordsX ? options2.facetCoordsX[id2] : 0; + const facetY = options2.facetCoordsY ? options2.facetCoordsY[id2] : 0; + const facetZ = options2.facetCoordsZ ? options2.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = this._sizes[index2 * 3] * this._boundsScaling; + _vec3[1] = this._sizes[index2 * 3 + 1] * this._boundsScaling; + _vec3[2] = this._sizes[index2 * 3 + 2] * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + _quat[0] = this._rotations[index2 * 4]; + _quat[1] = this._rotations[index2 * 4 + 1]; + _quat[2] = this._rotations[index2 * 4 + 2]; + _quat[3] = this._rotations[index2 * 4 + 3]; + if (reverseX) { + _quat[1] = -_quat[1]; + _quat[2] = -_quat[2]; + } + if (reverseY) { + _quat[0] = -_quat[0]; + _quat[2] = -_quat[2]; + } + if (reverseZ) { + _quat[0] = -_quat[0]; + _quat[1] = -_quat[1]; + } + UnitVertex.setRotation(dataView, index2, _quat); + let size; + if (options2.endColors) { + size = 1 / (endMaxColor - endMinColor + 1); + const fromColor = MathHelper.normalize(options2.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + const toColor = MathHelper.normalize(options2.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + set$5(_vec2, fromColor, toColor); + UnitVertex.setColor(dataView, index2, _vec2); + } else if (options2.lineColors) { + size = 1 / (lineMaxColor - lineMinColor + 1); + const color2 = MathHelper.normalize(options2.lineColors[id2], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); + set$5(_vec2, color2, color2); + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants$1.VECTOR2_ONE); } - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - const font = fontVisual.font; - font.update(); - fontVisual.update(); - } - } - getVertexPosition(position, pickedId) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[pickedId]; - if (id > -1) { - const index = transitionBuffer.currentBuffer.lookup[id]; - const dataView = transitionBuffer.currentBuffer.dataView; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, position); - break; - } + UnitVertex.setIdHover(dataView, index2, options2.hover ? options2.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options2.selected.has(id2) ? 1 : -1 : 0); + if (options2.order !== void 0) { + const order = MathHelper.normalize(options2.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); } + if (options2.staggerOrder !== void 0) { + _vec2[1] = options2.staggerOrder; + } else if (options2.staggerOrders) { + const stagger = MathHelper.normalize(options2.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options2.material ? options2.material : options2.materials ? options2.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options2.rounding ? options2.rounding * this._boundsScaling : options2.roundings ? options2.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setSdfBuffer(dataView, index2, options2.sdfBuffer ? options2.sdfBuffer : options2.sdfBuffers ? options2.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options2.sdfBorder ? options2.sdfBorder : options2.sdfBorders ? options2.sdfBorders[id2] : this._core.config.sdfBorder); + UnitVertex.setMatId(dataView, index2, options2.materialType ? options2.materialType : options2.materialTypes ? options2.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options2.materialColor ? options2.materialColor : options2.materialColors ? [options2.materialColors[id2 * 3], options2.materialColors[id2 * 3 + 1], options2.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options2.materialFuzz ? options2.materialFuzz : options2.materialFuzzes ? options2.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options2.materialGloss ? options2.materialGloss : options2.materialGlosses ? options2.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options2.materialDensity ? options2.materialDensity : options2.materialDensities ? options2.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options2.materialRefractiveIndex ? options2.materialRefractiveIndex : options2.materialRefractiveIndices ? options2.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options2.segmentColor ? options2.segmentColor : options2.segmentColors ? [options2.segmentColors[id2 * 4], options2.segmentColors[id2 * 4 + 1], options2.segmentColors[id2 * 4 + 2], options2.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() {}); + } + class AtlasBase { + get imageData() { + return this._imageData; } - prepare(xrFrame) {} - initializeWebXR(session) { - return null; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._changed = true; + } + } + constructor() { + this._imageData = null; + } + copyFrom(atlas) { + if (atlas.imageData) { + this._imageData = atlas.imageData; + this._changed = true; + } else { + this.imageData = null; + } } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../components/axes/axes.js":"8Tmim","../buffer.js":"itbJk","../vertex.js":"4J2YE","../components/labels.js":"PwNrz","../components/debug.js":"bBVbT","../components/controller.js":"f5tIG","../components/image.js":"kwtZG","../font.js":"ibkbS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"itbJk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BufferBase", ()=>BufferBase); -parcelHelpers.export(exports, "TransitionBufferBase", ()=>TransitionBufferBase); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _paletteJs = require("./palette.js"); -var _vertexJs = require("./vertex.js"); -var _pickJs = require("./helpers/pick.js"); -var _mainJs = require("./main.js"); -var _atlasJs = require("./atlas.js"); -class BufferBase { + update() { + } + } + let Atlas$2 = class Atlas extends AtlasBase { + }; + class BufferBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get ids() { - return this._ids; + return this._ids; } get dataView() { - return this._dataView; + return this._dataView; } get vertices() { - return this._vertices; + return this._vertices; } get lookup() { - return this._lookup; + return this._lookup; } get length() { - return this._length; + return this._length; } get selected() { - return this._selected; - } - constructor(core, ids){ - this._core = core; - this._ids = ids; - this._length = ids.length; - this._vertices = new ArrayBuffer(this._length * (0, _vertexJs.UnitVertex).SIZE_BYTES); - this._dataView = new DataView(this._vertices); - this._selected = new Set(); - this.from = 0; - this.to = 1; - this.unitType = (0, _mainJs.UnitType).block; - this._lookup = {}; - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - this._lookup[id] = i; - (0, _vertexJs.UnitVertex).setRotation(this._dataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } + return this._selected; + } + constructor(core, ids) { + this._core = core; + this._ids = ids; + this._length = ids.length; + this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); + this._dataView = new DataView(this._vertices); + this._selected = /* @__PURE__ */ new Set(); + this.from = 0; + this.to = 1; + this.unitType = UnitType.block; + this._lookup = {}; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + this._lookup[id2] = i; + UnitVertex.setRotation(this._dataView, i, Constants$1.QUAT_IDENTITY); + } } createShared() { - const buffer = Object.create(this); - buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); - buffer._dataView = new DataView(buffer._vertices); - return buffer; + const buffer = Object.create(this); + buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); + buffer._dataView = new DataView(buffer._vertices); + return buffer; } copyFrom(buffer) { - const start = window.performance.now(); - const fromDataView = buffer.dataView; - const toDataView = this._dataView; - const lookup = buffer.lookup; - for(let i = 0; i < this._length; i++){ - const index = lookup[this._ids[i]]; - if (index != null) { - (0, _vertexJs.UnitVertex).copyIdHover(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTranslation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyScale(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRotation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyColor(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySelected(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyMaterial(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRounding(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyOrder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexCoord(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexture(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBuffer(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBorder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter1(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter2(fromDataView, index, toDataView, i); - } else (0, _vertexJs.UnitVertex).setRotation(toDataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } - this.unitType = buffer.unitType; - this._selected = buffer.selected; - this._core.log.write((0, _mainJs.LogLevel).info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - update() {} - updateSelection(options) { - const start = window.performance.now(); - const ids = options && options.ids ? options.ids : this._ids; - const offset = options && options.offset !== undefined ? options.offset : 0; - const count = options && options.count !== undefined ? options.count : ids.length; - const selection = this._selected.size > 0; - const dataView = this._dataView; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = this._lookup[id]; - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? this._selected.has(id) ? 1 : -1 : 0); - } - this.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer update selection ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TransitionBufferBase { + const start = window.performance.now(); + const fromDataView = buffer.dataView; + const toDataView = this._dataView; + const lookup2 = buffer.lookup; + for (let i = 0; i < this._length; i++) { + const index2 = lookup2[this._ids[i]]; + if (index2 != null) { + UnitVertex.copyIdHover(fromDataView, index2, toDataView, i); + UnitVertex.copyTranslation(fromDataView, index2, toDataView, i); + UnitVertex.copyScale(fromDataView, index2, toDataView, i); + UnitVertex.copyRotation(fromDataView, index2, toDataView, i); + UnitVertex.copyColor(fromDataView, index2, toDataView, i); + UnitVertex.copySelected(fromDataView, index2, toDataView, i); + UnitVertex.copyMaterial(fromDataView, index2, toDataView, i); + UnitVertex.copyRounding(fromDataView, index2, toDataView, i); + UnitVertex.copyOrder(fromDataView, index2, toDataView, i); + UnitVertex.copyTexCoord(fromDataView, index2, toDataView, i); + UnitVertex.copyTexture(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBuffer(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBorder(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter1(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter2(fromDataView, index2, toDataView, i); + UnitVertex.copyMatId(fromDataView, index2, toDataView, i); + UnitVertex.copyMatColor(fromDataView, index2, toDataView, i); + UnitVertex.copyMatFuzz(fromDataView, index2, toDataView, i); + UnitVertex.copyMatRefractiveIndex(fromDataView, index2, toDataView, i); + UnitVertex.copyMatGloss(fromDataView, index2, toDataView, i); + UnitVertex.copyMatDensity(fromDataView, index2, toDataView, i); + UnitVertex.copySegColor(fromDataView, index2, toDataView, i); + } else { + UnitVertex.setRotation(toDataView, i, Constants$1.QUAT_IDENTITY); + } + } + this.unitType = buffer.unitType; + this._selected = buffer.selected; + this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + update() { + } + updateSelection(options2) { + const start = window.performance.now(); + const ids = options2 && options2.ids ? options2.ids : this._ids; + const offset2 = options2 && options2.offset !== void 0 ? options2.offset : 0; + const count2 = options2 && options2.count !== void 0 ? options2.count : ids.length; + const selection = this._selected.size > 0; + const dataView = this._dataView; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = this._lookup[id2]; + UnitVertex.setSelected(dataView, index2, selection ? this._selected.has(id2) ? 1 : -1 : 0); + } + this.update(); + this._core.log.write(LogLevel.info, `buffer update selection ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + } + class TransitionBufferBase { get pickIdLookup() { - return this._pickIdLookup; + return this._pickIdLookup; } get currentBuffer() { - return this._isBuffer1Current ? this._buffer1 : this._buffer2; + return this._isBuffer1Current ? this._buffer1 : this._buffer2; } get previousBuffer() { - return this._isBuffer1Current ? this._buffer2 : this._buffer1; + return this._isBuffer1Current ? this._buffer2 : this._buffer1; } get currentPalette() { - return this._isBuffer1Current ? this._palette1 : this._palette2; + return this._isBuffer1Current ? this._palette1 : this._palette2; } get previousPalette() { - return this._isBuffer1Current ? this._palette2 : this._palette1; + return this._isBuffer1Current ? this._palette2 : this._palette1; } get currentAtlas() { - return this._isBuffer1Current ? this._atlas1 : this._atlas2; + return this._isBuffer1Current ? this._atlas1 : this._atlas2; } get previousAtlas() { - return this._isBuffer1Current ? this._atlas2 : this._atlas1; + return this._isBuffer1Current ? this._atlas2 : this._atlas1; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get length() { - return this._length; - } - constructor(core, ids, bufferType, paletteType, atlasType){ - this.bufferType = bufferType; - this.paletteType = paletteType; - this.atlasType = atlasType; - this._core = core; - this._length = ids.length; - this.id = TransitionBufferBase._id++; - this.isVisible = true; - this.transitionTime = 1; - this.activeId = -1; - const start = window.performance.now(); - this._buffer1 = new bufferType(core, ids); - this._buffer2 = this._buffer1.createShared(); - this._palette1 = new paletteType(); - this._palette2 = new paletteType(); - this._atlas1 = new atlasType(); - this._atlas2 = new atlasType(); - this.isPickingEnabled = true; - this._pickIdLookup = {}; - const dataView1 = this._buffer1.dataView; - const dataView2 = this._buffer2.dataView; - const _vec4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - this._pickIdLookup[pickId] = id; - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).data, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView1, i, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView2, i, _vec4); - } - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); + return this._length; + } + constructor(core, ids, bufferType, paletteType, atlasType) { + this.bufferType = bufferType; + this.paletteType = paletteType; + this.atlasType = atlasType; + this._core = core; + this._length = ids.length; + this.id = TransitionBufferBase._id++; + this.isVisible = true; + this.transitionTime = 1; + this.activeId = -1; + const start = window.performance.now(); + this._buffer1 = new bufferType(core, ids); + this._buffer2 = this._buffer1.createShared(); + this._palette1 = new paletteType(); + this._palette2 = new paletteType(); + this._atlas1 = new atlasType(); + this._atlas2 = new atlasType(); + this.isPickingEnabled = true; + this._pickIdLookup = {}; + const dataView1 = this._buffer1.dataView; + const dataView2 = this._buffer2.dataView; + const _vec4 = create$5(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + const pickId = PickHelper.nextPickId(); + this._pickIdLookup[pickId] = id2; + PickHelper.encodeNumber(pickId, PickType.data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; + UnitVertex.setIdColor(dataView1, i, _vec4); + UnitVertex.setIdColor(dataView2, i, _vec4); + } + this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); } swap() { - this._isBuffer1Current = !this._isBuffer1Current; + this._isBuffer1Current = !this._isBuffer1Current; } copyFrom(transitionBuffer) { - const start = window.performance.now(); - this.key = transitionBuffer.key; - this.isVisible = transitionBuffer.isVisible; - this.transitionTime = transitionBuffer.transitionTime; - this.isPickingEnabled = transitionBuffer.isPickingEnabled; - this.unitType = transitionBuffer.unitType; - this.activeId = transitionBuffer.activeId; - this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); - this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); - this.currentBuffer.update(); - this.previousBuffer.update(); - this.currentPalette.copyFrom(transitionBuffer.currentPalette); - this.previousPalette.copyFrom(transitionBuffer.previousPalette); - this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); - this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } -} -TransitionBufferBase._id = 1; -class Buffer extends BufferBase { - constructor(core, ids){ - super(core, ids); - } -} -class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - } -} - -},{"gl-matrix":"5x28d","./constants.js":"lD0bG","./palette.js":"hZb65","./vertex.js":"4J2YE","./helpers/pick.js":"1t2sb","./main.js":"f421K","./atlas.js":"2peXi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2peXi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AtlasBase", ()=>AtlasBase); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -class AtlasBase { - get imageData() { - return this._imageData; + const start = window.performance.now(); + this.key = transitionBuffer.key; + this.isVisible = transitionBuffer.isVisible; + this.transitionTime = transitionBuffer.transitionTime; + this.isPickingEnabled = transitionBuffer.isPickingEnabled; + this.unitType = transitionBuffer.unitType; + this.activeId = transitionBuffer.activeId; + this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); + this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); + this.currentBuffer.update(); + this.previousBuffer.update(); + this.currentPalette.copyFrom(transitionBuffer.currentPalette); + this.previousPalette.copyFrom(transitionBuffer.previousPalette); + this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); + this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); + this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._changed = true; - } + } + TransitionBufferBase._id = 1; + let Buffer$3 = class Buffer extends BufferBase { + constructor(core, ids) { + super(core, ids); } - constructor(){ - this._imageData = null; + }; + let TransitionBuffer$2 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$3, Palette$3, Atlas$2); } - copyFrom(atlas) { - if (atlas.imageData) { - this._imageData = atlas.imageData; - this._changed = true; - } else this.imageData = null; - } - update() {} -} -class Atlas extends AtlasBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bBVbT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxes", ()=>DebugAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class DebugAxes { + }; + class DebugAxes { get vertices() { - return this._vertices; + return this._vertices; } get indices() { - return this._indices; + return this._indices; } get indexCount() { - return this._indexCount; + return this._indexCount; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } initialize() { - let vertexOffset = 0; - let indexOffset = 0; - const axisVertices = (0, _cubeJs.Cube).POSITIONS; - const axisIndices = (0, _cubeJs.Cube).INDICES; - this._vertices = new ArrayBuffer(3 * (0, _vertexJs.PositionColorVertex).SIZE_BYTES * axisVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const verticesView = new DataView(this._vertices); - this._indices = new Uint16Array(3 * axisIndices.length + 4); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - const transform = (0, _glMatrix.mat4).create(); - const length = 1; - const width = 0.01; - transform[0] = length; - transform[5] = width; - transform[10] = width; - transform[12] = 0.5; - transform[13] = 0; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITX, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = length; - transform[10] = width; - transform[12] = 0; - transform[13] = 0.5; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITY, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = width; - transform[10] = length; - transform[12] = 0; - transform[13] = 0; - transform[14] = 0.5; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITZ, transform, vertexOffset, indexOffset); - this._indexCount = this._indices.length; - this._isInitialized = true; + let vertexOffset = 0; + let indexOffset = 0; + const axisVertices = Cube.POSITIONS; + const axisIndices2 = Cube.INDICES; + this._vertices = new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); + const verticesView = new DataView(this._vertices); + this._indices = new Uint16Array(3 * axisIndices2.length + 4); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + const transform2 = create$7(); + const length2 = 1; + const width2 = 0.01; + transform2[0] = length2; + transform2[5] = width2; + transform2[10] = width2; + transform2[12] = 0.5; + transform2[13] = 0; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITX, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = length2; + transform2[10] = width2; + transform2[12] = 0; + transform2[13] = 0.5; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITY, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = width2; + transform2[10] = length2; + transform2[12] = 0; + transform2[13] = 0; + transform2[14] = 0.5; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITZ, transform2, vertexOffset, indexOffset); + this._indexCount = this._indices.length; + this._isInitialized = true; } - update(elapsedTime) {} - _createAxis(axisVertices, axisIndices, verticesView, indices, color, transform, vertexOffset, indexOffset) { - const position = (0, _glMatrix.vec3).create(); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - for(let i = 0; i < vertexCount; i++){ - (0, _glMatrix.vec3).set(position, axisVertices[i * (0, _vertexJs.PositionVertex).SIZE], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionColorVertex).setPosition(verticesView, vertexOffset + i, position); - (0, _vertexJs.PositionColorVertex).setColor(verticesView, vertexOffset + i, color); - } - for(let i = 0; i < indexCount; i++)indices[indexOffset + i] = axisIndices[i] + vertexOffset; - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../meshes/cube.js":"79I5N","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fYCHg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"eZSaZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eZSaZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _colorJs = require("./shaders/color.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _modelJs = require("./shaders/model.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unithexprismJs = require("./shaders/unithexprism.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _anaglyphJs = require("./shaders/anaglyph.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _pickJs = require("../../helpers/pick.js"); -var _debugJs = require("./components/debug.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _controllerJs = require("./components/controller.js"); -var _imageJs = require("./components/image.js"); -var _vertexJs = require("../../vertex.js"); -var _labelsJs = require("./components/labels.js"); -var _fontJs = require("./font.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + update(elapsedTime) { } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + _createAxis(axisVertices, axisIndices2, verticesView, indices, color2, transform2, vertexOffset, indexOffset) { + const position2 = create$6(); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + for (let i = 0; i < vertexCount; i++) { + set$8(position2, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); + transformMat4$2(position2, position2, transform2); + PositionColorVertex.setPosition(verticesView, vertexOffset + i, position2); + PositionColorVertex.setColor(verticesView, vertexOffset + i, color2); + } + for (let i = 0; i < indexCount; i++) { + indices[indexOffset + i] = axisIndices2[i] + vertexOffset; + } + } + } + var __awaiter$3 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get shaderResources() { - return this._shaderResources; + }; + class RendererConfig { + reset() { } - get colorShader() { - return this._colorShader; + } + class RendererBase { + get isInitialized() { + return this._isInitialized; } - get textureShader() { - return this._textureShader; + get config() { + return this._config; + } + get devicePixelRatio() { + return this._devicePixelRatio; + } + get width() { + return this._canvas.width; + } + set width(value2) { + this._options.width = value2; + } + get height() { + return this._canvas.height; } - get lassoShader() { - return this._lassoShader; + set height(value2) { + this._options.height = value2; } - get modelShader() { - return this._modelShader; + get webXRReferenceSpace() { + return this._webXRReferenceSpace; } - get sdfTextShader() { - return this._sdfTextShader; + get pickedType() { + return this._pickedType; } - get gridShader() { - return this._gridShader; + get pickedId() { + return this._pickedId; } - get blockShader() { - return this._blockShader; + get isCapturingPickImage() { + return this._isCapturingPickImage; } - get sphereShader() { - return this._sphereShader; + capturePickImage() { + this._isCapturingPickImage = true; } - get cyclinderShader() { - return this._cylinderShader; + get backgroundColor() { + return this._backgroundColor; } - get hexPrismShader() { - return this._hexPrismShader; + set backgroundColor(value2) { + if (!exactEquals(value2, this._backgroundColor)) { + this._backgroundColor = value2; + } } - get sdfShader() { - return this._sdfShader; + get ambientColor() { + return this._ambientColor; } - get anaglyphShader() { - return this._anaglyphShader; + set ambientColor(value2) { + if (!exactEquals$1(value2, this._ambientColor)) { + this._ambientColor = value2; + } } get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._directionToCamera = (0, _glMatrix.vec3).create(); - this._directionToLight = (0, _glMatrix.vec3).create(); - this._halfAngle = (0, _glMatrix.vec3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this.depthEnabled = true; + swapAxes() { + this._isAxes1Current = !this._isAxes1Current; } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + createCartesian2dAxesVisual(axes) { + return new AxesVisual(axes); } - get isWebXRSupported() { - return true; + createCartesian3dAxesVisual(axes) { + return new AxesVisual(axes); } - initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._colorShader = new (0, _colorJs.Color)(this._core, this); - this._textureShader = new (0, _textureJs.Texture)(this._core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(this._core, this); - this._modelShader = new (0, _modelJs.Model)(this._core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(this._core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(this._core, this); - this._anaglyphShader = new (0, _anaglyphJs.Anaglyph)(this._core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(this._core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(this._core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(this._core, this); - this._hexPrismShader = new (0, _unithexprismJs.UnitHexPrism)(this._core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(this._core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - this._isInitialized = false; - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); - this._isInitialized = true; + _createDebugAxesVisual(debugAxes) { + return null; } - _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._shaderResources.initializeContext(this._gl); - this._colorShader.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._modelShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._anaglyphShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._hexPrismShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._debugAxesVisual.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - this._anaglyphTextures = [ - null, - null - ]; - this.anaglyphFramebuffers = [ - null, - null - ]; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - for(let i = 0; i < this.controllers.length; i++)this.controllers[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - for(let i = 0; i < 2; i++){ - const texture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width, height); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._anaglyphTextures[i] = texture; - this.anaglyphFramebuffers[i] = framebuffer; - } - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + createLabelSetVisual(labelSet) { + return new LabelSetVisual$2(labelSet); } - _createContext(canvas) { - const antialias = this._options ? this._options.antialias === undefined ? true : this._options.antialias : true; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - return canvas.getContext("webgl", { - stencil: true, - alpha: true, - antialias: antialias, - preserveDrawingBuffer: preserveDrawingBuffer - }); + createControllerVisual(controller) { + return new ControllerVisual$1(controller); } - initializeWebXR(session) { - const promise = new Promise((resolve, reject)=>{ - this._gl.makeXRCompatible().then(()=>{ - session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, this._gl), - depthNear: this._core.config.nearPlane, - depthFar: this._core.config.farPlane - }); - session.requestReferenceSpace('local').then((refSpace)=>{ - this._webXRReferenceSpace = refSpace; - resolve(); - }); - }); - }); - return promise; + createTransitionBuffer(ids) { + return new TransitionBuffer$2(this._core, ids); } - prepare(xrFrame) { - if (xrFrame) { - const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); - if (pose) { - const glLayer = xrFrame.session.renderState.baseLayer; - for(let i = 0; i < pose.views.length; i++){ - const view = pose.views[i]; - this.vMatrices[i] = view.transform.inverse.matrix; - this.inverseVMatrices[i] = view.transform.matrix; - (0, _glMatrix.mat4).multiply(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); - this.mvMatrices[i] = this._mvMatrices[i]; - this.pMatrices[i] = view.projectionMatrix; - const viewport = glLayer.getViewport(view); - this._viewports[i].x = viewport.x; - this._viewports[i].y = viewport.y; - this._viewports[i].width = viewport.width; - this._viewports[i].height = viewport.height; - this._framebuffers[i] = glLayer.framebuffer; - } - } - this._viewportOffset = 0; - this._viewportCount = 2; - } else { - let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - this._framebuffers[1] = null; - break; - case (0, _mainJs.StereoMode).anaglyph: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = this.anaglyphFramebuffers[0]; - this._framebuffers[1] = this.anaglyphFramebuffers[1]; - break; - case (0, _mainJs.StereoMode).split: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = this._canvas.width / 2; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = null; - this._framebuffers[1] = null; - break; - } - } + createImageVisual(image2) { + return new ImageVisual$2(image2); } - createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; + createFontVisual(font2) { + return new FontVisual$2(font2); } - createControllerVisual(controller) { - const visual = new (0, _controllerJs.ControllerVisual)(this._core, this, controller); - visual.initializeContext(this._gl); - return visual; + constructor(options2) { + this._options = options2; + this.fonts = {}; } - createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + get isWebXRSupported() { + return false; } - createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + initialize(core) { + this._core = core; + this._canvas = document.createElement("canvas"); + const contextmenu = this._options && this._options.contextmenu; + if (!contextmenu) { + this._canvas.addEventListener("contextmenu", (e) => { + e.preventDefault(); + }); + } + this._canvas.tabIndex = this._core.container.tabIndex; + this._canvas.style.display = "block"; + this._canvas.style.touchAction = "none"; + this._core.container.appendChild(this._canvas); + this._mvMatrices = [create$7(), create$7()]; + this.pickPMatrix = create$7(); + this.axesVisibility = AxesVisibility.current; + this._debugAxes = new DebugAxes(); + this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); + this.transitionTime = 1; + this.transitionBuffers = []; + this.areLabelsVisible = true; + this.labelSets = []; + this.controllers = []; + this.areImagesVisible = true; + this.images = []; + this._viewports = [new DOMRect(), new DOMRect()]; + this.isPickingEnabled = false; + this._pickedType = PickType.none; + this._pickedId = 0; + this._lassoMMatrix = create$7(); + this._lassoThickness = create$3(); + this._resizeMinimumDelay = -1; + this._previousResizeWidth = -1; + this._previousResizeHeight = -1; } - _createDebugAxesVisual(debugAxes) { - return new (0, _debugJs.DebugAxesVisual)(this._core, this, debugAxes); + remove() { + this._core.container.removeChild(this._canvas); } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); + finalize() { + this._isInitialized = false; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; + setSize(elapsedTime) { + if (this._options && this._options.width && this._options.height) { + this._devicePixelRatio = 1; + this._resizeWidth = this._options.width; + this._resizeHeight = this._options.height; + } else { + this._devicePixelRatio = window.devicePixelRatio || 1; + this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; + this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; + } + if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { + this._previousResizeWidth = this._resizeWidth; + this._previousResizeHeight = this._resizeHeight; + this._isResizing = true; + this._resizeElapsedTime = elapsedTime; + } + if (this._isResizing) { + if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { + this._isResizing = false; + this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; + this._resize(this._resizeWidth, this._resizeHeight); + } else { + this._resizeElapsedTime += elapsedTime; + } + } } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; + _resize(width2, height2) { + this._canvas.style.width = `${Math.floor(width2 / this._devicePixelRatio)}px`; + this._canvas.style.height = `${Math.floor(height2 / this._devicePixelRatio)}px`; + width2 = Math.floor(width2); + height2 = Math.floor(height2); + this._canvas.width = width2; + this._canvas.height = height2; } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; + update(elapsedTime) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousPalette; + const current = transitionBuffer.currentPalette; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousAtlas; + const current = transitionBuffer.currentAtlas; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + if (this._core.config.isDebugVisible) { + if (this._debugAxesVisual) { + this._debugAxesVisual.mMatrix = this.mMatrix; + this._debugAxesVisual.vMatrices = this.vMatrices; + this._debugAxesVisual.pMatrices = this.pMatrices; + this._debugAxesVisual.viewports = this._viewports; + this._debugAxesVisual.viewportOffset = this._viewportOffset; + this._debugAxesVisual.viewportCount = this._viewportCount; + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + this.labelSets[i].label.update(elapsedTime); + labelSetVisual.mMatrix = this.mMatrix; + labelSetVisual.vMatrices = this.vMatrices; + labelSetVisual.pMatrices = this.pMatrices; + labelSetVisual.isPickingEnabled = this.isPickingEnabled; + labelSetVisual.pickPMatrix = this.pickPMatrix; + labelSetVisual.pickVMatrix = this.pickVMatrix; + labelSetVisual.viewports = this._viewports; + labelSetVisual.viewportOffset = this._viewportOffset; + labelSetVisual.viewportCount = this._viewportCount; + labelSetVisual.update(elapsedTime); + } + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual && imageVisual.isVisible) { + const image2 = this.images[i].image; + image2.update(elapsedTime); + imageVisual.mMatrix = this.mMatrix; + imageVisual.vMatrices = this.vMatrices; + imageVisual.pMatrices = this.pMatrices; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.pickPMatrix = this.pickPMatrix; + imageVisual.pickVMatrix = this.pickVMatrix; + imageVisual.viewports = this._viewports; + imageVisual.viewportOffset = this._viewportOffset; + imageVisual.viewportCount = this._viewportCount; + imageVisual.update(elapsedTime); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + const controller = this.controllers[i].controller; + controller.update(elapsedTime); + controllerVisual.vMatrices = this.vMatrices; + controllerVisual.inverseVMatrices = this.vMatrices; + controllerVisual.pMatrices = this.pMatrices; + controllerVisual.viewports = this._viewports; + controllerVisual.viewportOffset = this._viewportOffset; + controllerVisual.viewportCount = this._viewportCount; + controllerVisual.update(elapsedTime); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + const axes = axesVisual.axes; + axes.mMatrix = this.mMatrix; + axes.vMatrix = this.vMatrices[0]; + axes.update(elapsedTime); + axesVisual.vMatrices = this.vMatrices; + axesVisual.pMatrices = this.pMatrices; + axesVisual.isPickingEnabled = this.isPickingEnabled; + axesVisual.pickPMatrix = this.pickPMatrix; + axesVisual.pickVMatrix = this.pickVMatrix; + axesVisual.viewports = this._viewports; + axesVisual.viewportOffset = this._viewportOffset; + axesVisual.viewportCount = this._viewportCount; + axesVisual.update(elapsedTime); + } + } + } + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + const font2 = fontVisual.font; + font2.update(); + fontVisual.update(); + } } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); + getVertexPosition(position2, pickedId) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[pickedId]; + if (id2 > -1) { + const index2 = transitionBuffer.currentBuffer.lookup[id2]; + const dataView = transitionBuffer.currentBuffer.dataView; + UnitVertex.getTranslation(dataView, index2, position2); + break; + } + } } render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - if (this.depthEnabled) this._gl.enable(this._gl.DEPTH_TEST); - else this._gl.disable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); - if (xrFrame) { - const glLayer = xrFrame.session.renderState.baseLayer; - this._shaderResources.bindFramebuffer(glLayer.framebuffer); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph) { - for(let i = 0; i < 2; i++){ - this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else { - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - if (this._core.config.isDebugVisible) { - this._debugAxesVisual.framebuffers = this._framebuffers; - this._debugAxesVisual.render(elapsedTime, xrFrame); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.framebuffers = this._framebuffers; - axesVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(xrFrame, transitionBuffer); - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.framebuffers = this._framebuffers; - labelSetVisual.render(elapsedTime, xrFrame); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.framebuffers = this._framebuffers; - imageVisual.pickFramebuffer = this._pickFrameBuffer; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - controllerVisual.isRayVisible = this.isPickingEnabled; - controllerVisual.framebuffers = this._framebuffers; - controllerVisual.render(elapsedTime, xrFrame); - } - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - if (this._isCapturingPickImage && this.capturePickImageCallback) { - this._isCapturingPickImage = false; - const data = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); - this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data); - for(let i = 0; i < data.length / 4; i++)if (data[i * 4 + 3] == (0, _mainJs.PickType).data) data[i * 4 + 3] = 255; - else { - data[i * 4] = 0; - data[i * 4 + 1] = 0; - data[i * 4 + 2] = 0; - data[i * 4 + 3] = 0; - } - const length = this._core.config.pickWidth * this._core.config.pickHeight * 4; - const row = this._core.config.pickWidth * 4; - const end = (this._core.config.pickHeight - 1) * row; - const flipped = new Uint8ClampedArray(length); - for(let i = 0; i < length; i += row)flipped.set(data.subarray(i, i + row), end - i); - this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); - } - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { - this._shaderResources.bindFramebuffer(null); - this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); - this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; - this._anaglyphShader.indexBuffer = this._quad.indexBuffer; - this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; - this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; - this._anaglyphShader.prepare(); - this._anaglyphShader.viewport = this._viewports[0]; - this._anaglyphShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - }); + return __awaiter$3(this, void 0, void 0, function* () { + }); } - _renderTransitionBuffer(xrFrame, transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf || unitType == (0, _mainJs.UnitType).ringSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = 0; - this._blockShader.rangeMax = transitionBuffer.length - 1; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.selectedColor = this._core.config.selectionColor; - this._blockShader.hoverColor = this._core.config.hoverColor; - this._blockShader.activeColor = this._core.config.activeColor; - this._blockShader.highlightMode = this._core.config.highlightMode; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.ambient = this._config.ambient; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._blockShader.directionToLight = this._directionToLight; - this._blockShader.halfAngle = this._halfAngle; - } else { - this._blockShader.directionToLight = this._config.directionToLight; - this._blockShader.halfAngle = this._config.halfAngle; - } - this._blockShader.vMatrix = vMatrix; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf || unitType == (0, _mainJs.UnitType).disk)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = 0; - this._sphereShader.rangeMax = transitionBuffer.length - 1; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.selectedColor = this._core.config.selectionColor; - this._sphereShader.hoverColor = this._core.config.hoverColor; - this._sphereShader.activeColor = this._core.config.activeColor; - this._sphereShader.highlightMode = this._core.config.highlightMode; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.ambient = this._config.ambient; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sphereShader.directionToLight = this._directionToLight; - this._sphereShader.halfAngle = this._halfAngle; - } else { - this._sphereShader.directionToLight = this._config.directionToLight; - this._sphereShader.halfAngle = this._config.halfAngle; - } - this._sphereShader.vMatrix = vMatrix; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = 0; - this._cylinderShader.rangeMax = transitionBuffer.length - 1; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.selectedColor = this._core.config.selectionColor; - this._cylinderShader.hoverColor = this._core.config.hoverColor; - this._cylinderShader.activeColor = this._core.config.activeColor; - this._cylinderShader.highlightMode = this._core.config.highlightMode; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.ambient = this._config.ambient; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._cylinderShader.directionToLight = this._directionToLight; - this._cylinderShader.halfAngle = this._halfAngle; - } else { - this._cylinderShader.directionToLight = this._config.directionToLight; - this._cylinderShader.halfAngle = this._config.halfAngle; - } - this._cylinderShader.vMatrix = vMatrix; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._hexPrismShader.isInitialized && (unitType == (0, _mainJs.UnitType).hexPrism || unitType == (0, _mainJs.UnitType).hexPrismSdf)) { - this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; - this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._hexPrismShader.prepare(); - this._hexPrismShader.mMatrix = this.mMatrix; - this._hexPrismShader.time = this.transitionTime; - this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._hexPrismShader.rangeMin = 0; - this._hexPrismShader.rangeMax = transitionBuffer.length - 1; - this._hexPrismShader.hover = hoverId; - this._hexPrismShader.active = activeId; - this._hexPrismShader.selectedColor = this._core.config.selectionColor; - this._hexPrismShader.hoverColor = this._core.config.hoverColor; - this._hexPrismShader.activeColor = this._core.config.activeColor; - this._hexPrismShader.highlightMode = this._core.config.highlightMode; - this._hexPrismShader.specularPower = this._config.specularPower; - this._hexPrismShader.specularIntensity = this._config.specularIntensity; - this._hexPrismShader.ambient = this._config.ambient; - this._hexPrismShader.apply(); - this._hexPrismShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._hexPrismShader.directionToLight = this._directionToLight; - this._hexPrismShader.halfAngle = this._halfAngle; - } else { - this._hexPrismShader.directionToLight = this._config.directionToLight; - this._hexPrismShader.halfAngle = this._config.halfAngle; - } - this._hexPrismShader.vMatrix = vMatrix; - this._hexPrismShader.pMatrix = this.pMatrices[viewport]; - this._hexPrismShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._hexPrismShader.isPickShader = true; - this._hexPrismShader.pMatrix = this.pickPMatrix; - this._hexPrismShader.vMatrix = this.pickVMatrix; - this._hexPrismShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = 0; - this._sdfShader.rangeMax = transitionBuffer.length - 1; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.selectedColor = this._core.config.selectionColor; - this._sdfShader.hoverColor = this._core.config.hoverColor; - this._sdfShader.activeColor = this._core.config.activeColor; - this._sdfShader.highlightMode = this._core.config.highlightMode; - this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 0xff; - this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.ambient = this._config.ambient; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sdfShader.directionToLight = this._directionToLight; - this._sdfShader.halfAngle = this._halfAngle; - } else { - this._sdfShader.directionToLight = this._config.directionToLight; - this._sdfShader.halfAngle = this._config.halfAngle; - } - this._sdfShader.vMatrix = vMatrix; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } + prepare(xrFrame) { } -} - -},{"gl-matrix":"5x28d","../../main.js":"f421K","../renderer.js":"8zmPQ","./components/quad.js":"j6pP2","./buffer.js":"l0kgV","./config.js":"lRVKC","./shaders/shader.js":"hWbX1","./shaders/color.js":"jXv4X","./shaders/texture.js":"c5hna","./shaders/lasso.js":"5QPQk","./shaders/model.js":"5cbW3","./shaders/sdftext.js":"8CJWE","./shaders/pickgrid.js":"9bPD8","./shaders/unitblock.js":"jKxeO","./shaders/unitsphere.js":"72WuL","./shaders/unitcylinder.js":"16WiR","./shaders/unithexprism.js":"3fOzC","./shaders/unitsdf.js":"9zSFc","./shaders/anaglyph.js":"8jbJ4","../../helpers/texture.js":"bUoBU","../../helpers/pick.js":"1t2sb","./components/debug.js":"bt0jr","./components/axes/cartesian2d.js":"ktXb3","./components/axes/cartesian3d.js":"6CCj9","./components/controller.js":"hdGVP","./components/image.js":"j2Sdg","../../vertex.js":"4J2YE","./components/labels.js":"5a9e1","./font.js":"4v679","./components/lasso.js":"bi5JS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j6pP2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { + initializeWebXR(session) { + return null; + } + } + let Quad$2 = class Quad { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$7(); + fromScaling(_mat4, _vec3); + const vertices = Quad$3.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"gl-matrix":"5x28d","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l0kgV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - get vertexBuffer() { - return this._vertexBuffer; + }; + let Atlas$1 = class Atlas extends AtlasBase { + get texture() { + return this._texture; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + get defaultTexture() { + return this._defaultTexture; } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } } -} - -},{"../../buffer.js":"itbJk","../../main.js":"f421K","./atlas.js":"4oA1j","./palette.js":"6O8ED","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4oA1j":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + }; + let Palette$2 = class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../atlas.js":"2peXi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6O8ED":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { - get texture() { - return this._texture; + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } } - get defaultTexture() { - return this._defaultTexture; + }; + let Buffer$2 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../palette.js":"hZb65","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lRVKC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); + }; + let TransitionBuffer$1 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$2, Palette$2, Atlas$1); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + }; + let Config$1 = class Config extends RendererConfig { + constructor() { + super(); + this.reset(); } reset() { - this.specularIntensity = 0.15; - this.specularPower = 150; - this.lightPosition = (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0); - this.ambient = 0.01; - const _quat1 = (0, _glMatrix.quat).create(); - const _quat2 = (0, _glMatrix.quat).create(); - let angle = (0, _angleJs.AngleHelper).degreesToRadians(15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat1, _quat2); - angle = (0, _angleJs.AngleHelper).degreesToRadians(-15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat2, _quat1); - this.directionToLight = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(this.directionToLight, (0, _constantsJs.Constants).VECTOR3_UNITZ, _quat2); - this.halfAngle = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(this.halfAngle, (0, _constantsJs.Constants).VECTOR3_UNITZ, this.directionToLight); - (0, _glMatrix.vec3).normalize(this.halfAngle, this.halfAngle); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../helpers/angle.js":"53hwW","../renderer.js":"8zmPQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hWbX1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.specularIntensity = 0.15; + this.specularPower = 150; + this.lightPosition = fromValues$3(-0.5, 0.5, 0); + this.ambient = 0.01; + const _quat1 = create$4(); + const _quat2 = create$4(); + let angle2 = AngleHelper.degreesToRadians(15); + setAxisAngle(_quat1, Constants$1.VECTOR3_UNITX, angle2); + multiply(_quat2, _quat1, _quat2); + angle2 = AngleHelper.degreesToRadians(-15); + setAxisAngle(_quat1, Constants$1.VECTOR3_UNITY, angle2); + multiply(_quat2, _quat2, _quat1); + this.directionToLight = create$6(); + transformQuat(this.directionToLight, Constants$1.VECTOR3_UNITZ, _quat2); + this.halfAngle = create$6(); + add$4(this.halfAngle, Constants$1.VECTOR3_UNITZ, this.directionToLight); + normalize$5(this.halfAngle, this.halfAngle); + this.isFxaaEnabled = false; + } + }; + let Resources$1 = class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); - this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); - this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); - this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "anaglyph.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n", - "color.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); + this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); + this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); + this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + }; + Resources$1.glsl = { + "anaglyph.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n', + "color.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n', "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", - "lasso.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "model.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "model.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n', "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", - "pickgrid.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n", + "pickgrid.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n', "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n", + "sdftext.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n', "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n", - "unitblock.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitcylinder.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unithexprism.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unithexprism.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n", - "unitsdf.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitsphere.vertex.fx": "#version 100\n#include \"common.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n', + "unitblock.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitcylinder.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unithexprism.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unithexprism.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n', + "unitsdf.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitsphere.vertex.fx": '#version 100\n#include "common.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + let ShaderBase$1 = class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); + } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources$1.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"dvdia","../../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jXv4X":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Color extends (0, _shaderJs.ShaderBase) { + }; + let Color$1 = class Color extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._colorAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._colorAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c5hna":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + }; + let Texture$1 = class Texture extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5QPQk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let Lasso$3 = class Lasso extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5cbW3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Model", ()=>Model); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Model extends (0, _shaderJs.ShaderBase) { + }; + class Model extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); } applyView() { - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8CJWE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let SdfText$1 = class SdfText extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9bPD8":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let PickGrid$1 = class PickGrid extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jKxeO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ahgmR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -var _mainJs = require("../../../main.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + }; + let UnitShader$1 = class UnitShader extends ShaderBase$1 { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); - this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); - this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); - this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); + this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); + this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); + this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); } _updateCurrentBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); } _updatePreviousBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform1f(this._ambientUniform, this.ambient); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._activeColorUniform, this.activeColor); - this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == (0, _mainJs.HighlightMode).luminance ? 0.0 : 1.0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform1f(this._ambientUniform, this.ambient); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._activeColorUniform, this.activeColor); + this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0 : 1); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); } updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"hWbX1","../../../meshes/cube.js":"79I5N","../../../vertex.js":"4J2YE","../../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"72WuL":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); + } + }; + let UnitBlock$1 = class UnitBlock extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"16WiR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + let UnitSphere$1 = class UnitSphere extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + }; + let UnitCylinder$1 = class UnitCylinder extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3fOzC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitHexPrism", ()=>UnitHexPrism); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitHexPrism extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + class UnitHexPrism extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9zSFc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + } + let UnitSdf$1 = class UnitSdf extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); - this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); + this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8jbJ4":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Anaglyph", ()=>Anaglyph); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Anaglyph extends (0, _shaderJs.ShaderBase) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); + } + }; + class Anaglyph extends ShaderBase$1 { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bt0jr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxesVisual", ()=>DebugAxesVisual); -class DebugAxesVisual { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + } + } + class DebugAxesVisual { get isInitialized() { - return this._isInitialized && this._main.colorShader.isInitialized; + return this._isInitialized && this._main.colorShader.isInitialized; } - constructor(core, main, debugAxes){ - this._main = main; - this._debugAxes = debugAxes; - this.isVisible = true; + constructor(core, main, debugAxes) { + this._main = main; + this._debugAxes = debugAxes; + this.isVisible = true; } initializeContext(gl) { - if (!this._debugAxes.isInitialized) this._debugAxes.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._debugAxes.isInitialized) { + this._debugAxes.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const colorShader = this._main.colorShader; - const shaderResources = this._main.shaderResources; - colorShader.vertexBuffer = this._vertexBuffer; - colorShader.indexBuffer = this._indexBuffer; - colorShader.prepare(); - colorShader.mMatrix = this.mMatrix; - colorShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - colorShader.vMatrix = this.vMatrices[viewport]; - colorShader.pMatrix = this.pMatrices[viewport]; - colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + if (this.isInitialized) { + const colorShader = this._main.colorShader; + const shaderResources = this._main.shaderResources; + colorShader.vertexBuffer = this._vertexBuffer; + colorShader.indexBuffer = this._indexBuffer; + colorShader.prepare(); + colorShader.mMatrix = this.mMatrix; + colorShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + colorShader.vMatrix = this.vMatrices[viewport]; + colorShader.pMatrix = this.pMatrices[viewport]; + colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); } + } } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ktXb3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { + } + let AxesVisualBase$1 = class AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized; + } + get axes() { + return this._axes; + } + constructor(core) { + this._core = core; + this.isVisible = true; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + this._gl = gl; + } + update(elapsedTime) { + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { + } + _renderText() { + } + }; + let Cartesian2dVisual$1 = class Cartesian2dVisual extends AxesVisualBase$1 { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants$1.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"e0jpG","../../../../main.js":"f421K","../../../../constants.js":"lD0bG","../../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0jpG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { + }; + let Cartesian3dVisual$1 = class Cartesian3dVisual extends AxesVisualBase$1 { get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core){ - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; - } - update(elapsedTime) {} - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6CCj9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants$1.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"e0jpG","../../../../main.js":"f421K","../../../../constants.js":"lD0bG","../../../../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdGVP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -var _constantsJs = require("../../../constants.js"); -class ControllerVisual { + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + class ControllerVisual { get isInitialized() { - return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; + return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; } get controller() { - return this._controller; - } - constructor(core, main, controller){ - this._core = core; - this._main = main; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._controller = controller; - this._modelShader = main.modelShader; - this._colorShader = main.colorShader; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.rayMMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._controller; + } + constructor(core, main, controller) { + this._core = core; + this._main = main; + this._mMatrix = create$7(); + this._vec3 = create$6(); + this._controller = controller; + this._modelShader = main.modelShader; + this._colorShader = main.colorShader; + this.mMatrix = create$7(); + this.rayMMatrix = create$7(); + this.isVisible = true; } initializeContext(gl) { - if (!this._controller.isInitialized) this._controller.initialize(); - this._initialize(gl); + if (!this._controller.isInitialized) { + this._controller.initialize(); + } + this._initialize(gl); } _initialize(gl) { - this._gl = gl; - this.modelTexture = (0, _textureJs.TextureHelper).fromImage(gl, this._controller.texture, false, gl.LINEAR); - this._modelVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); - this._modelIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); - this._rayVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); - this._rayIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); - this._isInitialized = true; + this._gl = gl; + this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); + this._modelVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); + this._modelIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); + this._rayVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); + this._rayIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._modelShader.vertexBuffer = this._modelVertexBuffer; - this._modelShader.indexBuffer = this._modelIndexBuffer; - this._modelShader.texture2D = this.modelTexture; - this._modelShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); - this._modelShader.mMatrix = this._mMatrix; - this._modelShader.specularPower = 10; - this._modelShader.specularIntensity = 0.01; - this._modelShader.apply(); - this._modelShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._modelShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.halfAngle = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.vMatrix = this.vMatrices[viewport]; - this._modelShader.pMatrix = this.pMatrices[viewport]; - this._modelShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isRayVisible) { - this._colorShader.vertexBuffer = this._rayVertexBuffer; - this._colorShader.indexBuffer = this._rayIndexBuffer; - this._colorShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); - this._colorShader.mMatrix = this._mMatrix; - this._colorShader.apply(); - this._colorShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._colorShader.vMatrix = this.vMatrices[viewport]; - this._colorShader.pMatrix = this.pMatrices[viewport]; - this._colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); - } - } + if (this.isInitialized) { + this._modelShader.vertexBuffer = this._modelVertexBuffer; + this._modelShader.indexBuffer = this._modelIndexBuffer; + this._modelShader.texture2D = this.modelTexture; + this._modelShader.prepare(); + multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); + this._modelShader.mMatrix = this._mMatrix; + this._modelShader.specularPower = 10; + this._modelShader.specularIntensity = 0.01; + this._modelShader.apply(); + this._modelShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._modelShader.directionToLight = Constants$1.VECTOR3_UNITZ; + this._modelShader.halfAngle = Constants$1.VECTOR3_UNITZ; + this._modelShader.vMatrix = this.vMatrices[viewport]; + this._modelShader.pMatrix = this.pMatrices[viewport]; + this._modelShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isRayVisible) { + this._colorShader.vertexBuffer = this._rayVertexBuffer; + this._colorShader.indexBuffer = this._rayIndexBuffer; + this._colorShader.prepare(); + multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); + this._colorShader.mMatrix = this._mMatrix; + this._colorShader.apply(); + this._colorShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._colorShader.vMatrix = this.vMatrices[viewport]; + this._colorShader.pMatrix = this.pMatrices[viewport]; + this._colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); + } } + } } -} - -},{"gl-matrix":"5x28d","../../../helpers/texture.js":"bUoBU","../../../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2Sdg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { + } + let ImageVisual$1 = class ImageVisual { get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; + return this._isInitialized && this._main.textureShader.isInitialized; } get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._image; + } + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$7(); + this.isVisible = true; } initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - const shaderResources = this._main.shaderResources; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.isPickShader = false; - textureShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - textureShader.isPickShader = true; - textureShader.vMatrix = this.pickVMatrix; - textureShader.pMatrix = this.pickPMatrix; - textureShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + if (this.isInitialized) { + const textureShader = this._main.textureShader; + const shaderResources = this._main.shaderResources; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.isPickShader = false; + textureShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + textureShader.isPickShader = true; + textureShader.vMatrix = this.pickVMatrix; + textureShader.pMatrix = this.pickPMatrix; + textureShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); } + } } -} - -},{"gl-matrix":"5x28d","../../../helpers/texture.js":"bUoBU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5a9e1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { + }; + let LabelVisualBase$1 = class LabelVisualBase { get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; + } + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$7(); + this.mMatrix = create$7(); + this.isVisible = true; } initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - } + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } } + } } -} -class LabelVisual extends LabelVisualBase { + }; + let LabelVisual$1 = class LabelVisual extends LabelVisualBase$1 { get label() { - return this._label; + return this._label; } - set text(value) { - this._label.text = value; + set text(value2) { + this._label.text = value2; } get text() { - return this._label.text; + return this._label.text; } - constructor(core, main, label){ - super(core, main, label); + constructor(core, main, label2) { + super(core, main, label2); } -} -class LabelSetVisual extends LabelVisualBase { + }; + let LabelSetVisual$1 = class LabelSetVisual extends LabelVisualBase$1 { get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4v679":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { + return this._label; + } + constructor(core, main, label2) { + super(core, main, label2); + } + }; + let FontVisual$1 = class FontVisual { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get font() { - return this._font; + return this._font; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } } update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"bUoBU","../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bi5JS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + }; + let Lasso$2 = class Lasso { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const vertices = Quad$3.textured(Constants$1.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"../../../constants.js":"lD0bG","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gKCQy":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"gU7zw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gU7zw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _backgroundJs = require("./shaders/background.js"); -var _ssaoJs = require("./shaders/ssao.js"); -var _boxJs = require("./shaders/box.js"); -var _deferredJs = require("./shaders/deferred.js"); -var _combineJs = require("./shaders/combine.js"); -var _dofblurJs = require("./shaders/dofblur.js"); -var _downsampleJs = require("./shaders/downsample.js"); -var _gaussianJs = require("./shaders/gaussian.js"); -var _dofcombineJs = require("./shaders/dofcombine.js"); -var _fxaaJs = require("./shaders/fxaa.js"); -var _brightJs = require("./shaders/bright.js"); -var _angleJs = require("../../helpers/angle.js"); -var _pickJs = require("../../helpers/pick.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _fontJs = require("./font.js"); -var _mathJs = require("./../../helpers/math.js"); -var _constantsJs = require("../../constants.js"); -var _vertexJs = require("../../vertex.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _labelsJs = require("./components/labels.js"); -var _imageJs = require("./components/image.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + }; + var __awaiter$2 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { + }; + let Main$1 = class Main extends RendererBase { get shaderResources() { - return this._shaderResources; + return this._shaderResources; + } + get colorShader() { + return this._colorShader; } get textureShader() { - return this._textureShader; + return this._textureShader; } get lassoShader() { - return this._lassoShader; + return this._lassoShader; + } + get modelShader() { + return this._modelShader; } get sdfTextShader() { - return this._sdfTextShader; + return this._sdfTextShader; } get gridShader() { - return this._gridShader; + return this._gridShader; } get blockShader() { - return this._blockShader; + return this._blockShader; } get sphereShader() { - return this._sphereShader; + return this._sphereShader; } get cyclinderShader() { - return this._cylinderShader; + return this._cylinderShader; + } + get hexPrismShader() { + return this._hexPrismShader; } get sdfShader() { - return this._sdfShader; + return this._sdfShader; + } + get anaglyphShader() { + return this._anaglyphShader; } get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._position = (0, _glMatrix.vec3).create(); - this._direction = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.mat3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._shadowVMatrix = (0, _glMatrix.mat4).create(); - this._shadowPMatrix = (0, _glMatrix.mat4).create(); + return this._config; + } + constructor(options2) { + super(options2); + this._config = new Config$1(); + this._quad = new Quad$2(); + this._lasso = new Lasso$2(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$5(); + this._mat3 = create$8(); + this._directionToCamera = create$6(); + this._directionToLight = create$6(); + this._halfAngle = create$6(); + this._cameraPosition = create$6(); + this._modelPosition = create$6(); + this.depthEnabled = true; } get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + return this._createContext(document.createElement("canvas")) !== null; + } + get isWebXRSupported() { + return true; } initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._textureShader = new (0, _textureJs.Texture)(core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(core, this); - this._backgroundShader = new (0, _backgroundJs.Background)(core, this); - this._ssaoShader = new (0, _ssaoJs.Ssao)(core, this); - this._boxShader = new (0, _boxJs.Box)(core, this); - this._deferredShader = new (0, _deferredJs.Deferred)(core, this); - this._combineShader = new (0, _combineJs.Combine)(core, this); - this._dofBlurShader = new (0, _dofblurJs.DofBlur)(core, this); - this._downsampleShader = new (0, _downsampleJs.Downsample)(core, this); - this._gaussianShader = new (0, _gaussianJs.Gaussian)(core, this); - this._dofCombineShader = new (0, _dofcombineJs.DofCombine)(core, this); - this._fxaaShader = new (0, _fxaaJs.Fxaa)(core, this); - this._brightPassShader = new (0, _brightJs.Bright)(core, this); + super.initialize(core); + this._shaderResources = new Resources$1(); + this._colorShader = new Color$1(this._core, this); + this._textureShader = new Texture$1(this._core, this); + this._lassoShader = new Lasso$3(this._core, this); + this._modelShader = new Model(this._core, this); + this._sdfTextShader = new SdfText$1(this._core, this); + this._gridShader = new PickGrid$1(this._core, this); + this._anaglyphShader = new Anaglyph(this._core, this); + this._blockShader = new UnitBlock$1(this._core, this); + this._sphereShader = new UnitSphere$1(this._core, this); + this._cylinderShader = new UnitCylinder$1(this._core, this); + this._hexPrismShader = new UnitHexPrism(this._core, this); + this._sdfShader = new UnitSdf$1(this._core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + this._isInitialized = false; + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); this._isInitialized = true; + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; } _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); - const random = new (0, _mathJs.PseudoRandom)(0); - const _vec3 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._config.ssaoKernelSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - _vec3[2] = random.nextFloat(); - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - (0, _glMatrix.vec3).scale(_vec3, _vec3, random.nextFloat()); - let scale = i / this._config.ssaoKernelSize; - scale = (0, _mathJs.MathHelper).lerp(0.1, 1, scale * scale); - (0, _glMatrix.vec3).scale(_vec3, _vec3, scale); - this._ssaoSampleKernel[i * 3] = _vec3[0]; - this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; - this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; - } - const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); - _vec3[2] = 0; - for(let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - noise[i * 4] = _vec3[0]; - noise[i * 4 + 1] = _vec3[1]; - } - this._ssaoNoiseTexture = this._gl.createTexture(); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); - this._ssaoWidth = -1; - this._ssaoHeight = -1; - this._shadowWidth = -1; - this._shadowHeight = -1; - this._shaderResources.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._backgroundShader.initializeContext(this._gl); - this._ssaoShader.initializeContext(this._gl); - this._boxShader.initializeContext(this._gl); - this._deferredShader.initializeContext(this._gl); - this._combineShader.initializeContext(this._gl); - this._dofBlurShader.initializeContext(this._gl); - this._downsampleShader.initializeContext(this._gl); - this._gaussianShader.initializeContext(this._gl); - this._dofCombineShader.initializeContext(this._gl); - this._fxaaShader.initializeContext(this._gl); - this._brightPassShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._shaderResources.initializeContext(this._gl); + this._colorShader.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._modelShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._anaglyphShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._hexPrismShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._debugAxesVisual.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + this._anaglyphTextures = [null, null]; + this.anaglyphFramebuffers = [null, null]; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + for (let i = 0; i < this.controllers.length; i++) { + this.controllers[i].initializeContext(this._gl); + } + } + _resize(width2, height2) { + super._resize(width2, height2); + for (let i = 0; i < 2; i++) { + const texture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); const renderBuffer = this._gl.createRenderbuffer(); this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width2, height2); const framebuffer = this._gl.createFramebuffer(); this._shaderResources.bindFramebuffer(framebuffer); this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - this._positionTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); - this._colorTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._normalTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._geometryFrameBuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width, height); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._gl.drawBuffers([ - this._gl.COLOR_ATTACHMENT0, - this._gl.COLOR_ATTACHMENT1, - this._gl.COLOR_ATTACHMENT2 - ]); - this._postProcessTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); - this._postProcessTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); - this._postProcessDofTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); - this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); - const widthHalf = Math.round(width / 2); - const heightHalf = Math.round(height / 2); - this._postProcessHalfTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); - this._postProcessHalfTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - this._postProcessQuarterTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); - this._postProcessQuarterTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - this._postProcessEighthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); - this._postProcessEighthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); - const widthSixteenth = Math.round(widthEighth / 2); - const hgeightSixteenth = Math.round(heightEighth / 2); - this._postProcessSixteenthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); - this._postProcessSixteenthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + this._anaglyphTextures[i] = texture; + this.anaglyphFramebuffers[i] = framebuffer; + } + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); } _createContext(canvas) { - let supported = false; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - const options = { - stencil: true, - alpha: false, - antialias: false, - preserveDrawingBuffer: preserveDrawingBuffer - }; - const gl = canvas.getContext("webgl2", options); - if (gl) { - const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); - if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { - const texture = (0, _textureJs1.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); - const framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); - if (status == gl.FRAMEBUFFER_COMPLETE) supported = true; - gl.bindTexture(gl.TEXTURE_2D, null); - } - } - return supported ? gl : null; + const antialias = this._options ? this._options.antialias === void 0 ? true : this._options.antialias : true; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + return canvas.getContext("webgl", { + stencil: true, + alpha: true, + antialias, + preserveDrawingBuffer + }); } - prepare() { + initializeWebXR(session) { + const promise = new Promise((resolve2, reject) => { + this._gl.makeXRCompatible().then(() => { + session.updateRenderState({ + baseLayer: new XRWebGLLayer(session, this._gl), + depthNear: this._core.config.nearPlane, + depthFar: this._core.config.farPlane + }); + session.requestReferenceSpace("local").then((refSpace) => { + this._webXRReferenceSpace = refSpace; + resolve2(); + }); + }); + }); + return promise; + } + prepare(xrFrame) { + if (xrFrame) { + const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); + if (pose) { + const glLayer = xrFrame.session.renderState.baseLayer; + for (let i = 0; i < pose.views.length; i++) { + const view = pose.views[i]; + this.vMatrices[i] = view.transform.inverse.matrix; + this.inverseVMatrices[i] = view.transform.matrix; + multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); + this.mvMatrices[i] = this._mvMatrices[i]; + this.pMatrices[i] = view.projectionMatrix; + const viewport = glLayer.getViewport(view); + this._viewports[i].x = viewport.x; + this._viewports[i].y = viewport.y; + this._viewports[i].width = viewport.width; + this._viewports[i].height = viewport.height; + this._framebuffers[i] = glLayer.framebuffer; + } + } + this._viewportOffset = 0; + this._viewportCount = 2; + } else { let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - break; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + this._framebuffers[1] = null; + break; + case StereoMode.anaglyph: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = this.anaglyphFramebuffers[0]; + this._framebuffers[1] = this.anaglyphFramebuffers[1]; + break; + case StereoMode.split: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = this._canvas.width / 2; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = null; + this._framebuffers[1] = null; + break; } + } } createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; + const buffer = new TransitionBuffer$1(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createControllerVisual(controller) { + const visual = new ControllerVisual(this._core, this, controller); + visual.initializeContext(this._gl); + return visual; } createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + const visual = new Cartesian2dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + const visual = new Cartesian3dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); + _createDebugAxesVisual(debugAxes) { + return new DebugAxesVisual(this._core, this, debugAxes); + } + _createLabelVisual(label2) { + return new LabelVisual$1(this._core, this, label2); } createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; + const visual = new LabelSetVisual$1(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; + createImageVisual(image2) { + const visual = new ImageVisual$1(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; + createFontVisual(font2) { + const visual = new FontVisual$1(this._core, font2); + visual.initializeContext(this._gl); + return visual; } getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); + return this._canvas.toDataURL(mimeType); } - update(elapsedTime) { - super.update(elapsedTime); - if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { - this._shadowWidth = this._config.shadowWidth; - this._shadowHeight = this._config.shadowHeight; - this._shadowColorTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - this._shadowDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._shadowFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); - } - if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { - this._ssaoWidth = this._config.ssaoWidth; - this._ssaoHeight = this._config.ssaoHeight; - this._ssaoTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); - this._ssaoTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); - } - if (this._config.isDofEnabled && this._config.dofAutoFocus) { - this._core.getModelManipulationOrigin(this._modelManipulationOrigin); - this._core.getModelPosition(this._modelPosition); - (0, _glMatrix.vec3).add(this._position, this._modelManipulationOrigin, this._modelPosition); - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.vec3).subtract(this._position, this._position, this._cameraPosition); - const distance = -this._position[2]; - const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); - this._config.dofFocusDistance = (0, _mathJs.MathHelper).lerp(this._config.dofFocusDistance, distance, amount); + render(elapsedTime, xrFrame) { + return __awaiter$2(this, void 0, void 0, function* () { + if (this.depthEnabled) { + this._gl.enable(this._gl.DEPTH_TEST); + } else { + this._gl.disable(this._gl.DEPTH_TEST); } - } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - this._gl.enable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.cullFace(this._gl.BACK); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); - if (this.config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.clear(this._gl.DEPTH_BUFFER_BIT); - (0, _glMatrix.mat4).perspective(this._shadowPMatrix, (0, _angleJs.AngleHelper).degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, this.inverseVMatrices[0]); - (0, _glMatrix.vec3).transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); - (0, _glMatrix.vec3).add(this._position, this._position, this._modelPosition); - (0, _glMatrix.mat4).lookAt(this._shadowVMatrix, this._position, this._modelPosition, (0, _constantsJs.Constants).VECTOR3_UNITY); - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(transitionBuffer); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.geometryFramebuffer = this._geometryFrameBuffer; - axesVisual.render(elapsedTime); - } - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; - labelSetVisual.render(elapsedTime); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.geometryFramebuffer = this._geometryFrameBuffer; - imageVisual.render(elapsedTime); - } - } - if (this._backgroundShader.isInitialized) { - this._backgroundShader.prepare(); - this._backgroundShader.color = (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._backgroundShader.apply(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._gl.bindVertexArray(null); - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { - const viewport = this._viewportOffset; - this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - }); - } - _renderTransitionBuffer(transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = currentBuffer.from; - this._blockShader.rangeMax = currentBuffer.to; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._blockShader.vMatrix = this.vMatrices[viewport]; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = true; - this._blockShader.vMatrix = this._shadowVMatrix; - this._blockShader.pMatrix = this._shadowPMatrix; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.isShadowMap = false; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = currentBuffer.from; - this._sphereShader.rangeMax = currentBuffer.to; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sphereShader.vMatrix = this.vMatrices[viewport]; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = true; - this._sphereShader.vMatrix = this._shadowVMatrix; - this._sphereShader.pMatrix = this._shadowPMatrix; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.isShadowMap = false; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = currentBuffer.from; - this._cylinderShader.rangeMax = currentBuffer.to; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._cylinderShader.vMatrix = this.vMatrices[viewport]; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = true; - this._cylinderShader.vMatrix = this._shadowVMatrix; - this._cylinderShader.pMatrix = this._shadowPMatrix; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.isShadowMap = false; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = currentBuffer.from; - this._sdfShader.rangeMax = currentBuffer.to; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sdfShader.vMatrix = this.vMatrices[viewport]; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = true; - this._sdfShader.vMatrix = this._shadowVMatrix; - this._sdfShader.pMatrix = this._shadowPMatrix; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.isShadowMap = false; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } + this._gl.enable(this._gl.CULL_FACE); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); + if (xrFrame) { + const glLayer = xrFrame.session.renderState.baseLayer; + this._shaderResources.bindFramebuffer(glLayer.framebuffer); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else if (this._core.config.stereoMode == StereoMode.anaglyph) { + for (let i = 0; i < 2; i++) { + this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else { + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); } - } - _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { - if (this._deferredShader.isInitialized) { - this._gl.disable(this._gl.DEPTH_TEST); - let ssaoTexture; - if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { - this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); - ssaoTexture = this._ssaoTexture1; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); - this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; - this._ssaoShader.indexBuffer = this._quad.indexBuffer; - this._ssaoShader.texture2D1 = this._positionTexture; - this._ssaoShader.texture2D2 = this._normalTexture; - this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; - this._ssaoShader.prepare(); - this._ssaoShader.pMatrix = pMatrix; - this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; - this._ssaoShader.ssaoRadius = this._config.ssaoRadius; - this._ssaoShader.ssaoPower = this._config.ssaoPower; - this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; - this._ssaoShader.left = 0; - this._ssaoShader.top = 0; - this._ssaoShader.width = this._config.ssaoWidth; - this._ssaoShader.height = this._config.ssaoHeight; - this._ssaoShader.apply(); - this._ssaoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { - ssaoTexture = this._ssaoTexture2; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); - this._boxShader.vertexBuffer = this._quad.vertexBuffer; - this._boxShader.indexBuffer = this._quad.indexBuffer; - this._boxShader.texture2D = this._ssaoTexture1; - this._boxShader.prepare(); - this._boxShader.left = 0; - this._boxShader.top = 0; - this._boxShader.width = this._config.ssaoWidth; - this._boxShader.height = this._config.ssaoHeight; - this._boxShader.apply(); - this._boxShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); - let postProcessFrameBuffer = this._postProcessFrameBuffer1; - this._shaderResources.bindFramebuffer(postProcessFrameBuffer); - this._deferredShader.vertexBuffer = this._quad.vertexBuffer; - this._deferredShader.indexBuffer = this._quad.indexBuffer; - this._deferredShader.texture2D1 = this._positionTexture; - this._deferredShader.texture2D2 = this._colorTexture; - this._deferredShader.texture2D3 = this._normalTexture; - this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; - this._deferredShader.texture2D5 = this._shadowDepthTexture; - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); - this._deferredShader.prepare(); - this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; - this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; - this._deferredShader.inverseVMatrix = inverseVMatrix; - this._deferredShader.shadowVMatrix = this._shadowVMatrix; - this._deferredShader.shadowPMatrix = this._shadowPMatrix; - this._deferredShader.vMatrix = vMatrix; - this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; - this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; - this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, vMatrix); - (0, _glMatrix.vec3).set(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).normalize(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); - (0, _glMatrix.vec3).subtract(this._direction, this._cameraPosition, this._position); - (0, _glMatrix.vec3).normalize(this._direction, this._direction); - (0, _glMatrix.vec3).add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); - (0, _glMatrix.vec3).normalize(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); - this._deferredShader.left = viewport.left; - this._deferredShader.top = viewport.top; - this._deferredShader.width = viewport.width; - this._deferredShader.height = viewport.height; - this._deferredShader.shadowMapWidth = this._config.shadowWidth; - this._deferredShader.shadowMapHeight = this._config.shadowHeight; - this._deferredShader.ambientIntensity = this._config.ambientIntensity; - this._deferredShader.materialIntensity = this._config.materialIntensity; - this._deferredShader.specularPower = this._config.specularPower; - this._deferredShader.specularIntensity = this._config.specularIntensity; - this._deferredShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - const widthHalf = Math.round(viewport.width / 2); - const heightHalf = Math.round(viewport.height / 2); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - const widthSixteenth = Math.round(widthEighth / 2); - const heightSixteenth = Math.round(heightEighth / 2); - if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; - this._dofBlurShader.indexBuffer = this._quad.indexBuffer; - this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofBlurShader.texture2D2 = this._positionTexture; - this._dofBlurShader.prepare(); - this._dofBlurShader.focusDepth = this._config.dofFocusDistance; - this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; - this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; - this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; - this._dofBlurShader.left = viewport.left; - this._dofBlurShader.top = viewport.top; - this._dofBlurShader.width = viewport.width; - this._dofBlurShader.height = viewport.height; - this._dofBlurShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; - this._dofCombineShader.indexBuffer = this._quad.indexBuffer; - this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofCombineShader.texture2D2 = this._postProcessDofTexture; - this._dofCombineShader.prepare(); - this._dofCombineShader.focusDepth = this._config.dofFocusDistance; - this._dofCombineShader.left = viewport.left; - this._dofCombineShader.top = viewport.top; - this._dofCombineShader.width = viewport.width; - this._dofCombineShader.height = viewport.height; - this._dofCombineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthHalf; - this._brightPassShader.height = heightHalf; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessHalfTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthQuarter; - this._brightPassShader.height = heightQuarter; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessQuarterTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthEighth; - this._brightPassShader.height = heightEighth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessEighthTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthSixteenth; - this._brightPassShader.height = heightSixteenth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessHalfTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthHalf; - this._gaussianShader.height = heightHalf; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessHalfTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessQuarterTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthQuarter; - this._gaussianShader.height = heightQuarter; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessQuarterTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessEighthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthEighth; - this._gaussianShader.height = heightEighth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessEighthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthSixteenth; - this._gaussianShader.height = heightSixteenth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._core.config.isDebugVisible) { + this._debugAxesVisual.framebuffers = this._framebuffers; + this._debugAxesVisual.render(elapsedTime, xrFrame); + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.framebuffers = this._framebuffers; + axesVisual.render(elapsedTime, xrFrame); } - if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; - this._fxaaShader.indexBuffer = this._quad.indexBuffer; - this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._fxaaShader.prepare(); - this._fxaaShader.left = viewport.left; - this._fxaaShader.top = viewport.top; - this._fxaaShader.width = viewport.width; - this._fxaaShader.height = viewport.height; - this._fxaaShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(xrFrame, transitionBuffer); + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.framebuffers = this._framebuffers; + labelSetVisual.render(elapsedTime, xrFrame); } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.framebuffers = this._framebuffers; + imageVisual.pickFramebuffer = this._pickFrameBuffer; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.render(elapsedTime, xrFrame); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + controllerVisual.isRayVisible = this.isPickingEnabled; + controllerVisual.framebuffers = this._framebuffers; + controllerVisual.render(elapsedTime, xrFrame); + } + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + if (this._isCapturingPickImage && this.capturePickImageCallback) { + this._isCapturingPickImage = false; + const data2 = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); + this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data2); + for (let i = 0; i < data2.length / 4; i++) { + if (data2[i * 4 + 3] == PickType.data) { + data2[i * 4 + 3] = 255; + } else { + data2[i * 4] = 0; + data2[i * 4 + 1] = 0; + data2[i * 4 + 2] = 0; + data2[i * 4 + 3] = 0; + } + } + const length2 = this._core.config.pickWidth * this._core.config.pickHeight * 4; + const row = this._core.config.pickWidth * 4; + const end = (this._core.config.pickHeight - 1) * row; + const flipped = new Uint8ClampedArray(length2); + for (let i = 0; i < length2; i += row) { + flipped.set(data2.subarray(i, i + row), end - i); + } + this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); + } + } else { + set$7(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._combineShader.vertexBuffer = this._quad.vertexBuffer; - this._combineShader.indexBuffer = this._quad.indexBuffer; - this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - if (this._config.isBloomEnabled) { - this._combineShader.texture2D2 = this._postProcessHalfTexture1; - this._combineShader.texture2D3 = this._postProcessQuarterTexture1; - this._combineShader.texture2D4 = this._postProcessEighthTexture1; - this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; - } else { - this._combineShader.texture2D2 = null; - this._combineShader.texture2D3 = null; - this._combineShader.texture2D4 = null; - this._combineShader.texture2D5 = null; - } - this._combineShader.prepare(); - this._combineShader.viewport = viewport; - this._combineShader.intensity = this._config.bloomIntensity; - this._combineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { + this._shaderResources.bindFramebuffer(null); + this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); + this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; + this._anaglyphShader.indexBuffer = this._quad.indexBuffer; + this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; + this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; + this._anaglyphShader.prepare(); + this._anaglyphShader.viewport = this._viewports[0]; + this._anaglyphShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + }); + } + _renderTransitionBuffer(xrFrame, transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = 0; + this._blockShader.rangeMax = transitionBuffer.length - 1; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.selectedColor = this._core.config.selectionColor; + this._blockShader.hoverColor = this._core.config.hoverColor; + this._blockShader.activeColor = this._core.config.activeColor; + this._blockShader.highlightMode = this._core.config.highlightMode; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.ambient = this._config.ambient; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._blockShader.directionToLight = this._directionToLight; + this._blockShader.halfAngle = this._halfAngle; + } else { + this._blockShader.directionToLight = this._config.directionToLight; + this._blockShader.halfAngle = this._config.halfAngle; + } + this._blockShader.vMatrix = vMatrix; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = 0; + this._sphereShader.rangeMax = transitionBuffer.length - 1; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.selectedColor = this._core.config.selectionColor; + this._sphereShader.hoverColor = this._core.config.hoverColor; + this._sphereShader.activeColor = this._core.config.activeColor; + this._sphereShader.highlightMode = this._core.config.highlightMode; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.ambient = this._config.ambient; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sphereShader.directionToLight = this._directionToLight; + this._sphereShader.halfAngle = this._halfAngle; + } else { + this._sphereShader.directionToLight = this._config.directionToLight; + this._sphereShader.halfAngle = this._config.halfAngle; + } + this._sphereShader.vMatrix = vMatrix; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = 0; + this._cylinderShader.rangeMax = transitionBuffer.length - 1; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.selectedColor = this._core.config.selectionColor; + this._cylinderShader.hoverColor = this._core.config.hoverColor; + this._cylinderShader.activeColor = this._core.config.activeColor; + this._cylinderShader.highlightMode = this._core.config.highlightMode; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.ambient = this._config.ambient; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._cylinderShader.directionToLight = this._directionToLight; + this._cylinderShader.halfAngle = this._halfAngle; + } else { + this._cylinderShader.directionToLight = this._config.directionToLight; + this._cylinderShader.halfAngle = this._config.halfAngle; + } + this._cylinderShader.vMatrix = vMatrix; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { + this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; + this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._hexPrismShader.prepare(); + this._hexPrismShader.mMatrix = this.mMatrix; + this._hexPrismShader.time = this.transitionTime; + this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._hexPrismShader.rangeMin = 0; + this._hexPrismShader.rangeMax = transitionBuffer.length - 1; + this._hexPrismShader.hover = hoverId; + this._hexPrismShader.active = activeId; + this._hexPrismShader.selectedColor = this._core.config.selectionColor; + this._hexPrismShader.hoverColor = this._core.config.hoverColor; + this._hexPrismShader.activeColor = this._core.config.activeColor; + this._hexPrismShader.highlightMode = this._core.config.highlightMode; + this._hexPrismShader.specularPower = this._config.specularPower; + this._hexPrismShader.specularIntensity = this._config.specularIntensity; + this._hexPrismShader.ambient = this._config.ambient; + this._hexPrismShader.apply(); + this._hexPrismShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._hexPrismShader.directionToLight = this._directionToLight; + this._hexPrismShader.halfAngle = this._halfAngle; + } else { + this._hexPrismShader.directionToLight = this._config.directionToLight; + this._hexPrismShader.halfAngle = this._config.halfAngle; + } + this._hexPrismShader.vMatrix = vMatrix; + this._hexPrismShader.pMatrix = this.pMatrices[viewport]; + this._hexPrismShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._hexPrismShader.isPickShader = true; + this._hexPrismShader.pMatrix = this.pickPMatrix; + this._hexPrismShader.vMatrix = this.pickVMatrix; + this._hexPrismShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = 0; + this._sdfShader.rangeMax = transitionBuffer.length - 1; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.selectedColor = this._core.config.selectionColor; + this._sdfShader.hoverColor = this._core.config.hoverColor; + this._sdfShader.activeColor = this._core.config.activeColor; + this._sdfShader.highlightMode = this._core.config.highlightMode; + this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 255; + this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.ambient = this._config.ambient; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sdfShader.directionToLight = this._directionToLight; + this._sdfShader.halfAngle = this._halfAngle; + } else { + this._sdfShader.directionToLight = this._config.directionToLight; + this._sdfShader.halfAngle = this._config.halfAngle; + } + this._sdfShader.vMatrix = vMatrix; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } + } } -} - -},{"gl-matrix":"5x28d","../../main.js":"f421K","../renderer.js":"8zmPQ","./components/quad.js":"dAFCJ","./buffer.js":"i3lUV","./config.js":"btHxw","./shaders/shader.js":"f1nVl","./shaders/texture.js":"kb7uV","./shaders/lasso.js":"3XY2K","./shaders/sdftext.js":"9eKN6","./shaders/pickgrid.js":"dPLtS","./shaders/unitblock.js":"arj7Q","./shaders/unitsphere.js":"idlJV","./shaders/unitcylinder.js":"kG3Ma","./shaders/unitsdf.js":"eIwH3","./shaders/background.js":"j1a66","./shaders/ssao.js":"8V9Nh","./shaders/box.js":"6rVqd","./shaders/deferred.js":"jNY1W","./shaders/combine.js":"7jcRQ","./shaders/dofblur.js":"aFGoZ","./shaders/downsample.js":"emlyC","./shaders/gaussian.js":"5Fqo6","./shaders/dofcombine.js":"kBlwc","./shaders/fxaa.js":"9Vj9y","./shaders/bright.js":"3saQu","../../helpers/angle.js":"53hwW","../../helpers/pick.js":"1t2sb","./components/axes/cartesian2d.js":"ewMaB","./components/axes/cartesian3d.js":"h51do","./font.js":"8IUfH","./../../helpers/math.js":"f65d0","../../constants.js":"lD0bG","../../vertex.js":"4J2YE","../../helpers/texture.js":"bUoBU","./components/labels.js":"lrIn9","./components/image.js":"492tj","./components/lasso.js":"7Nt0P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dAFCJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { + }; + let Quad$1 = class Quad { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$7(); + fromScaling(_mat4, _vec3); + const vertices = Quad$3.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"gl-matrix":"5x28d","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i3lUV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - get vertexBuffer() { - return this._vertexBuffer; + }; + class Atlas extends AtlasBase { + get texture() { + return this._texture; } - constructor(core, ids){ - super(core, ids); + get defaultTexture() { + return this._defaultTexture; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } } -} - -},{"../../buffer.js":"itbJk","../../main.js":"f421K","./atlas.js":"3SMAz","./palette.js":"cjVUn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3SMAz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + } + let Palette$1 = class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../atlas.js":"2peXi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cjVUn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { - get texture() { - return this._texture; + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } } - get defaultTexture() { - return this._defaultTexture; + }; + let Buffer$1 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + constructor(core, ids) { + super(core, ids); + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../palette.js":"hZb65","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"btHxw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { + }; + class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$1, Palette$1, Atlas); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + } + class Config extends RendererConfig { get keyLightAltitude() { - return this._keyLightAltitude; + return this._keyLightAltitude; } - set keyLightAltitude(value) { - this._keyLightAltitude = value; - this._updateLights(); + set keyLightAltitude(value2) { + this._keyLightAltitude = value2; + this._updateLights(); } get keyLightAzimuth() { - return this._keyLightAzimuth; + return this._keyLightAzimuth; } - set keyLightAzimuth(value) { - this._keyLightAzimuth = value; - this._updateLights(); + set keyLightAzimuth(value2) { + this._keyLightAzimuth = value2; + this._updateLights(); } get keyLightDistance() { - return this._keyLightDistance; + return this._keyLightDistance; } - set keyLightDistance(value) { - this._keyLightDistance = value; - this._updateLights(); + set keyLightDistance(value2) { + this._keyLightDistance = value2; + this._updateLights(); } get fillLight1Altitude() { - return this._fillLight1Altitude; + return this._fillLight1Altitude; } - set fillLight1Altitude(value) { - this._fillLight1Altitude = value; - this._updateLights(); + set fillLight1Altitude(value2) { + this._fillLight1Altitude = value2; + this._updateLights(); } get fillLight1Azimuth() { - return this._fillLight1Azimuth; + return this._fillLight1Azimuth; } - set fillLight1Azimuth(value) { - this._fillLight1Azimuth = value; - this._updateLights(); + set fillLight1Azimuth(value2) { + this._fillLight1Azimuth = value2; + this._updateLights(); } get fillLight2Altitude() { - return this._fillLight2Altitude; + return this._fillLight2Altitude; } - set fillLight2Altitude(value) { - this._fillLight2Altitude = value; - this._updateLights(); + set fillLight2Altitude(value2) { + this._fillLight2Altitude = value2; + this._updateLights(); } get fillLight2Azimuth() { - return this._fillLight2Azimuth; + return this._fillLight2Azimuth; } - set fillLight2Azimuth(value) { - this._fillLight2Azimuth = value; - this._updateLights(); + set fillLight2Azimuth(value2) { + this._fillLight2Azimuth = value2; + this._updateLights(); } - constructor(){ - super(); - this._rotation = (0, _glMatrix.quat).create(); - this.keyLightPosition = (0, _glMatrix.vec3).create(); - this.fillLight1Position = (0, _glMatrix.vec3).create(); - this.fillLight2Position = (0, _glMatrix.vec3).create(); - this.reset(); + constructor() { + super(); + this._rotation = create$4(); + this.keyLightPosition = create$6(); + this.fillLight1Position = create$6(); + this.fillLight2Position = create$6(); + this.reset(); } _updateLights() { - this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); - this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); - this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); + this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); + this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); + this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); } - _updateLight(altitude, azimuth, distance, position) { - (0, _glMatrix.quat).rotateY(this._rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, (0, _angleJs.AngleHelper).degreesToRadians(azimuth)); - (0, _glMatrix.quat).rotateX(this._rotation, this._rotation, (0, _angleJs.AngleHelper).degreesToRadians(-altitude)); - (0, _glMatrix.vec3).transformQuat(position, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._rotation); - (0, _glMatrix.vec3).scale(position, position, distance); + _updateLight(altitude, azimuth, distance2, position2) { + rotateY(this._rotation, Constants$1.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); + rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); + transformQuat(position2, Constants$1.VECTOR3_UNITZ, this._rotation); + scale$5(position2, position2, distance2); } reset() { - this.isSsaoEnabled = true; - this.ssaoWidth = 1024; - this.ssaoHeight = 1024; - this.ssaoBlurEnabled = true; - this.ssaoKernelSize = 8; - this.ssaoNoiseSize = 4; - this.ssaoRadius = 0.02; - this.ssaoPower = 1; - this.isShadowEnabled = true; - this.shadowWidth = 1024; - this.shadowHeight = 1024; - this.isDofEnabled = false; - this.dofAutoFocus = true; - this.dofFocusDistance = 0.5; - this.dofFocusRange = 0.5; - this.dofMaxBackgroundBlur = 0.75; - this.isBloomEnabled = false; - this.bloomIntensity = 2; - this.specularIntensity = 0.15; - this.specularPower = 150; - this.ambientIntensity = 0.1; - this.materialIntensity = 0.5; - this.keyLightIntensity = 1.5; - this.fillLight1Intensity = 0.25; - this.fillLight2Intensity = 0.25; - this._keyLightAltitude = 30; - this._keyLightAzimuth = -45; - this._keyLightDistance = 1; - this._fillLight1Altitude = 30; - this._fillLight1Azimuth = 45; - this._fillLight2Altitude = 30; - this._fillLight2Azimuth = -135; - this._updateLights(); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../helpers/angle.js":"53hwW","../renderer.js":"8zmPQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f1nVl":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.isSsaoEnabled = true; + this.ssaoWidth = 1024; + this.ssaoHeight = 1024; + this.ssaoBlurEnabled = true; + this.ssaoKernelSize = 8; + this.ssaoNoiseSize = 4; + this.ssaoRadius = 0.02; + this.ssaoPower = 1; + this.isShadowEnabled = true; + this.shadowWidth = 1024; + this.shadowHeight = 1024; + this.isDofEnabled = false; + this.dofAutoFocus = true; + this.dofFocusDistance = 0.5; + this.dofFocusRange = 0.5; + this.dofMaxBackgroundBlur = 0.75; + this.isBloomEnabled = false; + this.bloomIntensity = 2; + this.specularIntensity = 0.15; + this.specularPower = 150; + this.ambientIntensity = 0.1; + this.materialIntensity = 0.5; + this.keyLightIntensity = 1.5; + this.fillLight1Intensity = 0.25; + this.fillLight2Intensity = 0.25; + this._keyLightAltitude = 30; + this._keyLightAzimuth = -45; + this._keyLightDistance = 1; + this._fillLight1Altitude = 30; + this._fillLight1Azimuth = 45; + this._fillLight2Altitude = 30; + this._fillLight2Azimuth = -135; + this._updateLights(); + this.isFxaaEnabled = false; + } + } + class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.OES_texture_float = gl.getExtension("OES_texture_float"); - this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "background.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.OES_texture_float = gl.getExtension("OES_texture_float"); + this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + } + Resources.glsl = { + "background.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n', "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", - "deferred.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n", + "deferred.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n', "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", - "fxaa.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n", + "fxaa.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n', "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", - "lasso.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "pickgrid.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n", + "pickgrid.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n', "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", - "texture.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n", + "texture.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n', "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitblock.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitcylinder.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n", - "unitsdf.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitsphere.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitblock.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitcylinder.vertex.fx": '#version 300 es\n#include "common.include.fx"\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n', + "unitsdf.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitsphere.vertex.fx": '#version 300 es\n#include "common.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.x+rd.x*h)<size.x ) t = h;\n}\n}\n{\nfloat a = dd.z + dd.x;\nfloat b = od.z + od.x;\nfloat c = oo.z + oo.x - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.y+rd.y*h)<size.y ) t = h;\n}\n}\n{\nfloat a = dd.x + dd.y;\nfloat b = od.x + od.y;\nfloat c = oo.x + oo.y - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.z+rd.z*h)<size.z ) t = h;\n}\n}\nif( t>1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); + } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"dvdia","../../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kb7uV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + } + class Texture extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3XY2K":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let Lasso$1 = class Lasso extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9eKN6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + }; + class SdfText extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dPLtS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class PickGrid extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"arj7Q":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dMP7E":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + } + class UnitShader extends ShaderBase { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); } _updateCurrentBuffer() { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); } _updatePreviousBuffer() { - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); } updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._translationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); - this._gl.vertexAttribDivisor(this._scaleAttribute, 0); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); - this._gl.vertexAttribDivisor(this._colorAttribute, 0); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); - this._gl.vertexAttribDivisor(this._selectedAttribute, 0); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); - this._gl.vertexAttribDivisor(this._orderAttribute, 0); - this._gl.vertexAttribDivisor(this._idAttribute, 0); - this._gl.vertexAttribDivisor(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"f1nVl","../../../meshes/cube.js":"79I5N","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"idlJV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._translationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); + this._gl.vertexAttribDivisor(this._scaleAttribute, 0); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); + this._gl.vertexAttribDivisor(this._colorAttribute, 0); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); + this._gl.vertexAttribDivisor(this._selectedAttribute, 0); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); + this._gl.vertexAttribDivisor(this._orderAttribute, 0); + this._gl.vertexAttribDivisor(this._idAttribute, 0); + this._gl.vertexAttribDivisor(this._idColorAttribute, 0); + } + } + class UnitBlock extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kG3Ma":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSphere extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + } + class UnitCylinder extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eIwH3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSdf extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j1a66":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Background", ()=>Background); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _quadJs = require("../components/quad.js"); -class Background extends (0, _shaderJs.ShaderBase) { - constructor(core, main){ - super(core, main); - this._quad = new (0, _quadJs.Quad)(); + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); + } + } + class Background extends ShaderBase { + constructor(core, main) { + super(core, main); + this._quad = new Quad$1(); } initializeContext(gl) { - super.initializeContext(gl); - this._quad.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + this._quad.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._isInitialized = true; - this._vao = gl.createVertexArray(); - gl.bindVertexArray(this._vao); - gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); - gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - gl.enableVertexAttribArray(this._positionAttribute); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); - gl.bindVertexArray(null); + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._isInitialized = true; + this._vao = gl.createVertexArray(); + gl.bindVertexArray(this._vao); + gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); + gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + gl.enableVertexAttribArray(this._positionAttribute); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); + gl.bindVertexArray(null); } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._colorUniform, this.color); } updateBuffers() { - super.updateBuffers(); - this._gl.bindVertexArray(this._vao); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","../components/quad.js":"dAFCJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8V9Nh":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ssao", ()=>Ssao); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Ssao extends (0, _shaderJs.ShaderBase) { + super.updateBuffers(); + this._gl.bindVertexArray(this._vao); + } + } + class Ssao extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); - this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); - this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); - this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); + this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); + this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); + this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); - this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); - this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); - this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); + this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); + this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); + this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); } applyView() { - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6rVqd":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Box", ()=>Box); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Box extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + class Box extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jNY1W":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Deferred", ()=>Deferred); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _glMatrix = require("gl-matrix"); -class Deferred extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Deferred extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } - constructor(core, main){ - super(core, main); - this.directionToKeyLight = (0, _glMatrix.vec3).create(); - this.directionToFillLight1 = (0, _glMatrix.vec3).create(); - this.directionToFillLight2 = (0, _glMatrix.vec3).create(); - this.keyLightHalfAngle = (0, _glMatrix.vec3).create(); + constructor(core, main) { + super(core, main); + this.directionToKeyLight = create$6(); + this.directionToFillLight1 = create$6(); + this.directionToFillLight2 = create$6(); + this.keyLightHalfAngle = create$6(); } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); - this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); - this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); - this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); - this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); - this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); - this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); - this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); - this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); - this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); - this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); - this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); - this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); + this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); + this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); + this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); + this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); + this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); + this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); + this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); + this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); + this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); + this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); + this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); + this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); - this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); - this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); - this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); - this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); - this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); - this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); - this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); - this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); - this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); - this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); - this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); - this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); + this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); + this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); + this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); + this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); + this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); + this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); + this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); + this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); + this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); + this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); + this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); + this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); + this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7jcRQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Combine", ()=>Combine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Combine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class Combine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1f(this._intensityUniform, this.intensity); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1f(this._intensityUniform, this.intensity); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aFGoZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofBlur", ()=>DofBlur); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofBlur extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class DofBlur extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); - this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); - this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); + this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); + this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); - this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); - this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); + this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); + this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"emlyC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Downsample", ()=>Downsample); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Downsample extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + } + } + class Downsample extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Fqo6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Gaussian", ()=>Gaussian); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Gaussian extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Gaussian extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBlwc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofCombine", ()=>DofCombine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofCombine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class DofCombine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._apertureUniform, this.aperture); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._apertureUniform, this.aperture); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Vj9y":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fxaa", ()=>Fxaa); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Fxaa extends (0, _shaderJs.ShaderBase) { - get texture2D() { - return this._texture2D; - } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3saQu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bright", ()=>Bright); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Bright extends (0, _shaderJs.ShaderBase) { + } + class Fxaa extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewMaB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); + } + class Bright extends ShaderBase { + get texture2D() { + return this._texture2D; } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } } - _renderText() { - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._isInitialized = true; } - _renderGrid() { - const gridShader = this._main.gridShader; - const axes = this._axes; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); - } - this._gl.enable(this._gl.CULL_FACE); + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); } - _renderGridTicks(axisId, edgeId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - _renderGridFace(faceId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"fFTxg","../../../../main.js":"f421K","../../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fFTxg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class AxesVisualBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get axes() { - return this._axes; + return this._axes; } - constructor(core){ - this._core = core; - this.isVisible = true; + constructor(core) { + this._core = core; + this.isVisible = true; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h51do":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { + } + _renderText() { + } + } + class Cartesian2dVisual extends AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const gridShader = this._main.gridShader; + const axes = this._axes; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"fFTxg","../../../../main.js":"f421K","../../../../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8IUfH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { + } + class Cartesian3dVisual extends AxesVisualBase { get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"bUoBU","../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lrIn9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { - get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } - initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); shader.applyModel(); shader.isPickShader = false; - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + } } + } } -} -class LabelVisual extends LabelVisualBase { - get label() { - return this._label; - } - set text(value) { - this._label.text = value; - } - get text() { - return this._label.text; - } - constructor(core, main, label){ - super(core, main, label); - } -} -class LabelSetVisual extends LabelVisualBase { - get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"492tj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { - get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; - } - get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.apply(); - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } -} - -},{"gl-matrix":"5x28d","../../../helpers/texture.js":"bUoBU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Nt0P":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { - get isInitialized() { - return this._isInitialized; + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - get vertexBuffer() { - return this._vertexBuffer; + } + class FontVisual { + get isInitialized() { + return this._isInitialized; } - get indexBuffer() { - return this._indexBuffer; + get font() { + return this._font; } - get indexCount() { - return this._indexCount; + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } -} - -},{"../../../constants.js":"lD0bG","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2SNte":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -parcelHelpers.export(exports, "Material", ()=>(0, _materialJs.Material)); -parcelHelpers.export(exports, "MetalMaterial", ()=>(0, _materialJs.MetalMaterial)); -parcelHelpers.export(exports, "GlossyMaterial", ()=>(0, _materialJs.GlossyMaterial)); -parcelHelpers.export(exports, "VarnishMaterial", ()=>(0, _materialJs.VarnishMaterial)); -parcelHelpers.export(exports, "LambertianMaterial", ()=>(0, _materialJs.LambertianMaterial)); -parcelHelpers.export(exports, "DielectricMaterial", ()=>(0, _materialJs.DielectricMaterial)); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>(0, _materialJs.DiffuseLightMaterial)); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>(0, _materialJs.IsotropicMaterial)); -parcelHelpers.export(exports, "Texture", ()=>(0, _textureJs.Texture)); -parcelHelpers.export(exports, "SolidColorTexture", ()=>(0, _textureJs.SolidColorTexture)); -parcelHelpers.export(exports, "ImageTexture", ()=>(0, _textureJs.ImageTexture)); -parcelHelpers.export(exports, "CheckerTexture", ()=>(0, _textureJs.CheckerTexture)); -parcelHelpers.export(exports, "GridTexture", ()=>(0, _textureJs.GridTexture)); -parcelHelpers.export(exports, "Light", ()=>(0, _lightJs.Light)); -parcelHelpers.export(exports, "SphereLight", ()=>(0, _lightJs.SphereLight)); -parcelHelpers.export(exports, "RectLight", ()=>(0, _lightJs.RectLight)); -parcelHelpers.export(exports, "Ground", ()=>(0, _groundJs.Ground)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -var _mainJs = require("./main.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _groundJs = require("./ground.js"); -var _constantsJs = require("./constants.js"); - -},{"./main.js":"dfh4e","./material.js":"jQJhi","./texture.js":"5NgmA","./light.js":"2sMdC","./ground.js":"54e1Z","./constants.js":"6DWH0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfh4e":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _mainJs = require("../../main.js"); -var _configJs = require("./config.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _raytraceJs = require("./shaders/raytrace.js"); -var _fullscreenquadJs = require("./shaders/fullscreenquad.js"); -var _bvhJs = require("./bvh.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _fontJs = require("./font.js"); -var _imageJs = require("./image.js"); -var _labelsJs = require("./labels.js"); -var _bufferJs = require("./buffer.js"); -var _constantsJs1 = require("./constants.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get frameCount() { - return this._frameCount; - } - get duration() { - return this._duration; - } - get config() { - return this._config; - } - set lights(value) { - if (value != this._lights) { - this._lights = value; - this._haveLightsChanged = true; - this._frameCount = 0; - } - } - get lights() { - return this._lights; - } - restart() { - this._frameCount = 0; - this._core.start(); - } - constructor(options){ - super(options); - (0, _glMatrix.glMatrix).setMatrixArrayType(Float32Array); - this._config = new (0, _configJs.Config)(); - this._frameCount = 0; - this._duration = 0; - this._position = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._manipulationOrigin = (0, _glMatrix.vec3).create(); - this._backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } } - initialize(core) { - super.initialize(core); - this._hittables = []; - this._lightBuffer = null; - this._worldCreated = false; - this._initializeAPI().then(()=>{ - this._initializeResources(); - }); + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } } - _initializeAPI() { - return __awaiter(this, void 0, void 0, function*() { - try { - const start = window.performance.now(); - const gpu = navigator.gpu; - this._presentationFormat = gpu.getPreferredCanvasFormat(); - this._adapter = yield gpu.requestAdapter(); - const gpuDeviceDescriptor = { - requiredLimits: { - maxStorageBufferBindingSize: 134217728, - maxComputeWorkgroupsPerDimension: 256 - } - }; - this._device = yield this._adapter.requestDevice(gpuDeviceDescriptor); - this._queue = this._device.queue; - this._context = this._canvas.getContext("webgpu"); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU API initialized ${Math.round(window.performance.now() - start)}ms`); - } catch (e) { - this._core.log.write((0, _mainJs.LogLevel).error, e); - return false; - } - return true; - }); + } + class LabelVisualBase { + get isInitialized() { + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; } - _initializeResources() { - const start = window.performance.now(); - const canvasConfig = { - device: this._device, - format: this._presentationFormat, - alphaMode: "premultiplied" - }; - this._context.configure(canvasConfig); - const computeUniformBufferDescriptor = { - label: "Compute uniform buffer", - size: (0, _raytraceJs.ComputeUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._computeUniformBuffer = this._device.createBuffer(computeUniformBufferDescriptor); - this._computeUniformBufferData = new (0, _raytraceJs.ComputeUniformBufferData)(); - const depthMinMaxBufferDescriptor = { - label: "Depth min max buffer", - size: 8, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - this._depthMinMaxBuffer = this._device.createBuffer(depthMinMaxBufferDescriptor); - const depthMinMaxBufferResultDescriptor = { - label: "Depth min max result buffer", - size: 8, - usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ - }; - this._depthMinMaxResultBuffer = this._device.createBuffer(depthMinMaxBufferResultDescriptor); - const fullscreenQuadUniformBufferDescriptor = { - label: "Full screen quad uniform buffer", - size: (0, _fullscreenquadJs.FullscreenQuadUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._fullscreenQuadUniformBuffer = this._device.createBuffer(fullscreenQuadUniformBufferDescriptor); - this._fullscreenQuadUniformBufferData = new (0, _fullscreenquadJs.FullscreenQuadUniformBufferData)(); - this._sampler = this._device.createSampler({ - label: "Sampler", - magFilter: "linear", - minFilter: "linear" - }); - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(this._device); - fontVisual.update(); - } - for(let i = 0; i < this.images.length; i++){ - const image = this.images[i]; - image.initializeContext(this._device); - image.update(); - } - const textureSize = { - width: 1, - height: 1 - }; - const textureDescriptor = { - label: "Placeholder texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._texture = this._device.createTexture(textureDescriptor); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU resources initialized ${Math.round(window.performance.now() - start)}ms`); - this._isInitialized = true; + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$7(); + this.mMatrix = create$7(); + this.isVisible = true; } - get isSupported() { - return navigator.gpu !== undefined; - } - _createWorld() { - return __awaiter(this, void 0, void 0, function*() { - const start = performance.now(); - this._hittables = this._getHittables(); - if (this._hittables.length == 0) return; - const bvhAccel = new (0, _bvhJs.BVHAccel)(this._core, this._hittables, this._config.maxPrimsInNode, (0, _bvhJs.SplitMethod).sah); - const hittables = bvhAccel.orderedPrimitives; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const atlas = transitionBuffer.currentAtlas; - if (atlas.imageData) { - const imageData = atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - yield createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - label: "Atlas texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._atlasTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this._atlasTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `atlas texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - break; - } - } - } - const materials = []; - const materialIds = []; - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - const material = hittable.material; - let materialId; - let found; - for(let j = 0; j < materials.length; j++)if (materials[j] === material) { - found = true; - materialId = j; - break; - } - if (!found) { - materialId = materials.length; - materials.push(material); - } - materialIds.push(materialId); - } - const textures = []; - const textureIds = []; - for(let i = 0; i < materials.length; i++){ - const material = materials[i]; - const texture = material.texture; - if (texture) { - let textureId; - let found; - for(let j = 0; j < textures.length; j++)if (textures[j] === texture) { - found = true; - textureId = j; - break; - } - if (!found) { - textureId = textures.length; - textures.push(texture); - if (texture instanceof (0, _textureJs.ImageTexture)) { - const imageData = texture.image; - if (imageData) { - let start = performance.now(); - const imageDataLinear = new ImageData(imageData.width, imageData.height); - for(let i = 0; i < imageData.data.length; i++)imageDataLinear.data[i] = Math.pow(imageData.data[i] / 0xff, 2.2) * 0xff; - this._core.log.write((0, _mainJs.LogLevel).info, `image inverse gamma ${Math.round(window.performance.now() - start)}ms`); - start = window.performance.now(); - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageDataLinear).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._backgroundTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap, - flipY: true - }; - const imageCopyTextureTagged = { - texture: this._backgroundTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `background image updated ${Math.round(window.performance.now() - start)}ms`); - }); - } - } - } - textureIds.push(textureId); - } else textureIds.push(0); - } - const textureBufferSizeBytes = textures.length * (0, _textureJs.TextureBufferData).SIZE * 4; - const textureBufferDescriptor = { - label: "Texture buffer", - size: textureBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._textureBuffer = this._device.createBuffer(textureBufferDescriptor); - this._textureBufferData = new (0, _textureJs.TextureBufferData)(textures.length); - for(let i = 0; i < textures.length; i++)textures[i].toBuffer(this._textureBufferData, i); - const materialBufferSizeBytes = materials.length * (0, _materialJs.MaterialBufferData).SIZE * 4; - const materialBufferDescriptor = { - label: "Material buffer", - size: materialBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._materialBuffer = this._device.createBuffer(materialBufferDescriptor); - this._materialBufferData = new (0, _materialJs.MaterialBufferData)(materials.length); - for(let i = 0; i < materials.length; i++)materials[i].toBuffer(this._materialBufferData, i, textureIds[i]); - const hittableBufferSizeBytes = hittables.length * (0, _hittableJs.HittableBufferData).SIZE * 4; - const hittableBufferDescriptor = { - label: "Hittable buffer", - size: hittableBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._hittableBuffer = this._device.createBuffer(hittableBufferDescriptor); - this._hittableBufferData = new (0, _hittableJs.HittableBufferData)(hittables.length); - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - hittable.toBuffer(this._hittableBufferData, i, materialIds[i]); - } - const linearBVHNodes = bvhAccel.nodes; - const linearBVHNodeBufferSizeBytes = linearBVHNodes.length * (0, _bvhJs.LinearBVHNodeBufferData).SIZE * 4; - const linearBVHNodeBufferDescriptor = { - label: "Linear BVH node buffer", - size: linearBVHNodeBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._linearBVHNodeBuffer = this._device.createBuffer(linearBVHNodeBufferDescriptor); - this._linearBVHNodeBufferData = new (0, _bvhJs.LinearBVHNodeBufferData)(linearBVHNodes.length); - for(let i = 0; i < linearBVHNodes.length; i++)linearBVHNodes[i].toBuffer(this._linearBVHNodeBufferData, i); - this._device.queue.writeBuffer(this._hittableBuffer, 0, this._hittableBufferData.buffer, this._hittableBufferData.byteOffset, this._hittableBufferData.byteLength); - this._device.queue.writeBuffer(this._materialBuffer, 0, this._materialBufferData.buffer, this._materialBufferData.byteOffset, this._materialBufferData.byteLength); - this._device.queue.writeBuffer(this._textureBuffer, 0, this._textureBufferData.buffer, this._textureBufferData.byteOffset, this._textureBufferData.byteLength); - this._device.queue.writeBuffer(this._linearBVHNodeBuffer, 0, this._linearBVHNodeBufferData.buffer, this._linearBVHNodeBufferData.byteOffset, this._linearBVHNodeBufferData.byteLength); - this._core.log.write((0, _mainJs.LogLevel).info, `create world ${Math.round(window.performance.now() - start)}ms`); - }); + initializeContext(gl) { + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } - _createLights() { - if (!this._lights || this._lights.length == 0) return; - const modelScale = this._core.getModelScale(); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - if (!this._lightBuffer) { - const lightBufferSizeBytes = this._lights.length * (0, _lightJs.LightBufferData).SIZE * 4; - const lightBufferDescriptor = { - label: "Light buffer", - size: lightBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._lightBuffer = this._device.createBuffer(lightBufferDescriptor); - this._lightBufferData = new (0, _lightJs.LightBufferData)(this._lights.length); - } - for(let i = 0; i < this._lights.length; i++){ - const light = this._lights[i]; - let lightCopy; - if (light instanceof (0, _lightJs.RectLight)) lightCopy = new (0, _lightJs.RectLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - rotation: (0, _glMatrix.quat).clone(light.rotation), - size: (0, _glMatrix.vec2).fromValues(light.size[0] * modelScale, light.size[1] * modelScale) - }); - else if (light instanceof (0, _lightJs.SphereLight)) lightCopy = new (0, _lightJs.SphereLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - radius: light.radius * modelScale - }); - (0, _glMatrix.vec3).scale(lightCopy.center, lightCopy.center, modelScale); - (0, _glMatrix.vec3).add(lightCopy.center, lightCopy.center, this._modelPosition); - lightCopy.toBuffer(this._lightBufferData, i); - } - this._device.queue.writeBuffer(this._lightBuffer, 0, this._lightBufferData.buffer, this._lightBufferData.byteOffset, this._lightBufferData.byteLength); - this._areLightsInitialized = true; - } - standardLighting(lights) { - lights || (lights = this._config.standardLightingOptions()); - const rectLights = []; - for(let i = 0; i < lights.length; i++){ - const light = lights[i]; - const center = (0, _glMatrix.vec3).create(); - const rotation = (0, _glMatrix.quat).create(); - const azimuth = (0, _angleJs.AngleHelper).degreesToRadians(light.azimuth); - const altitude = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, azimuth); - (0, _glMatrix.quat).rotateX(rotation, rotation, altitude); - (0, _glMatrix.vec3).transformQuat(center, (0, _constantsJs.Constants).VECTOR3_UNITZ, rotation); - (0, _glMatrix.vec3).scale(center, center, light.distance); - const yaw = (0, _angleJs.AngleHelper).degreesToRadians(light.yaw); - const pitch = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, yaw); - (0, _glMatrix.quat).rotateX(rotation, rotation, pitch); - rectLights.push(new (0, _lightJs.RectLight)({ - center: center, - rotation: rotation, - size: light.size, - color: light.color - })); - } - return rectLights; + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + } } - _getHittables() { - const hittables = []; - let minY = Number.MAX_VALUE; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible && transitionBuffer.hittables && transitionBuffer.hittables.length > 0) { - minY = Math.min(minY, transitionBuffer.minY); - for(let j = 0; j < transitionBuffer.hittables.length; j++)hittables.push(transitionBuffer.hittables[j]); - } - } - if (this.labelSets && this.labelSets.length > 0) for(let i = 0; i < this.labelSets.length; i++){ - const labelSet = this.labelSets[i]; - if (labelSet.hittables) for(let j = 0; j < labelSet.hittables.length; j++)hittables.push(labelSet.hittables[j]); - } - if (this.images && this.images.length > 0) { - for(let i = 0; i < this.images.length; i++)if (this.images[i].hittable) { - const hittable = this.images[i].hittable; - hittables.push(hittable); - minY = Math.min(hittable.bounds.min[1], minY); - } - } - if (this.ground) { - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - const groundSize = (0, _glMatrix.vec2).create(); - const groundPosition = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec2).scale(groundSize, this.ground.size || this._config.groundSize, modelScale); - if (this.ground.position) (0, _glMatrix.vec3).scale(groundPosition, this.ground.position, modelScale); - else (0, _glMatrix.vec3).set(groundPosition, 0, minY - (0, _constantsJs1.Constants).SHADOW_OFFSET, 0); - const options = { - size0: groundSize, - size1: groundSize, - center0: groundPosition, - center1: groundPosition, - time0: 1, - time1: 1, - texCoord0: (0, _glMatrix.vec2).fromValues(0, 0), - texCoord1: (0, _glMatrix.vec2).fromValues(1, 1), - material: this.ground.material || this.config.defaultMaterial - }; - (0, _glMatrix.vec3).add(options.center0, options.center0, modelPosition); - hittables.push(new (0, _hittableJs.HittableXzRect)(options)); + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } } - return hittables; + } } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + } + class LabelVisual extends LabelVisualBase { + get label() { + return this._label; } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + set text(value2) { + this._label.text = value2; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + get text() { + return this._label.text; } - createTransitionBuffer(ids) { - const transitionBuffer = new (0, _bufferJs.TransitionBuffer)(this._core, this, ids); - transitionBuffer.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return transitionBuffer; - } - _resizeBackings() { - const width = this.width; - const height = this.height; - const colorChannels = 3; - const outputColorBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * colorChannels; - const outputColorBufferDescriptor = { - label: "Output color buffer", - size: outputColorBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputColorBuffer = this._device.createBuffer(outputColorBufferDescriptor); - const outputNormalDepthBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * 4; - const outputDepthBufferDescriptor = { - label: "Output normal depth buffer", - size: outputNormalDepthBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputNormalDepthBuffer = this._device.createBuffer(outputDepthBufferDescriptor); - const computeShaderModuleDescriptor = { - code: (0, _raytraceJs.ComputeShaderWgsl) - }; - const computeModule = this._device.createShaderModule(computeShaderModuleDescriptor); - const computeBindGroupLayoutDescriptor = { - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 1, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "uniform" - } - }, - { - binding: 2, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 3, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 4, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 5, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 6, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 7, - visibility: GPUShaderStage.COMPUTE, - sampler: { - type: "filtering" - } - }, - { - binding: 8, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 9, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 10, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const computeBindGroupLayout = this._device.createBindGroupLayout(computeBindGroupLayoutDescriptor); - const computeBindGroupDescriptor = { - label: "Compute bind group descriptor", - layout: computeBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 1, - resource: { - buffer: this._computeUniformBuffer - } - }, - { - binding: 2, - resource: { - buffer: this._hittableBuffer - } - }, - { - binding: 3, - resource: { - buffer: this._materialBuffer - } - }, - { - binding: 4, - resource: { - buffer: this._textureBuffer - } - }, - { - binding: 5, - resource: { - buffer: this._lightBuffer - } - }, - { - binding: 6, - resource: { - buffer: this._linearBVHNodeBuffer - } - }, - { - binding: 7, - resource: this._sampler - }, - { - binding: 8, - resource: (this.fonts[this._core.font.name].texture || this._texture).createView() - }, - { - binding: 9, - resource: (this._backgroundTexture || this._texture).createView() - }, - { - binding: 10, - resource: (this._atlasTexture || this._texture).createView() - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._computeBindGroup = this._device.createBindGroup(computeBindGroupDescriptor); - const computePipelineLayoutDescriptor = { - label: "Compute pipeline layout descriptor", - bindGroupLayouts: [ - computeBindGroupLayout - ] - }; - const computePipelineLayout = this._device.createPipelineLayout(computePipelineLayoutDescriptor); - const compute = { - module: computeModule, - entryPoint: "main" - }; - const computePipelineDescriptor = { - label: "Compute pipeline descriptor", - layout: computePipelineLayout, - compute: compute - }; - this._computePipeline = this._device.createComputePipeline(computePipelineDescriptor); - const computeDepthNormal = { - module: computeModule, - entryPoint: "depthNormal" - }; - const computeDepthNormalPipelineDescriptor = { - label: "Depth normal pipeline descriptor", - layout: computePipelineLayout, - compute: computeDepthNormal - }; - this._computeDepthNormalPipeline = this._device.createComputePipeline(computeDepthNormalPipelineDescriptor); - const computeSegment = { - module: computeModule, - entryPoint: "segment" - }; - const computeSegmentPipelineDescriptor = { - label: "Segment pipeline descriptor", - layout: computePipelineLayout, - compute: computeSegment - }; - this._computeSegmentPipeline = this._device.createComputePipeline(computeSegmentPipelineDescriptor); - const clearBindGroupLayoutDescriptor = { - label: "Clear bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const clearBindGroupLayout = this._device.createBindGroupLayout(clearBindGroupLayoutDescriptor); - const clearBindGroupDescriptor = { - label: "Clear bind group descriptor", - layout: clearBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._clearBindGroup = this._device.createBindGroup(clearBindGroupDescriptor); - const clearPipelineLayoutDescriptor = { - label: "Clear pipeline layout descriptor", - bindGroupLayouts: [ - clearBindGroupLayout - ] - }; - const clearPipelineLayout = this._device.createPipelineLayout(clearPipelineLayoutDescriptor); - const clear = { - module: computeModule, - entryPoint: "clear" - }; - const clearPipelineDescriptor = { - label: "Clear pipeline descriptor", - layout: clearPipelineLayout, - compute: clear - }; - this._clearPipeline = this._device.createComputePipeline(clearPipelineDescriptor); - const fullscreenQuadShaderDescriptor = { - label: "Fullscreen quad shader descriptor", - code: (0, _fullscreenquadJs.FullscreenQuadWgsl) - }; - const fullscreenQuadModule = this._device.createShaderModule(fullscreenQuadShaderDescriptor); - const fullscreenQuadBindGroupLayoutDescriptor = { - label: "Fullscreen quad bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "uniform" - } - }, - { - binding: 1, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 2, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - } - ] - }; - const fullscreenQuadBindGroupLayout = this._device.createBindGroupLayout(fullscreenQuadBindGroupLayoutDescriptor); - const fullscreenQuadPipelineLayoutDescriptor = { - label: "Fullscreen quad pipeline layout descriptor", - bindGroupLayouts: [ - fullscreenQuadBindGroupLayout - ] - }; - const fullscreenQuadPipelineLayout = this._device.createPipelineLayout(fullscreenQuadPipelineLayoutDescriptor); - const vertex = { - module: fullscreenQuadModule, - entryPoint: "vert_main" - }; - const primitive = { - topology: "triangle-list" - }; - const colorState = { - format: this._presentationFormat - }; - const fragment = { - module: fullscreenQuadModule, - entryPoint: "frag_main", - targets: [ - colorState - ] - }; - const fullscreenQuadPiplelineDescriptor = { - label: "Fullscreen quad pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragment, - primitive: primitive - }; - this._fullscreenQuadPipeline = this._device.createRenderPipeline(fullscreenQuadPiplelineDescriptor); - const fullscreenQuadBindGroupDescriptor = { - label: "Fullscreen quad bind group descriptor", - layout: fullscreenQuadBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: this._fullscreenQuadUniformBuffer - } - }, - { - binding: 1, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 2, - resource: { - buffer: outputNormalDepthBuffer - } - } - ] - }; - this._fullscreenQuadBindGroup = this._device.createBindGroup(fullscreenQuadBindGroupDescriptor); - const fragmentHdr = { - module: fullscreenQuadModule, - entryPoint: "frag_main_hdr", - targets: [ - colorState - ] - }; - const fullscreenQuadHdrPiplelineDescriptor = { - label: "Fullscreen quad HDR pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentHdr, - primitive: primitive - }; - this._fullscreenQuadHdrPipeline = this._device.createRenderPipeline(fullscreenQuadHdrPiplelineDescriptor); - const fragmentDepth = { - module: fullscreenQuadModule, - entryPoint: "frag_depth", - targets: [ - colorState - ] - }; - const fullscreenQuadDepthPiplelineDescriptor = { - label: "Fullscreen quad depth pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentDepth, - primitive: primitive - }; - this._fullscreenQuadDepthPipeline = this._device.createRenderPipeline(fullscreenQuadDepthPiplelineDescriptor); - const fragmentNormal = { - module: fullscreenQuadModule, - entryPoint: "frag_normal", - targets: [ - colorState - ] - }; - const fullscreenQuadNormalPiplelineDescriptor = { - label: "Fullscreen quad normal pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentNormal, - primitive: primitive - }; - this._fullscreenQuadNormalPipeline = this._device.createRenderPipeline(fullscreenQuadNormalPiplelineDescriptor); - const fragmentEdge = { - module: fullscreenQuadModule, - entryPoint: "frag_edge", - targets: [ - colorState - ] - }; - const fullscreenQuadEdgePiplelineDescriptor = { - label: "Fullscreen quad edge pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentEdge, - primitive: primitive - }; - this._fullscreenQuadEdgePipeline = this._device.createRenderPipeline(fullscreenQuadEdgePiplelineDescriptor); - const fragmentSegment = { - module: fullscreenQuadModule, - entryPoint: "frag_segment", - targets: [ - colorState - ] - }; - const fullscreenQuadSegmentPiplelineDescriptor = { - label: "Fullscreen quad segment pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentSegment, - primitive: primitive - }; - this._fullscreenQuadSegmentPipeline = this._device.createRenderPipeline(fullscreenQuadSegmentPiplelineDescriptor); - this._computeUniformBufferData.setWidth(width); - this._computeUniformBufferData.setHeight(height); - this._fullscreenQuadUniformBufferData.setWidth(width); - this._fullscreenQuadUniformBufferData.setHeight(height); - this._computeUniformBufferData.setTime0(0); - this._computeUniformBufferData.setTime1(1); - this._computeDispatchCount = Math.min(Math.ceil(width * height / 256), this._device.limits.maxComputeWorkgroupsPerDimension); - this._frameCount = 0; - this._core.log.write((0, _mainJs.LogLevel).info, "backings resized"); + constructor(core, main, label2) { + super(core, main, label2); + } + } + class LabelSetVisual extends LabelVisualBase { + get label() { + return this._label; + } + constructor(core, main, label2) { + super(core, main, label2); + } + } + class ImageVisual { + get isInitialized() { + return this._isInitialized && this._main.textureShader.isInitialized; + } + get image() { + return this._image; + } + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$7(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - super.update(elapsedTime); - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const time0 = this._core.renderer.transitionTime; - const time1 = Math.min(time0 + this._config.shutterSpeed, 1); - transitionBuffer.time0 = time0; - transitionBuffer.time1 = time1; - transitionBuffer.duration = this._core.config.transitionDuration; - transitionBuffer.stagger = this._core.config.transitionStaggering; - transitionBuffer.update(); - } - } - if (this._haveLightsChanged || !this._lightBuffer) { - this._haveLightsChanged = false; - this._createLights(); - } - if (this._hasWorldChanged) { - this._hasWorldChanged = false; - this._createWorld().then(()=>{ - if (this._hittables.length > 0) { - this._resizeBackings(); - this._worldCreated = true; - } - }); + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.apply(); + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`frm tot ${this._frameCount}`); + } } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - if (!this._worldCreated || !this._areLightsInitialized || this._hittables.length == 0) return; - const epsilon = 0.000001; - if (Math.abs(this._computeUniformBufferData.getFieldOfView() - this._core.config.fov) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setFieldOfView(this._core.config.fov); - } - if (Math.abs(this._computeUniformBufferData.getAperture() - this._config.aperture) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setAperture(this._config.aperture); - } - const m = this.inverseVMatrices[0]; - this._computeUniformBufferData.getPosition(this._position); - this._computeUniformBufferData.getRight(this._right); - this._computeUniformBufferData.getUp(this._up); - this._computeUniformBufferData.getForward(this._forward); - if (Math.abs(this._position[0] - m[12]) > epsilon || Math.abs(this._position[1] - m[13]) > epsilon || Math.abs(this._position[2] - m[14]) > epsilon || Math.abs(this._right[0] - m[0]) > epsilon || Math.abs(this._right[1] - m[1]) > epsilon || Math.abs(this._right[2] - m[2]) > epsilon || Math.abs(this._up[0] - m[4]) > epsilon || Math.abs(this._up[1] - m[5]) > epsilon || Math.abs(this._up[2] - m[6]) > epsilon || Math.abs(this._forward[0] - m[8]) > epsilon || Math.abs(this._forward[1] - m[9]) > epsilon || Math.abs(this._forward[2] - m[10]) > epsilon) { - this._frameCount = 0; - (0, _glMatrix.vec3).set(this._position, m[12], m[13], m[14]); - (0, _glMatrix.vec3).set(this._right, m[0], m[1], m[2]); - (0, _glMatrix.vec3).set(this._up, m[4], m[5], m[6]); - (0, _glMatrix.vec3).set(this._forward, m[8], m[9], m[10]); - this._computeUniformBufferData.setPosition(this._position); - this._computeUniformBufferData.setRight(this._right); - this._computeUniformBufferData.setUp(this._up); - this._computeUniformBufferData.setForward(this._forward); - this._core.getModelPosition(this._modelPosition); - this._core.getModelManipulationOrigin(this._manipulationOrigin); - (0, _glMatrix.vec3).add(this._modelPosition, this._modelPosition, this._manipulationOrigin); - this._computeUniformBufferData.setLookAt(this._modelPosition); - } - this._computeUniformBufferData.getBackgroundColor(this._backgroundColor); - if (!(0, _glMatrix.vec4).equals(this._backgroundColor, this._config.backgroundColor)) { - this._frameCount = 0; - this._computeUniformBufferData.setBackgroundColor(this._config.backgroundColor); - } - this._tilesX = this._computeUniformBufferData.getTilesX(); - this._tilesY = this._computeUniformBufferData.getTilesY(); - this._tileOffsetX = this._computeUniformBufferData.getTileOffsetX(); - this._tileOffsetY = this._computeUniformBufferData.getTileOffsetY(); - if (this._tilesX != this._core.config.tilesX || this._tilesY != this._core.config.tilesY || this._tileOffsetX != this._core.config.tileOffsetX || this._tileOffsetY != this._core.config.tileOffsetY) { - this._frameCount = 0; - this._computeUniformBufferData.setTilesX(this._core.config.tilesX); - this._computeUniformBufferData.setTilesY(this._core.config.tilesY); - this._computeUniformBufferData.setTileOffsetX(this._core.config.tileOffsetX); - this._computeUniformBufferData.setTileOffsetY(this._core.config.tileOffsetY); - } - const clear = this._frameCount == 0; - if (clear) { - this._duration = 0; - this._startTime = performance.now(); - } - if (this._frameCount >= this._config.maxSamplesPerPixel) { - this._core.stop(); - return; - } - const raysPerFrame = this._config.raysPerFrame; - this._computeUniformBufferData.setRaysPerFrame(raysPerFrame); - this._computeUniformBufferData.setSeed(this._core.totalFrames * raysPerFrame); - this._device.queue.writeBuffer(this._computeUniformBuffer, 0, this._computeUniformBufferData.buffer, this._computeUniformBufferData.byteOffset, this._computeUniformBufferData.byteLength); - this._frameCount += raysPerFrame; - this._fullscreenQuadUniformBufferData.setSamplesPerPixel(this._frameCount); - this._fullscreenQuadUniformBufferData.setExposure(this._config.exposure); - this._fullscreenQuadUniformBufferData.setMinDepth(this._config.minDepth); - this._fullscreenQuadUniformBufferData.setMaxDepth(this._config.maxDepth); - this._fullscreenQuadUniformBufferData.setEdgeDepth(this._config.edgeDepth); - this._fullscreenQuadUniformBufferData.setEdgeNormal(this._config.edgeNormal); - this._device.queue.writeBuffer(this._fullscreenQuadUniformBuffer, 0, this._fullscreenQuadUniformBufferData.buffer, this._fullscreenQuadUniformBufferData.byteOffset, this._fullscreenQuadUniformBufferData.byteLength); - yield this._encodeCommands(clear); - this._duration = performance.now() - this._startTime; - }); + } + class Lasso { + get isInitialized() { + return this._isInitialized; } - clear() { - this._frameCount = 0; - } - _encodeCommands(clear) { - return __awaiter(this, void 0, void 0, function*() { - const commandEncoder = this._device.createCommandEncoder(); - const computePassEncoder = commandEncoder.beginComputePass(); - if (clear) { - computePassEncoder.setPipeline(this._clearPipeline); - computePassEncoder.setBindGroup(0, this._clearBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - } - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - case (0, _mainJs.RenderMode).hdr: - computePassEncoder.setPipeline(this._computePipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - case (0, _mainJs.RenderMode).depth: - case (0, _mainJs.RenderMode).normal: - computePassEncoder.setPipeline(this._computeDepthNormalPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - commandEncoder.copyBufferToBuffer(this._depthMinMaxBuffer, 0, this._depthMinMaxResultBuffer, 0, this._depthMinMaxResultBuffer.size); - if (this._config.autoDepth) { - yield this._depthMinMaxResultBuffer.mapAsync(GPUMapMode.READ); - const depthMinMax = new Uint32Array(this._depthMinMaxResultBuffer.getMappedRange()); - const depthMin = depthMinMax[0] / 1000; - const depthMax = depthMinMax[1] / 1000; - if (this._config.minDepth != depthMin || this._config.maxDepth != depthMax) console.log('depthMinMax', depthMin, depthMax); - this._config.minDepth = depthMin; - this._config.maxDepth = depthMax; - this._depthMinMaxResultBuffer.unmap(); - } - break; - case (0, _mainJs.RenderMode).edge: - case (0, _mainJs.RenderMode).segment: - computePassEncoder.setPipeline(this._computeSegmentPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - } - const colorAttachment = { - view: this._context.getCurrentTexture().createView(), - clearValue: { - r: 0.0, - g: 0.0, - b: 0.0, - a: 0.0 - }, - loadOp: "clear", - storeOp: "store" - }; - const fullscreenQuadRenderPassDescriptor = { - colorAttachments: [ - colorAttachment - ] - }; - const renderPassEncoder = commandEncoder.beginRenderPass(fullscreenQuadRenderPassDescriptor); - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - renderPassEncoder.setPipeline(this._fullscreenQuadPipeline); - break; - case (0, _mainJs.RenderMode).hdr: - renderPassEncoder.setPipeline(this._fullscreenQuadHdrPipeline); - break; - case (0, _mainJs.RenderMode).depth: - renderPassEncoder.setPipeline(this._fullscreenQuadDepthPipeline); - break; - case (0, _mainJs.RenderMode).normal: - renderPassEncoder.setPipeline(this._fullscreenQuadNormalPipeline); - break; - case (0, _mainJs.RenderMode).edge: - renderPassEncoder.setPipeline(this._fullscreenQuadEdgePipeline); - break; - case (0, _mainJs.RenderMode).segment: - renderPassEncoder.setPipeline(this._fullscreenQuadSegmentPipeline); - break; - } - renderPassEncoder.setBindGroup(0, this._fullscreenQuadBindGroup); - renderPassEncoder.draw(6, 1, 0, 0); - renderPassEncoder.end(); - this._queue.submit([ - commandEncoder.finish() - ]); - }); + get vertexBuffer() { + return this._vertexBuffer; + } + get indexBuffer() { + return this._indexBuffer; + } + get indexCount() { + return this._indexCount; + } + initializeContext(gl) { + const vertices = Quad$3.textured(Constants$1.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + } + var __awaiter$1 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - _resize(width, height) { - super._resize(width, height); - if (this._isInitialized && this._hittables.length > 0) { - this._resizeBackings(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); - } - } -} - -},{"gl-matrix":"5x28d","../renderer.js":"8zmPQ","../../main.js":"f421K","./config.js":"2dRLO","./hittable.js":"5cw7N","./material.js":"jQJhi","./shaders/raytrace.js":"cAHlu","./shaders/fullscreenquad.js":"1gtMg","./bvh.js":"8lb3C","./texture.js":"5NgmA","./light.js":"2sMdC","../../constants.js":"lD0bG","../../helpers/angle.js":"53hwW","./font.js":"3rF26","./image.js":"enHlm","./labels.js":"72uDI","./buffer.js":"dRm64","./constants.js":"6DWH0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2dRLO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); - } - standardLightingOptions(options) { - const azimuthOffset = options && options.azimuthOffset ? options.azimuthOffset : this.lightingAzimuthOffset; - const altitude = options && options.altitude ? options.altitude : this.lightingAltitude; - const size = options && options.size ? options.size : this.lightingSize; - const distance = options && options.distance ? options.distance : this.lightingDistance; - return [ - { - azimuth: -45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(10, 10, 10) - }, - { - azimuth: 45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: 45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }, - { - azimuth: -135 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -135 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - } - ]; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Main extends RendererBase { + get shaderResources() { + return this._shaderResources; } - reset() { - this.aperture = 0; - this.exposure = 1; - this.maxSamplesPerPixel = 10000; - this.shutterSpeed = 0; - this.raysPerFrame = 1; - this.maxPrimsInNode = 1; - this.defaultMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5) - }) - }); - this.defaultTextMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }) - }); - this.groundSize = (0, _glMatrix.vec2).fromValues(10, 10); - this.backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); - this.lightingAzimuthOffset = 0; - this.lightingAltitude = 30; - this.lightingSize = 0.5; - this.lightingDistance = 1.5; - this.autoDepth = true; - this.minDepth = 1; - this.maxDepth = 10; - this.edgeDepth = 0.01; - this.edgeNormal = 0.025; - } -} - -},{"gl-matrix":"5x28d","../renderer.js":"8zmPQ","./material.js":"jQJhi","./texture.js":"5NgmA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jQJhi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MaterialType", ()=>MaterialType); -parcelHelpers.export(exports, "MaterialBufferData", ()=>MaterialBufferData); -parcelHelpers.export(exports, "Material", ()=>Material); -parcelHelpers.export(exports, "LambertianMaterial", ()=>LambertianMaterial); -parcelHelpers.export(exports, "MetalMaterial", ()=>MetalMaterial); -parcelHelpers.export(exports, "DielectricMaterial", ()=>DielectricMaterial); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>DiffuseLightMaterial); -parcelHelpers.export(exports, "GlossyMaterial", ()=>GlossyMaterial); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>IsotropicMaterial); -parcelHelpers.export(exports, "VarnishMaterial", ()=>VarnishMaterial); -var _glMatrix = require("gl-matrix"); -const MaterialType = { - lambertian: 0, - metal: 1, - dielectric: 2, - glossy: 3, - diffuseLight: 4, - isotropic: 5, - varnish: 6 -}; -class MaterialBufferData extends Float32Array { - constructor(count){ - super(count * MaterialBufferData.SIZE); - this.TYPE_OFFSET = 0; - this.FUZZ_OFFSET = 1; - this.REFRACTIVE_INDEX_OFFSET = 2; - this.TEXTURE_ID_OFFSET = 3; - this.COLOR_OFFSET = 4; - this.GLOSSINESS_OFFSET = 7; - this.ID_COLOR_OFFSET = 8; - this.DENSITY_OFFSET = 12; - } - getType(index) { - return this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getFuzz(index) { - return this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET]; - } - setFuzz(index, value) { - this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET] = value; - } - getRefractiveIndex(index) { - return this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET]; - } - setRefractiveIndex(index, value) { - this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET] = value; - } - getTextureId(index) { - return this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET]; - } - setTextureId(index, value) { - this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET] = value; - } - getColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getGlossiness(index) { - return this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET]; - } - setGlossiness(index, value) { - this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET] = value; - } - getDensity(index) { - return this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET]; - } - setDensity(index, value) { - this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET] = value; - } - getIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -MaterialBufferData.SIZE = 16; -class Material { - get texture() { - return this._texture; - } - get idColor() { - return this._idColor; - } - constructor(options){ - this._idColor = options.idColor || (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); - } - toBuffer(buffer, index, textureId) {} -} -class LambertianMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.lambertian); - buffer.setIdColor(index, this.idColor); - buffer.setTextureId(index, textureId); - } -} -class MetalMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.metal); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setTextureId(index, textureId); - } -} -class DielectricMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - this.density = options && options.density !== undefined ? options.density : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.dielectric); - buffer.setIdColor(index, this.idColor); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setColor(index, (0, _glMatrix.vec3).fromValues(-Math.log(this.color[0]) * this.density, -Math.log(this.color[1]) * this.density, -Math.log(this.color[2]) * this.density)); - } -} -class DiffuseLightMaterial extends Material { - constructor(options){ - super(options); - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.diffuseLight); - buffer.setIdColor(index, this.idColor); - buffer.setColor(index, this.color); - } -} -class GlossyMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.glossy); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setTextureId(index, textureId); - } -} -class IsotropicMaterial extends Material { - constructor(options){ - super(options); - this.density = options.density; - this.color = options.color; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.isotropic); - buffer.setIdColor(index, this.idColor); - buffer.setDensity(index, this.density); - buffer.setColor(index, this.color); - } -} -class VarnishMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.varnish); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5NgmA":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureType", ()=>TextureType); -parcelHelpers.export(exports, "TextureBufferData", ()=>TextureBufferData); -parcelHelpers.export(exports, "Texture", ()=>Texture); -parcelHelpers.export(exports, "SolidColorTexture", ()=>SolidColorTexture); -parcelHelpers.export(exports, "ImageTexture", ()=>ImageTexture); -parcelHelpers.export(exports, "CheckerTexture", ()=>CheckerTexture); -parcelHelpers.export(exports, "GridTexture", ()=>GridTexture); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -const TextureType = { - none: 0, - solidColor: 1, - image: 2, - sdfText: 3, - checker: 4, - grid: 5 -}; -class TextureBufferData extends Float32Array { - constructor(count){ - super(count * TextureBufferData.SIZE); - this.COLOR0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.COLOR1_OFFSET = 4; - this.SIZE0_OFFSET = 8; - this.SIZE1_OFFSET = 12; - this.CLIP_OFFSET = 16; - this.OFFSET_OFFSET = 20; - } - getType(index) { - return this[TextureBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[TextureBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); - } - setOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - } -} -TextureBufferData.SIZE = 24; -class Texture { -} -class SolidColorTexture extends Texture { - constructor(options){ - super(); - this.color = options.color; - this.borderColor = options.borderColor || (0, _constantsJs.Constants).VECTOR3_ONE; - this._color = (0, _glMatrix.vec3).fromValues(Math.pow(this.color[0], 2.2), Math.pow(this.color[1], 2.2), Math.pow(this.color[2], 2.2)); - this._borderColor = (0, _glMatrix.vec3).fromValues(Math.pow(this.borderColor[0], 2.2), Math.pow(this.borderColor[1], 2.2), Math.pow(this.borderColor[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.solidColor); - buffer.setColor0(index, this._color); - buffer.setColor1(index, this._borderColor); - } -} -class ImageTexture extends Texture { - constructor(options){ - super(); - this.image = options.image; - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.image); - } -} -class CheckerTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.checker); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], 0, 0)); - buffer.setOffset(index, this.offset); - } -} -class GridTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.minorSize = options.minorSize; - this.thickness = options.thickness; - this.minorThickness = options.minorThickness; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this.clip = options.clip || (0, _glMatrix.vec4).fromValues(0, 0, 1, 1); - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.grid); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], this.minorSize[0], this.minorSize[1])); - buffer.setSize1(index, (0, _glMatrix.vec4).fromValues(this.thickness[0], this.thickness[1], this.minorThickness[0], this.minorThickness[1])); - buffer.setOffset(index, this.offset); - buffer.setClip(index, this.clip); - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5cw7N":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HittableType", ()=>HittableType); -parcelHelpers.export(exports, "HittableBufferData", ()=>HittableBufferData); -parcelHelpers.export(exports, "Hittable", ()=>Hittable); -parcelHelpers.export(exports, "HittableSphere", ()=>HittableSphere); -parcelHelpers.export(exports, "HittableXyDisk", ()=>HittableXyDisk); -parcelHelpers.export(exports, "HittableRotatedXyDisk", ()=>HittableRotatedXyDisk); -parcelHelpers.export(exports, "HittableRingSdf", ()=>HittableRingSdf); -parcelHelpers.export(exports, "HittableRotatedRingSdf", ()=>HittableRotatedRingSdf); -parcelHelpers.export(exports, "HittableBox", ()=>HittableBox); -parcelHelpers.export(exports, "HittableBoxSdf", ()=>HittableBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBoxSdf", ()=>HittableRotatedBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBox", ()=>HittableRotatedBox); -parcelHelpers.export(exports, "HittableCylinder", ()=>HittableCylinder); -parcelHelpers.export(exports, "HittableCylinderSdf", ()=>HittableCylinderSdf); -parcelHelpers.export(exports, "HittableHexPrism", ()=>HittableHexPrism); -parcelHelpers.export(exports, "HittableHexPrismSdf", ()=>HittableHexPrismSdf); -parcelHelpers.export(exports, "HittableRect", ()=>HittableRect); -parcelHelpers.export(exports, "HittableXyRect", ()=>HittableXyRect); -parcelHelpers.export(exports, "HittableXzRect", ()=>HittableXzRect); -parcelHelpers.export(exports, "HittableYzRect", ()=>HittableYzRect); -parcelHelpers.export(exports, "HittableFontXyRect", ()=>HittableFontXyRect); -parcelHelpers.export(exports, "HittableSdfXyRect", ()=>HittableSdfXyRect); -parcelHelpers.export(exports, "HittableRotatedXyRect", ()=>HittableRotatedXyRect); -parcelHelpers.export(exports, "HittableRotatedFontXyRect", ()=>HittableRotatedFontXyRect); -parcelHelpers.export(exports, "HittableRotatedSdfXyRect", ()=>HittableRotatedSdfXyRect); -parcelHelpers.export(exports, "HittableConstantMedium", ()=>HittableConstantMedium); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _boundsJs = require("../../helpers/bounds.js"); -var _aabbJs = require("./aabb.js"); -const HittableType = { - sphere: 0, - box: 1, - cylinder: 2, - hexPrism: 3, - rotatedBox: 4, - xyRect: 5, - xzRect: 6, - yzRect: 7, - rotatedXyRect: 8, - fontXyRect: 9, - rotatedFontXyRect: 10, - boxSdf: 11, - cylinderSdf: 12, - hexPrismSdf: 13, - constantMedium: 14, - sdfXyRect: 15, - rotatedSdfXyRect: 16, - rotatedBoxSdf: 17, - xYDisk: 18, - rotatedXyDisk: 19, - ringSdf: 20, - rotatedRingSdf: 21 -}; -class HittableBufferData extends Float32Array { - constructor(count){ - super(count * HittableBufferData.SIZE); - this.CENTER0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.SIZE0_OFFSET = 4; - this.MATERIAL_ID_OFFSET = 7; - this.ROTATION0_OFFSET = 8; - this.ROTATION1_OFFSET = 12; - this.TEXCOORD0_OFFSET = 16; - this.TEXCOORD1_OFFSET = 18; - this.CENTER1_OFFSET = 20; - this.ROUNDING_OFFSET = 23; - this.SIZE1_OFFSET = 24; - this.BOUNDARY_TYPE_OFFSET = 27; - this.TIME0_OFFSET = 28; - this.TIME1_OFFSET = 29; - this.TEX_ID_OFFSET = 30; - this.SDF_BUFFER_OFFSET = 31; - this.SDF_BORDER_OFFSET = 32; - this.PARAMETER_1_OFFSET = 33; - this.PARAMETER_2_OFFSET = 34; - } - getType(index) { - return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[HittableBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getTime0(index) { - return this[HittableBufferData.SIZE * index + this.TIME0_OFFSET]; - } - setTime0(index, value) { - this[HittableBufferData.SIZE * index + this.TIME0_OFFSET] = value; - } - getTime1(index) { - return this[HittableBufferData.SIZE * index + this.TIME1_OFFSET]; - } - setTime1(index, value) { - this[HittableBufferData.SIZE * index + this.TIME1_OFFSET] = value; - } - getSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getMaterialId(index) { - return this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET]; - } - setMaterialId(index, value) { - this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET] = value; - } - getRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + get textureShader() { + return this._textureShader; } - setTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + get lassoShader() { + return this._lassoShader; } - getTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + get sdfTextShader() { + return this._sdfTextShader; } - setTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + get gridShader() { + return this._gridShader; } - getRounding(index) { - return this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET]; + get blockShader() { + return this._blockShader; } - setRounding(index, value) { - this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET] = value; + get sphereShader() { + return this._sphereShader; } - getParameter1(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET]; + get cyclinderShader() { + return this._cylinderShader; } - setParameter1(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET] = value; + get sdfShader() { + return this._sdfShader; } - getParameter2(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET]; + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; } - setParameter2(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET] = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } - getBoundaryType(index) { - return this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET]; + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; } - setBoundaryType(index, value) { - this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET] = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - getTexId(index) { - return this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET]; + get config() { + return this._config; + } + constructor(options2) { + super(options2); + this._config = new Config(); + this._quad = new Quad$1(); + this._lasso = new Lasso(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$5(); + this._position = create$6(); + this._direction = create$6(); + this._cameraRotation = create$8(); + this._cameraPosition = create$6(); + this._modelPosition = create$6(); + this._modelManipulationOrigin = create$6(); + this._shadowVMatrix = create$7(); + this._shadowPMatrix = create$7(); } - setTexId(index, value) { - this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET] = value; + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; } - getSdfBuffer(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET]; + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources(); + this._textureShader = new Texture(core, this); + this._lassoShader = new Lasso$1(core, this); + this._sdfTextShader = new SdfText(core, this); + this._gridShader = new PickGrid(core, this); + this._blockShader = new UnitBlock(core, this); + this._sphereShader = new UnitSphere(core, this); + this._cylinderShader = new UnitCylinder(core, this); + this._sdfShader = new UnitSdf(core, this); + this._backgroundShader = new Background(core, this); + this._ssaoShader = new Ssao(core, this); + this._boxShader = new Box(core, this); + this._deferredShader = new Deferred(core, this); + this._combineShader = new Combine(core, this); + this._dofBlurShader = new DofBlur(core, this); + this._downsampleShader = new Downsample(core, this); + this._gaussianShader = new Gaussian(core, this); + this._dofCombineShader = new DofCombine(core, this); + this._fxaaShader = new Fxaa(core, this); + this._brightPassShader = new Bright(core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; } - setSdfBuffer(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET] = value; + _initializeContext(gl) { + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); + const random2 = new PseudoRandom(0); + const _vec3 = create$6(); + for (let i = 0; i < this._config.ssaoKernelSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + _vec3[2] = random2.nextFloat(); + normalize$5(_vec3, _vec3); + scale$5(_vec3, _vec3, random2.nextFloat()); + let scale2 = i / this._config.ssaoKernelSize; + scale2 = MathHelper.lerp(0.1, 1, scale2 * scale2); + scale$5(_vec3, _vec3, scale2); + this._ssaoSampleKernel[i * 3] = _vec3[0]; + this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; + this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; + } + const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); + _vec3[2] = 0; + for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + normalize$5(_vec3, _vec3); + noise[i * 4] = _vec3[0]; + noise[i * 4 + 1] = _vec3[1]; + } + this._ssaoNoiseTexture = this._gl.createTexture(); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); + this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); + this._ssaoWidth = -1; + this._ssaoHeight = -1; + this._shadowWidth = -1; + this._shadowHeight = -1; + this._shaderResources.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._backgroundShader.initializeContext(this._gl); + this._ssaoShader.initializeContext(this._gl); + this._boxShader.initializeContext(this._gl); + this._deferredShader.initializeContext(this._gl); + this._combineShader.initializeContext(this._gl); + this._dofBlurShader.initializeContext(this._gl); + this._downsampleShader.initializeContext(this._gl); + this._gaussianShader.initializeContext(this._gl); + this._dofCombineShader.initializeContext(this._gl); + this._fxaaShader.initializeContext(this._gl); + this._brightPassShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } } - getSdfBorder(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET]; + _resize(width2, height2) { + super._resize(width2, height2); + this._positionTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); + this._colorTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._normalTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._geometryFrameBuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width2, height2); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._gl.drawBuffers([this._gl.COLOR_ATTACHMENT0, this._gl.COLOR_ATTACHMENT1, this._gl.COLOR_ATTACHMENT2]); + this._postProcessTexture1 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessDepthTexture = TextureHelper.create(this._gl, width2, height2, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); + this._postProcessTexture2 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); + this._postProcessDofTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); + this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); + const widthHalf = Math.round(width2 / 2); + const heightHalf = Math.round(height2 / 2); + this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); + this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); + this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); + this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); + const widthSixteenth = Math.round(widthEighth / 2); + const hgeightSixteenth = Math.round(heightEighth / 2); + this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); + this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); } - setSdfBorder(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; + _createContext(canvas) { + let supported = false; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + const options2 = { + stencil: true, + alpha: false, + antialias: false, + preserveDrawingBuffer + }; + const gl = canvas.getContext("webgl2", options2); + if (gl) { + const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); + if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { + const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); + const framebuffer = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + if (status == gl.FRAMEBUFFER_COMPLETE) { + supported = true; + } + gl.bindTexture(gl.TEXTURE_2D, null); + } + } + return supported ? gl : null; } -} -HittableBufferData.SIZE = 36; -class Hittable { - get center0() { - return this._center0; + prepare() { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + break; + } } - get center1() { - return this._center1; + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; } - get time0() { - return this._time0; + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } - get time1() { - return this._time1; + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } - get material() { - return this._material; - } - set material(material) { - this._material = material; - } - get bounds() { - return this._bounds; - } - get offset0() { - return this._offset0; - } - get offset1() { - return this._offset1; - } - constructor(options){ - this._center0 = options.center0; - this._center1 = options.center1; - this._time0 = options.time0; - this._time1 = options.time1; - this._material = options.material; - this._bounds = new (0, _aabbJs.AABB)(); - this._offset0 = (0, _glMatrix.vec3).create(); - this._offset1 = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index, materialId) { - buffer.setCenter0(index, this._center0); - buffer.setCenter1(index, this._center1); - buffer.setTime0(index, this._time0); - buffer.setTime1(index, this._time1); - buffer.setMaterialId(index, materialId); - } -} -class HittableSphere extends Hittable { - get radius() { - return this._radius; - } - constructor(options){ - super(options); - this._radius = options.radius; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._radius, this._center1[1] - this._radius); - max[1] = Math.max(this._center0[1] + this._radius, this._center1[1] + this._radius); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.sphere); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._radius, this._radius)); - } -} -class HittableXyDisk extends Hittable { - get texCoord0() { - return this._texCoord0; + _createLabelVisual(label2) { + return new LabelVisual(this._core, this, label2); } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._radius0 = options.radius0; - this._radius1 = options.radius1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius0, this._center1[0] - this._radius1); - max[0] = Math.max(this._center0[0] + this._radius0, this._center1[0] + this._radius1); - min[1] = Math.min(this._center0[1] - this._radius0, this._center1[1] - this._radius1); - max[1] = Math.max(this._center0[1] + this._radius0, this._center1[1] + this._radius1); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xYDisk); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius0, this._radius0, this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius1, this._radius1, this._thickness)); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableRotatedXyDisk extends HittableXyDisk { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyDisk); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRingSdf extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - this._angle = options.angle0; - this._innerRadius = options.innerRadius0; - this._rounding = options.rounding; - const outerRadius = this._size0[0]; - const innerRadius = this._size0[1]; - const extrudedThicknesses = this._size0[2]; - const min = this._bounds.min; - const max = this._bounds.max; - max[1] = this._center0[1] + outerRadius; - const sinAngle = Math.sin(this._angle); - const cosAngle = Math.cos(this._angle); - if (this._angle < (0, _constantsJs.Constants).PI_OVER_TWO) { - min[0] = this.center0[0] - sinAngle * outerRadius; - max[0] = this.center0[0] + sinAngle * outerRadius; - min[1] = this.center0[1] + cosAngle * innerRadius; - } else { - min[0] = this._center0[0] - outerRadius; - max[0] = this._center0[0] + outerRadius; - min[1] = this._center0[1] + cosAngle * outerRadius; - } - min[2] = this._center0[2] - extrudedThicknesses; - max[2] = this._center0[2] + extrudedThicknesses; - this.offset0[0] = (min[0] + max[0]) / 2 - this._center0[0]; - this.offset0[1] = (min[1] + max[1]) / 2 - this._center0[1]; - this.offset0[2] = (min[2] + max[2]) / 2 - this._center0[2]; - this.offset1[0] = (min[0] + max[0]) / 2 - this._center1[0]; - this.offset1[1] = (min[1] + max[1]) / 2 - this._center1[1]; - this.offset1[2] = (min[2] + max[2]) / 2 - this._center1[2]; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.ringSdf); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - buffer.setParameter1(index, this._angle); - buffer.setParameter2(index, this._innerRadius); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedRingSdf extends HittableRingSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedRingSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableBox extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._size0[2], this._center1[2] - this._size1[2]); - max[2] = Math.max(this._center0[2] + this._size0[2], this._center1[2] + this._size1[2]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.box); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - } -} -class HittableBoxSdf extends HittableBox { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.boxSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedBoxSdf extends HittableBoxSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBoxSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedBox extends HittableBox { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBox); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinder extends Hittable { - get radius() { - return this._radius; + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - this._rotation0 = options.rotation0 || (0, _constantsJs.Constants).QUAT_IDENTITY; - this._rotation1 = options.rotation1 || (0, _constantsJs.Constants).QUAT_IDENTITY; - if (this._rotation0[3] * this._rotation1[3] == 1) { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._height, this._center1[1] - this._height); - max[1] = Math.max(this._center0[1] + this._height, this._center1[1] + this._height); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } else { - const ca0 = (0, _glMatrix.vec3).create(); - const pa0 = (0, _glMatrix.vec3).create(); - const pb0 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation0); - (0, _glMatrix.vec3).scaleAndAdd(pa0, this._center0, ca0, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb0, this._center0, ca0, this._height); - const ca1 = (0, _glMatrix.vec3).create(); - const pa1 = (0, _glMatrix.vec3).create(); - const pb1 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca1, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation1); - (0, _glMatrix.vec3).scaleAndAdd(pa1, this._center1, ca1, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb1, this._center1, ca1, this._height); - this._bounds.fromCylinder(pa0, pb0, this._radius); - const bounds = new (0, _aabbJs.AABB)(); - bounds.fromCylinder(pa1, pb1, this._radius); - const min0 = this._bounds.min; - const max0 = this._bounds.max; - const min1 = bounds.min; - const max1 = bounds.max; - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - } - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinder); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinderSdf extends HittableCylinder { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinderSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableHexPrism extends Hittable { - get radius() { - return this._radius; + createImageVisual(image2) { + const visual = new ImageVisual(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = this._center0[0] - this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - max[0] = this._center0[0] + this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - min[1] = this._center0[1] - this._height; - max[1] = this._center0[1] + this._height; - min[2] = this._center0[2] - this._radius; - max[2] = this._center0[2] + this._radius; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrism); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO, this._height, this._radius)); - } -} -class HittableHexPrismSdf extends HittableHexPrism { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrismSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRect extends Hittable { - get texCoord0() { - return this._texCoord0; + createFontVisual(font2) { + const visual = new FontVisual(this._core, font2); + visual.initializeContext(this._gl); + return visual; } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._size0 = options.size0; - this._size1 = options.size1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - this._setBounds(); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableXyRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xyRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._size0[1], this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._size1[1], this._thickness)); - } -} -class HittableXzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._thickness, this._center1[1] - this._thickness); - max[1] = Math.max(this._center0[1] + this._thickness, this._center1[1] + this._thickness); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._thickness, this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._thickness, this._size1[1])); - } -} -class HittableYzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._thickness, this._center1[0] - this._thickness); - max[0] = Math.max(this._center0[0] + this._thickness, this._center1[0] + this._thickness); - min[1] = Math.min(this._center0[1] - this._size0[0], this._center1[1] - this._size1[0]); - max[1] = Math.max(this._center0[1] + this._size0[0], this._center1[1] + this._size1[0]); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.yzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size0[0], this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size1[0], this._size1[1])); - } -} -class HittableFontXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.fontXyRect); - } -} -class HittableSdfXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.sdfXyRect); - } -} -class HittableRotatedXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyRect); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedFontXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.rotatedFontXyRect); - } -} -class HittableRotatedSdfXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.rotatedSdfXyRect); - } -} -class HittableConstantMedium extends Hittable { - get boundary() { - return this._boundary; - } - constructor(options){ - super(options); - this._boundary = options.boundary; - this._bounds = this._boundary.bounds; - } - toBuffer(buffer, index, materialId) { - this._boundary.toBuffer(buffer, index, materialId); - buffer.setBoundaryType(index, buffer.getType(index)); - buffer.setType(index, HittableType.constantMedium); - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../helpers/bounds.js":"beD2A","./aabb.js":"7wAtJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wAtJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AABB", ()=>AABB); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../../meshes/cube.js"); -class AABB { - get min() { - return this._min; - } - get max() { - return this._max; - } - constructor(){ - this._min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - this._max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - } - centroid(centroid) { - centroid[0] = (this._min[0] + this._max[0]) / 2; - centroid[1] = (this._min[1] + this._max[1]) / 2; - centroid[2] = (this._min[2] + this._max[2]) / 2; - } - size(size) { - size[0] = this._max[0] - this._min[0]; - size[1] = this._max[1] - this._min[1]; - size[2] = this._max[2] - this._min[2]; - } - offset(point, normalized) { - normalized[0] = (point[0] - this._min[0]) / (this._max[0] - this._min[0]); - normalized[1] = (point[1] - this._min[1]) / (this._max[1] - this._min[1]); - normalized[2] = (point[2] - this._min[2]) / (this._max[2] - this._min[2]); - } - unionBounds(bounds) { - (0, _glMatrix.vec3).min(this._min, this._min, bounds.min); - (0, _glMatrix.vec3).max(this._max, this._max, bounds.max); - } - unionPoint(point) { - (0, _glMatrix.vec3).min(this._min, this._min, point); - (0, _glMatrix.vec3).max(this._max, this._max, point); - } - maximumExtent() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - if (dx > dy && dx > dz) return 0; - else if (dy > dz) return 1; - return 2; - } - surfaceArea() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - return 2 * (dx * dy + dx * dz + dy * dz); - } - rotate(rotation) { - const sizeX = this._max[0] - this._min[0]; - const sizeY = this._max[1] - this._min[1]; - const sizeZ = this._max[2] - this._min[2]; - const min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - const max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const position = (0, _glMatrix.vec3).create(); - const vertices = (0, _cubeJs.Cube).POSITIONS; - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).copy(this._min, min); - (0, _glMatrix.vec3).copy(this._max, max); - } - fromCylinder(pa, pb, radius) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - this._min[0] = Math.min(pa[0] - ex, pb[0] - ex); - this._min[1] = Math.min(pa[1] - ey, pb[1] - ey); - this._min[2] = Math.min(pa[2] - ez, pb[2] - ez); - this._max[0] = Math.max(pa[0] + ex, pb[0] + ex); - this._max[1] = Math.max(pa[1] + ey, pb[1] + ey); - this._max[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"5x28d","../../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cAHlu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ComputeShaderWgsl", ()=>ComputeShaderWgsl); -parcelHelpers.export(exports, "ComputeUniformBufferData", ()=>ComputeUniformBufferData); -var _glMatrix = require("gl-matrix"); -const ComputeShaderWgsl = ` -const PI = 3.1415926535897932385f; -const TWO_PI = 6.2831853071795864769f; -const ROOT_THREE_OVER_TWO = 0.86602540378443864676f; - -struct ColorBuffer { - values: array<f32>, -} - -// (normal.x, normal.y, normal.z, depth) -struct NormalDepthBuffer { - values: array<f32>, -} - -// Min, max -// TODO: Convert to atomic add with uint -struct DepthMinMaxBuffer { - values: array<atomic<u32>>, -} - -struct Ray { - origin: vec3<f32>, - direction: vec3<f32>, - time: f32, -} - -struct HitRecord { - normal: vec3<f32>, - t: f32, - frontFace: bool, - materialId: u32, - uv: vec2<f32>, - id: u32, - previousId: u32, - position: vec3<f32>, - previousPosition: vec3<f32>, - isAbsorbing: bool, - previousIsAbsorbing: bool, - absorption: vec3<f32>, - previousAbsorption: vec3<f32>, - sdfBorder: bool, -} - -struct Camera { - origin: vec3<f32>, - lowerLeftCorner: vec3<f32>, - horizontal: vec3<f32>, - vertical: vec3<f32>, - lookAt: vec3<f32>, - u: vec3<f32>, - v: vec3<f32>, - w: vec3<f32>, - aspectRatio: f32, - viewportWidth: f32, - viewportHeight: f32, - fov: f32, - aperture: f32, - time0: f32, - time1: f32, -} - - // offest align size -struct Uniforms { // ------------------------------ - position: vec3<f32>, // 0 16 12 - width: f32, // 12 4 4 - right: vec3<f32>, // 16 16 12 - height: f32, // 28 4 4 - up: vec3<f32>, // 32 16 12 - seed: f32, // 44 4 4 - forward: vec3<f32>, // 48 16 12 - fov: f32, // 60 4 4 - lookAt: vec3<f32>, // 64 16 12 - aperture: f32, // 76 4 4 - backgroundColor: vec3<f32>, // 80 16 12 - time0: f32, // 92 4 4 - time1: f32, // 96 4 4 - tilesX : f32, // 100 4 4 - tilesY : f32, // 104 4 4 - tileOffsetX : f32, // 108 4 4 - tileOffsetY : f32, // 112 4 4 - raysPerFrame : f32, // 116 4 4 - // padding 120 4 8 - // ------------------------------ - // 16 128 -} - -// id type -// ---------------- -// 0 none -// 1 solidColor -// 2 image -// 3 sdfText -// 4 checker -// 5 grid - // offest align size stride -struct Texture { // --------------------------------------- - color0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - color1: vec3<f32>, // 16 12 12 - // padding 28 12 12 - size0: vec4<f32>, // 32 16 16 - size1: vec4<f32>, // 48 16 16 - clip: vec4<f32>, // 64 16 16 - offset: vec2<f32>, // 80 8 8 -} // --------------------------------------- - // 16 88 96 - -// id type -// --------------- -// 0 lambertian -// 1 metal -// 2 dielectric -// 3 diffuse light -// 4 glossy -// 5 isotropic -// 6 varnitsh - // offest align size stride -struct Material { // --------------------------------------- - typeId: f32, // 0 4 4 - fuzz: f32, // 4 4 4 - refractiveIndex: f32, // 8 4 4 - textureId: f32, // 12 4 4 - color: vec3<f32>, // 16 16 12 - glossiness: f32, // 28 4 4 - idColor: vec4<f32>, // 32 16 16 - density: f32, // 48 4 4 - // --------------------------------------- -} // 16 52 64 - -// id type -// ---------------- -// 0 distant -// 1 sphere -// 2 rect -// 3 disk -// 4 cylinder -// 5 dome - // offest align size stride -struct Light { // --------------------------------------- - rotation: vec4<f32>, // 0 16 16 - center: vec3<f32>, // 16 16 12 - typeId: f32, // 28 4 4 - size: vec3<f32>, // 32 16 12 - // padding 44 4 4 - color: vec3<f32>, // 48 16 12 -} // --------------------------------------- - // 16 60 64 - -// id type -// ---------------- -// 0 sphere -// 1 box -// 2 cylinder -// 3 hexPrism -// 4 rotatedBox -// 5 xyRect -// 6 xzRect -// 7 yzRect -// 8 rotatedXyRect -// 9 fontXyRect -// 10 rotatedFontXyRect -// 11 boxSdf -// 12 cylinderSdf -// 13 hexPrismSdf -// 14 constantMedium -// 15 sdfXyRect -// 16 rotatedSdfXyRect -// 17 rotatedBoxSdf -// 18 xyDisk -// 19 rotatedXyDisk -// 20 ringSdf -// 21 rotatedRingSdf - // offest align size stride -struct Hittable { // --------------------------------------- - center0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - size0: vec3<f32>, // 16 16 12 - materialId: f32, // 28 4 4 - rotation0: vec4<f32>, // 32 16 16 - rotation1: vec4<f32>, // 48 16 16 - texCoord0: vec2<f32>, // 64 8 8 - texCoord1: vec2<f32>, // 72 8 8 - center1: vec3<f32>, // 80 16 12 - rounding: f32, // 92 4 4 - size1: vec3<f32>, // 96 16 12 - boundaryTypeId: f32, // 108 4 4 - time0: f32, // 112 4 4 - time1: f32, // 116 4 4 - texId: f32, // 120 4 4 - sdfBuffer: f32, // 124 4 4 - sdfBorder: f32, // 128 4 4 - parameter1: f32, // 132 4 4 - parameter2: f32, // 136 4 4 - // padding 140 4 4 -} // --------------------------------------- - // 16 144 144 - - // offest align size stride -struct LinearBVHNode { // --------------------------------------- - center: vec3<f32>, // 0 16 12 - primitivesOffset: f32, // 12 4 4 - size: vec3<f32>, // 16 16 12 - secondChildOffset: f32, // 28 4 4 - nPrimitives: f32, // 32 4 4 - axis: f32, // 36 4 4 -} // --------------------------------------- - // 16 40 48 - -struct HittableBuffer { - hittables: array<Hittable>, -} - -struct MaterialBuffer { - materials: array<Material>, -} - -struct TextureBuffer { - textures: array<Texture>, -} - -struct LightBuffer { - lights: array<Light>, -} - -struct LinearBVHNodeBuffer { - nodes: array<LinearBVHNode>, -} - -// Schlick's approximation for reflectance -fn reflectance(cos: f32, refractiveIndex: f32) -> f32 { - var r = (1f - refractiveIndex) / (1f + refractiveIndex); - r = r * r; - return r + (1f - r) * pow(1f - cos, 5f); -} - -fn refraction(uv: vec3<f32>, n: vec3<f32>, etaiOverEtat: f32) -> vec3<f32> { - let cosTheta = min(dot(-uv, n), 1f); - let rOutPerp = etaiOverEtat * (uv + cosTheta * n); - let rOutParallel = -sqrt(abs(1f - dot(rOutPerp, rOutPerp))) * n; - return rOutPerp + rOutParallel; -} - -fn getCamera(uniforms: Uniforms) -> Camera { - var camera: Camera; - camera.aperture = uniforms.aperture; - camera.aspectRatio = uniforms.width / uniforms.height; - camera.fov = uniforms.fov; - camera.viewportHeight = 2f * tan(camera.fov / 2f); - camera.viewportWidth = camera.aspectRatio * camera.viewportHeight; - camera.origin = uniforms.position; - camera.lookAt = uniforms.lookAt; - camera.u = uniforms.right; - camera.v = uniforms.up; - camera.w = uniforms.forward; - let focusDistance = dot(camera.w, camera.origin - camera.lookAt); - camera.horizontal = camera.u * camera.viewportWidth * focusDistance; - camera.vertical = camera.v * camera.viewportHeight * focusDistance; - camera.lowerLeftCorner = camera.origin - camera.horizontal / 2f + camera.vertical / 2f - camera.w * focusDistance; - camera.time0 = uniforms.time0; - camera.time1 = uniforms.time1; - return camera; -} - -fn getCameraRay(camera: Camera, seed: ptr<function, u32>, texCoord: vec2<f32>) -> Ray { - // Depth of field - let rd = camera.aperture * randomInUnitDisk(seed); - let offset = camera.u * rd.x + camera.v * rd.y; - - var ray: Ray; - ray.origin = camera.origin + offset; - ray.direction = normalize(camera.lowerLeftCorner + texCoord.x * camera.horizontal - texCoord.y * camera.vertical - camera.origin - offset); - ray.time = camera.time0 + random(seed) * (camera.time1 - camera.time0); - return ray; -} - -fn degreesToRadians(degrees: f32) -> f32 { - return degrees * PI / 180f; -} - -// See https://www.reedbeta.com/blog/hash-functions-for-gpu-rendering/ -fn random(seed: ptr<function, u32>) -> f32 { - var random = ((*seed >> ((*seed >> 28u) + 4u)) ^ *seed) * 277803737u; - random = (random >> 22u) ^ random; - *seed = *seed * 747796405u + 2891336453u; - return f32(random) / 4294967295f; // [0,1] -} - -fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { - var p: vec2<f32>; - loop { - p = 2f * vec2<f32>(random(seed), random(seed)) - vec2<f32>(1f, 1f); - if (dot(p, p) <= 1f) { break; } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); } - return p; -} - -// fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { -// let t = TWO_PI * random(seed); -// let r = sqrt(random(seed)); -// return r * vec2<f32>(cos(t), sin(t)); -// } - -fn randomInUnitSphere(seed: ptr<function, u32>) -> vec3<f32> { - var p: vec3<f32>; - loop { - p = 2f * vec3<f32>(random(seed), random(seed), random(seed)) - vec3<f32>(1f, 1f, 1f); - if (dot(p, p) <= 1f) { break; } + update(elapsedTime) { + super.update(elapsedTime); + if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { + this._shadowWidth = this._config.shadowWidth; + this._shadowHeight = this._config.shadowHeight; + this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._shadowFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); + this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); + } + if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { + this._ssaoWidth = this._config.ssaoWidth; + this._ssaoHeight = this._config.ssaoHeight; + this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); + this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); + this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); + } + if (this._config.isDofEnabled && this._config.dofAutoFocus) { + this._core.getModelManipulationOrigin(this._modelManipulationOrigin); + this._core.getModelPosition(this._modelPosition); + add$4(this._position, this._modelManipulationOrigin, this._modelPosition); + this._core.camera.getPosition(this._cameraPosition); + subtract(this._position, this._position, this._cameraPosition); + const distance2 = -this._position[2]; + const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); + this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance2, amount); + } } - return p; -} - -fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { - return normalize(randomInUnitSphere(seed)); -} - -// fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { -// let theta = TWO_PI * random(seed); // [0,2Pi] -// let phi = acos(2f * random(seed) - 1f); // [-1,1] -// return vec3<f32>(sin(phi) * cos(theta), sin(phi) * sin(theta), cos(phi)); -// } - -fn rayAt(ray: Ray, t: f32) -> vec3<f32> { - return ray.origin + ray.direction * t; -} - -fn setFaceNormal(ray: Ray, outwardNormal: vec3<f32>, hitRecord: ptr<function, HitRecord>) { - (*hitRecord).frontFace = dot(ray.direction, outwardNormal) < 0f; - (*hitRecord).normal = select(-outwardNormal, outwardNormal, (*hitRecord).frontFace); -} - -// fn hitWorld(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { -// var hitAnything = false; -// var closestSoFar = tMax; -// let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; -// var tempHitRecord: HitRecord; -// for (var i: u32 = 0u; i < arrayLength(&hittableBuffer.hittables); i = i + 1u) { -// if (hit(i, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { -// hitAnything = true; -// closestSoFar = tempHitRecord.t; -// tempHitRecord.materialId = u32(hittableBuffer.hittables[i].materialId); -// *hitRecord = tempHitRecord; -// } -// } -// return hitAnything; -// } - -fn hitBVH(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - var hitAnything = false; - var closestSoFar = tMax; - let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; - var tempHitRecord: HitRecord; - var toVisitOffset = 0u; - var currentNodeIndex = 0u; - var nodesToVisit: array<u32, 64>; - loop { - let node = &linearBVHNodeBuffer.nodes[currentNodeIndex]; - // Check ray against BVH node - if (intersectBox((*node).center, (*node).size, ray, invDir, tMin, closestSoFar)) { - let nPrimitives = u32((*node).nPrimitives); - if (nPrimitives > 0u) { - let primitiveOffset = u32((*node).primitivesOffset); - for (var i: u32 = 0u; i < nPrimitives; i = i + 1u) { - let id = primitiveOffset + i; - if (hit(id, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { - hitAnything = true; - closestSoFar = tempHitRecord.t; - tempHitRecord.materialId = u32(hittableBuffer.hittables[id].materialId); - tempHitRecord.id = id; - } - } - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; + render(elapsedTime) { + return __awaiter$1(this, void 0, void 0, function* () { + this._gl.enable(this._gl.DEPTH_TEST); + this._gl.enable(this._gl.CULL_FACE); + this._gl.cullFace(this._gl.BACK); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); + if (this.config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.clear(this._gl.DEPTH_BUFFER_BIT); + perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + fromMat4(this._cameraRotation, this.inverseVMatrices[0]); + transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); + add$4(this._position, this._position, this._modelPosition); + lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants$1.VECTOR3_UNITY); + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(transitionBuffer); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.geometryFramebuffer = this._geometryFrameBuffer; + axesVisual.render(elapsedTime); } - else { - // Put far BVH node on nodesToVisit stack, advance to near node - if (ray.direction[u32((*node).axis)] < 0f) { - nodesToVisit[toVisitOffset] = currentNodeIndex + 1u; - currentNodeIndex = u32((*node).secondChildOffset); - } else { - nodesToVisit[toVisitOffset] = u32((*node).secondChildOffset); - currentNodeIndex = currentNodeIndex + 1u; - } - toVisitOffset = toVisitOffset + 1u; + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; + labelSetVisual.render(elapsedTime); } + } } - else { - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.geometryFramebuffer = this._geometryFrameBuffer; + imageVisual.render(elapsedTime); + } + } + } + if (this._backgroundShader.isInitialized) { + this._backgroundShader.prepare(); + this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._backgroundShader.apply(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._gl.bindVertexArray(null); + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + } else { + set$7(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { + const viewport = this._viewportOffset; + this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } } + }); } - if (hitAnything) { - tempHitRecord.previousId = (*hitRecord).id; - tempHitRecord.previousPosition = (*hitRecord).position; - tempHitRecord.previousIsAbsorbing = (*hitRecord).isAbsorbing; - tempHitRecord.previousAbsorption = (*hitRecord).absorption; - *hitRecord = tempHitRecord; - return true; - }; - return false; -} - -fn hit(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - switch u32(hittableBuffer.hittables[id].typeId) { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 5u: { - return hitXyRect(id, ray, tMin, tMax, hitRecord); - } - case 6u: { - return hitXzRect(id, ray, tMin, tMax, hitRecord); - } - // case 7u: { - // return hitYzRect(hittable, ray, tMin, tMax, hitRecord); - // } - case 8u: { - return hitRotatedXyRect(id, ray, tMin, tMax, hitRecord); - } - case 9u: { - return hitFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 10u: { - return hitRotatedFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); - } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); - } - case 14u: { - return hitConstantMedium(id, ray, invDir, tMin, tMax, hitRecord, seed); - } - case 15u: { - return hitSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); - } - case 16u: { - return hitRotatedSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); - } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 18u: { - return hitXyDisk(id, ray, tMin, tMax, hitRecord); - } - case 19u: { - return hitRotatedXyDisk(id, ray, tMin, tMax, hitRecord); + _renderTransitionBuffer(transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = currentBuffer.from; + this._blockShader.rangeMax = currentBuffer.to; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._blockShader.vMatrix = this.vMatrices[viewport]; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = true; + this._blockShader.vMatrix = this._shadowVMatrix; + this._blockShader.pMatrix = this._shadowPMatrix; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.isShadowMap = false; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = currentBuffer.from; + this._sphereShader.rangeMax = currentBuffer.to; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sphereShader.vMatrix = this.vMatrices[viewport]; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = true; + this._sphereShader.vMatrix = this._shadowVMatrix; + this._sphereShader.pMatrix = this._shadowPMatrix; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.isShadowMap = false; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = currentBuffer.from; + this._cylinderShader.rangeMax = currentBuffer.to; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._cylinderShader.vMatrix = this.vMatrices[viewport]; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = true; + this._cylinderShader.vMatrix = this._shadowVMatrix; + this._cylinderShader.pMatrix = this._shadowPMatrix; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.isShadowMap = false; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = currentBuffer.from; + this._sdfShader.rangeMax = currentBuffer.to; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sdfShader.vMatrix = this.vMatrices[viewport]; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = true; + this._sdfShader.vMatrix = this._shadowVMatrix; + this._sdfShader.pMatrix = this._shadowPMatrix; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.isShadowMap = false; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); + } + } + _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { + if (this._deferredShader.isInitialized) { + this._gl.disable(this._gl.DEPTH_TEST); + let ssaoTexture; + if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { + this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); + ssaoTexture = this._ssaoTexture1; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); + this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; + this._ssaoShader.indexBuffer = this._quad.indexBuffer; + this._ssaoShader.texture2D1 = this._positionTexture; + this._ssaoShader.texture2D2 = this._normalTexture; + this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; + this._ssaoShader.prepare(); + this._ssaoShader.pMatrix = pMatrix; + this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; + this._ssaoShader.ssaoRadius = this._config.ssaoRadius; + this._ssaoShader.ssaoPower = this._config.ssaoPower; + this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; + this._ssaoShader.left = 0; + this._ssaoShader.top = 0; + this._ssaoShader.width = this._config.ssaoWidth; + this._ssaoShader.height = this._config.ssaoHeight; + this._ssaoShader.apply(); + this._ssaoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { + ssaoTexture = this._ssaoTexture2; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); + this._boxShader.vertexBuffer = this._quad.vertexBuffer; + this._boxShader.indexBuffer = this._quad.indexBuffer; + this._boxShader.texture2D = this._ssaoTexture1; + this._boxShader.prepare(); + this._boxShader.left = 0; + this._boxShader.top = 0; + this._boxShader.width = this._config.ssaoWidth; + this._boxShader.height = this._config.ssaoHeight; + this._boxShader.apply(); + this._boxShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); + let postProcessFrameBuffer = this._postProcessFrameBuffer1; + this._shaderResources.bindFramebuffer(postProcessFrameBuffer); + this._deferredShader.vertexBuffer = this._quad.vertexBuffer; + this._deferredShader.indexBuffer = this._quad.indexBuffer; + this._deferredShader.texture2D1 = this._positionTexture; + this._deferredShader.texture2D2 = this._colorTexture; + this._deferredShader.texture2D3 = this._normalTexture; + this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; + this._deferredShader.texture2D5 = this._shadowDepthTexture; + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); + this._deferredShader.prepare(); + this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; + this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; + this._deferredShader.inverseVMatrix = inverseVMatrix; + this._deferredShader.shadowVMatrix = this._shadowVMatrix; + this._deferredShader.shadowPMatrix = this._shadowPMatrix; + this._deferredShader.vMatrix = vMatrix; + this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; + this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; + this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; + this._core.camera.getPosition(this._cameraPosition); + fromMat4(this._cameraRotation, vMatrix); + set$8(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + normalize$5(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); + subtract(this._direction, this._cameraPosition, this._position); + normalize$5(this._direction, this._direction); + add$4(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); + normalize$5(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); + copy$6(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); + copy$6(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); + this._deferredShader.left = viewport.left; + this._deferredShader.top = viewport.top; + this._deferredShader.width = viewport.width; + this._deferredShader.height = viewport.height; + this._deferredShader.shadowMapWidth = this._config.shadowWidth; + this._deferredShader.shadowMapHeight = this._config.shadowHeight; + this._deferredShader.ambientIntensity = this._config.ambientIntensity; + this._deferredShader.materialIntensity = this._config.materialIntensity; + this._deferredShader.specularPower = this._config.specularPower; + this._deferredShader.specularIntensity = this._config.specularIntensity; + this._deferredShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + const widthHalf = Math.round(viewport.width / 2); + const heightHalf = Math.round(viewport.height / 2); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + const widthSixteenth = Math.round(widthEighth / 2); + const heightSixteenth = Math.round(heightEighth / 2); + if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; + this._dofBlurShader.indexBuffer = this._quad.indexBuffer; + this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofBlurShader.texture2D2 = this._positionTexture; + this._dofBlurShader.prepare(); + this._dofBlurShader.focusDepth = this._config.dofFocusDistance; + this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; + this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; + this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; + this._dofBlurShader.left = viewport.left; + this._dofBlurShader.top = viewport.top; + this._dofBlurShader.width = viewport.width; + this._dofBlurShader.height = viewport.height; + this._dofBlurShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; + this._dofCombineShader.indexBuffer = this._quad.indexBuffer; + this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofCombineShader.texture2D2 = this._postProcessDofTexture; + this._dofCombineShader.prepare(); + this._dofCombineShader.focusDepth = this._config.dofFocusDistance; + this._dofCombineShader.left = viewport.left; + this._dofCombineShader.top = viewport.top; + this._dofCombineShader.width = viewport.width; + this._dofCombineShader.height = viewport.height; + this._dofCombineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthHalf; + this._brightPassShader.height = heightHalf; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessHalfTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthQuarter; + this._brightPassShader.height = heightQuarter; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessQuarterTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthEighth; + this._brightPassShader.height = heightEighth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessEighthTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthSixteenth; + this._brightPassShader.height = heightSixteenth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessHalfTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthHalf; + this._gaussianShader.height = heightHalf; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessHalfTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessQuarterTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthQuarter; + this._gaussianShader.height = heightQuarter; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessQuarterTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessEighthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthEighth; + this._gaussianShader.height = heightEighth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessEighthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthSixteenth; + this._gaussianShader.height = heightSixteenth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; + this._fxaaShader.indexBuffer = this._quad.indexBuffer; + this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._fxaaShader.prepare(); + this._fxaaShader.left = viewport.left; + this._fxaaShader.top = viewport.top; + this._fxaaShader.width = viewport.width; + this._fxaaShader.height = viewport.height; + this._fxaaShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._combineShader.vertexBuffer = this._quad.vertexBuffer; + this._combineShader.indexBuffer = this._quad.indexBuffer; + this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + if (this._config.isBloomEnabled) { + this._combineShader.texture2D2 = this._postProcessHalfTexture1; + this._combineShader.texture2D3 = this._postProcessQuarterTexture1; + this._combineShader.texture2D4 = this._postProcessEighthTexture1; + this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; + } else { + this._combineShader.texture2D2 = null; + this._combineShader.texture2D3 = null; + this._combineShader.texture2D4 = null; + this._combineShader.texture2D5 = null; + } + this._combineShader.prepare(); + this._combineShader.viewport = viewport; + this._combineShader.intensity = this._config.bloomIntensity; + this._combineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }); + class MaterialBufferData extends Float32Array { + constructor(count2) { + super(count2 * MaterialBufferData.SIZE); + this.TYPE_OFFSET = 0 / 4; + this.FUZZ_OFFSET = 4 / 4; + this.REFRACTIVE_INDEX_OFFSET = 8 / 4; + this.TEXTURE_ID_OFFSET = 12 / 4; + this.COLOR_OFFSET = 16 / 4; + this.GLOSSINESS_OFFSET = 28 / 4; + this.ID_COLOR_OFFSET = 32 / 4; + this.DENSITY_OFFSET = 48 / 4; } -} - -fn intersectBox(center: vec3<f32>, size: vec3<f32>, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32) -> bool { - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t0 = -n - k; - let t1 = -n + k; - let tNear = max(max(t0.x, t0.y), t0.z); - let tFar = min(min(t1.x, t1.y), t1.z); - if (tNear > tFar) { return false; } - return tNear < tMax && tFar > 0f; // Must return true when inside box, even if closestSoFar is closer than far box intersection -} - -fn hitConstantMedium(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let constantMedium = &hittableBuffer.hittables[id]; - let boundaryTypeId = u32((*constantMedium).boundaryTypeId); - var tempHitRecord1: HitRecord; - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, -100f, 100f, &tempHitRecord1)) { return false; } - var tempHitRecord2: HitRecord; - // When raymarching narrow grazing angles, adding SHADOW_OFFSET is < epsilon from surface, so hit function returns tN not tF, hence distanceInsideBoundary is incorrect - // Add larger distance to t - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, tempHitRecord1.t + 0.001f, 100f, &tempHitRecord2)) { return false; } - if (tempHitRecord1.t < tMin) { tempHitRecord1.t = tMin; } - if (tempHitRecord2.t > tMax) { tempHitRecord2.t = tMax; } - if (tempHitRecord1.t >= tempHitRecord2.t) { - return false; + getType(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET]; } - tempHitRecord1.t = max(tempHitRecord1.t, 0f); - let distanceInsideBoundary = tempHitRecord2.t - tempHitRecord1.t; - let negativeInverseDensity = -1f / materialBuffer.materials[u32((*constantMedium).materialId)].density; - let hitDistance = negativeInverseDensity * log(random(seed)); - if (hitDistance > distanceInsideBoundary) { return false; } - let t = tempHitRecord1.t + hitDistance; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - return true; -} - -fn hitConstantMediumBoundary(id: u32, boundaryTypeId: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - switch boundaryTypeId { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); - } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); - } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); - } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); - } - } -} - -fn hitSphere(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let sphere = &hittableBuffer.hittables[id]; - let radius = (*sphere).size0.x; - let time = min(max((ray.time - (*sphere).time0) / ((*sphere).time1 - (*sphere).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*sphere).center0 + time * ((*sphere).center1 - (*sphere).center0); - let oc = ray.origin - center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - h = sqrt(h); - - // Find the nearest root in range - var root = -b - h; - if (root < tMin || root > tMax) { - root = -b + h; - if (root < tMin || root > tMax) { return false; } - } - - // (*hitRecord).t = root; - // (*hitRecord).position = rayAt(ray, root); - // let outwardNormal = ((*hitRecord).position - center) / radius; - // setFaceNormal(ray, outwardNormal, hitRecord); - - // Reduce precision error in t by ensuring hit position is on sphere surface - let outwardNormal = normalize(ray.origin + ray.direction * root - center); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + outwardNormal * radius; // Use outward normal with internal reflection - (*hitRecord).t = root; // I should also re-calculate t, but this would involve another normalization. t is only used to check closest hit, so only important with overlapping geometry - - // UV - let phi = atan2(outwardNormal.x, outwardNormal.z); // [-pi,pi] - let theta = asin(outwardNormal.y); // [-pi/2, pi/2] - (*hitRecord).uv = vec2<f32>(phi / TWO_PI + 0.5f, theta / PI + 0.5f); // [0,1] - return true; -} - -fn hitBox(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let box = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*box).time0) / ((*box).time1 - (*box).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*box).center0 + time * ((*box).center1 - (*box).center0); - let size = (*box).size0 + time * ((*box).size1 - (*box).size0); - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t1 = -n - k; - let t2 = -n + k; - let tNear = max(max(t1.x, t1.y), t1.z); - let tFar = min(min(t2.x, t2.y), t2.z); - // if (tFar <= tNear) { return false; } - if (tNear > tFar || tFar < 0f) { return false; } - - // Find nearest root in range - var outwardNormal: vec3<f32>; - var root = tNear; - if (root < tMin || root > tMax) { - root = tFar; - if (root < tMin || root > tMax) { return false; } - outwardNormal = sign(ray.direction) * step(t2.xyz, t2.yzx) * step(t2.xyz, t2.zxy); + setType(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; } - else { - outwardNormal = -sign(ray.direction) * step(t1.yzx, t1.xyz) * step(t1.zxy, t1.xyz); + getFuzz(index2) { + return this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET]; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedBox(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBox = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBox).time0) / ((*rotatedBox).time1 - (*rotatedBox).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBox).center0 + time * ((*rotatedBox).center1 - (*rotatedBox).center0); - let rotation = slerpQuat((*rotatedBox).rotation0, (*rotatedBox).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let rotatedInvDir = vec3<f32>(1f, 1f, 1f) / rotatedRay.direction; - let hit = hitBox(id, rotatedRay, rotatedInvDir, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setFuzz(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET] = value2; } - return false; -} - -fn hitXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyDisk = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyDisk).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let radius = (*xyDisk).size0.x; - if (dot(p, p) > radius * radius) { return false; } // dot(p, p) is squared distance from disk center to intersection point - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / radius + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyDisk).texCoord0; - let texCoord1 = (*xyDisk).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyDisk = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyDisk).center0; - let time = min(max((ray.time - (*rotatedXyDisk).time0) / ((*rotatedXyDisk).time1 - (*rotatedXyDisk).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyDisk).center0 + time * ((*rotatedXyDisk).center1 - (*rotatedXyDisk).center0); - let rotation = slerpQuat((*rotatedXyDisk).rotation0, (*rotatedXyDisk).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyDisk(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getRefractiveIndex(index2) { + return this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET]; } - return false; -} - -fn hitXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyRect).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setRefractiveIndex(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET] = value2; } - return false; -} - -fn hitXzRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xzRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xzRect).center0; - - // Distance to plane, t - let t = -oc.y / ray.direction.y; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xzRect).size0; - if (abs(p.x) > size.x || abs(p.z) > size.z) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xz / size.xz + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xzRect).texCoord0; - let texCoord1 = (*xzRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 1f, 0f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -// fn hitYzRect(yzRect: Hittable, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { -// let oc = ray.origin - yzRect.center0; - -// // Distance to plane, t -// let t = -oc.x / ray.direction.x; - -// // If direction == 0, t = +/- infinity, which always returns false -// if (t < tMin || t > tMax) { return false; } - -// // Intersection point in model space -// let p = oc + t * ray.direction; - -// // Bounds -// if (abs(p.y) > yzRect.size0.y || abs(p.z) > yzRect.size0.z) { return false; } - -// // Texture coords -// var uv = vec2<f32>(0.5 * p.yz / yzRect.size0.yz + vec2<f32>(0.5f, 0.5f)); -// uv = yzRect.texCoord0 + uv * (yzRect.texCoord1 - yzRect.texCoord0); - -// (*hitRecord).uv = uv; -// (*hitRecord).t = t; -// (*hitRecord).position = rayAt(ray, t); -// let outwardNormal = vec3<f32>(1f, 0f, 0f); -// setFaceNormal(ray, outwardNormal, hitRecord); -// return true; -// } - -// TODO: Share hit function with XyRect -fn hitFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - let r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - if (r < buffer) { return false; } - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitFontXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getTextureId(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET]; } - return false; -} - -// TODO: Share hit function with FontXyRect, specifying texture -fn hitSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - // let size = (*xyRect).size0; - let size = (*xyRect).size0 + time * ((*xyRect).size1 - (*xyRect).size0); - if (abs(p.x) > (*xyRect).size0.x || abs(p.y) > (*xyRect).size0.y) { return false; } - - // Zero-thickness transparency - // TODO: Pre-multiplied alpha - // if (random(seed) > 0.5f) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - // let r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; - var r: f32; - if ((*xyRect).texId == 0f) { - r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; + setTextureId(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET] = value2; } - else { - r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - } - if (r < buffer) { return false; } - - // sdfBorder - let border = xyRect.sdfBorder / 0xff; - (*hitRecord).sdfBorder = r - buffer < border; - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitSdfXyRect(id, rotatedRay, tMin, tMax, hitRecord, seed); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - return false; -} - -fn rotateQuat(v: vec3<f32>, q: vec4<f32>) -> vec3<f32> { - return v + 2f * cross(q.xyz, cross(q.xyz, v) + q.w * v); -} - -fn slerpQuat(q0: vec4<f32>, q1: vec4<f32>, t: f32) -> vec4<f32> { - var cosom = dot(q0, q1); - var q2 = q1; - if (cosom < 0f) { - cosom = -cosom; - q2 = -q2; - } - var s0: f32; - var s1: f32; - if (1f - cosom > 0.000001f) { - // SLERP - let omega = acos(cosom); - let sinom = sin(omega); - s0 = sin((1f - t) * omega) / sinom; - s1 = sin(t * omega) / sinom; - } - else { - // Quaternions close enough for LERP - s0 = 1f - t; - s1 = t; - } - return s0 * q0 + s1 * q2; -} - -fn conjugate(q: vec4<f32>) -> vec4<f32> { - return vec4<f32>(-q.x, -q.y, -q.z, q.w); -} - -fn hitCylinder(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinder = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinder).time0) / ((*cylinder).time1 - (*cylinder).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinder).center0 + time * ((*cylinder).center1 - (*cylinder).center0); - let size = (*cylinder).size0 + time * ((*cylinder).size1 - (*cylinder).size0); - let rotation = slerpQuat((*cylinder).rotation0, (*cylinder).rotation1, time); - let ra = size.x; // Radius - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let oc = ray.origin - center; - let card = dot(ca, ray.direction); - let caoc = dot(ca, oc); - let a = 1f - card * card; - let b = dot(oc, ray.direction) - caoc * card; - let c = dot(oc, oc) - caoc * caoc - ra * ra; - var h = b * b - a * c; - if (h < 0f) { return false; } - h = sqrt(h); - let br0 = (-b - h) / a; - let br1 = (-b + h) / a; - - // Body - let ch = size.y; // Half-height - let y0 = caoc + br0 * card; - let y1 = caoc + br1 * card; - let bt0 = select(10000000f, br0, abs(y0) < ch); - let bt1 = select(-10000000f, br1, abs(y1) < ch); - - // Caps - let sy0 = sign(y0); - let sy1 = sign(y1); - let cr0 = (sy0 * ch - caoc) / card; - let cr1 = (sy1 * ch - caoc) / card; - let ct0 = select(10000000f, cr0, abs(b + a * cr0) < h); - let ct1 = select(-10000000f, cr1, abs(b + a * cr1) < h); - - // Find the nearest root in range - let tN = min(bt0, ct0); - let tF = max(bt1, ct1); - var root = tN; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - } - - // Normal - var outwardNormal: vec3<f32>; - if (root == bt0 || root == bt1) { - let y = select(y1, y0, root == bt0); - // outwardNormal = (oc + root * ray.direction - ca * y) / ra; - - // Reduce precision error in t by ensuring hit position is on cylinder surface - outwardNormal = normalize(oc + root * ray.direction - ca * y); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + ca * y + outwardNormal * ra; // Use outward normal with internal reflection - (*hitRecord).t = root; + setColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - else { - let sy = select(sy1, sy0, root == ct0); - outwardNormal = ca * sy; - - // TODO: Reduce precision error - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = rayAt(ray, root); - (*hitRecord).t = root; - } - - // setFaceNormal(ray, outwardNormal, hitRecord); - // (*hitRecord).position = rayAt(ray, root); - // (*hitRecord).t = root; - return true; -} - -fn hitHexPrism(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrism = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*hexPrism).time0) / ((*hexPrism).time1 - (*hexPrism).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrism).center0 + time * ((*hexPrism).center1 - (*hexPrism).center0); - let oc = ray.origin - center; - let size = (*hexPrism).size0; - let ra = size.x; // Distance from center to edge - let he = size.y; // Half-height - let rd = ray.direction; - - // Normals - let n1 = vec3<f32>(1f, 0f, 0f); - let n2 = vec3<f32>(0.5f, 0f, ROOT_THREE_OVER_TWO); - let n3 = vec3<f32>(-0.5f, 0f, ROOT_THREE_OVER_TWO); - let n4 = vec3<f32>(0f, 1f, 0f); - - // Slabs intersections - var t1 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n1)) / dot(rd, n1), 1f); - var t2 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n2)) / dot(rd, n2), 1f); - var t3 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n3)) / dot(rd, n3), 1f); - var t4 = vec3<f32>((vec2<f32>(he, -he) - dot(oc, n4)) / dot(rd, n4), 1f); - - // Inetsection selection - if (t1.y < t1.x) { t1 = vec3<f32>(t1.yx, -1f); } - if (t2.y < t2.x) { t2 = vec3<f32>(t2.yx, -1f); } - if (t3.y < t3.x) { t3 = vec3<f32>(t3.yx, -1f); } - if (t4.y < t4.x) { t4 = vec3<f32>(t4.yx, -1f); } - - var tN = vec4<f32>(t1.x, t1.z * n1); - if (t2.x > tN.x) { tN = vec4<f32>(t2.x, t2.z * n2); } - if (t3.x > tN.x) { tN = vec4<f32>(t3.x, t3.z * n3); } - if (t4.x > tN.x) { tN = vec4<f32>(t4.x, t4.z * n4); } - - let tF = min(min(t1.y,t2.y),min(t3.y,t4.y)); - - if (tN.x > tF || tF < 0f) { return false; } - - // Find the nearest root in range - var outwardNormal: vec3<f32>; - var root = tN.x; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - - // Normal - if (root == t1.y) { outwardNormal = -t1.z * n1; } - else if (root == t2.y) { outwardNormal = -t2.z * n2; } - else if (root == t3.y) { outwardNormal = -t3.z * n3; } - else if (root == t4.y) { outwardNormal = -t4.z * n4; } + getGlossiness(index2) { + return this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET]; } - else { - outwardNormal = tN.yzw; + setGlossiness(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET] = value2; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { - let q = abs(p) - b; - return length(max(q, vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y, q.z)), 0f) - r; -} - -// Box frame -// fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { -// let s = abs(p) - b; -// // let e = b.y / 3f; -// let e = 0.0002f; -// let q = abs(s + e) - e; -// return min(min( -// length(max(vec3<f32>(s.x, q.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(s.x, max(q.y,q.z)), 0f), -// length(max(vec3<f32>(q.x, s.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(s.y,q.z)), 0f)), -// length(max(vec3<f32>(q.x, q.y, s.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y,s.z)), 0f)); -// } - -fn hitBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let boxSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*boxSdf).rounding; - // let size = (*boxSdf).size0 - r; - let time = min(max((ray.time - (*boxSdf).time0) / ((*boxSdf).time1 - (*boxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*boxSdf).center0 + time * ((*boxSdf).center1 - (*boxSdf).center0); - // TODO: r0, r1 - let size = (*boxSdf).size0 + time * ((*boxSdf).size1 - (*boxSdf).size0) - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapBoxSdf(oc, size, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapBoxSdf(oc + k.xyy * h, size, r) + - k.yyx * mapBoxSdf(oc + k.yyx * h, size, r) + - k.yxy * mapBoxSdf(oc + k.yxy * h, size, r) + - k.xxx * mapBoxSdf(oc + k.xxx * h, size, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getDensity(index2) { + return this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET]; } - return false; -} - -fn hitRotatedBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBoxSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBoxSdf).time0) / ((*rotatedBoxSdf).time1 - (*rotatedBoxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBoxSdf).center0 + time * ((*rotatedBoxSdf).center1 - (*rotatedBoxSdf).center0); - let rotation = slerpQuat((*rotatedBoxSdf).rotation0, (*rotatedBoxSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitBoxSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setDensity(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET] = value2; } - return false; -} - -fn mapCylinderSdf(p: vec3<f32>, a: vec3<f32>, b: vec3<f32>, r0: f32, r1: f32) -> f32 { - let ba: vec3<f32> = b - a; - let pa: vec3<f32> = p - a; - let baba: f32 = dot(ba, ba); - let paba: f32 = dot(pa, ba); - let x: f32 = length(pa * baba - ba * paba) - r0 * baba; - let y: f32 = abs(paba - baba * 0.5f) - baba * 0.5f; - let x2: f32 = x * x; - let y2: f32 = y * y * baba; - // let d: f32 = (max(x, y) < 0f) ? -min(x2, y2) : (((x > 0f) ? x2 : 0f) + ((y > 0f) ? y2 : 0f)); - let d: f32 = select(select(0f, x2, x > 0f) + select(0f, y2, y > 0f), -min(x2, y2), max(x, y) < 0f); - return sign(d) * sqrt(abs(d)) / baba - r1; -} - -fn hitCylinderSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinderSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinderSdf).time0) / ((*cylinderSdf).time1 - (*cylinderSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinderSdf).center0 + time * ((*cylinderSdf).center1 - (*cylinderSdf).center0); - let size = (*cylinderSdf).size0 + time * ((*cylinderSdf).size1 - (*cylinderSdf).size0); - let rotation = slerpQuat((*cylinderSdf).rotation0, (*cylinderSdf).rotation1, time); - var t = tMin; - let r1 = (*cylinderSdf).rounding; - let r0 = size.x - r1; - let h0 = size.y - r1; - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let pa = ca * h0; - let pb = -pa; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapCylinderSdf(oc, pa, pb, r0, r1)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapCylinderSdf(oc + k.xyy * h, pa, pb, r0, r1) + - k.yyx * mapCylinderSdf(oc + k.yyx * h, pa, pb, r0, r1) + - k.yxy * mapCylinderSdf(oc + k.yxy * h, pa, pb, r0, r1) + - k.xxx * mapCylinderSdf(oc + k.xxx * h, pa, pb, r0, r1)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); } - return false; -} - -fn mapHexPrismSdf(p: vec3<f32>, hx: f32, hy: f32, r: f32) -> f32 { - let k = vec3<f32>(-0.8660254, 0.5, 0.57735); // (-sqrt(3)/2 or sin(60), 0.5, sqrt(3)/3 or tan(30)) - var p0 = abs(p.zxy); - let p1 = p0.xy - 2f * min(dot(k.xy, p0.xy), 0f) * k.xy; - let d = vec2<f32>(length(p1.xy - vec2(clamp(p1.x, -k.z * hx, k.z * hx), hx)) * sign(p1.y - hx), p0.z - hy); - return min(max(d.x, d.y), 0f) + length(max(d, vec2<f32>(0f, 0f))) - r; -} - -fn hitHexPrismSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrismSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*hexPrismSdf).rounding; - let size = (*hexPrismSdf).size0; - let time = min(max((ray.time - (*hexPrismSdf).time0) / ((*hexPrismSdf).time1 - (*hexPrismSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrismSdf).center0 + time * ((*hexPrismSdf).center1 - (*hexPrismSdf).center0); - let hx = size.x - r; - let hy = size.y - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapHexPrismSdf(oc, hx, hy, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // Replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapHexPrismSdf(oc + k.xyy * h, hx, hy, r) + - k.yyx * mapHexPrismSdf(oc + k.yyx * h, hx, hy, r) + - k.yxy * mapHexPrismSdf(oc + k.yxy * h, hx, hy, r) + - k.xxx * mapHexPrismSdf(oc + k.xxx * h, hx, hy, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + setIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; } - return false; -} - -fn mapRingSdf(p: vec3<f32>, n: vec2<f32>, r: f32, th: f32, h: f32, rounding: f32) -> f32 { - let px = abs(p.x); - // expand result of mat2x2(n.x,n.y,-n.y,n.x)*p; - // let p2 = vec2<f32>(n.x * px + n.y * p.y, -n.y * px + n.x * p.y); - // Column-major instead of row-major - let p2 = vec2<f32>(n.x * px - n.y * p.y, n.y * px + n.x * p.y); - let d = max(abs(length(p2) - r) - th * 0.5f, length(vec2<f32>(p2.x, max(0f, abs(r - p2.y) - th * 0.5f))) * sign(p2.x)); - - // Extrude - let w = vec2<f32>(d, abs(p.z) - h); - return min(max(w.x, w.y), 0f) + length(max(w, vec2<f32>(0f, 0f))) - rounding; -} - -fn hitRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let ringSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let size = (*ringSdf).size0; - let center = (*ringSdf).center0; - let rounding = (*ringSdf).rounding; - let outerr = size.x; - let innerr = size.y; - // Reduce angle such that inner radius arc reduces by rounding - var angle = (*ringSdf).parameter1; - angle -= angle * rounding / innerr * PI * 2; - let cs = vec2<f32>(cos(angle), sin(angle)); - let r = (outerr + innerr) * 0.5f; - let th = (outerr - innerr) - rounding; - let e = size.z - rounding; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapRingSdf(oc, cs, r, th, e, rounding)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.00001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapRingSdf(oc + k.xyy * h, cs, r, th, e, rounding) + - k.yyx * mapRingSdf(oc + k.yyx * h, cs, r, th, e, rounding) + - k.yxy * mapRingSdf(oc + k.yxy * h, cs, r, th, e, rounding) + - k.xxx * mapRingSdf(oc + k.xxx * h, cs, r, th, e, rounding)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + } + MaterialBufferData.SIZE = 64 / 4; + class TextureBufferData extends Float32Array { + constructor(count2) { + super(count2 * TextureBufferData.SIZE); + this.COLOR0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.COLOR1_OFFSET = 16 / 4; + this.SIZE0_OFFSET = 32 / 4; + this.SIZE1_OFFSET = 48 / 4; + this.CLIP_OFFSET = 64 / 4; + this.OFFSET_OFFSET = 80 / 4; + } + getType(index2) { + return this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + set$5(value2, this[offset2], this[offset2 + 1]); + } + setOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; } - return false; -} - -fn hitRotatedRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedRingSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedRingSdf).time0) / ((*rotatedRingSdf).time1 - (*rotatedRingSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedRingSdf).center0 + time * ((*rotatedRingSdf).center1 - (*rotatedRingSdf).center0); - let rotation = slerpQuat((*rotatedRingSdf).rotation0, (*rotatedRingSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitRingSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + } + TextureBufferData.SIZE = 96 / 4; + class HittableBufferData extends Float32Array { + constructor(count2) { + super(count2 * HittableBufferData.SIZE); + this.CENTER0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.SIZE0_OFFSET = 16 / 4; + this.MATERIAL_ID_OFFSET = 28 / 4; + this.ROTATION0_OFFSET = 32 / 4; + this.ROTATION1_OFFSET = 48 / 4; + this.TEXCOORD0_OFFSET = 64 / 4; + this.TEXCOORD1_OFFSET = 72 / 4; + this.CENTER1_OFFSET = 80 / 4; + this.ROUNDING_OFFSET = 92 / 4; + this.SIZE1_OFFSET = 96 / 4; + this.BOUNDARY_TYPE_OFFSET = 108 / 4; + this.TIME0_OFFSET = 112 / 4; + this.TIME1_OFFSET = 116 / 4; + this.TEX_ID_OFFSET = 120 / 4; + this.SDF_BUFFER_OFFSET = 124 / 4; + this.SDF_BORDER_OFFSET = 128 / 4; + this.PARAMETER_1_OFFSET = 132 / 4; + this.PARAMETER_2_OFFSET = 136 / 4; + this.MATERIAL_FUZZ_OFFSET = 140 / 4; + this.MATERIAL_GLOSS_OFFSET = 144 / 4; + this.MATERIAL_DENSITY_OFFSET = 148 / 4; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; + this.MATERIAL_COLOR_OFFSET = 160 / 4; + this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; + this.SEGMENT_COLOR_OFFSET = 176 / 4; + this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; + this.TEXTURE_ID_OFFSET = 196 / 4; + } + getType(index2) { + return this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getTime0(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET]; + } + setTime0(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET] = value2; + } + getTime1(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET]; + } + setTime1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET] = value2; + } + getSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + set$5(value2, this[offset2], this[offset2 + 1]); + } + setTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; } - return false; -} - -fn hitLights(ray: Ray) -> vec3<f32> { - var hit: bool; - for (var i: u32 = 0u; i < arrayLength(&lightBuffer.lights); i = i + 1u) { - // let light = lightBuffer.lights[i]; - switch u32(lightBuffer.lights[i].typeId) { - default: { - hit = hitSphereLight(i, ray); - } - case 2u: { - hit = hitRectLight(i, ray); - } - } - if (hit) { - return lightBuffer.lights[i].color; - } - } - - // Background color - // return vec3<f32>(0f, 0f, 0f); - // return vec3<f32>(1f, 1f, 1f); - return uniforms.backgroundColor; - - // TODO: Dome light - // let t = 0.5f * (ray.direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return background; -} - -fn hitSphereLight(id: u32, ray: Ray) -> bool { - let sphere = &lightBuffer.lights[id]; - let radius = (*sphere).size.x; - let oc = ray.origin - (*sphere).center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - return b < 0f; // Ensure ray towards light -} - -fn hitRectLight(id: u32, ray: Ray) -> bool { - let rotatedXyRect = &lightBuffer.lights[id]; - let center = (*rotatedXyRect).center; - let rotation = (*rotatedXyRect).rotation; - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - if (dot(rotatedRay.direction, vec3<f32>(0f, 0f, 1f)) < 0f) { return false; } // Directional light - let oc = rotatedRay.origin - center; - let t = -oc.z / rotatedRay.direction.z; - if (t < 0f) { return false; } - let p = oc + t * rotatedRay.direction; - if (abs(p.x) > (*rotatedXyRect).size.x || abs(p.y) > (*rotatedXyRect).size.y) { return false; } - return true; -} - -fn nearZero(v: vec3<f32>) -> bool { - return max(max(abs(v.x), abs(v.y)), abs(v.z)) < 0.00000001f; // 1e-8 -} - -fn scatterLambertian(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let scatterDirection = hitRecord.normal + randomUnitVector(seed); - - // Catch degenerate scatter direction - (*ray).direction = select(normalize(scatterDirection), hitRecord.normal, nearZero(scatterDirection)); - - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - return true; -} - -fn scatterMetal(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + materialBuffer.materials[hitRecord.materialId].fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; -} - -fn scatterGlossy(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Specular - let material = &materialBuffer.materials[hitRecord.materialId]; - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - if (reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + (*material).fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; + getTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + set$5(value2, this[offset2], this[offset2 + 1]); } - else { - // Lambertian - return scatterLambertian(ray, hitRecord, attenuation, seed); - } -} - -fn scatterDielectric(ray: ptr<function, Ray>, hitRecord: ptr<function, HitRecord>, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let material = &materialBuffer.materials[(*hitRecord).materialId]; - let refractiveIndex = (*material).refractiveIndex; - // TODO: If still inside another material, use its refractive index - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, (*hitRecord).frontFace); - let cosTheta = min(dot(-(*ray).direction, (*hitRecord).normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - // if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - if (cannotRefract || reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = reflect((*ray).direction, (*hitRecord).normal); + setTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; } - else { - (*ray).direction = refraction((*ray).direction, (*hitRecord).normal, refractionRatio); - } - (*ray).origin = (*hitRecord).position; - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); - - // Did the ray enter/stay inside? - (*attenuation) = vec3<f32>(1f, 1f, 1f); - // if (dot((*ray).direction, (*hitRecord).normal) < 0f) { - if (dot((*ray).direction, select(-(*hitRecord).normal, (*hitRecord).normal, (*hitRecord).frontFace)) < 0f) { - (*hitRecord).isAbsorbing = true; - (*hitRecord).absorption = (*material).color; - - // If already inside another absorbing dielectric, add to absorption - if ((*hitRecord).previousIsAbsorbing && (*hitRecord).id != (*hitRecord).previousId) { - (*hitRecord).absorption = (*hitRecord).absorption + (*hitRecord).previousAbsorption; - } + getRounding(index2) { + return this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET]; } - return true; -} - -fn scatterIsotropic(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = randomUnitVector(seed); - (*ray).origin = hitRecord.position; - (*attenuation) = materialBuffer.materials[hitRecord.materialId].color; - return true; -} - -fn scatterVarnish(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Front-face only (no internal reflection or refraction) - let material = &materialBuffer.materials[hitRecord.materialId]; - if (hitRecord.frontFace && (*material).glossiness > random(seed)) { - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - (*ray).direction = reflect((*ray).direction, hitRecord.normal); - } - else { - // Refraction improves definition at edges and deepens color on faces - (*ray).direction = refraction((*ray).direction, hitRecord.normal, refractionRatio); - } - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); + setRounding(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET] = value2; } - // Pass-through - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - return true; -} - -fn textureValue(hitRecord: HitRecord) -> vec3<f32> { - let textureId = materialBuffer.materials[hitRecord.materialId].textureId; - let texture = &textureBuffer.textures[u32(textureId)]; - switch u32((*texture).typeId) { - // No texture - default: { - return vec3<f32>(); - } - // Solid color - case 1u: { - if (hitRecord.sdfBorder) { - return (*texture).color1; - } - else { - return (*texture).color0; - } - - // Debug uv - // return vec3<f32>(hitRecord.uv, 0f); - } - // Image - case 2u: { - // Sample in linear space - return textureSampleLevel(backgroundTexture, linearSampler, hitRecord.uv, 0f).rgb; - // return vec3(hitRecord.uv.x, hitRecord.uv.y, 0f); - } - // Checker - case 4u: { - let q = trunc((hitRecord.uv + (*texture).offset) / (*texture).size0.xy); - return select((*texture).color0, (*texture).color1, (q.x + q.y) % 2f > 0f); - } - // Grid - case 5u: { - let size0 = (*texture).size0; - let size1 = (*texture).size1; - let clip = (*texture).clip; - if (hitRecord.uv.x < clip.x || hitRecord.uv.y < clip.y || hitRecord.uv.x > clip.z || hitRecord.uv.y > clip.w) { - return (*texture).color1; - } - let uv = hitRecord.uv + (*texture).offset; - var d = uv / size0.xy; - d = abs(d - round(d)) * size0.xy; - if (d.x < size1.x || d.y < size1.y) { - return (*texture).color0; - } - else { - d = uv / size0.zw; - d = abs(d - round(d)) * size0.zw; - if (d.x < size1.z || d.y < size1.w) { - return (*texture).color0; - } - return (*texture).color1; - } - } + getParameter1(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET]; } -} - -fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { - let maxDepth = 16u; // TODO: Pass as uniform - var depth = 0u; - // var result: Color; - var color = vec3<f32>(1f, 1f, 1f); - var attenuation = vec3<f32>(1f, 1f, 1f); - var emitted = vec3<f32>(0f, 0f, 0f); - var hitRecord: HitRecord; - hitRecord.id = 4294967295; // -1 as u32 - var scatter: bool; - loop { - // if (hitWorld(*ray, 0.00001f, 100f, &hitRecord, seed)) { - if (hitBVH(*ray, 0.00001f, 100f, &hitRecord, seed)) { - // Debug normal, depth - // First hit - // if (depth == 0u) { - // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - // // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f) - // // result.depth = 1f / hitRecord.t; - // result.depth = -1f / dot(hitRecord.position - (*ray).origin, uniforms.forward); - // } - // return result; - - // Depth - depth = depth + 1u; - if (depth == maxDepth) { - // Exceeded bounce limit, no more light is gathered - // result.color = vec3<f32>(0f, 0f, 0f); - // return result; - return vec3<f32>(0f, 0f, 0f); - } - - // Bounce - // If last hit was travelling INTO a dielectric, use last hit position to calculate distance - // and apply Beer's law to attenuate the light. Modify the dielectric scattering function to - // recrord travelling INTO a dielectric based on hitRecord normal and ray direction. - // Reset this flag each time here. - if (hitRecord.previousIsAbsorbing) { - // Beer's law - let d = distance(hitRecord.previousPosition, hitRecord.position); - color = color * exp(-d * hitRecord.previousAbsorption); - } - // Reset absorption - hitRecord.isAbsorbing = false; - hitRecord.absorption = vec3<f32>(0f, 0f, 0f); - switch u32(materialBuffer.materials[hitRecord.materialId].typeId) { - default: { - scatter = false; - } - case 0u: { - scatter = scatterLambertian(ray, hitRecord, &attenuation, seed); - } - case 1u: { - scatter = scatterMetal(ray, hitRecord, &attenuation, seed); - } - case 2u: { - scatter = scatterDielectric(ray, &hitRecord, &attenuation, seed); - } - case 3u: { - scatter = scatterGlossy(ray, hitRecord, &attenuation, seed); - } - case 4u: { - // Diffuse light - scatter = false; - emitted = materialBuffer.materials[hitRecord.materialId].color; - } - case 5u: { - scatter = scatterIsotropic(ray, hitRecord, &attenuation, seed); - } - case 6u: { - scatter = scatterVarnish(ray, hitRecord, &attenuation, seed); - } - } - - if (scatter) { - // Attenuate - color = color * attenuation; - } - else { - // Emit - // result.color = color * emitted; - // return result; - return color * emitted; - } - } - else { - // return color; - - // No hits - if (depth > 0u) { // Hide lights, background - return hitLights(*ray) * color; - // result.color = hitLights(*ray) * color; - // return result; - } - else { - // return vec3<f32>(0f, 0f, 0f); - return uniforms.backgroundColor; - // result.color = uniforms.backgroundColor; - // return result; - } - - // Background - // let t = 0.5f * ((*ray).direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return color * background; - } - } -} - -// TODO: Try writing color directly using var outputTexture : texture_storage_2d<rgb32f,read_write>; -// textureStore(outputTexture, uv, vec3<f32>(1f, 1f, 1f)); -@group(0) @binding(0) var<storage, read_write> outputColorBuffer: ColorBuffer; -@group(0) @binding(1) var<uniform> uniforms: Uniforms; -@group(0) @binding(2) var<storage, read> hittableBuffer: HittableBuffer; -@group(0) @binding(3) var<storage, read> materialBuffer: MaterialBuffer; -@group(0) @binding(4) var<storage, read> textureBuffer: TextureBuffer; -@group(0) @binding(5) var<storage, read> lightBuffer: LightBuffer; -@group(0) @binding(6) var<storage, read> linearBVHNodeBuffer: LinearBVHNodeBuffer; -@group(0) @binding(7) var linearSampler: sampler; -@group(0) @binding(8) var fontTexture: texture_2d<f32>; -@group(0) @binding(9) var backgroundTexture: texture_2d<f32>; -@group(0) @binding(10) var atlasTexture: texture_2d<f32>; -@group(0) @binding(11) var<storage, read_write> outputNormalDepthBuffer: NormalDepthBuffer; -@group(0) @binding(12) var<storage, read_write> depthMinMaxBuffer: DepthMinMaxBuffer; - -// TODO: Move lighting to seperate bind group so I can update it independently - -@compute @workgroup_size(256, 1, 1) -fn clear(@builtin(global_invocation_id) globalId : vec3<u32>) { - var index = globalId.x * 3u; - outputColorBuffer.values[index] = 0f; - outputColorBuffer.values[index + 1u] = 0f; - outputColorBuffer.values[index + 2u] = 0f; - index = globalId.x * 4u; - outputNormalDepthBuffer.values[index] = 0f; // Normal x - outputNormalDepthBuffer.values[index + 1u] = 0f; // Normal y - outputNormalDepthBuffer.values[index + 2u] = 0f; // Normal z - outputNormalDepthBuffer.values[index + 3u] = 0f; // Depth - atomicStore(&depthMinMaxBuffer.values[0], 4294967295u); - atomicStore(&depthMinMaxBuffer.values[1], 0u); -} - -@compute @workgroup_size(256, 1, 1) -fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var normal = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - depth = -1f / dot(hitRecord.position - ray.origin, uniforms.forward); - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = normal.x; - outputNormalDepthBuffer.values[index + 1u] = normal.y; - outputNormalDepthBuffer.values[index + 2u] = normal.z; - outputNormalDepthBuffer.values[index + 3u] = depth; - - // Min, max depth - // When depth is 0, it means no hit, so ignore - if (depth > 0f) { - atomicMin(&depthMinMaxBuffer.values[0], u32(depth * 1000f)); - } - atomicMax(&depthMinMaxBuffer.values[1], u32(depth * 1000f)); -} - -@compute @workgroup_size(256, 1, 1) -fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var color = vec4<f32>(1f, 1f, 1f, 0f); - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - // color = materialBuffer.materials[hitRecord.materialId].idColor; - let id = f32(hitRecord.id & 255u) / 255f; - color.x = id; - color.y = id; - color.z = id; - // let color3 = textureValue(hitRecord); - // color.x = color3.x; - // color.y = color3.y; - // color.z = color3.z; - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = color.x; - outputNormalDepthBuffer.values[index + 1u] = color.y; - outputNormalDepthBuffer.values[index + 2u] = color.z; - outputNormalDepthBuffer.values[index + 3u] = 1f; -} - -// @builtin(local_invocation_id) localId : vec3<u32>, -// @builtin(num_workgroups) numWorkgroups : vec3<u32>, -// @builtin(workgroup_id) workgroupId : vec3<u32> -// TODO: Use workgroup dimensions xy to get position directly froem globalId -// Then store using textureStore -// Check within bounds due to overdispatching - -@compute @workgroup_size(256, 1, 1) -fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // TODO: Is additional noise when tiling due to sdf iterations (try non-sdf), texel offsets, (size - 1) issues, overdispatching? - - // Tex coords [0,1] - // let id = f32(globalId.x); - // TODO: Divide by (imageSize.x - 1) - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Frame seed - var frameSeed = u32(uniforms.seed); - let raysPerFrame = u32(uniforms.raysPerFrame); - var color = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var normal = vec3<f32>(0f, 0f, 0f); - var seed: u32; - - for (var i = 0u; i < raysPerFrame; i = i + 1u) { - // Random number generator - // See https://nelari.us/post/weekend_raytracing_with_wgpu_1/#implement-a-random-number-generator - // fn initRng(pixel: vec2<u32>, resolution: vec2<u32>, frame: u32) -> u32 { - // // Adapted from https://github.com/boksajak/referencePT - // let seed = dot(pixel, vec2<u32>(1u, resolution.x)) ^ jenkinsHash(frame); - // return jenkinsHash(seed); - // } - // - // fn jenkinsHash(input: u32) -> u32 { - // var x = input; - // x += x << 10u; - // x ^= x >> 6u; - // x += x << 3u; - // x ^= x >> 11u; - // x += x << 15u; - // return x; - // } - // TODO: Consider switching to u32 for uniforms and use vec3<u32> arithmetic - seed = u32(tilePixelY * tileSize.x + tilePixelX) + frameSeed * u32(tileSize.x * tileSize.y); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord) + vec2<f32>(random(&seed), random(&seed)) / imageSize; - - // Ray - var ray = getCameraRay(camera, &seed, samplePos); - - // Color [0,1] - // let color = result.color; - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(1f, 1f, 1f)); - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - color += clamp(rayColor(&ray, &seed), vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - - // Depth - // let depth = 1f / rayColor(&ray, &seed).depth; - // color = vec3<f32>(depth, depth, depth); - // depth += result.depth; - - // Normal - // normal += result.normal; - - // Next frame - frameSeed = frameSeed + 1u; - } - let index = globalId.x * 3u; - outputColorBuffer.values[index + 0u] = outputColorBuffer.values[index + 0u] + color.x; - outputColorBuffer.values[index + 1u] = outputColorBuffer.values[index + 1u] + color.y; - outputColorBuffer.values[index + 2u] = outputColorBuffer.values[index + 2u] + color.z; - // outputDepthBuffer.values[globalId.x] = outputDepthBuffer.values[globalId.x] + depth; - // outputNormalBuffer.values[index + 0u] = outputNormalBuffer.values[index + 0u] + normal.x; - // outputNormalBuffer.values[index + 1u] = outputNormalBuffer.values[index + 1u] + normal.y; - // outputNormalBuffer.values[index + 2u] = outputNormalBuffer.values[index + 2u] + normal.z; -}`; -class ComputeUniformBufferData extends Float32Array { - constructor(){ - super(ComputeUniformBufferData.SIZE); - this.POSITION_OFFSET = 0; - this.WIDTH_OFFSET = 3; - this.RIGHT_OFFSET = 4; - this.HEIGHT_OFFSET = 7; - this.UP_OFFSET = 8; - this.SEED_OFFSET = 11; - this.FORWARD_OFFSET = 12; - this.FOV_OFFSET = 15; - this.LOOKAT_OFFSET = 16; - this.APERTURE_OFFSET = 19; - this.BACKGROUND_COLOR_OFFSET = 20; - this.TIME0_OFFSET = 23; - this.TIME1_OFFSET = 24; - this.TILES_X = 25; - this.TILES_Y = 26; - this.TILE_OFFSET_X = 27; - this.TILE_OFFSET_Y = 28; - this.RAYS_PER_FRAME_OFFSET = 29; + setParameter1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET] = value2; + } + getParameter2(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET]; + } + setParameter2(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET] = value2; + } + getBoundaryType(index2) { + return this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET]; + } + setBoundaryType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET] = value2; + } + getTexId(index2) { + return this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET]; + } + setTexId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET] = value2; + } + getSdfBuffer(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET]; + } + setSdfBuffer(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET] = value2; + } + getSdfBorder(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET]; + } + setSdfBorder(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET] = value2; + } + getMaterialTypeId(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET]; + } + setMaterialTypeId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET] = value2; + } + getMaterialFuzz(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET]; + } + setMaterialFuzz(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET] = value2; + } + getMaterialDensity(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET]; + } + setMaterialDensity(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET] = value2; + } + getMaterialGloss(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET]; + } + setMaterialGloss(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET] = value2; + } + getMaterialRefractiveIndex(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; + } + setMaterialRefractiveIndex(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value2; + } + getMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; + } + setMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; + value2[3] = this[offset2 + 3]; + } + setSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + } + HittableBufferData.SIZE = 208 / 4; + class ComputeUniformBufferData extends Float32Array { + constructor() { + super(ComputeUniformBufferData.SIZE); + this.POSITION_OFFSET = 0 / 4; + this.WIDTH_OFFSET = 12 / 4; + this.RIGHT_OFFSET = 16 / 4; + this.HEIGHT_OFFSET = 28 / 4; + this.UP_OFFSET = 32 / 4; + this.SEED_OFFSET = 44 / 4; + this.FORWARD_OFFSET = 48 / 4; + this.FOV_OFFSET = 60 / 4; + this.BACKGROUND_COLOR_OFFSET = 64 / 4; + this.TIME0_OFFSET = 76 / 4; + this.AMBIENT_COLOR_OFFSET = 80 / 4; + this.TIME1_OFFSET = 92 / 4; + this.TILES_X = 96 / 4; + this.TILES_Y = 100 / 4; + this.TILE_OFFSET_X = 104 / 4; + this.TILE_OFFSET_Y = 108 / 4; + this.LOOKAT_OFFSET = 112 / 4; + this.APERTURE_OFFSET = 124 / 4; + this.FOCUS_DISTANCE_OFFSET = 128 / 4; + this.RAYS_PER_FRAME_OFFSET = 132 / 4; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value2) { + this[this.FOCUS_DISTANCE_OFFSET] = value2; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSeed() { - return this[this.SEED_OFFSET]; + return this[this.SEED_OFFSET]; } - setSeed(value) { - this[this.SEED_OFFSET] = value; + setSeed(value2) { + this[this.SEED_OFFSET] = value2; } getRaysPerFrame() { - return this[this.RAYS_PER_FRAME_OFFSET]; + return this[this.RAYS_PER_FRAME_OFFSET]; } - setRaysPerFrame(value) { - this[this.RAYS_PER_FRAME_OFFSET] = value; + setRaysPerFrame(value2) { + this[this.RAYS_PER_FRAME_OFFSET] = value2; } getFieldOfView() { - return this[this.FOV_OFFSET]; + return this[this.FOV_OFFSET]; } - setFieldOfView(value) { - this[this.FOV_OFFSET] = value; + setFieldOfView(value2) { + this[this.FOV_OFFSET] = value2; } getAperture() { - return this[this.APERTURE_OFFSET]; + return this[this.APERTURE_OFFSET]; } - setAperture(value) { - this[this.APERTURE_OFFSET] = value; + setAperture(value2) { + this[this.APERTURE_OFFSET] = value2; } - getPosition(value) { - (0, _glMatrix.vec3).set(value, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); + getPosition(value2) { + set$8(value2, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); } - setPosition(value) { - this[this.POSITION_OFFSET] = value[0]; - this[this.POSITION_OFFSET + 1] = value[1]; - this[this.POSITION_OFFSET + 2] = value[2]; + setPosition(value2) { + this[this.POSITION_OFFSET] = value2[0]; + this[this.POSITION_OFFSET + 1] = value2[1]; + this[this.POSITION_OFFSET + 2] = value2[2]; } - getRight(value) { - (0, _glMatrix.vec3).set(value, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); + getRight(value2) { + set$8(value2, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); } - setRight(value) { - this[this.RIGHT_OFFSET] = value[0]; - this[this.RIGHT_OFFSET + 1] = value[1]; - this[this.RIGHT_OFFSET + 2] = value[2]; + setRight(value2) { + this[this.RIGHT_OFFSET] = value2[0]; + this[this.RIGHT_OFFSET + 1] = value2[1]; + this[this.RIGHT_OFFSET + 2] = value2[2]; } - getUp(value) { - (0, _glMatrix.vec3).set(value, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); + getUp(value2) { + set$8(value2, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); } - setUp(value) { - this[this.UP_OFFSET] = value[0]; - this[this.UP_OFFSET + 1] = value[1]; - this[this.UP_OFFSET + 2] = value[2]; + setUp(value2) { + this[this.UP_OFFSET] = value2[0]; + this[this.UP_OFFSET + 1] = value2[1]; + this[this.UP_OFFSET + 2] = value2[2]; } - getForward(value) { - (0, _glMatrix.vec3).set(value, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); + getForward(value2) { + set$8(value2, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); } - setForward(value) { - this[this.FORWARD_OFFSET] = value[0]; - this[this.FORWARD_OFFSET + 1] = value[1]; - this[this.FORWARD_OFFSET + 2] = value[2]; + setForward(value2) { + this[this.FORWARD_OFFSET] = value2[0]; + this[this.FORWARD_OFFSET + 1] = value2[1]; + this[this.FORWARD_OFFSET + 2] = value2[2]; } - getLookAt(value) { - (0, _glMatrix.vec3).set(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + getBackgroundColor(value2) { + set$7(value2, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); } - setLookAt(value) { - this[this.LOOKAT_OFFSET] = value[0]; - this[this.LOOKAT_OFFSET + 1] = value[1]; - this[this.LOOKAT_OFFSET + 2] = value[2]; + setBackgroundColor(value2) { + this[this.BACKGROUND_COLOR_OFFSET] = value2[0]; + this[this.BACKGROUND_COLOR_OFFSET + 1] = value2[1]; + this[this.BACKGROUND_COLOR_OFFSET + 2] = value2[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value2[3]; } - getBackgroundColor(value) { - (0, _glMatrix.vec4).set(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], 1); + getAmbientColor(value2) { + set$8(value2, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); } - setBackgroundColor(value) { - this[this.BACKGROUND_COLOR_OFFSET] = value[0]; - this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; - this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + setAmbientColor(value2) { + this[this.AMBIENT_COLOR_OFFSET] = value2[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value2[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value2[2]; } getTime0() { - return this[this.TIME0_OFFSET]; + return this[this.TIME0_OFFSET]; } - setTime0(value) { - this[this.TIME0_OFFSET] = value; + setTime0(value2) { + this[this.TIME0_OFFSET] = value2; } getTime1() { - return this[this.TIME1_OFFSET]; + return this[this.TIME1_OFFSET]; } - setTime1(value) { - this[this.TIME1_OFFSET] = value; + setTime1(value2) { + this[this.TIME1_OFFSET] = value2; } getTilesX() { - return this[this.TILES_X]; + return this[this.TILES_X]; } - setTilesX(value) { - this[this.TILES_X] = value; + setTilesX(value2) { + this[this.TILES_X] = value2; } getTilesY() { - return this[this.TILES_Y]; + return this[this.TILES_Y]; } - setTilesY(value) { - this[this.TILES_Y] = value; + setTilesY(value2) { + this[this.TILES_Y] = value2; } getTileOffsetX() { - return this[this.TILE_OFFSET_X]; + return this[this.TILE_OFFSET_X]; } - setTileOffsetX(value) { - this[this.TILE_OFFSET_X] = value; + setTileOffsetX(value2) { + this[this.TILE_OFFSET_X] = value2; } getTileOffsetY() { - return this[this.TILE_OFFSET_Y]; - } - setTileOffsetY(value) { - this[this.TILE_OFFSET_Y] = value; - } -} -ComputeUniformBufferData.SIZE = 32; - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1gtMg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FullscreenQuadWgsl", ()=>FullscreenQuadWgsl); -parcelHelpers.export(exports, "FullscreenQuadUniformBufferData", ()=>FullscreenQuadUniformBufferData); -const FullscreenQuadWgsl = ` -const GAMMA = vec3<f32>(0.45454545f); // 1 / 2.2 - -struct ColorData { - data : array<f32>, -} - -struct NormalDepthData { - data : array<f32>, -} - - // offest align size -struct Uniforms { // ------------------------------ - width: f32, // 0 4 4 - height: f32, // 4 4 4 - samplesPerPixel: f32, // 8 4 4 - exposure: f32, // 12 4 4 - minDepth: f32, // 16 4 4 - maxDepth: f32, // 20 4 4 - normalEdge: f32, // 24 4 4 - depthEdge: f32, // 28 4 4 -} // ------------------------------ - // 4 32 - -@group(0) @binding(0) var<uniform> uniforms : Uniforms; -@group(0) @binding(1) var<storage, read> colorBuffer : ColorData; -@group(0) @binding(2) var<storage, read> normalDepthBuffer : NormalDepthData; - -struct VertexOutput { - @builtin(position) Position : vec4<f32>, -}; - -@vertex -fn vert_main(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { - var pos = array<vec2<f32>, 6>( - vec2<f32>( 1f, 1f), - vec2<f32>( 1f, -1f), - vec2<f32>(-1f, -1f), - vec2<f32>( 1f, 1f), - vec2<f32>(-1f, -1f), - vec2<f32>(-1f, 1f)); - var output : VertexOutput; - output.Position = vec4<f32>(pos[vertexIndex], 0f, 1f); - return output; -} - -@fragment -fn frag_main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - // [0,1] - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -} - -@fragment -fn frag_depth(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - let depth = normalDepthBuffer.data[index + 3u]; - let minDepth = uniforms.minDepth; - let maxDepth = uniforms.maxDepth; - if (minDepth == maxDepth) { - // Raw, unnormalized depth - return vec4<f32>(vec3<f32>(depth, depth, depth), 1f); + return this[this.TILE_OFFSET_Y]; } - else { - // Normalize depth - var normalizedDepth = (depth - minDepth) / (maxDepth - minDepth); - return vec4<f32>(normalizedDepth, normalizedDepth, normalizedDepth, 1f); - } -} - -@fragment -fn frag_normal(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -// @fragment -// fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { -// let x = floor(coord.x); -// let y = floor(coord.y); -// let index = u32(x + y * uniforms.width) * 4u; - -// // Prevent edge detection at screen edges -// if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } - -// // Normal derivatives -// let p = vec3<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u]); -// let px = vec3<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u]); -// let py = vec3<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u]); -// let dpdx = px - p; -// let dpdy = py - p; -// let fwidth = abs(dpdx) + abs(dpdy); - -// // Depth derivatives -// let d = normalDepthBuffer.data[index + 3u]; -// let dx = normalDepthBuffer.data[index + 7u]; -// let dy = normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]; -// let ddpx = dx - d; -// let ddpy = dy - d; - -// // Normalize depth -// // let minDepth = uniforms.minDepth; -// // let maxDepth = uniforms.maxDepth; -// // let nd = (d - minDepth) / (maxDepth - minDepth); -// // let ndx = (dx - minDepth) / (maxDepth - minDepth); -// // let ndy = (dy - minDepth) / (maxDepth - minDepth); -// // let ddpx = ndx - nd; -// // let ddpy = ndy - nd; - -// let dfwidth = abs(ddpx) + abs(ddpy); - -// // Output white when magnitude of dpdx over a threshold -// let depthEdge = uniforms.depthEdge; -// let normalEdge = uniforms.normalEdge; -// if (dot(fwidth, fwidth) > normalEdge || dfwidth > depthEdge) { -// return vec4<f32>(1f, 1f, 1f, 1f); -// } else { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } -// } - -@fragment -fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - - // Prevent edge detection at screen edges - if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { - return vec4<f32>(0f, 0f, 0f, 1f); - } - - // Segment derivatives - let p = vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], normalDepthBuffer.data[index + 3u]); - let px = vec4<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u], normalDepthBuffer.data[index + 7u]); - let py = vec4<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]); - let dpdx = px - p; - let dpdy = py - p; - let fwidth = abs(dpdx) + abs(dpdy); - - // Output white when magnitude of dpdx over a threshold - if (dot(fwidth, fwidth) > 0f) { - return vec4<f32>(1f, 1f, 1f, 1f); - } else { - return vec4<f32>(0f, 0f, 0f, 1f); - // return p; - } -} - -@fragment -fn frag_segment(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -@fragment -fn frag_main_hdr(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - - // Simple tone-mapping from HDR to LDR - // if (uniforms.exposure > 0f) { - // color = color * uniforms.exposure; - // color = color / (color + vec3<f32>(1f, 1f, 1f)); - // } - - color = color * uniforms.exposure; - // ACES - // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ - let a = 2.51f; - let b = 0.03f; - let c = 2.43f; - let d = 0.59f; - let e = 0.14f; - color = (color * (a * color + b)) / (color * (c * color + d) + e); - - // See https://bruop.github.io/tonemapping/ - // See https://www.shadertoy.com/view/WdjSW3 - - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -}`; -class FullscreenQuadUniformBufferData extends Float32Array { - constructor(){ - super(FullscreenQuadUniformBufferData.SIZE); - this.WIDTH_OFFSET = 0; - this.HEIGHT_OFFSET = 1; - this.SPP_OFFSET = 2; - this.EXPOSURE_OFFSET = 3; - this.MIN_DEPTH_OFFSET = 4; - this.MAX_DEPTH_OFFSET = 5; - this.EDGE_NORMAL_OFFSET = 6; - this.EDGE_DEPTH_OFFSET = 7; + setTileOffsetY(value2) { + this[this.TILE_OFFSET_Y] = value2; + } + getLookAt(value2) { + set$8(value2, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value2) { + this[this.LOOKAT_OFFSET] = value2[0]; + this[this.LOOKAT_OFFSET + 1] = value2[1]; + this[this.LOOKAT_OFFSET + 2] = value2[2]; + } + } + ComputeUniformBufferData.SIZE = 144 / 4; + class FullscreenQuadUniformBufferData extends Float32Array { + constructor() { + super(FullscreenQuadUniformBufferData.SIZE); + this.WIDTH_OFFSET = 0 / 4; + this.HEIGHT_OFFSET = 4 / 4; + this.SPP_OFFSET = 8 / 4; + this.EXPOSURE_OFFSET = 12 / 4; + this.MIN_DEPTH_OFFSET = 16 / 4; + this.MAX_DEPTH_OFFSET = 20 / 4; + this.EDGE_NORMAL_OFFSET = 24 / 4; + this.EDGE_DEPTH_OFFSET = 28 / 4; + this.EDGE_FOREGROUND_OFFSET = 32 / 4; + this.EDGE_BACKGROUND_OFFSET = 48 / 4; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSamplesPerPixel() { - return this[this.SPP_OFFSET]; + return this[this.SPP_OFFSET]; } - setSamplesPerPixel(value) { - this[this.SPP_OFFSET] = value; + setSamplesPerPixel(value2) { + this[this.SPP_OFFSET] = value2; } getExposure() { - return this[this.EXPOSURE_OFFSET]; + return this[this.EXPOSURE_OFFSET]; } - setExposure(value) { - this[this.EXPOSURE_OFFSET] = value; + setExposure(value2) { + this[this.EXPOSURE_OFFSET] = value2; } getMinDepth() { - return this[this.MIN_DEPTH_OFFSET]; + return this[this.MIN_DEPTH_OFFSET]; } - setMinDepth(value) { - this[this.MIN_DEPTH_OFFSET] = value; + setMinDepth(value2) { + this[this.MIN_DEPTH_OFFSET] = value2; } getMaxDepth() { - return this[this.MAX_DEPTH_OFFSET]; + return this[this.MAX_DEPTH_OFFSET]; } - setMaxDepth(value) { - this[this.MAX_DEPTH_OFFSET] = value; + setMaxDepth(value2) { + this[this.MAX_DEPTH_OFFSET] = value2; } getEdgeDepth() { - return this[this.EDGE_DEPTH_OFFSET]; + return this[this.EDGE_DEPTH_OFFSET]; } - setEdgeDepth(value) { - this[this.EDGE_DEPTH_OFFSET] = value; + setEdgeDepth(value2) { + this[this.EDGE_DEPTH_OFFSET] = value2; } getEdgeNormal() { - return this[this.EDGE_NORMAL_OFFSET]; - } - setEdgeNormal(value) { - this[this.EDGE_NORMAL_OFFSET] = value; - } -} -FullscreenQuadUniformBufferData.SIZE = 8; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8lb3C":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SplitMethod", ()=>SplitMethod); -parcelHelpers.export(exports, "LinearBVHNode", ()=>LinearBVHNode); -parcelHelpers.export(exports, "BVHAccel", ()=>BVHAccel); -parcelHelpers.export(exports, "LinearBVHNodeBufferData", ()=>LinearBVHNodeBufferData); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _aabbJs = require("./aabb.js"); -const SplitMethod = { - middle: "middle", - equalCounts: "equalCounts", - sah: "sah" -}; -class BVHPrimitiveInfo { - get primitiveNumber() { - return this._primitiveNumber; - } - get bounds() { - return this._bounds; - } - get centroid() { - return this._centroid; - } - constructor(primitiveNumber, bounds){ - this._primitiveNumber = primitiveNumber; - this._bounds = bounds; - this._centroid = (0, _glMatrix.vec3).create(); - bounds.centroid(this._centroid); - } -} -class BVHBuildNode { - get bounds() { - return this._bounds; - } - get left() { - return this._left; - } - get right() { - return this._right; - } - get splitAxis() { - return this._splitAxis; - } - get firstPrimOffset() { - return this._firstPrimOffset; - } - get nPrimitives() { - return this._nPrimitives; - } - get start() { - return this._start; - } - get end() { - return this._end; - } - constructor(start, end){ - this._start = start; - this._end = end; - } - initLeaf(first, n, bounds) { - this._firstPrimOffset = first; - this._nPrimitives = n; - this._bounds = bounds; - this._left = null; - this._right = null; - } - initInterior(axis, left, right) { - this._left = left; - this._right = right; - this._bounds = new (0, _aabbJs.AABB)(); - this._bounds.unionBounds(this._left.bounds); - this._bounds.unionBounds(this._right.bounds); - this._splitAxis = axis; - this._nPrimitives = 0; - } -} -class LinearBVHNode { - constructor(){ - this.bounds = new (0, _aabbJs.AABB)(); - this.primitivesOffset = 0; - this.secondChildOffset = 0; - this.nPrimitives = 0; - this.axis = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._size = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index) { - this.bounds.centroid(this._centroid); - buffer.setCenter(index, this._centroid); - this.bounds.size(this._size); - (0, _glMatrix.vec3).scale(this._size, this._size, 0.5); - buffer.setSize(index, this._size); - buffer.setPrimitivesOffset(index, this.primitivesOffset); - buffer.setSecondChildOffset(index, this.secondChildOffset); - buffer.setNPrimitives(index, this.nPrimitives); - buffer.setAxis(index, this.axis); - } -} -class BVHAccel { - get orderedPrimitives() { - return this._orderedPrimitives; - } - get nodes() { - return this._nodes; - } - constructor(core, primitives, maxPrimsInNode, splitMethod){ - this._core = core; - if (!primitives || primitives.length == 0) return; - let start = performance.now(); - this._maxPrimsInNode = maxPrimsInNode; - this._splitMethod = splitMethod; - this._primitives = primitives; - this._normalized = (0, _glMatrix.vec3).create(); - this._primitiveInfo = []; - for(let i = 0; i < primitives.length; i++)this._primitiveInfo.push(new BVHPrimitiveInfo(i, primitives[i].bounds)); - this._totalNodes = 0; - this._orderedPrimitives = []; - const root = this._recursiveBuild(0, primitives.length); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh ${this._totalNodes} nodes split ${this._splitMethod} ${Math.round(window.performance.now() - start)}ms`); - start = performance.now(); - this._nodes = []; - for(let i = 0; i < this._totalNodes; i++)this._nodes.push(new LinearBVHNode()); - this._offset = 0; - this._flattenBVHTree(root); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh flattened ${Math.round(window.performance.now() - start)}ms`); - } - _recursiveBuild(start, end) { - const node = new BVHBuildNode(start, end - 1); - this._totalNodes++; - const bounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)bounds.unionBounds(this._primitiveInfo[i].bounds); - const nPrimitives = end - start; - if (nPrimitives == 1) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - const centroidBounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)centroidBounds.unionPoint(this._primitiveInfo[i].centroid); - const dim = centroidBounds.maximumExtent(); - let mid = Math.floor((start + end) / 2); - if (centroidBounds.max[dim] == centroidBounds.min[dim]) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - switch(this._splitMethod){ - case SplitMethod.middle: - break; - case SplitMethod.equalCounts: - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - break; - case SplitMethod.sah: - default: - if (nPrimitives <= 4) { - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - } else { - const nBuckets = 12; - const buckets = []; - for(let i = 0; i < nBuckets; i++)buckets.push({ - count: 0, - bounds: new (0, _aabbJs.AABB)() - }); - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - buckets[b].count++; - buckets[b].bounds.unionBounds(this._primitiveInfo[i].bounds); - } - const cost = []; - for(let i = 0; i < nBuckets - 1; i++){ - const b0 = new (0, _aabbJs.AABB)(); - const b1 = new (0, _aabbJs.AABB)(); - let count0 = 0; - let count1 = 0; - for(let j = 0; j <= i; j++){ - b0.unionBounds(buckets[j].bounds); - count0 += buckets[j].count; - } - for(let j = i + 1; j < nBuckets; j++){ - b1.unionBounds(buckets[j].bounds); - count1 += buckets[j].count; - } - cost.push(0.125 + (count0 * b0.surfaceArea() + count1 * b1.surfaceArea()) / bounds.surfaceArea()); - } - let minCost = cost[0]; - let minCostSplitBucket = 0; - for(let i = 1; i < nBuckets - 1; i++)if (cost[i] < minCost) { - minCost = cost[i]; - minCostSplitBucket = i; - } - const leafCost = nPrimitives; - if (nPrimitives > this._maxPrimsInNode || minCost < leafCost) { - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - if (b > minCostSplitBucket) { - mid = i; - break; - } - } - } else { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } - } - break; - } - node.initInterior(dim, this._recursiveBuild(start, mid), this._recursiveBuild(mid, end)); - } - } - return node; - } - _flattenBVHTree(node) { - const linearNode = this._nodes[this._offset]; - linearNode.bounds = node.bounds; - const myOffset = this._offset++; - if (node.nPrimitives > 0) { - linearNode.primitivesOffset = node.firstPrimOffset; - linearNode.nPrimitives = node.nPrimitives; - } else { - linearNode.axis = node.splitAxis; - linearNode.nPrimitives = 0; - this._flattenBVHTree(node.left); - linearNode.secondChildOffset = this._flattenBVHTree(node.right); - } - return myOffset; - } -} -class LinearBVHNodeBufferData extends Float32Array { - constructor(count){ - super(count * LinearBVHNodeBufferData.SIZE); - this.CENTER_OFFSET = 0; - this.SIZE_OFFSET = 4; - this.PRIMITIVES_OFFSET_OFFSET = 3; - this.SECOND_CHILD_OFFSET_OFFSET = 7; - this.N_PRIMITIVES_OFFSET = 8; - this.AXIS_OFFSET = 9; - } - getCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getPrimitivesOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET]; - } - setPrimitivesOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET] = value; - } - getSecondChildOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET]; - } - setSecondChildOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET] = value; - } - getNPrimitives(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET]; - } - setNPrimitives(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET] = value; - } - getAxis(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET]; - } - setAxis(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET] = value; - } -} -LinearBVHNodeBufferData.SIZE = 12; - -},{"gl-matrix":"5x28d","../../main.js":"f421K","./aabb.js":"7wAtJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2sMdC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LightType", ()=>LightType); -parcelHelpers.export(exports, "LightBufferData", ()=>LightBufferData); -parcelHelpers.export(exports, "Light", ()=>Light); -parcelHelpers.export(exports, "SphereLight", ()=>SphereLight); -parcelHelpers.export(exports, "RectLight", ()=>RectLight); -var _glMatrix = require("gl-matrix"); -const LightType = { - distant: 0, - sphere: 1, - rect: 2, - disc: 3, - cylinder: 4, - dome: 5 -}; -class LightBufferData extends Float32Array { - constructor(count){ - super(count * LightBufferData.SIZE); - this.ROTATION_OFFSET = 0; - this.CENTER_OFFSET = 4; - this.TYPE_OFFSET = 7; - this.SIZE_OFFSET = 8; - this.COLOR_OFFSET = 12; - } - getType(index) { - return this[LightBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[LightBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -LightBufferData.SIZE = 16; -class Light { - constructor(options){ - this.color = options.color; - this.center = options.center; - } - toBuffer(buffer, index) { - buffer.setCenter(index, this.center); - buffer.setColor(index, this.color); - } -} -class SphereLight extends Light { - constructor(options){ - super(options); - this.radius = options.radius / 2; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.sphere); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.radius, this.radius, this.radius)); - } -} -class RectLight extends Light { - constructor(options){ - super(options); - this._thickness = 0.00001; - this.size = options.size; - this.rotation = options.rotation; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.rect); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.size[0], this.size[1], this._thickness)); - buffer.setRotation(index, this.rotation); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rF26":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _mainJs = require("../../main.js"); -class FontVisual { - get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; + return this[this.EDGE_NORMAL_OFFSET]; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeNormal(value2) { + this[this.EDGE_NORMAL_OFFSET] = value2; } - initializeContext(device) { - this._device = device; - this._hasChanged = true; - this._isInitialized = true; + getEdgeForeground(value2) { + set$7(value2, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - const imageData = this._font.atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this.texture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this.texture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - } + setEdgeForeground(value2) { + this[this.EDGE_FOREGROUND_OFFSET] = value2[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value2[3]; } -} - -},{"../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"enHlm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _imageJs = require("../../components/image.js"); -var _hittableJs = require("./hittable.js"); -class ImageVisual { - get isInitialized() { - return this._isInitialized; + getEdgeBackground(value2) { + set$7(value2, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); } - get image() { - return this._image; - } - render(elapsedTime) {} - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this.isVisible = true; - image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeBackground(value2) { + this[this.EDGE_BACKGROUND_OFFSET] = value2[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value2[3]; } - initializeContext(device) { - if (!this._image.isInitialized) this._image.initialize(); - this._hasChanged = true; - this._isInitialized = true; + } + FullscreenQuadUniformBufferData.SIZE = 64 / 4; + class LinearBVHNodeBufferData extends Float32Array { + constructor(count2) { + super(count2 * LinearBVHNodeBufferData.SIZE); + this.CENTER_OFFSET = 0 / 4; + this.SIZE_OFFSET = 16 / 4; + this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; + this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; + this.N_PRIMITIVES_OFFSET = 32 / 4; + this.AXIS_OFFSET = 36 / 4; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const material = this._image.material == -1 ? this._main.config.defaultMaterial : this._main.materials[this._image.material]; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - const modelSizeX = this._image.maxBoundsX - this._image.minBoundsX; - const modelSizeY = this._image.maxBoundsY - this._image.minBoundsY; - const modelSizeZ = this._image.maxBoundsZ - this._image.minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - if (this._image instanceof (0, _imageJs.ImageQuad)) { - const imageQuad = this._image; - const position = (0, _glMatrix.vec3).fromValues((imageQuad.minBoundsX + imageQuad.maxBoundsX) / 2, (imageQuad.minBoundsY + imageQuad.maxBoundsY) / 2, (imageQuad.minBoundsZ + imageQuad.maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(position, imageQuad.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableRotatedXyRectOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - size1: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - material: material, - texCoord0: imageQuad.texCoord0, - texCoord1: imageQuad.texCoord1, - rotation0: imageQuad.rotation, - rotation1: imageQuad.rotation - }; - this.hittable = new (0, _hittableJs.HittableRotatedXyRect)(hittableRotatedXyRectOptions); - } else if (this._image instanceof (0, _imageJs.ImageSphere)) { - const imageSphere = this._image; - const position = imageSphere.position; - (0, _glMatrix.vec3).subtract(position, imageSphere.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableSphereOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - radius: imageSphere.radius * boundsScaling, - material: material - }; - this.hittable = new (0, _hittableJs.HittableSphere)(hittableSphereOptions); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"5x28d","../../components/image.js":"kwtZG","./hittable.js":"5cw7N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"72uDI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -class LabelSetVisual { - get isInitialized() { - return this._isInitialized; + getCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - get label() { - return this._labelSet; - } - render(elapsedTime) {} - constructor(core, main, labelSet){ - this._core = core; - this._main = main; - this._labelSet = labelSet; - this.isVisible = true; - labelSet.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - if (!this._labelSet.isInitialized) this._labelSet.initialize(); - if (this._labelSet.text && this._labelSet.text.length > 0) this._hasChanged = true; - this._isInitialized = true; + setCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const glpyhRotation = (0, _glMatrix.quat).create(); - const glyphInvRotation = (0, _glMatrix.quat).create(); - const position0 = (0, _glMatrix.vec3).create(); - const position1 = (0, _glMatrix.vec3).create(); - const dataView = this._labelSet.verticesView; - const labelCount = this._labelSet.text.length; - let glyphIndex = 0; - for(let i = 0; i < labelCount; i++){ - const material = this._labelSet.material !== undefined ? this._main.materials[this._labelSet.material] : this._labelSet.materials ? this._main.materials[this._labelSet.materials[i]] : this._main.config.defaultTextMaterial; - const glyphCount = this._labelSet.text[i].length; - for(let j = 0; j < glyphCount; j++){ - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 2, position0); - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 1, position1); - (0, _glMatrix.vec3).scale(position0, position0, modelScale); - (0, _glMatrix.vec3).scale(position1, position1, modelScale); - (0, _glMatrix.vec3).transformQuat(position0, position0, modelRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, modelRotation); - (0, _glMatrix.vec3).add(position0, position0, modelPosition); - (0, _glMatrix.vec3).add(position1, position1, modelPosition); - const centroid = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(centroid, position0, position1); - (0, _glMatrix.vec3).scale(centroid, centroid, 0.5); - if (this._labelSet.rotation) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotation[0], this._labelSet.rotation[1], this._labelSet.rotation[2], this._labelSet.rotation[3]); - else if (this._labelSet.rotations) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotations[i * 4], this._labelSet.rotations[i * 4 + 1], this._labelSet.rotations[i * 4 + 2], this._labelSet.rotations[i * 4 + 3]); - else (0, _glMatrix.quat).identity(glpyhRotation); - const rotation = (0, _glMatrix.quat).clone(glpyhRotation); - (0, _glMatrix.quat).multiply(rotation, modelRotation, rotation); - (0, _glMatrix.quat).conjugate(glyphInvRotation, rotation); - (0, _glMatrix.vec3).subtract(position0, position0, centroid); - (0, _glMatrix.vec3).subtract(position1, position1, centroid); - (0, _glMatrix.vec3).transformQuat(position0, position0, glyphInvRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, glyphInvRotation); - (0, _glMatrix.vec3).add(position0, position0, centroid); - (0, _glMatrix.vec3).add(position1, position1, centroid); - const texCoord0 = (0, _glMatrix.vec2).create(); - const texCoord1 = (0, _glMatrix.vec2).create(); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 2, texCoord0); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 1, texCoord1); - const hittableFontOptions = { - center0: centroid, - center1: centroid, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - size1: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - material: material, - texCoord0: texCoord0, - texCoord1: texCoord1, - rotation0: rotation, - rotation1: rotation, - sdfBuffer: this._core.config.sdfBuffer - }; - const hittable = new (0, _hittableJs.HittableRotatedFontXyRect)(hittableFontOptions); - this.hittables.push(hittable); - glyphIndex++; - } - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"5x28d","../../vertex.js":"4J2YE","./hittable.js":"5cw7N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dRm64":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _atlasJs = require("../../atlas.js"); -var _bufferJs = require("../../buffer.js"); -var _indexJs = require("../../index.js"); -var _mainJs = require("../../main.js"); -var _paletteJs = require("../../palette.js"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _mathJs = require("../../helpers/math.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - constructor(core, ids){ - super(core, ids); - this._isInitialized = true; + getSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - update() { - if (this._isInitialized) { - if (this.hasChangedCallback) this.hasChangedCallback(); - } + setSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - get time0() { - return this._time0; + getPrimitivesOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET]; } - set time0(value) { - if (this._time0 != value) { - this._time0 = value; - this._hasChanged = true; - } + setPrimitivesOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET] = value2; } - get time1() { - return this._time1; + getSecondChildOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET]; } - set time1(value) { - if (this._time1 != value) { - this._time1 = value; - this._hasChanged = true; - } + setSecondChildOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET] = value2; } - get duration() { - return this._duration; + getNPrimitives(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET]; } - set duration(value) { - if (this._duration != value) { - this._duration = value; - this._hasChanged = true; - } + setNPrimitives(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET] = value2; } - get stagger() { - return this.stagger; + getAxis(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET]; } - set stagger(value) { - if (this._stagger != value) { - this._stagger = value; - this._hasChanged = true; - } + setAxis(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET] = value2; } - constructor(core, main, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - this._main = main; - this._time0 = 0; - this._time1 = 1; - this._buffer1.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._buffer2.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._isInitialized = true; + } + LinearBVHNodeBufferData.SIZE = 48 / 4; + class LightBufferData extends Float32Array { + constructor(count2) { + super(count2 * LightBufferData.SIZE); + this.ROTATION_OFFSET = 0 / 4; + this.CENTER_OFFSET = 16 / 4; + this.TYPE_OFFSET = 28 / 4; + this.SIZE_OFFSET = 32 / 4; + this.COLOR_OFFSET = 48 / 4; + } + getType(index2) { + return this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - this.minY = Number.MAX_VALUE; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const previousBuffer = this.previousBuffer; - const currentBuffer = this.currentBuffer; - const currentUnitTranslation = (0, _glMatrix.vec3).create(); - const previousUnitTranslation = (0, _glMatrix.vec3).create(); - const currentUnitScale = (0, _glMatrix.vec3).create(); - const previousUnitScale = (0, _glMatrix.vec3).create(); - const currentUnitRotation = (0, _glMatrix.quat).create(); - const previousUnitRotation = (0, _glMatrix.quat).create(); - const unitOrder = (0, _glMatrix.vec2).create(); - const transitionDuration = this._duration / (this._duration + this._stagger); - for(let j = 0; j < currentBuffer.ids.length; j++){ - (0, _vertexJs.UnitVertex).getOrder(currentBuffer.dataView, j, unitOrder); - const startTime = unitOrder[1] * (1 - transitionDuration); - const animation0 = (0, _mathJs.MathHelper).clamp((this._time0 - startTime) / transitionDuration, 0, 1); - const animation1 = (0, _mathJs.MathHelper).clamp((this._time1 - startTime) / transitionDuration, 0, 1); - const unitScale0 = (0, _glMatrix.vec3).create(); - const unitScale1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getScale(currentBuffer.dataView, j, currentUnitScale); - (0, _vertexJs.UnitVertex).getScale(previousBuffer.dataView, j, previousUnitScale); - (0, _glMatrix.vec3).lerp(unitScale0, previousUnitScale, currentUnitScale, animation0); - (0, _glMatrix.vec3).lerp(unitScale1, previousUnitScale, currentUnitScale, animation1); - const unitTranslation0 = (0, _glMatrix.vec3).create(); - const unitTranslation1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, j, currentUnitTranslation); - (0, _vertexJs.UnitVertex).getTranslation(previousBuffer.dataView, j, previousUnitTranslation); - (0, _glMatrix.vec3).lerp(unitTranslation0, previousUnitTranslation, currentUnitTranslation, animation0); - (0, _glMatrix.vec3).lerp(unitTranslation1, previousUnitTranslation, currentUnitTranslation, animation1); - const unitRotation0 = (0, _glMatrix.quat).create(); - const unitRotation1 = (0, _glMatrix.quat).create(); - (0, _vertexJs.UnitVertex).getRotation(currentBuffer.dataView, j, currentUnitRotation); - (0, _vertexJs.UnitVertex).getRotation(previousBuffer.dataView, j, previousUnitRotation); - (0, _glMatrix.quat).slerp(unitRotation0, previousUnitRotation, currentUnitRotation, animation0); - (0, _glMatrix.quat).slerp(unitRotation1, previousUnitRotation, currentUnitRotation, animation1); - (0, _glMatrix.quat).multiply(unitRotation0, modelRotation, unitRotation0); - (0, _glMatrix.quat).multiply(unitRotation1, modelRotation, unitRotation1); - (0, _glMatrix.vec3).scale(unitTranslation0, unitTranslation0, modelScale); - (0, _glMatrix.vec3).scale(unitTranslation1, unitTranslation1, modelScale); - (0, _glMatrix.vec3).transformQuat(unitTranslation0, unitTranslation0, modelRotation); - (0, _glMatrix.vec3).transformQuat(unitTranslation1, unitTranslation1, modelRotation); - (0, _glMatrix.vec3).add(unitTranslation0, unitTranslation0, modelPosition); - (0, _glMatrix.vec3).add(unitTranslation1, unitTranslation1, modelPosition); - (0, _glMatrix.vec3).scale(unitScale0, unitScale0, modelScale / 2); - (0, _glMatrix.vec3).scale(unitScale1, unitScale1, modelScale / 2); - unitScale0[0] = Math.max(unitScale0[0], 0.00001); - unitScale0[1] = Math.max(unitScale0[1], 0.00001); - unitScale0[2] = Math.max(unitScale0[2], 0.00001); - unitScale1[0] = Math.max(unitScale1[0], 0.00001); - unitScale1[1] = Math.max(unitScale1[1], 0.00001); - unitScale1[2] = Math.max(unitScale1[2], 0.00001); - const endTime = startTime + transitionDuration; - const time0 = Math.min(Math.max((startTime - this._time0) / (this._time1 - this.time0), 0), 1); - const time1 = Math.min(Math.max((endTime - this._time0) / (this._time1 - this.time0), 0), 1); - const materialId = (0, _vertexJs.UnitVertex).getMaterial(currentBuffer.dataView, j); - const material = this._main.materials && this._main.materials.length > materialId ? this._main.materials[materialId] : this._main.config.defaultMaterial; - let hittable; - let unitTexCoord; - switch(currentBuffer.unitType){ - case (0, _indexJs.UnitType).sphere: - case (0, _indexJs.UnitType).sphereSdf: - hittable = new (0, _hittableJs.HittableSphere)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - material: material - }); - break; - case (0, _indexJs.UnitType).disk: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - else hittable = new (0, _hittableJs.HittableRotatedXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - break; - case (0, _indexJs.UnitType).block: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).sdf: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - const texId = (0, _vertexJs.UnitVertex).getTexture(currentBuffer.dataView, j); - const sdfBuffer = (0, _vertexJs.UnitVertex).getSdfBuffer(currentBuffer.dataView, j); - const sdfBorder = (0, _vertexJs.UnitVertex).getSdfBorder(currentBuffer.dataView, j); - const options = { - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: (0, _glMatrix.vec2).fromValues(unitScale0[0], unitScale0[1]), - size1: (0, _glMatrix.vec2).fromValues(unitScale1[0], unitScale1[1]), - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]), - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texId: texId, - sdfBuffer: sdfBuffer, - sdfBorder: sdfBorder - }; - hittable = unitRotation1[3] == 1 ? new (0, _hittableJs.HittableSdfXyRect)(options) : new (0, _hittableJs.HittableRotatedSdfXyRect)(options); - break; - case (0, _indexJs.UnitType).blockSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).ringSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).cylinder: - hittable = new (0, _hittableJs.HittableCylinder)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).cylinderSdf: - hittable = new (0, _hittableJs.HittableCylinderSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).hexPrism: - hittable = new (0, _hittableJs.HittableHexPrism)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - material: material - }); - break; - case (0, _indexJs.UnitType).hexPrismSdf: - hittable = new (0, _hittableJs.HittableHexPrismSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material - }); - break; - } - if (hittable.material instanceof (0, _materialJs.IsotropicMaterial)) this.hittables.push(new (0, _hittableJs.HittableConstantMedium)({ - boundary: hittable, - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - material: hittable.material - })); - else this.hittables.push(hittable); - this.minY = Math.min(hittable.bounds.min[1], this.minY); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} - -},{"gl-matrix":"5x28d","../../atlas.js":"2peXi","../../buffer.js":"itbJk","../../index.js":"9s7CR","../../main.js":"f421K","../../palette.js":"hZb65","../../vertex.js":"4J2YE","./hittable.js":"5cw7N","./material.js":"jQJhi","../../helpers/math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6DWH0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -class Constants { -} -Constants.SHADOW_OFFSET = 0.001; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"54e1Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ground", ()=>Ground); -class Ground { - constructor(options){ - if (options) { - this.position = options.position; - this.size = options.size; - this.material = options.material; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dUaaI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>(0, _tableJs.Table)); -parcelHelpers.export(exports, "ColumnType", ()=>(0, _tableJs.ColumnType)); -parcelHelpers.export(exports, "Filter", ()=>(0, _filterJs.Filter)); -var _tableJs = require("./table.js"); -var _filterJs = require("./filter.js"); - -},{"./table.js":"1Nyfw","./filter.js":"b6FuS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7YGk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraBase", ()=>(0, _cameraJs.CameraBase)); -parcelHelpers.export(exports, "CameraView", ()=>(0, _cameraJs.CameraView)); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>(0, _altazimuthJs.AltAzimuthCamera)); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>(0, _altazimuthJs.AltAzimuthCameraView)); -parcelHelpers.export(exports, "OrbitCamera", ()=>(0, _orbitJs.OrbitCamera)); -var _cameraJs = require("./camera.js"); -var _altazimuthJs = require("./altazimuth.js"); -var _orbitJs = require("./orbit.js"); - -},{"./camera.js":"h35rS","./altazimuth.js":"gRqOf","./orbit.js":"6JwjD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6JwjD":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OrbitCamera", ()=>OrbitCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cameraJs = require("./camera.js"); -class OrbitCamera extends (0, _cameraJs.CameraBase) { - getTwist(value) { - (0, _glMatrix.quat).copy(value, this._cameraRotation); - } - setTwist(value, isSmooth) { - (0, _glMatrix.quat).copy(this._cameraRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, value); - } - twist(angle, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._twist(this._vec3, angle); - } - _twist(axis, angle) { - (0, _glMatrix.quat).setAxisAngle(this._quat, axis, angle); - (0, _glMatrix.quat).multiply(this._cameraRotation, this._quat, this._cameraRotation); + } + LightBufferData.SIZE = 64 / 4; + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - rotate(translationDelta) { - (0, _glMatrix.vec3).set(this._vec3, translationDelta[1], translationDelta[0], 0); - const length = (0, _glMatrix.vec3).length(this._vec3); - const angle = length * (0, _constantsJs.Constants).PI / Math.min(this.width, this.height); - (0, _glMatrix.vec3).scale(this._vec3, this._vec3, 1 / length); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._vec3, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","./camera.js":"h35rS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iZ1f5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize for documentation -parcelHelpers.export(exports, "addDiv", ()=>(0, _htmlHelpers.addDiv)); -parcelHelpers.export(exports, "addEl", ()=>(0, _htmlHelpers.addEl)); -parcelHelpers.export(exports, "allTruthy", ()=>(0, _array.allTruthy)); -parcelHelpers.export(exports, "clone", ()=>(0, _clone.clone)); -parcelHelpers.export(exports, "colorFromString", ()=>(0, _color.colorFromString)); -parcelHelpers.export(exports, "colorIsEqual", ()=>(0, _color.colorIsEqual)); -parcelHelpers.export(exports, "colorToString", ()=>(0, _color.colorToString)); -parcelHelpers.export(exports, "concat", ()=>(0, _array.concat)); -parcelHelpers.export(exports, "createElement", ()=>(0, _tsxCreateElement.createElement)); -parcelHelpers.export(exports, "deepMerge", ()=>(0, _clone.deepMerge)); -parcelHelpers.export(exports, "desaturate", ()=>(0, _color.desaturate)); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>(0, _tsxCreateElement.getActiveElementInfo)); -parcelHelpers.export(exports, "mount", ()=>(0, _tsxCreateElement.mount)); -parcelHelpers.export(exports, "outerSize", ()=>(0, _htmlHelpers.outerSize)); -parcelHelpers.export(exports, "push", ()=>(0, _array.push)); -parcelHelpers.export(exports, "setActiveElement", ()=>(0, _tsxCreateElement.setActiveElement)); -var _array = require("../array"); -var _htmlHelpers = require("../htmlHelpers"); -var _clone = require("../clone"); -var _color = require("../color"); -var _tsxCreateElement = require("tsx-create-element"); - -},{"../array":"cecnk","../htmlHelpers":"fuoG9","../clone":"4Kzai","../color":"cgTtg","tsx-create-element":"dPDUq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cecnk":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "concat", ()=>concat); -/** - * Returns array with items which are truthy. - * @param args array or arrays to concat into a single array. - */ parcelHelpers.export(exports, "allTruthy", ()=>allTruthy); -/** - * Add an array to an existing array in place. - * @param arr Array to append to. - * @param items Arrof of items to append. - */ parcelHelpers.export(exports, "push", ()=>push); -function concat(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []); -} -function allTruthy(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []).filter(Boolean); -} -function push(arr, items) { + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }); + const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + MorphChartsCore: Core + }, Symbol.toStringTag, { value: "Module" })); + function concat(...args) { + return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []); + } + function allTruthy(...args) { + return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []).filter(Boolean); + } + function push$1(arr, items) { arr.push.apply(arr, items); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fuoG9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * Create a new element as a child of another element. - * @param tagName Tag name of the new tag to create. - * @param parentElement Reference of the element to append to. - * @returns new HTMLElement. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addEl", ()=>addEl); -/** - * Create a new div HTMLElement as a child of another element. - * @param parentElement Reference of the element to append to. - * @param className Optional css class name to apply to the div. - */ parcelHelpers.export(exports, "addDiv", ()=>addDiv); -/** - * Measure the outer height and width of an HTMLElement, including margin, padding and border. - * @param el HTML Element to measure. - */ parcelHelpers.export(exports, "outerSize", ()=>outerSize); -function addEl(tagName, parentElement) { + } + function addEl(tagName, parentElement) { const el = document.createElement(tagName); parentElement.appendChild(el); return el; -} -function addDiv(parentElement, className) { - const div = addEl('div', parentElement); - if (className) div.className = className; + } + function addDiv(parentElement, className2) { + const div = addEl("div", parentElement); + if (className2) { + div.className = className2; + } return div; -} -function outerSize(el) { + } + function outerSize$1(el) { const cs = getComputedStyle(el); - const height = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); - const width = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); - return { - height, - width - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Kzai":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "deepMerge", ()=>deepMerge); -var _deepmerge = require("deepmerge"); -var _isPlainObject = require("is-plain-object"); -const deepmerge = _deepmerge.default || _deepmerge; -function clone(objectToClone) { - if (!objectToClone) return objectToClone; - return deepmerge.all([ - objectToClone - ]); -} -const dontMerge = (destination, source)=>source; -function deepMerge(...objectsToMerge) { - const objects = objectsToMerge.filter(Boolean); - return deepmerge.all(objects, { - arrayMerge: dontMerge, - isMergeableObject: (0, _isPlainObject.isPlainObject) - }); -} - -},{"deepmerge":"doQxS","is-plain-object":"83B8P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"doQxS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var isMergeableObject = function isMergeableObject(value) { - return isNonNullObject(value) && !isSpecial(value); -}; -function isNonNullObject(value) { - return !!value && typeof value === 'object'; -} -function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value); -} -// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 -var canUseSymbol = typeof Symbol === 'function' && Symbol.for; -var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; -function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE; -} -function emptyTarget(val) { + const height2 = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); + const width2 = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); + return { height: height2, width: width2 }; + } + var isMergeableObject = function isMergeableObject2(value2) { + return isNonNullObject(value2) && !isSpecial(value2); + }; + function isNonNullObject(value2) { + return !!value2 && typeof value2 === "object"; + } + function isSpecial(value2) { + var stringValue = Object.prototype.toString.call(value2); + return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value2); + } + var canUseSymbol = typeof Symbol === "function" && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103; + function isReactElement(value2) { + return value2.$$typeof === REACT_ELEMENT_TYPE; + } + function emptyTarget(val) { return Array.isArray(val) ? [] : {}; -} -function cloneUnlessOtherwiseSpecified(value, options) { - return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; -} -function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options); + } + function cloneUnlessOtherwiseSpecified(value2, options2) { + return options2.clone !== false && options2.isMergeableObject(value2) ? deepmerge$1(emptyTarget(value2), value2, options2) : value2; + } + function defaultArrayMerge(target2, source2, options2) { + return target2.concat(source2).map(function(element2) { + return cloneUnlessOtherwiseSpecified(element2, options2); }); -} -function mergeObject(target, source, options) { + } + function mergeObject(target2, source2, options2) { var destination = {}; - if (options.isMergeableObject(target)) Object.keys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - Object.keys(source).forEach(function(key) { - if (!options.isMergeableObject(source[key]) || !target[key]) destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); - else destination[key] = deepmerge(target[key], source[key], options); + if (options2.isMergeableObject(target2)) { + Object.keys(target2).forEach(function(key2) { + destination[key2] = cloneUnlessOtherwiseSpecified(target2[key2], options2); + }); + } + Object.keys(source2).forEach(function(key2) { + if (!options2.isMergeableObject(source2[key2]) || !target2[key2]) { + destination[key2] = cloneUnlessOtherwiseSpecified(source2[key2], options2); + } else { + destination[key2] = deepmerge$1(target2[key2], source2[key2], options2); + } }); return destination; -} -function deepmerge(target, source, options) { - options = options || {}; - options.arrayMerge = options.arrayMerge || defaultArrayMerge; - options.isMergeableObject = options.isMergeableObject || isMergeableObject; - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); + } + function deepmerge$1(target2, source2, options2) { + options2 = options2 || {}; + options2.arrayMerge = options2.arrayMerge || defaultArrayMerge; + options2.isMergeableObject = options2.isMergeableObject || isMergeableObject; + var sourceIsArray = Array.isArray(source2); + var targetIsArray = Array.isArray(target2); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - if (!sourceAndTargetTypesMatch) return cloneUnlessOtherwiseSpecified(source, options); - else if (sourceIsArray) return options.arrayMerge(target, source, options); - else return mergeObject(target, source, options); -} -deepmerge.all = function deepmergeAll(array, options) { - if (!Array.isArray(array)) throw new Error('first argument should be an array'); - return array.reduce(function(prev, next) { - return deepmerge(prev, next, options); + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source2, options2); + } else if (sourceIsArray) { + return options2.arrayMerge(target2, source2, options2); + } else { + return mergeObject(target2, source2, options2); + } + } + deepmerge$1.all = function deepmergeAll(array2, options2) { + if (!Array.isArray(array2)) { + throw new Error("first argument should be an array"); + } + return array2.reduce(function(prev, next) { + return deepmerge$1(prev, next, options2); }, {}); -}; -var deepmerge_1 = deepmerge; -exports.default = deepmerge_1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"83B8P":[function(require,module,exports,__globalThis) { -/*! - * is-plain-object <https://github.com/jonschlinkert/is-plain-object> - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isPlainObject", ()=>isPlainObject); -function isObject(o) { - return Object.prototype.toString.call(o) === '[object Object]'; -} -function isPlainObject(o) { + }; + var deepmerge_1 = deepmerge$1; + const _deepmerge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: deepmerge_1 + }, Symbol.toStringTag, { value: "Module" })); + function isObject$1(o) { + return Object.prototype.toString.call(o) === "[object Object]"; + } + function isPlainObject(o) { var ctor, prot; - if (isObject(o) === false) return false; - // If has modified constructor + if (isObject$1(o) === false) return false; ctor = o.constructor; - if (ctor === undefined) return true; - // If has modified prototype + if (ctor === void 0) return true; prot = ctor.prototype; - if (isObject(prot) === false) return false; - // If constructor does not have an Object-specific method - if (prot.hasOwnProperty('isPrototypeOf') === false) return false; - // Most likely a plain Object + if (isObject$1(prot) === false) return false; + if (prot.hasOwnProperty("isPrototypeOf") === false) { + return false; + } return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cgTtg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Compares 2 colors to see if they are equal. - * @param a RGBAColor to compare - * @param b RGBAColor to compare - * @returns True if colors are equal. - */ parcelHelpers.export(exports, "colorIsEqual", ()=>colorIsEqual); -/** - * Convert a CSS color string to a Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.). - * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. - */ parcelHelpers.export(exports, "colorFromString", ()=>colorFromString); -/** - * Convert a Deck.gl color to a CSS rgba() string. - * @param color A Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.) - */ parcelHelpers.export(exports, "colorToString", ()=>colorToString); -parcelHelpers.export(exports, "desaturate", ()=>desaturate); -var _d3Color = require("d3-color"); -function rgbToDeckglColor(c) { - return [ - c.r, - c.g, - c.b, - c.opacity * 255 - ]; -} -function colorIsEqual(a, b) { - if (a.length !== b.length) return false; - for(let i = 0; i < a.length; i++){ - if (a[i] !== b[i]) return false; + } + const deepmerge = deepmerge_1 || _deepmerge; + function clone(objectToClone) { + if (!objectToClone) + return objectToClone; + return deepmerge.all([objectToClone]); + } + const dontMerge = (destination, source2) => source2; + function deepMerge(...objectsToMerge) { + const objects = objectsToMerge.filter(Boolean); + return deepmerge.all(objects, { arrayMerge: dontMerge, isMergeableObject: isPlainObject }); + } + function rgbToDeckglColor(c2) { + return [c2.r, c2.g, c2.b, c2.opacity * 255]; + } + function colorIsEqual(a2, b2) { + if (a2.length !== b2.length) + return false; + for (let i = 0; i < a2.length; i++) { + if (a2[i] !== b2[i]) + return false; } return true; -} -function colorFromString(cssColorSpecifier) { + } + function colorFromString(cssColorSpecifier) { if (cssColorSpecifier) { - const dc = (0, _d3Color.color)(cssColorSpecifier); - if (dc) { - const c = dc.rgb(); - return rgbToDeckglColor(c); - } + const dc = color$2(cssColorSpecifier); + if (dc) { + const c2 = dc.rgb(); + return rgbToDeckglColor(c2); + } } -} -function colorToString(color) { - const c = [ - ...color - ]; - if (c.length > 3) c[3] /= 255; - return `rgba(${c.join(',')})`; -} -function desaturate(color, value) { - const rgb = (0, _d3Color.rgb)(color[0], color[1], color[2], color[3] / 255); - const hslColor = (0, _d3Color.hsl)(rgb); - hslColor.s = value; - const c = hslColor.rgb(); - return rgbToDeckglColor(c); -} - -},{"d3-color":"37LNF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Q1zd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "minHeight", ()=>minHeight); -parcelHelpers.export(exports, "minWidth", ()=>minWidth); -parcelHelpers.export(exports, "defaultPresenterStyle", ()=>defaultPresenterStyle); -parcelHelpers.export(exports, "defaultPresenterConfig", ()=>defaultPresenterConfig); -parcelHelpers.export(exports, "createStage", ()=>createStage); -parcelHelpers.export(exports, "groupStrokeWidth", ()=>groupStrokeWidth); -parcelHelpers.export(exports, "lineZ", ()=>lineZ); -parcelHelpers.export(exports, "defaultView", ()=>defaultView); -parcelHelpers.export(exports, "minZ", ()=>minZ); -parcelHelpers.export(exports, "min3dDepth", ()=>min3dDepth); -parcelHelpers.export(exports, "minPixelSize", ()=>minPixelSize); -parcelHelpers.export(exports, "defaultOnAxisItem", ()=>defaultOnAxisItem); -var _color = require("./color"); -const minHeight = '100px'; -const minWidth = '100px'; -const defaultPresenterStyle = { - cssPrefix: 'vega-morphcharts-', - defaultCubeColor: [ - 128, - 128, - 128, - 255 - ], - highlightColor: [ - 0, - 0, - 0, - 255 - ] -}; -const defaultPresenterConfig = { - onCubeClick: (e, cube)=>{}, - onCubeHover: (e, cube)=>{}, + } + function colorToString(color2) { + const c2 = [...color2]; + if (c2.length > 3) { + c2[3] /= 255; + } + return `rgba(${c2.join(",")})`; + } + function desaturate(color2, value2) { + const rgb2 = rgb$1(color2[0], color2[1], color2[2], color2[3] / 255); + const hslColor = hsl$1(rgb2); + hslColor.s = value2; + const c2 = hslColor.rgb(); + return rgbToDeckglColor(c2); + } + const util$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + addDiv, + addEl, + allTruthy, + clone, + colorFromString, + colorIsEqual, + colorToString, + concat, + createElement, + deepMerge, + desaturate, + getActiveElementInfo, + mount, + outerSize: outerSize$1, + push: push$1, + setActiveElement + }, Symbol.toStringTag, { value: "Module" })); + const minHeight = "100px"; + const minWidth = "100px"; + const defaultPresenterStyle$1 = { + cssPrefix: "vega-morphcharts-", + defaultCubeColor: [128, 128, 128, 255], + highlightColor: [0, 0, 0, 255] + }; + const defaultPresenterConfig = { + onCubeClick: (e, cube) => { + }, + onCubeHover: (e, cube) => { + }, transitionDurations: { - position: 600, - stagger: 600, - view: 600 + position: 600, + stagger: 600, + view: 600 }, renderer: { - advanced: false, - advancedOptions: {}, - basicOptions: { - antialias: true - } + advanced: false, + advancedOptions: {}, + basicOptions: { + antialias: true + } } -}; -function createStage(view) { + }; + function createStage(view) { const stage = { - view, - cubeData: [], - pathData: [], - axes: { - x: [], - y: [], - z: [] - }, - gridLines: [], - textData: [], - legend: { - rows: {} - }, - facets: [] + view, + cubeData: [], + pathData: [], + axes: { + x: [], + y: [], + z: [] + }, + gridLines: [], + textData: [], + legend: { + rows: {} + }, + facets: [] }; return stage; -} -const groupStrokeWidth = 1; -const lineZ = 0; -const defaultView = '2d'; -const minZ = 0.5; -const min3dDepth = 0.05; -const minPixelSize = 0.5; -const zAxisEncodeColor = [ - 7, - 7, - 7, - 255 -]; -const zAxisOutColor = [ - 0, - 0, - 0, - 255 -]; -function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { - if ((0, _color.colorIsEqual)(stageItem.color, zAxisEncodeColor)) { - stageItem.color = zAxisOutColor; - if (currAxis.axisRole !== 'z') { - const previousAxisRole = removeCurrentAxes(stage, currAxis); - if (previousAxisRole) { - currAxis.axisRole = 'z'; - stage.axes.z.push(currAxis); - } + } + const groupStrokeWidth = 1; + const lineZ = 0; + const defaultView$1 = "2d"; + const minZ = 0.5; + const min3dDepth = 0.05; + const minPixelSize = 0.5; + const zAxisEncodeColor = [7, 7, 7, 255]; + const zAxisOutColor = [0, 0, 0, 255]; + function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { + if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { + stageItem.color = zAxisOutColor; + if (currAxis.axisRole !== "z") { + const previousAxisRole = removeCurrentAxes(stage, currAxis); + if (previousAxisRole) { + currAxis.axisRole = "z"; + stage.axes.z.push(currAxis); + } + } + } + } + function removeCurrentAxes(stage, currAxis) { + for (const axisRole in stage.axes) { + const axes = stage.axes[axisRole]; + for (let i = 0; i < axes.length; i++) { + if (axes[i] === currAxis) { + axes.splice(i, 1); + return axisRole; } + } } -} -function removeCurrentAxes(stage, currAxis) { - //find the current axis, remove it from parent - for(const axisRole in stage.axes){ - const axes = stage.axes[axisRole]; - for(let i = 0; i < axes.length; i++)if (axes[i] === currAxis) { - axes.splice(i, 1); - return axisRole; - } - } -} - -},{"./color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hIePf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param vega Vega library. - */ parcelHelpers.export(exports, "use", ()=>use); -const vega = { + } + const defaults$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + createStage, + defaultOnAxisItem, + defaultPresenterConfig, + defaultPresenterStyle: defaultPresenterStyle$1, + defaultView: defaultView$1, + groupStrokeWidth, + lineZ, + min3dDepth, + minHeight, + minPixelSize, + minWidth, + minZ + }, Symbol.toStringTag, { value: "Module" })); + const vega$1 = { CanvasHandler: null, inferType: null, inferTypes: null, @@ -41571,10999 +22319,7735 @@ const vega = { scheme: null, truncate: null, View: null -}; -const base = { - vega -}; -function use(vega) { - base.vega = vega; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9yYY0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Class which presents a Stage of chart data using MorphCharts to render. - */ parcelHelpers.export(exports, "Presenter", ()=>Presenter); -var _clone = require("./clone"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -var _legend = require("./legend"); -var _panel = require("./panel"); -var _patchedCubeArray = require("./patchedCubeArray"); -var _stagers = require("./stagers"); -var _tsxCreateElement = require("tsx-create-element"); -var _morphcharts = require("./morphcharts"); -class Presenter { - /** - * Get the previously rendered Stage object. - */ get stage() { - return this._last.stage; - } - /** - * Get the current View camera type. - */ get view() { - return this._last.view; - } - /** - * Instantiate a new Presenter. - * @param el Parent HTMLElement to present within. - * @param style Optional PresenterStyle styling options. - */ constructor(el, style){ - this.el = el; - this.style = (0, _clone.deepMerge)((0, _defaults.defaultPresenterStyle), style); - (0, _panel.initializePanel)(this); - this._last = { - view: null, - height: null, - width: null, - cubeCount: null, - stage: null - }; - } - /** - * Cancels any pending animation, calling animationCanceled() on original queue. - */ animationCancel() { - if (this.animationTimer) { - clearTimeout(this.animationTimer); - this.animationTimer = null; - if (this.logger) this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || 'handler'}`); - if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) this.queuedAnimationOptions.animationCanceled.call(null); - } - } - /** - * Stops the current animation and queues a new animation. - * @param handler Function to invoke when timeout is complete. - * @param timeout Length of time to wait before invoking the handler. - * @param options Optional QueuedAnimationOptions object. - */ animationQueue(handler, timeout, options) { - if (this.logger) this.logger(`queueing animation ${options && options.waitingLabel || 'waiting'}...(${timeout})`); - this.animationCancel(); - this.animationTimer = setTimeout(()=>{ - if (this.logger) this.logger(`queueing animation ${options && options.handlerLabel || 'handler'}...`); - handler(); - }, timeout); - } - /** - * Retrieve a sub-element of the rendered output. - * @param type PresenterElement type of the HTMLElement to retrieve. - */ getElement(type) { - const elements = this.el.getElementsByClassName((0, _panel.className)(type, this)); - if (elements && elements.length) return elements[0]; - } - /** - * Present the Vega Scene, or Stage object using Morphcharts. - * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. - * @param height Height of the rendering area. - * @param width Width of the rendering area. - * @param config Optional presentation configuration object. - */ present(sceneOrStage, height, width, config) { - this.animationCancel(); - const scene = sceneOrStage; - let stage; - const options = { - maxOrdinal: 0, - currAxis: null, - defaultCubeColor: this.style.defaultCubeColor, - assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (()=>options.maxOrdinal++), - modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : (0, _defaults.defaultOnAxisItem), - zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex - }; - //determine if this is a vega scene - if (scene.marktype) { - stage = (0, _defaults.createStage)(scene.view); - (0, _stagers.sceneToStage)(options, stage, scene); - } else stage = sceneOrStage; - const c = (0, _clone.deepMerge)((0, _defaults.defaultPresenterConfig), config); - if (!this.morphchartsref) { - this._morphChartsOptions = { - container: this.getElement((0, _enums.PresenterElement).gl), - pickGridCallback: c.axisPickGridCallback, - onCubeHover: (e, ordinal)=>{ - c.onCubeHover(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCubeClick: (e, ordinal)=>{ - c.onCubeClick(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, - onLasso: config === null || config === void 0 ? void 0 : config.onLasso - }; - this.morphchartsref = (0, _morphcharts.init)(this._morphChartsOptions, c.renderer || (0, _defaults.defaultPresenterConfig).renderer); - } - let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); - if (options.maxOrdinal) { - cubeCount = Math.max(cubeCount, options.maxOrdinal); - const empty = { - isEmpty: true - }; - stage.cubeData = (0, _patchedCubeArray.patchCubeArray)(cubeCount, empty, stage.cubeData); - } - config.preLayer && config.preLayer(stage); - this.morphChartsRenderResult = (0, _morphcharts.morphChartsRender)(this.morphchartsref, this._last.stage, stage, height, width, config && config.preStage, config && config.morphChartsColors, c); - delete stage.cubeData; - delete stage.redraw; - this._last = { - cubeCount, - height, - width, - stage, - view: stage.view - }; - const a = (0, _tsxCreateElement.getActiveElementInfo)(); - (0, _tsxCreateElement.mount)((0, _legend.LegendView)({ - legend: stage.legend, - onClick: config && config.onLegendClick - }), this.getElement((0, _enums.PresenterElement).legend)); - (0, _tsxCreateElement.setActiveElement)(a); - if (config && config.onPresent) config.onPresent(); - } - canvasToDataURL() { - return new Promise((resolve, reject)=>{ - this.morphchartsref.core.afterRenderCallback = ()=>{ - this.morphchartsref.core.afterRenderCallback = null; - const canvas = this.getElement((0, _enums.PresenterElement).gl).getElementsByTagName('canvas')[0]; - const png = canvas.toDataURL('image/png'); - resolve(png); - }; - }); - } - configColors(mcColors) { - (0, _morphcharts.colorConfig)(this.morphchartsref, mcColors); - } - /** - * Home the camera to the last initial position. - */ homeCamera() { - var _a; - (_a = this.morphchartsref) === null || _a === void 0 || _a.reset(); - } - /** - * Show guidelines of rendering height/width and center of OrbitView. - */ showGuides() { - this.getElement((0, _enums.PresenterElement).gl).classList.add('show-center'); - //TODO Morphcharts gridlines - } - finalize() { - this.animationCancel(); - if (this.morphchartsref) this.morphchartsref.core.stop(); - if (this.el) this.el.innerHTML = ''; - this._last = null; - this.morphchartsref = null; - this.el = null; - this.logger = null; - this.queuedAnimationOptions = null; - } -} - -},{"./clone":"4Kzai","./defaults":"4Q1zd","./enums":"hnVHt","./legend":"aunMk","./panel":"l2IQQ","./patchedCubeArray":"eWKaN","./stagers":"6p1Cn","tsx-create-element":"dPDUq","./morphcharts":"6vcDa","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hnVHt":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * HTML elements outputted by the presenter. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PresenterElement", ()=>PresenterElement); -var PresenterElement; -(function(PresenterElement) { - PresenterElement[PresenterElement["root"] = 0] = "root"; - PresenterElement[PresenterElement["gl"] = 1] = "gl"; - PresenterElement[PresenterElement["panel"] = 2] = "panel"; - PresenterElement[PresenterElement["legend"] = 3] = "legend"; - PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls"; -})(PresenterElement || (PresenterElement = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aunMk":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LegendView", ()=>LegendView); -var _tsxCreateElement = require("tsx-create-element"); -var _controls = require("./controls"); -const LegendView = (props)=>{ + }; + const base$3 = { + vega: vega$1 + }; + function use$5(vega2) { + base$3.vega = vega2; + } + var PresenterElement$1; + (function(PresenterElement2) { + PresenterElement2[PresenterElement2["root"] = 0] = "root"; + PresenterElement2[PresenterElement2["gl"] = 1] = "gl"; + PresenterElement2[PresenterElement2["panel"] = 2] = "panel"; + PresenterElement2[PresenterElement2["legend"] = 3] = "legend"; + PresenterElement2[PresenterElement2["vegaControls"] = 4] = "vegaControls"; + })(PresenterElement$1 || (PresenterElement$1 = {})); + const LegendView = (props) => { const rows = []; - const addRow = (row, i)=>{ - const fn = symbolMap[row.symbol.shape]; - let jsx; - if (fn) jsx = fn(row.symbol); - else jsx = (0, _tsxCreateElement.createElement)("span", null, "x"); - rows.push({ - cells: [ - { - className: 'symbol', - content: jsx - }, - { - className: 'label', - content: row.label, - title: row.label - } - ] - }); + const addRow = (row, i) => { + const fn2 = symbolMap[row.symbol.shape]; + let jsx; + if (fn2) { + jsx = fn2(row.symbol); + } else { + jsx = createElement("span", null, "x"); + } + rows.push({ + cells: [ + { className: "symbol", content: jsx }, + { className: "label", content: row.label, title: row.label } + ] + }); }; - const sorted = Object.keys(props.legend.rows).sort((a, b)=>+a - +b); - sorted.forEach((i)=>addRow(props.legend.rows[i], +i)); - if (sorted.length) return (0, _tsxCreateElement.createElement)((0, _controls.Table), { - rows: rows, - rowClassName: "legend-row", - onRowClick: (e, i)=>props.onClick(e, props.legend, i) - }, props.legend.title !== void 0 && (0, _tsxCreateElement.createElement)("tr", { - onClick: (e)=>props.onClick(e, props.legend, null) - }, (0, _tsxCreateElement.createElement)("th", { - colSpan: 2 - }, props.legend.title))); -}; -const symbolMap = { - square: function(symbol) { - return (0, _tsxCreateElement.createElement)("div", { - style: { - height: `${symbol.bounds.y2 - symbol.bounds.y1}px`, - width: `${symbol.bounds.x2 - symbol.bounds.x1}px`, - backgroundColor: symbol.fill, - borderColor: symbol.fill - } - }); - } -}; - -},{"tsx-create-element":"dPDUq","./controls":"9lm1L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l2IQQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializePanel", ()=>initializePanel); -parcelHelpers.export(exports, "className", ()=>className); -var _tsxCreateElement = require("tsx-create-element"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -function initializePanel(presenter) { - const rootDiv = (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).root, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).gl, presenter), - style: { - minHeight: (0, _defaults.minHeight), - minWidth: (0, _defaults.minWidth) - } - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).panel, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).vegaControls, presenter) - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).legend, presenter) - }))); - (0, _tsxCreateElement.mount)(rootDiv, presenter.el); -} -function className(type, presenter) { - return `${presenter.style.cssPrefix}${(0, _enums.PresenterElement)[type]}`; -} - -},{"tsx-create-element":"dPDUq","./defaults":"4Q1zd","./enums":"hnVHt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eWKaN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "patchCubeArray", ()=>patchCubeArray); -function patchCubeArray(allocatedSize, empty, cubes) { - const patched = new Array(allocatedSize); - patched.fill(empty); - cubes.forEach((cube)=>patched[cube.ordinal] = cube); - return patched; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6p1Cn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sceneToStage", ()=>sceneToStage); -var _legend = require("./marks/legend"); -var _legendDefault = parcelHelpers.interopDefault(_legend); -var _image = require("./marks/image"); -var _imageDefault = parcelHelpers.interopDefault(_image); -var _rect = require("./marks/rect"); -var _rectDefault = parcelHelpers.interopDefault(_rect); -var _rule = require("./marks/rule"); -var _ruleDefault = parcelHelpers.interopDefault(_rule); -var _line = require("./marks/line"); -var _lineDefault = parcelHelpers.interopDefault(_line); -var _text = require("./marks/text"); -var _textDefault = parcelHelpers.interopDefault(_text); -var _base = require("./base"); -var _color = require("./color"); -var _defaults = require("./defaults"); -var _interfaces = require("./marks/interfaces"); -function getAxisGroupType(item, options) { - const axisItem = item; - const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; - if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== undefined) return (0, _interfaces.GroupType).zAxis; - switch(axisItem.orient){ - case 'bottom': - case 'top': - return (0, _interfaces.GroupType).xAxis; - case 'left': - case 'right': - return (0, _interfaces.GroupType).yAxis; - } -} -function convertGroupRole(item, options) { - if (item.mark.role === 'legend') return (0, _interfaces.GroupType).legend; - if (item.mark.role === 'axis') { - const groupType = getAxisGroupType(item, options); - if (groupType !== undefined) return groupType; - } -} -const group = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(g) { - const gx = g.x || 0, gy = g.y || 0; - if (g.context && g.context.background && !stage.backgroundColor) stage.backgroundColor = (0, _color.colorFromString)(g.context.background); - if (g.stroke) { - const facetRect = { - datum: g.datum, - lines: (0, _rule.box)(gx + x, gy + y, g.height, g.width, g.stroke, (0, _defaults.groupStrokeWidth)) - }; - stage.facets.push(facetRect); - } - groupType = convertGroupRole(g, options) || groupType; - setCurrentAxis(options, stage, groupType); - // draw group contents - (0, _base.base).vega.sceneVisit(g, function(item) { - mainStager(options, stage, item, gx + x, gy + y, groupType); - }); - }); -}; -function setCurrentAxis(options, stage, groupType) { - let axisRole; - switch(groupType){ - case (0, _interfaces.GroupType).xAxis: - axisRole = 'x'; - break; - case (0, _interfaces.GroupType).yAxis: - axisRole = 'y'; - break; - case (0, _interfaces.GroupType).zAxis: - axisRole = 'z'; - break; - default: - return; + const sorted = Object.keys(props.legend.rows).sort((a2, b2) => +a2 - +b2); + sorted.forEach((i) => addRow(props.legend.rows[i])); + if (sorted.length) { + return createElement(Table$1, { rows, rowClassName: "legend-row", onRowClick: (e, i) => props.onClick(e, props.legend, i) }, props.legend.title !== void 0 && createElement( + "tr", + { onClick: (e) => props.onClick(e, props.legend, null) }, + createElement("th", { colSpan: 2 }, props.legend.title) + )); } - options.currAxis = { - axisRole, - domain: null, - tickText: [], - ticks: [] - }; - stage.axes[axisRole].push(options.currAxis); -} -const markStagers = { - group, - legend: (0, _legendDefault.default), - image: (0, _imageDefault.default), - rect: (0, _rectDefault.default), - rule: (0, _ruleDefault.default), - line: (0, _lineDefault.default), - text: (0, _textDefault.default) -}; -const mainStager = (options, stage, scene, x, y, groupType)=>{ - if (scene.marktype !== 'group' && groupType === (0, _interfaces.GroupType).legend) (0, _legendDefault.default)(options, stage, scene, x, y, groupType); - else { - const markStager = markStagers[scene.marktype]; - if (markStager) markStager(options, stage, scene, x, y, groupType); + }; + const symbolMap = { + square: function(symbol2) { + return createElement("div", { style: { + height: `${symbol2.bounds.y2 - symbol2.bounds.y1}px`, + width: `${symbol2.bounds.x2 - symbol2.bounds.x1}px`, + backgroundColor: symbol2.fill, + borderColor: symbol2.fill + } }); } -}; -function sceneToStage(options, stage, scene) { - mainStager(options, stage, scene, 0, 0, null); - sortAxis(stage.axes.x, 0); - sortAxis(stage.axes.y, 1); - sortAxis(stage.axes.z, 1); -} -function sortAxis(axes, dim) { - axes.forEach((axis)=>{ - if (axis.domain) orderDomain(axis.domain, dim); - axis.ticks.sort((a, b)=>a.sourcePosition[dim] - b.sourcePosition[dim]); - axis.tickText.sort((a, b)=>a.position[dim] - b.position[dim]); - }); -} -function orderDomain(domain, dim) { - if (domain.sourcePosition[dim] > domain.targetPosition[dim]) { - const temp = domain.targetPosition; - domain.targetPosition = domain.sourcePosition; - domain.sourcePosition = temp; - } -} - -},{"./marks/legend":"jtBG9","./marks/image":"1Vs56","./marks/rect":"7DefN","./marks/rule":"aqAq7","./marks/line":"axYMN","./marks/text":"geL5J","./base":"hIePf","./color":"cgTtg","./defaults":"4Q1zd","./marks/interfaces":"96Qp6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jtBG9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const legendMap = { - 'legend-title': function(legend, textItem) { - legend.title = textItem.text; + }; + function initializePanel(presenter) { + const rootDiv = createElement( + "div", + { className: className$1(PresenterElement$1.root, presenter) }, + createElement("div", { className: className$1(PresenterElement$1.gl, presenter), style: { minHeight, minWidth } }), + createElement( + "div", + { className: className$1(PresenterElement$1.panel, presenter) }, + createElement("div", { className: className$1(PresenterElement$1.vegaControls, presenter) }), + createElement("div", { className: className$1(PresenterElement$1.legend, presenter) }) + ) + ); + mount(rootDiv, presenter.el); + } + function className$1(type2, presenter) { + return `${presenter.style.cssPrefix}${PresenterElement$1[type2]}`; + } + function patchCubeArray(allocatedSize, empty, cubes) { + const patched = new Array(allocatedSize); + patched.fill(empty); + cubes.forEach((cube) => patched[cube.ordinal] = cube); + return patched; + } + const legendMap = { + "legend-title": function(legend2, textItem) { + legend2.title = textItem.text; }, - 'legend-symbol': function(legend, symbol) { - const { bounds, fill, shape } = symbol; - //this object is safe for serialization - const legendRowSymbol = { - bounds, - fill, - shape - }; - const i = symbol.datum.index; - legend.rows[i] = legend.rows[i] || {}; - legend.rows[i].symbol = legendRowSymbol; + "legend-symbol": function(legend2, symbol2) { + const { bounds: bounds2, fill: fill2, shape: shape2 } = symbol2; + const legendRowSymbol = { bounds: bounds2, fill: fill2, shape: shape2 }; + const i = symbol2.datum.index; + legend2.rows[i] = legend2.rows[i] || {}; + legend2.rows[i].symbol = legendRowSymbol; }, - 'legend-label': function(legend, label) { - const i = label.datum.index; - legend.rows[i] = legend.rows[i] || {}; - const row = legend.rows[i]; - row.label = label.text; - row.value = label.datum.value; - } -}; -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const fn = legendMap[item.mark.role]; - if (fn) fn(stage.legend, item); + "legend-label": function(legend2, label2) { + const i = label2.datum.index; + legend2.rows[i] = legend2.rows[i] || {}; + const row = legend2.rows[i]; + row.label = label2.text; + row.value = label2.datum.value; + } + }; + const markStager$5 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const fn2 = legendMap[item.mark.role]; + if (fn2) { + fn2(stage.legend, item); + } }); -}; -exports.default = markStager; - -},{"../base":"hIePf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Vs56":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const { bounds, height, url, width } = item; - let { x1, x2, y1, y2 } = bounds; - x1 += x; - x2 += x; - y1 += y; - y2 += y; - if (!stage.backgroundImages) stage.backgroundImages = []; - stage.backgroundImages.push({ - bounds: { - x1, - x2, - y1, - y2 - }, - height, - url, - width - }); + }; + const markStager$4 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const { bounds: bounds2, height: height2, url, width: width2 } = item; + let { x1: x12, x2: x22, y1: y12, y2: y22 } = bounds2; + x12 += x2; + x22 += x2; + y12 += y2; + y22 += y2; + if (!stage.backgroundImages) { + stage.backgroundImages = []; + } + stage.backgroundImages.push({ bounds: { x1: x12, x2: x22, y1: y12, y2: y22 }, height: height2, url, width: width2 }); }); -}; -exports.default = markStager; - -},{"../base":"hIePf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7DefN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const noZ = item.z === undefined; - const z = noZ ? 0 : (item.z || 0) + (0, _defaults.minZ); - const depth = (noZ ? 0 : item.depth || 0) + (0, _defaults.min3dDepth); - //change direction of y from SVG to GL - const ty = -1; - const ordinal = options.assignCubeOrdinal(item.datum); - if (ordinal > options.maxOrdinal) options.maxOrdinal = ordinal; - if (ordinal === undefined) ; - else { - const cube = { - ordinal, - size: [ - item.width, - item.height, - depth - ], - position: [ - x + (+item.x || 0), - ty * (y + (+item.y || 0)) - +item.height, - z - ], - color: (0, _color.colorFromString)(item.fill) || options.defaultCubeColor || [ - 128, - 128, - 128, - 128 - ] - }; - cube.color[3] = item.opacity === undefined ? 255 : 255 * item.opacity; - stage.cubeData.push(cube); - } + }; + const markStager$3 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const noZ = item.z === void 0; + const z2 = noZ ? 0 : (item.z || 0) + minZ; + const depth = (noZ ? 0 : item.depth || 0) + min3dDepth; + const ty2 = -1; + const ordinal2 = options2.assignCubeOrdinal(item.datum); + if (ordinal2 > options2.maxOrdinal) { + options2.maxOrdinal = ordinal2; + } + if (ordinal2 === void 0) ; + else { + const cube = { + ordinal: ordinal2, + size: [item.width, item.height, depth], + position: [x2 + (+item.x || 0), ty2 * (y2 + (+item.y || 0)) - +item.height, z2], + color: colorFromString(item.fill) || options2.defaultCubeColor || [128, 128, 128, 128] + }; + cube.color[3] = item.opacity === void 0 ? 255 : 255 * item.opacity; + stage.cubeData.push(cube); + } }); -}; -exports.default = markStager; - -},{"../base":"hIePf","../color":"cgTtg","../defaults":"4Q1zd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aqAq7":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "box", ()=>box); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const x1 = item.x || 0; - const y1 = item.y || 0; - const x2 = item.x2 != null ? item.x2 : x1; - const y2 = item.y2 != null ? item.y2 : y1; - const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth); - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, lineItem, stage, currAxis); - if (item.mark.role === 'axis-tick') currAxis.ticks.push(lineItem); - else if (item.mark.role === 'axis-domain') currAxis.domain = lineItem; - else stage.gridLines.push(lineItem); + }; + const markStager$2 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const x12 = item.x || 0; + const y12 = item.y || 0; + const x22 = item.x2 != null ? item.x2 : x12; + const y22 = item.y2 != null ? item.y2 : y12; + const lineItem = styledLine(x12 + x2, y12 + y2, x22 + x2, y22 + y2, item.stroke, item.strokeWidth); + const { currAxis } = options2; + if (options2.modifyAxis) { + options2.modifyAxis(item, lineItem, stage, currAxis); + } + if (item.mark.role === "axis-tick") { + currAxis.ticks.push(lineItem); + } else if (item.mark.role === "axis-domain") { + currAxis.domain = lineItem; + } else { + stage.gridLines.push(lineItem); + } }); -}; -function styledLine(x1, y1, x2, y2, stroke, strokeWidth) { - const line = { - sourcePosition: [ - x1, - -y1, - (0, _defaults.lineZ) - ], - targetPosition: [ - x2, - -y2, - (0, _defaults.lineZ) - ], - color: (0, _color.colorFromString)(stroke), - strokeWidth: strokeWidth - }; - return line; -} -function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) { + }; + function styledLine(x12, y12, x2, y2, stroke2, strokeWidth) { + const line2 = { + sourcePosition: [x12, -y12, lineZ], + //-1 = change direction of y from SVG to GL + targetPosition: [x2, -y2, lineZ], + color: colorFromString(stroke2), + strokeWidth + }; + return line2; + } + function box(gx, gy, height2, width2, stroke2, strokeWidth, diagonals = false) { const lines = [ - styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), - styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), - styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), - styledLine(gx, gy + height, gx, gy, stroke, strokeWidth) + styledLine(gx, gy, gx + width2, gy, stroke2, strokeWidth), + styledLine(gx + width2, gy, gx + width2, gy + height2, stroke2, strokeWidth), + styledLine(gx + width2, gy + height2, gx, gy + height2, stroke2, strokeWidth), + styledLine(gx, gy + height2, gx, gy, stroke2, strokeWidth) ]; if (diagonals) { - lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth)); - lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth)); + lines.push(styledLine(gx, gy, gx + width2, gy + height2, stroke2, strokeWidth)); + lines.push(styledLine(gx, gy + height2, gx + width2, gy, stroke2, strokeWidth)); } return lines; -} -exports.default = markStager; - -},{"../base":"hIePf","../color":"cgTtg","../defaults":"4Q1zd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"axYMN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _color = require("../color"); -//change direction of y from SVG to GL -const ty = -1; -const markStager = (options, stage, scene, x, y, groupType)=>{ - const g = Object.assign({ - opacity: 1, - strokeOpacity: 1, - strokeWidth: 1 - }, scene.items[0]); - const path = { - strokeWidth: g.strokeWidth, - strokeColor: (0, _color.colorFromString)(g.stroke), - positions: scene.items.map((it)=>[ - it.x, - ty * it.y, - it.z || 0 - ]) - }; - path.strokeColor[3] *= g.strokeOpacity; - path.strokeColor[3] *= g.opacity; - stage.pathData.push(path); -}; -exports.default = markStager; - -},{"../color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"geL5J":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ // import { AlignmentBaseline, TextAnchor } from '@deck.gl/layers/text-layer/text-layer'; -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - //change direction of y from SVG to GL - const ty = -1; - (0, _base.base).vega.sceneVisit(scene, function(item) { - if (!item.text) return; - const size = item.fontSize; - //const alignmentBaseline = convertBaseline(item.baseline); - //const yOffset = alignmentBaseline === 'top' ? item.fontSize / 2 : 0; //fixup to get tick text correct - const yOffset = 0; - const textItem = { - color: (0, _color.colorFromString)(item.fill), - text: item.limit === undefined ? item.text : (0, _base.base).vega.truncate(item.text, item.limit, 'right', item.ellipsis || '...'), - position: [ - x + (item.x || 0), - ty * (y + (item.y || 0) + yOffset), - 0 - ], - size, - angle: convertAngle(item.angle), - //textAnchor: convertAlignment(item.align), - //alignmentBaseline, - metaData: item.metaData - }; - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, textItem, stage, currAxis); - if (item.mark.role === 'axis-label') { - const tickText = textItem; - tickText.value = item.datum.value; - currAxis.tickText.push(tickText); - } else if (item.mark.role === 'axis-title') currAxis.title = textItem; - else stage.textData.push(textItem); + } + const ty = -1; + const markStager$1 = (options2, stage, scene, x2, y2, groupType) => { + const g = Object.assign({ opacity: 1, strokeOpacity: 1, strokeWidth: 1 }, scene.items[0]); + const path2 = { + strokeWidth: g.strokeWidth, + strokeColor: colorFromString(g.stroke), + positions: scene.items.map((it) => [ + it.x, + ty * it.y, + it.z || 0 + ]) + }; + path2.strokeColor[3] *= g.strokeOpacity; + path2.strokeColor[3] *= g.opacity; + stage.pathData.push(path2); + }; + const markStager = (options2, stage, scene, x2, y2, groupType) => { + const ty2 = -1; + base$3.vega.sceneVisit(scene, function(item) { + if (!item.text) + return; + const size = item.fontSize; + const yOffset = 0; + const textItem = { + color: colorFromString(item.fill), + text: item.limit === void 0 ? item.text : base$3.vega.truncate(item.text, item.limit, "right", item.ellipsis || "..."), + //use dots instead of unicode ellipsis for + position: [x2 + (item.x || 0), ty2 * (y2 + (item.y || 0) + yOffset), 0], + size, + angle: convertAngle(item.angle), + //textAnchor: convertAlignment(item.align), + //alignmentBaseline, + metaData: item.metaData + }; + const { currAxis } = options2; + if (options2.modifyAxis) { + options2.modifyAxis(item, textItem, stage, currAxis); + } + if (item.mark.role === "axis-label") { + const tickText = textItem; + tickText.value = item.datum.value; + currAxis.tickText.push(tickText); + } else if (item.mark.role === "axis-title") { + currAxis.title = textItem; + } else { + stage.textData.push(textItem); + } }); -}; -function convertAngle(vegaTextAngle) { - if (vegaTextAngle && !isNaN(vegaTextAngle)) return 360 - vegaTextAngle; + }; + function convertAngle(vegaTextAngle) { + if (vegaTextAngle && !isNaN(vegaTextAngle)) { + return 360 - vegaTextAngle; + } return 0; -} -// function convertAlignment(textAlign: SceneTextAlign): TextAnchor { -// switch (textAlign) { -// case 'center': return 'middle'; -// case 'left': return 'start'; -// case 'right': return 'end'; -// } -// return 'start'; -// } -// function convertBaseline(baseline: SceneTextBaseline): AlignmentBaseline { -// switch (baseline) { -// case 'middle': return 'center'; -// } -// return baseline || 'bottom'; -// } -exports.default = markStager; - -},{"../base":"hIePf","../color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"96Qp6":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GroupType", ()=>GroupType); -var GroupType; -(function(GroupType) { - GroupType[GroupType["none"] = 0] = "none"; - GroupType[GroupType["legend"] = 1] = "legend"; - GroupType[GroupType["xAxis"] = 2] = "xAxis"; - GroupType[GroupType["yAxis"] = 3] = "yAxis"; - GroupType[GroupType["zAxis"] = 4] = "zAxis"; -})(GroupType || (GroupType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6vcDa":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _render = require("./render"); -parcelHelpers.exportAll(_render, exports); -var _color = require("./color"); -parcelHelpers.exportAll(_color, exports); -var _init = require("./init"); -parcelHelpers.exportAll(_init, exports); - -},{"./render":"k7EOz","./color":"7T6SC","./init":"dMNNU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k7EOz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "morphChartsRender", ()=>morphChartsRender); -var _axes = require("./axes"); -var _bounds = require("./bounds"); -var _cubes = require("./cubes"); -var _lines = require("./lines"); -var _text = require("./text"); -var _image = require("./image"); -var _defaults = require("../defaults"); -var _color = require("./color"); -var _defaults1 = require("./defaults"); -var _camera = require("./camera"); -function morphChartsRender(ref, prevStage, stage, height, width, preStage, colors, config) { - const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults1.cameraDefaults); - const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref; - let transistion2dOnly = false; - let cameraTo; - let holdCamera; - if (config.camera === 'hold') holdCamera = true; - else cameraTo = config.camera; - if (prevStage && prevStage.view !== stage.view) { - modelTransitioner.shouldTransition = !holdCamera; - if (stage.view === '2d') { - modelTransitioner.qRotation.from = qModelRotation3d; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.from = qModelRotation2d; - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - } else { - modelTransitioner.shouldTransition = false; - if (stage.view === '2d') { - transistion2dOnly = true; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } + } + var GroupType; + (function(GroupType2) { + GroupType2[GroupType2["none"] = 0] = "none"; + GroupType2[GroupType2["legend"] = 1] = "legend"; + GroupType2[GroupType2["xAxis"] = 2] = "xAxis"; + GroupType2[GroupType2["yAxis"] = 3] = "yAxis"; + GroupType2[GroupType2["zAxis"] = 4] = "zAxis"; + })(GroupType || (GroupType = {})); + function getAxisGroupType(item, options2) { + const axisItem = item; + const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; + if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options2.zAxisZindex && options2.zAxisZindex !== void 0) { + return GroupType.zAxis; } - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - if (!prevStage) { - core.setModelRotation(modelTransitioner.qRotation.to, false); - core.camera.setOrbit(cameraTransitioner.qRotation.to, false); - core.camera.setPosition(cameraTransitioner.vPosition.to, false); - } else if (!holdCamera) cameraTransitioner.begin(); - positionTransitioner.begin(); - if (modelTransitioner.shouldTransition) modelTransitioner.begin(); - const props = { - ref, - stage, - height, - width, - config - }; - const cubeLayer = (0, _cubes.createCubeLayer)(props); - const lineLayer = (0, _lines.createLineLayer)(props); - const textLayer = (0, _text.createTextLayer)(props); - const { backgroundImages } = stage; - let contentBounds = (0, _bounds.outerBounds)((0, _bounds.outerBounds)(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), (0, _bounds.outerBounds)(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); - backgroundImages === null || backgroundImages === void 0 || backgroundImages.forEach((backgroundImage)=>{ - contentBounds = (0, _bounds.outerBounds)(contentBounds, convertBounds(backgroundImage.bounds)); - }); - props.bounds = contentBounds; - core.renderer.previousAxes = core.renderer.currentAxes; - const axesLayer = (0, _axes.createAxesLayer)(props); - core.config.transitionStaggering = config.transitionDurations.stagger; - core.config.transitionDuration = config.transitionDurations.position; - let bounds; - if (axesLayer && axesLayer.bounds) bounds = axesLayer.bounds; - else bounds = contentBounds; - ref.setMorphChartsRendererOptions(config.renderer); - if (preStage) preStage(stage, cubeLayer); - //add images - core.renderer.images = []; - if (backgroundImages) { - const addImage = (imageBounds, imageData)=>{ - const imageWidth = imageBounds.maxBoundsX - imageBounds.minBoundsX; - const imageHeight = imageBounds.maxBoundsY - imageBounds.minBoundsY; - const position = [ - imageBounds.minBoundsX + imageWidth / 2, - imageBounds.minBoundsY + imageHeight / 2, - 0 - ]; - const imageQuad = (0, _image.createImageQuad)(core, imageData, contentBounds, position, imageWidth, imageHeight); - const imageVisual = core.renderer.createImageVisual(imageQuad); - core.renderer.images.push(imageVisual); + switch (axisItem.orient) { + case "bottom": + case "top": + return GroupType.xAxis; + case "left": + case "right": + return GroupType.yAxis; + } + } + function convertGroupRole(item, options2) { + if (item.mark.role === "legend") + return GroupType.legend; + if (item.mark.role === "axis") { + const groupType = getAxisGroupType(item, options2); + if (groupType !== void 0) { + return groupType; + } + } + } + const group$1 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(g) { + const gx = g.x || 0, gy = g.y || 0; + if (g.context && g.context.background && !stage.backgroundColor) { + stage.backgroundColor = colorFromString(g.context.background); + } + if (g.stroke) { + const facetRect = { + datum: g.datum, + lines: box(gx + x2, gy + y2, g.height, g.width, g.stroke, groupStrokeWidth) }; - const imageDataCache = {}; - backgroundImages.forEach((backgroundImage)=>{ - const imageBounds = convertBounds(backgroundImage.bounds); - const imageData = imageDataCache[backgroundImage.url]; - if (imageData) addImage(imageBounds, imageData); - else (0, _image.getImageData)(backgroundImage.url).then((imageData)=>{ - imageDataCache[backgroundImage.url] = imageData; - addImage(imageBounds, imageData); - }); - }); + stage.facets.push(facetRect); + } + groupType = convertGroupRole(g, options2) || groupType; + setCurrentAxis(options2, stage, groupType); + base$3.vega.sceneVisit(g, function(item) { + mainStager(options2, stage, item, gx + x2, gy + y2, groupType); + }); + }); + }; + function setCurrentAxis(options2, stage, groupType) { + let axisRole; + switch (groupType) { + case GroupType.xAxis: + axisRole = "x"; + break; + case GroupType.yAxis: + axisRole = "y"; + break; + case GroupType.zAxis: + axisRole = "z"; + break; + default: + return; } - //Now call update on each layout - layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds, ref.layerStagger); - (0, _camera.applyCameraCallbacks)(ref, config, stage.view, transistion2dOnly); - core.renderer.transitionTime = 0; // Set renderer transition time for this render pass to prevent rendering target buffer for single frame - (0, _color.colorConfig)(ref, colors); - return { - bounds, - getCubeLayer: ()=>cubeLayer, - update: (layerSelection)=>layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, ref.layerStagger), - activate: (id)=>core.renderer.transitionBuffers[0].activeId = id, - moveCamera: (camera)=>{ - if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - cameraTransitioner.move(camera.position, camera.rotation); - } - }, - setTransitionTimeAxesVisibility: ()=>{ - (0, _camera.setTransitionTimeAxesVisibility)(transistion2dOnly, core); - } + options2.currAxis = { + axisRole, + domain: null, + tickText: [], + ticks: [] }; -} -function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, layerStagger) { - const layerItems = [ - { - layer: cubeLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes - }, - { - layer: lineLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines - }, - { - layer: textLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts - } + stage.axes[axisRole].push(options2.currAxis); + } + const markStagers = { + group: group$1, + legend: markStager$5, + image: markStager$4, + rect: markStager$3, + rule: markStager$2, + line: markStager$1, + text: markStager + }; + const mainStager = (options2, stage, scene, x2, y2, groupType) => { + if (scene.marktype !== "group" && groupType === GroupType.legend) { + markStager$5(options2, stage, scene); + } else { + const markStager2 = markStagers[scene.marktype]; + if (markStager2) { + markStager2(options2, stage, scene, x2, y2, groupType); + } + } + }; + function sceneToStage(options2, stage, scene) { + mainStager(options2, stage, scene, 0, 0, null); + sortAxis(stage.axes.x, 0); + sortAxis(stage.axes.y, 1); + sortAxis(stage.axes.z, 1); + } + function sortAxis(axes, dim) { + axes.forEach((axis) => { + if (axis.domain) + orderDomain(axis.domain, dim); + axis.ticks.sort((a2, b2) => a2.sourcePosition[dim] - b2.sourcePosition[dim]); + axis.tickText.sort((a2, b2) => a2.position[dim] - b2.position[dim]); + }); + } + function orderDomain(domain2, dim) { + if (domain2.sourcePosition[dim] > domain2.targetPosition[dim]) { + const temp2 = domain2.targetPosition; + domain2.targetPosition = domain2.sourcePosition; + domain2.sourcePosition = temp2; + } + } + function outerBounds(b1, b2) { + if (!b1 && !b2) + return; + if (!b1) + return b2; + if (!b2) + return b1; + const minProps = [ + "minBoundsX", + "minBoundsY", + "minBoundsZ" + ]; + const maxProps = [ + "maxBoundsX", + "maxBoundsY", + "maxBoundsZ" ]; - layerItems.forEach((layerItem)=>{ - var _a; - return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds, layerItem.selection, layerItem.stagger); + const result = {}; + minProps.forEach((p) => result[p] = notNull(Math.min, b1[p], b2[p])); + maxProps.forEach((p) => result[p] = notNull(Math.max, b1[p], b2[p])); + return result; + } + function notNull(fn2, v1, v2) { + if (v1 == null && v2 == null) + return null; + if (v1 == null) + return v2; + if (v2 == null) + return v1; + return fn2(v1, v2); + } + function increment$1(b2, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { + return outerBounds(b2, { + minBoundsX, + minBoundsY, + minBoundsZ, + maxBoundsX, + maxBoundsY, + maxBoundsZ }); -} -function convertBounds(bounds) { - if (!bounds) return; - return { - minBoundsX: bounds.x1, - maxBoundsX: bounds.x2, - minBoundsY: -bounds.y2, - maxBoundsY: -bounds.y1, - minBoundsZ: (0, _defaults.minZ), - maxBoundsZ: (0, _defaults.minZ) - }; -} - -},{"./axes":"a0VSy","./bounds":"g9F83","./cubes":"9hPmh","./lines":"cM6w1","./text":"6hAIv","./image":"k12os","../defaults":"4Q1zd","./color":"7T6SC","./defaults":"baEhk","./camera":"cPRXr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a0VSy":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createAxesLayer", ()=>createAxesLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -const createAxesLayer = (props)=>{ - const { config, height, ref, stage } = props; - const { core } = ref; + } + const createAxesLayer = (props) => { + const { config, height: height2, ref: ref2, stage } = props; + const { core } = ref2; const { renderer } = core; - const { x, y, z } = stage.axes; - const xyz = [ - ...x, - ...y, - ...z - ]; + const { x: x2, y: y2, z: z2 } = stage.axes; + const xyz = [...x2, ...y2, ...z2]; renderer.currentAxes = []; if (!xyz.length) { - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - return; + renderer.axesVisibility = AxesVisibility.none; + return; } - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + renderer.axesVisibility = AxesVisibility.current; const correlation = new AxesCorrelation(stage, 3); const { axesSets, labels } = correlation; - const grid = correlation.getGrid(); - if (grid.byColumn[0]) { - grid.byColumn[0].forEach((row)=>{ - row.axesSet.showFacetTitleY = true; - }); - grid.byRow[0].forEach((col)=>{ - col.axesSet.showFacetTitleX = true; - }); + const grid2 = correlation.getGrid(); + if (grid2.byColumn[0]) { + grid2.byColumn[0].forEach((row) => { + row.axesSet.showFacetTitleY = true; + }); + grid2.byRow[0].forEach((col) => { + col.axesSet.showFacetTitleX = true; + }); } - if (grid.rows > 1) { - const { byRow } = grid; - byRow[0].forEach(({ axesSet }, col)=>{ - if (!axesSet.y) { - if (byRow[1][col].axesSet) { - //move x up - byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; - byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; - delete axesSet.x; - } - } - }); + if (grid2.rows > 1) { + const { byRow } = grid2; + byRow[0].forEach(({ axesSet }, col) => { + if (!axesSet.y) { + if (byRow[1][col].axesSet) { + byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; + byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; + delete axesSet.x; + } + } + }); } - let bounds; + let bounds2; const allAxesSetBounds = []; let anyZ = false; - for(let i = 0; i < axesSets.length; i++)if (axesSets[i].z) { + for (let i = 0; i < axesSets.length; i++) { + if (axesSets[i].z) { anyZ = true; break; + } } - const is3d = stage.view === '3d' && anyZ; - axesSets.forEach((axesSet)=>{ - if (!axesSet.x && !axesSet.y) return; - const axesSetBounds = { - axesSet, - maxBoundsX: null, - maxBoundsY: null, - maxBoundsZ: null, - minBoundsX: null, - minBoundsY: null, - minBoundsZ: null - }; - if (is3d) { - const zBounds = getDomainBounds(1, axesSet.z); - axesSetBounds.minBoundsZ = -zBounds.maxBounds; - axesSetBounds.maxBoundsZ = -zBounds.minBounds; - } - const yBounds = getDomainBounds(1, axesSet.y); - axesSetBounds.minBoundsY = yBounds.minBounds; - axesSetBounds.maxBoundsY = yBounds.maxBounds; - axesSetBounds.y = yBounds.minBounds; - axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; - const xBounds = getDomainBounds(0, axesSet.x); - axesSetBounds.minBoundsX = xBounds.minBounds; - axesSetBounds.maxBoundsX = xBounds.maxBounds; - axesSetBounds.x = xBounds.minBounds; - axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; - allAxesSetBounds.push(axesSetBounds); - bounds = (0, _bounds.outerBounds)(bounds, axesSetBounds); + const is3d = stage.view === "3d" && anyZ; + axesSets.forEach((axesSet) => { + if (!axesSet.x && !axesSet.y) + return; + const axesSetBounds = { + axesSet, + maxBoundsX: null, + maxBoundsY: null, + maxBoundsZ: null, + minBoundsX: null, + minBoundsY: null, + minBoundsZ: null + }; + if (is3d) { + const zBounds = getDomainBounds(1, axesSet.z); + axesSetBounds.minBoundsZ = -zBounds.maxBounds; + axesSetBounds.maxBoundsZ = -zBounds.minBounds; + } + const yBounds = getDomainBounds(1, axesSet.y); + axesSetBounds.minBoundsY = yBounds.minBounds; + axesSetBounds.maxBoundsY = yBounds.maxBounds; + axesSetBounds.y = yBounds.minBounds; + axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; + const xBounds = getDomainBounds(0, axesSet.x); + axesSetBounds.minBoundsX = xBounds.minBounds; + axesSetBounds.maxBoundsX = xBounds.maxBounds; + axesSetBounds.x = xBounds.minBounds; + axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; + allAxesSetBounds.push(axesSetBounds); + bounds2 = outerBounds(bounds2, axesSetBounds); }); - const facetLabelX = labels.filter((label)=>label.axisRole === 'x')[0]; - const facetLabelY = labels.filter((label)=>label.axisRole === 'y')[0]; - core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator })=>{ - const axesSet = axesSets[axes]; - let a; - let f; - switch(axis){ - case 0: - a = axesSet.x; - f = facetLabelX; - break; - case 1: - a = axesSet.y; - f = facetLabelY; - break; - case 2: - a = axesSet.z; - break; + const facetLabelX = labels.filter((label2) => label2.axisRole === "x")[0]; + const facetLabelY = labels.filter((label2) => label2.axisRole === "y")[0]; + core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { + const axesSet = axesSets[axes]; + let a2; + let f; + switch (axis) { + case 0: { + a2 = axesSet.x; + f = facetLabelX; + break; + } + case 1: { + a2 = axesSet.y; + f = facetLabelY; + break; + } + case 2: { + a2 = axesSet.z; + break; } - if (a) config.onTextClick(manipulator.event, a.title || f.title); + } + if (a2) { + config.onTextClick(manipulator.event, a2.title || f.title); + } }; - allAxesSetBounds.forEach((axesSetBounds)=>{ - const { axesSet } = axesSetBounds; - if (!axesSet.x && !axesSet.y) return; - const cartesian = new (is3d ? (0, _morphcharts.Axes).Cartesian3dAxes : (0, _morphcharts.Axes).Cartesian2dAxes)(core); - cartesian.isDivisionPickingEnabled = [ - false, - false, - false - ]; - cartesian.arePickDivisionsVisible = [ - false, - false, - false - ]; - cartesian.isLabelPickingEnabled = [ - false, - false, - false - ]; - cartesian.isTitlePickingEnabled = [ - false, - false, - false - ]; - cartesian.isGridPickingEnabled = false; - cartesian.isHeadingPickingEnabled = [ - false, - false, - false - ]; - createAxes(cartesian, 0, 0, axesSet.x, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleX && facetLabelX); - createAxes(cartesian, 1, 1, axesSet.y, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleY && facetLabelY); - if (is3d) createAxes(cartesian, 1, 2, axesSet.z, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props); - configCartesianAxes(is3d, bounds, cartesian); - const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds; - const w = maxBoundsX - minBoundsX; - const h = maxBoundsY - minBoundsY; - cartesian.scalingX = axesSetBounds.w / w; - cartesian.scalingY = axesSetBounds.h / h; - cartesian.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w - 0.5; - cartesian.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h - 0.5; - const aspect = h / w; - if (aspect > 1) cartesian.offsetX /= aspect; - else cartesian.offsetY *= aspect; - const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian) : renderer.createCartesian2dAxesVisual(cartesian); - renderer.currentAxes.push(axes); - props.config.onAxesComplete && props.config.onAxesComplete(cartesian); + allAxesSetBounds.forEach((axesSetBounds) => { + const { axesSet } = axesSetBounds; + if (!axesSet.x && !axesSet.y) + return; + const cartesian2 = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); + cartesian2.isDivisionPickingEnabled = [false, false, false]; + cartesian2.arePickDivisionsVisible = [false, false, false]; + cartesian2.isLabelPickingEnabled = [false, false, false]; + cartesian2.isTitlePickingEnabled = [false, false, false]; + cartesian2.isGridPickingEnabled = false; + cartesian2.isHeadingPickingEnabled = [false, false, false]; + createAxes(cartesian2, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleX && facetLabelX); + createAxes(cartesian2, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleY && facetLabelY); + if (is3d) { + createAxes(cartesian2, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height2, props); + } + configCartesianAxes(is3d, bounds2, cartesian2); + const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds2; + const w2 = maxBoundsX - minBoundsX; + const h2 = maxBoundsY - minBoundsY; + cartesian2.scalingX = axesSetBounds.w / w2; + cartesian2.scalingY = axesSetBounds.h / h2; + cartesian2.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w2 - 0.5; + cartesian2.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h2 - 0.5; + const aspect = h2 / w2; + if (aspect > 1) { + cartesian2.offsetX /= aspect; + } else { + cartesian2.offsetY *= aspect; + } + const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian2) : renderer.createCartesian2dAxesVisual(cartesian2); + renderer.currentAxes.push(axes); + props.config.onAxesComplete && props.config.onAxesComplete(cartesian2); }); - return { - bounds - }; -}; -const nullDomain = { - sourcePosition: [ - 0, - 0, - 0 - ], - targetPosition: [ - 0, - 0, - 0 - ] -}; -class AxesCorrelation { - constructor(stage, dimensions){ - this.dimensions = dimensions; - const { x, y, z } = stage.axes; - this.axesSets = []; - this.labels = []; - [ - x, - y, - z - ].forEach((axes)=>{ - axes.forEach((axis)=>{ - if (this.axesSets.length === 0) this.initialize(axis); - else this.correlate(axis); - }); + return { bounds: bounds2 }; + }; + const nullDomain = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0] + }; + class AxesCorrelation { + constructor(stage, dimensions) { + this.dimensions = dimensions; + const { x: x2, y: y2, z: z2 } = stage.axes; + this.axesSets = []; + this.labels = []; + [x2, y2, z2].forEach((axes) => { + axes.forEach((axis) => { + if (this.axesSets.length === 0) { + this.initialize(axis); + } else { + this.correlate(axis); + } }); + }); } getGrid() { - const mapCols = {}; - const mapRows = {}; - this.axesSets.forEach((axesSet)=>{ - var _a; - const domain = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; - if (!domain) return; - const col = domain.sourcePosition[0].toString(); - const row = domain.sourcePosition[1].toString(); - if (!mapCols[col]) mapCols[col] = {}; - mapCols[col][row] = axesSet; - mapRows[row] = null; - }); - const colKeys = Object.keys(mapCols).sort((a, b)=>+a - +b); - const rowKeys = Object.keys(mapRows).sort((a, b)=>+a - +b); - return { - cols: colKeys.length, - rows: rowKeys.length, - byColumn: colKeys.map((colKey)=>rowKeys.map((rowKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })), - byRow: rowKeys.map((rowKey)=>colKeys.map((colKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })) - }; + const mapCols = {}; + const mapRows = {}; + this.axesSets.forEach((axesSet) => { + var _a2; + const domain2 = (_a2 = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a2 === void 0 ? void 0 : _a2.domain; + if (!domain2) + return; + const col = domain2.sourcePosition[0].toString(); + const row = domain2.sourcePosition[1].toString(); + if (!mapCols[col]) { + mapCols[col] = {}; + } + mapCols[col][row] = axesSet; + mapRows[row] = null; + }); + const colKeys = Object.keys(mapCols).sort((a2, b2) => +a2 - +b2); + const rowKeys = Object.keys(mapRows).sort((a2, b2) => +a2 - +b2); + return { + cols: colKeys.length, + rows: rowKeys.length, + byColumn: colKeys.map((colKey) => rowKeys.map((rowKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })), + byRow: rowKeys.map((rowKey) => colKeys.map((colKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })) + }; } initialize(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - const axesSet = {}; - axesSet[axis.axisRole] = axis; - this.axesSets.push(axesSet); + if (!axis.domain) { + this.labels.push(axis); + return; + } + const axesSet = {}; + axesSet[axis.axisRole] = axis; + this.axesSets.push(axesSet); } correlate(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - for(let i = 0; i < this.axesSets.length; i++){ - const axesSet = this.axesSets[i]; - for(const axisRole in axesSet){ - const test = axesSet[axisRole]; - if (this.matchDomains(axis.domain, test.domain)) { - //prefer the axes with titles - if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) axesSet[axis.axisRole] = axis; - return; - } + if (!axis.domain) { + this.labels.push(axis); + return; + } + for (let i = 0; i < this.axesSets.length; i++) { + const axesSet = this.axesSets[i]; + for (const axisRole in axesSet) { + const test2 = axesSet[axisRole]; + if (this.matchDomains(axis.domain, test2.domain)) { + if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) { + axesSet[axis.axisRole] = axis; } + return; + } } - this.initialize(axis); - } - matchDomains(a, b) { - if (this.matchPoint(a.sourcePosition, b.sourcePosition)) return true; - if (this.matchPoint(a.sourcePosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.sourcePosition)) return true; - return false; + } + this.initialize(axis); } - matchPoint(a, b) { - for(let i = 0; i < this.dimensions; i++){ - if (a[i] !== b[i]) return false; - } + matchDomains(a2, b2) { + if (this.matchPoint(a2.sourcePosition, b2.sourcePosition)) + return true; + if (this.matchPoint(a2.sourcePosition, b2.targetPosition)) return true; + if (this.matchPoint(a2.targetPosition, b2.targetPosition)) + return true; + if (this.matchPoint(a2.targetPosition, b2.sourcePosition)) + return true; + return false; + } + matchPoint(a2, b2) { + for (let i = 0; i < this.dimensions; i++) { + if (a2[i] !== b2[i]) + return false; + } + return true; } -} -function createAxes(cartesian, dim2d, dim3d, axis, orientation, height, props, facetLabel) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain, dim2d, height); - if (axis.axisRole === 'z') { - tickPositions.forEach((t, i)=>tickPositions[i] = 1 - t); - textPos.forEach((t, i)=>textPos[i] = 1 - t); - tickText.reverse(); - tickPositions.reverse(); - textPos.reverse(); - } - cartesian.setTickPositions(dim3d, tickPositions); - cartesian.zero[dim3d] = 0; //TODO get any "zero" gridline position from vega - cartesian.setLabelPositions(dim3d, textPos); - cartesian.setLabels(dim3d, tickText); - cartesian.setLabelSizes(dim3d, textSize); + } + function createAxes(cartesian2, dim2d, dim3d, axis, orientation, height2, props, facetLabel) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain2, dim2d, height2); + if (axis.axisRole === "z") { + tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); + textPos.forEach((t, i) => textPos[i] = 1 - t); + tickText.reverse(); + tickPositions.reverse(); + textPos.reverse(); + } + cartesian2.setTickPositions(dim3d, tickPositions); + cartesian2.zero[dim3d] = 0; + cartesian2.setLabelPositions(dim3d, textPos); + cartesian2.setLabels(dim3d, tickText); + cartesian2.setLabelSizes(dim3d, textSize); const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); if (title === null || title === void 0 ? void 0 : title.text) { - cartesian.setTitle(dim3d, title.text); - cartesian.setTitleSize(dim3d, title.size / height); + cartesian2.setTitle(dim3d, title.text); + cartesian2.setTitleSize(dim3d, title.size / height2); } - cartesian.setLabelOrientation(dim3d, orientation); - props.config.onAxisConfig && props.config.onAxisConfig(cartesian, dim3d, axis); + cartesian2.setLabelOrientation(dim3d, orientation); + props.config.onAxisConfig && props.config.onAxisConfig(cartesian2, dim3d, axis); return { - tickText - }; -} -function configCartesianAxes(is3d, bounds, cartesian) { - if (is3d) cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topBack] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).backRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).bottomRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).frontRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topFront] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topRight] = false; - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - cartesian.minBoundsX = minBoundsX; - cartesian.maxBoundsX = maxBoundsX; - cartesian.minBoundsY = minBoundsY; - cartesian.maxBoundsY = maxBoundsY; + tickText + }; + } + function configCartesianAxes(is3d, bounds2, cartesian2) { + if (is3d) { + cartesian2.isEdgeVisible[Edge3D.topBack] = false; + } + cartesian2.isEdgeVisible[Edge3D.backRight] = false; + cartesian2.isEdgeVisible[Edge3D.bottomRight] = false; + cartesian2.isEdgeVisible[Edge3D.frontRight] = false; + cartesian2.isEdgeVisible[Edge3D.topFront] = false; + cartesian2.isEdgeVisible[Edge3D.topRight] = false; + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; + cartesian2.minBoundsX = minBoundsX; + cartesian2.maxBoundsX = maxBoundsX; + cartesian2.minBoundsY = minBoundsY; + cartesian2.maxBoundsY = maxBoundsY; if (is3d) { - cartesian.minBoundsZ = minBoundsZ; - cartesian.maxBoundsZ = maxBoundsZ; - } -} -function getDomainBounds(dim2d, axis) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const minBounds = domain.sourcePosition[dim2d]; - const maxBounds = domain.targetPosition[dim2d]; + cartesian2.minBoundsZ = minBoundsZ; + cartesian2.maxBoundsZ = maxBoundsZ; + } + } + function getDomainBounds(dim2d, axis) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const minBounds = domain2.sourcePosition[dim2d]; + const maxBounds = domain2.targetPosition[dim2d]; return { - maxBounds, - minBounds - }; -} -function convertAxis(axis, domain, dim, height) { - const start = domain.sourcePosition[dim]; - const span = domain.targetPosition[dim] - start; - const tickPositions = axis ? axis.ticks.map((t)=>(t.sourcePosition[dim] - start) / span) : []; - const tickText = axis ? axis.tickText.map((t)=>t.text) : []; - const textPos = axis ? axis.tickText.map((t)=>(t.position[dim] - start) / span) : []; - const textSize = axis ? axis.tickText.map((t)=>t.size / height) : []; + maxBounds, + minBounds + }; + } + function convertAxis(axis, domain2, dim, height2) { + const start = domain2.sourcePosition[dim]; + const span2 = domain2.targetPosition[dim] - start; + const tickPositions = axis ? axis.ticks.map((t) => (t.sourcePosition[dim] - start) / span2) : []; + const tickText = axis ? axis.tickText.map((t) => t.text) : []; + const textPos = axis ? axis.tickText.map((t) => (t.position[dim] - start) / span2) : []; + const textSize = axis ? axis.tickText.map((t) => t.size / height2) : []; if (tickPositions.length) { - if (tickPositions[0] !== 0) tickPositions[0] = 0; - if (tickPositions[tickPositions.length - 1] !== 1) tickPositions[tickPositions.length - 1] = 1; + if (tickPositions[0] !== 0) { + tickPositions[0] = 0; + } + if (tickPositions[tickPositions.length - 1] !== 1) { + tickPositions[tickPositions.length - 1] = 1; + } } return { - tickPositions, - tickText, - textPos, - textSize - }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g9F83":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "outerBounds", ()=>outerBounds); -parcelHelpers.export(exports, "increment", ()=>increment); -function outerBounds(b1, b2) { - if (!b1 && !b2) return; - if (!b1) return b2; - if (!b2) return b1; - const minProps = [ - 'minBoundsX', - 'minBoundsY', - 'minBoundsZ' - ]; - const maxProps = [ - 'maxBoundsX', - 'maxBoundsY', - 'maxBoundsZ' - ]; - const result = {}; - minProps.forEach((p)=>result[p] = notNull(Math.min, b1[p], b2[p])); - maxProps.forEach((p)=>result[p] = notNull(Math.max, b1[p], b2[p])); - return result; -} -function notNull(fn, v1, v2) { - if (v1 == null && v2 == null) return null; - if (v1 == null) return v2; - if (v2 == null) return v1; - return fn(v1, v2); -} -function increment(b, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { - return outerBounds(b, { - minBoundsX, - minBoundsY, - minBoundsZ, - maxBoundsX, - maxBoundsY, - maxBoundsZ - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9hPmh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createCubeLayer", ()=>createCubeLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'cube'; -const createCubeLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const scatter = new (0, _morphcharts.Layouts).Scatter(core); - const { ids, colors, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds, maxColor, palette } = convert(stage); - if (!ids.length) return; + tickPositions, + tickText, + textPos, + textSize + }; + } + let ColorMap$1 = class ColorMap { + constructor(quant = 5) { + this.quant = quant; + this.colorMap = {}; + this.colorArray = []; + } + getColorKey(rgbaColor) { + const color2 = rgbaColor.slice(0, 3).map((e) => Math.floor(e / this.quant) * this.quant); + color2[3] = rgbaColor[3]; + return JSON.stringify(color2); + } + registerColor(rgbaColor) { + const colorKey = this.getColorKey(rgbaColor); + if (!this.colorMap[colorKey]) { + this.colorMap[colorKey] = { + index: this.colorArray.length, + rgbaColor + }; + this.colorArray.push(rgbaColor); + } + return this.colorMap[colorKey].index; + } + getPalette() { + return { + palette: new Uint8Array(this.colorArray.flat()), + maxColor: this.colorArray.length - 1 + }; + } + }; + function convert$3(newColor) { + const c2 = colorFromString(newColor).slice(0, 3); + return c2.map((v) => v / 255); + } + function colorConfig(ref2, colors2) { + if (!colors2) + return; + const { config } = ref2.core; + config.activeColor = convert$3(colors2.activeItemColor); + config.backgroundColor = new Float32Array(convert$3(colors2.backgroundColor)); + config.textColor = convert$3(colors2.textColor); + config.textBorderColor = convert$3(colors2.textBorderColor); + config.axesTextColor = convert$3(colors2.axesTextLabelColor); + config.axesGridBackgroundColor = convert$3(colors2.axesGridBackgroundColor); + config.axesGridHighlightColor = convert$3(colors2.axesGridHighlightColor); + config.axesGridMinorColor = convert$3(colors2.axesGridMinorColor); + config.axesGridMajorColor = convert$3(colors2.axesGridMajorColor); + config.axesGridZeroColor = convert$3(colors2.axesGridZeroColor); + ref2.core.renderer["_theme"] = null; + } + const key$2 = "cube"; + const createCubeLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const scatter = new Scatter(core); + const { ids, colors: colors2, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds: bounds2, maxColor, palette } = convert$2(stage); + if (!ids.length) + return; const { renderer } = core; - let cubeTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let cubeTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$2); if (!cubeTransitionBuffer) { - cubeTransitionBuffer = renderer.createTransitionBuffer(ids); - cubeTransitionBuffer.key = key; - renderer.transitionBuffers.push(cubeTransitionBuffer); - } else cubeTransitionBuffer.swap(); + cubeTransitionBuffer = renderer.createTransitionBuffer(ids); + cubeTransitionBuffer.key = key$2; + renderer.transitionBuffers.push(cubeTransitionBuffer); + } else { + cubeTransitionBuffer.swap(); + } scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { - positionsX, - positionsY, - positionsZ + positionsX, + positionsY, + positionsZ }); const layer = { - positionsX, - positionsY, - positionsZ, - update: (newBounds, selected, stagger)=>{ - const { colors, maxColor, minColor, palette } = layer.unitColorMap; - // reference off of core.renderer to get the actual buffer - const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - currCubeTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).block; - currCubeTransitionBuffer.currentPalette.colors = palette; - let options = Object.assign({ - selected, - colors, - minColor, - maxColor, - sizesX, - sizesY, - sizesZ - }, newBounds); - if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { - const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; - options = Object.assign(Object.assign({}, options), { - maxStaggerOrder, - minStaggerOrder, - staggerOrders - }); - } - scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); - }, - bounds, - unitColorMap: { - colors, - ids, - minColor: 0, - maxColor, - palette - } + positionsX, + positionsY, + positionsZ, + update: (newBounds, selected, stagger) => { + const { colors: colors3, maxColor: maxColor2, minColor, palette: palette2 } = layer.unitColorMap; + const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$2); + currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; + currCubeTransitionBuffer.currentPalette.colors = palette2; + let options2 = Object.assign({ + selected, + colors: colors3, + minColor, + maxColor: maxColor2, + sizesX, + sizesY, + sizesZ + }, newBounds); + if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { + const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; + options2 = Object.assign(Object.assign({}, options2), { + maxStaggerOrder, + minStaggerOrder, + staggerOrders + }); + } + scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options2); + }, + bounds: bounds2, + unitColorMap: { + colors: colors2, + ids, + minColor: 0, + maxColor, + palette + } }; return layer; -}; -function convert(stage) { + }; + function convert$2(stage) { const { cubeData } = stage; - const { length } = cubeData; + const { length: length2 } = cubeData; const ids = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizesX = new Float64Array(length); - const sizesY = new Float64Array(length); - const sizesZ = new Float64Array(length); - let bounds; - const colorMap = new (0, _color.ColorMap)(); - cubeData.forEach((cube, i)=>{ - ids.push(i); - if (cube.isEmpty) { - positionsX[i] = 0; - positionsY[i] = 0; - positionsZ[i] = 0; - sizesX[i] = 0; - sizesY[i] = 0; - sizesZ[i] = 0; - colors[i] = 0; - } else { - //ids.push(cube.ordinal); - positionsX[i] = cube.position[0] + cube.size[0] * 0.5; - positionsY[i] = cube.position[1] + cube.size[1] * 0.5; - positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; - sizesX[i] = cube.size[0]; - sizesY[i] = cube.size[1]; - sizesZ[i] = cube.size[2]; - bounds = (0, _bounds.increment)(bounds, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); - colors[i] = colorMap.registerColor(cube.color); - } + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizesX = new Float64Array(length2); + const sizesY = new Float64Array(length2); + const sizesZ = new Float64Array(length2); + let bounds2; + const colorMap = new ColorMap$1(); + cubeData.forEach((cube, i) => { + ids.push(i); + if (cube.isEmpty) { + positionsX[i] = 0; + positionsY[i] = 0; + positionsZ[i] = 0; + sizesX[i] = 0; + sizesY[i] = 0; + sizesZ[i] = 0; + colors2[i] = 0; + } else { + positionsX[i] = cube.position[0] + cube.size[0] * 0.5; + positionsY[i] = cube.position[1] + cube.size[1] * 0.5; + positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; + sizesX[i] = cube.size[0]; + sizesY[i] = cube.size[1]; + sizesZ[i] = cube.size[2]; + bounds2 = increment$1(bounds2, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); + colors2[i] = colorMap.registerColor(cube.color); + } }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizesX, - sizesY, - sizesZ, - bounds, - maxColor, - palette + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizesX, + sizesY, + sizesZ, + bounds: bounds2, + maxColor, + palette }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","./color":"7T6SC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7T6SC":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorMap", ()=>ColorMap); -parcelHelpers.export(exports, "colorConfig", ()=>colorConfig); -var _color = require("../color"); -class ColorMap { - constructor(quant = 5){ - this.quant = quant; - this.colorMap = {}; - this.colorArray = []; - } - getColorKey(rgbaColor) { - const color = rgbaColor.slice(0, 3).map((e)=>Math.floor(e / this.quant) * this.quant); - color[3] = rgbaColor[3]; //retain alpha - return JSON.stringify(color); - } - registerColor(rgbaColor) { - const colorKey = this.getColorKey(rgbaColor); - if (!this.colorMap[colorKey]) { - this.colorMap[colorKey] = { - index: this.colorArray.length, - rgbaColor - }; - this.colorArray.push(rgbaColor); - } - return this.colorMap[colorKey].index; - } - getPalette() { - return { - palette: new Uint8Array(this.colorArray.flat()), - maxColor: this.colorArray.length - 1 - }; - } -} -function convert(newColor) { - const c = (0, _color.colorFromString)(newColor).slice(0, 3); - return c.map((v)=>v / 255); -} -function colorConfig(ref, colors) { - if (!colors) return; - const { config } = ref.core; - config.activeColor = convert(colors.activeItemColor); - config.backgroundColor = new Float32Array(convert(colors.backgroundColor)); - config.textColor = convert(colors.textColor); - config.textBorderColor = convert(colors.textBorderColor); - config.axesTextColor = convert(colors.axesTextLabelColor); - config.axesGridBackgroundColor = convert(colors.axesGridBackgroundColor); - config.axesGridHighlightColor = convert(colors.axesGridHighlightColor); - config.axesGridMinorColor = convert(colors.axesGridMinorColor); - config.axesGridMajorColor = convert(colors.axesGridMajorColor); - config.axesGridZeroColor = convert(colors.axesGridZeroColor); - //TODO fix this - hack to reset the background color - ref.core.renderer['_theme'] = null; -} - -},{"../color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cM6w1":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createLineLayer", ()=>createLineLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'line'; -const createLineLayer = (props)=>{ - const { height, ref, stage, width } = props; - const { core } = ref; - const lines = new (0, _morphcharts.Layouts).Line(core); - const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert(stage, height, width); - if (!ids.length) return; + } + const key$1 = "line"; + const createLineLayer = (props) => { + const { height: height2, ref: ref2, stage } = props; + const { core } = ref2; + const lines = new Line(core); + const { ids, fromIds, toIds, lineColors, lineSizes, bounds: bounds2, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert$1(stage, height2); + if (!ids.length) + return; const { renderer } = core; - let lineTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let lineTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$1); if (!lineTransitionBuffer) { - lineTransitionBuffer = renderer.createTransitionBuffer(ids); - lineTransitionBuffer.key = key; - renderer.transitionBuffers.push(lineTransitionBuffer); - } else lineTransitionBuffer.swap(); + lineTransitionBuffer = renderer.createTransitionBuffer(ids); + lineTransitionBuffer.key = key$1; + renderer.transitionBuffers.push(lineTransitionBuffer); + } else { + lineTransitionBuffer.swap(); + } lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { - positionsX, - positionsY, - positionsZ, - lineSizes, - sizeScaling: 1 + positionsX, + positionsY, + positionsZ, + lineSizes, + sizeScaling: 1 }); - let options = { - lineColors, - lineMinColor: 0, - lineMaxColor + let options2 = { + lineColors, + lineMinColor: 0, + lineMaxColor }; - // Unit type - lineTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).cylinder; + lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; lineTransitionBuffer.currentPalette.colors = palette; return { - update: (newBounds)=>{ - options = Object.assign(Object.assign({}, options), newBounds); - // reference off of core.renderer to get the actual buffer - const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); - }, - bounds, - unitColorMap: { - ids, - colors: lineColors, - minColor: 0, - maxColor: lineMaxColor, - palette - } + update: (newBounds) => { + options2 = Object.assign(Object.assign({}, options2), newBounds); + const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$1); + lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options2); + }, + bounds: bounds2, + unitColorMap: { + ids, + colors: lineColors, + minColor: 0, + maxColor: lineMaxColor, + palette + } }; -}; -function convert(stage, height, width) { + }; + function convert$1(stage, height2, width2) { const { pathData } = stage; - const positions = []; + const positions2 = []; const lines = []; - const colorMap = new (0, _color.ColorMap)(); - pathData.forEach((path)=>{ - const color = colorMap.registerColor(path.strokeColor); - let from = positions.length; - positions.push(path.positions[0]); - for(let i = 1; i < path.positions.length; i++){ - const to = positions.length; - positions.push(path.positions[i]); - lines.push({ - id: lines.length, - from, - to, - color, - size: path.strokeWidth - }); - from = to; - } + const colorMap = new ColorMap$1(); + pathData.forEach((path2) => { + const color2 = colorMap.registerColor(path2.strokeColor); + let from = positions2.length; + positions2.push(path2.positions[0]); + for (let i = 1; i < path2.positions.length; i++) { + const to = positions2.length; + positions2.push(path2.positions[i]); + lines.push({ + id: lines.length, + from, + to, + color: color2, + size: path2.strokeWidth + }); + from = to; + } }); const ids = new Uint32Array(lines.length); const fromIds = new Uint32Array(lines.length); const toIds = new Uint32Array(lines.length); const lineColors = new Float64Array(lines.length); const lineSizes = new Float64Array(lines.length); - lines.forEach((line, i)=>{ - ids[i] = i; - fromIds[i] = line.from; - toIds[i] = line.to; - lineColors[i] = line.color; - lineSizes[i] = line.size; + lines.forEach((line2, i) => { + ids[i] = i; + fromIds[i] = line2.from; + toIds[i] = line2.to; + lineColors[i] = line2.color; + lineSizes[i] = line2.size; }); - const positionsX = new Float64Array(positions.length); - const positionsY = new Float64Array(positions.length); - const positionsZ = new Float64Array(positions.length); - let bounds; - positions.forEach((p, i)=>{ - positionsX[i] = p[0]; - positionsY[i] = p[1] + height; - positionsZ[i] = p[2]; - bounds = (0, _bounds.increment)(bounds, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); + const positionsX = new Float64Array(positions2.length); + const positionsY = new Float64Array(positions2.length); + const positionsZ = new Float64Array(positions2.length); + let bounds2; + positions2.forEach((p, i) => { + positionsX[i] = p[0]; + positionsY[i] = p[1] + height2; + positionsZ[i] = p[2]; + bounds2 = increment$1(bounds2, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); }); const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); return { - ids, - fromIds, - toIds, - lineColors, - lineSizes, - bounds, - positionsX, - positionsY, - positionsZ, - lineMaxColor, - palette - }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","./color":"7T6SC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6hAIv":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createTextLayer", ()=>createTextLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const createTextLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const { positionsX, positionsY, positionsZ, sizes, bounds, maxGlyphs, text } = convert(stage); - if (text.length === 0) { - core.renderer.labelSets = []; - return; - } - const options = { - text, - maxGlyphs, - scales: sizes + ids, + fromIds, + toIds, + lineColors, + lineSizes, + bounds: bounds2, + positionsX, + positionsY, + positionsZ, + lineMaxColor, + palette }; - const labelSet = new (0, _morphcharts.Components).LabelSet(core, options); + } + const createTextLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const { positionsX, positionsY, positionsZ, sizes, bounds: bounds2, maxGlyphs, text: text2 } = convert(stage); + if (text2.length === 0) { + core.renderer.labelSets = []; + return; + } + const options2 = { + text: text2, + maxGlyphs, + scales: sizes + }; + const labelSet = new LabelSet(core, options2); labelSet.positionsX = positionsX; labelSet.positionsY = positionsY; labelSet.positionsZ = positionsZ; - labelSet.horizontalAlignment = (0, _morphcharts.HorizontalAlignment).center; - labelSet.verticalAlignment = (0, _morphcharts.VerticalAlignment).center; + labelSet.horizontalAlignment = HorizontalAlignment.center; + labelSet.verticalAlignment = VerticalAlignment.center; const layer = { - update: (bounds)=>{ - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - }, - bounds + update: (bounds3) => { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds3; + labelSet.minBoundsX = minBoundsX; + labelSet.minBoundsY = minBoundsY; + labelSet.minBoundsZ = minBoundsZ; + labelSet.maxBoundsX = maxBoundsX; + labelSet.maxBoundsY = maxBoundsY; + labelSet.maxBoundsZ = maxBoundsZ; + }, + bounds: bounds2 }; const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); - core.renderer.labelSets = [ - labelSetVisual - ]; + core.renderer.labelSets = [labelSetVisual]; return layer; -}; -function convert(stage) { + }; + function convert(stage) { const { textData } = stage; - const { length } = textData; + const { length: length2 } = textData; const ids = []; - const text = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizes = new Float64Array(length); - let bounds; + const text2 = []; + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizes = new Float64Array(length2); + let bounds2; let maxGlyphs = 0; - const colorMap = new (0, _color.ColorMap)(); - textData.forEach((t, i)=>{ - ids.push(i); - text.push(t.text); - maxGlyphs += t.text.length; - positionsX[i] = t.position[0]; - positionsY[i] = t.position[1]; - positionsZ[i] = t.position[2]; - sizes[i] = 1.5 * t.size; //scale similar to axes - bounds = (0, _bounds.increment)(bounds, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); - colors[i] = colorMap.registerColor(t.color); + const colorMap = new ColorMap$1(); + textData.forEach((t, i) => { + ids.push(i); + text2.push(t.text); + maxGlyphs += t.text.length; + positionsX[i] = t.position[0]; + positionsY[i] = t.position[1]; + positionsZ[i] = t.position[2]; + sizes[i] = 1.5 * t.size; + bounds2 = increment$1(bounds2, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); + colors2[i] = colorMap.registerColor(t.color); }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizes, - bounds, - maxColor, - maxGlyphs, - palette, - text - }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","./color":"7T6SC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k12os":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getImageData", ()=>getImageData); -parcelHelpers.export(exports, "createImageQuad", ()=>createImageQuad); -var _morphcharts = require("morphcharts"); -function getImageData(url) { - return new Promise((resolve, reject)=>{ - const imageElement = document.createElement('img'); - imageElement.onload = ()=>{ - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - const { height, width } = imageElement; - canvas.width = width; - canvas.height = height; - ctx.drawImage(imageElement, 0, 0); - resolve(ctx.getImageData(0, 0, width, height)); - }; - imageElement.src = url; + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizes, + bounds: bounds2, + maxColor, + maxGlyphs, + palette, + text: text2 + }; + } + function getImageData(url) { + return new Promise((resolve2, reject) => { + const imageElement = document.createElement("img"); + imageElement.onload = () => { + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext("2d"); + const { height: height2, width: width2 } = imageElement; + canvas.width = width2; + canvas.height = height2; + ctx.drawImage(imageElement, 0, 0); + resolve2(ctx.getImageData(0, 0, width2, height2)); + }; + imageElement.src = url; }); -} -function createImageQuad(core, imageData, bounds, position, width, height) { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + } + function createImageQuad(core, imageData, bounds2, position2, width2, height2) { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; const imageOptions = { - imageData, - position, - height, - width, - minBoundsX, - maxBoundsX, - minBoundsZ, - maxBoundsZ, - minBoundsY, - maxBoundsY - }; - return new (0, _morphcharts.Components).ImageQuad(core, imageOptions); -} - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"baEhk":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cameraDefaults", ()=>cameraDefaults); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -function createCameraDefaults() { - const qModelRotation2d = (0, _glMatrix.quat).create(); - const qModelRotation3d = (0, _morphcharts.Constants).QUAT_ROTATEX_MINUS_90; - const qCameraRotation2d = (0, _glMatrix.quat).create(); - const qCameraRotation3d = (0, _glMatrix.quat).create(); - const qAngle = (0, _glMatrix.quat).create(); - const vCameraPosition = (0, _glMatrix.vec3).create(); - // Altitude (pitch around local right axis) - (0, _glMatrix.quat).setAxisAngle(qCameraRotation3d, (0, _morphcharts.Constants).VECTOR3_UNITX, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(30)); - // Azimuth (yaw around global up axis) - (0, _glMatrix.quat).setAxisAngle(qAngle, (0, _morphcharts.Constants).VECTOR3_UNITY, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(-25)); - (0, _glMatrix.quat).multiply(qCameraRotation3d, qCameraRotation3d, qAngle); + imageData, + position: position2, + height: height2, + width: width2, + minBoundsX, + maxBoundsX, + minBoundsZ, + maxBoundsZ, + minBoundsY, + maxBoundsY + }; + return new ImageQuad(core, imageOptions); + } + function createCameraDefaults() { + const qModelRotation2d2 = create$4(); + const qModelRotation3d2 = Constants$1.QUAT_ROTATEX_MINUS_90; + const qCameraRotation2d2 = create$4(); + const qCameraRotation3d2 = create$4(); + const qAngle = create$4(); + const vCameraPosition2 = create$6(); + setAxisAngle(qCameraRotation3d2, Constants$1.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); + setAxisAngle(qAngle, Constants$1.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); + multiply(qCameraRotation3d2, qCameraRotation3d2, qAngle); return { - qModelRotation2d, - qModelRotation3d, - qCameraRotation2d, - qCameraRotation3d, - vCameraPosition - }; -} -const cameraDefaults = createCameraDefaults(); - -},{"gl-matrix":"5x28d","morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cPRXr":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applyCameraCallbacks", ()=>applyCameraCallbacks); -parcelHelpers.export(exports, "setTransitionTimeAxesVisibility", ()=>setTransitionTimeAxesVisibility); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -var _defaults = require("./defaults"); -const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults.cameraDefaults); -function applyCameraCallbacks(ref, lastPresenterConfig, lastView, transistion2dOnly) { - const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref; - ref.reset = ()=>{ - core.reset(true); - if (lastView === '3d') { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = qCameraRotation3d; - cameraTransitioner.vPosition.to = vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = qCameraRotation2d; - cameraTransitioner.vPosition.to = vCameraPosition; - } - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); - core.setModelRotation(modelTransitioner.qRotation.current, true); - core.camera.setOrbit(cameraTransitioner.qRotation.to, true); - core.camera.setPosition(cameraTransitioner.vPosition.to, true); - }; - const cam = (t)=>{ - (0, _glMatrix.quat).slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); - (0, _glMatrix.vec3).lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); - core.camera.setOrbit(cameraTransitioner.qRotation.current, false); - core.camera.setPosition(cameraTransitioner.vPosition.current, false); - // disable picking during transitions, as the performance degradation could reduce the framerate - core.inputManager.isPickingEnabled = false; - }; - core.updateCallback = (elapsedTime)=>{ - const { transitionDurations } = lastPresenterConfig; - if (positionTransitioner.isTransitioning) { - const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); - core.renderer.transitionTime = t; - setTransitionTimeAxesVisibility(transistion2dOnly, core); - } else core.inputManager.isPickingEnabled = true; - if (modelTransitioner.isTransitioning) { - const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); - if (modelTransitioner.shouldTransition) { - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); - core.setModelRotation(modelTransitioner.qRotation.current, false); - } - cam(tm); - } - if (cameraTransitioner.isTransitioning) { - const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); - cam(t); + qModelRotation2d: qModelRotation2d2, + qModelRotation3d: qModelRotation3d2, + qCameraRotation2d: qCameraRotation2d2, + qCameraRotation3d: qCameraRotation3d2, + vCameraPosition: vCameraPosition2 + }; + } + const cameraDefaults = createCameraDefaults(); + const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + function applyCameraCallbacks(ref2, lastPresenterConfig, lastView, transistion2dOnly) { + const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref2; + ref2.reset = () => { + core.reset(true); + if (lastView === "3d") { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = qCameraRotation3d; + cameraTransitioner.vPosition.to = vCameraPosition; + } else { + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = qCameraRotation2d; + cameraTransitioner.vPosition.to = vCameraPosition; + } + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); + core.setModelRotation(modelTransitioner.qRotation.current, true); + core.camera.setOrbit(cameraTransitioner.qRotation.to, true); + core.camera.setPosition(cameraTransitioner.vPosition.to, true); + }; + const cam = (t) => { + slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); + lerp$1(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); + core.camera.setOrbit(cameraTransitioner.qRotation.current, false); + core.camera.setPosition(cameraTransitioner.vPosition.current, false); + core.inputManager.isPickingEnabled = false; + }; + core.updateCallback = (elapsedTime) => { + const { transitionDurations } = lastPresenterConfig; + if (positionTransitioner.isTransitioning) { + const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); + core.renderer.transitionTime = t; + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } else { + core.inputManager.isPickingEnabled = true; + } + if (modelTransitioner.isTransitioning) { + const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); + if (modelTransitioner.shouldTransition) { + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); + core.setModelRotation(modelTransitioner.qRotation.current, false); } + cam(tm); + } + if (cameraTransitioner.isTransitioning) { + const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); + cam(t); + } }; -} -function setTransitionTimeAxesVisibility(transistion2dOnly, core) { + } + function setTransitionTimeAxesVisibility(transistion2dOnly, core) { const t = core.renderer.transitionTime; if (transistion2dOnly) { - if (t < 0.5) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + if (t < 0.5) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else { + core.renderer.axesVisibility = AxesVisibility.current; + } } else { - if (t <= 0.01) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else if (t >= 0.99) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - } -} - -},{"gl-matrix":"5x28d","morphcharts":"9s7CR","./defaults":"baEhk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dMNNU":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "init", ()=>init); -var _morphcharts = require("morphcharts"); -var _renderer = require("./renderer"); -var _canvas = require("./canvas"); -var _transition = require("../transition"); -function init(options, mcRendererOptions) { - const { container } = options; - const core = new (0, _morphcharts.Core)({ - container - }); - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - core.config.pickSelectDelay = 50; - const cameraTransitioner = new (0, _transition.CameraTransitioner)(); - const modelTransitioner = new (0, _transition.ModelTransitioner)(); - const positionTransitioner = new (0, _transition.Transitioner)(); - positionTransitioner.ended = ()=>{ - core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - }; - const ref = { - supportedRenders: { - advanced: (0, _renderer.rendererEnabled)(true), - basic: (0, _renderer.rendererEnabled)(false) - }, - reset: null, - cameraTransitioner, - modelTransitioner, - positionTransitioner, - core, - setMorphChartsRendererOptions (mcRendererOptions) { - if ((0, _renderer.shouldChangeRenderer)(ref.lastMorphChartsRendererOptions, mcRendererOptions)) { - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - } else if (mcRendererOptions.advanced) //same renderer, poke the config - (0, _renderer.setRendererOptions)(core.renderer, mcRendererOptions); - ref.lastMorphChartsRendererOptions = mcRendererOptions; - }, - lastMorphChartsRendererOptions: mcRendererOptions, - layerStagger: {} - }; - return ref; -} - -},{"morphcharts":"9s7CR","./renderer":"8SaPq","./canvas":"ckfEx","../transition":"78Jmh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8SaPq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shouldChangeRenderer", ()=>shouldChangeRenderer); -parcelHelpers.export(exports, "getRenderer", ()=>getRenderer); -parcelHelpers.export(exports, "setRendererOptions", ()=>setRendererOptions); -parcelHelpers.export(exports, "rendererEnabled", ()=>rendererEnabled); -var _morphcharts = require("morphcharts"); -function shouldChangeRenderer(prev, next) { - var _a, _b; - if (!prev || !next) return true; - if (prev.advanced !== next.advanced) return true; - if (!prev.advanced) return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); -} -function getRenderer(mcRendererOptions, core) { - const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); - core.renderer = r; - setRendererOptions(r, mcRendererOptions); - return r; -} -function setRendererOptions(renderer, mcRendererOptions) { - const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; - if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) for(const key in o)renderer.config[key] = o[key]; -} -function rendererEnabled(advanced) { - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(); - return r.isSupported; -} - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ckfEx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "listenCanvasEvents", ()=>listenCanvasEvents); -var _morphcharts = require("morphcharts"); -const rightButton = 2; -function listenCanvasEvents(core, options) { - const { container, pickGridCallback } = options; - const { inputManager } = core; - if (options.onLasso) inputManager.pickLassoCallback = (result)=>{ - options.onLasso(result.ids[0], result.manipulator.event); - }; - inputManager.singleTouchAction = (manipulator)=>{ - if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _morphcharts.SingleTouchAction).rotate; - else if (manipulator.altKey) return (0, _morphcharts.SingleTouchAction).lasso; - else return (0, _morphcharts.SingleTouchAction).translate; - }; - inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator })=>{ - clearClickTimeout(); - const { altKey, button, shiftKey } = manipulator; - const me = { - altKey, - shiftKey, - button - }; - const e = me; - pickGridCallback([ - divisionX, - divisionY, - divisionZ - ], e); - }; - const canvas = container.getElementsByTagName('canvas')[0]; - let pickedId; - const hover = (e)=>{ - if (core.renderer.pickedId !== pickedId) { - pickedId = core.renderer.pickedId; - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeHover(e, ordinal); - } - }; - canvas.addEventListener('mousemove', (e)=>{ - clearClickTimeout(); - if (mousedown) options.onCubeHover(e, null); - hover(e); - }); - canvas.addEventListener('mouseout', hover); - canvas.addEventListener('mouseover', hover); - let mousedown; - canvas.addEventListener('mousedown', ()=>{ - mousedown = true; - }); - canvas.addEventListener('mouseup', (e)=>{ - mousedown = false; - }); - let canvasClickTimeout; - const clearClickTimeout = ()=>{ - clearTimeout(canvasClickTimeout); - canvasClickTimeout = null; - }; - canvas.addEventListener('click', (e)=>{ - canvasClickTimeout = setTimeout(()=>{ - options.onCanvasClick(e); - }, 50); - }); - inputManager.pickItemCallback = ({ manipulator })=>{ - clearClickTimeout(); - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeClick(manipulator.event, ordinal); - }; -} - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"78Jmh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Transitioner", ()=>Transitioner); -parcelHelpers.export(exports, "CameraTransitioner", ()=>CameraTransitioner); -parcelHelpers.export(exports, "ModelTransitioner", ()=>ModelTransitioner); -var _glMatrix = require("gl-matrix"); -var _easing = require("./easing"); -class Transitioner { - constructor(){ - this.isTransitioning = false; - } - begin() { - this.isTransitioning = true; - this.time = 0; - } - elapse(elapsedTime, totalTime, ease = false) { - this.time += elapsedTime; - if (this.time >= totalTime) { - this.isTransitioning = false; - this.time = totalTime; - this.ended && this.ended(); - } - const t = this.time / totalTime; - return ease ? (0, _easing.easing)(t) : t; - } -} -class CameraTransitioner extends Transitioner { - constructor(){ - super(); - this.qRotation = { - from: (0, _glMatrix.quat).create(), - to: null, - current: (0, _glMatrix.quat).create() - }; - this.vPosition = { - from: (0, _glMatrix.vec3).create(), - to: null, - current: (0, _glMatrix.vec3).create() - }; + if (t <= 0.01) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else if (t >= 0.99) { + core.renderer.axesVisibility = AxesVisibility.current; + } else { + core.renderer.axesVisibility = AxesVisibility.none; + } } - move(position, rotation) { - this.begin(); - this.qRotation.to = rotation; - this.vPosition.to = position; - } -} -class ModelTransitioner extends Transitioner { - constructor(){ - super(); - this.shouldTransition = false; - this.qRotation = { - from: null, - to: null, - current: (0, _glMatrix.quat).create() - }; + } + function morphChartsRender(ref2, prevStage, stage, height2, width2, preStage, colors2, config) { + const { qCameraRotation2d: qCameraRotation2d2, qCameraRotation3d: qCameraRotation3d2, qModelRotation2d: qModelRotation2d2, qModelRotation3d: qModelRotation3d2, vCameraPosition: vCameraPosition2 } = cameraDefaults; + const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref2; + let transistion2dOnly = false; + let cameraTo; + let holdCamera; + if (config.camera === "hold") { + holdCamera = true; + } else { + cameraTo = config.camera; } -} - -},{"gl-matrix":"5x28d","./easing":"kLGAR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kLGAR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easing", ()=>easing); -var _d3Ease = require("d3-ease"); -function easing(t) { - if (t === 0 || t === 1) return t; - return (0, _d3Ease.easeCubicInOut)(t); -} - -},{"d3-ease":"ejK9C","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ejK9C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easeLinear", ()=>(0, _linearJs.linear)); -parcelHelpers.export(exports, "easeQuad", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeQuadIn", ()=>(0, _quadJs.quadIn)); -parcelHelpers.export(exports, "easeQuadOut", ()=>(0, _quadJs.quadOut)); -parcelHelpers.export(exports, "easeQuadInOut", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeCubic", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easeCubicIn", ()=>(0, _cubicJs.cubicIn)); -parcelHelpers.export(exports, "easeCubicOut", ()=>(0, _cubicJs.cubicOut)); -parcelHelpers.export(exports, "easeCubicInOut", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easePoly", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easePolyIn", ()=>(0, _polyJs.polyIn)); -parcelHelpers.export(exports, "easePolyOut", ()=>(0, _polyJs.polyOut)); -parcelHelpers.export(exports, "easePolyInOut", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easeSin", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeSinIn", ()=>(0, _sinJs.sinIn)); -parcelHelpers.export(exports, "easeSinOut", ()=>(0, _sinJs.sinOut)); -parcelHelpers.export(exports, "easeSinInOut", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeExp", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeExpIn", ()=>(0, _expJs.expIn)); -parcelHelpers.export(exports, "easeExpOut", ()=>(0, _expJs.expOut)); -parcelHelpers.export(exports, "easeExpInOut", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeCircle", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeCircleIn", ()=>(0, _circleJs.circleIn)); -parcelHelpers.export(exports, "easeCircleOut", ()=>(0, _circleJs.circleOut)); -parcelHelpers.export(exports, "easeCircleInOut", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeBounce", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceIn", ()=>(0, _bounceJs.bounceIn)); -parcelHelpers.export(exports, "easeBounceOut", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceInOut", ()=>(0, _bounceJs.bounceInOut)); -parcelHelpers.export(exports, "easeBack", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeBackIn", ()=>(0, _backJs.backIn)); -parcelHelpers.export(exports, "easeBackOut", ()=>(0, _backJs.backOut)); -parcelHelpers.export(exports, "easeBackInOut", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeElastic", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticIn", ()=>(0, _elasticJs.elasticIn)); -parcelHelpers.export(exports, "easeElasticOut", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticInOut", ()=>(0, _elasticJs.elasticInOut)); -var _linearJs = require("./linear.js"); -var _quadJs = require("./quad.js"); -var _cubicJs = require("./cubic.js"); -var _polyJs = require("./poly.js"); -var _sinJs = require("./sin.js"); -var _expJs = require("./exp.js"); -var _circleJs = require("./circle.js"); -var _bounceJs = require("./bounce.js"); -var _backJs = require("./back.js"); -var _elasticJs = require("./elastic.js"); - -},{"./linear.js":false,"./quad.js":false,"./cubic.js":"9VY6p","./poly.js":false,"./sin.js":false,"./exp.js":false,"./circle.js":false,"./bounce.js":false,"./back.js":false,"./elastic.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VY6p":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubicIn", ()=>cubicIn); -parcelHelpers.export(exports, "cubicOut", ()=>cubicOut); -parcelHelpers.export(exports, "cubicInOut", ()=>cubicInOut); -function cubicIn(t) { - return t * t * t; -} -function cubicOut(t) { - return --t * t * t + 1; -} -function cubicInOut(t) { - return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3abZO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ViewGl", ()=>ViewGl); -var _base = require("../base"); -var _defaults = require("../defaults"); -var _presenter = require("../presenter"); -var _enums = require("../enums"); -var _rendererGl = require("./rendererGl"); -let registered = false; -//dynamic superclass lets us create a subclass at execution phase instead of declaration phase. -//This allows us to retrieve vega.View from either UMD or ES6 consumers of this class. -//pass in the SuperClass, which should be a vega.View -function _ViewGl(runtime, config) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class ViewGlInternal extends (0, _base.base).vega.View { - constructor(runtime, config = {}){ - super(runtime, config); - this.config = config; - this.presenter = config.presenter; - config.presenterConfig = config.presenterConfig || {}; - config.presenterConfig.redraw = ()=>{ - this._redraw = true; //use Vega View private member _redraw - this.run(); - }; - } - renderer(...args) { - if (args && args.length) { - const renderer = args[0]; - if (renderer === 'morphcharts' && !registered) { - (0, _base.base).vega.renderModule('morphcharts', { - handler: (0, _base.base).vega.CanvasHandler, - renderer: (0, _rendererGl.RendererGl) - }); - registered = true; - } - return super.renderer(renderer); - } else return super.renderer(); - } - initialize(el) { - if (!this.presenter) this.presenter = new (0, _presenter.Presenter)(el); - super.initialize(this.presenter.getElement((0, _enums.PresenterElement).vegaControls)); - const renderer = this._renderer; - renderer.presenterConfig = this.config.presenterConfig; - renderer.presenter = this.presenter; - renderer.getView = this.config && this.config.getView || (()=>this.presenter.view || (0, _defaults.defaultView)); - return this; - } - error(e) { - if (this.presenter.logger) this.presenter.logger(e); - } + if (prevStage && prevStage.view !== stage.view) { + modelTransitioner.shouldTransition = !holdCamera; + if (stage.view === "2d") { + modelTransitioner.qRotation.from = qModelRotation3d2; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.from = qModelRotation2d2; + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } + } else { + modelTransitioner.shouldTransition = false; + if (stage.view === "2d") { + transistion2dOnly = true; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } } - const instance = new ViewGlInternal(runtime, config); - return instance; -} -const ViewGl = _ViewGl; - -},{"../base":"hIePf","../defaults":"4Q1zd","../presenter":"9yYY0","../enums":"hnVHt","./rendererGl":"cfqe0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cfqe0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererGl", ()=>RendererGl); -var _base = require("../base"); -//pass in the SuperClass, which should be a vega.View -function _RendererGl(loader) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class RendererGlInternal extends (0, _base.base).vega.Renderer { - initialize(el, width, height, origin) { - this.height = height; - this.width = width; - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin); - } - resize(width, height, origin) { - super.resize(width, height, origin); - this.origin = origin; - this.height = height; - this.width = width; - //rteturn this for vega - return this; - } - _render(scene, items) { - const scene3d = scene; - scene3d.view = this.getView(); - this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); - //return this for vega - return this; - } - } - const instance = new RendererGlInternal(loader); - return instance; -} -const RendererGl = _RendererGl; - -},{"../base":"hIePf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eMVZG":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '1.0.6'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iDNR0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "colorSchemes", ()=>colorSchemes); -parcelHelpers.export(exports, "registerColorSchemes", ()=>registerColorSchemes); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _defaults = require("./defaults"); -const dualPairs = [ - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).gray - ], - [ - (0, _defaults.dualColorSchemeColors).red, - (0, _defaults.dualColorSchemeColors).green - ], - [ - (0, _defaults.dualColorSchemeColors).red, - (0, _defaults.dualColorSchemeColors).blue - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).red - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).orange - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).green - ] -]; -const colorSchemes = [ - { - scheme: (0, _sanddanceSpecs.ColorScaleNone), - colors: [ - (0, _defaults.defaultViewerOptions).colors.defaultCube - ] + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + if (!prevStage) { + core.setModelRotation(modelTransitioner.qRotation.to, false); + core.camera.setOrbit(cameraTransitioner.qRotation.to, false); + core.camera.setPosition(cameraTransitioner.vPosition.to, false); + } else if (!holdCamera) { + cameraTransitioner.begin(); } -]; -createDualColorSchemes(); -function registerColorSchemes(vega) { - colorSchemes.forEach((cs)=>{ - if (cs.colors.length === 1) vega.scheme(cs.scheme, (x)=>cs.colors[0]); - else vega.scheme(cs.scheme, cs.colors); - }); -} -function createPair(names, colors) { - const scheme = `dual_${names[0]}${names[1]}`; - colorSchemes.push({ - scheme, - colors - }); -} -function createDualColorSchemes() { - dualPairs.forEach((colors)=>{ - const names = colors.map((color)=>{ - for(const key in 0, _defaults.dualColorSchemeColors)if (color === (0, _defaults.dualColorSchemeColors)[key]) return key; - }); - createPair(names, colors); - createPair([ - ...names - ].reverse(), [ - ...colors - ].reverse()); - }); -} - -},{"@msrvida/sanddance-specs":"aOvSr","./defaults":"7bMd0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9IMa3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Component to view a SandDance data visualization. - */ parcelHelpers.export(exports, "Viewer", ()=>Viewer); -var _animator = require("./animator"); -var _axisSelection = require("./axisSelection"); -var _colorCubes = require("./colorCubes"); -var _colorSchemes = require("./colorSchemes"); -var _constants = require("./constants"); -var _dataScope = require("./dataScope"); -var _defaults = require("./defaults"); -var _details = require("./details"); -var _headers = require("./headers"); -var _legend = require("./legend"); -var _ordinal = require("./ordinal"); -var _search = require("./search"); -var _signals = require("./signals"); -var _tooltip = require("./tooltip"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _searchExpression = require("@msrvida/search-expression"); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _characterSet = require("./characterSet"); -var _transition = require("./transition"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + positionTransitioner.begin(); + if (modelTransitioner.shouldTransition) { + modelTransitioner.begin(); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + const props = { ref: ref2, stage, height: height2, config }; + const cubeLayer = createCubeLayer(props); + const lineLayer = createLineLayer(props); + const textLayer = createTextLayer(props); + const { backgroundImages } = stage; + let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); + backgroundImages === null || backgroundImages === void 0 ? void 0 : backgroundImages.forEach((backgroundImage) => { + contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); }); -}; -const { defaultView } = _vegaMorphcharts.defaults; -const zAxisZindex = 1010; -let didRegisterColorSchemes = false; -class Viewer { - /** - * Instantiate a new Viewer. - * @param element Parent HTMLElement to present within. - * @param options Optional viewer options object. - */ constructor(element, options){ - this.element = element; - this.options = _vegaMorphcharts.util.deepMerge((0, _defaults.defaultViewerOptions), options); - this.presenter = new _vegaMorphcharts.Presenter(element, (0, _defaults.getPresenterStyle)(this.options)); - //this.presenter.logger = console.log; - this._characterSet = new (0, _characterSet.CharacterSet)(); - this._dataScope = new (0, _dataScope.DataScope)(); - this._animator = new (0, _animator.Animator)(this._dataScope, { - onDataChanged: this.onDataChanged.bind(this), - onAnimateDataChange: this.onAnimateDataChange.bind(this) - }); - this._details = new (0, _details.Details)(this.presenter.getElement(_vegaMorphcharts.PresenterElement.panel), this.options.language, this._animator, this._dataScope, (remap)=>{ - this.currentColorContext = ~~remap; - this.renderSameLayout(); - }, ()=>this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); - this.insight = {}; - } - changeColorContexts(colorContexts) { - this.colorContexts = colorContexts; - this.currentColorContext = 0; - this.options.onColorContextChange && this.options.onColorContextChange(); - } - applyLegendColorContext(colorContext) { - const a = _vegaMorphcharts.util.getActiveElementInfo(); - _vegaMorphcharts.util.mount(colorContext.legendElement, this.presenter.getElement(_vegaMorphcharts.PresenterElement.legend)); - _vegaMorphcharts.util.setActiveElement(a); - this.presenter.stage.legend = colorContext.legend; - } - onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time) { - var _a; - if (time === undefined) { - const transitionDurations = ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) || _vegaMorphcharts.defaults.defaultPresenterConfig.transitionDurations; - time = transitionDurations.position + transitionDurations.stagger; - } - return new Promise((resolve, reject)=>{ - let innerPromise; - if (dataChange === (0, _animator.DataLayoutChange).refine) { - const oldColorContext = this.colorContexts[this.currentColorContext]; - innerPromise = new Promise((innerResolve)=>{ - this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, cubeLayer)=>{ - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - cubeLayer.unitColorMap = oldColorContext.colorMap; - if (this.options.onStage) this.options.onStage(stage); - } - })).then(()=>{ - //apply old legend - this.applyLegendColorContext(oldColorContext); - innerResolve(); - }); - }); - } else innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, colorMapper)=>{ - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - if (this.options.onStage) this.options.onStage(stage); - } - })); - innerPromise.then(()=>{ - this.presenter.animationQueue(resolve, time, { - waitingLabel, - handlerLabel, - animationCanceled: reject - }); - }); - }); - } - onDataChanged(dataLayout, filter) { - return __awaiter(this, void 0, void 0, function*() { - switch(dataLayout){ - case (0, _animator.DataLayoutChange).same: - { - const hasSelectedData = this._dataScope.hasSelectedData(); - const hasActive = !!this._dataScope.active; - if (hasSelectedData || hasActive) this.presenter.morphChartsRenderResult.update({ - cubes: this.convertSearchToSet() - }); - else this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - break; - } - case (0, _animator.DataLayoutChange).refine: - { - //save cube colors - const oldColorContext = this.colorContexts[this.currentColorContext]; - let colorMap; - this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, cubeLayer)=>{ - //save off the spec colors - colorMap = cubeLayer.unitColorMap; - cubeLayer.unitColorMap = oldColorContext.colorMap; - this.preStage(stage, cubeLayer); - }, - onPresent: ()=>{ - //save new legend - const newColorContext = { - colorMap, - legend: _vegaMorphcharts.util.clone(this.presenter.stage.legend), - legendElement: this.presenter.getElement(_vegaMorphcharts.PresenterElement.legend).children[0] - }; - //apply old legend - this.applyLegendColorContext(oldColorContext); - this.changeColorContexts([ - oldColorContext, - newColorContext - ]); - this.onPresent(); - } - })); - //narrow the filter only if it is different - if (!_searchExpression.compare(this.insight.filter, filter)) this.insight.filter = _searchExpression.narrow(this.insight.filter, filter); - if (this.options.onDataFilter) this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); - break; - } - case (0, _animator.DataLayoutChange).reset: - { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - this.changeColorContexts([ - colorContext - ]); - this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - onPresent: ()=>{ - //color needs to change instantly - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.onPresent(); - } - })); - delete this.insight.filter; - if (this.options.onDataFilter) this.options.onDataFilter(null, null); - break; - } - } - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); - } - }); - } - convertSearchToSet() { - if (this._dataScope.selection) { - const s = new Set(); - let found = false; - this._dataScope.selection.included.forEach((o, i)=>{ - s.add(o[0, _constants.GL_ORDINAL]); - found = true; - }); - if (!found) s.add(-1); - return s; - } - } - convertSetToSearch(s) { - const search = { - expressions: [] - }; - s.forEach((value)=>{ - search.expressions.push({ - name: (0, _constants.GL_ORDINAL), - operator: '==', - value, - clause: '||' - }); - }); - return search; - } - getSpecColumnsWithFilteredStats() { - if (!this._dataScope.hasFilteredData()) return this._specColumns; - const roles = [ - 'color', - 'facet', - 'group', - 'size', - 'sort', - 'sum', - 'x', - 'y', - 'z' - ]; - const specColumns = Object.assign({}, this._specColumns); - roles.forEach((r)=>{ - if (specColumns[r]) { - const column = Object.assign({}, specColumns[r]); - column.stats = this.getColumnStats(column); - specColumns[r] = column; - } - }); - return specColumns; - } - renderNewLayout(signalValues, presenterConfig, view) { - return __awaiter(this, void 0, void 0, function*() { - const currData = this._dataScope.currentData(); - const context = { - specColumns: this.getSpecColumnsWithFilteredStats(), - insight: this.insight, - specViewOptions: Object.assign(Object.assign({}, this.options), { - zAxisOptions: { - showZAxis: true, - zIndex: zAxisZindex - }, - collapseFacetAxes: true - }) - }; - const specResult = (0, _sanddanceSpecs.build)(context, currData); - if (!specResult.errors) { - const uiValues = (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec); - (0, _signals.applySignalValues)(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); - (0, _signals.unbindSignalUI)(specResult.vegaSpec); - this.vegaSpec = specResult.vegaSpec; - this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); - this.specCapabilities = specResult.specCapabilities; - const config = this.createConfig(presenterConfig); - this._lastPresenterConfig = config.presenterConfig; - if (view) config.getView = ()=>view; - if (!didRegisterColorSchemes) { - (0, _colorSchemes.registerColorSchemes)(_vegaMorphcharts.base.vega); - didRegisterColorSchemes = true; - } - try { - if (this.vegaViewGl) this.vegaViewGl.finalize(); - const runtime = _vegaMorphcharts.base.vega.parse(this.vegaSpec); - this.vegaViewGl = new _vegaMorphcharts.ViewGl(runtime, config).renderer('morphcharts').initialize(this.element); - yield this.vegaViewGl.runAsync(); - const handler = (n, v)=>{ - this._characterSet.resetCharacterSet(true); - }; - this.vegaSpec.signals.forEach((s)=>{ - this.vegaViewGl.addSignalListener(s.name, handler); - }); - //capture new color color contexts via signals - this.configForSignalCapture(config.presenterConfig); - } catch (e) { - specResult.errors = [ - e.message - ]; - } - if (!specResult.errors) (0, _headers.ensureHeaders)(this.presenter, this.options.language.headers); - } - if (specResult.errors) { - if (this.options.onError) this.options.onError(specResult.errors); - else if (this.presenter.logger) this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join('\n')}`); - } - return specResult; - }); - } - /** - * Render the same layout with new options. - * @param newViewerOptions New options object. - */ renderSameLayout(newViewerOptions) { - const colorContext = this.colorContexts[this.currentColorContext]; - this.applyLegendColorContext(colorContext); - if (newViewerOptions) { - if (newViewerOptions.colors) { - //set theme colors PresenterConfig - const mcColors = this.getMorphChartsColors(); - this.presenter.configColors(mcColors); - this._lastPresenterConfig.morphChartsColors = mcColors; - } - this.options = _vegaMorphcharts.util.deepMerge(this.options, newViewerOptions); - } - this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; - this.presenter.morphChartsRenderResult.update({ - cubes: this.convertSearchToSet() - }); - } - getView(view) { - if (view === undefined) { - if (this.presenter.view === null) return defaultView; - else return this.presenter.view; - } else return view; - } - transformData(values, transform) { - try { - const runtime = _vegaMorphcharts.base.vega.parse({ - $schema: 'https://vega.github.io/schema/vega/v4.json', - data: [ - { - name: 'source', - values, - transform - } - ] - }); - new _vegaMorphcharts.ViewGl(runtime).run(); - } catch (e) { - // continue regardless of error - } - return values; - } - /** - * Render data into a visualization. - * @param insightSetup InsightSetup object to create a visualization rendering. - * @param data Array of data objects. - * @param renderOptions Optional RenderOptions object. - */ render(insightSetup_1, data_1) { - return __awaiter(this, arguments, void 0, function*(insightSetup, data, renderOptions = {}) { - const { insight, setup } = insightSetup; - let result; - //see if refine expression has changed - if (!_searchExpression.compare(insight.filter, this.insight.filter)) { - const transitionDurations = (setup === null || setup === void 0 ? void 0 : setup.transitionDurations) || _vegaMorphcharts.defaults.defaultPresenterConfig.transitionDurations; - const renderTime = transitionDurations.position + transitionDurations.stagger; - const allowAsyncRenderTime = renderTime + this.options.filterRenderingTimerPadding; - if (insight.filter) { - //refining - result = yield this._render(insightSetup, data, renderOptions, true); - this.presenter.animationQueue(()=>{ - this.filter(insight.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); - }, allowAsyncRenderTime, { - waitingLabel: 'layout before refine', - handlerLabel: 'refine after layout' - }); - } else { - //not refining - this._dataScope.setFilteredData(null); - result = yield this._render(insightSetup, data, renderOptions, true); - this.presenter.animationQueue(()=>{ - this.reset(); - }, allowAsyncRenderTime, { - waitingLabel: 'layout before reset', - handlerLabel: 'reset after layout' - }); - } - } else result = yield this._render(insightSetup, data, renderOptions, false); - return result; - }); - } - shouldViewstateTransition(newInsight, oldInsight) { - if (!oldInsight.columns) return false; - if (oldInsight.chart !== newInsight.chart) return true; - if (oldInsight.size.height !== newInsight.size.height) return true; - if (oldInsight.size.width !== newInsight.size.width) return true; - if (oldInsight.columns.facet !== newInsight.columns.facet) return true; - return false; - } - configForSignalCapture(presenterConfig) { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - //now be ready to capture color changing signals - presenterConfig.preStage = (stage, cubeLayer)=>{ - if (this._shouldSaveColorContext()) //save off the colors from Vega layout - colorContext.colorMap = cubeLayer.unitColorMap; - this.preStage(stage, cubeLayer); - }; - presenterConfig.onPresent = ()=>{ - if (this._shouldSaveColorContext()) { - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.changeColorContexts([ - colorContext - ]); - this._dataScope.deselect(); - } - this.onPresent(); - }; - } - onPresent() { - var _a; - if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transition) (0, _transition.assignTransitionStagger)(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); - this.options.onPresent && this.options.onPresent(); - } - _render(insightSetup, data, renderOptions, forceNewCharacterSet) { - return __awaiter(this, void 0, void 0, function*() { - const { insight, setup } = insightSetup; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (this._dataScope.setData(data, renderOptions.columns)) //apply transform to the data - this.transformData(data, insight.transform); - this._specColumns = (0, _sanddanceSpecs.getSpecColumns)(insight, this._dataScope.getColumns(renderOptions.columnTypes)); - const ordinalMap = (0, _ordinal.assignOrdinals)(this._specColumns, data, renderOptions.ordinalMap); - this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight); - this.insight = _vegaMorphcharts.util.clone(insight); - this.setup = setup; - this._shouldSaveColorContext = ()=>!renderOptions.initialColorContext; - const colorContext = renderOptions.initialColorContext || { - colorMap: null, - legend: null, - legendElement: null - }; - const specResult = yield this.renderNewLayout(insight.signalValues, Object.assign(Object.assign({}, setup || {}), { - preStage: (stage, cubeLayer)=>{ - if (this._shouldSaveColorContext()) //save off the colors from Vega layout - colorContext.colorMap = cubeLayer.unitColorMap; - else //apply passed colorContext - cubeLayer.unitColorMap = colorContext.colorMap; - //if items are selected, repaint - const hasSelectedData = !!this._dataScope.hasSelectedData(); - //const hasActive = !!this._dataScope.active; - hasSelectedData || this._dataScope.active; - this.preStage(stage, cubeLayer); - }, - onPresent: ()=>{ - if (this._shouldSaveColorContext()) { - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.changeColorContexts([ - colorContext - ]); - } else //apply passed colorContext - this.applyLegendColorContext(colorContext); - this.onPresent(); - }, - shouldViewstateTransition: ()=>this.shouldViewstateTransition(insight, this.insight) - }), this.getView(insight.view)); - //future signal changes should save the color context - this._shouldSaveColorContext = ()=>!renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); - this._details.render(); - const result = { - ordinalMap, - specResult - }; - return result; - }); - } - overrideAxisLabels(stage) { - // if (this._specColumns.x && this._specColumns.x.type === 'date') { - // stage.axes.x.forEach(axis => makeDateRange( - // axis.tickText, - // this.getColumnStats(this._specColumns.x) - // )); - // } - // if (this._specColumns.y && this._specColumns.y.type === 'date') { - // stage.axes.y.forEach(axis => makeDateRange( - // axis.tickText, - // this.getColumnStats(this._specColumns.y) - // )); - // } - } - preLayer(stage) { - //convert ticks - let axisRole; - for(axisRole in stage.axes){ - const capability = this.specCapabilities.roles.filter((r)=>r.role === axisRole)[0]; - if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === 'exact')) (0, _axisSelection.moveTicksBetween)(stage.axes[axisRole]); - } + props.bounds = contentBounds; + core.renderer.previousAxes = core.renderer.currentAxes; + const axesLayer = createAxesLayer(props); + core.config.transitionStaggering = config.transitionDurations.stagger; + core.config.transitionDuration = config.transitionDurations.position; + let bounds2; + if (axesLayer && axesLayer.bounds) { + bounds2 = axesLayer.bounds; + } else { + bounds2 = contentBounds; } - preStage(stage, cubeLayer) { - this.overrideAxisLabels(stage); - this._axisSelection = new (0, _axisSelection.AxisSelection)(this.specCapabilities, this._specColumns, stage); - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - if (this.options.onStage) this.options.onStage(stage); + ref2.setMorphChartsRendererOptions(config.renderer); + if (preStage) { + preStage(stage, cubeLayer); } - onCubeClick(e, cube) { - this.options.onCubeClick && this.options.onCubeClick(e, cube); - const hasSelectedData = this._dataScope.hasSelectedData(); - if (hasSelectedData && this._dataScope.selection.included.length > 1) { - //if active is within selection, keep the selection and activate the one. - const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); - if (indexWithinSelection.index >= 0) { - this.activate(indexWithinSelection.datum); - this._details.populate(this._dataScope.selection, indexWithinSelection.index); - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); - } - return; - } - } - if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][0, _constants.GL_ORDINAL] === cube.ordinal) { - this.deselect(); - return; + core.renderer.images = []; + if (backgroundImages) { + const addImage = (imageBounds, imageData) => { + const imageWidth2 = imageBounds.maxBoundsX - imageBounds.minBoundsX; + const imageHeight2 = imageBounds.maxBoundsY - imageBounds.minBoundsY; + const position2 = [imageBounds.minBoundsX + imageWidth2 / 2, imageBounds.minBoundsY + imageHeight2 / 2, 0]; + const imageQuad = createImageQuad(core, imageData, contentBounds, position2, imageWidth2, imageHeight2); + const imageVisual = core.renderer.createImageVisual(imageQuad); + core.renderer.images.push(imageVisual); + }; + const imageDataCache = {}; + backgroundImages.forEach((backgroundImage) => { + const imageBounds = convertBounds(backgroundImage.bounds); + const imageData = imageDataCache[backgroundImage.url]; + if (imageData) { + addImage(imageBounds, imageData); + } else { + getImageData(backgroundImage.url).then((imageData2) => { + imageDataCache[backgroundImage.url] = imageData2; + addImage(imageBounds, imageData2); + }); } - const search = { - name: (0, _constants.GL_ORDINAL), - operator: '==', - value: cube.ordinal - }; - this.select(search); + }); } - onCubeHover(event, cube) { - var _a, _b; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (!cube) return; - const currentData = this._dataScope.currentData(); - const index = (0, _ordinal.getDataIndexOfCube)(cube, currentData); - if (index >= 0) { - const dataItem = (0, _tooltip.cleanDataItem)(((_a = this.options.tooltipOptions) === null || _a === void 0 ? void 0 : _a.prepareDataItem(currentData[index])) || currentData[index]); - const tooltipCreateOptions = { - dataItem, - event - }; - if ((_b = this.options.tooltipOptions) === null || _b === void 0 ? void 0 : _b.create) this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); - else this._tooltip = new (0, _tooltip.Tooltip)(Object.assign(Object.assign({}, tooltipCreateOptions), { - cssPrefix: this.presenter.style.cssPrefix - })); + layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds2, ref2.layerStagger); + applyCameraCallbacks(ref2, config, stage.view, transistion2dOnly); + core.renderer.transitionTime = 0; + colorConfig(ref2, colors2); + return { + bounds: bounds2, + getCubeLayer: () => cubeLayer, + update: (layerSelection) => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, ref2.layerStagger), + activate: (id2) => core.renderer.transitionBuffers[0].activeId = id2, + moveCamera: (camera) => { + if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + cameraTransitioner.move(camera.position, camera.rotation); } + }, + setTransitionTimeAxesVisibility: () => { + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } + }; + } + function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, layerStagger) { + const layerItems = [ + { + layer: cubeLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes + }, + { + layer: lineLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines + }, + { + layer: textLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts + } + ]; + layerItems.forEach((layerItem) => { + var _a2; + return (_a2 = layerItem.layer) === null || _a2 === void 0 ? void 0 : _a2.update(bounds2, layerItem.selection, layerItem.stagger); + }); + } + function convertBounds(bounds2) { + if (!bounds2) + return; + return { + minBoundsX: bounds2.x1, + maxBoundsX: bounds2.x2, + minBoundsY: -bounds2.y2, + maxBoundsY: -bounds2.y1, + minBoundsZ: minZ, + maxBoundsZ: minZ + }; + } + function shouldChangeRenderer(prev, next) { + var _a2, _b2; + if (!prev || !next) + return true; + if (prev.advanced !== next.advanced) + return true; + if (!prev.advanced) { + return ((_a2 = prev.basicOptions) === null || _a2 === void 0 ? void 0 : _a2.antialias) != ((_b2 = next.basicOptions) === null || _b2 === void 0 ? void 0 : _b2.antialias); } - onTextHover(e, t) { - //return true if highlight color is different - if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) return false; - return !_vegaMorphcharts.util.colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); + } + function getRenderer(mcRendererOptions, core) { + const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; + const r = advanced ? new Main() : new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); + core.renderer = r; + setRendererOptions(r, mcRendererOptions); + return r; + } + function setRendererOptions(renderer, mcRendererOptions) { + const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; + if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) { + for (const key2 in o) { + renderer.config[key2] = o[key2]; + } } - getMorphChartsColors() { - const { colors } = this.options; - return { - activeItemColor: colors.activeCube, - axesGridBackgroundColor: colors.backgroundColor, - axesGridHighlightColor: colors.axisSelectHighlight, - axesGridMajorColor: colors.gridLine, - axesGridMinorColor: colors.gridLine, - axesGridZeroColor: colors.gridLine, - axesTextHeadingColor: colors.axisText, - axesTextLabelColor: colors.axisText, - axesTextTitleColor: colors.axisText, - backgroundColor: colors.backgroundColor, - textBorderColor: colors.backgroundColor, - textColor: colors.axisText - }; + } + function rendererEnabled(advanced) { + const r = advanced ? new Main() : new Main$1(); + return r.isSupported; + } + const rightButton = 2; + function listenCanvasEvents(core, options2) { + const { container, pickGridCallback } = options2; + const { inputManager } = core; + if (options2.onLasso) { + inputManager.pickLassoCallback = (result) => { + options2.onLasso(result.ids[0], result.manipulator.event); + }; + } + inputManager.singleTouchAction = (manipulator) => { + if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.rotate; + } else if (manipulator.altKey) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.translate; + } + }; + inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { + clearClickTimeout(); + const { altKey, button, shiftKey } = manipulator; + const me = { altKey, shiftKey, button }; + const e = me; + pickGridCallback([divisionX, divisionY, divisionZ], e); + }; + const canvas = container.getElementsByTagName("canvas")[0]; + let pickedId; + const hover2 = (e) => { + if (core.renderer.pickedId !== pickedId) { + pickedId = core.renderer.pickedId; + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options2.onCubeHover(e, ordinal2); + } + }; + canvas.addEventListener("mousemove", (e) => { + clearClickTimeout(); + if (mousedown) { + options2.onCubeHover(e, null); + } + hover2(e); + }); + canvas.addEventListener("mouseout", hover2); + canvas.addEventListener("mouseover", hover2); + let mousedown; + canvas.addEventListener("mousedown", () => { + mousedown = true; + }); + canvas.addEventListener("mouseup", (e) => { + mousedown = false; + }); + let canvasClickTimeout; + const clearClickTimeout = () => { + clearTimeout(canvasClickTimeout); + canvasClickTimeout = null; + }; + canvas.addEventListener("click", (e) => { + canvasClickTimeout = setTimeout(() => { + options2.onCanvasClick(e); + }, 50); + }); + inputManager.pickItemCallback = ({ manipulator }) => { + clearClickTimeout(); + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options2.onCubeClick(manipulator.event, ordinal2); + }; + } + function cubicInOut(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; + } + function easing(t) { + if (t === 0 || t === 1) + return t; + return cubicInOut(t); + } + class Transitioner { + constructor() { + this.isTransitioning = false; } - createConfig(c) { - var _a; - const { getTextColor, getTextHighlightColor, onTextClick } = this.options; - const defaultPresenterConfig = { - morphChartsColors: this.getMorphChartsColors(), - zAxisZindex, - getCharacterSet: (stage)=>this._characterSet.getCharacterSet(stage), - getTextColor, - getTextHighlightColor, - onTextClick: (e, t)=>{ - if (t.metaData && t.metaData.search) { - //used by facets to select the facet - const search = (0, _search.getSearchGroupFromVegaValue)(t.metaData.search); - if (this.options.onAxisClick) this.options.onAxisClick(e, search); - else this.select(search); - } - if (onTextClick) onTextClick(e, t); - }, - onCubeClick: this.onCubeClick.bind(this), - onCubeHover: this.onCubeHover.bind(this), - onTextHover: this.onTextHover.bind(this), - preLayer: this.preLayer.bind(this), - preStage: this.preStage.bind(this), - onPresent: this.onPresent.bind(this), - onAxisConfig: (cartesian, dim3d, axis)=>{ - if (!axis) return; - const role = this.specCapabilities.roles.filter((r)=>r.role === axis.axisRole)[0]; - if (role === null || role === void 0 ? void 0 : role.axisSelection) { - cartesian.isDivisionPickingEnabled[dim3d] = true; - cartesian.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; - cartesian.isLabelPickingEnabled[dim3d] = true; - cartesian.isTitlePickingEnabled[dim3d] = true; - cartesian.isHeadingPickingEnabled[dim3d] = true; - cartesian.isGridPickingEnabled = false; - } - }, - onAxesComplete: (cartesian)=>{}, - axisPickGridCallback: (divisions, e)=>{ - const search = this._axisSelection.convert(divisions); - if (this.options.onAxisClick) this.options.onAxisClick(e, search); //TODO change onAxisClick to accept Search - else this.select(search); - }, - onLayerClick: (e)=>{ - this.options.onCanvasClick && this.options.onCanvasClick(e); - this.deselect(); - }, - onLegendClick: (e, legend, clickedIndex)=>{ - const legendRow = clickedIndex !== null && legend.rows[clickedIndex]; - if (legendRow) { - if (this.options.onLegendRowClick) this.options.onLegendRowClick(e, legendRow); - else this.select(legendRow.search); - } else if (this.options.onLegendHeaderClick) //header clicked - this.options.onLegendHeaderClick(e); - }, - onSceneRectAssignCubeOrdinal: (datum)=>{ - //TODO see if datum is a facet selection rect - return datum[0, _constants.GL_ORDINAL]; - }, - onTargetViewState: (h, w)=>{ - const { height, width } = this.insight.size; - let newViewStateTarget; - if (this.options.onNewViewStateTarget) newViewStateTarget = this.options.onNewViewStateTarget(); - return { - height, - width, - newViewStateTarget - }; - }, - layerSelection: { - cubes: this.convertSearchToSet() - }, - preserveDrawingBuffer: this.options.preserveDrawingBuffer - }; - if (!this.options.disableLasso) defaultPresenterConfig.onLasso = (ids, e)=>{ - this.deselect(); - const search = this.convertSetToSearch(ids); - this.select(search); - }; - if (this.options.onBeforeCreateLayers) defaultPresenterConfig.preLayer = (stage)=>{ - this.preLayer(stage); - this.options.onBeforeCreateLayers(stage, this.specCapabilities); - }; - const config = { - presenter: this.presenter, - presenterConfig: Object.assign(defaultPresenterConfig, c) - }; - if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) config.presenterConfig.transitionDurations = this.setup.transitionDurations; - return config; + begin() { + this.isTransitioning = true; + this.time = 0; } - /** - * Filter the data and animate. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. - */ filter(search, rebase = false) { - const u = this._dataScope.createUserSelection(search, false, rebase); - return new Promise((resolve, reject)=>{ - this._animator.filter(search, u.included, u.excluded, rebase).then(()=>{ - this._details.clear(); - this._details.clearSelection(); - this._details.populate(this._dataScope.selection); - resolve(); - }); - }); + elapse(elapsedTime, totalTime, ease = false) { + this.time += elapsedTime; + if (this.time >= totalTime) { + this.isTransitioning = false; + this.time = totalTime; + this.ended && this.ended(); + } + const t = this.time / totalTime; + return ease ? easing(t) : t; } - /** - * Remove any filtration and animate. - */ reset() { - return new Promise((resolve, reject)=>{ - this._animator.reset().then(()=>{ - this._details.clear(); - this._details.clearSelection(); - resolve(); - }); - }); + } + class CameraTransitioner extends Transitioner { + constructor() { + super(); + this.qRotation = { + from: create$4(), + to: null, + current: create$4() + }; + this.vPosition = { + from: create$6(), + to: null, + current: create$6() + }; + } + move(position2, rotation2) { + this.begin(); + this.qRotation.to = rotation2; + this.vPosition.to = position2; } - /** - * Select cubes by a filter expression. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - */ select(search) { - return new Promise((resolve, reject)=>{ - this._animator.select(search).then(()=>{ - this._details.populate(this._dataScope.selection); - resolve(); - }); - }); + } + class ModelTransitioner extends Transitioner { + constructor() { + super(); + this.shouldTransition = false; + this.qRotation = { + from: null, + to: null, + current: create$4() + }; } + } + function init$1(options2, mcRendererOptions) { + const { container } = options2; + const core = new Core({ container }); + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options2); + core.config.pickSelectDelay = 50; + const cameraTransitioner = new CameraTransitioner(); + const modelTransitioner = new ModelTransitioner(); + const positionTransitioner = new Transitioner(); + positionTransitioner.ended = () => { + core.renderer.axesVisibility = AxesVisibility.current; + }; + const ref2 = { + supportedRenders: { + advanced: rendererEnabled(true), + basic: rendererEnabled(false) + }, + reset: null, + cameraTransitioner, + modelTransitioner, + positionTransitioner, + core, + setMorphChartsRendererOptions(mcRendererOptions2) { + if (shouldChangeRenderer(ref2.lastMorphChartsRendererOptions, mcRendererOptions2)) { + getRenderer(mcRendererOptions2, core); + listenCanvasEvents(core, options2); + } else { + if (mcRendererOptions2.advanced) { + setRendererOptions(core.renderer, mcRendererOptions2); + } + } + ref2.lastMorphChartsRendererOptions = mcRendererOptions2; + }, + lastMorphChartsRendererOptions: mcRendererOptions, + layerStagger: {} + }; + return ref2; + } + class Presenter { /** - * Removes any selection. - */ deselect() { - return new Promise((resolve, reject)=>{ - this._animator.deselect().then(()=>{ - this._details.clearSelection(); - resolve(); - }); - }); + * Get the previously rendered Stage object. + */ + get stage() { + return this._last.stage; } /** - * Gets the current selection. - */ getSelection() { - if (!this._dataScope) return null; - const selectionState = { - search: this._dataScope.selection && this._dataScope.selection.search || null, - selectedData: this._dataScope.selection && this._dataScope.selection.included || null, - active: this._dataScope.active - }; - return selectionState; + * Get the current View camera type. + */ + get view() { + return this._last.view; } /** - * Set one data row to the active state. - */ activate(datum) { - return new Promise((resolve, reject)=>{ - this._animator.activate(datum).then(()=>{ - this.presenter.morphChartsRenderResult.activate(datum[0, _constants.GL_ORDINAL]); - this._details.render(); - resolve(); - }); - }); + * Instantiate a new Presenter. + * @param el Parent HTMLElement to present within. + * @param style Optional PresenterStyle styling options. + */ + constructor(el, style2) { + this.el = el; + this.style = deepMerge(defaultPresenterStyle$1, style2); + initializePanel(this); + this._last = { view: null, height: null, width: null, cubeCount: null, stage: null }; } /** - * Deactivate item. - */ deActivate() { - return new Promise((resolve, reject)=>{ - if (this._dataScope && this._dataScope.active) this._animator.deactivate().then(()=>{ - this.presenter.morphChartsRenderResult.activate(-1); - this._details.render(); - resolve(); - }); - else resolve(); - }); + * Cancels any pending animation, calling animationCanceled() on original queue. + */ + animationCancel() { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + if (this.logger) { + this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || "handler"}`); + } + if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) { + this.queuedAnimationOptions.animationCanceled.call(null); + } + } } /** - * Gets the current camera. - * @param transitionFinal Optional flag to get camera destination when transition completes. - */ getCamera(transitionFinal = false) { - var _a, _b, _c, _d, _e, _f, _g; - let position = [ - 0, - 0, - 0 - ]; - let rotation = [ - 0, - 0, - 0, - 0 - ]; - if (transitionFinal) { - position = Array.from((_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.cameraTransitioner.vPosition.to); - rotation = Array.from((_d = (_c = this.presenter) === null || _c === void 0 ? void 0 : _c.morphchartsref) === null || _d === void 0 ? void 0 : _d.cameraTransitioner.qRotation.to); - } else { - const camera = (_g = (_f = (_e = this.presenter) === null || _e === void 0 ? void 0 : _e.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; - if (camera) { - camera.getPosition(position); - camera.getOrbit(rotation); - } + * Stops the current animation and queues a new animation. + * @param handler Function to invoke when timeout is complete. + * @param timeout Length of time to wait before invoking the handler. + * @param options Optional QueuedAnimationOptions object. + */ + animationQueue(handler, timeout2, options2) { + if (this.logger) { + this.logger(`queueing animation ${options2 && options2.waitingLabel || "waiting"}...(${timeout2})`); + } + this.animationCancel(); + this.animationTimer = setTimeout(() => { + if (this.logger) { + this.logger(`queueing animation ${options2 && options2.handlerLabel || "handler"}...`); } - return { - position, - rotation, - captureSize: this.insight.size - }; + handler(); + }, timeout2); } /** - * Sets the current camera. - * @param camera Camera to set. - */ setCamera(camera) { - var _a, _b; - if (camera) (_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphChartsRenderResult) === null || _b === void 0 || _b.moveCamera(camera); + * Retrieve a sub-element of the rendered output. + * @param type PresenterElement type of the HTMLElement to retrieve. + */ + getElement(type2) { + const elements = this.el.getElementsByClassName(className$1(type2, this)); + if (elements && elements.length) { + return elements[0]; + } } /** - * Gets the current insight with signal values. - */ getInsight() { - const insight = Object.assign({}, this.insight); - insight.signalValues = this.getSignalValues(); - return insight; + * Present the Vega Scene, or Stage object using Morphcharts. + * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. + * @param height Height of the rendering area. + * @param width Width of the rendering area. + * @param config Optional presentation configuration object. + */ + present(sceneOrStage, height2, width2, config) { + this.animationCancel(); + const scene = sceneOrStage; + let stage; + const options2 = { + maxOrdinal: 0, + currAxis: null, + defaultCubeColor: this.style.defaultCubeColor, + assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (() => options2.maxOrdinal++), + modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, + zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex + }; + if (scene.marktype) { + stage = createStage(scene.view); + sceneToStage(options2, stage, scene); + } else { + stage = sceneOrStage; + } + const c2 = deepMerge(defaultPresenterConfig, config); + if (!this.morphchartsref) { + this._morphChartsOptions = { + container: this.getElement(PresenterElement$1.gl), + pickGridCallback: c2.axisPickGridCallback, + onCubeHover: (e, ordinal2) => { + c2.onCubeHover(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCubeClick: (e, ordinal2) => { + c2.onCubeClick(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, + onLasso: config === null || config === void 0 ? void 0 : config.onLasso + }; + this.morphchartsref = init$1(this._morphChartsOptions, c2.renderer || defaultPresenterConfig.renderer); + } + let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); + if (options2.maxOrdinal) { + cubeCount = Math.max(cubeCount, options2.maxOrdinal); + const empty = { + isEmpty: true + }; + stage.cubeData = patchCubeArray(cubeCount, empty, stage.cubeData); + } + config.preLayer && config.preLayer(stage); + this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height2, width2, config && config.preStage, config && config.morphChartsColors, c2); + delete stage.cubeData; + delete stage.redraw; + this._last = { + cubeCount, + height: height2, + width: width2, + stage, + view: stage.view + }; + const a2 = getActiveElementInfo(); + mount(LegendView({ legend: stage.legend, onClick: config && config.onLegendClick }), this.getElement(PresenterElement$1.legend)); + setActiveElement(a2); + if (config && config.onPresent) { + config.onPresent(); + } } - /** - * Gets column stats from current data (filtered or all). - * @param column Column to get stats for. - */ getColumnStats(column) { - return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; + canvasToDataURL() { + return new Promise((resolve2, reject) => { + this.morphchartsref.core.afterRenderCallback = () => { + this.morphchartsref.core.afterRenderCallback = null; + const canvas = this.getElement(PresenterElement$1.gl).getElementsByTagName("canvas")[0]; + const png = canvas.toDataURL("image/png"); + resolve2(png); + }; + }); + } + configColors(mcColors) { + colorConfig(this.morphchartsref, mcColors); } /** - * Gets current signal values. - */ getSignalValues() { - return (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec); + * Home the camera to the last initial position. + */ + homeCamera() { + var _a2; + (_a2 = this.morphchartsref) === null || _a2 === void 0 ? void 0 : _a2.reset(); } - assignTransitionStagger(transition) { - (0, _transition.assignTransitionStagger)(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + /** + * Show guidelines of rendering height/width and center of OrbitView. + */ + showGuides() { + this.getElement(PresenterElement$1.gl).classList.add("show-center"); } finalize() { - if (this._dataScope) this._dataScope.finalize(); - if (this._details) this._details.finalize(); - if (this._tooltip) this._tooltip.destroy(); - if (this.vegaViewGl) this.vegaViewGl.finalize(); - if (this.presenter) this.presenter.finalize(); - if (this.element) this.element.innerHTML = ''; - this.colorContexts = null; - this.element = null; - this.options = null; - this.presenter = null; - this.vegaSpec = null; - this.vegaViewGl = null; - this._animator = null; - this._dataScope = null; - this._details = null; - this._tooltip = null; + this.animationCancel(); + if (this.morphchartsref) + this.morphchartsref.core.stop(); + if (this.el) + this.el.innerHTML = ""; + this._last = null; + this.morphchartsref = null; + this.el = null; + this.logger = null; + this.queuedAnimationOptions = null; } -} -/** - * Default Viewer options. - */ Viewer.defaultViewerOptions = (0, _defaults.defaultViewerOptions); - -},{"./animator":"g3bB0","./axisSelection":"3Bo2C","./colorCubes":"a2zcs","./colorSchemes":"iDNR0","./constants":"ix2qh","./dataScope":"3xxVJ","./defaults":"7bMd0","./details":"5q1eU","./headers":"bOtA3","./legend":"buMaw","./ordinal":"eRzwB","./search":"6kluJ","./signals":"xDtCn","./tooltip":"bKbCn","@msrvida/sanddance-specs":"aOvSr","@msrvida/search-expression":"4F93b","@msrvida/vega-morphcharts":"9Sd5M","./characterSet":"grMul","./transition":"fNWAw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g3bB0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataLayoutChange", ()=>DataLayoutChange); -parcelHelpers.export(exports, "Animator", ()=>Animator); -var DataLayoutChange; -(function(DataLayoutChange) { - DataLayoutChange[DataLayoutChange["same"] = 0] = "same"; - DataLayoutChange[DataLayoutChange["reset"] = 1] = "reset"; - DataLayoutChange[DataLayoutChange["refine"] = 2] = "refine"; -})(DataLayoutChange || (DataLayoutChange = {})); -class Animator { - constructor(dataScope, props){ - this.dataScope = dataScope; - this.props = props; + } + function _RendererGl(loader2) { + class RendererGlInternal extends base$3.vega.Renderer { + initialize(el, width2, height2, origin) { + this.height = height2; + this.width = width2; + return super.initialize(el, width2, height2, origin); + } + resize(width2, height2, origin) { + super.resize(width2, height2, origin); + this.origin = origin; + this.height = height2; + this.width = width2; + return this; + } + _render(scene, items) { + const scene3d = scene; + scene3d.view = this.getView(); + this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); + return this; + } } - select(search) { - return new Promise((resolve, reject)=>{ - this.dataScope.select(search); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + const instance = new RendererGlInternal(loader2); + return instance; + } + const RendererGl = _RendererGl; + let registered = false; + function _ViewGl(runtime2, config) { + class ViewGlInternal extends base$3.vega.View { + constructor(runtime3, config2 = {}) { + super(runtime3, config2); + this.config = config2; + this.presenter = config2.presenter; + config2.presenterConfig = config2.presenterConfig || {}; + config2.presenterConfig.redraw = () => { + this._redraw = true; + this.run(); + }; + } + renderer(...args) { + if (args && args.length) { + const renderer = args[0]; + if (renderer === "morphcharts" && !registered) { + base$3.vega.renderModule("morphcharts", { handler: base$3.vega.CanvasHandler, renderer: RendererGl }); + registered = true; + } + return super.renderer(renderer); + } else { + return super.renderer(); + } + } + initialize(el) { + if (!this.presenter) { + this.presenter = new Presenter(el); + } + super.initialize(this.presenter.getElement(PresenterElement$1.vegaControls)); + const renderer = this._renderer; + renderer.presenterConfig = this.config.presenterConfig; + renderer.presenter = this.presenter; + renderer.getView = this.config && this.config.getView || (() => this.presenter.view || defaultView$1); + return this; + } + error(e) { + if (this.presenter.logger) { + this.presenter.logger(e); + } + } } - deselect() { - return new Promise((resolve, reject)=>{ - this.dataScope.deselect(); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + const instance = new ViewGlInternal(runtime2, config); + return instance; + } + const ViewGl = _ViewGl; + const version$5 = "1.0.6"; + const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Presenter, + get PresenterElement() { + return PresenterElement$1; + }, + ViewGl, + base: base$3, + controls, + defaults: defaults$1, + types, + use: use$5, + util: util$4, + version: version$5 + }, Symbol.toStringTag, { value: "Module" })); + const { defaultPresenterStyle } = defaults$1; + const defaultViewerOptions$1 = { + colors: { + activeCube: "purple", + defaultCube: colorToString(defaultPresenterStyle.defaultCubeColor), + hoveredCube: colorToString(defaultPresenterStyle.highlightColor), + selectedCube: "yellow", + axisSelectHighlight: colorToString([128, 128, 128, 128]), + axisLine: "#000", + axisText: "#000", + gridLine: "#CCC", + backgroundColor: "#FFF" + }, + language: { + headers: { + chart: "Chart", + details: "Details", + legend: "Legend", + selection: "Select & Filter" + }, + bing: "bing", + newColorMap: "remap color to filtered items", + oldColorMap: "keep same colors", + deselect: "deselect", + exclude: "exclude", + isolate: "isolate", + legendOther: "other", + nextDetail: ">", + previousDetail: "<", + reset: "reset", + colorBinCount: "Color bin count", + colorReverse: "Color reverse", + count: "Count", + percent: "Percent", + sum: "Sum", + scatterPointScale: "Point scale", + FacetMaxBins: "Facet max bins", + FacetVMaxBins: "Cross facet max bins", + XMaxBins: "X axis max bins", + YMaxBins: "Y axis max bins", + XGridSize: "X grid size", + YGridSize: "Y grid size", + InnerPaddingSize: "Inner padding size", + OuterPaddingSize: "Outer padding size", + treeMapMethod: "Treemap layout", + facetColumns: "Facet columns", + facetRows: "Facet rows", + markOpacitySignal: "Mark opacity", + textScaleSignal: "Text scale", + xAxisTextAngleSignal: "X axis text angle", + yAxisTextAngleSignal: "Y axis text angle", + zGrounded: "Z grounded", + zScaleProportion: "Z scale proportion to Y", + selectionCount: (count2) => `${count2} items selected` + }, + maxLegends: 19, + //20 would be "other" + onError: (errors) => { + }, + filterRenderingTimerPadding: 200, + selectionPolygonZ: -1, + tickSize: 10 + }; + function getPresenterStyle(options2) { + const style2 = { + cssPrefix, + fontFamily: options2.fontFamily, + defaultCubeColor: colorFromString(options2.colors.defaultCube) + }; + if (options2.colors.hoveredCube) { + style2.highlightColor = colorFromString(options2.colors.hoveredCube); } - filter(search, keepData, collapseData, rebase) { - if (rebase) this.dataScope.collapse(false, keepData); - this.dataScope.collapse(true, collapseData); - return new Promise((resolve, reject)=>{ - this.props.onAnimateDataChange(DataLayoutChange.refine, 'before refine', 'refine').then(()=>{ - this.dataScope.deselect(); - this.dataScope.setFilteredData(keepData); - this.props.onDataChanged(DataLayoutChange.refine, search); - resolve(); - }).catch(reject); - }); + return style2; + } + const cssPrefix = "sanddance-"; + const dualColorSchemeColors = { + black: "#212121", + gray: "#D2D2D2", + blue: "#0060F0", + green: "#00C000", + orange: "#FF9900", + red: "#E00000" + }; + function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { + if (includeVegaMorphChartsFields) { + if (columnName === GL_ORDINAL) + return true; } - reset() { - return new Promise((resolve, reject)=>{ - this.dataScope.deselect(); - let time; - if (!this.dataScope.hasFilteredData()) time = 0; - else this.dataScope.setFilteredData(null); - this.props.onAnimateDataChange(DataLayoutChange.reset, 'before reset', 'reset', time).then(()=>{ - this.dataScope.collapse(false); - this.props.onDataChanged(DataLayoutChange.reset); - resolve(); - }).catch(reject); - }); + for (const f in FieldNames) { + if (columnName === FieldNames[f]) + return true; } - activate(datum) { - return new Promise((resolve, reject)=>{ - this.dataScope.activate(datum); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + return false; + } + const util$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + getColumnsFromData, + getPresenterStyle, + getStats, + inferAll, + isInternalFieldName + }, Symbol.toStringTag, { value: "Module" })); + const dualPairs = [ + [dualColorSchemeColors.black, dualColorSchemeColors.gray], + [dualColorSchemeColors.red, dualColorSchemeColors.green], + [dualColorSchemeColors.red, dualColorSchemeColors.blue], + [dualColorSchemeColors.black, dualColorSchemeColors.red], + [dualColorSchemeColors.black, dualColorSchemeColors.orange], + [dualColorSchemeColors.black, dualColorSchemeColors.green] + ]; + const colorSchemes = [ + { + scheme: ColorScaleNone, + colors: [defaultViewerOptions$1.colors.defaultCube] + } + ]; + createDualColorSchemes(); + function registerColorSchemes(vega2) { + colorSchemes.forEach((cs) => { + if (cs.colors.length === 1) { + vega2.scheme(cs.scheme, (x2) => cs.colors[0]); + } else { + vega2.scheme(cs.scheme, cs.colors); + } + }); + } + function createPair(names, colors2) { + const scheme2 = `dual_${names[0]}${names[1]}`; + colorSchemes.push({ scheme: scheme2, colors: colors2 }); + } + function createDualColorSchemes() { + dualPairs.forEach((colors2) => { + const names = colors2.map((color2) => { + for (const key2 in dualColorSchemeColors) + if (color2 === dualColorSchemeColors[key2]) + return key2; + }); + createPair(names, colors2); + createPair([...names].reverse(), [...colors2].reverse()); + }); + } + var DataLayoutChange; + (function(DataLayoutChange2) { + DataLayoutChange2[DataLayoutChange2["same"] = 0] = "same"; + DataLayoutChange2[DataLayoutChange2["reset"] = 1] = "reset"; + DataLayoutChange2[DataLayoutChange2["refine"] = 2] = "refine"; + })(DataLayoutChange || (DataLayoutChange = {})); + class Animator { + constructor(dataScope, props) { + this.dataScope = dataScope; + this.props = props; } - deactivate() { - return new Promise((resolve, reject)=>{ - this.dataScope.deactivate(); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + select(search) { + return new Promise((resolve2, reject) => { + this.dataScope.select(search); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Bo2C":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisSelection", ()=>AxisSelection); -parcelHelpers.export(exports, "moveTicksBetween", ()=>moveTicksBetween); -var _expression = require("./expression"); -const dimToRole = { - 0: 'x', - 1: 'y', - 2: 'z' -}; -const roleToDim = { - x: 0, - y: 1, - z: 1 -}; -class AxisSelection { - constructor(specCapabilities, columns, stage){ - this.specCapabilities = specCapabilities; - this.columns = columns; - this.stage = stage; + deselect() { + return new Promise((resolve2, reject) => { + this.dataScope.deselect(); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } - convert(divisions) { - const searchRoles = []; - divisions.forEach((division, i)=>{ - const role = dimToRole[i]; - const axes = this.stage.axes[role]; - //all axes in a faceted chart should be the same - const axis = axes.filter((axis)=>axis.tickText.length)[0]; - if (axis) { - const capabilities = this.specCapabilities.roles.filter((r)=>r.role === role)[0]; - const column = this.columns[role]; - if (division >= 0 && (capabilities === null || capabilities === void 0 ? void 0 : capabilities.axisSelection)) searchRoles.push({ - axis, - role, - capabilities, - column, - division - }); - } - }); - switch(searchRoles.length){ - case 0: - return null; - case 1: - return this.getSearchFromSearchRole(searchRoles[0]); - default: - { - const roles = searchRoles.map((searchRole)=>this.getSearchFromSearchRole(searchRole)); - roles.forEach((role, i)=>{ - if (i === 0) return; - role.clause = '&&'; - }); - return roles; - } + filter(search, keepData, collapseData, rebase) { + if (rebase) { + this.dataScope.collapse(false, keepData); + } + this.dataScope.collapse(true, collapseData); + return new Promise((resolve2, reject) => { + this.props.onAnimateDataChange(DataLayoutChange.refine, "before refine", "refine").then(() => { + this.dataScope.deselect(); + this.dataScope.setFilteredData(keepData); + this.props.onDataChanged(DataLayoutChange.refine, search); + resolve2(); + }).catch(reject); + }); + } + reset() { + return new Promise((resolve2, reject) => { + this.dataScope.deselect(); + let time2; + if (!this.dataScope.hasFilteredData()) { + time2 = 0; + } else { + this.dataScope.setFilteredData(null); } + this.props.onAnimateDataChange(DataLayoutChange.reset, "before reset", "reset", time2).then(() => { + this.dataScope.collapse(false); + this.props.onDataChanged(DataLayoutChange.reset); + resolve2(); + }).catch(reject); + }); } - getSearchFromSearchRole(searchRole) { - const getSearch = searchRole.capabilities.axisSelection === 'exact' ? (a, c, i)=>({ - expressions: [ - (0, _expression.selectExactAxis)(a, c, i) - ] - }) : (0, _expression.selectBetweenAxis); - const { axis, column, division } = searchRole; - return getSearch(axis, column, division); - } -} -function moveTicksBetween(axes) { - axes.forEach((axis)=>{ - if (axis.ticks.length === 0) return; - const dim = roleToDim[axis.axisRole]; - const { color } = axis.ticks[0]; - const newLine = (value)=>{ - const line = { - sourcePosition: [ - 0, - 0, - 0 - ], - targetPosition: [ - 0, - 0, - 0 - ], - color - }; - line.sourcePosition[dim] = value; - return line; - }; - const newTicks = []; - newTicks.push(newLine(axis.domain.sourcePosition[dim])); - for(let i = 1; i < axis.ticks.length; i++)newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); - newTicks.push(newLine(axis.domain.targetPosition[dim])); - axis.ticks = newTicks; - }); -} - -},{"./expression":"2foo2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2foo2":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "notNice", ()=>notNice); -parcelHelpers.export(exports, "selectNullOrEmpty", ()=>selectNullOrEmpty); -parcelHelpers.export(exports, "selectExact", ()=>selectExact); -parcelHelpers.export(exports, "selectNone", ()=>selectNone); -parcelHelpers.export(exports, "selectExactAxis", ()=>selectExactAxis); -parcelHelpers.export(exports, "selectBetween", ()=>selectBetween); -parcelHelpers.export(exports, "selectBetweenAxis", ()=>selectBetweenAxis); -function notNice(niceValue) { - //convert "nice" numbers to numeric value - return (niceValue + '').replace(/[\s,]/g, ''); -} -function tickValue(axis, i) { + activate(datum2) { + return new Promise((resolve2, reject) => { + this.dataScope.activate(datum2); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); + } + deactivate() { + return new Promise((resolve2, reject) => { + this.dataScope.deactivate(); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); + } + } + function notNice(niceValue) { + return (niceValue + "").replace(/[\s,]/g, ""); + } + function tickValue(axis, i) { const tick = axis.tickText[i]; - let value; - if (tick) value = axis.tickText[i].value; - return { - tick, - value - }; -} -function selectNullOrEmpty(column) { + let value2; + if (tick) { + value2 = axis.tickText[i].value; + } + return { tick, value: value2 }; + } + function selectNullOrEmpty(column) { const searchExpression = { - name: column.name, - operator: 'isnullorEmpty' + name: column.name, + operator: "isnullorEmpty" }; return searchExpression; -} -function selectExact(column, value) { - if (value == null) return selectNullOrEmpty(column); + } + function selectExact(column, value2) { + if (value2 == null) { + return selectNullOrEmpty(column); + } const searchExpression = { - name: column.name, - operator: '==', - value + name: column.name, + operator: "==", + value: value2 }; return searchExpression; -} -function selectNone(column, values) { - const expressions = values.map((value, i)=>{ - const searchExpression = { - name: column.name, - operator: '!=', - value - }; - if (i) searchExpression.clause = '&&'; - return searchExpression; + } + function selectNone(column, values2) { + const expressions = values2.map((value2, i) => { + const searchExpression = { + name: column.name, + operator: "!=", + value: value2 + }; + if (i) { + searchExpression.clause = "&&"; + } + return searchExpression; }); const searchExpressionGroup = { - expressions + expressions }; return searchExpressionGroup; -} -function selectExactAxis(axis, column, i) { + } + function selectExactAxis(axis, column, i) { const result = tickValue(axis, i); - if (result.tick) return selectExact(column, result.value); -} -function selectBetween(column, lowValue, highValue, lowOperator = '>=', highOperator = '<') { + if (result.tick) { + return selectExact(column, result.value); + } + } + function selectBetween(column, lowValue, highValue, lowOperator = ">=", highOperator = "<") { const expressions = []; - if (lowValue !== undefined) expressions.push({ + if (lowValue !== void 0) { + expressions.push({ name: column.name, operator: lowOperator, value: lowValue - }); - if (highValue !== undefined) expressions.push({ + }); + } + if (highValue !== void 0) { + expressions.push({ name: column.name, operator: highOperator, value: highValue - }); - if (expressions.length > 1) expressions[1].clause = '&&'; + }); + } + if (expressions.length > 1) { + expressions[1].clause = "&&"; + } const searchExpressionGroup = { - expressions + expressions }; return searchExpressionGroup; -} -function selectBetweenAxis(axis, column, i) { + } + function selectBetweenAxis(axis, column, i) { const low = tickValue(axis, i); const high = tickValue(axis, i + 1); return selectBetween(column, low.value, high.value); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a2zcs":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "populateColorContext", ()=>populateColorContext); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -function populateColorContext(colorContext, presenter) { - if (!colorContext.colorMap) colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; - colorContext.legend = _vegaMorphcharts.util.clone(presenter.stage.legend); - colorContext.legendElement = presenter.getElement(_vegaMorphcharts.PresenterElement.legend).children[0]; -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3xxVJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _searchExpression = require("@msrvida/search-expression"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _constants = require("./constants"); -class DataScope { - constructor(){ - this.filteredColumnsStats = {}; + } + const dimToRole = { + 0: "x", + 1: "y", + 2: "z" + }; + const roleToDim = { + x: 0, + y: 1, + z: 1 + }; + class AxisSelection { + constructor(specCapabilities, columns, stage) { + this.specCapabilities = specCapabilities; + this.columns = columns; + this.stage = stage; } - setData(data, columns) { - const differentData = this.data !== data; - if (differentData) { - if (this.data) //clean up things we added to old data - this.deselect(); - this.data = data; - this.columns = columns; - this.filteredData = null; - this.filteredColumnsStats = {}; + convert(divisions) { + const searchRoles = []; + divisions.forEach((division, i) => { + const role = dimToRole[i]; + const axes = this.stage.axes[role]; + const axis = axes.filter((axis2) => axis2.tickText.length)[0]; + if (axis) { + const capabilities2 = this.specCapabilities.roles.filter((r) => r.role === role)[0]; + const column = this.columns[role]; + if (division >= 0 && (capabilities2 === null || capabilities2 === void 0 ? void 0 : capabilities2.axisSelection)) { + searchRoles.push({ + axis, + role, + capabilities: capabilities2, + column, + division + }); + } + } + }); + switch (searchRoles.length) { + case 0: { + return null; + } + case 1: { + return this.getSearchFromSearchRole(searchRoles[0]); + } + default: { + const roles = searchRoles.map((searchRole) => this.getSearchFromSearchRole(searchRole)); + roles.forEach((role, i) => { + if (i === 0) + return; + role.clause = "&&"; + }); + return roles; } - return differentData; + } } - setFilteredData(filteredData) { - this.filteredData = filteredData; + getSearchFromSearchRole(searchRole) { + const getSearch = searchRole.capabilities.axisSelection === "exact" ? (a2, c2, i) => ({ expressions: [selectExactAxis(a2, c2, i)] }) : selectBetweenAxis; + const { axis, column, division } = searchRole; + return getSearch(axis, column, division); + } + } + function moveTicksBetween(axes) { + axes.forEach((axis) => { + if (axis.ticks.length === 0) + return; + const dim = roleToDim[axis.axisRole]; + const { color: color2 } = axis.ticks[0]; + const newLine = (value2) => { + const line2 = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0], + color: color2 + }; + line2.sourcePosition[dim] = value2; + return line2; + }; + const newTicks = []; + newTicks.push(newLine(axis.domain.sourcePosition[dim])); + for (let i = 1; i < axis.ticks.length; i++) { + newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); + } + newTicks.push(newLine(axis.domain.targetPosition[dim])); + axis.ticks = newTicks; + }); + } + function populateColorContext(colorContext, presenter) { + if (!colorContext.colorMap) { + colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; + } + colorContext.legend = clone(presenter.stage.legend); + colorContext.legendElement = presenter.getElement(PresenterElement$1.legend).children[0]; + } + let DataScope$2 = class DataScope { + constructor() { + this.filteredColumnsStats = {}; + } + setData(data2, columns) { + const differentData = this.data !== data2; + if (differentData) { + if (this.data) { + this.deselect(); + } + this.data = data2; + this.columns = columns; + this.filteredData = null; this.filteredColumnsStats = {}; + } + return differentData; + } + setFilteredData(filteredData) { + this.filteredData = filteredData; + this.filteredColumnsStats = {}; } getColumns(columnTypes) { - if (!this.columns) this.columns = (0, _sanddanceSpecs.getColumnsFromData)(_vegaMorphcharts.base.vega.inferTypes, this.data, columnTypes); - return this.columns; + if (!this.columns) { + this.columns = getColumnsFromData(base$3.vega.inferTypes, this.data, columnTypes); + } + return this.columns; } getFilteredColumnStats(columnName) { - if (!this.filteredColumnsStats[columnName]) this.filteredColumnsStats[columnName] = (0, _sanddanceSpecs.getStats)(this.filteredData, this.columns.filter((c)=>c.name === columnName)[0]); - return this.filteredColumnsStats[columnName]; + if (!this.filteredColumnsStats[columnName]) { + this.filteredColumnsStats[columnName] = getStats(this.filteredData, this.columns.filter((c2) => c2.name === columnName)[0]); + } + return this.filteredColumnsStats[columnName]; } currentData() { - return this.filteredData || this.data; + return this.filteredData || this.data; } select(search) { - this.deselect(); - if (search) { - this.selection = this.createUserSelection(search, true, false); - if (this.selection.included.length) this.activate(this.selection.included[0]); + this.deselect(); + if (search) { + this.selection = this.createUserSelection(search, true, false); + if (this.selection.included.length) { + this.activate(this.selection.included[0]); } + } } - createUserSelection(search, assign, rebase) { - const exec = new (0, _searchExpression.Exec)(search, this.getColumns()); - const s = { - search, - included: [], - excluded: [] - }; - const data = rebase ? this.data : this.currentData(); - data.forEach((datum)=>{ - if (exec.run(datum)) { - if (assign) datum[(0, _sanddanceSpecs.FieldNames).Selected] = true; - s.included.push(datum); - } else s.excluded.push(datum); - }); - return s; + createUserSelection(search, assign2, rebase) { + const exec = new Exec(search, this.getColumns()); + const s2 = { + search, + included: [], + excluded: [] + }; + const data2 = rebase ? this.data : this.currentData(); + data2.forEach((datum2) => { + if (exec.run(datum2)) { + if (assign2) { + datum2[FieldNames.Selected] = true; + } + s2.included.push(datum2); + } else { + s2.excluded.push(datum2); + } + }); + return s2; } deselect() { - this.deactivate(); - this.data.forEach((datum)=>{ - delete datum[(0, _sanddanceSpecs.FieldNames).Selected]; - }); - this.selection = null; + this.deactivate(); + this.data.forEach((datum2) => { + delete datum2[FieldNames.Selected]; + }); + this.selection = null; } hasFilteredData() { - return !!this.filteredData; + return !!this.filteredData; } hasSelectedData() { - return !!this.selection; + return !!this.selection; } - collapse(collapsed, data = this.data) { - data.forEach((datum)=>{ - datum[(0, _sanddanceSpecs.FieldNames).Collapsed] = collapsed; - }); - this.isCollapsed = collapsed; + collapse(collapsed, data2 = this.data) { + data2.forEach((datum2) => { + datum2[FieldNames.Collapsed] = collapsed; + }); + this.isCollapsed = collapsed; } - activate(datum) { - this.deactivate(); - datum[(0, _sanddanceSpecs.FieldNames).Active] = true; - this.active = datum; + activate(datum2) { + this.deactivate(); + datum2[FieldNames.Active] = true; + this.active = datum2; } deactivate() { - if (this.active) delete this.active[(0, _sanddanceSpecs.FieldNames).Active]; - this.active = null; - } - ordinalIndexWithinSelection(ordinal) { - if (this.selection) for(let i = 0; i < this.selection.included.length; i++){ - const datum = this.selection.included[i]; - if (datum[0, _constants.GL_ORDINAL] === ordinal) return { - datum, - index: i - }; + if (this.active) { + delete this.active[FieldNames.Active]; + } + this.active = null; + } + ordinalIndexWithinSelection(ordinal2) { + if (this.selection) { + for (let i = 0; i < this.selection.included.length; i++) { + const datum2 = this.selection.included[i]; + if (datum2[GL_ORDINAL] === ordinal2) { + return { datum: datum2, index: i }; + } } - return { - datum: null, - index: -1 - }; + } + return { datum: null, index: -1 }; } finalize() { - this.data = null; - this.filteredData = null; - this.filteredColumnsStats = null; - if (this.selection) { - this.selection.excluded = null; - this.selection.included = null; - this.selection = null; - } - } -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","@msrvida/search-expression":"4F93b","@msrvida/sanddance-specs":"aOvSr","./constants":"ix2qh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5q1eU":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Details", ()=>Details); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _defaults = require("./defaults"); -var _constants = require("./constants"); -var _searchExpression = require("@msrvida/search-expression"); -var _util = require("./util"); -var Action; -(function(Action) { - Action[Action["deselect"] = 0] = "deselect"; - Action[Action["isolate"] = 1] = "isolate"; - Action[Action["exclude"] = 2] = "exclude"; - Action[Action["reset"] = 3] = "reset"; - Action[Action["next"] = 4] = "next"; - Action[Action["previous"] = 5] = "previous"; -})(Action || (Action = {})); -class Details { - constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps){ - this.language = language; - this.animator = animator; - this.dataScope = dataScope; - this.colorMapHandler = colorMapHandler; - this.hasColorMaps = hasColorMaps; - this.element = (0, _vegaMorphcharts.util).addDiv(parentElement, `${(0, _defaults.cssPrefix)}unitControls`); - this.clear(); + this.data = null; + this.filteredData = null; + this.filteredColumnsStats = null; + if (this.selection) { + this.selection.excluded = null; + this.selection.included = null; + this.selection = null; + } + } + }; + var Action; + (function(Action2) { + Action2[Action2["deselect"] = 0] = "deselect"; + Action2[Action2["isolate"] = 1] = "isolate"; + Action2[Action2["exclude"] = 2] = "exclude"; + Action2[Action2["reset"] = 3] = "reset"; + Action2[Action2["next"] = 4] = "next"; + Action2[Action2["previous"] = 5] = "previous"; + })(Action || (Action = {})); + class Details { + constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps) { + this.language = language; + this.animator = animator; + this.dataScope = dataScope; + this.colorMapHandler = colorMapHandler; + this.hasColorMaps = hasColorMaps; + this.element = addDiv(parentElement, `${cssPrefix}unitControls`); + this.clear(); } finalize() { - if (this.element) this.element.innerHTML = ''; - this.dataScope = null; - this.element = null; + if (this.element) + this.element.innerHTML = ""; + this.dataScope = null; + this.element = null; } clear() { - this.state = { - userSelection: null, - index: -1, - remapColor: false - }; - this.render(); + this.state = { + userSelection: null, + index: -1, + remapColor: false + }; + this.render(); } clearSelection() { - this.state.userSelection = null; - this.state.index = -1; - this.render(); - } - populate(userSelection, index = 0) { - this.state.userSelection = userSelection; - this.state.index = index; - this.render(); - } - selectByNameValue(columnName, value) { - const search = { - name: columnName, - operator: '==', - value - }; - this.clearSelection(); - this.animator.select(search); - this.populate(this.dataScope.selection); + this.state.userSelection = null; + this.state.index = -1; + this.render(); + } + populate(userSelection, index2 = 0) { + this.state.userSelection = userSelection; + this.state.index = index2; + this.render(); + } + selectByNameValue(columnName, value2) { + const search = { + name: columnName, + operator: "==", + value: value2 + }; + this.clearSelection(); + this.animator.select(search); + this.populate(this.dataScope.selection); } remapChanged(remap) { - this.state.remapColor = remap; - this.colorMapHandler(remap); - this.render(); + this.state.remapColor = remap; + this.colorMapHandler(remap); + this.render(); } handleAction(action) { - let p; - const u = this.state.userSelection; - switch(action){ - case Action.deselect: - this.clearSelection(); - p = this.animator.deselect(); - break; - case Action.exclude: - this.clearSelection(); - p = this.animator.filter((0, _searchExpression.invert)(u.search), u.excluded, u.included, false); - this.state.remapColor = false; - break; - case Action.isolate: - this.clearSelection(); - p = this.animator.filter(u.search, u.included, u.excluded, false); - this.state.remapColor = false; - break; - case Action.reset: - this.clear(); - p = this.animator.reset(); - break; - default: - switch(action){ - case Action.previous: - this.state.index--; - if (this.state.index < 0) this.state.index = this.state.userSelection.included.length - 1; - break; - case Action.next: - this.state.index++; - if (this.state.index >= this.state.userSelection.included.length) this.state.index = 0; - break; - } - this.render(); - p = this.animator.activate(this.state.userSelection.included[this.state.index]); + let p; + const u2 = this.state.userSelection; + switch (action) { + case Action.deselect: { + this.clearSelection(); + p = this.animator.deselect(); + break; + } + case Action.exclude: { + this.clearSelection(); + p = this.animator.filter(invert$2(u2.search), u2.excluded, u2.included, false); + this.state.remapColor = false; + break; + } + case Action.isolate: { + this.clearSelection(); + p = this.animator.filter(u2.search, u2.included, u2.excluded, false); + this.state.remapColor = false; + break; + } + case Action.reset: { + this.clear(); + p = this.animator.reset(); + break; } - p.then(()=>this.render()); + default: { + switch (action) { + case Action.previous: { + this.state.index--; + if (this.state.index < 0) { + this.state.index = this.state.userSelection.included.length - 1; + } + break; + } + case Action.next: { + this.state.index++; + if (this.state.index >= this.state.userSelection.included.length) { + this.state.index = 0; + } + break; + } + } + this.render(); + p = this.animator.activate(this.state.userSelection.included[this.state.index]); + } + } + p.then(() => this.render()); } render() { - const hasRefinedData = this.dataScope.hasFilteredData(); - const renderProps = { - language: this.language, - actionHandler: (action)=>this.handleAction(action), - selectionHandler: (columnName, value)=>this.selectByNameValue(columnName, value), - count: this.state.userSelection && this.state.userSelection.included.length, - hasRefinedData, - item: this.state.userSelection && this.state.userSelection.included[this.state.index], - remapColorHandler: (remap)=>this.remapChanged(remap), - hasColorMaps: this.hasColorMaps() && hasRefinedData, - remapColor: this.state.remapColor - }; - const a = _vegaMorphcharts.util.getActiveElementInfo(); - _vegaMorphcharts.util.mount(renderDetails(renderProps), this.element); - _vegaMorphcharts.util.setActiveElement(a); + const hasRefinedData = this.dataScope.hasFilteredData(); + const renderProps = { + language: this.language, + actionHandler: (action) => this.handleAction(action), + selectionHandler: (columnName, value2) => this.selectByNameValue(columnName, value2), + count: this.state.userSelection && this.state.userSelection.included.length, + hasRefinedData, + item: this.state.userSelection && this.state.userSelection.included[this.state.index], + remapColorHandler: (remap) => this.remapChanged(remap), + hasColorMaps: this.hasColorMaps() && hasRefinedData, + remapColor: this.state.remapColor + }; + const a2 = getActiveElementInfo(); + mount(renderDetails(renderProps), this.element); + setActiveElement(a2); } -} -const renderDetails = (props)=>{ + } + const renderDetails = (props) => { const controlButtons = [ - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.deselect) - }, props.language.deselect), - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.isolate) - }, props.language.isolate), - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.exclude) - }, props.language.exclude) + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.deselect) }, props.language.deselect), + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.isolate) }, props.language.isolate), + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.exclude) }, props.language.exclude) ]; - const colorMapping = _vegaMorphcharts.util.createElement("div", null, _vegaMorphcharts.util.createElement("button", { - disabled: props.remapColor, - onClick: (e)=>props.remapColorHandler(true) - }, props.language.newColorMap), _vegaMorphcharts.util.createElement("button", { - disabled: !props.remapColor, - onClick: (e)=>props.remapColorHandler(false) - }, props.language.oldColorMap)); + const colorMapping2 = createElement( + "div", + null, + createElement("button", { disabled: props.remapColor, onClick: (e) => props.remapColorHandler(true) }, props.language.newColorMap), + createElement("button", { disabled: !props.remapColor, onClick: (e) => props.remapColorHandler(false) }, props.language.oldColorMap) + ); const singleItem = props.count === 1; const scrollButtons = [ - _vegaMorphcharts.util.createElement("button", { - disabled: singleItem, - onClick: (e)=>props.actionHandler(Action.previous) - }, props.language.previousDetail), - _vegaMorphcharts.util.createElement("button", { - disabled: singleItem, - onClick: (e)=>props.actionHandler(Action.next) - }, props.language.nextDetail), - _vegaMorphcharts.util.createElement("span", null, " ", props.language.selectionCount(props.count)) + createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.previous) }, props.language.previousDetail), + createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.next) }, props.language.nextDetail), + createElement( + "span", + null, + " ", + props.language.selectionCount(props.count) + ) ]; const rows = []; - for(const prop in props.item){ - if (prop === (0, _constants.GL_ORDINAL)) continue; - if ((0, _util.isInternalFieldName)(prop)) continue; - rows.push({ - cells: [ - { - content: prop - }, - { - content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) - } - ] - }); - } - return _vegaMorphcharts.util.createElement("div", null, props.hasColorMaps && colorMapping, _vegaMorphcharts.util.createElement("h4", null, props.language.headers.selection), _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}selection` - }, controlButtons, _vegaMorphcharts.util.createElement("button", { - disabled: !props.hasRefinedData, - onClick: (e)=>props.actionHandler(Action.reset) - }, "reset")), props.item && _vegaMorphcharts.util.createElement("h4", null, props.language.headers.details), _vegaMorphcharts.util.createElement("div", null, _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}details-scroll` - }, props.item && scrollButtons), _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}details` - }, props.item && _vegaMorphcharts.util.createElement((0, _vegaMorphcharts.controls).Table, { - rows: rows - })))); -}; -function linkSelect(language, columnName, value, selectionHandler) { - return _vegaMorphcharts.util.createElement("span", null, _vegaMorphcharts.util.createElement("a", { - href: "#", - onClick: (e)=>selectionHandler(columnName, value) - }, value), isNaN(value) ? [ - ' ', - _vegaMorphcharts.util.createElement("a", { - className: "bing-search", - href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`, - target: "_blank" - }, language.bing) - ] : ''); -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","./defaults":"7bMd0","./constants":"ix2qh","@msrvida/search-expression":"4F93b","./util":"g08sL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOtA3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ensureHeaders", ()=>ensureHeaders); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -function ensureHeaders(presenter, headers) { - const vegaControls = presenter.getElement((0, _vegaMorphcharts.PresenterElement).vegaControls); - conditionalHeader(!!vegaControls.querySelectorAll('.vega-bindings > *').length, vegaControls, headers.chart); - const legend = presenter.getElement((0, _vegaMorphcharts.PresenterElement).legend); - conditionalHeader(!!legend.children.length, legend, headers.legend); -} -function conditionalHeader(condition, element, header) { - const existing = existingHeader(element, header); - if (condition && !existing) addHeader(element, header); - if (!condition && existing) existing.remove(); -} -function addHeader(element, header) { - const h = document.createElement('h4'); - h.innerHTML = header; - element.insertAdjacentElement('beforebegin', h); -} -function existingHeader(element, header) { - const { previousElementSibling } = element; - if (previousElementSibling && previousElementSibling.innerHTML === header) return previousElementSibling; -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"buMaw":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "finalizeLegend", ()=>finalizeLegend); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _expression = require("./expression"); -function legendRange(colorBinType, column, legend, clickedIndex) { - if (column.quantitative) return selectQuantitative(colorBinType, column, legend, clickedIndex); - else return selectCategorical(column, legend, clickedIndex); -} -function selectCategorical(column, legend, clickedIndex) { - const value = legend.rows[clickedIndex].value; - if (value === (0, _sanddanceSpecs.Other)) { - const values = []; - for(const i in legend.rows)if (+i !== clickedIndex) values.push(legend.rows[i].value); - return (0, _expression.selectNone)(column, values); - } else //select equal - return { - expressions: [ - (0, _expression.selectExact)(column, legend.rows[clickedIndex].value) + for (const prop in props.item) { + if (prop === GL_ORDINAL) { + continue; + } + if (isInternalFieldName(prop)) { + continue; + } + rows.push({ + cells: [ + { content: prop }, + { content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) } ] - }; -} -function selectQuantitative(colorBinType, column, legend, clickedIndex) { - const keys = Object.keys(legend.rows).map((key)=>+key).sort((a, b)=>+a - +b); + }); + } + return createElement( + "div", + null, + props.hasColorMaps && colorMapping2, + createElement("h4", null, props.language.headers.selection), + createElement( + "div", + { className: `${cssPrefix}selection` }, + controlButtons, + createElement("button", { disabled: !props.hasRefinedData, onClick: (e) => props.actionHandler(Action.reset) }, "reset") + ), + props.item && createElement("h4", null, props.language.headers.details), + createElement( + "div", + null, + createElement("div", { className: `${cssPrefix}details-scroll` }, props.item && scrollButtons), + createElement("div", { className: `${cssPrefix}details` }, props.item && createElement(Table$1, { rows })) + ) + ); + }; + function linkSelect(language, columnName, value2, selectionHandler) { + return createElement( + "span", + null, + createElement("a", { href: "#", onClick: (e) => selectionHandler(columnName, value2) }, value2), + isNaN(value2) ? [" ", createElement("a", { className: "bing-search", href: `https://www.bing.com/search?q=${encodeURIComponent(value2)}`, target: "_blank" }, language.bing)] : "" + ); + } + function ensureHeaders(presenter, headers) { + const vegaControls = presenter.getElement(PresenterElement$1.vegaControls); + conditionalHeader(!!vegaControls.querySelectorAll(".vega-bindings > *").length, vegaControls, headers.chart); + const legend2 = presenter.getElement(PresenterElement$1.legend); + conditionalHeader(!!legend2.children.length, legend2, headers.legend); + } + function conditionalHeader(condition, element2, header) { + const existing = existingHeader(element2, header); + if (condition && !existing) { + addHeader(element2, header); + } + if (!condition && existing) { + existing.remove(); + } + } + function addHeader(element2, header) { + const h2 = document.createElement("h4"); + h2.innerHTML = header; + element2.insertAdjacentElement("beforebegin", h2); + } + function existingHeader(element2, header) { + const { previousElementSibling } = element2; + if (previousElementSibling && previousElementSibling.innerHTML === header) { + return previousElementSibling; + } + } + function legendRange(colorBinType, column, legend2, clickedIndex) { + if (column.quantitative) { + return selectQuantitative(colorBinType, column, legend2, clickedIndex); + } else { + return selectCategorical(column, legend2, clickedIndex); + } + } + function selectCategorical(column, legend2, clickedIndex) { + const value2 = legend2.rows[clickedIndex].value; + if (value2 === Other) { + const values2 = []; + for (const i in legend2.rows) { + if (+i !== clickedIndex) { + values2.push(legend2.rows[i].value); + } + } + return selectNone(column, values2); + } else { + return { expressions: [selectExact(column, legend2.rows[clickedIndex].value)] }; + } + } + function selectQuantitative(colorBinType, column, legend2, clickedIndex) { + const keys2 = Object.keys(legend2.rows).map((key2) => +key2).sort((a2, b2) => +a2 - +b2); let lowValue; let lowOperator; let highValue; let highOperator; - const rowText = legend.rows[clickedIndex].label; - switch(colorBinType){ - case 'continuous': - lowValue = rowText; - if (clickedIndex < keys.length - 1) highValue = legend.rows[clickedIndex + 1].value; - break; - default: - { - if (rowText.indexOf('null') > 0) { - const ex = { - expressions: [ - (0, _expression.selectNullOrEmpty)(column) - ] - }; - return ex; - } - const dash = rowText.indexOf("\u2013"); //this is not the common dash character! - if (dash > 0) { - //bug in Vega for quantize? - //lowOperator = '>'; - //highOperator = '<='; - lowValue = rowText.substr(0, dash); - highValue = rowText.substr(dash + 1); - } else { - if (rowText.indexOf('<') >= 0) highValue = rowText.substring(2); - else if (rowText.indexOf("\u2265") >= 0) lowValue = rowText.substring(2); - } + const rowText = legend2.rows[clickedIndex].label; + switch (colorBinType) { + case "continuous": { + lowValue = rowText; + if (clickedIndex < keys2.length - 1) { + highValue = legend2.rows[clickedIndex + 1].value; + } + break; + } + default: { + if (rowText.indexOf("null") > 0) { + const ex = { + expressions: [selectNullOrEmpty(column)] + }; + return ex; + } + const dash = rowText.indexOf("–"); + if (dash > 0) { + lowValue = rowText.substr(0, dash); + highValue = rowText.substr(dash + 1); + } else { + if (rowText.indexOf("<") >= 0) { + highValue = rowText.substring(2); + } else { + if (rowText.indexOf("≥") >= 0) { + lowValue = rowText.substring(2); } + } + } + } } - if (lowValue) lowValue = (0, _expression.notNice)(lowValue); - if (highValue) highValue = (0, _expression.notNice)(highValue); - if (lowValue === highValue) return { - expressions: [ - (0, _expression.selectExact)(column, lowValue) - ] - }; - else return (0, _expression.selectBetween)(column, lowValue, highValue, lowOperator, highOperator); -} -function finalizeLegend(colorBinType, colorColumn, legend, language) { + if (lowValue) + lowValue = notNice(lowValue); + if (highValue) + highValue = notNice(highValue); + if (lowValue === highValue) { + return { expressions: [selectExact(column, lowValue)] }; + } else { + return selectBetween(column, lowValue, highValue, lowOperator, highOperator); + } + } + function finalizeLegend(colorBinType, colorColumn, legend2, language) { const rowTexts = []; - for(const i in legend.rows){ - const row = legend.rows[i]; - row.search = legendRange(colorBinType, colorColumn, legend, +i); - if (row.value === (0, _sanddanceSpecs.Other)) row.label = language.legendOther; - else rowTexts.push(row.value); - } -} - -},{"@msrvida/sanddance-specs":"aOvSr","./expression":"2foo2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eRzwB":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assignOrdinals", ()=>assignOrdinals); -parcelHelpers.export(exports, "getDataIndexOfCube", ()=>getDataIndexOfCube); -var _constants = require("./constants"); -function assignOrdinals(columns, data, ordinalMap) { + for (const i in legend2.rows) { + const row = legend2.rows[i]; + row.search = legendRange(colorBinType, colorColumn, legend2, +i); + if (row.value === Other) { + row.label = language.legendOther; + } else { + rowTexts.push(row.value); + } + } + } + function assignOrdinals(columns, data2, ordinalMap) { const uCol = columns.uid && columns.uid.name; - if (ordinalMap) data.forEach((d, i)=>{ - const key = uCol ? d[uCol] : i; - d[0, _constants.GL_ORDINAL] = ordinalMap[key]; - }); - else { - ordinalMap = {}; - data.forEach((d, i)=>{ - d[0, _constants.GL_ORDINAL] = i; - const uColValue = uCol ? d[uCol] : i; - ordinalMap[uColValue] = i; - }); + if (ordinalMap) { + data2.forEach((d2, i) => { + const key2 = uCol ? d2[uCol] : i; + d2[GL_ORDINAL] = ordinalMap[key2]; + }); + } else { + ordinalMap = {}; + data2.forEach((d2, i) => { + d2[GL_ORDINAL] = i; + const uColValue = uCol ? d2[uCol] : i; + ordinalMap[uColValue] = i; + }); } return ordinalMap; -} -function getDataIndexOfCube(cube, data) { - const len = data.length; - for(let i = 0; i < len; i++){ - if (data[i][0, _constants.GL_ORDINAL] === cube.ordinal) return i; - } -} - -},{"./constants":"ix2qh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6kluJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSearchGroupFromVegaValue", ()=>getSearchGroupFromVegaValue); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _array = require("./array"); -function getSearchGroupFromVegaValue(search) { - let group; + } + function getDataIndexOfCube(cube, data2) { + const len2 = data2.length; + for (let i = 0; i < len2; i++) { + if (data2[i][GL_ORDINAL] === cube.ordinal) { + return i; + } + } + } + const { push } = util$4; + function getSearchGroupFromVegaValue(search) { + let group2; const vegaSearch = search; if (Array.isArray(vegaSearch)) { - //flatten into one group - group = { - expressions: [] - }; - vegaSearch.forEach((g)=>{ - const clonedExpressions = _vegaMorphcharts.util.clone(g.expressions).filter(Boolean); - clonedExpressions[0].clause = '&&'; - (0, _array.push)(group.expressions, clonedExpressions); - }); - } else group = vegaSearch ? { - expressions: vegaSearch.expressions.filter(Boolean) - } : null; - return group; -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","./array":"cis83","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cis83":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "allTruthy", ()=>allTruthy); -parcelHelpers.export(exports, "concat", ()=>concat); -parcelHelpers.export(exports, "push", ()=>push); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -const { allTruthy, concat, push } = (0, _vegaMorphcharts.util); - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"xDtCn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applySignalValues", ()=>applySignalValues); -parcelHelpers.export(exports, "extractSignalValuesFromView", ()=>extractSignalValuesFromView); -parcelHelpers.export(exports, "unbindSignalUI", ()=>unbindSignalUI); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -function applySignalValues(sv, b) { - if (!sv || !b || !b.signals || !b.signals.length) return; - for(const key in sv){ - const value = sv[key]; - const signalB = b.signals.filter((signal)=>signal.name === key)[0]; - if (signalB && signalB.bind) signalB.value = value; - } -} -function extractSignalValuesFromView(view, spec) { - if (!view || !spec || !spec.signals || !spec.signals.length) return; + group2 = { expressions: [] }; + vegaSearch.forEach((g) => { + const clonedExpressions = clone(g.expressions).filter(Boolean); + clonedExpressions[0].clause = "&&"; + push(group2.expressions, clonedExpressions); + }); + } else { + group2 = vegaSearch ? { expressions: vegaSearch.expressions.filter(Boolean) } : null; + } + return group2; + } + function applySignalValues(sv, b2) { + if (!sv || !b2 || !b2.signals || !b2.signals.length) + return; + for (const key2 in sv) { + const value2 = sv[key2]; + const signalB = b2.signals.filter((signal) => signal.name === key2)[0]; + if (signalB && signalB.bind) { + signalB.value = value2; + } + } + } + function extractSignalValuesFromView(view, spec) { + if (!view || !spec || !spec.signals || !spec.signals.length) + return; const result = {}; - spec.signals.forEach((signalA)=>{ - //bound to a UI control - if (signalA.bind) try { - result[signalA.name] = view.signal(signalA.name); + spec.signals.forEach((signalA) => { + if (signalA.bind) { + try { + result[signalA.name] = view.signal(signalA.name); } catch (e) { - // continue regardless of error } + } }); return result; -} -//signals not capable of handling with MorphCharts -const hideSignalUI = [ - (0, _sanddanceSpecs.SignalNames).MarkOpacity, - (0, _sanddanceSpecs.SignalNames).TextAngleX, - (0, _sanddanceSpecs.SignalNames).TextAngleY -]; -function unbindSignalUI(spec) { - spec.signals.forEach((signal)=>{ - if (hideSignalUI.indexOf(signal.name) >= 0) delete signal.bind; + } + const hideSignalUI = [ + SignalNames.MarkOpacity, + SignalNames.TextAngleX, + SignalNames.TextAngleY + ]; + function unbindSignalUI(spec) { + spec.signals.forEach((signal) => { + if (hideSignalUI.indexOf(signal.name) >= 0) { + delete signal.bind; + } }); -} - -},{"@msrvida/sanddance-specs":"aOvSr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bKbCn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Tooltip", ()=>Tooltip); -parcelHelpers.export(exports, "cleanDataItem", ()=>cleanDataItem); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _constants = require("./constants"); -var _util = require("./util"); -const { outerSize } = _vegaMorphcharts.util; -const { Table } = _vegaMorphcharts.controls; -class Tooltip { - constructor(props){ - this.props = props; - const renderProps = { - cssPrefix: props.cssPrefix, - rows: getRows(props.dataItem) - }; - this.finalizeHandler = ()=>this.destroy(); - this.element = renderTooltip(renderProps); - if (this.element) { - this.element.style.position = 'absolute'; - this.child = this.element.firstChild; - document.body.appendChild(this.element); - //measure and move as necessary - let m = outerSize(this.child); - while(m.height > document.documentElement.clientHeight){ - const tr = this.child.querySelector('tr:last-child'); - if (tr) tr.parentElement.removeChild(tr); - else break; - m = outerSize(this.child); - } - let position; - const te = props.event; - if (te.touches) position = te[0]; - else { - const pme = props.event; - position = pme; - } - if (position.clientX + m.width >= document.documentElement.clientWidth) this.child.style.right = '0'; - let moveTop = true; - if (position.clientY + m.height >= document.documentElement.clientHeight) { - if (position.clientY - m.height > 0) this.child.style.bottom = '0'; - else moveTop = false; - } - if (moveTop) this.element.style.top = `${position.clientY}px`; - this.element.style.left = `${position.clientX}px`; - this.child.addEventListener('mouseenter', this.finalizeHandler); - this.child.addEventListener('mousemove', this.finalizeHandler); - this.child.addEventListener('mouseover', this.finalizeHandler); + } + const { outerSize } = util$4; + const { Table } = controls; + let Tooltip$1 = class Tooltip { + constructor(props) { + this.props = props; + const renderProps = { + cssPrefix: props.cssPrefix, + rows: getRows(props.dataItem) + }; + this.finalizeHandler = () => this.destroy(); + this.element = renderTooltip(renderProps); + if (this.element) { + this.element.style.position = "absolute"; + this.child = this.element.firstChild; + document.body.appendChild(this.element); + let m2 = outerSize(this.child); + while (m2.height > document.documentElement.clientHeight) { + const tr2 = this.child.querySelector("tr:last-child"); + if (tr2) { + tr2.parentElement.removeChild(tr2); + } else { + break; + } + m2 = outerSize(this.child); } + let position2; + const te = props.event; + if (te.touches) { + position2 = te[0]; + } else { + const pme = props.event; + position2 = pme; + } + if (position2.clientX + m2.width >= document.documentElement.clientWidth) { + this.child.style.right = "0"; + } + let moveTop = true; + if (position2.clientY + m2.height >= document.documentElement.clientHeight) { + if (position2.clientY - m2.height > 0) { + this.child.style.bottom = "0"; + } else { + moveTop = false; + } + } + if (moveTop) { + this.element.style.top = `${position2.clientY}px`; + } + this.element.style.left = `${position2.clientX}px`; + this.child.addEventListener("mouseenter", this.finalizeHandler); + this.child.addEventListener("mousemove", this.finalizeHandler); + this.child.addEventListener("mouseover", this.finalizeHandler); + } } destroy() { - this.child.removeEventListener('mouseenter', this.finalizeHandler); - this.child.removeEventListener('mousemove', this.finalizeHandler); - this.child.removeEventListener('mouseover', this.finalizeHandler); - if (this.element) document.body.removeChild(this.element); - this.element = null; - } -} -function cleanDataItem(item) { - const ret = {}; - for(const columnName in item){ - if (columnName === (0, _constants.GL_ORDINAL)) continue; - if ((0, _util.isInternalFieldName)(columnName)) continue; - ret[columnName] = item[columnName]; - } - return ret; -} -function getRows(item) { - const rows = []; - for(const columnName in item){ - const value = item[columnName]; - let content; - switch(value){ - case null: - content = _vegaMorphcharts.util.createElement("i", null, "null"); - break; - case undefined: - content = _vegaMorphcharts.util.createElement("i", null, "undefined"); - break; - default: - content = value.toString(); - } - //} - rows.push({ - cells: [ - { - content: columnName + ':' - }, - { - content - } - ] - }); - } - return rows; -} -const renderTooltip = (props)=>{ - return props.rows.length === 0 ? null : _vegaMorphcharts.util.createElement("div", { - className: `${props.cssPrefix}tooltip` - }, Table({ - rows: props.rows - })); -}; - -},{"@msrvida/vega-morphcharts":"9Sd5M","./constants":"ix2qh","./util":"g08sL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"grMul":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CharacterSet", ()=>CharacterSet); -class CharacterSet { - resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { - if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) this.chars = undefined; - } - getCharacterSet(stage) { - if (!this.chars) { - const map = {}; - const addText = (text)=>{ - Array.from(text).forEach((char)=>{ - map[char] = true; - }); - }; - stage.textData.forEach((t)=>addText(t.text)); - const { x, y } = stage.axes; - [ - x, - y - ].forEach((axes)=>{ - axes.forEach((axis)=>{ - if (axis.tickText) axis.tickText.forEach((t)=>addText(t.text)); - if (axis.title) addText(axis.title.text); - }); - }); - this.chars = Object.keys(map); - } - return this.chars; - } -} -function needsNewCharacterSet(oldInsight, newInsight) { - if (!oldInsight) return true; - if (!newInsight) return true; - if (oldInsight.chart !== newInsight.chart) return true; - if (oldInsight.facetStyle !== newInsight.facetStyle) return true; - if (oldInsight.totalStyle !== newInsight.totalStyle) return true; - if (oldInsight.hideAxes !== newInsight.hideAxes) return true; - if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) return true; - if (differentObjectValues(oldInsight.size, newInsight.size)) return true; - const oldColumns = oldInsight.columns; - const newColumns = newInsight.columns; - if (oldColumns.facet !== newColumns.facet) return true; - if (oldColumns.facetV !== newColumns.facetV) return true; - if (oldColumns.x !== newColumns.x) return true; - if (oldColumns.y !== newColumns.y) return true; - if (oldColumns.z !== newColumns.z) return true; - return false; -} -function differentObjectValues(a, b) { - if (!a && !b) return false; - if (!a || !b) return true; - const keys = Object.keys(b); - for(let i = 0; i < keys.length; i++){ - const key = keys[i]; - const ta = typeof a; - const tb = typeof b; - if (ta !== tb) return true; - if (ta === 'object') return differentObjectValues(a[key], b[key]); - else { - if (a[key] !== b[key]) return true; - } + this.child.removeEventListener("mouseenter", this.finalizeHandler); + this.child.removeEventListener("mousemove", this.finalizeHandler); + this.child.removeEventListener("mouseover", this.finalizeHandler); + if (this.element) { + document.body.removeChild(this.element); + } + this.element = null; } - return false; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fNWAw":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assignTransitionStagger", ()=>assignTransitionStagger); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _d3Scale = require("d3-scale"); -var _constants = require("./constants"); -function assignTransitionStagger(transition, currentData, selection, presenter) { - const { layerStagger } = presenter.morphchartsref; - const { morphChartsRenderResult } = presenter; - const cubelayer = morphChartsRenderResult.getCubeLayer(); - const range = transition.reverse ? [ - 1, - 0 - ] : [ - 0, - 1 - ]; - if (!transition || transition.type === 'ordinal' && !transition.reverse) delete layerStagger.cubes; - else { - const staggerOrders = new Float64Array(cubelayer.positionsX.length); - switch(transition.type){ - case 'ordinal': - { - //reverse ordinal - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - 0, - currentData.length - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(i); - }); - break; - } - case 'column': - if (transition.column.quantitative) { - const values = new Float64Array(currentData.length); - currentData.forEach((datum, i)=>{ - values[i] = datum[transition.column.name]; - }); - const stats = (0, _sanddanceSpecs.getStats)(currentData, transition.column); - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - stats.min, - stats.max - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(values[i]); - }); - } else { - const strings = new Array(currentData.length); - currentData.forEach((datum, i)=>{ - strings[i] = datum[transition.column.name]; - }); - (0, _sanddanceSpecs.getStats)(currentData, transition.column, (distictValues)=>{ - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - const index = distictValues.indexOf(strings[i]); - const staggerOrder = index / distictValues.length; - staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; - }); - }); - } - break; - case 'position': - { - const dimensions = { - x: cubelayer.positionsX, - y: cubelayer.positionsY, - z: cubelayer.positionsZ - }; - const positions = dimensions[transition.dimension]; - const values = new Float64Array(currentData.length); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - values[i] = positions[glOrdinal]; - }); - const stats = (0, _sanddanceSpecs.getStats)(values, null, 'number', true); - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - stats.min, - stats.max - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(values[i]); - }); - break; - } - } - layerStagger.cubes = { - staggerOrders, - maxStaggerOrder: 1, - minStaggerOrder: 0 - }; + }; + function cleanDataItem(item) { + const ret = {}; + for (const columnName in item) { + if (columnName === GL_ORDINAL) { + continue; + } + if (isInternalFieldName(columnName)) { + continue; + } + ret[columnName] = item[columnName]; } - cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); -} - -},{"@msrvida/sanddance-specs":"aOvSr","d3-scale":"1PRVx","./constants":"ix2qh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1PRVx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleBand", ()=>(0, _bandJsDefault.default)); -parcelHelpers.export(exports, "scalePoint", ()=>(0, _bandJs.point)); -parcelHelpers.export(exports, "scaleIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "scaleLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "scaleLog", ()=>(0, _logJsDefault.default)); -parcelHelpers.export(exports, "scaleSymlog", ()=>(0, _symlogJsDefault.default)); -parcelHelpers.export(exports, "scaleOrdinal", ()=>(0, _ordinalJsDefault.default)); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _ordinalJs.implicit)); -parcelHelpers.export(exports, "scalePow", ()=>(0, _powJsDefault.default)); -parcelHelpers.export(exports, "scaleSqrt", ()=>(0, _powJs.sqrt)); -parcelHelpers.export(exports, "scaleRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "scaleThreshold", ()=>(0, _thresholdJsDefault.default)); -parcelHelpers.export(exports, "scaleTime", ()=>(0, _timeJsDefault.default)); -parcelHelpers.export(exports, "scaleUtc", ()=>(0, _utcTimeJsDefault.default)); -parcelHelpers.export(exports, "scaleSequential", ()=>(0, _sequentialJsDefault.default)); -parcelHelpers.export(exports, "scaleSequentialLog", ()=>(0, _sequentialJs.sequentialLog)); -parcelHelpers.export(exports, "scaleSequentialPow", ()=>(0, _sequentialJs.sequentialPow)); -parcelHelpers.export(exports, "scaleSequentialSqrt", ()=>(0, _sequentialJs.sequentialSqrt)); -parcelHelpers.export(exports, "scaleSequentialSymlog", ()=>(0, _sequentialJs.sequentialSymlog)); -parcelHelpers.export(exports, "scaleSequentialQuantile", ()=>(0, _sequentialQuantileJsDefault.default)); -parcelHelpers.export(exports, "scaleDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "scaleDivergingLog", ()=>(0, _divergingJs.divergingLog)); -parcelHelpers.export(exports, "scaleDivergingPow", ()=>(0, _divergingJs.divergingPow)); -parcelHelpers.export(exports, "scaleDivergingSqrt", ()=>(0, _divergingJs.divergingSqrt)); -parcelHelpers.export(exports, "scaleDivergingSymlog", ()=>(0, _divergingJs.divergingSymlog)); -parcelHelpers.export(exports, "tickFormat", ()=>(0, _tickFormatJsDefault.default)); -var _bandJs = require("./band.js"); -var _bandJsDefault = parcelHelpers.interopDefault(_bandJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _linearJs = require("./linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _logJs = require("./log.js"); -var _logJsDefault = parcelHelpers.interopDefault(_logJs); -var _symlogJs = require("./symlog.js"); -var _symlogJsDefault = parcelHelpers.interopDefault(_symlogJs); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -var _powJs = require("./pow.js"); -var _powJsDefault = parcelHelpers.interopDefault(_powJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _thresholdJs = require("./threshold.js"); -var _thresholdJsDefault = parcelHelpers.interopDefault(_thresholdJs); -var _timeJs = require("./time.js"); -var _timeJsDefault = parcelHelpers.interopDefault(_timeJs); -var _utcTimeJs = require("./utcTime.js"); -var _utcTimeJsDefault = parcelHelpers.interopDefault(_utcTimeJs); -var _sequentialJs = require("./sequential.js"); -var _sequentialJsDefault = parcelHelpers.interopDefault(_sequentialJs); -var _sequentialQuantileJs = require("./sequentialQuantile.js"); -var _sequentialQuantileJsDefault = parcelHelpers.interopDefault(_sequentialQuantileJs); -var _divergingJs = require("./diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); - -},{"./band.js":"a1xEx","./identity.js":"e07Nz","./linear.js":"ik2PQ","./log.js":"5BBe1","./symlog.js":"26cMO","./ordinal.js":"cg12q","./pow.js":"ah9R8","./radial.js":"eL6SH","./quantile.js":"ENbdr","./quantize.js":"4Cxz6","./threshold.js":"lQqvO","./time.js":"dtq1F","./utcTime.js":"iLPRP","./sequential.js":"e0eA3","./sequentialQuantile.js":"i0IcB","./diverging.js":"6Pqcc","./tickFormat.js":"fHwUM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a1xEx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>band); -parcelHelpers.export(exports, "point", ()=>point); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -function band() { - var scale = (0, _ordinalJsDefault.default)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1; - step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); - var values = (0, _d3Array.range)(n).map(function(i) { - return start + step * i; + return ret; + } + function getRows(item) { + const rows = []; + for (const columnName in item) { + const value2 = item[columnName]; + let content2; + switch (value2) { + case null: + content2 = createElement("i", null, "null"); + break; + case void 0: + content2 = createElement("i", null, "undefined"); + break; + default: + content2 = value2.toString(); + } + rows.push({ + cells: [ + { content: columnName + ":" }, + { content: content2 } + ] + }); + } + return rows; + } + const renderTooltip = (props) => { + return props.rows.length === 0 ? null : createElement("div", { className: `${props.cssPrefix}tooltip` }, Table({ rows: props.rows })); + }; + class CharacterSet { + resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { + if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) { + this.chars = void 0; + } + } + getCharacterSet(stage) { + if (!this.chars) { + const map2 = {}; + const addText = (text2) => { + Array.from(text2).forEach((char) => { + map2[char] = true; + }); + }; + stage.textData.forEach((t) => addText(t.text)); + const { x: x2, y: y2 } = stage.axes; + [x2, y2].forEach((axes) => { + axes.forEach((axis) => { + if (axis.tickText) + axis.tickText.forEach((t) => addText(t.text)); + if (axis.title) + addText(axis.title.text); + }); }); - return ordinalRange(reverse ? values.reverse() : values); + this.chars = Object.keys(map2); + } + return this.chars; } - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.range = function(_) { - return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [ - r0, - r1 - ]; - }; - scale.rangeRound = function(_) { - return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale(); - }; - scale.bandwidth = function() { - return bandwidth; - }; - scale.step = function() { - return step; - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, rescale()) : round; - }; - scale.padding = function(_) { - return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner; - }; - scale.paddingInner = function(_) { - return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner; - }; - scale.paddingOuter = function(_) { - return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter; - }; - scale.align = function(_) { - return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; - }; - scale.copy = function() { - return band(domain(), [ - r0, - r1 - ]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - return (0, _initJs.initRange).apply(rescale(), arguments); -} -function pointish(scale) { - var copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - delete scale.paddingOuter; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band.apply(null, arguments).paddingInner(1)); -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","./ordinal.js":"cg12q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5lCYW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisect", ()=>(0, _bisectJsDefault.default)); -parcelHelpers.export(exports, "bisectRight", ()=>(0, _bisectJs.bisectRight)); -parcelHelpers.export(exports, "bisectLeft", ()=>(0, _bisectJs.bisectLeft)); -parcelHelpers.export(exports, "bisectCenter", ()=>(0, _bisectJs.bisectCenter)); -parcelHelpers.export(exports, "ascending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "bisector", ()=>(0, _bisectorJsDefault.default)); -parcelHelpers.export(exports, "blur", ()=>(0, _blurJs.blur)); -parcelHelpers.export(exports, "blur2", ()=>(0, _blurJs.blur2)); -parcelHelpers.export(exports, "blurImage", ()=>(0, _blurJs.blurImage)); -parcelHelpers.export(exports, "count", ()=>(0, _countJsDefault.default)); -parcelHelpers.export(exports, "cross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "cumsum", ()=>(0, _cumsumJsDefault.default)); -parcelHelpers.export(exports, "descending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "deviation", ()=>(0, _deviationJsDefault.default)); -parcelHelpers.export(exports, "extent", ()=>(0, _extentJsDefault.default)); -parcelHelpers.export(exports, "Adder", ()=>(0, _fsumJs.Adder)); -parcelHelpers.export(exports, "fsum", ()=>(0, _fsumJs.fsum)); -parcelHelpers.export(exports, "fcumsum", ()=>(0, _fsumJs.fcumsum)); -parcelHelpers.export(exports, "group", ()=>(0, _groupJsDefault.default)); -parcelHelpers.export(exports, "flatGroup", ()=>(0, _groupJs.flatGroup)); -parcelHelpers.export(exports, "flatRollup", ()=>(0, _groupJs.flatRollup)); -parcelHelpers.export(exports, "groups", ()=>(0, _groupJs.groups)); -parcelHelpers.export(exports, "index", ()=>(0, _groupJs.index)); -parcelHelpers.export(exports, "indexes", ()=>(0, _groupJs.indexes)); -parcelHelpers.export(exports, "rollup", ()=>(0, _groupJs.rollup)); -parcelHelpers.export(exports, "rollups", ()=>(0, _groupJs.rollups)); -parcelHelpers.export(exports, "groupSort", ()=>(0, _groupSortJsDefault.default)); -parcelHelpers.export(exports, "bin", ()=>(0, _binJsDefault.default)) // Deprecated; use bin. -; -parcelHelpers.export(exports, "histogram", ()=>(0, _binJsDefault.default)); -parcelHelpers.export(exports, "thresholdFreedmanDiaconis", ()=>(0, _freedmanDiaconisJsDefault.default)); -parcelHelpers.export(exports, "thresholdScott", ()=>(0, _scottJsDefault.default)); -parcelHelpers.export(exports, "thresholdSturges", ()=>(0, _sturgesJsDefault.default)); -parcelHelpers.export(exports, "max", ()=>(0, _maxJsDefault.default)); -parcelHelpers.export(exports, "maxIndex", ()=>(0, _maxIndexJsDefault.default)); -parcelHelpers.export(exports, "mean", ()=>(0, _meanJsDefault.default)); -parcelHelpers.export(exports, "median", ()=>(0, _medianJsDefault.default)); -parcelHelpers.export(exports, "medianIndex", ()=>(0, _medianJs.medianIndex)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "min", ()=>(0, _minJsDefault.default)); -parcelHelpers.export(exports, "minIndex", ()=>(0, _minIndexJsDefault.default)); -parcelHelpers.export(exports, "mode", ()=>(0, _modeJsDefault.default)); -parcelHelpers.export(exports, "nice", ()=>(0, _niceJsDefault.default)); -parcelHelpers.export(exports, "pairs", ()=>(0, _pairsJsDefault.default)); -parcelHelpers.export(exports, "permute", ()=>(0, _permuteJsDefault.default)); -parcelHelpers.export(exports, "quantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "quantileIndex", ()=>(0, _quantileJs.quantileIndex)); -parcelHelpers.export(exports, "quantileSorted", ()=>(0, _quantileJs.quantileSorted)); -parcelHelpers.export(exports, "quickselect", ()=>(0, _quickselectJsDefault.default)); -parcelHelpers.export(exports, "range", ()=>(0, _rangeJsDefault.default)); -parcelHelpers.export(exports, "rank", ()=>(0, _rankJsDefault.default)); -parcelHelpers.export(exports, "least", ()=>(0, _leastJsDefault.default)); -parcelHelpers.export(exports, "leastIndex", ()=>(0, _leastIndexJsDefault.default)); -parcelHelpers.export(exports, "greatest", ()=>(0, _greatestJsDefault.default)); -parcelHelpers.export(exports, "greatestIndex", ()=>(0, _greatestIndexJsDefault.default)); -parcelHelpers.export(exports, "scan", ()=>(0, _scanJsDefault.default)) // Deprecated; use leastIndex. -; -parcelHelpers.export(exports, "shuffle", ()=>(0, _shuffleJsDefault.default)); -parcelHelpers.export(exports, "shuffler", ()=>(0, _shuffleJs.shuffler)); -parcelHelpers.export(exports, "sum", ()=>(0, _sumJsDefault.default)); -parcelHelpers.export(exports, "ticks", ()=>(0, _ticksJsDefault.default)); -parcelHelpers.export(exports, "tickIncrement", ()=>(0, _ticksJs.tickIncrement)); -parcelHelpers.export(exports, "tickStep", ()=>(0, _ticksJs.tickStep)); -parcelHelpers.export(exports, "transpose", ()=>(0, _transposeJsDefault.default)); -parcelHelpers.export(exports, "variance", ()=>(0, _varianceJsDefault.default)); -parcelHelpers.export(exports, "zip", ()=>(0, _zipJsDefault.default)); -parcelHelpers.export(exports, "every", ()=>(0, _everyJsDefault.default)); -parcelHelpers.export(exports, "some", ()=>(0, _someJsDefault.default)); -parcelHelpers.export(exports, "filter", ()=>(0, _filterJsDefault.default)); -parcelHelpers.export(exports, "map", ()=>(0, _mapJsDefault.default)); -parcelHelpers.export(exports, "reduce", ()=>(0, _reduceJsDefault.default)); -parcelHelpers.export(exports, "reverse", ()=>(0, _reverseJsDefault.default)); -parcelHelpers.export(exports, "sort", ()=>(0, _sortJsDefault.default)); -parcelHelpers.export(exports, "difference", ()=>(0, _differenceJsDefault.default)); -parcelHelpers.export(exports, "disjoint", ()=>(0, _disjointJsDefault.default)); -parcelHelpers.export(exports, "intersection", ()=>(0, _intersectionJsDefault.default)); -parcelHelpers.export(exports, "subset", ()=>(0, _subsetJsDefault.default)); -parcelHelpers.export(exports, "superset", ()=>(0, _supersetJsDefault.default)); -parcelHelpers.export(exports, "union", ()=>(0, _unionJsDefault.default)); -parcelHelpers.export(exports, "InternMap", ()=>(0, _internmap.InternMap)); -parcelHelpers.export(exports, "InternSet", ()=>(0, _internmap.InternSet)); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _blurJs = require("./blur.js"); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _crossJs = require("./cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _cumsumJs = require("./cumsum.js"); -var _cumsumJsDefault = parcelHelpers.interopDefault(_cumsumJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _deviationJs = require("./deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _fsumJs = require("./fsum.js"); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _groupSortJs = require("./groupSort.js"); -var _groupSortJsDefault = parcelHelpers.interopDefault(_groupSortJs); -var _binJs = require("./bin.js"); -var _binJsDefault = parcelHelpers.interopDefault(_binJs); -var _freedmanDiaconisJs = require("./threshold/freedmanDiaconis.js"); -var _freedmanDiaconisJsDefault = parcelHelpers.interopDefault(_freedmanDiaconisJs); -var _scottJs = require("./threshold/scott.js"); -var _scottJsDefault = parcelHelpers.interopDefault(_scottJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _meanJs = require("./mean.js"); -var _meanJsDefault = parcelHelpers.interopDefault(_meanJs); -var _medianJs = require("./median.js"); -var _medianJsDefault = parcelHelpers.interopDefault(_medianJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _modeJs = require("./mode.js"); -var _modeJsDefault = parcelHelpers.interopDefault(_modeJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _pairsJs = require("./pairs.js"); -var _pairsJsDefault = parcelHelpers.interopDefault(_pairsJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _rangeJs = require("./range.js"); -var _rangeJsDefault = parcelHelpers.interopDefault(_rangeJs); -var _rankJs = require("./rank.js"); -var _rankJsDefault = parcelHelpers.interopDefault(_rankJs); -var _leastJs = require("./least.js"); -var _leastJsDefault = parcelHelpers.interopDefault(_leastJs); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -var _greatestIndexJs = require("./greatestIndex.js"); -var _greatestIndexJsDefault = parcelHelpers.interopDefault(_greatestIndexJs); -var _scanJs = require("./scan.js"); -var _scanJsDefault = parcelHelpers.interopDefault(_scanJs); -var _shuffleJs = require("./shuffle.js"); -var _shuffleJsDefault = parcelHelpers.interopDefault(_shuffleJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -var _zipJs = require("./zip.js"); -var _zipJsDefault = parcelHelpers.interopDefault(_zipJs); -var _everyJs = require("./every.js"); -var _everyJsDefault = parcelHelpers.interopDefault(_everyJs); -var _someJs = require("./some.js"); -var _someJsDefault = parcelHelpers.interopDefault(_someJs); -var _filterJs = require("./filter.js"); -var _filterJsDefault = parcelHelpers.interopDefault(_filterJs); -var _mapJs = require("./map.js"); -var _mapJsDefault = parcelHelpers.interopDefault(_mapJs); -var _reduceJs = require("./reduce.js"); -var _reduceJsDefault = parcelHelpers.interopDefault(_reduceJs); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _differenceJs = require("./difference.js"); -var _differenceJsDefault = parcelHelpers.interopDefault(_differenceJs); -var _disjointJs = require("./disjoint.js"); -var _disjointJsDefault = parcelHelpers.interopDefault(_disjointJs); -var _intersectionJs = require("./intersection.js"); -var _intersectionJsDefault = parcelHelpers.interopDefault(_intersectionJs); -var _subsetJs = require("./subset.js"); -var _subsetJsDefault = parcelHelpers.interopDefault(_subsetJs); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -var _unionJs = require("./union.js"); -var _unionJsDefault = parcelHelpers.interopDefault(_unionJs); -var _internmap = require("internmap"); - -},{"./bisect.js":"5mqeI","./ascending.js":"zAyXo","./bisector.js":"49VDk","./blur.js":"jfE0Q","./count.js":"6vIaU","./cross.js":"jUp0X","./cumsum.js":"h3OPK","./descending.js":"fbB9Y","./deviation.js":"6718P","./extent.js":"5JWQp","./fsum.js":"3h28A","./group.js":"kABha","./groupSort.js":"kyLtP","./bin.js":"6hfwu","./threshold/freedmanDiaconis.js":"2dRyq","./threshold/scott.js":"lGg25","./threshold/sturges.js":"1lIJb","./max.js":"8YwYZ","./maxIndex.js":"l9rNy","./mean.js":"fVfCV","./median.js":"awkrD","./merge.js":"liJWL","./min.js":"6iq65","./minIndex.js":"8xCGl","./mode.js":"2Kgrp","./nice.js":"e63B5","./pairs.js":"c2ViX","./permute.js":"eud3x","./quantile.js":"29jB7","./quickselect.js":"pm9zy","./range.js":"7i9on","./rank.js":"kd13S","./least.js":"ceK4t","./leastIndex.js":"dW25b","./greatest.js":"jrFax","./greatestIndex.js":"dL9ui","./scan.js":"bmKwW","./shuffle.js":"3ZIpU","./sum.js":"8SwUe","./ticks.js":"fmECo","./transpose.js":"1Ej71","./variance.js":"881VG","./zip.js":"f7Krc","./every.js":"agCBw","./some.js":"3LqiV","./filter.js":"9mlS9","./map.js":"ePJbS","./reduce.js":"h3fvA","./reverse.js":"lg91e","./sort.js":"93lWn","./difference.js":"jJaFT","./disjoint.js":"ewThO","./intersection.js":"3dVn4","./subset.js":"fO88f","./superset.js":"6zbJQ","./union.js":"loYUW","internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5mqeI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisectRight", ()=>bisectRight); -parcelHelpers.export(exports, "bisectLeft", ()=>bisectLeft); -parcelHelpers.export(exports, "bisectCenter", ()=>bisectCenter); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -const ascendingBisect = (0, _bisectorJsDefault.default)((0, _ascendingJsDefault.default)); -const bisectRight = ascendingBisect.right; -const bisectLeft = ascendingBisect.left; -const bisectCenter = (0, _bisectorJsDefault.default)((0, _numberJsDefault.default)).center; -exports.default = bisectRight; - -},{"./ascending.js":"zAyXo","./bisector.js":"49VDk","./number.js":"gSG0m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"zAyXo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ascending); -function ascending(a, b) { - return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49VDk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bisector); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -function bisector(f) { - let compare1, compare2, delta; - // If an accessor is specified, promote it to a comparator. In this case we - // can test whether the search value is (self-) comparable. We can’t do this - // for a comparator (except for specific, known comparators) because we can’t - // tell if the comparator is symmetric, and an asymmetric comparator can’t be - // used to test whether a single value is comparable. + } + function needsNewCharacterSet(oldInsight, newInsight) { + if (!oldInsight) + return true; + if (!newInsight) + return true; + if (oldInsight.chart !== newInsight.chart) + return true; + if (oldInsight.facetStyle !== newInsight.facetStyle) + return true; + if (oldInsight.totalStyle !== newInsight.totalStyle) + return true; + if (oldInsight.hideAxes !== newInsight.hideAxes) + return true; + if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) + return true; + if (differentObjectValues(oldInsight.size, newInsight.size)) + return true; + const oldColumns = oldInsight.columns; + const newColumns = newInsight.columns; + if (oldColumns.facet !== newColumns.facet) + return true; + if (oldColumns.facetV !== newColumns.facetV) + return true; + if (oldColumns.x !== newColumns.x) + return true; + if (oldColumns.y !== newColumns.y) + return true; + if (oldColumns.z !== newColumns.z) + return true; + return false; + } + function differentObjectValues(a2, b2) { + if (!a2 && !b2) + return false; + if (!a2 || !b2) + return true; + const keys2 = Object.keys(b2); + for (let i = 0; i < keys2.length; i++) { + const key2 = keys2[i]; + const ta = typeof a2; + const tb = typeof b2; + if (ta !== tb) + return true; + if (ta === "object") { + return differentObjectValues(a2[key2], b2[key2]); + } else { + if (a2[key2] !== b2[key2]) + return true; + } + } + return false; + } + function ascending$2(a2, b2) { + return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN; + } + function descending$1(a2, b2) { + return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN; + } + function bisector(f) { + let compare12, compare2, delta; if (f.length !== 2) { - compare1 = (0, _ascendingJsDefault.default); - compare2 = (d, x)=>(0, _ascendingJsDefault.default)(f(d), x); - delta = (d, x)=>f(d) - x; + compare12 = ascending$2; + compare2 = (d2, x2) => ascending$2(f(d2), x2); + delta = (d2, x2) => f(d2) - x2; } else { - compare1 = f === (0, _ascendingJsDefault.default) || f === (0, _descendingJsDefault.default) ? f : zero; - compare2 = f; - delta = f; + compare12 = f === ascending$2 || f === descending$1 ? f : zero$3; + compare2 = f; + delta = f; } - function left(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) < 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); - } - return lo; + function left(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) < 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; } - function right(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) <= 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); - } - return lo; + function right(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) <= 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; } - function center(a, x, lo = 0, hi = a.length) { - const i = left(a, x, lo, hi - 1); - return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; + function center(a2, x2, lo = 0, hi = a2.length) { + const i = left(a2, x2, lo, hi - 1); + return i > lo && delta(a2[i - 1], x2) > -delta(a2[i], x2) ? i - 1 : i; } - return { - left, - center, - right - }; -} -function zero() { + return { left, center, right }; + } + function zero$3() { return 0; -} - -},{"./ascending.js":"zAyXo","./descending.js":"fbB9Y","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fbB9Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>descending); -function descending(a, b) { - return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gSG0m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -parcelHelpers.export(exports, "numbers", ()=>numbers); -function number(x) { - return x === null ? NaN : +x; -} -function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) yield value; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jfE0Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "blur", ()=>blur); -parcelHelpers.export(exports, "blur2", ()=>blur2); -parcelHelpers.export(exports, "blurImage", ()=>blurImage); -function blur(values, r) { - if (!((r = +r) >= 0)) throw new RangeError("invalid r"); - let length = values.length; - if (!((length = Math.floor(length)) >= 0)) throw new RangeError("invalid length"); - if (!length || !r) return values; - const blur = blurf(r); - const temp = values.slice(); - blur(values, temp, 0, length, 1); - blur(temp, values, 0, length, 1); - blur(values, temp, 0, length, 1); - return values; -} -const blur2 = Blur2(blurf); -const blurImage = Blur2(blurfImage); -function Blur2(blur) { - return function(data, rx, ry = rx) { - if (!((rx = +rx) >= 0)) throw new RangeError("invalid rx"); - if (!((ry = +ry) >= 0)) throw new RangeError("invalid ry"); - let { data: values, width, height } = data; - if (!((width = Math.floor(width)) >= 0)) throw new RangeError("invalid width"); - if (!((height = Math.floor(height !== undefined ? height : values.length / width)) >= 0)) throw new RangeError("invalid height"); - if (!width || !height || !rx && !ry) return data; - const blurx = rx && blur(rx); - const blury = ry && blur(ry); - const temp = values.slice(); - if (blurx && blury) { - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } else if (blurx) { - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - } else if (blury) { - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } - return data; - }; -} -function blurh(blur, T, S, w, h) { - for(let y = 0, n = w * h; y < n;)blur(T, S, y, y += w, 1); -} -function blurv(blur, T, S, w, h) { - for(let x = 0, n = w * h; x < w; ++x)blur(T, S, x, x + n, w); -} -function blurfImage(radius) { - const blur = blurf(radius); - return (T, S, start, stop, step)=>{ - start <<= 2, stop <<= 2, step <<= 2; - blur(T, S, start + 0, stop + 0, step); - blur(T, S, start + 1, stop + 1, step); - blur(T, S, start + 2, stop + 2, step); - blur(T, S, start + 3, stop + 3, step); - }; -} -// Given a target array T, a source array S, sets each value T[i] to the average -// of {S[i - r], …, S[i], …, S[i + r]}, where r = ⌊radius⌋, start <= i < stop, -// for each i, i + step, i + 2 * step, etc., and where S[j] is clamped between -// S[start] (inclusive) and S[stop] (exclusive). If the given radius is not an -// integer, S[i - r - 1] and S[i + r + 1] are added to the sum, each weighted -// according to r - ⌊radius⌋. -function blurf(radius) { - const radius0 = Math.floor(radius); - if (radius0 === radius) return bluri(radius); - const t = radius - radius0; - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius0 * S[start]; - const s0 = step * radius0; - const s1 = s0 + step; - for(let i = start, j = start + s0; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s0)]; - T[i] = (sum + t * (S[Math.max(start, i - s1)] + S[Math.min(stop, i + s1)])) / w; - sum -= S[Math.max(start, i - s0)]; - } - }; -} -// Like blurf, but optimized for integer radius. -function bluri(radius) { - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius * S[start]; - const s = step * radius; - for(let i = start, j = start + s; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s)]; - T[i] = sum / w; - sum -= S[Math.max(start, i - s)]; - } - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6vIaU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>count); -function count(values, valueof) { - let count = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count; - } - return count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jUp0X":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cross); -function length(array) { - return array.length | 0; -} -function empty(length) { - return !(length > 0); -} -function arrayify(values) { - return typeof values !== "object" || "length" in values ? values : Array.from(values); -} -function reducer(reduce) { - return (values)=>reduce(...values); -} -function cross(...values) { - const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop()); - values = values.map(arrayify); - const lengths = values.map(length); - const j = values.length - 1; - const index = new Array(j + 1).fill(0); - const product = []; - if (j < 0 || lengths.some(empty)) return product; - while(true){ - product.push(index.map((j, i)=>values[i][j])); - let i = j; - while(++index[i] === lengths[i]){ - if (i === 0) return reduce ? product.map(reduce) : product; - index[i--] = 0; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h3OPK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cumsum); -function cumsum(values, valueof) { - var sum = 0, index = 0; - return Float64Array.from(values, valueof === undefined ? (v)=>sum += +v || 0 : (v)=>sum += +valueof(v, index++, values) || 0); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6718P":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>deviation); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -function deviation(values, valueof) { - const v = (0, _varianceJsDefault.default)(values, valueof); - return v ? Math.sqrt(v) : v; -} - -},{"./variance.js":"881VG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"881VG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>variance); -function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); + } + function number$6(x2) { + return x2 === null ? NaN : +x2; + } + function* numbers$2(values2, valueof) { + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + yield value2; } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - if (count > 1) return sum / (count - 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5JWQp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>extent); -function extent(values, valueof) { - let min; - let max; - if (valueof === undefined) { - for (const value of values)if (value != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + yield value2; } + } + } + } + const ascendingBisect = bisector(ascending$2); + const bisectRight$1 = ascendingBisect.right; + const bisectLeft$1 = ascendingBisect.left; + bisector(number$6).center; + function variance(values2, valueof) { + let count2 = 0; + let delta; + let mean2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); + } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); } + } } - return [ - min, - max - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3h28A":[function(require,module,exports,__globalThis) { -// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423 -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Adder", ()=>Adder); -parcelHelpers.export(exports, "fsum", ()=>fsum); -parcelHelpers.export(exports, "fcumsum", ()=>fcumsum); -class Adder { - constructor(){ - this._partials = new Float64Array(32); - this._n = 0; - } - add(x) { - const p = this._partials; - let i = 0; - for(let j = 0; j < this._n && j < 32; j++){ - const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); - if (lo) p[i++] = lo; - x = hi; - } - p[i] = x; - this._n = i + 1; - return this; + if (count2 > 1) return sum2 / (count2 - 1); + } + function deviation(values2, valueof) { + const v = variance(values2, valueof); + return v ? Math.sqrt(v) : v; + } + class Adder { + constructor() { + this._partials = new Float64Array(32); + this._n = 0; + } + add(x2) { + const p = this._partials; + let i = 0; + for (let j = 0; j < this._n && j < 32; j++) { + const y2 = p[j], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2); + if (lo) p[i++] = lo; + x2 = hi; + } + p[i] = x2; + this._n = i + 1; + return this; } valueOf() { - const p = this._partials; - let n = this._n, x, y, lo, hi = 0; - if (n > 0) { - hi = p[--n]; - while(n > 0){ - x = hi; - y = p[--n]; - hi = x + y; - lo = y - (hi - x); - if (lo) break; - } - if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { - y = lo * 2; - x = hi + y; - if (y == x - hi) hi = x; - } + const p = this._partials; + let n = this._n, x2, y2, lo, hi = 0; + if (n > 0) { + hi = p[--n]; + while (n > 0) { + x2 = hi; + y2 = p[--n]; + hi = x2 + y2; + lo = y2 - (hi - x2); + if (lo) break; + } + if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { + y2 = lo * 2; + x2 = hi + y2; + if (y2 == x2 - hi) hi = x2; } - return hi; + } + return hi; } -} -function fsum(values, valueof) { - const adder = new Adder(); - if (valueof === undefined) { - for (let value of values)if (value = +value) adder.add(value); - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) adder.add(value); - } - return +adder; -} -function fcumsum(values, valueof) { - const adder = new Adder(); - let index = -1; - return Float64Array.from(values, valueof === undefined ? (v)=>adder.add(+v || 0) : (v)=>adder.add(+valueof(v, ++index, values) || 0)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kABha":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>group); -parcelHelpers.export(exports, "groups", ()=>groups); -parcelHelpers.export(exports, "flatGroup", ()=>flatGroup); -parcelHelpers.export(exports, "flatRollup", ()=>flatRollup); -parcelHelpers.export(exports, "rollup", ()=>rollup); -parcelHelpers.export(exports, "rollups", ()=>rollups); -parcelHelpers.export(exports, "index", ()=>index); -parcelHelpers.export(exports, "indexes", ()=>indexes); -var _internmap = require("internmap"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -function group(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), (0, _identityJsDefault.default), keys); -} -function groups(values, ...keys) { - return nest(values, Array.from, (0, _identityJsDefault.default), keys); -} -function flatten(groups, keys) { - for(let i = 1, n = keys.length; i < n; ++i)groups = groups.flatMap((g)=>g.pop().map(([key, value])=>[ - ...g, - key, - value - ])); - return groups; -} -function flatGroup(values, ...keys) { - return flatten(groups(values, ...keys), keys); -} -function flatRollup(values, reduce, ...keys) { - return flatten(rollups(values, reduce, ...keys), keys); -} -function rollup(values, reduce, ...keys) { - return nest(values, (0, _identityJsDefault.default), reduce, keys); -} -function rollups(values, reduce, ...keys) { - return nest(values, Array.from, reduce, keys); -} -function index(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), unique, keys); -} -function indexes(values, ...keys) { - return nest(values, Array.from, unique, keys); -} -function unique(values) { - if (values.length !== 1) throw new Error("duplicate key"); - return values[0]; -} -function nest(values, map, reduce, keys) { - return function regroup(values, i) { - if (i >= keys.length) return reduce(values); - const groups = new (0, _internmap.InternMap)(); - const keyof = keys[i++]; - let index = -1; - for (const value of values){ - const key = keyof(value, ++index, values); - const group = groups.get(key); - if (group) group.push(value); - else groups.set(key, [ - value - ]); - } - for (const [key, values] of groups)groups.set(key, regroup(values, i)); - return map(groups); - }(values, 0); -} - -},{"internmap":"cOuqB","./identity.js":"i6NWs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cOuqB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InternMap", ()=>InternMap); -parcelHelpers.export(exports, "InternSet", ()=>InternSet); -class InternMap extends Map { - constructor(entries, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (entries != null) for (const [key, value] of entries)this.set(key, value); + } + class InternMap extends Map { + constructor(entries, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (entries != null) for (const [key3, value2] of entries) this.set(key3, value2); } - get(key) { - return super.get(intern_get(this, key)); + get(key2) { + return super.get(intern_get(this, key2)); } - has(key) { - return super.has(intern_get(this, key)); + has(key2) { + return super.has(intern_get(this, key2)); } - set(key, value) { - return super.set(intern_set(this, key), value); + set(key2, value2) { + return super.set(intern_set(this, key2), value2); } - delete(key) { - return super.delete(intern_delete(this, key)); + delete(key2) { + return super.delete(intern_delete(this, key2)); } -} -class InternSet extends Set { - constructor(values, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (values != null) for (const value of values)this.add(value); - } - has(value) { - return super.has(intern_get(this, value)); - } - add(value) { - return super.add(intern_set(this, value)); - } - delete(value) { - return super.delete(intern_delete(this, value)); - } -} -function intern_get({ _intern, _key }, value) { - const key = _key(value); - return _intern.has(key) ? _intern.get(key) : value; -} -function intern_set({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) return _intern.get(key); - _intern.set(key, value); - return value; -} -function intern_delete({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) { - value = _intern.get(key); - _intern.delete(key); - } - return value; -} -function keyof(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i6NWs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -function identity(x) { - return x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kyLtP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>groupSort); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -function groupSort(values, reduce, key) { - return (reduce.length !== 2 ? (0, _sortJsDefault.default)((0, _groupJs.rollup)(values, reduce, key), ([ak, av], [bk, bv])=>(0, _ascendingJsDefault.default)(av, bv) || (0, _ascendingJsDefault.default)(ak, bk)) : (0, _sortJsDefault.default)((0, _groupJsDefault.default)(values, key), ([ak, av], [bk, bv])=>reduce(av, bv) || (0, _ascendingJsDefault.default)(ak, bk))).map(([key])=>key); -} - -},{"./ascending.js":"zAyXo","./group.js":"kABha","./sort.js":"93lWn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93lWn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sort); -parcelHelpers.export(exports, "compareDefined", ()=>compareDefined); -parcelHelpers.export(exports, "ascendingDefined", ()=>ascendingDefined); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -function sort(values, ...F) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - values = Array.from(values); - let [f] = F; - if (f && f.length !== 2 || F.length > 1) { - const index = Uint32Array.from(values, (d, i)=>i); - if (F.length > 1) { - F = F.map((f)=>values.map(f)); - index.sort((i, j)=>{ - for (const f of F){ - const c = ascendingDefined(f[i], f[j]); - if (c) return c; - } - }); - } else { - f = values.map(f); - index.sort((i, j)=>ascendingDefined(f[i], f[j])); - } - return (0, _permuteJsDefault.default)(values, index); - } - return values.sort(compareDefined(f)); -} -function compareDefined(compare = (0, _ascendingJsDefault.default)) { - if (compare === (0, _ascendingJsDefault.default)) return ascendingDefined; - if (typeof compare !== "function") throw new TypeError("compare is not a function"); - return (a, b)=>{ - const x = compare(a, b); - if (x || x === 0) return x; - return (compare(b, b) === 0) - (compare(a, a) === 0); - }; -} -function ascendingDefined(a, b) { - return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0); -} - -},{"./ascending.js":"zAyXo","./permute.js":"eud3x","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eud3x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>permute); -function permute(source, keys) { - return Array.from(keys, (key)=>source[key]); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6hfwu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bin); -var _arrayJs = require("./array.js"); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -function bin() { - var value = (0, _identityJsDefault.default), domain = (0, _extentJsDefault.default), threshold = (0, _sturgesJsDefault.default); - function histogram(data) { - if (!Array.isArray(data)) data = Array.from(data); - var i, n = data.length, x, step, values = new Array(n); - for(i = 0; i < n; ++i)values[i] = value(data[i], i, data); - var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); - // Convert number of thresholds into uniform thresholds, and nice the - // default domain accordingly. - if (!Array.isArray(tz)) { - const max = x1, tn = +tz; - if (domain === (0, _extentJsDefault.default)) [x0, x1] = (0, _niceJsDefault.default)(x0, x1, tn); - tz = (0, _ticksJsDefault.default)(x0, x1, tn); - // If the domain is aligned with the first tick (which it will by - // default), then we can use quantization rather than bisection to bin - // values, which is substantially faster. - if (tz[0] <= x0) step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - // If the last threshold is coincident with the domain’s upper bound, the - // last bin will be zero-width. If the default domain is used, and this - // last threshold is coincident with the maximum input value, we can - // extend the niced upper bound by one tick to ensure uniform bin widths; - // otherwise, we simply remove the last threshold. Note that we don’t - // coerce values or the domain to numbers, and thus must be careful to - // compare order (>=) rather than strict equality (===)! - if (tz[tz.length - 1] >= x1) { - if (max >= x1 && domain === (0, _extentJsDefault.default)) { - const step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - if (isFinite(step)) { - if (step > 0) x1 = (Math.floor(x1 / step) + 1) * step; - else if (step < 0) x1 = (Math.ceil(x1 * -step) + 1) / -step; - } - } else tz.pop(); - } - } - // Remove any thresholds outside the domain. - // Be careful not to mutate an array owned by the user! - var m = tz.length, a = 0, b = m; - while(tz[a] <= x0)++a; - while(tz[b - 1] > x1)--b; - if (a || b < m) tz = tz.slice(a, b), m = b - a; - var bins = new Array(m + 1), bin; - // Initialize bins. - for(i = 0; i <= m; ++i){ - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - // Assign data to bins by value, ignoring any outside the domain. - if (isFinite(step)) { - if (step > 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]); - } else if (step < 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) { - const j = Math.floor((x0 - x) * step); - bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); // handle off-by-one due to rounding - } - } - } else { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[(0, _bisectJsDefault.default)(tz, x, 0, m)].push(data[i]); - } - return bins; - } - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), histogram) : value; - }; - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - _[0], - _[1] - ]), histogram) : domain; - }; - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(Array.isArray(_) ? (0, _arrayJs.slice).call(_) : _), histogram) : threshold; - }; - return histogram; -} - -},{"./array.js":"j2SMP","./bisect.js":"5mqeI","./constant.js":"7wJOu","./extent.js":"5JWQp","./identity.js":"i6NWs","./nice.js":"e63B5","./ticks.js":"fmECo","./threshold/sturges.js":"1lIJb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2SMP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "map", ()=>map); -var array = Array.prototype; -var slice = array.slice; -var map = array.map; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wJOu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constant); -function constant(x) { - return ()=>x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e63B5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -var _ticksJs = require("./ticks.js"); -function nice(start, stop, count) { - let prestep; - while(true){ - const step = (0, _ticksJs.tickIncrement)(start, stop, count); - if (step === prestep || step === 0 || !isFinite(step)) return [ - start, - stop - ]; - else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } - prestep = step; + } + class InternSet extends Set { + constructor(values2, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (values2 != null) for (const value2 of values2) this.add(value2); + } + has(value2) { + return super.has(intern_get(this, value2)); + } + add(value2) { + return super.add(intern_set(this, value2)); + } + delete(value2) { + return super.delete(intern_delete(this, value2)); + } + } + function intern_get({ _intern, _key }, value2) { + const key2 = _key(value2); + return _intern.has(key2) ? _intern.get(key2) : value2; + } + function intern_set({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) return _intern.get(key2); + _intern.set(key2, value2); + return value2; + } + function intern_delete({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) { + value2 = _intern.get(key2); + _intern.delete(key2); } -} - -},{"./ticks.js":"fmECo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fmECo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ticks); -parcelHelpers.export(exports, "tickIncrement", ()=>tickIncrement); -parcelHelpers.export(exports, "tickStep", ()=>tickStep); -const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); -function tickSpec(start, stop, count) { - const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; + return value2; + } + function keyof(value2) { + return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2; + } + function permute(source2, keys2) { + return Array.from(keys2, (key2) => source2[key2]); + } + function compareDefined(compare2 = ascending$2) { + if (compare2 === ascending$2) return ascendingDefined; + if (typeof compare2 !== "function") throw new TypeError("compare is not a function"); + return (a2, b2) => { + const x2 = compare2(a2, b2); + if (x2 || x2 === 0) return x2; + return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0); + }; + } + function ascendingDefined(a2, b2) { + return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0); + } + const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); + function tickSpec(start, stop2, count2) { + const step = (stop2 - start) / Math.max(0, count2), power = Math.floor(Math.log10(step)), error2 = step / Math.pow(10, power), factor = error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1; let i1, i2, inc; if (power < 0) { - inc = Math.pow(10, -power) / factor; - i1 = Math.round(start * inc); - i2 = Math.round(stop * inc); - if (i1 / inc < start) ++i1; - if (i2 / inc > stop) --i2; - inc = -inc; + inc = Math.pow(10, -power) / factor; + i1 = Math.round(start * inc); + i2 = Math.round(stop2 * inc); + if (i1 / inc < start) ++i1; + if (i2 / inc > stop2) --i2; + inc = -inc; } else { - inc = Math.pow(10, power) * factor; - i1 = Math.round(start / inc); - i2 = Math.round(stop / inc); - if (i1 * inc < start) ++i1; - if (i2 * inc > stop) --i2; - } - if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2); - return [ - i1, - i2, - inc - ]; -} -function ticks(start, stop, count) { - stop = +stop, start = +start, count = +count; - if (!(count > 0)) return []; - if (start === stop) return [ - start - ]; - const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count); + inc = Math.pow(10, power) * factor; + i1 = Math.round(start / inc); + i2 = Math.round(stop2 / inc); + if (i1 * inc < start) ++i1; + if (i2 * inc > stop2) --i2; + } + if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start, stop2, count2 * 2); + return [i1, i2, inc]; + } + function ticks(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + if (!(count2 > 0)) return []; + if (start === stop2) return [start]; + const reverse2 = stop2 < start, [i1, i2, inc] = reverse2 ? tickSpec(stop2, start, count2) : tickSpec(start, stop2, count2); if (!(i2 >= i1)) return []; - const n = i2 - i1 + 1, ticks = new Array(n); - if (reverse) { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) * inc; + const n = i2 - i1 + 1, ticks2 = new Array(n); + if (reverse2) { + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc; } else { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) * inc; - } - return ticks; -} -function tickIncrement(start, stop, count) { - stop = +stop, start = +start, count = +count; - return tickSpec(start, stop, count)[2]; -} -function tickStep(start, stop, count) { - stop = +stop, start = +start, count = +count; - const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count); - return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1lIJb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdSturges); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -function thresholdSturges(values) { - return Math.max(1, Math.ceil(Math.log((0, _countJsDefault.default)(values)) / Math.LN2) + 1); -} - -},{"../count.js":"6vIaU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2dRyq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdFreedmanDiaconis); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _quantileJs = require("../quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function thresholdFreedmanDiaconis(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _quantileJsDefault.default)(values, 0.75) - (0, _quantileJsDefault.default)(values, 0.25); - return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1; -} - -},{"../count.js":"6vIaU","../quantile.js":"29jB7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"29jB7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -parcelHelpers.export(exports, "quantileSorted", ()=>quantileSorted); -parcelHelpers.export(exports, "quantileIndex", ()=>quantileIndex); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _sortJs = require("./sort.js"); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -function quantile(values, p, valueof) { - values = Float64Array.from((0, _numberJs.numbers)(values, valueof)); - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return (0, _minJsDefault.default)(values); - if (p >= 1) return (0, _maxJsDefault.default)(values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = (0, _maxJsDefault.default)((0, _quickselectJsDefault.default)(values, i0).subarray(0, i0 + 1)), value1 = (0, _minJsDefault.default)(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} -function quantileSorted(values, p, valueof = (0, _numberJsDefault.default)) { - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} -function quantileIndex(values, p, valueof = (0, _numberJsDefault.default)) { - if (isNaN(p = +p)) return; - numbers = Float64Array.from(values, (_, i)=>(0, _numberJsDefault.default)(valueof(values[i], i, values))); - if (p <= 0) return (0, _minIndexJsDefault.default)(numbers); - if (p >= 1) return (0, _maxIndexJsDefault.default)(numbers); - var numbers, index = Uint32Array.from(values, (_, i)=>i), j = numbers.length - 1, i = Math.floor(j * p); - (0, _quickselectJsDefault.default)(index, i, 0, j, (i, j)=>(0, _sortJs.ascendingDefined)(numbers[i], numbers[j])); - i = (0, _greatestJsDefault.default)(index.subarray(0, i + 1), (i)=>numbers[i]); - return i >= 0 ? i : -1; -} - -},{"./max.js":"8YwYZ","./maxIndex.js":"l9rNy","./min.js":"6iq65","./minIndex.js":"8xCGl","./quickselect.js":"pm9zy","./number.js":"gSG0m","./sort.js":"93lWn","./greatest.js":"jrFax","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8YwYZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>max); -function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values)if (value != null && (max < value || max === undefined && value >= value)) max = value; + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc; + } + return ticks2; + } + function tickIncrement(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + return tickSpec(start, stop2, count2)[2]; + } + function tickStep(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + const reverse2 = stop2 < start, inc = reverse2 ? tickIncrement(stop2, start, count2) : tickIncrement(start, stop2, count2); + return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + } + function max$2(values2, valueof) { + let max2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; + } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value; - } - return max; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l9rNy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>maxIndex); -function maxIndex(values, valueof) { - let max; - let maxIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; + } + } } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; - } - return maxIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iq65":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>min); -function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values)if (value != null && (min > value || min === undefined && value >= value)) min = value; + return max2; + } + function min$2(values2, valueof) { + let min2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value; - } - return min; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8xCGl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>minIndex); -function minIndex(values, valueof) { - let min; - let minIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; - } - return minIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"pm9zy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quickselect); -var _sortJs = require("./sort.js"); -function quickselect(array, k, left = 0, right = Infinity, compare) { + return min2; + } + function quickselect(array2, k, left = 0, right = Infinity, compare2) { k = Math.floor(k); left = Math.floor(Math.max(0, left)); - right = Math.floor(Math.min(array.length - 1, right)); - if (!(left <= k && k <= right)) return array; - compare = compare === undefined ? (0, _sortJs.ascendingDefined) : (0, _sortJs.compareDefined)(compare); - while(right > left){ - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - const t = array[k]; - let i = left; - let j = right; - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - while(i < j){ - swap(array, i, j), ++i, --j; - while(compare(array[i], t) < 0)++i; - while(compare(array[j], t) > 0)--j; - } - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; -} -function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; -} - -},{"./sort.js":"93lWn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jrFax":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatest); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function greatest(values, compare = (0, _ascendingJsDefault.default)) { - let max; - let defined = false; - if (compare.length === 1) { - let maxValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, maxValue) > 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - max = element; - maxValue = value; - defined = true; - } - } - } else { - for (const value of values)if (defined ? compare(value, max) > 0 : compare(value, value) === 0) { - max = value; - defined = true; - } - } - return max; -} - -},{"./ascending.js":"zAyXo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lGg25":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdScott); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _deviationJs = require("../deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -function thresholdScott(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _deviationJsDefault.default)(values); - return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1; -} - -},{"../count.js":"6vIaU","../deviation.js":"6718P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fVfCV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mean); -function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count, sum += value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count, sum += value; - } - if (count) return sum / count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"awkrD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>median); -parcelHelpers.export(exports, "medianIndex", ()=>medianIndex); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function median(values, valueof) { - return (0, _quantileJsDefault.default)(values, 0.5, valueof); -} -function medianIndex(values, valueof) { - return (0, _quantileJs.quantileIndex)(values, 0.5, valueof); -} - -},{"./quantile.js":"29jB7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"liJWL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>merge); -function* flatten(arrays) { - for (const array of arrays)yield* array; -} -function merge(arrays) { - return Array.from(flatten(arrays)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Kgrp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mode); -var _internmap = require("internmap"); -function mode(values, valueof) { - const counts = new (0, _internmap.InternMap)(); - if (valueof === undefined) { - for (let value of values)if (value != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } - let modeValue; - let modeCount = 0; - for (const [value, count] of counts)if (count > modeCount) { - modeCount = count; - modeValue = value; - } - return modeValue; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c2ViX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>pairs); -parcelHelpers.export(exports, "pair", ()=>pair); -function pairs(values, pairof = pair) { - const pairs1 = []; - let previous; - let first = false; - for (const value of values){ - if (first) pairs1.push(pairof(previous, value)); - previous = value; - first = true; + right = Math.floor(Math.min(array2.length - 1, right)); + if (!(left <= k && k <= right)) return array2; + compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2); + while (right > left) { + if (right - left > 600) { + const n = right - left + 1; + const m2 = k - left + 1; + const z2 = Math.log(n); + const s2 = 0.5 * Math.exp(2 * z2 / 3); + const sd = 0.5 * Math.sqrt(z2 * s2 * (n - s2) / n) * (m2 - n / 2 < 0 ? -1 : 1); + const newLeft = Math.max(left, Math.floor(k - m2 * s2 / n + sd)); + const newRight = Math.min(right, Math.floor(k + (n - m2) * s2 / n + sd)); + quickselect(array2, k, newLeft, newRight, compare2); + } + const t = array2[k]; + let i = left; + let j = right; + swap$1(array2, left, k); + if (compare2(array2[right], t) > 0) swap$1(array2, left, right); + while (i < j) { + swap$1(array2, i, j), ++i, --j; + while (compare2(array2[i], t) < 0) ++i; + while (compare2(array2[j], t) > 0) --j; + } + if (compare2(array2[left], t) === 0) swap$1(array2, left, j); + else ++j, swap$1(array2, j, right); + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; } - return pairs1; -} -function pair(a, b) { - return [ - a, - b - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7i9on":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>range); -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); - while(++i < n)range[i] = start + i * step; - return range; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kd13S":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>rank); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _sortJs = require("./sort.js"); -function rank(values, valueof = (0, _ascendingJsDefault.default)) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - let V = Array.from(values); - const R = new Float64Array(V.length); - if (valueof.length !== 2) V = V.map(valueof), valueof = (0, _ascendingJsDefault.default); - const compareIndex = (i, j)=>valueof(V[i], V[j]); - let k, r; - values = Uint32Array.from(V, (_, i)=>i); - // Risky chaining due to Safari 14 https://github.com/d3/d3-array/issues/123 - values.sort(valueof === (0, _ascendingJsDefault.default) ? (i, j)=>(0, _sortJs.ascendingDefined)(V[i], V[j]) : (0, _sortJs.compareDefined)(compareIndex)); - values.forEach((j, i)=>{ - const c = compareIndex(j, k === undefined ? j : k); - if (c >= 0) { - if (k === undefined || c > 0) k = j, r = i; - R[j] = r; - } else R[j] = NaN; - }); - return R; -} - -},{"./ascending.js":"zAyXo","./sort.js":"93lWn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ceK4t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>least); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function least(values, compare = (0, _ascendingJsDefault.default)) { - let min; - let defined = false; - if (compare.length === 1) { - let minValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, minValue) < 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - min = element; - minValue = value; - defined = true; - } + return array2; + } + function swap$1(array2, i, j) { + const t = array2[i]; + array2[i] = array2[j]; + array2[j] = t; + } + function quantile$1(values2, p, valueof) { + values2 = Float64Array.from(numbers$2(values2, valueof)); + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return min$2(values2); + if (p >= 1) return max$2(values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$2(quickselect(values2, i0).subarray(0, i0 + 1)), value1 = min$2(values2.subarray(i0 + 1)); + return value0 + (value1 - value0) * (i - i0); + } + function quantileSorted(values2, p, valueof = number$6) { + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return +valueof(values2[0], 0, values2); + if (p >= 1) return +valueof(values2[n - 1], n - 1, values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values2[i0], i0, values2), value1 = +valueof(values2[i0 + 1], i0 + 1, values2); + return value0 + (value1 - value0) * (i - i0); + } + function mean(values2, valueof) { + let count2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; } + } } else { - for (const value of values)if (defined ? compare(value, min) < 0 : compare(value, value) === 0) { - min = value; - defined = true; - } - } - return min; -} - -},{"./ascending.js":"zAyXo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dW25b":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>leastIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -function leastIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _minIndexJsDefault.default)(values, compare); - let minValue; - let min = -1; - let index = -1; - for (const value of values){ - ++index; - if (min < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { - minValue = value; - min = index; - } - } - return min; -} - -},{"./ascending.js":"zAyXo","./minIndex.js":"8xCGl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dL9ui":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatestIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -function greatestIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _maxIndexJsDefault.default)(values, compare); - let maxValue; - let max = -1; - let index = -1; - for (const value of values){ - ++index; - if (max < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { - maxValue = value; - max = index; - } - } - return max; -} - -},{"./ascending.js":"zAyXo","./maxIndex.js":"l9rNy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmKwW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>scan); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -function scan(values, compare) { - const index = (0, _leastIndexJsDefault.default)(values, compare); - return index < 0 ? undefined : index; -} - -},{"./leastIndex.js":"dW25b","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ZIpU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shuffler", ()=>shuffler); -exports.default = shuffler(Math.random); -function shuffler(random) { - return function shuffle(array, i0 = 0, i1 = array.length) { - let m = i1 - (i0 = +i0); - while(m){ - const i = random() * m-- | 0, t = array[m + i0]; - array[m + i0] = array[i + i0]; - array[i + i0] = t; - } - return array; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8SwUe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sum); -function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value = +value) sum += value; - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) sum += value; - } - return sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Ej71":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>transpose); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for(var i = -1, m = (0, _minJsDefault.default)(matrix, length), transpose = new Array(m); ++i < m;)for(var j = -1, n, row = transpose[i] = new Array(n); ++j < n;)row[j] = matrix[j][i]; - return transpose; -} -function length(d) { - return d.length; -} - -},{"./min.js":"6iq65","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f7Krc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>zip); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -function zip() { - return (0, _transposeJsDefault.default)(arguments); -} - -},{"./transpose.js":"1Ej71","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"agCBw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>every); -function every(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (!test(value, ++index, values)) return false; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; + } + } } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3LqiV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>some); -function some(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (test(value, ++index, values)) return true; + if (count2) return sum2 / count2; + } + function median(values2, valueof) { + return quantile$1(values2, 0.5, valueof); + } + function* flatten(arrays) { + for (const array2 of arrays) { + yield* array2; } - return false; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9mlS9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>filter); -function filter(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - const array = []; - let index = -1; - for (const value of values)if (test(value, ++index, values)) array.push(value); - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ePJbS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>map); -function map(values, mapper) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - if (typeof mapper !== "function") throw new TypeError("mapper is not a function"); - return Array.from(values, (value, index)=>mapper(value, index, values)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h3fvA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reduce); -function reduce(values, reducer, value) { - if (typeof reducer !== "function") throw new TypeError("reducer is not a function"); - const iterator = values[Symbol.iterator](); - let done, next, index = -1; - if (arguments.length < 3) { - ({ done, value } = iterator.next()); - if (done) return; - ++index; + } + function merge$4(arrays) { + return Array.from(flatten(arrays)); + } + function range$3(start, stop2, step) { + start = +start, stop2 = +stop2, step = (n = arguments.length) < 2 ? (stop2 = start, start = 0, 1) : n < 3 ? 1 : +step; + var i = -1, n = Math.max(0, Math.ceil((stop2 - start) / step)) | 0, range2 = new Array(n); + while (++i < n) { + range2[i] = start + i * step; } - while({ done, value: next } = iterator.next(), !done)value = reducer(value, next, ++index, values); - return value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lg91e":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reverse); -function reverse(values) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - return Array.from(values).reverse(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jJaFT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>difference); -var _internmap = require("internmap"); -function difference(values, ...others) { - values = new (0, _internmap.InternSet)(values); - for (const other of others)for (const value of other)values.delete(value); - return values; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewThO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>disjoint); -var _internmap = require("internmap"); -function disjoint(values, other) { - const iterator = other[Symbol.iterator](), set = new (0, _internmap.InternSet)(); - for (const v of values){ - if (set.has(v)) return false; - let value, done; - while({ value, done } = iterator.next()){ - if (done) break; - if (Object.is(v, value)) return false; - set.add(value); + return range2; + } + function sum$1(values2, valueof) { + let sum2 = 0; + { + for (let value2 of values2) { + if (value2 = +value2) { + sum2 += value2; } + } } - return true; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3dVn4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>intersection); -var _internmap = require("internmap"); -function intersection(values, ...others) { - values = new (0, _internmap.InternSet)(values); - others = others.map(set); - out: for (const value of values){ - for (const other of others)if (!other.has(value)) { - values.delete(value); - continue out; - } - } - return values; -} -function set(values) { - return values instanceof (0, _internmap.InternSet) ? values : new (0, _internmap.InternSet)(values); -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fO88f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>subset); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -function subset(values, other) { - return (0, _supersetJsDefault.default)(other, values); -} - -},{"./superset.js":"6zbJQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6zbJQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>superset); -function superset(values, other) { - const iterator = values[Symbol.iterator](), set = new Set(); - for (const o of other){ - const io = intern(o); - if (set.has(io)) continue; - let value, done; - while({ value, done } = iterator.next()){ - if (done) return false; - const ivalue = intern(value); - set.add(ivalue); - if (Object.is(io, ivalue)) break; + return sum2; + } + function intersection(values2, ...others) { + values2 = new InternSet(values2); + others = others.map(set$4); + out: for (const value2 of values2) { + for (const other of others) { + if (!other.has(value2)) { + values2.delete(value2); + continue out; } + } } - return true; -} -function intern(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"loYUW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>union); -var _internmap = require("internmap"); -function union(...others) { - const set = new (0, _internmap.InternSet)(); - for (const other of others)for (const o of other)set.add(o); - return set; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ijd73":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initRange", ()=>initRange); -parcelHelpers.export(exports, "initInterpolator", ()=>initInterpolator); -function initRange(domain, range) { - switch(arguments.length){ - case 0: - break; - case 1: - this.range(domain); - break; - default: - this.range(range).domain(domain); - break; + return values2; + } + function set$4(values2) { + return values2 instanceof InternSet ? values2 : new InternSet(values2); + } + function union(...others) { + const set2 = new InternSet(); + for (const other of others) { + for (const o of other) { + set2.add(o); + } } - return this; -} -function initInterpolator(domain, interpolator) { - switch(arguments.length){ - case 0: - break; - case 1: - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - default: - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; + return set2; + } + function initRange(domain2, range2) { + switch (arguments.length) { + case 0: + break; + case 1: + this.range(domain2); + break; + default: + this.range(range2).domain(domain2); + break; } return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cg12q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "implicit", ()=>implicit); -parcelHelpers.export(exports, "default", ()=>ordinal); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -const implicit = Symbol("implicit"); -function ordinal() { - var index = new (0, _d3Array.InternMap)(), domain = [], range = [], unknown = implicit; - function scale(d) { - let i = index.get(d); - if (i === undefined) { - if (unknown !== implicit) return unknown; - index.set(d, i = domain.push(d) - 1); - } - return range[i % range.length]; - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new (0, _d3Array.InternMap)(); - for (const value of _){ - if (index.has(value)) continue; - index.set(value, domain.push(value) - 1); - } - return scale; - }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e07Nz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function identity(domain) { - var unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : x; + } + function initInterpolator(domain2, interpolator) { + switch (arguments.length) { + case 0: + break; + case 1: { + if (typeof domain2 === "function") this.interpolator(domain2); + else this.range(domain2); + break; + } + default: { + this.domain(domain2); + if (typeof interpolator === "function") this.interpolator(interpolator); + else this.range(interpolator); + break; + } } - scale.invert = scale; - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), scale) : domain.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + return this; + } + const implicit = Symbol("implicit"); + function ordinal() { + var index2 = new InternMap(), domain2 = [], range2 = [], unknown = implicit; + function scale2(d2) { + let i = index2.get(d2); + if (i === void 0) { + if (unknown !== implicit) return unknown; + index2.set(d2, i = domain2.push(d2) - 1); + } + return range2[i % range2.length]; + } + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = [], index2 = new InternMap(); + for (const value2 of _) { + if (index2.has(value2)) continue; + index2.set(value2, domain2.push(value2) - 1); + } + return scale2; }; - scale.copy = function() { - return identity(domain).unknown(unknown); + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), scale2) : range2.slice(); }; - domain = arguments.length ? Array.from(domain, (0, _numberJsDefault.default)) : [ - 0, - 1 - ]; - return (0, _linearJs.linearish)(scale); -} - -},{"./linear.js":"ik2PQ","./number.js":"aUICk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ik2PQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "linearish", ()=>linearish); -parcelHelpers.export(exports, "default", ()=>linear); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); -function linearish(scale) { - var domain = scale.domain; - scale.ticks = function(count) { - var d = domain(); - return (0, _d3Array.ticks)(d[0], d[d.length - 1], count == null ? 10 : count); - }; - scale.tickFormat = function(count, specifier) { - var d = domain(); - return (0, _tickFormatJsDefault.default)(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - scale.nice = function(count) { - if (count == null) count = 10; - var d = domain(); - var i0 = 0; - var i1 = d.length - 1; - var start = d[i0]; - var stop = d[i1]; - var prestep; - var step; - var maxIter = 10; - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - while(maxIter-- > 0){ - step = (0, _d3Array.tickIncrement)(start, stop, count); - if (step === prestep) { - d[i0] = start; - d[i1] = stop; - return domain(d); - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } else break; - prestep = step; - } - return scale; - }; - return scale; -} -function linear() { - var scale = (0, _continuousJsDefault.default)(); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, linear()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return linearish(scale); -} - -},{"d3-array":"5lCYW","./continuous.js":"2SYx4","./init.js":"ijd73","./tickFormat.js":"fHwUM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2SYx4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "transformer", ()=>transformer); -parcelHelpers.export(exports, "default", ()=>continuous); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var unit = [ - 0, - 1 -]; -function identity(x) { - return x; -} -function normalize(a, b) { - return (b -= a = +a) ? function(x) { - return (x - a) / b; - } : (0, _constantJsDefault.default)(isNaN(b) ? NaN : 0.5); -} -function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = t; - return function(x) { - return Math.max(a, Math.min(b, x)); - }; -} -// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. -function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { - return r0(d0(x)); - }; -} -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1; - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - while(++i < j){ - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - return function(x) { - var i = (0, _d3Array.bisect)(domain, x, 1, j) - 1; - return r[i](d[i](x)); - }; -} -function copy(source, target) { - return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); -} -function transformer() { - var domain = unit, range = unit, interpolate = (0, _d3Interpolate.interpolate), transform, untransform, unknown, clamp = identity, piecewise, output, input; - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), (0, _d3Interpolate.interpolateNumber))))(y))); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), rescale()) : domain.slice(); + scale2.copy = function() { + return ordinal(domain2, range2).unknown(unknown); }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); + initRange.apply(scale2, arguments); + return scale2; + } + function basis(t12, v0, v1, v2, v3) { + var t22 = t12 * t12, t32 = t22 * t12; + return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6; + } + function basis$1(values2) { + var n = values2.length - 1; + return function(t) { + var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values2[i], v2 = values2[i + 1], v0 = i > 0 ? values2[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values2[i + 2] : 2 * v2 - v1; + return basis((t - i / n) * n, v0, v1, v2, v3); }; - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = (0, _d3Interpolate.interpolateRound), rescale(); + } + function basisClosed(values2) { + var n = values2.length; + return function(t) { + var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values2[(i + n - 1) % n], v1 = values2[i % n], v2 = values2[(i + 1) % n], v3 = values2[(i + 2) % n]; + return basis((t - i / n) * n, v0, v1, v2, v3); }; - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; + } + const constant$5 = (x2) => () => x2; + function linear$2(a2, d2) { + return function(t) { + return a2 + t * d2; }; - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; + } + function exponential(a2, b2, y2) { + return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t) { + return Math.pow(a2 + t * b2, y2); }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + } + function hue$1(a2, b2) { + var d2 = b2 - a2; + return d2 ? linear$2(a2, d2 > 180 || d2 < -180 ? d2 - 360 * Math.round(d2 / 360) : d2) : constant$5(isNaN(a2) ? b2 : a2); + } + function gamma(y2) { + return (y2 = +y2) === 1 ? nogamma : function(a2, b2) { + return b2 - a2 ? exponential(a2, b2, y2) : constant$5(isNaN(a2) ? b2 : a2); }; - return function(t, u) { - transform = t, untransform = u; - return rescale(); + } + function nogamma(a2, b2) { + var d2 = b2 - a2; + return d2 ? linear$2(a2, d2) : constant$5(isNaN(a2) ? b2 : a2); + } + const rgb = (function rgbGamma(y2) { + var color2 = gamma(y2); + function rgb2(start, end) { + var r = color2((start = rgb$1(start)).r, (end = rgb$1(end)).r), g = color2(start.g, end.g), b2 = color2(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b2(t); + start.opacity = opacity2(t); + return start + ""; + }; + } + rgb2.gamma = rgbGamma; + return rgb2; + })(1); + function rgbSpline(spline) { + return function(colors2) { + var n = colors2.length, r = new Array(n), g = new Array(n), b2 = new Array(n), i, color2; + for (i = 0; i < n; ++i) { + color2 = rgb$1(colors2[i]); + r[i] = color2.r || 0; + g[i] = color2.g || 0; + b2[i] = color2.b || 0; + } + r = spline(r); + g = spline(g); + b2 = spline(b2); + color2.opacity = 1; + return function(t) { + color2.r = r(t); + color2.g = g(t); + color2.b = b2(t); + return color2 + ""; + }; }; -} -function continuous() { - return transformer()(identity, identity); -} - -},{"d3-array":"5lCYW","d3-interpolate":"hWyQt","./constant.js":"3WTV4","./number.js":"aUICk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hWyQt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolate", ()=>(0, _valueJsDefault.default)); -parcelHelpers.export(exports, "interpolateArray", ()=>(0, _arrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "interpolateDate", ()=>(0, _dateJsDefault.default)); -parcelHelpers.export(exports, "interpolateDiscrete", ()=>(0, _discreteJsDefault.default)); -parcelHelpers.export(exports, "interpolateHue", ()=>(0, _hueJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumber", ()=>(0, _numberJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumberArray", ()=>(0, _numberArrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateObject", ()=>(0, _objectJsDefault.default)); -parcelHelpers.export(exports, "interpolateRound", ()=>(0, _roundJsDefault.default)); -parcelHelpers.export(exports, "interpolateString", ()=>(0, _stringJsDefault.default)); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>(0, _indexJs.interpolateTransformCss)); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>(0, _indexJs.interpolateTransformSvg)); -parcelHelpers.export(exports, "interpolateZoom", ()=>(0, _zoomJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgb", ()=>(0, _rgbJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgbBasis", ()=>(0, _rgbJs.rgbBasis)); -parcelHelpers.export(exports, "interpolateRgbBasisClosed", ()=>(0, _rgbJs.rgbBasisClosed)); -parcelHelpers.export(exports, "interpolateHsl", ()=>(0, _hslJsDefault.default)); -parcelHelpers.export(exports, "interpolateHslLong", ()=>(0, _hslJs.hslLong)); -parcelHelpers.export(exports, "interpolateLab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "interpolateHcl", ()=>(0, _hclJsDefault.default)); -parcelHelpers.export(exports, "interpolateHclLong", ()=>(0, _hclJs.hclLong)); -parcelHelpers.export(exports, "interpolateCubehelix", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixLong", ()=>(0, _cubehelixJs.cubehelixLong)); -parcelHelpers.export(exports, "piecewise", ()=>(0, _piecewiseJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _discreteJs = require("./discrete.js"); -var _discreteJsDefault = parcelHelpers.interopDefault(_discreteJs); -var _hueJs = require("./hue.js"); -var _hueJsDefault = parcelHelpers.interopDefault(_hueJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _indexJs = require("./transform/index.js"); -var _zoomJs = require("./zoom.js"); -var _zoomJsDefault = parcelHelpers.interopDefault(_zoomJs); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _hslJs = require("./hsl.js"); -var _hslJsDefault = parcelHelpers.interopDefault(_hslJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _hclJs = require("./hcl.js"); -var _hclJsDefault = parcelHelpers.interopDefault(_hclJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _piecewiseJs = require("./piecewise.js"); -var _piecewiseJsDefault = parcelHelpers.interopDefault(_piecewiseJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); - -},{"./value.js":"gfJPE","./array.js":"aHWTr","./basis.js":"88PXq","./basisClosed.js":"k0GEO","./date.js":"7hJMh","./discrete.js":"856yx","./hue.js":"8zvjW","./number.js":"jdEvy","./numberArray.js":"e2unU","./object.js":"bDQsG","./round.js":"8t96L","./string.js":"i8PKu","./transform/index.js":"kov9u","./zoom.js":"fAkJy","./rgb.js":"eqhhf","./hsl.js":"kviB4","./lab.js":"drgXo","./hcl.js":"e1eQm","./cubehelix.js":"fTm9T","./piecewise.js":"3wh8c","./quantize.js":"6KHTv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfJPE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? (0, _constantJsDefault.default)(b) : (t === "number" ? (0, _numberJsDefault.default) : t === "string" ? (c = (0, _d3Color.color)(b)) ? (b = c, _rgbJsDefault.default) : (0, _stringJsDefault.default) : b instanceof (0, _d3Color.color) ? (0, _rgbJsDefault.default) : b instanceof Date ? (0, _dateJsDefault.default) : (0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : Array.isArray(b) ? (0, _arrayJs.genericArray) : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? (0, _objectJsDefault.default) : (0, _numberJsDefault.default))(a, b); - }); -var _d3Color = require("d3-color"); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _arrayJs = require("./array.js"); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); - -},{"d3-color":"37LNF","./rgb.js":"eqhhf","./array.js":"aHWTr","./date.js":"7hJMh","./number.js":"jdEvy","./object.js":"bDQsG","./string.js":"i8PKu","./constant.js":"iuQcB","./numberArray.js":"e2unU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eqhhf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rgbBasis", ()=>rgbBasis); -parcelHelpers.export(exports, "rgbBasisClosed", ()=>rgbBasisClosed); -var _d3Color = require("d3-color"); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -exports.default = function rgbGamma(y) { - var color = (0, _colorJs.gamma)(y); - function rgb(start, end) { - var r = color((start = (0, _d3Color.rgb)(start)).r, (end = (0, _d3Color.rgb)(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - rgb.gamma = rgbGamma; - return rgb; -}(1); -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; - for(i = 0; i < n; ++i){ - color = (0, _d3Color.rgb)(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; + } + var rgbBasis = rgbSpline(basis$1); + var rgbBasisClosed = rgbSpline(basisClosed); + function numberArray(a2, b2) { + if (!b2) b2 = []; + var n = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i; + return function(t) { + for (i = 0; i < n; ++i) c2[i] = a2[i] * (1 - t) + b2[i] * t; + return c2; }; -} -var rgbBasis = rgbSpline((0, _basisJsDefault.default)); -var rgbBasisClosed = rgbSpline((0, _basisClosedJsDefault.default)); - -},{"d3-color":"37LNF","./basis.js":"88PXq","./basisClosed.js":"k0GEO","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"88PXq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "basis", ()=>basis); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length - 1; - return function(t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - }); -function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = t2 * t1; - return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k0GEO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; - return (0, _basisJs.basis)((t - i / n) * n, v0, v1, v2, v3); - }; - }); -var _basisJs = require("./basis.js"); - -},{"./basis.js":"88PXq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fWpiN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hue", ()=>hue); -parcelHelpers.export(exports, "gamma", ()=>gamma); -parcelHelpers.export(exports, "default", ()=>nogamma); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -function linear(a, d) { + } + function isNumberArray(x2) { + return ArrayBuffer.isView(x2) && !(x2 instanceof DataView); + } + function array$5(a2, b2) { + return (isNumberArray(b2) ? numberArray : genericArray)(a2, b2); + } + function genericArray(a2, b2) { + var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i; + for (i = 0; i < na; ++i) x2[i] = interpolate$1(a2[i], b2[i]); + for (; i < nb; ++i) c2[i] = b2[i]; return function(t) { - return a + t * d; - }; -} -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} -function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} -function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); - }; -} -function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} - -},{"./constant.js":"iuQcB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iuQcB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>()=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aHWTr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return ((0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : genericArray)(a, b); - }); -parcelHelpers.export(exports, "genericArray", ()=>genericArray); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -function genericArray(a, b) { - var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; - for(i = 0; i < na; ++i)x[i] = (0, _valueJsDefault.default)(a[i], b[i]); - for(; i < nb; ++i)c[i] = b[i]; + for (i = 0; i < na; ++i) c2[i] = x2[i](t); + return c2; + }; + } + function date$1(a2, b2) { + var d2 = /* @__PURE__ */ new Date(); + return a2 = +a2, b2 = +b2, function(t) { + return d2.setTime(a2 * (1 - t) + b2 * t), d2; + }; + } + function interpolateNumber(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return a2 * (1 - t) + b2 * t; + }; + } + function object$1(a2, b2) { + var i = {}, c2 = {}, k; + if (a2 === null || typeof a2 !== "object") a2 = {}; + if (b2 === null || typeof b2 !== "object") b2 = {}; + for (k in b2) { + if (k in a2) { + i[k] = interpolate$1(a2[k], b2[k]); + } else { + c2[k] = b2[k]; + } + } return function(t) { - for(i = 0; i < na; ++i)c[i] = x[i](t); - return c; - }; -} - -},{"./value.js":"gfJPE","./numberArray.js":"e2unU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e2unU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; - return function(t) { - for(i = 0; i < n; ++i)c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; - }); -parcelHelpers.export(exports, "isNumberArray", ()=>isNumberArray); -function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7hJMh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jdEvy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bDQsG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = {}, c = {}, k; - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - for(k in b)if (k in a) i[k] = (0, _valueJsDefault.default)(a[k], b[k]); - else c[k] = b[k]; - return function(t) { - for(k in i)c[k] = i[k](t); - return c; - }; - }); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); - -},{"./value.js":"gfJPE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i8PKu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; // number interpolators - // Coerce inputs to strings. - a = a + "", b = b + ""; - // Interpolate pairs of numbers in a & b. - while((am = reA.exec(a)) && (bm = reB.exec(b))){ - if ((bs = bm.index) > bi) { - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { - s[++i] = null; - q.push({ - i: i, - x: (0, _numberJsDefault.default)(am, bm) - }); - } - bi = reB.lastIndex; - } - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - // Special optimization for only a single match. - // Otherwise, interpolate each of the numbers and rejoin the string. - return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) { - for(var i = 0, o; i < b; ++i)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); - }); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); -function zero(b) { + for (k in i) c2[k] = i[k](t); + return c2; + }; + } + var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); + function zero$2(b2) { return function() { - return b; + return b2; }; -} -function one(b) { + } + function one$2(b2) { return function(t) { - return b(t) + ""; - }; -} - -},{"./number.js":"jdEvy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"856yx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8zvjW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = (0, _colorJs.hue)(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; - }); -var _colorJs = require("./color.js"); - -},{"./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8t96L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kov9u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>interpolateTransformCss); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>interpolateTransformSvg); -var _numberJs = require("../number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _parseJs = require("./parse.js"); -function interpolateTransform(parse, pxComma, pxParen, degParen) { - function pop(s) { - return s.length ? s.pop() + " " : ""; - } - function translate(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb || yb) s.push("translate(" + xb + pxComma + yb + pxParen); - } - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; - else if (b - a > 180) a += 360; // shortest path - q.push({ - i: s.push(pop(s) + "rotate(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - } else if (b) s.push(pop(s) + "rotate(" + b + degParen); - } - function skewX(a, b, s, q) { - if (a !== b) q.push({ - i: s.push(pop(s) + "skewX(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - else if (b) s.push(pop(s) + "skewX(" + b + degParen); - } - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb !== 1 || yb !== 1) s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - return function(a, b) { - var s = [], q = []; // number interpolators - a = parse(a), b = parse(b); - translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); - rotate(a.rotate, b.rotate, s, q); - skewX(a.skewX, b.skewX, s, q); - scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); - a = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while(++i < n)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; + return b2(t) + ""; }; -} -var interpolateTransformCss = interpolateTransform((0, _parseJs.parseCss), "px, ", "px)", "deg)"); -var interpolateTransformSvg = interpolateTransform((0, _parseJs.parseSvg), ", ", ")", ")"); - -},{"../number.js":"jdEvy","./parse.js":"1NPFm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NPFm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/* eslint-disable no-undef */ parcelHelpers.export(exports, "parseCss", ()=>parseCss); -parcelHelpers.export(exports, "parseSvg", ()=>parseSvg); -var _decomposeJs = require("./decompose.js"); -var _decomposeJsDefault = parcelHelpers.interopDefault(_decomposeJs); -var svgNode; -function parseCss(value) { - const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + ""); - return m.isIdentity ? (0, _decomposeJs.identity) : (0, _decomposeJsDefault.default)(m.a, m.b, m.c, m.d, m.e, m.f); -} -function parseSvg(value) { - if (value == null) return 0, _decomposeJs.identity; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return 0, _decomposeJs.identity; - value = value.matrix; - return (0, _decomposeJsDefault.default)(value.a, value.b, value.c, value.d, value.e, value.f); -} - -},{"./decompose.js":"cQAQq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cQAQq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "default", ()=>function(a, b, c, d, e, f) { - var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b, a) * degrees, - skewX: Math.atan(skewX) * degrees, - scaleX: scaleX, - scaleY: scaleY - }; + } + function string(a2, b2) { + var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s2 = [], q = []; + a2 = a2 + "", b2 = b2 + ""; + while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) { + if ((bs = bm.index) > bi) { + bs = b2.slice(bi, bs); + if (s2[i]) s2[i] += bs; + else s2[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { + if (s2[i]) s2[i] += bm; + else s2[++i] = bm; + } else { + s2[++i] = null; + q.push({ i, x: interpolateNumber(am, bm) }); + } + bi = reB.lastIndex; + } + if (bi < b2.length) { + bs = b2.slice(bi); + if (s2[i]) s2[i] += bs; + else s2[++i] = bs; + } + return s2.length < 2 ? q[0] ? one$2(q[0].x) : zero$2(b2) : (b2 = q.length, function(t) { + for (var i2 = 0, o; i2 < b2; ++i2) s2[(o = q[i2]).i] = o.x(t); + return s2.join(""); }); -var degrees = 180 / Math.PI; -var identity = { + } + function interpolate$1(a2, b2) { + var t = typeof b2, c2; + return b2 == null || t === "boolean" ? constant$5(b2) : (t === "number" ? interpolateNumber : t === "string" ? (c2 = color$2(b2)) ? (b2 = c2, rgb) : string : b2 instanceof color$2 ? rgb : b2 instanceof Date ? date$1 : isNumberArray(b2) ? numberArray : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object$1 : interpolateNumber)(a2, b2); + } + function discrete$1(range2) { + var n = range2.length; + return function(t) { + return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; + }; + } + function hue(a2, b2) { + var i = hue$1(+a2, +b2); + return function(t) { + var x2 = i(t); + return x2 - 360 * Math.floor(x2 / 360); + }; + } + function interpolateRound(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return Math.round(a2 * (1 - t) + b2 * t); + }; + } + var degrees$1 = 180 / Math.PI; + var identity$7 = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fAkJy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var epsilon2 = 1e-12; -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} -exports.default = function zoomRho(rho, rho2, rho4) { - // p0 = [ux0, uy0, w0] - // p1 = [ux1, uy1, w1] - function zoom(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } else { - var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); - return [ - ux0 + u * dx, - uy0 + u * dy, - w0 * coshr0 / cosh(rho * s + r0) - ]; - }; - } - i.duration = S * 1000 * rho / Math.SQRT2; - return i; + }; + function decompose(a2, b2, c2, d2, e, f) { + var scaleX, scaleY2, skewX; + if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX; + if (skewX = a2 * c2 + b2 * d2) c2 -= a2 * skewX, d2 -= b2 * skewX; + if (scaleY2 = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY2, d2 /= scaleY2, skewX /= scaleY2; + if (a2 * d2 < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e, + translateY: f, + rotate: Math.atan2(b2, a2) * degrees$1, + skewX: Math.atan(skewX) * degrees$1, + scaleX, + scaleY: scaleY2 + }; + } + var svgNode; + function parseCss(value2) { + const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + ""); + return m2.isIdentity ? identity$7 : decompose(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f); + } + function parseSvg(value2) { + if (value2 == null) return identity$7; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value2); + if (!(value2 = svgNode.transform.baseVal.consolidate())) return identity$7; + value2 = value2.matrix; + return decompose(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f); + } + function interpolateTransform(parse2, pxComma, pxParen, degParen) { + function pop(s2) { + return s2.length ? s2.pop() + " " : ""; + } + function translate2(xa, ya, xb, yb, s2, q) { + if (xa !== xb || ya !== yb) { + var i = s2.push("translate(", null, pxComma, null, pxParen); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb || yb) { + s2.push("translate(" + xb + pxComma + yb + pxParen); + } } - zoom.rho = function(_) { - var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; - return zoomRho(_1, _2, _4); - }; - return zoom; -}(Math.SQRT2, 2, 4); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kviB4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hslLong", ()=>hslLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hsl(hue) { - return function(start, end) { - var h = hue((start = (0, _d3Color.hsl)(start)).h, (end = (0, _d3Color.hsl)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; + function rotate2(a2, b2, s2, q) { + if (a2 !== b2) { + if (a2 - b2 > 180) b2 += 360; + else if (b2 - a2 > 180) a2 += 360; + q.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s2.push(pop(s2) + "rotate(" + b2 + degParen); + } + } + function skewX(a2, b2, s2, q) { + if (a2 !== b2) { + q.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s2.push(pop(s2) + "skewX(" + b2 + degParen); + } + } + function scale2(xa, ya, xb, yb, s2, q) { + if (xa !== xb || ya !== yb) { + var i = s2.push(pop(s2) + "scale(", null, ",", null, ")"); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb !== 1 || yb !== 1) { + s2.push(pop(s2) + "scale(" + xb + "," + yb + ")"); + } + } + return function(a2, b2) { + var s2 = [], q = []; + a2 = parse2(a2), b2 = parse2(b2); + translate2(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q); + rotate2(a2.rotate, b2.rotate, s2, q); + skewX(a2.skewX, b2.skewX, s2, q); + scale2(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q); + a2 = b2 = null; + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s2[(o = q[i]).i] = o.x(t); + return s2.join(""); + }; + }; + } + var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); + var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + var epsilon2$1 = 1e-12; + function cosh(x2) { + return ((x2 = Math.exp(x2)) + 1 / x2) / 2; + } + function sinh(x2) { + return ((x2 = Math.exp(x2)) - 1 / x2) / 2; + } + function tanh(x2) { + return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1); + } + const zoom$1 = (function zoomRho(rho, rho2, rho4) { + function zoom2(p02, p1) { + var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < epsilon2$1) { + S = Math.log(w1 / w0) / rho; + i = function(t) { + return [ + ux0 + t * dx, + uy0 + t * dy, + w0 * Math.exp(rho * t * S) + ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / rho; + i = function(t) { + var s2 = t * S, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0)); + return [ + ux0 + u2 * dx, + uy0 + u2 * dy, + w0 * coshr0 / cosh(rho * s2 + r0) + ]; }; + } + i.duration = S * 1e3 * rho / Math.SQRT2; + return i; + } + zoom2.rho = function(_) { + var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; + return zoomRho(_1, _2, _4); }; -} -exports.default = hsl((0, _colorJs.hue)); -var hslLong = hsl((0, _colorJsDefault.default)); - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"drgXo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>lab); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function lab(start, end) { - var l = (0, _colorJsDefault.default)((start = (0, _d3Color.lab)(start)).l, (end = (0, _d3Color.lab)(end)).l), a = (0, _colorJsDefault.default)(start.a, end.a), b = (0, _colorJsDefault.default)(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { + return zoom2; + })(Math.SQRT2, 2, 4); + function hsl(hue2) { + return function(start, end) { + var h2 = hue2((start = hsl$1(start)).h, (end = hsl$1(end)).h), s2 = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.s = s2(t); start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); + start.opacity = opacity2(t); return start + ""; + }; + }; + } + const hsl_default = hsl(hue$1); + var hslLong = hsl(nogamma); + function lab(start, end) { + var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l), a2 = nogamma(start.a, end.a), b2 = nogamma(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.l = l(t); + start.a = a2(t); + start.b = b2(t); + start.opacity = opacity2(t); + return start + ""; }; -} - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e1eQm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hclLong", ()=>hclLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hcl(hue) { + } + function hcl(hue2) { return function(start, end) { - var h = hue((start = (0, _d3Color.hcl)(start)).h, (end = (0, _d3Color.hcl)(end)).h), c = (0, _colorJsDefault.default)(start.c, end.c), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); + var h2 = hue2((start = hcl$1(start)).h, (end = hcl$1(end)).h), c2 = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.c = c2(t); + start.l = l(t); + start.opacity = opacity2(t); + return start + ""; + }; + }; + } + const hcl_default = hcl(hue$1); + var hclLong = hcl(nogamma); + function cubehelix(hue2) { + return (function cubehelixGamma(y2) { + y2 = +y2; + function cubehelix2(start, end) { + var h2 = hue2((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h), s2 = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; + start.h = h2(t); + start.s = s2(t); + start.l = l(Math.pow(t, y2)); + start.opacity = opacity2(t); + return start + ""; }; - }; -} -exports.default = hcl((0, _colorJs.hue)); -var hclLong = hcl((0, _colorJsDefault.default)); - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fTm9T":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubehelixLong", ()=>cubehelixLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function cubehelix(hue) { - return function cubehelixGamma(y) { - y = +y; - function cubehelix(start, end) { - var h = hue((start = (0, _d3Color.cubehelix)(start)).h, (end = (0, _d3Color.cubehelix)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - cubehelix.gamma = cubehelixGamma; - return cubehelix; - }(1); -} -exports.default = cubehelix((0, _colorJs.hue)); -var cubehelixLong = cubehelix((0, _colorJsDefault.default)); - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3wh8c":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>piecewise); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -function piecewise(interpolate, values) { - if (values === undefined) values = interpolate, interpolate = (0, _valueJsDefault.default); - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while(i < n)I[i] = interpolate(v, v = values[++i]); + } + cubehelix2.gamma = cubehelixGamma; + return cubehelix2; + })(1); + } + const cubehelix_default = cubehelix(hue$1); + var cubehelixLong = cubehelix(nogamma); + function piecewise(interpolate2, values2) { + if (values2 === void 0) values2 = interpolate2, interpolate2 = interpolate$1; + var i = 0, n = values2.length - 1, v = values2[0], I = new Array(n < 0 ? 0 : n); + while (i < n) I[i] = interpolate2(v, v = values2[++i]); return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; -} - -},{"./value.js":"gfJPE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6KHTv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(interpolator, n) { - var samples = new Array(n); - for(var i = 0; i < n; ++i)samples[i] = interpolator(i / (n - 1)); - return samples; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3WTV4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constants); -function constants(x) { + var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); + return I[i2](t - i2); + }; + } + function quantize$2(interpolator, n) { + var samples = new Array(n); + for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + return samples; + } + const $$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + interpolate: interpolate$1, + interpolateArray: array$5, + interpolateBasis: basis$1, + interpolateBasisClosed: basisClosed, + interpolateCubehelix: cubehelix_default, + interpolateCubehelixLong: cubehelixLong, + interpolateDate: date$1, + interpolateDiscrete: discrete$1, + interpolateHcl: hcl_default, + interpolateHclLong: hclLong, + interpolateHsl: hsl_default, + interpolateHslLong: hslLong, + interpolateHue: hue, + interpolateLab: lab, + interpolateNumber, + interpolateNumberArray: numberArray, + interpolateObject: object$1, + interpolateRgb: rgb, + interpolateRgbBasis: rgbBasis, + interpolateRgbBasisClosed: rgbBasisClosed, + interpolateRound, + interpolateString: string, + interpolateTransformCss, + interpolateTransformSvg, + interpolateZoom: zoom$1, + piecewise, + quantize: quantize$2 + }, Symbol.toStringTag, { value: "Module" })); + function constants(x2) { return function() { - return x; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aUICk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -function number(x) { - return +x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fHwUM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>tickFormat); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -function tickFormat(start, stop, count, specifier) { - var step = (0, _d3Array.tickStep)(start, stop, count), precision; - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ",f" : specifier); - switch(specifier.type){ - case "s": - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return (0, _d3Format.formatPrefix)(specifier, value); - case "": - case "e": - case "g": - case "p": - case "r": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionRound)(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - case "f": - case "%": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; + return x2; + }; + } + function number$5(x2) { + return +x2; + } + var unit = [0, 1]; + function identity$6(x2) { + return x2; + } + function normalize$2(a2, b2) { + return (b2 -= a2 = +a2) ? function(x2) { + return (x2 - a2) / b2; + } : constants(isNaN(b2) ? NaN : 0.5); + } + function clamper(a2, b2) { + var t; + if (a2 > b2) t = a2, a2 = b2, b2 = t; + return function(x2) { + return Math.max(a2, Math.min(b2, x2)); + }; + } + function bimap(domain2, range2, interpolate2) { + var d0 = domain2[0], d1 = domain2[1], r0 = range2[0], r1 = range2[1]; + if (d1 < d0) d0 = normalize$2(d1, d0), r0 = interpolate2(r1, r0); + else d0 = normalize$2(d0, d1), r0 = interpolate2(r0, r1); + return function(x2) { + return r0(d0(x2)); + }; + } + function polymap(domain2, range2, interpolate2) { + var j = Math.min(domain2.length, range2.length) - 1, d2 = new Array(j), r = new Array(j), i = -1; + if (domain2[j] < domain2[0]) { + domain2 = domain2.slice().reverse(); + range2 = range2.slice().reverse(); } - return (0, _d3Format.format)(specifier); -} - -},{"d3-array":"5lCYW","d3-format":"4fjQY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4fjQY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "formatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "format", ()=>(0, _defaultLocaleJs.format)); -parcelHelpers.export(exports, "formatPrefix", ()=>(0, _defaultLocaleJs.formatPrefix)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "formatSpecifier", ()=>(0, _formatSpecifierJsDefault.default)); -parcelHelpers.export(exports, "FormatSpecifier", ()=>(0, _formatSpecifierJs.FormatSpecifier)); -parcelHelpers.export(exports, "precisionFixed", ()=>(0, _precisionFixedJsDefault.default)); -parcelHelpers.export(exports, "precisionPrefix", ()=>(0, _precisionPrefixJsDefault.default)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _precisionRoundJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _precisionFixedJs = require("./precisionFixed.js"); -var _precisionFixedJsDefault = parcelHelpers.interopDefault(_precisionFixedJs); -var _precisionPrefixJs = require("./precisionPrefix.js"); -var _precisionPrefixJsDefault = parcelHelpers.interopDefault(_precisionPrefixJs); -var _precisionRoundJs = require("./precisionRound.js"); -var _precisionRoundJsDefault = parcelHelpers.interopDefault(_precisionRoundJs); - -},{"./defaultLocale.js":"jzS6R","./locale.js":"9NtbG","./formatSpecifier.js":"iBXoR","./precisionFixed.js":"kTPBo","./precisionPrefix.js":"cmgfB","./precisionRound.js":"g5X8k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jzS6R":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formatPrefix", ()=>formatPrefix); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var format; -var formatPrefix; -defaultLocale({ - thousands: ",", - grouping: [ - 3 - ], - currency: [ - "$", - "" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} - -},{"./locale.js":"9NtbG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9NtbG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? (0, _identityJsDefault.default) : (0, _formatGroupJsDefault.default)(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? (0, _identityJsDefault.default) : (0, _formatNumeralsJsDefault.default)(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "\u2212" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - function newFormat(specifier) { - specifier = (0, _formatSpecifierJsDefault.default)(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - else if (!(0, _formatTypesJsDefault.default)[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - // If zero fill is specified, padding goes after sign and before digits. - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = (0, _formatTypesJsDefault.default)[type], maybeSuffix = /[defgprs%]/.test(type); - // Set the default precision if not specified, - // or clamp the specified precision to the supported range. - // For significant precision, it must be in [1, 21]. - // For fixed precision, it must be in [0, 20]. - precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - // Trim insignificant zeros. - if (trim) value = (0, _formatTrimJsDefault.default)(value); - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + (0, _formatPrefixAutoJs.prefixExponent) / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while(++i < n)if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - // Reconstruct the final output based on the desired alignment. - switch(align){ - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format.toString = function() { - return specifier + ""; - }; - return format; - } - function formatPrefix(specifier, value) { - var f = newFormat((specifier = (0, _formatSpecifierJsDefault.default)(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; - } - return { - format: newFormat, - formatPrefix: formatPrefix - }; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); -var _formatGroupJs = require("./formatGroup.js"); -var _formatGroupJsDefault = parcelHelpers.interopDefault(_formatGroupJs); -var _formatNumeralsJs = require("./formatNumerals.js"); -var _formatNumeralsJsDefault = parcelHelpers.interopDefault(_formatNumeralsJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _formatTrimJs = require("./formatTrim.js"); -var _formatTrimJsDefault = parcelHelpers.interopDefault(_formatTrimJs); -var _formatTypesJs = require("./formatTypes.js"); -var _formatTypesJsDefault = parcelHelpers.interopDefault(_formatTypesJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var map = Array.prototype.map, prefixes = [ - "y", - "z", - "a", - "f", - "p", - "n", - "\xb5", - "m", - "", - "k", - "M", - "G", - "T", - "P", - "E", - "Z", - "Y" -]; - -},{"./exponent.js":"aOeaO","./formatGroup.js":"jZnQc","./formatNumerals.js":"3gAed","./formatSpecifier.js":"iBXoR","./formatTrim.js":"gCu3n","./formatTypes.js":"dfzgV","./formatPrefixAuto.js":"iUhuq","./identity.js":"brXEh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aOeaO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x = (0, _formatDecimalJs.formatDecimalParts)(Math.abs(x)), x ? x[1] : NaN; - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"hs37D","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hs37D":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); - }); -// Computes the decimal coefficient and exponent of the specified number x with -// significant digits p, where x is positive and p is in [1, 21] or undefined. -// For example, formatDecimalParts(1.23) returns ["123", 0]. -parcelHelpers.export(exports, "formatDecimalParts", ()=>formatDecimalParts); -function formatDecimalParts(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = x.slice(0, i); - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). + while (++i < j) { + d2[i] = normalize$2(domain2[i], domain2[i + 1]); + r[i] = interpolate2(range2[i], range2[i + 1]); + } + return function(x2) { + var i2 = bisectRight$1(domain2, x2, 1, j) - 1; + return r[i2](d2[i2](x2)); + }; + } + function copy$2(source2, target2) { + return target2.domain(source2.domain()).range(source2.range()).interpolate(source2.interpolate()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function transformer$3() { + var domain2 = unit, range2 = unit, interpolate2 = interpolate$1, transform2, untransform, unknown, clamp2 = identity$6, piecewise2, output2, input; + function rescale() { + var n = Math.min(domain2.length, range2.length); + if (clamp2 !== identity$6) clamp2 = clamper(domain2[0], domain2[n - 1]); + piecewise2 = n > 2 ? polymap : bimap; + output2 = input = null; + return scale2; + } + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : (output2 || (output2 = piecewise2(domain2.map(transform2), range2, interpolate2)))(transform2(clamp2(x2))); + } + scale2.invert = function(y2) { + return clamp2(untransform((input || (input = piecewise2(range2, domain2.map(transform2), interpolateNumber)))(y2))); + }; + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), rescale()) : domain2.slice(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); + }; + scale2.rangeRound = function(_) { + return range2 = Array.from(_), interpolate2 = interpolateRound, rescale(); + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = _ ? true : identity$6, rescale()) : clamp2 !== identity$6; + }; + scale2.interpolate = function(_) { + return arguments.length ? (interpolate2 = _, rescale()) : interpolate2; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + return function(t, u2) { + transform2 = t, untransform = u2; + return rescale(); + }; + } + function continuous$1() { + return transformer$3()(identity$6, identity$6); + } + function formatDecimal$1(x2) { + return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); + } + function formatDecimalParts$1(x2, p) { + if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; + var i, coefficient = x2.slice(0, i); return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x2.slice(i + 1) ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jZnQc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while(i > 0 && g > 0){ - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3gAed":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iBXoR":[function(require,module,exports,__globalThis) { -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatSpecifier); -parcelHelpers.export(exports, "FormatSpecifier", ()=>FormatSpecifier); -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] + } + function exponent$1(x2) { + return x2 = formatDecimalParts$1(Math.abs(x2)), x2 ? x2[1] : NaN; + } + function formatGroup$1(grouping, thousands) { + return function(value2, width2) { + var i = value2.length, t = [], j = 0, g = grouping[0], length2 = 0; + while (i > 0 && g > 0) { + if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); + t.push(value2.substring(i -= g, i + g)); + if ((length2 += g + 1) > width2) break; + g = grouping[j = (j + 1) % grouping.length]; + } + return t.reverse().join(thousands); + }; + } + function formatNumerals$1(numerals) { + return function(value2) { + return value2.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } + var re$1 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + function formatSpecifier$1(specifier) { + if (!(match2 = re$1.exec(specifier))) throw new Error("invalid format: " + specifier); + var match2; + return new FormatSpecifier$1({ + fill: match2[1], + align: match2[2], + sign: match2[3], + symbol: match2[4], + zero: match2[5], + width: match2[6], + comma: match2[7], + precision: match2[8] && match2[8].slice(1), + trim: match2[9], + type: match2[10] }); -} -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof -function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; + } + formatSpecifier$1.prototype = FormatSpecifier$1.prototype; + function FormatSpecifier$1(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} -FormatSpecifier.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gCu3n":[function(require,module,exports,__globalThis) { -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(s) { - out: for(var n = s.length, i = 1, i0 = -1, i1; i < n; ++i)switch(s[i]){ - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + FormatSpecifier$1.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + function formatTrim$1(s2) { + out: for (var n = s2.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s2[i]) { + case ".": + i0 = i1 = i; + break; + case "0": + if (i0 === 0) i0 = i; + i1 = i; + break; + default: + if (!+s2[i]) break out; + if (i0 > 0) i0 = 0; + break; + } + } + return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2; + } + var prefixExponent$1; + function formatPrefixAuto$1(x2, p) { + var d2 = formatDecimalParts$1(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1], i = exponent2 - (prefixExponent$1 = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; + return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts$1(x2, Math.max(0, p + i - 1))[0]; + } + function formatRounded$1(x2, p) { + var d2 = formatDecimalParts$1(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1]; + return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); + } + const formatTypes$1 = { + "%": (x2, p) => (x2 * 100).toFixed(p), + "b": (x2) => Math.round(x2).toString(2), + "c": (x2) => x2 + "", + "d": formatDecimal$1, + "e": (x2, p) => x2.toExponential(p), + "f": (x2, p) => x2.toFixed(p), + "g": (x2, p) => x2.toPrecision(p), + "o": (x2) => Math.round(x2).toString(8), + "p": (x2, p) => formatRounded$1(x2 * 100, p), + "r": formatRounded$1, + "s": formatPrefixAuto$1, + "X": (x2) => Math.round(x2).toString(16).toUpperCase(), + "x": (x2) => Math.round(x2).toString(16) + }; + function identity$5(x2) { + return x2; + } + var map$3 = Array.prototype.map, prefixes$1 = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; + function formatLocale$2(locale2) { + var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$5 : formatGroup$1(map$3.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$5 : formatNumerals$1(map$3.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "−" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; + function newFormat(specifier) { + specifier = formatSpecifier$1(specifier); + var fill2 = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol2 = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type; + if (type2 === "n") comma = true, type2 = "g"; + else if (!formatTypes$1[type2]) precision === void 0 && (precision = 12), trim = true, type2 = "g"; + if (zero2 || fill2 === "0" && align === "=") zero2 = true, fill2 = "0", align = "="; + var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; + var formatType = formatTypes$1[type2], maybeSuffix = /[defgprs%]/.test(type2); + precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format2(value2) { + var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; + if (type2 === "c") { + valueSuffix = formatType(value2) + valueSuffix; + value2 = ""; + } else { + value2 = +value2; + var valueNegative = value2 < 0 || 1 / value2 < 0; + value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); + if (trim) value2 = formatTrim$1(value2); + if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; + valueSuffix = (type2 === "s" ? prefixes$1[8 + prefixExponent$1 / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); + if (maybeSuffix) { + i = -1, n = value2.length; + while (++i < n) { + if (c2 = value2.charCodeAt(i), 48 > c2 || c2 > 57) { + valueSuffix = (c2 === 46 ? decimal + value2.slice(i + 1) : value2.slice(i)) + valueSuffix; + value2 = value2.slice(0, i); break; + } + } + } } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfzgV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _formatDecimalJs = require("./formatDecimal.js"); -var _formatDecimalJsDefault = parcelHelpers.interopDefault(_formatDecimalJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _formatPrefixAutoJsDefault = parcelHelpers.interopDefault(_formatPrefixAutoJs); -var _formatRoundedJs = require("./formatRounded.js"); -var _formatRoundedJsDefault = parcelHelpers.interopDefault(_formatRoundedJs); -exports.default = { - "%": (x, p)=>(x * 100).toFixed(p), - "b": (x)=>Math.round(x).toString(2), - "c": (x)=>x + "", - "d": (0, _formatDecimalJsDefault.default), - "e": (x, p)=>x.toExponential(p), - "f": (x, p)=>x.toFixed(p), - "g": (x, p)=>x.toPrecision(p), - "o": (x)=>Math.round(x).toString(8), - "p": (x, p)=>(0, _formatRoundedJsDefault.default)(x * 100, p), - "r": (0, _formatRoundedJsDefault.default), - "s": (0, _formatPrefixAutoJsDefault.default), - "X": (x)=>Math.round(x).toString(16).toUpperCase(), - "x": (x)=>Math.round(x).toString(16) -}; - -},{"./formatDecimal.js":"hs37D","./formatPrefixAuto.js":"iUhuq","./formatRounded.js":"l08jr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUhuq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixExponent", ()=>prefixExponent); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + (0, _formatDecimalJs.formatDecimalParts)(x, Math.max(0, p + i - 1))[0]; // less than 1y! - }); -var _formatDecimalJs = require("./formatDecimal.js"); -var prefixExponent; - -},{"./formatDecimal.js":"hs37D","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l08jr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"hs37D","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"brXEh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kTPBo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step) { - return Math.max(0, -(0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"aOeaO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cmgfB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3 - (0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"aOeaO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g5X8k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, (0, _exponentJsDefault.default)(max) - (0, _exponentJsDefault.default)(step)) + 1; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"aOeaO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5BBe1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loggish", ()=>loggish); -parcelHelpers.export(exports, "default", ()=>log); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformLog(x) { - return Math.log(x); -} -function transformExp(x) { - return Math.exp(x); -} -function transformLogn(x) { - return -Math.log(-x); -} -function transformExpn(x) { - return -Math.exp(-x); -} -function pow10(x) { - return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; -} -function powp(base) { - return base === 10 ? pow10 : base === Math.E ? Math.exp : (x)=>Math.pow(base, x); -} -function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x)=>Math.log(x) / base); -} -function reflect(f) { - return (x, k)=>-f(-x, k); -} -function loggish(transform) { - const scale = transform(transformLog, transformExp); - const domain = scale.domain; - let base = 10; + if (comma && !zero2) value2 = group2(value2, Infinity); + var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) : ""; + if (comma && zero2) value2 = group2(padding2 + value2, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; + switch (align) { + case "<": + value2 = valuePrefix + value2 + valueSuffix + padding2; + break; + case "=": + value2 = valuePrefix + padding2 + value2 + valueSuffix; + break; + case "^": + value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); + break; + default: + value2 = padding2 + valuePrefix + value2 + valueSuffix; + break; + } + return numerals(value2); + } + format2.toString = function() { + return specifier + ""; + }; + return format2; + } + function formatPrefix2(specifier, value2) { + var f = newFormat((specifier = formatSpecifier$1(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent$1(value2) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes$1[8 + e / 3]; + return function(value3) { + return f(k * value3) + prefix; + }; + } + return { + format: newFormat, + formatPrefix: formatPrefix2 + }; + } + var locale$3; + var format$4; + var formatPrefix; + defaultLocale$3({ + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); + function defaultLocale$3(definition2) { + locale$3 = formatLocale$2(definition2); + format$4 = locale$3.format; + formatPrefix = locale$3.formatPrefix; + return locale$3; + } + function precisionFixed(step) { + return Math.max(0, -exponent$1(Math.abs(step))); + } + function precisionPrefix(step, value2) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value2) / 3))) * 3 - exponent$1(Math.abs(step))); + } + function precisionRound(step, max2) { + step = Math.abs(step), max2 = Math.abs(max2) - step; + return Math.max(0, exponent$1(max2) - exponent$1(step)) + 1; + } + function tickFormat$1(start, stop2, count2, specifier) { + var step = tickStep(start, stop2, count2), precision; + specifier = formatSpecifier$1(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value2 = Math.max(Math.abs(start), Math.abs(stop2)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value2))) specifier.precision = precision; + return formatPrefix(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop2))))) specifier.precision = precision - (specifier.type === "e"); + break; + } + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; + break; + } + } + return format$4(specifier); + } + function linearish(scale2) { + var domain2 = scale2.domain; + scale2.ticks = function(count2) { + var d2 = domain2(); + return ticks(d2[0], d2[d2.length - 1], count2 == null ? 10 : count2); + }; + scale2.tickFormat = function(count2, specifier) { + var d2 = domain2(); + return tickFormat$1(d2[0], d2[d2.length - 1], count2 == null ? 10 : count2, specifier); + }; + scale2.nice = function(count2) { + if (count2 == null) count2 = 10; + var d2 = domain2(); + var i0 = 0; + var i1 = d2.length - 1; + var start = d2[i0]; + var stop2 = d2[i1]; + var prestep; + var step; + var maxIter = 10; + if (stop2 < start) { + step = start, start = stop2, stop2 = step; + step = i0, i0 = i1, i1 = step; + } + while (maxIter-- > 0) { + step = tickIncrement(start, stop2, count2); + if (step === prestep) { + d2[i0] = start; + d2[i1] = stop2; + return domain2(d2); + } else if (step > 0) { + start = Math.floor(start / step) * step; + stop2 = Math.ceil(stop2 / step) * step; + } else if (step < 0) { + start = Math.ceil(start * step) / step; + stop2 = Math.floor(stop2 * step) / step; + } else { + break; + } + prestep = step; + } + return scale2; + }; + return scale2; + } + function linear$1() { + var scale2 = continuous$1(); + scale2.copy = function() { + return copy$2(scale2, linear$1()); + }; + initRange.apply(scale2, arguments); + return linearish(scale2); + } + function identity$4(domain2) { + var unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : x2; + } + scale2.invert = scale2; + scale2.domain = scale2.range = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), scale2) : domain2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return identity$4(domain2).unknown(unknown); + }; + domain2 = arguments.length ? Array.from(domain2, number$5) : [0, 1]; + return linearish(scale2); + } + function nice(domain2, interval2) { + domain2 = domain2.slice(); + var i0 = 0, i1 = domain2.length - 1, x02 = domain2[i0], x12 = domain2[i1], t; + if (x12 < x02) { + t = i0, i0 = i1, i1 = t; + t = x02, x02 = x12, x12 = t; + } + domain2[i0] = interval2.floor(x02); + domain2[i1] = interval2.ceil(x12); + return domain2; + } + function transformLog(x2) { + return Math.log(x2); + } + function transformExp(x2) { + return Math.exp(x2); + } + function transformLogn(x2) { + return -Math.log(-x2); + } + function transformExpn(x2) { + return -Math.exp(-x2); + } + function pow10(x2) { + return isFinite(x2) ? +("1e" + x2) : x2 < 0 ? 0 : x2; + } + function powp(base2) { + return base2 === 10 ? pow10 : base2 === Math.E ? Math.exp : (x2) => Math.pow(base2, x2); + } + function logp(base2) { + return base2 === Math.E ? Math.log : base2 === 10 && Math.log10 || base2 === 2 && Math.log2 || (base2 = Math.log(base2), (x2) => Math.log(x2) / base2); + } + function reflect(f) { + return (x2, k) => -f(-x2, k); + } + function loggish(transform2) { + const scale2 = transform2(transformLog, transformExp); + const domain2 = scale2.domain; + let base2 = 10; let logs; let pows; function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else transform(transformLog, transformExp); - return scale; - } - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.ticks = (count)=>{ - const d = domain(); - let u = d[0]; - let v = d[d.length - 1]; - const r = v < u; - if (r) [u, v] = [ - v, - u - ]; - let i = logs(u); - let j = logs(v); - let k; - let t; - const n = count == null ? 10 : +count; - let z = []; - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for(; i <= j; ++i)for(k = 1; k < base; ++k){ - t = i < 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - else for(; i <= j; ++i)for(k = base - 1; k >= 1; --k){ - t = i > 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - if (z.length * 2 < n) z = (0, _d3Array.ticks)(u, v, n); - } else z = (0, _d3Array.ticks)(i, j, Math.min(j - i, n)).map(pows); - return r ? z.reverse() : z; - }; - scale.tickFormat = (count, specifier)=>{ - if (count == null) count = 10; - if (specifier == null) specifier = base === 10 ? "s" : ","; - if (typeof specifier !== "function") { - if (!(base % 1) && (specifier = (0, _d3Format.formatSpecifier)(specifier)).precision == null) specifier.trim = true; - specifier = (0, _d3Format.format)(specifier); - } - if (count === Infinity) return specifier; - const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return (d)=>{ - let i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; + logs = logp(base2), pows = powp(base2); + if (domain2()[0] < 0) { + logs = reflect(logs), pows = reflect(pows); + transform2(transformLogn, transformExpn); + } else { + transform2(transformLog, transformExp); + } + return scale2; + } + scale2.base = function(_) { + return arguments.length ? (base2 = +_, rescale()) : base2; + }; + scale2.domain = function(_) { + return arguments.length ? (domain2(_), rescale()) : domain2(); + }; + scale2.ticks = (count2) => { + const d2 = domain2(); + let u2 = d2[0]; + let v = d2[d2.length - 1]; + const r = v < u2; + if (r) [u2, v] = [v, u2]; + let i = logs(u2); + let j = logs(v); + let k; + let t; + const n = count2 == null ? 10 : +count2; + let z2 = []; + if (!(base2 % 1) && j - i < n) { + i = Math.floor(i), j = Math.ceil(j); + if (u2 > 0) for (; i <= j; ++i) { + for (k = 1; k < base2; ++k) { + t = i < 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z2.push(t); + } + } + else for (; i <= j; ++i) { + for (k = base2 - 1; k >= 1; --k) { + t = i > 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z2.push(t); + } + } + if (z2.length * 2 < n) z2 = ticks(u2, v, n); + } else { + z2 = ticks(i, j, Math.min(j - i, n)).map(pows); + } + return r ? z2.reverse() : z2; + }; + scale2.tickFormat = (count2, specifier) => { + if (count2 == null) count2 = 10; + if (specifier == null) specifier = base2 === 10 ? "s" : ","; + if (typeof specifier !== "function") { + if (!(base2 % 1) && (specifier = formatSpecifier$1(specifier)).precision == null) specifier.trim = true; + specifier = format$4(specifier); + } + if (count2 === Infinity) return specifier; + const k = Math.max(1, base2 * count2 / scale2.ticks().length); + return (d2) => { + let i = d2 / pows(Math.round(logs(d2))); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k ? specifier(d2) : ""; + }; + }; + scale2.nice = () => { + return domain2(nice(domain2(), { + floor: (x2) => pows(Math.floor(logs(x2))), + ceil: (x2) => pows(Math.ceil(logs(x2))) + })); + }; + return scale2; + } + function log$4() { + const scale2 = loggish(transformer$3()).domain([1, 10]); + scale2.copy = () => copy$2(scale2, log$4()).base(scale2.base()); + initRange.apply(scale2, arguments); + return scale2; + } + function transformSymlog(c2) { + return function(x2) { + return Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); }; - scale.nice = ()=>{ - return domain((0, _niceJsDefault.default)(domain(), { - floor: (x)=>pows(Math.floor(logs(x))), - ceil: (x)=>pows(Math.ceil(logs(x))) - })); + } + function transformSymexp(c2) { + return function(x2) { + return Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + }; + } + function symlogish(transform2) { + var c2 = 1, scale2 = transform2(transformSymlog(c2), transformSymexp(c2)); + scale2.constant = function(_) { + return arguments.length ? transform2(transformSymlog(c2 = +_), transformSymexp(c2)) : c2; + }; + return linearish(scale2); + } + function symlog$1() { + var scale2 = symlogish(transformer$3()); + scale2.copy = function() { + return copy$2(scale2, symlog$1()).constant(scale2.constant()); + }; + return initRange.apply(scale2, arguments); + } + function transformPow(exponent2) { + return function(x2) { + return x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); }; - return scale; -} -function log() { - const scale = loggish((0, _continuousJs.transformer)()).domain([ - 1, - 10 - ]); - scale.copy = ()=>(0, _continuousJs.copy)(scale, log()).base(scale.base()); - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"5lCYW","d3-format":"4fjQY","./nice.js":"ig9Ha","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ig9Ha":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - domain[i0] = interval.floor(x0); - domain[i1] = interval.ceil(x1); - return domain; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"26cMO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symlogish", ()=>symlogish); -parcelHelpers.export(exports, "default", ()=>symlog); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformSymlog(c) { - return function(x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; -} -function transformSymexp(c) { - return function(x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; -} -function symlogish(transform) { - var c = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - return (0, _linearJs.linearish)(scale); -} -function symlog() { - var scale = symlogish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, symlog()).constant(scale.constant()); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"./linear.js":"ik2PQ","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ah9R8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "powish", ()=>powish); -parcelHelpers.export(exports, "default", ()=>pow); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformPow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; -} -function transformSqrt(x) { - return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x); -} -function transformSquare(x) { - return x < 0 ? -x * x : x * x; -} -function powish(transform) { - var scale = transform((0, _continuousJs.identity), (0, _continuousJs.identity)), exponent = 1; + } + function transformSqrt(x2) { + return x2 < 0 ? -Math.sqrt(-x2) : Math.sqrt(x2); + } + function transformSquare(x2) { + return x2 < 0 ? -x2 * x2 : x2 * x2; + } + function powish(transform2) { + var scale2 = transform2(identity$6, identity$6), exponent2 = 1; function rescale() { - return exponent === 1 ? transform((0, _continuousJs.identity), (0, _continuousJs.identity)) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - return (0, _linearJs.linearish)(scale); -} -function pow() { - var scale = powish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, pow()).exponent(scale.exponent()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} -function sqrt() { - return pow.apply(null, arguments).exponent(0.5); -} - -},{"./linear.js":"ik2PQ","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eL6SH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>radial); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function square(x) { - return Math.sign(x) * x * x; -} -function unsquare(x) { - return Math.sign(x) * Math.sqrt(Math.abs(x)); -} -function radial() { - var squared = (0, _continuousJsDefault.default)(), range = [ - 0, - 1 - ], round = false, unknown; - function scale(x) { - var y = unsquare(squared(x)); - return isNaN(y) ? unknown : round ? Math.round(y) : y; - } - scale.invert = function(y) { - return squared.invert(square(y)); - }; - scale.domain = function(_) { - return arguments.length ? (squared.domain(_), scale) : squared.domain(); - }; - scale.range = function(_) { - return arguments.length ? (squared.range((range = Array.from(_, (0, _numberJsDefault.default))).map(square)), scale) : range.slice(); - }; - scale.rangeRound = function(_) { - return scale.range(_).round(true); - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, scale) : round; - }; - scale.clamp = function(_) { - return arguments.length ? (squared.clamp(_), scale) : squared.clamp(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return radial(squared.domain(), range).round(round).clamp(squared.clamp()).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return (0, _linearJs.linearish)(scale); -} - -},{"./continuous.js":"2SYx4","./init.js":"ijd73","./linear.js":"ik2PQ","./number.js":"aUICk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ENbdr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function quantile() { - var domain = [], range = [], thresholds = [], unknown; + return exponent2 === 1 ? transform2(identity$6, identity$6) : exponent2 === 0.5 ? transform2(transformSqrt, transformSquare) : transform2(transformPow(exponent2), transformPow(1 / exponent2)); + } + scale2.exponent = function(_) { + return arguments.length ? (exponent2 = +_, rescale()) : exponent2; + }; + return linearish(scale2); + } + function pow$4() { + var scale2 = powish(transformer$3()); + scale2.copy = function() { + return copy$2(scale2, pow$4()).exponent(scale2.exponent()); + }; + initRange.apply(scale2, arguments); + return scale2; + } + function sqrt$3() { + return pow$4.apply(null, arguments).exponent(0.5); + } + function quantile() { + var domain2 = [], range2 = [], thresholds = [], unknown; function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while(++i < n)thresholds[i - 1] = (0, _d3Array.quantileSorted)(domain, i / n); - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : range[(0, _d3Array.bisect)(thresholds, x)]; - } - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : [ - i > 0 ? thresholds[i - 1] : domain[0], - i < thresholds.length ? thresholds[i] : domain[domain.length - 1] - ]; + var i = 0, n = Math.max(1, range2.length); + thresholds = new Array(n - 1); + while (++i < n) thresholds[i - 1] = quantileSorted(domain2, i / n); + return scale2; + } + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : range2[bisectRight$1(thresholds, x2)]; + } + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : [ + i > 0 ? thresholds[i - 1] : domain2[0], + i < thresholds.length ? thresholds[i] : domain2[domain2.length - 1] + ]; }; - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return rescale(); + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = []; + for (let d2 of _) if (d2 != null && !isNaN(d2 = +d2)) domain2.push(d2); + domain2.sort(ascending$2); + return rescale(); }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.quantiles = function() { - return thresholds.slice(); - }; - scale.copy = function() { - return quantile().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Cxz6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantize); -var _d3Array = require("d3-array"); -var _linearJs = require("./linear.js"); -var _initJs = require("./init.js"); -function quantize() { - var x0 = 0, x1 = 1, n = 1, domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.quantiles = function() { + return thresholds.slice(); + }; + scale2.copy = function() { + return quantile().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + function quantize$1() { + var x02 = 0, x12 = 1, n = 1, domain2 = [0.5], range2 = [0, 1], unknown; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; } function rescale() { - var i = -1; - domain = new Array(n); - while(++i < n)domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [ - x0, - x1 - ]; + var i = -1; + domain2 = new Array(n); + while (++i < n) domain2[i] = ((i + 1) * x12 - (i - n) * x02) / (n + 1); + return scale2; + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, x02 = +x02, x12 = +x12, rescale()) : [x02, x12]; }; - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : i < 1 ? [ - x0, - domain[0] - ] : i >= n ? [ - domain[n - 1], - x1 - ] : [ - domain[i - 1], - domain[i] - ]; + scale2.range = function(_) { + return arguments.length ? (n = (range2 = Array.from(_)).length - 1, rescale()) : range2.slice(); }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - scale.thresholds = function() { - return domain.slice(); - }; - scale.copy = function() { - return quantize().domain([ - x0, - x1 - ]).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply((0, _linearJs.linearish)(scale), arguments); -} - -},{"d3-array":"5lCYW","./linear.js":"ik2PQ","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lQqvO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>threshold); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function threshold() { - var domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown, n = 1; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; - } - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : i < 1 ? [x02, domain2[0]] : i >= n ? [domain2[n - 1], x12] : [domain2[i - 1], domain2[i]]; }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : scale2; }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [ - domain[i - 1], - domain[i] - ]; + scale2.thresholds = function() { + return domain2.slice(); }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return threshold().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dtq1F":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "calendar", ()=>calendar); -parcelHelpers.export(exports, "default", ()=>time); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -function date(t) { - return new Date(t); -} -function number(t) { - return t instanceof Date ? +t : +new Date(+t); -} -function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) { - var scale = (0, _continuousJsDefault.default)(), invert = scale.invert, domain = scale.domain; - var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y"); - function tickFormat(date) { - return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); - } - scale.invert = function(y) { - return new Date(invert(y)); - }; - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number)) : domain().map(date); - }; - scale.ticks = function(interval) { - var d = domain(); - return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval); - }; - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - scale.nice = function(interval) { - var d = domain(); - if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); - return interval ? domain((0, _niceJsDefault.default)(d, interval)) : scale; - }; - scale.copy = function() { - return (0, _continuousJs.copy)(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format)); - }; - return scale; -} -function time() { - return (0, _initJs.initRange).apply(calendar((0, _d3Time.timeTicks), (0, _d3Time.timeTickInterval), (0, _d3Time.timeYear), (0, _d3Time.timeMonth), (0, _d3Time.timeWeek), (0, _d3Time.timeDay), (0, _d3Time.timeHour), (0, _d3Time.timeMinute), (0, _d3Time.timeSecond), (0, _d3TimeFormat.timeFormat)).domain([ - new Date(2000, 0, 1), - new Date(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"6KMda","d3-time-format":"eC6Bi","./continuous.js":"2SYx4","./init.js":"ijd73","./nice.js":"ig9Ha","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6KMda":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>(0, _intervalJs.timeInterval)); -parcelHelpers.export(exports, "utcMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "utcMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "timeMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "timeMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "utcSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "utcSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "timeSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeMinute", ()=>(0, _minuteJs.timeMinute)); -parcelHelpers.export(exports, "timeMinutes", ()=>(0, _minuteJs.timeMinutes)); -parcelHelpers.export(exports, "utcMinute", ()=>(0, _minuteJs.utcMinute)); -parcelHelpers.export(exports, "utcMinutes", ()=>(0, _minuteJs.utcMinutes)); -parcelHelpers.export(exports, "timeHour", ()=>(0, _hourJs.timeHour)); -parcelHelpers.export(exports, "timeHours", ()=>(0, _hourJs.timeHours)); -parcelHelpers.export(exports, "utcHour", ()=>(0, _hourJs.utcHour)); -parcelHelpers.export(exports, "utcHours", ()=>(0, _hourJs.utcHours)); -parcelHelpers.export(exports, "timeDay", ()=>(0, _dayJs.timeDay)); -parcelHelpers.export(exports, "timeDays", ()=>(0, _dayJs.timeDays)); -parcelHelpers.export(exports, "utcDay", ()=>(0, _dayJs.utcDay)); -parcelHelpers.export(exports, "utcDays", ()=>(0, _dayJs.utcDays)); -parcelHelpers.export(exports, "unixDay", ()=>(0, _dayJs.unixDay)); -parcelHelpers.export(exports, "unixDays", ()=>(0, _dayJs.unixDays)); -parcelHelpers.export(exports, "timeWeek", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeWeeks", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeSunday", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeSundays", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeMonday", ()=>(0, _weekJs.timeMonday)); -parcelHelpers.export(exports, "timeMondays", ()=>(0, _weekJs.timeMondays)); -parcelHelpers.export(exports, "timeTuesday", ()=>(0, _weekJs.timeTuesday)); -parcelHelpers.export(exports, "timeTuesdays", ()=>(0, _weekJs.timeTuesdays)); -parcelHelpers.export(exports, "timeWednesday", ()=>(0, _weekJs.timeWednesday)); -parcelHelpers.export(exports, "timeWednesdays", ()=>(0, _weekJs.timeWednesdays)); -parcelHelpers.export(exports, "timeThursday", ()=>(0, _weekJs.timeThursday)); -parcelHelpers.export(exports, "timeThursdays", ()=>(0, _weekJs.timeThursdays)); -parcelHelpers.export(exports, "timeFriday", ()=>(0, _weekJs.timeFriday)); -parcelHelpers.export(exports, "timeFridays", ()=>(0, _weekJs.timeFridays)); -parcelHelpers.export(exports, "timeSaturday", ()=>(0, _weekJs.timeSaturday)); -parcelHelpers.export(exports, "timeSaturdays", ()=>(0, _weekJs.timeSaturdays)); -parcelHelpers.export(exports, "utcWeek", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcWeeks", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcSunday", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcSundays", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcMonday", ()=>(0, _weekJs.utcMonday)); -parcelHelpers.export(exports, "utcMondays", ()=>(0, _weekJs.utcMondays)); -parcelHelpers.export(exports, "utcTuesday", ()=>(0, _weekJs.utcTuesday)); -parcelHelpers.export(exports, "utcTuesdays", ()=>(0, _weekJs.utcTuesdays)); -parcelHelpers.export(exports, "utcWednesday", ()=>(0, _weekJs.utcWednesday)); -parcelHelpers.export(exports, "utcWednesdays", ()=>(0, _weekJs.utcWednesdays)); -parcelHelpers.export(exports, "utcThursday", ()=>(0, _weekJs.utcThursday)); -parcelHelpers.export(exports, "utcThursdays", ()=>(0, _weekJs.utcThursdays)); -parcelHelpers.export(exports, "utcFriday", ()=>(0, _weekJs.utcFriday)); -parcelHelpers.export(exports, "utcFridays", ()=>(0, _weekJs.utcFridays)); -parcelHelpers.export(exports, "utcSaturday", ()=>(0, _weekJs.utcSaturday)); -parcelHelpers.export(exports, "utcSaturdays", ()=>(0, _weekJs.utcSaturdays)); -parcelHelpers.export(exports, "timeMonth", ()=>(0, _monthJs.timeMonth)); -parcelHelpers.export(exports, "timeMonths", ()=>(0, _monthJs.timeMonths)); -parcelHelpers.export(exports, "utcMonth", ()=>(0, _monthJs.utcMonth)); -parcelHelpers.export(exports, "utcMonths", ()=>(0, _monthJs.utcMonths)); -parcelHelpers.export(exports, "timeYear", ()=>(0, _yearJs.timeYear)); -parcelHelpers.export(exports, "timeYears", ()=>(0, _yearJs.timeYears)); -parcelHelpers.export(exports, "utcYear", ()=>(0, _yearJs.utcYear)); -parcelHelpers.export(exports, "utcYears", ()=>(0, _yearJs.utcYears)); -parcelHelpers.export(exports, "utcTicks", ()=>(0, _ticksJs.utcTicks)); -parcelHelpers.export(exports, "utcTickInterval", ()=>(0, _ticksJs.utcTickInterval)); -parcelHelpers.export(exports, "timeTicks", ()=>(0, _ticksJs.timeTicks)); -parcelHelpers.export(exports, "timeTickInterval", ()=>(0, _ticksJs.timeTickInterval)); -var _intervalJs = require("./interval.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -var _ticksJs = require("./ticks.js"); - -},{"./interval.js":false,"./millisecond.js":"2UJoZ","./second.js":"bm0xM","./minute.js":"ifdFS","./hour.js":"xWpVx","./day.js":"aXPXh","./week.js":"1cvLV","./month.js":"764Za","./year.js":"4SlFD","./ticks.js":"9x0uu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9JWhy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -const t0 = new Date, t1 = new Date; -function timeInterval(floori, offseti, count, field) { - function interval(date) { - return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date; - } - interval.floor = (date)=>{ - return floori(date = new Date(+date)), date; - }; - interval.ceil = (date)=>{ - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - interval.round = (date)=>{ - const d0 = interval(date), d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - interval.offset = (date, step)=>{ - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - interval.range = (start, stop, step)=>{ - const range = []; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - let previous; - do range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - interval.filter = (test)=>{ - return timeInterval((date)=>{ - if (date >= date) while(floori(date), !test(date))date.setTime(date - 1); - }, (date, step)=>{ - if (date >= date) { - if (step < 0) while(++step <= 0){ - while(offseti(date, -1), !test(date)); // eslint-disable-line no-empty - } - else while(--step >= 0){ - while(offseti(date, 1), !test(date)); // eslint-disable-line no-empty - } - } - }); + scale2.copy = function() { + return quantize$1().domain([x02, x12]).range(range2).unknown(unknown); }; - if (count) { - interval.count = (start, end)=>{ - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - interval.every = (step)=>{ - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d)=>field(d) % step === 0 : (d)=>interval.count(0, d) % step === 0); - }; + return initRange.apply(linearish(scale2), arguments); + } + function threshold() { + var domain2 = [0.5], range2 = [0, 1], unknown, n = 1; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; } - return interval; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2UJoZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "millisecond", ()=>millisecond); -parcelHelpers.export(exports, "milliseconds", ()=>milliseconds); -var _intervalJs = require("./interval.js"); -const millisecond = (0, _intervalJs.timeInterval)(()=>{ -// noop -}, (date, step)=>{ - date.setTime(+date + step); -}, (start, end)=>{ + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : domain2.slice(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : range2.slice(); + }; + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return [domain2[i - 1], domain2[i]]; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return threshold().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + const t0$1 = /* @__PURE__ */ new Date(), t1 = /* @__PURE__ */ new Date(); + function timeInterval$1(floori, offseti, count2, field2) { + function interval2(date2) { + return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2; + } + interval2.floor = (date2) => { + return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2; + }; + interval2.ceil = (date2) => { + return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2; + }; + interval2.round = (date2) => { + const d0 = interval2(date2), d1 = interval2.ceil(date2); + return date2 - d0 < d1 - date2 ? d0 : d1; + }; + interval2.offset = (date2, step) => { + return offseti(date2 = /* @__PURE__ */ new Date(+date2), step == null ? 1 : Math.floor(step)), date2; + }; + interval2.range = (start, stop2, step) => { + const range2 = []; + start = interval2.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop2) || !(step > 0)) return range2; + let previous; + do + range2.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start); + while (previous < start && start < stop2); + return range2; + }; + interval2.filter = (test2) => { + return timeInterval$1((date2) => { + if (date2 >= date2) while (floori(date2), !test2(date2)) date2.setTime(date2 - 1); + }, (date2, step) => { + if (date2 >= date2) { + if (step < 0) while (++step <= 0) { + while (offseti(date2, -1), !test2(date2)) { + } + } + else while (--step >= 0) { + while (offseti(date2, 1), !test2(date2)) { + } + } + } + }); + }; + if (count2) { + interval2.count = (start, end) => { + t0$1.setTime(+start), t1.setTime(+end); + floori(t0$1), floori(t1); + return Math.floor(count2(t0$1, t1)); + }; + interval2.every = (step) => { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field2 ? (d2) => field2(d2) % step === 0 : (d2) => interval2.count(0, d2) % step === 0); + }; + } + return interval2; + } + const millisecond = timeInterval$1(() => { + }, (date2, step) => { + date2.setTime(+date2 + step); + }, (start, end) => { return end - start; -}); -// An optimized implementation for this simple case. -millisecond.every = (k)=>{ + }); + millisecond.every = (k) => { k = Math.floor(k); if (!isFinite(k) || !(k > 0)) return null; if (!(k > 1)) return millisecond; - return (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(Math.floor(date / k) * k); - }, (date, step)=>{ - date.setTime(+date + step * k); - }, (start, end)=>{ - return (end - start) / k; + return timeInterval$1((date2) => { + date2.setTime(Math.floor(date2 / k) * k); + }, (date2, step) => { + date2.setTime(+date2 + step * k); + }, (start, end) => { + return (end - start) / k; }); -}; -const milliseconds = millisecond.range; - -},{"./interval.js":"9JWhy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bm0xM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "second", ()=>second); -parcelHelpers.export(exports, "seconds", ()=>seconds); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const second = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds()); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationSecond)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationSecond); -}, (date)=>{ - return date.getUTCSeconds(); -}); -const seconds = second.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eRqDr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "durationSecond", ()=>durationSecond); -parcelHelpers.export(exports, "durationMinute", ()=>durationMinute); -parcelHelpers.export(exports, "durationHour", ()=>durationHour); -parcelHelpers.export(exports, "durationDay", ()=>durationDay); -parcelHelpers.export(exports, "durationWeek", ()=>durationWeek); -parcelHelpers.export(exports, "durationMonth", ()=>durationMonth); -parcelHelpers.export(exports, "durationYear", ()=>durationYear); -const durationSecond = 1000; -const durationMinute = durationSecond * 60; -const durationHour = durationMinute * 60; -const durationDay = durationHour * 24; -const durationWeek = durationDay * 7; -const durationMonth = durationDay * 30; -const durationYear = durationDay * 365; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ifdFS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMinute", ()=>timeMinute); -parcelHelpers.export(exports, "timeMinutes", ()=>timeMinutes); -parcelHelpers.export(exports, "utcMinute", ()=>utcMinute); -parcelHelpers.export(exports, "utcMinutes", ()=>utcMinutes); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getMinutes(); -}); -const timeMinutes = timeMinute.range; -const utcMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCSeconds(0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getUTCMinutes(); -}); -const utcMinutes = utcMinute.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"xWpVx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeHour", ()=>timeHour); -parcelHelpers.export(exports, "timeHours", ()=>timeHours); -parcelHelpers.export(exports, "utcHour", ()=>utcHour); -parcelHelpers.export(exports, "utcHours", ()=>utcHours); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond) - date.getMinutes() * (0, _durationJs.durationMinute)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getHours(); -}); -const timeHours = timeHour.range; -const utcHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMinutes(0, 0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getUTCHours(); -}); -const utcHours = utcHour.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aXPXh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeDay", ()=>timeDay); -parcelHelpers.export(exports, "timeDays", ()=>timeDays); -parcelHelpers.export(exports, "utcDay", ()=>utcDay); -parcelHelpers.export(exports, "utcDays", ()=>utcDays); -parcelHelpers.export(exports, "unixDay", ()=>unixDay); -parcelHelpers.export(exports, "unixDays", ()=>unixDays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeDay = (0, _intervalJs.timeInterval)((date)=>date.setHours(0, 0, 0, 0), (date, step)=>date.setDate(date.getDate() + step), (start, end)=>(end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationDay), (date)=>date.getDate() - 1); -const timeDays = timeDay.range; -const utcDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return date.getUTCDate() - 1; -}); -const utcDays = utcDay.range; -const unixDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return Math.floor(date / (0, _durationJs.durationDay)); -}); -const unixDays = unixDay.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1cvLV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeSunday", ()=>timeSunday); -parcelHelpers.export(exports, "timeMonday", ()=>timeMonday); -parcelHelpers.export(exports, "timeTuesday", ()=>timeTuesday); -parcelHelpers.export(exports, "timeWednesday", ()=>timeWednesday); -parcelHelpers.export(exports, "timeThursday", ()=>timeThursday); -parcelHelpers.export(exports, "timeFriday", ()=>timeFriday); -parcelHelpers.export(exports, "timeSaturday", ()=>timeSaturday); -parcelHelpers.export(exports, "timeSundays", ()=>timeSundays); -parcelHelpers.export(exports, "timeMondays", ()=>timeMondays); -parcelHelpers.export(exports, "timeTuesdays", ()=>timeTuesdays); -parcelHelpers.export(exports, "timeWednesdays", ()=>timeWednesdays); -parcelHelpers.export(exports, "timeThursdays", ()=>timeThursdays); -parcelHelpers.export(exports, "timeFridays", ()=>timeFridays); -parcelHelpers.export(exports, "timeSaturdays", ()=>timeSaturdays); -parcelHelpers.export(exports, "utcSunday", ()=>utcSunday); -parcelHelpers.export(exports, "utcMonday", ()=>utcMonday); -parcelHelpers.export(exports, "utcTuesday", ()=>utcTuesday); -parcelHelpers.export(exports, "utcWednesday", ()=>utcWednesday); -parcelHelpers.export(exports, "utcThursday", ()=>utcThursday); -parcelHelpers.export(exports, "utcFriday", ()=>utcFriday); -parcelHelpers.export(exports, "utcSaturday", ()=>utcSaturday); -parcelHelpers.export(exports, "utcSundays", ()=>utcSundays); -parcelHelpers.export(exports, "utcMondays", ()=>utcMondays); -parcelHelpers.export(exports, "utcTuesdays", ()=>utcTuesdays); -parcelHelpers.export(exports, "utcWednesdays", ()=>utcWednesdays); -parcelHelpers.export(exports, "utcThursdays", ()=>utcThursdays); -parcelHelpers.export(exports, "utcFridays", ()=>utcFridays); -parcelHelpers.export(exports, "utcSaturdays", ()=>utcSaturdays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -function timeWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setDate(date.getDate() + step * 7); - }, (start, end)=>{ - return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationWeek); + }; + millisecond.range; + const durationSecond$1 = 1e3; + const durationMinute$1 = durationSecond$1 * 60; + const durationHour$1 = durationMinute$1 * 60; + const durationDay$1 = durationHour$1 * 24; + const durationWeek$1 = durationDay$1 * 7; + const durationMonth$1 = durationDay$1 * 30; + const durationYear$1 = durationDay$1 * 365; + const second = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds()); + }, (date2, step) => { + date2.setTime(+date2 + step * durationSecond$1); + }, (start, end) => { + return (end - start) / durationSecond$1; + }, (date2) => { + return date2.getUTCSeconds(); + }); + second.range; + const timeMinute = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getMinutes(); + }); + timeMinute.range; + const utcMinute = timeInterval$1((date2) => { + date2.setUTCSeconds(0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getUTCMinutes(); + }); + utcMinute.range; + const timeHour = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1 - date2.getMinutes() * durationMinute$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getHours(); + }); + timeHour.range; + const utcHour = timeInterval$1((date2) => { + date2.setUTCMinutes(0, 0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getUTCHours(); + }); + utcHour.range; + const timeDay = timeInterval$1( + (date2) => date2.setHours(0, 0, 0, 0), + (date2, step) => date2.setDate(date2.getDate() + step), + (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, + (date2) => date2.getDate() - 1 + ); + timeDay.range; + const utcDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return date2.getUTCDate() - 1; + }); + utcDay.range; + const unixDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return Math.floor(date2 / durationDay$1); + }); + unixDay.range; + function timeWeekday(i) { + return timeInterval$1((date2) => { + date2.setDate(date2.getDate() - (date2.getDay() + 7 - i) % 7); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setDate(date2.getDate() + step * 7); + }, (start, end) => { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1; }); -} -const timeSunday = timeWeekday(0); -const timeMonday = timeWeekday(1); -const timeTuesday = timeWeekday(2); -const timeWednesday = timeWeekday(3); -const timeThursday = timeWeekday(4); -const timeFriday = timeWeekday(5); -const timeSaturday = timeWeekday(6); -const timeSundays = timeSunday.range; -const timeMondays = timeMonday.range; -const timeTuesdays = timeTuesday.range; -const timeWednesdays = timeWednesday.range; -const timeThursdays = timeThursday.range; -const timeFridays = timeFriday.range; -const timeSaturdays = timeSaturday.range; -function utcWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step * 7); - }, (start, end)=>{ - return (end - start) / (0, _durationJs.durationWeek); + } + const timeSunday = timeWeekday(0); + const timeMonday = timeWeekday(1); + const timeTuesday = timeWeekday(2); + const timeWednesday = timeWeekday(3); + const timeThursday = timeWeekday(4); + const timeFriday = timeWeekday(5); + const timeSaturday = timeWeekday(6); + timeSunday.range; + timeMonday.range; + timeTuesday.range; + timeWednesday.range; + timeThursday.range; + timeFriday.range; + timeSaturday.range; + function utcWeekday(i) { + return timeInterval$1((date2) => { + date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i) % 7); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step * 7); + }, (start, end) => { + return (end - start) / durationWeek$1; }); -} -const utcSunday = utcWeekday(0); -const utcMonday = utcWeekday(1); -const utcTuesday = utcWeekday(2); -const utcWednesday = utcWeekday(3); -const utcThursday = utcWeekday(4); -const utcFriday = utcWeekday(5); -const utcSaturday = utcWeekday(6); -const utcSundays = utcSunday.range; -const utcMondays = utcMonday.range; -const utcTuesdays = utcTuesday.range; -const utcWednesdays = utcWednesday.range; -const utcThursdays = utcThursday.range; -const utcFridays = utcFriday.range; -const utcSaturdays = utcSaturday.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"764Za":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMonth", ()=>timeMonth); -parcelHelpers.export(exports, "timeMonths", ()=>timeMonths); -parcelHelpers.export(exports, "utcMonth", ()=>utcMonth); -parcelHelpers.export(exports, "utcMonths", ()=>utcMonths); -var _intervalJs = require("./interval.js"); -const timeMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setMonth(date.getMonth() + step); -}, (start, end)=>{ + } + const utcSunday = utcWeekday(0); + const utcMonday = utcWeekday(1); + const utcTuesday = utcWeekday(2); + const utcWednesday = utcWeekday(3); + const utcThursday = utcWeekday(4); + const utcFriday = utcWeekday(5); + const utcSaturday = utcWeekday(6); + utcSunday.range; + utcMonday.range; + utcTuesday.range; + utcWednesday.range; + utcThursday.range; + utcFriday.range; + utcSaturday.range; + const timeMonth = timeInterval$1((date2) => { + date2.setDate(1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setMonth(date2.getMonth() + step); + }, (start, end) => { return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; -}, (date)=>{ - return date.getMonth(); -}); -const timeMonths = timeMonth.range; -const utcMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCMonth(date.getUTCMonth() + step); -}, (start, end)=>{ + }, (date2) => { + return date2.getMonth(); + }); + timeMonth.range; + const utcMonth = timeInterval$1((date2) => { + date2.setUTCDate(1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCMonth(date2.getUTCMonth() + step); + }, (start, end) => { return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; -}, (date)=>{ - return date.getUTCMonth(); -}); -const utcMonths = utcMonth.range; - -},{"./interval.js":"9JWhy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4SlFD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeYear", ()=>timeYear); -parcelHelpers.export(exports, "timeYears", ()=>timeYears); -parcelHelpers.export(exports, "utcYear", ()=>utcYear); -parcelHelpers.export(exports, "utcYears", ()=>utcYears); -var _intervalJs = require("./interval.js"); -const timeYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setFullYear(date.getFullYear() + step); -}, (start, end)=>{ + }, (date2) => { + return date2.getUTCMonth(); + }); + utcMonth.range; + const timeYear = timeInterval$1((date2) => { + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step); + }, (start, end) => { return end.getFullYear() - start.getFullYear(); -}, (date)=>{ - return date.getFullYear(); -}); -// An optimized implementation for this simple case. -timeYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setFullYear(Math.floor(date.getFullYear() / k) * k); - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setFullYear(date.getFullYear() + step * k); + }, (date2) => { + return date2.getFullYear(); + }); + timeYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setFullYear(Math.floor(date2.getFullYear() / k) * k); + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step * k); }); -}; -const timeYears = timeYear.range; -const utcYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step); -}, (start, end)=>{ + }; + timeYear.range; + const utcYear = timeInterval$1((date2) => { + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step); + }, (start, end) => { return end.getUTCFullYear() - start.getUTCFullYear(); -}, (date)=>{ - return date.getUTCFullYear(); -}); -// An optimized implementation for this simple case. -utcYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step * k); + }, (date2) => { + return date2.getUTCFullYear(); + }); + utcYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k) * k); + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step * k); }); -}; -const utcYears = utcYear.range; - -},{"./interval.js":"9JWhy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9x0uu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "utcTicks", ()=>utcTicks); -parcelHelpers.export(exports, "utcTickInterval", ()=>utcTickInterval); -parcelHelpers.export(exports, "timeTicks", ()=>timeTicks); -parcelHelpers.export(exports, "timeTickInterval", ()=>timeTickInterval); -var _d3Array = require("d3-array"); -var _durationJs = require("./duration.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -function ticker(year, month, week, day, hour, minute) { + }; + utcYear.range; + function ticker(year, month, week2, day, hour, minute) { const tickIntervals = [ - [ - (0, _secondJs.second), - 1, - (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 5, - 5 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 15, - 15 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 30, - 30 * (0, _durationJs.durationSecond) - ], - [ - minute, - 1, - (0, _durationJs.durationMinute) - ], - [ - minute, - 5, - 5 * (0, _durationJs.durationMinute) - ], - [ - minute, - 15, - 15 * (0, _durationJs.durationMinute) - ], - [ - minute, - 30, - 30 * (0, _durationJs.durationMinute) - ], - [ - hour, - 1, - (0, _durationJs.durationHour) - ], - [ - hour, - 3, - 3 * (0, _durationJs.durationHour) - ], - [ - hour, - 6, - 6 * (0, _durationJs.durationHour) - ], - [ - hour, - 12, - 12 * (0, _durationJs.durationHour) - ], - [ - day, - 1, - (0, _durationJs.durationDay) - ], - [ - day, - 2, - 2 * (0, _durationJs.durationDay) - ], - [ - week, - 1, - (0, _durationJs.durationWeek) - ], - [ - month, - 1, - (0, _durationJs.durationMonth) - ], - [ - month, - 3, - 3 * (0, _durationJs.durationMonth) - ], - [ - year, - 1, - (0, _durationJs.durationYear) - ] + [second, 1, durationSecond$1], + [second, 5, 5 * durationSecond$1], + [second, 15, 15 * durationSecond$1], + [second, 30, 30 * durationSecond$1], + [minute, 1, durationMinute$1], + [minute, 5, 5 * durationMinute$1], + [minute, 15, 15 * durationMinute$1], + [minute, 30, 30 * durationMinute$1], + [hour, 1, durationHour$1], + [hour, 3, 3 * durationHour$1], + [hour, 6, 6 * durationHour$1], + [hour, 12, 12 * durationHour$1], + [day, 1, durationDay$1], + [day, 2, 2 * durationDay$1], + [week2, 1, durationWeek$1], + [month, 1, durationMonth$1], + [month, 3, 3 * durationMonth$1], + [year, 1, durationYear$1] ]; - function ticks(start, stop, count) { - const reverse = stop < start; - if (reverse) [start, stop] = [ - stop, - start - ]; - const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count); - const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop - return reverse ? ticks.reverse() : ticks; - } - function tickInterval(start, stop, count) { - const target = Math.abs(stop - start) / count; - const i = (0, _d3Array.bisector)(([, , step])=>step).right(tickIntervals, target); - if (i === tickIntervals.length) return year.every((0, _d3Array.tickStep)(start / (0, _durationJs.durationYear), stop / (0, _durationJs.durationYear), count)); - if (i === 0) return (0, _millisecondJs.millisecond).every(Math.max((0, _d3Array.tickStep)(start, stop, count), 1)); - const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - return t.every(step); + function ticks2(start, stop2, count2) { + const reverse2 = stop2 < start; + if (reverse2) [start, stop2] = [stop2, start]; + const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval(start, stop2, count2); + const ticks3 = interval2 ? interval2.range(start, +stop2 + 1) : []; + return reverse2 ? ticks3.reverse() : ticks3; + } + function tickInterval(start, stop2, count2) { + const target2 = Math.abs(stop2 - start) / count2; + const i = bisector(([, , step2]) => step2).right(tickIntervals, target2); + if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop2 / durationYear$1, count2)); + if (i === 0) return millisecond.every(Math.max(tickStep(start, stop2, count2), 1)); + const [t, step] = tickIntervals[target2 / tickIntervals[i - 1][2] < tickIntervals[i][2] / target2 ? i - 1 : i]; + return t.every(step); + } + return [ticks2, tickInterval]; + } + const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute); + const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute); + function localDate$1(d2) { + if (0 <= d2.y && d2.y < 100) { + var date2 = new Date(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L); + date2.setFullYear(d2.y); + return date2; + } + return new Date(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L); + } + function utcDate$1(d2) { + if (0 <= d2.y && d2.y < 100) { + var date2 = new Date(Date.UTC(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L)); + date2.setUTCFullYear(d2.y); + return date2; } - return [ - ticks, - tickInterval - ]; -} -const [utcTicks, utcTickInterval] = ticker((0, _yearJs.utcYear), (0, _monthJs.utcMonth), (0, _weekJs.utcSunday), (0, _dayJs.unixDay), (0, _hourJs.utcHour), (0, _minuteJs.utcMinute)); -const [timeTicks, timeTickInterval] = ticker((0, _yearJs.timeYear), (0, _monthJs.timeMonth), (0, _weekJs.timeSunday), (0, _dayJs.timeDay), (0, _hourJs.timeHour), (0, _minuteJs.timeMinute)); - -},{"d3-array":"5lCYW","./duration.js":"eRqDr","./millisecond.js":"2UJoZ","./second.js":"bm0xM","./minute.js":"ifdFS","./hour.js":"xWpVx","./day.js":"aXPXh","./week.js":"1cvLV","./month.js":"764Za","./year.js":"4SlFD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eC6Bi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "timeFormat", ()=>(0, _defaultLocaleJs.timeFormat)); -parcelHelpers.export(exports, "timeParse", ()=>(0, _defaultLocaleJs.timeParse)); -parcelHelpers.export(exports, "utcFormat", ()=>(0, _defaultLocaleJs.utcFormat)); -parcelHelpers.export(exports, "utcParse", ()=>(0, _defaultLocaleJs.utcParse)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "isoFormat", ()=>(0, _isoFormatJsDefault.default)); -parcelHelpers.export(exports, "isoParse", ()=>(0, _isoParseJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _isoFormatJs = require("./isoFormat.js"); -var _isoFormatJsDefault = parcelHelpers.interopDefault(_isoFormatJs); -var _isoParseJs = require("./isoParse.js"); -var _isoParseJsDefault = parcelHelpers.interopDefault(_isoParseJs); - -},{"./defaultLocale.js":"dYsS4","./locale.js":"hOUzu","./isoFormat.js":false,"./isoParse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dYsS4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var timeFormat; -var timeParse; -var utcFormat; -var utcParse; -defaultLocale({ + return new Date(Date.UTC(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L)); + } + function newDate(y2, m2, d2) { + return { y: y2, m: m2, d: d2, H: 0, M: 0, S: 0, L: 0 }; + } + function formatLocale$1(locale2) { + var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths; + var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); + var formats2 = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "f": formatMicroseconds, + "g": formatYearISO, + "G": formatFullYearISO, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "q": formatQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatSeconds, + "u": formatWeekdayNumberMonday, + "U": formatWeekNumberSunday, + "V": formatWeekNumberISO, + "w": formatWeekdayNumberSunday, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear$1, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "f": formatUTCMicroseconds, + "g": formatUTCYearISO, + "G": formatUTCFullYearISO, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "q": formatUTCQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatUTCSeconds, + "u": formatUTCWeekdayNumberMonday, + "U": formatUTCWeekNumberSunday, + "V": formatUTCWeekNumberISO, + "w": formatUTCWeekdayNumberSunday, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "f": parseMicroseconds, + "g": parseYear, + "G": parseFullYear, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "q": parseQuarter, + "Q": parseUnixTimestamp, + "s": parseUnixTimestampSeconds, + "S": parseSeconds, + "u": parseWeekdayNumberMonday, + "U": parseWeekNumberSunday, + "V": parseWeekNumberISO, + "w": parseWeekdayNumberSunday, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + formats2.x = newFormat(locale_date, formats2); + formats2.X = newFormat(locale_time, formats2); + formats2.c = newFormat(locale_dateTime, formats2); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + function newFormat(specifier, formats3) { + return function(date2) { + var string2 = [], i = -1, j = 0, n = specifier.length, c2, pad2, format2; + if (!(date2 instanceof Date)) date2 = /* @__PURE__ */ new Date(+date2); + while (++i < n) { + if (specifier.charCodeAt(i) === 37) { + string2.push(specifier.slice(j, i)); + if ((pad2 = pads[c2 = specifier.charAt(++i)]) != null) c2 = specifier.charAt(++i); + else pad2 = c2 === "e" ? " " : "0"; + if (format2 = formats3[c2]) c2 = format2(date2, pad2); + string2.push(c2); + j = i + 1; + } + } + string2.push(specifier.slice(j, i)); + return string2.join(""); + }; + } + function newParse(specifier, Z3) { + return function(string2) { + var d2 = newDate(1900, void 0, 1), i = parseSpecifier(d2, specifier, string2 += "", 0), week2, day; + if (i != string2.length) return null; + if ("Q" in d2) return new Date(d2.Q); + if ("s" in d2) return new Date(d2.s * 1e3 + ("L" in d2 ? d2.L : 0)); + if (Z3 && !("Z" in d2)) d2.Z = 0; + if ("p" in d2) d2.H = d2.H % 12 + d2.p * 12; + if (d2.m === void 0) d2.m = "q" in d2 ? d2.q : 0; + if ("V" in d2) { + if (d2.V < 1 || d2.V > 53) return null; + if (!("w" in d2)) d2.w = 1; + if ("Z" in d2) { + week2 = utcDate$1(newDate(d2.y, 0, 1)), day = week2.getUTCDay(); + week2 = day > 4 || day === 0 ? utcMonday.ceil(week2) : utcMonday(week2); + week2 = utcDay.offset(week2, (d2.V - 1) * 7); + d2.y = week2.getUTCFullYear(); + d2.m = week2.getUTCMonth(); + d2.d = week2.getUTCDate() + (d2.w + 6) % 7; + } else { + week2 = localDate$1(newDate(d2.y, 0, 1)), day = week2.getDay(); + week2 = day > 4 || day === 0 ? timeMonday.ceil(week2) : timeMonday(week2); + week2 = timeDay.offset(week2, (d2.V - 1) * 7); + d2.y = week2.getFullYear(); + d2.m = week2.getMonth(); + d2.d = week2.getDate() + (d2.w + 6) % 7; + } + } else if ("W" in d2 || "U" in d2) { + if (!("w" in d2)) d2.w = "u" in d2 ? d2.u % 7 : "W" in d2 ? 1 : 0; + day = "Z" in d2 ? utcDate$1(newDate(d2.y, 0, 1)).getUTCDay() : localDate$1(newDate(d2.y, 0, 1)).getDay(); + d2.m = 0; + d2.d = "W" in d2 ? (d2.w + 6) % 7 + d2.W * 7 - (day + 5) % 7 : d2.w + d2.U * 7 - (day + 6) % 7; + } + if ("Z" in d2) { + d2.H += d2.Z / 100 | 0; + d2.M += d2.Z % 100; + return utcDate$1(d2); + } + return localDate$1(d2); + }; + } + function parseSpecifier(d2, specifier, string2, j) { + var i = 0, n = specifier.length, m2 = string2.length, c2, parse2; + while (i < n) { + if (j >= m2) return -1; + c2 = specifier.charCodeAt(i++); + if (c2 === 37) { + c2 = specifier.charAt(i++); + parse2 = parses[c2 in pads ? specifier.charAt(i++) : c2]; + if (!parse2 || (j = parse2(d2, string2, j)) < 0) return -1; + } else if (c2 != string2.charCodeAt(j++)) { + return -1; + } + } + return j; + } + function parsePeriod(d2, string2, i) { + var n = periodRe.exec(string2.slice(i)); + return n ? (d2.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseShortWeekday(d2, string2, i) { + var n = shortWeekdayRe.exec(string2.slice(i)); + return n ? (d2.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseWeekday(d2, string2, i) { + var n = weekdayRe.exec(string2.slice(i)); + return n ? (d2.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseShortMonth(d2, string2, i) { + var n = shortMonthRe.exec(string2.slice(i)); + return n ? (d2.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseMonth(d2, string2, i) { + var n = monthRe.exec(string2.slice(i)); + return n ? (d2.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseLocaleDateTime(d2, string2, i) { + return parseSpecifier(d2, locale_dateTime, string2, i); + } + function parseLocaleDate(d2, string2, i) { + return parseSpecifier(d2, locale_date, string2, i); + } + function parseLocaleTime(d2, string2, i) { + return parseSpecifier(d2, locale_time, string2, i); + } + function formatShortWeekday(d2) { + return locale_shortWeekdays[d2.getDay()]; + } + function formatWeekday(d2) { + return locale_weekdays[d2.getDay()]; + } + function formatShortMonth(d2) { + return locale_shortMonths[d2.getMonth()]; + } + function formatMonth(d2) { + return locale_months[d2.getMonth()]; + } + function formatPeriod(d2) { + return locale_periods[+(d2.getHours() >= 12)]; + } + function formatQuarter(d2) { + return 1 + ~~(d2.getMonth() / 3); + } + function formatUTCShortWeekday(d2) { + return locale_shortWeekdays[d2.getUTCDay()]; + } + function formatUTCWeekday(d2) { + return locale_weekdays[d2.getUTCDay()]; + } + function formatUTCShortMonth(d2) { + return locale_shortMonths[d2.getUTCMonth()]; + } + function formatUTCMonth(d2) { + return locale_months[d2.getUTCMonth()]; + } + function formatUTCPeriod(d2) { + return locale_periods[+(d2.getUTCHours() >= 12)]; + } + function formatUTCQuarter(d2) { + return 1 + ~~(d2.getUTCMonth() / 3); + } + return { + format: function(specifier) { + var f = newFormat(specifier += "", formats2); + f.toString = function() { + return specifier; + }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", false); + p.toString = function() { + return specifier; + }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { + return specifier; + }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier += "", true); + p.toString = function() { + return specifier; + }; + return p; + } + }; + } + var pads = { "-": "", "_": " ", "0": "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; + function pad$2(value2, fill2, width2) { + var sign2 = value2 < 0 ? "-" : "", string2 = (sign2 ? -value2 : value2) + "", length2 = string2.length; + return sign2 + (length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) + string2 : string2); + } + function requote(s2) { + return s2.replace(requoteRe, "\\$&"); + } + function formatRe(names) { + return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); + } + function formatLookup(names) { + return new Map(names.map((name, i) => [name.toLowerCase(), i])); + } + function parseWeekdayNumberSunday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); + return n ? (d2.w = +n[0], i + n[0].length) : -1; + } + function parseWeekdayNumberMonday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); + return n ? (d2.u = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberSunday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.U = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberISO(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.V = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberMonday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.W = +n[0], i + n[0].length) : -1; + } + function parseFullYear(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 4)); + return n ? (d2.y = +n[0], i + n[0].length) : -1; + } + function parseYear(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; + } + function parseZone(d2, string2, i) { + var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string2.slice(i, i + 6)); + return n ? (d2.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; + } + function parseQuarter(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); + return n ? (d2.q = n[0] * 3 - 3, i + n[0].length) : -1; + } + function parseMonthNumber(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.m = n[0] - 1, i + n[0].length) : -1; + } + function parseDayOfMonth(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.d = +n[0], i + n[0].length) : -1; + } + function parseDayOfYear(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); + return n ? (d2.m = 0, d2.d = +n[0], i + n[0].length) : -1; + } + function parseHour24(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.H = +n[0], i + n[0].length) : -1; + } + function parseMinutes(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.M = +n[0], i + n[0].length) : -1; + } + function parseSeconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.S = +n[0], i + n[0].length) : -1; + } + function parseMilliseconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); + return n ? (d2.L = +n[0], i + n[0].length) : -1; + } + function parseMicroseconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 6)); + return n ? (d2.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; + } + function parseLiteralPercent(d2, string2, i) { + var n = percentRe.exec(string2.slice(i, i + 1)); + return n ? i + n[0].length : -1; + } + function parseUnixTimestamp(d2, string2, i) { + var n = numberRe.exec(string2.slice(i)); + return n ? (d2.Q = +n[0], i + n[0].length) : -1; + } + function parseUnixTimestampSeconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i)); + return n ? (d2.s = +n[0], i + n[0].length) : -1; + } + function formatDayOfMonth(d2, p) { + return pad$2(d2.getDate(), p, 2); + } + function formatHour24(d2, p) { + return pad$2(d2.getHours(), p, 2); + } + function formatHour12(d2, p) { + return pad$2(d2.getHours() % 12 || 12, p, 2); + } + function formatDayOfYear(d2, p) { + return pad$2(1 + timeDay.count(timeYear(d2), d2), p, 3); + } + function formatMilliseconds(d2, p) { + return pad$2(d2.getMilliseconds(), p, 3); + } + function formatMicroseconds(d2, p) { + return formatMilliseconds(d2, p) + "000"; + } + function formatMonthNumber(d2, p) { + return pad$2(d2.getMonth() + 1, p, 2); + } + function formatMinutes(d2, p) { + return pad$2(d2.getMinutes(), p, 2); + } + function formatSeconds(d2, p) { + return pad$2(d2.getSeconds(), p, 2); + } + function formatWeekdayNumberMonday(d2) { + var day = d2.getDay(); + return day === 0 ? 7 : day; + } + function formatWeekNumberSunday(d2, p) { + return pad$2(timeSunday.count(timeYear(d2) - 1, d2), p, 2); + } + function dISO(d2) { + var day = d2.getDay(); + return day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2); + } + function formatWeekNumberISO(d2, p) { + d2 = dISO(d2); + return pad$2(timeThursday.count(timeYear(d2), d2) + (timeYear(d2).getDay() === 4), p, 2); + } + function formatWeekdayNumberSunday(d2) { + return d2.getDay(); + } + function formatWeekNumberMonday(d2, p) { + return pad$2(timeMonday.count(timeYear(d2) - 1, d2), p, 2); + } + function formatYear$1(d2, p) { + return pad$2(d2.getFullYear() % 100, p, 2); + } + function formatYearISO(d2, p) { + d2 = dISO(d2); + return pad$2(d2.getFullYear() % 100, p, 2); + } + function formatFullYear(d2, p) { + return pad$2(d2.getFullYear() % 1e4, p, 4); + } + function formatFullYearISO(d2, p) { + var day = d2.getDay(); + d2 = day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2); + return pad$2(d2.getFullYear() % 1e4, p, 4); + } + function formatZone(d2) { + var z2 = d2.getTimezoneOffset(); + return (z2 > 0 ? "-" : (z2 *= -1, "+")) + pad$2(z2 / 60 | 0, "0", 2) + pad$2(z2 % 60, "0", 2); + } + function formatUTCDayOfMonth(d2, p) { + return pad$2(d2.getUTCDate(), p, 2); + } + function formatUTCHour24(d2, p) { + return pad$2(d2.getUTCHours(), p, 2); + } + function formatUTCHour12(d2, p) { + return pad$2(d2.getUTCHours() % 12 || 12, p, 2); + } + function formatUTCDayOfYear(d2, p) { + return pad$2(1 + utcDay.count(utcYear(d2), d2), p, 3); + } + function formatUTCMilliseconds(d2, p) { + return pad$2(d2.getUTCMilliseconds(), p, 3); + } + function formatUTCMicroseconds(d2, p) { + return formatUTCMilliseconds(d2, p) + "000"; + } + function formatUTCMonthNumber(d2, p) { + return pad$2(d2.getUTCMonth() + 1, p, 2); + } + function formatUTCMinutes(d2, p) { + return pad$2(d2.getUTCMinutes(), p, 2); + } + function formatUTCSeconds(d2, p) { + return pad$2(d2.getUTCSeconds(), p, 2); + } + function formatUTCWeekdayNumberMonday(d2) { + var dow = d2.getUTCDay(); + return dow === 0 ? 7 : dow; + } + function formatUTCWeekNumberSunday(d2, p) { + return pad$2(utcSunday.count(utcYear(d2) - 1, d2), p, 2); + } + function UTCdISO(d2) { + var day = d2.getUTCDay(); + return day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2); + } + function formatUTCWeekNumberISO(d2, p) { + d2 = UTCdISO(d2); + return pad$2(utcThursday.count(utcYear(d2), d2) + (utcYear(d2).getUTCDay() === 4), p, 2); + } + function formatUTCWeekdayNumberSunday(d2) { + return d2.getUTCDay(); + } + function formatUTCWeekNumberMonday(d2, p) { + return pad$2(utcMonday.count(utcYear(d2) - 1, d2), p, 2); + } + function formatUTCYear(d2, p) { + return pad$2(d2.getUTCFullYear() % 100, p, 2); + } + function formatUTCYearISO(d2, p) { + d2 = UTCdISO(d2); + return pad$2(d2.getUTCFullYear() % 100, p, 2); + } + function formatUTCFullYear(d2, p) { + return pad$2(d2.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCFullYearISO(d2, p) { + var day = d2.getUTCDay(); + d2 = day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2); + return pad$2(d2.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCZone() { + return "+0000"; + } + function formatLiteralPercent() { + return "%"; + } + function formatUnixTimestamp(d2) { + return +d2; + } + function formatUnixTimestampSeconds(d2) { + return Math.floor(+d2 / 1e3); + } + var locale$2; + var timeFormat$1; + var timeParse$1; + var utcFormat$1; + var utcParse$1; + defaultLocale$2({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", - periods: [ - "AM", - "PM" - ], - days: [ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday" - ], - shortDays: [ - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat" - ], - months: [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" - ], - shortMonths: [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - timeFormat = locale.format; - timeParse = locale.parse; - utcFormat = locale.utcFormat; - utcParse = locale.utcParse; - return locale; -} - -},{"./locale.js":"hOUzu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hOUzu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatLocale); -var _d3Time = require("d3-time"); -function localDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); - date.setFullYear(d.y); - return date; - } - return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); -} -function utcDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); -} -function newDate(y, m, d) { - return { - y: y, - m: m, - d: d, - H: 0, - M: 0, - S: 0, - L: 0 - }; -} -function formatLocale(locale) { - var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; - var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); - var formats = { - "a": formatShortWeekday, - "A": formatWeekday, - "b": formatShortMonth, - "B": formatMonth, - "c": null, - "d": formatDayOfMonth, - "e": formatDayOfMonth, - "f": formatMicroseconds, - "g": formatYearISO, - "G": formatFullYearISO, - "H": formatHour24, - "I": formatHour12, - "j": formatDayOfYear, - "L": formatMilliseconds, - "m": formatMonthNumber, - "M": formatMinutes, - "p": formatPeriod, - "q": formatQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatSeconds, - "u": formatWeekdayNumberMonday, - "U": formatWeekNumberSunday, - "V": formatWeekNumberISO, - "w": formatWeekdayNumberSunday, - "W": formatWeekNumberMonday, - "x": null, - "X": null, - "y": formatYear, - "Y": formatFullYear, - "Z": formatZone, - "%": formatLiteralPercent + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + }); + function defaultLocale$2(definition2) { + locale$2 = formatLocale$1(definition2); + timeFormat$1 = locale$2.format; + timeParse$1 = locale$2.parse; + utcFormat$1 = locale$2.utcFormat; + utcParse$1 = locale$2.utcParse; + return locale$2; + } + function date(t) { + return new Date(t); + } + function number$4(t) { + return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t); + } + function calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2) { + var scale2 = continuous$1(), invert2 = scale2.invert, domain2 = scale2.domain; + var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear2 = format2("%Y"); + function tickFormat2(date2) { + return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week2(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2); + } + scale2.invert = function(y2) { + return new Date(invert2(y2)); + }; + scale2.domain = function(_) { + return arguments.length ? domain2(Array.from(_, number$4)) : domain2().map(date); + }; + scale2.ticks = function(interval2) { + var d2 = domain2(); + return ticks2(d2[0], d2[d2.length - 1], interval2 == null ? 10 : interval2); + }; + scale2.tickFormat = function(count2, specifier) { + return specifier == null ? tickFormat2 : format2(specifier); + }; + scale2.nice = function(interval2) { + var d2 = domain2(); + if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval(d2[0], d2[d2.length - 1], interval2 == null ? 10 : interval2); + return interval2 ? domain2(nice(d2, interval2)) : scale2; + }; + scale2.copy = function() { + return copy$2(scale2, calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2)); + }; + return scale2; + } + function time$1() { + return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat$1).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); + } + function utcTime() { + return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat$1).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); + } + function transformer$2() { + var x02 = 0, x12 = 1, t02, t12, k10, transform2, interpolator = identity$6, clamp2 = false, unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : interpolator(k10 === 0 ? 0.5 : (x2 = (transform2(x2) - t02) * k10, clamp2 ? Math.max(0, Math.min(1, x2)) : x2)); + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02), scale2) : [x02, x12]; + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1; + return arguments.length ? ([r0, r1] = _, interpolator = interpolate2(r0, r1), scale2) : [interpolator(0), interpolator(1)]; + }; + } + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + return function(t) { + transform2 = t, t02 = t(x02), t12 = t(x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02); + return scale2; + }; + } + function copy$1(source2, target2) { + return target2.domain(source2.domain()).interpolator(source2.interpolator()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function sequential() { + var scale2 = linearish(transformer$2()(identity$6)); + scale2.copy = function() { + return copy$1(scale2, sequential()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialLog() { + var scale2 = loggish(transformer$2()).domain([1, 10]); + scale2.copy = function() { + return copy$1(scale2, sequentialLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSymlog() { + var scale2 = symlogish(transformer$2()); + scale2.copy = function() { + return copy$1(scale2, sequentialSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialPow() { + var scale2 = powish(transformer$2()); + scale2.copy = function() { + return copy$1(scale2, sequentialPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSqrt() { + return sequentialPow.apply(null, arguments).exponent(0.5); + } + function transformer$1() { + var x02 = 0, x12 = 0.5, x2 = 1, s2 = 1, t02, t12, t22, k10, k21, interpolator = identity$6, transform2, clamp2 = false, unknown; + function scale2(x3) { + return isNaN(x3 = +x3) ? unknown : (x3 = 0.5 + ((x3 = +transform2(x3)) - t12) * (s2 * x3 < s2 * t12 ? k10 : k21), interpolator(clamp2 ? Math.max(0, Math.min(1, x3)) : x3)); + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12, x2] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), t22 = transform2(x2 = +x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1, scale2) : [x02, x12, x2]; + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1, r2; + return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate2, [r0, r1, r2]), scale2) : [interpolator(0), interpolator(0.5), interpolator(1)]; + }; + } + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; - var utcFormats = { - "a": formatUTCShortWeekday, - "A": formatUTCWeekday, - "b": formatUTCShortMonth, - "B": formatUTCMonth, - "c": null, - "d": formatUTCDayOfMonth, - "e": formatUTCDayOfMonth, - "f": formatUTCMicroseconds, - "g": formatUTCYearISO, - "G": formatUTCFullYearISO, - "H": formatUTCHour24, - "I": formatUTCHour12, - "j": formatUTCDayOfYear, - "L": formatUTCMilliseconds, - "m": formatUTCMonthNumber, - "M": formatUTCMinutes, - "p": formatUTCPeriod, - "q": formatUTCQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatUTCSeconds, - "u": formatUTCWeekdayNumberMonday, - "U": formatUTCWeekNumberSunday, - "V": formatUTCWeekNumberISO, - "w": formatUTCWeekdayNumberSunday, - "W": formatUTCWeekNumberMonday, - "x": null, - "X": null, - "y": formatUTCYear, - "Y": formatUTCFullYear, - "Z": formatUTCZone, - "%": formatLiteralPercent + return function(t) { + transform2 = t, t02 = t(x02), t12 = t(x12), t22 = t(x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1; + return scale2; }; - var parses = { - "a": parseShortWeekday, - "A": parseWeekday, - "b": parseShortMonth, - "B": parseMonth, - "c": parseLocaleDateTime, - "d": parseDayOfMonth, - "e": parseDayOfMonth, - "f": parseMicroseconds, - "g": parseYear, - "G": parseFullYear, - "H": parseHour24, - "I": parseHour24, - "j": parseDayOfYear, - "L": parseMilliseconds, - "m": parseMonthNumber, - "M": parseMinutes, - "p": parsePeriod, - "q": parseQuarter, - "Q": parseUnixTimestamp, - "s": parseUnixTimestampSeconds, - "S": parseSeconds, - "u": parseWeekdayNumberMonday, - "U": parseWeekNumberSunday, - "V": parseWeekNumberISO, - "w": parseWeekdayNumberSunday, - "W": parseWeekNumberMonday, - "x": parseLocaleDate, - "X": parseLocaleTime, - "y": parseYear, - "Y": parseFullYear, - "Z": parseZone, - "%": parseLiteralPercent - }; - // These recursive directive definitions must be deferred. - formats.x = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - function newFormat(specifier, formats) { - return function(date) { - var string = [], i = -1, j = 0, n = specifier.length, c, pad, format; - if (!(date instanceof Date)) date = new Date(+date); - while(++i < n)if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); - else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - string.push(specifier.slice(j, i)); - return string.join(""); - }; + } + function diverging$1() { + var scale2 = linearish(transformer$1()(identity$6)); + scale2.copy = function() { + return copy$1(scale2, diverging$1()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingLog() { + var scale2 = loggish(transformer$1()).domain([0.1, 1, 10]); + scale2.copy = function() { + return copy$1(scale2, divergingLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSymlog() { + var scale2 = symlogish(transformer$1()); + scale2.copy = function() { + return copy$1(scale2, divergingSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingPow() { + var scale2 = powish(transformer$1()); + scale2.copy = function() { + return copy$1(scale2, divergingPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSqrt() { + return divergingPow.apply(null, arguments).exponent(0.5); + } + function assignTransitionStagger(transition, currentData, selection, presenter) { + const { layerStagger } = presenter.morphchartsref; + const { morphChartsRenderResult } = presenter; + const cubelayer = morphChartsRenderResult.getCubeLayer(); + const range2 = transition.reverse ? [1, 0] : [0, 1]; + if (!transition || transition.type === "ordinal" && !transition.reverse) { + delete layerStagger.cubes; + } else { + const staggerOrders = new Float64Array(cubelayer.positionsX.length); + switch (transition.type) { + case "ordinal": { + const scale2 = linear$1(range2).domain([0, currentData.length]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(i); + }); + break; + } + case "column": { + if (transition.column.quantitative) { + const values2 = new Float64Array(currentData.length); + currentData.forEach((datum2, i) => { + values2[i] = datum2[transition.column.name]; + }); + const stats = getStats(currentData, transition.column); + const scale2 = linear$1(range2).domain([stats.min, stats.max]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(values2[i]); + }); + } else { + const strings2 = new Array(currentData.length); + currentData.forEach((datum2, i) => { + strings2[i] = datum2[transition.column.name]; + }); + getStats(currentData, transition.column, (distictValues) => { + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + const index2 = distictValues.indexOf(strings2[i]); + const staggerOrder = index2 / distictValues.length; + staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; + }); + }); + } + break; + } + case "position": { + const dimensions = { + x: cubelayer.positionsX, + y: cubelayer.positionsY, + z: cubelayer.positionsZ + }; + const positions2 = dimensions[transition.dimension]; + const values2 = new Float64Array(currentData.length); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + values2[i] = positions2[glOrdinal]; + }); + const stats = getStats(values2, null, "number", true); + const scale2 = linear$1(range2).domain([stats.min, stats.max]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(values2[i]); + }); + break; + } + } + layerStagger.cubes = { staggerOrders, maxStaggerOrder: 1, minStaggerOrder: 0 }; } - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, undefined, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day; - if (i != string.length) return null; - // If a UNIX timestamp is specified, return it. - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); - // If this is utcParse, never use the local timezone. - if (Z && !("Z" in d)) d.Z = 0; - // The am-pm flag is 0 for AM, and 1 for PM. - if ("p" in d) d.H = d.H % 12 + d.p * 12; - // If the month was not specified, inherit from the quarter. - if (d.m === undefined) d.m = "q" in d ? d.q : 0; - // Convert day-of-week and week-of-year to day-of-year. - if ("V" in d) { - if (d.V < 1 || d.V > 53) return null; - if (!("w" in d)) d.w = 1; - if ("Z" in d) { - week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); - week = day > 4 || day === 0 ? (0, _d3Time.utcMonday).ceil(week) : (0, _d3Time.utcMonday)(week); - week = (0, _d3Time.utcDay).offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); - week = day > 4 || day === 0 ? (0, _d3Time.timeMonday).ceil(week) : (0, _d3Time.timeMonday)(week); - week = (0, _d3Time.timeDay).offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; - } - // If a time zone is specified, all fields are interpreted as UTC and then - // offset according to the specified time zone. - if ("Z" in d) { - d.H += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate(d); - } - // Otherwise, all fields are in local time. - return localDate(d); - }; + cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); + } + var __awaiter = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - function parseSpecifier(d, specifier, string, j) { - var i = 0, n = specifier.length, m = string.length, c, parse; - while(i < n){ - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || (j = parse(d, string, j)) < 0) return -1; - } else if (c != string.charCodeAt(j++)) return -1; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - return j; + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + const { defaultView } = defaults$1; + const zAxisZindex = 1010; + let didRegisterColorSchemes = false; + let Viewer$1 = class Viewer { + /** + * Instantiate a new Viewer. + * @param element Parent HTMLElement to present within. + * @param options Optional viewer options object. + */ + constructor(element2, options2) { + this.element = element2; + this.options = deepMerge(defaultViewerOptions$1, options2); + this.presenter = new Presenter(element2, getPresenterStyle(this.options)); + this._characterSet = new CharacterSet(); + this._dataScope = new DataScope$2(); + this._animator = new Animator(this._dataScope, { + onDataChanged: this.onDataChanged.bind(this), + onAnimateDataChange: this.onAnimateDataChange.bind(this) + }); + this._details = new Details(this.presenter.getElement(PresenterElement$1.panel), this.options.language, this._animator, this._dataScope, (remap) => { + this.currentColorContext = ~~remap; + this.renderSameLayout(); + }, () => this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); + this.insight = {}; } - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + changeColorContexts(colorContexts) { + this.colorContexts = colorContexts; + this.currentColorContext = 0; + this.options.onColorContextChange && this.options.onColorContextChange(); } - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + applyLegendColorContext(colorContext) { + const a2 = getActiveElementInfo(); + mount(colorContext.legendElement, this.presenter.getElement(PresenterElement$1.legend)); + setActiveElement(a2); + this.presenter.stage.legend = colorContext.legend; + } + onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time2) { + var _a2; + if (time2 === void 0) { + const transitionDurations = ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transitionDurations) || defaultPresenterConfig.transitionDurations; + time2 = transitionDurations.position + transitionDurations.stagger; + } + return new Promise((resolve2, reject) => { + let innerPromise; + if (dataChange === DataLayoutChange.refine) { + const oldColorContext = this.colorContexts[this.currentColorContext]; + innerPromise = new Promise((innerResolve) => { + this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + cubeLayer.unitColorMap = oldColorContext.colorMap; + if (this.options.onStage) { + this.options.onStage(stage); + } + } })).then(() => { + this.applyLegendColorContext(oldColorContext); + innerResolve(); + }); + }); + } else { + innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, colorMapper) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + if (this.options.onStage) { + this.options.onStage(stage); + } + } })); + } + innerPromise.then(() => { + this.presenter.animationQueue(resolve2, time2, { waitingLabel, handlerLabel, animationCanceled: reject }); + }); + }); } - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + onDataChanged(dataLayout, filter2) { + return __awaiter(this, void 0, void 0, function* () { + switch (dataLayout) { + case DataLayoutChange.same: { + const hasSelectedData = this._dataScope.hasSelectedData(); + const hasActive = !!this._dataScope.active; + if (hasSelectedData || hasActive) { + this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); + } else { + this.presenter.morphChartsRenderResult.update({ cubes: null }); + } + break; + } + case DataLayoutChange.refine: { + const oldColorContext = this.colorContexts[this.currentColorContext]; + let colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { + colorMap = cubeLayer.unitColorMap; + cubeLayer.unitColorMap = oldColorContext.colorMap; + this.preStage(stage, cubeLayer); + }, onPresent: () => { + const newColorContext = { + colorMap, + legend: clone(this.presenter.stage.legend), + legendElement: this.presenter.getElement(PresenterElement$1.legend).children[0] + }; + this.applyLegendColorContext(oldColorContext); + this.changeColorContexts([oldColorContext, newColorContext]); + this.onPresent(); + } })); + if (!compare$4(this.insight.filter, filter2)) { + this.insight.filter = narrow(this.insight.filter, filter2); + } + if (this.options.onDataFilter) { + this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); + } + break; + } + case DataLayoutChange.reset: { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null + }; + this.changeColorContexts([colorContext]); + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { onPresent: () => { + populateColorContext(colorContext, this.presenter); + this.onPresent(); + } })); + delete this.insight.filter; + if (this.options.onDataFilter) { + this.options.onDataFilter(null, null); + } + break; + } + } + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); + } + }); } - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + convertSearchToSet() { + if (this._dataScope.selection) { + const s2 = /* @__PURE__ */ new Set(); + let found = false; + this._dataScope.selection.included.forEach((o, i) => { + s2.add(o[GL_ORDINAL]); + found = true; + }); + if (!found) { + s2.add(-1); + } + return s2; + } } - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + convertSetToSearch(s2) { + const search = { + expressions: [] + }; + s2.forEach((value2) => { + search.expressions.push({ + name: GL_ORDINAL, + operator: "==", + value: value2, + clause: "||" + }); + }); + return search; } - function parseLocaleDateTime(d, string, i) { - return parseSpecifier(d, locale_dateTime, string, i); + getSpecColumnsWithFilteredStats() { + if (!this._dataScope.hasFilteredData()) { + return this._specColumns; + } + const roles = ["color", "facet", "group", "size", "sort", "sum", "x", "y", "z"]; + const specColumns = Object.assign({}, this._specColumns); + roles.forEach((r) => { + if (specColumns[r]) { + const column = Object.assign({}, specColumns[r]); + column.stats = this.getColumnStats(column); + specColumns[r] = column; + } + }); + return specColumns; } - function parseLocaleDate(d, string, i) { - return parseSpecifier(d, locale_date, string, i); + renderNewLayout(signalValues, presenterConfig, view) { + return __awaiter(this, void 0, void 0, function* () { + const currData = this._dataScope.currentData(); + const context2 = { + specColumns: this.getSpecColumnsWithFilteredStats(), + insight: this.insight, + specViewOptions: Object.assign(Object.assign({}, this.options), { zAxisOptions: { + showZAxis: true, + zIndex: zAxisZindex + }, collapseFacetAxes: true }) + }; + const specResult = build(context2, currData); + if (!specResult.errors) { + const uiValues = extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); + applySignalValues(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); + unbindSignalUI(specResult.vegaSpec); + this.vegaSpec = specResult.vegaSpec; + this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); + this.specCapabilities = specResult.specCapabilities; + const config = this.createConfig(presenterConfig); + this._lastPresenterConfig = config.presenterConfig; + if (view) { + config.getView = () => view; + } + if (!didRegisterColorSchemes) { + registerColorSchemes(base$3.vega); + didRegisterColorSchemes = true; + } + try { + if (this.vegaViewGl) { + this.vegaViewGl.finalize(); + } + const runtime2 = base$3.vega.parse(this.vegaSpec); + this.vegaViewGl = new ViewGl(runtime2, config).renderer("morphcharts").initialize(this.element); + yield this.vegaViewGl.runAsync(); + const handler = (n, v) => { + this._characterSet.resetCharacterSet(true); + }; + this.vegaSpec.signals.forEach((s2) => { + this.vegaViewGl.addSignalListener(s2.name, handler); + }); + this.configForSignalCapture(config.presenterConfig); + } catch (e) { + specResult.errors = [e.message]; + } + if (!specResult.errors) { + ensureHeaders(this.presenter, this.options.language.headers); + } + } + if (specResult.errors) { + if (this.options.onError) { + this.options.onError(specResult.errors); + } else if (this.presenter.logger) { + this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join("\n")}`); + } + } + return specResult; + }); } - function parseLocaleTime(d, string, i) { - return parseSpecifier(d, locale_time, string, i); + /** + * Render the same layout with new options. + * @param newViewerOptions New options object. + */ + renderSameLayout(newViewerOptions) { + const colorContext = this.colorContexts[this.currentColorContext]; + this.applyLegendColorContext(colorContext); + if (newViewerOptions) { + if (newViewerOptions.colors) { + const mcColors = this.getMorphChartsColors(); + this.presenter.configColors(mcColors); + this._lastPresenterConfig.morphChartsColors = mcColors; + } + this.options = deepMerge(this.options, newViewerOptions); + } + this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); } - function formatShortWeekday(d) { - return locale_shortWeekdays[d.getDay()]; + getView(view) { + if (view === void 0) { + if (this.presenter.view === null) { + return defaultView; + } else { + return this.presenter.view; + } + } else { + return view; + } } - function formatWeekday(d) { - return locale_weekdays[d.getDay()]; + transformData(values2, transform2) { + try { + const runtime2 = base$3.vega.parse({ + $schema: "https://vega.github.io/schema/vega/v4.json", + data: [{ + name: "source", + values: values2, + transform: transform2 + }] + }); + new ViewGl(runtime2).run(); + } catch (e) { + } + return values2; } - function formatShortMonth(d) { - return locale_shortMonths[d.getMonth()]; + /** + * Render data into a visualization. + * @param insightSetup InsightSetup object to create a visualization rendering. + * @param data Array of data objects. + * @param renderOptions Optional RenderOptions object. + */ + render(insightSetup_1, data_1) { + return __awaiter(this, arguments, void 0, function* (insightSetup, data2, renderOptions = {}) { + const { insight, setup: setup2 } = insightSetup; + let result; + if (!compare$4(insight.filter, this.insight.filter)) { + const transitionDurations = (setup2 === null || setup2 === void 0 ? void 0 : setup2.transitionDurations) || defaultPresenterConfig.transitionDurations; + const renderTime = transitionDurations.position + transitionDurations.stagger; + const allowAsyncRenderTime = renderTime + this.options.filterRenderingTimerPadding; + if (insight.filter) { + result = yield this._render(insightSetup, data2, renderOptions, true); + this.presenter.animationQueue(() => { + this.filter(insight.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); + }, allowAsyncRenderTime, { waitingLabel: "layout before refine", handlerLabel: "refine after layout" }); + } else { + this._dataScope.setFilteredData(null); + result = yield this._render(insightSetup, data2, renderOptions, true); + this.presenter.animationQueue(() => { + this.reset(); + }, allowAsyncRenderTime, { waitingLabel: "layout before reset", handlerLabel: "reset after layout" }); + } + } else { + result = yield this._render(insightSetup, data2, renderOptions, false); + } + return result; + }); } - function formatMonth(d) { - return locale_months[d.getMonth()]; + shouldViewstateTransition(newInsight, oldInsight) { + if (!oldInsight.columns) + return false; + if (oldInsight.chart !== newInsight.chart) + return true; + if (oldInsight.size.height !== newInsight.size.height) + return true; + if (oldInsight.size.width !== newInsight.size.width) + return true; + if (oldInsight.columns.facet !== newInsight.columns.facet) + return true; + return false; } - function formatPeriod(d) { - return locale_periods[+(d.getHours() >= 12)]; + configForSignalCapture(presenterConfig) { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null + }; + presenterConfig.preStage = (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) { + colorContext.colorMap = cubeLayer.unitColorMap; + } + this.preStage(stage, cubeLayer); + }; + presenterConfig.onPresent = () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + this._dataScope.deselect(); + } + this.onPresent(); + }; } - function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); + onPresent() { + var _a2; + if ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transition) { + assignTransitionStagger(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + } + this.options.onPresent && this.options.onPresent(); } - function formatUTCShortWeekday(d) { - return locale_shortWeekdays[d.getUTCDay()]; + _render(insightSetup, data2, renderOptions, forceNewCharacterSet) { + return __awaiter(this, void 0, void 0, function* () { + const { insight, setup: setup2 } = insightSetup; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (this._dataScope.setData(data2, renderOptions.columns)) { + this.transformData(data2, insight.transform); + } + this._specColumns = getSpecColumns(insight, this._dataScope.getColumns(renderOptions.columnTypes)); + const ordinalMap = assignOrdinals(this._specColumns, data2, renderOptions.ordinalMap); + this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight); + this.insight = clone(insight); + this.setup = setup2; + this._shouldSaveColorContext = () => !renderOptions.initialColorContext; + const colorContext = renderOptions.initialColorContext || { + colorMap: null, + legend: null, + legendElement: null + }; + const specResult = yield this.renderNewLayout(insight.signalValues, Object.assign(Object.assign({}, setup2 || {}), { preStage: (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) { + colorContext.colorMap = cubeLayer.unitColorMap; + } else { + cubeLayer.unitColorMap = colorContext.colorMap; + } + const hasSelectedData = !!this._dataScope.hasSelectedData(); + if (hasSelectedData || this._dataScope.active) ; + this.preStage(stage, cubeLayer); + }, onPresent: () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + } else { + this.applyLegendColorContext(colorContext); + } + this.onPresent(); + }, shouldViewstateTransition: () => this.shouldViewstateTransition(insight, this.insight) }), this.getView(insight.view)); + this._shouldSaveColorContext = () => !renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); + this._details.render(); + const result = { ordinalMap, specResult }; + return result; + }); } - function formatUTCWeekday(d) { - return locale_weekdays[d.getUTCDay()]; + overrideAxisLabels(stage) { } - function formatUTCShortMonth(d) { - return locale_shortMonths[d.getUTCMonth()]; + preLayer(stage) { + let axisRole; + for (axisRole in stage.axes) { + const capability = this.specCapabilities.roles.filter((r) => r.role === axisRole)[0]; + if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === "exact")) { + moveTicksBetween(stage.axes[axisRole]); + } + } } - function formatUTCMonth(d) { - return locale_months[d.getUTCMonth()]; + preStage(stage, cubeLayer) { + this.overrideAxisLabels(stage); + this._axisSelection = new AxisSelection(this.specCapabilities, this._specColumns, stage); + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + if (this.options.onStage) { + this.options.onStage(stage); + } } - function formatUTCPeriod(d) { - return locale_periods[+(d.getUTCHours() >= 12)]; + onCubeClick(e, cube) { + this.options.onCubeClick && this.options.onCubeClick(e, cube); + const hasSelectedData = this._dataScope.hasSelectedData(); + if (hasSelectedData && this._dataScope.selection.included.length > 1) { + const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); + if (indexWithinSelection.index >= 0) { + this.activate(indexWithinSelection.datum); + this._details.populate(this._dataScope.selection, indexWithinSelection.index); + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); + } + return; + } + } + if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][GL_ORDINAL] === cube.ordinal) { + this.deselect(); + return; + } + const search = { + name: GL_ORDINAL, + operator: "==", + value: cube.ordinal + }; + this.select(search); + } + onCubeHover(event2, cube) { + var _a2, _b2; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (!cube) { + return; + } + const currentData = this._dataScope.currentData(); + const index2 = getDataIndexOfCube(cube, currentData); + if (index2 >= 0) { + const dataItem = cleanDataItem(((_a2 = this.options.tooltipOptions) === null || _a2 === void 0 ? void 0 : _a2.prepareDataItem(currentData[index2])) || currentData[index2]); + const tooltipCreateOptions = { + dataItem, + event: event2 + }; + if ((_b2 = this.options.tooltipOptions) === null || _b2 === void 0 ? void 0 : _b2.create) { + this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); + } else { + this._tooltip = new Tooltip$1(Object.assign(Object.assign({}, tooltipCreateOptions), { cssPrefix: this.presenter.style.cssPrefix })); + } + } } - function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); + onTextHover(e, t) { + if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) + return false; + return !colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); } - return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { - return specifier; - }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { - return specifier; - }; - return p; + getMorphChartsColors() { + const { colors: colors2 } = this.options; + return { + activeItemColor: colors2.activeCube, + axesGridBackgroundColor: colors2.backgroundColor, + axesGridHighlightColor: colors2.axisSelectHighlight, + axesGridMajorColor: colors2.gridLine, + axesGridMinorColor: colors2.gridLine, + axesGridZeroColor: colors2.gridLine, + axesTextHeadingColor: colors2.axisText, + axesTextLabelColor: colors2.axisText, + axesTextTitleColor: colors2.axisText, + backgroundColor: colors2.backgroundColor, + textBorderColor: colors2.backgroundColor, + textColor: colors2.axisText + }; + } + createConfig(c2) { + var _a2; + const { getTextColor, getTextHighlightColor, onTextClick } = this.options; + const defaultPresenterConfig2 = { + morphChartsColors: this.getMorphChartsColors(), + zAxisZindex, + getCharacterSet: (stage) => this._characterSet.getCharacterSet(stage), + getTextColor, + getTextHighlightColor, + onTextClick: (e, t) => { + if (t.metaData && t.metaData.search) { + const search = getSearchGroupFromVegaValue(t.metaData.search); + if (this.options.onAxisClick) { + this.options.onAxisClick(e, search); + } else { + this.select(search); + } + } + if (onTextClick) { + onTextClick(e, t); + } + }, + onCubeClick: this.onCubeClick.bind(this), + onCubeHover: this.onCubeHover.bind(this), + onTextHover: this.onTextHover.bind(this), + preLayer: this.preLayer.bind(this), + preStage: this.preStage.bind(this), + onPresent: this.onPresent.bind(this), + onAxisConfig: (cartesian2, dim3d, axis) => { + if (!axis) + return; + const role = this.specCapabilities.roles.filter((r) => r.role === axis.axisRole)[0]; + if (role === null || role === void 0 ? void 0 : role.axisSelection) { + cartesian2.isDivisionPickingEnabled[dim3d] = true; + cartesian2.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; + cartesian2.isLabelPickingEnabled[dim3d] = true; + cartesian2.isTitlePickingEnabled[dim3d] = true; + cartesian2.isHeadingPickingEnabled[dim3d] = true; + cartesian2.isGridPickingEnabled = false; + } + }, + onAxesComplete: (cartesian2) => { + }, + axisPickGridCallback: (divisions, e) => { + const search = this._axisSelection.convert(divisions); + if (this.options.onAxisClick) { + this.options.onAxisClick(e, search); + } else { + this.select(search); + } }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { - return specifier; - }; - return f; + onLayerClick: (e) => { + this.options.onCanvasClick && this.options.onCanvasClick(e); + this.deselect(); }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { - return specifier; - }; - return p; - } - }; -} -var pads = { - "-": "", - "_": " ", - "0": "0" -}, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; -function pad(value, fill, width) { - var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); -} -function requote(s) { - return s.replace(requoteRe, "\\$&"); -} -function formatRe(names) { - return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); -} -function formatLookup(names) { - return new Map(names.map((name, i)=>[ - name.toLowerCase(), - i - ])); -} -function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.w = +n[0], i + n[0].length) : -1; -} -function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.u = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.U = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.V = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.W = +n[0], i + n[0].length) : -1; -} -function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); - return n ? (d.y = +n[0], i + n[0].length) : -1; -} -function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; -} -function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); - return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; -} -function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; -} -function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.m = n[0] - 1, i + n[0].length) : -1; -} -function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.d = +n[0], i + n[0].length) : -1; -} -function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; -} -function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.H = +n[0], i + n[0].length) : -1; -} -function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.M = +n[0], i + n[0].length) : -1; -} -function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.S = +n[0], i + n[0].length) : -1; -} -function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.L = +n[0], i + n[0].length) : -1; -} -function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; -} -function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; -} -function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.Q = +n[0], i + n[0].length) : -1; -} -function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.s = +n[0], i + n[0].length) : -1; -} -function formatDayOfMonth(d, p) { - return pad(d.getDate(), p, 2); -} -function formatHour24(d, p) { - return pad(d.getHours(), p, 2); -} -function formatHour12(d, p) { - return pad(d.getHours() % 12 || 12, p, 2); -} -function formatDayOfYear(d, p) { - return pad(1 + (0, _d3Time.timeDay).count((0, _d3Time.timeYear)(d), d), p, 3); -} -function formatMilliseconds(d, p) { - return pad(d.getMilliseconds(), p, 3); -} -function formatMicroseconds(d, p) { - return formatMilliseconds(d, p) + "000"; -} -function formatMonthNumber(d, p) { - return pad(d.getMonth() + 1, p, 2); -} -function formatMinutes(d, p) { - return pad(d.getMinutes(), p, 2); -} -function formatSeconds(d, p) { - return pad(d.getSeconds(), p, 2); -} -function formatWeekdayNumberMonday(d) { - var day = d.getDay(); - return day === 0 ? 7 : day; -} -function formatWeekNumberSunday(d, p) { - return pad((0, _d3Time.timeSunday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function dISO(d) { - var day = d.getDay(); - return day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); -} -function formatWeekNumberISO(d, p) { - d = dISO(d); - return pad((0, _d3Time.timeThursday).count((0, _d3Time.timeYear)(d), d) + ((0, _d3Time.timeYear)(d).getDay() === 4), p, 2); -} -function formatWeekdayNumberSunday(d) { - return d.getDay(); -} -function formatWeekNumberMonday(d, p) { - return pad((0, _d3Time.timeMonday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function formatYear(d, p) { - return pad(d.getFullYear() % 100, p, 2); -} -function formatYearISO(d, p) { - d = dISO(d); - return pad(d.getFullYear() % 100, p, 2); -} -function formatFullYear(d, p) { - return pad(d.getFullYear() % 10000, p, 4); -} -function formatFullYearISO(d, p) { - var day = d.getDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); - return pad(d.getFullYear() % 10000, p, 4); -} -function formatZone(d) { - var z = d.getTimezoneOffset(); - return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); -} -function formatUTCDayOfMonth(d, p) { - return pad(d.getUTCDate(), p, 2); -} -function formatUTCHour24(d, p) { - return pad(d.getUTCHours(), p, 2); -} -function formatUTCHour12(d, p) { - return pad(d.getUTCHours() % 12 || 12, p, 2); -} -function formatUTCDayOfYear(d, p) { - return pad(1 + (0, _d3Time.utcDay).count((0, _d3Time.utcYear)(d), d), p, 3); -} -function formatUTCMilliseconds(d, p) { - return pad(d.getUTCMilliseconds(), p, 3); -} -function formatUTCMicroseconds(d, p) { - return formatUTCMilliseconds(d, p) + "000"; -} -function formatUTCMonthNumber(d, p) { - return pad(d.getUTCMonth() + 1, p, 2); -} -function formatUTCMinutes(d, p) { - return pad(d.getUTCMinutes(), p, 2); -} -function formatUTCSeconds(d, p) { - return pad(d.getUTCSeconds(), p, 2); -} -function formatUTCWeekdayNumberMonday(d) { - var dow = d.getUTCDay(); - return dow === 0 ? 7 : dow; -} -function formatUTCWeekNumberSunday(d, p) { - return pad((0, _d3Time.utcSunday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function UTCdISO(d) { - var day = d.getUTCDay(); - return day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); -} -function formatUTCWeekNumberISO(d, p) { - d = UTCdISO(d); - return pad((0, _d3Time.utcThursday).count((0, _d3Time.utcYear)(d), d) + ((0, _d3Time.utcYear)(d).getUTCDay() === 4), p, 2); -} -function formatUTCWeekdayNumberSunday(d) { - return d.getUTCDay(); -} -function formatUTCWeekNumberMonday(d, p) { - return pad((0, _d3Time.utcMonday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function formatUTCYear(d, p) { - return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCYearISO(d, p) { - d = UTCdISO(d); - return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCFullYear(d, p) { - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCFullYearISO(d, p) { - var day = d.getUTCDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCZone() { - return "+0000"; -} -function formatLiteralPercent() { - return "%"; -} -function formatUnixTimestamp(d) { - return +d; -} -function formatUnixTimestampSeconds(d) { - return Math.floor(+d / 1000); -} - -},{"d3-time":"6KMda","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iLPRP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>utcTime); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _timeJs = require("./time.js"); -var _initJs = require("./init.js"); -function utcTime() { - return (0, _initJs.initRange).apply((0, _timeJs.calendar)((0, _d3Time.utcTicks), (0, _d3Time.utcTickInterval), (0, _d3Time.utcYear), (0, _d3Time.utcMonth), (0, _d3Time.utcWeek), (0, _d3Time.utcDay), (0, _d3Time.utcHour), (0, _d3Time.utcMinute), (0, _d3Time.utcSecond), (0, _d3TimeFormat.utcFormat)).domain([ - Date.UTC(2000, 0, 1), - Date.UTC(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"6KMda","d3-time-format":"eC6Bi","./time.js":"dtq1F","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0eA3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "default", ()=>sequential); -parcelHelpers.export(exports, "sequentialLog", ()=>sequentialLog); -parcelHelpers.export(exports, "sequentialSymlog", ()=>sequentialSymlog); -parcelHelpers.export(exports, "sequentialPow", ()=>sequentialPow); -parcelHelpers.export(exports, "sequentialSqrt", ()=>sequentialSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 1, t0, t1, k10, transform, interpolator = (0, _continuousJs.identity), clamp = false, unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [ - x0, - x1 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [ - interpolator(0), - interpolator(1) - ]; + onLegendClick: (e, legend2, clickedIndex) => { + const legendRow = clickedIndex !== null && legend2.rows[clickedIndex]; + if (legendRow) { + if (this.options.onLegendRowClick) { + this.options.onLegendRowClick(e, legendRow); + } else { + this.select(legendRow.search); + } + } else if (this.options.onLegendHeaderClick) { + this.options.onLegendHeaderClick(e); + } + }, + onSceneRectAssignCubeOrdinal: (datum2) => { + return datum2[GL_ORDINAL]; + }, + onTargetViewState: (h2, w2) => { + const { height: height2, width: width2 } = this.insight.size; + let newViewStateTarget; + if (this.options.onNewViewStateTarget) { + newViewStateTarget = this.options.onNewViewStateTarget(); + } + return { height: height2, width: width2, newViewStateTarget }; + }, + layerSelection: { + cubes: this.convertSearchToSet() + }, + preserveDrawingBuffer: this.options.preserveDrawingBuffer + }; + if (!this.options.disableLasso) { + defaultPresenterConfig2.onLasso = (ids, e) => { + this.deselect(); + const search = this.convertSetToSearch(ids); + this.select(search); }; - } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); - return scale; - }; -} -function copy(source, target) { - return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown()); -} -function sequential() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return copy(scale, sequential()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 1, - 10 - ]); - scale.copy = function() { - return copy(scale, sequentialLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSqrt() { - return sequentialPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"hWyQt","./continuous.js":"2SYx4","./init.js":"ijd73","./linear.js":"ik2PQ","./log.js":"5BBe1","./symlog.js":"26cMO","./pow.js":"ah9R8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i0IcB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sequentialQuantile); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function sequentialQuantile() { - var domain = [], interpolator = (0, _continuousJs.identity); - function scale(x) { - if (x != null && !isNaN(x = +x)) return interpolator(((0, _d3Array.bisect)(domain, x, 1) - 1) / (domain.length - 1)); - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return scale; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - scale.range = function() { - return domain.map((d, i)=>interpolator(i / (domain.length - 1))); - }; - scale.quantiles = function(n) { - return Array.from({ - length: n + 1 - }, (_, i)=>(0, _d3Array.quantile)(domain, i / n)); - }; - scale.copy = function() { - return sequentialQuantile(interpolator).domain(domain); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} - -},{"d3-array":"5lCYW","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6Pqcc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>diverging); -parcelHelpers.export(exports, "divergingLog", ()=>divergingLog); -parcelHelpers.export(exports, "divergingSymlog", ()=>divergingSymlog); -parcelHelpers.export(exports, "divergingPow", ()=>divergingPow); -parcelHelpers.export(exports, "divergingSqrt", ()=>divergingSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _sequentialJs = require("./sequential.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 0.5, x2 = 1, s = 1, t0, t1, t2, k10, k21, interpolator = (0, _continuousJs.identity), transform, clamp = false, unknown; - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [ - x0, - x1, - x2 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = (0, _d3Interpolate.piecewise)(interpolate, [ - r0, - r1, - r2 - ]), scale) : [ - interpolator(0), - interpolator(0.5), - interpolator(1) - ]; + } + if (this.options.onBeforeCreateLayers) { + defaultPresenterConfig2.preLayer = (stage) => { + this.preLayer(stage); + this.options.onBeforeCreateLayers(stage, this.specCapabilities); }; + } + const config = { + presenter: this.presenter, + presenterConfig: Object.assign(defaultPresenterConfig2, c2) + }; + if ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transitionDurations) { + config.presenterConfig.transitionDurations = this.setup.transitionDurations; + } + return config; } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} -function diverging() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, diverging()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 0.1, - 1, - 10 - ]); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSqrt() { - return divergingPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"hWyQt","./continuous.js":"2SYx4","./init.js":"ijd73","./linear.js":"ik2PQ","./log.js":"5BBe1","./sequential.js":"e0eA3","./symlog.js":"26cMO","./pow.js":"ah9R8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7m9yM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '4.0.6'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"71zHd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "classList", ()=>classList); -parcelHelpers.export(exports, "deepCompare", ()=>deepCompare); -parcelHelpers.export(exports, "compareInsight", ()=>compareInsight); -var _justCompare = require("just-compare"); -const classList = (...args)=>{ - return args.filter(Boolean).join(' '); -}; -const deepCompare = _justCompare.default || _justCompare; -function addNullable(insight, signalValues) { - const withNulls = Object.assign(Object.assign({ - view: null, - filter: null - }, insight), { - signalValues - }); - return withNulls; -} -function compareInsight(viewer, insight) { - const currentInsight = viewer.getInsight(); - const a = addNullable(currentInsight, Object.assign(Object.assign({}, viewer.insight.signalValues), currentInsight.signalValues)); - const b = addNullable(insight, Object.assign(Object.assign({}, a.signalValues), insight.signalValues)); - const compare = deepCompare(a, b); - return { - a, - b, - compare - }; -} - -},{"just-compare":"hL7vS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hL7vS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>collectionCompare); -var collectionCompare = compare; -/* - primitives: value1 === value2 - functions: value1.toString == value2.toString - arrays: if length, sequence and values of properties are identical - objects: if length, names and values of properties are identical - compare([[1, [2, 3]], [[1, [2, 3]]); // true - compare([[1, [2, 3], 4], [[1, [2, 3]]); // false - compare({a: 2, b: 3}, {a: 2, b: 3}); // true - compare({a: 2, b: 3}, {b: 3, a: 2}); // true - compare({a: 2, b: 3, c: 4}, {a: 2, b: 3}); // false - compare({a: 2, b: 3}, {a: 2, b: 3, c: 4}); // false - compare([[1, [2, {a: 4}], 4], [[1, [2, {a: 4}]]); // true -*/ function compare(value1, value2) { - if (value1 === value2) return true; - /* eslint-disable no-self-compare */ // if both values are NaNs return true - if (value1 !== value1 && value2 !== value2) return true; - if (({}).toString.call(value1) != ({}).toString.call(value2)) return false; - if (value1 !== Object(value1)) // non equal primitives - return false; - if (!value1) return false; - if (Array.isArray(value1)) return compareArrays(value1, value2); - if (({}).toString.call(value1) == '[object Set]') return compareArrays(Array.from(value1), Array.from(value2)); - if (({}).toString.call(value1) == '[object Object]') return compareObjects(value1, value2); - else return compareNativeSubtypes(value1, value2); -} -function compareNativeSubtypes(value1, value2) { - // e.g. Function, RegExp, Date + /** + * Filter the data and animate. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. + */ + filter(search, rebase = false) { + const u2 = this._dataScope.createUserSelection(search, false, rebase); + return new Promise((resolve2, reject) => { + this._animator.filter(search, u2.included, u2.excluded, rebase).then(() => { + this._details.clear(); + this._details.clearSelection(); + this._details.populate(this._dataScope.selection); + resolve2(); + }); + }); + } + /** + * Remove any filtration and animate. + */ + reset() { + return new Promise((resolve2, reject) => { + this._animator.reset().then(() => { + this._details.clear(); + this._details.clearSelection(); + resolve2(); + }); + }); + } + /** + * Select cubes by a filter expression. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + */ + select(search) { + return new Promise((resolve2, reject) => { + this._animator.select(search).then(() => { + this._details.populate(this._dataScope.selection); + resolve2(); + }); + }); + } + /** + * Removes any selection. + */ + deselect() { + return new Promise((resolve2, reject) => { + this._animator.deselect().then(() => { + this._details.clearSelection(); + resolve2(); + }); + }); + } + /** + * Gets the current selection. + */ + getSelection() { + if (!this._dataScope) + return null; + const selectionState = { + search: this._dataScope.selection && this._dataScope.selection.search || null, + selectedData: this._dataScope.selection && this._dataScope.selection.included || null, + active: this._dataScope.active + }; + return selectionState; + } + /** + * Set one data row to the active state. + */ + activate(datum2) { + return new Promise((resolve2, reject) => { + this._animator.activate(datum2).then(() => { + this.presenter.morphChartsRenderResult.activate(datum2[GL_ORDINAL]); + this._details.render(); + resolve2(); + }); + }); + } + /** + * Deactivate item. + */ + deActivate() { + return new Promise((resolve2, reject) => { + if (this._dataScope && this._dataScope.active) { + this._animator.deactivate().then(() => { + this.presenter.morphChartsRenderResult.activate(-1); + this._details.render(); + resolve2(); + }); + } else { + resolve2(); + } + }); + } + /** + * Gets the current camera. + * @param transitionFinal Optional flag to get camera destination when transition completes. + */ + getCamera(transitionFinal = false) { + var _a2, _b2, _c2, _d2, _e2, _f, _g; + let position2 = [0, 0, 0]; + let rotation2 = [0, 0, 0, 0]; + if (transitionFinal) { + position2 = Array.from((_b2 = (_a2 = this.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphchartsref) === null || _b2 === void 0 ? void 0 : _b2.cameraTransitioner.vPosition.to); + rotation2 = Array.from((_d2 = (_c2 = this.presenter) === null || _c2 === void 0 ? void 0 : _c2.morphchartsref) === null || _d2 === void 0 ? void 0 : _d2.cameraTransitioner.qRotation.to); + } else { + const camera = (_g = (_f = (_e2 = this.presenter) === null || _e2 === void 0 ? void 0 : _e2.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; + if (camera) { + camera.getPosition(position2); + camera.getOrbit(rotation2); + } + } + return { position: position2, rotation: rotation2, captureSize: this.insight.size }; + } + /** + * Sets the current camera. + * @param camera Camera to set. + */ + setCamera(camera) { + var _a2, _b2; + if (camera) { + (_b2 = (_a2 = this.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphChartsRenderResult) === null || _b2 === void 0 ? void 0 : _b2.moveCamera(camera); + } + } + /** + * Gets the current insight with signal values. + */ + getInsight() { + const insight = Object.assign({}, this.insight); + insight.signalValues = this.getSignalValues(); + return insight; + } + /** + * Gets column stats from current data (filtered or all). + * @param column Column to get stats for. + */ + getColumnStats(column) { + return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; + } + /** + * Gets current signal values. + */ + getSignalValues() { + return extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); + } + assignTransitionStagger(transition) { + assignTransitionStagger(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + } + finalize() { + if (this._dataScope) + this._dataScope.finalize(); + if (this._details) + this._details.finalize(); + if (this._tooltip) + this._tooltip.destroy(); + if (this.vegaViewGl) + this.vegaViewGl.finalize(); + if (this.presenter) + this.presenter.finalize(); + if (this.element) + this.element.innerHTML = ""; + this.colorContexts = null; + this.element = null; + this.options = null; + this.presenter = null; + this.vegaSpec = null; + this.vegaViewGl = null; + this._animator = null; + this._dataScope = null; + this._details = null; + this._tooltip = null; + } + }; + Viewer$1.defaultViewerOptions = defaultViewerOptions$1; + const version$4 = "4.0.6"; + const use$4 = use$5; + const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + VegaMorphCharts: index$5, + Viewer: Viewer$1, + colorSchemes, + constants: constants$1, + searchExpression: index$6, + specs: index$7, + types: types$1, + use: use$4, + util: util$3, + version: version$4 + }, Symbol.toStringTag, { value: "Module" })); + var collectionCompare = compare$2; + function compare$2(value1, value2) { + if (value1 === value2) { + return true; + } + if (value1 !== value1 && value2 !== value2) { + return true; + } + if ({}.toString.call(value1) != {}.toString.call(value2)) { + return false; + } + if (value1 !== Object(value1)) { + return false; + } + if (!value1) { + return false; + } + if (Array.isArray(value1)) { + return compareArrays(value1, value2); + } + if ({}.toString.call(value1) == "[object Set]") { + return compareArrays(Array.from(value1), Array.from(value2)); + } + if ({}.toString.call(value1) == "[object Object]") { + return compareObjects(value1, value2); + } else { + return compareNativeSubtypes(value1, value2); + } + } + function compareNativeSubtypes(value1, value2) { return value1.toString() === value2.toString(); -} -function compareArrays(value1, value2) { - var len = value1.length; - if (len != value2.length) return false; + } + function compareArrays(value1, value2) { + var len2 = value1.length; + if (len2 != value2.length) { + return false; + } var alike = true; - for(var i = 0; i < len; i++)if (!compare(value1[i], value2[i])) { + for (var i = 0; i < len2; i++) { + if (!compare$2(value1[i], value2[i])) { alike = false; break; + } } return alike; -} -function compareObjects(value1, value2) { + } + function compareObjects(value1, value2) { var keys1 = Object.keys(value1).sort(); var keys2 = Object.keys(value2).sort(); - var len = keys1.length; - if (len != keys2.length) return false; - for(var i = 0; i < len; i++){ - var key1 = keys1[i]; - var key2 = keys2[i]; - if (!(key1 == key2 && compare(value1[key1], value2[key2]))) return false; + var len2 = keys1.length; + if (len2 != keys2.length) { + return false; + } + for (var i = 0; i < len2; i++) { + var key1 = keys1[i]; + var key2 = keys2[i]; + if (!(key1 == key2 && compare$2(value1[key1], value2[key2]))) { + return false; + } } return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2yfj3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Viewer", ()=>Viewer); -var _base = require("./base"); -var _util = require("./util"); -var _sanddance = require("@msrvida/sanddance"); -function _Viewer(_props) { - class __Viewer extends (0, _base.base).react.Component { - layout() { - const { props } = this; - this.lastData = props.data; - this.viewer.render({ - insight: props.insight, - setup: props.setup - }, props.data, props.renderOptions).then((renderResult)=>{ - //TODO: show errors if any - //console.log('viewer render'); - props.onView && props.onView(renderResult); - }).catch((e)=>{ - //console.log('viewer error'); - props.onError && props.onError(e); - }); - } - view() { - var _a, _b, _c, _d, _e; - const { props } = this; - let didLayout = false; - if (props.insight && props.data) { - const c = (0, _util.compareInsight)(this.viewer, props.insight); - const sameDataRef = props.data === this.lastData; - if (!c.compare || !sameDataRef) { - this.layout(); - didLayout = true; - } - } - if (!didLayout && props.setup) { - const { camera } = props.setup; - //compare setup, move camera - if (camera !== 'hold') { - if (!(0, _util.deepCompare)(this.viewer.setup.camera, camera)) { - //camera is different - if (!camera) (_b = (_a = this.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 || _b.homeCamera(); - else this.viewer.setCamera(camera); - //save this for next comparison - const setup = (0, _sanddance.VegaMorphCharts).util.clone(this.viewer.setup); - setup.camera = camera; - this.viewer.setup = setup; - } - } - if (props.setup.renderer) (_e = (_d = (_c = this.viewer) === null || _c === void 0 ? void 0 : _c.presenter) === null || _d === void 0 ? void 0 : _d.morphchartsref) === null || _e === void 0 || _e.setMorphChartsRendererOptions(props.setup.renderer); - } + } + const compare$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: collectionCompare + }, Symbol.toStringTag, { value: "Module" })); + const classList = (...args) => { + return args.filter(Boolean).join(" "); + }; + const deepCompare = collectionCompare || compare$3; + function addNullable(insight, signalValues) { + const withNulls = Object.assign(Object.assign({ view: null, filter: null }, insight), { signalValues }); + return withNulls; + } + function compareInsight(viewer, insight) { + const currentInsight = viewer.getInsight(); + const a2 = addNullable(currentInsight, Object.assign(Object.assign({}, viewer.insight.signalValues), currentInsight.signalValues)); + const b2 = addNullable(insight, Object.assign(Object.assign({}, a2.signalValues), insight.signalValues)); + const compare2 = deepCompare(a2, b2); + return { a: a2, b: b2, compare: compare2 }; + } + const util$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + classList, + compareInsight, + deepCompare + }, Symbol.toStringTag, { value: "Module" })); + const base$2 = { + react: null, + reactDOM: null + }; + function use$3(react, reactDOM, vega2) { + use$5(vega2); + base$2.react = react; + base$2.reactDOM = reactDOM; + Viewer.prototype = react.Component.prototype; + } + function _Viewer(_props) { + class __Viewer extends base$2.react.Component { + layout() { + const { props } = this; + this.lastData = props.data; + this.viewer.render({ + insight: props.insight, + setup: props.setup + }, props.data, props.renderOptions).then((renderResult) => { + props.onView && props.onView(renderResult); + }).catch((e) => { + props.onError && props.onError(e); + }); + } + view() { + var _a2, _b2, _c2, _d2, _e2; + const { props } = this; + let didLayout = false; + if (props.insight && props.data) { + const c2 = compareInsight(this.viewer, props.insight); + const sameDataRef = props.data === this.lastData; + if (!c2.compare || !sameDataRef) { + this.layout(); + didLayout = true; + } + } + if (!didLayout && props.setup) { + const { camera } = props.setup; + if (camera !== "hold") { + if (!deepCompare(this.viewer.setup.camera, camera)) { + if (!camera) { + (_b2 = (_a2 = this.viewer) === null || _a2 === void 0 ? void 0 : _a2.presenter) === null || _b2 === void 0 ? void 0 : _b2.homeCamera(); + } else { + this.viewer.setCamera(camera); + } + const setup2 = clone(this.viewer.setup); + setup2.camera = camera; + this.viewer.setup = setup2; + } + } + if (props.setup.renderer) { + (_e2 = (_d2 = (_c2 = this.viewer) === null || _c2 === void 0 ? void 0 : _c2.presenter) === null || _d2 === void 0 ? void 0 : _d2.morphchartsref) === null || _e2 === void 0 ? void 0 : _e2.setMorphChartsRendererOptions(props.setup.renderer); + } } - componentDidMount() { - const { props } = this; - const element = (0, _base.base).reactDOM.findDOMNode(this.viewerDiv); - this.viewer = new (0, _sanddance.Viewer)(element, props.viewerOptions); - if (props.onMount) { - if (props.onMount(this.viewer.presenter.getElement((0, _sanddance.VegaMorphCharts).PresenterElement.gl))) this.view(); - } else this.view(); - } - componentDidUpdate() { - const { props } = this; - this.viewer.options = (0, _sanddance.VegaMorphCharts).util.deepMerge(this.viewer.options, props.viewerOptions); + } + componentDidMount() { + const { props } = this; + const element2 = base$2.reactDOM.findDOMNode(this.viewerDiv); + this.viewer = new Viewer$1(element2, props.viewerOptions); + if (props.onMount) { + if (props.onMount(this.viewer.presenter.getElement(PresenterElement$1.gl))) { this.view(); + } + } else { + this.view(); } - componentWillUnmount() { - this.viewer.finalize(); - } - render() { - return (0, _base.base).react.createElement("div", { - className: "sanddance-ReactViewer", - ref: (div)=>this.viewerDiv = div - }); - } + } + componentDidUpdate() { + const { props } = this; + this.viewer.options = deepMerge(this.viewer.options, props.viewerOptions); + this.view(); + } + componentWillUnmount() { + this.viewer.finalize(); + } + render() { + return base$2.react.createElement("div", { className: "sanddance-ReactViewer", ref: (div) => this.viewerDiv = div }); + } } return new __Viewer(_props); -} -const Viewer = _Viewer; - -},{"./base":"e2btd","./util":"71zHd","@msrvida/sanddance":"ganM8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e2btd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param react React library. - * @param vega Vega library. - * @param deck @deck.gl/core library. - * @param layers @deck.gl/layers library. - * @param luma @luma.gl/core library. - */ parcelHelpers.export(exports, "use", ()=>use); -var _viewer = require("./viewer"); -var _sanddance = require("@msrvida/sanddance"); -const base = { - react: null, - reactDOM: null -}; -function use(react, reactDOM, vega) { - _sanddance.VegaMorphCharts.use(vega); - base.react = react; - base.reactDOM = reactDOM; - //inform React that we are using a dynamic base class - (0, _viewer.Viewer).prototype = react.Component.prototype; -} - -},{"./viewer":"2yfj3","@msrvida/sanddance":"ganM8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g42QN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '4.0.2'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"67xOI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "strings", ()=>strings); -const strings = { - appName: 'SandDance', - bingsearch: 'Bing', - bingsearchDescription: (term)=>`Search Bing for "${term}"`, - buttonClose: 'Close', - buttonSelect: 'Search & Select', - buttonColorSchemeMap: 'Map color scheme to filtered data', - buttonColorSchemeRemap: 'Remap color to filtered data', - buttonColorSchemeKeep: 'Keep same color scheme', - buttonCopyToClipboard: 'Copy to clipboard', - buttonExclude: 'Exclude', - buttonExport: 'Export', - buttonExportCount: (total)=>total == 1 ? 'Export 1 row...' : `Export ${total} rows...`, - buttonIsolate: 'Isolate', - buttonReset: 'Stop filtering', - buttonDeselect: 'Clear selection', - buttonToolbarFloat: 'Float toolbar', - buttonToolbarDock: 'Dock toolbar', - buttonToolbarHide: 'Hide toolbar', - buttonToolbarShow: 'Show toolbar', - buttonNextDataItem: 'Next data item', - buttonPrevDataItem: 'Previous data item', - buttonCreateSnapshot: 'Create snapshot', - buttonNextSnapshot: 'Next snapshot', - buttonPrevSnapshot: 'Previous snapshot', - buttonUpdateSnapshot: 'Update snapshot', - buttonAddExpression: 'Add expression', - buttonAddExpressionGroup: 'Add group', - buttonDeleteExpression: 'Delete', - buttonDeleteExpressionGroup: 'Delete group', - buttonClearSnapshots: 'Clear snapshots', - buttonDeleteSnapshot: 'Delete snapshot', - buttonEditSnapshot: 'Edit snapshot', - buttonMoveUp: 'Move up', - buttonMoveDown: 'Move down', - buttonShowVegaSpec: 'Show Vega spec', - buttonLaunchVegaEditor: 'Open Vega Editor', - buttonCameraHome: 'Center chart in window', - buttonTooltipMapping: 'Tooltip columns...', - buttonBackgroundImage: 'Background image...', - buttonTransitionReverse: 'Play Reverse', - buttonTransitionPause: 'Pause', - buttonTransitionPlay: 'Play', - buttonUndo: 'Undo', - buttonRedo: 'Redo', - buttonColumnTypes: 'Column types...', - buttonApply: 'Apply', - buttonRemove: 'Remove', - buttonResetToDefault: 'Reset to default', - chartTypeBarChartH: 'Bar', - chartTypeBarChartV: 'Column', - chartTypeDensity: 'Density', - chartTypeGrid: 'Grid', - chartTypeScatterPlot: 'Scatter', - chartTypeStacks: 'Stacks', - chartTypeStrips: 'Strips', - chartTypeTreeMap: 'Treemap', - defaultFileName: 'sanddance-data', - errorExportFilenameEmpty: 'Filename cannot be blank', - errorExportFilenameCharacters: (characters)=>`A filename cannot contain any of the following characters: ${characters}`, - errorColumnMustBeNumeric: 'Numeric column required for this chart type.', - errorNumericValue: 'Value must be numeric', - errorImageFormat: 'File is not an image', - labelBackgroundImageDialogTitle: 'Background image', - labelBackgroundImageSubtext: 'Background image can only be shown on Scatterplot, Density, and Stacks charts. Columns must be numeric type.', - labelBackgroundLeft: 'Left extent', - labelBackgroundRight: 'Right extent', - labelBackgroundBottom: 'Bottom extent', - labelBackgroundTop: 'Top extent', - labelBlank: 'blank', - labelNull: 'null', - labelTrue: 'true', - labelFalse: 'false', - labelSystemInfo: 'System info', - labelChangeColumnType: 'Change column type', - labelChartSettings: 'Chart settings', - labelEditColumn: 'Edit', - labelColumnName: 'Column name', - labelColumnType: 'Column type', - labelColumnDistinct: 'Distinct values', - labelColumnHasColorData: 'Has color data', - labelColumnIsColorData: 'Is color data', - labelColumnQuantitativeMin: 'Min', - labelColumnQuantitativeMax: 'Max', - labelColumnQuantitativeMean: 'Mean', - labelDataBrowser: 'Data browser', - labelDataScope: 'Scope', - labelExport: 'Export Data', - labelExportFormat: 'File format', - labelExportCSV: '.CSV - Comma separated values', - labelExportHTML: '.HTML - A SandDance html page embedding this data', - labelExportJSON: '.JSON - JavaScript object notation', - labelExportTSV: '.TSV - Tab separated values', - labelHistory: 'History', - labelHistoryWarning: 'This will erase your current history.', - labelTools: 'Tools', - labelHoldCamera: 'Keep previous camera position', - labelVegaSpec: 'Vega specification', - labelColor: 'Chart color', - labelError: 'Error', - labelExportFileName: 'File name', - labelSnapshots: 'Snapshots', - labelSnapshotSettingThumbnailWidth: 'Thumbnail image width', - labelSearch: 'Select by search', - labelSearchClause: 'Clause', - labelSearchColumn: 'Field', - labelSearchOperator: 'Operator', - labelSearchValue: 'Value', - labelSearchValuePlaceholder: 'Value to search for', - labelChart: 'Chart', - labelChartCanvas: 'Chart canvas', - labelColumnMapping: 'Column Mapping', - labelChartTypeOptions: 'Chart options', - labelColorBin: 'Color binning', - labelColorOptions: 'Color options', - labelColorBinExplanation: 'For numeric columns', - labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount)=>`Field <span className="fieldname">${colorColumnName}</span> is of type <span className="fieldtype">${colorColumnType}</span>${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ''}.`, - labelColorFieldIsColorData: (colorColumnName)=>`Field <span className="fieldname">${colorColumnName}</span> contains direct color data.`, - labelColorBinNone: 'None (continuous)', - labelColorBinQuantize: 'Quantize', - labelColorBinQuantile: 'Quantile', - labelColorFilter: 'Note: Colors will be re-mapped to the filter when viewing this snapshot.', - labelColorScheme: 'Scheme', - labelTotal: 'Total by', - labelTotalByCountSquare: 'Count (Grid layout)', - labelTotalByCountStrip: 'Count (Strip layout)', - labelTotalBySumStrip: 'Sum (Strip layout)', - labelTotalBySumTreemap: 'Sum (Treemap layout)', - labelTotalBySumStripPercent: 'Sum as percentage (Strip layout)', - labelColumnColor: 'Color by', - labelColumnFacet: 'Facet by', - labelFacetLayout: 'Facet layout', - labelFacetLayoutWrap: 'Wrap', + } + const Viewer = _Viewer; + const version$3 = "4.0.2"; + const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + SandDance: index$4, + Viewer, + use: use$3, + util: util$2, + version: version$3 + }, Symbol.toStringTag, { value: "Module" })); + const strings$1 = { + appName: "SandDance", + bingsearch: "Bing", + bingsearchDescription: (term) => `Search Bing for "${term}"`, + buttonClose: "Close", + buttonSelect: "Search & Select", + buttonColorSchemeMap: "Map color scheme to filtered data", + buttonColorSchemeRemap: "Remap color to filtered data", + buttonColorSchemeKeep: "Keep same color scheme", + buttonCopyToClipboard: "Copy to clipboard", + buttonExclude: "Exclude", + buttonExport: "Export", + buttonExportCount: (total) => total == 1 ? "Export 1 row..." : `Export ${total} rows...`, + buttonIsolate: "Isolate", + buttonReset: "Stop filtering", + buttonDeselect: "Clear selection", + buttonToolbarFloat: "Float toolbar", + buttonToolbarDock: "Dock toolbar", + buttonToolbarHide: "Hide toolbar", + buttonToolbarShow: "Show toolbar", + buttonNextDataItem: "Next data item", + buttonPrevDataItem: "Previous data item", + buttonCreateSnapshot: "Create snapshot", + buttonNextSnapshot: "Next snapshot", + buttonPrevSnapshot: "Previous snapshot", + buttonUpdateSnapshot: "Update snapshot", + buttonAddExpression: "Add expression", + buttonAddExpressionGroup: "Add group", + buttonDeleteExpression: "Delete", + buttonDeleteExpressionGroup: "Delete group", + buttonClearSnapshots: "Clear snapshots", + buttonDeleteSnapshot: "Delete snapshot", + buttonEditSnapshot: "Edit snapshot", + buttonMoveUp: "Move up", + buttonMoveDown: "Move down", + buttonShowVegaSpec: "Show Vega spec", + buttonLaunchVegaEditor: "Open Vega Editor", + buttonCameraHome: "Center chart in window", + buttonTooltipMapping: "Tooltip columns...", + buttonBackgroundImage: "Background image...", + buttonTransitionReverse: "Play Reverse", + buttonTransitionPause: "Pause", + buttonTransitionPlay: "Play", + buttonUndo: "Undo", + buttonRedo: "Redo", + buttonColumnTypes: "Column types...", + buttonApply: "Apply", + buttonRemove: "Remove", + buttonResetToDefault: "Reset to default", + chartTypeBarChartH: "Bar", + chartTypeBarChartV: "Column", + chartTypeDensity: "Density", + chartTypeGrid: "Grid", + chartTypeScatterPlot: "Scatter", + chartTypeStacks: "Stacks", + chartTypeStrips: "Strips", + chartTypeTreeMap: "Treemap", + defaultFileName: "sanddance-data", + errorExportFilenameEmpty: "Filename cannot be blank", + errorExportFilenameCharacters: (characters) => `A filename cannot contain any of the following characters: ${characters}`, + errorColumnMustBeNumeric: "Numeric column required for this chart type.", + errorNumericValue: "Value must be numeric", + errorImageFormat: "File is not an image", + labelBackgroundImageDialogTitle: "Background image", + labelBackgroundImageSubtext: "Background image can only be shown on Scatterplot, Density, and Stacks charts. Columns must be numeric type.", + labelBackgroundLeft: "Left extent", + labelBackgroundRight: "Right extent", + labelBackgroundBottom: "Bottom extent", + labelBackgroundTop: "Top extent", + labelBlank: "blank", + labelNull: "null", + labelTrue: "true", + labelFalse: "false", + labelSystemInfo: "System info", + labelChangeColumnType: "Change column type", + labelChartSettings: "Chart settings", + labelEditColumn: "Edit", + labelColumnName: "Column name", + labelColumnType: "Column type", + labelColumnDistinct: "Distinct values", + labelColumnHasColorData: "Has color data", + labelColumnIsColorData: "Is color data", + labelColumnQuantitativeMin: "Min", + labelColumnQuantitativeMax: "Max", + labelColumnQuantitativeMean: "Mean", + labelDataBrowser: "Data browser", + labelDataScope: "Scope", + labelExport: "Export Data", + labelExportFormat: "File format", + labelExportCSV: ".CSV - Comma separated values", + labelExportHTML: ".HTML - A SandDance html page embedding this data", + labelExportJSON: ".JSON - JavaScript object notation", + labelExportTSV: ".TSV - Tab separated values", + labelHistory: "History", + labelHistoryWarning: "This will erase your current history.", + labelTools: "Tools", + labelHoldCamera: "Keep previous camera position", + labelVegaSpec: "Vega specification", + labelColor: "Chart color", + labelError: "Error", + labelExportFileName: "File name", + labelSnapshots: "Snapshots", + labelSnapshotSettingThumbnailWidth: "Thumbnail image width", + labelSearch: "Select by search", + labelSearchClause: "Clause", + labelSearchColumn: "Field", + labelSearchOperator: "Operator", + labelSearchValue: "Value", + labelSearchValuePlaceholder: "Value to search for", + labelChart: "Chart", + labelChartCanvas: "Chart canvas", + labelColumnMapping: "Column Mapping", + labelChartTypeOptions: "Chart options", + labelColorBin: "Color binning", + labelColorOptions: "Color options", + labelColorBinExplanation: "For numeric columns", + labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount) => `Field <span className="fieldname">${colorColumnName}</span> is of type <span className="fieldtype">${colorColumnType}</span>${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ""}.`, + labelColorFieldIsColorData: (colorColumnName) => `Field <span className="fieldname">${colorColumnName}</span> contains direct color data.`, + labelColorBinNone: "None (continuous)", + labelColorBinQuantize: "Quantize", + labelColorBinQuantile: "Quantile", + labelColorFilter: "Note: Colors will be re-mapped to the filter when viewing this snapshot.", + labelColorScheme: "Scheme", + labelTotal: "Total by", + labelTotalByCountSquare: "Count (Grid layout)", + labelTotalByCountStrip: "Count (Strip layout)", + labelTotalBySumStrip: "Sum (Strip layout)", + labelTotalBySumTreemap: "Sum (Treemap layout)", + labelTotalBySumStripPercent: "Sum as percentage (Strip layout)", + labelColumnColor: "Color by", + labelColumnFacet: "Facet by", + labelFacetLayout: "Facet layout", + labelFacetLayoutWrap: "Wrap", // labelFacetLayoutHorizontal: 'Horizontal', // labelFacetLayoutVertical: 'Vertical', - labelFacetLayoutCross: "\u229E", - labelColumnFacetV: 'Cross facet by', - labelColumnSort: 'Sort by', - labelColumnX: 'X Axis', - labelColumnY: 'Y Axis', - labelColumnZ: 'Z Axis', - labelColumnSize: 'Size by', - labelColumnGroup: 'Group by', - labelAliasColor: 'Color', - labelAliasFacet: 'Facet', - labelAliasFacetV: 'Vertical facet', - labelAliasSort: 'Sort', - labelAliasX: 'X Axis', - labelAliasY: 'Y Axis', - labelAliasZ: 'Z Axis', - labelAliasSize: 'Size', - labelAliasGroup: 'Group', - labelDataItemIsFiltered: 'Item is filtered from view', - labelHistoryInit: 'Initial view', - labelHistoryFilterClear: 'Clear filter', - labelHistoryFilterIExclude: 'Exclude filter', - labelHistoryFilterIsolate: 'Isolate filter', - labelHistoryChangeChartType: (chart)=>`Change chart type to ${chart}`, - labelHistoryMapColumn: (column)=>`Map ${column} role`, - labelHistoryUnMapColumn: (column)=>`Unmap ${column} role`, - labelHistoryReviveSnapshot: 'Revive snapshot', - labelHistoryColorBin: 'Change color binning', - labelHistoryDirectColor: 'Change direct color', - labelRenderer: 'Renderer quality', - labelRendererAdvancedDisabled: 'Renderer quality (Enhanced 3D mode not supported on this device)', - labelRendererBasic: 'Standard mode', - labelRendererAdvanced: 'Enhanced 3D mode', - labelRendererOptions: 'Renderer options ...', - labelRendererOptionsDialogTitle: 'Renderer options', - labelRendererOptionsAntialias: 'Antialias', - labelRendererOptionsBloom: 'Bloom highlighting (for selections)', - labelRendererOptionsBloomIntensity: 'Intensity', - labelRendererOptionsDof: 'Depth of Field', - labelRendererOptionsDofRange: 'Focus Range', - labelRendererOptionsFxaa: 'Antialias', - labelRendererOptionsShadow: 'Shadows', - labelRendererOptionsSsao: 'Screen Space Ambient Occlusion', - labelShowLegend: 'Show legend', - labelShowAxes: 'Show axes', - labelSnapshotTitle: 'Title', - labelSnapshotDescription: 'Note (optional)', - labelTooltipMapping: 'Tooltip columns', - labelTransition: 'Transition', - labelTransitionOptions: 'Transition options', - labelTransitionScrubber: 'Scrub transition', - labelTransitionStaggerBy: 'Stagger by', - labelTransitionStaggerByOrdinal: 'Data order', - labelTransitionStaggerByColumn: 'Column', - labelTransitionStaggerByPosition: 'Axis position', - labelTransitionStaggerOptions: 'Stagger options', - labelTransitionStaggerReverse: 'Reverse', - labelTransitionDurations: 'Transition durations', - labelTransitionCamera: '2D / 3D view', - labelTransitionDuration: 'Duration', - labelTransitionStagger: 'Stagger', - labelVegaSpecData: 'Data reference', - labelVegaSpecNotes: 'Note: You may need to change the color scheme to make this visible in Vega.', - labelYes: 'Yes', - labelNo: 'No', - labelConfirmation: 'Are you sure?', - labelColumnTypes: 'Column types', - loading: 'Loading...', - schemeCategorical: 'Categorical', - schemeCyclical: 'Cyclical', - schemeDiverging: 'Diverging', - schemeDual: 'Dual', - schemeSequentialMultiHue: 'Sequential Multi Hue', - schemeSequentialMultiHueDark: 'For dark backgrounds', - schemeSequentialMultiHueLight: 'For light backgrounds', - schemeSequentialSingleHue: 'Sequential Single Hue', - selectDataSpanAll: 'All rows', - selectDataSpanFilter: 'Filtered', - selectDataSpanSelection: 'Selected', - selectVegaSpecDataNone: 'None', - selectVegaSpecDataInline: 'Inline - WARNING this may use substantial browser/clipboard memory for large data sets.', - selectVegaSpecDataUrl: 'URL', - record: (current, total)=>`${current} of ${total}`, - searchEQ: '=', - searchNEQ: '<>', - searchGT: '>', - searchGTE: '>=', - searchLT: '<', - searchLTE: '<=', - searchNULL: 'is null or empty', - searchIN: 'contains', - searchSW: 'starts with', - searchWHERE: 'Where', - searchAND: 'and', - searchOR: 'or', - selectAny: '-- any --', - selectNone: '-- none --', - selectNumeric: 'Numeric', - selectNonNumeric: 'Categorical', - selectDirectColor: 'Direct color', - selectReference: 'Column mappings', - tooltipSearch: (column, value)=>`Click to search in '${column}' for "${value}"`, - labelRequired: 'required', - labelSystem: 'System', - labelViewType2d: 'View in 2D', - labelViewType3d: 'View in 3D', - labelDataColors: 'Enabled if this data column contains any CSS color values.', - labelDataNullAll: 'Loading data...', - labelDataNullFiltered: 'You can filter by first making a selection, then choosing <b>Isolate</b> or <b>Exclude</b> in the top bar.', - labelDataNullSelection: 'You can select by: <ul><li>clicking the chart axes</li><li>clicking in the legend</li><li>searching</li</ul>', - labelZeroAll: 'Dataset contains zero rows.', - labelZeroSearchResults: 'No rows matched your search.', + labelFacetLayoutCross: "⊞", + labelColumnFacetV: "Cross facet by", + labelColumnSort: "Sort by", + labelColumnX: "X Axis", + labelColumnY: "Y Axis", + labelColumnZ: "Z Axis", + labelColumnSize: "Size by", + labelColumnGroup: "Group by", + labelAliasColor: "Color", + labelAliasFacet: "Facet", + labelAliasFacetV: "Vertical facet", + labelAliasSort: "Sort", + labelAliasX: "X Axis", + labelAliasY: "Y Axis", + labelAliasZ: "Z Axis", + labelAliasSize: "Size", + labelAliasGroup: "Group", + labelDataItemIsFiltered: "Item is filtered from view", + labelHistoryInit: "Initial view", + labelHistoryFilterClear: "Clear filter", + labelHistoryFilterIExclude: "Exclude filter", + labelHistoryFilterIsolate: "Isolate filter", + labelHistoryChangeChartType: (chart) => `Change chart type to ${chart}`, + labelHistoryMapColumn: (column) => `Map ${column} role`, + labelHistoryUnMapColumn: (column) => `Unmap ${column} role`, + labelHistoryReviveSnapshot: "Revive snapshot", + labelHistoryColorBin: "Change color binning", + labelHistoryDirectColor: "Change direct color", + labelRenderer: "Renderer quality", + labelRendererAdvancedDisabled: "Renderer quality (Enhanced 3D mode not supported on this device)", + labelRendererBasic: "Standard mode", + labelRendererAdvanced: "Enhanced 3D mode", + labelRendererOptions: "Renderer options ...", + labelRendererOptionsDialogTitle: "Renderer options", + labelRendererOptionsAntialias: "Antialias", + labelRendererOptionsBloom: "Bloom highlighting (for selections)", + labelRendererOptionsBloomIntensity: "Intensity", + labelRendererOptionsDof: "Depth of Field", + labelRendererOptionsDofRange: "Focus Range", + labelRendererOptionsFxaa: "Antialias", + labelRendererOptionsShadow: "Shadows", + labelRendererOptionsSsao: "Screen Space Ambient Occlusion", + labelShowLegend: "Show legend", + labelShowAxes: "Show axes", + labelSnapshotTitle: "Title", + labelSnapshotDescription: "Note (optional)", + labelTooltipMapping: "Tooltip columns", + labelTransition: "Transition", + labelTransitionOptions: "Transition options", + labelTransitionScrubber: "Scrub transition", + labelTransitionStaggerBy: "Stagger by", + labelTransitionStaggerByOrdinal: "Data order", + labelTransitionStaggerByColumn: "Column", + labelTransitionStaggerByPosition: "Axis position", + labelTransitionStaggerOptions: "Stagger options", + labelTransitionStaggerReverse: "Reverse", + labelTransitionDurations: "Transition durations", + labelTransitionCamera: "2D / 3D view", + labelTransitionDuration: "Duration", + labelTransitionStagger: "Stagger", + labelVegaSpecData: "Data reference", + labelVegaSpecNotes: "Note: You may need to change the color scheme to make this visible in Vega.", + labelYes: "Yes", + labelNo: "No", + labelConfirmation: "Are you sure?", + labelColumnTypes: "Column types", + loading: "Loading...", + schemeCategorical: "Categorical", + schemeCyclical: "Cyclical", + schemeDiverging: "Diverging", + schemeDual: "Dual", + schemeSequentialMultiHue: "Sequential Multi Hue", + schemeSequentialMultiHueDark: "For dark backgrounds", + schemeSequentialMultiHueLight: "For light backgrounds", + schemeSequentialSingleHue: "Sequential Single Hue", + selectDataSpanAll: "All rows", + selectDataSpanFilter: "Filtered", + selectDataSpanSelection: "Selected", + selectVegaSpecDataNone: "None", + selectVegaSpecDataInline: "Inline - WARNING this may use substantial browser/clipboard memory for large data sets.", + selectVegaSpecDataUrl: "URL", + record: (current, total) => `${current} of ${total}`, + searchEQ: "=", + searchNEQ: "<>", + searchGT: ">", + searchGTE: ">=", + searchLT: "<", + searchLTE: "<=", + searchNULL: "is null or empty", + searchIN: "contains", + searchSW: "starts with", + searchWHERE: "Where", + searchAND: "and", + searchOR: "or", + selectAny: "-- any --", + selectNone: "-- none --", + selectNumeric: "Numeric", + selectNonNumeric: "Categorical", + selectDirectColor: "Direct color", + selectReference: "Column mappings", + tooltipSearch: (column, value2) => `Click to search in '${column}' for "${value2}"`, + labelRequired: "required", + labelSystem: "System", + labelViewType2d: "View in 2D", + labelViewType3d: "View in 3D", + labelDataColors: "Enabled if this data column contains any CSS color values.", + labelDataNullAll: "Loading data...", + labelDataNullFiltered: "You can filter by first making a selection, then choosing <b>Isolate</b> or <b>Exclude</b> in the top bar.", + labelDataNullSelection: "You can select by: <ul><li>clicking the chart axes</li><li>clicking in the legend</li><li>searching</li</ul>", + labelZeroAll: "Dataset contains zero rows.", + labelZeroSearchResults: "No rows matched your search.", signalGroups: [ - { - prefix: 'Chart', - label: 'Chart options' - }, - { - prefix: 'Mark', - label: 'Mark options' - }, - { - prefix: 'RoleColor', - label: 'Color options' - }, - { - prefix: 'RoleFacet', - label: 'Facet options' - }, - { - prefix: 'RoleSort', - label: 'Sort options' - }, - { - prefix: 'RoleX', - label: 'X axis options' - }, - { - prefix: 'RoleY', - label: 'Y axis options' - }, - { - prefix: 'RoleZ', - label: 'Z axis options' - }, - { - prefix: 'Text', - label: 'Text options' - }, - { - prefix: '*', - label: 'Options' - } + { prefix: "Chart", label: "Chart options" }, + { prefix: "Mark", label: "Mark options" }, + { prefix: "RoleColor", label: "Color options" }, + { prefix: "RoleFacet", label: "Facet options" }, + { prefix: "RoleSort", label: "Sort options" }, + { prefix: "RoleX", label: "X axis options" }, + { prefix: "RoleY", label: "Y axis options" }, + { prefix: "RoleZ", label: "Z axis options" }, + { prefix: "Text", label: "Text options" }, + { prefix: "*", label: "Options" } ], - percentValueFormat: (value)=>`${value}%` -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6pZiK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconButton", ()=>IconButton); -var _base = require("../base"); -function IconButton(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.IconButton, Object.assign({}, props, { - styles: props.styles || { - root: { - color: props.themePalette.black - }, - rootHovered: { - background: 'transparent', - color: props.themePalette.themePrimary - }, - rootPressed: { - background: 'transparent' - }, - menuIcon: { - display: 'none' - } - }, - iconProps: { - iconName: props.iconName + percentValueFormat: (value2) => `${value2}%` + }; + function IconButton$1(props) { + return base$1.react.createElement(base$1.fluentUI.IconButton, Object.assign({}, props, { styles: props.styles || { + root: { + color: props.themePalette.black + }, + rootHovered: { + background: "transparent", + color: props.themePalette.themePrimary + }, + rootPressed: { + background: "transparent" + }, + menuIcon: { + display: "none" + } + }, iconProps: { iconName: props.iconName }, menuProps: props.menuProps })); + } + const maxCategoricalColors = 20; + function defaultColorScheme$1(c2) { + if (c2.quantitative) { + return "redyellowgreen"; + } else if (c2.stats.distinctValueCount === 2) { + return "dual_redgreen"; + } else if (c2.stats.distinctValueCount <= 10) { + return "category10"; + } + return "category20"; + } + const maxDistinctVal = 20; + const minDistinctVal = 2; + class BarChartRecommenderSummary { + constructor(columns, data2) { + let score2 = -1; + for (let i = 0; i < columns.length; i++) { + const recommendation = new BarChartRecommender(columns[i], data2).recommend(); + if (recommendation.score > score2) { + this.best = recommendation; + score2 = recommendation.score; + } + if (score2 === 1) + break; + } + for (let k = 0; k < columns.length; k++) { + const column = columns[k]; + if (column.name === this.best.columns.x || column.stats.isSequential) + continue; + if (column.quantitative || column.stats.distinctValueCount < maxCategoricalColors && column.stats.distinctValueCount > 1) { + this.best.columns.color = this.best.columns.sort = column.name; + this.best.scheme = defaultColorScheme$1(column); + if (column.quantitative) { + this.best.colorBin = "quantile"; + } + break; + } + } + } + recommend() { + return this.best; + } + } + class BarChartRecommender { + constructor(column, data2) { + this.score = 0; + this.column = column; + this.rules = [ + (column2) => { + if (column2.stats.isSequential) + return false; + else if (column2.quantitative) { + return true; + } else if (!column2.quantitative && column2.stats.distinctValueCount <= maxDistinctVal && column2.stats.distinctValueCount >= minDistinctVal) { + return true; + } else { + return false; + } + } + ]; + for (let i = 0; i < this.rules.length; i++) { + if (this.rules[i](column)) + this.score++; + } + } + recommend() { + const rec = { + chart: "barchart", + columns: { + x: this.column.name }, - menuProps: props.menuProps - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7ZE4v":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ensureColumnsExist", ()=>ensureColumnsExist); -parcelHelpers.export(exports, "ensureColumnsPopulated", ()=>ensureColumnsPopulated); -parcelHelpers.export(exports, "getTreemapColumn", ()=>getTreemapColumn); -parcelHelpers.export(exports, "colorMapping", ()=>colorMapping); -parcelHelpers.export(exports, "getBackgroundImageColumnBounds", ()=>getBackgroundImageColumnBounds); -var _chartRecommender = require("@msrvida/chart-recommender"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("./language"); -function ensureColumnsExist(insightColumns, actualColumns, transform) { - //ensure columns exist - for(const role in insightColumns){ - const columnName = insightColumns[role]; - const column = actualColumns.filter((c)=>c.name === columnName)[0]; - const transformColumn = transform ? transform.filter((t)=>{ - switch(t.type){ - case 'formula': - return t.as === columnName; + score: this.score, + scheme: void 0, + view: "2d" + }; + return rec; + } + } + const longitudeNames = ["lon", "long", "longitude"]; + const latitudeNames = ["lat", "latitude"]; + function isSpec(names, limits, column, data2) { + let is = false; + const cname = column.name.toLowerCase(); + for (let i = 0; i < names.length; i++) { + if (names[i] === cname) { + is = true; + break; + } + } + return is; + } + function isLongitude(column, data2) { + return isSpec(longitudeNames, [-180, 180], column); + } + function isLatitude(column, data2) { + return isSpec(latitudeNames, [-90, 90], column); + } + function isGeo(column, data2) { + return isLatitude(column) || isLongitude(column); + } + class ScatterPlotRecommenderSummary { + constructor(columns, data2) { + const rec = { + chart: "scatterplot", + score: void 0, + columns: {}, + scheme: void 0, + view: "2d" + }; + columns.forEach((column) => { + if (!rec.columns.x) { + if (column.name.toLowerCase() === "x") { + return rec.columns.x = column.name; + } else if (isLongitude(column)) { + return rec.columns.x = column.name; + } + } + if (!rec.columns.y) { + if (column.name.toLowerCase() === "y") { + return rec.columns.y = column.name; + } else if (isLatitude(column)) { + return rec.columns.y = column.name; + } + } + if (!rec.columns.color && !column.stats.isSequential) { + if (column.quantitative || column.stats.distinctValueCount < maxCategoricalColors) { + rec.columns.color = rec.columns.sort = column.name; + rec.scheme = defaultColorScheme$1(column); + if (column.quantitative) { + rec.colorBin = "quantile"; } - })[0] : null; - if (!(column || transformColumn)) delete insightColumns[role]; + return; + } + } + }); + if (rec.columns.x && rec.columns.y) { + this.best = rec; + } + } + recommend() { + return this.best; + } + } + function preferredColumnForTreemapSize(columns, strict) { + for (let i = 0; i < columns.length; i++) { + const c2 = columns[i]; + if (c2.quantitative) { + if (strict && c2.stats.hasNegative) + continue; + if (strict && c2.stats.isSequential) + continue; + if (strict && isGeo(c2)) + continue; + return c2; + } + } + } + class RecommenderSummary { + constructor(columns, data2) { + const quickRec = new ScatterPlotRecommenderSummary(columns, data2).recommend(); + if (quickRec) { + this.rec = quickRec; + } else { + const barChartrec = new BarChartRecommenderSummary(columns, data2).recommend(); + if (barChartrec && barChartrec.score >= 1) { + this.rec = barChartrec; + } else { + this.rec = { + chart: "grid", + columns: {}, + score: 1 + }; + } + } + } + recommend() { + return this.rec; + } + } + function ensureColumnsExist(insightColumns, actualColumns, transform2) { + for (const role in insightColumns) { + const columnName = insightColumns[role]; + const column = actualColumns.filter((c2) => c2.name === columnName)[0]; + const transformColumn = transform2 ? transform2.filter((t) => { + switch (t.type) { + case "formula": { + return t.as === columnName; + } + } + })[0] : null; + if (!(column || transformColumn)) { + delete insightColumns[role]; + } } -} -function ensureColumnsPopulated(chart, totalStyle, insightColumns, actualColumns) { - //ensure columns are populated - const nonInternal = actualColumns.filter((c)=>!(0, _sanddanceReact.SandDance).util.isInternalFieldName(c.name)); + } + function ensureColumnsPopulated(chart, totalStyle, insightColumns, actualColumns) { + const nonInternal = actualColumns.filter((c2) => !isInternalFieldName(c2.name)); const firstColumn = nonInternal[0]; const firstColumnName = firstColumn && firstColumn.name; - const firstQuantitative = nonInternal.filter((c)=>c.quantitative)[0]; + const firstQuantitative = nonInternal.filter((c2) => c2.quantitative)[0]; const firstQuantitativeColumnName = firstQuantitative && firstQuantitative.name; - const ensureColumn = (role, quantitative, treemap)=>{ - if (!insightColumns[role]) { - if (treemap) insightColumns[role] = getTreemapColumn(actualColumns).name; - else insightColumns[role] = quantitative ? firstQuantitativeColumnName : firstColumnName; + const ensureColumn = (role, quantitative, treemap2) => { + if (!insightColumns[role]) { + if (treemap2) { + insightColumns[role] = getTreemapColumn(actualColumns).name; + } else { + insightColumns[role] = quantitative ? firstQuantitativeColumnName : firstColumnName; } + } }; function checkRequiresSize() { - switch(totalStyle){ - case 'sum-strip': - case 'sum-strip-percent': - ensureColumn('size', true); - break; - case 'sum-treemap': - ensureColumn('size', true, true); - break; - } - } - switch(chart){ - case 'barchart': - case 'barchartV': - ensureColumn('x'); - checkRequiresSize(); - break; - case 'barchartH': - ensureColumn('y'); - checkRequiresSize(); - break; - case 'density': - ensureColumn('x'); - ensureColumn('y'); - checkRequiresSize(); - break; - case 'scatterplot': - case 'stacks': - ensureColumn('x'); - ensureColumn('y'); - break; - case 'treemap': - if (!insightColumns.size) insightColumns.size = getTreemapColumn(actualColumns).name; - if (!insightColumns.size) //error - no numeric column - return [ - (0, _language.strings).errorColumnMustBeNumeric - ]; - break; + switch (totalStyle) { + case "sum-strip": + case "sum-strip-percent": + ensureColumn("size", true); + break; + case "sum-treemap": + ensureColumn("size", true, true); + break; + } } -} -function getTreemapColumn(columns) { - let column = (0, _chartRecommender.preferredColumnForTreemapSize)(columns, true); - if (!column) column = (0, _chartRecommender.preferredColumnForTreemapSize)(columns, false); - return column; -} -function colorMapping(insight, columns) { - if (columns && insight.columns && insight.columns.color) return columns.filter((c)=>c.name === insight.columns.color)[0]; -} -function getBackgroundImageColumnBounds(columns) { - const bounds = []; - const getBound = (dimension, dataExtent, column)=>{ - const { stats } = column; - const numericValue = dataExtent === 'max' ? stats.max : stats.min; - return { - columnName: column.name, - dimension, - valid: true, - dataExtent, - numericValue, - stringValue: numericValue.toString() - }; - }; - const dataExtents = [ - 'max', - 'min' - ]; - const dimensions = [ - 'x', - 'y' - ]; - columns.forEach((c)=>{ - if (c.quantitative) dimensions.forEach((dimension)=>dataExtents.forEach((dataExtent)=>bounds.push(getBound(dimension, dataExtent, c)))); - }); - return bounds; -} - -},{"@msrvida/chart-recommender":"isTvp","@msrvida/sanddance-react":"lPyTZ","./language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"isTvp":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = { - enumerable: true, - get: function() { - return m[k]; - } - }; - Object.defineProperty(o, k2, desc); -} : function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); -var __exportStar = this && this.__exportStar || function(m, exports1) { - for(var p in m)if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports1, p)) __createBinding(exports1, m, p); -}; -Object.defineProperty(exports, "__esModule", { - value: true -}); -__exportStar(require("43b13d552e7a85bc"), exports); -__exportStar(require("3bedc68f1cc8f2e4"), exports); -__exportStar(require("ff78bff758b84686"), exports); -__exportStar(require("c80f1af882b7a9bb"), exports); -__exportStar(require("d8855069a6fbb589"), exports); - -},{"43b13d552e7a85bc":"dW3JE","3bedc68f1cc8f2e4":"h5UzG","ff78bff758b84686":"f7ySk","c80f1af882b7a9bb":"elfOE","d8855069a6fbb589":"fBxhA"}],"dW3JE":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BarChartRecommender = exports.BarChartRecommenderSummary = void 0; -var recommender_1 = require("ab394df5de988f3a"); -var maxDistinctVal = 20; -var minDistinctVal = 2; -var BarChartRecommenderSummary = /** @class */ function() { - function BarChartRecommenderSummary(columns, data) { - var score = -1; - for(var i = 0; i < columns.length; i++){ - var recommendation = new BarChartRecommender(columns[i], data).recommend(); - if (recommendation.score > score) { - this.best = recommendation; - score = recommendation.score; - } - if (score === 1) break; - } - for(var k = 0; k < columns.length; k++){ - var column = columns[k]; - if (column.name === this.best.columns.x || column.stats.isSequential) continue; - if (column.quantitative || column.stats.distinctValueCount < recommender_1.maxCategoricalColors && column.stats.distinctValueCount > 1) { - this.best.columns.color = this.best.columns.sort = column.name; - this.best.scheme = (0, recommender_1.defaultColorScheme)(column); - if (column.quantitative) this.best.colorBin = 'quantile'; - break; - } + switch (chart) { + case "barchart": + case "barchartV": + ensureColumn("x"); + checkRequiresSize(); + break; + case "barchartH": + ensureColumn("y"); + checkRequiresSize(); + break; + case "density": + ensureColumn("x"); + ensureColumn("y"); + checkRequiresSize(); + break; + case "scatterplot": + case "stacks": + ensureColumn("x"); + ensureColumn("y"); + break; + case "treemap": + if (!insightColumns.size) { + insightColumns.size = getTreemapColumn(actualColumns).name; } + if (!insightColumns.size) { + return [strings$1.errorColumnMustBeNumeric]; + } + break; } - BarChartRecommenderSummary.prototype.recommend = function() { - return this.best; - }; - return BarChartRecommenderSummary; -}(); -exports.BarChartRecommenderSummary = BarChartRecommenderSummary; -var BarChartRecommender = /** @class */ function() { - function BarChartRecommender(column, data) { - this.score = 0; - this.column = column; - //the total score for bar chart is 1 - this.rules = [ - function(column) { - if (column.stats.isSequential) return false; - else if (column.quantitative) return true; - else if (!column.quantitative && column.stats.distinctValueCount <= maxDistinctVal && column.stats.distinctValueCount >= minDistinctVal) return true; - else return false; - } - ]; - for(var i = 0; i < this.rules.length; i++)if (this.rules[i](column)) this.score++; + } + function getTreemapColumn(columns) { + let column = preferredColumnForTreemapSize(columns, true); + if (!column) { + column = preferredColumnForTreemapSize(columns, false); } - BarChartRecommender.prototype.recommend = function() { - var rec = { - chart: 'barchart', - columns: { - x: this.column.name - }, - score: this.score, - scheme: undefined, - view: '2d' - }; - return rec; - }; - return BarChartRecommender; -}(); -exports.BarChartRecommender = BarChartRecommender; - -},{"ab394df5de988f3a":"fhBxd"}],"fhBxd":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Recommender = exports.maxCategoricalColors = void 0; -exports.defaultColorScheme = defaultColorScheme; -exports.maxCategoricalColors = 20; -var Recommender = /** @class */ function() { - function Recommender(columns, data) {} - return Recommender; -}(); -exports.Recommender = Recommender; -function defaultColorScheme(c) { - if (c.quantitative) return 'redyellowgreen'; - else if (c.stats.distinctValueCount === 2) return 'dual_redgreen'; - else if (c.stats.distinctValueCount <= 10) return 'category10'; - return 'category20'; -} - -},{}],"h5UzG":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isLongitude = isLongitude; -exports.isLatitude = isLatitude; -exports.isGeo = isGeo; -//TODO: languages other than english -var longitudeNames = [ - 'lon', - 'long', - 'longitude' -]; -var latitudeNames = [ - 'lat', - 'latitude' -]; -function isSpec(names, limits, column, data) { - var is = false; - var cname = column.name.toLowerCase(); - for(var i = 0; i < names.length; i++)if (names[i] === cname) { - is = true; - break; + return column; + } + function colorMapping(insight, columns) { + if (columns && insight.columns && insight.columns.color) { + return columns.filter((c2) => c2.name === insight.columns.color)[0]; } - data; - return is; -} -function isLongitude(column, data) { - return isSpec(longitudeNames, [ - -180, - 180 - ], column, data); -} -function isLatitude(column, data) { - return isSpec(latitudeNames, [ - -90, - 90 - ], column, data); -} -function isGeo(column, data) { - return isLatitude(column, data) || isLongitude(column, data); -} - -},{}],"f7ySk":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ScatterPlotRecommenderSummary = void 0; -var recommender_1 = require("cdb513d2718963f"); -var geo_1 = require("fccf598d2708866c"); -var ScatterPlotRecommenderSummary = /** @class */ function() { - function ScatterPlotRecommenderSummary(columns, data) { - var rec = { - chart: 'scatterplot', - score: undefined, - columns: {}, - scheme: undefined, - view: '2d' + } + function getBackgroundImageColumnBounds(columns) { + const bounds2 = []; + const getBound = (dimension, dataExtent2, column) => { + const { stats } = column; + const numericValue = dataExtent2 === "max" ? stats.max : stats.min; + return { + columnName: column.name, + dimension, + valid: true, + dataExtent: dataExtent2, + numericValue, + stringValue: numericValue.toString() + }; + }; + const dataExtents = ["max", "min"]; + const dimensions = ["x", "y"]; + columns.forEach((c2) => { + if (c2.quantitative) { + dimensions.forEach((dimension) => dataExtents.forEach((dataExtent2) => bounds2.push(getBound(dimension, dataExtent2, c2)))); + } + }); + return bounds2; + } + function _BackgroundImageEditor(_props) { + class __BackgroundImageEditor extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + backgroundImageColumnBounds: [], + readyToApply: false, + hidden: true }; - columns.forEach(function(column) { - if (!rec.columns.x) { - if (column.name.toLowerCase() === 'x') return rec.columns.x = column.name; - else if ((0, geo_1.isLongitude)(column)) return rec.columns.x = column.name; - } - if (!rec.columns.y) { - if (column.name.toLowerCase() === 'y') return rec.columns.y = column.name; - else if ((0, geo_1.isLatitude)(column)) return rec.columns.y = column.name; - } - if (!rec.columns.color && !column.stats.isSequential) { - if (column.quantitative || column.stats.distinctValueCount < recommender_1.maxCategoricalColors) { - rec.columns.color = rec.columns.sort = column.name; - rec.scheme = (0, recommender_1.defaultColorScheme)(column); - if (column.quantitative) rec.colorBin = 'quantile'; - return; - } - } - }); - if (rec.columns.x && rec.columns.y) this.best = rec; - } - ScatterPlotRecommenderSummary.prototype.recommend = function() { - return this.best; - }; - return ScatterPlotRecommenderSummary; -}(); -exports.ScatterPlotRecommenderSummary = ScatterPlotRecommenderSummary; - -},{"cdb513d2718963f":"fhBxd","fccf598d2708866c":"h5UzG"}],"elfOE":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.preferredColumnForTreemapSize = preferredColumnForTreemapSize; -var geo_1 = require("fcabcca7cde34752"); -function preferredColumnForTreemapSize(columns, strict) { - for(var i = 0; i < columns.length; i++){ - var c = columns[i]; - if (c.quantitative) { - if (strict && c.stats.hasNegative) continue; - if (strict && c.stats.isSequential) continue; - if (strict && (0, geo_1.isGeo)(c)) continue; - return c; - } - } -} - -},{"fcabcca7cde34752":"h5UzG"}],"fBxhA":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.RecommenderSummary = void 0; -var barChart_1 = require("6385848df3350969"); -var scatterPlot_1 = require("800b6a0446d1d219"); -var RecommenderSummary = /** @class */ function() { - function RecommenderSummary(columns, data) { - var quickRec = new scatterPlot_1.ScatterPlotRecommenderSummary(columns, data).recommend(); - if (quickRec) this.rec = quickRec; - else { - var barChartrec = new barChart_1.BarChartRecommenderSummary(columns, data).recommend(); - if (barChartrec && barChartrec.score >= 1) this.rec = barChartrec; - else this.rec = { - chart: 'grid', - columns: {}, - score: 1 - }; + } + show(insightColumns) { + const { explorer: explorer2, quantitativeColumns } = this.props; + if (!quantitativeColumns.length) { + return; + } + const xCol = quantitativeColumns.filter((c2) => c2.name === insightColumns.x)[0]; + const yCol = quantitativeColumns.filter((c2) => c2.name === insightColumns.y)[0]; + let backgroundImageColumnBounds; + if (explorer2.imageHolder.backgroundImageColumnBounds.length < quantitativeColumns.length * 4) { + backgroundImageColumnBounds = getBackgroundImageColumnBounds(explorer2.state.dataContent.columns); + } else { + backgroundImageColumnBounds = clone(explorer2.imageHolder.backgroundImageColumnBounds); } - } - RecommenderSummary.prototype.recommend = function() { - return this.rec; - }; - return RecommenderSummary; -}(); -exports.RecommenderSummary = RecommenderSummary; - -},{"6385848df3350969":"dW3JE","800b6a0446d1d219":"f7ySk"}],"2iqEH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "attachSpecRoleToAxisTitle", ()=>attachSpecRoleToAxisTitle); -parcelHelpers.export(exports, "PositionedColumnMap", ()=>PositionedColumnMap); -var _base = require("./base"); -var _columnMap = require("./controls/columnMap"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function attachSpecRoleToAxisTitle(stage, specCapabilities) { - for(const axisName in stage.axes)specCapabilities.roles.forEach((specRole)=>{ - if (specRole.role === axisName) { - const axes = stage.axes[axisName]; - axes.forEach((axis)=>{ - if (axis.title) { - const textItem = axis.title; - textItem.specRole = specRole; + const newState = { hidden: false, xCol, yCol, backgroundImageColumnBounds }; + this.setState(newState); + this.checkReady(); + } + render() { + const { props, state } = this; + const { explorer: explorer2 } = props; + return base$1.react.createElement( + Dialog$1, + { hidden: state.hidden, onDismiss: () => this.setState({ hidden: true, backgroundImageFileFormatError: null }), modalProps: { + containerClassName: "sanddance-background-image-dialog" + }, dialogContentProps: { + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelBackgroundImageDialogTitle, + subText: strings$1.labelBackgroundImageSubtext + }, buttons: [ + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: "apply", iconProps: { iconName: "Photo2Add" }, text: strings$1.buttonApply, onClick: () => this.applyImage(true), disabled: !state.readyToApply }) + ] }, + explorer2.imageHolder.img ? base$1.react.createElement( + "div", + { className: "thumbnail" }, + base$1.react.createElement("img", { src: explorer2.imageHolder.img.src }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "remove", iconProps: { iconName: "Photo2Remove" }, text: strings$1.buttonRemove, onClick: () => { + explorer2.imageHolder.img = null; + this.applyImage(false); + this.setState({ readyToApply: false }); + } }) + ) : base$1.react.createElement( + "div", + { className: "thumbnail" }, + base$1.react.createElement("input", { type: "file", onChange: (e) => this.readBackgroundImage(e) }), + state.backgroundImageFileFormatError && base$1.react.createElement("div", { className: "error" }, state.backgroundImageFileFormatError) + ), + this.inputForColumn(state.xCol, "X axis", "x", strings$1.labelBackgroundLeft, strings$1.labelBackgroundRight), + this.inputForColumn(state.yCol, "Y axis", "y", strings$1.labelBackgroundBottom, strings$1.labelBackgroundTop) + ); + } + inputForColumn(column, label2, dimension, minLabel, maxLabel) { + const { props, state } = this; + const fieldInput = (label3, dataExtent2, getDefault) => { + const bounds2 = state.backgroundImageColumnBounds.filter((b2) => b2.columnName === (column === null || column === void 0 ? void 0 : column.name) && b2.dimension === dimension && b2.dataExtent === dataExtent2)[0]; + if (!bounds2) { + return null; + } + return base$1.react.createElement( + "div", + { className: "axis-bound-field" }, + base$1.react.createElement(base$1.fluentUI.TextField, { label: label3, onChange: (e, value2) => { + const numericValue = +value2; + bounds2.stringValue = value2; + bounds2.valid = !(!value2 || isNaN(numericValue)); + if (bounds2.valid) { + bounds2.numericValue = numericValue; + } + this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); + this.checkReady(); + }, value: bounds2.stringValue, errorMessage: bounds2.valid ? null : strings$1.errorNumericValue, onRenderSuffix: (a2) => { + return base$1.react.createElement(IconButton$1, { + iconName: "ScaleVolume", + themePalette: props.themePalette, + title: "Use data extent", + onClick: () => { + bounds2.numericValue = getDefault(); + bounds2.stringValue = bounds2.numericValue.toString(); + bounds2.valid = true; + this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); + this.checkReady(); } - }); - } - }); -} -function px(n) { - return n + 'px'; -} -function _PositionedColumnMap(_props) { - class __PositionedColumnMap extends (0, _base.base).react.Component { - constructor(props){ - super(props); - const { left, top } = props; - this.state = { - left, - top + }); + } }) + ); + }; + return base$1.react.createElement( + "div", + { className: "axis-bounds" }, + base$1.react.createElement(base$1.fluentUI.Dropdown, { label: label2, options: props.quantitativeColumns.map((c2) => { + const option = { + key: c2.name, + text: c2.name }; - this.dropdownRef = (0, _base.base).react.createRef(); - } - focus() { - if (!this.focused) { - this.focused = true; - this.dropdownRef.current.focus(true); + return option; + }), onChange: (e, o) => { + const newState = { readyToApply: false }; + const newColumn = props.quantitativeColumns.filter((c2) => c2.name === o.key)[0]; + switch (dimension) { + case "x": { + newState.xCol = newColumn; + break; + } + case "y": { + newState.yCol = newColumn; + break; + } } - } - componentDidMount() { - const size = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.outerSize(this.div); - const over = { - left: Math.max(0, this.state.left + size.width - this.props.container.offsetWidth), - top: Math.max(0, this.state.top + size.height - this.props.container.offsetHeight) + this.setState(newState); + this.checkReady(); + }, selectedKey: column === null || column === void 0 ? void 0 : column.name }), + base$1.react.createElement( + "div", + { className: "axis-bound-fields" }, + fieldInput(minLabel, "min", () => column.stats.min), + fieldInput(maxLabel, "max", () => column.stats.max) + ) + ); + } + readBackgroundImage(e) { + if (e.target.files) { + const file = e.target.files[0]; + const reader = new FileReader(); + reader.onload = () => { + const img = new Image(); + img.onerror = () => { + this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); }; - if (over.left || over.top) { - let { left, top } = this.state; - left -= over.left; - top -= over.top; - this.setState({ - left, - top - }); - } else this.focus(); + img.onload = () => { + const { src, height: height2, width: width2 } = img; + this.props.explorer.imageHolder.img = { src, height: height2, width: width2 }; + this.checkReady(); + }; + try { + img.src = reader.result; + } catch (e3) { + this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); + } + }; + reader.readAsDataURL(file); } - componentDidUpdate() { - this.focus(); + } + checkReady() { + setTimeout(() => { + const { state, props } = this; + const { explorer: explorer2 } = props; + const { backgroundImageColumnBounds } = state; + let valid = true; + const dimensions = ["x", "y"]; + const dataExtents = ["max", "min"]; + [state.xCol, state.yCol].forEach((c2) => dimensions.forEach((dimension) => dataExtents.forEach((dataExtent2) => { + const bounds2 = backgroundImageColumnBounds.filter((b2) => b2.columnName === c2.name && b2.dataExtent === dataExtent2 && b2.dimension === dimension)[0]; + if (!bounds2.valid) { + valid = false; + } + }))); + const readyToApply = explorer2.imageHolder.img && valid; + this.setState({ readyToApply }); + }, 0); + } + applyImage(showBackgroundImage) { + const { props, state } = this; + const { explorer: explorer2 } = props; + explorer2.imageHolder.showBackgroundImage = showBackgroundImage; + explorer2.imageHolder.backgroundImageColumnBounds = clone(state.backgroundImageColumnBounds); + if (showBackgroundImage) { + switch (props.chart) { + case "density": + case "scatterplot": + case "stacks": { + break; + } + default: { + explorer2.changeChartType("scatterplot"); + return; + } + } } - render() { - return (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div) this.div = div; - }, - className: "sanddance-columnMap-absolute", - style: { - position: 'absolute', - left: px(this.state.left), - top: px(this.state.top) - } - }, (0, _base.base).react.createElement((0, _columnMap.ColumnMap), Object.assign({}, this.props, { - componentRef: this.dropdownRef, - hideSignals: true - }))); + explorer2.forceUpdate(); + } + } + return new __BackgroundImageEditor(_props); + } + const BackgroundImageEditor = _BackgroundImageEditor; + function setInsightBackgroundImage(insight, imageHolder, columns) { + if (!imageHolder.showBackgroundImage || !columns.x || !columns.y) { + return; + } + const { backgroundImageColumnBounds } = imageHolder; + const xBounds = backgroundImageColumnBounds.filter((b2) => b2.columnName === columns.x && b2.dimension === "x"); + const yBounds = backgroundImageColumnBounds.filter((b2) => b2.columnName === columns.y && b2.dimension === "y"); + if (!xBounds.length || !yBounds.length) { + return; + } + const allBounds = [...xBounds, ...yBounds]; + for (let i = 0; i < allBounds.length; i++) { + if (!allBounds[i].valid) { + return; + } + } + const bottom = yBounds.filter((b2) => b2.dataExtent === "min")[0]; + const left = xBounds.filter((b2) => b2.dataExtent === "min")[0]; + const right = xBounds.filter((b2) => b2.dataExtent === "max")[0]; + const top = yBounds.filter((b2) => b2.dataExtent === "max")[0]; + const all = [bottom, left, right, top]; + for (let i = 0; i < all.length; i++) { + if (!all[i]) { + return; + } + } + const { src, height: height2, width: width2 } = imageHolder.img; + insight.backgroundImage = { + url: src, + size: { height: height2, width: width2 }, + extents: { + bottom: bottom.numericValue, + left: left.numericValue, + right: right.numericValue, + top: top.numericValue + } + }; + insight.size = insight.backgroundImage.size; + } + const dropdownWidth = 200; + function Dropdown$1(props) { + const newProps = Object.assign({}, props); + let selectedKey = null; + if (newProps.options && newProps.options.length > 1) { + const selectedOptions = newProps.options.filter((option) => option.selected); + if (selectedOptions && selectedOptions.length > 0) { + selectedKey = selectedOptions[0].key; + } + } + if (newProps.collapseLabel) { + newProps.onRenderTitle = ((a2, b2) => { + return base$1.react.createElement( + "span", + null, + newProps.label, + ": ", + a2[0].text + ); + }); + } + return base$1.react.createElement(base$1.fluentUI.Dropdown, Object.assign({ dropdownWidth }, newProps, { label: newProps.collapseLabel ? null : newProps.label, selectedKey })); + } + function getInitialSignalValue(explorer2, signal) { + let initialValue; + try { + initialValue = explorer2.viewer.vegaViewGl.signal(signal.name); + } catch (error2) { + } + return initialValue; + } + function Signal(props) { + if (!props.explorer.viewer || !props.signal) { + return null; + } + if (props.signal.bind) { + const input = props.signal.bind.input; + if (input) { + const fn2 = map$2[input]; + if (fn2) { + const prefix = props.prefix ? `${props.prefix} ` : ""; + const control = fn2(prefix, props.signal.bind, props.initialValue, (value2) => { + props.onChange && props.onChange(value2); + props.explorer.signal(props.signal.name, value2, props.newViewStateTarget); + }, props.disabled, props.collapseLabel, props.componentRef); + return base$1.react.createElement("div", { className: "sanddance-signal" }, control); } + } } - return new __PositionedColumnMap(_props); -} -const PositionedColumnMap = _PositionedColumnMap; - -},{"./base":"3TPz5","./controls/columnMap":"8sojP","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8sojP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnMapOptions", ()=>getColumnMapOptions); -parcelHelpers.export(exports, "ColumnMap", ()=>ColumnMap); -var _base = require("../base"); -var _dropdown = require("./dropdown"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _signal = require("./signal"); -var _language = require("../language"); -const maxFacets = 50; -const roleLabels = { - color: (0, _language.strings).labelColumnColor, - facet: (0, _language.strings).labelColumnFacet, - facetV: (0, _language.strings).labelColumnFacetV, - group: (0, _language.strings).labelColumnGroup, - size: (0, _language.strings).labelColumnSize, - sort: (0, _language.strings).labelColumnSort, + return null; + } + const map$2 = {}; + map$2["range"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { + let debouncer; + return base$1.react.createElement(base$1.fluentUI.Slider, { componentRef: ref2, label: prefix + bind2.name, max: bind2.max, min: bind2.min, step: bind2.step, defaultValue: initialValue, onChange: (value2) => { + if (debouncer) { + clearTimeout(debouncer); + } + debouncer = setTimeout(() => onChange(value2), bind2.debounce || 0); + }, disabled }); + }; + map$2["select"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { + const options2 = bind2.options.map((o, i) => { + const option = { + key: o, + text: o + }; + return option; + }); + const label2 = prefix + bind2.name; + return base$1.react.createElement(base$1.fluentUI.Dropdown, { componentRef: ref2, onRenderTitle: collapseLabel ? ((a2, b2) => base$1.react.createElement( + "span", + null, + label2, + ": ", + a2[0].text + )) : void 0, defaultSelectedKey: initialValue, label: collapseLabel ? void 0 : label2, options: options2, onChange: (e, o) => onChange(o.text), disabled }); + }; + map$2["checkbox"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { + return base$1.react.createElement(base$1.fluentUI.Toggle, { componentRef: ref2, defaultChecked: initialValue, label: prefix + bind2.name, onChange: (e, checked) => onChange(checked), disabled }); + }; + const maxFacets = 50; + const roleLabels = { + color: strings$1.labelColumnColor, + facet: strings$1.labelColumnFacet, + facetV: strings$1.labelColumnFacetV, + group: strings$1.labelColumnGroup, + size: strings$1.labelColumnSize, + sort: strings$1.labelColumnSort, uid: null, - x: (0, _language.strings).labelColumnX, - y: (0, _language.strings).labelColumnY, - z: (0, _language.strings).labelColumnZ -}; -const aliasLabels = { - color: (0, _language.strings).labelAliasColor, - facet: (0, _language.strings).labelAliasFacet, - facetV: (0, _language.strings).labelAliasFacetV, - group: (0, _language.strings).labelAliasGroup, - size: (0, _language.strings).labelAliasSize, - sort: (0, _language.strings).labelAliasSort, + x: strings$1.labelColumnX, + y: strings$1.labelColumnY, + z: strings$1.labelColumnZ + }; + const aliasLabels = { + color: strings$1.labelAliasColor, + facet: strings$1.labelAliasFacet, + facetV: strings$1.labelAliasFacetV, + group: strings$1.labelAliasGroup, + size: strings$1.labelAliasSize, + sort: strings$1.labelAliasSort, uid: null, - x: (0, _language.strings).labelAliasX, - y: (0, _language.strings).labelAliasY, - z: (0, _language.strings).labelAliasZ -}; -function filterColumnList(context, columns) { - switch(context){ - case 'facet': - case 'facetV': - return columns.filter((column)=>column.quantitative || column.stats.distinctValueCount && column.stats.distinctValueCount < maxFacets); - default: - return columns.slice(); + x: strings$1.labelAliasX, + y: strings$1.labelAliasY, + z: strings$1.labelAliasZ + }; + function filterColumnList(context2, columns) { + switch (context2) { + case "facet": + case "facetV": + return columns.filter((column) => column.quantitative || column.stats.distinctValueCount && column.stats.distinctValueCount < maxFacets); + default: + return columns.slice(); } -} -function optionsForSpecColumn(sectionName, columns, role, disabledColumnName, selectedColumnName) { + } + function optionsForSpecColumn(sectionName, columns, role, disabledColumnName, selectedColumnName) { const filtered = filterColumnList(role, columns); - const options = filtered.map((column)=>{ - const option = { - key: `column:${column.name}`, - text: column.name, - data: column, - selected: selectedColumnName === column.name, - disabled: disabledColumnName === column.name - }; - return option; + const options2 = filtered.map((column) => { + const option = { + key: `column:${column.name}`, + text: column.name, + data: column, + selected: selectedColumnName === column.name, + disabled: disabledColumnName === column.name + }; + return option; }); - if (options.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; - options.unshift(option); - } - return options; -} -function optionsForReference(sectionName, specRoles) { - const options = specRoles.map((specRole)=>{ - const option = { - key: `role:${specRole.role}`, - text: aliasLabels[specRole.role], - data: specRole.role - }; - return option; - }).sort((a, b)=>a.text.localeCompare(b.text)); - if (options.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; - options.unshift(option); - } - return options; -} -function selectFirst(options) { - for(let i = 0; i < options.length; i++){ - if (options[i].itemType === (0, _base.base).fluentUI.DropdownMenuItemType.Header) continue; - options[i].selected = true; - return; + if (options2.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options2.unshift(option); + } + return options2; + } + function optionsForReference(sectionName, specRoles) { + const options2 = specRoles.map((specRole) => { + const option = { + key: `role:${specRole.role}`, + text: aliasLabels[specRole.role], + data: specRole.role + }; + return option; + }).sort((a2, b2) => a2.text.localeCompare(b2.text)); + if (options2.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options2.unshift(option); + } + return options2; + } + function selectFirst(options2) { + for (let i = 0; i < options2.length; i++) { + if (options2[i].itemType === base$1.fluentUI.DropdownMenuItemType.Header) + continue; + options2[i].selected = true; + return; } -} -function getColumnMapOptions(props) { - if (!props.specRole) return null; + } + function getColumnMapOptions(props) { + if (!props.specRole) + return null; let categoricalColumns; let directColorColumns; let directColorGroup; let referenceGroup = []; - if (props.specRole.role === 'color') { - categoricalColumns = props.categoricalColumns.filter((c)=>!c.isColorData); - directColorColumns = props.categoricalColumns.filter((c)=>c.isColorData); - directColorGroup = optionsForSpecColumn((0, _language.strings).selectDirectColor, directColorColumns, 'color', props.disabledColumnName, props.selectedColumnName); - } else categoricalColumns = props.categoricalColumns; - if (props.specRole.role === 'sort') { - const others = props.specCapabilities.roles.filter((specRole)=>specRole.role !== props.specRole.role); - referenceGroup = optionsForReference((0, _language.strings).selectReference, others); - } - const quantitativeGroup = optionsForSpecColumn((0, _language.strings).selectNumeric, props.quantitativeColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); - const categoricGroup = props.specRole.excludeCategoric ? null : optionsForSpecColumn((0, _language.strings).selectNonNumeric, categoricalColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); - const options = referenceGroup.concat(quantitativeGroup).concat(categoricGroup).concat(directColorGroup).filter(Boolean); - return options; -} -function ColumnMap(props) { - const options = getColumnMapOptions(props); - if (props.specRole.allowNone) options.unshift({ + if (props.specRole.role === "color") { + categoricalColumns = props.categoricalColumns.filter((c2) => !c2.isColorData); + directColorColumns = props.categoricalColumns.filter((c2) => c2.isColorData); + directColorGroup = optionsForSpecColumn(strings$1.selectDirectColor, directColorColumns, "color", props.disabledColumnName, props.selectedColumnName); + } else { + categoricalColumns = props.categoricalColumns; + } + if (props.specRole.role === "sort") { + const others = props.specCapabilities.roles.filter((specRole) => specRole.role !== props.specRole.role); + referenceGroup = optionsForReference(strings$1.selectReference, others); + } + const quantitativeGroup = optionsForSpecColumn(strings$1.selectNumeric, props.quantitativeColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); + const categoricGroup = props.specRole.excludeCategoric ? null : optionsForSpecColumn(strings$1.selectNonNumeric, categoricalColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); + const options2 = referenceGroup.concat(quantitativeGroup).concat(categoricGroup).concat(directColorGroup).filter(Boolean); + return options2; + } + function ColumnMap(props) { + const options2 = getColumnMapOptions(props); + if (props.specRole.allowNone) { + options2.unshift({ key: -1, - text: (0, _language.strings).selectNone - }); - const hasSelection = options.reduce((p, c)=>{ - return p || c.selected; + text: strings$1.selectNone + }); + } + const hasSelection = options2.reduce((p, c2) => { + return p || c2.selected; }, false); - if (!hasSelection) selectFirst(options); + if (!hasSelection) { + selectFirst(options2); + } let signals; if (props.explorer.viewer && props.explorer.viewer.vegaSpec) { - if (props.specRole.signals) signals = props.explorer.viewer.vegaSpec.signals.filter((s)=>props.specRole.signals.indexOf(s.name) >= 0); + if (props.specRole.signals) { + signals = props.explorer.viewer.vegaSpec.signals.filter((s2) => props.specRole.signals.indexOf(s2.name) >= 0); + } } - const label = roleLabels[props.specRole.role]; - const signalElements = !props.hideSignals && signals && signals.map((signal, i)=>{ - let initialValue; - try { - initialValue = props.explorer.viewer.vegaViewGl.signal(signal.name); - } catch (error) { - // continue regardless of error - } - return (0, _base.base).react.createElement((0, _signal.Signal), { - key: signal.name + i + initialValue, - explorer: props.explorer, - signal: signal, - initialValue: initialValue, - onChange: (value)=>props.onChangeSignal && props.onChangeSignal(signal.name, value), - collapseLabel: props.collapseLabel - }); + const label2 = roleLabels[props.specRole.role]; + const signalElements = !props.hideSignals && signals && signals.map((signal, i) => { + let initialValue; + try { + initialValue = props.explorer.viewer.vegaViewGl.signal(signal.name); + } catch (error2) { + } + return base$1.react.createElement(Signal, { key: signal.name + i + initialValue, explorer: props.explorer, signal, initialValue, onChange: (value2) => props.onChangeSignal && props.onChangeSignal(signal.name, value2), collapseLabel: props.collapseLabel }); }); - return (0, _base.base).react.createElement("div", { - className: "sanddance-columnMap" - }, props.prefix, !props.hideDropdown && (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - componentRef: props.componentRef, - collapseLabel: props.collapseLabel, - disabled: props.disabled, - label: label, - options: options, - onChange: (e, o)=>props.changeColumnMapping(props.specRole.role, typeof o.data === 'string' ? o.data : (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(o.data)), - onDismiss: props.onDismiss - }), signalElements, props.suffix); -} - -},{"../base":"3TPz5","./dropdown":"7pP8h","@msrvida/sanddance-react":"lPyTZ","./signal":"buTZe","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7pP8h":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dropdownWidth", ()=>dropdownWidth); -parcelHelpers.export(exports, "Dropdown", ()=>Dropdown); -var _base = require("../base"); -const dropdownWidth = 200; -function Dropdown(props) { - const newProps = Object.assign({}, props); - let selectedKey = null; - if (newProps.options && newProps.options.length > 1) { - const selectedOptions = newProps.options.filter((option)=>option.selected); - if (selectedOptions && selectedOptions.length > 0) selectedKey = selectedOptions[0].key; - } - if (newProps.collapseLabel) newProps.onRenderTitle = (a, b)=>{ - return (0, _base.base).react.createElement("span", null, newProps.label, ": ", a[0].text); - }; - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Dropdown, Object.assign({ - dropdownWidth: dropdownWidth - }, newProps, { - label: newProps.collapseLabel ? null : newProps.label, - selectedKey: selectedKey - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"buTZe":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getInitialSignalValue", ()=>getInitialSignalValue); -parcelHelpers.export(exports, "Signal", ()=>Signal); -var _base = require("../base"); -function getInitialSignalValue(explorer, signal) { - let initialValue; - try { - initialValue = explorer.viewer.vegaViewGl.signal(signal.name); - } catch (error) { - // continue regardless of error - } - return initialValue; -} -function Signal(props) { - if (!props.explorer.viewer || !props.signal) return null; - if (props.signal.bind) { - const input = props.signal.bind.input; - if (input) { - const fn = map[input]; - if (fn) { - const prefix = props.prefix ? `${props.prefix} ` : ''; - const control = fn(prefix, props.signal.bind, props.initialValue, (value)=>{ - props.onChange && props.onChange(value); - props.explorer.signal(props.signal.name, value, props.newViewStateTarget); - }, props.disabled, props.collapseLabel, props.componentRef); - return (0, _base.base).react.createElement("div", { - className: "sanddance-signal" - }, control); + return base$1.react.createElement( + "div", + { className: "sanddance-columnMap" }, + props.prefix, + !props.hideDropdown && base$1.react.createElement(Dropdown$1, { componentRef: props.componentRef, collapseLabel: props.collapseLabel, disabled: props.disabled, label: label2, options: options2, onChange: (e, o) => props.changeColumnMapping(props.specRole.role, typeof o.data === "string" ? o.data : clone(o.data)), onDismiss: props.onDismiss }), + signalElements, + props.suffix + ); + } + function attachSpecRoleToAxisTitle(stage, specCapabilities) { + for (const axisName in stage.axes) { + specCapabilities.roles.forEach((specRole) => { + if (specRole.role === axisName) { + const axes = stage.axes[axisName]; + axes.forEach((axis) => { + if (axis.title) { + const textItem = axis.title; + textItem.specRole = specRole; } + }); } + }); } - return null; -} -const map = {}; -map['range'] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref)=>{ - let debouncer; - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - componentRef: ref, - label: prefix + bind.name, - max: bind.max, - min: bind.min, - step: bind.step, - defaultValue: initialValue, - onChange: (value)=>{ - if (debouncer) clearTimeout(debouncer); - debouncer = setTimeout(()=>onChange(value), bind.debounce || 0); - }, - disabled: disabled - }); -}; -map['select'] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref)=>{ - const options = bind.options.map((o, i)=>{ - const option = { - key: o, - text: o - }; - return option; - }); - const label = prefix + bind.name; - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Dropdown, { - componentRef: ref, - onRenderTitle: collapseLabel ? (a, b)=>(0, _base.base).react.createElement("span", null, label, ": ", a[0].text) : undefined, - defaultSelectedKey: initialValue, - label: collapseLabel ? undefined : label, - options: options, - onChange: (e, o)=>onChange(o.text), - disabled: disabled - }); -}; -map['checkbox'] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref)=>{ - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - componentRef: ref, - defaultChecked: initialValue, - label: prefix + bind.name, - onChange: (e, checked)=>onChange(checked), - disabled: disabled - }); -}; //TODO other signal types - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7dBYz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColumnTypeChanger", ()=>ColumnTypeChanger); -var _base = require("../base"); -var _dialog = require("./dialog"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -var _iconButton = require("./iconButton"); -function _ColumnTypeChanger(_props) { - class __ColumnTypeChanger extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = this.getInitialState(); - } - getInitialState() { - const { props } = this; - return { - dialogHidden: true, - confirmationHidden: true, - quantitativeColumns: props.initialQuantitativeColumns.map((c)=>(0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(c)), - categoricalColumns: props.initialCategoricalColumns.map((c)=>(0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(c)), - columnTypes: null - }; - } - closeDialog() { - this.setState(this.getInitialState()); + } + function px$1(n) { + return n + "px"; + } + function _PositionedColumnMap(_props) { + class __PositionedColumnMap extends base$1.react.Component { + constructor(props) { + super(props); + const { left, top } = props; + this.state = { left, top }; + this.dropdownRef = base$1.react.createRef(); + } + focus() { + if (!this.focused) { + this.focused = true; + this.dropdownRef.current.focus(true); } - openConfirmation(columnTypes) { - this.setState({ - columnTypes, - confirmationHidden: false - }); + } + componentDidMount() { + const size = outerSize$1(this.div); + const over = { + left: Math.max(0, this.state.left + size.width - this.props.container.offsetWidth), + top: Math.max(0, this.state.top + size.height - this.props.container.offsetHeight) + }; + if (over.left || over.top) { + let { left, top } = this.state; + left -= over.left; + top -= over.top; + this.setState({ left, top }); + } else { + this.focus(); } - render() { - const { props, state } = this; - const hasChanges = props.initialQuantitativeColumns.some((c, i)=>{ - return c.quantitative !== state.quantitativeColumns[i].quantitative; - }); - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - text: (0, _language.strings).buttonColumnTypes, - onClick: ()=>this.setState({ - dialogHidden: false - }) - }), (0, _base.base).react.createElement((0, _dialog.Dialog), { - minWidth: "80%", - hidden: state.dialogHidden, - onDismiss: ()=>this.closeDialog(), - dialogContentProps: { - className: `sanddance-dialog ${props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelColumnTypes - }, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: "revert", - text: (0, _language.strings).buttonResetToDefault, - onClick: ()=>this.openConfirmation(null), - iconProps: { - iconName: 'Undo' - } - }), - (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: "apply", - text: (0, _language.strings).buttonApply, - onClick: ()=>{ - const columnTypes = {}; - state.quantitativeColumns.forEach((c)=>{ - columnTypes[c.name] = c.quantitative ? c.type : 'string'; - }); - state.categoricalColumns.forEach((c)=>{ - columnTypes[c.name] = 'string'; - }); - this.openConfirmation(columnTypes); - }, - iconProps: { - iconName: 'Accept' - }, - disabled: !hasChanges - }) - ] - }, (0, _base.base).react.createElement("div", { - className: 'sanddance-columnTypes' - }, state.quantitativeColumns.length > 0 && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("h3", null, (0, _language.strings).selectNumeric), (0, _base.base).react.createElement("table", null, (0, _base.base).react.createElement("thead", null, (0, _base.base).react.createElement("tr", null, (0, _base.base).react.createElement("th", null, (0, _language.strings).labelEditColumn), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnName), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnQuantitativeMin), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnQuantitativeMax), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnQuantitativeMean), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnDistinct))), (0, _base.base).react.createElement("tbody", null, state.quantitativeColumns.map((c, i)=>(0, _base.base).react.createElement("tr", { - key: i, - className: c.quantitative ? '' : 'changed' - }, (0, _base.base).react.createElement("td", null, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - iconName: 'Edit', - onClick: undefined, - menuProps: { - items: [ - (0, _language.strings).selectNumeric, - (0, _language.strings).selectNonNumeric - ].map((t)=>{ - return { - key: t, - text: t, - onClick: ()=>{ - c.quantitative = t === (0, _language.strings).selectNumeric; - this.setState({ - quantitativeColumns: [ - ...state.quantitativeColumns - ] - }); - } - }; + } + componentDidUpdate() { + this.focus(); + } + render() { + return base$1.react.createElement( + "div", + { ref: (div) => { + if (div) + this.div = div; + }, className: "sanddance-columnMap-absolute", style: { position: "absolute", left: px$1(this.state.left), top: px$1(this.state.top) } }, + base$1.react.createElement(ColumnMap, Object.assign({}, this.props, { componentRef: this.dropdownRef, hideSignals: true })) + ); + } + } + return new __PositionedColumnMap(_props); + } + const PositionedColumnMap = _PositionedColumnMap; + function _ColumnTypeChanger(_props) { + class __ColumnTypeChanger extends base$1.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(); + } + getInitialState() { + const { props } = this; + return { + dialogHidden: true, + confirmationHidden: true, + quantitativeColumns: props.initialQuantitativeColumns.map((c2) => clone(c2)), + categoricalColumns: props.initialCategoricalColumns.map((c2) => clone(c2)), + columnTypes: null + }; + } + closeDialog() { + this.setState(this.getInitialState()); + } + openConfirmation(columnTypes) { + this.setState({ columnTypes, confirmationHidden: false }); + } + render() { + const { props, state } = this; + const hasChanges = props.initialQuantitativeColumns.some((c2, i) => { + return c2.quantitative !== state.quantitativeColumns[i].quantitative; + }); + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { text: strings$1.buttonColumnTypes, onClick: () => this.setState({ dialogHidden: false }) }), + base$1.react.createElement( + Dialog$1, + { minWidth: "80%", hidden: state.dialogHidden, onDismiss: () => this.closeDialog(), dialogContentProps: { + className: `sanddance-dialog ${props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelColumnTypes + }, buttons: [ + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "revert", text: strings$1.buttonResetToDefault, onClick: () => this.openConfirmation(null), iconProps: { iconName: "Undo" } }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "apply", text: strings$1.buttonApply, onClick: () => { + const columnTypes = {}; + state.quantitativeColumns.forEach((c2) => { + columnTypes[c2.name] = c2.quantitative ? c2.type : "string"; + }); + state.categoricalColumns.forEach((c2) => { + columnTypes[c2.name] = "string"; + }); + this.openConfirmation(columnTypes); + }, iconProps: { iconName: "Accept" }, disabled: !hasChanges }) + ] }, + base$1.react.createElement( + "div", + { className: "sanddance-columnTypes" }, + state.quantitativeColumns.length > 0 && base$1.react.createElement( + "div", + null, + base$1.react.createElement("h3", null, strings$1.selectNumeric), + base$1.react.createElement( + "table", + null, + base$1.react.createElement( + "thead", + null, + base$1.react.createElement( + "tr", + null, + base$1.react.createElement("th", null, strings$1.labelEditColumn), + base$1.react.createElement("th", null, strings$1.labelColumnName), + base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMin), + base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMax), + base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMean), + base$1.react.createElement("th", null, strings$1.labelColumnDistinct) + ) + ), + base$1.react.createElement("tbody", null, state.quantitativeColumns.map((c2, i) => base$1.react.createElement( + "tr", + { key: i, className: c2.quantitative ? "" : "changed" }, + base$1.react.createElement( + "td", + null, + base$1.react.createElement(IconButton$1, { iconName: "Edit", onClick: void 0, menuProps: { + items: [strings$1.selectNumeric, strings$1.selectNonNumeric].map((t) => { + return { + key: t, + text: t, + onClick: () => { + c2.quantitative = t === strings$1.selectNumeric; + this.setState({ quantitativeColumns: [...state.quantitativeColumns] }); + } + }; }) - }, - themePalette: props.themePalette, - title: (0, _language.strings).labelChangeColumnType - })), (0, _base.base).react.createElement("td", null, c.name), (0, _base.base).react.createElement("td", null, c.stats.min), (0, _base.base).react.createElement("td", null, c.stats.max), (0, _base.base).react.createElement("td", null, c.stats.mean), (0, _base.base).react.createElement("td", null, c.stats.distinctValueCount)))))), state.categoricalColumns.length > 0 && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("h3", null, (0, _language.strings).selectNonNumeric), (0, _base.base).react.createElement("table", null, (0, _base.base).react.createElement("thead", null, (0, _base.base).react.createElement("tr", null, (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnName), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnType), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnDistinct), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnHasColorData), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnIsColorData))), (0, _base.base).react.createElement("tbody", null, state.categoricalColumns.map((c, i)=>(0, _base.base).react.createElement("tr", { - key: i - }, (0, _base.base).react.createElement("td", null, c.name), (0, _base.base).react.createElement("td", null, c.type), (0, _base.base).react.createElement("td", null, c.stats.distinctValueCount), (0, _base.base).react.createElement("td", null, (!!c.stats.hasColorData).toString()), (0, _base.base).react.createElement("td", null, (!!c.isColorData).toString())))))))), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: state.confirmationHidden, - onDismiss: ()=>this.setState({ - confirmationHidden: true - }), - dialogContentProps: { - className: `sanddance-dialog ${props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelConfirmation, - subText: (0, _language.strings).labelHistoryWarning - }, - buttons: (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - text: (0, _language.strings).buttonApply, - onClick: ()=>{ - this.closeDialog(); - this.props.onConfirmUpdate(this.state.columnTypes); - }, - iconProps: { - iconName: 'Accept' - } - }) - })); - } + }, themePalette: props.themePalette, title: strings$1.labelChangeColumnType }) + ), + base$1.react.createElement("td", null, c2.name), + base$1.react.createElement("td", null, c2.stats.min), + base$1.react.createElement("td", null, c2.stats.max), + base$1.react.createElement("td", null, c2.stats.mean), + base$1.react.createElement("td", null, c2.stats.distinctValueCount) + ))) + ) + ), + state.categoricalColumns.length > 0 && base$1.react.createElement( + "div", + null, + base$1.react.createElement("h3", null, strings$1.selectNonNumeric), + base$1.react.createElement( + "table", + null, + base$1.react.createElement( + "thead", + null, + base$1.react.createElement( + "tr", + null, + base$1.react.createElement("th", null, strings$1.labelColumnName), + base$1.react.createElement("th", null, strings$1.labelColumnType), + base$1.react.createElement("th", null, strings$1.labelColumnDistinct), + base$1.react.createElement("th", null, strings$1.labelColumnHasColorData), + base$1.react.createElement("th", null, strings$1.labelColumnIsColorData) + ) + ), + base$1.react.createElement("tbody", null, state.categoricalColumns.map((c2, i) => base$1.react.createElement( + "tr", + { key: i }, + base$1.react.createElement("td", null, c2.name), + base$1.react.createElement("td", null, c2.type), + base$1.react.createElement("td", null, c2.stats.distinctValueCount), + base$1.react.createElement("td", null, (!!c2.stats.hasColorData).toString()), + base$1.react.createElement("td", null, (!!c2.isColorData).toString()) + ))) + ) + ) + ) + ), + base$1.react.createElement(Dialog$1, { hidden: state.confirmationHidden, onDismiss: () => this.setState({ confirmationHidden: true }), dialogContentProps: { + className: `sanddance-dialog ${props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelConfirmation, + subText: strings$1.labelHistoryWarning + }, buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { text: strings$1.buttonApply, onClick: () => { + this.closeDialog(); + this.props.onConfirmUpdate(this.state.columnTypes); + }, iconProps: { iconName: "Accept" } }) }) + ); + } } return new __ColumnTypeChanger(_props); -} -const ColumnTypeChanger = _ColumnTypeChanger; - -},{"../base":"3TPz5","./dialog":"OQi9w","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","./iconButton":"6pZiK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7XSio":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataExportPicker", ()=>DataExportPicker); -parcelHelpers.export(exports, "removeExtensions", ()=>removeExtensions); -parcelHelpers.export(exports, "getEmbedHTML", ()=>getEmbedHTML); -var _dataExporterHtml = require("./dataExporterHtml"); -var _dialog = require("./dialog"); -var _base = require("../base"); -var _exportDelimited = require("../exportDelimited"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -const exportTypes = [ - [ - 'json', - (0, _language.strings).labelExportJSON - ], - [ - 'csv', - (0, _language.strings).labelExportCSV - ], - [ - 'tsv', - (0, _language.strings).labelExportTSV - ], - [ - 'html', - (0, _language.strings).labelExportHTML - ] -]; -function _DataExportPicker(_props) { - class __DataExportPicker extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = this.getInitialState(this.props); - } - getInitialState(props) { - const initialState = { - initializer: props.initializer, - dialogHidden: true, - exportType: exportTypes[0][0], - fileName: props.initializer.fileName, - fileNameError: '', - working: false - }; - return initialState; - } - componentDidUpdate() { - if (!(0, _sanddanceReact.util).deepCompare(this.props.initializer, this.state.initializer)) this.setState(this.getInitialState(this.props)); - } - // Converts to dataExport type and calls dataExportHandler to deal with data - createExport(exportType, displayName) { - const final = (data)=>{ - this.props.dataExportHandler(data, exportType, displayName); - this.close(); - }; - const json = JSON.stringify(this.props.data, columnReplacer); - switch(exportType){ - case 'json': - final(json); - break; - case 'csv': - final((0, _exportDelimited.convertToDelimited)(JSON.parse(json), ',')); - break; - case 'tsv': - final((0, _exportDelimited.convertToDelimited)(JSON.parse(json), '\t')); - break; - case 'html': - { - const csv = (0, _exportDelimited.convertToDelimited)(JSON.parse(json), ','); - const html = (0, _dataExporterHtml.embedHtml)(`${(0, _language.strings).appName} - ${escape(displayName)}`, embedScript(csv, displayName)); - final(html); - } - } - } - close() { - this.setState({ - dialogHidden: true, - working: false - }); - } - render() { - const closeDialog = ()=>this.close(); - if (this.state.delayAction) requestAnimationFrame(()=>{ - //allow render to complete - if (this.state.delayAction) { - this.state.delayAction(); - this.setState({ - delayAction: null - }); - } - }); - const disabled = this.state.working || this.state.dialogHidden; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: "search-action search-bottom-action", - text: (0, _language.strings).buttonExportCount(this.props.data.length), - onClick: ()=>this.setState({ - dialogHidden: false - }), - disabled: this.props.disabled - }), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: this.state.dialogHidden, - onDismiss: closeDialog, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelExport - }, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 0, - disabled: disabled || !!this.state.fileNameError, - onClick: (e)=>this.setState({ - delayAction: ()=>this.createExport(this.state.exportType, this.state.fileName), - working: true - }), - text: (0, _language.strings).buttonExport, - iconProps: { - iconName: 'Download' - } - }) - ] - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelExportFileName, - onChange: (e, displayName)=>{ - const displayNameError = getFileNameError(displayName); - this.setState({ - fileName: displayName, - fileNameError: displayNameError - }); - }, - errorMessage: this.state.fileNameError, - value: this.state.fileName - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - className: "sanddance-form-separate", - disabled: disabled, - selectedKey: this.state.exportType, - options: exportTypes.map(([exportType, text])=>{ - return { - key: exportType, - text, - disabled: false - }; - }), - onChange: (ev, option)=>this.setState({ - exportType: option.key - }), - label: (0, _language.strings).labelExportFormat - }))); - } - } - return new __DataExportPicker(_props); -} -const DataExportPicker = _DataExportPicker; -const illegalChars = '\\/:*?"<>|'; -function getFileNameError(displayName) { - if (!displayName) return (0, _language.strings).errorExportFilenameEmpty; - for(let i = 0; i < illegalChars.length; i++){ - if (displayName.indexOf(illegalChars[i]) >= 0) return (0, _language.strings).errorExportFilenameCharacters(illegalChars); - } -} -function removeExtensions(fileName) { - exportTypes.forEach(([exportType])=>{ - const re = new RegExp(`\\.${exportType}`, 'ig'); - fileName = fileName.replace(re, ''); - }); - return fileName; -} -function columnReplacer(name, value) { - if ((0, _sanddanceReact.SandDance).util.isInternalFieldName(name, true)) return undefined; - return value === null ? '' : value; -} -function embedScript(csv, displayName, snapshots) { - const dataFile = { - type: 'csv', - displayName, - snapshots - }; - return `<pre id='csv-data' style='display:none'>${csv}</pre> - <script>SandDanceEmbed.load(Object.assign({rawText: document.getElementById('csv-data').innerText}, ${JSON.stringify(dataFile)}))</script>`; -} -function getEmbedHTML(data, displayName, snapshots) { - const json = JSON.stringify(data, columnReplacer); - const csv = (0, _exportDelimited.convertToDelimited)(JSON.parse(json), ','); - const html = (0, _dataExporterHtml.embedHtml)(`${(0, _language.strings).appName} - ${escape(displayName)}`, embedScript(csv, displayName, snapshots)); - return html; -} - -},{"./dataExporterHtml":"3Md58","./dialog":"OQi9w","../base":"3TPz5","../exportDelimited":"f4JI7","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Md58":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "embedHtml", ()=>embedHtml); -const embedHtml = (title, embed)=>`<!DOCTYPE html> + } + const ColumnTypeChanger = _ColumnTypeChanger; + const embedHtml = (title, embed) => `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> @@ -52573,141 +30057,292 @@ const embedHtml = (title, embed)=>`<!DOCTYPE html> <link rel="stylesheet" type="text/css" href="https://unpkg.com/@msrvida/sanddance-embed@4/dist/css/sanddance-embed.css" /> </head> <body> - <script src="https://unpkg.com/react@17/umd/react.production.min.js"></script> - <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> - <script src="https://unpkg.com/vega@5.32/build/vega.min.js"></script> - <script src="https://unpkg.com/@fluentui/react@8/dist/fluentui-react.js"></script> - <script src="https://unpkg.com/@msrvida/fluentui-icons@1/dist/umd/fluentui-icons.js"></script> - <script src="https://unpkg.com/@msrvida/sanddance-explorer@4/dist/umd/sanddance-explorer.js"></script> - <script src="https://unpkg.com/@msrvida/sanddance-embed@4/dist/umd/sanddance-embed.js"></script> + <script src="https://unpkg.com/react@17/umd/react.production.min.js"><\/script> + <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"><\/script> + <script src="https://unpkg.com/vega@6.2/build/vega.min.js"><\/script> + <script src="https://unpkg.com/@fluentui/react@8/dist/fluentui-react.js"><\/script> + <script src="https://unpkg.com/@msrvida/fluentui-icons@1/dist/umd/fluentui-icons.js"><\/script> + <script src="https://unpkg.com/@msrvida/sanddance-explorer@4/dist/umd/sanddance-explorer.js"><\/script> + <script src="https://unpkg.com/@msrvida/sanddance-embed@4/dist/umd/sanddance-embed.js"><\/script> ${embed} </body> </html>`; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f4JI7":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "convertToDelimited", ()=>convertToDelimited); -function convertToDelimited(data, delimiter) { - const fields = Object.keys(data[0]); - const file = data.map((row)=>{ - return fields.map((fieldName)=>{ - const value = row[fieldName]; - if (typeof value === 'number') return value; - if (typeof value === 'string') { - if (value.indexOf(delimiter) >= 0) return `"${value.replace(/"/g, '""')}"`; - else return value; - } - return ''; - }).join(delimiter); + function convertToDelimited(data2, delimiter) { + const fields = Object.keys(data2[0]); + const file = data2.map((row) => { + return fields.map((fieldName) => { + const value2 = row[fieldName]; + if (typeof value2 === "number") { + return value2; + } + if (typeof value2 === "string") { + if (value2.indexOf(delimiter) >= 0) { + return `"${value2.replace(/"/g, '""')}"`; + } else { + return value2; + } + } + return ""; + }).join(delimiter); }); file.unshift(fields.join(delimiter)); - return file.join('\n'); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dwBpS":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "chartLabelMap", ()=>chartLabelMap); -parcelHelpers.export(exports, "chartLabel", ()=>chartLabel); -parcelHelpers.export(exports, "Chart", ()=>Chart); -var _base = require("../base"); -var _columnMap = require("../controls/columnMap"); -var _dialog = require("../controls/dialog"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _signal = require("../controls/signal"); -var _language = require("../language"); -var _toggleColumns = require("../controls/toggleColumns"); -var _columns = require("../columns"); -var _backgroundImageEditor = require("./backgroundImageEditor"); -const singleFacetLayouts = [ - { - facetStyle: 'wrap', - text: (0, _language.strings).labelFacetLayoutWrap + return file.join("\n"); + } + const exportTypes = [ + ["json", strings$1.labelExportJSON], + ["csv", strings$1.labelExportCSV], + ["tsv", strings$1.labelExportTSV], + ["html", strings$1.labelExportHTML] + ]; + function _DataExportPicker(_props) { + class __DataExportPicker extends base$1.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(this.props); + } + getInitialState(props) { + const initialState = { + initializer: props.initializer, + dialogHidden: true, + exportType: exportTypes[0][0], + fileName: props.initializer.fileName, + fileNameError: "", + working: false + }; + return initialState; + } + componentDidUpdate() { + if (!deepCompare(this.props.initializer, this.state.initializer)) { + this.setState(this.getInitialState(this.props)); + } + } + // Converts to dataExport type and calls dataExportHandler to deal with data + createExport(exportType, displayName) { + const final = (data2) => { + this.props.dataExportHandler(data2, exportType, displayName); + this.close(); + }; + const json2 = JSON.stringify(this.props.data, columnReplacer); + switch (exportType) { + case "json": { + final(json2); + break; + } + case "csv": { + final(convertToDelimited(JSON.parse(json2), ",")); + break; + } + case "tsv": { + final(convertToDelimited(JSON.parse(json2), " ")); + break; + } + case "html": { + const csv = convertToDelimited(JSON.parse(json2), ","); + const html = embedHtml(`${strings$1.appName} - ${escape(displayName)}`, embedScript(csv, displayName)); + final(html); + } + } + } + close() { + this.setState({ dialogHidden: true, working: false }); + } + render() { + const closeDialog = () => this.close(); + if (this.state.delayAction) { + requestAnimationFrame(() => { + if (this.state.delayAction) { + this.state.delayAction(); + this.setState({ delayAction: null }); + } + }); + } + const disabled = this.state.working || this.state.dialogHidden; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "search-action search-bottom-action", text: strings$1.buttonExportCount(this.props.data.length), onClick: () => this.setState({ dialogHidden: false }), disabled: this.props.disabled }), + base$1.react.createElement( + Dialog$1, + { hidden: this.state.dialogHidden, onDismiss: closeDialog, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelExport + }, buttons: [ + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: 0, disabled: disabled || !!this.state.fileNameError, onClick: (e) => this.setState({ + delayAction: () => this.createExport(this.state.exportType, this.state.fileName), + working: true + }), text: strings$1.buttonExport, iconProps: { + iconName: "Download" + } }) + ] }, + base$1.react.createElement(base$1.fluentUI.TextField, { label: strings$1.labelExportFileName, onChange: (e, displayName) => { + const displayNameError = getFileNameError(displayName); + this.setState({ fileName: displayName, fileNameError: displayNameError }); + }, errorMessage: this.state.fileNameError, value: this.state.fileName }), + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { className: "sanddance-form-separate", disabled, selectedKey: this.state.exportType, options: exportTypes.map(([exportType, text2]) => { + return { + key: exportType, + text: text2, + disabled: false + }; + }), onChange: (ev, option) => this.setState({ exportType: option.key }), label: strings$1.labelExportFormat }) + ) + ); + } + } + return new __DataExportPicker(_props); + } + const DataExportPicker = _DataExportPicker; + const illegalChars = '\\/:*?"<>|'; + function getFileNameError(displayName) { + if (!displayName) { + return strings$1.errorExportFilenameEmpty; + } + for (let i = 0; i < illegalChars.length; i++) { + if (displayName.indexOf(illegalChars[i]) >= 0) { + return strings$1.errorExportFilenameCharacters(illegalChars); + } + } + } + function removeExtensions(fileName) { + exportTypes.forEach(([exportType]) => { + const re2 = new RegExp(`\\.${exportType}`, "ig"); + fileName = fileName.replace(re2, ""); + }); + return fileName; + } + function columnReplacer(name, value2) { + if (isInternalFieldName(name, true)) { + return void 0; } -]; -const chartLabelMap = [ + return value2 === null ? "" : value2; + } + function embedScript(csv, displayName, snapshots) { + const dataFile = { type: "csv", displayName, snapshots }; + return `<pre id='csv-data' style='display:none'>${csv}</pre> + <script>SandDanceEmbed.load(Object.assign({rawText: document.getElementById('csv-data').innerText}, ${JSON.stringify(dataFile)}))<\/script>`; + } + function getEmbedHTML(data2, displayName, snapshots) { + const json2 = JSON.stringify(data2, columnReplacer); + const csv = convertToDelimited(JSON.parse(json2), ","); + const html = embedHtml(`${strings$1.appName} - ${escape(displayName)}`, embedScript(csv, displayName, snapshots)); + return html; + } + function Group$1(props) { + return base$1.react.createElement( + "div", + { className: classList("sanddance-group", props.className) }, + base$1.react.createElement( + "div", + { className: "group-head" }, + base$1.react.createElement("label", null, props.label), + props.labelCount && base$1.react.createElement( + "span", + { className: "count" }, + "(", + props.labelCount, + ")" + ) + ), + props.children && base$1.react.createElement("div", { className: "group-body" }, props.children) + ); + } + function ToggleColumns(props) { + return base$1.react.createElement("div", null, props.allColumns.map((c2, i) => base$1.react.createElement( + "div", + { key: c2.name }, + base$1.react.createElement( + "label", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: props.exclusions.indexOf(c2.name) < 0, inlineLabel: true, label: c2.name, onChange: () => props.toggleExclusion(c2.name) }) + ) + ))); + } + const singleFacetLayouts = [ + { facetStyle: "wrap", text: strings$1.labelFacetLayoutWrap } + //{ facetStyle: 'horizontal', text: strings.labelFacetLayoutHorizontal }, + //{ facetStyle: 'vertical', text: strings.labelFacetLayoutVertical } + ]; + const chartLabelMap = [ { - key: 'grid', - text: (0, _language.strings).chartTypeGrid + key: "grid", + text: strings$1.chartTypeGrid }, { - key: 'scatterplot', - text: (0, _language.strings).chartTypeScatterPlot + key: "scatterplot", + text: strings$1.chartTypeScatterPlot }, { - key: 'density', - text: (0, _language.strings).chartTypeDensity + key: "density", + text: strings$1.chartTypeDensity }, { - key: 'barchartV', - text: (0, _language.strings).chartTypeBarChartV + key: "barchartV", + text: strings$1.chartTypeBarChartV }, { - key: 'barchartH', - text: (0, _language.strings).chartTypeBarChartH + key: "barchartH", + text: strings$1.chartTypeBarChartH }, { - key: 'treemap', - text: (0, _language.strings).chartTypeTreeMap + key: "treemap", + text: strings$1.chartTypeTreeMap }, { - key: 'strips', - text: (0, _language.strings).chartTypeStrips + key: "strips", + text: strings$1.chartTypeStrips }, { - key: 'stacks', - text: (0, _language.strings).chartTypeStacks - } -]; -function chartLabel(key) { - for(let i = 0; i < chartLabelMap.length; i++){ - if (key === chartLabelMap[i].key) return chartLabelMap[i].text; - } -} -function _Chart(_props) { - class __Chart extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - showTooltipDialog: false - }; - this.choiceRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = this.choiceRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - } - render() { - const { props } = this; - const { explorer, specCapabilities } = props; - const signals = explorer.viewer && explorer.viewer.vegaSpec && specCapabilities && specCapabilities.signals && explorer.viewer.vegaSpec.signals.filter((s)=>specCapabilities.signals.indexOf(s.name) >= 0); - const hasOptions = !!signals || (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage); - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelChart - }, (0, _base.base).react.createElement("div", { - className: "calculator" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - componentRef: this.choiceRef, - selectedKey: props.chart, - className: "sanddance-chart-type", - options: chartLabelMap.map((o)=>{ - return Object.assign(Object.assign({}, o), { - disabled: props.disabled || o.key === 'treemap' && props.quantitativeColumns.length === 0 - }); - }), - onChange: (e, o)=>props.explorer.changeChartType(o.key) - }))), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColumnMapping - }, (0, _base.base).react.createElement("div", null, specCapabilities && specCapabilities.roles.map((specRole, i)=>{ + key: "stacks", + text: strings$1.chartTypeStacks + } + ]; + function chartLabel(key2) { + for (let i = 0; i < chartLabelMap.length; i++) { + if (key2 === chartLabelMap[i].key) { + return chartLabelMap[i].text; + } + } + } + function _Chart(_props) { + class __Chart extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + showTooltipDialog: false + }; + this.choiceRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = this.choiceRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + } + render() { + const { props } = this; + const { explorer: explorer2, specCapabilities } = props; + const signals = explorer2.viewer && explorer2.viewer.vegaSpec && specCapabilities && specCapabilities.signals && explorer2.viewer.vegaSpec.signals.filter((s2) => specCapabilities.signals.indexOf(s2.name) >= 0); + const hasOptions = !!signals || (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage); + return base$1.react.createElement( + "div", + null, + base$1.react.createElement( + Group$1, + { label: strings$1.labelChart }, + base$1.react.createElement( + "div", + { className: "calculator" }, + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { componentRef: this.choiceRef, selectedKey: props.chart, className: "sanddance-chart-type", options: chartLabelMap.map((o) => { + return Object.assign(Object.assign({}, o), { disabled: props.disabled || o.key === "treemap" && props.quantitativeColumns.length === 0 }); + }), onChange: (e, o) => props.explorer.changeChartType(o.key) }) + ) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelColumnMapping }, + base$1.react.createElement( + "div", + null, + specCapabilities && specCapabilities.roles.map((specRole, i) => { const specColumnInRole = props.insightColumns[specRole.role]; const selectedColumnName = specColumnInRole; let disabledColumnName; @@ -52715,10715 +30350,5682 @@ function _Chart(_props) { let suffix; let hideDropdown = false; let { totalStyle } = props; - if (!totalStyle) totalStyle = 'count-square'; + if (!totalStyle) { + totalStyle = "count-square"; + } let { facetStyle } = props; - if (!facetStyle) facetStyle = 'wrap'; - switch(specRole.role){ - case 'facet': - suffix = (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - disabled: !props.insightColumns.facet, - collapseLabel: props.collapseLabels, - label: (0, _language.strings).labelFacetLayout, - calloutProps: { - style: { - minWidth: '18em' - } - }, - options: [ - { - key: 'header1', - text: `${(0, _language.strings).labelFacetLayout}:`, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }, - ...singleFacetLayouts.map((f)=>{ - const o = { - key: f.facetStyle, - text: f.text, - data: f, - selected: facetStyle === f.facetStyle - }; - return o; - }), - { - key: 'divider', - text: '-', - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Divider - }, - { - key: 'header2', - text: `${(0, _language.strings).labelColumnFacetV}:`, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }, - ...(0, _columnMap.getColumnMapOptions)(Object.assign(Object.assign({}, props), { - specRole, - selectedColumnName: props.insightColumns.facetV - })).map((o)=>{ - if (o.itemType !== (0, _base.base).fluentUI.DropdownMenuItemType.Header) { - const facetData = { - facetStyle: 'cross', - column: o.data - }; - o.data = facetData; - o.text = `${(0, _language.strings).labelFacetLayoutCross} ${o.text}`; - } - return o; - }) - ], - onChange: (e, o)=>{ - const facetData = o.data; - props.changeColumnMapping('facet', 'facet', null, { - facetStyle: facetData.facetStyle - }); - if (facetData.facetStyle === 'cross') props.changeColumnMapping('facetV', (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(facetData.column)); - } - }); - break; - case 'facetV': - hideDropdown = true; - break; - case 'size': - { - const options = [ - { - key: 'count-square', - text: (0, _language.strings).labelTotalByCountSquare, - data: 'count-square', - selected: !totalStyle || totalStyle === 'count-square' - }, - { - key: 'count-strip', - text: (0, _language.strings).labelTotalByCountStrip, - data: 'count-strip', - selected: totalStyle === 'count-strip' - }, - { - key: 'sum-strip', - text: (0, _language.strings).labelTotalBySumStrip, - data: 'sum-strip', - selected: totalStyle === 'sum-strip' - }, - { - key: 'sum-treemap', - text: (0, _language.strings).labelTotalBySumTreemap, - data: 'sum-treemap', - selected: totalStyle === 'sum-treemap', - disabled: props.quantitativeColumns.length === 0 - } - ]; - if (specCapabilities.percentage) options.push({ - key: 'sum-strip-percent', - text: (0, _language.strings).labelTotalBySumStripPercent, - data: 'sum-strip-percent', - selected: totalStyle === 'sum-strip-percent', - disabled: props.quantitativeColumns.length === 0 - }); - prefix = !specCapabilities.countsAndSums ? null : (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabels, - label: (0, _language.strings).labelTotal, - calloutProps: { - style: { - minWidth: '18em' - } - }, - options: options, - onChange: (e, o)=>{ - const totalStyle = o.data; - let defaultColumn; - if (totalStyle.indexOf('sum-') === 0) { - if (totalStyle === 'sum-treemap') defaultColumn = (0, _columns.getTreemapColumn)(props.allColumns); - defaultColumn = defaultColumn || props.quantitativeColumns[0]; - } - props.changeColumnMapping('size', 'size', defaultColumn, { - totalStyle - }); - } - }); - break; - } + if (!facetStyle) { + facetStyle = "wrap"; } - const disabled = props.disabled || specRole.disabled || specRole.role === 'size' && !(!specCapabilities.countsAndSums || totalStyle.indexOf('sum-') === 0) || specRole.role === 'sort' && specCapabilities.countsAndSums && totalStyle === 'sum-treemap'; - return (0, _base.base).react.createElement((0, _columnMap.ColumnMap), Object.assign({}, props, { - prefix: prefix, - suffix: suffix, - collapseLabel: props.collapseLabels, - disabled: disabled, - disabledColumnName: disabledColumnName, - selectedColumnName: selectedColumnName, - specRole: specRole, - key: i, - onChangeSignal: (name, value)=>props.onChangeSignal(specRole.role, selectedColumnName, name, value), - hideDropdown: hideDropdown - })); - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: 'sanddance-chart-button', - text: (0, _language.strings).buttonTooltipMapping, - onClick: ()=>this.setState({ - showTooltipDialog: true - }) - }))), hasOptions && (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelChartTypeOptions - }, signals && signals.map((signal, i)=>(0, _base.base).react.createElement((0, _signal.Signal), { - key: i, - signal: signal, - explorer: explorer, - initialValue: (0, _signal.getInitialSignalValue)(explorer, signal), - disabled: props.disabled || this.disableSignal(signal), - collapseLabel: props.collapseLabels, - newViewStateTarget: false - })), (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage) && (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: 'sanddance-chart-button', - text: (0, _language.strings).buttonBackgroundImage, - onClick: ()=>{ - let insightColumns; - switch(props.chart){ - case 'scatterplot': - case 'stacks': - insightColumns = props.insightColumns; - break; + switch (specRole.role) { + case "facet": { + suffix = base$1.react.createElement(Dropdown$1, { disabled: !props.insightColumns.facet, collapseLabel: props.collapseLabels, label: strings$1.labelFacetLayout, calloutProps: { style: { minWidth: "18em" } }, options: [ + { + key: "header1", + text: `${strings$1.labelFacetLayout}:`, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }, + ...singleFacetLayouts.map((f) => { + const o = { + key: f.facetStyle, + text: f.text, + data: f, + selected: facetStyle === f.facetStyle + }; + return o; + }), + { + key: "divider", + text: "-", + itemType: base$1.fluentUI.DropdownMenuItemType.Divider + }, + { + key: "header2", + text: `${strings$1.labelColumnFacetV}:`, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }, + ...getColumnMapOptions(Object.assign(Object.assign({}, props), { specRole, selectedColumnName: props.insightColumns.facetV })).map((o) => { + if (o.itemType !== base$1.fluentUI.DropdownMenuItemType.Header) { + const facetData = { + facetStyle: "cross", + column: o.data + }; + o.data = facetData; + o.text = `${strings$1.labelFacetLayoutCross} ${o.text}`; + } + return o; + }) + ], onChange: (e, o) => { + const facetData = o.data; + props.changeColumnMapping("facet", "facet", null, { facetStyle: facetData.facetStyle }); + if (facetData.facetStyle === "cross") { + props.changeColumnMapping("facetV", clone(facetData.column)); + } + } }); + break; + } + case "facetV": { + hideDropdown = true; + break; + } + case "size": { + const options2 = [ + { + key: "count-square", + text: strings$1.labelTotalByCountSquare, + data: "count-square", + selected: !totalStyle || totalStyle === "count-square" + }, + { + key: "count-strip", + text: strings$1.labelTotalByCountStrip, + data: "count-strip", + selected: totalStyle === "count-strip" + }, + { + key: "sum-strip", + text: strings$1.labelTotalBySumStrip, + data: "sum-strip", + selected: totalStyle === "sum-strip" + }, + { + key: "sum-treemap", + text: strings$1.labelTotalBySumTreemap, + data: "sum-treemap", + selected: totalStyle === "sum-treemap", + disabled: props.quantitativeColumns.length === 0 + } + ]; + if (specCapabilities.percentage) { + options2.push({ + key: "sum-strip-percent", + text: strings$1.labelTotalBySumStripPercent, + data: "sum-strip-percent", + selected: totalStyle === "sum-strip-percent", + disabled: props.quantitativeColumns.length === 0 + }); } - if (!insightColumns) insightColumns = props.explorer.changeChartType('scatterplot'); - this.backgroundImageEditor.show(insightColumns); + prefix = !specCapabilities.countsAndSums ? null : base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabels, label: strings$1.labelTotal, calloutProps: { style: { minWidth: "18em" } }, options: options2, onChange: (e, o) => { + const totalStyle2 = o.data; + let defaultColumn; + if (totalStyle2.indexOf("sum-") === 0) { + if (totalStyle2 === "sum-treemap") { + defaultColumn = getTreemapColumn(props.allColumns); + } + defaultColumn = defaultColumn || props.quantitativeColumns[0]; + } + props.changeColumnMapping("size", "size", defaultColumn, { totalStyle: totalStyle2 }); + } }); + break; + } } - })), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !this.state.showTooltipDialog, - onDismiss: ()=>this.setState({ - showTooltipDialog: false - }), - title: (0, _language.strings).labelTooltipMapping - }, (0, _base.base).react.createElement((0, _toggleColumns.ToggleColumns), { - allColumns: props.allColumns, - exclusions: props.tooltipExclusions, - toggleExclusion: props.toggleTooltipExclusion - })), (0, _base.base).react.createElement((0, _backgroundImageEditor.BackgroundImageEditor), Object.assign({}, props, { - ref: (e)=>this.backgroundImageEditor = e - }))); - } - disableSignal(signal) { - if (this.props.view === '2d' && signal.name === (0, _sanddanceReact.SandDance).constants.SignalNames.ZGrounded) return true; - return false; + const disabled = props.disabled || specRole.disabled || specRole.role === "size" && !(!specCapabilities.countsAndSums || totalStyle.indexOf("sum-") === 0) || specRole.role === "sort" && specCapabilities.countsAndSums && totalStyle === "sum-treemap"; + return base$1.react.createElement(ColumnMap, Object.assign({}, props, { prefix, suffix, collapseLabel: props.collapseLabels, disabled, disabledColumnName, selectedColumnName, specRole, key: i, onChangeSignal: (name, value2) => props.onChangeSignal(specRole.role, selectedColumnName, name, value2), hideDropdown })); + }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "sanddance-chart-button", text: strings$1.buttonTooltipMapping, onClick: () => this.setState({ showTooltipDialog: true }) }) + ) + ), + hasOptions && base$1.react.createElement( + Group$1, + { label: strings$1.labelChartTypeOptions }, + signals && signals.map((signal, i) => base$1.react.createElement(Signal, { key: i, signal, explorer: explorer2, initialValue: getInitialSignalValue(explorer2, signal), disabled: props.disabled || this.disableSignal(signal), collapseLabel: props.collapseLabels, newViewStateTarget: false })), + (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage) && base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "sanddance-chart-button", text: strings$1.buttonBackgroundImage, onClick: () => { + let insightColumns; + switch (props.chart) { + case "scatterplot": + case "stacks": { + insightColumns = props.insightColumns; + break; + } + } + if (!insightColumns) { + insightColumns = props.explorer.changeChartType("scatterplot"); + } + this.backgroundImageEditor.show(insightColumns); + } }) + ), + base$1.react.createElement( + Dialog$1, + { hidden: !this.state.showTooltipDialog, onDismiss: () => this.setState({ showTooltipDialog: false }), title: strings$1.labelTooltipMapping }, + base$1.react.createElement(ToggleColumns, { allColumns: props.allColumns, exclusions: props.tooltipExclusions, toggleExclusion: props.toggleTooltipExclusion }) + ), + base$1.react.createElement(BackgroundImageEditor, Object.assign({}, props, { ref: (e) => this.backgroundImageEditor = e })) + ); + } + disableSignal(signal) { + if (this.props.view === "2d" && signal.name === SignalNames.ZGrounded) { + return true; } + return false; + } } return new __Chart(_props); -} -const Chart = _Chart; - -},{"../base":"3TPz5","../controls/columnMap":"8sojP","../controls/dialog":"OQi9w","../controls/dropdown":"7pP8h","../controls/group":"afKlW","@msrvida/sanddance-react":"lPyTZ","../controls/signal":"buTZe","../language":"67xOI","../controls/toggleColumns":"kBkXL","../columns":"7ZE4v","./backgroundImageEditor":"hTdbK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"afKlW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Group", ()=>Group); -var _base = require("../base"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Group(props) { - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-group', props.className) - }, (0, _base.base).react.createElement("div", { - className: "group-head" - }, (0, _base.base).react.createElement("label", null, props.label), props.labelCount && (0, _base.base).react.createElement("span", { - className: "count" - }, "(", props.labelCount, ")")), props.children && (0, _base.base).react.createElement("div", { - className: "group-body" - }, props.children)); -} - -},{"../base":"3TPz5","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBkXL":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ToggleColumns", ()=>ToggleColumns); -var _base = require("../base"); -function ToggleColumns(props) { - return (0, _base.base).react.createElement("div", null, props.allColumns.map((c, i)=>(0, _base.base).react.createElement("div", { - key: c.name - }, (0, _base.base).react.createElement("label", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: props.exclusions.indexOf(c.name) < 0, - inlineLabel: true, - label: c.name, - onChange: ()=>props.toggleExclusion(c.name) - }))))); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eXzPo":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Search", ()=>Search); -var _searchTerm = require("../controls/searchTerm"); -var _base = require("../base"); -var _button = require("../controls/button"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -const maxClauses = 5; -function getColumnWithName(columnName, columns) { - for(let i = 0; i < columns.length; i++){ - if (columns[i].name === columnName) return columns[i]; - } -} -function validateExpression(ex) { - if (ex.operator === 'isnullorEmpty') { - ex.errorMessage = null; - return; - } - const s = (0, _searchTerm.getText)(ex); - if (s.length === 0) ex.errorMessage = (0, _language.strings).labelRequired; - else ex.errorMessage = null; -} -function clearExpressionValidation(ex) { - if (ex.operator === 'isnullorEmpty') { - ex.errorMessage = null; - return; - } - const s = (0, _searchTerm.getText)(ex); - if (s.length !== 0) ex.errorMessage = null; -} -function getGroupClauses(currClause, index, disableGroupOR) { - let keys; - if (index === 0) keys = [ - [ - null, - (0, _language.strings).searchWHERE - ] - ]; - else { - keys = [ - [ - '&&', - (0, _language.strings).searchAND - ] + } + const Chart = _Chart; + function TextField$1(props) { + return base$1.react.createElement(base$1.fluentUI.TextField, Object.assign({ onKeyUp: (e) => { + e.nativeEvent.stopImmediatePropagation(); + } }, props)); + } + const maxAutocomplete = 100; + function getValidOperators(column) { + const type2 = column && column.type; + switch (type2) { + case "boolean": + return [ + ["==", strings$1.searchEQ], + ["!=", strings$1.searchNEQ], + ["isnullorEmpty", strings$1.searchNULL] + ]; + case "date": + case "integer": + case "number": + return [ + ["==", strings$1.searchEQ], + ["!=", strings$1.searchNEQ], + [">", strings$1.searchGT], + [">=", strings$1.searchGTE], + ["<", strings$1.searchLT], + ["<=", strings$1.searchLTE], + ["isnullorEmpty", strings$1.searchNULL] + ]; + case "string": + default: + return [ + ["==", strings$1.searchEQ], + ["!=", strings$1.searchNEQ], + [">", strings$1.searchGT], + [">=", strings$1.searchGTE], + ["<", strings$1.searchLT], + ["<=", strings$1.searchLTE], + ["contains", strings$1.searchIN], + ["starts", strings$1.searchSW], + ["isnullorEmpty", strings$1.searchNULL] ]; - if (!disableGroupOR) keys.push([ - '||', - (0, _language.strings).searchOR - ]); - } - return keys.map((key, i)=>{ - const [clause, text] = key; - const selected = currClause == clause; //deliberate double equal - const option = { - key: i, - text, - data: clause, - selected - }; - return option; - }); -} -function _Search(_props) { - class __Search extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = this.getInitialState(this.props); - this.dropdownRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - } - getInitialState(props) { - const initialState = { - groups: props.initializer.search || [ - this.newGroup(0, null) - ], - sortedColumns: [ - ...props.initializer.columns - ].sort((a, b)=>a.name.localeCompare(b.name)), - initializer: props.initializer - }; - initialState.groups.forEach((group)=>{ - group.expressions.forEach((ex)=>ex.unlocked = group.expressions.length <= 2); - }); - return initialState; - } - componentDidUpdate() { - if (!(0, _sanddanceReact.util).deepCompare(this.props.initializer, this.state.initializer)) this.setState(this.getInitialState(this.props)); - } - validateAndSearch() { - const groups = [ - ...this.state.groups - ]; - groups.forEach((group)=>{ - group.expressions.forEach(validateExpression); - const errors = group.expressions.reduce((p, c)=>p || c.errorMessage, ''); - if (errors) this.setState({ - groups - }); - else this.props.onSelect(this.state.groups); - }); - } - newGroup(key, clause) { - const group = { - key, - clause, - expressions: [ - this.newExpression(0, null) - ] - }; - return group; - } - updateGroup(partialGroup, groupIndex) { - const groups = [ - ...this.state.groups - ]; - const group = Object.assign(Object.assign({}, groups[groupIndex]), partialGroup); - groups[groupIndex] = group; - this.setState({ - groups - }); - } - addGroup() { - const groups = [ - ...this.state.groups - ]; - const maxKey = groups.reduce((max, p)=>p.key > max ? p.key : max, groups[0].key); - const newGroup = this.newGroup(maxKey + 1, '&&'); - groups.push(newGroup); - this.setState({ - groups - }); - } - deleteGroup(groupIndex) { - const groups = [ - ...this.state.groups - ]; - groups.splice(groupIndex, 1); - this.setState({ - groups - }); - } - newExpression(key, clause) { - const ex = { - key, - clause, - name: null, - operator: 'contains', - value: '' - }; - return ex; - } - addExpression(groupIndex) { - const groups = [ - ...this.state.groups - ]; - const group = groups[groupIndex]; - const maxKey = group.expressions.reduce((max, p)=>p.key > max ? p.key : max, group.expressions[0].key); - const newEx = this.newExpression(maxKey + 1, '&&'); - group.expressions.push(newEx); - if (group.expressions.length === 2) newEx.unlocked = true; - else { - group.expressions.forEach((ex)=>ex.unlocked = false); - newEx.clause = group.expressions[1].clause; - } - this.setState({ - groups - }); - } - updateExpression(partialEx, groupIndex, index) { - const groups = [ - ...this.state.groups - ]; - const group = groups[groupIndex]; - const ex = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(group.expressions[index]); - if (ex.name !== partialEx.name) { - //choose an appropriate operator when switching data type - const oldColumn = getColumnWithName(ex.name, this.state.sortedColumns); - const newColumn = getColumnWithName(partialEx.name, this.state.sortedColumns); - const oldType = oldColumn && oldColumn.type; - const newType = newColumn && newColumn.type; - if (oldType !== newType) { - const newOperators = (0, _searchTerm.getValidOperators)(newColumn).map((validOperator)=>validOperator[0]); - //see if old operator is compatible - if (newOperators.indexOf(ex.operator) < 0) //not compatible, so choose "equal" - partialEx.operator = '=='; - } - } - Object.assign(ex, partialEx); - clearExpressionValidation(ex); - group.expressions[index] = ex; - this.setState({ - groups - }); - } - deleteExpression(groupIndex, index) { - const groups = [ - ...this.state.groups - ]; - const group = groups[groupIndex]; - const expressions = [ - ...group.expressions - ]; - expressions.splice(index, 1); - if (expressions.length === 2) expressions[1].unlocked = true; - group.expressions = expressions; - this.setState({ - groups - }); - } - render() { - return (0, _base.base).react.createElement((0, _group.Group), { - className: "sanddance-search", - label: (0, _language.strings).labelSearch - }, (0, _base.base).react.createElement("div", null, this.state.groups.map((group, groupIndex)=>(0, _base.base).react.createElement("div", { - className: "sanddance-search-group", - key: group.key - }, (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: this.props.collapseLabels, - className: "search-group-clause", - label: (0, _language.strings).labelSearchClause, - disabled: groupIndex === 0 || this.props.disableGroupOR, - dropdownWidth: 120, - options: getGroupClauses(group.clause, groupIndex, this.props.disableGroupOR), - onChange: (e, o)=>this.updateGroup({ - clause: o.data - }, groupIndex) - }), (0, _base.base).react.createElement("div", null, group.expressions.map((ex, i)=>(0, _base.base).react.createElement("div", { - className: "sanddance-search-expression", - key: ex.key - }, (0, _base.base).react.createElement((0, _searchTerm.SearchTerm), { - dropdownRef: groupIndex === 0 && i === 0 ? this.dropdownRef : undefined, - collapseLabels: this.props.collapseLabels, - onUpdateExpression: (ex, i)=>this.updateExpression(ex, groupIndex, i), - autoCompleteDistinctValues: this.props.autoCompleteDistinctValues, - index: i, - columns: this.state.sortedColumns, - data: this.props.data, - searchExpression: ex, - disableOR: this.props.disableExpressionOR, - column: getColumnWithName(ex.name, this.state.sortedColumns) - }), group.expressions.length > 1 && (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Cancel", - onClick: ()=>this.deleteExpression(groupIndex, i), - text: (0, _language.strings).buttonDeleteExpression - })))), group.expressions.length < maxClauses && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Add", - onClick: ()=>this.addExpression(groupIndex), - text: (0, _language.strings).buttonAddExpression - })), this.state.groups.length > 1 && (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Cancel", - onClick: ()=>this.deleteGroup(groupIndex), - text: (0, _language.strings).buttonDeleteExpressionGroup - }))), this.state.groups.length < maxClauses && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action search-bottom-action", - iconName: "Add", - onClick: ()=>this.addGroup(), - text: (0, _language.strings).buttonAddExpressionGroup - }))), (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - className: "search-action search-bottom-action", - text: (0, _language.strings).buttonSelect, - onClick: ()=>this.validateAndSearch() - })); - } - } - return new __Search(_props); -} -const Search = _Search; - -},{"../controls/searchTerm":"6ZfbH","../base":"3TPz5","../controls/button":"f8wtc","../controls/dropdown":"7pP8h","../controls/group":"afKlW","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6ZfbH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "maxAutocomplete", ()=>maxAutocomplete); -parcelHelpers.export(exports, "getValidOperators", ()=>getValidOperators); -parcelHelpers.export(exports, "getText", ()=>getText); -parcelHelpers.export(exports, "SearchTerm", ()=>SearchTerm); -var _dropdown = require("./dropdown"); -var _textfield = require("./textfield"); -var _base = require("../base"); -var _language = require("../language"); -const maxAutocomplete = 100; -function getValidOperators(column) { - const type = column && column.type; - switch(type){ - case 'boolean': - return [ - [ - '==', - (0, _language.strings).searchEQ - ], - [ - '!=', - (0, _language.strings).searchNEQ - ], - [ - 'isnullorEmpty', - (0, _language.strings).searchNULL - ] - ]; - case 'date': - case 'integer': - case 'number': - return [ - [ - '==', - (0, _language.strings).searchEQ - ], - [ - '!=', - (0, _language.strings).searchNEQ - ], - [ - '>', - (0, _language.strings).searchGT - ], - [ - '>=', - (0, _language.strings).searchGTE - ], - [ - '<', - (0, _language.strings).searchLT - ], - [ - '<=', - (0, _language.strings).searchLTE - ], - [ - 'isnullorEmpty', - (0, _language.strings).searchNULL - ] - ]; - case 'string': - default: - return [ - [ - '==', - (0, _language.strings).searchEQ - ], - [ - '!=', - (0, _language.strings).searchNEQ - ], - [ - '>', - (0, _language.strings).searchGT - ], - [ - '>=', - (0, _language.strings).searchGTE - ], - [ - '<', - (0, _language.strings).searchLT - ], - [ - '<=', - (0, _language.strings).searchLTE - ], - [ - 'contains', - (0, _language.strings).searchIN - ], - [ - 'starts', - (0, _language.strings).searchSW - ], - [ - 'isnullorEmpty', - (0, _language.strings).searchNULL - ] - ]; } -} -function getExpressionClauses(currClause, disableOR) { - const keys = [ - [ - '&&', - (0, _language.strings).searchAND - ] + } + function getExpressionClauses(currClause, disableOR) { + const keys2 = [ + ["&&", strings$1.searchAND] ]; - if (!disableOR) keys.push([ - '||', - (0, _language.strings).searchOR - ]); - return keys.map((key, i)=>{ - const [clause, text] = key; - const selected = currClause == clause; //deliberate double equal - const option = { - key: i, - text, - data: clause, - selected - }; - return option; + if (!disableOR) { + keys2.push(["||", strings$1.searchOR]); + } + return keys2.map((key2, i) => { + const [clause, text2] = key2; + const selected = currClause == clause; + const option = { + key: i, + text: text2, + data: clause, + selected + }; + return option; }); -} -function getOperators(ex, column) { + } + function getOperators(ex, column) { let anySelected = false; const validOperators = getValidOperators(column); - const options = validOperators.map((validoperator)=>{ - const [op, text] = validoperator; - const selected = ex.operator === op; - anySelected = anySelected || selected; - const option = { - key: op, - text, - data: op, - selected - }; - return option; + const options2 = validOperators.map((validoperator) => { + const [op, text2] = validoperator; + const selected = ex.operator === op; + anySelected = anySelected || selected; + const option = { + key: op, + text: text2, + data: op, + selected + }; + return option; }); - if (!anySelected) options[0].selected = true; - return options; -} -function getDistinctValues(data, columnName) { + if (!anySelected) { + options2[0].selected = true; + } + return options2; + } + function getDistinctValues(data2, columnName) { const distinctMap = {}; - for(let i = 0; i < data.length; i++){ - const row = data[i]; - const value = row[columnName]; - distinctMap[value] = true; + for (let i = 0; i < data2.length; i++) { + const row = data2[i]; + const value2 = row[columnName]; + distinctMap[value2] = true; } return Object.keys(distinctMap).sort(); -} -function getValues(ex, column, data, autoCompleteDistinctValues) { + } + function getValues(ex, column, data2, autoCompleteDistinctValues) { const stats = column && column.stats; if (stats && stats.distinctValueCount < maxAutocomplete) { - if (!autoCompleteDistinctValues[column.name]) autoCompleteDistinctValues[column.name] = getDistinctValues(data, column.name); - return autoCompleteDistinctValues[column.name].map((v, i)=>({ - key: i, - text: v - })); + if (!autoCompleteDistinctValues[column.name]) { + autoCompleteDistinctValues[column.name] = getDistinctValues(data2, column.name); + } + return autoCompleteDistinctValues[column.name].map((v, i) => ({ + key: i, + text: v + })); } return []; -} -function getText(ex) { - if (ex.operator === 'isnullorEmpty') return ''; - return typeof ex.value === 'string' ? ex.value : ex.value == null ? '' : ex.value.toString(); -} -function SearchTerm(props) { + } + function getText(ex) { + if (ex.operator === "isnullorEmpty") + return ""; + return typeof ex.value === "string" ? ex.value : ex.value == null ? "" : ex.value.toString(); + } + function SearchTerm(props) { const ex = props.searchExpression; const possibleValues = getValues(ex, props.column, props.data, props.autoCompleteDistinctValues); - //TODO better date handling with calendar picker - return (0, _base.base).react.createElement("div", null, props.index > 0 && (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, _language.strings).labelSearchClause, - dropdownWidth: 120, - disabled: !ex.unlocked || props.disableOR, - options: getExpressionClauses(ex.clause, props.disableOR), - onChange: (e, o)=>props.onUpdateExpression({ - clause: o.data - }, props.index) - }), (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - componentRef: props.dropdownRef, - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, _language.strings).labelSearchColumn, - options: [ - { - key: '', - text: (0, _language.strings).selectAny, - data: null, - selected: ex.name === null - } - ].concat(props.columns.map((c, i)=>({ - key: c.name, - text: c.name, - data: c, - selected: c.name === ex.name - }))), - onChange: (e, o)=>props.onUpdateExpression({ - name: o.data && o.data.name || null - }, props.index) - }), (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, _language.strings).labelSearchOperator, - dropdownWidth: 120, - options: getOperators(ex, props.column), - onChange: (e, o)=>props.onUpdateExpression({ - operator: o.data - }, props.index) - }), possibleValues.length > 0 && (0, _base.base).react.createElement((0, _base.base).fluentUI.ComboBox, { - className: "search-field", - label: props.collapseLabels ? null : (0, _language.strings).labelSearchValue, - placeholder: (0, _language.strings).labelSearchValuePlaceholder, - disabled: ex.operator === 'isnullorEmpty', - dropdownWidth: (0, _dropdown.dropdownWidth), - allowFreeform: true, - autoComplete: "on", - errorMessage: ex.errorMessage, - text: getText(ex), - options: getValues(ex, props.column, props.data, props.autoCompleteDistinctValues), - onChange: (e, o, i, value)=>{ - if (o) value = o.text; - props.onUpdateExpression({ - value - }, props.index); - } - }), possibleValues.length === 0 && (0, _base.base).react.createElement((0, _textfield.TextField), { - className: "search-field", - label: props.collapseLabels ? null : (0, _language.strings).labelSearchValue, - placeholder: (0, _language.strings).labelSearchValuePlaceholder, - disabled: ex.operator === 'isnullorEmpty', - errorMessage: ex.errorMessage, - value: getText(ex), - onChange: (e, v)=>props.onUpdateExpression({ - value: v - }, props.index) - })); -} - -},{"./dropdown":"7pP8h","./textfield":"1HIvT","../base":"3TPz5","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1HIvT":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextField", ()=>TextField); -var _base = require("../base"); -function TextField(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, Object.assign({ - onKeyUp: (e)=>{ - e.nativeEvent.stopImmediatePropagation(); - } - }, props)); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8wtc":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Button", ()=>Button); -var _base = require("../base"); -function Button(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, Object.assign({}, props, { - styles: { - root: Object.assign({ - backgroundColor: 'transparent', - height: '30px', - width: props.width, - padding: 0 - }, props.rootStyle), - rootDisabled: { - backgroundColor: 'transparent' - }, - icon: { - color: props.themePalette.themePrimary - }, - label: { - fontWeight: '400', - textAlign: props.textAlign || 'left' - } - }, - iconProps: { - iconName: props.iconName + return base$1.react.createElement( + "div", + null, + props.index > 0 && base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabels, className: "search-field", label: strings$1.labelSearchClause, dropdownWidth: 120, disabled: !ex.unlocked || props.disableOR, options: getExpressionClauses(ex.clause, props.disableOR), onChange: (e, o) => props.onUpdateExpression({ clause: o.data }, props.index) }), + base$1.react.createElement(Dropdown$1, { componentRef: props.dropdownRef, collapseLabel: props.collapseLabels, className: "search-field", label: strings$1.labelSearchColumn, options: [ + { + key: "", + text: strings$1.selectAny, + data: null, + selected: ex.name === null + } + ].concat(props.columns.map((c2, i) => ({ + key: c2.name, + text: c2.name, + data: c2, + selected: c2.name === ex.name + }))), onChange: (e, o) => props.onUpdateExpression({ name: o.data && o.data.name || null }, props.index) }), + base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabels, className: "search-field", label: strings$1.labelSearchOperator, dropdownWidth: 120, options: getOperators(ex, props.column), onChange: (e, o) => props.onUpdateExpression({ operator: o.data }, props.index) }), + possibleValues.length > 0 && base$1.react.createElement(base$1.fluentUI.ComboBox, { className: "search-field", label: props.collapseLabels ? null : strings$1.labelSearchValue, placeholder: strings$1.labelSearchValuePlaceholder, disabled: ex.operator === "isnullorEmpty", dropdownWidth, allowFreeform: true, autoComplete: "on", errorMessage: ex.errorMessage, text: getText(ex), options: getValues(ex, props.column, props.data, props.autoCompleteDistinctValues), onChange: (e, o, i, value2) => { + if (o) { + value2 = o.text; + } + props.onUpdateExpression({ value: value2 }, props.index); + } }), + possibleValues.length === 0 && base$1.react.createElement(TextField$1, { className: "search-field", label: props.collapseLabels ? null : strings$1.labelSearchValue, placeholder: strings$1.labelSearchValuePlaceholder, disabled: ex.operator === "isnullorEmpty", errorMessage: ex.errorMessage, value: getText(ex), onChange: (e, v) => props.onUpdateExpression({ value: v }, props.index) }) + ); + } + function Button(props) { + return base$1.react.createElement(base$1.fluentUI.DefaultButton, Object.assign({}, props, { styles: { + root: Object.assign({ backgroundColor: "transparent", height: "30px", width: props.width, padding: 0 }, props.rootStyle), + rootDisabled: { + backgroundColor: "transparent" + }, + icon: { + color: props.themePalette.themePrimary + }, + label: { + fontWeight: "400", + textAlign: props.textAlign || "left" + } + }, iconProps: { iconName: props.iconName } })); + } + const maxClauses = 5; + function getColumnWithName(columnName, columns) { + for (let i = 0; i < columns.length; i++) { + if (columns[i].name === columnName) + return columns[i]; + } + } + function validateExpression(ex) { + if (ex.operator === "isnullorEmpty") { + ex.errorMessage = null; + return; + } + const s2 = getText(ex); + if (s2.length === 0) { + ex.errorMessage = strings$1.labelRequired; + } else { + ex.errorMessage = null; + } + } + function clearExpressionValidation(ex) { + if (ex.operator === "isnullorEmpty") { + ex.errorMessage = null; + return; + } + const s2 = getText(ex); + if (s2.length !== 0) { + ex.errorMessage = null; + } + } + function getGroupClauses(currClause, index2, disableGroupOR) { + let keys2; + if (index2 === 0) { + keys2 = [ + [null, strings$1.searchWHERE] + ]; + } else { + keys2 = [ + ["&&", strings$1.searchAND] + ]; + if (!disableGroupOR) { + keys2.push(["||", strings$1.searchOR]); + } + } + return keys2.map((key2, i) => { + const [clause, text2] = key2; + const selected = currClause == clause; + const option = { + key: i, + text: text2, + data: clause, + selected + }; + return option; + }); + } + function _Search(_props) { + class __Search extends base$1.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(this.props); + this.dropdownRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = this.dropdownRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + } + getInitialState(props) { + const initialState = { + groups: props.initializer.search || [this.newGroup(0, null)], + sortedColumns: [...props.initializer.columns].sort((a2, b2) => a2.name.localeCompare(b2.name)), + initializer: props.initializer + }; + initialState.groups.forEach((group2) => { + group2.expressions.forEach((ex) => ex.unlocked = group2.expressions.length <= 2); + }); + return initialState; + } + componentDidUpdate() { + if (!deepCompare(this.props.initializer, this.state.initializer)) { + this.setState(this.getInitialState(this.props)); } - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2xbhO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Settings", ()=>Settings); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _base = require("../base"); -var _canvas = require("../canvas"); -var _dialog = require("../controls/dialog"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _signal = require("../controls/signal"); -var _language = require("../language"); -var _version = require("../version"); -var SandDance = _sanddanceReact.SandDance; -var DataRefType; -(function(DataRefType) { - DataRefType[DataRefType["none"] = 0] = "none"; - DataRefType[DataRefType["inline"] = 1] = "inline"; - DataRefType[DataRefType["url"] = 2] = "url"; -})(DataRefType || (DataRefType = {})); -function filterSignals(signal) { - switch(signal.name){ - case SandDance.constants.SignalNames.XBins: - case SandDance.constants.SignalNames.YBins: - case SandDance.constants.SignalNames.FacetBins: - case SandDance.constants.SignalNames.FacetVBins: - case SandDance.constants.SignalNames.ColorBinCount: - case SandDance.constants.SignalNames.ColorReverse: - case SandDance.constants.SignalNames.PointScale: - case SandDance.constants.SignalNames.TreeMapMethod: - case SandDance.constants.SignalNames.ZGrounded: - return false; - default: - return !!signal.bind; + } + validateAndSearch() { + const groups = [...this.state.groups]; + groups.forEach((group2) => { + group2.expressions.forEach(validateExpression); + const errors = group2.expressions.reduce((p, c2) => p || c2.errorMessage, ""); + if (errors) { + this.setState({ groups }); + } else { + this.props.onSelect(this.state.groups); + } + }); + } + newGroup(key2, clause) { + const group2 = { + key: key2, + clause, + expressions: [this.newExpression(0, null)] + }; + return group2; + } + updateGroup(partialGroup, groupIndex) { + const groups = [...this.state.groups]; + const group2 = Object.assign(Object.assign({}, groups[groupIndex]), partialGroup); + groups[groupIndex] = group2; + this.setState({ groups }); + } + addGroup() { + const groups = [...this.state.groups]; + const maxKey = groups.reduce((max2, p) => p.key > max2 ? p.key : max2, groups[0].key); + const newGroup = this.newGroup(maxKey + 1, "&&"); + groups.push(newGroup); + this.setState({ groups }); + } + deleteGroup(groupIndex) { + const groups = [...this.state.groups]; + groups.splice(groupIndex, 1); + this.setState({ groups }); + } + newExpression(key2, clause) { + const ex = { key: key2, clause, name: null, operator: "contains", value: "" }; + return ex; + } + addExpression(groupIndex) { + const groups = [...this.state.groups]; + const group2 = Object.assign({}, groups[groupIndex]); + const expressions = [...group2.expressions]; + const maxKey = expressions.reduce((max2, p) => p.key > max2 ? p.key : max2, expressions[0].key); + const newEx = this.newExpression(maxKey + 1, "&&"); + expressions.push(newEx); + if (expressions.length === 2) { + newEx.unlocked = true; + } else { + expressions.forEach((ex) => ex.unlocked = false); + newEx.clause = expressions[1].clause; + } + group2.expressions = expressions; + groups[groupIndex] = group2; + this.setState({ groups }); + } + updateExpression(partialEx, groupIndex, index2) { + const groups = [...this.state.groups]; + const group2 = Object.assign({}, groups[groupIndex]); + const expressions = [...group2.expressions]; + const currentEx = expressions[index2]; + if (currentEx.name !== partialEx.name) { + const oldColumn = getColumnWithName(currentEx.name, this.state.sortedColumns); + const newColumn = getColumnWithName(partialEx.name, this.state.sortedColumns); + const oldType = oldColumn && oldColumn.type; + const newType = newColumn && newColumn.type; + if (oldType !== newType) { + const newOperators = getValidOperators(newColumn).map((validOperator) => validOperator[0]); + if (newOperators.indexOf(currentEx.operator) < 0) { + partialEx.operator = "=="; + } + } + } + const ex = Object.assign(Object.assign({}, currentEx), partialEx); + clearExpressionValidation(ex); + expressions[index2] = ex; + group2.expressions = expressions; + groups[groupIndex] = group2; + this.setState({ groups }); + } + deleteExpression(groupIndex, index2) { + const groups = [...this.state.groups]; + const group2 = Object.assign({}, groups[groupIndex]); + const expressions = [...group2.expressions]; + expressions.splice(index2, 1); + if (expressions.length === 2) { + expressions[1].unlocked = true; + } + group2.expressions = expressions; + groups[groupIndex] = group2; + this.setState({ groups }); + } + render() { + return base$1.react.createElement( + Group$1, + { className: "sanddance-search", label: strings$1.labelSearch }, + base$1.react.createElement( + "div", + null, + this.state.groups.map((group2, groupIndex) => base$1.react.createElement( + "div", + { className: "sanddance-search-group", key: group2.key }, + base$1.react.createElement(Dropdown$1, { collapseLabel: this.props.collapseLabels, className: "search-group-clause", label: strings$1.labelSearchClause, disabled: groupIndex === 0 || this.props.disableGroupOR, dropdownWidth: 120, options: getGroupClauses(group2.clause, groupIndex, this.props.disableGroupOR), onChange: (e, o) => this.updateGroup({ clause: o.data }, groupIndex) }), + base$1.react.createElement("div", null, group2.expressions.map((ex, i) => base$1.react.createElement( + "div", + { className: "sanddance-search-expression", key: ex.key }, + base$1.react.createElement(SearchTerm, { dropdownRef: groupIndex === 0 && i === 0 ? this.dropdownRef : void 0, collapseLabels: this.props.collapseLabels, onUpdateExpression: (ex2, i2) => this.updateExpression(ex2, groupIndex, i2), autoCompleteDistinctValues: this.props.autoCompleteDistinctValues, index: i, columns: this.state.sortedColumns, data: this.props.data, searchExpression: ex, disableOR: this.props.disableExpressionOR, column: getColumnWithName(ex.name, this.state.sortedColumns) }), + group2.expressions.length > 1 && base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action", iconName: "Cancel", onClick: () => this.deleteExpression(groupIndex, i), text: strings$1.buttonDeleteExpression }) + ))), + group2.expressions.length < maxClauses && base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action", iconName: "Add", onClick: () => this.addExpression(groupIndex), text: strings$1.buttonAddExpression }) + ), + this.state.groups.length > 1 && base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action", iconName: "Cancel", onClick: () => this.deleteGroup(groupIndex), text: strings$1.buttonDeleteExpressionGroup }) + )), + this.state.groups.length < maxClauses && base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action search-bottom-action", iconName: "Add", onClick: () => this.addGroup(), text: strings$1.buttonAddExpressionGroup }) + ) + ), + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { className: "search-action search-bottom-action", text: strings$1.buttonSelect, onClick: () => this.validateAndSearch() }) + ); + } + } + return new __Search(_props); + } + const Search = _Search; + var PresenterElement = PresenterElement$1; + function getCanvas(viewer) { + const tags = viewer.presenter.getElement(PresenterElement.gl).getElementsByTagName("canvas"); + if (tags) { + return tags[0]; + } + } + function removeTabIndex(viewer) { + const canvas = getCanvas(viewer); + if (canvas) { + canvas.tabIndex = -1; + } + } + const capabilities = { + webgl: !!document.createElement("canvas").getContext("webgl"), + webgl2: !!document.createElement("canvas").getContext("webgl2") + }; + const version$2 = "4.1.8"; + var SandDance = index$4; + var DataRefType; + (function(DataRefType2) { + DataRefType2[DataRefType2["none"] = 0] = "none"; + DataRefType2[DataRefType2["inline"] = 1] = "inline"; + DataRefType2[DataRefType2["url"] = 2] = "url"; + })(DataRefType || (DataRefType = {})); + function filterSignals(signal) { + switch (signal.name) { + case SandDance.constants.SignalNames.XBins: + case SandDance.constants.SignalNames.YBins: + case SandDance.constants.SignalNames.FacetBins: + case SandDance.constants.SignalNames.FacetVBins: + case SandDance.constants.SignalNames.ColorBinCount: + case SandDance.constants.SignalNames.ColorReverse: + case SandDance.constants.SignalNames.PointScale: + case SandDance.constants.SignalNames.TreeMapMethod: + case SandDance.constants.SignalNames.ZGrounded: + return false; + default: + return !!signal.bind; } -} -function cloneData(vegaSpec) { + } + function cloneData(vegaSpec) { const data0 = vegaSpec.data[0]; const valuesData = data0; - const values = valuesData.values; + const values2 = valuesData.values; delete valuesData.values; - const data = SandDance.VegaMorphCharts.util.clone(vegaSpec.data); - valuesData.values = values; - return { - data, - values - }; -} -function cloneScales(vegaSpec) { + const data2 = SandDance.VegaMorphCharts.util.clone(vegaSpec.data); + valuesData.values = values2; + return { data: data2, values: values2 }; + } + function cloneScales(vegaSpec) { return SandDance.VegaMorphCharts.util.clone(vegaSpec.scales); -} -function serializeSpec(vegaSpec, datafile, dataRefType, transform, scheme) { - const scales = cloneScales(vegaSpec); - const colorScale = scales.filter((scale)=>scale.name === SandDance.constants.ScaleNames.Color)[0]; - if (scheme.indexOf('dual_') >= 0) colorScale.range = SandDance.colorSchemes.filter((cs)=>cs.scheme === scheme)[0].colors; - const clone = cloneData(vegaSpec); - const data0 = clone.data[0]; + } + function serializeSpec(vegaSpec, datafile, dataRefType, transform2, scheme2) { + const scales2 = cloneScales(vegaSpec); + const colorScale = scales2.filter((scale2) => scale2.name === SandDance.constants.ScaleNames.Color)[0]; + if (scheme2.indexOf("dual_") >= 0) { + colorScale.range = SandDance.colorSchemes.filter((cs) => cs.scheme === scheme2)[0].colors; + } + const clone2 = cloneData(vegaSpec); + const data0 = clone2.data[0]; if (dataRefType === DataRefType.inline) { - const valuesData = data0; - valuesData.format = { - parse: 'auto', - type: 'json' - }; - valuesData.values = clone.values; + const valuesData = data0; + valuesData.format = { parse: "auto", type: "json" }; + valuesData.values = clone2.values; } else if (dataRefType === DataRefType.none) { - const valuesData = data0; - valuesData.values = []; - if (transform) { - if (valuesData.transform) valuesData.transform.push.apply(valuesData.transform, transform); - else valuesData.transform = transform; + const valuesData = data0; + valuesData.values = []; + if (transform2) { + if (valuesData.transform) { + valuesData.transform.push.apply(valuesData.transform, transform2); + } else { + valuesData.transform = transform2; } + } } else if (dataRefType === DataRefType.url) { - const urlData = data0; - urlData.url = datafile.dataUrl; - urlData.format = { - parse: 'auto', - type: datafile.type - }; - if (transform) { - if (urlData.transform) urlData.transform.push.apply(urlData.transform, transform); - else urlData.transform = transform; + const urlData = data0; + urlData.url = datafile.dataUrl; + urlData.format = { parse: "auto", type: datafile.type }; + if (transform2) { + if (urlData.transform) { + urlData.transform.push.apply(urlData.transform, transform2); + } else { + urlData.transform = transform2; } + } + } + return Object.assign(Object.assign({}, vegaSpec), { data: clone2.data, scales: scales2 }); + } + function defaultDataRefType(datafile) { + if (datafile.dataUrl) { + return DataRefType.url; } - return Object.assign(Object.assign({}, vegaSpec), { - data: clone.data, - scales - }); -} -function defaultDataRefType(datafile) { - if (datafile.dataUrl) return DataRefType.url; return DataRefType.none; -} -function initState(props) { + } + function initState(props) { return { - showSystemDialog: false, - showVegaDialog: false, - dataRefType: defaultDataRefType(props.dataFile), - spec: null - }; -} -function signalGroupKey(key) { - for(let i = 0; i < (0, _language.strings).signalGroups.length; i++){ - if ((0, _language.strings).signalGroups[i].prefix === key) return key; - } - return '*'; -} -function vegaSignalGroups(vegaSignals) { + showSystemDialog: false, + showVegaDialog: false, + dataRefType: defaultDataRefType(props.dataFile), + spec: null + }; + } + function signalGroupKey(key2) { + for (let i = 0; i < strings$1.signalGroups.length; i++) { + if (strings$1.signalGroups[i].prefix === key2) { + return key2; + } + } + return "*"; + } + function vegaSignalGroups(vegaSignals) { const signalGroupMap = {}; - vegaSignals.forEach((vs)=>{ - const split = vs.name.split('_'); - const key = signalGroupKey(split[0]); - signalGroupMap[key] = signalGroupMap[key] || []; - signalGroupMap[key].push(vs); + vegaSignals.forEach((vs) => { + const split = vs.name.split("_"); + const key2 = signalGroupKey(split[0]); + signalGroupMap[key2] = signalGroupMap[key2] || []; + signalGroupMap[key2].push(vs); }); return signalGroupMap; -} -function _Settings(_props) { - class __Settings extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = initState(props); - } - render() { - const { props, state } = this; - if (!props.explorer.viewer || !props.explorer.viewer.vegaSpec) return null; - const options = [ - { - key: DataRefType.none, - text: (0, _language.strings).selectVegaSpecDataNone, - selected: this.state.dataRefType === DataRefType.none, - data: DataRefType.none - }, - !props.dataFile.rawText && { - key: DataRefType.url, - text: (0, _language.strings).selectVegaSpecDataUrl, - selected: this.state.dataRefType === DataRefType.url, - data: DataRefType.url - }, - { - key: DataRefType.inline, - text: (0, _language.strings).selectVegaSpecDataInline, - selected: this.state.dataRefType === DataRefType.inline, - data: DataRefType.inline - } - ].filter(Boolean); - const signalGroupMap = vegaSignalGroups(props.explorer.viewer.vegaSpec.signals); - let first = true; - return (0, _base.base).react.createElement("div", null, (0, _language.strings).signalGroups.map((sg, gi)=>{ - const vegaSignals = signalGroupMap[sg.prefix]; - if (vegaSignals) { - const filteredVegaSignals = vegaSignals.filter(filterSignals); - if (filteredVegaSignals.length > 0) return (0, _base.base).react.createElement((0, _group.Group), { - key: sg.prefix, - label: sg.label - }, filteredVegaSignals.map((signal, i)=>{ - const ref = (0, _base.base).react.createRef(); - if (first) { - first = false; - props.explorer.dialogFocusHandler.focus = ()=>{ - const f = ref.current; - if (f === null || f === void 0 ? void 0 : f.focus) f.focus(); - }; - } - return (0, _base.base).react.createElement((0, _signal.Signal), { - componentRef: ref, - key: i, - signal: signal, - explorer: props.explorer, - initialValue: (0, _signal.getInitialSignalValue)(props.explorer, signal), - newViewStateTarget: false - }); - })); - } - }), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelChartCanvas - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelShowAxes, - defaultChecked: !props.hideAxes, - onChange: (e, checked)=>props.onToggleAxes(!checked) - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelShowLegend, - defaultChecked: !props.hideLegend, - onChange: (e, checked)=>props.onToggleLegend(!checked) - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTools - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - text: (0, _language.strings).buttonShowVegaSpec, - onClick: ()=>this.setState({ - showVegaDialog: true, - spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, this.state.dataRefType, props.explorer.viewer.getInsight().transform, this.props.scheme) - }) - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelSnapshots - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelSnapshotSettingThumbnailWidth, - onChange: (value)=>{ - this.props.explorer.snapshotThumbWidth = value; - }, - min: 100, - max: 800, - defaultValue: this.props.explorer.snapshotThumbWidth - })), props.additionalSettings && props.additionalSettings.map((g, i)=>(0, _base.base).react.createElement((0, _group.Group), { - key: i, - label: g.groupLabel - }, g.children)), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelSystem - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - text: (0, _language.strings).labelSystemInfo, - onClick: ()=>this.setState({ - showSystemDialog: true - }) - })), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !state.showVegaDialog, - onDismiss: ()=>this.setState(initState(this.props)), - minWidth: "80%", - title: (0, _language.strings).labelVegaSpec, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: "copy", - iconProps: { - iconName: 'Copy' - }, - text: (0, _language.strings).buttonCopyToClipboard, - onClick: ()=>{ - const pre = document.getElementById('sanddance-vega-spec'); - const range = document.createRange(); - range.selectNode(pre); - const selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - document.execCommand('copy'); - } - }), - (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: "edit", - iconProps: { - iconName: 'OpenInNewWindow' - }, - text: (0, _language.strings).buttonLaunchVegaEditor, - onClick: ()=>{ - window.open('https://vega.github.io/editor/', '_blank'); - } - }) - ] - }, (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - label: (0, _language.strings).labelVegaSpecData, - options: options, - onChange: (e, o)=>this.setState({ - dataRefType: o.data, - spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, o.data, props.explorer.viewer.getInsight().transform, this.props.scheme) - }) - }), (0, _base.base).react.createElement("pre", { - id: "sanddance-vega-spec" - }, JSON.stringify(this.state.spec, null, 2)), (0, _base.base).react.createElement("div", null, (0, _language.strings).labelVegaSpecNotes)), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !state.showSystemDialog, - onDismiss: ()=>this.setState(initState(this.props)), - title: (0, _language.strings).labelSystemInfo - }, (0, _base.base).react.createElement("ul", null, this.props.children, (0, _base.base).react.createElement("li", null, "SandDanceExplorer version: ", (0, _version.version)), (0, _base.base).react.createElement("li", null, "SandDanceReact version: ", _sanddanceReact.version), (0, _base.base).react.createElement("li", null, "SandDance version: ", SandDance.version), (0, _base.base).react.createElement("li", null, "Vega-MorphCharts version: ", SandDance.VegaMorphCharts.version), (0, _base.base).react.createElement("li", null, "WebGL enabled: ", (0, _canvas.capabilities).webgl ? (0, _language.strings).labelYes : (0, _language.strings).labelNo), (0, _base.base).react.createElement("li", null, "WebGL2 enabled: ", (0, _canvas.capabilities).webgl2 ? (0, _language.strings).labelYes : (0, _language.strings).labelNo)))); - } + } + function _Settings(_props) { + class __Settings extends base$1.react.Component { + constructor(props) { + super(props); + this.state = initState(props); + } + render() { + const { props, state } = this; + if (!props.explorer.viewer || !props.explorer.viewer.vegaSpec) + return null; + const options2 = [ + { + key: DataRefType.none, + text: strings$1.selectVegaSpecDataNone, + selected: this.state.dataRefType === DataRefType.none, + data: DataRefType.none + }, + !props.dataFile.rawText && { + key: DataRefType.url, + text: strings$1.selectVegaSpecDataUrl, + selected: this.state.dataRefType === DataRefType.url, + data: DataRefType.url + }, + { + key: DataRefType.inline, + text: strings$1.selectVegaSpecDataInline, + selected: this.state.dataRefType === DataRefType.inline, + data: DataRefType.inline + } + ].filter(Boolean); + const signalGroupMap = vegaSignalGroups(props.explorer.viewer.vegaSpec.signals); + let first = true; + return base$1.react.createElement( + "div", + null, + strings$1.signalGroups.map((sg, gi) => { + const vegaSignals = signalGroupMap[sg.prefix]; + if (vegaSignals) { + const filteredVegaSignals = vegaSignals.filter(filterSignals); + if (filteredVegaSignals.length > 0) { + return base$1.react.createElement(Group$1, { key: sg.prefix, label: sg.label }, filteredVegaSignals.map((signal, i) => { + const ref2 = base$1.react.createRef(); + if (first) { + first = false; + props.explorer.dialogFocusHandler.focus = () => { + const f = ref2.current; + if (f === null || f === void 0 ? void 0 : f.focus) { + f.focus(); + } + }; + } + return base$1.react.createElement(Signal, { componentRef: ref2, key: i, signal, explorer: props.explorer, initialValue: getInitialSignalValue(props.explorer, signal), newViewStateTarget: false }); + })); + } + } + }), + base$1.react.createElement( + Group$1, + { label: strings$1.labelChartCanvas }, + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelShowAxes, defaultChecked: !props.hideAxes, onChange: (e, checked) => props.onToggleAxes(!checked) }), + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelShowLegend, defaultChecked: !props.hideLegend, onChange: (e, checked) => props.onToggleLegend(!checked) }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTools }, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { text: strings$1.buttonShowVegaSpec, onClick: () => this.setState({ + showVegaDialog: true, + spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, this.state.dataRefType, props.explorer.viewer.getInsight().transform, this.props.scheme) + }) }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelSnapshots }, + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelSnapshotSettingThumbnailWidth, onChange: (value2) => { + this.props.explorer.snapshotThumbWidth = value2; + }, min: 100, max: 800, defaultValue: this.props.explorer.snapshotThumbWidth }) + ), + props.additionalSettings && props.additionalSettings.map((g, i) => base$1.react.createElement(Group$1, { key: i, label: g.groupLabel }, g.children)), + base$1.react.createElement( + Group$1, + { label: strings$1.labelSystem }, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { text: strings$1.labelSystemInfo, onClick: () => this.setState({ showSystemDialog: true }) }) + ), + base$1.react.createElement( + Dialog$1, + { hidden: !state.showVegaDialog, onDismiss: () => this.setState(initState(this.props)), minWidth: "80%", title: strings$1.labelVegaSpec, buttons: [ + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: "copy", iconProps: { iconName: "Copy" }, text: strings$1.buttonCopyToClipboard, onClick: () => { + const pre = document.getElementById("sanddance-vega-spec"); + const range2 = document.createRange(); + range2.selectNode(pre); + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range2); + document.execCommand("copy"); + } }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "edit", iconProps: { iconName: "OpenInNewWindow" }, text: strings$1.buttonLaunchVegaEditor, onClick: () => { + window.open("https://vega.github.io/editor/", "_blank"); + } }) + ] }, + base$1.react.createElement(Dropdown$1, { label: strings$1.labelVegaSpecData, options: options2, onChange: (e, o) => this.setState({ + dataRefType: o.data, + spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, o.data, props.explorer.viewer.getInsight().transform, this.props.scheme) + }) }), + base$1.react.createElement("pre", { id: "sanddance-vega-spec" }, JSON.stringify(this.state.spec, null, 2)), + base$1.react.createElement("div", null, strings$1.labelVegaSpecNotes) + ), + base$1.react.createElement( + Dialog$1, + { hidden: !state.showSystemDialog, onDismiss: () => this.setState(initState(this.props)), title: strings$1.labelSystemInfo }, + base$1.react.createElement( + "ul", + null, + this.props.children, + base$1.react.createElement( + "li", + null, + "SandDanceExplorer version: ", + version$2 + ), + base$1.react.createElement( + "li", + null, + "SandDanceReact version: ", + version$3 + ), + base$1.react.createElement( + "li", + null, + "SandDance version: ", + SandDance.version + ), + base$1.react.createElement( + "li", + null, + "Vega-MorphCharts version: ", + SandDance.VegaMorphCharts.version + ), + base$1.react.createElement( + "li", + null, + "WebGL enabled: ", + capabilities.webgl ? strings$1.labelYes : strings$1.labelNo + ), + base$1.react.createElement( + "li", + null, + "WebGL2 enabled: ", + capabilities.webgl2 ? strings$1.labelYes : strings$1.labelNo + ) + ) + ) + ); + } } return new __Settings(_props); -} -const Settings = _Settings; - -},{"@msrvida/sanddance-react":"lPyTZ","../base":"3TPz5","../canvas":"55nq5","../controls/dialog":"OQi9w","../controls/dropdown":"7pP8h","../controls/group":"afKlW","../controls/signal":"buTZe","../language":"67xOI","../version":"CFT5Q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55nq5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getCanvas", ()=>getCanvas); -parcelHelpers.export(exports, "removeTabIndex", ()=>removeTabIndex); -parcelHelpers.export(exports, "capabilities", ()=>capabilities); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var PresenterElement = (0, _sanddanceReact.SandDance).VegaMorphCharts.PresenterElement; -function getCanvas(viewer) { - const tags = viewer.presenter.getElement(PresenterElement.gl).getElementsByTagName('canvas'); - if (tags) return tags[0]; -} -function removeTabIndex(viewer) { - const canvas = getCanvas(viewer); - if (canvas) canvas.tabIndex = -1; -} -const capabilities = { - webgl: !!document.createElement('canvas').getContext('webgl'), - webgl2: !!document.createElement('canvas').getContext('webgl2') -}; - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"CFT5Q":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '4.1.8'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g29jp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SnapshotEditor", ()=>SnapshotEditor); -var _base = require("../base"); -var _dialog = require("../controls/dialog"); -var _canvas = require("../canvas"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -function _SnapshotEditor(_props) { - class __SnapshotEditor extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - showEditFormDialog: false, - title: '', - description: '', - image: null, - bgColor: null, - insight: null, - editIndex: -1 - }; + } + const Settings = _Settings; + function _SnapshotEditor(_props) { + class __SnapshotEditor extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + showEditFormDialog: false, + title: "", + description: "", + image: null, + bgColor: null, + insight: null, + editIndex: -1 + }; + } + resize(src, thumbWidth) { + if (!src) + return; + const img = new Image(); + img.onload = () => { + const canvas = document.createElement("canvas"), ctx = canvas.getContext("2d"); + const ratio = img.width / thumbWidth; + canvas.height = img.height / ratio; + canvas.width = thumbWidth; + ctx.drawImage(img, 0, 0, canvas.width, canvas.height); + const image2 = canvas.toDataURL(); + this.setState({ image: image2 }); + }; + img.src = src; + } + editSnapshot(snapshot, editIndex = -1) { + if (snapshot) { + this.setState(Object.assign(Object.assign({ showEditFormDialog: true }, snapshot), { editIndex })); + } else { + const { explorer: explorer2 } = this.props; + const signalValues = explorer2.viewer.getSignalValues(); + explorer2.viewer.deselect().then(() => { + const canvas = getCanvas(explorer2.viewer); + const bgColor = canvas && window.getComputedStyle(canvas).backgroundColor; + const insight = clone(explorer2.viewer.getInsight()); + delete insight.size; + insight.signalValues = signalValues; + const title = this.props.getTitle && this.props.getTitle(insight) || ""; + const description = this.props.getDescription && this.props.getDescription(insight) || ""; + this.setState({ showEditFormDialog: true, bgColor, title, description, insight, image: null, editIndex }); + setTimeout(() => { + explorer2.viewer.presenter.canvasToDataURL().then((dataUrl) => { + this.resize(dataUrl, explorer2.snapshotThumbWidth); + }); + }, 500); + }); } - resize(src, thumbWidth) { - if (!src) return; - const img = new Image(); - img.onload = ()=>{ - const canvas = document.createElement('canvas'), ctx = canvas.getContext('2d'); - const ratio = img.width / thumbWidth; - canvas.height = img.height / ratio; - canvas.width = thumbWidth; - ctx.drawImage(img, 0, 0, canvas.width, canvas.height); - const image = canvas.toDataURL(); - this.setState({ - image - }); + } + render() { + var _a2, _b2; + const { explorer: explorer2 } = this.props; + return base$1.react.createElement( + Dialog$1, + { modalProps: { className: classList("sanddance-snapshot-dialog", this.props.theme) }, minWidth: `${explorer2.snapshotThumbWidth + 64}px`, hidden: !this.state.showEditFormDialog, onDismiss: () => this.setState({ showEditFormDialog: false }), title: this.state.editIndex >= 0 ? strings$1.buttonEditSnapshot : strings$1.buttonCreateSnapshot, buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { disabled: !this.state.image || !this.state.title, key: 0, onClick: (e) => { + const setup2 = clone(explorer2.getSetup()); + if (setup2.camera !== "hold") { + setup2.camera = explorer2.viewer.getCamera(); + } + const snapshot = { + title: this.state.title, + description: this.state.description, + insight: this.state.insight, + image: this.state.image, + bgColor: this.state.bgColor, + setup: setup2 }; - img.src = src; - } - editSnapshot(snapshot, editIndex = -1) { - if (snapshot) this.setState(Object.assign(Object.assign({ - showEditFormDialog: true - }, snapshot), { - editIndex - })); - else { - const { explorer } = this.props; - const signalValues = explorer.viewer.getSignalValues(); - explorer.viewer.deselect().then(()=>{ - const canvas = (0, _canvas.getCanvas)(explorer.viewer); - const bgColor = canvas && window.getComputedStyle(canvas).backgroundColor; - const insight = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(explorer.viewer.getInsight()); - delete insight.size; - insight.signalValues = signalValues; - const title = this.props.getTitle && this.props.getTitle(insight) || ''; - const description = this.props.getDescription && this.props.getDescription(insight) || ''; - this.setState({ - showEditFormDialog: true, - bgColor, - title, - description, - insight, - image: null, - editIndex - }); - //allow deselection to render - setTimeout(()=>{ - explorer.viewer.presenter.canvasToDataURL().then((dataUrl)=>{ - this.resize(dataUrl, explorer.snapshotThumbWidth); - }); - }, 500); - }); - } - } - render() { - var _a, _b; - const { explorer } = this.props; - return (0, _base.base).react.createElement((0, _dialog.Dialog), { - modalProps: { - className: (0, _sanddanceReact.util).classList('sanddance-snapshot-dialog', this.props.theme) - }, - minWidth: `${explorer.snapshotThumbWidth + 64}px`, - hidden: !this.state.showEditFormDialog, - onDismiss: ()=>this.setState({ - showEditFormDialog: false - }), - title: this.state.editIndex >= 0 ? (0, _language.strings).buttonEditSnapshot : (0, _language.strings).buttonCreateSnapshot, - buttons: (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - disabled: !this.state.image || !this.state.title, - key: 0, - onClick: (e)=>{ - const setup = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(explorer.getSetup()); - if (setup.camera !== 'hold') //get the latest camera movement, instead of what's in state - setup.camera = explorer.viewer.getCamera(); - const snapshot = { - title: this.state.title, - description: this.state.description, - insight: this.state.insight, - image: this.state.image, - bgColor: this.state.bgColor, - setup - }; - this.props.modifySnapShot && this.props.modifySnapShot(snapshot); - this.props.onWriteSnapshot(snapshot, this.state.editIndex); - this.setState({ - showEditFormDialog: false, - title: '', - description: '', - image: null - }); - }, - iconProps: { - iconName: 'Camera' - }, - text: this.state.editIndex >= 0 ? (0, _language.strings).buttonUpdateSnapshot : (0, _language.strings).buttonCreateSnapshot - }) - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelSnapshotTitle, - onChange: (e, title)=>this.setState({ - title - }), - value: this.state.title - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelSnapshotDescription, - onChange: (e, description)=>this.setState({ - description - }), - value: this.state.description, - multiline: true - }), (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, !this.state.image && (0, _base.base).react.createElement((0, _base.base).fluentUI.Spinner, null), this.state.image && (0, _base.base).react.createElement("img", { - src: this.state.image, - style: { - backgroundColor: this.state.bgColor - } - })), ((_b = (_a = explorer.viewer) === null || _a === void 0 ? void 0 : _a.colorContexts) === null || _b === void 0 ? void 0 : _b.length) > 1 && (0, _base.base).react.createElement("div", null, (0, _language.strings).labelColorFilter)); - } + this.props.modifySnapShot && this.props.modifySnapShot(snapshot); + this.props.onWriteSnapshot(snapshot, this.state.editIndex); + this.setState({ showEditFormDialog: false, title: "", description: "", image: null }); + }, iconProps: { iconName: "Camera" }, text: this.state.editIndex >= 0 ? strings$1.buttonUpdateSnapshot : strings$1.buttonCreateSnapshot }) }, + base$1.react.createElement(base$1.fluentUI.TextField, { label: strings$1.labelSnapshotTitle, onChange: (e, title) => this.setState({ title }), value: this.state.title }), + base$1.react.createElement(base$1.fluentUI.TextField, { label: strings$1.labelSnapshotDescription, onChange: (e, description) => this.setState({ description }), value: this.state.description, multiline: true }), + base$1.react.createElement( + "div", + { className: "thumbnail" }, + !this.state.image && base$1.react.createElement(base$1.fluentUI.Spinner, null), + this.state.image && base$1.react.createElement("img", { src: this.state.image, style: { backgroundColor: this.state.bgColor } }) + ), + ((_b2 = (_a2 = explorer2.viewer) === null || _a2 === void 0 ? void 0 : _a2.colorContexts) === null || _b2 === void 0 ? void 0 : _b2.length) > 1 && base$1.react.createElement("div", null, strings$1.labelColorFilter) + ); + } } return new __SnapshotEditor(_props); -} -const SnapshotEditor = _SnapshotEditor; - -},{"../base":"3TPz5","../controls/dialog":"OQi9w","../canvas":"55nq5","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"sTI5I":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Snapshots", ()=>Snapshots); -var _base = require("../base"); -var _dialog = require("../controls/dialog"); -var _group = require("../controls/group"); -var _iconButton = require("../controls/iconButton"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -function _Snapshots(_props) { - class __Snapshots extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - confirmation: null, - title: '', - description: '', - image: null, - bgColor: null, - insight: null - }; - } - render() { - const items = [ - { - key: 'clear', - text: (0, _language.strings).buttonClearSnapshots, - onClick: ()=>this.setState({ - confirmation: { - buttonText: (0, _language.strings).buttonClearSnapshots, - handler: ()=>this.props.onClearSnapshots() - } - }), - disabled: this.props.snapshots.length === 0 - } - ]; - if (this.props.getTopActions) items.push.apply(items, this.props.getTopActions(this.props.snapshots)); - const ref = (0, _base.base).react.createRef(); - this.props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - (_a = ref.current) === null || _a === void 0 || _a.focus(); - }; - return (0, _base.base).react.createElement((0, _group.Group), { - className: "sanddance-snapshots", - label: (0, _language.strings).labelSnapshots - }, (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - componentRef: ref, - text: (0, _language.strings).buttonCreateSnapshot, - onClick: (e)=>this.props.editor.editSnapshot(), - split: true, - menuProps: { - items + } + const SnapshotEditor = _SnapshotEditor; + function _Snapshots(_props) { + class __Snapshots extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + confirmation: null, + title: "", + description: "", + image: null, + bgColor: null, + insight: null + }; + } + render() { + const items = [ + { + key: "clear", + text: strings$1.buttonClearSnapshots, + onClick: () => this.setState({ + confirmation: { + buttonText: strings$1.buttonClearSnapshots, + handler: () => this.props.onClearSnapshots() + } + }), + disabled: this.props.snapshots.length === 0 + } + ]; + if (this.props.getTopActions) { + items.push.apply(items, this.props.getTopActions(this.props.snapshots)); + } + const ref2 = base$1.react.createRef(); + this.props.explorer.dialogFocusHandler.focus = () => { + var _a2; + (_a2 = ref2.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + Group$1, + { className: "sanddance-snapshots", label: strings$1.labelSnapshots }, + base$1.react.createElement( + "div", + null, + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { componentRef: ref2, text: strings$1.buttonCreateSnapshot, onClick: (e) => this.props.editor.editSnapshot(), split: true, menuProps: { + items + } }), + this.props.getChildren && this.props.getChildren(this.props.snapshots), + this.state.confirmation && base$1.react.createElement(Dialog$1, { hidden: false, buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: 0, onClick: (e) => { + this.setState({ confirmation: null }); + this.state.confirmation.handler(); + }, iconProps: { iconName: "Delete" }, text: this.state.confirmation.buttonText }), onDismiss: () => this.setState({ confirmation: null }) }, strings$1.labelConfirmation), + base$1.react.createElement("div", null, this.props.snapshots.map((snapshot, i) => { + const actions = this.props.getActions && this.props.getActions(snapshot, i) || []; + actions.push({ + iconButtonProps: { + themePalette: this.props.themePalette, + title: strings$1.buttonEditSnapshot, + onClick: (e) => this.props.editor.editSnapshot(snapshot, i), + iconName: "Edit" } - }), this.props.getChildren && this.props.getChildren(this.props.snapshots), this.state.confirmation && (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: false, - buttons: (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 0, - onClick: (e)=>{ - this.setState({ - confirmation: null - }); - this.state.confirmation.handler(); - }, - iconProps: { - iconName: 'Delete' - }, - text: this.state.confirmation.buttonText - }), - onDismiss: ()=>this.setState({ - confirmation: null - }) - }, (0, _language.strings).labelConfirmation), (0, _base.base).react.createElement("div", null, this.props.snapshots.map((snapshot, i)=>{ - const actions = this.props.getActions && this.props.getActions(snapshot, i) || []; + }); + if (this.props.snapshots.length > 1) { actions.push({ - iconButtonProps: { - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonEditSnapshot, - onClick: (e)=>this.props.editor.editSnapshot(snapshot, i), - iconName: 'Edit' - } - }); - if (this.props.snapshots.length > 1) actions.push({ - iconButtonProps: { - disabled: i === 0, - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonMoveUp, - onClick: (e)=>this.props.onMoveUp(i), - iconName: 'SortUp' - } + iconButtonProps: { + disabled: i === 0, + themePalette: this.props.themePalette, + title: strings$1.buttonMoveUp, + onClick: (e) => this.props.onMoveUp(i), + iconName: "SortUp" + } }, { - iconButtonProps: { - disabled: i > this.props.snapshots.length - 2, - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonMoveDown, - onClick: (e)=>this.props.onMoveDown(i), - iconName: 'SortDown' - } - }); - actions.push({ - iconButtonProps: { - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonDeleteSnapshot, - onClick: ()=>this.setState({ - confirmation: { - buttonText: (0, _language.strings).buttonDeleteSnapshot, - handler: ()=>this.props.onRemoveSnapshot(i) - } - }), - iconName: 'Delete' - } + iconButtonProps: { + disabled: i > this.props.snapshots.length - 2, + themePalette: this.props.themePalette, + title: strings$1.buttonMoveDown, + onClick: (e) => this.props.onMoveDown(i), + iconName: "SortDown" + } }); - return (0, _base.base).react.createElement("div", { - key: i, - className: (0, _sanddanceReact.util).classList('snapshot', i === this.props.selectedSnapshotIndex && 'selected') - }, (0, _base.base).react.createElement("div", { - onClick: (e)=>this.props.onSnapshotClick(snapshot, i) - }, (0, _base.base).react.createElement("div", { - className: 'title' - }, snapshot.title), (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, (0, _base.base).react.createElement("img", { - title: snapshot.description, - src: snapshot.image, - style: { - backgroundColor: snapshot.bgColor + } + actions.push({ + iconButtonProps: { + themePalette: this.props.themePalette, + title: strings$1.buttonDeleteSnapshot, + onClick: () => this.setState({ + confirmation: { + buttonText: strings$1.buttonDeleteSnapshot, + handler: () => this.props.onRemoveSnapshot(i) } - }))), (0, _base.base).react.createElement(Actions, { - actions: actions, - snapshot: snapshot - })); - })))); - } + }), + iconName: "Delete" + } + }); + return base$1.react.createElement( + "div", + { key: i, className: classList("snapshot", i === this.props.selectedSnapshotIndex && "selected") }, + base$1.react.createElement( + "div", + { onClick: (e) => this.props.onSnapshotClick(snapshot, i) }, + base$1.react.createElement("div", { className: "title" }, snapshot.title), + base$1.react.createElement( + "div", + { className: "thumbnail" }, + base$1.react.createElement("img", { title: snapshot.description, src: snapshot.image, style: { backgroundColor: snapshot.bgColor } }) + ) + ), + base$1.react.createElement(Actions, { actions, snapshot }) + ); + })) + ) + ); + } } return new __Snapshots(_props); -} -const Snapshots = _Snapshots; -function Actions(props) { - return (0, _base.base).react.createElement("div", { - className: "actions" - }, props.actions.map((action, i)=>{ - if (action.iconButtonProps) return (0, _base.base).react.createElement((0, _iconButton.IconButton), Object.assign({ - key: i - }, action.iconButtonProps)); - if (action.element) return action.element; + } + const Snapshots = _Snapshots; + function Actions(props) { + return base$1.react.createElement("div", { className: "actions" }, props.actions.map((action, i) => { + if (action.iconButtonProps) { + return base$1.react.createElement(IconButton$1, Object.assign({ key: i }, action.iconButtonProps)); + } + if (action.element) { + return action.element; + } })); -} - -},{"../base":"3TPz5","../controls/dialog":"OQi9w","../controls/group":"afKlW","../controls/iconButton":"6pZiK","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3tDGl":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TransitionEditor", ()=>TransitionEditor); -parcelHelpers.export(exports, "getTransition", ()=>getTransition); -parcelHelpers.export(exports, "syncTansitionDurations", ()=>syncTansitionDurations); -var _base = require("../base"); -var _group = require("../controls/group"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _dropdown = require("../controls/dropdown"); -var _iconButton = require("../controls/iconButton"); -var _button = require("../controls/button"); -const positions = [ - [ - 'x', - (0, _language.strings).labelAliasX - ], - [ - 'y', - (0, _language.strings).labelAliasY - ], - [ - 'z', - (0, _language.strings).labelAliasZ - ] -]; -const autoScrubInterval = 50; //tune to get the smoothest animation while able to do an update pass through React -function _TransitionEditor(_props) { - class __TransitionEditor extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = Object.assign({ - scrub: 100, - pauseDisabled: true - }, this.initialCalc(props.transitionDurations)); - this.autoScrubber = new AutoScrubber(autoScrubInterval, (direction, interval)=>{ - const totalMs = this.state.totalTransition * 1000; - const currentMs = this.state.scrub / 100 * totalMs; - const scrubMs = currentMs + direction * interval; - let scrub = scrubMs / totalMs * 100; - if (direction < 0 && scrub <= 0) { - scrub = 0; - this.autoScrubber.stop(); - } - if (direction > 0 && scrub >= 100) { - scrub = 100; - this.autoScrubber.stop(); - } - this.setScrubState(scrub); - }); - } - initialCalc(transitionDurations) { - const totalTransition = (transitionDurations.position + transitionDurations.stagger) / 1000; - const staggerPercent = transitionDurations.stagger === 0 ? 1 : transitionDurations.stagger / (totalTransition * 1000) * 100; - const viewTransition = transitionDurations.view / 1000; - return { - totalTransition, - staggerPercent, - viewTransition - }; - } - setScrubState(scrub) { - const { morphChartsRenderResult, morphchartsref } = this.props.explorer.viewer.presenter; - morphchartsref.core.renderer.transitionTime = scrub / 100; - morphChartsRenderResult.setTransitionTimeAxesVisibility(); - scrub = Math.round(scrub); - this.setState({ - scrub, - pauseDisabled: this.autoScrubber.isStopped() - }); - } - setDurations() { - setTimeout(()=>{ - const { props, state } = this; - const { totalTransition, staggerPercent, viewTransition } = state; - const stagger = totalTransition * staggerPercent / 100; - const { transitionDurations } = props; - transitionDurations.position = (totalTransition - stagger) * 1000; - transitionDurations.stagger = stagger * 1000; - transitionDurations.view = viewTransition * 1000; - syncTansitionDurations(props.explorer.viewer, transitionDurations); - props.changeSetup(null, false); - }); - } - render() { - const { props, state } = this; - const { explorer, transitionDurations, changeSetup } = props; - const sliderRef = (0, _base.base).react.createRef(); - explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransition - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - componentRef: sliderRef, - label: (0, _language.strings).labelTransitionScrubber, - min: 0, - max: 100, - valueFormat: (0, _language.strings).percentValueFormat, - value: state.scrub, - onChange: (scrub)=>{ - this.autoScrubber.stop(); - this.setScrubState(scrub); - } - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - title: (0, _language.strings).buttonTransitionReverse, - iconName: 'PlayReverseResume', - onClick: ()=>{ - this.autoScrubber.toggleScrubbing(-1); - if (state.scrub === 0) this.setState({ - scrub: 100 - }); - } - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - title: (0, _language.strings).buttonTransitionPause, - iconName: 'Pause', - onClick: ()=>{ - this.autoScrubber.togglePause(); - }, - disabled: state.pauseDisabled - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - title: (0, _language.strings).buttonTransitionPlay, - iconName: 'PlayResume', - onClick: ()=>{ - this.autoScrubber.toggleScrubbing(1); - if (state.scrub === 100) this.setState({ - scrub: 0 - }); - } - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransitionOptions - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelHoldCamera, - checked: explorer.state.holdCamera, - onChange: (e, holdCamera)=>{ - changeSetup({ - holdCamera - }, false); - } - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - label: (0, _language.strings).labelTransitionStaggerBy, - selectedKey: props.transitionType, - options: [ - { - key: 'ordinal', - text: (0, _language.strings).labelTransitionStaggerByOrdinal - }, - { - key: 'column', - text: (0, _language.strings).labelTransitionStaggerByColumn - }, - { - key: 'position', - text: (0, _language.strings).labelTransitionStaggerByPosition - } - ], - onChange: (e, o)=>{ - const transitionType = o.key; - changeSetup({ - transitionType - }, true); + } + const positions = [ + ["x", strings$1.labelAliasX], + ["y", strings$1.labelAliasY], + ["z", strings$1.labelAliasZ] + ]; + const autoScrubInterval = 50; + function _TransitionEditor(_props) { + class __TransitionEditor extends base$1.react.Component { + constructor(props) { + super(props); + this.state = Object.assign({ scrub: 100, pauseDisabled: true }, this.initialCalc(props.transitionDurations)); + this.autoScrubber = new AutoScrubber(autoScrubInterval, (direction, interval2) => { + const totalMs = this.state.totalTransition * 1e3; + const currentMs = this.state.scrub / 100 * totalMs; + const scrubMs = currentMs + direction * interval2; + let scrub = scrubMs / totalMs * 100; + if (direction < 0 && scrub <= 0) { + scrub = 0; + this.autoScrubber.stop(); + } + if (direction > 0 && scrub >= 100) { + scrub = 100; + this.autoScrubber.stop(); + } + this.setScrubState(scrub); + }); + } + initialCalc(transitionDurations) { + const totalTransition = (transitionDurations.position + transitionDurations.stagger) / 1e3; + const staggerPercent = transitionDurations.stagger === 0 ? 1 : transitionDurations.stagger / (totalTransition * 1e3) * 100; + const viewTransition = transitionDurations.view / 1e3; + return { totalTransition, staggerPercent, viewTransition }; + } + setScrubState(scrub) { + const { morphChartsRenderResult, morphchartsref } = this.props.explorer.viewer.presenter; + morphchartsref.core.renderer.transitionTime = scrub / 100; + morphChartsRenderResult.setTransitionTimeAxesVisibility(); + scrub = Math.round(scrub); + this.setState({ scrub, pauseDisabled: this.autoScrubber.isStopped() }); + } + setDurations() { + setTimeout(() => { + const { props, state } = this; + const { totalTransition, staggerPercent, viewTransition } = state; + const stagger = totalTransition * staggerPercent / 100; + const { transitionDurations } = props; + transitionDurations.position = (totalTransition - stagger) * 1e3; + transitionDurations.stagger = stagger * 1e3; + transitionDurations.view = viewTransition * 1e3; + syncTansitionDurations(props.explorer.viewer, transitionDurations); + props.changeSetup(null, false); + }); + } + render() { + const { props, state } = this; + const { explorer: explorer2, transitionDurations, changeSetup } = props; + const sliderRef = base$1.react.createRef(); + explorer2.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = sliderRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransition }, + base$1.react.createElement(base$1.fluentUI.Slider, { componentRef: sliderRef, label: strings$1.labelTransitionScrubber, min: 0, max: 100, valueFormat: strings$1.percentValueFormat, value: state.scrub, onChange: (scrub) => { + this.autoScrubber.stop(); + this.setScrubState(scrub); + } }), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, title: strings$1.buttonTransitionReverse, iconName: "PlayReverseResume", onClick: () => { + this.autoScrubber.toggleScrubbing(-1); + if (state.scrub === 0) { + this.setState({ scrub: 100 }); + } + } }), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, title: strings$1.buttonTransitionPause, iconName: "Pause", onClick: () => { + this.autoScrubber.togglePause(); + }, disabled: state.pauseDisabled }), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, title: strings$1.buttonTransitionPlay, iconName: "PlayResume", onClick: () => { + this.autoScrubber.toggleScrubbing(1); + if (state.scrub === 100) { + this.setState({ scrub: 0 }); + } + } }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransitionOptions }, + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelHoldCamera, checked: explorer2.state.holdCamera, onChange: (e, holdCamera) => { + changeSetup({ holdCamera }, false); + } }), + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { label: strings$1.labelTransitionStaggerBy, selectedKey: props.transitionType, options: [ + { + key: "ordinal", + text: strings$1.labelTransitionStaggerByOrdinal + }, + { + key: "column", + text: strings$1.labelTransitionStaggerByColumn + }, + { + key: "position", + text: strings$1.labelTransitionStaggerByPosition + } + ], onChange: (e, o) => { + const transitionType = o.key; + changeSetup({ transitionType }, true); + } }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransitionStaggerOptions }, + (() => { + switch (props.transitionType) { + case "column": { + return base$1.react.createElement(Dropdown$1, { collapseLabel: props.compactUI, label: strings$1.labelTransitionStaggerByColumn, options: getColumnOptions(props, props.transitionColumn.name), onChange: (e, o) => { + changeSetup({ transitionColumn: o.data }, true); + } }); } - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransitionStaggerOptions - }, (()=>{ - switch(props.transitionType){ - case 'column': - return (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.compactUI, - label: (0, _language.strings).labelTransitionStaggerByColumn, - options: getColumnOptions(props, props.transitionColumn.name), - onChange: (e, o)=>{ - changeSetup({ - transitionColumn: o.data - }, true); - } - }); - case 'position': - return (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.compactUI, - label: (0, _language.strings).labelTransitionStaggerByPosition, - options: positions.map(([key, text])=>{ - return { - key, - text, - selected: props.transitionDimension === key - }; - }), - onChange: (e, o)=>{ - changeSetup({ - transitionDimension: o.key - }, true); - } - }); + case "position": { + return base$1.react.createElement(Dropdown$1, { collapseLabel: props.compactUI, label: strings$1.labelTransitionStaggerByPosition, options: positions.map(([key2, text2]) => { + return { key: key2, text: text2, selected: props.transitionDimension === key2 }; + }), onChange: (e, o) => { + changeSetup({ transitionDimension: o.key }, true); + } }); } - })(), (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelTransitionStaggerReverse, - checked: props.transitionReverse, - onChange: (e, transitionReverse)=>changeSetup({ - transitionReverse - }, true) - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransitionDurations - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelTransitionDuration, - onChange: (totalTransition)=>{ - this.setState({ - totalTransition - }); - this.setDurations(); - }, - min: 0, - max: 5, - step: 0.1, - value: state.totalTransition - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelTransitionStagger, - onChange: (staggerPercent)=>{ - this.setState({ - staggerPercent - }); - this.setDurations(); - }, - min: 0, - max: 100, - valueFormat: (0, _language.strings).percentValueFormat, - value: state.staggerPercent - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelTransitionCamera, - onChange: (viewTransition)=>{ - this.setState({ - viewTransition - }); - this.setDurations(); - }, - min: 0, - max: 5, - step: 0.1, - value: state.viewTransition - }), (0, _base.base).react.createElement((0, _button.Button), { - themePalette: props.themePalette, - onClick: ()=>{ - const defaults = (0, _sanddanceReact.SandDance).VegaMorphCharts.defaults.defaultPresenterConfig.transitionDurations; - const { position, stagger, view } = defaults; - transitionDurations.position = position; - transitionDurations.stagger = stagger; - transitionDurations.view = view; - this.setState(Object.assign({}, this.initialCalc(transitionDurations))); - this.setDurations(); - }, - text: (0, _language.strings).buttonResetToDefault - }))); - } + } + })(), + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelTransitionStaggerReverse, checked: props.transitionReverse, onChange: (e, transitionReverse) => changeSetup({ transitionReverse }, true) }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransitionDurations }, + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelTransitionDuration, onChange: (totalTransition) => { + this.setState({ totalTransition }); + this.setDurations(); + }, min: 0, max: 5, step: 0.1, value: state.totalTransition }), + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelTransitionStagger, onChange: (staggerPercent) => { + this.setState({ staggerPercent }); + this.setDurations(); + }, min: 0, max: 100, valueFormat: strings$1.percentValueFormat, value: state.staggerPercent }), + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelTransitionCamera, onChange: (viewTransition) => { + this.setState({ viewTransition }); + this.setDurations(); + }, min: 0, max: 5, step: 0.1, value: state.viewTransition }), + base$1.react.createElement(Button, { themePalette: props.themePalette, onClick: () => { + const defaults2 = defaultPresenterConfig.transitionDurations; + const { position: position2, stagger, view } = defaults2; + transitionDurations.position = position2; + transitionDurations.stagger = stagger; + transitionDurations.view = view; + this.setState(Object.assign({}, this.initialCalc(transitionDurations))); + this.setDurations(); + }, text: strings$1.buttonResetToDefault }) + ) + ); + } } return new __TransitionEditor(_props); -} -const TransitionEditor = _TransitionEditor; -function groupOptions(sectionName, columns, selectedKey) { - const options = columns.map((column)=>{ - const option = { - key: `column:${column.name}`, - text: column.name, - data: column, - selected: column.name === selectedKey - }; - return option; + } + const TransitionEditor = _TransitionEditor; + function groupOptions(sectionName, columns, selectedKey) { + const options2 = columns.map((column) => { + const option = { + key: `column:${column.name}`, + text: column.name, + data: column, + selected: column.name === selectedKey + }; + return option; }); - if (options.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; - options.unshift(option); - } - return options; -} -function getColumnOptions(props, selectedKey) { - const quantitativeGroup = groupOptions((0, _language.strings).selectNumeric, props.quantitativeColumns, selectedKey); - const categoricGroup = groupOptions((0, _language.strings).selectNonNumeric, props.categoricalColumns, selectedKey); + if (options2.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options2.unshift(option); + } + return options2; + } + function getColumnOptions(props, selectedKey) { + const quantitativeGroup = groupOptions(strings$1.selectNumeric, props.quantitativeColumns, selectedKey); + const categoricGroup = groupOptions(strings$1.selectNonNumeric, props.categoricalColumns, selectedKey); return quantitativeGroup.concat(categoricGroup); -} -function getTransition(state) { - const reverse = state.transitionReverse; - switch(state.transitionType){ - case 'ordinal': - return { - type: 'ordinal', - reverse - }; - case 'column': - return { - type: 'column', - column: state.transitionColumn, - reverse - }; - case 'position': - return { - type: 'position', - dimension: state.transitionDimension, - reverse - }; + } + function getTransition(state) { + const reverse2 = state.transitionReverse; + switch (state.transitionType) { + case "ordinal": { + return { + type: "ordinal", + reverse: reverse2 + }; + } + case "column": { + return { + type: "column", + column: state.transitionColumn, + reverse: reverse2 + }; + } + case "position": { + return { + type: "position", + dimension: state.transitionDimension, + reverse: reverse2 + }; + } } -} -function syncTansitionDurations(viewer, transitionDurations) { - var _a, _b; - const config = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.core.config; + } + function syncTansitionDurations(viewer, transitionDurations) { + var _a2, _b2; + const config = (_b2 = (_a2 = viewer === null || viewer === void 0 ? void 0 : viewer.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphchartsref) === null || _b2 === void 0 ? void 0 : _b2.core.config; if (config) { - const { position, stagger } = transitionDurations; - config.transitionDuration = position; - config.transitionStaggering = stagger; + const { position: position2, stagger } = transitionDurations; + config.transitionDuration = position2; + config.transitionStaggering = stagger; } -} -class AutoScrubber { - constructor(interval, onInterval){ - this.interval = interval; - this.onInterval = onInterval; + } + class AutoScrubber { + constructor(interval2, onInterval) { + this.interval = interval2; + this.onInterval = onInterval; } getSignedInterval() { - return this.interval * this.direction; + return this.interval * this.direction; } toggleScrubbing(direction) { - if (this.isScrubbing() && direction === this.direction) this.pause(); - else this.start(direction); + if (this.isScrubbing() && direction === this.direction) { + this.pause(); + } else { + this.start(direction); + } } isPaused() { - return !this.isScrubbing() && this.direction !== undefined; + return !this.isScrubbing() && this.direction !== void 0; } isStopped() { - return !this.isScrubbing() && this.direction === undefined; + return !this.isScrubbing() && this.direction === void 0; } isScrubbing() { - return this.autoScrubTimer !== undefined; + return this.autoScrubTimer !== void 0; } togglePause() { - if (this.isScrubbing()) this.pause(); - else if (this.direction) this.start(this.direction); + if (this.isScrubbing()) { + this.pause(); + } else if (this.direction) { + this.start(this.direction); + } } start(direction) { - this.direction = direction; - if (!this.isScrubbing()) this.autoScrubTimer = setInterval(()=>this.onInterval(this.direction, this.interval), this.interval); + this.direction = direction; + if (!this.isScrubbing()) { + this.autoScrubTimer = setInterval(() => this.onInterval(this.direction, this.interval), this.interval); + } } pause() { - clearInterval(this.autoScrubTimer); - this.autoScrubTimer = undefined; + clearInterval(this.autoScrubTimer); + this.autoScrubTimer = void 0; } stop() { - this.pause(); - this.direction = undefined; - } -} - -},{"../base":"3TPz5","../controls/group":"afKlW","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","../controls/dropdown":"7pP8h","../controls/iconButton":"6pZiK","../controls/button":"f8wtc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cQRoj":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Explorer", ()=>Explorer); -var _base = require("./base"); -var _canvas = require("./canvas"); -var _clickableTextLayer = require("./clickableTextLayer"); -var _colorMap = require("./colorMap"); -var _colorScheme = require("./colorScheme"); -var _columns = require("./columns"); -var _dataScope = require("./controls/dataScope"); -var _dialog = require("./controls/dialog"); -var _iconButton = require("./controls/iconButton"); -var _sidebar = require("./controls/sidebar"); -var _topbar = require("./controls/topbar"); -var _dataLoader = require("./dataLoader"); -var _defaults = require("./defaults"); -var _chart = require("./dialogs/chart"); -var _color = require("./dialogs/color"); -var _dataBrowser = require("./dialogs/dataBrowser"); -var _history = require("./dialogs/history"); -var _search = require("./dialogs/search"); -var _settings = require("./dialogs/settings"); -var _snapshotEditor = require("./dialogs/snapshotEditor"); -var _snapshots = require("./dialogs/snapshots"); -var _transition = require("./dialogs/transition"); -var _interfaces = require("./interfaces"); -var _language = require("./language"); -var _mouseEvent = require("./mouseEvent"); -var _partialInsight = require("./partialInsight"); -var _themes = require("./themes"); -var _searchGroups = require("./searchGroups"); -var _chartRecommender = require("@msrvida/chart-recommender"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _renderer = require("./controls/renderer"); -var _backgroundImageEditor = require("./dialogs/backgroundImageEditor"); -function _Explorer(_props) { - class __Explorer extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.dialogFocusHandler = {}; - this.state = (0, _defaults.initialExplorerState)(props); - this.imageHolder = { - img: null, - backgroundImageColumnBounds: [], - showBackgroundImage: false - }; - this.snapshotThumbWidth = (0, _defaults.snapshotThumbWidth); - this.discardColorContextUpdates = true; - this.updateViewerOptions(Object.assign(Object.assign({}, (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone((0, _sanddanceReact.SandDance).Viewer.defaultViewerOptions)), props.viewerOptions)); - } - finalize() { - if (this.viewer) this.viewer.finalize(); - } - updateViewerOptions(viewerOptions) { - this.viewerOptions = Object.assign(Object.assign({}, (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge((0, _defaults.defaultViewerOptions), { - tooltipOptions: { - prepareDataItem: (item)=>{ - const ret = {}; - for(const columnName in item)if (this.state.tooltipExclusions.indexOf(columnName) < 0) ret[columnName] = item[columnName]; - return ret; - } - } - }, this.viewerOptions, viewerOptions)), { - onColorContextChange: ()=>this.manageColorToolbar(), - onDataFilter: (filter, filteredData)=>{ - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - selectedItemIndex[(0, _dataScope.DataScopeId).FilteredData] = 0; - this.changeInsight({ - filter - }, { - label: this.historicFilterChange, - omit: !this.historicFilterChange - }); - this.historicFilterChange = null; - this.setState({ - filteredData, - selectedItemIndex - }); - if (this.state.sideTabId === (0, _interfaces.SideTabId).Data && this.state.dataScopeId === (0, _dataScope.DataScopeId).FilteredData) //make sure item is active - requestAnimationFrame(()=>filteredData && this.silentActivation(filteredData[0])); - viewerOptions && viewerOptions.onDataFilter && viewerOptions.onDataFilter(filter, filteredData); - }, - onSelectionChanged: (newSearch, index, selectedData)=>{ - if (this.ignoreSelectionChange) return; - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - selectedItemIndex[(0, _dataScope.DataScopeId).SelectedData] = index || 0; - let { search } = this.state; - const { sideTabId } = this.state; - if (newSearch) search = (0, _searchGroups.createInputSearch)(newSearch); - this.setState({ - search, - selectedItemIndex, - sideTabId - }); - viewerOptions && viewerOptions.onSelectionChanged && viewerOptions.onSelectionChanged(newSearch, index, selectedData); - }, - onAxisClick: (e, search)=>{ - this.toggleableSearch(e, search); - viewerOptions && viewerOptions.onAxisClick && viewerOptions.onAxisClick(e, search); - }, - onLegendHeaderClick: (e)=>{ - const pos = (0, _mouseEvent.getPosition)(e); - const specRole = this.state.specCapabilities && this.state.specCapabilities.roles.filter((r)=>r.role === 'color')[0]; - const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { - collapseLabel: true, - container: this.div, - selectedColumnName: this.state.columns['color'], - onDismiss: ()=>{ - this.setState({ - positionedColumnMapProps: null - }); - }, - specRole, - left: pos.left - this.div.clientLeft, - top: pos.top - this.div.clientTop - }); - this.setState({ - positionedColumnMapProps - }); - }, - onLegendRowClick: (e, legendRow)=>{ - this.toggleableSearch(e, legendRow.search); - viewerOptions && viewerOptions.onLegendRowClick && viewerOptions.onLegendRowClick(e, legendRow); - }, - onError: (errors)=>{ - this.setState({ - errors - }); - viewerOptions && viewerOptions.onError && viewerOptions.onError(errors); - }, - onBeforeCreateLayers: (stage, specCapabilities)=>{ - (0, _clickableTextLayer.attachSpecRoleToAxisTitle)(stage, specCapabilities); - }, - getTextColor: (o)=>{ - if (o.specRole) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.clickableText); - else if (o.metaData && o.metaData.search) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.searchText); - else return o.color; - }, - getTextHighlightColor: (o)=>{ - if (o.specRole) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.clickableTextHighlight); - else if (o.metaData && o.metaData.search) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.searchTextHighlight); - else return [ - 0, - 0, - 0, - 0 - ]; - }, - onTextClick: (e, text)=>{ - if (e && text) { - const pos = (0, _mouseEvent.getPosition)(e); - const rect = this.viewer.element.getBoundingClientRect(); - pos.left += rect.left; - pos.top += rect.top; - const { specRole } = text; - if (pos && specRole) { - const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { - collapseLabel: true, - container: this.div, - selectedColumnName: this.state.columns[specRole.role], - onDismiss: ()=>{ - this.setState({ - positionedColumnMapProps: null - }); - }, - specRole, - left: pos.left, - top: pos.top - }); - this.setState({ - positionedColumnMapProps - }); - } else this.setState({ - positionedColumnMapProps: null - }); - } - }, - onNewViewStateTarget: ()=>this.newViewStateTarget - }); - if (this.viewer && this.viewer.presenter) { - const newPresenterStyle = (0, _sanddanceReact.SandDance).util.getPresenterStyle(this.viewerOptions); - const mergePrenterStyle = Object.assign(Object.assign({}, this.viewer.presenter.style), newPresenterStyle); - this.viewer.presenter.style = mergePrenterStyle; - this.viewer.options = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge(this.viewer.options, this.props.viewerOptions, this.viewerOptions); - } - } - signal(signalName, signalValue, newViewStateTarget) { - switch(signalName){ - case (0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount: - case (0, _sanddanceReact.SandDance).constants.SignalNames.ColorReverse: - case (0, _sanddanceReact.SandDance).constants.SignalNames.MarkOpacity: - this.discardColorContextUpdates = false; - break; - } - this.newViewStateTarget = newViewStateTarget; - this.viewer.vegaViewGl.signal(signalName, signalValue); - this.viewer.vegaViewGl.runAsync().then(()=>{ - //deeply set the state without a state change. This prevents a redraw if re-rendered - if (this.state.signalValues) this.state.signalValues[signalName] = signalValue; - this.discardColorContextUpdates = true; - this.newViewStateTarget = undefined; - this.props.onSignalChanged && this.props.onSignalChanged(signalName, signalValue); - }); - } - manageColorToolbar() { - const canRemap = this.viewer.colorContexts && this.viewer.colorContexts.length > 1; - (0, _colorMap.applyColorButtons)(this.viewer.presenter, !!this.state.columns.color, { - themePalette: (0, _themes.themePalettes)[this.props.theme || ''], - canRemap, - isRemap: canRemap && this.viewer.currentColorContext > 0, - colorMapHandler: (remap)=>{ - this.viewer.currentColorContext = ~~remap; - this.viewer.renderSameLayout(); - this.manageColorToolbar(); - } - }); - } - getInsight() { - return this.viewer.getInsight(); - } - getSetup() { - return { - camera: this.state.holdCamera ? 'hold' : this.state.camera, - renderer: this.state.renderer, - transition: (0, _transition.getTransition)(this.state), - transitionDurations: this.state.transitionDurations - }; - } - setSetup(setup, newState) { - newState.camera = undefined; - if (setup) { - this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(setup); - const { camera, renderer, transition, transitionDurations } = setup; - newState.renderer = renderer; - newState.transitionType = transition.type; - if (camera === 'hold') newState.holdCamera = true; - else { - newState.holdCamera = false; - newState.camera = camera; - } - if (transition.type === 'column') newState.transitionColumn = transition.column; - else if (transition.type === 'position') newState.transitionDimension = transition.dimension; - if (transitionDurations) { - newState.transitionDurations = transitionDurations; - (0, _transition.syncTansitionDurations)(this.viewer, transitionDurations); - } - } - } - setInsight(historyAction, newState = {}, partialInsight = this.viewer.getInsight(), rebaseFilter, setup) { - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - (0, _dataScope.resetSelectedItemIndex)(selectedItemIndex); - const historicInsight = Object.assign({ - chart: null, - scheme: null, - columns: null, - filter: null, - rebaseFilter - }, partialInsight); - const state = Object.assign({ - filteredData: null, - selectedItemIndex, - search: (0, _searchGroups.createInputSearch)(historicInsight.filter) - }, newState); - const changeInsight = ()=>{ - this.getColorContext = null; - this.setSetup(setup, historicInsight); - this.changeInsight(historicInsight, historyAction, state, setup); - }; - const currentFilter = this.viewer.getInsight().filter; - if (rebaseFilter && currentFilter && historicInsight.filter) { - if ((0, _sanddanceReact.SandDance).searchExpression.startsWith(historicInsight.filter, currentFilter)) changeInsight(); - else { - const { transitionDurations } = this.state; - const renderTime = transitionDurations.position + transitionDurations.stagger; - const allowAsyncRenderTime = renderTime + this.viewerOptions.filterRenderingTimerPadding; - this.viewer.reset().then(()=>new Promise((resolve, reject)=>{ - setTimeout(resolve, allowAsyncRenderTime); - })).then(changeInsight); - } - } else changeInsight(); - } - handleReviveSnapshot(snapshot, selectedSnapshotIndex) { - let handled = false; - if (this.props.onSnapshotClick) { - this.setState({ - selectedSnapshotIndex - }); - handled = this.props.onSnapshotClick(snapshot, selectedSnapshotIndex); - } - if (!handled) this.reviveSnapshot(selectedSnapshotIndex); - } - reviveSnapshot(snapshotOrIndex) { - if (typeof snapshotOrIndex === 'number') { - const selectedSnapshotIndex = snapshotOrIndex; - const snapshot = this.state.snapshots[selectedSnapshotIndex]; - const newState = { - note: snapshot.description, - selectedSnapshotIndex - }; - if (!this.state.sidebarClosed) { - newState.sideTabId = (0, _interfaces.SideTabId).Snapshots; - this.scrollSnapshotIntoView(selectedSnapshotIndex); - } - if (snapshot.insight) { - const { backgroundImage } = snapshot.insight; - this.imageHolder.showBackgroundImage = !!backgroundImage; - if (backgroundImage) this.imageHolder.img = { - src: backgroundImage.url, - height: backgroundImage.size.height, - width: backgroundImage.size.width - }; - } - this.setInsight({ - label: (0, _language.strings).labelHistoryReviveSnapshot - }, newState, snapshot.insight, true, snapshot.setup); - } else { - const snapshot = snapshotOrIndex; - if (snapshot.insight) this.setInsight({ - label: (0, _language.strings).labelHistoryReviveSnapshot - }, { - note: snapshot.description, - selectedSnapshotIndex: -1 - }, snapshot.insight, true, snapshot.setup); //don't navigate to sideTab - else this.setState({ - note: snapshot.description, - selectedSnapshotIndex: -1 - }); - } - } - load(data, getPartialInsight, optionsOrPrefs) { - this.setState({ - historyIndex: -1, - historyItems: [] - }); - this.changeInsight({ - columns: null - }, { - label: null, - omit: true - }, { - note: null - }); - return new Promise((resolve, reject)=>{ - const loadFinal = (dataContent)=>{ - let partialInsight; - this.prefs = optionsOrPrefs && optionsOrPrefs.chartPrefs || optionsOrPrefs || {}; - this.imageHolder.backgroundImageColumnBounds = (0, _columns.getBackgroundImageColumnBounds)(dataContent.columns); - if (getPartialInsight) { - partialInsight = getPartialInsight(dataContent.columns); - (0, _partialInsight.initPrefs)(this.prefs, partialInsight); - } - if (!partialInsight) { - //load recommendation - const r = new (0, _chartRecommender.RecommenderSummary)(dataContent.columns, dataContent.data); - partialInsight = r.recommend(); - } - partialInsight = Object.assign({ - facetStyle: 'wrap', - filter: null, - totalStyle: null, - transform: null - }, partialInsight); - if (partialInsight.chart === 'barchart') partialInsight.chart = 'barchartV'; - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - const sideTabId = (0, _interfaces.SideTabId).ChartType; - (0, _dataScope.resetSelectedItemIndex)(selectedItemIndex); - const newState = Object.assign({ - camera: undefined, - columns: {}, - dataFile, - dataContent, - snapshots: dataContent.snapshots || this.state.snapshots, - autoCompleteDistinctValues: {}, - filteredData: null, - tooltipExclusions: optionsOrPrefs && optionsOrPrefs.tooltipExclusions || [], - selectedItemIndex, - sideTabId - }, partialInsight); - this.getColorContext = null; - (0, _columns.ensureColumnsExist)(newState.columns, dataContent.columns, newState.transform); - const errors = (0, _columns.ensureColumnsPopulated)(partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.chart, partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.totalStyle, newState.columns, dataContent.columns); - newState.errors = errors; - newState.transitionColumn = dataContent.columns[0]; - const setup = optionsOrPrefs && optionsOrPrefs.setup; - this.setSetup(setup, newState); - //change insight - this.changeInsight(partialInsight, { - label: (0, _language.strings).labelHistoryInit, - insert: true - }, newState, optionsOrPrefs && optionsOrPrefs.setup); - //make sure item is active - this.activateDataBrowserItem(sideTabId, this.state.dataScopeId); - resolve(); - }; - let dataFile; - if (Array.isArray(data)) return (0, _dataLoader.loadDataArray)(data, 'json', optionsOrPrefs && optionsOrPrefs.columnTypes).then((result)=>{ - dataFile = { - type: 'json' - }; - loadFinal(result); - }).catch(reject); - else { - dataFile = data; - return (0, _dataLoader.loadDataFile)(dataFile, optionsOrPrefs && optionsOrPrefs.columnTypes).then(loadFinal).catch(reject); - } - }); - } - changeChartType(chart) { - const partialInsight = Object.assign({}, (0, _partialInsight.copyPrefToNewState)(this.prefs, chart, '*', '*')); - const insight = Object.assign({ - chart - }, partialInsight); - const columns = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, partialInsight.columns, this.state.columns); - const { signalValues } = this.viewer.getInsight(); - insight.signalValues = Object.assign(Object.assign({}, this.state.signalValues), signalValues); - insight.columns = Object.assign({}, columns); - insight.totalStyle = this.state.totalStyle; - let errors; - //special case mappings when switching chart type - if (this.state.chart === 'scatterplot' && (chart === 'barchart' || chart === 'barchartV')) insight.columns = Object.assign(Object.assign({}, columns), { - sort: columns.y - }); - else if (this.state.chart === 'scatterplot' && chart === 'barchartH') insight.columns = Object.assign(Object.assign({}, columns), { - sort: columns.x - }); - else if (chart === 'treemap') { - insight.view = '2d'; - if (!columns.size) { - //make sure size exists and is numeric - let sizeColumn; - //first check prefs - if (partialInsight && partialInsight.columns && partialInsight.columns.size) { - const prefSizeColumn = this.state.dataContent.columns.filter((c)=>c.name === partialInsight.columns.size)[0]; - if (prefSizeColumn && prefSizeColumn.quantitative) sizeColumn = prefSizeColumn; - } - if (!sizeColumn) sizeColumn = (0, _columns.getTreemapColumn)(this.state.dataContent.columns); - if (!sizeColumn) //error - no numeric columns - errors = [ - (0, _language.strings).errorColumnMustBeNumeric - ]; - else insight.columns = Object.assign(Object.assign({}, columns), { - size: sizeColumn.name - }); - } - } else if (chart === 'stacks') insight.view = '3d'; - (0, _columns.ensureColumnsExist)(insight.columns, this.state.dataContent.columns, this.state.transform); - errors = (0, _columns.ensureColumnsPopulated)(chart, insight.totalStyle, insight.columns, this.state.dataContent.columns); - this.calculate(()=>{ - this.changeInsight(insight, { - label: (0, _language.strings).labelHistoryChangeChartType((0, _chart.chartLabel)(chart)) - }, errors ? { - errors, - camera: undefined - } : { - camera: undefined - }); - }); - return insight.columns; - } - calculate(calculating) { - this.setState({ - calculating - }); - } - changeView(view) { - this.changeInsight({ - view - }, { - label: view === '2d' ? (0, _language.strings).labelViewType2d : (0, _language.strings).labelViewType3d - }); - } - //state members which change the insight - changeInsight(partialInsight, historyAction, additionalUIState, historicSetup) { - if (!partialInsight.signalValues) partialInsight.signalValues = null; - if (partialInsight.chart === 'barchart') partialInsight.chart = 'barchartV'; - this.addHistory(Object.assign(Object.assign({}, partialInsight), { - historicSetup - }), historyAction, additionalUIState); - } - addHistory(historicInsight, historyAction, additionalUIState) { - const setCleanState = (newState)=>{ - const cleanState = Object.assign(Object.assign({}, newState), additionalUIState); - if (!cleanState.note) cleanState.note = null; - delete cleanState.rebaseFilter; - if (this.viewer) { - const { signalValues } = this.viewer.getInsight(); - cleanState.signalValues = Object.assign(Object.assign(Object.assign({}, this.state.signalValues), signalValues), cleanState.signalValues); - } - this.setState(cleanState); - }; - if (historyAction.omit) { - setCleanState(historicInsight); - return; - } - const historyItems = this.state.historyItems.slice(0, this.state.historyIndex + 1); - const historyIndex = historyItems.length; - historyItems.push({ - label: historyAction.label, - historicInsight - }); - if (historyAction.insert) setCleanState({ - historyIndex, - historyItems - }); - else setCleanState(Object.assign(Object.assign({}, historicInsight), { - historyIndex, - historyItems - })); - } - replay(index) { - return (0, _history.replay)(this.state.historyItems, index); - } - undo() { - const historyIndex = this.state.historyIndex - 1; - if (historyIndex < 0) return; - this.doReplay(historyIndex); - } - redo(historyIndex = this.state.historyIndex + 1) { - if (historyIndex >= this.state.historyItems.length) return; - this.doReplay(historyIndex); - } - doReplay(historyIndex) { - const newState = this.replay(historyIndex); - this.rebaseFilter = true; - this.setSetup(newState.historicSetup, newState); - this.setState(Object.assign(Object.assign({}, newState), { - historyIndex - })); - } - changespecCapabilities(specCapabilities) { - this.setState({ - specCapabilities - }); - } - changeColumnMapping(role, column, options) { - const columns = Object.assign({}, this.state.columns); - const label = column ? (0, _language.strings).labelHistoryMapColumn(role) : (0, _language.strings).labelHistoryUnMapColumn(role); - const final = ()=>{ - const partialInsight = { - columns, - totalStyle: options ? options.totalStyle : this.state.totalStyle - }; - const errors = (0, _columns.ensureColumnsPopulated)(this.state.chart, partialInsight.totalStyle, partialInsight.columns, this.state.dataContent.columns); - columns[role] = column && column.name; - this.changeInsight(partialInsight, { - label - }, errors ? { - errors, - camera: this.viewer.getCamera() - } : { - camera: this.viewer.getCamera() - }); - }; - const _changeInsight = (newInsight, columnUpdate, historyAction)=>{ - newInsight.columns = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, columns, columnUpdate); - (0, _partialInsight.savePref)(this.prefs, this.state.chart, '*', '*', { - columns: columnUpdate - }); - this.changeInsight(newInsight, historyAction, { - camera: this.viewer.getCamera() - }); - }; - if (column) { - let columnUpdate; - switch(role){ - case 'facet': - { - (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'facet', column.name); - const historicInsight = { - columns, - facetStyle: options ? options.facetStyle : this.state.facetStyle - }; - columnUpdate = { - facet: column.name - }; - _changeInsight(historicInsight, columnUpdate, { - label - }); - break; - } - case 'color': - { - let calculating = null; - const historicInsight = { - scheme: options && options.scheme, - columns, - colorBin: this.state.colorBin - }; - if (!historicInsight.scheme) (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'color', column.name); - if (!historicInsight.scheme) historicInsight.scheme = (0, _colorScheme.bestColorScheme)(column, null, this.state.scheme); - if (!column.stats.hasColorData) { - historicInsight.directColor = false; - if (this.state.directColor !== historicInsight.directColor) calculating = ()=>this._resize(); - } - if (this.state.columns && this.state.columns.color && this.state.columns.color !== column.name) { - const currColorColumn = this.state.dataContent.columns.filter((c)=>c.name === this.state.columns.color)[0]; - if (column.isColorData != currColorColumn.isColorData) calculating = ()=>this._resize(); - } - this.ignoreSelectionChange = true; - this.viewer.deselect().then(()=>{ - this.ignoreSelectionChange = false; - //allow deselection to render - requestAnimationFrame(()=>{ - columnUpdate = { - color: column.name - }; - this.getColorContext = null; - this.setState({ - calculating - }); - _changeInsight(historicInsight, columnUpdate, { - label - }); - }); - }); - break; - } - case 'x': - { - (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'x', column.name); - const historicInsight = { - columns - }; - columnUpdate = { - x: column.name - }; - _changeInsight(historicInsight, columnUpdate, { - label - }); - break; - } - case 'size': - { - (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'size', column.name); - const historicInsight = { - totalStyle: options ? options.totalStyle : this.state.totalStyle - }; - columnUpdate = { - size: column.name - }; - _changeInsight(historicInsight, columnUpdate, { - label - }); - break; - } - default: - final(); - break; - } - } else switch(role){ - case 'facet': - columns.facet = null; - columns.facetV = null; - this.changeInsight({ - columns, - facetStyle: 'wrap' - }, { - label - }); - break; - default: - final(); - break; - } - } - setSideTabId(sideTabId, dataScopeId) { - if (sideTabId === (0, _interfaces.SideTabId).Data && dataScopeId == null) //choose most relevant DataScopeId - dataScopeId = this.getBestDataScopeId(); - if (dataScopeId == null) dataScopeId = this.state.dataScopeId; - const calculating = ()=>{ - this.dialogFocusHandler.focus && this.dialogFocusHandler.focus(); - }; - this.setState({ - sideTabId, - dataScopeId, - sidebarClosed: false, - calculating - }); - this.activateDataBrowserItem(sideTabId, dataScopeId); - } - getBestDataScopeId() { - let dataScopeId; - const selectionState = this.viewer && this.viewer.getSelection(); - if (selectionState && selectionState.selectedData && selectionState.selectedData.length) dataScopeId = (0, _dataScope.DataScopeId).SelectedData; - else if (this.state.filteredData) dataScopeId = (0, _dataScope.DataScopeId).FilteredData; - else dataScopeId = (0, _dataScope.DataScopeId).AllData; - return dataScopeId; - } - activateDataBrowserItem(sideTabId, dataScopeId) { - if (!this.viewer) return; - let itemToActivate; - if (sideTabId === (0, _interfaces.SideTabId).Data) switch(dataScopeId){ - case (0, _dataScope.DataScopeId).AllData: - itemToActivate = this.state.dataContent && this.state.dataContent.data[this.state.selectedItemIndex[(0, _dataScope.DataScopeId).AllData]]; - break; - case (0, _dataScope.DataScopeId).FilteredData: - itemToActivate = this.state.filteredData && this.state.filteredData[this.state.selectedItemIndex[(0, _dataScope.DataScopeId).FilteredData]]; - break; - case (0, _dataScope.DataScopeId).SelectedData: - { - const selection = this.viewer.getSelection() || {}; - itemToActivate = selection.selectedData && selection.selectedData[this.state.selectedItemIndex[(0, _dataScope.DataScopeId).SelectedData]]; - break; - } - } - this.silentActivation(itemToActivate); - } - silentActivation(itemToActivate) { - this.ignoreSelectionChange = true; - const done = ()=>{ - this.ignoreSelectionChange = false; - }; - if (itemToActivate) return this.viewer.activate(itemToActivate).then(done); - else return this.viewer.deActivate().then(done); - } - sidebar(sidebarClosed, sidebarPinned) { - this.setState({ - sidebarClosed, - sidebarPinned - }); - } - resize() { - this.setState({ - calculating: ()=>this._resize() - }); - } - _resize() { - this.changeInsight({ - size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed) - }, { - label: 'resize', - omit: true - }); - } - viewerMounted(glDiv) { - this.setState({ - size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed), - signalValues: this.state.signalValues - }); - } - getLayoutDivSize(pinned, closed) { - const div = pinned && !closed ? this.layoutDivPinned : this.layoutDivUnpinned; - return { - height: div.offsetHeight, - width: div.offsetWidth - }; - } - toggleableSearch(e, search) { - if (e.ctrlKey) { - this.setState({ - search: (0, _searchGroups.createInputSearch)(search) - }); - this.setSideTabId((0, _interfaces.SideTabId).Search); - } else { - const oldSelection = this.viewer.getSelection(); - if (oldSelection.search) { - //look for matching groups and toggle them - const result = (0, _searchGroups.compareGroups)((0, _sanddanceReact.SandDance).searchExpression.ensureSearchExpressionGroupArray(oldSelection.search), search); - if (result.found) { - //removing a group - if (result.groups.length === 0) this.doDeselect(); - else //select with new search removed - this.doSelect(result.groups); - } else //adding a new group - if (e.altKey || e.shiftKey) { - let group = true; - if (e.altKey) search.clause = '&&'; - else if (e.shiftKey) { - if (this.props.searchORDisabled) group = false; - else search.clause = '||'; - } - if (group) { - result.groups.push(search); - this.doSelect(result.groups); - } else this.doSelect(search); - } else //replace - this.doSelect(search); - } else this.doSelect(search); - } - } - doFilter(search, historicFilterChange) { - this.historicFilterChange = historicFilterChange; - this.viewer.filter(search); - } - doUnfilter(historicFilterChange) { - this.historicFilterChange = historicFilterChange; - this.viewer.reset(); - } - doSelect(search) { - return this.viewer.select(search); - } - doDeselect() { - return this.viewer.deselect(); - } - writeSnapshot(snapshot, editIndex) { - let { selectedSnapshotIndex } = this.state; - let snapshots; - if (editIndex >= 0) { - snapshots = [ - ...this.state.snapshots - ]; - snapshots[editIndex] = snapshot; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - } else { - const note = snapshot.description; - snapshots = this.state.snapshots.concat(snapshot); - selectedSnapshotIndex = snapshots.length - 1; - this.scrollSnapshotIntoView(selectedSnapshotIndex); - this.setState({ - sideTabId: (0, _interfaces.SideTabId).Snapshots, - snapshots, - selectedSnapshotIndex, - note - }); - } - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - } - scrollSnapshotIntoView(selectedSnapshotIndex) { - clearTimeout(this.scrollSnapshotTimer); - if (this.state.sidebarClosed) return; - this.scrollSnapshotTimer = setTimeout(()=>{ - const selectedSnapshotElement = this.div.querySelector(`.snapshot:nth-child(${selectedSnapshotIndex + 1})`); - if (selectedSnapshotElement) selectedSnapshotElement.scrollIntoView({ - behavior: 'smooth', - block: 'nearest' - }); - }, 500); - } - componentDidMount() { - if (this.props.mounted) this.props.mounted(this); - } - render() { - var _a, _b, _c; - const insight = (0, _history.getPureInsight)(this.state); - const loaded = !!(insight.columns && this.state.dataContent); - if (loaded) (0, _backgroundImageEditor.setInsightBackgroundImage)(insight, this.imageHolder, this.state.columns); - const selectionState = this.viewer && this.viewer.getSelection() || {}; - const selectionSearch = selectionState && selectionState.search; - const columnMapProps = this.getColumnMapBaseProps(); - const datas = {}; - datas[(0, _dataScope.DataScopeId).AllData] = this.state.dataContent && this.state.dataContent.data; - datas[(0, _dataScope.DataScopeId).FilteredData] = this.state.filteredData; - datas[(0, _dataScope.DataScopeId).SelectedData] = selectionState && selectionState.selectedData; - if (this.state.calculating) requestAnimationFrame(()=>{ - //allow render to complete - if (this.state.calculating) { - this.state.calculating(); - this.setState({ - calculating: null - }); - } - }); - const theme = this.props.theme || ''; - const themePalette = (0, _themes.themePalettes)[theme]; - let renderOptions; - if (loaded) renderOptions = Object.assign(Object.assign({}, this.props.renderOptions), { - rebaseFilter: ()=>this.rebaseFilter, - initialColorContext: this.getColorContext && this.getColorContext(this.viewer.insight, insight), - discardColorContextUpdates: ()=>this.discardColorContextUpdates, - columns: (_a = this.state.dataContent) === null || _a === void 0 ? void 0 : _a.columns - }); - return (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div) this.div = div; - }, - className: (0, _sanddanceReact.util).classList('sanddance-explorer', this.props.theme) - }, (0, _base.base).react.createElement((0, _topbar.Topbar), { - collapseLabels: this.props.compactUI, - historyIndex: this.state.historyIndex, - historyItems: this.state.historyItems, - undo: ()=>this.undo(), - redo: ()=>this.redo(), - logoClickUrl: this.props.logoClickUrl, - logoClickTarget: this.props.logoClickTarget, - themePalette: themePalette, - loaded: loaded, - doDeselect: this.doDeselect.bind(this), - doFilter: this.doFilter.bind(this), - doUnfilter: this.doUnfilter.bind(this), - filter: this.state.filter, - selectionSearch: selectionSearch, - selectionState: selectionState, - buttons: this.props.topBarButtonProps, - iconButtons: this.props.topBarIconButtonProps, - view: this.state.view, - snapshotsHidden: (_b = this.props.snapshotProps) === null || _b === void 0 ? void 0 : _b.hidden, - snapshots: this.state.snapshots, - onSnapshotPreviousClick: ()=>{ - let selectedSnapshotIndex; - if (this.state.selectedSnapshotIndex === -1) selectedSnapshotIndex = this.state.snapshots.length - 1; - else { - selectedSnapshotIndex = this.state.selectedSnapshotIndex; - selectedSnapshotIndex--; - if (selectedSnapshotIndex < 0) selectedSnapshotIndex = this.state.snapshots.length - 1; - } - this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); - }, - onSnapshotClick: ()=>this.snapshotEditor.editSnapshot(), - onSnapshotNextClick: ()=>{ - let selectedSnapshotIndex; - if (this.state.selectedSnapshotIndex === -1) selectedSnapshotIndex = 0; - else { - selectedSnapshotIndex = this.state.selectedSnapshotIndex; - selectedSnapshotIndex++; - if (selectedSnapshotIndex > this.state.snapshots.length - 1) selectedSnapshotIndex = 0; - } - this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); - }, - onViewClick: ()=>{ - const view = this.state.view === '2d' ? '3d' : '2d'; - this.changeInsight({ - view - }, { - label: view === '2d' ? (0, _language.strings).labelViewType2d : (0, _language.strings).labelViewType3d - }); - } - }), (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-main', this.state.sidebarPinned && 'pinned', this.state.sidebarClosed && 'closed', (insight.hideLegend || insight.directColor || !(0, _columns.colorMapping)(insight, this.state.dataContent && this.state.dataContent.columns)) && 'hide-legend') - }, (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div && !this.layoutDivUnpinned) this.layoutDivUnpinned = div; - }, - className: "sanddance-layout-unpinned" - }), (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div && !this.layoutDivPinned) this.layoutDivPinned = div; - }, - className: "sanddance-layout-pinned" - }), !loaded && (0, _base.base).react.createElement("div", { - className: "loading" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Spinner, { - size: (0, _base.base).fluentUI.SpinnerSize.large, - label: (0, _language.strings).loading - })), (0, _base.base).react.createElement((0, _sidebar.Sidebar), { - themePalette: themePalette, - calculating: !!this.state.calculating, - closed: this.state.sidebarClosed, - hideSidebarControls: this.props.hideSidebarControls, - snapshotsHidden: (_c = this.props.snapshotProps) === null || _c === void 0 ? void 0 : _c.hidden, - pinned: this.state.sidebarPinned, - disabled: !loaded, - dataScopeProps: { - themePalette, - compact: this.state.sidebarClosed, - onCompactClick: ()=>{ - this.changeInsight({ - size: this.getLayoutDivSize(this.state.sidebarPinned, false) - }, { - label: null, - omit: true - }, { - sidebarClosed: false - }); - }, - dataSet: this.props.datasetElement, - dataCount: loaded && { - all: this.state.dataContent && this.state.dataContent.data.length, - filtered: this.state.filteredData && this.state.filteredData.length, - selected: selectionState && selectionState.selectedData && selectionState.selectedData.length - }, - active: this.state.sideTabId === (0, _interfaces.SideTabId).Data, - onDataScopeClick: (dataScopeId)=>this.setSideTabId((0, _interfaces.SideTabId).Data, dataScopeId), - selectedDataScope: this.state.dataScopeId, - disabled: !loaded - }, - onSideTabClick: (sideTabId)=>{ - //collapse or toggle - if (sideTabId === (0, _interfaces.SideTabId).Collapse || this.state.sideTabId === sideTabId) { - let { dataScopeId, sidebarClosed } = this.state; - if (sidebarClosed && sideTabId === (0, _interfaces.SideTabId).Data) dataScopeId = this.getBestDataScopeId(); - sidebarClosed = !this.state.sidebarClosed; - this.changeInsight({ - size: this.getLayoutDivSize(this.state.sidebarPinned, sidebarClosed) - }, { - label: null, - omit: true - }, { - dataScopeId, - sidebarClosed - }); - } else if (sideTabId === (0, _interfaces.SideTabId).Pin) this.changeInsight({ - size: this.getLayoutDivSize(!this.state.sidebarPinned, this.state.sidebarClosed) - }, { - label: null, - omit: true - }, { - sidebarPinned: !this.state.sidebarPinned - }); - else this.setSideTabId(sideTabId); - }, - selectedSideTab: this.state.sideTabId - }, loaded && (()=>{ - switch(this.state.sideTabId){ - case (0, _interfaces.SideTabId).ChartType: - return (0, _base.base).react.createElement((0, _chart.Chart), Object.assign({ - themePalette: themePalette, - collapseLabels: this.props.compactUI, - tooltipExclusions: this.state.tooltipExclusions, - toggleTooltipExclusion: (columnName)=>{ - const tooltipExclusions = [ - ...this.state.tooltipExclusions - ]; - const i = tooltipExclusions.indexOf(columnName); - if (i < 0) tooltipExclusions.push(columnName); - else tooltipExclusions.splice(i, 1); - this.setState({ - tooltipExclusions - }); - this.props.onTooltipExclusionsChanged && this.props.onTooltipExclusionsChanged(tooltipExclusions); - }, - disabled: !loaded || this.state.sidebarClosed - }, columnMapProps, { - chart: this.state.chart, - view: this.state.view, - insightColumns: this.state.columns, - onChangeSignal: (role, column, name, value)=>(0, _partialInsight.saveSignalValuePref)(this.prefs, this.state.chart, role, column, name, value) - })); - case (0, _interfaces.SideTabId).Color: - return (0, _base.base).react.createElement((0, _color.Color), Object.assign({ - compactUI: this.props.compactUI, - specCapabilities: this.state.specCapabilities, - disabled: !loaded || this.state.sidebarClosed - }, columnMapProps, { - dataContent: this.state.dataContent, - scheme: this.state.scheme, - colorBin: this.state.colorBin, - colorBinSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s)=>s.name === (0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount)[0], - colorReverseSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s)=>s.name === (0, _sanddanceReact.SandDance).constants.SignalNames.ColorReverse)[0], - colorColumn: this.state.columns.color, - onColorBinChange: (colorBin)=>{ - this.ignoreSelectionChange = true; - this.viewer.deselect().then(()=>{ - this.ignoreSelectionChange = false; - //allow deselection to render - requestAnimationFrame(()=>{ - this.getColorContext = null; - this.changeInsight({ - colorBin - }, { - label: (0, _language.strings).labelHistoryColorBin - }); - (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, { - colorBin - }); - }); - }); - }, - onColorSchemeChange: (scheme)=>{ - this.changeColumnMapping('color', this.state.dataContent.columns.filter((c)=>c.name === this.state.columns.color)[0], { - scheme - }); - (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, { - scheme - }); - }, - onColorBinCountChange: (value)=>{ - const signalValues = {}; - signalValues[(0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount] = value; - (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, { - signalValues - }); - }, - onColorReverseChange: (value)=>{ - this.getColorContext = null; - }, - directColor: this.state.directColor, - onDirectColorChange: (directColor)=>{ - this.changeInsight({ - directColor - }, { - label: (0, _language.strings).labelHistoryDirectColor - }, { - calculating: ()=>this._resize() - }); - } - })); - case (0, _interfaces.SideTabId).Data: - { - const data = datas[this.state.dataScopeId]; - let itemVisible = true; - switch(this.state.dataScopeId){ - case (0, _dataScope.DataScopeId).AllData: - { - const item = this.state.selectedItemIndex[this.state.dataScopeId]; - itemVisible = this.state.dataContent && !this.state.filteredData || this.state.filteredData.indexOf(data[item]) >= 0; - } - } - return (0, _base.base).react.createElement((0, _dataBrowser.DataBrowser), { - explorer: this, - theme: this.props.theme, - themePalette: themePalette, - disabled: !loaded || this.state.sidebarClosed, - columns: this.state.dataContent && this.state.dataContent.columns, - categoricalColumns: columnMapProps.categoricalColumns, - quantitativeColumns: columnMapProps.quantitativeColumns, - data: data, - displayName: this.state.dataFile && this.state.dataFile.displayName || (0, _language.strings).defaultFileName, - nullMessage: (0, _dataBrowser.dataBrowserNullMessages)[this.state.dataScopeId], - zeroMessage: (0, _dataBrowser.dataBrowserZeroMessages)[this.state.dataScopeId], - index: this.state.selectedItemIndex[this.state.dataScopeId], - itemVisible: itemVisible, - dataExportHandler: this.props.dataExportHandler, - selectedDataScope: this.state.dataScopeId, - onDataScopeClick: (dataScopeId)=>this.setSideTabId((0, _interfaces.SideTabId).Data, dataScopeId), - onActivate: (row, index)=>{ - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - selectedItemIndex[this.state.dataScopeId] = index; - this.setState({ - selectedItemIndex - }); - this.silentActivation(row); - }, - onSearch: (e, search)=>{ - if (e.ctrlKey) this.setState({ - sideTabId: (0, _interfaces.SideTabId).Search, - search - }); - else this.doSelect(search); - }, - bingSearchDisabled: this.props.bingSearchDisabled, - onUpdateColumnTypes: (columnTypes)=>{ - this.load(this.state.dataFile, null, { - prefs: this.prefs, - columnTypes - }); - } - }); - } - case (0, _interfaces.SideTabId).Search: - return (0, _base.base).react.createElement((0, _search.Search), { - explorer: this, - collapseLabels: this.props.compactUI, - themePalette: themePalette, - disabled: !loaded || this.state.sidebarClosed, - disableGroupOR: this.props.searchORDisabled, - disableExpressionOR: this.props.searchORDisabled, - initializer: { - columns: columnMapProps.allColumns, - search: this.state.search - }, - autoCompleteDistinctValues: this.state.autoCompleteDistinctValues, - onSelect: (expr)=>this.doSelect(expr), - data: this.state.dataContent.data - }); - case (0, _interfaces.SideTabId).Snapshots: - return (0, _base.base).react.createElement((0, _snapshots.Snapshots), Object.assign({}, this.props.snapshotProps, { - editor: this.snapshotEditor, - themePalette: themePalette, - explorer: this, - snapshots: this.state.snapshots, - selectedSnapshotIndex: this.state.selectedSnapshotIndex, - onClearSnapshots: ()=>{ - const snapshots = []; - this.setState({ - snapshots, - selectedSnapshotIndex: -1 - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - }, - onWriteSnapshot: (s, i)=>this.writeSnapshot(s, i), - onRemoveSnapshot: (i)=>{ - const snapshots = [ - ...this.state.snapshots - ]; - snapshots.splice(i, 1); - let { selectedSnapshotIndex } = this.state; - if (i === selectedSnapshotIndex) selectedSnapshotIndex = -1; - else if (selectedSnapshotIndex > i) selectedSnapshotIndex--; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - }, - onSnapshotClick: (snapshot, selectedSnapshotIndex)=>{ - this.setState({ - selectedSnapshotIndex - }); - this.calculate(()=>{ - this.handleReviveSnapshot(snapshot, selectedSnapshotIndex); - }); - }, - onMoveUp: (i)=>{ - if (i > 0) { - const snapshots = [ - ...this.state.snapshots - ]; - const temp = snapshots[i - 1]; - snapshots[i - 1] = snapshots[i]; - snapshots[i] = temp; - let { selectedSnapshotIndex } = this.state; - if (i === selectedSnapshotIndex) selectedSnapshotIndex = i - 1; - else if (i - 1 === selectedSnapshotIndex) selectedSnapshotIndex = i; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - } - }, - onMoveDown: (i)=>{ - if (i < this.state.snapshots.length - 1) { - const snapshots = [ - ...this.state.snapshots - ]; - const temp = snapshots[i + 1]; - snapshots[i + 1] = snapshots[i]; - snapshots[i] = temp; - let { selectedSnapshotIndex } = this.state; - if (i === selectedSnapshotIndex) selectedSnapshotIndex = i + 1; - else if (i + 1 === selectedSnapshotIndex) selectedSnapshotIndex = i; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - } - } - })); - case (0, _interfaces.SideTabId).History: - return (0, _base.base).react.createElement((0, _history.History), { - explorer: this, - themePalette: themePalette, - historyIndex: this.state.historyIndex, - historyItems: this.state.historyItems, - redo: (i)=>this.redo(i) - }); - case (0, _interfaces.SideTabId).Transition: - return (0, _base.base).react.createElement((0, _transition.TransitionEditor), Object.assign({}, columnMapProps, this.state, { - compactUI: this.props.compactUI, - explorer: this, - themePalette: themePalette, - changeSetup: (newState, affectsStagger)=>{ - const calculating = ()=>{ - if (affectsStagger) this.viewer.assignTransitionStagger((0, _transition.getTransition)(this.state)); - this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(this.getSetup()); - }; - if (newState) this.setState(Object.assign(Object.assign({}, newState), { - calculating - })); - else calculating(); - } - })); - case (0, _interfaces.SideTabId).Settings: - return (0, _base.base).react.createElement((0, _settings.Settings), { - explorer: this, - dataFile: this.state.dataFile, - scheme: this.state.scheme, - hideLegend: this.state.hideLegend, - onToggleLegend: (hideLegend)=>this.setState({ - hideLegend, - calculating: ()=>this._resize() - }), - hideAxes: this.state.hideAxes, - onToggleAxes: (hideAxes)=>this.setState({ - calculating: ()=>this.setState({ - hideAxes - }) - }), - additionalSettings: this.props.additionalSettings - }, this.props.systemInfoChildren); - } - })()), loaded && (0, _base.base).react.createElement("div", { - className: "sanddance-view" - }, (0, _base.base).react.createElement((0, _sanddanceReact.Viewer), { - renderOptions: renderOptions, - viewerOptions: this.viewerOptions, - ref: (reactViewer)=>{ - if (reactViewer) this.viewer = reactViewer.viewer; - }, - onView: (renderResult)=>{ - this.rebaseFilter = false; - this.changespecCapabilities(renderResult.specResult.errors ? renderResult.specResult.specCapabilities : this.viewer.specCapabilities); - this.getColorContext = (oldInsight, newInsight)=>{ - if (!oldInsight && !newInsight) return null; - if (!oldInsight || !newInsight) return null; - if (oldInsight.scheme !== newInsight.scheme) return null; - if (oldInsight.columns.color !== newInsight.columns.color) return null; - if (oldInsight.directColor != newInsight.directColor) return null; - return this.viewer.colorContexts && this.viewer.colorContexts[this.viewer.currentColorContext]; - }; - //don't allow tabbing to the canvas - (0, _canvas.removeTabIndex)(this.viewer); - this.props.onView && this.props.onView(); - }, - onError: (e)=>{ - this.props.onError && this.props.onError(e); - }, - data: this.state.dataContent.data, - insight: insight, - setup: this.getSetup(), - onMount: (el)=>this.viewerMounted(el) - }), this.state.note && (0, _base.base).react.createElement("div", { - className: 'sanddance-note' - }, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - className: 'cancel', - themePalette: themePalette, - title: (0, _language.strings).buttonClose, - iconName: 'Cancel', - onClick: ()=>this.setState({ - note: null - }) - }), (0, _base.base).react.createElement("div", null, this.state.note)), (0, _base.base).react.createElement((0, _renderer.Renderer), { - explorer: this, - advanced: this.state.renderer.advanced, - advancedOptions: this.state.renderer.advancedOptions, - basicOptions: this.state.renderer.basicOptions, - themePalette: themePalette, - onHomeClick: ()=>{ - this.setState({ - camera: undefined - }); - this.viewer.presenter.homeCamera(); - } - })), (0, _base.base).react.createElement((0, _dialog.Dialog), { - title: (0, _language.strings).labelError, - hidden: !this.state.errors, - onDismiss: ()=>{ - this.setState({ - errors: null - }); - } - }, this.state.errors && this.state.errors.map((error, i)=>(0, _base.base).react.createElement("div", { - key: i - }, error))), (0, _base.base).react.createElement((0, _snapshotEditor.SnapshotEditor), Object.assign({ - ref: (se)=>this.snapshotEditor = se - }, this.props.snapshotProps, { - explorer: this, - onWriteSnapshot: (s, i)=>this.writeSnapshot(s, i), - theme: this.props.theme, - themePalette: themePalette - }))), this.state.positionedColumnMapProps && (0, _base.base).react.createElement((0, _clickableTextLayer.PositionedColumnMap), Object.assign({}, this.state.positionedColumnMapProps))); - } - getColumnMapBaseProps() { - const allColumns = this.state.dataContent && this.state.dataContent.columns.filter((c)=>!(0, _sanddanceReact.SandDance).util.isInternalFieldName(c.name, true)); - const quantitativeColumns = allColumns && allColumns.filter((c)=>c.quantitative); - const categoricalColumns = allColumns && allColumns.filter((c)=>!c.quantitative); - const props = { - changeColumnMapping: (role, columnOrRole, defaultColumn, options)=>{ - let column; - if (typeof columnOrRole === 'string') { - //look up current insight - const columnName = this.state.columns[columnOrRole]; - column = allColumns.filter((c)=>c.name === columnName)[0] || defaultColumn; - } else column = columnOrRole; - this.changeColumnMapping(role, column, options); - }, - facetStyle: this.state.facetStyle, - totalStyle: this.state.totalStyle, - allColumns, - quantitativeColumns, - categoricalColumns, - specCapabilities: this.state.specCapabilities, - explorer: this - }; - return props; - } + this.pause(); + this.direction = void 0; } - return new __Explorer(_props); -} -const Explorer = _Explorer; - -},{"./base":"3TPz5","./canvas":"55nq5","./clickableTextLayer":"2iqEH","./colorMap":"hxIPY","./colorScheme":"1pr3j","./columns":"7ZE4v","./controls/dataScope":"0ukjY","./controls/dialog":"OQi9w","./controls/iconButton":"6pZiK","./controls/sidebar":"8tdcg","./controls/topbar":"frGei","./dataLoader":"cz9uW","./defaults":"5K5JN","./dialogs/chart":"dwBpS","./dialogs/color":"jLMxI","./dialogs/dataBrowser":"dT4UW","./dialogs/history":"4nAWT","./dialogs/search":"eXzPo","./dialogs/settings":"2xbhO","./dialogs/snapshotEditor":"g29jp","./dialogs/snapshots":"sTI5I","./dialogs/transition":"3tDGl","./interfaces":"k3BwW","./language":"67xOI","./mouseEvent":"ioN9k","./partialInsight":"1nehK","./themes":"g7FJh","./searchGroups":"3oCWU","@msrvida/chart-recommender":"isTvp","@msrvida/sanddance-react":"lPyTZ","./controls/renderer":"4tj9B","./dialogs/backgroundImageEditor":"hTdbK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hxIPY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applyColorButtons", ()=>applyColorButtons); -var _base = require("./base"); -var _iconButton = require("./controls/iconButton"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("./language"); -const className = 'sanddance-panel-tools'; -function ensureToolbar(panel) { + } + const className = "sanddance-panel-tools"; + function ensureToolbar(panel) { const existing = panel.getElementsByClassName(className); - if (existing.length > 0) return existing[0]; - else { - const div = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.addDiv(panel, className); - panel.insertAdjacentElement('afterbegin', div); - return div; + if (existing.length > 0) { + return existing[0]; + } else { + const div = addDiv(panel, className); + panel.insertAdjacentElement("afterbegin", div); + return div; } -} -function applyColorButtons(presenter, showLegend, props) { - const panel = presenter.getElement((0, _sanddanceReact.SandDance).VegaMorphCharts.PresenterElement.panel); + } + function applyColorButtons(presenter, showLegend, props) { + const panel = presenter.getElement(PresenterElement$1.panel); const div = ensureToolbar(panel); - (0, _base.base).reactDOM.render(ColorMap(props), div); - panel.style.display = showLegend ? '' : 'none'; -} -function ColorMap(props) { + base$1.reactDOM.render(ColorMap(props), div); + panel.style.display = showLegend ? "" : "none"; + } + function ColorMap(props) { const menuProps = { - items: [ - { - key: 'new', - text: (0, _language.strings).buttonColorSchemeRemap, - disabled: !props.canRemap || props.isRemap, - onClick: ()=>props.colorMapHandler(true) - }, - { - key: 'old', - text: (0, _language.strings).buttonColorSchemeKeep, - disabled: !props.canRemap || !props.isRemap, - onClick: ()=>props.colorMapHandler(false) - } - ] - }; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - styles: { - menuIcon: { - display: 'none' - } - }, - themePalette: props.themePalette, - title: (0, _language.strings).buttonColorSchemeMap, - onClick: null, - iconName: props.canRemap ? 'FiltersSolid' : 'Filters', - menuProps: menuProps - })); -} - -},{"./base":"3TPz5","./controls/iconButton":"6pZiK","@msrvida/sanddance-react":"lPyTZ","./language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1pr3j":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bestColorScheme", ()=>bestColorScheme); -function bestColorScheme(newColumn, oldColumn, oldScheme) { - if (oldColumn && oldColumn.quantitative === newColumn.quantitative && defaultColorScheme(oldColumn) === defaultColorScheme(newColumn)) return oldScheme; - return defaultColorScheme(newColumn); -} -function defaultColorScheme(c) { - if (c.quantitative) return 'redyellowgreen'; - else if (c.stats.distinctValueCount === 2) return 'dual_redgreen'; - else if (c.stats.distinctValueCount <= 10) return 'category10'; - return 'category20'; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0ukjY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataScopeId", ()=>DataScopeId); -parcelHelpers.export(exports, "resetSelectedItemIndex", ()=>resetSelectedItemIndex); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -var _button = require("./button"); -var _base = require("../base"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _d3Format = require("d3-format"); -var DataScopeId; -(function(DataScopeId) { - DataScopeId[DataScopeId["AllData"] = 0] = "AllData"; - DataScopeId[DataScopeId["SelectedData"] = 1] = "SelectedData"; - DataScopeId[DataScopeId["FilteredData"] = 2] = "FilteredData"; -})(DataScopeId || (DataScopeId = {})); -function resetSelectedItemIndex(selectedItemIndex) { - selectedItemIndex[DataScopeId.AllData] = 0; - selectedItemIndex[DataScopeId.FilteredData] = 0; - selectedItemIndex[DataScopeId.SelectedData] = 0; -} -const shortFormat = (0, _d3Format.format)('.2~s'); -function short(n) { - return n === -1 ? '--' : n ? n < 1000 ? n.toString() : shortFormat(n) : '0'; -} -function DataScope(props) { - const dataCount = Object.assign({ - all: -1, - filtered: -1, - selected: -1 - }, props.dataCount); - return props.compact ? (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-datascope', 'compact'), - onClick: props.onCompactClick - }, (0, _base.base).react.createElement(Compact, Object.assign({}, props, { - dataScopeId: DataScopeId.AllData, - text: (0, _language.strings).selectDataSpanAll, - count: dataCount.all - })), (0, _base.base).react.createElement(Compact, Object.assign({}, props, { - dataScopeId: DataScopeId.FilteredData, - text: (0, _language.strings).selectDataSpanFilter, - count: dataCount.filtered - })), (0, _base.base).react.createElement(Compact, Object.assign({}, props, { - dataScopeId: DataScopeId.SelectedData, - text: (0, _language.strings).selectDataSpanSelection, - count: dataCount.selected - }))) : (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-datascope', 'extended', props.active && 'active') - }, (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("div", null, props.dataSet), (0, _base.base).react.createElement("div", { - className: "datascope-buttons" - }, (0, _base.base).react.createElement(DataScopeButton, Object.assign({}, props, { - dataScopeId: DataScopeId.AllData, - text: (0, _language.strings).selectDataSpanAll, - count: dataCount.all - })), (0, _base.base).react.createElement(DataScopeButton, Object.assign({}, props, { - dataScopeId: DataScopeId.FilteredData, - text: (0, _language.strings).selectDataSpanFilter, - count: dataCount.filtered - })), (0, _base.base).react.createElement(DataScopeButton, Object.assign({}, props, { - dataScopeId: DataScopeId.SelectedData, - text: (0, _language.strings).selectDataSpanSelection, - count: dataCount.selected - }))))); -} -function Compact(props) { - return (0, _base.base).react.createElement("div", { - title: props.text, - onClick: ()=>{ - props.onDataScopeClick(props.dataScopeId); - } - }, short(props.count)); -} -function DataScopeButton(props) { - return (0, _base.base).react.createElement((0, _button.Button), { - themePalette: props.themePalette, - className: (0, _sanddanceReact.util).classList('datascope-button', props.selectedDataScope === props.dataScopeId && 'selected'), - disabled: props.disabled, - text: props.text, - onClick: ()=>{ - props.onDataScopeClick(props.dataScopeId); - }, - onRenderText: ()=>{ - return (0, _base.base).react.createElement("div", { - title: props.count > 0 ? props.count.toString() : '' - }, (0, _base.base).react.createElement("label", null, props.text), (0, _base.base).react.createElement("div", null, short(props.count))); + items: [ + { + key: "new", + text: strings$1.buttonColorSchemeRemap, + disabled: !props.canRemap || props.isRemap, + onClick: () => props.colorMapHandler(true) }, - onRenderIcon: ()=>null - }); -} - -},{"./button":"f8wtc","../base":"3TPz5","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","d3-format":"itHmU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"itHmU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "formatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "format", ()=>(0, _defaultLocaleJs.format)); -parcelHelpers.export(exports, "formatPrefix", ()=>(0, _defaultLocaleJs.formatPrefix)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "formatSpecifier", ()=>(0, _formatSpecifierJsDefault.default)); -parcelHelpers.export(exports, "FormatSpecifier", ()=>(0, _formatSpecifierJs.FormatSpecifier)); -parcelHelpers.export(exports, "precisionFixed", ()=>(0, _precisionFixedJsDefault.default)); -parcelHelpers.export(exports, "precisionPrefix", ()=>(0, _precisionPrefixJsDefault.default)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _precisionRoundJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _precisionFixedJs = require("./precisionFixed.js"); -var _precisionFixedJsDefault = parcelHelpers.interopDefault(_precisionFixedJs); -var _precisionPrefixJs = require("./precisionPrefix.js"); -var _precisionPrefixJsDefault = parcelHelpers.interopDefault(_precisionPrefixJs); -var _precisionRoundJs = require("./precisionRound.js"); -var _precisionRoundJsDefault = parcelHelpers.interopDefault(_precisionRoundJs); - -},{"./defaultLocale.js":"93IfM","./locale.js":false,"./formatSpecifier.js":false,"./precisionFixed.js":false,"./precisionPrefix.js":false,"./precisionRound.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93IfM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formatPrefix", ()=>formatPrefix); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var format; -var formatPrefix; -defaultLocale({ - decimal: ".", - thousands: ",", - grouping: [ - 3 - ], - currency: [ - "$", - "" - ], - minus: "-" -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} - -},{"./locale.js":"MDG5s","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"MDG5s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? (0, _identityJsDefault.default) : (0, _formatGroupJsDefault.default)(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? (0, _identityJsDefault.default) : (0, _formatNumeralsJsDefault.default)(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "-" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - function newFormat(specifier) { - specifier = (0, _formatSpecifierJsDefault.default)(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - else if (!(0, _formatTypesJsDefault.default)[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - // If zero fill is specified, padding goes after sign and before digits. - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = (0, _formatTypesJsDefault.default)[type], maybeSuffix = /[defgprs%]/.test(type); - // Set the default precision if not specified, - // or clamp the specified precision to the supported range. - // For significant precision, it must be in [1, 21]. - // For fixed precision, it must be in [0, 20]. - precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - // Trim insignificant zeros. - if (trim) value = (0, _formatTrimJsDefault.default)(value); - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + (0, _formatPrefixAutoJs.prefixExponent) / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while(++i < n)if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - // Reconstruct the final output based on the desired alignment. - switch(align){ - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format.toString = function() { - return specifier + ""; - }; - return format; + { + key: "old", + text: strings$1.buttonColorSchemeKeep, + disabled: !props.canRemap || !props.isRemap, + onClick: () => props.colorMapHandler(false) } - function formatPrefix(specifier, value) { - var f = newFormat((specifier = (0, _formatSpecifierJsDefault.default)(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; + ] + }; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(IconButton$1, { styles: { + menuIcon: { + display: "none" } - return { - format: newFormat, - formatPrefix: formatPrefix - }; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); -var _formatGroupJs = require("./formatGroup.js"); -var _formatGroupJsDefault = parcelHelpers.interopDefault(_formatGroupJs); -var _formatNumeralsJs = require("./formatNumerals.js"); -var _formatNumeralsJsDefault = parcelHelpers.interopDefault(_formatNumeralsJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _formatTrimJs = require("./formatTrim.js"); -var _formatTrimJsDefault = parcelHelpers.interopDefault(_formatTrimJs); -var _formatTypesJs = require("./formatTypes.js"); -var _formatTypesJsDefault = parcelHelpers.interopDefault(_formatTypesJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var map = Array.prototype.map, prefixes = [ - "y", - "z", - "a", - "f", - "p", - "n", - "\xb5", - "m", - "", - "k", - "M", - "G", - "T", - "P", - "E", - "Z", - "Y" -]; - -},{"./exponent.js":"hGAq4","./formatGroup.js":"jxvv9","./formatNumerals.js":"f3HGM","./formatSpecifier.js":"8Wjeu","./formatTrim.js":"SfY1D","./formatTypes.js":"hmsB1","./formatPrefixAuto.js":"kxrNA","./identity.js":"Nub0n","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hGAq4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x = (0, _formatDecimalJs.formatDecimalParts)(Math.abs(x)), x ? x[1] : NaN; - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"9qcOn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9qcOn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); - }); -// Computes the decimal coefficient and exponent of the specified number x with -// significant digits p, where x is positive and p is in [1, 21] or undefined. -// For example, formatDecimalParts(1.23) returns ["123", 0]. -parcelHelpers.export(exports, "formatDecimalParts", ()=>formatDecimalParts); -function formatDecimalParts(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = x.slice(0, i); - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). + }, themePalette: props.themePalette, title: strings$1.buttonColorSchemeMap, onClick: null, iconName: props.canRemap ? "FiltersSolid" : "Filters", menuProps }) + ); + } + function bestColorScheme(newColumn, oldColumn, oldScheme) { + return defaultColorScheme(newColumn); + } + function defaultColorScheme(c2) { + if (c2.quantitative) { + return "redyellowgreen"; + } else if (c2.stats.distinctValueCount === 2) { + return "dual_redgreen"; + } else if (c2.stats.distinctValueCount <= 10) { + return "category10"; + } + return "category20"; + } + function formatDecimal(x2) { + return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); + } + function formatDecimalParts(x2, p) { + if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; + var i, coefficient = x2.slice(0, i); return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x2.slice(i + 1) ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jxvv9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while(i > 0 && g > 0){ - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f3HGM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Wjeu":[function(require,module,exports,__globalThis) { -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatSpecifier); -parcelHelpers.export(exports, "FormatSpecifier", ()=>FormatSpecifier); -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; + } + function exponent(x2) { + return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN; + } + function formatGroup(grouping, thousands) { + return function(value2, width2) { + var i = value2.length, t = [], j = 0, g = grouping[0], length2 = 0; + while (i > 0 && g > 0) { + if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); + t.push(value2.substring(i -= g, i + g)); + if ((length2 += g + 1) > width2) break; + g = grouping[j = (j + 1) % grouping.length]; + } + return t.reverse().join(thousands); + }; + } + function formatNumerals(numerals) { + return function(value2) { + return value2.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } + var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + function formatSpecifier(specifier) { + if (!(match2 = re.exec(specifier))) throw new Error("invalid format: " + specifier); + var match2; return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] + fill: match2[1], + align: match2[2], + sign: match2[3], + symbol: match2[4], + zero: match2[5], + width: match2[6], + comma: match2[7], + precision: match2[8] && match2[8].slice(1), + trim: match2[9], + type: match2[10] }); -} -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof -function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; + } + formatSpecifier.prototype = FormatSpecifier.prototype; + function FormatSpecifier(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} -FormatSpecifier.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"SfY1D":[function(require,module,exports,__globalThis) { -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(s) { - out: for(var n = s.length, i = 1, i0 = -1, i1; i < n; ++i)switch(s[i]){ - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; - break; - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hmsB1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _formatDecimalJs = require("./formatDecimal.js"); -var _formatDecimalJsDefault = parcelHelpers.interopDefault(_formatDecimalJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _formatPrefixAutoJsDefault = parcelHelpers.interopDefault(_formatPrefixAutoJs); -var _formatRoundedJs = require("./formatRounded.js"); -var _formatRoundedJsDefault = parcelHelpers.interopDefault(_formatRoundedJs); -exports.default = { - "%": function(x, p) { - return (x * 100).toFixed(p); - }, - "b": function(x) { - return Math.round(x).toString(2); + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + FormatSpecifier.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + function formatTrim(s2) { + out: for (var n = s2.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s2[i]) { + case ".": + i0 = i1 = i; + break; + case "0": + if (i0 === 0) i0 = i; + i1 = i; + break; + default: + if (!+s2[i]) break out; + if (i0 > 0) i0 = 0; + break; + } + } + return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2; + } + var prefixExponent; + function formatPrefixAuto(x2, p) { + var d2 = formatDecimalParts(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; + return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x2, Math.max(0, p + i - 1))[0]; + } + function formatRounded(x2, p) { + var d2 = formatDecimalParts(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1]; + return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); + } + const formatTypes = { + "%": function(x2, p) { + return (x2 * 100).toFixed(p); }, - "c": function(x) { - return x + ""; + "b": function(x2) { + return Math.round(x2).toString(2); }, - "d": (0, _formatDecimalJsDefault.default), - "e": function(x, p) { - return x.toExponential(p); + "c": function(x2) { + return x2 + ""; }, - "f": function(x, p) { - return x.toFixed(p); + "d": formatDecimal, + "e": function(x2, p) { + return x2.toExponential(p); }, - "g": function(x, p) { - return x.toPrecision(p); + "f": function(x2, p) { + return x2.toFixed(p); }, - "o": function(x) { - return Math.round(x).toString(8); + "g": function(x2, p) { + return x2.toPrecision(p); }, - "p": function(x, p) { - return (0, _formatRoundedJsDefault.default)(x * 100, p); + "o": function(x2) { + return Math.round(x2).toString(8); }, - "r": (0, _formatRoundedJsDefault.default), - "s": (0, _formatPrefixAutoJsDefault.default), - "X": function(x) { - return Math.round(x).toString(16).toUpperCase(); + "p": function(x2, p) { + return formatRounded(x2 * 100, p); }, - "x": function(x) { - return Math.round(x).toString(16); - } -}; - -},{"./formatDecimal.js":"9qcOn","./formatPrefixAuto.js":"kxrNA","./formatRounded.js":"bk9ei","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kxrNA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixExponent", ()=>prefixExponent); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + (0, _formatDecimalJs.formatDecimalParts)(x, Math.max(0, p + i - 1))[0]; // less than 1y! - }); -var _formatDecimalJs = require("./formatDecimal.js"); -var prefixExponent; - -},{"./formatDecimal.js":"9qcOn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bk9ei":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"9qcOn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Nub0n":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8tdcg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sidebar", ()=>Sidebar); -var _base = require("../base"); -var _dataScope = require("./dataScope"); -var _scrollable = require("./scrollable"); -var _interfaces = require("../interfaces"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _sideButton = require("./sideButton"); -function Sidebar(props) { - const sidebuttons = [ - { - sideTabId: (0, _interfaces.SideTabId).ChartType, - iconName: 'BIDashboard', - title: (0, _language.strings).labelChart - }, - { - sideTabId: (0, _interfaces.SideTabId).Color, - iconName: 'Color', - title: (0, _language.strings).labelColor - }, - { - sideTabId: (0, _interfaces.SideTabId).Data, - iconName: 'Table', - title: (0, _language.strings).labelDataBrowser - }, - { - sideTabId: (0, _interfaces.SideTabId).Search, - iconName: 'Search', - title: (0, _language.strings).labelSearch - }, - !props.snapshotsHidden && { - sideTabId: (0, _interfaces.SideTabId).Snapshots, - iconName: 'Camera', - title: (0, _language.strings).labelSnapshots - }, - { - sideTabId: (0, _interfaces.SideTabId).History, - iconName: 'History', - title: (0, _language.strings).labelHistory - }, - { - sideTabId: (0, _interfaces.SideTabId).Transition, - iconName: 'Flow', - title: (0, _language.strings).labelTransition - }, - { - sideTabId: (0, _interfaces.SideTabId).Settings, - iconName: 'Settings', - title: (0, _language.strings).labelChartSettings - } - ].filter(Boolean); - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-sidebar', 'calculator', props.pinned && 'pinned', props.closed && 'closed') - }, (0, _base.base).react.createElement("div", { - className: "sidebar-content" - }, (0, _base.base).react.createElement((0, _dataScope.DataScope), Object.assign({}, props.dataScopeProps)), (0, _base.base).react.createElement("div", { - className: "vbuttons" - }, (0, _base.base).react.createElement("div", { - className: "sidebar-dialogs", - role: 'tablist' - }, sidebuttons.map((sidebutton, i)=>(0, _base.base).react.createElement((0, _sideButton.Sidebutton), Object.assign({ - key: i - }, props, sidebutton, { - themePalette: props.themePalette - })))), !props.hideSidebarControls && (0, _base.base).react.createElement("div", { - className: "sidebar-controls" - }, (0, _base.base).react.createElement((0, _sideButton.Sidebutton), Object.assign({}, props, { - omitAriaSelected: true, - role: 'button', - sideTabId: (0, _interfaces.SideTabId).Pin, - iconName: props.pinned ? 'Pinned' : 'Pin', - title: props.pinned ? (0, _language.strings).buttonToolbarFloat : (0, _language.strings).buttonToolbarDock - })), (0, _base.base).react.createElement((0, _sideButton.Sidebutton), Object.assign({}, props, { - omitAriaSelected: true, - role: 'button', - sideTabId: (0, _interfaces.SideTabId).Collapse, - iconName: props.closed ? 'DoubleChevronRight12' : 'DoubleChevronLeft12', - title: props.closed ? (0, _language.strings).buttonToolbarShow : (0, _language.strings).buttonToolbarHide - })))), (0, _base.base).react.createElement((0, _scrollable.Scrollable), { - role: 'tabpanel' - }, (0, _base.base).react.createElement("div", { - className: "sidetab" - }, props.children)), props.calculating && (0, _base.base).react.createElement("div", { - className: "calculating" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Spinner, { - size: (0, _base.base).fluentUI.SpinnerSize.large - })))); -} - -},{"../base":"3TPz5","./dataScope":"0ukjY","./scrollable":"kjmdO","../interfaces":"k3BwW","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","./sideButton":"lIUiX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kjmdO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scrollable", ()=>Scrollable); -var _base = require("../base"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Scrollable(props) { - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('scrollable-container', props.className), - role: props.role - }, (0, _base.base).react.createElement("div", { - className: "scrollable" - }, props.children)); -} - -},{"../base":"3TPz5","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k3BwW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SideTabId", ()=>SideTabId); -var SideTabId; -(function(SideTabId) { - SideTabId[SideTabId["ChartType"] = 0] = "ChartType"; - SideTabId[SideTabId["Data"] = 1] = "Data"; - SideTabId[SideTabId["Search"] = 2] = "Search"; - SideTabId[SideTabId["Color"] = 3] = "Color"; - SideTabId[SideTabId["Snapshots"] = 4] = "Snapshots"; - SideTabId[SideTabId["History"] = 5] = "History"; - SideTabId[SideTabId["Transition"] = 6] = "Transition"; - SideTabId[SideTabId["Settings"] = 7] = "Settings"; - SideTabId[SideTabId["Pin"] = 8] = "Pin"; - SideTabId[SideTabId["Collapse"] = 9] = "Collapse"; -})(SideTabId || (SideTabId = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lIUiX":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sidebutton", ()=>Sidebutton); -var _base = require("../base"); -var _iconButton = require("./iconButton"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Sidebutton(props) { - const selected = !props.closed && props.selectedSideTab === props.sideTabId; - const buttonProps = props.omitAriaSelected ? {} : { - 'aria-selected': selected - }; - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('vbutton', selected && 'selected') - }, props.badgeText && (0, _base.base).react.createElement("div", { - className: "count" - }, props.badgeText), (0, _base.base).react.createElement((0, _iconButton.IconButton), Object.assign({}, buttonProps, { - role: props.role || 'tab', - themePalette: props.themePalette, - className: "vbutton", - iconName: props.iconName, - title: props.title, - onClick: ()=>{ - props.onSideTabClick(props.sideTabId); - } - }))); -} - -},{"../base":"3TPz5","./iconButton":"6pZiK","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"frGei":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Topbar", ()=>Topbar); -var _commandBarButtonStyles = require("./CommandBarButton.styles"); -var _logo = require("./logo"); -var _base = require("../base"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Topbar(props) { - var _a; - const zeroResults = props.selectionState.selectedData && props.selectionState.selectedData.length === 0; - const disabled = !props.loaded; - const items = [ - { - key: 'undo', - name: (0, _language.strings).buttonUndo, - iconProps: { - iconName: 'Undo' - }, - disabled: disabled || props.historyItems.length === 0 || props.historyIndex === 0, - onClick: props.undo - }, - { - key: 'redo', - name: (0, _language.strings).buttonRedo, - iconProps: { - iconName: 'Redo' - }, - disabled: disabled || props.historyItems.length <= 1 || props.historyIndex >= props.historyItems.length - 1, - onClick: props.redo - }, - { - key: 'deselect', - name: (0, _language.strings).buttonDeselect, - iconProps: { - iconName: 'Cancel' - }, - disabled: disabled || !props.selectionSearch, - onClick: props.doDeselect - }, - { - key: 'isolate', - name: (0, _language.strings).buttonIsolate, - iconProps: { - iconName: 'Filter' - }, - disabled: disabled || !props.selectionSearch || zeroResults, - onClick: ()=>props.doFilter(props.selectionSearch, (0, _language.strings).labelHistoryFilterIsolate) - }, - { - key: 'exclude', - name: (0, _language.strings).buttonExclude, - iconProps: { - iconName: 'ClearFilter' - }, - disabled: disabled || !props.selectionSearch || zeroResults, - onClick: ()=>props.doFilter((0, _sanddanceReact.SandDance).searchExpression.invert(props.selectionSearch), (0, _language.strings).labelHistoryFilterIExclude) - }, - { - key: 'reset', - name: (0, _language.strings).buttonReset, - iconProps: { - iconName: 'RemoveFilter' - }, - disabled: disabled || !props.filter, - onClick: ()=>props.doUnfilter((0, _language.strings).labelHistoryFilterClear) - } - ]; - if (props.buttons) items.push.apply(items, props.buttons); - if (props.collapseLabels) items.forEach((item)=>item.iconOnly = true); - const farItems = []; - if (!props.snapshotsHidden) farItems.push({ - key: 'previous-snapshot', - iconProps: { - iconName: 'Previous' - }, - title: (0, _language.strings).buttonPrevSnapshot, - onClick: props.onSnapshotPreviousClick, - disabled: !props.snapshots || props.snapshots.length < 2 - }, { - key: 'snapshot', - iconProps: { - iconName: 'Camera' - }, - title: (0, _language.strings).buttonCreateSnapshot, - onClick: props.onSnapshotClick, - disabled: !props.loaded - }, { - key: 'next-snapshot', - iconProps: { - iconName: 'Next' - }, - title: (0, _language.strings).buttonNextSnapshot, - onClick: props.onSnapshotNextClick, - disabled: !props.snapshots || props.snapshots.length < 2 - }); - farItems.push({ - key: 'view', - iconProps: { - iconName: props.view === '2d' ? 'CubeShape' : 'Page' - }, - title: props.view === '2d' ? (0, _language.strings).labelViewType3d : (0, _language.strings).labelViewType2d, - onClick: props.onViewClick, - disabled: !props.loaded - }); - if ((_a = props.iconButtons) === null || _a === void 0 ? void 0 : _a.length) farItems.push(...props.iconButtons); - return (0, _base.base).react.createElement("div", { - className: "sanddance-explorer-topbar" - }, (0, _base.base).react.createElement("div", { - className: "logo" - }, (0, _base.base).react.createElement((0, _logo.Logo), null), (0, _base.base).react.createElement("a", { - href: props.logoClickUrl || '/', - target: props.logoClickTarget || '_blank' - }, (0, _language.strings).appName)), (0, _base.base).react.createElement("div", { - className: "sanddance-explorer-commandbar" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Customizer, { - scopedSettings: { - CommandBarButton: { - styles: (buttonProps)=>{ - buttonProps.theme.palette = props.themePalette; - return (0, _commandBarButtonStyles.CommandBarButtonStyles)(buttonProps); - } - } - } - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.CommandBar, { - items: items, - farItems: farItems, - styles: { - root: { - backgroundColor: 'transparent', - height: 'unset', - paddingLeft: 0, - paddingRight: 0 - } - } - })))); -} - -},{"./CommandBarButton.styles":"lVFm9","./logo":"6QmCn","../base":"3TPz5","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lVFm9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ //adapted from https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/fluent-theme/src/fluent/styles/CommandBarButton.styles.ts -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBarButtonStyles", ()=>CommandBarButtonStyles); -var _base = require("../base"); -const CommandBarButtonStyles = (props)=>{ - const { theme } = props; - if (!theme) throw new Error('Theme is undefined or null.'); - const { palette, semanticColors } = theme; - const BUTTON_ICON_CLASSNAME = '.ms-Button-icon'; - return { - root: [ - Object.assign({}, (0, _base.base).fluentUI.getFocusStyle(theme, { - inset: 2 - })), - { - backgroundColor: palette.white - } - ], - rootHovered: { - backgroundColor: palette.neutralLighter, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDarkAlt - } - } - }, - rootPressed: { - backgroundColor: palette.neutralLight, - color: palette.neutralDark, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootChecked: { - backgroundColor: palette.neutralLight, - color: palette.neutralDark, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootCheckedHovered: { - backgroundColor: palette.neutralQuaternaryAlt, - color: palette.neutralDark - }, - rootExpanded: { - color: palette.neutralDark, - backgroundColor: palette.neutralLight, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootExpandedHovered: { - background: palette.neutralQuaternaryAlt - }, - rootDisabled: { - backgroundColor: palette.white, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: semanticColors.disabledBodySubtext - } - } - }, - splitButtonMenuButton: { - backgroundColor: palette.white, - color: palette.neutralSecondary, - selectors: { - ':hover': { - backgroundColor: palette.neutralLighter, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.neutralPrimary - } - } - }, - ':active': { - backgroundColor: palette.neutralLight, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.neutralPrimary - } - } - } - } - }, - splitButtonMenuButtonDisabled: { - backgroundColor: palette.white - }, - icon: { - color: palette.themePrimary - } - }; -}; - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6QmCn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Logo", ()=>Logo); -var _base = require("../base"); -const s = ` - ...... -....... -... -...... - ...... - ... -....... -...... -`; -const d = s.split('\n').map((row, irow)=>row.length ? row.split('').map((char, icol)=>char.trim() ? `M${2 * icol + 1} ${2 * (irow - 1) + 1} v1 h1 v-1 Z` : '').join(' ') : '').join('\n'); -function Logo() { - return (0, _base.base).react.createElement("svg", { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 16 16" - }, (0, _base.base).react.createElement("path", { - d: d - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cz9uW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loadDataFile", ()=>loadDataFile); -parcelHelpers.export(exports, "loadDataArray", ()=>loadDataArray); -var _sanddanceReact = require("@msrvida/sanddance-react"); -const loadDataFile = (dataFile, columnTypes)=>new Promise((resolve, reject)=>{ - const vega = (0, _sanddanceReact.SandDance).VegaMorphCharts.base.vega; - const loader = vega.loader(); - function handleRawText(text) { - let data; - try { - data = vega.read(text, { - type: dataFile.type, - parse: {} - }); - } catch (e) { - reject(e); - } - if (data) loadDataArray(data, dataFile.type, columnTypes).then((dc)=>{ - if (dataFile.snapshotsUrl) fetch(dataFile.snapshotsUrl).then((response)=>response.json()).then((snapshots)=>{ - dc.snapshots = snapshots; - resolve(dc); - }).catch(reject); - else if (dataFile.snapshots) { - dc.snapshots = dataFile.snapshots; - resolve(dc); - } else resolve(dc); - }).catch(reject); - } - if (dataFile.dataUrl) loader.load(dataFile.dataUrl).then(handleRawText).catch(reject); - else if (dataFile.rawText) handleRawText(dataFile.rawText); - else reject('dataFile object must have either dataUrl or rawText property set.'); - }); -const loadDataArray = (data, type, columnTypes)=>new Promise((resolve, reject)=>{ - const parse = type === 'csv' || type === 'tsv'; - if (parse) //convert empty strings to null so that vega.inferType will get dates - data.forEach((row)=>{ - for(const column in row)if (row[column] === '') row[column] = null; - }); - const columns = (0, _sanddanceReact.SandDance).util.getColumnsFromData((0, _sanddanceReact.SandDance).VegaMorphCharts.base.vega.inferTypes, data, columnTypes).filter((c)=>c.name && c.name.trim()).sort((a, b)=>a.name.localeCompare(b.name)); - if (parse) { - const booleanColumns = columns.filter((c)=>c.type === 'boolean'); - const dateColumns = columns.filter((c)=>c.type === 'date'); - const numericColumns = columns.filter((c)=>c.type === 'integer' || c.type === 'number'); - data.forEach((obj)=>{ - booleanColumns.forEach((c)=>{ - obj[c.name] = ('' + obj[c.name]).toLowerCase() === 'true'; - }); - dateColumns.forEach((c)=>{ - const input = obj[c.name]; - if (input !== null) { - const d = new Date(input); - d.input = input; - obj[c.name] = d; - } - }); - numericColumns.forEach((c)=>{ - const n = parseFloat(obj[c.name]); - obj[c.name] = isNaN(n) ? null : n; - }); - }); - } - resolve({ - data, - columns - }); - }); - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5K5JN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fontFamily", ()=>fontFamily); -parcelHelpers.export(exports, "defaultViewerOptions", ()=>defaultViewerOptions); -parcelHelpers.export(exports, "snapshotThumbWidth", ()=>snapshotThumbWidth); -parcelHelpers.export(exports, "defaultRenderer", ()=>defaultRenderer); -parcelHelpers.export(exports, "initialExplorerState", ()=>initialExplorerState); -var _themes = require("./themes"); -var _interfaces = require("./interfaces"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _dataScope = require("./controls/dataScope"); -const fontFamily = 'Segoe UI, sans-serif'; -const defaultViewerOptions = { - colors: (0, _themes.getColorSettingsFromThemePalette)((0, _themes.themePalettes)['']), - fontFamily -}; -const snapshotThumbWidth = 300; -const defaultRenderer = { - advanced: false, - advancedOptions: { - bloomIntensity: 2, - isBloomEnabled: false, - isDofEnabled: false, - dofFocusRange: 0.25, - isFxaaEnabled: false, - isShadowEnabled: true, - isSsaoEnabled: true + "r": formatRounded, + "s": formatPrefixAuto, + "X": function(x2) { + return Math.round(x2).toString(16).toUpperCase(); }, - basicOptions: { - antialias: true + "x": function(x2) { + return Math.round(x2).toString(16); } -}; -function initialExplorerState(props) { - const renderer = props.initialRenderer || defaultRenderer; - if (!renderer.advancedOptions) renderer.advancedOptions = defaultRenderer.advancedOptions; - if (!renderer.basicOptions) renderer.basicOptions = defaultRenderer.basicOptions; - const state = { - calculating: null, - errors: null, - autoCompleteDistinctValues: {}, - colorBin: null, - dataContent: null, - dataFile: null, - search: null, - totalStyle: null, - facetStyle: 'wrap', - filter: null, - filteredData: null, - specCapabilities: null, - size: { - height: null, - width: null - }, - scheme: null, - transform: null, - columns: null, - chart: 'grid', - signalValues: null, - hideAxes: false, - hideLegend: false, - sideTabId: (0, _interfaces.SideTabId).ChartType, - dataScopeId: (0, _dataScope.DataScopeId).AllData, - selectedItemIndex: {}, - sidebarClosed: props.initialSidebarClosed === undefined ? false : props.initialSidebarClosed, - sidebarPinned: props.initialSidebarPinned === undefined ? true : props.initialSidebarPinned, - view: props.initialView || '2d', - snapshots: [], - selectedSnapshotIndex: -1, - tooltipExclusions: [], - positionedColumnMapProps: null, - note: null, - historyIndex: -1, - historyItems: [], - renderer, - transitionType: 'ordinal', - transitionDimension: 'x', - transitionDurations: (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone((0, _sanddanceReact.SandDance).VegaMorphCharts.defaults.defaultPresenterConfig.transitionDurations) - }; - (0, _dataScope.resetSelectedItemIndex)(state.selectedItemIndex); - return state; -} - -},{"./themes":"g7FJh","./interfaces":"k3BwW","@msrvida/sanddance-react":"lPyTZ","./controls/dataScope":"0ukjY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g7FJh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "themePalettes", ()=>themePalettes); -parcelHelpers.export(exports, "getColorSettingsFromThemePalette", ()=>getColorSettingsFromThemePalette); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var util = (0, _sanddanceReact.SandDance).VegaMorphCharts.util; -const themePalettes = {}; -themePalettes[''] = { - themePrimary: '#0078d4', - themeLighterAlt: '#eff6fc', - themeLighter: '#deecf9', - themeLight: '#c7e0f4', - themeTertiary: '#71afe5', - themeSecondary: '#2b88d8', - themeDarkAlt: '#106ebe', - themeDark: '#005a9e', - themeDarker: '#004578', - neutralLighterAlt: '#faf9f8', - neutralLighter: '#f3f2f1', - neutralLight: '#edebe9', - neutralQuaternaryAlt: '#e1dfdd', - neutralQuaternary: '#d0d0d0', - neutralTertiaryAlt: '#c8c6c4', - neutralTertiary: '#595959', - neutralSecondary: '#373737', - neutralSecondaryAlt: '#373737', - neutralPrimaryAlt: '#2f2f2f', - neutralPrimary: '#000000', - neutralDark: '#151515', - black: '#0b0b0b', - white: '#ffffff' -}; -themePalettes['dark-theme'] = { - themePrimary: '#0078d4', - themeLighterAlt: '#eff6fc', - themeLighter: '#deecf9', - themeLight: '#c7e0f4', - themeTertiary: '#71afe5', - themeSecondary: '#2b88d8', - themeDarkAlt: '#106ebe', - themeDark: '#005a9e', - themeDarker: '#004578', - neutralLighterAlt: '#0b0b0b', - neutralLighter: '#151515', - neutralLight: '#252525', - neutralQuaternaryAlt: '#2f2f2f', - neutralQuaternary: '#373737', - neutralTertiaryAlt: '#595959', - neutralTertiary: '#c8c8c8', - neutralSecondary: '#d0d0d0', - neutralSecondaryAlt: '#d0d0d0', - neutralPrimaryAlt: '#dadada', - neutralPrimary: '#ffffff', - neutralDark: '#f4f4f4', - black: '#f8f8f8', - white: '#000000' -}; -function getColorSettingsFromThemePalette(themePalette) { - const c = util.colorFromString(themePalette.themeSecondary); - c[3] = 256 / 3; // one-third opacity background - return { - axisLine: themePalette.black, - axisText: themePalette.black, - gridLine: themePalette.neutralLight, - backgroundColor: themePalette.white, - hoveredCube: themePalette.black, - clickableText: themePalette.themeDark, - clickableTextHighlight: util.colorToString(c), - searchText: themePalette.neutralPrimary, - searchTextHighlight: themePalette.neutralPrimaryAlt - }; -} - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jLMxI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -var _base = require("../base"); -var _columnMap = require("../controls/columnMap"); -var _palettes = require("../palettes"); -var _signal = require("../controls/signal"); -var _language = require("../language"); -var _group = require("../controls/group"); -function Color(props) { - const colorColumn = props.dataContent.columns.filter((c)=>c.name === props.colorColumn)[0]; - const disabledColorBin = !colorColumn || !colorColumn.quantitative || props.directColor; - const colorBin = props.colorBin || 'quantize'; - const dropdownRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - return (0, _base.base).react.createElement("div", { - className: "sanddance-color-dialog" - }, (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColor - }, (0, _base.base).react.createElement((0, _columnMap.ColumnMap), Object.assign({}, props, { - componentRef: dropdownRef, - collapseLabel: props.compactUI, - selectedColumnName: props.colorColumn, - specRole: props.specCapabilities && props.specCapabilities.roles.filter((r)=>r.role === 'color')[0], - key: 0 - })), colorColumn && colorColumn.isColorData && (0, _base.base).react.createElement("div", { - className: "sanddance-explanation", - dangerouslySetInnerHTML: { - __html: (0, _language.strings).labelColorFieldIsColorData(colorColumn.name) - } - }), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _palettes.Palette), { - collapseLabel: props.compactUI, - scheme: props.scheme, - colorColumn: colorColumn, - changeColorScheme: (scheme)=>{ - props.onColorSchemeChange(scheme); - }, - disabled: props.disabled || props.directColor || colorColumn && colorColumn.isColorData - }), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _signal.Signal), { - disabled: props.disabled || !colorColumn || props.directColor || colorColumn && colorColumn.isColorData, - signal: props.colorReverseSignal, - explorer: props.explorer, - initialValue: (0, _signal.getInitialSignalValue)(props.explorer, props.colorReverseSignal), - onChange: props.onColorReverseChange, - collapseLabel: props.compactUI - })), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColorBin - }, (0, _base.base).react.createElement("div", { - className: "sanddance-explanation" - }, (0, _language.strings).labelColorBinExplanation), (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - selectedKey: colorBin, - options: [ - { - key: 'continuous', - text: (0, _language.strings).labelColorBinNone, - disabled: disabledColorBin - }, - { - key: 'quantize', - text: (0, _language.strings).labelColorBinQuantize, - disabled: disabledColorBin - }, - { - key: 'quantile', - text: (0, _language.strings).labelColorBinQuantile, - disabled: disabledColorBin + }; + function identity$3(x2) { + return x2; + } + var map$1 = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; + function formatLocale(locale2) { + var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$3 : formatGroup(map$1.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$3 : formatNumerals(map$1.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; + function newFormat(specifier) { + specifier = formatSpecifier(specifier); + var fill2 = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol2 = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type; + if (type2 === "n") comma = true, type2 = "g"; + else if (!formatTypes[type2]) precision === void 0 && (precision = 12), trim = true, type2 = "g"; + if (zero2 || fill2 === "0" && align === "=") zero2 = true, fill2 = "0", align = "="; + var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; + var formatType = formatTypes[type2], maybeSuffix = /[defgprs%]/.test(type2); + precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format2(value2) { + var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; + if (type2 === "c") { + valueSuffix = formatType(value2) + valueSuffix; + value2 = ""; + } else { + value2 = +value2; + var valueNegative = value2 < 0 || 1 / value2 < 0; + value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); + if (trim) value2 = formatTrim(value2); + if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; + valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); + if (maybeSuffix) { + i = -1, n = value2.length; + while (++i < n) { + if (c2 = value2.charCodeAt(i), 48 > c2 || c2 > 57) { + valueSuffix = (c2 === 46 ? decimal + value2.slice(i + 1) : value2.slice(i)) + valueSuffix; + value2 = value2.slice(0, i); + break; + } } - ], - onChange: (e, o)=>{ - props.onColorBinChange(o.key); - } - }), (0, _base.base).react.createElement((0, _signal.Signal), { - disabled: props.disabled || disabledColorBin || props.colorBin === 'continuous', - signal: props.colorBinSignal, - explorer: props.explorer, - initialValue: (0, _signal.getInitialSignalValue)(props.explorer, props.colorBinSignal), - onChange: props.onColorBinCountChange, - collapseLabel: props.compactUI - })), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColorOptions - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).selectDirectColor, - disabled: !colorColumn.stats.hasColorData, - checked: !!(colorColumn.stats.hasColorData && props.directColor), - onChange: (e, checked)=>props.onDirectColorChange(checked) - }), (0, _base.base).react.createElement("div", { - className: "sanddance-explanation", - dangerouslySetInnerHTML: { - __html: (0, _language.strings).labelDataColors + } } - }))); -} - -},{"../base":"3TPz5","../controls/columnMap":"8sojP","../palettes":"2BdAl","../controls/signal":"buTZe","../language":"67xOI","../controls/group":"afKlW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2BdAl":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _base = require("../base"); -var _categorical = require("./categorical"); -var _cyclical = require("./cyclical"); -var _diverging = require("./diverging"); -var _dropdown = require("../controls/dropdown"); -var _dual = require("./dual"); -var _scheme = require("./scheme"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _sequentialMultiHue = require("./sequentialMultiHue"); -var _sequentialSingleHue = require("./sequentialSingleHue"); -var _language = require("../language"); -const maxDistinctColors = 20; -function Palette(props) { - const { distinctValueCount } = props.colorColumn.stats; - const isDual = distinctValueCount === 2; - const categoricalNumeric = distinctValueCount > 0 && distinctValueCount < maxDistinctColors; - let isQualitative = false; - let isQuantitative = false; - switch(props.colorColumn.type){ - case 'boolean': - case 'string': - isQualitative = true; + if (comma && !zero2) value2 = group2(value2, Infinity); + var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) : ""; + if (comma && zero2) value2 = group2(padding2 + value2, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; + switch (align) { + case "<": + value2 = valuePrefix + value2 + valueSuffix + padding2; break; - case 'number': - isQuantitative = true; + case "=": + value2 = valuePrefix + padding2 + value2 + valueSuffix; + break; + case "^": + value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); + break; + default: + value2 = padding2 + valuePrefix + value2 + valueSuffix; break; - case 'date': - case 'integer': - isQuantitative = true; - isQualitative = categoricalNumeric; - } - const selected = props.scheme; - const options = []; - function menu(name, opts) { - if (options.length) options.push({ - key: 'divider' + options.length, - text: null, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Divider - }); - options.push({ - key: name, - text: name, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }); - options.push.apply(options, opts); - } - isQualitative && menu((0, _language.strings).schemeCategorical, (0, _categorical.categorical)(selected)); - isQuantitative && menu((0, _language.strings).schemeSequentialSingleHue, (0, _sequentialSingleHue.sequentialSingleHue)(selected)); - isQuantitative && menu((0, _language.strings).schemeSequentialMultiHue, (0, _sequentialMultiHue.sequentialMultiHue)(selected)); - isQuantitative && menu((0, _language.strings).schemeDiverging, (0, _diverging.diverging)(selected)); - isQuantitative && menu((0, _language.strings).schemeCyclical, (0, _cyclical.cyclical)(selected)); - isDual && menu((0, _language.strings).schemeDual, (0, _dual.dual)(selected)); - return (0, _base.base).react.createElement("div", { - className: "sanddance-palette" - }, (0, _base.base).react.createElement("div", { - className: "sanddance-explanation", - dangerouslySetInnerHTML: { - __html: (0, _language.strings).labelColorFieldInfo(props.colorColumn.name, props.colorColumn.type, categoricalNumeric, distinctValueCount) - } - }), (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabel, - disabled: props.disabled, - dropdownWidth: 400, - label: (0, _language.strings).labelColorScheme, - onRenderOption: (option)=>{ - if (option.itemType === (0, _base.base).fluentUI.DropdownMenuItemType.Header) return (0, _base.base).react.createElement("span", null, option.text); - else return (0, _base.base).react.createElement("div", { - className: "sanddance-scheme option" - }, (0, _base.base).react.createElement("span", { - className: "name" - }, option.scheme), option.children); - }, - options: options, - onChange: (e, o)=>{ - props.changeColorScheme(o.scheme); - } - }), (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-scheme', props.disabled && 'disabled') - }, props.scheme && (0, _scheme.schemesJSX)[props.scheme])); -} - -},{"../base":"3TPz5","./categorical":"iU6ln","./cyclical":"l6Ur3","./diverging":"89PRK","../controls/dropdown":"7pP8h","./dual":"gLg9j","./scheme":"efDez","@msrvida/sanddance-react":"lPyTZ","./sequentialMultiHue":"1y9LK","./sequentialSingleHue":"2GC64","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iU6ln":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "categorical", ()=>categorical); -var _base = require("../base"); -var _scheme = require("./scheme"); -const p8 = `${12.5}%`; -const p9 = `${100 / 9}%`; -const p10 = `${10}%`; -const p12 = `${100 / 12}%`; -const p20 = `${5}%`; -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['accent'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#7fc97f", - style: { - width: p8, - background: 'rgb(127, 201, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#beaed4", - style: { - width: p8, - background: 'rgb(190, 174, 212)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdc086", - style: { - width: p8, - background: 'rgb(253, 192, 134)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffff99", - style: { - width: p8, - background: 'rgb(255, 255, 153)' - } - }), (0, _base.base).react.createElement("div", { - title: "#386cb0", - style: { - width: p8, - background: 'rgb(56, 108, 176)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f0027f", - style: { - width: p8, - background: 'rgb(240, 2, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bf5b17", - style: { - width: p8, - background: 'rgb(191, 91, 23)' - } - }), (0, _base.base).react.createElement("div", { - title: "#666666", - style: { - width: p8, - background: 'rgb(102, 102, 102)' - } - })); - (0, _scheme.schemesJSX)['category10'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#1f77b4", - style: { - width: p10, - background: 'rgb(31, 119, 180)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f0e", - style: { - width: p10, - background: 'rgb(255, 127, 14)' - } - }), (0, _base.base).react.createElement("div", { - title: "#2ca02c", - style: { - width: p10, - background: 'rgb(44, 160, 44)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d62728", - style: { - width: p10, - background: 'rgb(214, 39, 40)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9467bd", - style: { - width: p10, - background: 'rgb(148, 103, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8c564b", - style: { - width: p10, - background: 'rgb(140, 86, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e377c2", - style: { - width: p10, - background: 'rgb(227, 119, 194)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7f7f7f", - style: { - width: p10, - background: 'rgb(127, 127, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bcbd22", - style: { - width: p10, - background: 'rgb(188, 189, 34)' - } - }), (0, _base.base).react.createElement("div", { - title: "#17becf", - style: { - width: p10, - background: 'rgb(23, 190, 207)' - } - })); - (0, _scheme.schemesJSX)['category20'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#1f77b4", - style: { - width: p20, - background: 'rgb(31, 119, 180)' - } - }), (0, _base.base).react.createElement("div", { - title: "#aec7e8", - style: { - width: p20, - background: 'rgb(174, 199, 232)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f0e", - style: { - width: p20, - background: 'rgb(255, 127, 14)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffbb78", - style: { - width: p20, - background: 'rgb(255, 187, 120)' - } - }), (0, _base.base).react.createElement("div", { - title: "#2ca02c", - style: { - width: p20, - background: 'rgb(44, 160, 44)' - } - }), (0, _base.base).react.createElement("div", { - title: "#98df8a", - style: { - width: p20, - background: 'rgb(152, 223, 138)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d62728", - style: { - width: p20, - background: 'rgb(214, 39, 40)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff9896", - style: { - width: p20, - background: 'rgb(255, 152, 150)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9467bd", - style: { - width: p20, - background: 'rgb(148, 103, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c5b0d5", - style: { - width: p20, - background: 'rgb(197, 176, 213)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8c564b", - style: { - width: p20, - background: 'rgb(140, 86, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c49c94", - style: { - width: p20, - background: 'rgb(196, 156, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e377c2", - style: { - width: p20, - background: 'rgb(227, 119, 194)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f7b6d2", - style: { - width: p20, - background: 'rgb(247, 182, 210)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7f7f7f", - style: { - width: p20, - background: 'rgb(127, 127, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c7c7c7", - style: { - width: p20, - background: 'rgb(199, 199, 199)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bcbd22", - style: { - width: p20, - background: 'rgb(188, 189, 34)' - } - }), (0, _base.base).react.createElement("div", { - title: "#dbdb8d", - style: { - width: p20, - background: 'rgb(219, 219, 141)' - } - }), (0, _base.base).react.createElement("div", { - title: "#17becf", - style: { - width: p20, - background: 'rgb(23, 190, 207)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9edae5", - style: { - width: p20, - background: 'rgb(158, 218, 229)' - } - })); - (0, _scheme.schemesJSX)['category20b'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#393b79", - style: { - width: p20, - background: 'rgb(57, 59, 121)' - } - }), (0, _base.base).react.createElement("div", { - title: "#5254a3", - style: { - width: p20, - background: 'rgb(82, 84, 163)' - } - }), (0, _base.base).react.createElement("div", { - title: "#6b6ecf", - style: { - width: p20, - background: 'rgb(107, 110, 207)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9c9ede", - style: { - width: p20, - background: 'rgb(156, 158, 222)' - } - }), (0, _base.base).react.createElement("div", { - title: "#637939", - style: { - width: p20, - background: 'rgb(99, 121, 57)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8ca252", - style: { - width: p20, - background: 'rgb(140, 162, 82)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b5cf6b", - style: { - width: p20, - background: 'rgb(181, 207, 107)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cedb9c", - style: { - width: p20, - background: 'rgb(206, 219, 156)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8c6d31", - style: { - width: p20, - background: 'rgb(140, 109, 49)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bd9e39", - style: { - width: p20, - background: 'rgb(189, 158, 57)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7ba52", - style: { - width: p20, - background: 'rgb(231, 186, 82)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7cb94", - style: { - width: p20, - background: 'rgb(231, 203, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#843c39", - style: { - width: p20, - background: 'rgb(132, 60, 57)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ad494a", - style: { - width: p20, - background: 'rgb(173, 73, 74)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d6616b", - style: { - width: p20, - background: 'rgb(214, 97, 107)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7969c", - style: { - width: p20, - background: 'rgb(231, 150, 156)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7b4173", - style: { - width: p20, - background: 'rgb(123, 65, 115)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a55194", - style: { - width: p20, - background: 'rgb(165, 81, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ce6dbd", - style: { - width: p20, - background: 'rgb(206, 109, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#de9ed6", - style: { - width: p20, - background: 'rgb(222, 158, 214)' - } - })); - (0, _scheme.schemesJSX)['category20c'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#3182bd", - style: { - width: p20, - background: 'rgb(49, 130, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#6baed6", - style: { - width: p20, - background: 'rgb(107, 174, 214)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9ecae1", - style: { - width: p20, - background: 'rgb(158, 202, 225)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c6dbef", - style: { - width: p20, - background: 'rgb(198, 219, 239)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e6550d", - style: { - width: p20, - background: 'rgb(230, 85, 13)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fd8d3c", - style: { - width: p20, - background: 'rgb(253, 141, 60)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdae6b", - style: { - width: p20, - background: 'rgb(253, 174, 107)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdd0a2", - style: { - width: p20, - background: 'rgb(253, 208, 162)' - } - }), (0, _base.base).react.createElement("div", { - title: "#31a354", - style: { - width: p20, - background: 'rgb(49, 163, 84)' - } - }), (0, _base.base).react.createElement("div", { - title: "#74c476", - style: { - width: p20, - background: 'rgb(116, 196, 118)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a1d99b", - style: { - width: p20, - background: 'rgb(161, 217, 155)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c7e9c0", - style: { - width: p20, - background: 'rgb(199, 233, 192)' - } - }), (0, _base.base).react.createElement("div", { - title: "#756bb1", - style: { - width: p20, - background: 'rgb(117, 107, 177)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9e9ac8", - style: { - width: p20, - background: 'rgb(158, 154, 200)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bcbddc", - style: { - width: p20, - background: 'rgb(188, 189, 220)' - } - }), (0, _base.base).react.createElement("div", { - title: "#dadaeb", - style: { - width: p20, - background: 'rgb(218, 218, 235)' - } - }), (0, _base.base).react.createElement("div", { - title: "#636363", - style: { - width: p20, - background: 'rgb(99, 99, 99)' - } - }), (0, _base.base).react.createElement("div", { - title: "#969696", - style: { - width: p20, - background: 'rgb(150, 150, 150)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bdbdbd", - style: { - width: p20, - background: 'rgb(189, 189, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d9d9d9", - style: { - width: p20, - background: 'rgb(217, 217, 217)' - } - })); - (0, _scheme.schemesJSX)['dark2'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#1b9e77", - style: { - width: p8, - background: 'rgb(27, 158, 119)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d95f02", - style: { - width: p8, - background: 'rgb(217, 95, 2)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7570b3", - style: { - width: p8, - background: 'rgb(117, 112, 179)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7298a", - style: { - width: p8, - background: 'rgb(231, 41, 138)' - } - }), (0, _base.base).react.createElement("div", { - title: "#66a61e", - style: { - width: p8, - background: 'rgb(102, 166, 30)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e6ab02", - style: { - width: p8, - background: 'rgb(230, 171, 2)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a6761d", - style: { - width: p8, - background: 'rgb(166, 118, 29)' - } - }), (0, _base.base).react.createElement("div", { - title: "#666666", - style: { - width: p8, - background: 'rgb(102, 102, 102)' - } - })); - (0, _scheme.schemesJSX)['paired'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#a6cee3", - style: { - width: p12, - background: 'rgb(166, 206, 227)' - } - }), (0, _base.base).react.createElement("div", { - title: "#1f78b4", - style: { - width: p12, - background: 'rgb(31, 120, 180)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b2df8a", - style: { - width: p12, - background: 'rgb(178, 223, 138)' - } - }), (0, _base.base).react.createElement("div", { - title: "#33a02c", - style: { - width: p12, - background: 'rgb(51, 160, 44)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fb9a99", - style: { - width: p12, - background: 'rgb(251, 154, 153)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e31a1c", - style: { - width: p12, - background: 'rgb(227, 26, 28)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdbf6f", - style: { - width: p12, - background: 'rgb(253, 191, 111)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f00", - style: { - width: p12, - background: 'rgb(255, 127, 0)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cab2d6", - style: { - width: p12, - background: 'rgb(202, 178, 214)' - } - }), (0, _base.base).react.createElement("div", { - title: "#6a3d9a", - style: { - width: p12, - background: 'rgb(106, 61, 154)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffff99", - style: { - width: p12, - background: 'rgb(255, 255, 153)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b15928", - style: { - width: p12, - background: 'rgb(177, 89, 40)' } - })); - (0, _scheme.schemesJSX)['pastel1'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#fbb4ae", - style: { - width: p9, - background: 'rgb(251, 180, 174)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b3cde3", - style: { - width: p9, - background: 'rgb(179, 205, 227)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ccebc5", - style: { - width: p9, - background: 'rgb(204, 235, 197)' - } - }), (0, _base.base).react.createElement("div", { - title: "#decbe4", - style: { - width: p9, - background: 'rgb(222, 203, 228)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fed9a6", - style: { - width: p9, - background: 'rgb(254, 217, 166)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffffcc", - style: { - width: p9, - background: 'rgb(255, 255, 204)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e5d8bd", - style: { - width: p9, - background: 'rgb(229, 216, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fddaec", - style: { - width: p9, - background: 'rgb(253, 218, 236)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f2f2f2", - style: { - width: p9, - background: 'rgb(242, 242, 242)' + return numerals(value2); + } + format2.toString = function() { + return specifier + ""; + }; + return format2; + } + function formatPrefix2(specifier, value2) { + var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value2) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; + return function(value3) { + return f(k * value3) + prefix; + }; + } + return { + format: newFormat, + formatPrefix: formatPrefix2 + }; + } + var locale$1; + var format$3; + defaultLocale$1({ + decimal: ".", + thousands: ",", + grouping: [3], + currency: ["$", ""], + minus: "-" + }); + function defaultLocale$1(definition2) { + locale$1 = formatLocale(definition2); + format$3 = locale$1.format; + locale$1.formatPrefix; + return locale$1; + } + var DataScopeId; + (function(DataScopeId2) { + DataScopeId2[DataScopeId2["AllData"] = 0] = "AllData"; + DataScopeId2[DataScopeId2["SelectedData"] = 1] = "SelectedData"; + DataScopeId2[DataScopeId2["FilteredData"] = 2] = "FilteredData"; + })(DataScopeId || (DataScopeId = {})); + function resetSelectedItemIndex(selectedItemIndex) { + selectedItemIndex[DataScopeId.AllData] = 0; + selectedItemIndex[DataScopeId.FilteredData] = 0; + selectedItemIndex[DataScopeId.SelectedData] = 0; + } + const shortFormat = format$3(".2~s"); + function short(n) { + return n === -1 ? "--" : n ? n < 1e3 ? n.toString() : shortFormat(n) : "0"; + } + function DataScope$1(props) { + const dataCount = Object.assign({ all: -1, filtered: -1, selected: -1 }, props.dataCount); + return props.compact ? base$1.react.createElement( + "div", + { className: classList("sanddance-datascope", "compact"), onClick: props.onCompactClick }, + base$1.react.createElement(Compact, Object.assign({}, props, { dataScopeId: DataScopeId.AllData, text: strings$1.selectDataSpanAll, count: dataCount.all })), + base$1.react.createElement(Compact, Object.assign({}, props, { dataScopeId: DataScopeId.FilteredData, text: strings$1.selectDataSpanFilter, count: dataCount.filtered })), + base$1.react.createElement(Compact, Object.assign({}, props, { dataScopeId: DataScopeId.SelectedData, text: strings$1.selectDataSpanSelection, count: dataCount.selected })) + ) : base$1.react.createElement( + "div", + { className: classList("sanddance-datascope", "extended", props.active && "active") }, + base$1.react.createElement( + "div", + null, + base$1.react.createElement("div", null, props.dataSet), + base$1.react.createElement( + "div", + { className: "datascope-buttons" }, + base$1.react.createElement(DataScopeButton, Object.assign({}, props, { dataScopeId: DataScopeId.AllData, text: strings$1.selectDataSpanAll, count: dataCount.all })), + base$1.react.createElement(DataScopeButton, Object.assign({}, props, { dataScopeId: DataScopeId.FilteredData, text: strings$1.selectDataSpanFilter, count: dataCount.filtered })), + base$1.react.createElement(DataScopeButton, Object.assign({}, props, { dataScopeId: DataScopeId.SelectedData, text: strings$1.selectDataSpanSelection, count: dataCount.selected })) + ) + ) + ); + } + function Compact(props) { + return base$1.react.createElement("div", { title: props.text, onClick: () => { + props.onDataScopeClick(props.dataScopeId); + } }, short(props.count)); + } + function DataScopeButton(props) { + return base$1.react.createElement(Button, { themePalette: props.themePalette, className: classList("datascope-button", props.selectedDataScope === props.dataScopeId && "selected"), disabled: props.disabled, text: props.text, onClick: () => { + props.onDataScopeClick(props.dataScopeId); + }, onRenderText: () => { + return base$1.react.createElement( + "div", + { title: props.count > 0 ? props.count.toString() : "" }, + base$1.react.createElement("label", null, props.text), + base$1.react.createElement("div", null, short(props.count)) + ); + }, onRenderIcon: () => null }); + } + function Scrollable(props) { + return base$1.react.createElement( + "div", + { className: classList("scrollable-container", props.className), role: props.role }, + base$1.react.createElement("div", { className: "scrollable" }, props.children) + ); + } + var SideTabId; + (function(SideTabId2) { + SideTabId2[SideTabId2["ChartType"] = 0] = "ChartType"; + SideTabId2[SideTabId2["Data"] = 1] = "Data"; + SideTabId2[SideTabId2["Search"] = 2] = "Search"; + SideTabId2[SideTabId2["Color"] = 3] = "Color"; + SideTabId2[SideTabId2["Snapshots"] = 4] = "Snapshots"; + SideTabId2[SideTabId2["History"] = 5] = "History"; + SideTabId2[SideTabId2["Transition"] = 6] = "Transition"; + SideTabId2[SideTabId2["Settings"] = 7] = "Settings"; + SideTabId2[SideTabId2["Pin"] = 8] = "Pin"; + SideTabId2[SideTabId2["Collapse"] = 9] = "Collapse"; + })(SideTabId || (SideTabId = {})); + function Sidebutton(props) { + const selected = !props.closed && props.selectedSideTab === props.sideTabId; + const buttonProps = props.omitAriaSelected ? {} : { + "aria-selected": selected + }; + return base$1.react.createElement( + "div", + { className: classList("vbutton", selected && "selected") }, + props.badgeText && base$1.react.createElement("div", { className: "count" }, props.badgeText), + base$1.react.createElement(IconButton$1, Object.assign({}, buttonProps, { role: props.role || "tab", themePalette: props.themePalette, className: "vbutton", iconName: props.iconName, title: props.title, onClick: () => { + props.onSideTabClick(props.sideTabId); + } })) + ); + } + function Sidebar(props) { + const sidebuttons = [ + { + sideTabId: SideTabId.ChartType, + iconName: "BIDashboard", + title: strings$1.labelChart + }, + { + sideTabId: SideTabId.Color, + iconName: "Color", + title: strings$1.labelColor + }, + { + sideTabId: SideTabId.Data, + iconName: "Table", + title: strings$1.labelDataBrowser + }, + { + sideTabId: SideTabId.Search, + iconName: "Search", + title: strings$1.labelSearch + }, + !props.snapshotsHidden && { + sideTabId: SideTabId.Snapshots, + iconName: "Camera", + title: strings$1.labelSnapshots + }, + { + sideTabId: SideTabId.History, + iconName: "History", + title: strings$1.labelHistory + }, + { + sideTabId: SideTabId.Transition, + iconName: "Flow", + title: strings$1.labelTransition + }, + { + sideTabId: SideTabId.Settings, + iconName: "Settings", + title: strings$1.labelChartSettings + } + ].filter(Boolean); + return base$1.react.createElement( + "div", + { className: classList("sanddance-sidebar", "calculator", props.pinned && "pinned", props.closed && "closed") }, + base$1.react.createElement( + "div", + { className: "sidebar-content" }, + base$1.react.createElement(DataScope$1, Object.assign({}, props.dataScopeProps)), + base$1.react.createElement( + "div", + { className: "vbuttons" }, + base$1.react.createElement("div", { className: "sidebar-dialogs", role: "tablist" }, sidebuttons.map((sidebutton, i) => base$1.react.createElement(Sidebutton, Object.assign({ key: i }, props, sidebutton, { themePalette: props.themePalette })))), + !props.hideSidebarControls && base$1.react.createElement( + "div", + { className: "sidebar-controls" }, + base$1.react.createElement(Sidebutton, Object.assign({}, props, { omitAriaSelected: true, role: "button", sideTabId: SideTabId.Pin, iconName: props.pinned ? "Pinned" : "Pin", title: props.pinned ? strings$1.buttonToolbarFloat : strings$1.buttonToolbarDock })), + base$1.react.createElement(Sidebutton, Object.assign({}, props, { omitAriaSelected: true, role: "button", sideTabId: SideTabId.Collapse, iconName: props.closed ? "DoubleChevronRight12" : "DoubleChevronLeft12", title: props.closed ? strings$1.buttonToolbarShow : strings$1.buttonToolbarHide })) + ) + ), + base$1.react.createElement( + Scrollable, + { role: "tabpanel" }, + base$1.react.createElement("div", { className: "sidetab" }, props.children) + ), + props.calculating && base$1.react.createElement( + "div", + { className: "calculating" }, + base$1.react.createElement(base$1.fluentUI.Spinner, { size: base$1.fluentUI.SpinnerSize.large }) + ) + ) + ); + } + const CommandBarButtonStyles = (props) => { + const { theme } = props; + if (!theme) { + throw new Error("Theme is undefined or null."); + } + const { palette, semanticColors } = theme; + const BUTTON_ICON_CLASSNAME = ".ms-Button-icon"; + return { + root: [ + Object.assign({}, base$1.fluentUI.getFocusStyle(theme, { inset: 2 })), + { + backgroundColor: palette.white } - })); - (0, _scheme.schemesJSX)['pastel2'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#b3e2cd", - style: { - width: p8, - background: 'rgb(179, 226, 205)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdcdac", - style: { - width: p8, - background: 'rgb(253, 205, 172)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cbd5e8", - style: { - width: p8, - background: 'rgb(203, 213, 232)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f4cae4", - style: { - width: p8, - background: 'rgb(244, 202, 228)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e6f5c9", - style: { - width: p8, - background: 'rgb(230, 245, 201)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fff2ae", - style: { - width: p8, - background: 'rgb(255, 242, 174)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f1e2cc", - style: { - width: p8, - background: 'rgb(241, 226, 204)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cccccc", - style: { - width: p8, - background: 'rgb(204, 204, 204)' + ], + rootHovered: { + backgroundColor: palette.neutralLighter, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDarkAlt + } } - })); - (0, _scheme.schemesJSX)['set1'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#e41a1c", - style: { - width: p9, - background: 'rgb(228, 26, 28)' - } - }), (0, _base.base).react.createElement("div", { - title: "#377eb8", - style: { - width: p9, - background: 'rgb(55, 126, 184)' - } - }), (0, _base.base).react.createElement("div", { - title: "#4daf4a", - style: { - width: p9, - background: 'rgb(77, 175, 74)' - } - }), (0, _base.base).react.createElement("div", { - title: "#984ea3", - style: { - width: p9, - background: 'rgb(152, 78, 163)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f00", - style: { - width: p9, - background: 'rgb(255, 127, 0)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffff33", - style: { - width: p9, - background: 'rgb(255, 255, 51)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a65628", - style: { - width: p9, - background: 'rgb(166, 86, 40)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f781bf", - style: { - width: p9, - background: 'rgb(247, 129, 191)' - } - }), (0, _base.base).react.createElement("div", { - title: "#999999", - style: { - width: p9, - background: 'rgb(153, 153, 153)' + }, + rootPressed: { + backgroundColor: palette.neutralLight, + color: palette.neutralDark, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDark + } } - })); - (0, _scheme.schemesJSX)['set2'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#66c2a5", - style: { - width: p8, - background: 'rgb(102, 194, 165)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fc8d62", - style: { - width: p8, - background: 'rgb(252, 141, 98)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8da0cb", - style: { - width: p8, - background: 'rgb(141, 160, 203)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e78ac3", - style: { - width: p8, - background: 'rgb(231, 138, 195)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a6d854", - style: { - width: p8, - background: 'rgb(166, 216, 84)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffd92f", - style: { - width: p8, - background: 'rgb(255, 217, 47)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e5c494", - style: { - width: p8, - background: 'rgb(229, 196, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b3b3b3", - style: { - width: p8, - background: 'rgb(179, 179, 179)' + }, + rootChecked: { + backgroundColor: palette.neutralLight, + color: palette.neutralDark, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDark + } } - })); - (0, _scheme.schemesJSX)['set3'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#8dd3c7", - style: { - width: p12, - background: 'rgb(141, 211, 199)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffffb3", - style: { - width: p12, - background: 'rgb(255, 255, 179)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bebada", - style: { - width: p12, - background: 'rgb(190, 186, 218)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fb8072", - style: { - width: p12, - background: 'rgb(251, 128, 114)' - } - }), (0, _base.base).react.createElement("div", { - title: "#80b1d3", - style: { - width: p12, - background: 'rgb(128, 177, 211)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdb462", - style: { - width: p12, - background: 'rgb(253, 180, 98)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b3de69", - style: { - width: p12, - background: 'rgb(179, 222, 105)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fccde5", - style: { - width: p12, - background: 'rgb(252, 205, 229)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d9d9d9", - style: { - width: p12, - background: 'rgb(217, 217, 217)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bc80bd", - style: { - width: p12, - background: 'rgb(188, 128, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ccebc5", - style: { - width: p12, - background: 'rgb(204, 235, 197)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffed6f", - style: { - width: p12, - background: 'rgb(255, 237, 111)' + }, + rootCheckedHovered: { + backgroundColor: palette.neutralQuaternaryAlt, + color: palette.neutralDark + }, + rootExpanded: { + color: palette.neutralDark, + backgroundColor: palette.neutralLight, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDark + } } - })); - (0, _scheme.schemesJSX)['tableau10'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#4c78a8", - style: { - width: p10, - background: 'rgb(76, 120, 168)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f58518", - style: { - width: p10, - background: 'rgb(245, 133, 24)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e45756", - style: { - width: p10, - background: 'rgb(228, 87, 86)' - } - }), (0, _base.base).react.createElement("div", { - title: "#72b7b2", - style: { - width: p10, - background: 'rgb(114, 183, 178)' - } - }), (0, _base.base).react.createElement("div", { - title: "#54a24b", - style: { - width: p10, - background: 'rgb(84, 162, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#eeca3b", - style: { - width: p10, - background: 'rgb(238, 202, 59)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b279a2", - style: { - width: p10, - background: 'rgb(178, 121, 162)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff9da6", - style: { - width: p10, - background: 'rgb(255, 157, 166)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9d755d", - style: { - width: p10, - background: 'rgb(157, 117, 93)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bab0ac", - style: { - width: p10, - background: 'rgb(186, 176, 172)' + }, + rootExpandedHovered: { + background: palette.neutralQuaternaryAlt + }, + rootDisabled: { + backgroundColor: palette.white, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: semanticColors.disabledBodySubtext + } } - })); - (0, _scheme.schemesJSX)['tableau20'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#4c78a8", - style: { - width: p20, - background: 'rgb(76, 120, 168)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9ecae9", - style: { - width: p20, - background: 'rgb(158, 202, 233)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f58518", - style: { - width: p20, - background: 'rgb(245, 133, 24)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffbf79", - style: { - width: p20, - background: 'rgb(255, 191, 121)' - } - }), (0, _base.base).react.createElement("div", { - title: "#54a24b", - style: { - width: p20, - background: 'rgb(84, 162, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#88d27a", - style: { - width: p20, - background: 'rgb(136, 210, 122)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b79a20", - style: { - width: p20, - background: 'rgb(183, 154, 32)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f2cf5b", - style: { - width: p20, - background: 'rgb(242, 207, 91)' - } - }), (0, _base.base).react.createElement("div", { - title: "#439894", - style: { - width: p20, - background: 'rgb(67, 152, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#83bcb6", - style: { - width: p20, - background: 'rgb(131, 188, 182)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e45756", - style: { - width: p20, - background: 'rgb(228, 87, 86)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff9d98", - style: { - width: p20, - background: 'rgb(255, 157, 152)' - } - }), (0, _base.base).react.createElement("div", { - title: "#79706e", - style: { - width: p20, - background: 'rgb(121, 112, 110)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bab0ac", - style: { - width: p20, - background: 'rgb(186, 176, 172)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d67195", - style: { - width: p20, - background: 'rgb(214, 113, 149)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fcbfd2", - style: { - width: p20, - background: 'rgb(252, 191, 210)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b279a2", - style: { - width: p20, - background: 'rgb(178, 121, 162)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d6a5c9", - style: { - width: p20, - background: 'rgb(214, 165, 201)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9e765f", - style: { - width: p20, - background: 'rgb(158, 118, 95)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d8b5a5", - style: { - width: p20, - background: 'rgb(216, 181, 165)' + }, + splitButtonMenuButton: { + backgroundColor: palette.white, + color: palette.neutralSecondary, + selectors: { + ":hover": { + backgroundColor: palette.neutralLighter, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.neutralPrimary + } + } + }, + ":active": { + backgroundColor: palette.neutralLight, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.neutralPrimary + } + } + } } - })); - loaded = true; -} -function categorical(selected) { - if (!loaded) load(); - return [ - (0, _scheme.schemeOption)(selected, 'accent'), - (0, _scheme.schemeOption)(selected, 'category10'), - (0, _scheme.schemeOption)(selected, 'category20'), - (0, _scheme.schemeOption)(selected, 'category20b'), - (0, _scheme.schemeOption)(selected, 'category20c'), - (0, _scheme.schemeOption)(selected, 'dark2'), - (0, _scheme.schemeOption)(selected, 'paired'), - (0, _scheme.schemeOption)(selected, 'pastel1'), - (0, _scheme.schemeOption)(selected, 'pastel2'), - (0, _scheme.schemeOption)(selected, 'set1'), - (0, _scheme.schemeOption)(selected, 'set2'), - (0, _scheme.schemeOption)(selected, 'set3'), - (0, _scheme.schemeOption)(selected, 'tableau10'), - (0, _scheme.schemeOption)(selected, 'tableau20') - ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"efDez":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "schemeOption", ()=>schemeOption); -parcelHelpers.export(exports, "schemeHeader", ()=>schemeHeader); -parcelHelpers.export(exports, "schemesJSX", ()=>schemesJSX); -var _base = require("../base"); -function schemeOption(selected, scheme) { - return { - key: scheme, - text: scheme, - selected: selected === scheme, - scheme: scheme, - children: schemesJSX[scheme] - }; -} -function schemeHeader(key, text) { - return { - key, - text, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; -} -const schemesJSX = {}; - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l6Ur3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cyclical", ()=>cyclical); -var _base = require("../base"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['rainbow'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-rainbow" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#6e40aa" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#bf3caf" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#fe4b83" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#ff7847" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#e2b72f" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#aff05b" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#52f667" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#1ddfa3" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#23abd8" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#4c6edb" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#6e40aa" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-rainbow)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['sinebow'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-sinebow" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#ff4040" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#e78d0b" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#a7d503" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#58fc2a" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#18f472" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#00bfbf" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#1872f4" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#582afc" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#a703d5" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#e70b8d" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ff4040" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-sinebow)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function cyclical(selected) { - if (!loaded) load(); - return [ - (0, _scheme.schemeOption)(selected, 'rainbow'), - (0, _scheme.schemeOption)(selected, 'sinebow') - ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"89PRK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "diverging", ()=>diverging); -var _base = require("../base"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['blueorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-blueorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(5, 48, 97)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(34, 101, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(75, 148, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(143, 194, 221)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(205, 227, 238)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(242, 240, 235)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(253, 221, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(248, 182, 100)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(221, 132, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(178, 90, 9)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 59, 8)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-blueorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['brownbluegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-brownbluegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(84, 48, 5)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(139, 84, 15)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(188, 132, 53)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(222, 190, 123)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(242, 228, 192)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(238, 241, 234)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(195, 231, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(127, 201, 191)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(57, 152, 143)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(10, 103, 95)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 60, 48)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-brownbluegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purplegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purplegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(64, 0, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(115, 47, 128)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(154, 109, 170)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(193, 164, 205)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(228, 210, 230)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(239, 240, 239)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(214, 238, 209)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(162, 215, 158)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(92, 173, 101)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(33, 120, 57)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 68, 27)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purplegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['pinkyellowgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-pinkyellowgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(142, 1, 82)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(192, 38, 126)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(221, 114, 173)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(240, 179, 214)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(250, 221, 237)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(245, 243, 239)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(225, 242, 202)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(182, 222, 135)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(128, 187, 71)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(79, 145, 37)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(39, 100, 25)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-pinkyellowgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purpleorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purpleorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(45, 0, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(85, 45, 132)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(129, 112, 172)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(176, 170, 208)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(215, 215, 233)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(243, 238, 234)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(253, 221, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(248, 182, 100)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(221, 132, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(178, 90, 9)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 59, 8)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purpleorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(103, 0, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(172, 32, 47)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 96, 80)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(241, 163, 133)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(251, 215, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(242, 239, 238)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(205, 227, 238)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(143, 194, 221)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(75, 148, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(34, 101, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(5, 48, 97)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redgrey'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redgrey" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(103, 0, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(172, 32, 47)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 96, 80)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(241, 163, 133)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(252, 216, 197)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(250, 244, 241)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(223, 223, 223)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(184, 184, 184)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(134, 134, 134)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(78, 78, 78)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(26, 26, 26)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redgrey)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redyellowblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redyellowblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(165, 0, 38)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(212, 50, 44)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(241, 110, 67)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 172, 100)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 221, 144)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(250, 248, 193)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(220, 241, 236)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(171, 214, 232)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(117, 171, 208)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(74, 116, 180)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(49, 54, 149)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redyellowblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redyellowgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redyellowgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(165, 0, 38)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(212, 50, 44)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(241, 110, 67)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 172, 99)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 221, 141)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(249, 247, 174)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(215, 238, 142)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(164, 216, 110)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(100, 188, 97)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(34, 150, 79)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 104, 55)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redyellowgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['spectral'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-spectral" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(158, 1, 66)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(209, 60, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(240, 112, 74)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 172, 99)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 221, 141)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(251, 248, 176)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(224, 243, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(169, 221, 162)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(105, 189, 169)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(66, 136, 181)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(94, 79, 162)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-spectral)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function diverging(selected) { - if (!loaded) load(); - return [ - (0, _scheme.schemeOption)(selected, 'blueorange'), - (0, _scheme.schemeOption)(selected, 'brownbluegreen'), - (0, _scheme.schemeOption)(selected, 'purplegreen'), - (0, _scheme.schemeOption)(selected, 'pinkyellowgreen'), - (0, _scheme.schemeOption)(selected, 'purpleorange'), - (0, _scheme.schemeOption)(selected, 'redblue'), - (0, _scheme.schemeOption)(selected, 'redgrey'), - (0, _scheme.schemeOption)(selected, 'redyellowblue'), - (0, _scheme.schemeOption)(selected, 'redyellowgreen'), - (0, _scheme.schemeOption)(selected, 'spectral') - ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gLg9j":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dual", ()=>dual); -var _base = require("../base"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _sanddanceReact.SandDance).colorSchemes.filter((cs)=>cs.colors.length === 2).map((binaryScheme, i)=>{ - (0, _scheme.schemesJSX)[binaryScheme.scheme] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, binaryScheme.colors.map((color, j)=>(0, _base.base).react.createElement("div", { - key: j, - title: color, - style: { - width: '50%', - backgroundColor: color - } - }))); - }); - loaded = true; -} -function dual(selected) { - if (!loaded) load(); - return (0, _sanddanceReact.SandDance).colorSchemes.filter((cs)=>cs.colors.length === 2).map((binaryScheme, i)=>(0, _scheme.schemeOption)(selected, binaryScheme.scheme)); -} - -},{"../base":"3TPz5","@msrvida/sanddance-react":"lPyTZ","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1y9LK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sequentialMultiHue", ()=>sequentialMultiHue); -var _base = require("../base"); -var _language = require("../language"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['viridis'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-viridis" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#440154" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#482475" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#414487" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#355f8d" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#2a788e" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#21918c" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#22a884" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#44bf70" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#7ad151" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#bddf26" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fde725" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-viridis)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['inferno'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-inferno" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#000004" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#160b39" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#420a68" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#6a176e" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#932667" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#bc3754" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#dd513a" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f37819" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fca50a" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#f6d746" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fcffa4" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-inferno)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['magma'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-magma" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#000004" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#140e36" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#3b0f70" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#641a80" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#8c2981" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#b73779" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#de4968" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f7705c" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fe9f6d" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fecf92" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fcfdbf" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-magma)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['plasma'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-plasma" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#0d0887" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#41049d" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#6a00a8" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#8f0da4" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#b12a90" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#cc4778" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#e16462" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f2844b" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fca636" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fcce25" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#f0f921" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-plasma)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['cividis'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-cividis" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#002051" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#0a326a" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#2b446e" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#4d566d" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#696970" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#7f7c75" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#948f78" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ada476" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#caba6a" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ead156" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fdea45" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-cividis)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['turbo'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-turbo" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#23171b" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#4a58dd" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#2f9df5" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#27d7c4" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#4df884" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#95fb51" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#dedd32" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ffa423" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#f65f18" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ba2208" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#900c00" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-turbo)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['bluegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-bluegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 253)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(232, 246, 249)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 239, 237)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(183, 228, 218)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(143, 211, 193)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(104, 194, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(73, 177, 127)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 153, 89)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(21, 127, 60)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(3, 100, 41)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 68, 27)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-bluegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['bluepurple'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-bluepurple" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 253)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(228, 238, 245)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(204, 221, 236)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(178, 202, 225)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(156, 179, 213)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(143, 149, 198)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(140, 116, 181)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(137, 82, 165)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(133, 45, 143)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(115, 15, 113)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(77, 0, 75)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-bluepurple)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['goldgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-goldgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f4d166" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#d5ca60" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#b6c35c" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#98bb59" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#7cb257" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#60a656" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#4b9c53" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#3f8f4f" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#33834a" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#257740" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#146c36" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-goldgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['goldorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-goldorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f4d166" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#f8be5c" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#f8aa4c" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#f5983b" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#f3852a" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#ef701b" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#e2621f" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#d65322" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#c54923" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#b14223" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#9e3a26" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-goldorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['goldred'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-goldred" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f4d166" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#f6be59" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#f9aa51" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#fc964e" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#f6834b" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#ee734a" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#e56249" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#db5247" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#cf4244" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#c43141" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#b71d3e" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-goldred)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['greenblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-greenblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 240)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(229, 245, 223)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(211, 238, 206)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(189, 229, 191)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(158, 217, 187)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(123, 203, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(88, 183, 205)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(57, 156, 198)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(29, 126, 183)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(11, 96, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(8, 64, 129)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-greenblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['orangered'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-orangered" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 236)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(254, 235, 207)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(253, 220, 175)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(253, 202, 148)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(253, 176, 122)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(250, 142, 93)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(241, 108, 73)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(224, 69, 48)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(200, 29, 19)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(167, 4, 3)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 0, 0)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-orangered)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purplebluegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purplebluegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 251)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(239, 231, 242)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(219, 216, 234)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(190, 201, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(152, 185, 217)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(105, 168, 207)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(64, 150, 192)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(25, 135, 159)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(3, 120, 119)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(1, 99, 83)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(1, 70, 54)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purplebluegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purpleblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purpleblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 251)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(239, 234, 244)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(219, 218, 235)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(191, 201, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(155, 185, 217)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(114, 168, 207)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(67, 148, 195)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(26, 125, 182)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(6, 103, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(4, 82, 129)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(2, 56, 88)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purpleblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purplered'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purplered" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 244, 249)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(234, 227, 240)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(220, 201, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(208, 170, 210)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(208, 138, 194)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(221, 99, 174)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(227, 56, 144)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(215, 28, 108)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(183, 11, 79)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(143, 2, 58)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(103, 0, 31)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purplered)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redpurple'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redpurple" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 243)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(253, 228, 225)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(252, 207, 204)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(251, 181, 188)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(249, 147, 176)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(243, 105, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(224, 62, 152)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(192, 23, 136)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(153, 3, 124)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(112, 1, 116)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(73, 0, 106)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redpurple)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yellowgreenblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yellowgreenblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 217)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(239, 249, 189)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 238, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(169, 221, 183)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(115, 201, 189)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(69, 180, 194)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(40, 151, 191)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(32, 115, 178)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(35, 78, 160)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(28, 49, 133)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(8, 29, 88)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yellowgreenblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yellowgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yellowgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 229)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(247, 252, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(228, 244, 172)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(199, 232, 155)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(162, 216, 138)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(120, 197, 120)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(78, 175, 99)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 148, 78)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(21, 121, 63)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(3, 96, 52)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 69, 41)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yellowgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yelloworangebrown'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yelloworangebrown" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 229)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(255, 248, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(254, 234, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(254, 214, 118)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 186, 74)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(251, 153, 44)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(238, 121, 24)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(216, 91, 10)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(183, 67, 4)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(143, 50, 4)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(102, 37, 6)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yelloworangebrown)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yelloworangered'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yelloworangered" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 204)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(255, 240, 169)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(254, 224, 135)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(254, 201, 101)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 171, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(253, 137, 60)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(250, 92, 46)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(236, 48, 35)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(211, 17, 33)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(175, 2, 37)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(128, 0, 38)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yelloworangered)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#323232" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#2e4463" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#1e588a" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#086da7" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#0082b9" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#039ac7" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#12b1d4" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#2bc8e2" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#3ddff0" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#61f4fb" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffff" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkgold'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkgold" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#3c3c3c" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#554a38" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#6d5a35" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#846f32" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#a0832d" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#bf9828" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#dbb022" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f0cb23" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fae241" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fff290" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffff" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkgold)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#3a3a3a" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#245447" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#076a4c" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#038145" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#2d9642" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#5fa941" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#89bb3f" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#b3cb3b" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#dbdc34" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ffed39" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffaa" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkmulti'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkmulti" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#373737" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#294767" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#1e5b88" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#1a748b" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#1f8e7e" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#29a869" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#6abf50" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#aad332" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#eae30d" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fff166" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffff" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkmulti)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkred'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkred" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#343434" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#643633" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#8c3a36" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#b03e38" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#d14632" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#e75d1e" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#eb7e20" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ed9c25" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#efb92d" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#f3d431" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffeb2c" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkred)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightgreyred'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightgreyred" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#efe9e6" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#e2dcd9" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#d7cecb" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#ccc1be" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#c0b4af" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#c4a293" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#d38b66" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#de7336" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#e15917" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#df3a10" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#dc000b" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightgreyred)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightgreyteal'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightgreyteal" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#e4eaea" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#d7ddde" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#cbd1d4" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#bcc6ca" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#adbac0" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#85b2be" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#4aacc1" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#22a1c2" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#2192c0" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#1e84be" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#1876bc" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightgreyteal)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightmulti'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightmulti" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#e0f1f2" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#caebd7" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#b8e2b3" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#bddf93" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#d8e17e" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#f6e072" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#f6c659" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f4a946" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#f58a3f" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#f56c3f" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ef4a3c" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightmulti)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f2e7da" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#f7d7bd" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#f9c7a0" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#fab78a" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#faa47a" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#f8936d" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#f38264" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ed725f" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#e6605b" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#dd4f5b" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#d43d5b" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lighttealblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lighttealblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#e3e9e0" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#c4ddd1" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#a2d1cb" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#84c4c9" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#66b5c3" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#49a7bd" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#3698b4" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#3188a9" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#2d799e" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#276994" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#255988" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lighttealblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function sequentialMultiHue(selected) { - if (!loaded) load(); + }, + splitButtonMenuButtonDisabled: { + backgroundColor: palette.white + }, + icon: { + color: palette.themePrimary + } + }; + }; + const s = ` + ...... +....... +... +...... + ...... + ... +....... +...... +`; + const d = s.split("\n").map((row, irow) => row.length ? row.split("").map((char, icol) => char.trim() ? `M${2 * icol + 1} ${2 * (irow - 1) + 1} v1 h1 v-1 Z` : "").join(" ") : "").join("\n"); + function Logo() { + return base$1.react.createElement( + "svg", + { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16" }, + base$1.react.createElement("path", { d }) + ); + } + function Topbar(props) { + var _a2; + const zeroResults = props.selectionState.selectedData && props.selectionState.selectedData.length === 0; + const disabled = !props.loaded; + const items = [ + { + key: "undo", + name: strings$1.buttonUndo, + iconProps: { + iconName: "Undo" + }, + disabled: disabled || props.historyItems.length === 0 || props.historyIndex === 0, + onClick: props.undo + }, + { + key: "redo", + name: strings$1.buttonRedo, + iconProps: { + iconName: "Redo" + }, + disabled: disabled || props.historyItems.length <= 1 || props.historyIndex >= props.historyItems.length - 1, + onClick: props.redo + }, + { + key: "deselect", + name: strings$1.buttonDeselect, + iconProps: { + iconName: "Cancel" + }, + disabled: disabled || !props.selectionSearch, + onClick: props.doDeselect + }, + { + key: "isolate", + name: strings$1.buttonIsolate, + iconProps: { + iconName: "Filter" + }, + disabled: disabled || !props.selectionSearch || zeroResults, + onClick: () => props.doFilter(props.selectionSearch, strings$1.labelHistoryFilterIsolate) + }, + { + key: "exclude", + name: strings$1.buttonExclude, + iconProps: { + iconName: "ClearFilter" + }, + disabled: disabled || !props.selectionSearch || zeroResults, + onClick: () => props.doFilter(invert$2(props.selectionSearch), strings$1.labelHistoryFilterIExclude) + }, + { + key: "reset", + name: strings$1.buttonReset, + iconProps: { + iconName: "RemoveFilter" + }, + disabled: disabled || !props.filter, + onClick: () => props.doUnfilter(strings$1.labelHistoryFilterClear) + } + ]; + if (props.buttons) { + items.push.apply(items, props.buttons); + } + if (props.collapseLabels) { + items.forEach((item) => item.iconOnly = true); + } + const farItems = []; + if (!props.snapshotsHidden) { + farItems.push({ + key: "previous-snapshot", + iconProps: { + iconName: "Previous" + }, + title: strings$1.buttonPrevSnapshot, + onClick: props.onSnapshotPreviousClick, + disabled: !props.snapshots || props.snapshots.length < 2 + }, { + key: "snapshot", + iconProps: { + iconName: "Camera" + }, + title: strings$1.buttonCreateSnapshot, + onClick: props.onSnapshotClick, + disabled: !props.loaded + }, { + key: "next-snapshot", + iconProps: { + iconName: "Next" + }, + title: strings$1.buttonNextSnapshot, + onClick: props.onSnapshotNextClick, + disabled: !props.snapshots || props.snapshots.length < 2 + }); + } + farItems.push({ + key: "view", + iconProps: { + iconName: props.view === "2d" ? "CubeShape" : "Page" + }, + title: props.view === "2d" ? strings$1.labelViewType3d : strings$1.labelViewType2d, + onClick: props.onViewClick, + disabled: !props.loaded + }); + if ((_a2 = props.iconButtons) === null || _a2 === void 0 ? void 0 : _a2.length) { + farItems.push(...props.iconButtons); + } + return base$1.react.createElement( + "div", + { className: "sanddance-explorer-topbar" }, + base$1.react.createElement( + "div", + { className: "logo" }, + base$1.react.createElement(Logo, null), + base$1.react.createElement("a", { href: props.logoClickUrl || "/", target: props.logoClickTarget || "_blank" }, strings$1.appName) + ), + base$1.react.createElement( + "div", + { className: "sanddance-explorer-commandbar" }, + base$1.react.createElement( + base$1.fluentUI.Customizer, + { scopedSettings: { + CommandBarButton: { + styles: (buttonProps) => { + buttonProps.theme.palette = props.themePalette; + return CommandBarButtonStyles(buttonProps); + } + } + } }, + base$1.react.createElement(base$1.fluentUI.CommandBar, { items, farItems, styles: { + root: { + backgroundColor: "transparent", + height: "unset", + paddingLeft: 0, + paddingRight: 0 + } + } }) + ) + ) + ); + } + const loadDataFile = (dataFile, columnTypes) => new Promise((resolve2, reject) => { + const vega2 = base$3.vega; + const loader2 = vega2.loader(); + function handleRawText(text2) { + let data2; + try { + data2 = vega2.read(text2, { type: dataFile.type, parse: {} }); + } catch (e) { + reject(e); + } + if (data2) { + loadDataArray(data2, dataFile.type, columnTypes).then((dc) => { + if (dataFile.snapshotsUrl) { + fetch(dataFile.snapshotsUrl).then((response) => response.json()).then((snapshots) => { + dc.snapshots = snapshots; + resolve2(dc); + }).catch(reject); + } else if (dataFile.snapshots) { + dc.snapshots = dataFile.snapshots; + resolve2(dc); + } else { + resolve2(dc); + } + }).catch(reject); + } + } + if (dataFile.dataUrl) { + loader2.load(dataFile.dataUrl).then(handleRawText).catch(reject); + } else if (dataFile.rawText) { + handleRawText(dataFile.rawText); + } else { + reject("dataFile object must have either dataUrl or rawText property set."); + } + }); + const loadDataArray = (data2, type2, columnTypes) => new Promise((resolve2, reject) => { + const parse2 = type2 === "csv" || type2 === "tsv"; + if (parse2) { + data2.forEach((row) => { + for (const column in row) { + if (row[column] === "") { + row[column] = null; + } + } + }); + } + const columns = getColumnsFromData(base$3.vega.inferTypes, data2, columnTypes).filter((c2) => c2.name && c2.name.trim()).sort((a2, b2) => a2.name.localeCompare(b2.name)); + if (parse2) { + const booleanColumns = columns.filter((c2) => c2.type === "boolean"); + const dateColumns = columns.filter((c2) => c2.type === "date"); + const numericColumns = columns.filter((c2) => c2.type === "integer" || c2.type === "number"); + data2.forEach((obj2) => { + booleanColumns.forEach((c2) => { + obj2[c2.name] = ("" + obj2[c2.name]).toLowerCase() === "true"; + }); + dateColumns.forEach((c2) => { + const input = obj2[c2.name]; + if (input !== null) { + const d2 = new Date(input); + d2.input = input; + obj2[c2.name] = d2; + } + }); + numericColumns.forEach((c2) => { + const n = parseFloat(obj2[c2.name]); + obj2[c2.name] = isNaN(n) ? null : n; + }); + }); + } + resolve2({ data: data2, columns }); + }); + var util$1 = util$4; + const themePalettes = {}; + themePalettes[""] = { + themePrimary: "#0078d4", + themeLighterAlt: "#eff6fc", + themeLighter: "#deecf9", + themeLight: "#c7e0f4", + themeTertiary: "#71afe5", + themeSecondary: "#2b88d8", + themeDarkAlt: "#106ebe", + themeDark: "#005a9e", + themeDarker: "#004578", + neutralLighterAlt: "#faf9f8", + neutralLighter: "#f3f2f1", + neutralLight: "#edebe9", + neutralQuaternaryAlt: "#e1dfdd", + neutralQuaternary: "#d0d0d0", + neutralTertiaryAlt: "#c8c6c4", + neutralTertiary: "#595959", + neutralSecondary: "#373737", + neutralSecondaryAlt: "#373737", + neutralPrimaryAlt: "#2f2f2f", + neutralPrimary: "#000000", + neutralDark: "#151515", + black: "#0b0b0b", + white: "#ffffff" + }; + themePalettes["dark-theme"] = { + themePrimary: "#0078d4", + themeLighterAlt: "#eff6fc", + themeLighter: "#deecf9", + themeLight: "#c7e0f4", + themeTertiary: "#71afe5", + themeSecondary: "#2b88d8", + themeDarkAlt: "#106ebe", + themeDark: "#005a9e", + themeDarker: "#004578", + neutralLighterAlt: "#0b0b0b", + neutralLighter: "#151515", + neutralLight: "#252525", + neutralQuaternaryAlt: "#2f2f2f", + neutralQuaternary: "#373737", + neutralTertiaryAlt: "#595959", + neutralTertiary: "#c8c8c8", + neutralSecondary: "#d0d0d0", + neutralSecondaryAlt: "#d0d0d0", + neutralPrimaryAlt: "#dadada", + neutralPrimary: "#ffffff", + neutralDark: "#f4f4f4", + black: "#f8f8f8", + white: "#000000" + }; + function getColorSettingsFromThemePalette(themePalette) { + const c2 = util$1.colorFromString(themePalette.themeSecondary); + c2[3] = 256 / 3; + return { + axisLine: themePalette.black, + axisText: themePalette.black, + gridLine: themePalette.neutralLight, + backgroundColor: themePalette.white, + hoveredCube: themePalette.black, + clickableText: themePalette.themeDark, + clickableTextHighlight: util$1.colorToString(c2), + searchText: themePalette.neutralPrimary, + searchTextHighlight: themePalette.neutralPrimaryAlt + }; + } + const fontFamily$1 = "Segoe UI, sans-serif"; + const defaultViewerOptions = { + colors: getColorSettingsFromThemePalette(themePalettes[""]), + fontFamily: fontFamily$1 + }; + const snapshotThumbWidth = 300; + const defaultRenderer = { + advanced: false, + advancedOptions: { + bloomIntensity: 2, + isBloomEnabled: false, + isDofEnabled: false, + dofFocusRange: 0.25, + isFxaaEnabled: false, + isShadowEnabled: true, + isSsaoEnabled: true + }, + basicOptions: { + antialias: true + } + }; + function initialExplorerState(props) { + const renderer = props.initialRenderer || defaultRenderer; + if (!renderer.advancedOptions) { + renderer.advancedOptions = defaultRenderer.advancedOptions; + } + if (!renderer.basicOptions) { + renderer.basicOptions = defaultRenderer.basicOptions; + } + const state = { + calculating: null, + errors: null, + autoCompleteDistinctValues: {}, + colorBin: null, + dataContent: null, + dataFile: null, + search: null, + totalStyle: null, + facetStyle: "wrap", + filter: null, + filteredData: null, + specCapabilities: null, + size: { + height: null, + width: null + }, + scheme: null, + transform: null, + columns: null, + chart: "grid", + signalValues: null, + hideAxes: false, + hideLegend: false, + sideTabId: SideTabId.ChartType, + dataScopeId: DataScopeId.AllData, + selectedItemIndex: {}, + sidebarClosed: props.initialSidebarClosed === void 0 ? false : props.initialSidebarClosed, + sidebarPinned: props.initialSidebarPinned === void 0 ? true : props.initialSidebarPinned, + view: props.initialView || "2d", + snapshots: [], + selectedSnapshotIndex: -1, + tooltipExclusions: [], + positionedColumnMapProps: null, + note: null, + historyIndex: -1, + historyItems: [], + renderer, + transitionType: "ordinal", + transitionDimension: "x", + transitionDurations: clone(defaultPresenterConfig.transitionDurations) + }; + resetSelectedItemIndex(state.selectedItemIndex); + return state; + } + function schemeOption(selected, scheme2) { + return { + key: scheme2, + text: scheme2, + selected: selected === scheme2, + scheme: scheme2, + children: schemesJSX[scheme2] + }; + } + function schemeHeader(key2, text2) { + return { + key: key2, + text: text2, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + } + const schemesJSX = {}; + const p8 = `${100 / 8}%`; + const p9 = `${100 / 9}%`; + const p10 = `${100 / 10}%`; + const p12 = `${100 / 12}%`; + const p20 = `${100 / 20}%`; + let loaded$5 = false; + function load$7() { + schemesJSX["accent"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#7fc97f", style: { width: p8, background: "rgb(127, 201, 127)" } }), + base$1.react.createElement("div", { title: "#beaed4", style: { width: p8, background: "rgb(190, 174, 212)" } }), + base$1.react.createElement("div", { title: "#fdc086", style: { width: p8, background: "rgb(253, 192, 134)" } }), + base$1.react.createElement("div", { title: "#ffff99", style: { width: p8, background: "rgb(255, 255, 153)" } }), + base$1.react.createElement("div", { title: "#386cb0", style: { width: p8, background: "rgb(56, 108, 176)" } }), + base$1.react.createElement("div", { title: "#f0027f", style: { width: p8, background: "rgb(240, 2, 127)" } }), + base$1.react.createElement("div", { title: "#bf5b17", style: { width: p8, background: "rgb(191, 91, 23)" } }), + base$1.react.createElement("div", { title: "#666666", style: { width: p8, background: "rgb(102, 102, 102)" } }) + ); + schemesJSX["category10"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#1f77b4", style: { width: p10, background: "rgb(31, 119, 180)" } }), + base$1.react.createElement("div", { title: "#ff7f0e", style: { width: p10, background: "rgb(255, 127, 14)" } }), + base$1.react.createElement("div", { title: "#2ca02c", style: { width: p10, background: "rgb(44, 160, 44)" } }), + base$1.react.createElement("div", { title: "#d62728", style: { width: p10, background: "rgb(214, 39, 40)" } }), + base$1.react.createElement("div", { title: "#9467bd", style: { width: p10, background: "rgb(148, 103, 189)" } }), + base$1.react.createElement("div", { title: "#8c564b", style: { width: p10, background: "rgb(140, 86, 75)" } }), + base$1.react.createElement("div", { title: "#e377c2", style: { width: p10, background: "rgb(227, 119, 194)" } }), + base$1.react.createElement("div", { title: "#7f7f7f", style: { width: p10, background: "rgb(127, 127, 127)" } }), + base$1.react.createElement("div", { title: "#bcbd22", style: { width: p10, background: "rgb(188, 189, 34)" } }), + base$1.react.createElement("div", { title: "#17becf", style: { width: p10, background: "rgb(23, 190, 207)" } }) + ); + schemesJSX["category20"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#1f77b4", style: { width: p20, background: "rgb(31, 119, 180)" } }), + base$1.react.createElement("div", { title: "#aec7e8", style: { width: p20, background: "rgb(174, 199, 232)" } }), + base$1.react.createElement("div", { title: "#ff7f0e", style: { width: p20, background: "rgb(255, 127, 14)" } }), + base$1.react.createElement("div", { title: "#ffbb78", style: { width: p20, background: "rgb(255, 187, 120)" } }), + base$1.react.createElement("div", { title: "#2ca02c", style: { width: p20, background: "rgb(44, 160, 44)" } }), + base$1.react.createElement("div", { title: "#98df8a", style: { width: p20, background: "rgb(152, 223, 138)" } }), + base$1.react.createElement("div", { title: "#d62728", style: { width: p20, background: "rgb(214, 39, 40)" } }), + base$1.react.createElement("div", { title: "#ff9896", style: { width: p20, background: "rgb(255, 152, 150)" } }), + base$1.react.createElement("div", { title: "#9467bd", style: { width: p20, background: "rgb(148, 103, 189)" } }), + base$1.react.createElement("div", { title: "#c5b0d5", style: { width: p20, background: "rgb(197, 176, 213)" } }), + base$1.react.createElement("div", { title: "#8c564b", style: { width: p20, background: "rgb(140, 86, 75)" } }), + base$1.react.createElement("div", { title: "#c49c94", style: { width: p20, background: "rgb(196, 156, 148)" } }), + base$1.react.createElement("div", { title: "#e377c2", style: { width: p20, background: "rgb(227, 119, 194)" } }), + base$1.react.createElement("div", { title: "#f7b6d2", style: { width: p20, background: "rgb(247, 182, 210)" } }), + base$1.react.createElement("div", { title: "#7f7f7f", style: { width: p20, background: "rgb(127, 127, 127)" } }), + base$1.react.createElement("div", { title: "#c7c7c7", style: { width: p20, background: "rgb(199, 199, 199)" } }), + base$1.react.createElement("div", { title: "#bcbd22", style: { width: p20, background: "rgb(188, 189, 34)" } }), + base$1.react.createElement("div", { title: "#dbdb8d", style: { width: p20, background: "rgb(219, 219, 141)" } }), + base$1.react.createElement("div", { title: "#17becf", style: { width: p20, background: "rgb(23, 190, 207)" } }), + base$1.react.createElement("div", { title: "#9edae5", style: { width: p20, background: "rgb(158, 218, 229)" } }) + ); + schemesJSX["category20b"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#393b79", style: { width: p20, background: "rgb(57, 59, 121)" } }), + base$1.react.createElement("div", { title: "#5254a3", style: { width: p20, background: "rgb(82, 84, 163)" } }), + base$1.react.createElement("div", { title: "#6b6ecf", style: { width: p20, background: "rgb(107, 110, 207)" } }), + base$1.react.createElement("div", { title: "#9c9ede", style: { width: p20, background: "rgb(156, 158, 222)" } }), + base$1.react.createElement("div", { title: "#637939", style: { width: p20, background: "rgb(99, 121, 57)" } }), + base$1.react.createElement("div", { title: "#8ca252", style: { width: p20, background: "rgb(140, 162, 82)" } }), + base$1.react.createElement("div", { title: "#b5cf6b", style: { width: p20, background: "rgb(181, 207, 107)" } }), + base$1.react.createElement("div", { title: "#cedb9c", style: { width: p20, background: "rgb(206, 219, 156)" } }), + base$1.react.createElement("div", { title: "#8c6d31", style: { width: p20, background: "rgb(140, 109, 49)" } }), + base$1.react.createElement("div", { title: "#bd9e39", style: { width: p20, background: "rgb(189, 158, 57)" } }), + base$1.react.createElement("div", { title: "#e7ba52", style: { width: p20, background: "rgb(231, 186, 82)" } }), + base$1.react.createElement("div", { title: "#e7cb94", style: { width: p20, background: "rgb(231, 203, 148)" } }), + base$1.react.createElement("div", { title: "#843c39", style: { width: p20, background: "rgb(132, 60, 57)" } }), + base$1.react.createElement("div", { title: "#ad494a", style: { width: p20, background: "rgb(173, 73, 74)" } }), + base$1.react.createElement("div", { title: "#d6616b", style: { width: p20, background: "rgb(214, 97, 107)" } }), + base$1.react.createElement("div", { title: "#e7969c", style: { width: p20, background: "rgb(231, 150, 156)" } }), + base$1.react.createElement("div", { title: "#7b4173", style: { width: p20, background: "rgb(123, 65, 115)" } }), + base$1.react.createElement("div", { title: "#a55194", style: { width: p20, background: "rgb(165, 81, 148)" } }), + base$1.react.createElement("div", { title: "#ce6dbd", style: { width: p20, background: "rgb(206, 109, 189)" } }), + base$1.react.createElement("div", { title: "#de9ed6", style: { width: p20, background: "rgb(222, 158, 214)" } }) + ); + schemesJSX["category20c"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#3182bd", style: { width: p20, background: "rgb(49, 130, 189)" } }), + base$1.react.createElement("div", { title: "#6baed6", style: { width: p20, background: "rgb(107, 174, 214)" } }), + base$1.react.createElement("div", { title: "#9ecae1", style: { width: p20, background: "rgb(158, 202, 225)" } }), + base$1.react.createElement("div", { title: "#c6dbef", style: { width: p20, background: "rgb(198, 219, 239)" } }), + base$1.react.createElement("div", { title: "#e6550d", style: { width: p20, background: "rgb(230, 85, 13)" } }), + base$1.react.createElement("div", { title: "#fd8d3c", style: { width: p20, background: "rgb(253, 141, 60)" } }), + base$1.react.createElement("div", { title: "#fdae6b", style: { width: p20, background: "rgb(253, 174, 107)" } }), + base$1.react.createElement("div", { title: "#fdd0a2", style: { width: p20, background: "rgb(253, 208, 162)" } }), + base$1.react.createElement("div", { title: "#31a354", style: { width: p20, background: "rgb(49, 163, 84)" } }), + base$1.react.createElement("div", { title: "#74c476", style: { width: p20, background: "rgb(116, 196, 118)" } }), + base$1.react.createElement("div", { title: "#a1d99b", style: { width: p20, background: "rgb(161, 217, 155)" } }), + base$1.react.createElement("div", { title: "#c7e9c0", style: { width: p20, background: "rgb(199, 233, 192)" } }), + base$1.react.createElement("div", { title: "#756bb1", style: { width: p20, background: "rgb(117, 107, 177)" } }), + base$1.react.createElement("div", { title: "#9e9ac8", style: { width: p20, background: "rgb(158, 154, 200)" } }), + base$1.react.createElement("div", { title: "#bcbddc", style: { width: p20, background: "rgb(188, 189, 220)" } }), + base$1.react.createElement("div", { title: "#dadaeb", style: { width: p20, background: "rgb(218, 218, 235)" } }), + base$1.react.createElement("div", { title: "#636363", style: { width: p20, background: "rgb(99, 99, 99)" } }), + base$1.react.createElement("div", { title: "#969696", style: { width: p20, background: "rgb(150, 150, 150)" } }), + base$1.react.createElement("div", { title: "#bdbdbd", style: { width: p20, background: "rgb(189, 189, 189)" } }), + base$1.react.createElement("div", { title: "#d9d9d9", style: { width: p20, background: "rgb(217, 217, 217)" } }) + ); + schemesJSX["dark2"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#1b9e77", style: { width: p8, background: "rgb(27, 158, 119)" } }), + base$1.react.createElement("div", { title: "#d95f02", style: { width: p8, background: "rgb(217, 95, 2)" } }), + base$1.react.createElement("div", { title: "#7570b3", style: { width: p8, background: "rgb(117, 112, 179)" } }), + base$1.react.createElement("div", { title: "#e7298a", style: { width: p8, background: "rgb(231, 41, 138)" } }), + base$1.react.createElement("div", { title: "#66a61e", style: { width: p8, background: "rgb(102, 166, 30)" } }), + base$1.react.createElement("div", { title: "#e6ab02", style: { width: p8, background: "rgb(230, 171, 2)" } }), + base$1.react.createElement("div", { title: "#a6761d", style: { width: p8, background: "rgb(166, 118, 29)" } }), + base$1.react.createElement("div", { title: "#666666", style: { width: p8, background: "rgb(102, 102, 102)" } }) + ); + schemesJSX["paired"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#a6cee3", style: { width: p12, background: "rgb(166, 206, 227)" } }), + base$1.react.createElement("div", { title: "#1f78b4", style: { width: p12, background: "rgb(31, 120, 180)" } }), + base$1.react.createElement("div", { title: "#b2df8a", style: { width: p12, background: "rgb(178, 223, 138)" } }), + base$1.react.createElement("div", { title: "#33a02c", style: { width: p12, background: "rgb(51, 160, 44)" } }), + base$1.react.createElement("div", { title: "#fb9a99", style: { width: p12, background: "rgb(251, 154, 153)" } }), + base$1.react.createElement("div", { title: "#e31a1c", style: { width: p12, background: "rgb(227, 26, 28)" } }), + base$1.react.createElement("div", { title: "#fdbf6f", style: { width: p12, background: "rgb(253, 191, 111)" } }), + base$1.react.createElement("div", { title: "#ff7f00", style: { width: p12, background: "rgb(255, 127, 0)" } }), + base$1.react.createElement("div", { title: "#cab2d6", style: { width: p12, background: "rgb(202, 178, 214)" } }), + base$1.react.createElement("div", { title: "#6a3d9a", style: { width: p12, background: "rgb(106, 61, 154)" } }), + base$1.react.createElement("div", { title: "#ffff99", style: { width: p12, background: "rgb(255, 255, 153)" } }), + base$1.react.createElement("div", { title: "#b15928", style: { width: p12, background: "rgb(177, 89, 40)" } }) + ); + schemesJSX["pastel1"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#fbb4ae", style: { width: p9, background: "rgb(251, 180, 174)" } }), + base$1.react.createElement("div", { title: "#b3cde3", style: { width: p9, background: "rgb(179, 205, 227)" } }), + base$1.react.createElement("div", { title: "#ccebc5", style: { width: p9, background: "rgb(204, 235, 197)" } }), + base$1.react.createElement("div", { title: "#decbe4", style: { width: p9, background: "rgb(222, 203, 228)" } }), + base$1.react.createElement("div", { title: "#fed9a6", style: { width: p9, background: "rgb(254, 217, 166)" } }), + base$1.react.createElement("div", { title: "#ffffcc", style: { width: p9, background: "rgb(255, 255, 204)" } }), + base$1.react.createElement("div", { title: "#e5d8bd", style: { width: p9, background: "rgb(229, 216, 189)" } }), + base$1.react.createElement("div", { title: "#fddaec", style: { width: p9, background: "rgb(253, 218, 236)" } }), + base$1.react.createElement("div", { title: "#f2f2f2", style: { width: p9, background: "rgb(242, 242, 242)" } }) + ); + schemesJSX["pastel2"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#b3e2cd", style: { width: p8, background: "rgb(179, 226, 205)" } }), + base$1.react.createElement("div", { title: "#fdcdac", style: { width: p8, background: "rgb(253, 205, 172)" } }), + base$1.react.createElement("div", { title: "#cbd5e8", style: { width: p8, background: "rgb(203, 213, 232)" } }), + base$1.react.createElement("div", { title: "#f4cae4", style: { width: p8, background: "rgb(244, 202, 228)" } }), + base$1.react.createElement("div", { title: "#e6f5c9", style: { width: p8, background: "rgb(230, 245, 201)" } }), + base$1.react.createElement("div", { title: "#fff2ae", style: { width: p8, background: "rgb(255, 242, 174)" } }), + base$1.react.createElement("div", { title: "#f1e2cc", style: { width: p8, background: "rgb(241, 226, 204)" } }), + base$1.react.createElement("div", { title: "#cccccc", style: { width: p8, background: "rgb(204, 204, 204)" } }) + ); + schemesJSX["set1"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#e41a1c", style: { width: p9, background: "rgb(228, 26, 28)" } }), + base$1.react.createElement("div", { title: "#377eb8", style: { width: p9, background: "rgb(55, 126, 184)" } }), + base$1.react.createElement("div", { title: "#4daf4a", style: { width: p9, background: "rgb(77, 175, 74)" } }), + base$1.react.createElement("div", { title: "#984ea3", style: { width: p9, background: "rgb(152, 78, 163)" } }), + base$1.react.createElement("div", { title: "#ff7f00", style: { width: p9, background: "rgb(255, 127, 0)" } }), + base$1.react.createElement("div", { title: "#ffff33", style: { width: p9, background: "rgb(255, 255, 51)" } }), + base$1.react.createElement("div", { title: "#a65628", style: { width: p9, background: "rgb(166, 86, 40)" } }), + base$1.react.createElement("div", { title: "#f781bf", style: { width: p9, background: "rgb(247, 129, 191)" } }), + base$1.react.createElement("div", { title: "#999999", style: { width: p9, background: "rgb(153, 153, 153)" } }) + ); + schemesJSX["set2"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#66c2a5", style: { width: p8, background: "rgb(102, 194, 165)" } }), + base$1.react.createElement("div", { title: "#fc8d62", style: { width: p8, background: "rgb(252, 141, 98)" } }), + base$1.react.createElement("div", { title: "#8da0cb", style: { width: p8, background: "rgb(141, 160, 203)" } }), + base$1.react.createElement("div", { title: "#e78ac3", style: { width: p8, background: "rgb(231, 138, 195)" } }), + base$1.react.createElement("div", { title: "#a6d854", style: { width: p8, background: "rgb(166, 216, 84)" } }), + base$1.react.createElement("div", { title: "#ffd92f", style: { width: p8, background: "rgb(255, 217, 47)" } }), + base$1.react.createElement("div", { title: "#e5c494", style: { width: p8, background: "rgb(229, 196, 148)" } }), + base$1.react.createElement("div", { title: "#b3b3b3", style: { width: p8, background: "rgb(179, 179, 179)" } }) + ); + schemesJSX["set3"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#8dd3c7", style: { width: p12, background: "rgb(141, 211, 199)" } }), + base$1.react.createElement("div", { title: "#ffffb3", style: { width: p12, background: "rgb(255, 255, 179)" } }), + base$1.react.createElement("div", { title: "#bebada", style: { width: p12, background: "rgb(190, 186, 218)" } }), + base$1.react.createElement("div", { title: "#fb8072", style: { width: p12, background: "rgb(251, 128, 114)" } }), + base$1.react.createElement("div", { title: "#80b1d3", style: { width: p12, background: "rgb(128, 177, 211)" } }), + base$1.react.createElement("div", { title: "#fdb462", style: { width: p12, background: "rgb(253, 180, 98)" } }), + base$1.react.createElement("div", { title: "#b3de69", style: { width: p12, background: "rgb(179, 222, 105)" } }), + base$1.react.createElement("div", { title: "#fccde5", style: { width: p12, background: "rgb(252, 205, 229)" } }), + base$1.react.createElement("div", { title: "#d9d9d9", style: { width: p12, background: "rgb(217, 217, 217)" } }), + base$1.react.createElement("div", { title: "#bc80bd", style: { width: p12, background: "rgb(188, 128, 189)" } }), + base$1.react.createElement("div", { title: "#ccebc5", style: { width: p12, background: "rgb(204, 235, 197)" } }), + base$1.react.createElement("div", { title: "#ffed6f", style: { width: p12, background: "rgb(255, 237, 111)" } }) + ); + schemesJSX["tableau10"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#4c78a8", style: { width: p10, background: "rgb(76, 120, 168)" } }), + base$1.react.createElement("div", { title: "#f58518", style: { width: p10, background: "rgb(245, 133, 24)" } }), + base$1.react.createElement("div", { title: "#e45756", style: { width: p10, background: "rgb(228, 87, 86)" } }), + base$1.react.createElement("div", { title: "#72b7b2", style: { width: p10, background: "rgb(114, 183, 178)" } }), + base$1.react.createElement("div", { title: "#54a24b", style: { width: p10, background: "rgb(84, 162, 75)" } }), + base$1.react.createElement("div", { title: "#eeca3b", style: { width: p10, background: "rgb(238, 202, 59)" } }), + base$1.react.createElement("div", { title: "#b279a2", style: { width: p10, background: "rgb(178, 121, 162)" } }), + base$1.react.createElement("div", { title: "#ff9da6", style: { width: p10, background: "rgb(255, 157, 166)" } }), + base$1.react.createElement("div", { title: "#9d755d", style: { width: p10, background: "rgb(157, 117, 93)" } }), + base$1.react.createElement("div", { title: "#bab0ac", style: { width: p10, background: "rgb(186, 176, 172)" } }) + ); + schemesJSX["tableau20"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#4c78a8", style: { width: p20, background: "rgb(76, 120, 168)" } }), + base$1.react.createElement("div", { title: "#9ecae9", style: { width: p20, background: "rgb(158, 202, 233)" } }), + base$1.react.createElement("div", { title: "#f58518", style: { width: p20, background: "rgb(245, 133, 24)" } }), + base$1.react.createElement("div", { title: "#ffbf79", style: { width: p20, background: "rgb(255, 191, 121)" } }), + base$1.react.createElement("div", { title: "#54a24b", style: { width: p20, background: "rgb(84, 162, 75)" } }), + base$1.react.createElement("div", { title: "#88d27a", style: { width: p20, background: "rgb(136, 210, 122)" } }), + base$1.react.createElement("div", { title: "#b79a20", style: { width: p20, background: "rgb(183, 154, 32)" } }), + base$1.react.createElement("div", { title: "#f2cf5b", style: { width: p20, background: "rgb(242, 207, 91)" } }), + base$1.react.createElement("div", { title: "#439894", style: { width: p20, background: "rgb(67, 152, 148)" } }), + base$1.react.createElement("div", { title: "#83bcb6", style: { width: p20, background: "rgb(131, 188, 182)" } }), + base$1.react.createElement("div", { title: "#e45756", style: { width: p20, background: "rgb(228, 87, 86)" } }), + base$1.react.createElement("div", { title: "#ff9d98", style: { width: p20, background: "rgb(255, 157, 152)" } }), + base$1.react.createElement("div", { title: "#79706e", style: { width: p20, background: "rgb(121, 112, 110)" } }), + base$1.react.createElement("div", { title: "#bab0ac", style: { width: p20, background: "rgb(186, 176, 172)" } }), + base$1.react.createElement("div", { title: "#d67195", style: { width: p20, background: "rgb(214, 113, 149)" } }), + base$1.react.createElement("div", { title: "#fcbfd2", style: { width: p20, background: "rgb(252, 191, 210)" } }), + base$1.react.createElement("div", { title: "#b279a2", style: { width: p20, background: "rgb(178, 121, 162)" } }), + base$1.react.createElement("div", { title: "#d6a5c9", style: { width: p20, background: "rgb(214, 165, 201)" } }), + base$1.react.createElement("div", { title: "#9e765f", style: { width: p20, background: "rgb(158, 118, 95)" } }), + base$1.react.createElement("div", { title: "#d8b5a5", style: { width: p20, background: "rgb(216, 181, 165)" } }) + ); + loaded$5 = true; + } + function categorical(selected) { + if (!loaded$5) + load$7(); return [ - (0, _scheme.schemeOption)(selected, 'viridis'), - (0, _scheme.schemeOption)(selected, 'magma'), - (0, _scheme.schemeOption)(selected, 'inferno'), - (0, _scheme.schemeOption)(selected, 'plasma'), - (0, _scheme.schemeOption)(selected, 'cividis'), - (0, _scheme.schemeOption)(selected, 'turbo'), - (0, _scheme.schemeOption)(selected, 'bluegreen'), - (0, _scheme.schemeOption)(selected, 'bluepurple'), - (0, _scheme.schemeOption)(selected, 'goldgreen'), - (0, _scheme.schemeOption)(selected, 'goldorange'), - (0, _scheme.schemeOption)(selected, 'goldred'), - (0, _scheme.schemeOption)(selected, 'greenblue'), - (0, _scheme.schemeOption)(selected, 'orangered'), - (0, _scheme.schemeOption)(selected, 'purplebluegreen'), - (0, _scheme.schemeOption)(selected, 'purpleblue'), - (0, _scheme.schemeOption)(selected, 'purplered'), - (0, _scheme.schemeOption)(selected, 'redpurple'), - (0, _scheme.schemeOption)(selected, 'yellowgreenblue'), - (0, _scheme.schemeOption)(selected, 'yellowgreen'), - (0, _scheme.schemeOption)(selected, 'yelloworangebrown'), - (0, _scheme.schemeOption)(selected, 'yelloworangered'), - (0, _scheme.schemeHeader)('schemeSequentialMultiHueDark', (0, _language.strings).schemeSequentialMultiHueDark), - (0, _scheme.schemeOption)(selected, 'darkblue'), - (0, _scheme.schemeOption)(selected, 'darkgold'), - (0, _scheme.schemeOption)(selected, 'darkgreen'), - (0, _scheme.schemeOption)(selected, 'darkmulti'), - (0, _scheme.schemeOption)(selected, 'darkred'), - (0, _scheme.schemeHeader)('schemeSequentialMultiHueLight', (0, _language.strings).schemeSequentialMultiHueLight), - (0, _scheme.schemeOption)(selected, 'lightgreyred'), - (0, _scheme.schemeOption)(selected, 'lightgreyteal'), - (0, _scheme.schemeOption)(selected, 'lightmulti'), - (0, _scheme.schemeOption)(selected, 'lightorange'), - (0, _scheme.schemeOption)(selected, 'lighttealblue') + schemeOption(selected, "accent"), + schemeOption(selected, "category10"), + schemeOption(selected, "category20"), + schemeOption(selected, "category20b"), + schemeOption(selected, "category20c"), + schemeOption(selected, "dark2"), + schemeOption(selected, "paired"), + schemeOption(selected, "pastel1"), + schemeOption(selected, "pastel2"), + schemeOption(selected, "set1"), + schemeOption(selected, "set2"), + schemeOption(selected, "set3"), + schemeOption(selected, "tableau10"), + schemeOption(selected, "tableau20") ]; -} - -},{"../base":"3TPz5","../language":"67xOI","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2GC64":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sequentialSingleHue", ()=>sequentialSingleHue); -var _base = require("../base"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['blues'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-blues" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 251, 255)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(227, 238, 249)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(207, 225, 242)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(181, 212, 233)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(147, 195, 223)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(109, 174, 213)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(75, 151, 201)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 126, 188)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(24, 100, 170)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(10, 74, 144)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(8, 48, 107)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-blues)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['tealblues'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-tealblues" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#bce4d8" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#a3d6d2" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#8cc9cd" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#76bdc7" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#5fb0c0" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#45a2b9" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#3993b0" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#3584a6" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#32759b" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#2f6790" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#2c5985" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-tealblues)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['teals'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-teals" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#bbdfdf" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#a2d4d5" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#8ac9c9" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#75bcbb" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#61b0af" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#4da5a4" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#379998" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#2b8b8c" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#1e7f7f" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#127273" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#006667" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-teals)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['greens'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-greens" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 245)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(232, 246, 227)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(211, 238, 205)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(183, 226, 177)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(151, 212, 148)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(115, 195, 120)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(77, 175, 98)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 152, 79)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(21, 127, 59)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(3, 100, 41)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 68, 27)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-greens)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['greys'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-greys" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 255)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(242, 242, 242)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(226, 226, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(206, 206, 206)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(180, 180, 180)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(151, 151, 151)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(122, 122, 122)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(95, 95, 95)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(64, 64, 64)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(30, 30, 30)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 0, 0)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-greys)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purples'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purples" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(252, 251, 253)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(241, 239, 246)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(226, 225, 239)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(206, 206, 229)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(182, 181, 216)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(158, 155, 201)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(135, 130, 188)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(115, 99, 172)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(97, 64, 155)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(80, 31, 140)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(63, 0, 125)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purples)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['browns'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-browns" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#eedbbd" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#ecca96" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#e9b97a" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#e4a865" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#dc9856" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#d18954" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#c7784c" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#c0673f" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#b85536" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ad4433" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#9f3632" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-browns)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['reds'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-reds" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 245, 240)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(254, 227, 214)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(253, 201, 180)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 170, 142)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(252, 138, 107)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(249, 105, 76)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(239, 69, 51)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(217, 39, 35)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(187, 21, 26)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(151, 11, 19)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(103, 0, 13)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-reds)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['oranges'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-oranges" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 245, 235)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(254, 232, 211)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(253, 216, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(253, 194, 140)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(253, 167, 98)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(251, 141, 61)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(242, 112, 29)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(226, 86, 9)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(196, 65, 3)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(159, 51, 3)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 39, 4)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-oranges)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['warmgreys'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-warmgreys" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#dcd4d0" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#cec5c1" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#c0b8b4" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#b3aaa7" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#a59c99" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#98908c" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#8b827f" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#7e7673" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#726866" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#665c5a" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#59504e" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-warmgreys)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function sequentialSingleHue(selected) { - if (!loaded) load(); + } + let loaded$4 = false; + function load$6() { + schemesJSX["rainbow"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-rainbow" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#6e40aa" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#bf3caf" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#fe4b83" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#ff7847" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#e2b72f" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#aff05b" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#52f667" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#1ddfa3" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#23abd8" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#4c6edb" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#6e40aa" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-rainbow)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["sinebow"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-sinebow" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#ff4040" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#e78d0b" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#a7d503" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#58fc2a" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#18f472" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#00bfbf" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#1872f4" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#582afc" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#a703d5" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#e70b8d" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ff4040" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-sinebow)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded$4 = true; + } + function cyclical(selected) { + if (!loaded$4) + load$6(); return [ - (0, _scheme.schemeOption)(selected, 'blues'), - (0, _scheme.schemeOption)(selected, 'tealblues'), - (0, _scheme.schemeOption)(selected, 'teals'), - (0, _scheme.schemeOption)(selected, 'greens'), - (0, _scheme.schemeOption)(selected, 'browns'), - (0, _scheme.schemeOption)(selected, 'oranges'), - (0, _scheme.schemeOption)(selected, 'reds'), - (0, _scheme.schemeOption)(selected, 'purples'), - (0, _scheme.schemeOption)(selected, 'warmgreys'), - (0, _scheme.schemeOption)(selected, 'greys') + schemeOption(selected, "rainbow"), + schemeOption(selected, "sinebow") ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dT4UW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dataBrowserZeroMessages", ()=>dataBrowserZeroMessages); -parcelHelpers.export(exports, "dataBrowserNullMessages", ()=>dataBrowserNullMessages); -parcelHelpers.export(exports, "DataBrowser", ()=>DataBrowser); -var _base = require("../base"); -var _dataExporter = require("../controls/dataExporter"); -var _dataItem = require("../controls/dataItem"); -var _dataScope = require("../controls/dataScope"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _iconButton = require("../controls/iconButton"); -var _language = require("../language"); -var _columnTypeChanger = require("../controls/columnTypeChanger"); -const dataBrowserZeroMessages = {}; -dataBrowserZeroMessages[(0, _dataScope.DataScopeId).AllData] = (0, _language.strings).labelZeroAll; -dataBrowserZeroMessages[(0, _dataScope.DataScopeId).FilteredData] = null; //empty array is not used -dataBrowserZeroMessages[(0, _dataScope.DataScopeId).SelectedData] = (0, _language.strings).labelZeroSearchResults; -const dataBrowserNullMessages = {}; -dataBrowserNullMessages[(0, _dataScope.DataScopeId).AllData] = (0, _language.strings).labelDataNullAll; -dataBrowserNullMessages[(0, _dataScope.DataScopeId).FilteredData] = (0, _language.strings).labelDataNullFiltered; -dataBrowserNullMessages[(0, _dataScope.DataScopeId).SelectedData] = (0, _language.strings).labelDataNullSelection; -function DataBrowser(props) { - function activateRecord(newIndex) { - props.onActivate(props.data[newIndex], newIndex); - } - const { index } = props; - const length = props.data && props.data.length || 0; - const dropdownRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - return (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelDataBrowser, - className: "sanddance-dataIndex" - }, (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - componentRef: dropdownRef, - label: (0, _language.strings).labelDataScope, - collapseLabel: true, - options: [ - { - key: (0, _dataScope.DataScopeId).AllData, - text: (0, _language.strings).selectDataSpanAll, - isSelected: props.selectedDataScope === (0, _dataScope.DataScopeId).AllData - }, - { - key: (0, _dataScope.DataScopeId).FilteredData, - text: (0, _language.strings).selectDataSpanFilter, - isSelected: props.selectedDataScope === (0, _dataScope.DataScopeId).FilteredData - }, - { - key: (0, _dataScope.DataScopeId).SelectedData, - text: (0, _language.strings).selectDataSpanSelection, - isSelected: props.selectedDataScope === (0, _dataScope.DataScopeId).SelectedData - } - ], - onChange: (e, o)=>{ - props.onDataScopeClick(o.key); - } - }), !props.data && (0, _base.base).react.createElement("div", { - dangerouslySetInnerHTML: { - __html: props.nullMessage - } - }), props.data && !props.data.length && (0, _base.base).react.createElement("div", null, props.zeroMessage), !!length && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("div", { - className: "index" - }, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - iconName: "ChevronLeftMed", - onClick: (e)=>activateRecord(index <= 0 ? length - 1 : index - 1), - disabled: props.disabled || length === 1, - title: (0, _language.strings).buttonPrevDataItem - }), (0, _base.base).react.createElement("span", null, (0, _language.strings).record(index + 1, length)), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - iconName: "ChevronRightMed", - onClick: (e)=>activateRecord(index >= length - 1 ? 0 : index + 1), - disabled: props.disabled || length === 1, - title: (0, _language.strings).buttonNextDataItem - })), !props.itemVisible && (0, _base.base).react.createElement("div", { - className: "item-filtered" - }, (0, _language.strings).labelDataItemIsFiltered), (0, _base.base).react.createElement((0, _dataItem.DataItem), { - columns: props.columns, - item: props.data[index], - disabled: props.disabled, - onSearch: props.onSearch, - bingSearchDisabled: props.bingSearchDisabled - })), (0, _base.base).react.createElement((0, _columnTypeChanger.ColumnTypeChanger), { - theme: props.theme, - themePalette: props.themePalette, - initialCategoricalColumns: props.categoricalColumns, - initialQuantitativeColumns: props.quantitativeColumns, - onConfirmUpdate: props.onUpdateColumnTypes - }), props.dataExportHandler && props.data && (0, _base.base).react.createElement((0, _dataExporter.DataExportPicker), { - theme: props.theme, - initializer: { - fileName: `${(0, _dataExporter.removeExtensions)(props.displayName)} (${props.data.length})` - }, - data: props.data, - dataExportHandler: props.dataExportHandler, - disabled: props.disabled - })); -} - -},{"../base":"3TPz5","../controls/dataExporter":"7XSio","../controls/dataItem":"900yp","../controls/dataScope":"0ukjY","../controls/dropdown":"7pP8h","../controls/group":"afKlW","../controls/iconButton":"6pZiK","../language":"67xOI","../controls/columnTypeChanger":"7dBYz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"900yp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataItem", ()=>DataItem); -var _base = require("../base"); -var _keycodes = require("../keycodes"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function isNumber(value) { - if (typeof value === 'number') return true; - if (!isNaN(value)) return true; + } + let loaded$3 = false; + function load$5() { + schemesJSX["blueorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-blueorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(5, 48, 97)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(34, 101, 163)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(75, 148, 196)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(143, 194, 221)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(205, 227, 238)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(242, 240, 235)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(253, 221, 179)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(248, 182, 100)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(221, 132, 31)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(178, 90, 9)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 59, 8)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-blueorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["brownbluegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-brownbluegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(84, 48, 5)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(139, 84, 15)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(188, 132, 53)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(222, 190, 123)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(242, 228, 192)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(238, 241, 234)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(195, 231, 226)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(127, 201, 191)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(57, 152, 143)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(10, 103, 95)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 60, 48)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-brownbluegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purplegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purplegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(64, 0, 75)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(115, 47, 128)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(154, 109, 170)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(193, 164, 205)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(228, 210, 230)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(239, 240, 239)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(214, 238, 209)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(162, 215, 158)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(92, 173, 101)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(33, 120, 57)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 68, 27)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purplegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["pinkyellowgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-pinkyellowgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(142, 1, 82)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(192, 38, 126)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(221, 114, 173)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(240, 179, 214)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(250, 221, 237)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(245, 243, 239)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(225, 242, 202)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(182, 222, 135)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(128, 187, 71)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(79, 145, 37)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(39, 100, 25)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-pinkyellowgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purpleorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purpleorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(45, 0, 75)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(85, 45, 132)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(129, 112, 172)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(176, 170, 208)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(215, 215, 233)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(243, 238, 234)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(253, 221, 179)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(248, 182, 100)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(221, 132, 31)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(178, 90, 9)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 59, 8)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purpleorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(103, 0, 31)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(172, 32, 47)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 96, 80)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(241, 163, 133)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(251, 215, 196)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(242, 239, 238)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(205, 227, 238)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(143, 194, 221)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(75, 148, 196)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(34, 101, 163)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(5, 48, 97)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redgrey"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redgrey" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(103, 0, 31)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(172, 32, 47)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 96, 80)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(241, 163, 133)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(252, 216, 197)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(250, 244, 241)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(223, 223, 223)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(184, 184, 184)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(134, 134, 134)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(78, 78, 78)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(26, 26, 26)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redgrey)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redyellowblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redyellowblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(165, 0, 38)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(212, 50, 44)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(241, 110, 67)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 172, 100)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 221, 144)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(250, 248, 193)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(220, 241, 236)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(171, 214, 232)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(117, 171, 208)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(74, 116, 180)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(49, 54, 149)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redyellowblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redyellowgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redyellowgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(165, 0, 38)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(212, 50, 44)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(241, 110, 67)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 172, 99)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 221, 141)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(249, 247, 174)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(215, 238, 142)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(164, 216, 110)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(100, 188, 97)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(34, 150, 79)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 104, 55)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redyellowgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["spectral"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-spectral" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(158, 1, 66)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(209, 60, 75)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(240, 112, 74)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 172, 99)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 221, 141)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(251, 248, 176)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(224, 243, 161)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(169, 221, 162)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(105, 189, 169)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(66, 136, 181)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(94, 79, 162)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-spectral)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded$3 = true; + } + function diverging(selected) { + if (!loaded$3) + load$5(); + return [ + schemeOption(selected, "blueorange"), + schemeOption(selected, "brownbluegreen"), + schemeOption(selected, "purplegreen"), + schemeOption(selected, "pinkyellowgreen"), + schemeOption(selected, "purpleorange"), + schemeOption(selected, "redblue"), + schemeOption(selected, "redgrey"), + schemeOption(selected, "redyellowblue"), + schemeOption(selected, "redyellowgreen"), + schemeOption(selected, "spectral") + ]; + } + let loaded$2 = false; + function load$4() { + colorSchemes.filter((cs) => cs.colors.length === 2).map((binaryScheme, i) => { + schemesJSX[binaryScheme.scheme] = base$1.react.createElement("div", { className: "swatch" }, binaryScheme.colors.map((color2, j) => base$1.react.createElement("div", { key: j, title: color2, style: { width: "50%", backgroundColor: color2 } }))); + }); + loaded$2 = true; + } + function dual(selected) { + if (!loaded$2) + load$4(); + return colorSchemes.filter((cs) => cs.colors.length === 2).map((binaryScheme, i) => schemeOption(selected, binaryScheme.scheme)); + } + let loaded$1 = false; + function load$3() { + schemesJSX["viridis"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-viridis" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#440154" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#482475" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#414487" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#355f8d" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#2a788e" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#21918c" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#22a884" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#44bf70" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#7ad151" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#bddf26" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fde725" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-viridis)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["inferno"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-inferno" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#000004" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#160b39" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#420a68" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#6a176e" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#932667" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#bc3754" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#dd513a" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f37819" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fca50a" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#f6d746" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fcffa4" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-inferno)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["magma"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-magma" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#000004" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#140e36" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#3b0f70" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#641a80" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#8c2981" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#b73779" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#de4968" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f7705c" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fe9f6d" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fecf92" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fcfdbf" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-magma)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["plasma"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-plasma" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#0d0887" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#41049d" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#6a00a8" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#8f0da4" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#b12a90" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#cc4778" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#e16462" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f2844b" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fca636" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fcce25" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#f0f921" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-plasma)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["cividis"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-cividis" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#002051" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#0a326a" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#2b446e" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#4d566d" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#696970" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#7f7c75" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#948f78" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ada476" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#caba6a" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ead156" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fdea45" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-cividis)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["turbo"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-turbo" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#23171b" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#4a58dd" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#2f9df5" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#27d7c4" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#4df884" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#95fb51" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#dedd32" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ffa423" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#f65f18" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ba2208" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#900c00" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-turbo)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["bluegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-bluegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 253)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(232, 246, 249)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 239, 237)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(183, 228, 218)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(143, 211, 193)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(104, 194, 163)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(73, 177, 127)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 153, 89)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(21, 127, 60)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(3, 100, 41)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 68, 27)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-bluegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["bluepurple"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-bluepurple" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 253)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(228, 238, 245)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(204, 221, 236)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(178, 202, 225)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(156, 179, 213)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(143, 149, 198)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(140, 116, 181)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(137, 82, 165)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(133, 45, 143)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(115, 15, 113)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(77, 0, 75)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-bluepurple)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["goldgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-goldgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f4d166" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#d5ca60" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#b6c35c" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#98bb59" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#7cb257" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#60a656" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#4b9c53" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#3f8f4f" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#33834a" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#257740" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#146c36" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-goldgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["goldorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-goldorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f4d166" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#f8be5c" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#f8aa4c" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#f5983b" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#f3852a" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#ef701b" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#e2621f" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#d65322" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#c54923" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#b14223" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#9e3a26" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-goldorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["goldred"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-goldred" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f4d166" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#f6be59" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#f9aa51" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#fc964e" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#f6834b" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#ee734a" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#e56249" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#db5247" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#cf4244" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#c43141" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#b71d3e" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-goldred)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["greenblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-greenblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 240)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(229, 245, 223)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(211, 238, 206)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(189, 229, 191)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(158, 217, 187)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(123, 203, 196)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(88, 183, 205)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(57, 156, 198)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(29, 126, 183)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(11, 96, 161)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(8, 64, 129)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-greenblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["orangered"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-orangered" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 236)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(254, 235, 207)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(253, 220, 175)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(253, 202, 148)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(253, 176, 122)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(250, 142, 93)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(241, 108, 73)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(224, 69, 48)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(200, 29, 19)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(167, 4, 3)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 0, 0)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-orangered)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purplebluegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purplebluegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 251)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(239, 231, 242)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(219, 216, 234)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(190, 201, 226)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(152, 185, 217)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(105, 168, 207)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(64, 150, 192)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(25, 135, 159)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(3, 120, 119)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(1, 99, 83)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(1, 70, 54)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purplebluegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purpleblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purpleblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 251)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(239, 234, 244)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(219, 218, 235)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(191, 201, 226)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(155, 185, 217)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(114, 168, 207)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(67, 148, 195)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(26, 125, 182)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(6, 103, 161)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(4, 82, 129)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(2, 56, 88)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purpleblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purplered"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purplered" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 244, 249)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(234, 227, 240)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(220, 201, 226)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(208, 170, 210)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(208, 138, 194)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(221, 99, 174)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(227, 56, 144)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(215, 28, 108)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(183, 11, 79)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(143, 2, 58)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(103, 0, 31)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purplered)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redpurple"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redpurple" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 243)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(253, 228, 225)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(252, 207, 204)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(251, 181, 188)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(249, 147, 176)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(243, 105, 163)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(224, 62, 152)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(192, 23, 136)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(153, 3, 124)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(112, 1, 116)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(73, 0, 106)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redpurple)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yellowgreenblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yellowgreenblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 217)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(239, 249, 189)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 238, 179)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(169, 221, 183)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(115, 201, 189)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(69, 180, 194)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(40, 151, 191)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(32, 115, 178)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(35, 78, 160)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(28, 49, 133)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(8, 29, 88)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yellowgreenblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yellowgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yellowgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 229)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(247, 252, 196)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(228, 244, 172)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(199, 232, 155)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(162, 216, 138)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(120, 197, 120)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(78, 175, 99)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 148, 78)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(21, 121, 63)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(3, 96, 52)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 69, 41)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yellowgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yelloworangebrown"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yelloworangebrown" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 229)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(255, 248, 196)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(254, 234, 161)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(254, 214, 118)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 186, 74)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(251, 153, 44)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(238, 121, 24)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(216, 91, 10)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(183, 67, 4)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(143, 50, 4)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(102, 37, 6)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yelloworangebrown)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yelloworangered"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yelloworangered" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 204)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(255, 240, 169)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(254, 224, 135)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(254, 201, 101)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 171, 75)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(253, 137, 60)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(250, 92, 46)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(236, 48, 35)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(211, 17, 33)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(175, 2, 37)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(128, 0, 38)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yelloworangered)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#323232" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#2e4463" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#1e588a" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#086da7" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#0082b9" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#039ac7" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#12b1d4" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#2bc8e2" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#3ddff0" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#61f4fb" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffff" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkgold"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkgold" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#3c3c3c" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#554a38" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#6d5a35" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#846f32" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#a0832d" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#bf9828" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#dbb022" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f0cb23" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fae241" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fff290" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffff" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkgold)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#3a3a3a" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#245447" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#076a4c" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#038145" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#2d9642" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#5fa941" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#89bb3f" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#b3cb3b" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#dbdc34" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ffed39" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffaa" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkmulti"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkmulti" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#373737" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#294767" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#1e5b88" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#1a748b" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#1f8e7e" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#29a869" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#6abf50" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#aad332" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#eae30d" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fff166" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffff" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkmulti)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkred"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkred" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#343434" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#643633" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#8c3a36" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#b03e38" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#d14632" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#e75d1e" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#eb7e20" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ed9c25" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#efb92d" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#f3d431" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffeb2c" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkred)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightgreyred"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightgreyred" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#efe9e6" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#e2dcd9" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#d7cecb" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#ccc1be" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#c0b4af" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#c4a293" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#d38b66" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#de7336" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#e15917" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#df3a10" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#dc000b" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightgreyred)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightgreyteal"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightgreyteal" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#e4eaea" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#d7ddde" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#cbd1d4" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#bcc6ca" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#adbac0" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#85b2be" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#4aacc1" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#22a1c2" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#2192c0" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#1e84be" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#1876bc" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightgreyteal)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightmulti"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightmulti" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#e0f1f2" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#caebd7" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#b8e2b3" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#bddf93" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#d8e17e" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#f6e072" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#f6c659" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f4a946" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#f58a3f" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#f56c3f" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ef4a3c" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightmulti)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f2e7da" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#f7d7bd" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#f9c7a0" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#fab78a" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#faa47a" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#f8936d" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#f38264" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ed725f" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#e6605b" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#dd4f5b" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#d43d5b" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lighttealblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lighttealblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#e3e9e0" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#c4ddd1" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#a2d1cb" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#84c4c9" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#66b5c3" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#49a7bd" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#3698b4" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#3188a9" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#2d799e" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#276994" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#255988" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lighttealblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded$1 = true; + } + function sequentialMultiHue(selected) { + if (!loaded$1) + load$3(); + return [ + schemeOption(selected, "viridis"), + schemeOption(selected, "magma"), + schemeOption(selected, "inferno"), + schemeOption(selected, "plasma"), + schemeOption(selected, "cividis"), + schemeOption(selected, "turbo"), + schemeOption(selected, "bluegreen"), + schemeOption(selected, "bluepurple"), + schemeOption(selected, "goldgreen"), + schemeOption(selected, "goldorange"), + schemeOption(selected, "goldred"), + schemeOption(selected, "greenblue"), + schemeOption(selected, "orangered"), + schemeOption(selected, "purplebluegreen"), + schemeOption(selected, "purpleblue"), + schemeOption(selected, "purplered"), + schemeOption(selected, "redpurple"), + schemeOption(selected, "yellowgreenblue"), + schemeOption(selected, "yellowgreen"), + schemeOption(selected, "yelloworangebrown"), + schemeOption(selected, "yelloworangered"), + schemeHeader("schemeSequentialMultiHueDark", strings$1.schemeSequentialMultiHueDark), + schemeOption(selected, "darkblue"), + schemeOption(selected, "darkgold"), + schemeOption(selected, "darkgreen"), + schemeOption(selected, "darkmulti"), + schemeOption(selected, "darkred"), + schemeHeader("schemeSequentialMultiHueLight", strings$1.schemeSequentialMultiHueLight), + schemeOption(selected, "lightgreyred"), + schemeOption(selected, "lightgreyteal"), + schemeOption(selected, "lightmulti"), + schemeOption(selected, "lightorange"), + schemeOption(selected, "lighttealblue") + ]; + } + let loaded = false; + function load$2() { + schemesJSX["blues"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-blues" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 251, 255)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(227, 238, 249)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(207, 225, 242)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(181, 212, 233)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(147, 195, 223)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(109, 174, 213)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(75, 151, 201)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 126, 188)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(24, 100, 170)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(10, 74, 144)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(8, 48, 107)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-blues)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["tealblues"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-tealblues" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#bce4d8" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#a3d6d2" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#8cc9cd" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#76bdc7" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#5fb0c0" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#45a2b9" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#3993b0" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#3584a6" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#32759b" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#2f6790" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#2c5985" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-tealblues)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["teals"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-teals" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#bbdfdf" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#a2d4d5" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#8ac9c9" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#75bcbb" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#61b0af" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#4da5a4" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#379998" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#2b8b8c" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#1e7f7f" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#127273" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#006667" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-teals)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["greens"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-greens" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 245)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(232, 246, 227)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(211, 238, 205)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(183, 226, 177)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(151, 212, 148)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(115, 195, 120)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(77, 175, 98)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 152, 79)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(21, 127, 59)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(3, 100, 41)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 68, 27)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-greens)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["greys"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-greys" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 255)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(242, 242, 242)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(226, 226, 226)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(206, 206, 206)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(180, 180, 180)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(151, 151, 151)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(122, 122, 122)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(95, 95, 95)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(64, 64, 64)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(30, 30, 30)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 0, 0)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-greys)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purples"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purples" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(252, 251, 253)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(241, 239, 246)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(226, 225, 239)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(206, 206, 229)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(182, 181, 216)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(158, 155, 201)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(135, 130, 188)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(115, 99, 172)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(97, 64, 155)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(80, 31, 140)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(63, 0, 125)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purples)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["browns"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-browns" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#eedbbd" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#ecca96" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#e9b97a" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#e4a865" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#dc9856" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#d18954" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#c7784c" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#c0673f" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#b85536" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ad4433" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#9f3632" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-browns)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["reds"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-reds" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 245, 240)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(254, 227, 214)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(253, 201, 180)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 170, 142)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(252, 138, 107)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(249, 105, 76)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(239, 69, 51)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(217, 39, 35)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(187, 21, 26)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(151, 11, 19)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(103, 0, 13)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-reds)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["oranges"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-oranges" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 245, 235)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(254, 232, 211)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(253, 216, 179)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(253, 194, 140)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(253, 167, 98)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(251, 141, 61)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(242, 112, 29)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(226, 86, 9)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(196, 65, 3)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(159, 51, 3)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 39, 4)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-oranges)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["warmgreys"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-warmgreys" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#dcd4d0" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#cec5c1" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#c0b8b4" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#b3aaa7" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#a59c99" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#98908c" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#8b827f" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#7e7673" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#726866" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#665c5a" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#59504e" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-warmgreys)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded = true; + } + function sequentialSingleHue(selected) { + if (!loaded) + load$2(); + return [ + schemeOption(selected, "blues"), + schemeOption(selected, "tealblues"), + schemeOption(selected, "teals"), + schemeOption(selected, "greens"), + schemeOption(selected, "browns"), + schemeOption(selected, "oranges"), + schemeOption(selected, "reds"), + schemeOption(selected, "purples"), + schemeOption(selected, "warmgreys"), + schemeOption(selected, "greys") + ]; + } + const maxDistinctColors = 20; + function Palette(props) { + const { distinctValueCount } = props.colorColumn.stats; + const isDual = distinctValueCount === 2; + const categoricalNumeric = distinctValueCount > 0 && distinctValueCount < maxDistinctColors; + let isQualitative = false; + let isQuantitative2 = false; + switch (props.colorColumn.type) { + case "boolean": + case "string": + isQualitative = true; + break; + case "number": + isQuantitative2 = true; + break; + case "date": + case "integer": + isQuantitative2 = true; + isQualitative = categoricalNumeric; + } + const selected = props.scheme; + const options2 = []; + function menu(name, opts) { + if (options2.length) { + options2.push({ + key: "divider" + options2.length, + text: null, + itemType: base$1.fluentUI.DropdownMenuItemType.Divider + }); + } + options2.push({ + key: name, + text: name, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }); + options2.push.apply(options2, opts); + } + isQualitative && menu(strings$1.schemeCategorical, categorical(selected)); + isQuantitative2 && menu(strings$1.schemeSequentialSingleHue, sequentialSingleHue(selected)); + isQuantitative2 && menu(strings$1.schemeSequentialMultiHue, sequentialMultiHue(selected)); + isQuantitative2 && menu(strings$1.schemeDiverging, diverging(selected)); + isQuantitative2 && menu(strings$1.schemeCyclical, cyclical(selected)); + isDual && menu(strings$1.schemeDual, dual(selected)); + return base$1.react.createElement( + "div", + { className: "sanddance-palette" }, + base$1.react.createElement("div", { className: "sanddance-explanation", dangerouslySetInnerHTML: { + __html: strings$1.labelColorFieldInfo(props.colorColumn.name, props.colorColumn.type, categoricalNumeric, distinctValueCount) + } }), + base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabel, disabled: props.disabled, dropdownWidth: 400, label: strings$1.labelColorScheme, onRenderOption: (option) => { + if (option.itemType === base$1.fluentUI.DropdownMenuItemType.Header) { + return base$1.react.createElement("span", null, option.text); + } else { + return base$1.react.createElement( + "div", + { className: "sanddance-scheme option" }, + base$1.react.createElement("span", { className: "name" }, option.scheme), + option.children + ); + } + }, options: options2, onChange: (e, o) => { + props.changeColorScheme(o.scheme); + } }), + base$1.react.createElement("div", { className: classList("sanddance-scheme", props.disabled && "disabled") }, props.scheme && schemesJSX[props.scheme]) + ); + } + function Color(props) { + const colorColumn = props.dataContent.columns.filter((c2) => c2.name === props.colorColumn)[0]; + const disabledColorBin = !colorColumn || !colorColumn.quantitative || props.directColor; + const colorBin = props.colorBin || "quantize"; + const dropdownRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = dropdownRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + "div", + { className: "sanddance-color-dialog" }, + base$1.react.createElement( + Group$1, + { label: strings$1.labelColor }, + base$1.react.createElement(ColumnMap, Object.assign({}, props, { componentRef: dropdownRef, collapseLabel: props.compactUI, selectedColumnName: props.colorColumn, specRole: props.specCapabilities && props.specCapabilities.roles.filter((r) => r.role === "color")[0], key: 0 })), + colorColumn && colorColumn.isColorData && base$1.react.createElement("div", { className: "sanddance-explanation", dangerouslySetInnerHTML: { __html: strings$1.labelColorFieldIsColorData(colorColumn.name) } }), + colorColumn && !colorColumn.isColorData && base$1.react.createElement(Palette, { collapseLabel: props.compactUI, scheme: props.scheme, colorColumn, changeColorScheme: (scheme2) => { + props.onColorSchemeChange(scheme2); + }, disabled: props.disabled || props.directColor || colorColumn && colorColumn.isColorData }), + colorColumn && !colorColumn.isColorData && base$1.react.createElement(Signal, { disabled: props.disabled || !colorColumn || props.directColor || colorColumn && colorColumn.isColorData, signal: props.colorReverseSignal, explorer: props.explorer, initialValue: getInitialSignalValue(props.explorer, props.colorReverseSignal), onChange: props.onColorReverseChange, collapseLabel: props.compactUI }) + ), + colorColumn && !colorColumn.isColorData && base$1.react.createElement( + Group$1, + { label: strings$1.labelColorBin }, + base$1.react.createElement("div", { className: "sanddance-explanation" }, strings$1.labelColorBinExplanation), + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { selectedKey: colorBin, options: [ + { + key: "continuous", + text: strings$1.labelColorBinNone, + disabled: disabledColorBin + }, + { + key: "quantize", + text: strings$1.labelColorBinQuantize, + disabled: disabledColorBin + }, + { + key: "quantile", + text: strings$1.labelColorBinQuantile, + disabled: disabledColorBin + } + ], onChange: (e, o) => { + props.onColorBinChange(o.key); + } }), + base$1.react.createElement(Signal, { disabled: props.disabled || disabledColorBin || props.colorBin === "continuous", signal: props.colorBinSignal, explorer: props.explorer, initialValue: getInitialSignalValue(props.explorer, props.colorBinSignal), onChange: props.onColorBinCountChange, collapseLabel: props.compactUI }) + ), + colorColumn && !colorColumn.isColorData && base$1.react.createElement( + Group$1, + { label: strings$1.labelColorOptions }, + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.selectDirectColor, disabled: !colorColumn.stats.hasColorData, checked: !!(colorColumn.stats.hasColorData && props.directColor), onChange: (e, checked) => props.onDirectColorChange(checked) }), + base$1.react.createElement("div", { className: "sanddance-explanation", dangerouslySetInnerHTML: { __html: strings$1.labelDataColors } }) + ) + ); + } + const KeyCodes$1 = { + ENTER: 13 + }; + function isNumber$2(value2) { + if (typeof value2 === "number") + return true; + if (!isNaN(value2)) + return true; return false; -} -function isBoolean(value) { - if (typeof value === 'boolean') return true; - if (typeof value === 'string') switch(value.toLowerCase()){ + } + function isBoolean$2(value2) { + if (typeof value2 === "boolean") + return true; + if (typeof value2 === "string") { + switch (value2.toLowerCase()) { case "true": case "false": - return true; + return true; + } } return false; -} -function bingSearchLink(column, value) { - if (isNumber(value)) return null; - if (isBoolean(value)) return null; - if (column && column.stats.distinctValueCount === 2) return null; - return (0, _base.base).react.createElement("div", { - className: 'bing-search' - }, (0, _base.base).react.createElement("a", { - href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`, - target: '_blank', - title: (0, _language.strings).bingsearchDescription(value), - "aria-label": (0, _language.strings).bingsearchDescription(value) - }, (0, _language.strings).bingsearch)); -} -function displayValue(value) { - switch(value){ - case '': - return { - special: true, - display: (0, _language.strings).labelBlank - }; - case null: - return { - special: true, - display: (0, _language.strings).labelNull - }; - case true: - return { - special: true, - display: (0, _language.strings).labelTrue - }; - case false: - return { - special: true, - display: (0, _language.strings).labelFalse - }; - default: - if (typeof value === 'object') { - if (value instanceof Date) { - const d = value; - return displayValue(d.input); - } - return { - special: false, - display: value.toLocaleString() - }; - } - return { - special: false, - display: value - }; + } + function bingSearchLink(column, value2) { + if (isNumber$2(value2)) + return null; + if (isBoolean$2(value2)) + return null; + if (column && column.stats.distinctValueCount === 2) + return null; + return base$1.react.createElement( + "div", + { className: "bing-search" }, + base$1.react.createElement("a", { href: `https://www.bing.com/search?q=${encodeURIComponent(value2)}`, target: "_blank", title: strings$1.bingsearchDescription(value2), "aria-label": strings$1.bingsearchDescription(value2) }, strings$1.bingsearch) + ); + } + function displayValue(value2) { + switch (value2) { + case "": { + return { special: true, display: strings$1.labelBlank }; + } + case null: { + return { special: true, display: strings$1.labelNull }; + } + case true: { + return { special: true, display: strings$1.labelTrue }; + } + case false: { + return { special: true, display: strings$1.labelFalse }; + } + default: { + if (typeof value2 === "object") { + if (value2 instanceof Date) { + const d2 = value2; + return displayValue(d2.input); + } + return { special: false, display: value2.toLocaleString() }; + } + return { special: false, display: value2 }; + } + } + } + function displayValueElement(nvp) { + const d2 = displayValue(nvp.value); + if (d2.special) { + return base$1.react.createElement("i", null, d2.display); + } + return d2.display; + } + function DataItem(props) { + if (!props.item) { + return null; } -} -function displayValueElement(nvp) { - const d = displayValue(nvp.value); - if (d.special) return (0, _base.base).react.createElement("i", null, d.display); - return d.display; -} -function DataItem(props) { - if (!props.item) return null; const nameValuePairs = []; - for(const columnName in props.item){ - if (columnName === (0, _sanddanceReact.SandDance).constants.GL_ORDINAL && !props.showSystemFields) continue; - if ((0, _sanddanceReact.SandDance).util.isInternalFieldName(columnName)) continue; - const nameValuePair = { - columnName, - value: props.item[columnName] - }; - if (!props.bingSearchDisabled) nameValuePair.bingSearch = bingSearchLink(props.columns.filter((c)=>c.name === columnName)[0], props.item[columnName]); - nameValuePairs.push(nameValuePair); - } - return (0, _base.base).react.createElement("div", { - className: "sanddance-dataItem" - }, nameValuePairs.map((nameValuePair, i)=>{ - const ex = { - key: 0, - name: nameValuePair.columnName, - operator: '==', - value: nameValuePair.value - }; - if (nameValuePair.value === null || nameValuePair.value === '') { - ex.operator = 'isnullorEmpty'; - delete ex.value; - } - const searchClick = (e)=>{ - const search = { - key: 0, - expressions: [ - ex - ] - }; - props.onSearch(e, [ - search - ]); - }; - const title = (0, _language.strings).tooltipSearch(nameValuePair.columnName, displayValue(nameValuePair.value).display); - return (0, _base.base).react.createElement("div", { - key: i, - onClick: !props.disabled ? searchClick : null, - title: title, - onKeyUp: (e)=>{ - if (e.keyCode === (0, _keycodes.KeyCodes).ENTER) searchClick(e); - }, - tabIndex: 0, - className: "name-value" - }, (0, _base.base).react.createElement("div", { - className: "column-name" - }, nameValuePair.columnName), (0, _base.base).react.createElement("div", { - className: "column-value" - }, displayValueElement(nameValuePair)), nameValuePair.bingSearch); + for (const columnName in props.item) { + if (columnName === GL_ORDINAL && !props.showSystemFields) { + continue; + } + if (isInternalFieldName(columnName)) { + continue; + } + const nameValuePair = { + columnName, + value: props.item[columnName] + }; + if (!props.bingSearchDisabled) { + nameValuePair.bingSearch = bingSearchLink(props.columns.filter((c2) => c2.name === columnName)[0], props.item[columnName]); + } + nameValuePairs.push(nameValuePair); + } + return base$1.react.createElement("div", { className: "sanddance-dataItem" }, nameValuePairs.map((nameValuePair, i) => { + const ex = { + key: 0, + name: nameValuePair.columnName, + operator: "==", + value: nameValuePair.value + }; + if (nameValuePair.value === null || nameValuePair.value === "") { + ex.operator = "isnullorEmpty"; + delete ex.value; + } + const searchClick = (e) => { + const search = { + key: 0, + expressions: [ex] + }; + props.onSearch(e, [search]); + }; + const title = strings$1.tooltipSearch(nameValuePair.columnName, displayValue(nameValuePair.value).display); + return base$1.react.createElement( + "div", + { key: i, onClick: !props.disabled ? searchClick : null, title, onKeyUp: (e) => { + if (e.keyCode === KeyCodes$1.ENTER) { + searchClick(e); + } + }, tabIndex: 0, className: "name-value" }, + base$1.react.createElement("div", { className: "column-name" }, nameValuePair.columnName), + base$1.react.createElement("div", { className: "column-value" }, displayValueElement(nameValuePair)), + nameValuePair.bingSearch + ); })); -} - -},{"../base":"3TPz5","../keycodes":"8gTMx","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8gTMx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyCodes", ()=>KeyCodes); -const KeyCodes = { - ENTER: 13 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4nAWT":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "History", ()=>History); -parcelHelpers.export(exports, "getPureInsight", ()=>getPureInsight); -parcelHelpers.export(exports, "replay", ()=>replay); -var _base = require("../base"); -var _group = require("../controls/group"); -var _keycodes = require("../keycodes"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function History(props) { - return (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelHistory, - className: "sanddance-history" - }, (0, _base.base).react.createElement("ol", null, props.historyItems.map((hi, i)=>{ - let ref; + } + const dataBrowserZeroMessages = {}; + dataBrowserZeroMessages[DataScopeId.AllData] = strings$1.labelZeroAll; + dataBrowserZeroMessages[DataScopeId.FilteredData] = null; + dataBrowserZeroMessages[DataScopeId.SelectedData] = strings$1.labelZeroSearchResults; + const dataBrowserNullMessages = {}; + dataBrowserNullMessages[DataScopeId.AllData] = strings$1.labelDataNullAll; + dataBrowserNullMessages[DataScopeId.FilteredData] = strings$1.labelDataNullFiltered; + dataBrowserNullMessages[DataScopeId.SelectedData] = strings$1.labelDataNullSelection; + function DataBrowser(props) { + function activateRecord(newIndex) { + props.onActivate(props.data[newIndex], newIndex); + } + const { index: index2 } = props; + const length2 = props.data && props.data.length || 0; + const dropdownRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = dropdownRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + Group$1, + { label: strings$1.labelDataBrowser, className: "sanddance-dataIndex" }, + base$1.react.createElement(Dropdown$1, { componentRef: dropdownRef, label: strings$1.labelDataScope, collapseLabel: true, options: [ + { + key: DataScopeId.AllData, + text: strings$1.selectDataSpanAll, + isSelected: props.selectedDataScope === DataScopeId.AllData + }, + { + key: DataScopeId.FilteredData, + text: strings$1.selectDataSpanFilter, + isSelected: props.selectedDataScope === DataScopeId.FilteredData + }, + { + key: DataScopeId.SelectedData, + text: strings$1.selectDataSpanSelection, + isSelected: props.selectedDataScope === DataScopeId.SelectedData + } + ], onChange: (e, o) => { + props.onDataScopeClick(o.key); + } }), + !props.data && base$1.react.createElement("div", { dangerouslySetInnerHTML: { __html: props.nullMessage } }), + props.data && !props.data.length && base$1.react.createElement("div", null, props.zeroMessage), + !!length2 && base$1.react.createElement( + "div", + null, + base$1.react.createElement( + "div", + { className: "index" }, + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, iconName: "ChevronLeftMed", onClick: (e) => activateRecord(index2 <= 0 ? length2 - 1 : index2 - 1), disabled: props.disabled || length2 === 1, title: strings$1.buttonPrevDataItem }), + base$1.react.createElement("span", null, strings$1.record(index2 + 1, length2)), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, iconName: "ChevronRightMed", onClick: (e) => activateRecord(index2 >= length2 - 1 ? 0 : index2 + 1), disabled: props.disabled || length2 === 1, title: strings$1.buttonNextDataItem }) + ), + !props.itemVisible && base$1.react.createElement("div", { className: "item-filtered" }, strings$1.labelDataItemIsFiltered), + base$1.react.createElement(DataItem, { columns: props.columns, item: props.data[index2], disabled: props.disabled, onSearch: props.onSearch, bingSearchDisabled: props.bingSearchDisabled }) + ), + base$1.react.createElement(ColumnTypeChanger, { theme: props.theme, themePalette: props.themePalette, initialCategoricalColumns: props.categoricalColumns, initialQuantitativeColumns: props.quantitativeColumns, onConfirmUpdate: props.onUpdateColumnTypes }), + props.dataExportHandler && props.data && base$1.react.createElement(DataExportPicker, { theme: props.theme, initializer: { + fileName: `${removeExtensions(props.displayName)} (${props.data.length})` + }, data: props.data, dataExportHandler: props.dataExportHandler, disabled: props.disabled }) + ); + } + function History(props) { + return base$1.react.createElement( + Group$1, + { label: strings$1.labelHistory, className: "sanddance-history" }, + base$1.react.createElement("ol", null, props.historyItems.map((hi, i) => { + let ref2; if (i === props.historyIndex) { - ref = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - (_a = ref.current) === null || _a === void 0 || _a.focus(); - }; - } - return (0, _base.base).react.createElement("li", { - key: i, - className: (0, _sanddanceReact.util).classList(i === props.historyIndex && 'selected'), - onKeyUp: (e)=>{ - if (e.keyCode === (0, _keycodes.KeyCodes).ENTER) props.redo(i); - } - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: 'sanddance-history-button', - componentRef: ref, - text: hi.label, - onClick: ()=>props.redo(i) - })); - }))); -} -function getPureInsight(historicInsight) { - const { colorBin, columns, directColor, facetStyle, filter, hideAxes, hideLegend, scheme, signalValues, size, totalStyle, transform, chart, view } = historicInsight; + ref2 = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + (_a2 = ref2.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + } + return base$1.react.createElement( + "li", + { key: i, className: classList(i === props.historyIndex && "selected"), onKeyUp: (e) => { + if (e.keyCode === KeyCodes$1.ENTER) { + props.redo(i); + } + } }, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "sanddance-history-button", componentRef: ref2, text: hi.label, onClick: () => props.redo(i) }) + ); + })) + ); + } + function getPureInsight(historicInsight) { + const { colorBin, columns, directColor, facetStyle, filter: filter2, hideAxes, hideLegend, scheme: scheme2, signalValues, size, totalStyle, transform: transform2, chart, view } = historicInsight; const insight = { - colorBin, - columns, - directColor, - facetStyle, - filter, - hideAxes, - hideLegend, - scheme, - signalValues, - size, - totalStyle, - transform, - chart, - view + colorBin, + columns, + directColor, + facetStyle, + filter: filter2, + hideAxes, + hideLegend, + scheme: scheme2, + signalValues, + size, + totalStyle, + transform: transform2, + chart, + view }; return insight; -} -function replay(historyItems, index) { - let filter = null; + } + function replay(historyItems, index2) { + let filter2 = null; let historicInsight = {}; - for(let i = 0; i < index + 1; i++){ - const historyItem = historyItems[i]; - if (historyItem) { - if (historyItem.historicInsight.filter === null) filter = null; - else if (historyItem.historicInsight.rebaseFilter) filter = historyItem.historicInsight.filter; - else if (historyItem.historicInsight.filter) filter = (0, _sanddanceReact.SandDance).searchExpression.narrow(filter, historyItem.historicInsight.filter); - historicInsight = Object.assign(Object.assign({}, historicInsight), historyItem.historicInsight); - } + for (let i = 0; i < index2 + 1; i++) { + const historyItem = historyItems[i]; + if (historyItem) { + if (historyItem.historicInsight.filter === null) { + filter2 = null; + } else if (historyItem.historicInsight.rebaseFilter) { + filter2 = historyItem.historicInsight.filter; + } else if (historyItem.historicInsight.filter) { + filter2 = narrow(filter2, historyItem.historicInsight.filter); + } + historicInsight = Object.assign(Object.assign({}, historicInsight), historyItem.historicInsight); + } } - return Object.assign(Object.assign({}, historicInsight), { - filter - }); -} - -},{"../base":"3TPz5","../controls/group":"afKlW","../keycodes":"8gTMx","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ioN9k":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getPosition", ()=>getPosition); -function hasClientXY(e) { - if (e && e.clientX !== undefined && e.clientX !== undefined) return { - top: e.clientY, - left: e.clientX - }; -} -function getPosition(e) { + return Object.assign(Object.assign({}, historicInsight), { filter: filter2 }); + } + function hasClientXY(e) { + if (e && e.clientX !== void 0 && e.clientX !== void 0) { + return { top: e.clientY, left: e.clientX }; + } + } + function getPosition(e) { const xy = hasClientXY(e); - if (xy) return xy; + if (xy) { + return xy; + } const te = e; - if (te === null || te === void 0 ? void 0 : te.touches) for(let i = 0; i < te.touches.length; i++){ - const xy = hasClientXY(te.touches[i]); - if (xy) return xy; + if (te === null || te === void 0 ? void 0 : te.touches) { + for (let i = 0; i < te.touches.length; i++) { + const xy2 = hasClientXY(te.touches[i]); + if (xy2) { + return xy2; + } + } } const el = e.target; - if (el && el.getClientRects) return el.getClientRects()[0]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1nehK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initPrefs", ()=>initPrefs); -parcelHelpers.export(exports, "saveSignalValuePref", ()=>saveSignalValuePref); -parcelHelpers.export(exports, "copyPrefToNewState", ()=>copyPrefToNewState); -parcelHelpers.export(exports, "savePref", ()=>savePref); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function initPrefs(prefs, partialInsight) { + if (el && el.getClientRects) { + return el.getClientRects()[0]; + } + } + function initPrefs(prefs, partialInsight) { if (partialInsight) { - const specTypePrefs = prefs[partialInsight.chart] || {}; - prefs[partialInsight.chart] = specTypePrefs; - for(const _role in partialInsight.columns){ - const role = _role; - if (role === 'color' || role === 'x') { - const rolePrefs = specTypePrefs[role] || {}; - specTypePrefs[role] = rolePrefs; - const column = partialInsight.columns[role]; - const copySignalValue = (signalName)=>{ - if (partialInsight.signalValues && partialInsight.signalValues[signalName] && rolePrefs[column]) { - const signalValues = rolePrefs[column].signalValues || {}; - signalValues[signalName] = partialInsight.signalValues[signalName]; - rolePrefs[column].signalValues = signalValues; - } - }; - switch(role){ - case 'color': - rolePrefs[column] = { - scheme: partialInsight.scheme, - colorBin: partialInsight.colorBin - }; - copySignalValue((0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount); - break; - case 'x': - copySignalValue((0, _sanddanceReact.SandDance).constants.SignalNames.XBins); - break; - } - } + const specTypePrefs = prefs[partialInsight.chart] || {}; + prefs[partialInsight.chart] = specTypePrefs; + for (const _role in partialInsight.columns) { + const role = _role; + if (role === "color" || role === "x") { + const rolePrefs = specTypePrefs[role] || {}; + specTypePrefs[role] = rolePrefs; + const column = partialInsight.columns[role]; + const copySignalValue = (signalName) => { + if (partialInsight.signalValues && partialInsight.signalValues[signalName] && rolePrefs[column]) { + const signalValues = rolePrefs[column].signalValues || {}; + signalValues[signalName] = partialInsight.signalValues[signalName]; + rolePrefs[column].signalValues = signalValues; + } + }; + switch (role) { + case "color": + rolePrefs[column] = { + scheme: partialInsight.scheme, + colorBin: partialInsight.colorBin + }; + copySignalValue(SignalNames.ColorBinCount); + break; + case "x": + copySignalValue(SignalNames.XBins); + break; + } } + } } -} -function saveSignalValuePref(prefs, chart, role, column, signalName, signalValue) { - const partialInsight = savePref(prefs, chart, role, column, { - signalValues: {} - }); + } + function saveSignalValuePref(prefs, chart, role, column, signalName, signalValue) { + const partialInsight = savePref(prefs, chart, role, column, { signalValues: {} }); partialInsight.signalValues[signalName] = signalValue; -} -function copyPrefToNewState(prefs, chart, role, columnName) { - const specTypePrefs = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, prefs['*'], prefs[chart]); - const rolePrefs = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, specTypePrefs['*'], specTypePrefs[role]); - const partialInsight = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, rolePrefs['*'], rolePrefs[columnName]); + } + function copyPrefToNewState(prefs, chart, role, columnName) { + const specTypePrefs = deepMerge({}, prefs["*"], prefs[chart]); + const rolePrefs = deepMerge({}, specTypePrefs["*"], specTypePrefs[role]); + const partialInsight = deepMerge({}, rolePrefs["*"], rolePrefs[columnName]); return partialInsight; -} -function savePref(prefs, chart, role, column, partialInsight) { + } + function savePref(prefs, chart, role, column, partialInsight) { const SpecTypePrefs = prefs[chart] || {}; prefs[chart] = SpecTypePrefs; const rolePrefs = SpecTypePrefs[role] || {}; SpecTypePrefs[role] = rolePrefs; - rolePrefs[column] = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, rolePrefs[column], partialInsight); + rolePrefs[column] = deepMerge({}, rolePrefs[column], partialInsight); return rolePrefs[column]; -} - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3oCWU":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "compareGroups", ()=>compareGroups); -parcelHelpers.export(exports, "createInputSearch", ()=>createInputSearch); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function comparableGroup(group) { - return Object.assign(Object.assign({}, group), { - clause: null - }); -} -function compareGroup(a, b) { - return (0, _sanddanceReact.SandDance).searchExpression.compareGroup(comparableGroup(a), comparableGroup(b)); -} -function compareGroups(haystack, needle) { + } + function comparableGroup(group2) { + return Object.assign(Object.assign({}, group2), { clause: null }); + } + function compareGroup(a2, b2) { + return compareGroup$1(comparableGroup(a2), comparableGroup(b2)); + } + function compareGroups(haystack, needle) { const groups = []; let found = false; - //look for item in all - haystack.forEach((group)=>{ - if (compareGroup(group, needle)) //if it exists, don't add it + haystack.forEach((group2) => { + if (compareGroup(group2, needle)) { found = true; - else groups.push(group); + } else { + groups.push(group2); + } }); - return { - groups, - found - }; -} -function createInputSearch(search) { - const groups = (0, _sanddanceReact.SandDance).searchExpression.ensureSearchExpressionGroupArray(search); - const dialogSearch = groups.map((group, groupIndex)=>{ - return Object.assign(Object.assign({ - key: groupIndex - }, group), { - expressions: group.expressions.map((ex, i)=>{ - const ex2 = Object.assign({ - key: i - }, ex); - return ex2; - }) - }); + return { groups, found }; + } + function createInputSearch(search) { + const groups = ensureSearchExpressionGroupArray(search); + const dialogSearch = groups.map((group2, groupIndex) => { + return Object.assign(Object.assign({ key: groupIndex }, group2), { expressions: group2.expressions.map((ex, i) => { + const ex2 = Object.assign({ key: i }, ex); + return ex2; + }) }); }); return dialogSearch; -} - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4tj9B":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Renderer", ()=>Renderer); -var _base = require("../base"); -var _language = require("../language"); -var _iconButton = require("./iconButton"); -var _dialog = require("./dialog"); -var _button = require("./button"); -function _Renderer(_props) { - class __Renderer extends (0, _base.base).react.Component { - constructor(props){ - var _a, _b; - super(props); - this.state = this.getInitialState(props); - if (!((_b = (_a = this.state.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 ? void 0 : _b.morphchartsref)) { - const t = setInterval(()=>{ - var _a, _b; - const newState = this.getInitialState(props); - if (this.mounted && ((_b = (_a = newState.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 ? void 0 : _b.morphchartsref)) { - clearInterval(t); - this.setState(newState); - } - }, 10); - } - } - componentDidMount() { - this.mounted = true; - } - componentWillUnmount() { - this.mounted = false; - } - getInitialState(props) { - const { viewer } = props.explorer; - return { - showOptions: false, - viewer - }; - } - setOptions(newOptions) { - const { explorer } = this.props; - const renderer = Object.assign(Object.assign({}, explorer.state.renderer), newOptions); - const { onSetupOptionsChanged } = explorer.props; - if (onSetupOptionsChanged) { - const setup = explorer.getSetup(); - setup.renderer = renderer; - onSetupOptionsChanged(setup); - } - explorer.setState({ - renderer - }); - } - setBasicOptions(newOptions) { - this.setOptions({ - advanced: false, - basicOptions: Object.assign(Object.assign({}, this.props.basicOptions), newOptions) - }); - } - setAdvancedOptions(newOptions) { - this.setOptions({ - advanced: true, - advancedOptions: Object.assign(Object.assign({}, this.props.advancedOptions), newOptions) - }); - } - render() { - var _a, _b; - const { props, state } = this; - const iconButtonStyles = { - menuIcon: { - display: 'none' - } - }; - if (!((_b = (_a = state.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 ? void 0 : _b.morphchartsref)) return (0, _base.base).react.createElement((0, _iconButton.IconButton), { - styles: iconButtonStyles, - className: 'sanddance-advanced-renderer', - disabled: true, - iconName: 'HourGlass', - onClick: undefined, - themePalette: props.themePalette, - title: (0, _language.strings).labelRenderer - }); - else { - const { morphchartsref } = state.viewer.presenter; - const choiceButtonStyle = { - border: 'none' - }; - const { advanced, advancedOptions, basicOptions } = props; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - iconName: 'PicturePosition', - title: (0, _language.strings).buttonCameraHome, - onClick: props.onHomeClick, - styles: iconButtonStyles, - themePalette: props.themePalette - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - styles: iconButtonStyles, - className: 'sanddance-advanced-renderer', - iconName: advanced ? 'DiamondSolid' : 'Diamond', - disabled: !morphchartsref.supportedRenders.advanced, - onClick: undefined, - themePalette: props.themePalette, - title: morphchartsref.supportedRenders.advanced ? (0, _language.strings).labelRenderer : (0, _language.strings).labelRendererAdvancedDisabled, - menuProps: { - items: [ - { - key: 'basic', - text: (0, _language.strings).labelRendererBasic, - iconProps: { - iconName: advanced ? null : 'RadioBullet' - }, - onClick: ()=>advanced && this.setOptions({ - advanced: false - }) - }, - { - key: 'advanced', - text: (0, _language.strings).labelRendererAdvanced, - iconProps: { - iconName: advanced ? 'RadioBullet' : null - }, - onClick: ()=>!advanced && this.setOptions({ - advanced: true - }) - }, - { - key: 'options', - text: (0, _language.strings).labelRendererOptions, - onClick: (e)=>this.setState({ - showOptions: true - }) - } - ] - } - }), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !state.showOptions, - dialogContentProps: { - className: 'sanddance-renderer-dialog', - title: (0, _language.strings).labelRendererOptionsDialogTitle - }, - onDismiss: ()=>this.setState({ - showOptions: false - }) - }, (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - iconName: advanced ? 'RadioBtnOff' : 'RadioBtnOn', - onClick: ()=>this.setOptions({ - advanced: false - }), - text: (0, _language.strings).labelRendererBasic, - themePalette: props.themePalette, - rootStyle: choiceButtonStyle - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: basicOptions.antialias, - label: (0, _language.strings).labelRendererOptionsAntialias, - onChange: (e, antialias)=>this.setBasicOptions({ - antialias - }) - })))), (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - iconName: advanced ? 'RadioBtnOn' : 'RadioBtnOff', - onClick: ()=>this.setOptions({ - advanced: true - }), - text: (0, _language.strings).labelRendererAdvanced, - themePalette: props.themePalette, - rootStyle: choiceButtonStyle - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isShadowEnabled, - label: (0, _language.strings).labelRendererOptionsShadow, - onChange: (e, isShadowEnabled)=>this.setAdvancedOptions({ - isShadowEnabled - }) - })), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isSsaoEnabled, - label: (0, _language.strings).labelRendererOptionsSsao, - onChange: (e, isSsaoEnabled)=>this.setAdvancedOptions({ - isSsaoEnabled - }) - })), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isBloomEnabled, - label: (0, _language.strings).labelRendererOptionsBloom, - onChange: (e, isBloomEnabled)=>this.setAdvancedOptions({ - isBloomEnabled - }) - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - value: advancedOptions.bloomIntensity, - min: 0.1, - max: 5, - step: 0.01, - label: (0, _language.strings).labelRendererOptionsBloomIntensity, - onChange: (bloomIntensity)=>this.setAdvancedOptions({ - bloomIntensity, - isBloomEnabled: true - }) - })))), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isDofEnabled, - label: (0, _language.strings).labelRendererOptionsDof, - onChange: (e, isDofEnabled)=>this.setAdvancedOptions({ - isDofEnabled - }) - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - value: advancedOptions.dofFocusRange, - min: 0, - max: 2, - step: 0.01, - label: (0, _language.strings).labelRendererOptionsDofRange, - onChange: (dofFocusRange)=>this.setAdvancedOptions({ - dofFocusRange, - isDofEnabled: true - }) - })))), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isFxaaEnabled, - label: (0, _language.strings).labelRendererOptionsFxaa, - onChange: (e, isFxaaEnabled)=>this.setAdvancedOptions({ - isFxaaEnabled - }) - })))))); + } + function _Renderer(_props) { + class __Renderer extends base$1.react.Component { + constructor(props) { + var _a2, _b2; + super(props); + this.state = this.getInitialState(props); + if (!((_b2 = (_a2 = this.state.viewer) === null || _a2 === void 0 ? void 0 : _a2.presenter) === null || _b2 === void 0 ? void 0 : _b2.morphchartsref)) { + const t = setInterval(() => { + var _a3, _b3; + const newState = this.getInitialState(props); + if (this.mounted && ((_b3 = (_a3 = newState.viewer) === null || _a3 === void 0 ? void 0 : _a3.presenter) === null || _b3 === void 0 ? void 0 : _b3.morphchartsref)) { + clearInterval(t); + this.setState(newState); } + }, 10); } - } - return new __Renderer(_props); -} -const Renderer = _Renderer; - -},{"../base":"3TPz5","../language":"67xOI","./iconButton":"6pZiK","./dialog":"OQi9w","./button":"f8wtc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jGrId":[function(require,module,exports,__globalThis) { -module.exports = React; - -},{}],"1a3X3":[function(require,module,exports,__globalThis) { -module.exports = ReactDOM; - -},{}],"dtgCh":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fluentUI", ()=>fluentUI); -var _button = require("@fluentui/react/lib/Button"); -var _choiceGroup = require("@fluentui/react/lib/ChoiceGroup"); -var _comboBox = require("@fluentui/react/lib/ComboBox"); -var _commandBar = require("@fluentui/react/lib/CommandBar"); -var _contextualMenu = require("@fluentui/react/lib/ContextualMenu"); -var _utilities = require("@fluentui/react/lib/Utilities"); -var _dialog = require("@fluentui/react/lib/Dialog"); -var _dropdown = require("@fluentui/react/lib/Dropdown"); -var _styling = require("@fluentui/react/lib/Styling"); -var _icon = require("@fluentui/react/lib/Icon"); -var _fluentuiIcons = require("@msrvida/fluentui-icons"); -var _label = require("@fluentui/react/lib/Label"); -var _modal = require("@fluentui/react/lib/Modal"); -var _slider = require("@fluentui/react/lib/Slider"); -var _spinner = require("@fluentui/react/lib/Spinner"); -var _textField = require("@fluentui/react/lib/TextField"); -var _toggle = require("@fluentui/react/lib/Toggle"); -(0, _fluentuiIcons.use)((0, _styling.registerIcons)); -(0, _fluentuiIcons.initializeIcons)(); -const fluentUI = { - ActionButton: (0, _button.ActionButton), - ChoiceGroup: (0, _choiceGroup.ChoiceGroup), - ComboBox: (0, _comboBox.ComboBox), - CommandBar: (0, _commandBar.CommandBar), - ContextualMenuItemType: (0, _contextualMenu.ContextualMenuItemType), - Customizer: (0, _utilities.Customizer), - DefaultButton: (0, _button.DefaultButton), - Dialog: (0, _dialog.Dialog), - DialogFooter: (0, _dialog.DialogFooter), - DialogType: (0, _dialog.DialogType), - Dropdown: (0, _dropdown.Dropdown), - DropdownMenuItemType: (0, _dropdown.DropdownMenuItemType), - Icon: (0, _icon.Icon), - IconButton: (0, _button.IconButton), - getFocusStyle: (0, _styling.getFocusStyle), - getTheme: (0, _styling.getTheme), - Label: (0, _label.Label), - loadTheme: (0, _styling.loadTheme), - Modal: (0, _modal.Modal), - PrimaryButton: (0, _button.PrimaryButton), - Slider: (0, _slider.Slider), - Spinner: (0, _spinner.Spinner), - SpinnerSize: (0, _spinner.SpinnerSize), - TextField: (0, _textField.TextField), - Toggle: (0, _toggle.Toggle), - registerIcons: (0, _styling.registerIcons), - unregisterIcons: (0, _styling.unregisterIcons) -}; - -},{"@fluentui/react/lib/Button":"1457j","@fluentui/react/lib/ChoiceGroup":"8qKBO","@fluentui/react/lib/ComboBox":"7XnNF","@fluentui/react/lib/CommandBar":"9ad8u","@fluentui/react/lib/ContextualMenu":"iuj1y","@fluentui/react/lib/Utilities":"1NZCy","@fluentui/react/lib/Dialog":"bXa7Q","@fluentui/react/lib/Dropdown":"8LUqt","@fluentui/react/lib/Styling":"hTimn","@fluentui/react/lib/Icon":"hiMUP","@msrvida/fluentui-icons":"1pQ7X","@fluentui/react/lib/Label":"8FZUu","@fluentui/react/lib/Modal":"7RBgT","@fluentui/react/lib/Slider":"e6BwJ","@fluentui/react/lib/Spinner":"4BGE1","@fluentui/react/lib/TextField":"4CWIf","@fluentui/react/lib/Toggle":"cpdGU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1457j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Button/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Button/index":"5ue98","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ue98":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ButtonGlobalClassNames", ()=>(0, _baseButtonClassNames.ButtonGlobalClassNames)); -var _baseButton = require("./BaseButton"); -parcelHelpers.exportAll(_baseButton, exports); -var _buttonTypes = require("./Button.types"); -parcelHelpers.exportAll(_buttonTypes, exports); -var _button = require("./Button"); -parcelHelpers.exportAll(_button, exports); -var _actionButton = require("./ActionButton/ActionButton"); -parcelHelpers.exportAll(_actionButton, exports); -var _commandBarButton = require("./CommandBarButton/CommandBarButton"); -parcelHelpers.exportAll(_commandBarButton, exports); -var _commandButton = require("./CommandButton/CommandButton"); -parcelHelpers.exportAll(_commandButton, exports); -var _compoundButton = require("./CompoundButton/CompoundButton"); -parcelHelpers.exportAll(_compoundButton, exports); -var _defaultButton = require("./DefaultButton/DefaultButton"); -parcelHelpers.exportAll(_defaultButton, exports); -var _messageBarButton = require("./MessageBarButton/MessageBarButton"); -parcelHelpers.exportAll(_messageBarButton, exports); -var _primaryButton = require("./PrimaryButton/PrimaryButton"); -parcelHelpers.exportAll(_primaryButton, exports); -var _iconButton = require("./IconButton/IconButton"); -parcelHelpers.exportAll(_iconButton, exports); -var _splitButtonClassNames = require("./SplitButton/SplitButton.classNames"); -parcelHelpers.exportAll(_splitButtonClassNames, exports); -var _baseButtonClassNames = require("./BaseButton.classNames"); - -},{"./BaseButton":false,"./Button.types":false,"./Button":false,"./ActionButton/ActionButton":"i8Fdq","./CommandBarButton/CommandBarButton":"fxfe4","./CommandButton/CommandButton":"5I0qn","./CompoundButton/CompoundButton":false,"./DefaultButton/DefaultButton":"3H4TE","./MessageBarButton/MessageBarButton":false,"./PrimaryButton/PrimaryButton":"g0nWk","./IconButton/IconButton":"bbHBP","./SplitButton/SplitButton.classNames":false,"./BaseButton.classNames":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"RtUZ1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BaseButton", ()=>BaseButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _icon = require("../../Icon"); -var _directionalHint = require("../../common/DirectionalHint"); -var _contextualMenu = require("../../ContextualMenu"); -var _baseButtonClassNames = require("./BaseButton.classNames"); -var _splitButtonClassNames = require("./SplitButton/SplitButton.classNames"); -var _keytipData = require("../../KeytipData"); -var TouchIdleDelay = 500; /* ms */ -var COMPONENT_NAME = 'BaseButton'; -/** - * {@docCategory Button} - */ var BaseButton = /** @class */ function(_super) { - (0, _tslib.__extends)(BaseButton, _super); - function BaseButton(props) { - var _this = _super.call(this, props) || this; - _this._buttonElement = _react.createRef(); - _this._splitButtonContainer = _react.createRef(); - _this._mergedRef = (0, _utilities.createMergedRef)(); - _this._renderedVisibleMenu = false; - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); - }); - _this._onRenderIcon = function(buttonProps, defaultRender) { - var iconProps = _this.props.iconProps; - if (iconProps && (iconProps.iconName !== undefined || iconProps.imageProps)) { - var className = iconProps.className, imageProps = iconProps.imageProps, rest = (0, _tslib.__rest)(iconProps, [ - "className", - "imageProps" - ]); - // If the styles prop is specified as part of iconProps, fall back to regular Icon as FontIcon and ImageIcon - // do not have this prop. - if (iconProps.styles) return _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - className: (0, _utilities.css)(_this._classNames.icon, className), - imageProps: imageProps - }, rest)); - if (iconProps.iconName) return _react.createElement((0, _icon.FontIcon), (0, _tslib.__assign)({ - className: (0, _utilities.css)(_this._classNames.icon, className) - }, rest)); - if (imageProps) return _react.createElement((0, _icon.ImageIcon), (0, _tslib.__assign)({ - className: (0, _utilities.css)(_this._classNames.icon, className), - imageProps: imageProps - }, rest)); - } - return null; - }; - _this._onRenderTextContents = function() { - var _a = _this.props, text = _a.text, children = _a.children, // eslint-disable-next-line deprecation/deprecation - _b = _a.secondaryText, // eslint-disable-next-line deprecation/deprecation - secondaryText = _b === void 0 ? _this.props.description : _b, _c = _a.onRenderText, onRenderText = _c === void 0 ? _this._onRenderText : _c, _d = _a.onRenderDescription, onRenderDescription = _d === void 0 ? _this._onRenderDescription : _d; - if (text || typeof children === 'string' || secondaryText) return _react.createElement("span", { - className: _this._classNames.textContainer - }, onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription)); - return [ - onRenderText(_this.props, _this._onRenderText), - onRenderDescription(_this.props, _this._onRenderDescription) - ]; - }; - _this._onRenderText = function() { - var text = _this.props.text; - var children = _this.props.children; - // For backwards compat, we should continue to take in the text content from children. - if (text === undefined && typeof children === 'string') text = children; - if (_this._hasText()) return _react.createElement("span", { - key: _this._labelId, - className: _this._classNames.label, - id: _this._labelId - }, text); - return null; - }; - _this._onRenderChildren = function() { - var children = _this.props.children; - // If children is just a string, either it or the text will be rendered via onRenderLabel - // If children is another component, it will be rendered after text - if (typeof children === 'string') return null; - return children; - }; - _this._onRenderDescription = function(props) { - // eslint-disable-next-line deprecation/deprecation - var _a = props.secondaryText, secondaryText = _a === void 0 ? _this.props.description : _a; - // ms-Button-description is only shown when the button type is compound. - // In other cases it will not be displayed. - return secondaryText ? _react.createElement("span", { - key: _this._descriptionId, - className: _this._classNames.description, - id: _this._descriptionId - }, secondaryText) : null; - }; - _this._onRenderAriaDescription = function() { - var ariaDescription = _this.props.ariaDescription; - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan, - // otherwise it will be assigned to descriptionSpan. - return ariaDescription ? _react.createElement("span", { - className: _this._classNames.screenReaderText, - id: _this._ariaDescriptionId - }, ariaDescription) : null; - }; - _this._onRenderMenuIcon = function(props) { - var menuIconProps = _this.props.menuIconProps; - return _react.createElement((0, _icon.FontIcon), (0, _tslib.__assign)({ - iconName: "ChevronDown" - }, menuIconProps, { - className: _this._classNames.menuIcon - })); - }; - _this._onRenderMenu = function(menuProps) { - var MenuType = _this.props.menuAs ? (0, _utilities.composeComponentAs)(_this.props.menuAs, (0, _contextualMenu.ContextualMenu)) : (0, _contextualMenu.ContextualMenu); - return _react.createElement(MenuType, (0, _tslib.__assign)({}, menuProps)); - }; - _this._onDismissMenu = function(ev) { - var menuProps = _this.props.menuProps; - if (menuProps && menuProps.onDismiss) menuProps.onDismiss(ev); - if (!ev || !ev.defaultPrevented) _this._dismissMenu(); - }; - _this._dismissMenu = function() { - _this._menuShouldFocusOnMount = undefined; - _this._menuShouldFocusOnContainer = undefined; - _this.setState({ - menuHidden: true - }); - }; - _this._openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { - if (shouldFocusOnMount === void 0) shouldFocusOnMount = true; - if (_this.props.menuProps) { - _this._menuShouldFocusOnContainer = shouldFocusOnContainer; - _this._menuShouldFocusOnMount = shouldFocusOnMount; - _this._renderedVisibleMenu = true; - _this.setState({ - menuHidden: false - }); - } - }; - _this._onToggleMenu = function(shouldFocusOnContainer) { - var shouldFocusOnMount = true; - if (_this.props.menuProps && _this.props.menuProps.shouldFocusOnMount === false) shouldFocusOnMount = false; - _this.state.menuHidden ? _this._openMenu(shouldFocusOnContainer, shouldFocusOnMount) : _this._dismissMenu(); - }; - _this._onSplitContainerFocusCapture = function(ev) { - var container = _this._splitButtonContainer.current; - // If the target is coming from the portal we do not need to set focus on the container. - if (!container || ev.target && (0, _utilities.portalContainsElement)(ev.target, container)) return; - // We should never be able to focus the individual buttons in a split button. Focus - // should always remain on the container. - container.focus(); - }; - _this._onSplitButtonPrimaryClick = function(ev) { - if (!_this.state.menuHidden) _this._dismissMenu(); - // toggle split buttons need two separate targets, even for touch - var singleTouchTarget = _this._processingTouch && !_this.props.toggle; - if (!singleTouchTarget && _this.props.onClick) _this.props.onClick(ev); - else if (singleTouchTarget) _this._onMenuClick(ev); - }; - _this._onKeyDown = function(ev) { - // explicity cancelling event so click won't fire after this - // eslint-disable-next-line deprecation/deprecation - if (_this.props.disabled && (ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).space)) { - ev.preventDefault(); - ev.stopPropagation(); - } else if (!_this.props.disabled) { - if (_this.props.menuProps) _this._onMenuKeyDown(ev); - else if (_this.props.onKeyDown !== undefined) _this.props.onKeyDown(ev); // not cancelling event because it's not disabled - } - }; - _this._onKeyUp = function(ev) { - if (!_this.props.disabled && _this.props.onKeyUp !== undefined) _this.props.onKeyUp(ev); // not cancelling event because it's not disabled - }; - _this._onKeyPress = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if (!_this.props.disabled && _this.props.onKeyPress !== undefined) // eslint-disable-next-line deprecation/deprecation - _this.props.onKeyPress(ev); // not cancelling event because it's not disabled - }; - _this._onMouseUp = function(ev) { - if (!_this.props.disabled && _this.props.onMouseUp !== undefined) _this.props.onMouseUp(ev); // not cancelling event because it's not disabled - }; - _this._onMouseDown = function(ev) { - if (!_this.props.disabled && _this.props.onMouseDown !== undefined) _this.props.onMouseDown(ev); // not cancelling event because it's not disabled - }; - _this._onClick = function(ev) { - if (!_this.props.disabled) { - if (_this.props.menuProps) _this._onMenuClick(ev); - else if (_this.props.onClick !== undefined) _this.props.onClick(ev); // not cancelling event because it's not disabled - } - }; - _this._onSplitButtonContainerKeyDown = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).space) { - if (_this._buttonElement.current) { - _this._buttonElement.current.click(); - ev.preventDefault(); - ev.stopPropagation(); - } - } else _this._onMenuKeyDown(ev); - }; - _this._onMenuKeyDown = function(ev) { - var _a; - if (_this.props.disabled) return; - if (_this.props.onKeyDown) _this.props.onKeyDown(ev); - // eslint-disable-next-line deprecation/deprecation - var isUp = ev.which === (0, _utilities.KeyCodes).up; - // eslint-disable-next-line deprecation/deprecation - var isDown = ev.which === (0, _utilities.KeyCodes).down; - if (!ev.defaultPrevented && _this._isValidMenuOpenKey(ev)) { - var onMenuClick = _this.props.onMenuClick; - if (onMenuClick) onMenuClick(ev, _this.props); - _this._onToggleMenu(false); - ev.preventDefault(); - ev.stopPropagation(); - } - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).space) // We manually set the focus visibility to true if opening via Enter or Space to account for the scenario where - // a user clicks on the button, closes the menu and then opens it via keyboard. In this scenario our default logic - // for setting focus visibility is not triggered since there is no keyboard navigation present beforehand. - (0, _utilities.setFocusVisibility)(true, ev.target, (_a = _this.context) === null || _a === void 0 ? void 0 : _a.registeredProviders); - if (!(ev.altKey || ev.metaKey) && (isUp || isDown)) // Suppose a menu, with shouldFocusOnMount: false, is open, and user wants to keyboard to the menu items - // We need to re-render the menu with shouldFocusOnMount as true. - { - if (!_this.state.menuHidden && _this.props.menuProps) { - var currentShouldFocusOnMount = _this._menuShouldFocusOnMount !== undefined ? _this._menuShouldFocusOnMount : _this.props.menuProps.shouldFocusOnMount; - if (!currentShouldFocusOnMount) { - ev.preventDefault(); - ev.stopPropagation(); - _this._menuShouldFocusOnMount = true; - _this.forceUpdate(); - } - } - } - }; - _this._onTouchStart = function() { - if (_this._isSplitButton && _this._splitButtonContainer.current && !('onpointerdown' in _this._splitButtonContainer.current)) _this._handleTouchAndPointerEvent(); - }; - _this._onMenuClick = function(ev) { - var _a = _this.props, onMenuClick = _a.onMenuClick, menuProps = _a.menuProps; - if (onMenuClick) onMenuClick(ev, _this.props); - // focus on the container by default when the menu is opened with a click event - // this differentiates from a keyboard interaction triggering the click event - var shouldFocusOnContainer = typeof (menuProps === null || menuProps === void 0 ? void 0 : menuProps.shouldFocusOnContainer) === 'boolean' ? menuProps.shouldFocusOnContainer : ev.nativeEvent.pointerType === 'mouse'; - if (!ev.defaultPrevented) { - _this._onToggleMenu(shouldFocusOnContainer); - ev.preventDefault(); - ev.stopPropagation(); - } + } + componentDidMount() { + this.mounted = true; + } + componentWillUnmount() { + this.mounted = false; + } + getInitialState(props) { + const { viewer } = props.explorer; + return { + showOptions: false, + viewer }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); - _this._events = new (0, _utilities.EventGroup)(_this); - (0, _utilities.warnConditionallyRequiredProps)(COMPONENT_NAME, props, [ - 'menuProps', - 'onClick' - ], 'split', _this.props.split); - (0, _utilities.warnDeprecations)(COMPONENT_NAME, props, { - rootProps: undefined, - description: 'secondaryText', - toggled: 'checked' + } + setOptions(newOptions) { + const { explorer: explorer2 } = this.props; + const renderer = Object.assign(Object.assign({}, explorer2.state.renderer), newOptions); + const { onSetupOptionsChanged } = explorer2.props; + if (onSetupOptionsChanged) { + const setup2 = explorer2.getSetup(); + setup2.renderer = renderer; + onSetupOptionsChanged(setup2); + } + explorer2.setState({ renderer }); + } + setBasicOptions(newOptions) { + this.setOptions({ + advanced: false, + basicOptions: Object.assign(Object.assign({}, this.props.basicOptions), newOptions) }); - _this._labelId = (0, _utilities.getId)(); - _this._descriptionId = (0, _utilities.getId)(); - _this._ariaDescriptionId = (0, _utilities.getId)(); - _this.state = { - menuHidden: true - }; - return _this; - } - Object.defineProperty(BaseButton.prototype, "_isSplitButton", { - get: function() { - return !!this.props.menuProps && !!this.props.onClick && this.props.split === true; - }, - enumerable: false, - configurable: true - }); - BaseButton.prototype.render = function() { - var _a; - var _b = this.props, ariaDescription = _b.ariaDescription, ariaLabel = _b.ariaLabel, ariaHidden = _b.ariaHidden, className = _b.className, disabled = _b.disabled, allowDisabledFocus = _b.allowDisabledFocus, primaryDisabled = _b.primaryDisabled, // eslint-disable-next-line deprecation/deprecation - _c = _b.secondaryText, // eslint-disable-next-line deprecation/deprecation - secondaryText = _c === void 0 ? this.props.description : _c, href = _b.href, iconProps = _b.iconProps, menuIconProps = _b.menuIconProps, styles = _b.styles, checked = _b.checked, variantClassName = _b.variantClassName, theme = _b.theme, toggle = _b.toggle, getClassNames = _b.getClassNames, role = _b.role; - var menuHidden = this.state.menuHidden; - // Button is disabled if the whole button (in case of splitButton is disabled) or if the primary action is disabled - var isPrimaryButtonDisabled = disabled || primaryDisabled; - this._classNames = getClassNames ? getClassNames(theme, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, checked, !menuHidden, !!this.props.menuProps, this.props.split, !!allowDisabledFocus) : (0, _baseButtonClassNames.getBaseButtonClassNames)(theme, styles, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, !!this.props.menuProps, checked, !menuHidden, this.props.split); - var _d = this, _ariaDescriptionId = _d._ariaDescriptionId, _labelId = _d._labelId, _descriptionId = _d._descriptionId; - // Anchor tag cannot be disabled hence in disabled state rendering - // anchor button as normal button - var renderAsAnchor = !isPrimaryButtonDisabled && !!href; - var tag = renderAsAnchor ? 'a' : 'button'; - var nativeProps = (0, _utilities.getNativeProps)(// eslint-disable-next-line deprecation/deprecation - (0, _utilities.assign)(renderAsAnchor ? {} : { - type: 'button' - }, this.props.rootProps, this.props), renderAsAnchor ? (0, _utilities.anchorProperties) : (0, _utilities.buttonProperties), [ - 'disabled' - ]); - // Check for ariaLabel passed in via Button props, and fall back to aria-label passed in via native props - var resolvedAriaLabel = ariaLabel || nativeProps['aria-label']; - // Check for ariaDescription, secondaryText or aria-describedby in the native props to determine source of - // aria-describedby. Otherwise default to undefined so property does not appear in output. - var ariaDescribedBy = undefined; - if (ariaDescription) ariaDescribedBy = _ariaDescriptionId; - else if (secondaryText && this.props.onRenderDescription !== (0, _utilities.nullRender)) // for buttons like CompoundButton with a valid onRenderDescription, we need to set an ariaDescribedBy - // for buttons that do not render anything (via nullRender), we should not set an ariaDescribedBy - ariaDescribedBy = _descriptionId; - else if (nativeProps['aria-describedby']) ariaDescribedBy = nativeProps['aria-describedby']; - // If an explicit aria-labelledby is given, use that and we're done. - // If any kind of description is given (which will end up as an aria-describedby attribute) - // and no ariaLabel is specified, set the labelledby element. - // Otherwise, the button is labeled implicitly by the descendent text on the button (if it exists). - var ariaLabelledBy = undefined; - if (nativeProps['aria-labelledby']) ariaLabelledBy = nativeProps['aria-labelledby']; - else if (ariaDescribedBy && !resolvedAriaLabel) ariaLabelledBy = this._hasText() ? _labelId : undefined; - var dataIsFocusable = this.props['data-is-focusable'] === false || disabled && !allowDisabledFocus || this._isSplitButton ? false : true; - var isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox'; - // if isCheckboxTypeRole, always return a checked value. - // Otherwise only return checked value if toggle is set to true. - // This is because role="checkbox" always needs to have an aria-checked value - // but our checked prop only sets aria-pressed if we mark the button as a toggle="true" - var checkedOrPressedValue = isCheckboxTypeRole ? !!checked : toggle === true ? !!checked : undefined; - var buttonProps = (0, _utilities.assign)(nativeProps, (_a = { - className: this._classNames.root, - // eslint-disable-next-line deprecation/deprecation - ref: this._mergedRef(this.props.elementRef, this._buttonElement), - disabled: isPrimaryButtonDisabled && !allowDisabledFocus, - onKeyDown: this._onKeyDown, - onKeyPress: this._onKeyPress, - onKeyUp: this._onKeyUp, - onMouseDown: this._onMouseDown, - onMouseUp: this._onMouseUp, - onClick: this._onClick, - 'aria-label': resolvedAriaLabel, - 'aria-labelledby': ariaLabelledBy, - 'aria-describedby': ariaDescribedBy, - 'aria-disabled': isPrimaryButtonDisabled, - 'data-is-focusable': dataIsFocusable - }, // aria-pressed attribute should only be present for toggle buttons - // aria-checked attribute should only be present for toggle buttons with checkbox type role - _a[isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed'] = checkedOrPressedValue, _a)); - if (ariaHidden) buttonProps['aria-hidden'] = true; - if (this._isSplitButton) return this._onRenderSplitButtonContent(tag, buttonProps); - else if (this.props.menuProps) { - var _e = this.props.menuProps.id, id = _e === void 0 ? "".concat(this._labelId, "-menu") : _e; - (0, _utilities.assign)(buttonProps, { - 'aria-expanded': !menuHidden, - 'aria-controls': !menuHidden ? id : null, - 'aria-haspopup': true - }); + } + setAdvancedOptions(newOptions) { + this.setOptions({ + advanced: true, + advancedOptions: Object.assign(Object.assign({}, this.props.advancedOptions), newOptions) + }); + } + render() { + var _a2, _b2; + const { props, state } = this; + const iconButtonStyles = { + menuIcon: { + display: "none" + } + }; + if (!((_b2 = (_a2 = state.viewer) === null || _a2 === void 0 ? void 0 : _a2.presenter) === null || _b2 === void 0 ? void 0 : _b2.morphchartsref)) { + return base$1.react.createElement(IconButton$1, { styles: iconButtonStyles, className: "sanddance-advanced-renderer", disabled: true, iconName: "HourGlass", onClick: void 0, themePalette: props.themePalette, title: strings$1.labelRenderer }); + } else { + const { morphchartsref } = state.viewer.presenter; + const choiceButtonStyle = { + border: "none" + }; + const { advanced, advancedOptions, basicOptions } = props; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(IconButton$1, { iconName: "PicturePosition", title: strings$1.buttonCameraHome, onClick: props.onHomeClick, styles: iconButtonStyles, themePalette: props.themePalette }), + base$1.react.createElement(IconButton$1, { styles: iconButtonStyles, className: "sanddance-advanced-renderer", iconName: advanced ? "DiamondSolid" : "Diamond", disabled: !morphchartsref.supportedRenders.advanced, onClick: void 0, themePalette: props.themePalette, title: morphchartsref.supportedRenders.advanced ? strings$1.labelRenderer : strings$1.labelRendererAdvancedDisabled, menuProps: { + items: [ + { + key: "basic", + text: strings$1.labelRendererBasic, + iconProps: { + iconName: advanced ? null : "RadioBullet" + }, + onClick: () => advanced && this.setOptions({ advanced: false }) + //disabled: !advanced, + }, + { + key: "advanced", + text: strings$1.labelRendererAdvanced, + iconProps: { + iconName: advanced ? "RadioBullet" : null + }, + onClick: () => !advanced && this.setOptions({ advanced: true }) + //disabled: advanced, + }, + { + key: "options", + text: strings$1.labelRendererOptions, + onClick: (e) => this.setState({ showOptions: true }) + } + ] + } }), + base$1.react.createElement( + Dialog$1, + { hidden: !state.showOptions, dialogContentProps: { + className: "sanddance-renderer-dialog", + title: strings$1.labelRendererOptionsDialogTitle + }, onDismiss: () => this.setState({ showOptions: false }) }, + base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { iconName: advanced ? "RadioBtnOff" : "RadioBtnOn", onClick: () => this.setOptions({ advanced: false }), text: strings$1.labelRendererBasic, themePalette: props.themePalette, rootStyle: choiceButtonStyle }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: basicOptions.antialias, label: strings$1.labelRendererOptionsAntialias, onChange: (e, antialias) => this.setBasicOptions({ antialias }) }) + ) + ) + ), + base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { iconName: advanced ? "RadioBtnOn" : "RadioBtnOff", onClick: () => this.setOptions({ advanced: true }), text: strings$1.labelRendererAdvanced, themePalette: props.themePalette, rootStyle: choiceButtonStyle }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isShadowEnabled, label: strings$1.labelRendererOptionsShadow, onChange: (e, isShadowEnabled) => this.setAdvancedOptions({ isShadowEnabled }) }) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isSsaoEnabled, label: strings$1.labelRendererOptionsSsao, onChange: (e, isSsaoEnabled) => this.setAdvancedOptions({ isSsaoEnabled }) }) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isBloomEnabled, label: strings$1.labelRendererOptionsBloom, onChange: (e, isBloomEnabled) => this.setAdvancedOptions({ isBloomEnabled }) }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Slider, { value: advancedOptions.bloomIntensity, min: 0.1, max: 5, step: 0.01, label: strings$1.labelRendererOptionsBloomIntensity, onChange: (bloomIntensity) => this.setAdvancedOptions({ bloomIntensity, isBloomEnabled: true }) }) + ) + ) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isDofEnabled, label: strings$1.labelRendererOptionsDof, onChange: (e, isDofEnabled) => this.setAdvancedOptions({ isDofEnabled }) }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Slider, { value: advancedOptions.dofFocusRange, min: 0, max: 2, step: 0.01, label: strings$1.labelRendererOptionsDofRange, onChange: (dofFocusRange) => this.setAdvancedOptions({ dofFocusRange, isDofEnabled: true }) }) + ) + ) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isFxaaEnabled, label: strings$1.labelRendererOptionsFxaa, onChange: (e, isFxaaEnabled) => this.setAdvancedOptions({ isFxaaEnabled }) }) + ) + ) + ) + ) + ); } - return this._onRenderContent(tag, buttonProps); - }; - BaseButton.prototype.componentDidMount = function() { - // For split buttons, touching anywhere in the button should drop the dropdown, which should contain the - // primary action. This gives more hit target space for touch environments. We're setting the onpointerdown here, - // because React does not support Pointer events yet. - if (this._isSplitButton && this._splitButtonContainer.current) { - if ('onpointerdown' in this._splitButtonContainer.current) this._events.on(this._splitButtonContainer.current, 'pointerdown', this._onPointerDown, true); - if ('onpointerup' in this._splitButtonContainer.current && this.props.onPointerUp) this._events.on(this._splitButtonContainer.current, 'pointerup', this.props.onPointerUp, true); + } + } + return new __Renderer(_props); + } + const Renderer$1 = _Renderer; + function _Explorer(_props) { + class __Explorer extends base$1.react.Component { + constructor(props) { + super(props); + this.dialogFocusHandler = {}; + this.state = initialExplorerState(props); + this.imageHolder = { img: null, backgroundImageColumnBounds: [], showBackgroundImage: false }; + this.snapshotThumbWidth = snapshotThumbWidth; + this.discardColorContextUpdates = true; + this.updateViewerOptions(Object.assign(Object.assign({}, clone(Viewer$1.defaultViewerOptions)), props.viewerOptions)); + } + finalize() { + if (this.viewer) + this.viewer.finalize(); + } + updateViewerOptions(viewerOptions) { + this.viewerOptions = Object.assign(Object.assign({}, deepMerge(defaultViewerOptions, { + tooltipOptions: { + prepareDataItem: ((item) => { + const ret = {}; + for (const columnName in item) { + if (this.state.tooltipExclusions.indexOf(columnName) < 0) { + ret[columnName] = item[columnName]; + } + } + return ret; + }) + } + }, this.viewerOptions, viewerOptions)), { onColorContextChange: () => this.manageColorToolbar(), onDataFilter: (filter2, filteredData) => { + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + selectedItemIndex[DataScopeId.FilteredData] = 0; + this.changeInsight({ filter: filter2 }, { label: this.historicFilterChange, omit: !this.historicFilterChange }); + this.historicFilterChange = null; + this.setState({ filteredData, selectedItemIndex }); + if (this.state.sideTabId === SideTabId.Data && this.state.dataScopeId === DataScopeId.FilteredData) { + requestAnimationFrame(() => filteredData && this.silentActivation(filteredData[0])); + } + viewerOptions && viewerOptions.onDataFilter && viewerOptions.onDataFilter(filter2, filteredData); + }, onSelectionChanged: (newSearch, index2, selectedData) => { + if (this.ignoreSelectionChange) + return; + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + selectedItemIndex[DataScopeId.SelectedData] = index2 || 0; + let { search } = this.state; + const { sideTabId } = this.state; + if (newSearch) { + search = createInputSearch(newSearch); + } + this.setState({ search, selectedItemIndex, sideTabId }); + viewerOptions && viewerOptions.onSelectionChanged && viewerOptions.onSelectionChanged(newSearch, index2, selectedData); + }, onAxisClick: (e, search) => { + this.toggleableSearch(e, search); + viewerOptions && viewerOptions.onAxisClick && viewerOptions.onAxisClick(e, search); + }, onLegendHeaderClick: (e) => { + const pos = getPosition(e); + const specRole = this.state.specCapabilities && this.state.specCapabilities.roles.filter((r) => r.role === "color")[0]; + const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { collapseLabel: true, container: this.div, selectedColumnName: this.state.columns["color"], onDismiss: () => { + this.setState({ positionedColumnMapProps: null }); + }, specRole, left: pos.left - this.div.clientLeft, top: pos.top - this.div.clientTop }); + this.setState({ positionedColumnMapProps }); + }, onLegendRowClick: (e, legendRow) => { + this.toggleableSearch(e, legendRow.search); + viewerOptions && viewerOptions.onLegendRowClick && viewerOptions.onLegendRowClick(e, legendRow); + }, onError: (errors) => { + this.setState({ errors }); + viewerOptions && viewerOptions.onError && viewerOptions.onError(errors); + }, onBeforeCreateLayers: (stage, specCapabilities) => { + attachSpecRoleToAxisTitle(stage, specCapabilities); + }, getTextColor: (o) => { + if (o.specRole) { + return colorFromString(this.viewerOptions.colors.clickableText); + } else if (o.metaData && o.metaData.search) { + return colorFromString(this.viewerOptions.colors.searchText); + } else { + return o.color; + } + }, getTextHighlightColor: (o) => { + if (o.specRole) { + return colorFromString(this.viewerOptions.colors.clickableTextHighlight); + } else if (o.metaData && o.metaData.search) { + return colorFromString(this.viewerOptions.colors.searchTextHighlight); + } else { + return [0, 0, 0, 0]; + } + }, onTextClick: (e, text2) => { + if (e && text2) { + const pos = getPosition(e); + const rect2 = this.viewer.element.getBoundingClientRect(); + pos.left += rect2.left; + pos.top += rect2.top; + const { specRole } = text2; + if (pos && specRole) { + const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { collapseLabel: true, container: this.div, selectedColumnName: this.state.columns[specRole.role], onDismiss: () => { + this.setState({ positionedColumnMapProps: null }); + }, specRole, left: pos.left, top: pos.top }); + this.setState({ positionedColumnMapProps }); + } else { + this.setState({ positionedColumnMapProps: null }); + } + } + }, onNewViewStateTarget: () => this.newViewStateTarget }); + if (this.viewer && this.viewer.presenter) { + const newPresenterStyle = getPresenterStyle(this.viewerOptions); + const mergePrenterStyle = Object.assign(Object.assign({}, this.viewer.presenter.style), newPresenterStyle); + this.viewer.presenter.style = mergePrenterStyle; + this.viewer.options = deepMerge(this.viewer.options, this.props.viewerOptions, this.viewerOptions); } - }; - BaseButton.prototype.componentDidUpdate = function(prevProps, prevState) { - // If Button's menu was closed, run onAfterMenuDismiss. - if (this.props.onAfterMenuDismiss && !prevState.menuHidden && this.state.menuHidden) this.props.onAfterMenuDismiss(); - }; - BaseButton.prototype.componentWillUnmount = function() { - this._async.dispose(); - this._events.dispose(); - }; - BaseButton.prototype.focus = function() { - var _a, _b; - if (this._isSplitButton && this._splitButtonContainer.current) { - (0, _utilities.setFocusVisibility)(true, undefined, (_a = this.context) === null || _a === void 0 ? void 0 : _a.registeredProviders); - this._splitButtonContainer.current.focus(); - } else if (this._buttonElement.current) { - (0, _utilities.setFocusVisibility)(true, undefined, (_b = this.context) === null || _b === void 0 ? void 0 : _b.registeredProviders); - this._buttonElement.current.focus(); + } + signal(signalName, signalValue, newViewStateTarget) { + switch (signalName) { + case SignalNames.ColorBinCount: + case SignalNames.ColorReverse: + case SignalNames.MarkOpacity: + this.discardColorContextUpdates = false; + break; } - }; - BaseButton.prototype.dismissMenu = function() { - this._dismissMenu(); - }; - BaseButton.prototype.openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { - this._openMenu(shouldFocusOnContainer, shouldFocusOnMount); - }; - BaseButton.prototype._onRenderContent = function(tag, buttonProps) { - var _this = this; - var props = this.props; - var Tag = tag; - var menuIconProps = props.menuIconProps, menuProps = props.menuProps, _a = props.onRenderIcon, onRenderIcon = _a === void 0 ? this._onRenderIcon : _a, _b = props.onRenderAriaDescription, onRenderAriaDescription = _b === void 0 ? this._onRenderAriaDescription : _b, _c = props.onRenderChildren, onRenderChildren = _c === void 0 ? this._onRenderChildren : _c, // eslint-disable-next-line deprecation/deprecation - _d = props.onRenderMenu, // eslint-disable-next-line deprecation/deprecation - onRenderMenu = _d === void 0 ? this._onRenderMenu : _d, _e = props.onRenderMenuIcon, onRenderMenuIcon = _e === void 0 ? this._onRenderMenuIcon : _e, disabled = props.disabled; - var keytipProps = props.keytipProps; - if (keytipProps && menuProps) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - var Button = function(keytipAttributes) { - return _react.createElement(Tag, (0, _tslib.__assign)({}, buttonProps, keytipAttributes), _react.createElement("span", { - className: _this._classNames.flexContainer, - "data-automationid": "splitbuttonprimary" - }, onRenderIcon(props, _this._onRenderIcon), _this._onRenderTextContents(), onRenderAriaDescription(props, _this._onRenderAriaDescription), onRenderChildren(props, _this._onRenderChildren), !_this._isSplitButton && (menuProps || menuIconProps || _this.props.onRenderMenuIcon) && onRenderMenuIcon(_this.props, _this._onRenderMenuIcon), menuProps && !menuProps.doNotLayer && _this._shouldRenderMenu() && onRenderMenu(_this._getMenuProps(menuProps), _this._onRenderMenu))); - }; - var Content = keytipProps ? // If we're making a split button, we won't put the keytip here - _react.createElement((0, _keytipData.KeytipData), { - keytipProps: !this._isSplitButton ? keytipProps : undefined, - ariaDescribedBy: buttonProps['aria-describedby'], - disabled: disabled - }, function(keytipAttributes) { - return Button(keytipAttributes); - }) : Button(); - if (menuProps && menuProps.doNotLayer) return _react.createElement(_react.Fragment, null, Content, this._shouldRenderMenu() && onRenderMenu(this._getMenuProps(menuProps), this._onRenderMenu)); - return _react.createElement(_react.Fragment, null, Content, _react.createElement((0, _utilities.FocusRects), null)); - }; - /** - * Method to help determine if the menu's component tree should - * be rendered. It takes into account whether the menu is expanded, - * whether it is a persisted menu and whether it has been shown to the user. - */ BaseButton.prototype._shouldRenderMenu = function() { - var menuHidden = this.state.menuHidden; - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, persistMenu = _a.persistMenu, renderPersistedMenuHiddenOnMount = _a.renderPersistedMenuHiddenOnMount; - if (!menuHidden) // Always should render a menu when it is expanded - return true; - else if (persistMenu && (this._renderedVisibleMenu || renderPersistedMenuHiddenOnMount)) // _renderedVisibleMenu ensures that the first rendering of - // the menu happens on-screen, as edge's scrollbar calculations are off if done while hidden. - return true; - return false; - }; - BaseButton.prototype._hasText = function() { - // _onRenderTextContents and _onRenderText do not perform the same checks. Below is parity with what _onRenderText - // used to have before the refactor that introduced this function. _onRenderTextContents does not require props. - // text to be undefined in order for props.children to be used as a fallback. - // Purely a code maintainability/reuse issue, but logged as Issue #4979. - return this.props.text !== null && (this.props.text !== undefined || typeof this.props.children === 'string'); - }; - BaseButton.prototype._getMenuProps = function(menuProps) { - var persistMenu = this.props.persistMenu; - var menuHidden = this.state.menuHidden; - // the accessible menu label (accessible name) has a relationship to the button. - // If the menu props do not specify an explicit value for aria-label or aria-labelledBy, - // AND the button has text, we'll set the menu aria-labelledBy to the text element id. - if (!menuProps.ariaLabel && !menuProps.labelElementId && this._hasText()) menuProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, menuProps), { - labelElementId: this._labelId - }); - return (0, _tslib.__assign)((0, _tslib.__assign)({ - id: this._labelId + '-menu', - directionalHint: (0, _directionalHint.DirectionalHint).bottomLeftEdge - }, menuProps), { - shouldFocusOnContainer: this._menuShouldFocusOnContainer, - shouldFocusOnMount: this._menuShouldFocusOnMount, - hidden: persistMenu ? menuHidden : undefined, - className: (0, _utilities.css)('ms-BaseButton-menuhost', menuProps.className), - target: this._isSplitButton ? this._splitButtonContainer.current : this._buttonElement.current, - onDismiss: this._onDismissMenu + this.newViewStateTarget = newViewStateTarget; + this.viewer.vegaViewGl.signal(signalName, signalValue); + this.viewer.vegaViewGl.runAsync().then(() => { + if (this.state.signalValues) { + this.state.signalValues[signalName] = signalValue; + } + this.discardColorContextUpdates = true; + this.newViewStateTarget = void 0; + this.props.onSignalChanged && this.props.onSignalChanged(signalName, signalValue); }); - }; - BaseButton.prototype._onRenderSplitButtonContent = function(tag, buttonProps) { - var _this = this; - var _a = this.props, _b = _a.styles, styles = _b === void 0 ? {} : _b, disabled = _a.disabled, allowDisabledFocus = _a.allowDisabledFocus, checked = _a.checked, getSplitButtonClassNames = _a.getSplitButtonClassNames, primaryDisabled = _a.primaryDisabled, menuProps = _a.menuProps, toggle = _a.toggle, role = _a.role, primaryActionButtonProps = _a.primaryActionButtonProps; - var keytipProps = this.props.keytipProps; - var menuHidden = this.state.menuHidden; - var classNames = getSplitButtonClassNames ? getSplitButtonClassNames(!!disabled, !menuHidden, !!checked, !!allowDisabledFocus) : styles && (0, _splitButtonClassNames.getSplitButtonClassNames)(styles, !!disabled, !menuHidden, !!checked, !!primaryDisabled); - (0, _utilities.assign)(buttonProps, { - onClick: undefined, - onPointerDown: undefined, - onPointerUp: undefined, - tabIndex: -1, - 'data-is-focusable': false + } + manageColorToolbar() { + const canRemap = this.viewer.colorContexts && this.viewer.colorContexts.length > 1; + applyColorButtons(this.viewer.presenter, !!this.state.columns.color, { + themePalette: themePalettes[this.props.theme || ""], + canRemap, + isRemap: canRemap && this.viewer.currentColorContext > 0, + colorMapHandler: (remap) => { + this.viewer.currentColorContext = ~~remap; + this.viewer.renderSameLayout(); + this.manageColorToolbar(); + } }); - if (keytipProps && menuProps) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - var containerProps = (0, _utilities.getNativeProps)(buttonProps, [], [ - 'disabled' - ]); - // Add additional props to apply on primary action button - if (primaryActionButtonProps) (0, _utilities.assign)(buttonProps, primaryActionButtonProps); - var SplitButton = function(keytipAttributes) { - return _react.createElement("div", (0, _tslib.__assign)({}, containerProps, { - "data-ktp-target": keytipAttributes ? keytipAttributes['data-ktp-target'] : undefined, - role: role ? role : 'button', - "aria-disabled": disabled, - "aria-haspopup": true, - "aria-expanded": !menuHidden, - "aria-pressed": toggle ? !!checked : undefined, - "aria-describedby": (0, _utilities.mergeAriaAttributeValues)(buttonProps['aria-describedby'], keytipAttributes ? keytipAttributes['aria-describedby'] : undefined), - className: classNames && classNames.splitButtonContainer, - onKeyDown: _this._onSplitButtonContainerKeyDown, - onTouchStart: _this._onTouchStart, - ref: _this._splitButtonContainer, - "data-is-focusable": true, - onClick: !disabled && !primaryDisabled ? _this._onSplitButtonPrimaryClick : undefined, - tabIndex: !disabled && !primaryDisabled || allowDisabledFocus ? 0 : undefined, - "aria-roledescription": buttonProps['aria-roledescription'], - onFocusCapture: _this._onSplitContainerFocusCapture - }), _react.createElement("span", { - style: { - display: 'flex', - width: '100%' - } - }, _this._onRenderContent(tag, buttonProps), _this._onRenderSplitButtonMenuButton(classNames, keytipAttributes), _this._onRenderSplitButtonDivider(classNames))); + } + getInsight() { + return this.viewer.getInsight(); + } + getSetup() { + return { + camera: this.state.holdCamera ? "hold" : this.state.camera, + renderer: this.state.renderer, + transition: getTransition(this.state), + transitionDurations: this.state.transitionDurations }; - return keytipProps ? _react.createElement((0, _keytipData.KeytipData), { - keytipProps: keytipProps, - disabled: disabled - }, function(keytipAttributes) { - return SplitButton(keytipAttributes); - }) : SplitButton(); - }; - BaseButton.prototype._onRenderSplitButtonDivider = function(classNames) { - if (classNames && classNames.divider) { - var onClick = function(ev) { - ev.stopPropagation(); - }; - return _react.createElement("span", { - className: classNames.divider, - "aria-hidden": true, - onClick: onClick - }); + } + setSetup(setup2, newState) { + newState.camera = void 0; + if (setup2) { + this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(setup2); + const { camera, renderer, transition, transitionDurations } = setup2; + newState.renderer = renderer; + newState.transitionType = transition.type; + if (camera === "hold") { + newState.holdCamera = true; + } else { + newState.holdCamera = false; + newState.camera = camera; + } + if (transition.type === "column") { + newState.transitionColumn = transition.column; + } else if (transition.type === "position") { + newState.transitionDimension = transition.dimension; + } + if (transitionDurations) { + newState.transitionDurations = transitionDurations; + syncTansitionDurations(this.viewer, transitionDurations); + } } - return null; - }; - BaseButton.prototype._onRenderSplitButtonMenuButton = function(classNames, keytipAttributes) { - var _a = this.props, allowDisabledFocus = _a.allowDisabledFocus, checked = _a.checked, disabled = _a.disabled, splitButtonMenuProps = _a.splitButtonMenuProps, splitButtonAriaLabel = _a.splitButtonAriaLabel, primaryDisabled = _a.primaryDisabled; - var menuHidden = this.state.menuHidden; - var menuIconProps = this.props.menuIconProps; - if (menuIconProps === undefined) menuIconProps = { - iconName: 'ChevronDown' - }; - var splitButtonProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonMenuProps), { - styles: classNames, - checked: checked, - disabled: disabled, - allowDisabledFocus: allowDisabledFocus, - onClick: this._onMenuClick, - menuProps: undefined, - iconProps: (0, _tslib.__assign)((0, _tslib.__assign)({}, menuIconProps), { - className: this._classNames.menuIcon - }), - ariaLabel: splitButtonAriaLabel, - 'aria-haspopup': true, - 'aria-expanded': !menuHidden, - 'data-is-focusable': false - }); - // Add data-ktp-execute-target to the split button if the keytip is defined - return _react.createElement(BaseButton, (0, _tslib.__assign)({}, splitButtonProps, { - "data-ktp-execute-target": keytipAttributes ? keytipAttributes['data-ktp-execute-target'] : keytipAttributes, - onMouseDown: this._onMouseDown, - tabIndex: primaryDisabled && !allowDisabledFocus ? 0 : -1 - })); - }; - BaseButton.prototype._onPointerDown = function(ev) { - var onPointerDown = this.props.onPointerDown; - if (onPointerDown) onPointerDown(ev); - if (ev.pointerType === 'touch') { - this._handleTouchAndPointerEvent(); - ev.preventDefault(); - ev.stopImmediatePropagation(); + } + setInsight(historyAction, newState = {}, partialInsight = this.viewer.getInsight(), rebaseFilter, setup2) { + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + resetSelectedItemIndex(selectedItemIndex); + const historicInsight = Object.assign({ chart: null, scheme: null, columns: null, filter: null, rebaseFilter }, partialInsight); + const state = Object.assign({ filteredData: null, selectedItemIndex, search: createInputSearch(historicInsight.filter) }, newState); + const changeInsight = () => { + this.getColorContext = null; + this.setSetup(setup2, historicInsight); + this.changeInsight(historicInsight, historyAction, state, setup2); + }; + const currentFilter = this.viewer.getInsight().filter; + if (rebaseFilter && currentFilter && historicInsight.filter) { + if (startsWith(historicInsight.filter, currentFilter)) { + changeInsight(); + } else { + const { transitionDurations } = this.state; + const renderTime = transitionDurations.position + transitionDurations.stagger; + const allowAsyncRenderTime = renderTime + this.viewerOptions.filterRenderingTimerPadding; + this.viewer.reset().then(() => new Promise((resolve2, reject) => { + setTimeout(resolve2, allowAsyncRenderTime); + })).then(changeInsight); + } + } else { + changeInsight(); } - }; - BaseButton.prototype._handleTouchAndPointerEvent = function() { - var _this = this; - // If we already have an existing timeout from a previous touch and pointer event - // cancel that timeout so we can set a new one. - if (this._lastTouchTimeoutId !== undefined) { - this._async.clearTimeout(this._lastTouchTimeoutId); - this._lastTouchTimeoutId = undefined; + } + handleReviveSnapshot(snapshot, selectedSnapshotIndex) { + let handled = false; + if (this.props.onSnapshotClick) { + this.setState({ selectedSnapshotIndex }); + handled = this.props.onSnapshotClick(snapshot, selectedSnapshotIndex); } - this._processingTouch = true; - this._lastTouchTimeoutId = this._async.setTimeout(function() { - _this._processingTouch = false; - _this._lastTouchTimeoutId = undefined; - // Touch and pointer events don't focus the button naturally, - // so adding an imperative focus call to guarantee this behavior. - // Only focus the button if a splitbutton menu is not open - if (_this.state.menuHidden) _this.focus(); - }, TouchIdleDelay); - }; - /** - * Returns if the user hits a valid keyboard key to open the menu - * @param ev - the keyboard event - * @returns True if user clicks on custom trigger key if enabled or alt + down arrow if not. False otherwise. - */ BaseButton.prototype._isValidMenuOpenKey = function(ev) { - if (this.props.menuTriggerKeyCode) // eslint-disable-next-line deprecation/deprecation - return ev.which === this.props.menuTriggerKeyCode; - else if (this.props.menuProps) // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).down && (ev.altKey || ev.metaKey); - // Note: When enter is pressed, we will let the event continue to propagate - // to trigger the onClick event on the button - return false; - }; - BaseButton.defaultProps = { - baseClassName: 'ms-Button', - styles: {}, - split: false - }; - // needed to access registeredProviders when manually setting focus visibility - BaseButton.contextType = (0, _utilities.FocusRectsContext); - return BaseButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Icon":"hiMUP","../../common/DirectionalHint":"avdAc","../../ContextualMenu":"iuj1y","./BaseButton.classNames":"2b9yc","./SplitButton/SplitButton.classNames":"8sJhS","../../KeytipData":"9cfzj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9gizs":[function(require,module,exports,__globalThis) { -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "__extends", ()=>__extends); -parcelHelpers.export(exports, "__assign", ()=>__assign); -parcelHelpers.export(exports, "__rest", ()=>__rest); -parcelHelpers.export(exports, "__decorate", ()=>__decorate); -parcelHelpers.export(exports, "__param", ()=>__param); -parcelHelpers.export(exports, "__esDecorate", ()=>__esDecorate); -parcelHelpers.export(exports, "__runInitializers", ()=>__runInitializers); -parcelHelpers.export(exports, "__propKey", ()=>__propKey); -parcelHelpers.export(exports, "__setFunctionName", ()=>__setFunctionName); -parcelHelpers.export(exports, "__metadata", ()=>__metadata); -parcelHelpers.export(exports, "__awaiter", ()=>__awaiter); -parcelHelpers.export(exports, "__generator", ()=>__generator); -parcelHelpers.export(exports, "__createBinding", ()=>__createBinding); -parcelHelpers.export(exports, "__exportStar", ()=>__exportStar); -parcelHelpers.export(exports, "__values", ()=>__values); -parcelHelpers.export(exports, "__read", ()=>__read); -/** @deprecated */ parcelHelpers.export(exports, "__spread", ()=>__spread); -/** @deprecated */ parcelHelpers.export(exports, "__spreadArrays", ()=>__spreadArrays); -parcelHelpers.export(exports, "__spreadArray", ()=>__spreadArray); -parcelHelpers.export(exports, "__await", ()=>__await); -parcelHelpers.export(exports, "__asyncGenerator", ()=>__asyncGenerator); -parcelHelpers.export(exports, "__asyncDelegator", ()=>__asyncDelegator); -parcelHelpers.export(exports, "__asyncValues", ()=>__asyncValues); -parcelHelpers.export(exports, "__makeTemplateObject", ()=>__makeTemplateObject); -parcelHelpers.export(exports, "__importStar", ()=>__importStar); -parcelHelpers.export(exports, "__importDefault", ()=>__importDefault); -parcelHelpers.export(exports, "__classPrivateFieldGet", ()=>__classPrivateFieldGet); -parcelHelpers.export(exports, "__classPrivateFieldSet", ()=>__classPrivateFieldSet); -parcelHelpers.export(exports, "__classPrivateFieldIn", ()=>__classPrivateFieldIn); -parcelHelpers.export(exports, "__addDisposableResource", ()=>__addDisposableResource); -parcelHelpers.export(exports, "__disposeResources", ()=>__disposeResources); -parcelHelpers.export(exports, "__rewriteRelativeImportExtension", ()=>__rewriteRelativeImportExtension); -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || ({ - __proto__: [] - }) instanceof Array && function(d, b) { - d.__proto__ = b; - } || function(d, b) { - for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; - }; - return extendStatics(d, b); -}; -function __extends(d, b) { - if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for(var s, i = 1, n = arguments.length; i < n; i++){ - s = arguments[i]; - for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + if (!handled) { + this.reviveSnapshot(selectedSnapshotIndex); } - return t; - }; - return __assign.apply(this, arguments); -}; -function __rest(s, e) { - var t = {}; - for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") { - for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; -} -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} -function __param(paramIndex, decorator) { - return function(target, key) { - decorator(target, key, paramIndex); - }; -} -function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { - if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); - return f; - } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for(var i = decorators.length - 1; i >= 0; i--){ - var context = {}; - for(var p in contextIn)context[p] = p === "access" ? {} : contextIn[p]; - for(var p in contextIn.access)context.access[p] = contextIn.access[p]; - context.addInitializer = function(f) { - if (done) throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f || null)); - }; - var result = (0, decorators[i])(kind === "accessor" ? { - get: descriptor.get, - set: descriptor.set - } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -} -function __runInitializers(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for(var i = 0; i < initializers.length; i++)value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - return useValue ? value : void 0; -} -function __propKey(x) { - return typeof x === "symbol" ? x : "".concat(x); -} -function __setFunctionName(f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { - configurable: true, - value: prefix ? "".concat(prefix, " ", name) : name - }); -} -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); + } + reviveSnapshot(snapshotOrIndex) { + if (typeof snapshotOrIndex === "number") { + const selectedSnapshotIndex = snapshotOrIndex; + const snapshot = this.state.snapshots[selectedSnapshotIndex]; + const newState = { note: snapshot.description, selectedSnapshotIndex }; + if (!this.state.sidebarClosed) { + newState.sideTabId = SideTabId.Snapshots; + this.scrollSnapshotIntoView(selectedSnapshotIndex); + } + if (snapshot.insight) { + const { backgroundImage } = snapshot.insight; + this.imageHolder.showBackgroundImage = !!backgroundImage; + if (backgroundImage) { + this.imageHolder.img = { + src: backgroundImage.url, + height: backgroundImage.size.height, + width: backgroundImage.size.width + }; + } + } + this.setInsight({ label: strings$1.labelHistoryReviveSnapshot }, newState, snapshot.insight, true, snapshot.setup); + } else { + const snapshot = snapshotOrIndex; + if (snapshot.insight) { + this.setInsight({ label: strings$1.labelHistoryReviveSnapshot }, { note: snapshot.description, selectedSnapshotIndex: -1 }, snapshot.insight, true, snapshot.setup); + } else { + this.setState({ note: snapshot.description, selectedSnapshotIndex: -1 }); + } + } + } + load(data2, getPartialInsight, optionsOrPrefs) { + this.setState({ historyIndex: -1, historyItems: [] }); + this.changeInsight({ columns: null }, { label: null, omit: true }, { note: null }); + return new Promise((resolve2, reject) => { + const loadFinal = (dataContent) => { + let partialInsight; + this.prefs = optionsOrPrefs && optionsOrPrefs.chartPrefs || optionsOrPrefs || {}; + this.imageHolder.backgroundImageColumnBounds = getBackgroundImageColumnBounds(dataContent.columns); + if (getPartialInsight) { + partialInsight = getPartialInsight(dataContent.columns); + initPrefs(this.prefs, partialInsight); + } + if (!partialInsight) { + const r = new RecommenderSummary(dataContent.columns, dataContent.data); + partialInsight = r.recommend(); + } + partialInsight = Object.assign({ facetStyle: "wrap", filter: null, totalStyle: null, transform: null }, partialInsight); + if (partialInsight.chart === "barchart") { + partialInsight.chart = "barchartV"; + } + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + const sideTabId = SideTabId.ChartType; + resetSelectedItemIndex(selectedItemIndex); + const newState = Object.assign({ + camera: void 0, + columns: {}, + dataFile, + dataContent, + snapshots: dataContent.snapshots || this.state.snapshots, + autoCompleteDistinctValues: {}, + filteredData: null, + tooltipExclusions: optionsOrPrefs && optionsOrPrefs.tooltipExclusions || [], + selectedItemIndex, + sideTabId + }, partialInsight); + this.getColorContext = null; + ensureColumnsExist(newState.columns, dataContent.columns, newState.transform); + const errors = ensureColumnsPopulated(partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.chart, partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.totalStyle, newState.columns, dataContent.columns); + newState.errors = errors; + newState.transitionColumn = dataContent.columns[0]; + const setup2 = optionsOrPrefs && optionsOrPrefs.setup; + this.setSetup(setup2, newState); + this.changeInsight(partialInsight, { label: strings$1.labelHistoryInit, insert: true }, newState, optionsOrPrefs && optionsOrPrefs.setup); + this.activateDataBrowserItem(sideTabId, this.state.dataScopeId); + resolve2(); + }; + let dataFile; + if (Array.isArray(data2)) { + return loadDataArray(data2, "json", optionsOrPrefs && optionsOrPrefs.columnTypes).then((result) => { + dataFile = { + type: "json" + }; + loadFinal(result); + }).catch(reject); + } else { + dataFile = data2; + return loadDataFile(dataFile, optionsOrPrefs && optionsOrPrefs.columnTypes).then(loadFinal).catch(reject); + } }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); + } + changeChartType(chart) { + const partialInsight = Object.assign({}, copyPrefToNewState(this.prefs, chart, "*", "*")); + const insight = Object.assign({ chart }, partialInsight); + const columns = deepMerge({}, partialInsight.columns, this.state.columns); + const { signalValues } = this.viewer.getInsight(); + insight.signalValues = Object.assign(Object.assign({}, this.state.signalValues), signalValues); + insight.columns = Object.assign({}, columns); + insight.totalStyle = this.state.totalStyle; + let errors; + if (this.state.chart === "scatterplot" && (chart === "barchart" || chart === "barchartV")) { + insight.columns = Object.assign(Object.assign({}, columns), { sort: columns.y }); + } else if (this.state.chart === "scatterplot" && chart === "barchartH") { + insight.columns = Object.assign(Object.assign({}, columns), { sort: columns.x }); + } else if (chart === "treemap") { + insight.view = "2d"; + if (!columns.size) { + let sizeColumn; + if (partialInsight && partialInsight.columns && partialInsight.columns.size) { + const prefSizeColumn = this.state.dataContent.columns.filter((c2) => c2.name === partialInsight.columns.size)[0]; + if (prefSizeColumn && prefSizeColumn.quantitative) { + sizeColumn = prefSizeColumn; + } + } + if (!sizeColumn) { + sizeColumn = getTreemapColumn(this.state.dataContent.columns); + } + if (!sizeColumn) { + errors = [strings$1.errorColumnMustBeNumeric]; + } else { + insight.columns = Object.assign(Object.assign({}, columns), { size: sizeColumn.name }); } + } + } else if (chart === "stacks") { + insight.view = "3d"; } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + ensureColumnsExist(insight.columns, this.state.dataContent.columns, this.state.transform); + errors = ensureColumnsPopulated(chart, insight.totalStyle, insight.columns, this.state.dataContent.columns); + this.calculate(() => { + this.changeInsight(insight, { label: strings$1.labelHistoryChangeChartType(chartLabel(chart)) }, errors ? { errors, camera: void 0 } : { camera: void 0 }); + }); + return insight.columns; + } + calculate(calculating) { + this.setState({ calculating }); + } + changeView(view) { + this.changeInsight({ view }, { label: view === "2d" ? strings$1.labelViewType2d : strings$1.labelViewType3d }); + } + //state members which change the insight + changeInsight(partialInsight, historyAction, additionalUIState, historicSetup) { + if (!partialInsight.signalValues) { + partialInsight.signalValues = null; } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + if (partialInsight.chart === "barchart") { + partialInsight.chart = "barchartV"; } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} -function __generator(thisArg, body) { - var _ = { - label: 0, - sent: function() { - if (t[0] & 1) throw t[1]; - return t[1]; - }, - trys: [], - ops: [] - }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([ - n, - v - ]); + this.addHistory(Object.assign(Object.assign({}, partialInsight), { historicSetup }), historyAction, additionalUIState); + } + addHistory(historicInsight, historyAction, additionalUIState) { + const setCleanState = (newState) => { + const cleanState = Object.assign(Object.assign({}, newState), additionalUIState); + if (!cleanState.note) { + cleanState.note = null; + } + delete cleanState.rebaseFilter; + if (this.viewer) { + const { signalValues } = this.viewer.getInsight(); + cleanState.signalValues = Object.assign(Object.assign(Object.assign({}, this.state.signalValues), signalValues), cleanState.signalValues); + } + this.setState(cleanState); + }; + if (historyAction.omit) { + setCleanState(historicInsight); + return; + } + const historyItems = this.state.historyItems.slice(0, this.state.historyIndex + 1); + const historyIndex = historyItems.length; + historyItems.push({ label: historyAction.label, historicInsight }); + if (historyAction.insert) { + setCleanState({ historyIndex, historyItems }); + } else { + setCleanState(Object.assign(Object.assign({}, historicInsight), { historyIndex, historyItems })); + } + } + replay(index2) { + return replay(this.state.historyItems, index2); + } + undo() { + const historyIndex = this.state.historyIndex - 1; + if (historyIndex < 0) + return; + this.doReplay(historyIndex); + } + redo(historyIndex = this.state.historyIndex + 1) { + if (historyIndex >= this.state.historyItems.length) + return; + this.doReplay(historyIndex); + } + doReplay(historyIndex) { + const newState = this.replay(historyIndex); + this.rebaseFilter = true; + this.setSetup(newState.historicSetup, newState); + this.setState(Object.assign(Object.assign({}, newState), { historyIndex })); + } + changespecCapabilities(specCapabilities) { + this.setState({ specCapabilities }); + } + changeColumnMapping(role, column, options2) { + const columns = Object.assign({}, this.state.columns); + const label2 = column ? strings$1.labelHistoryMapColumn(role) : strings$1.labelHistoryUnMapColumn(role); + const final = () => { + const partialInsight = { columns, totalStyle: options2 ? options2.totalStyle : this.state.totalStyle }; + const errors = ensureColumnsPopulated(this.state.chart, partialInsight.totalStyle, partialInsight.columns, this.state.dataContent.columns); + columns[role] = column && column.name; + this.changeInsight(partialInsight, { label: label2 }, errors ? { errors, camera: this.viewer.getCamera() } : { camera: this.viewer.getCamera() }); + }; + const _changeInsight = (newInsight, columnUpdate, historyAction) => { + newInsight.columns = deepMerge({}, columns, columnUpdate); + savePref(this.prefs, this.state.chart, "*", "*", { columns: columnUpdate }); + this.changeInsight(newInsight, historyAction, { camera: this.viewer.getCamera() }); }; - } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while(g && (g = 0, op[0] && (_ = 0)), _)try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [ - op[0] & 2, - t.value - ]; - switch(op[0]){ - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { - value: op[1], - done: false - }; - case 5: - _.label++; - y = op[1]; - op = [ - 0 - ]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) _.ops.pop(); - _.trys.pop(); - continue; + if (column) { + let columnUpdate; + switch (role) { + case "facet": { + copyPrefToNewState(this.prefs, this.state.chart, "facet", column.name); + const historicInsight = { columns, facetStyle: options2 ? options2.facetStyle : this.state.facetStyle }; + columnUpdate = { facet: column.name }; + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + break; + } + case "color": { + let calculating = null; + const historicInsight = { scheme: options2 && options2.scheme, columns, colorBin: this.state.colorBin }; + if (!historicInsight.scheme) { + copyPrefToNewState(this.prefs, this.state.chart, "color", column.name); + } + if (!historicInsight.scheme) { + historicInsight.scheme = bestColorScheme(column, null, this.state.scheme); + } + if (!column.stats.hasColorData) { + historicInsight.directColor = false; + if (this.state.directColor !== historicInsight.directColor) { + calculating = () => this._resize(); + } + } + if (this.state.columns && this.state.columns.color && this.state.columns.color !== column.name) { + const currColorColumn = this.state.dataContent.columns.filter((c2) => c2.name === this.state.columns.color)[0]; + if (column.isColorData != currColorColumn.isColorData) { + calculating = () => this._resize(); + } + } + this.ignoreSelectionChange = true; + this.viewer.deselect().then(() => { + this.ignoreSelectionChange = false; + requestAnimationFrame(() => { + columnUpdate = { color: column.name }; + this.getColorContext = null; + this.setState({ calculating }); + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + }); + }); + break; + } + case "x": { + copyPrefToNewState(this.prefs, this.state.chart, "x", column.name); + const historicInsight = { columns }; + columnUpdate = { x: column.name }; + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + break; + } + case "size": { + copyPrefToNewState(this.prefs, this.state.chart, "size", column.name); + const historicInsight = { totalStyle: options2 ? options2.totalStyle : this.state.totalStyle }; + columnUpdate = { size: column.name }; + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + break; } - op = body.call(thisArg, _); - } catch (e) { - op = [ - 6, - e - ]; - y = 0; - } finally{ - f = t = 0; + default: { + final(); + break; + } + } + } else { + switch (role) { + case "facet": { + columns.facet = null; + columns.facetV = null; + this.changeInsight({ columns, facetStyle: "wrap" }, { label: label2 }); + break; + } + default: { + final(); + break; + } + } } - if (op[0] & 5) throw op[1]; - return { - value: op[0] ? op[1] : void 0, - done: true - }; - } -} -var __createBinding = Object.create ? function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = { - enumerable: true, - get: function() { - return m[k]; - } - }; - Object.defineProperty(o, k2, desc); -} : function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}; -function __exportStar(m, o) { - for(var p in m)if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function() { - if (o && i >= o.length) o = void 0; - return { - value: o && o[i++], - done: !o - }; + } + setSideTabId(sideTabId, dataScopeId) { + if (sideTabId === SideTabId.Data && dataScopeId == null) { + dataScopeId = this.getBestDataScopeId(); } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while((n === void 0 || n-- > 0) && !(r = i.next()).done)ar.push(r.value); - } catch (error) { - e = { - error: error + if (dataScopeId == null) { + dataScopeId = this.state.dataScopeId; + } + const calculating = () => { + this.dialogFocusHandler.focus && this.dialogFocusHandler.focus(); }; - } finally{ - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } finally{ - if (e) throw e.error; - } - } - return ar; -} -function __spread() { - for(var ar = [], i = 0; i < arguments.length; i++)ar = ar.concat(__read(arguments[i])); - return ar; -} -function __spreadArrays() { - for(var s = 0, i = 0, il = arguments.length; i < il; i++)s += arguments[i].length; - for(var r = Array(s), k = 0, i = 0; i < il; i++)for(var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)r[k] = a[j]; - return r; -} -function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) { - for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; + this.setState({ sideTabId, dataScopeId, sidebarClosed: false, calculating }); + this.activateDataBrowserItem(sideTabId, dataScopeId); + } + getBestDataScopeId() { + let dataScopeId; + const selectionState = this.viewer && this.viewer.getSelection(); + if (selectionState && selectionState.selectedData && selectionState.selectedData.length) { + dataScopeId = DataScopeId.SelectedData; + } else if (this.state.filteredData) { + dataScopeId = DataScopeId.FilteredData; + } else { + dataScopeId = DataScopeId.AllData; } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function awaitReturn(f) { - return function(v) { - return Promise.resolve(v).then(f, reject); + return dataScopeId; + } + activateDataBrowserItem(sideTabId, dataScopeId) { + if (!this.viewer) + return; + let itemToActivate; + if (sideTabId === SideTabId.Data) { + switch (dataScopeId) { + case DataScopeId.AllData: { + itemToActivate = this.state.dataContent && this.state.dataContent.data[this.state.selectedItemIndex[DataScopeId.AllData]]; + break; + } + case DataScopeId.FilteredData: { + itemToActivate = this.state.filteredData && this.state.filteredData[this.state.selectedItemIndex[DataScopeId.FilteredData]]; + break; + } + case DataScopeId.SelectedData: { + const selection = this.viewer.getSelection() || {}; + itemToActivate = selection.selectedData && selection.selectedData[this.state.selectedItemIndex[DataScopeId.SelectedData]]; + break; + } + } + } + this.silentActivation(itemToActivate); + } + silentActivation(itemToActivate) { + this.ignoreSelectionChange = true; + const done = () => { + this.ignoreSelectionChange = false; }; - } - function verb(n, f) { - if (g[n]) { - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([ - n, - v, - a, - b - ]) > 1 || resume(n, v); - }); - }; - if (f) i[n] = f(i[n]); + if (itemToActivate) { + return this.viewer.activate(itemToActivate).then(done); + } else { + return this.viewer.deActivate().then(done); } - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); + } + sidebar(sidebarClosed, sidebarPinned) { + this.setState({ sidebarClosed, sidebarPinned }); + } + resize() { + this.setState({ calculating: () => this._resize() }); + } + _resize() { + this.changeInsight({ size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed) }, { label: "resize", omit: true }); + } + viewerMounted(glDiv) { + this.setState({ + size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed), + signalValues: this.state.signalValues + //keep initialized signalValues + }); + } + getLayoutDivSize(pinned, closed) { + const div = pinned && !closed ? this.layoutDivPinned : this.layoutDivUnpinned; + return { height: div.offsetHeight, width: div.offsetWidth }; + } + toggleableSearch(e, search) { + if (e.ctrlKey) { + this.setState({ search: createInputSearch(search) }); + this.setSideTabId(SideTabId.Search); + } else { + const oldSelection = this.viewer.getSelection(); + if (oldSelection.search) { + const result = compareGroups(ensureSearchExpressionGroupArray(oldSelection.search), search); + if (result.found) { + if (result.groups.length === 0) { + this.doDeselect(); + } else { + this.doSelect(result.groups); + } + } else { + if (e.altKey || e.shiftKey) { + let group2 = true; + if (e.altKey) { + search.clause = "&&"; + } else if (e.shiftKey) { + if (this.props.searchORDisabled) { + group2 = false; + } else { + search.clause = "||"; + } + } + if (group2) { + result.groups.push(search); + this.doSelect(result.groups); + } else { + this.doSelect(search); + } + } else { + this.doSelect(search); + } + } + } else { + this.doSelect(search); + } } - } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); - } -} -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function(e) { - throw e; - }), verb("return"), i[Symbol.iterator] = function() { - return this; - }, i; - function verb(n, f) { - i[n] = o[n] ? function(v) { - return (p = !p) ? { - value: __await(o[n](v)), - done: false - } : f ? f(v) : v; - } : f; - } -} -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); + } + doFilter(search, historicFilterChange) { + this.historicFilterChange = historicFilterChange; + this.viewer.filter(search); + } + doUnfilter(historicFilterChange) { + this.historicFilterChange = historicFilterChange; + this.viewer.reset(); + } + doSelect(search) { + return this.viewer.select(search); + } + doDeselect() { + return this.viewer.deselect(); + } + writeSnapshot(snapshot, editIndex) { + let { selectedSnapshotIndex } = this.state; + let snapshots; + if (editIndex >= 0) { + snapshots = [...this.state.snapshots]; + snapshots[editIndex] = snapshot; + this.setState({ snapshots, selectedSnapshotIndex }); + } else { + const note = snapshot.description; + snapshots = this.state.snapshots.concat(snapshot); + selectedSnapshotIndex = snapshots.length - 1; + this.scrollSnapshotIntoView(selectedSnapshotIndex); + this.setState({ sideTabId: SideTabId.Snapshots, snapshots, selectedSnapshotIndex, note }); + } + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + } + scrollSnapshotIntoView(selectedSnapshotIndex) { + clearTimeout(this.scrollSnapshotTimer); + if (this.state.sidebarClosed) + return; + this.scrollSnapshotTimer = setTimeout(() => { + const selectedSnapshotElement = this.div.querySelector(`.snapshot:nth-child(${selectedSnapshotIndex + 1})`); + if (selectedSnapshotElement) { + selectedSnapshotElement.scrollIntoView({ behavior: "smooth", block: "nearest" }); + } + }, 500); + } + componentDidMount() { + if (this.props.mounted) { + this.props.mounted(this); + } + } + render() { + var _a2, _b2, _c2; + const insight = getPureInsight(this.state); + const loaded2 = !!(insight.columns && this.state.dataContent); + if (loaded2) { + setInsightBackgroundImage(insight, this.imageHolder, this.state.columns); + } + const selectionState = this.viewer && this.viewer.getSelection() || {}; + const selectionSearch = selectionState && selectionState.search; + const columnMapProps = this.getColumnMapBaseProps(); + const datas = {}; + datas[DataScopeId.AllData] = this.state.dataContent && this.state.dataContent.data; + datas[DataScopeId.FilteredData] = this.state.filteredData; + datas[DataScopeId.SelectedData] = selectionState && selectionState.selectedData; + if (this.state.calculating) { + requestAnimationFrame(() => { + if (this.state.calculating) { + this.state.calculating(); + this.setState({ calculating: null }); + } + }); + } + const theme = this.props.theme || ""; + const themePalette = themePalettes[theme]; + let renderOptions; + if (loaded2) { + renderOptions = Object.assign(Object.assign({}, this.props.renderOptions), { rebaseFilter: () => this.rebaseFilter, initialColorContext: this.getColorContext && this.getColorContext(this.viewer.insight, insight), discardColorContextUpdates: () => this.discardColorContextUpdates, columns: (_a2 = this.state.dataContent) === null || _a2 === void 0 ? void 0 : _a2.columns }); + } + return base$1.react.createElement( + "div", + { ref: (div) => { + if (div) + this.div = div; + }, className: classList("sanddance-explorer", this.props.theme) }, + base$1.react.createElement(Topbar, { collapseLabels: this.props.compactUI, historyIndex: this.state.historyIndex, historyItems: this.state.historyItems, undo: () => this.undo(), redo: () => this.redo(), logoClickUrl: this.props.logoClickUrl, logoClickTarget: this.props.logoClickTarget, themePalette, loaded: loaded2, doDeselect: this.doDeselect.bind(this), doFilter: this.doFilter.bind(this), doUnfilter: this.doUnfilter.bind(this), filter: this.state.filter, selectionSearch, selectionState, buttons: this.props.topBarButtonProps, iconButtons: this.props.topBarIconButtonProps, view: this.state.view, snapshotsHidden: (_b2 = this.props.snapshotProps) === null || _b2 === void 0 ? void 0 : _b2.hidden, snapshots: this.state.snapshots, onSnapshotPreviousClick: () => { + let selectedSnapshotIndex; + if (this.state.selectedSnapshotIndex === -1) { + selectedSnapshotIndex = this.state.snapshots.length - 1; + } else { + selectedSnapshotIndex = this.state.selectedSnapshotIndex; + selectedSnapshotIndex--; + if (selectedSnapshotIndex < 0) { + selectedSnapshotIndex = this.state.snapshots.length - 1; + } + } + this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); + }, onSnapshotClick: () => this.snapshotEditor.editSnapshot(), onSnapshotNextClick: () => { + let selectedSnapshotIndex; + if (this.state.selectedSnapshotIndex === -1) { + selectedSnapshotIndex = 0; + } else { + selectedSnapshotIndex = this.state.selectedSnapshotIndex; + selectedSnapshotIndex++; + if (selectedSnapshotIndex > this.state.snapshots.length - 1) { + selectedSnapshotIndex = 0; + } + } + this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); + }, onViewClick: () => { + const view = this.state.view === "2d" ? "3d" : "2d"; + this.changeInsight({ view }, { label: view === "2d" ? strings$1.labelViewType2d : strings$1.labelViewType3d }); + } }), + base$1.react.createElement( + "div", + { className: classList("sanddance-main", this.state.sidebarPinned && "pinned", this.state.sidebarClosed && "closed", (insight.hideLegend || insight.directColor || !colorMapping(insight, this.state.dataContent && this.state.dataContent.columns)) && "hide-legend") }, + base$1.react.createElement("div", { ref: (div) => { + if (div && !this.layoutDivUnpinned) + this.layoutDivUnpinned = div; + }, className: "sanddance-layout-unpinned" }), + base$1.react.createElement("div", { ref: (div) => { + if (div && !this.layoutDivPinned) + this.layoutDivPinned = div; + }, className: "sanddance-layout-pinned" }), + !loaded2 && base$1.react.createElement( + "div", + { className: "loading" }, + base$1.react.createElement(base$1.fluentUI.Spinner, { size: base$1.fluentUI.SpinnerSize.large, label: strings$1.loading }) + ), + base$1.react.createElement(Sidebar, { themePalette, calculating: !!this.state.calculating, closed: this.state.sidebarClosed, hideSidebarControls: this.props.hideSidebarControls, snapshotsHidden: (_c2 = this.props.snapshotProps) === null || _c2 === void 0 ? void 0 : _c2.hidden, pinned: this.state.sidebarPinned, disabled: !loaded2, dataScopeProps: { + themePalette, + compact: this.state.sidebarClosed, + onCompactClick: () => { + this.changeInsight({ + size: this.getLayoutDivSize(this.state.sidebarPinned, false) + }, { + label: null, + omit: true + }, { + sidebarClosed: false + }); + }, + dataSet: this.props.datasetElement, + dataCount: loaded2 && { + all: this.state.dataContent && this.state.dataContent.data.length, + filtered: this.state.filteredData && this.state.filteredData.length, + selected: selectionState && selectionState.selectedData && selectionState.selectedData.length + }, + active: this.state.sideTabId === SideTabId.Data, + onDataScopeClick: (dataScopeId) => this.setSideTabId(SideTabId.Data, dataScopeId), + selectedDataScope: this.state.dataScopeId, + disabled: !loaded2 + }, onSideTabClick: (sideTabId) => { + if (sideTabId === SideTabId.Collapse || this.state.sideTabId === sideTabId) { + let { dataScopeId, sidebarClosed } = this.state; + if (sidebarClosed && sideTabId === SideTabId.Data) { + dataScopeId = this.getBestDataScopeId(); + } + sidebarClosed = !this.state.sidebarClosed; + this.changeInsight({ + size: this.getLayoutDivSize(this.state.sidebarPinned, sidebarClosed) + }, { + label: null, + omit: true + }, { + dataScopeId, + sidebarClosed + }); + } else if (sideTabId === SideTabId.Pin) { + this.changeInsight({ + size: this.getLayoutDivSize(!this.state.sidebarPinned, this.state.sidebarClosed) + }, { + label: null, + omit: true + }, { + sidebarPinned: !this.state.sidebarPinned + }); + } else { + this.setSideTabId(sideTabId); + } + }, selectedSideTab: this.state.sideTabId }, loaded2 && (() => { + switch (this.state.sideTabId) { + case SideTabId.ChartType: { + return base$1.react.createElement(Chart, Object.assign({ themePalette, collapseLabels: this.props.compactUI, tooltipExclusions: this.state.tooltipExclusions, toggleTooltipExclusion: (columnName) => { + const tooltipExclusions = [...this.state.tooltipExclusions]; + const i = tooltipExclusions.indexOf(columnName); + if (i < 0) { + tooltipExclusions.push(columnName); + } else { + tooltipExclusions.splice(i, 1); + } + this.setState({ tooltipExclusions }); + this.props.onTooltipExclusionsChanged && this.props.onTooltipExclusionsChanged(tooltipExclusions); + }, disabled: !loaded2 || this.state.sidebarClosed }, columnMapProps, { chart: this.state.chart, view: this.state.view, insightColumns: this.state.columns, onChangeSignal: (role, column, name, value2) => saveSignalValuePref(this.prefs, this.state.chart, role, column, name, value2) })); + } + case SideTabId.Color: { + return base$1.react.createElement(Color, Object.assign({ compactUI: this.props.compactUI, specCapabilities: this.state.specCapabilities, disabled: !loaded2 || this.state.sidebarClosed }, columnMapProps, { dataContent: this.state.dataContent, scheme: this.state.scheme, colorBin: this.state.colorBin, colorBinSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s2) => s2.name === SignalNames.ColorBinCount)[0], colorReverseSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s2) => s2.name === SignalNames.ColorReverse)[0], colorColumn: this.state.columns.color, onColorBinChange: (colorBin) => { + this.ignoreSelectionChange = true; + this.viewer.deselect().then(() => { + this.ignoreSelectionChange = false; + requestAnimationFrame(() => { + this.getColorContext = null; + this.changeInsight({ colorBin }, { label: strings$1.labelHistoryColorBin }); + savePref(this.prefs, this.state.chart, "color", this.state.columns.color, { colorBin }); + }); + }); + }, onColorSchemeChange: (scheme2) => { + this.changeColumnMapping("color", this.state.dataContent.columns.filter((c2) => c2.name === this.state.columns.color)[0], { scheme: scheme2 }); + savePref(this.prefs, this.state.chart, "color", this.state.columns.color, { scheme: scheme2 }); + }, onColorBinCountChange: (value2) => { + const signalValues = {}; + signalValues[SignalNames.ColorBinCount] = value2; + savePref(this.prefs, this.state.chart, "color", this.state.columns.color, { signalValues }); + }, onColorReverseChange: (value2) => { + this.getColorContext = null; + }, directColor: this.state.directColor, onDirectColorChange: (directColor) => { + this.changeInsight({ directColor }, { label: strings$1.labelHistoryDirectColor }, { calculating: () => this._resize() }); + } })); + } + case SideTabId.Data: { + const data2 = datas[this.state.dataScopeId]; + let itemVisible = true; + switch (this.state.dataScopeId) { + case DataScopeId.AllData: { + const item = this.state.selectedItemIndex[this.state.dataScopeId]; + itemVisible = this.state.dataContent && !this.state.filteredData || this.state.filteredData.indexOf(data2[item]) >= 0; + } + } + return base$1.react.createElement(DataBrowser, { explorer: this, theme: this.props.theme, themePalette, disabled: !loaded2 || this.state.sidebarClosed, columns: this.state.dataContent && this.state.dataContent.columns, categoricalColumns: columnMapProps.categoricalColumns, quantitativeColumns: columnMapProps.quantitativeColumns, data: data2, displayName: this.state.dataFile && this.state.dataFile.displayName || strings$1.defaultFileName, nullMessage: dataBrowserNullMessages[this.state.dataScopeId], zeroMessage: dataBrowserZeroMessages[this.state.dataScopeId], index: this.state.selectedItemIndex[this.state.dataScopeId], itemVisible, dataExportHandler: this.props.dataExportHandler, selectedDataScope: this.state.dataScopeId, onDataScopeClick: (dataScopeId) => this.setSideTabId(SideTabId.Data, dataScopeId), onActivate: (row, index2) => { + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + selectedItemIndex[this.state.dataScopeId] = index2; + this.setState({ selectedItemIndex }); + this.silentActivation(row); + }, onSearch: (e, search) => { + if (e.ctrlKey) { + this.setState({ sideTabId: SideTabId.Search, search }); + } else { + this.doSelect(search); + } + }, bingSearchDisabled: this.props.bingSearchDisabled, onUpdateColumnTypes: (columnTypes) => { + this.load(this.state.dataFile, null, { prefs: this.prefs, columnTypes }); + } }); + } + case SideTabId.Search: { + return base$1.react.createElement(Search, { explorer: this, collapseLabels: this.props.compactUI, themePalette, disabled: !loaded2 || this.state.sidebarClosed, disableGroupOR: this.props.searchORDisabled, disableExpressionOR: this.props.searchORDisabled, initializer: { + columns: columnMapProps.allColumns, + search: this.state.search + }, autoCompleteDistinctValues: this.state.autoCompleteDistinctValues, onSelect: (expr2) => this.doSelect(expr2), data: this.state.dataContent.data }); + } + case SideTabId.Snapshots: { + return base$1.react.createElement(Snapshots, Object.assign({}, this.props.snapshotProps, { editor: this.snapshotEditor, themePalette, explorer: this, snapshots: this.state.snapshots, selectedSnapshotIndex: this.state.selectedSnapshotIndex, onClearSnapshots: () => { + const snapshots = []; + this.setState({ snapshots, selectedSnapshotIndex: -1 }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + }, onWriteSnapshot: (s2, i) => this.writeSnapshot(s2, i), onRemoveSnapshot: (i) => { + const snapshots = [...this.state.snapshots]; + snapshots.splice(i, 1); + let { selectedSnapshotIndex } = this.state; + if (i === selectedSnapshotIndex) { + selectedSnapshotIndex = -1; + } else if (selectedSnapshotIndex > i) { + selectedSnapshotIndex--; + } + this.setState({ snapshots, selectedSnapshotIndex }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + }, onSnapshotClick: (snapshot, selectedSnapshotIndex) => { + this.setState({ selectedSnapshotIndex }); + this.calculate(() => { + this.handleReviveSnapshot(snapshot, selectedSnapshotIndex); + }); + }, onMoveUp: (i) => { + if (i > 0) { + const snapshots = [...this.state.snapshots]; + const temp2 = snapshots[i - 1]; + snapshots[i - 1] = snapshots[i]; + snapshots[i] = temp2; + let { selectedSnapshotIndex } = this.state; + if (i === selectedSnapshotIndex) { + selectedSnapshotIndex = i - 1; + } else if (i - 1 === selectedSnapshotIndex) { + selectedSnapshotIndex = i; + } + this.setState({ snapshots, selectedSnapshotIndex }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + } + }, onMoveDown: (i) => { + if (i < this.state.snapshots.length - 1) { + const snapshots = [...this.state.snapshots]; + const temp2 = snapshots[i + 1]; + snapshots[i + 1] = snapshots[i]; + snapshots[i] = temp2; + let { selectedSnapshotIndex } = this.state; + if (i === selectedSnapshotIndex) { + selectedSnapshotIndex = i + 1; + } else if (i + 1 === selectedSnapshotIndex) { + selectedSnapshotIndex = i; + } + this.setState({ snapshots, selectedSnapshotIndex }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + } + } })); + } + case SideTabId.History: { + return base$1.react.createElement(History, { explorer: this, themePalette, historyIndex: this.state.historyIndex, historyItems: this.state.historyItems, redo: (i) => this.redo(i) }); + } + case SideTabId.Transition: { + return base$1.react.createElement(TransitionEditor, Object.assign({}, columnMapProps, this.state, { compactUI: this.props.compactUI, explorer: this, themePalette, changeSetup: (newState, affectsStagger) => { + const calculating = () => { + if (affectsStagger) { + this.viewer.assignTransitionStagger(getTransition(this.state)); + } + this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(this.getSetup()); + }; + if (newState) { + this.setState(Object.assign(Object.assign({}, newState), { calculating })); + } else { + calculating(); + } + } })); + } + case SideTabId.Settings: { + return base$1.react.createElement(Settings, { explorer: this, dataFile: this.state.dataFile, scheme: this.state.scheme, hideLegend: this.state.hideLegend, onToggleLegend: (hideLegend) => this.setState({ hideLegend, calculating: () => this._resize() }), hideAxes: this.state.hideAxes, onToggleAxes: (hideAxes) => this.setState({ calculating: () => this.setState({ hideAxes }) }), additionalSettings: this.props.additionalSettings }, this.props.systemInfoChildren); + } + } + })()), + loaded2 && base$1.react.createElement( + "div", + { className: "sanddance-view" }, + base$1.react.createElement(Viewer, { renderOptions, viewerOptions: this.viewerOptions, ref: (reactViewer) => { + if (reactViewer) { + this.viewer = reactViewer.viewer; + } + }, onView: (renderResult) => { + this.rebaseFilter = false; + this.changespecCapabilities(renderResult.specResult.errors ? renderResult.specResult.specCapabilities : this.viewer.specCapabilities); + this.getColorContext = (oldInsight, newInsight) => { + if (!oldInsight && !newInsight) { + return null; + } + if (!oldInsight || !newInsight) { + return null; + } + if (oldInsight.scheme !== newInsight.scheme) { + return null; + } + if (oldInsight.columns.color !== newInsight.columns.color) { + return null; + } + if (oldInsight.directColor != newInsight.directColor) { + return null; + } + return this.viewer.colorContexts && this.viewer.colorContexts[this.viewer.currentColorContext]; + }; + removeTabIndex(this.viewer); + this.props.onView && this.props.onView(); + }, onError: (e) => { + this.props.onError && this.props.onError(e); + }, data: this.state.dataContent.data, insight, setup: this.getSetup(), onMount: (el) => this.viewerMounted(el) }), + this.state.note && base$1.react.createElement( + "div", + { className: "sanddance-note" }, + base$1.react.createElement(IconButton$1, { className: "cancel", themePalette, title: strings$1.buttonClose, iconName: "Cancel", onClick: () => this.setState({ note: null }) }), + base$1.react.createElement("div", null, this.state.note) + ), + base$1.react.createElement(Renderer$1, { explorer: this, advanced: this.state.renderer.advanced, advancedOptions: this.state.renderer.advancedOptions, basicOptions: this.state.renderer.basicOptions, themePalette, onHomeClick: () => { + this.setState({ camera: void 0 }); + this.viewer.presenter.homeCamera(); + } }) + ), + base$1.react.createElement(Dialog$1, { title: strings$1.labelError, hidden: !this.state.errors, onDismiss: () => { + this.setState({ errors: null }); + } }, this.state.errors && this.state.errors.map((error2, i) => base$1.react.createElement("div", { key: i }, error2))), + base$1.react.createElement(SnapshotEditor, Object.assign({ ref: (se) => this.snapshotEditor = se }, this.props.snapshotProps, { explorer: this, onWriteSnapshot: (s2, i) => this.writeSnapshot(s2, i), theme: this.props.theme, themePalette })) + ), + this.state.positionedColumnMapProps && base$1.react.createElement(PositionedColumnMap, Object.assign({}, this.state.positionedColumnMapProps)) + ); + } + getColumnMapBaseProps() { + const allColumns = this.state.dataContent && this.state.dataContent.columns.filter((c2) => !isInternalFieldName(c2.name, true)); + const quantitativeColumns = allColumns && allColumns.filter((c2) => c2.quantitative); + const categoricalColumns = allColumns && allColumns.filter((c2) => !c2.quantitative); + const props = { + changeColumnMapping: (role, columnOrRole, defaultColumn, options2) => { + let column; + if (typeof columnOrRole === "string") { + const columnName = this.state.columns[columnOrRole]; + column = allColumns.filter((c2) => c2.name === columnName)[0] || defaultColumn; + } else { + column = columnOrRole; + } + this.changeColumnMapping(role, column, options2); + }, + facetStyle: this.state.facetStyle, + totalStyle: this.state.totalStyle, + allColumns, + quantitativeColumns, + categoricalColumns, + specCapabilities: this.state.specCapabilities, + explorer: this }; + return props; + } } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v) { - resolve({ - value: v, - done: d - }); - }, reject); + return new __Explorer(_props); + } + const Explorer = _Explorer; + const base$1 = { + fluentUI: null, + react: null, + reactDOM: null + }; + function use$2(fluentUI2, react, reactDOM, vega2) { + use$3(react, reactDOM, vega2); + base$1.fluentUI = fluentUI2; + base$1.react = react; + base$1.reactDOM = reactDOM; + BackgroundImageEditor.prototype = react.Component.prototype; + Chart.prototype = react.Component.prototype; + ColumnTypeChanger.prototype = react.Component.prototype; + DataExportPicker.prototype = react.Component.prototype; + Explorer.prototype = react.Component.prototype; + PositionedColumnMap.prototype = react.Component.prototype; + Renderer$1.prototype = react.Component.prototype; + Search.prototype = react.Component.prototype; + SnapshotEditor.prototype = react.Component.prototype; + Snapshots.prototype = react.Component.prototype; + Settings.prototype = react.Component.prototype; + TransitionEditor.prototype = react.Component.prototype; + } + function Dialog$1(props) { + return base$1.react.createElement( + base$1.fluentUI.Dialog, + Object.assign({}, props, { dialogContentProps: Object.assign({ + type: base$1.fluentUI.DialogType.normal, + title: props.title + }, props.dialogContentProps) }), + base$1.react.createElement("div", { onKeyUp: (e) => { + e.nativeEvent.stopImmediatePropagation(); + } }, props.children), + base$1.react.createElement( + base$1.fluentUI.DialogFooter, + null, + props.buttons, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { iconProps: { iconName: "Cancel" }, onClick: props.onDismiss, text: strings$1.buttonClose }) + ) + ); + } + const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Dialog: Dialog$1 + }, Symbol.toStringTag, { value: "Module" })); + const SandDanceExplorer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Explorer, + SandDance: index$4, + SandDanceReact: index$3, + get SideTabId() { + return SideTabId; + }, + capabilities, + controls: index$2, + getColorSettingsFromThemePalette, + getEmbedHTML, + themePalettes, + use: use$2, + util: util$2, + version: version$2 + }, Symbol.toStringTag, { value: "Module" })); + const base = { + fluentUI: null + }; + function use$1(fluentUI2, vega2) { + use$2(fluentUI2, React__namespace, ReactDOM__namespace, vega2); + base.fluentUI = fluentUI2; + } + var extendStatics = function(d2, b2) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { + d3.__proto__ = b3; + } || function(d3, b3) { + for (var p in b3) if (Object.prototype.hasOwnProperty.call(b3, p)) d3[p] = b3[p]; + }; + return extendStatics(d2, b2); + }; + function __extends(d2, b2) { + if (typeof b2 !== "function" && b2 !== null) + throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); + extendStatics(d2, b2); + function __() { + this.constructor = d2; } -} -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) Object.defineProperty(cooked, "raw", { - value: raw - }); - else cooked.raw = raw; - return cooked; -} -var __setModuleDefault = Object.create ? function(o, v) { - Object.defineProperty(o, "default", { - enumerable: true, - value: v - }); -} : function(o, v) { - o["default"] = v; -}; -var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o) { - var ar = []; - for(var k in o)if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); -}; -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for(var k = ownKeys(mod), i = 0; i < k.length; i++)if (k[i] !== "default") __createBinding(result, mod, k[i]); + d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); + } + var __assign$1 = function() { + __assign$1 = Object.assign || function __assign2(t) { + for (var s2, i = 1, n = arguments.length; i < n; i++) { + s2 = arguments[i]; + for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) t[p] = s2[p]; + } + return t; + }; + return __assign$1.apply(this, arguments); + }; + function __rest(s2, e) { + var t = {}; + for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p) && e.indexOf(p) < 0) + t[p] = s2[p]; + if (s2 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s2); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i])) + t[p[i]] = s2[p[i]]; + } + return t; + } + function __decorate(decorators, target2, key2, desc) { + var c2 = arguments.length, r = c2 < 3 ? target2 : desc === null ? desc = Object.getOwnPropertyDescriptor(target2, key2) : desc, d2; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target2, key2, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d2 = decorators[i]) r = (c2 < 3 ? d2(r) : c2 > 3 ? d2(target2, key2, r) : d2(target2, key2)) || r; + return c2 > 3 && r && Object.defineProperty(target2, key2, r), r; + } + function __spreadArray(to, from, pack2) { + if (pack2 || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } } - __setModuleDefault(result, mod); - return result; -} -function __importDefault(mod) { - return mod && mod.__esModule ? mod : { - default: mod - }; -} -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; -} -function __classPrivateFieldIn(state, receiver) { - if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} -function __addDisposableResource(env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { - try { - inner.call(this); - } catch (e) { - return Promise.reject(e); - } - }; - env.stack.push({ - value: value, - dispose: dispose, - async: async - }); - } else if (async) env.stack.push({ - async: true - }); - return value; -} -var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + return to.concat(ar || Array.prototype.slice.call(from)); + } + typeof SuppressedError === "function" ? SuppressedError : function(error2, suppressed, message) { var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; -function __disposeResources(env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while(r = env.stack.pop())try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { - fail(e); - return next(); - }); - } else s |= 1; - } catch (e) { - fail(e); - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); -} -function __rewriteRelativeImportExtension(path, preserveJsx) { - if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js"; - }); - return path; -} -exports.default = { - __extends: __extends, - __assign: __assign, - __rest: __rest, - __decorate: __decorate, - __param: __param, - __esDecorate: __esDecorate, - __runInitializers: __runInitializers, - __propKey: __propKey, - __setFunctionName: __setFunctionName, - __metadata: __metadata, - __awaiter: __awaiter, - __generator: __generator, - __createBinding: __createBinding, - __exportStar: __exportStar, - __values: __values, - __read: __read, - __spread: __spread, - __spreadArrays: __spreadArrays, - __spreadArray: __spreadArray, - __await: __await, - __asyncGenerator: __asyncGenerator, - __asyncDelegator: __asyncDelegator, - __asyncValues: __asyncValues, - __makeTemplateObject: __makeTemplateObject, - __importStar: __importStar, - __importDefault: __importDefault, - __classPrivateFieldGet: __classPrivateFieldGet, - __classPrivateFieldSet: __classPrivateFieldSet, - __classPrivateFieldIn: __classPrivateFieldIn, - __addDisposableResource: __addDisposableResource, - __disposeResources: __disposeResources, - __rewriteRelativeImportExtension: __rewriteRelativeImportExtension -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NZCy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Async", ()=>(0, _utilities.Async)); -parcelHelpers.export(exports, "AutoScroll", ()=>(0, _utilities.AutoScroll)); -parcelHelpers.export(exports, "BaseComponent", ()=>(0, _utilities.BaseComponent)); -parcelHelpers.export(exports, "Customizations", ()=>(0, _utilities.Customizations)); -parcelHelpers.export(exports, "Customizer", ()=>(0, _utilities.Customizer)); -parcelHelpers.export(exports, "CustomizerContext", ()=>(0, _utilities.CustomizerContext)); -parcelHelpers.export(exports, "DATA_IS_SCROLLABLE_ATTRIBUTE", ()=>(0, _utilities.DATA_IS_SCROLLABLE_ATTRIBUTE)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _utilities.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "DelayedRender", ()=>(0, _utilities.DelayedRender)); -parcelHelpers.export(exports, "EventGroup", ()=>(0, _utilities.EventGroup)); -parcelHelpers.export(exports, "FabricPerformance", ()=>(0, _utilities.FabricPerformance)); -parcelHelpers.export(exports, "FocusRects", ()=>(0, _utilities.FocusRects)); -parcelHelpers.export(exports, "FocusRectsContext", ()=>(0, _utilities.FocusRectsContext)); -parcelHelpers.export(exports, "FocusRectsProvider", ()=>(0, _utilities.FocusRectsProvider)); -parcelHelpers.export(exports, "GlobalSettings", ()=>(0, _utilities.GlobalSettings)); -parcelHelpers.export(exports, "IsFocusVisibleClassName", ()=>(0, _utilities.IsFocusVisibleClassName)); -parcelHelpers.export(exports, "KeyCodes", ()=>(0, _utilities.KeyCodes)); -parcelHelpers.export(exports, "Rectangle", ()=>(0, _utilities.Rectangle)); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>(0, _utilities.SELECTION_CHANGE)); -parcelHelpers.export(exports, "Selection", ()=>(0, _utilities.Selection)); -parcelHelpers.export(exports, "SelectionDirection", ()=>(0, _utilities.SelectionDirection)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _utilities.SelectionMode)); -parcelHelpers.export(exports, "addDirectionalKeyCode", ()=>(0, _utilities.addDirectionalKeyCode)); -parcelHelpers.export(exports, "addElementAtIndex", ()=>(0, _utilities.addElementAtIndex)); -parcelHelpers.export(exports, "allowOverscrollOnElement", ()=>(0, _utilities.allowOverscrollOnElement)); -parcelHelpers.export(exports, "allowScrollOnElement", ()=>(0, _utilities.allowScrollOnElement)); -parcelHelpers.export(exports, "anchorProperties", ()=>(0, _utilities.anchorProperties)); -parcelHelpers.export(exports, "appendFunction", ()=>(0, _utilities.appendFunction)); -parcelHelpers.export(exports, "arraysEqual", ()=>(0, _utilities.arraysEqual)); -parcelHelpers.export(exports, "asAsync", ()=>(0, _utilities.asAsync)); -parcelHelpers.export(exports, "assertNever", ()=>(0, _utilities.assertNever)); -parcelHelpers.export(exports, "assign", ()=>(0, _utilities.assign)); -parcelHelpers.export(exports, "audioProperties", ()=>(0, _utilities.audioProperties)); -parcelHelpers.export(exports, "baseElementEvents", ()=>(0, _utilities.baseElementEvents)); -parcelHelpers.export(exports, "baseElementProperties", ()=>(0, _utilities.baseElementProperties)); -parcelHelpers.export(exports, "buttonProperties", ()=>(0, _utilities.buttonProperties)); -parcelHelpers.export(exports, "calculatePrecision", ()=>(0, _utilities.calculatePrecision)); -parcelHelpers.export(exports, "canUseDOM", ()=>(0, _utilities.canUseDOM)); -parcelHelpers.export(exports, "classNamesFunction", ()=>(0, _utilities.classNamesFunction)); -parcelHelpers.export(exports, "colGroupProperties", ()=>(0, _utilities.colGroupProperties)); -parcelHelpers.export(exports, "colProperties", ()=>(0, _utilities.colProperties)); -parcelHelpers.export(exports, "composeComponentAs", ()=>(0, _utilities.composeComponentAs)); -parcelHelpers.export(exports, "composeRenderFunction", ()=>(0, _utilities.composeRenderFunction)); -parcelHelpers.export(exports, "createArray", ()=>(0, _utilities.createArray)); -parcelHelpers.export(exports, "createMemoizer", ()=>(0, _utilities.createMemoizer)); -parcelHelpers.export(exports, "createMergedRef", ()=>(0, _utilities.createMergedRef)); -parcelHelpers.export(exports, "css", ()=>(0, _utilities.css)); -parcelHelpers.export(exports, "customizable", ()=>(0, _utilities.customizable)); -parcelHelpers.export(exports, "disableBodyScroll", ()=>(0, _utilities.disableBodyScroll)); -parcelHelpers.export(exports, "divProperties", ()=>(0, _utilities.divProperties)); -parcelHelpers.export(exports, "doesElementContainFocus", ()=>(0, _utilities.doesElementContainFocus)); -parcelHelpers.export(exports, "elementContains", ()=>(0, _utilities.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _utilities.elementContainsAttribute)); -parcelHelpers.export(exports, "enableBodyScroll", ()=>(0, _utilities.enableBodyScroll)); -parcelHelpers.export(exports, "extendComponent", ()=>(0, _utilities.extendComponent)); -parcelHelpers.export(exports, "filteredAssign", ()=>(0, _utilities.filteredAssign)); -parcelHelpers.export(exports, "find", ()=>(0, _utilities.find)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _utilities.findElementRecursive)); -parcelHelpers.export(exports, "findIndex", ()=>(0, _utilities.findIndex)); -parcelHelpers.export(exports, "findScrollableParent", ()=>(0, _utilities.findScrollableParent)); -parcelHelpers.export(exports, "fitContentToBounds", ()=>(0, _utilities.fitContentToBounds)); -parcelHelpers.export(exports, "flatten", ()=>(0, _utilities.flatten)); -parcelHelpers.export(exports, "focusAsync", ()=>(0, _utilities.focusAsync)); -parcelHelpers.export(exports, "focusFirstChild", ()=>(0, _utilities.focusFirstChild)); -parcelHelpers.export(exports, "formProperties", ()=>(0, _utilities.formProperties)); -parcelHelpers.export(exports, "format", ()=>(0, _utilities.format)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _utilities.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _utilities.getChildren)); -parcelHelpers.export(exports, "getDistanceBetweenPoints", ()=>(0, _utilities.getDistanceBetweenPoints)); -parcelHelpers.export(exports, "getDocument", ()=>(0, _utilities.getDocument)); -parcelHelpers.export(exports, "getElementIndexPath", ()=>(0, _utilities.getElementIndexPath)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _utilities.getEventTarget)); -parcelHelpers.export(exports, "getFirstFocusable", ()=>(0, _utilities.getFirstFocusable)); -parcelHelpers.export(exports, "getFirstTabbable", ()=>(0, _utilities.getFirstTabbable)); -parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>(0, _utilities.getFirstVisibleElementFromSelector)); -parcelHelpers.export(exports, "getFocusableByIndexPath", ()=>(0, _utilities.getFocusableByIndexPath)); -parcelHelpers.export(exports, "getId", ()=>(0, _utilities.getId)); -parcelHelpers.export(exports, "getInitials", ()=>(0, _utilities.getInitials)); -parcelHelpers.export(exports, "getLanguage", ()=>(0, _utilities.getLanguage)); -parcelHelpers.export(exports, "getLastFocusable", ()=>(0, _utilities.getLastFocusable)); -parcelHelpers.export(exports, "getLastTabbable", ()=>(0, _utilities.getLastTabbable)); -parcelHelpers.export(exports, "getNativeElementProps", ()=>(0, _utilities.getNativeElementProps)); -parcelHelpers.export(exports, "getNativeProps", ()=>(0, _utilities.getNativeProps)); -parcelHelpers.export(exports, "getNextElement", ()=>(0, _utilities.getNextElement)); -parcelHelpers.export(exports, "getParent", ()=>(0, _utilities.getParent)); -parcelHelpers.export(exports, "getPreviousElement", ()=>(0, _utilities.getPreviousElement)); -parcelHelpers.export(exports, "getPropsWithDefaults", ()=>(0, _utilities.getPropsWithDefaults)); -parcelHelpers.export(exports, "getRTL", ()=>(0, _utilities.getRTL)); -parcelHelpers.export(exports, "getRTLSafeKeyCode", ()=>(0, _utilities.getRTLSafeKeyCode)); -parcelHelpers.export(exports, "getRect", ()=>(0, _utilities.getRect)); -parcelHelpers.export(exports, "getResourceUrl", ()=>(0, _utilities.getResourceUrl)); -parcelHelpers.export(exports, "getScrollbarWidth", ()=>(0, _utilities.getScrollbarWidth)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _utilities.getVirtualParent)); -parcelHelpers.export(exports, "getWindow", ()=>(0, _utilities.getWindow)); -parcelHelpers.export(exports, "hasHorizontalOverflow", ()=>(0, _utilities.hasHorizontalOverflow)); -parcelHelpers.export(exports, "hasOverflow", ()=>(0, _utilities.hasOverflow)); -parcelHelpers.export(exports, "hasVerticalOverflow", ()=>(0, _utilities.hasVerticalOverflow)); -parcelHelpers.export(exports, "hoistMethods", ()=>(0, _utilities.hoistMethods)); -parcelHelpers.export(exports, "hoistStatics", ()=>(0, _utilities.hoistStatics)); -parcelHelpers.export(exports, "htmlElementProperties", ()=>(0, _utilities.htmlElementProperties)); -parcelHelpers.export(exports, "iframeProperties", ()=>(0, _utilities.iframeProperties)); -parcelHelpers.export(exports, "imageProperties", ()=>(0, _utilities.imageProperties)); -parcelHelpers.export(exports, "imgProperties", ()=>(0, _utilities.imgProperties)); -parcelHelpers.export(exports, "initializeComponentRef", ()=>(0, _utilities.initializeComponentRef)); -parcelHelpers.export(exports, "initializeFocusRects", ()=>(0, _utilities.initializeFocusRects)); -parcelHelpers.export(exports, "inputProperties", ()=>(0, _utilities.inputProperties)); -parcelHelpers.export(exports, "isControlled", ()=>(0, _utilities.isControlled)); -parcelHelpers.export(exports, "isDirectionalKeyCode", ()=>(0, _utilities.isDirectionalKeyCode)); -parcelHelpers.export(exports, "isElementFocusSubZone", ()=>(0, _utilities.isElementFocusSubZone)); -parcelHelpers.export(exports, "isElementFocusZone", ()=>(0, _utilities.isElementFocusZone)); -parcelHelpers.export(exports, "isElementTabbable", ()=>(0, _utilities.isElementTabbable)); -parcelHelpers.export(exports, "isElementVisible", ()=>(0, _utilities.isElementVisible)); -parcelHelpers.export(exports, "isElementVisibleAndNotHidden", ()=>(0, _utilities.isElementVisibleAndNotHidden)); -parcelHelpers.export(exports, "isIE11", ()=>(0, _utilities.isIE11)); -parcelHelpers.export(exports, "isIOS", ()=>(0, _utilities.isIOS)); -parcelHelpers.export(exports, "isMac", ()=>(0, _utilities.isMac)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _utilities.isVirtualElement)); -parcelHelpers.export(exports, "labelProperties", ()=>(0, _utilities.labelProperties)); -parcelHelpers.export(exports, "liProperties", ()=>(0, _utilities.liProperties)); -parcelHelpers.export(exports, "mapEnumByName", ()=>(0, _utilities.mapEnumByName)); -parcelHelpers.export(exports, "memoize", ()=>(0, _utilities.memoize)); -parcelHelpers.export(exports, "memoizeFunction", ()=>(0, _utilities.memoizeFunction)); -parcelHelpers.export(exports, "merge", ()=>(0, _utilities.merge)); -parcelHelpers.export(exports, "mergeAriaAttributeValues", ()=>(0, _utilities.mergeAriaAttributeValues)); -parcelHelpers.export(exports, "mergeCustomizations", ()=>(0, _utilities.mergeCustomizations)); -parcelHelpers.export(exports, "mergeScopedSettings", ()=>(0, _utilities.mergeScopedSettings)); -parcelHelpers.export(exports, "mergeSettings", ()=>(0, _utilities.mergeSettings)); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>(0, _utilities.MergeStylesShadowRootProvider)); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>(0, _utilities.MergeStylesRootProvider)); -parcelHelpers.export(exports, "modalize", ()=>(0, _utilities.modalize)); -parcelHelpers.export(exports, "nullRender", ()=>(0, _utilities.nullRender)); -parcelHelpers.export(exports, "olProperties", ()=>(0, _utilities.olProperties)); -parcelHelpers.export(exports, "omit", ()=>(0, _utilities.omit)); -parcelHelpers.export(exports, "on", ()=>(0, _utilities.on)); -parcelHelpers.export(exports, "optionProperties", ()=>(0, _utilities.optionProperties)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _utilities.portalContainsElement)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _utilities.precisionRound)); -parcelHelpers.export(exports, "raiseClick", ()=>(0, _utilities.raiseClick)); -parcelHelpers.export(exports, "removeDirectionalKeyCode", ()=>(0, _utilities.removeDirectionalKeyCode)); -parcelHelpers.export(exports, "removeIndex", ()=>(0, _utilities.removeIndex)); -parcelHelpers.export(exports, "replaceElement", ()=>(0, _utilities.replaceElement)); -parcelHelpers.export(exports, "resetControlledWarnings", ()=>(0, _utilities.resetControlledWarnings)); -parcelHelpers.export(exports, "resetIds", ()=>(0, _utilities.resetIds)); -parcelHelpers.export(exports, "resetMemoizations", ()=>(0, _utilities.resetMemoizations)); -parcelHelpers.export(exports, "safeRequestAnimationFrame", ()=>(0, _utilities.safeRequestAnimationFrame)); -parcelHelpers.export(exports, "safeSetTimeout", ()=>(0, _utilities.safeSetTimeout)); -parcelHelpers.export(exports, "selectProperties", ()=>(0, _utilities.selectProperties)); -parcelHelpers.export(exports, "setBaseUrl", ()=>(0, _utilities.setBaseUrl)); -parcelHelpers.export(exports, "setFocusVisibility", ()=>(0, _utilities.setFocusVisibility)); -parcelHelpers.export(exports, "setLanguage", ()=>(0, _utilities.setLanguage)); -parcelHelpers.export(exports, "setMemoizeWeakMap", ()=>(0, _utilities.setMemoizeWeakMap)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _utilities.setPortalAttribute)); -parcelHelpers.export(exports, "setRTL", ()=>(0, _utilities.setRTL)); -parcelHelpers.export(exports, "setSSR", ()=>(0, _utilities.setSSR)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _utilities.setVirtualParent)); -parcelHelpers.export(exports, "setWarningCallback", ()=>(0, _utilities.setWarningCallback)); -parcelHelpers.export(exports, "shallowCompare", ()=>(0, _utilities.shallowCompare)); -parcelHelpers.export(exports, "shouldWrapFocus", ()=>(0, _utilities.shouldWrapFocus)); -parcelHelpers.export(exports, "styled", ()=>(0, _utilities.styled)); -parcelHelpers.export(exports, "tableProperties", ()=>(0, _utilities.tableProperties)); -parcelHelpers.export(exports, "tdProperties", ()=>(0, _utilities.tdProperties)); -parcelHelpers.export(exports, "textAreaProperties", ()=>(0, _utilities.textAreaProperties)); -parcelHelpers.export(exports, "thProperties", ()=>(0, _utilities.thProperties)); -parcelHelpers.export(exports, "toMatrix", ()=>(0, _utilities.toMatrix)); -parcelHelpers.export(exports, "trProperties", ()=>(0, _utilities.trProperties)); -parcelHelpers.export(exports, "unhoistMethods", ()=>(0, _utilities.unhoistMethods)); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>(0, _utilities.useAdoptedStylesheet)); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>(0, _utilities.useAdoptedStylesheetEx)); -parcelHelpers.export(exports, "useCustomizationSettings", ()=>(0, _utilities.useCustomizationSettings)); -parcelHelpers.export(exports, "useFocusRects", ()=>(0, _utilities.useFocusRects)); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>(0, _utilities.useHasMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>(0, _utilities.useMergeStylesHooks)); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>(0, _utilities.useMergeStylesRootStylesheets)); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>(0, _utilities.useMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useShadowConfig", ()=>(0, _utilities.useShadowConfig)); -parcelHelpers.export(exports, "useStyled", ()=>(0, _utilities.useStyled)); -parcelHelpers.export(exports, "values", ()=>(0, _utilities.values)); -parcelHelpers.export(exports, "videoProperties", ()=>(0, _utilities.videoProperties)); -parcelHelpers.export(exports, "warn", ()=>(0, _utilities.warn)); -parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>(0, _utilities.warnConditionallyRequiredProps)); -parcelHelpers.export(exports, "warnControlledUsage", ()=>(0, _utilities.warnControlledUsage)); -parcelHelpers.export(exports, "warnDeprecations", ()=>(0, _utilities.warnDeprecations)); -parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>(0, _utilities.warnMutuallyExclusive)); -var _version = require("./version"); -var _utilities = require("@fluentui/utilities"); - -},{"./version":"6kzFC","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6kzFC":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react', '8.122.1'); - -},{"@fluentui/set-version":"iqYXf"}],"iqYXf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVersion", ()=>(0, _setVersion.setVersion)); -var _setVersion = require("./setVersion"); -(0, _setVersion.setVersion)('@fluentui/set-version', '6.0.0'); - -},{"./setVersion":"TiCtO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"TiCtO":[function(require,module,exports,__globalThis) { -// A packages cache that makes sure that we don't inject the same packageName twice in the same bundle - -// this cache is local to the module closure inside this bundle -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVersion", ()=>setVersion); -var packagesCache = {}; -// Cache access to window to avoid IE11 memory leak. -var _win = undefined; -try { + return e.name = "SuppressedError", e.error = error2, e.suppressed = suppressed, e; + }; + var packagesCache = {}; + var _win = void 0; + try { _win = window; -} catch (e) { -/* no-op */ } -function setVersion(packageName, packageVersion) { - if (typeof _win !== 'undefined') { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var packages = _win.__packages__ = _win.__packages__ || {}; - // We allow either the global packages or local packages caches to invalidate so testing can - // just clear the global to set this state - if (!packages[packageName] || !packagesCache[packageName]) { - packagesCache[packageName] = packageVersion; - var versions = packages[packageName] = packages[packageName] || []; - versions.push(packageVersion); - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55bj3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Async", ()=>(0, _async.Async)); -parcelHelpers.export(exports, "AutoScroll", ()=>(0, _autoScroll.AutoScroll)); -parcelHelpers.export(exports, "BaseComponent", ()=>(0, _baseComponent.BaseComponent)); -parcelHelpers.export(exports, "nullRender", ()=>(0, _baseComponent.nullRender)); -parcelHelpers.export(exports, "DelayedRender", ()=>(0, _delayedRender.DelayedRender)); -parcelHelpers.export(exports, "EventGroup", ()=>(0, _eventGroup.EventGroup)); -parcelHelpers.export(exports, "FabricPerformance", ()=>(0, _fabricPerformance.FabricPerformance)); -parcelHelpers.export(exports, "GlobalSettings", ()=>(0, _globalSettings.GlobalSettings)); -parcelHelpers.export(exports, "KeyCodes", ()=>(0, _keyCodes.KeyCodes)); -parcelHelpers.export(exports, "Rectangle", ()=>(0, _rectangle.Rectangle)); -parcelHelpers.export(exports, "appendFunction", ()=>(0, _appendFunction.appendFunction)); -parcelHelpers.export(exports, "mergeAriaAttributeValues", ()=>(0, _aria.mergeAriaAttributeValues)); -parcelHelpers.export(exports, "addElementAtIndex", ()=>(0, _array.addElementAtIndex)); -parcelHelpers.export(exports, "arraysEqual", ()=>(0, _array.arraysEqual)); -parcelHelpers.export(exports, "createArray", ()=>(0, _array.createArray)); -parcelHelpers.export(exports, "find", ()=>(0, _array.find)); -parcelHelpers.export(exports, "findIndex", ()=>(0, _array.findIndex)); -parcelHelpers.export(exports, "flatten", ()=>(0, _array.flatten)); -parcelHelpers.export(exports, "removeIndex", ()=>(0, _array.removeIndex)); -parcelHelpers.export(exports, "replaceElement", ()=>(0, _array.replaceElement)); -parcelHelpers.export(exports, "toMatrix", ()=>(0, _array.toMatrix)); -parcelHelpers.export(exports, "asAsync", ()=>(0, _asAsync.asAsync)); -parcelHelpers.export(exports, "assertNever", ()=>(0, _assertNever.assertNever)); -parcelHelpers.export(exports, "classNamesFunction", ()=>(0, _classNamesFunction.classNamesFunction)); -parcelHelpers.export(exports, "composeComponentAs", ()=>(0, _composeComponentAs.composeComponentAs)); -parcelHelpers.export(exports, "isControlled", ()=>(0, _controlled.isControlled)); -parcelHelpers.export(exports, "css", ()=>(0, _css.css)); -parcelHelpers.export(exports, "Customizations", ()=>(0, _customizations.Customizations)); -parcelHelpers.export(exports, "Customizer", ()=>(0, _customizer.Customizer)); -parcelHelpers.export(exports, "CustomizerContext", ()=>(0, _customizerContext.CustomizerContext)); -parcelHelpers.export(exports, "customizable", ()=>(0, _customizable.customizable)); -parcelHelpers.export(exports, "useCustomizationSettings", ()=>(0, _useCustomizationSettings.useCustomizationSettings)); -parcelHelpers.export(exports, "mergeCustomizations", ()=>(0, _mergeCustomizations.mergeCustomizations)); -parcelHelpers.export(exports, "mergeScopedSettings", ()=>(0, _mergeSettings.mergeScopedSettings)); -parcelHelpers.export(exports, "mergeSettings", ()=>(0, _mergeSettings.mergeSettings)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _dom.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "elementContains", ()=>(0, _dom.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _dom.elementContainsAttribute)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _dom.findElementRecursive)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _dom.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _dom.getChildren)); -parcelHelpers.export(exports, "getDocument", ()=>(0, _dom.getDocument)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _dom.getEventTarget)); -parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>(0, _dom.getFirstVisibleElementFromSelector)); -parcelHelpers.export(exports, "getParent", ()=>(0, _dom.getParent)); -parcelHelpers.export(exports, "getRect", ()=>(0, _dom.getRect)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _dom.getVirtualParent)); -parcelHelpers.export(exports, "getWindow", ()=>(0, _dom.getWindow)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _dom.isVirtualElement)); -parcelHelpers.export(exports, "on", ()=>(0, _dom.on)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _dom.portalContainsElement)); -parcelHelpers.export(exports, "raiseClick", ()=>(0, _dom.raiseClick)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _dom.setPortalAttribute)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _dom.setVirtualParent)); -parcelHelpers.export(exports, "extendComponent", ()=>(0, _extendComponent.extendComponent)); -parcelHelpers.export(exports, "doesElementContainFocus", ()=>(0, _focus.doesElementContainFocus)); -parcelHelpers.export(exports, "focusAsync", ()=>(0, _focus.focusAsync)); -parcelHelpers.export(exports, "focusFirstChild", ()=>(0, _focus.focusFirstChild)); -parcelHelpers.export(exports, "getElementIndexPath", ()=>(0, _focus.getElementIndexPath)); -parcelHelpers.export(exports, "getFirstFocusable", ()=>(0, _focus.getFirstFocusable)); -parcelHelpers.export(exports, "getFirstTabbable", ()=>(0, _focus.getFirstTabbable)); -parcelHelpers.export(exports, "getFocusableByIndexPath", ()=>(0, _focus.getFocusableByIndexPath)); -parcelHelpers.export(exports, "getLastFocusable", ()=>(0, _focus.getLastFocusable)); -parcelHelpers.export(exports, "getLastTabbable", ()=>(0, _focus.getLastTabbable)); -parcelHelpers.export(exports, "getNextElement", ()=>(0, _focus.getNextElement)); -parcelHelpers.export(exports, "getPreviousElement", ()=>(0, _focus.getPreviousElement)); -parcelHelpers.export(exports, "isElementFocusSubZone", ()=>(0, _focus.isElementFocusSubZone)); -parcelHelpers.export(exports, "isElementFocusZone", ()=>(0, _focus.isElementFocusZone)); -parcelHelpers.export(exports, "isElementTabbable", ()=>(0, _focus.isElementTabbable)); -parcelHelpers.export(exports, "isElementVisible", ()=>(0, _focus.isElementVisible)); -parcelHelpers.export(exports, "isElementVisibleAndNotHidden", ()=>(0, _focus.isElementVisibleAndNotHidden)); -parcelHelpers.export(exports, "shouldWrapFocus", ()=>(0, _focus.shouldWrapFocus)); -parcelHelpers.export(exports, "getId", ()=>(0, _getId.getId)); -parcelHelpers.export(exports, "resetIds", ()=>(0, _getId.resetIds)); -parcelHelpers.export(exports, "getNativeElementProps", ()=>(0, _getNativeElementProps.getNativeElementProps)); -parcelHelpers.export(exports, "hoistMethods", ()=>(0, _hoist.hoistMethods)); -parcelHelpers.export(exports, "unhoistMethods", ()=>(0, _hoist.unhoistMethods)); -parcelHelpers.export(exports, "hoistStatics", ()=>(0, _hoistStatics.hoistStatics)); -parcelHelpers.export(exports, "initializeComponentRef", ()=>(0, _initializeComponentRef.initializeComponentRef)); -parcelHelpers.export(exports, "initializeFocusRects", ()=>(0, _initializeFocusRects.initializeFocusRects)); -parcelHelpers.export(exports, "FocusRectsProvider", ()=>(0, _focusRectsProvider.FocusRectsProvider)); -parcelHelpers.export(exports, "FocusRects", ()=>(0, _useFocusRects.FocusRects)); -parcelHelpers.export(exports, "FocusRectsContext", ()=>(0, _useFocusRects.FocusRectsContext)); -parcelHelpers.export(exports, "useFocusRects", ()=>(0, _useFocusRects.useFocusRects)); -parcelHelpers.export(exports, "getInitials", ()=>(0, _initials.getInitials)); -parcelHelpers.export(exports, "addDirectionalKeyCode", ()=>(0, _keyboard.addDirectionalKeyCode)); -parcelHelpers.export(exports, "isDirectionalKeyCode", ()=>(0, _keyboard.isDirectionalKeyCode)); -parcelHelpers.export(exports, "removeDirectionalKeyCode", ()=>(0, _keyboard.removeDirectionalKeyCode)); -parcelHelpers.export(exports, "getLanguage", ()=>(0, _language.getLanguage)); -parcelHelpers.export(exports, "setLanguage", ()=>(0, _language.setLanguage)); -parcelHelpers.export(exports, "calculatePrecision", ()=>(0, _math.calculatePrecision)); -parcelHelpers.export(exports, "fitContentToBounds", ()=>(0, _math.fitContentToBounds)); -parcelHelpers.export(exports, "getDistanceBetweenPoints", ()=>(0, _math.getDistanceBetweenPoints)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _math.precisionRound)); -parcelHelpers.export(exports, "createMemoizer", ()=>(0, _memoize.createMemoizer)); -parcelHelpers.export(exports, "memoize", ()=>(0, _memoize.memoize)); -parcelHelpers.export(exports, "memoizeFunction", ()=>(0, _memoize.memoizeFunction)); -parcelHelpers.export(exports, "resetMemoizations", ()=>(0, _memoize.resetMemoizations)); -parcelHelpers.export(exports, "setMemoizeWeakMap", ()=>(0, _memoize.setMemoizeWeakMap)); -parcelHelpers.export(exports, "merge", ()=>(0, _merge.merge)); -parcelHelpers.export(exports, "isIOS", ()=>(0, _mobileDetector.isIOS)); -parcelHelpers.export(exports, "modalize", ()=>(0, _modalize.modalize)); -parcelHelpers.export(exports, "assign", ()=>(0, _object.assign)); -parcelHelpers.export(exports, "filteredAssign", ()=>(0, _object.filteredAssign)); -parcelHelpers.export(exports, "mapEnumByName", ()=>(0, _object.mapEnumByName)); -parcelHelpers.export(exports, "shallowCompare", ()=>(0, _object.shallowCompare)); -parcelHelpers.export(exports, "values", ()=>(0, _object.values)); -parcelHelpers.export(exports, "omit", ()=>(0, _object.omit)); -parcelHelpers.export(exports, "isMac", ()=>(0, _osDetector.isMac)); -parcelHelpers.export(exports, "hasHorizontalOverflow", ()=>(0, _overflow.hasHorizontalOverflow)); -parcelHelpers.export(exports, "hasOverflow", ()=>(0, _overflow.hasOverflow)); -parcelHelpers.export(exports, "hasVerticalOverflow", ()=>(0, _overflow.hasVerticalOverflow)); -parcelHelpers.export(exports, "anchorProperties", ()=>(0, _properties.anchorProperties)); -parcelHelpers.export(exports, "audioProperties", ()=>(0, _properties.audioProperties)); -parcelHelpers.export(exports, "baseElementEvents", ()=>(0, _properties.baseElementEvents)); -parcelHelpers.export(exports, "baseElementProperties", ()=>(0, _properties.baseElementProperties)); -parcelHelpers.export(exports, "buttonProperties", ()=>(0, _properties.buttonProperties)); -parcelHelpers.export(exports, "colGroupProperties", ()=>(0, _properties.colGroupProperties)); -parcelHelpers.export(exports, "colProperties", ()=>(0, _properties.colProperties)); -parcelHelpers.export(exports, "divProperties", ()=>(0, _properties.divProperties)); -parcelHelpers.export(exports, "formProperties", ()=>(0, _properties.formProperties)); -parcelHelpers.export(exports, "getNativeProps", ()=>(0, _properties.getNativeProps)); -parcelHelpers.export(exports, "htmlElementProperties", ()=>(0, _properties.htmlElementProperties)); -parcelHelpers.export(exports, "iframeProperties", ()=>(0, _properties.iframeProperties)); -parcelHelpers.export(exports, "imageProperties", ()=>(0, _properties.imageProperties)); -parcelHelpers.export(exports, "imgProperties", ()=>(0, _properties.imgProperties)); -parcelHelpers.export(exports, "inputProperties", ()=>(0, _properties.inputProperties)); -parcelHelpers.export(exports, "labelProperties", ()=>(0, _properties.labelProperties)); -parcelHelpers.export(exports, "liProperties", ()=>(0, _properties.liProperties)); -parcelHelpers.export(exports, "olProperties", ()=>(0, _properties.olProperties)); -parcelHelpers.export(exports, "optionProperties", ()=>(0, _properties.optionProperties)); -parcelHelpers.export(exports, "selectProperties", ()=>(0, _properties.selectProperties)); -parcelHelpers.export(exports, "tableProperties", ()=>(0, _properties.tableProperties)); -parcelHelpers.export(exports, "tdProperties", ()=>(0, _properties.tdProperties)); -parcelHelpers.export(exports, "textAreaProperties", ()=>(0, _properties.textAreaProperties)); -parcelHelpers.export(exports, "thProperties", ()=>(0, _properties.thProperties)); -parcelHelpers.export(exports, "trProperties", ()=>(0, _properties.trProperties)); -parcelHelpers.export(exports, "videoProperties", ()=>(0, _properties.videoProperties)); -parcelHelpers.export(exports, "composeRenderFunction", ()=>(0, _composeRenderFunction.composeRenderFunction)); -parcelHelpers.export(exports, "getResourceUrl", ()=>(0, _resources.getResourceUrl)); -parcelHelpers.export(exports, "setBaseUrl", ()=>(0, _resources.setBaseUrl)); -parcelHelpers.export(exports, "getRTL", ()=>(0, _rtl.getRTL)); -parcelHelpers.export(exports, "getRTLSafeKeyCode", ()=>(0, _rtl.getRTLSafeKeyCode)); -parcelHelpers.export(exports, "setRTL", ()=>(0, _rtl.setRTL)); -parcelHelpers.export(exports, "safeRequestAnimationFrame", ()=>(0, _safeRequestAnimationFrame.safeRequestAnimationFrame)); -parcelHelpers.export(exports, "safeSetTimeout", ()=>(0, _safeSetTimeout.safeSetTimeout)); -parcelHelpers.export(exports, "DATA_IS_SCROLLABLE_ATTRIBUTE", ()=>(0, _scroll.DATA_IS_SCROLLABLE_ATTRIBUTE)); -parcelHelpers.export(exports, "allowOverscrollOnElement", ()=>(0, _scroll.allowOverscrollOnElement)); -parcelHelpers.export(exports, "allowScrollOnElement", ()=>(0, _scroll.allowScrollOnElement)); -parcelHelpers.export(exports, "disableBodyScroll", ()=>(0, _scroll.disableBodyScroll)); -parcelHelpers.export(exports, "enableBodyScroll", ()=>(0, _scroll.enableBodyScroll)); -parcelHelpers.export(exports, "findScrollableParent", ()=>(0, _scroll.findScrollableParent)); -parcelHelpers.export(exports, "getScrollbarWidth", ()=>(0, _scroll.getScrollbarWidth)); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>(0, _index.SELECTION_CHANGE)); -parcelHelpers.export(exports, "SELECTION_ITEMS_CHANGE", ()=>(0, _index.SELECTION_ITEMS_CHANGE)); -parcelHelpers.export(exports, "Selection", ()=>(0, _index.Selection)); -parcelHelpers.export(exports, "SelectionDirection", ()=>(0, _index.SelectionDirection)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _index.SelectionMode)); -parcelHelpers.export(exports, "format", ()=>(0, _string.format)); -parcelHelpers.export(exports, "styled", ()=>(0, _styled.styled)); -parcelHelpers.export(exports, "resetControlledWarnings", ()=>(0, _warn.resetControlledWarnings)); -parcelHelpers.export(exports, "setWarningCallback", ()=>(0, _warn.setWarningCallback)); -parcelHelpers.export(exports, "warn", ()=>(0, _warn.warn)); -parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>(0, _warn.warnConditionallyRequiredProps)); -parcelHelpers.export(exports, "warnControlledUsage", ()=>(0, _warn.warnControlledUsage)); -parcelHelpers.export(exports, "warnDeprecations", ()=>(0, _warn.warnDeprecations)); -parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>(0, _warn.warnMutuallyExclusive)); -parcelHelpers.export(exports, "isIE11", ()=>(0, _ie11Detector.isIE11)); -parcelHelpers.export(exports, "getPropsWithDefaults", ()=>(0, _getPropsWithDefaults.getPropsWithDefaults)); -parcelHelpers.export(exports, "setFocusVisibility", ()=>(0, _setFocusVisibility.setFocusVisibility)); -parcelHelpers.export(exports, "IsFocusVisibleClassName", ()=>(0, _setFocusVisibility.IsFocusVisibleClassName)); -parcelHelpers.export(exports, "canUseDOM", ()=>(0, _canUseDOM.canUseDOM)); -// eslint-disable-next-line deprecation/deprecation -parcelHelpers.export(exports, "setSSR", ()=>(0, _setSSR.setSSR)); -parcelHelpers.export(exports, "createMergedRef", ()=>(0, _createMergedRef.createMergedRef)); -parcelHelpers.export(exports, "useIsomorphicLayoutEffect", ()=>(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>(0, _shadowDom.MergeStylesRootProvider)); -parcelHelpers.export(exports, "MergeStylesShadowRootContext", ()=>(0, _shadowDom.MergeStylesShadowRootContext)); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>(0, _shadowDom.MergeStylesShadowRootProvider)); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>(0, _shadowDom.useAdoptedStylesheet)); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>(0, _shadowDom.useAdoptedStylesheetEx)); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>(0, _shadowDom.useHasMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>(0, _shadowDom.useMergeStylesHooks)); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>(0, _shadowDom.useMergeStylesRootStylesheets)); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>(0, _shadowDom.useMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useShadowConfig", ()=>(0, _shadowDom.useShadowConfig)); -parcelHelpers.export(exports, "useStyled", ()=>(0, _shadowDom.useStyled)); -var _async = require("./Async"); -var _autoScroll = require("./AutoScroll"); -var _baseComponent = require("./BaseComponent"); -var _delayedRender = require("./DelayedRender"); -var _eventGroup = require("./EventGroup"); -var _fabricPerformance = require("./FabricPerformance"); -var _globalSettings = require("./GlobalSettings"); -var _keyCodes = require("./KeyCodes"); -var _rectangle = require("./Rectangle"); -var _appendFunction = require("./appendFunction"); -var _aria = require("./aria"); -var _array = require("./array"); -var _asAsync = require("./asAsync"); -var _assertNever = require("./assertNever"); -var _classNamesFunction = require("./classNamesFunction"); -var _composeComponentAs = require("./componentAs/composeComponentAs"); -var _controlled = require("./controlled"); -var _css = require("./css"); -var _customizations = require("./customizations/Customizations"); -var _customizer = require("./customizations/Customizer"); -var _customizerContext = require("./customizations/CustomizerContext"); -var _customizable = require("./customizations/customizable"); -var _useCustomizationSettings = require("./customizations/useCustomizationSettings"); -var _mergeCustomizations = require("./customizations/mergeCustomizations"); -var _mergeSettings = require("./customizations/mergeSettings"); -var _dom = require("./dom"); -var _extendComponent = require("./extendComponent"); -var _focus = require("./focus"); -var _getId = require("./getId"); -var _getNativeElementProps = require("./getNativeElementProps"); -var _hoist = require("./hoist"); -var _hoistStatics = require("./hoistStatics"); -var _initializeComponentRef = require("./initializeComponentRef"); -var _initializeFocusRects = require("./initializeFocusRects"); -var _focusRectsProvider = require("./FocusRectsProvider"); -var _useFocusRects = require("./useFocusRects"); -var _initials = require("./initials"); -var _keyboard = require("./keyboard"); -var _language = require("./language"); -var _math = require("./math"); -var _memoize = require("./memoize"); -var _merge = require("./merge"); -var _mobileDetector = require("./mobileDetector"); -var _modalize = require("./modalize"); -var _object = require("./object"); -var _osDetector = require("./osDetector"); -var _overflow = require("./overflow"); -var _properties = require("./properties"); -var _composeRenderFunction = require("./renderFunction/composeRenderFunction"); -var _resources = require("./resources"); -var _rtl = require("./rtl"); -var _safeRequestAnimationFrame = require("./safeRequestAnimationFrame"); -var _safeSetTimeout = require("./safeSetTimeout"); -var _scroll = require("./scroll"); -var _index = require("./selection/index"); -var _string = require("./string"); -var _styled = require("./styled"); -var _warn = require("./warn"); -var _ie11Detector = require("./ie11Detector"); -var _getPropsWithDefaults = require("./getPropsWithDefaults"); -var _setFocusVisibility = require("./setFocusVisibility"); -var _canUseDOM = require("./dom/canUseDOM"); -var _setSSR = require("./dom/setSSR"); -var _createMergedRef = require("./createMergedRef"); -var _useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect"); -var _version = require("./version"); -var _shadowDom = require("./shadowDom"); - -},{"./Async":"bcsew","./AutoScroll":"etMgU","./BaseComponent":"iLCoe","./DelayedRender":"jKQeJ","./EventGroup":"0TvPH","./FabricPerformance":"hiYVs","./GlobalSettings":"6x3RK","./KeyCodes":"eQoHk","./Rectangle":"hkyht","./appendFunction":"8Ic5h","./aria":"2p7Pt","./array":"1Pspi","./asAsync":"jPOCb","./assertNever":"l66AW","./classNamesFunction":"lKbNl","./componentAs/composeComponentAs":"7HNhY","./controlled":"5Lj2y","./css":"dmVvk","./customizations/Customizations":"eQS4T","./customizations/Customizer":"5lXfh","./customizations/CustomizerContext":"aB8eN","./customizations/customizable":"7RolT","./customizations/useCustomizationSettings":"hUUmS","./customizations/mergeCustomizations":"yo2of","./customizations/mergeSettings":"c4Gl8","./dom":"QMA5I","./extendComponent":"iAatf","./focus":"vgfwi","./getId":"kDauC","./getNativeElementProps":"iMQBc","./hoist":"49HjY","./hoistStatics":"4OPmM","./initializeComponentRef":"8tu37","./initializeFocusRects":"lLcL3","./FocusRectsProvider":"7Mxbq","./useFocusRects":"hYOqE","./initials":"6G2ZZ","./keyboard":"1QqA5","./language":"7welB","./math":"9UcDS","./memoize":"cqPyR","./merge":"43b5Z","./mobileDetector":"9ucFx","./modalize":"8iyQK","./object":"celWf","./osDetector":"fxaey","./overflow":"gxEfk","./properties":"hUmZ9","./renderFunction/composeRenderFunction":"hnUBo","./resources":"bTWnR","./rtl":"gRlx4","./safeRequestAnimationFrame":"ghqZY","./safeSetTimeout":"2wmgr","./scroll":"c99qU","./selection/index":"hAgvp","./string":"996Ia","./styled":"bwELv","./warn":"dpie2","./ie11Detector":"c5nmJ","./getPropsWithDefaults":"lBZmc","./setFocusVisibility":"2d3GF","./dom/canUseDOM":"iFHeV","./dom/setSSR":"6DBuh","./createMergedRef":"e5kFM","./useIsomorphicLayoutEffect":"88Q1R","./version":"e49Gp","./shadowDom":"dU66z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bcsew":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Async", ()=>Async); -var _getWindow = require("./dom/getWindow"); -/** - * Bugs often appear in async code when stuff gets disposed, but async operations don't get canceled. - * This Async helper class solves these issues by tying async code to the lifetime of a disposable object. - * - * Usage: Anything class extending from BaseModel can access this helper via this.async. Otherwise create a - * new instance of the class and remember to call dispose() during your code's dispose handler. - * - * @public - */ var Async = /** @class */ function() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - function Async(parent, onError) { + } catch (e) { + } + function setVersion(packageName, packageVersion) { + if (typeof _win !== "undefined") { + var packages = _win.__packages__ = _win.__packages__ || {}; + if (!packages[packageName] || !packagesCache[packageName]) { + packagesCache[packageName] = packageVersion; + var versions = packages[packageName] = packages[packageName] || []; + versions.push(packageVersion); + } + } + } + setVersion("@fluentui/set-version", "6.0.0"); + function canUseDOM() { + return ( + // eslint-disable-next-line no-restricted-globals + typeof window !== "undefined" && !!// eslint-disable-next-line no-restricted-globals, @typescript-eslint/no-deprecated + (window.document && window.document.createElement) + ); + } + var _window$1 = void 0; + try { + _window$1 = window; + } catch (e) { + } + function getWindow(rootElement) { + if (!canUseDOM() || typeof _window$1 === "undefined") { + return void 0; + } else { + var el = rootElement; + return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window$1; + } + } + var Async = ( + /** @class */ + (function() { + function Async2(parent, onError) { this._timeoutIds = null; this._immediateIds = null; this._intervalIds = null; @@ -63432,216 +36034,185 @@ var _getWindow = require("./dom/getWindow"); this._parent = parent || null; this._onErrorHandler = onError; this._noop = function() { - /* do nothing */ }; - } - /** - * Dispose function, clears all async operations. - */ Async.prototype.dispose = function() { - var id; + }; + } + Async2.prototype.dispose = function() { + var id2; this._isDisposed = true; this._parent = null; - // Clear timeouts. if (this._timeoutIds) { - for(id in this._timeoutIds)if (this._timeoutIds.hasOwnProperty(id)) this.clearTimeout(parseInt(id, 10)); - this._timeoutIds = null; + for (id2 in this._timeoutIds) { + if (this._timeoutIds.hasOwnProperty(id2)) { + this.clearTimeout(parseInt(id2, 10)); + } + } + this._timeoutIds = null; } - // Clear immediates. if (this._immediateIds) { - for(id in this._immediateIds)if (this._immediateIds.hasOwnProperty(id)) this.clearImmediate(parseInt(id, 10)); - this._immediateIds = null; + for (id2 in this._immediateIds) { + if (this._immediateIds.hasOwnProperty(id2)) { + this.clearImmediate(parseInt(id2, 10)); + } + } + this._immediateIds = null; } - // Clear intervals. if (this._intervalIds) { - for(id in this._intervalIds)if (this._intervalIds.hasOwnProperty(id)) this.clearInterval(parseInt(id, 10)); - this._intervalIds = null; + for (id2 in this._intervalIds) { + if (this._intervalIds.hasOwnProperty(id2)) { + this.clearInterval(parseInt(id2, 10)); + } + } + this._intervalIds = null; } - // Clear animation frames. if (this._animationFrameIds) { - for(id in this._animationFrameIds)if (this._animationFrameIds.hasOwnProperty(id)) this.cancelAnimationFrame(parseInt(id, 10)); - this._animationFrameIds = null; + for (id2 in this._animationFrameIds) { + if (this._animationFrameIds.hasOwnProperty(id2)) { + this.cancelAnimationFrame(parseInt(id2, 10)); + } + } + this._animationFrameIds = null; } - }; - /** - * SetTimeout override, which will auto cancel the timeout during dispose. - * @param callback - Callback to execute. - * @param duration - Duration in milliseconds. - * @returns The setTimeout id. - */ Async.prototype.setTimeout = function(callback, duration) { + }; + Async2.prototype.setTimeout = function(callback, duration) { var _this = this; var timeoutId = 0; if (!this._isDisposed) { - if (!this._timeoutIds) this._timeoutIds = {}; - timeoutId = setTimeout(function() { - // Time to execute the timeout, enqueue it as a foreground task to be executed. - try { - // Now delete the record and call the callback. - if (_this._timeoutIds) delete _this._timeoutIds[timeoutId]; - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }, duration); - this._timeoutIds[timeoutId] = true; + if (!this._timeoutIds) { + this._timeoutIds = {}; + } + timeoutId = setTimeout(function() { + try { + if (_this._timeoutIds) { + delete _this._timeoutIds[timeoutId]; + } + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }, duration); + this._timeoutIds[timeoutId] = true; } return timeoutId; - }; - /** - * Clears the timeout. - * @param id - Id to cancel. - */ Async.prototype.clearTimeout = function(id) { - if (this._timeoutIds && this._timeoutIds[id]) { - clearTimeout(id); - delete this._timeoutIds[id]; - } - }; - /** - * SetImmediate override, which will auto cancel the immediate during dispose. - * @param callback - Callback to execute. - * @param targetElement - Optional target element to use for identifying the correct window. - * @returns The setTimeout id. - */ Async.prototype.setImmediate = function(callback, targetElement) { + }; + Async2.prototype.clearTimeout = function(id2) { + if (this._timeoutIds && this._timeoutIds[id2]) { + clearTimeout(id2); + delete this._timeoutIds[id2]; + } + }; + Async2.prototype.setImmediate = function(callback, targetElement) { var _this = this; var immediateId = 0; - var win = (0, _getWindow.getWindow)(targetElement); + var win = getWindow(targetElement); if (!this._isDisposed) { - if (!this._immediateIds) this._immediateIds = {}; - var setImmediateCallback = function() { - // Time to execute the timeout, enqueue it as a foreground task to be executed. - try { - // Now delete the record and call the callback. - if (_this._immediateIds) delete _this._immediateIds[immediateId]; - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }; - immediateId = win.setTimeout(setImmediateCallback, 0); - this._immediateIds[immediateId] = true; + if (!this._immediateIds) { + this._immediateIds = {}; + } + var setImmediateCallback = function() { + try { + if (_this._immediateIds) { + delete _this._immediateIds[immediateId]; + } + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }; + immediateId = win.setTimeout(setImmediateCallback, 0); + this._immediateIds[immediateId] = true; } return immediateId; - }; - /** - * Clears the immediate. - * @param id - Id to cancel. - * @param targetElement - Optional target element to use for identifying the correct window. - */ Async.prototype.clearImmediate = function(id, targetElement) { - var win = (0, _getWindow.getWindow)(targetElement); - if (this._immediateIds && this._immediateIds[id]) { - win.clearTimeout(id); - delete this._immediateIds[id]; - } - }; - /** - * SetInterval override, which will auto cancel the timeout during dispose. - * @param callback - Callback to execute. - * @param duration - Duration in milliseconds. - * @returns The setTimeout id. - */ Async.prototype.setInterval = function(callback, duration) { + }; + Async2.prototype.clearImmediate = function(id2, targetElement) { + var win = getWindow(targetElement); + if (this._immediateIds && this._immediateIds[id2]) { + win.clearTimeout(id2); + delete this._immediateIds[id2]; + } + }; + Async2.prototype.setInterval = function(callback, duration) { var _this = this; var intervalId = 0; if (!this._isDisposed) { - if (!this._intervalIds) this._intervalIds = {}; - intervalId = setInterval(function() { - // Time to execute the interval callback, enqueue it as a foreground task to be executed. - try { - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }, duration); - this._intervalIds[intervalId] = true; + if (!this._intervalIds) { + this._intervalIds = {}; + } + intervalId = setInterval(function() { + try { + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }, duration); + this._intervalIds[intervalId] = true; } return intervalId; - }; - /** - * Clears the interval. - * @param id - Id to cancel. - */ Async.prototype.clearInterval = function(id) { - if (this._intervalIds && this._intervalIds[id]) { - clearInterval(id); - delete this._intervalIds[id]; - } - }; - /** - * Creates a function that, when executed, will only call the func function at most once per - * every wait milliseconds. Provide an options object to indicate that func should be invoked - * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled - * function will return the result of the last func call. - * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the throttled function is invoked more than once during the wait timeout. - * - * @param func - The function to throttle. - * @param wait - The number of milliseconds to throttle executions to. Defaults to 0. - * @param options - The options object. - * @returns The new throttled function. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - Async.prototype.throttle = function(func, wait, options) { + }; + Async2.prototype.clearInterval = function(id2) { + if (this._intervalIds && this._intervalIds[id2]) { + clearInterval(id2); + delete this._intervalIds[id2]; + } + }; + Async2.prototype.throttle = function(func, wait, options2) { var _this = this; - if (this._isDisposed) return this._noop; + if (this._isDisposed) { + return this._noop; + } var waitMS = wait || 0; var leading = true; var trailing = true; var lastExecuteTime = 0; var lastResult; - // eslint-disable-next-line @typescript-eslint/no-explicit-any var lastArgs; var timeoutId = null; - if (options && typeof options.leading === 'boolean') leading = options.leading; - if (options && typeof options.trailing === 'boolean') trailing = options.trailing; + if (options2 && typeof options2.leading === "boolean") { + leading = options2.leading; + } + if (options2 && typeof options2.trailing === "boolean") { + trailing = options2.trailing; + } var callback = function(userCall) { - var now = Date.now(); - var delta = now - lastExecuteTime; - var waitLength = leading ? waitMS - delta : waitMS; - if (delta >= waitMS && (!userCall || leading)) { - lastExecuteTime = now; - if (timeoutId) { - _this.clearTimeout(timeoutId); - timeoutId = null; - } - lastResult = func.apply(_this._parent, lastArgs); - } else if (timeoutId === null && trailing) timeoutId = _this.setTimeout(callback, waitLength); - return lastResult; - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var resultFunction = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - lastArgs = args; - return callback(true); - }; + var now2 = Date.now(); + var delta = now2 - lastExecuteTime; + var waitLength = leading ? waitMS - delta : waitMS; + if (delta >= waitMS && (!userCall || leading)) { + lastExecuteTime = now2; + if (timeoutId) { + _this.clearTimeout(timeoutId); + timeoutId = null; + } + lastResult = func.apply(_this._parent, lastArgs); + } else if (timeoutId === null && trailing) { + timeoutId = _this.setTimeout(callback, waitLength); + } + return lastResult; + }; + var resultFunction = (function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + lastArgs = args; + return callback(true); + }); return resultFunction; - }; - /** - * Creates a function that will delay the execution of func until after wait milliseconds have - * elapsed since the last time it was invoked. Provide an options object to indicate that func - * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls - * to the debounced function will return the result of the last func call. - * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the debounced function is invoked more than once during the wait - * timeout. - * - * @param func - The function to debounce. - * @param wait - The number of milliseconds to delay. - * @param options - The options object. - * @returns The new debounced function. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - Async.prototype.debounce = function(func, wait, options) { + }; + Async2.prototype.debounce = function(func, wait, options2) { var _this = this; if (this._isDisposed) { - var noOpFunction = function() { - /** Do nothing */ }; - noOpFunction.cancel = function() { - return; - }; - noOpFunction.flush = function() { - return null; - }; - noOpFunction.pending = function() { - return false; - }; - return noOpFunction; + var noOpFunction = (function() { + }); + noOpFunction.cancel = function() { + return; + }; + noOpFunction.flush = (function() { + return null; + }); + noOpFunction.pending = function() { + return false; + }; + return noOpFunction; } var waitMS = wait || 0; var leading = false; @@ -63650,1668 +36221,806 @@ var _getWindow = require("./dom/getWindow"); var lastCallTime = 0; var lastExecuteTime = Date.now(); var lastResult; - // eslint-disable-next-line @typescript-eslint/no-explicit-any var lastArgs; var timeoutId = null; - if (options && typeof options.leading === 'boolean') leading = options.leading; - if (options && typeof options.trailing === 'boolean') trailing = options.trailing; - if (options && typeof options.maxWait === 'number' && !isNaN(options.maxWait)) maxWait = options.maxWait; - var markExecuted = function(time) { - if (timeoutId) { - _this.clearTimeout(timeoutId); - timeoutId = null; - } - lastExecuteTime = time; + if (options2 && typeof options2.leading === "boolean") { + leading = options2.leading; + } + if (options2 && typeof options2.trailing === "boolean") { + trailing = options2.trailing; + } + if (options2 && typeof options2.maxWait === "number" && !isNaN(options2.maxWait)) { + maxWait = options2.maxWait; + } + var markExecuted = function(time2) { + if (timeoutId) { + _this.clearTimeout(timeoutId); + timeoutId = null; + } + lastExecuteTime = time2; }; - var invokeFunction = function(time) { - markExecuted(time); - lastResult = func.apply(_this._parent, lastArgs); + var invokeFunction = function(time2) { + markExecuted(time2); + lastResult = func.apply(_this._parent, lastArgs); }; var callback = function(userCall) { - var now = Date.now(); - var executeImmediately = false; - if (userCall) { - if (leading && now - lastCallTime >= waitMS) executeImmediately = true; - lastCallTime = now; - } - var delta = now - lastCallTime; - var waitLength = waitMS - delta; - var maxWaitDelta = now - lastExecuteTime; - var maxWaitExpired = false; - if (maxWait !== null) { - // maxWait only matters when there is a pending callback - if (maxWaitDelta >= maxWait && timeoutId) maxWaitExpired = true; - else waitLength = Math.min(waitLength, maxWait - maxWaitDelta); + var now2 = Date.now(); + var executeImmediately = false; + if (userCall) { + if (leading && now2 - lastCallTime >= waitMS) { + executeImmediately = true; + } + lastCallTime = now2; + } + var delta = now2 - lastCallTime; + var waitLength = waitMS - delta; + var maxWaitDelta = now2 - lastExecuteTime; + var maxWaitExpired = false; + if (maxWait !== null) { + if (maxWaitDelta >= maxWait && timeoutId) { + maxWaitExpired = true; + } else { + waitLength = Math.min(waitLength, maxWait - maxWaitDelta); } - if (delta >= waitMS || maxWaitExpired || executeImmediately) invokeFunction(now); - else if ((timeoutId === null || !userCall) && trailing) timeoutId = _this.setTimeout(callback, waitLength); - return lastResult; + } + if (delta >= waitMS || maxWaitExpired || executeImmediately) { + invokeFunction(now2); + } else if ((timeoutId === null || !userCall) && trailing) { + timeoutId = _this.setTimeout(callback, waitLength); + } + return lastResult; }; var pending = function() { - return !!timeoutId; + return !!timeoutId; }; var cancel = function() { - if (pending()) // Mark the debounced function as having executed + if (pending()) { markExecuted(Date.now()); - }; - var flush = function() { - if (pending()) invokeFunction(Date.now()); - return lastResult; - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var resultFunction = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - lastArgs = args; - return callback(true); - }; + } + }; + var flush2 = function() { + if (pending()) { + invokeFunction(Date.now()); + } + return lastResult; + }; + var resultFunction = (function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + lastArgs = args; + return callback(true); + }); resultFunction.cancel = cancel; - resultFunction.flush = flush; + resultFunction.flush = flush2; resultFunction.pending = pending; return resultFunction; - }; - Async.prototype.requestAnimationFrame = function(callback, targetElement) { + }; + Async2.prototype.requestAnimationFrame = function(callback, targetElement) { var _this = this; var animationFrameId = 0; - var win = (0, _getWindow.getWindow)(targetElement); + var win = getWindow(targetElement); if (!this._isDisposed) { - if (!this._animationFrameIds) this._animationFrameIds = {}; - var animationFrameCallback = function() { - try { - // Now delete the record and call the callback. - if (_this._animationFrameIds) delete _this._animationFrameIds[animationFrameId]; - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }; - animationFrameId = win.requestAnimationFrame ? win.requestAnimationFrame(animationFrameCallback) : win.setTimeout(animationFrameCallback, 0); - this._animationFrameIds[animationFrameId] = true; + if (!this._animationFrameIds) { + this._animationFrameIds = {}; + } + var animationFrameCallback = function() { + try { + if (_this._animationFrameIds) { + delete _this._animationFrameIds[animationFrameId]; + } + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }; + animationFrameId = win.requestAnimationFrame ? win.requestAnimationFrame(animationFrameCallback) : win.setTimeout(animationFrameCallback, 0); + this._animationFrameIds[animationFrameId] = true; } return animationFrameId; - }; - Async.prototype.cancelAnimationFrame = function(id, targetElement) { - var win = (0, _getWindow.getWindow)(targetElement); - if (this._animationFrameIds && this._animationFrameIds[id]) { - win.cancelAnimationFrame ? win.cancelAnimationFrame(id) : win.clearTimeout(id); - delete this._animationFrameIds[id]; - } - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Async.prototype._logError = function(e) { - if (this._onErrorHandler) this._onErrorHandler(e); - }; - return Async; -}(); - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aI1a8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to get the window object. The helper will make sure to use a cached variable - * of "window", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the - * window object won't match the "global" window object, and for these scenarios, you should - * pass in an element hosted within the popup. - * - * @public - */ parcelHelpers.export(exports, "getWindow", ()=>getWindow); -var _canUseDOM = require("./canUseDOM"); -var _window = undefined; -// Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window" -// hits a memory leak, whereas aliasing it and calling "typeof _window" does not. -// Caching the window value at the file scope lets us minimize the impact. -try { - // eslint-disable-next-line no-restricted-globals - _window = window; -} catch (e) { -/* no-op */ } -function getWindow(rootElement) { - if (!(0, _canUseDOM.canUseDOM)() || typeof _window === 'undefined') return undefined; - else { - var el = rootElement; - return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window; - } -} - -},{"./canUseDOM":"iFHeV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iFHeV":[function(require,module,exports,__globalThis) { -/** - * Verifies if an application can use DOM. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "canUseDOM", ()=>canUseDOM); -function canUseDOM() { - return(// eslint-disable-next-line no-restricted-globals - typeof window !== 'undefined' && !!// eslint-disable-next-line no-restricted-globals, deprecation/deprecation - (window.document && window.document.createElement)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"etMgU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AutoScroll", ()=>AutoScroll); -var _eventGroup = require("./EventGroup"); -var _scroll = require("./scroll"); -var _getRect = require("./dom/getRect"); -var _dom = require("./dom"); -var SCROLL_ITERATION_DELAY = 16; -var SCROLL_GUTTER = 100; -var MAX_SCROLL_VELOCITY = 15; -/** - * AutoScroll simply hooks up mouse events given a parent element, and scrolls the container - * up/down depending on how close the mouse is to the top/bottom of the container. - * - * Once you don't want autoscroll any more, just dispose the helper and it will unhook events. - * - * @public - * {@docCategory AutoScroll} - */ var AutoScroll = /** @class */ function() { - function AutoScroll(element, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _dom.getWindow)(element); - this._events = new (0, _eventGroup.EventGroup)(this); - this._scrollableParent = (0, _scroll.findScrollableParent)(element); - this._incrementScroll = this._incrementScroll.bind(this); - this._scrollRect = (0, _getRect.getRect)(this._scrollableParent, theWin); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - if (this._scrollableParent === theWin) this._scrollableParent = theWin.document.body; - if (this._scrollableParent) { - this._events.on(theWin, 'mousemove', this._onMouseMove, true); - this._events.on(theWin, 'touchmove', this._onTouchMove, true); - } - } - AutoScroll.prototype.dispose = function() { - this._events.dispose(); - this._stopScroll(); - }; - AutoScroll.prototype._onMouseMove = function(ev) { - this._computeScrollVelocity(ev); - }; - AutoScroll.prototype._onTouchMove = function(ev) { - if (ev.touches.length > 0) this._computeScrollVelocity(ev); - }; - AutoScroll.prototype._computeScrollVelocity = function(ev) { - if (!this._scrollRect) return; - var clientX; - var clientY; - if ('clientX' in ev) { - clientX = ev.clientX; - clientY = ev.clientY; - } else { - clientX = ev.touches[0].clientX; - clientY = ev.touches[0].clientY; - } - var scrollRectTop = this._scrollRect.top; - var scrollRectLeft = this._scrollRect.left; - var scrollClientBottom = scrollRectTop + this._scrollRect.height - SCROLL_GUTTER; - var scrollClientRight = scrollRectLeft + this._scrollRect.width - SCROLL_GUTTER; - // variables to use for alternating scroll direction - var scrollRect; - var clientDirection; - var scrollClient; - // if either of these conditions are met we are scrolling vertically else horizontally - if (clientY < scrollRectTop + SCROLL_GUTTER || clientY > scrollClientBottom) { - clientDirection = clientY; - scrollRect = scrollRectTop; - scrollClient = scrollClientBottom; - this._isVerticalScroll = true; - } else { - clientDirection = clientX; - scrollRect = scrollRectLeft; - scrollClient = scrollClientRight; - this._isVerticalScroll = false; - } - // calculate scroll velocity and direction - if (clientDirection < scrollRect + SCROLL_GUTTER) this._scrollVelocity = Math.max(-MAX_SCROLL_VELOCITY, -MAX_SCROLL_VELOCITY * ((SCROLL_GUTTER - (clientDirection - scrollRect)) / SCROLL_GUTTER)); - else if (clientDirection > scrollClient) this._scrollVelocity = Math.min(MAX_SCROLL_VELOCITY, MAX_SCROLL_VELOCITY * ((clientDirection - scrollClient) / SCROLL_GUTTER)); - else this._scrollVelocity = 0; - if (this._scrollVelocity) this._startScroll(); - else this._stopScroll(); - }; - AutoScroll.prototype._startScroll = function() { - if (!this._timeoutId) this._incrementScroll(); - }; - AutoScroll.prototype._incrementScroll = function() { - if (this._scrollableParent) { - if (this._isVerticalScroll) this._scrollableParent.scrollTop += Math.round(this._scrollVelocity); - else this._scrollableParent.scrollLeft += Math.round(this._scrollVelocity); - } - this._timeoutId = setTimeout(this._incrementScroll, SCROLL_ITERATION_DELAY); - }; - AutoScroll.prototype._stopScroll = function() { - if (this._timeoutId) { - clearTimeout(this._timeoutId); - delete this._timeoutId; - } - }; - return AutoScroll; -}(); - -},{"./EventGroup":"0TvPH","./scroll":"c99qU","./dom/getRect":"cPL7s","./dom":"QMA5I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0TvPH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "EventGroup", ()=>EventGroup); -var _dom = require("./dom"); -var _object = require("./object"); -var EventGroup = /** @class */ function() { - /** parent: the context in which events attached to non-HTMLElements are called */ function EventGroup(parent) { - this._id = EventGroup._uniqueId++; - this._parent = parent; - this._eventRecords = []; + }; + Async2.prototype.cancelAnimationFrame = function(id2, targetElement) { + var win = getWindow(targetElement); + if (this._animationFrameIds && this._animationFrameIds[id2]) { + win.cancelAnimationFrame ? win.cancelAnimationFrame(id2) : win.clearTimeout(id2); + delete this._animationFrameIds[id2]; + } + }; + Async2.prototype._logError = function(e) { + if (this._onErrorHandler) { + this._onErrorHandler(e); + } + }; + return Async2; + })() + ); + function isVirtualElement(element2) { + return element2 && !!element2._virtual; + } + function getVirtualParent(child) { + var parent; + if (child && isVirtualElement(child)) { + parent = child._virtual.parent; + } + return parent; + } + function getParent(child, allowVirtualParents) { + var _a2, _b2; + if (allowVirtualParents === void 0) { + allowVirtualParents = true; + } + if (!child) { + return null; + } + var parent = allowVirtualParents && getVirtualParent(child); + if (parent) { + return parent; + } + if (typeof child.assignedElements !== "function" && ((_a2 = child.assignedSlot) === null || _a2 === void 0 ? void 0 : _a2.parentNode)) { + return child.assignedSlot; + } else if (((_b2 = child.parentNode) === null || _b2 === void 0 ? void 0 : _b2.nodeType) === 11) { + return child.parentNode.host; + } else { + return child.parentNode; + } + } + function elementContains(parent, child, allowVirtualParents) { + if (allowVirtualParents === void 0) { + allowVirtualParents = true; } - /** For IE8, bubbleEvent is ignored here and must be dealt with by the handler. - * Events raised here by default have bubbling set to false and cancelable set to true. - * This applies also to built-in events being raised manually here on HTMLElements, - * which may lead to unexpected behavior if it differs from the defaults. - * - */ EventGroup.raise = function(target, eventName, eventArgs, bubbleEvent, doc) { - var retVal; - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _dom.getDocument)(); - if (EventGroup._isElement(target)) { - if (typeof theDoc !== 'undefined' && theDoc.createEvent) { - var ev = theDoc.createEvent('HTMLEvents'); - // eslint-disable-next-line deprecation/deprecation - ev.initEvent(eventName, bubbleEvent || false, true); - (0, _object.assign)(ev, eventArgs); - retVal = target.dispatchEvent(ev); - } else if (typeof theDoc !== 'undefined' && theDoc.createEventObject) { - // IE8 - var evObj = theDoc.createEventObject(eventArgs); - // cannot set cancelBubble on evObj, fireEvent will overwrite it - target.fireEvent('on' + eventName, evObj); - } - } else // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore -- FIXME: strictBindCallApply error - https://github.com/microsoft/fluentui/issues/17331 - while(target && retVal !== false){ - var events = target.__events__; - var eventRecords = events ? events[eventName] : null; - if (eventRecords) { - for(var id in eventRecords)if (eventRecords.hasOwnProperty(id)) { - var eventRecordList = eventRecords[id]; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore -- FIXME: strictBindCallApply error - https://github.com/microsoft/fluentui/issues/17331 - for(var listIndex = 0; retVal !== false && listIndex < eventRecordList.length; listIndex++){ - var record = eventRecordList[listIndex]; - if (record.objectCallback) retVal = record.objectCallback.call(record.parent, eventArgs); - } - } - } - // If the target has a parent, bubble the event up. - target = bubbleEvent ? target.parent : null; - } - return retVal; - }; - EventGroup.isObserved = function(target, eventName) { - var events = target && target.__events__; - return !!events && !!events[eventName]; - }; - /** Check to see if the target has declared support of the given event. */ EventGroup.isDeclared = function(target, eventName) { - var declaredEvents = target && target.__declaredEvents; - return !!declaredEvents && !!declaredEvents[eventName]; - }; - EventGroup.stopPropagation = function(event) { - if (event.stopPropagation) event.stopPropagation(); - else // IE8 - event.cancelBubble = true; - }; - EventGroup._isElement = function(target) { - return !!target && (!!target.addEventListener || typeof HTMLElement !== 'undefined' && target instanceof HTMLElement); - }; - EventGroup.prototype.dispose = function() { - if (!this._isDisposed) { - this._isDisposed = true; - this.off(); - this._parent = null; - } - }; - /** On the target, attach a set of events, where the events object is a name to function mapping. */ EventGroup.prototype.onAll = function(target, events, useCapture) { - for(var eventName in events)if (events.hasOwnProperty(eventName)) this.on(target, eventName, events[eventName], useCapture); - }; - /** - * On the target, attach an event whose handler will be called in the context of the parent - * of this instance of EventGroup. - */ EventGroup.prototype.on = function(target, eventName, callback, options) { - var _this = this; - if (eventName.indexOf(',') > -1) { - var events = eventName.split(/[ ,]+/); - for(var i = 0; i < events.length; i++)this.on(target, events[i], callback, options); - } else { - var parent_1 = this._parent; - var eventRecord = { - target: target, - eventName: eventName, - parent: parent_1, - callback: callback, - options: options - }; - // Initialize and wire up the record on the target, so that it can call the callback if the event fires. - var events = target.__events__ = target.__events__ || {}; - events[eventName] = events[eventName] || { - count: 0 - }; - events[eventName][this._id] = events[eventName][this._id] || []; - events[eventName][this._id].push(eventRecord); - events[eventName].count++; - if (EventGroup._isElement(target)) { - var processElementEvent = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - if (_this._isDisposed) return; - var result; - try { - result = callback.apply(parent_1, args); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore -- FIXME: strictBindCallApply error - https://github.com/microsoft/fluentui/issues/17331 - if (result === false && args[0]) { - var e = args[0]; - if (e.preventDefault) e.preventDefault(); - if (e.stopPropagation) e.stopPropagation(); - e.cancelBubble = true; - } - } catch (e) { - // ignore - } - return result; - }; - eventRecord.elementCallback = processElementEvent; - if (target.addEventListener) target.addEventListener(eventName, processElementEvent, options); - else if (target.attachEvent) // IE8 - target.attachEvent('on' + eventName, processElementEvent); - } else { - var processObjectEvent = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - if (_this._isDisposed) return; - return callback.apply(parent_1, args); - }; - eventRecord.objectCallback = processObjectEvent; - } - // Remember the record locally, so that it can be removed. - this._eventRecords.push(eventRecord); - } - }; - EventGroup.prototype.off = function(target, eventName, callback, options) { - for(var i = 0; i < this._eventRecords.length; i++){ - var eventRecord = this._eventRecords[i]; - if ((!target || target === eventRecord.target) && (!eventName || eventName === eventRecord.eventName) && (!callback || callback === eventRecord.callback) && (typeof options !== 'boolean' || options === eventRecord.options)) { - var events = eventRecord.target.__events__; - var targetArrayLookup = events[eventRecord.eventName]; - var targetArray = targetArrayLookup ? targetArrayLookup[this._id] : null; - // We may have already target's entries, so check for null. - if (targetArray) { - if (targetArray.length === 1 || !callback) { - targetArrayLookup.count -= targetArray.length; - delete events[eventRecord.eventName][this._id]; - } else { - targetArrayLookup.count--; - targetArray.splice(targetArray.indexOf(eventRecord), 1); - } - if (!targetArrayLookup.count) delete events[eventRecord.eventName]; - } - if (eventRecord.elementCallback) { - if (eventRecord.target.removeEventListener) eventRecord.target.removeEventListener(eventRecord.eventName, eventRecord.elementCallback, eventRecord.options); - else if (eventRecord.target.detachEvent) // IE8 - eventRecord.target.detachEvent('on' + eventRecord.eventName, eventRecord.elementCallback); - } - this._eventRecords.splice(i--, 1); - } - } - }; - /** Trigger the given event in the context of this instance of EventGroup. */ EventGroup.prototype.raise = function(eventName, eventArgs, bubbleEvent) { - return EventGroup.raise(this._parent, eventName, eventArgs, bubbleEvent); - }; - /** Declare an event as being supported by this instance of EventGroup. */ EventGroup.prototype.declare = function(event) { - var declaredEvents = this._parent.__declaredEvents = this._parent.__declaredEvents || {}; - if (typeof event === 'string') declaredEvents[event] = true; - else for(var i = 0; i < event.length; i++)declaredEvents[event[i]] = true; - }; - EventGroup._uniqueId = 0; - return EventGroup; -}(); - -},{"./dom":"QMA5I","./object":"celWf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"QMA5I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContains", ()=>(0, _elementContains.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _elementContainsAttribute.elementContainsAttribute)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _findElementRecursive.findElementRecursive)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _getActiveElement.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _getChildren.getChildren)); -parcelHelpers.export(exports, "getDocument", ()=>(0, _getDocument.getDocument)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _getEventTarget.getEventTarget)); -parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>(0, _getFirstVisibleElementFromSelector.getFirstVisibleElementFromSelector)); -parcelHelpers.export(exports, "getParent", ()=>(0, _getParent.getParent)); -parcelHelpers.export(exports, "getRect", ()=>(0, _getRect.getRect)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _getVirtualParent.getVirtualParent)); -parcelHelpers.export(exports, "getWindow", ()=>(0, _getWindow.getWindow)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _isVirtualElement.isVirtualElement)); -parcelHelpers.export(exports, "on", ()=>(0, _on.on)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _portalContainsElement.portalContainsElement)); -parcelHelpers.export(exports, "raiseClick", ()=>(0, _raiseClick.raiseClick)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _setPortalAttribute.setPortalAttribute)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _setVirtualParent.setVirtualParent)); -var _elementContains = require("./dom/elementContains"); -var _elementContainsAttribute = require("./dom/elementContainsAttribute"); -var _findElementRecursive = require("./dom/findElementRecursive"); -var _getActiveElement = require("./dom/getActiveElement"); -var _getChildren = require("./dom/getChildren"); -var _getDocument = require("./dom/getDocument"); -var _getEventTarget = require("./dom/getEventTarget"); -var _getFirstVisibleElementFromSelector = require("./dom/getFirstVisibleElementFromSelector"); -var _getParent = require("./dom/getParent"); -var _getRect = require("./dom/getRect"); -var _getVirtualParent = require("./dom/getVirtualParent"); -var _getWindow = require("./dom/getWindow"); -var _isVirtualElement = require("./dom/isVirtualElement"); -var _on = require("./dom/on"); -var _portalContainsElement = require("./dom/portalContainsElement"); -var _raiseClick = require("./dom/raiseClick"); -var _setPortalAttribute = require("./dom/setPortalAttribute"); -var _setVirtualParent = require("./dom/setVirtualParent"); - -},{"./dom/elementContains":"2CwUJ","./dom/elementContainsAttribute":"5nhe5","./dom/findElementRecursive":"bXARJ","./dom/getActiveElement":"ej3Mo","./dom/getChildren":"2mLgW","./dom/getDocument":"7EOu7","./dom/getEventTarget":"7SPqE","./dom/getFirstVisibleElementFromSelector":"8D3L7","./dom/getParent":"jcio6","./dom/getRect":"cPL7s","./dom/getVirtualParent":"95Nzl","./dom/getWindow":"aI1a8","./dom/isVirtualElement":"g1lgp","./dom/on":"bmVGg","./dom/portalContainsElement":"gxxCf","./dom/raiseClick":"7xL7G","./dom/setPortalAttribute":"iieJm","./dom/setVirtualParent":"04xNE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2CwUJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContains", ()=>(0, _domUtilities.elementContains)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9rkUy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContains", ()=>(0, _elementContains.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _elementContainsAttribute.elementContainsAttribute)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _findElementRecursive.findElementRecursive)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _getActiveElement.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _getChildren.getChildren)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _getEventTarget.getEventTarget)); -parcelHelpers.export(exports, "getParent", ()=>(0, _getParent.getParent)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _getVirtualParent.getVirtualParent)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _isVirtualElement.isVirtualElement)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _portalContainsElement.portalContainsElement)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _setPortalAttribute.setPortalAttribute)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _setVirtualParent.setVirtualParent)); -var _elementContains = require("./elementContains"); -var _elementContainsAttribute = require("./elementContainsAttribute"); -var _findElementRecursive = require("./findElementRecursive"); -var _getActiveElement = require("./getActiveElement"); -var _getChildren = require("./getChildren"); -var _getEventTarget = require("./getEventTarget"); -var _getParent = require("./getParent"); -var _getVirtualParent = require("./getVirtualParent"); -var _isVirtualElement = require("./isVirtualElement"); -var _portalContainsElement = require("./portalContainsElement"); -var _setPortalAttribute = require("./setPortalAttribute"); -var _setVirtualParent = require("./setVirtualParent"); -var _version = require("./version"); - -},{"./elementContains":"fEbuU","./elementContainsAttribute":"3JNJ4","./findElementRecursive":"9jL42","./getActiveElement":"eFvN1","./getChildren":"dzzLx","./getEventTarget":"bigj6","./getParent":"e1jhK","./getVirtualParent":"h5OcT","./isVirtualElement":"8A405","./portalContainsElement":"bpjTZ","./setPortalAttribute":"3IIlp","./setVirtualParent":"9VlRR","./version":"3KF3P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fEbuU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Determines whether or not a parent element contains a given child element. - * If `allowVirtualParents` is true, this method may return `true` if the child - * has the parent in its virtual element hierarchy. - * - * @public - */ parcelHelpers.export(exports, "elementContains", ()=>elementContains); -var _getParent = require("./getParent"); -function elementContains(parent, child, allowVirtualParents) { - if (allowVirtualParents === void 0) allowVirtualParents = true; var isContained = false; if (parent && child) { - if (allowVirtualParents) { - if (parent === child) isContained = true; - else { - isContained = false; - while(child){ - var nextParent = (0, _getParent.getParent)(child); - if (nextParent === parent) { - isContained = true; - break; - } - child = nextParent; - } - } - } else if (parent.contains) isContained = parent.contains(child); + if (allowVirtualParents) { + if (parent === child) { + isContained = true; + } else { + isContained = false; + while (child) { + var nextParent = getParent(child); + if (nextParent === parent) { + isContained = true; + break; + } + child = nextParent; + } + } + } else if (parent.contains) { + isContained = parent.contains(child); + } } return isContained; -} - -},{"./getParent":"e1jhK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e1jhK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the element which is the parent of a given element. - * If `allowVirtuaParents` is `true`, this method prefers the virtual parent over - * real DOM parent when present. - * - * @public - */ parcelHelpers.export(exports, "getParent", ()=>getParent); -var _getVirtualParent = require("./getVirtualParent"); -function getParent(child, allowVirtualParents) { - var _a, _b; - if (allowVirtualParents === void 0) allowVirtualParents = true; - if (!child) return null; - var parent = allowVirtualParents && (0, _getVirtualParent.getVirtualParent)(child); - if (parent) return parent; - // Support looking for parents in shadow DOM - if (typeof child.assignedElements !== 'function' && ((_a = child.assignedSlot) === null || _a === void 0 ? void 0 : _a.parentNode)) // Element is slotted - return child.assignedSlot; - else if (((_b = child.parentNode) === null || _b === void 0 ? void 0 : _b.nodeType) === 11) // nodeType 11 is DOCUMENT_FRAGMENT - // Element is in shadow root - return child.parentNode.host; - else return child.parentNode; -} - -},{"./getVirtualParent":"h5OcT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h5OcT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the virtual parent given the child element, if it exists. - * - * @public - */ parcelHelpers.export(exports, "getVirtualParent", ()=>getVirtualParent); -var _isVirtualElement = require("./isVirtualElement"); -function getVirtualParent(child) { - var parent; - if (child && (0, _isVirtualElement.isVirtualElement)(child)) parent = child._virtual.parent; - return parent; -} - -},{"./isVirtualElement":"8A405","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8A405":[function(require,module,exports,__globalThis) { -/** - * Determines whether or not an element has the virtual hierarchy extension. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isVirtualElement", ()=>isVirtualElement); -function isVirtualElement(element) { - return element && !!element._virtual; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3JNJ4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Determines if an element, or any of its ancestors, contain the given attribute - * @param element - element to start searching at - * @param attribute - the attribute to search for - * @returns the value of the first instance found - */ parcelHelpers.export(exports, "elementContainsAttribute", ()=>elementContainsAttribute); -var _findElementRecursive = require("./findElementRecursive"); -function elementContainsAttribute(element, attribute, doc) { - var elementMatch = (0, _findElementRecursive.findElementRecursive)(element, function(testElement) { - return testElement.hasAttribute(attribute); + } + function findElementRecursive(element2, matchFunction, doc) { + doc !== null && doc !== void 0 ? doc : doc = document; + if (!element2 || element2 === doc.body || element2 instanceof Document) { + return null; + } + return matchFunction(element2) ? element2 : findElementRecursive(getParent(element2), matchFunction); + } + function elementContainsAttribute(element2, attribute, doc) { + var elementMatch = findElementRecursive(element2, function(testElement) { + return testElement.hasAttribute(attribute); }, doc); return elementMatch && elementMatch.getAttribute(attribute); -} - -},{"./findElementRecursive":"9jL42","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9jL42":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Finds the first parent element where the matchFunction returns true - * @param element - element to start searching at - * @param matchFunction - the function that determines if the element is a match - * @returns the matched element or null no match was found - */ parcelHelpers.export(exports, "findElementRecursive", ()=>findElementRecursive); -var _getParent = require("./getParent"); -function findElementRecursive(element, matchFunction, doc) { - // eslint-disable-next-line no-restricted-globals - doc !== null && doc !== void 0 ? doc : doc = document; - if (!element || element === doc.body || element instanceof Document) return null; - return matchFunction(element) ? element : findElementRecursive((0, _getParent.getParent)(element), matchFunction); -} - -},{"./getParent":"e1jhK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eFvN1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getActiveElement", ()=>getActiveElement); -var getActiveElement = function(doc) { + } + var getActiveElement = function(doc) { var ae = doc.activeElement; - while(ae === null || ae === void 0 ? void 0 : ae.shadowRoot)ae = ae.shadowRoot.activeElement; + while (ae === null || ae === void 0 ? void 0 : ae.shadowRoot) { + ae = ae.shadowRoot.activeElement; + } return ae; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dzzLx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the elements which are child elements of the given element. - * If `allowVirtualChildren` is `true`, this method enumerates virtual child elements - * after the original children. - * @param parent - The element to get the children of. - * @param allowVirtualChildren - true if the method should enumerate virtual child elements. - */ parcelHelpers.export(exports, "getChildren", ()=>getChildren); -var _isVirtualElement = require("./isVirtualElement"); -function getChildren(parent, allowVirtualChildren) { - if (allowVirtualChildren === void 0) allowVirtualChildren = true; - var children = []; + }; + function getChildren(parent, allowVirtualChildren) { + if (allowVirtualChildren === void 0) { + allowVirtualChildren = true; + } + var children2 = []; if (parent) { - for(var i = 0; i < parent.children.length; i++)children.push(parent.children.item(i)); - if (allowVirtualChildren && (0, _isVirtualElement.isVirtualElement)(parent)) children.push.apply(children, parent._virtual.children); - } - return children; -} - -},{"./isVirtualElement":"8A405","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bigj6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getEventTarget", ()=>getEventTarget); -var getEventTarget = function(event) { - var target = event.target; - if (target && target.shadowRoot) target = event.composedPath()[0]; - return target; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bpjTZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Determine whether a target is within a portal from perspective of root or optional parent. - * This function only works against portal components that use the setPortalAttribute function. - * If both parent and child are within the same portal this function will return false. - * @param target - Element to query portal containment status of. - * @param parent - Optional parent perspective. Search for containing portal stops at parent - * (or root if parent is undefined or invalid.) - */ parcelHelpers.export(exports, "portalContainsElement", ()=>portalContainsElement); -var _findElementRecursive = require("./findElementRecursive"); -var _setPortalAttribute = require("./setPortalAttribute"); -function portalContainsElement(target, parent, doc) { - var _a; - var elementMatch = (0, _findElementRecursive.findElementRecursive)(target, function(testElement) { - var _a; - return parent === testElement || !!((_a = testElement.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(testElement, (0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE))); + for (var i = 0; i < parent.children.length; i++) { + children2.push(parent.children.item(i)); + } + if (allowVirtualChildren && isVirtualElement(parent)) { + children2.push.apply(children2, parent._virtual.children); + } + } + return children2; + } + var getEventTarget = function(event2) { + var target2 = event2.target; + if (target2 && target2.shadowRoot) { + target2 = event2.composedPath()[0]; + } + return target2; + }; + var DATA_PORTAL_ATTRIBUTE = "data-portal-element"; + function setPortalAttribute(element2) { + element2.setAttribute(DATA_PORTAL_ATTRIBUTE, "true"); + } + function portalContainsElement(target2, parent, doc) { + var _a2; + var elementMatch = findElementRecursive(target2, function(testElement) { + var _a3; + return parent === testElement || !!((_a3 = testElement.hasAttribute) === null || _a3 === void 0 ? void 0 : _a3.call(testElement, DATA_PORTAL_ATTRIBUTE)); }, doc); - return elementMatch !== null && !!((_a = elementMatch.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(elementMatch, (0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE))); -} - -},{"./findElementRecursive":"9jL42","./setPortalAttribute":"3IIlp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3IIlp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>DATA_PORTAL_ATTRIBUTE); -/** - * Identify element as a portal by setting an attribute. - * @param element - Element to mark as a portal. - */ parcelHelpers.export(exports, "setPortalAttribute", ()=>setPortalAttribute); -var DATA_PORTAL_ATTRIBUTE = 'data-portal-element'; -function setPortalAttribute(element) { - element.setAttribute(DATA_PORTAL_ATTRIBUTE, 'true'); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VlRR":[function(require,module,exports,__globalThis) { -/** - * Sets the virtual parent of an element. - * Pass `undefined` as the `parent` to clear the virtual parent. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVirtualParent", ()=>setVirtualParent); -function setVirtualParent(child, parent) { + return elementMatch !== null && !!((_a2 = elementMatch.hasAttribute) === null || _a2 === void 0 ? void 0 : _a2.call(elementMatch, DATA_PORTAL_ATTRIBUTE)); + } + function setVirtualParent(child, parent) { var virtualChild = child; var virtualParent = parent; - if (!virtualChild._virtual) virtualChild._virtual = { + if (!virtualChild._virtual) { + virtualChild._virtual = { children: [] - }; + }; + } var oldParent = virtualChild._virtual.parent; if (oldParent && oldParent !== parent) { - // Remove the child from its old parent. - var index = oldParent._virtual.children.indexOf(virtualChild); - if (index > -1) oldParent._virtual.children.splice(index, 1); + var index2 = oldParent._virtual.children.indexOf(virtualChild); + if (index2 > -1) { + oldParent._virtual.children.splice(index2, 1); + } } - virtualChild._virtual.parent = virtualParent || undefined; + virtualChild._virtual.parent = virtualParent || void 0; if (virtualParent) { - if (!virtualParent._virtual) virtualParent._virtual = { - children: [] + if (!virtualParent._virtual) { + virtualParent._virtual = { + children: [] }; - virtualParent._virtual.children.push(virtualChild); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3KF3P":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/dom-utilities', '2.3.9'); - -},{"@fluentui/set-version":"iqYXf"}],"5nhe5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _domUtilities.elementContainsAttribute)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bXARJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _domUtilities.findElementRecursive)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ej3Mo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _domUtilities.getActiveElement)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2mLgW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getChildren", ()=>(0, _domUtilities.getChildren)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7EOu7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to get the document object. Note that in popup window cases, document - * might be the wrong document, which is why we look at ownerDocument for the - * truth. - * - * @public - */ parcelHelpers.export(exports, "getDocument", ()=>getDocument); -var _canUseDOM = require("./canUseDOM"); -function getDocument(rootElement) { - // eslint-disable-next-line no-restricted-globals - if (!(0, _canUseDOM.canUseDOM)() || typeof document === 'undefined') return undefined; - else { - var el = rootElement; - // eslint-disable-next-line no-restricted-globals - return el && el.ownerDocument ? el.ownerDocument : document; - } -} - -},{"./canUseDOM":"iFHeV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7SPqE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _domUtilities.getEventTarget)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8D3L7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the first visible element that matches the given selector - * @param selector - The selector to use to find potential visible elements - * @returns The first visible element that matches the selector, otherwise undefined - * - * @public - */ parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>getFirstVisibleElementFromSelector); -var _focus = require("../focus"); -var _getDocument = require("./getDocument"); -function getFirstVisibleElementFromSelector(selector) { - var doc = (0, _getDocument.getDocument)(); - var elements = doc.querySelectorAll(selector); - // Iterate across the elements that match the selector and return the first visible/non-hidden element - return Array.from(elements).find(function(element) { - var _a; - return (0, _focus.isElementVisibleAndNotHidden)(element, (_a = doc.defaultView) !== null && _a !== void 0 ? _a : undefined); - }); -} - -},{"../focus":"vgfwi","./getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"vgfwi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the first focusable element. - * - * @public - */ parcelHelpers.export(exports, "getFirstFocusable", ()=>getFirstFocusable); -/** - * Gets the last focusable element. - * - * @public - */ parcelHelpers.export(exports, "getLastFocusable", ()=>getLastFocusable); -/** - * Gets the first tabbable element. (The difference between focusable and tabbable is that tabbable elements are - * focusable elements that also have tabIndex != -1.) - * @param rootElement - The parent element to search beneath. - * @param currentElement - The descendant of rootElement to start the search at. This element is the first one checked, - * and iteration continues forward. Typical use passes rootElement.firstChild. - * @param includeElementsInFocusZones - true if traversal should go into FocusZone descendants. - * @param checkNode - Include currentElement in search when true. Defaults to true. - * @public - */ parcelHelpers.export(exports, "getFirstTabbable", ()=>getFirstTabbable); -/** - * Gets the last tabbable element. (The difference between focusable and tabbable is that tabbable elements are - * focusable elements that also have tabIndex != -1.) - * @param rootElement - The parent element to search beneath. - * @param currentElement - The descendant of rootElement to start the search at. This element is the first one checked, - * and iteration continues in reverse. Typical use passes rootElement.lastChild. - * @param includeElementsInFocusZones - true if traversal should go into FocusZone descendants. - * @param checkNode - Include currentElement in search when true. Defaults to true. - * @public - */ parcelHelpers.export(exports, "getLastTabbable", ()=>getLastTabbable); -/** - * Attempts to focus the first focusable element that is a child or child's child of the rootElement. - * - * @public - * @param rootElement - Element to start the search for a focusable child. - * @param bypassHiddenElements - If true, focus will be not be set on hidden elements. - * @returns True if focus was set, false if it was not. - */ parcelHelpers.export(exports, "focusFirstChild", ()=>focusFirstChild); -/** - * Traverse to find the previous element. - * If tabbable is true, the element must have tabIndex != -1. - * - * @public - */ parcelHelpers.export(exports, "getPreviousElement", ()=>getPreviousElement); -/** - * Traverse to find the next focusable element. - * If tabbable is true, the element must have tabIndex != -1. - * - * @public - * @param checkNode - Include currentElement in search when true. - */ parcelHelpers.export(exports, "getNextElement", ()=>getNextElement); -/** - * Determines if an element is visible. - * - * @public - */ parcelHelpers.export(exports, "isElementVisible", ()=>isElementVisible); -/** - * Determines if an element is visible and not hidden - * @param element - Element to check - * @returns Returns true if the given element is visible and not hidden - * - * @public - */ parcelHelpers.export(exports, "isElementVisibleAndNotHidden", ()=>isElementVisibleAndNotHidden); -/** - * Determines if an element can receive focus programmatically or via a mouse click. - * If checkTabIndex is true, additionally checks to ensure the element can be focused with the tab key, - * meaning tabIndex != -1. - * - * @public - */ parcelHelpers.export(exports, "isElementTabbable", ()=>isElementTabbable); -/** - * Determines if a given element is a focus zone. - * - * @public - */ parcelHelpers.export(exports, "isElementFocusZone", ()=>isElementFocusZone); -/** - * Determines if a given element is a focus sub zone. - * - * @public - */ parcelHelpers.export(exports, "isElementFocusSubZone", ()=>isElementFocusSubZone); -/** - * Determines if an element, or any of its children, contain focus. - * - * @public - */ parcelHelpers.export(exports, "doesElementContainFocus", ()=>doesElementContainFocus); -/** - * Determines if an, or any of its ancestors, sepcificies that it doesn't want focus to wrap - * @param element - element to start searching from - * @param noWrapDataAttribute - the no wrap data attribute to match (either) - * @returns true if focus should wrap, false otherwise - */ parcelHelpers.export(exports, "shouldWrapFocus", ()=>shouldWrapFocus); -/** - * Sets focus to an element asynchronously. The focus will be set at the next browser repaint, - * meaning it won't cause any extra recalculations. If more than one focusAsync is called during one frame, - * only the latest called focusAsync element will actually be focused - * @param element - The element to focus - */ parcelHelpers.export(exports, "focusAsync", ()=>focusAsync); -/** - * Finds the closest focusable element via an index path from a parent. See - * `getElementIndexPath` for getting an index path from an element to a child. - */ parcelHelpers.export(exports, "getFocusableByIndexPath", ()=>getFocusableByIndexPath); -/** - * Finds the element index path from a parent element to a child element. - * - * If you had this node structure: "A has children [B, C] and C has child D", - * the index path from A to D would be [1, 0], or `parent.chidren[1].children[0]`. - */ parcelHelpers.export(exports, "getElementIndexPath", ()=>getElementIndexPath); -var _elementContainsAttribute = require("./dom/elementContainsAttribute"); -var _elementContains = require("./dom/elementContains"); -var _getParent = require("./dom/getParent"); -var _getWindow = require("./dom/getWindow"); -var _getDocument = require("./dom/getDocument"); -var IS_FOCUSABLE_ATTRIBUTE = 'data-is-focusable'; -var IS_VISIBLE_ATTRIBUTE = 'data-is-visible'; -var FOCUSZONE_ID_ATTRIBUTE = 'data-focuszone-id'; -var FOCUSZONE_SUB_ATTRIBUTE = 'data-is-sub-focuszone'; -function getFirstFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { - return getNextElement(rootElement, currentElement, true, false, false, includeElementsInFocusZones, undefined, undefined, undefined, includeShadowRoots); -} -function getLastFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { - return getPreviousElement(rootElement, currentElement, true, false, true, includeElementsInFocusZones, undefined, undefined, includeShadowRoots); -} -function getFirstTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { - if (checkNode === void 0) checkNode = true; - return getNextElement(rootElement, currentElement, checkNode, false, false, includeElementsInFocusZones, false, true, undefined, includeShadowRoots); -} -function getLastTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { - if (checkNode === void 0) checkNode = true; + } + virtualParent._virtual.children.push(virtualChild); + } + } + function getDocument(rootElement) { + if (!canUseDOM() || typeof document === "undefined") { + return void 0; + } else { + var el = rootElement; + return el && el.ownerDocument ? el.ownerDocument : document; + } + } + var IS_FOCUSABLE_ATTRIBUTE$1 = "data-is-focusable"; + var IS_VISIBLE_ATTRIBUTE = "data-is-visible"; + var FOCUSZONE_ID_ATTRIBUTE$1 = "data-focuszone-id"; + var FOCUSZONE_SUB_ATTRIBUTE = "data-is-sub-focuszone"; + function getFirstFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { + return getNextElement(rootElement, currentElement, true, false, false, includeElementsInFocusZones, void 0, void 0, void 0, includeShadowRoots); + } + function getLastFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { + return getPreviousElement(rootElement, currentElement, true, false, true, includeElementsInFocusZones, void 0, void 0, includeShadowRoots); + } + function getFirstTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { + return getNextElement(rootElement, currentElement, checkNode, false, false, includeElementsInFocusZones, false, true, void 0, includeShadowRoots); + } + function getLastTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { return getPreviousElement(rootElement, currentElement, checkNode, false, true, includeElementsInFocusZones, false, true, includeShadowRoots); -} -function focusFirstChild(rootElement, bypassHiddenElements, includeShadowRoots) { - var element = getNextElement(rootElement, rootElement, true, false, false, true, undefined, undefined, bypassHiddenElements, includeShadowRoots); - if (element) { - focusAsync(element); - return true; + } + function focusFirstChild(rootElement, bypassHiddenElements, includeShadowRoots) { + var element2 = getNextElement(rootElement, rootElement, true, false, false, true, void 0, void 0, bypassHiddenElements, includeShadowRoots); + if (element2) { + focusAsync(element2); + return true; + } + return false; + } + function getPreviousElement(rootElement, currentElement, checkNode, suppressParentTraversal, traverseChildren, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots) { + var _a2; + if (!currentElement || !allowFocusRoot && currentElement === rootElement) { + return null; } - return false; -} -function getPreviousElement(rootElement, currentElement, checkNode, suppressParentTraversal, traverseChildren, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots) { - var _a; - if (!currentElement || !allowFocusRoot && currentElement === rootElement) return null; var isCurrentElementVisible = isElementVisible(currentElement); - // Check its children. if (traverseChildren && isCurrentElementVisible && (includeElementsInFocusZones || !(isElementFocusZone(currentElement) || isElementFocusSubZone(currentElement)))) { - var lastElementChild = currentElement.lastElementChild || includeShadowRoots && ((_a = currentElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.lastElementChild); - var childMatch = getPreviousElement(rootElement, lastElementChild, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (childMatch) { - if (tabbable && isElementTabbable(childMatch, true, includeShadowRoots) || !tabbable) return childMatch; - var childMatchSiblingMatch = getPreviousElement(rootElement, childMatch.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (childMatchSiblingMatch) return childMatchSiblingMatch; - var childMatchParent = childMatch.parentElement; - // At this point if we have not found any potential matches - // start looking at the rest of the subtree under the currentParent. - // NOTE: We do not want to recurse here because doing so could - // cause elements to get skipped. - while(childMatchParent && childMatchParent !== currentElement){ - var childMatchParentMatch = getPreviousElement(rootElement, childMatchParent.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (childMatchParentMatch) return childMatchParentMatch; - childMatchParent = childMatchParent.parentElement; - } + var lastElementChild = currentElement.lastElementChild || includeShadowRoots && ((_a2 = currentElement.shadowRoot) === null || _a2 === void 0 ? void 0 : _a2.lastElementChild); + var childMatch = getPreviousElement(rootElement, lastElementChild, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (childMatch) { + if (tabbable && isElementTabbable(childMatch, true, includeShadowRoots) || !tabbable) { + return childMatch; + } + var childMatchSiblingMatch = getPreviousElement(rootElement, childMatch.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (childMatchSiblingMatch) { + return childMatchSiblingMatch; + } + var childMatchParent = childMatch.parentElement; + while (childMatchParent && childMatchParent !== currentElement) { + var childMatchParentMatch = getPreviousElement(rootElement, childMatchParent.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (childMatchParentMatch) { + return childMatchParentMatch; + } + childMatchParent = childMatchParent.parentElement; } + } + } + if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) { + return currentElement; } - // Check the current node, if it's not the first traversal. - if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) return currentElement; - // Check its previous sibling. var siblingMatch = getPreviousElement(rootElement, currentElement.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (siblingMatch) return siblingMatch; - // Check its parent. - if (!suppressParentTraversal) return getPreviousElement(rootElement, currentElement.parentElement, true, false, false, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (siblingMatch) { + return siblingMatch; + } + if (!suppressParentTraversal) { + return getPreviousElement(rootElement, currentElement.parentElement, true, false, false, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + } return null; -} -function getNextElement(rootElement, currentElement, checkNode, suppressParentTraversal, suppressChildTraversal, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots) { - var _a; - if (!currentElement || currentElement === rootElement && suppressChildTraversal && !allowFocusRoot) return null; + } + function getNextElement(rootElement, currentElement, checkNode, suppressParentTraversal, suppressChildTraversal, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots) { + var _a2; + if (!currentElement || currentElement === rootElement && suppressChildTraversal && !allowFocusRoot) { + return null; + } var checkElementVisibility = bypassHiddenElements ? isElementVisibleAndNotHidden : isElementVisible; var isCurrentElementVisible = checkElementVisibility(currentElement); - // Check the current node, if it's not the first traversal. - if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) return currentElement; - // Check its children. + if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) { + return currentElement; + } if (!suppressChildTraversal && isCurrentElementVisible && (includeElementsInFocusZones || !(isElementFocusZone(currentElement) || isElementFocusSubZone(currentElement)))) { - var firstElementchild = currentElement.firstElementChild || includeShadowRoots && ((_a = currentElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.firstElementChild); - var childMatch = getNextElement(rootElement, firstElementchild, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); - if (childMatch) return childMatch; + var firstElementchild = currentElement.firstElementChild || includeShadowRoots && ((_a2 = currentElement.shadowRoot) === null || _a2 === void 0 ? void 0 : _a2.firstElementChild); + var childMatch = getNextElement(rootElement, firstElementchild, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); + if (childMatch) { + return childMatch; + } + } + if (currentElement === rootElement) { + return null; } - if (currentElement === rootElement) return null; - // Check its sibling. var siblingMatch = getNextElement(rootElement, currentElement.nextElementSibling, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); - if (siblingMatch) return siblingMatch; - if (!suppressParentTraversal) return getNextElement(rootElement, currentElement.parentElement, false, false, true, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); + if (siblingMatch) { + return siblingMatch; + } + if (!suppressParentTraversal) { + return getNextElement(rootElement, currentElement.parentElement, false, false, true, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); + } return null; -} -function isElementVisible(element) { - // If the element is not valid, return false. - if (!element || !element.getAttribute) return false; - var visibilityAttribute = element.getAttribute(IS_VISIBLE_ATTRIBUTE); - // If the element is explicitly marked with the visibility attribute, return that value as boolean. - if (visibilityAttribute !== null && visibilityAttribute !== undefined) return visibilityAttribute === 'true'; - // Fallback to other methods of determining actual visibility. - return element.offsetHeight !== 0 || element.offsetParent !== null || // eslint-disable-next-line @typescript-eslint/no-explicit-any - element.isVisible === true; // used as a workaround for testing. -} -function isElementVisibleAndNotHidden(element, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _getWindow.getWindow)(); - return !!element && isElementVisible(element) && !element.hidden && theWin.getComputedStyle(element).visibility !== 'hidden'; -} -function isElementTabbable(element, checkTabIndex, checkShadowRoot) { - if (checkShadowRoot === void 0) checkShadowRoot = true; - // If this element is null or is disabled, it is not considered tabbable. - if (!element || element.disabled) return false; + } + function isElementVisible(element2) { + if (!element2 || !element2.getAttribute) { + return false; + } + var visibilityAttribute = element2.getAttribute(IS_VISIBLE_ATTRIBUTE); + if (visibilityAttribute !== null && visibilityAttribute !== void 0) { + return visibilityAttribute === "true"; + } + return element2.offsetHeight !== 0 || element2.offsetParent !== null || // eslint-disable-next-line @typescript-eslint/no-explicit-any + element2.isVisible === true; + } + function isElementVisibleAndNotHidden(element2, win) { + var theWin = win !== null && win !== void 0 ? win : getWindow(); + return !!element2 && isElementVisible(element2) && !element2.hidden && theWin.getComputedStyle(element2).visibility !== "hidden"; + } + function isElementTabbable(element2, checkTabIndex, checkShadowRoot) { + if (checkShadowRoot === void 0) { + checkShadowRoot = true; + } + if (!element2 || element2.disabled) { + return false; + } var tabIndex = 0; var tabIndexAttributeValue = null; - if (element && element.getAttribute) { - tabIndexAttributeValue = element.getAttribute('tabIndex'); - if (tabIndexAttributeValue) tabIndex = parseInt(tabIndexAttributeValue, 10); + if (element2 && element2.getAttribute) { + tabIndexAttributeValue = element2.getAttribute("tabIndex"); + if (tabIndexAttributeValue) { + tabIndex = parseInt(tabIndexAttributeValue, 10); + } } - var isFocusableAttribute = element.getAttribute ? element.getAttribute(IS_FOCUSABLE_ATTRIBUTE) : null; + var isFocusableAttribute = element2.getAttribute ? element2.getAttribute(IS_FOCUSABLE_ATTRIBUTE$1) : null; var isTabIndexSet = tabIndexAttributeValue !== null && tabIndex >= 0; - var delegatesFocus = checkShadowRoot && element.shadowRoot ? !!element.shadowRoot.delegatesFocus : false; - var result = !!element && isFocusableAttribute !== 'false' && (element.tagName === 'A' || element.tagName === 'BUTTON' || element.tagName === 'INPUT' || element.tagName === 'TEXTAREA' || element.tagName === 'SELECT' || isFocusableAttribute === 'true' || isTabIndexSet || delegatesFocus); + var delegatesFocus = checkShadowRoot && element2.shadowRoot ? !!element2.shadowRoot.delegatesFocus : false; + var result = !!element2 && isFocusableAttribute !== "false" && (element2.tagName === "A" || element2.tagName === "BUTTON" || element2.tagName === "INPUT" || element2.tagName === "TEXTAREA" || element2.tagName === "SELECT" || isFocusableAttribute === "true" || isTabIndexSet || delegatesFocus); return checkTabIndex ? tabIndex !== -1 && result : result; -} -function isElementFocusZone(element) { - return !!(element && element.getAttribute && !!element.getAttribute(FOCUSZONE_ID_ATTRIBUTE)); -} -function isElementFocusSubZone(element) { - return !!(element && element.getAttribute && element.getAttribute(FOCUSZONE_SUB_ATTRIBUTE) === 'true'); -} -function doesElementContainFocus(element) { - var doc = (0, _getDocument.getDocument)(element); + } + function isElementFocusZone(element2) { + return !!(element2 && element2.getAttribute && !!element2.getAttribute(FOCUSZONE_ID_ATTRIBUTE$1)); + } + function isElementFocusSubZone(element2) { + return !!(element2 && element2.getAttribute && element2.getAttribute(FOCUSZONE_SUB_ATTRIBUTE) === "true"); + } + function doesElementContainFocus(element2) { + var doc = getDocument(element2); var currentActiveElement = doc && doc.activeElement; - if (currentActiveElement && (0, _elementContains.elementContains)(element, currentActiveElement)) return true; + if (currentActiveElement && elementContains(element2, currentActiveElement)) { + return true; + } return false; -} -function shouldWrapFocus(element, noWrapDataAttribute, doc) { - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _getDocument.getDocument)(); - return (0, _elementContainsAttribute.elementContainsAttribute)(element, noWrapDataAttribute, theDoc) === 'true' ? false : true; -} -var animationId = undefined; -function focusAsync(element) { - if (element) { - var win = (0, _getWindow.getWindow)(element); - if (win) { - // cancel any previous focus queues - if (animationId !== undefined) win.cancelAnimationFrame(animationId); - // element.focus() is a no-op if the element is no longer in the DOM, meaning this is always safe - animationId = win.requestAnimationFrame(function() { - element && element.focus(); - // We are done focusing for this frame, so reset the queued focus element - animationId = undefined; - }); - } + } + function shouldWrapFocus(element2, noWrapDataAttribute, doc) { + var theDoc = getDocument(); + return elementContainsAttribute(element2, noWrapDataAttribute, theDoc) === "true" ? false : true; + } + var animationId = void 0; + function focusAsync(element2) { + if (element2) { + var win = getWindow(element2); + if (win) { + if (animationId !== void 0) { + win.cancelAnimationFrame(animationId); + } + animationId = win.requestAnimationFrame(function() { + element2 && element2.focus(); + animationId = void 0; + }); + } } -} -function getFocusableByIndexPath(parent, path) { - var element = parent; - for(var _i = 0, path_1 = path; _i < path_1.length; _i++){ - var index = path_1[_i]; - var nextChild = element.children[Math.min(index, element.children.length - 1)]; - if (!nextChild) break; - element = nextChild; - } - element = isElementTabbable(element) && isElementVisible(element) ? element : getNextElement(parent, element, true) || getPreviousElement(parent, element); - return element; -} -function getElementIndexPath(fromElement, toElement) { - var path = []; - while(toElement && fromElement && toElement !== fromElement){ - var parent_1 = (0, _getParent.getParent)(toElement, true); - if (parent_1 === null) return []; - path.unshift(Array.prototype.indexOf.call(parent_1.children, toElement)); - toElement = parent_1; - } - return path; -} - -},{"./dom/elementContainsAttribute":"5nhe5","./dom/elementContains":"2CwUJ","./dom/getParent":"jcio6","./dom/getWindow":"aI1a8","./dom/getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jcio6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getParent", ()=>(0, _domUtilities.getParent)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cPL7s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to get bounding client rect. Passing in window will get the window size. - * - * @public - */ parcelHelpers.export(exports, "getRect", ()=>getRect); -var _getWindow = require("./getWindow"); -function getRect(element, win) { - var theWin = (win !== null && win !== void 0 ? win : !element || element && element.hasOwnProperty('devicePixelRatio')) ? (0, _getWindow.getWindow)() : (0, _getWindow.getWindow)(element); - var rect; - if (element) { - if (element === theWin) rect = { - left: 0, - top: 0, - width: theWin.innerWidth, - height: theWin.innerHeight, - right: theWin.innerWidth, - bottom: theWin.innerHeight - }; - else if (element.getBoundingClientRect) rect = element.getBoundingClientRect(); - } - return rect; -} - -},{"./getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"95Nzl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _domUtilities.getVirtualParent)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g1lgp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _domUtilities.isVirtualElement)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmVGg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "on", ()=>on); -function on(element, eventName, callback, options) { - element.addEventListener(eventName, callback, options); + } + function getFocusableByIndexPath(parent, path2) { + var element2 = parent; + for (var _i = 0, path_1 = path2; _i < path_1.length; _i++) { + var index2 = path_1[_i]; + var nextChild = element2.children[Math.min(index2, element2.children.length - 1)]; + if (!nextChild) { + break; + } + element2 = nextChild; + } + element2 = isElementTabbable(element2) && isElementVisible(element2) ? element2 : getNextElement(parent, element2, true) || getPreviousElement(parent, element2); + return element2; + } + function getElementIndexPath(fromElement, toElement) { + var path2 = []; + while (toElement && fromElement && toElement !== fromElement) { + var parent_1 = getParent(toElement, true); + if (parent_1 === null) { + return []; + } + path2.unshift(Array.prototype.indexOf.call(parent_1.children, toElement)); + toElement = parent_1; + } + return path2; + } + function on$1(element2, eventName, callback, options2) { + element2.addEventListener(eventName, callback, options2); return function() { - return element.removeEventListener(eventName, callback, options); - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gxxCf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _domUtilities.portalContainsElement)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7xL7G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** Raises a click event. - * @deprecated Moved to `FocusZone` component since it was the only place internally using this function. - */ parcelHelpers.export(exports, "raiseClick", ()=>raiseClick); -var _getDocument = require("./getDocument"); -function raiseClick(target, doc) { - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _getDocument.getDocument)(); - var event = createNewEvent('MouseEvents', theDoc); - // eslint-disable-next-line deprecation/deprecation - event.initEvent('click', true, true); - target.dispatchEvent(event); -} -function createNewEvent(eventName, doc) { - var event; - if (typeof Event === 'function') // Chrome, Opera, Firefox - event = new Event(eventName); - else { - // IE - event = doc.createEvent('Event'); - // eslint-disable-next-line deprecation/deprecation - event.initEvent(eventName, true, true); - } - return event; -} - -},{"./getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iieJm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _domUtilities.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _domUtilities.setPortalAttribute)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"04xNE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _domUtilities.setVirtualParent)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"celWf":[function(require,module,exports,__globalThis) { -/** - * Compares a to b and b to a. - * - * @public - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shallowCompare", ()=>shallowCompare); -/** - * Makes a resulting merge of a bunch of objects. Pass in the target object followed by 1 or more - * objects as arguments and they will be merged sequentially into the target. Note that this will - * shallow merge; it will not create new cloned values for target members. - * - * @public - * @param target - Target object to merge following object arguments into. - * @param args - One or more objects that will be mixed into the target in the order they are provided. - * @returns Resulting merged target. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "assign", ()=>assign); -/** - * Makes a resulting merge of a bunch of objects, but allows a filter function to be passed in to filter - * the resulting merges. This allows for scenarios where you want to merge "everything except that one thing" - * or "properties that start with data-". Note that this will shallow merge; it will not create new cloned - * values for target members. - * - * @public - * @param isAllowed - Callback to determine if the given propName is allowed in the result. - * @param target - Target object to merge following object arguments into. - * @param args - One or more objects that will be mixed into the target in the order they are provided. - * @returns Resulting merged target. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "filteredAssign", ()=>filteredAssign); -/** - * Takes an enum and iterates over each value of the enum (as a string), running the callback on each, - * returning a mapped array. - * @param theEnum - Enum to iterate over - * @param callback - The first parameter the name of the entry, and the second parameter is the value - * of that entry, which is the value you'd normally use when using the enum (usually a number). - */ parcelHelpers.export(exports, "mapEnumByName", ()=>mapEnumByName); -/** - * Get all values in an object dictionary - * - * @param obj - The dictionary to get values for - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "values", ()=>values); -/** - * Tiny helper to do the minimal amount of work in duplicating an object but omitting some - * props. This ends up faster than using object ...rest or reduce to filter. - * - * This behaves very much like filteredAssign, but does not merge many objects together, - * uses an exclusion object map, and avoids spreads all for optimal performance. - * - * See perf test for background: - * https://jsperf.com/omit-vs-rest-vs-reduce/1 - * - * @param obj - The object to clone - * @param exclusions - The array of keys to exclude - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "omit", ()=>omit); -function shallowCompare(a, b) { - if (!a || !b) // only return true if both a and b are falsy - return !a && !b; - for(var propName in a)if (a.hasOwnProperty(propName)) { - if (!b.hasOwnProperty(propName) || b[propName] !== a[propName]) return false; - } - for(var propName in b)if (b.hasOwnProperty(propName)) { - if (!a.hasOwnProperty(propName)) return false; + return element2.removeEventListener(eventName, callback, options2); + }; + } + function shallowCompare(a2, b2) { + if (!a2 || !b2) { + return !a2 && !b2; + } + for (var propName in a2) { + if (a2.hasOwnProperty(propName)) { + if (!b2.hasOwnProperty(propName) || b2[propName] !== a2[propName]) { + return false; + } + } + } + for (var propName in b2) { + if (b2.hasOwnProperty(propName)) { + if (!a2.hasOwnProperty(propName)) { + return false; + } + } } return true; -} -function assign(target) { - var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - return filteredAssign.apply(this, [ - null, - target - ].concat(args)); -} -function filteredAssign(isAllowed, target) { + } + function assign(target2) { var args = []; - for(var _i = 2; _i < arguments.length; _i++)args[_i - 2] = arguments[_i]; - target = target || {}; - for(var _a = 0, args_1 = args; _a < args_1.length; _a++){ - var sourceObject = args_1[_a]; - if (sourceObject) { - for(var propName in sourceObject)if (sourceObject.hasOwnProperty(propName) && (!isAllowed || isAllowed(propName))) target[propName] = sourceObject[propName]; - } - } - return target; -} -function mapEnumByName(// eslint-disable-next-line @typescript-eslint/no-explicit-any -theEnum, callback) { - // map<any> to satisfy compiler since it doesn't realize we strip out undefineds in the .filter() call - return Object.keys(theEnum).map(function(p) { - // map on each property name as a string - if (String(Number(p)) !== p) // if the property is not just a number (because enums in TypeScript will map both ways) - return callback(p, theEnum[p]); - return undefined; - }).filter(function(v) { - return !!v; - }); // only return elements with values -} -function values(obj) { - return Object.keys(obj).reduce(function(arr, key) { - arr.push(obj[key]); - return arr; - }, []); -} -function omit(obj, exclusions) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var result = {}; - for(var key in obj)if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) result[key] = obj[key]; - return result; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c99qU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATA_IS_SCROLLABLE_ATTRIBUTE", ()=>DATA_IS_SCROLLABLE_ATTRIBUTE); -parcelHelpers.export(exports, "allowScrollOnElement", ()=>allowScrollOnElement); -parcelHelpers.export(exports, "allowOverscrollOnElement", ()=>allowOverscrollOnElement); -/** - * Disables the body scrolling. - * - * @public - */ parcelHelpers.export(exports, "disableBodyScroll", ()=>disableBodyScroll); -/** - * Enables the body scrolling. - * - * @public - */ parcelHelpers.export(exports, "enableBodyScroll", ()=>enableBodyScroll); -/** - * Calculates the width of a scrollbar for the browser/os. - * - * @public - */ parcelHelpers.export(exports, "getScrollbarWidth", ()=>getScrollbarWidth); -/** - * Traverses up the DOM for the element with the data-is-scrollable=true attribute, or returns - * document.body. - * - * @public - */ parcelHelpers.export(exports, "findScrollableParent", ()=>findScrollableParent); -var _getDocument = require("./dom/getDocument"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _getWindow = require("./dom/getWindow"); -var _scrollbarWidth; -var _bodyScrollDisabledCount = 0; -var DisabledScrollClassName = (0, _mergeStyles.mergeStyles)({ - overflow: 'hidden !important' -}); -var DATA_IS_SCROLLABLE_ATTRIBUTE = 'data-is-scrollable'; -var allowScrollOnElement = function(element, events) { - var window = (0, _getWindow.getWindow)(element); - if (!element || !window) return; - var _previousClientY = 0; - var _element = null; - var computedStyles = window.getComputedStyle(element); - // remember the clientY for future calls of _preventOverscrolling - var _saveClientY = function(event) { - if (event.targetTouches.length === 1) _previousClientY = event.targetTouches[0].clientY; - }; - // prevent the body from scrolling when the user attempts - // to scroll past the top or bottom of the element - var _preventOverscrolling = function(event) { - // only respond to a single-finger touch - if (event.targetTouches.length !== 1) return; - // prevent the body touchmove handler from firing - // so that scrolling is allowed within the element - event.stopPropagation(); - if (!_element) return; - var clientY = event.targetTouches[0].clientY - _previousClientY; - var scrollableParent = findScrollableParent(event.target); - if (scrollableParent && _element !== scrollableParent) { - _element = scrollableParent; - computedStyles = window.getComputedStyle(_element); - } - var scrollTop = _element.scrollTop; - var isColumnReverse = (computedStyles === null || computedStyles === void 0 ? void 0 : computedStyles.flexDirection) === 'column-reverse'; - // if the element is scrolled to the top, - // prevent the user from scrolling up - if (scrollTop === 0 && (isColumnReverse ? clientY < 0 : clientY > 0)) event.preventDefault(); - // if the element is scrolled to the bottom, - // prevent the user from scrolling down - if (_element.scrollHeight - Math.abs(Math.ceil(scrollTop)) <= _element.clientHeight && (isColumnReverse ? clientY > 0 : clientY < 0)) event.preventDefault(); - }; - events.on(element, 'touchstart', _saveClientY, { - passive: false - }); - events.on(element, 'touchmove', _preventOverscrolling, { - passive: false - }); - _element = element; -}; -var allowOverscrollOnElement = function(element, events) { - if (!element) return; - var _allowElementScroll = function(event) { - event.stopPropagation(); - }; - events.on(element, 'touchmove', _allowElementScroll, { - passive: false - }); -}; -var _disableIosBodyScroll = function(event) { - event.preventDefault(); -}; -function disableBodyScroll() { - var doc = (0, _getDocument.getDocument)(); - if (doc && doc.body && !_bodyScrollDisabledCount) { - doc.body.classList.add(DisabledScrollClassName); - doc.body.addEventListener('touchmove', _disableIosBodyScroll, { - passive: false, - capture: false - }); - } - _bodyScrollDisabledCount++; -} -function enableBodyScroll() { - if (_bodyScrollDisabledCount > 0) { - var doc = (0, _getDocument.getDocument)(); - if (doc && doc.body && _bodyScrollDisabledCount === 1) { - doc.body.classList.remove(DisabledScrollClassName); - doc.body.removeEventListener('touchmove', _disableIosBodyScroll); - } - _bodyScrollDisabledCount--; - } -} -function getScrollbarWidth(doc) { - if (_scrollbarWidth === undefined) { - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _getDocument.getDocument)(); - var scrollDiv = theDoc.createElement('div'); - scrollDiv.style.setProperty('width', '100px'); - scrollDiv.style.setProperty('height', '100px'); - scrollDiv.style.setProperty('overflow', 'scroll'); - scrollDiv.style.setProperty('position', 'absolute'); - scrollDiv.style.setProperty('top', '-9999px'); - theDoc.body.appendChild(scrollDiv); - // Get the scrollbar width - _scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - // Delete the DIV - theDoc.body.removeChild(scrollDiv); + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; } - return _scrollbarWidth; -} -function findScrollableParent(startingElement) { - var el = startingElement; - var doc = (0, _getDocument.getDocument)(startingElement); - // First do a quick scan for the scrollable attribute. - while(el && el !== doc.body){ - if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) === 'true') return el; - el = el.parentElement; + return filteredAssign.apply(this, [null, target2].concat(args)); + } + function filteredAssign(isAllowed, target2) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + target2 = target2 || {}; + for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) { + var sourceObject = args_1[_a2]; + if (sourceObject) { + for (var propName in sourceObject) { + if (sourceObject.hasOwnProperty(propName) && (!isAllowed || isAllowed(propName))) { + target2[propName] = sourceObject[propName]; + } + } + } } - // If we haven't found it, the use the slower method: compute styles to evaluate if overflow is set. - el = startingElement; - while(el && el !== doc.body){ - if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) !== 'false') { - var computedStyles = getComputedStyle(el); - var overflowY = computedStyles ? computedStyles.getPropertyValue('overflow-y') : ''; - if (overflowY && (overflowY === 'scroll' || overflowY === 'auto')) return el; + return target2; + } + var EventGroup = ( + /** @class */ + (function() { + function EventGroup2(parent) { + this._id = EventGroup2._uniqueId++; + this._parent = parent; + this._eventRecords = []; + } + EventGroup2.raise = function(target2, eventName, eventArgs, bubbleEvent, doc) { + var retVal2; + var theDoc = doc !== null && doc !== void 0 ? doc : getDocument(); + if (EventGroup2._isElement(target2)) { + if (typeof theDoc !== "undefined" && theDoc.createEvent) { + var ev = theDoc.createEvent("HTMLEvents"); + ev.initEvent(eventName, bubbleEvent || false, true); + assign(ev, eventArgs); + retVal2 = target2.dispatchEvent(ev); + } else if (typeof theDoc !== "undefined" && theDoc.createEventObject) { + var evObj = theDoc.createEventObject(eventArgs); + target2.fireEvent("on" + eventName, evObj); + } + } else { + while (target2 && retVal2 !== false) { + var events2 = target2.__events__; + var eventRecords = events2 ? events2[eventName] : null; + if (eventRecords) { + for (var id2 in eventRecords) { + if (eventRecords.hasOwnProperty(id2)) { + var eventRecordList = eventRecords[id2]; + for (var listIndex = 0; retVal2 !== false && listIndex < eventRecordList.length; listIndex++) { + var record = eventRecordList[listIndex]; + if (record.objectCallback) { + retVal2 = record.objectCallback.call(record.parent, eventArgs); + } + } + } + } + } + target2 = bubbleEvent ? target2.parent : null; + } + } + return retVal2; + }; + EventGroup2.isObserved = function(target2, eventName) { + var events2 = target2 && target2.__events__; + return !!events2 && !!events2[eventName]; + }; + EventGroup2.isDeclared = function(target2, eventName) { + var declaredEvents = target2 && target2.__declaredEvents; + return !!declaredEvents && !!declaredEvents[eventName]; + }; + EventGroup2.stopPropagation = function(event2) { + if (event2.stopPropagation) { + event2.stopPropagation(); + } else { + event2.cancelBubble = true; } - el = el.parentElement; + }; + EventGroup2._isElement = function(target2) { + return !!target2 && (!!target2.addEventListener || typeof HTMLElement !== "undefined" && target2 instanceof HTMLElement); + }; + EventGroup2.prototype.dispose = function() { + if (!this._isDisposed) { + this._isDisposed = true; + this.off(); + this._parent = null; + } + }; + EventGroup2.prototype.onAll = function(target2, events2, useCapture) { + for (var eventName in events2) { + if (events2.hasOwnProperty(eventName)) { + this.on(target2, eventName, events2[eventName], useCapture); + } + } + }; + EventGroup2.prototype.on = function(target2, eventName, callback, options2) { + var _this = this; + if (eventName.indexOf(",") > -1) { + var events2 = eventName.split(/[ ,]+/); + for (var i = 0; i < events2.length; i++) { + this.on(target2, events2[i], callback, options2); + } + } else { + var parent_1 = this._parent; + var eventRecord = { + target: target2, + eventName, + parent: parent_1, + callback, + options: options2 + }; + var events2 = target2.__events__ = target2.__events__ || {}; + events2[eventName] = events2[eventName] || { + count: 0 + }; + events2[eventName][this._id] = events2[eventName][this._id] || []; + events2[eventName][this._id].push(eventRecord); + events2[eventName].count++; + if (EventGroup2._isElement(target2)) { + var processElementEvent = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (_this._isDisposed) { + return; + } + var result; + try { + result = callback.apply(parent_1, args); + if (result === false && args[0]) { + var e = args[0]; + if (e.preventDefault) { + e.preventDefault(); + } + if (e.stopPropagation) { + e.stopPropagation(); + } + e.cancelBubble = true; + } + } catch (e3) { + } + return result; + }; + eventRecord.elementCallback = processElementEvent; + if (target2.addEventListener) { + target2.addEventListener(eventName, processElementEvent, options2); + } else if (target2.attachEvent) { + target2.attachEvent("on" + eventName, processElementEvent); + } + } else { + var processObjectEvent = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (_this._isDisposed) { + return; + } + return callback.apply(parent_1, args); + }; + eventRecord.objectCallback = processObjectEvent; + } + this._eventRecords.push(eventRecord); + } + }; + EventGroup2.prototype.off = function(target2, eventName, callback, options2) { + for (var i = 0; i < this._eventRecords.length; i++) { + var eventRecord = this._eventRecords[i]; + if ((!target2 || target2 === eventRecord.target) && (!eventName || eventName === eventRecord.eventName) && (!callback || callback === eventRecord.callback) && (typeof options2 !== "boolean" || options2 === eventRecord.options)) { + var events2 = eventRecord.target.__events__; + var targetArrayLookup = events2[eventRecord.eventName]; + var targetArray = targetArrayLookup ? targetArrayLookup[this._id] : null; + if (targetArray) { + if (targetArray.length === 1 || !callback) { + targetArrayLookup.count -= targetArray.length; + delete events2[eventRecord.eventName][this._id]; + } else { + targetArrayLookup.count--; + targetArray.splice(targetArray.indexOf(eventRecord), 1); + } + if (!targetArrayLookup.count) { + delete events2[eventRecord.eventName]; + } + } + if (eventRecord.elementCallback) { + if (eventRecord.target.removeEventListener) { + eventRecord.target.removeEventListener(eventRecord.eventName, eventRecord.elementCallback, eventRecord.options); + } else if (eventRecord.target.detachEvent) { + eventRecord.target.detachEvent("on" + eventRecord.eventName, eventRecord.elementCallback); + } + } + this._eventRecords.splice(i--, 1); + } + } + }; + EventGroup2.prototype.raise = function(eventName, eventArgs, bubbleEvent) { + return EventGroup2.raise(this._parent, eventName, eventArgs, bubbleEvent); + }; + EventGroup2.prototype.declare = function(event2) { + var declaredEvents = this._parent.__declaredEvents = this._parent.__declaredEvents || {}; + if (typeof event2 === "string") { + declaredEvents[event2] = true; + } else { + for (var i = 0; i < event2.length; i++) { + declaredEvents[event2[i]] = true; + } + } + }; + EventGroup2._uniqueId = 0; + return EventGroup2; + })() + ); + var GLOBAL_STYLESHEET_KEY = "__global__"; + var SHADOW_DOM_STYLESHEET_SETTING = "__shadow_dom_stylesheet__"; + var DEFAULT_SHADOW_CONFIG = { + stylesheetKey: GLOBAL_STYLESHEET_KEY, + inShadow: false, + window: void 0, + __isShadowConfig__: true + }; + var makeShadowConfig = function(stylesheetKey, inShadow, window2) { + return { + stylesheetKey, + inShadow, + window: window2, + __isShadowConfig__: true + }; + }; + var isShadowConfig = function(value2) { + if (!(value2 && isRecord(value2))) { + return false; } - // Fall back to window scroll. - if (!el || el === doc.body) el = (0, _getWindow.getWindow)(startingElement); - return el; -} - -},{"./dom/getDocument":"7EOu7","@fluentui/merge-styles":"bDG2L","./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bDG2L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _mergeStyles.mergeStyles)); -parcelHelpers.export(exports, "mergeCss", ()=>(0, _mergeStyles.mergeCss)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _mergeStyleSets.mergeStyleSets)); -parcelHelpers.export(exports, "mergeCssSets", ()=>(0, _mergeStyleSets.mergeCssSets)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _concatStyleSets.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _concatStyleSetsWithProps.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _fontFace.fontFace)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _keyframes.keyframes)); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _stylesheet.InjectionMode)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _stylesheet.Stylesheet)); -parcelHelpers.export(exports, "ShadowDomStylesheet", ()=>(0, _shadowDomStylesheet.ShadowDomStylesheet)); -parcelHelpers.export(exports, "SUPPORTS_CONSTRUCTABLE_STYLESHEETS", ()=>(0, _shadowDomStylesheet.SUPPORTS_CONSTRUCTABLE_STYLESHEETS)); -parcelHelpers.export(exports, "SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS", ()=>(0, _shadowDomStylesheet.SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS)); -parcelHelpers.export(exports, "setRTL", ()=>(0, _styleOptionsState.setRTL)); -parcelHelpers.export(exports, "DEFAULT_SHADOW_CONFIG", ()=>(0, _shadowConfig.DEFAULT_SHADOW_CONFIG)); -parcelHelpers.export(exports, "GLOBAL_STYLESHEET_KEY", ()=>(0, _shadowConfig.GLOBAL_STYLESHEET_KEY)); -parcelHelpers.export(exports, "makeShadowConfig", ()=>(0, _shadowConfig.makeShadowConfig)); -parcelHelpers.export(exports, "cloneCSSStyleSheet", ()=>(0, _cloneCSSStyleSheet.cloneCSSStyleSheet)); -var _mergeStyles = require("./mergeStyles"); -var _mergeStyleSets = require("./mergeStyleSets"); -var _concatStyleSets = require("./concatStyleSets"); -var _concatStyleSetsWithProps = require("./concatStyleSetsWithProps"); -var _fontFace = require("./fontFace"); -var _keyframes = require("./keyframes"); -var _stylesheet = require("./Stylesheet"); -var _shadowDomStylesheet = require("./ShadowDomStylesheet"); -var _styleOptionsState = require("./StyleOptionsState"); -var _shadowConfig = require("./shadowConfig"); -var _cloneCSSStyleSheet = require("./cloneCSSStyleSheet"); -var _version = require("./version"); - -},{"./mergeStyles":"2LkLK","./mergeStyleSets":"kqzRE","./concatStyleSets":"5Msd3","./concatStyleSetsWithProps":"9Tcvm","./fontFace":"5xypM","./keyframes":"h7yKx","./Stylesheet":"5wD4L","./ShadowDomStylesheet":"4ADZe","./StyleOptionsState":"4aGJx","./shadowConfig":"7TWty","./cloneCSSStyleSheet":"5w3No","./version":"1UJId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2LkLK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Concatenation helper, which can merge class names together. Skips over falsey values. - * - * @public - */ parcelHelpers.export(exports, "mergeStyles", ()=>mergeStyles); -/** - * Concatenation helper, which can merge class names together. Skips over falsey values. - * Accepts a set of options that will be used when calculating styles. - * - * @public - */ parcelHelpers.export(exports, "mergeCss", ()=>mergeCss); -var _extractStyleParts = require("./extractStyleParts"); -var _shadowConfig = require("./shadowConfig"); -var _styleOptionsState = require("./StyleOptionsState"); -var _stylesheet = require("./Stylesheet"); -var _styleToClassName = require("./styleToClassName"); -function mergeStyles() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - return mergeCss(args, (0, _styleOptionsState.getStyleOptions)()); -} -function mergeCss(args, options) { - var styleArgs = args instanceof Array ? args : [ - args - ]; - var opts = options || {}; - var hasShadowConfig = (0, _shadowConfig.isShadowConfig)(styleArgs[0]); - if (hasShadowConfig) opts.shadowConfig = styleArgs[0]; - opts.stylesheet = (0, _stylesheet.Stylesheet).getInstance(opts.shadowConfig); - var _a = (0, _extractStyleParts.extractStyleParts)(opts.stylesheet, styleArgs), classes = _a.classes, objects = _a.objects; - if (objects.length) classes.push((0, _styleToClassName.styleToClassName)(opts, objects)); - return classes.join(' '); -} - -},{"./extractStyleParts":"gPZki","./shadowConfig":"7TWty","./StyleOptionsState":"4aGJx","./Stylesheet":"5wD4L","./styleToClassName":"7B171","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gPZki":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Separates the classes and style objects. Any classes that are pre-registered - * args are auto expanded into objects. - */ parcelHelpers.export(exports, "extractStyleParts", ()=>extractStyleParts); -var _shadowConfig = require("./shadowConfig"); -function extractStyleParts(sheet) { + return value2.__isShadowConfig__ === true; + }; + function isRecord(value2) { + return value2 !== null && typeof value2 === "object" && !Array.isArray(value2); + } + function extractStyleParts(sheet) { var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } var classes = []; var objects = []; - var stylesheet = sheet; + var stylesheet2 = sheet; function _processArgs(argsList) { - for(var _i = 0, argsList_1 = argsList; _i < argsList_1.length; _i++){ - var arg = argsList_1[_i]; - if (arg && !(0, _shadowConfig.isShadowConfig)(arg)) { - if (typeof arg === 'string') { - if (arg.indexOf(' ') >= 0) _processArgs(arg.split(' ')); - else { - var translatedArgs = stylesheet.argsFromClassName(arg); - if (translatedArgs) _processArgs(translatedArgs); - else // Avoid adding the same class twice. - if (classes.indexOf(arg) === -1) classes.push(arg); - } - } else if (Array.isArray(arg)) _processArgs(arg); - else if (typeof arg === 'object') objects.push(arg); + for (var _i2 = 0, argsList_1 = argsList; _i2 < argsList_1.length; _i2++) { + var arg = argsList_1[_i2]; + if (arg && !isShadowConfig(arg)) { + if (typeof arg === "string") { + if (arg.indexOf(" ") >= 0) { + _processArgs(arg.split(" ")); + } else { + var translatedArgs = stylesheet2.argsFromClassName(arg); + if (translatedArgs) { + _processArgs(translatedArgs); + } else { + if (classes.indexOf(arg) === -1) { + classes.push(arg); + } + } } + } else if (Array.isArray(arg)) { + _processArgs(arg); + } else if (typeof arg === "object") { + objects.push(arg); + } } + } } _processArgs(args); return { - classes: classes, - objects: objects - }; -} - -},{"./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7TWty":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GLOBAL_STYLESHEET_KEY", ()=>GLOBAL_STYLESHEET_KEY); -parcelHelpers.export(exports, "SHADOW_DOM_STYLESHEET_SETTING", ()=>SHADOW_DOM_STYLESHEET_SETTING); -parcelHelpers.export(exports, "DEFAULT_SHADOW_CONFIG", ()=>DEFAULT_SHADOW_CONFIG); -parcelHelpers.export(exports, "makeShadowConfig", ()=>makeShadowConfig); -parcelHelpers.export(exports, "isShadowConfig", ()=>isShadowConfig); -var GLOBAL_STYLESHEET_KEY = '__global__'; -var SHADOW_DOM_STYLESHEET_SETTING = '__shadow_dom_stylesheet__'; -var DEFAULT_SHADOW_CONFIG = { - stylesheetKey: GLOBAL_STYLESHEET_KEY, - inShadow: false, - window: undefined, - __isShadowConfig__: true -}; -var makeShadowConfig = function(stylesheetKey, inShadow, window) { - return { - stylesheetKey: stylesheetKey, - inShadow: inShadow, - window: window, - __isShadowConfig__: true - }; -}; -var isShadowConfig = function(value) { - if (!(value && isRecord(value))) return false; - return value.__isShadowConfig__ === true; -}; -function isRecord(value) { - return value !== null && typeof value === 'object' && !Array.isArray(value); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4aGJx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Sets the current RTL value. - */ parcelHelpers.export(exports, "setRTL", ()=>setRTL); -/** - * Gets the current RTL value. - */ parcelHelpers.export(exports, "getRTL", ()=>getRTL); -parcelHelpers.export(exports, "getStyleOptions", ()=>getStyleOptions); -var _shadowConfig = require("./shadowConfig"); -function setRTL(isRTL) { - if (_rtl !== isRTL) _rtl = isRTL; -} -function getRTL() { - if (_rtl === undefined) _rtl = // eslint-disable-next-line no-restricted-globals - typeof document !== 'undefined' && // eslint-disable-next-line no-restricted-globals - !!document.documentElement && // eslint-disable-next-line no-restricted-globals - document.documentElement.getAttribute('dir') === 'rtl'; + classes, + objects + }; + } + function setRTL$1(isRTL) { + if (_rtl !== isRTL) { + _rtl = isRTL; + } + } + function getRTL$1() { + if (_rtl === void 0) { + _rtl = // eslint-disable-next-line no-restricted-globals + typeof document !== "undefined" && // eslint-disable-next-line no-restricted-globals + !!document.documentElement && // eslint-disable-next-line no-restricted-globals + document.documentElement.getAttribute("dir") === "rtl"; + } return _rtl; -} -// This has been split into 2 lines because it was working in Fabric due to the code being transpiled to es5, so this -// was converted to var while not working in Fluent that uses babel to transpile the code to be es6-like. Splitting the -// logic into two lines, however, allows it to work in both scenarios. -var _rtl; -_rtl = getRTL(); -function getStyleOptions() { + } + var _rtl; + _rtl = getRTL$1(); + function getStyleOptions() { return { - rtl: getRTL(), - shadowConfig: (0, _shadowConfig.DEFAULT_SHADOW_CONFIG) - }; -} - -},{"./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5wD4L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InjectionMode", ()=>InjectionMode); -parcelHelpers.export(exports, "STYLESHEET_SETTING", ()=>STYLESHEET_SETTING); -parcelHelpers.export(exports, "Stylesheet", ()=>Stylesheet); -var _tslib = require("tslib"); -var _shadowConfig = require("./shadowConfig"); -var InjectionMode = { + rtl: getRTL$1(), + shadowConfig: DEFAULT_SHADOW_CONFIG + }; + } + var InjectionMode = { /** * Avoids style injection, use getRules() to read the styles. - */ none: 0, + */ + none: 0, /** * Inserts rules using the insertRule api. - */ insertNode: 1, + */ + insertNode: 1, /** * Appends rules using appendChild. - */ appendChild: 2 -}; -var STYLESHEET_SETTING = '__stylesheet__'; -/** - * MSIE 11 doesn't cascade styles based on DOM ordering, but rather on the order that each style node - * is created. As such, to maintain consistent priority, IE11 should reuse a single style node. - */ var REUSE_STYLE_NODE = typeof navigator !== 'undefined' && /rv:11.0/.test(navigator.userAgent); -var _global = {}; -// Grab window. -try { - // Why the cast? - // if compiled/type checked in same program with `@fluentui/font-icons-mdl2` which extends `Window` on global - // ( check packages/font-icons-mdl2/src/index.ts ) the definitions don't match! Thus the need of this extra assertion - _global = window || {}; -} catch (_a) { -/* leave as blank object */ } -var _stylesheet; -/** - * Represents the state of styles registered in the page. Abstracts - * the surface for adding styles to the stylesheet, exposes helpers - * for reading the styles registered in server rendered scenarios. - * - * @public - */ var Stylesheet = /** @class */ function() { - function Stylesheet(config, serializedStylesheet) { - var _a, _b, _c, _d, _e, _f; + */ + appendChild: 2 + }; + var STYLESHEET_SETTING = "__stylesheet__"; + var REUSE_STYLE_NODE = typeof navigator !== "undefined" && /rv:11.0/.test(navigator.userAgent); + var _global$1 = {}; + try { + _global$1 = window || {}; + } catch (_a2) { + } + var _stylesheet; + var Stylesheet = ( + /** @class */ + (function() { + function Stylesheet2(config, serializedStylesheet) { + var _a2, _b2, _c2, _d2, _e2, _f; this._rules = []; this._preservedRules = []; this._counter = 0; @@ -65319,1526 +37028,1175 @@ var _stylesheet; this._onInsertRuleCallbacks = []; this._onResetCallbacks = []; this._classNameToArgs = {}; - // If there is no document we won't have an element to inject into. - this._config = (0, _tslib.__assign)({ - injectionMode: typeof document === 'undefined' ? InjectionMode.none : InjectionMode.insertNode, - defaultPrefix: 'css', - namespace: undefined, - cspSettings: undefined - }, config); - this._classNameToArgs = (_a = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.classNameToArgs) !== null && _a !== void 0 ? _a : this._classNameToArgs; - this._counter = (_b = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.counter) !== null && _b !== void 0 ? _b : this._counter; - this._keyToClassName = (_d = (_c = this._config.classNameCache) !== null && _c !== void 0 ? _c : serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.keyToClassName) !== null && _d !== void 0 ? _d : this._keyToClassName; - this._preservedRules = (_e = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.preservedRules) !== null && _e !== void 0 ? _e : this._preservedRules; + this._config = __assign$1({ injectionMode: typeof document === "undefined" ? InjectionMode.none : InjectionMode.insertNode, defaultPrefix: "css", namespace: void 0, cspSettings: void 0 }, config); + this._classNameToArgs = (_a2 = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.classNameToArgs) !== null && _a2 !== void 0 ? _a2 : this._classNameToArgs; + this._counter = (_b2 = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.counter) !== null && _b2 !== void 0 ? _b2 : this._counter; + this._keyToClassName = (_d2 = (_c2 = this._config.classNameCache) !== null && _c2 !== void 0 ? _c2 : serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.keyToClassName) !== null && _d2 !== void 0 ? _d2 : this._keyToClassName; + this._preservedRules = (_e2 = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.preservedRules) !== null && _e2 !== void 0 ? _e2 : this._preservedRules; this._rules = (_f = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.rules) !== null && _f !== void 0 ? _f : this._rules; - } - /** - * Gets the singleton instance. - */ Stylesheet.getInstance = function(shadowConfig) { - _stylesheet = _global[STYLESHEET_SETTING]; - if (_global[0, _shadowConfig.SHADOW_DOM_STYLESHEET_SETTING]) return _global[0, _shadowConfig.SHADOW_DOM_STYLESHEET_SETTING].getInstance(shadowConfig); + } + Stylesheet2.getInstance = function(shadowConfig) { + _stylesheet = _global$1[STYLESHEET_SETTING]; + if (_global$1[SHADOW_DOM_STYLESHEET_SETTING]) { + return _global$1[SHADOW_DOM_STYLESHEET_SETTING].getInstance(shadowConfig); + } if (!_stylesheet || _stylesheet._lastStyleElement && _stylesheet._lastStyleElement.ownerDocument !== document) { - var fabricConfig = (_global === null || _global === void 0 ? void 0 : _global.FabricConfig) || {}; - var stylesheet = new Stylesheet(fabricConfig.mergeStyles, fabricConfig.serializedStylesheet); - _stylesheet = stylesheet; - _global[STYLESHEET_SETTING] = stylesheet; + var fabricConfig = (_global$1 === null || _global$1 === void 0 ? void 0 : _global$1.FabricConfig) || {}; + var stylesheet2 = new Stylesheet2(fabricConfig.mergeStyles, fabricConfig.serializedStylesheet); + _stylesheet = stylesheet2; + _global$1[STYLESHEET_SETTING] = stylesheet2; } return _stylesheet; - }; - /** - * Serializes the Stylesheet instance into a format which allows rehydration on creation. - * @returns string representation of `ISerializedStylesheet` interface. - */ Stylesheet.prototype.serialize = function() { + }; + Stylesheet2.prototype.serialize = function() { return JSON.stringify({ - classNameToArgs: this._classNameToArgs, - counter: this._counter, - keyToClassName: this._keyToClassName, - preservedRules: this._preservedRules, - rules: this._rules + classNameToArgs: this._classNameToArgs, + counter: this._counter, + keyToClassName: this._keyToClassName, + preservedRules: this._preservedRules, + rules: this._rules }); - }; - /** - * Configures the stylesheet. - */ Stylesheet.prototype.setConfig = function(config) { - this._config = (0, _tslib.__assign)((0, _tslib.__assign)({}, this._config), config); - }; - /** - * Configures a reset callback. - * - * @param callback - A callback which will be called when the Stylesheet is reset. - * @returns function which when called un-registers provided callback. - */ Stylesheet.prototype.onReset = function(callback) { + }; + Stylesheet2.prototype.setConfig = function(config) { + this._config = __assign$1(__assign$1({}, this._config), config); + }; + Stylesheet2.prototype.onReset = function(callback) { var _this = this; this._onResetCallbacks.push(callback); return function() { - _this._onResetCallbacks = _this._onResetCallbacks.filter(function(cb) { - return cb !== callback; - }); + _this._onResetCallbacks = _this._onResetCallbacks.filter(function(cb) { + return cb !== callback; + }); }; - }; - /** - * Configures an insert rule callback. - * - * @param callback - A callback which will be called when a rule is inserted. - * @returns function which when called un-registers provided callback. - */ Stylesheet.prototype.onInsertRule = function(callback) { + }; + Stylesheet2.prototype.onInsertRule = function(callback) { var _this = this; this._onInsertRuleCallbacks.push(callback); return function() { - _this._onInsertRuleCallbacks = _this._onInsertRuleCallbacks.filter(function(cb) { - return cb !== callback; - }); + _this._onInsertRuleCallbacks = _this._onInsertRuleCallbacks.filter(function(cb) { + return cb !== callback; + }); }; - }; - /** - * Generates a unique classname. - * - * @param displayName - Optional value to use as a prefix. - */ Stylesheet.prototype.getClassName = function(displayName) { + }; + Stylesheet2.prototype.getClassName = function(displayName) { var namespace = this._config.namespace; var prefix = displayName || this._config.defaultPrefix; - return "".concat(namespace ? namespace + '-' : '').concat(prefix, "-").concat(this._counter++); - }; - /** - * Used internally to cache information about a class which was - * registered with the stylesheet. - */ Stylesheet.prototype.cacheClassName = function(className, key, args, rules) { - this._keyToClassName[this._getCacheKey(key)] = className; - this._classNameToArgs[className] = { - args: args, - rules: rules - }; - }; - /** - * Gets the appropriate classname given a key which was previously - * registered using cacheClassName. - */ Stylesheet.prototype.classNameFromKey = function(key) { - return this._keyToClassName[this._getCacheKey(key)]; - }; - /** - * Gets all classnames cache with the stylesheet. - */ Stylesheet.prototype.getClassNameCache = function() { + return "".concat(namespace ? namespace + "-" : "").concat(prefix, "-").concat(this._counter++); + }; + Stylesheet2.prototype.cacheClassName = function(className2, key2, args, rules2) { + this._keyToClassName[this._getCacheKey(key2)] = className2; + this._classNameToArgs[className2] = { + args, + rules: rules2 + }; + }; + Stylesheet2.prototype.classNameFromKey = function(key2) { + return this._keyToClassName[this._getCacheKey(key2)]; + }; + Stylesheet2.prototype.getClassNameCache = function() { return this._keyToClassName; - }; - /** - * Gets the arguments associated with a given classname which was - * previously registered using cacheClassName. - */ Stylesheet.prototype.argsFromClassName = function(className) { - var entry = this._classNameToArgs[className]; - return entry && entry.args; - }; - /** - * Gets the rules associated with a given classname which was - * previously registered using cacheClassName. - */ Stylesheet.prototype.insertedRulesFromClassName = function(className) { - var entry = this._classNameToArgs[className]; - return entry && entry.rules; - }; - /** - * Inserts a css rule into the stylesheet. - * @param preserve - Preserves the rule beyond a reset boundary. - */ Stylesheet.prototype.insertRule = function(rule, preserve, stylesheetKey) { - if (stylesheetKey === void 0) stylesheetKey = (0, _shadowConfig.GLOBAL_STYLESHEET_KEY); + }; + Stylesheet2.prototype.argsFromClassName = function(className2) { + var entry2 = this._classNameToArgs[className2]; + return entry2 && entry2.args; + }; + Stylesheet2.prototype.insertedRulesFromClassName = function(className2) { + var entry2 = this._classNameToArgs[className2]; + return entry2 && entry2.rules; + }; + Stylesheet2.prototype.insertRule = function(rule2, preserve, stylesheetKey) { + if (stylesheetKey === void 0) { + stylesheetKey = GLOBAL_STYLESHEET_KEY; + } var injectionMode = this._config.injectionMode; - var element = injectionMode !== InjectionMode.none ? this._getStyleElement() : undefined; - if (preserve) this._preservedRules.push(rule); - if (element) switch(injectionMode){ + var element2 = injectionMode !== InjectionMode.none ? this._getStyleElement() : void 0; + if (preserve) { + this._preservedRules.push(rule2); + } + if (element2) { + switch (injectionMode) { case InjectionMode.insertNode: - this._insertRuleIntoSheet(element.sheet, rule); - break; + this._insertRuleIntoSheet(element2.sheet, rule2); + break; case InjectionMode.appendChild: - element.appendChild(document.createTextNode(rule)); - break; + element2.appendChild(document.createTextNode(rule2)); + break; + } + } else { + this._rules.push(rule2); + } + if (this._config.onInsertRule) { + this._config.onInsertRule(rule2); } - else this._rules.push(rule); - // eslint-disable-next-line deprecation/deprecation - if (this._config.onInsertRule) // eslint-disable-next-line deprecation/deprecation - this._config.onInsertRule(rule); this._onInsertRuleCallbacks.forEach(function(callback) { - return callback({ - key: stylesheetKey, - sheet: element ? element.sheet : undefined, - rule: rule - }); + return callback({ key: stylesheetKey, sheet: element2 ? element2.sheet : void 0, rule: rule2 }); }); - }; - /** - * Gets all rules registered with the stylesheet; only valid when - * using InsertionMode.none. - */ Stylesheet.prototype.getRules = function(includePreservedRules) { - return (includePreservedRules ? this._preservedRules.join('') : '') + this._rules.join(''); - }; - /** - * Resets the internal state of the stylesheet. Only used in server - * rendered scenarios where we're using InsertionMode.none. - */ Stylesheet.prototype.reset = function() { + }; + Stylesheet2.prototype.getRules = function(includePreservedRules) { + return (includePreservedRules ? this._preservedRules.join("") : "") + this._rules.join(""); + }; + Stylesheet2.prototype.reset = function() { this._rules = []; this._counter = 0; this._classNameToArgs = {}; this._keyToClassName = {}; this._onResetCallbacks.forEach(function(callback) { - return callback(); + return callback(); }); - }; - // Forces the regeneration of incoming styles without totally resetting the stylesheet. - Stylesheet.prototype.resetKeys = function() { + }; + Stylesheet2.prototype.resetKeys = function() { this._keyToClassName = {}; - }; - Stylesheet.prototype._createStyleElement = function() { - var _a; - var doc = ((_a = this._config.window) === null || _a === void 0 ? void 0 : _a.document) || document; + }; + Stylesheet2.prototype._createStyleElement = function() { + var _a2; + var doc = ((_a2 = this._config.window) === null || _a2 === void 0 ? void 0 : _a2.document) || document; var head = doc.head; - var styleElement = doc.createElement('style'); + var styleElement = doc.createElement("style"); var nodeToInsertBefore = null; - styleElement.setAttribute('data-merge-styles', 'true'); + styleElement.setAttribute("data-merge-styles", "true"); var cspSettings = this._config.cspSettings; if (cspSettings) { - if (cspSettings.nonce) styleElement.setAttribute('nonce', cspSettings.nonce); + if (cspSettings.nonce) { + styleElement.setAttribute("nonce", cspSettings.nonce); + } } - if (this._lastStyleElement) // If the `nextElementSibling` is null, then the insertBefore will act as a regular append. - // https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore#Syntax - nodeToInsertBefore = this._lastStyleElement.nextElementSibling; - else { - var placeholderStyleTag = this._findPlaceholderStyleTag(); - if (placeholderStyleTag) nodeToInsertBefore = placeholderStyleTag.nextElementSibling; - else nodeToInsertBefore = head.childNodes[0]; + if (this._lastStyleElement) { + nodeToInsertBefore = this._lastStyleElement.nextElementSibling; + } else { + var placeholderStyleTag = this._findPlaceholderStyleTag(); + if (placeholderStyleTag) { + nodeToInsertBefore = placeholderStyleTag.nextElementSibling; + } else { + nodeToInsertBefore = head.childNodes[0]; + } } head.insertBefore(styleElement, head.contains(nodeToInsertBefore) ? nodeToInsertBefore : null); this._lastStyleElement = styleElement; return styleElement; - }; - Stylesheet.prototype._insertRuleIntoSheet = function(sheet, rule) { - if (!sheet) return false; + }; + Stylesheet2.prototype._insertRuleIntoSheet = function(sheet, rule2) { + if (!sheet) { + return false; + } try { - sheet.insertRule(rule, sheet.cssRules.length); - return true; + sheet.insertRule(rule2, sheet.cssRules.length); + return true; } catch (e) { - // The browser will throw exceptions on unsupported rules (such as a moz prefix in webkit.) - // We need to swallow the exceptions for this scenario, otherwise we'd need to filter - // which could be slower and bulkier. } return false; - }; - Stylesheet.prototype._getCacheKey = function(key) { - return key; - }; - Stylesheet.prototype._getStyleElement = function() { + }; + Stylesheet2.prototype._getCacheKey = function(key2) { + return key2; + }; + Stylesheet2.prototype._getStyleElement = function() { var _this = this; if (!this._styleElement) { - this._styleElement = this._createStyleElement(); - if (!REUSE_STYLE_NODE) { - // Reset the style element on the next frame. - var win = this._config.window || window; - win.requestAnimationFrame(function() { - _this._styleElement = undefined; - }); - } + this._styleElement = this._createStyleElement(); + if (!REUSE_STYLE_NODE) { + var win = this._config.window || window; + win.requestAnimationFrame(function() { + _this._styleElement = void 0; + }); + } } return this._styleElement; - }; - Stylesheet.prototype._findPlaceholderStyleTag = function() { + }; + Stylesheet2.prototype._findPlaceholderStyleTag = function() { var head = document.head; - if (head) return head.querySelector('style[data-merge-styles]'); + if (head) { + return head.querySelector("style[data-merge-styles]"); + } return null; - }; - return Stylesheet; -}(); - -},{"tslib":"9gizs","./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7B171":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "serializeRuleEntries", ()=>serializeRuleEntries); -parcelHelpers.export(exports, "styleToRegistration", ()=>styleToRegistration); -/** - * Insert style to stylesheet. - * @param registration Style registration. - * @param specificityMultiplier Number of times classname selector is repeated in the css rule. - * This is to increase css specificity in case it's needed. Default to 1. - */ parcelHelpers.export(exports, "applyRegistration", ()=>applyRegistration); -parcelHelpers.export(exports, "styleToClassName", ()=>styleToClassName); -var _tslib = require("tslib"); -var _stylesheet = require("./Stylesheet"); -var _kebabRules = require("./transforms/kebabRules"); -var _prefixRules = require("./transforms/prefixRules"); -var _provideUnits = require("./transforms/provideUnits"); -var _rtlifyRules = require("./transforms/rtlifyRules"); -var _tokenizeWithParentheses = require("./tokenizeWithParentheses"); -var DISPLAY_NAME = 'displayName'; -function getDisplayName(rules) { - var rootStyle = rules && rules['&']; - return rootStyle ? rootStyle.displayName : undefined; -} -var globalSelectorRegExp = /\:global\((.+?)\)/g; -/** - * Finds comma separated selectors in a :global() e.g. ":global(.class1, .class2, .class3)" - * and wraps them each in their own global ":global(.class1), :global(.class2), :global(.class3)" - * - * @param selectorWithGlobals The selector to process - * @returns The updated selector - */ function expandCommaSeparatedGlobals(selectorWithGlobals) { - // We the selector does not have a :global() we can shortcut - if (!globalSelectorRegExp.test(selectorWithGlobals)) return selectorWithGlobals; + }; + return Stylesheet2; + })() + ); + var rules = {}; + function kebabRules(rulePairs, index2) { + var rule2 = rulePairs[index2]; + if (rule2.charAt(0) !== "-") { + rulePairs[index2] = rules[rule2] = rules[rule2] || rule2.replace(/([A-Z])/g, "-$1").toLowerCase(); + } + } + var _vendorSettings; + function getVendorSettings() { + var _a2; + if (!_vendorSettings) { + var doc = typeof document !== "undefined" ? document : void 0; + var nav = typeof navigator !== "undefined" ? navigator : void 0; + var userAgent = (_a2 = nav === null || nav === void 0 ? void 0 : nav.userAgent) === null || _a2 === void 0 ? void 0 : _a2.toLowerCase(); + if (!doc) { + _vendorSettings = { + isWebkit: true, + isMoz: true, + isOpera: true, + isMs: true + }; + } else { + _vendorSettings = { + isWebkit: !!(doc && "WebkitAppearance" in doc.documentElement.style), + isMoz: !!(userAgent && userAgent.indexOf("firefox") > -1), + isOpera: !!(userAgent && userAgent.indexOf("opera") > -1), + isMs: !!(nav && (/rv:11.0/i.test(nav.userAgent) || /Edge\/\d./i.test(navigator.userAgent))) + }; + } + } + return _vendorSettings; + } + var autoPrefixNames = { + "user-select": 1 + }; + function prefixRules(rulePairs, index2) { + var vendorSettings = getVendorSettings(); + var name = rulePairs[index2]; + if (autoPrefixNames[name]) { + var value2 = rulePairs[index2 + 1]; + if (autoPrefixNames[name]) { + if (vendorSettings.isWebkit) { + rulePairs.push("-webkit-" + name, value2); + } + if (vendorSettings.isMoz) { + rulePairs.push("-moz-" + name, value2); + } + if (vendorSettings.isMs) { + rulePairs.push("-ms-" + name, value2); + } + if (vendorSettings.isOpera) { + rulePairs.push("-o-" + name, value2); + } + } + } + } + var NON_PIXEL_NUMBER_PROPS = [ + "column-count", + "font-weight", + "flex", + "flex-grow", + "flex-shrink", + "fill-opacity", + "opacity", + "order", + "z-index", + "zoom" + ]; + function provideUnits(rulePairs, index2) { + var name = rulePairs[index2]; + var value2 = rulePairs[index2 + 1]; + if (typeof value2 === "number") { + var isNonPixelProp = NON_PIXEL_NUMBER_PROPS.indexOf(name) > -1; + var isVariableOrPrefixed = name.indexOf("--") > -1; + var unit2 = isNonPixelProp || isVariableOrPrefixed ? "" : "px"; + rulePairs[index2 + 1] = "".concat(value2).concat(unit2); + } + } + var _a$6; + var LEFT$1 = "left"; + var RIGHT$1 = "right"; + var NO_FLIP = "@noflip"; + var NAME_REPLACEMENTS = (_a$6 = {}, _a$6[LEFT$1] = RIGHT$1, _a$6[RIGHT$1] = LEFT$1, _a$6); + var VALUE_REPLACEMENTS = { + "w-resize": "e-resize", + "sw-resize": "se-resize", + "nw-resize": "ne-resize" + }; + function rtlifyRules(options2, rulePairs, index2) { + if (options2.rtl) { + var name_1 = rulePairs[index2]; + if (!name_1) { + return; + } + var value2 = rulePairs[index2 + 1]; + if (typeof value2 === "string" && value2.indexOf(NO_FLIP) >= 0) { + rulePairs[index2 + 1] = value2.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g, ""); + } else if (name_1.indexOf(LEFT$1) >= 0) { + rulePairs[index2] = name_1.replace(LEFT$1, RIGHT$1); + } else if (name_1.indexOf(RIGHT$1) >= 0) { + rulePairs[index2] = name_1.replace(RIGHT$1, LEFT$1); + } else if (String(value2).indexOf(LEFT$1) >= 0) { + rulePairs[index2 + 1] = value2.replace(LEFT$1, RIGHT$1); + } else if (String(value2).indexOf(RIGHT$1) >= 0) { + rulePairs[index2 + 1] = value2.replace(RIGHT$1, LEFT$1); + } else if (NAME_REPLACEMENTS[name_1]) { + rulePairs[index2] = NAME_REPLACEMENTS[name_1]; + } else if (VALUE_REPLACEMENTS[value2]) { + rulePairs[index2 + 1] = VALUE_REPLACEMENTS[value2]; + } else { + switch (name_1) { + case "margin": + case "padding": + rulePairs[index2 + 1] = flipQuad(value2); + break; + case "box-shadow": + rulePairs[index2 + 1] = negateNum(value2, 0); + break; + } + } + } + } + function negateNum(value2, partIndex) { + var parts = value2.split(" "); + var numberVal = parseInt(parts[partIndex], 10); + parts[0] = parts[0].replace(String(numberVal), String(numberVal * -1)); + return parts.join(" "); + } + function flipQuad(value2) { + if (typeof value2 === "string") { + var parts = value2.split(" "); + if (parts.length === 4) { + return "".concat(parts[0], " ").concat(parts[3], " ").concat(parts[2], " ").concat(parts[1]); + } + } + return value2; + } + function tokenizeWithParentheses(value2) { + var parts = []; + var partStart = 0; + var parens = 0; + for (var i = 0; i < value2.length; i++) { + switch (value2[i]) { + case "(": + parens++; + break; + case ")": + if (parens) { + parens--; + } + break; + case " ": + case " ": + if (!parens) { + if (i > partStart) { + parts.push(value2.substring(partStart, i)); + } + partStart = i + 1; + } + break; + } + } + if (partStart < value2.length) { + parts.push(value2.substring(partStart)); + } + return parts; + } + var DISPLAY_NAME = "displayName"; + function getDisplayName(rules2) { + var rootStyle = rules2 && rules2["&"]; + return rootStyle ? rootStyle.displayName : void 0; + } + var globalSelectorRegExp = /\:global\((.+?)\)/g; + function expandCommaSeparatedGlobals(selectorWithGlobals) { + if (!globalSelectorRegExp.test(selectorWithGlobals)) { + return selectorWithGlobals; + } var replacementInfo = []; var findGlobal = /\:global\((.+?)\)/g; - var match = null; - // Create a result list for global selectors so we can replace them. - while(match = findGlobal.exec(selectorWithGlobals))// Only if the found selector is a comma separated list we'll process it. - if (match[1].indexOf(',') > -1) replacementInfo.push([ - match.index, - match.index + match[0].length, - // Wrap each of the found selectors in :global() - match[1].split(',').map(function(v) { + var match2 = null; + while (match2 = findGlobal.exec(selectorWithGlobals)) { + if (match2[1].indexOf(",") > -1) { + replacementInfo.push([ + match2.index, + match2.index + match2[0].length, + // Wrap each of the found selectors in :global() + match2[1].split(",").map(function(v) { return ":global(".concat(v.trim(), ")"); - }).join(', ') - ]); - // Replace the found selectors with their wrapped variants in reverse order - return replacementInfo.reverse().reduce(function(selector, _a) { - var matchIndex = _a[0], matchEndIndex = _a[1], replacement = _a[2]; - var prefix = selector.slice(0, matchIndex); - var suffix = selector.slice(matchEndIndex); - return prefix + replacement + suffix; + }).join(", ") + ]); + } + } + return replacementInfo.reverse().reduce(function(selector, _a2) { + var matchIndex = _a2[0], matchEndIndex = _a2[1], replacement = _a2[2]; + var prefix = selector.slice(0, matchIndex); + var suffix = selector.slice(matchEndIndex); + return prefix + replacement + suffix; }, selectorWithGlobals); -} -function isSelector(potentialSelector) { - return potentialSelector.indexOf(':global(') >= 0 || potentialSelector.indexOf(':') === 0; -} -function expandSelector(newSelector, currentSelector) { - if (newSelector.indexOf(':global(') >= 0) return newSelector.replace(globalSelectorRegExp, '$1'); - else if (newSelector.indexOf(':host(') === 0) return newSelector; - else if (newSelector.indexOf(':') === 0) return currentSelector + newSelector; - else if (newSelector.indexOf('&') < 0) return currentSelector + ' ' + newSelector; + } + function isSelector(potentialSelector) { + return potentialSelector.indexOf(":global(") >= 0 || potentialSelector.indexOf(":") === 0; + } + function expandSelector(newSelector, currentSelector) { + if (newSelector.indexOf(":global(") >= 0) { + return newSelector.replace(globalSelectorRegExp, "$1"); + } else if (newSelector.indexOf(":host(") === 0) { + return newSelector; + } else if (newSelector.indexOf(":") === 0) { + return currentSelector + newSelector; + } else if (newSelector.indexOf("&") < 0) { + return currentSelector + " " + newSelector; + } return newSelector; -} -function extractSelector(currentSelector, rules, selector, value, stylesheet) { - if (rules === void 0) rules = { - __order: [] - }; - if (selector.indexOf('@') === 0) { - selector = selector + '{' + currentSelector; - extractRules([ - value - ], rules, selector, stylesheet); - } else if (selector.indexOf(',') > -1) expandCommaSeparatedGlobals(selector).split(',').map(function(s) { - return s.trim(); - }).forEach(function(separatedSelector) { - return extractRules([ - value - ], rules, expandSelector(separatedSelector, currentSelector), stylesheet); - }); - else extractRules([ - value - ], rules, expandSelector(selector, currentSelector), stylesheet); -} -function extractRules(args, rules, currentSelector, stylesheet) { - if (rules === void 0) rules = { - __order: [] - }; - if (currentSelector === void 0) currentSelector = '&'; - var currentRules = rules[currentSelector]; + } + function extractSelector(currentSelector, rules2, selector, value2, stylesheet2) { + if (rules2 === void 0) { + rules2 = { __order: [] }; + } + if (selector.indexOf("@") === 0) { + selector = selector + "{" + currentSelector; + extractRules([value2], rules2, selector, stylesheet2); + } else if (selector.indexOf(",") > -1) { + expandCommaSeparatedGlobals(selector).split(",").map(function(s2) { + return s2.trim(); + }).forEach(function(separatedSelector) { + return extractRules([value2], rules2, expandSelector(separatedSelector, currentSelector), stylesheet2); + }); + } else { + extractRules([value2], rules2, expandSelector(selector, currentSelector), stylesheet2); + } + } + function extractRules(args, rules2, currentSelector, stylesheet2) { + if (rules2 === void 0) { + rules2 = { __order: [] }; + } + if (currentSelector === void 0) { + currentSelector = "&"; + } + var currentRules = rules2[currentSelector]; if (!currentRules) { - currentRules = {}; - rules[currentSelector] = currentRules; - rules.__order.push(currentSelector); - } - for(var _i = 0, args_1 = args; _i < args_1.length; _i++){ - var arg = args_1[_i]; - // If the arg is a string, we need to look up the class map and merge. - if (typeof arg === 'string') { - var expandedRules = stylesheet.argsFromClassName(arg); - if (expandedRules) extractRules(expandedRules, rules, currentSelector, stylesheet); - // Else if the arg is an array, we need to recurse in. - } else if (Array.isArray(arg)) extractRules(arg, rules, currentSelector, stylesheet); - else { - for(var prop in arg)if (arg.hasOwnProperty(prop)) { - var propValue = arg[prop]; - if (prop === 'selectors') { - // every child is a selector. - var selectors = arg.selectors; - for(var newSelector in selectors)if (selectors.hasOwnProperty(newSelector)) extractSelector(currentSelector, rules, newSelector, selectors[newSelector], stylesheet); - } else if (typeof propValue === 'object' || isSelector(prop)) // prop is a selector. - { - if (propValue !== null && propValue !== undefined) extractSelector(currentSelector, rules, prop, propValue, stylesheet); - } else if (propValue !== undefined) { - // Else, add the rule to the currentSelector. - if (prop === 'margin' || prop === 'padding') expandQuads(currentRules, prop, propValue); - else currentRules[prop] = propValue; + currentRules = {}; + rules2[currentSelector] = currentRules; + rules2.__order.push(currentSelector); + } + for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { + var arg = args_1[_i]; + if (typeof arg === "string") { + var expandedRules = stylesheet2.argsFromClassName(arg); + if (expandedRules) { + extractRules(expandedRules, rules2, currentSelector, stylesheet2); + } + } else if (Array.isArray(arg)) { + extractRules(arg, rules2, currentSelector, stylesheet2); + } else { + for (var prop in arg) { + if (arg.hasOwnProperty(prop)) { + var propValue = arg[prop]; + if (prop === "selectors") { + var selectors = arg.selectors; + for (var newSelector in selectors) { + if (selectors.hasOwnProperty(newSelector)) { + extractSelector(currentSelector, rules2, newSelector, selectors[newSelector], stylesheet2); + } + } + } else if (typeof propValue === "object" || isSelector(prop)) { + if (propValue !== null && propValue !== void 0) { + extractSelector(currentSelector, rules2, prop, propValue, stylesheet2); + } + } else { + if (propValue !== void 0) { + if (prop === "margin" || prop === "padding") { + expandQuads(currentRules, prop, propValue); + } else { + currentRules[prop] = propValue; } + } } + } } + } } - return rules; -} -function expandQuads(currentRules, name, value) { - var parts = typeof value === 'string' ? (0, _tokenizeWithParentheses.tokenizeWithParentheses)(value) : [ - value - ]; - if (parts.length === 0) parts.push(value); - if (parts[parts.length - 1] === '!important') // Remove !important from parts, and append it to each part individually - parts = parts.slice(0, -1).map(function(p) { - return p + ' !important'; - }); - currentRules[name + 'Top'] = parts[0]; - currentRules[name + 'Right'] = parts[1] || parts[0]; - currentRules[name + 'Bottom'] = parts[2] || parts[0]; - currentRules[name + 'Left'] = parts[3] || parts[1] || parts[0]; -} -function getKeyForRules(options, rules) { - var serialized = [ - options.rtl ? 'rtl' : 'ltr' - ]; + return rules2; + } + function expandQuads(currentRules, name, value2) { + var parts = typeof value2 === "string" ? tokenizeWithParentheses(value2) : [value2]; + if (parts.length === 0) { + parts.push(value2); + } + if (parts[parts.length - 1] === "!important") { + parts = parts.slice(0, -1).map(function(p) { + return p + " !important"; + }); + } + currentRules[name + "Top"] = parts[0]; + currentRules[name + "Right"] = parts[1] || parts[0]; + currentRules[name + "Bottom"] = parts[2] || parts[0]; + currentRules[name + "Left"] = parts[3] || parts[1] || parts[0]; + } + function getKeyForRules(options2, rules2) { + var serialized = [options2.rtl ? "rtl" : "ltr"]; var hasProps = false; - for(var _i = 0, _a = rules.__order; _i < _a.length; _i++){ - var selector = _a[_i]; - serialized.push(selector); - var rulesForSelector = rules[selector]; - for(var propName in rulesForSelector)if (rulesForSelector.hasOwnProperty(propName) && rulesForSelector[propName] !== undefined) { - hasProps = true; - serialized.push(propName, rulesForSelector[propName]); - } - } - return hasProps ? serialized.join('') : undefined; -} -function repeatString(target, count) { - if (count <= 0) return ''; - if (count === 1) return target; - return target + repeatString(target, count - 1); -} -function serializeRuleEntries(options, ruleEntries) { - if (!ruleEntries) return ''; + for (var _i = 0, _a2 = rules2.__order; _i < _a2.length; _i++) { + var selector = _a2[_i]; + serialized.push(selector); + var rulesForSelector = rules2[selector]; + for (var propName in rulesForSelector) { + if (rulesForSelector.hasOwnProperty(propName) && rulesForSelector[propName] !== void 0) { + hasProps = true; + serialized.push(propName, rulesForSelector[propName]); + } + } + } + return hasProps ? serialized.join("") : void 0; + } + function repeatString(target2, count2) { + if (count2 <= 0) { + return ""; + } + if (count2 === 1) { + return target2; + } + return target2 + repeatString(target2, count2 - 1); + } + function serializeRuleEntries(options2, ruleEntries) { + if (!ruleEntries) { + return ""; + } var allEntries = []; - for(var entry in ruleEntries)if (ruleEntries.hasOwnProperty(entry) && entry !== DISPLAY_NAME && ruleEntries[entry] !== undefined) allEntries.push(entry, ruleEntries[entry]); - // Apply transforms. - for(var i = 0; i < allEntries.length; i += 2){ - (0, _kebabRules.kebabRules)(allEntries, i); - (0, _provideUnits.provideUnits)(allEntries, i); - (0, _rtlifyRules.rtlifyRules)(options, allEntries, i); - (0, _prefixRules.prefixRules)(allEntries, i); - } - // Apply punctuation. - for(var i = 1; i < allEntries.length; i += 4)allEntries.splice(i, 1, ':', allEntries[i], ';'); - return allEntries.join(''); -} -function styleToRegistration(options) { - var _a; + for (var entry2 in ruleEntries) { + if (ruleEntries.hasOwnProperty(entry2) && entry2 !== DISPLAY_NAME && ruleEntries[entry2] !== void 0) { + allEntries.push(entry2, ruleEntries[entry2]); + } + } + for (var i = 0; i < allEntries.length; i += 2) { + kebabRules(allEntries, i); + provideUnits(allEntries, i); + rtlifyRules(options2, allEntries, i); + prefixRules(allEntries, i); + } + for (var i = 1; i < allEntries.length; i += 4) { + allEntries.splice(i, 1, ":", allEntries[i], ";"); + } + return allEntries.join(""); + } + function styleToRegistration(options2) { + var _a2; var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - var stylesheet = (_a = options.stylesheet) !== null && _a !== void 0 ? _a : (0, _stylesheet.Stylesheet).getInstance(options.shadowConfig); - var rules = extractRules(args, undefined, undefined, stylesheet); - var key = getKeyForRules(options, rules); - if (key) { - var registration = { - className: stylesheet.classNameFromKey(key), - key: key, - args: args - }; - if (!registration.className) { - registration.className = stylesheet.getClassName(getDisplayName(rules)); - var rulesToInsert = []; - for(var _b = 0, _c = rules.__order; _b < _c.length; _b++){ - var selector = _c[_b]; - rulesToInsert.push(selector, serializeRuleEntries(options, rules[selector])); - } - registration.rulesToInsert = rulesToInsert; - } - return registration; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var stylesheet2 = (_a2 = options2.stylesheet) !== null && _a2 !== void 0 ? _a2 : Stylesheet.getInstance(options2.shadowConfig); + var rules2 = extractRules(args, void 0, void 0, stylesheet2); + var key2 = getKeyForRules(options2, rules2); + if (key2) { + var registration = { + className: stylesheet2.classNameFromKey(key2), + key: key2, + args + }; + if (!registration.className) { + registration.className = stylesheet2.getClassName(getDisplayName(rules2)); + var rulesToInsert = []; + for (var _b2 = 0, _c2 = rules2.__order; _b2 < _c2.length; _b2++) { + var selector = _c2[_b2]; + rulesToInsert.push(selector, serializeRuleEntries(options2, rules2[selector])); + } + registration.rulesToInsert = rulesToInsert; + } + return registration; + } + return void 0; + } + function applyRegistration(registration, specificityMultiplier, shadowConfig, sheet) { + if (specificityMultiplier === void 0) { + specificityMultiplier = 1; } - return undefined; -} -function applyRegistration(registration, specificityMultiplier, shadowConfig, sheet) { - if (specificityMultiplier === void 0) specificityMultiplier = 1; - var stylesheet = sheet !== null && sheet !== void 0 ? sheet : (0, _stylesheet.Stylesheet).getInstance(shadowConfig); - var className = registration.className, key = registration.key, args = registration.args, rulesToInsert = registration.rulesToInsert; + var stylesheet2 = sheet !== null && sheet !== void 0 ? sheet : Stylesheet.getInstance(shadowConfig); + var className2 = registration.className, key2 = registration.key, args = registration.args, rulesToInsert = registration.rulesToInsert; if (rulesToInsert) { - // rulesToInsert is an ordered array of selector/rule pairs. - for(var i = 0; i < rulesToInsert.length; i += 2){ - var rules = rulesToInsert[i + 1]; - if (rules) { - var selector = rulesToInsert[i]; - selector = selector.replace(/&/g, repeatString(".".concat(registration.className), specificityMultiplier)); - // Insert. Note if a media query, we must close the query with a final bracket. - var processedRule = "".concat(selector, "{").concat(rules, "}").concat(selector.indexOf('@') === 0 ? '}' : ''); - stylesheet.insertRule(processedRule); - } + for (var i = 0; i < rulesToInsert.length; i += 2) { + var rules2 = rulesToInsert[i + 1]; + if (rules2) { + var selector = rulesToInsert[i]; + selector = selector.replace(/&/g, repeatString(".".concat(registration.className), specificityMultiplier)); + var processedRule = "".concat(selector, "{").concat(rules2, "}").concat(selector.indexOf("@") === 0 ? "}" : ""); + stylesheet2.insertRule(processedRule); } - stylesheet.cacheClassName(className, key, args, rulesToInsert); + } + stylesheet2.cacheClassName(className2, key2, args, rulesToInsert); } -} -function styleToClassName(options) { + } + function styleToClassName(options2) { var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - var registration = styleToRegistration.apply(void 0, (0, _tslib.__spreadArray)([ - options - ], args, false)); - if (registration) { - applyRegistration(registration, options.specificityMultiplier, options.shadowConfig, options.stylesheet); - return registration.className; - } - return ''; -} - -},{"tslib":"9gizs","./Stylesheet":"5wD4L","./transforms/kebabRules":"e0Xsp","./transforms/prefixRules":"gYDpi","./transforms/provideUnits":"8SfBA","./transforms/rtlifyRules":"896Tj","./tokenizeWithParentheses":"2ckEI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0Xsp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "kebabRules", ()=>kebabRules); -var rules = {}; -function kebabRules(rulePairs, index) { - var rule = rulePairs[index]; - if (rule.charAt(0) !== '-') rulePairs[index] = rules[rule] = rules[rule] || rule.replace(/([A-Z])/g, '-$1').toLowerCase(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gYDpi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixRules", ()=>prefixRules); -var _getVendorSettings = require("../getVendorSettings"); -var autoPrefixNames = { - 'user-select': 1 -}; -function prefixRules(rulePairs, index) { - var vendorSettings = (0, _getVendorSettings.getVendorSettings)(); - var name = rulePairs[index]; - if (autoPrefixNames[name]) { - var value = rulePairs[index + 1]; - if (autoPrefixNames[name]) { - if (vendorSettings.isWebkit) rulePairs.push('-webkit-' + name, value); - if (vendorSettings.isMoz) rulePairs.push('-moz-' + name, value); - if (vendorSettings.isMs) rulePairs.push('-ms-' + name, value); - if (vendorSettings.isOpera) rulePairs.push('-o-' + name, value); - } - } -} - -},{"../getVendorSettings":"ctDJu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ctDJu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getVendorSettings", ()=>getVendorSettings); -/** - * Sets the vendor settings for prefixing and vendor specific operations. - */ parcelHelpers.export(exports, "setVendorSettings", ()=>setVendorSettings); -var _vendorSettings; -function getVendorSettings() { - var _a; - if (!_vendorSettings) { - // eslint-disable-next-line no-restricted-globals - var doc = typeof document !== 'undefined' ? document : undefined; - var nav = typeof navigator !== 'undefined' ? navigator : undefined; - var userAgent = (_a = nav === null || nav === void 0 ? void 0 : nav.userAgent) === null || _a === void 0 ? void 0 : _a.toLowerCase(); - if (!doc) _vendorSettings = { - isWebkit: true, - isMoz: true, - isOpera: true, - isMs: true - }; - else _vendorSettings = { - isWebkit: !!(doc && 'WebkitAppearance' in doc.documentElement.style), - isMoz: !!(userAgent && userAgent.indexOf('firefox') > -1), - isOpera: !!(userAgent && userAgent.indexOf('opera') > -1), - isMs: !!(nav && (/rv:11.0/i.test(nav.userAgent) || /Edge\/\d./i.test(navigator.userAgent))) - }; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; } - return _vendorSettings; -} -function setVendorSettings(vendorSettings) { - _vendorSettings = vendorSettings; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8SfBA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "provideUnits", ()=>provideUnits); -var NON_PIXEL_NUMBER_PROPS = [ - 'column-count', - 'font-weight', - 'flex', - 'flex-grow', - 'flex-shrink', - 'fill-opacity', - 'opacity', - 'order', - 'z-index', - 'zoom' -]; -function provideUnits(rulePairs, index) { - var name = rulePairs[index]; - var value = rulePairs[index + 1]; - if (typeof value === 'number') { - var isNonPixelProp = NON_PIXEL_NUMBER_PROPS.indexOf(name) > -1; - var isVariableOrPrefixed = name.indexOf('--') > -1; - var unit = isNonPixelProp || isVariableOrPrefixed ? '' : 'px'; - rulePairs[index + 1] = "".concat(value).concat(unit); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"896Tj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * RTLifies the rulePair in the array at the current index. This mutates the array for performance - * reasons. - */ parcelHelpers.export(exports, "rtlifyRules", ()=>rtlifyRules); -var _a; -var LEFT = 'left'; -var RIGHT = 'right'; -var NO_FLIP = '@noflip'; -var NAME_REPLACEMENTS = (_a = {}, _a[LEFT] = RIGHT, _a[RIGHT] = LEFT, _a); -var VALUE_REPLACEMENTS = { - 'w-resize': 'e-resize', - 'sw-resize': 'se-resize', - 'nw-resize': 'ne-resize' -}; -function rtlifyRules(options, rulePairs, index) { - if (options.rtl) { - var name_1 = rulePairs[index]; - if (!name_1) return; - var value = rulePairs[index + 1]; - if (typeof value === 'string' && value.indexOf(NO_FLIP) >= 0) rulePairs[index + 1] = value.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g, ''); - else if (name_1.indexOf(LEFT) >= 0) rulePairs[index] = name_1.replace(LEFT, RIGHT); - else if (name_1.indexOf(RIGHT) >= 0) rulePairs[index] = name_1.replace(RIGHT, LEFT); - else if (String(value).indexOf(LEFT) >= 0) rulePairs[index + 1] = value.replace(LEFT, RIGHT); - else if (String(value).indexOf(RIGHT) >= 0) rulePairs[index + 1] = value.replace(RIGHT, LEFT); - else if (NAME_REPLACEMENTS[name_1]) rulePairs[index] = NAME_REPLACEMENTS[name_1]; - else if (VALUE_REPLACEMENTS[value]) rulePairs[index + 1] = VALUE_REPLACEMENTS[value]; - else switch(name_1){ - case 'margin': - case 'padding': - rulePairs[index + 1] = flipQuad(value); - break; - case 'box-shadow': - rulePairs[index + 1] = negateNum(value, 0); - break; - } + var registration = styleToRegistration.apply(void 0, __spreadArray([options2], args, false)); + if (registration) { + applyRegistration(registration, options2.specificityMultiplier, options2.shadowConfig, options2.stylesheet); + return registration.className; } -} -/** - * Given a string value in a space delimited format (e.g. "1 2 3 4"), negates a particular value. - */ function negateNum(value, partIndex) { - var parts = value.split(' '); - var numberVal = parseInt(parts[partIndex], 10); - parts[0] = parts[0].replace(String(numberVal), String(numberVal * -1)); - return parts.join(' '); -} -/** - * Given a string quad, flips the left and right values. - */ function flipQuad(value) { - if (typeof value === 'string') { - var parts = value.split(' '); - if (parts.length === 4) return "".concat(parts[0], " ").concat(parts[3], " ").concat(parts[2], " ").concat(parts[1]); - } - return value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2ckEI":[function(require,module,exports,__globalThis) { -/** - * Split a string into tokens separated by whitespace, except all text within parentheses - * is treated as a single token (whitespace is ignored within parentheses). - * - * Unlike String.split(' '), multiple consecutive space characters are collapsed and - * removed from the returned array (including leading and trailing spaces). - * - * For example: - * `tokenizeWithParentheses("3px calc(var(--x) / 2) 9px 0 ")` - * => `["3px", "calc(var(--x) / 2)", "9px", "0"]` - * - * @returns The array of tokens. Returns an empty array if the string was empty or contained only whitespace. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "tokenizeWithParentheses", ()=>tokenizeWithParentheses); -function tokenizeWithParentheses(value) { - var parts = []; - var partStart = 0; - var parens = 0; - for(var i = 0; i < value.length; i++)switch(value[i]){ - case '(': - parens++; - break; - case ')': - if (parens) parens--; - break; - case '\t': - case ' ': - if (!parens) { - // Add the new part if it's not an empty string - if (i > partStart) parts.push(value.substring(partStart, i)); - partStart = i + 1; - } - break; + return ""; + } + function mergeStyles() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; } - // Add the last part - if (partStart < value.length) parts.push(value.substring(partStart)); - return parts; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kqzRE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Takes in one or more style set objects, each consisting of a set of areas, - * each which will produce a class name. Using this is analogous to calling - * `mergeStyles` for each property in the object, but ensures we maintain the - * set ordering when multiple style sets are merged. - * - * @param styleSets - One or more style sets to be merged. - */ parcelHelpers.export(exports, "mergeStyleSets", ()=>mergeStyleSets); -/** - * Takes in one or more style set objects, each1consisting of a set of areas, - * each which will produce a class name. Using this is analogous to calling - * `mergeCss` for each property in the object, but ensures the - * set ordering when multiple style sets are merged. - * - * @param styleSets - One or more style sets to be merged. - * @param options - (optional) Options to use when creating rules. - */ parcelHelpers.export(exports, "mergeCssSets", ()=>mergeCssSets); -var _tslib = require("tslib"); -var _concatStyleSets = require("./concatStyleSets"); -var _extractStyleParts = require("./extractStyleParts"); -var _styleOptionsState = require("./StyleOptionsState"); -var _styleToClassName = require("./styleToClassName"); -var _shadowConfig = require("./shadowConfig"); -var _stylesheet = require("./Stylesheet"); -function mergeStyleSets() { + return mergeCss(args, getStyleOptions()); + } + function mergeCss(args, options2) { + var styleArgs = args instanceof Array ? args : [args]; + var opts = options2 || {}; + var hasShadowConfig = isShadowConfig(styleArgs[0]); + if (hasShadowConfig) { + opts.shadowConfig = styleArgs[0]; + } + opts.stylesheet = Stylesheet.getInstance(opts.shadowConfig); + var _a2 = extractStyleParts(opts.stylesheet, styleArgs), classes = _a2.classes, objects = _a2.objects; + if (objects.length) { + classes.push(styleToClassName(opts, objects)); + } + return classes.join(" "); + } + function concatStyleSets() { var styleSets = []; - for(var _i = 0; _i < arguments.length; _i++)styleSets[_i] = arguments[_i]; - return mergeCssSets(styleSets, (0, _styleOptionsState.getStyleOptions)()); -} -function mergeCssSets(styleSets, options) { - var classNameSet = { - subComponentStyles: {} - }; - var shadowConfig = undefined; - var styleSet; - if ((0, _shadowConfig.isShadowConfig)(styleSets[0])) { - shadowConfig = styleSets[0]; - styleSet = styleSets[1]; - } else styleSet = styleSets[0]; - shadowConfig !== null && shadowConfig !== void 0 ? shadowConfig : shadowConfig = options === null || options === void 0 ? void 0 : options.shadowConfig; - var opts = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - shadowConfig: shadowConfig - }); - if (!styleSet && styleSets.length <= 1) return { - subComponentStyles: {} - }; - var sheet = (0, _stylesheet.Stylesheet).getInstance(shadowConfig); - opts.stylesheet = sheet; - var concatenatedStyleSet = (0, _concatStyleSets.concatStyleSets).apply(void 0, styleSets); - var registrations = []; - for(var styleSetArea in concatenatedStyleSet)if (concatenatedStyleSet.hasOwnProperty(styleSetArea)) { - if (styleSetArea === 'subComponentStyles') { - classNameSet.subComponentStyles = concatenatedStyleSet.subComponentStyles || {}; - continue; - } else if (styleSetArea === '__shadowConfig__') continue; - var styles = concatenatedStyleSet[styleSetArea]; - var _a = (0, _extractStyleParts.extractStyleParts)(sheet, styles), classes = _a.classes, objects = _a.objects; - if (objects === null || objects === void 0 ? void 0 : objects.length) { - var registration = (0, _styleToClassName.styleToRegistration)(opts || {}, { - displayName: styleSetArea - }, objects); - if (registration) { - registrations.push(registration); - classNameSet[styleSetArea] = classes.concat([ - registration.className - ]).join(' '); - } - } else classNameSet[styleSetArea] = classes.join(' '); + for (var _i = 0; _i < arguments.length; _i++) { + styleSets[_i] = arguments[_i]; } - for(var _i = 0, registrations_1 = registrations; _i < registrations_1.length; _i++){ - var registration = registrations_1[_i]; - if (registration) (0, _styleToClassName.applyRegistration)(registration, options === null || options === void 0 ? void 0 : options.specificityMultiplier, shadowConfig); + if (styleSets && styleSets.length === 1 && styleSets[0] && !styleSets[0].subComponentStyles && !isShadowConfig(styleSets[0])) { + return styleSets[0]; } - return classNameSet; -} - -},{"tslib":"9gizs","./concatStyleSets":"5Msd3","./extractStyleParts":"gPZki","./StyleOptionsState":"4aGJx","./styleToClassName":"7B171","./shadowConfig":"7TWty","./Stylesheet":"5wD4L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Msd3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Combine a set of styles together (but does not register css classes). - * @param styleSets - One or more stylesets to be merged (each param can also be falsy). - */ parcelHelpers.export(exports, "concatStyleSets", ()=>concatStyleSets); -var _tslib = require("tslib"); -var _shadowConfig = require("./shadowConfig"); -function concatStyleSets() { - var styleSets = []; - for(var _i = 0; _i < arguments.length; _i++)styleSets[_i] = arguments[_i]; - if (styleSets && styleSets.length === 1 && styleSets[0] && !styleSets[0].subComponentStyles && !(0, _shadowConfig.isShadowConfig)(styleSets[0])) return styleSets[0]; var mergedSet = {}; - // We process sub component styles in two phases. First we collect them, then we combine them into 1 style function. var workingSubcomponentStyles = {}; - for(var _a = 0, styleSets_1 = styleSets; _a < styleSets_1.length; _a++){ - var currentSet = styleSets_1[_a]; - if (currentSet && !(0, _shadowConfig.isShadowConfig)(currentSet)) { - for(var prop in currentSet)if (currentSet.hasOwnProperty(prop)) { - if (prop === 'subComponentStyles' && currentSet.subComponentStyles !== undefined) { - // subcomponent styles - style functions or objects - var currentComponentStyles = currentSet.subComponentStyles; - for(var subCompProp in currentComponentStyles)if (currentComponentStyles.hasOwnProperty(subCompProp)) { - if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) workingSubcomponentStyles[subCompProp].push(currentComponentStyles[subCompProp]); - else workingSubcomponentStyles[subCompProp] = [ - currentComponentStyles[subCompProp] - ]; - } - continue; + for (var _a2 = 0, styleSets_1 = styleSets; _a2 < styleSets_1.length; _a2++) { + var currentSet = styleSets_1[_a2]; + if (currentSet && !isShadowConfig(currentSet)) { + for (var prop in currentSet) { + if (currentSet.hasOwnProperty(prop)) { + if (prop === "subComponentStyles" && currentSet.subComponentStyles !== void 0) { + var currentComponentStyles = currentSet.subComponentStyles; + for (var subCompProp in currentComponentStyles) { + if (currentComponentStyles.hasOwnProperty(subCompProp)) { + if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) { + workingSubcomponentStyles[subCompProp].push(currentComponentStyles[subCompProp]); + } else { + workingSubcomponentStyles[subCompProp] = [currentComponentStyles[subCompProp]]; + } } - // the as any casts below is a workaround for ts 2.8. - // todo: remove cast to any in ts 2.9. - var mergedValue = mergedSet[prop]; - var currentValue = currentSet[prop]; - if (mergedValue === undefined) mergedSet[prop] = currentValue; - else mergedSet[prop] = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], Array.isArray(mergedValue) ? mergedValue : [ - mergedValue - ], true), Array.isArray(currentValue) ? currentValue : [ - currentValue - ], true); + } + continue; } + var mergedValue = mergedSet[prop]; + var currentValue = currentSet[prop]; + if (mergedValue === void 0) { + mergedSet[prop] = currentValue; + } else { + mergedSet[prop] = __spreadArray(__spreadArray([], Array.isArray(mergedValue) ? mergedValue : [mergedValue], true), Array.isArray(currentValue) ? currentValue : [currentValue], true); + } + } } + } } if (Object.keys(workingSubcomponentStyles).length > 0) { - mergedSet.subComponentStyles = {}; - var mergedSubStyles = mergedSet.subComponentStyles; - var _loop_1 = function(subCompProp) { - if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) { - var workingSet_1 = workingSubcomponentStyles[subCompProp]; - mergedSubStyles[subCompProp] = function(styleProps) { - return concatStyleSets.apply(void 0, workingSet_1.map(function(styleFunctionOrObject) { - return typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject; - })); - }; - } - }; - // now we process the subcomponent styles if there are any - for(var subCompProp in workingSubcomponentStyles)_loop_1(subCompProp); + mergedSet.subComponentStyles = {}; + var mergedSubStyles = mergedSet.subComponentStyles; + var _loop_1 = function(subCompProp2) { + if (workingSubcomponentStyles.hasOwnProperty(subCompProp2)) { + var workingSet_1 = workingSubcomponentStyles[subCompProp2]; + mergedSubStyles[subCompProp2] = function(styleProps) { + return concatStyleSets.apply(void 0, workingSet_1.map(function(styleFunctionOrObject) { + return typeof styleFunctionOrObject === "function" ? styleFunctionOrObject(styleProps) : styleFunctionOrObject; + })); + }; + } + }; + for (var subCompProp in workingSubcomponentStyles) { + _loop_1(subCompProp); + } } return mergedSet; -} - -},{"tslib":"9gizs","./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Tcvm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Concatenates style sets into one, but resolves functional sets using the given props. - * @param styleProps - Props used to resolve functional sets. - * @param allStyles - Style sets, which can be functions or objects. - */ parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>concatStyleSetsWithProps); -var _concatStyleSets = require("./concatStyleSets"); -function concatStyleSetsWithProps(styleProps) { + } + function mergeStyleSets() { + var styleSets = []; + for (var _i = 0; _i < arguments.length; _i++) { + styleSets[_i] = arguments[_i]; + } + return mergeCssSets(styleSets, getStyleOptions()); + } + function mergeCssSets(styleSets, options2) { + var classNameSet = { subComponentStyles: {} }; + var shadowConfig = void 0; + var styleSet; + if (isShadowConfig(styleSets[0])) { + shadowConfig = styleSets[0]; + styleSet = styleSets[1]; + } else { + styleSet = styleSets[0]; + } + shadowConfig !== null && shadowConfig !== void 0 ? shadowConfig : shadowConfig = options2 === null || options2 === void 0 ? void 0 : options2.shadowConfig; + var opts = __assign$1(__assign$1({}, options2), { shadowConfig }); + if (!styleSet && styleSets.length <= 1) { + return { subComponentStyles: {} }; + } + var sheet = Stylesheet.getInstance(shadowConfig); + opts.stylesheet = sheet; + var concatenatedStyleSet = concatStyleSets.apply(void 0, styleSets); + var registrations = []; + for (var styleSetArea in concatenatedStyleSet) { + if (concatenatedStyleSet.hasOwnProperty(styleSetArea)) { + if (styleSetArea === "subComponentStyles") { + classNameSet.subComponentStyles = concatenatedStyleSet.subComponentStyles || {}; + continue; + } else if (styleSetArea === "__shadowConfig__") { + continue; + } + var styles = concatenatedStyleSet[styleSetArea]; + var _a2 = extractStyleParts(sheet, styles), classes = _a2.classes, objects = _a2.objects; + if (objects === null || objects === void 0 ? void 0 : objects.length) { + var registration = styleToRegistration(opts || {}, { displayName: styleSetArea }, objects); + if (registration) { + registrations.push(registration); + classNameSet[styleSetArea] = classes.concat([registration.className]).join(" "); + } + } else { + classNameSet[styleSetArea] = classes.join(" "); + } + } + } + for (var _i = 0, registrations_1 = registrations; _i < registrations_1.length; _i++) { + var registration = registrations_1[_i]; + if (registration) { + applyRegistration(registration, options2 === null || options2 === void 0 ? void 0 : options2.specificityMultiplier, shadowConfig); + } + } + return classNameSet; + } + function concatStyleSetsWithProps(styleProps) { var allStyles = []; - for(var _i = 1; _i < arguments.length; _i++)allStyles[_i - 1] = arguments[_i]; + for (var _i = 1; _i < arguments.length; _i++) { + allStyles[_i - 1] = arguments[_i]; + } var result = []; - for(var _a = 0, allStyles_1 = allStyles; _a < allStyles_1.length; _a++){ - var styles = allStyles_1[_a]; - if (styles) result.push(typeof styles === 'function' ? styles(styleProps) : styles); - } - if (result.length === 1) return result[0]; - else if (result.length) // cliffkoh: I cannot figure out how to avoid the cast to any here. - // It is something to do with the use of Omit in IStyleSet. - // It might not be necessary once Omit becomes part of lib.d.ts (when we remove our own Omit and rely on - // the official version). - return (0, _concatStyleSets.concatStyleSets).apply(void 0, result); + for (var _a2 = 0, allStyles_1 = allStyles; _a2 < allStyles_1.length; _a2++) { + var styles = allStyles_1[_a2]; + if (styles) { + result.push(typeof styles === "function" ? styles(styleProps) : styles); + } + } + if (result.length === 1) { + return result[0]; + } else if (result.length) { + return concatStyleSets.apply(void 0, result); + } return {}; -} - -},{"./concatStyleSets":"5Msd3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5xypM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Registers a font face. - * @public - */ parcelHelpers.export(exports, "fontFace", ()=>fontFace); -var _styleOptionsState = require("./StyleOptionsState"); -var _stylesheet = require("./Stylesheet"); -var _styleToClassName = require("./styleToClassName"); -function fontFace(font) { - var stylesheet = (0, _stylesheet.Stylesheet).getInstance(); - var rule = (0, _styleToClassName.serializeRuleEntries)((0, _styleOptionsState.getStyleOptions)(), font); - var className = stylesheet.classNameFromKey(rule); - if (className) return; - var name = stylesheet.getClassName(); - stylesheet.insertRule("@font-face{".concat(rule, "}"), true); - stylesheet.cacheClassName(name, rule, [], [ - 'font-face', - rule - ]); -} - -},{"./StyleOptionsState":"4aGJx","./Stylesheet":"5wD4L","./styleToClassName":"7B171","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7yKx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Registers keyframe definitions. - * - * @public - */ parcelHelpers.export(exports, "keyframes", ()=>keyframes); -var _styleOptionsState = require("./StyleOptionsState"); -var _stylesheet = require("./Stylesheet"); -var _styleToClassName = require("./styleToClassName"); -function keyframes(timeline) { - var stylesheet = (0, _stylesheet.Stylesheet).getInstance(); + } + function fontFace(font2) { + var stylesheet2 = Stylesheet.getInstance(); + var rule2 = serializeRuleEntries(getStyleOptions(), font2); + var className2 = stylesheet2.classNameFromKey(rule2); + if (className2) { + return; + } + var name = stylesheet2.getClassName(); + stylesheet2.insertRule("@font-face{".concat(rule2, "}"), true); + stylesheet2.cacheClassName(name, rule2, [], ["font-face", rule2]); + } + function keyframes(timeline) { + var stylesheet2 = Stylesheet.getInstance(); var rulesArray = []; - for(var prop in timeline)if (timeline.hasOwnProperty(prop)) rulesArray.push(prop, '{', (0, _styleToClassName.serializeRuleEntries)((0, _styleOptionsState.getStyleOptions)(), timeline[prop]), '}'); - var rules = rulesArray.join(''); - var className = stylesheet.classNameFromKey(rules); - if (className) return className; - var name = stylesheet.getClassName(); - stylesheet.insertRule("@keyframes ".concat(name, "{").concat(rules, "}"), true); - stylesheet.cacheClassName(name, rules, [], [ - 'keyframes', - rules - ]); - return name; -} - -},{"./StyleOptionsState":"4aGJx","./Stylesheet":"5wD4L","./styleToClassName":"7B171","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4ADZe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SUPPORTS_CONSTRUCTABLE_STYLESHEETS", ()=>SUPPORTS_CONSTRUCTABLE_STYLESHEETS); -parcelHelpers.export(exports, "SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS", ()=>SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS); -parcelHelpers.export(exports, "ShadowDomStylesheet", ()=>ShadowDomStylesheet); -var _tslib = require("tslib"); -/* eslint no-restricted-globals: 0 */ var _stylesheet = require("./Stylesheet"); -var _shadowConfig = require("./shadowConfig"); -var SUPPORTS_CONSTRUCTABLE_STYLESHEETS = typeof document !== 'undefined' && Array.isArray(document.adoptedStyleSheets) && 'replace' in CSSStyleSheet.prototype; -var supportsModifyingAdoptedStyleSheets = false; -if (SUPPORTS_CONSTRUCTABLE_STYLESHEETS) try { - document.adoptedStyleSheets.push(); - supportsModifyingAdoptedStyleSheets = true; -} catch (e) { - supportsModifyingAdoptedStyleSheets = false; -} -var SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS = supportsModifyingAdoptedStyleSheets; -var _stylesheet1; -var _global = {}; -// Grab window. -try { - // Why the cast? - // if compiled/type checked in same program with `@fluentui/font-icons-mdl2` which extends `Window` on global - // ( check packages/font-icons-mdl2/src/index.ts ) the definitions don't match! Thus the need of this extra assertion - _global = window || {}; -} catch (_a) { -/* leave as blank object */ } -var copyOldGlobalRules = function(stylesheet, inShadow, win, doc) { - var _a; - if (inShadow === void 0) inShadow = false; - if (!doc) // SSR - return; - var oldGlobalRules = doc.querySelectorAll('[data-merge-styles]'); - if (oldGlobalRules) { - stylesheet.setConfig({ - window: win, - inShadow: inShadow, - stylesheetKey: (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) - }); - for(var i = 0; i < oldGlobalRules.length; i++){ - var styleElem = oldGlobalRules[i]; - styleElem.setAttribute('data-merge-styles-global', 'true'); - var cssRules = ((_a = styleElem.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) || []; - for(var j = 0; j < cssRules.length; j++){ - var rule = cssRules[j]; - stylesheet.insertRule(rule.cssText); - } - } + for (var prop in timeline) { + if (timeline.hasOwnProperty(prop)) { + rulesArray.push(prop, "{", serializeRuleEntries(getStyleOptions(), timeline[prop]), "}"); + } } -}; -var ShadowDomStylesheet = /** @class */ function(_super) { - (0, _tslib.__extends)(ShadowDomStylesheet, _super); - function ShadowDomStylesheet(config, serializedStylesheet) { - var _this = _super.call(this, config, serializedStylesheet) || this; - _this._onAddSheetCallbacks = []; - _this._sheetCounter = 0; - _this._adoptableSheets = new Map(); - _global[0, _shadowConfig.SHADOW_DOM_STYLESHEET_SETTING] = ShadowDomStylesheet; - return _this; + var rules2 = rulesArray.join(""); + var className2 = stylesheet2.classNameFromKey(rules2); + if (className2) { + return className2; } - ShadowDomStylesheet.getInstance = function(shadowConfig) { - var sConfig = shadowConfig || (0, _shadowConfig.DEFAULT_SHADOW_CONFIG); - var stylesheetKey = sConfig.stylesheetKey || (0, _shadowConfig.GLOBAL_STYLESHEET_KEY); - var inShadow = sConfig.inShadow; - var win = sConfig.window || (typeof window !== 'undefined' ? window : undefined); - var global = win || _global; - var doc = win ? win.document : typeof document !== 'undefined' ? document : undefined; - _stylesheet1 = global[0, _stylesheet.STYLESHEET_SETTING]; - // When an app has multiple versions of Fluent v8 it is possible - // that an older version of Stylesheet is initialized before - // the version that supports shadow DOM. We check for this case - // and re-initialize the stylesheet in that case. - var oldStylesheetInitializedFirst = _stylesheet1 && !_stylesheet1.getAdoptedSheets; - if (!_stylesheet1 || oldStylesheetInitializedFirst || _stylesheet1._lastStyleElement && _stylesheet1._lastStyleElement.ownerDocument !== doc) { - var fabricConfig = (global === null || global === void 0 ? void 0 : global.FabricConfig) || {}; - var defaultMergeStyles = { - window: win, - inShadow: inShadow, - stylesheetKey: stylesheetKey - }; - fabricConfig.mergeStyles = fabricConfig.mergeStyles || {}; - fabricConfig.mergeStyles = (0, _tslib.__assign)((0, _tslib.__assign)({}, defaultMergeStyles), fabricConfig.mergeStyles); - var stylesheet = void 0; - if (oldStylesheetInitializedFirst) { - stylesheet = new ShadowDomStylesheet(fabricConfig.mergeStyles, JSON.parse(_stylesheet1.serialize())); - copyOldGlobalRules(stylesheet, inShadow, win, doc); - } else stylesheet = new ShadowDomStylesheet(fabricConfig.mergeStyles, fabricConfig.serializedStylesheet); - _stylesheet1 = stylesheet; - global[0, _stylesheet.STYLESHEET_SETTING] = _stylesheet1; - } else _stylesheet1.setConfig({ - window: win, - inShadow: inShadow, - stylesheetKey: stylesheetKey - }); - if (win) _stylesheet1._getAdoptableStyleSheet(stylesheetKey); - return _stylesheet1; - }; - ShadowDomStylesheet.prototype.getAdoptedSheets = function() { - return this._adoptableSheets; - }; - ShadowDomStylesheet.prototype.onAddSheet = function(callback) { - var _this = this; - this._onAddSheetCallbacks.push(callback); - return function() { - _this._onAddSheetCallbacks = _this._onAddSheetCallbacks.filter(function(cb) { - return cb !== callback; - }); - }; + var name = stylesheet2.getClassName(); + stylesheet2.insertRule("@keyframes ".concat(name, "{").concat(rules2, "}"), true); + stylesheet2.cacheClassName(name, rules2, [], ["keyframes", rules2]); + return name; + } + var _scrollbarWidth; + var _bodyScrollDisabledCount = 0; + var DisabledScrollClassName = mergeStyles({ + overflow: "hidden !important" + }); + var DATA_IS_SCROLLABLE_ATTRIBUTE = "data-is-scrollable"; + var allowScrollOnElement = function(element2, events2) { + var window2 = getWindow(element2); + if (!element2 || !window2) { + return; + } + var _previousClientY = 0; + var _element = null; + var computedStyles = window2.getComputedStyle(element2); + var _saveClientY = function(event2) { + if (event2.targetTouches.length === 1) { + _previousClientY = event2.targetTouches[0].clientY; + } }; - ShadowDomStylesheet.prototype.insertRule = function(rule, preserve) { - var _a = this._config, injectionMode = _a.injectionMode, _b = _a.stylesheetKey, stylesheetKey = _b === void 0 ? (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) : _b; - var injectStyles = injectionMode !== (0, _stylesheet.InjectionMode).none; - var addToConstructableStylesheet = stylesheetKey === (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) || !!this._adoptableSheets.has(stylesheetKey); - var constructableSheet = undefined; - if (injectStyles && addToConstructableStylesheet) constructableSheet = this._getAdoptableStyleSheet(stylesheetKey); - if (constructableSheet) this._insertRuleIntoSheet(constructableSheet, rule); - _super.prototype.insertRule.call(this, rule, preserve, stylesheetKey); - }; - ShadowDomStylesheet.prototype._getCacheKey = function(key) { - var _a = this._config, _b = _a.inShadow, inShadow = _b === void 0 ? false : _b, _c = _a.stylesheetKey, currentStylesheetKey = _c === void 0 ? (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) : _c; - if (inShadow) return "__".concat(currentStylesheetKey, "__").concat(key); - return _super.prototype._getCacheKey.call(this, key); - }; - ShadowDomStylesheet.prototype._createStyleElement = function() { - var styleElement = _super.prototype._createStyleElement.call(this); - if (this._config.stylesheetKey === (0, _shadowConfig.GLOBAL_STYLESHEET_KEY)) styleElement.setAttribute('data-merge-styles-global', 'true'); - return styleElement; + var _preventOverscrolling = function(event2) { + if (event2.targetTouches.length !== 1) { + return; + } + event2.stopPropagation(); + if (!_element) { + return; + } + var clientY = event2.targetTouches[0].clientY - _previousClientY; + var scrollableParent = findScrollableParent(event2.target); + if (scrollableParent && _element !== scrollableParent) { + _element = scrollableParent; + computedStyles = window2.getComputedStyle(_element); + } + var scrollTop = _element.scrollTop; + var isColumnReverse = (computedStyles === null || computedStyles === void 0 ? void 0 : computedStyles.flexDirection) === "column-reverse"; + if (scrollTop === 0 && (isColumnReverse ? clientY < 0 : clientY > 0)) { + event2.preventDefault(); + } + if (_element.scrollHeight - Math.abs(Math.ceil(scrollTop)) <= _element.clientHeight && (isColumnReverse ? clientY > 0 : clientY < 0)) { + event2.preventDefault(); + } }; - ShadowDomStylesheet.prototype._makeCSSStyleSheet = function() { - var win = this._config.window || window; - var sheet = undefined; - if (!SUPPORTS_CONSTRUCTABLE_STYLESHEETS) { - var style = this._createStyleElement(); - sheet = style.sheet; - } else sheet = new win.CSSStyleSheet(); - if (sheet) { - sheet.bucketName = 'merge-styles'; - sheet.metadata = { - stylesheetKey: this._config.stylesheetKey || (0, _shadowConfig.GLOBAL_STYLESHEET_KEY), - sortOrder: this._sheetCounter++ - }; - } - return sheet; + events2.on(element2, "touchstart", _saveClientY, { passive: false }); + events2.on(element2, "touchmove", _preventOverscrolling, { passive: false }); + _element = element2; + }; + var allowOverscrollOnElement = function(element2, events2) { + if (!element2) { + return; + } + var _allowElementScroll = function(event2) { + event2.stopPropagation(); }; - ShadowDomStylesheet.prototype._addAdoptableStyleSheet = function(key, sheet, queue) { - var _this = this; - if (queue === void 0) queue = true; - if (!this._adoptableSheets.has(key)) { - this._adoptableSheets.set(key, sheet); - var win = this._config.window; - if (queue && win) win.queueMicrotask(function() { - _this._onAddSheetCallbacks.forEach(function(callback) { - return callback({ - key: key, - sheet: sheet - }); - }); - }); + events2.on(element2, "touchmove", _allowElementScroll, { passive: false }); + }; + var _disableIosBodyScroll = function(event2) { + event2.preventDefault(); + }; + function disableBodyScroll() { + var doc = getDocument(); + if (doc && doc.body && !_bodyScrollDisabledCount) { + doc.body.classList.add(DisabledScrollClassName); + doc.body.addEventListener("touchmove", _disableIosBodyScroll, { passive: false, capture: false }); + } + _bodyScrollDisabledCount++; + } + function enableBodyScroll() { + if (_bodyScrollDisabledCount > 0) { + var doc = getDocument(); + if (doc && doc.body && _bodyScrollDisabledCount === 1) { + doc.body.classList.remove(DisabledScrollClassName); + doc.body.removeEventListener("touchmove", _disableIosBodyScroll); + } + _bodyScrollDisabledCount--; + } + } + function getScrollbarWidth(doc) { + if (_scrollbarWidth === void 0) { + var theDoc = getDocument(); + var scrollDiv = theDoc.createElement("div"); + scrollDiv.style.setProperty("width", "100px"); + scrollDiv.style.setProperty("height", "100px"); + scrollDiv.style.setProperty("overflow", "scroll"); + scrollDiv.style.setProperty("position", "absolute"); + scrollDiv.style.setProperty("top", "-9999px"); + theDoc.body.appendChild(scrollDiv); + _scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; + theDoc.body.removeChild(scrollDiv); + } + return _scrollbarWidth; + } + function findScrollableParent(startingElement) { + var el = startingElement; + var doc = getDocument(startingElement); + while (el && el !== doc.body) { + if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) === "true") { + return el; + } + el = el.parentElement; + } + el = startingElement; + while (el && el !== doc.body) { + if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) !== "false") { + var computedStyles = getComputedStyle(el); + var overflowY = computedStyles ? computedStyles.getPropertyValue("overflow-y") : ""; + if (overflowY && (overflowY === "scroll" || overflowY === "auto")) { + return el; } - }; - ShadowDomStylesheet.prototype._getAdoptableStyleSheet = function(key) { - var sheet = this._adoptableSheets.get(key); - if (!sheet) { - sheet = this._makeCSSStyleSheet(); - this._addAdoptableStyleSheet(key, sheet); - } - return sheet; - }; - return ShadowDomStylesheet; -}((0, _stylesheet.Stylesheet)); - -},{"tslib":"9gizs","./Stylesheet":"5wD4L","./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5w3No":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cloneCSSStyleSheet", ()=>cloneCSSStyleSheet); -parcelHelpers.export(exports, "cloneExtendedCSSStyleSheet", ()=>cloneExtendedCSSStyleSheet); -var cloneCSSStyleSheet = function(srcSheet, targetSheet) { - for(var i = 0; i < srcSheet.cssRules.length; i++)targetSheet.insertRule(srcSheet.cssRules[i].cssText, i); - return targetSheet; -}; -var cloneExtendedCSSStyleSheet = function(srcSheet, targetSheet) { - var clone = cloneCSSStyleSheet(srcSheet, targetSheet); - clone.bucketName = srcSheet.bucketName; - for(var _i = 0, _a = Object.keys(srcSheet.metadata); _i < _a.length; _i++){ - var key = _a[_i]; - clone.metadata[key] = srcSheet.metadata[key]; - } - return clone; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1UJId":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/merge-styles', '8.6.13'); - -},{"@fluentui/set-version":"iqYXf"}],"iLCoe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BaseComponent", ()=>BaseComponent); -/** - * Simple constant function for returning null, used to render empty templates in JSX. - * - * @public - */ parcelHelpers.export(exports, "nullRender", ()=>nullRender); -var _tslib = require("tslib"); -var _react = require("react"); -var _async = require("./Async"); -var _eventGroup = require("./EventGroup"); -var _warnConditionallyRequiredProps = require("./warn/warnConditionallyRequiredProps"); -var _warnMutuallyExclusive = require("./warn/warnMutuallyExclusive"); -var _warnDeprecations = require("./warn/warnDeprecations"); -/** - * BaseComponent class, which provides basic helpers for all components. - * - * @public - * {@docCategory BaseComponent} - * - * @deprecated Do not use. We are moving away from class component. - */ var BaseComponent = /** @class */ function(_super) { - (0, _tslib.__extends)(BaseComponent, _super); - /** - * BaseComponent constructor - * @param props - The props for the component. - * @param context - The context for the component. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - function BaseComponent(props, context) { - var _this = _super.call(this, props, context) || this; - // eslint-disable-next-line deprecation/deprecation - _makeAllSafe(_this, BaseComponent.prototype, [ - 'componentDidMount', - 'shouldComponentUpdate', - 'getSnapshotBeforeUpdate', - 'render', - 'componentDidUpdate', - 'componentWillUnmount' - ]); - return _this; + } + el = el.parentElement; } - /** - * When the component receives props, make sure the componentRef is updated. - */ BaseComponent.prototype.componentDidUpdate = function(prevProps, prevState) { - this._updateComponentRef(prevProps, this.props); - }; - /** - * When the component has mounted, update the componentRef. - */ BaseComponent.prototype.componentDidMount = function() { - this._setComponentRef(this.props.componentRef, this); - }; - /** - * If we have disposables, dispose them automatically on unmount. - */ BaseComponent.prototype.componentWillUnmount = function() { - this._setComponentRef(this.props.componentRef, null); - if (this.__disposables) { - for(var i = 0, len = this._disposables.length; i < len; i++){ - var disposable = this.__disposables[i]; - if (disposable.dispose) disposable.dispose(); - } - this.__disposables = null; + if (!el || el === doc.body) { + el = getWindow(startingElement); + } + return el; + } + function warn$1(message) { + if (console && console.warn) { + console.warn(message); + } + } + var define_process_env_default = { NODE_ENV: "production" }; + function warnConditionallyRequiredProps(componentName, props, requiredProps, conditionalPropName, condition) { + if (condition === true && define_process_env_default.NODE_ENV !== "production") { + for (var _i = 0, requiredProps_1 = requiredProps; _i < requiredProps_1.length; _i++) { + var requiredPropName = requiredProps_1[_i]; + if (!(requiredPropName in props)) { + warn$1("".concat(componentName, " property '").concat(requiredPropName, "' is required when '").concat(conditionalPropName, "' is used.'")); } + } + } + } + function warnMutuallyExclusive(componentName, props, exclusiveMap) { + } + function warnDeprecations(componentName, props, deprecationMap) { + } + (function(_super) { + __extends(BaseComponent, _super); + function BaseComponent(props, context2) { + var _this = _super.call(this, props, context2) || this; + _makeAllSafe(_this, BaseComponent.prototype, [ + "componentDidMount", + "shouldComponentUpdate", + "getSnapshotBeforeUpdate", + "render", + "componentDidUpdate", + "componentWillUnmount" + ]); + return _this; + } + BaseComponent.prototype.componentDidUpdate = function(prevProps, prevState) { + this._updateComponentRef(prevProps, this.props); + }; + BaseComponent.prototype.componentDidMount = function() { + this._setComponentRef(this.props.componentRef, this); + }; + BaseComponent.prototype.componentWillUnmount = function() { + this._setComponentRef(this.props.componentRef, null); + if (this.__disposables) { + for (var i = 0, len2 = this._disposables.length; i < len2; i++) { + var disposable = this.__disposables[i]; + if (disposable.dispose) { + disposable.dispose(); + } + } + this.__disposables = null; + } }; Object.defineProperty(BaseComponent.prototype, "className", { - /** - * Gets the object's class name. - */ get: function() { - if (!this.__className) { - var funcNameRegex = /function (.{1,})\(/; - var results = funcNameRegex.exec(this.constructor.toString()); - this.__className = results && results.length > 1 ? results[1] : ''; - } - return this.__className; - }, - enumerable: false, - configurable: true + /** + * Gets the object's class name. + */ + get: function() { + if (!this.__className) { + var funcNameRegex = /function (.{1,})\(/; + var results = funcNameRegex.exec(this.constructor.toString()); + this.__className = results && results.length > 1 ? results[1] : ""; + } + return this.__className; + }, + enumerable: false, + configurable: true }); Object.defineProperty(BaseComponent.prototype, "_disposables", { - /** - * Allows subclasses to push things to this._disposables to be auto disposed. - */ get: function() { - if (!this.__disposables) this.__disposables = []; - return this.__disposables; - }, - enumerable: false, - configurable: true + /** + * Allows subclasses to push things to this._disposables to be auto disposed. + */ + get: function() { + if (!this.__disposables) { + this.__disposables = []; + } + return this.__disposables; + }, + enumerable: false, + configurable: true }); Object.defineProperty(BaseComponent.prototype, "_async", { - /** - * Gets the async instance associated with the component, created on demand. The async instance gives - * subclasses a way to execute setTimeout/setInterval async calls safely, where the callbacks - * will be cleared/ignored automatically after unmounting. The helpers within the async object also - * preserve the this pointer so that you don't need to "bind" the callbacks. - */ get: function() { - if (!this.__async) { - this.__async = new (0, _async.Async)(this); - this._disposables.push(this.__async); - } - return this.__async; - }, - enumerable: false, - configurable: true + /** + * Gets the async instance associated with the component, created on demand. The async instance gives + * subclasses a way to execute setTimeout/setInterval async calls safely, where the callbacks + * will be cleared/ignored automatically after unmounting. The helpers within the async object also + * preserve the this pointer so that you don't need to "bind" the callbacks. + */ + get: function() { + if (!this.__async) { + this.__async = new Async(this); + this._disposables.push(this.__async); + } + return this.__async; + }, + enumerable: false, + configurable: true }); Object.defineProperty(BaseComponent.prototype, "_events", { - /** - * Gets the event group instance assocaited with the component, created on demand. The event instance - * provides on/off methods for listening to DOM (or regular javascript object) events. The event callbacks - * will be automatically disconnected after unmounting. The helpers within the events object also - * preserve the this reference so that you don't need to "bind" the callbacks. - */ get: function() { - if (!this.__events) { - this.__events = new (0, _eventGroup.EventGroup)(this); - this._disposables.push(this.__events); - } - return this.__events; - }, - enumerable: false, - configurable: true + /** + * Gets the event group instance assocaited with the component, created on demand. The event instance + * provides on/off methods for listening to DOM (or regular javascript object) events. The event callbacks + * will be automatically disconnected after unmounting. The helpers within the events object also + * preserve the this reference so that you don't need to "bind" the callbacks. + */ + get: function() { + if (!this.__events) { + this.__events = new EventGroup(this); + this._disposables.push(this.__events); + } + return this.__events; + }, + enumerable: false, + configurable: true }); - /** - * Helper to return a memoized ref resolver function. - * @param refName - Name of the member to assign the ref to. - * @returns A function instance keyed from the given refname. - * @deprecated Use `createRef` from React.createRef. - */ BaseComponent.prototype._resolveRef = function(refName) { - var _this = this; - if (!this.__resolves) this.__resolves = {}; - if (!this.__resolves[refName]) this.__resolves[refName] = function(ref) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return _this[refName] = ref; + BaseComponent.prototype._resolveRef = function(refName) { + var _this = this; + if (!this.__resolves) { + this.__resolves = {}; + } + if (!this.__resolves[refName]) { + this.__resolves[refName] = function(ref2) { + return _this[refName] = ref2; }; - return this.__resolves[refName]; + } + return this.__resolves[refName]; }; - /** - * Updates the componentRef (by calling it with "this" when necessary.) - */ BaseComponent.prototype._updateComponentRef = function(currentProps, newProps) { - if (newProps === void 0) newProps = {}; - // currentProps *should* always be defined, but verify that just in case a subclass is manually - // calling a lifecycle method with no parameters (which has happened) or other odd usage. - if (currentProps && newProps && currentProps.componentRef !== newProps.componentRef) { - this._setComponentRef(currentProps.componentRef, null); - this._setComponentRef(newProps.componentRef, this); - } + BaseComponent.prototype._updateComponentRef = function(currentProps, newProps) { + if (newProps === void 0) { + newProps = {}; + } + if (currentProps && newProps && currentProps.componentRef !== newProps.componentRef) { + this._setComponentRef(currentProps.componentRef, null); + this._setComponentRef(newProps.componentRef, this); + } }; - /** - * Warns when a deprecated props are being used. - * - * @param deprecationMap - The map of deprecations, where key is the prop name and the value is - * either null or a replacement prop name. - */ BaseComponent.prototype._warnDeprecations = function(deprecationMap) { - (0, _warnDeprecations.warnDeprecations)(this.className, this.props, deprecationMap); + BaseComponent.prototype._warnDeprecations = function(deprecationMap) { + warnDeprecations(this.className, this.props); }; - /** - * Warns when props which are mutually exclusive with each other are both used. - * - * @param mutuallyExclusiveMap - The map of mutually exclusive props. - */ BaseComponent.prototype._warnMutuallyExclusive = function(mutuallyExclusiveMap) { - (0, _warnMutuallyExclusive.warnMutuallyExclusive)(this.className, this.props, mutuallyExclusiveMap); + BaseComponent.prototype._warnMutuallyExclusive = function(mutuallyExclusiveMap) { + warnMutuallyExclusive(this.className, this.props); }; - /** - * Warns when props are required if a condition is met. - * - * @param requiredProps - The name of the props that are required when the condition is met. - * @param conditionalPropName - The name of the prop that the condition is based on. - * @param condition - Whether the condition is met. - */ BaseComponent.prototype._warnConditionallyRequiredProps = function(requiredProps, conditionalPropName, condition) { - (0, _warnConditionallyRequiredProps.warnConditionallyRequiredProps)(this.className, this.props, requiredProps, conditionalPropName, condition); + BaseComponent.prototype._warnConditionallyRequiredProps = function(requiredProps, conditionalPropName, condition) { + warnConditionallyRequiredProps(this.className, this.props, requiredProps, conditionalPropName, condition); }; - BaseComponent.prototype._setComponentRef = function(ref, value) { - if (!this._skipComponentRefResolution && ref) { - if (typeof ref === 'function') ref(value); - if (typeof ref === 'object') // eslint-disable-next-line @typescript-eslint/no-explicit-any - ref.current = value; + BaseComponent.prototype._setComponentRef = function(ref2, value2) { + if (!this._skipComponentRefResolution && ref2) { + if (typeof ref2 === "function") { + ref2(value2); } + if (typeof ref2 === "object") { + ref2.current = value2; + } + } }; return BaseComponent; -}(_react.Component); -/** - * Helper to override a given method with a wrapper method that can try/catch the original, but also - * ensures that the BaseComponent's methods are called before the subclass's. This ensures that - * componentWillUnmount in the base is called and that things in the _disposables array are disposed. - */ // eslint-disable-next-line deprecation/deprecation -function _makeAllSafe(obj, prototype, methodNames) { - for(var i = 0, len = methodNames.length; i < len; i++)_makeSafe(obj, prototype, methodNames[i]); -} -// eslint-disable-next-line deprecation/deprecation -function _makeSafe(obj, prototype, methodName) { - /* eslint-disable @typescript-eslint/no-explicit-any */ var classMethod = obj[methodName]; - var prototypeMethod = prototype[methodName]; - if (classMethod || prototypeMethod) obj[methodName] = function() { + })(React__namespace.Component); + function _makeAllSafe(obj2, prototype2, methodNames) { + for (var i = 0, len2 = methodNames.length; i < len2; i++) { + _makeSafe(obj2, prototype2, methodNames[i]); + } + } + function _makeSafe(obj2, prototype2, methodName) { + var classMethod = obj2[methodName]; + var prototypeMethod = prototype2[methodName]; + if (classMethod || prototypeMethod) { + obj2[methodName] = function() { var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - /* eslint-enable @typescript-eslint/no-explicit-any */ var retVal; - if (prototypeMethod) retVal = prototypeMethod.apply(this, args); - if (classMethod !== prototypeMethod) retVal = classMethod.apply(this, args); - return retVal; - }; -} -function nullRender() { + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var retVal2; + if (prototypeMethod) { + retVal2 = prototypeMethod.apply(this, args); + } + if (classMethod !== prototypeMethod) { + retVal2 = classMethod.apply(this, args); + } + return retVal2; + }; + } + } + function nullRender() { return null; -} - -},{"tslib":"9gizs","react":"jGrId","./Async":"bcsew","./EventGroup":"0TvPH","./warn/warnConditionallyRequiredProps":"77JnC","./warn/warnMutuallyExclusive":"1HY1B","./warn/warnDeprecations":"e2341","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"77JnC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Warns when props are required if a condition is met. - * - * @public - * @param componentName - The name of the component being used. - * @param props - The props passed into the component. - * @param requiredProps - The name of the props that are required when the condition is met. - * @param conditionalPropName - The name of the prop that the condition is based on. - * @param condition - Whether the condition is met. - */ parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>warnConditionallyRequiredProps); -var _warn = require("./warn"); -function warnConditionallyRequiredProps(componentName, props, requiredProps, conditionalPropName, condition) { - condition; - var _i, requiredProps_1, requiredPropName; -} - -},{"./warn":"itqD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"itqD3":[function(require,module,exports,__globalThis) { -/* eslint-disable no-console */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Sends a warning to console, if the api is present. - * - * @public - * @param message - Warning message. - */ parcelHelpers.export(exports, "warn", ()=>warn); -/** - * Configures the warning callback. Passing in undefined will reset it to use the default - * console.warn function. - * - * @public - * @param warningCallback - Callback to override the generated warnings. - */ parcelHelpers.export(exports, "setWarningCallback", ()=>setWarningCallback); -var _warningCallback = undefined; -function warn(message) { - if (console && console.warn) console.warn(message); -} -function setWarningCallback(warningCallback) { - _warningCallback = warningCallback; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1HY1B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Warns when two props which are mutually exclusive are both being used. - * - * @public - * @param componentName - The name of the component being used. - * @param props - The props passed into the component. - * @param exclusiveMap - A map where the key is a parameter, and the value is the other parameter. - */ parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>warnMutuallyExclusive); -var _warn = require("./warn"); -function warnMutuallyExclusive(componentName, props, exclusiveMap) { - var propName, propInExclusiveMapValue; -} - -},{"./warn":"itqD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e2341":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Warns when a deprecated props are being used. - * - * @public - * @param componentName - The name of the component being used. - * @param props - The props passed into the component. - * @param deprecationMap - The map of deprecations, where key is the prop name and the value is - * either null or a replacement prop name. - */ parcelHelpers.export(exports, "warnDeprecations", ()=>warnDeprecations); -var _warn = require("./warn"); -function warnDeprecations(componentName, props, deprecationMap) { - var propName, deprecationMessage, replacementPropName; -} - -},{"./warn":"itqD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jKQeJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DelayedRender", ()=>DelayedRender); -var _tslib = require("tslib"); -var _react = require("react"); -var _getWindow = require("./dom/getWindow"); -var DelayedRender = /** @class */ function(_super) { - (0, _tslib.__extends)(DelayedRender, _super); - function DelayedRender(props) { + } + var DelayedRender = ( + /** @class */ + (function(_super) { + __extends(DelayedRender2, _super); + function DelayedRender2(props) { var _this = _super.call(this, props) || this; _this.state = { - isRendered: (0, _getWindow.getWindow)() === undefined + isRendered: getWindow() === void 0 }; return _this; - } - DelayedRender.prototype.componentDidMount = function() { + } + DelayedRender2.prototype.componentDidMount = function() { var _this = this; var delay = this.props.delay; - // eslint-disable-next-line no-restricted-globals this._timeoutId = window.setTimeout(function() { - _this.setState({ - isRendered: true - }); + _this.setState({ + isRendered: true + }); }, delay); - }; - DelayedRender.prototype.componentWillUnmount = function() { - if (this._timeoutId) clearTimeout(this._timeoutId); - }; - DelayedRender.prototype.render = function() { - return this.state.isRendered ? _react.Children.only(this.props.children) : null; - }; - DelayedRender.defaultProps = { + }; + DelayedRender2.prototype.componentWillUnmount = function() { + if (this._timeoutId) { + clearTimeout(this._timeoutId); + } + }; + DelayedRender2.prototype.render = function() { + return this.state.isRendered ? React__namespace.Children.only(this.props.children) : null; + }; + DelayedRender2.defaultProps = { delay: 0 - }; - return DelayedRender; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hiYVs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FabricPerformance", ()=>FabricPerformance); -var now = function() { - return typeof performance !== 'undefined' && !!performance.now ? performance.now() : Date.now(); -}; -var RESET_INTERVAL = 180000; // auto reset every 3 minutes -var FabricPerformance = /** @class */ function() { - function FabricPerformance() {} - /** - * Measures execution time of the given syncronous function. If the same logic is executed multiple times, - * each individual measurement will be collected as well the overall numbers. - * @param name - The name of this measurement - * @param func - The logic to be measured for execution time - */ FabricPerformance.measure = function(name, func) { - if (FabricPerformance._timeoutId) FabricPerformance.setPeriodicReset(); - var start = now(); - func(); - var end = now(); - var measurement = FabricPerformance.summary[name] || { - totalDuration: 0, - count: 0, - all: [] - }; - var duration = end - start; - measurement.totalDuration += duration; - measurement.count++; - measurement.all.push({ - duration: duration, - timeStamp: end - }); - FabricPerformance.summary[name] = measurement; - }; - FabricPerformance.reset = function() { - FabricPerformance.summary = {}; - clearTimeout(FabricPerformance._timeoutId); - FabricPerformance._timeoutId = NaN; - }; - FabricPerformance.setPeriodicReset = function() { - FabricPerformance._timeoutId = setTimeout(function() { - return FabricPerformance.reset(); - }, RESET_INTERVAL); - }; - FabricPerformance.summary = {}; - return FabricPerformance; -}(); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6x3RK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GlobalSettings", ()=>GlobalSettings); -var _getWindow = require("./dom/getWindow"); -/** - * Storing global state in local module variables has issues when more than one copy - * if the module gets loaded on the page (due to a bundling error or simply by consuming - * a prebundled script.) - * - * This file contains helpers to deal with the getting and setting local state, and allows - * callers to get called back when it mutates. - */ var GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__'; -var CALLBACK_STATE_PROP_NAME = '__callbacks__'; -var _counter = 0; -/** - * Global settings helper, which stores settings in the global (window) namespace. - * If window is not provided, it will store settings in module scope. Provides a - * way to observe changes as well when their values change. - * - * @public - * {@docCategory GlobalSettings} - */ var GlobalSettings = /** @class */ function() { - function GlobalSettings() {} - GlobalSettings.getValue = function(key, defaultValue) { + }; + return DelayedRender2; + })(React__namespace.Component) + ); + var GLOBAL_SETTINGS_PROP_NAME = "__globalSettings__"; + var CALLBACK_STATE_PROP_NAME = "__callbacks__"; + var _counter = 0; + var GlobalSettings = ( + /** @class */ + (function() { + function GlobalSettings2() { + } + GlobalSettings2.getValue = function(key2, defaultValue) { var globalSettings = _getGlobalSettings(); - if (globalSettings[key] === undefined) globalSettings[key] = typeof defaultValue === 'function' ? defaultValue() : defaultValue; - return globalSettings[key]; - }; - GlobalSettings.setValue = function(key, value) { + if (globalSettings[key2] === void 0) { + globalSettings[key2] = typeof defaultValue === "function" ? defaultValue() : defaultValue; + } + return globalSettings[key2]; + }; + GlobalSettings2.setValue = function(key2, value2) { var globalSettings = _getGlobalSettings(); var callbacks = globalSettings[CALLBACK_STATE_PROP_NAME]; - var oldValue = globalSettings[key]; - if (value !== oldValue) { - globalSettings[key] = value; - var changeDescription = { - oldValue: oldValue, - value: value, - key: key - }; - for(var id in callbacks)if (callbacks.hasOwnProperty(id)) callbacks[id](changeDescription); - } - return value; - }; - GlobalSettings.addChangeListener = function(cb) { - // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal. - // (It's faster to delete a key than it is to look up the index of an object and splice an array.) - var id = cb.__id__; + var oldValue = globalSettings[key2]; + if (value2 !== oldValue) { + globalSettings[key2] = value2; + var changeDescription = { + oldValue, + value: value2, + key: key2 + }; + for (var id2 in callbacks) { + if (callbacks.hasOwnProperty(id2)) { + callbacks[id2](changeDescription); + } + } + } + return value2; + }; + GlobalSettings2.addChangeListener = function(cb) { + var id2 = cb.__id__; var callbacks = _getCallbacks(); - if (!id) id = cb.__id__ = String(_counter++); - callbacks[id] = cb; - }; - GlobalSettings.removeChangeListener = function(cb) { + if (!id2) { + id2 = cb.__id__ = String(_counter++); + } + callbacks[id2] = cb; + }; + GlobalSettings2.removeChangeListener = function(cb) { var callbacks = _getCallbacks(); delete callbacks[cb.__id__]; - }; - return GlobalSettings; -}(); -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _getGlobalSettings() { - var _a; - var win = (0, _getWindow.getWindow)(); - // eslint-disable-next-line @typescript-eslint/no-explicit-any + }; + return GlobalSettings2; + })() + ); + function _getGlobalSettings() { + var _a2; + var win = getWindow(); var globalObj = win || {}; - if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) globalObj[GLOBAL_SETTINGS_PROP_NAME] = (_a = {}, _a[CALLBACK_STATE_PROP_NAME] = {}, _a); + if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) { + globalObj[GLOBAL_SETTINGS_PROP_NAME] = (_a2 = {}, _a2[CALLBACK_STATE_PROP_NAME] = {}, _a2); + } return globalObj[GLOBAL_SETTINGS_PROP_NAME]; -} -function _getCallbacks() { + } + function _getCallbacks() { var globalSettings = _getGlobalSettings(); return globalSettings[CALLBACK_STATE_PROP_NAME]; -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQoHk":[function(require,module,exports,__globalThis) { -/** - * Simulated enum for keycodes. These will get inlined by uglify when used much like an enum - * - * @public - * {@docCategory KeyCodes} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyCodes", ()=>KeyCodes); -var KeyCodes = { + } + var KeyCodes = { backspace: 8, tab: 9, enter: 13, - shift: 16, - ctrl: 17, alt: 18, - pauseBreak: 19, - capslock: 20, escape: 27, space: 32, pageUp: 33, @@ -66848,8617 +38206,5135 @@ var KeyCodes = { left: 37, up: 38, right: 39, - down: 40, - insert: 45, - del: 46, - zero: 48, - one: 49, - two: 50, - three: 51, - four: 52, - five: 53, - six: 54, - seven: 55, - eight: 56, - nine: 57, - colon: 58, - a: 65, - b: 66, - c: 67, - d: 68, - e: 69, - f: 70, - g: 71, - h: 72, - i: 73, - j: 74, - k: 75, - l: 76, - m: 77, - n: 78, - o: 79, - p: 80, - q: 81, - r: 82, - s: 83, - t: 84, - u: 85, - v: 86, - w: 87, - x: 88, - y: 89, - z: 90, - leftWindow: 91, - rightWindow: 92, - select: 93, - /* eslint-disable @typescript-eslint/naming-convention */ zero_numpad: 96, - one_numpad: 97, - two_numpad: 98, - three_numpad: 99, - four_numpad: 100, - five_numpad: 101, - six_numpad: 102, - seven_numpad: 103, - eight_numpad: 104, - nine_numpad: 105, - /* eslint-enable @typescript-eslint/naming-convention */ multiply: 106, - add: 107, - subtract: 109, - decimalPoint: 110, - divide: 111, - f1: 112, - f2: 113, - f3: 114, - f4: 115, - f5: 116, - f6: 117, - f7: 118, - f8: 119, - f9: 120, - f10: 121, - f11: 122, - f12: 123, - numlock: 144, - scrollLock: 145, - semicolon: 186, - equalSign: 187, - comma: 188, - dash: 189, - period: 190, - forwardSlash: 191, - graveAccent: 192, - openBracket: 219, - backSlash: 220, - closeBracket: 221, - singleQuote: 222 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hkyht":[function(require,module,exports,__globalThis) { -/** - * Rectangle helper class. - * - * @public - * {@docCategory Rectangle} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Rectangle", ()=>Rectangle); -var Rectangle = /** @class */ function() { - function Rectangle(left, right, top, bottom) { - if (left === void 0) left = 0; - if (right === void 0) right = 0; - if (top === void 0) top = 0; - if (bottom === void 0) bottom = 0; + down: 40 + }; + var Rectangle = ( + /** @class */ + (function() { + function Rectangle2(left, right, top, bottom) { + if (left === void 0) { + left = 0; + } + if (right === void 0) { + right = 0; + } + if (top === void 0) { + top = 0; + } + if (bottom === void 0) { + bottom = 0; + } this.top = top; this.bottom = bottom; this.left = left; this.right = right; - } - Object.defineProperty(Rectangle.prototype, "width", { + } + Object.defineProperty(Rectangle2.prototype, "width", { /** * Calculated automatically by subtracting the right from left - */ get: function() { - return this.right - this.left; + */ + get: function() { + return this.right - this.left; }, enumerable: false, configurable: true - }); - Object.defineProperty(Rectangle.prototype, "height", { + }); + Object.defineProperty(Rectangle2.prototype, "height", { /** * Calculated automatically by subtracting the bottom from top. - */ get: function() { - return this.bottom - this.top; + */ + get: function() { + return this.bottom - this.top; }, enumerable: false, configurable: true - }); - /** - * Tests if another rect is approximately equal to this rect (within 4 decimal places.) - */ Rectangle.prototype.equals = function(rect) { - // Fixing to 4 decimal places because it allows enough precision and will handle cases when something - // should be rounded, like .999999 should round to 1. - return parseFloat(this.top.toFixed(4)) === parseFloat(rect.top.toFixed(4)) && parseFloat(this.bottom.toFixed(4)) === parseFloat(rect.bottom.toFixed(4)) && parseFloat(this.left.toFixed(4)) === parseFloat(rect.left.toFixed(4)) && parseFloat(this.right.toFixed(4)) === parseFloat(rect.right.toFixed(4)); - }; - return Rectangle; -}(); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Ic5h":[function(require,module,exports,__globalThis) { -/* eslint-disable @typescript-eslint/no-explicit-any */ /** - * Returns a single function which will call each of the given functions in the context of the - * parent. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "appendFunction", ()=>appendFunction); -function appendFunction(parent) { + }); + Rectangle2.prototype.equals = function(rect2) { + return parseFloat(this.top.toFixed(4)) === parseFloat(rect2.top.toFixed(4)) && parseFloat(this.bottom.toFixed(4)) === parseFloat(rect2.bottom.toFixed(4)) && parseFloat(this.left.toFixed(4)) === parseFloat(rect2.left.toFixed(4)) && parseFloat(this.right.toFixed(4)) === parseFloat(rect2.right.toFixed(4)); + }; + return Rectangle2; + })() + ); + function appendFunction(parent) { var functions = []; - for(var _i = 1; _i < arguments.length; _i++)functions[_i - 1] = arguments[_i]; - if (functions.length < 2) return functions[0]; + for (var _i = 1; _i < arguments.length; _i++) { + functions[_i - 1] = arguments[_i]; + } + if (functions.length < 2) { + return functions[0]; + } return function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - functions.forEach(function(f) { - return f && f.apply(parent, args); - }); + var args = []; + for (var _i2 = 0; _i2 < arguments.length; _i2++) { + args[_i2] = arguments[_i2]; + } + functions.forEach(function(f) { + return f && f.apply(parent, args); + }); }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2p7Pt":[function(require,module,exports,__globalThis) { -/** - * ARIA helper to concatenate attributes, returning undefined if all attributes - * are undefined. (Empty strings are not a valid ARIA attribute value.) - * - * @param ariaAttributes - ARIA attributes to merge - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mergeAriaAttributeValues", ()=>mergeAriaAttributeValues); -function mergeAriaAttributeValues() { + } + function mergeAriaAttributeValues() { var ariaAttributes = []; - for(var _i = 0; _i < arguments.length; _i++)ariaAttributes[_i] = arguments[_i]; + for (var _i = 0; _i < arguments.length; _i++) { + ariaAttributes[_i] = arguments[_i]; + } var mergedAttribute = ariaAttributes.filter(function(arg) { - return arg; - }).join(' ').trim(); - return mergedAttribute === '' ? undefined : mergedAttribute; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Pspi":[function(require,module,exports,__globalThis) { -/** - * Helper to find the index of an item within an array, using a callback to - * determine the match. - * - * @public - * @param array - Array to search. - * @param cb - Callback which returns true on matches. - * @param fromIndex - Optional index to start from (defaults to 0) - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "findIndex", ()=>findIndex); -/** - * Helper to find the first item within an array that satisfies the callback. - * @param array - Array to search - * @param cb - Callback which returns true on matches - */ parcelHelpers.export(exports, "find", ()=>find); -/** - * Creates an array of a given size and helper method to populate. - * - * @public - * @param size - Size of array. - * @param getItem - Callback to populate given cell index. - */ parcelHelpers.export(exports, "createArray", ()=>createArray); -/** - * Convert the given array to a matrix with columnCount number - * of columns. - * - * @public - * @param items - The array to convert - * @param columnCount - The number of columns for the resulting matrix - * @returns A matrix of items - */ parcelHelpers.export(exports, "toMatrix", ()=>toMatrix); -/** - * Given an array, it returns a new array that does not contain the item at the given index. - * @param array - The array to operate on - * @param index - The index of the element to remove - */ parcelHelpers.export(exports, "removeIndex", ()=>removeIndex); -/** - * Given an array, this function returns a new array where the element at a given index has been replaced. - * @param array - The array to operate on - * @param newElement - The element that will be placed in the new array - * @param index - The index of the element that should be replaced - */ parcelHelpers.export(exports, "replaceElement", ()=>replaceElement); -/** - * Given an array, this function returns a new array where an element has been inserted at the given index. - * @param array - The array to operate on - * @param index - The index where an element should be inserted - * @param itemToAdd - The element to insert - */ parcelHelpers.export(exports, "addElementAtIndex", ()=>addElementAtIndex); -/** - * Given an array where each element is of type T or T[], flatten it into an array of T - * @param array - The array where each element can optionally also be an array - */ parcelHelpers.export(exports, "flatten", ()=>flatten); -/** - * Returns a boolean indicating if the two given arrays are equal in length and values. - * - * @param array1 - First array to compare - * @param array2 - Second array to compare - * @returns True if the arrays are the same length and have the same values in the same positions, false otherwise. - */ parcelHelpers.export(exports, "arraysEqual", ()=>arraysEqual); -function findIndex(array, cb, fromIndex) { - if (fromIndex === void 0) fromIndex = 0; - var index = -1; - for(var i = fromIndex; array && i < array.length; i++)if (cb(array[i], i)) { - index = i; + return arg; + }).join(" ").trim(); + return mergedAttribute === "" ? void 0 : mergedAttribute; + } + function findIndex(array2, cb, fromIndex) { + if (fromIndex === void 0) { + fromIndex = 0; + } + var index2 = -1; + for (var i = fromIndex; array2 && i < array2.length; i++) { + if (cb(array2[i], i)) { + index2 = i; break; + } } - return index; -} -function find(array, cb) { - var index = findIndex(array, cb); - if (index < 0) return undefined; - return array[index]; -} -function createArray(size, getItem) { - var array = []; - for(var i = 0; i < size; i++)array.push(getItem(i)); - return array; -} -function toMatrix(items, columnCount) { - return items.reduce(function(rows, currentValue, index) { - if (index % columnCount === 0) rows.push([ - currentValue - ]); - else rows[rows.length - 1].push(currentValue); - return rows; - }, []); -} -function removeIndex(array, index) { - return array.filter(function(_, i) { - return index !== i; - }); -} -function replaceElement(array, newElement, index) { - var copy = array.slice(); - copy[index] = newElement; - return copy; -} -function addElementAtIndex(array, index, itemToAdd) { - var copy = array.slice(); - copy.splice(index, 0, itemToAdd); - return copy; -} -function flatten(array) { - var result = []; - array.forEach(function(item) { - return result = result.concat(item); - }); - return result; -} -function arraysEqual(array1, array2) { - if (array1.length !== array2.length) return false; - for(var i = 0; i < array1.length; i++){ - if (array1[i] !== array2[i]) return false; + return index2; + } + function find$3(array2, cb) { + var index2 = findIndex(array2, cb); + if (index2 < 0) { + return void 0; } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jPOCb":[function(require,module,exports,__globalThis) { -/** - * asAsync - a HOC for async loading components. - * - * Usage: - * - * const AsyncDialog = asAsync({ - * load: () => import('Dialog').then(result => result.default), - * }); - * - * React.render(domElement, <AsyncDialog asyncPlaceholder={ () => <Spinner/> } { ...dialogProps } />); - * - * Note the `asyncPlaceholder` prop will be respected when rendering the async component and it hasn't - * been loaded yet. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Produces a component which internally loads the target component before first mount. - * The component passes all props through to the loaded component. - * - * This overload accepts a module with a default export for the component. - */ parcelHelpers.export(exports, "asAsync", ()=>asAsync); -var _tslib = require("tslib"); -var _react = require("react"); -/** - * If possible, use a WeakMap to maintain a cache of loaded components. - * This can be used to synchronously render components that have already been loaded, - * rather than having to wait for at least one async tick. - */ var _syncModuleCache = typeof WeakMap !== 'undefined' ? new WeakMap() : undefined; -function asAsync(options) { - var Async = /** @class */ function(_super) { - (0, _tslib.__extends)(Async, _super); - function Async() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.state = { - Component: _syncModuleCache ? _syncModuleCache.get(options.load) : undefined - }; - return _this; - } - Async.prototype.render = function() { - // Typescript issue: the rest can't be pulled without the any cast, as TypeScript fails with rest on generics. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var _a = this.props, forwardedRef = _a.forwardedRef, Placeholder = _a.asyncPlaceholder, rest = (0, _tslib.__rest)(_a, [ - "forwardedRef", - "asyncPlaceholder" - ]); - var Component = this.state.Component; - return Component ? _react.createElement(Component, (0, _tslib.__assign)((0, _tslib.__assign)({}, rest), { - ref: forwardedRef - })) : Placeholder ? _react.createElement(Placeholder, null) : null; - }; - Async.prototype.componentDidMount = function() { - var _this = this; - var Component = this.state.Component; - if (!Component) options.load().then(function(LoadedComponent) { - if (LoadedComponent) { - // Cache component for future reference. - _syncModuleCache && _syncModuleCache.set(options.load, LoadedComponent); - // Set state. - _this.setState({ - Component: LoadedComponent - }, options.onLoad); - } - }).catch(options.onError); - }; - return Async; - }(_react.Component); - return _react.forwardRef(function(props, ref) { - return _react.createElement(Async, (0, _tslib.__assign)({}, props, { - forwardedRef: ref - })); - }); -} - -},{"tslib":"9gizs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l66AW":[function(require,module,exports,__globalThis) { -/** - * AssertNever is a utility function that can be used for exhaustiveness checks in switch statements. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assertNever", ()=>assertNever); -function assertNever(x) { - throw new Error('Unexpected object: ' + x); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lKbNl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Creates a getClassNames function which calls getStyles given the props, and injects them - * into mergeStyleSets. - * - * Note that the props you pass in on every render should be in the same order and - * immutable (numbers, strings, and booleans). This will allow the results to be memoized. Violating - * these will cause extra recalcs to occur. - */ parcelHelpers.export(exports, "classNamesFunction", ()=>classNamesFunction); -var _mergeStyles = require("@fluentui/merge-styles"); -var _rtl = require("./rtl"); -var _dom = require("./dom"); -var MAX_CACHE_COUNT = 50; -var DEFAULT_SPECIFICITY_MULTIPLIER = 5; -var _memoizedClassNames = 0; -var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); -if (stylesheet && stylesheet.onReset) stylesheet.onReset(function() { - return _memoizedClassNames++; -}); -// Note that because of the caching nature within the classNames memoization, -// I've disabled this rule to simply be able to work with any types. -/* eslint-disable @typescript-eslint/no-explicit-any */ // This represents a prop we attach to each Map to indicate the cached return value -// associated with the graph node. -var retVal = '__retval__'; -function classNamesFunction(options) { - // We build a trie where each node is a Map. The map entry key represents an argument - // value, and the entry value is another node (Map). Each node has a `__retval__` - // property which is used to hold the cached response. - if (options === void 0) options = {}; - // To derive the response, we can simply ensure the arguments are added or already - // exist in the trie. At the last node, if there is a `__retval__` we return that. Otherwise - // we call the `getStyles` api to evaluate, cache on the property, and return that. - // let map: IRecursiveMemoNode = new Map(); - var windowMap = new Map(); - var styleCalcCount = 0; - var getClassNamesCount = 0; - var currentMemoizedClassNames = _memoizedClassNames; - var getClassNames = function(styleFunctionOrObject, styleProps) { - var _a; - if (styleProps === void 0) styleProps = {}; - // If useStaticStyles is true, styleFunctionOrObject returns slot to classname mappings. - // If there is also no style overrides, we can skip merge styles completely and - // simply return the result from the style funcion. - if (options.useStaticStyles && typeof styleFunctionOrObject === 'function' && styleFunctionOrObject.__noStyleOverride__) return styleFunctionOrObject(styleProps); - getClassNamesCount++; - var shadowConfig = styleFunctionOrObject ? styleFunctionOrObject.__shadowConfig__ : undefined; - var key = shadowConfig && shadowConfig.window ? shadowConfig.window : '__default__'; - if (!windowMap.has(key)) windowMap.set(key, new Map()); - var current = windowMap.get(key); - // let current: Map<any, any> = map; - var theme = styleProps.theme; - var rtl = theme && theme.rtl !== undefined ? theme.rtl : (0, _rtl.getRTL)(); - var disableCaching = options.disableCaching; - // On reset of our stylesheet, reset memoized cache. - if (currentMemoizedClassNames !== _memoizedClassNames) { - currentMemoizedClassNames = _memoizedClassNames; - // map = new Map(); - windowMap.set(key, new Map()); - current = windowMap.get(key); - styleCalcCount = 0; - } - if (!options.disableCaching) { - current = _traverseMap(windowMap.get(key), styleFunctionOrObject); - current = _traverseMap(current, styleProps); - } - if (disableCaching || !current[retVal]) { - if (styleFunctionOrObject === undefined) current[retVal] = {}; - else current[retVal] = (0, _mergeStyles.mergeCssSets)([ - typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject - ], { - shadowConfig: styleFunctionOrObject.__shadowConfig__, - rtl: !!rtl, - specificityMultiplier: options.useStaticStyles ? DEFAULT_SPECIFICITY_MULTIPLIER : undefined - }); - if (!disableCaching) styleCalcCount++; - } - if (styleCalcCount > (options.cacheSize || MAX_CACHE_COUNT)) { - var win = (0, _dom.getWindow)(); - if ((_a = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _a === void 0 ? void 0 : _a.enableClassNameCacheFullWarning) { - // eslint-disable-next-line no-console - console.warn("Styles are being recalculated too frequently. Cache miss rate is ".concat(styleCalcCount, "/").concat(getClassNamesCount, ".")); - // eslint-disable-next-line no-console - console.trace(); - } - windowMap.get(key).clear(); - styleCalcCount = 0; - // Mutate the options passed in, that's all we can do. - options.disableCaching = true; - } - // Note: the retVal is an attached property on the Map; not a key in the Map. We use this attached property to - // cache the return value for this branch of the graph. - return current[retVal]; - }; - return getClassNames; -} -function _traverseEdge(current, value) { - value = _normalizeValue(value); - if (!current.has(value)) current.set(value, new Map()); - return current.get(value); -} -function _traverseMap(current, inputs) { - if (typeof inputs === 'function') { - var cachedInputsFromStyled = inputs.__cachedInputs__; - if (cachedInputsFromStyled) // The styled helper will generate the styles function and will attach the cached - // inputs (consisting of the default styles, customzied styles, and user provided styles.) - // These should be used as cache keys for deriving the memoized value. - for(var _i = 0, _a = inputs.__cachedInputs__; _i < _a.length; _i++){ - var input = _a[_i]; - current = _traverseEdge(current, input); - } - else current = _traverseEdge(current, inputs); - } else if (typeof inputs === 'object') { - for(var propName in inputs)if (inputs.hasOwnProperty(propName)) current = _traverseEdge(current, inputs[propName]); + return array2[index2]; + } + function addElementAtIndex(array2, index2, itemToAdd) { + var copy2 = array2.slice(); + copy2.splice(index2, 0, itemToAdd); + return copy2; + } + function arraysEqual(array1, array2) { + if (array1.length !== array2.length) { + return false; } - return current; -} -function _normalizeValue(value) { - switch(value){ - case undefined: - return '__undefined__'; - case null: - return '__null__'; - default: - return value; - } -} - -},{"@fluentui/merge-styles":"bDG2L","./rtl":"gRlx4","./dom":"QMA5I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gRlx4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the rtl state of the page (returns true if in rtl.) - */ parcelHelpers.export(exports, "getRTL", ()=>getRTL); -/** - * Sets the rtl state of the page (by adjusting the dir attribute of the html element.) - */ parcelHelpers.export(exports, "setRTL", ()=>setRTL); -/** - * Returns the given key, but flips right/left arrows if necessary. - */ parcelHelpers.export(exports, "getRTLSafeKeyCode", ()=>getRTLSafeKeyCode); -var _keyCodes = require("./KeyCodes"); -var _getDocument = require("./dom/getDocument"); -var _sessionStorage = require("./sessionStorage"); -var _mergeStyles = require("@fluentui/merge-styles"); -var RTL_LOCAL_STORAGE_KEY = 'isRTL'; -// Default to undefined so that we initialize on first read. -var _isRTL; -function getRTL(theme) { - if (theme === void 0) theme = {}; - if (theme.rtl !== undefined) return theme.rtl; - if (_isRTL === undefined) { - // Fabric supports persisting the RTL setting between page refreshes via session storage - var savedRTL = (0, _sessionStorage.getItem)(RTL_LOCAL_STORAGE_KEY); - if (savedRTL !== null) { - _isRTL = savedRTL === '1'; - setRTL(_isRTL); - } - var doc = (0, _getDocument.getDocument)(); - if (_isRTL === undefined && doc) { - _isRTL = (doc.body && doc.body.getAttribute('dir') || doc.documentElement.getAttribute('dir')) === 'rtl'; - (0, _mergeStyles.setRTL)(_isRTL); - } + for (var i = 0; i < array1.length; i++) { + if (array1[i] !== array2[i]) { + return false; + } } - return !!_isRTL; -} -function setRTL(isRTL, persistSetting) { - if (persistSetting === void 0) persistSetting = false; - var doc = (0, _getDocument.getDocument)(); - if (doc) doc.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr'); - if (persistSetting) (0, _sessionStorage.setItem)(RTL_LOCAL_STORAGE_KEY, isRTL ? '1' : '0'); - _isRTL = isRTL; - (0, _mergeStyles.setRTL)(_isRTL); -} -function getRTLSafeKeyCode(key, theme) { - if (theme === void 0) theme = {}; - if (getRTL(theme)) { - if (key === (0, _keyCodes.KeyCodes).left) key = (0, _keyCodes.KeyCodes).right; - else if (key === (0, _keyCodes.KeyCodes).right) key = (0, _keyCodes.KeyCodes).left; - } - return key; -} - -},{"./KeyCodes":"eQoHk","./dom/getDocument":"7EOu7","./sessionStorage":"fAeWE","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fAeWE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Fetches an item from session storage without throwing an exception - * @param key The key of the item to fetch from session storage - */ parcelHelpers.export(exports, "getItem", ()=>getItem); -/** - * Inserts an item into session storage without throwing an exception - * @param key The key of the item to add to session storage - * @param data The data to put into session storage - */ parcelHelpers.export(exports, "setItem", ()=>setItem); -var _getWindow = require("./dom/getWindow"); -function getItem(key) { + return true; + } + function getItem$1(key2) { var result = null; try { - var win = (0, _getWindow.getWindow)(); - result = win ? win.sessionStorage.getItem(key) : null; + var win = getWindow(); + result = win ? win.sessionStorage.getItem(key2) : null; } catch (e) { - /* Eat the exception */ } + } return result; -} -function setItem(key, data) { - var _a; + } + function setItem(key2, data2) { + var _a2; try { - (_a = (0, _getWindow.getWindow)()) === null || _a === void 0 || _a.sessionStorage.setItem(key, data); + (_a2 = getWindow()) === null || _a2 === void 0 ? void 0 : _a2.sessionStorage.setItem(key2, data2); } catch (e) { - /* Eat the exception */ } -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7HNhY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Composes two components which conform to the `IComponentAs` specification; that is, two - * components which accept a `defaultRender` prop, which is a 'default' implementation of - * a component which accepts the same overall props. - * - * @public - */ parcelHelpers.export(exports, "composeComponentAs", ()=>composeComponentAs); -var _tslib = require("tslib"); -var _react = require("react"); -var _memoize = require("../memoize"); -function createComposedComponent(outer) { - var Outer = outer; - var outerMemoizer = (0, _memoize.createMemoizer)(function(inner) { - if (outer === inner) throw new Error('Attempted to compose a component with itself.'); - var Inner = inner; - var innerMemoizer = (0, _memoize.createMemoizer)(function(defaultRender) { - var InnerWithDefaultRender = function(innerProps) { - return _react.createElement(Inner, (0, _tslib.__assign)({}, innerProps, { - defaultRender: defaultRender - })); - }; - return InnerWithDefaultRender; - }); - var OuterWithDefaultRender = function(outerProps) { - var defaultRender = outerProps.defaultRender; - return _react.createElement(Outer, (0, _tslib.__assign)({}, outerProps, { - defaultRender: defaultRender ? innerMemoizer(defaultRender) : Inner - })); - }; - return OuterWithDefaultRender; - }); - return outerMemoizer; -} -var componentAsMemoizer = (0, _memoize.createMemoizer)(createComposedComponent); -function composeComponentAs(outer, inner) { - return componentAsMemoizer(outer)(inner); -} - -},{"tslib":"9gizs","react":"jGrId","../memoize":"cqPyR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cqPyR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Test utility for providing a custom weakmap. - * - * @internal - * */ parcelHelpers.export(exports, "setMemoizeWeakMap", ()=>setMemoizeWeakMap); -/** - * Reset memoizations. - */ parcelHelpers.export(exports, "resetMemoizations", ()=>resetMemoizations); -/** - * Memoize decorator to be used on class methods. WARNING: the `this` reference - * will be inaccessible within a memoized method, given that a cached method's `this` - * would not be instance-specific. - * - * @public - */ parcelHelpers.export(exports, "memoize", ()=>memoize); -/** - * Memoizes a function; when you pass in the same parameters multiple times, it returns a cached result. - * Be careful when passing in objects, you need to pass in the same INSTANCE for caching to work. Otherwise - * it will grow the cache unnecessarily. Also avoid using default values that evaluate functions; passing in - * undefined for a value and relying on a default function will execute it the first time, but will not - * re-evaluate subsequent times which may have been unexpected. - * - * By default, the cache will reset after 100 permutations, to avoid abuse cases where the function is - * unintendedly called with unique objects. Without a reset, the cache could grow infinitely, so we safeguard - * by resetting. To override this behavior, pass a value of 0 to the maxCacheSize parameter. - * - * @public - * @param cb - The function to memoize. - * @param maxCacheSize - Max results to cache. If the cache exceeds this value, it will reset on the next call. - * @param ignoreNullOrUndefinedResult - Flag to decide whether to cache callback result if it is undefined/null. - * If the flag is set to true, the callback result is recomputed every time till the callback result is - * not undefined/null for the first time, and then the non-undefined/null version gets cached. - * @returns A memoized version of the function. - */ parcelHelpers.export(exports, "memoizeFunction", ()=>memoizeFunction); -/** - * Creates a memoizer for a single-value function, backed by a WeakMap. - * With a WeakMap, the memoized values are only kept as long as the source objects, - * ensuring that there is no memory leak. - * - * This function assumes that the input values passed to the wrapped function will be - * `function` or `object` types. To memoize functions which accept other inputs, use - * `memoizeFunction`, which memoizes against arbitrary inputs using a lookup cache. - * - * @public - */ parcelHelpers.export(exports, "createMemoizer", ()=>createMemoizer); -var _mergeStyles = require("@fluentui/merge-styles"); -var _initializedStylesheetResets = false; -var _resetCounter = 0; -var _emptyObject = { - empty: true -}; -var _dictionary = {}; -var _weakMap = typeof WeakMap === 'undefined' ? null : WeakMap; -function setMemoizeWeakMap(weakMap) { - _weakMap = weakMap; -} -function resetMemoizations() { - _resetCounter++; -} -function memoize(_target, _key, descriptor) { - // We bind to "null" to prevent people from inadvertently pulling values from "this", - // rather than passing them in as input values which can be memoized. - var fn = memoizeFunction(descriptor.value && descriptor.value.bind(null)); - return { - configurable: true, - get: function() { - return fn; - } - }; -} -function memoizeFunction(cb, maxCacheSize, ignoreNullOrUndefinedResult) { - if (maxCacheSize === void 0) maxCacheSize = 100; - if (ignoreNullOrUndefinedResult === void 0) ignoreNullOrUndefinedResult = false; - // Avoid breaking scenarios which don't have weak map. - if (!_weakMap) return cb; - if (!_initializedStylesheetResets) { - var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); - if (stylesheet && stylesheet.onReset) (0, _mergeStyles.Stylesheet).getInstance().onReset(resetMemoizations); - _initializedStylesheetResets = true; } - var rootNode; - var cacheSize = 0; - var localResetCounter = _resetCounter; - return function memoizedFunction() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - var currentNode = rootNode; - if (rootNode === undefined || localResetCounter !== _resetCounter || maxCacheSize > 0 && cacheSize > maxCacheSize) { - rootNode = _createNode(); - cacheSize = 0; - localResetCounter = _resetCounter; - } - currentNode = rootNode; - // Traverse the tree until we find the match. - for(var i = 0; i < args.length; i++){ - var arg = _normalizeArg(args[i]); - if (!currentNode.map.has(arg)) currentNode.map.set(arg, _createNode()); - currentNode = currentNode.map.get(arg); - } - if (!currentNode.hasOwnProperty('value')) { - currentNode.value = cb.apply(void 0, args); - cacheSize++; - } - if (ignoreNullOrUndefinedResult && (currentNode.value === null || currentNode.value === undefined)) currentNode.value = cb.apply(void 0, args); - return currentNode.value; - }; -} -function createMemoizer(getValue) { - if (!_weakMap) // Without a `WeakMap` implementation, memoization is not possible. - return getValue; - var cache = new _weakMap(); - function memoizedGetValue(input) { - if (!input || typeof input !== 'function' && typeof input !== 'object') // A WeakMap can only be used to test against reference values, i.e. 'function' and 'object'. - // All other inputs cannot be memoized against in this manner. - return getValue(input); - if (cache.has(input)) return cache.get(input); - var value = getValue(input); - cache.set(input, value); - return value; - } - return memoizedGetValue; -} -function _normalizeArg(val) { - if (!val) return _emptyObject; - else if (typeof val === 'object' || typeof val === 'function') return val; - else if (!_dictionary[val]) _dictionary[val] = { - val: val - }; - return _dictionary[val]; -} -function _createNode() { - return { - map: _weakMap ? new _weakMap() : null - }; -} - -},{"@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Lj2y":[function(require,module,exports,__globalThis) { -/** - * Determines whether a component is controlled. - * @param props - Component props - * @param valueProp - Prop containing the controlled value - * @returns true if controlled, false if uncontrolled - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isControlled", ()=>isControlled); -function isControlled(props, valueProp) { - // React's built-in <input> considers a prop to be provided if its value is non-null/undefined. - // Mirror that behavior here (rather than checking for just undefined). - return props[valueProp] !== undefined && props[valueProp] !== null; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dmVvk":[function(require,module,exports,__globalThis) { -/** - * Concatination helper, which can merge class names together. Skips over falsey values. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "css", ()=>css); -function css() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - var classes = []; - for(var _a = 0, args_1 = args; _a < args_1.length; _a++){ - var arg = args_1[_a]; - if (arg) { - if (typeof arg === 'string') classes.push(arg); - else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') classes.push(arg.toString()); - else { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - for(var key in arg)// eslint-disable-next-line @typescript-eslint/no-explicit-any - if (arg[key]) classes.push(key); - } - } - } - return classes.join(' '); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQS4T":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Customizations", ()=>Customizations); -var _tslib = require("tslib"); -var _globalSettings = require("../GlobalSettings"); -var CustomizationsGlobalKey = 'customizations'; -var NO_CUSTOMIZATIONS = { - settings: {}, - scopedSettings: {}, - inCustomizerContext: false -}; -var _allSettings = (0, _globalSettings.GlobalSettings).getValue(CustomizationsGlobalKey, { - settings: {}, - scopedSettings: {}, - inCustomizerContext: false -}); -var _events = []; -var Customizations = /** @class */ function() { - function Customizations() {} - Customizations.reset = function() { - _allSettings.settings = {}; - _allSettings.scopedSettings = {}; - }; - /** Apply global Customization settings. - * @example Customizations.applySettings(\{ theme: \{...\} \}); - */ Customizations.applySettings = function(settings) { - _allSettings.settings = (0, _tslib.__assign)((0, _tslib.__assign)({}, _allSettings.settings), settings); - Customizations._raiseChange(); - }; - /** Apply Customizations to a particular named scope, like a component. - * @example Customizations.applyScopedSettings('Nav', \{ styles: () =\> \{\} \}); - */ Customizations.applyScopedSettings = function(scopeName, settings) { - _allSettings.scopedSettings[scopeName] = (0, _tslib.__assign)((0, _tslib.__assign)({}, _allSettings.scopedSettings[scopeName]), settings); - Customizations._raiseChange(); - }; - Customizations.getSettings = function(properties, scopeName, localSettings) { - if (localSettings === void 0) localSettings = NO_CUSTOMIZATIONS; - var settings = {}; - var localScopedSettings = scopeName && localSettings.scopedSettings[scopeName] || {}; - var globalScopedSettings = scopeName && _allSettings.scopedSettings[scopeName] || {}; - for(var _i = 0, properties_1 = properties; _i < properties_1.length; _i++){ - var property = properties_1[_i]; - settings[property] = localScopedSettings[property] || localSettings.settings[property] || globalScopedSettings[property] || _allSettings.settings[property]; - } - return settings; - }; - /** Used to run some code that sets Customizations without triggering an update until the end. - * Useful for applying Customizations that don't affect anything currently rendered, or for - * applying many customizations at once. - * @param suppressUpdate - Do not raise the change event at the end, preventing all updates - */ Customizations.applyBatchedUpdates = function(code, suppressUpdate) { - Customizations._suppressUpdates = true; - try { - code(); - } catch (_a) { - /* do nothing */ } - Customizations._suppressUpdates = false; - if (!suppressUpdate) Customizations._raiseChange(); - }; - Customizations.observe = function(onChange) { - _events.push(onChange); - }; - Customizations.unobserve = function(onChange) { - _events = _events.filter(function(cb) { - return cb !== onChange; - }); - }; - Customizations._raiseChange = function() { - if (!Customizations._suppressUpdates) _events.forEach(function(cb) { - return cb(); - }); - }; - return Customizations; -}(); - -},{"tslib":"9gizs","../GlobalSettings":"6x3RK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5lXfh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Customizer", ()=>Customizer); -var _tslib = require("tslib"); -var _react = require("react"); -var _customizations = require("./Customizations"); -var _customizerContext = require("./CustomizerContext"); -var _mergeCustomizations = require("./mergeCustomizations"); -/** - * The Customizer component allows for default props to be mixed into components which - * are decorated with the customizable() decorator, or use the styled HOC. This enables - * injection scenarios like: - * - * 1. render svg icons instead of the icon font within all buttons - * 2. inject a custom theme object into a component - * - * Props are provided via the settings prop which should be one of the following: - * - A json map which contains 1 or more name/value pairs representing injectable props. - * - A function that receives the current settings and returns the new ones that apply to the scope - * - * @public - * - * @deprecated This component is deprecated for purpose of applying theme to components - * as of `@fluentui/react` version 8. Use `ThemeProvider` for applying theme instead. - */ var Customizer = /** @class */ function(_super) { - (0, _tslib.__extends)(Customizer, _super); - function Customizer() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._onCustomizationChange = function() { - return _this.forceUpdate(); - }; - return _this; - } - Customizer.prototype.componentDidMount = function() { - (0, _customizations.Customizations).observe(this._onCustomizationChange); - }; - Customizer.prototype.componentWillUnmount = function() { - (0, _customizations.Customizations).unobserve(this._onCustomizationChange); - }; - Customizer.prototype.render = function() { - var _this = this; - var contextTransform = this.props.contextTransform; - return _react.createElement((0, _customizerContext.CustomizerContext).Consumer, null, function(parentContext) { - var newContext = (0, _mergeCustomizations.mergeCustomizations)(_this.props, parentContext); - if (contextTransform) newContext = contextTransform(newContext); - return _react.createElement((0, _customizerContext.CustomizerContext).Provider, { - value: newContext - }, _this.props.children); - }); - }; - return Customizer; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./Customizations":"eQS4T","./CustomizerContext":"aB8eN","./mergeCustomizations":"yo2of","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aB8eN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CustomizerContext", ()=>CustomizerContext); -var _react = require("react"); -var CustomizerContext = _react.createContext({ - customizations: { - inCustomizerContext: false, - settings: {}, - scopedSettings: {} - } -}); - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"yo2of":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Merge props and customizations giving priority to props over context. - * NOTE: This function will always perform multiple merge operations. Use with caution. - * @param props - New settings to merge in. - * @param parentContext - Context containing current settings. - * @returns Merged customizations. - */ parcelHelpers.export(exports, "mergeCustomizations", ()=>mergeCustomizations); -var _mergeSettings = require("./mergeSettings"); -function mergeCustomizations(props, parentContext) { - var _a = (parentContext || {}).customizations, customizations = _a === void 0 ? { - settings: {}, - scopedSettings: {} - } : _a; - return { - customizations: { - settings: (0, _mergeSettings.mergeSettings)(customizations.settings, props.settings), - scopedSettings: (0, _mergeSettings.mergeScopedSettings)(customizations.scopedSettings, props.scopedSettings), - inCustomizerContext: true - } - }; -} - -},{"./mergeSettings":"c4Gl8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c4Gl8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Merge new and old settings, giving priority to new settings. - * New settings is optional in which case oldSettings is returned as-is. - * @param oldSettings - Old settings to fall back to. - * @param newSettings - New settings that will be merged over oldSettings. - * @returns Merged settings. - */ parcelHelpers.export(exports, "mergeSettings", ()=>mergeSettings); -parcelHelpers.export(exports, "mergeScopedSettings", ()=>mergeScopedSettings); -var _tslib = require("tslib"); -function mergeSettings(oldSettings, newSettings) { - if (oldSettings === void 0) oldSettings = {}; - var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _settingsMergeWith(newSettings); - return mergeSettingsWith(oldSettings); -} -function mergeScopedSettings(oldSettings, newSettings) { - if (oldSettings === void 0) oldSettings = {}; - var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _scopedSettingsMergeWith(newSettings); - return mergeSettingsWith(oldSettings); -} -function _isSettingsFunction(settings) { - return typeof settings === 'function'; -} -function _settingsMergeWith(newSettings) { - return function(settings) { - return newSettings ? (0, _tslib.__assign)((0, _tslib.__assign)({}, settings), newSettings) : settings; - }; -} -function _scopedSettingsMergeWith(scopedSettingsFromProps) { - if (scopedSettingsFromProps === void 0) scopedSettingsFromProps = {}; - return function(oldScopedSettings) { - var newScopedSettings = (0, _tslib.__assign)({}, oldScopedSettings); - for(var scopeName in scopedSettingsFromProps)if (scopedSettingsFromProps.hasOwnProperty(scopeName)) newScopedSettings[scopeName] = (0, _tslib.__assign)((0, _tslib.__assign)({}, oldScopedSettings[scopeName]), scopedSettingsFromProps[scopeName]); - return newScopedSettings; - }; -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7RolT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "customizable", ()=>customizable); -var _tslib = require("tslib"); -var _react = require("react"); -var _customizations = require("./Customizations"); -var _hoistStatics = require("../hoistStatics"); -var _customizerContext = require("./CustomizerContext"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _mergeStylesShadowRootConsumer = require("../shadowDom/contexts/MergeStylesShadowRootConsumer"); -var _getWindow = require("../dom/getWindow"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _memoize = require("../memoize"); -var memoizedMakeShadowConfig = (0, _memoize.memoizeFunction)((0, _mergeStyles.makeShadowConfig)); -var mergeComponentStyles = (0, _memoize.memoizeFunction)(// eslint-disable-next-line @typescript-eslint/no-explicit-any -function(defaultStyles, componentStyles, shadowConfig) { - var _a; - var styles = (_a = componentStyles !== null && componentStyles !== void 0 ? componentStyles : defaultStyles) !== null && _a !== void 0 ? _a : {}; - styles.__shadowConfig__ = shadowConfig; - return styles; -}); -function customizable(scope, fields, concatStyles) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return function customizableFactory(ComposedComponent) { - var _a; - var resultClass = (_a = /** @class */ function(_super) { - (0, _tslib.__extends)(ComponentWithInjectedProps, _super); - function ComponentWithInjectedProps(props) { - var _this = _super.call(this, props) || this; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _this._styleCache = {}; - _this._onSettingChanged = _this._onSettingChanged.bind(_this); - return _this; - } - ComponentWithInjectedProps.prototype.componentDidMount = function() { - (0, _customizations.Customizations).observe(this._onSettingChanged); - }; - ComponentWithInjectedProps.prototype.componentWillUnmount = function() { - (0, _customizations.Customizations).unobserve(this._onSettingChanged); - }; - ComponentWithInjectedProps.prototype.render = function() { - var _this = this; - return _react.createElement((0, _mergeStylesShadowRootConsumer.MergeStylesShadowRootConsumer), { - stylesheetKey: scope - }, function(inShadow) { - return _react.createElement((0, _customizerContext.CustomizerContext).Consumer, null, function(context) { - var _a; - var defaultProps = (0, _customizations.Customizations).getSettings(fields, scope, context.customizations); - var win = (_a = _this.context.window) !== null && _a !== void 0 ? _a : (0, _getWindow.getWindow)(); - var shadowConfig = memoizedMakeShadowConfig(scope, inShadow, win); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var componentProps = _this.props; - // If defaultProps.styles is a function, evaluate it before calling concatStyleSets - if (defaultProps.styles && typeof defaultProps.styles === 'function') defaultProps.styles = defaultProps.styles((0, _tslib.__assign)((0, _tslib.__assign)({}, defaultProps), componentProps)); - // If concatStyles is true and custom styles have been defined compute those styles - if (concatStyles && defaultProps.styles) { - if (_this._styleCache.default !== defaultProps.styles || _this._styleCache.component !== componentProps.styles) { - var mergedStyles = (0, _mergeStyles.concatStyleSets)(defaultProps.styles, componentProps.styles); - mergedStyles.__shadowConfig__ = shadowConfig; - _this._styleCache.default = defaultProps.styles; - _this._styleCache.component = componentProps.styles; - _this._styleCache.merged = mergedStyles; - } - return _react.createElement(ComposedComponent, (0, _tslib.__assign)({}, defaultProps, componentProps, { - styles: _this._styleCache.merged - })); - } - var styles = mergeComponentStyles(defaultProps.styles, componentProps.styles, shadowConfig); - return _react.createElement(ComposedComponent, (0, _tslib.__assign)({}, defaultProps, componentProps, { - styles: styles - })); - }); - }); - }; - ComponentWithInjectedProps.prototype._onSettingChanged = function() { - this.forceUpdate(); - }; - return ComponentWithInjectedProps; - }(_react.Component), _a.displayName = 'Customized' + scope, _a.contextType = (0, _reactWindowProvider.WindowContext), _a); - return (0, _hoistStatics.hoistStatics)(ComposedComponent, resultClass); - }; -} - -},{"tslib":"9gizs","react":"jGrId","./Customizations":"eQS4T","../hoistStatics":"4OPmM","./CustomizerContext":"aB8eN","@fluentui/merge-styles":"bDG2L","../shadowDom/contexts/MergeStylesShadowRootConsumer":"8fmsO","../dom/getWindow":"aI1a8","@fluentui/react-window-provider":"iP8C0","../memoize":"cqPyR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4OPmM":[function(require,module,exports,__globalThis) { -/** - * Allows you to hoist static functions in components. - * Created for the purpose of fixing broken static functions in classes - * that utilize decorators. - * - * @public - * @param source - The object where the methods are hoisted from. - * @param dest - The object to hoist the methods onto. - * @returns The dest object with methods added - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hoistStatics", ()=>hoistStatics); -function hoistStatics(source, dest) { - for(var name_1 in source)if (source.hasOwnProperty(name_1)) // eslint-disable-next-line @typescript-eslint/no-explicit-any - dest[name_1] = source[name_1]; - return dest; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8fmsO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesShadowRootConsumer", ()=>MergeStylesShadowRootConsumer); -var _mergeStyles = require("@fluentui/merge-styles"); -var _useMergeStylesHooks = require("../hooks/useMergeStylesHooks"); -var _useMergeStylesShadowRoot = require("../hooks/useMergeStylesShadowRoot"); -var MergeStylesShadowRootConsumer = function(_a) { - var stylesheetKey = _a.stylesheetKey, children = _a.children; - var _b = (0, _useMergeStylesHooks.useMergeStylesHooks)(), useAdoptedStylesheetEx = _b.useAdoptedStylesheetEx, useMergeStylesRootStylesheets = _b.useMergeStylesRootStylesheets, useWindow = _b.useWindow; - var shadowCtx = (0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext)(); - var rootMergeStyles = useMergeStylesRootStylesheets(); - var win = useWindow(); - useAdoptedStylesheetEx((0, _mergeStyles.GLOBAL_STYLESHEET_KEY), shadowCtx, rootMergeStyles, win); - useAdoptedStylesheetEx(stylesheetKey, shadowCtx, rootMergeStyles, win); - return children(!!shadowCtx); -}; - -},{"@fluentui/merge-styles":"bDG2L","../hooks/useMergeStylesHooks":"90VFe","../hooks/useMergeStylesShadowRoot":"gp0eP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"90VFe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>useMergeStylesHooks); -var _react = require("react"); -var _mergeStylesDefaultContext = require("../contexts/MergeStylesDefaultContext"); -var useMergeStylesHooks = function() { - var ctx = _react.useContext((0, _mergeStylesDefaultContext.MergeStylesDefaultContext)); - return { - useAdoptedStylesheet: ctx.useAdoptedStylesheet, - useAdoptedStylesheetEx: ctx.useAdoptedStylesheetEx, - useShadowConfig: ctx.useShadowConfig, - useMergeStylesShadowRootContext: ctx.useMergeStylesShadowRootContext, - useHasMergeStylesShadowRootContext: ctx.useHasMergeStylesShadowRootContext, - useMergeStylesRootStylesheets: ctx.useMergeStylesRootStylesheets, - useWindow: ctx.useWindow, - useStyled: ctx.useStyled - }; -}; - -},{"react":"jGrId","../contexts/MergeStylesDefaultContext":"jiC2S","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jiC2S":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "noop", ()=>noop); -parcelHelpers.export(exports, "noopShadow", ()=>noopShadow); -parcelHelpers.export(exports, "noopRootStylesheets", ()=>noopRootStylesheets); -parcelHelpers.export(exports, "noopUndefined", ()=>noopUndefined); -parcelHelpers.export(exports, "getNewContext", ()=>getNewContext); -parcelHelpers.export(exports, "MergeStylesDefaultContext", ()=>MergeStylesDefaultContext); -var _mergeStyles = require("@fluentui/merge-styles"); -var _react = require("react"); -var noop = function() { - return false; -}; -var noopShadow = function() { - return 0, _mergeStyles.DEFAULT_SHADOW_CONFIG; -}; -var noopRootStylesheets = function() { - return new Map(); -}; -var noopUndefined = function() { - return undefined; -}; -var getNewContext = function() { - return { - stylesheets: new Map(), - useAdoptedStylesheetEx: noop, - useAdoptedStylesheet: noop, - useShadowConfig: noopShadow, - useMergeStylesShadowRootContext: noopUndefined, - useHasMergeStylesShadowRootContext: noop, - useMergeStylesRootStylesheets: noopRootStylesheets, - useWindow: noopUndefined, - useStyled: noopUndefined - }; -}; -var MergeStylesDefaultContext = _react.createContext(getNewContext()); - -},{"@fluentui/merge-styles":"bDG2L","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gp0eP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>useHasMergeStylesShadowRootContext); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>useMergeStylesShadowRootContext); -var _react = require("react"); -var _mergeStylesShadowRootContext = require("../contexts/MergeStylesShadowRootContext"); -var useHasMergeStylesShadowRootContext = function() { - return !!useMergeStylesShadowRootContext(); -}; -var useMergeStylesShadowRootContext = function() { - return _react.useContext((0, _mergeStylesShadowRootContext.MergeStylesShadowRootContext)); -}; - -},{"react":"jGrId","../contexts/MergeStylesShadowRootContext":"eqTfx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eqTfx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesShadowRootContext", ()=>MergeStylesShadowRootContext); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>MergeStylesShadowRootProvider); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _useMergeStylesHooks = require("../hooks/useMergeStylesHooks"); -var MergeStylesShadowRootContext = _react.createContext(undefined); -var MergeStylesShadowRootProvider = function(_a) { - var shadowRoot = _a.shadowRoot, props = (0, _tslib.__rest)(_a, [ - "shadowRoot" - ]); - var value = _react.useMemo(function() { - return { - stylesheets: new Map(), - shadowRoot: shadowRoot - }; - }, [ - shadowRoot - ]); - return _react.createElement(MergeStylesShadowRootContext.Provider, (0, _tslib.__assign)({ - value: value - }, props), _react.createElement(GlobalStyles, null), props.children); -}; -var GlobalStyles = function(props) { - var useAdoptedStylesheet = (0, _useMergeStylesHooks.useMergeStylesHooks)().useAdoptedStylesheet; - useAdoptedStylesheet((0, _mergeStyles.GLOBAL_STYLESHEET_KEY)); - return null; -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","../hooks/useMergeStylesHooks":"90VFe","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iP8C0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "WindowContext", ()=>(0, _windowProvider.WindowContext)); -parcelHelpers.export(exports, "useWindow", ()=>(0, _windowProvider.useWindow)); -parcelHelpers.export(exports, "useDocument", ()=>(0, _windowProvider.useDocument)); -parcelHelpers.export(exports, "WindowProvider", ()=>(0, _windowProvider.WindowProvider)); -var _windowProvider = require("./WindowProvider"); -var _version = require("./version"); - -},{"./WindowProvider":"gvsaA","./version":"6NRh1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gvsaA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "WindowContext", ()=>WindowContext); -parcelHelpers.export(exports, "useWindow", ()=>useWindow); -parcelHelpers.export(exports, "useDocument", ()=>useDocument); -parcelHelpers.export(exports, "WindowProvider", ()=>WindowProvider); -var _react = require("react"); -var WindowContext = _react.createContext({ - // eslint-disable-next-line no-restricted-globals - window: typeof window === 'object' ? window : undefined -}); -var useWindow = function() { - return _react.useContext(WindowContext).window; -}; -var useDocument = function() { - var _a; - return (_a = _react.useContext(WindowContext).window) === null || _a === void 0 ? void 0 : _a.document; -}; -var WindowProvider = function(props) { - return _react.createElement(WindowContext.Provider, { - value: props - }, props.children); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6NRh1":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react-window-provider', '2.2.28'); - -},{"@fluentui/set-version":"iqYXf"}],"hUUmS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to get Customizations settings from Customizations singleton or CustomizerContext. - * It will trigger component state update on settings change observed. - */ parcelHelpers.export(exports, "useCustomizationSettings", ()=>useCustomizationSettings); -var _react = require("react"); -var _customizations = require("./Customizations"); -var _customizerContext = require("./CustomizerContext"); -function useCustomizationSettings(properties, scopeName) { - var forceUpdate = useForceUpdate(); - var customizations = _react.useContext((0, _customizerContext.CustomizerContext)).customizations; - var inCustomizerContext = customizations.inCustomizerContext; - _react.useEffect(function() { - if (!inCustomizerContext) (0, _customizations.Customizations).observe(forceUpdate); - return function() { - if (!inCustomizerContext) (0, _customizations.Customizations).unobserve(forceUpdate); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- exclude forceUpdate - }, [ - inCustomizerContext - ]); - return (0, _customizations.Customizations).getSettings(properties, scopeName, customizations); -} -function useForceUpdate() { - var _a = _react.useState(0), setValue = _a[1]; - return function() { - return setValue(function(value) { - return ++value; - }); - }; -} - -},{"react":"jGrId","./Customizations":"eQS4T","./CustomizerContext":"aB8eN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iAatf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Extends a component's lifetime methods by appending new functions to the existing lifetime functions. - */ parcelHelpers.export(exports, "extendComponent", ()=>extendComponent); -var _appendFunction = require("./appendFunction"); -function extendComponent(parent, methods) { - for(var name_1 in methods)if (methods.hasOwnProperty(name_1)) // eslint-disable-next-line @typescript-eslint/no-explicit-any - parent[name_1] = (0, _appendFunction.appendFunction)(parent, parent[name_1], methods[name_1]); -} - -},{"./appendFunction":"8Ic5h","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kDauC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Generates a unique id in the global scope (this spans across duplicate copies of the same library.) - * - * @public - */ parcelHelpers.export(exports, "getId", ()=>getId); -/** - * Resets id counter to an (optional) number. - * - * @public - */ parcelHelpers.export(exports, "resetIds", ()=>resetIds); -var _getWindow = require("./dom/getWindow"); -var _mergeStyles = require("@fluentui/merge-styles"); -// Initialize global window id. -var CURRENT_ID_PROPERTY = '__currentId__'; -var DEFAULT_ID_STRING = 'id__'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -var _global = (0, _getWindow.getWindow)() || {}; -if (_global[CURRENT_ID_PROPERTY] === undefined) _global[CURRENT_ID_PROPERTY] = 0; -var _initializedStylesheetResets = false; -function getId(prefix) { - if (!_initializedStylesheetResets) { - // Configure ids to reset on stylesheet resets. - var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); - if (stylesheet && stylesheet.onReset) stylesheet.onReset(resetIds); - _initializedStylesheetResets = true; - } - var index = _global[CURRENT_ID_PROPERTY]++; - return (prefix === undefined ? DEFAULT_ID_STRING : prefix) + index; -} -function resetIds(counter) { - if (counter === void 0) counter = 0; - _global[CURRENT_ID_PROPERTY] = counter; -} - -},{"./dom/getWindow":"aI1a8","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iMQBc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Given an element tagname and user props, filters the props to only allowed props for the given - * element type. - * @param tagName - Tag name (e.g. "div") - * @param props - Props object - * @param excludedPropNames - List of props to disallow - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "getNativeElementProps", ()=>getNativeElementProps); -var _properties = require("./properties"); -var nativeElementMap = { - label: (0, _properties.labelProperties), - audio: (0, _properties.audioProperties), - video: (0, _properties.videoProperties), - ol: (0, _properties.olProperties), - li: (0, _properties.liProperties), - a: (0, _properties.anchorProperties), - button: (0, _properties.buttonProperties), - input: (0, _properties.inputProperties), - textarea: (0, _properties.textAreaProperties), - select: (0, _properties.selectProperties), - option: (0, _properties.optionProperties), - table: (0, _properties.tableProperties), - tr: (0, _properties.trProperties), - th: (0, _properties.thProperties), - td: (0, _properties.tdProperties), - colGroup: (0, _properties.colGroupProperties), - col: (0, _properties.colProperties), - form: (0, _properties.formProperties), - iframe: (0, _properties.iframeProperties), - img: (0, _properties.imgProperties) -}; -function getNativeElementProps(tagName, props, excludedPropNames) { - var allowedPropNames = tagName && nativeElementMap[tagName] || (0, _properties.htmlElementProperties); - return (0, _properties.getNativeProps)(props, allowedPropNames, excludedPropNames); -} - -},{"./properties":"hUmZ9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hUmZ9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "baseElementEvents", ()=>baseElementEvents); -parcelHelpers.export(exports, "baseElementProperties", ()=>baseElementProperties); -parcelHelpers.export(exports, "htmlElementProperties", ()=>htmlElementProperties); -parcelHelpers.export(exports, "labelProperties", ()=>labelProperties); -parcelHelpers.export(exports, "audioProperties", ()=>audioProperties); -parcelHelpers.export(exports, "videoProperties", ()=>videoProperties); -parcelHelpers.export(exports, "olProperties", ()=>olProperties); -parcelHelpers.export(exports, "liProperties", ()=>liProperties); -parcelHelpers.export(exports, "anchorProperties", ()=>anchorProperties); -parcelHelpers.export(exports, "buttonProperties", ()=>buttonProperties); -parcelHelpers.export(exports, "inputProperties", ()=>inputProperties); -parcelHelpers.export(exports, "textAreaProperties", ()=>textAreaProperties); -parcelHelpers.export(exports, "selectProperties", ()=>selectProperties); -parcelHelpers.export(exports, "optionProperties", ()=>optionProperties); -parcelHelpers.export(exports, "tableProperties", ()=>tableProperties); -parcelHelpers.export(exports, "trProperties", ()=>trProperties); -parcelHelpers.export(exports, "thProperties", ()=>thProperties); -parcelHelpers.export(exports, "tdProperties", ()=>tdProperties); -parcelHelpers.export(exports, "colGroupProperties", ()=>colGroupProperties); -parcelHelpers.export(exports, "colProperties", ()=>colProperties); -parcelHelpers.export(exports, "formProperties", ()=>formProperties); -parcelHelpers.export(exports, "iframeProperties", ()=>iframeProperties); -parcelHelpers.export(exports, "imgProperties", ()=>imgProperties); -parcelHelpers.export(exports, "imageProperties", ()=>imageProperties); -parcelHelpers.export(exports, "divProperties", ()=>divProperties); -/** - * Gets native supported props for an html element provided the allowance set. Use one of the property - * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given - * props set. Note that all data- and aria- prefixed attributes will be allowed. - * NOTE: getNativeProps should always be applied first when adding props to a react component. The - * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props. - * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to - * the component after an onClick function is added, then the getNativeProps onClick will override it. - * - * @public - * @param props - The unfiltered input props - * @param allowedPropsNames - The array or record of allowed prop names. - * @returns The filtered props - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "getNativeProps", ()=>getNativeProps); -var toObjectMap = function() { - var items = []; - for(var _i = 0; _i < arguments.length; _i++)items[_i] = arguments[_i]; - var result = {}; - for(var _a = 0, items_1 = items; _a < items_1.length; _a++){ - var item = items_1[_a]; - var keys = Array.isArray(item) ? item : Object.keys(item); - for(var _b = 0, keys_1 = keys; _b < keys_1.length; _b++){ - var key = keys_1[_b]; - result[key] = 1; - } + } + var RTL_LOCAL_STORAGE_KEY = "isRTL"; + var _isRTL; + function getRTL(theme) { + if (theme === void 0) { + theme = {}; + } + if (theme.rtl !== void 0) { + return theme.rtl; + } + if (_isRTL === void 0) { + var savedRTL = getItem$1(RTL_LOCAL_STORAGE_KEY); + if (savedRTL !== null) { + _isRTL = savedRTL === "1"; + setRTL(_isRTL); + } + var doc = getDocument(); + if (_isRTL === void 0 && doc) { + _isRTL = (doc.body && doc.body.getAttribute("dir") || doc.documentElement.getAttribute("dir")) === "rtl"; + setRTL$1(_isRTL); + } } - return result; -}; -var baseElementEvents = toObjectMap([ - 'onCopy', - 'onCut', - 'onPaste', - 'onCompositionEnd', - 'onCompositionStart', - 'onCompositionUpdate', - 'onFocus', - 'onFocusCapture', - 'onBlur', - 'onBlurCapture', - 'onChange', - 'onInput', - 'onSubmit', - 'onLoad', - 'onError', - 'onKeyDown', - 'onKeyDownCapture', - 'onKeyPress', - 'onKeyUp', - 'onAbort', - 'onCanPlay', - 'onCanPlayThrough', - 'onDurationChange', - 'onEmptied', - 'onEncrypted', - 'onEnded', - 'onLoadedData', - 'onLoadedMetadata', - 'onLoadStart', - 'onPause', - 'onPlay', - 'onPlaying', - 'onProgress', - 'onRateChange', - 'onSeeked', - 'onSeeking', - 'onStalled', - 'onSuspend', - 'onTimeUpdate', - 'onVolumeChange', - 'onWaiting', - 'onClick', - 'onClickCapture', - 'onContextMenu', - 'onDoubleClick', - 'onDrag', - 'onDragEnd', - 'onDragEnter', - 'onDragExit', - 'onDragLeave', - 'onDragOver', - 'onDragStart', - 'onDrop', - 'onMouseDown', - 'onMouseDownCapture', - 'onMouseEnter', - 'onMouseLeave', - 'onMouseMove', - 'onMouseOut', - 'onMouseOver', - 'onMouseUp', - 'onMouseUpCapture', - 'onSelect', - 'onTouchCancel', - 'onTouchEnd', - 'onTouchMove', - 'onTouchStart', - 'onScroll', - 'onWheel', - 'onPointerCancel', - 'onPointerDown', - 'onPointerEnter', - 'onPointerLeave', - 'onPointerMove', - 'onPointerOut', - 'onPointerOver', - 'onPointerUp', - 'onGotPointerCapture', - 'onLostPointerCapture' -]); -var baseElementProperties = toObjectMap([ - 'accessKey', - 'children', - 'className', - 'contentEditable', - 'dir', - 'draggable', - 'hidden', - 'htmlFor', - 'id', - 'lang', - 'ref', - 'role', - 'style', - 'tabIndex', - 'title', - 'translate', - 'spellCheck', - 'name' -]); -var htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents); -var labelProperties = toObjectMap(htmlElementProperties, [ - 'form' -]); -var audioProperties = toObjectMap(htmlElementProperties, [ - 'height', - 'loop', - 'muted', - 'preload', - 'src', - 'width' -]); -var videoProperties = toObjectMap(audioProperties, [ - 'poster' -]); -var olProperties = toObjectMap(htmlElementProperties, [ - 'start' -]); -var liProperties = toObjectMap(htmlElementProperties, [ - 'value' -]); -var anchorProperties = toObjectMap(htmlElementProperties, [ - 'download', - 'href', - 'hrefLang', - 'media', - 'rel', - 'target', - 'type' -]); -var buttonProperties = toObjectMap(htmlElementProperties, [ - 'autoFocus', - 'disabled', - 'form', - 'formAction', - 'formEncType', - 'formMethod', - 'formNoValidate', - 'formTarget', - 'type', - 'value' -]); -var inputProperties = toObjectMap(buttonProperties, [ - 'accept', - 'alt', - 'autoCapitalize', - 'autoComplete', - 'checked', - 'dirname', - 'form', - 'height', - 'inputMode', - 'list', - 'max', - 'maxLength', - 'min', - 'minLength', - 'multiple', - 'pattern', - 'placeholder', - 'readOnly', - 'required', - 'src', - 'step', - 'size', - 'type', - 'value', - 'width' -]); -var textAreaProperties = toObjectMap(buttonProperties, [ - 'autoCapitalize', - 'cols', - 'dirname', - 'form', - 'maxLength', - 'minLength', - 'placeholder', - 'readOnly', - 'required', - 'rows', - 'wrap' -]); -var selectProperties = toObjectMap(buttonProperties, [ - 'form', - 'multiple', - 'required' -]); -var optionProperties = toObjectMap(htmlElementProperties, [ - 'selected', - 'value' -]); -var tableProperties = toObjectMap(htmlElementProperties, [ - 'cellPadding', - 'cellSpacing' -]); -var trProperties = htmlElementProperties; -var thProperties = toObjectMap(htmlElementProperties, [ - 'rowSpan', - 'scope' -]); -var tdProperties = toObjectMap(htmlElementProperties, [ - 'colSpan', - 'headers', - 'rowSpan', - 'scope' -]); -var colGroupProperties = toObjectMap(htmlElementProperties, [ - 'span' -]); -var colProperties = toObjectMap(htmlElementProperties, [ - 'span' -]); -var formProperties = toObjectMap(htmlElementProperties, [ - 'acceptCharset', - 'action', - 'encType', - 'encType', - 'method', - 'noValidate', - 'target' -]); -var iframeProperties = toObjectMap(htmlElementProperties, [ - 'allow', - 'allowFullScreen', - 'allowPaymentRequest', - 'allowTransparency', - 'csp', - 'height', - 'importance', - 'referrerPolicy', - 'sandbox', - 'src', - 'srcDoc', - 'width' -]); -var imgProperties = toObjectMap(htmlElementProperties, [ - 'alt', - 'crossOrigin', - 'height', - 'src', - 'srcSet', - 'useMap', - 'width' -]); -var imageProperties = imgProperties; -var divProperties = htmlElementProperties; -function getNativeProps(// eslint-disable-next-line @typescript-eslint/no-explicit-any -props, allowedPropNames, excludedPropNames) { - // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for - // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings. - // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then - // return native props. - // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797 - var isArray = Array.isArray(allowedPropNames); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var result = {}; - var keys = Object.keys(props); - for(var _i = 0, keys_2 = keys; _i < keys_2.length; _i++){ - var key = keys_2[_i]; - var isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0; - if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) // eslint-disable-next-line @typescript-eslint/no-explicit-any - result[key] = props[key]; + return !!_isRTL; + } + function setRTL(isRTL, persistSetting) { + if (persistSetting === void 0) { + persistSetting = false; } - return result; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49HjY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Allows you to hoist methods, except those in an exclusion set from a source object into a destination object. - * - * @public - * @param destination - The instance of the object to hoist the methods onto. - * @param source - The instance of the object where the methods are hoisted from. - * @param exclusions - (Optional) What methods to exclude from being hoisted. - * @returns An array of names of methods that were hoisted. - */ parcelHelpers.export(exports, "hoistMethods", ()=>hoistMethods); -/** - * Provides a method for convenience to unhoist hoisted methods. - * - * @public - * @param source - The source object upon which methods were hoisted. - * @param methodNames - An array of method names to unhoist. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "unhoistMethods", ()=>unhoistMethods); -var REACT_LIFECYCLE_EXCLUSIONS = [ - 'setState', - 'render', - 'componentWillMount', - 'UNSAFE_componentWillMount', - 'componentDidMount', - 'componentWillReceiveProps', - 'UNSAFE_componentWillReceiveProps', - 'shouldComponentUpdate', - 'componentWillUpdate', - 'getSnapshotBeforeUpdate', - 'UNSAFE_componentWillUpdate', - 'componentDidUpdate', - 'componentWillUnmount' -]; -function hoistMethods(// eslint-disable-next-line @typescript-eslint/no-explicit-any -destination, // eslint-disable-next-line @typescript-eslint/no-explicit-any -source, exclusions) { - if (exclusions === void 0) exclusions = REACT_LIFECYCLE_EXCLUSIONS; - var hoisted = []; - var _loop_1 = function(methodName) { - if (typeof source[methodName] === 'function' && destination[methodName] === undefined && (!exclusions || exclusions.indexOf(methodName) === -1)) { - hoisted.push(methodName); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - destination[methodName] = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - source[methodName].apply(source, args); - }; - } - }; - for(var methodName in source)_loop_1(methodName); - return hoisted; -} -function unhoistMethods(source, methodNames) { - methodNames.forEach(function(methodName) { - return delete source[methodName]; - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8tu37":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to manage componentRef resolution. Internally appends logic to - * lifetime methods to resolve componentRef to the passed in object. - * - * Usage: call initializeComponentRef(this) in the constructor, - */ parcelHelpers.export(exports, "initializeComponentRef", ()=>initializeComponentRef); -var _extendComponent = require("./extendComponent"); -function initializeComponentRef(obj) { - (0, _extendComponent.extendComponent)(obj, { - componentDidMount: _onMount, - componentDidUpdate: _onUpdate, - componentWillUnmount: _onUnmount - }); -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _onMount() { - _setComponentRef(this.props.componentRef, this); -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _onUpdate(prevProps) { - if (prevProps.componentRef !== this.props.componentRef) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _setComponentRef(prevProps.componentRef, null); - _setComponentRef(this.props.componentRef, this); + var doc = getDocument(); + if (doc) { + doc.documentElement.setAttribute("dir", isRTL ? "rtl" : "ltr"); } -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _onUnmount() { - _setComponentRef(this.props.componentRef, null); -} -function _setComponentRef(componentRef, value) { - if (componentRef) { - if (typeof componentRef === 'object') componentRef.current = value; - else if (typeof componentRef === 'function') componentRef(value); - } -} - -},{"./extendComponent":"iAatf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lLcL3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Initializes the logic which: - * - * 1. Subscribes keydown and mousedown events. (It will only do it once per window, - * so it's safe to call this method multiple times.) - * 2. When the user presses directional keyboard keys, adds the 'ms-Fabric--isFocusVisible' classname - * to the document body, removes the 'ms-Fabric-isFocusHidden' classname. - * 3. When the user clicks a mouse button, adds the 'ms-Fabric-isFocusHidden' classname to the - * document body, removes the 'ms-Fabric--isFocusVisible' classname. - * - * This logic allows components on the page to conditionally render focus treatments based on - * the existence of global classnames, which simplifies logic overall. - * - * @param window - the window used to add the event listeners - * @deprecated Use useFocusRects hook or FocusRects component instead. - */ parcelHelpers.export(exports, "initializeFocusRects", ()=>initializeFocusRects); -var _getWindow = require("./dom/getWindow"); -var _keyboard = require("./keyboard"); -var _setFocusVisibility = require("./setFocusVisibility"); -function initializeFocusRects(window) { - var _a; - var win = window || (0, _getWindow.getWindow)(); - if (!win || ((_a = win.FabricConfig) === null || _a === void 0 ? void 0 : _a.disableFocusRects) === true) return; - if (!win.__hasInitializeFocusRects__) { - win.__hasInitializeFocusRects__ = true; - win.addEventListener('mousedown', _onMouseDown, true); - win.addEventListener('pointerdown', _onPointerDown, true); - win.addEventListener('keydown', _onKeyDown, true); - } -} -function _onMouseDown(ev) { - (0, _setFocusVisibility.setFocusVisibility)(false, ev.target); -} -function _onPointerDown(ev) { - if (ev.pointerType !== 'mouse') (0, _setFocusVisibility.setFocusVisibility)(false, ev.target); -} -function _onKeyDown(ev) { - // eslint-disable-next-line deprecation/deprecation - (0, _keyboard.isDirectionalKeyCode)(ev.which) && (0, _setFocusVisibility.setFocusVisibility)(true, ev.target); -} - -},{"./dom/getWindow":"aI1a8","./keyboard":"1QqA5","./setFocusVisibility":"2d3GF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1QqA5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Returns true if the keycode is a directional keyboard key. - */ parcelHelpers.export(exports, "isDirectionalKeyCode", ()=>isDirectionalKeyCode); -/** - * Adds a keycode to the list of keys that, when pressed, should cause the focus outlines to be visible. - * This can be used to add global shortcut keys that directionally move from section to section within - * an app or between focus trap zones. - */ parcelHelpers.export(exports, "addDirectionalKeyCode", ()=>addDirectionalKeyCode); -/** - * Removes a keycode to the list of keys that, when pressed, should cause the focus outlines to be visible. - * This can be used to remove global shortcut keys that directionally move from section to section within - * an app or between focus trap zones. - */ parcelHelpers.export(exports, "removeDirectionalKeyCode", ()=>removeDirectionalKeyCode); -var _keyCodes = require("./KeyCodes"); -var _a; -var DirectionalKeyCodes = (_a = {}, _a[(0, _keyCodes.KeyCodes).up] = 1, _a[(0, _keyCodes.KeyCodes).down] = 1, _a[(0, _keyCodes.KeyCodes).left] = 1, _a[(0, _keyCodes.KeyCodes).right] = 1, _a[(0, _keyCodes.KeyCodes).home] = 1, _a[(0, _keyCodes.KeyCodes).end] = 1, _a[(0, _keyCodes.KeyCodes).tab] = 1, _a[(0, _keyCodes.KeyCodes).pageUp] = 1, _a[(0, _keyCodes.KeyCodes).pageDown] = 1, _a); -function isDirectionalKeyCode(which) { - return !!DirectionalKeyCodes[which]; -} -function addDirectionalKeyCode(which) { - DirectionalKeyCodes[which] = 1; -} -function removeDirectionalKeyCode(which) { - delete DirectionalKeyCodes[which]; -} - -},{"./KeyCodes":"eQoHk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2d3GF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IsFocusVisibleClassName", ()=>IsFocusVisibleClassName); -parcelHelpers.export(exports, "IsFocusHiddenClassName", ()=>IsFocusHiddenClassName); -/** - * Sets the visibility of focus styling. - * - * By default, focus styles (the box surrounding a focused Button, for example) only show up when navigational - * keypresses occur (through Tab, arrows, PgUp/PgDn, Home and End), and are hidden when mouse interactions occur. - * This API provides an imperative way to turn them on/off. - * - * A use case might be when you have a keypress like ctrl-f6 navigate to a particular region on the page, - * and want focus to show up. - * - * @param enabled - Whether to turn focus visibility on or off. - * @param target - Optional target from which to get window in case no `providerElem` has been specified. - * @param registeredProviders - Array of provider refs that are associated with a FocusRectsProvider. If no array - * is passed in, the classnames are attached to the document body that contains `target`. - */ parcelHelpers.export(exports, "setFocusVisibility", ()=>setFocusVisibility); -var _getWindow = require("./dom/getWindow"); -var IsFocusVisibleClassName = 'ms-Fabric--isFocusVisible'; -var IsFocusHiddenClassName = 'ms-Fabric--isFocusHidden'; -function updateClassList(el, enabled) { - if (el) { - el.classList.add(enabled ? IsFocusVisibleClassName : IsFocusHiddenClassName); - el.classList.remove(enabled ? IsFocusHiddenClassName : IsFocusVisibleClassName); - } -} -function setFocusVisibility(enabled, target, registeredProviders) { - var _a; - if (registeredProviders) registeredProviders.forEach(function(ref) { - return updateClassList(ref.current, enabled); - }); - else updateClassList((_a = (0, _getWindow.getWindow)(target)) === null || _a === void 0 ? void 0 : _a.document.body, enabled); -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Mxbq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusRectsProvider", ()=>FocusRectsProvider); -var _react = require("react"); -var _useFocusRects = require("./useFocusRects"); -var FocusRectsProvider = function(props) { - var providerRef = props.providerRef, layerRoot = props.layerRoot; - var registeredProviders = _react.useState([])[0]; - var parentContext = _react.useContext((0, _useFocusRects.FocusRectsContext)); - // Inherit the parent context if it exists, unless this is a layer root. - // This allows the topmost provider element in the DOM tree to handle the focus events. - // Since layers are in a separate HTML tree from their parent, they shouldn't use the parent's providerRef. - var inheritParentContext = parentContext !== undefined && !layerRoot; - var context = _react.useMemo(function() { - return inheritParentContext ? undefined : { - providerRef: providerRef, - registeredProviders: registeredProviders, - registerProvider: function(ref) { - // Register this child provider with the current context, and any parent contexts - registeredProviders.push(ref); - parentContext === null || parentContext === void 0 || parentContext.registerProvider(ref); - }, - unregisterProvider: function(ref) { - parentContext === null || parentContext === void 0 || parentContext.unregisterProvider(ref); - var i = registeredProviders.indexOf(ref); - if (i >= 0) registeredProviders.splice(i, 1); - } - }; - }, [ - providerRef, - registeredProviders, - parentContext, - inheritParentContext - ]); - _react.useEffect(function() { - if (context) { - context.registerProvider(context.providerRef); - return function() { - return context.unregisterProvider(context.providerRef); - }; - } - }, [ - context - ]); - // Create a new context provider if this is not inheriting from the parent. - if (context) return _react.createElement((0, _useFocusRects.FocusRectsContext).Provider, { - value: context - }, props.children); - else return _react.createElement(_react.Fragment, null, props.children); -}; - -},{"react":"jGrId","./useFocusRects":"hYOqE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hYOqE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusRectsContext", ()=>FocusRectsContext); -/** - * Initializes the logic which: - * - * 1. Subscribes keydown, keyup, mousedown and pointerdown events. (It will only do it once for the current element of - * the FocusRectsContext providerRef or once per window if no such element is provided via context, so it's safe to - * call this method multiple times.) - * 2. When the user presses triggers a keydown or keyup event via directional keyboard keys, adds the - * 'ms-Fabric--isFocusVisible' classname to the current element of the FocusRectsContext providerRef or the document - * body if no such element is provided via context, and removes the 'ms-Fabric-isFocusHidden' classname. - * 3. When the user triggers a mousedown or pointerdown event, adds the 'ms-Fabric-isFocusHidden' classname to the - * current element of the FocusRectsContext providerRef or the document body if no such element is provided via - * context, and removes the 'ms-Fabric--isFocusVisible' classname. - * - * This logic allows components on the page to conditionally render focus treatments based on - * the existence of global classnames, which simplifies logic overall. - * - * @param rootRef - A Ref object. Focus rectangle can be applied on itself and all its children. - */ parcelHelpers.export(exports, "useFocusRects", ()=>useFocusRects); -parcelHelpers.export(exports, "FocusRects", ()=>FocusRects); -var _react = require("react"); -var _getWindow = require("./dom/getWindow"); -var _keyboard = require("./keyboard"); -var _setFocusVisibility = require("./setFocusVisibility"); -var mountCounters = new WeakMap(); -var callbackMap = new WeakMap(); -function setMountCounters(key, delta) { - var newValue; - var currValue = mountCounters.get(key); - if (currValue) newValue = currValue + delta; - else newValue = 1; - mountCounters.set(key, newValue); - return newValue; -} -function setCallbackMap(context) { - var callbacks = callbackMap.get(context); - if (callbacks) return callbacks; - var onMouseDown = function(ev) { - return _onMouseDown(ev, context.registeredProviders); - }; - var onPointerDown = function(ev) { - return _onPointerDown(ev, context.registeredProviders); - }; - var onKeyDown = function(ev) { - return _onKeyDown(ev, context.registeredProviders); - }; - var onKeyUp = function(ev) { - return _onKeyUp(ev, context.registeredProviders); - }; - callbacks = { - onMouseDown: onMouseDown, - onPointerDown: onPointerDown, - onKeyDown: onKeyDown, - onKeyUp: onKeyUp - }; - callbackMap.set(context, callbacks); - return callbacks; -} -var FocusRectsContext = _react.createContext(undefined); -function useFocusRects(rootRef) { - var context = _react.useContext(FocusRectsContext); - _react.useEffect(function() { - var _a, _b, _c, _d; - var win = (0, _getWindow.getWindow)(rootRef === null || rootRef === void 0 ? void 0 : rootRef.current); - if (!win || ((_a = win.FabricConfig) === null || _a === void 0 ? void 0 : _a.disableFocusRects) === true) return undefined; - var el = win; - var onMouseDown; - var onPointerDown; - var onKeyDown; - var onKeyUp; - if (((_b = context === null || context === void 0 ? void 0 : context.providerRef) === null || _b === void 0 ? void 0 : _b.current) && ((_d = (_c = context === null || context === void 0 ? void 0 : context.providerRef) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.addEventListener)) { - el = context.providerRef.current; - // The NOINLINE directive tells terser not to move the setCallbackMap implementation into the call site during - // minification. - // This prevents the function from capturing additional variables in the closure, which can cause memory leaks. - var callbacks = /*@__NOINLINE__*/ setCallbackMap(context); - onMouseDown = callbacks.onMouseDown; - onPointerDown = callbacks.onPointerDown; - onKeyDown = callbacks.onKeyDown; - onKeyUp = callbacks.onKeyUp; - } else { - onMouseDown = _onMouseDown; - onPointerDown = _onPointerDown; - onKeyDown = _onKeyDown; - onKeyUp = _onKeyUp; - } - var count = setMountCounters(el, 1); - if (count <= 1) { - el.addEventListener('mousedown', onMouseDown, true); - el.addEventListener('pointerdown', onPointerDown, true); - el.addEventListener('keydown', onKeyDown, true); - el.addEventListener('keyup', onKeyUp, true); - } - return function() { - var _a; - if (!win || ((_a = win.FabricConfig) === null || _a === void 0 ? void 0 : _a.disableFocusRects) === true) return; - count = setMountCounters(el, -1); - if (count === 0) { - el.removeEventListener('mousedown', onMouseDown, true); - el.removeEventListener('pointerdown', onPointerDown, true); - el.removeEventListener('keydown', onKeyDown, true); - el.removeEventListener('keyup', onKeyUp, true); - } - }; - }, [ - context, - rootRef - ]); -} -var FocusRects = function(props) { - useFocusRects(props.rootRef); - return null; -}; -function _onMouseDown(ev, registeredProviders) { - (0, _setFocusVisibility.setFocusVisibility)(false, ev.target, registeredProviders); -} -function _onPointerDown(ev, registeredProviders) { - if (ev.pointerType !== 'mouse') (0, _setFocusVisibility.setFocusVisibility)(false, ev.target, registeredProviders); -} -// You need both a keydown and a keyup listener that sets focus visibility to true to handle two distinct scenarios when -// attaching the listeners and classnames to the provider instead of the document body. -// If you only have a keydown listener, then the focus rectangles will not show when moving from outside of the provider -// to inside it. That is why a keyup listener is needed, since it will always trigger after the focus event is fired. -// If you only have a keyup listener, then the focus rectangles will not show moving between different tabbable elements -// if the tab key is pressed without being released. That's is why we need a keydown listener, since it will trigger for -// every element that is being tabbed into. -// This works because `classList.add` is smart and will not duplicate a classname that already exists on the classList -// when focus visibility is turned on. -function _onKeyDown(ev, registeredProviders) { - // eslint-disable-next-line deprecation/deprecation - if ((0, _keyboard.isDirectionalKeyCode)(ev.which)) (0, _setFocusVisibility.setFocusVisibility)(true, ev.target, registeredProviders); -} -function _onKeyUp(ev, registeredProviders) { - // eslint-disable-next-line deprecation/deprecation - if ((0, _keyboard.isDirectionalKeyCode)(ev.which)) (0, _setFocusVisibility.setFocusVisibility)(true, ev.target, registeredProviders); -} - -},{"react":"jGrId","./dom/getWindow":"aI1a8","./keyboard":"1QqA5","./setFocusVisibility":"2d3GF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6G2ZZ":[function(require,module,exports,__globalThis) { -/** - * Regular expressions matching characters to ignore when calculating the initials. - */ /** - * Regular expression matching characters within various types of enclosures, including the enclosures themselves - * so for example, (xyz) [xyz] {xyz} <xyz> all would be ignored - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Get (up to 2 characters) initials based on display name of the persona. - * - * @public - */ parcelHelpers.export(exports, "getInitials", ()=>getInitials); -var UNWANTED_ENCLOSURES_REGEX = /[\(\[\{\<][^\)\]\}\>]*[\)\]\}\>]/g; -/** - * Regular expression matching special ASCII characters except space, plus some unicode special characters. - * Applies after unwanted enclosures have been removed - */ var UNWANTED_CHARS_REGEX = /[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g; -/** - * Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed - * and number has been trimmed for whitespaces - */ var PHONENUMBER_REGEX = /^\d+[\d\s]*(:?ext|x|)\s*\d+$/i; -/** Regular expression matching one or more spaces. */ var MULTIPLE_WHITESPACES_REGEX = /\s+/g; -/** - * Regular expression matching languages for which we currently don't support initials. - * Arabic: Arabic, Arabic Supplement, Arabic Extended-A. - * Korean: Hangul Jamo, Hangul Compatibility Jamo, Hangul Jamo Extended-A, Hangul Syllables, Hangul Jamo Extended-B. - * Japanese: Hiragana, Katakana. - * CJK: CJK Unified Ideographs Extension A, CJK Unified Ideographs, CJK Compatibility Ideographs, - * CJK Unified Ideographs Extension B - */ var UNSUPPORTED_TEXT_REGEX = // eslint-disable-next-line @fluentui/max-len -/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD869][\uDC00-\uDED6]/; -function getInitialsLatin(displayName, isRtl) { - var initials = ''; - var splits = displayName.split(' '); - if (splits.length === 2) { - initials += splits[0].charAt(0).toUpperCase(); - initials += splits[1].charAt(0).toUpperCase(); - } else if (splits.length === 3) { - initials += splits[0].charAt(0).toUpperCase(); - initials += splits[2].charAt(0).toUpperCase(); - } else if (splits.length !== 0) initials += splits[0].charAt(0).toUpperCase(); - if (isRtl && initials.length > 1) return initials.charAt(1) + initials.charAt(0); - return initials; -} -function cleanupDisplayName(displayName) { - displayName = displayName.replace(UNWANTED_ENCLOSURES_REGEX, ''); - displayName = displayName.replace(UNWANTED_CHARS_REGEX, ''); - displayName = displayName.replace(MULTIPLE_WHITESPACES_REGEX, ' '); - displayName = displayName.trim(); - return displayName; -} -function getInitials(displayName, isRtl, allowPhoneInitials) { - if (!displayName) return ''; - displayName = cleanupDisplayName(displayName); - // For names containing CJK characters, and phone numbers, we don't display initials - if (UNSUPPORTED_TEXT_REGEX.test(displayName) || !allowPhoneInitials && PHONENUMBER_REGEX.test(displayName)) return ''; - return getInitialsLatin(displayName, isRtl); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7welB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the language set for the page. - * @param persistenceType - Where to persist the value. Default is `sessionStorage` if available. - */ parcelHelpers.export(exports, "getLanguage", ()=>getLanguage); -parcelHelpers.export(exports, "setLanguage", ()=>setLanguage); -var _getDocument = require("./dom/getDocument"); -var _localStorage = require("./localStorage"); -var _sessionStorage = require("./sessionStorage"); -// Default to undefined so that we initialize on first read. -var _language; -var STORAGE_KEY = 'language'; -function getLanguage(persistenceType) { - if (persistenceType === void 0) persistenceType = 'sessionStorage'; - if (_language === undefined) { - var doc = (0, _getDocument.getDocument)(); - var savedLanguage = persistenceType === 'localStorage' ? _localStorage.getItem(STORAGE_KEY) : persistenceType === 'sessionStorage' ? _sessionStorage.getItem(STORAGE_KEY) : undefined; - if (savedLanguage) _language = savedLanguage; - if (_language === undefined && doc) _language = doc.documentElement.getAttribute('lang'); - if (_language === undefined) _language = 'en'; + if (persistSetting) { + setItem(RTL_LOCAL_STORAGE_KEY, isRTL ? "1" : "0"); } - return _language; -} -function setLanguage(language, persistenceParam) { - var doc = (0, _getDocument.getDocument)(); - if (doc) doc.documentElement.setAttribute('lang', language); - var persistenceType = persistenceParam === true ? 'none' : !persistenceParam ? 'sessionStorage' : persistenceParam; - if (persistenceType === 'localStorage') _localStorage.setItem(STORAGE_KEY, language); - else if (persistenceType === 'sessionStorage') _sessionStorage.setItem(STORAGE_KEY, language); - _language = language; -} - -},{"./dom/getDocument":"7EOu7","./localStorage":"3NE8f","./sessionStorage":"fAeWE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3NE8f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Fetches an item from local storage without throwing an exception - * @param key The key of the item to fetch from local storage - */ parcelHelpers.export(exports, "getItem", ()=>getItem); -/** - * Inserts an item into local storage without throwing an exception - * @param key The key of the item to add to local storage - * @param data The data to put into local storage - */ parcelHelpers.export(exports, "setItem", ()=>setItem); -var _getWindow = require("./dom/getWindow"); -function getItem(key) { - var result = null; - try { - var win = (0, _getWindow.getWindow)(); - result = win ? win.localStorage.getItem(key) : null; - } catch (e) { - /* Eat the exception */ } - return result; -} -function setItem(key, data) { - try { - var win = (0, _getWindow.getWindow)(); - win && win.localStorage.setItem(key, data); - } catch (e) { - /* Eat the exception */ } -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9UcDS":[function(require,module,exports,__globalThis) { -/** - * Determines the distance between two points. - * - * @public - */ /* eslint-disable deprecation/deprecation */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getDistanceBetweenPoints", ()=>getDistanceBetweenPoints); -/** - * Produces a proportionally-scaled version of an input content size when fit to a bounding size. - * Given a `contentSize` and a `boundsSize`, this function scales `contentSize` proportionally - * using either `contain` or `cover` fit behaviors. - * Use this function to pre-calculate the layout for the CSS `object-fit` and `background-fit` behaviors. - * With `contain`, the output size must be the largest it can be while completely within the `boundsSize`. - * With `cover`, the output size must be the smallest it can be while completely around the `boundsSize`. - * By default, there is a `maxScale` value of 1, which prevents the `contentSize` from being scaled larger. - * - * @param options - the options for the bounds fit operation - */ parcelHelpers.export(exports, "fitContentToBounds", ()=>fitContentToBounds); -/** - * Calculates a number's precision based on the number of trailing - * zeros if the number does not have a decimal indicated by a negative - * precision. Otherwise, it calculates the number of digits after - * the decimal point indicated by a positive precision. - * @param value - the value to determine the precision of - */ parcelHelpers.export(exports, "calculatePrecision", ()=>calculatePrecision); -/** - * Rounds a number to a certain level of precision. Accepts negative precision. - * @param value - The value that is being rounded. - * @param precision - The number of decimal places to round the number to - */ parcelHelpers.export(exports, "precisionRound", ()=>precisionRound); -function getDistanceBetweenPoints(point1, point2) { - var left1 = point1.left || point1.x || 0; - var top1 = point1.top || point1.y || 0; - var left2 = point2.left || point2.x || 0; - var top2 = point2.top || point2.y || 0; - /* eslint-enable deprecation/deprecation */ var distance = Math.sqrt(Math.pow(left1 - left2, 2) + Math.pow(top1 - top2, 2)); - return distance; -} -function fitContentToBounds(options) { - var contentSize = options.contentSize, boundsSize = options.boundsSize, _a = options.mode, mode = _a === void 0 ? 'contain' : _a, _b = options.maxScale, maxScale = _b === void 0 ? 1 : _b; - var contentAspectRatio = contentSize.width / contentSize.height; - var boundsAspectRatio = boundsSize.width / boundsSize.height; - var scale; - if (mode === 'contain' ? contentAspectRatio > boundsAspectRatio : contentAspectRatio < boundsAspectRatio) scale = boundsSize.width / contentSize.width; - else scale = boundsSize.height / contentSize.height; - var finalScale = Math.min(maxScale, scale); - return { - width: contentSize.width * finalScale, - height: contentSize.height * finalScale - }; -} -function calculatePrecision(value) { - /** - * Group 1: - * [1-9]([0]+$) matches trailing zeros - * Group 2: - * \.([0-9]*) matches all digits after a decimal point. - */ var groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value)); - if (!groups) return 0; - if (groups[1]) return -groups[1].length; - if (groups[2]) return groups[2].length; - return 0; -} -function precisionRound(value, precision, base) { - if (base === void 0) base = 10; - var exp = Math.pow(base, precision); - return Math.round(value * exp) / exp; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"43b5Z":[function(require,module,exports,__globalThis) { -/** - * Simple deep merge function. Takes all arguments and returns a deep copy of the objects merged - * together in the order provided. If an object creates a circular reference, it will assign the - * original reference. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "merge", ()=>merge); -function merge(target) { - var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - for(var _a = 0, args_1 = args; _a < args_1.length; _a++){ - var arg = args_1[_a]; - _merge(target || {}, arg); - } - return target; -} -/** - * The _merge helper iterates through all props on source and assigns them to target. - * When the value is an object, we will create a deep clone of the object. However if - * there is a circular reference, the value will not be deep cloned and will persist - * the reference. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -function _merge(target, source, circularReferences) { - if (circularReferences === void 0) circularReferences = []; - circularReferences.push(source); - for(var name_1 in source){ - if (source.hasOwnProperty(name_1)) { - if (name_1 !== '__proto__' && name_1 !== 'constructor' && name_1 !== 'prototype') { - var value = source[name_1]; - if (typeof value === 'object' && value !== null && !Array.isArray(value)) { - var isCircularReference = circularReferences.indexOf(value) > -1; - target[name_1] = isCircularReference ? value : _merge(target[name_1] || {}, value, circularReferences); - } else target[name_1] = value; - } - } + _isRTL = isRTL; + setRTL$1(_isRTL); + } + function getRTLSafeKeyCode(key2, theme) { + if (theme === void 0) { + theme = {}; } - circularReferences.pop(); - return target; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ucFx":[function(require,module,exports,__globalThis) { -/** - * Returns true if and only if the user is on a iOS device. - * Used to determine whether iOS-specific behavior should be applied. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isIOS", ()=>isIOS); -var isIOS = function() { - // eslint-disable-next-line no-restricted-globals - if (!window || !window.navigator || !window.navigator.userAgent) return false; - // eslint-disable-next-line no-restricted-globals - return /iPad|iPhone|iPod/i.test(window.navigator.userAgent); -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8iyQK":[function(require,module,exports,__globalThis) { -/** - * The helper functions here will make the target element as modal to screen readers, by placing aria-hidden on elements - * that are siblings to the target element and the target element's ancestors (because aria-hidden gets inherited). - * That way, all other elements on the page are hidden to the screen reader. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Call this on a target element to make it modal to screen readers. - * Returns a function that undoes the changes it made. - */ parcelHelpers.export(exports, "modalize", ()=>modalize); -var _getDocument = require("./dom/getDocument"); -/** Tag names to ignore when modalizing */ var tagsToIgnore = [ - 'TEMPLATE', - 'STYLE', - 'SCRIPT' -]; -function modalize(target) { - var targetDocument = (0, _getDocument.getDocument)(target); - if (!targetDocument) // can't do this in SSR - return function() { - return undefined; - }; - var affectedNodes = []; - // start at target, then recurse and do the same for parent, until we reach <body> - while(target !== targetDocument.body && target.parentElement){ - // grab all siblings of current element - for(var _i = 0, _a = target.parentElement.children; _i < _a.length; _i++){ - var sibling = _a[_i]; - // but ignore elements that are already aria-hidden - var ariaHidden = sibling.getAttribute('aria-hidden'); - if (sibling !== target && (ariaHidden === null || ariaHidden === void 0 ? void 0 : ariaHidden.toLowerCase()) !== 'true' && tagsToIgnore.indexOf(sibling.tagName) === -1) affectedNodes.push([ - sibling, - ariaHidden - ]); - } - target = target.parentElement; - } - // take all those elements and set aria-hidden=true on them - affectedNodes.forEach(function(_a) { - var node = _a[0]; - node.setAttribute('aria-hidden', 'true'); - }); - return function() { - unmodalize(affectedNodes); - affectedNodes = []; // dispose - }; -} -/** - * Undoes the changes that modalize() did. - */ function unmodalize(affectedNodes) { - affectedNodes.forEach(function(_a) { - var node = _a[0], originalValue = _a[1]; - // Restore the original value (false or unset) - if (originalValue) node.setAttribute('aria-hidden', originalValue); - else node.removeAttribute('aria-hidden'); - }); -} - -},{"./dom/getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fxaey":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Returns true if the user is on a Mac. Caches the result value. - * @param reset - Reset the cached result value (mainly for testing). - */ parcelHelpers.export(exports, "isMac", ()=>isMac); -var _getWindow = require("./dom/getWindow"); -var isMacResult; -function isMac(reset) { - var _a; - if (typeof isMacResult === 'undefined' || reset) { - var win = (0, _getWindow.getWindow)(); - // In certain SSR frameworks, `window` will be defined even on the server but `navigator` will be undefined - var userAgent = (_a = win === null || win === void 0 ? void 0 : win.navigator) === null || _a === void 0 ? void 0 : _a.userAgent; - isMacResult = !!userAgent && userAgent.indexOf('Macintosh') !== -1; + if (getRTL(theme)) { + if (key2 === KeyCodes.left) { + key2 = KeyCodes.right; + } else if (key2 === KeyCodes.right) { + key2 = KeyCodes.left; + } } - return !!isMacResult; -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gxEfk":[function(require,module,exports,__globalThis) { -/** - * Detects whether an element's content has horizontal overflow - * - * @public - * @param element - Element to check for overflow - * @returns True if element's content overflows - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hasHorizontalOverflow", ()=>hasHorizontalOverflow); -/** - * Detects whether an element's content has vertical overflow - * - * @public - * @param element - Element to check for overflow - * @returns True if element's content overflows - */ parcelHelpers.export(exports, "hasVerticalOverflow", ()=>hasVerticalOverflow); -/** - * Detects whether an element's content has overflow in any direction - * - * @public - * @param element - Element to check for overflow - * @returns True if element's content overflows - */ parcelHelpers.export(exports, "hasOverflow", ()=>hasOverflow); -function hasHorizontalOverflow(element) { - return element.clientWidth < element.scrollWidth; -} -function hasVerticalOverflow(element) { - return element.clientHeight < element.scrollHeight; -} -function hasOverflow(element) { - return hasHorizontalOverflow(element) || hasVerticalOverflow(element); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hnUBo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Composes two 'render functions' to produce a final render function that renders - * the outer function, passing the inner function as 'default render'. The inner function - * is then passed the original 'default render' prop. - * @public - */ parcelHelpers.export(exports, "composeRenderFunction", ()=>composeRenderFunction); -var _memoize = require("../memoize"); -function createComposedRenderFunction(outer) { - var outerMemoizer = (0, _memoize.createMemoizer)(function(inner) { - var innerMemoizer = (0, _memoize.createMemoizer)(function(defaultRender) { - return function(innerProps) { - return inner(innerProps, defaultRender); - }; - }); - return function(outerProps, defaultRender) { - return outer(outerProps, defaultRender ? innerMemoizer(defaultRender) : inner); - }; + return key2; + } + var MAX_CACHE_COUNT = 50; + var DEFAULT_SPECIFICITY_MULTIPLIER = 5; + var _memoizedClassNames = 0; + var stylesheet$1 = Stylesheet.getInstance(); + if (stylesheet$1 && stylesheet$1.onReset) { + stylesheet$1.onReset(function() { + return _memoizedClassNames++; }); - return outerMemoizer; -} -var memoizer = (0, _memoize.createMemoizer)(createComposedRenderFunction); -function composeRenderFunction(outer, inner) { - return memoizer(outer)(inner); -} - -},{"../memoize":"cqPyR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bTWnR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * @deprecated Unused as of version 8 - */ parcelHelpers.export(exports, "getResourceUrl", ()=>getResourceUrl); -/** - * @deprecated Unused as of version 8 - */ parcelHelpers.export(exports, "setBaseUrl", ()=>setBaseUrl); -var _baseUrl = ''; -function getResourceUrl(url) { - return _baseUrl + url; -} -function setBaseUrl(baseUrl) { - _baseUrl = baseUrl; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ghqZY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "safeRequestAnimationFrame", ()=>safeRequestAnimationFrame); -var _extendComponent = require("./extendComponent"); -var safeRequestAnimationFrame = function(component) { - var activeTimeouts; - return function(cb) { - if (!activeTimeouts) { - activeTimeouts = new Set(); - (0, _extendComponent.extendComponent)(component, { - componentWillUnmount: function() { - activeTimeouts.forEach(function(id) { - return cancelAnimationFrame(id); - }); - } - }); - } - var timeoutId = requestAnimationFrame(function() { - activeTimeouts.delete(timeoutId); - cb(); - }); - activeTimeouts.add(timeoutId); - }; -}; - -},{"./extendComponent":"iAatf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2wmgr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "safeSetTimeout", ()=>safeSetTimeout); -var _extendComponent = require("./extendComponent"); -var safeSetTimeout = function(component) { - var activeTimeouts; - return function(cb, duration) { - if (!activeTimeouts) { - activeTimeouts = new Set(); - (0, _extendComponent.extendComponent)(component, { - componentWillUnmount: function() { - activeTimeouts.forEach(function(id) { - return clearTimeout(id); - }); - } - }); - } - var timeoutId = setTimeout(function() { - activeTimeouts.delete(timeoutId); - cb(); - }, duration); - activeTimeouts.add(timeoutId); - }; -}; - -},{"./extendComponent":"iAatf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hAgvp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>(0, _selectionTypes.SELECTION_CHANGE)); -parcelHelpers.export(exports, "SELECTION_ITEMS_CHANGE", ()=>(0, _selectionTypes.SELECTION_ITEMS_CHANGE)); -parcelHelpers.export(exports, "SelectionDirection", ()=>(0, _selectionTypes.SelectionDirection)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _selectionTypes.SelectionMode)); -parcelHelpers.export(exports, "Selection", ()=>(0, _selection.Selection)); -var _selectionTypes = require("./Selection.types"); -var _selection = require("./Selection"); - -},{"./Selection.types":"hrSBP","./Selection":"95bhY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hrSBP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>SELECTION_CHANGE); -parcelHelpers.export(exports, "SELECTION_ITEMS_CHANGE", ()=>SELECTION_ITEMS_CHANGE); -parcelHelpers.export(exports, "SelectionMode", ()=>SelectionMode); -parcelHelpers.export(exports, "SelectionDirection", ()=>SelectionDirection); -var SELECTION_CHANGE = 'change'; -var SELECTION_ITEMS_CHANGE = 'items-change'; -var SelectionMode; -(function(SelectionMode) { - SelectionMode[SelectionMode["none"] = 0] = "none"; - SelectionMode[SelectionMode["single"] = 1] = "single"; - SelectionMode[SelectionMode["multiple"] = 2] = "multiple"; -})(SelectionMode || (SelectionMode = {})); -var SelectionDirection; -(function(SelectionDirection) { - SelectionDirection[SelectionDirection["horizontal"] = 0] = "horizontal"; - SelectionDirection[SelectionDirection["vertical"] = 1] = "vertical"; -})(SelectionDirection || (SelectionDirection = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"95bhY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Selection", ()=>Selection); -var _selectionTypes = require("./Selection.types"); -var _eventGroup = require("../EventGroup"); -/** - * {@docCategory Selection} - */ var Selection = /** @class */ function() { - /** - * Create a new Selection. If `TItem` does not have a `key` property, you must provide an options - * object with a `getKey` implementation. Providing options is optional otherwise. - * (At most one `options` object is accepted.) - */ function Selection() { - var options = []; // Otherwise, arguments require options with `getKey`. - for(var _i = 0 // Otherwise, arguments require options with `getKey`. - ; _i < arguments.length // Otherwise, arguments require options with `getKey`. - ; _i++ // Otherwise, arguments require options with `getKey`. - )options[_i] = arguments[_i]; // Otherwise, arguments require options with `getKey`. - var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, onItemsChanged = _a.onItemsChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function() { - return true; - } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? (0, _selectionTypes.SelectionMode).multiple : _c; - this.mode = selectionMode; - this._getKey = getKey || defaultGetKey; - this._changeEventSuppressionCount = 0; - this._exemptedCount = 0; - this._anchoredIndex = 0; - this._unselectableCount = 0; - this._onSelectionChanged = onSelectionChanged; - this._onItemsChanged = onItemsChanged; - this._canSelectItem = canSelectItem; - this._keyToIndexMap = {}; - this._isModal = false; - this.setItems(items || [], true); - this.count = this.getSelectedCount(); - } - Selection.prototype.canSelectItem = function(item, index) { - if (typeof index === 'number' && index < 0) return false; - return this._canSelectItem(item, index); - }; - Selection.prototype.getKey = function(item, index) { - var key = this._getKey(item, index); - return typeof key === 'number' || key ? "".concat(key) : ''; - }; - Selection.prototype.setChangeEvents = function(isEnabled, suppressChange) { - this._changeEventSuppressionCount += isEnabled ? -1 : 1; - if (this._changeEventSuppressionCount === 0 && this._hasChanged) { - this._hasChanged = false; - if (!suppressChange) this._change(); - } - }; - Selection.prototype.isModal = function() { - return this._isModal; - }; - Selection.prototype.setModal = function(isModal) { - if (this._isModal !== isModal) { - this.setChangeEvents(false); - this._isModal = isModal; - if (!isModal) this.setAllSelected(false); - this._change(); - this.setChangeEvents(true); - } - }; - /** - * Selection needs the items, call this method to set them. If the set - * of items is the same, this will re-evaluate selection and index maps. - * Otherwise, shouldClear should be set to true, so that selection is - * cleared. - */ Selection.prototype.setItems = function(items, shouldClear) { - if (shouldClear === void 0) shouldClear = true; - var newKeyToIndexMap = {}; - var newUnselectableIndices = {}; - var hasSelectionChanged = false; - this.setChangeEvents(false); - // Reset the unselectable count. - this._unselectableCount = 0; - var haveItemsChanged = false; - // Build lookup table for quick selection evaluation. - for(var i = 0; i < items.length; i++){ - var item = items[i]; - if (item) { - var key = this.getKey(item, i); - if (key) { - if (!haveItemsChanged && (!(key in this._keyToIndexMap) || this._keyToIndexMap[key] !== i)) haveItemsChanged = true; - newKeyToIndexMap[key] = i; - } - } - newUnselectableIndices[i] = item && !this.canSelectItem(item); - if (newUnselectableIndices[i]) this._unselectableCount++; - } - if (shouldClear || items.length === 0) this._setAllSelected(false, true); - // Check the exemption list for discrepencies. - var newExemptedIndicies = {}; - var newExemptedCount = 0; - for(var indexProperty in this._exemptedIndices)if (this._exemptedIndices.hasOwnProperty(indexProperty)) { - var index = Number(indexProperty); - var item = this._items[index]; - var exemptKey = item ? this.getKey(item, Number(index)) : undefined; - var newIndex = exemptKey ? newKeyToIndexMap[exemptKey] : index; - if (newIndex === undefined) // The item has likely been replaced or removed. - hasSelectionChanged = true; - else { - // We know the new index of the item. update the existing exemption table. - newExemptedIndicies[newIndex] = true; - newExemptedCount++; - hasSelectionChanged = hasSelectionChanged || newIndex !== index; - } - } - if (this._items && this._exemptedCount === 0 && items.length !== this._items.length && this._isAllSelected) // If everything was selected but the number of items has changed, selection has changed. - hasSelectionChanged = true; - if (!haveItemsChanged) for(var _i = 0, _a = Object.keys(this._keyToIndexMap); _i < _a.length; _i++){ - var key = _a[_i]; - if (!(key in newKeyToIndexMap)) { - haveItemsChanged = true; - break; - } - } - this._exemptedIndices = newExemptedIndicies; - this._exemptedCount = newExemptedCount; - this._keyToIndexMap = newKeyToIndexMap; - this._unselectableIndices = newUnselectableIndices; - this._items = items; - this._selectedItems = null; - if (hasSelectionChanged) this._updateCount(); - if (haveItemsChanged) { - (0, _eventGroup.EventGroup).raise(this, (0, _selectionTypes.SELECTION_ITEMS_CHANGE)); - if (this._onItemsChanged) this._onItemsChanged(); - } - if (hasSelectionChanged) this._change(); - this.setChangeEvents(true); - }; - Selection.prototype.getItems = function() { - return this._items; - }; - Selection.prototype.getSelection = function() { - if (!this._selectedItems) { - this._selectedItems = []; - var items = this._items; - if (items) { - for(var i = 0; i < items.length; i++)if (this.isIndexSelected(i)) this._selectedItems.push(items[i]); - } - } - return this._selectedItems; - }; - Selection.prototype.getSelectedCount = function() { - return this._isAllSelected ? this._items.length - this._exemptedCount - this._unselectableCount : this._exemptedCount; - }; - Selection.prototype.getSelectedIndices = function() { - if (!this._selectedIndices) { - this._selectedIndices = []; - var items = this._items; - if (items) { - for(var i = 0; i < items.length; i++)if (this.isIndexSelected(i)) this._selectedIndices.push(i); - } + } + var retVal = "__retval__"; + function classNamesFunction(options2) { + if (options2 === void 0) { + options2 = {}; + } + var windowMap = /* @__PURE__ */ new Map(); + var styleCalcCount = 0; + var getClassNamesCount = 0; + var currentMemoizedClassNames = _memoizedClassNames; + var getClassNames2 = function(styleFunctionOrObject, styleProps) { + var _a2; + if (styleProps === void 0) { + styleProps = {}; + } + if (options2.useStaticStyles && typeof styleFunctionOrObject === "function" && styleFunctionOrObject.__noStyleOverride__) { + return styleFunctionOrObject(styleProps); + } + getClassNamesCount++; + var shadowConfig = styleFunctionOrObject ? styleFunctionOrObject.__shadowConfig__ : void 0; + var key2 = shadowConfig && shadowConfig.window ? shadowConfig.window : "__default__"; + if (!windowMap.has(key2)) { + windowMap.set(key2, /* @__PURE__ */ new Map()); + } + var current = windowMap.get(key2); + var theme = styleProps.theme; + var rtl = theme && theme.rtl !== void 0 ? theme.rtl : getRTL(); + var disableCaching = options2.disableCaching; + if (currentMemoizedClassNames !== _memoizedClassNames) { + currentMemoizedClassNames = _memoizedClassNames; + windowMap.set(key2, /* @__PURE__ */ new Map()); + current = windowMap.get(key2); + styleCalcCount = 0; + } + if (!options2.disableCaching) { + current = _traverseMap(windowMap.get(key2), styleFunctionOrObject); + current = _traverseMap(current, styleProps); + } + if (disableCaching || !current[retVal]) { + if (styleFunctionOrObject === void 0) { + current[retVal] = {}; + } else { + current[retVal] = mergeCssSets([ + typeof styleFunctionOrObject === "function" ? styleFunctionOrObject(styleProps) : styleFunctionOrObject + ], { + shadowConfig: styleFunctionOrObject.__shadowConfig__, + rtl: !!rtl, + specificityMultiplier: options2.useStaticStyles ? DEFAULT_SPECIFICITY_MULTIPLIER : void 0 + }); } - return this._selectedIndices; - }; - Selection.prototype.getItemIndex = function(key) { - var index = this._keyToIndexMap[key]; - return index !== null && index !== void 0 ? index : -1; - }; - Selection.prototype.isRangeSelected = function(fromIndex, count) { - if (count === 0) return false; - var endIndex = fromIndex + count; - for(var i = fromIndex; i < endIndex; i++){ - if (!this.isIndexSelected(i)) return false; + if (!disableCaching) { + styleCalcCount++; } - return true; + } + if (styleCalcCount > (options2.cacheSize || MAX_CACHE_COUNT)) { + var win = getWindow(); + if ((_a2 = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _a2 === void 0 ? void 0 : _a2.enableClassNameCacheFullWarning) { + console.warn("Styles are being recalculated too frequently. Cache miss rate is ".concat(styleCalcCount, "/").concat(getClassNamesCount, ".")); + console.trace(); + } + windowMap.get(key2).clear(); + styleCalcCount = 0; + options2.disableCaching = true; + } + return current[retVal]; }; - Selection.prototype.isAllSelected = function() { - var selectableCount = this._items.length - this._unselectableCount; - // In single mode, we can only have a max of 1 item. - if (this.mode === (0, _selectionTypes.SelectionMode).single) selectableCount = Math.min(selectableCount, 1); - return this.count > 0 && this._isAllSelected && this._exemptedCount === 0 || !this._isAllSelected && this._exemptedCount === selectableCount && selectableCount > 0; - }; - Selection.prototype.isKeySelected = function(key) { - var index = this._keyToIndexMap[key]; - return this.isIndexSelected(index); - }; - Selection.prototype.isIndexSelected = function(index) { - return !!(this.count > 0 && this._isAllSelected && !this._exemptedIndices[index] && !this._unselectableIndices[index] || !this._isAllSelected && this._exemptedIndices[index]); - }; - Selection.prototype.setAllSelected = function(isAllSelected) { - if (isAllSelected && this.mode !== (0, _selectionTypes.SelectionMode).multiple) return; - var selectableCount = this._items ? this._items.length - this._unselectableCount : 0; - this.setChangeEvents(false); - if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) { - this._exemptedIndices = {}; - if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) { - this._exemptedCount = 0; - this._isAllSelected = isAllSelected; - this._change(); - } - this._updateCount(); - } - this.setChangeEvents(true); - }; - Selection.prototype.setKeySelected = function(key, isSelected, shouldAnchor) { - var index = this._keyToIndexMap[key]; - if (index >= 0) this.setIndexSelected(index, isSelected, shouldAnchor); - }; - Selection.prototype.setIndexSelected = function(index, isSelected, shouldAnchor) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - // Clamp the index. - index = Math.min(Math.max(0, index), this._items.length - 1); - // No-op on out of bounds selections. - if (index < 0 || index >= this._items.length) return; - this.setChangeEvents(false); - var isExempt = this._exemptedIndices[index]; - var canSelect = !this._unselectableIndices[index]; - if (canSelect) { - if (isSelected && this.mode === (0, _selectionTypes.SelectionMode).single) // If this is single-select, the previous selection should be removed. - this._setAllSelected(false, true); - // Determine if we need to remove the exemption. - if (isExempt && (isSelected && this._isAllSelected || !isSelected && !this._isAllSelected)) { - delete this._exemptedIndices[index]; - this._exemptedCount--; - } - // Determine if we need to add the exemption. - if (!isExempt && (isSelected && !this._isAllSelected || !isSelected && this._isAllSelected)) { - this._exemptedIndices[index] = true; - this._exemptedCount++; - } - if (shouldAnchor) this._anchoredIndex = index; - } - this._updateCount(); - this.setChangeEvents(true); - }; - Selection.prototype.setRangeSelected = function(fromIndex, count, isSelected, shouldAnchor) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - // Clamp the index. - fromIndex = Math.min(Math.max(0, fromIndex), this._items.length - 1); - // Clamp the range. - count = Math.min(Math.max(0, count), this._items.length - fromIndex); - // No-op on out of bounds selections. - if (fromIndex < 0 || fromIndex >= this._items.length || count === 0) return; - this.setChangeEvents(false); - var anchorIndex = this._anchoredIndex || 0; - var startIndex = fromIndex; - var endIndex = fromIndex + count - 1; - var newAnchorIndex = anchorIndex >= endIndex ? startIndex : endIndex; - for(; startIndex <= endIndex; startIndex++)this.setIndexSelected(startIndex, isSelected, shouldAnchor ? startIndex === newAnchorIndex : false); - this.setChangeEvents(true); - }; - Selection.prototype.selectToKey = function(key, clearSelection) { - this.selectToIndex(this._keyToIndexMap[key], clearSelection); - }; - Selection.prototype.selectToRange = function(fromIndex, count, clearSelection) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - if (this.mode === (0, _selectionTypes.SelectionMode).single) { - if (count === 1) this.setIndexSelected(fromIndex, true, true); - return; - } - var anchorIndex = this._anchoredIndex || 0; - var startIndex = Math.min(fromIndex, anchorIndex); - var endIndex = Math.max(fromIndex + count - 1, anchorIndex); - this.setChangeEvents(false); - if (clearSelection) this._setAllSelected(false, true); - for(; startIndex <= endIndex; startIndex++)this.setIndexSelected(startIndex, true, false); - this.setChangeEvents(true); - }; - Selection.prototype.selectToIndex = function(index, clearSelection) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - if (this.mode === (0, _selectionTypes.SelectionMode).single) { - this.setIndexSelected(index, true, true); - return; - } - var anchorIndex = this._anchoredIndex || 0; - var startIndex = Math.min(index, anchorIndex); - var endIndex = Math.max(index, anchorIndex); - this.setChangeEvents(false); - if (clearSelection) this._setAllSelected(false, true); - for(; startIndex <= endIndex; startIndex++)this.setIndexSelected(startIndex, true, false); - this.setChangeEvents(true); - }; - Selection.prototype.toggleAllSelected = function() { - this.setAllSelected(!this.isAllSelected()); - }; - Selection.prototype.toggleKeySelected = function(key) { - this.setKeySelected(key, !this.isKeySelected(key), true); - }; - Selection.prototype.toggleIndexSelected = function(index) { - this.setIndexSelected(index, !this.isIndexSelected(index), true); - }; - Selection.prototype.toggleRangeSelected = function(fromIndex, count) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - var isRangeSelected = this.isRangeSelected(fromIndex, count); - var endIndex = fromIndex + count; - if (this.mode === (0, _selectionTypes.SelectionMode).single && count > 1) return; - this.setChangeEvents(false); - for(var i = fromIndex; i < endIndex; i++)this.setIndexSelected(i, !isRangeSelected, false); - this.setChangeEvents(true); - }; - Selection.prototype._updateCount = function(preserveModalState) { - if (preserveModalState === void 0) preserveModalState = false; - var count = this.getSelectedCount(); - if (count !== this.count) { - this.count = count; - this._change(); - } - if (!this.count && !preserveModalState) this.setModal(false); - }; - Selection.prototype._setAllSelected = function(isAllSelected, preserveModalState) { - if (preserveModalState === void 0) preserveModalState = false; - if (isAllSelected && this.mode !== (0, _selectionTypes.SelectionMode).multiple) return; - var selectableCount = this._items ? this._items.length - this._unselectableCount : 0; - this.setChangeEvents(false); - if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) { - this._exemptedIndices = {}; - if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) { - this._exemptedCount = 0; - this._isAllSelected = isAllSelected; - this._change(); - } - this._updateCount(preserveModalState); - } - this.setChangeEvents(true); - }; - Selection.prototype._change = function() { - if (this._changeEventSuppressionCount === 0) { - this._selectedItems = null; - this._selectedIndices = undefined; - (0, _eventGroup.EventGroup).raise(this, (0, _selectionTypes.SELECTION_CHANGE)); - if (this._onSelectionChanged) this._onSelectionChanged(); - } else this._hasChanged = true; - }; - return Selection; -}(); -function defaultGetKey(item, index) { - // 0 may be used as a key - var _a = (item || {}).key, key = _a === void 0 ? "".concat(index) : _a; - return key; -} - -},{"./Selection.types":"hrSBP","../EventGroup":"0TvPH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"996Ia":[function(require,module,exports,__globalThis) { -// Regex that finds { and } so they can be removed on a lookup for string format -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * String format method, used for scenarios where at runtime you - * need to evaluate a formatted string given a tokenized string. This - * usually only is needed in localization scenarios. - - * @example - * ```tsx - * "I love {0} every {1}".format("CXP") - * ``` - * will result in a Debug Exception. - * - * @public - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "format", ()=>format); -var FORMAT_ARGS_REGEX = /[\{\}]/g; -// Regex that finds {#} so it can be replaced by the arguments in string format -var FORMAT_REGEX = /\{\d+\}/g; -function format(s) { - var values = []; - for(var _i = 1; _i < arguments.length; _i++)values[_i - 1] = arguments[_i]; - var args = values; - // Callback match function - function replaceFunc(match) { - // looks up in the args - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var replacement = args[match.replace(FORMAT_ARGS_REGEX, '')]; - // catches undefined in nondebug and null in debug and nondebug - if (replacement === null || replacement === undefined) replacement = ''; - return replacement; - } - return s.replace(FORMAT_REGEX, replaceFunc); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bwELv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "styled", ()=>styled); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _index = require("./shadowDom/index"); -var _useCustomizationSettings = require("./customizations/useCustomizationSettings"); -var DefaultFields = [ - 'theme', - 'styles' -]; -function styled(Component, baseStyles, getProps, customizable, pure) { - customizable = customizable || { - scope: '', - fields: undefined - }; - var scope = customizable.scope, _a = customizable.fields, fields = _a === void 0 ? DefaultFields : _a; - var Wrapped = _react.forwardRef(function(props, forwardedRef) { - var styles = _react.useRef(); - var settings = (0, _useCustomizationSettings.useCustomizationSettings)(fields, scope); - var customizedStyles = settings.styles, dir = settings.dir, rest = (0, _tslib.__rest)(settings, [ - "styles", - "dir" - ]); - var additionalProps = getProps ? getProps(props) : undefined; - var useStyled = (0, _index.useMergeStylesHooks)().useStyled; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var cache = styles.current && styles.current.__cachedInputs__ || []; - var propStyles = props.styles; - if (!styles.current || customizedStyles !== cache[1] || propStyles !== cache[2]) { - // Using styled components as the Component arg will result in nested styling arrays. - // The function can be cached and in order to prevent the props from being retained within it's closure - // we pass in just the styles and not the entire props - var concatenatedStyles = function(styleProps) { - return (0, _mergeStyles.concatStyleSetsWithProps)(styleProps, baseStyles, customizedStyles, propStyles); - }; - // The __cachedInputs__ array is attached to the function and consumed by the - // classNamesFunction as a list of keys to include for memoizing classnames. - concatenatedStyles.__cachedInputs__ = [ - baseStyles, - customizedStyles, - propStyles - ]; - concatenatedStyles.__noStyleOverride__ = !customizedStyles && !propStyles; - styles.current = concatenatedStyles; - } - styles.current.__shadowConfig__ = useStyled(scope); - return _react.createElement(Component, (0, _tslib.__assign)({ - ref: forwardedRef - }, rest, additionalProps, props, { - styles: styles.current - })); - }); - // Function.prototype.name is an ES6 feature, so the cast to any is required until we're - // able to drop IE 11 support and compile with ES6 libs - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Wrapped.displayName = "Styled".concat(Component.displayName || Component.name); - // This preserves backwards compatibility. - var pureComponent = pure ? _react.memo(Wrapped) : Wrapped; - // Check if the wrapper has a displayName after it has been memoized. Then assign it to the pure component. - if (Wrapped.displayName) pureComponent.displayName = Wrapped.displayName; - return pureComponent; -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","./shadowDom/index":"dU66z","./customizations/useCustomizationSettings":"hUUmS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dU66z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>(0, _mergeStylesRootContext.MergeStylesRootProvider)); -parcelHelpers.export(exports, "MergeStylesShadowRootConsumer", ()=>(0, _mergeStylesShadowRootConsumer.MergeStylesShadowRootConsumer)); -parcelHelpers.export(exports, "MergeStylesShadowRootContext", ()=>(0, _mergeStylesShadowRootContext.MergeStylesShadowRootContext)); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>(0, _mergeStylesShadowRootContext.MergeStylesShadowRootProvider)); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>(0, _useAdoptedStylesheet.useAdoptedStylesheet)); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>(0, _useAdoptedStylesheet.useAdoptedStylesheetEx)); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>(0, _useMergeStylesHooks.useMergeStylesHooks)); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>(0, _useMergeStylesRootStylesheets.useMergeStylesRootStylesheets)); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>(0, _useMergeStylesShadowRoot.useHasMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>(0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useShadowConfig", ()=>(0, _useShadowConfig.useShadowConfig)); -parcelHelpers.export(exports, "useStyled", ()=>(0, _useStyled.useStyled)); -var _mergeStylesRootContext = require("./contexts/MergeStylesRootContext"); -var _mergeStylesShadowRootConsumer = require("./contexts/MergeStylesShadowRootConsumer"); -var _mergeStylesShadowRootContext = require("./contexts/MergeStylesShadowRootContext"); -var _useAdoptedStylesheet = require("./hooks/useAdoptedStylesheet"); -var _useMergeStylesHooks = require("./hooks/useMergeStylesHooks"); -var _useMergeStylesRootStylesheets = require("./hooks/useMergeStylesRootStylesheets"); -var _useMergeStylesShadowRoot = require("./hooks/useMergeStylesShadowRoot"); -var _useShadowConfig = require("./hooks/useShadowConfig"); -var _useStyled = require("./hooks/useStyled"); - -},{"./contexts/MergeStylesRootContext":"imHPx","./contexts/MergeStylesShadowRootConsumer":false,"./contexts/MergeStylesShadowRootContext":"eqTfx","./hooks/useAdoptedStylesheet":"cwY76","./hooks/useMergeStylesHooks":"90VFe","./hooks/useMergeStylesRootStylesheets":"daPdP","./hooks/useMergeStylesShadowRoot":"gp0eP","./hooks/useShadowConfig":"ddtud","./hooks/useStyled":"eIB12","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"imHPx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesRootContext", ()=>MergeStylesRootContext); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>MergeStylesRootProvider); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _dom = require("../../dom"); -var _mergeStylesDefaultContext = require("./MergeStylesDefaultContext"); -var _useAdoptedStylesheet = require("../hooks/useAdoptedStylesheet"); -var _useShadowConfig = require("../hooks/useShadowConfig"); -var _useMergeStylesShadowRoot = require("../hooks/useMergeStylesShadowRoot"); -var _useMergeStylesRootStylesheets = require("../hooks/useMergeStylesRootStylesheets"); -var _useStyled = require("../hooks/useStyled"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var MergeStylesRootContext = _react.createContext((0, _mergeStylesDefaultContext.getNewContext)()); -var MergeStylesRootProvider = function(_a) { - var userSheets = _a.stylesheets, userWindow = _a.window, useAdoptedStylesheet = _a.useAdoptedStylesheet, useAdoptedStylesheetEx = _a.useAdoptedStylesheetEx, useShadowConfig = _a.useShadowConfig, useMergeStylesShadowRootContext = _a.useMergeStylesShadowRootContext, useHasMergeStylesShadowRootContext = _a.useHasMergeStylesShadowRootContext, useMergeStylesRootStylesheets = _a.useMergeStylesRootStylesheets, useWindow = _a.useWindow, useStyled = _a.useStyled, props = (0, _tslib.__rest)(_a, [ - "stylesheets", - "window", - "useAdoptedStylesheet", - "useAdoptedStylesheetEx", - "useShadowConfig", - "useMergeStylesShadowRootContext", - "useHasMergeStylesShadowRootContext", - "useMergeStylesRootStylesheets", - "useWindow", - "useStyled" - ]); - var win = userWindow !== null && userWindow !== void 0 ? userWindow : (0, _dom.getWindow)(); - var _b = _react.useState(function() { - return userSheets || new Map(); - }), stylesheets = _b[0], setStylesheets = _b[1]; - var sheetHandler = _react.useCallback(function(_a) { - var key = _a.key, sheet = _a.sheet; - setStylesheets(function(prev) { - var next = new Map(prev); - next.set(key, sheet); - return next; - }); - }, []); - // Udapte stylesheets based on user style sheet changes - _react.useEffect(function() { - setStylesheets(userSheets || new Map()); - }, [ - userSheets - ]); - // Wire up listener for adopted stylesheets - _react.useEffect(function() { - if (!win) return; - var sheet = (0, _mergeStyles.ShadowDomStylesheet).getInstance((0, _mergeStyles.makeShadowConfig)((0, _mergeStyles.GLOBAL_STYLESHEET_KEY), false, win)); - var off = sheet.onAddSheet(sheetHandler); - return function() { - off(); - }; - }, [ - win, - sheetHandler - ]); - // Read stylesheets from window on mount - _react.useEffect(function() { - if (!win) return; - var changed = false; - var next = new Map(stylesheets); - var sheet = (0, _mergeStyles.ShadowDomStylesheet).getInstance((0, _mergeStyles.makeShadowConfig)((0, _mergeStyles.GLOBAL_STYLESHEET_KEY), false, win)); - var adoptedSheets = sheet.getAdoptedSheets(); - adoptedSheets.forEach(function(adoptedSheet, key) { - next.set(key, adoptedSheet); - changed = true; - }); - if (changed) setStylesheets(next); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - var defaultValues = _react.useMemo(function() { - return { - stylesheets: stylesheets, - useAdoptedStylesheet: useAdoptedStylesheet || (0, _useAdoptedStylesheet.useAdoptedStylesheet), - useAdoptedStylesheetEx: useAdoptedStylesheetEx || (0, _useAdoptedStylesheet.useAdoptedStylesheetEx), - useShadowConfig: useShadowConfig || (0, _useShadowConfig.useShadowConfig), - useMergeStylesShadowRootContext: useMergeStylesShadowRootContext || (0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext), - useHasMergeStylesShadowRootContext: useHasMergeStylesShadowRootContext || (0, _useMergeStylesShadowRoot.useHasMergeStylesShadowRootContext), - useMergeStylesRootStylesheets: useMergeStylesRootStylesheets || (0, _useMergeStylesRootStylesheets.useMergeStylesRootStylesheets), - useWindow: useWindow || (0, _reactWindowProvider.useWindow), - useStyled: useStyled || (0, _useStyled.useStyled) - }; - }, [ - stylesheets, - useAdoptedStylesheet, - useAdoptedStylesheetEx, - useShadowConfig, - useMergeStylesShadowRootContext, - useHasMergeStylesShadowRootContext, - useMergeStylesRootStylesheets, - useWindow, - useStyled - ]); - return _react.createElement((0, _mergeStylesDefaultContext.MergeStylesDefaultContext).Provider, { - value: defaultValues - }, _react.createElement(MergeStylesRootContext.Provider, (0, _tslib.__assign)({ - value: defaultValues - }, props))); -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","../../dom":"QMA5I","./MergeStylesDefaultContext":"jiC2S","../hooks/useAdoptedStylesheet":"cwY76","../hooks/useShadowConfig":"ddtud","../hooks/useMergeStylesShadowRoot":"gp0eP","../hooks/useMergeStylesRootStylesheets":"daPdP","../hooks/useStyled":"eIB12","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cwY76":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>useAdoptedStylesheet); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>useAdoptedStylesheetEx); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _useMergeStylesRootStylesheets = require("./useMergeStylesRootStylesheets"); -var _useMergeStylesShadowRoot = require("./useMergeStylesShadowRoot"); -var useAdoptedStylesheet = function(stylesheetKey) { - var shadowCtx = (0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext)(); - var rootMergeStyles = (0, _useMergeStylesRootStylesheets.useMergeStylesRootStylesheets)(); - var win = (0, _reactWindowProvider.useWindow)(); - return useAdoptedStylesheetEx(stylesheetKey, shadowCtx, rootMergeStyles, win); -}; -var useAdoptedStylesheetEx = function(stylesheetKey, shadowCtx, rootMergeStyles, win) { - var polyfillInsertListners = _react.useRef({}); - _react.useEffect(function() { - if (!shadowCtx) return; - var polyfillListeners = polyfillInsertListners.current; - polyfillInsertListners.current = {}; - return function() { - Object.keys(polyfillListeners).forEach(function(key) { - polyfillListeners[key](); - }); - }; - }, [ - win, - stylesheetKey, - shadowCtx - ]); - if (!shadowCtx) return false; - if (shadowCtx.shadowRoot && !shadowCtx.stylesheets.has(stylesheetKey)) { - var adoptableStyleSheet = rootMergeStyles.get(stylesheetKey); - if (adoptableStyleSheet && (win === null || win === void 0 ? void 0 : win.document)) adoptSheet(shadowCtx, win.document, stylesheetKey, adoptableStyleSheet, polyfillInsertListners.current); + return getClassNames2; + } + function _traverseEdge(current, value2) { + value2 = _normalizeValue(value2); + if (!current.has(value2)) { + current.set(value2, /* @__PURE__ */ new Map()); } - return true; -}; -var updatePolyfillSheet = function(shadowCtx, stylesheetKey, rule) { - var shadowRoot = shadowCtx.shadowRoot; - var style = shadowRoot.querySelector("[data-merge-styles-stylesheet-key=\"".concat(stylesheetKey, "\"]")); - if (style === null || style === void 0 ? void 0 : style.sheet) style.sheet.insertRule(rule); -}; -var adoptSheet = function(shadowCtx, doc, stylesheetKey, stylesheet, listenerRef) { - var _a, _b, _c, _d, _e; - var shadowRoot = shadowCtx.shadowRoot; - shadowCtx.stylesheets.set(stylesheetKey, stylesheet); - if (0, _mergeStyles.SUPPORTS_CONSTRUCTABLE_STYLESHEETS) { - // Maintain the sort order of Fluent style sheets - var prevSheets = shadowRoot.adoptedStyleSheets; - var i = prevSheets.length; - var found = i === 0; - while(i >= 0 && !found){ - i--; - var prevSheet = prevSheets[i]; - var prevSortOrder = (_b = (_a = prevSheet.metadata) === null || _a === void 0 ? void 0 : _a.sortOrder) !== null && _b !== void 0 ? _b : 0; - var sheetSortOrder = (_d = (_c = stylesheet.metadata) === null || _c === void 0 ? void 0 : _c.sortOrder) !== null && _d !== void 0 ? _d : 0; - if (prevSheet.bucketName === 'merge-styles' && prevSortOrder < sheetSortOrder) found = true; - } - if (0, _mergeStyles.SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS) // The current spec allows the `adoptedStyleSheets` array to be modified. - // Previous versions of the spec required a new array to be created. - // For more details see: https://github.com/microsoft/fast/pull/6703 - shadowRoot.adoptedStyleSheets.splice(i + 1, 0, stylesheet); - else shadowRoot.adoptedStyleSheets = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], shadowRoot.adoptedStyleSheets.slice(0, i + 1), true), [ - stylesheet - ], false), shadowRoot.adoptedStyleSheets.slice(i + 1), true); - } else { - var style = doc.createElement('style'); - style.setAttribute('data-merge-styles-stylesheet-key', stylesheetKey); - var otherStyles = shadowRoot.querySelectorAll('[data-merge-styles-stylesheet-key]'); - if (otherStyles.length > 0) shadowRoot.insertBefore(style, otherStyles[otherStyles.length - 1].nextSibling); - else shadowRoot.insertBefore(style, shadowRoot.firstChild); - if (style.sheet) { - (0, _mergeStyles.cloneCSSStyleSheet)(stylesheet, style.sheet); - if (!listenerRef[stylesheetKey]) { - var onInsert = function(_a) { - var key = _a.key, rule = _a.rule; - if (key === stylesheetKey) { - if (shadowCtx && rule) updatePolyfillSheet(shadowCtx, key, rule); - } - }; - var polyfillSheet = (0, _mergeStyles.Stylesheet).getInstance((0, _mergeStyles.makeShadowConfig)(stylesheetKey, true, (_e = doc.defaultView) !== null && _e !== void 0 ? _e : undefined)); - listenerRef[stylesheetKey] = polyfillSheet.onInsertRule(onInsert); - } + return current.get(value2); + } + function _traverseMap(current, inputs) { + if (typeof inputs === "function") { + var cachedInputsFromStyled = inputs.__cachedInputs__; + if (cachedInputsFromStyled) { + for (var _i = 0, _a2 = inputs.__cachedInputs__; _i < _a2.length; _i++) { + var input = _a2[_i]; + current = _traverseEdge(current, input); + } + } else { + current = _traverseEdge(current, inputs); + } + } else if (typeof inputs === "object") { + for (var propName in inputs) { + if (inputs.hasOwnProperty(propName)) { + current = _traverseEdge(current, inputs[propName]); } + } } -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","@fluentui/react-window-provider":"iP8C0","./useMergeStylesRootStylesheets":"daPdP","./useMergeStylesShadowRoot":"gp0eP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"daPdP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>useMergeStylesRootStylesheets); -var _react = require("react"); -var _mergeStylesDefaultContext = require("../contexts/MergeStylesDefaultContext"); -var useMergeStylesRootStylesheets = function() { - return _react.useContext((0, _mergeStylesDefaultContext.MergeStylesDefaultContext)).stylesheets; -}; - -},{"react":"jGrId","../contexts/MergeStylesDefaultContext":"jiC2S","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ddtud":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useShadowConfig", ()=>useShadowConfig); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var useShadowConfig = function(stylesheetKey, inShadow, win) { - if (inShadow === void 0) inShadow = false; - return _react.useMemo(function() { - return (0, _mergeStyles.makeShadowConfig)(stylesheetKey, inShadow, win); - }, [ - stylesheetKey, - inShadow, - win - ]); -}; - -},{"react":"jGrId","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eIB12":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useStyled", ()=>useStyled); -var _dom = require("../../dom"); -var _useMergeStylesHooks = require("./useMergeStylesHooks"); -var useStyled = function(scope) { - if (scope === void 0) scope = '__global__'; - var _a = (0, _useMergeStylesHooks.useMergeStylesHooks)(), useAdoptedStylesheetEx = _a.useAdoptedStylesheetEx, useShadowConfig = _a.useShadowConfig, useMergeStylesShadowRootContext = _a.useMergeStylesShadowRootContext, useMergeStylesRootStylesheets = _a.useMergeStylesRootStylesheets, useWindow = _a.useWindow; - var win = useWindow() || (0, _dom.getWindow)(); - var shadowCtx = useMergeStylesShadowRootContext(); - var inShadow = !!shadowCtx; - var rootMergeStyles = useMergeStylesRootStylesheets(); - var shadowConfig = useShadowConfig(scope, inShadow, win); - useAdoptedStylesheetEx(scope, shadowCtx, rootMergeStyles, win); - return shadowConfig; -}; - -},{"../../dom":"QMA5I","./useMergeStylesHooks":"90VFe","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dpie2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setWarningCallback", ()=>(0, _warn.setWarningCallback)); -parcelHelpers.export(exports, "warn", ()=>(0, _warn.warn)); -parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>(0, _warnConditionallyRequiredProps.warnConditionallyRequiredProps)); -parcelHelpers.export(exports, "resetControlledWarnings", ()=>(0, _warnControlledUsage.resetControlledWarnings)); -parcelHelpers.export(exports, "warnControlledUsage", ()=>(0, _warnControlledUsage.warnControlledUsage)); -parcelHelpers.export(exports, "warnDeprecations", ()=>(0, _warnDeprecations.warnDeprecations)); -parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>(0, _warnMutuallyExclusive.warnMutuallyExclusive)); -var _warn = require("./warn/warn"); -var _warnConditionallyRequiredProps = require("./warn/warnConditionallyRequiredProps"); -var _warnControlledUsage = require("./warn/warnControlledUsage"); -var _warnDeprecations = require("./warn/warnDeprecations"); -var _warnMutuallyExclusive = require("./warn/warnMutuallyExclusive"); - -},{"./warn/warn":"itqD3","./warn/warnConditionallyRequiredProps":"77JnC","./warn/warnControlledUsage":"31R0G","./warn/warnDeprecations":"e2341","./warn/warnMutuallyExclusive":"1HY1B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"31R0G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** Reset controlled usage warnings for testing purposes. */ parcelHelpers.export(exports, "resetControlledWarnings", ()=>resetControlledWarnings); -/** - * Check for and warn on the following error conditions with a form component: - * - A value prop is provided (indicated it's being used as controlled) without a change handler, - * and the component is not read-only - * - Both the value and defaultValue props are provided - * - The component is attempting to switch between controlled and uncontrolled - * - * The messages mimic the warnings React gives for these error conditions on input elements. - * The warning will only be displayed once per component ID. - */ parcelHelpers.export(exports, "warnControlledUsage", ()=>warnControlledUsage); -var _warn = require("./warn"); -var _controlled = require("../controlled"); -var warningsMap; -function resetControlledWarnings() {} -function warnControlledUsage(params) { - var componentId, componentName, defaultValueProp, props, oldProps, onChangeProp, readOnlyProp, valueProp, oldIsControlled, newIsControlled, hasOnChange, isReadOnly, defaultValue, oldType, newType, warnMap; -} - -},{"./warn":"itqD3","../controlled":"5Lj2y","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c5nmJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isIE11", ()=>isIE11); -var _getWindow = require("./dom/getWindow"); -var isIE11 = function() { - var _a; - var win = (0, _getWindow.getWindow)(); - if (!((_a = win === null || win === void 0 ? void 0 : win.navigator) === null || _a === void 0 ? void 0 : _a.userAgent)) return false; - return win.navigator.userAgent.indexOf('rv:11.0') > -1; -}; - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lBZmc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Function to apply default values to a component props object. This function is intended for function components, - * to maintain parity with the `defaultProps` feature of class components. It accounts for properties that are - * specified, but undefined. - * @param defaultProps- An object with default values for various properties - * @param propsWithoutDefaults- The props object passed into the component - */ parcelHelpers.export(exports, "getPropsWithDefaults", ()=>getPropsWithDefaults); -var _tslib = require("tslib"); -function getPropsWithDefaults(defaultProps, propsWithoutDefaults) { - var props = (0, _tslib.__assign)({}, propsWithoutDefaults); - for(var _i = 0, _a = Object.keys(defaultProps); _i < _a.length; _i++){ - var key = _a[_i]; - if (props[key] === undefined) props[key] = defaultProps[key]; + return current; + } + function _normalizeValue(value2) { + switch (value2) { + case void 0: + return "__undefined__"; + case null: + return "__null__"; + default: + return value2; } - return props; -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6DBuh":[function(require,module,exports,__globalThis) { -/** - * @deprecated Use `canUseDOM` from `@fluentui/utilities` instead. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "_isSSR", ()=>_isSSR); -/** - * Helper to set ssr mode to simulate no window object returned from getWindow helper. - * - * @deprecated Use `canUseDOM` from `@fluentui/utilities` instead. - */ parcelHelpers.export(exports, "setSSR", ()=>setSSR); -var _isSSR = false; -function setSSR(isEnabled) { - throw new Error("setSSR has been deprecated and is not used in any utilities anymore. Use canUseDOM from @fluentui/utilities instead."); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e5kFM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createMergedRef", ()=>createMergedRef); -var _array = require("./array"); -/** - * Set up a ref resolver function given internal state managed for the ref. - * @param local Set - */ var createResolver = function(local) { - return function(newValue) { - for(var _i = 0, _a = local.refs; _i < _a.length; _i++){ - var ref = _a[_i]; - if (typeof ref === 'function') ref(newValue); - else if (ref) // work around the immutability of the React.Ref type - ref.current = newValue; + } + var _initializedStylesheetResets$1 = false; + var _resetCounter = 0; + var _emptyObject = { empty: true }; + var _dictionary = {}; + var _weakMap = typeof WeakMap === "undefined" ? null : WeakMap; + function resetMemoizations() { + _resetCounter++; + } + function memoizeFunction(cb, maxCacheSize, ignoreNullOrUndefinedResult) { + if (maxCacheSize === void 0) { + maxCacheSize = 100; + } + if (ignoreNullOrUndefinedResult === void 0) { + ignoreNullOrUndefinedResult = false; + } + if (!_weakMap) { + return cb; + } + if (!_initializedStylesheetResets$1) { + var stylesheet2 = Stylesheet.getInstance(); + if (stylesheet2 && stylesheet2.onReset) { + Stylesheet.getInstance().onReset(resetMemoizations); + } + _initializedStylesheetResets$1 = true; + } + var rootNode; + var cacheSize = 0; + var localResetCounter = _resetCounter; + return function memoizedFunction() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var currentNode = rootNode; + if (rootNode === void 0 || localResetCounter !== _resetCounter || maxCacheSize > 0 && cacheSize > maxCacheSize) { + rootNode = _createNode(); + cacheSize = 0; + localResetCounter = _resetCounter; + } + currentNode = rootNode; + for (var i = 0; i < args.length; i++) { + var arg = _normalizeArg(args[i]); + if (!currentNode.map.has(arg)) { + currentNode.map.set(arg, _createNode()); } + currentNode = currentNode.map.get(arg); + } + if (!currentNode.hasOwnProperty("value")) { + currentNode.value = cb.apply(void 0, args); + cacheSize++; + } + if (ignoreNullOrUndefinedResult && (currentNode.value === null || currentNode.value === void 0)) { + currentNode.value = cb.apply(void 0, args); + } + return currentNode.value; }; -}; -var createMergedRef = function(value) { - var local = { - refs: [] - }; - return function() { - var newRefs = []; - for(var _i = 0; _i < arguments.length; _i++)newRefs[_i] = arguments[_i]; - if (!local.resolver || !(0, _array.arraysEqual)(local.refs, newRefs)) local.resolver = createResolver(local); - local.refs = newRefs; - return local.resolver; - }; -}; - -},{"./array":"1Pspi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"88Q1R":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useIsomorphicLayoutEffect", ()=>useIsomorphicLayoutEffect); -var _react = require("react"); -var _canUseDOM = require("./dom/canUseDOM"); -var useIsomorphicLayoutEffect = (0, _canUseDOM.canUseDOM)() ? _react.useLayoutEffect : _react.useEffect; - -},{"react":"jGrId","./dom/canUseDOM":"iFHeV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e49Gp":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/utilities', '8.15.19'); - -},{"@fluentui/set-version":"iqYXf"}],"hiMUP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Icon/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Icon/index":"35V5u","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"35V5u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _icon = require("./Icon"); -parcelHelpers.exportAll(_icon, exports); -var _iconBase = require("./Icon.base"); -parcelHelpers.exportAll(_iconBase, exports); -var _iconTypes = require("./Icon.types"); -parcelHelpers.exportAll(_iconTypes, exports); -var _fontIcon = require("./FontIcon"); -parcelHelpers.exportAll(_fontIcon, exports); -var _imageIcon = require("./ImageIcon"); -parcelHelpers.exportAll(_imageIcon, exports); - -},{"./Icon":"gfQnz","./Icon.base":false,"./Icon.types":false,"./FontIcon":"gQUPC","./ImageIcon":"64ZOw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfQnz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Icon", ()=>Icon); -var _utilities = require("../../Utilities"); -var _iconBase = require("./Icon.base"); -var _iconStyles = require("./Icon.styles"); -var Icon = (0, _utilities.styled)((0, _iconBase.IconBase), (0, _iconStyles.getStyles), undefined, { - scope: 'Icon' -}, true); -Icon.displayName = 'Icon'; - -},{"../../Utilities":"1NZCy","./Icon.base":"a20eb","./Icon.styles":"lyw66","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a20eb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconBase", ()=>IconBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _iconTypes = require("./Icon.types"); -var _image = require("../Image/Image"); -var _imageTypes = require("../Image/Image.types"); -var _utilities = require("../../Utilities"); -var _fontIcon = require("./FontIcon"); -var getClassNames = (0, _utilities.classNamesFunction)({ - // Icon is used a lot by other components. - // It's likely to see expected cases which pass different className to the Icon. - // Therefore setting a larger cache size. - cacheSize: 100 -}); -var IconBase = /** @class */ function(_super) { - (0, _tslib.__extends)(IconBase, _super); - function IconBase(props) { - var _this = _super.call(this, props) || this; - _this._onImageLoadingStateChange = function(state) { - if (_this.props.imageProps && _this.props.imageProps.onLoadingStateChange) _this.props.imageProps.onLoadingStateChange(state); - if (state === (0, _imageTypes.ImageLoadState).error) _this.setState({ - imageLoadError: true - }); - }; - _this.state = { - imageLoadError: false - }; - return _this; + } + function createMemoizer(getValue2) { + if (!_weakMap) { + return getValue2; } - IconBase.prototype.render = function() { - var _a = this.props, children = _a.children, className = _a.className, styles = _a.styles, iconName = _a.iconName, imageErrorAs = _a.imageErrorAs, theme = _a.theme; - var isPlaceholder = typeof iconName === 'string' && iconName.length === 0; - var isImage = // eslint-disable-next-line deprecation/deprecation - !!this.props.imageProps || this.props.iconType === (0, _iconTypes.IconType).image || this.props.iconType === (0, _iconTypes.IconType).Image; - var iconContent = (0, _fontIcon.getIconContent)(iconName) || {}; - var iconClassName = iconContent.iconClassName, iconContentChildren = iconContent.children, mergeImageProps = iconContent.mergeImageProps; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - iconClassName: iconClassName, - isImage: isImage, - isPlaceholder: isPlaceholder - }); - var RootType = isImage ? 'span' : 'i'; - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.htmlElementProperties), [ - 'aria-label' - ]); - var imageLoadError = this.state.imageLoadError; - var imageProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.props.imageProps), { - onLoadingStateChange: this._onImageLoadingStateChange - }); - var ImageType = imageLoadError && imageErrorAs || (0, _image.Image); - // eslint-disable-next-line deprecation/deprecation - var ariaLabel = this.props['aria-label'] || this.props.ariaLabel; - var accessibleName = imageProps.alt || ariaLabel || this.props.title; - var hasName = !!(accessibleName || this.props['aria-labelledby'] || imageProps['aria-label'] || imageProps['aria-labelledby']); - var containerProps = hasName ? { - role: isImage || mergeImageProps ? undefined : 'img', - 'aria-label': isImage || mergeImageProps ? undefined : accessibleName - } : { - 'aria-hidden': true - }; - var finalIconContentChildren = iconContentChildren; - if (mergeImageProps && iconContentChildren && typeof iconContentChildren === 'object' && accessibleName) finalIconContentChildren = _react.cloneElement(iconContentChildren, { - alt: accessibleName - }); - return _react.createElement(RootType, (0, _tslib.__assign)({ - "data-icon-name": iconName - }, containerProps, nativeProps, mergeImageProps ? { - title: undefined, - 'aria-label': undefined - } : {}, { - className: classNames.root - }), isImage ? _react.createElement(ImageType, (0, _tslib.__assign)({}, imageProps)) : children || finalIconContentChildren); - }; - return IconBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./Icon.types":"aUXAd","../Image/Image":"5keBP","../Image/Image.types":"fYQRq","../../Utilities":"1NZCy","./FontIcon":"gQUPC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aUXAd":[function(require,module,exports,__globalThis) { -/** - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - * {@docCategory Icon} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconType", ()=>IconType); -var IconType; -(function(IconType) { - /** - * Render using the fabric icon font. - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["default"] = 0] = "default"; - /** - * Render using an image, where imageProps would be used. - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["image"] = 1] = "image"; - /** - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["Default"] = 100000] = "Default"; - /** - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["Image"] = 100001] = "Image"; -})(IconType || (IconType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5keBP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Image", ()=>Image); -var _utilities = require("../../Utilities"); -var _imageBase = require("./Image.base"); -var _imageStyles = require("./Image.styles"); -var Image = (0, _utilities.styled)((0, _imageBase.ImageBase), (0, _imageStyles.getStyles), undefined, { - scope: 'Image' -}, true); -Image.displayName = 'Image'; - -},{"../../Utilities":"1NZCy","./Image.base":"jzeV5","./Image.styles":"fI8tg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jzeV5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageBase", ()=>ImageBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _imageTypes = require("./Image.types"); -var _reactHooks = require("@fluentui/react-hooks"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var SVG_REGEX = /\.svg$/i; -var KEY_PREFIX = 'fabricImage'; -function useLoadState(props, imageElement) { - var onLoadingStateChange = props.onLoadingStateChange, onLoad = props.onLoad, onError = props.onError, src = props.src; - var _a = _react.useState((0, _imageTypes.ImageLoadState).notLoaded), loadState = _a[0], setLoadState = _a[1]; - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - // If the src property changes, reset the load state - // (does nothing if the load state is already notLoaded) - setLoadState((0, _imageTypes.ImageLoadState).notLoaded); - }, [ - src - ]); - // eslint-disable-next-line react-hooks/exhaustive-deps -- intended to run every render - _react.useEffect(function() { - if (loadState === (0, _imageTypes.ImageLoadState).notLoaded) { - // testing if naturalWidth and naturalHeight are greater than zero is better than checking - // .complete, because .complete will also be set to true if the image breaks. However, - // for some browsers, SVG images do not have a naturalWidth or naturalHeight, so fall back - // to checking .complete for these images. - var isLoaded = imageElement.current ? src && imageElement.current.naturalWidth > 0 && imageElement.current.naturalHeight > 0 || imageElement.current.complete && SVG_REGEX.test(src) : false; - if (isLoaded) setLoadState((0, _imageTypes.ImageLoadState).loaded); - } - }); - _react.useEffect(function() { - onLoadingStateChange === null || onLoadingStateChange === void 0 || onLoadingStateChange(loadState); - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run when loadState changes - }, [ - loadState - ]); - var onImageLoaded = _react.useCallback(function(ev) { - onLoad === null || onLoad === void 0 || onLoad(ev); - if (src) setLoadState((0, _imageTypes.ImageLoadState).loaded); - }, [ - src, - onLoad - ]); - var onImageError = _react.useCallback(function(ev) { - onError === null || onError === void 0 || onError(ev); - setLoadState((0, _imageTypes.ImageLoadState).error); - }, [ - onError - ]); - return [ - loadState, - onImageLoaded, - onImageError - ]; -} -var ImageBase = _react.forwardRef(function(props, forwardedRef) { - var frameElement = _react.useRef(); - var imageElement = _react.useRef(); - var _a = useLoadState(props, imageElement), loadState = _a[0], onImageLoaded = _a[1], onImageError = _a[2]; - var imageProps = (0, _utilities.getNativeProps)(props, (0, _utilities.imgProperties), [ - 'width', - 'height' - ]); - var src = props.src, alt = props.alt, width = props.width, height = props.height, _b = props.shouldFadeIn, shouldFadeIn = _b === void 0 ? true : _b, shouldStartVisible = props.shouldStartVisible, className = props.className, imageFit = props.imageFit, role = props.role, maximizeFrame = props.maximizeFrame, styles = props.styles, theme = props.theme, loading = props.loading; - var coverStyle = useCoverStyle(props, loadState, imageElement, frameElement); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - width: width, - height: height, - maximizeFrame: maximizeFrame, - shouldFadeIn: shouldFadeIn, - shouldStartVisible: shouldStartVisible, - isLoaded: loadState === (0, _imageTypes.ImageLoadState).loaded || loadState === (0, _imageTypes.ImageLoadState).notLoaded && props.shouldStartVisible, - isLandscape: coverStyle === (0, _imageTypes.ImageCoverStyle).landscape, - isCenter: imageFit === (0, _imageTypes.ImageFit).center, - isCenterContain: imageFit === (0, _imageTypes.ImageFit).centerContain, - isCenterCover: imageFit === (0, _imageTypes.ImageFit).centerCover, - isContain: imageFit === (0, _imageTypes.ImageFit).contain, - isCover: imageFit === (0, _imageTypes.ImageFit).cover, - isNone: imageFit === (0, _imageTypes.ImageFit).none, - isError: loadState === (0, _imageTypes.ImageLoadState).error, - isNotImageFit: imageFit === undefined - }); - // If image dimensions aren't specified, the natural size of the image is used. - return _react.createElement("div", { - className: classNames.root, - style: { - width: width, - height: height - }, - ref: frameElement - }, _react.createElement("img", (0, _tslib.__assign)({}, imageProps, { - onLoad: onImageLoaded, - onError: onImageError, - key: KEY_PREFIX + props.src || '', - className: classNames.image, - ref: (0, _reactHooks.useMergedRefs)(imageElement, forwardedRef), - src: src, - alt: alt, - role: role, - loading: loading - }))); -}); -ImageBase.displayName = 'ImageBase'; -function useCoverStyle(props, loadState, imageElement, frameElement) { - var previousLoadState = _react.useRef(loadState); - var coverStyle = _react.useRef(); - if (coverStyle === undefined || previousLoadState.current === (0, _imageTypes.ImageLoadState).notLoaded && loadState === (0, _imageTypes.ImageLoadState).loaded) coverStyle.current = computeCoverStyle(props, loadState, imageElement, frameElement); - previousLoadState.current = loadState; - return coverStyle.current; -} -function computeCoverStyle(props, loadState, imageElement, frameElement) { - var imageFit = props.imageFit, width = props.width, height = props.height; - // Do not compute cover style if it was already specified in props - if (props.coverStyle !== undefined) return props.coverStyle; - else if (loadState === (0, _imageTypes.ImageLoadState).loaded && (imageFit === (0, _imageTypes.ImageFit).cover || imageFit === (0, _imageTypes.ImageFit).contain || imageFit === (0, _imageTypes.ImageFit).centerContain || imageFit === (0, _imageTypes.ImageFit).centerCover) && imageElement.current && frameElement.current) { - // Determine the desired ratio using the width and height props. - // If those props aren't available, measure measure the frame. - var desiredRatio = void 0; - if (typeof width === 'number' && typeof height === 'number' && imageFit !== (0, _imageTypes.ImageFit).centerContain && imageFit !== (0, _imageTypes.ImageFit).centerCover) desiredRatio = width / height; - else desiredRatio = frameElement.current.clientWidth / frameElement.current.clientHeight; - // Examine the source image to determine its original ratio. - var naturalRatio = imageElement.current.naturalWidth / imageElement.current.naturalHeight; - // Should we crop from the top or the sides? - if (naturalRatio > desiredRatio) return (0, _imageTypes.ImageCoverStyle).landscape; - } - return (0, _imageTypes.ImageCoverStyle).portrait; -} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./Image.types":"fYQRq","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fYQRq":[function(require,module,exports,__globalThis) { -/** - * The possible methods that can be used to fit the image. - * {@docCategory Image} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageFit", ()=>ImageFit); -parcelHelpers.export(exports, "ImageCoverStyle", ()=>ImageCoverStyle); -parcelHelpers.export(exports, "ImageLoadState", ()=>ImageLoadState); -var ImageFit; -(function(ImageFit) { - /** - * The image is not scaled. The image is centered and cropped within the content box. - */ ImageFit[ImageFit["center"] = 0] = "center"; - /** - * The image is scaled to maintain its aspect ratio while being fully contained within the frame. The image will - * be centered horizontally and vertically within the frame. The space in the top and bottom or in the sides of - * the frame will be empty depending on the difference in aspect ratio between the image and the frame. - */ ImageFit[ImageFit["contain"] = 1] = "contain"; - /** - * The image is scaled to maintain its aspect ratio while filling the frame. Portions of the image will be cropped - * from the top and bottom, or the sides, depending on the difference in aspect ratio between the image and the frame. - */ ImageFit[ImageFit["cover"] = 2] = "cover"; - /** - * Neither the image nor the frame are scaled. If their sizes do not match, the image will either be cropped or the - * frame will have empty space. - */ ImageFit[ImageFit["none"] = 3] = "none"; - /** - * The image will be centered horizontally and vertically within the frame and maintains its aspect ratio. It will - * behave as ImageFit.center if the image's natural height or width is less than the Image frame's height or width, - * but if both natural height and width are larger than the frame it will behave as ImageFit.cover. - */ ImageFit[ImageFit["centerCover"] = 4] = "centerCover"; - /** - * The image will be centered horizontally and vertically within the frame and maintains its aspect ratio. It will - * behave as ImageFit.center if the image's natural height and width is less than the Image frame's height and width, - * but if either natural height or width are larger than the frame it will behave as ImageFit.contain. - */ ImageFit[ImageFit["centerContain"] = 5] = "centerContain"; -})(ImageFit || (ImageFit = {})); -var ImageCoverStyle; -(function(ImageCoverStyle) { - /** - * The image will be shown at 100% height of container and the width will be scaled accordingly - */ ImageCoverStyle[ImageCoverStyle["landscape"] = 0] = "landscape"; - /** - * The image will be shown at 100% width of container and the height will be scaled accordingly - */ ImageCoverStyle[ImageCoverStyle["portrait"] = 1] = "portrait"; -})(ImageCoverStyle || (ImageCoverStyle = {})); -var ImageLoadState; -(function(ImageLoadState) { - /** - * The image has not yet been loaded, and there is no error yet. - */ ImageLoadState[ImageLoadState["notLoaded"] = 0] = "notLoaded"; - /** - * The image has been loaded successfully. - */ ImageLoadState[ImageLoadState["loaded"] = 1] = "loaded"; - /** - * An error has been encountered while loading the image. - */ ImageLoadState[ImageLoadState["error"] = 2] = "error"; - /** - * @deprecated Not used. Use `onLoadingStateChange` and re-render the Image with a different src. - */ ImageLoadState[ImageLoadState["errorLoaded"] = 3] = "errorLoaded"; -})(ImageLoadState || (ImageLoadState = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2LHjM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// re-export since this is a hook, which people would reasonably expect to import from react-hooks -parcelHelpers.export(exports, "useIsomorphicLayoutEffect", ()=>(0, _utilities.useIsomorphicLayoutEffect)); -var _version = require("./version"); -var _useAsync = require("./useAsync"); -parcelHelpers.exportAll(_useAsync, exports); -var _useBoolean = require("./useBoolean"); -parcelHelpers.exportAll(_useBoolean, exports); -var _useConst = require("./useConst"); -parcelHelpers.exportAll(_useConst, exports); -var _useConstCallback = require("./useConstCallback"); -parcelHelpers.exportAll(_useConstCallback, exports); -var _useControllableValue = require("./useControllableValue"); -parcelHelpers.exportAll(_useControllableValue, exports); -var _useEventCallback = require("./useEventCallback"); -parcelHelpers.exportAll(_useEventCallback, exports); -var _useForceUpdate = require("./useForceUpdate"); -parcelHelpers.exportAll(_useForceUpdate, exports); -var _useId = require("./useId"); -parcelHelpers.exportAll(_useId, exports); -var _useMergedRefs = require("./useMergedRefs"); -parcelHelpers.exportAll(_useMergedRefs, exports); -var _useMount = require("./useMount"); -parcelHelpers.exportAll(_useMount, exports); -var _useMountSync = require("./useMountSync"); -parcelHelpers.exportAll(_useMountSync, exports); -var _useOnEvent = require("./useOnEvent"); -parcelHelpers.exportAll(_useOnEvent, exports); -var _usePrevious = require("./usePrevious"); -parcelHelpers.exportAll(_usePrevious, exports); -var _useRefEffect = require("./useRefEffect"); -parcelHelpers.exportAll(_useRefEffect, exports); -var _useSetInterval = require("./useSetInterval"); -parcelHelpers.exportAll(_useSetInterval, exports); -var _useSetTimeout = require("./useSetTimeout"); -parcelHelpers.exportAll(_useSetTimeout, exports); -var _useTarget = require("./useTarget"); -parcelHelpers.exportAll(_useTarget, exports); -var _useUnmount = require("./useUnmount"); -parcelHelpers.exportAll(_useUnmount, exports); -var _useWarnings = require("./useWarnings"); -parcelHelpers.exportAll(_useWarnings, exports); -var _utilities = require("@fluentui/utilities"); - -},{"./version":"dfLIU","./useAsync":"59zc5","./useBoolean":"z2bLn","./useConst":"flUwA","./useConstCallback":"dYnED","./useControllableValue":"jzIvg","./useEventCallback":"eQrXT","./useForceUpdate":"68Qoo","./useId":"hSNPu","./useMergedRefs":"h89Si","./useMount":"cIQtY","./useMountSync":"2Zqci","./useOnEvent":"hr82L","./usePrevious":"5S4Wu","./useRefEffect":"4xx4j","./useSetInterval":"icdCd","./useSetTimeout":"fsPaE","./useTarget":"7N9lH","./useUnmount":"jioLf","./useWarnings":"6VfEj","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfLIU":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react-hooks', '8.8.16'); - -},{"@fluentui/set-version":"iqYXf"}],"59zc5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to provide an Async instance that is automatically cleaned up on dismount. - */ parcelHelpers.export(exports, "useAsync", ()=>useAsync); -var _utilities = require("@fluentui/utilities"); -var _react = require("react"); -function useAsync() { - var asyncRef = _react.useRef(); - if (!asyncRef.current) asyncRef.current = new (0, _utilities.Async)(); - _react.useEffect(function() { - return function() { - var _a; - (_a = asyncRef.current) === null || _a === void 0 || _a.dispose(); - asyncRef.current = undefined; - }; - }, []); - return asyncRef.current; -} - -},{"@fluentui/utilities":"55bj3","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"z2bLn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to store a value and generate callbacks for setting the value to true or false. - * The identity of the callbacks will always stay the same. - * - * @param initialState - Initial value - * @returns Array with the current value and an object containing the updater callbacks. - */ parcelHelpers.export(exports, "useBoolean", ()=>useBoolean); -var _react = require("react"); -var _useConst = require("./useConst"); -function useBoolean(initialState) { - var _a = _react.useState(initialState), value = _a[0], setValue = _a[1]; - var setTrue = (0, _useConst.useConst)(function() { - return function() { - setValue(true); - }; - }); - var setFalse = (0, _useConst.useConst)(function() { - return function() { - setValue(false); - }; - }); - var toggle = (0, _useConst.useConst)(function() { - return function() { - setValue(function(currentValue) { - return !currentValue; - }); - }; - }); - return [ - value, - { - setTrue: setTrue, - setFalse: setFalse, - toggle: toggle - } - ]; -} - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flUwA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to - * always return the same value (and if the initializer is a function, only call it once). - * This is similar to setting a private member in a class constructor. - * - * If the value should ever change based on dependencies, use `React.useMemo` instead. - * - * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`, - * only the value/function passed in the first time this is called is respected. - * @returns The value. The identity of this value will always be the same. - */ parcelHelpers.export(exports, "useConst", ()=>useConst); -var _react = require("react"); -function useConst(initialValue) { - // Use useRef to store the value because it's the least expensive built-in hook that works here - // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive - // internally due to reducer handling which we don't need) - var ref = _react.useRef(); - if (ref.current === undefined) // Box the value in an object so we can tell if it's initialized even if the initializer - // returns/is undefined - ref.current = { - value: typeof initialValue === 'function' ? initialValue() : initialValue - }; - return ref.current.value; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dYnED":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead. - * If you need a callback reference that never changes, consider `useEventCallback`. - * - * This hook was intended for creating callbacks which have no dependencies, and therefore never - * need to change. It works fine if everyone using it is extremely mindful of how closures work, - * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs - * like unintentionally capturing the first value of a prop and not respecting updates (when - * updates should be respected). - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "useConstCallback", ()=>useConstCallback); -var _react = require("react"); -function useConstCallback(callback) { - var ref = _react.useRef(); - if (!ref.current) ref.current = callback; - return ref.current; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jzIvg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useControllableValue", ()=>useControllableValue); -var _react = require("react"); -var _useConst = require("./useConst"); -function useControllableValue(controlledValue, defaultUncontrolledValue, onChange) { - var _a = _react.useState(defaultUncontrolledValue), value = _a[0], setValue = _a[1]; - var isControlled = (0, _useConst.useConst)(controlledValue !== undefined); - var currentValue = isControlled ? controlledValue : value; - // Duplicate the current value and onChange in refs so they're accessible from - // setValueOrCallOnChange without creating a new callback every time - var valueRef = _react.useRef(currentValue); - var onChangeRef = _react.useRef(onChange); - _react.useEffect(function() { - valueRef.current = currentValue; - onChangeRef.current = onChange; - }); - // To match the behavior of the setter returned by React.useState, this callback's identity - // should never change. This means it MUST NOT directly reference variables that can change. - var setValueOrCallOnChange = (0, _useConst.useConst)(function() { - return function(update, ev) { - // Assuming here that TValue is not a function, because a controllable value will typically - // be something a user can enter as input - var newValue = typeof update === 'function' ? update(valueRef.current) : update; - if (onChangeRef.current) onChangeRef.current(ev, newValue); - if (!isControlled) setValue(newValue); - }; - }); - return [ - currentValue, - setValueOrCallOnChange - ]; -} - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQrXT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Modified `useCallback` that returns the same function reference every time, but internally calls - * the most-recently passed callback implementation. Can be useful in situations such as: - * - Event handler dependencies change too frequently, such as user props which might change on - * every render, or volatile values such as useState/useDispatch - * - Callback must be referenced in a captured context (such as a window event handler or unmount - * handler that's registered once) but needs access to the latest props - * - * In general, prefer `useCallback` unless you've encountered one of the problems above. - * - * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback - * - * @param fn - The callback function that will be used - * @returns A function which is referentially stable but internally calls the most recently passed callback - */ parcelHelpers.export(exports, "useEventCallback", ()=>useEventCallback); -var _react = require("react"); -var _useConst = require("./useConst"); -var _utilities = require("@fluentui/utilities"); -function useEventCallback(fn) { - var callbackRef = _react.useRef(function() { - throw new Error('Cannot call an event handler while rendering'); - }); - (0, _utilities.useIsomorphicLayoutEffect)(function() { - callbackRef.current = fn; - }, [ - fn - ]); - // useConst rather than useCallback to ensure the reference is always stable - // (useCallback's deps list is an optimization, not a guarantee) - return (0, _useConst.useConst)(function() { - return function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - var callback = callbackRef.current; - return callback.apply(void 0, args); - }; - }); -} - -},{"react":"jGrId","./useConst":"flUwA","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"68Qoo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to force update a function component by updating a dummy state. - */ parcelHelpers.export(exports, "useForceUpdate", ()=>useForceUpdate); -var _react = require("react"); -var _useConst = require("./useConst"); -function useForceUpdate() { - var _a = _react.useState(0), setValue = _a[1]; - var forceUpdate = (0, _useConst.useConst)(function() { - return function() { - return setValue(function(value) { - return ++value; - }); - }; - }); - return forceUpdate; -} - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hSNPu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library). - * - * @param prefix - Optional prefix for the ID - * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present, - * without conditioning the hook call - * @returns The ID - */ parcelHelpers.export(exports, "useId", ()=>useId); -var _react = require("react"); -var _utilities = require("@fluentui/utilities"); -function useId(prefix, providedId) { - // getId should only be called once since it updates the global constant for the next ID value. - // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.) - var ref = _react.useRef(providedId); - if (!ref.current) ref.current = (0, _utilities.getId)(prefix); - return ref.current; -} - -},{"react":"jGrId","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h89Si":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that - * updates all provided refs - * @param refs - Refs to collectively update with one ref value. - * @returns A function with an attached "current" prop, so that it can be treated like a RefObject. - */ parcelHelpers.export(exports, "useMergedRefs", ()=>useMergedRefs); -var _tslib = require("tslib"); -var _react = require("react"); -function useMergedRefs() { - var refs = []; - for(var _i = 0; _i < arguments.length; _i++)refs[_i] = arguments[_i]; - var mergedCallback = _react.useCallback(function(value) { - // Update the "current" prop hanging on the function. - mergedCallback.current = value; - for(var _i = 0, refs_1 = refs; _i < refs_1.length; _i++){ - var ref = refs_1[_i]; - if (typeof ref === 'function') ref(value); - else if (ref) // work around the immutability of the React.Ref type - ref.current = value; - } - }, (0, _tslib.__spreadArray)([], refs, true)); - return mergedCallback; -} - -},{"tslib":"9gizs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cIQtY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMount", ()=>useMount); -var _react = require("react"); -var useMount = function(callback) { - var mountRef = _react.useRef(callback); - mountRef.current = callback; - _react.useEffect(function() { - var _a; - (_a = mountRef.current) === null || _a === void 0 || _a.call(mountRef); - }, []); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Zqci":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMountSync", ()=>useMountSync); -var _react = require("react"); -var useMountSync = function(callback) { - var mountRef = _react.useRef(callback); - mountRef.current = callback; - // eslint-disable-next-line no-restricted-properties - _react.useLayoutEffect(function() { - var _a; - (_a = mountRef.current) === null || _a === void 0 || _a.call(mountRef); - }, []); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hr82L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to attach an event handler on mount and handle cleanup. - * @param element - Element (or ref to an element) to attach the event handler to - * @param eventName - The event to attach a handler for - * @param callback - The handler for the event - * @param useCapture - Whether or not to attach the handler for the capture phase - */ parcelHelpers.export(exports, "useOnEvent", ()=>useOnEvent); -var _utilities = require("@fluentui/utilities"); -var _react = require("react"); -function useOnEvent(element, eventName, callback, useCapture) { - // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders - var callbackRef = _react.useRef(callback); - callbackRef.current = callback; - _react.useEffect(function() { - var actualElement = element && 'current' in element ? element.current : element; - if (!actualElement || !actualElement.addEventListener) return; - var dispose = (0, _utilities.on)(actualElement, eventName, function(ev) { - return callbackRef.current(ev); - }, useCapture); - return dispose; - }, [ - element, - eventName, - useCapture - ]); -} - -},{"@fluentui/utilities":"55bj3","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5S4Wu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook keeping track of a given value from a previous execution of the component the Hook is used in. - * - * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state) - */ parcelHelpers.export(exports, "usePrevious", ()=>usePrevious); -var _react = require("react"); -function usePrevious(value) { - var ref = (0, _react.useRef)(); - (0, _react.useEffect)(function() { - ref.current = value; - }); - return ref.current; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4xx4j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return - * a cleanup function that'll be called before the value changes, and when the ref is unmounted. - * - * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see - * https://github.com/facebook/react/issues/14387#issuecomment-503616820). - * - * Usage example: - * ```ts - * const myRef = useRefEffect<HTMLElement>(element => { - * ... - * return () => { ... cleanup ... }; - * }); - * ``` - * ```jsx - * <div ref={myRef} /> - * ``` - * - * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function. - * @param initial - (Optional) The initial value for the ref. - * - * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be - * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property. - */ parcelHelpers.export(exports, "useRefEffect", ()=>useRefEffect); -var _react = require("react"); -function useRefEffect(callback, initial) { - if (initial === void 0) initial = null; - var createRefCallback = function() { - var refCallback = function(value) { - if (data.ref.current !== value) { - if (data.cleanup) { - data.cleanup(); - data.cleanup = undefined; - } - data.ref.current = value; - if (value !== null) data.cleanup = data.callback(value); - } - }; - refCallback.current = initial; - return refCallback; - }; - var data = _react.useRef({ - ref: createRefCallback(), - callback: callback - }).current; - data.callback = callback; - return data.ref; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"icdCd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useSetInterval", ()=>useSetInterval); -var _react = require("react"); -var _useConst = require("./useConst"); -var useSetInterval = function() { - var intervalIds = (0, _useConst.useConst)({}); - _react.useEffect(function() { - return function() { - for(var _i = 0, _a = Object.keys(intervalIds); _i < _a.length; _i++){ - var id = _a[_i]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - clearInterval(id); - } + var cache2 = new _weakMap(); + function memoizedGetValue(input) { + if (!input || typeof input !== "function" && typeof input !== "object") { + return getValue2(input); + } + if (cache2.has(input)) { + return cache2.get(input); + } + var value2 = getValue2(input); + cache2.set(input, value2); + return value2; + } + return memoizedGetValue; + } + function _normalizeArg(val) { + if (!val) { + return _emptyObject; + } else if (typeof val === "object" || typeof val === "function") { + return val; + } else if (!_dictionary[val]) { + _dictionary[val] = { val }; + } + return _dictionary[val]; + } + function _createNode() { + return { + map: _weakMap ? new _weakMap() : null + }; + } + function createComposedComponent(outer) { + var Outer = outer; + var outerMemoizer = createMemoizer(function(inner) { + if (outer === inner) { + throw new Error("Attempted to compose a component with itself."); + } + var Inner = inner; + var innerMemoizer = createMemoizer(function(defaultRender) { + var InnerWithDefaultRender = function(innerProps) { + return React__namespace.createElement(Inner, __assign$1({}, innerProps, { defaultRender })); }; - }, // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that - [ - intervalIds - ]); - return (0, _useConst.useConst)({ - setInterval: function(func, duration) { - var id = setInterval(func, duration); - intervalIds[id] = 1; - return id; - }, - clearInterval: function(id) { - delete intervalIds[id]; - clearInterval(id); - } + return InnerWithDefaultRender; + }); + var OuterWithDefaultRender = function(outerProps) { + var defaultRender = outerProps.defaultRender; + return React__namespace.createElement(Outer, __assign$1({}, outerProps, { defaultRender: defaultRender ? innerMemoizer(defaultRender) : Inner })); + }; + return OuterWithDefaultRender; }); -}; - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fsPaE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useSetTimeout", ()=>useSetTimeout); -var _react = require("react"); -var _useConst = require("./useConst"); -var useSetTimeout = function() { - var timeoutIds = (0, _useConst.useConst)({}); - // Cleanup function. - _react.useEffect(function() { - return function() { - for(var _i = 0, _a = Object.keys(timeoutIds); _i < _a.length; _i++){ - var id = _a[_i]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - clearTimeout(id); + return outerMemoizer; + } + var componentAsMemoizer = createMemoizer(createComposedComponent); + function composeComponentAs(outer, inner) { + return componentAsMemoizer(outer)(inner); + } + function isControlled(props, valueProp) { + return props[valueProp] !== void 0 && props[valueProp] !== null; + } + function css() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var classes = []; + for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) { + var arg = args_1[_a2]; + if (arg) { + if (typeof arg === "string") { + classes.push(arg); + } else if (arg.hasOwnProperty("toString") && typeof arg.toString === "function") { + classes.push(arg.toString()); + } else { + for (var key2 in arg) { + if (arg[key2]) { + classes.push(key2); } - }; - }, // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that - [ - timeoutIds - ]); - // Return wrapper which will auto cleanup. - return (0, _useConst.useConst)({ - setTimeout: function(func, duration) { - var id = setTimeout(func, duration); - timeoutIds[id] = 1; - return id; - }, - clearTimeout: function(id) { - delete timeoutIds[id]; - clearTimeout(id); + } } - }); -}; - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7N9lH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to calculate and cache the target element specified by the given target attribute, - * as well as the target element's (or host element's) parent window - * @param target- Target selector passed to the component as a property, describing the element that - * the callout should target - * @param hostElement- The callout's host element, used for determining the parent window. - */ parcelHelpers.export(exports, "useTarget", ()=>useTarget); -var _utilities = require("@fluentui/utilities"); -var _react = require("react"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -function useTarget(target, hostElement) { - var _a, _b, _c; - var previousTargetProp = _react.useRef(); - var targetRef = _react.useRef(null); - /** - * Stores an instance of Window, used to check - * for server side rendering and if focus was lost. - */ var targetWindow = (0, _reactWindowProvider.useWindow)(); - // If the target element changed, find the new one. If we are tracking - // target with class name, always find element because we do not know if - // fabric has rendered a new element and disposed the old element. - if (!target || target !== previousTargetProp.current || typeof target === 'string') { - var currentElement = hostElement === null || hostElement === void 0 ? void 0 : hostElement.current; - if (target) { - if (typeof target === 'string') { - // If element is part of shadow dom, then querySelector on shadow root, else query on document - if ((_a = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _a === void 0 ? void 0 : _a.host) targetRef.current = (_c = (_b = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _b === void 0 ? void 0 : _b.querySelector(target)) !== null && _c !== void 0 ? _c : null; - else { - var currentDoc = (0, _utilities.getDocument)(currentElement); - targetRef.current = currentDoc ? currentDoc.querySelector(target) : null; - } - } else if ('stopPropagation' in target) targetRef.current = target; - else if ('getBoundingClientRect' in target) targetRef.current = target; - else if ('current' in target) targetRef.current = target.current; - else targetRef.current = target; + } + } + return classes.join(" "); + } + var CustomizationsGlobalKey = "customizations"; + var NO_CUSTOMIZATIONS = { settings: {}, scopedSettings: {}, inCustomizerContext: false }; + var _allSettings = GlobalSettings.getValue(CustomizationsGlobalKey, { + settings: {}, + scopedSettings: {}, + inCustomizerContext: false + }); + var _events = []; + var Customizations = ( + /** @class */ + (function() { + function Customizations2() { + } + Customizations2.reset = function() { + _allSettings.settings = {}; + _allSettings.scopedSettings = {}; + }; + Customizations2.applySettings = function(settings) { + _allSettings.settings = __assign$1(__assign$1({}, _allSettings.settings), settings); + Customizations2._raiseChange(); + }; + Customizations2.applyScopedSettings = function(scopeName, settings) { + _allSettings.scopedSettings[scopeName] = __assign$1(__assign$1({}, _allSettings.scopedSettings[scopeName]), settings); + Customizations2._raiseChange(); + }; + Customizations2.getSettings = function(properties, scopeName, localSettings) { + if (localSettings === void 0) { + localSettings = NO_CUSTOMIZATIONS; } - previousTargetProp.current = target; + var settings = {}; + var localScopedSettings = scopeName && localSettings.scopedSettings[scopeName] || {}; + var globalScopedSettings = scopeName && _allSettings.scopedSettings[scopeName] || {}; + for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { + var property2 = properties_1[_i]; + settings[property2] = localScopedSettings[property2] || localSettings.settings[property2] || globalScopedSettings[property2] || _allSettings.settings[property2]; + } + return settings; + }; + Customizations2.applyBatchedUpdates = function(code, suppressUpdate) { + Customizations2._suppressUpdates = true; + try { + code(); + } catch (_a2) { + } + Customizations2._suppressUpdates = false; + if (!suppressUpdate) { + Customizations2._raiseChange(); + } + }; + Customizations2.observe = function(onChange) { + _events.push(onChange); + }; + Customizations2.unobserve = function(onChange) { + _events = _events.filter(function(cb) { + return cb !== onChange; + }); + }; + Customizations2._raiseChange = function() { + if (!Customizations2._suppressUpdates) { + _events.forEach(function(cb) { + return cb(); + }); + } + }; + return Customizations2; + })() + ); + var CustomizerContext = React__namespace.createContext({ + customizations: { + inCustomizerContext: false, + settings: {}, + scopedSettings: {} } - return [ - targetRef, - targetWindow - ]; -} - -},{"@fluentui/utilities":"55bj3","react":"jGrId","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jioLf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useUnmount", ()=>useUnmount); -var _react = require("react"); -var useUnmount = function(callback) { - var unmountRef = _react.useRef(callback); - unmountRef.current = callback; - _react.useEffect(function() { - return function() { - var _a; - (_a = unmountRef.current) === null || _a === void 0 || _a.call(unmountRef); + }); + function mergeSettings(oldSettings, newSettings) { + if (oldSettings === void 0) { + oldSettings = {}; + } + var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _settingsMergeWith(newSettings); + return mergeSettingsWith(oldSettings); + } + function mergeScopedSettings(oldSettings, newSettings) { + if (oldSettings === void 0) { + oldSettings = {}; + } + var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _scopedSettingsMergeWith(newSettings); + return mergeSettingsWith(oldSettings); + } + function _isSettingsFunction(settings) { + return typeof settings === "function"; + } + function _settingsMergeWith(newSettings) { + return function(settings) { + return newSettings ? __assign$1(__assign$1({}, settings), newSettings) : settings; + }; + } + function _scopedSettingsMergeWith(scopedSettingsFromProps) { + if (scopedSettingsFromProps === void 0) { + scopedSettingsFromProps = {}; + } + return function(oldScopedSettings) { + var newScopedSettings = __assign$1({}, oldScopedSettings); + for (var scopeName in scopedSettingsFromProps) { + if (scopedSettingsFromProps.hasOwnProperty(scopeName)) { + newScopedSettings[scopeName] = __assign$1(__assign$1({}, oldScopedSettings[scopeName]), scopedSettingsFromProps[scopeName]); + } + } + return newScopedSettings; + }; + } + function mergeCustomizations(props, parentContext) { + var _a2 = (parentContext || {}).customizations, customizations = _a2 === void 0 ? { settings: {}, scopedSettings: {} } : _a2; + return { + customizations: { + settings: mergeSettings(customizations.settings, props.settings), + scopedSettings: mergeScopedSettings(customizations.scopedSettings, props.scopedSettings), + inCustomizerContext: true + } + }; + } + var Customizer = ( + /** @class */ + (function(_super) { + __extends(Customizer2, _super); + function Customizer2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._onCustomizationChange = function() { + return _this.forceUpdate(); }; - }, []); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6VfEj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Only in development mode, display console warnings when certain conditions are met. - * Note that all warnings except `controlledUsage` will only be shown on first render - * (new `controlledUsage` warnings may be shown later due to prop changes). - */ parcelHelpers.export(exports, "useWarnings", ()=>useWarnings); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("@fluentui/utilities"); -var _usePrevious = require("./usePrevious"); -var _useConst = require("./useConst"); -var warningId = 0; -function useWarnings(options) { - var name_1, props, _a, other, conditionallyRequired, deprecations, mutuallyExclusive, controlledUsage, hasWarnedRef, componentId, oldProps, _i, other_1, warning, _b, conditionallyRequired_1, req; -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/utilities":"55bj3","./usePrevious":"5S4Wu","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fI8tg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var GlobalClassNames = { - root: 'ms-Image', - rootMaximizeFrame: 'ms-Image--maximizeFrame', - image: 'ms-Image-image', - imageCenter: 'ms-Image-image--center', - imageContain: 'ms-Image-image--contain', - imageCover: 'ms-Image-image--cover', - imageCenterContain: 'ms-Image-image--centerContain', - imageCenterCover: 'ms-Image-image--centerCover', - imageNone: 'ms-Image-image--none', - imageLandscape: 'ms-Image-image--landscape', - imagePortrait: 'ms-Image-image--portrait' -}; -var getStyles = function(props) { - var className = props.className, width = props.width, height = props.height, maximizeFrame = props.maximizeFrame, isLoaded = props.isLoaded, shouldFadeIn = props.shouldFadeIn, shouldStartVisible = props.shouldStartVisible, isLandscape = props.isLandscape, isCenter = props.isCenter, isContain = props.isContain, isCover = props.isCover, isCenterContain = props.isCenterContain, isCenterCover = props.isCenterCover, isNone = props.isNone, isError = props.isError, isNotImageFit = props.isNotImageFit, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var ImageFitStyles = { - position: 'absolute', - left: '50% /* @noflip */', - top: '50%', - transform: 'translate(-50%,-50%)' - }; - // Cut the mustard using msMaxTouchPoints to detect IE11 which does not support CSS object-fit - var window = (0, _utilities.getWindow)(); - var supportsObjectFit = window !== undefined && // eslint-disable-next-line @fluentui/max-len - // cast needed as vendor prefixed `msMaxTouchPoints` api is no longer part of TS lib declaration - introduced with TS 4.4 - window.navigator.msMaxTouchPoints === undefined; - var fallbackObjectFitStyles = isContain && isLandscape || isCover && !isLandscape ? { - width: '100%', - height: 'auto' - } : { - width: 'auto', - height: '100%' + return _this; + } + Customizer2.prototype.componentDidMount = function() { + Customizations.observe(this._onCustomizationChange); + }; + Customizer2.prototype.componentWillUnmount = function() { + Customizations.unobserve(this._onCustomizationChange); + }; + Customizer2.prototype.render = function() { + var _this = this; + var contextTransform = this.props.contextTransform; + return React__namespace.createElement(CustomizerContext.Consumer, null, function(parentContext) { + var newContext = mergeCustomizations(_this.props, parentContext); + if (contextTransform) { + newContext = contextTransform(newContext); + } + return React__namespace.createElement(CustomizerContext.Provider, { value: newContext }, _this.props.children); + }); + }; + return Customizer2; + })(React__namespace.Component) + ); + function hoistStatics(source2, dest) { + for (var name_1 in source2) { + if (source2.hasOwnProperty(name_1)) { + dest[name_1] = source2[name_1]; + } + } + return dest; + } + var noop$5 = function() { + return false; + }; + var noopShadow = function() { + return DEFAULT_SHADOW_CONFIG; + }; + var noopRootStylesheets = function() { + return /* @__PURE__ */ new Map(); + }; + var noopUndefined = function() { + return void 0; + }; + var getNewContext = function() { + return { + stylesheets: /* @__PURE__ */ new Map(), + useAdoptedStylesheetEx: noop$5, + useAdoptedStylesheet: noop$5, + useShadowConfig: noopShadow, + useMergeStylesShadowRootContext: noopUndefined, + useHasMergeStylesShadowRootContext: noop$5, + useMergeStylesRootStylesheets: noopRootStylesheets, + useWindow: noopUndefined, + useStyled: noopUndefined }; + }; + var MergeStylesDefaultContext = React__namespace.createContext(getNewContext()); + var useMergeStylesHooks = function() { + var ctx = React__namespace.useContext(MergeStylesDefaultContext); return { - root: [ - classNames.root, - theme.fonts.medium, - { - overflow: 'hidden' - }, - maximizeFrame && [ - classNames.rootMaximizeFrame, - { - height: '100%', - width: '100%' - } - ], - isLoaded && shouldFadeIn && !shouldStartVisible && (0, _styling.AnimationClassNames).fadeIn400, - (isCenter || isContain || isCover || isCenterContain || isCenterCover) && { - position: 'relative' - }, - className - ], - image: [ - classNames.image, - { - display: 'block', - opacity: 0 - }, - isLoaded && [ - 'is-loaded', - { - opacity: 1 - } - ], - isCenter && [ - classNames.imageCenter, - ImageFitStyles - ], - isContain && [ - classNames.imageContain, - supportsObjectFit && { - width: '100%', - height: '100%', - objectFit: 'contain' - }, - !supportsObjectFit && fallbackObjectFitStyles, - !supportsObjectFit && ImageFitStyles - ], - isCover && [ - classNames.imageCover, - supportsObjectFit && { - width: '100%', - height: '100%', - objectFit: 'cover' - }, - !supportsObjectFit && fallbackObjectFitStyles, - !supportsObjectFit && ImageFitStyles - ], - isCenterContain && [ - classNames.imageCenterContain, - isLandscape && { - maxWidth: '100%' - }, - !isLandscape && { - maxHeight: '100%' - }, - ImageFitStyles - ], - isCenterCover && [ - classNames.imageCenterCover, - isLandscape && { - maxHeight: '100%' - }, - !isLandscape && { - maxWidth: '100%' - }, - ImageFitStyles - ], - isNone && [ - classNames.imageNone, - { - width: 'auto', - height: 'auto' - } - ], - isNotImageFit && [ - !!width && !height && { - height: 'auto', - width: '100%' - }, - !width && !!height && { - height: '100%', - width: 'auto' - }, - !!width && !!height && { - height: '100%', - width: '100%' - } - ], - isLandscape && classNames.imageLandscape, - !isLandscape && classNames.imagePortrait, - !isLoaded && 'is-notLoaded', - shouldFadeIn && 'is-fadeIn', - isError && 'is-error' - ] + useAdoptedStylesheet: ctx.useAdoptedStylesheet, + useAdoptedStylesheetEx: ctx.useAdoptedStylesheetEx, + useShadowConfig: ctx.useShadowConfig, + useMergeStylesShadowRootContext: ctx.useMergeStylesShadowRootContext, + useHasMergeStylesShadowRootContext: ctx.useHasMergeStylesShadowRootContext, + useMergeStylesRootStylesheets: ctx.useMergeStylesRootStylesheets, + useWindow: ctx.useWindow, + useStyled: ctx.useStyled }; -}; - -},{"../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hTimn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>(0, _styleUtilities.AnimationClassNames)); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _styleUtilities.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _styleUtilities.AnimationVariables)); -parcelHelpers.export(exports, "ColorClassNames", ()=>(0, _styleUtilities.ColorClassNames)); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _styleUtilities.DefaultEffects)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _styleUtilities.DefaultFontStyles)); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _styleUtilities.DefaultPalette)); -parcelHelpers.export(exports, "EdgeChromiumHighContrastSelector", ()=>(0, _styleUtilities.EdgeChromiumHighContrastSelector)); -parcelHelpers.export(exports, "FontClassNames", ()=>(0, _styleUtilities.FontClassNames)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _styleUtilities.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _styleUtilities.FontWeights)); -parcelHelpers.export(exports, "HighContrastSelector", ()=>(0, _styleUtilities.HighContrastSelector)); -parcelHelpers.export(exports, "HighContrastSelectorBlack", ()=>(0, _styleUtilities.HighContrastSelectorBlack)); -parcelHelpers.export(exports, "HighContrastSelectorWhite", ()=>(0, _styleUtilities.HighContrastSelectorWhite)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _styleUtilities.IconFontSizes)); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _styleUtilities.InjectionMode)); -parcelHelpers.export(exports, "PulsingBeaconAnimationStyles", ()=>(0, _styleUtilities.PulsingBeaconAnimationStyles)); -parcelHelpers.export(exports, "ScreenWidthMaxLarge", ()=>(0, _styleUtilities.ScreenWidthMaxLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxMedium", ()=>(0, _styleUtilities.ScreenWidthMaxMedium)); -parcelHelpers.export(exports, "ScreenWidthMaxSmall", ()=>(0, _styleUtilities.ScreenWidthMaxSmall)); -parcelHelpers.export(exports, "ScreenWidthMaxXLarge", ()=>(0, _styleUtilities.ScreenWidthMaxXLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxXXLarge", ()=>(0, _styleUtilities.ScreenWidthMaxXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinLarge", ()=>(0, _styleUtilities.ScreenWidthMinLarge)); -parcelHelpers.export(exports, "ScreenWidthMinMedium", ()=>(0, _styleUtilities.ScreenWidthMinMedium)); -parcelHelpers.export(exports, "ScreenWidthMinSmall", ()=>(0, _styleUtilities.ScreenWidthMinSmall)); -parcelHelpers.export(exports, "ScreenWidthMinUhfMobile", ()=>(0, _styleUtilities.ScreenWidthMinUhfMobile)); -parcelHelpers.export(exports, "ScreenWidthMinXLarge", ()=>(0, _styleUtilities.ScreenWidthMinXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXLarge", ()=>(0, _styleUtilities.ScreenWidthMinXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXXLarge", ()=>(0, _styleUtilities.ScreenWidthMinXXXLarge)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _styleUtilities.Stylesheet)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>(0, _styleUtilities.ThemeSettingName)); -parcelHelpers.export(exports, "ZIndexes", ()=>(0, _styleUtilities.ZIndexes)); -parcelHelpers.export(exports, "buildClassMap", ()=>(0, _styleUtilities.buildClassMap)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _styleUtilities.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _styleUtilities.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _styleUtilities.createFontStyles)); -parcelHelpers.export(exports, "focusClear", ()=>(0, _styleUtilities.focusClear)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _styleUtilities.fontFace)); -parcelHelpers.export(exports, "getEdgeChromiumNoHighContrastAdjustSelector", ()=>(0, _styleUtilities.getEdgeChromiumNoHighContrastAdjustSelector)); -parcelHelpers.export(exports, "getFadedOverflowStyle", ()=>(0, _styleUtilities.getFadedOverflowStyle)); -parcelHelpers.export(exports, "getFocusOutlineStyle", ()=>(0, _styleUtilities.getFocusOutlineStyle)); -parcelHelpers.export(exports, "getFocusStyle", ()=>(0, _styleUtilities.getFocusStyle)); -parcelHelpers.export(exports, "getGlobalClassNames", ()=>(0, _styleUtilities.getGlobalClassNames)); -parcelHelpers.export(exports, "getHighContrastNoAdjustStyle", ()=>(0, _styleUtilities.getHighContrastNoAdjustStyle)); -parcelHelpers.export(exports, "getIcon", ()=>(0, _styleUtilities.getIcon)); -parcelHelpers.export(exports, "getIconClassName", ()=>(0, _styleUtilities.getIconClassName)); -parcelHelpers.export(exports, "getInputFocusStyle", ()=>(0, _styleUtilities.getInputFocusStyle)); -parcelHelpers.export(exports, "getPlaceholderStyles", ()=>(0, _styleUtilities.getPlaceholderStyles)); -parcelHelpers.export(exports, "getScreenSelector", ()=>(0, _styleUtilities.getScreenSelector)); -parcelHelpers.export(exports, "getTheme", ()=>(0, _styleUtilities.getTheme)); -parcelHelpers.export(exports, "getThemedContext", ()=>(0, _styleUtilities.getThemedContext)); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>(0, _styleUtilities.hiddenContentStyle)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _styleUtilities.keyframes)); -parcelHelpers.export(exports, "loadTheme", ()=>(0, _styleUtilities.loadTheme)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _styleUtilities.mergeStyleSets)); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _styleUtilities.mergeStyles)); -parcelHelpers.export(exports, "noWrap", ()=>(0, _styleUtilities.noWrap)); -parcelHelpers.export(exports, "normalize", ()=>(0, _styleUtilities.normalize)); -parcelHelpers.export(exports, "registerIconAlias", ()=>(0, _styleUtilities.registerIconAlias)); -parcelHelpers.export(exports, "registerIcons", ()=>(0, _styleUtilities.registerIcons)); -parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>(0, _styleUtilities.registerOnThemeChangeCallback)); -parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>(0, _styleUtilities.removeOnThemeChangeCallback)); -parcelHelpers.export(exports, "setIconOptions", ()=>(0, _styleUtilities.setIconOptions)); -parcelHelpers.export(exports, "unregisterIcons", ()=>(0, _styleUtilities.unregisterIcons)); -parcelHelpers.export(exports, "createTheme", ()=>(0, _theme.createTheme)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _theme.registerDefaultFontFaces)); -var _version = require("./version"); -var _styleUtilities = require("@fluentui/style-utilities"); -var _theme = require("@fluentui/theme"); - -},{"./version":"6kzFC","@fluentui/style-utilities":"bJvmh","@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bJvmh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>(0, _index.AnimationClassNames)); -parcelHelpers.export(exports, "FontClassNames", ()=>(0, _index.FontClassNames)); -parcelHelpers.export(exports, "ColorClassNames", ()=>(0, _index.ColorClassNames)); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _index1.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _index1.AnimationVariables)); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _index1.DefaultPalette)); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _index1.DefaultEffects)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _index1.DefaultFontStyles)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _index1.registerDefaultFontFaces)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _index1.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _index1.FontWeights)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _index1.IconFontSizes)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _index1.createFontStyles)); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>(0, _index1.hiddenContentStyle)); -parcelHelpers.export(exports, "PulsingBeaconAnimationStyles", ()=>(0, _index1.PulsingBeaconAnimationStyles)); -parcelHelpers.export(exports, "getGlobalClassNames", ()=>(0, _index1.getGlobalClassNames)); -parcelHelpers.export(exports, "getFocusStyle", ()=>(0, _index1.getFocusStyle)); -parcelHelpers.export(exports, "getFocusOutlineStyle", ()=>(0, _index1.getFocusOutlineStyle)); -parcelHelpers.export(exports, "getInputFocusStyle", ()=>(0, _index1.getInputFocusStyle)); -parcelHelpers.export(exports, "getThemedContext", ()=>(0, _index1.getThemedContext)); -parcelHelpers.export(exports, "focusClear", ()=>(0, _index1.focusClear)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>(0, _index1.ThemeSettingName)); -parcelHelpers.export(exports, "getTheme", ()=>(0, _index1.getTheme)); -parcelHelpers.export(exports, "loadTheme", ()=>(0, _index1.loadTheme)); -parcelHelpers.export(exports, "createTheme", ()=>(0, _index1.createTheme)); -parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>(0, _index1.registerOnThemeChangeCallback)); -parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>(0, _index1.removeOnThemeChangeCallback)); -parcelHelpers.export(exports, "HighContrastSelector", ()=>(0, _index1.HighContrastSelector)); -parcelHelpers.export(exports, "HighContrastSelectorWhite", ()=>(0, _index1.HighContrastSelectorWhite)); -parcelHelpers.export(exports, "HighContrastSelectorBlack", ()=>(0, _index1.HighContrastSelectorBlack)); -parcelHelpers.export(exports, "EdgeChromiumHighContrastSelector", ()=>(0, _index1.EdgeChromiumHighContrastSelector)); -parcelHelpers.export(exports, "ScreenWidthMinSmall", ()=>(0, _index1.ScreenWidthMinSmall)); -parcelHelpers.export(exports, "ScreenWidthMinMedium", ()=>(0, _index1.ScreenWidthMinMedium)); -parcelHelpers.export(exports, "ScreenWidthMinLarge", ()=>(0, _index1.ScreenWidthMinLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXLarge", ()=>(0, _index1.ScreenWidthMinXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXLarge", ()=>(0, _index1.ScreenWidthMinXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXXLarge", ()=>(0, _index1.ScreenWidthMinXXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxSmall", ()=>(0, _index1.ScreenWidthMaxSmall)); -parcelHelpers.export(exports, "ScreenWidthMaxMedium", ()=>(0, _index1.ScreenWidthMaxMedium)); -parcelHelpers.export(exports, "ScreenWidthMaxLarge", ()=>(0, _index1.ScreenWidthMaxLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxXLarge", ()=>(0, _index1.ScreenWidthMaxXLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxXXLarge", ()=>(0, _index1.ScreenWidthMaxXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinUhfMobile", ()=>(0, _index1.ScreenWidthMinUhfMobile)); -parcelHelpers.export(exports, "getScreenSelector", ()=>(0, _index1.getScreenSelector)); -parcelHelpers.export(exports, "getHighContrastNoAdjustStyle", ()=>(0, _index1.getHighContrastNoAdjustStyle)); -parcelHelpers.export(exports, "getEdgeChromiumNoHighContrastAdjustSelector", ()=>(0, _index1.getEdgeChromiumNoHighContrastAdjustSelector)); -parcelHelpers.export(exports, "normalize", ()=>(0, _index1.normalize)); -parcelHelpers.export(exports, "noWrap", ()=>(0, _index1.noWrap)); -parcelHelpers.export(exports, "getFadedOverflowStyle", ()=>(0, _index1.getFadedOverflowStyle)); -parcelHelpers.export(exports, "getPlaceholderStyles", ()=>(0, _index1.getPlaceholderStyles)); -parcelHelpers.export(exports, "ZIndexes", ()=>(0, _index1.ZIndexes)); -parcelHelpers.export(exports, "buildClassMap", ()=>(0, _index2.buildClassMap)); -parcelHelpers.export(exports, "getIcon", ()=>(0, _index2.getIcon)); -parcelHelpers.export(exports, "registerIcons", ()=>(0, _index2.registerIcons)); -parcelHelpers.export(exports, "registerIconAlias", ()=>(0, _index2.registerIconAlias)); -parcelHelpers.export(exports, "unregisterIcons", ()=>(0, _index2.unregisterIcons)); -parcelHelpers.export(exports, "setIconOptions", ()=>(0, _index2.setIconOptions)); -parcelHelpers.export(exports, "getIconClassName", ()=>(0, _index2.getIconClassName)); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _mergeStyles.InjectionMode)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _mergeStyles.Stylesheet)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _mergeStyles.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _mergeStyles.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _mergeStyles.fontFace)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _mergeStyles.keyframes)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _mergeStyles.mergeStyleSets)); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _mergeStyles.mergeStyles)); -parcelHelpers.export(exports, "FLUENT_CDN_BASE_URL", ()=>(0, _cdn.FLUENT_CDN_BASE_URL)); -var _index = require("./classNames/index"); -var _index1 = require("./styles/index"); -var _index2 = require("./utilities/index"); -var _mergeStyles = require("./MergeStyles"); -var _cdn = require("./cdn"); -var _version = require("./version"); -// Ensure theme is initialized when this package is referenced. -var _theme = require("./styles/theme"); -(0, _theme.initializeThemeInCustomizations)(); - -},{"./classNames/index":"4KgaX","./styles/index":"7vNgo","./utilities/index":"6wcJ3","./MergeStyles":"gDRLE","./cdn":false,"./version":"9IVjH","./styles/theme":"uuyP7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4KgaX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>(0, _animationClassNames.AnimationClassNames)); -parcelHelpers.export(exports, "FontClassNames", ()=>(0, _fontClassNames.FontClassNames)); -parcelHelpers.export(exports, "ColorClassNames", ()=>(0, _colorClassNames.ColorClassNames)); -var _animationClassNames = require("./AnimationClassNames"); -var _fontClassNames = require("./FontClassNames"); -var _colorClassNames = require("./ColorClassNames"); - -},{"./AnimationClassNames":"ijw6Y","./FontClassNames":false,"./ColorClassNames":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ijw6Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>AnimationClassNames); -var _index = require("../utilities/index"); -var _index1 = require("../styles/index"); -var AnimationClassNames = (0, _index.buildClassMap)((0, _index1.AnimationStyles)); - -},{"../utilities/index":"6wcJ3","../styles/index":"7vNgo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6wcJ3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "buildClassMap", ()=>(0, _buildClassMap.buildClassMap)); -parcelHelpers.export(exports, "getIcon", ()=>(0, _icons.getIcon)); -parcelHelpers.export(exports, "registerIcons", ()=>(0, _icons.registerIcons)); -parcelHelpers.export(exports, "registerIconAlias", ()=>(0, _icons.registerIconAlias)); -parcelHelpers.export(exports, "unregisterIcons", ()=>(0, _icons.unregisterIcons)); -parcelHelpers.export(exports, "setIconOptions", ()=>(0, _icons.setIconOptions)); -parcelHelpers.export(exports, "getIconClassName", ()=>(0, _getIconClassName.getIconClassName)); -var _buildClassMap = require("./buildClassMap"); -var _icons = require("./icons"); -var _getIconClassName = require("./getIconClassName"); - -},{"./buildClassMap":"i1LYf","./icons":"hfyHB","./getIconClassName":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i1LYf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Builds a class names object from a given map. - * - * @param styles - Map of unprocessed styles. - * @returns Map of property name to class name. - */ parcelHelpers.export(exports, "buildClassMap", ()=>buildClassMap); -var _mergeStyles = require("../MergeStyles"); -function buildClassMap(styles) { - var classes = {}; - var _loop_1 = function(styleName) { - if (styles.hasOwnProperty(styleName)) { - var className_1; - Object.defineProperty(classes, styleName, { - get: function() { - if (className_1 === undefined) // eslint-disable-next-line @typescript-eslint/no-explicit-any - className_1 = (0, _mergeStyles.mergeStyles)(styles[styleName]).toString(); - return className_1; - }, - enumerable: true, - configurable: true + }; + var MergeStylesShadowRootContext = React__namespace.createContext(void 0); + var useHasMergeStylesShadowRootContext = function() { + return !!useMergeStylesShadowRootContext(); + }; + var useMergeStylesShadowRootContext = function() { + return React__namespace.useContext(MergeStylesShadowRootContext); + }; + var MergeStylesShadowRootConsumer = function(_a2) { + var stylesheetKey = _a2.stylesheetKey, children2 = _a2.children; + var _b2 = useMergeStylesHooks(), useAdoptedStylesheetEx = _b2.useAdoptedStylesheetEx, useMergeStylesRootStylesheets = _b2.useMergeStylesRootStylesheets, useWindow2 = _b2.useWindow; + var shadowCtx = useMergeStylesShadowRootContext(); + var rootMergeStyles = useMergeStylesRootStylesheets(); + var win = useWindow2(); + useAdoptedStylesheetEx(GLOBAL_STYLESHEET_KEY, shadowCtx, rootMergeStyles, win); + useAdoptedStylesheetEx(stylesheetKey, shadowCtx, rootMergeStyles, win); + return children2(!!shadowCtx); + }; + var WindowContext = React__namespace.createContext({ + // eslint-disable-next-line no-restricted-globals + window: typeof window === "object" ? window : void 0 + }); + var useWindow = function() { + return React__namespace.useContext(WindowContext).window; + }; + var useDocument = function() { + var _a2; + return (_a2 = React__namespace.useContext(WindowContext).window) === null || _a2 === void 0 ? void 0 : _a2.document; + }; + var memoizedMakeShadowConfig = memoizeFunction(makeShadowConfig); + var mergeComponentStyles = memoizeFunction( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function(defaultStyles, componentStyles, shadowConfig) { + var _a2; + var styles = (_a2 = componentStyles !== null && componentStyles !== void 0 ? componentStyles : defaultStyles) !== null && _a2 !== void 0 ? _a2 : {}; + styles.__shadowConfig__ = shadowConfig; + return styles; + } + ); + function customizable(scope, fields, concatStyles) { + return function customizableFactory(ComposedComponent) { + var _a2; + var resultClass = (_a2 = /** @class */ + (function(_super) { + __extends(ComponentWithInjectedProps, _super); + function ComponentWithInjectedProps(props) { + var _this = _super.call(this, props) || this; + _this._styleCache = {}; + _this._onSettingChanged = _this._onSettingChanged.bind(_this); + return _this; + } + ComponentWithInjectedProps.prototype.componentDidMount = function() { + Customizations.observe(this._onSettingChanged); + }; + ComponentWithInjectedProps.prototype.componentWillUnmount = function() { + Customizations.unobserve(this._onSettingChanged); + }; + ComponentWithInjectedProps.prototype.render = function() { + var _this = this; + return React__namespace.createElement(MergeStylesShadowRootConsumer, { stylesheetKey: scope }, function(inShadow) { + return React__namespace.createElement(CustomizerContext.Consumer, null, function(context2) { + var _b2; + var defaultProps = Customizations.getSettings(fields, scope, context2.customizations); + var win = (_b2 = _this.context.window) !== null && _b2 !== void 0 ? _b2 : getWindow(); + var shadowConfig = memoizedMakeShadowConfig(scope, inShadow, win); + var componentProps = _this.props; + if (defaultProps.styles && typeof defaultProps.styles === "function") { + defaultProps.styles = defaultProps.styles(__assign$1(__assign$1({}, defaultProps), componentProps)); + } + if (defaultProps.styles) { + if (_this._styleCache.default !== defaultProps.styles || _this._styleCache.component !== componentProps.styles) { + var mergedStyles = concatStyleSets(defaultProps.styles, componentProps.styles); + mergedStyles.__shadowConfig__ = shadowConfig; + _this._styleCache.default = defaultProps.styles; + _this._styleCache.component = componentProps.styles; + _this._styleCache.merged = mergedStyles; + } + return React__namespace.createElement(ComposedComponent, __assign$1({}, defaultProps, componentProps, { styles: _this._styleCache.merged })); + } + var styles = mergeComponentStyles(defaultProps.styles, componentProps.styles, shadowConfig); + return React__namespace.createElement(ComposedComponent, __assign$1({}, defaultProps, componentProps, { styles })); }); + }); + }; + ComponentWithInjectedProps.prototype._onSettingChanged = function() { + this.forceUpdate(); + }; + return ComponentWithInjectedProps; + })(React__namespace.Component), _a2.displayName = "Customized" + scope, _a2.contextType = WindowContext, _a2); + return hoistStatics(ComposedComponent, resultClass); + }; + } + function useCustomizationSettings(properties, scopeName) { + var forceUpdate = useForceUpdate(); + var customizations = React__namespace.useContext(CustomizerContext).customizations; + var inCustomizerContext = customizations.inCustomizerContext; + React__namespace.useEffect(function() { + if (!inCustomizerContext) { + Customizations.observe(forceUpdate); + } + return function() { + if (!inCustomizerContext) { + Customizations.unobserve(forceUpdate); } + }; + }, [inCustomizerContext]); + return Customizations.getSettings(properties, scopeName, customizations); + } + function useForceUpdate() { + var _a2 = React__namespace.useState(0), setValue = _a2[1]; + return function() { + return setValue(function(value2) { + return ++value2; + }); }; - for(var styleName in styles)_loop_1(styleName); - return classes; -} - -},{"../MergeStyles":"gDRLE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gDRLE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _mergeStyles.InjectionMode)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _mergeStyles.Stylesheet)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _mergeStyles.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _mergeStyles.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _mergeStyles.fontFace)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _mergeStyles.keyframes)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _mergeStyles.mergeStyleSets)); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _mergeStyles.mergeStyles)); -var _mergeStyles = require("@fluentui/merge-styles"); - -},{"@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hfyHB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Registers a given subset of icons. - * - * @param iconSubset - the icon subset definition. - */ parcelHelpers.export(exports, "registerIcons", ()=>registerIcons); -/** - * Unregisters icons by name. - * - * @param iconNames - List of icons to unregister. - */ parcelHelpers.export(exports, "unregisterIcons", ()=>unregisterIcons); -/** - * Remaps one icon name to another. - */ parcelHelpers.export(exports, "registerIconAlias", ()=>registerIconAlias); -/** - * Gets an icon definition. If an icon is requested but the subset has yet to be registered, - * it will get registered immediately. - * - * @public - * @param name - Name of icon. - */ parcelHelpers.export(exports, "getIcon", ()=>getIcon); -/** - * Sets the icon options. - * - * @public - */ parcelHelpers.export(exports, "setIconOptions", ()=>setIconOptions); -var _tslib = require("tslib"); -var _utilities = require("@fluentui/utilities"); -var _mergeStyles = require("@fluentui/merge-styles"); -var ICON_SETTING_NAME = 'icons'; -var _iconSettings = (0, _utilities.GlobalSettings).getValue(ICON_SETTING_NAME, { - __options: { - disableWarnings: false, - warnOnMissingIcons: true - }, - __remapped: {} -}); -// Reset icon registration on stylesheet resets. -var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); -if (stylesheet && stylesheet.onReset) stylesheet.onReset(function() { - for(var name_1 in _iconSettings)if (_iconSettings.hasOwnProperty(name_1) && !!_iconSettings[name_1].subset) _iconSettings[name_1].subset.className = undefined; -}); -/** - * Normalizes an icon name for consistent mapping. - * Current implementation is to convert the icon name to lower case. - * - * @param name - Icon name to normalize. - * @returns {string} Normalized icon name to use for indexing and mapping. - */ var normalizeIconName = function(name) { - return name.toLowerCase(); -}; -function registerIcons(iconSubset, options) { - var subset = (0, _tslib.__assign)((0, _tslib.__assign)({}, iconSubset), { - isRegistered: false, - className: undefined - }); - var icons = iconSubset.icons; - // Grab options, optionally mix user provided ones on top. - options = options ? (0, _tslib.__assign)((0, _tslib.__assign)({}, _iconSettings.__options), options) : _iconSettings.__options; - for(var iconName in icons)if (icons.hasOwnProperty(iconName)) { - var code = icons[iconName]; - var normalizedIconName = normalizeIconName(iconName); - if (_iconSettings[normalizedIconName]) _warnDuplicateIcon(iconName); - else _iconSettings[normalizedIconName] = { - code: code, - subset: subset - }; + } + function extendComponent(parent, methods2) { + for (var name_1 in methods2) { + if (methods2.hasOwnProperty(name_1)) { + parent[name_1] = appendFunction(parent, parent[name_1], methods2[name_1]); + } } -} -function unregisterIcons(iconNames) { - var options = _iconSettings.__options; - var _loop_1 = function(iconName) { - var normalizedIconName = normalizeIconName(iconName); - if (_iconSettings[normalizedIconName]) delete _iconSettings[normalizedIconName]; - else // Warn that we are trying to delete an icon that doesn't exist - if (!options.disableWarnings) (0, _utilities.warn)("The icon \"".concat(iconName, "\" tried to unregister but was not registered.")); - // Delete any aliases for this iconName - if (_iconSettings.__remapped[normalizedIconName]) delete _iconSettings.__remapped[normalizedIconName]; - // Delete any items that were an alias for this iconName - Object.keys(_iconSettings.__remapped).forEach(function(key) { - if (_iconSettings.__remapped[key] === normalizedIconName) delete _iconSettings.__remapped[key]; - }); - }; - for(var _i = 0, iconNames_1 = iconNames; _i < iconNames_1.length; _i++){ - var iconName = iconNames_1[_i]; - _loop_1(iconName); - } -} -function registerIconAlias(iconName, mappedToName) { - _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName); -} -function getIcon(name) { - var icon = undefined; - var options = _iconSettings.__options; - name = name ? normalizeIconName(name) : ''; - name = _iconSettings.__remapped[name] || name; - if (name) { - icon = _iconSettings[name]; - if (icon) { - var subset = icon.subset; - if (subset && subset.fontFace) { - if (!subset.isRegistered) { - (0, _mergeStyles.fontFace)(subset.fontFace); - subset.isRegistered = true; - } - if (!subset.className) subset.className = (0, _mergeStyles.mergeStyles)(subset.style, { - fontFamily: subset.fontFace.fontFamily, - fontWeight: subset.fontFace.fontWeight || 'normal', - fontStyle: subset.fontFace.fontStyle || 'normal' - }); - } - } else // eslint-disable-next-line deprecation/deprecation - if (!options.disableWarnings && options.warnOnMissingIcons) (0, _utilities.warn)("The icon \"".concat(name, "\" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.")); + } + var CURRENT_ID_PROPERTY = "__currentId__"; + var DEFAULT_ID_STRING = "id__"; + var _global = getWindow() || {}; + if (_global[CURRENT_ID_PROPERTY] === void 0) { + _global[CURRENT_ID_PROPERTY] = 0; + } + var _initializedStylesheetResets = false; + function getId(prefix) { + if (!_initializedStylesheetResets) { + var stylesheet2 = Stylesheet.getInstance(); + if (stylesheet2 && stylesheet2.onReset) { + stylesheet2.onReset(resetIds); + } + _initializedStylesheetResets = true; } - return icon; -} -function setIconOptions(options) { - _iconSettings.__options = (0, _tslib.__assign)((0, _tslib.__assign)({}, _iconSettings.__options), options); -} -var _missingIcons = []; -var _missingIconsTimer = undefined; -function _warnDuplicateIcon(iconName) { - var options = _iconSettings.__options; - var warningDelay = 2000; - var maxIconsInMessage = 10; - if (!options.disableWarnings) { - _missingIcons.push(iconName); - if (_missingIconsTimer === undefined) _missingIconsTimer = setTimeout(function() { - (0, _utilities.warn)("Some icons were re-registered. Applications should only call registerIcons for any given icon once. Redefining what an icon is may have unintended consequences. Duplicates include: \n" + _missingIcons.slice(0, maxIconsInMessage).join(', ') + (_missingIcons.length > maxIconsInMessage ? " (+ ".concat(_missingIcons.length - maxIconsInMessage, " more)") : '')); - _missingIconsTimer = undefined; - _missingIcons = []; - }, warningDelay); + var index2 = _global[CURRENT_ID_PROPERTY]++; + return (prefix === void 0 ? DEFAULT_ID_STRING : prefix) + index2; + } + function resetIds(counter) { + if (counter === void 0) { + counter = 0; } -} - -},{"tslib":"9gizs","@fluentui/utilities":"55bj3","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7vNgo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _animationStyles.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _animationStyles.AnimationVariables)); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _defaultPalette.DefaultPalette)); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _defaultEffects.DefaultEffects)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _defaultFontStyles.DefaultFontStyles)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _defaultFontStyles.registerDefaultFontFaces)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _fonts.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _fonts.FontWeights)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _fonts.IconFontSizes)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _fonts.createFontStyles)); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>(0, _hiddenContentStyle.hiddenContentStyle)); -parcelHelpers.export(exports, "PulsingBeaconAnimationStyles", ()=>(0, _pulsingBeaconAnimationStyles.PulsingBeaconAnimationStyles)); -parcelHelpers.export(exports, "getGlobalClassNames", ()=>(0, _getGlobalClassNames.getGlobalClassNames)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>(0, _theme.ThemeSettingName)); -parcelHelpers.export(exports, "getTheme", ()=>(0, _theme.getTheme)); -parcelHelpers.export(exports, "loadTheme", ()=>(0, _theme.loadTheme)); -parcelHelpers.export(exports, "createTheme", ()=>(0, _theme.createTheme)); -parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>(0, _theme.registerOnThemeChangeCallback)); -parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>(0, _theme.removeOnThemeChangeCallback)); -var _animationStyles = require("./AnimationStyles"); -var _defaultPalette = require("./DefaultPalette"); -var _defaultEffects = require("./DefaultEffects"); -var _defaultFontStyles = require("./DefaultFontStyles"); -var _fonts = require("./fonts"); -var _getFocusStyle = require("./getFocusStyle"); -parcelHelpers.exportAll(_getFocusStyle, exports); -var _hiddenContentStyle = require("./hiddenContentStyle"); -var _pulsingBeaconAnimationStyles = require("./PulsingBeaconAnimationStyles"); -var _getGlobalClassNames = require("./getGlobalClassNames"); -var _scheme = require("./scheme"); -parcelHelpers.exportAll(_scheme, exports); -var _theme = require("./theme"); -var _commonStyles = require("./CommonStyles"); -parcelHelpers.exportAll(_commonStyles, exports); -var _generalStyles = require("./GeneralStyles"); -parcelHelpers.exportAll(_generalStyles, exports); -var _getFadedOverflowStyle = require("./getFadedOverflowStyle"); -parcelHelpers.exportAll(_getFadedOverflowStyle, exports); -var _getPlaceholderStyles = require("./getPlaceholderStyles"); -parcelHelpers.exportAll(_getPlaceholderStyles, exports); -var _zIndexes = require("./zIndexes"); -parcelHelpers.exportAll(_zIndexes, exports); - -},{"./AnimationStyles":"43k8I","./DefaultPalette":false,"./DefaultEffects":false,"./DefaultFontStyles":false,"./fonts":"Tr1M8","./getFocusStyle":"byDYo","./hiddenContentStyle":"furJc","./PulsingBeaconAnimationStyles":false,"./getGlobalClassNames":"g6mIZ","./scheme":false,"./theme":"uuyP7","./CommonStyles":"rgkn6","./GeneralStyles":"frMaf","./getFadedOverflowStyle":false,"./getPlaceholderStyles":"1VkGl","./zIndexes":"hDsdg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"43k8I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _theme.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _theme.AnimationVariables)); -var _theme = require("@fluentui/theme"); - -},{"@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6MuB2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FluentTheme", ()=>(0, _fluentTheme.FluentTheme)); -var _mergeThemes = require("./mergeThemes"); -parcelHelpers.exportAll(_mergeThemes, exports); -var _index = require("./types/index"); -parcelHelpers.exportAll(_index, exports); -var _index1 = require("./colors/index"); -parcelHelpers.exportAll(_index1, exports); -var _index2 = require("./effects/index"); -parcelHelpers.exportAll(_index2, exports); -var _index3 = require("./spacing/index"); -parcelHelpers.exportAll(_index3, exports); -var _index4 = require("./motion/index"); -parcelHelpers.exportAll(_index4, exports); -var _index5 = require("./fonts/index"); -parcelHelpers.exportAll(_index5, exports); -var _createTheme = require("./createTheme"); -parcelHelpers.exportAll(_createTheme, exports); -var _fluentTheme = require("./FluentTheme"); -var _version = require("./version"); - -},{"./mergeThemes":false,"./types/index":false,"./colors/index":false,"./effects/index":false,"./spacing/index":false,"./motion/index":"5Q3cL","./fonts/index":"cXCfS","./createTheme":"91iV5","./FluentTheme":false,"./version":"dCgRo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j9270":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Merge a partial/full theme into a full theme and returns a merged full theme. - */ parcelHelpers.export(exports, "mergeThemes", ()=>mergeThemes); -var _utilities = require("@fluentui/utilities"); -var _makeSemanticColors = require("./utilities/makeSemanticColors"); -function mergeThemes(theme, partialTheme) { - var _a, _b, _c; - if (partialTheme === void 0) partialTheme = {}; - var mergedTheme = (0, _utilities.merge)({}, theme, partialTheme, { - semanticColors: (0, _makeSemanticColors.getSemanticColors)(partialTheme.palette, partialTheme.effects, partialTheme.semanticColors, partialTheme.isInverted === undefined ? theme.isInverted : partialTheme.isInverted) - }); - if (((_a = partialTheme.palette) === null || _a === void 0 ? void 0 : _a.themePrimary) && !((_b = partialTheme.palette) === null || _b === void 0 ? void 0 : _b.accent)) mergedTheme.palette.accent = partialTheme.palette.themePrimary; - if (partialTheme.defaultFontStyle) for(var _i = 0, _d = Object.keys(mergedTheme.fonts); _i < _d.length; _i++){ - var fontStyle = _d[_i]; - mergedTheme.fonts[fontStyle] = (0, _utilities.merge)(mergedTheme.fonts[fontStyle], partialTheme.defaultFontStyle, (_c = partialTheme === null || partialTheme === void 0 ? void 0 : partialTheme.fonts) === null || _c === void 0 ? void 0 : _c[fontStyle]); + _global[CURRENT_ID_PROPERTY] = counter; + } + var toObjectMap = function() { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; } - return mergedTheme; -} - -},{"@fluentui/utilities":"55bj3","./utilities/makeSemanticColors":"dsk6N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dsk6N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** Generates all the semantic slot colors based on the theme so far - * We'll use these as fallbacks for semantic slots that the passed in theme did not define. - * The caller must still mix in the customized semantic slots at the end. - */ parcelHelpers.export(exports, "makeSemanticColors", ()=>makeSemanticColors); -/** - * Map partial platte and effects to partial semantic colors. - */ parcelHelpers.export(exports, "getSemanticColors", ()=>getSemanticColors); -var _tslib = require("tslib"); -function makeSemanticColors(p, e, s, isInverted, depComments) { - if (depComments === void 0) depComments = false; - var semanticColors = (0, _tslib.__assign)({ - primaryButtonBorder: 'transparent', - errorText: !isInverted ? '#a4262c' : '#F1707B', - messageText: !isInverted ? '#323130' : '#F3F2F1', - messageLink: !isInverted ? '#005A9E' : '#6CB8F6', - messageLinkHovered: !isInverted ? '#004578' : '#82C7FF', - infoIcon: !isInverted ? '#605e5c' : '#C8C6C4', - errorIcon: !isInverted ? '#A80000' : '#F1707B', - blockingIcon: !isInverted ? '#FDE7E9' : '#442726', - warningIcon: !isInverted ? '#797775' : '#C8C6C4', - severeWarningIcon: !isInverted ? '#D83B01' : '#FCE100', - successIcon: !isInverted ? '#107C10' : '#92C353', - infoBackground: !isInverted ? '#f3f2f1' : '#323130', - errorBackground: !isInverted ? '#FDE7E9' : '#442726', - blockingBackground: !isInverted ? '#FDE7E9' : '#442726', - warningBackground: !isInverted ? '#FFF4CE' : '#433519', - severeWarningBackground: !isInverted ? '#FED9CC' : '#4F2A0F', - successBackground: !isInverted ? '#DFF6DD' : '#393D1B', - // deprecated - warningHighlight: !isInverted ? '#ffb900' : '#fff100', - successText: !isInverted ? '#107C10' : '#92c353' - }, s); - var fullSemanticColors = getSemanticColors(p, e, semanticColors, isInverted); - return _fixDeprecatedSlots(fullSemanticColors, depComments); -} -function getSemanticColors(p, e, s, isInverted, depComments) { - if (depComments === void 0) depComments = false; var result = {}; - // map palette - var _a = p || {}, white = _a.white, black = _a.black, themePrimary = _a.themePrimary, themeDark = _a.themeDark, themeDarker = _a.themeDarker, themeDarkAlt = _a.themeDarkAlt, themeLighter = _a.themeLighter, neutralLight = _a.neutralLight, neutralLighter = _a.neutralLighter, neutralDark = _a.neutralDark, neutralQuaternary = _a.neutralQuaternary, neutralQuaternaryAlt = _a.neutralQuaternaryAlt, neutralPrimary = _a.neutralPrimary, neutralSecondary = _a.neutralSecondary, neutralSecondaryAlt = _a.neutralSecondaryAlt, neutralTertiary = _a.neutralTertiary, neutralTertiaryAlt = _a.neutralTertiaryAlt, neutralLighterAlt = _a.neutralLighterAlt, accent = _a.accent; - if (white) { - result.bodyBackground = white; - result.bodyFrameBackground = white; - result.accentButtonText = white; - result.buttonBackground = white; - result.primaryButtonText = white; - result.primaryButtonTextHovered = white; - result.primaryButtonTextPressed = white; - result.inputBackground = white; - result.inputForegroundChecked = white; - result.listBackground = white; - result.menuBackground = white; - result.cardStandoutBackground = white; + for (var _a2 = 0, items_1 = items; _a2 < items_1.length; _a2++) { + var item = items_1[_a2]; + var keys2 = Array.isArray(item) ? item : Object.keys(item); + for (var _b2 = 0, keys_1 = keys2; _b2 < keys_1.length; _b2++) { + var key2 = keys_1[_b2]; + result[key2] = 1; + } } - if (black) { - result.bodyTextChecked = black; - result.buttonTextCheckedHovered = black; + return result; + }; + var baseElementEvents = toObjectMap([ + "onCopy", + "onCut", + "onPaste", + "onCompositionEnd", + "onCompositionStart", + "onCompositionUpdate", + "onFocus", + "onFocusCapture", + "onBlur", + "onBlurCapture", + "onChange", + "onInput", + "onSubmit", + "onLoad", + "onError", + "onKeyDown", + "onKeyDownCapture", + "onKeyPress", + "onKeyUp", + "onAbort", + "onCanPlay", + "onCanPlayThrough", + "onDurationChange", + "onEmptied", + "onEncrypted", + "onEnded", + "onLoadedData", + "onLoadedMetadata", + "onLoadStart", + "onPause", + "onPlay", + "onPlaying", + "onProgress", + "onRateChange", + "onSeeked", + "onSeeking", + "onStalled", + "onSuspend", + "onTimeUpdate", + "onVolumeChange", + "onWaiting", + "onClick", + "onClickCapture", + "onContextMenu", + "onDoubleClick", + "onDrag", + "onDragEnd", + "onDragEnter", + "onDragExit", + "onDragLeave", + "onDragOver", + "onDragStart", + "onDrop", + "onMouseDown", + "onMouseDownCapture", + "onMouseEnter", + "onMouseLeave", + "onMouseMove", + "onMouseOut", + "onMouseOver", + "onMouseUp", + "onMouseUpCapture", + "onSelect", + "onTouchCancel", + "onTouchEnd", + "onTouchMove", + "onTouchStart", + "onScroll", + "onWheel", + "onPointerCancel", + "onPointerDown", + "onPointerEnter", + "onPointerLeave", + "onPointerMove", + "onPointerOut", + "onPointerOver", + "onPointerUp", + "onGotPointerCapture", + "onLostPointerCapture" + ]); + var baseElementProperties = toObjectMap([ + "accessKey", + // global + "children", + // global + "className", + // global + "contentEditable", + // global + "dir", + // global + "draggable", + // global + "hidden", + // global + "htmlFor", + // global + "id", + // global + "lang", + // global + "ref", + // global + "role", + // global + "style", + // global + "tabIndex", + // global + "title", + // global + "translate", + // global + "spellCheck", + // global + "name" + // global + ]); + var htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents); + toObjectMap(htmlElementProperties, [ + "form" + // button, fieldset, input, label, meter, object, output, select, textarea + ]); + var audioProperties = toObjectMap(htmlElementProperties, [ + "height", + // canvas, embed, iframe, img, input, object, video + "loop", + // audio, video + "muted", + // audio, video + "preload", + // audio, video + "src", + // audio, embed, iframe, img, input, script, source, track, video + "width" + // canvas, embed, iframe, img, input, object, video + ]); + toObjectMap(audioProperties, [ + "poster" + // video + ]); + toObjectMap(htmlElementProperties, [ + "start" + // ol + ]); + toObjectMap(htmlElementProperties, [ + "value" + // button, input, li, option, meter, progress, param + ]); + var anchorProperties = toObjectMap(htmlElementProperties, [ + "download", + // a, area + "href", + // a, area, base, link + "hrefLang", + // a, area, link + "media", + // a, area, link, source, style + "rel", + // a, area, link + "target", + // a, area, base, form + "type" + // a, button, input, link, menu, object, script, source, style + ]); + var buttonProperties = toObjectMap(htmlElementProperties, [ + "autoFocus", + // button, input, select, textarea + "disabled", + // button, fieldset, input, optgroup, option, select, textarea + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "formAction", + // input, button + "formEncType", + // input, button + "formMethod", + // input, button + "formNoValidate", + // input, button + "formTarget", + // input, button + "type", + // a, button, input, link, menu, object, script, source, style + "value" + // button, input, li, option, meter, progress, param, + ]); + var inputProperties = toObjectMap(buttonProperties, [ + "accept", + // input + "alt", + // area, img, input + "autoCapitalize", + // input, textarea + "autoComplete", + // form, input + "checked", + // input + "dirname", + // input, textarea + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "height", + // canvas, embed, iframe, img, input, object, video + "inputMode", + // input + "list", + // input + "max", + // input, meter + "maxLength", + // input, textarea + "min", + // input, meter + "minLength", + // input, textarea + "multiple", + // input, select + "pattern", + // input + "placeholder", + // input, textarea + "readOnly", + // input, textarea + "required", + // input, select, textarea + "src", + // audio, embed, iframe, img, input, script, source, track, video + "step", + // input + "size", + // input + "type", + // a, button, input, link, menu, object, script, source, style + "value", + // button, input, li, option, meter, progress, param + "width" + // canvas, embed, iframe, img, input, object, video + ]); + var textAreaProperties = toObjectMap(buttonProperties, [ + "autoCapitalize", + // input, textarea + "cols", + // textarea + "dirname", + // input, textarea + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "maxLength", + // input, textarea + "minLength", + // input, textarea + "placeholder", + // input, textarea + "readOnly", + // input, textarea + "required", + // input, select, textarea + "rows", + // textarea + "wrap" + // textarea + ]); + toObjectMap(buttonProperties, [ + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "multiple", + // input, select + "required" + // input, select, textarea + ]); + toObjectMap(htmlElementProperties, [ + "selected", + // option + "value" + // button, input, li, option, meter, progress, param + ]); + toObjectMap(htmlElementProperties, [ + "cellPadding", + // table + "cellSpacing" + // table + ]); + toObjectMap(htmlElementProperties, [ + "rowSpan", + // td, th + "scope" + // th + ]); + toObjectMap(htmlElementProperties, [ + "colSpan", + // td + "headers", + // td + "rowSpan", + // td, th + "scope" + // th + ]); + toObjectMap(htmlElementProperties, [ + "span" + // col, colgroup + ]); + toObjectMap(htmlElementProperties, [ + "span" + // col, colgroup + ]); + toObjectMap(htmlElementProperties, [ + "acceptCharset", + // form + "action", + // form + "encType", + // form + "encType", + // form + "method", + // form + "noValidate", + // form + "target" + // form + ]); + toObjectMap(htmlElementProperties, [ + "allow", + // iframe + "allowFullScreen", + // iframe + "allowPaymentRequest", + // iframe + "allowTransparency", + // iframe + "csp", + // iframe + "height", + // canvas, embed, iframe, img, input, object, video + "importance", + // iframe + "referrerPolicy", + // iframe + "sandbox", + // iframe + "src", + // audio, embed, iframe, img, input, script, source, track, video + "srcDoc", + // iframe + "width" + // canvas, embed, iframe, img, input, object, video, + ]); + var imgProperties = toObjectMap(htmlElementProperties, [ + "alt", + // area, img, input + "crossOrigin", + // img + "height", + // canvas, embed, iframe, img, input, object, video + "src", + // audio, embed, iframe, img, input, script, source, track, video + "srcSet", + // img, source + "useMap", + // img, object, + "width" + // canvas, embed, iframe, img, input, object, video + ]); + var divProperties = htmlElementProperties; + function getNativeProps(props, allowedPropNames, excludedPropNames) { + var isArray2 = Array.isArray(allowedPropNames); + var result = {}; + var keys2 = Object.keys(props); + for (var _i = 0, keys_2 = keys2; _i < keys_2.length; _i++) { + var key2 = keys_2[_i]; + var isNativeProp = !isArray2 && allowedPropNames[key2] || isArray2 && allowedPropNames.indexOf(key2) >= 0 || key2.indexOf("data-") === 0 || key2.indexOf("aria-") === 0; + if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key2)) === -1)) { + result[key2] = props[key2]; + } } - if (themePrimary) { - result.link = themePrimary; - result.primaryButtonBackground = themePrimary; - result.inputBackgroundChecked = themePrimary; - result.inputIcon = themePrimary; - result.inputFocusBorderAlt = themePrimary; - result.menuIcon = themePrimary; - result.menuHeader = themePrimary; - result.accentButtonBackground = themePrimary; + return result; + } + var REACT_LIFECYCLE_EXCLUSIONS = [ + "setState", + "render", + "componentWillMount", + "UNSAFE_componentWillMount", + "componentDidMount", + "componentWillReceiveProps", + "UNSAFE_componentWillReceiveProps", + "shouldComponentUpdate", + "componentWillUpdate", + "getSnapshotBeforeUpdate", + "UNSAFE_componentWillUpdate", + "componentDidUpdate", + "componentWillUnmount" + ]; + function hoistMethods(destination, source2, exclusions) { + if (exclusions === void 0) { + exclusions = REACT_LIFECYCLE_EXCLUSIONS; } - if (themeDark) { - result.primaryButtonBackgroundPressed = themeDark; - result.inputBackgroundCheckedHovered = themeDark; - result.inputIconHovered = themeDark; + var hoisted = []; + var _loop_1 = function(methodName2) { + if (typeof source2[methodName2] === "function" && destination[methodName2] === void 0 && (!exclusions || exclusions.indexOf(methodName2) === -1)) { + hoisted.push(methodName2); + destination[methodName2] = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + source2[methodName2].apply(source2, args); + }; + } + }; + for (var methodName in source2) { + _loop_1(methodName); } - if (themeDarker) result.linkHovered = themeDarker; - if (themeDarkAlt) result.primaryButtonBackgroundHovered = themeDarkAlt; - if (themeLighter) result.inputPlaceholderBackgroundChecked = themeLighter; - if (neutralLight) { - result.bodyBackgroundChecked = neutralLight; - result.bodyFrameDivider = neutralLight; - result.bodyDivider = neutralLight; - result.variantBorder = neutralLight; - result.buttonBackgroundCheckedHovered = neutralLight; - result.buttonBackgroundPressed = neutralLight; - result.listItemBackgroundChecked = neutralLight; - result.listHeaderBackgroundPressed = neutralLight; - result.menuItemBackgroundPressed = neutralLight; - // eslint-disable-next-line deprecation/deprecation - result.menuItemBackgroundChecked = neutralLight; + return hoisted; + } + function unhoistMethods(source2, methodNames) { + methodNames.forEach(function(methodName) { + return delete source2[methodName]; + }); + } + function initializeComponentRef(obj2) { + extendComponent(obj2, { + componentDidMount: _onMount, + componentDidUpdate: _onUpdate, + componentWillUnmount: _onUnmount + }); + } + function _onMount() { + _setComponentRef(this.props.componentRef, this); + } + function _onUpdate(prevProps) { + if (prevProps.componentRef !== this.props.componentRef) { + _setComponentRef(prevProps.componentRef, null); + _setComponentRef(this.props.componentRef, this); } - if (neutralLighter) { - result.bodyBackgroundHovered = neutralLighter; - result.buttonBackgroundHovered = neutralLighter; - result.buttonBackgroundDisabled = neutralLighter; - result.buttonBorderDisabled = neutralLighter; - result.primaryButtonBackgroundDisabled = neutralLighter; - result.disabledBackground = neutralLighter; - result.listItemBackgroundHovered = neutralLighter; - result.listHeaderBackgroundHovered = neutralLighter; - result.menuItemBackgroundHovered = neutralLighter; + } + function _onUnmount() { + _setComponentRef(this.props.componentRef, null); + } + function _setComponentRef(componentRef, value2) { + if (componentRef) { + if (typeof componentRef === "object") { + componentRef.current = value2; + } else if (typeof componentRef === "function") { + componentRef(value2); + } } - if (neutralQuaternary) { - result.primaryButtonTextDisabled = neutralQuaternary; - result.disabledSubtext = neutralQuaternary; + } + var _a$5; + var DirectionalKeyCodes = (_a$5 = {}, _a$5[KeyCodes.up] = 1, _a$5[KeyCodes.down] = 1, _a$5[KeyCodes.left] = 1, _a$5[KeyCodes.right] = 1, _a$5[KeyCodes.home] = 1, _a$5[KeyCodes.end] = 1, _a$5[KeyCodes.tab] = 1, _a$5[KeyCodes.pageUp] = 1, _a$5[KeyCodes.pageDown] = 1, _a$5); + function isDirectionalKeyCode(which) { + return !!DirectionalKeyCodes[which]; + } + var IsFocusVisibleClassName = "ms-Fabric--isFocusVisible"; + var IsFocusHiddenClassName = "ms-Fabric--isFocusHidden"; + function updateClassList(el, enabled) { + if (el) { + el.classList.add(enabled ? IsFocusVisibleClassName : IsFocusHiddenClassName); + el.classList.remove(enabled ? IsFocusHiddenClassName : IsFocusVisibleClassName); } - if (neutralQuaternaryAlt) result.listItemBackgroundCheckedHovered = neutralQuaternaryAlt; - if (neutralTertiary) { - result.disabledBodyText = neutralTertiary; - result.variantBorderHovered = (s === null || s === void 0 ? void 0 : s.variantBorderHovered) || neutralTertiary; - result.buttonTextDisabled = neutralTertiary; - result.inputIconDisabled = neutralTertiary; - result.disabledText = neutralTertiary; + } + function setFocusVisibility(enabled, target2, registeredProviders) { + var _a2; + if (registeredProviders) { + registeredProviders.forEach(function(ref2) { + return updateClassList(ref2.current, enabled); + }); + } else { + updateClassList((_a2 = getWindow(target2)) === null || _a2 === void 0 ? void 0 : _a2.document.body, enabled); } - if (neutralPrimary) { - result.bodyText = neutralPrimary; - result.actionLink = neutralPrimary; - result.buttonText = neutralPrimary; - result.inputBorderHovered = neutralPrimary; - result.inputText = neutralPrimary; - result.listText = neutralPrimary; - result.menuItemText = neutralPrimary; + } + var mountCounters = /* @__PURE__ */ new WeakMap(); + var callbackMap = /* @__PURE__ */ new WeakMap(); + function setMountCounters(key2, delta) { + var newValue; + var currValue = mountCounters.get(key2); + if (currValue) { + newValue = currValue + delta; + } else { + newValue = 1; } - if (neutralLighterAlt) { - result.bodyStandoutBackground = neutralLighterAlt; - result.defaultStateBackground = neutralLighterAlt; + mountCounters.set(key2, newValue); + return newValue; + } + function setCallbackMap(context2) { + var callbacks = callbackMap.get(context2); + if (callbacks) { + return callbacks; } - if (neutralDark) { - result.actionLinkHovered = neutralDark; - result.buttonTextHovered = neutralDark; - result.buttonTextChecked = neutralDark; - result.buttonTextPressed = neutralDark; - result.inputTextHovered = neutralDark; - result.menuItemTextHovered = neutralDark; + var onMouseDown = function(ev) { + return _onMouseDown(ev, context2.registeredProviders); + }; + var onPointerDown = function(ev) { + return _onPointerDown(ev, context2.registeredProviders); + }; + var onKeyDown = function(ev) { + return _onKeyDown(ev, context2.registeredProviders); + }; + var onKeyUp = function(ev) { + return _onKeyUp(ev, context2.registeredProviders); + }; + callbacks = { onMouseDown, onPointerDown, onKeyDown, onKeyUp }; + callbackMap.set(context2, callbacks); + return callbacks; + } + var FocusRectsContext = React__namespace.createContext(void 0); + function useFocusRects(rootRef) { + var context2 = React__namespace.useContext(FocusRectsContext); + React__namespace.useEffect(function() { + var _a2, _b2, _c2, _d2; + var win = getWindow(rootRef === null || rootRef === void 0 ? void 0 : rootRef.current); + if (!win || ((_a2 = win.FabricConfig) === null || _a2 === void 0 ? void 0 : _a2.disableFocusRects) === true) { + return void 0; + } + var el = win; + var onMouseDown; + var onPointerDown; + var onKeyDown; + var onKeyUp; + if (((_b2 = context2 === null || context2 === void 0 ? void 0 : context2.providerRef) === null || _b2 === void 0 ? void 0 : _b2.current) && ((_d2 = (_c2 = context2 === null || context2 === void 0 ? void 0 : context2.providerRef) === null || _c2 === void 0 ? void 0 : _c2.current) === null || _d2 === void 0 ? void 0 : _d2.addEventListener)) { + el = context2.providerRef.current; + var callbacks = ( + /*@__NOINLINE__*/ + setCallbackMap(context2) + ); + onMouseDown = callbacks.onMouseDown; + onPointerDown = callbacks.onPointerDown; + onKeyDown = callbacks.onKeyDown; + onKeyUp = callbacks.onKeyUp; + } else { + onMouseDown = _onMouseDown; + onPointerDown = _onPointerDown; + onKeyDown = _onKeyDown; + onKeyUp = _onKeyUp; + } + var count2 = setMountCounters(el, 1); + if (count2 <= 1) { + el.addEventListener("mousedown", onMouseDown, true); + el.addEventListener("pointerdown", onPointerDown, true); + el.addEventListener("keydown", onKeyDown, true); + el.addEventListener("keyup", onKeyUp, true); + } + return function() { + var _a3; + if (!win || ((_a3 = win.FabricConfig) === null || _a3 === void 0 ? void 0 : _a3.disableFocusRects) === true) { + return; + } + count2 = setMountCounters(el, -1); + if (count2 === 0) { + el.removeEventListener("mousedown", onMouseDown, true); + el.removeEventListener("pointerdown", onPointerDown, true); + el.removeEventListener("keydown", onKeyDown, true); + el.removeEventListener("keyup", onKeyUp, true); + } + }; + }, [context2, rootRef]); + } + var FocusRects = function(props) { + useFocusRects(props.rootRef); + return null; + }; + function _onMouseDown(ev, registeredProviders) { + setFocusVisibility(false, ev.target, registeredProviders); + } + function _onPointerDown(ev, registeredProviders) { + if (ev.pointerType !== "mouse") { + setFocusVisibility(false, ev.target, registeredProviders); } - if (neutralSecondary) { - result.bodySubtext = neutralSecondary; - result.focusBorder = neutralSecondary; - result.inputBorder = neutralSecondary; - result.smallInputBorder = neutralSecondary; - result.inputPlaceholderText = neutralSecondary; + } + function _onKeyDown(ev, registeredProviders) { + if (isDirectionalKeyCode(ev.which)) { + setFocusVisibility(true, ev.target, registeredProviders); } - if (neutralSecondaryAlt) result.buttonBorder = neutralSecondaryAlt; - if (neutralTertiaryAlt) { - result.disabledBodySubtext = neutralTertiaryAlt; - result.disabledBorder = neutralTertiaryAlt; - result.buttonBackgroundChecked = neutralTertiaryAlt; - result.menuDivider = neutralTertiaryAlt; - } - if (accent) result.accentButtonBackground = accent; - // map effects - if (e === null || e === void 0 ? void 0 : e.elevation4) result.cardShadow = e.elevation4; - if (!isInverted && (e === null || e === void 0 ? void 0 : e.elevation8)) result.cardShadowHovered = e.elevation8; - else if (result.variantBorderHovered) result.cardShadowHovered = '0 0 1px ' + result.variantBorderHovered; - result = (0, _tslib.__assign)((0, _tslib.__assign)({}, result), s); - return result; -} -function _fixDeprecatedSlots(s, depComments) { - // Add @deprecated tag as comment if enabled - var dep = ''; - if (depComments === true) dep = ' /* @deprecated */'; - /* eslint-disable deprecation/deprecation */ s.listTextColor = s.listText + dep; - s.menuItemBackgroundChecked += dep; - s.warningHighlight += dep; - s.warningText = s.messageText + dep; - s.successText += dep; - /* eslint-enable deprecation/deprecation */ return s; -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7yAiX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _defaultPalette.DefaultPalette)); -var _fluentColors = require("./FluentColors"); -parcelHelpers.exportAll(_fluentColors, exports); -var _defaultPalette = require("./DefaultPalette"); - -},{"./FluentColors":false,"./DefaultPalette":"ltCeA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ltCeA":[function(require,module,exports,__globalThis) { -// When adding or removing a color, make sure you keep this consistent with IColorClassNames -// by adding the color variants. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultPalette", ()=>DefaultPalette); -var DefaultPalette = { - themeDarker: '#004578', - themeDark: '#005a9e', - themeDarkAlt: '#106ebe', - themePrimary: '#0078d4', - themeSecondary: '#2b88d8', - themeTertiary: '#71afe5', - themeLight: '#c7e0f4', - themeLighter: '#deecf9', - themeLighterAlt: '#eff6fc', - black: '#000000', - blackTranslucent40: 'rgba(0,0,0,.4)', - neutralDark: '#201f1e', - neutralPrimary: '#323130', - neutralPrimaryAlt: '#3b3a39', - neutralSecondary: '#605e5c', - neutralSecondaryAlt: '#8a8886', - neutralTertiary: '#a19f9d', - neutralTertiaryAlt: '#c8c6c4', - neutralQuaternary: '#d2d0ce', - neutralQuaternaryAlt: '#e1dfdd', - neutralLight: '#edebe9', - neutralLighter: '#f3f2f1', - neutralLighterAlt: '#faf9f8', - accent: '#0078d4', - white: '#ffffff', - whiteTranslucent40: 'rgba(255,255,255,.4)', - yellowDark: '#d29200', - yellow: '#ffb900', - yellowLight: '#fff100', - orange: '#d83b01', - orangeLight: '#ea4300', - orangeLighter: '#ff8c00', - redDark: '#a4262c', - red: '#e81123', - magentaDark: '#5c005c', - magenta: '#b4009e', - magentaLight: '#e3008c', - purpleDark: '#32145a', - purple: '#5c2d91', - purpleLight: '#b4a0ff', - blueDark: '#002050', - blueMid: '#00188f', - blue: '#0078d4', - blueLight: '#00bcf2', - tealDark: '#004b50', - teal: '#008272', - tealLight: '#00b294', - greenDark: '#004b1c', - green: '#107c10', - greenLight: '#bad80a' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2nXfK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _defaultEffects.DefaultEffects)); -parcelHelpers.export(exports, "Depths", ()=>(0, _fluentDepths.Depths)); -var _defaultEffects = require("./DefaultEffects"); -var _fluentDepths = require("./FluentDepths"); - -},{"./DefaultEffects":"jcrQE","./FluentDepths":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jcrQE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultEffects", ()=>DefaultEffects); -var _fluentDepths = require("./FluentDepths"); -var DefaultEffects = { - elevation4: (0, _fluentDepths.Depths).depth4, - elevation8: (0, _fluentDepths.Depths).depth8, - elevation16: (0, _fluentDepths.Depths).depth16, - elevation64: (0, _fluentDepths.Depths).depth64, - roundedCorner2: '2px', - roundedCorner4: '4px', - roundedCorner6: '6px' -}; - -},{"./FluentDepths":"k9iEB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k9iEB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Depths", ()=>Depths); -var Depths; -(function(Depths) { - Depths.depth0 = '0 0 0 0 transparent'; - Depths.depth4 = '0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)'; - Depths.depth8 = '0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)'; - Depths.depth16 = '0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108)'; - Depths.depth64 = '0 25.6px 57.6px 0 rgba(0, 0, 0, 0.22), 0 4.8px 14.4px 0 rgba(0, 0, 0, 0.18)'; -})(Depths || (Depths = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"82zHh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultSpacing", ()=>(0, _defaultSpacing.DefaultSpacing)); -var _defaultSpacing = require("./DefaultSpacing"); - -},{"./DefaultSpacing":"c1Apy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c1Apy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultSpacing", ()=>DefaultSpacing); -var DefaultSpacing = { - s2: '4px', - s1: '8px', - m: '16px', - l1: '20px', - l2: '32px' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Q3cL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _fluentMotion = require("./FluentMotion"); -parcelHelpers.exportAll(_fluentMotion, exports); -var _animationStyles = require("./AnimationStyles"); -parcelHelpers.exportAll(_animationStyles, exports); - -},{"./FluentMotion":false,"./AnimationStyles":"3XlEl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3XlEl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationVariables", ()=>AnimationVariables); -parcelHelpers.export(exports, "AnimationStyles", ()=>AnimationStyles); -var _mergeStyles = require("@fluentui/merge-styles"); -/* Register the keyframes */ var EASING_FUNCTION_1 = 'cubic-bezier(.1,.9,.2,1)'; -var EASING_FUNCTION_2 = 'cubic-bezier(.1,.25,.75,.9)'; -var DURATION_1 = '0.167s'; -var DURATION_2 = '0.267s'; -var DURATION_3 = '0.367s'; -var DURATION_4 = '0.467s'; -var FADE_IN = (0, _mergeStyles.keyframes)({ - from: { - opacity: 0 - }, - to: { - opacity: 1 + } + function _onKeyUp(ev, registeredProviders) { + if (isDirectionalKeyCode(ev.which)) { + setFocusVisibility(true, ev.target, registeredProviders); } -}); -var FADE_OUT = (0, _mergeStyles.keyframes)({ - from: { - opacity: 1 - }, - to: { - opacity: 0, - visibility: 'hidden' - } -}); -var SLIDE_RIGHT_IN10 = _createSlideInX(-10); -var SLIDE_RIGHT_IN20 = _createSlideInX(-20); -var SLIDE_RIGHT_IN40 = _createSlideInX(-40); -var SLIDE_RIGHT_IN400 = _createSlideInX(-400); -var SLIDE_LEFT_IN10 = _createSlideInX(10); -var SLIDE_LEFT_IN20 = _createSlideInX(20); -var SLIDE_LEFT_IN40 = _createSlideInX(40); -var SLIDE_LEFT_IN400 = _createSlideInX(400); -var SLIDE_UP_IN10 = _createSlideInY(10); -var SLIDE_UP_IN20 = _createSlideInY(20); -var SLIDE_DOWN_IN10 = _createSlideInY(-10); -var SLIDE_DOWN_IN20 = _createSlideInY(-20); -var SLIDE_RIGHT_OUT10 = _createSlideOutX(10); -var SLIDE_RIGHT_OUT20 = _createSlideOutX(20); -var SLIDE_RIGHT_OUT40 = _createSlideOutX(40); -var SLIDE_RIGHT_OUT400 = _createSlideOutX(400); -var SLIDE_LEFT_OUT10 = _createSlideOutX(-10); -var SLIDE_LEFT_OUT20 = _createSlideOutX(-20); -var SLIDE_LEFT_OUT40 = _createSlideOutX(-40); -var SLIDE_LEFT_OUT400 = _createSlideOutX(-400); -var SLIDE_UP_OUT10 = _createSlideOutY(-10); -var SLIDE_UP_OUT20 = _createSlideOutY(-20); -var SLIDE_DOWN_OUT10 = _createSlideOutY(10); -var SLIDE_DOWN_OUT20 = _createSlideOutY(20); -var SCALE_UP100 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(.98,.98,1)' - }, - to: { - transform: 'scale3d(1,1,1)' + } + var FocusRectsProvider = function(props) { + var providerRef = props.providerRef, layerRoot = props.layerRoot; + var registeredProviders = React__namespace.useState([])[0]; + var parentContext = React__namespace.useContext(FocusRectsContext); + var inheritParentContext = parentContext !== void 0 && !layerRoot; + var context2 = React__namespace.useMemo(function() { + return inheritParentContext ? void 0 : { + providerRef, + registeredProviders, + registerProvider: function(ref2) { + registeredProviders.push(ref2); + parentContext === null || parentContext === void 0 ? void 0 : parentContext.registerProvider(ref2); + }, + unregisterProvider: function(ref2) { + parentContext === null || parentContext === void 0 ? void 0 : parentContext.unregisterProvider(ref2); + var i = registeredProviders.indexOf(ref2); + if (i >= 0) { + registeredProviders.splice(i, 1); + } + } + }; + }, [providerRef, registeredProviders, parentContext, inheritParentContext]); + React__namespace.useEffect(function() { + if (context2) { + context2.registerProvider(context2.providerRef); + return function() { + return context2.unregisterProvider(context2.providerRef); + }; + } + }, [context2]); + if (context2) { + return React__namespace.createElement(FocusRectsContext.Provider, { value: context2 }, props.children); + } else { + return React__namespace.createElement(React__namespace.Fragment, null, props.children); + } + }; + function getItem(key2) { + var result = null; + try { + var win = getWindow(); + result = win ? win.localStorage.getItem(key2) : null; + } catch (e) { + } + return result; + } + var _language; + var STORAGE_KEY = "language"; + function getLanguage(persistenceType) { + if (persistenceType === void 0) { + persistenceType = "sessionStorage"; + } + if (_language === void 0) { + var doc = getDocument(); + var savedLanguage = persistenceType === "localStorage" ? getItem(STORAGE_KEY) : persistenceType === "sessionStorage" ? getItem$1(STORAGE_KEY) : void 0; + if (savedLanguage) { + _language = savedLanguage; + } + if (_language === void 0 && doc) { + _language = doc.documentElement.getAttribute("lang"); + } + if (_language === void 0) { + _language = "en"; + } } -}); -var SCALE_DOWN98 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(1,1,1)' - }, - to: { - transform: 'scale3d(.98,.98,1)' + return _language; + } + function merge$3(target2) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; } -}); -var SCALE_DOWN100 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(1.03,1.03,1)' - }, - to: { - transform: 'scale3d(1,1,1)' + for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) { + var arg = args_1[_a2]; + _merge(target2 || {}, arg); } -}); -var SCALE_UP103 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(1,1,1)' - }, - to: { - transform: 'scale3d(1.03,1.03,1)' + return target2; + } + function _merge(target2, source2, circularReferences) { + if (circularReferences === void 0) { + circularReferences = []; + } + circularReferences.push(source2); + for (var name_1 in source2) { + if (source2.hasOwnProperty(name_1)) { + if (name_1 !== "__proto__" && name_1 !== "constructor" && name_1 !== "prototype") { + var value2 = source2[name_1]; + if (typeof value2 === "object" && value2 !== null && !Array.isArray(value2)) { + var isCircularReference = circularReferences.indexOf(value2) > -1; + target2[name_1] = isCircularReference ? value2 : _merge(target2[name_1] || {}, value2, circularReferences); + } else { + target2[name_1] = value2; + } + } + } } -}); -var ROTATE90 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'rotateZ(0deg)' - }, - to: { - transform: 'rotateZ(90deg)' + circularReferences.pop(); + return target2; + } + var isIOS = function() { + if (!window || !window.navigator || !window.navigator.userAgent) { + return false; } -}); -var ROTATE_N90 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'rotateZ(0deg)' - }, - to: { - transform: 'rotateZ(-90deg)' + return /iPad|iPhone|iPod/i.test(window.navigator.userAgent); + }; + var tagsToIgnore = ["TEMPLATE", "STYLE", "SCRIPT"]; + function modalize(target2) { + var targetDocument = getDocument(target2); + if (!targetDocument) { + return function() { + return void 0; + }; } -}); -var AnimationVariables = { - easeFunction1: EASING_FUNCTION_1, - easeFunction2: EASING_FUNCTION_2, - durationValue1: DURATION_1, - durationValue2: DURATION_2, - durationValue3: DURATION_3, - durationValue4: DURATION_4 -}; -var AnimationStyles = { - slideRightIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN10), DURATION_3, EASING_FUNCTION_1), - slideRightIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN20), DURATION_3, EASING_FUNCTION_1), - slideRightIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN40), DURATION_3, EASING_FUNCTION_1), - slideRightIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN400), DURATION_3, EASING_FUNCTION_1), - slideLeftIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN10), DURATION_3, EASING_FUNCTION_1), - slideLeftIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN20), DURATION_3, EASING_FUNCTION_1), - slideLeftIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN40), DURATION_3, EASING_FUNCTION_1), - slideLeftIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN400), DURATION_3, EASING_FUNCTION_1), - slideUpIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN10), DURATION_3, EASING_FUNCTION_1), - slideUpIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN20), DURATION_3, EASING_FUNCTION_1), - slideDownIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN10), DURATION_3, EASING_FUNCTION_1), - slideDownIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN20), DURATION_3, EASING_FUNCTION_1), - slideRightOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT10), DURATION_3, EASING_FUNCTION_1), - slideRightOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT20), DURATION_3, EASING_FUNCTION_1), - slideRightOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT40), DURATION_3, EASING_FUNCTION_1), - slideRightOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT400), DURATION_3, EASING_FUNCTION_1), - slideLeftOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT10), DURATION_3, EASING_FUNCTION_1), - slideLeftOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT20), DURATION_3, EASING_FUNCTION_1), - slideLeftOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT40), DURATION_3, EASING_FUNCTION_1), - slideLeftOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT400), DURATION_3, EASING_FUNCTION_1), - slideUpOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT10), DURATION_3, EASING_FUNCTION_1), - slideUpOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT20), DURATION_3, EASING_FUNCTION_1), - slideDownOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT10), DURATION_3, EASING_FUNCTION_1), - slideDownOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT20), DURATION_3, EASING_FUNCTION_1), - scaleUpIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_UP100), DURATION_3, EASING_FUNCTION_1), - scaleDownIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_DOWN100), DURATION_3, EASING_FUNCTION_1), - scaleUpOut103: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_UP103), DURATION_1, EASING_FUNCTION_2), - scaleDownOut98: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_DOWN98), DURATION_1, EASING_FUNCTION_2), - fadeIn100: _createAnimation(FADE_IN, DURATION_1, EASING_FUNCTION_2), - fadeIn200: _createAnimation(FADE_IN, DURATION_2, EASING_FUNCTION_2), - fadeIn400: _createAnimation(FADE_IN, DURATION_3, EASING_FUNCTION_2), - fadeIn500: _createAnimation(FADE_IN, DURATION_4, EASING_FUNCTION_2), - fadeOut100: _createAnimation(FADE_OUT, DURATION_1, EASING_FUNCTION_2), - fadeOut200: _createAnimation(FADE_OUT, DURATION_2, EASING_FUNCTION_2), - fadeOut400: _createAnimation(FADE_OUT, DURATION_3, EASING_FUNCTION_2), - fadeOut500: _createAnimation(FADE_OUT, DURATION_4, EASING_FUNCTION_2), - rotate90deg: _createAnimation(ROTATE90, '0.1s', EASING_FUNCTION_2), - rotateN90deg: _createAnimation(ROTATE_N90, '0.1s', EASING_FUNCTION_2) -}; -function _createAnimation(animationName, animationDuration, animationTimingFunction) { - return { - animationName: animationName, - animationDuration: animationDuration, - animationTimingFunction: animationTimingFunction, - animationFillMode: 'both' - }; -} -function _createSlideInX(fromX) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(".concat(fromX, "px,0,0)"), - pointerEvents: 'none' - }, - to: { - transform: "translate3d(0,0,0)", - pointerEvents: 'auto' - } - }); -} -function _createSlideInY(fromY) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(0,".concat(fromY, "px,0)"), - pointerEvents: 'none' - }, - to: { - transform: "translate3d(0,0,0)", - pointerEvents: 'auto' - } - }); -} -function _createSlideOutX(toX) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(0,0,0)" - }, - to: { - transform: "translate3d(".concat(toX, "px,0,0)") - } - }); -} -function _createSlideOutY(toY) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(0,0,0)" - }, - to: { - transform: "translate3d(0,".concat(toY, "px,0)") + var affectedNodes = []; + while (target2 !== targetDocument.body && target2.parentElement) { + for (var _i = 0, _a2 = target2.parentElement.children; _i < _a2.length; _i++) { + var sibling = _a2[_i]; + var ariaHidden = sibling.getAttribute("aria-hidden"); + if (sibling !== target2 && (ariaHidden === null || ariaHidden === void 0 ? void 0 : ariaHidden.toLowerCase()) !== "true" && tagsToIgnore.indexOf(sibling.tagName) === -1) { + affectedNodes.push([sibling, ariaHidden]); } - }); -} - -},{"@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cXCfS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _createFontStyles.createFontStyles)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _defaultFontStyles.DefaultFontStyles)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _defaultFontStyles.registerDefaultFontFaces)); -var _fluentFonts = require("./FluentFonts"); -parcelHelpers.exportAll(_fluentFonts, exports); -var _createFontStyles = require("./createFontStyles"); -var _defaultFontStyles = require("./DefaultFontStyles"); - -},{"./FluentFonts":"2xotE","./createFontStyles":false,"./DefaultFontStyles":"9DzCb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2xotE":[function(require,module,exports,__globalThis) { -// Font face names to be registered. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalizedFontNames", ()=>LocalizedFontNames); -parcelHelpers.export(exports, "LocalizedFontFamilies", ()=>LocalizedFontFamilies); -parcelHelpers.export(exports, "FontSizes", ()=>FontSizes); -parcelHelpers.export(exports, "FontWeights", ()=>FontWeights); -parcelHelpers.export(exports, "IconFontSizes", ()=>IconFontSizes); -var LocalizedFontNames; -(function(LocalizedFontNames) { - LocalizedFontNames.Arabic = 'Segoe UI Web (Arabic)'; - LocalizedFontNames.Cyrillic = 'Segoe UI Web (Cyrillic)'; - LocalizedFontNames.EastEuropean = 'Segoe UI Web (East European)'; - LocalizedFontNames.Greek = 'Segoe UI Web (Greek)'; - LocalizedFontNames.Hebrew = 'Segoe UI Web (Hebrew)'; - LocalizedFontNames.Thai = 'Leelawadee UI Web'; - LocalizedFontNames.Vietnamese = 'Segoe UI Web (Vietnamese)'; - LocalizedFontNames.WestEuropean = 'Segoe UI Web (West European)'; - LocalizedFontNames.Selawik = 'Selawik Web'; - LocalizedFontNames.Armenian = 'Segoe UI Web (Armenian)'; - LocalizedFontNames.Georgian = 'Segoe UI Web (Georgian)'; -})(LocalizedFontNames || (LocalizedFontNames = {})); -var LocalizedFontFamilies; -(function(LocalizedFontFamilies) { - LocalizedFontFamilies.Arabic = "'".concat(LocalizedFontNames.Arabic, "'"); - LocalizedFontFamilies.ChineseSimplified = "'Microsoft Yahei UI', Verdana, Simsun"; - LocalizedFontFamilies.ChineseTraditional = "'Microsoft Jhenghei UI', Pmingliu"; - LocalizedFontFamilies.Cyrillic = "'".concat(LocalizedFontNames.Cyrillic, "'"); - LocalizedFontFamilies.EastEuropean = "'".concat(LocalizedFontNames.EastEuropean, "'"); - LocalizedFontFamilies.Greek = "'".concat(LocalizedFontNames.Greek, "'"); - LocalizedFontFamilies.Hebrew = "'".concat(LocalizedFontNames.Hebrew, "'"); - LocalizedFontFamilies.Hindi = "'Nirmala UI'"; - LocalizedFontFamilies.Japanese = "'Yu Gothic UI', 'Meiryo UI', Meiryo, 'MS Pgothic', Osaka"; - LocalizedFontFamilies.Korean = "'Malgun Gothic', Gulim"; - LocalizedFontFamilies.Selawik = "'".concat(LocalizedFontNames.Selawik, "'"); - LocalizedFontFamilies.Thai = "'Leelawadee UI Web', 'Kmer UI'"; - LocalizedFontFamilies.Vietnamese = "'".concat(LocalizedFontNames.Vietnamese, "'"); - LocalizedFontFamilies.WestEuropean = "'".concat(LocalizedFontNames.WestEuropean, "'"); - LocalizedFontFamilies.Armenian = "'".concat(LocalizedFontNames.Armenian, "'"); - LocalizedFontFamilies.Georgian = "'".concat(LocalizedFontNames.Georgian, "'"); -})(LocalizedFontFamilies || (LocalizedFontFamilies = {})); -var FontSizes; -(function(FontSizes) { - FontSizes.size10 = '10px'; - FontSizes.size12 = '12px'; - FontSizes.size14 = '14px'; - FontSizes.size16 = '16px'; - FontSizes.size18 = '18px'; - FontSizes.size20 = '20px'; - FontSizes.size24 = '24px'; - FontSizes.size28 = '28px'; - FontSizes.size32 = '32px'; - FontSizes.size42 = '42px'; - FontSizes.size68 = '68px'; - FontSizes.mini = '10px'; - FontSizes.xSmall = '10px'; - FontSizes.small = '12px'; - FontSizes.smallPlus = '12px'; - FontSizes.medium = '14px'; - FontSizes.mediumPlus = '16px'; - FontSizes.icon = '16px'; - FontSizes.large = '18px'; - FontSizes.xLarge = '20px'; - FontSizes.xLargePlus = '24px'; - FontSizes.xxLarge = '28px'; - FontSizes.xxLargePlus = '32px'; - FontSizes.superLarge = '42px'; - FontSizes.mega = '68px'; -})(FontSizes || (FontSizes = {})); -var FontWeights; -(function(FontWeights) { - FontWeights.light = 100; - FontWeights.semilight = 300; - FontWeights.regular = 400; - FontWeights.semibold = 600; - FontWeights.bold = 700; -})(FontWeights || (FontWeights = {})); -var IconFontSizes; -(function(IconFontSizes) { - IconFontSizes.xSmall = '10px'; - IconFontSizes.small = '12px'; - IconFontSizes.medium = '16px'; - IconFontSizes.large = '20px'; -})(IconFontSizes || (IconFontSizes = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gXPWQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createFontStyles", ()=>createFontStyles); -var _fluentFonts = require("./FluentFonts"); -// Fallback fonts, if specified system or web fonts are unavailable. -var FontFamilyFallbacks = "'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif"; -// By default, we favor system fonts for the default. -// All localized fonts use a web font and never use the system font. -var defaultFontFamily = "'Segoe UI', '".concat((0, _fluentFonts.LocalizedFontNames).WestEuropean, "'"); -// Mapping of language prefix to to font family. -var LanguageToFontMap = { - ar: (0, _fluentFonts.LocalizedFontFamilies).Arabic, - bg: (0, _fluentFonts.LocalizedFontFamilies).Cyrillic, - cs: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - el: (0, _fluentFonts.LocalizedFontFamilies).Greek, - et: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - he: (0, _fluentFonts.LocalizedFontFamilies).Hebrew, - hi: (0, _fluentFonts.LocalizedFontFamilies).Hindi, - hr: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - hu: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - ja: (0, _fluentFonts.LocalizedFontFamilies).Japanese, - kk: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - ko: (0, _fluentFonts.LocalizedFontFamilies).Korean, - lt: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - lv: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - pl: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - ru: (0, _fluentFonts.LocalizedFontFamilies).Cyrillic, - sk: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - 'sr-latn': (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - th: (0, _fluentFonts.LocalizedFontFamilies).Thai, - tr: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - uk: (0, _fluentFonts.LocalizedFontFamilies).Cyrillic, - vi: (0, _fluentFonts.LocalizedFontFamilies).Vietnamese, - 'zh-hans': (0, _fluentFonts.LocalizedFontFamilies).ChineseSimplified, - 'zh-hant': (0, _fluentFonts.LocalizedFontFamilies).ChineseTraditional, - hy: (0, _fluentFonts.LocalizedFontFamilies).Armenian, - ka: (0, _fluentFonts.LocalizedFontFamilies).Georgian -}; -function _fontFamilyWithFallbacks(fontFamily) { - return "".concat(fontFamily, ", ").concat(FontFamilyFallbacks); -} -/** - * If there is a localized font for this language, return that. - * Returns undefined if there is no localized font for that language. - */ function _getLocalizedFontFamily(language) { - for(var lang in LanguageToFontMap){ - if (LanguageToFontMap.hasOwnProperty(lang) && language && lang.indexOf(language) === 0) // eslint-disable-next-line @typescript-eslint/no-explicit-any - return LanguageToFontMap[lang]; + } + target2 = target2.parentElement; } - return defaultFontFamily; -} -function _createFont(size, weight, fontFamily) { - return { - fontFamily: fontFamily, - MozOsxFontSmoothing: 'grayscale', - WebkitFontSmoothing: 'antialiased', - fontSize: size, - fontWeight: weight - }; -} -function createFontStyles(localeCode) { - var localizedFont = _getLocalizedFontFamily(localeCode); - var fontFamilyWithFallback = _fontFamilyWithFallbacks(localizedFont); - var fontStyles = { - tiny: _createFont((0, _fluentFonts.FontSizes).mini, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - xSmall: _createFont((0, _fluentFonts.FontSizes).xSmall, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - small: _createFont((0, _fluentFonts.FontSizes).small, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - smallPlus: _createFont((0, _fluentFonts.FontSizes).smallPlus, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - medium: _createFont((0, _fluentFonts.FontSizes).medium, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - mediumPlus: _createFont((0, _fluentFonts.FontSizes).mediumPlus, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - large: _createFont((0, _fluentFonts.FontSizes).large, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - xLarge: _createFont((0, _fluentFonts.FontSizes).xLarge, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - xLargePlus: _createFont((0, _fluentFonts.FontSizes).xLargePlus, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - xxLarge: _createFont((0, _fluentFonts.FontSizes).xxLarge, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - xxLargePlus: _createFont((0, _fluentFonts.FontSizes).xxLargePlus, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - superLarge: _createFont((0, _fluentFonts.FontSizes).superLarge, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - mega: _createFont((0, _fluentFonts.FontSizes).mega, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback) - }; - return fontStyles; -} - -},{"./FluentFonts":"2xotE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9DzCb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>DefaultFontStyles); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>registerDefaultFontFaces); -var _mergeStyles = require("@fluentui/merge-styles"); -var _fluentFonts = require("./FluentFonts"); -var _createFontStyles = require("./createFontStyles"); -var _utilities = require("@fluentui/utilities"); -// Default urls. -var DefaultBaseUrl = 'https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets'; -var DefaultFontStyles = (0, _createFontStyles.createFontStyles)((0, _utilities.getLanguage)()); -function _registerFontFace(fontFamily, url, fontWeight, localFontName) { - fontFamily = "'".concat(fontFamily, "'"); - var localFontSrc = localFontName !== undefined ? "local('".concat(localFontName, "'),") : ''; - (0, _mergeStyles.fontFace)({ - fontFamily: fontFamily, - src: localFontSrc + "url('".concat(url, ".woff2') format('woff2'),") + "url('".concat(url, ".woff') format('woff')"), - fontWeight: fontWeight, - fontStyle: 'normal', - fontDisplay: 'swap' - }); -} -function _registerFontFaceSet(baseUrl, fontFamily, cdnFolder, cdnFontName, localFontName) { - if (cdnFontName === void 0) cdnFontName = 'segoeui'; - var urlBase = "".concat(baseUrl, "/").concat(cdnFolder, "/").concat(cdnFontName); - _registerFontFace(fontFamily, urlBase + '-light', (0, _fluentFonts.FontWeights).light, localFontName && localFontName + ' Light'); - _registerFontFace(fontFamily, urlBase + '-semilight', (0, _fluentFonts.FontWeights).semilight, localFontName && localFontName + ' SemiLight'); - _registerFontFace(fontFamily, urlBase + '-regular', (0, _fluentFonts.FontWeights).regular, localFontName); - _registerFontFace(fontFamily, urlBase + '-semibold', (0, _fluentFonts.FontWeights).semibold, localFontName && localFontName + ' SemiBold'); - _registerFontFace(fontFamily, urlBase + '-bold', (0, _fluentFonts.FontWeights).bold, localFontName && localFontName + ' Bold'); -} -function registerDefaultFontFaces(baseUrl) { - if (baseUrl) { - var fontUrl = "".concat(baseUrl, "/fonts"); - // Produce @font-face definitions for all supported web fonts. - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Thai, 'leelawadeeui-thai', 'leelawadeeui'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Arabic, 'segoeui-arabic'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Cyrillic, 'segoeui-cyrillic'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).EastEuropean, 'segoeui-easteuropean'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Greek, 'segoeui-greek'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Hebrew, 'segoeui-hebrew'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Vietnamese, 'segoeui-vietnamese'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).WestEuropean, 'segoeui-westeuropean', 'segoeui', 'Segoe UI'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontFamilies).Selawik, 'selawik', 'selawik'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Armenian, 'segoeui-armenian'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Georgian, 'segoeui-georgian'); - // Leelawadee UI (Thai) does not have a 'light' weight, so we override - // the font-face generated above to use the 'semilight' weight instead. - _registerFontFace('Leelawadee UI Web', "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-semilight"), (0, _fluentFonts.FontWeights).light); - // Leelawadee UI (Thai) does not have a 'semibold' weight, so we override - // the font-face generated above to use the 'bold' weight instead. - _registerFontFace('Leelawadee UI Web', "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-bold"), (0, _fluentFonts.FontWeights).semibold); - } -} -/** - * Reads the fontBaseUrl from window.FabricConfig.fontBaseUrl or falls back to a default. - */ function _getFontBaseUrl() { - var _a, _b; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var fabricConfig = (_a = (0, _utilities.getWindow)()) === null || _a === void 0 ? void 0 : _a.FabricConfig; - return (_b = fabricConfig === null || fabricConfig === void 0 ? void 0 : fabricConfig.fontBaseUrl) !== null && _b !== void 0 ? _b : DefaultBaseUrl; -} -/** - * Register the font faces. - */ registerDefaultFontFaces(_getFontBaseUrl()); - -},{"@fluentui/merge-styles":"bDG2L","./FluentFonts":"2xotE","./createFontStyles":"gXPWQ","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"91iV5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Creates a custom theme definition. - * @param theme - Partial theme object. - * @param depComments - Whether to include deprecated tags as comments for deprecated slots. - */ parcelHelpers.export(exports, "createTheme", ()=>createTheme); -var _index = require("./colors/index"); -var _index1 = require("./effects/index"); -var _index2 = require("./fonts/index"); -var _mergeThemes = require("./mergeThemes"); -var _index3 = require("./spacing/index"); -var _makeSemanticColors = require("./utilities/makeSemanticColors"); -function createTheme(theme, depComments) { - if (theme === void 0) theme = {}; - if (depComments === void 0) depComments = false; - var isInverted = !!theme.isInverted; - var baseTheme = { - palette: (0, _index.DefaultPalette), - effects: (0, _index1.DefaultEffects), - fonts: (0, _index2.DefaultFontStyles), - spacing: (0, _index3.DefaultSpacing), - isInverted: isInverted, - disableGlobalClassNames: false, - semanticColors: (0, _makeSemanticColors.makeSemanticColors)((0, _index.DefaultPalette), (0, _index1.DefaultEffects), undefined, isInverted, depComments), - rtl: undefined - }; - return (0, _mergeThemes.mergeThemes)(baseTheme, theme); -} - -},{"./colors/index":"7yAiX","./effects/index":"2nXfK","./fonts/index":"cXCfS","./mergeThemes":"j9270","./spacing/index":"82zHh","./utilities/makeSemanticColors":"dsk6N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dCgRo":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/theme', '2.6.63'); - -},{"@fluentui/set-version":"iqYXf"}],"Tr1M8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalizedFontNames", ()=>(0, _theme.LocalizedFontNames)); -parcelHelpers.export(exports, "LocalizedFontFamilies", ()=>(0, _theme.LocalizedFontFamilies)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _theme.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _theme.FontWeights)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _theme.IconFontSizes)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _theme.createFontStyles)); -var _theme = require("@fluentui/theme"); - -},{"@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"byDYo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getFocusStyle", ()=>getFocusStyle); -/** - * Generates style to clear browser specific focus styles. - */ parcelHelpers.export(exports, "focusClear", ()=>focusClear); -/** - * Generates a style which can be used to set a border on focus. - * - * @param theme - The theme object to use. - * @param inset - The number of pixels to inset the border (default 0) - * @param width - The border width in pixels (default 1) - * @param color - Color of the outline (default `theme.palette.neutralSecondary`) - * @returns The style object. - */ parcelHelpers.export(exports, "getFocusOutlineStyle", ()=>getFocusOutlineStyle); -parcelHelpers.export(exports, "getInputFocusStyle", ()=>getInputFocusStyle); -var _commonStyles = require("./CommonStyles"); -var _utilities = require("@fluentui/utilities"); -var _zIndexes = require("./zIndexes"); -function getFocusStyle(theme, insetOrOptions, position, highContrastStyle, borderColor, outlineColor, isFocusedOnly, borderRadius) { - if (typeof insetOrOptions === 'number' || !insetOrOptions) return _getFocusStyleInternal(theme, { - inset: insetOrOptions, - position: position, - highContrastStyle: highContrastStyle, - borderColor: borderColor, - outlineColor: outlineColor, - isFocusedOnly: isFocusedOnly, - borderRadius: borderRadius + affectedNodes.forEach(function(_a3) { + var node = _a3[0]; + node.setAttribute("aria-hidden", "true"); }); - else return _getFocusStyleInternal(theme, insetOrOptions); -} -function _getFocusStyleInternal(theme, options) { - var _a, _b; - if (options === void 0) options = {}; - var borderRadius = options.borderRadius, _c = options.inset, inset = _c === void 0 ? 0 : _c, _d = options.width, width = _d === void 0 ? 1 : _d, _e = options.position, position = _e === void 0 ? 'relative' : _e, highContrastStyle = options.highContrastStyle, _f = options.borderColor, borderColor = _f === void 0 ? theme.palette.white : _f, _g = options.outlineColor, outlineColor = _g === void 0 ? theme.palette.neutralSecondary : _g, _h = options.isFocusedOnly, isFocusedOnly = _h === void 0 ? true : _h, pointerEvents = options.pointerEvents; - return { - // Clear browser-specific focus styles and use 'transparent' as placeholder for focus style. - outline: 'transparent', - // Requirement because pseudo-element is absolutely positioned. - position: position, - selectors: (_a = { - // Clear the focus border in Firefox. - // Reference: http://stackoverflow.com/a/199319/1436671 - '::-moz-focus-inner': { - border: '0' - } - }, // When the element that uses this mixin is in a :focus state, add a pseudo-element to - // create a border. - _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &").concat(isFocusedOnly ? ':focus' : '', ":after, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &").concat(isFocusedOnly ? ':focus' : '', ":after")] = { - content: '""', - position: 'absolute', - pointerEvents: pointerEvents, - left: inset + 1, - top: inset + 1, - bottom: inset + 1, - right: inset + 1, - border: "".concat(width, "px solid ").concat(borderColor), - outline: "".concat(width, "px solid ").concat(outlineColor), - zIndex: (0, _zIndexes.ZIndexes).FocusStyle, - borderRadius: borderRadius, - selectors: (_b = {}, _b[0, _commonStyles.HighContrastSelector] = highContrastStyle, _b) - }, _a) - }; -} -function focusClear() { - return { - selectors: { - '&::-moz-focus-inner': { - // Clear the focus border in Firefox. Reference: http://stackoverflow.com/a/199319/1436671 - border: 0 - }, - '&': { - // Clear browser specific focus styles and use transparent as placeholder for focus style - outline: 'transparent' - } - } + return function() { + unmodalize(affectedNodes); + affectedNodes = []; }; -} -function getFocusOutlineStyle(theme, inset, width, color) { - var _a; - if (inset === void 0) inset = 0; - if (width === void 0) width = 1; - return { - selectors: (_a = {}, _a[":global(".concat((0, _utilities.IsFocusVisibleClassName), ") &:focus")] = { - outline: "".concat(width, " solid ").concat(color || theme.palette.neutralSecondary), - outlineOffset: "".concat(-inset, "px") - }, _a) - }; -} -var getInputFocusStyle = function(borderColor, borderRadius, borderType, borderPosition) { - var _a, _b, _c; - if (borderType === void 0) borderType = 'border'; - if (borderPosition === void 0) borderPosition = -1; - var isBorderBottom = borderType === 'borderBottom'; - return { - borderColor: borderColor, - selectors: { - ':after': (_a = { - pointerEvents: 'none', - content: "''", - position: 'absolute', - left: isBorderBottom ? 0 : borderPosition, - top: borderPosition, - bottom: borderPosition, - right: isBorderBottom ? 0 : borderPosition - }, _a[borderType] = "2px solid ".concat(borderColor), _a.borderRadius = borderRadius, _a.width = borderType === 'borderBottom' ? '100%' : undefined, _a.selectors = (_b = {}, _b[0, _commonStyles.HighContrastSelector] = (_c = {}, _c[borderType === 'border' ? 'borderColor' : 'borderBottomColor'] = 'Highlight', _c), _b), _a) - } - }; -}; - -},{"./CommonStyles":"rgkn6","@fluentui/utilities":"55bj3","./zIndexes":"hDsdg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"rgkn6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HighContrastSelector", ()=>HighContrastSelector); -parcelHelpers.export(exports, "HighContrastSelectorWhite", ()=>HighContrastSelectorWhite); -parcelHelpers.export(exports, "HighContrastSelectorBlack", ()=>HighContrastSelectorBlack); -parcelHelpers.export(exports, "EdgeChromiumHighContrastSelector", ()=>EdgeChromiumHighContrastSelector); -parcelHelpers.export(exports, "ScreenWidthMinSmall", ()=>ScreenWidthMinSmall); -parcelHelpers.export(exports, "ScreenWidthMinMedium", ()=>ScreenWidthMinMedium); -parcelHelpers.export(exports, "ScreenWidthMinLarge", ()=>ScreenWidthMinLarge); -parcelHelpers.export(exports, "ScreenWidthMinXLarge", ()=>ScreenWidthMinXLarge); -parcelHelpers.export(exports, "ScreenWidthMinXXLarge", ()=>ScreenWidthMinXXLarge); -parcelHelpers.export(exports, "ScreenWidthMinXXXLarge", ()=>ScreenWidthMinXXXLarge); -parcelHelpers.export(exports, "ScreenWidthMaxSmall", ()=>ScreenWidthMaxSmall); -parcelHelpers.export(exports, "ScreenWidthMaxMedium", ()=>ScreenWidthMaxMedium); -parcelHelpers.export(exports, "ScreenWidthMaxLarge", ()=>ScreenWidthMaxLarge); -parcelHelpers.export(exports, "ScreenWidthMaxXLarge", ()=>ScreenWidthMaxXLarge); -parcelHelpers.export(exports, "ScreenWidthMaxXXLarge", ()=>ScreenWidthMaxXXLarge); -parcelHelpers.export(exports, "ScreenWidthMinUhfMobile", ()=>ScreenWidthMinUhfMobile); -parcelHelpers.export(exports, "getScreenSelector", ()=>getScreenSelector); -/** - * The style which turns off high contrast adjustment in browsers. - */ parcelHelpers.export(exports, "getHighContrastNoAdjustStyle", ()=>getHighContrastNoAdjustStyle); -/** - * The style which turns off high contrast adjustment in (only) Edge Chromium browser. - * @deprecated Use `getHighContrastNoAdjustStyle` - */ // eslint-disable-next-line deprecation/deprecation -parcelHelpers.export(exports, "getEdgeChromiumNoHighContrastAdjustSelector", ()=>getEdgeChromiumNoHighContrastAdjustSelector); -var HighContrastSelector = '@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)'; -var HighContrastSelectorWhite = // eslint-disable-next-line @fluentui/max-len -'@media screen and (-ms-high-contrast: black-on-white), screen and (forced-colors: active) and (prefers-color-scheme: light)'; -var HighContrastSelectorBlack = // eslint-disable-next-line @fluentui/max-len -'@media screen and (-ms-high-contrast: white-on-black), screen and (forced-colors: active) and (prefers-color-scheme: dark)'; -var EdgeChromiumHighContrastSelector = '@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)'; -var ScreenWidthMinSmall = 320; -var ScreenWidthMinMedium = 480; -var ScreenWidthMinLarge = 640; -var ScreenWidthMinXLarge = 1024; -var ScreenWidthMinXXLarge = 1366; -var ScreenWidthMinXXXLarge = 1920; -var ScreenWidthMaxSmall = ScreenWidthMinMedium - 1; -var ScreenWidthMaxMedium = ScreenWidthMinLarge - 1; -var ScreenWidthMaxLarge = ScreenWidthMinXLarge - 1; -var ScreenWidthMaxXLarge = ScreenWidthMinXXLarge - 1; -var ScreenWidthMaxXXLarge = ScreenWidthMinXXXLarge - 1; -var ScreenWidthMinUhfMobile = 768; -function getScreenSelector(min, max) { - var minSelector = typeof min === 'number' ? " and (min-width: ".concat(min, "px)") : ''; - var maxSelector = typeof max === 'number' ? " and (max-width: ".concat(max, "px)") : ''; - return "@media only screen".concat(minSelector).concat(maxSelector); -} -function getHighContrastNoAdjustStyle() { - return { - forcedColorAdjust: 'none', - MsHighContrastAdjust: 'none' - }; -} -function getEdgeChromiumNoHighContrastAdjustSelector() { - var _a; - return _a = {}, // eslint-disable-next-line deprecation/deprecation - _a[EdgeChromiumHighContrastSelector] = { - forcedColorAdjust: 'none', - MsHighContrastAdjust: 'none' - }, _a; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hDsdg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ZIndexes", ()=>ZIndexes); -var ZIndexes; -(function(ZIndexes) { - ZIndexes.Nav = 1; - /** - * @deprecated Do not use - */ ZIndexes.ScrollablePane = 1; - ZIndexes.FocusStyle = 1; - ZIndexes.Coachmark = 1000; - ZIndexes.Layer = 1000000; - ZIndexes.KeytipLayer = 1000001; -})(ZIndexes || (ZIndexes = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"furJc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>hiddenContentStyle); -var hiddenContentStyle = { - position: 'absolute', - width: 1, - height: 1, - margin: -1, - padding: 0, - border: 0, - overflow: 'hidden', - whiteSpace: 'nowrap' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g6mIZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Checks for the `disableGlobalClassNames` property on the `theme` to determine if it should return `classNames` - * Note that calls to this function are memoized. - * - * @param classNames - The collection of global class names that apply when the flag is false. Make sure to pass in - * the same instance on each call to benefit from memoization. - * @param theme - The theme to check the flag on - * @param disableGlobalClassNames - Optional. Explicitly opt in/out of disabling global classnames. Defaults to false. - */ parcelHelpers.export(exports, "getGlobalClassNames", ()=>getGlobalClassNames); -var _mergeStyles = require("@fluentui/merge-styles"); -var _utilities = require("@fluentui/utilities"); -/** - * Internal memoized function which simply takes in the class map and the - * disable boolean. These immutable values can be memoized. - */ var _getGlobalClassNames = (0, _utilities.memoizeFunction)(function(classNames, disableGlobalClassNames) { - var styleSheet = (0, _mergeStyles.Stylesheet).getInstance(); - if (disableGlobalClassNames) // disable global classnames - return Object.keys(classNames).reduce(function(acc, className) { - acc[className] = styleSheet.getClassName(classNames[className]); - return acc; - }, {}); - // use global classnames - return classNames; -}); -function getGlobalClassNames(classNames, theme, disableGlobalClassNames) { - return _getGlobalClassNames(classNames, disableGlobalClassNames !== undefined ? disableGlobalClassNames : theme.disableGlobalClassNames); -} - -},{"@fluentui/merge-styles":"bDG2L","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"uuyP7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createTheme", ()=>(0, _theme.createTheme)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>ThemeSettingName); -parcelHelpers.export(exports, "initializeThemeInCustomizations", ()=>initializeThemeInCustomizations); -/** - * Gets the theme object - * @param depComments - Whether to include deprecated tags as comments for deprecated slots. - */ parcelHelpers.export(exports, "getTheme", ()=>getTheme); -/** - * Registers a callback that gets called whenever the theme changes. - * This should only be used when the component cannot automatically get theme changes through its state. - * This will not register duplicate callbacks. - */ parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>registerOnThemeChangeCallback); -/** - * See registerOnThemeChangeCallback(). - * Removes previously registered callbacks. - */ parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>removeOnThemeChangeCallback); -/** - * Applies the theme, while filling in missing slots. - * @param theme - Partial theme object. - * @param depComments - Whether to include deprecated tags as comments for deprecated slots. - */ parcelHelpers.export(exports, "loadTheme", ()=>loadTheme); -var _tslib = require("tslib"); -var _utilities = require("@fluentui/utilities"); -var _loadThemedStyles = require("@microsoft/load-themed-styles"); -var _theme = require("@fluentui/theme"); -var _theme1 = (0, _theme.createTheme)({}); -var _onThemeChangeCallbacks = []; -var ThemeSettingName = 'theme'; -function initializeThemeInCustomizations() { - var _a; - var _b, _c; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var win = (0, _utilities.getWindow)(); - if ((_b = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _b === void 0 ? void 0 : _b.legacyTheme) // does everything the `else` clause does and more, such as invoke legacy theming - loadTheme(win.FabricConfig.legacyTheme); - else if (!(0, _utilities.Customizations).getSettings([ - ThemeSettingName - ]).theme) { - if ((_c = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _c === void 0 ? void 0 : _c.theme) _theme1 = (0, _theme.createTheme)(win.FabricConfig.theme); - // Set the default theme. - (0, _utilities.Customizations).applySettings((_a = {}, _a[ThemeSettingName] = _theme1, _a)); - } -} -initializeThemeInCustomizations(); -function getTheme(depComments) { - if (depComments === void 0) depComments = false; - if (depComments === true) _theme1 = (0, _theme.createTheme)({}, depComments); - return _theme1; -} -function registerOnThemeChangeCallback(callback) { - if (_onThemeChangeCallbacks.indexOf(callback) === -1) _onThemeChangeCallbacks.push(callback); -} -function removeOnThemeChangeCallback(callback) { - var i = _onThemeChangeCallbacks.indexOf(callback); - if (i === -1) return; - _onThemeChangeCallbacks.splice(i, 1); -} -function loadTheme(theme, depComments) { - var _a; - if (depComments === void 0) depComments = false; - _theme1 = (0, _theme.createTheme)(theme, depComments); - // Invoke the legacy method of theming the page as well. - (0, _loadThemedStyles.loadTheme)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, _theme1.palette), _theme1.semanticColors), _theme1.effects), _loadFonts(_theme1))); - (0, _utilities.Customizations).applySettings((_a = {}, _a[ThemeSettingName] = _theme1, _a)); - _onThemeChangeCallbacks.forEach(function(callback) { - try { - callback(_theme1); - } catch (e) { - // don't let a bad callback break everything else - } + } + function unmodalize(affectedNodes) { + affectedNodes.forEach(function(_a2) { + var node = _a2[0], originalValue = _a2[1]; + if (originalValue) { + node.setAttribute("aria-hidden", originalValue); + } else { + node.removeAttribute("aria-hidden"); + } }); - return _theme1; -} -/** - * Loads font variables into a JSON object. - * @param theme - The theme object - */ function _loadFonts(theme) { - var lines = {}; - for(var _i = 0, _a = Object.keys(theme.fonts); _i < _a.length; _i++){ - var fontName = _a[_i]; - var font = theme.fonts[fontName]; - for(var _b = 0, _c = Object.keys(font); _b < _c.length; _b++){ - var propName = _c[_b]; - var name_1 = fontName + propName.charAt(0).toUpperCase() + propName.slice(1); - var value = font[propName]; - if (propName === 'fontSize' && typeof value === 'number') // if it's a number, convert it to px by default like our theming system does - value = value + 'px'; - lines[name_1] = value; - } + } + var isMacResult; + function isMac(reset2) { + var _a2; + if (typeof isMacResult === "undefined" || reset2) { + var win = getWindow(); + var userAgent = (_a2 = win === null || win === void 0 ? void 0 : win.navigator) === null || _a2 === void 0 ? void 0 : _a2.userAgent; + isMacResult = !!userAgent && userAgent.indexOf("Macintosh") !== -1; } - return lines; -} - -},{"tslib":"9gizs","@fluentui/utilities":"55bj3","@microsoft/load-themed-styles":"eP2p8","@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eP2p8":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See LICENSE in the project root for license information. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Loads a set of style text. If it is registered too early, we will register it when the window.load - * event is fired. - * @param {string | ThemableArray} styles Themable style text to register. - * @param {boolean} loadAsync When true, always load styles in async mode, irrespective of current sync mode. - */ parcelHelpers.export(exports, "loadStyles", ()=>loadStyles); -/** - * Allows for customizable loadStyles logic. e.g. for server side rendering application - * @param {(processedStyles: string, rawStyles?: string | ThemableArray) => void} - * a loadStyles callback that gets called when styles are loaded or reloaded - */ parcelHelpers.export(exports, "configureLoadStyles", ()=>configureLoadStyles); -/** - * Configure run mode of load-themable-styles - * @param mode load-themable-styles run mode, async or sync - */ parcelHelpers.export(exports, "configureRunMode", ()=>configureRunMode); -/** - * external code can call flush to synchronously force processing of currently buffered styles - */ parcelHelpers.export(exports, "flush", ()=>flush); -/** - * Registers a set theme tokens to find and replace. If styles were already registered, they will be - * replaced. - * @param {theme} theme JSON object of theme tokens to values. - */ parcelHelpers.export(exports, "loadTheme", ()=>loadTheme); -/** - * Clear already registered style elements and style records in theme_State object - * @param option - specify which group of registered styles should be cleared. - * Default to be both themable and non-themable styles will be cleared - */ parcelHelpers.export(exports, "clearStyles", ()=>clearStyles); -/** - * Find theme tokens and replaces them with provided theme values. - * @param {string} styles Tokenized styles to fix. - */ parcelHelpers.export(exports, "detokenize", ()=>detokenize); -/** - * Split tokenized CSS into an array of strings and theme specification objects - * @param {string} styles Tokenized styles to split. - */ parcelHelpers.export(exports, "splitStyles", ()=>splitStyles); -var global = arguments[3]; -var __assign = undefined && undefined.__assign || function() { - __assign = Object.assign || function(t) { - for(var s, i = 1, n = arguments.length; i < n; i++){ - s = arguments[i]; - for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -// Store the theming state in __themeState__ global scope for reuse in the case of duplicate -// load-themed-styles hosted on the page. -var _root = typeof window === 'undefined' ? global : window; // eslint-disable-line @typescript-eslint/no-explicit-any -// Nonce string to inject into script tag if one provided. This is used in CSP (Content Security Policy). -var _styleNonce = _root && _root.CSPSettings && _root.CSPSettings.nonce; -var _themeState = initializeThemeState(); -/** - * Matches theming tokens. For example, "[theme: themeSlotName, default: #FFF]" (including the quotes). - */ var _themeTokenRegex = /[\'\"]\[theme:\s*(\w+)\s*(?:\,\s*default:\s*([\\"\']?[\.\,\(\)\#\-\s\w]*[\.\,\(\)\#\-\w][\"\']?))?\s*\][\'\"]/g; -var now = function() { - return typeof performance !== 'undefined' && !!performance.now ? performance.now() : Date.now(); -}; -function measure(func) { - var start = now(); - func(); - var end = now(); - _themeState.perf.duration += end - start; -} -/** - * initialize global state object - */ function initializeThemeState() { - var state = _root.__themeState__ || { - theme: undefined, - lastStyleElement: undefined, - registeredStyles: [] - }; - if (!state.runState) state = __assign(__assign({}, state), { - perf: { - count: 0, - duration: 0 - }, - runState: { - flushTimer: 0, - mode: 0 /* Mode.sync */ , - buffer: [] - } - }); - if (!state.registeredThemableStyles) state = __assign(__assign({}, state), { - registeredThemableStyles: [] - }); - _root.__themeState__ = state; - return state; -} -function loadStyles(styles, loadAsync) { - if (loadAsync === void 0) loadAsync = false; - measure(function() { - var styleParts = Array.isArray(styles) ? styles : splitStyles(styles); - var _a = _themeState.runState, mode = _a.mode, buffer = _a.buffer, flushTimer = _a.flushTimer; - if (loadAsync || mode === 1 /* Mode.async */ ) { - buffer.push(styleParts); - if (!flushTimer) _themeState.runState.flushTimer = asyncLoadStyles(); - } else applyThemableStyles(styleParts); - }); -} -function configureLoadStyles(loadStylesFn) { - _themeState.loadStyles = loadStylesFn; -} -function configureRunMode(mode) { - _themeState.runState.mode = mode; -} -function flush() { - measure(function() { - var styleArrays = _themeState.runState.buffer.slice(); - _themeState.runState.buffer = []; - var mergedStyleArray = [].concat.apply([], styleArrays); - if (mergedStyleArray.length > 0) applyThemableStyles(mergedStyleArray); - }); -} -/** - * register async loadStyles - */ function asyncLoadStyles() { - return setTimeout(function() { - _themeState.runState.flushTimer = 0; - flush(); - }, 0); -} -/** - * Loads a set of style text. If it is registered too early, we will register it when the window.load event - * is fired. - * @param {string} styleText Style to register. - * @param {IStyleRecord} styleRecord Existing style record to re-apply. - */ function applyThemableStyles(stylesArray, styleRecord) { - if (_themeState.loadStyles) _themeState.loadStyles(resolveThemableArray(stylesArray).styleString, stylesArray); - else registerStyles(stylesArray); -} -function loadTheme(theme) { - _themeState.theme = theme; - // reload styles. - reloadStyles(); -} -function clearStyles(option) { - if (option === void 0) option = 3 /* ClearStyleOptions.all */ ; - if (option === 3 /* ClearStyleOptions.all */ || option === 2 /* ClearStyleOptions.onlyNonThemable */ ) { - clearStylesInternal(_themeState.registeredStyles); - _themeState.registeredStyles = []; - } - if (option === 3 /* ClearStyleOptions.all */ || option === 1 /* ClearStyleOptions.onlyThemable */ ) { - clearStylesInternal(_themeState.registeredThemableStyles); - _themeState.registeredThemableStyles = []; - } -} -function clearStylesInternal(records) { - records.forEach(function(styleRecord) { - var styleElement = styleRecord && styleRecord.styleElement; - if (styleElement && styleElement.parentElement) styleElement.parentElement.removeChild(styleElement); - }); -} -/** - * Reloads styles. - */ function reloadStyles() { - if (_themeState.theme) { - var themableStyles = []; - for(var _i = 0, _a = _themeState.registeredThemableStyles; _i < _a.length; _i++){ - var styleRecord = _a[_i]; - themableStyles.push(styleRecord.themableStyle); - } - if (themableStyles.length > 0) { - clearStyles(1 /* ClearStyleOptions.onlyThemable */ ); - applyThemableStyles([].concat.apply([], themableStyles)); - } - } -} -function detokenize(styles) { - if (styles) styles = resolveThemableArray(splitStyles(styles)).styleString; - return styles; -} -/** - * Resolves ThemingInstruction objects in an array and joins the result into a string. - * @param {ThemableArray} splitStyleArray ThemableArray to resolve and join. - */ function resolveThemableArray(splitStyleArray) { - var theme = _themeState.theme; - var themable = false; - // Resolve the array of theming instructions to an array of strings. - // Then join the array to produce the final CSS string. - var resolvedArray = (splitStyleArray || []).map(function(currentValue) { - var themeSlot = currentValue.theme; - if (themeSlot) { - themable = true; - // A theming annotation. Resolve it. - var themedValue = theme ? theme[themeSlot] : undefined; - var defaultValue = currentValue.defaultValue || 'inherit'; - // Warn to console if we hit an unthemed value even when themes are provided, but only if "DEBUG" is true. - // Allow the themedValue to be undefined to explicitly request the default value. - if (theme && !themedValue && console && !(themeSlot in theme) && typeof DEBUG !== 'undefined' && DEBUG) console.warn("Theming value not provided for \"".concat(themeSlot, "\". Falling back to \"").concat(defaultValue, "\".")); - return themedValue || defaultValue; - } else // A non-themable string. Preserve it. - return currentValue.rawString; + return !!isMacResult; + } + function hasHorizontalOverflow(element2) { + return element2.clientWidth < element2.scrollWidth; + } + function hasVerticalOverflow(element2) { + return element2.clientHeight < element2.scrollHeight; + } + function hasOverflow(element2) { + return hasHorizontalOverflow(element2) || hasVerticalOverflow(element2); + } + function createComposedRenderFunction(outer) { + var outerMemoizer = createMemoizer(function(inner) { + var innerMemoizer = createMemoizer(function(defaultRender) { + return function(innerProps) { + return inner(innerProps, defaultRender); + }; + }); + return function(outerProps, defaultRender) { + return outer(outerProps, defaultRender ? innerMemoizer(defaultRender) : inner); + }; }); - return { - styleString: resolvedArray.join(''), - themable: themable - }; -} -function splitStyles(styles) { - var result = []; - if (styles) { - var pos = 0; // Current position in styles. - var tokenMatch = void 0; - while(tokenMatch = _themeTokenRegex.exec(styles)){ - var matchIndex = tokenMatch.index; - if (matchIndex > pos) result.push({ - rawString: styles.substring(pos, matchIndex) - }); - result.push({ - theme: tokenMatch[1], - defaultValue: tokenMatch[2] // May be undefined + return outerMemoizer; + } + var memoizer = createMemoizer(createComposedRenderFunction); + function composeRenderFunction(outer, inner) { + return memoizer(outer)(inner); + } + var safeRequestAnimationFrame = function(component) { + var activeTimeouts; + return function(cb) { + if (!activeTimeouts) { + activeTimeouts = /* @__PURE__ */ new Set(); + extendComponent(component, { + componentWillUnmount: function() { + activeTimeouts.forEach(function(id2) { + return cancelAnimationFrame(id2); }); - // index of the first character after the current match - pos = _themeTokenRegex.lastIndex; - } - // Push the rest of the string after the last match. - result.push({ - rawString: styles.substring(pos) - }); - } - return result; -} -/** - * Registers a set of style text. If it is registered too early, we will register it when the - * window.load event is fired. - * @param {ThemableArray} styleArray Array of IThemingInstruction objects to register. - * @param {IStyleRecord} styleRecord May specify a style Element to update. - */ function registerStyles(styleArray) { - if (typeof document === 'undefined') return; - var head = document.getElementsByTagName('head')[0]; - var styleElement = document.createElement('style'); - var _a = resolveThemableArray(styleArray), styleString = _a.styleString, themable = _a.themable; - styleElement.setAttribute('data-load-themed-styles', 'true'); - if (_styleNonce) styleElement.setAttribute('nonce', _styleNonce); - styleElement.appendChild(document.createTextNode(styleString)); - _themeState.perf.count++; - head.appendChild(styleElement); - var ev = document.createEvent('HTMLEvents'); - ev.initEvent('styleinsert', true, false); - ev.args = { - newStyle: styleElement - }; - document.dispatchEvent(ev); - var record = { - styleElement: styleElement, - themableStyle: styleArray - }; - if (themable) _themeState.registeredThemableStyles.push(record); - else _themeState.registeredStyles.push(record); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"frMaf":[function(require,module,exports,__globalThis) { -// This file mimics styles and mixins from _General.Mixins.scss -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "normalize", ()=>normalize); -parcelHelpers.export(exports, "noWrap", ()=>noWrap); -var normalize = { - boxShadow: 'none', - margin: 0, - padding: 0, - boxSizing: 'border-box' -}; -var noWrap = { - overflow: 'hidden', - textOverflow: 'ellipsis', - whiteSpace: 'nowrap' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1VkGl":[function(require,module,exports,__globalThis) { -/** - * Generates placeholder style for each of the browsers supported by `@fluentui/react`. - * @param styles - The style to use. - * @returns The placeholder style object for each browser depending on the placeholder directive it uses. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getPlaceholderStyles", ()=>getPlaceholderStyles); -function getPlaceholderStyles(styles) { - return { - selectors: { - '::placeholder': styles, - ':-ms-input-placeholder': styles, - '::-ms-input-placeholder': styles - } - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9IVjH":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/style-utilities', '8.11.5'); - -},{"@fluentui/set-version":"iqYXf"}],"gQUPC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getIconContent", ()=>getIconContent); -parcelHelpers.export(exports, "FontIcon", ()=>FontIcon); -parcelHelpers.export(exports, "getFontIcon", ()=>getFontIcon); -var _tslib = require("tslib"); -var _react = require("react"); -var _iconStyles = require("./Icon.styles"); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getIconContent = (0, _utilities.memoizeFunction)(function(iconName) { - var _a = (0, _styling.getIcon)(iconName) || { - subset: {}, - code: undefined - }, code = _a.code, subset = _a.subset; - if (!code) return null; - return { - children: code, - iconClassName: subset.className, - fontFamily: subset.fontFace && subset.fontFace.fontFamily, - mergeImageProps: subset.mergeImageProps - }; -}, undefined, true); -var FontIcon = function(props) { - var iconName = props.iconName, className = props.className, _a = props.style, style = _a === void 0 ? {} : _a; - var iconContent = getIconContent(iconName) || {}; - var iconClassName = iconContent.iconClassName, children = iconContent.children, fontFamily = iconContent.fontFamily, mergeImageProps = iconContent.mergeImageProps; - var nativeProps = (0, _utilities.getNativeProps)(props, (0, _utilities.htmlElementProperties)); - var accessibleName = props['aria-label'] || props.title; - var containerProps = props['aria-label'] || props['aria-labelledby'] || props.title ? { - role: mergeImageProps ? undefined : 'img' - } : { - 'aria-hidden': true - }; - var finalChildren = children; - if (mergeImageProps) { - if (typeof children === 'object' && typeof children.props === 'object' && accessibleName) finalChildren = _react.cloneElement(children, { - alt: accessibleName + } }); - } - return _react.createElement("i", (0, _tslib.__assign)({ - "data-icon-name": iconName - }, containerProps, nativeProps, mergeImageProps ? { - title: undefined, - 'aria-label': undefined - } : {}, { - className: (0, _utilities.css)((0, _iconStyles.MS_ICON), (0, _iconStyles.classNames).root, iconClassName, !iconName && (0, _iconStyles.classNames).placeholder, className), - // Apply the font family this way to ensure it doesn't get overridden by Fabric Core ms-Icon styles - // https://github.com/microsoft/fluentui/issues/10449 - style: (0, _tslib.__assign)({ - fontFamily: fontFamily - }, style) - }), finalChildren); -}; -var getFontIcon = (0, _utilities.memoizeFunction)(function(iconName, className, ariaLabel) { - return FontIcon({ - iconName: iconName, - className: className, - 'aria-label': ariaLabel - }); -}); - -},{"tslib":"9gizs","react":"jGrId","./Icon.styles":"lyw66","../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lyw66":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "classNames", ()=>classNames); -parcelHelpers.export(exports, "MS_ICON", ()=>MS_ICON); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var classNames = (0, _styling.mergeStyleSets)({ - root: { - display: 'inline-block', - textDecoration: 'inherit' - }, - placeholder: [ - 'ms-Icon-placeHolder', - { - width: '1em' - } - ], - image: [ - 'ms-Icon-imageContainer', - { - overflow: 'hidden' - } - ] -}); -var MS_ICON = 'ms-Icon'; -var getStyles = function(props) { - var className = props.className, iconClassName = props.iconClassName, isPlaceholder = props.isPlaceholder, isImage = props.isImage, styles = props.styles; - return { - root: [ - isPlaceholder && classNames.placeholder, - classNames.root, - isImage && classNames.image, - iconClassName, - className, - styles && styles.root, - // eslint-disable-next-line deprecation/deprecation - styles && styles.imageContainer - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"64ZOw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageIcon", ()=>ImageIcon); -var _tslib = require("tslib"); -var _react = require("react"); -var _image = require("../Image/Image"); -var _utilities = require("../../Utilities"); -var _iconStyles = require("./Icon.styles"); -var ImageIcon = function(props) { - var className = props.className, imageProps = props.imageProps; - var nativeProps = (0, _utilities.getNativeProps)(props, (0, _utilities.htmlElementProperties), [ - 'aria-label', - 'aria-labelledby', - 'title', - 'aria-describedby' - ]); - var altText = imageProps.alt || props['aria-label']; - var hasName = altText || props['aria-labelledby'] || props.title || imageProps['aria-label'] || imageProps['aria-labelledby'] || imageProps.title; - // move naming or describing attributes from the container (where they are invalid) to the image - var imageNameProps = { - 'aria-labelledby': props['aria-labelledby'], - 'aria-describedby': props['aria-describedby'], - title: props.title - }; - var containerProps = hasName ? {} : { - 'aria-hidden': true + } + var timeoutId = requestAnimationFrame(function() { + activeTimeouts.delete(timeoutId); + cb(); + }); + activeTimeouts.add(timeoutId); }; - return _react.createElement("div", (0, _tslib.__assign)({}, containerProps, nativeProps, { - className: (0, _utilities.css)((0, _iconStyles.MS_ICON), (0, _iconStyles.classNames).root, (0, _iconStyles.classNames).image, className) - }), _react.createElement((0, _image.Image), (0, _tslib.__assign)({}, imageNameProps, imageProps, { - alt: hasName ? altText : '' - }))); -}; - -},{"tslib":"9gizs","react":"jGrId","../Image/Image":"5keBP","../../Utilities":"1NZCy","./Icon.styles":"lyw66","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"avdAc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DirectionalHint", ()=>DirectionalHint); -var DirectionalHint = { - /** - * Appear above the target element, with the left edges of the callout and target aligning. - */ topLeftEdge: 0, - /** - * Appear above the target element, with the centers of the callout and target aligning. - */ topCenter: 1, - /** - * Appear above the target element, with the right edges of the callout and target aligning. - */ topRightEdge: 2, - /** - * Appear above the target element, aligning with the target element such that the callout tends toward - * the center of the screen. - */ topAutoEdge: 3, - /** - * Appear below the target element, with the left edges of the callout and target aligning. - */ bottomLeftEdge: 4, - /** - * Appear below the target element, with the centers of the callout and target aligning. - */ bottomCenter: 5, - /** - * Appear below the target element, with the right edges of the callout and target aligning. - */ bottomRightEdge: 6, - /** - * Appear below the target element, aligning with the target element such that the callout tends toward - * the center of the screen. - */ bottomAutoEdge: 7, - /** - * Appear to the left of the target element, with the top edges of the callout and target aligning. - */ leftTopEdge: 8, - /** - * Appear to the left of the target element, with the centers of the callout and target aligning. - */ leftCenter: 9, - /** - * Appear to the left of the target element, with the bottom edges of the callout and target aligning. - */ leftBottomEdge: 10, - /** - * Appear to the right of the target element, with the top edges of the callout and target aligning. - */ rightTopEdge: 11, - /** - * Appear to the right of the target element, with the centers of the callout and target aligning. - */ rightCenter: 12, - /** - * Appear to the right of the target element, with the bottom edges of the callout and target aligning. - */ rightBottomEdge: 13 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iuj1y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ContextualMenu/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ContextualMenu/index":"9oh5j","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9oh5j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getMenuItemStyles", ()=>(0, _contextualMenuCnstyles.getMenuItemStyles)); -parcelHelpers.export(exports, "getContextualMenuItemClassNames", ()=>(0, _contextualMenuClassNames.getItemClassNames)); -parcelHelpers.export(exports, "getContextualMenuItemStyles", ()=>(0, _contextualMenuClassNames.getItemStyles)); -var _contextualMenu = require("./ContextualMenu"); -parcelHelpers.exportAll(_contextualMenu, exports); -var _contextualMenuBase = require("./ContextualMenu.base"); -parcelHelpers.exportAll(_contextualMenuBase, exports); -var _contextualMenuTypes = require("./ContextualMenu.types"); -parcelHelpers.exportAll(_contextualMenuTypes, exports); -var _contextualMenuItem = require("./ContextualMenuItem"); -parcelHelpers.exportAll(_contextualMenuItem, exports); -var _contextualMenuItemBase = require("./ContextualMenuItem.base"); -parcelHelpers.exportAll(_contextualMenuItemBase, exports); -var _contextualMenuItemTypes = require("./ContextualMenuItem.types"); -parcelHelpers.exportAll(_contextualMenuItemTypes, exports); -var _contextualMenuCnstyles = require("./ContextualMenu.cnstyles"); -var _contextualMenuClassNames = require("./ContextualMenu.classNames"); - -},{"./ContextualMenu":"eivnv","./ContextualMenu.base":false,"./ContextualMenu.types":"akDeV","./ContextualMenuItem":false,"./ContextualMenuItem.base":false,"./ContextualMenuItem.types":false,"./ContextualMenu.cnstyles":false,"./ContextualMenu.classNames":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eivnv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenu", ()=>ContextualMenu); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _contextualMenuBase = require("./ContextualMenu.base"); -var _contextualMenuStyles = require("./ContextualMenu.styles"); -function onRenderSubMenu(subMenuProps) { - return _react.createElement(LocalContextualMenu, (0, _tslib.__assign)({}, subMenuProps)); -} -// This is to prevent cyclic import with ContextualMenu.base.tsx. -var LocalContextualMenu = (0, _utilities.styled)((0, _contextualMenuBase.ContextualMenuBase), (0, _contextualMenuStyles.getStyles), function(props) { - return { - onRenderSubMenu: props.onRenderSubMenu ? (0, _utilities.composeRenderFunction)(props.onRenderSubMenu, onRenderSubMenu) : onRenderSubMenu - }; -}, { - scope: 'ContextualMenu' -}); -var ContextualMenu = LocalContextualMenu; -ContextualMenu.displayName = 'ContextualMenu'; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./ContextualMenu.base":"luJCP","./ContextualMenu.styles":"9ouID","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"luJCP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSubmenuItems", ()=>getSubmenuItems); -/** - * Returns true if a list of menu items can contain a checkbox - */ parcelHelpers.export(exports, "canAnyMenuItemsCheck", ()=>canAnyMenuItemsCheck); -parcelHelpers.export(exports, "ContextualMenuBase", ()=>ContextualMenuBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _contextualMenuTypes = require("./ContextualMenu.types"); -var _directionalHint = require("../../common/DirectionalHint"); -var _focusZone = require("../../FocusZone"); -var _utilities = require("../../Utilities"); -var _index = require("../../utilities/contextualMenu/index"); -var _callout = require("../../Callout"); -var _contextualMenuItem = require("./ContextualMenuItem"); -var _index1 = require("./ContextualMenuItemWrapper/index"); -var _styling = require("../../Styling"); -var _contextualMenuClassNames = require("./ContextualMenu.classNames"); -var _reactHooks = require("@fluentui/react-hooks"); -var _responsiveMode = require("../../ResponsiveMode"); -var _index2 = require("../../utilities/MenuContext/index"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getContextualMenuItemClassNames = (0, _utilities.classNamesFunction)(); -// The default ContextualMenu properties have no items and beak, the default submenu direction is right and top. -var DEFAULT_PROPS = { - items: [], - shouldFocusOnMount: true, - gapSpace: 0, - directionalHint: (0, _directionalHint.DirectionalHint).bottomAutoEdge, - beakWidth: 16 -}; -/* return number of menu items, excluding headers and dividers */ function getItemCount(items) { - var totalItemCount = 0; - for(var _i = 0, items_1 = items; _i < items_1.length; _i++){ - var item = items_1[_i]; - if (item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Divider && item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Header) { - var itemCount = item.customOnRenderListLength ? item.customOnRenderListLength : 1; - totalItemCount += itemCount; - } + }; + var DefaultFields = ["theme", "styles"]; + function styled(Component, baseStyles, getProps, customizable2, pure) { + customizable2 = customizable2 || { scope: "", fields: void 0 }; + var scope = customizable2.scope, _a2 = customizable2.fields, fields = _a2 === void 0 ? DefaultFields : _a2; + var Wrapped = React__namespace.forwardRef(function(props, forwardedRef) { + var styles = React__namespace.useRef(void 0); + var settings = useCustomizationSettings(fields, scope); + var customizedStyles = settings.styles; + settings.dir; + var rest = __rest(settings, ["styles", "dir"]); + var additionalProps = getProps ? getProps(props) : void 0; + var useStyled = useMergeStylesHooks().useStyled; + var cache2 = styles.current && styles.current.__cachedInputs__ || []; + var propStyles = props.styles; + if (!styles.current || customizedStyles !== cache2[1] || propStyles !== cache2[2]) { + var concatenatedStyles = function(styleProps) { + return concatStyleSetsWithProps(styleProps, baseStyles, customizedStyles, propStyles); + }; + concatenatedStyles.__cachedInputs__ = [ + baseStyles, + customizedStyles, + propStyles + ]; + concatenatedStyles.__noStyleOverride__ = !customizedStyles && !propStyles; + styles.current = concatenatedStyles; + } + styles.current.__shadowConfig__ = useStyled(scope); + return React__namespace.createElement(Component, __assign$1({ ref: forwardedRef }, rest, additionalProps, props, { styles: styles.current })); + }); + Wrapped.displayName = "Styled".concat(Component.displayName || Component.name); + var pureComponent = pure ? React__namespace.memo(Wrapped) : Wrapped; + if (Wrapped.displayName) { + pureComponent.displayName = Wrapped.displayName; } - return totalItemCount; -} -function getSubmenuItems(item, options) { - var target = options === null || options === void 0 ? void 0 : options.target; - // eslint-disable-next-line deprecation/deprecation - var items = item.subMenuProps ? item.subMenuProps.items : item.items; - if (items) { - var overrideItems = []; - for(var _i = 0, items_2 = items; _i < items_2.length; _i++){ - var subItem = items_2[_i]; - if (subItem.preferMenuTargetAsEventTarget) { - // For sub-items which need an overridden target, intercept `onClick` - var onClick = subItem.onClick, contextItem = (0, _tslib.__rest)(subItem, [ - "onClick" - ]); - overrideItems.push((0, _tslib.__assign)((0, _tslib.__assign)({}, contextItem), { - onClick: getOnClickWithOverrideTarget(onClick, target) - })); - } else overrideItems.push(subItem); + return pureComponent; + } + function warnControlledUsage(params2) { + } + var isIE11 = function() { + var _a2; + var win = getWindow(); + if (!((_a2 = win === null || win === void 0 ? void 0 : win.navigator) === null || _a2 === void 0 ? void 0 : _a2.userAgent)) { + return false; + } + return win.navigator.userAgent.indexOf("rv:11.0") > -1; + }; + function getPropsWithDefaults(defaultProps, propsWithoutDefaults) { + var props = __assign$1({}, propsWithoutDefaults); + for (var _i = 0, _a2 = Object.keys(defaultProps); _i < _a2.length; _i++) { + var key2 = _a2[_i]; + if (props[key2] === void 0) { + props[key2] = defaultProps[key2]; + } + } + return props; + } + var createResolver = function(local) { + return function(newValue) { + for (var _i = 0, _a2 = local.refs; _i < _a2.length; _i++) { + var ref2 = _a2[_i]; + if (typeof ref2 === "function") { + ref2(newValue); + } else if (ref2) { + ref2.current = newValue; + } + } + }; + }; + var createMergedRef = function(value2) { + var local = { + refs: [] + }; + return function() { + var newRefs = []; + for (var _i = 0; _i < arguments.length; _i++) { + newRefs[_i] = arguments[_i]; + } + if (!local.resolver || !arraysEqual(local.refs, newRefs)) { + local.resolver = createResolver(local); + } + local.refs = newRefs; + return local.resolver; + }; + }; + var useIsomorphicLayoutEffect = canUseDOM() ? React__namespace.useLayoutEffect : React__namespace.useEffect; + var IconType; + (function(IconType2) { + IconType2[IconType2["default"] = 0] = "default"; + IconType2[IconType2["image"] = 1] = "image"; + IconType2[IconType2["Default"] = 1e5] = "Default"; + IconType2[IconType2["Image"] = 100001] = "Image"; + })(IconType || (IconType = {})); + var ImageFit; + (function(ImageFit2) { + ImageFit2[ImageFit2["center"] = 0] = "center"; + ImageFit2[ImageFit2["contain"] = 1] = "contain"; + ImageFit2[ImageFit2["cover"] = 2] = "cover"; + ImageFit2[ImageFit2["none"] = 3] = "none"; + ImageFit2[ImageFit2["centerCover"] = 4] = "centerCover"; + ImageFit2[ImageFit2["centerContain"] = 5] = "centerContain"; + })(ImageFit || (ImageFit = {})); + var ImageCoverStyle; + (function(ImageCoverStyle2) { + ImageCoverStyle2[ImageCoverStyle2["landscape"] = 0] = "landscape"; + ImageCoverStyle2[ImageCoverStyle2["portrait"] = 1] = "portrait"; + })(ImageCoverStyle || (ImageCoverStyle = {})); + var ImageLoadState; + (function(ImageLoadState2) { + ImageLoadState2[ImageLoadState2["notLoaded"] = 0] = "notLoaded"; + ImageLoadState2[ImageLoadState2["loaded"] = 1] = "loaded"; + ImageLoadState2[ImageLoadState2["error"] = 2] = "error"; + ImageLoadState2[ImageLoadState2["errorLoaded"] = 3] = "errorLoaded"; + })(ImageLoadState || (ImageLoadState = {})); + function useAsync() { + var asyncRef = React__namespace.useRef(void 0); + if (!asyncRef.current) { + asyncRef.current = new Async(); + } + React__namespace.useEffect(function() { + return function() { + var _a2; + (_a2 = asyncRef.current) === null || _a2 === void 0 ? void 0 : _a2.dispose(); + asyncRef.current = void 0; + }; + }, []); + return asyncRef.current; + } + function useConst(initialValue) { + var ref2 = React__namespace.useRef(void 0); + if (ref2.current === void 0) { + ref2.current = { + value: typeof initialValue === "function" ? initialValue() : initialValue + }; + } + return ref2.current.value; + } + function useBoolean(initialState) { + var _a2 = React__namespace.useState(initialState), value2 = _a2[0], setValue = _a2[1]; + var setTrue = useConst(function() { + return function() { + setValue(true); + }; + }); + var setFalse = useConst(function() { + return function() { + setValue(false); + }; + }); + var toggle = useConst(function() { + return function() { + setValue(function(currentValue) { + return !currentValue; + }); + }; + }); + return [value2, { setTrue, setFalse, toggle }]; + } + function useControllableValue(controlledValue, defaultUncontrolledValue, onChange) { + var _a2 = React__namespace.useState(defaultUncontrolledValue), value2 = _a2[0], setValue = _a2[1]; + var isControlled2 = useConst(controlledValue !== void 0); + var currentValue = isControlled2 ? controlledValue : value2; + var valueRef = React__namespace.useRef(currentValue); + var onChangeRef = React__namespace.useRef(onChange); + React__namespace.useEffect(function() { + valueRef.current = currentValue; + onChangeRef.current = onChange; + }); + var setValueOrCallOnChange = useConst(function() { + return function(update2, ev) { + var newValue = typeof update2 === "function" ? update2(valueRef.current) : update2; + if (onChangeRef.current) { + onChangeRef.current(ev, newValue); + } + if (!isControlled2) { + setValue(newValue); + } + }; + }); + return [currentValue, setValueOrCallOnChange]; + } + function useEventCallback(fn2) { + var callbackRef = React__namespace.useRef(function() { + throw new Error("Cannot call an event handler while rendering"); + }); + useIsomorphicLayoutEffect(function() { + callbackRef.current = fn2; + }, [fn2]); + return useConst(function() { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; } - return overrideItems; + var callback = callbackRef.current; + return callback.apply(void 0, args); + }; + }); + } + function useId(prefix, providedId) { + var ref2 = React__namespace.useRef(providedId); + if (!ref2.current) { + ref2.current = getId(prefix); } -} -function canAnyMenuItemsCheck(items) { - return items.some(function(item) { - if (item.canCheck) return true; - // If the item is a section, check if any of the items in the section can check. - if (item.sectionProps && item.sectionProps.items.some(function(submenuItem) { - return submenuItem.canCheck === true; - })) return true; - return false; + return ref2.current; + } + function useMergedRefs() { + var refs = []; + for (var _i = 0; _i < arguments.length; _i++) { + refs[_i] = arguments[_i]; + } + var mergedCallback = React__namespace.useCallback(function(value2) { + mergedCallback.current = value2; + for (var _i2 = 0, refs_1 = refs; _i2 < refs_1.length; _i2++) { + var ref2 = refs_1[_i2]; + if (typeof ref2 === "function") { + ref2(value2); + } else if (ref2) { + ref2.current = value2; + } + } + }, __spreadArray([], refs, true)); + return mergedCallback; + } + function useOnEvent(element2, eventName, callback, useCapture) { + var callbackRef = React__namespace.useRef(callback); + callbackRef.current = callback; + React__namespace.useEffect(function() { + var actualElement = element2 && "current" in element2 ? element2.current : element2; + if (!actualElement || !actualElement.addEventListener) { + return; + } + var dispose = on$1(actualElement, eventName, function(ev) { + return callbackRef.current(ev); + }, useCapture); + return dispose; + }, [element2, eventName, useCapture]); + } + function usePrevious(value2) { + var ref2 = React__namespace.useRef(void 0); + React__namespace.useEffect(function() { + ref2.current = value2; }); -} -var NavigationIdleDelay = 250; /* ms */ -var COMPONENT_NAME = 'ContextualMenu'; -var _getMenuItemStylesFunction = (0, _utilities.memoizeFunction)(function() { - var styles = []; - for(var _i = 0; _i < arguments.length; _i++)styles[_i] = arguments[_i]; - return function(styleProps) { - return (0, _styling.concatStyleSetsWithProps).apply(void 0, (0, _tslib.__spreadArray)([ - styleProps, - (0, _contextualMenuClassNames.getItemStyles) - ], styles, false)); - }; -}); -//#region Custom hooks -function useVisibility(props, targetWindow) { - var _a = props.hidden, hidden = _a === void 0 ? false : _a, onMenuDismissed = props.onMenuDismissed, onMenuOpened = props.onMenuOpened; - var previousHidden = (0, _reactHooks.usePrevious)(hidden); - var onMenuOpenedRef = _react.useRef(onMenuOpened); - var onMenuClosedRef = _react.useRef(onMenuDismissed); - var propsRef = _react.useRef(props); - onMenuOpenedRef.current = onMenuOpened; - onMenuClosedRef.current = onMenuDismissed; - propsRef.current = props; - _react.useEffect(function() { - var _a, _b; - // Don't issue dismissed callbacks on initial mount - if (hidden && previousHidden === false) (_a = onMenuClosedRef.current) === null || _a === void 0 || _a.call(onMenuClosedRef, propsRef.current); - else if (!hidden && previousHidden !== false) (_b = onMenuOpenedRef.current) === null || _b === void 0 || _b.call(onMenuOpenedRef, propsRef.current); - }, [ - hidden, - previousHidden - ]); - // Issue onDismissedCallback on unmount - _react.useEffect(function() { + return ref2.current; + } + var useSetTimeout = function() { + var timeoutIds = useConst({}); + React__namespace.useEffect( + function() { return function() { - var _a; - return (_a = onMenuClosedRef.current) === null || _a === void 0 ? void 0 : _a.call(onMenuClosedRef, propsRef.current); + for (var _i = 0, _a2 = Object.keys(timeoutIds); _i < _a2.length; _i++) { + var id2 = _a2[_i]; + clearTimeout(id2); + } }; + }, + // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that + [timeoutIds] + ); + return useConst({ + setTimeout: function(func, duration) { + var id2 = setTimeout(func, duration); + timeoutIds[id2] = 1; + return id2; + }, + clearTimeout: function(id2) { + delete timeoutIds[id2]; + clearTimeout(id2); + } + }); + }; + function useTarget(target2, hostElement) { + var _a2, _b2, _c2; + var previousTargetProp = React__namespace.useRef(void 0); + var targetRef = React__namespace.useRef(null); + var targetWindow = useWindow(); + if (!target2 || target2 !== previousTargetProp.current || typeof target2 === "string") { + var currentElement = hostElement === null || hostElement === void 0 ? void 0 : hostElement.current; + if (target2) { + if (typeof target2 === "string") { + if ((_a2 = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _a2 === void 0 ? void 0 : _a2.host) { + targetRef.current = (_c2 = (_b2 = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _b2 === void 0 ? void 0 : _b2.querySelector(target2)) !== null && _c2 !== void 0 ? _c2 : null; + } else { + var currentDoc = getDocument(currentElement); + targetRef.current = currentDoc ? currentDoc.querySelector(target2) : null; + } + } else if ("stopPropagation" in target2) { + targetRef.current = target2; + } else if ("getBoundingClientRect" in target2) { + targetRef.current = target2; + } else if ("current" in target2) { + targetRef.current = target2.current; + } else { + targetRef.current = target2; + } + } + previousTargetProp.current = target2; + } + return [targetRef, targetWindow]; + } + var useUnmount = function(callback) { + var unmountRef = React__namespace.useRef(callback); + unmountRef.current = callback; + React__namespace.useEffect(function() { + return function() { + var _a2; + (_a2 = unmountRef.current) === null || _a2 === void 0 ? void 0 : _a2.call(unmountRef); + }; }, []); -} -function useSubMenuState(_a, dismiss) { - var hidden = _a.hidden, items = _a.items, theme = _a.theme, className = _a.className, id = _a.id, menuTarget = _a.target; - var _b = _react.useState(), expandedMenuItemKey = _b[0], setExpandedMenuItemKey = _b[1]; - var _c = _react.useState(), submenuTarget = _c[0], setSubmenuTarget = _c[1]; - /** True if the menu was expanded by mouse click OR hover (as opposed to by keyboard) */ var _d = _react.useState(), shouldFocusOnContainer = _d[0], setShouldFocusOnContainer = _d[1]; - var subMenuId = (0, _reactHooks.useId)(COMPONENT_NAME, id); - var closeSubMenu = _react.useCallback(function() { - setShouldFocusOnContainer(undefined); - setExpandedMenuItemKey(undefined); - setSubmenuTarget(undefined); - }, []); - var openSubMenu = _react.useCallback(function(_a, target, focusContainer) { - var submenuItemKey = _a.key; - if (expandedMenuItemKey === submenuItemKey) return; - target.focus(); - setShouldFocusOnContainer(focusContainer); - setExpandedMenuItemKey(submenuItemKey); - setSubmenuTarget(target); - }, [ - expandedMenuItemKey - ]); - _react.useEffect(function() { - if (hidden) closeSubMenu(); - }, [ - hidden, - closeSubMenu + }; + var getClassNames$r = classNamesFunction(); + var SVG_REGEX = /\.svg$/i; + var KEY_PREFIX = "fabricImage"; + function useLoadState(props, imageElement) { + var onLoadingStateChange = props.onLoadingStateChange, onLoad = props.onLoad, onError = props.onError, src = props.src; + var _a2 = React__namespace.useState(ImageLoadState.notLoaded), loadState = _a2[0], setLoadState = _a2[1]; + useIsomorphicLayoutEffect(function() { + setLoadState(ImageLoadState.notLoaded); + }, [src]); + React__namespace.useEffect(function() { + if (loadState === ImageLoadState.notLoaded) { + var isLoaded = imageElement.current ? src && imageElement.current.naturalWidth > 0 && imageElement.current.naturalHeight > 0 || imageElement.current.complete && SVG_REGEX.test(src) : false; + if (isLoaded) { + setLoadState(ImageLoadState.loaded); + } + } + }); + React__namespace.useEffect(function() { + onLoadingStateChange === null || onLoadingStateChange === void 0 ? void 0 : onLoadingStateChange(loadState); + }, [loadState]); + var onImageLoaded = React__namespace.useCallback(function(ev) { + onLoad === null || onLoad === void 0 ? void 0 : onLoad(ev); + if (src) { + setLoadState(ImageLoadState.loaded); + } + }, [src, onLoad]); + var onImageError = React__namespace.useCallback(function(ev) { + onError === null || onError === void 0 ? void 0 : onError(ev); + setLoadState(ImageLoadState.error); + }, [onError]); + return [loadState, onImageLoaded, onImageError]; + } + var ImageBase = React__namespace.forwardRef(function(props, forwardedRef) { + var frameElement = React__namespace.useRef(void 0); + var imageElement = React__namespace.useRef(void 0); + var _a2 = useLoadState(props, imageElement), loadState = _a2[0], onImageLoaded = _a2[1], onImageError = _a2[2]; + var imageProps = getNativeProps(props, imgProperties, [ + "width", + "height" ]); - var onSubMenuDismiss = useOnSubmenuDismiss(dismiss, closeSubMenu); - var getSubmenuProps = function() { - var item = findItemByKeyFromItems(expandedMenuItemKey, items); - var submenuProps = null; - if (item) { - submenuProps = { - items: getSubmenuItems(item, { - target: menuTarget - }), - target: submenuTarget, - onDismiss: onSubMenuDismiss, - isSubMenu: true, - id: subMenuId, - shouldFocusOnMount: true, - shouldFocusOnContainer: shouldFocusOnContainer, - directionalHint: (0, _utilities.getRTL)(theme) ? (0, _directionalHint.DirectionalHint).leftTopEdge : (0, _directionalHint.DirectionalHint).rightTopEdge, - className: className, - gapSpace: 0, - isBeakVisible: false - }; - if (item.subMenuProps) (0, _utilities.assign)(submenuProps, item.subMenuProps); - if (item.preferMenuTargetAsEventTarget) { - var onItemClick = item.onItemClick; - submenuProps.onItemClick = getOnClickWithOverrideTarget(onItemClick, menuTarget); - } + var src = props.src, alt = props.alt, width2 = props.width, height2 = props.height, _b2 = props.shouldFadeIn, shouldFadeIn = _b2 === void 0 ? true : _b2, shouldStartVisible = props.shouldStartVisible, className2 = props.className, imageFit = props.imageFit, role = props.role, maximizeFrame = props.maximizeFrame, styles = props.styles, theme = props.theme, loading = props.loading; + var coverStyle = useCoverStyle(props, loadState, imageElement, frameElement); + var classNames2 = getClassNames$r(styles, { + theme, + className: className2, + width: width2, + height: height2, + maximizeFrame, + shouldFadeIn, + shouldStartVisible, + isLoaded: loadState === ImageLoadState.loaded || loadState === ImageLoadState.notLoaded && props.shouldStartVisible, + isLandscape: coverStyle === ImageCoverStyle.landscape, + isCenter: imageFit === ImageFit.center, + isCenterContain: imageFit === ImageFit.centerContain, + isCenterCover: imageFit === ImageFit.centerCover, + isContain: imageFit === ImageFit.contain, + isCover: imageFit === ImageFit.cover, + isNone: imageFit === ImageFit.none, + isError: loadState === ImageLoadState.error, + isNotImageFit: imageFit === void 0 + }); + return React__namespace.createElement( + "div", + { className: classNames2.root, style: { width: width2, height: height2 }, ref: frameElement }, + React__namespace.createElement("img", __assign$1({}, imageProps, { onLoad: onImageLoaded, onError: onImageError, key: KEY_PREFIX + props.src || "", className: classNames2.image, ref: useMergedRefs(imageElement, forwardedRef), src, alt, role, loading })) + ); + }); + ImageBase.displayName = "ImageBase"; + function useCoverStyle(props, loadState, imageElement, frameElement) { + var previousLoadState = React__namespace.useRef(loadState); + var coverStyle = React__namespace.useRef(void 0); + if (coverStyle === void 0 || previousLoadState.current === ImageLoadState.notLoaded && loadState === ImageLoadState.loaded) { + coverStyle.current = computeCoverStyle(props, loadState, imageElement, frameElement); + } + previousLoadState.current = loadState; + return coverStyle.current; + } + function computeCoverStyle(props, loadState, imageElement, frameElement) { + var imageFit = props.imageFit, width2 = props.width, height2 = props.height; + if (props.coverStyle !== void 0) { + return props.coverStyle; + } else if (loadState === ImageLoadState.loaded && (imageFit === ImageFit.cover || imageFit === ImageFit.contain || imageFit === ImageFit.centerContain || imageFit === ImageFit.centerCover) && imageElement.current && frameElement.current) { + var desiredRatio = void 0; + if (typeof width2 === "number" && typeof height2 === "number" && imageFit !== ImageFit.centerContain && imageFit !== ImageFit.centerCover) { + desiredRatio = width2 / height2; + } else { + desiredRatio = frameElement.current.clientWidth / frameElement.current.clientHeight; + } + var naturalRatio = imageElement.current.naturalWidth / imageElement.current.naturalHeight; + if (naturalRatio > desiredRatio) { + return ImageCoverStyle.landscape; + } + } + return ImageCoverStyle.portrait; + } + function buildClassMap(styles) { + var classes = {}; + var _loop_1 = function(styleName2) { + if (styles.hasOwnProperty(styleName2)) { + var className_1; + Object.defineProperty(classes, styleName2, { + get: function() { + if (className_1 === void 0) { + className_1 = mergeStyles(styles[styleName2]).toString(); + } + return className_1; + }, + enumerable: true, + configurable: true + }); + } + }; + for (var styleName in styles) { + _loop_1(styleName); + } + return classes; + } + var ICON_SETTING_NAME = "icons"; + var _iconSettings = GlobalSettings.getValue(ICON_SETTING_NAME, { + __options: { + disableWarnings: false, + warnOnMissingIcons: true + }, + __remapped: {} + }); + var stylesheet = Stylesheet.getInstance(); + if (stylesheet && stylesheet.onReset) { + stylesheet.onReset(function() { + for (var name_1 in _iconSettings) { + if (_iconSettings.hasOwnProperty(name_1) && !!_iconSettings[name_1].subset) { + _iconSettings[name_1].subset.className = void 0; + } + } + }); + } + var normalizeIconName = function(name) { + return name.toLowerCase(); + }; + function registerIcons$1(iconSubset, options2) { + var subset = __assign$1(__assign$1({}, iconSubset), { isRegistered: false, className: void 0 }); + var icons = iconSubset.icons; + options2 = options2 ? __assign$1(__assign$1({}, _iconSettings.__options), options2) : _iconSettings.__options; + for (var iconName in icons) { + if (icons.hasOwnProperty(iconName)) { + var code = icons[iconName]; + var normalizedIconName = normalizeIconName(iconName); + if (_iconSettings[normalizedIconName]) { + _warnDuplicateIcon(iconName); + } else { + _iconSettings[normalizedIconName] = { + code, + subset + }; + } + } + } + } + function unregisterIcons$1(iconNames) { + var options2 = _iconSettings.__options; + var _loop_1 = function(iconName2) { + var normalizedIconName = normalizeIconName(iconName2); + if (_iconSettings[normalizedIconName]) { + delete _iconSettings[normalizedIconName]; + } else { + if (!options2.disableWarnings) { + warn$1('The icon "'.concat(iconName2, '" tried to unregister but was not registered.')); + } + } + if (_iconSettings.__remapped[normalizedIconName]) { + delete _iconSettings.__remapped[normalizedIconName]; + } + Object.keys(_iconSettings.__remapped).forEach(function(key2) { + if (_iconSettings.__remapped[key2] === normalizedIconName) { + delete _iconSettings.__remapped[key2]; } - return submenuProps; + }); }; - return [ - expandedMenuItemKey, - openSubMenu, - getSubmenuProps, - onSubMenuDismiss - ]; -} -function useShouldUpdateFocusOnMouseMove(_a) { - var delayUpdateFocusOnHover = _a.delayUpdateFocusOnHover, hidden = _a.hidden; - var shouldUpdateFocusOnMouseEvent = _react.useRef(!delayUpdateFocusOnHover); - var gotMouseMove = _react.useRef(false); - _react.useEffect(function() { - shouldUpdateFocusOnMouseEvent.current = !delayUpdateFocusOnHover; - gotMouseMove.current = hidden ? false : !delayUpdateFocusOnHover && gotMouseMove.current; - }, [ - delayUpdateFocusOnHover, - hidden - ]); - var onMenuFocusCapture = _react.useCallback(function() { - if (delayUpdateFocusOnHover) shouldUpdateFocusOnMouseEvent.current = false; - }, [ - delayUpdateFocusOnHover - ]); - return [ - shouldUpdateFocusOnMouseEvent, - gotMouseMove, - onMenuFocusCapture - ]; -} -function usePreviousActiveElement(_a, targetWindow, hostElement) { - var hidden = _a.hidden, onRestoreFocus = _a.onRestoreFocus; - var previousActiveElement = _react.useRef(); - var tryFocusPreviousActiveElement = _react.useCallback(function(options) { - var _a, _b; - if (onRestoreFocus) onRestoreFocus(options); - else if (options === null || options === void 0 ? void 0 : options.documentContainsFocus) // Make sure that the focus method actually exists - // In some cases the object might exist but not be a real element. - // This is primarily for IE 11 and should be removed once IE 11 is no longer in use. - (_b = (_a = previousActiveElement.current) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 || _b.call(_a); - }, [ - onRestoreFocus - ]); - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - var _a, _b; - if (!hidden) { - var newElement = targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement; - if (!((_a = hostElement.current) === null || _a === void 0 ? void 0 : _a.contains(newElement)) && newElement.tagName !== 'BODY') previousActiveElement.current = newElement; - } else if (previousActiveElement.current) { - tryFocusPreviousActiveElement({ - originalElement: previousActiveElement.current, - containsFocus: true, - documentContainsFocus: ((_b = (0, _utilities.getDocument)()) === null || _b === void 0 ? void 0 : _b.hasFocus()) || false + for (var _i = 0, iconNames_1 = iconNames; _i < iconNames_1.length; _i++) { + var iconName = iconNames_1[_i]; + _loop_1(iconName); + } + } + function getIcon(name) { + var icon = void 0; + var options2 = _iconSettings.__options; + name = name ? normalizeIconName(name) : ""; + name = _iconSettings.__remapped[name] || name; + if (name) { + icon = _iconSettings[name]; + if (icon) { + var subset = icon.subset; + if (subset && subset.fontFace) { + if (!subset.isRegistered) { + fontFace(subset.fontFace); + subset.isRegistered = true; + } + if (!subset.className) { + subset.className = mergeStyles(subset.style, { + fontFamily: subset.fontFace.fontFamily, + fontWeight: subset.fontFace.fontWeight || "normal", + fontStyle: subset.fontFace.fontStyle || "normal" }); - previousActiveElement.current = undefined; + } } - }, [ - hidden, - targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement, - tryFocusPreviousActiveElement, - hostElement - ]); - return [ - tryFocusPreviousActiveElement - ]; -} -function useKeyHandlers(_a, dismiss, hostElement, openSubMenu) { - var theme = _a.theme, isSubMenu = _a.isSubMenu, _b = _a.focusZoneProps, _c = _b === void 0 ? {} : _b, checkForNoWrap = _c.checkForNoWrap, _d = _c.direction, focusZoneDirection = _d === void 0 ? (0, _focusZone.FocusZoneDirection).vertical : _d; - /** True if the most recent keydown event was for alt (option) or meta (command). */ var lastKeyDownWasAltOrMeta = _react.useRef(); - /** - * Calls `shouldHandleKey` to determine whether the keyboard event should be handled; - * if so, stops event propagation and dismisses menu(s). - * @param ev - The keyboard event. - * @param shouldHandleKey - Returns whether we should handle this keyboard event. - * @param dismissAllMenus - If true, dismiss all menus. Otherwise, dismiss only the current menu. - * Only does anything if `shouldHandleKey` returns true. - * @returns Whether the event was handled. - */ var keyHandler = function(ev, shouldHandleKey, dismissAllMenus) { - var handled = false; - if (shouldHandleKey(ev)) { - dismiss(ev, dismissAllMenus); - ev.preventDefault(); - ev.stopPropagation(); - handled = true; + } else { + if (!options2.disableWarnings && options2.warnOnMissingIcons) { + warn$1('The icon "'.concat(name, '" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.')); } - return handled; - }; - /** - * Checks if the submenu should be closed - */ var shouldCloseSubMenu = function(ev) { - var submenuCloseKey = (0, _utilities.getRTL)(theme) ? (0, _utilities.KeyCodes).right : (0, _utilities.KeyCodes).left; - // eslint-disable-next-line deprecation/deprecation - if (ev.which !== submenuCloseKey || !isSubMenu) return false; - return !!(focusZoneDirection === (0, _focusZone.FocusZoneDirection).vertical || checkForNoWrap && !(0, _utilities.shouldWrapFocus)(ev.target, 'data-no-horizontal-wrap')); - }; - var shouldHandleKeyDown = function(ev) { - return(// eslint-disable-next-line deprecation/deprecation - ev.which === (0, _utilities.KeyCodes).escape || shouldCloseSubMenu(ev) || // eslint-disable-next-line deprecation/deprecation - ev.which === (0, _utilities.KeyCodes).up && (ev.altKey || ev.metaKey)); - }; - var onKeyDown = function(ev) { - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in shouldHandleKeyUp for reasoning. - lastKeyDownWasAltOrMeta.current = isAltOrMeta(ev); - // On Mac, pressing escape dismisses all levels of native context menus - // eslint-disable-next-line deprecation/deprecation - var dismissAllMenus = ev.which === (0, _utilities.KeyCodes).escape && ((0, _utilities.isMac)() || (0, _utilities.isIOS)()); - return keyHandler(ev, shouldHandleKeyDown, dismissAllMenus); - }; - /** - * We close the menu on key up only if ALL of the following are true: - * - Most recent key down was alt or meta (command) - * - The alt/meta key down was NOT followed by some other key (such as down/up arrow to - * expand/collapse the menu) - * - We're not on a Mac (or iOS) - * - * This is because on Windows, pressing alt moves focus to the application menu bar or similar, - * closing any open context menus. There is not a similar behavior on Macs. - */ var shouldHandleKeyUp = function(ev) { - var keyPressIsAltOrMetaAlone = lastKeyDownWasAltOrMeta.current && isAltOrMeta(ev); - lastKeyDownWasAltOrMeta.current = false; - return !!keyPressIsAltOrMetaAlone && !((0, _utilities.isIOS)() || (0, _utilities.isMac)()); - }; - var onKeyUp = function(ev) { - return keyHandler(ev, shouldHandleKeyUp, true); + } + } + return icon; + } + var _missingIcons = []; + var _missingIconsTimer = void 0; + function _warnDuplicateIcon(iconName) { + var options2 = _iconSettings.__options; + var warningDelay = 2e3; + var maxIconsInMessage = 10; + if (!options2.disableWarnings) { + _missingIcons.push(iconName); + if (_missingIconsTimer === void 0) { + _missingIconsTimer = setTimeout(function() { + warn$1("Some icons were re-registered. Applications should only call registerIcons for any given icon once. Redefining what an icon is may have unintended consequences. Duplicates include: \n" + _missingIcons.slice(0, maxIconsInMessage).join(", ") + (_missingIcons.length > maxIconsInMessage ? " (+ ".concat(_missingIcons.length - maxIconsInMessage, " more)") : "")); + _missingIconsTimer = void 0; + _missingIcons = []; + }, warningDelay); + } + } + } + function makeSemanticColors(p, e, s2, isInverted, depComments) { + if (depComments === void 0) { + depComments = false; + } + var semanticColors = __assign$1({ + primaryButtonBorder: "transparent", + errorText: !isInverted ? "#a4262c" : "#F1707B", + messageText: !isInverted ? "#323130" : "#F3F2F1", + messageLink: !isInverted ? "#005A9E" : "#6CB8F6", + messageLinkHovered: !isInverted ? "#004578" : "#82C7FF", + infoIcon: !isInverted ? "#605e5c" : "#C8C6C4", + errorIcon: !isInverted ? "#A80000" : "#F1707B", + blockingIcon: !isInverted ? "#FDE7E9" : "#442726", + warningIcon: !isInverted ? "#797775" : "#C8C6C4", + severeWarningIcon: !isInverted ? "#D83B01" : "#FCE100", + successIcon: !isInverted ? "#107C10" : "#92C353", + infoBackground: !isInverted ? "#f3f2f1" : "#323130", + errorBackground: !isInverted ? "#FDE7E9" : "#442726", + blockingBackground: !isInverted ? "#FDE7E9" : "#442726", + warningBackground: !isInverted ? "#FFF4CE" : "#433519", + severeWarningBackground: !isInverted ? "#FED9CC" : "#4F2A0F", + successBackground: !isInverted ? "#DFF6DD" : "#393D1B", + // deprecated + warningHighlight: !isInverted ? "#ffb900" : "#fff100", + successText: !isInverted ? "#107C10" : "#92c353" + }, s2); + var fullSemanticColors = getSemanticColors(p, e, semanticColors, isInverted); + return _fixDeprecatedSlots(fullSemanticColors, depComments); + } + function getSemanticColors(p, e, s2, isInverted, depComments) { + var result = {}; + var _a2 = p || {}, white = _a2.white, black = _a2.black, themePrimary = _a2.themePrimary, themeDark = _a2.themeDark, themeDarker = _a2.themeDarker, themeDarkAlt = _a2.themeDarkAlt, themeLighter = _a2.themeLighter, neutralLight = _a2.neutralLight, neutralLighter = _a2.neutralLighter, neutralDark = _a2.neutralDark, neutralQuaternary = _a2.neutralQuaternary, neutralQuaternaryAlt = _a2.neutralQuaternaryAlt, neutralPrimary = _a2.neutralPrimary, neutralSecondary = _a2.neutralSecondary, neutralSecondaryAlt = _a2.neutralSecondaryAlt, neutralTertiary = _a2.neutralTertiary, neutralTertiaryAlt = _a2.neutralTertiaryAlt, neutralLighterAlt = _a2.neutralLighterAlt, accent = _a2.accent; + if (white) { + result.bodyBackground = white; + result.bodyFrameBackground = white; + result.accentButtonText = white; + result.buttonBackground = white; + result.primaryButtonText = white; + result.primaryButtonTextHovered = white; + result.primaryButtonTextPressed = white; + result.inputBackground = white; + result.inputForegroundChecked = white; + result.listBackground = white; + result.menuBackground = white; + result.cardStandoutBackground = white; + } + if (black) { + result.bodyTextChecked = black; + result.buttonTextCheckedHovered = black; + } + if (themePrimary) { + result.link = themePrimary; + result.primaryButtonBackground = themePrimary; + result.inputBackgroundChecked = themePrimary; + result.inputIcon = themePrimary; + result.inputFocusBorderAlt = themePrimary; + result.menuIcon = themePrimary; + result.menuHeader = themePrimary; + result.accentButtonBackground = themePrimary; + } + if (themeDark) { + result.primaryButtonBackgroundPressed = themeDark; + result.inputBackgroundCheckedHovered = themeDark; + result.inputIconHovered = themeDark; + } + if (themeDarker) { + result.linkHovered = themeDarker; + } + if (themeDarkAlt) { + result.primaryButtonBackgroundHovered = themeDarkAlt; + } + if (themeLighter) { + result.inputPlaceholderBackgroundChecked = themeLighter; + } + if (neutralLight) { + result.bodyBackgroundChecked = neutralLight; + result.bodyFrameDivider = neutralLight; + result.bodyDivider = neutralLight; + result.variantBorder = neutralLight; + result.buttonBackgroundCheckedHovered = neutralLight; + result.buttonBackgroundPressed = neutralLight; + result.listItemBackgroundChecked = neutralLight; + result.listHeaderBackgroundPressed = neutralLight; + result.menuItemBackgroundPressed = neutralLight; + result.menuItemBackgroundChecked = neutralLight; + } + if (neutralLighter) { + result.bodyBackgroundHovered = neutralLighter; + result.buttonBackgroundHovered = neutralLighter; + result.buttonBackgroundDisabled = neutralLighter; + result.buttonBorderDisabled = neutralLighter; + result.primaryButtonBackgroundDisabled = neutralLighter; + result.disabledBackground = neutralLighter; + result.listItemBackgroundHovered = neutralLighter; + result.listHeaderBackgroundHovered = neutralLighter; + result.menuItemBackgroundHovered = neutralLighter; + } + if (neutralQuaternary) { + result.primaryButtonTextDisabled = neutralQuaternary; + result.disabledSubtext = neutralQuaternary; + } + if (neutralQuaternaryAlt) { + result.listItemBackgroundCheckedHovered = neutralQuaternaryAlt; + } + if (neutralTertiary) { + result.disabledBodyText = neutralTertiary; + result.variantBorderHovered = (s2 === null || s2 === void 0 ? void 0 : s2.variantBorderHovered) || neutralTertiary; + result.buttonTextDisabled = neutralTertiary; + result.inputIconDisabled = neutralTertiary; + result.disabledText = neutralTertiary; + } + if (neutralPrimary) { + result.bodyText = neutralPrimary; + result.actionLink = neutralPrimary; + result.buttonText = neutralPrimary; + result.inputBorderHovered = neutralPrimary; + result.inputText = neutralPrimary; + result.listText = neutralPrimary; + result.menuItemText = neutralPrimary; + } + if (neutralLighterAlt) { + result.bodyStandoutBackground = neutralLighterAlt; + result.defaultStateBackground = neutralLighterAlt; + } + if (neutralDark) { + result.actionLinkHovered = neutralDark; + result.buttonTextHovered = neutralDark; + result.buttonTextChecked = neutralDark; + result.buttonTextPressed = neutralDark; + result.inputTextHovered = neutralDark; + result.menuItemTextHovered = neutralDark; + } + if (neutralSecondary) { + result.bodySubtext = neutralSecondary; + result.focusBorder = neutralSecondary; + result.inputBorder = neutralSecondary; + result.smallInputBorder = neutralSecondary; + result.inputPlaceholderText = neutralSecondary; + } + if (neutralSecondaryAlt) { + result.buttonBorder = neutralSecondaryAlt; + } + if (neutralTertiaryAlt) { + result.disabledBodySubtext = neutralTertiaryAlt; + result.disabledBorder = neutralTertiaryAlt; + result.buttonBackgroundChecked = neutralTertiaryAlt; + result.menuDivider = neutralTertiaryAlt; + } + if (accent) { + result.accentButtonBackground = accent; + } + if (e === null || e === void 0 ? void 0 : e.elevation4) { + result.cardShadow = e.elevation4; + } + if (!isInverted && (e === null || e === void 0 ? void 0 : e.elevation8)) { + result.cardShadowHovered = e.elevation8; + } else if (result.variantBorderHovered) { + result.cardShadowHovered = "0 0 1px " + result.variantBorderHovered; + } + result = __assign$1(__assign$1({}, result), s2); + return result; + } + function _fixDeprecatedSlots(s2, depComments) { + var dep = ""; + if (depComments === true) { + dep = " /* @deprecated */"; + } + s2.listTextColor = s2.listText + dep; + s2.menuItemBackgroundChecked += dep; + s2.warningHighlight += dep; + s2.warningText = s2.messageText + dep; + s2.successText += dep; + return s2; + } + function mergeThemes(theme, partialTheme) { + var _a2, _b2, _c2; + if (partialTheme === void 0) { + partialTheme = {}; + } + var mergedTheme = merge$3({}, theme, partialTheme, { + semanticColors: getSemanticColors(partialTheme.palette, partialTheme.effects, partialTheme.semanticColors, partialTheme.isInverted === void 0 ? theme.isInverted : partialTheme.isInverted) + }); + if (((_a2 = partialTheme.palette) === null || _a2 === void 0 ? void 0 : _a2.themePrimary) && !((_b2 = partialTheme.palette) === null || _b2 === void 0 ? void 0 : _b2.accent)) { + mergedTheme.palette.accent = partialTheme.palette.themePrimary; + } + if (partialTheme.defaultFontStyle) { + for (var _i = 0, _d2 = Object.keys(mergedTheme.fonts); _i < _d2.length; _i++) { + var fontStyle = _d2[_i]; + mergedTheme.fonts[fontStyle] = merge$3(mergedTheme.fonts[fontStyle], partialTheme.defaultFontStyle, (_c2 = partialTheme === null || partialTheme === void 0 ? void 0 : partialTheme.fonts) === null || _c2 === void 0 ? void 0 : _c2[fontStyle]); + } + } + return mergedTheme; + } + var DefaultPalette = { + themeDarker: "#004578", + themeDark: "#005a9e", + themeDarkAlt: "#106ebe", + themePrimary: "#0078d4", + themeSecondary: "#2b88d8", + themeTertiary: "#71afe5", + themeLight: "#c7e0f4", + themeLighter: "#deecf9", + themeLighterAlt: "#eff6fc", + black: "#000000", + blackTranslucent40: "rgba(0,0,0,.4)", + neutralDark: "#201f1e", + neutralPrimary: "#323130", + neutralPrimaryAlt: "#3b3a39", + neutralSecondary: "#605e5c", + neutralSecondaryAlt: "#8a8886", + neutralTertiary: "#a19f9d", + neutralTertiaryAlt: "#c8c6c4", + neutralQuaternary: "#d2d0ce", + neutralQuaternaryAlt: "#e1dfdd", + neutralLight: "#edebe9", + neutralLighter: "#f3f2f1", + neutralLighterAlt: "#faf9f8", + accent: "#0078d4", + white: "#ffffff", + whiteTranslucent40: "rgba(255,255,255,.4)", + yellowDark: "#d29200", + yellow: "#ffb900", + yellowLight: "#fff100", + orange: "#d83b01", + orangeLight: "#ea4300", + orangeLighter: "#ff8c00", + redDark: "#a4262c", + red: "#e81123", + magentaDark: "#5c005c", + magenta: "#b4009e", + magentaLight: "#e3008c", + purpleDark: "#32145a", + purple: "#5c2d91", + purpleLight: "#b4a0ff", + blueDark: "#002050", + blueMid: "#00188f", + blue: "#0078d4", + blueLight: "#00bcf2", + tealDark: "#004b50", + teal: "#008272", + tealLight: "#00b294", + greenDark: "#004b1c", + green: "#107c10", + greenLight: "#bad80a" + }; + var Depths; + (function(Depths2) { + Depths2.depth0 = "0 0 0 0 transparent"; + Depths2.depth4 = "0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)"; + Depths2.depth8 = "0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)"; + Depths2.depth16 = "0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108)"; + Depths2.depth64 = "0 25.6px 57.6px 0 rgba(0, 0, 0, 0.22), 0 4.8px 14.4px 0 rgba(0, 0, 0, 0.18)"; + })(Depths || (Depths = {})); + var DefaultEffects = { + elevation4: Depths.depth4, + elevation8: Depths.depth8, + elevation16: Depths.depth16, + elevation64: Depths.depth64, + roundedCorner2: "2px", + roundedCorner4: "4px", + roundedCorner6: "6px" + }; + var DefaultSpacing = { + s2: "4px", + s1: "8px", + m: "16px", + l1: "20px", + l2: "32px" + }; + var EASING_FUNCTION_1 = "cubic-bezier(.1,.9,.2,1)"; + var EASING_FUNCTION_2 = "cubic-bezier(.1,.25,.75,.9)"; + var DURATION_1 = "0.167s"; + var DURATION_2 = "0.267s"; + var DURATION_3 = "0.367s"; + var DURATION_4 = "0.467s"; + var FADE_IN = keyframes({ + from: { opacity: 0 }, + to: { opacity: 1 } + }); + var FADE_OUT = keyframes({ + from: { opacity: 1 }, + to: { opacity: 0, visibility: "hidden" } + }); + var SLIDE_RIGHT_IN10 = _createSlideInX(-10); + var SLIDE_RIGHT_IN20 = _createSlideInX(-20); + var SLIDE_RIGHT_IN40 = _createSlideInX(-40); + var SLIDE_RIGHT_IN400 = _createSlideInX(-400); + var SLIDE_LEFT_IN10 = _createSlideInX(10); + var SLIDE_LEFT_IN20 = _createSlideInX(20); + var SLIDE_LEFT_IN40 = _createSlideInX(40); + var SLIDE_LEFT_IN400 = _createSlideInX(400); + var SLIDE_UP_IN10 = _createSlideInY(10); + var SLIDE_UP_IN20 = _createSlideInY(20); + var SLIDE_DOWN_IN10 = _createSlideInY(-10); + var SLIDE_DOWN_IN20 = _createSlideInY(-20); + var SLIDE_RIGHT_OUT10 = _createSlideOutX(10); + var SLIDE_RIGHT_OUT20 = _createSlideOutX(20); + var SLIDE_RIGHT_OUT40 = _createSlideOutX(40); + var SLIDE_RIGHT_OUT400 = _createSlideOutX(400); + var SLIDE_LEFT_OUT10 = _createSlideOutX(-10); + var SLIDE_LEFT_OUT20 = _createSlideOutX(-20); + var SLIDE_LEFT_OUT40 = _createSlideOutX(-40); + var SLIDE_LEFT_OUT400 = _createSlideOutX(-400); + var SLIDE_UP_OUT10 = _createSlideOutY(-10); + var SLIDE_UP_OUT20 = _createSlideOutY(-20); + var SLIDE_DOWN_OUT10 = _createSlideOutY(10); + var SLIDE_DOWN_OUT20 = _createSlideOutY(20); + var SCALE_UP100 = keyframes({ + from: { transform: "scale3d(.98,.98,1)" }, + to: { transform: "scale3d(1,1,1)" } + }); + var SCALE_DOWN98 = keyframes({ + from: { transform: "scale3d(1,1,1)" }, + to: { transform: "scale3d(.98,.98,1)" } + }); + var SCALE_DOWN100 = keyframes({ + from: { transform: "scale3d(1.03,1.03,1)" }, + to: { transform: "scale3d(1,1,1)" } + }); + var SCALE_UP103 = keyframes({ + from: { transform: "scale3d(1,1,1)" }, + to: { transform: "scale3d(1.03,1.03,1)" } + }); + var ROTATE90 = keyframes({ + from: { transform: "rotateZ(0deg)" }, + to: { transform: "rotateZ(90deg)" } + }); + var ROTATE_N90 = keyframes({ + from: { transform: "rotateZ(0deg)" }, + to: { transform: "rotateZ(-90deg)" } + }); + var AnimationVariables = { + easeFunction1: EASING_FUNCTION_1, + easeFunction2: EASING_FUNCTION_2, + durationValue2: DURATION_2, + durationValue3: DURATION_3 + }; + var AnimationStyles = { + slideRightIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN10), DURATION_3, EASING_FUNCTION_1), + slideRightIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN20), DURATION_3, EASING_FUNCTION_1), + slideRightIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN40), DURATION_3, EASING_FUNCTION_1), + slideRightIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN400), DURATION_3, EASING_FUNCTION_1), + slideLeftIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN10), DURATION_3, EASING_FUNCTION_1), + slideLeftIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN20), DURATION_3, EASING_FUNCTION_1), + slideLeftIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN40), DURATION_3, EASING_FUNCTION_1), + slideLeftIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN400), DURATION_3, EASING_FUNCTION_1), + slideUpIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN10), DURATION_3, EASING_FUNCTION_1), + slideUpIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN20), DURATION_3, EASING_FUNCTION_1), + slideDownIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN10), DURATION_3, EASING_FUNCTION_1), + slideDownIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN20), DURATION_3, EASING_FUNCTION_1), + slideRightOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT10), DURATION_3, EASING_FUNCTION_1), + slideRightOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT20), DURATION_3, EASING_FUNCTION_1), + slideRightOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT40), DURATION_3, EASING_FUNCTION_1), + slideRightOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT400), DURATION_3, EASING_FUNCTION_1), + slideLeftOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT10), DURATION_3, EASING_FUNCTION_1), + slideLeftOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT20), DURATION_3, EASING_FUNCTION_1), + slideLeftOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT40), DURATION_3, EASING_FUNCTION_1), + slideLeftOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT400), DURATION_3, EASING_FUNCTION_1), + slideUpOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT10), DURATION_3, EASING_FUNCTION_1), + slideUpOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT20), DURATION_3, EASING_FUNCTION_1), + slideDownOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT10), DURATION_3, EASING_FUNCTION_1), + slideDownOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT20), DURATION_3, EASING_FUNCTION_1), + scaleUpIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_UP100), DURATION_3, EASING_FUNCTION_1), + scaleDownIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_DOWN100), DURATION_3, EASING_FUNCTION_1), + scaleUpOut103: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_UP103), DURATION_1, EASING_FUNCTION_2), + scaleDownOut98: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_DOWN98), DURATION_1, EASING_FUNCTION_2), + fadeIn100: _createAnimation(FADE_IN, DURATION_1, EASING_FUNCTION_2), + fadeIn200: _createAnimation(FADE_IN, DURATION_2, EASING_FUNCTION_2), + fadeIn400: _createAnimation(FADE_IN, DURATION_3, EASING_FUNCTION_2), + fadeIn500: _createAnimation(FADE_IN, DURATION_4, EASING_FUNCTION_2), + fadeOut100: _createAnimation(FADE_OUT, DURATION_1, EASING_FUNCTION_2), + fadeOut200: _createAnimation(FADE_OUT, DURATION_2, EASING_FUNCTION_2), + fadeOut400: _createAnimation(FADE_OUT, DURATION_3, EASING_FUNCTION_2), + fadeOut500: _createAnimation(FADE_OUT, DURATION_4, EASING_FUNCTION_2), + rotate90deg: _createAnimation(ROTATE90, "0.1s", EASING_FUNCTION_2), + rotateN90deg: _createAnimation(ROTATE_N90, "0.1s", EASING_FUNCTION_2) + // expandCollapse 100/200/400, delay 100/200 + }; + function _createAnimation(animationName, animationDuration2, animationTimingFunction) { + return { + animationName, + animationDuration: animationDuration2, + animationTimingFunction, + animationFillMode: "both" }; - var onMenuKeyDown = function(ev) { - // Mark as handled if onKeyDown returns true (for handling collapse cases) - // or if we are attempting to expand a submenu - var handled = onKeyDown(ev); - if (handled || !hostElement.current) return; - // If we have a modifier key being pressed, we do not want to move focus. - // Otherwise, handle up and down keys. - var hasModifier = !!(ev.altKey || ev.metaKey); - // eslint-disable-next-line deprecation/deprecation - var isUp = ev.which === (0, _utilities.KeyCodes).up; - // eslint-disable-next-line deprecation/deprecation - var isDown = ev.which === (0, _utilities.KeyCodes).down; - if (!hasModifier && (isUp || isDown)) { - var elementToFocus = isUp ? (0, _utilities.getLastFocusable)(hostElement.current, hostElement.current.lastChild, true) : (0, _utilities.getFirstFocusable)(hostElement.current, hostElement.current.firstChild, true); - if (elementToFocus) { - elementToFocus.focus(); - ev.preventDefault(); - ev.stopPropagation(); - } - } + } + function _createSlideInX(fromX) { + return keyframes({ + from: { transform: "translate3d(".concat(fromX, "px,0,0)"), pointerEvents: "none" }, + to: { transform: "translate3d(0,0,0)", pointerEvents: "auto" } + }); + } + function _createSlideInY(fromY) { + return keyframes({ + from: { transform: "translate3d(0,".concat(fromY, "px,0)"), pointerEvents: "none" }, + to: { transform: "translate3d(0,0,0)", pointerEvents: "auto" } + }); + } + function _createSlideOutX(toX) { + return keyframes({ + from: { transform: "translate3d(0,0,0)" }, + to: { transform: "translate3d(".concat(toX, "px,0,0)") } + }); + } + function _createSlideOutY(toY) { + return keyframes({ + from: { transform: "translate3d(0,0,0)" }, + to: { transform: "translate3d(0,".concat(toY, "px,0)") } + }); + } + var LocalizedFontNames; + (function(LocalizedFontNames2) { + LocalizedFontNames2.Arabic = "Segoe UI Web (Arabic)"; + LocalizedFontNames2.Cyrillic = "Segoe UI Web (Cyrillic)"; + LocalizedFontNames2.EastEuropean = "Segoe UI Web (East European)"; + LocalizedFontNames2.Greek = "Segoe UI Web (Greek)"; + LocalizedFontNames2.Hebrew = "Segoe UI Web (Hebrew)"; + LocalizedFontNames2.Thai = "Leelawadee UI Web"; + LocalizedFontNames2.Vietnamese = "Segoe UI Web (Vietnamese)"; + LocalizedFontNames2.WestEuropean = "Segoe UI Web (West European)"; + LocalizedFontNames2.Selawik = "Selawik Web"; + LocalizedFontNames2.Armenian = "Segoe UI Web (Armenian)"; + LocalizedFontNames2.Georgian = "Segoe UI Web (Georgian)"; + })(LocalizedFontNames || (LocalizedFontNames = {})); + var LocalizedFontFamilies; + (function(LocalizedFontFamilies2) { + LocalizedFontFamilies2.Arabic = "'".concat(LocalizedFontNames.Arabic, "'"); + LocalizedFontFamilies2.ChineseSimplified = "'Microsoft Yahei UI', Verdana, Simsun"; + LocalizedFontFamilies2.ChineseTraditional = "'Microsoft Jhenghei UI', Pmingliu"; + LocalizedFontFamilies2.Cyrillic = "'".concat(LocalizedFontNames.Cyrillic, "'"); + LocalizedFontFamilies2.EastEuropean = "'".concat(LocalizedFontNames.EastEuropean, "'"); + LocalizedFontFamilies2.Greek = "'".concat(LocalizedFontNames.Greek, "'"); + LocalizedFontFamilies2.Hebrew = "'".concat(LocalizedFontNames.Hebrew, "'"); + LocalizedFontFamilies2.Hindi = "'Nirmala UI'"; + LocalizedFontFamilies2.Japanese = "'Yu Gothic UI', 'Meiryo UI', Meiryo, 'MS Pgothic', Osaka"; + LocalizedFontFamilies2.Korean = "'Malgun Gothic', Gulim"; + LocalizedFontFamilies2.Selawik = "'".concat(LocalizedFontNames.Selawik, "'"); + LocalizedFontFamilies2.Thai = "'Leelawadee UI Web', 'Kmer UI'"; + LocalizedFontFamilies2.Vietnamese = "'".concat(LocalizedFontNames.Vietnamese, "'"); + LocalizedFontFamilies2.WestEuropean = "'".concat(LocalizedFontNames.WestEuropean, "'"); + LocalizedFontFamilies2.Armenian = "'".concat(LocalizedFontNames.Armenian, "'"); + LocalizedFontFamilies2.Georgian = "'".concat(LocalizedFontNames.Georgian, "'"); + })(LocalizedFontFamilies || (LocalizedFontFamilies = {})); + var FontSizes; + (function(FontSizes2) { + FontSizes2.size10 = "10px"; + FontSizes2.size12 = "12px"; + FontSizes2.size14 = "14px"; + FontSizes2.size16 = "16px"; + FontSizes2.size18 = "18px"; + FontSizes2.size20 = "20px"; + FontSizes2.size24 = "24px"; + FontSizes2.size28 = "28px"; + FontSizes2.size32 = "32px"; + FontSizes2.size42 = "42px"; + FontSizes2.size68 = "68px"; + FontSizes2.mini = "10px"; + FontSizes2.xSmall = "10px"; + FontSizes2.small = "12px"; + FontSizes2.smallPlus = "12px"; + FontSizes2.medium = "14px"; + FontSizes2.mediumPlus = "16px"; + FontSizes2.icon = "16px"; + FontSizes2.large = "18px"; + FontSizes2.xLarge = "20px"; + FontSizes2.xLargePlus = "24px"; + FontSizes2.xxLarge = "28px"; + FontSizes2.xxLargePlus = "32px"; + FontSizes2.superLarge = "42px"; + FontSizes2.mega = "68px"; + })(FontSizes || (FontSizes = {})); + var FontWeights; + (function(FontWeights2) { + FontWeights2.light = 100; + FontWeights2.semilight = 300; + FontWeights2.regular = 400; + FontWeights2.semibold = 600; + FontWeights2.bold = 700; + })(FontWeights || (FontWeights = {})); + var IconFontSizes; + (function(IconFontSizes2) { + IconFontSizes2.xSmall = "10px"; + IconFontSizes2.small = "12px"; + IconFontSizes2.medium = "16px"; + IconFontSizes2.large = "20px"; + })(IconFontSizes || (IconFontSizes = {})); + var FontFamilyFallbacks = "'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif"; + var defaultFontFamily = "'Segoe UI', '".concat(LocalizedFontNames.WestEuropean, "'"); + var LanguageToFontMap = { + ar: LocalizedFontFamilies.Arabic, + bg: LocalizedFontFamilies.Cyrillic, + cs: LocalizedFontFamilies.EastEuropean, + el: LocalizedFontFamilies.Greek, + et: LocalizedFontFamilies.EastEuropean, + he: LocalizedFontFamilies.Hebrew, + hi: LocalizedFontFamilies.Hindi, + hr: LocalizedFontFamilies.EastEuropean, + hu: LocalizedFontFamilies.EastEuropean, + ja: LocalizedFontFamilies.Japanese, + kk: LocalizedFontFamilies.EastEuropean, + ko: LocalizedFontFamilies.Korean, + lt: LocalizedFontFamilies.EastEuropean, + lv: LocalizedFontFamilies.EastEuropean, + pl: LocalizedFontFamilies.EastEuropean, + ru: LocalizedFontFamilies.Cyrillic, + sk: LocalizedFontFamilies.EastEuropean, + "sr-latn": LocalizedFontFamilies.EastEuropean, + th: LocalizedFontFamilies.Thai, + tr: LocalizedFontFamilies.EastEuropean, + uk: LocalizedFontFamilies.Cyrillic, + vi: LocalizedFontFamilies.Vietnamese, + "zh-hans": LocalizedFontFamilies.ChineseSimplified, + "zh-hant": LocalizedFontFamilies.ChineseTraditional, + hy: LocalizedFontFamilies.Armenian, + ka: LocalizedFontFamilies.Georgian + }; + function _fontFamilyWithFallbacks(fontFamily2) { + return "".concat(fontFamily2, ", ").concat(FontFamilyFallbacks); + } + function _getLocalizedFontFamily(language) { + for (var lang in LanguageToFontMap) { + if (LanguageToFontMap.hasOwnProperty(lang) && language && lang.indexOf(language) === 0) { + return LanguageToFontMap[lang]; + } + } + return defaultFontFamily; + } + function _createFont(size, weight, fontFamily2) { + return { + fontFamily: fontFamily2, + MozOsxFontSmoothing: "grayscale", + WebkitFontSmoothing: "antialiased", + fontSize: size, + fontWeight: weight }; - var onItemKeyDown = function(item, ev) { - var openKey = (0, _utilities.getRTL)(theme) ? (0, _utilities.KeyCodes).left : (0, _utilities.KeyCodes).right; - if (!item.disabled && // eslint-disable-next-line deprecation/deprecation - (ev.which === openKey || ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).down && (ev.altKey || ev.metaKey))) { - openSubMenu(item, ev.currentTarget); - ev.preventDefault(); - } + } + function createFontStyles(localeCode) { + var localizedFont = _getLocalizedFontFamily(localeCode); + var fontFamilyWithFallback = _fontFamilyWithFallbacks(localizedFont); + var fontStyles = { + tiny: _createFont(FontSizes.mini, FontWeights.regular, fontFamilyWithFallback), + xSmall: _createFont(FontSizes.xSmall, FontWeights.regular, fontFamilyWithFallback), + small: _createFont(FontSizes.small, FontWeights.regular, fontFamilyWithFallback), + smallPlus: _createFont(FontSizes.smallPlus, FontWeights.regular, fontFamilyWithFallback), + medium: _createFont(FontSizes.medium, FontWeights.regular, fontFamilyWithFallback), + mediumPlus: _createFont(FontSizes.mediumPlus, FontWeights.regular, fontFamilyWithFallback), + large: _createFont(FontSizes.large, FontWeights.regular, fontFamilyWithFallback), + xLarge: _createFont(FontSizes.xLarge, FontWeights.semibold, fontFamilyWithFallback), + xLargePlus: _createFont(FontSizes.xLargePlus, FontWeights.semibold, fontFamilyWithFallback), + xxLarge: _createFont(FontSizes.xxLarge, FontWeights.semibold, fontFamilyWithFallback), + xxLargePlus: _createFont(FontSizes.xxLargePlus, FontWeights.semibold, fontFamilyWithFallback), + superLarge: _createFont(FontSizes.superLarge, FontWeights.semibold, fontFamilyWithFallback), + mega: _createFont(FontSizes.mega, FontWeights.semibold, fontFamilyWithFallback) }; - return [ - onKeyDown, - onKeyUp, - onMenuKeyDown, - onItemKeyDown - ]; -} -function useScrollHandler(asyncTracker) { - var isScrollIdle = _react.useRef(true); - var scrollIdleTimeoutId = _react.useRef(); - /** - * Scroll handler for the callout to make sure the mouse events - * for updating focus are not interacting during scroll - */ var onScroll = function() { - if (!isScrollIdle.current && scrollIdleTimeoutId.current !== undefined) { - asyncTracker.clearTimeout(scrollIdleTimeoutId.current); - scrollIdleTimeoutId.current = undefined; - } else isScrollIdle.current = false; - scrollIdleTimeoutId.current = asyncTracker.setTimeout(function() { - isScrollIdle.current = true; - }, NavigationIdleDelay); + return fontStyles; + } + var DefaultBaseUrl = "https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets"; + var DefaultFontStyles = createFontStyles(getLanguage()); + function _registerFontFace(fontFamily2, url, fontWeight, localFontName) { + fontFamily2 = "'".concat(fontFamily2, "'"); + var localFontSrc = localFontName !== void 0 ? "local('".concat(localFontName, "'),") : ""; + fontFace({ + fontFamily: fontFamily2, + src: localFontSrc + "url('".concat(url, ".woff2') format('woff2'),") + "url('".concat(url, ".woff') format('woff')"), + fontWeight, + fontStyle: "normal", + fontDisplay: "swap" + }); + } + function _registerFontFaceSet(baseUrl, fontFamily2, cdnFolder, cdnFontName, localFontName) { + if (cdnFontName === void 0) { + cdnFontName = "segoeui"; + } + var urlBase = "".concat(baseUrl, "/").concat(cdnFolder, "/").concat(cdnFontName); + _registerFontFace(fontFamily2, urlBase + "-light", FontWeights.light, localFontName && localFontName + " Light"); + _registerFontFace(fontFamily2, urlBase + "-semilight", FontWeights.semilight, localFontName && localFontName + " SemiLight"); + _registerFontFace(fontFamily2, urlBase + "-regular", FontWeights.regular, localFontName); + _registerFontFace(fontFamily2, urlBase + "-semibold", FontWeights.semibold, localFontName && localFontName + " SemiBold"); + _registerFontFace(fontFamily2, urlBase + "-bold", FontWeights.bold, localFontName && localFontName + " Bold"); + } + function registerDefaultFontFaces(baseUrl) { + if (baseUrl) { + var fontUrl = "".concat(baseUrl, "/fonts"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Thai, "leelawadeeui-thai", "leelawadeeui"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Arabic, "segoeui-arabic"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Cyrillic, "segoeui-cyrillic"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.EastEuropean, "segoeui-easteuropean"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Greek, "segoeui-greek"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Hebrew, "segoeui-hebrew"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Vietnamese, "segoeui-vietnamese"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.WestEuropean, "segoeui-westeuropean", "segoeui", "Segoe UI"); + _registerFontFaceSet(fontUrl, LocalizedFontFamilies.Selawik, "selawik", "selawik"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Armenian, "segoeui-armenian"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Georgian, "segoeui-georgian"); + _registerFontFace("Leelawadee UI Web", "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-semilight"), FontWeights.light); + _registerFontFace("Leelawadee UI Web", "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-bold"), FontWeights.semibold); + } + } + function _getFontBaseUrl() { + var _a2, _b2; + var fabricConfig = (_a2 = getWindow()) === null || _a2 === void 0 ? void 0 : _a2.FabricConfig; + return (_b2 = fabricConfig === null || fabricConfig === void 0 ? void 0 : fabricConfig.fontBaseUrl) !== null && _b2 !== void 0 ? _b2 : DefaultBaseUrl; + } + registerDefaultFontFaces(_getFontBaseUrl()); + function createTheme(theme, depComments) { + if (theme === void 0) { + theme = {}; + } + if (depComments === void 0) { + depComments = false; + } + var isInverted = !!theme.isInverted; + var baseTheme = { + palette: DefaultPalette, + effects: DefaultEffects, + fonts: DefaultFontStyles, + spacing: DefaultSpacing, + isInverted, + disableGlobalClassNames: false, + semanticColors: makeSemanticColors(DefaultPalette, DefaultEffects, void 0, isInverted, depComments), + rtl: void 0 + }; + return mergeThemes(baseTheme, theme); + } + var HighContrastSelector = "@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)"; + var HighContrastSelectorWhite = ( + // eslint-disable-next-line @fluentui/max-len + "@media screen and (-ms-high-contrast: black-on-white), screen and (forced-colors: active) and (prefers-color-scheme: light)" + ); + var ScreenWidthMinSmall = 320; + var ScreenWidthMinMedium = 480; + var ScreenWidthMinLarge = 640; + var ScreenWidthMinXLarge = 1024; + var ScreenWidthMinXXLarge = 1366; + var ScreenWidthMaxSmall = ScreenWidthMinMedium - 1; + var ScreenWidthMaxMedium = ScreenWidthMinLarge - 1; + var ScreenWidthMinUhfMobile = 768; + function getScreenSelector(min2, max2) { + var minSelector = " and (min-width: ".concat(min2, "px)"); + var maxSelector = typeof max2 === "number" ? " and (max-width: ".concat(max2, "px)") : ""; + return "@media only screen".concat(minSelector).concat(maxSelector); + } + function getHighContrastNoAdjustStyle() { + return { + forcedColorAdjust: "none", + MsHighContrastAdjust: "none" }; - return [ - onScroll, - isScrollIdle - ]; -} -function useOnSubmenuDismiss(dismiss, closeSubMenu) { - var isMountedRef = _react.useRef(false); - _react.useEffect(function() { - isMountedRef.current = true; - return function() { - isMountedRef.current = false; - }; - }, []); - /** - * This function is called ASYNCHRONOUSLY, and so there is a chance it is called - * after the component is unmounted. The isMountedRef is added to prevent - * from calling setState() after unmount. Do NOT copy this pattern in synchronous - * code. - */ var onSubMenuDismiss = function(ev, dismissAll) { - if (dismissAll) dismiss(ev, dismissAll); - else if (isMountedRef.current) closeSubMenu(); + } + var ZIndexes; + (function(ZIndexes2) { + ZIndexes2.Nav = 1; + ZIndexes2.ScrollablePane = 1; + ZIndexes2.FocusStyle = 1; + ZIndexes2.Coachmark = 1e3; + ZIndexes2.Layer = 1e6; + ZIndexes2.KeytipLayer = 1000001; + })(ZIndexes || (ZIndexes = {})); + function getFocusStyle(theme, insetOrOptions, position2, highContrastStyle, borderColor, outlineColor, isFocusedOnly, borderRadius) { + if (typeof insetOrOptions === "number" || !insetOrOptions) { + return _getFocusStyleInternal(theme, { + inset: insetOrOptions, + position: position2, + highContrastStyle, + borderColor, + outlineColor, + isFocusedOnly, + borderRadius + }); + } else { + return _getFocusStyleInternal(theme, insetOrOptions); + } + } + function _getFocusStyleInternal(theme, options2) { + var _a2, _b2; + if (options2 === void 0) { + options2 = {}; + } + var borderRadius = options2.borderRadius, _c2 = options2.inset, inset = _c2 === void 0 ? 0 : _c2, _d2 = options2.width, width2 = _d2 === void 0 ? 1 : _d2, _e2 = options2.position, position2 = _e2 === void 0 ? "relative" : _e2, highContrastStyle = options2.highContrastStyle, _f = options2.borderColor, borderColor = _f === void 0 ? theme.palette.white : _f, _g = options2.outlineColor, outlineColor = _g === void 0 ? theme.palette.neutralSecondary : _g, _h = options2.isFocusedOnly, isFocusedOnly = _h === void 0 ? true : _h, pointerEvents = options2.pointerEvents; + return { + // Clear browser-specific focus styles and use 'transparent' as placeholder for focus style. + outline: "transparent", + // Requirement because pseudo-element is absolutely positioned. + position: position2, + selectors: (_a2 = { + // Clear the focus border in Firefox. + // Reference: http://stackoverflow.com/a/199319/1436671 + "::-moz-focus-inner": { + border: "0" + } + }, // When the element that uses this mixin is in a :focus state, add a pseudo-element to + // create a border. + _a2[".".concat(IsFocusVisibleClassName, " &").concat(isFocusedOnly ? ":focus" : "", ":after, :host(.").concat(IsFocusVisibleClassName, ") &").concat(isFocusedOnly ? ":focus" : "", ":after")] = { + content: '""', + position: "absolute", + pointerEvents, + left: inset + 1, + top: inset + 1, + bottom: inset + 1, + right: inset + 1, + border: "".concat(width2, "px solid ").concat(borderColor), + outline: "".concat(width2, "px solid ").concat(outlineColor), + zIndex: ZIndexes.FocusStyle, + borderRadius, + selectors: (_b2 = {}, _b2[HighContrastSelector] = highContrastStyle, _b2) + }, _a2) }; - return onSubMenuDismiss; -} -function useSubmenuEnterTimer(_a, asyncTracker) { - var _b = _a.subMenuHoverDelay, subMenuHoverDelay = _b === void 0 ? NavigationIdleDelay : _b; - var enterTimerRef = _react.useRef(undefined); - var cancelSubMenuTimer = function() { - if (enterTimerRef.current !== undefined) { - asyncTracker.clearTimeout(enterTimerRef.current); - enterTimerRef.current = undefined; + } + function focusClear() { + return { + selectors: { + "&::-moz-focus-inner": { + // Clear the focus border in Firefox. Reference: http://stackoverflow.com/a/199319/1436671 + border: 0 + }, + "&": { + // Clear browser specific focus styles and use transparent as placeholder for focus style + outline: "transparent" } + } }; - var startSubmenuTimer = function(onTimerExpired) { - enterTimerRef.current = asyncTracker.setTimeout(function() { - onTimerExpired(); - cancelSubMenuTimer(); - }, subMenuHoverDelay); - }; - return [ - cancelSubMenuTimer, - startSubmenuTimer, - enterTimerRef - ]; -} -function useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss) { - var menuTarget = props.target; - var onItemMouseEnterBase = function(item, ev, target) { - if (shouldUpdateFocusOnMouseEvent.current) gotMouseMove.current = true; - if (shouldIgnoreMouseEvent()) return; - updateFocusOnMouseEvent(item, ev, target); - }; - var onItemMouseMoveBase = function(item, ev, target) { - var targetElement = ev.currentTarget; - // Always do this check to make sure we record a mouseMove if needed (even if we are timed out) - if (shouldUpdateFocusOnMouseEvent.current) gotMouseMove.current = true; - else return; - if (!isScrollIdle.current || subMenuEntryTimer.current !== undefined || targetElement === (targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement)) return; - updateFocusOnMouseEvent(item, ev, target); - }; - var shouldIgnoreMouseEvent = function() { - return !isScrollIdle.current || !gotMouseMove.current; - }; - var onMouseItemLeave = function(item, ev) { - var _a; - if (shouldIgnoreMouseEvent()) return; - cancelSubMenuTimer(); - if (expandedMenuItemKey !== undefined) return; - /** - * IE11 focus() method forces parents to scroll to top of element. - * Edge and IE expose a setActive() function for focusable divs that - * sets the page focus but does not scroll the parent element. - */ if (hostElement.current.setActive) try { - hostElement.current.setActive(); - } catch (e) { - /* no-op */ } - else (_a = hostElement.current) === null || _a === void 0 || _a.focus(); - }; - /** - * Handles updating focus when mouseEnter or mouseMove fire. - * As part of updating focus, This function will also update - * the expand/collapse state accordingly. - */ var updateFocusOnMouseEvent = function(item, ev, target) { - var targetElement = target ? target : ev.currentTarget; - if (item.key === expandedMenuItemKey) return; - cancelSubMenuTimer(); - // If the menu is not expanded we can update focus without any delay - if (expandedMenuItemKey === undefined) targetElement.focus(); - // Delay updating expanding/dismissing the submenu - // and only set focus if we have not already done so - if ((0, _index.hasSubmenu)(item)) { - ev.stopPropagation(); - startSubmenuTimer(function() { - targetElement.focus(); - openSubMenu(item, targetElement, true); - }); - } else startSubmenuTimer(function() { - onSubMenuDismiss(ev); - targetElement.focus(); - }); + } + var getInputFocusStyle = function(borderColor, borderRadius, borderType, borderPosition) { + var _a2, _b2, _c2; + if (borderType === void 0) { + borderType = "border"; + } + if (borderPosition === void 0) { + borderPosition = -1; + } + var isBorderBottom = borderType === "borderBottom"; + return { + borderColor, + selectors: { + ":after": (_a2 = { + pointerEvents: "none", + content: "''", + position: "absolute", + left: isBorderBottom ? 0 : borderPosition, + top: borderPosition, + bottom: borderPosition, + right: isBorderBottom ? 0 : borderPosition + }, _a2[borderType] = "2px solid ".concat(borderColor), _a2.borderRadius = borderRadius, _a2.width = borderType === "borderBottom" ? "100%" : void 0, _a2.selectors = (_b2 = {}, _b2[HighContrastSelector] = (_c2 = {}, _c2[borderType === "border" ? "borderColor" : "borderBottomColor"] = "Highlight", _c2), _b2), _a2) + } }; - var onItemClick = function(item, ev) { - onItemClickBase(item, ev, ev.currentTarget); + }; + var hiddenContentStyle = { + position: "absolute", + width: 1, + height: 1, + margin: -1, + padding: 0, + border: 0, + overflow: "hidden", + whiteSpace: "nowrap" + }; + var _getGlobalClassNames = memoizeFunction(function(classNames2, disableGlobalClassNames) { + var styleSheet = Stylesheet.getInstance(); + if (disableGlobalClassNames) { + return Object.keys(classNames2).reduce(function(acc, className2) { + acc[className2] = styleSheet.getClassName(classNames2[className2]); + return acc; + }, {}); + } + return classNames2; + }); + function getGlobalClassNames(classNames2, theme, disableGlobalClassNames) { + return _getGlobalClassNames(classNames2, theme.disableGlobalClassNames); + } + var __assign = function() { + __assign = Object.assign || function(t) { + for (var s2, i = 1, n = arguments.length; i < n; i++) { + s2 = arguments[i]; + for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) + t[p] = s2[p]; + } + return t; }; - var onItemClickBase = function(item, ev, target) { - var items = getSubmenuItems(item, { - target: menuTarget - }); - // Cancel an async menu item hover timeout action from being taken and instead - // just trigger the click event instead. - cancelSubMenuTimer(); - if (!(0, _index.hasSubmenu)(item) && (!items || !items.length)) // This is an item without a menu. Click it. - executeItemClick(item, ev); - else if (item.key !== expandedMenuItemKey) { - // This has a collapsed sub menu. Expand it. - // focus on the container by default when the menu is opened with a click event - // this differentiates from a keyboard interaction triggering the click event - var shouldFocusOnContainer = typeof props.shouldFocusOnContainer === 'boolean' ? props.shouldFocusOnContainer : ev.nativeEvent.pointerType === 'mouse'; - openSubMenu(item, target, shouldFocusOnContainer); - } - ev.stopPropagation(); - ev.preventDefault(); + return __assign.apply(this, arguments); + }; + var _root = typeof window === "undefined" ? global : window; + var _styleNonce = _root && _root.CSPSettings && _root.CSPSettings.nonce; + var _themeState = initializeThemeState(); + function initializeThemeState() { + var state = _root.__themeState__ || { + theme: void 0, + lastStyleElement: void 0, + registeredStyles: [] + }; + if (!state.runState) { + state = __assign(__assign({}, state), { perf: { + count: 0, + duration: 0 + }, runState: { + flushTimer: 0, + mode: 0, + buffer: [] + } }); + } + if (!state.registeredThemableStyles) { + state = __assign(__assign({}, state), { registeredThemableStyles: [] }); + } + _root.__themeState__ = state; + return state; + } + function applyThemableStyles(stylesArray, styleRecord) { + if (_themeState.loadStyles) { + _themeState.loadStyles(resolveThemableArray(stylesArray).styleString, stylesArray); + } else { + registerStyles(stylesArray); + } + } + function loadTheme$1(theme) { + _themeState.theme = theme; + reloadStyles(); + } + function clearStyles(option) { + { + clearStylesInternal(_themeState.registeredThemableStyles); + _themeState.registeredThemableStyles = []; + } + } + function clearStylesInternal(records) { + records.forEach(function(styleRecord) { + var styleElement = styleRecord && styleRecord.styleElement; + if (styleElement && styleElement.parentElement) { + styleElement.parentElement.removeChild(styleElement); + } + }); + } + function reloadStyles() { + if (_themeState.theme) { + var themableStyles = []; + for (var _i = 0, _a2 = _themeState.registeredThemableStyles; _i < _a2.length; _i++) { + var styleRecord = _a2[_i]; + themableStyles.push(styleRecord.themableStyle); + } + if (themableStyles.length > 0) { + clearStyles(); + applyThemableStyles([].concat.apply([], themableStyles)); + } + } + } + function resolveThemableArray(splitStyleArray) { + var theme = _themeState.theme; + var themable = false; + var resolvedArray = (splitStyleArray || []).map(function(currentValue) { + var themeSlot = currentValue.theme; + if (themeSlot) { + themable = true; + var themedValue = theme ? theme[themeSlot] : void 0; + var defaultValue = currentValue.defaultValue || "inherit"; + if (theme && !themedValue && console && !(themeSlot in theme) && typeof DEBUG !== "undefined" && DEBUG) { + console.warn('Theming value not provided for "'.concat(themeSlot, '". Falling back to "').concat(defaultValue, '".')); + } + return themedValue || defaultValue; + } else { + return currentValue.rawString; + } + }); + return { + styleString: resolvedArray.join(""), + themable }; - var onAnchorClick = function(item, ev) { - executeItemClick(item, ev); - ev.stopPropagation(); + } + function registerStyles(styleArray) { + if (typeof document === "undefined") { + return; + } + var head = document.getElementsByTagName("head")[0]; + var styleElement = document.createElement("style"); + var _a2 = resolveThemableArray(styleArray), styleString = _a2.styleString, themable = _a2.themable; + styleElement.setAttribute("data-load-themed-styles", "true"); + if (_styleNonce) { + styleElement.setAttribute("nonce", _styleNonce); + } + styleElement.appendChild(document.createTextNode(styleString)); + _themeState.perf.count++; + head.appendChild(styleElement); + var ev = document.createEvent("HTMLEvents"); + ev.initEvent( + "styleinsert", + true, + false + /* cancelable */ + ); + ev.args = { + newStyle: styleElement }; - var executeItemClick = function(item, ev) { - if (item.disabled || item.isDisabled) return; - if (item.preferMenuTargetAsEventTarget) overrideTarget(ev, menuTarget); - var shouldDismiss = false; - if (item.onClick) shouldDismiss = !!item.onClick(ev, item); - else if (props.onItemClick) shouldDismiss = !!props.onItemClick(ev, item); - if (shouldDismiss || !ev.defaultPrevented) dismiss(ev, true); + document.dispatchEvent(ev); + var record = { + styleElement, + themableStyle: styleArray }; - return [ - onItemMouseEnterBase, - onItemMouseMoveBase, - onMouseItemLeave, - onItemClick, - onAnchorClick, - executeItemClick, - onItemClickBase - ]; -} -var ContextualMenuBase = _react.memo(_react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var _a; - var _b = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults), ref = _b.ref, props = (0, _tslib.__rest)(_b, [ - "ref" - ]); - var hostElement = _react.useRef(null); - var asyncTracker = (0, _reactHooks.useAsync)(); - var menuId = (0, _reactHooks.useId)(COMPONENT_NAME, props.id); - (0, _reactHooks.useWarnings)({ - name: COMPONENT_NAME, - props: props, - deprecations: { - getMenuClassNames: 'styles' - } + if (themable) { + _themeState.registeredThemableStyles.push(record); + } else { + _themeState.registeredStyles.push(record); + } + } + var _theme = createTheme({}); + var _onThemeChangeCallbacks = []; + var ThemeSettingName = "theme"; + function initializeThemeInCustomizations() { + var _a2; + var _b2, _c2; + var win = getWindow(); + if ((_b2 = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _b2 === void 0 ? void 0 : _b2.legacyTheme) { + loadTheme(win.FabricConfig.legacyTheme); + } else if (!Customizations.getSettings([ThemeSettingName]).theme) { + if ((_c2 = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _c2 === void 0 ? void 0 : _c2.theme) { + _theme = createTheme(win.FabricConfig.theme); + } + Customizations.applySettings((_a2 = {}, _a2[ThemeSettingName] = _theme, _a2)); + } + } + initializeThemeInCustomizations(); + function getTheme(depComments) { + if (depComments === void 0) { + depComments = false; + } + if (depComments === true) { + _theme = createTheme({}, depComments); + } + return _theme; + } + function loadTheme(theme, depComments) { + var _a2; + if (depComments === void 0) { + depComments = false; + } + _theme = createTheme(theme, depComments); + loadTheme$1(__assign$1(__assign$1(__assign$1(__assign$1({}, _theme.palette), _theme.semanticColors), _theme.effects), _loadFonts(_theme))); + Customizations.applySettings((_a2 = {}, _a2[ThemeSettingName] = _theme, _a2)); + _onThemeChangeCallbacks.forEach(function(callback) { + try { + callback(_theme); + } catch (e) { + } }); - var dismiss = function(ev, dismissAll) { - var _a; - return (_a = props.onDismiss) === null || _a === void 0 ? void 0 : _a.call(props, ev, dismissAll); - }; - var _c = (0, _reactHooks.useTarget)(props.target, hostElement), targetRef = _c[0], targetWindow = _c[1]; - var tryFocusPreviousActiveElement = usePreviousActiveElement(props, targetWindow, hostElement)[0]; - var _d = useSubMenuState(props, dismiss), expandedMenuItemKey = _d[0], openSubMenu = _d[1], getSubmenuProps = _d[2], onSubMenuDismiss = _d[3]; - var _e = useShouldUpdateFocusOnMouseMove(props), shouldUpdateFocusOnMouseEvent = _e[0], gotMouseMove = _e[1], onMenuFocusCapture = _e[2]; - var _f = useScrollHandler(asyncTracker), onScroll = _f[0], isScrollIdle = _f[1]; - var _g = useSubmenuEnterTimer(props, asyncTracker), cancelSubMenuTimer = _g[0], startSubmenuTimer = _g[1], subMenuEntryTimer = _g[2]; - var responsiveMode = (0, _responsiveMode.useResponsiveMode)(hostElement, props.responsiveMode); - useVisibility(props, targetWindow); - var _h = useKeyHandlers(props, dismiss, hostElement, openSubMenu), onKeyDown = _h[0], onKeyUp = _h[1], onMenuKeyDown = _h[2], onItemKeyDown = _h[3]; - var _j = useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss), onItemMouseEnterBase = _j[0], onItemMouseMoveBase = _j[1], onMouseItemLeave = _j[2], onItemClick = _j[3], onAnchorClick = _j[4], executeItemClick = _j[5], onItemClickBase = _j[6]; - //#region Render helpers - var onDefaultRenderMenuList = function(menuListProps, // eslint-disable-next-line deprecation/deprecation - menuClassNames, defaultRender) { - var indexCorrection = 0; - var items = menuListProps.items, totalItemCount = menuListProps.totalItemCount, hasCheckmarks = menuListProps.hasCheckmarks, hasIcons = menuListProps.hasIcons; - return _react.createElement("ul", { - className: menuClassNames.list, - onKeyDown: onKeyDown, - onKeyUp: onKeyUp, - role: 'presentation' - }, items.map(function(item, index) { - var menuItem = renderMenuItem(item, index, indexCorrection, totalItemCount, hasCheckmarks, hasIcons, menuClassNames); - if (item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Divider && item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Header) { - var indexIncrease = item.customOnRenderListLength ? item.customOnRenderListLength : 1; - indexCorrection += indexIncrease; - } - return menuItem; - })); + return _theme; + } + function _loadFonts(theme) { + var lines = {}; + for (var _i = 0, _a2 = Object.keys(theme.fonts); _i < _a2.length; _i++) { + var fontName = _a2[_i]; + var font2 = theme.fonts[fontName]; + for (var _b2 = 0, _c2 = Object.keys(font2); _b2 < _c2.length; _b2++) { + var propName = _c2[_b2]; + var name_1 = fontName + propName.charAt(0).toUpperCase() + propName.slice(1); + var value2 = font2[propName]; + if (propName === "fontSize" && typeof value2 === "number") { + value2 = value2 + "px"; + } + lines[name_1] = value2; + } + } + return lines; + } + var normalize$1 = { + boxShadow: "none", + margin: 0, + padding: 0, + boxSizing: "border-box" + }; + function getPlaceholderStyles(styles) { + return { + selectors: { + "::placeholder": styles, + // Chrome, Safari, Opera, Firefox + ":-ms-input-placeholder": styles, + // IE 10+ + "::-ms-input-placeholder": styles + // Edge + } }; - var renderFocusZone = function(children, adjustedFocusZoneProps) { - var _a = props.focusZoneAs, ChildrenRenderer = _a === void 0 ? (0, _focusZone.FocusZone) : _a; - return _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({}, adjustedFocusZoneProps), children); + } + var AnimationClassNames = buildClassMap(AnimationStyles); + setVersion("@fluentui/style-utilities", "8.13.5"); + initializeThemeInCustomizations(); + var GlobalClassNames$h = { + root: "ms-Image", + rootMaximizeFrame: "ms-Image--maximizeFrame", + image: "ms-Image-image", + imageCenter: "ms-Image-image--center", + imageContain: "ms-Image-image--contain", + imageCover: "ms-Image-image--cover", + imageCenterContain: "ms-Image-image--centerContain", + imageCenterCover: "ms-Image-image--centerCover", + imageNone: "ms-Image-image--none", + imageLandscape: "ms-Image-image--landscape", + imagePortrait: "ms-Image-image--portrait" + }; + var getStyles$w = function(props) { + var className2 = props.className, width2 = props.width, height2 = props.height, maximizeFrame = props.maximizeFrame, isLoaded = props.isLoaded, shouldFadeIn = props.shouldFadeIn, shouldStartVisible = props.shouldStartVisible, isLandscape = props.isLandscape, isCenter = props.isCenter, isContain = props.isContain, isCover = props.isCover, isCenterContain = props.isCenterContain, isCenterCover = props.isCenterCover, isNone = props.isNone, isError = props.isError, isNotImageFit = props.isNotImageFit, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$h, theme); + var ImageFitStyles = { + position: "absolute", + left: "50% /* @noflip */", + top: "50%", + transform: "translate(-50%,-50%)" + // @todo test RTL renders transform: translate(50%,-50%); + }; + var window2 = getWindow(); + var supportsObjectFit = window2 !== void 0 && // eslint-disable-next-line @fluentui/max-len + // cast needed as vendor prefixed `msMaxTouchPoints` api is no longer part of TS lib declaration - introduced with TS 4.4 + window2.navigator.msMaxTouchPoints === void 0; + var fallbackObjectFitStyles = isContain && isLandscape || isCover && !isLandscape ? { width: "100%", height: "auto" } : { width: "auto", height: "100%" }; + return { + root: [ + classNames2.root, + theme.fonts.medium, + { + overflow: "hidden" + }, + maximizeFrame && [ + classNames2.rootMaximizeFrame, + { + height: "100%", + width: "100%" + } + ], + isLoaded && shouldFadeIn && !shouldStartVisible && AnimationClassNames.fadeIn400, + (isCenter || isContain || isCover || isCenterContain || isCenterCover) && { + position: "relative" + }, + className2 + ], + image: [ + classNames2.image, + { + display: "block", + opacity: 0 + }, + isLoaded && [ + "is-loaded", + { + opacity: 1 + } + ], + isCenter && [classNames2.imageCenter, ImageFitStyles], + isContain && [ + classNames2.imageContain, + supportsObjectFit && { + width: "100%", + height: "100%", + objectFit: "contain" + }, + !supportsObjectFit && fallbackObjectFitStyles, + !supportsObjectFit && ImageFitStyles + ], + isCover && [ + classNames2.imageCover, + supportsObjectFit && { + width: "100%", + height: "100%", + objectFit: "cover" + }, + !supportsObjectFit && fallbackObjectFitStyles, + !supportsObjectFit && ImageFitStyles + ], + isCenterContain && [ + classNames2.imageCenterContain, + isLandscape && { + maxWidth: "100%" + }, + !isLandscape && { + maxHeight: "100%" + }, + ImageFitStyles + ], + isCenterCover && [ + classNames2.imageCenterCover, + isLandscape && { + maxHeight: "100%" + }, + !isLandscape && { + maxWidth: "100%" + }, + ImageFitStyles + ], + isNone && [ + classNames2.imageNone, + { + width: "auto", + height: "auto" + } + ], + isNotImageFit && [ + !!width2 && !height2 && { + height: "auto", + width: "100%" + }, + !width2 && !!height2 && { + height: "100%", + width: "auto" + }, + !!width2 && !!height2 && { + height: "100%", + width: "100%" + } + ], + isLandscape && classNames2.imageLandscape, + !isLandscape && classNames2.imagePortrait, + !isLoaded && "is-notLoaded", + shouldFadeIn && "is-fadeIn", + isError && "is-error" + ] }; - /** - * !!!IMPORTANT!!! Avoid mutating `item: IContextualMenuItem` argument. It will - * cause the menu items to always re-render because the component update is based on shallow comparison. - */ var renderMenuItem = function(item, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons, // eslint-disable-next-line deprecation/deprecation - menuClassNames) { - var _a; - var renderedItems = []; - var iconProps = item.iconProps || { - iconName: 'None' - }; - var getItemClassNames = item.getItemClassNames, itemProps = item.itemProps; - var styles = itemProps ? itemProps.styles : undefined; - // We only send a dividerClassName when the item to be rendered is a divider. - // For all other cases, the default divider style is used. - var dividerClassName = item.itemType === (0, _contextualMenuTypes.ContextualMenuItemType).Divider ? item.className : undefined; - var subMenuIconClassName = item.submenuIconProps ? item.submenuIconProps.className : ''; - // eslint-disable-next-line deprecation/deprecation - var itemClassNames; - // IContextualMenuItem#getItemClassNames for backwards compatibility - // otherwise uses mergeStyles for class names. - if (getItemClassNames) itemClassNames = getItemClassNames(props.theme, (0, _index.isItemDisabled)(item), expandedMenuItemKey === item.key, !!(0, _index.getIsChecked)(item), !!item.href, iconProps.iconName !== 'None', item.className, dividerClassName, iconProps.className, subMenuIconClassName, item.primaryDisabled); - else { - var itemStyleProps = { - theme: props.theme, - disabled: (0, _index.isItemDisabled)(item), - expanded: expandedMenuItemKey === item.key, - checked: !!(0, _index.getIsChecked)(item), - isAnchorLink: !!item.href, - knownIcon: iconProps.iconName !== 'None', - itemClassName: item.className, - dividerClassName: dividerClassName, - iconClassName: iconProps.className, - subMenuClassName: subMenuIconClassName, - primaryDisabled: item.primaryDisabled - }; - // We need to generate default styles then override if styles are provided - // since the ContextualMenu currently handles item classNames. - itemClassNames = getContextualMenuItemClassNames(_getMenuItemStylesFunction((_a = menuClassNames.subComponentStyles) === null || _a === void 0 ? void 0 : _a.menuItem, styles), itemStyleProps); - } - // eslint-disable-next-line deprecation/deprecation - if (item.text === '-' || item.name === '-') item.itemType = (0, _contextualMenuTypes.ContextualMenuItemType).Divider; - switch(item.itemType){ - case (0, _contextualMenuTypes.ContextualMenuItemType).Divider: - renderedItems.push(renderSeparator(index, itemClassNames)); - break; - case (0, _contextualMenuTypes.ContextualMenuItemType).Header: - renderedItems.push(renderSeparator(index, itemClassNames)); - var headerItem = renderHeaderMenuItem(item, itemClassNames, menuClassNames, index, hasCheckmarks, hasIcons); - renderedItems.push(renderListItem(headerItem, item.key || index, itemClassNames, item.title)); - break; - case (0, _contextualMenuTypes.ContextualMenuItemType).Section: - renderedItems.push(renderSectionItem(item, itemClassNames, menuClassNames, index, hasCheckmarks, hasIcons)); - break; - default: - var defaultRenderNormalItem = function() { - return renderNormalItem(item, itemClassNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons); - }; - var menuItem = props.onRenderContextualMenuItem ? props.onRenderContextualMenuItem(item, defaultRenderNormalItem) : defaultRenderNormalItem(); - renderedItems.push(renderListItem(menuItem, item.key || index, itemClassNames, item.title)); - break; - } - // Since multiple nodes *could* be rendered, wrap them all in a fragment with this item's key. - // This ensures the reconciler handles multi-item output per-node correctly and does not re-mount content. - return _react.createElement(_react.Fragment, { - key: item.key - }, renderedItems); - }; - var defaultMenuItemRenderer = function(item, // eslint-disable-next-line deprecation/deprecation - menuClassNames) { - var index = item.index, focusableElementIndex = item.focusableElementIndex, totalItemCount = item.totalItemCount, hasCheckmarks = item.hasCheckmarks, hasIcons = item.hasIcons; - return renderMenuItem(item, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons, menuClassNames); - }; - var renderSectionItem = function(sectionItem, // eslint-disable-next-line deprecation/deprecation - itemClassNames, // eslint-disable-next-line deprecation/deprecation - menuClassNames, index, hasCheckmarks, hasIcons) { - var sectionProps = sectionItem.sectionProps; - if (!sectionProps) return; - var headerItem; - var groupProps; - if (sectionProps.title) { - var headerContextualMenuItem = undefined; - var ariaLabelledby = ''; - if (typeof sectionProps.title === 'string') { - // Since title is a user-facing string, it needs to be stripped - // of whitespace in order to build a valid element ID - var id_1 = menuId + sectionProps.title.replace(/\s/g, ''); - headerContextualMenuItem = { - key: "section-".concat(sectionProps.title, "-title"), - itemType: (0, _contextualMenuTypes.ContextualMenuItemType).Header, - text: sectionProps.title, - id: id_1 - }; - ariaLabelledby = id_1; - } else { - var id_2 = sectionProps.title.id || menuId + sectionProps.title.key.replace(/\s/g, ''); - headerContextualMenuItem = (0, _tslib.__assign)((0, _tslib.__assign)({}, sectionProps.title), { - id: id_2 - }); - ariaLabelledby = id_2; - } - if (headerContextualMenuItem) { - groupProps = { - role: 'group', - 'aria-labelledby': ariaLabelledby - }; - headerItem = renderHeaderMenuItem(headerContextualMenuItem, itemClassNames, menuClassNames, index, hasCheckmarks, hasIcons); - } - } - if (sectionProps.items && sectionProps.items.length > 0) { - var correctedIndex_1 = 0; - return _react.createElement("li", { - role: "presentation", - key: sectionProps.key || sectionItem.key || "section-".concat(index) - }, _react.createElement("div", (0, _tslib.__assign)({}, groupProps), _react.createElement("ul", { - className: menuClassNames.list, - role: "presentation" - }, sectionProps.topDivider && renderSeparator(index, itemClassNames, true, true), headerItem && renderListItem(headerItem, sectionItem.key || index, itemClassNames, sectionItem.title), sectionProps.items.map(function(contextualMenuItem, itemsIndex) { - var menuItem = renderMenuItem(contextualMenuItem, itemsIndex, correctedIndex_1, getItemCount(sectionProps.items), hasCheckmarks, hasIcons, menuClassNames); - if (contextualMenuItem.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Divider && contextualMenuItem.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Header) { - var indexIncrease = contextualMenuItem.customOnRenderListLength ? contextualMenuItem.customOnRenderListLength : 1; - correctedIndex_1 += indexIncrease; - } - return menuItem; - }), sectionProps.bottomDivider && renderSeparator(index, itemClassNames, false, true)))); - } - }; - var renderListItem = function(content, key, classNames, title) { - return _react.createElement("li", { - role: "presentation", - title: title, - key: key, - className: classNames.item - }, content); - }; - var renderSeparator = function(index, classNames, top, fromSection) { - if (fromSection || index > 0) return _react.createElement("li", { - role: "separator", - key: 'separator-' + index + (top === undefined ? '' : top ? '-top' : '-bottom'), - className: classNames.divider, - "aria-hidden": "true" - }); - return null; + }; + var Image$1 = styled(ImageBase, getStyles$w, void 0, { + scope: "Image" + }, true); + Image$1.displayName = "Image"; + var classNames = mergeStyleSets({ + root: { + display: "inline-block", + textDecoration: "inherit" + }, + placeholder: [ + "ms-Icon-placeHolder", + { + width: "1em" + } + ], + image: [ + "ms-Icon-imageContainer", + { + overflow: "hidden" + } + ] + }); + var MS_ICON = "ms-Icon"; + var getStyles$v = function(props) { + var className2 = props.className, iconClassName = props.iconClassName, isPlaceholder = props.isPlaceholder, isImage = props.isImage, styles = props.styles; + return { + root: [ + isPlaceholder && classNames.placeholder, + classNames.root, + isImage && classNames.image, + iconClassName, + className2, + styles && styles.root, + // eslint-disable-next-line @typescript-eslint/no-deprecated + styles && styles.imageContainer + ] }; - var renderNormalItem = function(item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons) { - if (item.onRender) return item.onRender((0, _tslib.__assign)({ - 'aria-posinset': focusableElementIndex + 1, - 'aria-setsize': totalItemCount - }, item), dismiss); - var contextualMenuItemAs = props.contextualMenuItemAs; - var commonProps = { - item: item, - classNames: classNames, - index: index, - focusableElementIndex: focusableElementIndex, - totalItemCount: totalItemCount, - hasCheckmarks: hasCheckmarks, - hasIcons: hasIcons, - contextualMenuItemAs: contextualMenuItemAs, - onItemMouseEnter: onItemMouseEnterBase, - onItemMouseLeave: onMouseItemLeave, - onItemMouseMove: onItemMouseMoveBase, - onItemMouseDown: onItemMouseDown, - executeItemClick: executeItemClick, - onItemKeyDown: onItemKeyDown, - expandedMenuItemKey: expandedMenuItemKey, - openSubMenu: openSubMenu, - dismissSubMenu: onSubMenuDismiss, - dismissMenu: dismiss - }; - if (item.href) { - var ContextualMenuAnchorAs = (0, _index1.ContextualMenuAnchor); - if (item.contextualMenuItemWrapperAs) ContextualMenuAnchorAs = (0, _utilities.composeComponentAs)(item.contextualMenuItemWrapperAs, ContextualMenuAnchorAs); - return _react.createElement(ContextualMenuAnchorAs, (0, _tslib.__assign)({}, commonProps, { - onItemClick: onAnchorClick - })); - } - if (item.split && (0, _index.hasSubmenu)(item)) { - var ContextualMenuSplitButtonAs = (0, _index1.ContextualMenuSplitButton); - if (item.contextualMenuItemWrapperAs) ContextualMenuSplitButtonAs = (0, _utilities.composeComponentAs)(item.contextualMenuItemWrapperAs, ContextualMenuSplitButtonAs); - return _react.createElement(ContextualMenuSplitButtonAs, (0, _tslib.__assign)({}, commonProps, { - onItemClick: onItemClick, - onItemClickBase: onItemClickBase, - onTap: cancelSubMenuTimer - })); - } - var ContextualMenuButtonAs = (0, _index1.ContextualMenuButton); - if (item.contextualMenuItemWrapperAs) ContextualMenuButtonAs = (0, _utilities.composeComponentAs)(item.contextualMenuItemWrapperAs, ContextualMenuButtonAs); - return _react.createElement(ContextualMenuButtonAs, (0, _tslib.__assign)({}, commonProps, { - onItemClick: onItemClick, - onItemClickBase: onItemClickBase - })); + }; + var getIconContent = memoizeFunction( + function(iconName) { + var _a2 = getIcon(iconName) || { + subset: {}, + code: void 0 + }, code = _a2.code, subset = _a2.subset; + if (!code) { + return null; + } + return { + children: code, + iconClassName: subset.className, + fontFamily: subset.fontFace && subset.fontFace.fontFamily, + mergeImageProps: subset.mergeImageProps + }; + }, + void 0, + true + /*ignoreNullOrUndefinedResult */ + ); + var FontIcon = function(props) { + var iconName = props.iconName, className2 = props.className, _a2 = props.style, style2 = _a2 === void 0 ? {} : _a2; + var iconContent = getIconContent(iconName) || {}; + var iconClassName = iconContent.iconClassName, children2 = iconContent.children, fontFamily2 = iconContent.fontFamily, mergeImageProps = iconContent.mergeImageProps; + var nativeProps = getNativeProps(props, htmlElementProperties); + var accessibleName = props["aria-label"] || props.title; + var containerProps = props["aria-label"] || props["aria-labelledby"] || props.title ? { + role: mergeImageProps ? void 0 : "img" + } : { + "aria-hidden": true }; - var renderHeaderMenuItem = function(item, // eslint-disable-next-line deprecation/deprecation - itemClassNames, // eslint-disable-next-line deprecation/deprecation - menuClassNames, index, hasCheckmarks, hasIcons) { - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(item.contextualMenuItemAs, ChildrenRenderer); - if (props.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(props.contextualMenuItemAs, ChildrenRenderer); - var itemProps = item.itemProps, id = item.id; - var divHtmlProperties = itemProps && (0, _utilities.getNativeProps)(itemProps, (0, _utilities.divProperties)); - return(// eslint-disable-next-line deprecation/deprecation - _react.createElement("div", (0, _tslib.__assign)({ - id: id, - className: menuClassNames.header - }, divHtmlProperties, { - style: item.style - }), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - item: item, - classNames: itemClassNames, - index: index, - onCheckmarkClick: hasCheckmarks ? onItemClick : undefined, - hasIcons: hasIcons - }, itemProps)))); - }; - //#endregion - //#region Main render - var isBeakVisible = props.isBeakVisible; - var items = props.items, labelElementId = props.labelElementId, id = props.id, className = props.className, beakWidth = props.beakWidth, directionalHint = props.directionalHint, directionalHintForRTL = props.directionalHintForRTL, alignTargetEdge = props.alignTargetEdge, gapSpace = props.gapSpace, coverTarget = props.coverTarget, ariaLabel = props.ariaLabel, doNotLayer = props.doNotLayer, target = props.target, bounds = props.bounds, useTargetWidth = props.useTargetWidth, useTargetAsMinWidth = props.useTargetAsMinWidth, directionalHintFixed = props.directionalHintFixed, shouldFocusOnMount = props.shouldFocusOnMount, shouldFocusOnContainer = props.shouldFocusOnContainer, title = props.title, styles = props.styles, theme = props.theme, calloutProps = props.calloutProps, _k = props.onRenderSubMenu, onRenderSubMenu = _k === void 0 ? onDefaultRenderSubMenu : _k, _l = props.onRenderMenuList, onRenderMenuList = _l === void 0 ? function(menuListProps, defaultRender) { - return onDefaultRenderMenuList(menuListProps, classNames, defaultRender); - } : _l, focusZoneProps = props.focusZoneProps, // eslint-disable-next-line deprecation/deprecation - getMenuClassNames = props.getMenuClassNames; - var classNames = getMenuClassNames ? getMenuClassNames(theme, className) : getClassNames(styles, { - theme: theme, - className: className - }); - var hasIcons = itemsHaveIcons(items); - function itemsHaveIcons(contextualMenuItems) { - for(var _i = 0, contextualMenuItems_1 = contextualMenuItems; _i < contextualMenuItems_1.length; _i++){ - var item = contextualMenuItems_1[_i]; - if (item.iconProps) return true; - if (item.itemType === (0, _contextualMenuTypes.ContextualMenuItemType).Section && item.sectionProps && itemsHaveIcons(item.sectionProps.items)) return true; - } - return false; + var finalChildren = children2; + if (mergeImageProps) { + if (typeof children2 === "object" && typeof children2.props === "object" && accessibleName) { + finalChildren = React__namespace.cloneElement(children2, { alt: accessibleName }); + } } - var adjustedFocusZoneProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - direction: (0, _focusZone.FocusZoneDirection).vertical, - handleTabKey: (0, _focusZone.FocusZoneTabbableElements).all, - isCircularNavigation: true, - 'data-tabster': '{"uncontrolled": {}, "focusable": { "excludeFromMover": true }}' - }, focusZoneProps), { - className: (0, _utilities.css)(classNames.root, (_a = props.focusZoneProps) === null || _a === void 0 ? void 0 : _a.className) - }); - var hasCheckmarks = canAnyMenuItemsCheck(items); - var submenuProps = expandedMenuItemKey && props.hidden !== true ? getSubmenuProps() : null; - isBeakVisible = isBeakVisible === undefined ? responsiveMode <= (0, _responsiveMode.ResponsiveMode).medium : isBeakVisible; - /** - * When useTargetWidth is true, get the width of the target element and apply it for the context menu container - */ var contextMenuStyle; - var targetAsHtmlElement = targetRef.current; - if ((useTargetWidth || useTargetAsMinWidth) && targetAsHtmlElement && targetAsHtmlElement.offsetWidth) { - var targetBoundingRect = targetAsHtmlElement.getBoundingClientRect(); - var targetWidth = targetBoundingRect.width - 2; /* Accounts for 1px border */ - if (useTargetWidth) contextMenuStyle = { - width: targetWidth + return React__namespace.createElement("i", __assign$1({ "data-icon-name": iconName }, containerProps, nativeProps, mergeImageProps ? { + title: void 0, + "aria-label": void 0 + } : {}, { + className: css(MS_ICON, classNames.root, iconClassName, !iconName && classNames.placeholder, className2), + // Apply the font family this way to ensure it doesn't get overridden by Fabric Core ms-Icon styles + // https://github.com/microsoft/fluentui/issues/10449 + style: __assign$1({ fontFamily: fontFamily2 }, style2) + }), finalChildren); + }; + memoizeFunction(function(iconName, className2, ariaLabel2) { + return FontIcon({ iconName, className: className2, "aria-label": ariaLabel2 }); + }); + var getClassNames$q = classNamesFunction({ + // Icon is used a lot by other components. + // It's likely to see expected cases which pass different className to the Icon. + // Therefore setting a larger cache size. + cacheSize: 100 + }); + var IconBase = ( + /** @class */ + (function(_super) { + __extends(IconBase2, _super); + function IconBase2(props) { + var _this = _super.call(this, props) || this; + _this._onImageLoadingStateChange = function(state) { + if (_this.props.imageProps && _this.props.imageProps.onLoadingStateChange) { + _this.props.imageProps.onLoadingStateChange(state); + } + if (state === ImageLoadState.error) { + _this.setState({ imageLoadError: true }); + } }; - else if (useTargetAsMinWidth) contextMenuStyle = { - minWidth: targetWidth + _this.state = { + imageLoadError: false }; - } - // The menu should only return if items were provided, if no items were provided then it should not appear. - if (items && items.length > 0) { - var totalItemCount_1 = getItemCount(items); - var calloutStyles_1 = classNames.subComponentStyles ? classNames.subComponentStyles.callout : undefined; - return _react.createElement((0, _index2.MenuContext).Consumer, null, function(menuContext) { - return _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - styles: calloutStyles_1, - onRestoreFocus: tryFocusPreviousActiveElement - }, calloutProps, { - target: target || menuContext.target, - isBeakVisible: isBeakVisible, - beakWidth: beakWidth, - directionalHint: directionalHint, - directionalHintForRTL: directionalHintForRTL, - gapSpace: gapSpace, - coverTarget: coverTarget, - doNotLayer: doNotLayer, - className: (0, _utilities.css)('ms-ContextualMenu-Callout', calloutProps && calloutProps.className), - setInitialFocus: shouldFocusOnMount, - onDismiss: props.onDismiss || menuContext.onDismiss, - onScroll: onScroll, - bounds: bounds, - directionalHintFixed: directionalHintFixed, - alignTargetEdge: alignTargetEdge, - hidden: props.hidden || menuContext.hidden, - ref: forwardedRef - }), _react.createElement("div", { - style: contextMenuStyle, - ref: hostElement, - id: id, - className: classNames.container, - tabIndex: shouldFocusOnContainer ? 0 : -1, - onKeyDown: onMenuKeyDown, - onKeyUp: onKeyUp, - onFocusCapture: onMenuFocusCapture, - "aria-label": ariaLabel, - "aria-labelledby": labelElementId, - role: 'menu' - }, title && _react.createElement("div", { - className: classNames.title - }, " ", title, " "), items && items.length ? renderFocusZone(onRenderMenuList({ - ariaLabel: ariaLabel, - items: items, - totalItemCount: totalItemCount_1, - hasCheckmarks: hasCheckmarks, - hasIcons: hasIcons, - defaultMenuItemRenderer: function(item) { - return defaultMenuItemRenderer(item, classNames); - }, - labelElementId: labelElementId - }, function(menuListProps, defaultRender) { - return onDefaultRenderMenuList(menuListProps, classNames, defaultRender); - }), adjustedFocusZoneProps) : null, submenuProps && onRenderSubMenu(submenuProps, onDefaultRenderSubMenu)), _react.createElement((0, _utilities.FocusRects), null)); + return _this; + } + IconBase2.prototype.render = function() { + var _a2 = this.props, children2 = _a2.children, className2 = _a2.className, styles = _a2.styles, iconName = _a2.iconName, imageErrorAs = _a2.imageErrorAs, theme = _a2.theme; + var isPlaceholder = typeof iconName === "string" && iconName.length === 0; + var isImage = ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + !!this.props.imageProps || this.props.iconType === IconType.image || this.props.iconType === IconType.Image + ); + var iconContent = getIconContent(iconName) || {}; + var iconClassName = iconContent.iconClassName, iconContentChildren = iconContent.children, mergeImageProps = iconContent.mergeImageProps; + var classNames2 = getClassNames$q(styles, { + theme, + className: className2, + iconClassName, + isImage, + isPlaceholder }); - } else return null; -//#endregion -}), function(prevProps, newProps) { - if (!newProps.shouldUpdateWhenHidden && prevProps.hidden && newProps.hidden) // Do not update when hidden. - return true; - return (0, _utilities.shallowCompare)(prevProps, newProps); -}); -ContextualMenuBase.displayName = 'ContextualMenuBase'; -/** - * Returns true if the key for the event is alt (Mac option) or meta (Mac command). - */ function isAltOrMeta(ev) { - // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).alt || ev.key === 'Meta'; -} -function onItemMouseDown(item, ev) { - var _a; - (_a = item.onMouseDown) === null || _a === void 0 || _a.call(item, item, ev); -} -function onDefaultRenderSubMenu(subMenuProps, defaultRender) { - throw Error("ContextualMenuBase: onRenderSubMenu callback is null or undefined. Please ensure to set `onRenderSubMenu` property either manually or with `styled` helper."); -} -/** - * Returns the item that matches a given key if any. - * @param key - The key of the item to match - * @param items - The items to look for the key - */ function findItemByKeyFromItems(key, items) { - for(var _i = 0, items_3 = items; _i < items_3.length; _i++){ - var item = items_3[_i]; - if (item.itemType === (0, _contextualMenuTypes.ContextualMenuItemType).Section && item.sectionProps) { - var match = findItemByKeyFromItems(key, item.sectionProps.items); - if (match) return match; - } else if (item.key && item.key === key) return item; - } -} -function getOnClickWithOverrideTarget(onClick, target) { - return onClick ? function(ev, item) { - overrideTarget(ev, target); - return onClick(ev, item); - } : onClick; -} -function overrideTarget(ev, target) { - if (ev && target) { - ev.persist(); - if (target instanceof Event) ev.target = target.target; - else if (target instanceof Element) ev.target = target; - } -} - -},{"tslib":"9gizs","react":"jGrId","./ContextualMenu.types":"akDeV","../../common/DirectionalHint":"avdAc","../../FocusZone":"k9nPH","../../Utilities":"1NZCy","../../utilities/contextualMenu/index":"lGesq","../../Callout":"g2jXk","./ContextualMenuItem":"cJR9f","./ContextualMenuItemWrapper/index":"lIK0C","../../Styling":"hTimn","./ContextualMenu.classNames":"bg3cO","@fluentui/react-hooks":"2LHjM","../../ResponsiveMode":"cFpqz","../../utilities/MenuContext/index":"l3bQw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"akDeV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DirectionalHint", ()=>(0, _directionalHint.DirectionalHint)); -parcelHelpers.export(exports, "ContextualMenuItemType", ()=>ContextualMenuItemType); -var _directionalHint = require("../../common/DirectionalHint"); -var ContextualMenuItemType; -(function(ContextualMenuItemType) { - ContextualMenuItemType[ContextualMenuItemType["Normal"] = 0] = "Normal"; - ContextualMenuItemType[ContextualMenuItemType["Divider"] = 1] = "Divider"; - ContextualMenuItemType[ContextualMenuItemType["Header"] = 2] = "Header"; - ContextualMenuItemType[ContextualMenuItemType["Section"] = 3] = "Section"; -})(ContextualMenuItemType || (ContextualMenuItemType = {})); - -},{"../../common/DirectionalHint":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k9nPH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusZone", ()=>(0, _reactFocus.FocusZone)); -parcelHelpers.export(exports, "FocusZoneDirection", ()=>(0, _reactFocus.FocusZoneDirection)); -parcelHelpers.export(exports, "FocusZoneTabbableElements", ()=>(0, _reactFocus.FocusZoneTabbableElements)); -var _reactFocus = require("@fluentui/react-focus"); - -},{"@fluentui/react-focus":"5Zqef","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Zqef":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _version = require("./version"); -var _index = require("./components/FocusZone/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./version":"8AjcD","./components/FocusZone/index":"6Mjnc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8AjcD":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react-focus', '8.9.19'); - -},{"@fluentui/set-version":"iqYXf"}],"6Mjnc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _focusZone = require("./FocusZone"); -parcelHelpers.exportAll(_focusZone, exports); -var _focusZoneTypes = require("./FocusZone.types"); -parcelHelpers.exportAll(_focusZoneTypes, exports); - -},{"./FocusZone":"38RzR","./FocusZone.types":"hsbYN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"38RzR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusZone", ()=>FocusZone); -var _tslib = require("tslib"); -var _react = require("react"); -var _focusZoneTypes = require("./FocusZone.types"); -var _utilities = require("@fluentui/utilities"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _styleUtilities = require("@fluentui/style-utilities"); -var IS_FOCUSABLE_ATTRIBUTE = 'data-is-focusable'; -var IS_ENTER_DISABLED_ATTRIBUTE = 'data-disable-click-on-enter'; -var FOCUSZONE_ID_ATTRIBUTE = 'data-focuszone-id'; -var TABINDEX = 'tabindex'; -var NO_VERTICAL_WRAP = 'data-no-vertical-wrap'; -var NO_HORIZONTAL_WRAP = 'data-no-horizontal-wrap'; -var LARGE_DISTANCE_FROM_CENTER = 999999999; -var LARGE_NEGATIVE_DISTANCE_FROM_CENTER = -999999999; -var focusZoneStyles; -var focusZoneClass = 'ms-FocusZone'; -/** - * Raises a click on a target element based on a keyboard event. - */ function raiseClickFromKeyboardEvent(target, ev) { - var event; - if (typeof MouseEvent === 'function') event = new MouseEvent('click', { + var RootType = isImage ? "span" : "i"; + var nativeProps = getNativeProps(this.props, htmlElementProperties, [ + "aria-label" + ]); + var imageLoadError = this.state.imageLoadError; + var imageProps = __assign$1(__assign$1({}, this.props.imageProps), { onLoadingStateChange: this._onImageLoadingStateChange }); + var ImageType = imageLoadError && imageErrorAs || Image$1; + var ariaLabel2 = this.props["aria-label"] || this.props.ariaLabel; + var accessibleName = imageProps.alt || ariaLabel2 || this.props.title; + var hasName = !!(accessibleName || this.props["aria-labelledby"] || imageProps["aria-label"] || imageProps["aria-labelledby"]); + var containerProps = hasName ? { + role: isImage || mergeImageProps ? void 0 : "img", + "aria-label": isImage || mergeImageProps ? void 0 : accessibleName + } : { + "aria-hidden": true + }; + var finalIconContentChildren = iconContentChildren; + if (mergeImageProps && iconContentChildren && typeof iconContentChildren === "object" && accessibleName) { + finalIconContentChildren = React__namespace.cloneElement(iconContentChildren, { + alt: accessibleName + }); + } + return React__namespace.createElement(RootType, __assign$1({ "data-icon-name": iconName }, containerProps, nativeProps, mergeImageProps ? { + title: void 0, + "aria-label": void 0 + } : {}, { className: classNames2.root }), isImage ? React__namespace.createElement(ImageType, __assign$1({}, imageProps)) : children2 || finalIconContentChildren); + }; + return IconBase2; + })(React__namespace.Component) + ); + var Icon = styled(IconBase, getStyles$v, void 0, { + scope: "Icon" + }, true); + Icon.displayName = "Icon"; + var ImageIcon = function(props) { + var className2 = props.className, imageProps = props.imageProps; + var nativeProps = getNativeProps(props, htmlElementProperties, [ + "aria-label", + "aria-labelledby", + "title", + "aria-describedby" + ]); + var altText = imageProps.alt || props["aria-label"]; + var hasName = altText || props["aria-labelledby"] || props.title || imageProps["aria-label"] || imageProps["aria-labelledby"] || imageProps.title; + var imageNameProps = { + "aria-labelledby": props["aria-labelledby"], + "aria-describedby": props["aria-describedby"], + title: props.title + }; + var containerProps = hasName ? {} : { + "aria-hidden": true + }; + return React__namespace.createElement( + "div", + __assign$1({}, containerProps, nativeProps, { className: css(MS_ICON, classNames.root, classNames.image, className2) }), + React__namespace.createElement(Image$1, __assign$1({}, imageNameProps, imageProps, { alt: hasName ? altText : "" })) + ); + }; + var DirectionalHint = { + /** + * Appear above the target element, with the left edges of the callout and target aligning. + */ + topLeftEdge: 0, + /** + * Appear above the target element, with the centers of the callout and target aligning. + */ + topCenter: 1, + /** + * Appear above the target element, with the right edges of the callout and target aligning. + */ + topRightEdge: 2, + /** + * Appear above the target element, aligning with the target element such that the callout tends toward + * the center of the screen. + */ + topAutoEdge: 3, + /** + * Appear below the target element, with the left edges of the callout and target aligning. + */ + bottomLeftEdge: 4, + /** + * Appear below the target element, with the centers of the callout and target aligning. + */ + bottomCenter: 5, + /** + * Appear below the target element, with the right edges of the callout and target aligning. + */ + bottomRightEdge: 6, + /** + * Appear below the target element, aligning with the target element such that the callout tends toward + * the center of the screen. + */ + bottomAutoEdge: 7, + /** + * Appear to the left of the target element, with the top edges of the callout and target aligning. + */ + leftTopEdge: 8, + /** + * Appear to the left of the target element, with the centers of the callout and target aligning. + */ + leftCenter: 9, + /** + * Appear to the left of the target element, with the bottom edges of the callout and target aligning. + */ + leftBottomEdge: 10, + /** + * Appear to the right of the target element, with the top edges of the callout and target aligning. + */ + rightTopEdge: 11, + /** + * Appear to the right of the target element, with the centers of the callout and target aligning. + */ + rightCenter: 12, + /** + * Appear to the right of the target element, with the bottom edges of the callout and target aligning. + */ + rightBottomEdge: 13 + }; + var ContextualMenuItemType; + (function(ContextualMenuItemType2) { + ContextualMenuItemType2[ContextualMenuItemType2["Normal"] = 0] = "Normal"; + ContextualMenuItemType2[ContextualMenuItemType2["Divider"] = 1] = "Divider"; + ContextualMenuItemType2[ContextualMenuItemType2["Header"] = 2] = "Header"; + ContextualMenuItemType2[ContextualMenuItemType2["Section"] = 3] = "Section"; + })(ContextualMenuItemType || (ContextualMenuItemType = {})); + var FocusZoneTabbableElements = { + /** All tabbing action is allowed */ + all: 1, + /** Tabbing is allowed only on input elements */ + inputOnly: 2 + }; + var FocusZoneDirection; + (function(FocusZoneDirection2) { + FocusZoneDirection2[FocusZoneDirection2["vertical"] = 0] = "vertical"; + FocusZoneDirection2[FocusZoneDirection2["horizontal"] = 1] = "horizontal"; + FocusZoneDirection2[FocusZoneDirection2["bidirectional"] = 2] = "bidirectional"; + FocusZoneDirection2[FocusZoneDirection2["domOrder"] = 3] = "domOrder"; + })(FocusZoneDirection || (FocusZoneDirection = {})); + var IS_FOCUSABLE_ATTRIBUTE = "data-is-focusable"; + var IS_ENTER_DISABLED_ATTRIBUTE = "data-disable-click-on-enter"; + var FOCUSZONE_ID_ATTRIBUTE = "data-focuszone-id"; + var TABINDEX = "tabindex"; + var NO_VERTICAL_WRAP = "data-no-vertical-wrap"; + var NO_HORIZONTAL_WRAP = "data-no-horizontal-wrap"; + var LARGE_DISTANCE_FROM_CENTER = 999999999; + var LARGE_NEGATIVE_DISTANCE_FROM_CENTER = -999999999; + var focusZoneStyles; + var focusZoneClass = "ms-FocusZone"; + function raiseClickFromKeyboardEvent(target2, ev) { + var event2; + if (typeof MouseEvent === "function") { + event2 = new MouseEvent("click", { ctrlKey: ev === null || ev === void 0 ? void 0 : ev.ctrlKey, metaKey: ev === null || ev === void 0 ? void 0 : ev.metaKey, shiftKey: ev === null || ev === void 0 ? void 0 : ev.shiftKey, altKey: ev === null || ev === void 0 ? void 0 : ev.altKey, bubbles: ev === null || ev === void 0 ? void 0 : ev.bubbles, cancelable: ev === null || ev === void 0 ? void 0 : ev.cancelable - }); - else { + }); + } else { + event2 = document.createEvent("MouseEvents"); + event2.initMouseEvent( + "click", + ev ? ev.bubbles : false, + ev ? ev.cancelable : false, // eslint-disable-next-line no-restricted-globals - event = document.createEvent('MouseEvents'); - // eslint-disable-next-line deprecation/deprecation - event.initMouseEvent('click', ev ? ev.bubbles : false, ev ? ev.cancelable : false, // eslint-disable-next-line no-restricted-globals - window, 0, 0, 0, 0, 0, ev ? ev.ctrlKey : false, ev ? ev.altKey : false, ev ? ev.shiftKey : false, ev ? ev.metaKey : false, 0, null); - } - target.dispatchEvent(event); -} -// Helper function that will return a class for when the root is focused -function getRootClass() { - if (!focusZoneStyles) focusZoneStyles = (0, _mergeStyles.mergeStyles)({ + window, + // not using getWindow() since this can only be run client side + 0, + // detail + 0, + // screen x + 0, + // screen y + 0, + // client x + 0, + // client y + ev ? ev.ctrlKey : false, + ev ? ev.altKey : false, + ev ? ev.shiftKey : false, + ev ? ev.metaKey : false, + 0, + // button + null + ); + } + target2.dispatchEvent(event2); + } + function getRootClass() { + if (!focusZoneStyles) { + focusZoneStyles = mergeStyles({ selectors: { - ':focus': { - outline: 'none' - } + ":focus": { + outline: "none" + } } - }, focusZoneClass); + }, focusZoneClass); + } return focusZoneStyles; -} -var _allInstances = {}; -var _outerZones = new Set(); -var ALLOWED_INPUT_TYPES = [ - 'text', - 'number', - 'password', - 'email', - 'tel', - 'url', - 'search', - 'textarea' -]; -var ALLOW_VIRTUAL_ELEMENTS = false; -var FocusZone = /** @class */ function(_super) { - (0, _tslib.__extends)(FocusZone, _super); - function FocusZone(props) { - var _a, _b, _c, _d; + } + var _allInstances = {}; + var _outerZones = /* @__PURE__ */ new Set(); + var ALLOWED_INPUT_TYPES = ["text", "number", "password", "email", "tel", "url", "search", "textarea"]; + var ALLOW_VIRTUAL_ELEMENTS = false; + var FocusZone = ( + /** @class */ + (function(_super) { + __extends(FocusZone2, _super); + function FocusZone2(props) { + var _a2, _b2, _c2, _d2; var _this = _super.call(this, props) || this; - _this._root = _react.createRef(); - _this._mergedRef = (0, _utilities.createMergedRef)(); + _this._root = React__namespace.createRef(); + _this._mergedRef = createMergedRef(); _this._onFocus = function(ev) { - if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. + if (_this._portalContainsElement(ev.target)) { return; - var _a = _this.props, onActiveElementChanged = _a.onActiveElementChanged, // eslint-disable-next-line deprecation/deprecation - doNotAllowFocusEventToPropagate = _a.doNotAllowFocusEventToPropagate, stopFocusPropagation = _a.stopFocusPropagation, // eslint-disable-next-line deprecation/deprecation - onFocusNotification = _a.onFocusNotification, onFocus = _a.onFocus, shouldFocusInnerElementWhenReceivedFocus = _a.shouldFocusInnerElementWhenReceivedFocus, defaultTabbableElement = _a.defaultTabbableElement; - var isImmediateDescendant = _this._isImmediateDescendantOfZone(ev.target); - var newActiveElement; - if (isImmediateDescendant) newActiveElement = ev.target; - else { - var parentElement = ev.target; - while(parentElement && parentElement !== _this._root.current){ - if ((0, _utilities.isElementTabbable)(parentElement, undefined, _this._inShadowRoot) && _this._isImmediateDescendantOfZone(parentElement)) { - newActiveElement = parentElement; - break; - } - parentElement = (0, _utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS); - } - } - // If an inner focusable element should be focused when FocusZone container receives focus - if (shouldFocusInnerElementWhenReceivedFocus && ev.target === _this._root.current) { - var maybeElementToFocus = defaultTabbableElement && typeof defaultTabbableElement === 'function' && _this._root.current && defaultTabbableElement(_this._root.current); - // try to focus defaultTabbable element - if (maybeElementToFocus && (0, _utilities.isElementTabbable)(maybeElementToFocus, undefined, _this._inShadowRoot)) { - newActiveElement = maybeElementToFocus; - maybeElementToFocus.focus(); - } else { - // force focus on first focusable element - _this.focus(true); - if (_this._activeElement) // set to null as new active element was handled in method above - newActiveElement = null; - } - } - var initialElementFocused = !_this._activeElement; - // If the new active element is a child of this zone and received focus, - // update alignment an immediate descendant - if (newActiveElement && newActiveElement !== _this._activeElement) { - if (isImmediateDescendant || initialElementFocused) _this._setFocusAlignment(newActiveElement, true, true); - _this._activeElement = newActiveElement; - if (initialElementFocused) _this._updateTabIndexes(); - } - if (onActiveElementChanged) onActiveElementChanged(_this._activeElement, ev); - if (stopFocusPropagation || doNotAllowFocusEventToPropagate) ev.stopPropagation(); - if (onFocus) onFocus(ev); - else if (onFocusNotification) onFocusNotification(); + } + var _a22 = _this.props, onActiveElementChanged = _a22.onActiveElementChanged, doNotAllowFocusEventToPropagate = _a22.doNotAllowFocusEventToPropagate, stopFocusPropagation = _a22.stopFocusPropagation, onFocusNotification = _a22.onFocusNotification, onFocus = _a22.onFocus, shouldFocusInnerElementWhenReceivedFocus = _a22.shouldFocusInnerElementWhenReceivedFocus, defaultTabbableElement = _a22.defaultTabbableElement; + var isImmediateDescendant = _this._isImmediateDescendantOfZone(ev.target); + var newActiveElement; + if (isImmediateDescendant) { + newActiveElement = ev.target; + } else { + var parentElement = ev.target; + while (parentElement && parentElement !== _this._root.current) { + if (isElementTabbable(parentElement, void 0, _this._inShadowRoot) && _this._isImmediateDescendantOfZone(parentElement)) { + newActiveElement = parentElement; + break; + } + parentElement = getParent(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + } + if (shouldFocusInnerElementWhenReceivedFocus && ev.target === _this._root.current) { + var maybeElementToFocus = defaultTabbableElement && typeof defaultTabbableElement === "function" && _this._root.current && defaultTabbableElement(_this._root.current); + if (maybeElementToFocus && isElementTabbable(maybeElementToFocus, void 0, _this._inShadowRoot)) { + newActiveElement = maybeElementToFocus; + maybeElementToFocus.focus(); + } else { + _this.focus(true); + if (_this._activeElement) { + newActiveElement = null; + } + } + } + var initialElementFocused = !_this._activeElement; + if (newActiveElement && newActiveElement !== _this._activeElement) { + if (isImmediateDescendant || initialElementFocused) { + _this._setFocusAlignment(newActiveElement, true, true); + } + _this._activeElement = newActiveElement; + if (initialElementFocused) { + _this._updateTabIndexes(); + } + } + if (onActiveElementChanged) { + onActiveElementChanged(_this._activeElement, ev); + } + if (stopFocusPropagation || doNotAllowFocusEventToPropagate) { + ev.stopPropagation(); + } + if (onFocus) { + onFocus(ev); + } else if (onFocusNotification) { + onFocusNotification(); + } }; _this._onBlur = function() { - _this._setParkedFocus(false); + _this._setParkedFocus(false); }; _this._onMouseDown = function(ev) { - if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. + if (_this._portalContainsElement(ev.target)) { return; - var disabled = _this.props.disabled; - if (disabled) return; - var target = ev.target; - var path = []; - while(target && target !== _this._root.current){ - path.push(target); - target = (0, _utilities.getParent)(target, ALLOW_VIRTUAL_ELEMENTS); - } - while(path.length){ - target = path.pop(); - if (target && (0, _utilities.isElementTabbable)(target, undefined, _this._inShadowRoot)) _this._setActiveElement(target, true); - if ((0, _utilities.isElementFocusZone)(target)) break; - } - }; - /** - * Handle the keystrokes. - */ _this._onKeyDown = function(ev, theme) { - if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. + } + var disabled = _this.props.disabled; + if (disabled) { return; - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, direction = _a.direction, disabled = _a.disabled, isInnerZoneKeystroke = _a.isInnerZoneKeystroke, pagingSupportDisabled = _a.pagingSupportDisabled, shouldEnterInnerZone = _a.shouldEnterInnerZone; - if (disabled) return; - if (_this.props.onKeyDown) _this.props.onKeyDown(ev); - // If the default has been prevented, do not process keyboard events. - if (ev.isDefaultPrevented()) return; - if (_this._getDocument().activeElement === _this._root.current && _this._isInnerZone) // If this element has focus, it is being controlled by a parent. - // Ignore the keystroke. + } + var target2 = ev.target; + var path2 = []; + while (target2 && target2 !== _this._root.current) { + path2.push(target2); + target2 = getParent(target2, ALLOW_VIRTUAL_ELEMENTS); + } + while (path2.length) { + target2 = path2.pop(); + if (target2 && isElementTabbable(target2, void 0, _this._inShadowRoot)) { + _this._setActiveElement(target2, true); + } + if (isElementFocusZone(target2)) { + break; + } + } + }; + _this._onKeyDown = function(ev, theme) { + if (_this._portalContainsElement(ev.target)) { return; - if ((shouldEnterInnerZone && shouldEnterInnerZone(ev) || isInnerZoneKeystroke && isInnerZoneKeystroke(ev)) && _this._isImmediateDescendantOfZone(ev.target)) { - // Try to focus - var innerZone = _this._getFirstInnerZone(); - if (innerZone) { - if (!innerZone.focus(true)) return; - } else if ((0, _utilities.isElementFocusSubZone)(ev.target)) { - if (!_this.focusElement((0, _utilities.getNextElement)(ev.target, ev.target.firstChild, true))) return; - } else return; - } else if (ev.altKey) return; - else // eslint-disable-next-line @fluentui/deprecated-keyboard-event-props, deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).space: - if (_this._shouldRaiseClicksOnSpace && _this._tryInvokeClickForFocusable(ev.target, ev)) break; - return; - case (0, _utilities.KeyCodes).left: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusLeft(theme)) break; - } - return; - case (0, _utilities.KeyCodes).right: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusRight(theme)) break; - } - return; - case (0, _utilities.KeyCodes).up: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).horizontal) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusUp()) break; - } - return; - case (0, _utilities.KeyCodes).down: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).horizontal) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusDown()) break; - } - return; - case (0, _utilities.KeyCodes).pageDown: - if (!pagingSupportDisabled && _this._moveFocusPaging(true)) break; - return; - case (0, _utilities.KeyCodes).pageUp: - if (!pagingSupportDisabled && _this._moveFocusPaging(false)) break; - return; - case (0, _utilities.KeyCodes).tab: - if (// eslint-disable-next-line deprecation/deprecation - _this.props.allowTabKey || _this.props.handleTabKey === (0, _focusZoneTypes.FocusZoneTabbableElements).all || _this.props.handleTabKey === (0, _focusZoneTypes.FocusZoneTabbableElements).inputOnly && _this._isElementInput(ev.target)) { - var focusChanged = false; - _this._processingTabKey = true; - if (direction === (0, _focusZoneTypes.FocusZoneDirection).vertical || !_this._shouldWrapFocus(_this._activeElement, NO_HORIZONTAL_WRAP)) focusChanged = ev.shiftKey ? _this._moveFocusUp() : _this._moveFocusDown(); - else { - var tabWithDirection = (0, _utilities.getRTL)(theme) ? !ev.shiftKey : ev.shiftKey; - focusChanged = tabWithDirection ? _this._moveFocusLeft(theme) : _this._moveFocusRight(theme); - } - _this._processingTabKey = false; - if (focusChanged) break; - else if (_this.props.shouldResetActiveElementWhenTabFromZone) _this._activeElement = null; - } - return; - case (0, _utilities.KeyCodes).home: - if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, false)) return false; - var firstChild = _this._root.current && _this._root.current.firstChild; - if (_this._root.current && firstChild && _this.focusElement((0, _utilities.getNextElement)(_this._root.current, firstChild, true))) break; - return; - case (0, _utilities.KeyCodes).end: - if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, true)) return false; - var lastChild = _this._root.current && _this._root.current.lastChild; - if (_this._root.current && _this.focusElement((0, _utilities.getPreviousElement)(_this._root.current, lastChild, true, true, true))) break; - return; - case (0, _utilities.KeyCodes).enter: - if (_this._shouldRaiseClicksOnEnter && _this._tryInvokeClickForFocusable(ev.target, ev)) break; - return; - default: - return; + } + var _a22 = _this.props, direction = _a22.direction, disabled = _a22.disabled, isInnerZoneKeystroke = _a22.isInnerZoneKeystroke, pagingSupportDisabled = _a22.pagingSupportDisabled, shouldEnterInnerZone = _a22.shouldEnterInnerZone; + if (disabled) { + return; + } + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + } + if (ev.isDefaultPrevented()) { + return; + } + if (_this._getDocument().activeElement === _this._root.current && _this._isInnerZone) { + return; + } + if ((shouldEnterInnerZone && shouldEnterInnerZone(ev) || isInnerZoneKeystroke && isInnerZoneKeystroke(ev)) && _this._isImmediateDescendantOfZone(ev.target)) { + var innerZone = _this._getFirstInnerZone(); + if (innerZone) { + if (!innerZone.focus(true)) { + return; + } + } else if (isElementFocusSubZone(ev.target)) { + if (!_this.focusElement(getNextElement(ev.target, ev.target.firstChild, true))) { + return; + } + } else { + return; } - ev.preventDefault(); - ev.stopPropagation(); - }; - _this._getHorizontalDistanceFromCenter = function(isForward, // eslint-disable-next-line deprecation/deprecation - activeRect, // eslint-disable-next-line deprecation/deprecation - targetRect) { - // eslint-disable-next-line deprecation/deprecation - var leftAlignment = _this._focusAlignment.left || _this._focusAlignment.x || 0; - // ClientRect values can be floats that differ by very small fractions of a decimal. - // If the difference between top and bottom are within a pixel then we should treat - // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent, - // but without Math.Floor they will be handled incorrectly. - var targetRectTop = Math.floor(targetRect.top); - var activeRectBottom = Math.floor(activeRect.bottom); - var targetRectBottom = Math.floor(targetRect.bottom); - var activeRectTop = Math.floor(activeRect.top); - var isValidCandidateOnpagingDown = isForward && targetRectTop > activeRectBottom; - var isValidCandidateOnpagingUp = !isForward && targetRectBottom < activeRectTop; - if (isValidCandidateOnpagingDown || isValidCandidateOnpagingUp) { - if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) return 0; - return Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } else if (ev.altKey) { + return; + } else { + switch (ev.which) { + case KeyCodes.space: + if (_this._shouldRaiseClicksOnSpace && _this._tryInvokeClickForFocusable(ev.target, ev)) { + break; + } + return; + case KeyCodes.left: + if (direction !== FocusZoneDirection.vertical) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusLeft(theme)) { + break; + } + } + return; + case KeyCodes.right: + if (direction !== FocusZoneDirection.vertical) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusRight(theme)) { + break; + } + } + return; + case KeyCodes.up: + if (direction !== FocusZoneDirection.horizontal) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusUp()) { + break; + } + } + return; + case KeyCodes.down: + if (direction !== FocusZoneDirection.horizontal) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusDown()) { + break; + } + } + return; + case KeyCodes.pageDown: + if (!pagingSupportDisabled && _this._moveFocusPaging(true)) { + break; + } + return; + case KeyCodes.pageUp: + if (!pagingSupportDisabled && _this._moveFocusPaging(false)) { + break; + } + return; + case KeyCodes.tab: + if ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + _this.props.allowTabKey || _this.props.handleTabKey === FocusZoneTabbableElements.all || _this.props.handleTabKey === FocusZoneTabbableElements.inputOnly && _this._isElementInput(ev.target) + ) { + var focusChanged = false; + _this._processingTabKey = true; + if (direction === FocusZoneDirection.vertical || !_this._shouldWrapFocus(_this._activeElement, NO_HORIZONTAL_WRAP)) { + focusChanged = ev.shiftKey ? _this._moveFocusUp() : _this._moveFocusDown(); + } else { + var tabWithDirection = getRTL(theme) ? !ev.shiftKey : ev.shiftKey; + focusChanged = tabWithDirection ? _this._moveFocusLeft(theme) : _this._moveFocusRight(theme); + } + _this._processingTabKey = false; + if (focusChanged) { + break; + } else if (_this.props.shouldResetActiveElementWhenTabFromZone) { + _this._activeElement = null; + } + } + return; + case KeyCodes.home: + if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, false)) { + return false; + } + var firstChild = _this._root.current && _this._root.current.firstChild; + if (_this._root.current && firstChild && _this.focusElement(getNextElement(_this._root.current, firstChild, true))) { + break; + } + return; + case KeyCodes.end: + if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, true)) { + return false; + } + var lastChild = _this._root.current && _this._root.current.lastChild; + if (_this._root.current && _this.focusElement(getPreviousElement(_this._root.current, lastChild, true, true, true))) { + break; + } + return; + case KeyCodes.enter: + if (_this._shouldRaiseClicksOnEnter && _this._tryInvokeClickForFocusable(ev.target, ev)) { + break; + } + return; + default: + return; } - if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return LARGE_DISTANCE_FROM_CENTER; - }; - // Manage componentRef resolution. - (0, _utilities.initializeComponentRef)(_this); - _this._id = (0, _utilities.getId)('FocusZone'); + } + ev.preventDefault(); + ev.stopPropagation(); + }; + _this._getHorizontalDistanceFromCenter = function(isForward, activeRect, targetRect) { + var leftAlignment = _this._focusAlignment.left || _this._focusAlignment.x || 0; + var targetRectTop = Math.floor(targetRect.top); + var activeRectBottom = Math.floor(activeRect.bottom); + var targetRectBottom = Math.floor(targetRect.bottom); + var activeRectTop = Math.floor(activeRect.top); + var isValidCandidateOnpagingDown = isForward && targetRectTop > activeRectBottom; + var isValidCandidateOnpagingUp = !isForward && targetRectBottom < activeRectTop; + if (isValidCandidateOnpagingDown || isValidCandidateOnpagingUp) { + if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) { + return 0; + } + return Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } + if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) { + return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return LARGE_DISTANCE_FROM_CENTER; + }; + initializeComponentRef(_this); + _this._id = getId("FocusZone"); _this._focusAlignment = { - left: 0, - top: 0 + left: 0, + top: 0 }; _this._processingTabKey = false; - var shouldRaiseClicksFallback = (_b = (_a = props.shouldRaiseClicks) !== null && _a !== void 0 ? _a : FocusZone.defaultProps.shouldRaiseClicks) !== null && _b !== void 0 ? _b : true; - _this._shouldRaiseClicksOnEnter = (_c = props.shouldRaiseClicksOnEnter) !== null && _c !== void 0 ? _c : shouldRaiseClicksFallback; - _this._shouldRaiseClicksOnSpace = (_d = props.shouldRaiseClicksOnSpace) !== null && _d !== void 0 ? _d : shouldRaiseClicksFallback; + var shouldRaiseClicksFallback = (_b2 = (_a2 = props.shouldRaiseClicks) !== null && _a2 !== void 0 ? _a2 : FocusZone2.defaultProps.shouldRaiseClicks) !== null && _b2 !== void 0 ? _b2 : true; + _this._shouldRaiseClicksOnEnter = (_c2 = props.shouldRaiseClicksOnEnter) !== null && _c2 !== void 0 ? _c2 : shouldRaiseClicksFallback; + _this._shouldRaiseClicksOnSpace = (_d2 = props.shouldRaiseClicksOnSpace) !== null && _d2 !== void 0 ? _d2 : shouldRaiseClicksFallback; return _this; - } - /** Used for testing purposes only. */ FocusZone.getOuterZones = function() { + } + FocusZone2.getOuterZones = function() { return _outerZones.size; - }; - /** - * Handle global tab presses so that we can patch tabindexes on the fly. - * HEADS UP: This must not be an arrow function in order to be referentially equal among instances - * for ref counting to work correctly! - */ FocusZone._onKeyDownCapture = function(ev) { - // eslint-disable-next-line deprecation/deprecation, @fluentui/deprecated-keyboard-event-props - if (ev.which === (0, _utilities.KeyCodes).tab) _outerZones.forEach(function(zone) { + }; + FocusZone2._onKeyDownCapture = function(ev) { + if (ev.which === KeyCodes.tab) { + _outerZones.forEach(function(zone) { return zone._updateTabIndexes(); - }); - }; - FocusZone.prototype.componentDidMount = function() { - var _a; + }); + } + }; + FocusZone2.prototype.componentDidMount = function() { + var _a2; var root = this._root.current; - this._inShadowRoot = !!((_a = this.context) === null || _a === void 0 ? void 0 : _a.shadowRoot); + this._inShadowRoot = !!((_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.shadowRoot); _allInstances[this._id] = this; if (root) { - var parentElement = (0, _utilities.getParent)(root, ALLOW_VIRTUAL_ELEMENTS); - while(parentElement && parentElement !== this._getDocument().body && parentElement.nodeType === 1){ - if ((0, _utilities.isElementFocusZone)(parentElement)) { - this._isInnerZone = true; - break; - } - parentElement = (0, _utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS); - } - if (!this._isInnerZone) { - _outerZones.add(this); - this._root.current && this._root.current.addEventListener('keydown', FocusZone._onKeyDownCapture, true); - } - this._root.current && this._root.current.addEventListener('blur', this._onBlur, true); - // Assign initial tab indexes so that we can set initial focus as appropriate. - this._updateTabIndexes(); - if (this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === 'string') this._activeElement = this._getDocument().querySelector(this.props.defaultTabbableElement); - else if (this.props.defaultActiveElement) // eslint-disable-next-line deprecation/deprecation + var parentElement = getParent(root, ALLOW_VIRTUAL_ELEMENTS); + while (parentElement && parentElement !== this._getDocument().body && parentElement.nodeType === 1) { + if (isElementFocusZone(parentElement)) { + this._isInnerZone = true; + break; + } + parentElement = getParent(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + if (!this._isInnerZone) { + _outerZones.add(this); + this._root.current && this._root.current.addEventListener("keydown", FocusZone2._onKeyDownCapture, true); + } + this._root.current && this._root.current.addEventListener("blur", this._onBlur, true); + this._updateTabIndexes(); + if (this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === "string") { + this._activeElement = this._getDocument().querySelector(this.props.defaultTabbableElement); + } else if (this.props.defaultActiveElement) { this._activeElement = this._getDocument().querySelector(this.props.defaultActiveElement); - if (this.props.shouldFocusOnMount) this.focus(); + } + if (this.props.shouldFocusOnMount) { + this.focus(); + } } - }; - FocusZone.prototype.componentDidUpdate = function() { - var _a; + }; + FocusZone2.prototype.componentDidUpdate = function() { + var _a2; var root = this._root.current; var doc = this._getDocument(); - this._inShadowRoot = !!((_a = this.context) === null || _a === void 0 ? void 0 : _a.shadowRoot); - // If either _activeElement or _defaultFocusElement are no longer contained by _root, - // reset those variables (and update tab indexes) to avoid memory leaks - if (this._activeElement && !(0, _utilities.elementContains)(this._root.current, this._activeElement, ALLOW_VIRTUAL_ELEMENTS) || this._defaultFocusElement && !(0, _utilities.elementContains)(this._root.current, this._defaultFocusElement, ALLOW_VIRTUAL_ELEMENTS)) { - this._activeElement = null; - this._defaultFocusElement = null; - this._updateTabIndexes(); + this._inShadowRoot = !!((_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.shadowRoot); + if (this._activeElement && !elementContains(this._root.current, this._activeElement, ALLOW_VIRTUAL_ELEMENTS) || this._defaultFocusElement && !elementContains(this._root.current, this._defaultFocusElement, ALLOW_VIRTUAL_ELEMENTS)) { + this._activeElement = null; + this._defaultFocusElement = null; + this._updateTabIndexes(); } if (!this.props.preventFocusRestoration && doc && this._lastIndexPath && (doc.activeElement === doc.body || doc.activeElement === null || doc.activeElement === root)) { - // The element has been removed after the render, attempt to restore focus. - var elementToFocus = (0, _utilities.getFocusableByIndexPath)(root, this._lastIndexPath); - if (elementToFocus) { - this._setActiveElement(elementToFocus, true); - elementToFocus.focus(); - this._setParkedFocus(false); - } else // We had a focus path to restore, but now that path is unresolvable. Park focus - // on the container until we can try again. + var elementToFocus = getFocusableByIndexPath(root, this._lastIndexPath); + if (elementToFocus) { + this._setActiveElement(elementToFocus, true); + elementToFocus.focus(); + this._setParkedFocus(false); + } else { this._setParkedFocus(true); + } } - }; - FocusZone.prototype.componentWillUnmount = function() { + }; + FocusZone2.prototype.componentWillUnmount = function() { delete _allInstances[this._id]; if (!this._isInnerZone) { - _outerZones.delete(this); - this._root.current && this._root.current.removeEventListener('keydown', FocusZone._onKeyDownCapture, true); + _outerZones.delete(this); + this._root.current && this._root.current.removeEventListener("keydown", FocusZone2._onKeyDownCapture, true); + } + if (this._root.current) { + this._root.current.removeEventListener("blur", this._onBlur, true); } - if (this._root.current) this._root.current.removeEventListener('blur', this._onBlur, true); this._activeElement = null; this._defaultFocusElement = null; - }; - FocusZone.prototype.render = function() { + }; + FocusZone2.prototype.render = function() { var _this = this; - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, tag = _a.as, elementType = _a.elementType, rootProps = _a.rootProps, ariaDescribedBy = _a.ariaDescribedBy, ariaLabelledBy = _a.ariaLabelledBy, className = _a.className; - var divProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.htmlElementProperties)); - var Tag = tag || elementType || 'div'; - // Note, right before rendering/reconciling proceeds, we need to record if focus - // was in the zone before the update. This helper will track this and, if focus - // was actually in the zone, what the index path to the element is at this time. - // Then, later in componentDidUpdate, we can evaluate if we need to restore it in - // the case the element was removed. + var _a2 = this.props, tag = _a2.as, elementType = _a2.elementType, rootProps = _a2.rootProps, ariaDescribedBy = _a2.ariaDescribedBy, ariaLabelledBy = _a2.ariaLabelledBy, className2 = _a2.className; + var divProps = getNativeProps(this.props, htmlElementProperties); + var Tag = tag || elementType || "div"; this._evaluateFocusBeforeRender(); - // Only support RTL defined in global theme, not contextual theme/RTL. - var theme = (0, _styleUtilities.getTheme)(); - return _react.createElement(Tag, (0, _tslib.__assign)({ - "aria-labelledby": ariaLabelledBy, - "aria-describedby": ariaDescribedBy - }, divProps, rootProps, { - // Once the getClassName correctly memoizes inputs this should - // be replaced so that className is passed to getRootClass and is included there so - // the class names will always be in the same order. - className: (0, _utilities.css)(getRootClass(), className), - // eslint-disable-next-line deprecation/deprecation - ref: this._mergedRef(this.props.elementRef, this._root), - "data-focuszone-id": this._id, - // eslint-disable-next-line react/jsx-no-bind - onKeyDown: function(ev) { - return _this._onKeyDown(ev, theme); - }, - onFocus: this._onFocus, - onMouseDownCapture: this._onMouseDown + var theme = getTheme(); + return React__namespace.createElement(Tag, __assign$1({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy }, divProps, rootProps, { + // Once the getClassName correctly memoizes inputs this should + // be replaced so that className is passed to getRootClass and is included there so + // the class names will always be in the same order. + className: css(getRootClass(), className2), + // eslint-disable-next-line @typescript-eslint/no-deprecated + ref: this._mergedRef(this.props.elementRef, this._root), + "data-focuszone-id": this._id, + // eslint-disable-next-line react/jsx-no-bind + onKeyDown: function(ev) { + return _this._onKeyDown(ev, theme); + }, + onFocus: this._onFocus, + onMouseDownCapture: this._onMouseDown }), this.props.children); - }; - /** - * Sets focus to the first tabbable item in the zone. - * @param forceIntoFirstElement - If true, focus will be forced into the first element, even - * if focus is already in the focus zone. - * @param bypassHiddenElements - If true, focus will be not be set on hidden elements. - * @returns True if focus could be set to an active element, false if no operation was taken. - */ FocusZone.prototype.focus = function(forceIntoFirstElement, bypassHiddenElements) { - if (forceIntoFirstElement === void 0) forceIntoFirstElement = false; - if (bypassHiddenElements === void 0) bypassHiddenElements = false; + }; + FocusZone2.prototype.focus = function(forceIntoFirstElement, bypassHiddenElements) { + if (forceIntoFirstElement === void 0) { + forceIntoFirstElement = false; + } + if (bypassHiddenElements === void 0) { + bypassHiddenElements = false; + } if (this._root.current) { - if (!forceIntoFirstElement && this._root.current.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true' && this._isInnerZone) { - var ownerZoneElement = this._getOwnerZone(this._root.current); - if (ownerZoneElement !== this._root.current) { - var ownerZone = _allInstances[ownerZoneElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; - return !!ownerZone && ownerZone.focusElement(this._root.current); - } - return false; - } else if (!forceIntoFirstElement && this._activeElement && (0, _utilities.elementContains)(this._root.current, this._activeElement) && (0, _utilities.isElementTabbable)(this._activeElement, undefined, this._inShadowRoot) && (!bypassHiddenElements || (0, _utilities.isElementVisibleAndNotHidden)(this._activeElement))) { - this._activeElement.focus(); - return true; - } else { - var firstChild = this._root.current.firstChild; - return this.focusElement((0, _utilities.getNextElement)(this._root.current, firstChild, true, undefined, undefined, undefined, undefined, undefined, bypassHiddenElements)); + if (!forceIntoFirstElement && this._root.current.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "true" && this._isInnerZone) { + var ownerZoneElement = this._getOwnerZone(this._root.current); + if (ownerZoneElement !== this._root.current) { + var ownerZone = _allInstances[ownerZoneElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + return !!ownerZone && ownerZone.focusElement(this._root.current); } + return false; + } else if (!forceIntoFirstElement && this._activeElement && elementContains(this._root.current, this._activeElement) && isElementTabbable(this._activeElement, void 0, this._inShadowRoot) && (!bypassHiddenElements || isElementVisibleAndNotHidden(this._activeElement))) { + this._activeElement.focus(); + return true; + } else { + var firstChild = this._root.current.firstChild; + return this.focusElement(getNextElement(this._root.current, firstChild, true, void 0, void 0, void 0, void 0, void 0, bypassHiddenElements)); + } } return false; - }; - /** - * Sets focus to the last tabbable item in the zone. - * @returns True if focus could be set to an active element, false if no operation was taken. - */ FocusZone.prototype.focusLast = function() { + }; + FocusZone2.prototype.focusLast = function() { if (this._root.current) { - var lastChild = this._root.current && this._root.current.lastChild; - return this.focusElement((0, _utilities.getPreviousElement)(this._root.current, lastChild, true, true, true)); + var lastChild = this._root.current && this._root.current.lastChild; + return this.focusElement(getPreviousElement(this._root.current, lastChild, true, true, true)); } return false; - }; - /** - * Sets focus to a specific child element within the zone. This can be used in conjunction with - * shouldReceiveFocus to create delayed focus scenarios (like animate the scroll position to the correct - * location and then focus.) - * @param element - The child element within the zone to focus. - * @param forceAlignment - If true, focus alignment will be set according to the element provided. - * @returns True if focus could be set to an active element, false if no operation was taken. - */ FocusZone.prototype.focusElement = function(element, forceAlignment) { - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, onBeforeFocus = _a.onBeforeFocus, shouldReceiveFocus = _a.shouldReceiveFocus; - if (shouldReceiveFocus && !shouldReceiveFocus(element) || onBeforeFocus && !onBeforeFocus(element)) return false; - if (element) { - // when we set focus to a specific child, we should recalculate the alignment depending on its position. - this._setActiveElement(element, forceAlignment); - if (this._activeElement) this._activeElement.focus(); - return true; + }; + FocusZone2.prototype.focusElement = function(element2, forceAlignment) { + var _a2 = this.props, onBeforeFocus = _a2.onBeforeFocus, shouldReceiveFocus = _a2.shouldReceiveFocus; + if (shouldReceiveFocus && !shouldReceiveFocus(element2) || onBeforeFocus && !onBeforeFocus(element2)) { + return false; + } + if (element2) { + this._setActiveElement(element2, forceAlignment); + if (this._activeElement) { + this._activeElement.focus(); + } + return true; } return false; - }; - /** - * Forces horizontal alignment in the context of vertical arrowing to use specific point as the reference, - * rather than a center based on the last horizontal motion. - * @param point - the new reference point. - */ FocusZone.prototype.setFocusAlignment = function(point) { - this._focusAlignment = point; - }; - Object.defineProperty(FocusZone.prototype, "defaultFocusElement", { + }; + FocusZone2.prototype.setFocusAlignment = function(point2) { + this._focusAlignment = point2; + }; + Object.defineProperty(FocusZone2.prototype, "defaultFocusElement", { get: function() { - return this._defaultFocusElement; + return this._defaultFocusElement; }, enumerable: false, configurable: true - }); - Object.defineProperty(FocusZone.prototype, "activeElement", { + }); + Object.defineProperty(FocusZone2.prototype, "activeElement", { get: function() { - return this._activeElement; + return this._activeElement; }, enumerable: false, configurable: true - }); - FocusZone.prototype._evaluateFocusBeforeRender = function() { + }); + FocusZone2.prototype._evaluateFocusBeforeRender = function() { var root = this._root.current; var doc = this._getDocument(); if (doc) { - var focusedElement = doc.activeElement; - // Only update the index path if we are not parked on the root. - if (focusedElement !== root) { - var shouldRestoreFocus = (0, _utilities.elementContains)(root, focusedElement, false); - this._lastIndexPath = shouldRestoreFocus ? (0, _utilities.getElementIndexPath)(root, focusedElement) : undefined; - } - } - }; - /** - * When focus is in the zone at render time but then all focusable elements are removed, - * we "park" focus temporarily on the root. Once we update with focusable children, we restore - * focus to the closest path from previous. If the user tabs away from the parked container, - * we restore focusability to the pre-parked state. - */ FocusZone.prototype._setParkedFocus = function(isParked) { + var focusedElement = doc.activeElement; + if (focusedElement !== root) { + var shouldRestoreFocus = elementContains(root, focusedElement, false); + this._lastIndexPath = shouldRestoreFocus ? getElementIndexPath(root, focusedElement) : void 0; + } + } + }; + FocusZone2.prototype._setParkedFocus = function(isParked) { var root = this._root.current; if (root && this._isParked !== isParked) { - this._isParked = isParked; - if (isParked) { - if (!this.props.allowFocusRoot) { - this._parkedTabIndex = root.getAttribute('tabindex'); - root.setAttribute('tabindex', '-1'); - } - root.focus(); - } else if (!this.props.allowFocusRoot) { - if (this._parkedTabIndex) { - root.setAttribute('tabindex', this._parkedTabIndex); - this._parkedTabIndex = undefined; - } else root.removeAttribute('tabindex'); + this._isParked = isParked; + if (isParked) { + if (!this.props.allowFocusRoot) { + this._parkedTabIndex = root.getAttribute("tabindex"); + root.setAttribute("tabindex", "-1"); + } + root.focus(); + } else if (!this.props.allowFocusRoot) { + if (this._parkedTabIndex) { + root.setAttribute("tabindex", this._parkedTabIndex); + this._parkedTabIndex = void 0; + } else { + root.removeAttribute("tabindex"); } + } } - }; - FocusZone.prototype._setActiveElement = function(element, forceAlignment) { + }; + FocusZone2.prototype._setActiveElement = function(element2, forceAlignment) { var previousActiveElement = this._activeElement; - this._activeElement = element; + this._activeElement = element2; if (previousActiveElement) { - if ((0, _utilities.isElementFocusZone)(previousActiveElement)) this._updateTabIndexes(previousActiveElement); - previousActiveElement.tabIndex = -1; + if (isElementFocusZone(previousActiveElement)) { + this._updateTabIndexes(previousActiveElement); + } + previousActiveElement.tabIndex = -1; } if (this._activeElement) { - if (!this._focusAlignment || forceAlignment) this._setFocusAlignment(element, true, true); - this._activeElement.tabIndex = 0; + if (!this._focusAlignment || forceAlignment) { + this._setFocusAlignment(element2, true, true); + } + this._activeElement.tabIndex = 0; } - }; - FocusZone.prototype._preventDefaultWhenHandled = function(ev) { + }; + FocusZone2.prototype._preventDefaultWhenHandled = function(ev) { this.props.preventDefaultWhenHandled && ev.preventDefault(); - }; - /** - * Walk up the dom try to find a focusable element. - */ FocusZone.prototype._tryInvokeClickForFocusable = function(targetElement, ev) { - var target = targetElement; - if (target === this._root.current) return false; + }; + FocusZone2.prototype._tryInvokeClickForFocusable = function(targetElement, ev) { + var target2 = targetElement; + if (target2 === this._root.current) { + return false; + } do { - if (target.tagName === 'BUTTON' || target.tagName === 'A' || target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.tagName === 'SUMMARY') return false; - if (this._isImmediateDescendantOfZone(target) && target.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true' && target.getAttribute(IS_ENTER_DISABLED_ATTRIBUTE) !== 'true') { - raiseClickFromKeyboardEvent(target, ev); - return true; - } - target = (0, _utilities.getParent)(target, ALLOW_VIRTUAL_ELEMENTS); - }while (target !== this._root.current); + if (target2.tagName === "BUTTON" || target2.tagName === "A" || target2.tagName === "INPUT" || target2.tagName === "TEXTAREA" || target2.tagName === "SUMMARY") { + return false; + } + if (this._isImmediateDescendantOfZone(target2) && target2.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "true" && target2.getAttribute(IS_ENTER_DISABLED_ATTRIBUTE) !== "true") { + raiseClickFromKeyboardEvent(target2, ev); + return true; + } + target2 = getParent(target2, ALLOW_VIRTUAL_ELEMENTS); + } while (target2 !== this._root.current); return false; - }; - /** - * Traverse to find first child zone. - */ FocusZone.prototype._getFirstInnerZone = function(rootElement) { + }; + FocusZone2.prototype._getFirstInnerZone = function(rootElement) { rootElement = rootElement || this._activeElement || this._root.current; - if (!rootElement) return null; - if ((0, _utilities.isElementFocusZone)(rootElement)) return _allInstances[rootElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + if (!rootElement) { + return null; + } + if (isElementFocusZone(rootElement)) { + return _allInstances[rootElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + } var child = rootElement.firstElementChild; - while(child){ - if ((0, _utilities.isElementFocusZone)(child)) return _allInstances[child.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; - var match = this._getFirstInnerZone(child); - if (match) return match; - child = child.nextElementSibling; + while (child) { + if (isElementFocusZone(child)) { + return _allInstances[child.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + } + var match2 = this._getFirstInnerZone(child); + if (match2) { + return match2; + } + child = child.nextElementSibling; } return null; - }; - FocusZone.prototype._moveFocus = function(isForward, // eslint-disable-next-line deprecation/deprecation - getDistanceFromCenter, ev, useDefaultWrap) { - if (useDefaultWrap === void 0) useDefaultWrap = true; - var element = this._activeElement; + }; + FocusZone2.prototype._moveFocus = function(isForward, getDistanceFromCenter, ev, useDefaultWrap) { + if (useDefaultWrap === void 0) { + useDefaultWrap = true; + } + var element2 = this._activeElement; var candidateDistance = -1; - var candidateElement = undefined; + var candidateElement = void 0; var changedFocus = false; - var isBidirectional = this.props.direction === (0, _focusZoneTypes.FocusZoneDirection).bidirectional; - if (!element || !this._root.current) return false; - if (this._isElementInput(element)) { - if (!this._shouldInputLoseFocus(element, isForward)) return false; + var isBidirectional = this.props.direction === FocusZoneDirection.bidirectional; + if (!element2 || !this._root.current) { + return false; + } + if (this._isElementInput(element2)) { + if (!this._shouldInputLoseFocus(element2, isForward)) { + return false; + } } - var activeRect = isBidirectional ? element.getBoundingClientRect() : null; + var activeRect = isBidirectional ? element2.getBoundingClientRect() : null; do { - element = isForward ? (0, _utilities.getNextElement)(this._root.current, element) : (0, _utilities.getPreviousElement)(this._root.current, element); - if (isBidirectional) { - if (element) { - var targetRect = element.getBoundingClientRect(); - // eslint-disable-next-line deprecation/deprecation - var elementDistance = getDistanceFromCenter(activeRect, targetRect); - if (elementDistance === -1 && candidateDistance === -1) { - candidateElement = element; - break; - } - if (elementDistance > -1 && (candidateDistance === -1 || elementDistance < candidateDistance)) { - candidateDistance = elementDistance; - candidateElement = element; - } - if (candidateDistance >= 0 && elementDistance < 0) break; - } - } else { - candidateElement = element; + element2 = isForward ? getNextElement(this._root.current, element2) : getPreviousElement(this._root.current, element2); + if (isBidirectional) { + if (element2) { + var targetRect = element2.getBoundingClientRect(); + var elementDistance = getDistanceFromCenter(activeRect, targetRect); + if (elementDistance === -1 && candidateDistance === -1) { + candidateElement = element2; break; + } + if (elementDistance > -1 && (candidateDistance === -1 || elementDistance < candidateDistance)) { + candidateDistance = elementDistance; + candidateElement = element2; + } + if (candidateDistance >= 0 && elementDistance < 0) { + break; + } } - }while (element); - // Focus the closest candidate + } else { + candidateElement = element2; + break; + } + } while (element2); if (candidateElement && candidateElement !== this._activeElement) { - changedFocus = true; - this.focusElement(candidateElement); + changedFocus = true; + this.focusElement(candidateElement); } else if (this.props.isCircularNavigation && useDefaultWrap) { - if (isForward) return this.focusElement((0, _utilities.getNextElement)(this._root.current, this._root.current.firstElementChild, true)); - else return this.focusElement((0, _utilities.getPreviousElement)(this._root.current, this._root.current.lastElementChild, true, true, true)); + if (isForward) { + return this.focusElement(getNextElement(this._root.current, this._root.current.firstElementChild, true)); + } else { + return this.focusElement(getPreviousElement(this._root.current, this._root.current.lastElementChild, true, true, true)); + } } return changedFocus; - }; - FocusZone.prototype._moveFocusDown = function() { + }; + FocusZone2.prototype._moveFocusDown = function() { var _this = this; var targetTop = -1; - // eslint-disable-next-line deprecation/deprecation var leftAlignment = this._focusAlignment.left || this._focusAlignment.x || 0; - if (// eslint-disable-next-line deprecation/deprecation - this._moveFocus(true, function(activeRect, targetRect) { - var distance = -1; - // ClientRect values can be floats that differ by very small fractions of a decimal. - // If the difference between top and bottom are within a pixel then we should treat - // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent, - // but without Math.Floor they will be handled incorrectly. + if ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + this._moveFocus(true, function(activeRect, targetRect) { + var distance2 = -1; var targetRectTop = Math.floor(targetRect.top); var activeRectBottom = Math.floor(activeRect.bottom); if (targetRectTop < activeRectBottom) { - if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return LARGE_DISTANCE_FROM_CENTER; + if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) { + return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return LARGE_DISTANCE_FROM_CENTER; } if (targetTop === -1 && targetRectTop >= activeRectBottom || targetRectTop === targetTop) { - targetTop = targetRectTop; - if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) distance = 0; - else distance = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); - } - return distance; - })) { - this._setFocusAlignment(this._activeElement, false, true); - return true; + targetTop = targetRectTop; + if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) { + distance2 = 0; + } else { + distance2 = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } + } + return distance2; + }) + ) { + this._setFocusAlignment(this._activeElement, false, true); + return true; } return false; - }; - FocusZone.prototype._moveFocusUp = function() { + }; + FocusZone2.prototype._moveFocusUp = function() { var _this = this; var targetTop = -1; - // eslint-disable-next-line deprecation/deprecation var leftAlignment = this._focusAlignment.left || this._focusAlignment.x || 0; - if (// eslint-disable-next-line deprecation/deprecation - this._moveFocus(false, function(activeRect, targetRect) { - var distance = -1; - // ClientRect values can be floats that differ by very small fractions of a decimal. - // If the difference between top and bottom are within a pixel then we should treat - // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent, - // but without Math.Floor they will be handled incorrectly. + if ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + this._moveFocus(false, function(activeRect, targetRect) { + var distance2 = -1; var targetRectBottom = Math.floor(targetRect.bottom); var targetRectTop = Math.floor(targetRect.top); var activeRectTop = Math.floor(activeRect.top); if (targetRectBottom > activeRectTop) { - if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return LARGE_DISTANCE_FROM_CENTER; + if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) { + return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return LARGE_DISTANCE_FROM_CENTER; } if (targetTop === -1 && targetRectBottom <= activeRectTop || targetRectTop === targetTop) { - targetTop = targetRectTop; - if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) distance = 0; - else distance = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); - } - return distance; - })) { - this._setFocusAlignment(this._activeElement, false, true); - return true; + targetTop = targetRectTop; + if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) { + distance2 = 0; + } else { + distance2 = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } + } + return distance2; + }) + ) { + this._setFocusAlignment(this._activeElement, false, true); + return true; } return false; - }; - FocusZone.prototype._moveFocusLeft = function(theme) { + }; + FocusZone2.prototype._moveFocusLeft = function(theme) { var _this = this; var shouldWrap = this._shouldWrapFocus(this._activeElement, NO_HORIZONTAL_WRAP); - if (this._moveFocus((0, _utilities.getRTL)(theme), // eslint-disable-next-line deprecation/deprecation - function(activeRect, targetRect) { - var distance = -1; + if (this._moveFocus( + getRTL(theme), + // eslint-disable-next-line @typescript-eslint/no-deprecated + function(activeRect, targetRect) { + var distance2 = -1; var topBottomComparison; - if ((0, _utilities.getRTL)(theme)) // When in RTL, this comparison should be the same as the one in _moveFocusRight for LTR. - // Going left at a leftmost rectangle will go down a line instead of up a line like in LTR. - // This is important, because we want to be comparing the top of the target rect - // with the bottom of the active rect. - topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); - else topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); - if (topBottomComparison && targetRect.right <= activeRect.right && _this.props.direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) distance = activeRect.right - targetRect.right; - else if (!shouldWrap) distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return distance; - }, undefined /*ev*/ , shouldWrap)) { - this._setFocusAlignment(this._activeElement, true, false); - return true; + if (getRTL(theme)) { + topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); + } else { + topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); + } + if (topBottomComparison && targetRect.right <= activeRect.right && _this.props.direction !== FocusZoneDirection.vertical) { + distance2 = activeRect.right - targetRect.right; + } else if (!shouldWrap) { + distance2 = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return distance2; + }, + void 0, + shouldWrap + )) { + this._setFocusAlignment(this._activeElement, true, false); + return true; } return false; - }; - FocusZone.prototype._moveFocusRight = function(theme) { + }; + FocusZone2.prototype._moveFocusRight = function(theme) { var _this = this; var shouldWrap = this._shouldWrapFocus(this._activeElement, NO_HORIZONTAL_WRAP); - if (this._moveFocus(!(0, _utilities.getRTL)(theme), // eslint-disable-next-line deprecation/deprecation - function(activeRect, targetRect) { - var distance = -1; + if (this._moveFocus( + !getRTL(theme), + // eslint-disable-next-line @typescript-eslint/no-deprecated + function(activeRect, targetRect) { + var distance2 = -1; var topBottomComparison; - if ((0, _utilities.getRTL)(theme)) // When in RTL, this comparison should be the same as the one in _moveFocusLeft for LTR. - // Going right at a rightmost rectangle will go up a line instead of down a line like in LTR. - // This is important, because we want to be comparing the bottom of the target rect - // with the top of the active rect. - topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); - else topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); - if (topBottomComparison && targetRect.left >= activeRect.left && _this.props.direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) distance = targetRect.left - activeRect.left; - else if (!shouldWrap) distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return distance; - }, undefined /*ev*/ , shouldWrap)) { - this._setFocusAlignment(this._activeElement, true, false); - return true; + if (getRTL(theme)) { + topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); + } else { + topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); + } + if (topBottomComparison && targetRect.left >= activeRect.left && _this.props.direction !== FocusZoneDirection.vertical) { + distance2 = targetRect.left - activeRect.left; + } else if (!shouldWrap) { + distance2 = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return distance2; + }, + void 0, + shouldWrap + )) { + this._setFocusAlignment(this._activeElement, true, false); + return true; } return false; - }; - FocusZone.prototype._moveFocusPaging = function(isForward, useDefaultWrap) { - if (useDefaultWrap === void 0) useDefaultWrap = true; - var element = this._activeElement; - if (!element || !this._root.current) return false; - if (this._isElementInput(element)) { - if (!this._shouldInputLoseFocus(element, isForward)) return false; + }; + FocusZone2.prototype._moveFocusPaging = function(isForward, useDefaultWrap) { + if (useDefaultWrap === void 0) { + useDefaultWrap = true; + } + var element2 = this._activeElement; + if (!element2 || !this._root.current) { + return false; + } + if (this._isElementInput(element2)) { + if (!this._shouldInputLoseFocus(element2, isForward)) { + return false; + } + } + var scrollableParent = findScrollableParent(element2); + if (!scrollableParent) { + return false; } - var scrollableParent = (0, _utilities.findScrollableParent)(element); - if (!scrollableParent) return false; var candidateDistance = -1; - var candidateElement = undefined; + var candidateElement = void 0; var targetTop = -1; var targetBottom = -1; var pagesize = scrollableParent.clientHeight; - var activeRect = element.getBoundingClientRect(); + var activeRect = element2.getBoundingClientRect(); do { - element = isForward ? (0, _utilities.getNextElement)(this._root.current, element) : (0, _utilities.getPreviousElement)(this._root.current, element); - if (element) { - var targetRect = element.getBoundingClientRect(); - var targetRectTop = Math.floor(targetRect.top); - var activeRectBottom = Math.floor(activeRect.bottom); - var targetRectBottom = Math.floor(targetRect.bottom); - var activeRectTop = Math.floor(activeRect.top); - var elementDistance = this._getHorizontalDistanceFromCenter(isForward, activeRect, targetRect); - var isElementPassedPageSizeOnPagingDown = isForward && targetRectTop > activeRectBottom + pagesize; - var isElementPassedPageSizeOnPagingUp = !isForward && targetRectBottom < activeRectTop - pagesize; - if (isElementPassedPageSizeOnPagingDown || isElementPassedPageSizeOnPagingUp) break; - if (elementDistance > -1) { - // for paging down - if (isForward && targetRectTop > targetTop) { - targetTop = targetRectTop; - candidateDistance = elementDistance; - candidateElement = element; - } else if (!isForward && targetRectBottom < targetBottom) { - // for paging up - targetBottom = targetRectBottom; - candidateDistance = elementDistance; - candidateElement = element; - } else if (candidateDistance === -1 || elementDistance <= candidateDistance) { - candidateDistance = elementDistance; - candidateElement = element; - } - } - } - }while (element); + element2 = isForward ? getNextElement(this._root.current, element2) : getPreviousElement(this._root.current, element2); + if (element2) { + var targetRect = element2.getBoundingClientRect(); + var targetRectTop = Math.floor(targetRect.top); + var activeRectBottom = Math.floor(activeRect.bottom); + var targetRectBottom = Math.floor(targetRect.bottom); + var activeRectTop = Math.floor(activeRect.top); + var elementDistance = this._getHorizontalDistanceFromCenter(isForward, activeRect, targetRect); + var isElementPassedPageSizeOnPagingDown = isForward && targetRectTop > activeRectBottom + pagesize; + var isElementPassedPageSizeOnPagingUp = !isForward && targetRectBottom < activeRectTop - pagesize; + if (isElementPassedPageSizeOnPagingDown || isElementPassedPageSizeOnPagingUp) { + break; + } + if (elementDistance > -1) { + if (isForward && targetRectTop > targetTop) { + targetTop = targetRectTop; + candidateDistance = elementDistance; + candidateElement = element2; + } else if (!isForward && targetRectBottom < targetBottom) { + targetBottom = targetRectBottom; + candidateDistance = elementDistance; + candidateElement = element2; + } else if (candidateDistance === -1 || elementDistance <= candidateDistance) { + candidateDistance = elementDistance; + candidateElement = element2; + } + } + } + } while (element2); var changedFocus = false; - // Focus the closest candidate if (candidateElement && candidateElement !== this._activeElement) { - changedFocus = true; - this.focusElement(candidateElement); - this._setFocusAlignment(candidateElement, false, true); + changedFocus = true; + this.focusElement(candidateElement); + this._setFocusAlignment(candidateElement, false, true); } else if (this.props.isCircularNavigation && useDefaultWrap) { - if (isForward) return this.focusElement((0, _utilities.getNextElement)(this._root.current, this._root.current.firstElementChild, true)); - return this.focusElement((0, _utilities.getPreviousElement)(this._root.current, this._root.current.lastElementChild, true, true, true)); + if (isForward) { + return this.focusElement(getNextElement(this._root.current, this._root.current.firstElementChild, true)); + } + return this.focusElement(getPreviousElement(this._root.current, this._root.current.lastElementChild, true, true, true)); } return changedFocus; + }; + FocusZone2.prototype._setFocusAlignment = function(element2, isHorizontal, isVertical) { + if (this.props.direction === FocusZoneDirection.bidirectional && (!this._focusAlignment || isHorizontal || isVertical)) { + var rect2 = element2.getBoundingClientRect(); + var left = rect2.left + rect2.width / 2; + var top_1 = rect2.top + rect2.height / 2; + if (!this._focusAlignment) { + this._focusAlignment = { left, top: top_1 }; + } + if (isHorizontal) { + this._focusAlignment.left = left; + } + if (isVertical) { + this._focusAlignment.top = top_1; + } + } + }; + FocusZone2.prototype._isImmediateDescendantOfZone = function(element2) { + return this._getOwnerZone(element2) === this._root.current; + }; + FocusZone2.prototype._getOwnerZone = function(element2) { + var parentElement = getParent(element2, ALLOW_VIRTUAL_ELEMENTS); + while (parentElement && parentElement !== this._root.current && parentElement !== this._getDocument().body) { + if (isElementFocusZone(parentElement)) { + return parentElement; + } + parentElement = getParent(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + return parentElement; + }; + FocusZone2.prototype._updateTabIndexes = function(element2) { + if (!this._activeElement && this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === "function") { + this._activeElement = this.props.defaultTabbableElement(this._root.current); + } + if (!element2 && this._root.current) { + this._defaultFocusElement = null; + element2 = this._root.current; + if (this._activeElement && !elementContains(element2, this._activeElement)) { + this._activeElement = null; + } + } + if (this._activeElement && !isElementTabbable(this._activeElement, void 0, this._inShadowRoot)) { + this._activeElement = null; + } + var childNodes = element2 && element2.children; + for (var childIndex = 0; childNodes && childIndex < childNodes.length; childIndex++) { + var child = childNodes[childIndex]; + if (!isElementFocusZone(child)) { + if (child.getAttribute && child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "false") { + child.setAttribute(TABINDEX, "-1"); + } + if (isElementTabbable(child, void 0, this._inShadowRoot)) { + if (this.props.disabled) { + child.setAttribute(TABINDEX, "-1"); + } else if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { + this._defaultFocusElement = child; + if (child.getAttribute(TABINDEX) !== "0") { + child.setAttribute(TABINDEX, "0"); + } + } else if (child.getAttribute(TABINDEX) !== "-1") { + child.setAttribute(TABINDEX, "-1"); + } + } else if (child.tagName === "svg" && child.getAttribute("focusable") !== "false") { + child.setAttribute("focusable", "false"); + } + } else if (child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "true") { + if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { + this._defaultFocusElement = child; + if (child.getAttribute(TABINDEX) !== "0") { + child.setAttribute(TABINDEX, "0"); + } + } else if (child.getAttribute(TABINDEX) !== "-1") { + child.setAttribute(TABINDEX, "-1"); + } + } + this._updateTabIndexes(child); + } + }; + FocusZone2.prototype._isContentEditableElement = function(element2) { + return element2 && element2.getAttribute("contenteditable") === "true"; + }; + FocusZone2.prototype._isElementInput = function(element2) { + if (element2 && element2.tagName && (element2.tagName.toLowerCase() === "input" || element2.tagName.toLowerCase() === "textarea")) { + return true; + } + return false; + }; + FocusZone2.prototype._shouldInputLoseFocus = function(element2, isForward) { + if (!this._processingTabKey && element2 && element2.type && ALLOWED_INPUT_TYPES.indexOf(element2.type.toLowerCase()) > -1) { + var selectionStart = element2.selectionStart; + var selectionEnd = element2.selectionEnd; + var isRangeSelected = selectionStart !== selectionEnd; + var inputValue = element2.value; + var isReadonly = element2.readOnly; + if (isRangeSelected || selectionStart > 0 && !isForward && !isReadonly || selectionStart !== inputValue.length && isForward && !isReadonly || !!this.props.handleTabKey && !(this.props.shouldInputLoseFocusOnArrowKey && this.props.shouldInputLoseFocusOnArrowKey(element2))) { + return false; + } + } + return true; + }; + FocusZone2.prototype._shouldWrapFocus = function(element2, noWrapDataAttribute) { + return this.props.checkForNoWrap ? shouldWrapFocus(element2, noWrapDataAttribute) : true; + }; + FocusZone2.prototype._portalContainsElement = function(element2) { + return element2 && !!this._root.current && portalContainsElement(element2, this._root.current); + }; + FocusZone2.prototype._getDocument = function() { + return getDocument(this._root.current); + }; + FocusZone2.defaultProps = { + isCircularNavigation: false, + direction: FocusZoneDirection.bidirectional, + shouldRaiseClicks: true, + // Hardcoding uncontrolled flag for proper interop with FluentUI V9. + "data-tabster": '{"uncontrolled": {}}' + }; + FocusZone2.contextType = MergeStylesShadowRootContext; + return FocusZone2; + })(React__namespace.Component) + ); + function getIsChecked(item) { + if (item.canCheck) { + return !!(item.isChecked || item.checked); + } + if (typeof item.isChecked === "boolean") { + return item.isChecked; + } + if (typeof item.checked === "boolean") { + return item.checked; + } + return null; + } + function hasSubmenu(item) { + return !!(item.subMenuProps || item.items); + } + function isItemDisabled(item) { + return !!(item.isDisabled || item.disabled); + } + function getMenuItemAriaRole(item) { + var isChecked = getIsChecked(item); + var canCheck = isChecked !== null; + return canCheck ? "menuitemcheckbox" : "menuitem"; + } + var RectangleEdge; + (function(RectangleEdge2) { + RectangleEdge2[RectangleEdge2["top"] = 1] = "top"; + RectangleEdge2[RectangleEdge2["bottom"] = -1] = "bottom"; + RectangleEdge2[RectangleEdge2["left"] = 2] = "left"; + RectangleEdge2[RectangleEdge2["right"] = -2] = "right"; + })(RectangleEdge || (RectangleEdge = {})); + var Position; + (function(Position2) { + Position2[Position2["top"] = 0] = "top"; + Position2[Position2["bottom"] = 1] = "bottom"; + Position2[Position2["start"] = 2] = "start"; + Position2[Position2["end"] = 3] = "end"; + })(Position || (Position = {})); + var _a$4; + function _createPositionData(targetEdge, alignmentEdge, isAuto) { + return { + targetEdge, + alignmentEdge, + isAuto }; - FocusZone.prototype._setFocusAlignment = function(element, isHorizontal, isVertical) { - if (this.props.direction === (0, _focusZoneTypes.FocusZoneDirection).bidirectional && (!this._focusAlignment || isHorizontal || isVertical)) { - var rect = element.getBoundingClientRect(); - var left = rect.left + rect.width / 2; - var top_1 = rect.top + rect.height / 2; - if (!this._focusAlignment) this._focusAlignment = { - left: left, - top: top_1 - }; - if (isHorizontal) this._focusAlignment.left = left; - if (isVertical) this._focusAlignment.top = top_1; + } + var DirectionalDictionary = (_a$4 = {}, _a$4[DirectionalHint.topLeftEdge] = _createPositionData(RectangleEdge.top, RectangleEdge.left), _a$4[DirectionalHint.topCenter] = _createPositionData(RectangleEdge.top), _a$4[DirectionalHint.topRightEdge] = _createPositionData(RectangleEdge.top, RectangleEdge.right), _a$4[DirectionalHint.topAutoEdge] = _createPositionData(RectangleEdge.top, void 0, true), _a$4[DirectionalHint.bottomLeftEdge] = _createPositionData(RectangleEdge.bottom, RectangleEdge.left), _a$4[DirectionalHint.bottomCenter] = _createPositionData(RectangleEdge.bottom), _a$4[DirectionalHint.bottomRightEdge] = _createPositionData(RectangleEdge.bottom, RectangleEdge.right), _a$4[DirectionalHint.bottomAutoEdge] = _createPositionData(RectangleEdge.bottom, void 0, true), _a$4[DirectionalHint.leftTopEdge] = _createPositionData(RectangleEdge.left, RectangleEdge.top), _a$4[DirectionalHint.leftCenter] = _createPositionData(RectangleEdge.left), _a$4[DirectionalHint.leftBottomEdge] = _createPositionData(RectangleEdge.left, RectangleEdge.bottom), _a$4[DirectionalHint.rightTopEdge] = _createPositionData(RectangleEdge.right, RectangleEdge.top), _a$4[DirectionalHint.rightCenter] = _createPositionData(RectangleEdge.right), _a$4[DirectionalHint.rightBottomEdge] = _createPositionData(RectangleEdge.right, RectangleEdge.bottom), _a$4); + function _isRectangleWithinBounds(rect2, boundingRect) { + if (rect2.top < boundingRect.top) { + return false; + } + if (rect2.bottom > boundingRect.bottom) { + return false; + } + if (rect2.left < boundingRect.left) { + return false; + } + if (rect2.right > boundingRect.right) { + return false; + } + return true; + } + function _getOutOfBoundsEdges(rect2, boundingRect) { + var outOfBounds2 = []; + if (rect2.top < boundingRect.top) { + outOfBounds2.push(RectangleEdge.top); + } + if (rect2.bottom > boundingRect.bottom) { + outOfBounds2.push(RectangleEdge.bottom); + } + if (rect2.left < boundingRect.left) { + outOfBounds2.push(RectangleEdge.left); + } + if (rect2.right > boundingRect.right) { + outOfBounds2.push(RectangleEdge.right); + } + return outOfBounds2; + } + function _getEdgeValue(rect2, edge) { + return rect2[RectangleEdge[edge]]; + } + function _setEdgeValue(rect2, edge, value2) { + rect2[RectangleEdge[edge]] = value2; + return rect2; + } + function _getCenterValue(rect2, edge) { + var edges = _getFlankingEdges(edge); + return (_getEdgeValue(rect2, edges.positiveEdge) + _getEdgeValue(rect2, edges.negativeEdge)) / 2; + } + function _getRelativeEdgeValue(edge, value2) { + if (edge > 0) { + return value2; + } else { + return value2 * -1; + } + } + function _getRelativeRectEdgeValue(edge, rect2) { + return _getRelativeEdgeValue(edge, _getEdgeValue(rect2, edge)); + } + function _getRelativeEdgeDifference(rect2, hostRect, edge) { + var edgeDifference = _getEdgeValue(rect2, edge) - _getEdgeValue(hostRect, edge); + return _getRelativeEdgeValue(edge, edgeDifference); + } + function _moveEdge(rect2, edge, newValue, maintainSize) { + if (maintainSize === void 0) { + maintainSize = true; + } + var difference = _getEdgeValue(rect2, edge) - newValue; + var returnRect = _setEdgeValue(rect2, edge, newValue); + if (maintainSize) { + returnRect = _setEdgeValue(rect2, edge * -1, _getEdgeValue(rect2, edge * -1) - difference); + } + return returnRect; + } + function _alignEdges(rect2, target2, edge, gap) { + if (gap === void 0) { + gap = 0; + } + return _moveEdge(rect2, edge, _getEdgeValue(target2, edge) + _getRelativeEdgeValue(edge, gap)); + } + function _alignOppositeEdges(rect2, target2, targetEdge, gap) { + if (gap === void 0) { + gap = 0; + } + var oppositeEdge = targetEdge * -1; + var adjustedGap = _getRelativeEdgeValue(oppositeEdge, gap); + return _moveEdge(rect2, targetEdge * -1, _getEdgeValue(target2, targetEdge) + adjustedGap); + } + function _isEdgeInBounds(rect2, bounds2, edge) { + var adjustedRectValue = _getRelativeRectEdgeValue(edge, rect2); + return adjustedRectValue > _getRelativeRectEdgeValue(edge, bounds2); + } + function _getOutOfBoundsDegree(rect2, bounds2) { + var breakingEdges = _getOutOfBoundsEdges(rect2, bounds2); + var total = 0; + for (var _i = 0, breakingEdges_1 = breakingEdges; _i < breakingEdges_1.length; _i++) { + var edge = breakingEdges_1[_i]; + total += Math.pow(_getRelativeEdgeDifference(rect2, bounds2, edge), 2); + } + return total; + } + function _canScrollResizeToFitEdge(target2, bounding, targetEdge, minimumScrollResizeHeight) { + if (minimumScrollResizeHeight === void 0) { + minimumScrollResizeHeight = 200; + } + if (targetEdge !== RectangleEdge.bottom && targetEdge !== RectangleEdge.top) { + return false; + } + return _getRelativeEdgeDifference(target2, bounding, targetEdge) >= minimumScrollResizeHeight; + } + function _flipToFit(rect2, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + if (gap === void 0) { + gap = 0; + } + var directions = [ + RectangleEdge.left, + RectangleEdge.right, + RectangleEdge.bottom, + RectangleEdge.top + ]; + if (getRTL()) { + directions[0] *= -1; + directions[1] *= -1; + } + var currentEstimate = rect2; + var currentEdge = positionData.targetEdge; + var currentAlignment = positionData.alignmentEdge; + var oobDegree; + var bestEdge = currentEdge; + var bestAlignment = currentAlignment; + for (var i = 0; i < 4; i++) { + if (_isEdgeInBounds(currentEstimate, bounding, currentEdge)) { + return { + elementRectangle: currentEstimate, + targetEdge: currentEdge, + alignmentEdge: currentAlignment + }; + } else if (shouldScroll && _canScrollResizeToFitEdge(target2, bounding, currentEdge, minimumScrollResizeHeight)) { + switch (currentEdge) { + case RectangleEdge.bottom: + currentEstimate.bottom = bounding.bottom; + break; + case RectangleEdge.top: + currentEstimate.top = bounding.top; + break; + } + return { + elementRectangle: currentEstimate, + targetEdge: currentEdge, + alignmentEdge: currentAlignment, + forcedInBounds: true + }; + } else { + var currentOOBDegree = _getOutOfBoundsDegree(currentEstimate, bounding); + if (!oobDegree || currentOOBDegree < oobDegree) { + oobDegree = currentOOBDegree; + bestEdge = currentEdge; + bestAlignment = currentAlignment; + } + directions.splice(directions.indexOf(currentEdge), 1); + if (directions.length > 0) { + if (directions.indexOf(currentEdge * -1) > -1) { + currentEdge = currentEdge * -1; + } else { + currentAlignment = currentEdge; + currentEdge = directions.slice(-1)[0]; + } + currentEstimate = _estimatePosition(rect2, target2, { targetEdge: currentEdge, alignmentEdge: currentAlignment }, gap); } + } + } + currentEstimate = _estimatePosition(rect2, target2, { targetEdge: bestEdge, alignmentEdge: bestAlignment }, gap); + return { + elementRectangle: currentEstimate, + targetEdge: bestEdge, + alignmentEdge: bestAlignment }; - FocusZone.prototype._isImmediateDescendantOfZone = function(element) { - return this._getOwnerZone(element) === this._root.current; + } + function _flipAlignmentEdge(elementEstimate, target2, gap, coverTarget) { + var alignmentEdge = elementEstimate.alignmentEdge, targetEdge = elementEstimate.targetEdge, elementRectangle = elementEstimate.elementRectangle; + var oppositeEdge = alignmentEdge * -1; + var newEstimate = _estimatePosition(elementRectangle, target2, { targetEdge, alignmentEdge: oppositeEdge }, gap, coverTarget); + return { + elementRectangle: newEstimate, + targetEdge, + alignmentEdge: oppositeEdge }; - FocusZone.prototype._getOwnerZone = function(element) { - var parentElement = (0, _utilities.getParent)(element, ALLOW_VIRTUAL_ELEMENTS); - while(parentElement && parentElement !== this._root.current && parentElement !== this._getDocument().body){ - if ((0, _utilities.isElementFocusZone)(parentElement)) return parentElement; - parentElement = (0, _utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + function _adjustFitWithinBounds(element2, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + if (gap === void 0) { + gap = 0; + } + var alignmentEdge = positionData.alignmentEdge, alignTargetEdge = positionData.alignTargetEdge; + var elementEstimate = { + elementRectangle: element2, + targetEdge: positionData.targetEdge, + alignmentEdge + }; + if (!directionalHintFixed && !coverTarget) { + elementEstimate = _flipToFit(element2, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap); + } + var outOfBounds2 = _getOutOfBoundsEdges(elementEstimate.elementRectangle, bounding); + var fixedEdge = directionalHintFixed ? -elementEstimate.targetEdge : void 0; + if (outOfBounds2.length > 0) { + if (alignTargetEdge) { + if (elementEstimate.alignmentEdge && outOfBounds2.indexOf(elementEstimate.alignmentEdge * -1) > -1) { + var flippedElementEstimate = _flipAlignmentEdge(elementEstimate, target2, gap, coverTarget); + if (_isRectangleWithinBounds(flippedElementEstimate.elementRectangle, bounding)) { + return flippedElementEstimate; + } else { + elementEstimate = _alignOutOfBoundsEdges(_getOutOfBoundsEdges(flippedElementEstimate.elementRectangle, bounding), elementEstimate, bounding, fixedEdge); + } + } else { + elementEstimate = _alignOutOfBoundsEdges(outOfBounds2, elementEstimate, bounding, fixedEdge); } - return parentElement; - }; - FocusZone.prototype._updateTabIndexes = function(element) { - if (!this._activeElement && this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === 'function') this._activeElement = this.props.defaultTabbableElement(this._root.current); - if (!element && this._root.current) { - this._defaultFocusElement = null; - element = this._root.current; - if (this._activeElement && !(0, _utilities.elementContains)(element, this._activeElement)) this._activeElement = null; - } - // If active element changes state to disabled, set it to null. - // Otherwise, we lose keyboard accessibility to other elements in focus zone. - if (this._activeElement && !(0, _utilities.isElementTabbable)(this._activeElement, undefined, this._inShadowRoot)) this._activeElement = null; - var childNodes = element && element.children; - for(var childIndex = 0; childNodes && childIndex < childNodes.length; childIndex++){ - var child = childNodes[childIndex]; - if (!(0, _utilities.isElementFocusZone)(child)) { - // If the item is explicitly set to not be focusable then TABINDEX needs to be set to -1. - if (child.getAttribute && child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'false') child.setAttribute(TABINDEX, '-1'); - if ((0, _utilities.isElementTabbable)(child, undefined, this._inShadowRoot)) { - if (this.props.disabled) child.setAttribute(TABINDEX, '-1'); - else if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { - this._defaultFocusElement = child; - if (child.getAttribute(TABINDEX) !== '0') child.setAttribute(TABINDEX, '0'); - } else if (child.getAttribute(TABINDEX) !== '-1') child.setAttribute(TABINDEX, '-1'); - } else if (child.tagName === 'svg' && child.getAttribute('focusable') !== 'false') // Disgusting IE hack. Sad face. - child.setAttribute('focusable', 'false'); - } else if (child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true') { - if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { - this._defaultFocusElement = child; - if (child.getAttribute(TABINDEX) !== '0') child.setAttribute(TABINDEX, '0'); - } else if (child.getAttribute(TABINDEX) !== '-1') child.setAttribute(TABINDEX, '-1'); - } - this._updateTabIndexes(child); + } else { + elementEstimate = _alignOutOfBoundsEdges(outOfBounds2, elementEstimate, bounding, fixedEdge); + } + } + return elementEstimate; + } + function _alignOutOfBoundsEdges(outOfBoundsEdges, elementEstimate, bounding, preserveEdge) { + for (var _i = 0, outOfBoundsEdges_1 = outOfBoundsEdges; _i < outOfBoundsEdges_1.length; _i++) { + var direction = outOfBoundsEdges_1[_i]; + var edgeAttempt = void 0; + if (preserveEdge && preserveEdge === direction * -1) { + edgeAttempt = _moveEdge(elementEstimate.elementRectangle, direction, _getEdgeValue(bounding, direction), false); + elementEstimate.forcedInBounds = true; + } else { + edgeAttempt = _alignEdges(elementEstimate.elementRectangle, bounding, direction); + var inBounds = _isEdgeInBounds(edgeAttempt, bounding, direction * -1); + if (!inBounds) { + edgeAttempt = _moveEdge(edgeAttempt, direction * -1, _getEdgeValue(bounding, direction * -1), false); + elementEstimate.forcedInBounds = true; } + } + elementEstimate.elementRectangle = edgeAttempt; + } + return elementEstimate; + } + function _centerEdgeToPoint(rect2, edge, point2) { + var positiveEdge = _getFlankingEdges(edge).positiveEdge; + var elementMiddle = _getCenterValue(rect2, edge); + var distanceToMiddle = elementMiddle - _getEdgeValue(rect2, positiveEdge); + return _moveEdge(rect2, positiveEdge, point2 - distanceToMiddle); + } + function _estimatePosition(elementToPosition, target2, positionData, gap, coverTarget) { + if (gap === void 0) { + gap = 0; + } + var estimatedElementPosition = new Rectangle(elementToPosition.left, elementToPosition.right, elementToPosition.top, elementToPosition.bottom); + var alignmentEdge = positionData.alignmentEdge, targetEdge = positionData.targetEdge; + var elementEdge = coverTarget ? targetEdge : targetEdge * -1; + estimatedElementPosition = coverTarget ? _alignEdges(estimatedElementPosition, target2, targetEdge, gap) : _alignOppositeEdges(estimatedElementPosition, target2, targetEdge, gap); + if (!alignmentEdge) { + var targetMiddlePoint = _getCenterValue(target2, targetEdge); + estimatedElementPosition = _centerEdgeToPoint(estimatedElementPosition, elementEdge, targetMiddlePoint); + } else { + estimatedElementPosition = _alignEdges(estimatedElementPosition, target2, alignmentEdge); + } + return estimatedElementPosition; + } + function _getFlankingEdges(edge) { + if (edge === RectangleEdge.top || edge === RectangleEdge.bottom) { + return { + positiveEdge: RectangleEdge.left, + negativeEdge: RectangleEdge.right + }; + } else { + return { + positiveEdge: RectangleEdge.top, + negativeEdge: RectangleEdge.bottom + }; + } + } + function _finalizeReturnEdge(elementRectangle, returnEdge, bounds2) { + if (bounds2 && Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds2, returnEdge)) > Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds2, returnEdge * -1))) { + return returnEdge * -1; + } + return returnEdge; + } + function _isEdgeOnBounds(elementRectangle, edge, bounds2) { + return bounds2 !== void 0 && _getEdgeValue(elementRectangle, edge) === _getEdgeValue(bounds2, edge); + } + function _finalizeElementPosition(elementRectangle, hostElement, targetEdge, bounds2, alignmentEdge, coverTarget, doNotFinalizeReturnEdge, forceWithinBounds) { + var returnValue = {}; + var hostRect = _getRectangleFromElement(hostElement); + var elementEdge = coverTarget ? targetEdge : targetEdge * -1; + var returnEdge = alignmentEdge ? alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge; + if (!doNotFinalizeReturnEdge || _isEdgeOnBounds(elementRectangle, getOppositeEdge(returnEdge), bounds2)) { + returnEdge = _finalizeReturnEdge(elementRectangle, returnEdge, bounds2); + } + returnValue[RectangleEdge[elementEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge); + returnValue[RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge); + if (forceWithinBounds) { + returnValue[RectangleEdge[elementEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge * -1); + returnValue[RectangleEdge[returnEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge * -1); + } + return returnValue; + } + function _calculateActualBeakWidthInPixels(beakWidth) { + return Math.sqrt(beakWidth * beakWidth * 2); + } + function _getPositionData(directionalHint, directionalHintForRTL, previousPositions) { + if (directionalHint === void 0) { + directionalHint = DirectionalHint.bottomAutoEdge; + } + if (previousPositions) { + return { + alignmentEdge: previousPositions.alignmentEdge, + isAuto: previousPositions.isAuto, + targetEdge: previousPositions.targetEdge + }; + } + var positionInformation = __assign$1({}, DirectionalDictionary[directionalHint]); + if (getRTL()) { + if (positionInformation.alignmentEdge && positionInformation.alignmentEdge % 2 === 0) { + positionInformation.alignmentEdge = positionInformation.alignmentEdge * -1; + } + return directionalHintForRTL !== void 0 ? DirectionalDictionary[directionalHintForRTL] : positionInformation; + } + return positionInformation; + } + function _getAlignmentData(positionData, target2, boundingRect, coverTarget, alignTargetEdge) { + if (positionData.isAuto) { + positionData.alignmentEdge = getClosestEdge(positionData.targetEdge, target2, boundingRect); + } + positionData.alignTargetEdge = alignTargetEdge; + return positionData; + } + function getClosestEdge(targetEdge, target2, boundingRect) { + var targetCenter = _getCenterValue(target2, targetEdge); + var boundingCenter = _getCenterValue(boundingRect, targetEdge); + var _a2 = _getFlankingEdges(targetEdge), positiveEdge = _a2.positiveEdge, negativeEdge = _a2.negativeEdge; + if (targetCenter <= boundingCenter) { + return positiveEdge; + } else { + return negativeEdge; + } + } + function _positionElementWithinBounds(elementToPosition, target2, bounding, positionData, gap, shouldScroll, minimumScrollResizeHeight, directionalHintFixed, coverTarget) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + var estimatedElementPosition = _estimatePosition(elementToPosition, target2, positionData, gap, coverTarget); + if (_isRectangleWithinBounds(estimatedElementPosition, bounding)) { + return { + elementRectangle: estimatedElementPosition, + targetEdge: positionData.targetEdge, + alignmentEdge: positionData.alignmentEdge + }; + } else { + return _adjustFitWithinBounds(estimatedElementPosition, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget); + } + } + function _finalizeBeakPosition(elementPosition, positionedBeak, bounds2) { + var targetEdge = elementPosition.targetEdge * -1; + var actualElement = new Rectangle(0, elementPosition.elementRectangle.width, 0, elementPosition.elementRectangle.height); + var returnValue = {}; + var returnEdge = _finalizeReturnEdge(elementPosition.elementRectangle, elementPosition.alignmentEdge ? elementPosition.alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge, bounds2); + var beakEdgeDifference = _getRelativeEdgeDifference(elementPosition.elementRectangle, elementPosition.targetRectangle, targetEdge); + var showBeak = beakEdgeDifference > Math.abs(_getEdgeValue(positionedBeak, targetEdge)); + returnValue[RectangleEdge[targetEdge]] = _getEdgeValue(positionedBeak, targetEdge); + returnValue[RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); + return { + elementPosition: __assign$1({}, returnValue), + closestEdge: getClosestEdge(elementPosition.targetEdge, positionedBeak, actualElement), + targetEdge, + hideBeak: !showBeak }; - FocusZone.prototype._isContentEditableElement = function(element) { - return element && element.getAttribute('contenteditable') === 'true'; - }; - FocusZone.prototype._isElementInput = function(element) { - if (element && element.tagName && (element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea')) return true; - return false; + } + function _positionBeak(beakWidth, elementPosition) { + var target2 = elementPosition.targetRectangle; + var _a2 = _getFlankingEdges(elementPosition.targetEdge), positiveEdge = _a2.positiveEdge, negativeEdge = _a2.negativeEdge; + var beakTargetPoint = _getCenterValue(target2, elementPosition.targetEdge); + var elementBounds = new Rectangle(beakWidth / 2, elementPosition.elementRectangle.width - beakWidth / 2, beakWidth / 2, elementPosition.elementRectangle.height - beakWidth / 2); + var beakPosition = new Rectangle(0, beakWidth, 0, beakWidth); + beakPosition = _moveEdge(beakPosition, elementPosition.targetEdge * -1, -beakWidth / 2); + beakPosition = _centerEdgeToPoint(beakPosition, elementPosition.targetEdge * -1, beakTargetPoint - _getRelativeRectEdgeValue(positiveEdge, elementPosition.elementRectangle)); + if (!_isEdgeInBounds(beakPosition, elementBounds, positiveEdge)) { + beakPosition = _alignEdges(beakPosition, elementBounds, positiveEdge); + } else if (!_isEdgeInBounds(beakPosition, elementBounds, negativeEdge)) { + beakPosition = _alignEdges(beakPosition, elementBounds, negativeEdge); + } + return beakPosition; + } + function _getRectangleFromElement(element2) { + var clientRect = element2.getBoundingClientRect(); + return new Rectangle(clientRect.left, clientRect.right, clientRect.top, clientRect.bottom); + } + function _getRectangleFromIRect(rect2) { + return new Rectangle(rect2.left, rect2.right, rect2.top, rect2.bottom); + } + function _getTargetRect(bounds2, target2) { + var targetRectangle; + if (target2) { + if (!!target2.preventDefault) { + var ev = target2; + targetRectangle = new Rectangle(ev.clientX, ev.clientX, ev.clientY, ev.clientY); + } else if (!!target2.getBoundingClientRect) { + targetRectangle = _getRectangleFromElement(target2); + } else { + var rectOrPoint = target2; + var left = rectOrPoint.left || rectOrPoint.x; + var top_1 = rectOrPoint.top || rectOrPoint.y; + var right = rectOrPoint.right || left; + var bottom = rectOrPoint.bottom || top_1; + targetRectangle = new Rectangle(left, right, top_1, bottom); + } + if (!_isRectangleWithinBounds(targetRectangle, bounds2)) { + var outOfBounds2 = _getOutOfBoundsEdges(targetRectangle, bounds2); + for (var _i = 0, outOfBounds_1 = outOfBounds2; _i < outOfBounds_1.length; _i++) { + var direction = outOfBounds_1[_i]; + targetRectangle[RectangleEdge[direction]] = bounds2[RectangleEdge[direction]]; + } + } + } else { + targetRectangle = new Rectangle(0, 0, 0, 0); + } + return targetRectangle; + } + function _positionElementRelative(props, elementToPosition, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + var gap = props.gapSpace ? props.gapSpace : 0; + var targetRect = _getTargetRect(boundingRect, props.target); + var positionData = _getAlignmentData(_getPositionData(props.directionalHint, props.directionalHintForRTL, previousPositions), targetRect, boundingRect, props.coverTarget, props.alignTargetEdge); + var positionedElement = _positionElementWithinBounds(_getRectangleFromElement(elementToPosition), targetRect, boundingRect, positionData, gap, shouldScroll, minimumScrollResizeHeight, props.directionalHintFixed, props.coverTarget); + return __assign$1(__assign$1({}, positionedElement), { targetRectangle: targetRect }); + } + function _finalizePositionData(positionedElement, hostElement, bounds2, coverTarget, doNotFinalizeReturnEdge) { + var finalizedElement = _finalizeElementPosition(positionedElement.elementRectangle, hostElement, positionedElement.targetEdge, bounds2, positionedElement.alignmentEdge, coverTarget, doNotFinalizeReturnEdge, positionedElement.forcedInBounds); + return { + elementPosition: finalizedElement, + targetEdge: positionedElement.targetEdge, + alignmentEdge: positionedElement.alignmentEdge }; - FocusZone.prototype._shouldInputLoseFocus = function(element, isForward) { - // If a tab was used, we want to focus on the next element. - if (!this._processingTabKey && element && element.type && ALLOWED_INPUT_TYPES.indexOf(element.type.toLowerCase()) > -1) { - var selectionStart = element.selectionStart; - var selectionEnd = element.selectionEnd; - var isRangeSelected = selectionStart !== selectionEnd; - var inputValue = element.value; - var isReadonly = element.readOnly; - // We shouldn't lose focus in the following cases: - // 1. There is range selected. - // 2. When selection start is larger than 0 and it is backward and not readOnly. - // 3. when selection start is not the end of length, it is forward and not readOnly. - // 4. We press any of the arrow keys when our handleTabKey isn't none or undefined (only losing focus if we hit - // tab) and if shouldInputLoseFocusOnArrowKey is defined, if scenario prefers to not loose the focus which is - // determined by calling the callback shouldInputLoseFocusOnArrowKey - if (isRangeSelected || selectionStart > 0 && !isForward && !isReadonly || selectionStart !== inputValue.length && isForward && !isReadonly || !!this.props.handleTabKey && !(this.props.shouldInputLoseFocusOnArrowKey && this.props.shouldInputLoseFocusOnArrowKey(element))) return false; + } + function _calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { + if (beakWidth === void 0) { + beakWidth = 0; + } + if (gapSpace === void 0) { + gapSpace = 0; + } + return _calculateActualBeakWidthInPixels(isBeakVisible ? beakWidth : 0) / 2 + gapSpace; + } + function _positionCallout(props, hostElement, callout, previousPositions, shouldScroll, minimumScrollResizeHeight, doNotFinalizeReturnEdge, win) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + var theWin = win !== null && win !== void 0 ? win : getWindow(); + var beakWidth = props.isBeakVisible ? props.beakWidth || 0 : 0; + var gap = _calculateGapSpace(props.isBeakVisible, props.beakWidth, props.gapSpace); + var positionProps = props; + positionProps.gapSpace = gap; + var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new Rectangle(0, theWin.innerWidth - getScrollbarWidth(), 0, theWin.innerHeight); + var positionedElement = _positionElementRelative(positionProps, callout, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight); + var beakPositioned = _positionBeak(beakWidth, positionedElement); + var finalizedBeakPosition = _finalizeBeakPosition(positionedElement, beakPositioned, boundingRect); + return __assign$1(__assign$1({}, _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget, doNotFinalizeReturnEdge)), { beakPosition: finalizedBeakPosition }); + } + function _positionCard(props, hostElement, callout, previousPositions, win) { + var theWin = win !== null && win !== void 0 ? win : getWindow(); + return _positionCallout(props, hostElement, callout, previousPositions, false, void 0, true, theWin); + } + function _getRectangleFromTarget(target2) { + var _a2, _b2, _c2, _d2; + var mouseTarget = target2; + var elementTarget = target2; + var rectOrPointTarget = target2; + var targetRect; + var left = (_a2 = rectOrPointTarget.left) !== null && _a2 !== void 0 ? _a2 : rectOrPointTarget.x; + var top = (_b2 = rectOrPointTarget.top) !== null && _b2 !== void 0 ? _b2 : rectOrPointTarget.y; + var right = (_c2 = rectOrPointTarget.right) !== null && _c2 !== void 0 ? _c2 : left; + var bottom = (_d2 = rectOrPointTarget.bottom) !== null && _d2 !== void 0 ? _d2 : top; + if (!!mouseTarget.stopPropagation) { + targetRect = new Rectangle(mouseTarget.clientX, mouseTarget.clientX, mouseTarget.clientY, mouseTarget.clientY); + } else if (left !== void 0 && top !== void 0) { + targetRect = new Rectangle(left, right, top, bottom); + } else { + targetRect = _getRectangleFromElement(elementTarget); + } + return targetRect; + } + function positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, win) { + return _positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, void 0, win); + } + function positionCard(props, hostElement, elementToPosition, previousPositions, win) { + return _positionCard(props, hostElement, elementToPosition, previousPositions, win); + } + function getOppositeEdge(edge) { + return edge * -1; + } + function _getBoundsFromTargetWindow(target2, targetWindow) { + var segments2 = void 0; + if (targetWindow.getWindowSegments) { + segments2 = targetWindow.getWindowSegments(); + } + if (segments2 === void 0 || segments2.length <= 1) { + return { + top: 0, + left: 0, + right: targetWindow.innerWidth, + bottom: targetWindow.innerHeight, + width: targetWindow.innerWidth, + height: targetWindow.innerHeight + }; + } + var x2 = 0; + var y2 = 0; + if (target2 !== null && !!target2.getBoundingClientRect) { + var clientRect = target2.getBoundingClientRect(); + x2 = (clientRect.left + clientRect.right) / 2; + y2 = (clientRect.top + clientRect.bottom) / 2; + } else if (target2 !== null) { + x2 = target2.left || target2.x; + y2 = target2.top || target2.y; + } + var bounds2 = { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0 }; + for (var _i = 0, segments_1 = segments2; _i < segments_1.length; _i++) { + var segment = segments_1[_i]; + if (x2 && segment.left <= x2 && segment.right >= x2 && y2 && segment.top <= y2 && segment.bottom >= y2) { + bounds2 = { + top: segment.top, + left: segment.left, + right: segment.right, + bottom: segment.bottom, + width: segment.width, + height: segment.height + }; + } + } + return bounds2; + } + function getBoundsFromTargetWindow(target2, targetWindow) { + return _getBoundsFromTargetWindow(target2, targetWindow); + } + function calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { + return _calculateGapSpace(isBeakVisible, beakWidth, gapSpace); + } + function getRectangleFromTarget(target2) { + return _getRectangleFromTarget(target2); + } + function useScrollbarAsync(props, root) { + var async = useAsync(); + var _a2 = React__namespace.useState(false), needsVerticalScrollBarState = _a2[0], setNeedsVerticalScrollBar = _a2[1]; + React__namespace.useEffect(function() { + async.requestAnimationFrame(function() { + var _a3; + if (props.style && props.style.overflowY) { + return; + } + var needsVerticalScrollBar = false; + if (root && root.current && ((_a3 = root.current) === null || _a3 === void 0 ? void 0 : _a3.firstElementChild)) { + var rootHeight = root.current.clientHeight; + var firstChildHeight = root.current.firstElementChild.clientHeight; + if (rootHeight > 0 && firstChildHeight > rootHeight) { + needsVerticalScrollBar = firstChildHeight - rootHeight > 1; + } + } + if (needsVerticalScrollBarState !== needsVerticalScrollBar) { + setNeedsVerticalScrollBar(needsVerticalScrollBar); } - return true; - }; - FocusZone.prototype._shouldWrapFocus = function(element, noWrapDataAttribute) { - return this.props.checkForNoWrap ? (0, _utilities.shouldWrapFocus)(element, noWrapDataAttribute) : true; - }; - /** - * Returns true if the element is a descendant of the FocusZone through a React portal. - */ FocusZone.prototype._portalContainsElement = function(element) { - return element && !!this._root.current && (0, _utilities.portalContainsElement)(element, this._root.current); - }; - FocusZone.prototype._getDocument = function() { - return (0, _utilities.getDocument)(this._root.current); - }; - FocusZone.contextType = (0, _utilities.MergeStylesShadowRootContext); - FocusZone.defaultProps = { - isCircularNavigation: false, - direction: (0, _focusZoneTypes.FocusZoneDirection).bidirectional, - shouldRaiseClicks: true, - // Hardcoding uncontrolled flag for proper interop with FluentUI V9. - 'data-tabster': '{"uncontrolled": {}}' - }; - return FocusZone; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./FocusZone.types":"hsbYN","@fluentui/utilities":"55bj3","@fluentui/merge-styles":"bDG2L","@fluentui/style-utilities":"bJvmh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hsbYN":[function(require,module,exports,__globalThis) { -/** - * {@docCategory FocusZone} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusZoneTabbableElements", ()=>FocusZoneTabbableElements); -parcelHelpers.export(exports, "FocusZoneDirection", ()=>FocusZoneDirection); -var FocusZoneTabbableElements = { - /** Tabbing is not allowed */ none: 0, - /** All tabbing action is allowed */ all: 1, - /** Tabbing is allowed only on input elements */ inputOnly: 2 -}; -var FocusZoneDirection; -(function(FocusZoneDirection) { - /** Only react to up/down arrows. */ FocusZoneDirection[FocusZoneDirection["vertical"] = 0] = "vertical"; - /** Only react to left/right arrows. */ FocusZoneDirection[FocusZoneDirection["horizontal"] = 1] = "horizontal"; - /** React to all arrows. */ FocusZoneDirection[FocusZoneDirection["bidirectional"] = 2] = "bidirectional"; - /** - * React to all arrows. Navigate next item in DOM on right/down arrow keys and previous - left/up arrow keys. - * Right and Left arrow keys are swapped in RTL mode. - */ FocusZoneDirection[FocusZoneDirection["domOrder"] = 3] = "domOrder"; -})(FocusZoneDirection || (FocusZoneDirection = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lGesq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _contextualMenuUtility = require("./contextualMenuUtility"); -parcelHelpers.exportAll(_contextualMenuUtility, exports); - -},{"./contextualMenuUtility":"jCBxW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jCBxW":[function(require,module,exports,__globalThis) { -/** - * Determines the effective checked state of a menu item. - * - * @param item {IContextualMenuItem} to get the check state of. - * @returns {true} if the item is checked. - * @returns {false} if the item is unchecked. - * @returns {null} if the item is not checkable. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getIsChecked", ()=>getIsChecked); -parcelHelpers.export(exports, "hasSubmenu", ()=>hasSubmenu); -parcelHelpers.export(exports, "isItemDisabled", ()=>isItemDisabled); -parcelHelpers.export(exports, "getMenuItemAriaRole", ()=>getMenuItemAriaRole); -function getIsChecked(item) { - if (item.canCheck) return !!(item.isChecked || item.checked); - if (typeof item.isChecked === 'boolean') return item.isChecked; - if (typeof item.checked === 'boolean') return item.checked; - // Item is not checkable. - return null; -} -function hasSubmenu(item) { - // eslint-disable-next-line deprecation/deprecation - return !!(item.subMenuProps || item.items); -} -function isItemDisabled(item) { - return !!(item.isDisabled || item.disabled); -} -function getMenuItemAriaRole(item) { - var isChecked = getIsChecked(item); - var canCheck = isChecked !== null; - return canCheck ? 'menuitemcheckbox' : 'menuitem'; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g2jXk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Callout/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Callout/index":"4sb4j","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4sb4j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _callout = require("./Callout"); -parcelHelpers.exportAll(_callout, exports); -var _calloutTypes = require("./Callout.types"); -parcelHelpers.exportAll(_calloutTypes, exports); -var _calloutContent = require("./CalloutContent"); -parcelHelpers.exportAll(_calloutContent, exports); -var _calloutContentBase = require("./CalloutContent.base"); -parcelHelpers.exportAll(_calloutContentBase, exports); -var _focusTrapCallout = require("./FocusTrapCallout"); -parcelHelpers.exportAll(_focusTrapCallout, exports); -var _focusTrapCalloutTypes = require("./FocusTrapCallout.types"); -parcelHelpers.exportAll(_focusTrapCalloutTypes, exports); -var _directionalHint = require("../../common/DirectionalHint"); -parcelHelpers.exportAll(_directionalHint, exports); - -},{"./Callout":"9IC7W","./Callout.types":false,"./CalloutContent":false,"./CalloutContent.base":false,"./FocusTrapCallout":false,"./FocusTrapCallout.types":false,"../../common/DirectionalHint":"avdAc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9IC7W":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Callout", ()=>Callout); -var _tslib = require("tslib"); -var _react = require("react"); -var _calloutContent = require("./CalloutContent"); -var _layer = require("../../Layer"); -var Callout = _react.forwardRef(function(_a, forwardedRef) { - var layerProps = _a.layerProps, doNotLayer = _a.doNotLayer, rest = (0, _tslib.__rest)(_a, [ - "layerProps", - "doNotLayer" - ]); - var content = _react.createElement((0, _calloutContent.CalloutContent), (0, _tslib.__assign)({}, rest, { - doNotLayer: doNotLayer, - ref: forwardedRef - })); - return doNotLayer ? content : _react.createElement((0, _layer.Layer), (0, _tslib.__assign)({}, layerProps), content); -}); -Callout.displayName = 'Callout'; - -},{"tslib":"9gizs","react":"jGrId","./CalloutContent":"8K8Ao","../../Layer":"hQjxQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8K8Ao":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CalloutContent", ()=>CalloutContent); -var _utilities = require("../../Utilities"); -var _calloutContentBase = require("./CalloutContent.base"); -var _calloutContentStyles = require("./CalloutContent.styles"); -var CalloutContent = (0, _utilities.styled)((0, _calloutContentBase.CalloutContentBase), (0, _calloutContentStyles.getStyles), undefined, { - scope: 'CalloutContent' -}); - -},{"../../Utilities":"1NZCy","./CalloutContent.base":"fq2Rc","./CalloutContent.styles":"bduHE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fq2Rc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CalloutContentBase", ()=>CalloutContentBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _directionalHint = require("../../common/DirectionalHint"); -var _utilities = require("../../Utilities"); -var _positioning = require("../../utilities/positioning/positioning"); -var _positioning1 = require("../../Positioning"); -var _popup = require("../../Popup"); -var _styling = require("../../Styling"); -var _reactHooks = require("@fluentui/react-hooks"); -var _dom = require("../../utilities/dom"); -var _a; -var COMPONENT_NAME = 'CalloutContentBase'; -var ANIMATIONS = (_a = {}, _a[(0, _positioning1.RectangleEdge).top] = (0, _styling.AnimationClassNames).slideUpIn10, _a[(0, _positioning1.RectangleEdge).bottom] = (0, _styling.AnimationClassNames).slideDownIn10, _a[(0, _positioning1.RectangleEdge).left] = (0, _styling.AnimationClassNames).slideLeftIn10, _a[(0, _positioning1.RectangleEdge).right] = (0, _styling.AnimationClassNames).slideRightIn10, _a); -var BEAK_ORIGIN_POSITION = { - top: 0, - left: 0 -}; -// Microsoft Edge will overwrite inline styles if there is an animation pertaining to that style. -// To help ensure that edge will respect the offscreen style opacity -// filter needs to be added as an additional way to set opacity. -// Also set pointer-events: none so that the callout will not occlude the element it is -// going to be positioned against -var OFF_SCREEN_STYLE = { + }); + return function() { + return async.dispose(); + }; + }); + return needsVerticalScrollBarState; + } + function defaultFocusRestorer(options2) { + var originalElement = options2.originalElement, containsFocus = options2.containsFocus; + if (originalElement && containsFocus && originalElement !== getWindow()) { + setTimeout(function() { + var _a2; + (_a2 = originalElement.focus) === null || _a2 === void 0 ? void 0 : _a2.call(originalElement); + }, 0); + } + } + function useRestoreFocus(props, root) { + var _a2 = props.onRestoreFocus, onRestoreFocus = _a2 === void 0 ? defaultFocusRestorer : _a2; + var originalFocusedElement = React__namespace.useRef(void 0); + var containsFocus = React__namespace.useRef(false); + React__namespace.useEffect(function() { + originalFocusedElement.current = getDocument().activeElement; + if (doesElementContainFocus(root.current)) { + containsFocus.current = true; + } + return function() { + var _a3; + onRestoreFocus === null || onRestoreFocus === void 0 ? void 0 : onRestoreFocus({ + originalElement: originalFocusedElement.current, + containsFocus: containsFocus.current, + documentContainsFocus: ((_a3 = getDocument()) === null || _a3 === void 0 ? void 0 : _a3.hasFocus()) || false + }); + originalFocusedElement.current = void 0; + }; + }, []); + useOnEvent(root, "focus", React__namespace.useCallback(function() { + containsFocus.current = true; + }, []), true); + useOnEvent(root, "blur", React__namespace.useCallback(function(ev) { + if (root.current && ev.relatedTarget && !root.current.contains(ev.relatedTarget)) { + containsFocus.current = false; + } + }, []), true); + } + function useHideSiblingNodes(props, root) { + var shouldHideSiblings = String(props["aria-modal"]).toLowerCase() === "true" && props.enableAriaHiddenSiblings; + React__namespace.useEffect(function() { + if (!(shouldHideSiblings && root.current)) { + return; + } + var unmodalize2 = modalize(root.current); + return unmodalize2; + }, [root, shouldHideSiblings]); + } + var Popup = React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var props = getPropsWithDefaults({ shouldRestoreFocus: true, enableAriaHiddenSiblings: true }, propsWithoutDefaults); + var root = React__namespace.useRef(void 0); + var mergedRootRef = useMergedRefs(root, forwardedRef); + useHideSiblingNodes(props, root); + useRestoreFocus(props, root); + var role = props.role, className2 = props.className, ariaLabel2 = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, style2 = props.style, children2 = props.children, onDismiss = props.onDismiss; + var needsVerticalScrollBar = useScrollbarAsync(props, root); + var onKeyDown = React__namespace.useCallback(function(ev) { + switch (ev.which) { + case KeyCodes.escape: + if (onDismiss) { + onDismiss(ev); + ev.preventDefault(); + ev.stopPropagation(); + } + break; + } + }, [onDismiss]); + var win = useWindow(); + useOnEvent(win, "keydown", onKeyDown); + return React__namespace.createElement("div", __assign$1({ ref: mergedRootRef }, getNativeProps(props, divProperties), { className: className2, role, "aria-label": ariaLabel2, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onKeyDown, style: __assign$1({ overflowY: needsVerticalScrollBar ? "scroll" : void 0, outline: "none" }, style2) }), children2); + }); + Popup.displayName = "Popup"; + var useDocumentEx = function() { + var _a2; + return (_a2 = useDocument()) !== null && _a2 !== void 0 ? _a2 : typeof document !== "undefined" ? document : void 0; + }; + var useWindowEx = function() { + var _a2; + return (_a2 = useWindow()) !== null && _a2 !== void 0 ? _a2 : typeof window !== "undefined" ? window : void 0; + }; + var getDocumentEx = function(ctx) { + var _a2, _b2; + return (_b2 = (_a2 = ctx === null || ctx === void 0 ? void 0 : ctx.window) === null || _a2 === void 0 ? void 0 : _a2.document) !== null && _b2 !== void 0 ? _b2 : typeof document !== "undefined" ? document : void 0; + }; + var getWindowEx = function(ctx) { + var _a2; + return (_a2 = ctx === null || ctx === void 0 ? void 0 : ctx.window) !== null && _a2 !== void 0 ? _a2 : typeof window !== "undefined" ? window : void 0; + }; + var _a$3; + var COMPONENT_NAME$9 = "CalloutContentBase"; + var ANIMATIONS = (_a$3 = {}, _a$3[RectangleEdge.top] = AnimationClassNames.slideUpIn10, _a$3[RectangleEdge.bottom] = AnimationClassNames.slideDownIn10, _a$3[RectangleEdge.left] = AnimationClassNames.slideLeftIn10, _a$3[RectangleEdge.right] = AnimationClassNames.slideRightIn10, _a$3); + var BEAK_ORIGIN_POSITION = { top: 0, left: 0 }; + var OFF_SCREEN_STYLE = { opacity: 0, - filter: 'opacity(0)', - pointerEvents: 'none' -}; -// role and role description go hand-in-hand. Both would be included by spreading getNativeProps for a basic element -// This constant array can be used to filter these out of native props spread on callout root and apply them together on -// calloutMain (the Popup component within the callout) -var ARIA_ROLE_ATTRIBUTES = [ - 'role', - 'aria-roledescription' -]; -var DEFAULT_PROPS = { + filter: "opacity(0)", + pointerEvents: "none" + }; + var ARIA_ROLE_ATTRIBUTES = ["role", "aria-roledescription"]; + var DEFAULT_PROPS$6 = { preventDismissOnLostFocus: false, preventDismissOnScroll: false, preventDismissOnResize: false, @@ -75466,57103 +43342,43810 @@ var DEFAULT_PROPS = { beakWidth: 16, gapSpace: 0, minPagePadding: 8, - directionalHint: (0, _directionalHint.DirectionalHint).bottomAutoEdge -}; -var getClassNames = (0, _utilities.classNamesFunction)({ + directionalHint: DirectionalHint.bottomAutoEdge + }; + var getClassNames$p = classNamesFunction({ disableCaching: true -}); -/** - * (Hook) to return a function to lazily fetch the bounds of the target element for the callout. - */ function useBounds(_a, targetRef, targetWindow) { - var bounds = _a.bounds, _b = _a.minPagePadding, minPagePadding = _b === void 0 ? DEFAULT_PROPS.minPagePadding : _b, target = _a.target; - var _c = _react.useState(false), targetWindowResized = _c[0], setTargetWindowResized = _c[1]; - var cachedBounds = _react.useRef(); - var getBounds = _react.useCallback(function() { - if (!cachedBounds.current || targetWindowResized) { - var currentBounds = typeof bounds === 'function' ? targetWindow ? bounds(target, targetWindow) : undefined : bounds; - if (!currentBounds && targetWindow) { - currentBounds = (0, _positioning1.getBoundsFromTargetWindow)(targetRef.current, targetWindow); - currentBounds = { - top: currentBounds.top + minPagePadding, - left: currentBounds.left + minPagePadding, - right: currentBounds.right - minPagePadding, - bottom: currentBounds.bottom - minPagePadding, - width: currentBounds.width - minPagePadding * 2, - height: currentBounds.height - minPagePadding * 2 - }; - } - cachedBounds.current = currentBounds; - targetWindowResized && setTargetWindowResized(false); - } - return cachedBounds.current; - }, [ - bounds, - minPagePadding, - target, - targetRef, - targetWindow, - targetWindowResized - ]); - var async = (0, _reactHooks.useAsync)(); - (0, _reactHooks.useOnEvent)(targetWindow, 'resize', async.debounce(function() { - setTargetWindowResized(true); - }, 500, { - leading: true - })); + // disabling caching because stylesProp.position mutates often + }); + function useBounds(_a2, targetRef, targetWindow) { + var bounds2 = _a2.bounds, _b2 = _a2.minPagePadding, minPagePadding = _b2 === void 0 ? DEFAULT_PROPS$6.minPagePadding : _b2, target2 = _a2.target; + var _c2 = React__namespace.useState(false), targetWindowResized = _c2[0], setTargetWindowResized = _c2[1]; + var cachedBounds = React__namespace.useRef(void 0); + var getBounds = React__namespace.useCallback(function() { + if (!cachedBounds.current || targetWindowResized) { + var currentBounds = typeof bounds2 === "function" ? targetWindow ? bounds2(target2, targetWindow) : void 0 : bounds2; + if (!currentBounds && targetWindow) { + currentBounds = getBoundsFromTargetWindow(targetRef.current, targetWindow); + currentBounds = { + top: currentBounds.top + minPagePadding, + left: currentBounds.left + minPagePadding, + right: currentBounds.right - minPagePadding, + bottom: currentBounds.bottom - minPagePadding, + width: currentBounds.width - minPagePadding * 2, + height: currentBounds.height - minPagePadding * 2 + }; + } + cachedBounds.current = currentBounds; + targetWindowResized && setTargetWindowResized(false); + } + return cachedBounds.current; + }, [bounds2, minPagePadding, target2, targetRef, targetWindow, targetWindowResized]); + var async = useAsync(); + useOnEvent(targetWindow, "resize", async.debounce(function() { + setTargetWindowResized(true); + }, 500, { leading: true })); return getBounds; -} -/** - * (Hook) to return the maximum available height for the Callout to render into. - */ function useMaxHeight(_a, getBounds, targetRef, positions) { - var _b; - var calloutMaxHeight = _a.calloutMaxHeight, finalHeight = _a.finalHeight, directionalHint = _a.directionalHint, directionalHintFixed = _a.directionalHintFixed, hidden = _a.hidden, gapSpace = _a.gapSpace, beakWidth = _a.beakWidth, isBeakVisible = _a.isBeakVisible, coverTarget = _a.coverTarget; - var _c = _react.useState(), maxHeight = _c[0], setMaxHeight = _c[1]; - var _d = (_b = positions === null || positions === void 0 ? void 0 : positions.elementPosition) !== null && _b !== void 0 ? _b : {}, top = _d.top, bottom = _d.bottom; - var targetRect = (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) ? (0, _positioning.getRectangleFromTarget)(targetRef.current) : undefined; - _react.useEffect(function() { - var _a; - var bounds = (_a = getBounds()) !== null && _a !== void 0 ? _a : {}; - var topBounds = bounds.top; - var bottomBounds = bounds.bottom; - var calculatedHeight; - // If aligned to top edge of target and not covering target, update bottom bounds to the - // top of the target (accounting for gap space and beak) - if ((positions === null || positions === void 0 ? void 0 : positions.targetEdge) === (0, _positioning1.RectangleEdge).top && (targetRect === null || targetRect === void 0 ? void 0 : targetRect.top) && !coverTarget) bottomBounds = targetRect.top - (0, _positioning.calculateGapSpace)(isBeakVisible, beakWidth, gapSpace); - if (typeof top === 'number' && bottomBounds) calculatedHeight = bottomBounds - top; - else if (typeof bottom === 'number' && typeof topBounds === 'number' && bottomBounds) calculatedHeight = bottomBounds - topBounds - bottom; - if (!calloutMaxHeight && !hidden || calloutMaxHeight && calculatedHeight && calloutMaxHeight > calculatedHeight) setMaxHeight(calculatedHeight); - else if (calloutMaxHeight) setMaxHeight(calloutMaxHeight); - else setMaxHeight(undefined); + } + function useMaxHeight(_a2, getBounds, targetRef, positions2) { + var _b2; + var calloutMaxHeight = _a2.calloutMaxHeight, finalHeight = _a2.finalHeight, directionalHint = _a2.directionalHint, directionalHintFixed = _a2.directionalHintFixed, hidden = _a2.hidden, gapSpace = _a2.gapSpace, beakWidth = _a2.beakWidth, isBeakVisible = _a2.isBeakVisible, coverTarget = _a2.coverTarget; + var _c2 = React__namespace.useState(), maxHeight = _c2[0], setMaxHeight = _c2[1]; + var _d2 = (_b2 = positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition) !== null && _b2 !== void 0 ? _b2 : {}, top = _d2.top, bottom = _d2.bottom; + var targetRect = (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) ? getRectangleFromTarget(targetRef.current) : void 0; + React__namespace.useEffect(function() { + var _a3; + var bounds2 = (_a3 = getBounds()) !== null && _a3 !== void 0 ? _a3 : {}; + var topBounds = bounds2.top; + var bottomBounds = bounds2.bottom; + var calculatedHeight; + if ((positions2 === null || positions2 === void 0 ? void 0 : positions2.targetEdge) === RectangleEdge.top && (targetRect === null || targetRect === void 0 ? void 0 : targetRect.top) && !coverTarget) { + bottomBounds = targetRect.top - calculateGapSpace(isBeakVisible, beakWidth, gapSpace); + } + if (typeof top === "number" && bottomBounds) { + calculatedHeight = bottomBounds - top; + } else if (typeof bottom === "number" && typeof topBounds === "number" && bottomBounds) { + calculatedHeight = bottomBounds - topBounds - bottom; + } + if (!calloutMaxHeight && !hidden || calloutMaxHeight && calculatedHeight && calloutMaxHeight > calculatedHeight) { + setMaxHeight(calculatedHeight); + } else if (calloutMaxHeight) { + setMaxHeight(calloutMaxHeight); + } else { + setMaxHeight(void 0); + } }, [ - bottom, - calloutMaxHeight, - finalHeight, - directionalHint, - directionalHintFixed, - getBounds, - hidden, - positions, - top, - gapSpace, - beakWidth, - isBeakVisible, - targetRect, - coverTarget + bottom, + calloutMaxHeight, + finalHeight, + directionalHint, + directionalHintFixed, + getBounds, + hidden, + positions2, + top, + gapSpace, + beakWidth, + isBeakVisible, + targetRect, + coverTarget ]); return maxHeight; -} -/** - * (Hook) to find the current position of Callout. If Callout is resized then a new position is calculated. - */ function usePositions(props, hostElement, calloutElement, targetRef, getBounds, popupRef) { - var _a = _react.useState(), positions = _a[0], setPositions = _a[1]; - var positionAttempts = _react.useRef(0); - var previousTarget = _react.useRef(); - var async = (0, _reactHooks.useAsync)(); - var hidden = props.hidden, target = props.target, finalHeight = props.finalHeight, calloutMaxHeight = props.calloutMaxHeight, onPositioned = props.onPositioned, directionalHint = props.directionalHint, hideOverflow = props.hideOverflow, preferScrollResizePositioning = props.preferScrollResizePositioning; - var win = (0, _dom.useWindowEx)(); - var localRef = _react.useRef(); + } + function usePositions(props, hostElement, calloutElement, targetRef, getBounds, popupRef) { + var _a2 = React__namespace.useState(), positions2 = _a2[0], setPositions = _a2[1]; + var positionAttempts = React__namespace.useRef(0); + var previousTarget = React__namespace.useRef(void 0); + var async = useAsync(); + var hidden = props.hidden, target2 = props.target, finalHeight = props.finalHeight, calloutMaxHeight = props.calloutMaxHeight, onPositioned = props.onPositioned, directionalHint = props.directionalHint, hideOverflow = props.hideOverflow, preferScrollResizePositioning = props.preferScrollResizePositioning; + var win = useWindowEx(); + var localRef = React__namespace.useRef(void 0); var popupStyles; if (localRef.current !== popupRef.current) { - localRef.current = popupRef.current; - popupStyles = popupRef.current ? win === null || win === void 0 ? void 0 : win.getComputedStyle(popupRef.current) : undefined; + localRef.current = popupRef.current; + popupStyles = popupRef.current ? win === null || win === void 0 ? void 0 : win.getComputedStyle(popupRef.current) : void 0; } var popupOverflowY = popupStyles === null || popupStyles === void 0 ? void 0 : popupStyles.overflowY; - _react.useEffect(function() { - if (!hidden) { - var timerId_1 = async.requestAnimationFrame(function() { - var _a, _b; - if (hostElement.current && calloutElement) { - var currentProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - target: targetRef.current, - bounds: getBounds() - }); - // duplicate calloutElement & remove useMaxHeight's maxHeight for position calc - var dupeCalloutElement = calloutElement.cloneNode(true); - dupeCalloutElement.style.maxHeight = calloutMaxHeight ? "".concat(calloutMaxHeight) : ''; - dupeCalloutElement.style.visibility = 'hidden'; - (_a = calloutElement.parentElement) === null || _a === void 0 || _a.appendChild(dupeCalloutElement); - var previousPositions = previousTarget.current === target ? positions : undefined; - // only account for scroll resizing if styles allow callout to scroll - // (popup styles determine if callout will scroll) - var isOverflowYHidden = hideOverflow || popupOverflowY === 'clip' || popupOverflowY === 'hidden'; - var shouldScroll = preferScrollResizePositioning && !isOverflowYHidden; - // If there is a finalHeight given then we assume that the user knows and will handle - // additional positioning adjustments so we should call positionCard - var newPositions = finalHeight ? (0, _positioning1.positionCard)(currentProps, hostElement.current, dupeCalloutElement, previousPositions, win) : (0, _positioning1.positionCallout)(currentProps, hostElement.current, dupeCalloutElement, previousPositions, shouldScroll, undefined, win); - // clean up duplicate calloutElement - (_b = calloutElement.parentElement) === null || _b === void 0 || _b.removeChild(dupeCalloutElement); - // Set the new position only when the positions do not exist or one of the new callout positions - // is different. The position should not change if the position is within 2 decimal places. - if (!positions && newPositions || positions && newPositions && !arePositionsEqual(positions, newPositions) && positionAttempts.current < 5) { - // We should not reposition the callout more than a few times, if it is then the content is likely resizing - // and we should stop trying to reposition to prevent a stack overflow. - positionAttempts.current++; - setPositions(newPositions); - } else if (positionAttempts.current > 0) { - // Only call the onPositioned callback if the callout has been re-positioned at least once. - positionAttempts.current = 0; - onPositioned === null || onPositioned === void 0 || onPositioned(positions); - } - } - }, calloutElement); - previousTarget.current = target; - return function() { - async.cancelAnimationFrame(timerId_1); - previousTarget.current = undefined; - }; - } else { - // When the callout is hidden, clear position state so that it is not accidentally used next render. - setPositions(undefined); - positionAttempts.current = 0; - } - }, [ - hidden, - directionalHint, - async, - calloutElement, - calloutMaxHeight, - hostElement, - targetRef, - finalHeight, - getBounds, - onPositioned, - positions, - props, - target, - hideOverflow, - preferScrollResizePositioning, - popupOverflowY, - win - ]); - return positions; -} -/** - * (Hook) to set up behavior to automatically focus the callout when it appears, if indicated by props. - */ function useAutoFocus(_a, positions, calloutElement) { - var hidden = _a.hidden, setInitialFocus = _a.setInitialFocus; - var async = (0, _reactHooks.useAsync)(); - var hasPositions = !!positions; - _react.useEffect(function() { - if (!hidden && setInitialFocus && hasPositions && calloutElement) { - var timerId_2 = async.requestAnimationFrame(function() { - return (0, _utilities.focusFirstChild)(calloutElement); - }, calloutElement); - return function() { - return async.cancelAnimationFrame(timerId_2); - }; - } + React__namespace.useEffect(function() { + if (!hidden) { + var timerId_1 = async.requestAnimationFrame(function() { + var _a3, _b2; + if (hostElement.current && calloutElement) { + var currentProps = __assign$1(__assign$1({}, props), { target: targetRef.current, bounds: getBounds() }); + var dupeCalloutElement = calloutElement.cloneNode(true); + dupeCalloutElement.style.maxHeight = calloutMaxHeight ? "".concat(calloutMaxHeight) : ""; + dupeCalloutElement.style.visibility = "hidden"; + (_a3 = calloutElement.parentElement) === null || _a3 === void 0 ? void 0 : _a3.appendChild(dupeCalloutElement); + var previousPositions = previousTarget.current === target2 ? positions2 : void 0; + var isOverflowYHidden = hideOverflow || popupOverflowY === "clip" || popupOverflowY === "hidden"; + var shouldScroll = preferScrollResizePositioning && !isOverflowYHidden; + var newPositions = finalHeight ? positionCard(currentProps, hostElement.current, dupeCalloutElement, previousPositions, win) : positionCallout(currentProps, hostElement.current, dupeCalloutElement, previousPositions, shouldScroll, void 0, win); + (_b2 = calloutElement.parentElement) === null || _b2 === void 0 ? void 0 : _b2.removeChild(dupeCalloutElement); + if (!positions2 && newPositions || positions2 && newPositions && !arePositionsEqual(positions2, newPositions) && positionAttempts.current < 5) { + positionAttempts.current++; + setPositions(newPositions); + } else if (positionAttempts.current > 0) { + positionAttempts.current = 0; + onPositioned === null || onPositioned === void 0 ? void 0 : onPositioned(positions2); + } + } + }, calloutElement); + previousTarget.current = target2; + return function() { + async.cancelAnimationFrame(timerId_1); + previousTarget.current = void 0; + }; + } else { + setPositions(void 0); + positionAttempts.current = 0; + } }, [ - hidden, - hasPositions, - async, - calloutElement, - setInitialFocus + hidden, + directionalHint, + async, + calloutElement, + calloutMaxHeight, + hostElement, + targetRef, + finalHeight, + getBounds, + onPositioned, + positions2, + props, + target2, + hideOverflow, + preferScrollResizePositioning, + popupOverflowY, + win ]); -} -/** - * (Hook) to set up various handlers to dismiss the popup when it loses focus or the window scrolls or similar cases. - */ function useDismissHandlers(_a, positions, hostElement, targetRef, targetWindow) { - var hidden = _a.hidden, onDismiss = _a.onDismiss, // eslint-disable-next-line deprecation/deprecation - preventDismissOnScroll = _a.preventDismissOnScroll, // eslint-disable-next-line deprecation/deprecation - preventDismissOnResize = _a.preventDismissOnResize, // eslint-disable-next-line deprecation/deprecation - preventDismissOnLostFocus = _a.preventDismissOnLostFocus, dismissOnTargetClick = _a.dismissOnTargetClick, shouldDismissOnWindowFocus = _a.shouldDismissOnWindowFocus, preventDismissOnEvent = _a.preventDismissOnEvent; - var isMouseDownOnPopup = _react.useRef(false); - var async = (0, _reactHooks.useAsync)(); - var mouseDownHandlers = (0, _reactHooks.useConst)([ - function() { - isMouseDownOnPopup.current = true; - }, - function() { - isMouseDownOnPopup.current = false; - } - ]); - var positionsExists = !!positions; - _react.useEffect(function() { - var dismissOnScroll = function(ev) { - if (positionsExists && !preventDismissOnScroll) dismissOnClickOrScroll(ev); - }; - var dismissOnResize = function(ev) { - if (!preventDismissOnResize && !(preventDismissOnEvent && preventDismissOnEvent(ev))) onDismiss === null || onDismiss === void 0 || onDismiss(ev); - }; - var dismissOnLostFocus = function(ev) { - if (!preventDismissOnLostFocus) dismissOnClickOrScroll(ev); - }; - var dismissOnClickOrScroll = function(ev) { - var eventPaths = ev.composedPath ? ev.composedPath() : []; - var target = eventPaths.length > 0 ? eventPaths[0] : ev.target; - var isEventTargetOutsideCallout = hostElement.current && !(0, _utilities.elementContains)(hostElement.current, target); - // If mouse is pressed down on callout but moved outside then released, don't dismiss the callout. - if (isEventTargetOutsideCallout && isMouseDownOnPopup.current) { - isMouseDownOnPopup.current = false; - return; - } - if (!targetRef.current && isEventTargetOutsideCallout || ev.target !== targetWindow && isEventTargetOutsideCallout && (!targetRef.current || 'stopPropagation' in targetRef.current || dismissOnTargetClick || target !== targetRef.current && !(0, _utilities.elementContains)(targetRef.current, target))) { - if (preventDismissOnEvent && preventDismissOnEvent(ev)) return; - onDismiss === null || onDismiss === void 0 || onDismiss(ev); - } - }; - var dismissOnTargetWindowBlur = function(ev) { - // Do nothing - if (!shouldDismissOnWindowFocus) return; - if ((preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnLostFocus) && !(targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.hasFocus()) && ev.relatedTarget === null) onDismiss === null || onDismiss === void 0 || onDismiss(ev); - }; - // This is added so the callout will dismiss when the window is scrolled - // but not when something inside the callout is scrolled. The delay seems - // to be required to avoid React firing an async focus event in IE from - // the target changing focus quickly prior to rendering the callout. - var disposablesPromise = new Promise(function(resolve) { - async.setTimeout(function() { - if (!hidden && targetWindow) { - var disposables_1 = [ - (0, _utilities.on)(targetWindow, 'scroll', dismissOnScroll, true), - (0, _utilities.on)(targetWindow, 'resize', dismissOnResize, true), - (0, _utilities.on)(targetWindow.document.documentElement, 'focus', dismissOnLostFocus, true), - (0, _utilities.on)(targetWindow.document.documentElement, 'click', dismissOnLostFocus, true), - (0, _utilities.on)(targetWindow, 'blur', dismissOnTargetWindowBlur, true) - ]; - resolve(function() { - disposables_1.forEach(function(dispose) { - return dispose(); - }); - }); - } - }, 0); - }); + return positions2; + } + function useAutoFocus(_a2, positions2, calloutElement) { + var hidden = _a2.hidden, setInitialFocus = _a2.setInitialFocus; + var async = useAsync(); + var hasPositions = !!positions2; + React__namespace.useEffect(function() { + if (!hidden && setInitialFocus && hasPositions && calloutElement) { + var timerId_2 = async.requestAnimationFrame(function() { + return focusFirstChild(calloutElement); + }, calloutElement); return function() { - disposablesPromise.then(function(dispose) { + return async.cancelAnimationFrame(timerId_2); + }; + } + }, [hidden, hasPositions, async, calloutElement, setInitialFocus]); + } + function useDismissHandlers(_a2, positions2, hostElement, targetRef, targetWindow) { + var hidden = _a2.hidden, onDismiss = _a2.onDismiss, preventDismissOnScroll = _a2.preventDismissOnScroll, preventDismissOnResize = _a2.preventDismissOnResize, preventDismissOnLostFocus = _a2.preventDismissOnLostFocus, dismissOnTargetClick = _a2.dismissOnTargetClick, shouldDismissOnWindowFocus = _a2.shouldDismissOnWindowFocus, preventDismissOnEvent = _a2.preventDismissOnEvent; + var isMouseDownOnPopup = React__namespace.useRef(false); + var async = useAsync(); + var mouseDownHandlers = useConst([ + function() { + isMouseDownOnPopup.current = true; + }, + function() { + isMouseDownOnPopup.current = false; + } + ]); + var positionsExists = !!positions2; + React__namespace.useEffect(function() { + var dismissOnScroll = function(ev) { + if (positionsExists && !preventDismissOnScroll) { + dismissOnClickOrScroll(ev); + } + }; + var dismissOnResize = function(ev) { + if (!preventDismissOnResize && !(preventDismissOnEvent && preventDismissOnEvent(ev))) { + onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(ev); + } + }; + var dismissOnLostFocus = function(ev) { + if (!preventDismissOnLostFocus) { + dismissOnClickOrScroll(ev); + } + }; + var dismissOnClickOrScroll = function(ev) { + var eventPaths = ev.composedPath ? ev.composedPath() : []; + var target2 = eventPaths.length > 0 ? eventPaths[0] : ev.target; + var isEventTargetOutsideCallout = hostElement.current && !elementContains(hostElement.current, target2); + if (isEventTargetOutsideCallout && isMouseDownOnPopup.current) { + isMouseDownOnPopup.current = false; + return; + } + if (!targetRef.current && isEventTargetOutsideCallout || ev.target !== targetWindow && isEventTargetOutsideCallout && (!targetRef.current || "stopPropagation" in targetRef.current || dismissOnTargetClick || target2 !== targetRef.current && !elementContains(targetRef.current, target2))) { + if (preventDismissOnEvent && preventDismissOnEvent(ev)) { + return; + } + onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(ev); + } + }; + var dismissOnTargetWindowBlur = function(ev) { + if (!shouldDismissOnWindowFocus) { + return; + } + if ((preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnLostFocus) && !(targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.hasFocus()) && ev.relatedTarget === null) { + onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(ev); + } + }; + var disposablesPromise = new Promise(function(resolve2) { + async.setTimeout(function() { + if (!hidden && targetWindow) { + var disposables_1 = [ + on$1(targetWindow, "scroll", dismissOnScroll, true), + on$1(targetWindow, "resize", dismissOnResize, true), + on$1(targetWindow.document.documentElement, "focus", dismissOnLostFocus, true), + on$1(targetWindow.document.documentElement, "click", dismissOnLostFocus, true), + on$1(targetWindow, "blur", dismissOnTargetWindowBlur, true) + ]; + resolve2(function() { + disposables_1.forEach(function(dispose) { return dispose(); + }); }); - }; + } + }, 0); + }); + return function() { + disposablesPromise.then(function(dispose) { + return dispose(); + }); + }; }, [ - hidden, - async, - hostElement, - targetRef, - targetWindow, - onDismiss, - shouldDismissOnWindowFocus, - dismissOnTargetClick, - preventDismissOnLostFocus, - preventDismissOnResize, - preventDismissOnScroll, - positionsExists, - preventDismissOnEvent + hidden, + async, + hostElement, + targetRef, + targetWindow, + onDismiss, + shouldDismissOnWindowFocus, + dismissOnTargetClick, + preventDismissOnLostFocus, + preventDismissOnResize, + preventDismissOnScroll, + positionsExists, + preventDismissOnEvent ]); return mouseDownHandlers; -} -var CalloutContentBase = _react.memo(_react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var props = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var styles = props.styles, style = props.style, ariaLabel = props.ariaLabel, ariaDescribedBy = props.ariaDescribedBy, ariaLabelledBy = props.ariaLabelledBy, className = props.className, isBeakVisible = props.isBeakVisible, children = props.children, beakWidth = props.beakWidth, calloutWidth = props.calloutWidth, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer, finalHeight = props.finalHeight, _a = props.hideOverflow, hideOverflow = _a === void 0 ? !!finalHeight : _a, backgroundColor = props.backgroundColor, calloutMaxHeight = props.calloutMaxHeight, onScroll = props.onScroll, // eslint-disable-next-line deprecation/deprecation - _b = props.shouldRestoreFocus, // eslint-disable-next-line deprecation/deprecation - shouldRestoreFocus = _b === void 0 ? true : _b, target = props.target, hidden = props.hidden, onLayerMounted = props.onLayerMounted, popupProps = props.popupProps; - var hostElement = _react.useRef(null); - var popupRef = _react.useRef(null); - var mergedPopupRefs = (0, _reactHooks.useMergedRefs)(popupRef, popupProps === null || popupProps === void 0 ? void 0 : popupProps.ref); - var _c = _react.useState(null), calloutElement = _c[0], setCalloutElement = _c[1]; - var calloutCallback = _react.useCallback(function(calloutEl) { - setCalloutElement(calloutEl); + } + var CalloutContentBase = React__namespace.memo(React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var props = getPropsWithDefaults(DEFAULT_PROPS$6, propsWithoutDefaults); + var styles = props.styles, style2 = props.style, ariaLabel2 = props.ariaLabel, ariaDescribedBy = props.ariaDescribedBy, ariaLabelledBy = props.ariaLabelledBy, className2 = props.className, isBeakVisible = props.isBeakVisible, children2 = props.children, beakWidth = props.beakWidth, calloutWidth = props.calloutWidth, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer, finalHeight = props.finalHeight, _a2 = props.hideOverflow, hideOverflow = _a2 === void 0 ? !!finalHeight : _a2, backgroundColor = props.backgroundColor, calloutMaxHeight = props.calloutMaxHeight, onScroll = props.onScroll, _b2 = props.shouldRestoreFocus, shouldRestoreFocus = _b2 === void 0 ? true : _b2, target2 = props.target, hidden = props.hidden, onLayerMounted = props.onLayerMounted, popupProps = props.popupProps; + var hostElement = React__namespace.useRef(null); + var popupRef = React__namespace.useRef(null); + var mergedPopupRefs = useMergedRefs(popupRef, popupProps === null || popupProps === void 0 ? void 0 : popupProps.ref); + var _c2 = React__namespace.useState(null), calloutElement = _c2[0], setCalloutElement = _c2[1]; + var calloutCallback = React__namespace.useCallback(function(calloutEl) { + setCalloutElement(calloutEl); + }, []); + var rootRef = useMergedRefs(hostElement, forwardedRef); + var _d2 = useTarget(props.target, { + current: calloutElement + }), targetRef = _d2[0], targetWindow = _d2[1]; + var getBounds = useBounds(props, targetRef, targetWindow); + var positions2 = usePositions(props, hostElement, calloutElement, targetRef, getBounds, mergedPopupRefs); + var maxHeight = useMaxHeight(props, getBounds, targetRef, positions2); + var _e2 = useDismissHandlers(props, positions2, hostElement, targetRef, targetWindow), mouseDownOnPopup = _e2[0], mouseUpOnPopup = _e2[1]; + var isForcedInBounds = (positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition.top) && (positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition.bottom); + var cssPositions = __assign$1(__assign$1({}, positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition), { maxHeight }); + if (isForcedInBounds) { + cssPositions.bottom = void 0; + } + useAutoFocus(props, positions2, calloutElement); + React__namespace.useEffect(function() { + if (!hidden) { + onLayerMounted === null || onLayerMounted === void 0 ? void 0 : onLayerMounted(); + } + }, [hidden]); + if (!targetWindow) { + return null; + } + var overflowYHidden = hideOverflow; + var beakVisible = isBeakVisible && !!target2; + var classNames2 = getClassNames$p(styles, { + theme: props.theme, + className: className2, + overflowYHidden, + calloutWidth, + positions: positions2, + beakWidth, + backgroundColor, + calloutMaxWidth, + calloutMinWidth, + doNotLayer + }); + var overflowStyle = __assign$1(__assign$1({ maxHeight: calloutMaxHeight ? calloutMaxHeight : "100%" }, style2), overflowYHidden && { overflowY: "hidden" }); + var visibilityStyle = props.hidden ? { visibility: "hidden" } : void 0; + return React__namespace.createElement( + "div", + { ref: rootRef, className: classNames2.container, style: visibilityStyle }, + React__namespace.createElement( + "div", + __assign$1({}, getNativeProps(props, divProperties, ARIA_ROLE_ATTRIBUTES), { + className: css(classNames2.root, positions2 && positions2.targetEdge && ANIMATIONS[positions2.targetEdge]), + style: positions2 ? __assign$1({}, cssPositions) : OFF_SCREEN_STYLE, + // Safari and Firefox on Mac OS requires this to back-stop click events so focus remains in the Callout. + // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus + tabIndex: -1, + ref: calloutCallback + }), + beakVisible && React__namespace.createElement("div", { className: classNames2.beak, style: getBeakPosition(positions2) }), + beakVisible && React__namespace.createElement("div", { className: classNames2.beakCurtain }), + React__namespace.createElement( + Popup, + __assign$1({ + // don't use getNativeElementProps for role and roledescription because it will also + // pass through data-* props (resulting in them being used in two places) + role: props.role, + "aria-roledescription": props["aria-roledescription"], + ariaDescribedBy, + ariaLabel: ariaLabel2, + ariaLabelledBy, + className: classNames2.calloutMain, + onDismiss: props.onDismiss, + onMouseDown: mouseDownOnPopup, + onMouseUp: mouseUpOnPopup, + onRestoreFocus: props.onRestoreFocus, + onScroll, + // eslint-disable-next-line @typescript-eslint/no-deprecated + shouldRestoreFocus, + style: overflowStyle + }, popupProps, { ref: mergedPopupRefs }), + children2 + ) + ) + ); + }), function(previousProps, nextProps) { + if (!nextProps.shouldUpdateWhenHidden && previousProps.hidden && nextProps.hidden) { + return true; + } + return shallowCompare(previousProps, nextProps); + }); + function getBeakPosition(positions2) { + var _a2, _b2; + var beakPositionStyle = __assign$1(__assign$1({}, (_a2 = positions2 === null || positions2 === void 0 ? void 0 : positions2.beakPosition) === null || _a2 === void 0 ? void 0 : _a2.elementPosition), { display: ((_b2 = positions2 === null || positions2 === void 0 ? void 0 : positions2.beakPosition) === null || _b2 === void 0 ? void 0 : _b2.hideBeak) ? "none" : void 0 }); + if (!beakPositionStyle.top && !beakPositionStyle.bottom && !beakPositionStyle.left && !beakPositionStyle.right) { + beakPositionStyle.left = BEAK_ORIGIN_POSITION.left; + beakPositionStyle.top = BEAK_ORIGIN_POSITION.top; + } + return beakPositionStyle; + } + function arePositionsEqual(prevElementPositions, newElementPosition) { + return comparePositions(prevElementPositions.elementPosition, newElementPosition.elementPosition) && comparePositions(prevElementPositions.beakPosition.elementPosition, newElementPosition.beakPosition.elementPosition); + } + function comparePositions(prevElementPositions, newElementPositions) { + for (var key2 in newElementPositions) { + if (newElementPositions.hasOwnProperty(key2)) { + var oldPositionEdge = prevElementPositions[key2]; + var newPositionEdge = newElementPositions[key2]; + if (oldPositionEdge !== void 0 && newPositionEdge !== void 0) { + if (oldPositionEdge.toFixed(2) !== newPositionEdge.toFixed(2)) { + return false; + } + } else { + return false; + } + } + } + return true; + } + CalloutContentBase.displayName = COMPONENT_NAME$9; + function getBeakStyle(beakWidth) { + return { + height: beakWidth, + width: beakWidth + }; + } + var GlobalClassNames$g = { + container: "ms-Callout-container", + root: "ms-Callout", + beak: "ms-Callout-beak", + beakCurtain: "ms-Callout-beakCurtain", + calloutMain: "ms-Callout-main" + }; + var getStyles$u = function(props) { + var _a2; + var theme = props.theme, className2 = props.className, overflowYHidden = props.overflowYHidden, calloutWidth = props.calloutWidth, beakWidth = props.beakWidth, backgroundColor = props.backgroundColor, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer; + var classNames2 = getGlobalClassNames(GlobalClassNames$g, theme); + var semanticColors = theme.semanticColors, effects = theme.effects; + return { + container: [ + classNames2.container, + { + position: "relative" + } + ], + root: [ + classNames2.root, + theme.fonts.medium, + { + position: "absolute", + display: "flex", + zIndex: doNotLayer ? ZIndexes.Layer : void 0, + boxSizing: "border-box", + borderRadius: effects.roundedCorner2, + boxShadow: effects.elevation16, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + borderWidth: 1, + borderStyle: "solid", + borderColor: "WindowText" + }, _a2) + }, + focusClear(), + className2, + !!calloutWidth && { width: calloutWidth }, + !!calloutMaxWidth && { maxWidth: calloutMaxWidth }, + !!calloutMinWidth && { minWidth: calloutMinWidth } + ], + beak: [ + classNames2.beak, + { + position: "absolute", + backgroundColor: semanticColors.menuBackground, + boxShadow: "inherit", + border: "inherit", + boxSizing: "border-box", + transform: "rotate(45deg)" + }, + getBeakStyle(beakWidth), + backgroundColor && { + backgroundColor + } + ], + beakCurtain: [ + classNames2.beakCurtain, + { + position: "absolute", + top: 0, + right: 0, + bottom: 0, + left: 0, + backgroundColor: semanticColors.menuBackground, + borderRadius: effects.roundedCorner2 + } + ], + calloutMain: [ + classNames2.calloutMain, + { + backgroundColor: semanticColors.menuBackground, + overflowX: "hidden", + overflowY: "auto", + position: "relative", + width: "100%", + borderRadius: effects.roundedCorner2 + }, + overflowYHidden && { + overflowY: "hidden" + }, + backgroundColor && { + backgroundColor + } + ] + }; + }; + var CalloutContent = styled(CalloutContentBase, getStyles$u, void 0, { + scope: "CalloutContent" + }); + var PortalCompatContext = React__namespace.createContext(void 0); + var portalCompatContextDefaultValue = function() { + return function() { + return void 0; + }; + }; + PortalCompatContext.Provider; + function usePortalCompat() { + var _React_useContext; + return (_React_useContext = React__namespace.useContext(PortalCompatContext)) !== null && _React_useContext !== void 0 ? _React_useContext : portalCompatContextDefaultValue; + } + var getClassNames$o = classNamesFunction(); + var getFabricTheme = memoizeFunction(function(theme, isRTL) { + return createTheme(__assign$1(__assign$1({}, theme), { rtl: isRTL })); + }); + var getDir = function(_a2) { + var theme = _a2.theme, dir = _a2.dir; + var contextDir = getRTL(theme) ? "rtl" : "ltr"; + var pageDir = getRTL() ? "rtl" : "ltr"; + var componentDir = dir ? dir : contextDir; + return { + // If Fabric dir !== contextDir + // Or If contextDir !== pageDir + // Then we need to set dir of the Fabric root + rootDir: componentDir !== contextDir || componentDir !== pageDir ? componentDir : dir, + // If dir !== contextDir || pageDir + // then set contextual theme around content + needsTheme: componentDir !== contextDir + }; + }; + var FabricBase = React__namespace.forwardRef(function(props, ref2) { + var className2 = props.className, theme = props.theme, applyTheme = props.applyTheme, applyThemeToBody = props.applyThemeToBody, styles = props.styles; + var classNames2 = getClassNames$o(styles, { + theme, + applyTheme, + className: className2 + }); + var rootElement = React__namespace.useRef(null); + useApplyThemeToBody(applyThemeToBody, classNames2, rootElement); + return React__namespace.createElement(React__namespace.Fragment, null, useRenderedContent(props, classNames2, rootElement, ref2)); + }); + FabricBase.displayName = "FabricBase"; + function useRenderedContent(props, _a2, rootElement, ref2) { + var root = _a2.root; + var _b2 = props.as, Root = _b2 === void 0 ? "div" : _b2, dir = props.dir, theme = props.theme; + var divProps = getNativeProps(props, divProperties, ["dir"]); + var _c2 = getDir(props), rootDir = _c2.rootDir, needsTheme = _c2.needsTheme; + var renderedContent = React__namespace.createElement( + FocusRectsProvider, + { providerRef: rootElement }, + React__namespace.createElement(Root, __assign$1({ dir: rootDir }, divProps, { className: root, ref: useMergedRefs(rootElement, ref2) })) + ); + if (needsTheme) { + renderedContent = // eslint-disable-next-line @typescript-eslint/no-deprecated + React__namespace.createElement(Customizer, { settings: { theme: getFabricTheme(theme, dir === "rtl") } }, renderedContent); + } + return renderedContent; + } + function useApplyThemeToBody(applyThemeToBody, _a2, rootElement) { + var bodyThemed = _a2.bodyThemed; + React__namespace.useEffect(function() { + if (applyThemeToBody) { + var currentDoc_1 = getDocument(rootElement.current); + if (currentDoc_1) { + currentDoc_1.body.classList.add(bodyThemed); + return function() { + currentDoc_1.body.classList.remove(bodyThemed); + }; + } + } + }, [bodyThemed, applyThemeToBody, rootElement]); + return rootElement; + } + var inheritFont = { fontFamily: "inherit" }; + var GlobalClassNames$f = { + root: "ms-Fabric", + bodyThemed: "ms-Fabric-bodyThemed" + }; + var getStyles$t = function(props) { + var applyTheme = props.applyTheme, className2 = props.className, preventBlanketFontInheritance = props.preventBlanketFontInheritance, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$f, theme); + return { + root: [ + classNames2.root, + theme.fonts.medium, + { + color: theme.palette.neutralPrimary + }, + !preventBlanketFontInheritance && { + "& button": inheritFont, + "& input": inheritFont, + "& textarea": inheritFont + }, + // apply theme to only if applyTheme is true + applyTheme && { + color: theme.semanticColors.bodyText, + backgroundColor: theme.semanticColors.bodyBackground + }, + className2 + ], + bodyThemed: [ + { + backgroundColor: theme.semanticColors.bodyBackground + } + ] + }; + }; + var Fabric = styled(FabricBase, getStyles$t, void 0, { + scope: "Fabric" + }); + var _layersByHostId = {}; + var _layerHostsById = {}; + var defaultHostId = "fluent-default-layer-host"; + var _defaultHostSelector = "#".concat(defaultHostId); + function registerLayer(hostId, callback) { + if (!_layersByHostId[hostId]) { + _layersByHostId[hostId] = []; + } + _layersByHostId[hostId].push(callback); + var layerHosts = _layerHostsById[hostId]; + if (layerHosts) { + for (var _i = 0, layerHosts_1 = layerHosts; _i < layerHosts_1.length; _i++) { + var layerHost = layerHosts_1[_i]; + layerHost.notifyLayersChanged(); + } + } + } + function unregisterLayer(hostId, callback) { + var layers = _layersByHostId[hostId]; + if (layers) { + var idx = layers.indexOf(callback); + if (idx >= 0) { + layers.splice(idx, 1); + if (layers.length === 0) { + delete _layersByHostId[hostId]; + } + } + } + var layerHosts = _layerHostsById[hostId]; + if (layerHosts) { + for (var _i = 0, layerHosts_2 = layerHosts; _i < layerHosts_2.length; _i++) { + var layerHost = layerHosts_2[_i]; + layerHost.notifyLayersChanged(); + } + } + } + function getLayerHost(hostId) { + var layerHosts = _layerHostsById[hostId]; + return layerHosts && layerHosts[0] || void 0; + } + function createDefaultLayerHost(doc, shadowRoot) { + if (shadowRoot === void 0) { + shadowRoot = null; + } + var host = doc.createElement("div"); + host.setAttribute("id", defaultHostId); + host.style.cssText = "position:fixed;z-index:1000000"; + if (shadowRoot) { + shadowRoot.appendChild(host); + } else { + doc === null || doc === void 0 ? void 0 : doc.body.appendChild(host); + } + return host; + } + function getDefaultTarget() { + return _defaultHostSelector; + } + var getClassNames$n = classNamesFunction(); + var getFocusVisibility = function(providerRef) { + if (providerRef === null || providerRef === void 0 ? void 0 : providerRef.current) { + return providerRef.current.classList.contains(IsFocusVisibleClassName); + } + return false; + }; + var LayerBase = React__namespace.forwardRef(function(props, ref2) { + var registerPortalEl = usePortalCompat(); + var rootRef = React__namespace.useRef(null); + var mergedRef = useMergedRefs(rootRef, ref2); + var layerRef = React__namespace.useRef(void 0); + var fabricElementRef = React__namespace.useRef(null); + var focusContext = React__namespace.useContext(FocusRectsContext); + var _a2 = React__namespace.useState(false), needRaiseLayerMount = _a2[0], setNeedRaiseLayerMount = _a2[1]; + var focusRectsRef = React__namespace.useCallback(function(el) { + var isFocusVisible = getFocusVisibility(focusContext === null || focusContext === void 0 ? void 0 : focusContext.providerRef); + if (el && isFocusVisible) { + el.classList.add(IsFocusVisibleClassName); + } + }, [focusContext]); + var children2 = props.children, className2 = props.className, eventBubblingEnabled = props.eventBubblingEnabled, fabricProps = props.fabricProps, hostId = props.hostId, insertFirst = props.insertFirst, _b2 = props.onLayerDidMount, onLayerDidMount = _b2 === void 0 ? function() { + return void 0; + } : _b2, _c2 = props.onLayerMounted, onLayerMounted = _c2 === void 0 ? function() { + return void 0; + } : _c2, onLayerWillUnmount = props.onLayerWillUnmount, styles = props.styles, theme = props.theme; + var fabricRef = useMergedRefs(fabricElementRef, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.ref, focusRectsRef); + var classNames2 = getClassNames$n(styles, { + theme, + className: className2, + isNotHost: !hostId + }); + var getHost = function(doc, shadowRoot) { + var _a22, _b22; + if (shadowRoot === void 0) { + shadowRoot = null; + } + var root = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : doc; + if (hostId) { + var layerHost = getLayerHost(hostId); + if (layerHost) { + return (_a22 = layerHost.rootRef.current) !== null && _a22 !== void 0 ? _a22 : null; + } + return (_b22 = root.getElementById(hostId)) !== null && _b22 !== void 0 ? _b22 : null; + } else { + var defaultHostSelector = getDefaultTarget(); + var host = defaultHostSelector ? root.querySelector(defaultHostSelector) : null; + if (!host) { + host = createDefaultLayerHost(doc, shadowRoot); + } + return host; + } + }; + var removeLayerElement = function() { + onLayerWillUnmount === null || onLayerWillUnmount === void 0 ? void 0 : onLayerWillUnmount(); + var elem = layerRef.current; + layerRef.current = void 0; + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + }; + var createLayerElement = function() { + var _a22, _b22, _c22, _d2; + var doc = getDocument(rootRef.current); + var shadowRoot = ((_b22 = (_a22 = rootRef.current) === null || _a22 === void 0 ? void 0 : _a22.getRootNode()) === null || _b22 === void 0 ? void 0 : _b22.host) ? (_c22 = rootRef === null || rootRef === void 0 ? void 0 : rootRef.current) === null || _c22 === void 0 ? void 0 : _c22.getRootNode() : void 0; + if (!doc || !doc && !shadowRoot) { + return; + } + var host = getHost(doc, shadowRoot); + if (!host) { + return; + } + if (!host.__tabsterElementFlags) { + host.__tabsterElementFlags = {}; + } + host.__tabsterElementFlags.noDirectAriaHidden = true; + removeLayerElement(); + var el = ((_d2 = host.ownerDocument) !== null && _d2 !== void 0 ? _d2 : doc).createElement("div"); + el.className = classNames2.root; + setPortalAttribute(el); + setVirtualParent(el, rootRef.current); + insertFirst ? host.insertBefore(el, host.firstChild) : host.appendChild(el); + layerRef.current = el; + setNeedRaiseLayerMount(true); + }; + useIsomorphicLayoutEffect(function() { + createLayerElement(); + if (hostId) { + registerLayer(hostId, createLayerElement); + } + var unregisterPortalEl = layerRef.current ? registerPortalEl(layerRef.current) : void 0; + return function() { + if (unregisterPortalEl) { + unregisterPortalEl(); + } + removeLayerElement(); + if (hostId) { + unregisterLayer(hostId, createLayerElement); + } + }; + }, [hostId]); + React__namespace.useEffect(function() { + if (layerRef.current && needRaiseLayerMount) { + onLayerMounted === null || onLayerMounted === void 0 ? void 0 : onLayerMounted(); + onLayerDidMount === null || onLayerDidMount === void 0 ? void 0 : onLayerDidMount(); + setNeedRaiseLayerMount(false); + } + }, [needRaiseLayerMount, onLayerMounted, onLayerDidMount]); + return React__namespace.createElement("span", { className: "ms-layer", ref: mergedRef }, layerRef.current && ReactDOM__namespace.createPortal(React__namespace.createElement( + FocusRectsProvider, + { layerRoot: true, providerRef: fabricRef }, + React__namespace.createElement(Fabric, __assign$1({}, !eventBubblingEnabled && getFilteredEvents(), fabricProps, { className: css(classNames2.content, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.className), ref: fabricRef }), children2) + ), layerRef.current)); + }); + LayerBase.displayName = "LayerBase"; + var filteredEventProps; + var onFilterEvent = function(ev) { + if (ev.eventPhase === Event.BUBBLING_PHASE && ev.type !== "mouseenter" && ev.type !== "mouseleave" && ev.type !== "touchstart" && ev.type !== "touchend") { + ev.stopPropagation(); + } + }; + function getFilteredEvents() { + if (!filteredEventProps) { + filteredEventProps = {}; + [ + "onClick", + "onContextMenu", + "onDoubleClick", + "onDrag", + "onDragEnd", + "onDragEnter", + "onDragExit", + "onDragLeave", + "onDragOver", + "onDragStart", + "onDrop", + "onMouseDown", + "onMouseEnter", + "onMouseLeave", + "onMouseMove", + "onMouseOver", + "onMouseOut", + "onMouseUp", + "onTouchMove", + "onTouchStart", + "onTouchCancel", + "onTouchEnd", + "onKeyDown", + "onKeyPress", + "onKeyUp", + "onFocus", + "onBlur", + "onChange", + "onInput", + "onInvalid", + "onSubmit" + ].forEach(function(name) { + return filteredEventProps[name] = onFilterEvent; + }); + } + return filteredEventProps; + } + var GlobalClassNames$e = { + root: "ms-Layer", + rootNoHost: "ms-Layer--fixed", + content: "ms-Layer-content" + }; + var getStyles$s = function(props) { + var className2 = props.className, isNotHost = props.isNotHost, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$e, theme); + return { + root: [ + classNames2.root, + theme.fonts.medium, + isNotHost && [ + classNames2.rootNoHost, + { + position: "fixed", + zIndex: ZIndexes.Layer, + top: 0, + left: 0, + bottom: 0, + right: 0, + visibility: "hidden" + } + ], + className2 + ], + content: [ + classNames2.content, + { + visibility: "visible" + } + ] + }; + }; + var Layer = styled(LayerBase, getStyles$s, void 0, { + scope: "Layer", + fields: ["hostId", "theme", "styles"] + }); + var Callout = React__namespace.forwardRef(function(_a2, forwardedRef) { + var layerProps = _a2.layerProps, doNotLayer = _a2.doNotLayer, rest = __rest(_a2, ["layerProps", "doNotLayer"]); + var content2 = React__namespace.createElement(CalloutContent, __assign$1({}, rest, { doNotLayer, ref: forwardedRef })); + return doNotLayer ? content2 : React__namespace.createElement(Layer, __assign$1({}, layerProps), content2); + }); + Callout.displayName = "Callout"; + var COMPONENT_NAME$8 = "FocusTrapZone"; + var DEFAULT_PROPS$5 = { + disabled: false, + disableFirstFocus: false, + forceFocusInsideTrap: true, + isClickableOutsideFocusTrap: false, + // Hardcoding completely uncontrolled flag for proper interop with FluentUI V9. + "data-tabster": '{"uncontrolled": {"completely": true}}' + }; + var useComponentRef$6 = function(componentRef, previouslyFocusedElement, focusFTZ) { + React__namespace.useImperativeHandle(componentRef, function() { + return { + get previouslyFocusedElement() { + return previouslyFocusedElement; + }, + focus: focusFTZ + }; + }, [focusFTZ, previouslyFocusedElement]); + }; + var FocusTrapZone = React__namespace.forwardRef(function(propsWithoutDefaults, ref2) { + var _a2; + var root = React__namespace.useRef(null); + var firstBumper = React__namespace.useRef(null); + var lastBumper = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(root, ref2); + var doc = useDocument(); + var win = useWindowEx(); + var inShadow = useHasMergeStylesShadowRootContext(); + var isFirstRender = (_a2 = usePrevious(false)) !== null && _a2 !== void 0 ? _a2 : true; + var props = getPropsWithDefaults(DEFAULT_PROPS$5, propsWithoutDefaults); + var internalState = useConst({ + hasFocus: false, + focusStackId: useId("ftz-", props.id) + }); + var children2 = props.children, componentRef = props.componentRef, disabled = props.disabled, disableFirstFocus = props.disableFirstFocus, forceFocusInsideTrap = props.forceFocusInsideTrap, focusPreviouslyFocusedInnerElement = props.focusPreviouslyFocusedInnerElement, firstFocusableSelector = props.firstFocusableSelector, firstFocusableTarget = props.firstFocusableTarget, _b2 = props.disableRestoreFocus, disableRestoreFocus = _b2 === void 0 ? props.ignoreExternalFocusing : _b2, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, enableAriaHiddenSiblings = props.enableAriaHiddenSiblings; + var bumperProps = { + "aria-hidden": true, + style: { + pointerEvents: "none", + position: "fixed" + // 'fixed' prevents browsers from scrolling to bumpers when viewport does not contain them + }, + tabIndex: disabled ? -1 : 0, + // make bumpers tabbable only when enabled + "data-is-visible": true, + "data-is-focus-trap-zone-bumper": true + }; + var focusElementAsync = React__namespace.useCallback(function(element2) { + if (element2 !== firstBumper.current && element2 !== lastBumper.current) { + focusAsync(element2); + } }, []); - var rootRef = (0, _reactHooks.useMergedRefs)(hostElement, forwardedRef); - var _d = (0, _reactHooks.useTarget)(props.target, { - current: calloutElement - }), targetRef = _d[0], targetWindow = _d[1]; - var getBounds = useBounds(props, targetRef, targetWindow); - var positions = usePositions(props, hostElement, calloutElement, targetRef, getBounds, mergedPopupRefs); - var maxHeight = useMaxHeight(props, getBounds, targetRef, positions); - var _e = useDismissHandlers(props, positions, hostElement, targetRef, targetWindow), mouseDownOnPopup = _e[0], mouseUpOnPopup = _e[1]; - // do not set both top and bottom css props from positions - // instead, use maxHeight - var isForcedInBounds = (positions === null || positions === void 0 ? void 0 : positions.elementPosition.top) && (positions === null || positions === void 0 ? void 0 : positions.elementPosition.bottom); - var cssPositions = (0, _tslib.__assign)((0, _tslib.__assign)({}, positions === null || positions === void 0 ? void 0 : positions.elementPosition), { - maxHeight: maxHeight + var focusFTZ = useEventCallback(function() { + if (!root.current) { + return; + } + var previouslyFocusedElementInTrapZone = internalState.previouslyFocusedElementInTrapZone; + if (focusPreviouslyFocusedInnerElement && previouslyFocusedElementInTrapZone && elementContains(root.current, previouslyFocusedElementInTrapZone)) { + focusElementAsync(previouslyFocusedElementInTrapZone); + return; + } + var firstFocusableChild = null; + if (typeof firstFocusableTarget === "string") { + firstFocusableChild = root.current.querySelector(firstFocusableTarget); + } else if (firstFocusableTarget) { + firstFocusableChild = firstFocusableTarget(root.current); + } else if (firstFocusableSelector) { + var focusSelector = typeof firstFocusableSelector === "string" ? firstFocusableSelector : firstFocusableSelector(); + firstFocusableChild = root.current.querySelector("." + focusSelector); + } + if (!firstFocusableChild) { + firstFocusableChild = getNextElement(root.current, root.current.firstChild, false, false, false, true, void 0, void 0, void 0, inShadow); + } + if (firstFocusableChild) { + focusElementAsync(firstFocusableChild); + } }); - if (isForcedInBounds) cssPositions.bottom = undefined; - useAutoFocus(props, positions, calloutElement); - _react.useEffect(function() { - if (!hidden) onLayerMounted === null || onLayerMounted === void 0 || onLayerMounted(); - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run if hidden changes - }, [ - hidden - ]); - // If there is no target window then we are likely in server side rendering and we should not render anything. - if (!targetWindow) return null; - var overflowYHidden = hideOverflow; - var beakVisible = isBeakVisible && !!target; - var classNames = getClassNames(styles, { - theme: props.theme, - className: className, - overflowYHidden: overflowYHidden, - calloutWidth: calloutWidth, - positions: positions, - beakWidth: beakWidth, - backgroundColor: backgroundColor, - calloutMaxWidth: calloutMaxWidth, - calloutMinWidth: calloutMinWidth, - doNotLayer: doNotLayer + var focusBumper = function(isFirstBumper) { + if (disabled || !root.current) { + return; + } + var nextFocusable = isFirstBumper === internalState.hasFocus ? getLastTabbable(root.current, lastBumper.current, true, false, inShadow) : getFirstTabbable(root.current, firstBumper.current, true, false, inShadow); + if (nextFocusable) { + if (nextFocusable === firstBumper.current || nextFocusable === lastBumper.current) { + focusFTZ(); + } else { + nextFocusable.focus(); + } + } + }; + var onRootBlurCapture = function(ev) { + var _a3; + (_a3 = props.onBlurCapture) === null || _a3 === void 0 ? void 0 : _a3.call(props, ev); + var relatedTarget = ev.relatedTarget; + if (ev.relatedTarget === null) { + relatedTarget = getActiveElement(doc); + } + if (!elementContains(root.current, relatedTarget)) { + internalState.hasFocus = false; + } + }; + var onRootFocusCapture = function(ev) { + var _a3; + (_a3 = props.onFocusCapture) === null || _a3 === void 0 ? void 0 : _a3.call(props, ev); + if (ev.target === firstBumper.current) { + focusBumper(true); + } else if (ev.target === lastBumper.current) { + focusBumper(false); + } + internalState.hasFocus = true; + if (ev.target !== ev.currentTarget && !(ev.target === firstBumper.current || ev.target === lastBumper.current)) { + internalState.previouslyFocusedElementInTrapZone = getEventTarget(ev.nativeEvent); + } + }; + var returnFocusToInitiator = useEventCallback(function(elementToFocusOnDismiss) { + FocusTrapZone.focusStack = FocusTrapZone.focusStack.filter(function(value2) { + return internalState.focusStackId !== value2; + }); + if (!doc) { + return; + } + var activeElement = doc.activeElement; + if (!disableRestoreFocus && typeof (elementToFocusOnDismiss === null || elementToFocusOnDismiss === void 0 ? void 0 : elementToFocusOnDismiss.focus) === "function" && // only restore focus if the current focused element is within the FTZ, or if nothing is focused + (elementContains(root.current, activeElement) || activeElement === doc.body || activeElement.shadowRoot)) { + focusElementAsync(elementToFocusOnDismiss); + } }); - var overflowStyle = (0, _tslib.__assign)((0, _tslib.__assign)({ - maxHeight: calloutMaxHeight ? calloutMaxHeight : '100%' - }, style), overflowYHidden && { - overflowY: 'hidden' + var forceFocusOrClickInTrap = useEventCallback(function(ev) { + if (disabled) { + return; + } + if (internalState.focusStackId === FocusTrapZone.focusStack.slice(-1)[0]) { + var targetElement = getEventTarget(ev); + if (targetElement && !elementContains(root.current, targetElement)) { + if (doc && getActiveElement(doc) === doc.body) { + setTimeout(function() { + if (doc && getActiveElement(doc) === doc.body) { + focusFTZ(); + internalState.hasFocus = true; + } + }, 0); + } else { + focusFTZ(); + internalState.hasFocus = true; + } + ev.preventDefault(); + ev.stopPropagation(); + } + } }); - var visibilityStyle = props.hidden ? { - visibility: 'hidden' - } : undefined; - // React.CSSProperties does not understand IRawStyle, so the inline animations will need to be cast as any for now. - return _react.createElement("div", { - ref: rootRef, - className: classNames.container, - style: visibilityStyle - }, _react.createElement("div", (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), ARIA_ROLE_ATTRIBUTES), { - className: (0, _utilities.css)(classNames.root, positions && positions.targetEdge && ANIMATIONS[positions.targetEdge]), - style: positions ? (0, _tslib.__assign)({}, cssPositions) : OFF_SCREEN_STYLE, - // Safari and Firefox on Mac OS requires this to back-stop click events so focus remains in the Callout. - // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus - tabIndex: -1, - ref: calloutCallback - }), beakVisible && _react.createElement("div", { - className: classNames.beak, - style: getBeakPosition(positions) - }), beakVisible && _react.createElement("div", { - className: classNames.beakCurtain - }), _react.createElement((0, _popup.Popup), (0, _tslib.__assign)({ - // don't use getNativeElementProps for role and roledescription because it will also - // pass through data-* props (resulting in them being used in two places) - role: props.role, - "aria-roledescription": props['aria-roledescription'], - ariaDescribedBy: ariaDescribedBy, - ariaLabel: ariaLabel, - ariaLabelledBy: ariaLabelledBy, - className: classNames.calloutMain, - onDismiss: props.onDismiss, - onMouseDown: mouseDownOnPopup, - onMouseUp: mouseUpOnPopup, - onRestoreFocus: props.onRestoreFocus, - onScroll: onScroll, - shouldRestoreFocus: shouldRestoreFocus, - style: overflowStyle - }, popupProps, { - ref: mergedPopupRefs - }), children))); -}), function(previousProps, nextProps) { - if (!nextProps.shouldUpdateWhenHidden && previousProps.hidden && nextProps.hidden) // Do not update when hidden. - return true; - return (0, _utilities.shallowCompare)(previousProps, nextProps); -}); -/** - * (Utility) to find and return the current `Callout` Beak position. - * - * @param positions - */ function getBeakPosition(positions) { - var _a, _b; - var beakPositionStyle = (0, _tslib.__assign)((0, _tslib.__assign)({}, (_a = positions === null || positions === void 0 ? void 0 : positions.beakPosition) === null || _a === void 0 ? void 0 : _a.elementPosition), { - display: ((_b = positions === null || positions === void 0 ? void 0 : positions.beakPosition) === null || _b === void 0 ? void 0 : _b.hideBeak) ? 'none' : undefined + React__namespace.useEffect(function() { + var disposables = []; + if (forceFocusInsideTrap) { + disposables.push(on$1(win, "focus", forceFocusOrClickInTrap, true)); + } + if (!isClickableOutsideFocusTrap) { + disposables.push(on$1(win, "click", forceFocusOrClickInTrap, true)); + } + return function() { + disposables.forEach(function(dispose) { + return dispose(); + }); + }; + }, [forceFocusInsideTrap, isClickableOutsideFocusTrap, win]); + React__namespace.useEffect(function() { + if (disabled || !isFirstRender && !forceFocusInsideTrap || !root.current) { + return; + } + FocusTrapZone.focusStack.push(internalState.focusStackId); + var elementToFocusOnDismiss = props.elementToFocusOnDismiss || getActiveElement(doc); + if (!disableFirstFocus && !elementContains(root.current, elementToFocusOnDismiss)) { + focusFTZ(); + } + return function() { + return returnFocusToInitiator(elementToFocusOnDismiss); + }; + }, [forceFocusInsideTrap, disabled]); + React__namespace.useEffect(function() { + if (!disabled && enableAriaHiddenSiblings) { + var unmodalize2 = modalize(root.current); + return unmodalize2; + } + }, [disabled, enableAriaHiddenSiblings, root]); + useUnmount(function() { + delete internalState.previouslyFocusedElementInTrapZone; }); - if (!beakPositionStyle.top && !beakPositionStyle.bottom && !beakPositionStyle.left && !beakPositionStyle.right) { - beakPositionStyle.left = BEAK_ORIGIN_POSITION.left; - beakPositionStyle.top = BEAK_ORIGIN_POSITION.top; + useComponentRef$6(componentRef, internalState.previouslyFocusedElementInTrapZone, focusFTZ); + return React__namespace.createElement( + "div", + __assign$1({ "aria-labelledby": props.ariaLabelledBy }, getNativeProps(props, divProperties), { ref: mergedRootRef, onFocusCapture: onRootFocusCapture, onBlurCapture: onRootBlurCapture }), + React__namespace.createElement("div", __assign$1({}, bumperProps, { ref: firstBumper })), + children2, + React__namespace.createElement("div", __assign$1({}, bumperProps, { ref: lastBumper })) + ); + }); + FocusTrapZone.displayName = COMPONENT_NAME$8; + FocusTrapZone.focusStack = []; + var defaultIconRenderer = function(props) { + var item = props.item, classNames2 = props.classNames; + var iconProps = item.iconProps; + return React__namespace.createElement(Icon, __assign$1({}, iconProps, { className: classNames2.icon })); + }; + var renderItemIcon = function(props) { + var item = props.item, hasIcons = props.hasIcons; + if (!hasIcons) { + return null; } - return beakPositionStyle; -} -/** - * (Utility) used to compare two different elementPositions to determine whether they are equal. - * - * @param prevElementPositions - * @param newElementPosition - */ function arePositionsEqual(prevElementPositions, newElementPosition) { - return comparePositions(prevElementPositions.elementPosition, newElementPosition.elementPosition) && comparePositions(prevElementPositions.beakPosition.elementPosition, newElementPosition.beakPosition.elementPosition); -} -/** - * (Utility) used in **arePositionsEqual** to compare two different elementPositions. - * - * @param prevElementPositions - * @param newElementPositions - */ function comparePositions(prevElementPositions, newElementPositions) { - for(var key in newElementPositions)if (newElementPositions.hasOwnProperty(key)) { - var oldPositionEdge = prevElementPositions[key]; - var newPositionEdge = newElementPositions[key]; - if (oldPositionEdge !== undefined && newPositionEdge !== undefined) { - if (oldPositionEdge.toFixed(2) !== newPositionEdge.toFixed(2)) return false; - } else return false; + if (item.onRenderIcon) { + return item.onRenderIcon(props, defaultIconRenderer); } - return true; -} -CalloutContentBase.displayName = COMPONENT_NAME; - -},{"tslib":"9gizs","react":"jGrId","../../common/DirectionalHint":"avdAc","../../Utilities":"1NZCy","../../utilities/positioning/positioning":"8HbU4","../../Positioning":"bWPOk","../../Popup":"bOJlv","../../Styling":"hTimn","@fluentui/react-hooks":"2LHjM","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8HbU4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "__positioningTestPackage", ()=>__positioningTestPackage); -/** - * Used to position an element relative to the given positioning props. - * If positioning has been completed before, previousPositions can be passed to ensure that the positioning element - * repositions based on its previous targets rather than starting with directionalhint. - */ parcelHelpers.export(exports, "positionElement", ()=>positionElement); -parcelHelpers.export(exports, "positionCallout", ()=>positionCallout); -parcelHelpers.export(exports, "positionCard", ()=>positionCard); -/** - * Gets the maximum height that a rectangle can have in order to fit below or above a target. - * If the directional hint specifies a left or right edge (i.e. leftCenter) it will limit the height to the topBorder - * of the target given. - * If no bounds are provided then the window is treated as the bounds. - */ parcelHelpers.export(exports, "getMaxHeight", ()=>getMaxHeight); -/** - * Returns the opposite edge of the given RectangleEdge. - */ parcelHelpers.export(exports, "getOppositeEdge", ()=>getOppositeEdge); -parcelHelpers.export(exports, "getBoundsFromTargetWindow", ()=>getBoundsFromTargetWindow); -parcelHelpers.export(exports, "calculateGapSpace", ()=>calculateGapSpace); -parcelHelpers.export(exports, "getRectangleFromTarget", ()=>getRectangleFromTarget); -var _tslib = require("tslib"); -var _directionalHint = require("../../common/DirectionalHint"); -var _utilities = require("../../Utilities"); -var _positioningTypes = require("./positioning.types"); -var _a; -function _createPositionData(targetEdge, alignmentEdge, isAuto) { - return { - targetEdge: targetEdge, - alignmentEdge: alignmentEdge, - isAuto: isAuto - }; -} -// Currently the beakPercent is set to 50 for all positions meaning that it should tend to the center of the target -var DirectionalDictionary = (_a = {}, _a[(0, _directionalHint.DirectionalHint).topLeftEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).top, (0, _positioningTypes.RectangleEdge).left), _a[(0, _directionalHint.DirectionalHint).topCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).top), _a[(0, _directionalHint.DirectionalHint).topRightEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).top, (0, _positioningTypes.RectangleEdge).right), _a[(0, _directionalHint.DirectionalHint).topAutoEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).top, undefined, true), _a[(0, _directionalHint.DirectionalHint).bottomLeftEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom, (0, _positioningTypes.RectangleEdge).left), _a[(0, _directionalHint.DirectionalHint).bottomCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom), _a[(0, _directionalHint.DirectionalHint).bottomRightEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom, (0, _positioningTypes.RectangleEdge).right), _a[(0, _directionalHint.DirectionalHint).bottomAutoEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom, undefined, true), _a[(0, _directionalHint.DirectionalHint).leftTopEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).left, (0, _positioningTypes.RectangleEdge).top), _a[(0, _directionalHint.DirectionalHint).leftCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).left), _a[(0, _directionalHint.DirectionalHint).leftBottomEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).left, (0, _positioningTypes.RectangleEdge).bottom), _a[(0, _directionalHint.DirectionalHint).rightTopEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).right, (0, _positioningTypes.RectangleEdge).top), _a[(0, _directionalHint.DirectionalHint).rightCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).right), _a[(0, _directionalHint.DirectionalHint).rightBottomEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).right, (0, _positioningTypes.RectangleEdge).bottom), _a); -function _isRectangleWithinBounds(rect, boundingRect) { - if (rect.top < boundingRect.top) return false; - if (rect.bottom > boundingRect.bottom) return false; - if (rect.left < boundingRect.left) return false; - if (rect.right > boundingRect.right) return false; - return true; -} -/** - * Gets all of the edges of a rectangle that are outside of the given bounds. - * If there are no out of bounds edges it returns an empty array. - */ function _getOutOfBoundsEdges(rect, boundingRect) { - var outOfBounds = []; - if (rect.top < boundingRect.top) outOfBounds.push((0, _positioningTypes.RectangleEdge).top); - if (rect.bottom > boundingRect.bottom) outOfBounds.push((0, _positioningTypes.RectangleEdge).bottom); - if (rect.left < boundingRect.left) outOfBounds.push((0, _positioningTypes.RectangleEdge).left); - if (rect.right > boundingRect.right) outOfBounds.push((0, _positioningTypes.RectangleEdge).right); - return outOfBounds; -} -function _getEdgeValue(rect, edge) { - return rect[(0, _positioningTypes.RectangleEdge)[edge]]; -} -function _setEdgeValue(rect, edge, value) { - rect[(0, _positioningTypes.RectangleEdge)[edge]] = value; - return rect; -} -/** - * Returns the middle value of an edge. Only returns 1 value rather than xy coordinates as - * the itself already contains the other coordinate. - * For instance, a bottom edge's current value is it's y coordinate, so the number returned is the x. - */ function _getCenterValue(rect, edge) { - var edges = _getFlankingEdges(edge); - return (_getEdgeValue(rect, edges.positiveEdge) + _getEdgeValue(rect, edges.negativeEdge)) / 2; -} -/** - * Flips the value depending on the edge. - * If the edge is a "positive" edge, Top or Left, then the value should stay as it is. - * If the edge is a "negative" edge, Bottom or Right, then the value should be flipped. - * This is to account for the fact that the coordinates are effectively reserved in certain cases for the - * "negative" edges. - * - * For example, when testing to see if a bottom edge 1 is within the bounds of another bottom edge 2: - * If edge 1 is greater than edge 2 then it is out of bounds. This is reversed for top edge 1 and top edge 2. - * If top edge 1 is less than edge 2 then it is out of bounds. - */ function _getRelativeEdgeValue(edge, value) { - if (edge > 0) return value; - else return value * -1; -} -function _getRelativeRectEdgeValue(edge, rect) { - return _getRelativeEdgeValue(edge, _getEdgeValue(rect, edge)); -} -function _getRelativeEdgeDifference(rect, hostRect, edge) { - var edgeDifference = _getEdgeValue(rect, edge) - _getEdgeValue(hostRect, edge); - return _getRelativeEdgeValue(edge, edgeDifference); -} -/** - * Moves the edge of a rectangle to the value given. It only moves the edge in a linear direction based on that edge. - * For example, if it's a bottom edge it will only change y coordinates. - * if maintainSize is set to false, it will only adjust the specified edge value - */ function _moveEdge(rect, edge, newValue, maintainSize) { - if (maintainSize === void 0) maintainSize = true; - var difference = _getEdgeValue(rect, edge) - newValue; - var returnRect = _setEdgeValue(rect, edge, newValue); - if (maintainSize) returnRect = _setEdgeValue(rect, edge * -1, _getEdgeValue(rect, edge * -1) - difference); - return returnRect; -} -/** - * Aligns the edge on the passed in rect to the target. If there is a gap then it will have that space between the two. - */ function _alignEdges(rect, target, edge, gap) { - if (gap === void 0) gap = 0; - return _moveEdge(rect, edge, _getEdgeValue(target, edge) + _getRelativeEdgeValue(edge, gap)); -} -/** - * Aligns the targetEdge on the passed in target to the rects corresponding opposite edge. - * For instance if targetEdge is bottom, then the rects top will be moved to match it. - */ function _alignOppositeEdges(rect, target, targetEdge, gap) { - if (gap === void 0) gap = 0; - var oppositeEdge = targetEdge * -1; - var adjustedGap = _getRelativeEdgeValue(oppositeEdge, gap); - return _moveEdge(rect, targetEdge * -1, _getEdgeValue(target, targetEdge) + adjustedGap); -} -/** - * Tests to see if the given edge is within the bounds of the given rectangle. - */ function _isEdgeInBounds(rect, bounds, edge) { - var adjustedRectValue = _getRelativeRectEdgeValue(edge, rect); - return adjustedRectValue > _getRelativeRectEdgeValue(edge, bounds); -} -/** - * Returns a measure of how much a rectangle is out of bounds for a given alignment; - * this can be used to compare which rectangle is more or less out of bounds. - * A value of 0 means the rectangle is entirely in bounds - */ function _getOutOfBoundsDegree(rect, bounds) { - var breakingEdges = _getOutOfBoundsEdges(rect, bounds); - var total = 0; - for(var _i = 0, breakingEdges_1 = breakingEdges; _i < breakingEdges_1.length; _i++){ - var edge = breakingEdges_1[_i]; - total += Math.pow(_getRelativeEdgeDifference(rect, bounds, edge), 2); + return defaultIconRenderer(props); + }; + var renderCheckMarkIcon = function(_a2) { + var onCheckmarkClick = _a2.onCheckmarkClick, item = _a2.item, classNames2 = _a2.classNames; + var isItemChecked = getIsChecked(item); + if (onCheckmarkClick) { + var onClick = function(e) { + return onCheckmarkClick(item, e); + }; + return React__namespace.createElement(Icon, { + iconName: item.canCheck !== false && isItemChecked ? "CheckMark" : "", + className: classNames2.checkmarkIcon, + // eslint-disable-next-line react/jsx-no-bind + onClick + }); } - return total; -} -/** - * Returns true if scroll-resizing will move the target edge within the bounding rectangle, - * and there is room between the target edge and the bounding edge for scrolled content. - * Returns false otherwise. - */ function _canScrollResizeToFitEdge(target, bounding, targetEdge, minimumScrollResizeHeight) { - if (minimumScrollResizeHeight === void 0) minimumScrollResizeHeight = 200; - // Only scroll vertically to fit - cannot scroll to fit right or left edges - if (targetEdge !== (0, _positioningTypes.RectangleEdge).bottom && targetEdge !== (0, _positioningTypes.RectangleEdge).top) return false; - return _getRelativeEdgeDifference(target, bounding, targetEdge) >= minimumScrollResizeHeight; -} -/** - * Attempts to move the rectangle through various sides of the target to find a place to fit. - * If no fit is found, the least bad option should be returned. - */ function _flipToFit(rect, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap) { - if (shouldScroll === void 0) shouldScroll = false; - if (gap === void 0) gap = 0; - var directions = [ - (0, _positioningTypes.RectangleEdge).left, - (0, _positioningTypes.RectangleEdge).right, - (0, _positioningTypes.RectangleEdge).bottom, - (0, _positioningTypes.RectangleEdge).top - ]; - // In RTL page, RectangleEdge.right has a higher priority than RectangleEdge.left, so the order should be updated. - if ((0, _utilities.getRTL)()) { - directions[0] *= -1; - directions[1] *= -1; + return null; + }; + var renderItemName = function(_a2) { + var item = _a2.item, classNames2 = _a2.classNames; + if (item.text || item.name) { + return React__namespace.createElement("span", { className: classNames2.label }, item.text || item.name); } - var currentEstimate = rect; - var currentEdge = positionData.targetEdge; - var currentAlignment = positionData.alignmentEdge; - // keep track of least bad option, in case no sides fit - var oobDegree; - var bestEdge = currentEdge; - var bestAlignment = currentAlignment; - // Keep switching sides until one is found with enough space. - // If all sides don't fit then return the unmodified element. - for(var i = 0; i < 4; i++){ - if (_isEdgeInBounds(currentEstimate, bounding, currentEdge)) // Edge is in bounds, return current estimate - return { - elementRectangle: currentEstimate, - targetEdge: currentEdge, - alignmentEdge: currentAlignment - }; - else if (shouldScroll && _canScrollResizeToFitEdge(target, bounding, currentEdge, minimumScrollResizeHeight)) { - // Scrolling will allow edge to fit, move the estimate currentEdge inside the bounds and return - switch(currentEdge){ - case (0, _positioningTypes.RectangleEdge).bottom: - currentEstimate.bottom = bounding.bottom; - break; - case (0, _positioningTypes.RectangleEdge).top: - currentEstimate.top = bounding.top; - break; - } - return { - elementRectangle: currentEstimate, - targetEdge: currentEdge, - alignmentEdge: currentAlignment, - forcedInBounds: true - }; - } else { - // update least-bad edges - var currentOOBDegree = _getOutOfBoundsDegree(currentEstimate, bounding); - if (!oobDegree || currentOOBDegree < oobDegree) { - oobDegree = currentOOBDegree; - bestEdge = currentEdge; - bestAlignment = currentAlignment; - } - directions.splice(directions.indexOf(currentEdge), 1); - if (directions.length > 0) { - if (directions.indexOf(currentEdge * -1) > -1) currentEdge = currentEdge * -1; - else { - currentAlignment = currentEdge; - currentEdge = directions.slice(-1)[0]; - } - currentEstimate = _estimatePosition(rect, target, { - targetEdge: currentEdge, - alignmentEdge: currentAlignment - }, gap); - } - } + return null; + }; + var renderSecondaryText = function(_a2) { + var item = _a2.item, classNames2 = _a2.classNames; + if (item.secondaryText) { + return React__namespace.createElement("span", { className: classNames2.secondaryText }, item.secondaryText); } - // nothing fits, use least-bad option - currentEstimate = _estimatePosition(rect, target, { - targetEdge: bestEdge, - alignmentEdge: bestAlignment - }, gap); - return { - elementRectangle: currentEstimate, - targetEdge: bestEdge, - alignmentEdge: bestAlignment - }; -} -/** - * Flips only the alignment edge of an element rectangle. This is used instead of nudging the alignment edges - * into position, when `alignTargetEdge` is specified. - */ function _flipAlignmentEdge(elementEstimate, target, gap, coverTarget) { - var alignmentEdge = elementEstimate.alignmentEdge, targetEdge = elementEstimate.targetEdge, elementRectangle = elementEstimate.elementRectangle; - var oppositeEdge = alignmentEdge * -1; - var newEstimate = _estimatePosition(elementRectangle, target, { - targetEdge: targetEdge, - alignmentEdge: oppositeEdge - }, gap, coverTarget); - return { - elementRectangle: newEstimate, - targetEdge: targetEdge, - alignmentEdge: oppositeEdge - }; -} -/** - * Adjusts a element rectangle to fit within the bounds given. If directionalHintFixed or covertarget is passed in - * then the element will not flip sides on the target. They will, however, be nudged to fit within the bounds given. - */ function _adjustFitWithinBounds(element, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget) { - if (shouldScroll === void 0) shouldScroll = false; - if (gap === void 0) gap = 0; - var alignmentEdge = positionData.alignmentEdge, alignTargetEdge = positionData.alignTargetEdge; - var elementEstimate = { - elementRectangle: element, - targetEdge: positionData.targetEdge, - alignmentEdge: alignmentEdge - }; - if (!directionalHintFixed && !coverTarget) elementEstimate = _flipToFit(element, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap); - var outOfBounds = _getOutOfBoundsEdges(elementEstimate.elementRectangle, bounding); - // if directionalHintFixed is specified, we need to force the target edge to not change - // we need *-1 because targetEdge refers to the target's edge; the callout edge is the opposite - var fixedEdge = directionalHintFixed ? -elementEstimate.targetEdge : undefined; - if (outOfBounds.length > 0) { - if (alignTargetEdge) { - // The edge opposite to the alignment edge might be out of bounds. - // Flip alignment to see if we can get it within bounds. - if (elementEstimate.alignmentEdge && outOfBounds.indexOf(elementEstimate.alignmentEdge * -1) > -1) { - var flippedElementEstimate = _flipAlignmentEdge(elementEstimate, target, gap, coverTarget); - if (_isRectangleWithinBounds(flippedElementEstimate.elementRectangle, bounding)) return flippedElementEstimate; - else // If the flipped elements edges are still out of bounds, try nudging it. - elementEstimate = _alignOutOfBoundsEdges(_getOutOfBoundsEdges(flippedElementEstimate.elementRectangle, bounding), elementEstimate, bounding, fixedEdge); - } else elementEstimate = _alignOutOfBoundsEdges(outOfBounds, elementEstimate, bounding, fixedEdge); - } else elementEstimate = _alignOutOfBoundsEdges(outOfBounds, elementEstimate, bounding, fixedEdge); + return null; + }; + var renderSubMenuIcon = function(_a2) { + var item = _a2.item, classNames2 = _a2.classNames, theme = _a2.theme; + if (hasSubmenu(item)) { + return React__namespace.createElement(Icon, __assign$1({ iconName: getRTL(theme) ? "ChevronLeft" : "ChevronRight" }, item.submenuIconProps, { className: classNames2.subMenuIcon })); } - return elementEstimate; -} -/** - * Iterates through a list of out of bounds edges and tries to nudge and align them. - * @param outOfBoundsEdges - Array of edges that are out of bounds - * @param elementEstimate - The current element positioning estimate - * @param bounding - The current bounds - * @param preserveEdge - Specify an edge that should not be modified - */ function _alignOutOfBoundsEdges(outOfBoundsEdges, elementEstimate, bounding, preserveEdge) { - for(var _i = 0, outOfBoundsEdges_1 = outOfBoundsEdges; _i < outOfBoundsEdges_1.length; _i++){ - var direction = outOfBoundsEdges_1[_i]; - var edgeAttempt = void 0; - // if preserveEdge is specified, do not call _alignEdges, skip directly to _moveEdge - // this is because _alignEdges will move the opposite edge - if (preserveEdge && preserveEdge === direction * -1) { - edgeAttempt = _moveEdge(elementEstimate.elementRectangle, direction, _getEdgeValue(bounding, direction), false); - elementEstimate.forcedInBounds = true; - } else { - edgeAttempt = _alignEdges(elementEstimate.elementRectangle, bounding, direction); - var inBounds = _isEdgeInBounds(edgeAttempt, bounding, direction * -1); - // only update estimate if the attempt didn't break out of the opposite bounding edge - if (!inBounds) { - edgeAttempt = _moveEdge(edgeAttempt, direction * -1, _getEdgeValue(bounding, direction * -1), false); - elementEstimate.forcedInBounds = true; + return null; + }; + var ContextualMenuItemBase = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuItemBase2, _super); + function ContextualMenuItemBase2(props) { + var _this = _super.call(this, props) || this; + _this.openSubMenu = function() { + var _a2 = _this.props, item = _a2.item, openSubMenu = _a2.openSubMenu, getSubmenuTarget = _a2.getSubmenuTarget; + if (getSubmenuTarget) { + var submenuTarget = getSubmenuTarget(); + if (hasSubmenu(item) && openSubMenu && submenuTarget) { + openSubMenu(item, submenuTarget); } + } + }; + _this.dismissSubMenu = function() { + var _a2 = _this.props, item = _a2.item, dismissSubMenu = _a2.dismissSubMenu; + if (hasSubmenu(item) && dismissSubMenu) { + dismissSubMenu(); + } + }; + _this.dismissMenu = function(dismissAll) { + var dismissMenu = _this.props.dismissMenu; + if (dismissMenu) { + dismissMenu(void 0, dismissAll); + } + }; + initializeComponentRef(_this); + return _this; + } + ContextualMenuItemBase2.prototype.render = function() { + var _a2 = this.props, item = _a2.item, classNames2 = _a2.classNames; + var renderContent = item.onRenderContent || this._renderLayout; + return React__namespace.createElement("div", { className: item.split ? classNames2.linkContentMenu : classNames2.linkContent }, renderContent(this.props, { + renderCheckMarkIcon, + renderItemIcon, + renderItemName, + renderSecondaryText, + renderSubMenuIcon + })); + }; + ContextualMenuItemBase2.prototype._renderLayout = function(props, defaultRenders) { + return React__namespace.createElement( + React__namespace.Fragment, + null, + defaultRenders.renderCheckMarkIcon(props), + defaultRenders.renderItemIcon(props), + defaultRenders.renderItemName(props), + defaultRenders.renderSecondaryText(props), + defaultRenders.renderSubMenuIcon(props) + ); + }; + return ContextualMenuItemBase2; + })(React__namespace.Component) + ); + var getDividerClassNames = memoizeFunction( + // eslint-disable-next-line @typescript-eslint/no-deprecated + function(theme) { + return mergeStyleSets({ + wrapper: { + display: "inline-flex", + height: "100%", + alignItems: "center" + }, + divider: { + width: 1, + height: "100%", + backgroundColor: theme.palette.neutralTertiaryAlt } - elementEstimate.elementRectangle = edgeAttempt; - } - return elementEstimate; -} -/** - * Moves the middle point on an edge to the point given. - * Only moves in one direction. For instance if a bottom edge is passed in, then - * the bottom edge will be moved in the x axis to match the point. - */ function _centerEdgeToPoint(rect, edge, point) { - var positiveEdge = _getFlankingEdges(edge).positiveEdge; - var elementMiddle = _getCenterValue(rect, edge); - var distanceToMiddle = elementMiddle - _getEdgeValue(rect, positiveEdge); - return _moveEdge(rect, positiveEdge, point - distanceToMiddle); -} -/** - * Moves the element rectangle to be appropriately positioned relative to a given target. - * Does not flip or adjust the element. - */ function _estimatePosition(elementToPosition, target, positionData, gap, coverTarget) { - if (gap === void 0) gap = 0; - var estimatedElementPosition = new (0, _utilities.Rectangle)(elementToPosition.left, elementToPosition.right, elementToPosition.top, elementToPosition.bottom); - var alignmentEdge = positionData.alignmentEdge, targetEdge = positionData.targetEdge; - var elementEdge = coverTarget ? targetEdge : targetEdge * -1; - estimatedElementPosition = coverTarget ? _alignEdges(estimatedElementPosition, target, targetEdge, gap) : _alignOppositeEdges(estimatedElementPosition, target, targetEdge, gap); - // if no alignment edge is provided it's supposed to be centered. - if (!alignmentEdge) { - var targetMiddlePoint = _getCenterValue(target, targetEdge); - estimatedElementPosition = _centerEdgeToPoint(estimatedElementPosition, elementEdge, targetMiddlePoint); - } else estimatedElementPosition = _alignEdges(estimatedElementPosition, target, alignmentEdge); - return estimatedElementPosition; -} -/** - * Returns the non-opposite edges of the target edge. - * For instance if bottom is passed in then left and right will be returned. - */ function _getFlankingEdges(edge) { - if (edge === (0, _positioningTypes.RectangleEdge).top || edge === (0, _positioningTypes.RectangleEdge).bottom) return { - positiveEdge: (0, _positioningTypes.RectangleEdge).left, - negativeEdge: (0, _positioningTypes.RectangleEdge).right - }; - else return { - positiveEdge: (0, _positioningTypes.RectangleEdge).top, - negativeEdge: (0, _positioningTypes.RectangleEdge).bottom - }; -} -/** - * Retrieve the final value for the return edge of `elementRectangle`. If the `elementRectangle` is closer to one side - * of the bounds versus the other, the return edge is flipped to grow inward. - */ function _finalizeReturnEdge(elementRectangle, returnEdge, bounds) { - if (bounds && Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge)) > Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge * -1))) return returnEdge * -1; - return returnEdge; -} -/** - * Whether or not the considered edge of the elementRectangle is lying on the edge of the bounds - * @param elementRectangle The rectangle whose edge we are considering - * @param bounds The rectangle marking the bounds - * @param edge The target edge we're considering - * @returns If the target edge of the elementRectangle is in the same location as that edge of the bounds - */ function _isEdgeOnBounds(elementRectangle, edge, bounds) { - return bounds !== undefined && _getEdgeValue(elementRectangle, edge) === _getEdgeValue(bounds, edge); -} -/** - * Finalizes the element position based on the hostElement. Only returns the - * rectangle values to position such that they are anchored to the target. - * This helps prevent resizing from looking very strange. - * For instance, if the target edge is top and aligned with the left side then - * the bottom and left values are returned so as the Callout shrinks it shrinks towards that corner. - */ function _finalizeElementPosition(elementRectangle, hostElement, targetEdge, bounds, alignmentEdge, coverTarget, doNotFinalizeReturnEdge, forceWithinBounds) { - var returnValue = {}; - var hostRect = _getRectangleFromElement(hostElement); - var elementEdge = coverTarget ? targetEdge : targetEdge * -1; - var returnEdge = alignmentEdge ? alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge; - // If we are finalizing the return edge, choose the edge such that we grow away from the bounds - // If we are not finalizing the return edge but the opposite edge is flush against the bounds, - // choose that as the anchor edge so the element rect can grow away from the bounds' edge - // In this case there will not be a visual difference because there is no more room for the elementRectangle to grow - // in the usual direction - if (!doNotFinalizeReturnEdge || _isEdgeOnBounds(elementRectangle, getOppositeEdge(returnEdge), bounds)) returnEdge = _finalizeReturnEdge(elementRectangle, returnEdge, bounds); - returnValue[(0, _positioningTypes.RectangleEdge)[elementEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge); - returnValue[(0, _positioningTypes.RectangleEdge)[returnEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge); - // if the positioned element will still overflow, return all four edges with in-bounds values - if (forceWithinBounds) { - returnValue[(0, _positioningTypes.RectangleEdge)[elementEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge * -1); - returnValue[(0, _positioningTypes.RectangleEdge)[returnEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge * -1); + }); } - return returnValue; -} -// Since the beak is rotated 45 degrees the actual height/width is the length of the diagonal. -// We still want to position the beak based on it's midpoint which does not change. It will -// be at (beakwidth / 2, beakwidth / 2) -function _calculateActualBeakWidthInPixels(beakWidth) { - return Math.sqrt(beakWidth * beakWidth * 2); -} -/** - * Returns the appropriate IPositionData based on the props altered for RTL. - * If directionalHintForRTL is passed in that is used if the page is RTL. - * If directionalHint is specified, no directionalHintForRTL is available, and the page is RTL, the hint will be - * flipped (e.g. bottomLeftEdge would become bottomRightEdge). - * - * If there is no directionalHint passed in, bottomAutoEdge is chosen automatically. - */ function _getPositionData(directionalHint, directionalHintForRTL, previousPositions) { - if (directionalHint === void 0) directionalHint = (0, _directionalHint.DirectionalHint).bottomAutoEdge; - if (previousPositions) return { - alignmentEdge: previousPositions.alignmentEdge, - isAuto: previousPositions.isAuto, - targetEdge: previousPositions.targetEdge + ); + var CONTEXTUAL_MENU_ITEM_HEIGHT = 36; + var MediumScreenSelector$1 = getScreenSelector(0, ScreenWidthMaxMedium); + var getMenuItemStyles = memoizeFunction(function(theme) { + var _a2, _b2, _c2, _d2, _e2; + var semanticColors = theme.semanticColors, fonts = theme.fonts, palette = theme.palette; + var ContextualMenuItemBackgroundHoverColor = semanticColors.menuItemBackgroundHovered; + var ContextualMenuItemTextHoverColor = semanticColors.menuItemTextHovered; + var ContextualMenuItemBackgroundSelectedColor = semanticColors.menuItemBackgroundPressed; + var ContextualMenuItemDividerColor = semanticColors.bodyDivider; + var menuItemStyles = { + item: [ + fonts.medium, + { + color: semanticColors.bodyText, + position: "relative", + boxSizing: "border-box" + } + ], + divider: { + display: "block", + height: "1px", + backgroundColor: ContextualMenuItemDividerColor, + position: "relative" + }, + root: [ + getFocusStyle(theme), + fonts.medium, + { + color: semanticColors.bodyText, + backgroundColor: "transparent", + border: "none", + width: "100%", + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + display: "block", + cursor: "pointer", + padding: "0px 8px 0 4px", + // inner elements have a margin of 4px (4 + 4 = 8px as on right side) + textAlign: "left" + } + ], + rootDisabled: { + color: semanticColors.disabledBodyText, + cursor: "default", + pointerEvents: "none", + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + // ensure disabled text looks different than enabled + color: "GrayText", + opacity: 1 + }, _a2) + }, + rootHovered: { + backgroundColor: ContextualMenuItemBackgroundHoverColor, + color: ContextualMenuItemTextHoverColor, + selectors: { + ".ms-ContextualMenu-icon": { + color: palette.themeDarkAlt + }, + ".ms-ContextualMenu-submenuIcon": { + color: palette.neutralPrimary + } + } + }, + rootFocused: { + backgroundColor: palette.white + }, + rootChecked: { + selectors: { + ".ms-ContextualMenu-checkmarkIcon": { + color: palette.neutralPrimary + } + } + }, + rootPressed: { + backgroundColor: ContextualMenuItemBackgroundSelectedColor, + selectors: { + ".ms-ContextualMenu-icon": { + color: palette.themeDark + }, + ".ms-ContextualMenu-submenuIcon": { + color: palette.neutralPrimary + } + } + }, + rootExpanded: { + backgroundColor: ContextualMenuItemBackgroundSelectedColor, + color: semanticColors.bodyTextChecked, + selectors: (_b2 = { + ".ms-ContextualMenu-submenuIcon": (_c2 = {}, _c2[HighContrastSelector] = { + // icons inside of anchor tags are not properly inheriting color in high contrast + color: "inherit" + }, _c2) + }, _b2[HighContrastSelector] = __assign$1({}, getHighContrastNoAdjustStyle()), _b2) + }, + linkContent: { + whiteSpace: "nowrap", + height: "inherit", + display: "flex", + alignItems: "center", + maxWidth: "100%" + }, + anchorLink: { + padding: "0px 8px 0 4px", + // inner elements have a margin of 4px (4 + 4 = 8px as on right side) + textRendering: "auto", + color: "inherit", + letterSpacing: "normal", + wordSpacing: "normal", + textTransform: "none", + textIndent: "0px", + textShadow: "none", + textDecoration: "none", + boxSizing: "border-box" + }, + label: { + margin: "0 4px", + verticalAlign: "middle", + display: "inline-block", + flexGrow: "1", + textOverflow: "ellipsis", + whiteSpace: "nowrap", + overflow: "hidden" + }, + secondaryText: { + color: theme.palette.neutralSecondary, + paddingLeft: "20px", + textAlign: "right" + }, + icon: { + display: "inline-block", + minHeight: "1px", + maxHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + fontSize: IconFontSizes.medium, + width: IconFontSizes.medium, + margin: "0 4px", + verticalAlign: "middle", + flexShrink: "0", + selectors: (_d2 = {}, _d2[MediumScreenSelector$1] = { + fontSize: IconFontSizes.large, + width: IconFontSizes.large + }, _d2) + }, + iconColor: { + color: semanticColors.menuIcon + }, + iconDisabled: { + color: semanticColors.disabledBodyText + }, + checkmarkIcon: { + color: semanticColors.bodySubtext + }, + subMenuIcon: { + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + color: palette.neutralSecondary, + textAlign: "center", + display: "inline-block", + verticalAlign: "middle", + flexShrink: "0", + fontSize: IconFontSizes.small, + // 12px + selectors: (_e2 = { + ":hover": { + color: palette.neutralPrimary + }, + ":active": { + color: palette.neutralPrimary + } + }, _e2[MediumScreenSelector$1] = { + fontSize: IconFontSizes.medium + // 16px + }, _e2) + }, + splitButtonFlexContainer: [ + getFocusStyle(theme), + { + display: "flex", + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + flexWrap: "nowrap", + justifyContent: "center", + alignItems: "flex-start" + } + ] }; - var positionInformation = (0, _tslib.__assign)({}, DirectionalDictionary[directionalHint]); - if ((0, _utilities.getRTL)()) { - // If alignment edge exists and that alignment edge is -2 or 2, right or left, then flip it. - if (positionInformation.alignmentEdge && positionInformation.alignmentEdge % 2 === 0) positionInformation.alignmentEdge = positionInformation.alignmentEdge * -1; - return directionalHintForRTL !== undefined ? DirectionalDictionary[directionalHintForRTL] : positionInformation; + return concatStyleSets(menuItemStyles); + }); + var CONTEXTUAL_SPLIT_MENU_MINWIDTH = "28px"; + var MediumScreenSelector = getScreenSelector(0, ScreenWidthMaxMedium); + var getSplitButtonVerticalDividerClassNames = memoizeFunction( + /* eslint-disable @typescript-eslint/no-deprecated */ + function(theme) { + var _a2; + return mergeStyleSets(getDividerClassNames(theme), { + /* eslint-enable @typescript-eslint/no-deprecated */ + wrapper: { + position: "absolute", + right: 28, + // width of the splitMenu based on the padding plus icon fontSize + selectors: (_a2 = {}, _a2[MediumScreenSelector] = { + right: 32 + // fontSize of the icon increased from 12px to 16px + }, _a2) + }, + divider: { + height: 16, + width: 1 + } + }); } - return positionInformation; -} -/** - * Gets the alignment data for the given information. This only really matters if the positioning is Auto. - * If it is auto then the alignmentEdge should be chosen based on the target edge's position relative to - * the center of the page. - */ function _getAlignmentData(positionData, target, boundingRect, coverTarget, alignTargetEdge) { - if (positionData.isAuto) positionData.alignmentEdge = getClosestEdge(positionData.targetEdge, target, boundingRect); - positionData.alignTargetEdge = alignTargetEdge; - return positionData; -} -function getClosestEdge(targetEdge, target, boundingRect) { - var targetCenter = _getCenterValue(target, targetEdge); - var boundingCenter = _getCenterValue(boundingRect, targetEdge); - var _a = _getFlankingEdges(targetEdge), positiveEdge = _a.positiveEdge, negativeEdge = _a.negativeEdge; - if (targetCenter <= boundingCenter) return positiveEdge; - else return negativeEdge; -} -function _positionElementWithinBounds(elementToPosition, target, bounding, positionData, gap, shouldScroll, minimumScrollResizeHeight, directionalHintFixed, coverTarget) { - if (shouldScroll === void 0) shouldScroll = false; - var estimatedElementPosition = _estimatePosition(elementToPosition, target, positionData, gap, coverTarget); - if (_isRectangleWithinBounds(estimatedElementPosition, bounding)) return { - elementRectangle: estimatedElementPosition, - targetEdge: positionData.targetEdge, - alignmentEdge: positionData.alignmentEdge - }; - else return _adjustFitWithinBounds(estimatedElementPosition, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget); -} -function _finalizeBeakPosition(elementPosition, positionedBeak, bounds) { - var targetEdge = elementPosition.targetEdge * -1; - // The "host" element that we will use to help position the beak. - var actualElement = new (0, _utilities.Rectangle)(0, elementPosition.elementRectangle.width, 0, elementPosition.elementRectangle.height); - var returnValue = {}; - var returnEdge = _finalizeReturnEdge(elementPosition.elementRectangle, elementPosition.alignmentEdge ? elementPosition.alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge, bounds); - // only show the beak if the callout is not fully covering the target - var beakEdgeDifference = _getRelativeEdgeDifference(elementPosition.elementRectangle, elementPosition.targetRectangle, targetEdge); - var showBeak = beakEdgeDifference > Math.abs(_getEdgeValue(positionedBeak, targetEdge)); - returnValue[(0, _positioningTypes.RectangleEdge)[targetEdge]] = _getEdgeValue(positionedBeak, targetEdge); - returnValue[(0, _positioningTypes.RectangleEdge)[returnEdge]] = _getRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); - return { - elementPosition: (0, _tslib.__assign)({}, returnValue), - closestEdge: getClosestEdge(elementPosition.targetEdge, positionedBeak, actualElement), - targetEdge: targetEdge, - hideBeak: !showBeak - }; -} -function _positionBeak(beakWidth, elementPosition) { - var target = elementPosition.targetRectangle; - /** - * Note about beak positioning: The actual beak width only matters for getting the gap between the callout and - * target, it does not impact the beak placement within the callout. For example example, if the beakWidth is 8, - * then the actual beakWidth is sqrroot(8^2 + 8^2) = 11.31x11.31. So the callout will need to be an extra 3 pixels - * away from its target. While the beak is being positioned in the callout it still acts as though it were 8x8. - */ var _a = _getFlankingEdges(elementPosition.targetEdge), positiveEdge = _a.positiveEdge, negativeEdge = _a.negativeEdge; - var beakTargetPoint = _getCenterValue(target, elementPosition.targetEdge); - var elementBounds = new (0, _utilities.Rectangle)(beakWidth / 2, elementPosition.elementRectangle.width - beakWidth / 2, beakWidth / 2, elementPosition.elementRectangle.height - beakWidth / 2); - var beakPosition = new (0, _utilities.Rectangle)(0, beakWidth, 0, beakWidth); - beakPosition = _moveEdge(beakPosition, elementPosition.targetEdge * -1, -beakWidth / 2); - beakPosition = _centerEdgeToPoint(beakPosition, elementPosition.targetEdge * -1, beakTargetPoint - _getRelativeRectEdgeValue(positiveEdge, elementPosition.elementRectangle)); - if (!_isEdgeInBounds(beakPosition, elementBounds, positiveEdge)) beakPosition = _alignEdges(beakPosition, elementBounds, positiveEdge); - else if (!_isEdgeInBounds(beakPosition, elementBounds, negativeEdge)) beakPosition = _alignEdges(beakPosition, elementBounds, negativeEdge); - return beakPosition; -} -function _getRectangleFromElement(element) { - // eslint-disable-next-line deprecation/deprecation - var clientRect = element.getBoundingClientRect(); - return new (0, _utilities.Rectangle)(clientRect.left, clientRect.right, clientRect.top, clientRect.bottom); -} -function _getRectangleFromIRect(rect) { - return new (0, _utilities.Rectangle)(rect.left, rect.right, rect.top, rect.bottom); -} -function _getTargetRect(bounds, target) { - var targetRectangle; - if (target) { - // eslint-disable-next-line no-extra-boolean-cast - if (!!target.preventDefault) { - var ev = target; - targetRectangle = new (0, _utilities.Rectangle)(ev.clientX, ev.clientX, ev.clientY, ev.clientY); - // eslint-disable-next-line no-extra-boolean-cast - } else if (!!target.getBoundingClientRect) targetRectangle = _getRectangleFromElement(target); - else { - var rectOrPoint = target; - // eslint-disable-next-line deprecation/deprecation - var left = rectOrPoint.left || rectOrPoint.x; - // eslint-disable-next-line deprecation/deprecation - var top_1 = rectOrPoint.top || rectOrPoint.y; - var right = rectOrPoint.right || left; - var bottom = rectOrPoint.bottom || top_1; - targetRectangle = new (0, _utilities.Rectangle)(left, right, top_1, bottom); - } - if (!_isRectangleWithinBounds(targetRectangle, bounds)) { - var outOfBounds = _getOutOfBoundsEdges(targetRectangle, bounds); - for(var _i = 0, outOfBounds_1 = outOfBounds; _i < outOfBounds_1.length; _i++){ - var direction = outOfBounds_1[_i]; - targetRectangle[(0, _positioningTypes.RectangleEdge)[direction]] = bounds[(0, _positioningTypes.RectangleEdge)[direction]]; - } + ); + var GlobalClassNames$d = { + item: "ms-ContextualMenu-item", + divider: "ms-ContextualMenu-divider", + root: "ms-ContextualMenu-link", + isChecked: "is-checked", + isExpanded: "is-expanded", + isDisabled: "is-disabled", + linkContent: "ms-ContextualMenu-linkContent", + linkContentMenu: "ms-ContextualMenu-linkContent", + icon: "ms-ContextualMenu-icon", + iconColor: "ms-ContextualMenu-iconColor", + checkmarkIcon: "ms-ContextualMenu-checkmarkIcon", + subMenuIcon: "ms-ContextualMenu-submenuIcon", + label: "ms-ContextualMenu-itemText", + secondaryText: "ms-ContextualMenu-secondaryText", + splitMenu: "ms-ContextualMenu-splitMenu", + screenReaderText: "ms-ContextualMenu-screenReaderText" + }; + var getItemClassNames = memoizeFunction(function(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className2) { + var _a2, _b2, _c2, _d2; + var styles = getMenuItemStyles(theme); + var classNames2 = getGlobalClassNames(GlobalClassNames$d, theme); + return mergeStyleSets({ + item: [classNames2.item, styles.item, itemClassName], + divider: [classNames2.divider, styles.divider, dividerClassName], + root: [ + classNames2.root, + styles.root, + checked && [classNames2.isChecked, styles.rootChecked], + isAnchorLink && styles.anchorLink, + expanded && [classNames2.isExpanded, styles.rootExpanded], + disabled && [classNames2.isDisabled, styles.rootDisabled], + !disabled && !expanded && [ + { + selectors: (_a2 = { + ":hover": styles.rootHovered, + ":active": styles.rootPressed + }, // eslint-disable-next-line @fluentui/max-len + _a2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _a2[".".concat(IsFocusVisibleClassName, " &:hover, :host(.").concat(IsFocusVisibleClassName, ") &:hover")] = { + background: "inherit;" + }, _a2) + } + ], + className2 + ], + splitPrimary: [ + styles.root, + { + width: "calc(100% - ".concat(CONTEXTUAL_SPLIT_MENU_MINWIDTH, ")") + }, + checked && ["is-checked", styles.rootChecked], + (disabled || primaryDisabled) && ["is-disabled", styles.rootDisabled], + !(disabled || primaryDisabled) && !checked && [ + { + selectors: (_b2 = { + ":hover": styles.rootHovered + }, // when hovering over the splitPrimary also affect the splitMenu + _b2[":hover ~ .".concat(classNames2.splitMenu)] = styles.rootHovered, _b2[":active"] = styles.rootPressed, // eslint-disable-next-line @fluentui/max-len + _b2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _b2[".".concat(IsFocusVisibleClassName, " &:hover, :host(.").concat(IsFocusVisibleClassName, ") &:hover")] = { + background: "inherit;" + }, _b2) + } + ] + ], + splitMenu: [ + classNames2.splitMenu, + styles.root, + { + flexBasis: "0", + padding: "0 8px", + minWidth: CONTEXTUAL_SPLIT_MENU_MINWIDTH + }, + expanded && ["is-expanded", styles.rootExpanded], + disabled && ["is-disabled", styles.rootDisabled], + !disabled && !expanded && [ + { + selectors: (_c2 = { + ":hover": styles.rootHovered, + ":active": styles.rootPressed + }, // eslint-disable-next-line @fluentui/max-len + _c2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _c2[".".concat(IsFocusVisibleClassName, " &:hover, :host(.").concat(IsFocusVisibleClassName, ") &:hover")] = { + background: "inherit;" + }, _c2) + } + ] + ], + anchorLink: styles.anchorLink, + linkContent: [classNames2.linkContent, styles.linkContent], + linkContentMenu: [ + classNames2.linkContentMenu, + styles.linkContent, + { + justifyContent: "center" + } + ], + icon: [ + classNames2.icon, + knownIcon && styles.iconColor, + styles.icon, + iconClassName, + disabled && [classNames2.isDisabled, styles.iconDisabled] + ], + iconColor: styles.iconColor, + checkmarkIcon: [classNames2.checkmarkIcon, knownIcon && styles.checkmarkIcon, styles.icon, iconClassName], + subMenuIcon: [ + classNames2.subMenuIcon, + styles.subMenuIcon, + subMenuClassName, + expanded && { color: theme.palette.neutralPrimary }, + disabled && [styles.iconDisabled] + ], + label: [classNames2.label, styles.label], + secondaryText: [classNames2.secondaryText, styles.secondaryText], + splitContainer: [ + styles.splitButtonFlexContainer, + !disabled && !checked && [ + { + selectors: (_d2 = {}, // eslint-disable-next-line @fluentui/max-len + _d2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _d2) + } + ] + ], + screenReaderText: [ + classNames2.screenReaderText, + styles.screenReaderText, + hiddenContentStyle, + { visibility: "hidden" } + ] + }); + }); + var getItemStyles = function(props) { + var theme = props.theme, disabled = props.disabled, expanded = props.expanded, checked = props.checked, isAnchorLink = props.isAnchorLink, knownIcon = props.knownIcon, itemClassName = props.itemClassName, dividerClassName = props.dividerClassName, iconClassName = props.iconClassName, subMenuClassName = props.subMenuClassName, primaryDisabled = props.primaryDisabled, className2 = props.className; + return getItemClassNames(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className2); + }; + var ContextualMenuItem = styled(ContextualMenuItemBase, getItemStyles, void 0, { scope: "ContextualMenuItem" }); + var ContextualMenuItemWrapper = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuItemWrapper2, _super); + function ContextualMenuItemWrapper2(props) { + var _this = _super.call(this, props) || this; + _this._onItemMouseEnter = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseEnter = _a2.onItemMouseEnter; + if (onItemMouseEnter) { + onItemMouseEnter(item, ev, ev.currentTarget); + } + }; + _this._onItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemClickBase = _a2.onItemClickBase; + if (onItemClickBase) { + onItemClickBase(item, ev, ev.currentTarget); + } + }; + _this._onItemMouseLeave = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseLeave = _a2.onItemMouseLeave; + if (onItemMouseLeave) { + onItemMouseLeave(item, ev); + } + }; + _this._onItemKeyDown = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemKeyDown = _a2.onItemKeyDown; + if (onItemKeyDown) { + onItemKeyDown(item, ev); + } + }; + _this._onItemMouseMove = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseMove = _a2.onItemMouseMove; + if (onItemMouseMove) { + onItemMouseMove(item, ev, ev.currentTarget); + } + }; + _this._getSubmenuTarget = function() { + return void 0; + }; + initializeComponentRef(_this); + return _this; + } + ContextualMenuItemWrapper2.prototype.shouldComponentUpdate = function(newProps) { + return !shallowCompare(newProps, this.props); + }; + return ContextualMenuItemWrapper2; + })(React__namespace.Component) + ); + var KTP_PREFIX = "ktp"; + var KTP_SEPARATOR = "-"; + var DATAKTP_TARGET = "data-ktp-target"; + var DATAKTP_EXECUTE_TARGET = "data-ktp-execute-target"; + var KTP_LAYER_ID = "ktp-layer-id"; + var KeytipEvents; + (function(KeytipEvents2) { + KeytipEvents2.KEYTIP_ADDED = "keytipAdded"; + KeytipEvents2.KEYTIP_REMOVED = "keytipRemoved"; + KeytipEvents2.KEYTIP_UPDATED = "keytipUpdated"; + KeytipEvents2.PERSISTED_KEYTIP_ADDED = "persistedKeytipAdded"; + KeytipEvents2.PERSISTED_KEYTIP_REMOVED = "persistedKeytipRemoved"; + KeytipEvents2.PERSISTED_KEYTIP_EXECUTE = "persistedKeytipExecute"; + KeytipEvents2.ENTER_KEYTIP_MODE = "enterKeytipMode"; + KeytipEvents2.EXIT_KEYTIP_MODE = "exitKeytipMode"; + })(KeytipEvents || (KeytipEvents = {})); + var KeytipManager = ( + /** @class */ + (function() { + function KeytipManager2() { + this.keytips = {}; + this.persistedKeytips = {}; + this.sequenceMapping = {}; + this.inKeytipMode = false; + this.shouldEnterKeytipMode = true; + this.delayUpdatingKeytipChange = false; + } + KeytipManager2.getInstance = function() { + return this._instance; + }; + KeytipManager2.prototype.init = function(delayUpdatingKeytipChange) { + this.delayUpdatingKeytipChange = delayUpdatingKeytipChange; + }; + KeytipManager2.prototype.register = function(keytipProps, persisted) { + if (persisted === void 0) { + persisted = false; + } + var props = keytipProps; + if (!persisted) { + props = this.addParentOverflow(keytipProps); + this.sequenceMapping[props.keySequences.toString()] = props; + } + var uniqueKeytip = this._getUniqueKtp(props); + persisted ? this.persistedKeytips[uniqueKeytip.uniqueID] = uniqueKeytip : this.keytips[uniqueKeytip.uniqueID] = uniqueKeytip; + if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { + var event_1 = persisted ? KeytipEvents.PERSISTED_KEYTIP_ADDED : KeytipEvents.KEYTIP_ADDED; + EventGroup.raise(this, event_1, { + keytip: props, + uniqueID: uniqueKeytip.uniqueID + }); + } + return uniqueKeytip.uniqueID; + }; + KeytipManager2.prototype.update = function(keytipProps, uniqueID) { + var newKeytipProps = this.addParentOverflow(keytipProps); + var uniqueKeytip = this._getUniqueKtp(newKeytipProps, uniqueID); + var oldKeyTip = this.keytips[uniqueID]; + if (oldKeyTip) { + uniqueKeytip.keytip.visible = oldKeyTip.keytip.visible; + this.keytips[uniqueID] = uniqueKeytip; + delete this.sequenceMapping[oldKeyTip.keytip.keySequences.toString()]; + this.sequenceMapping[uniqueKeytip.keytip.keySequences.toString()] = uniqueKeytip.keytip; + if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { + EventGroup.raise(this, KeytipEvents.KEYTIP_UPDATED, { + keytip: uniqueKeytip.keytip, + uniqueID: uniqueKeytip.uniqueID + }); + } + } + }; + KeytipManager2.prototype.unregister = function(keytipToRemove, uniqueID, persisted) { + if (persisted === void 0) { + persisted = false; + } + persisted ? delete this.persistedKeytips[uniqueID] : delete this.keytips[uniqueID]; + !persisted && delete this.sequenceMapping[keytipToRemove.keySequences.toString()]; + var event2 = persisted ? KeytipEvents.PERSISTED_KEYTIP_REMOVED : KeytipEvents.KEYTIP_REMOVED; + if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { + EventGroup.raise(this, event2, { + keytip: keytipToRemove, + uniqueID + }); + } + }; + KeytipManager2.prototype.enterKeytipMode = function() { + EventGroup.raise(this, KeytipEvents.ENTER_KEYTIP_MODE); + }; + KeytipManager2.prototype.exitKeytipMode = function() { + EventGroup.raise(this, KeytipEvents.EXIT_KEYTIP_MODE); + }; + KeytipManager2.prototype.getKeytips = function() { + var _this = this; + return Object.keys(this.keytips).map(function(key2) { + return _this.keytips[key2].keytip; + }); + }; + KeytipManager2.prototype.addParentOverflow = function(keytipProps) { + var fullSequence = __spreadArray([], keytipProps.keySequences, true); + fullSequence.pop(); + if (fullSequence.length !== 0) { + var parentKeytip = this.sequenceMapping[fullSequence.toString()]; + if (parentKeytip && parentKeytip.overflowSetSequence) { + return __assign$1(__assign$1({}, keytipProps), { overflowSetSequence: parentKeytip.overflowSetSequence }); + } } - } else targetRectangle = new (0, _utilities.Rectangle)(0, 0, 0, 0); - return targetRectangle; -} -/** - * If max height is less than zero it returns the bounds height instead. - */ function _getMaxHeightFromTargetRectangle(targetRectangle, targetEdge, gapSpace, bounds, coverTarget) { - var maxHeight = 0; - var directionalHint = DirectionalDictionary[targetEdge]; - // If cover target is set, then the max height should be calculated using the opposite of the target edge since - // that's the direction that the callout will expand in. - // For instance, if the directionalhint is bottomLeftEdge then the callout will position so it's bottom edge - // is aligned with the bottom of the target and expand up towards the top of the screen and the calculated max height - // is (bottom of target) - (top of screen) - gapSpace. - var target = coverTarget ? directionalHint.targetEdge * -1 : directionalHint.targetEdge; - if (target === (0, _positioningTypes.RectangleEdge).top) maxHeight = _getEdgeValue(targetRectangle, directionalHint.targetEdge) - bounds.top - gapSpace; - else if (target === (0, _positioningTypes.RectangleEdge).bottom) maxHeight = bounds.bottom - _getEdgeValue(targetRectangle, directionalHint.targetEdge) - gapSpace; - else maxHeight = bounds.bottom - targetRectangle.top - gapSpace; - return maxHeight > 0 ? maxHeight : bounds.height; -} -function _positionElementRelative(props, elementToPosition, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight) { - if (shouldScroll === void 0) shouldScroll = false; - var gap = props.gapSpace ? props.gapSpace : 0; - var targetRect = _getTargetRect(boundingRect, props.target); - var positionData = _getAlignmentData(_getPositionData(props.directionalHint, props.directionalHintForRTL, previousPositions), targetRect, boundingRect, props.coverTarget, props.alignTargetEdge); - var positionedElement = _positionElementWithinBounds(_getRectangleFromElement(elementToPosition), targetRect, boundingRect, positionData, gap, shouldScroll, minimumScrollResizeHeight, props.directionalHintFixed, props.coverTarget); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, positionedElement), { - targetRectangle: targetRect - }); -} -function _finalizePositionData(positionedElement, hostElement, bounds, coverTarget, doNotFinalizeReturnEdge) { - var finalizedElement = _finalizeElementPosition(positionedElement.elementRectangle, hostElement, positionedElement.targetEdge, bounds, positionedElement.alignmentEdge, coverTarget, doNotFinalizeReturnEdge, positionedElement.forcedInBounds); - return { - elementPosition: finalizedElement, - targetEdge: positionedElement.targetEdge, - alignmentEdge: positionedElement.alignmentEdge - }; -} -function _positionElement(props, hostElement, elementToPosition, previousPositions, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new (0, _utilities.Rectangle)(0, theWin.innerWidth - (0, _utilities.getScrollbarWidth)(), 0, theWin.innerHeight); - var positionedElement = _positionElementRelative(props, elementToPosition, boundingRect, previousPositions); - return _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget); -} -function _calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { - if (beakWidth === void 0) beakWidth = 0; - if (gapSpace === void 0) gapSpace = 0; - return _calculateActualBeakWidthInPixels(isBeakVisible ? beakWidth : 0) / 2 + gapSpace; -} -function _positionCallout(props, hostElement, callout, previousPositions, shouldScroll, minimumScrollResizeHeight, doNotFinalizeReturnEdge, win) { - if (shouldScroll === void 0) shouldScroll = false; - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - var beakWidth = props.isBeakVisible ? props.beakWidth || 0 : 0; - var gap = _calculateGapSpace(props.isBeakVisible, props.beakWidth, props.gapSpace); - var positionProps = props; - positionProps.gapSpace = gap; - var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new (0, _utilities.Rectangle)(0, theWin.innerWidth - (0, _utilities.getScrollbarWidth)(), 0, theWin.innerHeight); - var positionedElement = _positionElementRelative(positionProps, callout, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight); - var beakPositioned = _positionBeak(beakWidth, positionedElement); - var finalizedBeakPosition = _finalizeBeakPosition(positionedElement, beakPositioned, boundingRect); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget, doNotFinalizeReturnEdge)), { - beakPosition: finalizedBeakPosition + return keytipProps; + }; + KeytipManager2.prototype.menuExecute = function(overflowButtonSequences, keytipSequences) { + EventGroup.raise(this, KeytipEvents.PERSISTED_KEYTIP_EXECUTE, { + overflowButtonSequences, + keytipSequences + }); + }; + KeytipManager2.prototype._getUniqueKtp = function(keytipProps, uniqueID) { + if (uniqueID === void 0) { + uniqueID = getId(); + } + return { keytip: __assign$1({}, keytipProps), uniqueID }; + }; + KeytipManager2._instance = new KeytipManager2(); + return KeytipManager2; + })() + ); + function sequencesToID(keySequences) { + return keySequences.reduce(function(prevValue, keySequence) { + return prevValue + KTP_SEPARATOR + keySequence.split("").join(KTP_SEPARATOR); + }, KTP_PREFIX); + } + function mergeOverflows(keySequences, overflowKeySequences) { + var overflowSequenceLen = overflowKeySequences.length; + var overflowSequence = __spreadArray([], overflowKeySequences, true).pop(); + var newKeySequences = __spreadArray([], keySequences, true); + return addElementAtIndex(newKeySequences, overflowSequenceLen - 1, overflowSequence); + } + function getAriaDescribedBy(keySequences) { + var describedby = " " + KTP_LAYER_ID; + if (!keySequences.length) { + return describedby; + } + return describedby + " " + sequencesToID(keySequences); + } + function useKeytipData(options2) { + var uniqueId = React__namespace.useRef(void 0); + var keytipProps = options2.keytipProps ? __assign$1({ disabled: options2.disabled }, options2.keytipProps) : void 0; + var keytipManager = useConst(KeytipManager.getInstance()); + var prevOptions = usePrevious(options2); + useIsomorphicLayoutEffect(function() { + if (uniqueId.current && keytipProps && ((prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.keytipProps) !== options2.keytipProps || (prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.disabled) !== options2.disabled)) { + keytipManager.update(keytipProps, uniqueId.current); + } }); -} -function _positionCard(props, hostElement, callout, previousPositions, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - return _positionCallout(props, hostElement, callout, previousPositions, false, undefined, true, theWin); -} -function _getRectangleFromTarget(target) { - var _a, _b, _c, _d; - var mouseTarget = target; - var elementTarget = target; - var rectOrPointTarget = target; - var targetRect; - // eslint-disable-next-line deprecation/deprecation - var left = (_a = rectOrPointTarget.left) !== null && _a !== void 0 ? _a : rectOrPointTarget.x; - // eslint-disable-next-line deprecation/deprecation - var top = (_b = rectOrPointTarget.top) !== null && _b !== void 0 ? _b : rectOrPointTarget.y; - var right = (_c = rectOrPointTarget.right) !== null && _c !== void 0 ? _c : left; - var bottom = (_d = rectOrPointTarget.bottom) !== null && _d !== void 0 ? _d : top; - // eslint-disable-next-line no-extra-boolean-cast -- may not actually be a MouseEvent - if (!!mouseTarget.stopPropagation) targetRect = new (0, _utilities.Rectangle)(mouseTarget.clientX, mouseTarget.clientX, mouseTarget.clientY, mouseTarget.clientY); - else if (left !== undefined && top !== undefined) targetRect = new (0, _utilities.Rectangle)(left, right, top, bottom); - else targetRect = _getRectangleFromElement(elementTarget); - return targetRect; -} -var __positioningTestPackage = { - _finalizePositionData: _finalizePositionData, - _finalizeBeakPosition: _finalizeBeakPosition, - _calculateActualBeakWidthInPixels: _calculateActualBeakWidthInPixels, - _positionElementWithinBounds: _positionElementWithinBounds, - _positionBeak: _positionBeak, - _getPositionData: _getPositionData, - _getMaxHeightFromTargetRectangle: _getMaxHeightFromTargetRectangle -}; -function positionElement(props, hostElement, elementToPosition, previousPositions, win) { - return _positionElement(props, hostElement, elementToPosition, previousPositions, win); -} -function positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, win) { - return _positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, undefined, win); -} -function positionCard(props, hostElement, elementToPosition, previousPositions, win) { - return _positionCard(props, hostElement, elementToPosition, previousPositions, win); -} -function getMaxHeight(target, targetEdge, gapSpace, bounds, coverTarget, win) { - if (gapSpace === void 0) gapSpace = 0; - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - var targetRect = _getRectangleFromTarget(target); - var boundingRectangle = bounds ? _getRectangleFromIRect(bounds) : new (0, _utilities.Rectangle)(0, theWin.innerWidth - (0, _utilities.getScrollbarWidth)(), 0, theWin.innerHeight); - return _getMaxHeightFromTargetRectangle(targetRect, targetEdge, gapSpace, boundingRectangle, coverTarget); -} -function getOppositeEdge(edge) { - return edge * -1; -} -function _getBoundsFromTargetWindow(target, targetWindow) { - var segments = undefined; - if (targetWindow.getWindowSegments) segments = targetWindow.getWindowSegments(); - // Identify if we're dealing with single screen scenarios. - if (segments === undefined || segments.length <= 1) return { - top: 0, - left: 0, - right: targetWindow.innerWidth, - bottom: targetWindow.innerHeight, - width: targetWindow.innerWidth, - height: targetWindow.innerHeight - }; - // Logic for determining dual screen scenarios. - var x = 0; - var y = 0; - // If the target is an Element get coordinates for its center. - if (target !== null && !!target.getBoundingClientRect) { - var clientRect = target.getBoundingClientRect(); - x = (clientRect.left + clientRect.right) / 2; - y = (clientRect.top + clientRect.bottom) / 2; - } else if (target !== null) { - // eslint-disable-next-line deprecation/deprecation - x = target.left || target.x; - // eslint-disable-next-line deprecation/deprecation - y = target.top || target.y; - } - var bounds = { - top: 0, - left: 0, - right: 0, - bottom: 0, - width: 0, - height: 0 + useIsomorphicLayoutEffect(function() { + if (keytipProps) { + uniqueId.current = keytipManager.register(keytipProps); + } + return function() { + keytipProps && keytipManager.unregister(keytipProps, uniqueId.current); + }; + }, []); + var nativeKeytipProps = { + ariaDescribedBy: options2.ariaDescribedBy, + keytipId: void 0 }; - // Define which window segment are the coordinates in and calculate bounds based on that. - for(var _i = 0, segments_1 = segments; _i < segments_1.length; _i++){ - var segment = segments_1[_i]; - if (x && segment.left <= x && segment.right >= x && y && segment.top <= y && segment.bottom >= y) bounds = { - top: segment.top, - left: segment.left, - right: segment.right, - bottom: segment.bottom, - width: segment.width, - height: segment.height - }; + if (keytipProps) { + nativeKeytipProps = getKeytipData(keytipManager, keytipProps, options2.ariaDescribedBy); } - return bounds; -} -function getBoundsFromTargetWindow(target, targetWindow) { - return _getBoundsFromTargetWindow(target, targetWindow); -} -function calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { - return _calculateGapSpace(isBeakVisible, beakWidth, gapSpace); -} -function getRectangleFromTarget(target) { - return _getRectangleFromTarget(target); -} - -},{"tslib":"9gizs","../../common/DirectionalHint":"avdAc","../../Utilities":"1NZCy","./positioning.types":"g1lRH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g1lRH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RectangleEdge", ()=>RectangleEdge); -parcelHelpers.export(exports, "Position", ()=>Position); -var RectangleEdge; -(function(RectangleEdge) { - RectangleEdge[RectangleEdge["top"] = 1] = "top"; - RectangleEdge[RectangleEdge["bottom"] = -1] = "bottom"; - RectangleEdge[RectangleEdge["left"] = 2] = "left"; - RectangleEdge[RectangleEdge["right"] = -2] = "right"; -})(RectangleEdge || (RectangleEdge = {})); -var Position; -(function(Position) { - Position[Position["top"] = 0] = "top"; - Position[Position["bottom"] = 1] = "bottom"; - Position[Position["start"] = 2] = "start"; - Position[Position["end"] = 3] = "end"; -})(Position || (Position = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bWPOk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./utilities/positioning/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./utilities/positioning/index":"bNxI6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bNxI6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getBoundsFromTargetWindow", ()=>(0, _positioning.getBoundsFromTargetWindow)); -parcelHelpers.export(exports, "getMaxHeight", ()=>(0, _positioning.getMaxHeight)); -parcelHelpers.export(exports, "getOppositeEdge", ()=>(0, _positioning.getOppositeEdge)); -parcelHelpers.export(exports, "positionCallout", ()=>(0, _positioning.positionCallout)); -parcelHelpers.export(exports, "positionCard", ()=>(0, _positioning.positionCard)); -parcelHelpers.export(exports, "positionElement", ()=>(0, _positioning.positionElement)); -var _positioning = require("./positioning"); -var _positioningTypes = require("./positioning.types"); -parcelHelpers.exportAll(_positioningTypes, exports); - -},{"./positioning":"8HbU4","./positioning.types":"g1lRH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOJlv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Popup/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Popup/index":"b83nM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b83nM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _popup = require("./Popup"); -parcelHelpers.exportAll(_popup, exports); -var _popupTypes = require("./Popup.types"); -parcelHelpers.exportAll(_popupTypes, exports); - -},{"./Popup":"3vnAQ","./Popup.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3vnAQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Popup", ()=>Popup); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -function useScrollbarAsync(props, root) { - var async = (0, _reactHooks.useAsync)(); - var _a = _react.useState(false), needsVerticalScrollBarState = _a[0], setNeedsVerticalScrollBar = _a[1]; - _react.useEffect(function() { - async.requestAnimationFrame(function() { - var _a; - // If overflowY is overridden, don't waste time calculating whether the scrollbar is necessary. - if (props.style && props.style.overflowY) return; - var needsVerticalScrollBar = false; - if (root && root.current && ((_a = root.current) === null || _a === void 0 ? void 0 : _a.firstElementChild)) { - // ClientHeight returns the client height of an element rounded to an - // integer. On some browsers at different zoom levels this rounding - // can generate different results for the root container and child even - // though they are the same height. This causes us to show a scroll bar - // when not needed. Ideally we would use BoundingClientRect().height - // instead however seems that the API is 90% slower than using ClientHeight. - // Therefore instead we will calculate the difference between heights and - // allow for a 1px difference to still be considered ok and not show the - // scroll bar. - var rootHeight = root.current.clientHeight; - var firstChildHeight = root.current.firstElementChild.clientHeight; - if (rootHeight > 0 && firstChildHeight > rootHeight) needsVerticalScrollBar = firstChildHeight - rootHeight > 1; - } - if (needsVerticalScrollBarState !== needsVerticalScrollBar) setNeedsVerticalScrollBar(needsVerticalScrollBar); + return nativeKeytipProps; + } + function getKeytipData(keytipManager, keytipProps, describedByPrepend) { + var newKeytipProps = keytipManager.addParentOverflow(keytipProps); + var ariaDescribedBy = mergeAriaAttributeValues(describedByPrepend, getAriaDescribedBy(newKeytipProps.keySequences)); + var keySequences = __spreadArray([], newKeytipProps.keySequences, true); + if (newKeytipProps.overflowSetSequence) { + keySequences = mergeOverflows(keySequences, newKeytipProps.overflowSetSequence); + } + var keytipId = sequencesToID(keySequences); + return { + ariaDescribedBy, + keytipId + }; + } + var KeytipData = function(props) { + var _a2; + var children2 = props.children, keytipDataProps = __rest(props, ["children"]); + var _b2 = useKeytipData(keytipDataProps), keytipId = _b2.keytipId, ariaDescribedBy = _b2.ariaDescribedBy; + return children2((_a2 = {}, _a2[DATAKTP_TARGET] = keytipId, _a2[DATAKTP_EXECUTE_TARGET] = keytipId, _a2["aria-describedby"] = ariaDescribedBy, _a2)); + }; + var ContextualMenuAnchor = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuAnchor2, _super); + function ContextualMenuAnchor2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._anchor = React__namespace.createRef(); + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); }); - return function() { - return async.dispose(); + _this._getSubmenuTarget = function() { + return _this._anchor.current ? _this._anchor.current : void 0; }; - }); - return needsVerticalScrollBarState; -} -function defaultFocusRestorer(options) { - var originalElement = options.originalElement, containsFocus = options.containsFocus; - if (originalElement && containsFocus && originalElement !== (0, _utilities.getWindow)()) // Make sure that the focus method actually exists - // In some cases the object might exist but not be a real element. - // This is primarily for IE 11 and should be removed once IE 11 is no longer in use. - // This is wrapped in a setTimeout because of a React 16 bug that is resolved in 17. - // Once we move to 17, the setTimeout should be removed (ref: https://github.com/facebook/react/issues/17894#issuecomment-656094405) - setTimeout(function() { - var _a; - (_a = originalElement.focus) === null || _a === void 0 || _a.call(originalElement); - }, 0); -} -function useRestoreFocus(props, root) { - var _a = props.onRestoreFocus, onRestoreFocus = _a === void 0 ? defaultFocusRestorer : _a; - var originalFocusedElement = _react.useRef(); - var containsFocus = _react.useRef(false); - _react.useEffect(function() { - originalFocusedElement.current = (0, _utilities.getDocument)().activeElement; - if ((0, _utilities.doesElementContainFocus)(root.current)) containsFocus.current = true; - return function() { - var _a; - onRestoreFocus === null || onRestoreFocus === void 0 || onRestoreFocus({ - originalElement: originalFocusedElement.current, - containsFocus: containsFocus.current, - documentContainsFocus: ((_a = (0, _utilities.getDocument)()) === null || _a === void 0 ? void 0 : _a.hasFocus()) || false - }); - // De-reference DOM Node to avoid retainment via transpiled closure of _onKeyDown - originalFocusedElement.current = undefined; + _this._onItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemClick = _a2.onItemClick; + if (onItemClick) { + onItemClick(item, ev); + } }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run on first render - }, []); - (0, _reactHooks.useOnEvent)(root, 'focus', _react.useCallback(function() { - containsFocus.current = true; - }, []), true); - (0, _reactHooks.useOnEvent)(root, 'blur', _react.useCallback(function(ev) { - /** The popup should update this._containsFocus when: - * relatedTarget exists AND - * the relatedTarget is not contained within the popup. - * If the relatedTarget is within the popup, that means the popup still has focus - * and focused moved from one element to another within the popup. - * If relatedTarget is undefined or null that usually means that a - * keyboard event occurred and focus didn't change - */ if (root.current && ev.relatedTarget && !root.current.contains(ev.relatedTarget)) containsFocus.current = false; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run on first render - }, []), true); -} -function useHideSiblingNodes(props, root) { - // eslint-disable-next-line deprecation/deprecation - var shouldHideSiblings = String(props['aria-modal']).toLowerCase() === 'true' && props.enableAriaHiddenSiblings; - _react.useEffect(function() { - if (!(shouldHideSiblings && root.current)) return; - var unmodalize = (0, _utilities.modalize)(root.current); - return unmodalize; - }, [ - root, - shouldHideSiblings - ]); -} -var Popup = _react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var props = (0, _utilities.getPropsWithDefaults)({ - shouldRestoreFocus: true, - enableAriaHiddenSiblings: true - }, propsWithoutDefaults); - var root = _react.useRef(); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(root, forwardedRef); - useHideSiblingNodes(props, root); - useRestoreFocus(props, root); - var role = props.role, className = props.className, ariaLabel = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, style = props.style, children = props.children, onDismiss = props.onDismiss; - var needsVerticalScrollBar = useScrollbarAsync(props, root); - var onKeyDown = _react.useCallback(function(ev) { - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).escape: - if (onDismiss) { - onDismiss(ev); - ev.preventDefault(); - ev.stopPropagation(); - } - break; + _this._renderAriaDescription = function(ariaDescription, className2) { + return ariaDescription ? React__namespace.createElement("span", { id: _this._ariaDescriptionId, className: className2 }, ariaDescription) : null; + }; + return _this; + } + ContextualMenuAnchor2.prototype.render = function() { + var _this = this; + var _a2 = this.props, item = _a2.item, classNames2 = _a2.classNames, index2 = _a2.index, focusableElementIndex = _a2.focusableElementIndex, totalItemCount = _a2.totalItemCount, hasCheckmarks = _a2.hasCheckmarks, hasIcons = _a2.hasIcons, expandedMenuItemKey = _a2.expandedMenuItemKey, onItemClick = _a2.onItemClick, openSubMenu = _a2.openSubMenu, dismissSubMenu = _a2.dismissSubMenu, dismissMenu = _a2.dismissMenu; + var ChildrenRenderer = ContextualMenuItem; + if (this.props.item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.item.contextualMenuItemAs, ChildrenRenderer); } - }, [ - onDismiss - ]); - var win = (0, _reactWindowProvider.useWindow)(); - (0, _reactHooks.useOnEvent)(win, 'keydown', onKeyDown); - return _react.createElement("div", (0, _tslib.__assign)({ - ref: mergedRootRef - }, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)), { - className: className, - role: role, - "aria-label": ariaLabel, - "aria-labelledby": ariaLabelledBy, - "aria-describedby": ariaDescribedBy, - onKeyDown: onKeyDown, - style: (0, _tslib.__assign)({ - overflowY: needsVerticalScrollBar ? 'scroll' : undefined, - outline: 'none' - }, style) - }), children); -}); -Popup.displayName = 'Popup'; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@fluentui/react-hooks":"2LHjM","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55K1t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useDocumentEx", ()=>useDocumentEx); -parcelHelpers.export(exports, "useWindowEx", ()=>useWindowEx); -parcelHelpers.export(exports, "getDocumentEx", ()=>getDocumentEx); -parcelHelpers.export(exports, "getWindowEx", ()=>getWindowEx); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var useDocumentEx = function() { - var _a; - // eslint-disable-next-line no-restricted-globals - return (_a = (0, _reactWindowProvider.useDocument)()) !== null && _a !== void 0 ? _a : typeof document !== 'undefined' ? document : undefined; -}; -var useWindowEx = function() { - var _a; - // eslint-disable-next-line no-restricted-globals - return (_a = (0, _reactWindowProvider.useWindow)()) !== null && _a !== void 0 ? _a : typeof window !== 'undefined' ? window : undefined; -}; -var getDocumentEx = function(ctx) { - var _a, _b; - // eslint-disable-next-line no-restricted-globals - return (_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.window) === null || _a === void 0 ? void 0 : _a.document) !== null && _b !== void 0 ? _b : typeof document !== 'undefined' ? document : undefined; -}; -var getWindowEx = function(ctx) { - var _a; - // eslint-disable-next-line no-restricted-globals - return (_a = ctx === null || ctx === void 0 ? void 0 : ctx.window) !== null && _a !== void 0 ? _a : typeof window !== 'undefined' ? window : undefined; -}; - -},{"@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bduHE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -function getBeakStyle(beakWidth) { - return { - height: beakWidth, - width: beakWidth - }; -} -var GlobalClassNames = { - container: 'ms-Callout-container', - root: 'ms-Callout', - beak: 'ms-Callout-beak', - beakCurtain: 'ms-Callout-beakCurtain', - calloutMain: 'ms-Callout-main' -}; -var getStyles = function(props) { - var _a; - var theme = props.theme, className = props.className, overflowYHidden = props.overflowYHidden, calloutWidth = props.calloutWidth, beakWidth = props.beakWidth, backgroundColor = props.backgroundColor, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var semanticColors = theme.semanticColors, effects = theme.effects; - return { - container: [ - classNames.container, - { - position: 'relative' - } - ], - root: [ - classNames.root, - theme.fonts.medium, - { - position: 'absolute', - display: 'flex', - zIndex: doNotLayer ? (0, _styling.ZIndexes).Layer : undefined, - boxSizing: 'border-box', - borderRadius: effects.roundedCorner2, - boxShadow: effects.elevation16, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - borderWidth: 1, - borderStyle: 'solid', - borderColor: 'WindowText' - }, _a) - }, - (0, _styling.focusClear)(), - className, - !!calloutWidth && { - width: calloutWidth - }, - !!calloutMaxWidth && { - maxWidth: calloutMaxWidth - }, - !!calloutMinWidth && { - minWidth: calloutMinWidth - } - ], - beak: [ - classNames.beak, - { - position: 'absolute', - backgroundColor: semanticColors.menuBackground, - boxShadow: 'inherit', - border: 'inherit', - boxSizing: 'border-box', - transform: 'rotate(45deg)' - }, - getBeakStyle(beakWidth), - backgroundColor && { - backgroundColor: backgroundColor - } - ], - beakCurtain: [ - classNames.beakCurtain, - { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - left: 0, - backgroundColor: semanticColors.menuBackground, - borderRadius: effects.roundedCorner2 - } - ], - calloutMain: [ - classNames.calloutMain, - { - backgroundColor: semanticColors.menuBackground, - overflowX: 'hidden', - overflowY: 'auto', - position: 'relative', - width: '100%', - borderRadius: effects.roundedCorner2 - }, - overflowYHidden && { - overflowY: 'hidden' - }, - backgroundColor && { - backgroundColor: backgroundColor - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hQjxQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _version = require("./version"); -var _index = require("./components/Layer/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./version":"6kzFC","./components/Layer/index":"60lMd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60lMd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createDefaultLayerHost", ()=>(0, _layerNotification.createDefaultLayerHost)); -parcelHelpers.export(exports, "cleanupDefaultLayerHost", ()=>(0, _layerNotification.cleanupDefaultLayerHost)); -parcelHelpers.export(exports, "getLayerHostSelector", ()=>(0, _layerNotification.getDefaultTarget)); -parcelHelpers.export(exports, "getLayerCount", ()=>(0, _layerNotification.getLayerCount)); -parcelHelpers.export(exports, "getLayerHost", ()=>(0, _layerNotification.getLayerHost)); -parcelHelpers.export(exports, "notifyHostChanged", ()=>(0, _layerNotification.notifyHostChanged)); -parcelHelpers.export(exports, "registerLayer", ()=>(0, _layerNotification.registerLayer)); -parcelHelpers.export(exports, "registerLayerHost", ()=>(0, _layerNotification.registerLayerHost)); -parcelHelpers.export(exports, "setLayerHostSelector", ()=>(0, _layerNotification.setDefaultTarget)); -parcelHelpers.export(exports, "unregisterLayer", ()=>(0, _layerNotification.unregisterLayer)); -parcelHelpers.export(exports, "unregisterLayerHost", ()=>(0, _layerNotification.unregisterLayerHost)); -parcelHelpers.export(exports, "getLayerStyles", ()=>(0, _layerStyles.getStyles)); -var _layer = require("./Layer"); -parcelHelpers.exportAll(_layer, exports); -var _layerBase = require("./Layer.base"); -parcelHelpers.exportAll(_layerBase, exports); -var _layerTypes = require("./Layer.types"); -parcelHelpers.exportAll(_layerTypes, exports); -var _layerHost = require("./LayerHost"); -parcelHelpers.exportAll(_layerHost, exports); -var _layerHostTypes = require("./LayerHost.types"); -parcelHelpers.exportAll(_layerHostTypes, exports); -var _layerNotification = require("./Layer.notification"); -var _layerStyles = require("./Layer.styles"); - -},{"./Layer":"bAxi9","./Layer.base":false,"./Layer.types":false,"./LayerHost":false,"./LayerHost.types":false,"./Layer.notification":false,"./Layer.styles":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bAxi9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Layer", ()=>Layer); -var _utilities = require("../../Utilities"); -var _layerBase = require("./Layer.base"); -var _layerStyles = require("./Layer.styles"); -var Layer = (0, _utilities.styled)((0, _layerBase.LayerBase), (0, _layerStyles.getStyles), undefined, { - scope: 'Layer', - fields: [ - 'hostId', - 'theme', - 'styles' - ] -}); - -},{"../../Utilities":"1NZCy","./Layer.base":"kgbHL","./Layer.styles":"doFKM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kgbHL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LayerBase", ()=>LayerBase); -var _tslib = require("tslib"); -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore "react-portal-compat-context" uses v9 configs via path aliases -var _reactPortalCompatContext = require("@fluentui/react-portal-compat-context"); -var _react = require("react"); -var _reactDom = require("react-dom"); -var _fabric = require("../../Fabric"); -var _utilities = require("../../Utilities"); -var _layerNotification = require("./Layer.notification"); -var _reactHooks = require("@fluentui/react-hooks"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getFocusVisibility = function(providerRef) { - if (providerRef === null || providerRef === void 0 ? void 0 : providerRef.current) return providerRef.current.classList.contains((0, _utilities.IsFocusVisibleClassName)); - return false; -}; -var LayerBase = _react.forwardRef(function(props, ref) { - var registerPortalEl = (0, _reactPortalCompatContext.usePortalCompat)(); - var rootRef = _react.useRef(null); - var mergedRef = (0, _reactHooks.useMergedRefs)(rootRef, ref); - var layerRef = _react.useRef(); - var fabricElementRef = _react.useRef(null); - var focusContext = _react.useContext((0, _utilities.FocusRectsContext)); - // Tracks if the layer mount events need to be raised. - // Required to allow the DOM to render after the layer element is added. - var _a = _react.useState(false), needRaiseLayerMount = _a[0], setNeedRaiseLayerMount = _a[1]; - // Sets the focus visible className when the FocusRectsProvider for the layer is rendered - // This allows the current focus visibility style to be carried over to the layer content - var focusRectsRef = _react.useCallback(function(el) { - var isFocusVisible = getFocusVisibility(focusContext === null || focusContext === void 0 ? void 0 : focusContext.providerRef); - if (el && isFocusVisible) el.classList.add((0, _utilities.IsFocusVisibleClassName)); - }, [ - focusContext - ]); - var children = props.children, className = props.className, eventBubblingEnabled = props.eventBubblingEnabled, fabricProps = props.fabricProps, hostId = props.hostId, insertFirst = props.insertFirst, _b = props.onLayerDidMount, onLayerDidMount = _b === void 0 ? function() { - return undefined; - } : _b, // eslint-disable-next-line deprecation/deprecation - _c = props.onLayerMounted, // eslint-disable-next-line deprecation/deprecation - onLayerMounted = _c === void 0 ? function() { - return undefined; - } : _c, onLayerWillUnmount = props.onLayerWillUnmount, styles = props.styles, theme = props.theme; - var fabricRef = (0, _reactHooks.useMergedRefs)(fabricElementRef, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.ref, focusRectsRef); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - isNotHost: !hostId - }); - // Returns the user provided hostId props element, the default target selector, - // or undefined if document doesn't exist. - var getHost = function(doc, shadowRoot) { - var _a, _b; - if (shadowRoot === void 0) shadowRoot = null; - var root = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : doc; - if (hostId) { - var layerHost = (0, _layerNotification.getLayerHost)(hostId); - if (layerHost) return (_a = layerHost.rootRef.current) !== null && _a !== void 0 ? _a : null; - return (_b = root.getElementById(hostId)) !== null && _b !== void 0 ? _b : null; - } else { - var defaultHostSelector = (0, _layerNotification.getDefaultTarget)(); - // Find the host. - var host = defaultHostSelector ? root.querySelector(defaultHostSelector) : null; - // If no host is available, create a container for injecting layers in. - // Having a container scopes layout computation. - if (!host) host = (0, _layerNotification.createDefaultLayerHost)(doc, shadowRoot); - return host; + if (this.props.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.contextualMenuItemAs, ChildrenRenderer); } - }; - // Removes the current layer element's parentNode and runs onLayerWillUnmount prop if provided. - var removeLayerElement = function() { - onLayerWillUnmount === null || onLayerWillUnmount === void 0 || onLayerWillUnmount(); - var elem = layerRef.current; - // Clear ref before removing from the DOM - layerRef.current = undefined; - if (elem && elem.parentNode) elem.parentNode.removeChild(elem); - }; - // If a doc or host exists, it will remove and update layer parentNodes. - var createLayerElement = function() { - var _a, _b, _c, _d; - var doc = (0, _utilities.getDocument)(rootRef.current); - var shadowRoot = ((_b = (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.getRootNode()) === null || _b === void 0 ? void 0 : _b.host) ? (_c = rootRef === null || rootRef === void 0 ? void 0 : rootRef.current) === null || _c === void 0 ? void 0 : _c.getRootNode() : undefined; - if (!doc || !doc && !shadowRoot) return; - var host = getHost(doc, shadowRoot); - if (!host) return; - // Tabster in V9 sets aria-hidden on the elements outside of the modal dialog. And it doesn't set aria-hidden - // on the virtual children of the dialog. But the host element itself is not a virtual child of a dialog, it - // might contain virtual children. noDirectAriaHidden flag makes Tabster to poke inside the element and set - // aria-hidden on the children (if they are not virtual children of the active V9 dialog) not on the host element. - // To avoid importing Tabster as a dependency here, we just set a flag on the host element which is checked by - // Tabster. - if (!host.__tabsterElementFlags) host.__tabsterElementFlags = {}; - host.__tabsterElementFlags.noDirectAriaHidden = true; - // Remove and re-create any previous existing layer elements. - removeLayerElement(); - var el = ((_d = host.ownerDocument) !== null && _d !== void 0 ? _d : doc).createElement('div'); - el.className = classNames.root; - (0, _utilities.setPortalAttribute)(el); - (0, _utilities.setVirtualParent)(el, rootRef.current); - insertFirst ? host.insertBefore(el, host.firstChild) : host.appendChild(el); - layerRef.current = el; - setNeedRaiseLayerMount(true); - }; - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - createLayerElement(); - // Check if the user provided a hostId prop and register the layer with the ID. - if (hostId) (0, _layerNotification.registerLayer)(hostId, createLayerElement); - var unregisterPortalEl = layerRef.current ? registerPortalEl(layerRef.current) : undefined; - return function() { - if (unregisterPortalEl) unregisterPortalEl(); - removeLayerElement(); - if (hostId) (0, _layerNotification.unregisterLayer)(hostId, createLayerElement); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should run if the hostId updates. - }, [ - hostId - ]); - _react.useEffect(function() { - if (layerRef.current && needRaiseLayerMount) { - onLayerMounted === null || onLayerMounted === void 0 || onLayerMounted(); - onLayerDidMount === null || onLayerDidMount === void 0 || onLayerDidMount(); - setNeedRaiseLayerMount(false); + var anchorRel = item.rel; + if (item.target && item.target.toLowerCase() === "_blank") { + anchorRel = anchorRel ? anchorRel : "nofollow noopener noreferrer"; } - }, [ - needRaiseLayerMount, - onLayerMounted, - onLayerDidMount - ]); - useDebugWarnings(props); - return _react.createElement("span", { - className: "ms-layer", - ref: mergedRef - }, layerRef.current && _reactDom.createPortal(_react.createElement((0, _utilities.FocusRectsProvider), { - layerRoot: true, - providerRef: fabricRef - }, _react.createElement((0, _fabric.Fabric), (0, _tslib.__assign)({}, !eventBubblingEnabled && getFilteredEvents(), fabricProps, { - className: (0, _utilities.css)(classNames.content, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.className), - ref: fabricRef - }), children)), layerRef.current)); -}); -LayerBase.displayName = 'LayerBase'; -var filteredEventProps; -var onFilterEvent = function(ev) { - // We should just be able to check ev.bubble here and only stop events that are bubbling up. However, even though - // mouseenter and mouseleave do NOT bubble up, they are showing up as bubbling. Therefore we stop events based on - // event name rather than ev.bubble. - if (ev.eventPhase === Event.BUBBLING_PHASE && ev.type !== 'mouseenter' && ev.type !== 'mouseleave' && ev.type !== 'touchstart' && ev.type !== 'touchend') ev.stopPropagation(); -}; -function getFilteredEvents() { - if (!filteredEventProps) { - filteredEventProps = {}; - [ - 'onClick', - 'onContextMenu', - 'onDoubleClick', - 'onDrag', - 'onDragEnd', - 'onDragEnter', - 'onDragExit', - 'onDragLeave', - 'onDragOver', - 'onDragStart', - 'onDrop', - 'onMouseDown', - 'onMouseEnter', - 'onMouseLeave', - 'onMouseMove', - 'onMouseOver', - 'onMouseOut', - 'onMouseUp', - 'onTouchMove', - 'onTouchStart', - 'onTouchCancel', - 'onTouchEnd', - 'onKeyDown', - 'onKeyPress', - 'onKeyUp', - 'onFocus', - 'onBlur', - 'onChange', - 'onInput', - 'onInvalid', - 'onSubmit' - ].forEach(function(name) { - return filteredEventProps[name] = onFilterEvent; + var itemHasSubmenu = hasSubmenu(item); + var nativeProps = getNativeProps(item, anchorProperties); + var disabled = isItemDisabled(item); + var itemProps = item.itemProps, ariaDescription = item.ariaDescription; + var keytipProps = item.keytipProps; + if (keytipProps && itemHasSubmenu) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + if (ariaDescription) { + this._ariaDescriptionId = getId(); + } + var ariaDescribedByIds = mergeAriaAttributeValues(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : void 0, nativeProps["aria-describedby"]); + var additionalItemProperties = { + "aria-describedby": ariaDescribedByIds + }; + return React__namespace.createElement( + "div", + null, + React__namespace.createElement(KeytipData, { keytipProps: item.keytipProps, ariaDescribedBy: ariaDescribedByIds, disabled }, function(keytipAttributes) { + return React__namespace.createElement( + "a", + __assign$1({}, additionalItemProperties, nativeProps, keytipAttributes, { + ref: _this._anchor, + href: item.href, + target: item.target, + rel: anchorRel, + className: classNames2.root, + role: "menuitem", + "aria-haspopup": itemHasSubmenu || void 0, + "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : void 0, + "aria-posinset": focusableElementIndex + 1, + "aria-setsize": totalItemCount, + "aria-disabled": isItemDisabled(item), + // eslint-disable-next-line @typescript-eslint/no-deprecated + style: item.style, + onClick: _this._onItemClick, + onMouseEnter: _this._onItemMouseEnter, + onMouseLeave: _this._onItemMouseLeave, + onMouseMove: _this._onItemMouseMove, + onKeyDown: itemHasSubmenu ? _this._onItemKeyDown : void 0 + }), + React__namespace.createElement(ChildrenRenderer, __assign$1({ componentRef: item.componentRef, item, classNames: classNames2, index: index2, onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : void 0, hasIcons, openSubMenu, dismissSubMenu, dismissMenu, getSubmenuTarget: _this._getSubmenuTarget }, itemProps)), + _this._renderAriaDescription(ariaDescription, classNames2.screenReaderText) + ); + }) + ); + }; + return ContextualMenuAnchor2; + })(ContextualMenuItemWrapper) + ); + var ContextualMenuButton = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuButton2, _super); + function ContextualMenuButton2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._btn = React__namespace.createRef(); + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); }); - } - return filteredEventProps; -} -function useDebugWarnings(props) {} - -},{"tslib":"9gizs","@fluentui/react-portal-compat-context":"e83z8","react":"jGrId","react-dom":"1a3X3","../../Fabric":"gZZ0s","../../Utilities":"1NZCy","./Layer.notification":"gngXH","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e83z8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PortalCompatContextProvider", ()=>(0, _portalCompatContext.PortalCompatContextProvider)); -parcelHelpers.export(exports, "usePortalCompat", ()=>(0, _portalCompatContext.usePortalCompat)); -var _portalCompatContext = require("./PortalCompatContext"); - -},{"./PortalCompatContext":"envTF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"envTF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PortalCompatContextProvider", ()=>PortalCompatContextProvider); -parcelHelpers.export(exports, "usePortalCompat", ()=>usePortalCompat); -var _react = require("react"); -var PortalCompatContext = _react.createContext(undefined); -var portalCompatContextDefaultValue = function() { - return function() { - return undefined; - }; -}; -var PortalCompatContextProvider = PortalCompatContext.Provider; -function usePortalCompat() { - var _React_useContext; - return (_React_useContext = _react.useContext(PortalCompatContext)) !== null && _React_useContext !== void 0 ? _React_useContext : portalCompatContextDefaultValue; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gZZ0s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Fabric/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Fabric/index":"ikc5I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ikc5I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _fabric = require("./Fabric"); -parcelHelpers.exportAll(_fabric, exports); -var _fabricBase = require("./Fabric.base"); -parcelHelpers.exportAll(_fabricBase, exports); -var _fabricTypes = require("./Fabric.types"); -parcelHelpers.exportAll(_fabricTypes, exports); - -},{"./Fabric":"ghXvG","./Fabric.base":false,"./Fabric.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ghXvG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fabric", ()=>Fabric); -var _utilities = require("../../Utilities"); -var _fabricBase = require("./Fabric.base"); -var _fabricStyles = require("./Fabric.styles"); -var Fabric = (0, _utilities.styled)((0, _fabricBase.FabricBase), (0, _fabricStyles.getStyles), undefined, { - scope: 'Fabric' -}); - -},{"../../Utilities":"1NZCy","./Fabric.base":"6xJxq","./Fabric.styles":"3SPki","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6xJxq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FabricBase", ()=>FabricBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var _reactHooks = require("@fluentui/react-hooks"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getFabricTheme = (0, _utilities.memoizeFunction)(function(theme, isRTL) { - return (0, _styling.createTheme)((0, _tslib.__assign)((0, _tslib.__assign)({}, theme), { - rtl: isRTL - })); -}); -var getDir = function(_a) { - var theme = _a.theme, dir = _a.dir; - var contextDir = (0, _utilities.getRTL)(theme) ? 'rtl' : 'ltr'; - var pageDir = (0, _utilities.getRTL)() ? 'rtl' : 'ltr'; - var componentDir = dir ? dir : contextDir; - return { - // If Fabric dir !== contextDir - // Or If contextDir !== pageDir - // Then we need to set dir of the Fabric root - rootDir: componentDir !== contextDir || componentDir !== pageDir ? componentDir : dir, - // If dir !== contextDir || pageDir - // then set contextual theme around content - needsTheme: componentDir !== contextDir - }; -}; -var FabricBase = _react.forwardRef(function(props, ref) { - var className = props.className, theme = props.theme, applyTheme = props.applyTheme, applyThemeToBody = props.applyThemeToBody, styles = props.styles; - var classNames = getClassNames(styles, { - theme: theme, - applyTheme: applyTheme, - className: className - }); - var rootElement = _react.useRef(null); - useApplyThemeToBody(applyThemeToBody, classNames, rootElement); - return _react.createElement(_react.Fragment, null, useRenderedContent(props, classNames, rootElement, ref)); -}); -FabricBase.displayName = 'FabricBase'; -function useRenderedContent(props, _a, rootElement, ref) { - var root = _a.root; - var _b = props.as, Root = _b === void 0 ? 'div' : _b, dir = props.dir, theme = props.theme; - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), [ - 'dir' - ]); - var _c = getDir(props), rootDir = _c.rootDir, needsTheme = _c.needsTheme; - var renderedContent = _react.createElement((0, _utilities.FocusRectsProvider), { - providerRef: rootElement - }, _react.createElement(Root, (0, _tslib.__assign)({ - dir: rootDir - }, divProps, { - className: root, - ref: (0, _reactHooks.useMergedRefs)(rootElement, ref) - }))); - // Create the contextual theme if component direction does not match parent direction. - if (needsTheme) // Disabling ThemeProvider here because theme doesn't need to be re-provided by ThemeProvider if dir has changed. - renderedContent = // eslint-disable-next-line deprecation/deprecation - _react.createElement((0, _utilities.Customizer), { - settings: { - theme: getFabricTheme(theme, dir === 'rtl') - } - }, renderedContent); - return renderedContent; -} -function useApplyThemeToBody(applyThemeToBody, _a, rootElement) { - var bodyThemed = _a.bodyThemed; - _react.useEffect(function() { - if (applyThemeToBody) { - var currentDoc_1 = (0, _utilities.getDocument)(rootElement.current); - if (currentDoc_1) { - currentDoc_1.body.classList.add(bodyThemed); - return function() { - currentDoc_1.body.classList.remove(bodyThemed); - }; - } + _this._renderAriaDescription = function(ariaDescription, className2) { + return ariaDescription ? React__namespace.createElement("span", { id: _this._ariaDescriptionId, className: className2 }, ariaDescription) : null; + }; + _this._getSubmenuTarget = function() { + return _this._btn.current ? _this._btn.current : void 0; + }; + return _this; + } + ContextualMenuButton2.prototype.render = function() { + var _this = this; + var _a2 = this.props, item = _a2.item, classNames2 = _a2.classNames, index2 = _a2.index, focusableElementIndex = _a2.focusableElementIndex, totalItemCount = _a2.totalItemCount, hasCheckmarks = _a2.hasCheckmarks, hasIcons = _a2.hasIcons, contextualMenuItemAs = _a2.contextualMenuItemAs, expandedMenuItemKey = _a2.expandedMenuItemKey, onItemMouseDown2 = _a2.onItemMouseDown, onItemClick = _a2.onItemClick, openSubMenu = _a2.openSubMenu, dismissSubMenu = _a2.dismissSubMenu, dismissMenu = _a2.dismissMenu; + var ChildrenRenderer = ContextualMenuItem; + if (item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(item.contextualMenuItemAs, ChildrenRenderer); } - }, [ - bodyThemed, - applyThemeToBody, - rootElement - ]); - return rootElement; -} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Styling":"hTimn","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3SPki":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var inheritFont = { - fontFamily: 'inherit' -}; -var GlobalClassNames = { - root: 'ms-Fabric', - bodyThemed: 'ms-Fabric-bodyThemed' -}; -var getStyles = function(props) { - var applyTheme = props.applyTheme, className = props.className, preventBlanketFontInheritance = props.preventBlanketFontInheritance, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - root: [ - classNames.root, - theme.fonts.medium, - { - color: theme.palette.neutralPrimary - }, - !preventBlanketFontInheritance && { - '& button': inheritFont, - '& input': inheritFont, - '& textarea': inheritFont - }, - // apply theme to only if applyTheme is true - applyTheme && { - color: theme.semanticColors.bodyText, - backgroundColor: theme.semanticColors.bodyBackground - }, - className - ], - bodyThemed: [ - { - backgroundColor: theme.semanticColors.bodyBackground - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gngXH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Register a layer for a given host id - * @param hostId - Id of the layer host - * @param layer - Layer instance - */ parcelHelpers.export(exports, "registerLayer", ()=>registerLayer); -/** - * Unregister a layer for a given host id - * @param hostId - Id of the layer host - * @param layer - Layer instance - */ parcelHelpers.export(exports, "unregisterLayer", ()=>unregisterLayer); -/** - * Gets the number of layers currently registered with a host id. - * @param hostId - Id of the layer host. - * @returns The number of layers currently registered with the host. - */ parcelHelpers.export(exports, "getLayerCount", ()=>getLayerCount); -/** - * Gets the Layer Host instance associated with a hostId, if applicable. - * @param hostId - Id of the layer host - * @returns A component ref for the associated layer host. - */ parcelHelpers.export(exports, "getLayerHost", ()=>getLayerHost); -/** - * Registers a Layer Host with an associated hostId. - * @param hostId - Id of the layer host - * @param layerHost - layer host instance - */ parcelHelpers.export(exports, "registerLayerHost", ()=>registerLayerHost); -/** - * Unregisters a Layer Host from the associated hostId. - * @param hostId - Id of the layer host - * @param layerHost - layer host instance - */ parcelHelpers.export(exports, "unregisterLayerHost", ()=>unregisterLayerHost); -/** - * When no default layer host is provided, this function is executed to create the default host. - */ parcelHelpers.export(exports, "createDefaultLayerHost", ()=>createDefaultLayerHost); -/** - * This function can be optionally called to clean up the default layer host as needed. - */ parcelHelpers.export(exports, "cleanupDefaultLayerHost", ()=>cleanupDefaultLayerHost); -/** - * Used for notifying applicable Layers that a host is available/unavailable and to re-evaluate Layers that - * care about the specific host. - */ parcelHelpers.export(exports, "notifyHostChanged", ()=>notifyHostChanged); -/** - * Sets the default target selector to use when determining the host in which - * Layered content will be injected into. If not provided, an element will be - * created at the end of the document body. - * - * Passing in a falsy value will clear the default target and reset back to - * using a created element at the end of document body. - */ parcelHelpers.export(exports, "setDefaultTarget", ()=>setDefaultTarget); -/** - * Get the default target selector when determining a host - */ parcelHelpers.export(exports, "getDefaultTarget", ()=>getDefaultTarget); -var _layersByHostId = {}; -var _layerHostsById = {}; -var defaultHostId = 'fluent-default-layer-host'; -var _defaultHostSelector = "#".concat(defaultHostId); -function registerLayer(hostId, callback) { - if (!_layersByHostId[hostId]) _layersByHostId[hostId] = []; - _layersByHostId[hostId].push(callback); - var layerHosts = _layerHostsById[hostId]; - if (layerHosts) for(var _i = 0, layerHosts_1 = layerHosts; _i < layerHosts_1.length; _i++){ - var layerHost = layerHosts_1[_i]; - layerHost.notifyLayersChanged(); - } -} -function unregisterLayer(hostId, callback) { - var layers = _layersByHostId[hostId]; - if (layers) { - var idx = layers.indexOf(callback); - if (idx >= 0) { - layers.splice(idx, 1); - if (layers.length === 0) delete _layersByHostId[hostId]; + if (contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(contextualMenuItemAs, ChildrenRenderer); } + var isChecked = getIsChecked(item); + var canCheck = isChecked !== null; + var defaultRole = getMenuItemAriaRole(item); + var itemHasSubmenu = hasSubmenu(item); + var itemProps = item.itemProps, ariaLabel2 = item.ariaLabel, ariaDescription = item.ariaDescription; + var buttonNativeProperties = getNativeProps(item, buttonProperties); + delete buttonNativeProperties.disabled; + var itemRole = item.role || defaultRole; + if (ariaDescription) { + this._ariaDescriptionId = getId(); + } + var ariaDescribedByIds = mergeAriaAttributeValues(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : void 0, buttonNativeProperties["aria-describedby"]); + var itemButtonProperties = { + className: classNames2.root, + onClick: this._onItemClick, + onKeyDown: itemHasSubmenu ? this._onItemKeyDown : void 0, + onMouseEnter: this._onItemMouseEnter, + onMouseLeave: this._onItemMouseLeave, + onMouseDown: function(ev) { + return onItemMouseDown2 ? onItemMouseDown2(item, ev) : void 0; + }, + onMouseMove: this._onItemMouseMove, + href: item.href, + title: item.title, + "aria-label": ariaLabel2, + "aria-describedby": ariaDescribedByIds, + "aria-haspopup": itemHasSubmenu || void 0, + "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : void 0, + "aria-posinset": focusableElementIndex + 1, + "aria-setsize": totalItemCount, + "aria-disabled": isItemDisabled(item), + "aria-checked": (itemRole === "menuitemcheckbox" || itemRole === "menuitemradio") && canCheck ? !!isChecked : void 0, + "aria-selected": itemRole === "menuitem" && canCheck ? !!isChecked : void 0, + role: itemRole, + // eslint-disable-next-line @typescript-eslint/no-deprecated + style: item.style + }; + var keytipProps = item.keytipProps; + if (keytipProps && itemHasSubmenu) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + return React__namespace.createElement(KeytipData, { keytipProps, ariaDescribedBy: ariaDescribedByIds, disabled: isItemDisabled(item) }, function(keytipAttributes) { + return React__namespace.createElement( + "button", + __assign$1({ ref: _this._btn }, buttonNativeProperties, itemButtonProperties, keytipAttributes), + React__namespace.createElement(ChildrenRenderer, __assign$1({ componentRef: item.componentRef, item, classNames: classNames2, index: index2, onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : void 0, hasIcons, openSubMenu, dismissSubMenu, dismissMenu, getSubmenuTarget: _this._getSubmenuTarget }, itemProps)), + _this._renderAriaDescription(ariaDescription, classNames2.screenReaderText) + ); + }); + }; + return ContextualMenuButton2; + })(ContextualMenuItemWrapper) + ); + var getStyles$r = function(props) { + var theme = props.theme, getClassNames2 = props.getClassNames, className2 = props.className; + if (!theme) { + throw new Error("Theme is undefined or null."); + } + if (getClassNames2) { + var names = getClassNames2(theme); + return { + wrapper: [names.wrapper], + divider: [names.divider] + }; } - var layerHosts = _layerHostsById[hostId]; - if (layerHosts) for(var _i = 0, layerHosts_2 = layerHosts; _i < layerHosts_2.length; _i++){ - var layerHost = layerHosts_2[_i]; - layerHost.notifyLayersChanged(); - } -} -function getLayerCount(hostId) { - var layers = _layerHostsById[hostId]; - return layers ? layers.length : 0; -} -function getLayerHost(hostId) { - var layerHosts = _layerHostsById[hostId]; - return layerHosts && layerHosts[0] || undefined; -} -function registerLayerHost(hostId, layerHost) { - var layerHosts = _layerHostsById[hostId] || (_layerHostsById[hostId] = []); - // Insert this at the start of an array to avoid race conditions between mount and unmount. - // If a LayerHost is re-mounted, and mount of the new instance may occur before the unmount of the old one. - // Putting the new instance at the start of this array ensures that calls to `getLayerHost` will immediately - // get the new one even if the old one is around briefly. - layerHosts.unshift(layerHost); -} -function unregisterLayerHost(hostId, layerHost) { - var layerHosts = _layerHostsById[hostId]; - if (layerHosts) { - var idx = layerHosts.indexOf(layerHost); - if (idx >= 0) layerHosts.splice(idx, 1); - if (layerHosts.length === 0) delete _layerHostsById[hostId]; - } -} -function createDefaultLayerHost(doc, shadowRoot) { - if (shadowRoot === void 0) shadowRoot = null; - var host = doc.createElement('div'); - host.setAttribute('id', defaultHostId); - host.style.cssText = 'position:fixed;z-index:1000000'; - if (shadowRoot) shadowRoot.appendChild(host); - else doc === null || doc === void 0 || doc.body.appendChild(host); - // doc?.body.appendChild(host); - return host; -} -function cleanupDefaultLayerHost(doc, shadowRoot) { - if (shadowRoot === void 0) shadowRoot = null; - var root = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : doc; - var host = root.querySelector("#".concat(defaultHostId)); - if (host) root.removeChild(host); -} -function notifyHostChanged(id) { - if (_layersByHostId[id]) _layersByHostId[id].forEach(function(callback) { - return callback(); - }); -} -function setDefaultTarget(selector) { - _defaultHostSelector = selector; -} -function getDefaultTarget() { - return _defaultHostSelector; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"doFKM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-Layer', - rootNoHost: 'ms-Layer--fixed', - content: 'ms-Layer-content' -}; -var getStyles = function(props) { - var className = props.className, isNotHost = props.isNotHost, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); return { - root: [ - classNames.root, - theme.fonts.medium, - isNotHost && [ - classNames.rootNoHost, - { - position: 'fixed', - zIndex: (0, _styling.ZIndexes).Layer, - top: 0, - left: 0, - bottom: 0, - right: 0, - visibility: 'hidden' - } - ], - className - ], - content: [ - classNames.content, - { - visibility: 'visible' - } - ] + wrapper: [ + { + display: "inline-flex", + height: "100%", + alignItems: "center" + }, + className2 + ], + divider: [ + { + width: 1, + height: "100%", + backgroundColor: theme.palette.neutralTertiaryAlt + } + ] }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cJR9f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuItem", ()=>ContextualMenuItem); -var _utilities = require("../../Utilities"); -var _contextualMenuItemBase = require("./ContextualMenuItem.base"); -var _contextualMenuClassNames = require("./ContextualMenu.classNames"); -var ContextualMenuItem = (0, _utilities.styled)((0, _contextualMenuItemBase.ContextualMenuItemBase), (0, _contextualMenuClassNames.getItemStyles), undefined, { - scope: 'ContextualMenuItem' -}); - -},{"../../Utilities":"1NZCy","./ContextualMenuItem.base":"eTkTx","./ContextualMenu.classNames":"bg3cO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eTkTx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuItemBase", ()=>ContextualMenuItemBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _index = require("../../utilities/contextualMenu/index"); -var _utilities = require("../../Utilities"); -var _icon = require("../../Icon"); -var defaultIconRenderer = function(props) { - var item = props.item, classNames = props.classNames; - var iconProps = item.iconProps; - return _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({}, iconProps, { - className: classNames.icon - })); -}; -var renderItemIcon = function(props) { - var item = props.item, hasIcons = props.hasIcons; - if (!hasIcons) return null; - if (item.onRenderIcon) return item.onRenderIcon(props, defaultIconRenderer); - return defaultIconRenderer(props); -}; -var renderCheckMarkIcon = function(_a) { - var onCheckmarkClick = _a.onCheckmarkClick, item = _a.item, classNames = _a.classNames; - var isItemChecked = (0, _index.getIsChecked)(item); - if (onCheckmarkClick) { - // Ensures that the item is passed as the first argument to the checkmark click callback. - var onClick = function(e) { - return onCheckmarkClick(item, e); + }; + var getClassNames$m = classNamesFunction(); + var VerticalDividerBase = React__namespace.forwardRef(function(props, ref2) { + var styles = props.styles, theme = props.theme, deprecatedGetClassNames = props.getClassNames, className2 = props.className; + var classNames2 = getClassNames$m(styles, { theme, getClassNames: deprecatedGetClassNames, className: className2 }); + return React__namespace.createElement( + "span", + { className: classNames2.wrapper, ref: ref2 }, + React__namespace.createElement("span", { className: classNames2.divider }) + ); + }); + VerticalDividerBase.displayName = "VerticalDividerBase"; + var VerticalDivider = styled(VerticalDividerBase, getStyles$r, void 0, { + scope: "VerticalDivider" + }); + var TouchIdleDelay$2 = 500; + var ContextualMenuSplitButton = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuSplitButton2, _super); + function ContextualMenuSplitButton2(props) { + var _this = _super.call(this, props) || this; + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); + }); + _this._onItemKeyDown = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemKeyDown = _a2.onItemKeyDown; + if (ev.which === KeyCodes.enter) { + _this._executeItemClick(ev); + ev.preventDefault(); + ev.stopPropagation(); + } else if (onItemKeyDown) { + onItemKeyDown(item, ev); + } + }; + _this._getSubmenuTarget = function() { + return _this._splitButton; + }; + _this._renderAriaDescription = function(ariaDescription, className2) { + return ariaDescription ? React__namespace.createElement("span", { id: _this._ariaDescriptionId, className: className2 }, ariaDescription) : null; + }; + _this._onItemMouseEnterPrimary = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseEnter = _a2.onItemMouseEnter; + if (onItemMouseEnter) { + onItemMouseEnter(__assign$1(__assign$1({}, item), { subMenuProps: void 0, items: void 0 }), ev, _this._splitButton); + } + }; + _this._onItemMouseEnterIcon = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseEnter = _a2.onItemMouseEnter; + if (onItemMouseEnter) { + onItemMouseEnter(item, ev, _this._splitButton); + } + }; + _this._onItemMouseMovePrimary = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseMove = _a2.onItemMouseMove; + if (onItemMouseMove) { + onItemMouseMove(__assign$1(__assign$1({}, item), { subMenuProps: void 0, items: void 0 }), ev, _this._splitButton); + } + }; + _this._onItemMouseMoveIcon = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseMove = _a2.onItemMouseMove; + if (onItemMouseMove) { + onItemMouseMove(item, ev, _this._splitButton); + } + }; + _this._onIconItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemClickBase = _a2.onItemClickBase; + if (onItemClickBase) { + onItemClickBase(item, ev, _this._splitButton ? _this._splitButton : ev.currentTarget); + } + }; + _this._executeItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, executeItemClick = _a2.executeItemClick, onItemClick = _a2.onItemClick; + if (item.disabled || item.isDisabled) { + return; + } + if (_this._processingTouch && !item.canCheck && onItemClick) { + return onItemClick(item, ev); + } + if (executeItemClick) { + executeItemClick(item, ev); + } + }; + _this._onTouchStart = function(ev) { + if (_this._splitButton && !("onpointerdown" in _this._splitButton)) { + _this._handleTouchAndPointerEvent(ev); + } + }; + _this._onPointerDown = function(ev) { + if (ev.pointerType === "touch") { + _this._handleTouchAndPointerEvent(ev); + ev.preventDefault(); + ev.stopImmediatePropagation(); + } }; - return _react.createElement((0, _icon.Icon), { - iconName: item.canCheck !== false && isItemChecked ? 'CheckMark' : '', - className: classNames.checkmarkIcon, - // eslint-disable-next-line react/jsx-no-bind - onClick: onClick + _this._async = new Async(_this); + _this._events = new EventGroup(_this); + _this._dismissLabelId = getId(); + return _this; + } + ContextualMenuSplitButton2.prototype.componentDidMount = function() { + if (this._splitButton && "onpointerdown" in this._splitButton) { + this._events.on(this._splitButton, "pointerdown", this._onPointerDown, true); + } + }; + ContextualMenuSplitButton2.prototype.componentWillUnmount = function() { + this._async.dispose(); + this._events.dispose(); + }; + ContextualMenuSplitButton2.prototype.render = function() { + var _this = this; + var _a2; + var _b2 = this.props, item = _b2.item, classNames2 = _b2.classNames, index2 = _b2.index, focusableElementIndex = _b2.focusableElementIndex, totalItemCount = _b2.totalItemCount, hasCheckmarks = _b2.hasCheckmarks, hasIcons = _b2.hasIcons, onItemMouseLeave = _b2.onItemMouseLeave, expandedMenuItemKey = _b2.expandedMenuItemKey; + var itemHasSubmenu = hasSubmenu(item); + var keytipProps = item.keytipProps; + if (keytipProps) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + var ariaDescription = item.ariaDescription; + if (ariaDescription) { + this._ariaDescriptionId = getId(); + } + var ariaChecked = (_a2 = getIsChecked(item)) !== null && _a2 !== void 0 ? _a2 : void 0; + return React__namespace.createElement(KeytipData, { keytipProps, disabled: isItemDisabled(item) }, function(keytipAttributes) { + return React__namespace.createElement( + "div", + { "data-ktp-target": keytipAttributes["data-ktp-target"], ref: function(splitButton) { + _this._splitButton = splitButton; + }, role: getMenuItemAriaRole(item), "aria-label": item.ariaLabel, className: classNames2.splitContainer, "aria-disabled": isItemDisabled(item), "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : void 0, "aria-haspopup": true, "aria-describedby": mergeAriaAttributeValues(item.ariaDescribedBy, ariaDescription ? _this._ariaDescriptionId : void 0, keytipAttributes["aria-describedby"]), "aria-checked": ariaChecked, "aria-posinset": focusableElementIndex + 1, "aria-setsize": totalItemCount, onMouseEnter: _this._onItemMouseEnterPrimary, onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(_this, __assign$1(__assign$1({}, item), { subMenuProps: null, items: null })) : void 0, onMouseMove: _this._onItemMouseMovePrimary, onKeyDown: _this._onItemKeyDown, onClick: _this._executeItemClick, onTouchStart: _this._onTouchStart, tabIndex: 0, "data-is-focusable": true, "aria-roledescription": item["aria-roledescription"] }, + _this._renderSplitPrimaryButton(item, classNames2, index2, hasCheckmarks, hasIcons), + _this._renderSplitDivider(item), + _this._renderSplitIconButton(item, classNames2, index2, keytipAttributes), + _this._renderAriaDescription(ariaDescription, classNames2.screenReaderText) + ); }); - } - return null; -}; -var renderItemName = function(_a) { - var item = _a.item, classNames = _a.classNames; - /* eslint-disable deprecation/deprecation */ if (item.text || item.name) return _react.createElement("span", { - className: classNames.label - }, item.text || item.name); - /* eslint-enable deprecation/deprecation */ return null; -}; -var renderSecondaryText = function(_a) { - var item = _a.item, classNames = _a.classNames; - if (item.secondaryText) return _react.createElement("span", { - className: classNames.secondaryText - }, item.secondaryText); - return null; -}; -var renderSubMenuIcon = function(_a) { - var item = _a.item, classNames = _a.classNames, theme = _a.theme; - if ((0, _index.hasSubmenu)(item)) return _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - iconName: (0, _utilities.getRTL)(theme) ? 'ChevronLeft' : 'ChevronRight' - }, item.submenuIconProps, { - className: classNames.subMenuIcon - })); - return null; -}; -var ContextualMenuItemBase = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuItemBase, _super); - function ContextualMenuItemBase(props) { - var _this = _super.call(this, props) || this; - _this.openSubMenu = function() { - var _a = _this.props, item = _a.item, openSubMenu = _a.openSubMenu, getSubmenuTarget = _a.getSubmenuTarget; - if (getSubmenuTarget) { - var submenuTarget = getSubmenuTarget(); - if ((0, _index.hasSubmenu)(item) && openSubMenu && submenuTarget) openSubMenu(item, submenuTarget); - } + }; + ContextualMenuSplitButton2.prototype._renderSplitPrimaryButton = function(item, classNames2, index2, hasCheckmarks, hasIcons) { + var _a2 = this.props, _b2 = _a2.contextualMenuItemAs, ChildrenRenderer = _b2 === void 0 ? ContextualMenuItem : _b2, onItemClick = _a2.onItemClick; + var itemProps = { + key: item.key, + disabled: isItemDisabled(item) || item.primaryDisabled, + /* eslint-disable @typescript-eslint/no-deprecated */ + name: item.name, + text: item.text || item.name, + secondaryText: item.secondaryText, + /* eslint-enable @typescript-eslint/no-deprecated */ + className: classNames2.splitPrimary, + canCheck: item.canCheck, + isChecked: item.isChecked, + checked: item.checked, + iconProps: item.iconProps, + id: this._dismissLabelId, + onRenderIcon: item.onRenderIcon, + data: item.data, + "data-is-focusable": false }; - _this.dismissSubMenu = function() { - var _a = _this.props, item = _a.item, dismissSubMenu = _a.dismissSubMenu; - if ((0, _index.hasSubmenu)(item) && dismissSubMenu) dismissSubMenu(); + var itemComponentProps = item.itemProps; + return React__namespace.createElement( + "button", + __assign$1({}, getNativeProps(itemProps, buttonProperties)), + React__namespace.createElement(ChildrenRenderer, __assign$1({ "data-is-focusable": false, item: __assign$1(__assign$1({}, itemProps), { onClick: item.onClick }), classNames: classNames2, index: index2, onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : void 0, hasIcons }, itemComponentProps)) + ); + }; + ContextualMenuSplitButton2.prototype._renderSplitDivider = function(item) { + var getDividerClassNames2 = item.getSplitButtonVerticalDividerClassNames || getSplitButtonVerticalDividerClassNames; + return React__namespace.createElement( + VerticalDivider, + { + // eslint-disable-next-line @typescript-eslint/no-deprecated + getClassNames: getDividerClassNames2 + } + ); + }; + ContextualMenuSplitButton2.prototype._renderSplitIconButton = function(item, classNames2, index2, keytipAttributes) { + var _a2 = this.props, onItemMouseLeave = _a2.onItemMouseLeave, onItemMouseDown2 = _a2.onItemMouseDown, openSubMenu = _a2.openSubMenu, dismissSubMenu = _a2.dismissSubMenu, dismissMenu = _a2.dismissMenu; + var ChildrenRenderer = ContextualMenuItem; + if (this.props.item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.item.contextualMenuItemAs, ChildrenRenderer); + } + if (this.props.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.contextualMenuItemAs, ChildrenRenderer); + } + var itemProps = { + onClick: this._onIconItemClick, + disabled: isItemDisabled(item), + className: classNames2.splitMenu, + subMenuProps: item.subMenuProps, + submenuIconProps: item.submenuIconProps, + split: true, + key: item.key, + "aria-labelledby": this._dismissLabelId + }; + var buttonProps = __assign$1(__assign$1({}, getNativeProps(itemProps, buttonProperties)), { + onMouseEnter: this._onItemMouseEnterIcon, + onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(this, item) : void 0, + onMouseDown: function(ev) { + return onItemMouseDown2 ? onItemMouseDown2(item, ev) : void 0; + }, + onMouseMove: this._onItemMouseMoveIcon, + "data-is-focusable": false, + "data-ktp-execute-target": keytipAttributes["data-ktp-execute-target"], + "aria-haspopup": true + }); + var itemComponentProps = item.itemProps; + return React__namespace.createElement( + "button", + __assign$1({}, buttonProps), + React__namespace.createElement(ChildrenRenderer, __assign$1({ componentRef: item.componentRef, item: itemProps, classNames: classNames2, index: index2, hasIcons: false, openSubMenu, dismissSubMenu, dismissMenu, getSubmenuTarget: this._getSubmenuTarget }, itemComponentProps)) + ); + }; + ContextualMenuSplitButton2.prototype._handleTouchAndPointerEvent = function(ev) { + var _this = this; + var onTap = this.props.onTap; + if (onTap) { + onTap(ev); + } + if (this._lastTouchTimeoutId) { + this._async.clearTimeout(this._lastTouchTimeoutId); + this._lastTouchTimeoutId = void 0; + } + this._processingTouch = true; + this._lastTouchTimeoutId = this._async.setTimeout(function() { + _this._processingTouch = false; + _this._lastTouchTimeoutId = void 0; + }, TouchIdleDelay$2); + }; + return ContextualMenuSplitButton2; + })(ContextualMenuItemWrapper) + ); + var BaseDecorator = ( + /** @class */ + (function(_super) { + __extends(BaseDecorator2, _super); + function BaseDecorator2(props) { + var _this = _super.call(this, props) || this; + _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); + return _this; + } + BaseDecorator2.prototype._updateComposedComponentRef = function(composedComponentInstance) { + this._composedComponentInstance = composedComponentInstance; + if (composedComponentInstance) { + this._hoisted = hoistMethods(this, composedComponentInstance); + } else if (this._hoisted) { + unhoistMethods(this, this._hoisted); + } + }; + return BaseDecorator2; + })(React__namespace.Component) + ); + var ResponsiveMode; + (function(ResponsiveMode2) { + ResponsiveMode2[ResponsiveMode2["small"] = 0] = "small"; + ResponsiveMode2[ResponsiveMode2["medium"] = 1] = "medium"; + ResponsiveMode2[ResponsiveMode2["large"] = 2] = "large"; + ResponsiveMode2[ResponsiveMode2["xLarge"] = 3] = "xLarge"; + ResponsiveMode2[ResponsiveMode2["xxLarge"] = 4] = "xxLarge"; + ResponsiveMode2[ResponsiveMode2["xxxLarge"] = 5] = "xxxLarge"; + ResponsiveMode2[ResponsiveMode2["unknown"] = 999] = "unknown"; + })(ResponsiveMode || (ResponsiveMode = {})); + var RESPONSIVE_MAX_CONSTRAINT = [479, 639, 1023, 1365, 1919, 99999999]; + var _lastMode; + function getInitialResponsiveMode() { + var _a2; + return (_a2 = _lastMode) !== null && _a2 !== void 0 ? _a2 : ResponsiveMode.large; + } + function withResponsiveMode(ComposedComponent) { + var _a2; + var resultClass = (_a2 = /** @class */ + (function(_super) { + __extends(WithResponsiveMode, _super); + function WithResponsiveMode(props) { + var _this = _super.call(this, props) || this; + _this._onResize = function() { + var responsiveMode = getResponsiveMode(_this.context.window); + if (responsiveMode !== _this.state.responsiveMode) { + _this.setState({ + responsiveMode + }); + } }; - _this.dismissMenu = function(dismissAll) { - var dismissMenu = _this.props.dismissMenu; - if (dismissMenu) dismissMenu(undefined /* ev */ , dismissAll); + _this._events = new EventGroup(_this); + _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); + _this.state = { + responsiveMode: getInitialResponsiveMode() }; - (0, _utilities.initializeComponentRef)(_this); return _this; + } + WithResponsiveMode.prototype.componentDidMount = function() { + this._events.on(this.context.window, "resize", this._onResize); + this._onResize(); + }; + WithResponsiveMode.prototype.componentWillUnmount = function() { + this._events.dispose(); + }; + WithResponsiveMode.prototype.render = function() { + var responsiveMode = this.state.responsiveMode; + return responsiveMode === ResponsiveMode.unknown ? null : React__namespace.createElement(ComposedComponent, __assign$1({ ref: this._updateComposedComponentRef, responsiveMode }, this.props)); + }; + return WithResponsiveMode; + })(BaseDecorator), _a2.contextType = WindowContext, _a2); + return hoistStatics(ComposedComponent, resultClass); + } + function getWidthOfCurrentWindow(currentWindow) { + try { + return currentWindow.document.documentElement.clientWidth; + } catch (e) { + return currentWindow.innerWidth; } - ContextualMenuItemBase.prototype.render = function() { - var _a = this.props, item = _a.item, classNames = _a.classNames; - var renderContent = item.onRenderContent || this._renderLayout; - return _react.createElement("div", { - className: item.split ? classNames.linkContentMenu : classNames.linkContent - }, renderContent(this.props, { - renderCheckMarkIcon: renderCheckMarkIcon, - renderItemIcon: renderItemIcon, - renderItemName: renderItemName, - renderSecondaryText: renderSecondaryText, - renderSubMenuIcon: renderSubMenuIcon - })); - }; - ContextualMenuItemBase.prototype._renderLayout = function(props, defaultRenders) { - return _react.createElement(_react.Fragment, null, defaultRenders.renderCheckMarkIcon(props), defaultRenders.renderItemIcon(props), defaultRenders.renderItemName(props), defaultRenders.renderSecondaryText(props), defaultRenders.renderSubMenuIcon(props)); - }; - return ContextualMenuItemBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../utilities/contextualMenu/index":"lGesq","../../Utilities":"1NZCy","../../Icon":"hiMUP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bg3cO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSplitButtonVerticalDividerClassNames", ()=>getSplitButtonVerticalDividerClassNames); -parcelHelpers.export(exports, "getItemClassNames", ()=>getItemClassNames); -parcelHelpers.export(exports, "getItemStyles", ()=>getItemStyles); -var _verticalDividerClassNames = require("../Divider/VerticalDivider.classNames"); -var _contextualMenuCnstyles = require("./ContextualMenu.cnstyles"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var CONTEXTUAL_SPLIT_MENU_MINWIDTH = '28px'; -var MediumScreenSelector = (0, _styling.getScreenSelector)(0, (0, _styling.ScreenWidthMaxMedium)); -var getSplitButtonVerticalDividerClassNames = (0, _utilities.memoizeFunction)(/* eslint-disable deprecation/deprecation */ function(theme) { - var _a; - return (0, _styling.mergeStyleSets)((0, _verticalDividerClassNames.getDividerClassNames)(theme), { - /* eslint-enable deprecation/deprecation */ wrapper: { - position: 'absolute', - right: 28, - selectors: (_a = {}, _a[MediumScreenSelector] = { - right: 32 - }, _a) - }, - divider: { - height: 16, - width: 1 + } + function getResponsiveMode(currentWindow) { + var responsiveMode = ResponsiveMode.small; + if (currentWindow) { + try { + while (getWidthOfCurrentWindow(currentWindow) > RESPONSIVE_MAX_CONSTRAINT[responsiveMode]) { + responsiveMode++; } - }); -}); -var GlobalClassNames = { - item: 'ms-ContextualMenu-item', - divider: 'ms-ContextualMenu-divider', - root: 'ms-ContextualMenu-link', - isChecked: 'is-checked', - isExpanded: 'is-expanded', - isDisabled: 'is-disabled', - linkContent: 'ms-ContextualMenu-linkContent', - linkContentMenu: 'ms-ContextualMenu-linkContent', - icon: 'ms-ContextualMenu-icon', - iconColor: 'ms-ContextualMenu-iconColor', - checkmarkIcon: 'ms-ContextualMenu-checkmarkIcon', - subMenuIcon: 'ms-ContextualMenu-submenuIcon', - label: 'ms-ContextualMenu-itemText', - secondaryText: 'ms-ContextualMenu-secondaryText', - splitMenu: 'ms-ContextualMenu-splitMenu', - screenReaderText: 'ms-ContextualMenu-screenReaderText' -}; -var getItemClassNames = (0, _utilities.memoizeFunction)(function(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className) { - var _a, _b, _c, _d; - var styles = (0, _contextualMenuCnstyles.getMenuItemStyles)(theme); - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return (0, _styling.mergeStyleSets)({ - item: [ - classNames.item, - styles.item, - itemClassName - ], - divider: [ - classNames.divider, - styles.divider, - dividerClassName - ], - root: [ - classNames.root, - styles.root, - checked && [ - classNames.isChecked, - styles.rootChecked - ], - isAnchorLink && styles.anchorLink, - expanded && [ - classNames.isExpanded, - styles.rootExpanded - ], - disabled && [ - classNames.isDisabled, - styles.rootDisabled - ], - !disabled && !expanded && [ - { - selectors: (_a = { - ':hover': styles.rootHovered, - ':active': styles.rootPressed - }, // eslint-disable-next-line @fluentui/max-len - _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:hover")] = { - background: 'inherit;' - }, _a) - } - ], - className - ], - splitPrimary: [ - styles.root, - { - width: "calc(100% - ".concat(CONTEXTUAL_SPLIT_MENU_MINWIDTH, ")") - }, - checked && [ - 'is-checked', - styles.rootChecked - ], - (disabled || primaryDisabled) && [ - 'is-disabled', - styles.rootDisabled - ], - !(disabled || primaryDisabled) && !checked && [ - { - selectors: (_b = { - ':hover': styles.rootHovered - }, // when hovering over the splitPrimary also affect the splitMenu - _b[":hover ~ .".concat(classNames.splitMenu)] = styles.rootHovered, _b[':active'] = styles.rootPressed, // eslint-disable-next-line @fluentui/max-len - _b[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _b[".".concat((0, _utilities.IsFocusVisibleClassName), " &:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:hover")] = { - background: 'inherit;' - }, _b) - } - ] - ], - splitMenu: [ - classNames.splitMenu, - styles.root, - { - flexBasis: '0', - padding: '0 8px', - minWidth: CONTEXTUAL_SPLIT_MENU_MINWIDTH - }, - expanded && [ - 'is-expanded', - styles.rootExpanded - ], - disabled && [ - 'is-disabled', - styles.rootDisabled - ], - !disabled && !expanded && [ - { - selectors: (_c = { - ':hover': styles.rootHovered, - ':active': styles.rootPressed - }, // eslint-disable-next-line @fluentui/max-len - _c[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _c[".".concat((0, _utilities.IsFocusVisibleClassName), " &:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:hover")] = { - background: 'inherit;' - }, _c) - } - ] - ], - anchorLink: styles.anchorLink, - linkContent: [ - classNames.linkContent, - styles.linkContent - ], - linkContentMenu: [ - classNames.linkContentMenu, - styles.linkContent, - { - justifyContent: 'center' - } - ], - icon: [ - classNames.icon, - knownIcon && styles.iconColor, - styles.icon, - iconClassName, - disabled && [ - classNames.isDisabled, - styles.iconDisabled - ] - ], - iconColor: styles.iconColor, - checkmarkIcon: [ - classNames.checkmarkIcon, - knownIcon && styles.checkmarkIcon, - styles.icon, - iconClassName - ], - subMenuIcon: [ - classNames.subMenuIcon, - styles.subMenuIcon, - subMenuClassName, - expanded && { - color: theme.palette.neutralPrimary - }, - disabled && [ - styles.iconDisabled - ] - ], - label: [ - classNames.label, - styles.label - ], - secondaryText: [ - classNames.secondaryText, - styles.secondaryText - ], - splitContainer: [ - styles.splitButtonFlexContainer, - !disabled && !checked && [ - { - selectors: (_d = {}, // eslint-disable-next-line @fluentui/max-len - _d[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _d) - } - ] - ], - screenReaderText: [ - classNames.screenReaderText, - styles.screenReaderText, - (0, _styling.hiddenContentStyle), - { - visibility: 'hidden' - } - ] - }); -}); -var getItemStyles = function(props) { - var theme = props.theme, disabled = props.disabled, expanded = props.expanded, checked = props.checked, isAnchorLink = props.isAnchorLink, knownIcon = props.knownIcon, itemClassName = props.itemClassName, dividerClassName = props.dividerClassName, iconClassName = props.iconClassName, subMenuClassName = props.subMenuClassName, primaryDisabled = props.primaryDisabled, className = props.className; - // eslint-disable-next-line deprecation/deprecation - return getItemClassNames(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className); -}; - -},{"../Divider/VerticalDivider.classNames":"cuEOn","./ContextualMenu.cnstyles":"ktzsg","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cuEOn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getDividerClassNames", ()=>getDividerClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getDividerClassNames = (0, _utilities.memoizeFunction)(// eslint-disable-next-line deprecation/deprecation -function(theme) { - return (0, _styling.mergeStyleSets)({ - wrapper: { - display: 'inline-flex', - height: '100%', - alignItems: 'center' - }, - divider: { - width: 1, - height: '100%', - backgroundColor: theme.palette.neutralTertiaryAlt + } catch (e) { + responsiveMode = getInitialResponsiveMode(); + } + _lastMode = responsiveMode; + } else { + { + throw new Error("Content was rendered in a server environment without providing a default responsive mode. Call setResponsiveMode to define what the responsive mode is."); + } + } + return responsiveMode; + } + var useResponsiveMode = function(elementRef, overrideResponsiveMode) { + var _a2 = React__namespace.useState(getInitialResponsiveMode()), lastResponsiveMode = _a2[0], setLastResponsiveMode = _a2[1]; + var onResize = React__namespace.useCallback(function() { + var newResponsiveMode = getResponsiveMode(getWindow(elementRef.current)); + if (lastResponsiveMode !== newResponsiveMode) { + setLastResponsiveMode(newResponsiveMode); + } + }, [elementRef, lastResponsiveMode]); + var win = useWindow(); + useOnEvent(win, "resize", onResize); + React__namespace.useEffect(function() { + if (overrideResponsiveMode === void 0) { + onResize(); + } + }, [overrideResponsiveMode]); + return overrideResponsiveMode !== null && overrideResponsiveMode !== void 0 ? overrideResponsiveMode : lastResponsiveMode; + }; + var MenuContext = React__namespace.createContext({}); + var getClassNames$l = classNamesFunction(); + var getContextualMenuItemClassNames = classNamesFunction(); + var DEFAULT_PROPS$4 = { + items: [], + shouldFocusOnMount: true, + gapSpace: 0, + directionalHint: DirectionalHint.bottomAutoEdge, + beakWidth: 16 + }; + function getItemCount(items) { + var totalItemCount = 0; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var item = items_1[_i]; + if (item.itemType !== ContextualMenuItemType.Divider && item.itemType !== ContextualMenuItemType.Header) { + var itemCount = item.customOnRenderListLength ? item.customOnRenderListLength : 1; + totalItemCount += itemCount; + } + } + return totalItemCount; + } + function getSubmenuItems(item, options2) { + var target2 = options2 === null || options2 === void 0 ? void 0 : options2.target; + var items = item.subMenuProps ? item.subMenuProps.items : item.items; + if (items) { + var overrideItems = []; + for (var _i = 0, items_2 = items; _i < items_2.length; _i++) { + var subItem = items_2[_i]; + if (subItem.preferMenuTargetAsEventTarget) { + var onClick = subItem.onClick, contextItem = __rest(subItem, ["onClick"]); + overrideItems.push(__assign$1(__assign$1({}, contextItem), { onClick: getOnClickWithOverrideTarget(onClick, target2) })); + } else { + overrideItems.push(subItem); } + } + return overrideItems; + } + } + function canAnyMenuItemsCheck(items) { + return items.some(function(item) { + if (item.canCheck) { + return true; + } + if (item.sectionProps && item.sectionProps.items.some(function(submenuItem) { + return submenuItem.canCheck === true; + })) { + return true; + } + return false; }); -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ktzsg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CONTEXTUAL_MENU_ITEM_HEIGHT", ()=>CONTEXTUAL_MENU_ITEM_HEIGHT); -parcelHelpers.export(exports, "getMenuItemStyles", ()=>getMenuItemStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var CONTEXTUAL_MENU_ITEM_HEIGHT = 36; -var MediumScreenSelector = (0, _styling.getScreenSelector)(0, (0, _styling.ScreenWidthMaxMedium)); -var getMenuItemStyles = (0, _utilities.memoizeFunction)(function(theme) { - var _a, _b, _c, _d, _e; - var semanticColors = theme.semanticColors, fonts = theme.fonts, palette = theme.palette; - var ContextualMenuItemBackgroundHoverColor = semanticColors.menuItemBackgroundHovered; - var ContextualMenuItemTextHoverColor = semanticColors.menuItemTextHovered; - var ContextualMenuItemBackgroundSelectedColor = semanticColors.menuItemBackgroundPressed; - var ContextualMenuItemDividerColor = semanticColors.bodyDivider; - var menuItemStyles = { - item: [ - fonts.medium, - { - color: semanticColors.bodyText, - position: 'relative', - boxSizing: 'border-box' - } - ], - divider: { - display: 'block', - height: '1px', - backgroundColor: ContextualMenuItemDividerColor, - position: 'relative' - }, - root: [ - (0, _styling.getFocusStyle)(theme), - fonts.medium, - { - color: semanticColors.bodyText, - backgroundColor: 'transparent', - border: 'none', - width: '100%', - height: CONTEXTUAL_MENU_ITEM_HEIGHT, - lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, - display: 'block', - cursor: 'pointer', - padding: '0px 8px 0 4px', - textAlign: 'left' - } - ], - rootDisabled: { - color: semanticColors.disabledBodyText, - cursor: 'default', - pointerEvents: 'none', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - // ensure disabled text looks different than enabled - color: 'GrayText', - opacity: 1 - }, _a) - }, - rootHovered: { - backgroundColor: ContextualMenuItemBackgroundHoverColor, - color: ContextualMenuItemTextHoverColor, - selectors: { - '.ms-ContextualMenu-icon': { - color: palette.themeDarkAlt - }, - '.ms-ContextualMenu-submenuIcon': { - color: palette.neutralPrimary - } - } - }, - rootFocused: { - backgroundColor: palette.white - }, - rootChecked: { - selectors: { - '.ms-ContextualMenu-checkmarkIcon': { - color: palette.neutralPrimary - } - } - }, - rootPressed: { - backgroundColor: ContextualMenuItemBackgroundSelectedColor, - selectors: { - '.ms-ContextualMenu-icon': { - color: palette.themeDark - }, - '.ms-ContextualMenu-submenuIcon': { - color: palette.neutralPrimary - } - } - }, - rootExpanded: { - backgroundColor: ContextualMenuItemBackgroundSelectedColor, - color: semanticColors.bodyTextChecked, - selectors: (_b = { - '.ms-ContextualMenu-submenuIcon': (_c = {}, _c[0, _styling.HighContrastSelector] = { - // icons inside of anchor tags are not properly inheriting color in high contrast - color: 'inherit' - }, _c) - }, _b[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({}, (0, _styling.getHighContrastNoAdjustStyle)()), _b) - }, - linkContent: { - whiteSpace: 'nowrap', - height: 'inherit', - display: 'flex', - alignItems: 'center', - maxWidth: '100%' - }, - anchorLink: { - padding: '0px 8px 0 4px', - textRendering: 'auto', - color: 'inherit', - letterSpacing: 'normal', - wordSpacing: 'normal', - textTransform: 'none', - textIndent: '0px', - textShadow: 'none', - textDecoration: 'none', - boxSizing: 'border-box' - }, - label: { - margin: '0 4px', - verticalAlign: 'middle', - display: 'inline-block', - flexGrow: '1', - textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - overflow: 'hidden' - }, - secondaryText: { - color: theme.palette.neutralSecondary, - paddingLeft: '20px', - textAlign: 'right' - }, - icon: { - display: 'inline-block', - minHeight: '1px', - maxHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, - fontSize: (0, _styling.IconFontSizes).medium, - width: (0, _styling.IconFontSizes).medium, - margin: '0 4px', - verticalAlign: 'middle', - flexShrink: '0', - selectors: (_d = {}, _d[MediumScreenSelector] = { - fontSize: (0, _styling.IconFontSizes).large, - width: (0, _styling.IconFontSizes).large - }, _d) - }, - iconColor: { - color: semanticColors.menuIcon - }, - iconDisabled: { - color: semanticColors.disabledBodyText - }, - checkmarkIcon: { - color: semanticColors.bodySubtext - }, - subMenuIcon: { - height: CONTEXTUAL_MENU_ITEM_HEIGHT, - lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, - color: palette.neutralSecondary, - textAlign: 'center', - display: 'inline-block', - verticalAlign: 'middle', - flexShrink: '0', - fontSize: (0, _styling.IconFontSizes).small, - selectors: (_e = { - ':hover': { - color: palette.neutralPrimary - }, - ':active': { - color: palette.neutralPrimary - } - }, _e[MediumScreenSelector] = { - fontSize: (0, _styling.IconFontSizes).medium - }, _e) - }, - splitButtonFlexContainer: [ - (0, _styling.getFocusStyle)(theme), - { - display: 'flex', - height: CONTEXTUAL_MENU_ITEM_HEIGHT, - flexWrap: 'nowrap', - justifyContent: 'center', - alignItems: 'flex-start' - } - ] + } + var NavigationIdleDelay = 250; + var COMPONENT_NAME$7 = "ContextualMenu"; + var _getMenuItemStylesFunction = memoizeFunction(function() { + var styles = []; + for (var _i = 0; _i < arguments.length; _i++) { + styles[_i] = arguments[_i]; + } + return function(styleProps) { + return concatStyleSetsWithProps.apply(void 0, __spreadArray([styleProps, getItemStyles], styles, false)); + }; + }); + function useVisibility(props, targetWindow) { + var _a2 = props.hidden, hidden = _a2 === void 0 ? false : _a2, onMenuDismissed = props.onMenuDismissed, onMenuOpened = props.onMenuOpened; + var previousHidden = usePrevious(hidden); + var onMenuOpenedRef = React__namespace.useRef(onMenuOpened); + var onMenuClosedRef = React__namespace.useRef(onMenuDismissed); + var propsRef = React__namespace.useRef(props); + onMenuOpenedRef.current = onMenuOpened; + onMenuClosedRef.current = onMenuDismissed; + propsRef.current = props; + React__namespace.useEffect(function() { + var _a3, _b2; + if (hidden && previousHidden === false) { + (_a3 = onMenuClosedRef.current) === null || _a3 === void 0 ? void 0 : _a3.call(onMenuClosedRef, propsRef.current); + } else if (!hidden && previousHidden !== false) { + (_b2 = onMenuOpenedRef.current) === null || _b2 === void 0 ? void 0 : _b2.call(onMenuOpenedRef, propsRef.current); + } + }, [hidden, previousHidden]); + React__namespace.useEffect(function() { + return function() { + var _a3; + return (_a3 = onMenuClosedRef.current) === null || _a3 === void 0 ? void 0 : _a3.call(onMenuClosedRef, propsRef.current); + }; + }, []); + } + function useSubMenuState(_a2, dismiss) { + var hidden = _a2.hidden, items = _a2.items, theme = _a2.theme, className2 = _a2.className, id2 = _a2.id, menuTarget = _a2.target; + var _b2 = React__namespace.useState(), expandedMenuItemKey = _b2[0], setExpandedMenuItemKey = _b2[1]; + var _c2 = React__namespace.useState(), submenuTarget = _c2[0], setSubmenuTarget = _c2[1]; + var _d2 = React__namespace.useState(), shouldFocusOnContainer = _d2[0], setShouldFocusOnContainer = _d2[1]; + var subMenuId = useId(COMPONENT_NAME$7, id2); + var closeSubMenu = React__namespace.useCallback(function() { + setShouldFocusOnContainer(void 0); + setExpandedMenuItemKey(void 0); + setSubmenuTarget(void 0); + }, []); + var openSubMenu = React__namespace.useCallback(function(_a3, target2, focusContainer) { + var submenuItemKey = _a3.key; + if (expandedMenuItemKey === submenuItemKey) { + return; + } + target2.focus(); + setShouldFocusOnContainer(focusContainer); + setExpandedMenuItemKey(submenuItemKey); + setSubmenuTarget(target2); + }, [expandedMenuItemKey]); + React__namespace.useEffect(function() { + if (hidden) { + closeSubMenu(); + } + }, [hidden, closeSubMenu]); + var onSubMenuDismiss = useOnSubmenuDismiss(dismiss, closeSubMenu); + var getSubmenuProps = function() { + var item = findItemByKeyFromItems(expandedMenuItemKey, items); + var submenuProps = null; + if (item) { + submenuProps = { + items: getSubmenuItems(item, { target: menuTarget }), + target: submenuTarget, + onDismiss: onSubMenuDismiss, + isSubMenu: true, + id: subMenuId, + shouldFocusOnMount: true, + shouldFocusOnContainer, + directionalHint: getRTL(theme) ? DirectionalHint.leftTopEdge : DirectionalHint.rightTopEdge, + className: className2, + gapSpace: 0, + isBeakVisible: false + }; + if (item.subMenuProps) { + assign(submenuProps, item.subMenuProps); + } + if (item.preferMenuTargetAsEventTarget) { + var onItemClick = item.onItemClick; + submenuProps.onItemClick = getOnClickWithOverrideTarget(onItemClick, menuTarget); + } + } + return submenuProps; + }; + return [expandedMenuItemKey, openSubMenu, getSubmenuProps, onSubMenuDismiss]; + } + function useShouldUpdateFocusOnMouseMove(_a2) { + var delayUpdateFocusOnHover = _a2.delayUpdateFocusOnHover, hidden = _a2.hidden; + var shouldUpdateFocusOnMouseEvent = React__namespace.useRef(!delayUpdateFocusOnHover); + var gotMouseMove = React__namespace.useRef(false); + React__namespace.useEffect(function() { + shouldUpdateFocusOnMouseEvent.current = !delayUpdateFocusOnHover; + gotMouseMove.current = hidden ? false : !delayUpdateFocusOnHover && gotMouseMove.current; + }, [delayUpdateFocusOnHover, hidden]); + var onMenuFocusCapture = React__namespace.useCallback(function() { + if (delayUpdateFocusOnHover) { + shouldUpdateFocusOnMouseEvent.current = false; + } + }, [delayUpdateFocusOnHover]); + return [shouldUpdateFocusOnMouseEvent, gotMouseMove, onMenuFocusCapture]; + } + function usePreviousActiveElement(_a2, targetWindow, hostElement) { + var hidden = _a2.hidden, onRestoreFocus = _a2.onRestoreFocus; + var previousActiveElement = React__namespace.useRef(void 0); + var tryFocusPreviousActiveElement = React__namespace.useCallback(function(options2) { + var _a3, _b2; + if (onRestoreFocus) { + onRestoreFocus(options2); + } else if (options2 === null || options2 === void 0 ? void 0 : options2.documentContainsFocus) { + (_b2 = (_a3 = previousActiveElement.current) === null || _a3 === void 0 ? void 0 : _a3.focus) === null || _b2 === void 0 ? void 0 : _b2.call(_a3); + } + }, [onRestoreFocus]); + useIsomorphicLayoutEffect(function() { + var _a3, _b2; + if (!hidden) { + var newElement = targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement; + if (!((_a3 = hostElement.current) === null || _a3 === void 0 ? void 0 : _a3.contains(newElement)) && newElement.tagName !== "BODY") { + previousActiveElement.current = newElement; + } + } else if (previousActiveElement.current) { + tryFocusPreviousActiveElement({ + originalElement: previousActiveElement.current, + containsFocus: true, + documentContainsFocus: ((_b2 = getDocument()) === null || _b2 === void 0 ? void 0 : _b2.hasFocus()) || false + }); + previousActiveElement.current = void 0; + } + }, [hidden, targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement, tryFocusPreviousActiveElement, hostElement]); + return [tryFocusPreviousActiveElement]; + } + function useKeyHandlers(_a2, dismiss, hostElement, openSubMenu) { + var theme = _a2.theme, isSubMenu = _a2.isSubMenu, _b2 = _a2.focusZoneProps, _c2 = _b2 === void 0 ? {} : _b2, checkForNoWrap = _c2.checkForNoWrap, _d2 = _c2.direction, focusZoneDirection = _d2 === void 0 ? FocusZoneDirection.vertical : _d2; + var lastKeyDownWasAltOrMeta = React__namespace.useRef(void 0); + var keyHandler = function(ev, shouldHandleKey, dismissAllMenus) { + var handled = false; + if (shouldHandleKey(ev)) { + dismiss(ev, dismissAllMenus); + ev.preventDefault(); + ev.stopPropagation(); + handled = true; + } + return handled; + }; + var shouldCloseSubMenu = function(ev) { + var submenuCloseKey = getRTL(theme) ? KeyCodes.right : KeyCodes.left; + if (ev.which !== submenuCloseKey || !isSubMenu) { + return false; + } + return !!(focusZoneDirection === FocusZoneDirection.vertical || checkForNoWrap && !shouldWrapFocus(ev.target, "data-no-horizontal-wrap")); + }; + var shouldHandleKeyDown = function(ev) { + return ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + ev.which === KeyCodes.escape || shouldCloseSubMenu(ev) || ev.which === KeyCodes.up && (ev.altKey || ev.metaKey) + ); + }; + var onKeyDown = function(ev) { + lastKeyDownWasAltOrMeta.current = isAltOrMeta$1(ev); + var dismissAllMenus = ev.which === KeyCodes.escape && (isMac() || isIOS()); + return keyHandler(ev, shouldHandleKeyDown, dismissAllMenus); + }; + var shouldHandleKeyUp = function(ev) { + var keyPressIsAltOrMetaAlone = lastKeyDownWasAltOrMeta.current && isAltOrMeta$1(ev); + lastKeyDownWasAltOrMeta.current = false; + return !!keyPressIsAltOrMetaAlone && !(isIOS() || isMac()); + }; + var onKeyUp = function(ev) { + return keyHandler( + ev, + shouldHandleKeyUp, + true + /* dismissAllMenus */ + ); + }; + var onMenuKeyDown = function(ev) { + var handled = onKeyDown(ev); + if (handled || !hostElement.current) { + return; + } + var hasModifier = !!(ev.altKey || ev.metaKey); + var isUp = ev.which === KeyCodes.up; + var isDown = ev.which === KeyCodes.down; + if (!hasModifier && (isUp || isDown)) { + var elementToFocus = isUp ? getLastFocusable(hostElement.current, hostElement.current.lastChild, true) : getFirstFocusable(hostElement.current, hostElement.current.firstChild, true); + if (elementToFocus) { + elementToFocus.focus(); + ev.preventDefault(); + ev.stopPropagation(); + } + } + }; + var onItemKeyDown = function(item, ev) { + var openKey = getRTL(theme) ? KeyCodes.left : KeyCodes.right; + if (!item.disabled && // eslint-disable-next-line @typescript-eslint/no-deprecated + (ev.which === openKey || ev.which === KeyCodes.enter || ev.which === KeyCodes.down && (ev.altKey || ev.metaKey))) { + openSubMenu(item, ev.currentTarget); + ev.preventDefault(); + } + }; + return [onKeyDown, onKeyUp, onMenuKeyDown, onItemKeyDown]; + } + function useScrollHandler(asyncTracker) { + var isScrollIdle = React__namespace.useRef(true); + var scrollIdleTimeoutId = React__namespace.useRef(void 0); + var onScroll = function() { + if (!isScrollIdle.current && scrollIdleTimeoutId.current !== void 0) { + asyncTracker.clearTimeout(scrollIdleTimeoutId.current); + scrollIdleTimeoutId.current = void 0; + } else { + isScrollIdle.current = false; + } + scrollIdleTimeoutId.current = asyncTracker.setTimeout(function() { + isScrollIdle.current = true; + }, NavigationIdleDelay); + }; + return [onScroll, isScrollIdle]; + } + function useOnSubmenuDismiss(dismiss, closeSubMenu) { + var isMountedRef = React__namespace.useRef(false); + React__namespace.useEffect(function() { + isMountedRef.current = true; + return function() { + isMountedRef.current = false; + }; + }, []); + var onSubMenuDismiss = function(ev, dismissAll) { + if (dismissAll) { + dismiss(ev, dismissAll); + } else if (isMountedRef.current) { + closeSubMenu(); + } + }; + return onSubMenuDismiss; + } + function useSubmenuEnterTimer(_a2, asyncTracker) { + var _b2 = _a2.subMenuHoverDelay, subMenuHoverDelay = _b2 === void 0 ? NavigationIdleDelay : _b2; + var enterTimerRef = React__namespace.useRef(void 0); + var cancelSubMenuTimer = function() { + if (enterTimerRef.current !== void 0) { + asyncTracker.clearTimeout(enterTimerRef.current); + enterTimerRef.current = void 0; + } + }; + var startSubmenuTimer = function(onTimerExpired) { + enterTimerRef.current = asyncTracker.setTimeout(function() { + onTimerExpired(); + cancelSubMenuTimer(); + }, subMenuHoverDelay); + }; + return [cancelSubMenuTimer, startSubmenuTimer, enterTimerRef]; + } + function useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss) { + var menuTarget = props.target; + var onItemMouseEnterBase = function(item, ev, target2) { + if (shouldUpdateFocusOnMouseEvent.current) { + gotMouseMove.current = true; + } + if (shouldIgnoreMouseEvent()) { + return; + } + updateFocusOnMouseEvent(item, ev, target2); + }; + var onItemMouseMoveBase = function(item, ev, target2) { + var targetElement = ev.currentTarget; + if (shouldUpdateFocusOnMouseEvent.current) { + gotMouseMove.current = true; + } else { + return; + } + if (!isScrollIdle.current || subMenuEntryTimer.current !== void 0 || targetElement === (targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement)) { + return; + } + updateFocusOnMouseEvent(item, ev, target2); }; - return (0, _styling.concatStyleSets)(menuItemStyles); -}); - -},{"tslib":"9gizs","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lIK0C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _contextualMenuAnchor = require("./ContextualMenuAnchor"); -parcelHelpers.exportAll(_contextualMenuAnchor, exports); -var _contextualMenuButton = require("./ContextualMenuButton"); -parcelHelpers.exportAll(_contextualMenuButton, exports); -var _contextualMenuSplitButton = require("./ContextualMenuSplitButton"); -parcelHelpers.exportAll(_contextualMenuSplitButton, exports); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -parcelHelpers.exportAll(_contextualMenuItemWrapper, exports); -var _contextualMenuItemWrapperTypes = require("./ContextualMenuItemWrapper.types"); -parcelHelpers.exportAll(_contextualMenuItemWrapperTypes, exports); - -},{"./ContextualMenuAnchor":"gJtGo","./ContextualMenuButton":"i5hAV","./ContextualMenuSplitButton":"151ms","./ContextualMenuItemWrapper":false,"./ContextualMenuItemWrapper.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gJtGo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuAnchor", ()=>ContextualMenuAnchor); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -var _keytipData = require("../../../KeytipData"); -var _index = require("../../../utilities/contextualMenu/index"); -var _contextualMenuItem = require("../ContextualMenuItem"); -var ContextualMenuAnchor = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuAnchor, _super); - function ContextualMenuAnchor() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._anchor = _react.createRef(); - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); - }); - _this._getSubmenuTarget = function() { - return _this._anchor.current ? _this._anchor.current : undefined; - }; - _this._onItemClick = function(ev) { - var _a = _this.props, item = _a.item, onItemClick = _a.onItemClick; - if (onItemClick) onItemClick(item, ev); - }; - _this._renderAriaDescription = function(ariaDescription, className) { - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan - return ariaDescription ? _react.createElement("span", { - id: _this._ariaDescriptionId, - className: className - }, ariaDescription) : null; - }; - return _this; - } - ContextualMenuAnchor.prototype.render = function() { - var _this = this; - var _a = this.props, item = _a.item, classNames = _a.classNames, index = _a.index, focusableElementIndex = _a.focusableElementIndex, totalItemCount = _a.totalItemCount, hasCheckmarks = _a.hasCheckmarks, hasIcons = _a.hasIcons, expandedMenuItemKey = _a.expandedMenuItemKey, onItemClick = _a.onItemClick, openSubMenu = _a.openSubMenu, dismissSubMenu = _a.dismissSubMenu, dismissMenu = _a.dismissMenu; - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (this.props.item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.item.contextualMenuItemAs, ChildrenRenderer); - if (this.props.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.contextualMenuItemAs, ChildrenRenderer); - var anchorRel = item.rel; - if (item.target && item.target.toLowerCase() === '_blank') anchorRel = anchorRel ? anchorRel : 'nofollow noopener noreferrer'; // Safe default to prevent tabjacking - var itemHasSubmenu = (0, _index.hasSubmenu)(item); - var nativeProps = (0, _utilities.getNativeProps)(item, (0, _utilities.anchorProperties)); - var disabled = (0, _index.isItemDisabled)(item); - var itemProps = item.itemProps, ariaDescription = item.ariaDescription; - var keytipProps = item.keytipProps; - if (keytipProps && itemHasSubmenu) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - // Check for ariaDescription to set the _ariaDescriptionId and render a hidden span with - // the description in it to be added to ariaDescribedBy - if (ariaDescription) this._ariaDescriptionId = (0, _utilities.getId)(); - var ariaDescribedByIds = (0, _utilities.mergeAriaAttributeValues)(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : undefined, nativeProps['aria-describedby']); - var additionalItemProperties = { - 'aria-describedby': ariaDescribedByIds - }; - return _react.createElement("div", null, _react.createElement((0, _keytipData.KeytipData), { - keytipProps: item.keytipProps, - ariaDescribedBy: ariaDescribedByIds, - disabled: disabled - }, function(keytipAttributes) { - return _react.createElement("a", (0, _tslib.__assign)({}, additionalItemProperties, nativeProps, keytipAttributes, { - ref: _this._anchor, - href: item.href, - target: item.target, - rel: anchorRel, - className: classNames.root, - role: "menuitem", - "aria-haspopup": itemHasSubmenu || undefined, - "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : undefined, - "aria-posinset": focusableElementIndex + 1, - "aria-setsize": totalItemCount, - "aria-disabled": (0, _index.isItemDisabled)(item), - // eslint-disable-next-line deprecation/deprecation - style: item.style, - onClick: _this._onItemClick, - onMouseEnter: _this._onItemMouseEnter, - onMouseLeave: _this._onItemMouseLeave, - onMouseMove: _this._onItemMouseMove, - onKeyDown: itemHasSubmenu ? _this._onItemKeyDown : undefined - }), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - componentRef: item.componentRef, - item: item, - classNames: classNames, - index: index, - onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined, - hasIcons: hasIcons, - openSubMenu: openSubMenu, - dismissSubMenu: dismissSubMenu, - dismissMenu: dismissMenu, - getSubmenuTarget: _this._getSubmenuTarget - }, itemProps)), _this._renderAriaDescription(ariaDescription, classNames.screenReaderText)); - })); + var shouldIgnoreMouseEvent = function() { + return !isScrollIdle.current || !gotMouseMove.current; }; - return ContextualMenuAnchor; -}((0, _contextualMenuItemWrapper.ContextualMenuItemWrapper)); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","./ContextualMenuItemWrapper":"1NVzL","../../../KeytipData":"9cfzj","../../../utilities/contextualMenu/index":"lGesq","../ContextualMenuItem":"cJR9f","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NVzL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuItemWrapper", ()=>ContextualMenuItemWrapper); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var ContextualMenuItemWrapper = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuItemWrapper, _super); - function ContextualMenuItemWrapper(props) { - var _this = _super.call(this, props) || this; - _this._onItemMouseEnter = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseEnter = _a.onItemMouseEnter; - if (onItemMouseEnter) onItemMouseEnter(item, ev, ev.currentTarget); - }; - _this._onItemClick = function(ev) { - var _a = _this.props, item = _a.item, onItemClickBase = _a.onItemClickBase; - if (onItemClickBase) onItemClickBase(item, ev, ev.currentTarget); - }; - _this._onItemMouseLeave = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseLeave = _a.onItemMouseLeave; - if (onItemMouseLeave) onItemMouseLeave(item, ev); - }; - _this._onItemKeyDown = function(ev) { - var _a = _this.props, item = _a.item, onItemKeyDown = _a.onItemKeyDown; - if (onItemKeyDown) onItemKeyDown(item, ev); - }; - _this._onItemMouseMove = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseMove = _a.onItemMouseMove; - if (onItemMouseMove) onItemMouseMove(item, ev, ev.currentTarget); - }; - _this._getSubmenuTarget = function() { - return undefined; - }; - (0, _utilities.initializeComponentRef)(_this); - return _this; - } - ContextualMenuItemWrapper.prototype.shouldComponentUpdate = function(newProps) { - return !(0, _utilities.shallowCompare)(newProps, this.props); - }; - return ContextualMenuItemWrapper; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9cfzj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/KeytipData/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/KeytipData/index":"aomaw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aomaw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useKeytipRef", ()=>(0, _useKeytipRef.useKeytipRef)); -var _keytipData = require("./KeytipData"); -parcelHelpers.exportAll(_keytipData, exports); -var _keytipDataTypes = require("./KeytipData.types"); -parcelHelpers.exportAll(_keytipDataTypes, exports); -var _useKeytipRef = require("./useKeytipRef"); - -},{"./KeytipData":"ifQ8O","./KeytipData.types":false,"./useKeytipRef":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ifQ8O":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeytipData", ()=>KeytipData); -var _tslib = require("tslib"); -var _index = require("../../utilities/keytips/index"); -var _useKeytipData = require("./useKeytipData"); -var KeytipData = function(props) { - var _a; - var children = props.children, keytipDataProps = (0, _tslib.__rest)(props, [ - "children" - ]); - var _b = (0, _useKeytipData.useKeytipData)(keytipDataProps), keytipId = _b.keytipId, ariaDescribedBy = _b.ariaDescribedBy; - return children((_a = {}, _a[0, _index.DATAKTP_TARGET] = keytipId, _a[0, _index.DATAKTP_EXECUTE_TARGET] = keytipId, _a['aria-describedby'] = ariaDescribedBy, _a)); -}; - -},{"tslib":"9gizs","../../utilities/keytips/index":"8l91i","./useKeytipData":"ty9OD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8l91i":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _ikeytipTransitionKey = require("./IKeytipTransitionKey"); -parcelHelpers.exportAll(_ikeytipTransitionKey, exports); -var _keytipConfig = require("./KeytipConfig"); -parcelHelpers.exportAll(_keytipConfig, exports); -var _keytipConstants = require("./KeytipConstants"); -parcelHelpers.exportAll(_keytipConstants, exports); -var _keytipManager = require("./KeytipManager"); -parcelHelpers.exportAll(_keytipManager, exports); -var _keytipUtils = require("./KeytipUtils"); -parcelHelpers.exportAll(_keytipUtils, exports); - -},{"./IKeytipTransitionKey":"eJfOe","./KeytipConfig":"koR4Q","./KeytipConstants":"VnNjn","./KeytipManager":"04Pqp","./KeytipUtils":"adsC1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eJfOe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Tests for equality between two IKeytipTransitionKeys. - * - * @param key1 - First IKeytipTransitionKey. - * @param key2 - Second IKeytipTransitionKey. - * @returns T/F if the transition keys are equal. - */ parcelHelpers.export(exports, "transitionKeysAreEqual", ()=>transitionKeysAreEqual); -/** - * Tests if 'key' is present in 'keys'. - * - * @param keys - Array of IKeytipTransitionKey. - * @param key - IKeytipTransitionKey to find in 'keys'. - * @returns T/F if 'keys' contains 'key'. - */ parcelHelpers.export(exports, "transitionKeysContain", ()=>transitionKeysContain); -var _utilities = require("../../Utilities"); -function transitionKeysAreEqual(key1, key2) { - if (key1.key !== key2.key) return false; - var mod1 = key1.modifierKeys; - var mod2 = key2.modifierKeys; - if (!mod1 && mod2 || mod1 && !mod2) // Not equal if one modifier is defined and the other isn't - return false; - if (mod1 && mod2) { - if (mod1.length !== mod2.length) return false; - // Sort both arrays - mod1 = mod1.sort(); - mod2 = mod2.sort(); - for(var i = 0; i < mod1.length; i++){ - if (mod1[i] !== mod2[i]) return false; + var onMouseItemLeave = function(item, ev) { + var _a2; + if (shouldIgnoreMouseEvent()) { + return; + } + cancelSubMenuTimer(); + if (expandedMenuItemKey !== void 0) { + return; + } + if (hostElement.current.setActive) { + try { + hostElement.current.setActive(); + } catch (e) { } - } - return true; -} -function transitionKeysContain(keys, key) { - return !!(0, _utilities.find)(keys, function(transitionKey) { - return transitionKeysAreEqual(transitionKey, key); - }); -} - -},{"../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"koR4Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Builds a map of ID to IKeytipProps - * - * @param config - IKeytipConfig object - * @returns Config map - */ parcelHelpers.export(exports, "buildKeytipConfigMap", ()=>buildKeytipConfigMap); -/** - * Constructs a keytip from an IKeytipConfigItem and puts it in the configMap - * - * @param configMap - IKeytipConfigMap to store the keytip in - * @param parentSequence - string of the parent keytip - * @param keytip - IKeytipConfigItem data - */ parcelHelpers.export(exports, "constructKeytip", ()=>constructKeytip); -var _tslib = require("tslib"); -function buildKeytipConfigMap(config) { - var configMap = {}; - for(var _i = 0, _a = config.keytips; _i < _a.length; _i++){ - var keytip = _a[_i]; - constructKeytip(configMap, [], keytip); - } - return configMap; -} -function constructKeytip(configMap, parentSequence, keytip) { - // Compute full key sequence - var sequence = keytip.sequence ? keytip.sequence : keytip.content.toLocaleLowerCase(); - var keytipSequence = parentSequence.concat(sequence); - // Save props in configMap - var keytipProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, keytip.optionalProps), { - keySequences: keytipSequence, - content: keytip.content - }); - configMap[keytip.id] = keytipProps; - if (keytip.children) for(var _i = 0, _a = keytip.children; _i < _a.length; _i++){ - var child = _a[_i]; - // Create keytips for all children - constructKeytip(configMap, keytipSequence, child); - } -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"VnNjn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KTP_PREFIX", ()=>KTP_PREFIX); -parcelHelpers.export(exports, "KTP_SEPARATOR", ()=>KTP_SEPARATOR); -parcelHelpers.export(exports, "KTP_FULL_PREFIX", ()=>KTP_FULL_PREFIX); -parcelHelpers.export(exports, "DATAKTP_TARGET", ()=>DATAKTP_TARGET); -parcelHelpers.export(exports, "DATAKTP_EXECUTE_TARGET", ()=>DATAKTP_EXECUTE_TARGET); -parcelHelpers.export(exports, "DATAKTP_ARIA_TARGET", ()=>DATAKTP_ARIA_TARGET); -parcelHelpers.export(exports, "KTP_LAYER_ID", ()=>KTP_LAYER_ID); -parcelHelpers.export(exports, "KTP_ARIA_SEPARATOR", ()=>KTP_ARIA_SEPARATOR); -parcelHelpers.export(exports, "KeytipEvents", ()=>KeytipEvents); -var KTP_PREFIX = 'ktp'; -var KTP_SEPARATOR = '-'; -var KTP_FULL_PREFIX = KTP_PREFIX + KTP_SEPARATOR; -var DATAKTP_TARGET = 'data-ktp-target'; -var DATAKTP_EXECUTE_TARGET = 'data-ktp-execute-target'; -var DATAKTP_ARIA_TARGET = 'data-ktp-aria-target'; -var KTP_LAYER_ID = 'ktp-layer-id'; -var KTP_ARIA_SEPARATOR = ', '; -var KeytipEvents; -(function(KeytipEvents) { - KeytipEvents.KEYTIP_ADDED = 'keytipAdded'; - KeytipEvents.KEYTIP_REMOVED = 'keytipRemoved'; - KeytipEvents.KEYTIP_UPDATED = 'keytipUpdated'; - KeytipEvents.PERSISTED_KEYTIP_ADDED = 'persistedKeytipAdded'; - KeytipEvents.PERSISTED_KEYTIP_REMOVED = 'persistedKeytipRemoved'; - KeytipEvents.PERSISTED_KEYTIP_EXECUTE = 'persistedKeytipExecute'; - KeytipEvents.ENTER_KEYTIP_MODE = 'enterKeytipMode'; - KeytipEvents.EXIT_KEYTIP_MODE = 'exitKeytipMode'; -})(KeytipEvents || (KeytipEvents = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"04Pqp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeytipManager", ()=>KeytipManager); -var _tslib = require("tslib"); -var _utilities = require("../../Utilities"); -var _keytipConstants = require("../../utilities/keytips/KeytipConstants"); -/** - * This class is responsible for handling registering, updating, and unregistering of keytips - */ var KeytipManager = /** @class */ function() { - function KeytipManager() { - this.keytips = {}; - this.persistedKeytips = {}; - this.sequenceMapping = {}; - // This is (and should be) updated and kept in sync - // with the inKeytipMode in KeytipLayer. - this.inKeytipMode = false; - // Boolean that gets checked before entering keytip mode by the KeytipLayer - // Used for an override in special cases (e.g. Disable entering keytip mode when a modal is shown) - this.shouldEnterKeytipMode = true; - // Boolean to indicate whether to delay firing an event to update subscribers of - // keytip data changed. - this.delayUpdatingKeytipChange = false; - } - /** - * Static function to get singleton KeytipManager instance - * - * @returns Singleton KeytipManager instance - */ KeytipManager.getInstance = function() { - return this._instance; + } else { + (_a2 = hostElement.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + } }; - /** - * Initialization code to set set parameters to define - * how the KeytipManager handles keytip data. - * - * @param delayUpdatingKeytipChange - T/F if we should delay notifiying keytip subscribers - * of keytip changes - */ KeytipManager.prototype.init = function(delayUpdatingKeytipChange) { - this.delayUpdatingKeytipChange = delayUpdatingKeytipChange; + var updateFocusOnMouseEvent = function(item, ev, target2) { + var targetElement = target2 ? target2 : ev.currentTarget; + if (item.key === expandedMenuItemKey) { + return; + } + cancelSubMenuTimer(); + if (expandedMenuItemKey === void 0) { + targetElement.focus(); + } + if (hasSubmenu(item)) { + ev.stopPropagation(); + startSubmenuTimer(function() { + targetElement.focus(); + openSubMenu(item, targetElement, true); + }); + } else { + startSubmenuTimer(function() { + onSubMenuDismiss(ev); + targetElement.focus(); + }); + } }; - /** - * Registers a keytip - * - * @param keytipProps - Keytip to register - * @param persisted - T/F if this keytip should be persisted, default is false - * @returns Unique ID for this keytip - */ KeytipManager.prototype.register = function(keytipProps, persisted) { - if (persisted === void 0) persisted = false; - var props = keytipProps; - if (!persisted) { - // Add the overflowSetSequence if necessary - props = this.addParentOverflow(keytipProps); - this.sequenceMapping[props.keySequences.toString()] = props; - } - // Create a unique keytip - var uniqueKeytip = this._getUniqueKtp(props); - // Add to dictionary - persisted ? this.persistedKeytips[uniqueKeytip.uniqueID] = uniqueKeytip : this.keytips[uniqueKeytip.uniqueID] = uniqueKeytip; - // We only want to add something new if we are currently showing keytip mode - if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { - var event_1 = persisted ? (0, _keytipConstants.KeytipEvents).PERSISTED_KEYTIP_ADDED : (0, _keytipConstants.KeytipEvents).KEYTIP_ADDED; - (0, _utilities.EventGroup).raise(this, event_1, { - keytip: props, - uniqueID: uniqueKeytip.uniqueID - }); - } - return uniqueKeytip.uniqueID; + var onItemClick = function(item, ev) { + onItemClickBase(item, ev, ev.currentTarget); }; - /** - * Update a keytip - * - * @param keytipProps - Keytip to update - * @param uniqueID - Unique ID of this keytip - */ KeytipManager.prototype.update = function(keytipProps, uniqueID) { - var newKeytipProps = this.addParentOverflow(keytipProps); - var uniqueKeytip = this._getUniqueKtp(newKeytipProps, uniqueID); - var oldKeyTip = this.keytips[uniqueID]; - if (oldKeyTip) { - // Update everything except 'visible' - uniqueKeytip.keytip.visible = oldKeyTip.keytip.visible; - // Update keytip in this.keytips - this.keytips[uniqueID] = uniqueKeytip; - // Update the sequence to be up to date - delete this.sequenceMapping[oldKeyTip.keytip.keySequences.toString()]; - this.sequenceMapping[uniqueKeytip.keytip.keySequences.toString()] = uniqueKeytip.keytip; - // Raise event only if we are currently in keytip mode - if (this.inKeytipMode || !this.delayUpdatingKeytipChange) (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).KEYTIP_UPDATED, { - keytip: uniqueKeytip.keytip, - uniqueID: uniqueKeytip.uniqueID - }); + var onItemClickBase = function(item, ev, target2) { + var items = getSubmenuItems(item, { target: menuTarget }); + cancelSubMenuTimer(); + if (!hasSubmenu(item) && (!items || !items.length)) { + executeItemClick(item, ev); + } else { + if (item.key !== expandedMenuItemKey) { + var shouldFocusOnContainer = typeof props.shouldFocusOnContainer === "boolean" ? props.shouldFocusOnContainer : ev.nativeEvent.pointerType === "mouse"; + openSubMenu(item, target2, shouldFocusOnContainer); } + } + ev.stopPropagation(); + ev.preventDefault(); }; - /** - * Unregisters a keytip - * - * @param keytipToRemove - IKeytipProps of the keytip to remove - * @param uniqueID - Unique ID of this keytip - * @param persisted - T/F if this keytip should be persisted, default is false - */ KeytipManager.prototype.unregister = function(keytipToRemove, uniqueID, persisted) { - if (persisted === void 0) persisted = false; - persisted ? delete this.persistedKeytips[uniqueID] : delete this.keytips[uniqueID]; - !persisted && delete this.sequenceMapping[keytipToRemove.keySequences.toString()]; - var event = persisted ? (0, _keytipConstants.KeytipEvents).PERSISTED_KEYTIP_REMOVED : (0, _keytipConstants.KeytipEvents).KEYTIP_REMOVED; - // Update keytips only if we're in keytip mode - if (this.inKeytipMode || !this.delayUpdatingKeytipChange) (0, _utilities.EventGroup).raise(this, event, { - keytip: keytipToRemove, - uniqueID: uniqueID - }); + var onAnchorClick = function(item, ev) { + executeItemClick(item, ev); + ev.stopPropagation(); }; - /** - * Manual call to enter keytip mode - */ KeytipManager.prototype.enterKeytipMode = function() { - (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).ENTER_KEYTIP_MODE); + var executeItemClick = function(item, ev) { + if (item.disabled || item.isDisabled) { + return; + } + if (item.preferMenuTargetAsEventTarget) { + overrideTarget(ev, menuTarget); + } + var shouldDismiss = false; + if (item.onClick) { + shouldDismiss = !!item.onClick(ev, item); + } else if (props.onItemClick) { + shouldDismiss = !!props.onItemClick(ev, item); + } + if (shouldDismiss || !ev.defaultPrevented) { + dismiss(ev, true); + } }; - /** - * Manual call to exit keytip mode - */ KeytipManager.prototype.exitKeytipMode = function() { - (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).EXIT_KEYTIP_MODE); + return [ + onItemMouseEnterBase, + onItemMouseMoveBase, + onMouseItemLeave, + onItemClick, + onAnchorClick, + executeItemClick, + onItemClickBase + ]; + } + var ContextualMenuBase = React__namespace.memo(React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var _a2; + var _b2 = getPropsWithDefaults(DEFAULT_PROPS$4, propsWithoutDefaults); + _b2.ref; + var props = __rest(_b2, ["ref"]); + var hostElement = React__namespace.useRef(null); + var asyncTracker = useAsync(); + var menuId = useId(COMPONENT_NAME$7, props.id); + var dismiss = function(ev, dismissAll) { + var _a3; + return (_a3 = props.onDismiss) === null || _a3 === void 0 ? void 0 : _a3.call(props, ev, dismissAll); }; - /** - * Gets all IKeytipProps from this.keytips - * - * @returns All keytips stored in the manager - */ KeytipManager.prototype.getKeytips = function() { - var _this = this; - return Object.keys(this.keytips).map(function(key) { - return _this.keytips[key].keytip; - }); + var _c2 = useTarget(props.target, hostElement), targetRef = _c2[0], targetWindow = _c2[1]; + var tryFocusPreviousActiveElement = usePreviousActiveElement(props, targetWindow, hostElement)[0]; + var _d2 = useSubMenuState(props, dismiss), expandedMenuItemKey = _d2[0], openSubMenu = _d2[1], getSubmenuProps = _d2[2], onSubMenuDismiss = _d2[3]; + var _e2 = useShouldUpdateFocusOnMouseMove(props), shouldUpdateFocusOnMouseEvent = _e2[0], gotMouseMove = _e2[1], onMenuFocusCapture = _e2[2]; + var _f = useScrollHandler(asyncTracker), onScroll = _f[0], isScrollIdle = _f[1]; + var _g = useSubmenuEnterTimer(props, asyncTracker), cancelSubMenuTimer = _g[0], startSubmenuTimer = _g[1], subMenuEntryTimer = _g[2]; + var responsiveMode = useResponsiveMode(hostElement, props.responsiveMode); + useVisibility(props); + var _h = useKeyHandlers(props, dismiss, hostElement, openSubMenu), onKeyDown = _h[0], onKeyUp = _h[1], onMenuKeyDown = _h[2], onItemKeyDown = _h[3]; + var _j = useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss), onItemMouseEnterBase = _j[0], onItemMouseMoveBase = _j[1], onMouseItemLeave = _j[2], onItemClick = _j[3], onAnchorClick = _j[4], executeItemClick = _j[5], onItemClickBase = _j[6]; + var onDefaultRenderMenuList = function(menuListProps, menuClassNames, defaultRender) { + var indexCorrection = 0; + var items2 = menuListProps.items, totalItemCount = menuListProps.totalItemCount, hasCheckmarks2 = menuListProps.hasCheckmarks, hasIcons2 = menuListProps.hasIcons; + return React__namespace.createElement("ul", { className: menuClassNames.list, onKeyDown, onKeyUp, role: "presentation" }, items2.map(function(item, index2) { + var menuItem = renderMenuItem(item, index2, indexCorrection, totalItemCount, hasCheckmarks2, hasIcons2, menuClassNames); + if (item.itemType !== ContextualMenuItemType.Divider && item.itemType !== ContextualMenuItemType.Header) { + var indexIncrease = item.customOnRenderListLength ? item.customOnRenderListLength : 1; + indexCorrection += indexIncrease; + } + return menuItem; + })); + }; + var renderFocusZone = function(children2, adjustedFocusZoneProps2) { + var _a3 = props.focusZoneAs, ChildrenRenderer = _a3 === void 0 ? FocusZone : _a3; + return React__namespace.createElement(ChildrenRenderer, __assign$1({}, adjustedFocusZoneProps2), children2); + }; + var renderMenuItem = function(item, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2, menuClassNames) { + var _a3; + var renderedItems = []; + var iconProps = item.iconProps || { iconName: "None" }; + var getItemClassNames2 = item.getItemClassNames, itemProps = item.itemProps; + var styles2 = itemProps ? itemProps.styles : void 0; + var dividerClassName = item.itemType === ContextualMenuItemType.Divider ? item.className : void 0; + var subMenuIconClassName = item.submenuIconProps ? item.submenuIconProps.className : ""; + var itemClassNames; + if (getItemClassNames2) { + itemClassNames = getItemClassNames2(props.theme, isItemDisabled(item), expandedMenuItemKey === item.key, !!getIsChecked(item), !!item.href, iconProps.iconName !== "None", item.className, dividerClassName, iconProps.className, subMenuIconClassName, item.primaryDisabled); + } else { + var itemStyleProps = { + theme: props.theme, + disabled: isItemDisabled(item), + expanded: expandedMenuItemKey === item.key, + checked: !!getIsChecked(item), + isAnchorLink: !!item.href, + knownIcon: iconProps.iconName !== "None", + itemClassName: item.className, + dividerClassName, + iconClassName: iconProps.className, + subMenuClassName: subMenuIconClassName, + primaryDisabled: item.primaryDisabled + }; + itemClassNames = getContextualMenuItemClassNames(_getMenuItemStylesFunction((_a3 = menuClassNames.subComponentStyles) === null || _a3 === void 0 ? void 0 : _a3.menuItem, styles2), itemStyleProps); + } + if (item.text === "-" || item.name === "-") { + item.itemType = ContextualMenuItemType.Divider; + } + switch (item.itemType) { + case ContextualMenuItemType.Divider: + renderedItems.push(renderSeparator(index2, itemClassNames)); + break; + case ContextualMenuItemType.Header: + renderedItems.push(renderSeparator(index2, itemClassNames)); + var headerItem = renderHeaderMenuItem(item, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2); + renderedItems.push(renderListItem(headerItem, item.key || index2, itemClassNames, item.title)); + break; + case ContextualMenuItemType.Section: + renderedItems.push(renderSectionItem(item, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2)); + break; + default: + var defaultRenderNormalItem = function() { + return renderNormalItem(item, itemClassNames, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2); + }; + var menuItem = props.onRenderContextualMenuItem ? props.onRenderContextualMenuItem(item, defaultRenderNormalItem) : defaultRenderNormalItem(); + renderedItems.push(renderListItem(menuItem, item.key || index2, itemClassNames, item.title)); + break; + } + return React__namespace.createElement(React__namespace.Fragment, { key: item.key }, renderedItems); }; - /** - * Adds the overflowSetSequence to the keytipProps if its parent keytip also has it - * - * @param keytipProps - Keytip props to add overflowSetSequence to if necessary - * @returns - Modified keytip props, if needed to be modified - */ KeytipManager.prototype.addParentOverflow = function(keytipProps) { - var fullSequence = (0, _tslib.__spreadArray)([], keytipProps.keySequences, true); - fullSequence.pop(); - if (fullSequence.length !== 0) { - var parentKeytip = this.sequenceMapping[fullSequence.toString()]; - if (parentKeytip && parentKeytip.overflowSetSequence) return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - overflowSetSequence: parentKeytip.overflowSetSequence - }); + var defaultMenuItemRenderer = function(item, menuClassNames) { + var index2 = item.index, focusableElementIndex = item.focusableElementIndex, totalItemCount = item.totalItemCount, hasCheckmarks2 = item.hasCheckmarks, hasIcons2 = item.hasIcons; + return renderMenuItem(item, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2, menuClassNames); + }; + var renderSectionItem = function(sectionItem, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2) { + var sectionProps = sectionItem.sectionProps; + if (!sectionProps) { + return; + } + var headerItem; + var groupProps; + if (sectionProps.title) { + var headerContextualMenuItem = void 0; + var ariaLabelledby = ""; + if (typeof sectionProps.title === "string") { + var id_1 = menuId + sectionProps.title.replace(/\s/g, ""); + headerContextualMenuItem = { + key: "section-".concat(sectionProps.title, "-title"), + itemType: ContextualMenuItemType.Header, + text: sectionProps.title, + id: id_1 + }; + ariaLabelledby = id_1; + } else { + var id_2 = sectionProps.title.id || menuId + sectionProps.title.key.replace(/\s/g, ""); + headerContextualMenuItem = __assign$1(__assign$1({}, sectionProps.title), { id: id_2 }); + ariaLabelledby = id_2; } - return keytipProps; + if (headerContextualMenuItem) { + groupProps = { + role: "group", + "aria-labelledby": ariaLabelledby + }; + headerItem = renderHeaderMenuItem(headerContextualMenuItem, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2); + } + } + if (sectionProps.items && sectionProps.items.length > 0) { + var correctedIndex_1 = 0; + return React__namespace.createElement( + "li", + { role: "presentation", key: sectionProps.key || sectionItem.key || "section-".concat(index2) }, + React__namespace.createElement( + "div", + __assign$1({}, groupProps), + React__namespace.createElement( + "ul", + { className: menuClassNames.list, role: "presentation" }, + sectionProps.topDivider && renderSeparator(index2, itemClassNames, true, true), + headerItem && renderListItem(headerItem, sectionItem.key || index2, itemClassNames, sectionItem.title), + sectionProps.items.map(function(contextualMenuItem, itemsIndex) { + var menuItem = renderMenuItem(contextualMenuItem, itemsIndex, correctedIndex_1, getItemCount(sectionProps.items), hasCheckmarks2, hasIcons2, menuClassNames); + if (contextualMenuItem.itemType !== ContextualMenuItemType.Divider && contextualMenuItem.itemType !== ContextualMenuItemType.Header) { + var indexIncrease = contextualMenuItem.customOnRenderListLength ? contextualMenuItem.customOnRenderListLength : 1; + correctedIndex_1 += indexIncrease; + } + return menuItem; + }), + sectionProps.bottomDivider && renderSeparator(index2, itemClassNames, false, true) + ) + ) + ); + } }; - /** - * Public function to bind for overflow items that have a submenu - */ KeytipManager.prototype.menuExecute = function(overflowButtonSequences, keytipSequences) { - (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).PERSISTED_KEYTIP_EXECUTE, { - overflowButtonSequences: overflowButtonSequences, - keytipSequences: keytipSequences - }); + var renderListItem = function(content2, key2, classNames3, title2) { + return React__namespace.createElement("li", { role: "presentation", title: title2, key: key2, className: classNames3.item }, content2); }; - /** - * Creates an IUniqueKeytip object - * - * @param keytipProps - IKeytipProps - * @param uniqueID - Unique ID, will default to the next unique ID if not passed - * @returns IUniqueKeytip object - */ KeytipManager.prototype._getUniqueKtp = function(keytipProps, uniqueID) { - if (uniqueID === void 0) uniqueID = (0, _utilities.getId)(); - return { - keytip: (0, _tslib.__assign)({}, keytipProps), - uniqueID: uniqueID - }; + var renderSeparator = function(index2, classNames3, top, fromSection) { + if (fromSection || index2 > 0) { + return React__namespace.createElement("li", { role: "separator", key: "separator-" + index2 + (top === void 0 ? "" : top ? "-top" : "-bottom"), className: classNames3.divider, "aria-hidden": "true" }); + } + return null; }; - KeytipManager._instance = new KeytipManager(); - return KeytipManager; -}(); - -},{"tslib":"9gizs","../../Utilities":"1NZCy","../../utilities/keytips/KeytipConstants":"VnNjn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"adsC1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Converts a whole set of KeySequences into one keytip ID, which will be the ID for the last keytip sequence specified - * keySequences should not include the initial keytip 'start' sequence. - * - * @param keySequences - Full path of IKeySequences for one keytip. - * @returns String to use for the keytip ID. - */ parcelHelpers.export(exports, "sequencesToID", ()=>sequencesToID); -/** - * Merges an overflow sequence with a key sequence. - * - * @param keySequences - Full sequence for one keytip. - * @param overflowKeySequences - Full overflow keytip sequence. - * @returns Sequence that will be used by the keytip when in the overflow. - */ parcelHelpers.export(exports, "mergeOverflows", ()=>mergeOverflows); -/** - * Constructs the data-ktp-target attribute selector from a full key sequence. - * - * @param keySequences - Full string[] for a Keytip. - * @returns String selector to use to query for the keytip target. - */ parcelHelpers.export(exports, "ktpTargetFromSequences", ()=>ktpTargetFromSequences); -/** - * Constructs the data-ktp-execute-target attribute selector from a keytip ID. - * - * @param keytipId - ID of the Keytip. - * @returns String selector to use to query for the keytip execute target. - */ parcelHelpers.export(exports, "ktpTargetFromId", ()=>ktpTargetFromId); -/** - * Gets the aria-describedby value to put on the component with this keytip. - * - * @param keySequences - KeySequences of the keytip. - * @returns The aria-describedby value to set on the component with this keytip. - */ parcelHelpers.export(exports, "getAriaDescribedBy", ()=>getAriaDescribedBy); -var _tslib = require("tslib"); -var _keytipConstants = require("./KeytipConstants"); -var _utilities = require("../../Utilities"); -function sequencesToID(keySequences) { - return keySequences.reduce(function(prevValue, keySequence) { - return prevValue + (0, _keytipConstants.KTP_SEPARATOR) + keySequence.split('').join((0, _keytipConstants.KTP_SEPARATOR)); - }, (0, _keytipConstants.KTP_PREFIX)); -} -function mergeOverflows(keySequences, overflowKeySequences) { - var overflowSequenceLen = overflowKeySequences.length; - var overflowSequence = (0, _tslib.__spreadArray)([], overflowKeySequences, true).pop(); - var newKeySequences = (0, _tslib.__spreadArray)([], keySequences, true); - return (0, _utilities.addElementAtIndex)(newKeySequences, overflowSequenceLen - 1, overflowSequence); -} -function ktpTargetFromSequences(keySequences) { - return '[' + (0, _keytipConstants.DATAKTP_TARGET) + '="' + sequencesToID(keySequences) + '"]'; -} -function ktpTargetFromId(keytipId) { - return '[' + (0, _keytipConstants.DATAKTP_EXECUTE_TARGET) + '="' + keytipId + '"]'; -} -function getAriaDescribedBy(keySequences) { - var describedby = ' ' + (0, _keytipConstants.KTP_LAYER_ID); - if (!keySequences.length) // Return just the layer ID - return describedby; - return describedby + ' ' + sequencesToID(keySequences); -} - -},{"tslib":"9gizs","./KeytipConstants":"VnNjn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ty9OD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook that creates attributes for components which are enabled with Keytip. - */ parcelHelpers.export(exports, "useKeytipData", ()=>useKeytipData); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("../../Utilities"); -var _index = require("../../utilities/keytips/index"); -function useKeytipData(options) { - var uniqueId = _react.useRef(); - var keytipProps = options.keytipProps ? (0, _tslib.__assign)({ - disabled: options.disabled - }, options.keytipProps) : undefined; - var keytipManager = (0, _reactHooks.useConst)((0, _index.KeytipManager).getInstance()); - var prevOptions = (0, _reactHooks.usePrevious)(options); - // useLayoutEffect used to strictly emulate didUpdate/didMount behavior - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - if (uniqueId.current && keytipProps && ((prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.keytipProps) !== options.keytipProps || (prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.disabled) !== options.disabled)) keytipManager.update(keytipProps, uniqueId.current); + var renderNormalItem = function(item, classNames3, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2) { + if (item.onRender) { + return item.onRender(__assign$1({ "aria-posinset": focusableElementIndex + 1, "aria-setsize": totalItemCount }, item), dismiss); + } + var contextualMenuItemAs = props.contextualMenuItemAs; + var commonProps = { + item, + classNames: classNames3, + index: index2, + focusableElementIndex, + totalItemCount, + hasCheckmarks: hasCheckmarks2, + hasIcons: hasIcons2, + contextualMenuItemAs, + onItemMouseEnter: onItemMouseEnterBase, + onItemMouseLeave: onMouseItemLeave, + onItemMouseMove: onItemMouseMoveBase, + onItemMouseDown, + executeItemClick, + onItemKeyDown, + expandedMenuItemKey, + openSubMenu, + dismissSubMenu: onSubMenuDismiss, + dismissMenu: dismiss + }; + if (item.href) { + var ContextualMenuAnchorAs = ContextualMenuAnchor; + if (item.contextualMenuItemWrapperAs) { + ContextualMenuAnchorAs = composeComponentAs(item.contextualMenuItemWrapperAs, ContextualMenuAnchorAs); + } + return React__namespace.createElement(ContextualMenuAnchorAs, __assign$1({}, commonProps, { onItemClick: onAnchorClick })); + } + if (item.split && hasSubmenu(item)) { + var ContextualMenuSplitButtonAs = ContextualMenuSplitButton; + if (item.contextualMenuItemWrapperAs) { + ContextualMenuSplitButtonAs = composeComponentAs(item.contextualMenuItemWrapperAs, ContextualMenuSplitButtonAs); + } + return React__namespace.createElement(ContextualMenuSplitButtonAs, __assign$1({}, commonProps, { onItemClick, onItemClickBase, onTap: cancelSubMenuTimer })); + } + var ContextualMenuButtonAs = ContextualMenuButton; + if (item.contextualMenuItemWrapperAs) { + ContextualMenuButtonAs = composeComponentAs(item.contextualMenuItemWrapperAs, ContextualMenuButtonAs); + } + return React__namespace.createElement(ContextualMenuButtonAs, __assign$1({}, commonProps, { onItemClick, onItemClickBase })); + }; + var renderHeaderMenuItem = function(item, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2) { + var ChildrenRenderer = ContextualMenuItem; + if (item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(item.contextualMenuItemAs, ChildrenRenderer); + } + if (props.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(props.contextualMenuItemAs, ChildrenRenderer); + } + var itemProps = item.itemProps, id3 = item.id; + var divHtmlProperties = itemProps && getNativeProps(itemProps, divProperties); + return ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + React__namespace.createElement( + "div", + __assign$1({ id: id3, className: menuClassNames.header }, divHtmlProperties, { style: item.style }), + React__namespace.createElement(ChildrenRenderer, __assign$1({ item, classNames: itemClassNames, index: index2, onCheckmarkClick: hasCheckmarks2 ? onItemClick : void 0, hasIcons: hasIcons2 }, itemProps)) + ) + ); + }; + var isBeakVisible = props.isBeakVisible; + var items = props.items, labelElementId = props.labelElementId, id2 = props.id, className2 = props.className, beakWidth = props.beakWidth, directionalHint = props.directionalHint, directionalHintForRTL = props.directionalHintForRTL, alignTargetEdge = props.alignTargetEdge, gapSpace = props.gapSpace, coverTarget = props.coverTarget, ariaLabel2 = props.ariaLabel, doNotLayer = props.doNotLayer, target2 = props.target, bounds2 = props.bounds, useTargetWidth = props.useTargetWidth, useTargetAsMinWidth = props.useTargetAsMinWidth, directionalHintFixed = props.directionalHintFixed, shouldFocusOnMount = props.shouldFocusOnMount, shouldFocusOnContainer = props.shouldFocusOnContainer, title = props.title, styles = props.styles, theme = props.theme, calloutProps = props.calloutProps, _k = props.onRenderSubMenu, onRenderSubMenu2 = _k === void 0 ? onDefaultRenderSubMenu : _k, _l = props.onRenderMenuList, onRenderMenuList = _l === void 0 ? function(menuListProps, defaultRender) { + return onDefaultRenderMenuList(menuListProps, classNames2); + } : _l, focusZoneProps = props.focusZoneProps, getMenuClassNames = props.getMenuClassNames; + var classNames2 = getMenuClassNames ? getMenuClassNames(theme, className2) : getClassNames$l(styles, { + theme, + className: className2 }); - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - // Register Keytip in KeytipManager - if (keytipProps) uniqueId.current = keytipManager.register(keytipProps); - return function() { - // Unregister Keytip in KeytipManager - keytipProps && keytipManager.unregister(keytipProps, uniqueId.current); + var hasIcons = itemsHaveIcons(items); + function itemsHaveIcons(contextualMenuItems) { + for (var _i = 0, contextualMenuItems_1 = contextualMenuItems; _i < contextualMenuItems_1.length; _i++) { + var item = contextualMenuItems_1[_i]; + if (item.iconProps) { + return true; + } + if (item.itemType === ContextualMenuItemType.Section && item.sectionProps && itemsHaveIcons(item.sectionProps.items)) { + return true; + } + } + return false; + } + var adjustedFocusZoneProps = __assign$1(__assign$1({ direction: FocusZoneDirection.vertical, handleTabKey: FocusZoneTabbableElements.all, isCircularNavigation: true, "data-tabster": '{"uncontrolled": {}, "focusable": { "excludeFromMover": true }}' }, focusZoneProps), { className: css(classNames2.root, (_a2 = props.focusZoneProps) === null || _a2 === void 0 ? void 0 : _a2.className) }); + var hasCheckmarks = canAnyMenuItemsCheck(items); + var submenuProps = expandedMenuItemKey && props.hidden !== true ? getSubmenuProps() : null; + isBeakVisible = isBeakVisible === void 0 ? responsiveMode <= ResponsiveMode.medium : isBeakVisible; + var contextMenuStyle; + var targetAsHtmlElement = targetRef.current; + if ((useTargetWidth || useTargetAsMinWidth) && targetAsHtmlElement && targetAsHtmlElement.offsetWidth) { + var targetBoundingRect = targetAsHtmlElement.getBoundingClientRect(); + var targetWidth = targetBoundingRect.width - 2; + if (useTargetWidth) { + contextMenuStyle = { + width: targetWidth }; - // this is meant to run only at mount, and updates are handled separately - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - var nativeKeytipProps = { - ariaDescribedBy: options.ariaDescribedBy, - keytipId: undefined + } else if (useTargetAsMinWidth) { + contextMenuStyle = { + minWidth: targetWidth + }; + } + } + if (items && items.length > 0) { + var totalItemCount_1 = getItemCount(items); + var calloutStyles_1 = classNames2.subComponentStyles ? classNames2.subComponentStyles.callout : void 0; + return React__namespace.createElement(MenuContext.Consumer, null, function(menuContext) { + return React__namespace.createElement( + Callout, + __assign$1({ styles: calloutStyles_1, onRestoreFocus: tryFocusPreviousActiveElement }, calloutProps, { target: target2 || menuContext.target, isBeakVisible, beakWidth, directionalHint, directionalHintForRTL, gapSpace, coverTarget, doNotLayer, className: css("ms-ContextualMenu-Callout", calloutProps && calloutProps.className), setInitialFocus: shouldFocusOnMount, onDismiss: props.onDismiss || menuContext.onDismiss, onScroll, bounds: bounds2, directionalHintFixed, alignTargetEdge, hidden: props.hidden || menuContext.hidden, ref: forwardedRef }), + React__namespace.createElement( + "div", + { style: contextMenuStyle, ref: hostElement, id: id2, className: classNames2.container, tabIndex: shouldFocusOnContainer ? 0 : -1, onKeyDown: onMenuKeyDown, onKeyUp, onFocusCapture: onMenuFocusCapture, "aria-label": ariaLabel2, "aria-labelledby": labelElementId, role: "menu" }, + title && React__namespace.createElement( + "div", + { className: classNames2.title }, + " ", + title, + " " + ), + items && items.length ? renderFocusZone(onRenderMenuList({ + ariaLabel: ariaLabel2, + items, + totalItemCount: totalItemCount_1, + hasCheckmarks, + hasIcons, + defaultMenuItemRenderer: function(item) { + return defaultMenuItemRenderer(item, classNames2); + }, + labelElementId + }, function(menuListProps, defaultRender) { + return onDefaultRenderMenuList(menuListProps, classNames2); + }), adjustedFocusZoneProps) : null, + submenuProps && onRenderSubMenu2(submenuProps, onDefaultRenderSubMenu) + ), + React__namespace.createElement(FocusRects, null) + ); + }); + } else { + return null; + } + }), function(prevProps, newProps) { + if (!newProps.shouldUpdateWhenHidden && prevProps.hidden && newProps.hidden) { + return true; + } + return shallowCompare(prevProps, newProps); + }); + ContextualMenuBase.displayName = "ContextualMenuBase"; + function isAltOrMeta$1(ev) { + return ev.which === KeyCodes.alt || ev.key === "Meta"; + } + function onItemMouseDown(item, ev) { + var _a2; + (_a2 = item.onMouseDown) === null || _a2 === void 0 ? void 0 : _a2.call(item, item, ev); + } + function onDefaultRenderSubMenu(subMenuProps, defaultRender) { + throw Error("ContextualMenuBase: onRenderSubMenu callback is null or undefined. Please ensure to set `onRenderSubMenu` property either manually or with `styled` helper."); + } + function findItemByKeyFromItems(key2, items) { + for (var _i = 0, items_3 = items; _i < items_3.length; _i++) { + var item = items_3[_i]; + if (item.itemType === ContextualMenuItemType.Section && item.sectionProps) { + var match2 = findItemByKeyFromItems(key2, item.sectionProps.items); + if (match2) { + return match2; + } + } else if (item.key && item.key === key2) { + return item; + } + } + } + function getOnClickWithOverrideTarget(onClick, target2) { + return onClick ? function(ev, item) { + overrideTarget(ev, target2); + return onClick(ev, item); + } : onClick; + } + function overrideTarget(ev, target2) { + if (ev && target2) { + ev.persist(); + if (target2 instanceof Event) { + ev.target = target2.target; + } else if (target2 instanceof Element) { + ev.target = target2; + } + } + } + var GlobalClassNames$c = { + root: "ms-ContextualMenu", + container: "ms-ContextualMenu-container", + list: "ms-ContextualMenu-list", + header: "ms-ContextualMenu-header", + title: "ms-ContextualMenu-title", + isopen: "is-open" + }; + var getStyles$q = function(props) { + var className2 = props.className, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$c, theme); + var fonts = theme.fonts, semanticColors = theme.semanticColors, effects = theme.effects; + return { + root: [ + theme.fonts.medium, + classNames2.root, + classNames2.isopen, + { + backgroundColor: semanticColors.menuBackground, + minWidth: "180px" + }, + className2 + ], + container: [ + classNames2.container, + { + selectors: { + ":focus": { outline: 0 } + } + } + ], + list: [ + classNames2.list, + classNames2.isopen, + { + listStyleType: "none", + margin: "0", + padding: "0" + } + ], + header: [ + classNames2.header, + fonts.small, + { + fontWeight: FontWeights.semibold, + color: semanticColors.menuHeader, + background: "none", + backgroundColor: "transparent", + border: "none", + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + cursor: "default", + padding: "0px 6px", + userSelect: "none", + textAlign: "left" + } + ], + title: [ + classNames2.title, + { + fontSize: fonts.mediumPlus.fontSize, + paddingRight: "14px", + paddingLeft: "14px", + paddingBottom: "5px", + paddingTop: "5px", + backgroundColor: semanticColors.menuItemBackgroundPressed + } + ], + subComponentStyles: { + callout: { + root: { + boxShadow: effects.elevation8 + } + }, + menuItem: {} + } }; - if (keytipProps) nativeKeytipProps = getKeytipData(keytipManager, keytipProps, options.ariaDescribedBy); - return nativeKeytipProps; -} -/** - * Gets the aria- and data- attributes to attach to the component - * @param keytipProps - options for Keytip - * @param describedByPrepend - ariaDescribedBy value to prepend - */ function getKeytipData(keytipManager, keytipProps, describedByPrepend) { - // Add the parent overflow sequence if necessary - var newKeytipProps = keytipManager.addParentOverflow(keytipProps); - // Construct aria-describedby and data-ktp-id attributes - var ariaDescribedBy = (0, _utilities.mergeAriaAttributeValues)(describedByPrepend, (0, _index.getAriaDescribedBy)(newKeytipProps.keySequences)); - var keySequences = (0, _tslib.__spreadArray)([], newKeytipProps.keySequences, true); - if (newKeytipProps.overflowSetSequence) keySequences = (0, _index.mergeOverflows)(keySequences, newKeytipProps.overflowSetSequence); - var keytipId = (0, _index.sequencesToID)(keySequences); + }; + function onRenderSubMenu(subMenuProps) { + return React__namespace.createElement(LocalContextualMenu, __assign$1({}, subMenuProps)); + } + var LocalContextualMenu = styled(ContextualMenuBase, getStyles$q, function(props) { return { - ariaDescribedBy: ariaDescribedBy, - keytipId: keytipId - }; -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","../../Utilities":"1NZCy","../../utilities/keytips/index":"8l91i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i5hAV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuButton", ()=>ContextualMenuButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -var _keytipData = require("../../../KeytipData"); -var _index = require("../../../utilities/contextualMenu/index"); -var _contextualMenuItem = require("../ContextualMenuItem"); -var ContextualMenuButton = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuButton, _super); - function ContextualMenuButton() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._btn = _react.createRef(); - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); + onRenderSubMenu: props.onRenderSubMenu ? composeRenderFunction(props.onRenderSubMenu, onRenderSubMenu) : onRenderSubMenu + }; + }, { scope: "ContextualMenu" }); + var ContextualMenu = LocalContextualMenu; + ContextualMenu.displayName = "ContextualMenu"; + var ButtonGlobalClassNames = { + msButton: "ms-Button", + msButtonHasMenu: "ms-Button--hasMenu", + msButtonIcon: "ms-Button-icon", + msButtonMenuIcon: "ms-Button-menuIcon", + msButtonLabel: "ms-Button-label", + msButtonDescription: "ms-Button-description", + msButtonScreenReaderText: "ms-Button-screenReaderText", + msButtonFlexContainer: "ms-Button-flexContainer", + msButtonTextContainer: "ms-Button-textContainer" + }; + var getBaseButtonClassNames = memoizeFunction(function(theme, styles, className2, variantClassName, iconClassName, menuIconClassName, disabled, hasMenu, checked, expanded, isSplit) { + var _a2, _b2; + var classNames2 = getGlobalClassNames(ButtonGlobalClassNames, theme || {}); + var isExpanded = expanded && !isSplit; + return mergeStyleSets(styles.__shadowConfig__, { + root: [ + classNames2.msButton, + styles.root, + variantClassName, + checked && ["is-checked", styles.rootChecked], + isExpanded && [ + "is-expanded", + styles.rootExpanded, + (_a2 = {}, _a2[":hover .".concat(classNames2.msButtonIcon)] = styles.iconExpandedHovered, // menuIcon falls back to rootExpandedHovered to support original behavior + _a2[":hover .".concat(classNames2.msButtonMenuIcon)] = styles.menuIconExpandedHovered || styles.rootExpandedHovered, _a2[":hover"] = styles.rootExpandedHovered, _a2) + ], + hasMenu && [ButtonGlobalClassNames.msButtonHasMenu, styles.rootHasMenu], + disabled && ["is-disabled", styles.rootDisabled], + !disabled && !isExpanded && !checked && (_b2 = { + ":hover": styles.rootHovered + }, _b2[":hover .".concat(classNames2.msButtonLabel)] = styles.labelHovered, _b2[":hover .".concat(classNames2.msButtonIcon)] = styles.iconHovered, _b2[":hover .".concat(classNames2.msButtonDescription)] = styles.descriptionHovered, _b2[":hover .".concat(classNames2.msButtonMenuIcon)] = styles.menuIconHovered, _b2[":focus"] = styles.rootFocused, _b2[":active"] = styles.rootPressed, _b2[":active .".concat(classNames2.msButtonIcon)] = styles.iconPressed, _b2[":active .".concat(classNames2.msButtonDescription)] = styles.descriptionPressed, _b2[":active .".concat(classNames2.msButtonMenuIcon)] = styles.menuIconPressed, _b2), + disabled && checked && [styles.rootCheckedDisabled], + !disabled && checked && { + ":hover": styles.rootCheckedHovered, + ":active": styles.rootCheckedPressed + }, + className2 + ], + flexContainer: [classNames2.msButtonFlexContainer, styles.flexContainer], + textContainer: [classNames2.msButtonTextContainer, styles.textContainer], + icon: [ + classNames2.msButtonIcon, + iconClassName, + styles.icon, + isExpanded && styles.iconExpanded, + checked && styles.iconChecked, + disabled && styles.iconDisabled + ], + label: [classNames2.msButtonLabel, styles.label, checked && styles.labelChecked, disabled && styles.labelDisabled], + menuIcon: [ + classNames2.msButtonMenuIcon, + menuIconClassName, + styles.menuIcon, + checked && styles.menuIconChecked, + disabled && !isSplit && styles.menuIconDisabled, + !disabled && !isExpanded && !checked && { + ":hover": styles.menuIconHovered, + ":active": styles.menuIconPressed + }, + isExpanded && ["is-expanded", styles.menuIconExpanded] + ], + description: [ + classNames2.msButtonDescription, + styles.description, + checked && styles.descriptionChecked, + disabled && styles.descriptionDisabled + ], + screenReaderText: [classNames2.msButtonScreenReaderText, styles.screenReaderText] + }); + }); + var SplitButtonGlobalClassNames = { + msSplitButtonDivider: "ms-SplitButton-divider" + }; + var getSplitButtonClassNames = memoizeFunction(function(styles, disabled, expanded, checked, primaryDisabled) { + return { + root: mergeStyles(styles.splitButtonMenuButton, expanded && [styles.splitButtonMenuButtonExpanded], disabled && [styles.splitButtonMenuButtonDisabled], checked && !disabled && [styles.splitButtonMenuButtonChecked], primaryDisabled && !disabled && [ + { + ":focus": styles.splitButtonMenuFocused + } + ]), + splitButtonContainer: mergeStyles(styles.splitButtonContainer, !disabled && checked && [ + styles.splitButtonContainerChecked, + { + ":hover": styles.splitButtonContainerCheckedHovered + } + ], !disabled && !checked && [ + { + ":hover": styles.splitButtonContainerHovered, + ":focus": styles.splitButtonContainerFocused + } + ], disabled && styles.splitButtonContainerDisabled), + icon: mergeStyles(styles.splitButtonMenuIcon, disabled && styles.splitButtonMenuIconDisabled, !disabled && primaryDisabled && styles.splitButtonMenuIcon), + flexContainer: mergeStyles(styles.splitButtonFlexContainer), + divider: mergeStyles(SplitButtonGlobalClassNames.msSplitButtonDivider, styles.splitButtonDivider, (primaryDisabled || disabled) && styles.splitButtonDividerDisabled) + }; + }); + var TouchIdleDelay$1 = 500; + var COMPONENT_NAME$6 = "BaseButton"; + var BaseButton = ( + /** @class */ + (function(_super) { + __extends(BaseButton2, _super); + function BaseButton2(props) { + var _this = _super.call(this, props) || this; + _this._buttonElement = React__namespace.createRef(); + _this._splitButtonContainer = React__namespace.createRef(); + _this._mergedRef = createMergedRef(); + _this._renderedVisibleMenu = false; + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); }); - _this._renderAriaDescription = function(ariaDescription, className) { - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan - return ariaDescription ? _react.createElement("span", { - id: _this._ariaDescriptionId, - className: className - }, ariaDescription) : null; + _this._onRenderIcon = function(buttonProps, defaultRender) { + var iconProps = _this.props.iconProps; + if (iconProps && (iconProps.iconName !== void 0 || iconProps.imageProps)) { + var className2 = iconProps.className, imageProps = iconProps.imageProps, rest = __rest(iconProps, ["className", "imageProps"]); + if (iconProps.styles) { + return React__namespace.createElement(Icon, __assign$1({ className: css(_this._classNames.icon, className2), imageProps }, rest)); + } + if (iconProps.iconName) { + return React__namespace.createElement(FontIcon, __assign$1({ className: css(_this._classNames.icon, className2) }, rest)); + } + if (imageProps) { + return React__namespace.createElement(ImageIcon, __assign$1({ className: css(_this._classNames.icon, className2), imageProps }, rest)); + } + } + return null; + }; + _this._onRenderTextContents = function() { + var _a2 = _this.props, text2 = _a2.text, children2 = _a2.children, _b2 = _a2.secondaryText, secondaryText = _b2 === void 0 ? _this.props.description : _b2, _c2 = _a2.onRenderText, onRenderText = _c2 === void 0 ? _this._onRenderText : _c2, _d2 = _a2.onRenderDescription, onRenderDescription = _d2 === void 0 ? _this._onRenderDescription : _d2; + if (text2 || typeof children2 === "string" || secondaryText) { + return React__namespace.createElement( + "span", + { className: _this._classNames.textContainer }, + onRenderText(_this.props, _this._onRenderText), + onRenderDescription(_this.props, _this._onRenderDescription) + ); + } + return [onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription)]; + }; + _this._onRenderText = function() { + var text2 = _this.props.text; + var children2 = _this.props.children; + if (text2 === void 0 && typeof children2 === "string") { + text2 = children2; + } + if (_this._hasText()) { + return React__namespace.createElement("span", { key: _this._labelId, className: _this._classNames.label, id: _this._labelId }, text2); + } + return null; + }; + _this._onRenderChildren = function() { + var children2 = _this.props.children; + if (typeof children2 === "string") { + return null; + } + return children2; + }; + _this._onRenderDescription = function(props2) { + var _a2 = props2.secondaryText, secondaryText = _a2 === void 0 ? _this.props.description : _a2; + return secondaryText ? React__namespace.createElement("span", { key: _this._descriptionId, className: _this._classNames.description, id: _this._descriptionId }, secondaryText) : null; + }; + _this._onRenderAriaDescription = function() { + var ariaDescription = _this.props.ariaDescription; + return ariaDescription ? React__namespace.createElement("span", { className: _this._classNames.screenReaderText, id: _this._ariaDescriptionId }, ariaDescription) : null; + }; + _this._onRenderMenuIcon = function(props2) { + var menuIconProps = _this.props.menuIconProps; + return React__namespace.createElement(FontIcon, __assign$1({ iconName: "ChevronDown" }, menuIconProps, { className: _this._classNames.menuIcon })); + }; + _this._onRenderMenu = function(menuProps) { + var MenuType = _this.props.menuAs ? composeComponentAs(_this.props.menuAs, ContextualMenu) : ContextualMenu; + return React__namespace.createElement(MenuType, __assign$1({}, menuProps)); + }; + _this._onDismissMenu = function(ev) { + var menuProps = _this.props.menuProps; + if (menuProps && menuProps.onDismiss) { + menuProps.onDismiss(ev); + } + if (!ev || !ev.defaultPrevented) { + _this._dismissMenu(); + } }; - _this._getSubmenuTarget = function() { - return _this._btn.current ? _this._btn.current : undefined; + _this._dismissMenu = function() { + _this._menuShouldFocusOnMount = void 0; + _this._menuShouldFocusOnContainer = void 0; + _this.setState({ menuHidden: true }); }; - return _this; - } - ContextualMenuButton.prototype.render = function() { - var _this = this; - var _a = this.props, item = _a.item, classNames = _a.classNames, index = _a.index, focusableElementIndex = _a.focusableElementIndex, totalItemCount = _a.totalItemCount, hasCheckmarks = _a.hasCheckmarks, hasIcons = _a.hasIcons, contextualMenuItemAs = _a.contextualMenuItemAs, expandedMenuItemKey = _a.expandedMenuItemKey, onItemMouseDown = _a.onItemMouseDown, onItemClick = _a.onItemClick, openSubMenu = _a.openSubMenu, dismissSubMenu = _a.dismissSubMenu, dismissMenu = _a.dismissMenu; - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(item.contextualMenuItemAs, ChildrenRenderer); - if (contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(contextualMenuItemAs, ChildrenRenderer); - var isChecked = (0, _index.getIsChecked)(item); - var canCheck = isChecked !== null; - var defaultRole = (0, _index.getMenuItemAriaRole)(item); - var itemHasSubmenu = (0, _index.hasSubmenu)(item); - var itemProps = item.itemProps, ariaLabel = item.ariaLabel, ariaDescription = item.ariaDescription; - var buttonNativeProperties = (0, _utilities.getNativeProps)(item, (0, _utilities.buttonProperties)); - // Do not add the disabled attribute to the button so that it is focusable - delete buttonNativeProperties.disabled; - var itemRole = item.role || defaultRole; - // Check for ariaDescription to set the _ariaDescriptionId and render a hidden span with - // the description in it to be added to ariaDescribedBy - if (ariaDescription) this._ariaDescriptionId = (0, _utilities.getId)(); - var ariaDescribedByIds = (0, _utilities.mergeAriaAttributeValues)(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : undefined, buttonNativeProperties['aria-describedby']); - var itemButtonProperties = { - className: classNames.root, - onClick: this._onItemClick, - onKeyDown: itemHasSubmenu ? this._onItemKeyDown : undefined, - onMouseEnter: this._onItemMouseEnter, - onMouseLeave: this._onItemMouseLeave, - onMouseDown: function(ev) { - return onItemMouseDown ? onItemMouseDown(item, ev) : undefined; - }, - onMouseMove: this._onItemMouseMove, - href: item.href, - title: item.title, - 'aria-label': ariaLabel, - 'aria-describedby': ariaDescribedByIds, - 'aria-haspopup': itemHasSubmenu || undefined, - 'aria-expanded': itemHasSubmenu ? item.key === expandedMenuItemKey : undefined, - 'aria-posinset': focusableElementIndex + 1, - 'aria-setsize': totalItemCount, - 'aria-disabled': (0, _index.isItemDisabled)(item), - 'aria-checked': (itemRole === 'menuitemcheckbox' || itemRole === 'menuitemradio') && canCheck ? !!isChecked : undefined, - 'aria-selected': itemRole === 'menuitem' && canCheck ? !!isChecked : undefined, - role: itemRole, - // eslint-disable-next-line deprecation/deprecation - style: item.style + _this._openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { + if (shouldFocusOnMount === void 0) { + shouldFocusOnMount = true; + } + if (_this.props.menuProps) { + _this._menuShouldFocusOnContainer = shouldFocusOnContainer; + _this._menuShouldFocusOnMount = shouldFocusOnMount; + _this._renderedVisibleMenu = true; + _this.setState({ menuHidden: false }); + } }; - var keytipProps = item.keytipProps; - if (keytipProps && itemHasSubmenu) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - return _react.createElement((0, _keytipData.KeytipData), { - keytipProps: keytipProps, - ariaDescribedBy: ariaDescribedByIds, - disabled: (0, _index.isItemDisabled)(item) - }, function(keytipAttributes) { - return _react.createElement("button", (0, _tslib.__assign)({ - ref: _this._btn - }, buttonNativeProperties, itemButtonProperties, keytipAttributes), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - componentRef: item.componentRef, - item: item, - classNames: classNames, - index: index, - onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined, - hasIcons: hasIcons, - openSubMenu: openSubMenu, - dismissSubMenu: dismissSubMenu, - dismissMenu: dismissMenu, - getSubmenuTarget: _this._getSubmenuTarget - }, itemProps)), _this._renderAriaDescription(ariaDescription, classNames.screenReaderText)); - }); - }; - return ContextualMenuButton; -}((0, _contextualMenuItemWrapper.ContextualMenuItemWrapper)); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","./ContextualMenuItemWrapper":"1NVzL","../../../KeytipData":"9cfzj","../../../utilities/contextualMenu/index":"lGesq","../ContextualMenuItem":"cJR9f","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"151ms":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuSplitButton", ()=>ContextualMenuSplitButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _contextualMenuItem = require("../ContextualMenuItem"); -var _contextualMenuClassNames = require("../ContextualMenu.classNames"); -var _keytipData = require("../../../KeytipData"); -var _index = require("../../../utilities/contextualMenu/index"); -var _divider = require("../../../Divider"); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -var TouchIdleDelay = 500; /* ms */ -var ContextualMenuSplitButton = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuSplitButton, _super); - function ContextualMenuSplitButton(props) { - var _this = _super.call(this, props) || this; - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); - }); - _this._onItemKeyDown = function(ev) { - var _a = _this.props, item = _a.item, onItemKeyDown = _a.onItemKeyDown; - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).enter) { - _this._executeItemClick(ev); - ev.preventDefault(); - ev.stopPropagation(); - } else if (onItemKeyDown) onItemKeyDown(item, ev); + _this._onToggleMenu = function(shouldFocusOnContainer) { + var shouldFocusOnMount = true; + if (_this.props.menuProps && _this.props.menuProps.shouldFocusOnMount === false) { + shouldFocusOnMount = false; + } + _this.state.menuHidden ? _this._openMenu(shouldFocusOnContainer, shouldFocusOnMount) : _this._dismissMenu(); }; - _this._getSubmenuTarget = function() { - return _this._splitButton; + _this._onSplitContainerFocusCapture = function(ev) { + var container = _this._splitButtonContainer.current; + if (!container || ev.target && portalContainsElement(ev.target, container)) { + return; + } + container.focus(); }; - _this._renderAriaDescription = function(ariaDescription, className) { - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan - return ariaDescription ? _react.createElement("span", { - id: _this._ariaDescriptionId, - className: className - }, ariaDescription) : null; + _this._onSplitButtonPrimaryClick = function(ev) { + if (!_this.state.menuHidden) { + _this._dismissMenu(); + } + var singleTouchTarget = _this._processingTouch && !_this.props.toggle; + if (!singleTouchTarget && _this.props.onClick) { + _this.props.onClick(ev); + } else if (singleTouchTarget) { + _this._onMenuClick(ev); + } }; - _this._onItemMouseEnterPrimary = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseEnter = _a.onItemMouseEnter; - if (onItemMouseEnter) onItemMouseEnter((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - subMenuProps: undefined, - items: undefined - }), ev, _this._splitButton); + _this._onKeyDown = function(ev) { + if (_this.props.disabled && (ev.which === KeyCodes.enter || ev.which === KeyCodes.space)) { + ev.preventDefault(); + ev.stopPropagation(); + } else if (!_this.props.disabled) { + if (_this.props.menuProps) { + _this._onMenuKeyDown(ev); + } else if (_this.props.onKeyDown !== void 0) { + _this.props.onKeyDown(ev); + } + } }; - _this._onItemMouseEnterIcon = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseEnter = _a.onItemMouseEnter; - if (onItemMouseEnter) onItemMouseEnter(item, ev, _this._splitButton); + _this._onKeyUp = function(ev) { + if (!_this.props.disabled && _this.props.onKeyUp !== void 0) { + _this.props.onKeyUp(ev); + } }; - _this._onItemMouseMovePrimary = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseMove = _a.onItemMouseMove; - if (onItemMouseMove) onItemMouseMove((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - subMenuProps: undefined, - items: undefined - }), ev, _this._splitButton); + _this._onKeyPress = function(ev) { + if (!_this.props.disabled && _this.props.onKeyPress !== void 0) { + _this.props.onKeyPress(ev); + } }; - _this._onItemMouseMoveIcon = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseMove = _a.onItemMouseMove; - if (onItemMouseMove) onItemMouseMove(item, ev, _this._splitButton); + _this._onMouseUp = function(ev) { + if (!_this.props.disabled && _this.props.onMouseUp !== void 0) { + _this.props.onMouseUp(ev); + } }; - _this._onIconItemClick = function(ev) { - var _a = _this.props, item = _a.item, onItemClickBase = _a.onItemClickBase; - if (onItemClickBase) onItemClickBase(item, ev, _this._splitButton ? _this._splitButton : ev.currentTarget); + _this._onMouseDown = function(ev) { + if (!_this.props.disabled && _this.props.onMouseDown !== void 0) { + _this.props.onMouseDown(ev); + } }; - _this._executeItemClick = function(ev) { - var _a = _this.props, item = _a.item, executeItemClick = _a.executeItemClick, onItemClick = _a.onItemClick; - if (item.disabled || item.isDisabled) return; - if (_this._processingTouch && !item.canCheck && onItemClick) return onItemClick(item, ev); - if (executeItemClick) executeItemClick(item, ev); + _this._onClick = function(ev) { + if (!_this.props.disabled) { + if (_this.props.menuProps) { + _this._onMenuClick(ev); + } else if (_this.props.onClick !== void 0) { + _this.props.onClick(ev); + } + } }; - _this._onTouchStart = function(ev) { - if (_this._splitButton && !('onpointerdown' in _this._splitButton)) _this._handleTouchAndPointerEvent(ev); + _this._onSplitButtonContainerKeyDown = function(ev) { + if (ev.which === KeyCodes.enter || ev.which === KeyCodes.space) { + if (_this._buttonElement.current) { + _this._buttonElement.current.click(); + ev.preventDefault(); + ev.stopPropagation(); + } + } else { + _this._onMenuKeyDown(ev); + } }; - _this._onPointerDown = function(ev) { - if (ev.pointerType === 'touch') { - _this._handleTouchAndPointerEvent(ev); + _this._onMenuKeyDown = function(ev) { + var _a2; + if (_this.props.disabled) { + return; + } + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + } + var isUp = ev.which === KeyCodes.up; + var isDown = ev.which === KeyCodes.down; + if (!ev.defaultPrevented && _this._isValidMenuOpenKey(ev)) { + var onMenuClick = _this.props.onMenuClick; + if (onMenuClick) { + onMenuClick(ev, _this.props); + } + _this._onToggleMenu(false); + ev.preventDefault(); + ev.stopPropagation(); + } + if (ev.which === KeyCodes.enter || ev.which === KeyCodes.space) { + setFocusVisibility(true, ev.target, (_a2 = _this.context) === null || _a2 === void 0 ? void 0 : _a2.registeredProviders); + } + if (!(ev.altKey || ev.metaKey) && (isUp || isDown)) { + if (!_this.state.menuHidden && _this.props.menuProps) { + var currentShouldFocusOnMount = _this._menuShouldFocusOnMount !== void 0 ? _this._menuShouldFocusOnMount : _this.props.menuProps.shouldFocusOnMount; + if (!currentShouldFocusOnMount) { ev.preventDefault(); - ev.stopImmediatePropagation(); + ev.stopPropagation(); + _this._menuShouldFocusOnMount = true; + _this.forceUpdate(); + } } + } + }; + _this._onTouchStart = function() { + if (_this._isSplitButton && _this._splitButtonContainer.current && !("onpointerdown" in _this._splitButtonContainer.current)) { + _this._handleTouchAndPointerEvent(); + } + }; + _this._onMenuClick = function(ev) { + var _a2 = _this.props, onMenuClick = _a2.onMenuClick, menuProps = _a2.menuProps; + if (onMenuClick) { + onMenuClick(ev, _this.props); + } + var shouldFocusOnContainer = typeof (menuProps === null || menuProps === void 0 ? void 0 : menuProps.shouldFocusOnContainer) === "boolean" ? menuProps.shouldFocusOnContainer : ev.nativeEvent.pointerType === "mouse"; + if (!ev.defaultPrevented) { + _this._onToggleMenu(shouldFocusOnContainer); + ev.preventDefault(); + ev.stopPropagation(); + } + }; + initializeComponentRef(_this); + _this._async = new Async(_this); + _this._events = new EventGroup(_this); + warnConditionallyRequiredProps(COMPONENT_NAME$6, props, ["menuProps", "onClick"], "split", _this.props.split); + _this._labelId = getId(); + _this._descriptionId = getId(); + _this._ariaDescriptionId = getId(); + _this.state = { + menuHidden: true }; - _this._async = new (0, _utilities.Async)(_this); - _this._events = new (0, _utilities.EventGroup)(_this); - _this._dismissLabelId = (0, _utilities.getId)(); return _this; - } - ContextualMenuSplitButton.prototype.componentDidMount = function() { - if (this._splitButton && 'onpointerdown' in this._splitButton) this._events.on(this._splitButton, 'pointerdown', this._onPointerDown, true); - }; - ContextualMenuSplitButton.prototype.componentWillUnmount = function() { + } + Object.defineProperty(BaseButton2.prototype, "_isSplitButton", { + get: function() { + return !!this.props.menuProps && !!this.props.onClick && this.props.split === true; + }, + enumerable: false, + configurable: true + }); + BaseButton2.prototype.render = function() { + var _a2; + var _b2 = this.props, ariaDescription = _b2.ariaDescription, ariaLabel2 = _b2.ariaLabel, ariaHidden = _b2.ariaHidden, className2 = _b2.className, disabled = _b2.disabled, allowDisabledFocus = _b2.allowDisabledFocus, primaryDisabled = _b2.primaryDisabled, _c2 = _b2.secondaryText, secondaryText = _c2 === void 0 ? this.props.description : _c2, href2 = _b2.href, iconProps = _b2.iconProps, menuIconProps = _b2.menuIconProps, styles = _b2.styles, checked = _b2.checked, variantClassName = _b2.variantClassName, theme = _b2.theme, toggle = _b2.toggle, getClassNames2 = _b2.getClassNames, role = _b2.role; + var menuHidden = this.state.menuHidden; + var isPrimaryButtonDisabled = disabled || primaryDisabled; + this._classNames = getClassNames2 ? getClassNames2(theme, className2, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, checked, !menuHidden, !!this.props.menuProps, this.props.split, !!allowDisabledFocus) : getBaseButtonClassNames(theme, styles, className2, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, !!this.props.menuProps, checked, !menuHidden, this.props.split); + var _d2 = this, _ariaDescriptionId = _d2._ariaDescriptionId, _labelId = _d2._labelId, _descriptionId = _d2._descriptionId; + var renderAsAnchor = !isPrimaryButtonDisabled && !!href2; + var tag = renderAsAnchor ? "a" : "button"; + var nativeProps = getNativeProps( + // eslint-disable-next-line @typescript-eslint/no-deprecated + assign(renderAsAnchor ? {} : { type: "button" }, this.props.rootProps, this.props), + renderAsAnchor ? anchorProperties : buttonProperties, + [ + "disabled" + // let disabled buttons be focused and styled as disabled. + ] + ); + var resolvedAriaLabel = ariaLabel2 || nativeProps["aria-label"]; + var ariaDescribedBy = void 0; + if (ariaDescription) { + ariaDescribedBy = _ariaDescriptionId; + } else if (secondaryText && this.props.onRenderDescription !== nullRender) { + ariaDescribedBy = _descriptionId; + } else if (nativeProps["aria-describedby"]) { + ariaDescribedBy = nativeProps["aria-describedby"]; + } + var ariaLabelledBy = void 0; + if (nativeProps["aria-labelledby"]) { + ariaLabelledBy = nativeProps["aria-labelledby"]; + } else if (ariaDescribedBy && !resolvedAriaLabel) { + ariaLabelledBy = this._hasText() ? _labelId : void 0; + } + var dataIsFocusable = this.props["data-is-focusable"] === false || disabled && !allowDisabledFocus || this._isSplitButton ? false : true; + var isCheckboxTypeRole = role === "menuitemcheckbox" || role === "checkbox"; + var checkedOrPressedValue = isCheckboxTypeRole ? !!checked : toggle === true ? !!checked : void 0; + var buttonProps = assign(nativeProps, (_a2 = { + className: this._classNames.root, + // eslint-disable-next-line @typescript-eslint/no-deprecated + ref: this._mergedRef(this.props.elementRef, this._buttonElement), + disabled: isPrimaryButtonDisabled && !allowDisabledFocus, + onKeyDown: this._onKeyDown, + onKeyPress: this._onKeyPress, + onKeyUp: this._onKeyUp, + onMouseDown: this._onMouseDown, + onMouseUp: this._onMouseUp, + onClick: this._onClick, + "aria-label": resolvedAriaLabel, + "aria-labelledby": ariaLabelledBy, + "aria-describedby": ariaDescribedBy, + "aria-disabled": isPrimaryButtonDisabled, + "data-is-focusable": dataIsFocusable + }, // aria-pressed attribute should only be present for toggle buttons + // aria-checked attribute should only be present for toggle buttons with checkbox type role + _a2[isCheckboxTypeRole ? "aria-checked" : "aria-pressed"] = checkedOrPressedValue, _a2)); + if (ariaHidden) { + buttonProps["aria-hidden"] = true; + } + if (this._isSplitButton) { + return this._onRenderSplitButtonContent(tag, buttonProps); + } else if (this.props.menuProps) { + var _e2 = this.props.menuProps.id, id2 = _e2 === void 0 ? "".concat(this._labelId, "-menu") : _e2; + assign(buttonProps, { + "aria-expanded": !menuHidden, + "aria-controls": !menuHidden ? id2 : null, + "aria-haspopup": true + }); + } + return this._onRenderContent(tag, buttonProps); + }; + BaseButton2.prototype.componentDidMount = function() { + if (this._isSplitButton && this._splitButtonContainer.current) { + if ("onpointerdown" in this._splitButtonContainer.current) { + this._events.on(this._splitButtonContainer.current, "pointerdown", this._onPointerDown, true); + } + if ("onpointerup" in this._splitButtonContainer.current && this.props.onPointerUp) { + this._events.on(this._splitButtonContainer.current, "pointerup", this.props.onPointerUp, true); + } + } + }; + BaseButton2.prototype.componentDidUpdate = function(prevProps, prevState) { + if (this.props.onAfterMenuDismiss && !prevState.menuHidden && this.state.menuHidden) { + this.props.onAfterMenuDismiss(); + } + }; + BaseButton2.prototype.componentWillUnmount = function() { this._async.dispose(); this._events.dispose(); - }; - ContextualMenuSplitButton.prototype.render = function() { + }; + BaseButton2.prototype.focus = function() { + var _a2, _b2; + if (this._isSplitButton && this._splitButtonContainer.current) { + setFocusVisibility(true, void 0, (_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.registeredProviders); + this._splitButtonContainer.current.focus(); + } else if (this._buttonElement.current) { + setFocusVisibility(true, void 0, (_b2 = this.context) === null || _b2 === void 0 ? void 0 : _b2.registeredProviders); + this._buttonElement.current.focus(); + } + }; + BaseButton2.prototype.dismissMenu = function() { + this._dismissMenu(); + }; + BaseButton2.prototype.openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { + this._openMenu(shouldFocusOnContainer, shouldFocusOnMount); + }; + BaseButton2.prototype._onRenderContent = function(tag, buttonProps) { var _this = this; - var _a; - var _b = this.props, item = _b.item, classNames = _b.classNames, index = _b.index, focusableElementIndex = _b.focusableElementIndex, totalItemCount = _b.totalItemCount, hasCheckmarks = _b.hasCheckmarks, hasIcons = _b.hasIcons, onItemMouseLeave = _b.onItemMouseLeave, expandedMenuItemKey = _b.expandedMenuItemKey; - var itemHasSubmenu = (0, _index.hasSubmenu)(item); - var keytipProps = item.keytipProps; - if (keytipProps) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - // Check for ariaDescription to set the _ariaDescriptionId and render a hidden span with - // the description in it to be added to ariaDescribedBy - var ariaDescription = item.ariaDescription; - if (ariaDescription) this._ariaDescriptionId = (0, _utilities.getId)(); - var ariaChecked = (_a = (0, _index.getIsChecked)(item)) !== null && _a !== void 0 ? _a : undefined; - return _react.createElement((0, _keytipData.KeytipData), { - keytipProps: keytipProps, - disabled: (0, _index.isItemDisabled)(item) - }, function(keytipAttributes) { - return _react.createElement("div", { - "data-ktp-target": keytipAttributes['data-ktp-target'], - ref: function(splitButton) { - return _this._splitButton = splitButton; - }, - role: (0, _index.getMenuItemAriaRole)(item), - "aria-label": item.ariaLabel, - className: classNames.splitContainer, - "aria-disabled": (0, _index.isItemDisabled)(item), - "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : undefined, - "aria-haspopup": true, - "aria-describedby": (0, _utilities.mergeAriaAttributeValues)(item.ariaDescribedBy, ariaDescription ? _this._ariaDescriptionId : undefined, keytipAttributes['aria-describedby']), - "aria-checked": ariaChecked, - "aria-posinset": focusableElementIndex + 1, - "aria-setsize": totalItemCount, - onMouseEnter: _this._onItemMouseEnterPrimary, - onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(_this, (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - subMenuProps: null, - items: null - })) : undefined, - onMouseMove: _this._onItemMouseMovePrimary, - onKeyDown: _this._onItemKeyDown, - onClick: _this._executeItemClick, - onTouchStart: _this._onTouchStart, - tabIndex: 0, - "data-is-focusable": true, - "aria-roledescription": item['aria-roledescription'] - }, _this._renderSplitPrimaryButton(item, classNames, index, hasCheckmarks, hasIcons), _this._renderSplitDivider(item), _this._renderSplitIconButton(item, classNames, index, keytipAttributes), _this._renderAriaDescription(ariaDescription, classNames.screenReaderText)); - }); - }; - ContextualMenuSplitButton.prototype._renderSplitPrimaryButton = function(item, // eslint-disable-next-line deprecation/deprecation - classNames, index, hasCheckmarks, hasIcons) { - var _a = this.props, _b = _a.contextualMenuItemAs, ChildrenRenderer = _b === void 0 ? (0, _contextualMenuItem.ContextualMenuItem) : _b, onItemClick = _a.onItemClick; - var itemProps = { - key: item.key, - disabled: (0, _index.isItemDisabled)(item) || item.primaryDisabled, - /* eslint-disable deprecation/deprecation */ name: item.name, - text: item.text || item.name, - secondaryText: item.secondaryText, - /* eslint-enable deprecation/deprecation */ className: classNames.splitPrimary, - canCheck: item.canCheck, - isChecked: item.isChecked, - checked: item.checked, - iconProps: item.iconProps, - id: this._dismissLabelId, - onClick: item.onClick, - onRenderIcon: item.onRenderIcon, - data: item.data, - 'data-is-focusable': false - }; - var itemComponentProps = item.itemProps; - return _react.createElement("button", (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(itemProps, (0, _utilities.buttonProperties))), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - "data-is-focusable": false, - item: itemProps, - classNames: classNames, - index: index, - onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined, - hasIcons: hasIcons - }, itemComponentProps))); - }; - ContextualMenuSplitButton.prototype._renderSplitDivider = function(item) { - var getDividerClassNames = item.getSplitButtonVerticalDividerClassNames || (0, _contextualMenuClassNames.getSplitButtonVerticalDividerClassNames); - return _react.createElement((0, _divider.VerticalDivider), { - getClassNames: getDividerClassNames - }); - }; - ContextualMenuSplitButton.prototype._renderSplitIconButton = function(item, classNames, index, keytipAttributes) { - var _a = this.props, onItemMouseLeave = _a.onItemMouseLeave, onItemMouseDown = _a.onItemMouseDown, openSubMenu = _a.openSubMenu, dismissSubMenu = _a.dismissSubMenu, dismissMenu = _a.dismissMenu; - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (this.props.item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.item.contextualMenuItemAs, ChildrenRenderer); - if (this.props.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.contextualMenuItemAs, ChildrenRenderer); - var itemProps = { - onClick: this._onIconItemClick, - disabled: (0, _index.isItemDisabled)(item), - className: classNames.splitMenu, - subMenuProps: item.subMenuProps, - submenuIconProps: item.submenuIconProps, - split: true, - key: item.key, - 'aria-labelledby': this._dismissLabelId - }; - var buttonProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(itemProps, (0, _utilities.buttonProperties))), { - onMouseEnter: this._onItemMouseEnterIcon, - onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(this, item) : undefined, - onMouseDown: function(ev) { - return onItemMouseDown ? onItemMouseDown(item, ev) : undefined; - }, - onMouseMove: this._onItemMouseMoveIcon, - 'data-is-focusable': false, - 'data-ktp-execute-target': keytipAttributes['data-ktp-execute-target'], - 'aria-haspopup': true + var props = this.props; + var Tag = tag; + var menuIconProps = props.menuIconProps, menuProps = props.menuProps, _a2 = props.onRenderIcon, onRenderIcon = _a2 === void 0 ? this._onRenderIcon : _a2, _b2 = props.onRenderAriaDescription, onRenderAriaDescription = _b2 === void 0 ? this._onRenderAriaDescription : _b2, _c2 = props.onRenderChildren, onRenderChildren = _c2 === void 0 ? this._onRenderChildren : _c2, _d2 = props.onRenderMenu, onRenderMenu = _d2 === void 0 ? this._onRenderMenu : _d2, _e2 = props.onRenderMenuIcon, onRenderMenuIcon = _e2 === void 0 ? this._onRenderMenuIcon : _e2, disabled = props.disabled; + var keytipProps = props.keytipProps; + if (keytipProps && menuProps) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + var Button2 = function(keytipAttributes) { + return React__namespace.createElement( + Tag, + __assign$1({}, buttonProps, keytipAttributes), + React__namespace.createElement( + "span", + { className: _this._classNames.flexContainer, "data-automationid": "splitbuttonprimary" }, + onRenderIcon(props, _this._onRenderIcon), + _this._onRenderTextContents(), + onRenderAriaDescription(props, _this._onRenderAriaDescription), + onRenderChildren(props, _this._onRenderChildren), + !_this._isSplitButton && (menuProps || menuIconProps || _this.props.onRenderMenuIcon) && onRenderMenuIcon(_this.props, _this._onRenderMenuIcon), + menuProps && !menuProps.doNotLayer && _this._shouldRenderMenu() && onRenderMenu(_this._getMenuProps(menuProps), _this._onRenderMenu) + ) + ); + }; + var Content = keytipProps ? ( + // If we're making a split button, we won't put the keytip here + React__namespace.createElement(KeytipData, { keytipProps: !this._isSplitButton ? keytipProps : void 0, ariaDescribedBy: buttonProps["aria-describedby"], disabled }, function(keytipAttributes) { + return Button2(keytipAttributes); + }) + ) : Button2(); + if (menuProps && menuProps.doNotLayer) { + return React__namespace.createElement( + React__namespace.Fragment, + null, + Content, + this._shouldRenderMenu() && onRenderMenu(this._getMenuProps(menuProps), this._onRenderMenu) + ); + } + return React__namespace.createElement( + React__namespace.Fragment, + null, + Content, + React__namespace.createElement(FocusRects, null) + ); + }; + BaseButton2.prototype._shouldRenderMenu = function() { + var menuHidden = this.state.menuHidden; + var _a2 = this.props, persistMenu = _a2.persistMenu, renderPersistedMenuHiddenOnMount = _a2.renderPersistedMenuHiddenOnMount; + if (!menuHidden) { + return true; + } else if (persistMenu && (this._renderedVisibleMenu || renderPersistedMenuHiddenOnMount)) { + return true; + } + return false; + }; + BaseButton2.prototype._hasText = function() { + return this.props.text !== null && (this.props.text !== void 0 || typeof this.props.children === "string"); + }; + BaseButton2.prototype._getMenuProps = function(menuProps) { + var persistMenu = this.props.persistMenu; + var menuHidden = this.state.menuHidden; + if (!menuProps.ariaLabel && !menuProps.labelElementId && this._hasText()) { + menuProps = __assign$1(__assign$1({}, menuProps), { labelElementId: this._labelId }); + } + return __assign$1(__assign$1({ id: this._labelId + "-menu", directionalHint: DirectionalHint.bottomLeftEdge }, menuProps), { shouldFocusOnContainer: this._menuShouldFocusOnContainer, shouldFocusOnMount: this._menuShouldFocusOnMount, hidden: persistMenu ? menuHidden : void 0, className: css("ms-BaseButton-menuhost", menuProps.className), target: this._isSplitButton ? this._splitButtonContainer.current : this._buttonElement.current, onDismiss: this._onDismissMenu }); + }; + BaseButton2.prototype._onRenderSplitButtonContent = function(tag, buttonProps) { + var _this = this; + var _a2 = this.props, _b2 = _a2.styles, styles = _b2 === void 0 ? {} : _b2, disabled = _a2.disabled, allowDisabledFocus = _a2.allowDisabledFocus, checked = _a2.checked, getSplitButtonClassNames$1 = _a2.getSplitButtonClassNames, primaryDisabled = _a2.primaryDisabled, menuProps = _a2.menuProps, toggle = _a2.toggle, role = _a2.role, primaryActionButtonProps = _a2.primaryActionButtonProps; + var keytipProps = this.props.keytipProps; + var menuHidden = this.state.menuHidden; + var classNames2 = getSplitButtonClassNames$1 ? getSplitButtonClassNames$1(!!disabled, !menuHidden, !!checked, !!allowDisabledFocus) : styles && getSplitButtonClassNames(styles, !!disabled, !menuHidden, !!checked, !!primaryDisabled); + assign(buttonProps, { + onClick: void 0, + onPointerDown: void 0, + onPointerUp: void 0, + tabIndex: -1, + "data-is-focusable": false }); - var itemComponentProps = item.itemProps; - return _react.createElement("button", (0, _tslib.__assign)({}, buttonProps), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - componentRef: item.componentRef, - item: itemProps, - classNames: classNames, - index: index, - hasIcons: false, - openSubMenu: openSubMenu, - dismissSubMenu: dismissSubMenu, - dismissMenu: dismissMenu, - getSubmenuTarget: this._getSubmenuTarget - }, itemComponentProps))); - }; - ContextualMenuSplitButton.prototype._handleTouchAndPointerEvent = function(ev) { + if (keytipProps && menuProps) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + var containerProps = getNativeProps(buttonProps, [], ["disabled"]); + if (primaryActionButtonProps) { + assign(buttonProps, primaryActionButtonProps); + } + var SplitButton = function(keytipAttributes) { + return React__namespace.createElement( + "div", + __assign$1({}, containerProps, { "data-ktp-target": keytipAttributes ? keytipAttributes["data-ktp-target"] : void 0, role: role ? role : "button", "aria-disabled": disabled, "aria-haspopup": true, "aria-expanded": !menuHidden, "aria-pressed": toggle ? !!checked : void 0, "aria-describedby": mergeAriaAttributeValues(buttonProps["aria-describedby"], keytipAttributes ? keytipAttributes["aria-describedby"] : void 0), className: classNames2 && classNames2.splitButtonContainer, onKeyDown: _this._onSplitButtonContainerKeyDown, onTouchStart: _this._onTouchStart, ref: _this._splitButtonContainer, "data-is-focusable": true, onClick: !disabled && !primaryDisabled ? _this._onSplitButtonPrimaryClick : void 0, tabIndex: !disabled && !primaryDisabled || allowDisabledFocus ? 0 : void 0, "aria-roledescription": buttonProps["aria-roledescription"], onFocusCapture: _this._onSplitContainerFocusCapture }), + React__namespace.createElement( + "span", + { style: { display: "flex", width: "100%" } }, + _this._onRenderContent(tag, buttonProps), + _this._onRenderSplitButtonMenuButton(classNames2, keytipAttributes), + _this._onRenderSplitButtonDivider(classNames2) + ) + ); + }; + return keytipProps ? React__namespace.createElement(KeytipData, { keytipProps, disabled }, function(keytipAttributes) { + return SplitButton(keytipAttributes); + }) : SplitButton(); + }; + BaseButton2.prototype._onRenderSplitButtonDivider = function(classNames2) { + if (classNames2 && classNames2.divider) { + var onClick = function(ev) { + ev.stopPropagation(); + }; + return React__namespace.createElement("span", { className: classNames2.divider, "aria-hidden": true, onClick }); + } + return null; + }; + BaseButton2.prototype._onRenderSplitButtonMenuButton = function(classNames2, keytipAttributes) { + var _a2 = this.props, allowDisabledFocus = _a2.allowDisabledFocus, checked = _a2.checked, disabled = _a2.disabled, splitButtonMenuProps = _a2.splitButtonMenuProps, splitButtonAriaLabel = _a2.splitButtonAriaLabel, primaryDisabled = _a2.primaryDisabled; + var menuHidden = this.state.menuHidden; + var menuIconProps = this.props.menuIconProps; + if (menuIconProps === void 0) { + menuIconProps = { + iconName: "ChevronDown" + }; + } + var splitButtonProps = __assign$1(__assign$1({}, splitButtonMenuProps), { styles: classNames2, checked, disabled, allowDisabledFocus, onClick: this._onMenuClick, menuProps: void 0, iconProps: __assign$1(__assign$1({}, menuIconProps), { className: this._classNames.menuIcon }), ariaLabel: splitButtonAriaLabel, "aria-haspopup": true, "aria-expanded": !menuHidden, "data-is-focusable": false }); + return React__namespace.createElement(BaseButton2, __assign$1({}, splitButtonProps, { "data-ktp-execute-target": keytipAttributes ? keytipAttributes["data-ktp-execute-target"] : keytipAttributes, onMouseDown: this._onMouseDown, tabIndex: primaryDisabled && !allowDisabledFocus ? 0 : -1 })); + }; + BaseButton2.prototype._onPointerDown = function(ev) { + var onPointerDown = this.props.onPointerDown; + if (onPointerDown) { + onPointerDown(ev); + } + if (ev.pointerType === "touch") { + this._handleTouchAndPointerEvent(); + ev.preventDefault(); + ev.stopImmediatePropagation(); + } + }; + BaseButton2.prototype._handleTouchAndPointerEvent = function() { var _this = this; - var onTap = this.props.onTap; - if (onTap) onTap(ev); - // If we already have an existing timeout from a previous touch/pointer event - // cancel that timeout so we can set a new one. - if (this._lastTouchTimeoutId) { - this._async.clearTimeout(this._lastTouchTimeoutId); - this._lastTouchTimeoutId = undefined; + if (this._lastTouchTimeoutId !== void 0) { + this._async.clearTimeout(this._lastTouchTimeoutId); + this._lastTouchTimeoutId = void 0; } this._processingTouch = true; this._lastTouchTimeoutId = this._async.setTimeout(function() { - _this._processingTouch = false; - _this._lastTouchTimeoutId = undefined; - }, TouchIdleDelay); - }; - return ContextualMenuSplitButton; -}((0, _contextualMenuItemWrapper.ContextualMenuItemWrapper)); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","../ContextualMenuItem":"cJR9f","../ContextualMenu.classNames":"bg3cO","../../../KeytipData":"9cfzj","../../../utilities/contextualMenu/index":"lGesq","../../../Divider":"dWBx3","./ContextualMenuItemWrapper":"1NVzL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dWBx3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Divider/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Divider/index":"8vweJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8vweJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _verticalDivider = require("./VerticalDivider"); -parcelHelpers.exportAll(_verticalDivider, exports); -var _verticalDividerTypes = require("./VerticalDivider.types"); -parcelHelpers.exportAll(_verticalDividerTypes, exports); - -},{"./VerticalDivider":"aZ5tF","./VerticalDivider.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aZ5tF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VerticalDivider", ()=>VerticalDivider); -var _verticalDividerStyles = require("./VerticalDivider.styles"); -var _verticalDividerBase = require("./VerticalDivider.base"); -var _utilities = require("../../Utilities"); -var VerticalDivider = (0, _utilities.styled)((0, _verticalDividerBase.VerticalDividerBase), (0, _verticalDividerStyles.getStyles), undefined, { - scope: 'VerticalDivider' -}); - -},{"./VerticalDivider.styles":"fK5e0","./VerticalDivider.base":"dEzWL","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fK5e0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var getStyles = function(props) { - // eslint-disable-next-line deprecation/deprecation - var theme = props.theme, getClassNames = props.getClassNames, className = props.className; - if (!theme) throw new Error('Theme is undefined or null.'); - if (getClassNames) { - var names = getClassNames(theme); - return { - wrapper: [ - names.wrapper - ], - divider: [ - names.divider - ] - }; - } - return { - wrapper: [ - { - display: 'inline-flex', - height: '100%', - alignItems: 'center' - }, - className - ], - divider: [ - { - width: 1, - height: '100%', - backgroundColor: theme.palette.neutralTertiaryAlt - } - ] - }; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dEzWL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VerticalDividerBase", ()=>VerticalDividerBase); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var VerticalDividerBase = _react.forwardRef(function(props, ref) { - // eslint-disable-next-line deprecation/deprecation - var styles = props.styles, theme = props.theme, deprecatedGetClassNames = props.getClassNames, className = props.className; - var classNames = getClassNames(styles, { - theme: theme, - getClassNames: deprecatedGetClassNames, - className: className - }); - return _react.createElement("span", { - className: classNames.wrapper, - ref: ref - }, _react.createElement("span", { - className: classNames.divider - })); -}); -VerticalDividerBase.displayName = 'VerticalDividerBase'; - -},{"react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cFpqz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _useResponsiveMode = require("./utilities/hooks/useResponsiveMode"); -parcelHelpers.exportAll(_useResponsiveMode, exports); -var _withResponsiveMode = require("./utilities/decorators/withResponsiveMode"); -parcelHelpers.exportAll(_withResponsiveMode, exports); - -},{"./utilities/hooks/useResponsiveMode":"3CcPR","./utilities/decorators/withResponsiveMode":"3hIIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3CcPR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useResponsiveMode", ()=>useResponsiveMode); -var _react = require("react"); -var _utilities = require("@fluentui/utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _withResponsiveMode = require("../decorators/withResponsiveMode"); -var _windowProvider = require("../../WindowProvider"); -var useResponsiveMode = function(elementRef, overrideResponsiveMode) { - var _a = _react.useState((0, _withResponsiveMode.getInitialResponsiveMode)()), lastResponsiveMode = _a[0], setLastResponsiveMode = _a[1]; - var onResize = _react.useCallback(function() { - var newResponsiveMode = (0, _withResponsiveMode.getResponsiveMode)((0, _utilities.getWindow)(elementRef.current)); - // Setting the same value should not cause a re-render. - if (lastResponsiveMode !== newResponsiveMode) setLastResponsiveMode(newResponsiveMode); - }, [ - elementRef, - lastResponsiveMode - ]); - var win = (0, _windowProvider.useWindow)(); - (0, _reactHooks.useOnEvent)(win, 'resize', onResize); - // Call resize function initially on mount, or if the override changes from defined to undefined - // (the effect will run on all override changes, but onResize will only be called if it changed to undefined) - _react.useEffect(function() { - if (overrideResponsiveMode === undefined) onResize(); - // eslint-disable-next-line react-hooks/exhaustive-deps -- only meant to run on mount or when override changes - }, [ - overrideResponsiveMode - ]); - return overrideResponsiveMode !== null && overrideResponsiveMode !== void 0 ? overrideResponsiveMode : lastResponsiveMode; -}; - -},{"react":"jGrId","@fluentui/utilities":"55bj3","@fluentui/react-hooks":"2LHjM","../decorators/withResponsiveMode":"3hIIg","../../WindowProvider":"diLL7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3hIIg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ResponsiveMode", ()=>ResponsiveMode); -/** - * Allows a server rendered scenario to provide a **default** responsive mode. - * This WILL NOT trigger any updates to components that have already consumed the responsive mode! - */ parcelHelpers.export(exports, "setResponsiveMode", ()=>setResponsiveMode); -/** - * Initializes the responsive mode to the current window size. This can be used to avoid - * a re-render during first component mount since the window would otherwise not be measured - * until after mounting. - * - * This WILL NOT trigger any updates to components that have already consumed the responsive mode! - */ parcelHelpers.export(exports, "initializeResponsiveMode", ()=>initializeResponsiveMode); -parcelHelpers.export(exports, "getInitialResponsiveMode", ()=>getInitialResponsiveMode); -/** - * @deprecated Decorator usage is deprecated. Either call `getResponsiveMode` manually, or - * use the `useResponsiveMode` hook within a function component. - */ parcelHelpers.export(exports, "withResponsiveMode", ()=>withResponsiveMode); -/** - * Hook to get the current responsive mode (window size category). - * @param currentWindow - Use this window when determining the responsive mode. - */ parcelHelpers.export(exports, "getResponsiveMode", ()=>getResponsiveMode); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseDecorator = require("./BaseDecorator"); -var _utilities = require("../../Utilities"); -var _windowProvider = require("../../WindowProvider"); -var ResponsiveMode; -(function(ResponsiveMode) { - /** Width \<= 479px */ ResponsiveMode[ResponsiveMode["small"] = 0] = "small"; - /** Width \> 479px and \<= 639px */ ResponsiveMode[ResponsiveMode["medium"] = 1] = "medium"; - /** Width \> 639px and \<= 1023px */ ResponsiveMode[ResponsiveMode["large"] = 2] = "large"; - /** Width \> 1023px and \<= 1365px */ ResponsiveMode[ResponsiveMode["xLarge"] = 3] = "xLarge"; - /** Width \> 1365px and \<= 1919px */ ResponsiveMode[ResponsiveMode["xxLarge"] = 4] = "xxLarge"; - /** Width \> 1919px */ ResponsiveMode[ResponsiveMode["xxxLarge"] = 5] = "xxxLarge"; - ResponsiveMode[ResponsiveMode["unknown"] = 999] = "unknown"; -})(ResponsiveMode || (ResponsiveMode = {})); -var RESPONSIVE_MAX_CONSTRAINT = [ - 479, - 639, - 1023, - 1365, - 1919, - 99999999 -]; -/** - * User specified mode to default to, useful for server side rendering scenarios. - */ var _defaultMode; -/** - * Tracking the last mode we successfully rendered, which allows us to - * paint initial renders with the correct size. - */ var _lastMode; -function setResponsiveMode(responsiveMode) { - _defaultMode = responsiveMode; -} -function initializeResponsiveMode(element) { - var currentWindow = (0, _utilities.getWindow)(element); - if (currentWindow) getResponsiveMode(currentWindow); -} -function getInitialResponsiveMode() { - var _a; - return (_a = _defaultMode !== null && _defaultMode !== void 0 ? _defaultMode : _lastMode) !== null && _a !== void 0 ? _a : ResponsiveMode.large; -} -function withResponsiveMode(ComposedComponent) { - var _a; - // eslint-disable-next-line deprecation/deprecation - var resultClass = (_a = /** @class */ function(_super) { - (0, _tslib.__extends)(WithResponsiveMode, _super); - function WithResponsiveMode(props) { - var _this = _super.call(this, props) || this; - _this._onResize = function() { - var responsiveMode = getResponsiveMode(_this.context.window); - if (responsiveMode !== _this.state.responsiveMode) _this.setState({ - responsiveMode: responsiveMode - }); - }; - _this._events = new (0, _utilities.EventGroup)(_this); - _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); - _this.state = { - responsiveMode: getInitialResponsiveMode() - }; - return _this; - } - WithResponsiveMode.prototype.componentDidMount = function() { - this._events.on(this.context.window, 'resize', this._onResize); - this._onResize(); - }; - WithResponsiveMode.prototype.componentWillUnmount = function() { - this._events.dispose(); - }; - WithResponsiveMode.prototype.render = function() { - var responsiveMode = this.state.responsiveMode; - return responsiveMode === ResponsiveMode.unknown ? null : _react.createElement(ComposedComponent, (0, _tslib.__assign)({ - ref: this._updateComposedComponentRef, - responsiveMode: responsiveMode - }, this.props)); - }; - return WithResponsiveMode; - }((0, _baseDecorator.BaseDecorator)), _a.contextType = (0, _windowProvider.WindowContext), _a); - return (0, _utilities.hoistStatics)(ComposedComponent, resultClass); -} -function getWidthOfCurrentWindow(currentWindow) { - try { - return currentWindow.document.documentElement.clientWidth; - } catch (e) { - return currentWindow.innerWidth; - } -} -function getResponsiveMode(currentWindow) { - var responsiveMode = ResponsiveMode.small; - if (currentWindow) { - try { - while(getWidthOfCurrentWindow(currentWindow) > RESPONSIVE_MAX_CONSTRAINT[responsiveMode])responsiveMode++; - } catch (e) { - // Return a best effort result in cases where we're in the browser but it throws on getting innerWidth. - responsiveMode = getInitialResponsiveMode(); + _this._processingTouch = false; + _this._lastTouchTimeoutId = void 0; + if (_this.state.menuHidden) { + _this.focus(); + } + }, TouchIdleDelay$1); + }; + BaseButton2.prototype._isValidMenuOpenKey = function(ev) { + if (this.props.menuTriggerKeyCode) { + return ev.which === this.props.menuTriggerKeyCode; + } else if (this.props.menuProps) { + return ev.which === KeyCodes.down && (ev.altKey || ev.metaKey); } - // Tracking last mode just gives us a better default in future renders, - // which avoids starting with the wrong value if we've measured once. - _lastMode = responsiveMode; - } else { - if (_defaultMode !== undefined) responsiveMode = _defaultMode; - else throw new Error("Content was rendered in a server environment without providing a default responsive mode. Call setResponsiveMode to define what the responsive mode is."); - } - return responsiveMode; -} - -},{"tslib":"9gizs","react":"jGrId","./BaseDecorator":"eoH6o","../../Utilities":"1NZCy","../../WindowProvider":"diLL7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eoH6o":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BaseDecorator", ()=>BaseDecorator); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var BaseDecorator = /** @class */ function(_super) { - (0, _tslib.__extends)(BaseDecorator, _super); - function BaseDecorator(props) { - var _this = _super.call(this, props) || this; - _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); - return _this; - } - /** - * Updates the ref to the component composed by the decorator, which will also take care of hoisting - * (and unhoisting as appropriate) methods from said component. - * - * Pass this method as the argument to the 'ref' property of the composed component. - */ BaseDecorator.prototype._updateComposedComponentRef = function(composedComponentInstance) { - this._composedComponentInstance = composedComponentInstance; - if (composedComponentInstance) this._hoisted = (0, _utilities.hoistMethods)(this, composedComponentInstance); - else if (this._hoisted) (0, _utilities.unhoistMethods)(this, this._hoisted); - }; - return BaseDecorator; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"diLL7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "WindowContext", ()=>(0, _reactWindowProvider.WindowContext)); -parcelHelpers.export(exports, "WindowProvider", ()=>(0, _reactWindowProvider.WindowProvider)); -parcelHelpers.export(exports, "useDocument", ()=>(0, _reactWindowProvider.useDocument)); -parcelHelpers.export(exports, "useWindow", ()=>(0, _reactWindowProvider.useWindow)); -var _version = require("./version"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); - -},{"./version":"6kzFC","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l3bQw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _menuContext = require("./MenuContext"); -parcelHelpers.exportAll(_menuContext, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./MenuContext":"gFd9B","./types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gFd9B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MenuContext", ()=>MenuContext); -parcelHelpers.export(exports, "useMenuContext", ()=>useMenuContext); -var _react = require("react"); -var MenuContext = _react.createContext({}); -var useMenuContext = function() { - return _react.useContext(MenuContext); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ouID":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var _contextualMenuCnstyles = require("./ContextualMenu.cnstyles"); -var GlobalClassNames = { - root: 'ms-ContextualMenu', - container: 'ms-ContextualMenu-container', - list: 'ms-ContextualMenu-list', - header: 'ms-ContextualMenu-header', - title: 'ms-ContextualMenu-title', - isopen: 'is-open' -}; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var fonts = theme.fonts, semanticColors = theme.semanticColors, effects = theme.effects; - return { - root: [ - theme.fonts.medium, - classNames.root, - classNames.isopen, - { - backgroundColor: semanticColors.menuBackground, - minWidth: '180px' - }, - className - ], - container: [ - classNames.container, - { - selectors: { - ':focus': { - outline: 0 - } - } - } - ], - list: [ - classNames.list, - classNames.isopen, - { - listStyleType: 'none', - margin: '0', - padding: '0' - } - ], - header: [ - classNames.header, - fonts.small, - { - fontWeight: (0, _styling.FontWeights).semibold, - color: semanticColors.menuHeader, - background: 'none', - backgroundColor: 'transparent', - border: 'none', - height: (0, _contextualMenuCnstyles.CONTEXTUAL_MENU_ITEM_HEIGHT), - lineHeight: (0, _contextualMenuCnstyles.CONTEXTUAL_MENU_ITEM_HEIGHT), - cursor: 'default', - padding: '0px 6px', - userSelect: 'none', - textAlign: 'left' - } - ], - title: [ - classNames.title, - { - fontSize: fonts.mediumPlus.fontSize, - paddingRight: '14px', - paddingLeft: '14px', - paddingBottom: '5px', - paddingTop: '5px', - backgroundColor: semanticColors.menuItemBackgroundPressed - } - ], - subComponentStyles: { - callout: { - root: { - boxShadow: effects.elevation8 - } - }, - menuItem: {} - } - }; -}; - -},{"../../Styling":"hTimn","./ContextualMenu.cnstyles":"ktzsg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2b9yc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ButtonGlobalClassNames", ()=>ButtonGlobalClassNames); -parcelHelpers.export(exports, "getBaseButtonClassNames", ()=>getBaseButtonClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var ButtonGlobalClassNames = { - msButton: 'ms-Button', - msButtonHasMenu: 'ms-Button--hasMenu', - msButtonIcon: 'ms-Button-icon', - msButtonMenuIcon: 'ms-Button-menuIcon', - msButtonLabel: 'ms-Button-label', - msButtonDescription: 'ms-Button-description', - msButtonScreenReaderText: 'ms-Button-screenReaderText', - msButtonFlexContainer: 'ms-Button-flexContainer', - msButtonTextContainer: 'ms-Button-textContainer' -}; -var getBaseButtonClassNames = (0, _utilities.memoizeFunction)(function(theme, styles, className, variantClassName, iconClassName, menuIconClassName, disabled, hasMenu, checked, expanded, isSplit) { - var _a, _b; - var classNames = (0, _styling.getGlobalClassNames)(ButtonGlobalClassNames, theme || {}); - var isExpanded = expanded && !isSplit; - return (0, _styling.mergeStyleSets)(styles.__shadowConfig__, { - root: [ - classNames.msButton, - styles.root, - variantClassName, - checked && [ - 'is-checked', - styles.rootChecked - ], - isExpanded && [ - 'is-expanded', - styles.rootExpanded, - (_a = {}, _a[":hover .".concat(classNames.msButtonIcon)] = styles.iconExpandedHovered, // menuIcon falls back to rootExpandedHovered to support original behavior - _a[":hover .".concat(classNames.msButtonMenuIcon)] = styles.menuIconExpandedHovered || styles.rootExpandedHovered, _a[':hover'] = styles.rootExpandedHovered, _a) - ], - hasMenu && [ - ButtonGlobalClassNames.msButtonHasMenu, - styles.rootHasMenu - ], - disabled && [ - 'is-disabled', - styles.rootDisabled - ], - !disabled && !isExpanded && !checked && (_b = { - ':hover': styles.rootHovered - }, _b[":hover .".concat(classNames.msButtonLabel)] = styles.labelHovered, _b[":hover .".concat(classNames.msButtonIcon)] = styles.iconHovered, _b[":hover .".concat(classNames.msButtonDescription)] = styles.descriptionHovered, _b[":hover .".concat(classNames.msButtonMenuIcon)] = styles.menuIconHovered, _b[':focus'] = styles.rootFocused, _b[':active'] = styles.rootPressed, _b[":active .".concat(classNames.msButtonIcon)] = styles.iconPressed, _b[":active .".concat(classNames.msButtonDescription)] = styles.descriptionPressed, _b[":active .".concat(classNames.msButtonMenuIcon)] = styles.menuIconPressed, _b), - disabled && checked && [ - styles.rootCheckedDisabled - ], - !disabled && checked && { - ':hover': styles.rootCheckedHovered, - ':active': styles.rootCheckedPressed - }, - className - ], - flexContainer: [ - classNames.msButtonFlexContainer, - styles.flexContainer - ], - textContainer: [ - classNames.msButtonTextContainer, - styles.textContainer - ], - icon: [ - classNames.msButtonIcon, - iconClassName, - styles.icon, - isExpanded && styles.iconExpanded, - checked && styles.iconChecked, - disabled && styles.iconDisabled - ], - label: [ - classNames.msButtonLabel, - styles.label, - checked && styles.labelChecked, - disabled && styles.labelDisabled - ], - menuIcon: [ - classNames.msButtonMenuIcon, - menuIconClassName, - styles.menuIcon, - checked && styles.menuIconChecked, - disabled && !isSplit && styles.menuIconDisabled, - !disabled && !isExpanded && !checked && { - ':hover': styles.menuIconHovered, - ':active': styles.menuIconPressed - }, - isExpanded && [ - 'is-expanded', - styles.menuIconExpanded - ] - ], - description: [ - classNames.msButtonDescription, - styles.description, - checked && styles.descriptionChecked, - disabled && styles.descriptionDisabled - ], - screenReaderText: [ - classNames.msButtonScreenReaderText, - styles.screenReaderText - ] - }); -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8sJhS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SplitButtonGlobalClassNames", ()=>SplitButtonGlobalClassNames); -parcelHelpers.export(exports, "getSplitButtonClassNames", ()=>getSplitButtonClassNames); -var _utilities = require("../../../Utilities"); -var _styling = require("../../../Styling"); -var SplitButtonGlobalClassNames = { - msSplitButtonDivider: 'ms-SplitButton-divider' -}; -var getSplitButtonClassNames = (0, _utilities.memoizeFunction)(function(styles, disabled, expanded, checked, primaryDisabled) { - return { - root: (0, _styling.mergeStyles)(styles.splitButtonMenuButton, expanded && [ - styles.splitButtonMenuButtonExpanded - ], disabled && [ - styles.splitButtonMenuButtonDisabled - ], checked && !disabled && [ - styles.splitButtonMenuButtonChecked - ], primaryDisabled && !disabled && [ - { - ':focus': styles.splitButtonMenuFocused - } - ]), - splitButtonContainer: (0, _styling.mergeStyles)(styles.splitButtonContainer, !disabled && checked && [ - styles.splitButtonContainerChecked, - { - ':hover': styles.splitButtonContainerCheckedHovered - } - ], !disabled && !checked && [ - { - ':hover': styles.splitButtonContainerHovered, - ':focus': styles.splitButtonContainerFocused - } - ], disabled && styles.splitButtonContainerDisabled), - icon: (0, _styling.mergeStyles)(styles.splitButtonMenuIcon, disabled && styles.splitButtonMenuIconDisabled, !disabled && primaryDisabled && styles.splitButtonMenuIcon), - flexContainer: (0, _styling.mergeStyles)(styles.splitButtonFlexContainer), - divider: (0, _styling.mergeStyles)(SplitButtonGlobalClassNames.msSplitButtonDivider, styles.splitButtonDivider, (primaryDisabled || disabled) && styles.splitButtonDividerDisabled) - }; -}); - -},{"../../../Utilities":"1NZCy","../../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i8Fdq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ActionButton", ()=>ActionButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _actionButtonStyles = require("./ActionButton.styles"); -/** - * {@docCategory Button} - */ var ActionButton = /** @class */ function(_super) { - (0, _tslib.__extends)(ActionButton, _super); - function ActionButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionButton.prototype.render = function() { - var _a = this.props, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: "ms-Button--action ms-Button--command", - styles: (0, _actionButtonStyles.getStyles)(theme, styles), - onRenderDescription: (0, _utilities.nullRender) - })); - }; - ActionButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('ActionButton', [ - 'theme', - 'styles' - ], true) - ], ActionButton); - return ActionButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./ActionButton.styles":"03QOE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"03QOE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var DEFAULT_BUTTON_HEIGHT = '40px'; -var DEFAULT_PADDING = '0 4px'; -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a, _b, _c; - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var actionButtonStyles = { - root: (_a = { - padding: DEFAULT_PADDING, - height: DEFAULT_BUTTON_HEIGHT, - color: theme.palette.neutralPrimary, - backgroundColor: 'transparent', - border: '1px solid transparent' - }, _a[0, _styling.HighContrastSelector] = { - borderColor: 'Window' - }, _a), - rootHovered: (_b = { - color: theme.palette.themePrimary - }, _b[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _b), - iconHovered: { - color: theme.palette.themePrimary - }, - rootPressed: { - color: theme.palette.black - }, - rootExpanded: { - color: theme.palette.themePrimary - }, - iconPressed: { - color: theme.palette.themeDarker - }, - rootDisabled: (_c = { - color: theme.palette.neutralTertiary, - backgroundColor: 'transparent', - borderColor: 'transparent' - }, _c[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _c), - rootChecked: { - color: theme.palette.black - }, - iconChecked: { - color: theme.palette.themeDarker - }, - flexContainer: { - justifyContent: 'flex-start' - }, - icon: { - color: theme.palette.themeDarkAlt - }, - iconDisabled: { - color: 'inherit' - }, - menuIcon: { - color: theme.palette.neutralSecondary - }, - textContainer: { - flexGrow: 0 - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, actionButtonStyles, customStyles); -}); - -},{"../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"40Y3k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var noOutline = { + return false; + }; + BaseButton2.defaultProps = { + baseClassName: "ms-Button", + styles: {}, + split: false + }; + BaseButton2.contextType = FocusRectsContext; + return BaseButton2; + })(React__namespace.Component) + ); + var noOutline = { outline: 0 -}; -var iconStyle = function(fontSize) { - return { - fontSize: fontSize, - margin: '0 4px', - height: '16px', - lineHeight: '16px', - textAlign: 'center', - flexShrink: 0 - }; -}; -var getStyles = (0, _utilities.memoizeFunction)(function(theme) { - var _a, _b; - var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; - var border = semanticColors.buttonBorder; - var disabledBackground = semanticColors.disabledBackground; - var disabledText = semanticColors.disabledText; - var buttonHighContrastFocus = { - left: -2, - top: -2, - bottom: -2, - right: -2, - outlineColor: 'ButtonText' - }; - return { - root: [ - (0, _styling.getFocusStyle)(theme, { - inset: 1, - highContrastStyle: buttonHighContrastFocus, - borderColor: 'transparent' - }), - theme.fonts.medium, - { - border: '1px solid ' + border, - borderRadius: effects.roundedCorner2, - boxSizing: 'border-box', - cursor: 'pointer', - display: 'inline-flex', - alignItems: 'center', - justifyContent: 'center', - padding: '0 16px', - textDecoration: 'none', - textAlign: 'center', - userSelect: 'none', - // IE11 workaround for preventing shift of child elements of a button when active. - ':active > span': { - position: 'relative', - left: 0, - top: 0 - } - } - ], - rootDisabled: [ - (0, _styling.getFocusStyle)(theme, { - inset: 1, - highContrastStyle: buttonHighContrastFocus, - borderColor: 'transparent' - }), - { - backgroundColor: disabledBackground, - borderColor: disabledBackground, - color: disabledText, - cursor: 'default', - ':hover': noOutline, - ':focus': noOutline - } - ], - iconDisabled: (_a = { - color: disabledText - }, _a[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _a), - menuIconDisabled: (_b = { - color: disabledText - }, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _b), - flexContainer: { - display: 'flex', - height: '100%', - flexWrap: 'nowrap', - justifyContent: 'center', - alignItems: 'center' - }, - description: { - display: 'block' - }, - textContainer: { - flexGrow: 1, - display: 'block' - }, - icon: iconStyle(fonts.mediumPlus.fontSize), - menuIcon: iconStyle(fonts.small.fontSize), - label: { - margin: '0 4px', - lineHeight: '100%', - display: 'block' - }, - screenReaderText: (0, _styling.hiddenContentStyle) - }; -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fxfe4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBarButton", ()=>CommandBarButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _commandBarButtonStyles = require("./CommandBarButton.styles"); -/** - * {@docCategory Button} - */ var CommandBarButton = /** @class */ function(_super) { - (0, _tslib.__extends)(CommandBarButton, _super); - function CommandBarButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandBarButton.prototype.render = function() { - var _a = this.props, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: "ms-Button--commandBar", - styles: (0, _commandBarButtonStyles.getStyles)(theme, styles), - onRenderDescription: (0, _utilities.nullRender) - })); + }; + var iconStyle = function(fontSize2) { + return { + fontSize: fontSize2, + margin: "0 4px", + height: "16px", + lineHeight: "16px", + textAlign: "center", + flexShrink: 0 }; - CommandBarButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('CommandBarButton', [ - 'theme', - 'styles' - ], true) - ], CommandBarButton); - return CommandBarButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./CommandBarButton.styles":"1bkHA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1bkHA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var _splitButtonStyles = require("../SplitButton/SplitButton.styles"); -var _baseButtonClassNames = require("../BaseButton.classNames"); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles, focusInset, focusColor) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var baseSplitButtonStyles = (0, _splitButtonStyles.getStyles)(theme); - var p = theme.palette, semanticColors = theme.semanticColors; - var commandButtonHighContrastFocus = { - left: 4, - top: 4, - bottom: 4, - right: 4, - border: 'none' + }; + var getStyles$p = memoizeFunction(function(theme) { + var _a2, _b2; + var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; + var border = semanticColors.buttonBorder; + var disabledBackground = semanticColors.disabledBackground; + var disabledText = semanticColors.disabledText; + var buttonHighContrastFocus = { + left: -2, + top: -2, + bottom: -2, + right: -2, + outlineColor: "ButtonText" }; - var commandButtonStyles = { - root: [ - (0, _styling.getFocusStyle)(theme, { - inset: 2, - highContrastStyle: commandButtonHighContrastFocus, - borderColor: 'transparent' - }), - theme.fonts.medium, - (_a = { - minWidth: '40px', - backgroundColor: p.white, - color: p.neutralPrimary, - padding: '0 4px', - border: 'none', - borderRadius: 0 - }, _a[0, _styling.HighContrastSelector] = { - border: 'none' - }, _a) - ], - rootHovered: (_b = { - backgroundColor: p.neutralLighter, - color: p.neutralDark - }, _b[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _b[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDarkAlt - }, _b[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _b), - rootPressed: (_c = { - backgroundColor: p.neutralLight, - color: p.neutralDark - }, _c[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _c[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _c), - rootChecked: (_d = { - backgroundColor: p.neutralLight, - color: p.neutralDark - }, _d[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _d[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _d), - rootCheckedHovered: (_e = { - backgroundColor: p.neutralQuaternaryAlt - }, _e[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _e[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _e), - rootExpanded: (_f = { - backgroundColor: p.neutralLight, - color: p.neutralDark - }, _f[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _f[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _f), - rootExpandedHovered: { - backgroundColor: p.neutralQuaternaryAlt - }, - rootDisabled: (_g = { - backgroundColor: p.white - }, _g[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = (_h = { - color: semanticColors.disabledBodySubtext - }, _h[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _h), _g[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _g), - // Split button styles - splitButtonContainer: (_j = { - height: '100%' - }, _j[0, _styling.HighContrastSelector] = { - border: 'none' - }, _j), - splitButtonDividerDisabled: (_k = {}, _k[0, _styling.HighContrastSelector] = { - backgroundColor: 'Window' - }, _k), - splitButtonDivider: { - backgroundColor: p.neutralTertiaryAlt - }, - splitButtonMenuButton: { - backgroundColor: p.white, - border: 'none', - borderTopRightRadius: '0', - borderBottomRightRadius: '0', - color: p.neutralSecondary, - ':hover': (_l = { - backgroundColor: p.neutralLighter, - color: p.neutralDark - }, _l[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _l[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.neutralPrimary - }, _l), - ':active': (_m = { - backgroundColor: p.neutralLight - }, _m[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.neutralPrimary - }, _m) - }, - splitButtonMenuButtonDisabled: (_o = { - backgroundColor: p.white - }, _o[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText', - border: 'none', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _o), - splitButtonMenuButtonChecked: { - backgroundColor: p.neutralLight, - color: p.neutralDark, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuButtonExpanded: { - backgroundColor: p.neutralLight, - color: p.black, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuIcon: { - color: p.neutralPrimary - }, - splitButtonMenuIconDisabled: { - color: p.neutralTertiary - }, - label: { - fontWeight: 'normal' - }, - icon: { - color: p.themePrimary - }, - menuIcon: { - color: p.neutralSecondary - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, baseSplitButtonStyles, commandButtonStyles, customStyles); -}); - -},{"tslib":"9gizs","../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","../SplitButton/SplitButton.styles":"2TsW5","../BaseButton.classNames":"2b9yc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2TsW5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; + return { + root: [ + getFocusStyle(theme, { inset: 1, highContrastStyle: buttonHighContrastFocus, borderColor: "transparent" }), + theme.fonts.medium, + { + border: "1px solid " + border, + borderRadius: effects.roundedCorner2, + boxSizing: "border-box", + cursor: "pointer", + display: "inline-flex", + alignItems: "center", + justifyContent: "center", + padding: "0 16px", + textDecoration: "none", + textAlign: "center", + userSelect: "none", + // IE11 workaround for preventing shift of child elements of a button when active. + ":active > span": { + position: "relative", + left: 0, + top: 0 + } + } + ], + rootDisabled: [ + getFocusStyle(theme, { inset: 1, highContrastStyle: buttonHighContrastFocus, borderColor: "transparent" }), + { + backgroundColor: disabledBackground, + borderColor: disabledBackground, + color: disabledText, + cursor: "default", + ":hover": noOutline, + ":focus": noOutline + } + ], + iconDisabled: (_a2 = { + color: disabledText + }, _a2[HighContrastSelector] = { + color: "GrayText" + }, _a2), + menuIconDisabled: (_b2 = { + color: disabledText + }, _b2[HighContrastSelector] = { + color: "GrayText" + }, _b2), + flexContainer: { + display: "flex", + height: "100%", + flexWrap: "nowrap", + justifyContent: "center", + alignItems: "center" + }, + description: { + display: "block" + }, + textContainer: { + flexGrow: 1, + display: "block" + }, + icon: iconStyle(fonts.mediumPlus.fontSize), + menuIcon: iconStyle(fonts.small.fontSize), + label: { + margin: "0 4px", + lineHeight: "100%", + display: "block" + }, + screenReaderText: hiddenContentStyle + }; + }); + var getStyles$o = memoizeFunction(function(theme, customStyles) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; var effects = theme.effects, palette = theme.palette, semanticColors = theme.semanticColors; var buttonHighContrastFocus = { - left: -2, - top: -2, - bottom: -2, - right: -2, - border: 'none' - }; - var splitButtonDividerBaseStyles = { - position: 'absolute', - width: 1, - right: 31, - top: 8, - bottom: 8 + left: -2, + top: -2, + bottom: -2, + right: -2, + border: "none" + }; + var splitButtonDividerBaseStyles2 = { + position: "absolute", + width: 1, + right: 31, + top: 8, + bottom: 8 }; var splitButtonStyles = { - splitButtonContainer: [ - (0, _styling.getFocusStyle)(theme, { - highContrastStyle: buttonHighContrastFocus, - inset: 2, - pointerEvents: 'none' - }), - { - display: 'inline-flex', - '.ms-Button--default': { - borderTopRightRadius: '0', - borderBottomRightRadius: '0', - borderRight: 'none', - flexGrow: '1' - }, - '.ms-Button--primary': (_a = { - borderTopRightRadius: '0', - borderBottomRightRadius: '0', - border: 'none', - flexGrow: '1', - ':hover': { - border: 'none' - }, - ':active': { - border: 'none' - } - }, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)((0, _tslib.__assign)({ - color: 'WindowText', - backgroundColor: 'Window', - border: '1px solid WindowText', - borderRightWidth: '0' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - ':hover': { - backgroundColor: 'Highlight', - border: '1px solid Highlight', - borderRightWidth: '0', - color: 'HighlightText' - }, - ':active': { - border: '1px solid Highlight' - } - }), _a), - '.ms-Button--default + .ms-Button': (_b = {}, _b[0, _styling.HighContrastSelector] = { - border: '1px solid WindowText', - borderLeftWidth: '0', - ':hover': { - backgroundColor: 'HighlightText', - borderColor: 'Highlight', - color: 'Highlight', - '.ms-Button-menuIcon': (0, _tslib.__assign)({ - backgroundColor: 'HighlightText', - color: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()) - } - }, _b), - '.ms-Button--default + .ms-Button[aria-expanded="true"]': (_c = {}, _c[0, _styling.HighContrastSelector] = { - backgroundColor: 'HighlightText', - borderColor: 'Highlight', - color: 'Highlight', - '.ms-Button-menuIcon': (0, _tslib.__assign)({ - backgroundColor: 'HighlightText', - color: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()) - }, _c), - '.ms-Button--primary + .ms-Button': (_d = { - border: 'none' - }, _d[0, _styling.HighContrastSelector] = { - border: '1px solid WindowText', - borderLeftWidth: '0', - ':hover': { - borderLeftWidth: '0', - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText', - '.ms-Button-menuIcon': (0, _tslib.__assign)((0, _tslib.__assign)({}, (0, _styling.getHighContrastNoAdjustStyle)()), { - color: 'HighlightText' - }) - } - }, _d), - '.ms-Button--primary + .ms-Button[aria-expanded="true"]': (_e = {}, _e[0, _styling.HighContrastSelector] = (0, _tslib.__assign)((0, _tslib.__assign)({ - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - '.ms-Button-menuIcon': { - color: 'HighlightText' - } - }), _e), - '.ms-Button.is-disabled': (_f = {}, _f[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _f) - } - ], - splitButtonContainerHovered: { - '.ms-Button--default.is-disabled': (_g = { - backgroundColor: semanticColors.buttonBackgroundDisabled, - color: semanticColors.buttonTextDisabled - }, _g[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _g), - '.ms-Button--primary.is-disabled': (_h = { - backgroundColor: semanticColors.primaryButtonBackgroundDisabled, - color: semanticColors.primaryButtonTextDisabled - }, _h[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _h) - }, - splitButtonContainerChecked: { - '.ms-Button--primary': (_j = {}, _j[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _j) - }, - splitButtonContainerCheckedHovered: { - '.ms-Button--primary': (_k = {}, _k[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _k) - }, - splitButtonContainerFocused: { - outline: 'none!important' - }, - splitButtonMenuButton: (_l = { - padding: 6, - height: 'auto', - boxSizing: 'border-box', - borderRadius: 0, - borderTopRightRadius: effects.roundedCorner2, - borderBottomRightRadius: effects.roundedCorner2, - border: "1px solid ".concat(palette.neutralSecondaryAlt), - borderLeft: 'none', - outline: 'transparent', - userSelect: 'none', - display: 'inline-block', - textDecoration: 'none', - textAlign: 'center', - cursor: 'pointer', - verticalAlign: 'top', - width: 32, - marginLeft: -1, - marginTop: 0, - marginRight: 0, - marginBottom: 0 - }, _l[0, _styling.HighContrastSelector] = { - '.ms-Button-menuIcon': { - color: 'WindowText' - } - }, _l), - splitButtonDivider: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles), (_m = {}, _m[0, _styling.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _m)), - splitButtonDividerDisabled: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles), (_o = {}, _o[0, _styling.HighContrastSelector] = { - backgroundColor: 'GrayText' - }, _o)), - splitButtonMenuButtonDisabled: (_p = { - pointerEvents: 'none', - border: 'none', - ':hover': { - cursor: 'default' + splitButtonContainer: [ + getFocusStyle(theme, { highContrastStyle: buttonHighContrastFocus, inset: 2, pointerEvents: "none" }), + { + display: "inline-flex", + ".ms-Button--default": { + borderTopRightRadius: "0", + borderBottomRightRadius: "0", + borderRight: "none", + flexGrow: "1" + }, + ".ms-Button--primary": (_a2 = { + borderTopRightRadius: "0", + borderBottomRightRadius: "0", + border: "none", + flexGrow: "1", + ":hover": { + border: "none" }, - '.ms-Button--primary': (_q = {}, _q[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _q), - '.ms-Button-menuIcon': (_r = {}, _r[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _r) - }, _p[0, _styling.HighContrastSelector] = { - color: 'GrayText', - border: '1px solid GrayText', - backgroundColor: 'Window' - }, _p), - splitButtonFlexContainer: { - display: 'flex', - height: '100%', - flexWrap: 'nowrap', - justifyContent: 'center', - alignItems: 'center' - }, - splitButtonContainerDisabled: (_s = { - outline: 'none', - border: 'none' - }, _s[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _s), - splitButtonMenuFocused: (0, _tslib.__assign)({}, (0, _styling.getFocusStyle)(theme, { - highContrastStyle: buttonHighContrastFocus, - inset: 2 - })) - }; - return (0, _styling.concatStyleSets)(splitButtonStyles, customStyles); -}); - -},{"tslib":"9gizs","../../../Styling":"hTimn","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5I0qn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandButton", ()=>CommandButton); -var _actionButton = require("../ActionButton/ActionButton"); -var CommandButton = (0, _actionButton.ActionButton); - -},{"../ActionButton/ActionButton":"i8Fdq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3H4TE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultButton", ()=>DefaultButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _defaultButtonStyles = require("./DefaultButton.styles"); -/** - * {@docCategory Button} - */ var DefaultButton = /** @class */ function(_super) { - (0, _tslib.__extends)(DefaultButton, _super); - function DefaultButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - DefaultButton.prototype.render = function() { - var _a = this.props, _b = _a.primary, primary = _b === void 0 ? false : _b, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: primary ? 'ms-Button--primary' : 'ms-Button--default', - styles: (0, _defaultButtonStyles.getStyles)(theme, styles, primary), - onRenderDescription: (0, _utilities.nullRender) - })); + ":active": { + border: "none" + } + }, _a2[HighContrastSelector] = __assign$1(__assign$1({ color: "WindowText", backgroundColor: "Window", border: "1px solid WindowText", borderRightWidth: "0" }, getHighContrastNoAdjustStyle()), { ":hover": { + backgroundColor: "Highlight", + border: "1px solid Highlight", + borderRightWidth: "0", + color: "HighlightText" + }, ":active": { + border: "1px solid Highlight" + } }), _a2), + ".ms-Button--default + .ms-Button": (_b2 = {}, _b2[HighContrastSelector] = { + border: "1px solid WindowText", + borderLeftWidth: "0", + ":hover": { + backgroundColor: "HighlightText", + borderColor: "Highlight", + color: "Highlight", + ".ms-Button-menuIcon": __assign$1({ backgroundColor: "HighlightText", color: "Highlight" }, getHighContrastNoAdjustStyle()) + } + }, _b2), + '.ms-Button--default + .ms-Button[aria-expanded="true"]': (_c2 = {}, _c2[HighContrastSelector] = { + backgroundColor: "HighlightText", + borderColor: "Highlight", + color: "Highlight", + ".ms-Button-menuIcon": __assign$1({ backgroundColor: "HighlightText", color: "Highlight" }, getHighContrastNoAdjustStyle()) + }, _c2), + ".ms-Button--primary + .ms-Button": (_d2 = { + border: "none" + }, _d2[HighContrastSelector] = { + border: "1px solid WindowText", + borderLeftWidth: "0", + ":hover": { + borderLeftWidth: "0", + backgroundColor: "Highlight", + borderColor: "Highlight", + color: "HighlightText", + ".ms-Button-menuIcon": __assign$1(__assign$1({}, getHighContrastNoAdjustStyle()), { color: "HighlightText" }) + } + }, _d2), + '.ms-Button--primary + .ms-Button[aria-expanded="true"]': (_e2 = {}, _e2[HighContrastSelector] = __assign$1(__assign$1({ backgroundColor: "Highlight", borderColor: "Highlight", color: "HighlightText" }, getHighContrastNoAdjustStyle()), { ".ms-Button-menuIcon": { + color: "HighlightText" + } }), _e2), + ".ms-Button.is-disabled": (_f = {}, _f[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _f) + } + ], + splitButtonContainerHovered: { + ".ms-Button--default.is-disabled": (_g = { + backgroundColor: semanticColors.buttonBackgroundDisabled, + color: semanticColors.buttonTextDisabled + }, _g[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _g), + ".ms-Button--primary.is-disabled": (_h = { + backgroundColor: semanticColors.primaryButtonBackgroundDisabled, + color: semanticColors.primaryButtonTextDisabled + }, _h[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _h) + }, + splitButtonContainerChecked: { + ".ms-Button--primary": (_j = {}, _j[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText" }, getHighContrastNoAdjustStyle()), _j) + }, + splitButtonContainerCheckedHovered: { + ".ms-Button--primary": (_k = {}, _k[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText" }, getHighContrastNoAdjustStyle()), _k) + }, + splitButtonContainerFocused: { + outline: "none!important" + }, + splitButtonMenuButton: (_l = { + padding: 6, + height: "auto", + boxSizing: "border-box", + borderRadius: 0, + borderTopRightRadius: effects.roundedCorner2, + borderBottomRightRadius: effects.roundedCorner2, + border: "1px solid ".concat(palette.neutralSecondaryAlt), + borderLeft: "none", + outline: "transparent", + userSelect: "none", + display: "inline-block", + textDecoration: "none", + textAlign: "center", + cursor: "pointer", + verticalAlign: "top", + width: 32, + marginLeft: -1, + marginTop: 0, + marginRight: 0, + marginBottom: 0 + }, _l[HighContrastSelector] = { + ".ms-Button-menuIcon": { + color: "WindowText" + } + }, _l), + splitButtonDivider: __assign$1(__assign$1({}, splitButtonDividerBaseStyles2), (_m = {}, _m[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _m)), + splitButtonDividerDisabled: __assign$1(__assign$1({}, splitButtonDividerBaseStyles2), (_o = {}, _o[HighContrastSelector] = { + backgroundColor: "GrayText" + }, _o)), + splitButtonMenuButtonDisabled: (_p = { + pointerEvents: "none", + border: "none", + ":hover": { + cursor: "default" + }, + ".ms-Button--primary": (_q = {}, _q[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _q), + ".ms-Button-menuIcon": (_r = {}, _r[HighContrastSelector] = { + color: "GrayText" + }, _r) + }, _p[HighContrastSelector] = { + color: "GrayText", + border: "1px solid GrayText", + backgroundColor: "Window" + }, _p), + splitButtonFlexContainer: { + display: "flex", + height: "100%", + flexWrap: "nowrap", + justifyContent: "center", + alignItems: "center" + }, + splitButtonContainerDisabled: (_s = { + outline: "none", + border: "none" + }, _s[HighContrastSelector] = __assign$1({ color: "GrayText", borderColor: "GrayText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _s), + splitButtonMenuFocused: __assign$1({}, getFocusStyle(theme, { highContrastStyle: buttonHighContrastFocus, inset: 2 })) }; - DefaultButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('DefaultButton', [ - 'theme', - 'styles' - ], true) - ], DefaultButton); - return DefaultButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./DefaultButton.styles":"iURfs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iURfs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var _splitButtonStyles = require("../SplitButton/SplitButton.styles"); -var _buttonThemes = require("../ButtonThemes"); -var DEFAULT_BUTTON_MIN_HEIGHT = '32px'; -var DEFAULT_BUTTON_MIN_WIDTH = '80px'; -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles, primary) { - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var splitButtonStyles = (0, _splitButtonStyles.getStyles)(theme); - var defaultButtonStyles = { - root: { - minWidth: DEFAULT_BUTTON_MIN_WIDTH, - minHeight: DEFAULT_BUTTON_MIN_HEIGHT - }, - label: { - fontWeight: (0, _styling.FontWeights).semibold - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, defaultButtonStyles, primary ? (0, _buttonThemes.primaryStyles)(theme) : (0, _buttonThemes.standardStyles)(theme), splitButtonStyles, customStyles); -}); - -},{"../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","../SplitButton/SplitButton.styles":"2TsW5","../ButtonThemes":"f0GMb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f0GMb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "standardStyles", ()=>standardStyles); -parcelHelpers.export(exports, "primaryStyles", ()=>primaryStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var splitButtonDividerBaseStyles = function() { + return concatStyleSets(splitButtonStyles, customStyles); + }); + var splitButtonDividerBaseStyles = function() { return { - position: 'absolute', - width: 1, - right: 31, - top: 8, - bottom: 8 - }; -}; -function standardStyles(theme) { - var _a, _b, _c, _d, _e; - var s = theme.semanticColors, p = theme.palette; - var buttonBackground = s.buttonBackground; - var buttonBackgroundPressed = s.buttonBackgroundPressed; - var buttonBackgroundHovered = s.buttonBackgroundHovered; - var buttonBackgroundDisabled = s.buttonBackgroundDisabled; - var buttonText = s.buttonText; - var buttonTextHovered = s.buttonTextHovered; - var buttonTextDisabled = s.buttonTextDisabled; - var buttonTextChecked = s.buttonTextChecked; - var buttonTextCheckedHovered = s.buttonTextCheckedHovered; + position: "absolute", + width: 1, + right: 31, + top: 8, + bottom: 8 + }; + }; + function standardStyles(theme) { + var _a2, _b2, _c2, _d2, _e2; + var s2 = theme.semanticColors, p = theme.palette; + var buttonBackground = s2.buttonBackground; + var buttonBackgroundPressed = s2.buttonBackgroundPressed; + var buttonBackgroundHovered = s2.buttonBackgroundHovered; + var buttonBackgroundDisabled = s2.buttonBackgroundDisabled; + var buttonText = s2.buttonText; + var buttonTextHovered = s2.buttonTextHovered; + var buttonTextDisabled = s2.buttonTextDisabled; + var buttonTextChecked = s2.buttonTextChecked; + var buttonTextCheckedHovered = s2.buttonTextCheckedHovered; return { - root: { - backgroundColor: buttonBackground, - color: buttonText - }, - rootHovered: (_a = { - backgroundColor: buttonBackgroundHovered, - color: buttonTextHovered - }, _a[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - color: 'Highlight' - }, _a), - rootPressed: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextChecked - }, - rootExpanded: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextChecked - }, - rootChecked: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextChecked - }, - rootCheckedHovered: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextCheckedHovered - }, - rootDisabled: (_b = { - color: buttonTextDisabled, - backgroundColor: buttonBackgroundDisabled - }, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _b), - // Split button styles - splitButtonContainer: (_c = {}, _c[0, _styling.HighContrastSelector] = { - border: 'none' - }, _c), - splitButtonMenuButton: { - color: p.white, - backgroundColor: 'transparent', - ':hover': (_d = { - backgroundColor: p.neutralLight - }, _d[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _d) - }, - splitButtonMenuButtonDisabled: { - backgroundColor: s.buttonBackgroundDisabled, - ':hover': { - backgroundColor: s.buttonBackgroundDisabled - } - }, - splitButtonDivider: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles()), (_e = { - backgroundColor: p.neutralTertiaryAlt - }, _e[0, _styling.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _e)), - splitButtonDividerDisabled: { - backgroundColor: theme.palette.neutralTertiaryAlt - }, - splitButtonMenuButtonChecked: { - backgroundColor: p.neutralQuaternaryAlt, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuButtonExpanded: { - backgroundColor: p.neutralQuaternaryAlt, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuIcon: { - color: s.buttonText - }, - splitButtonMenuIconDisabled: { - color: s.buttonTextDisabled + root: { + backgroundColor: buttonBackground, + color: buttonText + }, + rootHovered: (_a2 = { + backgroundColor: buttonBackgroundHovered, + color: buttonTextHovered + }, _a2[HighContrastSelector] = { + borderColor: "Highlight", + color: "Highlight" + }, _a2), + rootPressed: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextChecked + }, + rootExpanded: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextChecked + }, + rootChecked: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextChecked + }, + rootCheckedHovered: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextCheckedHovered + }, + rootDisabled: (_b2 = { + color: buttonTextDisabled, + backgroundColor: buttonBackgroundDisabled + }, _b2[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _b2), + // Split button styles + splitButtonContainer: (_c2 = {}, _c2[HighContrastSelector] = { + border: "none" + }, _c2), + splitButtonMenuButton: { + color: p.white, + backgroundColor: "transparent", + ":hover": (_d2 = { + backgroundColor: p.neutralLight + }, _d2[HighContrastSelector] = { + color: "Highlight" + }, _d2) + }, + splitButtonMenuButtonDisabled: { + backgroundColor: s2.buttonBackgroundDisabled, + ":hover": { + backgroundColor: s2.buttonBackgroundDisabled + } + }, + splitButtonDivider: __assign$1(__assign$1({}, splitButtonDividerBaseStyles()), (_e2 = { backgroundColor: p.neutralTertiaryAlt }, _e2[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _e2)), + splitButtonDividerDisabled: { + backgroundColor: theme.palette.neutralTertiaryAlt + }, + splitButtonMenuButtonChecked: { + backgroundColor: p.neutralQuaternaryAlt, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt + } + }, + splitButtonMenuButtonExpanded: { + backgroundColor: p.neutralQuaternaryAlt, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt } + }, + splitButtonMenuIcon: { + color: s2.buttonText + }, + splitButtonMenuIconDisabled: { + color: s2.buttonTextDisabled + } }; -} -function primaryStyles(theme) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - var p = theme.palette, s = theme.semanticColors; + } + function primaryStyles(theme) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; + var p = theme.palette, s2 = theme.semanticColors; return { - root: (_a = { - backgroundColor: s.primaryButtonBackground, - border: "1px solid ".concat(s.primaryButtonBackground), - color: s.primaryButtonText - }, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText', - borderColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus")] = { - ':after': { - border: "none", - outlineColor: p.white - } - }, _a), - rootHovered: (_b = { - backgroundColor: s.primaryButtonBackgroundHovered, - border: "1px solid ".concat(s.primaryButtonBackgroundHovered), - color: s.primaryButtonTextHovered - }, _b[0, _styling.HighContrastSelector] = { - color: 'Window', - backgroundColor: 'Highlight', - borderColor: 'Highlight' - }, _b), - rootPressed: (_c = { - backgroundColor: s.primaryButtonBackgroundPressed, - border: "1px solid ".concat(s.primaryButtonBackgroundPressed), - color: s.primaryButtonTextPressed - }, _c[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText', - borderColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _c), - rootExpanded: { - backgroundColor: s.primaryButtonBackgroundPressed, - color: s.primaryButtonTextPressed - }, - rootChecked: { - backgroundColor: s.primaryButtonBackgroundPressed, - color: s.primaryButtonTextPressed - }, - rootCheckedHovered: { - backgroundColor: s.primaryButtonBackgroundPressed, - color: s.primaryButtonTextPressed - }, - rootDisabled: (_d = { - color: s.primaryButtonTextDisabled, - backgroundColor: s.primaryButtonBackgroundDisabled - }, _d[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _d), - // Split button styles - splitButtonContainer: (_e = {}, _e[0, _styling.HighContrastSelector] = { - border: 'none' - }, _e), - splitButtonDivider: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles()), (_f = { - backgroundColor: p.white - }, _f[0, _styling.HighContrastSelector] = { - backgroundColor: 'Window' - }, _f)), - splitButtonMenuButton: (_g = { - backgroundColor: s.primaryButtonBackground, - color: s.primaryButtonText - }, _g[0, _styling.HighContrastSelector] = { - backgroundColor: 'Canvas' - }, _g[':hover'] = (_h = { - backgroundColor: s.primaryButtonBackgroundHovered - }, _h[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _h), _g), - splitButtonMenuButtonDisabled: { - backgroundColor: s.primaryButtonBackgroundDisabled, - ':hover': { - backgroundColor: s.primaryButtonBackgroundDisabled - } - }, - splitButtonMenuButtonChecked: { - backgroundColor: s.primaryButtonBackgroundPressed, - ':hover': { - backgroundColor: s.primaryButtonBackgroundPressed - } - }, - splitButtonMenuButtonExpanded: { - backgroundColor: s.primaryButtonBackgroundPressed, - ':hover': { - backgroundColor: s.primaryButtonBackgroundPressed - } - }, - splitButtonMenuIcon: { - color: s.primaryButtonText - }, - splitButtonMenuIconDisabled: (_j = { - color: p.neutralTertiary - }, _j[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _j) - }; -} - -},{"tslib":"9gizs","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g0nWk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PrimaryButton", ()=>PrimaryButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _defaultButton = require("../DefaultButton/DefaultButton"); -/** - * {@docCategory Button} - */ var PrimaryButton = /** @class */ function(_super) { - (0, _tslib.__extends)(PrimaryButton, _super); - function PrimaryButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - PrimaryButton.prototype.render = function() { - return _react.createElement((0, _defaultButton.DefaultButton), (0, _tslib.__assign)({}, this.props, { - primary: true, - onRenderDescription: (0, _utilities.nullRender) - })); + root: (_a2 = { + backgroundColor: s2.primaryButtonBackground, + border: "1px solid ".concat(s2.primaryButtonBackground), + color: s2.primaryButtonText + }, _a2[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText", borderColor: "WindowText" }, getHighContrastNoAdjustStyle()), _a2[".".concat(IsFocusVisibleClassName, " &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus")] = { + ":after": { + border: "none", + outlineColor: p.white + } + }, _a2), + rootHovered: (_b2 = { + backgroundColor: s2.primaryButtonBackgroundHovered, + border: "1px solid ".concat(s2.primaryButtonBackgroundHovered), + color: s2.primaryButtonTextHovered + }, _b2[HighContrastSelector] = { + color: "Window", + backgroundColor: "Highlight", + borderColor: "Highlight" + }, _b2), + rootPressed: (_c2 = { + backgroundColor: s2.primaryButtonBackgroundPressed, + border: "1px solid ".concat(s2.primaryButtonBackgroundPressed), + color: s2.primaryButtonTextPressed + }, _c2[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText", borderColor: "WindowText" }, getHighContrastNoAdjustStyle()), _c2), + rootExpanded: { + backgroundColor: s2.primaryButtonBackgroundPressed, + color: s2.primaryButtonTextPressed + }, + rootChecked: { + backgroundColor: s2.primaryButtonBackgroundPressed, + color: s2.primaryButtonTextPressed + }, + rootCheckedHovered: { + backgroundColor: s2.primaryButtonBackgroundPressed, + color: s2.primaryButtonTextPressed + }, + rootDisabled: (_d2 = { + color: s2.primaryButtonTextDisabled, + backgroundColor: s2.primaryButtonBackgroundDisabled + }, _d2[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _d2), + // Split button styles + splitButtonContainer: (_e2 = {}, _e2[HighContrastSelector] = { + border: "none" + }, _e2), + splitButtonDivider: __assign$1(__assign$1({}, splitButtonDividerBaseStyles()), (_f = { backgroundColor: p.white }, _f[HighContrastSelector] = { + backgroundColor: "Window" + }, _f)), + splitButtonMenuButton: (_g = { + backgroundColor: s2.primaryButtonBackground, + color: s2.primaryButtonText + }, _g[HighContrastSelector] = { + backgroundColor: "Canvas" + }, _g[":hover"] = (_h = { + backgroundColor: s2.primaryButtonBackgroundHovered + }, _h[HighContrastSelector] = { + color: "Highlight" + }, _h), _g), + splitButtonMenuButtonDisabled: { + backgroundColor: s2.primaryButtonBackgroundDisabled, + ":hover": { + backgroundColor: s2.primaryButtonBackgroundDisabled + } + }, + splitButtonMenuButtonChecked: { + backgroundColor: s2.primaryButtonBackgroundPressed, + ":hover": { + backgroundColor: s2.primaryButtonBackgroundPressed + } + }, + splitButtonMenuButtonExpanded: { + backgroundColor: s2.primaryButtonBackgroundPressed, + ":hover": { + backgroundColor: s2.primaryButtonBackgroundPressed + } + }, + splitButtonMenuIcon: { + color: s2.primaryButtonText + }, + splitButtonMenuIconDisabled: (_j = { + color: p.neutralTertiary + }, _j[HighContrastSelector] = { + color: "GrayText" + }, _j) + }; + } + var DEFAULT_BUTTON_MIN_HEIGHT = "32px"; + var DEFAULT_BUTTON_MIN_WIDTH = "80px"; + var getStyles$n = memoizeFunction(function(theme, customStyles, primary) { + var baseButtonStyles = getStyles$p(theme); + var splitButtonStyles = getStyles$o(theme); + var defaultButtonStyles = { + root: { + minWidth: DEFAULT_BUTTON_MIN_WIDTH, + minHeight: DEFAULT_BUTTON_MIN_HEIGHT + }, + label: { + fontWeight: FontWeights.semibold + } }; - PrimaryButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('PrimaryButton', [ - 'theme', - 'styles' - ], true) - ], PrimaryButton); - return PrimaryButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","../DefaultButton/DefaultButton":"3H4TE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bbHBP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconButton", ()=>IconButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _iconButtonStyles = require("./IconButton.styles"); -/** - * {@docCategory Button} - */ var IconButton = /** @class */ function(_super) { - (0, _tslib.__extends)(IconButton, _super); - function IconButton() { + return concatStyleSets(baseButtonStyles, defaultButtonStyles, primary ? primaryStyles(theme) : standardStyles(theme), splitButtonStyles, customStyles); + }); + var DefaultButton = ( + /** @class */ + (function(_super) { + __extends(DefaultButton2, _super); + function DefaultButton2() { return _super !== null && _super.apply(this, arguments) || this; - } - IconButton.prototype.render = function() { - var _a = this.props, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: "ms-Button--icon", - styles: (0, _iconButtonStyles.getStyles)(theme, styles), - onRenderText: (0, _utilities.nullRender), - onRenderDescription: (0, _utilities.nullRender) - })); + } + DefaultButton2.prototype.render = function() { + var _a2 = this.props, _b2 = _a2.primary, primary = _b2 === void 0 ? false : _b2, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: primary ? "ms-Button--primary" : "ms-Button--default", styles: getStyles$n(theme, styles, primary), onRenderDescription: nullRender })); + }; + DefaultButton2 = __decorate([ + customizable("DefaultButton", ["theme", "styles"]) + ], DefaultButton2); + return DefaultButton2; + })(React__namespace.Component) + ); + var DEFAULT_BUTTON_HEIGHT = "40px"; + var DEFAULT_PADDING = "0 4px"; + var getStyles$m = memoizeFunction(function(theme, customStyles) { + var _a2, _b2, _c2; + var baseButtonStyles = getStyles$p(theme); + var actionButtonStyles = { + root: (_a2 = { + padding: DEFAULT_PADDING, + height: DEFAULT_BUTTON_HEIGHT, + color: theme.palette.neutralPrimary, + backgroundColor: "transparent", + border: "1px solid transparent" + }, _a2[HighContrastSelector] = { + borderColor: "Window" + }, _a2), + rootHovered: (_b2 = { + color: theme.palette.themePrimary + }, _b2[HighContrastSelector] = { + color: "Highlight" + }, _b2), + iconHovered: { + color: theme.palette.themePrimary + }, + rootPressed: { + color: theme.palette.black + }, + rootExpanded: { + color: theme.palette.themePrimary + }, + iconPressed: { + color: theme.palette.themeDarker + }, + rootDisabled: (_c2 = { + color: theme.palette.neutralTertiary, + backgroundColor: "transparent", + borderColor: "transparent" + }, _c2[HighContrastSelector] = { + color: "GrayText" + }, _c2), + rootChecked: { + color: theme.palette.black + }, + iconChecked: { + color: theme.palette.themeDarker + }, + flexContainer: { + justifyContent: "flex-start" + }, + icon: { + color: theme.palette.themeDarkAlt + }, + iconDisabled: { + color: "inherit" + }, + menuIcon: { + color: theme.palette.neutralSecondary + }, + textContainer: { + flexGrow: 0 + } }; - IconButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('IconButton', [ - 'theme', - 'styles' - ], true) - ], IconButton); - return IconButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./IconButton.styles":"l1BeF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l1BeF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var _splitButtonStyles = require("../SplitButton/SplitButton.styles"); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a; - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var splitButtonStyles = (0, _splitButtonStyles.getStyles)(theme); + return concatStyleSets(baseButtonStyles, actionButtonStyles, customStyles); + }); + var ActionButton = ( + /** @class */ + (function(_super) { + __extends(ActionButton2, _super); + function ActionButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ActionButton2.prototype.render = function() { + var _a2 = this.props, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: "ms-Button--action ms-Button--command", styles: getStyles$m(theme, styles), onRenderDescription: nullRender })); + }; + ActionButton2 = __decorate([ + customizable("ActionButton", ["theme", "styles"]) + ], ActionButton2); + return ActionButton2; + })(React__namespace.Component) + ); + var getStyles$l = memoizeFunction(function(theme, customStyles) { + var _a2; + var baseButtonStyles = getStyles$p(theme); + var splitButtonStyles = getStyles$o(theme); var palette = theme.palette, semanticColors = theme.semanticColors; var iconButtonStyles = { - root: { - padding: '0 4px', - width: '32px', - height: '32px', - backgroundColor: 'transparent', - border: 'none', - color: semanticColors.link - }, - rootHovered: (_a = { - color: palette.themeDarkAlt, - backgroundColor: palette.neutralLighter - }, _a[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - color: 'Highlight' - }, _a), - rootHasMenu: { - width: 'auto' - }, - rootPressed: { - color: palette.themeDark, - backgroundColor: palette.neutralLight - }, - rootExpanded: { - color: palette.themeDark, - backgroundColor: palette.neutralLight - }, - rootChecked: { - color: palette.themeDark, - backgroundColor: palette.neutralLight - }, - rootCheckedHovered: { - color: palette.themeDark, - backgroundColor: palette.neutralQuaternaryAlt - }, - rootDisabled: { - color: palette.neutralTertiaryAlt - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles); -}); - -},{"../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","../SplitButton/SplitButton.styles":"2TsW5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8qKBO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ChoiceGroup/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ChoiceGroup/index":"3SnD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3SnD3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _choiceGroup = require("./ChoiceGroup"); -parcelHelpers.exportAll(_choiceGroup, exports); -var _choiceGroupBase = require("./ChoiceGroup.base"); -parcelHelpers.exportAll(_choiceGroupBase, exports); -var _choiceGroupTypes = require("./ChoiceGroup.types"); -parcelHelpers.exportAll(_choiceGroupTypes, exports); -var _index = require("./ChoiceGroupOption/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./ChoiceGroup":"efrlU","./ChoiceGroup.base":false,"./ChoiceGroup.types":false,"./ChoiceGroupOption/index":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"efrlU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroup", ()=>ChoiceGroup); -var _utilities = require("../../Utilities"); -var _choiceGroupBase = require("./ChoiceGroup.base"); -var _choiceGroupStyles = require("./ChoiceGroup.styles"); -var ChoiceGroup = (0, _utilities.styled)((0, _choiceGroupBase.ChoiceGroupBase), (0, _choiceGroupStyles.getStyles), undefined, { - scope: 'ChoiceGroup' -}); - -},{"../../Utilities":"1NZCy","./ChoiceGroup.base":"7MQAQ","./ChoiceGroup.styles":"imoN3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7MQAQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroupBase", ()=>ChoiceGroupBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _label = require("../../Label"); -var _utilities = require("../../Utilities"); -var _index = require("./ChoiceGroupOption/index"); -var _reactHooks = require("@fluentui/react-hooks"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getOptionId = function(option, id) { - return "".concat(id, "-").concat(option.key); -}; -var findOption = function(options, key) { - return key === undefined ? undefined : (0, _utilities.find)(options, function(value) { - return value.key === key; - }); -}; -var focusSelectedOption = function(options, keyChecked, id, focusProviders, doc) { - var optionToFocus = findOption(options, keyChecked) || options.filter(function(option) { - return !option.disabled; - })[0]; - var elementToFocus = optionToFocus && (doc === null || doc === void 0 ? void 0 : doc.getElementById(getOptionId(optionToFocus, id))); - if (elementToFocus) { - elementToFocus.focus(); - (0, _utilities.setFocusVisibility)(true, elementToFocus, focusProviders); - } -}; -var focusFromFocusTrapZone = function(evt) { - return evt.relatedTarget instanceof HTMLElement && evt.relatedTarget.dataset.isFocusTrapZoneBumper === 'true'; -}; -var useComponentRef = function(options, keyChecked, id, componentRef, focusProviders) { - var doc = (0, _dom.useDocumentEx)(); - _react.useImperativeHandle(componentRef, function() { - return { - get checkedOption () { - return findOption(options, keyChecked); - }, - focus: function() { - focusSelectedOption(options, keyChecked, id, focusProviders, doc); - } - }; - }, [ - options, - keyChecked, - id, - focusProviders, - doc - ]); -}; -var COMPONENT_NAME = 'ChoiceGroup'; -var ChoiceGroupBase = _react.forwardRef(function(props, forwardedRef) { - var className = props.className, theme = props.theme, styles = props.styles, _a = props.options, options = _a === void 0 ? [] : _a, label = props.label, required = props.required, disabled = props.disabled, name = props.name, defaultSelectedKey = props.defaultSelectedKey, componentRef = props.componentRef, onChange = props.onChange; - var id = (0, _reactHooks.useId)('ChoiceGroup'); - var labelId = (0, _reactHooks.useId)('ChoiceGroupLabel'); - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), [ - 'onChange', - 'className', - 'required' - ]); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - optionsContainIconOrImage: options.some(function(option) { - return !!(option.iconProps || option.imageSrc); - }) - }); - var ariaLabelledBy = props.ariaLabelledBy || (label ? labelId : props['aria-labelledby']); - var _b = (0, _reactHooks.useControllableValue)(props.selectedKey, defaultSelectedKey), keyChecked = _b[0], setKeyChecked = _b[1]; - var _c = _react.useState(), keyFocused = _c[0], setKeyFocused = _c[1]; - var rootRef = _react.useRef(null); - var mergedRootRefs = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var focusContext = _react.useContext((0, _utilities.FocusRectsContext)); - useDebugWarnings(props); - useComponentRef(options, keyChecked, id, componentRef, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); - (0, _utilities.useFocusRects)(rootRef); - var onFocus = _react.useCallback(function(ev, option) { - var _a; - if (option) { - setKeyFocused(option.itemKey); - (_a = option.onFocus) === null || _a === void 0 || _a.call(option, ev); + root: { + padding: "0 4px", + width: "32px", + height: "32px", + backgroundColor: "transparent", + border: "none", + color: semanticColors.link + }, + rootHovered: (_a2 = { + color: palette.themeDarkAlt, + backgroundColor: palette.neutralLighter + }, _a2[HighContrastSelector] = { + borderColor: "Highlight", + color: "Highlight" + }, _a2), + rootHasMenu: { + width: "auto" + }, + rootPressed: { + color: palette.themeDark, + backgroundColor: palette.neutralLight + }, + rootExpanded: { + color: palette.themeDark, + backgroundColor: palette.neutralLight + }, + rootChecked: { + color: palette.themeDark, + backgroundColor: palette.neutralLight + }, + rootCheckedHovered: { + color: palette.themeDark, + backgroundColor: palette.neutralQuaternaryAlt + }, + rootDisabled: { + color: palette.neutralTertiaryAlt + } + }; + return concatStyleSets(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles); + }); + var IconButton = ( + /** @class */ + (function(_super) { + __extends(IconButton2, _super); + function IconButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + IconButton2.prototype.render = function() { + var _a2 = this.props, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: "ms-Button--icon", styles: getStyles$l(theme, styles), onRenderText: nullRender, onRenderDescription: nullRender })); + }; + IconButton2 = __decorate([ + customizable("IconButton", ["theme", "styles"]) + ], IconButton2); + return IconButton2; + })(React__namespace.Component) + ); + var PrimaryButton = ( + /** @class */ + (function(_super) { + __extends(PrimaryButton2, _super); + function PrimaryButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PrimaryButton2.prototype.render = function() { + return React__namespace.createElement(DefaultButton, __assign$1({}, this.props, { primary: true, onRenderDescription: nullRender })); + }; + PrimaryButton2 = __decorate([ + customizable("PrimaryButton", ["theme", "styles"]) + ], PrimaryButton2); + return PrimaryButton2; + })(React__namespace.Component) + ); + var getStyles$k = memoizeFunction(function(theme, customStyles, focusInset, focusColor) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o; + var baseButtonStyles = getStyles$p(theme); + var baseSplitButtonStyles = getStyles$o(theme); + var p = theme.palette, semanticColors = theme.semanticColors; + var commandButtonHighContrastFocus = { + left: 4, + top: 4, + bottom: 4, + right: 4, + border: "none" + }; + var commandButtonStyles = { + root: [ + getFocusStyle(theme, { + inset: 2, + highContrastStyle: commandButtonHighContrastFocus, + borderColor: "transparent" + }), + theme.fonts.medium, + (_a2 = { + minWidth: "40px", + backgroundColor: p.white, + color: p.neutralPrimary, + padding: "0 4px", + border: "none", + borderRadius: 0 + }, _a2[HighContrastSelector] = { + border: "none" + }, _a2) + ], + rootHovered: (_b2 = { + backgroundColor: p.neutralLighter, + color: p.neutralDark + }, _b2[HighContrastSelector] = { + color: "Highlight" + }, _b2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDarkAlt + }, _b2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _b2), + rootPressed: (_c2 = { + backgroundColor: p.neutralLight, + color: p.neutralDark + }, _c2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _c2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _c2), + rootChecked: (_d2 = { + backgroundColor: p.neutralLight, + color: p.neutralDark + }, _d2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _d2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _d2), + rootCheckedHovered: (_e2 = { + backgroundColor: p.neutralQuaternaryAlt + }, _e2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _e2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _e2), + rootExpanded: (_f = { + backgroundColor: p.neutralLight, + color: p.neutralDark + }, _f[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _f[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _f), + rootExpandedHovered: { + backgroundColor: p.neutralQuaternaryAlt + }, + rootDisabled: (_g = { + backgroundColor: p.white + }, _g[".".concat(ButtonGlobalClassNames.msButtonIcon)] = (_h = { + color: semanticColors.disabledBodySubtext + }, _h[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _h), _g[HighContrastSelector] = __assign$1({ color: "GrayText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _g), + // Split button styles + splitButtonContainer: (_j = { + height: "100%" + }, _j[HighContrastSelector] = { + border: "none" + }, _j), + splitButtonDividerDisabled: (_k = {}, _k[HighContrastSelector] = { + backgroundColor: "Window" + }, _k), + splitButtonDivider: { + backgroundColor: p.neutralTertiaryAlt + }, + splitButtonMenuButton: { + backgroundColor: p.white, + border: "none", + borderTopRightRadius: "0", + borderBottomRightRadius: "0", + color: p.neutralSecondary, + ":hover": (_l = { + backgroundColor: p.neutralLighter, + color: p.neutralDark + }, _l[HighContrastSelector] = { + color: "Highlight" + }, _l[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.neutralPrimary + }, _l), + ":active": (_m = { + backgroundColor: p.neutralLight + }, _m[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.neutralPrimary + }, _m) + }, + splitButtonMenuButtonDisabled: (_o = { + backgroundColor: p.white + }, _o[HighContrastSelector] = __assign$1({ color: "GrayText", border: "none", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _o), + splitButtonMenuButtonChecked: { + backgroundColor: p.neutralLight, + color: p.neutralDark, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt } - }, []); - var onBlur = _react.useCallback(function(ev, option) { - var _a; - setKeyFocused(undefined); - (_a = option === null || option === void 0 ? void 0 : option.onBlur) === null || _a === void 0 || _a.call(option, ev); - }, []); - var onOptionChange = _react.useCallback(function(evt, option) { - var _a; - if (!option) return; - setKeyChecked(option.itemKey); - (_a = option.onChange) === null || _a === void 0 || _a.call(option, evt); - onChange === null || onChange === void 0 || onChange(evt, findOption(options, option.itemKey)); - }, [ - onChange, - options, - setKeyChecked - ]); - var onRadioFocus = _react.useCallback(function(evt) { - // Handles scenarios like this bug: https://github.com/microsoft/fluentui/issues/20173 - if (focusFromFocusTrapZone(evt)) focusSelectedOption(options, keyChecked, id, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); - }, [ - options, - keyChecked, - id, - focusContext - ]); - return _react.createElement("div", (0, _tslib.__assign)({ - className: classNames.root - }, divProps, { - ref: mergedRootRefs - }), _react.createElement("div", (0, _tslib.__assign)({ - role: "radiogroup" - }, ariaLabelledBy && { - 'aria-labelledby': ariaLabelledBy - }, { - onFocus: onRadioFocus - }), label && _react.createElement((0, _label.Label), { - className: classNames.label, - required: required, - id: labelId, - disabled: disabled - }, label), _react.createElement("div", { - className: classNames.flexContainer - }, options.map(function(option) { - return _react.createElement((0, _index.ChoiceGroupOption), (0, _tslib.__assign)({ - itemKey: option.key - }, option, { - key: option.key, - onBlur: onBlur, - onFocus: onFocus, - onChange: onOptionChange, - focused: option.key === keyFocused, - checked: option.key === keyChecked, - disabled: option.disabled || disabled, - id: getOptionId(option, id), - labelId: option.labelId || "".concat(labelId, "-").concat(option.key), - name: name || id, - required: required - })); - })))); -}); -ChoiceGroupBase.displayName = COMPONENT_NAME; -function useDebugWarnings(props) {} - -},{"tslib":"9gizs","react":"jGrId","../../Label":"8FZUu","../../Utilities":"1NZCy","./ChoiceGroupOption/index":"fGZfZ","@fluentui/react-hooks":"2LHjM","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8FZUu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Label/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Label/index":"jklZV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jklZV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _labelBase = require("./Label.base"); -parcelHelpers.exportAll(_labelBase, exports); -var _labelTypes = require("./Label.types"); -parcelHelpers.exportAll(_labelTypes, exports); -var _label = require("./Label"); -parcelHelpers.exportAll(_label, exports); - -},{"./Label.base":false,"./Label.types":false,"./Label":"4UD9B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lN99G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelBase", ()=>LabelBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)({ + }, + splitButtonMenuButtonExpanded: { + backgroundColor: p.neutralLight, + color: p.black, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt + } + }, + splitButtonMenuIcon: { + color: p.neutralPrimary + }, + splitButtonMenuIconDisabled: { + color: p.neutralTertiary + }, + label: { + fontWeight: "normal" + // theme.fontWeights.semibold, + }, + icon: { + color: p.themePrimary + }, + menuIcon: { + color: p.neutralSecondary + } + }; + return concatStyleSets(baseButtonStyles, baseSplitButtonStyles, commandButtonStyles, customStyles); + }); + var CommandBarButton = ( + /** @class */ + (function(_super) { + __extends(CommandBarButton2, _super); + function CommandBarButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandBarButton2.prototype.render = function() { + var _a2 = this.props, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: "ms-Button--commandBar", styles: getStyles$k(theme, styles), onRenderDescription: nullRender })); + }; + CommandBarButton2 = __decorate([ + customizable("CommandBarButton", ["theme", "styles"]) + ], CommandBarButton2); + return CommandBarButton2; + })(React__namespace.Component) + ); + var CommandButton = ActionButton; + var getClassNames$k = classNamesFunction({ // Label is used a lot by other components. // It's likely to see expected cases which pass different className to the Label. // Therefore setting a larger cache size. cacheSize: 100 -}); -var LabelBase = /** @class */ function(_super) { - (0, _tslib.__extends)(LabelBase, _super); - function LabelBase() { + }); + var LabelBase = ( + /** @class */ + (function(_super) { + __extends(LabelBase2, _super); + function LabelBase2() { return _super !== null && _super.apply(this, arguments) || this; - } - LabelBase.prototype.render = function() { - var _a = this.props, _b = _a.as, RootType = _b === void 0 ? 'label' : _b, children = _a.children, className = _a.className, disabled = _a.disabled, styles = _a.styles, required = _a.required, theme = _a.theme; - var classNames = getClassNames(styles, { - className: className, - disabled: disabled, - required: required, - theme: theme + } + LabelBase2.prototype.render = function() { + var _a2 = this.props, _b2 = _a2.as, RootType = _b2 === void 0 ? "label" : _b2, children2 = _a2.children, className2 = _a2.className, disabled = _a2.disabled, styles = _a2.styles, required2 = _a2.required, theme = _a2.theme; + var classNames2 = getClassNames$k(styles, { + className: className2, + disabled, + required: required2, + theme }); - return _react.createElement(RootType, (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)), { - className: classNames.root - }), children); - }; - return LabelBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4UD9B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Label", ()=>Label); -var _utilities = require("../../Utilities"); -var _labelBase = require("./Label.base"); -var _labelStyles = require("./Label.styles"); -var Label = (0, _utilities.styled)((0, _labelBase.LabelBase), (0, _labelStyles.getStyles), undefined, { - scope: 'Label' -}); - -},{"../../Utilities":"1NZCy","./Label.base":"lN99G","./Label.styles":"bde6m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bde6m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var getStyles = function(props) { - var _a; - var theme = props.theme, className = props.className, disabled = props.disabled, required = props.required; + return React__namespace.createElement(RootType, __assign$1({}, getNativeProps(this.props, divProperties), { className: classNames2.root }), children2); + }; + return LabelBase2; + })(React__namespace.Component) + ); + var getStyles$j = function(props) { + var _a2; + var theme = props.theme, className2 = props.className, disabled = props.disabled, required2 = props.required; var semanticColors = theme.semanticColors; - // Tokens - var labelFontWeight = (0, _styling.FontWeights).semibold; + var labelFontWeight = FontWeights.semibold; var labelColor = semanticColors.bodyText; var labelDisabledColor = semanticColors.disabledBodyText; var labelRequiredStarColor = semanticColors.errorText; return { - root: [ - 'ms-Label', - theme.fonts.medium, - { - fontWeight: labelFontWeight, - color: labelColor, - boxSizing: 'border-box', - boxShadow: 'none', - margin: 0, - display: 'block', - padding: '5px 0', - wordWrap: 'break-word', - overflowWrap: 'break-word' - }, - disabled && { - color: labelDisabledColor, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) - }, - required && { - selectors: { - '::after': { - content: "' *'", - color: labelRequiredStarColor, - paddingRight: 12 - } - } - }, - className - ] + root: [ + "ms-Label", + theme.fonts.medium, + { + fontWeight: labelFontWeight, + color: labelColor, + boxSizing: "border-box", + boxShadow: "none", + margin: 0, + display: "block", + padding: "5px 0", + wordWrap: "break-word", + overflowWrap: "break-word" + }, + disabled && { + color: labelDisabledColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _a2) + }, + required2 && { + selectors: { + "::after": { + content: "' *'", + color: labelRequiredStarColor, + paddingRight: 12 + } + } + }, + className2 + ] }; -}; - -},{"tslib":"9gizs","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fGZfZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _choiceGroupOption = require("./ChoiceGroupOption"); -parcelHelpers.exportAll(_choiceGroupOption, exports); -var _choiceGroupOptionTypes = require("./ChoiceGroupOption.types"); -parcelHelpers.exportAll(_choiceGroupOptionTypes, exports); - -},{"./ChoiceGroupOption":"l21UM","./ChoiceGroupOption.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l21UM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroupOption", ()=>ChoiceGroupOption); -var _utilities = require("../../../Utilities"); -var _choiceGroupOptionBase = require("./ChoiceGroupOption.base"); -var _choiceGroupOptionStyles = require("./ChoiceGroupOption.styles"); -var ChoiceGroupOption = (0, _utilities.styled)((0, _choiceGroupOptionBase.ChoiceGroupOptionBase), (0, _choiceGroupOptionStyles.getStyles), undefined, { - scope: 'ChoiceGroupOption' -}); - -},{"../../../Utilities":"1NZCy","./ChoiceGroupOption.base":"bmRsn","./ChoiceGroupOption.styles":"fUMBU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmRsn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroupOptionBase", ()=>ChoiceGroupOptionBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _image = require("../../../Image"); -var _icon = require("../../../Icon"); -var _utilities = require("../../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var LARGE_IMAGE_SIZE = 71; -var DEFAULT_PROPS = { + }; + var Label$2 = styled(LabelBase, getStyles$j, void 0, { + scope: "Label" + }); + var getClassNames$j = classNamesFunction(); + var LARGE_IMAGE_SIZE = 71; + var DEFAULT_PROPS$3 = { // This ensures default imageSize value doesn't mutate. Mutation can cause style re-calcuation. - imageSize: { - width: 32, - height: 32 - } -}; -var ChoiceGroupOptionBase = function(propsWithoutDefaults) { - // Mix the `key` prop back in since custom render functions may be expecting it - // (React uses `key` internally rather than passing it through to the component) - var props = (0, _utilities.getPropsWithDefaults)((0, _tslib.__assign)((0, _tslib.__assign)({}, DEFAULT_PROPS), { - key: propsWithoutDefaults.itemKey - }), propsWithoutDefaults); - var ariaLabel = props.ariaLabel, focused = props.focused, required = props.required, theme = props.theme, iconProps = props.iconProps, imageSrc = props.imageSrc, imageSize = props.imageSize, disabled = props.disabled, checked = props.checked, id = props.id, styles = props.styles, name = props.name, rest = (0, _tslib.__rest)(props, [ - "ariaLabel", - "focused", - "required", - "theme", - "iconProps", - "imageSrc", - "imageSize", - "disabled", - "checked", - "id", - "styles", - "name" - ]); - var classNames = getClassNames(styles, { - theme: theme, - hasIcon: !!iconProps, - hasImage: !!imageSrc, - checked: checked, - disabled: disabled, - imageIsLarge: !!imageSrc && (imageSize.width > LARGE_IMAGE_SIZE || imageSize.height > LARGE_IMAGE_SIZE), - imageSize: imageSize, - focused: focused + imageSize: { width: 32, height: 32 } + }; + var ChoiceGroupOptionBase = function(propsWithoutDefaults) { + var props = getPropsWithDefaults(__assign$1(__assign$1({}, DEFAULT_PROPS$3), { key: propsWithoutDefaults.itemKey }), propsWithoutDefaults); + var ariaLabel2 = props.ariaLabel, focused = props.focused, required2 = props.required, theme = props.theme, iconProps = props.iconProps, imageSrc = props.imageSrc, imageSize = props.imageSize, disabled = props.disabled, checked = props.checked, id2 = props.id, styles = props.styles, name = props.name, rest = __rest(props, ["ariaLabel", "focused", "required", "theme", "iconProps", "imageSrc", "imageSize", "disabled", "checked", "id", "styles", "name"]); + var classNames2 = getClassNames$j(styles, { + theme, + hasIcon: !!iconProps, + hasImage: !!imageSrc, + checked, + disabled, + imageIsLarge: !!imageSrc && (imageSize.width > LARGE_IMAGE_SIZE || imageSize.height > LARGE_IMAGE_SIZE), + imageSize, + focused }); - var _a = (0, _utilities.getNativeProps)(rest, (0, _utilities.inputProperties)), className = _a.className, nativeProps = (0, _tslib.__rest)(_a, [ - "className" - ]); + var _a2 = getNativeProps(rest, inputProperties), className2 = _a2.className, nativeProps = __rest(_a2, ["className"]); var defaultOnRenderLabel = function() { - return _react.createElement("span", { - id: props.labelId, - className: "ms-ChoiceFieldLabel" - }, props.text); + return React__namespace.createElement("span", { id: props.labelId, className: "ms-ChoiceFieldLabel" }, props.text); }; var defaultOnRenderField = function() { - var _a = props.imageAlt, imageAlt = _a === void 0 ? '' : _a, selectedImageSrc = props.selectedImageSrc; - var onRenderLabel = props.onRenderLabel ? (0, _utilities.composeRenderFunction)(props.onRenderLabel, defaultOnRenderLabel) : defaultOnRenderLabel; - var label = onRenderLabel((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - })); - return _react.createElement("label", { - htmlFor: id, - className: classNames.field - }, imageSrc && _react.createElement("div", { - className: classNames.innerField - }, _react.createElement("div", { - className: classNames.imageWrapper - }, _react.createElement((0, _image.Image), (0, _tslib.__assign)({ - src: imageSrc, - alt: imageAlt - }, imageSize))), _react.createElement("div", { - className: classNames.selectedImageWrapper - }, _react.createElement((0, _image.Image), (0, _tslib.__assign)({ - src: selectedImageSrc, - alt: imageAlt - }, imageSize)))), iconProps && _react.createElement("div", { - className: classNames.innerField - }, _react.createElement("div", { - className: classNames.iconWrapper - }, _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({}, iconProps)))), imageSrc || iconProps ? _react.createElement("div", { - className: classNames.labelWrapper - }, label) : label); - }; - var _b = props.onRenderField, onRenderField = _b === void 0 ? defaultOnRenderField : _b; + var _a3 = props.imageAlt, imageAlt = _a3 === void 0 ? "" : _a3, selectedImageSrc = props.selectedImageSrc; + var onRenderLabel = props.onRenderLabel ? composeRenderFunction(props.onRenderLabel, defaultOnRenderLabel) : defaultOnRenderLabel; + var label2 = onRenderLabel(__assign$1(__assign$1({}, props), { key: props.itemKey })); + return React__namespace.createElement( + "label", + { htmlFor: id2, className: classNames2.field }, + imageSrc && React__namespace.createElement( + "div", + { className: classNames2.innerField }, + React__namespace.createElement( + "div", + { className: classNames2.imageWrapper }, + React__namespace.createElement(Image$1, __assign$1({ src: imageSrc, alt: imageAlt }, imageSize)) + ), + React__namespace.createElement( + "div", + { className: classNames2.selectedImageWrapper }, + React__namespace.createElement(Image$1, __assign$1({ src: selectedImageSrc, alt: imageAlt }, imageSize)) + ) + ), + iconProps && React__namespace.createElement( + "div", + { className: classNames2.innerField }, + React__namespace.createElement( + "div", + { className: classNames2.iconWrapper }, + React__namespace.createElement(Icon, __assign$1({}, iconProps)) + ) + ), + imageSrc || iconProps ? React__namespace.createElement("div", { className: classNames2.labelWrapper }, label2) : label2 + ); + }; + var _b2 = props.onRenderField, onRenderField = _b2 === void 0 ? defaultOnRenderField : _b2; var onChange = function(evt) { - var _a; - (_a = props.onChange) === null || _a === void 0 || _a.call(props, evt, (0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - })); + var _a3; + (_a3 = props.onChange) === null || _a3 === void 0 ? void 0 : _a3.call(props, evt, __assign$1(__assign$1({}, props), { key: props.itemKey })); }; var onBlur = function(evt) { - var _a; - (_a = props.onBlur) === null || _a === void 0 || _a.call(props, evt); + var _a3; + (_a3 = props.onBlur) === null || _a3 === void 0 ? void 0 : _a3.call(props, evt); }; var onFocus = function(evt) { - var _a; - (_a = props.onFocus) === null || _a === void 0 || _a.call(props, evt, (0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - })); - }; - return _react.createElement("div", { - className: classNames.root - }, _react.createElement("div", { - className: classNames.choiceFieldWrapper - }, _react.createElement("input", (0, _tslib.__assign)({ - "aria-label": ariaLabel, - id: id, - className: (0, _utilities.css)(classNames.input, className), - type: "radio", - name: name, - disabled: disabled, - checked: checked, - required: required - }, nativeProps, { - onChange: onChange, - onFocus: onFocus, - onBlur: onBlur - })), onRenderField((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - }), defaultOnRenderField))); -}; -ChoiceGroupOptionBase.displayName = 'ChoiceGroupOption'; - -},{"tslib":"9gizs","react":"jGrId","../../../Image":"73jnt","../../../Icon":"hiMUP","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73jnt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Image/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Image/index":"9Jyaq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Jyaq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _image = require("./Image"); -parcelHelpers.exportAll(_image, exports); -var _imageBase = require("./Image.base"); -parcelHelpers.exportAll(_imageBase, exports); -var _imageTypes = require("./Image.types"); -parcelHelpers.exportAll(_imageTypes, exports); - -},{"./Image":"5keBP","./Image.base":false,"./Image.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fUMBU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var GlobalClassNames = { - root: 'ms-ChoiceField', - choiceFieldWrapper: 'ms-ChoiceField-wrapper', - input: 'ms-ChoiceField-input', - field: 'ms-ChoiceField-field', - innerField: 'ms-ChoiceField-innerField', - imageWrapper: 'ms-ChoiceField-imageWrapper', - iconWrapper: 'ms-ChoiceField-iconWrapper', - labelWrapper: 'ms-ChoiceField-labelWrapper', - checked: 'is-checked' -}; -var labelWrapperLineHeight = 15; -var labelWrapperHeight = labelWrapperLineHeight * 2 + 2; // adding 2px height to ensure text doesn't get cutoff -var iconSize = 32; -var choiceFieldSize = 20; -var choiceFieldTransitionDuration = '200ms'; -var choiceFieldTransitionTiming = 'cubic-bezier(.4, 0, .23, 1)'; -var radioButtonSpacing = 3; -var radioButtonInnerSize = 5; -function getChoiceGroupFocusStyle(focusBorderColor, hasIconOrImage) { - var _a, _b; + var _a3; + (_a3 = props.onFocus) === null || _a3 === void 0 ? void 0 : _a3.call(props, evt, __assign$1(__assign$1({}, props), { key: props.itemKey })); + }; + return React__namespace.createElement( + "div", + { className: classNames2.root }, + React__namespace.createElement( + "div", + { className: classNames2.choiceFieldWrapper }, + React__namespace.createElement("input", __assign$1({ "aria-label": ariaLabel2, id: id2, className: css(classNames2.input, className2), type: "radio", name, disabled, checked, required: required2 }, nativeProps, { onChange, onFocus, onBlur })), + onRenderField(__assign$1(__assign$1({}, props), { key: props.itemKey }), defaultOnRenderField) + ) + ); + }; + ChoiceGroupOptionBase.displayName = "ChoiceGroupOption"; + var GlobalClassNames$b = { + root: "ms-ChoiceField", + choiceFieldWrapper: "ms-ChoiceField-wrapper", + input: "ms-ChoiceField-input", + field: "ms-ChoiceField-field", + innerField: "ms-ChoiceField-innerField", + imageWrapper: "ms-ChoiceField-imageWrapper", + iconWrapper: "ms-ChoiceField-iconWrapper", + labelWrapper: "ms-ChoiceField-labelWrapper", + checked: "is-checked" + }; + var labelWrapperLineHeight = 15; + var labelWrapperHeight = labelWrapperLineHeight * 2 + 2; + var iconSize = 32; + var choiceFieldSize = 20; + var choiceFieldTransitionDuration = "200ms"; + var choiceFieldTransitionTiming = "cubic-bezier(.4, 0, .23, 1)"; + var radioButtonSpacing = 3; + var radioButtonInnerSize = 5; + function getChoiceGroupFocusStyle(focusBorderColor, hasIconOrImage) { + var _a2, _b2; return [ - 'is-inFocus', - { - selectors: (_a = {}, _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &")] = { - position: 'relative', - outline: 'transparent', - selectors: { - '::-moz-focus-inner': { - border: 0 - }, - ':after': { - content: '""', - top: -2, - right: -2, - bottom: -2, - left: -2, - pointerEvents: 'none', - border: "1px solid ".concat(focusBorderColor), - position: 'absolute', - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - borderColor: 'WindowText', - borderWidth: hasIconOrImage ? 1 : 2 - }, _b) - } - } - }, _a) - } + "is-inFocus", + { + selectors: (_a2 = {}, _a2[".".concat(IsFocusVisibleClassName, " &, :host(.").concat(IsFocusVisibleClassName, ") &")] = { + position: "relative", + outline: "transparent", + selectors: { + "::-moz-focus-inner": { + border: 0 + }, + ":after": { + content: '""', + top: -2, + right: -2, + bottom: -2, + left: -2, + pointerEvents: "none", + border: "1px solid ".concat(focusBorderColor), + position: "absolute", + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "WindowText", + borderWidth: hasIconOrImage ? 1 : 2 + }, _b2) + } + } + }, _a2) + } ]; -} -function getImageWrapperStyle(isSelectedImageWrapper, className, checked) { + } + function getImageWrapperStyle(isSelectedImageWrapper, className2, checked) { return [ - className, + className2, + { + paddingBottom: 2, + transitionProperty: "opacity", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: "ease", + selectors: { + ".ms-Image": { + display: "inline-block", + borderStyle: "none" + } + } + }, + (checked ? !isSelectedImageWrapper : isSelectedImageWrapper) && [ + "is-hidden", { - paddingBottom: 2, - transitionProperty: 'opacity', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: 'ease', - selectors: { - '.ms-Image': { - display: 'inline-block', - borderStyle: 'none' - } - } - }, - (checked ? !isSelectedImageWrapper : isSelectedImageWrapper) && [ - 'is-hidden', - { - position: 'absolute', - left: 0, - top: 0, - width: '100%', - height: '100%', - overflow: 'hidden', - opacity: 0 - } - ] + position: "absolute", + left: 0, + top: 0, + width: "100%", + height: "100%", + overflow: "hidden", + opacity: 0 + } + ] ]; -} -var getStyles = function(props) { - var _a, _b, _c, _d, _e; + } + var getStyles$i = function(props) { + var _a2, _b2, _c2, _d2, _e2; var theme = props.theme, hasIcon = props.hasIcon, hasImage = props.hasImage, checked = props.checked, disabled = props.disabled, imageIsLarge = props.imageIsLarge, focused = props.focused, imageSize = props.imageSize; var palette = theme.palette, semanticColors = theme.semanticColors, fonts = theme.fonts; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - // Tokens - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.smallInputBorder + var classNames2 = getGlobalClassNames(GlobalClassNames$b, theme); var circleBorderColor = palette.neutralPrimary; var circleHoveredBorderColor = semanticColors.inputBorderHovered; var circleCheckedBorderColor = semanticColors.inputBackgroundChecked; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered var circleCheckedHoveredBorderColor = palette.themeDark; var circleDisabledBorderColor = semanticColors.disabledBodySubtext; var circleBackgroundColor = semanticColors.bodyBackground; var dotUncheckedHoveredColor = palette.neutralSecondary; var dotCheckedColor = semanticColors.inputBackgroundChecked; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered var dotCheckedHoveredColor = palette.themeDark; var dotDisabledColor = semanticColors.disabledBodySubtext; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.bodyTextChecked var labelHoverFocusColor = palette.neutralDark; var focusBorderColor = semanticColors.focusBorder; var iconOrImageChoiceBorderUncheckedHoveredColor = semanticColors.inputBorderHovered; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered var iconOrImageChoiceBorderCheckedColor = semanticColors.inputBackgroundChecked; var iconOrImageChoiceBorderCheckedHoveredColor = palette.themeDark; var iconOrImageChoiceBackgroundColor = palette.neutralLighter; var fieldHoverOrFocusProperties = { - selectors: { - '.ms-ChoiceFieldLabel': { - color: labelHoverFocusColor - }, - ':before': { - borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor - }, - ':after': [ - !hasIcon && !hasImage && !checked && { - content: '""', - transitionProperty: 'background-color', - left: 5, - top: 5, - width: 10, - height: 10, - backgroundColor: dotUncheckedHoveredColor - }, - checked && { - borderColor: dotCheckedHoveredColor, - background: dotCheckedHoveredColor + selectors: { + ".ms-ChoiceFieldLabel": { + color: labelHoverFocusColor + }, + ":before": { + borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor + }, + ":after": [ + !hasIcon && !hasImage && !checked && { + content: '""', + transitionProperty: "background-color", + left: 5, + top: 5, + width: 10, + height: 10, + backgroundColor: dotUncheckedHoveredColor + }, + checked && { + borderColor: dotCheckedHoveredColor, + background: dotCheckedHoveredColor + } + ] + } + }; + var enabledFieldWithImageHoverOrFocusProperties = { + borderColor: checked ? iconOrImageChoiceBorderCheckedHoveredColor : iconOrImageChoiceBorderUncheckedHoveredColor, + selectors: { + ":before": { + opacity: 1, + borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor + } + } + }; + var circleAreaProperties = [ + { + content: '""', + display: "inline-block", + backgroundColor: circleBackgroundColor, + borderWidth: 1, + borderStyle: "solid", + borderColor: circleBorderColor, + width: choiceFieldSize, + height: choiceFieldSize, + fontWeight: "normal", + position: "absolute", + top: 0, + left: 0, + boxSizing: "border-box", + transitionProperty: "border-color", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: choiceFieldTransitionTiming, + borderRadius: "50%" + }, + disabled && { + borderColor: circleDisabledBorderColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ borderColor: "GrayText", background: "Window" }, getHighContrastNoAdjustStyle()), _a2) + }, + checked && { + borderColor: disabled ? circleDisabledBorderColor : circleCheckedBorderColor, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "Highlight", + background: "Window", + forcedColorAdjust: "none" + }, _b2) + }, + (hasIcon || hasImage) && { + top: radioButtonSpacing, + right: radioButtonSpacing, + left: "auto", + // To reset the value of 'left' to its default value, so that 'right' works + opacity: checked ? 1 : 0 + } + ]; + var dotAreaProperties = [ + { + content: '""', + width: 0, + height: 0, + borderRadius: "50%", + position: "absolute", + left: choiceFieldSize / 2, + right: 0, + transitionProperty: "border-width", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: choiceFieldTransitionTiming, + boxSizing: "border-box" + }, + checked && { + borderWidth: 5, + borderStyle: "solid", + borderColor: disabled ? dotDisabledColor : dotCheckedColor, + background: dotCheckedColor, + left: 5, + top: 5, + width: 10, + height: 10, + selectors: (_c2 = {}, _c2[HighContrastSelector] = { + borderColor: "Highlight", + forcedColorAdjust: "none" + }, _c2) + }, + checked && (hasIcon || hasImage) && { + top: radioButtonSpacing + radioButtonInnerSize, + right: radioButtonSpacing + radioButtonInnerSize, + left: "auto" + // To reset the value of 'left' to its default value, so that 'right' works + } + ]; + return { + root: [ + classNames2.root, + theme.fonts.medium, + { + display: "flex", + alignItems: "center", + boxSizing: "border-box", + color: semanticColors.bodyText, + minHeight: 26, + border: "none", + position: "relative", + marginTop: 8, + selectors: { + ".ms-ChoiceFieldLabel": { + display: "inline-block" + } + } + }, + !hasIcon && !hasImage && { + selectors: { + ".ms-ChoiceFieldLabel": { + paddingLeft: "26px" + } + } + }, + hasImage && "ms-ChoiceField--image", + hasIcon && "ms-ChoiceField--icon", + (hasIcon || hasImage) && { + display: "inline-flex", + fontSize: 0, + margin: "0 4px 4px 0", + paddingLeft: 0, + backgroundColor: iconOrImageChoiceBackgroundColor, + height: "100%" + } + ], + choiceFieldWrapper: [ + classNames2.choiceFieldWrapper, + focused && getChoiceGroupFocusStyle(focusBorderColor, hasIcon || hasImage) + ], + // The hidden input + input: [ + classNames2.input, + { + position: "absolute", + opacity: 0, + top: 0, + right: 0, + width: "100%", + height: "100%", + margin: 0 + }, + disabled && "is-disabled" + ], + field: [ + classNames2.field, + checked && classNames2.checked, + { + display: "inline-block", + cursor: "pointer", + marginTop: 0, + position: "relative", + verticalAlign: "top", + userSelect: "none", + minHeight: 20, + selectors: { + ":hover": !disabled && fieldHoverOrFocusProperties, + ":focus": !disabled && fieldHoverOrFocusProperties, + // The circle + ":before": circleAreaProperties, + // The dot + ":after": dotAreaProperties + } + }, + hasIcon && "ms-ChoiceField--icon", + hasImage && "ms-ChoiceField-field--image", + (hasIcon || hasImage) && { + boxSizing: "content-box", + cursor: "pointer", + paddingTop: 22, + margin: 0, + textAlign: "center", + transitionProperty: "all", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: "ease", + border: "1px solid transparent", + justifyContent: "center", + alignItems: "center", + display: "flex", + flexDirection: "column" + }, + checked && { + borderColor: iconOrImageChoiceBorderCheckedColor + }, + (hasIcon || hasImage) && !disabled && { + selectors: { + ":hover": enabledFieldWithImageHoverOrFocusProperties, + ":focus": enabledFieldWithImageHoverOrFocusProperties + } + }, + disabled && { + cursor: "default", + selectors: { + ".ms-ChoiceFieldLabel": { + color: semanticColors.disabledBodyText, + selectors: (_d2 = {}, _d2[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _d2) + } + } + }, + checked && disabled && { + borderColor: iconOrImageChoiceBackgroundColor + } + ], + innerField: [ + classNames2.innerField, + hasImage && { + // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. + height: imageSize.height, + width: imageSize.width + }, + (hasIcon || hasImage) && { + position: "relative", + display: "inline-block", + paddingLeft: 30, + paddingRight: 30 + }, + (hasIcon || hasImage) && imageIsLarge && { + paddingLeft: 24, + paddingRight: 24 + }, + (hasIcon || hasImage) && disabled && { + opacity: 0.25, + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + color: "GrayText", + opacity: 1 + }, _e2) + } + ], + imageWrapper: getImageWrapperStyle(false, classNames2.imageWrapper, checked), + selectedImageWrapper: getImageWrapperStyle(true, classNames2.imageWrapper, checked), + iconWrapper: [ + classNames2.iconWrapper, + { + fontSize: iconSize, + lineHeight: iconSize, + height: iconSize + } + ], + labelWrapper: [ + classNames2.labelWrapper, + fonts.medium, + (hasIcon || hasImage) && { + display: "block", + position: "relative", + margin: "4px 8px 2px 8px", + height: labelWrapperHeight, + lineHeight: labelWrapperLineHeight, + // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. + maxWidth: imageSize.width * 2, + overflow: "hidden", + whiteSpace: "pre-wrap" + } + ] + }; + }; + var ChoiceGroupOption = styled(ChoiceGroupOptionBase, getStyles$i, void 0, { scope: "ChoiceGroupOption" }); + var getClassNames$i = classNamesFunction(); + var getOptionId = function(option, id2) { + return "".concat(id2, "-").concat(option.key); + }; + var findOption = function(options2, key2) { + return key2 === void 0 ? void 0 : find$3(options2, function(value2) { + return value2.key === key2; + }); + }; + var focusSelectedOption = function(options2, keyChecked, id2, focusProviders, doc) { + var optionToFocus = findOption(options2, keyChecked) || options2.filter(function(option) { + return !option.disabled; + })[0]; + var elementToFocus = optionToFocus && (doc === null || doc === void 0 ? void 0 : doc.getElementById(getOptionId(optionToFocus, id2))); + if (elementToFocus) { + elementToFocus.focus(); + setFocusVisibility(true, elementToFocus, focusProviders); + } + }; + var focusFromFocusTrapZone = function(evt) { + return evt.relatedTarget instanceof HTMLElement && evt.relatedTarget.dataset.isFocusTrapZoneBumper === "true"; + }; + var useComponentRef$5 = function(options2, keyChecked, id2, componentRef, focusProviders) { + var doc = useDocumentEx(); + React__namespace.useImperativeHandle(componentRef, function() { + return { + get checkedOption() { + return findOption(options2, keyChecked); + }, + focus: function() { + focusSelectedOption(options2, keyChecked, id2, focusProviders, doc); + } + }; + }, [options2, keyChecked, id2, focusProviders, doc]); + }; + var COMPONENT_NAME$5 = "ChoiceGroup"; + var ChoiceGroupBase = React__namespace.forwardRef(function(props, forwardedRef) { + var className2 = props.className, theme = props.theme, styles = props.styles, _a2 = props.options, options2 = _a2 === void 0 ? [] : _a2, label2 = props.label, required2 = props.required, disabled = props.disabled, name = props.name, defaultSelectedKey = props.defaultSelectedKey, componentRef = props.componentRef, onChange = props.onChange; + var id2 = useId("ChoiceGroup"); + var labelId = useId("ChoiceGroupLabel"); + var divProps = getNativeProps(props, divProperties, [ + "onChange", + "className", + "required" + ]); + var classNames2 = getClassNames$i(styles, { + theme, + className: className2, + optionsContainIconOrImage: options2.some(function(option) { + return !!(option.iconProps || option.imageSrc); + }) + }); + var ariaLabelledBy = props.ariaLabelledBy || (label2 ? labelId : props["aria-labelledby"]); + var _b2 = useControllableValue(props.selectedKey, defaultSelectedKey), keyChecked = _b2[0], setKeyChecked = _b2[1]; + var _c2 = React__namespace.useState(), keyFocused = _c2[0], setKeyFocused = _c2[1]; + var rootRef = React__namespace.useRef(null); + var mergedRootRefs = useMergedRefs(rootRef, forwardedRef); + var focusContext = React__namespace.useContext(FocusRectsContext); + useComponentRef$5(options2, keyChecked, id2, componentRef, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); + useFocusRects(rootRef); + var onFocus = React__namespace.useCallback(function(ev, option) { + var _a22; + if (option) { + setKeyFocused(option.itemKey); + (_a22 = option.onFocus) === null || _a22 === void 0 ? void 0 : _a22.call(option, ev); + } + }, []); + var onBlur = React__namespace.useCallback(function(ev, option) { + var _a22; + setKeyFocused(void 0); + (_a22 = option === null || option === void 0 ? void 0 : option.onBlur) === null || _a22 === void 0 ? void 0 : _a22.call(option, ev); + }, []); + var onOptionChange = React__namespace.useCallback(function(evt, option) { + var _a22; + if (!option) { + return; + } + setKeyChecked(option.itemKey); + (_a22 = option.onChange) === null || _a22 === void 0 ? void 0 : _a22.call(option, evt); + onChange === null || onChange === void 0 ? void 0 : onChange(evt, findOption(options2, option.itemKey)); + }, [onChange, options2, setKeyChecked]); + var onRadioFocus = React__namespace.useCallback(function(evt) { + if (focusFromFocusTrapZone(evt)) { + focusSelectedOption(options2, keyChecked, id2, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); + } + }, [options2, keyChecked, id2, focusContext]); + return React__namespace.createElement( + "div", + __assign$1({ className: classNames2.root }, divProps, { ref: mergedRootRefs }), + React__namespace.createElement( + "div", + __assign$1({ role: "radiogroup" }, ariaLabelledBy && { "aria-labelledby": ariaLabelledBy }, { onFocus: onRadioFocus }), + label2 && React__namespace.createElement(Label$2, { className: classNames2.label, required: required2, id: labelId, disabled }, label2), + React__namespace.createElement("div", { className: classNames2.flexContainer }, options2.map(function(option) { + return React__namespace.createElement(ChoiceGroupOption, __assign$1({ itemKey: option.key }, option, { key: option.key, onBlur, onFocus, onChange: onOptionChange, focused: option.key === keyFocused, checked: option.key === keyChecked, disabled: option.disabled || disabled, id: getOptionId(option, id2), labelId: option.labelId || "".concat(labelId, "-").concat(option.key), name: name || id2, required: required2 })); + })) + ) + ); + }); + ChoiceGroupBase.displayName = COMPONENT_NAME$5; + var GlobalClassNames$a = { + root: "ms-ChoiceFieldGroup", + flexContainer: "ms-ChoiceFieldGroup-flexContainer" + }; + var getStyles$h = function(props) { + var className2 = props.className, optionsContainIconOrImage = props.optionsContainIconOrImage, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$a, theme); + return { + root: [ + className2, + classNames2.root, + theme.fonts.medium, + { + display: "block" + } + ], + flexContainer: [ + classNames2.flexContainer, + optionsContainIconOrImage && { + display: "flex", + flexDirection: "row", + flexWrap: "wrap" + } + ] + }; + }; + var ChoiceGroup = styled(ChoiceGroupBase, getStyles$h, void 0, { scope: "ChoiceGroup" }); + var SELECTION_FORWARD = "forward"; + var SELECTION_BACKWARD = "backward"; + var Autofill = ( + /** @class */ + (function(_super) { + __extends(Autofill2, _super); + function Autofill2(props) { + var _this = _super.call(this, props) || this; + _this._inputElement = React__namespace.createRef(); + _this._autoFillEnabled = true; + _this._onCompositionStart = function(ev) { + _this.setState({ isComposing: true }); + _this._autoFillEnabled = false; + }; + _this._onCompositionUpdate = function() { + if (isIE11()) { + _this._updateValue(_this._getCurrentInputValue(), true); + } + }; + _this._onCompositionEnd = function(ev) { + var inputValue = _this._getCurrentInputValue(); + _this._tryEnableAutofill(inputValue, _this.value, false, true); + _this.setState({ isComposing: false }); + _this._async.setTimeout(function() { + _this._updateValue(_this._getCurrentInputValue(), false); + }, 0); + }; + _this._onClick = function() { + if (_this.value && _this.value !== "" && _this._autoFillEnabled) { + _this._autoFillEnabled = false; + } + }; + _this._onKeyDown = function(ev) { + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + } + if (!ev.nativeEvent.isComposing) { + switch (ev.which) { + case KeyCodes.backspace: + _this._autoFillEnabled = false; + break; + case KeyCodes.left: + case KeyCodes.right: + if (_this._autoFillEnabled) { + _this.setState(function(prev) { + return { + inputValue: _this.props.suggestedDisplayValue || prev.inputValue + }; + }); + _this._autoFillEnabled = false; } - ] + break; + default: + if (!_this._autoFillEnabled) { + if (_this.props.enableAutofillOnKeyPress.indexOf(ev.which) !== -1) { + _this._autoFillEnabled = true; + } + } + break; + } + } + }; + _this._onInputChanged = function(ev) { + var value2 = _this._getCurrentInputValue(ev); + if (!_this.state.isComposing) { + _this._tryEnableAutofill(value2, _this.value, ev.nativeEvent.isComposing); + } + if (!(isIE11() && _this.state.isComposing)) { + var nativeEventComposing = ev.nativeEvent.isComposing; + var isComposing = nativeEventComposing === void 0 ? _this.state.isComposing : nativeEventComposing; + _this._updateValue(value2, isComposing); + } + }; + _this._onChanged = function() { + return; + }; + _this._updateValue = function(newValue, composing) { + if (!newValue && newValue === _this.value) { + return; + } + var _a2 = _this.props, onInputChange = _a2.onInputChange, onInputValueChange = _a2.onInputValueChange; + if (onInputChange) { + newValue = (onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(newValue, composing)) || ""; + } + _this.setState({ inputValue: newValue }, function() { + return onInputValueChange === null || onInputValueChange === void 0 ? void 0 : onInputValueChange(newValue, composing); + }); + }; + initializeComponentRef(_this); + _this._async = new Async(_this); + _this.state = { + inputValue: props.defaultVisibleValue || "", + isComposing: false + }; + return _this; + } + Autofill2.getDerivedStateFromProps = function(props, state) { + if (props.updateValueInWillReceiveProps) { + var updatedInputValue = props.updateValueInWillReceiveProps(); + if (updatedInputValue !== null && updatedInputValue !== state.inputValue && !state.isComposing) { + return __assign$1(__assign$1({}, state), { inputValue: updatedInputValue }); + } + } + return null; + }; + Object.defineProperty(Autofill2.prototype, "cursorLocation", { + get: function() { + if (this._inputElement.current) { + var inputElement = this._inputElement.current; + if (inputElement.selectionDirection !== SELECTION_FORWARD) { + return inputElement.selectionEnd; + } else { + return inputElement.selectionStart; + } + } else { + return -1; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "isValueSelected", { + get: function() { + return Boolean(this.inputElement && this.inputElement.selectionStart !== this.inputElement.selectionEnd); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "value", { + get: function() { + return this._getControlledValue() || this.state.inputValue || ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "selectionStart", { + get: function() { + return this._inputElement.current ? this._inputElement.current.selectionStart : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "selectionEnd", { + get: function() { + return this._inputElement.current ? this._inputElement.current.selectionEnd : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "inputElement", { + get: function() { + return this._inputElement.current; + }, + enumerable: false, + configurable: true + }); + Autofill2.prototype.componentDidUpdate = function(_, _1, cursor2) { + var _a2; + var _b2 = this.props, suggestedDisplayValue = _b2.suggestedDisplayValue, shouldSelectFullInputValueInComponentDidUpdate = _b2.shouldSelectFullInputValueInComponentDidUpdate, preventValueSelection = _b2.preventValueSelection; + var differenceIndex = 0; + if (preventValueSelection) { + return; + } + var document2 = ((_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.window.document) || getDocument(this._inputElement.current); + var isFocused = this._inputElement.current && this._inputElement.current === (document2 === null || document2 === void 0 ? void 0 : document2.activeElement); + if (isFocused && this._autoFillEnabled && this.value && suggestedDisplayValue && _doesTextStartWith(suggestedDisplayValue, this.value)) { + var shouldSelectFullRange = false; + if (shouldSelectFullInputValueInComponentDidUpdate) { + shouldSelectFullRange = shouldSelectFullInputValueInComponentDidUpdate(); + } + if (shouldSelectFullRange) { + this._inputElement.current.setSelectionRange(0, suggestedDisplayValue.length, SELECTION_BACKWARD); + } else { + while (differenceIndex < this.value.length && this.value[differenceIndex].toLocaleLowerCase() === suggestedDisplayValue[differenceIndex].toLocaleLowerCase()) { + differenceIndex++; + } + if (differenceIndex > 0) { + this._inputElement.current.setSelectionRange(differenceIndex, suggestedDisplayValue.length, SELECTION_BACKWARD); + } + } + } else if (this._inputElement.current) { + if (cursor2 !== null && !this._autoFillEnabled && !this.state.isComposing) { + this._inputElement.current.setSelectionRange(cursor2.start, cursor2.end, cursor2.dir); + } + } + }; + Autofill2.prototype.componentWillUnmount = function() { + this._async.dispose(); + }; + Autofill2.prototype.render = function() { + var nativeProps = getNativeProps(this.props, inputProperties); + var style2 = __assign$1(__assign$1({}, this.props.style), { fontFamily: "inherit" }); + return React__namespace.createElement("input", __assign$1({ autoCapitalize: "off", autoComplete: "off", "aria-autocomplete": "both" }, nativeProps, { + style: style2, + ref: this._inputElement, + value: this._getDisplayValue(), + onCompositionStart: this._onCompositionStart, + onCompositionUpdate: this._onCompositionUpdate, + onCompositionEnd: this._onCompositionEnd, + // TODO (Fabric 8?) - switch to calling only onChange. See notes in TextField._onInputChange. + onChange: this._onChanged, + onInput: this._onInputChanged, + onKeyDown: this._onKeyDown, + onClick: this.props.onClick ? this.props.onClick : this._onClick, + "data-lpignore": true + })); + }; + Autofill2.prototype.focus = function() { + this._inputElement.current && this._inputElement.current.focus(); + }; + Autofill2.prototype.clear = function() { + this._autoFillEnabled = true; + this._updateValue("", false); + this._inputElement.current && this._inputElement.current.setSelectionRange(0, 0); + }; + Autofill2.prototype.getSnapshotBeforeUpdate = function() { + var _a2, _b2; + var inel = this._inputElement.current; + if (inel && inel.selectionStart !== this.value.length) { + return { + start: (_a2 = inel.selectionStart) !== null && _a2 !== void 0 ? _a2 : inel.value.length, + end: (_b2 = inel.selectionEnd) !== null && _b2 !== void 0 ? _b2 : inel.value.length, + dir: inel.selectionDirection || "backward" + }; + } + return null; + }; + Autofill2.prototype._getCurrentInputValue = function(ev) { + if (ev && ev.target && ev.target.value) { + return ev.target.value; + } else if (this.inputElement && this.inputElement.value) { + return this.inputElement.value; + } else { + return ""; + } + }; + Autofill2.prototype._tryEnableAutofill = function(newValue, oldValue, isComposing, isComposed) { + if (!isComposing && newValue && this._inputElement.current && this._inputElement.current.selectionStart === newValue.length && !this._autoFillEnabled && (newValue.length > oldValue.length || isComposed)) { + this._autoFillEnabled = true; + } + }; + Autofill2.prototype._getDisplayValue = function() { + if (this._autoFillEnabled) { + return _getDisplayValue(this.value, this.props.suggestedDisplayValue); + } + return this.value; + }; + Autofill2.prototype._getControlledValue = function() { + var value2 = this.props.value; + if (value2 === void 0 || typeof value2 === "string") { + return value2; + } + console.warn("props.value of Autofill should be a string, but it is ".concat(value2, " with type of ").concat(typeof value2)); + return value2.toString(); + }; + Autofill2.defaultProps = { + enableAutofillOnKeyPress: [KeyCodes.down, KeyCodes.up] + }; + Autofill2.contextType = WindowContext; + return Autofill2; + })(React__namespace.Component) + ); + function _getDisplayValue(inputValue, suggestedDisplayValue) { + var displayValue2 = inputValue; + if (suggestedDisplayValue && inputValue && _doesTextStartWith(suggestedDisplayValue, displayValue2)) { + displayValue2 = suggestedDisplayValue; + } + return displayValue2; + } + function _doesTextStartWith(text2, startWith) { + if (!text2 || !startWith) { + return false; + } + return text2.toLocaleLowerCase().indexOf(startWith.toLocaleLowerCase()) === 0; + } + var getClassNames$h = classNamesFunction(); + var CheckboxBase = React__namespace.forwardRef(function(props, forwardedRef) { + var disabled = props.disabled, required2 = props.required, inputProps = props.inputProps, name = props.name, ariaLabel2 = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, ariaPositionInSet = props.ariaPositionInSet, ariaSetSize = props.ariaSetSize, title = props.title, checkmarkIconProps = props.checkmarkIconProps, styles = props.styles, theme = props.theme, className2 = props.className, _a2 = props.boxSide, boxSide = _a2 === void 0 ? "start" : _a2; + var id2 = useId("checkbox-", props.id); + var rootRef = React__namespace.useRef(null); + var mergedRootRefs = useMergedRefs(rootRef, forwardedRef); + var inputRef = React__namespace.useRef(null); + var _b2 = useControllableValue(props.checked, props.defaultChecked, props.onChange), isChecked = _b2[0], setIsChecked = _b2[1]; + var _c2 = useControllableValue(props.indeterminate, props.defaultIndeterminate), isIndeterminate = _c2[0], setIsIndeterminate = _c2[1]; + useFocusRects(rootRef); + var classNames2 = getClassNames$h(styles, { + theme, + className: className2, + disabled, + indeterminate: isIndeterminate, + checked: isChecked, + reversed: boxSide !== "start", + isUsingCustomLabelRender: !!props.onRenderLabel + }); + var onChange = React__namespace.useCallback(function(event2) { + if (isIndeterminate) { + setIsChecked(!!isChecked, event2); + setIsIndeterminate(false); + } else { + setIsChecked(!isChecked, event2); + } + }, [setIsChecked, setIsIndeterminate, isIndeterminate, isChecked]); + var defaultLabelRenderer = React__namespace.useCallback(function(checkboxProps) { + if (!checkboxProps) { + return null; + } + return checkboxProps.label ? React__namespace.createElement("span", { className: classNames2.text, title: checkboxProps.title }, checkboxProps.label) : null; + }, [classNames2.text]); + var setNativeIndeterminate = React__namespace.useCallback(function(indeterminate) { + if (!inputRef.current) { + return; + } + var value2 = !!indeterminate; + inputRef.current.indeterminate = value2; + setIsIndeterminate(value2); + }, [setIsIndeterminate]); + useComponentRef$4(props, isChecked, isIndeterminate, setNativeIndeterminate, inputRef); + React__namespace.useEffect(function() { + return setNativeIndeterminate(isIndeterminate); + }, [setNativeIndeterminate, isIndeterminate]); + var onRenderLabel = props.onRenderLabel || defaultLabelRenderer; + var ariaChecked = isIndeterminate ? "mixed" : void 0; + var mergedInputProps = __assign$1(__assign$1({ className: classNames2.input, type: "checkbox" }, inputProps), { checked: !!isChecked, disabled, required: required2, name, id: id2, title, onChange, "aria-disabled": disabled, "aria-label": ariaLabel2, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-posinset": ariaPositionInSet, "aria-setsize": ariaSetSize, "aria-checked": ariaChecked }); + return React__namespace.createElement( + "div", + { className: classNames2.root, title, ref: mergedRootRefs }, + React__namespace.createElement("input", __assign$1({}, mergedInputProps, { ref: inputRef, title, "data-ktp-execute-target": true })), + React__namespace.createElement( + "label", + { className: classNames2.label, htmlFor: id2 }, + React__namespace.createElement( + "div", + { className: classNames2.checkbox, "data-ktp-target": true }, + React__namespace.createElement(Icon, __assign$1({ iconName: "CheckMark" }, checkmarkIconProps, { className: classNames2.checkmark })) + ), + onRenderLabel(props, defaultLabelRenderer) + ) + ); + }); + CheckboxBase.displayName = "CheckboxBase"; + function useComponentRef$4(props, isChecked, isIndeterminate, setIndeterminate, checkBoxRef) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + get checked() { + return !!isChecked; + }, + get indeterminate() { + return !!isIndeterminate; + }, + set indeterminate(indeterminate) { + setIndeterminate(indeterminate); + }, + focus: function() { + if (checkBoxRef.current) { + checkBoxRef.current.focus(); + } + } + }; + }, [checkBoxRef, isChecked, isIndeterminate, setIndeterminate]); + } + var GlobalClassNames$9 = { + root: "ms-Checkbox", + label: "ms-Checkbox-label", + checkbox: "ms-Checkbox-checkbox", + checkmark: "ms-Checkbox-checkmark", + text: "ms-Checkbox-text" + }; + var MS_CHECKBOX_LABEL_SIZE = "20px"; + var MS_CHECKBOX_TRANSITION_DURATION = "200ms"; + var MS_CHECKBOX_TRANSITION_TIMING = "cubic-bezier(.4, 0, .23, 1)"; + var getStyles$g = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; + var className2 = props.className, theme = props.theme, reversed = props.reversed, checked = props.checked, disabled = props.disabled, isUsingCustomLabelRender = props.isUsingCustomLabelRender, indeterminate = props.indeterminate; + var semanticColors = theme.semanticColors, effects = theme.effects, palette = theme.palette, fonts = theme.fonts; + var classNames2 = getGlobalClassNames(GlobalClassNames$9, theme); + var checkmarkFontColor = semanticColors.inputForegroundChecked; + var checkmarkFontColorHovered = palette.neutralSecondary; + var checkboxBorderColor = palette.neutralPrimary; + var checkboxBorderIndeterminateColor = semanticColors.inputBackgroundChecked; + var checkboxBorderColorChecked = semanticColors.inputBackgroundChecked; + var checkboxBorderColorDisabled = semanticColors.disabledBodySubtext; + var checkboxBorderHoveredColor = semanticColors.inputBorderHovered; + var checkboxBorderIndeterminateHoveredColor = semanticColors.inputBackgroundCheckedHovered; + var checkboxBackgroundChecked = semanticColors.inputBackgroundChecked; + var checkboxBackgroundCheckedHovered = semanticColors.inputBackgroundCheckedHovered; + var checkboxBorderColorCheckedHovered = semanticColors.inputBackgroundCheckedHovered; + var checkboxHoveredTextColor = semanticColors.inputTextHovered; + var checkboxBackgroundDisabledChecked = semanticColors.disabledBodySubtext; + var checkboxTextColor = semanticColors.bodyText; + var checkboxTextColorDisabled = semanticColors.disabledText; + var indeterminateDotStyles = [ + (_a2 = { + content: '""', + borderRadius: effects.roundedCorner2, + position: "absolute", + width: 10, + height: 10, + top: 4, + left: 4, + boxSizing: "border-box", + borderWidth: 5, + borderStyle: "solid", + borderColor: disabled ? checkboxBorderColorDisabled : checkboxBorderIndeterminateColor, + transitionProperty: "border-width, border, border-color", + transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, + transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING + }, _a2[HighContrastSelector] = { + borderColor: "WindowText" + }, _a2) + ]; + return { + root: [ + classNames2.root, + { + position: "relative", + display: "flex" + }, + reversed && "reversed", + checked && "is-checked", + !disabled && "is-enabled", + disabled && "is-disabled", + !disabled && [ + !checked && (_b2 = {}, _b2[":hover .".concat(classNames2.checkbox)] = (_c2 = { + borderColor: checkboxBorderHoveredColor + }, _c2[HighContrastSelector] = { + borderColor: "Highlight" + }, _c2), _b2[":focus .".concat(classNames2.checkbox)] = { borderColor: checkboxBorderHoveredColor }, _b2[":hover .".concat(classNames2.checkmark)] = (_d2 = { + color: checkmarkFontColorHovered, + opacity: "1" + }, _d2[HighContrastSelector] = { + color: "Highlight" + }, _d2), _b2), + checked && !indeterminate && (_e2 = {}, _e2[":hover .".concat(classNames2.checkbox)] = { + background: checkboxBackgroundCheckedHovered, + borderColor: checkboxBorderColorCheckedHovered + }, _e2[":focus .".concat(classNames2.checkbox)] = { + background: checkboxBackgroundCheckedHovered, + borderColor: checkboxBorderColorCheckedHovered + }, _e2[HighContrastSelector] = (_f = {}, _f[":hover .".concat(classNames2.checkbox)] = { + background: "Highlight", + borderColor: "Highlight" + }, _f[":focus .".concat(classNames2.checkbox)] = { + background: "Highlight" + }, _f[":focus:hover .".concat(classNames2.checkbox)] = { + background: "Highlight" + }, _f[":focus:hover .".concat(classNames2.checkmark)] = { + color: "Window" + }, _f[":hover .".concat(classNames2.checkmark)] = { + color: "Window" + }, _f), _e2), + indeterminate && (_g = {}, _g[":hover .".concat(classNames2.checkbox, ", :hover .").concat(classNames2.checkbox, ":after")] = (_h = { + borderColor: checkboxBorderIndeterminateHoveredColor + }, _h[HighContrastSelector] = { + borderColor: "WindowText" + }, _h), _g[":focus .".concat(classNames2.checkbox)] = { + borderColor: checkboxBorderIndeterminateHoveredColor + }, _g[":hover .".concat(classNames2.checkmark)] = { + opacity: "0" + }, _g), + (_j = {}, _j[":hover .".concat(classNames2.text, ", :focus .").concat(classNames2.text)] = (_k = { + color: checkboxHoveredTextColor + }, _k[HighContrastSelector] = { + color: disabled ? "GrayText" : "WindowText" + }, _k), _j) + ], + className2 + ], + input: (_l = { + position: "absolute", + background: "none", + opacity: 0 + }, // eslint-disable-next-line @fluentui/max-len + _l[".".concat(IsFocusVisibleClassName, " &:focus + label::before, :host(.").concat(IsFocusVisibleClassName, ") &:focus + label::before")] = (_m = { + outline: "1px solid " + theme.palette.neutralSecondary, + outlineOffset: "2px" + }, _m[HighContrastSelector] = { + outline: "1px solid WindowText" + }, _m), _l), + label: [ + classNames2.label, + theme.fonts.medium, + { + display: "flex", + alignItems: isUsingCustomLabelRender ? "center" : "flex-start", + cursor: disabled ? "default" : "pointer", + position: "relative", + userSelect: "none" + }, + reversed && { + flexDirection: "row-reverse", + justifyContent: "flex-end" + }, + { + "&::before": { + position: "absolute", + left: 0, + right: 0, + top: 0, + bottom: 0, + content: '""', + pointerEvents: "none" + } + } + ], + checkbox: [ + classNames2.checkbox, + (_o = { + position: "relative", + display: "flex", + flexShrink: 0, + alignItems: "center", + justifyContent: "center", + height: MS_CHECKBOX_LABEL_SIZE, + width: MS_CHECKBOX_LABEL_SIZE, + border: "1px solid ".concat(checkboxBorderColor), + borderRadius: effects.roundedCorner2, + boxSizing: "border-box", + transitionProperty: "background, border, border-color", + transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, + transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING, + /* in case the icon is bigger than the box */ + overflow: "hidden", + ":after": indeterminate ? indeterminateDotStyles : null + }, _o[HighContrastSelector] = __assign$1({ borderColor: "WindowText" }, getHighContrastNoAdjustStyle()), _o), + indeterminate && { + borderColor: checkboxBorderIndeterminateColor + }, + !reversed ? ( + // This margin on the checkbox is for backwards compat. Notably it has the effect where a customRender + // is used, there will be only a 4px margin from checkbox to label. The label by default would have + // another 4px margin for a total of 8px margin between checkbox and label. We don't combine the two + // (and move it into the text) to not incur a breaking change for everyone using custom render atm. + { + marginRight: 4 + } + ) : { + marginLeft: 4 + }, + !disabled && !indeterminate && checked && (_p = { + background: checkboxBackgroundChecked, + borderColor: checkboxBorderColorChecked + }, _p[HighContrastSelector] = { + background: "Highlight", + borderColor: "Highlight" + }, _p), + disabled && (_q = { + borderColor: checkboxBorderColorDisabled + }, _q[HighContrastSelector] = { + borderColor: "GrayText" + }, _q), + checked && disabled && (_r = { + background: checkboxBackgroundDisabledChecked, + borderColor: checkboxBorderColorDisabled + }, _r[HighContrastSelector] = { + background: "Window" + }, _r) + ], + checkmark: [ + classNames2.checkmark, + (_s = { + opacity: checked && !indeterminate ? "1" : "0", + color: checkmarkFontColor + }, _s[HighContrastSelector] = __assign$1({ color: disabled ? "GrayText" : "Window" }, getHighContrastNoAdjustStyle()), _s) + ], + text: [ + classNames2.text, + (_t = { + color: disabled ? checkboxTextColorDisabled : checkboxTextColor, + fontSize: fonts.medium.fontSize, + lineHeight: "20px" + }, _t[HighContrastSelector] = __assign$1({ color: disabled ? "GrayText" : "WindowText" }, getHighContrastNoAdjustStyle()), _t), + !reversed ? { + marginLeft: 4 + } : { + marginRight: 4 } + ] }; - var enabledFieldWithImageHoverOrFocusProperties = { - borderColor: checked ? iconOrImageChoiceBorderCheckedHoveredColor : iconOrImageChoiceBorderUncheckedHoveredColor, + }; + var Checkbox = styled(CheckboxBase, getStyles$g, void 0, { scope: "Checkbox" }); + var _a$2, _b$2; + var ComboBoxHeight = 32; + var ComboBoxLineHeight = 30; + var ComboBoxCaretDownWidth = 32; + var ComboBoxOptionHeight = 36; + var getDisabledStyles = memoizeFunction(function(theme) { + var _a2; + var semanticColors = theme.semanticColors; + return { + backgroundColor: semanticColors.disabledBackground, + color: semanticColors.disabledText, + cursor: "default", + selectors: (_a2 = { + ":after": { + borderColor: semanticColors.disabledBackground + } + }, _a2[HighContrastSelector] = { + color: "GrayText", selectors: { - ':before': { - opacity: 1, - borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor - } + ":after": { + borderColor: "GrayText" + } } + }, _a2) }; - var circleAreaProperties = [ + }); + var listOptionHighContrastStyles = { + selectors: (_a$2 = {}, _a$2[HighContrastSelector] = __assign$1({ backgroundColor: "Highlight", borderColor: "Highlight", color: "HighlightText" }, getHighContrastNoAdjustStyle()), _a$2) + }; + var inputHighContrastStyles = { + selectors: (_b$2 = {}, _b$2[HighContrastSelector] = __assign$1({ color: "WindowText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _b$2) + }; + var getOptionStyles = memoizeFunction(function(theme, customStylesForAllOptions, customOptionStylesForCurrentOption, isPending, isHidden, isSelected) { + var _a2; + var palette = theme.palette, semanticColors = theme.semanticColors; + var option = { + textHoveredColor: semanticColors.menuItemTextHovered, + textSelectedColor: palette.neutralDark, + textDisabledColor: semanticColors.disabledText, + backgroundHoveredColor: semanticColors.menuItemBackgroundHovered, + backgroundPressedColor: semanticColors.menuItemBackgroundPressed + }; + var optionStyles = { + root: [ + theme.fonts.medium, + { + backgroundColor: isPending ? option.backgroundHoveredColor : "transparent", + boxSizing: "border-box", + cursor: "pointer", + display: isHidden ? "none" : "block", + width: "100%", + height: "auto", + minHeight: ComboBoxOptionHeight, + lineHeight: "20px", + padding: "0 8px", + position: "relative", + borderWidth: "1px", + borderStyle: "solid", + borderColor: "transparent", + borderRadius: 0, + wordWrap: "break-word", + overflowWrap: "break-word", + textAlign: "left", + selectors: __assign$1(__assign$1((_a2 = {}, _a2[HighContrastSelector] = { + border: "none", + borderColor: "Background" + }, _a2), !isHidden && { + "&.ms-Checkbox": { + display: "flex", + alignItems: "center" + } + }), { "&.ms-Button--command:hover:active": { + backgroundColor: option.backgroundPressedColor + }, ".ms-Checkbox-label": { + width: "100%" + } }) + }, + isSelected ? [ + { + backgroundColor: "transparent", + color: option.textSelectedColor, + selectors: { + ":hover": [ + { + backgroundColor: option.backgroundHoveredColor + }, + listOptionHighContrastStyles + ] + } + }, + getFocusStyle(theme, { inset: -1, isFocusedOnly: false }), + listOptionHighContrastStyles + ] : [] + ], + rootHovered: { + backgroundColor: option.backgroundHoveredColor, + color: option.textHoveredColor + }, + rootFocused: { + backgroundColor: option.backgroundHoveredColor + }, + rootDisabled: { + color: option.textDisabledColor, + cursor: "default" + }, + optionText: { + overflow: "hidden", + whiteSpace: "nowrap", + textOverflow: "ellipsis", + minWidth: "0px", + maxWidth: "100%", + wordWrap: "break-word", + overflowWrap: "break-word", + display: "inline-block" + }, + optionTextWrapper: { + maxWidth: "100%", + display: "flex", + alignItems: "center" + } + }; + return concatStyleSets(optionStyles, customStylesForAllOptions, customOptionStylesForCurrentOption); + }); + var getCaretDownButtonStyles = memoizeFunction(function(theme, customStyles) { + var _a2, _b2; + var semanticColors = theme.semanticColors, fonts = theme.fonts; + var caret = { + buttonTextColor: semanticColors.bodySubtext, + buttonTextHoveredCheckedColor: semanticColors.buttonTextChecked, + buttonBackgroundHoveredColor: semanticColors.listItemBackgroundHovered, + buttonBackgroundCheckedColor: semanticColors.listItemBackgroundChecked, + buttonBackgroundCheckedHoveredColor: semanticColors.listItemBackgroundCheckedHovered + }; + var buttonHighContrastStyles = { + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ backgroundColor: "Highlight", borderColor: "Highlight", color: "HighlightText" }, getHighContrastNoAdjustStyle()), _a2) + }; + var styles = { + root: { + color: caret.buttonTextColor, + fontSize: fonts.small.fontSize, + position: "absolute", + top: 0, + height: "100%", + lineHeight: ComboBoxLineHeight, + width: ComboBoxCaretDownWidth, + textAlign: "center", + cursor: "default", + selectors: (_b2 = {}, _b2[HighContrastSelector] = __assign$1({ backgroundColor: "ButtonFace", borderColor: "ButtonText", color: "ButtonText" }, getHighContrastNoAdjustStyle()), _b2) + }, + icon: { + fontSize: fonts.small.fontSize + }, + rootHovered: [ { - content: '""', - display: 'inline-block', - backgroundColor: circleBackgroundColor, - borderWidth: 1, - borderStyle: 'solid', - borderColor: circleBorderColor, - width: choiceFieldSize, - height: choiceFieldSize, - fontWeight: 'normal', - position: 'absolute', - top: 0, - left: 0, - boxSizing: 'border-box', - transitionProperty: 'border-color', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: choiceFieldTransitionTiming, - borderRadius: '50%' - }, - disabled && { - borderColor: circleDisabledBorderColor, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'GrayText', - background: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) + backgroundColor: caret.buttonBackgroundHoveredColor, + color: caret.buttonTextHoveredCheckedColor, + cursor: "pointer" }, - checked && { - borderColor: disabled ? circleDisabledBorderColor : circleCheckedBorderColor, - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - background: 'Window', - forcedColorAdjust: 'none' - }, _b) + buttonHighContrastStyles + ], + rootPressed: [ + { + backgroundColor: caret.buttonBackgroundCheckedColor, + color: caret.buttonTextHoveredCheckedColor }, - (hasIcon || hasImage) && { - top: radioButtonSpacing, - right: radioButtonSpacing, - left: 'auto', - opacity: checked ? 1 : 0 - } - ]; - var dotAreaProperties = [ + buttonHighContrastStyles + ], + rootChecked: [ { - content: '""', - width: 0, - height: 0, - borderRadius: '50%', - position: 'absolute', - left: choiceFieldSize / 2, - right: 0, - transitionProperty: 'border-width', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: choiceFieldTransitionTiming, - boxSizing: 'border-box' + backgroundColor: caret.buttonBackgroundCheckedColor, + color: caret.buttonTextHoveredCheckedColor }, - checked && { - borderWidth: 5, - borderStyle: 'solid', - borderColor: disabled ? dotDisabledColor : dotCheckedColor, - background: dotCheckedColor, - left: 5, - top: 5, - width: 10, - height: 10, - selectors: (_c = {}, _c[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - forcedColorAdjust: 'none' - }, _c) + buttonHighContrastStyles + ], + rootCheckedHovered: [ + { + backgroundColor: caret.buttonBackgroundCheckedHoveredColor, + color: caret.buttonTextHoveredCheckedColor }, - checked && (hasIcon || hasImage) && { - top: radioButtonSpacing + radioButtonInnerSize, - right: radioButtonSpacing + radioButtonInnerSize, - left: 'auto' + buttonHighContrastStyles + ], + rootDisabled: [ + getDisabledStyles(theme), + { + position: "absolute" } + ] + }; + return concatStyleSets(styles, customStyles); + }); + var getStyles$f = memoizeFunction(function(theme, customStyles, comboBoxOptionWidth) { + var _a2, _b2, _c2, _d2, _e2, _f; + var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; + var root = { + textColor: semanticColors.inputText, + borderColor: semanticColors.inputBorder, + borderHoveredColor: semanticColors.inputBorderHovered, + borderPressedColor: semanticColors.inputFocusBorderAlt, + borderFocusedColor: semanticColors.inputFocusBorderAlt, + backgroundColor: semanticColors.inputBackground, + erroredColor: semanticColors.errorText + }; + var option = { + headerTextColor: semanticColors.menuHeader, + dividerBorderColor: semanticColors.bodyDivider + }; + var placeholderHighContrastStyles = { + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + color: "GrayText" + }, _a2) + }; + var placeholderStyles = [ + { + color: semanticColors.inputPlaceholderText + }, + placeholderHighContrastStyles ]; - return { - root: [ - classNames.root, - theme.fonts.medium, - { - display: 'flex', - alignItems: 'center', - boxSizing: 'border-box', - color: semanticColors.bodyText, - minHeight: 26, - border: 'none', - position: 'relative', - marginTop: 8, - selectors: { - '.ms-ChoiceFieldLabel': { - display: 'inline-block' - } - } - }, - !hasIcon && !hasImage && { - selectors: { - '.ms-ChoiceFieldLabel': { - paddingLeft: '26px' - } - } + var placeholderStylesHovered = [ + { + color: semanticColors.inputTextHovered + }, + placeholderHighContrastStyles + ]; + var disabledPlaceholderStyles = [ + { + color: semanticColors.disabledText + }, + placeholderHighContrastStyles + ]; + var ComboBoxRootHighContrastFocused = __assign$1(__assign$1({ color: "HighlightText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), { selectors: { + ":after": { + borderColor: "Highlight" + } + } }); + var focusBorderStyles = getInputFocusStyle(root.borderPressedColor, effects.roundedCorner2, "border", 0); + var styles = { + container: {}, + label: {}, + labelDisabled: {}, + root: [ + theme.fonts.medium, + { + boxShadow: "none", + marginLeft: "0", + paddingRight: ComboBoxCaretDownWidth, + paddingLeft: 9, + color: root.textColor, + position: "relative", + outline: "0", + userSelect: "none", + backgroundColor: root.backgroundColor, + cursor: "text", + display: "block", + height: ComboBoxHeight, + whiteSpace: "nowrap", + textOverflow: "ellipsis", + boxSizing: "border-box", + // Border-box matches Dropdown and TextField + selectors: { + ".ms-Label": { + display: "inline-block", + marginBottom: "8px" }, - hasImage && 'ms-ChoiceField--image', - hasIcon && 'ms-ChoiceField--icon', - (hasIcon || hasImage) && { - display: 'inline-flex', - fontSize: 0, - margin: '0 4px 4px 0', - paddingLeft: 0, - backgroundColor: iconOrImageChoiceBackgroundColor, - height: '100%' - } - ], - choiceFieldWrapper: [ - classNames.choiceFieldWrapper, - focused && getChoiceGroupFocusStyle(focusBorderColor, hasIcon || hasImage) - ], - // The hidden input - input: [ - classNames.input, - { - position: 'absolute', - opacity: 0, - top: 0, - right: 0, - width: '100%', - height: '100%', - margin: 0 + "&.is-open": { + selectors: (_b2 = {}, _b2[HighContrastSelector] = ComboBoxRootHighContrastFocused, _b2) }, - disabled && 'is-disabled' - ], - field: [ - classNames.field, - checked && classNames.checked, + // setting border using pseudo-element here in order to + // prevent chevron button to overlap ComboBox border under certain resolutions + ":after": { + pointerEvents: "none", + content: "''", + position: "absolute", + left: 0, + top: 0, + bottom: 0, + right: 0, + borderWidth: "1px", + borderStyle: "solid", + borderColor: root.borderColor, + borderRadius: effects.roundedCorner2 + } + } + } + ], + rootHovered: { + selectors: (_c2 = { + ":after": { + borderColor: root.borderHoveredColor + }, + ".ms-ComboBox-Input": [ { - display: 'inline-block', - cursor: 'pointer', - marginTop: 0, - position: 'relative', - verticalAlign: 'top', - userSelect: 'none', - minHeight: 20, - selectors: { - ':hover': !disabled && fieldHoverOrFocusProperties, - ':focus': !disabled && fieldHoverOrFocusProperties, - // The circle - ':before': circleAreaProperties, - // The dot - ':after': dotAreaProperties - } - }, - hasIcon && 'ms-ChoiceField--icon', - hasImage && 'ms-ChoiceField-field--image', - (hasIcon || hasImage) && { - boxSizing: 'content-box', - cursor: 'pointer', - paddingTop: 22, - margin: 0, - textAlign: 'center', - transitionProperty: 'all', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: 'ease', - border: '1px solid transparent', - justifyContent: 'center', - alignItems: 'center', - display: 'flex', - flexDirection: 'column' - }, - checked && { - borderColor: iconOrImageChoiceBorderCheckedColor - }, - (hasIcon || hasImage) && !disabled && { - selectors: { - ':hover': enabledFieldWithImageHoverOrFocusProperties, - ':focus': enabledFieldWithImageHoverOrFocusProperties - } - }, - disabled && { - cursor: 'default', - selectors: { - '.ms-ChoiceFieldLabel': { - color: semanticColors.disabledBodyText, - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _d) - } - } - }, - checked && disabled && { - borderColor: iconOrImageChoiceBackgroundColor - } - ], - innerField: [ - classNames.innerField, - hasImage && { - // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. - height: imageSize.height, - width: imageSize.width + color: semanticColors.inputTextHovered }, - (hasIcon || hasImage) && { - position: 'relative', - display: 'inline-block', - paddingLeft: 30, - paddingRight: 30 - }, - (hasIcon || hasImage) && imageIsLarge && { - paddingLeft: 24, - paddingRight: 24 - }, - (hasIcon || hasImage) && disabled && { - opacity: 0.25, - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = { - color: 'GrayText', - opacity: 1 - }, _e) - } - ], - imageWrapper: getImageWrapperStyle(false, classNames.imageWrapper, checked), - selectedImageWrapper: getImageWrapperStyle(true, classNames.imageWrapper, checked), - iconWrapper: [ - classNames.iconWrapper, - { - fontSize: iconSize, - lineHeight: iconSize, - height: iconSize - } - ], - labelWrapper: [ - classNames.labelWrapper, - fonts.medium, - (hasIcon || hasImage) && { - display: 'block', - position: 'relative', - margin: '4px 8px 2px 8px', - height: labelWrapperHeight, - lineHeight: labelWrapperLineHeight, - // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. - maxWidth: imageSize.width * 2, - overflow: 'hidden', - whiteSpace: 'pre-wrap' - } - ] + getPlaceholderStyles(placeholderStylesHovered), + inputHighContrastStyles + ] + }, _c2[HighContrastSelector] = __assign$1(__assign$1({ color: "HighlightText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), { selectors: { + ":after": { + borderColor: "Highlight" + } + } }), _c2) + }, + rootPressed: [ + { + position: "relative", + selectors: (_d2 = {}, _d2[HighContrastSelector] = ComboBoxRootHighContrastFocused, _d2) + } + ], + rootFocused: [ + { + selectors: (_e2 = { + ".ms-ComboBox-Input": [ + { + color: semanticColors.inputTextHovered + }, + inputHighContrastStyles + ] + }, _e2[HighContrastSelector] = ComboBoxRootHighContrastFocused, _e2) + }, + focusBorderStyles + ], + rootDisabled: getDisabledStyles(theme), + rootError: { + selectors: { + ":after": { + borderColor: root.erroredColor + }, + ":hover:after": { + borderColor: semanticColors.inputBorderHovered + } + } + }, + rootDisallowFreeForm: {}, + input: [ + getPlaceholderStyles(placeholderStyles), + { + backgroundColor: root.backgroundColor, + color: root.textColor, + boxSizing: "border-box", + width: "100%", + height: "100%", + borderStyle: "none", + outline: "none", + font: "inherit", + textOverflow: "ellipsis", + padding: "0", + selectors: { + "::-ms-clear": { + display: "none" + } + } + }, + inputHighContrastStyles + ], + inputDisabled: [getDisabledStyles(theme), getPlaceholderStyles(disabledPlaceholderStyles)], + errorMessage: [ + theme.fonts.small, + { + color: root.erroredColor, + marginTop: "5px" + } + ], + callout: { + boxShadow: effects.elevation8 + }, + optionsContainerWrapper: { + width: comboBoxOptionWidth + }, + optionsContainer: { + display: "block" + }, + screenReaderText: hiddenContentStyle, + header: [ + fonts.medium, + { + fontWeight: FontWeights.semibold, + color: option.headerTextColor, + backgroundColor: "none", + borderStyle: "none", + height: ComboBoxOptionHeight, + lineHeight: ComboBoxOptionHeight, + cursor: "default", + padding: "0 8px", + userSelect: "none", + textAlign: "left", + selectors: (_f = {}, _f[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _f) + } + ], + divider: { + height: 1, + backgroundColor: option.dividerBorderColor + } + }; + return concatStyleSets(styles, customStyles); + }); + var getClassNames$g = memoizeFunction(function(styles, className2, isOpen, disabled, required2, focused, allowFreeForm, hasErrorMessage) { + return { + container: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-container", className2, styles.container), + label: mergeStyles(styles.__shadowConfig__, styles.label, disabled && styles.labelDisabled), + root: mergeStyles(styles.__shadowConfig__, "ms-ComboBox", hasErrorMessage ? styles.rootError : isOpen && "is-open", required2 && "is-required", styles.root, !allowFreeForm && styles.rootDisallowFreeForm, hasErrorMessage && !focused ? styles.rootError : !disabled && focused && styles.rootFocused, !disabled && { + selectors: { + ":hover": hasErrorMessage ? styles.rootError : !isOpen && !focused && styles.rootHovered, + ":active": hasErrorMessage ? styles.rootError : styles.rootPressed, + ":focus": hasErrorMessage ? styles.rootError : styles.rootFocused + } + }, disabled && ["is-disabled", styles.rootDisabled]), + input: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-Input", styles.input, disabled && styles.inputDisabled), + errorMessage: mergeStyles(styles.__shadowConfig__, styles.errorMessage), + callout: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-callout", styles.callout), + optionsContainerWrapper: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-optionsContainerWrapper", styles.optionsContainerWrapper), + optionsContainer: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-optionsContainer", styles.optionsContainer), + header: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-header", styles.header), + divider: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-divider", styles.divider), + screenReaderText: mergeStyles(styles.__shadowConfig__, styles.screenReaderText) }; -}; - -},{"tslib":"9gizs","../../../Styling":"hTimn","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"imoN3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-ChoiceFieldGroup', - flexContainer: 'ms-ChoiceFieldGroup-flexContainer' -}; -var getStyles = function(props) { - var className = props.className, optionsContainIconOrImage = props.optionsContainIconOrImage, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + }); + var getComboBoxOptionClassNames = memoizeFunction(function(styles) { return { - root: [ - className, - classNames.root, - theme.fonts.medium, - { - display: 'block' - } - ], - flexContainer: [ - classNames.flexContainer, - optionsContainIconOrImage && { - display: 'flex', - flexDirection: 'row', - flexWrap: 'wrap' - } - ] + optionText: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-optionText", styles.optionText), + root: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-option", styles.root, { + selectors: { + ":hover": styles.rootHovered, + ":focus": styles.rootFocused, + ":active": styles.rootPressed + } + }), + optionTextWrapper: mergeStyles(styles.__shadowConfig__, styles.optionTextWrapper) }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7XnNF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ComboBox/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ComboBox/index":"4nZqV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4nZqV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _comboBox = require("./ComboBox"); -parcelHelpers.exportAll(_comboBox, exports); -var _comboBoxTypes = require("./ComboBox.types"); -parcelHelpers.exportAll(_comboBoxTypes, exports); -var _virtualizedComboBox = require("./VirtualizedComboBox"); -parcelHelpers.exportAll(_virtualizedComboBox, exports); - -},{"./ComboBox":"1FUTw","./ComboBox.types":false,"./VirtualizedComboBox":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1FUTw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ComboBox", ()=>ComboBox); -var _tslib = require("tslib"); -var _react = require("react"); -var _autofill = require("../../Autofill"); -var _utilities = require("../../Utilities"); -var _callout = require("../../Callout"); -var _checkbox = require("../../Checkbox"); -var _comboBoxStyles = require("./ComboBox.styles"); -var _comboBoxClassNames = require("./ComboBox.classNames"); -var _label = require("../../Label"); -var _selectableOption = require("../../SelectableOption"); -var _button = require("../../Button"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities1 = require("@fluentui/utilities"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var SearchDirection; -(function(SearchDirection) { - SearchDirection[SearchDirection["backward"] = -1] = "backward"; - SearchDirection[SearchDirection["none"] = 0] = "none"; - SearchDirection[SearchDirection["forward"] = 1] = "forward"; -})(SearchDirection || (SearchDirection = {})); -var HoverStatus; -(function(HoverStatus) { - /** Used when the user was hovering and has since moused out of the menu items */ HoverStatus[HoverStatus["clearAll"] = -2] = "clearAll"; - /** Default "normal" state, when no hover has happened or a hover is in progress */ HoverStatus[HoverStatus["default"] = -1] = "default"; -})(HoverStatus || (HoverStatus = {})); -var ScrollIdleDelay = 250; /* ms */ -var TouchIdleDelay = 500; /* ms */ -/** - * This is used to clear any pending autocomplete text (used when autocomplete is true and - * allowFreeform is false) - */ var ReadOnlyPendingAutoCompleteTimeout = 1000; /* ms */ -/** - * Internal component that is used to wrap all ComboBox options. - * This is used to customize when we want to re-render components, - * so we don't re-render every option every time render is executed. - */ var ComboBoxOptionWrapper = _react.memo(function(_a) { - var render = _a.render; + }); + function getAllSelectedOptions(options2, selectedIndices) { + var selectedOptions = []; + for (var _i = 0, selectedIndices_1 = selectedIndices; _i < selectedIndices_1.length; _i++) { + var index2 = selectedIndices_1[_i]; + var option = options2[index2]; + if (option) { + selectedOptions.push(option); + } + } + return selectedOptions; + } + var SelectableOptionMenuItemType; + (function(SelectableOptionMenuItemType2) { + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["Normal"] = 0] = "Normal"; + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["Divider"] = 1] = "Divider"; + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["Header"] = 2] = "Header"; + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["SelectAll"] = 3] = "SelectAll"; + })(SelectableOptionMenuItemType || (SelectableOptionMenuItemType = {})); + var SearchDirection; + (function(SearchDirection2) { + SearchDirection2[SearchDirection2["backward"] = -1] = "backward"; + SearchDirection2[SearchDirection2["none"] = 0] = "none"; + SearchDirection2[SearchDirection2["forward"] = 1] = "forward"; + })(SearchDirection || (SearchDirection = {})); + var HoverStatus; + (function(HoverStatus2) { + HoverStatus2[HoverStatus2["clearAll"] = -2] = "clearAll"; + HoverStatus2[HoverStatus2["default"] = -1] = "default"; + })(HoverStatus || (HoverStatus = {})); + var ScrollIdleDelay = 250; + var TouchIdleDelay = 500; + var ReadOnlyPendingAutoCompleteTimeout = 1e3; + var ComboBoxOptionWrapper = React__namespace.memo(function(_a2) { + var render = _a2.render; return render(); -}, function(_a, _b) { - var oldRender = _a.render, oldProps = (0, _tslib.__rest)(_a, [ - "render" - ]); - var newRender = _b.render, newProps = (0, _tslib.__rest)(_b, [ - "render" - ]); - // The render function will always be different, so we ignore that prop - return (0, _utilities.shallowCompare)(oldProps, newProps); -}); -var COMPONENT_NAME = 'ComboBox'; -var DEFAULT_PROPS = { + }, function(_a2, _b2) { + _a2.render; + var oldProps = __rest(_a2, ["render"]); + _b2.render; + var newProps = __rest(_b2, ["render"]); + return shallowCompare(oldProps, newProps); + }); + var COMPONENT_NAME$4 = "ComboBox"; + var DEFAULT_PROPS$2 = { options: [], allowFreeform: false, allowParentArrowNavigation: false, - autoComplete: 'on', - buttonIconProps: { - iconName: 'ChevronDown' - } -}; -function useOptionsState(_a) { - var options = _a.options, defaultSelectedKey = _a.defaultSelectedKey, selectedKey = _a.selectedKey; - /** The currently selected indices */ var _b = _react.useState(function() { - return getSelectedIndices(options, buildDefaultSelectedKeys(defaultSelectedKey, selectedKey)); - }), selectedIndices = _b[0], setSelectedIndices = _b[1]; - /** The options currently available for the callout */ var _c = _react.useState(options), currentOptions = _c[0], setCurrentOptions = _c[1]; - /** This value is used for the autocomplete hint value */ var _d = _react.useState(), suggestedDisplayValue = _d[0], setSuggestedDisplayValue = _d[1]; - _react.useEffect(function() { - if (selectedKey !== undefined) { - var selectedKeys = buildSelectedKeys(selectedKey); - var indices = getSelectedIndices(options, selectedKeys); - setSelectedIndices(indices); - } - setCurrentOptions(options); - }, [ - options, - selectedKey - ]); - _react.useEffect(function() { - if (selectedKey === null) setSuggestedDisplayValue(undefined); - }, [ - selectedKey - ]); + autoComplete: "on", + buttonIconProps: { iconName: "ChevronDown" } + }; + function useOptionsState(_a2) { + var options2 = _a2.options, defaultSelectedKey = _a2.defaultSelectedKey, selectedKey = _a2.selectedKey; + var _b2 = React__namespace.useState(function() { + return getSelectedIndices(options2, buildDefaultSelectedKeys(defaultSelectedKey, selectedKey)); + }), selectedIndices = _b2[0], setSelectedIndices = _b2[1]; + var _c2 = React__namespace.useState(options2), currentOptions = _c2[0], setCurrentOptions = _c2[1]; + var _d2 = React__namespace.useState(), suggestedDisplayValue = _d2[0], setSuggestedDisplayValue = _d2[1]; + React__namespace.useEffect(function() { + if (selectedKey !== void 0) { + var selectedKeys = buildSelectedKeys(selectedKey); + var indices = getSelectedIndices(options2, selectedKeys); + setSelectedIndices(indices); + } + setCurrentOptions(options2); + }, [options2, selectedKey]); + React__namespace.useEffect(function() { + if (selectedKey === null) { + setSuggestedDisplayValue(void 0); + } + }, [selectedKey]); return [ - selectedIndices, - setSelectedIndices, - currentOptions, - setCurrentOptions, - suggestedDisplayValue, - setSuggestedDisplayValue + selectedIndices, + setSelectedIndices, + currentOptions, + setCurrentOptions, + suggestedDisplayValue, + setSuggestedDisplayValue ]; -} -var ComboBox = _react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var _a = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults), ref = _a.ref, props = (0, _tslib.__rest)(_a, [ - "ref" - ]); - var rootRef = _react.useRef(null); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var _b = useOptionsState(props), selectedIndices = _b[0], setSelectedIndices = _b[1], currentOptions = _b[2], setCurrentOptions = _b[3], suggestedDisplayValue = _b[4], setSuggestedDisplayValue = _b[5]; - return _react.createElement(ComboBoxInternal, (0, _tslib.__assign)({}, props, { - hoisted: { - mergedRootRef: mergedRootRef, - rootRef: rootRef, - selectedIndices: selectedIndices, - setSelectedIndices: setSelectedIndices, - currentOptions: currentOptions, - setCurrentOptions: setCurrentOptions, - suggestedDisplayValue: suggestedDisplayValue, - setSuggestedDisplayValue: setSuggestedDisplayValue - } - })); -}); -ComboBox.displayName = COMPONENT_NAME; -/** - * Depth-first search to find the first descendant element where the match function returns true. - * @param element - element to start searching at - * @param match - the function that determines if the element is a match - * @returns the matched element or null no match was found - */ function findFirstDescendant(element, match) { - var children = (0, _utilities1.getChildren)(element); - // For loop is used because forEach cannot be stopped. - for(var index = 0; index < children.length; index++){ - var child = children[index]; - if (match(child)) return child; - var candidate = findFirstDescendant(child, match); - if (candidate) return candidate; + } + var ComboBox = React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var _a2 = getPropsWithDefaults(DEFAULT_PROPS$2, propsWithoutDefaults); + _a2.ref; + var props = __rest(_a2, ["ref"]); + var rootRef = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(rootRef, forwardedRef); + var _b2 = useOptionsState(props), selectedIndices = _b2[0], setSelectedIndices = _b2[1], currentOptions = _b2[2], setCurrentOptions = _b2[3], suggestedDisplayValue = _b2[4], setSuggestedDisplayValue = _b2[5]; + return React__namespace.createElement(ComboBoxInternal, __assign$1({}, props, { hoisted: { + mergedRootRef, + rootRef, + selectedIndices, + setSelectedIndices, + currentOptions, + setCurrentOptions, + suggestedDisplayValue, + setSuggestedDisplayValue + } })); + }); + ComboBox.displayName = COMPONENT_NAME$4; + function findFirstDescendant(element2, match2) { + var children2 = getChildren(element2); + for (var index2 = 0; index2 < children2.length; index2++) { + var child = children2[index2]; + if (match2(child)) { + return child; + } + var candidate = findFirstDescendant(child, match2); + if (candidate) { + return candidate; + } } return null; -} -var ComboBoxInternal = /** @class */ function(_super) { - (0, _tslib.__extends)(ComboBoxInternal, _super); - function ComboBoxInternal(props) { + } + var ComboBoxInternal = ( + /** @class */ + (function(_super) { + __extends(ComboBoxInternal2, _super); + function ComboBoxInternal2(props) { var _this = _super.call(this, props) || this; - /** The input aspect of the combo box */ _this._autofill = _react.createRef(); - /** The wrapping div of the input and button */ _this._comboBoxWrapper = _react.createRef(); - /** The callout element */ _this._comboBoxMenu = _react.createRef(); - /** The menu item element that is currently selected */ _this._selectedElement = _react.createRef(); - // props to prevent dismiss on scroll/resize immediately after opening + _this._autofill = React__namespace.createRef(); + _this._comboBoxWrapper = React__namespace.createRef(); + _this._comboBoxMenu = React__namespace.createRef(); + _this._selectedElement = React__namespace.createRef(); _this._overrideScrollDismiss = false; - /** - * {@inheritdoc} - */ _this.focus = function(shouldOpenOnFocus, useFocusAsync) { - if (_this.props.disabled) return; - if (_this._autofill.current) { - if (useFocusAsync) (0, _utilities.focusAsync)(_this._autofill.current); - else _this._autofill.current.focus(); - if (shouldOpenOnFocus) _this.setState({ - isOpen: true - }); + _this.focus = function(shouldOpenOnFocus, useFocusAsync) { + if (_this.props.disabled) { + return; + } + if (_this._autofill.current) { + if (useFocusAsync) { + focusAsync(_this._autofill.current); + } else { + _this._autofill.current.focus(); } - // Programmatically setting focus means that there is nothing else that needs to be done - // Focus is now contained - if (!_this._hasFocus()) _this.setState({ - focusState: 'focused' - }); + if (shouldOpenOnFocus) { + _this.setState({ + isOpen: true + }); + } + } + if (!_this._hasFocus()) { + _this.setState({ focusState: "focused" }); + } }; - /** - * Close menu callout if it is open - */ _this.dismissMenu = function() { - var isOpen = _this.state.isOpen; - isOpen && _this.setState({ - isOpen: false - }); + _this.dismissMenu = function() { + var isOpen = _this.state.isOpen; + isOpen && _this.setState({ isOpen: false }); }; - /** - * componentWillReceiveProps handler for the auto fill component - * Checks/updates the input value to set, if needed - * @param defaultVisibleValue - the defaultVisibleValue that got passed - * in to the auto fill's componentWillReceiveProps - * @returns - the updated value to set, if needed - */ _this._onUpdateValueInAutofillWillReceiveProps = function() { - var comboBox = _this._autofill.current; - if (!comboBox) return null; - if (comboBox.value === null || comboBox.value === undefined) return null; - return normalizeToString(_this._currentVisibleValue); + _this._onUpdateValueInAutofillWillReceiveProps = function() { + var comboBox = _this._autofill.current; + if (!comboBox) { + return null; + } + if (comboBox.value === null || comboBox.value === void 0) { + return null; + } + return normalizeToString(_this._currentVisibleValue); }; _this._renderComboBoxWrapper = function(multiselectAccessibleText, errorMessageId) { - var _a = _this.props, label = _a.label, disabled = _a.disabled, ariaLabel = _a.ariaLabel, _b = _a.ariaDescribedBy, ariaDescribedBy = _b === void 0 ? _this.props['aria-describedby'] : _b, required = _a.required, errorMessage = _a.errorMessage, buttonIconProps = _a.buttonIconProps, isButtonAriaHidden = _a.isButtonAriaHidden, title = _a.title, placeholderProp = _a.placeholder, tabIndex = _a.tabIndex, autofill = _a.autofill, iconButtonProps = _a.iconButtonProps, suggestedDisplayValue = _a.hoisted.suggestedDisplayValue; - var _c = _this.state, ariaActiveDescendantValue = _c.ariaActiveDescendantValue, isOpen = _c.isOpen; - // If the combo box has focus, is multiselect, and has a display string, then use that placeholder - // so that the selected items don't appear to vanish. This is not ideal but it's the only reasonable way - // to correct the behavior where the input is cleared so the user can type. If a full refactor is done, then this - // should be removed and the multiselect combo box should behave like a picker. - var placeholder = _this._hasFocus() && _this.props.multiSelect && multiselectAccessibleText ? multiselectAccessibleText : placeholderProp; - var labelledBy = [ - _this.props['aria-labelledby'], - label && _this._id + '-label' - ].join(' ').trim(); - var labelProps = { - 'aria-labelledby': labelledBy ? labelledBy : undefined, - 'aria-label': ariaLabel && !label ? ariaLabel : undefined - }; - return _react.createElement("div", { - "data-ktp-target": true, - ref: _this._comboBoxWrapper, - id: _this._id + 'wrapper', - className: _this._classNames.root, - "aria-owns": isOpen ? _this._id + '-list' : undefined - }, _react.createElement((0, _autofill.Autofill), (0, _tslib.__assign)({ - "data-ktp-execute-target": true, - "data-is-interactable": !disabled, - componentRef: _this._autofill, - id: _this._id + '-input', - className: _this._classNames.input, - type: "text", - onFocus: _this._onFocus, - onBlur: _this._onBlur, - onKeyDown: _this._onInputKeyDown, - onKeyUp: _this._onInputKeyUp, - onClick: _this._onAutofillClick, - onTouchStart: _this._onTouchStart, - onInputValueChange: _this._onInputChange, - "aria-expanded": isOpen, - "aria-autocomplete": _this._getAriaAutoCompleteValue(), - role: "combobox", - readOnly: disabled - }, labelProps, { - "aria-describedby": errorMessage !== undefined ? (0, _utilities.mergeAriaAttributeValues)(ariaDescribedBy, errorMessageId) : ariaDescribedBy, - "aria-activedescendant": ariaActiveDescendantValue, - "aria-required": required, - "aria-disabled": disabled, - "aria-controls": isOpen ? _this._id + '-list' : undefined, - spellCheck: false, - defaultVisibleValue: _this._currentVisibleValue, - suggestedDisplayValue: suggestedDisplayValue, - updateValueInWillReceiveProps: _this._onUpdateValueInAutofillWillReceiveProps, - shouldSelectFullInputValueInComponentDidUpdate: _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate, - title: title, - preventValueSelection: !_this._hasFocus(), - placeholder: placeholder, - tabIndex: disabled ? -1 : tabIndex - }, autofill)), _react.createElement((0, _button.IconButton), (0, _tslib.__assign)({ - className: 'ms-ComboBox-CaretDown-button', - styles: _this._getCaretButtonStyles(), - role: isButtonAriaHidden ? 'presentation' : undefined, - "aria-hidden": isButtonAriaHidden - }, !isButtonAriaHidden ? labelProps : undefined, { - "data-is-focusable": false, - tabIndex: -1, - onClick: _this._onComboBoxClick, - onBlur: _this._onBlur, - iconProps: buttonIconProps, - disabled: disabled, - checked: isOpen - }, iconButtonProps))); - }; - /** - * componentDidUpdate handler for the auto fill component - * - * @param defaultVisibleValue - the current defaultVisibleValue in the auto fill's componentDidUpdate - * @param suggestedDisplayValue - the current suggestedDisplayValue in the auto fill's componentDidUpdate - * @returns - should the full value of the input be selected? - * True if the defaultVisibleValue equals the suggestedDisplayValue, false otherwise - */ _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate = function() { - return _this._currentVisibleValue === _this.props.hoisted.suggestedDisplayValue; - }; - /** - * Get the correct value to pass to the input - * to show to the user based off of the current props and state - * @returns the value to pass to the input - */ _this._getVisibleValue = function() { - var _a = _this.props, text = _a.text, allowFreeform = _a.allowFreeform, allowFreeInput = _a.allowFreeInput, autoComplete = _a.autoComplete, _b = _a.hoisted, suggestedDisplayValue = _b.suggestedDisplayValue, selectedIndices = _b.selectedIndices, currentOptions = _b.currentOptions; - var _c = _this.state, currentPendingValueValidIndex = _c.currentPendingValueValidIndex, currentPendingValue = _c.currentPendingValue, isOpen = _c.isOpen; - var currentPendingIndexValid = indexWithinBounds(currentOptions, currentPendingValueValidIndex); - // If the user passed is a value prop, use that - // unless we are open and have a valid current pending index - if (!(isOpen && currentPendingIndexValid) && (text || text === '') && (currentPendingValue === null || currentPendingValue === undefined)) return text; - if (_this.props.multiSelect) { - // Multi-select - if (_this._hasFocus()) { - var index = -1; - if (autoComplete === 'on' && currentPendingIndexValid) index = currentPendingValueValidIndex; - return _this._getPendingString(currentPendingValue, currentOptions, index); - } else return _this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue); + var _a2 = _this.props, label2 = _a2.label, disabled = _a2.disabled, ariaLabel2 = _a2.ariaLabel, _b2 = _a2.ariaDescribedBy, ariaDescribedBy = _b2 === void 0 ? _this.props["aria-describedby"] : _b2, required2 = _a2.required, errorMessage = _a2.errorMessage, buttonIconProps = _a2.buttonIconProps, isButtonAriaHidden = _a2.isButtonAriaHidden, title = _a2.title, placeholderProp = _a2.placeholder, tabIndex = _a2.tabIndex, autofill = _a2.autofill, iconButtonProps = _a2.iconButtonProps, suggestedDisplayValue = _a2.hoisted.suggestedDisplayValue; + var _c2 = _this.state, ariaActiveDescendantValue = _c2.ariaActiveDescendantValue, isOpen = _c2.isOpen; + var placeholder = _this._hasFocus() && _this.props.multiSelect && multiselectAccessibleText ? multiselectAccessibleText : placeholderProp; + var labelledBy = [_this.props["aria-labelledby"], label2 && _this._id + "-label"].join(" ").trim(); + var labelProps = { + "aria-labelledby": labelledBy ? labelledBy : void 0, + "aria-label": ariaLabel2 && !label2 ? ariaLabel2 : void 0 + }; + var hasErrorMessage = errorMessage && errorMessage.length > 0 ? true : false; + return React__namespace.createElement( + "div", + { "data-ktp-target": true, ref: _this._comboBoxWrapper, id: _this._id + "wrapper", className: _this._classNames.root, "aria-owns": isOpen ? _this._id + "-list" : void 0 }, + React__namespace.createElement(Autofill, __assign$1({ "data-ktp-execute-target": true, "data-is-interactable": !disabled, componentRef: _this._autofill, id: _this._id + "-input", className: _this._classNames.input, type: "text", onFocus: _this._onFocus, onBlur: _this._onBlur, onKeyDown: _this._onInputKeyDown, onKeyUp: _this._onInputKeyUp, onClick: _this._onAutofillClick, onTouchStart: _this._onTouchStart, onInputValueChange: _this._onInputChange, "aria-expanded": isOpen, "aria-autocomplete": _this._getAriaAutoCompleteValue(), role: "combobox", readOnly: disabled }, labelProps, { + "aria-describedby": errorMessage !== void 0 ? mergeAriaAttributeValues(ariaDescribedBy, errorMessageId) : ariaDescribedBy, + "aria-activedescendant": ariaActiveDescendantValue, + "aria-required": required2, + "aria-disabled": disabled, + "aria-invalid": hasErrorMessage, + "aria-controls": isOpen ? _this._id + "-list" : void 0, + spellCheck: false, + defaultVisibleValue: _this._currentVisibleValue, + suggestedDisplayValue, + // eslint-disable-next-line @typescript-eslint/no-deprecated + updateValueInWillReceiveProps: _this._onUpdateValueInAutofillWillReceiveProps, + shouldSelectFullInputValueInComponentDidUpdate: _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate, + title, + preventValueSelection: !_this._hasFocus(), + placeholder, + tabIndex: disabled ? -1 : tabIndex + }, autofill)), + React__namespace.createElement(IconButton, __assign$1({ className: "ms-ComboBox-CaretDown-button", styles: _this._getCaretButtonStyles(), role: isButtonAriaHidden ? "presentation" : void 0, "aria-hidden": isButtonAriaHidden }, !isButtonAriaHidden ? labelProps : void 0, { "data-is-focusable": false, tabIndex: -1, onClick: _this._onComboBoxClick, onBlur: _this._onBlur, iconProps: buttonIconProps, disabled, checked: isOpen }, iconButtonProps)) + ); + }; + _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate = function() { + return _this._currentVisibleValue === _this.props.hoisted.suggestedDisplayValue; + }; + _this._getVisibleValue = function() { + var _a2 = _this.props, text2 = _a2.text, allowFreeform = _a2.allowFreeform, allowFreeInput = _a2.allowFreeInput, autoComplete = _a2.autoComplete, _b2 = _a2.hoisted, suggestedDisplayValue = _b2.suggestedDisplayValue, selectedIndices = _b2.selectedIndices, currentOptions = _b2.currentOptions; + var _c2 = _this.state, currentPendingValueValidIndex = _c2.currentPendingValueValidIndex, currentPendingValue = _c2.currentPendingValue, isOpen = _c2.isOpen; + var currentPendingIndexValid = indexWithinBounds(currentOptions, currentPendingValueValidIndex); + if (!(isOpen && currentPendingIndexValid) && (text2 || text2 === "") && (currentPendingValue === null || currentPendingValue === void 0)) { + return text2; + } + if (_this.props.multiSelect) { + if (_this._hasFocus()) { + var index2 = -1; + if (autoComplete === "on" && currentPendingIndexValid) { + index2 = currentPendingValueValidIndex; + } + return _this._getPendingString(currentPendingValue, currentOptions, index2); } else { - // Single-select - var index = _this._getFirstSelectedIndex(); - if (allowFreeform || allowFreeInput) { - // If we are allowing freeform/free input and autocomplete is also true - // and we've got a pending value that matches an option, remember - // the matched option's index - if (autoComplete === 'on' && currentPendingIndexValid) index = currentPendingValueValidIndex; - // Since we are allowing freeform, if there is currently a pending value, use that - // otherwise use the index determined above (falling back to '' if we did not get a valid index) - return _this._getPendingString(currentPendingValue, currentOptions, index); - } else { - // If we are not allowing freeform and have a valid index that matches the pending value, - // we know we will need some version of the pending value - if (currentPendingIndexValid && autoComplete === 'on') { - // If autoComplete is on, return the raw pending value, otherwise remember - // the matched option's index - index = currentPendingValueValidIndex; - return normalizeToString(currentPendingValue); - } else if (!_this.state.isOpen && currentPendingValue) return indexWithinBounds(currentOptions, index) ? currentPendingValue : normalizeToString(suggestedDisplayValue); - else return indexWithinBounds(currentOptions, index) ? getPreviewText(currentOptions[index]) : normalizeToString(suggestedDisplayValue); - } - } - }; - /** - * Handler for typing changes on the input - * @param updatedValue - the newly changed value - */ _this._onInputChange = function(updatedValue) { - if (_this.props.disabled) { - _this._handleInputWhenDisabled(null); - return; - } - if (_this.props.onInputValueChange) _this.props.onInputValueChange(updatedValue); - _this.props.allowFreeform || _this.props.allowFreeInput ? _this._processInputChangeWithFreeform(updatedValue) : _this._processInputChangeWithoutFreeform(updatedValue); - }; - /** - * Focus (and select) the content of the input - * and set the focused state - */ _this._onFocus = function() { - var _a, _b; - (_b = (_a = _this._autofill.current) === null || _a === void 0 ? void 0 : _a.inputElement) === null || _b === void 0 || _b.select(); - if (!_this._hasFocus()) _this.setState({ - focusState: 'focusing' - }); - }; - /** - * Callback issued when the options should be resolved, if they have been updated or - * if they need to be passed in the first time. This only does work if an onResolveOptions - * callback was passed in - */ _this._onResolveOptions = function() { - if (_this.props.onResolveOptions) { - // get the options - var newOptions_1 = _this.props.onResolveOptions((0, _tslib.__spreadArray)([], _this.props.hoisted.currentOptions, true)); - // Check to see if the returned value is an array, if it is update the state - // If the returned value is not an array then check to see if it's a promise or PromiseLike. - // If it is then resolve it asynchronously. - if (Array.isArray(newOptions_1)) _this.props.hoisted.setCurrentOptions(newOptions_1); - else if (newOptions_1 && newOptions_1.then) { - // Ensure that the promise will only use the callback if it was the most recent one - // and update the state when the promise returns - _this._currentPromise = newOptions_1; - newOptions_1.then(function(newOptionsFromPromise) { - if (newOptions_1 === _this._currentPromise) _this.props.hoisted.setCurrentOptions(newOptionsFromPromise); - }); + return _this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue); + } + } else { + var index2 = _this._getFirstSelectedIndex(); + if (allowFreeform || allowFreeInput) { + if (autoComplete === "on" && currentPendingIndexValid) { + index2 = currentPendingValueValidIndex; + } + return _this._getPendingString(currentPendingValue, currentOptions, index2); + } else { + if (currentPendingIndexValid && autoComplete === "on") { + index2 = currentPendingValueValidIndex; + return normalizeToString(currentPendingValue); + } else if (!_this.state.isOpen && currentPendingValue) { + return indexWithinBounds(currentOptions, index2) ? currentPendingValue : normalizeToString(suggestedDisplayValue); + } else { + return indexWithinBounds(currentOptions, index2) ? getPreviewText(currentOptions[index2]) : normalizeToString(suggestedDisplayValue); + } + } + } + }; + _this._onInputChange = function(updatedValue) { + if (_this.props.disabled) { + _this._handleInputWhenDisabled( + null + /* event */ + ); + return; + } + if (_this.props.onInputValueChange) { + _this.props.onInputValueChange(updatedValue); + } + _this.props.allowFreeform || _this.props.allowFreeInput ? _this._processInputChangeWithFreeform(updatedValue) : _this._processInputChangeWithoutFreeform(updatedValue); + }; + _this._onFocus = function() { + var _a2, _b2; + (_b2 = (_a2 = _this._autofill.current) === null || _a2 === void 0 ? void 0 : _a2.inputElement) === null || _b2 === void 0 ? void 0 : _b2.select(); + if (!_this._hasFocus()) { + _this.setState({ focusState: "focusing" }); + } + }; + _this._onResolveOptions = function() { + if (_this.props.onResolveOptions) { + var newOptions_1 = _this.props.onResolveOptions(__spreadArray([], _this.props.hoisted.currentOptions, true)); + if (Array.isArray(newOptions_1)) { + _this.props.hoisted.setCurrentOptions(newOptions_1); + } else if (newOptions_1 && newOptions_1.then) { + _this._currentPromise = newOptions_1; + newOptions_1.then(function(newOptionsFromPromise) { + if (newOptions_1 === _this._currentPromise) { + _this.props.hoisted.setCurrentOptions(newOptionsFromPromise); } + }); } + } }; - /** - * OnBlur handler. Set the focused state to false - * and submit any pending value - */ // eslint-disable-next-line deprecation/deprecation - _this._onBlur = function(event) { - var _a, _b; - var doc = (0, _dom.getDocumentEx)(_this.context); - // Do nothing if the blur is coming from something - // inside the comboBox root or the comboBox menu since - // it we are not really blurring from the whole comboBox - var relatedTarget = event.relatedTarget; - if (event.relatedTarget === null) // In IE11, due to lack of support, event.relatedTarget is always - // null making every onBlur call to be "outside" of the ComboBox - // even when it's not. Using document.activeElement is another way - // for us to be able to get what the relatedTarget without relying - // on the event + _this._onBlur = function(event2) { + var _a2, _b2; + var doc = getDocumentEx(_this.context); + var relatedTarget = event2.relatedTarget; + if (event2.relatedTarget === null) { relatedTarget = doc === null || doc === void 0 ? void 0 : doc.activeElement; - if (relatedTarget) { - var isBlurFromComboBoxTitle = (_a = _this.props.hoisted.rootRef.current) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget); - var isBlurFromComboBoxMenu = (_b = _this._comboBoxMenu.current) === null || _b === void 0 ? void 0 : _b.contains(relatedTarget); - var isBlurFromComboBoxMenuAncestor = _this._comboBoxMenu.current && (0, _utilities.findElementRecursive)(_this._comboBoxMenu.current, function(element) { - return element === relatedTarget; - }, doc); - if (isBlurFromComboBoxTitle || isBlurFromComboBoxMenu || isBlurFromComboBoxMenuAncestor) { - if (isBlurFromComboBoxMenuAncestor && _this._hasFocus() && (!_this.props.multiSelect || _this.props.allowFreeform)) _this._submitPendingValue(event); - event.preventDefault(); - event.stopPropagation(); - return; - } - } - if (_this._hasFocus()) { - _this.setState({ - focusState: 'none' - }); - if (!_this.props.multiSelect || _this.props.allowFreeform) _this._submitPendingValue(event); - } - }; - // Render Callout container and pass in list - _this._onRenderContainer = function(props, defaultRender) { - var onRenderList = props.onRenderList, calloutProps = props.calloutProps, dropdownWidth = props.dropdownWidth, dropdownMaxWidth = props.dropdownMaxWidth, _a = props.onRenderUpperContent, onRenderUpperContent = _a === void 0 ? _this._onRenderUpperContent : _a, _b = props.onRenderLowerContent, onRenderLowerContent = _b === void 0 ? _this._onRenderLowerContent : _b, useComboBoxAsMenuWidth = props.useComboBoxAsMenuWidth, persistMenu = props.persistMenu, _c = props.shouldRestoreFocus, shouldRestoreFocus = _c === void 0 ? true : _c; - var isOpen = _this.state.isOpen; - var id = _this._id; - var comboBoxMenuWidth = useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? _this._comboBoxWrapper.current.clientWidth + 2 : undefined; - return _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - isBeakVisible: false, - gapSpace: 0, - doNotLayer: false, - directionalHint: (0, _callout.DirectionalHint).bottomLeftEdge, - directionalHintFixed: false - }, calloutProps, { - onLayerMounted: _this._onLayerMounted, - className: (0, _utilities.css)(_this._classNames.callout, calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.className), - target: _this._comboBoxWrapper.current, - onDismiss: _this._onDismiss, - onMouseDown: _this._onCalloutMouseDown, - onScroll: _this._onScroll, - setInitialFocus: false, - calloutWidth: useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? comboBoxMenuWidth && comboBoxMenuWidth : dropdownWidth, - calloutMaxWidth: dropdownMaxWidth ? dropdownMaxWidth : comboBoxMenuWidth, - hidden: persistMenu ? !isOpen : undefined, - shouldRestoreFocus: shouldRestoreFocus, - // eslint-disable-next-line react/jsx-no-bind - preventDismissOnEvent: function(ev) { - return _this._preventDismissOnScrollOrResize(ev); - } - }), onRenderUpperContent(_this.props, _this._onRenderUpperContent), _react.createElement("div", { - className: _this._classNames.optionsContainerWrapper, - ref: _this._comboBoxMenu - }, onRenderList === null || onRenderList === void 0 ? void 0 : onRenderList((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - id: id - }), _this._onRenderList)), onRenderLowerContent(_this.props, _this._onRenderLowerContent)); + } + if (relatedTarget) { + var isBlurFromComboBoxTitle = (_a2 = _this.props.hoisted.rootRef.current) === null || _a2 === void 0 ? void 0 : _a2.contains(relatedTarget); + var isBlurFromComboBoxMenu = (_b2 = _this._comboBoxMenu.current) === null || _b2 === void 0 ? void 0 : _b2.contains(relatedTarget); + var isBlurFromComboBoxMenuAncestor = _this._comboBoxMenu.current && findElementRecursive(_this._comboBoxMenu.current, function(element2) { + return element2 === relatedTarget; + }, doc); + if (isBlurFromComboBoxTitle || isBlurFromComboBoxMenu || isBlurFromComboBoxMenuAncestor) { + if (isBlurFromComboBoxMenuAncestor && _this._hasFocus() && (!_this.props.multiSelect || _this.props.allowFreeform)) { + _this._submitPendingValue(event2); + } + event2.preventDefault(); + event2.stopPropagation(); + return; + } + } + if (_this._hasFocus()) { + _this.setState({ focusState: "none" }); + if (!_this.props.multiSelect || _this.props.allowFreeform) { + _this._submitPendingValue(event2); + } + } + }; + _this._onRenderContainer = function(props2, defaultRender) { + var onRenderList = props2.onRenderList, calloutProps = props2.calloutProps, dropdownWidth2 = props2.dropdownWidth, dropdownMaxWidth = props2.dropdownMaxWidth, _a2 = props2.onRenderUpperContent, onRenderUpperContent = _a2 === void 0 ? _this._onRenderUpperContent : _a2, _b2 = props2.onRenderLowerContent, onRenderLowerContent = _b2 === void 0 ? _this._onRenderLowerContent : _b2, useComboBoxAsMenuWidth = props2.useComboBoxAsMenuWidth, persistMenu = props2.persistMenu, _c2 = props2.shouldRestoreFocus, shouldRestoreFocus = _c2 === void 0 ? true : _c2; + var isOpen = _this.state.isOpen; + var id2 = _this._id; + var comboBoxMenuWidth = useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? _this._comboBoxWrapper.current.clientWidth + 2 : void 0; + return React__namespace.createElement( + Callout, + __assign$1({ isBeakVisible: false, gapSpace: 0, doNotLayer: false, directionalHint: DirectionalHint.bottomLeftEdge, directionalHintFixed: false }, calloutProps, { + onLayerMounted: _this._onLayerMounted, + className: css(_this._classNames.callout, calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.className), + target: _this._comboBoxWrapper.current, + onDismiss: _this._onDismiss, + onMouseDown: _this._onCalloutMouseDown, + onScroll: _this._onScroll, + setInitialFocus: false, + calloutWidth: useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? comboBoxMenuWidth && comboBoxMenuWidth : dropdownWidth2, + calloutMaxWidth: dropdownMaxWidth ? dropdownMaxWidth : comboBoxMenuWidth, + hidden: persistMenu ? !isOpen : void 0, + // eslint-disable-next-line @typescript-eslint/no-deprecated + shouldRestoreFocus, + // eslint-disable-next-line react/jsx-no-bind + preventDismissOnEvent: function(ev) { + return _this._preventDismissOnScrollOrResize(ev); + } + }), + onRenderUpperContent(_this.props, _this._onRenderUpperContent), + React__namespace.createElement("div", { className: _this._classNames.optionsContainerWrapper, ref: _this._comboBoxMenu }, onRenderList === null || onRenderList === void 0 ? void 0 : onRenderList(__assign$1(__assign$1({}, props2), { id: id2 }), _this._onRenderList)), + onRenderLowerContent(_this.props, _this._onRenderLowerContent) + ); }; _this._onLayerMounted = function() { - _this._onCalloutLayerMounted(); - // need to call this again here to get the correct scroll parent dimensions - // when the callout is first opened - _this._async.setTimeout(function() { - _this._scrollIntoView(); - }, 0); - if (_this.props.calloutProps && _this.props.calloutProps.onLayerMounted) _this.props.calloutProps.onLayerMounted(); + _this._onCalloutLayerMounted(); + _this._async.setTimeout(function() { + _this._scrollIntoView(); + }, 0); + if (_this.props.calloutProps && _this.props.calloutProps.onLayerMounted) { + _this.props.calloutProps.onLayerMounted(); + } }; _this._onRenderLabel = function(onRenderLabelProps) { - var _a = onRenderLabelProps.props, label = _a.label, disabled = _a.disabled, required = _a.required; - if (label) return _react.createElement((0, _label.Label), { - id: _this._id + '-label', - disabled: disabled, - required: required, - className: _this._classNames.label - }, label, onRenderLabelProps.multiselectAccessibleText && _react.createElement("span", { - className: _this._classNames.screenReaderText - }, onRenderLabelProps.multiselectAccessibleText)); - return null; - }; - // Render List of items - _this._onRenderList = function(props) { - var _a = props.onRenderItem, onRenderItem = _a === void 0 ? _this._onRenderItem : _a, label = props.label, ariaLabel = props.ariaLabel, multiSelect = props.multiSelect; - var queue = { - items: [] - }; - var renderedList = []; - var emptyQueue = function() { - var newGroup = queue.id ? [ - _react.createElement("div", { - role: "group", - key: queue.id, - "aria-labelledby": queue.id - }, queue.items) - ] : queue.items; - renderedList = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], renderedList, true), newGroup, true); - // Flush items and id - queue = { - items: [] - }; - }; - var placeRenderedOptionIntoQueue = function(item, index) { - /* - Case Header - empty queue if it's not already empty - ensure unique ID for header and set queue ID - push header into queue - Case Divider - push divider into queue if not first item - empty queue if not already empty - Default - push item into queue - */ switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - queue.items.length > 0 && emptyQueue(); - var id_1 = _this._id + item.key; - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({ - id: id_1 - }, item), { - index: index - }), _this._onRenderItem)); - queue.id = id_1; - break; - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - index > 0 && queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); - queue.items.length > 0 && emptyQueue(); - break; - default: - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); - } - }; - // Place options into the queue. Queue will be emptied anytime a Header or Divider is encountered - props.options.forEach(function(item, index) { - placeRenderedOptionIntoQueue(item, index); - }); - // Push remaining items into all renderedList - queue.items.length > 0 && emptyQueue(); - var id = _this._id; - return _react.createElement("div", { - id: id + '-list', - className: _this._classNames.optionsContainer, - "aria-labelledby": label && id + '-label', - "aria-label": ariaLabel && !label ? ariaLabel : undefined, - "aria-multiselectable": multiSelect ? 'true' : undefined, - role: "listbox" - }, renderedList); + var _a2 = onRenderLabelProps.props, label2 = _a2.label, disabled = _a2.disabled, required2 = _a2.required; + if (label2) { + return React__namespace.createElement( + Label$2, + { id: _this._id + "-label", disabled, required: required2, className: _this._classNames.label }, + label2, + onRenderLabelProps.multiselectAccessibleText && React__namespace.createElement("span", { className: _this._classNames.screenReaderText }, onRenderLabelProps.multiselectAccessibleText) + ); + } + return null; + }; + _this._onRenderList = function(props2) { + var _a2 = props2.onRenderItem, onRenderItem = _a2 === void 0 ? _this._onRenderItem : _a2, label2 = props2.label, ariaLabel2 = props2.ariaLabel, multiSelect = props2.multiSelect; + var queue = { items: [] }; + var renderedList = []; + var emptyQueue = function() { + var newGroup = queue.id ? [ + React__namespace.createElement("div", { role: "group", key: queue.id, "aria-labelledby": queue.id }, queue.items) + ] : queue.items; + renderedList = __spreadArray(__spreadArray([], renderedList, true), newGroup, true); + queue = { items: [] }; + }; + var placeRenderedOptionIntoQueue = function(item, index2) { + switch (item.itemType) { + case SelectableOptionMenuItemType.Header: + queue.items.length > 0 && emptyQueue(); + var id_1 = _this._id + item.key; + queue.items.push(onRenderItem(__assign$1(__assign$1({ id: id_1 }, item), { index: index2 }), _this._onRenderItem)); + queue.id = id_1; + break; + case SelectableOptionMenuItemType.Divider: + index2 > 0 && queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); + queue.items.length > 0 && emptyQueue(); + break; + default: + queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); + } + }; + props2.options.forEach(function(item, index2) { + placeRenderedOptionIntoQueue(item, index2); + }); + queue.items.length > 0 && emptyQueue(); + var id2 = _this._id; + return React__namespace.createElement("div", { id: id2 + "-list", className: _this._classNames.optionsContainer, "aria-labelledby": label2 && id2 + "-label", "aria-label": ariaLabel2 && !label2 ? ariaLabel2 : void 0, "aria-multiselectable": multiSelect ? "true" : void 0, role: "listbox" }, renderedList); }; - // Render items _this._onRenderItem = function(item) { - switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - return _this._renderSeparator(item); - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - return _this._renderHeader(item); - default: - return _this._renderOption(item); - } + switch (item.itemType) { + case SelectableOptionMenuItemType.Divider: + return _this._renderSeparator(item); + case SelectableOptionMenuItemType.Header: + return _this._renderHeader(item); + default: + return _this._renderOption(item); + } }; - // Default _onRenderLowerContent function returns nothing _this._onRenderLowerContent = function() { - return null; + return null; }; - // Default _onRenderUpperContent function returns nothing _this._onRenderUpperContent = function() { - return null; + return null; }; _this._renderOption = function(item) { - var _a; - var _b = _this.props.onRenderOption, onRenderOption = _b === void 0 ? _this._onRenderOptionContent : _b; - var id = (_a = item.id) !== null && _a !== void 0 ? _a : _this._id + '-list' + item.index; - var isSelected = _this._isOptionSelected(item.index); - var isChecked = _this._isOptionChecked(item.index); - var isIndeterminate = _this._isOptionIndeterminate(item.index); - var optionStyles = _this._getCurrentOptionStyles(item); - var optionClassNames = (0, _comboBoxClassNames.getComboBoxOptionClassNames)(optionStyles); - var title = item.title; - var getOptionComponent = function() { - return !_this.props.multiSelect ? _react.createElement((0, _button.CommandButton), { - id: id, - key: item.key, - "data-index": item.index, - styles: optionStyles, - checked: isSelected, - className: 'ms-ComboBox-option', - onClick: _this._onItemClick(item), - // eslint-disable-next-line react/jsx-no-bind - onMouseEnter: _this._onOptionMouseEnter.bind(_this, item.index), - // eslint-disable-next-line react/jsx-no-bind - onMouseMove: _this._onOptionMouseMove.bind(_this, item.index), - onMouseLeave: _this._onOptionMouseLeave, - role: "option", - "aria-selected": isSelected ? 'true' : 'false', - ariaLabel: item.ariaLabel, - disabled: item.disabled, - title: title - }, _react.createElement("span", { - className: optionClassNames.optionTextWrapper, - ref: isSelected ? _this._selectedElement : undefined - }, onRenderOption(item, _this._onRenderOptionContent))) : _react.createElement((0, _checkbox.Checkbox), { - id: id, - ariaLabel: item.ariaLabel, - ariaLabelledBy: item.ariaLabel ? undefined : id + '-label', - key: item.key, - styles: optionStyles, - className: 'ms-ComboBox-option', - onChange: _this._onItemClick(item), - label: item.text, - checked: isChecked, - indeterminate: isIndeterminate, - title: title, - disabled: item.disabled, - // eslint-disable-next-line react/jsx-no-bind - onRenderLabel: _this._renderCheckboxLabel.bind(_this, (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - id: id + '-label' - })), - inputProps: (0, _tslib.__assign)({ - // aria-selected should only be applied to checked items, not hovered items - 'aria-selected': isChecked ? 'true' : 'false', - role: 'option' - }, { - 'data-index': item.index, - 'data-is-focusable': true - }) - }); - }; - return _react.createElement(ComboBoxOptionWrapper, { - key: item.key, - index: item.index, - disabled: item.disabled, - isSelected: isSelected, - isChecked: isChecked, - isIndeterminate: isIndeterminate, - text: item.text, - // eslint-disable-next-line react/jsx-no-bind - render: getOptionComponent, - data: item.data + var _a2; + var _b2 = _this.props.onRenderOption, onRenderOption = _b2 === void 0 ? _this._onRenderOptionContent : _b2; + var id2 = (_a2 = item.id) !== null && _a2 !== void 0 ? _a2 : _this._id + "-list" + item.index; + var isSelected = _this._isOptionSelected(item.index); + var isChecked = _this._isOptionChecked(item.index); + var isIndeterminate = _this._isOptionIndeterminate(item.index); + var optionStyles = _this._getCurrentOptionStyles(item); + var optionClassNames = getComboBoxOptionClassNames(optionStyles); + var title = item.title; + var getOptionComponent = function() { + return !_this.props.multiSelect ? React__namespace.createElement(CommandButton, { + id: id2, + key: item.key, + "data-index": item.index, + styles: optionStyles, + checked: isSelected, + className: "ms-ComboBox-option", + onClick: _this._onItemClick(item), + // eslint-disable-next-line react/jsx-no-bind + onMouseEnter: _this._onOptionMouseEnter.bind(_this, item.index), + // eslint-disable-next-line react/jsx-no-bind + onMouseMove: _this._onOptionMouseMove.bind(_this, item.index), + onMouseLeave: _this._onOptionMouseLeave, + role: "option", + "aria-selected": isSelected ? "true" : "false", + ariaLabel: item.ariaLabel, + disabled: item.disabled, + title + }, React__namespace.createElement("span", { className: optionClassNames.optionTextWrapper, ref: isSelected ? _this._selectedElement : void 0 }, onRenderOption(item, _this._onRenderOptionContent))) : React__namespace.createElement(Checkbox, { + id: id2, + ariaLabel: item.ariaLabel, + ariaLabelledBy: item.ariaLabel ? void 0 : id2 + "-label", + key: item.key, + styles: optionStyles, + className: "ms-ComboBox-option", + onChange: _this._onItemClick(item), + label: item.text, + checked: isChecked, + indeterminate: isIndeterminate, + title, + disabled: item.disabled, + // eslint-disable-next-line react/jsx-no-bind + onRenderLabel: _this._renderCheckboxLabel.bind(_this, __assign$1(__assign$1({}, item), { id: id2 + "-label" })), + inputProps: __assign$1({ + // aria-selected should only be applied to checked items, not hovered items + "aria-selected": isChecked ? "true" : "false", + role: "option" + }, { + "data-index": item.index, + "data-is-focusable": true + }) }); - }; - /** - * Mouse clicks to headers, dividers and scrollbar should not make input lose focus - */ _this._onCalloutMouseDown = function(ev) { - ev.preventDefault(); - }; - /** - * Scroll handler for the callout to make sure the mouse events - * for updating focus are not interacting during scroll - */ _this._onScroll = function() { - var _a; - if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) { - _this._async.clearTimeout(_this._scrollIdleTimeoutId); - _this._scrollIdleTimeoutId = undefined; - } else _this._isScrollIdle = false; - if ((_a = _this.props.calloutProps) === null || _a === void 0 ? void 0 : _a.onScroll) _this.props.calloutProps.onScroll(); - _this._scrollIdleTimeoutId = _this._async.setTimeout(function() { - _this._isScrollIdle = true; - }, ScrollIdleDelay); + }; + return React__namespace.createElement(ComboBoxOptionWrapper, { + key: item.key, + index: item.index, + disabled: item.disabled, + isSelected, + isChecked, + isIndeterminate, + text: item.text, + // eslint-disable-next-line react/jsx-no-bind + render: getOptionComponent, + data: item.data + }); + }; + _this._onCalloutMouseDown = function(ev) { + ev.preventDefault(); + }; + _this._onScroll = function() { + var _a2; + if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== void 0) { + _this._async.clearTimeout(_this._scrollIdleTimeoutId); + _this._scrollIdleTimeoutId = void 0; + } else { + _this._isScrollIdle = false; + } + if ((_a2 = _this.props.calloutProps) === null || _a2 === void 0 ? void 0 : _a2.onScroll) { + _this.props.calloutProps.onScroll(); + } + _this._scrollIdleTimeoutId = _this._async.setTimeout(function() { + _this._isScrollIdle = true; + }, ScrollIdleDelay); }; _this._onRenderOptionContent = function(item) { - var optionClassNames = (0, _comboBoxClassNames.getComboBoxOptionClassNames)(_this._getCurrentOptionStyles(item)); - return _react.createElement("span", { - className: optionClassNames.optionText - }, item.text); + var optionClassNames = getComboBoxOptionClassNames(_this._getCurrentOptionStyles(item)); + return React__namespace.createElement("span", { className: optionClassNames.optionText }, item.text); }; - /* - * Render content of a multiselect item label. - * Text within the label is aria-hidden, to prevent duplicate input/label exposure - */ _this._onRenderMultiselectOptionContent = function(item) { - var optionClassNames = (0, _comboBoxClassNames.getComboBoxOptionClassNames)(_this._getCurrentOptionStyles(item)); - return _react.createElement("span", { - id: item.id, - "aria-hidden": "true", - className: optionClassNames.optionText - }, item.text); + _this._onRenderMultiselectOptionContent = function(item) { + var optionClassNames = getComboBoxOptionClassNames(_this._getCurrentOptionStyles(item)); + return React__namespace.createElement("span", { id: item.id, "aria-hidden": "true", className: optionClassNames.optionText }, item.text); }; - /** - * Handles dismissing (cancelling) the menu - */ _this._onDismiss = function() { - var onMenuDismiss = _this.props.onMenuDismiss; - if (onMenuDismiss) onMenuDismiss(); - // In persistMode we need to simulate callout layer mount - // since that only happens once. We do it on dismiss since - // it works either way. - if (_this.props.persistMenu) _this._onCalloutLayerMounted(); - // close the menu - _this._setOpenStateAndFocusOnClose(false, false); - // reset the selected index - // to the last value state - _this._resetSelectedIndex(); + _this._onDismiss = function() { + var onMenuDismiss = _this.props.onMenuDismiss; + if (onMenuDismiss) { + onMenuDismiss(); + } + if (_this.props.persistMenu) { + _this._onCalloutLayerMounted(); + } + _this._setOpenStateAndFocusOnClose( + false, + false + /* focusInputAfterClose */ + ); + _this._resetSelectedIndex(); }; _this._onAfterClearPendingInfo = function() { - _this._processingClearPendingInfo = false; - }; - /** - * Handle keydown on the input - * @param ev - The keyboard event that was fired - */ _this._onInputKeyDown = function(ev) { - var _a = _this.props, disabled = _a.disabled, allowFreeform = _a.allowFreeform, allowFreeInput = _a.allowFreeInput, allowParentArrowNavigation = _a.allowParentArrowNavigation, autoComplete = _a.autoComplete, currentOptions = _a.hoisted.currentOptions; - var _b = _this.state, isOpen = _b.isOpen, currentPendingValueValidIndexOnHover = _b.currentPendingValueValidIndexOnHover; - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in _onInputKeyUp for reasoning. - _this._lastKeyDownWasAltOrMeta = isAltOrMeta(ev); - if (disabled) { - _this._handleInputWhenDisabled(ev); + _this._processingClearPendingInfo = false; + }; + _this._onInputKeyDown = function(ev) { + var _a2 = _this.props, disabled = _a2.disabled, allowFreeform = _a2.allowFreeform, allowFreeInput = _a2.allowFreeInput, allowParentArrowNavigation = _a2.allowParentArrowNavigation, autoComplete = _a2.autoComplete, currentOptions = _a2.hoisted.currentOptions; + var _b2 = _this.state, isOpen = _b2.isOpen, currentPendingValueValidIndexOnHover = _b2.currentPendingValueValidIndexOnHover; + _this._lastKeyDownWasAltOrMeta = isAltOrMeta(ev); + if (disabled) { + _this._handleInputWhenDisabled(ev); + return; + } + var index2 = _this._getPendingSelectedIndex( + false + /* includeCurrentPendingValue */ + ); + switch (ev.which) { + case KeyCodes.enter: + if (_this._autofill.current && _this._autofill.current.inputElement) { + _this._autofill.current.inputElement.select(); + } + _this._submitPendingValue(ev); + if (_this.props.multiSelect && isOpen) { + _this.setState({ + currentPendingValueValidIndex: index2 + }); + } else { + if (isOpen || (!allowFreeform || _this.state.currentPendingValue === void 0 || _this.state.currentPendingValue === null || _this.state.currentPendingValue.length <= 0) && _this.state.currentPendingValueValidIndex < 0) { + _this.setState({ + isOpen: !isOpen + }); + } + } + break; + case KeyCodes.tab: + if (!_this.props.multiSelect) { + _this._submitPendingValue(ev); + } + if (isOpen) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + false + /* focusInputAfterClose */ + ); + } + return; + case KeyCodes.escape: + _this._resetSelectedIndex(); + if (isOpen) { + _this.setState({ + isOpen: false + }); + } else { return; - } - var index = _this._getPendingSelectedIndex(false); - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).enter: - if (_this._autofill.current && _this._autofill.current.inputElement) _this._autofill.current.inputElement.select(); - _this._submitPendingValue(ev); - if (_this.props.multiSelect && isOpen) _this.setState({ - currentPendingValueValidIndex: index - }); - else // On enter submit the pending value - if (isOpen || (!allowFreeform || _this.state.currentPendingValue === undefined || _this.state.currentPendingValue === null || _this.state.currentPendingValue.length <= 0) && _this.state.currentPendingValueValidIndex < 0) // if we are open or - // if we are not allowing freeform or - // our we have no pending value - // and no valid pending index - // flip the open state - _this.setState({ - isOpen: !isOpen - }); - break; - case (0, _utilities.KeyCodes).tab: - // On enter submit the pending value - if (!_this.props.multiSelect) _this._submitPendingValue(ev); - // If we are not allowing freeform - // or the combo box is open, flip the open state - if (isOpen) _this._setOpenStateAndFocusOnClose(!isOpen, false); - // Allow TAB to propagate - return; - case (0, _utilities.KeyCodes).escape: - // reset the selected index - _this._resetSelectedIndex(); - // Close the menu if opened - if (isOpen) _this.setState({ - isOpen: false - }); - else return; - break; - case (0, _utilities.KeyCodes).up: - // if we are in clearAll state (e.g. the user as hovering - // and has since mousedOut of the menu items), - // go to the last index - if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) index = _this.props.hoisted.currentOptions.length; - if (ev.altKey || ev.metaKey) { - // Close the menu if it is open and break so - // that the event get stopPropagation and prevent default. - // Otherwise, we need to let the event continue to propagate - if (isOpen) { - _this._setOpenStateAndFocusOnClose(!isOpen, true); - break; - } - return; - } - // do not scroll page - ev.preventDefault(); - // Go to the previous option - _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.backward); - break; - case (0, _utilities.KeyCodes).down: - // Expand the combo box on ALT + DownArrow - if (ev.altKey || ev.metaKey) _this._setOpenStateAndFocusOnClose(true, true); - else { - // if we are in clearAll state (e.g. the user as hovering - // and has since mousedOut of the menu items), - // go to the first index - if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) index = -1; - // do not scroll page - ev.preventDefault(); - // Got to the next option - _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.forward); - } - break; - case (0, _utilities.KeyCodes).home: - case (0, _utilities.KeyCodes).end: - if (allowFreeform || allowFreeInput) return; - // Set the initial values to respond to HOME - // which goes to the first selectable option - index = -1; - var directionToSearch = SearchDirection.forward; - // If end, update the values to respond to END - // which goes to the last selectable option - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).end) { - index = currentOptions.length; - directionToSearch = SearchDirection.backward; - } - _this._setPendingInfoFromIndexAndDirection(index, directionToSearch); - break; - /* eslint-disable no-fallthrough */ case (0, _utilities.KeyCodes).space: - // event handled in _onComboBoxKeyUp - if (!allowFreeform && !allowFreeInput && autoComplete === 'off') break; - default: - /* eslint-enable no-fallthrough */ // are we processing a function key? if so bail out - // eslint-disable-next-line deprecation/deprecation - if (ev.which >= 112 /* F1 */ && ev.which <= 123 /* F12 */ ) return; - // If we get here and we got either and ALT key - // or meta key, let the event propagate - // eslint-disable-next-line deprecation/deprecation - if (ev.keyCode === (0, _utilities.KeyCodes).alt || ev.key === 'Meta' /* && isOpen */ ) return; - // eslint-disable-next-line deprecation/deprecation - if (allowParentArrowNavigation && (ev.keyCode === (0, _utilities.KeyCodes).left || ev.keyCode === (0, _utilities.KeyCodes).right)) return; - // If we are not allowing freeform or free input and - // allowing autoComplete, handle the input here - if (!allowFreeform && !allowFreeInput && autoComplete === 'on') { - _this._onInputChange(ev.key); - break; - } - // allow the key to propagate by default - return; - } - ev.stopPropagation(); - ev.preventDefault(); - }; - /** - * Handle keyup on the input - * @param ev - the keyboard event that was fired - */ _this._onInputKeyUp = function(ev) { - var _a = _this.props, disabled = _a.disabled, allowFreeform = _a.allowFreeform, allowFreeInput = _a.allowFreeInput, autoComplete = _a.autoComplete; - var isOpen = _this.state.isOpen; - // We close the menu on key up only if ALL of the following are true: - // - Most recent key down was alt or meta (command) - // - The alt/meta key down was NOT followed by some other key (such as down/up arrow to - // expand/collapse the menu) - // - We're not on a Mac (or iOS) - // This is because on Windows, pressing alt moves focus to the application menu bar or similar, - // closing any open context menus. There is not a similar behavior on Macs. - var keyPressIsAltOrMetaAlone = _this._lastKeyDownWasAltOrMeta && isAltOrMeta(ev); - _this._lastKeyDownWasAltOrMeta = false; - var shouldHandleKey = keyPressIsAltOrMetaAlone && !((0, _utilities.isMac)() || (0, _utilities.isIOS)()); - if (disabled) { - _this._handleInputWhenDisabled(ev); + } + break; + case KeyCodes.up: + if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) { + index2 = _this.props.hoisted.currentOptions.length; + } + if (ev.altKey || ev.metaKey) { + if (isOpen) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + true + /* focusInputAfterClose */ + ); + break; + } return; - } - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).space: - // If we are not allowing freeform or free input, and autoComplete is off - // make space expand/collapse the combo box - // and allow the event to propagate - if (!allowFreeform && !allowFreeInput && autoComplete === 'off') _this._setOpenStateAndFocusOnClose(!isOpen, !!isOpen); - return; - default: - if (shouldHandleKey && isOpen) _this._setOpenStateAndFocusOnClose(!isOpen, true); - else { - if (_this.state.focusState === 'focusing' && _this.props.openOnKeyboardFocus) _this.setState({ - isOpen: true - }); - if (_this.state.focusState !== 'focused') _this.setState({ - focusState: 'focused' - }); - } - return; - } + } + ev.preventDefault(); + _this._setPendingInfoFromIndexAndDirection(index2, SearchDirection.backward); + break; + case KeyCodes.down: + if (ev.altKey || ev.metaKey) { + _this._setOpenStateAndFocusOnClose( + true, + true + /* focusInputAfterClose */ + ); + } else { + if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) { + index2 = -1; + } + ev.preventDefault(); + _this._setPendingInfoFromIndexAndDirection(index2, SearchDirection.forward); + } + break; + case KeyCodes.home: + case KeyCodes.end: + if (allowFreeform || allowFreeInput) { + return; + } + index2 = -1; + var directionToSearch = SearchDirection.forward; + if (ev.which === KeyCodes.end) { + index2 = currentOptions.length; + directionToSearch = SearchDirection.backward; + } + _this._setPendingInfoFromIndexAndDirection(index2, directionToSearch); + break; + /* eslint-disable no-fallthrough */ + case KeyCodes.space: + if (!allowFreeform && !allowFreeInput && autoComplete === "off") { + break; + } + default: + if (ev.which >= 112 && ev.which <= 123) { + return; + } + if (ev.keyCode === KeyCodes.alt || ev.key === "Meta") { + return; + } + if (allowParentArrowNavigation && (ev.keyCode === KeyCodes.left || ev.keyCode === KeyCodes.right)) { + return; + } + if (!allowFreeform && !allowFreeInput && autoComplete === "on") { + _this._onInputChange(ev.key); + break; + } + return; + } + ev.stopPropagation(); + ev.preventDefault(); + }; + _this._onInputKeyUp = function(ev) { + var _a2 = _this.props, disabled = _a2.disabled, allowFreeform = _a2.allowFreeform, allowFreeInput = _a2.allowFreeInput, autoComplete = _a2.autoComplete; + var isOpen = _this.state.isOpen; + var keyPressIsAltOrMetaAlone = _this._lastKeyDownWasAltOrMeta && isAltOrMeta(ev); + _this._lastKeyDownWasAltOrMeta = false; + var shouldHandleKey = keyPressIsAltOrMetaAlone && !(isMac() || isIOS()); + if (disabled) { + _this._handleInputWhenDisabled(ev); + return; + } + switch (ev.which) { + case KeyCodes.space: + if (!allowFreeform && !allowFreeInput && autoComplete === "off") { + _this._setOpenStateAndFocusOnClose(!isOpen, !!isOpen); + } + return; + default: + if (shouldHandleKey && isOpen) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + true + /* focusInputAfterClose */ + ); + } else { + if (_this.state.focusState === "focusing" && _this.props.openOnKeyboardFocus) { + _this.setState({ isOpen: true }); + } + if (_this.state.focusState !== "focused") { + _this.setState({ focusState: "focused" }); + } + } + return; + } }; _this._onOptionMouseLeave = function() { - if (_this._shouldIgnoreMouseEvent()) return; - // Ignore the event in persistMenu mode if the callout has - // closed. This is to avoid clearing the visuals on item click. - if (_this.props.persistMenu && !_this.state.isOpen) return; - _this.setState({ - currentPendingValueValidIndexOnHover: HoverStatus.clearAll - }); - }; - /** - * Click handler for the button of the combo box and the input when not allowing freeform. - * This toggles the expand/collapse state of the combo box (if enabled). - */ _this._onComboBoxClick = function() { - var disabled = _this.props.disabled; - var isOpen = _this.state.isOpen; - if (!disabled) { - _this._setOpenStateAndFocusOnClose(!isOpen, false); - _this.setState({ - focusState: 'focused' - }); - } - }; - /** - * Click handler for the autofill. - */ _this._onAutofillClick = function() { - var _a = _this.props, disabled = _a.disabled, allowFreeform = _a.allowFreeform; - if (allowFreeform && !disabled) _this.focus(_this.state.isOpen || _this._processingTouch); - else _this._onComboBoxClick(); + if (_this._shouldIgnoreMouseEvent()) { + return; + } + if (_this.props.persistMenu && !_this.state.isOpen) { + return; + } + _this.setState({ + currentPendingValueValidIndexOnHover: HoverStatus.clearAll + }); + }; + _this._onComboBoxClick = function() { + var disabled = _this.props.disabled; + var isOpen = _this.state.isOpen; + if (!disabled) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + false + /* focusInputAfterClose */ + ); + _this.setState({ focusState: "focused" }); + } + }; + _this._onAutofillClick = function() { + var _a2 = _this.props, disabled = _a2.disabled, allowFreeform = _a2.allowFreeform; + if (allowFreeform && !disabled) { + _this.focus(_this.state.isOpen || _this._processingTouch); + } else { + _this._onComboBoxClick(); + } }; _this._onTouchStart = function() { - if (_this._comboBoxWrapper.current && !('onpointerdown' in _this._comboBoxWrapper)) _this._handleTouchAndPointerEvent(); + if (_this._comboBoxWrapper.current && !("onpointerdown" in _this._comboBoxWrapper)) { + _this._handleTouchAndPointerEvent(); + } }; _this._onPointerDown = function(ev) { - if (ev.pointerType === 'touch') { - _this._handleTouchAndPointerEvent(); - ev.preventDefault(); - ev.stopImmediatePropagation(); - } + if (ev.pointerType === "touch") { + _this._handleTouchAndPointerEvent(); + ev.preventDefault(); + ev.stopImmediatePropagation(); + } }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); - _this._events = new (0, _utilities.EventGroup)(_this); - (0, _utilities.warnMutuallyExclusive)(COMPONENT_NAME, props, { - defaultSelectedKey: 'selectedKey', - text: 'defaultSelectedKey', - selectedKey: 'value', - dropdownWidth: 'useComboBoxAsMenuWidth', - ariaLabel: 'label' - }); - _this._id = props.id || (0, _utilities.getId)('ComboBox'); + initializeComponentRef(_this); + _this._async = new Async(_this); + _this._events = new EventGroup(_this); + _this._id = props.id || getId("ComboBox"); _this._isScrollIdle = true; _this._processingTouch = false; _this._gotMouseMove = false; _this._processingClearPendingInfo = false; _this.state = { - isOpen: false, - focusState: 'none', - currentPendingValueValidIndex: -1, - currentPendingValue: undefined, - currentPendingValueValidIndexOnHover: HoverStatus.default + isOpen: false, + focusState: "none", + currentPendingValueValidIndex: -1, + currentPendingValue: void 0, + currentPendingValueValidIndexOnHover: HoverStatus.default }; return _this; - } - Object.defineProperty(ComboBoxInternal.prototype, "selectedOptions", { + } + Object.defineProperty(ComboBoxInternal2.prototype, "selectedOptions", { /** * All selected options - */ get: function() { - var _a = this.props.hoisted, currentOptions = _a.currentOptions, selectedIndices = _a.selectedIndices; - return (0, _selectableOption.getAllSelectedOptions)(currentOptions, selectedIndices); + */ + get: function() { + var _a2 = this.props.hoisted, currentOptions = _a2.currentOptions, selectedIndices = _a2.selectedIndices; + return getAllSelectedOptions(currentOptions, selectedIndices); }, enumerable: false, configurable: true - }); - ComboBoxInternal.prototype.componentDidMount = function() { + }); + ComboBoxInternal2.prototype.componentDidMount = function() { if (this._comboBoxWrapper.current && !this.props.disabled) { - // hook up resolving the options if needed on focus - this._events.on(this._comboBoxWrapper.current, 'focus', this._onResolveOptions, true); - if ('onpointerdown' in this._comboBoxWrapper.current) // For ComboBoxes, touching anywhere in the combo box should drop the dropdown, including the input element. - // This gives more hit target space for touch environments. We're setting the onpointerdown here, because React - // does not support Pointer events yet. - this._events.on(this._comboBoxWrapper.current, 'pointerdown', this._onPointerDown, true); + this._events.on(this._comboBoxWrapper.current, "focus", this._onResolveOptions, true); + if ("onpointerdown" in this._comboBoxWrapper.current) { + this._events.on(this._comboBoxWrapper.current, "pointerdown", this._onPointerDown, true); + } } - }; - ComboBoxInternal.prototype.componentDidUpdate = function(prevProps, prevState) { + }; + ComboBoxInternal2.prototype.componentDidUpdate = function(prevProps, prevState) { var _this = this; - var _a, _b, _c; - var _d = this.props, allowFreeform = _d.allowFreeform, allowFreeInput = _d.allowFreeInput, text = _d.text, onMenuOpen = _d.onMenuOpen, onMenuDismissed = _d.onMenuDismissed, _e = _d.hoisted, currentOptions = _e.currentOptions, selectedIndices = _e.selectedIndices; + var _a2, _b2, _c2; + var _d2 = this.props, allowFreeform = _d2.allowFreeform, allowFreeInput = _d2.allowFreeInput, text2 = _d2.text, onMenuOpen = _d2.onMenuOpen, onMenuDismissed = _d2.onMenuDismissed, _e2 = _d2.hoisted, currentOptions = _e2.currentOptions, selectedIndices = _e2.selectedIndices; var _f = this.state, currentPendingValue = _f.currentPendingValue, currentPendingValueValidIndex = _f.currentPendingValueValidIndex, isOpen = _f.isOpen; - // If we are newly open or are open and the pending valid index changed, - // make sure the currently selected/pending option is scrolled into view - if (isOpen && (!prevState.isOpen || prevState.currentPendingValueValidIndex !== currentPendingValueValidIndex)) // Need this timeout so that the selectedElement ref is correctly updated - this._async.setTimeout(function() { + if (isOpen && (!prevState.isOpen || prevState.currentPendingValueValidIndex !== currentPendingValueValidIndex)) { + this._async.setTimeout(function() { return _this._scrollIntoView(); - }, 0); - var doc = (0, _dom.getDocumentEx)(this.context); - // if an action is taken that put focus in the ComboBox - // and If we are open or we are just closed, shouldFocusAfterClose is set, - // but we are not the activeElement set focus on the input - if (this._hasFocus() && (isOpen || prevState.isOpen && !isOpen && this._focusInputAfterClose && this._autofill.current && (doc === null || doc === void 0 ? void 0 : doc.activeElement) !== this._autofill.current.inputElement)) this.focus(undefined /*shouldOpenOnFocus*/ , true); - // If we should focusAfterClose AND - // just opened/closed the menu OR - // are focused AND - // updated the selectedIndex with the menu closed OR - // are not allowing freeform or free input OR - // the value changed - // we need to set selection - if (this._focusInputAfterClose && (prevState.isOpen && !isOpen || this._hasFocus() && (!isOpen && !this.props.multiSelect && prevProps.hoisted.selectedIndices && selectedIndices && prevProps.hoisted.selectedIndices[0] !== selectedIndices[0] || !allowFreeform && !allowFreeInput || text !== prevProps.text))) this._onFocus(); + }, 0); + } + var doc = getDocumentEx(this.context); + if (this._hasFocus() && (isOpen || prevState.isOpen && !isOpen && this._focusInputAfterClose && this._autofill.current && (doc === null || doc === void 0 ? void 0 : doc.activeElement) !== this._autofill.current.inputElement)) { + this.focus( + void 0, + true + /*useFocusAsync*/ + ); + } + if (this._focusInputAfterClose && (prevState.isOpen && !isOpen || this._hasFocus() && (!isOpen && !this.props.multiSelect && prevProps.hoisted.selectedIndices && selectedIndices && prevProps.hoisted.selectedIndices[0] !== selectedIndices[0] || !allowFreeform && !allowFreeInput || text2 !== prevProps.text))) { + this._onFocus(); + } this._notifyPendingValueChanged(prevState); if (isOpen && !prevState.isOpen) { - // handle dismiss buffer after suggestions are opened - this._overrideScrollDismiss = true; - this._async.clearTimeout(this._overrideScrollDimissTimeout); - this._overrideScrollDimissTimeout = this._async.setTimeout(function() { - _this._overrideScrollDismiss = false; - }, 100); - onMenuOpen === null || onMenuOpen === void 0 || onMenuOpen(); - } - if (!isOpen && prevState.isOpen && onMenuDismissed) onMenuDismissed(); + this._overrideScrollDismiss = true; + this._async.clearTimeout(this._overrideScrollDimissTimeout); + this._overrideScrollDimissTimeout = this._async.setTimeout(function() { + _this._overrideScrollDismiss = false; + }, 100); + onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen(); + } + if (!isOpen && prevState.isOpen && onMenuDismissed) { + onMenuDismissed(); + } var newCurrentPendingValueValidIndex = currentPendingValueValidIndex; - var options = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); + var options2 = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); }); - // If currentOptions differs from the previous currentOptions we need to update the currentPendingValueValidIndex - // otherwise, it will be out of sync with the currentOptions. This can happen when the options are filtered. - if (!(0, _utilities.shallowCompare)(prevProps.hoisted.currentOptions, currentOptions) && currentPendingValue) newCurrentPendingValueValidIndex = this.props.allowFreeform || this.props.allowFreeInput ? this._processInputChangeWithFreeform(currentPendingValue) : this._updateAutocompleteIndexWithoutFreeform(currentPendingValue); - var descendantText = undefined; - if (isOpen && this._hasFocus() && newCurrentPendingValueValidIndex !== -1) descendantText = (_a = options[newCurrentPendingValueValidIndex].id) !== null && _a !== void 0 ? _a : this._id + '-list' + newCurrentPendingValueValidIndex; - else if (isOpen && selectedIndices.length) descendantText = (_c = (_b = options[selectedIndices[0]]) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : this._id + '-list' + selectedIndices[0]; - if (descendantText !== this.state.ariaActiveDescendantValue) this.setState({ + if (!shallowCompare(prevProps.hoisted.currentOptions, currentOptions) && currentPendingValue) { + newCurrentPendingValueValidIndex = this.props.allowFreeform || this.props.allowFreeInput ? this._processInputChangeWithFreeform(currentPendingValue) : this._updateAutocompleteIndexWithoutFreeform(currentPendingValue); + } + var descendantText = void 0; + if (isOpen && this._hasFocus() && newCurrentPendingValueValidIndex !== -1) { + descendantText = (_a2 = options2[newCurrentPendingValueValidIndex].id) !== null && _a2 !== void 0 ? _a2 : this._id + "-list" + newCurrentPendingValueValidIndex; + } else if (isOpen && selectedIndices.length) { + descendantText = (_c2 = (_b2 = options2[selectedIndices[0]]) === null || _b2 === void 0 ? void 0 : _b2.id) !== null && _c2 !== void 0 ? _c2 : this._id + "-list" + selectedIndices[0]; + } + if (descendantText !== this.state.ariaActiveDescendantValue) { + this.setState({ ariaActiveDescendantValue: descendantText - }); - }; - ComboBoxInternal.prototype.componentWillUnmount = function() { + }); + } + }; + ComboBoxInternal2.prototype.componentWillUnmount = function() { this._async.dispose(); this._events.dispose(); - }; - // Primary Render - ComboBoxInternal.prototype.render = function() { - var id = this._id; - var errorMessageId = id + '-error'; - var _a = this.props, className = _a.className, disabled = _a.disabled, required = _a.required, errorMessage = _a.errorMessage, _b = _a.onRenderContainer, onRenderContainer = _b === void 0 ? this._onRenderContainer : _b, _c = _a.onRenderLabel, onRenderLabel = _c === void 0 ? this._onRenderLabel : _c, _d = _a.onRenderList, onRenderList = _d === void 0 ? this._onRenderList : _d, _e = _a.onRenderItem, onRenderItem = _e === void 0 ? this._onRenderItem : _e, _f = _a.onRenderOption, onRenderOption = _f === void 0 ? this._onRenderOptionContent : _f, allowFreeform = _a.allowFreeform, customStyles = _a.styles, theme = _a.theme, persistMenu = _a.persistMenu, multiSelect = _a.multiSelect, _g = _a.hoisted, suggestedDisplayValue = _g.suggestedDisplayValue, selectedIndices = _g.selectedIndices, currentOptions = _g.currentOptions; + }; + ComboBoxInternal2.prototype.render = function() { + var id2 = this._id; + var errorMessageId = id2 + "-error"; + var _a2 = this.props, className2 = _a2.className, disabled = _a2.disabled, required2 = _a2.required, errorMessage = _a2.errorMessage, _b2 = _a2.onRenderContainer, onRenderContainer = _b2 === void 0 ? this._onRenderContainer : _b2, _c2 = _a2.onRenderLabel, onRenderLabel = _c2 === void 0 ? this._onRenderLabel : _c2, _d2 = _a2.onRenderList, onRenderList = _d2 === void 0 ? this._onRenderList : _d2, _e2 = _a2.onRenderItem, onRenderItem = _e2 === void 0 ? this._onRenderItem : _e2, _f = _a2.onRenderOption, onRenderOption = _f === void 0 ? this._onRenderOptionContent : _f, allowFreeform = _a2.allowFreeform, customStyles = _a2.styles, theme = _a2.theme, persistMenu = _a2.persistMenu, multiSelect = _a2.multiSelect, _g = _a2.hoisted, suggestedDisplayValue = _g.suggestedDisplayValue, selectedIndices = _g.selectedIndices, currentOptions = _g.currentOptions; var isOpen = this.state.isOpen; this._currentVisibleValue = this._getVisibleValue(); - // Single select is already accessible since the whole text is selected - // when focus enters the input. Since multiselect appears to clear the input - // it needs special accessible text - var multiselectAccessibleText = multiSelect ? this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue) : undefined; - var divProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'onChange', - 'value', - 'aria-describedby', - 'aria-labelledby' + var multiselectAccessibleText = multiSelect ? this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue) : void 0; + var divProps = getNativeProps(this.props, divProperties, [ + "onChange", + "value", + "aria-describedby", + "aria-labelledby" ]); var hasErrorMessage = errorMessage && errorMessage.length > 0 ? true : false; - this._classNames = this.props.getClassNames ? this.props.getClassNames(theme, !!isOpen, !!disabled, !!required, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage, className) : (0, _comboBoxClassNames.getClassNames)((0, _comboBoxStyles.getStyles)(theme, customStyles), className, !!isOpen, !!disabled, !!required, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage); + this._classNames = this.props.getClassNames ? this.props.getClassNames(theme, !!isOpen, !!disabled, !!required2, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage, className2) : getClassNames$g(getStyles$f(theme, customStyles), className2, !!isOpen, !!disabled, !!required2, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage); var comboBoxWrapper = this._renderComboBoxWrapper(multiselectAccessibleText, errorMessageId); - return _react.createElement("div", (0, _tslib.__assign)({}, divProps, { - ref: this.props.hoisted.mergedRootRef, - className: this._classNames.container - }), onRenderLabel({ - props: this.props, - multiselectAccessibleText: multiselectAccessibleText - }, this._onRenderLabel), comboBoxWrapper, (persistMenu || isOpen) && onRenderContainer((0, _tslib.__assign)((0, _tslib.__assign)({}, this.props), { - onRenderList: onRenderList, - onRenderItem: onRenderItem, - onRenderOption: onRenderOption, - options: currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }), - onDismiss: this._onDismiss - }), this._onRenderContainer), hasErrorMessage && _react.createElement("div", { - role: "alert", - id: errorMessageId, - className: this._classNames.errorMessage - }, errorMessage)); - }; - ComboBoxInternal.prototype._getPendingString = function(currentPendingValue, currentOptions, index) { - return currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValue : indexWithinBounds(currentOptions, index) ? getPreviewText(currentOptions[index]) : ''; - }; - /** - * Returns a string that concatenates all of the selected values - * for multiselect combo box. - */ ComboBoxInternal.prototype._getMultiselectDisplayString = function(selectedIndices, currentOptions, suggestedDisplayValue) { + return React__namespace.createElement( + "div", + __assign$1({}, divProps, { ref: this.props.hoisted.mergedRootRef, className: this._classNames.container }), + onRenderLabel({ props: this.props, multiselectAccessibleText }, this._onRenderLabel), + comboBoxWrapper, + (persistMenu || isOpen) && onRenderContainer(__assign$1(__assign$1({}, this.props), { onRenderList, onRenderItem, onRenderOption, options: currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }), onDismiss: this._onDismiss }), this._onRenderContainer), + hasErrorMessage && React__namespace.createElement("div", { role: "alert", id: errorMessageId, className: this._classNames.errorMessage }, errorMessage) + ); + }; + ComboBoxInternal2.prototype._getPendingString = function(currentPendingValue, currentOptions, index2) { + return currentPendingValue !== null && currentPendingValue !== void 0 ? currentPendingValue : indexWithinBounds(currentOptions, index2) ? getPreviewText(currentOptions[index2]) : ""; + }; + ComboBoxInternal2.prototype._getMultiselectDisplayString = function(selectedIndices, currentOptions, suggestedDisplayValue) { var displayValues = []; - for(var idx = 0; selectedIndices && idx < selectedIndices.length; idx++){ - var index = selectedIndices[idx]; - if (currentOptions[index].itemType !== (0, _selectableOption.SelectableOptionMenuItemType).SelectAll) displayValues.push(indexWithinBounds(currentOptions, index) ? currentOptions[index].text : normalizeToString(suggestedDisplayValue)); + for (var idx = 0; selectedIndices && idx < selectedIndices.length; idx++) { + var index2 = selectedIndices[idx]; + if (currentOptions[index2].itemType !== SelectableOptionMenuItemType.SelectAll) { + displayValues.push(indexWithinBounds(currentOptions, index2) ? currentOptions[index2].text : normalizeToString(suggestedDisplayValue)); + } } - var _a = this.props.multiSelectDelimiter, multiSelectDelimiter = _a === void 0 ? ', ' : _a; + var _a2 = this.props.multiSelectDelimiter, multiSelectDelimiter = _a2 === void 0 ? ", " : _a2; return displayValues.join(multiSelectDelimiter); - }; - /** - * Do not dismiss if the window resizes or scrolls within 100ms of opening - * This prevents the Android issue where pickers immediately dismiss on open, because the keyboard appears - * @param ev - the event triggering the dismiss check - * @returns a boolean indicating whether the callout dismissal should be prevented - */ ComboBoxInternal.prototype._preventDismissOnScrollOrResize = function(ev) { - // default to passed-in preventDismiss + }; + ComboBoxInternal2.prototype._preventDismissOnScrollOrResize = function(ev) { var calloutProps = this.props.calloutProps; - if (calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.preventDismissOnEvent) return calloutProps.preventDismissOnEvent(ev); - if (this._overrideScrollDismiss && (ev.type === 'scroll' || ev.type === 'resize')) return true; + if (calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.preventDismissOnEvent) { + return calloutProps.preventDismissOnEvent(ev); + } + if (this._overrideScrollDismiss && (ev.type === "scroll" || ev.type === "resize")) { + return true; + } return false; - }; - /** - * Process the new input's new value when the combo box allows freeform entry - * @param updatedValue - the input's newly changed value - * @returns the index of the matched option, -1 if no match was found - */ ComboBoxInternal.prototype._processInputChangeWithFreeform = function(updatedValue) { + }; + ComboBoxInternal2.prototype._processInputChangeWithFreeform = function(updatedValue) { var _this = this; var currentOptions = this.props.hoisted.currentOptions; var newCurrentPendingValueValidIndex = -1; - // if the new value is empty, see if we have an exact match and then set the pending info - if (updatedValue === '') { - var items = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }).filter(function(option) { - return isNormalOption(option) && !option.disabled && getPreviewText(option) === updatedValue; - }); - // if we found a match remember the index - if (items.length === 1) newCurrentPendingValueValidIndex = items[0].index; - this._setPendingInfo(updatedValue, newCurrentPendingValueValidIndex, updatedValue); - return newCurrentPendingValueValidIndex; + if (updatedValue === "") { + var items = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }).filter(function(option) { + return isNormalOption(option) && !option.disabled && getPreviewText(option) === updatedValue; + }); + if (items.length === 1) { + newCurrentPendingValueValidIndex = items[0].index; + } + this._setPendingInfo(updatedValue, newCurrentPendingValueValidIndex, updatedValue); + return newCurrentPendingValueValidIndex; } - // Remember the original value and then make the value lowercase for comparison var originalUpdatedValue = updatedValue; - // Make the value lowercase for comparison if caseSensitive is false updatedValue = this._adjustForCaseSensitivity(updatedValue); - var newSuggestedDisplayValue = ''; - // If autoComplete is on, attempt to find a match from the available options - if (this.props.autoComplete === 'on') { - // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value - var items = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }).filter(function(option) { - return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)).indexOf(updatedValue) === 0; - }); - if (items.length > 0) { - // use ariaLabel as the value when the option is set - var text = getPreviewText(items[0]); - // If the user typed out the complete option text, we don't need any suggested display text anymore - newSuggestedDisplayValue = this._adjustForCaseSensitivity(text) !== updatedValue ? text : ''; - // remember the index of the match we found - newCurrentPendingValueValidIndex = items[0].index; - } + var newSuggestedDisplayValue = ""; + if (this.props.autoComplete === "on") { + var items = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }).filter(function(option) { + return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)).indexOf(updatedValue) === 0; + }); + if (items.length > 0) { + var text2 = getPreviewText(items[0]); + newSuggestedDisplayValue = this._adjustForCaseSensitivity(text2) !== updatedValue ? text2 : ""; + newCurrentPendingValueValidIndex = items[0].index; + } } else { - // If autoComplete is off, attempt to find a match only when the value is exactly equal to the text of an option - var items = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }).filter(function(option) { - return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)) === updatedValue; - }); - // if we found a match remember the index - if (items.length === 1) newCurrentPendingValueValidIndex = items[0].index; + var items = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }).filter(function(option) { + return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)) === updatedValue; + }); + if (items.length === 1) { + newCurrentPendingValueValidIndex = items[0].index; + } } - // Set the updated state this._setPendingInfo(originalUpdatedValue, newCurrentPendingValueValidIndex, newSuggestedDisplayValue); return newCurrentPendingValueValidIndex; - }; - /** - * Process the new input's new value when the combo box does not allow freeform entry - * @param updatedValue - the input's newly changed value - * @returns the index of the matched option - */ ComboBoxInternal.prototype._processInputChangeWithoutFreeform = function(updatedValue) { + }; + ComboBoxInternal2.prototype._processInputChangeWithoutFreeform = function(updatedValue) { var _this = this; - var _a = this.state, currentPendingValue = _a.currentPendingValue, currentPendingValueValidIndex = _a.currentPendingValueValidIndex; - if (this.props.autoComplete === 'on') // If autoComplete is on while allow freeform is off, - // we will remember the key press and build up a string to attempt to match - // as long as characters are typed within a the timeout span of each other, - // otherwise we will clear the string and start building a new one on the next keypress. - // Also, only do this processing if we have a non-empty value - { - if (updatedValue !== '') { - // If we have a pending autocomplete clearing task, - // we know that the user is typing with key press happening - // within the timeout of each other so remove the clearing task - // and continue building the pending value with the updated value - if (this._autoCompleteTimeout) { - this._async.clearTimeout(this._autoCompleteTimeout); - this._autoCompleteTimeout = undefined; - updatedValue = normalizeToString(currentPendingValue) + updatedValue; - } - var matchingIndex = this._updateAutocompleteIndexWithoutFreeform(updatedValue); - // Schedule a timeout to clear the pending value after the timeout span - this._autoCompleteTimeout = this._async.setTimeout(function() { - _this._autoCompleteTimeout = undefined; - }, ReadOnlyPendingAutoCompleteTimeout); - return matchingIndex; - } - } - // If we get here, autoComplete is off. - // Remember we are not allowing freeform, so at this point, if we have a pending valid value index - // use that; otherwise use the selectedIndex - var index = currentPendingValueValidIndex >= 0 ? currentPendingValueValidIndex : this._getFirstSelectedIndex(); - // Since we are not allowing freeform, we need to - // set both the pending and suggested values/index - // to allow us to select all content in the input to - // give the illusion that we are readonly (e.g. freeform off) - this._setPendingInfoFromIndex(index); - return index; - }; - ComboBoxInternal.prototype._updateAutocompleteIndexWithoutFreeform = function(updatedValue) { + var _a2 = this.state, currentPendingValue = _a2.currentPendingValue, currentPendingValueValidIndex = _a2.currentPendingValueValidIndex; + if (this.props.autoComplete === "on") { + if (updatedValue !== "") { + if (this._autoCompleteTimeout) { + this._async.clearTimeout(this._autoCompleteTimeout); + this._autoCompleteTimeout = void 0; + updatedValue = normalizeToString(currentPendingValue) + updatedValue; + } + var matchingIndex = this._updateAutocompleteIndexWithoutFreeform(updatedValue); + this._autoCompleteTimeout = this._async.setTimeout(function() { + _this._autoCompleteTimeout = void 0; + }, ReadOnlyPendingAutoCompleteTimeout); + return matchingIndex; + } + } + var index2 = currentPendingValueValidIndex >= 0 ? currentPendingValueValidIndex : this._getFirstSelectedIndex(); + this._setPendingInfoFromIndex(index2); + return index2; + }; + ComboBoxInternal2.prototype._updateAutocompleteIndexWithoutFreeform = function(updatedValue) { var _this = this; var currentOptions = this.props.hoisted.currentOptions; var originalUpdatedValue = updatedValue; updatedValue = this._adjustForCaseSensitivity(updatedValue); - // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value var items = currentOptions.map(function(item, i) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: i - }); + return __assign$1(__assign$1({}, item), { index: i }); }).filter(function(option) { - return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(option.text).indexOf(updatedValue) === 0; + return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(option.text).indexOf(updatedValue) === 0; }); - // If we found a match, update the state if (items.length > 0) { - this._setPendingInfo(originalUpdatedValue, items[0].index, getPreviewText(items[0])); - return items[0].index; + this._setPendingInfo(originalUpdatedValue, items[0].index, getPreviewText(items[0])); + return items[0].index; } return -1; - }; - ComboBoxInternal.prototype._getFirstSelectedIndex = function() { + }; + ComboBoxInternal2.prototype._getFirstSelectedIndex = function() { var selectedIndices = this.props.hoisted.selectedIndices; return (selectedIndices === null || selectedIndices === void 0 ? void 0 : selectedIndices.length) ? selectedIndices[0] : -1; - }; - /** - * Walk along the options starting at the index, stepping by the delta (positive or negative) - * looking for the next valid selectable index (e.g. skipping headings and dividers) - * @param index - the index to get the next selectable index from - * @param delta - optional delta to step by when finding the next index, defaults to 0 - * @returns - the next valid selectable index. If the new index is outside of the bounds, - * it will snap to the edge of the options array. If delta == 0 and the given index is not selectable - */ ComboBoxInternal.prototype._getNextSelectableIndex = function(index, searchDirection) { + }; + ComboBoxInternal2.prototype._getNextSelectableIndex = function(index2, searchDirection) { var currentOptions = this.props.hoisted.currentOptions; - var newIndex = index + searchDirection; + var newIndex = index2 + searchDirection; newIndex = Math.max(0, Math.min(currentOptions.length - 1, newIndex)); - if (!indexWithinBounds(currentOptions, newIndex)) return -1; + if (!indexWithinBounds(currentOptions, newIndex)) { + return -1; + } var option = currentOptions[newIndex]; if (!isSelectableOption(option) || option.hidden === true) { - // Should we continue looking for an index to select? - if (searchDirection !== SearchDirection.none && (newIndex > 0 && searchDirection < SearchDirection.none || newIndex >= 0 && newIndex < currentOptions.length && searchDirection > SearchDirection.none)) newIndex = this._getNextSelectableIndex(newIndex, searchDirection); - else // If we cannot perform a useful search just return the index we were given - return index; + if (searchDirection !== SearchDirection.none && (newIndex > 0 && searchDirection < SearchDirection.none || newIndex >= 0 && newIndex < currentOptions.length && searchDirection > SearchDirection.none)) { + newIndex = this._getNextSelectableIndex(newIndex, searchDirection); + } else { + return index2; + } } - // We have the next valid selectable index, return it return newIndex; - }; - /** - * Set the selected index. Note, this is - * the "real" selected index, not the pending selected index - * @param index - the index to set (or the index to set from if a search direction is provided) - * @param searchDirection - the direction to search along the options from the given index - */ ComboBoxInternal.prototype._setSelectedIndex = function(index, submitPendingValueEvent, searchDirection) { - if (searchDirection === void 0) searchDirection = SearchDirection.none; - var _a = this.props, onChange = _a.onChange, onPendingValueChanged = _a.onPendingValueChanged, _b = _a.hoisted, initialIndices = _b.selectedIndices, currentOptions = _b.currentOptions; - // Clone currentOptions and selectedIndices so we don't mutate state + }; + ComboBoxInternal2.prototype._setSelectedIndex = function(index2, submitPendingValueEvent, searchDirection) { + if (searchDirection === void 0) { + searchDirection = SearchDirection.none; + } + var _a2 = this.props, onChange = _a2.onChange, onPendingValueChanged = _a2.onPendingValueChanged, _b2 = _a2.hoisted, initialIndices = _b2.selectedIndices, currentOptions = _b2.currentOptions; var selectedIndices = initialIndices ? initialIndices.slice() : []; var changedOptions = currentOptions.slice(); - // Find the next selectable index, if searchDirection is none - // we will get our starting index back - index = this._getNextSelectableIndex(index, searchDirection); - if (!indexWithinBounds(currentOptions, index)) return; - // Are we at a new index? If so, update the state, otherwise - // there is nothing to do - if (this.props.multiSelect || selectedIndices.length < 1 || selectedIndices.length === 1 && selectedIndices[0] !== index) { - var option = (0, _tslib.__assign)({}, currentOptions[index]); - // if option doesn't existing, or option is disabled, we noop - if (!option || option.disabled) return; - if (this.props.multiSelect) { - // Setting the initial state of option.selected in Multi-select combo box by checking the - // selectedIndices array and overriding the undefined issue - option.selected = option.selected !== undefined ? !option.selected : selectedIndices.indexOf(index) < 0; - // handle changing all options if SelectAll is changed - if (option.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll) { - selectedIndices = []; - // if select all is set to checked, push all selectable option indices - if (option.selected) currentOptions.forEach(function(currentOption, i) { - if (!currentOption.disabled && isSelectableOption(currentOption)) { - selectedIndices.push(i); - changedOptions[i] = (0, _tslib.__assign)((0, _tslib.__assign)({}, currentOption), { - selected: true - }); - } - }); - else changedOptions = currentOptions.map(function(currentOption) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, currentOption), { - selected: false - }); - }); - } else { - if (option.selected && selectedIndices.indexOf(index) < 0) selectedIndices.push(index); - else if (!option.selected && selectedIndices.indexOf(index) >= 0) selectedIndices = selectedIndices.filter(function(value) { - return value !== index; - }); - changedOptions[index] = option; - // If SelectAll exists and another option was toggled, update the SelectAll option's state - var selectAllOption = changedOptions.filter(function(o) { - return o.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll; - })[0]; - if (selectAllOption) { - var selectAllState = this._isSelectAllChecked(selectedIndices); - var selectAllIndex_1 = changedOptions.indexOf(selectAllOption); - if (selectAllState) { - selectedIndices.push(selectAllIndex_1); - changedOptions[selectAllIndex_1] = (0, _tslib.__assign)((0, _tslib.__assign)({}, selectAllOption), { - selected: true - }); - } else { - selectedIndices = selectedIndices.filter(function(value) { - return value !== selectAllIndex_1; - }); - changedOptions[selectAllIndex_1] = (0, _tslib.__assign)((0, _tslib.__assign)({}, selectAllOption), { - selected: false - }); - } - } - } - } else selectedIndices[0] = index; - submitPendingValueEvent.persist(); - // Only setState if combo box is uncontrolled. - if (this.props.selectedKey || this.props.selectedKey === null) // If combo box value is changed, revert preview first - { - if (this._hasPendingValue && onPendingValueChanged) { - onPendingValueChanged(); - this._hasPendingValue = false; - } + index2 = this._getNextSelectableIndex(index2, searchDirection); + if (!indexWithinBounds(currentOptions, index2)) { + return; + } + if (this.props.multiSelect || selectedIndices.length < 1 || selectedIndices.length === 1 && selectedIndices[0] !== index2) { + var option = __assign$1({}, currentOptions[index2]); + if (!option || option.disabled) { + return; + } + if (this.props.multiSelect) { + option.selected = option.selected !== void 0 ? !option.selected : selectedIndices.indexOf(index2) < 0; + if (option.itemType === SelectableOptionMenuItemType.SelectAll) { + selectedIndices = []; + if (option.selected) { + currentOptions.forEach(function(currentOption, i) { + if (!currentOption.disabled && isSelectableOption(currentOption)) { + selectedIndices.push(i); + changedOptions[i] = __assign$1(__assign$1({}, currentOption), { selected: true }); + } + }); + } else { + changedOptions = currentOptions.map(function(currentOption) { + return __assign$1(__assign$1({}, currentOption), { selected: false }); + }); + } } else { - this.props.hoisted.setSelectedIndices(selectedIndices); - this.props.hoisted.setCurrentOptions(changedOptions); - // If ComboBox value is changed, revert preview first - if (this._hasPendingValue && onPendingValueChanged) { - onPendingValueChanged(); - this._hasPendingValue = false; + if (option.selected && selectedIndices.indexOf(index2) < 0) { + selectedIndices.push(index2); + } else if (!option.selected && selectedIndices.indexOf(index2) >= 0) { + selectedIndices = selectedIndices.filter(function(value2) { + return value2 !== index2; + }); + } + changedOptions[index2] = option; + var selectAllOption = changedOptions.filter(function(o) { + return o.itemType === SelectableOptionMenuItemType.SelectAll; + })[0]; + if (selectAllOption) { + var selectAllState = this._isSelectAllChecked(selectedIndices); + var selectAllIndex_1 = changedOptions.indexOf(selectAllOption); + if (selectAllState) { + selectedIndices.push(selectAllIndex_1); + changedOptions[selectAllIndex_1] = __assign$1(__assign$1({}, selectAllOption), { selected: true }); + } else { + selectedIndices = selectedIndices.filter(function(value2) { + return value2 !== selectAllIndex_1; + }); + changedOptions[selectAllIndex_1] = __assign$1(__assign$1({}, selectAllOption), { selected: false }); } - } - // Call onChange after state is updated - if (onChange) onChange(submitPendingValueEvent, option, index, getPreviewText(option)); + } + } + } else { + selectedIndices[0] = index2; + } + submitPendingValueEvent.persist(); + if (this.props.selectedKey || this.props.selectedKey === null) { + if (this._hasPendingValue && onPendingValueChanged) { + onPendingValueChanged(); + this._hasPendingValue = false; + } + } else { + this.props.hoisted.setSelectedIndices(selectedIndices); + this.props.hoisted.setCurrentOptions(changedOptions); + if (this._hasPendingValue && onPendingValueChanged) { + onPendingValueChanged(); + this._hasPendingValue = false; + } + } + if (onChange) { + onChange(submitPendingValueEvent, option, index2, getPreviewText(option)); + } + } + if (this.props.multiSelect && this.state.isOpen) { + return; } - if (this.props.multiSelect && this.state.isOpen) return; - // clear all of the pending info this._clearPendingInfo(); - }; - /** - * Submit a pending value if there is one - */ ComboBoxInternal.prototype._submitPendingValue = function(submitPendingValueEvent) { - var _a; - var _b = this.props, onChange = _b.onChange, allowFreeform = _b.allowFreeform, autoComplete = _b.autoComplete, multiSelect = _b.multiSelect, hoisted = _b.hoisted; + }; + ComboBoxInternal2.prototype._submitPendingValue = function(submitPendingValueEvent) { + var _a2; + var _b2 = this.props, onChange = _b2.onChange, allowFreeform = _b2.allowFreeform, autoComplete = _b2.autoComplete, multiSelect = _b2.multiSelect, hoisted = _b2.hoisted; var currentOptions = hoisted.currentOptions; - var _c = this.state, currentPendingValue = _c.currentPendingValue, currentPendingValueValidIndex = _c.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _c.currentPendingValueValidIndexOnHover; + var _c2 = this.state, currentPendingValue = _c2.currentPendingValue, currentPendingValueValidIndex = _c2.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _c2.currentPendingValueValidIndexOnHover; var selectedIndices = this.props.hoisted.selectedIndices; - // Do not submit any pending value if we - // have already initiated clearing the pending info - if (this._processingClearPendingInfo) return; - // If we allow freeform we need to handle that + if (this._processingClearPendingInfo) { + return; + } if (allowFreeform) { - // if currentPendingValue is null or undefined the user did not submit anything - // (not even empty because we would have stored that as the pending value) - if (currentPendingValue === null || currentPendingValue === undefined) { - // if a user did not type anything they may just hovered over an item - if (currentPendingValueValidIndexOnHover >= 0) { - this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); - this._clearPendingInfo(); - } - return; + if (currentPendingValue === null || currentPendingValue === void 0) { + if (currentPendingValueValidIndexOnHover >= 0) { + this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); + this._clearPendingInfo(); } - // Check to see if the user typed an exact match - if (indexWithinBounds(currentOptions, currentPendingValueValidIndex)) { - var pendingOptionText = this._adjustForCaseSensitivity(getPreviewText(currentOptions[currentPendingValueValidIndex])); - var autofill = this._autofill.current; - // By exact match, that means: our pending value is the same as the pending option text OR - // the pending option starts with the pending value and we have an "autoComplete" selection - // where the total length is equal to pending option length OR - // the live value in the underlying input matches the pending option; update the state - var adjustedCurrentPendingValue = this._adjustForCaseSensitivity(currentPendingValue); - if (adjustedCurrentPendingValue === pendingOptionText || autoComplete && pendingOptionText.indexOf(adjustedCurrentPendingValue) === 0 && (autofill === null || autofill === void 0 ? void 0 : autofill.isValueSelected) && currentPendingValue.length + (autofill.selectionEnd - autofill.selectionStart) === pendingOptionText.length || ((_a = autofill === null || autofill === void 0 ? void 0 : autofill.inputElement) === null || _a === void 0 ? void 0 : _a.value) !== undefined && this._adjustForCaseSensitivity(autofill.inputElement.value) === pendingOptionText) { - this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); - if (multiSelect && this.state.isOpen) return; - this._clearPendingInfo(); - return; - } + return; + } + if (indexWithinBounds(currentOptions, currentPendingValueValidIndex)) { + var pendingOptionText = this._adjustForCaseSensitivity(getPreviewText(currentOptions[currentPendingValueValidIndex])); + var autofill = this._autofill.current; + var adjustedCurrentPendingValue = this._adjustForCaseSensitivity(currentPendingValue); + if (adjustedCurrentPendingValue === pendingOptionText || autoComplete && pendingOptionText.indexOf(adjustedCurrentPendingValue) === 0 && (autofill === null || autofill === void 0 ? void 0 : autofill.isValueSelected) && currentPendingValue.length + (autofill.selectionEnd - autofill.selectionStart) === pendingOptionText.length || ((_a2 = autofill === null || autofill === void 0 ? void 0 : autofill.inputElement) === null || _a2 === void 0 ? void 0 : _a2.value) !== void 0 && this._adjustForCaseSensitivity(autofill.inputElement.value) === pendingOptionText) { + this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); + if (multiSelect && this.state.isOpen) { + return; + } + this._clearPendingInfo(); + return; } + } + if (onChange) { if (onChange) { - if (onChange) // trigger onChange to clear value - onChange(submitPendingValueEvent, undefined, undefined, currentPendingValue); - } else { - // If we are not controlled, create a new selected option - var newOption = { - key: currentPendingValue || (0, _utilities.getId)(), - text: normalizeToString(currentPendingValue) - }; - // If it's multiselect, set selected state to true - if (multiSelect) newOption.selected = true; - var newOptions = currentOptions.concat([ - newOption - ]); - if (selectedIndices) { - if (!multiSelect) selectedIndices = []; - selectedIndices.push(newOptions.length - 1); - } - hoisted.setCurrentOptions(newOptions); - hoisted.setSelectedIndices(selectedIndices); + onChange(submitPendingValueEvent, void 0, void 0, currentPendingValue); } - } else if (currentPendingValueValidIndex >= 0) // Since we are not allowing freeform, we must have a matching - // to be able to update state - this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); - else if (currentPendingValueValidIndexOnHover >= 0) // If all else failed and we were hovering over an item, select it - this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); - // Finally, clear the pending info + } else { + var newOption = { + key: currentPendingValue || getId(), + text: normalizeToString(currentPendingValue) + }; + if (multiSelect) { + newOption.selected = true; + } + var newOptions = currentOptions.concat([newOption]); + if (selectedIndices) { + if (!multiSelect) { + selectedIndices = []; + } + selectedIndices.push(newOptions.length - 1); + } + hoisted.setCurrentOptions(newOptions); + hoisted.setSelectedIndices(selectedIndices); + } + } else if (currentPendingValueValidIndex >= 0) { + this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); + } else if (currentPendingValueValidIndexOnHover >= 0) { + this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); + } this._clearPendingInfo(); - }; - ComboBoxInternal.prototype._onCalloutLayerMounted = function() { - // In persistMenu mode _onLayerMounted is only called once for the lifetime - // of the component. Any functionality required for callout "on mount" can - // go here so that we can also call it again during callout dismissal to reset - // object state. + }; + ComboBoxInternal2.prototype._onCalloutLayerMounted = function() { this._gotMouseMove = false; - }; - // Render separator - ComboBoxInternal.prototype._renderSeparator = function(item) { - var index = item.index, key = item.key; - if (index && index > 0) return _react.createElement("div", { - role: "presentation", - key: key, - className: this._classNames.divider - }); + }; + ComboBoxInternal2.prototype._renderSeparator = function(item) { + var index2 = item.index, key2 = item.key; + if (index2 && index2 > 0) { + return React__namespace.createElement("div", { role: "presentation", key: key2, className: this._classNames.divider }); + } return null; - }; - ComboBoxInternal.prototype._renderHeader = function(item) { - var _a = this.props.onRenderOption, onRenderOption = _a === void 0 ? this._onRenderOptionContent : _a; - return _react.createElement("div", { - id: item.id, - key: item.key, - className: this._classNames.header - }, onRenderOption(item, this._onRenderOptionContent)); - }; - ComboBoxInternal.prototype._renderCheckboxLabel = function(item) { - var _a = this.props.onRenderOption, onRenderOption = _a === void 0 ? this._onRenderMultiselectOptionContent : _a; + }; + ComboBoxInternal2.prototype._renderHeader = function(item) { + var _a2 = this.props.onRenderOption, onRenderOption = _a2 === void 0 ? this._onRenderOptionContent : _a2; + return React__namespace.createElement("div", { id: item.id, key: item.key, className: this._classNames.header }, onRenderOption(item, this._onRenderOptionContent)); + }; + ComboBoxInternal2.prototype._renderCheckboxLabel = function(item) { + var _a2 = this.props.onRenderOption, onRenderOption = _a2 === void 0 ? this._onRenderMultiselectOptionContent : _a2; return onRenderOption(item, this._onRenderMultiselectOptionContent); - }; - /** - * If we are coming from a mouseOut: - * there is no visible selected option. - * - * Else if We are hovering over an item: - * that gets the selected look. - * - * Else: - * Use the current valid pending index if it exists OR - * we do not have a valid index and we currently have a pending input value, - * otherwise use the selected index - * */ ComboBoxInternal.prototype._isOptionHighlighted = function(index) { + }; + ComboBoxInternal2.prototype._isOptionHighlighted = function(index2) { var currentPendingValueValidIndexOnHover = this.state.currentPendingValueValidIndexOnHover; - // If the hover state is set to clearAll, don't show a selected index. - // Note, this happens when the user moused out of the menu items - if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) return false; - return currentPendingValueValidIndexOnHover >= 0 ? currentPendingValueValidIndexOnHover === index : this._isOptionSelected(index); - }; - ComboBoxInternal.prototype._isOptionSelected = function(index) { - return this._getPendingSelectedIndex(true) === index; - }; - ComboBoxInternal.prototype._isOptionChecked = function(index) { - if (this.props.multiSelect && index !== undefined && this.props.hoisted.selectedIndices) { - var idxOfSelectedIndex = -1; - idxOfSelectedIndex = this.props.hoisted.selectedIndices.indexOf(index); - return idxOfSelectedIndex >= 0; + if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) { + return false; + } + return currentPendingValueValidIndexOnHover >= 0 ? currentPendingValueValidIndexOnHover === index2 : this._isOptionSelected(index2); + }; + ComboBoxInternal2.prototype._isOptionSelected = function(index2) { + return this._getPendingSelectedIndex( + true + /* includePendingValue */ + ) === index2; + }; + ComboBoxInternal2.prototype._isOptionChecked = function(index2) { + if (this.props.multiSelect && index2 !== void 0 && this.props.hoisted.selectedIndices) { + var idxOfSelectedIndex = -1; + idxOfSelectedIndex = this.props.hoisted.selectedIndices.indexOf(index2); + return idxOfSelectedIndex >= 0; } return false; - }; - ComboBoxInternal.prototype._isOptionIndeterminate = function(index) { - var _a = this.props, multiSelect = _a.multiSelect, hoisted = _a.hoisted; - if (multiSelect && index !== undefined && hoisted.selectedIndices && hoisted.currentOptions) { - var option = hoisted.currentOptions[index]; - if (option && option.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll) return hoisted.selectedIndices.length > 0 && !this._isSelectAllChecked(); + }; + ComboBoxInternal2.prototype._isOptionIndeterminate = function(index2) { + var _a2 = this.props, multiSelect = _a2.multiSelect, hoisted = _a2.hoisted; + if (multiSelect && index2 !== void 0 && hoisted.selectedIndices && hoisted.currentOptions) { + var option = hoisted.currentOptions[index2]; + if (option && option.itemType === SelectableOptionMenuItemType.SelectAll) { + return hoisted.selectedIndices.length > 0 && !this._isSelectAllChecked(); + } } return false; - }; - ComboBoxInternal.prototype._isSelectAllChecked = function(testIndices) { - var _a = this.props, multiSelect = _a.multiSelect, hoisted = _a.hoisted; + }; + ComboBoxInternal2.prototype._isSelectAllChecked = function(testIndices) { + var _a2 = this.props, multiSelect = _a2.multiSelect, hoisted = _a2.hoisted; var selectAllOption = hoisted.currentOptions.find(function(option) { - return option.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll; + return option.itemType === SelectableOptionMenuItemType.SelectAll; }); var selectedIndices = testIndices || hoisted.selectedIndices; - if (!multiSelect || !selectedIndices || !selectAllOption) return false; - // start by not including the select all option itself + if (!multiSelect || !selectedIndices || !selectAllOption) { + return false; + } var selectAllIndex = hoisted.currentOptions.indexOf(selectAllOption); - var compareSelectedIndices = selectedIndices.filter(function(value) { - return value !== selectAllIndex; + var compareSelectedIndices = selectedIndices.filter(function(value2) { + return value2 !== selectAllIndex; }); - // get array of selectable options, excluding disabled options, headers, and dividers var selectableOptions = hoisted.currentOptions.filter(function(option) { - return !option.disabled && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).SelectAll && isSelectableOption(option); + return !option.disabled && option.itemType !== SelectableOptionMenuItemType.SelectAll && isSelectableOption(option); }); return compareSelectedIndices.length === selectableOptions.length; - }; - /** - * Gets the pending selected index taking into account valueValidIndex and selectedIndex - * @param includeCurrentPendingValue - Should we include the currentPendingValue when - * finding the index - */ ComboBoxInternal.prototype._getPendingSelectedIndex = function(includeCurrentPendingValue) { - var _a = this.state, currentPendingValueValidIndex = _a.currentPendingValueValidIndex, currentPendingValue = _a.currentPendingValue; - return currentPendingValueValidIndex >= 0 || includeCurrentPendingValue && currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValueValidIndex : this.props.multiSelect ? -1 : this._getFirstSelectedIndex(); - }; - /** - * Scroll the selected element into view - */ ComboBoxInternal.prototype._scrollIntoView = function() { - var _a = this.props, onScrollToItem = _a.onScrollToItem, scrollSelectedToTop = _a.scrollSelectedToTop; + }; + ComboBoxInternal2.prototype._getPendingSelectedIndex = function(includeCurrentPendingValue) { + var _a2 = this.state, currentPendingValueValidIndex = _a2.currentPendingValueValidIndex, currentPendingValue = _a2.currentPendingValue; + return currentPendingValueValidIndex >= 0 || includeCurrentPendingValue && currentPendingValue !== null && currentPendingValue !== void 0 ? currentPendingValueValidIndex : this.props.multiSelect ? -1 : this._getFirstSelectedIndex(); + }; + ComboBoxInternal2.prototype._scrollIntoView = function() { + var _a2 = this.props, onScrollToItem = _a2.onScrollToItem, scrollSelectedToTop = _a2.scrollSelectedToTop; var currentPendingSelectedIndex = this._getPendingSelectedIndex(true); if (onScrollToItem) { - // Use the custom scroll handler - onScrollToItem(currentPendingSelectedIndex >= 0 ? currentPendingSelectedIndex : this._getFirstSelectedIndex()); - return; + onScrollToItem(currentPendingSelectedIndex >= 0 ? currentPendingSelectedIndex : this._getFirstSelectedIndex()); + return; } var scrollToElement = this._selectedElement.current; - // in multi-select there are multiple selected elements, so we use the pending select index - // to locate the option to scroll to. - if (this.props.multiSelect && this._comboBoxMenu.current) scrollToElement = findFirstDescendant(this._comboBoxMenu.current, function(element) { - var _a; - return ((_a = element.dataset) === null || _a === void 0 ? void 0 : _a.index) === currentPendingSelectedIndex.toString(); - }); - if (scrollToElement && scrollToElement.offsetParent) { - var alignToTop = true; - // We are using refs, scroll the ref into view - if (this._comboBoxMenu.current && this._comboBoxMenu.current.offsetParent) { - var scrollableParent = this._comboBoxMenu.current.offsetParent; - var selectedElement = scrollToElement.offsetParent; - var _b = selectedElement, offsetHeight = _b.offsetHeight, offsetTop = _b.offsetTop; - var _c = scrollableParent, parentOffsetHeight = _c.offsetHeight, scrollTop = _c.scrollTop; - var isAbove = offsetTop < scrollTop; - var isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; - if (isAbove || scrollSelectedToTop) { - alignToTop = false; - scrollableParent.scrollTo(0, offsetTop); - } else if (isBelow) scrollableParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); - } else scrollToElement.offsetParent.scrollIntoView(alignToTop); + if (this.props.multiSelect && this._comboBoxMenu.current) { + scrollToElement = findFirstDescendant(this._comboBoxMenu.current, function(element2) { + var _a3; + return ((_a3 = element2.dataset) === null || _a3 === void 0 ? void 0 : _a3.index) === currentPendingSelectedIndex.toString(); + }); } - }; - /** - * Click handler for the menu items - * to select the item and also close the menu - * @param index - the index of the item that was clicked - */ ComboBoxInternal.prototype._onItemClick = function(item) { + if (scrollToElement && scrollToElement.offsetParent) { + var alignToTop = true; + if (this._comboBoxMenu.current && this._comboBoxMenu.current.offsetParent) { + var scrollableParent = this._comboBoxMenu.current.offsetParent; + var selectedElement = scrollToElement.offsetParent; + var _b2 = selectedElement, offsetHeight = _b2.offsetHeight, offsetTop = _b2.offsetTop; + var _c2 = scrollableParent, parentOffsetHeight = _c2.offsetHeight, scrollTop = _c2.scrollTop; + var isAbove = offsetTop < scrollTop; + var isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; + if (isAbove || scrollSelectedToTop) { + alignToTop = false; + scrollableParent.scrollTo(0, offsetTop); + } else if (isBelow) { + scrollableParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); + } + } else { + scrollToElement.offsetParent.scrollIntoView(alignToTop); + } + } + }; + ComboBoxInternal2.prototype._onItemClick = function(item) { var _this = this; var onItemClick = this.props.onItemClick; - var index = item.index; + var index2 = item.index; return function(ev) { - // only close the callout when it's in single-select mode - if (!_this.props.multiSelect) { - // ensure that focus returns to the input, not the button - _this._autofill.current && _this._autofill.current.focus(); - _this.setState({ - isOpen: false - }); - } - // Continue processing the click only after - // performing menu close / control focus(inner working) - onItemClick && onItemClick(ev, item, index); - _this._setSelectedIndex(index, ev); + if (!_this.props.multiSelect) { + _this._autofill.current && _this._autofill.current.focus(); + _this.setState({ + isOpen: false + }); + } + onItemClick && onItemClick(ev, item, index2); + _this._setSelectedIndex(index2, ev); }; - }; - /** - * Reset the selected index by clearing the - * input (of any pending text), clearing the pending state, - * and setting the suggested display value to the last - * selected state text - */ ComboBoxInternal.prototype._resetSelectedIndex = function() { + }; + ComboBoxInternal2.prototype._resetSelectedIndex = function() { var currentOptions = this.props.hoisted.currentOptions; this._clearPendingInfo(); var selectedIndex = this._getFirstSelectedIndex(); - if (selectedIndex > 0 && selectedIndex < currentOptions.length) this.props.hoisted.setSuggestedDisplayValue(currentOptions[selectedIndex].text); - else if (this.props.text) // If we had a value initially, restore it - this.props.hoisted.setSuggestedDisplayValue(this.props.text); - }; - /** - * Clears the pending info state - */ ComboBoxInternal.prototype._clearPendingInfo = function() { + if (selectedIndex > 0 && selectedIndex < currentOptions.length) { + this.props.hoisted.setSuggestedDisplayValue(currentOptions[selectedIndex].text); + } else if (this.props.text) { + this.props.hoisted.setSuggestedDisplayValue(this.props.text); + } + }; + ComboBoxInternal2.prototype._clearPendingInfo = function() { this._processingClearPendingInfo = true; - this.props.hoisted.setSuggestedDisplayValue(undefined); + this.props.hoisted.setSuggestedDisplayValue(void 0); this.setState({ - currentPendingValue: undefined, - currentPendingValueValidIndex: -1, - currentPendingValueValidIndexOnHover: HoverStatus.default + currentPendingValue: void 0, + currentPendingValueValidIndex: -1, + currentPendingValueValidIndexOnHover: HoverStatus.default }, this._onAfterClearPendingInfo); - }; - /** - * Set the pending info - * @param currentPendingValue - new pending value to set - * @param currentPendingValueValidIndex - new pending value index to set - * @param suggestedDisplayValue - new suggest display value to set - */ ComboBoxInternal.prototype._setPendingInfo = function(currentPendingValue, currentPendingValueValidIndex, suggestedDisplayValue) { - if (currentPendingValueValidIndex === void 0) currentPendingValueValidIndex = -1; - if (this._processingClearPendingInfo) return; + }; + ComboBoxInternal2.prototype._setPendingInfo = function(currentPendingValue, currentPendingValueValidIndex, suggestedDisplayValue) { + if (currentPendingValueValidIndex === void 0) { + currentPendingValueValidIndex = -1; + } + if (this._processingClearPendingInfo) { + return; + } this.props.hoisted.setSuggestedDisplayValue(suggestedDisplayValue); this.setState({ - currentPendingValue: normalizeToString(currentPendingValue), - currentPendingValueValidIndex: currentPendingValueValidIndex, - currentPendingValueValidIndexOnHover: HoverStatus.default + currentPendingValue: normalizeToString(currentPendingValue), + currentPendingValueValidIndex, + currentPendingValueValidIndexOnHover: HoverStatus.default }); - }; - /** - * Set the pending info from the given index - * @param index - the index to set the pending info from - */ ComboBoxInternal.prototype._setPendingInfoFromIndex = function(index) { + }; + ComboBoxInternal2.prototype._setPendingInfoFromIndex = function(index2) { var currentOptions = this.props.hoisted.currentOptions; - if (index >= 0 && index < currentOptions.length) { - var option = currentOptions[index]; - this._setPendingInfo(getPreviewText(option), index, getPreviewText(option)); - } else this._clearPendingInfo(); - }; - /** - * Sets the pending info for the combo box - * @param index - the index to search from - * @param searchDirection - the direction to search - */ ComboBoxInternal.prototype._setPendingInfoFromIndexAndDirection = function(index, searchDirection) { + if (index2 >= 0 && index2 < currentOptions.length) { + var option = currentOptions[index2]; + this._setPendingInfo(getPreviewText(option), index2, getPreviewText(option)); + } else { + this._clearPendingInfo(); + } + }; + ComboBoxInternal2.prototype._setPendingInfoFromIndexAndDirection = function(index2, searchDirection) { var currentOptions = this.props.hoisted.currentOptions; - // update index to allow content to wrap - if (searchDirection === SearchDirection.forward && index >= currentOptions.length - 1) index = -1; - else if (searchDirection === SearchDirection.backward && index <= 0) index = currentOptions.length; - // get the next "valid" index - var indexUpdate = this._getNextSelectableIndex(index, searchDirection); - // if the two indices are equal we didn't move and - // we should attempt to get get the first/last "valid" index to use - // (Note, this takes care of the potential cases where the first/last - // item is not focusable), otherwise use the updated index - if (index === indexUpdate) { - if (searchDirection === SearchDirection.forward) index = this._getNextSelectableIndex(-1, searchDirection); - else if (searchDirection === SearchDirection.backward) index = this._getNextSelectableIndex(currentOptions.length, searchDirection); - } else index = indexUpdate; - if (indexWithinBounds(currentOptions, index)) this._setPendingInfoFromIndex(index); - }; - ComboBoxInternal.prototype._notifyPendingValueChanged = function(prevState) { + if (searchDirection === SearchDirection.forward && index2 >= currentOptions.length - 1) { + index2 = -1; + } else if (searchDirection === SearchDirection.backward && index2 <= 0) { + index2 = currentOptions.length; + } + var indexUpdate = this._getNextSelectableIndex(index2, searchDirection); + if (index2 === indexUpdate) { + if (searchDirection === SearchDirection.forward) { + index2 = this._getNextSelectableIndex(-1, searchDirection); + } else if (searchDirection === SearchDirection.backward) { + index2 = this._getNextSelectableIndex(currentOptions.length, searchDirection); + } + } else { + index2 = indexUpdate; + } + if (indexWithinBounds(currentOptions, index2)) { + this._setPendingInfoFromIndex(index2); + } + }; + ComboBoxInternal2.prototype._notifyPendingValueChanged = function(prevState) { var onPendingValueChanged = this.props.onPendingValueChanged; - if (!onPendingValueChanged) return; - var currentOptions = this.props.hoisted.currentOptions; - var _a = this.state, currentPendingValue = _a.currentPendingValue, currentPendingValueValidIndex = _a.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _a.currentPendingValueValidIndexOnHover; - var newPendingIndex = undefined; - var newPendingValue = undefined; - if (currentPendingValueValidIndexOnHover !== prevState.currentPendingValueValidIndexOnHover && indexWithinBounds(currentOptions, currentPendingValueValidIndexOnHover)) // Set new pending index if hover index was changed - newPendingIndex = currentPendingValueValidIndexOnHover; - else if (currentPendingValueValidIndex !== prevState.currentPendingValueValidIndex && indexWithinBounds(currentOptions, currentPendingValueValidIndex)) // Set new pending index if currentPendingValueValidIndex was changed - newPendingIndex = currentPendingValueValidIndex; - else if (currentPendingValue !== prevState.currentPendingValue) // Set pendingValue in the case it was changed and no index was changed - newPendingValue = currentPendingValue; - // Notify when there is a new pending index/value. Also, if there is a pending value, it needs to send undefined. - if (newPendingIndex !== undefined || newPendingValue !== undefined || this._hasPendingValue) { - onPendingValueChanged(newPendingIndex !== undefined ? currentOptions[newPendingIndex] : undefined, newPendingIndex, newPendingValue); - this._hasPendingValue = newPendingIndex !== undefined || newPendingValue !== undefined; + if (!onPendingValueChanged) { + return; } - }; - /** - * Sets the isOpen state and updates focusInputAfterClose - */ ComboBoxInternal.prototype._setOpenStateAndFocusOnClose = function(isOpen, focusInputAfterClose) { + var currentOptions = this.props.hoisted.currentOptions; + var _a2 = this.state, currentPendingValue = _a2.currentPendingValue, currentPendingValueValidIndex = _a2.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _a2.currentPendingValueValidIndexOnHover; + var newPendingIndex = void 0; + var newPendingValue = void 0; + if (currentPendingValueValidIndexOnHover !== prevState.currentPendingValueValidIndexOnHover && indexWithinBounds(currentOptions, currentPendingValueValidIndexOnHover)) { + newPendingIndex = currentPendingValueValidIndexOnHover; + } else if (currentPendingValueValidIndex !== prevState.currentPendingValueValidIndex && indexWithinBounds(currentOptions, currentPendingValueValidIndex)) { + newPendingIndex = currentPendingValueValidIndex; + } else if (currentPendingValue !== prevState.currentPendingValue) { + newPendingValue = currentPendingValue; + } + if (newPendingIndex !== void 0 || newPendingValue !== void 0 || this._hasPendingValue) { + onPendingValueChanged(newPendingIndex !== void 0 ? currentOptions[newPendingIndex] : void 0, newPendingIndex, newPendingValue); + this._hasPendingValue = newPendingIndex !== void 0 || newPendingValue !== void 0; + } + }; + ComboBoxInternal2.prototype._setOpenStateAndFocusOnClose = function(isOpen, focusInputAfterClose) { this._focusInputAfterClose = focusInputAfterClose; + this.setState({ isOpen }); + }; + ComboBoxInternal2.prototype._onOptionMouseEnter = function(index2) { + if (this._shouldIgnoreMouseEvent()) { + return; + } this.setState({ - isOpen: isOpen - }); - }; - ComboBoxInternal.prototype._onOptionMouseEnter = function(index) { - if (this._shouldIgnoreMouseEvent()) return; - this.setState({ - currentPendingValueValidIndexOnHover: index + currentPendingValueValidIndexOnHover: index2 }); - }; - ComboBoxInternal.prototype._onOptionMouseMove = function(index) { + }; + ComboBoxInternal2.prototype._onOptionMouseMove = function(index2) { this._gotMouseMove = true; - if (!this._isScrollIdle || this.state.currentPendingValueValidIndexOnHover === index) return; + if (!this._isScrollIdle || this.state.currentPendingValueValidIndexOnHover === index2) { + return; + } this.setState({ - currentPendingValueValidIndexOnHover: index + currentPendingValueValidIndexOnHover: index2 }); - }; - ComboBoxInternal.prototype._shouldIgnoreMouseEvent = function() { + }; + ComboBoxInternal2.prototype._shouldIgnoreMouseEvent = function() { return !this._isScrollIdle || !this._gotMouseMove; - }; - /** - * Handle dismissing the menu and eating the required key event when disabled - * @param ev - the keyboard event that was fired - */ ComboBoxInternal.prototype._handleInputWhenDisabled = function(ev) { - // If we are disabled, close the menu (if needed) - // and eat all keystrokes other than TAB or ESC + }; + ComboBoxInternal2.prototype._handleInputWhenDisabled = function(ev) { if (this.props.disabled) { - if (this.state.isOpen) this.setState({ - isOpen: false - }); - // When disabled stop propagation and prevent default - // of the event unless we have a tab, escape, or function key - if (ev !== null && // eslint-disable-next-line deprecation/deprecation - ev.which !== (0, _utilities.KeyCodes).tab && // eslint-disable-next-line deprecation/deprecation - ev.which !== (0, _utilities.KeyCodes).escape && // eslint-disable-next-line deprecation/deprecation - (ev.which < 112 /* F1 */ || ev.which > 123)) { - ev.stopPropagation(); - ev.preventDefault(); - } + if (this.state.isOpen) { + this.setState({ isOpen: false }); + } + if (ev !== null && // eslint-disable-next-line @typescript-eslint/no-deprecated + ev.which !== KeyCodes.tab && // eslint-disable-next-line @typescript-eslint/no-deprecated + ev.which !== KeyCodes.escape && // eslint-disable-next-line @typescript-eslint/no-deprecated + (ev.which < 112 || ev.which > 123)) { + ev.stopPropagation(); + ev.preventDefault(); + } } - }; - ComboBoxInternal.prototype._handleTouchAndPointerEvent = function() { + }; + ComboBoxInternal2.prototype._handleTouchAndPointerEvent = function() { var _this = this; - // If we already have an existing timeout from a previous touch and pointer event - // cancel that timeout so we can set a nwe one. - if (this._lastTouchTimeoutId !== undefined) { - this._async.clearTimeout(this._lastTouchTimeoutId); - this._lastTouchTimeoutId = undefined; + if (this._lastTouchTimeoutId !== void 0) { + this._async.clearTimeout(this._lastTouchTimeoutId); + this._lastTouchTimeoutId = void 0; } this._processingTouch = true; this._lastTouchTimeoutId = this._async.setTimeout(function() { - _this._processingTouch = false; - _this._lastTouchTimeoutId = undefined; + _this._processingTouch = false; + _this._lastTouchTimeoutId = void 0; }, TouchIdleDelay); - }; - /** - * Get the styles for the current option. - * @param item - Item props for the current option - */ ComboBoxInternal.prototype._getCaretButtonStyles = function() { + }; + ComboBoxInternal2.prototype._getCaretButtonStyles = function() { var customCaretDownButtonStyles = this.props.caretDownButtonStyles; - return (0, _comboBoxStyles.getCaretDownButtonStyles)(this.props.theme, customCaretDownButtonStyles); - }; - /** - * Get the styles for the current option. - * @param item - Item props for the current option - */ ComboBoxInternal.prototype._getCurrentOptionStyles = function(item) { - var _a; + return getCaretDownButtonStyles(this.props.theme, customCaretDownButtonStyles); + }; + ComboBoxInternal2.prototype._getCurrentOptionStyles = function(item) { + var _a2; var customStylesForAllOptions = this.props.comboBoxOptionStyles; var customStylesForCurrentOption = item.styles; - var optionStyles = (0, _comboBoxStyles.getOptionStyles)(this.props.theme, customStylesForAllOptions, customStylesForCurrentOption, this._isPendingOption(item), item.hidden, this._isOptionHighlighted(item.index)); - // TODO: fix this for multi-window scenarios - optionStyles.__shadowConfig__ = (_a = this.props.styles) === null || _a === void 0 ? void 0 : _a.__shadowConfig__; + var optionStyles = getOptionStyles(this.props.theme, customStylesForAllOptions, customStylesForCurrentOption, this._isPendingOption(item), item.hidden, this._isOptionHighlighted(item.index)); + optionStyles.__shadowConfig__ = (_a2 = this.props.styles) === null || _a2 === void 0 ? void 0 : _a2.__shadowConfig__; return optionStyles; - }; - /** - * Get the aria autocomplete value for the combo box - * @returns 'inline' if auto-complete automatically dynamic, 'both' if we have a list of possible values to pick from - * and can dynamically populate input, and 'list' if auto-complete is not enabled as selection is the only option. - * Ideally, this should be 'none' if auto-complete is not enabled, but there is a known bug in Edge - * where the callout may appear over the combo box if this attribute is set to 'none' - */ ComboBoxInternal.prototype._getAriaAutoCompleteValue = function() { - var autoComplete = !this.props.disabled && this.props.autoComplete === 'on'; - return autoComplete ? this.props.allowFreeform ? 'inline' : 'both' : 'list'; - }; - ComboBoxInternal.prototype._isPendingOption = function(item) { + }; + ComboBoxInternal2.prototype._getAriaAutoCompleteValue = function() { + var autoComplete = !this.props.disabled && this.props.autoComplete === "on"; + return autoComplete ? this.props.allowFreeform ? "inline" : "both" : "list"; + }; + ComboBoxInternal2.prototype._isPendingOption = function(item) { return item && item.index === this.state.currentPendingValueValidIndex; + }; + ComboBoxInternal2.prototype._hasFocus = function() { + return this.state.focusState !== "none"; + }; + ComboBoxInternal2.prototype._adjustForCaseSensitivity = function(text2) { + return this.props.caseSensitive ? text2 : text2.toLowerCase(); + }; + ComboBoxInternal2.contextType = WindowContext; + ComboBoxInternal2 = __decorate([ + customizable("ComboBox", ["theme", "styles"]) + ], ComboBoxInternal2); + return ComboBoxInternal2; + })(React__namespace.Component) + ); + function getSelectedIndices(options2, selectedKeys) { + if (!options2 || !selectedKeys) { + return []; + } + var selectedIndices = {}; + options2.forEach(function(option, index2) { + if (option.selected) { + selectedIndices[index2] = true; + } + }); + var _loop_1 = function(selectedKey2) { + var index2 = findIndex(options2, function(option) { + return option.key === selectedKey2; + }); + if (index2 > -1) { + selectedIndices[index2] = true; + } + }; + for (var _i = 0, selectedKeys_1 = selectedKeys; _i < selectedKeys_1.length; _i++) { + var selectedKey = selectedKeys_1[_i]; + _loop_1(selectedKey); + } + return Object.keys(selectedIndices).map(Number).sort(); + } + function buildDefaultSelectedKeys(defaultSelectedKey, selectedKey) { + var selectedKeys = buildSelectedKeys(defaultSelectedKey); + if (selectedKeys.length) { + return selectedKeys; + } + return buildSelectedKeys(selectedKey); + } + function buildSelectedKeys(selectedKey) { + if (selectedKey === void 0) { + return []; + } + return selectedKey instanceof Array ? selectedKey : [selectedKey]; + } + function normalizeToString(value2) { + return value2 || ""; + } + function indexWithinBounds(options2, index2) { + return !!options2 && index2 >= 0 && index2 < options2.length; + } + function isNormalOption(option) { + return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider && option.itemType !== SelectableOptionMenuItemType.SelectAll; + } + function isSelectableOption(option) { + return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider; + } + function getPreviewText(item) { + return item.useAriaLabelAsText && item.ariaLabel ? item.ariaLabel : item.text; + } + function isAltOrMeta(ev) { + return ev.which === KeyCodes.alt || ev.key === "Meta"; + } + var COMMAND_BAR_HEIGHT = 44; + var getStyles$e = function(props) { + var className2 = props.className, theme = props.theme; + var semanticColors = theme.semanticColors; + return { + root: [ + theme.fonts.medium, + "ms-CommandBar", + { + display: "flex", + backgroundColor: semanticColors.bodyBackground, + padding: "0 14px 0 24px", + height: COMMAND_BAR_HEIGHT + }, + className2 + ], + primarySet: [ + "ms-CommandBar-primaryCommand", + { + flexGrow: "1", + display: "flex", + alignItems: "stretch" + } + ], + secondarySet: [ + "ms-CommandBar-secondaryCommand", + { + flexShrink: "0", + display: "flex", + alignItems: "stretch" + } + ] + }; + }; + var getCommandButtonStyles = memoizeFunction(function(customStyles) { + var rootStyles = { + height: "100%" + }; + var labelStyles = { + whiteSpace: "nowrap" + }; + var _a2 = customStyles || {}, root = _a2.root, label2 = _a2.label, restCustomStyles = __rest(_a2, ["root", "label"]); + return __assign$1(__assign$1({}, restCustomStyles), { root: root ? [rootStyles, root] : rootStyles, label: label2 ? [labelStyles, label2] : labelStyles }); + }); + var registerPersistedKeytips = function(keytipsToRegister, keytipManager, registeredPersistedKeytips) { + for (var _i = 0, keytipsToRegister_1 = keytipsToRegister; _i < keytipsToRegister_1.length; _i++) { + var keytip = keytipsToRegister_1[_i]; + var uniqueID = keytipManager.register(keytip, true); + registeredPersistedKeytips[uniqueID] = keytip; + } + }; + var unregisterPersistedKeytips = function(keytipManager, registeredPersistedKeytips) { + for (var _i = 0, _a2 = Object.keys(registeredPersistedKeytips); _i < _a2.length; _i++) { + var uniqueID = _a2[_i]; + keytipManager.unregister(registeredPersistedKeytips[uniqueID], uniqueID, true); + delete registeredPersistedKeytips[uniqueID]; + } + }; + var useKeytipRegistrations = function(registeredPersistedKeytips, keytipsToRegister, keytipManager) { + var prevPersistedKeytips = usePrevious(registeredPersistedKeytips); + React__namespace.useEffect(function() { + if (prevPersistedKeytips) { + unregisterPersistedKeytips(keytipManager, prevPersistedKeytips); + registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); + } + }); + React__namespace.useEffect(function() { + registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); + return function() { + unregisterPersistedKeytips(keytipManager, registeredPersistedKeytips); + }; + }, []); + }; + var OverflowButton = function(props) { + var keytipManager = KeytipManager.getInstance(); + var className2 = props.className, overflowItems = props.overflowItems, keytipSequences = props.keytipSequences, itemSubMenuProvider = props.itemSubMenuProvider, onRenderOverflowButton = props.onRenderOverflowButton; + var persistedKeytips = useConst({}); + var getSubMenuForItem = React__namespace.useCallback(function(item) { + if (itemSubMenuProvider) { + return itemSubMenuProvider(item); + } + if (item.subMenuProps) { + return item.subMenuProps.items; + } + return void 0; + }, [itemSubMenuProvider]); + var _a2 = React__namespace.useMemo(function() { + var newKeytipsToRegister = []; + var newOverflowItems = []; + if (keytipSequences) { + overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.forEach(function(overflowItem) { + var _a3; + var keytip = overflowItem.keytipProps; + if (keytip) { + var persistedKeytip = { + content: keytip.content, + keySequences: keytip.keySequences, + disabled: keytip.disabled || !!(overflowItem.disabled || overflowItem.isDisabled), + hasDynamicChildren: keytip.hasDynamicChildren, + hasMenu: keytip.hasMenu + }; + if (keytip.hasDynamicChildren || getSubMenuForItem(overflowItem)) { + persistedKeytip.onExecute = keytipManager.menuExecute.bind(keytipManager, keytipSequences, (_a3 = overflowItem === null || overflowItem === void 0 ? void 0 : overflowItem.keytipProps) === null || _a3 === void 0 ? void 0 : _a3.keySequences); + persistedKeytip.hasOverflowSubMenu = true; + } else { + persistedKeytip.onExecute = keytip.onExecute; + } + newKeytipsToRegister.push(persistedKeytip); + var newOverflowItem = __assign$1(__assign$1({}, overflowItem), { keytipProps: __assign$1(__assign$1({}, keytip), { overflowSetSequence: keytipSequences }) }); + newOverflowItems === null || newOverflowItems === void 0 ? void 0 : newOverflowItems.push(newOverflowItem); + } else { + newOverflowItems === null || newOverflowItems === void 0 ? void 0 : newOverflowItems.push(overflowItem); + } + }); + } else { + newOverflowItems = overflowItems; + } + return { modifiedOverflowItems: newOverflowItems, keytipsToRegister: newKeytipsToRegister }; + }, [overflowItems, getSubMenuForItem, keytipManager, keytipSequences]), modifiedOverflowItems = _a2.modifiedOverflowItems, keytipsToRegister = _a2.keytipsToRegister; + useKeytipRegistrations(persistedKeytips, keytipsToRegister, keytipManager); + return React__namespace.createElement("div", { className: className2 }, onRenderOverflowButton(modifiedOverflowItems)); + }; + var getClassNames$f = classNamesFunction(); + var COMPONENT_NAME$3 = "OverflowSet"; + var useComponentRef$3 = function(props, divContainer) { + var doc = useDocumentEx(); + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + focus: function(_forceIntoFirstElement, bypassHiddenElements) { + var focusSucceeded = false; + if (divContainer.current) { + focusSucceeded = focusFirstChild(divContainer.current, bypassHiddenElements); + } + return focusSucceeded; + }, + focusElement: function(childElement) { + var focusSucceeded = false; + if (!childElement) { + return false; + } + if (divContainer.current && elementContains(divContainer.current, childElement)) { + childElement.focus(); + focusSucceeded = (doc === null || doc === void 0 ? void 0 : doc.activeElement) === childElement; + } + return focusSucceeded; + } + }; + }, [divContainer, doc]); + }; + var OverflowSetBase = React__namespace.forwardRef(function(props, forwardedRef) { + var divContainer = React__namespace.useRef(null); + var mergedRef = useMergedRefs(divContainer, forwardedRef); + useComponentRef$3(props, divContainer); + var items = props.items, overflowItems = props.overflowItems, className2 = props.className, styles = props.styles, vertical = props.vertical, role = props.role, _a2 = props.overflowSide, overflowSide = _a2 === void 0 ? "end" : _a2, onRenderItem = props.onRenderItem; + var classNames2 = getClassNames$f(styles, { className: className2, vertical }); + var showOverflow = !!overflowItems && overflowItems.length > 0; + return React__namespace.createElement( + "div", + __assign$1({}, getNativeProps(props, divProperties), { role: role || "group", "aria-orientation": role === "menubar" ? vertical === true ? "vertical" : "horizontal" : void 0, className: classNames2.root, ref: mergedRef }), + overflowSide === "start" && showOverflow && React__namespace.createElement(OverflowButton, __assign$1({}, props, { className: classNames2.overflowButton })), + items && items.map(function(item, i) { + return React__namespace.createElement("div", { className: classNames2.item, key: item.key, role: "none" }, onRenderItem(item)); + }), + overflowSide === "end" && showOverflow && React__namespace.createElement(OverflowButton, __assign$1({}, props, { className: classNames2.overflowButton })) + ); + }); + OverflowSetBase.displayName = COMPONENT_NAME$3; + var overflowItemStyle = { + flexShrink: 0, + display: "inherit" + }; + var getStyles$d = function(props) { + var className2 = props.className, vertical = props.vertical; + return { + root: [ + "ms-OverflowSet", + { + position: "relative", + display: "flex", + flexWrap: "nowrap" + }, + vertical && { flexDirection: "column" }, + className2 + ], + item: ["ms-OverflowSet-item", overflowItemStyle], + overflowButton: ["ms-OverflowSet-overflowButton", overflowItemStyle] + }; + }; + var OverflowSet = styled(OverflowSetBase, getStyles$d, void 0, { + scope: "OverflowSet" + }); + var ResizeGroupDirection; + (function(ResizeGroupDirection2) { + ResizeGroupDirection2[ResizeGroupDirection2["horizontal"] = 0] = "horizontal"; + ResizeGroupDirection2[ResizeGroupDirection2["vertical"] = 1] = "vertical"; + })(ResizeGroupDirection || (ResizeGroupDirection = {})); + var RESIZE_DELAY = 16; + var getMeasurementCache = function() { + var measurementsCache = {}; + return { + /** + * Checks if the provided data has a cacheKey. If it has a cacheKey and there is a + * corresponding entry in the measurementsCache, then it will return that value. + * Returns undefined otherwise. + */ + getCachedMeasurement: function(data2) { + if (data2 && data2.cacheKey && measurementsCache.hasOwnProperty(data2.cacheKey)) { + return measurementsCache[data2.cacheKey]; + } + return void 0; + }, + /** + * Should be called whenever there is a new measurement associated with a given data object. + * If the data has a cacheKey, store that measurement in the measurementsCache. + */ + addMeasurementToCache: function(data2, measurement) { + if (data2.cacheKey) { + measurementsCache[data2.cacheKey] = measurement; + } + } + }; + }; + var getNextResizeGroupStateProvider = function(measurementCache) { + if (measurementCache === void 0) { + measurementCache = getMeasurementCache(); + } + var _measurementCache = measurementCache; + var _containerDimension; + function _getMeasuredDimension(measuredData, getElementToMeasureDimension) { + var cachedDimension = _measurementCache.getCachedMeasurement(measuredData); + if (cachedDimension !== void 0) { + return cachedDimension; + } + var measuredDimension = getElementToMeasureDimension(); + _measurementCache.addMeasurementToCache(measuredData, measuredDimension); + return measuredDimension; + } + function _shrinkContentsUntilTheyFit(data2, onReduceData, getElementToMeasureDimension) { + var dataToMeasure = data2; + var measuredDimension = _getMeasuredDimension(data2, getElementToMeasureDimension); + while (measuredDimension > _containerDimension) { + var nextMeasuredData = onReduceData(dataToMeasure); + if (nextMeasuredData === void 0) { + return { + renderedData: dataToMeasure, + resizeDirection: void 0, + dataToMeasure: void 0 + }; + } + measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); + if (measuredDimension === void 0) { + return { + dataToMeasure: nextMeasuredData, + resizeDirection: "shrink" + }; + } + dataToMeasure = nextMeasuredData; + } + return { + renderedData: dataToMeasure, + resizeDirection: void 0, + dataToMeasure: void 0 + }; + } + function _growDataUntilItDoesNotFit(data2, onGrowData, getElementToMeasureDimension, onReduceData) { + var dataToMeasure = data2; + var measuredDimension = _getMeasuredDimension(data2, getElementToMeasureDimension); + while (measuredDimension < _containerDimension) { + var nextMeasuredData = onGrowData(dataToMeasure); + if (nextMeasuredData === void 0) { + return { + renderedData: dataToMeasure, + resizeDirection: void 0, + dataToMeasure: void 0 + }; + } + measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); + if (measuredDimension === void 0) { + return { + dataToMeasure: nextMeasuredData + }; + } + dataToMeasure = nextMeasuredData; + } + return __assign$1({ resizeDirection: "shrink" }, _shrinkContentsUntilTheyFit(dataToMeasure, onReduceData, getElementToMeasureDimension)); + } + function _updateContainerDimension(newDimension, fullDimensionData, renderedData, onGrowData) { + var nextState; + if (newDimension > _containerDimension) { + if (onGrowData) { + nextState = { + resizeDirection: "grow", + dataToMeasure: onGrowData(renderedData) + }; + } else { + nextState = { + resizeDirection: "shrink", + dataToMeasure: fullDimensionData + }; + } + } else { + nextState = { + resizeDirection: "shrink", + dataToMeasure: renderedData + }; + } + _containerDimension = newDimension; + return __assign$1(__assign$1({}, nextState), { measureContainer: false }); + } + function getNextState(props, currentState, getElementToMeasureDimension, newContainerDimension) { + if (newContainerDimension === void 0 && currentState.dataToMeasure === void 0) { + return void 0; + } + if (newContainerDimension) { + if (_containerDimension && currentState.renderedData && !currentState.dataToMeasure) { + return __assign$1(__assign$1({}, currentState), _updateContainerDimension(newContainerDimension, props.data, currentState.renderedData, props.onGrowData)); + } + _containerDimension = newContainerDimension; + } + var nextState = __assign$1(__assign$1({}, currentState), { measureContainer: false }); + if (currentState.dataToMeasure) { + if (currentState.resizeDirection === "grow" && props.onGrowData) { + nextState = __assign$1(__assign$1({}, nextState), _growDataUntilItDoesNotFit(currentState.dataToMeasure, props.onGrowData, getElementToMeasureDimension, props.onReduceData)); + } else { + nextState = __assign$1(__assign$1({}, nextState), _shrinkContentsUntilTheyFit(currentState.dataToMeasure, props.onReduceData, getElementToMeasureDimension)); + } + } + return nextState; + } + function shouldRenderDataForMeasurement(dataToMeasure) { + if (!dataToMeasure || _measurementCache.getCachedMeasurement(dataToMeasure) !== void 0) { + return false; + } + return true; + } + function getInitialResizeGroupState(data2) { + return { + dataToMeasure: __assign$1({}, data2), + resizeDirection: "grow", + measureContainer: true + }; + } + return { + getNextState, + shouldRenderDataForMeasurement, + getInitialResizeGroupState }; - /** - * Returns true if the component has some kind of focus. If it's either focusing or if it's focused - */ ComboBoxInternal.prototype._hasFocus = function() { - return this.state.focusState !== 'none'; - }; - ComboBoxInternal.prototype._adjustForCaseSensitivity = function(text) { - return this.props.caseSensitive ? text : text.toLowerCase(); - }; - ComboBoxInternal.contextType = (0, _reactWindowProvider.WindowContext); - ComboBoxInternal = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('ComboBox', [ - 'theme', - 'styles' - ], true) - ], ComboBoxInternal); - return ComboBoxInternal; -}(_react.Component); -/** - * Get the indices of the options that are marked as selected - * @param options - the combo box options - * @param selectedKeys - the known selected keys to find - * @returns - an array of the indices of the selected options, empty array if nothing is selected - */ function getSelectedIndices(options, selectedKeys) { - if (!options || !selectedKeys) return []; - var selectedIndices = {}; - options.forEach(function(option, index) { - if (option.selected) selectedIndices[index] = true; + }; + var MeasuredContext = React__namespace.createContext({ isMeasured: false }); + var hiddenDivStyles = { position: "fixed", visibility: "hidden" }; + var hiddenParentStyles = { position: "relative" }; + function resizeDataReducer(state, action) { + var _a2; + switch (action.type) { + case "resizeData": + return __assign$1({}, action.value); + case "dataToMeasure": + return __assign$1(__assign$1({}, state), { dataToMeasure: action.value, resizeDirection: "grow", measureContainer: true }); + default: + return __assign$1(__assign$1({}, state), (_a2 = {}, _a2[action.type] = action.value, _a2)); + } + } + function useResizeState(props, nextResizeGroupStateProvider, rootRef) { + var initialStateData = useConst(function() { + return nextResizeGroupStateProvider.getInitialResizeGroupState(props.data); }); - var _loop_1 = function(selectedKey) { - var index = (0, _utilities.findIndex)(options, function(option) { - return option.key === selectedKey; + var _a2 = React__namespace.useReducer(resizeDataReducer, initialStateData), resizeData = _a2[0], dispatchResizeDataAction = _a2[1]; + React__namespace.useEffect(function() { + dispatchResizeDataAction({ + type: "dataToMeasure", + value: props.data + }); + }, [props.data]); + var stateRef = React__namespace.useRef(initialStateData); + stateRef.current = __assign$1({}, resizeData); + var updateResizeState = React__namespace.useCallback(function(nextState) { + if (nextState) { + dispatchResizeDataAction({ + type: "resizeData", + value: nextState }); - if (index > -1) selectedIndices[index] = true; - }; - for(var _i = 0, selectedKeys_1 = selectedKeys; _i < selectedKeys_1.length; _i++){ - var selectedKey = selectedKeys_1[_i]; - _loop_1(selectedKey); - } - return Object.keys(selectedIndices).map(Number).sort(); -} -/** - * Given default selected key(s) and selected key(s), return the selected keys(s). - * When default selected key(s) are available, they take precedence and return them instead of selected key(s). - * - * @returns No matter what specific types the input parameters are, always return an array of - * either strings or numbers instead of primitive type. This normalization makes caller's logic easier. - */ function buildDefaultSelectedKeys(defaultSelectedKey, selectedKey) { - var selectedKeys = buildSelectedKeys(defaultSelectedKey); - if (selectedKeys.length) return selectedKeys; - return buildSelectedKeys(selectedKey); -} -function buildSelectedKeys(selectedKey) { - if (selectedKey === undefined) return []; - // need to cast here so typescript does not complain - return selectedKey instanceof Array ? selectedKey : [ - selectedKey + } + }, []); + var remeasure = React__namespace.useCallback(function() { + if (rootRef.current) { + dispatchResizeDataAction({ + type: "measureContainer", + value: true + }); + } + }, [rootRef]); + return [stateRef, updateResizeState, remeasure]; + } + function useResizingBehavior(props, rootRef) { + var nextResizeGroupStateProvider = useConst(getNextResizeGroupStateProvider); + var initialHiddenDiv = React__namespace.useRef(null); + var updateHiddenDiv = React__namespace.useRef(null); + var hasRenderedContent = React__namespace.useRef(false); + var async = useAsync(); + var _a2 = useResizeState(props, nextResizeGroupStateProvider, rootRef), stateRef = _a2[0], updateResizeState = _a2[1], remeasure = _a2[2]; + React__namespace.useEffect(function() { + var _a22; + if (stateRef.current.renderedData) { + hasRenderedContent.current = true; + (_a22 = props.dataDidRender) === null || _a22 === void 0 ? void 0 : _a22.call(props, stateRef.current.renderedData); + } + }); + React__namespace.useEffect(function() { + async.requestAnimationFrame(function() { + var containerDimension = void 0; + if (stateRef.current.measureContainer && rootRef.current) { + var boundingRect = rootRef.current.getBoundingClientRect(); + containerDimension = props.direction === ResizeGroupDirection.vertical ? boundingRect.height : boundingRect.width; + } + var nextState = nextResizeGroupStateProvider.getNextState(props, stateRef.current, function() { + var refToMeasure = !hasRenderedContent.current ? initialHiddenDiv : updateHiddenDiv; + if (!refToMeasure.current) { + return 0; + } + var measuredBoundingRect = refToMeasure.current.getBoundingClientRect(); + return props.direction === ResizeGroupDirection.vertical ? measuredBoundingRect.height : measuredBoundingRect.width; + }, containerDimension); + updateResizeState(nextState); + }, rootRef.current); + }); + var win = useWindow(); + useOnEvent(win, "resize", async.debounce(remeasure, RESIZE_DELAY, { leading: true })); + var dataNeedsMeasuring = nextResizeGroupStateProvider.shouldRenderDataForMeasurement(stateRef.current.dataToMeasure); + var isInitialMeasure = !hasRenderedContent.current && dataNeedsMeasuring; + return [ + stateRef.current.dataToMeasure, + stateRef.current.renderedData, + remeasure, + initialHiddenDiv, + updateHiddenDiv, + dataNeedsMeasuring, + isInitialMeasure ]; -} -function normalizeToString(value) { - return value || ''; -} -/** - * Is the index within the bounds of the array? - * @param options - options to check if the index is valid for - * @param index - the index to check - * @returns - true if the index is valid for the given options, false otherwise - */ function indexWithinBounds(options, index) { - return !!options && index >= 0 && index < options.length; -} -/** Whether this is a normal option, not a header or divider or select all. */ function isNormalOption(option) { - return option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Header && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Divider && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).SelectAll; -} -/** Whether this is a selectable option, not a header or divider. */ function isSelectableOption(option) { - return option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Header && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Divider; -} -/** - * For scenarios where the option's `text` prop contains embedded styles, we use the option's - * `ariaLabel` value as the text in the input and for autocomplete matching. We know to use this - * when the `useAriaLabelAsText` prop is set to true. - */ function getPreviewText(item) { - return item.useAriaLabelAsText && item.ariaLabel ? item.ariaLabel : item.text; -} -/** - * Returns true if the key for the event is alt (Mac option) or meta (Mac command). - */ function isAltOrMeta(ev) { - // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).alt || ev.key === 'Meta'; -} - -},{"tslib":"9gizs","react":"jGrId","../../Autofill":"3uh8V","../../Utilities":"1NZCy","../../Callout":"g2jXk","../../Checkbox":"dwb0b","./ComboBox.styles":"5808M","./ComboBox.classNames":"lioZM","../../Label":"8FZUu","../../SelectableOption":"jqbZ7","../../Button":"1457j","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3uh8V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Autofill/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Autofill/index":"7vfRr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7vfRr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _autofill = require("./Autofill"); -parcelHelpers.exportAll(_autofill, exports); -var _autofillTypes = require("./Autofill.types"); -parcelHelpers.exportAll(_autofillTypes, exports); - -},{"./Autofill":"9iX1O","./Autofill.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9iX1O":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Autofill", ()=>Autofill); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var SELECTION_FORWARD = 'forward'; -var SELECTION_BACKWARD = 'backward'; -/** - * {@docCategory Autofill} - */ var Autofill = /** @class */ function(_super) { - (0, _tslib.__extends)(Autofill, _super); - function Autofill(props) { + } + var measuredContextValue = { isMeasured: true }; + var ResizeGroupBase = React__namespace.forwardRef(function(props, forwardedRef) { + var rootRef = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(rootRef, forwardedRef); + var _a2 = useResizingBehavior(props, rootRef), dataToMeasure = _a2[0], renderedData = _a2[1], remeasure = _a2[2], initialHiddenDiv = _a2[3], updateHiddenDiv = _a2[4], dataNeedsMeasuring = _a2[5], isInitialMeasure = _a2[6]; + React__namespace.useImperativeHandle(props.componentRef, function() { + return { remeasure }; + }, [remeasure]); + var className2 = props.className, onRenderData = props.onRenderData; + var divProps = getNativeProps(props, divProperties, ["data"]); + return React__namespace.createElement( + "div", + __assign$1({}, divProps, { className: className2, ref: mergedRootRef }), + React__namespace.createElement( + "div", + { style: hiddenParentStyles }, + dataNeedsMeasuring && !isInitialMeasure && React__namespace.createElement( + "div", + { style: hiddenDivStyles, ref: updateHiddenDiv }, + React__namespace.createElement(MeasuredContext.Provider, { value: measuredContextValue }, onRenderData(dataToMeasure)) + ), + React__namespace.createElement("div", { ref: initialHiddenDiv, style: isInitialMeasure ? hiddenDivStyles : void 0, "data-automation-id": "visibleContent" }, isInitialMeasure ? onRenderData(dataToMeasure) : renderedData && onRenderData(renderedData)) + ) + ); + }); + ResizeGroupBase.displayName = "ResizeGroupBase"; + var ResizeGroup = ResizeGroupBase; + var getClassNames$e = classNamesFunction(); + var TooltipBase = ( + /** @class */ + (function(_super) { + __extends(TooltipBase2, _super); + function TooltipBase2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._onRenderContent = function(props) { + if (typeof props.content === "string") { + return React__namespace.createElement("p", { className: _this._classNames.subText }, props.content); + } else { + return React__namespace.createElement("div", { className: _this._classNames.subText }, props.content); + } + }; + return _this; + } + TooltipBase2.prototype.render = function() { + var _a2 = this.props, className2 = _a2.className, calloutProps = _a2.calloutProps, directionalHint = _a2.directionalHint, directionalHintForRTL = _a2.directionalHintForRTL, styles = _a2.styles, id2 = _a2.id, maxWidth = _a2.maxWidth, _b2 = _a2.onRenderContent, onRenderContent = _b2 === void 0 ? this._onRenderContent : _b2, targetElement = _a2.targetElement, theme = _a2.theme; + this._classNames = getClassNames$e(styles, { + theme, + className: className2 || calloutProps && calloutProps.className, + beakWidth: calloutProps && calloutProps.isBeakVisible ? calloutProps.beakWidth : 0, + gapSpace: calloutProps && calloutProps.gapSpace, + maxWidth + }); + return React__namespace.createElement( + Callout, + __assign$1({ target: targetElement, directionalHint, directionalHintForRTL }, calloutProps, getNativeProps(this.props, divProperties, ["id"]), { className: this._classNames.root }), + React__namespace.createElement("div", { className: this._classNames.content, id: id2, onFocus: this.props.onFocus, onMouseEnter: this.props.onMouseEnter, onMouseLeave: this.props.onMouseLeave }, onRenderContent(this.props, this._onRenderContent)) + ); + }; + TooltipBase2.defaultProps = { + directionalHint: DirectionalHint.topCenter, + maxWidth: "364px", + calloutProps: { + isBeakVisible: true, + beakWidth: 16, + gapSpace: 0, + setInitialFocus: true, + doNotLayer: false + } + }; + return TooltipBase2; + })(React__namespace.Component) + ); + var getStyles$c = function(props) { + var className2 = props.className, _a2 = props.beakWidth, beakWidth = _a2 === void 0 ? 16 : _a2, _b2 = props.gapSpace, gapSpace = _b2 === void 0 ? 0 : _b2, maxWidth = props.maxWidth, theme = props.theme; + var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; + var tooltipGapSpace = -(Math.sqrt(beakWidth * beakWidth / 2) + gapSpace) + 1 / // There isn't really a great way to pass in a `window` reference here so disabling the line rule + // eslint-disable-next-line no-restricted-globals + window.devicePixelRatio; + return { + root: [ + "ms-Tooltip", + theme.fonts.medium, + AnimationClassNames.fadeIn200, + { + background: semanticColors.menuBackground, + boxShadow: effects.elevation8, + padding: "8px", + maxWidth, + selectors: { + ":after": { + content: "''", + position: "absolute", + bottom: tooltipGapSpace, + left: tooltipGapSpace, + right: tooltipGapSpace, + top: tooltipGapSpace, + zIndex: 0 + } + } + }, + className2 + ], + content: [ + "ms-Tooltip-content", + fonts.small, + { + position: "relative", + zIndex: 1, + color: semanticColors.menuItemText, + wordWrap: "break-word", + overflowWrap: "break-word", + overflow: "hidden" + } + ], + subText: [ + "ms-Tooltip-subtext", + { + // Using inherit here to avoid unintentional global overrides of the <p> tag. + fontSize: "inherit", + fontWeight: "inherit", + color: "inherit", + margin: 0 + } + ] + }; + }; + var Tooltip = styled(TooltipBase, getStyles$c, void 0, { + scope: "Tooltip" + }); + var TooltipDelay; + (function(TooltipDelay2) { + TooltipDelay2[TooltipDelay2["zero"] = 0] = "zero"; + TooltipDelay2[TooltipDelay2["medium"] = 1] = "medium"; + TooltipDelay2[TooltipDelay2["long"] = 2] = "long"; + })(TooltipDelay || (TooltipDelay = {})); + var TooltipOverflowMode; + (function(TooltipOverflowMode2) { + TooltipOverflowMode2[TooltipOverflowMode2["Parent"] = 0] = "Parent"; + TooltipOverflowMode2[TooltipOverflowMode2["Self"] = 1] = "Self"; + })(TooltipOverflowMode || (TooltipOverflowMode = {})); + var getClassNames$d = classNamesFunction(); + var TooltipHostBase = ( + /** @class */ + (function(_super) { + __extends(TooltipHostBase2, _super); + function TooltipHostBase2(props) { var _this = _super.call(this, props) || this; - _this._inputElement = _react.createRef(); - _this._autoFillEnabled = true; - // Composition events are used when the character/text requires several keystrokes to be completed. - // Some examples of this are mobile text input and languages like Japanese or Arabic. - // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart - _this._onCompositionStart = function(ev) { - _this.setState({ - isComposing: true - }); - _this._autoFillEnabled = false; + _this._tooltipHost = React__namespace.createRef(); + _this._defaultTooltipId = getId("tooltip"); + _this.show = function() { + _this._toggleTooltip(true); }; - // Composition events are used when the character/text requires several keystrokes to be completed. - // Some examples of this are mobile text input and languages like Japanese or Arabic. - // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart - _this._onCompositionUpdate = function() { - if ((0, _utilities.isIE11)()) _this._updateValue(_this._getCurrentInputValue(), true); + _this.dismiss = function() { + _this._hideTooltip(); }; - // Composition events are used when the character/text requires several keystrokes to be completed. - // Some examples of this are mobile text input and languages like Japanese or Arabic. - // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart - _this._onCompositionEnd = function(ev) { - var inputValue = _this._getCurrentInputValue(); - _this._tryEnableAutofill(inputValue, _this.value, false, true); - _this.setState({ - isComposing: false - }); - // Due to timing, this needs to be async, otherwise no text will be selected. - _this._async.setTimeout(function() { - // it's technically possible that the value of isComposing is reset during this timeout, - // so explicitly trigger this with composing=true here, since it is supposed to be the - // update for composition end - _this._updateValue(_this._getCurrentInputValue(), false); - }, 0); + _this._getTargetElement = function() { + if (!_this._tooltipHost.current) { + return void 0; + } + var overflowMode = _this.props.overflowMode; + if (overflowMode !== void 0) { + switch (overflowMode) { + case TooltipOverflowMode.Parent: + return _this._tooltipHost.current.parentElement; + case TooltipOverflowMode.Self: + return _this._tooltipHost.current; + } + } + return _this._tooltipHost.current; }; - _this._onClick = function() { - if (_this.value && _this.value !== '' && _this._autoFillEnabled) _this._autoFillEnabled = false; + _this._onTooltipFocus = function(ev) { + if (_this._ignoreNextFocusEvent) { + _this._ignoreNextFocusEvent = false; + return; + } + _this._onTooltipMouseEnter(ev); }; - _this._onKeyDown = function(ev) { - if (_this.props.onKeyDown) _this.props.onKeyDown(ev); - // If the event is actively being composed, then don't alert autofill. - // Right now typing does not have isComposing, once that has been fixed any should be removed. - if (!ev.nativeEvent.isComposing) // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).backspace: - _this._autoFillEnabled = false; - break; - case (0, _utilities.KeyCodes).left: - case (0, _utilities.KeyCodes).right: - if (_this._autoFillEnabled) { - _this.setState(function(prev) { - return { - inputValue: _this.props.suggestedDisplayValue || prev.inputValue - }; - }); - _this._autoFillEnabled = false; - } - break; - default: - if (!_this._autoFillEnabled) // eslint-disable-next-line deprecation/deprecation - { - if (_this.props.enableAutofillOnKeyPress.indexOf(ev.which) !== -1) _this._autoFillEnabled = true; - } - break; - } + _this._onTooltipContentFocus = function(ev) { + if (TooltipHostBase2._currentVisibleTooltip && TooltipHostBase2._currentVisibleTooltip !== _this) { + TooltipHostBase2._currentVisibleTooltip.dismiss(); + } + TooltipHostBase2._currentVisibleTooltip = _this; + _this._clearDismissTimer(); + _this._clearOpenTimer(); }; - _this._onInputChanged = function(ev) { - var value = _this._getCurrentInputValue(ev); - if (!_this.state.isComposing) _this._tryEnableAutofill(value, _this.value, ev.nativeEvent.isComposing); - // If it is not IE11 and currently composing, update the value - if (!((0, _utilities.isIE11)() && _this.state.isComposing)) { - var nativeEventComposing = ev.nativeEvent.isComposing; - var isComposing = nativeEventComposing === undefined ? _this.state.isComposing : nativeEventComposing; - _this._updateValue(value, isComposing); - } + _this._onTooltipBlur = function(ev) { + var _a2; + _this._ignoreNextFocusEvent = ((_a2 = getDocumentEx(_this.context)) === null || _a2 === void 0 ? void 0 : _a2.activeElement) === ev.target; + _this._dismissTimerId = _this._async.setTimeout(function() { + _this._hideTooltip(); + }, 0); }; - _this._onChanged = function() { - // Swallow this event, we don't care about it - // We must provide it because React PropTypes marks it as required, but onInput serves the correct purpose + _this._onTooltipMouseEnter = function(ev) { + var _a2 = _this.props, overflowMode = _a2.overflowMode, delay = _a2.delay; + var doc = getDocumentEx(_this.context); + if (TooltipHostBase2._currentVisibleTooltip && TooltipHostBase2._currentVisibleTooltip !== _this) { + TooltipHostBase2._currentVisibleTooltip.dismiss(); + } + TooltipHostBase2._currentVisibleTooltip = _this; + if (overflowMode !== void 0) { + var overflowElement = _this._getTargetElement(); + if (overflowElement && !hasOverflow(overflowElement)) { + return; + } + } + if (ev.target && portalContainsElement(ev.target, _this._getTargetElement(), doc)) { return; + } + _this._clearDismissTimer(); + _this._clearOpenTimer(); + if (delay !== TooltipDelay.zero) { + var delayTime = _this._getDelayTime(delay); + _this._openTimerId = _this._async.setTimeout(function() { + _this._toggleTooltip(true); + }, delayTime); + } else { + _this._toggleTooltip(true); + } }; - /** - * Updates the current input value as well as getting a new display value. - * @param newValue - The new value from the input - */ _this._updateValue = function(newValue, composing) { - // Only proceed if the value is nonempty and is different from the old value - // This is to work around the fact that, in IE 11, inputs with a placeholder fire an onInput event on focus - if (!newValue && newValue === _this.value) return; - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, onInputChange = _a.onInputChange, onInputValueChange = _a.onInputValueChange; - if (onInputChange) newValue = (onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(newValue, composing)) || ''; - _this.setState({ - inputValue: newValue - }, function() { - return onInputValueChange === null || onInputValueChange === void 0 ? void 0 : onInputValueChange(newValue, composing); + _this._onTooltipMouseLeave = function(ev) { + var closeDelay = _this.props.closeDelay; + _this._clearDismissTimer(); + _this._clearOpenTimer(); + if (closeDelay) { + _this._dismissTimerId = _this._async.setTimeout(function() { + _this._toggleTooltip(false); + }, closeDelay); + } else { + _this._toggleTooltip(false); + } + if (TooltipHostBase2._currentVisibleTooltip === _this) { + TooltipHostBase2._currentVisibleTooltip = void 0; + } + }; + _this._onTooltipKeyDown = function(ev) { + if ((ev.which === KeyCodes.escape || ev.ctrlKey) && _this.state.isTooltipVisible) { + _this._hideTooltip(); + ev.stopPropagation(); + } + }; + _this._clearDismissTimer = function() { + _this._async.clearTimeout(_this._dismissTimerId); + }; + _this._clearOpenTimer = function() { + _this._async.clearTimeout(_this._openTimerId); + }; + _this._hideTooltip = function() { + _this._clearOpenTimer(); + _this._clearDismissTimer(); + _this._toggleTooltip(false); + }; + _this._toggleTooltip = function(isTooltipVisible) { + if (_this.state.isTooltipVisible !== isTooltipVisible) { + _this.setState({ isTooltipVisible }, function() { + return _this.props.onTooltipToggle && _this.props.onTooltipToggle(isTooltipVisible); }); + } }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); + _this._getDelayTime = function(delay) { + switch (delay) { + case TooltipDelay.medium: + return 300; + case TooltipDelay.long: + return 500; + default: + return 0; + } + }; + initializeComponentRef(_this); _this.state = { - inputValue: props.defaultVisibleValue || '', - isComposing: false + isAriaPlaceholderRendered: false, + isTooltipVisible: false }; return _this; - } - Autofill.getDerivedStateFromProps = function(props, state) { - // eslint-disable-next-line deprecation/deprecation - if (props.updateValueInWillReceiveProps) { - // eslint-disable-next-line deprecation/deprecation - var updatedInputValue = props.updateValueInWillReceiveProps(); - // Don't update if we have a null value or the value isn't changing - // the value should still update if an empty string is passed in - if (updatedInputValue !== null && updatedInputValue !== state.inputValue && !state.isComposing) return (0, _tslib.__assign)((0, _tslib.__assign)({}, state), { - inputValue: updatedInputValue - }); - } - return null; - }; - Object.defineProperty(Autofill.prototype, "cursorLocation", { - get: function() { - if (this._inputElement.current) { - var inputElement = this._inputElement.current; - if (inputElement.selectionDirection !== SELECTION_FORWARD) return inputElement.selectionEnd; - else return inputElement.selectionStart; - } else return -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "isValueSelected", { - get: function() { - return Boolean(this.inputElement && this.inputElement.selectionStart !== this.inputElement.selectionEnd); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "value", { - get: function() { - return this._getControlledValue() || this.state.inputValue || ''; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "selectionStart", { - get: function() { - return this._inputElement.current ? this._inputElement.current.selectionStart : -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "selectionEnd", { - get: function() { - return this._inputElement.current ? this._inputElement.current.selectionEnd : -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "inputElement", { - get: function() { - return this._inputElement.current; - }, - enumerable: false, - configurable: true - }); - Autofill.prototype.componentDidUpdate = function(_, _1, cursor) { - var _a; - var _b = this.props, suggestedDisplayValue = _b.suggestedDisplayValue, shouldSelectFullInputValueInComponentDidUpdate = _b.shouldSelectFullInputValueInComponentDidUpdate, preventValueSelection = _b.preventValueSelection; - var differenceIndex = 0; - if (preventValueSelection) return; - var document = ((_a = this.context) === null || _a === void 0 ? void 0 : _a.window.document) || (0, _utilities.getDocument)(this._inputElement.current); - var isFocused = this._inputElement.current && this._inputElement.current === (document === null || document === void 0 ? void 0 : document.activeElement); - if (isFocused && this._autoFillEnabled && this.value && suggestedDisplayValue && _doesTextStartWith(suggestedDisplayValue, this.value)) { - var shouldSelectFullRange = false; - if (shouldSelectFullInputValueInComponentDidUpdate) shouldSelectFullRange = shouldSelectFullInputValueInComponentDidUpdate(); - if (shouldSelectFullRange) this._inputElement.current.setSelectionRange(0, suggestedDisplayValue.length, SELECTION_BACKWARD); - else { - while(differenceIndex < this.value.length && this.value[differenceIndex].toLocaleLowerCase() === suggestedDisplayValue[differenceIndex].toLocaleLowerCase())differenceIndex++; - if (differenceIndex > 0) this._inputElement.current.setSelectionRange(differenceIndex, suggestedDisplayValue.length, SELECTION_BACKWARD); - } - } else if (this._inputElement.current) { - if (cursor !== null && !this._autoFillEnabled && !this.state.isComposing) this._inputElement.current.setSelectionRange(cursor.start, cursor.end, cursor.dir); + } + TooltipHostBase2.prototype.render = function() { + var _a2 = this.props, calloutProps = _a2.calloutProps, children2 = _a2.children, content2 = _a2.content, directionalHint = _a2.directionalHint, directionalHintForRTL = _a2.directionalHintForRTL, className2 = _a2.hostClassName, id2 = _a2.id, _b2 = _a2.setAriaDescribedBy, setAriaDescribedBy = _b2 === void 0 ? true : _b2, tooltipProps = _a2.tooltipProps, styles = _a2.styles, theme = _a2.theme; + this._classNames = getClassNames$d(styles, { + theme, + className: className2 + }); + var isTooltipVisible = this.state.isTooltipVisible; + var tooltipId = id2 || this._defaultTooltipId; + var tooltipRenderProps = __assign$1(__assign$1({ id: "".concat(tooltipId, "--tooltip"), content: content2, targetElement: this._getTargetElement(), directionalHint, directionalHintForRTL, calloutProps: assign({}, calloutProps, { + onDismiss: this._hideTooltip, + onFocus: this._onTooltipContentFocus, + onMouseEnter: this._onTooltipMouseEnter, + onMouseLeave: this._onTooltipMouseLeave + }), onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave }, getNativeProps(this.props, divProperties, ["id"])), tooltipProps); + var tooltipContent = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.onRenderContent) ? tooltipProps.onRenderContent(tooltipRenderProps, function(props) { + return (props === null || props === void 0 ? void 0 : props.content) ? React__namespace.createElement(React__namespace.Fragment, null, props.content) : null; + }) : content2; + var showTooltip = isTooltipVisible && !!tooltipContent; + var ariaDescribedBy = setAriaDescribedBy && isTooltipVisible && !!tooltipContent ? tooltipId : void 0; + return React__namespace.createElement( + "div", + { className: this._classNames.root, ref: this._tooltipHost, onFocusCapture: this._onTooltipFocus, onBlurCapture: this._onTooltipBlur, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave, onKeyDown: this._onTooltipKeyDown, role: "none", "aria-describedby": ariaDescribedBy }, + children2, + showTooltip && React__namespace.createElement(Tooltip, __assign$1({}, tooltipRenderProps)), + React__namespace.createElement("div", { hidden: true, id: tooltipId, style: hiddenContentStyle }, tooltipContent) + ); + }; + TooltipHostBase2.prototype.componentDidMount = function() { + this._async = new Async(this); + }; + TooltipHostBase2.prototype.componentWillUnmount = function() { + if (TooltipHostBase2._currentVisibleTooltip && TooltipHostBase2._currentVisibleTooltip === this) { + TooltipHostBase2._currentVisibleTooltip = void 0; } - }; - Autofill.prototype.componentWillUnmount = function() { this._async.dispose(); + }; + TooltipHostBase2.defaultProps = { + delay: TooltipDelay.medium + }; + TooltipHostBase2.contextType = WindowContext; + return TooltipHostBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$8 = { + root: "ms-TooltipHost", + ariaPlaceholder: "ms-TooltipHost-aria-placeholder" + }; + var getStyles$b = function(props) { + var className2 = props.className, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$8, theme); + return { + root: [ + classNames2.root, + { + display: "inline" + }, + className2 + ] }; - Autofill.prototype.render = function() { - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.inputProperties)); - var style = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.props.style), { - fontFamily: 'inherit' - }); - return _react.createElement("input", (0, _tslib.__assign)({ - autoCapitalize: "off", - autoComplete: "off", - "aria-autocomplete": 'both' - }, nativeProps, { - style: style, - ref: this._inputElement, - value: this._getDisplayValue(), - onCompositionStart: this._onCompositionStart, - onCompositionUpdate: this._onCompositionUpdate, - onCompositionEnd: this._onCompositionEnd, - // TODO (Fabric 8?) - switch to calling only onChange. See notes in TextField._onInputChange. - onChange: this._onChanged, - onInput: this._onInputChanged, - onKeyDown: this._onKeyDown, - onClick: this.props.onClick ? this.props.onClick : this._onClick, - "data-lpignore": true - })); - }; - Autofill.prototype.focus = function() { - this._inputElement.current && this._inputElement.current.focus(); - }; - Autofill.prototype.clear = function() { - this._autoFillEnabled = true; - this._updateValue('', false); - this._inputElement.current && this._inputElement.current.setSelectionRange(0, 0); - }; - Autofill.prototype.getSnapshotBeforeUpdate = function() { - var _a, _b; - var inel = this._inputElement.current; - if (inel && inel.selectionStart !== this.value.length) return { - start: (_a = inel.selectionStart) !== null && _a !== void 0 ? _a : inel.value.length, - end: (_b = inel.selectionEnd) !== null && _b !== void 0 ? _b : inel.value.length, - dir: inel.selectionDirection || 'backward' + }; + var TooltipHost = styled(TooltipHostBase, getStyles$b, void 0, { + scope: "TooltipHost" + }); + var getClassNames$c = classNamesFunction(); + var CommandBarBase = ( + /** @class */ + (function(_super) { + __extends(CommandBarBase2, _super); + function CommandBarBase2(props) { + var _this = _super.call(this, props) || this; + _this._overflowSet = React__namespace.createRef(); + _this._resizeGroup = React__namespace.createRef(); + _this._onRenderData = function(data2) { + var _a2 = _this.props, ariaLabel2 = _a2.ariaLabel, primaryGroupAriaLabel = _a2.primaryGroupAriaLabel, farItemsGroupAriaLabel = _a2.farItemsGroupAriaLabel; + var hasSecondSet = data2.farItems && data2.farItems.length > 0; + return React__namespace.createElement( + FocusZone, + { className: css(_this._classNames.root), direction: FocusZoneDirection.horizontal, role: "menubar", "aria-label": ariaLabel2 }, + React__namespace.createElement(OverflowSet, { role: hasSecondSet ? "group" : "none", "aria-label": hasSecondSet ? primaryGroupAriaLabel : void 0, componentRef: _this._overflowSet, className: css(_this._classNames.primarySet), items: data2.primaryItems, overflowItems: data2.overflowItems.length ? data2.overflowItems : void 0, onRenderItem: _this._onRenderItem, onRenderOverflowButton: _this._onRenderOverflowButton }), + hasSecondSet && React__namespace.createElement(OverflowSet, { role: "group", "aria-label": farItemsGroupAriaLabel, className: css(_this._classNames.secondarySet), items: data2.farItems, onRenderItem: _this._onRenderItem, onRenderOverflowButton: nullRender }) + ); }; - return null; - }; - Autofill.prototype._getCurrentInputValue = function(ev) { - if (ev && ev.target && ev.target.value) return ev.target.value; - else if (this.inputElement && this.inputElement.value) return this.inputElement.value; - else return ''; - }; - /** - * Attempts to enable autofill. Whether or not autofill is enabled depends on the input value, - * whether or not any text is selected, and only if the new input value is longer than the old input value. - * Autofill should never be set to true if the value is composing. Once compositionEnd is called, then - * it should be completed. - * See https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent for more information on composition. - * @param newValue - new input value - * @param oldValue - old input value - * @param isComposing - if true then the text is actively being composed and it has not completed. - * @param isComposed - if the text is a composed text value. - */ Autofill.prototype._tryEnableAutofill = function(newValue, oldValue, isComposing, isComposed) { - if (!isComposing && newValue && this._inputElement.current && this._inputElement.current.selectionStart === newValue.length && !this._autoFillEnabled && (newValue.length > oldValue.length || isComposed)) this._autoFillEnabled = true; - }; - Autofill.prototype._getDisplayValue = function() { - if (this._autoFillEnabled) return _getDisplayValue(this.value, this.props.suggestedDisplayValue); - return this.value; - }; - Autofill.prototype._getControlledValue = function() { - var value = this.props.value; - if (value === undefined || typeof value === 'string') return value; - // eslint-disable-next-line no-console - console.warn("props.value of Autofill should be a string, but it is ".concat(value, " with type of ").concat(typeof value)); - return value.toString(); - }; - Autofill.defaultProps = { - enableAutofillOnKeyPress: [ - (0, _utilities.KeyCodes).down, - (0, _utilities.KeyCodes).up - ] - }; - // need to check WindowContext to get the provided document - Autofill.contextType = (0, _reactWindowProvider.WindowContext); - return Autofill; -}(_react.Component); -/** - * Returns a string that should be used as the display value. - * It evaluates this based on whether or not the suggested value starts with the input value - * and whether or not autofill is enabled. - * @param inputValue - the value that the input currently has. - * @param suggestedDisplayValue - the possible full value - */ function _getDisplayValue(inputValue, suggestedDisplayValue) { - var displayValue = inputValue; - if (suggestedDisplayValue && inputValue && _doesTextStartWith(suggestedDisplayValue, displayValue)) displayValue = suggestedDisplayValue; - return displayValue; -} -function _doesTextStartWith(text, startWith) { - if (!text || !startWith) return false; - var _i, _a, val; - return text.toLocaleLowerCase().indexOf(startWith.toLocaleLowerCase()) === 0; -} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dwb0b":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Checkbox/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Checkbox/index":"kodpt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kodpt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _checkbox = require("./Checkbox"); -parcelHelpers.exportAll(_checkbox, exports); -var _checkboxBase = require("./Checkbox.base"); -parcelHelpers.exportAll(_checkboxBase, exports); -var _checkboxTypes = require("./Checkbox.types"); -parcelHelpers.exportAll(_checkboxTypes, exports); - -},{"./Checkbox":"MX8EY","./Checkbox.base":false,"./Checkbox.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"MX8EY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Checkbox", ()=>Checkbox); -var _utilities = require("@fluentui/utilities"); -var _checkboxBase = require("./Checkbox.base"); -var _checkboxStyles = require("./Checkbox.styles"); -var Checkbox = (0, _utilities.styled)((0, _checkboxBase.CheckboxBase), (0, _checkboxStyles.getStyles), undefined, { - scope: 'Checkbox' -}); - -},{"@fluentui/utilities":"55bj3","./Checkbox.base":"fwXOI","./Checkbox.styles":"jorBQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fwXOI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CheckboxBase", ()=>CheckboxBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _icon = require("../Icon/Icon"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var CheckboxBase = _react.forwardRef(function(props, forwardedRef) { - var disabled = props.disabled, required = props.required, inputProps = props.inputProps, name = props.name, ariaLabel = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, ariaPositionInSet = props.ariaPositionInSet, ariaSetSize = props.ariaSetSize, title = props.title, checkmarkIconProps = props.checkmarkIconProps, styles = props.styles, theme = props.theme, className = props.className, _a = props.boxSide, boxSide = _a === void 0 ? 'start' : _a; - var id = (0, _reactHooks.useId)('checkbox-', props.id); - var rootRef = _react.useRef(null); - var mergedRootRefs = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var inputRef = _react.useRef(null); - var _b = (0, _reactHooks.useControllableValue)(props.checked, props.defaultChecked, props.onChange), isChecked = _b[0], setIsChecked = _b[1]; - var _c = (0, _reactHooks.useControllableValue)(props.indeterminate, props.defaultIndeterminate), isIndeterminate = _c[0], setIsIndeterminate = _c[1]; - (0, _utilities.useFocusRects)(rootRef); - useDebugWarning(props); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - disabled: disabled, - indeterminate: isIndeterminate, - checked: isChecked, - reversed: boxSide !== 'start', - isUsingCustomLabelRender: !!props.onRenderLabel - }); - var onChange = _react.useCallback(function(event) { - if (isIndeterminate) { - // If indeterminate, clicking the checkbox *only* removes the indeterminate state (or if - // controlled, lets the consumer know to change it by calling onChange). It doesn't - // change the checked state. - setIsChecked(!!isChecked, event); - setIsIndeterminate(false); - } else setIsChecked(!isChecked, event); - }, [ - setIsChecked, - setIsIndeterminate, - isIndeterminate, - isChecked - ]); - var defaultLabelRenderer = _react.useCallback(function(checkboxProps) { - if (!checkboxProps) return null; - return checkboxProps.label ? _react.createElement("span", { - className: classNames.text, - title: checkboxProps.title - }, checkboxProps.label) : null; - }, [ - classNames.text - ]); - var setNativeIndeterminate = _react.useCallback(function(indeterminate1) { - if (!inputRef.current) return; - var value = !!indeterminate1; - inputRef.current.indeterminate = value; - setIsIndeterminate(value); - }, [ - setIsIndeterminate - ]); - useComponentRef(props, isChecked, isIndeterminate, setNativeIndeterminate, inputRef); - _react.useEffect(function() { - return setNativeIndeterminate(isIndeterminate); - }, [ - setNativeIndeterminate, - isIndeterminate - ]); - var onRenderLabel = props.onRenderLabel || defaultLabelRenderer; - var ariaChecked = isIndeterminate ? 'mixed' : undefined; - var mergedInputProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - className: classNames.input, - type: 'checkbox' - }, inputProps), { - checked: !!isChecked, - disabled: disabled, - required: required, - name: name, - id: id, - title: title, - onChange: onChange, - 'aria-disabled': disabled, - 'aria-label': ariaLabel, - 'aria-labelledby': ariaLabelledBy, - 'aria-describedby': ariaDescribedBy, - 'aria-posinset': ariaPositionInSet, - 'aria-setsize': ariaSetSize, - 'aria-checked': ariaChecked - }); - return _react.createElement("div", { - className: classNames.root, - title: title, - ref: mergedRootRefs - }, _react.createElement("input", (0, _tslib.__assign)({}, mergedInputProps, { - ref: inputRef, - title: title, - "data-ktp-execute-target": true - })), _react.createElement("label", { - className: classNames.label, - htmlFor: id - }, _react.createElement("div", { - className: classNames.checkbox, - "data-ktp-target": true - }, _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - iconName: "CheckMark" - }, checkmarkIconProps, { - className: classNames.checkmark - }))), onRenderLabel(props, defaultLabelRenderer))); -}); -CheckboxBase.displayName = 'CheckboxBase'; -function useDebugWarning(props) {} -function useComponentRef(props, isChecked, isIndeterminate, setIndeterminate, checkBoxRef) { - _react.useImperativeHandle(props.componentRef, function() { - return { - get checked () { - return !!isChecked; - }, - get indeterminate () { - return !!isIndeterminate; - }, - set indeterminate (indeterminate){ - setIndeterminate(indeterminate); - }, - focus: function() { - if (checkBoxRef.current) checkBoxRef.current.focus(); - } + _this._onRenderItem = function(item) { + if (item.onRender) { + return item.onRender(item, function() { + return void 0; + }); + } + var itemText = item.text || item.name; + var commandButtonProps = __assign$1(__assign$1({ allowDisabledFocus: true, role: "menuitem" }, item), { styles: getCommandButtonStyles(item.buttonStyles), className: css("ms-CommandBarItem-link", item.className), text: !item.iconOnly ? itemText : void 0, menuProps: item.subMenuProps, onClick: _this._onButtonClick(item) }); + if (item.iconOnly && (itemText !== void 0 || item.tooltipHostProps)) { + return React__namespace.createElement(TooltipHost, __assign$1({ + role: "none", + content: itemText, + // eslint-disable-next-line @typescript-eslint/no-deprecated + setAriaDescribedBy: false + }, item.tooltipHostProps), _this._commandButton(item, commandButtonProps)); + } + return _this._commandButton(item, commandButtonProps); + }; + _this._commandButton = function(item, props2) { + var ButtonAs = _this.props.buttonAs; + var CommandBarButtonAs = item.commandBarButtonAs; + var DefaultButtonAs = CommandBarButton; + var Type = DefaultButtonAs; + if (CommandBarButtonAs) { + Type = composeComponentAs(CommandBarButtonAs, Type); + } + if (ButtonAs) { + Type = composeComponentAs(ButtonAs, Type); + } + return React__namespace.createElement(Type, __assign$1({}, props2)); }; - }, [ - checkBoxRef, - isChecked, - isIndeterminate, - setIndeterminate - ]); -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../Icon/Icon":"gfQnz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jorBQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styleUtilities = require("@fluentui/style-utilities"); -var _utilities = require("@fluentui/utilities"); -var GlobalClassNames = { - root: 'ms-Checkbox', - label: 'ms-Checkbox-label', - checkbox: 'ms-Checkbox-checkbox', - checkmark: 'ms-Checkbox-checkmark', - text: 'ms-Checkbox-text' -}; -var MS_CHECKBOX_LABEL_SIZE = '20px'; -var MS_CHECKBOX_TRANSITION_DURATION = '200ms'; -var MS_CHECKBOX_TRANSITION_TIMING = 'cubic-bezier(.4, 0, .23, 1)'; -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; - var className = props.className, theme = props.theme, reversed = props.reversed, checked = props.checked, disabled = props.disabled, isUsingCustomLabelRender = props.isUsingCustomLabelRender, indeterminate = props.indeterminate; - var semanticColors = theme.semanticColors, effects = theme.effects, palette = theme.palette, fonts = theme.fonts; - var classNames = (0, _styleUtilities.getGlobalClassNames)(GlobalClassNames, theme); - var checkmarkFontColor = semanticColors.inputForegroundChecked; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBorder - var checkmarkFontColorHovered = palette.neutralSecondary; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.smallInputBorder - var checkboxBorderColor = palette.neutralPrimary; - var checkboxBorderIndeterminateColor = semanticColors.inputBackgroundChecked; - var checkboxBorderColorChecked = semanticColors.inputBackgroundChecked; - var checkboxBorderColorDisabled = semanticColors.disabledBodySubtext; - var checkboxBorderHoveredColor = semanticColors.inputBorderHovered; - var checkboxBorderIndeterminateHoveredColor = semanticColors.inputBackgroundCheckedHovered; - var checkboxBackgroundChecked = semanticColors.inputBackgroundChecked; - // TODO: after updating the semanticColors slots mapping the following 2 tokens need to be - // semanticColors.inputBackgroundCheckedHovered - var checkboxBackgroundCheckedHovered = semanticColors.inputBackgroundCheckedHovered; - var checkboxBorderColorCheckedHovered = semanticColors.inputBackgroundCheckedHovered; - var checkboxHoveredTextColor = semanticColors.inputTextHovered; - var checkboxBackgroundDisabledChecked = semanticColors.disabledBodySubtext; - var checkboxTextColor = semanticColors.bodyText; - var checkboxTextColorDisabled = semanticColors.disabledText; - var indeterminateDotStyles = [ - (_a = { - content: '""', - borderRadius: effects.roundedCorner2, - position: 'absolute', - width: 10, - height: 10, - top: 4, - left: 4, - boxSizing: 'border-box', - borderWidth: 5, - borderStyle: 'solid', - borderColor: disabled ? checkboxBorderColorDisabled : checkboxBorderIndeterminateColor, - transitionProperty: 'border-width, border, border-color', - transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, - transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING - }, _a[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'WindowText' - }, _a) - ]; + _this._onRenderOverflowButton = function(overflowItems) { + var _a2 = _this.props.overflowButtonProps, overflowButtonProps = _a2 === void 0 ? {} : _a2; + var combinedOverflowItems = __spreadArray(__spreadArray([], overflowButtonProps.menuProps ? overflowButtonProps.menuProps.items : [], true), overflowItems, true); + var overflowProps = __assign$1(__assign$1({ role: "menuitem" }, overflowButtonProps), { styles: __assign$1({ menuIcon: { fontSize: "17px" } }, overflowButtonProps.styles), className: css("ms-CommandBar-overflowButton", overflowButtonProps.className), menuProps: __assign$1(__assign$1({}, overflowButtonProps.menuProps), { items: combinedOverflowItems }), menuIconProps: __assign$1({ iconName: "More" }, overflowButtonProps.menuIconProps) }); + var OverflowButtonType = _this.props.overflowButtonAs ? composeComponentAs(_this.props.overflowButtonAs, CommandBarButton) : CommandBarButton; + return React__namespace.createElement(OverflowButtonType, __assign$1({}, overflowProps)); + }; + _this._onReduceData = function(data2) { + var _a2 = _this.props, shiftOnReduce = _a2.shiftOnReduce, onDataReduced = _a2.onDataReduced; + var primaryItems = data2.primaryItems, overflowItems = data2.overflowItems, cacheKey = data2.cacheKey; + var farItems = data2.farItems; + var movedItem = primaryItems[shiftOnReduce ? 0 : primaryItems.length - 1]; + if (movedItem !== void 0) { + movedItem.renderedInOverflow = true; + overflowItems = __spreadArray([movedItem], overflowItems, true); + primaryItems = shiftOnReduce ? primaryItems.slice(1) : primaryItems.slice(0, -1); + var newData = __assign$1(__assign$1({}, data2), { primaryItems, overflowItems }); + cacheKey = _this._computeCacheKey({ primaryItems, overflow: overflowItems.length > 0, farItems }); + if (onDataReduced) { + onDataReduced(movedItem); + } + newData.cacheKey = cacheKey; + return newData; + } + return void 0; + }; + _this._onGrowData = function(data2) { + var _a2 = _this.props, shiftOnReduce = _a2.shiftOnReduce, onDataGrown = _a2.onDataGrown; + var minimumOverflowItems = data2.minimumOverflowItems; + var primaryItems = data2.primaryItems, overflowItems = data2.overflowItems, cacheKey = data2.cacheKey; + var farItems = data2.farItems; + var movedItem = overflowItems[0]; + if (movedItem !== void 0 && overflowItems.length > minimumOverflowItems) { + movedItem.renderedInOverflow = false; + overflowItems = overflowItems.slice(1); + primaryItems = shiftOnReduce ? __spreadArray([movedItem], primaryItems, true) : __spreadArray(__spreadArray([], primaryItems, true), [movedItem], false); + var newData = __assign$1(__assign$1({}, data2), { primaryItems, overflowItems }); + cacheKey = _this._computeCacheKey({ primaryItems, overflow: overflowItems.length > 0, farItems }); + if (onDataGrown) { + onDataGrown(movedItem); + } + newData.cacheKey = cacheKey; + return newData; + } + return void 0; + }; + initializeComponentRef(_this); + return _this; + } + CommandBarBase2.prototype.render = function() { + var _a2 = this.props, items = _a2.items, overflowItems = _a2.overflowItems, farItems = _a2.farItems, styles = _a2.styles, theme = _a2.theme, dataDidRender = _a2.dataDidRender, _b2 = _a2.onReduceData, onReduceData = _b2 === void 0 ? this._onReduceData : _b2, _c2 = _a2.onGrowData, onGrowData = _c2 === void 0 ? this._onGrowData : _c2, _d2 = _a2.resizeGroupAs, ResizeGroupAs = _d2 === void 0 ? ResizeGroup : _d2; + var commandBarData = { + primaryItems: __spreadArray([], items, true), + overflowItems: __spreadArray([], overflowItems, true), + minimumOverflowItems: __spreadArray([], overflowItems, true).length, + // for tracking + farItems, + cacheKey: this._computeCacheKey({ + primaryItems: __spreadArray([], items, true), + overflow: overflowItems && overflowItems.length > 0, + farItems + }) + }; + this._classNames = getClassNames$c(styles, { theme }); + var nativeProps = getNativeProps(this.props, divProperties); + return React__namespace.createElement(ResizeGroupAs, __assign$1({}, nativeProps, { componentRef: this._resizeGroup, data: commandBarData, onReduceData, onGrowData, onRenderData: this._onRenderData, dataDidRender })); + }; + CommandBarBase2.prototype.focus = function() { + var overflowSet = this._overflowSet.current; + overflowSet && overflowSet.focus(); + }; + CommandBarBase2.prototype.remeasure = function() { + this._resizeGroup.current && this._resizeGroup.current.remeasure(); + }; + CommandBarBase2.prototype._onButtonClick = function(item) { + return function(ev) { + if (item.inactive) { + return; + } + if (item.onClick) { + item.onClick(ev, item); + } + }; + }; + CommandBarBase2.prototype._computeCacheKey = function(data2) { + var primaryItems = data2.primaryItems, overflow = data2.overflow, farItems = data2.farItems; + var returnKey = function(acc, current) { + var _a2 = current.cacheKey, cacheKey = _a2 === void 0 ? current.key : _a2; + return acc + cacheKey; + }; + var primaryKey = primaryItems && primaryItems.reduce(returnKey, ""); + var overflowKey = overflow ? "overflow" : ""; + var farKey = farItems && farItems.reduce(returnKey, ""); + return [primaryKey, overflowKey, farKey].join(""); + }; + CommandBarBase2.defaultProps = { + items: [], + overflowItems: [] + }; + return CommandBarBase2; + })(React__namespace.Component) + ); + var CommandBar = styled(CommandBarBase, getStyles$e, void 0, { + scope: "CommandBar" + }); + var DialogType; + (function(DialogType2) { + DialogType2[DialogType2["normal"] = 0] = "normal"; + DialogType2[DialogType2["largeHeader"] = 1] = "largeHeader"; + DialogType2[DialogType2["close"] = 2] = "close"; + })(DialogType || (DialogType = {})); + var animationDuration = AnimationVariables.durationValue2; + var globalClassNames$1 = { + root: "ms-Modal", + main: "ms-Dialog-main", + scrollableContent: "ms-Modal-scrollableContent", + isOpen: "is-open", + layer: "ms-Modal-Layer" + }; + var getStyles$a = function(props) { + var _a2; + var className2 = props.className, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, isOpen = props.isOpen, isVisible = props.isVisible, hasBeenOpened = props.hasBeenOpened, modalRectangleTop = props.modalRectangleTop, theme = props.theme, topOffsetFixed = props.topOffsetFixed, isModeless = props.isModeless, layerClassName = props.layerClassName, isDefaultDragHandle = props.isDefaultDragHandle, windowInnerHeight = props.windowInnerHeight; + var palette = theme.palette, effects = theme.effects, fonts = theme.fonts; + var classNames2 = getGlobalClassNames(globalClassNames$1, theme); + return { + root: [ + classNames2.root, + fonts.medium, + { + backgroundColor: "transparent", + position: "fixed", + height: "100%", + width: "100%", + display: "flex", + alignItems: "center", + justifyContent: "center", + opacity: 0, + pointerEvents: "none", + transition: "opacity ".concat(animationDuration) + }, + topOffsetFixed && typeof modalRectangleTop === "number" && hasBeenOpened && { + alignItems: "flex-start" + }, + isOpen && classNames2.isOpen, + isVisible && { + opacity: 1 + }, + isVisible && !isModeless && { + pointerEvents: "auto" + }, + className2 + ], + main: [ + classNames2.main, + { + boxShadow: effects.elevation64, + borderRadius: effects.roundedCorner2, + backgroundColor: palette.white, + boxSizing: "border-box", + position: "relative", + textAlign: "left", + outline: "3px solid transparent", + maxHeight: "calc(100% - 32px)", + maxWidth: "calc(100% - 32px)", + minHeight: "176px", + minWidth: "288px", + overflowY: "auto", + zIndex: isModeless ? ZIndexes.Layer : void 0 + }, + isModeless && { + pointerEvents: "auto" + }, + topOffsetFixed && typeof modalRectangleTop === "number" && hasBeenOpened && { + top: modalRectangleTop + }, + isDefaultDragHandle && { + cursor: "move" + }, + containerClassName + ], + scrollableContent: [ + classNames2.scrollableContent, + { + overflowY: "auto", + flexGrow: 1, + maxHeight: "100vh", + selectors: (_a2 = {}, _a2["@supports (-webkit-overflow-scrolling: touch)"] = { + maxHeight: windowInnerHeight + }, _a2) + }, + scrollableContentClassName + ], + layer: isModeless && [layerClassName, classNames2.layer, { pointerEvents: "none" }], + keyboardMoveIconContainer: { + position: "absolute", + display: "flex", + justifyContent: "center", + width: "100%", + padding: "3px 0px" + }, + keyboardMoveIcon: { + // eslint-disable-next-line @typescript-eslint/no-deprecated + fontSize: fonts.xLargePlus.fontSize, + width: "24px" + } + }; + }; + var getClassNames$b = classNamesFunction(); + var OverlayBase = ( + /** @class */ + (function(_super) { + __extends(OverlayBase2, _super); + function OverlayBase2(props) { + var _this = _super.call(this, props) || this; + initializeComponentRef(_this); + var _a2 = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a2 === void 0 ? false : _a2; + _this._allowTouchBodyScroll = allowTouchBodyScroll; + return _this; + } + OverlayBase2.prototype.componentDidMount = function() { + !this._allowTouchBodyScroll && disableBodyScroll(); + }; + OverlayBase2.prototype.componentWillUnmount = function() { + !this._allowTouchBodyScroll && enableBodyScroll(); + }; + OverlayBase2.prototype.render = function() { + var _a2 = this.props, isDark = _a2.isDarkThemed, className2 = _a2.className, theme = _a2.theme, styles = _a2.styles; + var divProps = getNativeProps(this.props, divProperties); + var classNames2 = getClassNames$b(styles, { + theme, + className: className2, + isDark + }); + return React__namespace.createElement("div", __assign$1({}, divProps, { className: classNames2.root })); + }; + return OverlayBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$7 = { + root: "ms-Overlay", + rootDark: "ms-Overlay--dark" + }; + var getStyles$9 = function(props) { + var _a2; + var className2 = props.className, theme = props.theme, isNone = props.isNone, isDark = props.isDark; + var palette = theme.palette; + var classNames2 = getGlobalClassNames(GlobalClassNames$7, theme); return { - root: [ - classNames.root, - { - position: 'relative', - display: 'flex' - }, - reversed && 'reversed', - checked && 'is-checked', - !disabled && 'is-enabled', - disabled && 'is-disabled', - !disabled && [ - !checked && (_b = {}, _b[":hover .".concat(classNames.checkbox)] = (_c = { - borderColor: checkboxBorderHoveredColor - }, _c[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _c), _b[":focus .".concat(classNames.checkbox)] = { - borderColor: checkboxBorderHoveredColor - }, _b[":hover .".concat(classNames.checkmark)] = (_d = { - color: checkmarkFontColorHovered, - opacity: '1' - }, _d[0, _styleUtilities.HighContrastSelector] = { - color: 'Highlight' - }, _d), _b), - checked && !indeterminate && (_e = {}, _e[":hover .".concat(classNames.checkbox)] = { - background: checkboxBackgroundCheckedHovered, - borderColor: checkboxBorderColorCheckedHovered - }, _e[":focus .".concat(classNames.checkbox)] = { - background: checkboxBackgroundCheckedHovered, - borderColor: checkboxBorderColorCheckedHovered - }, _e[0, _styleUtilities.HighContrastSelector] = (_f = {}, _f[":hover .".concat(classNames.checkbox)] = { - background: 'Highlight', - borderColor: 'Highlight' - }, _f[":focus .".concat(classNames.checkbox)] = { - background: 'Highlight' - }, _f[":focus:hover .".concat(classNames.checkbox)] = { - background: 'Highlight' - }, _f[":focus:hover .".concat(classNames.checkmark)] = { - color: 'Window' - }, _f[":hover .".concat(classNames.checkmark)] = { - color: 'Window' - }, _f), _e), - indeterminate && (_g = {}, _g[":hover .".concat(classNames.checkbox, ", :hover .").concat(classNames.checkbox, ":after")] = (_h = { - borderColor: checkboxBorderIndeterminateHoveredColor - }, _h[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'WindowText' - }, _h), _g[":focus .".concat(classNames.checkbox)] = { - borderColor: checkboxBorderIndeterminateHoveredColor - }, _g[":hover .".concat(classNames.checkmark)] = { - opacity: '0' - }, _g), - (_j = {}, _j[":hover .".concat(classNames.text, ", :focus .").concat(classNames.text)] = (_k = { - color: checkboxHoveredTextColor - }, _k[0, _styleUtilities.HighContrastSelector] = { - color: disabled ? 'GrayText' : 'WindowText' - }, _k), _j) - ], - className - ], - input: (_l = { - position: 'absolute', - background: 'none', + root: [ + classNames2.root, + theme.fonts.medium, + { + backgroundColor: palette.whiteTranslucent40, + top: 0, + right: 0, + bottom: 0, + left: 0, + position: "absolute", + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + border: "1px solid WindowText", opacity: 0 - }, // eslint-disable-next-line @fluentui/max-len - _l[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus + label::before, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus + label::before")] = (_m = { - outline: '1px solid ' + theme.palette.neutralSecondary, - outlineOffset: '2px' - }, _m[0, _styleUtilities.HighContrastSelector] = { - outline: '1px solid WindowText' - }, _m), _l), - label: [ - classNames.label, - theme.fonts.medium, - { - display: 'flex', - alignItems: isUsingCustomLabelRender ? 'center' : 'flex-start', - cursor: disabled ? 'default' : 'pointer', - position: 'relative', - userSelect: 'none' - }, - reversed && { - flexDirection: 'row-reverse', - justifyContent: 'flex-end' - }, - { - '&::before': { - position: 'absolute', - left: 0, - right: 0, - top: 0, - bottom: 0, - content: '""', - pointerEvents: 'none' - } - } - ], - checkbox: [ - classNames.checkbox, - (_o = { - position: 'relative', - display: 'flex', - flexShrink: 0, - alignItems: 'center', - justifyContent: 'center', - height: MS_CHECKBOX_LABEL_SIZE, - width: MS_CHECKBOX_LABEL_SIZE, - border: "1px solid ".concat(checkboxBorderColor), - borderRadius: effects.roundedCorner2, - boxSizing: 'border-box', - transitionProperty: 'background, border, border-color', - transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, - transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING, - /* in case the icon is bigger than the box */ overflow: 'hidden', - ':after': indeterminate ? indeterminateDotStyles : null - }, _o[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'WindowText' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _o), - indeterminate && { - borderColor: checkboxBorderIndeterminateColor - }, - !reversed ? // is used, there will be only a 4px margin from checkbox to label. The label by default would have - // another 4px margin for a total of 8px margin between checkbox and label. We don't combine the two - // (and move it into the text) to not incur a breaking change for everyone using custom render atm. - { - marginRight: 4 - } : { - marginLeft: 4 - }, - !disabled && !indeterminate && checked && (_p = { - background: checkboxBackgroundChecked, - borderColor: checkboxBorderColorChecked - }, _p[0, _styleUtilities.HighContrastSelector] = { - background: 'Highlight', - borderColor: 'Highlight' - }, _p), - disabled && (_q = { - borderColor: checkboxBorderColorDisabled - }, _q[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'GrayText' - }, _q), - checked && disabled && (_r = { - background: checkboxBackgroundDisabledChecked, - borderColor: checkboxBorderColorDisabled - }, _r[0, _styleUtilities.HighContrastSelector] = { - background: 'Window' - }, _r) - ], - checkmark: [ - classNames.checkmark, - (_s = { - opacity: checked && !indeterminate ? '1' : '0', - color: checkmarkFontColor - }, _s[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - color: disabled ? 'GrayText' : 'Window' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _s) + }, _a2) + }, + isNone && { + visibility: "hidden" + }, + isDark && [ + classNames2.rootDark, + { + backgroundColor: palette.blackTranslucent40 + } ], - text: [ - classNames.text, - (_t = { - color: disabled ? checkboxTextColorDisabled : checkboxTextColor, - fontSize: fonts.medium.fontSize, - lineHeight: '20px' - }, _t[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - color: disabled ? 'GrayText' : 'WindowText' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _t), - !reversed ? { - marginLeft: 4 - } : { - marginRight: 4 - } - ] + className2 + ] }; -}; - -},{"tslib":"9gizs","@fluentui/style-utilities":"bJvmh","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5808M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getOptionStyles", ()=>getOptionStyles); -parcelHelpers.export(exports, "getCaretDownButtonStyles", ()=>getCaretDownButtonStyles); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var _a, _b; -var ComboBoxHeight = 32; -var ComboBoxLineHeight = 30; -var ComboBoxCaretDownWidth = 32; -var ComboBoxOptionHeight = 36; -var getDisabledStyles = (0, _utilities.memoizeFunction)(function(theme) { - var _a; - var semanticColors = theme.semanticColors; + }; + var Overlay = styled(OverlayBase, getStyles$9, void 0, { + scope: "Overlay" + }); + var getClassNames$a = memoizeFunction(function(className2, isDragging) { return { - backgroundColor: semanticColors.disabledBackground, - color: semanticColors.disabledText, - cursor: 'default', - selectors: (_a = { - ':after': { - borderColor: semanticColors.disabledBackground - } - }, _a[0, _styling.HighContrastSelector] = { - color: 'GrayText', - selectors: { - ':after': { - borderColor: 'GrayText' - } - } - }, _a) - }; -}); -var listOptionHighContrastStyles = { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) -}; -var inputHighContrastStyles = { - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'WindowText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _b) -}; -var getOptionStyles = (0, _utilities.memoizeFunction)(function(theme, customStylesForAllOptions, customOptionStylesForCurrentOption, isPending, isHidden, isSelected) { - var _a; - var palette = theme.palette, semanticColors = theme.semanticColors; - var option = { - textHoveredColor: semanticColors.menuItemTextHovered, - textSelectedColor: palette.neutralDark, - textDisabledColor: semanticColors.disabledText, - backgroundHoveredColor: semanticColors.menuItemBackgroundHovered, - backgroundPressedColor: semanticColors.menuItemBackgroundPressed - }; - var optionStyles = { - root: [ - theme.fonts.medium, - { - backgroundColor: isPending ? option.backgroundHoveredColor : 'transparent', - boxSizing: 'border-box', - cursor: 'pointer', - display: isHidden ? 'none' : 'block', - width: '100%', - height: 'auto', - minHeight: ComboBoxOptionHeight, - lineHeight: '20px', - padding: '0 8px', - position: 'relative', - borderWidth: '1px', - borderStyle: 'solid', - borderColor: 'transparent', - borderRadius: 0, - wordWrap: 'break-word', - overflowWrap: 'break-word', - textAlign: 'left', - selectors: (0, _tslib.__assign)((0, _tslib.__assign)((_a = {}, _a[0, _styling.HighContrastSelector] = { - border: 'none', - borderColor: 'Background' - }, _a), !isHidden && { - '&.ms-Checkbox': { - display: 'flex', - alignItems: 'center' - } - }), { - '&.ms-Button--command:hover:active': { - backgroundColor: option.backgroundPressedColor - }, - '.ms-Checkbox-label': { - width: '100%' - } - }) - }, - isSelected ? [ - { - backgroundColor: 'transparent', - color: option.textSelectedColor, - selectors: { - ':hover': [ - { - backgroundColor: option.backgroundHoveredColor - }, - listOptionHighContrastStyles - ] - } - }, - (0, _styling.getFocusStyle)(theme, { - inset: -1, - isFocusedOnly: false - }), - listOptionHighContrastStyles - ] : [] - ], - rootHovered: { - backgroundColor: option.backgroundHoveredColor, - color: option.textHoveredColor - }, - rootFocused: { - backgroundColor: option.backgroundHoveredColor - }, - rootDisabled: { - color: option.textDisabledColor, - cursor: 'default' - }, - optionText: { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - minWidth: '0px', - maxWidth: '100%', - wordWrap: 'break-word', - overflowWrap: 'break-word', - display: 'inline-block' - }, - optionTextWrapper: { - maxWidth: '100%', - display: 'flex', - alignItems: 'center' + root: mergeStyles(className2, isDragging && { + touchAction: "none", + selectors: { + "& *": { + userSelect: "none" + } } + }) }; - return (0, _styling.concatStyleSets)(optionStyles, customStylesForAllOptions, customOptionStylesForCurrentOption); -}); -var getCaretDownButtonStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a, _b; - var semanticColors = theme.semanticColors, fonts = theme.fonts; - var caret = { - buttonTextColor: semanticColors.bodySubtext, - buttonTextHoveredCheckedColor: semanticColors.buttonTextChecked, - buttonBackgroundHoveredColor: semanticColors.listItemBackgroundHovered, - buttonBackgroundCheckedColor: semanticColors.listItemBackgroundChecked, - buttonBackgroundCheckedHoveredColor: semanticColors.listItemBackgroundCheckedHovered - }; - var buttonHighContrastStyles = { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) + }); + var eventMapping = { + touch: { + start: "touchstart", + move: "touchmove", + stop: "touchend" + }, + mouse: { + start: "mousedown", + move: "mousemove", + stop: "mouseup" + } + }; + var DraggableZone = ( + /** @class */ + (function(_super) { + __extends(DraggableZone2, _super); + function DraggableZone2(props) { + var _this = _super.call(this, props) || this; + _this._currentEventType = eventMapping.mouse; + _this._events = []; + _this._onMouseDown = function(event2) { + var onMouseDown = React__namespace.Children.only(_this.props.children).props.onMouseDown; + if (onMouseDown) { + onMouseDown(event2); + } + _this._currentEventType = eventMapping.mouse; + return _this._onDragStart(event2); + }; + _this._onMouseUp = function(event2) { + var onMouseUp = React__namespace.Children.only(_this.props.children).props.onMouseUp; + if (onMouseUp) { + onMouseUp(event2); + } + _this._currentEventType = eventMapping.mouse; + return _this._onDragStop(event2); + }; + _this._onTouchStart = function(event2) { + var onTouchStart = React__namespace.Children.only(_this.props.children).props.onTouchStart; + if (onTouchStart) { + onTouchStart(event2); + } + _this._currentEventType = eventMapping.touch; + return _this._onDragStart(event2); + }; + _this._onTouchEnd = function(event2) { + var onTouchEnd = React__namespace.Children.only(_this.props.children).props.onTouchEnd; + if (onTouchEnd) { + onTouchEnd(event2); + } + _this._currentEventType = eventMapping.touch; + _this._onDragStop(event2); + }; + _this._onDragStart = function(event2) { + if (typeof event2.button === "number" && event2.button !== 0) { + return false; + } + if (_this.props.handleSelector && !_this._matchesSelector(event2.target, _this.props.handleSelector) || _this.props.preventDragSelector && _this._matchesSelector(event2.target, _this.props.preventDragSelector)) { + return; + } + _this._touchId = _this._getTouchId(event2); + var position2 = _this._getControlPosition(event2); + if (position2 === void 0) { + return; + } + var dragData = _this._createDragDataFromPosition(position2); + _this.props.onStart && _this.props.onStart(event2, dragData); + _this.setState({ + isDragging: true, + lastPosition: position2 + }); + var doc = getDocumentEx(_this.context); + _this._events = [ + on$1( + doc.body, + _this._currentEventType.move, + _this._onDrag, + true + /* use capture phase */ + ), + on$1( + doc.body, + _this._currentEventType.stop, + _this._onDragStop, + true + /* use capture phase */ + ) + ]; + }; + _this._onDrag = function(event2) { + if (event2.type === "touchmove") { + event2.preventDefault(); + } + var position2 = _this._getControlPosition(event2); + if (!position2) { + return; + } + var updatedData = _this._createUpdatedDragData(_this._createDragDataFromPosition(position2)); + var updatedPosition = updatedData.position; + _this.props.onDragChange && _this.props.onDragChange(event2, updatedData); + _this.setState({ + position: updatedPosition, + lastPosition: position2 + }); + }; + _this._onDragStop = function(event2) { + if (!_this.state.isDragging) { + return; + } + var position2 = _this._getControlPosition(event2); + if (!position2) { + return; + } + var baseDragData = _this._createDragDataFromPosition(position2); + _this.setState({ + isDragging: false, + lastPosition: void 0 + }); + _this.props.onStop && _this.props.onStop(event2, baseDragData); + if (_this.props.position) { + _this.setState({ + position: _this.props.position + }); + } + _this._events.forEach(function(dispose) { + return dispose(); + }); + }; + _this.state = { + isDragging: false, + position: _this.props.position || { x: 0, y: 0 }, + lastPosition: void 0 + }; + return _this; + } + DraggableZone2.prototype.componentDidUpdate = function(prevProps) { + if (this.props.position && (!prevProps.position || this.props.position !== prevProps.position)) { + this.setState({ position: this.props.position }); + } + }; + DraggableZone2.prototype.componentWillUnmount = function() { + this._events.forEach(function(dispose) { + return dispose(); + }); + }; + DraggableZone2.prototype.render = function() { + var child = React__namespace.Children.only(this.props.children); + var props = child.props; + var position2 = this.props.position; + var _a2 = this.state, statePosition = _a2.position, isDragging = _a2.isDragging; + var x2 = statePosition.x; + var y2 = statePosition.y; + if (position2 && !isDragging) { + x2 = position2.x; + y2 = position2.y; + } + return React__namespace.cloneElement(child, { + style: __assign$1(__assign$1({}, props.style), { transform: "translate(".concat(x2, "px, ").concat(y2, "px)") }), + className: getClassNames$a(props.className, this.state.isDragging).root, + onMouseDown: this._onMouseDown, + onMouseUp: this._onMouseUp, + onTouchStart: this._onTouchStart, + onTouchEnd: this._onTouchEnd + }); + }; + DraggableZone2.prototype._getControlPosition = function(event2) { + var touchObj = this._getActiveTouch(event2); + if (this._touchId !== void 0 && !touchObj) { + return void 0; + } + var eventToGetOffset = touchObj || event2; + return { + x: eventToGetOffset.clientX, + y: eventToGetOffset.clientY + }; + }; + DraggableZone2.prototype._getActiveTouch = function(event2) { + return event2.targetTouches && this._findTouchInTouchList(event2.targetTouches) || event2.changedTouches && this._findTouchInTouchList(event2.changedTouches); + }; + DraggableZone2.prototype._getTouchId = function(event2) { + var touch2 = event2.targetTouches && event2.targetTouches[0] || event2.changedTouches && event2.changedTouches[0]; + if (touch2) { + return touch2.identifier; + } + }; + DraggableZone2.prototype._matchesSelector = function(element2, selector) { + var _a2; + if (!element2 || element2 === ((_a2 = getDocumentEx(this.context)) === null || _a2 === void 0 ? void 0 : _a2.body)) { + return false; + } + var matchesSelectorFn = ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + element2.matches || element2.webkitMatchesSelector || element2.msMatchesSelector + ); + if (!matchesSelectorFn) { + return false; + } + return matchesSelectorFn.call(element2, selector) || this._matchesSelector(element2.parentElement, selector); + }; + DraggableZone2.prototype._findTouchInTouchList = function(touchList) { + if (this._touchId === void 0) { + return; + } + for (var i = 0; i < touchList.length; i++) { + if (touchList[i].identifier === this._touchId) { + return touchList[i]; + } + } + return void 0; + }; + DraggableZone2.prototype._createDragDataFromPosition = function(position2) { + var lastPosition = this.state.lastPosition; + if (lastPosition === void 0) { + return { + delta: { x: 0, y: 0 }, + lastPosition: position2, + position: position2 + }; + } + return { + delta: { + x: position2.x - lastPosition.x, + y: position2.y - lastPosition.y + }, + lastPosition, + position: position2 + }; + }; + DraggableZone2.prototype._createUpdatedDragData = function(baseDragData) { + var position2 = this.state.position; + return { + position: { + x: position2.x + baseDragData.delta.x, + y: position2.y + baseDragData.delta.y + }, + delta: baseDragData.delta, + lastPosition: position2 + }; + }; + DraggableZone2.contextType = WindowContext; + return DraggableZone2; + })(React__namespace.Component) + ); + var ZERO = { x: 0, y: 0 }; + var DEFAULT_PROPS$1 = { + isOpen: false, + isDarkOverlay: true, + className: "", + containerClassName: "", + enableAriaHiddenSiblings: true + }; + var getClassNames$9 = classNamesFunction(); + var getMoveDelta = function(ev) { + var delta = 10; + if (ev.shiftKey) { + if (!ev.ctrlKey) { + delta = 50; + } + } else if (ev.ctrlKey) { + delta = 1; + } + return delta; + }; + var useComponentRef$2 = function(props, focusTrapZone) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + focus: function() { + if (focusTrapZone.current) { + focusTrapZone.current.focus(); + } + } + }; + }, [focusTrapZone]); + }; + var ModalBase = React__namespace.forwardRef(function(propsWithoutDefaults, ref2) { + var _a2, _b2, _c2, _d2, _e2; + var props = getPropsWithDefaults(DEFAULT_PROPS$1, propsWithoutDefaults); + var allowTouchBodyScroll = props.allowTouchBodyScroll, className2 = props.className, children2 = props.children, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, focusTrapZoneProps = props.focusTrapZoneProps, forceFocusInsideTrap = props.forceFocusInsideTrap, _f = props.disableRestoreFocus, disableRestoreFocus = _f === void 0 ? props.ignoreExternalFocusing : _f, isBlocking = props.isBlocking, isAlert = props.isAlert, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, onDismiss = props.onDismiss, layerProps = props.layerProps, overlay = props.overlay, isOpen = props.isOpen, titleAriaId = props.titleAriaId, styles = props.styles, subtitleAriaId = props.subtitleAriaId, theme = props.theme, topOffsetFixed = props.topOffsetFixed, responsiveMode = props.responsiveMode, onLayerDidMount = props.onLayerDidMount, isModeless = props.isModeless, dragOptions = props.dragOptions, onDismissed = props.onDismissed, enableAriaHiddenSiblings = props.enableAriaHiddenSiblings, popupProps = props.popupProps; + var rootRef = React__namespace.useRef(null); + var focusTrapZone = React__namespace.useRef(null); + var focusTrapZoneRef = useMergedRefs(focusTrapZone, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.componentRef); + var focusTrapZoneElm = React__namespace.useRef(null); + var mergedRef = useMergedRefs(rootRef, ref2); + var modalResponsiveMode = useResponsiveMode(mergedRef); + var focusTrapZoneId = useId("ModalFocusTrapZone", focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.id); + var win = useWindow(); + var _g = useSetTimeout(), setTimeout2 = _g.setTimeout, clearTimeout2 = _g.clearTimeout; + var _h = React__namespace.useState(isOpen), isModalOpen = _h[0], setIsModalOpen = _h[1]; + var _j = React__namespace.useState(isOpen), isVisible = _j[0], setIsVisible = _j[1]; + var _k = React__namespace.useState(ZERO), coordinates = _k[0], setCoordinates = _k[1]; + var _l = React__namespace.useState(), modalRectangleTop = _l[0], setModalRectangleTop = _l[1]; + var _m = useBoolean(false), isModalMenuOpen = _m[0], _o = _m[1], toggleModalMenuOpen = _o.toggle, setModalMenuClose = _o.setFalse; + var internalState = useConst(function() { + return { + onModalCloseTimer: 0, + allowTouchBodyScroll, + scrollableContent: null, + lastSetCoordinates: ZERO, + events: new EventGroup({}) + }; + }); + var keepInBounds = (dragOptions || {}).keepInBounds; + var isAlertRole = isAlert !== null && isAlert !== void 0 ? isAlert : isBlocking && !isModeless; + var layerClassName = layerProps === void 0 ? "" : layerProps.className; + var classNames2 = getClassNames$9(styles, { + theme, + className: className2, + containerClassName, + scrollableContentClassName, + isOpen, + isVisible, + hasBeenOpened: internalState.hasBeenOpened, + modalRectangleTop, + topOffsetFixed, + isModeless, + layerClassName, + windowInnerHeight: win === null || win === void 0 ? void 0 : win.innerHeight, + isDefaultDragHandle: dragOptions && !dragOptions.dragHandleSelector + }); + var mergedLayerProps = __assign$1(__assign$1({ eventBubblingEnabled: false }, layerProps), { onLayerDidMount: layerProps && layerProps.onLayerDidMount ? layerProps.onLayerDidMount : onLayerDidMount, insertFirst: (layerProps === null || layerProps === void 0 ? void 0 : layerProps.insertFirst) || isModeless, className: classNames2.layer }); + var allowScrollOnModal = React__namespace.useCallback(function(elt) { + if (elt) { + if (internalState.allowTouchBodyScroll) { + allowOverscrollOnElement(elt, internalState.events); + } else { + allowScrollOnElement(elt, internalState.events); + } + } else { + internalState.events.off(internalState.scrollableContent); + } + internalState.scrollableContent = elt; + }, [internalState]); + var registerInitialModalPosition = function() { + var dialogMain = focusTrapZoneElm.current; + var modalRectangle = dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect(); + if (modalRectangle) { + if (topOffsetFixed) { + setModalRectangleTop(modalRectangle.top); + } + if (keepInBounds) { + internalState.minPosition = { x: -modalRectangle.left, y: -modalRectangle.top }; + internalState.maxPosition = { x: modalRectangle.left, y: modalRectangle.top }; + } + } }; - var styles = { - root: { - color: caret.buttonTextColor, - fontSize: fonts.small.fontSize, - position: 'absolute', - top: 0, - height: '100%', - lineHeight: ComboBoxLineHeight, - width: ComboBoxCaretDownWidth, - textAlign: 'center', - cursor: 'default', - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'ButtonFace', - borderColor: 'ButtonText', - color: 'ButtonText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _b) - }, - icon: { - fontSize: fonts.small.fontSize - }, - rootHovered: [ - { - backgroundColor: caret.buttonBackgroundHoveredColor, - color: caret.buttonTextHoveredCheckedColor, - cursor: 'pointer' - }, - buttonHighContrastStyles - ], - rootPressed: [ - { - backgroundColor: caret.buttonBackgroundCheckedColor, - color: caret.buttonTextHoveredCheckedColor - }, - buttonHighContrastStyles - ], - rootChecked: [ - { - backgroundColor: caret.buttonBackgroundCheckedColor, - color: caret.buttonTextHoveredCheckedColor - }, - buttonHighContrastStyles - ], - rootCheckedHovered: [ - { - backgroundColor: caret.buttonBackgroundCheckedHoveredColor, - color: caret.buttonTextHoveredCheckedColor - }, - buttonHighContrastStyles - ], - rootDisabled: [ - getDisabledStyles(theme), - { - position: 'absolute' + var getClampedAxis = React__namespace.useCallback(function(axis, position2) { + var minPosition = internalState.minPosition, maxPosition = internalState.maxPosition; + if (keepInBounds && minPosition && maxPosition) { + position2 = Math.max(minPosition[axis], position2); + position2 = Math.min(maxPosition[axis], position2); + } + return position2; + }, [keepInBounds, internalState]); + var handleModalClose = function() { + var _a22; + internalState.lastSetCoordinates = ZERO; + setModalMenuClose(); + internalState.isInKeyboardMoveMode = false; + setIsModalOpen(false); + setCoordinates(ZERO); + (_a22 = internalState.disposeOnKeyUp) === null || _a22 === void 0 ? void 0 : _a22.call(internalState); + onDismissed === null || onDismissed === void 0 ? void 0 : onDismissed(); + }; + var handleDragStart = React__namespace.useCallback(function() { + setModalMenuClose(); + internalState.isInKeyboardMoveMode = false; + }, [internalState, setModalMenuClose]); + var handleDrag = React__namespace.useCallback(function(ev, dragData) { + setCoordinates(function(prevValue) { + return { + x: getClampedAxis("x", prevValue.x + dragData.delta.x), + y: getClampedAxis("y", prevValue.y + dragData.delta.y) + }; + }); + }, [getClampedAxis]); + var handleDragStop = React__namespace.useCallback(function() { + if (focusTrapZone.current) { + focusTrapZone.current.focus(); + } + }, []); + var handleEnterKeyboardMoveMode = function() { + var handleKeyDown = function(ev) { + if (ev.altKey && ev.ctrlKey && ev.keyCode === KeyCodes.space) { + ev.preventDefault(); + ev.stopPropagation(); + return; + } + var newLocal = ev.altKey || ev.keyCode === KeyCodes.escape; + if (isModalMenuOpen && newLocal) { + setModalMenuClose(); + } + if (internalState.isInKeyboardMoveMode && (ev.keyCode === KeyCodes.escape || ev.keyCode === KeyCodes.enter)) { + internalState.isInKeyboardMoveMode = false; + ev.preventDefault(); + ev.stopPropagation(); + } + if (internalState.isInKeyboardMoveMode) { + var handledEvent = true; + var delta_1 = getMoveDelta(ev); + switch (ev.keyCode) { + /* eslint-disable no-fallthrough */ + case KeyCodes.escape: + setCoordinates(internalState.lastSetCoordinates); + case KeyCodes.enter: { + internalState.lastSetCoordinates = ZERO; + break; + } + case KeyCodes.up: { + setCoordinates(function(prevValue) { + return { x: prevValue.x, y: getClampedAxis("y", prevValue.y - delta_1) }; + }); + break; + } + case KeyCodes.down: { + setCoordinates(function(prevValue) { + return { x: prevValue.x, y: getClampedAxis("y", prevValue.y + delta_1) }; + }); + break; + } + case KeyCodes.left: { + setCoordinates(function(prevValue) { + return { x: getClampedAxis("x", prevValue.x - delta_1), y: prevValue.y }; + }); + break; + } + case KeyCodes.right: { + setCoordinates(function(prevValue) { + return { x: getClampedAxis("x", prevValue.x + delta_1), y: prevValue.y }; + }); + break; } - ] - }; - return (0, _styling.concatStyleSets)(styles, customStyles); -}); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles, comboBoxOptionWidth) { - var _a, _b, _c, _d, _e, _f; - var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; - var root = { - textColor: semanticColors.inputText, - borderColor: semanticColors.inputBorder, - borderHoveredColor: semanticColors.inputBorderHovered, - borderPressedColor: semanticColors.inputFocusBorderAlt, - borderFocusedColor: semanticColors.inputFocusBorderAlt, - backgroundColor: semanticColors.inputBackground, - erroredColor: semanticColors.errorText + default: { + handledEvent = false; + } + } + if (handledEvent) { + ev.preventDefault(); + ev.stopPropagation(); + } + } + }; + internalState.lastSetCoordinates = coordinates; + setModalMenuClose(); + internalState.isInKeyboardMoveMode = true; + internalState.events.on( + win, + "keydown", + handleKeyDown, + true + /* useCapture */ + ); + internalState.disposeOnKeyDown = function() { + internalState.events.off( + win, + "keydown", + handleKeyDown, + true + /* useCapture */ + ); + internalState.disposeOnKeyDown = void 0; + }; }; - var option = { - headerTextColor: semanticColors.menuHeader, - dividerBorderColor: semanticColors.bodyDivider + var handleExitKeyboardMoveMode = function(ev) { + var _a22, _b22; + (_a22 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.onBlur) === null || _a22 === void 0 ? void 0 : _a22.call(focusTrapZoneProps, ev); + internalState.lastSetCoordinates = ZERO; + internalState.isInKeyboardMoveMode = false; + (_b22 = internalState.disposeOnKeyDown) === null || _b22 === void 0 ? void 0 : _b22.call(internalState); }; - // placeholder style variables - var placeholderHighContrastStyles = { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _a) + var registerForKeyUp = function() { + var handleKeyUp = function(ev) { + if (ev.altKey && ev.ctrlKey && ev.keyCode === KeyCodes.space) { + if (elementContains(internalState.scrollableContent, ev.target)) { + toggleModalMenuOpen(); + ev.preventDefault(); + ev.stopPropagation(); + } + } + }; + if (!internalState.disposeOnKeyUp) { + internalState.events.on( + win, + "keyup", + handleKeyUp, + true + /* useCapture */ + ); + internalState.disposeOnKeyUp = function() { + internalState.events.off( + win, + "keyup", + handleKeyUp, + true + /* useCapture */ + ); + internalState.disposeOnKeyUp = void 0; + }; + } }; - var placeholderStyles = [ + React__namespace.useEffect(function() { + clearTimeout2(internalState.onModalCloseTimer); + if (isOpen) { + requestAnimationFrame(function() { + return setTimeout2(registerInitialModalPosition, 0); + }); + setIsModalOpen(true); + if (dragOptions) { + registerForKeyUp(); + } + internalState.hasBeenOpened = true; + setIsVisible(true); + } + if (!isOpen && isModalOpen) { + internalState.onModalCloseTimer = setTimeout2(handleModalClose, parseFloat(animationDuration) * 1e3); + setIsVisible(false); + } + }, [isModalOpen, isOpen]); + useUnmount(function() { + internalState.events.dispose(); + if (internalState.onModalCloseTimer) { + clearTimeout2(internalState.onModalCloseTimer); + internalState.onModalCloseTimer = 0; + } + }); + useComponentRef$2(props, focusTrapZone); + var modalContent = React__namespace.createElement( + FocusTrapZone, + __assign$1({}, focusTrapZoneProps, { + id: focusTrapZoneId, + ref: focusTrapZoneElm, + componentRef: focusTrapZoneRef, + className: css(classNames2.main, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.className), + elementToFocusOnDismiss: (_a2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.elementToFocusOnDismiss) !== null && _a2 !== void 0 ? _a2 : elementToFocusOnDismiss, + isClickableOutsideFocusTrap: (_b2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.isClickableOutsideFocusTrap) !== null && _b2 !== void 0 ? _b2 : isModeless || isClickableOutsideFocusTrap || !isBlocking, + disableRestoreFocus: (_c2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.disableRestoreFocus) !== null && _c2 !== void 0 ? _c2 : disableRestoreFocus, + forceFocusInsideTrap: ((_d2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.forceFocusInsideTrap) !== null && _d2 !== void 0 ? _d2 : forceFocusInsideTrap) && !isModeless, + // eslint-disable-next-line @typescript-eslint/no-deprecated + firstFocusableSelector: (focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.firstFocusableSelector) || firstFocusableSelector, + focusPreviouslyFocusedInnerElement: (_e2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.focusPreviouslyFocusedInnerElement) !== null && _e2 !== void 0 ? _e2 : true, + onBlur: internalState.isInKeyboardMoveMode ? handleExitKeyboardMoveMode : void 0 + }), + dragOptions && internalState.isInKeyboardMoveMode && React__namespace.createElement("div", { className: classNames2.keyboardMoveIconContainer }, dragOptions.keyboardMoveIconProps ? React__namespace.createElement(Icon, __assign$1({}, dragOptions.keyboardMoveIconProps)) : React__namespace.createElement(Icon, { iconName: "move", className: classNames2.keyboardMoveIcon })), + React__namespace.createElement( + "div", + { ref: allowScrollOnModal, className: classNames2.scrollableContent, "data-is-scrollable": true }, + dragOptions && isModalMenuOpen && React__namespace.createElement(dragOptions.menu, { items: [ + { key: "move", text: dragOptions.moveMenuItemText, onClick: handleEnterKeyboardMoveMode }, + { key: "close", text: dragOptions.closeMenuItemText, onClick: handleModalClose } + ], onDismiss: setModalMenuClose, alignTargetEdge: true, coverTarget: true, directionalHint: DirectionalHint.topLeftEdge, directionalHintFixed: true, shouldFocusOnMount: true, target: internalState.scrollableContent }), + children2 + ) + ); + return isModalOpen && modalResponsiveMode >= (responsiveMode || ResponsiveMode.small) && React__namespace.createElement( + Layer, + __assign$1({ ref: mergedRef }, mergedLayerProps), + React__namespace.createElement( + Popup, + __assign$1({ + role: isAlertRole ? "alertdialog" : "dialog", + ariaLabelledBy: titleAriaId, + ariaDescribedBy: subtitleAriaId, + onDismiss, + // eslint-disable-next-line @typescript-eslint/no-deprecated + shouldRestoreFocus: !disableRestoreFocus, + // Modeless modals shouldn't hide siblings. + // Popup will automatically handle this based on the aria-modal setting. + // eslint-disable-next-line @typescript-eslint/no-deprecated + enableAriaHiddenSiblings, + "aria-modal": !isModeless + }, popupProps), + React__namespace.createElement( + "div", + { className: classNames2.root, role: !isModeless ? "document" : void 0 }, + !isModeless && React__namespace.createElement(Overlay, __assign$1({ "aria-hidden": true, isDarkThemed: isDarkOverlay, onClick: isBlocking ? void 0 : onDismiss, allowTouchBodyScroll }, overlay)), + dragOptions ? React__namespace.createElement(DraggableZone, { handleSelector: dragOptions.dragHandleSelector || "#".concat(focusTrapZoneId), preventDragSelector: "button", onStart: handleDragStart, onDragChange: handleDrag, onStop: handleDragStop, position: coordinates }, modalContent) : modalContent + ) + ) + ) || null; + }); + ModalBase.displayName = "Modal"; + var Modal = styled(ModalBase, getStyles$a, void 0, { + scope: "Modal", + fields: ["theme", "styles", "enableAriaHiddenSiblings"] + }); + Modal.displayName = "Modal"; + var getClassNames$8 = classNamesFunction(); + var DialogFooterBase = ( + /** @class */ + (function(_super) { + __extends(DialogFooterBase2, _super); + function DialogFooterBase2(props) { + var _this = _super.call(this, props) || this; + initializeComponentRef(_this); + return _this; + } + DialogFooterBase2.prototype.render = function() { + var _a2 = this.props, className2 = _a2.className, styles = _a2.styles, theme = _a2.theme; + this._classNames = getClassNames$8(styles, { + theme, + className: className2 + }); + return React__namespace.createElement( + "div", + { className: this._classNames.actions }, + React__namespace.createElement("div", { className: this._classNames.actionsRight }, this._renderChildrenAsActions()) + ); + }; + DialogFooterBase2.prototype._renderChildrenAsActions = function() { + var _this = this; + return React__namespace.Children.map(this.props.children, function(child) { + return child ? React__namespace.createElement("span", { className: _this._classNames.action }, child) : null; + }); + }; + return DialogFooterBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$6 = { + actions: "ms-Dialog-actions", + action: "ms-Dialog-action", + actionsRight: "ms-Dialog-actionsRight" + }; + var getStyles$8 = function(props) { + var className2 = props.className, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$6, theme); + return { + actions: [ + classNames2.actions, { - color: semanticColors.inputPlaceholderText - }, - placeholderHighContrastStyles - ]; - var placeholderStylesHovered = [ + position: "relative", + width: "100%", + minHeight: "24px", + lineHeight: "24px", + margin: "16px 0 0", + fontSize: "0", + selectors: { + ".ms-Button": { + lineHeight: "normal", + verticalAlign: "middle" + } + } + }, + className2 + ], + action: [ + classNames2.action, { - color: semanticColors.inputTextHovered - }, - placeholderHighContrastStyles - ]; - var disabledPlaceholderStyles = [ + margin: "0 4px" + } + ], + actionsRight: [ + classNames2.actionsRight, { - color: semanticColors.disabledText - }, - placeholderHighContrastStyles - ]; - var ComboBoxRootHighContrastFocused = (0, _tslib.__assign)((0, _tslib.__assign)({ - color: 'HighlightText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - selectors: { - ':after': { - borderColor: 'Highlight' - } + alignItems: "center", + display: "flex", + fontSize: "0", + justifyContent: "flex-end", + marginRight: "-4px" } - }); - var focusBorderStyles = (0, _styling.getInputFocusStyle)(root.borderPressedColor, effects.roundedCorner2, 'border', 0); - var styles = { - container: {}, - label: {}, - labelDisabled: {}, - root: [ - theme.fonts.medium, - { - boxShadow: 'none', - marginLeft: '0', - paddingRight: ComboBoxCaretDownWidth, - paddingLeft: 9, - color: root.textColor, - position: 'relative', - outline: '0', - userSelect: 'none', - backgroundColor: root.backgroundColor, - cursor: 'text', - display: 'block', - height: ComboBoxHeight, - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - boxSizing: 'border-box', - selectors: { - '.ms-Label': { - display: 'inline-block', - marginBottom: '8px' - }, - '&.is-open': { - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _b) - }, - // setting border using pseudo-element here in order to - // prevent chevron button to overlap ComboBox border under certain resolutions - ':after': { - pointerEvents: 'none', - content: "''", - position: 'absolute', - left: 0, - top: 0, - bottom: 0, - right: 0, - borderWidth: '1px', - borderStyle: 'solid', - borderColor: root.borderColor, - borderRadius: effects.roundedCorner2 - } - } - } - ], - rootHovered: { - selectors: (_c = { - ':after': { - borderColor: root.borderHoveredColor - }, - '.ms-ComboBox-Input': [ - { - color: semanticColors.inputTextHovered - }, - (0, _styling.getPlaceholderStyles)(placeholderStylesHovered), - inputHighContrastStyles - ] - }, _c[0, _styling.HighContrastSelector] = (0, _tslib.__assign)((0, _tslib.__assign)({ - color: 'HighlightText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - selectors: { - ':after': { - borderColor: 'Highlight' - } - } - }), _c) - }, - rootPressed: [ - { - position: 'relative', - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _d) - } - ], - rootFocused: [ - { - selectors: (_e = { - '.ms-ComboBox-Input': [ - { - color: semanticColors.inputTextHovered - }, - inputHighContrastStyles - ] - }, _e[0, _styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _e) - }, - focusBorderStyles - ], - rootDisabled: getDisabledStyles(theme), - rootError: { - selectors: { - ':after': { - borderColor: root.erroredColor - }, - ':hover:after': { - borderColor: semanticColors.inputBorderHovered - } - } - }, - rootDisallowFreeForm: {}, - input: [ - (0, _styling.getPlaceholderStyles)(placeholderStyles), - { - backgroundColor: root.backgroundColor, - color: root.textColor, - boxSizing: 'border-box', - width: '100%', - height: '100%', - borderStyle: 'none', - outline: 'none', - font: 'inherit', - textOverflow: 'ellipsis', - padding: '0', - selectors: { - '::-ms-clear': { - display: 'none' - } - } - }, - inputHighContrastStyles - ], - inputDisabled: [ - getDisabledStyles(theme), - (0, _styling.getPlaceholderStyles)(disabledPlaceholderStyles) - ], - errorMessage: [ - theme.fonts.small, - { - color: root.erroredColor, - marginTop: '5px' - } - ], - callout: { - boxShadow: effects.elevation8 - }, - optionsContainerWrapper: { - width: comboBoxOptionWidth - }, - optionsContainer: { - display: 'block' - }, - screenReaderText: (0, _styling.hiddenContentStyle), - header: [ - fonts.medium, - { - fontWeight: (0, _styling.FontWeights).semibold, - color: option.headerTextColor, - backgroundColor: 'none', - borderStyle: 'none', - height: ComboBoxOptionHeight, - lineHeight: ComboBoxOptionHeight, - cursor: 'default', - padding: '0 8px', - userSelect: 'none', - textAlign: 'left', - selectors: (_f = {}, _f[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _f) - } - ], - divider: { - height: 1, - backgroundColor: option.dividerBorderColor - } - }; - return (0, _styling.concatStyleSets)(styles, customStyles); -}); - -},{"tslib":"9gizs","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lioZM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getClassNames", ()=>getClassNames); -parcelHelpers.export(exports, "getComboBoxOptionClassNames", ()=>getComboBoxOptionClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getClassNames = (0, _utilities.memoizeFunction)(function(styles, className, isOpen, disabled, required, focused, allowFreeForm, hasErrorMessage) { - // const mergeStyles = mergeStylesShadow(styles.__shadowConfig__); - return { - container: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-container', className, styles.container), - label: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.label, disabled && styles.labelDisabled), - root: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox', hasErrorMessage ? styles.rootError : isOpen && 'is-open', required && 'is-required', styles.root, !allowFreeForm && styles.rootDisallowFreeForm, hasErrorMessage && !focused ? styles.rootError : !disabled && focused && styles.rootFocused, !disabled && { - selectors: { - ':hover': hasErrorMessage ? styles.rootError : !isOpen && !focused && styles.rootHovered, - ':active': hasErrorMessage ? styles.rootError : styles.rootPressed, - ':focus': hasErrorMessage ? styles.rootError : styles.rootFocused - } - }, disabled && [ - 'is-disabled', - styles.rootDisabled - ]), - input: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-Input', styles.input, disabled && styles.inputDisabled), - errorMessage: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.errorMessage), - callout: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-callout', styles.callout), - optionsContainerWrapper: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-optionsContainerWrapper', styles.optionsContainerWrapper), - optionsContainer: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-optionsContainer', styles.optionsContainer), - header: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-header', styles.header), - divider: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-divider', styles.divider), - screenReaderText: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.screenReaderText) - }; -}); -var getComboBoxOptionClassNames = (0, _utilities.memoizeFunction)(function(styles) { - return { - optionText: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-optionText', styles.optionText), - root: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-option', styles.root, { - selectors: { - ':hover': styles.rootHovered, - ':focus': styles.rootFocused, - ':active': styles.rootPressed - } - }), - optionTextWrapper: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.optionTextWrapper) - }; -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jqbZ7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./utilities/selectableOption/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./utilities/selectableOption/index":"koCae","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"koCae":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _selectableOption = require("./SelectableOption"); -parcelHelpers.exportAll(_selectableOption, exports); -var _selectableOptionTypes = require("./SelectableOption.types"); -parcelHelpers.exportAll(_selectableOptionTypes, exports); -var _selectableDroppableTextTypes = require("./SelectableDroppableText.types"); -parcelHelpers.exportAll(_selectableDroppableTextTypes, exports); - -},{"./SelectableOption":"1X6d3","./SelectableOption.types":"2jOel","./SelectableDroppableText.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1X6d3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getAllSelectedOptions", ()=>getAllSelectedOptions); -function getAllSelectedOptions(options, selectedIndices) { - var selectedOptions = []; - for(var _i = 0, selectedIndices_1 = selectedIndices; _i < selectedIndices_1.length; _i++){ - var index = selectedIndices_1[_i]; - var option = options[index]; - if (option) selectedOptions.push(option); - } - return selectedOptions; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2jOel":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SelectableOptionMenuItemType", ()=>SelectableOptionMenuItemType); -var SelectableOptionMenuItemType; -(function(SelectableOptionMenuItemType) { - SelectableOptionMenuItemType[SelectableOptionMenuItemType["Normal"] = 0] = "Normal"; - SelectableOptionMenuItemType[SelectableOptionMenuItemType["Divider"] = 1] = "Divider"; - SelectableOptionMenuItemType[SelectableOptionMenuItemType["Header"] = 2] = "Header"; - SelectableOptionMenuItemType[SelectableOptionMenuItemType["SelectAll"] = 3] = "SelectAll"; -})(SelectableOptionMenuItemType || (SelectableOptionMenuItemType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ad8u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/CommandBar/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/CommandBar/index":"8qt81","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8qt81":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getCommandBarStyles", ()=>(0, _commandBarStyles.getStyles)); -parcelHelpers.export(exports, "getCommandButtonStyles", ()=>(0, _commandBarStyles.getCommandButtonStyles)); -var _commandBarStyles = require("./CommandBar.styles"); -var _commandBar = require("./CommandBar"); -parcelHelpers.exportAll(_commandBar, exports); -var _commandBarBase = require("./CommandBar.base"); -parcelHelpers.exportAll(_commandBarBase, exports); -var _commandBarTypes = require("./CommandBar.types"); -parcelHelpers.exportAll(_commandBarTypes, exports); - -},{"./CommandBar.styles":false,"./CommandBar":"6N02t","./CommandBar.base":false,"./CommandBar.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hGu9m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -parcelHelpers.export(exports, "getCommandButtonStyles", ()=>getCommandButtonStyles); -var _tslib = require("tslib"); -var _utilities = require("../../Utilities"); -var COMMAND_BAR_HEIGHT = 44; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var semanticColors = theme.semanticColors; + ] + }; + }; + var DialogFooter = styled(DialogFooterBase, getStyles$8, void 0, { scope: "DialogFooter" }); + DialogFooter.displayName = "DialogFooter"; + var getClassNames$7 = classNamesFunction(); + var DialogFooterType = React__namespace.createElement(DialogFooter, null).type; + var DialogContentBase = ( + /** @class */ + (function(_super) { + __extends(DialogContentBase2, _super); + function DialogContentBase2(props) { + var _this = _super.call(this, props) || this; + initializeComponentRef(_this); + return _this; + } + DialogContentBase2.prototype.render = function() { + var _a2 = this.props, showCloseButton = _a2.showCloseButton, className2 = _a2.className, closeButtonAriaLabel = _a2.closeButtonAriaLabel, onDismiss = _a2.onDismiss, subTextId = _a2.subTextId, subText = _a2.subText, _b2 = _a2.titleProps, titleProps = _b2 === void 0 ? {} : _b2, titleId = _a2.titleId, title = _a2.title, type2 = _a2.type, styles = _a2.styles, theme = _a2.theme, draggableHeaderClassName = _a2.draggableHeaderClassName; + var classNames2 = getClassNames$7(styles, { + theme, + className: className2, + isLargeHeader: type2 === DialogType.largeHeader, + isClose: type2 === DialogType.close, + draggableHeaderClassName + }); + var groupings = this._groupChildren(); + var subTextContent; + if (subText) { + subTextContent = React__namespace.createElement("p", { className: classNames2.subText, id: subTextId }, subText); + } + return React__namespace.createElement( + "div", + { className: classNames2.content }, + React__namespace.createElement( + "div", + { className: classNames2.header }, + React__namespace.createElement("div", __assign$1({ id: titleId, role: "heading", "aria-level": 1 }, titleProps, { className: css(classNames2.title, titleProps.className) }), title), + React__namespace.createElement( + "div", + { className: classNames2.topButton }, + this.props.topButtonsProps.map(function(props, index2) { + return React__namespace.createElement(IconButton, __assign$1({ key: props.uniqueId || index2 }, props)); + }), + (type2 === DialogType.close || showCloseButton && type2 !== DialogType.largeHeader) && React__namespace.createElement(IconButton, { className: classNames2.button, iconProps: { iconName: "Cancel" }, ariaLabel: closeButtonAriaLabel, onClick: onDismiss }) + ) + ), + React__namespace.createElement( + "div", + { className: classNames2.inner }, + React__namespace.createElement( + "div", + { className: classNames2.innerContent }, + subTextContent, + groupings.contents + ), + groupings.footers + ) + ); + }; + DialogContentBase2.prototype._groupChildren = function() { + var groupings = { + footers: [], + contents: [] + }; + React__namespace.Children.map(this.props.children, function(child) { + if (typeof child === "object" && child !== null && child.type === DialogFooterType) { + groupings.footers.push(child); + } else { + groupings.contents.push(child); + } + }); + return groupings; + }; + DialogContentBase2.defaultProps = { + showCloseButton: false, + className: "", + topButtonsProps: [], + closeButtonAriaLabel: "Close" + }; + DialogContentBase2 = __decorate([ + withResponsiveMode + ], DialogContentBase2); + return DialogContentBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$5 = { + contentLgHeader: "ms-Dialog-lgHeader", + close: "ms-Dialog--close", + subText: "ms-Dialog-subText", + header: "ms-Dialog-header", + headerLg: "ms-Dialog--lgHeader", + button: "ms-Dialog-button ms-Dialog-button--close", + inner: "ms-Dialog-inner", + content: "ms-Dialog-content", + title: "ms-Dialog-title" + }; + var getStyles$7 = function(props) { + var _a2, _b2, _c2; + var className2 = props.className, theme = props.theme, isLargeHeader = props.isLargeHeader, isClose = props.isClose, hidden = props.hidden, isMultiline = props.isMultiline, draggableHeaderClassName = props.draggableHeaderClassName; + var palette = theme.palette, fonts = theme.fonts, effects = theme.effects, semanticColors = theme.semanticColors; + var classNames2 = getGlobalClassNames(GlobalClassNames$5, theme); return { - root: [ - theme.fonts.medium, - 'ms-CommandBar', - { - display: 'flex', - backgroundColor: semanticColors.bodyBackground, - padding: '0 14px 0 24px', - height: COMMAND_BAR_HEIGHT - }, - className - ], - primarySet: [ - 'ms-CommandBar-primaryCommand', - { - flexGrow: '1', - display: 'flex', - alignItems: 'stretch' - } + content: [ + isLargeHeader && [ + classNames2.contentLgHeader, + { + borderTop: "4px solid ".concat(palette.themePrimary) + } ], - secondarySet: [ - 'ms-CommandBar-secondaryCommand', - { - flexShrink: '0', - display: 'flex', - alignItems: 'stretch' - } + isClose && classNames2.close, + { + flexGrow: 1, + overflowY: "hidden" + // required for allowScrollOnElement + }, + className2 + ], + subText: [ + classNames2.subText, + fonts.medium, + { + margin: "0 0 24px 0", + color: semanticColors.bodySubtext, + lineHeight: "1.5", + wordWrap: "break-word", + fontWeight: FontWeights.regular + } + ], + header: [ + classNames2.header, + { + position: "relative", + width: "100%", + boxSizing: "border-box" + }, + isClose && classNames2.close, + draggableHeaderClassName && [ + draggableHeaderClassName, + { + cursor: "move" + } ] + ], + button: [ + classNames2.button, + hidden && { + selectors: { + ".ms-Icon.ms-Icon--Cancel": { + color: semanticColors.buttonText, + fontSize: IconFontSizes.medium + } + } + } + ], + inner: [ + classNames2.inner, + { + padding: "0 24px 24px", + selectors: (_a2 = {}, _a2["@media (min-width: ".concat(ScreenWidthMinSmall, "px) and (max-width: ").concat(ScreenWidthMaxSmall, "px)")] = { + padding: "0 16px 16px" + }, _a2) + } + ], + innerContent: [ + classNames2.content, + { + position: "relative", + width: "100%" + } + ], + title: [ + classNames2.title, + fonts.xLarge, + { + color: semanticColors.bodyText, + margin: "0", + minHeight: fonts.xLarge.fontSize, + padding: "16px 46px 20px 24px", + lineHeight: "normal", + selectors: (_b2 = {}, _b2["@media (min-width: ".concat(ScreenWidthMinSmall, "px) and (max-width: ").concat(ScreenWidthMaxSmall, "px)")] = { + padding: "16px 46px 16px 16px" + }, _b2) + }, + isLargeHeader && { + color: semanticColors.menuHeader + }, + isMultiline && { fontSize: fonts.xxLarge.fontSize } + ], + topButton: [ + { + display: "flex", + flexDirection: "row", + flexWrap: "nowrap", + position: "absolute", + top: "0", + right: "0", + padding: "15px 15px 0 0", + selectors: (_c2 = { + "> *": { + flex: "0 0 auto" + }, + ".ms-Dialog-button": { + color: semanticColors.buttonText + }, + ".ms-Dialog-button:hover": { + color: semanticColors.buttonTextHovered, + borderRadius: effects.roundedCorner2 + } + }, _c2["@media (min-width: ".concat(ScreenWidthMinSmall, "px) and (max-width: ").concat(ScreenWidthMaxSmall, "px)")] = { + padding: "15px 8px 0 0" + }, _c2) + } + ] }; -}; -var getCommandButtonStyles = (0, _utilities.memoizeFunction)(function(customStyles) { - var rootStyles = { - height: '100%' - }; - var labelStyles = { - whiteSpace: 'nowrap' - }; - var _a = customStyles || {}, root = _a.root, label = _a.label, restCustomStyles = (0, _tslib.__rest)(_a, [ - "root", - "label" - ]); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, restCustomStyles), { - root: root ? [ - rootStyles, - root - ] : rootStyles, - label: label ? [ - labelStyles, - label - ] : labelStyles - }); -}); - -},{"tslib":"9gizs","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6N02t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBar", ()=>CommandBar); -var _utilities = require("../../Utilities"); -var _commandBarBase = require("./CommandBar.base"); -var _commandBarStyles = require("./CommandBar.styles"); -var CommandBar = (0, _utilities.styled)((0, _commandBarBase.CommandBarBase), (0, _commandBarStyles.getStyles), undefined, { - scope: 'CommandBar' -}); - -},{"../../Utilities":"1NZCy","./CommandBar.base":"kVqqU","./CommandBar.styles":"hGu9m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kVqqU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBarBase", ()=>CommandBarBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _overflowSet = require("../../OverflowSet"); -var _resizeGroup = require("../../ResizeGroup"); -var _focusZone = require("../../FocusZone"); -var _button = require("../../Button"); -var _tooltip = require("../../Tooltip"); -var _commandBarStyles = require("./CommandBar.styles"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var CommandBarBase = /** @class */ function(_super) { - (0, _tslib.__extends)(CommandBarBase, _super); - function CommandBarBase(props) { + }; + var DialogContent = styled(DialogContentBase, getStyles$7, void 0, { scope: "DialogContent" }); + DialogContent.displayName = "DialogContent"; + var getClassNames$6 = classNamesFunction(); + var DefaultModalProps = { + isDarkOverlay: false, + isBlocking: false, + className: "", + containerClassName: "", + topOffsetFixed: false, + enableAriaHiddenSiblings: true + }; + var DefaultDialogContentProps = { + type: DialogType.normal, + className: "", + topButtonsProps: [] + }; + var DialogBase = ( + /** @class */ + (function(_super) { + __extends(DialogBase2, _super); + function DialogBase2(props) { var _this = _super.call(this, props) || this; - _this._overflowSet = _react.createRef(); - _this._resizeGroup = _react.createRef(); - _this._onRenderData = function(data) { - var _a = _this.props, ariaLabel = _a.ariaLabel, primaryGroupAriaLabel = _a.primaryGroupAriaLabel, farItemsGroupAriaLabel = _a.farItemsGroupAriaLabel; - var hasSecondSet = data.farItems && data.farItems.length > 0; - return _react.createElement((0, _focusZone.FocusZone), { - className: (0, _utilities.css)(_this._classNames.root), - direction: (0, _focusZone.FocusZoneDirection).horizontal, - role: 'menubar', - "aria-label": ariaLabel - }, _react.createElement((0, _overflowSet.OverflowSet), { - role: hasSecondSet ? 'group' : 'none', - "aria-label": hasSecondSet ? primaryGroupAriaLabel : undefined, - componentRef: _this._overflowSet, - className: (0, _utilities.css)(_this._classNames.primarySet), - items: data.primaryItems, - overflowItems: data.overflowItems.length ? data.overflowItems : undefined, - onRenderItem: _this._onRenderItem, - onRenderOverflowButton: _this._onRenderOverflowButton - }), hasSecondSet && _react.createElement((0, _overflowSet.OverflowSet), { - role: "group", - "aria-label": farItemsGroupAriaLabel, - className: (0, _utilities.css)(_this._classNames.secondarySet), - items: data.farItems, - onRenderItem: _this._onRenderItem, - onRenderOverflowButton: (0, _utilities.nullRender) - })); - }; - _this._onRenderItem = function(item) { - if (item.onRender) // These are the top level items, there is no relevant menu dismissing function to - // provide for the IContextualMenuItem onRender function. Pass in a no op function instead. - return item.onRender(item, function() { - return undefined; - }); - // eslint-disable-next-line deprecation/deprecation - var itemText = item.text || item.name; - var commandButtonProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - allowDisabledFocus: true, - role: 'menuitem' - }, item), { - styles: (0, _commandBarStyles.getCommandButtonStyles)(item.buttonStyles), - className: (0, _utilities.css)('ms-CommandBarItem-link', item.className), - text: !item.iconOnly ? itemText : undefined, - menuProps: item.subMenuProps, - onClick: _this._onButtonClick(item) - }); - if (item.iconOnly && (itemText !== undefined || item.tooltipHostProps)) return _react.createElement((0, _tooltip.TooltipHost), (0, _tslib.__assign)({ - role: "none", - content: itemText, - setAriaDescribedBy: false - }, item.tooltipHostProps), _this._commandButton(item, commandButtonProps)); - return _this._commandButton(item, commandButtonProps); - }; - _this._commandButton = function(item, props) { - var ButtonAs = _this.props.buttonAs; - var CommandBarButtonAs = item.commandBarButtonAs; - var DefaultButtonAs = (0, _button.CommandBarButton); - // The prop types between these three possible implementations overlap enough that a force-cast is safe. - var Type = DefaultButtonAs; - if (CommandBarButtonAs) Type = (0, _utilities.composeComponentAs)(CommandBarButtonAs, Type); - if (ButtonAs) Type = (0, _utilities.composeComponentAs)(ButtonAs, Type); - // Always pass the default implementation to the override so it may be composed. - return _react.createElement(Type, (0, _tslib.__assign)({}, props)); + _this._getSubTextId = function() { + var _a2 = _this.props, ariaDescribedById = _a2.ariaDescribedById, modalProps = _a2.modalProps, dialogContentProps = _a2.dialogContentProps, subText = _a2.subText; + var id2 = modalProps && modalProps.subtitleAriaId || ariaDescribedById; + if (!id2) { + id2 = (dialogContentProps && dialogContentProps.subText || subText) && _this._defaultSubTextId; + } + return id2; }; - _this._onRenderOverflowButton = function(overflowItems) { - var _a = _this.props.overflowButtonProps, overflowButtonProps = _a === void 0 ? {} : _a; - var combinedOverflowItems = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], overflowButtonProps.menuProps ? overflowButtonProps.menuProps.items : [], true), overflowItems, true); - var overflowProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - role: 'menuitem' - }, overflowButtonProps), { - styles: (0, _tslib.__assign)({ - menuIcon: { - fontSize: '17px' - } - }, overflowButtonProps.styles), - className: (0, _utilities.css)('ms-CommandBar-overflowButton', overflowButtonProps.className), - menuProps: (0, _tslib.__assign)((0, _tslib.__assign)({}, overflowButtonProps.menuProps), { - items: combinedOverflowItems - }), - menuIconProps: (0, _tslib.__assign)({ - iconName: 'More' - }, overflowButtonProps.menuIconProps) - }); - var OverflowButtonType = _this.props.overflowButtonAs ? (0, _utilities.composeComponentAs)(_this.props.overflowButtonAs, (0, _button.CommandBarButton)) : (0, _button.CommandBarButton); - return _react.createElement(OverflowButtonType, (0, _tslib.__assign)({}, overflowProps)); + _this._getTitleTextId = function() { + var _a2 = _this.props, ariaLabelledById = _a2.ariaLabelledById, modalProps = _a2.modalProps, dialogContentProps = _a2.dialogContentProps, title = _a2.title; + var id2 = modalProps && modalProps.titleAriaId || ariaLabelledById; + if (!id2) { + id2 = (dialogContentProps && dialogContentProps.title || title) && _this._defaultTitleTextId; + } + return id2; + }; + _this._id = getId("Dialog"); + _this._defaultTitleTextId = _this._id + "-title"; + _this._defaultSubTextId = _this._id + "-subText"; + return _this; + } + DialogBase2.prototype.render = function() { + var _a2, _b2, _c2; + var props = this.props; + var className2 = props.className, containerClassName = props.containerClassName, contentClassName = props.contentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, forceFocusInsideTrap = props.forceFocusInsideTrap, styles = props.styles, hidden = props.hidden, _d2 = props.disableRestoreFocus, disableRestoreFocus = _d2 === void 0 ? props.ignoreExternalFocusing : _d2, isBlocking = props.isBlocking, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, _e2 = props.isOpen, isOpen = _e2 === void 0 ? !hidden : _e2, onDismiss = props.onDismiss, onDismissed = props.onDismissed, onLayerDidMount = props.onLayerDidMount, responsiveMode = props.responsiveMode, subText = props.subText, theme = props.theme, title = props.title, topButtonsProps = props.topButtonsProps, type2 = props.type, minWidth2 = props.minWidth, maxWidth = props.maxWidth, modalProps = props.modalProps; + var mergedLayerProps = __assign$1({ onLayerDidMount }, modalProps === null || modalProps === void 0 ? void 0 : modalProps.layerProps); + var dialogDraggableClassName; + var dragOptions; + if ((modalProps === null || modalProps === void 0 ? void 0 : modalProps.dragOptions) && !((_a2 = modalProps.dragOptions) === null || _a2 === void 0 ? void 0 : _a2.dragHandleSelector)) { + dragOptions = __assign$1({}, modalProps.dragOptions); + dialogDraggableClassName = "ms-Dialog-draggable-header"; + dragOptions.dragHandleSelector = ".".concat(dialogDraggableClassName); + } + var mergedModalProps = __assign$1(__assign$1(__assign$1(__assign$1({}, DefaultModalProps), { elementToFocusOnDismiss, firstFocusableSelector, forceFocusInsideTrap, disableRestoreFocus, isClickableOutsideFocusTrap, responsiveMode, className: className2, containerClassName, isBlocking, isDarkOverlay, onDismissed }), modalProps), { dragOptions, layerProps: mergedLayerProps, isOpen }); + var dialogContentProps = __assign$1(__assign$1(__assign$1({ className: contentClassName, subText, title, topButtonsProps, type: type2 }, DefaultDialogContentProps), props.dialogContentProps), { draggableHeaderClassName: dialogDraggableClassName, titleProps: __assign$1({ + // eslint-disable-next-line @typescript-eslint/no-deprecated + id: ((_b2 = props.dialogContentProps) === null || _b2 === void 0 ? void 0 : _b2.titleId) || this._defaultTitleTextId + }, (_c2 = props.dialogContentProps) === null || _c2 === void 0 ? void 0 : _c2.titleProps) }); + var classNames2 = getClassNames$6(styles, { + theme, + className: mergedModalProps.className, + containerClassName: mergedModalProps.containerClassName, + hidden, + dialogDefaultMinWidth: minWidth2, + dialogDefaultMaxWidth: maxWidth + }); + return React__namespace.createElement( + Modal, + __assign$1({}, mergedModalProps, { className: classNames2.root, containerClassName: classNames2.main, onDismiss: onDismiss || mergedModalProps.onDismiss, subtitleAriaId: this._getSubTextId(), titleAriaId: this._getTitleTextId() }), + React__namespace.createElement(DialogContent, __assign$1({ subTextId: this._defaultSubTextId, showCloseButton: mergedModalProps.isBlocking, onDismiss }, dialogContentProps), props.children) + ); + }; + DialogBase2.defaultProps = { + hidden: true + }; + DialogBase2 = __decorate([ + withResponsiveMode + ], DialogBase2); + return DialogBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$4 = { + root: "ms-Dialog" + }; + var getStyles$6 = function(props) { + var _a2; + var className2 = props.className, containerClassName = props.containerClassName, _b2 = props.dialogDefaultMinWidth, dialogDefaultMinWidth = _b2 === void 0 ? "288px" : _b2, _c2 = props.dialogDefaultMaxWidth, dialogDefaultMaxWidth = _c2 === void 0 ? "340px" : _c2, hidden = props.hidden, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$4, theme); + return { + root: [classNames2.root, theme.fonts.medium, className2], + main: [ + { + width: dialogDefaultMinWidth, + outline: "3px solid transparent", + selectors: (_a2 = {}, _a2["@media (min-width: ".concat(ScreenWidthMinMedium, "px)")] = { + width: "auto", + maxWidth: dialogDefaultMaxWidth, + minWidth: dialogDefaultMinWidth + }, _a2) + }, + !hidden && { display: "flex" }, + containerClassName + ] + }; + }; + var Dialog = styled(DialogBase, getStyles$6, void 0, { scope: "Dialog" }); + Dialog.displayName = "Dialog"; + var DropdownSizePosCache = ( + /** @class */ + (function() { + function DropdownSizePosCache2() { + this._size = 0; + } + DropdownSizePosCache2.prototype.updateOptions = function(options2) { + var displayOnlyOptionsCache = []; + var notSelectableOptionsCache = []; + var size = 0; + for (var i = 0; i < options2.length; i++) { + var _a2 = options2[i], itemType = _a2.itemType, hidden = _a2.hidden; + if (itemType === SelectableOptionMenuItemType.Divider || itemType === SelectableOptionMenuItemType.Header) { + displayOnlyOptionsCache.push(i); + notSelectableOptionsCache.push(i); + } else if (hidden) { + notSelectableOptionsCache.push(i); + } else { + size++; + } + } + this._size = size; + this._displayOnlyOptionsCache = displayOnlyOptionsCache; + this._notSelectableOptionsCache = notSelectableOptionsCache; + this._cachedOptions = __spreadArray([], options2, true); + }; + Object.defineProperty(DropdownSizePosCache2.prototype, "optionSetSize", { + /** + * The size of all the selectable options. + */ + get: function() { + return this._size; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DropdownSizePosCache2.prototype, "cachedOptions", { + /** + * The chached options array. + */ + get: function() { + return this._cachedOptions; + }, + enumerable: false, + configurable: true + }); + DropdownSizePosCache2.prototype.positionInSet = function(index2) { + if (index2 === void 0) { + return void 0; + } + var offset2 = 0; + while (index2 > this._notSelectableOptionsCache[offset2]) { + offset2++; + } + if (this._displayOnlyOptionsCache[offset2] === index2) { + throw new Error("Unexpected: Option at index ".concat(index2, " is not a selectable element.")); + } + if (this._notSelectableOptionsCache[offset2] === index2) { + return void 0; + } + return index2 - offset2 + 1; + }; + return DropdownSizePosCache2; + })() + ); + var PanelType; + (function(PanelType2) { + PanelType2[PanelType2["smallFluid"] = 0] = "smallFluid"; + PanelType2[PanelType2["smallFixedFar"] = 1] = "smallFixedFar"; + PanelType2[PanelType2["smallFixedNear"] = 2] = "smallFixedNear"; + PanelType2[PanelType2["medium"] = 3] = "medium"; + PanelType2[PanelType2["large"] = 4] = "large"; + PanelType2[PanelType2["largeFixed"] = 5] = "largeFixed"; + PanelType2[PanelType2["extraLarge"] = 6] = "extraLarge"; + PanelType2[PanelType2["custom"] = 7] = "custom"; + PanelType2[PanelType2["customNear"] = 8] = "customNear"; + })(PanelType || (PanelType = {})); + var getClassNames$5 = classNamesFunction(); + var PanelVisibilityState; + (function(PanelVisibilityState2) { + PanelVisibilityState2[PanelVisibilityState2["closed"] = 0] = "closed"; + PanelVisibilityState2[PanelVisibilityState2["animatingOpen"] = 1] = "animatingOpen"; + PanelVisibilityState2[PanelVisibilityState2["open"] = 2] = "open"; + PanelVisibilityState2[PanelVisibilityState2["animatingClosed"] = 3] = "animatingClosed"; + })(PanelVisibilityState || (PanelVisibilityState = {})); + var PanelBase = ( + /** @class */ + (function(_super) { + __extends(PanelBase2, _super); + function PanelBase2(props) { + var _this = _super.call(this, props) || this; + _this._panel = React__namespace.createRef(); + _this._animationCallback = null; + _this._hasCustomNavigation = !!(_this.props.onRenderNavigation || _this.props.onRenderNavigationContent); + _this.dismiss = function(ev) { + if (_this.props.onDismiss && _this.isActive) { + _this.props.onDismiss(ev); + } + if (!ev || ev && !ev.defaultPrevented) { + _this.close(); + } }; - _this._onReduceData = function(data) { - var _a = _this.props, shiftOnReduce = _a.shiftOnReduce, onDataReduced = _a.onDataReduced; - var primaryItems = data.primaryItems, overflowItems = data.overflowItems, cacheKey = data.cacheKey; - var farItems = data.farItems; - // Use first item if shiftOnReduce, otherwise use last item - var movedItem = primaryItems[shiftOnReduce ? 0 : primaryItems.length - 1]; - if (movedItem !== undefined) { - movedItem.renderedInOverflow = true; - overflowItems = (0, _tslib.__spreadArray)([ - movedItem - ], overflowItems, true); - primaryItems = shiftOnReduce ? primaryItems.slice(1) : primaryItems.slice(0, -1); - var newData = (0, _tslib.__assign)((0, _tslib.__assign)({}, data), { - primaryItems: primaryItems, - overflowItems: overflowItems - }); - cacheKey = _this._computeCacheKey({ - primaryItems: primaryItems, - overflow: overflowItems.length > 0, - farItems: farItems - }); - if (onDataReduced) onDataReduced(movedItem); - newData.cacheKey = cacheKey; - return newData; + _this._allowScrollOnPanel = function(elt) { + var _a3; + _this._resizeObserver = _this._createResizeObserver(function(entries) { + if (entries.length > 0 && entries[0].target === elt) { + _this._updateFooterPosition(); + } + }); + if (elt) { + (_a3 = _this._resizeObserver) === null || _a3 === void 0 ? void 0 : _a3.observe(elt); + if (_this._allowTouchBodyScroll) { + allowOverscrollOnElement(elt, _this._events); + } else { + allowScrollOnElement(elt, _this._events); } - return undefined; + } else { + _this._events.off(_this._scrollableContent); + } + _this._scrollableContent = elt; }; - _this._onGrowData = function(data) { - var _a = _this.props, shiftOnReduce = _a.shiftOnReduce, onDataGrown = _a.onDataGrown; - var minimumOverflowItems = data.minimumOverflowItems; - var primaryItems = data.primaryItems, overflowItems = data.overflowItems, cacheKey = data.cacheKey; - var farItems = data.farItems; - var movedItem = overflowItems[0]; - // Make sure that moved item exists and is not one of the original overflow items - if (movedItem !== undefined && overflowItems.length > minimumOverflowItems) { - movedItem.renderedInOverflow = false; - overflowItems = overflowItems.slice(1); - // if shiftOnReduce, movedItem goes first, otherwise, last. - primaryItems = shiftOnReduce ? (0, _tslib.__spreadArray)([ - movedItem - ], primaryItems, true) : (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], primaryItems, true), [ - movedItem - ], false); - var newData = (0, _tslib.__assign)((0, _tslib.__assign)({}, data), { - primaryItems: primaryItems, - overflowItems: overflowItems - }); - cacheKey = _this._computeCacheKey({ - primaryItems: primaryItems, - overflow: overflowItems.length > 0, - farItems: farItems - }); - if (onDataGrown) onDataGrown(movedItem); - newData.cacheKey = cacheKey; - return newData; - } - return undefined; + _this._onRenderNavigation = function(props2) { + if (!_this.props.onRenderNavigationContent && !_this.props.onRenderNavigation && !_this.props.hasCloseButton) { + return null; + } + var _a3 = _this.props.onRenderNavigationContent, onRenderNavigationContent = _a3 === void 0 ? _this._onRenderNavigationContent : _a3; + return React__namespace.createElement("div", { className: _this._classNames.navigation }, onRenderNavigationContent(props2, _this._onRenderNavigationContent)); + }; + _this._onRenderNavigationContent = function(props2) { + var _a3; + var closeButtonAriaLabel = props2.closeButtonAriaLabel, hasCloseButton = props2.hasCloseButton, _b2 = props2.onRenderHeader, onRenderHeader = _b2 === void 0 ? _this._onRenderHeader : _b2; + if (hasCloseButton) { + var iconButtonStyles = (_a3 = _this._classNames.subComponentStyles) === null || _a3 === void 0 ? void 0 : _a3.closeButton(); + return React__namespace.createElement( + React__namespace.Fragment, + null, + !_this._hasCustomNavigation && onRenderHeader(_this.props, _this._onRenderHeader, _this._headerTextId), + React__namespace.createElement(IconButton, { styles: iconButtonStyles, className: _this._classNames.closeButton, onClick: _this._onPanelClick, ariaLabel: closeButtonAriaLabel, title: closeButtonAriaLabel, "data-is-visible": true, iconProps: { iconName: "Cancel" } }) + ); + } + return null; + }; + _this._onRenderHeader = function(props2, defaultRender, headerTextId) { + var headerText = props2.headerText, _a3 = props2.headerTextProps, headerTextProps = _a3 === void 0 ? {} : _a3; + if (headerText) { + return React__namespace.createElement( + "div", + { className: _this._classNames.header }, + React__namespace.createElement("div", __assign$1({ id: headerTextId, role: "heading", "aria-level": 1 }, headerTextProps, { className: css(_this._classNames.headerText, headerTextProps.className) }), headerText) + ); + } + return null; + }; + _this._onRenderBody = function(props2) { + return React__namespace.createElement("div", { className: _this._classNames.content }, props2.children); + }; + _this._onRenderFooter = function(props2) { + var _a3 = _this.props.onRenderFooterContent, onRenderFooterContent = _a3 === void 0 ? null : _a3; + if (onRenderFooterContent) { + return React__namespace.createElement( + "div", + { className: _this._classNames.footer }, + React__namespace.createElement("div", { className: _this._classNames.footerInner }, onRenderFooterContent()) + ); + } + return null; }; - (0, _utilities.initializeComponentRef)(_this); - return _this; - } - CommandBarBase.prototype.render = function() { - var _a = this.props, items = _a.items, overflowItems = _a.overflowItems, farItems = _a.farItems, styles = _a.styles, theme = _a.theme, dataDidRender = _a.dataDidRender, _b = _a.onReduceData, onReduceData = _b === void 0 ? this._onReduceData : _b, _c = _a.onGrowData, onGrowData = _c === void 0 ? this._onGrowData : _c, _d = _a.resizeGroupAs, ResizeGroupAs = _d === void 0 ? (0, _resizeGroup.ResizeGroup) : _d; - var commandBarData = { - primaryItems: (0, _tslib.__spreadArray)([], items, true), - overflowItems: (0, _tslib.__spreadArray)([], overflowItems, true), - minimumOverflowItems: (0, _tslib.__spreadArray)([], overflowItems, true).length, - farItems: farItems, - cacheKey: this._computeCacheKey({ - primaryItems: (0, _tslib.__spreadArray)([], items, true), - overflow: overflowItems && overflowItems.length > 0, - farItems: farItems - }) + _this._animateTo = function(newVisibilityState) { + if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpen) { + _this.props.onOpen(); + } + _this._animationCallback = _this._async.setTimeout(function() { + _this.setState({ visibility: newVisibilityState }); + _this._onTransitionComplete(newVisibilityState); + }, 200); }; - this._classNames = getClassNames(styles, { - theme: theme - }); - // ResizeGroup will render these attributes to the root <div>. - // TODO We may need to elevate classNames from <FocusZone> into <ResizeGroup> ? - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)); - return _react.createElement(ResizeGroupAs, (0, _tslib.__assign)({}, nativeProps, { - componentRef: this._resizeGroup, - data: commandBarData, - onReduceData: onReduceData, - onGrowData: onGrowData, - onRenderData: this._onRenderData, - dataDidRender: dataDidRender - })); - }; - CommandBarBase.prototype.focus = function() { - var overflowSet = this._overflowSet.current; - overflowSet && overflowSet.focus(); - }; - CommandBarBase.prototype.remeasure = function() { - this._resizeGroup.current && this._resizeGroup.current.remeasure(); - }; - CommandBarBase.prototype._onButtonClick = function(item) { - return function(ev) { - // inactive is deprecated. remove check in 7.0 - // eslint-disable-next-line deprecation/deprecation - if (item.inactive) return; - if (item.onClick) item.onClick(ev, item); + _this._clearExistingAnimationTimer = function() { + if (_this._animationCallback !== null) { + _this._async.clearTimeout(_this._animationCallback); + } }; - }; - CommandBarBase.prototype._computeCacheKey = function(data) { - var primaryItems = data.primaryItems, overflow = data.overflow, farItems = data.farItems; - var returnKey = function(acc, current) { - var _a = current.cacheKey, cacheKey = _a === void 0 ? current.key : _a; - return acc + cacheKey; + _this._onPanelClick = function(ev) { + _this.dismiss(ev); }; - var primaryKey = primaryItems && primaryItems.reduce(returnKey, ''); - var overflowKey = overflow ? 'overflow' : ''; - var farKey = farItems && farItems.reduce(returnKey, ''); - return [ - primaryKey, - overflowKey, - farKey - ].join(''); - }; - CommandBarBase.defaultProps = { - items: [], - overflowItems: [] - }; - return CommandBarBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../OverflowSet":"cUjom","../../ResizeGroup":"lgldX","../../FocusZone":"k9nPH","../../Button":"1457j","../../Tooltip":"dAQ01","./CommandBar.styles":"hGu9m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cUjom":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/OverflowSet/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/OverflowSet/index":"gSTyE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gSTyE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _overflowSet = require("./OverflowSet"); -parcelHelpers.exportAll(_overflowSet, exports); -var _overflowSetBase = require("./OverflowSet.base"); -parcelHelpers.exportAll(_overflowSetBase, exports); -var _overflowSetTypes = require("./OverflowSet.types"); -parcelHelpers.exportAll(_overflowSetTypes, exports); - -},{"./OverflowSet":"cwhns","./OverflowSet.base":false,"./OverflowSet.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cwhns":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverflowSet", ()=>OverflowSet); -var _utilities = require("../../Utilities"); -var _overflowSetBase = require("./OverflowSet.base"); -var _overflowSetStyles = require("./OverflowSet.styles"); -var OverflowSet = (0, _utilities.styled)((0, _overflowSetBase.OverflowSetBase), (0, _overflowSetStyles.getStyles), undefined, { - scope: 'OverflowSet' -}); - -},{"../../Utilities":"1NZCy","./OverflowSet.base":"dTJHN","./OverflowSet.styles":"159Ht","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dTJHN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverflowSetBase", ()=>OverflowSetBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("../../Utilities"); -var _overflowButton = require("./OverflowButton"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var COMPONENT_NAME = 'OverflowSet'; -var useComponentRef = function(props, divContainer) { - var doc = (0, _dom.useDocumentEx)(); - _react.useImperativeHandle(props.componentRef, function() { - return { - focus: function(_forceIntoFirstElement, bypassHiddenElements) { - var focusSucceeded = false; - if (divContainer.current) focusSucceeded = (0, _utilities.focusFirstChild)(divContainer.current, bypassHiddenElements); - return focusSucceeded; - }, - focusElement: function(childElement) { - var focusSucceeded = false; - if (!childElement) return false; - if (divContainer.current && (0, _utilities.elementContains)(divContainer.current, childElement)) { - childElement.focus(); - focusSucceeded = (doc === null || doc === void 0 ? void 0 : doc.activeElement) === childElement; - } - return focusSucceeded; - } + _this._onTransitionComplete = function(newVisibilityState) { + _this._updateFooterPosition(); + if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpened) { + _this.props.onOpened(); + } + if (newVisibilityState === PanelVisibilityState.closed && _this.props.onDismissed) { + _this.props.onDismissed(); + } + }; + var _a2 = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a2 === void 0 ? false : _a2; + _this._allowTouchBodyScroll = allowTouchBodyScroll; + initializeComponentRef(_this); + _this.state = { + isFooterSticky: false, + // intentionally ignore props so animation takes place during componentDidMount + visibility: PanelVisibilityState.closed, + id: getId("Panel") }; - }, [ - divContainer, - doc - ]); -}; -var OverflowSetBase = _react.forwardRef(function(props, forwardedRef) { - var divContainer = _react.useRef(null); - var mergedRef = (0, _reactHooks.useMergedRefs)(divContainer, forwardedRef); - useComponentRef(props, divContainer); - var items = props.items, overflowItems = props.overflowItems, className = props.className, styles = props.styles, vertical = props.vertical, role = props.role, _a = props.overflowSide, overflowSide = _a === void 0 ? 'end' : _a, onRenderItem = props.onRenderItem; - var classNames = getClassNames(styles, { - className: className, - vertical: vertical - }); - var showOverflow = !!overflowItems && overflowItems.length > 0; - return _react.createElement("div", (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)), { - role: role || 'group', - "aria-orientation": role === 'menubar' ? vertical === true ? 'vertical' : 'horizontal' : undefined, - className: classNames.root, - ref: mergedRef - }), overflowSide === 'start' && showOverflow && _react.createElement((0, _overflowButton.OverflowButton), (0, _tslib.__assign)({}, props, { - className: classNames.overflowButton - })), items && items.map(function(item, i) { - return _react.createElement("div", { - className: classNames.item, - key: item.key, - role: "none" - }, onRenderItem(item)); - }), overflowSide === 'end' && showOverflow && _react.createElement((0, _overflowButton.OverflowButton), (0, _tslib.__assign)({}, props, { - className: classNames.overflowButton - }))); -}); -OverflowSetBase.displayName = COMPONENT_NAME; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","../../Utilities":"1NZCy","./OverflowButton":"1yEzy","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1yEzy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverflowButton", ()=>OverflowButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _keytipManager = require("../../utilities/keytips/KeytipManager"); -var _reactHooks = require("@fluentui/react-hooks"); -var registerPersistedKeytips = function(keytipsToRegister, keytipManager, registeredPersistedKeytips) { - for(var _i = 0, keytipsToRegister_1 = keytipsToRegister; _i < keytipsToRegister_1.length; _i++){ - var keytip = keytipsToRegister_1[_i]; - var uniqueID = keytipManager.register(keytip, true); - // Update map - registeredPersistedKeytips[uniqueID] = keytip; - } -}; -var unregisterPersistedKeytips = function(keytipManager, registeredPersistedKeytips) { - for(var _i = 0, _a = Object.keys(registeredPersistedKeytips); _i < _a.length; _i++){ - var uniqueID = _a[_i]; - keytipManager.unregister(registeredPersistedKeytips[uniqueID], uniqueID, true); - delete registeredPersistedKeytips[uniqueID]; - } -}; -var useKeytipRegistrations = function(registeredPersistedKeytips, keytipsToRegister, keytipManager) { - var prevPersistedKeytips = (0, _reactHooks.usePrevious)(registeredPersistedKeytips); - // Update - _react.useEffect(function() { - if (prevPersistedKeytips) { - // Unregister old keytips - unregisterPersistedKeytips(keytipManager, prevPersistedKeytips); - // Register new keytips - registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); + return _this; + } + PanelBase2.getDerivedStateFromProps = function(nextProps, prevState) { + if (nextProps.isOpen === void 0) { + return null; } - }); - // Mount/Unmount - _react.useEffect(function() { - // Register on mount - registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); - return function() { - // Unregister on unmount - unregisterPersistedKeytips(keytipManager, registeredPersistedKeytips); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); -}; -var OverflowButton = function(props) { - var keytipManager = (0, _keytipManager.KeytipManager).getInstance(); - var className = props.className, overflowItems = props.overflowItems, keytipSequences = props.keytipSequences, itemSubMenuProvider = props.itemSubMenuProvider, onRenderOverflowButton = props.onRenderOverflowButton; - var persistedKeytips = (0, _reactHooks.useConst)({}); - // Gets the subMenu for an overflow item - var getSubMenuForItem = _react.useCallback(function(item) { - // Checks if itemSubMenuProvider has been defined, if not defaults to subMenuProps - if (itemSubMenuProvider) return itemSubMenuProvider(item); - if (item.subMenuProps) return item.subMenuProps.items; - return undefined; - }, [ - itemSubMenuProvider - ]); - var _a = _react.useMemo(function() { - var newKeytipsToRegister = []; - var newOverflowItems = []; - if (keytipSequences) overflowItems === null || overflowItems === void 0 || overflowItems.forEach(function(overflowItem) { - var _a; - var keytip = overflowItem.keytipProps; - if (keytip) { - // Create persisted keytip - var persistedKeytip = { - content: keytip.content, - keySequences: keytip.keySequences, - disabled: keytip.disabled || !!(overflowItem.disabled || overflowItem.isDisabled), - hasDynamicChildren: keytip.hasDynamicChildren, - hasMenu: keytip.hasMenu - }; - if (keytip.hasDynamicChildren || getSubMenuForItem(overflowItem)) { - // If the keytip has a submenu or children nodes, change onExecute to persistedKeytipExecute - persistedKeytip.onExecute = keytipManager.menuExecute.bind(keytipManager, keytipSequences, (_a = overflowItem === null || overflowItem === void 0 ? void 0 : overflowItem.keytipProps) === null || _a === void 0 ? void 0 : _a.keySequences); - persistedKeytip.hasOverflowSubMenu = true; - } else // If the keytip doesn't have a submenu, just execute the original function - persistedKeytip.onExecute = keytip.onExecute; - newKeytipsToRegister.push(persistedKeytip); - // Add the overflow sequence to this item - var newOverflowItem = (0, _tslib.__assign)((0, _tslib.__assign)({}, overflowItem), { - keytipProps: (0, _tslib.__assign)((0, _tslib.__assign)({}, keytip), { - overflowSetSequence: keytipSequences - }) - }); - newOverflowItems === null || newOverflowItems === void 0 || newOverflowItems.push(newOverflowItem); - } else // Nothing to change, add overflowItem to list - newOverflowItems === null || newOverflowItems === void 0 || newOverflowItems.push(overflowItem); + if (nextProps.isOpen && (prevState.visibility === PanelVisibilityState.closed || prevState.visibility === PanelVisibilityState.animatingClosed)) { + return { visibility: PanelVisibilityState.animatingOpen }; + } + if (!nextProps.isOpen && (prevState.visibility === PanelVisibilityState.open || prevState.visibility === PanelVisibilityState.animatingOpen)) { + return { visibility: PanelVisibilityState.animatingClosed }; + } + return null; + }; + PanelBase2.prototype.componentDidMount = function() { + this._async = new Async(this); + this._events = new EventGroup(this); + var win = getWindowEx(this.context); + var doc = getDocumentEx(this.context); + this._events.on(win, "resize", this._updateFooterPosition); + if (this._shouldListenForOuterClick(this.props)) { + this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, "mousedown", this._dismissOnOuterClick, true); + } + if (this.props.isOpen) { + this.setState({ visibility: PanelVisibilityState.animatingOpen }); + } + }; + PanelBase2.prototype.componentDidUpdate = function(previousProps, previousState) { + var shouldListenOnOuterClick = this._shouldListenForOuterClick(this.props); + var previousShouldListenOnOuterClick = this._shouldListenForOuterClick(previousProps); + if (this.state.visibility !== previousState.visibility) { + this._clearExistingAnimationTimer(); + if (this.state.visibility === PanelVisibilityState.animatingOpen) { + this._animateTo(PanelVisibilityState.open); + } else if (this.state.visibility === PanelVisibilityState.animatingClosed) { + this._animateTo(PanelVisibilityState.closed); + } + } + var doc = getDocumentEx(this.context); + if (shouldListenOnOuterClick && !previousShouldListenOnOuterClick) { + this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, "mousedown", this._dismissOnOuterClick, true); + } else if (!shouldListenOnOuterClick && previousShouldListenOnOuterClick) { + this._events.off(doc === null || doc === void 0 ? void 0 : doc.body, "mousedown", this._dismissOnOuterClick, true); + } + }; + PanelBase2.prototype.componentWillUnmount = function() { + var _a2; + this._async.dispose(); + this._events.dispose(); + (_a2 = this._resizeObserver) === null || _a2 === void 0 ? void 0 : _a2.disconnect(); + }; + PanelBase2.prototype.render = function() { + var _a2 = this.props, _b2 = _a2.className, className2 = _b2 === void 0 ? "" : _b2, elementToFocusOnDismiss = _a2.elementToFocusOnDismiss, firstFocusableSelector = _a2.firstFocusableSelector, focusTrapZoneProps = _a2.focusTrapZoneProps, forceFocusInsideTrap = _a2.forceFocusInsideTrap, hasCloseButton = _a2.hasCloseButton, headerText = _a2.headerText, _c2 = _a2.headerClassName, headerClassName = _c2 === void 0 ? "" : _c2, ignoreExternalFocusing = _a2.ignoreExternalFocusing, isBlocking = _a2.isBlocking, isFooterAtBottom = _a2.isFooterAtBottom, isLightDismiss = _a2.isLightDismiss, isHiddenOnDismiss = _a2.isHiddenOnDismiss, layerProps = _a2.layerProps, overlayProps = _a2.overlayProps, popupProps = _a2.popupProps, type2 = _a2.type, styles = _a2.styles, theme = _a2.theme, customWidth = _a2.customWidth, _d2 = _a2.onLightDismissClick, onLightDismissClick = _d2 === void 0 ? this._onPanelClick : _d2, _e2 = _a2.onRenderNavigation, onRenderNavigation = _e2 === void 0 ? this._onRenderNavigation : _e2, _f = _a2.onRenderHeader, onRenderHeader = _f === void 0 ? this._onRenderHeader : _f, _g = _a2.onRenderBody, onRenderBody = _g === void 0 ? this._onRenderBody : _g, _h = _a2.onRenderFooter, onRenderFooter = _h === void 0 ? this._onRenderFooter : _h; + var _j = this.state, isFooterSticky = _j.isFooterSticky, visibility = _j.visibility, id2 = _j.id; + var isLeft = type2 === PanelType.smallFixedNear || type2 === PanelType.customNear ? true : false; + var isRTL = getRTL(theme); + var isOnRightSide = isRTL ? isLeft : !isLeft; + var customWidthStyles = type2 === PanelType.custom || type2 === PanelType.customNear ? { width: customWidth } : {}; + var nativeProps = getNativeProps(this.props, divProperties); + var isOpen = this.isActive; + var isAnimating = visibility === PanelVisibilityState.animatingClosed || visibility === PanelVisibilityState.animatingOpen; + this._headerTextId = headerText && id2 + "-headerText"; + if (!isOpen && !isAnimating && !isHiddenOnDismiss) { + return null; + } + this._classNames = getClassNames$5(styles, { + theme, + className: className2, + focusTrapZoneClassName: focusTrapZoneProps ? focusTrapZoneProps.className : void 0, + hasCloseButton, + headerClassName, + isAnimating, + isFooterSticky, + isFooterAtBottom, + isOnRightSide, + isOpen, + isHiddenOnDismiss, + type: type2, + hasCustomNavigation: this._hasCustomNavigation }); - else newOverflowItems = overflowItems; - return { - modifiedOverflowItems: newOverflowItems, - keytipsToRegister: newKeytipsToRegister - }; - }, [ - overflowItems, - getSubMenuForItem, - keytipManager, - keytipSequences - ]), modifiedOverflowItems = _a.modifiedOverflowItems, keytipsToRegister = _a.keytipsToRegister; - useKeytipRegistrations(persistedKeytips, keytipsToRegister, keytipManager); - return _react.createElement("div", { - className: className - }, onRenderOverflowButton(modifiedOverflowItems)); -}; - -},{"tslib":"9gizs","react":"jGrId","../../utilities/keytips/KeytipManager":"04Pqp","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"159Ht":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var overflowItemStyle = { - flexShrink: 0, - display: 'inherit' -}; -var getStyles = function(props) { - var className = props.className, vertical = props.vertical; - return { - root: [ - 'ms-OverflowSet', - { - position: 'relative', - display: 'flex', - flexWrap: 'nowrap' - }, - vertical && { - flexDirection: 'column' - }, - className - ], - item: [ - 'ms-OverflowSet-item', - overflowItemStyle - ], - overflowButton: [ - 'ms-OverflowSet-overflowButton', - overflowItemStyle - ] - }; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lgldX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ResizeGroup/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ResizeGroup/index":"9cG4J","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9cG4J":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _resizeGroup = require("./ResizeGroup"); -parcelHelpers.exportAll(_resizeGroup, exports); -var _resizeGroupBase = require("./ResizeGroup.base"); -parcelHelpers.exportAll(_resizeGroupBase, exports); -var _resizeGroupTypes = require("./ResizeGroup.types"); -parcelHelpers.exportAll(_resizeGroupTypes, exports); - -},{"./ResizeGroup":"5ttP5","./ResizeGroup.base":false,"./ResizeGroup.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ttP5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ResizeGroup", ()=>ResizeGroup); -var _resizeGroupBase = require("./ResizeGroup.base"); -var ResizeGroup = (0, _resizeGroupBase.ResizeGroupBase); - -},{"./ResizeGroup.base":"7Gid8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Gid8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getMeasurementCache", ()=>getMeasurementCache); -parcelHelpers.export(exports, "getNextResizeGroupStateProvider", ()=>getNextResizeGroupStateProvider); -parcelHelpers.export(exports, "MeasuredContext", ()=>MeasuredContext); -parcelHelpers.export(exports, "ResizeGroupBase", ()=>ResizeGroupBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _resizeGroupTypes = require("./ResizeGroup.types"); -var _reactHooks = require("@fluentui/react-hooks"); -var _windowProvider = require("../../WindowProvider"); -var RESIZE_DELAY = 16; -var getMeasurementCache = function() { - var measurementsCache = {}; - return { - /** - * Checks if the provided data has a cacheKey. If it has a cacheKey and there is a - * corresponding entry in the measurementsCache, then it will return that value. - * Returns undefined otherwise. - */ getCachedMeasurement: function(data) { - if (data && data.cacheKey && measurementsCache.hasOwnProperty(data.cacheKey)) return measurementsCache[data.cacheKey]; - return undefined; + var _k = this, _classNames = _k._classNames, _allowTouchBodyScroll = _k._allowTouchBodyScroll; + var overlay; + if (isBlocking && isOpen) { + overlay = React__namespace.createElement(Overlay, __assign$1({ className: _classNames.overlay, isDarkThemed: false, onClick: isLightDismiss ? onLightDismissClick : void 0, allowTouchBodyScroll: _allowTouchBodyScroll }, overlayProps)); + } + return React__namespace.createElement( + Layer, + __assign$1({}, layerProps), + React__namespace.createElement( + Popup, + __assign$1({ role: "dialog", "aria-modal": isBlocking ? "true" : void 0, ariaLabelledBy: this._headerTextId ? this._headerTextId : void 0, onDismiss: this.dismiss, className: _classNames.hiddenPanel, enableAriaHiddenSiblings: isOpen ? true : false }, popupProps), + React__namespace.createElement( + "div", + __assign$1({ "aria-hidden": !isOpen && isAnimating }, nativeProps, { ref: this._panel, className: _classNames.root }), + overlay, + React__namespace.createElement( + FocusTrapZone, + __assign$1({ ignoreExternalFocusing, forceFocusInsideTrap: !isBlocking || isHiddenOnDismiss && !isOpen ? false : forceFocusInsideTrap, firstFocusableSelector, isClickableOutsideFocusTrap: true }, focusTrapZoneProps, { className: _classNames.main, style: customWidthStyles, elementToFocusOnDismiss }), + React__namespace.createElement( + "div", + { className: _classNames.contentInner }, + React__namespace.createElement( + "div", + { ref: this._allowScrollOnPanel, className: _classNames.scrollableContent, "data-is-scrollable": true }, + React__namespace.createElement("div", { className: _classNames.commands, "data-is-visible": true }, onRenderNavigation(this.props, this._onRenderNavigation)), + (this._hasCustomNavigation || !hasCloseButton) && onRenderHeader(this.props, this._onRenderHeader, this._headerTextId), + onRenderBody(this.props, this._onRenderBody), + onRenderFooter(this.props, this._onRenderFooter) + ) + ) + ) + ) + ) + ); + }; + PanelBase2.prototype.open = function() { + if (this.props.isOpen !== void 0) { + return; + } + if (this.isActive) { + return; + } + this.setState({ visibility: PanelVisibilityState.animatingOpen }); + }; + PanelBase2.prototype.close = function() { + if (this.props.isOpen !== void 0) { + return; + } + if (!this.isActive) { + return; + } + this.setState({ visibility: PanelVisibilityState.animatingClosed }); + }; + Object.defineProperty(PanelBase2.prototype, "isActive", { + /** isActive is true when panel is open or opening. */ + get: function() { + return this.state.visibility === PanelVisibilityState.open || this.state.visibility === PanelVisibilityState.animatingOpen; }, - /** - * Should be called whenever there is a new measurement associated with a given data object. - * If the data has a cacheKey, store that measurement in the measurementsCache. - */ addMeasurementToCache: function(data, measurement) { - if (data.cacheKey) measurementsCache[data.cacheKey] = measurement; + enumerable: false, + configurable: true + }); + PanelBase2.prototype._createResizeObserver = function(callback) { + var _a2; + var doc = getDocumentEx(this.context); + var resizeObserver = null; + if ((_a2 = doc === null || doc === void 0 ? void 0 : doc.defaultView) === null || _a2 === void 0 ? void 0 : _a2.ResizeObserver) { + resizeObserver = new doc.defaultView.ResizeObserver(callback); + } + return resizeObserver; + }; + PanelBase2.prototype._shouldListenForOuterClick = function(props) { + return !!props.isBlocking && !!props.isOpen; + }; + PanelBase2.prototype._updateFooterPosition = function() { + var scrollableContent = this._scrollableContent; + if (scrollableContent) { + var height2 = scrollableContent.clientHeight; + var innerHeight_1 = scrollableContent.scrollHeight; + this.setState({ + isFooterSticky: height2 < innerHeight_1 ? true : false + }); + } + }; + PanelBase2.prototype._dismissOnOuterClick = function(ev) { + var panel = this._panel.current; + if (this.isActive && panel && !ev.defaultPrevented) { + if (!elementContains(panel, ev.target)) { + if (this.props.onOuterClick) { + this.props.onOuterClick(ev); + } else { + this.dismiss(ev); + } + } } - }; -}; -var getNextResizeGroupStateProvider = function(measurementCache) { - if (measurementCache === void 0) measurementCache = getMeasurementCache(); - var _measurementCache = measurementCache; - var _containerDimension; - /** - * Gets the width/height of the data rendered in a hidden div. - * @param measuredData - The data corresponding to the measurement we wish to take. - * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. - * Only called when the measurement is not in the cache. - */ function _getMeasuredDimension(measuredData, getElementToMeasureDimension) { - var cachedDimension = _measurementCache.getCachedMeasurement(measuredData); - if (cachedDimension !== undefined) return cachedDimension; - var measuredDimension = getElementToMeasureDimension(); - _measurementCache.addMeasurementToCache(measuredData, measuredDimension); - return measuredDimension; + }; + PanelBase2.defaultProps = { + isHiddenOnDismiss: false, + isOpen: void 0, + isBlocking: true, + hasCloseButton: true, + type: PanelType.smallFixedFar + }; + PanelBase2.contextType = WindowContext; + return PanelBase2; + })(React__namespace.Component) + ); + var _a$1, _b$1, _c$1, _d$1, _e$1; + var GlobalClassNames$3 = { + root: "ms-Panel", + main: "ms-Panel-main", + commands: "ms-Panel-commands", + contentInner: "ms-Panel-contentInner", + scrollableContent: "ms-Panel-scrollableContent", + navigation: "ms-Panel-navigation", + closeButton: "ms-Panel-closeButton ms-PanelAction-close", + header: "ms-Panel-header", + headerText: "ms-Panel-headerText", + content: "ms-Panel-content", + footer: "ms-Panel-footer", + footerInner: "ms-Panel-footerInner", + isOpen: "is-open", + hasCloseButton: "ms-Panel--hasCloseButton", + smallFluid: "ms-Panel--smFluid", + smallFixedNear: "ms-Panel--smLeft", + smallFixedFar: "ms-Panel--sm", + medium: "ms-Panel--md", + large: "ms-Panel--lg", + largeFixed: "ms-Panel--fixed", + extraLarge: "ms-Panel--xl", + custom: "ms-Panel--custom", + customNear: "ms-Panel--customLeft" + }; + var panelWidth = { + full: "100%", + auto: "auto", + xs: 272, + sm: 340, + md1: 592, + md2: 644, + lg: 940 + }; + var panelMargin = { + auto: "auto", + none: 0, + md: 48, + lg: 428, + xl: 176 + }; + var smallPanelSelectors = (_a$1 = {}, _a$1["@media (min-width: ".concat(ScreenWidthMinMedium, "px)")] = { + width: panelWidth.sm + }, _a$1); + var mediumPanelSelectors = (_b$1 = {}, _b$1["@media (min-width: ".concat(ScreenWidthMinLarge, "px)")] = { + width: panelWidth.md1 + }, _b$1["@media (min-width: ".concat(ScreenWidthMinXLarge, "px)")] = { + width: panelWidth.md2 + }, _b$1); + var largePanelSelectors = (_c$1 = {}, _c$1["@media (min-width: ".concat(ScreenWidthMinUhfMobile, "px)")] = { + left: panelMargin.md, + width: panelWidth.auto + }, _c$1["@media (min-width: ".concat(ScreenWidthMinXXLarge, "px)")] = { + left: panelMargin.lg + }, _c$1); + var largeFixedPanelSelectors = (_d$1 = {}, _d$1["@media (min-width: ".concat(ScreenWidthMinXXLarge, "px)")] = { + left: panelMargin.auto, + width: panelWidth.lg + }, _d$1); + var extraLargePanelSelectors = (_e$1 = {}, _e$1["@media (min-width: ".concat(ScreenWidthMinXXLarge, "px)")] = { + left: panelMargin.xl + }, _e$1); + var getPanelBreakpoints = function(type2) { + var selectors; + switch (type2) { + case PanelType.smallFixedFar: + selectors = __assign$1({}, smallPanelSelectors); + break; + case PanelType.medium: + selectors = __assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors); + break; + case PanelType.large: + selectors = __assign$1(__assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors); + break; + case PanelType.largeFixed: + selectors = __assign$1(__assign$1(__assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), largeFixedPanelSelectors); + break; + case PanelType.extraLarge: + selectors = __assign$1(__assign$1(__assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), extraLargePanelSelectors); + break; } - /** - * Will get the next IResizeGroupState based on the current data while trying to shrink contents - * to fit in the container. - * @param data - The initial data point to start measuring. - * @param onReduceData - Function that transforms the data into something that should render with less width/height. - * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. - * Only called when the measurement is not in the cache. - */ function _shrinkContentsUntilTheyFit(data, onReduceData, getElementToMeasureDimension) { - var dataToMeasure = data; - var measuredDimension = _getMeasuredDimension(data, getElementToMeasureDimension); - while(measuredDimension > _containerDimension){ - var nextMeasuredData = onReduceData(dataToMeasure); - // We don't want to get stuck in an infinite render loop when there are no more - // scaling steps, so implementations of onReduceData should return undefined when - // there are no more scaling states to apply. - if (nextMeasuredData === undefined) return { - renderedData: dataToMeasure, - resizeDirection: undefined, - dataToMeasure: undefined - }; - measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); - // If the measurement isn't in the cache, we need to re-render with some data in a hidden div - if (measuredDimension === undefined) return { - dataToMeasure: nextMeasuredData, - resizeDirection: 'shrink' - }; - dataToMeasure = nextMeasuredData; + return selectors; + }; + var commandBarHeight = "44px"; + var sharedPaddingStyles = { + paddingLeft: "24px", + paddingRight: "24px" + }; + var getStyles$5 = function(props) { + var _a2, _b2, _c2, _d2; + var className2 = props.className, focusTrapZoneClassName = props.focusTrapZoneClassName, hasCloseButton = props.hasCloseButton, headerClassName = props.headerClassName, isAnimating = props.isAnimating, isFooterSticky = props.isFooterSticky, isFooterAtBottom = props.isFooterAtBottom, isOnRightSide = props.isOnRightSide, isOpen = props.isOpen, isHiddenOnDismiss = props.isHiddenOnDismiss, hasCustomNavigation = props.hasCustomNavigation, theme = props.theme, _e2 = props.type, type2 = _e2 === void 0 ? PanelType.smallFixedFar : _e2; + var effects = theme.effects, fonts = theme.fonts, semanticColors = theme.semanticColors; + var classNames2 = getGlobalClassNames(GlobalClassNames$3, theme); + var isCustomPanel = type2 === PanelType.custom || type2 === PanelType.customNear; + return { + root: [ + classNames2.root, + theme.fonts.medium, + isOpen && classNames2.isOpen, + hasCloseButton && classNames2.hasCloseButton, + { + pointerEvents: "none", + position: "absolute", + top: 0, + left: 0, + right: 0, + bottom: 0 + }, + isCustomPanel && isOnRightSide && classNames2.custom, + isCustomPanel && !isOnRightSide && classNames2.customNear, + className2 + ], + overlay: [ + { + pointerEvents: "auto", + cursor: "pointer" + }, + isOpen && isAnimating && AnimationClassNames.fadeIn100, + !isOpen && isAnimating && AnimationClassNames.fadeOut100 + ], + hiddenPanel: [ + !isOpen && !isAnimating && isHiddenOnDismiss && { + visibility: "hidden" + } + ], + main: [ + classNames2.main, + { + backgroundColor: semanticColors.bodyBackground, + boxShadow: effects.elevation64, + pointerEvents: "auto", + position: "absolute", + display: "flex", + flexDirection: "column", + overflowX: "hidden", + overflowY: "auto", + WebkitOverflowScrolling: "touch", + bottom: 0, + top: 0, + // left, right, width are overridden depending on the type of the Panel and the screen breakpoint. + left: panelMargin.auto, + right: panelMargin.none, + width: panelWidth.full, + selectors: __assign$1((_a2 = {}, _a2[HighContrastSelector] = { + borderLeft: "3px solid ".concat(semanticColors.variantBorder), + borderRight: "3px solid ".concat(semanticColors.variantBorder) + }, _a2), getPanelBreakpoints(type2)) + }, + type2 === PanelType.smallFluid && { + left: panelMargin.none + }, + type2 === PanelType.smallFixedNear && { + left: panelMargin.none, + right: panelMargin.auto, + width: panelWidth.xs + }, + type2 === PanelType.customNear && { + right: "auto", + left: 0 + }, + isCustomPanel && { + maxWidth: "100vw" + }, + isOpen && isAnimating && !isOnRightSide && AnimationClassNames.slideRightIn40, + isOpen && isAnimating && isOnRightSide && AnimationClassNames.slideLeftIn40, + !isOpen && isAnimating && !isOnRightSide && AnimationClassNames.slideLeftOut40, + !isOpen && isAnimating && isOnRightSide && AnimationClassNames.slideRightOut40, + focusTrapZoneClassName + ], + commands: [ + classNames2.commands, + { + // Ensures that the sticky header always has a background to prevent overlaps on scroll. + backgroundColor: semanticColors.bodyBackground, + paddingTop: 18, + selectors: (_b2 = {}, _b2["@media (min-height: ".concat(ScreenWidthMinMedium, "px)")] = { + position: "sticky", + top: 0, + zIndex: 1 + }, _b2) + }, + hasCustomNavigation && { + paddingTop: "inherit" } - return { - renderedData: dataToMeasure, - resizeDirection: undefined, - dataToMeasure: undefined - }; - } - /** - * This function should be called when the state changes in a manner that might allow for more content to fit - * on the screen, such as the window width/height growing. - * @param data - The initial data point to start measuring. - * @param onGrowData - Function that transforms the data into something that may take up more space when rendering. - * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. - * Only called when the measurement is not in the cache. - */ function _growDataUntilItDoesNotFit(data, onGrowData, getElementToMeasureDimension, onReduceData) { - var dataToMeasure = data; - var measuredDimension = _getMeasuredDimension(data, getElementToMeasureDimension); - while(measuredDimension < _containerDimension){ - var nextMeasuredData = onGrowData(dataToMeasure); - // We don't want to get stuck in an infinite render loop when there are no more - // scaling steps, so implementations of onGrowData should return undefined when - // there are no more scaling states to apply. - if (nextMeasuredData === undefined) return { - renderedData: dataToMeasure, - resizeDirection: undefined, - dataToMeasure: undefined - }; - measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); - // If the measurement isn't in the cache, we need to re-render with some data in a hidden div - if (measuredDimension === undefined) return { - dataToMeasure: nextMeasuredData - }; - dataToMeasure = nextMeasuredData; + ], + navigation: [ + classNames2.navigation, + { + display: "flex", + justifyContent: "flex-end" + }, + hasCustomNavigation && { + height: commandBarHeight + } + ], + contentInner: [ + classNames2.contentInner, + { + display: "flex", + flexDirection: "column", + flexGrow: 1, + overflowY: "hidden" + } + ], + header: [ + classNames2.header, + sharedPaddingStyles, + { + alignSelf: "flex-start" + }, + hasCloseButton && !hasCustomNavigation && { + flexGrow: 1 + }, + hasCustomNavigation && { + // Ensure that title doesn't shrink if screen is too small + flexShrink: 0 + } + ], + headerText: [ + classNames2.headerText, + fonts.xLarge, + { + color: semanticColors.bodyText, + lineHeight: "27px", + overflowWrap: "break-word", + wordWrap: "break-word", + wordBreak: "break-word", + hyphens: "auto" + }, + headerClassName + ], + scrollableContent: [ + classNames2.scrollableContent, + { + overflowY: "auto" + }, + isFooterAtBottom && { + flexGrow: 1, + display: "inherit", + flexDirection: "inherit" } - // Once the loop is done, we should now shrink until the contents fit. - return (0, _tslib.__assign)({ - resizeDirection: 'shrink' - }, _shrinkContentsUntilTheyFit(dataToMeasure, onReduceData, getElementToMeasureDimension)); - } - /** - * Handles an update to the container width/height. - * Should only be called when we knew the previous container width/height. - * @param newDimension - The new width/height of the container. - * @param fullDimensionData - The initial data passed in as a prop to resizeGroup. - * @param renderedData - The data that was rendered prior to the container size changing. - * @param onGrowData - Set to true if the Resize group has an onGrowData function. - */ function _updateContainerDimension(newDimension, fullDimensionData, renderedData, onGrowData) { - var nextState; - if (newDimension > _containerDimension) { - if (onGrowData) nextState = { - resizeDirection: 'grow', - dataToMeasure: onGrowData(renderedData) - }; - else nextState = { - resizeDirection: 'shrink', - dataToMeasure: fullDimensionData - }; - } else nextState = { - resizeDirection: 'shrink', - dataToMeasure: renderedData - }; - _containerDimension = newDimension; - return (0, _tslib.__assign)((0, _tslib.__assign)({}, nextState), { - measureContainer: false - }); - } - function getNextState(props, currentState, getElementToMeasureDimension, newContainerDimension) { - // If there is no new container width/height or data to measure, there is no need for a new state update - if (newContainerDimension === undefined && currentState.dataToMeasure === undefined) return undefined; - if (newContainerDimension) { - // If we know the last container size and we rendered data at that width/height, we can do an optimized render - if (_containerDimension && currentState.renderedData && !currentState.dataToMeasure) return (0, _tslib.__assign)((0, _tslib.__assign)({}, currentState), _updateContainerDimension(newContainerDimension, props.data, currentState.renderedData, props.onGrowData)); - // If we are just setting the container width/height for the first time, we can't do any optimizations - _containerDimension = newContainerDimension; - } - var nextState = (0, _tslib.__assign)((0, _tslib.__assign)({}, currentState), { - measureContainer: false - }); - if (currentState.dataToMeasure) { - if (currentState.resizeDirection === 'grow' && props.onGrowData) nextState = (0, _tslib.__assign)((0, _tslib.__assign)({}, nextState), _growDataUntilItDoesNotFit(currentState.dataToMeasure, props.onGrowData, getElementToMeasureDimension, props.onReduceData)); - else nextState = (0, _tslib.__assign)((0, _tslib.__assign)({}, nextState), _shrinkContentsUntilTheyFit(currentState.dataToMeasure, props.onReduceData, getElementToMeasureDimension)); + ], + content: [ + classNames2.content, + sharedPaddingStyles, + { + paddingBottom: 20 + }, + isFooterAtBottom && { + selectors: (_c2 = {}, _c2["@media (min-height: ".concat(ScreenWidthMinMedium, "px)")] = { + flexGrow: 1 + }, _c2) } - return nextState; - } - /** Function that determines if we need to render content for measurement based on the measurement cache contents. */ function shouldRenderDataForMeasurement(dataToMeasure) { - if (!dataToMeasure || _measurementCache.getCachedMeasurement(dataToMeasure) !== undefined) return false; - return true; - } - function getInitialResizeGroupState(data) { - return { - dataToMeasure: (0, _tslib.__assign)({}, data), - resizeDirection: 'grow', - measureContainer: true - }; - } - return { - getNextState: getNextState, - shouldRenderDataForMeasurement: shouldRenderDataForMeasurement, - getInitialResizeGroupState: getInitialResizeGroupState - }; -}; -var MeasuredContext = _react.createContext({ - isMeasured: false -}); -// Styles for the hidden div used for measurement -var hiddenDivStyles = { - position: 'fixed', - visibility: 'hidden' -}; -var hiddenParentStyles = { - position: 'relative' -}; -var COMPONENT_NAME = 'ResizeGroup'; -/** - * Use useReducer instead of userState because React is not batching the state updates - * when state is set in callbacks of setTimeout or requestAnimationFrame. - * See issue: https://github.com/facebook/react/issues/14259 - */ function resizeDataReducer(state, action) { - var _a; - switch(action.type){ - case 'resizeData': - return (0, _tslib.__assign)({}, action.value); - case 'dataToMeasure': - return (0, _tslib.__assign)((0, _tslib.__assign)({}, state), { - dataToMeasure: action.value, - resizeDirection: 'grow', - measureContainer: true - }); - default: - return (0, _tslib.__assign)((0, _tslib.__assign)({}, state), (_a = {}, _a[action.type] = action.value, _a)); + ], + footer: [ + classNames2.footer, + { + // Ensure that footer doesn't shrink if screen is too small + flexShrink: 0, + borderTop: "1px solid transparent", + transition: "opacity ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction2), + selectors: (_d2 = {}, _d2["@media (min-height: ".concat(ScreenWidthMinMedium, "px)")] = { + position: "sticky", + bottom: 0 + }, _d2) + }, + isFooterSticky && { + backgroundColor: semanticColors.bodyBackground, + borderTopColor: semanticColors.variantBorder + } + ], + footerInner: [ + classNames2.footerInner, + sharedPaddingStyles, + { + paddingBottom: 16, + paddingTop: 16 + } + ], + subComponentStyles: { + closeButton: { + root: [ + classNames2.closeButton, + { + marginRight: 14, + color: theme.palette.neutralSecondary, + fontSize: IconFontSizes.large + }, + hasCustomNavigation && { + marginRight: 0, + height: "auto", + width: "44px" + } + ], + rootHovered: { + color: theme.palette.neutralPrimary + } + } + } + }; + }; + var Panel = styled(PanelBase, getStyles$5, void 0, { + scope: "Panel" + }); + var getClassNames$4 = classNamesFunction(); + var DEFAULT_PROPS = { + options: [] + }; + function useSelectedItemsState(_a2) { + var defaultSelectedKeys = _a2.defaultSelectedKeys, selectedKeys = _a2.selectedKeys, defaultSelectedKey = _a2.defaultSelectedKey, selectedKey = _a2.selectedKey, options2 = _a2.options, multiSelect = _a2.multiSelect; + var oldOptions = usePrevious(options2); + var _b2 = React__namespace.useState([]), selectedIndices = _b2[0], setSelectedIndices = _b2[1]; + var selectedKeyPropToUse; + var didOptionsChange = options2 !== oldOptions; + if (multiSelect) { + if (didOptionsChange && defaultSelectedKeys !== void 0) { + selectedKeyPropToUse = defaultSelectedKeys; + } else { + selectedKeyPropToUse = selectedKeys; + } + } else { + if (didOptionsChange && defaultSelectedKey !== void 0) { + selectedKeyPropToUse = defaultSelectedKey; + } else { + selectedKeyPropToUse = selectedKey; + } } -} -function useResizeState(props, nextResizeGroupStateProvider, rootRef) { - var initialStateData = (0, _reactHooks.useConst)(function() { - return nextResizeGroupStateProvider.getInitialResizeGroupState(props.data); - }); - var _a = _react.useReducer(resizeDataReducer, initialStateData), resizeData = _a[0], dispatchResizeDataAction = _a[1]; - // Reset state when new data is provided - _react.useEffect(function() { - dispatchResizeDataAction({ - type: 'dataToMeasure', - value: props.data - }); - }, [ - props.data - ]); - // Because it's possible that we may force more than one re-render per animation frame, we - // want to make sure that the RAF request is using the most recent data. - var stateRef = _react.useRef(initialStateData); - stateRef.current = (0, _tslib.__assign)({}, resizeData); - var updateResizeState = _react.useCallback(function(nextState) { - if (nextState) dispatchResizeDataAction({ - type: 'resizeData', - value: nextState + var oldSelectedKeyProp = usePrevious(selectedKeyPropToUse); + React__namespace.useEffect(function() { + var getSelectedIndexes = function() { + if (selectedKeyPropToUse === void 0) { + if (multiSelect) { + return getAllSelectedIndices(); + } + var selectedIndex = getSelectedIndex(null); + return selectedIndex !== -1 ? [selectedIndex] : []; + } else if (!Array.isArray(selectedKeyPropToUse)) { + var selectedIndex = getSelectedIndex(selectedKeyPropToUse); + return selectedIndex !== -1 ? [selectedIndex] : []; + } + var returnValue = []; + for (var _i = 0, selectedKeyPropToUse_1 = selectedKeyPropToUse; _i < selectedKeyPropToUse_1.length; _i++) { + var key2 = selectedKeyPropToUse_1[_i]; + var selectedIndex = getSelectedIndex(key2); + selectedIndex !== -1 && returnValue.push(selectedIndex); + } + return returnValue; + }; + var getAllSelectedIndices = function() { + return options2.map(function(option, index2) { + return option.selected ? index2 : -1; + }).filter(function(index2) { + return index2 !== -1; }); - }, []); - var remeasure = _react.useCallback(function() { - if (rootRef.current) dispatchResizeDataAction({ - type: 'measureContainer', - value: true + }; + var getSelectedIndex = function(searchKey) { + return findIndex(options2, function(option) { + if (searchKey != null) { + return option.key === searchKey; + } else { + return !!option.selected || !!option.isSelected; + } }); - }, [ - rootRef - ]); - return [ - stateRef, - updateResizeState, - remeasure - ]; -} -function useResizingBehavior(props, rootRef) { - var nextResizeGroupStateProvider = (0, _reactHooks.useConst)(getNextResizeGroupStateProvider); - // A div that can be used for the initial measurement so that we can avoid mounting a second instance - // of the component being measured for the initial render. - var initialHiddenDiv = _react.useRef(null); - // A hidden div that is used for mounting a new instance of the component for measurement in a hidden - // div without unmounting the currently visible content. - var updateHiddenDiv = _react.useRef(null); - // Tracks if any content has been rendered to the user. This enables us to do some performance optimizations - // for the initial render. - var hasRenderedContent = _react.useRef(false); - var async = (0, _reactHooks.useAsync)(); - var _a = useResizeState(props, nextResizeGroupStateProvider, rootRef), stateRef = _a[0], updateResizeState = _a[1], remeasure = _a[2]; - _react.useEffect(function() { - var _a; - if (stateRef.current.renderedData) { - hasRenderedContent.current = true; - (_a = props.dataDidRender) === null || _a === void 0 || _a.call(props, stateRef.current.renderedData); - } - }); - _react.useEffect(function() { - async.requestAnimationFrame(function() { - var containerDimension = undefined; - if (stateRef.current.measureContainer && rootRef.current) { - var boundingRect = rootRef.current.getBoundingClientRect(); - containerDimension = props.direction === (0, _resizeGroupTypes.ResizeGroupDirection).vertical ? boundingRect.height : boundingRect.width; + }; + if ((selectedKeyPropToUse !== void 0 || !oldOptions) && (selectedKeyPropToUse !== oldSelectedKeyProp || didOptionsChange)) { + setSelectedIndices(getSelectedIndexes()); + } + }, [didOptionsChange, multiSelect, oldOptions, oldSelectedKeyProp, options2, selectedKeyPropToUse]); + return [selectedIndices, setSelectedIndices]; + } + var DropdownBase = React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var props = getPropsWithDefaults(DEFAULT_PROPS, propsWithoutDefaults); + var rootRef = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(forwardedRef, rootRef); + var responsiveMode = useResponsiveMode(rootRef, props.responsiveMode); + var _a2 = useSelectedItemsState(props), selectedIndices = _a2[0], setSelectedIndices = _a2[1]; + return React__namespace.createElement(DropdownInternal, __assign$1({}, props, { responsiveMode, hoisted: { rootRef: mergedRootRef, selectedIndices, setSelectedIndices } })); + }); + DropdownBase.displayName = "DropdownBase"; + var DropdownInternal = ( + /** @class */ + (function(_super) { + __extends(DropdownInternal2, _super); + function DropdownInternal2(props) { + var _this = _super.call(this, props) || this; + _this._host = React__namespace.createRef(); + _this._focusZone = React__namespace.createRef(); + _this._dropDown = React__namespace.createRef(); + _this._scrollIdleDelay = 250; + _this._sizePosCache = new DropdownSizePosCache(); + _this._requestAnimationFrame = safeRequestAnimationFrame(_this); + _this.dismissMenu = function() { + var isOpen = _this.state.isOpen; + isOpen && _this.setState({ isOpen: false }); + }; + _this._onChange = function(event2, options22, index2, checked, multiSelect2) { + var _a2 = _this.props, onChange = _a2.onChange, onChanged = _a2.onChanged; + if (onChange || onChanged) { + var changedOpt = multiSelect2 ? __assign$1(__assign$1({}, options22[index2]), { selected: !checked }) : options22[index2]; + onChange && onChange(__assign$1(__assign$1({}, event2), { target: _this._dropDown.current }), changedOpt, index2); + onChanged && onChanged(changedOpt, index2); + } + }; + _this._getPlaceholder = function() { + return _this.props.placeholder || _this.props.placeHolder; + }; + _this._getTitle = function(items, _unused) { + var _a2 = _this.props.multiSelectDelimiter, multiSelectDelimiter = _a2 === void 0 ? ", " : _a2; + return items.map(function(i) { + return i.text; + }).join(multiSelectDelimiter); + }; + _this._onRenderTitle = function(items) { + return React__namespace.createElement(React__namespace.Fragment, null, _this._getTitle(items)); + }; + _this._onRenderPlaceholder = function(props2) { + if (!_this._getPlaceholder()) { + return null; + } + return React__namespace.createElement(React__namespace.Fragment, null, _this._getPlaceholder()); + }; + _this._onRenderContainer = function(props2) { + var calloutProps = props2.calloutProps, panelProps = props2.panelProps; + var _a2 = _this.props, responsiveMode = _a2.responsiveMode, dropdownWidth2 = _a2.dropdownWidth; + var isSmall = responsiveMode <= ResponsiveMode.medium; + var focusTrapZoneProps = { firstFocusableTarget: "#".concat(_this._listId, "1") }; + var panelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.panel : void 0; + var calloutWidth = void 0; + var calloutMinWidth = void 0; + if (dropdownWidth2 === "auto") { + calloutMinWidth = _this._dropDown.current ? _this._dropDown.current.clientWidth : 0; + } else { + calloutWidth = dropdownWidth2 || (_this._dropDown.current ? _this._dropDown.current.clientWidth : 0); + } + return isSmall ? React__namespace.createElement(Panel, __assign$1({ closeButtonAriaLabel: "Close", focusTrapZoneProps, hasCloseButton: true, isOpen: true, isLightDismiss: true, onDismiss: _this._onDismiss, styles: panelStyles }, panelProps), _this._renderFocusableList(props2)) : React__namespace.createElement(Callout, __assign$1({ isBeakVisible: false, gapSpace: 0, doNotLayer: false, directionalHintFixed: false, directionalHint: DirectionalHint.bottomLeftEdge, calloutWidth, calloutMinWidth }, calloutProps, { className: _this._classNames.callout, target: _this._dropDown.current, onDismiss: _this._onDismiss, onScroll: _this._onScroll, onPositioned: _this._onPositioned }), _this._renderFocusableList(props2)); + }; + _this._onRenderCaretDown = function(props2) { + return React__namespace.createElement(Icon, { className: _this._classNames.caretDown, iconName: "ChevronDown", "aria-hidden": true }); + }; + _this._onRenderList = function(props2) { + var _a2 = props2.onRenderItem, onRenderItem = _a2 === void 0 ? _this._onRenderItem : _a2; + var queue = { items: [] }; + var renderedList = []; + var emptyQueue = function() { + var newGroup = queue.id ? [ + React__namespace.createElement("div", { role: "group", key: queue.id, "aria-labelledby": queue.id }, queue.items) + ] : queue.items; + renderedList = __spreadArray(__spreadArray([], renderedList, true), newGroup, true); + queue = { items: [] }; + }; + var placeRenderedOptionIntoQueue = function(item, index2) { + switch (item.itemType) { + case SelectableOptionMenuItemType.Header: + queue.items.length > 0 && emptyQueue(); + var id2 = _this._id + item.key; + queue.items.push(onRenderItem(__assign$1(__assign$1({ id: id2 }, item), { index: index2 }), _this._onRenderItem)); + queue.id = id2; + break; + case SelectableOptionMenuItemType.Divider: + index2 > 0 && queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); + queue.items.length > 0 && emptyQueue(); + break; + default: + queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); } - var nextState = nextResizeGroupStateProvider.getNextState(props, stateRef.current, function() { - var refToMeasure = !hasRenderedContent.current ? initialHiddenDiv : updateHiddenDiv; - if (!refToMeasure.current) return 0; - var measuredBoundingRect = refToMeasure.current.getBoundingClientRect(); - return props.direction === (0, _resizeGroupTypes.ResizeGroupDirection).vertical ? measuredBoundingRect.height : measuredBoundingRect.width; - }, containerDimension); - updateResizeState(nextState); - }, rootRef.current); - }); - var win = (0, _windowProvider.useWindow)(); - (0, _reactHooks.useOnEvent)(win, 'resize', async.debounce(remeasure, RESIZE_DELAY, { - leading: true - })); - var dataNeedsMeasuring = nextResizeGroupStateProvider.shouldRenderDataForMeasurement(stateRef.current.dataToMeasure); - var isInitialMeasure = !hasRenderedContent.current && dataNeedsMeasuring; - return [ - stateRef.current.dataToMeasure, - stateRef.current.renderedData, - remeasure, - initialHiddenDiv, - updateHiddenDiv, - dataNeedsMeasuring, - isInitialMeasure - ]; -} -function useDebugWarnings(props) {} -var measuredContextValue = { - isMeasured: true -}; -var ResizeGroupBase = _react.forwardRef(function(props, forwardedRef) { - var rootRef = _react.useRef(null); - // The root div which is the container inside of which we are trying to fit content. - var mergedRootRef = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var _a = useResizingBehavior(props, rootRef), dataToMeasure = _a[0], renderedData = _a[1], remeasure = _a[2], initialHiddenDiv = _a[3], updateHiddenDiv = _a[4], dataNeedsMeasuring = _a[5], isInitialMeasure = _a[6]; - _react.useImperativeHandle(props.componentRef, function() { - return { - remeasure: remeasure + }; + props2.options.forEach(function(item, index2) { + placeRenderedOptionIntoQueue(item, index2); + }); + queue.items.length > 0 && emptyQueue(); + return React__namespace.createElement(React__namespace.Fragment, null, renderedList); }; - }, [ - remeasure - ]); - useDebugWarnings(props); - var className = props.className, onRenderData = props.onRenderData; - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), [ - 'data' - ]); - // We only ever render the final content to the user. All measurements are done in a hidden div. - // For the initial render, we want this to be as fast as possible, so we need to make sure that we only mount one - // version of the component for measurement and the final render. For renders that update what is on screen, we - // want to make sure that there are no jarring effects such as the screen flashing as we apply scaling steps for - // measurement. In the update case, we mount a second version of the component just for measurement purposes and - // leave the rendered content untouched until we know the next state to show to the user. - return _react.createElement("div", (0, _tslib.__assign)({}, divProps, { - className: className, - ref: mergedRootRef - }), _react.createElement("div", { - style: hiddenParentStyles - }, dataNeedsMeasuring && !isInitialMeasure && _react.createElement("div", { - style: hiddenDivStyles, - ref: updateHiddenDiv - }, _react.createElement(MeasuredContext.Provider, { - value: measuredContextValue - }, onRenderData(dataToMeasure))), _react.createElement("div", { - ref: initialHiddenDiv, - style: isInitialMeasure ? hiddenDivStyles : undefined, - "data-automation-id": "visibleContent" - }, isInitialMeasure ? onRenderData(dataToMeasure) : renderedData && onRenderData(renderedData)))); -}); -ResizeGroupBase.displayName = 'ResizeGroupBase'; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./ResizeGroup.types":"d6k9Y","@fluentui/react-hooks":"2LHjM","../../WindowProvider":"diLL7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d6k9Y":[function(require,module,exports,__globalThis) { -/** - * {@docCategory ResizeGroup} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ResizeGroupDirection", ()=>ResizeGroupDirection); -var ResizeGroupDirection; -(function(ResizeGroupDirection) { - ResizeGroupDirection[ResizeGroupDirection["horizontal"] = 0] = "horizontal"; - ResizeGroupDirection[ResizeGroupDirection["vertical"] = 1] = "vertical"; -})(ResizeGroupDirection || (ResizeGroupDirection = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dAQ01":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Tooltip/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Tooltip/index":"j3rRm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j3rRm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _tooltip = require("./Tooltip"); -parcelHelpers.exportAll(_tooltip, exports); -var _tooltipBase = require("./Tooltip.base"); -parcelHelpers.exportAll(_tooltipBase, exports); -var _tooltipTypes = require("./Tooltip.types"); -parcelHelpers.exportAll(_tooltipTypes, exports); -var _tooltipHost = require("./TooltipHost"); -parcelHelpers.exportAll(_tooltipHost, exports); -var _tooltipHostBase = require("./TooltipHost.base"); -parcelHelpers.exportAll(_tooltipHostBase, exports); -var _tooltipHostTypes = require("./TooltipHost.types"); -parcelHelpers.exportAll(_tooltipHostTypes, exports); - -},{"./Tooltip":false,"./Tooltip.base":false,"./Tooltip.types":false,"./TooltipHost":"dBgGB","./TooltipHost.base":false,"./TooltipHost.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1tZCB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Tooltip", ()=>Tooltip); -var _utilities = require("../../Utilities"); -var _tooltipBase = require("./Tooltip.base"); -var _tooltipStyles = require("./Tooltip.styles"); -var Tooltip = (0, _utilities.styled)((0, _tooltipBase.TooltipBase), (0, _tooltipStyles.getStyles), undefined, { - scope: 'Tooltip' -}); - -},{"../../Utilities":"1NZCy","./Tooltip.base":"1Jq1Y","./Tooltip.styles":"3dBwO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Jq1Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipBase", ()=>TooltipBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _callout = require("../../Callout"); -var _directionalHint = require("../../common/DirectionalHint"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var TooltipBase = /** @class */ function(_super) { - (0, _tslib.__extends)(TooltipBase, _super); - function TooltipBase() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._onRenderContent = function(props) { - if (typeof props.content === 'string') return _react.createElement("p", { - className: _this._classNames.subText - }, props.content); - else return _react.createElement("div", { - className: _this._classNames.subText - }, props.content); + _this._onRenderItem = function(item) { + switch (item.itemType) { + case SelectableOptionMenuItemType.Divider: + return _this._renderSeparator(item); + case SelectableOptionMenuItemType.Header: + return _this._renderHeader(item); + default: + return _this._renderOption(item); + } }; - return _this; - } - TooltipBase.prototype.render = function() { - var _a = this.props, className = _a.className, calloutProps = _a.calloutProps, directionalHint = _a.directionalHint, directionalHintForRTL = _a.directionalHintForRTL, styles = _a.styles, id = _a.id, maxWidth = _a.maxWidth, _b = _a.onRenderContent, onRenderContent = _b === void 0 ? this._onRenderContent : _b, targetElement = _a.targetElement, theme = _a.theme; - this._classNames = getClassNames(styles, { - theme: theme, - className: className || calloutProps && calloutProps.className, - beakWidth: calloutProps && calloutProps.isBeakVisible ? calloutProps.beakWidth : 0, - gapSpace: calloutProps && calloutProps.gapSpace, - maxWidth: maxWidth - }); - return _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - target: targetElement, - directionalHint: directionalHint, - directionalHintForRTL: directionalHintForRTL - }, calloutProps, (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'id' - ]), { - className: this._classNames.root - }), _react.createElement("div", { - className: this._classNames.content, - id: id, - onFocus: this.props.onFocus, - onMouseEnter: this.props.onMouseEnter, - onMouseLeave: this.props.onMouseLeave - }, onRenderContent(this.props, this._onRenderContent))); - }; - // Specify default props values - TooltipBase.defaultProps = { - directionalHint: (0, _directionalHint.DirectionalHint).topCenter, - maxWidth: '364px', - calloutProps: { - isBeakVisible: true, - beakWidth: 16, - gapSpace: 0, - setInitialFocus: true, - doNotLayer: false - } - }; - return TooltipBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Callout":"g2jXk","../../common/DirectionalHint":"avdAc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3dBwO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var getStyles = function(props) { - var className = props.className, _a = props.beakWidth, beakWidth = _a === void 0 ? 16 : _a, _b = props.gapSpace, gapSpace = _b === void 0 ? 0 : _b, maxWidth = props.maxWidth, theme = props.theme; - var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; - // The math here is done to account for the 45 degree rotation of the beak - // and sub-pixel rounding that differs across browsers, which is more noticeable when - // the device pixel ratio is larger - var tooltipGapSpace = -(Math.sqrt(beakWidth * beakWidth / 2) + gapSpace) + 1 / // There isn't really a great way to pass in a `window` reference here so disabling the line rule - // eslint-disable-next-line no-restricted-globals - window.devicePixelRatio; - return { - root: [ - 'ms-Tooltip', - theme.fonts.medium, - (0, _styling.AnimationClassNames).fadeIn200, - { - background: semanticColors.menuBackground, - boxShadow: effects.elevation8, - padding: '8px', - maxWidth: maxWidth, - selectors: { - ':after': { - content: "''", - position: 'absolute', - bottom: tooltipGapSpace, - left: tooltipGapSpace, - right: tooltipGapSpace, - top: tooltipGapSpace, - zIndex: 0 - } + _this._renderOption = function(item) { + var _a2; + var _b2 = _this.props, _c2 = _b2.onRenderOption, onRenderOption = _c2 === void 0 ? _this._onRenderOption : _c2, _d2 = _b2.hoisted.selectedIndices, selectedIndices = _d2 === void 0 ? [] : _d2; + var isItemSelected = item.index !== void 0 && selectedIndices ? selectedIndices.indexOf(item.index) > -1 : false; + var itemClassName = item.hidden ? _this._classNames.dropdownItemHidden : isItemSelected && item.disabled === true ? _this._classNames.dropdownItemSelectedAndDisabled : isItemSelected ? _this._classNames.dropdownItemSelected : item.disabled === true ? _this._classNames.dropdownItemDisabled : _this._classNames.dropdownItem; + var title = item.title; + var id2 = _this._listId + item.index; + var labelId = (_a2 = item.id) !== null && _a2 !== void 0 ? _a2 : id2 + "-label"; + var multiSelectItemStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.multiSelectItem : void 0; + return !_this.props.multiSelect ? React__namespace.createElement(CommandButton, { + id: id2, + key: item.key, + "data-index": item.index, + "data-is-focusable": !item.disabled, + disabled: item.disabled, + className: itemClassName, + onClick: _this._onItemClick(item), + // eslint-disable-next-line react/jsx-no-bind + onMouseEnter: _this._onItemMouseEnter.bind(_this, item), + // eslint-disable-next-line react/jsx-no-bind + onMouseLeave: _this._onMouseItemLeave.bind(_this, item), + // eslint-disable-next-line react/jsx-no-bind + onMouseMove: _this._onItemMouseMove.bind(_this, item), + role: "option", + "aria-selected": isItemSelected ? "true" : "false", + ariaLabel: item.ariaLabel, + title, + "aria-posinset": _this._sizePosCache.positionInSet(item.index), + "aria-setsize": _this._sizePosCache.optionSetSize + }, onRenderOption(item, _this._onRenderOption)) : React__namespace.createElement(Checkbox, { + id: id2, + key: item.key, + disabled: item.disabled, + onChange: _this._onItemClick(item), + inputProps: __assign$1({ "aria-selected": isItemSelected, onMouseEnter: _this._onItemMouseEnter.bind(_this, item), onMouseLeave: _this._onMouseItemLeave.bind(_this, item), onMouseMove: _this._onItemMouseMove.bind(_this, item), role: "option" }, { + "data-index": item.index, + "data-is-focusable": !(item.disabled || item.hidden) + }), + label: item.text, + title, + // eslint-disable-next-line react/jsx-no-bind + onRenderLabel: _this._onRenderItemLabel.bind(_this, __assign$1(__assign$1({}, item), { id: labelId })), + className: css(itemClassName, "is-multi-select"), + checked: isItemSelected, + styles: multiSelectItemStyles, + ariaPositionInSet: !item.hidden ? _this._sizePosCache.positionInSet(item.index) : void 0, + ariaSetSize: !item.hidden ? _this._sizePosCache.optionSetSize : void 0, + ariaLabel: item.ariaLabel, + ariaLabelledBy: item.ariaLabel ? void 0 : labelId + }); + }; + _this._onRenderOption = function(item) { + return React__namespace.createElement("span", { className: _this._classNames.dropdownOptionText }, item.text); + }; + _this._onRenderMultiselectOption = function(item) { + return React__namespace.createElement("span", { id: item.id, "aria-hidden": "true", className: _this._classNames.dropdownOptionText }, item.text); + }; + _this._onRenderItemLabel = function(item) { + var _a2 = _this.props.onRenderOption, onRenderOption = _a2 === void 0 ? _this._onRenderMultiselectOption : _a2; + return onRenderOption(item, _this._onRenderMultiselectOption); + }; + _this._onPositioned = function(positions2) { + if (_this._focusZone.current) { + _this._requestAnimationFrame(function() { + var selectedIndices = _this.props.hoisted.selectedIndices; + if (_this._focusZone.current) { + if (!_this._hasBeenPositioned && selectedIndices && selectedIndices[0] && !_this.props.options[selectedIndices[0]].disabled) { + var element2 = getDocument().getElementById("".concat(_this._id, "-list").concat(selectedIndices[0])); + if (element2) { + _this._focusZone.current.focusElement(element2); + } + _this._hasBeenPositioned = true; + } else { + _this._focusZone.current.focus(); } - }, - className - ], - content: [ - 'ms-Tooltip-content', - fonts.small, - { - position: 'relative', - zIndex: 1, - color: semanticColors.menuItemText, - wordWrap: 'break-word', - overflowWrap: 'break-word', - overflow: 'hidden' - } - ], - subText: [ - 'ms-Tooltip-subtext', - { - // Using inherit here to avoid unintentional global overrides of the <p> tag. - fontSize: 'inherit', - fontWeight: 'inherit', - color: 'inherit', - margin: 0 - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cki5b":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Tooltip} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipDelay", ()=>TooltipDelay); -var TooltipDelay; -(function(TooltipDelay) { - TooltipDelay[TooltipDelay["zero"] = 0] = "zero"; - /** 300 ms delay before showing the tooltip */ TooltipDelay[TooltipDelay["medium"] = 1] = "medium"; - /** 500 ms delay before showing the tooltip */ TooltipDelay[TooltipDelay["long"] = 2] = "long"; -})(TooltipDelay || (TooltipDelay = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dBgGB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipHost", ()=>TooltipHost); -var _utilities = require("../../Utilities"); -var _tooltipHostBase = require("./TooltipHost.base"); -var _tooltipHostStyles = require("./TooltipHost.styles"); -var TooltipHost = (0, _utilities.styled)((0, _tooltipHostBase.TooltipHostBase), (0, _tooltipHostStyles.getStyles), undefined, { - scope: 'TooltipHost' -}); - -},{"../../Utilities":"1NZCy","./TooltipHost.base":"9YH1k","./TooltipHost.styles":"et1eN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9YH1k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipHostBase", ()=>TooltipHostBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var _tooltipHostTypes = require("./TooltipHost.types"); -var _tooltip = require("./Tooltip"); -var _tooltipTypes = require("./Tooltip.types"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var TooltipHostBase = /** @class */ function(_super) { - (0, _tslib.__extends)(TooltipHostBase, _super); - // Constructor - function TooltipHostBase(props) { - var _this = _super.call(this, props) || this; - // The wrapping div that gets the hover events - _this._tooltipHost = _react.createRef(); - _this._defaultTooltipId = (0, _utilities.getId)('tooltip'); - _this.show = function() { - _this._toggleTooltip(true); - }; - _this.dismiss = function() { - _this._hideTooltip(); + } + }); + } + if (!_this.state.calloutRenderEdge || _this.state.calloutRenderEdge !== positions2.targetEdge) { + _this.setState({ + calloutRenderEdge: positions2.targetEdge + }); + } }; - _this._getTargetElement = function() { - if (!_this._tooltipHost.current) return undefined; - var overflowMode = _this.props.overflowMode; - // Select target element based on overflow mode. For parent mode, you want to position the tooltip relative - // to the parent element, otherwise it might look off. - if (overflowMode !== undefined) switch(overflowMode){ - case (0, _tooltipHostTypes.TooltipOverflowMode).Parent: - return _this._tooltipHost.current.parentElement; - case (0, _tooltipHostTypes.TooltipOverflowMode).Self: - return _this._tooltipHost.current; - } - return _this._tooltipHost.current; + _this._onItemClick = function(item) { + return function(event2) { + if (!item.disabled) { + _this.setSelectedIndex(event2, item.index); + if (!_this.props.multiSelect) { + _this.setState({ + isOpen: false + }); + } + } + }; + }; + _this._onScroll = function() { + var win = getWindowEx(_this.context); + if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== void 0) { + win.clearTimeout(_this._scrollIdleTimeoutId); + _this._scrollIdleTimeoutId = void 0; + } else { + _this._isScrollIdle = false; + } + _this._scrollIdleTimeoutId = win.setTimeout(function() { + _this._isScrollIdle = true; + }, _this._scrollIdleDelay); }; - _this._onTooltipFocus = function(ev) { - if (_this._ignoreNextFocusEvent) { - _this._ignoreNextFocusEvent = false; - return; + _this._onMouseItemLeave = function(item, ev) { + if (_this._shouldIgnoreMouseEvent()) { + return; + } + if (_this._host.current) { + if (_this._host.current.setActive) { + try { + _this._host.current.setActive(); + } catch (e) { + } + } else { + _this._host.current.focus(); } - _this._onTooltipMouseEnter(ev); + } }; - _this._onTooltipContentFocus = function(ev) { - if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip !== _this) TooltipHostBase._currentVisibleTooltip.dismiss(); - TooltipHostBase._currentVisibleTooltip = _this; - _this._clearDismissTimer(); - _this._clearOpenTimer(); - }; - _this._onTooltipBlur = function(ev) { - var _a; - // The focused element gets a blur event when the document loses focus - // (e.g. switching tabs in the browser), but we don't want to show the - // tooltip again when the document gets focus back. Handle this case by - // checking if the blurred element is still the document's activeElement, - // and ignoring when it next gets focus back. - // See https://github.com/microsoft/fluentui/issues/13541 - _this._ignoreNextFocusEvent = ((_a = (0, _dom.getDocumentEx)(_this.context)) === null || _a === void 0 ? void 0 : _a.activeElement) === ev.target; - _this._dismissTimerId = _this._async.setTimeout(function() { - _this._hideTooltip(); - }, 0); + _this._onDismiss = function() { + _this.setState({ isOpen: false }); }; - // Show Tooltip - _this._onTooltipMouseEnter = function(ev) { - var _a = _this.props, overflowMode = _a.overflowMode, delay = _a.delay; - var doc = (0, _dom.getDocumentEx)(_this.context); - if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip !== _this) TooltipHostBase._currentVisibleTooltip.dismiss(); - TooltipHostBase._currentVisibleTooltip = _this; - if (overflowMode !== undefined) { - var overflowElement = _this._getTargetElement(); - if (overflowElement && !(0, _utilities.hasOverflow)(overflowElement)) return; - } - if (ev.target && (0, _utilities.portalContainsElement)(ev.target, _this._getTargetElement(), doc)) // Do not show tooltip when target is inside a portal relative to TooltipHost. + _this._onDropdownBlur = function(ev) { + var disabled = _this._isDisabled(); + if (disabled) { return; - _this._clearDismissTimer(); - _this._clearOpenTimer(); - if (delay !== (0, _tooltipTypes.TooltipDelay).zero) { - var delayTime = _this._getDelayTime(delay); // non-null assertion because we set it in `defaultProps` - _this._openTimerId = _this._async.setTimeout(function() { - _this._toggleTooltip(true); - }, delayTime); - } else _this._toggleTooltip(true); - }; - // Hide Tooltip - _this._onTooltipMouseLeave = function(ev) { - var closeDelay = _this.props.closeDelay; - _this._clearDismissTimer(); - _this._clearOpenTimer(); - if (closeDelay) _this._dismissTimerId = _this._async.setTimeout(function() { - _this._toggleTooltip(false); - }, closeDelay); - else _this._toggleTooltip(false); - if (TooltipHostBase._currentVisibleTooltip === _this) TooltipHostBase._currentVisibleTooltip = undefined; + } + if (_this.state.isOpen) { + return; + } + _this.setState({ hasFocus: false }); + if (_this.props.onBlur) { + _this.props.onBlur(ev); + } }; - _this._onTooltipKeyDown = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if ((ev.which === (0, _utilities.KeyCodes).escape || ev.ctrlKey) && _this.state.isTooltipVisible) { - _this._hideTooltip(); + _this._onDropdownKeyDown = function(ev) { + var disabled = _this._isDisabled(); + if (disabled) { + return; + } + _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + if (ev.defaultPrevented) { + return; + } + } + var newIndex; + var selectedIndex = _this.props.hoisted.selectedIndices.length ? _this.props.hoisted.selectedIndices[0] : -1; + var containsExpandCollapseModifier = ev.altKey || ev.metaKey; + var isOpen = _this.state.isOpen; + switch (ev.which) { + case KeyCodes.enter: + _this.setState({ + isOpen: !isOpen + }); + break; + case KeyCodes.escape: + if (!isOpen) { + return; + } + _this.setState({ + isOpen: false + }); + break; + case KeyCodes.up: + if (containsExpandCollapseModifier) { + if (isOpen) { + _this.setState({ isOpen: false }); + break; + } + return; + } + if (_this.props.multiSelect) { + _this.setState({ isOpen: true }); + } else if (!_this._isDisabled()) { + newIndex = _this._moveIndex(ev, -1, selectedIndex - 1, selectedIndex); + } + break; + case KeyCodes.down: + if (containsExpandCollapseModifier) { ev.stopPropagation(); - } + ev.preventDefault(); + } + if (containsExpandCollapseModifier && !isOpen || _this.props.multiSelect) { + _this.setState({ isOpen: true }); + } else if (!_this._isDisabled()) { + newIndex = _this._moveIndex(ev, 1, selectedIndex + 1, selectedIndex); + } + break; + case KeyCodes.home: + if (!_this.props.multiSelect) { + newIndex = _this._moveIndex(ev, 1, 0, selectedIndex); + } + break; + case KeyCodes.end: + if (!_this.props.multiSelect) { + newIndex = _this._moveIndex(ev, -1, _this.props.options.length - 1, selectedIndex); + } + break; + case KeyCodes.space: + break; + default: + return; + } + if (newIndex !== selectedIndex) { + ev.stopPropagation(); + ev.preventDefault(); + } }; - _this._clearDismissTimer = function() { - _this._async.clearTimeout(_this._dismissTimerId); + _this._onDropdownKeyUp = function(ev) { + var disabled = _this._isDisabled(); + if (disabled) { + return; + } + var shouldHandleKey = _this._shouldHandleKeyUp(ev); + var isOpen = _this.state.isOpen; + if (_this.props.onKeyUp) { + _this.props.onKeyUp(ev); + if (ev.defaultPrevented) { + return; + } + } + switch (ev.which) { + case KeyCodes.space: + _this.setState({ + isOpen: !isOpen + }); + break; + default: + if (shouldHandleKey && isOpen) { + _this.setState({ isOpen: false }); + } + return; + } + ev.stopPropagation(); + ev.preventDefault(); }; - _this._clearOpenTimer = function() { - _this._async.clearTimeout(_this._openTimerId); + _this._onZoneKeyDown = function(ev) { + var _a2, _b2; + var elementToFocus; + _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); + var containsExpandCollapseModifier = ev.altKey || ev.metaKey; + switch (ev.which) { + case KeyCodes.up: + if (containsExpandCollapseModifier) { + _this.setState({ isOpen: false }); + } else { + if (_this._host.current) { + elementToFocus = getLastFocusable(_this._host.current, _this._host.current.lastChild, true); + } + } + break; + // All directional keystrokes should be canceled when the zone is rendered. + // This avoids the body scroll from reacting and thus dismissing the dropdown. + case KeyCodes.home: + case KeyCodes.end: + case KeyCodes.pageUp: + case KeyCodes.pageDown: + break; + case KeyCodes.down: + if (!containsExpandCollapseModifier && _this._host.current) { + elementToFocus = getFirstFocusable(_this._host.current, _this._host.current.firstChild, true); + } + break; + case KeyCodes.escape: + _this.setState({ isOpen: false }); + break; + case KeyCodes.tab: + _this.setState({ isOpen: false }); + var document_1 = getDocument(); + if (document_1) { + if (ev.shiftKey) { + (_a2 = getPreviousElement(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _a2 === void 0 ? void 0 : _a2.focus(); + } else { + (_b2 = getNextElement(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _b2 === void 0 ? void 0 : _b2.focus(); + } + } + break; + default: + return; + } + if (elementToFocus) { + elementToFocus.focus(); + } + ev.stopPropagation(); + ev.preventDefault(); }; - // Hide Tooltip - _this._hideTooltip = function() { - _this._clearOpenTimer(); - _this._clearDismissTimer(); - _this._toggleTooltip(false); + _this._onZoneKeyUp = function(ev) { + var shouldHandleKey = _this._shouldHandleKeyUp(ev); + if (shouldHandleKey && _this.state.isOpen) { + _this.setState({ isOpen: false }); + ev.preventDefault(); + } }; - _this._toggleTooltip = function(isTooltipVisible) { - if (_this.state.isTooltipVisible !== isTooltipVisible) _this.setState({ - isTooltipVisible: isTooltipVisible - }, function() { - return _this.props.onTooltipToggle && _this.props.onTooltipToggle(isTooltipVisible); + _this._onDropdownClick = function(ev) { + if (_this.props.onClick) { + _this.props.onClick(ev); + if (ev.defaultPrevented) { + return; + } + } + var isOpen = _this.state.isOpen; + var disabled = _this._isDisabled(); + if (!disabled && !_this._shouldOpenOnFocus()) { + _this.setState({ + isOpen: !isOpen }); + } + _this._isFocusedByClick = false; }; - _this._getDelayTime = function(delay) { - switch(delay){ - case (0, _tooltipTypes.TooltipDelay).medium: - return 300; - case (0, _tooltipTypes.TooltipDelay).long: - return 500; - default: - return 0; - } + _this._onDropdownMouseDown = function() { + _this._isFocusedByClick = true; }; - (0, _utilities.initializeComponentRef)(_this); + _this._onFocus = function(ev) { + var disabled = _this._isDisabled(); + if (!disabled) { + if (_this.props.onFocus) { + _this.props.onFocus(ev); + } + var state = { hasFocus: true }; + if (_this._shouldOpenOnFocus()) { + state.isOpen = true; + } + _this.setState(state); + } + }; + _this._isDisabled = function() { + var disabled = _this.props.disabled; + var isDisabled = _this.props.isDisabled; + if (disabled === void 0) { + disabled = isDisabled; + } + return disabled; + }; + _this._onRenderLabel = function(props2) { + var label2 = props2.label, required2 = props2.required, disabled = props2.disabled; + var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : void 0; + return label2 ? React__namespace.createElement(Label$2, { className: _this._classNames.label, id: _this._labelId, required: required2, styles: labelStyles, disabled }, label2) : null; + }; + initializeComponentRef(_this); + props.multiSelect; + props.selectedKey; + props.selectedKeys; + props.defaultSelectedKey; + props.defaultSelectedKeys; + var options2 = props.options; + _this._id = props.id || getId("Dropdown"); + _this._labelId = _this._id + "-label"; + _this._listId = _this._id + "-list"; + _this._optionId = _this._id + "-option"; + _this._isScrollIdle = true; + _this._hasBeenPositioned = false; + _this._sizePosCache.updateOptions(options2); _this.state = { - isAriaPlaceholderRendered: false, - isTooltipVisible: false + isOpen: false, + hasFocus: false, + calloutRenderEdge: void 0 }; return _this; - } - // Render - TooltipHostBase.prototype.render = function() { - var _a = this.props, calloutProps = _a.calloutProps, children = _a.children, content = _a.content, directionalHint = _a.directionalHint, directionalHintForRTL = _a.directionalHintForRTL, className = _a.hostClassName, id = _a.id, // eslint-disable-next-line deprecation/deprecation - _b = _a.setAriaDescribedBy, // eslint-disable-next-line deprecation/deprecation - setAriaDescribedBy = _b === void 0 ? true : _b, tooltipProps = _a.tooltipProps, styles = _a.styles, theme = _a.theme; - this._classNames = getClassNames(styles, { - theme: theme, - className: className + } + Object.defineProperty(DropdownInternal2.prototype, "selectedOptions", { + /** + * All selected options + */ + get: function() { + var _a2 = this.props, options2 = _a2.options, selectedIndices = _a2.hoisted.selectedIndices; + return getAllSelectedOptions(options2, selectedIndices); + }, + enumerable: false, + configurable: true + }); + DropdownInternal2.prototype.componentWillUnmount = function() { + clearTimeout(this._scrollIdleTimeoutId); + }; + DropdownInternal2.prototype.componentDidUpdate = function(prevProps, prevState) { + if (prevState.isOpen === true && this.state.isOpen === false) { + this._gotMouseMove = false; + this._hasBeenPositioned = false; + if (this.props.onDismiss) { + this.props.onDismiss(); + } + } + }; + DropdownInternal2.prototype.render = function() { + var id2 = this._id; + var props = this.props; + var className2 = props.className, label2 = props.label, options2 = props.options, ariaLabel2 = props.ariaLabel, required2 = props.required, errorMessage = props.errorMessage, propStyles = props.styles, theme = props.theme, panelProps = props.panelProps, calloutProps = props.calloutProps, _a2 = props.onRenderTitle, onRenderTitle = _a2 === void 0 ? this._getTitle : _a2, _b2 = props.onRenderContainer, onRenderContainer = _b2 === void 0 ? this._onRenderContainer : _b2, _c2 = props.onRenderCaretDown, onRenderCaretDown = _c2 === void 0 ? this._onRenderCaretDown : _c2, _d2 = props.onRenderLabel, onRenderLabel = _d2 === void 0 ? this._onRenderLabel : _d2, _e2 = props.onRenderItem, onRenderItem = _e2 === void 0 ? this._onRenderItem : _e2, selectedIndices = props.hoisted.selectedIndices, responsiveMode = props.responsiveMode; + var _f = this.state, isOpen = _f.isOpen, calloutRenderEdge = _f.calloutRenderEdge, hasFocus = _f.hasFocus; + var onRenderPlaceholder = props.onRenderPlaceholder || props.onRenderPlaceHolder || this._getPlaceholder; + if (options2 !== this._sizePosCache.cachedOptions) { + this._sizePosCache.updateOptions(options2); + } + var selectedOptions = getAllSelectedOptions(options2, selectedIndices); + var divProps = getNativeProps(props, divProperties); + var disabled = this._isDisabled(); + var isSmall = responsiveMode <= ResponsiveMode.medium; + var errorMessageId = id2 + "-errorMessage"; + this._classNames = getClassNames$4(propStyles, { + theme, + className: className2, + hasError: !!(errorMessage && errorMessage.length > 0), + hasLabel: !!label2, + isOpen, + required: required2, + disabled, + isRenderingPlaceholder: !selectedOptions.length, + panelClassName: panelProps ? panelProps.className : void 0, + calloutClassName: calloutProps ? calloutProps.className : void 0, + calloutRenderEdge }); - var isTooltipVisible = this.state.isTooltipVisible; - var tooltipId = id || this._defaultTooltipId; - var tooltipRenderProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - id: "".concat(tooltipId, "--tooltip"), - content: content, - targetElement: this._getTargetElement(), - directionalHint: directionalHint, - directionalHintForRTL: directionalHintForRTL, - calloutProps: (0, _utilities.assign)({}, calloutProps, { - onDismiss: this._hideTooltip, - onFocus: this._onTooltipContentFocus, - onMouseEnter: this._onTooltipMouseEnter, - onMouseLeave: this._onTooltipMouseLeave - }), - onMouseEnter: this._onTooltipMouseEnter, - onMouseLeave: this._onTooltipMouseLeave - }, (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'id' - ])), tooltipProps); - // Get the content of the tooltip for use in the hidden div used for screen readers - var tooltipContent = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.onRenderContent) ? tooltipProps.onRenderContent(tooltipRenderProps, function(props) { - return (props === null || props === void 0 ? void 0 : props.content) ? _react.createElement(_react.Fragment, null, props.content) : null; - }) : content; - var showTooltip = isTooltipVisible && !!tooltipContent; - var ariaDescribedBy = setAriaDescribedBy && isTooltipVisible && !!tooltipContent ? tooltipId : undefined; - return _react.createElement("div", { - className: this._classNames.root, - ref: this._tooltipHost, - onFocusCapture: this._onTooltipFocus, - onBlurCapture: this._onTooltipBlur, - onMouseEnter: this._onTooltipMouseEnter, - onMouseLeave: this._onTooltipMouseLeave, - onKeyDown: this._onTooltipKeyDown, - role: "none", - "aria-describedby": ariaDescribedBy - }, children, showTooltip && _react.createElement((0, _tooltip.Tooltip), (0, _tslib.__assign)({}, tooltipRenderProps)), _react.createElement("div", { - hidden: true, - id: tooltipId, - style: (0, _styling.hiddenContentStyle) - }, tooltipContent)); - }; - TooltipHostBase.prototype.componentDidMount = function() { - this._async = new (0, _utilities.Async)(this); - }; - TooltipHostBase.prototype.componentWillUnmount = function() { - if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip === this) TooltipHostBase._currentVisibleTooltip = undefined; - this._async.dispose(); + var hasErrorMessage = !!errorMessage && errorMessage.length > 0; + return React__namespace.createElement( + "div", + { className: this._classNames.root, ref: this.props.hoisted.rootRef, "aria-owns": isOpen && !isSmall ? this._listId : void 0 }, + onRenderLabel(this.props, this._onRenderLabel), + React__namespace.createElement( + "div", + __assign$1({ "data-is-focusable": !disabled, "data-ktp-target": true, ref: this._dropDown, id: id2, tabIndex: disabled ? -1 : 0, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen ? "true" : "false", "aria-label": ariaLabel2, "aria-labelledby": label2 && !ariaLabel2 ? mergeAriaAttributeValues(this._labelId, this._optionId) : void 0, "aria-describedby": hasErrorMessage ? this._id + "-errorMessage" : void 0, "aria-required": required2, "aria-disabled": disabled, "aria-invalid": hasErrorMessage, "aria-controls": isOpen && !isSmall ? this._listId : void 0 }, divProps, { className: this._classNames.dropdown, onBlur: this._onDropdownBlur, onKeyDown: this._onDropdownKeyDown, onKeyUp: this._onDropdownKeyUp, onClick: this._onDropdownClick, onMouseDown: this._onDropdownMouseDown, onFocus: this._onFocus }), + React__namespace.createElement( + "span", + { id: this._optionId, className: this._classNames.title, "aria-live": hasFocus ? "polite" : void 0, "aria-atomic": hasFocus ? true : void 0 }, + // If option is selected render title, otherwise render the placeholder text + selectedOptions.length ? onRenderTitle(selectedOptions, this._onRenderTitle) : onRenderPlaceholder(props, this._onRenderPlaceholder) + ), + React__namespace.createElement("span", { className: this._classNames.caretDownWrapper }, onRenderCaretDown(props, this._onRenderCaretDown)) + ), + isOpen && onRenderContainer(__assign$1(__assign$1({}, props), { onDismiss: this._onDismiss, onRenderItem }), this._onRenderContainer), + hasErrorMessage && React__namespace.createElement("div", { role: "alert", id: errorMessageId, className: this._classNames.errorMessage }, errorMessage) + ); + }; + DropdownInternal2.prototype.focus = function(shouldOpenOnFocus) { + if (this._dropDown.current) { + this._dropDown.current.focus(); + if (shouldOpenOnFocus) { + this.setState({ + isOpen: true + }); + } + } + }; + DropdownInternal2.prototype.setSelectedIndex = function(event2, index2) { + var _a2 = this.props, options2 = _a2.options, selectedKey = _a2.selectedKey, selectedKeys = _a2.selectedKeys, multiSelect = _a2.multiSelect, notifyOnReselect = _a2.notifyOnReselect, _b2 = _a2.hoisted.selectedIndices, selectedIndices = _b2 === void 0 ? [] : _b2; + var checked = selectedIndices ? selectedIndices.indexOf(index2) > -1 : false; + var newIndexes = []; + index2 = Math.max(0, Math.min(options2.length - 1, index2)); + if (selectedKey !== void 0 || selectedKeys !== void 0) { + this._onChange(event2, options2, index2, checked, multiSelect); + return; + } + if (!multiSelect && !notifyOnReselect && index2 === selectedIndices[0]) { + return; + } else if (multiSelect) { + newIndexes = selectedIndices ? this._copyArray(selectedIndices) : []; + if (checked) { + var position2 = newIndexes.indexOf(index2); + if (position2 > -1) { + newIndexes.splice(position2, 1); + } + } else { + newIndexes.push(index2); + } + } else { + newIndexes = [index2]; + } + event2.persist(); + this.props.hoisted.setSelectedIndices(newIndexes); + this._onChange(event2, options2, index2, checked, multiSelect); + }; + DropdownInternal2.prototype._copyArray = function(array2) { + var newArray = []; + for (var _i = 0, array_1 = array2; _i < array_1.length; _i++) { + var element2 = array_1[_i]; + newArray.push(element2); + } + return newArray; + }; + DropdownInternal2.prototype._moveIndex = function(event2, stepValue, index2, selectedIndex) { + var options2 = this.props.options; + if (selectedIndex === index2 || options2.length === 0) { + return selectedIndex; + } + if (index2 >= options2.length) { + index2 = 0; + } else if (index2 < 0) { + index2 = options2.length - 1; + } + var stepCounter = 0; + while (options2[index2].itemType === SelectableOptionMenuItemType.Header || options2[index2].itemType === SelectableOptionMenuItemType.Divider || options2[index2].disabled) { + if (stepCounter >= options2.length) { + return selectedIndex; + } + if (index2 + stepValue < 0) { + index2 = options2.length; + } else if (index2 + stepValue >= options2.length) { + index2 = -1; + } + index2 = index2 + stepValue; + stepCounter++; + } + this.setSelectedIndex(event2, index2); + return index2; + }; + DropdownInternal2.prototype._renderFocusableList = function(props) { + var _a2 = props.onRenderList, onRenderList = _a2 === void 0 ? this._onRenderList : _a2, label2 = props.label, ariaLabel2 = props.ariaLabel, multiSelect = props.multiSelect; + return React__namespace.createElement( + "div", + { className: this._classNames.dropdownItemsWrapper, onKeyDown: this._onZoneKeyDown, onKeyUp: this._onZoneKeyUp, ref: this._host, tabIndex: 0 }, + React__namespace.createElement(FocusZone, { ref: this._focusZone, direction: FocusZoneDirection.vertical, id: this._listId, className: this._classNames.dropdownItems, role: "listbox", "aria-label": ariaLabel2, "aria-labelledby": label2 && !ariaLabel2 ? this._labelId : void 0, "aria-multiselectable": multiSelect }, onRenderList(props, this._onRenderList)) + ); + }; + DropdownInternal2.prototype._renderSeparator = function(item) { + var index2 = item.index, key2 = item.key; + var separatorClassName = item.hidden ? this._classNames.dropdownDividerHidden : this._classNames.dropdownDivider; + if (index2 > 0) { + return React__namespace.createElement("div", { role: "presentation", key: key2, className: separatorClassName }); + } + return null; + }; + DropdownInternal2.prototype._renderHeader = function(item) { + var _a2 = this.props.onRenderOption, onRenderOption = _a2 === void 0 ? this._onRenderOption : _a2; + var key2 = item.key, id2 = item.id; + var headerClassName = item.hidden ? this._classNames.dropdownItemHeaderHidden : this._classNames.dropdownItemHeader; + return React__namespace.createElement("div", { id: id2, key: key2, className: headerClassName }, onRenderOption(item, this._onRenderOption)); + }; + DropdownInternal2.prototype._onItemMouseEnter = function(item, ev) { + if (this._shouldIgnoreMouseEvent()) { + return; + } + var targetElement = ev.currentTarget; + targetElement.focus(); + }; + DropdownInternal2.prototype._onItemMouseMove = function(item, ev) { + var doc = getDocumentEx(this.context); + var targetElement = ev.currentTarget; + this._gotMouseMove = true; + if (!this._isScrollIdle || doc.activeElement === targetElement) { + return; + } + targetElement.focus(); + }; + DropdownInternal2.prototype._shouldIgnoreMouseEvent = function() { + return !this._isScrollIdle || !this._gotMouseMove; + }; + DropdownInternal2.prototype._isAltOrMeta = function(ev) { + return ev.which === KeyCodes.alt || ev.key === "Meta"; + }; + DropdownInternal2.prototype._shouldHandleKeyUp = function(ev) { + var keyPressIsAltOrMetaAlone = this._lastKeyDownWasAltOrMeta && this._isAltOrMeta(ev); + this._lastKeyDownWasAltOrMeta = false; + return !!keyPressIsAltOrMetaAlone && !(isMac() || isIOS()); + }; + DropdownInternal2.prototype._shouldOpenOnFocus = function() { + var hasFocus = this.state.hasFocus; + var openOnKeyboardFocus = this.props.openOnKeyboardFocus; + return !this._isFocusedByClick && openOnKeyboardFocus === true && !hasFocus; + }; + DropdownInternal2.defaultProps = { + options: [] + }; + DropdownInternal2.contextType = WindowContext; + return DropdownInternal2; + })(React__namespace.Component) + ); + var _a, _b, _c, _d, _e; + var GlobalClassNames$2 = { + root: "ms-Dropdown-container", + label: "ms-Dropdown-label", + dropdown: "ms-Dropdown", + title: "ms-Dropdown-title", + caretDownWrapper: "ms-Dropdown-caretDownWrapper", + caretDown: "ms-Dropdown-caretDown", + callout: "ms-Dropdown-callout", + panel: "ms-Dropdown-panel", + dropdownItems: "ms-Dropdown-items", + dropdownItem: "ms-Dropdown-item", + dropdownDivider: "ms-Dropdown-divider", + dropdownOptionText: "ms-Dropdown-optionText", + dropdownItemHeader: "ms-Dropdown-header", + titleIsPlaceHolder: "ms-Dropdown-titleIsPlaceHolder", + titleHasError: "ms-Dropdown-title--hasError" + }; + var DROPDOWN_HEIGHT = 32; + var DROPDOWN_ITEM_HEIGHT = 36; + var highContrastAdjustMixin = (_a = {}, _a["".concat(HighContrastSelector, ", ").concat(HighContrastSelectorWhite.replace("@media ", ""))] = __assign$1({}, getHighContrastNoAdjustStyle()), _a); + var highContrastItemAndTitleStateMixin = { + selectors: __assign$1((_b = {}, _b[HighContrastSelector] = (_c = { + backgroundColor: "Highlight", + borderColor: "Highlight", + color: "HighlightText" + }, _c[".".concat(IsFocusVisibleClassName, " &:focus:after")] = { + borderColor: "HighlightText" + }, _c), _b[".ms-Checkbox-checkbox"] = (_d = {}, _d[HighContrastSelector] = { + borderColor: "HighlightText" + }, _d), _b), highContrastAdjustMixin) + }; + var highContrastBorderState = { + selectors: (_e = {}, _e[HighContrastSelector] = { + borderColor: "Highlight" + }, _e) + }; + var MinimumScreenSelector = getScreenSelector(0, ScreenWidthMinMedium); + var getStyles$4 = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m; + var theme = props.theme, hasError = props.hasError, hasLabel = props.hasLabel, className2 = props.className, isOpen = props.isOpen, disabled = props.disabled, required2 = props.required, isRenderingPlaceholder = props.isRenderingPlaceholder, panelClassName = props.panelClassName, calloutClassName = props.calloutClassName, calloutRenderEdge = props.calloutRenderEdge; + if (!theme) { + throw new Error("theme is undefined or null in base Dropdown getStyles function."); + } + var globalClassnames = getGlobalClassNames(GlobalClassNames$2, theme); + var palette = theme.palette, semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; + var rootHoverFocusActiveSelectorNeutralDarkMixin = { + color: semanticColors.menuItemTextHovered }; - TooltipHostBase.defaultProps = { - delay: (0, _tooltipTypes.TooltipDelay).medium - }; - TooltipHostBase.contextType = (0, _reactWindowProvider.WindowContext); - return TooltipHostBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Styling":"hTimn","../../Utilities":"1NZCy","./TooltipHost.types":"2LOQ1","./Tooltip":"1tZCB","./Tooltip.types":"cki5b","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2LOQ1":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Tooltip} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipOverflowMode", ()=>TooltipOverflowMode); -var TooltipOverflowMode; -(function(TooltipOverflowMode) { - /** Only show tooltip if parent DOM element is overflowing */ TooltipOverflowMode[TooltipOverflowMode["Parent"] = 0] = "Parent"; - /** - * Only show tooltip if tooltip host's content is overflowing. - * Note that this does not check the children for overflow, only the TooltipHost root. - */ TooltipOverflowMode[TooltipOverflowMode["Self"] = 1] = "Self"; -})(TooltipOverflowMode || (TooltipOverflowMode = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"et1eN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-TooltipHost', - ariaPlaceholder: 'ms-TooltipHost-aria-placeholder' -}; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + var rootHoverFocusActiveSelectorNeutralPrimaryMixin = { + color: semanticColors.menuItemText + }; + var borderColorError = { + borderColor: semanticColors.errorText + }; + var dropdownItemStyle = [ + globalClassnames.dropdownItem, + { + backgroundColor: "transparent", + boxSizing: "border-box", + cursor: "pointer", + display: "flex", + alignItems: "center", + padding: "0 8px", + width: "100%", + minHeight: DROPDOWN_ITEM_HEIGHT, + lineHeight: 20, + height: 0, + position: "relative", + border: "1px solid transparent", + borderRadius: 0, + wordWrap: "break-word", + overflowWrap: "break-word", + textAlign: "left", + ".ms-Button-flexContainer": { + width: "100%" + } + } + ]; + var dropdownHeaderStyle = [ + globalClassnames.dropdownItemHeader, + __assign$1(__assign$1({}, fonts.medium), { fontWeight: FontWeights.semibold, color: semanticColors.menuHeader, background: "none", backgroundColor: "transparent", border: "none", height: DROPDOWN_ITEM_HEIGHT, lineHeight: DROPDOWN_ITEM_HEIGHT, cursor: "default", padding: "0 8px", userSelect: "none", textAlign: "left", selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _a2) }) + ]; + var selectedItemBackgroundColor = semanticColors.menuItemBackgroundPressed; + var itemSelectors = function(isSelected) { + var _a3, _b3; + if (isSelected === void 0) { + isSelected = false; + } + return { + selectors: (_a3 = { + "&:hover": [ + { + color: semanticColors.menuItemTextHovered, + backgroundColor: !isSelected ? semanticColors.menuItemBackgroundHovered : selectedItemBackgroundColor + }, + highContrastItemAndTitleStateMixin + ], + "&.is-multi-select:hover": [ + { backgroundColor: !isSelected ? "transparent" : selectedItemBackgroundColor }, + highContrastItemAndTitleStateMixin + ], + "&:active:hover": [ + { + color: semanticColors.menuItemTextHovered, + backgroundColor: !isSelected ? semanticColors.menuItemBackgroundPressed : semanticColors.menuItemBackgroundHovered + }, + highContrastItemAndTitleStateMixin + ] + }, _a3[".".concat(IsFocusVisibleClassName, " &:focus:after, :host(.").concat(IsFocusVisibleClassName, ") &:focus:after")] = (_b3 = { + left: 0, + top: 0, + bottom: 0, + right: 0 + }, _b3[HighContrastSelector] = { + inset: "2px" + }, _b3), _a3[HighContrastSelector] = { + border: "none" + }, _a3) + }; + }; + var dropdownItemSelected = __spreadArray(__spreadArray([], dropdownItemStyle, true), [ + { + backgroundColor: selectedItemBackgroundColor, + color: semanticColors.menuItemTextHovered + }, + itemSelectors(true), + highContrastItemAndTitleStateMixin + ], false); + var dropdownItemDisabled = __spreadArray(__spreadArray([], dropdownItemStyle, true), [ + { + color: semanticColors.disabledText, + cursor: "default", + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + color: "GrayText", + border: "none" + }, _b2) + } + ], false); + var titleOpenBorderRadius = calloutRenderEdge === RectangleEdge.bottom ? "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0") : "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2); + var calloutOpenBorderRadius = calloutRenderEdge === RectangleEdge.bottom ? "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2) : "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0"); return { - root: [ - classNames.root, + root: [globalClassnames.root, className2], + label: globalClassnames.label, + dropdown: [ + globalClassnames.dropdown, + normalize$1, + fonts.medium, + { + color: semanticColors.menuItemText, + borderColor: semanticColors.focusBorder, + position: "relative", + outline: 0, + userSelect: "none", + selectors: (_c2 = {}, _c2["&:hover ." + globalClassnames.title] = [ + !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, + { borderColor: isOpen ? palette.neutralSecondary : palette.neutralPrimary }, + highContrastBorderState + ], _c2["&:focus ." + globalClassnames.title] = [ + !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, + { selectors: (_d2 = {}, _d2[HighContrastSelector] = { color: "Highlight" }, _d2) } + ], _c2["&:focus:after"] = [ { - display: 'inline' - }, - className - ] + pointerEvents: "none", + content: "''", + position: "absolute", + boxSizing: "border-box", + top: "0px", + left: "0px", + width: "100%", + height: "100%", + // see https://github.com/microsoft/fluentui/pull/9182 for semantic color disc + border: !disabled ? "2px solid ".concat(palette.themePrimary) : "none", + borderRadius: "2px", + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + color: "Highlight" + }, _e2) + } + ], _c2["&:active ." + globalClassnames.title] = [ + !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, + { borderColor: palette.themePrimary }, + highContrastBorderState + ], _c2["&:hover ." + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:focus ." + globalClassnames.caretDown] = [ + !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, + { selectors: (_f = {}, _f[HighContrastSelector] = { color: "Highlight" }, _f) } + ], _c2["&:active ." + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:hover ." + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:focus ." + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:active ." + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:hover ." + globalClassnames.titleHasError] = borderColorError, _c2["&:active ." + globalClassnames.titleHasError] = borderColorError, _c2) + }, + isOpen && "is-open", + disabled && "is-disabled", + required2 && "is-required", + required2 && !hasLabel && { + selectors: (_g = { + ":before": { + content: "'*'", + color: semanticColors.errorText, + position: "absolute", + top: -5, + right: -10 + } + }, _g[HighContrastSelector] = { + selectors: { + ":after": { + right: -14 + // moving the * 4 pixel to right to alleviate border clipping in HC mode. + } + } + }, _g) + } + ], + title: [ + globalClassnames.title, + normalize$1, + { + backgroundColor: semanticColors.inputBackground, + borderWidth: 1, + borderStyle: "solid", + borderColor: semanticColors.inputBorder, + borderRadius: isOpen ? titleOpenBorderRadius : effects.roundedCorner2, + cursor: "pointer", + display: "block", + height: DROPDOWN_HEIGHT, + lineHeight: DROPDOWN_HEIGHT - 2, + padding: "0 28px 0 8px", + position: "relative", + overflow: "hidden", + whiteSpace: "nowrap", + textOverflow: "ellipsis" + }, + isRenderingPlaceholder && [globalClassnames.titleIsPlaceHolder, { color: semanticColors.inputPlaceholderText }], + hasError && [globalClassnames.titleHasError, borderColorError], + disabled && { + backgroundColor: semanticColors.disabledBackground, + border: "none", + color: semanticColors.disabledText, + cursor: "default", + selectors: (_h = {}, _h[HighContrastSelector] = __assign$1({ border: "1px solid GrayText", color: "GrayText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _h) + } + ], + caretDownWrapper: [ + globalClassnames.caretDownWrapper, + { + height: DROPDOWN_HEIGHT, + lineHeight: DROPDOWN_HEIGHT - 2, + // height minus the border + paddingTop: 1, + position: "absolute", + right: 8, + top: 0 + }, + !disabled && { + cursor: "pointer" + } + ], + caretDown: [ + globalClassnames.caretDown, + { color: palette.neutralSecondary, fontSize: fonts.small.fontSize, pointerEvents: "none" }, + disabled && { + color: semanticColors.disabledText, + selectors: (_j = {}, _j[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _j) + } + ], + errorMessage: __assign$1(__assign$1({ color: semanticColors.errorText }, theme.fonts.small), { paddingTop: 5 }), + callout: [ + globalClassnames.callout, + { + boxShadow: effects.elevation8, + borderRadius: calloutOpenBorderRadius, + selectors: (_k = {}, _k[".ms-Callout-main"] = { borderRadius: calloutOpenBorderRadius }, _k) + }, + calloutClassName + ], + dropdownItemsWrapper: { selectors: { "&:focus": { outline: 0 } } }, + dropdownItems: [globalClassnames.dropdownItems, { display: "block" }], + dropdownItem: __spreadArray(__spreadArray([], dropdownItemStyle, true), [itemSelectors()], false), + dropdownItemSelected, + dropdownItemDisabled, + dropdownItemSelectedAndDisabled: [dropdownItemSelected, dropdownItemDisabled, { backgroundColor: "transparent" }], + dropdownItemHidden: __spreadArray(__spreadArray([], dropdownItemStyle, true), [{ display: "none" }], false), + dropdownDivider: [globalClassnames.dropdownDivider, { height: 1, backgroundColor: semanticColors.bodyDivider }], + dropdownDividerHidden: [globalClassnames.dropdownDivider, { display: "none" }], + dropdownOptionText: [ + globalClassnames.dropdownOptionText, + { + overflow: "hidden", + whiteSpace: "nowrap", + textOverflow: "ellipsis", + minWidth: 0, + maxWidth: "100%", + wordWrap: "break-word", + overflowWrap: "break-word", + margin: "1px" + } + ], + dropdownItemHeader: dropdownHeaderStyle, + dropdownItemHeaderHidden: __spreadArray(__spreadArray([], dropdownHeaderStyle, true), [{ display: "none" }], false), + subComponentStyles: { + label: { root: { display: "inline-block" } }, + multiSelectItem: { + root: { + padding: 0 + }, + label: { + alignSelf: "stretch", + padding: "0 8px", + width: "100%" + }, + input: { + selectors: (_l = {}, // eslint-disable-next-line @fluentui/max-len + _l[".".concat(IsFocusVisibleClassName, " &:focus + label::before, :host(.").concat(IsFocusVisibleClassName, ") &:focus + label::before")] = { + outlineOffset: "0px" + }, _l) + } + }, + panel: { + root: [panelClassName], + main: { + selectors: (_m = {}, // In case of extra small screen sizes + _m[MinimumScreenSelector] = { + // panelWidth xs + width: 272 + }, _m) + }, + contentInner: { padding: "0 0 20px" } + } + } }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bXa7Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>(0, _index.Dialog)); -var _index = require("./components/Dialog/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Dialog/index":"7FXbB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7FXbB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _dialog = require("./Dialog"); -parcelHelpers.exportAll(_dialog, exports); -var _dialogBase = require("./Dialog.base"); -parcelHelpers.exportAll(_dialogBase, exports); -var _dialogContent = require("./DialogContent"); -parcelHelpers.exportAll(_dialogContent, exports); -var _dialogContentBase = require("./DialogContent.base"); -parcelHelpers.exportAll(_dialogContentBase, exports); -var _dialogFooter = require("./DialogFooter"); -parcelHelpers.exportAll(_dialogFooter, exports); -var _dialogFooterBase = require("./DialogFooter.base"); -parcelHelpers.exportAll(_dialogFooterBase, exports); -var _dialogTypes = require("./Dialog.types"); -parcelHelpers.exportAll(_dialogTypes, exports); -var _dialogContentTypes = require("./DialogContent.types"); -parcelHelpers.exportAll(_dialogContentTypes, exports); -var _dialogFooterTypes = require("./DialogFooter.types"); -parcelHelpers.exportAll(_dialogFooterTypes, exports); - -},{"./Dialog":"efw5L","./Dialog.base":false,"./DialogContent":false,"./DialogContent.base":false,"./DialogFooter":"8shIu","./DialogFooter.base":false,"./Dialog.types":false,"./DialogContent.types":"lz1qp","./DialogFooter.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"efw5L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dialog", ()=>Dialog); -var _utilities = require("../../Utilities"); -var _dialogBase = require("./Dialog.base"); -var _dialogStyles = require("./Dialog.styles"); -var Dialog = (0, _utilities.styled)((0, _dialogBase.DialogBase), (0, _dialogStyles.getStyles), undefined, { - scope: 'Dialog' -}); -Dialog.displayName = 'Dialog'; - -},{"../../Utilities":"1NZCy","./Dialog.base":"fsCtu","./Dialog.styles":"73MTE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fsCtu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogBase", ()=>DialogBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _dialogContentTypes = require("./DialogContent.types"); -var _modal = require("../../Modal"); -var _responsiveMode = require("../../ResponsiveMode"); -var _dialogContent = require("./DialogContent"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DefaultModalProps = { - isDarkOverlay: false, - isBlocking: false, - className: '', - containerClassName: '', - topOffsetFixed: false, - enableAriaHiddenSiblings: true -}; -var DefaultDialogContentProps = { - type: (0, _dialogContentTypes.DialogType).normal, - className: '', - topButtonsProps: [] -}; -// eslint-disable-next-line deprecation/deprecation -var DialogBase = /** @class */ function(_super) { - (0, _tslib.__extends)(DialogBase, _super); - function DialogBase(props) { - var _this = _super.call(this, props) || this; - _this._getSubTextId = function() { - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, ariaDescribedById = _a.ariaDescribedById, modalProps = _a.modalProps, dialogContentProps = _a.dialogContentProps, subText = _a.subText; - var id = modalProps && modalProps.subtitleAriaId || ariaDescribedById; - if (!id) id = (dialogContentProps && dialogContentProps.subText || subText) && _this._defaultSubTextId; - return id; - }; - _this._getTitleTextId = function() { - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, ariaLabelledById = _a.ariaLabelledById, modalProps = _a.modalProps, dialogContentProps = _a.dialogContentProps, title = _a.title; - var id = modalProps && modalProps.titleAriaId || ariaLabelledById; - if (!id) id = (dialogContentProps && dialogContentProps.title || title) && _this._defaultTitleTextId; - return id; - }; - _this._id = (0, _utilities.getId)('Dialog'); - _this._defaultTitleTextId = _this._id + '-title'; - _this._defaultSubTextId = _this._id + '-subText'; - return _this; - } - DialogBase.prototype.render = function() { - var _a, _b, _c; - var props = this.props; - var /* eslint-disable deprecation/deprecation */ className = props.className, containerClassName = props.containerClassName, contentClassName = props.contentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, forceFocusInsideTrap = props.forceFocusInsideTrap, styles = props.styles, hidden = props.hidden, _d = props.disableRestoreFocus, disableRestoreFocus = _d === void 0 ? props.ignoreExternalFocusing : _d, isBlocking = props.isBlocking, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, _e = props.isOpen, isOpen = _e === void 0 ? !hidden : _e, onDismiss = props.onDismiss, onDismissed = props.onDismissed, onLayerDidMount = props.onLayerDidMount, responsiveMode = props.responsiveMode, subText = props.subText, theme = props.theme, title = props.title, topButtonsProps = props.topButtonsProps, type = props.type, /* eslint-enable deprecation/deprecation */ minWidth = props.minWidth, maxWidth = props.maxWidth, modalProps = props.modalProps; - var mergedLayerProps = (0, _tslib.__assign)({ - onLayerDidMount: onLayerDidMount - }, modalProps === null || modalProps === void 0 ? void 0 : modalProps.layerProps); - var dialogDraggableClassName; - var dragOptions; - // If dragOptions are provided, but no drag handle is specified, we supply a drag handle, - // and inform dialog contents to add class to draggable class to the header - if ((modalProps === null || modalProps === void 0 ? void 0 : modalProps.dragOptions) && !((_a = modalProps.dragOptions) === null || _a === void 0 ? void 0 : _a.dragHandleSelector)) { - // spread options to avoid mutating props - dragOptions = (0, _tslib.__assign)({}, modalProps.dragOptions); - dialogDraggableClassName = 'ms-Dialog-draggable-header'; - dragOptions.dragHandleSelector = ".".concat(dialogDraggableClassName); - } - var mergedModalProps = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, DefaultModalProps), { - elementToFocusOnDismiss: elementToFocusOnDismiss, - firstFocusableSelector: firstFocusableSelector, - forceFocusInsideTrap: forceFocusInsideTrap, - disableRestoreFocus: disableRestoreFocus, - isClickableOutsideFocusTrap: isClickableOutsideFocusTrap, - responsiveMode: responsiveMode, - className: className, - containerClassName: containerClassName, - isBlocking: isBlocking, - isDarkOverlay: isDarkOverlay, - onDismissed: onDismissed - }), modalProps), { - dragOptions: dragOptions, - layerProps: mergedLayerProps, - isOpen: isOpen - }); - var dialogContentProps = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({ - className: contentClassName, - subText: subText, - title: title, - topButtonsProps: topButtonsProps, - type: type - }, DefaultDialogContentProps), props.dialogContentProps), { - draggableHeaderClassName: dialogDraggableClassName, - titleProps: (0, _tslib.__assign)({ - // eslint-disable-next-line deprecation/deprecation - id: ((_b = props.dialogContentProps) === null || _b === void 0 ? void 0 : _b.titleId) || this._defaultTitleTextId - }, (_c = props.dialogContentProps) === null || _c === void 0 ? void 0 : _c.titleProps) - }); - var classNames = getClassNames(styles, { - theme: theme, - className: mergedModalProps.className, - containerClassName: mergedModalProps.containerClassName, - hidden: hidden, - dialogDefaultMinWidth: minWidth, - dialogDefaultMaxWidth: maxWidth - }); - return _react.createElement((0, _modal.Modal), (0, _tslib.__assign)({}, mergedModalProps, { - className: classNames.root, - containerClassName: classNames.main, - onDismiss: onDismiss || mergedModalProps.onDismiss, - subtitleAriaId: this._getSubTextId(), - titleAriaId: this._getTitleTextId() - }), _react.createElement((0, _dialogContent.DialogContent), (0, _tslib.__assign)({ - subTextId: this._defaultSubTextId, - showCloseButton: mergedModalProps.isBlocking, - onDismiss: onDismiss - }, dialogContentProps), props.children)); - }; - DialogBase.defaultProps = { - hidden: true + }; + var Dropdown = styled(DropdownBase, getStyles$4, void 0, { + scope: "Dropdown" + }); + Dropdown.displayName = "Dropdown"; + const fabricIconsWoff = "data:font/woff;base64,d09GRgABAAAAABuQAA4AAAAAMIgABKj2AAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABRAAAAEgAAABgMVN8b2NtYXAAAAGMAAABEAAAArIn/BeDY3Z0IAAAApwAAAAgAAAAKgnZCa9mcGdtAAACvAAAAPAAAAFZ/J7mjmdhc3AAAAOsAAAADAAAAAwACAAbZ2x5ZgAAA7gAABITAAAepM100RhoZWFkAAAVzAAAADIAAAA2BVACQGhoZWEAABYAAAAAFQAAACQQAQgDaG10eAAAFhgAAABQAAAAchoOED5sb2NhAAAWaAAAAHAAAABw0ZDZvG1heHAAABbYAAAAHQAAACAAWQIibmFtZQAAFvgAAAP3AAAJ+pKX8lVwb3N0AAAa8AAAABQAAAAg/1EArnByZXAAABsEAAAAiQAAANN4vfIOeJxjYGH/xDiBgZWBgXUWqzEDA6M0hGa+yJDGJMTBysrFyMQIBgxAIMCAAL7BCgoMDs95vzpzgPkQkgGsjgXCU2BgAAD3EghqeJxjYGBgZoBgGQZGIMnAuAbIYwTzWRgnAOkEBgcGVgaF57zP+Z8LPhd6Lvxc4rnMc6Xnvs8zn094PvX5sufLnx9+IfPC4cWUF9NeLH9x4sXvl6IvS17ufXnoFfNrjteX36x+s+bNqTen3zK9bXuX+W7m+/73Ez72fFz16dhnn8/Bn598Vfnq/P8/AwPYBgG4DYpYbJiEZEMxDhsy3s3AboPEF4nfEp8kvkp8lHgr8QoID0jMl6iTqJLIkciU8BN/K35ZvEm8UbxQPFBcXpxNbKVYolismJyohIi/cKVwuXCMcJSwqtAiwYOCkwXmC8zlW8zXxpvN85znPk8AtyDXZ0jo0RYwstHejsEOAFLcpEl4nGPQYghlKGBoYFjFyMDYwOzAeIDBAYsIEAAAqhwHlXicXY+/TsNADMZzJLSEJ0A6IZ11KkOViJ3phksk1CUlDOelgNRKpO+AlIXFA8/ibhnzYgjMEf4utr/P+ny/c6f5yXx2nKVHKilWnDfhoNQLDurtmf35IU/vNmVhTNV5VvdlwWoJomtOF/VNsGjI0PWWTG0eH7acLWKXxY7w0nDShk7qbQB2qL/HHeJVPJLFI4QS30/xfYxL+rUsVobTiyasA/des/OoAUzFYxN49BoQf8ikP3VnE+NsOWXbwE5zgkSfygL3RJqE+0uPf/Wgkv+G+23Iv6tB9U3c9Bb0h2HBgrChl2fbUAkaYPkOhPxkxgABAAIACAAK//8AD3icnVh7cFRVmj/ffaYREm46SedFwk2nuwkhCelOp8E86EQSeSwkBgapboMwCktQMrqKGEDngKPgBHFMZtx1YLWUCZY7o7vrc2uYXdupLXGmZsQdtsbaSu38oQKzs+Jzq5TOvSf7nXNvd5rglu509+3zuOfxnfO9ft9HJHKKEOV76j1EJjohMcM0AqZhnpL/YL0qvWqvIeo96e//UFlP8APECxf0S1oDUbHh80AM9PGE5bW8CXlca8CafClh7cZx+MnDL7kGxxWbht8wo6YRMfKIFadWXE5RxS3llBXH8Z+Tz/V5+jw+3gO6B0K4tgd8SlJ6MWGvs9clpBft9QnpJemlhEKuaNrrcQhupxCNaHpaT5MYuYscJsdx56KS4iKtWJUDmu5V5RrNXxP0ywFvMIRdLcFoS2s04FVbY9gVbo2ESyI4qMQX8EInRFuCoVhIbYSQN6Q3gr9G00O6Nx/0gO7Lh+KiEp/uC1SBT/bFqiASbo35YnInxNQYhKuk4qJ8yV/TKEVbOiVvuBPLRmznY3+VpH0BAPJT7N3S8pXs4NOeQg/+nmYHV5aXsnefAhmA2U9BHb6F72bewnfxLdQ9xY5IiiJ9uIl9Wt0VXPHOD31LfaVNpePvrAjGF7JPN33ovIWCq99CwSZrbP3DO9radjy8PlPGtq6qq1u1NeaWSu3/jxg79yDsP3Ev3DG73YdXkpr79ipSpV25ZPHSpjmEiZJIBH95RKOkkoSRtwYyM2Tmy/VgmKEYChdevM/shIieL+tmCDlndMIKMKtkXx6Jrz/UxAorNw6NdMVtSqlE410jQxsr4aOmQ+vjpTUVvrn2XQWV9w8M3F9ZID0y11dRU6oRi17X0XZzd61E4nGJ1Hbf3NZx3Whe6YLaovq+YcM6Zgz31RfVLijN4+KO9BGaR3SKWlTApR7pMiCqmk4lj9iE4aPTy6howJWNTtrEmpQDMpmkAZvYAWlSJviCylSnCiVeEiJtuNIsiTK/pg2kotFfVORvrHBLueLrOhSa0/hGJZ5XokBUqhPHbkDE8CNPDAlvF4+gkzTqI38yd+PYA5X0cN6BDoaKyqlr/OuvCQXxiyyLVUlKJNypoMYoXGN0s5ibDdSs1lhrbSTsK/GVKAR2J9huZWl///pjx15LnX3hmScfODTY1FOyf9GzH0DJ4/vPn/nJnnh8z0/OnN9/6H/OPReDOkaosahky/3fg8aTZ1OvHTumEXuSjSVgTEremTorutb3L49t3/5wz+M31Dz22Qtb+fwPDjhrrX7on++mEmEfLexYcF9yy7f5xkTYnMy58kkRqSD13OZoOqjchHCBBDQRHinQKIegU86YAT2PhJemJ+3DT6qBpQe6e/Ylo5d7dz3hV5azyamlsHpOQ3ygUWVljbXF5vK19cHlzUvKtH/sPoBznpRGcE44mtw3dY//iV3KtRBIXzPQOBBvmCO/V7akeXmwfu1ys7i2sSznzv1oEbkUKSglCtca4IYw2hKDRrRzncpsE6XGt7184uBN4fBNB0+8vO2+81utj73l5UGvPL9vo9O393cnkskTv9vrlnge0e1M29hnfeINlpd7ZWPr+fucvimSM1yUwoOQrL5wGq/jkoGuJ2b6VDNk6lj9OmsKYW7hxWla88iXRApQ6VUKEyxA7VcpC+iow7tOj/b3j57elSn7ju7s6Nh5tM8t7UfLg0htMOiILOWfKaLQ3Cm8tGjOJFHKVMzDh181TiV4FLzvajxNA2kmUbIcT+Q3OP0mP4Dhj5r8FBGusgugToqaYBpFJdhGT+Q3IuA+OqFVLb2LLLKot6UKBY9rHVCudxKxCFCGKjaFuyukPGgjyeA+Gk3H+RQ+WU1RmtFYSqdJOs5pTSm4gPMQTm5GRprJLWQvGSVPkZfIGS4tSpVUWFwk5UuKe/eKe+9uu7BTqvXOaKrCucE1N+JwTHG4M8syzW67pTsHuXvle3lWWyGPgPbB6QdXr37w9Acs/Uh0sKfOW1lT6a3r2dISbIu2tK9Zyvv4a1CP5doBp87vAsdF2taE+4/ubBdzsY/NNnFwfFaHNHvE9lnt87PaecSl8RGW5hTX9QxGm1e3t0Tbgi1bslQPRt0DfUlzyXTqfCUxrn3n0f7mtW0RnMv7VDLbGMNVPewqgz79DcYQGTIyXE/ayVrH9ywAoW2OGBsZdhiORHPuQZRbaYf/2AUtrTFETKaYZGpCIGsMs8Lg20yjSA9Go4O9i6aFm+ItmXKZzh6GtoXzSudZcd5QkBYuzHFlXlmJlRJkEz6bz3P0Qqa8PYVaa2flXaJyPLaldI6HN2xKAAGpV7PwXMGMJUQrHRI4z7XJrqNRlfjWF0/Qm8JD26zTCXll36bkiXf23D5x9OD1MIHIAT3E0N5R3QrfRE+8uPXh6W3WLxJyT9/ZO/a8cyLZdduRVQgtWHLZ0OC6WLXw5e59KljMc+2b1/SI0tDJZaokAxBgk6jTaKrUyXQgD2ECBC4nVbTglznmBoV4xRqcdrNRdmxfiQ99qGO/UX0UHxJvKmj5rj94dOJ2TsymPnllwjq9bcghdePo3qHtty7DS9LIqiO3dfFj3XG2Txxy2/TDzqGrY+sGh5bxg7o+W39Tf5PUkm7cOR83DqE/4wqJAF1HeB7jTs4HQa6bCHxjoAm6OIl4vc7l8in6m+aK6/rCNdXswXlzy5t7l7D77beONEjL2f0Nva/cMrAW9mvFwZgJx2LNzCifl8eKypYsaapYfluj9PTCGn1e4Rz47/JmtciMBYs19mCwf1HXri3fWgKH7DMNR6RlcKihd00Z7K+uae5bucK028rh4+ZYZXM5K55TOFc3F9o3N962rKKpYUkZfJiHbJABfY9OBHbRiIfzJWIgU0IGSgqFOAYndhUIACPjN02+UArtL75qHqIek88EDQUwjVGNFZfeczyJTSTP1EeSx4mbkIeX9EtXxzfyGAZM1u6EPGYNYxAlj2N8c0XTGsYhHEPBBnQyDXl877mEBFDpvDwAQ8oBEC422OP2eALOUTiHnkA+Zx+T/irBFqvPpW+E3zsYDBBX6tzgF3JJQm+EKuA3eMQnnK2GAyhbloS3JuhlqhJUS47vGJ0QnSj9NvpFalGUZi7XiHZxrWuIQXyuZKPDjngjoQB3a+LBhdGZMiIncenAxIRFpcA0sZOcYIayqBBlcioA6LgYficmgaRRgQBvUsSaAYw1L3EM6dwWSBSPKHlVbyI9DgFpOGF/pBYm0mMiNpVwpopfvOurMLNC+o4OtbcPHe3rH+XlqEpzGv38pVgDDpMy9aJ+ke8Z8PAIV1eHrTL54og1Jg+PYEVUrbER3K+MlGkj7liHn9LYiDyML+WLVlkZVnGKVWaVkTk8NhD3xTF9PWkiEcQ7bWQFYp7rr6Z2NsrxIiSQOb4uNjGeiJpe3EvSwRvCK/FBSE4NntzX27vv5GCm7L77xkjkxru7u/fcGA7fuOeQADUKcnIKbxnofvZpAubLTVCQYJ8kkzA/MfWXSfZJQiO5i/DSJji9O3c5mXMHV1IEUoLFOJl9av0bzoYCuSmJS1qVSVwf5U3lMqJ/iXgI8ac3XNspFUZbpFCVmsEVtYj4qwAcFCGFSpx+vUSh6BbfP/3Q6pVd9E9vPXNX5+qHTr+PvvT7LH0xtbK6Q64+cP7MyT3x/sfeRgNy6J/eY5cfo9AjET4OtEceBHLX/MTR1979/CC6X77QqsNv3KsoDL3syTPnDxyZ/o+/ixx/Zox9/PnZv91u0COc99xWc/2gIp5BGfKi9AZ46ObqKsoCKhDaZERZPASBMTacgHEYT7BhGMOIhId2lNsM8F7Rz/hYvA++Pse7UcRaIk7AQNXJJWCMioY1guyNoPPslGNOAgLDBrTwCBqLuU/FIAhjCBPlAQfz8XwFwEWKTX57eJeNaIU62qtXrtvUHKivDzRvWreyur0DdRl7F65cuylcu2SmV0Nt3rRqQWv5tckV5hQ1VySvLW9dsGpTtk+Z6dPJrl9tbljT0eIz2hYvbjN8LR1rGjb/ahel2N+0uj1carRf2W+TgXv9+RXeRUMjh3t7D48MLfJW5PvvHfjKXuFrdojYfhW5Ae+mSubqUA/RSFYTNN3xfHowoxVtUOzPAkhfpyzirRhPSqEz1AY3P3Fn1/UjJwfjcVcLugv9xpz19/zNxt5DuzeWrd2QUX48xM9Hb7hh9Oe7GpsW7TpwdHXyuUdvZ13IvnPsXGKcKtPampEnNw+eHLmeCm3A5RRl46ND7Yv/4rZuf8aOUL4CX8nT8e2ewLLtxywNmX8OGhJj0oQbKz6g2zrPifmEDSDI1UgmgAGfHtJDsVDMF/OpukAHIfzjih7SIWKCbqjZeAN+/H7i/czPfrkr/QOdxONpkpLQbMJ1yT+egq4fsVfsipSacqMbqzxnyvtxlVrzu7rkO1jydYQbhP1L8r9OsZR04Q170qWV5zIcWuswmrmS1pyMnoc3RJPTWuxHLTHMGUoljDzwh17V+jHsmMIlaYbMVJIdt0lKnpihMeEMBYJFnB1PIpUY6WRo7ErCDiCcQjkbt1SgbdkwO16pbZS+OkLBUDcTBTcqHDrNjihctP5/BhBOUmDwp4/v27x06eZ9j/90MKc+G/O7q1wB8TMZhdxFtYVXLeXWr8ydVDhx/Dc76Z91sj/3BDmxJNq3ElJOqoiJuDHkZER0nnAIgUg5IGQ0wwgSS8CUEQebXo/Ci5AJ/jxSYMULq6sLrXiBB2helaFQoyoPqMf6Efv9b6RfWg+w38Ktv7H/KO1mf4AP4Rb7WqkB668A3Mp+ayspX+EU9fkUWugrLJBovmHk27RAamR4ifyxqV0i/cm6U36Ul1TcLEo4zWI6HVsFaPt9eNc8ihf0cz/A0U3UFXMMasok08h8IfOgPqBRvSzwC6PC0WKc7j7gPhxSpUV2TCYzsk5cJbGzTfHQ3H8q8Mk5QtTn9bTAnjrIfi/3TurzCfYCjmM/S8AluKTNS8ANX1q6LtqMwyH4d6Kpf6/bYp7I28sRL6gbk8zLCpMwgJNhg7QuwbxwCdfSpS9tDjclEiZlOsdDqkCuHPirAr8qY9Zj8ndGODSS3xbYiFf1YYGNZlASrwkZRqykvz2zDhIdECCYD7AQKn3Hesyudaq4hn6Rw6YZACVqwkc7OSPicokIjOkHv+BEBCIZZqjIBZvey1acsbF2L7xxxsLL51hWF5ds4XVz0yQjInLYxP+FXZnJ4VZw3jvZW462xbo+PWunyVUp3UDywoXk+fPiPye72xpws7uTmZf472RGhV7nIYIuz0gbmDw36jfqJPxDfG4iwnNiU/FETYgF3EOiUE/CQII9j5KscHzBnk/AAJucOsfFIcA43KA8mGQvJKwNMh5cQlrdQRJx38CG9PPOGrganwQbEnww3g/XGYH1S1E/diLvPBjDGhzr84in2KOIEsNYK2Wl5Lj9qHSndGf6LL96lT9npj5jN8PTSj48/QP2FnsLllk72etyM3RZZ+Vm9rp1lvOUC7gevzKmwnUxuEGhp2pqKkWl9+wqR2dsHpR9IXlEWIUxUSa+Lhf+1Cz+qiRFbhLDdDIW1EmizM5GKKlssmJKvMLDf1XOQaHZpISdkkQCAumqJK36By5+nEPySTH2oAQhPzEschjpkUxuAbHBjWANfAbPavAzuxPIL1mH9K/syR54Fj6zdrNfTxOmw260gVot01H/v4WWUKFTZwzl13i/xNr7D8ryqVf1NcjUbfkGl3IjH3dOYdRKc+NaP+eR7OHxaTol4tqZ+JRHtqrH/oKHtiQvK4+yyFWUoQUMoEQ2O1qG0blehnYjYsgi2+qAAa7CesgrQBeganhkrhqSyDBiqMeOp1JSRSDj39nBJA+gkxMTyWm0ackJO3nqVHJaxNTYxLrG58GON6QkOn37AreRWSQRSIIYlZ4vpiRPyZ/gQiBM5bRYlGdY3Lh0ti2/i3yXjJK/Jifd06CMqbPKTH+gJBuLtUMslA/cd5XkxmfZpIdIXFbiwXMSIZFsMBeCcCvCeMSuiPFB/EdEzxX9OXVJpHZ5WEXdylSmomYq7JKXyx6XU/hFeW9gcd00yfbwcnEdkNlDYPaQ9AaXJZp7u8GpC25FyvSgtFE0jAjBULhQnZECGX0XRu7jdYszS2lztS3lld5pMtPFSy+Qq8bA7DH27gxvZzLpLFub4Tz5X7oQ0KMAeJxjYGRgYGBZ8W1igahBPL/NVwZuDgYQ2P/3YAOIvmfgdQZEczCAxTkZmEAUAE1pCdgAAHicY2BkYOBgAAE4yciACpgAAsoAHQAAAHicY9ViWMbBwCDMwMDwmYGNAQQamBoYYADIYmxgBNKMLEAWEDIIMwaDxYWZGhjbmSSBbFYgD6EDrIvxMuMVBiMGSTgfCBlkGA6AOACflgxrAAAAFgAqAEIAZAFUAaQByAIcAjICngLsAzwDpAP+BQYFcgWuBdAGDAZ6BpYGsgbUBvQHGgdMB2QHhgecB7IILAiECLQJQgm0CgoKWgrQCyQLgAvWC/IMDgwyDFYMhgy8DRANQA1eDaQN5g4EDmYPUnicY2BkYGAwZzjBwMsAAoxgkguEGSNBTAAdRwF9AAAAeJy1VD+LHDcUf3u79l1wfARDwKWKEM7HMmtfzJnY1WHHla85mwM3Ae2MdkZ4diQkjYcxLlK6yMdIY8inCAmkTJ1PkDpVyrz3pNnb827MJZAdRvPT0/v7e08LALdHX8II4u8rfCMewS3cRbwDu/BNwmOUP0t4gvjbhK/Bp2ATvg6fwduEd+Fr+D7hPfgcfkn4BhzC7wnfHP08miS8D4c7v2KU0eQT3BU7fyY8gi/G5wnvwP74TcJjlL9LeIL4x4Svwe3xbwlfBzH+I+FdcJO9hPfgcDL4uQEvJj8kfHP8bvJXwvvwYu+7n96Lo7v3HohTnTvjzSKIx8ZZ42TQpsnESV2LM11WwYsz5ZV7rYrsqZw7nYvTJ8+OxIn3KvgzVba1dJsHm5Jz5Tx6Fvez4+N4Sofx7LkqjRLaCymCk4VaSvdKmIUIlVrLr3SmtSTOzdLKRiufbU2+CsE+nM26rsuWw3mGNrPQW1M6aat+tjBN8LMLc99aW2tVCDrIxEvTiqXsResVJoGJkVgEI3KnZFBTUWhva9lPhWwKYZ3G0xxVFH6lF1a5pQ4B3c17LqLWuWrIFx54YdwAFhRhulmqdaZo8zAVxDzaTslmCKAb0VU6r9Yy6zCobvK6LbBNq+xNU/fiQN8RajnHXC7U0cPHsmX1QjelcMoH7BSxehGAzFe+HjEDBxqjBLWkFjiNUQvTNbWRxWX2ZKRKOSrHYChc22DbIApFZZJOpWp7mVEcxqZP6tQQdIj8VHquMefs6t2G9yDgCO7CPXiA6BQ05ODAgMd3AQFljxE5vPO0SpRoRA1keHICNT4CzlBWQoVnnncKvwq1X+NaoOZTtJvjnnxTjCf4z3LE9p41yY6sSmjRn0TNq1hcReec8/ApZwH3MZtjfNZtB8t1u+ecjcFVoA5VJfENzECB0iVn+QplxBKdVKy7jb+S9y0yOGjn+F3iXmJOmtnK/gXzxHNA6UOY4dPxk6G/D+2zFGeGuGcvJfux6KFH6YK9UbWzrdE952yxI5r7KFYW1PuXXJNgJnr8tsxdZCIyNmiTzHDVDjWoDgVT3BesZ7njPUuID4pjuTPRNk9eVNpL9m25r1Rz4DOymnMeQydqroishryihecuuA3JYlXD9Epdtbwv0CbH/ZT5ijMf405XcT6sQPMkdsxTjut2zrpUKWnnWE3Lc1ds5Z5sakYHqH8HvzSh88TLNu8xh//K7YX3gj2VKHM8xyHdqWFWt1UwRN/M69HaDFAlsZbA8YZbQP5jrQVKOq7c8K382OzJS1OluC8mrbGqiFu+WS1bUrZDNwc/pFnzTf7nGY3/jE3qzIX34YboxDLND+U7Z6Zjb/+Hu/03hsc4mgB4nGNgZgCD/34M5QyYwBwAKWEB/3ic28CgzbCJkZNJm3ETF4jcztWaG2qrysChvZ07NdhBTwbE4onwsNCQBLF4nc215YVBLD4dFRkRHhCLX05CmI8DxBLg4+FkZwGxBMEAxBLaMKEgwADIYtjOCDeaCW40M9xoFrjRrHCj2eQkoUazw43mgBvNCTd6kzAju/YGBgXX2kwJFwDEASgaAAAA"; + function initializeIcons$1() { + const subset = { + style: { + MozOsxFontSmoothing: "grayscale", + WebkitFontSmoothing: "antialiased", + fontStyle: "normal", + fontWeight: "normal", + speak: "none" + }, + fontFace: { + fontFamily: '"FabricMDL2Icons"', + src: `url("${fabricIconsWoff}") format("woff")` + }, + icons: { + Accept: "", + Add: "", + BIDashboard: "", + Camera: "", + Cancel: "", + ChevronDown: "", + ChevronLeftMed: "", + ChevronRightMed: "", + Clear: "", + ClearFilter: "", + ClearNight: "", + CloudDownload: "", + Color: "", + Copy: "", + CubeShape: "", + Delete: "", + Diamond: "", + DiamondSolid: "", + DoubleChevronLeft12: "", + DoubleChevronRight12: "", + Download: "", + Edit: "", + Filter: "", + Filters: "", + FiltersSolid: "", + Flow: "", + History: "", + HourGlass: "", + More: "", + Next: "", + OpenInNewWindow: "", + Page: "", + Pause: "", + Photo2Add: "", + Photo2Remove: "", + PicturePosition: "", + Pin: "", + Pinned: "", + PlayResume: "", + PlayReverseResume: "", + Previous: "", + RadioBtnOff: "", + RadioBtnOn: "", + RadioBullet: "", + Redo: "", + RemoveFilter: "", + ScaleVolume: "", + Search: "", + Settings: "", + SortDown: "", + SortUp: "", + Sunny: "", + Table: "", + Undo: "" + } }; - DialogBase = (0, _tslib.__decorate)([ - (0, _responsiveMode.withResponsiveMode) - ], DialogBase); - return DialogBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./DialogContent.types":"lz1qp","../../Modal":"7RBgT","../../ResponsiveMode":"cFpqz","./DialogContent":"7qNNV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lz1qp":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Dialog} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogType", ()=>DialogType); -var DialogType; -(function(DialogType) { - /** Standard dialog */ DialogType[DialogType["normal"] = 0] = "normal"; - /** Dialog with large header banner */ DialogType[DialogType["largeHeader"] = 1] = "largeHeader"; - /** Dialog with an 'x' close button in the upper-right corner */ DialogType[DialogType["close"] = 2] = "close"; -})(DialogType || (DialogType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7RBgT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>(0, _index.Modal)); -var _index = require("./components/Modal/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Modal/index":"bgO9e","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bgO9e":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _modal = require("./Modal"); -parcelHelpers.exportAll(_modal, exports); -var _modalBase = require("./Modal.base"); -parcelHelpers.exportAll(_modalBase, exports); -var _modalTypes = require("./Modal.types"); -parcelHelpers.exportAll(_modalTypes, exports); - -},{"./Modal":"ePfbY","./Modal.base":false,"./Modal.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ePfbY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Modal", ()=>Modal); -var _utilities = require("../../Utilities"); -var _modalBase = require("./Modal.base"); -var _modalStyles = require("./Modal.styles"); -var Modal = (0, _utilities.styled)((0, _modalBase.ModalBase), (0, _modalStyles.getStyles), undefined, { - scope: 'Modal', - fields: [ - 'theme', - 'styles', - 'enableAriaHiddenSiblings' - ] -}); -Modal.displayName = 'Modal'; - -},{"../../Utilities":"1NZCy","./Modal.base":"9JqAn","./Modal.styles":"kcVY7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9JqAn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ModalBase", ()=>ModalBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _focusTrapZone = require("../../FocusTrapZone"); -var _modalStyles = require("./Modal.styles"); -var _overlay = require("../../Overlay"); -var _layer = require("../../Layer"); -var _popup = require("../../Popup"); -var _responsiveMode = require("../../ResponsiveMode"); -var _directionalHint = require("../../common/DirectionalHint"); -var _icon = require("../../Icon"); -var _index = require("../../utilities/DraggableZone/index"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _reactHooks = require("@fluentui/react-hooks"); -var ZERO = { - x: 0, - y: 0 -}; -var DEFAULT_PROPS = { - isOpen: false, - isDarkOverlay: true, - className: '', - containerClassName: '', - enableAriaHiddenSiblings: true -}; -var getClassNames = (0, _utilities.classNamesFunction)(); -var getMoveDelta = function(ev) { - var delta = 10; - if (ev.shiftKey) { - if (!ev.ctrlKey) delta = 50; - } else if (ev.ctrlKey) delta = 1; - return delta; -}; -var useComponentRef = function(props, focusTrapZone) { - _react.useImperativeHandle(props.componentRef, function() { - return { - focus: function() { - if (focusTrapZone.current) focusTrapZone.current.focus(); - } - }; - }, [ - focusTrapZone - ]); -}; -var ModalBase = _react.forwardRef(function(propsWithoutDefaults, ref) { - var _a, _b, _c, _d, _e; - var props = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var allowTouchBodyScroll = props.allowTouchBodyScroll, className = props.className, children = props.children, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, focusTrapZoneProps = props.focusTrapZoneProps, forceFocusInsideTrap = props.forceFocusInsideTrap, // eslint-disable-next-line deprecation/deprecation - _f = props.disableRestoreFocus, // eslint-disable-next-line deprecation/deprecation - disableRestoreFocus = _f === void 0 ? props.ignoreExternalFocusing : _f, isBlocking = props.isBlocking, isAlert = props.isAlert, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, onDismiss = props.onDismiss, layerProps = props.layerProps, overlay = props.overlay, isOpen = props.isOpen, titleAriaId = props.titleAriaId, styles = props.styles, subtitleAriaId = props.subtitleAriaId, theme = props.theme, topOffsetFixed = props.topOffsetFixed, responsiveMode = props.responsiveMode, // eslint-disable-next-line deprecation/deprecation - onLayerDidMount = props.onLayerDidMount, isModeless = props.isModeless, dragOptions = props.dragOptions, onDismissed = props.onDismissed, // eslint-disable-next-line deprecation/deprecation - enableAriaHiddenSiblings = props.enableAriaHiddenSiblings, popupProps = props.popupProps; - var rootRef = _react.useRef(null); - var focusTrapZone = _react.useRef(null); - var focusTrapZoneRef = (0, _reactHooks.useMergedRefs)(focusTrapZone, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.componentRef); - var focusTrapZoneElm = _react.useRef(null); - var mergedRef = (0, _reactHooks.useMergedRefs)(rootRef, ref); - var modalResponsiveMode = (0, _responsiveMode.useResponsiveMode)(mergedRef); - var focusTrapZoneId = (0, _reactHooks.useId)('ModalFocusTrapZone', focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.id); - var win = (0, _reactWindowProvider.useWindow)(); - var _g = (0, _reactHooks.useSetTimeout)(), setTimeout = _g.setTimeout, clearTimeout = _g.clearTimeout; - var _h = _react.useState(isOpen), isModalOpen = _h[0], setIsModalOpen = _h[1]; - var _j = _react.useState(isOpen), isVisible = _j[0], setIsVisible = _j[1]; - var _k = _react.useState(ZERO), coordinates = _k[0], setCoordinates = _k[1]; - var _l = _react.useState(), modalRectangleTop = _l[0], setModalRectangleTop = _l[1]; - var _m = (0, _reactHooks.useBoolean)(false), isModalMenuOpen = _m[0], _o = _m[1], toggleModalMenuOpen = _o.toggle, setModalMenuClose = _o.setFalse; - var internalState = (0, _reactHooks.useConst)(function() { - return { - onModalCloseTimer: 0, - allowTouchBodyScroll: allowTouchBodyScroll, - scrollableContent: null, - lastSetCoordinates: ZERO, - events: new (0, _utilities.EventGroup)({}) - }; + return subset; + } + let registerIcons; + let unregisterIcons; + function initializeIcons() { + [initializeIcons$1].forEach((initialize2) => { + const subset = initialize2(); + unregisterIcons && unregisterIcons(Object.keys(subset.icons)); + registerIcons(subset, { + disableWarnings: true + }); }); - var keepInBounds = (dragOptions || {}).keepInBounds; - var isAlertRole = isAlert !== null && isAlert !== void 0 ? isAlert : isBlocking && !isModeless; - var layerClassName = layerProps === undefined ? '' : layerProps.className; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - containerClassName: containerClassName, - scrollableContentClassName: scrollableContentClassName, - isOpen: isOpen, - isVisible: isVisible, - hasBeenOpened: internalState.hasBeenOpened, - modalRectangleTop: modalRectangleTop, - topOffsetFixed: topOffsetFixed, - isModeless: isModeless, - layerClassName: layerClassName, - windowInnerHeight: win === null || win === void 0 ? void 0 : win.innerHeight, - isDefaultDragHandle: dragOptions && !dragOptions.dragHandleSelector + } + function use(_registerIcons, _unregisterIcons) { + registerIcons = _registerIcons; + unregisterIcons = _unregisterIcons; + } + var ONKEYDOWN_TIMEOUT_DURATION = 1e3; + var getClassNames$3 = classNamesFunction(); + var getSlotStyleFn = function(sty) { + return function(value2) { + var _a2; + return _a2 = {}, _a2[sty] = "".concat(value2, "%"), _a2; + }; + }; + var getPercent = function(value2, sliderMin, sliderMax) { + return sliderMax === sliderMin ? 0 : (value2 - sliderMin) / (sliderMax - sliderMin) * 100; + }; + var useComponentRef$1 = function(props, sliderBoxRef, value2, range2) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + get value() { + return value2; + }, + get range() { + return range2; + }, + focus: function() { + var _a2; + (_a2 = sliderBoxRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + } + }; + }, [range2, sliderBoxRef, value2]); + }; + var useSlider = function(props, ref2) { + var _a2 = props.step, step = _a2 === void 0 ? 1 : _a2, className2 = props.className, _b2 = props.disabled, disabled = _b2 === void 0 ? false : _b2, label2 = props.label, _c2 = props.max, max2 = _c2 === void 0 ? 10 : _c2, _d2 = props.min, min2 = _d2 === void 0 ? 0 : _d2, _e2 = props.showValue, showValue = _e2 === void 0 ? true : _e2, _f = props.buttonProps, buttonProps = _f === void 0 ? {} : _f, _g = props.vertical, vertical = _g === void 0 ? false : _g, snapToStep = props.snapToStep, valueFormat = props.valueFormat, styles = props.styles, theme = props.theme, originFromZero = props.originFromZero, ariaLabelledBy = props["aria-labelledby"], _h = props.ariaLabel, ariaLabel2 = _h === void 0 ? props["aria-label"] : _h, ranged = props.ranged, onChange = props.onChange, onChanged = props.onChanged; + var disposables = React__namespace.useRef([]); + var _j = useSetTimeout(), setTimeout2 = _j.setTimeout, clearTimeout2 = _j.clearTimeout; + var sliderLine = React__namespace.useRef(null); + var win = useWindowEx(); + var _k = useControllableValue(props.value, props.defaultValue, function(ev, v) { + return onChange === null || onChange === void 0 ? void 0 : onChange(v, ranged ? [internalState.latestLowerValue, v] : void 0, ev); + }), unclampedValue = _k[0], setValue = _k[1]; + var _l = useControllableValue(props.lowerValue, props.defaultLowerValue, function(ev, lv) { + return onChange === null || onChange === void 0 ? void 0 : onChange(internalState.latestValue, [lv, internalState.latestValue], ev); + }), unclampedLowerValue = _l[0], setLowerValue = _l[1]; + var value2 = Math.max(min2, Math.min(max2, unclampedValue || 0)); + var lowerValue = Math.max(min2, Math.min(value2, unclampedLowerValue || 0)); + var internalState = useConst({ + onKeyDownTimer: -1, + isAdjustingLowerValue: false, + latestValue: value2, + latestLowerValue: lowerValue }); - var mergedLayerProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - eventBubblingEnabled: false - }, layerProps), { - onLayerDidMount: layerProps && layerProps.onLayerDidMount ? layerProps.onLayerDidMount : onLayerDidMount, - insertFirst: (layerProps === null || layerProps === void 0 ? void 0 : layerProps.insertFirst) || isModeless, - className: classNames.layer + internalState.latestValue = value2; + internalState.latestLowerValue = lowerValue; + var id2 = useId("Slider", props.id || (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.id)); + var classNames2 = getClassNames$3(styles, { + className: className2, + disabled, + vertical, + showTransitions: !snapToStep && !internalState.isBetweenSteps, + showValue, + ranged, + theme }); - // Allow the user to scroll within the modal but not on the body - var allowScrollOnModal = _react.useCallback(function(elt) { - if (elt) { - if (internalState.allowTouchBodyScroll) (0, _utilities.allowOverscrollOnElement)(elt, internalState.events); - else (0, _utilities.allowScrollOnElement)(elt, internalState.events); - } else internalState.events.off(internalState.scrollableContent); - internalState.scrollableContent = elt; - }, [ - internalState - ]); - var registerInitialModalPosition = function() { - var dialogMain = focusTrapZoneElm.current; - var modalRectangle = dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect(); - if (modalRectangle) { - if (topOffsetFixed) setModalRectangleTop(modalRectangle.top); - if (keepInBounds) { - // x/y are unavailable in IE, so use the equivalent left/top - internalState.minPosition = { - x: -modalRectangle.left, - y: -modalRectangle.top - }; - internalState.maxPosition = { - x: modalRectangle.left, - y: modalRectangle.top - }; - } + var steps = (max2 - min2) / step; + var clearOnKeyDownTimer = function() { + clearTimeout2(internalState.onKeyDownTimer); + internalState.onKeyDownTimer = -1; + }; + var setOnKeyDownTimer = function(event2) { + clearOnKeyDownTimer(); + if (onChanged) { + internalState.onKeyDownTimer = setTimeout2(function() { + onChanged(event2, internalState.latestValue, ranged ? [internalState.latestLowerValue, internalState.latestValue] : void 0); + }, ONKEYDOWN_TIMEOUT_DURATION); + } + }; + var getAriaValueText = function(valueProps) { + var ariaValueText = props.ariaValueText; + if (valueProps !== void 0) { + return ariaValueText ? ariaValueText(valueProps) : valueProps.toString(); + } + return void 0; + }; + var updateValue = function(ev, newValue, newUnroundedValue) { + newValue = Math.min(max2, Math.max(min2, newValue)); + newUnroundedValue = newUnroundedValue !== void 0 ? Math.min(max2, Math.max(min2, newUnroundedValue)) : void 0; + var numDec = 0; + if (isFinite(step)) { + while (Math.round(step * Math.pow(10, numDec)) / Math.pow(10, numDec) !== step) { + numDec++; } + } + var roundedValue = parseFloat(newValue.toFixed(numDec)); + internalState.isBetweenSteps = newUnroundedValue !== void 0 && newUnroundedValue !== roundedValue; + if (ranged) { + if (internalState.isAdjustingLowerValue && (originFromZero ? roundedValue <= 0 : roundedValue <= internalState.latestValue)) { + setLowerValue(roundedValue, ev); + } else if (!internalState.isAdjustingLowerValue && (originFromZero ? roundedValue >= 0 : roundedValue >= internalState.latestLowerValue)) { + setValue(roundedValue, ev); + } + } else { + setValue(roundedValue, ev); + } }; - /** - * Clamps an axis to a specified min and max position. - * - * @param axis A string that represents the axis (x/y). - * @param position The position on the axis. - */ var getClampedAxis = _react.useCallback(function(axis, position) { - var minPosition = internalState.minPosition, maxPosition = internalState.maxPosition; - if (keepInBounds && minPosition && maxPosition) { - position = Math.max(minPosition[axis], position); - position = Math.min(maxPosition[axis], position); - } - return position; - }, [ - keepInBounds, - internalState - ]); - var handleModalClose = function() { - var _a; - internalState.lastSetCoordinates = ZERO; - setModalMenuClose(); - internalState.isInKeyboardMoveMode = false; - setIsModalOpen(false); - setCoordinates(ZERO); - (_a = internalState.disposeOnKeyUp) === null || _a === void 0 || _a.call(internalState); - onDismissed === null || onDismissed === void 0 || onDismissed(); - }; - var handleDragStart = _react.useCallback(function() { - setModalMenuClose(); - internalState.isInKeyboardMoveMode = false; - }, [ - internalState, - setModalMenuClose - ]); - var handleDrag = _react.useCallback(function(ev, dragData) { - setCoordinates(function(prevValue) { - return { - x: getClampedAxis('x', prevValue.x + dragData.delta.x), - y: getClampedAxis('y', prevValue.y + dragData.delta.y) - }; - }); - }, [ - getClampedAxis - ]); - var handleDragStop = _react.useCallback(function() { - if (focusTrapZone.current) focusTrapZone.current.focus(); - }, []); - var handleEnterKeyboardMoveMode = function() { - // We need a global handleKeyDown event when we are in the move mode so that we can - // handle the key presses and the components inside the modal do not get the events - var handleKeyDown = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if (ev.altKey && ev.ctrlKey && ev.keyCode === (0, _utilities.KeyCodes).space) { - // CTRL + ALT + SPACE is handled during keyUp - ev.preventDefault(); - ev.stopPropagation(); - return; - } - // eslint-disable-next-line deprecation/deprecation - var newLocal = ev.altKey || ev.keyCode === (0, _utilities.KeyCodes).escape; - if (isModalMenuOpen && newLocal) setModalMenuClose(); - // eslint-disable-next-line deprecation/deprecation - if (internalState.isInKeyboardMoveMode && (ev.keyCode === (0, _utilities.KeyCodes).escape || ev.keyCode === (0, _utilities.KeyCodes).enter)) { - internalState.isInKeyboardMoveMode = false; - ev.preventDefault(); - ev.stopPropagation(); - } - if (internalState.isInKeyboardMoveMode) { - var handledEvent = true; - var delta_1 = getMoveDelta(ev); - // eslint-disable-next-line deprecation/deprecation - switch(ev.keyCode){ - /* eslint-disable no-fallthrough */ case (0, _utilities.KeyCodes).escape: - setCoordinates(internalState.lastSetCoordinates); - case (0, _utilities.KeyCodes).enter: - // TODO: determine if fallthrough was intentional - /* eslint-enable no-fallthrough */ internalState.lastSetCoordinates = ZERO; - break; - case (0, _utilities.KeyCodes).up: - setCoordinates(function(prevValue) { - return { - x: prevValue.x, - y: getClampedAxis('y', prevValue.y - delta_1) - }; - }); - break; - case (0, _utilities.KeyCodes).down: - setCoordinates(function(prevValue) { - return { - x: prevValue.x, - y: getClampedAxis('y', prevValue.y + delta_1) - }; - }); - break; - case (0, _utilities.KeyCodes).left: - setCoordinates(function(prevValue) { - return { - x: getClampedAxis('x', prevValue.x - delta_1), - y: prevValue.y - }; - }); - break; - case (0, _utilities.KeyCodes).right: - setCoordinates(function(prevValue) { - return { - x: getClampedAxis('x', prevValue.x + delta_1), - y: prevValue.y - }; - }); - break; - default: - handledEvent = false; - } - if (handledEvent) { - ev.preventDefault(); - ev.stopPropagation(); - } - } - }; - internalState.lastSetCoordinates = coordinates; - setModalMenuClose(); - internalState.isInKeyboardMoveMode = true; - internalState.events.on(win, 'keydown', handleKeyDown, true); - internalState.disposeOnKeyDown = function() { - internalState.events.off(win, 'keydown', handleKeyDown, true); - internalState.disposeOnKeyDown = undefined; - }; + var onKeyDown = function(event2) { + var newCurrentValue = internalState.isAdjustingLowerValue ? internalState.latestLowerValue : internalState.latestValue; + var diff = 0; + switch (event2.which) { + case getRTLSafeKeyCode(KeyCodes.left, props.theme): + case KeyCodes.down: + diff = -step; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + case getRTLSafeKeyCode(KeyCodes.right, props.theme): + case KeyCodes.up: + diff = step; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + case KeyCodes.home: + newCurrentValue = min2; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + case KeyCodes.end: + newCurrentValue = max2; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + default: + return; + } + updateValue(event2, newCurrentValue + diff); + event2.preventDefault(); + event2.stopPropagation(); + }; + var getPosition2 = function(event2, verticalProp) { + var currentPosition = 0; + switch (event2.type) { + case "mousedown": + case "mousemove": + currentPosition = !verticalProp ? event2.clientX : event2.clientY; + break; + case "touchstart": + case "touchmove": + currentPosition = !verticalProp ? event2.touches[0].clientX : event2.touches[0].clientY; + break; + } + return currentPosition; + }; + var calculateCurrentSteps = function(event2) { + var sliderPositionRect = sliderLine.current.getBoundingClientRect(); + var sliderLength = !props.vertical ? sliderPositionRect.width : sliderPositionRect.height; + var stepLength = sliderLength / steps; + var currentSteps; + var distance2; + if (!props.vertical) { + var left = getPosition2(event2, props.vertical); + distance2 = getRTL(props.theme) ? sliderPositionRect.right - left : left - sliderPositionRect.left; + currentSteps = distance2 / stepLength; + } else { + var bottom = getPosition2(event2, props.vertical); + distance2 = sliderPositionRect.bottom - bottom; + currentSteps = distance2 / stepLength; + } + return currentSteps; + }; + var onMouseMoveOrTouchMove = function(event2, suppressEventCancelation) { + var currentSteps = calculateCurrentSteps(event2); + var newUnroundedValue = min2 + step * currentSteps; + var newCurrentValue = min2 + step * Math.round(currentSteps); + updateValue(event2, newCurrentValue, newUnroundedValue); + if (!suppressEventCancelation) { + event2.preventDefault(); + event2.stopPropagation(); + } }; - var handleExitKeyboardMoveMode = function(ev) { - var _a, _b; - (_a = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.onBlur) === null || _a === void 0 || _a.call(focusTrapZoneProps, ev); - internalState.lastSetCoordinates = ZERO; - internalState.isInKeyboardMoveMode = false; - (_b = internalState.disposeOnKeyDown) === null || _b === void 0 || _b.call(internalState); + var onMouseDownOrTouchStart = function(event2) { + if (ranged) { + var currentSteps = calculateCurrentSteps(event2); + var newValue = min2 + step * currentSteps; + internalState.isAdjustingLowerValue = newValue <= internalState.latestLowerValue || newValue - internalState.latestLowerValue <= internalState.latestValue - newValue; + } + if (event2.type === "mousedown") { + disposables.current.push(on$1(win, "mousemove", onMouseMoveOrTouchMove, true), on$1(win, "mouseup", onMouseUpOrTouchEnd, true)); + } else if (event2.type === "touchstart") { + disposables.current.push(on$1(win, "touchmove", onMouseMoveOrTouchMove, true), on$1(win, "touchend", onMouseUpOrTouchEnd, true)); + } + onMouseMoveOrTouchMove(event2, true); }; - var registerForKeyUp = function() { - var handleKeyUp = function(ev) { - // Needs to handle the CTRL + ALT + SPACE key during keyup due to FireFox bug: - // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143 - // eslint-disable-next-line deprecation/deprecation - if (ev.altKey && ev.ctrlKey && ev.keyCode === (0, _utilities.KeyCodes).space) { - if ((0, _utilities.elementContains)(internalState.scrollableContent, ev.target)) { - toggleModalMenuOpen(); - ev.preventDefault(); - ev.stopPropagation(); - } - } - }; - if (!internalState.disposeOnKeyUp) { - internalState.events.on(win, 'keyup', handleKeyUp, true); - internalState.disposeOnKeyUp = function() { - internalState.events.off(win, 'keyup', handleKeyUp, true); - internalState.disposeOnKeyUp = undefined; - }; - } + var onMouseUpOrTouchEnd = function(event2) { + internalState.isBetweenSteps = void 0; + onChanged === null || onChanged === void 0 ? void 0 : onChanged(event2, internalState.latestValue, ranged ? [internalState.latestLowerValue, internalState.latestValue] : void 0); + disposeListeners(); }; - _react.useEffect(function() { - clearTimeout(internalState.onModalCloseTimer); - // Opening the dialog - if (isOpen) { - // This must be done after the modal content has rendered - requestAnimationFrame(function() { - return setTimeout(registerInitialModalPosition, 0); - }); - setIsModalOpen(true); - // Add a keyUp handler for all key up events once the dialog is open. - if (dragOptions) registerForKeyUp(); - internalState.hasBeenOpened = true; - setIsVisible(true); - } - // Closing the dialog - if (!isOpen && isModalOpen) { - internalState.onModalCloseTimer = setTimeout(handleModalClose, parseFloat((0, _modalStyles.animationDuration)) * 1000); - setIsVisible(false); - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run if isModalOpen or isOpen mutates. - }, [ - isModalOpen, - isOpen - ]); - (0, _reactHooks.useUnmount)(function() { - internalState.events.dispose(); - if (internalState.onModalCloseTimer) { - clearTimeout(internalState.onModalCloseTimer); - internalState.onModalCloseTimer = 0; - } - }); - useComponentRef(props, focusTrapZone); - useDebugWarnings(props); - var modalContent = _react.createElement((0, _focusTrapZone.FocusTrapZone), (0, _tslib.__assign)({}, focusTrapZoneProps, { - id: focusTrapZoneId, - ref: focusTrapZoneElm, - componentRef: focusTrapZoneRef, - className: (0, _utilities.css)(classNames.main, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.className), - elementToFocusOnDismiss: (_a = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.elementToFocusOnDismiss) !== null && _a !== void 0 ? _a : elementToFocusOnDismiss, - isClickableOutsideFocusTrap: (_b = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.isClickableOutsideFocusTrap) !== null && _b !== void 0 ? _b : isModeless || isClickableOutsideFocusTrap || !isBlocking, - disableRestoreFocus: (_c = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.disableRestoreFocus) !== null && _c !== void 0 ? _c : disableRestoreFocus, - forceFocusInsideTrap: ((_d = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.forceFocusInsideTrap) !== null && _d !== void 0 ? _d : forceFocusInsideTrap) && !isModeless, - // eslint-disable-next-line deprecation/deprecation - firstFocusableSelector: (focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.firstFocusableSelector) || firstFocusableSelector, - focusPreviouslyFocusedInnerElement: (_e = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.focusPreviouslyFocusedInnerElement) !== null && _e !== void 0 ? _e : true, - onBlur: internalState.isInKeyboardMoveMode ? handleExitKeyboardMoveMode : undefined - }), dragOptions && internalState.isInKeyboardMoveMode && _react.createElement("div", { - className: classNames.keyboardMoveIconContainer - }, dragOptions.keyboardMoveIconProps ? _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({}, dragOptions.keyboardMoveIconProps)) : _react.createElement((0, _icon.Icon), { - iconName: "move", - className: classNames.keyboardMoveIcon - })), _react.createElement("div", { - ref: allowScrollOnModal, - className: classNames.scrollableContent, - "data-is-scrollable": true - }, dragOptions && isModalMenuOpen && _react.createElement(dragOptions.menu, { - items: [ - { - key: 'move', - text: dragOptions.moveMenuItemText, - onClick: handleEnterKeyboardMoveMode - }, - { - key: 'close', - text: dragOptions.closeMenuItemText, - onClick: handleModalClose - } - ], - onDismiss: setModalMenuClose, - alignTargetEdge: true, - coverTarget: true, - directionalHint: (0, _directionalHint.DirectionalHint).topLeftEdge, - directionalHintFixed: true, - shouldFocusOnMount: true, - target: internalState.scrollableContent - }), children)); - return isModalOpen && modalResponsiveMode >= (responsiveMode || (0, _responsiveMode.ResponsiveMode).small) && _react.createElement((0, _layer.Layer), (0, _tslib.__assign)({ - ref: mergedRef - }, mergedLayerProps), _react.createElement((0, _popup.Popup), (0, _tslib.__assign)({ - role: isAlertRole ? 'alertdialog' : 'dialog', - ariaLabelledBy: titleAriaId, - ariaDescribedBy: subtitleAriaId, - onDismiss: onDismiss, - shouldRestoreFocus: !disableRestoreFocus, - // Modeless modals shouldn't hide siblings. - // Popup will automatically handle this based on the aria-modal setting. - enableAriaHiddenSiblings: enableAriaHiddenSiblings, - "aria-modal": !isModeless - }, popupProps), _react.createElement("div", { - className: classNames.root, - role: !isModeless ? 'document' : undefined - }, !isModeless && _react.createElement((0, _overlay.Overlay), (0, _tslib.__assign)({ - "aria-hidden": true, - isDarkThemed: isDarkOverlay, - onClick: isBlocking ? undefined : onDismiss, - allowTouchBodyScroll: allowTouchBodyScroll - }, overlay)), dragOptions ? _react.createElement((0, _index.DraggableZone), { - handleSelector: dragOptions.dragHandleSelector || "#".concat(focusTrapZoneId), - preventDragSelector: "button", - onStart: handleDragStart, - onDragChange: handleDrag, - onStop: handleDragStop, - position: coordinates - }, modalContent) : modalContent))) || null; -}); -ModalBase.displayName = 'Modal'; -function useDebugWarnings(props) {} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../FocusTrapZone":"5R7BQ","./Modal.styles":"kcVY7","../../Overlay":"eCuPP","../../Layer":"hQjxQ","../../Popup":"bOJlv","../../ResponsiveMode":"cFpqz","../../common/DirectionalHint":"avdAc","../../Icon":"hiMUP","../../utilities/DraggableZone/index":"gcdmd","@fluentui/react-window-provider":"iP8C0","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5R7BQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/FocusTrapZone/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/FocusTrapZone/index":"dzHmS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dzHmS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _focusTrapZone = require("./FocusTrapZone"); -parcelHelpers.exportAll(_focusTrapZone, exports); -var _focusTrapZoneTypes = require("./FocusTrapZone.types"); -parcelHelpers.exportAll(_focusTrapZoneTypes, exports); - -},{"./FocusTrapZone":"hqYwI","./FocusTrapZone.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hqYwI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusTrapZone", ()=>FocusTrapZone); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _windowProvider = require("../../WindowProvider"); -var _dom = require("../../utilities/dom"); -var COMPONENT_NAME = 'FocusTrapZone'; -var DEFAULT_PROPS = { - disabled: false, - disableFirstFocus: false, - forceFocusInsideTrap: true, - isClickableOutsideFocusTrap: false, - // Hardcoding completely uncontrolled flag for proper interop with FluentUI V9. - 'data-tabster': '{"uncontrolled": {"completely": true}}' -}; -var useComponentRef = function(componentRef, previouslyFocusedElement, focusFTZ) { - _react.useImperativeHandle(componentRef, function() { - return { - get previouslyFocusedElement () { - return previouslyFocusedElement; - }, - focus: focusFTZ - }; - }, [ - focusFTZ, - previouslyFocusedElement - ]); -}; -var FocusTrapZone = _react.forwardRef(function(propsWithoutDefaults, ref) { - var _a; - var root = _react.useRef(null); - var firstBumper = _react.useRef(null); - var lastBumper = _react.useRef(null); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(root, ref); - var doc = (0, _windowProvider.useDocument)(); - var win = (0, _dom.useWindowEx)(); - var inShadow = (0, _utilities.useHasMergeStylesShadowRootContext)(); - var isFirstRender = (_a = (0, _reactHooks.usePrevious)(false)) !== null && _a !== void 0 ? _a : true; - var props = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var internalState = (0, _reactHooks.useConst)({ - hasFocus: false, - focusStackId: (0, _reactHooks.useId)('ftz-', props.id) - }); - var children = props.children, componentRef = props.componentRef, disabled = props.disabled, disableFirstFocus = props.disableFirstFocus, forceFocusInsideTrap = props.forceFocusInsideTrap, focusPreviouslyFocusedInnerElement = props.focusPreviouslyFocusedInnerElement, // eslint-disable-next-line deprecation/deprecation - firstFocusableSelector = props.firstFocusableSelector, firstFocusableTarget = props.firstFocusableTarget, // eslint-disable-next-line deprecation/deprecation - _b = props.disableRestoreFocus, // eslint-disable-next-line deprecation/deprecation - disableRestoreFocus = _b === void 0 ? props.ignoreExternalFocusing : _b, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, enableAriaHiddenSiblings = props.enableAriaHiddenSiblings; - var bumperProps = { - 'aria-hidden': true, - style: { - pointerEvents: 'none', - position: 'fixed' - }, - tabIndex: disabled ? -1 : 0, - 'data-is-visible': true, - 'data-is-focus-trap-zone-bumper': true + var onThumbFocus = function(event2) { + internalState.isAdjustingLowerValue = event2.target === lowerValueThumbRef.current; }; - var focusElementAsync = _react.useCallback(function(element) { - if (element !== firstBumper.current && element !== lastBumper.current) (0, _utilities.focusAsync)(element); + var disposeListeners = React__namespace.useCallback(function() { + disposables.current.forEach(function(dispose) { + return dispose(); + }); + disposables.current = []; }, []); - /** - * Callback to force focus into FTZ (named to avoid overlap with global focus() callback). - * useEventCallback always returns the same callback reference but updates the implementation - * every render to avoid stale captured values. - */ var focusFTZ = (0, _reactHooks.useEventCallback)(function() { - if (!root.current) return; // not done mounting - var previouslyFocusedElementInTrapZone = internalState.previouslyFocusedElementInTrapZone; - if (focusPreviouslyFocusedInnerElement && previouslyFocusedElementInTrapZone && (0, _utilities.elementContains)(root.current, previouslyFocusedElementInTrapZone)) { - // focus on the last item that had focus in the zone before we left the zone - focusElementAsync(previouslyFocusedElementInTrapZone); - return; + React__namespace.useEffect(function() { + return disposeListeners; + }, [disposeListeners]); + var lowerValueThumbRef = React__namespace.useRef(null); + var thumbRef = React__namespace.useRef(null); + var sliderBoxRef = React__namespace.useRef(null); + useComponentRef$1(props, sliderBoxRef, value2, ranged ? [lowerValue, value2] : void 0); + var getPositionStyles = getSlotStyleFn(vertical ? "bottom" : getRTL(props.theme) ? "right" : "left"); + var getTrackStyles = getSlotStyleFn(vertical ? "height" : "width"); + var originValue = originFromZero ? 0 : min2; + var valuePercent = getPercent(value2, min2, max2); + var lowerValuePercent = getPercent(lowerValue, min2, max2); + var originPercentOfLine = getPercent(originValue, min2, max2); + var activeSectionWidth = ranged ? valuePercent - lowerValuePercent : Math.abs(originPercentOfLine - valuePercent); + var topSectionWidth = Math.min(100 - valuePercent, 100 - originPercentOfLine); + var bottomSectionWidth = ranged ? lowerValuePercent : Math.min(valuePercent, originPercentOfLine); + var rootProps = { + className: classNames2.root, + ref: ref2 + }; + var labelProps = { + className: classNames2.titleLabel, + children: label2, + disabled, + htmlFor: ariaLabel2 ? void 0 : id2 + }; + var valueLabelProps = showValue ? { + className: classNames2.valueLabel, + children: valueFormat ? valueFormat(value2) : value2, + disabled, + htmlFor: disabled ? id2 : void 0 + } : void 0; + var lowerValueLabelProps = ranged && showValue ? { + className: classNames2.valueLabel, + children: valueFormat ? valueFormat(lowerValue) : lowerValue, + disabled + } : void 0; + var zeroTickProps = originFromZero ? { + className: classNames2.zeroTick, + style: getPositionStyles(originPercentOfLine) + } : void 0; + var trackActiveProps = { + className: css(classNames2.lineContainer, classNames2.activeSection), + style: getTrackStyles(activeSectionWidth) + }; + var trackTopInactiveProps = { + className: css(classNames2.lineContainer, classNames2.inactiveSection), + style: getTrackStyles(topSectionWidth) + }; + var trackBottomInactiveProps = { + className: css(classNames2.lineContainer, classNames2.inactiveSection), + style: getTrackStyles(bottomSectionWidth) + }; + var sliderProps = __assign$1({ "aria-disabled": disabled, role: "slider", tabIndex: disabled ? void 0 : 0 }, { "data-is-focusable": !disabled }); + var sliderBoxProps = __assign$1(__assign$1(__assign$1({ id: id2, className: css(classNames2.slideBox, buttonProps.className), ref: sliderBoxRef }, !disabled && { + onMouseDown: onMouseDownOrTouchStart, + onTouchStart: onMouseDownOrTouchStart, + onKeyDown + }), buttonProps && getNativeProps(buttonProps, divProperties, ["id", "className"])), !ranged && __assign$1(__assign$1({}, sliderProps), { "aria-valuemin": min2, "aria-valuemax": max2, "aria-valuenow": value2, "aria-valuetext": getAriaValueText(value2), "aria-label": ariaLabel2 || label2, "aria-labelledby": ariaLabelledBy })); + var onFocusProp = disabled ? {} : { onFocus: onThumbFocus }; + var thumbProps = __assign$1({ ref: thumbRef, className: classNames2.thumb, style: getPositionStyles(valuePercent) }, ranged && __assign$1(__assign$1(__assign$1({}, sliderProps), onFocusProp), { id: "max-".concat(id2), "aria-valuemin": lowerValue, "aria-valuemax": max2, "aria-valuenow": value2, "aria-valuetext": getAriaValueText(value2), "aria-label": "max ".concat(ariaLabel2 || label2) })); + var lowerValueThumbProps = ranged ? __assign$1(__assign$1(__assign$1({ ref: lowerValueThumbRef, className: classNames2.thumb, style: getPositionStyles(lowerValuePercent) }, sliderProps), onFocusProp), { id: "min-".concat(id2), "aria-valuemin": min2, "aria-valuemax": value2, "aria-valuenow": lowerValue, "aria-valuetext": getAriaValueText(lowerValue), "aria-label": "min ".concat(ariaLabel2 || label2) }) : void 0; + var containerProps = { + className: classNames2.container + }; + var sliderLineProps = { + ref: sliderLine, + className: classNames2.line + }; + return { + root: rootProps, + label: labelProps, + sliderBox: sliderBoxProps, + container: containerProps, + valueLabel: valueLabelProps, + lowerValueLabel: lowerValueLabelProps, + thumb: thumbProps, + lowerValueThumb: lowerValueThumbProps, + zeroTick: zeroTickProps, + activeTrack: trackActiveProps, + topInactiveTrack: trackTopInactiveProps, + bottomInactiveTrack: trackBottomInactiveProps, + sliderLine: sliderLineProps + }; + }; + var COMPONENT_NAME$2 = "SliderBase"; + var SliderBase = React__namespace.forwardRef(function(props, ref2) { + var slotProps = useSlider(props, ref2); + return React__namespace.createElement( + "div", + __assign$1({}, slotProps.root), + slotProps && React__namespace.createElement(Label$2, __assign$1({}, slotProps.label)), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.container), + props.ranged && (props.vertical ? slotProps.valueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.valueLabel)) : slotProps.lowerValueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.lowerValueLabel))), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.sliderBox), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.sliderLine), + props.ranged && React__namespace.createElement("span", __assign$1({}, slotProps.lowerValueThumb)), + React__namespace.createElement("span", __assign$1({}, slotProps.thumb)), + slotProps.zeroTick && React__namespace.createElement("span", __assign$1({}, slotProps.zeroTick)), + React__namespace.createElement("span", __assign$1({}, slotProps.bottomInactiveTrack)), + React__namespace.createElement("span", __assign$1({}, slotProps.activeTrack)), + React__namespace.createElement("span", __assign$1({}, slotProps.topInactiveTrack)) + ) + ), + props.ranged && props.vertical ? slotProps.lowerValueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.lowerValueLabel)) : slotProps.valueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.valueLabel)) + ), + React__namespace.createElement(FocusRects, null) + ); + }); + SliderBase.displayName = COMPONENT_NAME$2; + var GlobalClassNames$1 = { + root: "ms-Slider", + enabled: "ms-Slider-enabled", + disabled: "ms-Slider-disabled", + row: "ms-Slider-row", + column: "ms-Slider-column", + container: "ms-Slider-container", + slideBox: "ms-Slider-slideBox", + line: "ms-Slider-line", + thumb: "ms-Slider-thumb", + activeSection: "ms-Slider-active", + inactiveSection: "ms-Slider-inactive", + valueLabel: "ms-Slider-value", + showValue: "ms-Slider-showValue", + showTransitions: "ms-Slider-showTransitions", + zeroTick: "ms-Slider-zeroTick" + }; + var getStyles$3 = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o; + var className2 = props.className, titleLabelClassName = props.titleLabelClassName, theme = props.theme, vertical = props.vertical, disabled = props.disabled, showTransitions = props.showTransitions, showValue = props.showValue, ranged = props.ranged; + var semanticColors = theme.semanticColors, palette = theme.palette; + var classNames2 = getGlobalClassNames(GlobalClassNames$1, theme); + var pressedActiveSectionColor = semanticColors.inputBackgroundCheckedHovered; + var hoveredActiveSectionColor = semanticColors.inputBackgroundChecked; + var hoveredPressedinactiveSectionColor = palette.neutralSecondaryAlt; + var restActiveSectionColor = palette.neutralPrimary; + var restInactiveSectionColor = palette.neutralSecondaryAlt; + var disabledActiveSectionColor = semanticColors.disabledText; + var disabledInactiveSectionColor = semanticColors.disabledBackground; + var thumbBackgroundColor = semanticColors.inputBackground; + var thumbBorderColor = semanticColors.smallInputBorder; + var thumbDisabledBorderColor = semanticColors.disabledBorder; + var slideBoxActiveSectionStyles = !disabled && { + backgroundColor: pressedActiveSectionColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _a2) + }; + var slideBoxInactiveSectionStyles = !disabled && { + backgroundColor: hoveredPressedinactiveSectionColor, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "Highlight" + }, _b2) + }; + var slideHoverSectionStyles = !disabled && { + backgroundColor: hoveredActiveSectionColor, + selectors: (_c2 = {}, _c2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _c2) + }; + var slideBoxActiveThumbStyles = !disabled && { + border: "2px solid ".concat(pressedActiveSectionColor), + selectors: (_d2 = {}, _d2[HighContrastSelector] = { + borderColor: "Highlight" + }, _d2) + }; + var slideBoxActiveZeroTickStyles = !props.disabled && { + backgroundColor: semanticColors.inputPlaceholderBackgroundChecked, + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _e2) + }; + return { + root: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([ + classNames2.root, + theme.fonts.medium, + { + userSelect: "none" + }, + vertical && { + marginRight: 8 } - var firstFocusableChild = null; - if (typeof firstFocusableTarget === 'string') firstFocusableChild = root.current.querySelector(firstFocusableTarget); - else if (firstFocusableTarget) firstFocusableChild = firstFocusableTarget(root.current); - else if (firstFocusableSelector) { - var focusSelector = typeof firstFocusableSelector === 'string' ? firstFocusableSelector : firstFocusableSelector(); - firstFocusableChild = root.current.querySelector('.' + focusSelector); + ], [!disabled ? classNames2.enabled : void 0], false), [disabled ? classNames2.disabled : void 0], false), [!vertical ? classNames2.row : void 0], false), [vertical ? classNames2.column : void 0], false), [ + className2 + ], false), + titleLabel: [ + { + padding: 0 + }, + titleLabelClassName + ], + container: [ + classNames2.container, + { + display: "flex", + flexWrap: "nowrap", + alignItems: "center" + }, + vertical && { + flexDirection: "column", + height: "100%", + textAlign: "center", + margin: "8px 0" + } + ], + slideBox: __spreadArray(__spreadArray([ + classNames2.slideBox, + !ranged && getFocusStyle(theme), + { + background: "transparent", + border: "none", + flexGrow: 1, + lineHeight: 28, + display: "flex", + alignItems: "center", + selectors: (_f = {}, _f[":active .".concat(classNames2.activeSection)] = slideBoxActiveSectionStyles, _f[":hover .".concat(classNames2.activeSection)] = slideHoverSectionStyles, _f[":active .".concat(classNames2.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":hover .".concat(classNames2.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":active .".concat(classNames2.thumb)] = slideBoxActiveThumbStyles, _f[":hover .".concat(classNames2.thumb)] = slideBoxActiveThumbStyles, _f[":active .".concat(classNames2.zeroTick)] = slideBoxActiveZeroTickStyles, _f[":hover .".concat(classNames2.zeroTick)] = slideBoxActiveZeroTickStyles, _f[HighContrastSelector] = { + forcedColorAdjust: "none" + }, _f) + }, + vertical ? { + height: "100%", + width: 28, + padding: "8px 0" + // Make room for thumb at bottom of line + } : { + height: 28, + width: "auto", + padding: "0 8px" + // Make room for thumb at ends of line + } + ], [showValue ? classNames2.showValue : void 0], false), [showTransitions ? classNames2.showTransitions : void 0], false), + thumb: [ + classNames2.thumb, + ranged && getFocusStyle(theme, { inset: -4 }), + { + borderWidth: 2, + borderStyle: "solid", + borderColor: thumbBorderColor, + borderRadius: 10, + boxSizing: "border-box", + background: thumbBackgroundColor, + display: "block", + width: 16, + height: 16, + position: "absolute" + }, + vertical ? { + left: -6, + margin: "0 auto", + transform: "translateY(8px)" + } : { + top: -6, + transform: getRTL(theme) ? "translateX(50%)" : "translateX(-50%)" + }, + showTransitions && { + transition: "left ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction1) + }, + disabled && { + borderColor: thumbDisabledBorderColor, + selectors: (_g = {}, _g[HighContrastSelector] = { + borderColor: "GrayText" + }, _g) + } + ], + line: [ + classNames2.line, + { + display: "flex", + position: "relative" + }, + vertical ? { + height: "100%", + width: 4, + margin: "0 auto", + flexDirection: "column-reverse" + } : { + width: "100%" } - // Fall back to first element if query selector did not match any elements. - if (!firstFocusableChild) firstFocusableChild = (0, _utilities.getNextElement)(root.current, root.current.firstChild, false, false, false, true, undefined, undefined, undefined, inShadow); - if (firstFocusableChild) focusElementAsync(firstFocusableChild); - }); - /** Used in root div focus/blur handlers */ var focusBumper = function(isFirstBumper) { - if (disabled || !root.current) return; - var nextFocusable = isFirstBumper === internalState.hasFocus ? (0, _utilities.getLastTabbable)(root.current, lastBumper.current, true, false, inShadow) : (0, _utilities.getFirstTabbable)(root.current, firstBumper.current, true, false, inShadow); - if (nextFocusable) { - if (nextFocusable === firstBumper.current || nextFocusable === lastBumper.current) // This can happen when FTZ contains no tabbable elements. - // focusFTZ() will take care of finding a focusable element in FTZ. - focusFTZ(); - else nextFocusable.focus(); - } - }; - /** Root div blur handler (doesn't need useCallback since it's for a native element) */ var onRootBlurCapture = function(ev) { - var _a; - (_a = props.onBlurCapture) === null || _a === void 0 || _a.call(props, ev); - var relatedTarget = ev.relatedTarget; - if (ev.relatedTarget === null) // In IE11, due to lack of support, event.relatedTarget is always - // null making every onBlur call to be "outside" of the root - // even when it's not. Using document.activeElement is another way - // for us to be able to get what the relatedTarget without relying - // on the event - relatedTarget = (0, _utilities.getActiveElement)(doc); - if (!(0, _utilities.elementContains)(root.current, relatedTarget)) internalState.hasFocus = false; - }; - /** Root div focus handler (doesn't need useCallback since it's for a native element) */ var onRootFocusCapture = function(ev) { - var _a; - (_a = props.onFocusCapture) === null || _a === void 0 || _a.call(props, ev); - if (ev.target === firstBumper.current) focusBumper(true); - else if (ev.target === lastBumper.current) focusBumper(false); - internalState.hasFocus = true; - if (ev.target !== ev.currentTarget && !(ev.target === firstBumper.current || ev.target === lastBumper.current)) // every time focus changes within the trap zone, remember the focused element so that - // it can be restored if focus leaves the pane and returns via keystroke (i.e. via a call to this.focus(true)) - internalState.previouslyFocusedElementInTrapZone = (0, _utilities.getEventTarget)(ev.nativeEvent); - }; - /** Called to restore focus on unmount or props change. (useEventCallback ensures latest prop values are used.) */ var returnFocusToInitiator = (0, _reactHooks.useEventCallback)(function(elementToFocusOnDismiss) { - FocusTrapZone.focusStack = FocusTrapZone.focusStack.filter(function(value) { - return internalState.focusStackId !== value; - }); - if (!doc) return; - // Do not use getActiveElement() here. - // When the FTZ is in shadow DOM focus returns to the - // shadow host rather than body so we need to be - // able to inspect that - var activeElement = doc.activeElement; - if (!disableRestoreFocus && typeof (elementToFocusOnDismiss === null || elementToFocusOnDismiss === void 0 ? void 0 : elementToFocusOnDismiss.focus) === 'function' && // only restore focus if the current focused element is within the FTZ, or if nothing is focused - ((0, _utilities.elementContains)(root.current, activeElement) || activeElement === doc.body || activeElement.shadowRoot)) focusElementAsync(elementToFocusOnDismiss); - }); - /** Called in window event handlers. (useEventCallback ensures latest prop values are used.) */ var forceFocusOrClickInTrap = (0, _reactHooks.useEventCallback)(function(ev) { - // be sure to use the latest values here - if (disabled) return; - if (internalState.focusStackId === FocusTrapZone.focusStack.slice(-1)[0]) { - var targetElement = (0, _utilities.getEventTarget)(ev); - if (targetElement && !(0, _utilities.elementContains)(root.current, targetElement)) { - if (doc && (0, _utilities.getActiveElement)(doc) === doc.body) setTimeout(function() { - if (doc && (0, _utilities.getActiveElement)(doc) === doc.body) { - focusFTZ(); - internalState.hasFocus = true; // set focus here since we stop event propagation - } - }, 0); - else { - focusFTZ(); - internalState.hasFocus = true; // set focus here since we stop event propagation - } - ev.preventDefault(); - ev.stopPropagation(); - } + ], + lineContainer: [ + { + borderRadius: 4, + boxSizing: "border-box" + }, + vertical ? { + width: 4, + height: "100%" + } : { + height: 4, + width: "100%" } - }); - // Update window event handlers when relevant props change - _react.useEffect(function() { - var disposables = []; - if (forceFocusInsideTrap) disposables.push((0, _utilities.on)(win, 'focus', forceFocusOrClickInTrap, true)); - if (!isClickableOutsideFocusTrap) disposables.push((0, _utilities.on)(win, 'click', forceFocusOrClickInTrap, true)); - return function() { - disposables.forEach(function(dispose) { - return dispose(); - }); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run when these two props change - }, [ - forceFocusInsideTrap, - isClickableOutsideFocusTrap, - win - ]); - // On prop change or first render, focus the FTZ and update focusStack if appropriate - _react.useEffect(function() { - // Do nothing if disabled, or if it's a re-render and forceFocusInsideTrap is false - // (to match existing behavior, the FTZ handles first focus even if forceFocusInsideTrap - // is false, though it's debatable whether it should do this) - if (disabled || !isFirstRender && !forceFocusInsideTrap || !root.current) return; - // Transition from forceFocusInsideTrap / FTZ disabled to enabled (or initial mount) - FocusTrapZone.focusStack.push(internalState.focusStackId); - var elementToFocusOnDismiss = props.elementToFocusOnDismiss || (0, _utilities.getActiveElement)(doc); - if (!disableFirstFocus && !(0, _utilities.elementContains)(root.current, elementToFocusOnDismiss)) focusFTZ(); - // To match existing behavior, always return focus on cleanup (even if we didn't handle - // initial focus), but it's debatable whether that's correct - return function() { - return returnFocusToInitiator(elementToFocusOnDismiss); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run when these two props change - }, [ - forceFocusInsideTrap, - disabled - ]); - // Handle modalization separately from first focus - _react.useEffect(function() { - if (!disabled && enableAriaHiddenSiblings) { - var unmodalize = (0, _utilities.modalize)(root.current); - return unmodalize; + ], + activeSection: [ + classNames2.activeSection, + { + background: restActiveSectionColor, + selectors: (_h = {}, _h[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _h) + }, + showTransitions && { + transition: "width ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction1) + }, + disabled && { + background: disabledActiveSectionColor, + selectors: (_j = {}, _j[HighContrastSelector] = { + backgroundColor: "GrayText", + borderColor: "GrayText" + }, _j) + } + ], + inactiveSection: [ + classNames2.inactiveSection, + { + background: restInactiveSectionColor, + selectors: (_k = {}, _k[HighContrastSelector] = { + border: "1px solid WindowText" + }, _k) + }, + showTransitions && { + transition: "width ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction1) + }, + disabled && { + background: disabledInactiveSectionColor, + selectors: (_l = {}, _l[HighContrastSelector] = { + borderColor: "GrayText" + }, _l) + } + ], + zeroTick: [ + classNames2.zeroTick, + { + position: "absolute", + background: semanticColors.disabledBorder, + selectors: (_m = {}, _m[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _m) + }, + props.disabled && { + background: semanticColors.disabledBackground, + selectors: (_o = {}, _o[HighContrastSelector] = { + backgroundColor: "GrayText" + }, _o) + }, + props.vertical ? { + width: "16px", + height: "1px", + transform: getRTL(theme) ? "translateX(6px)" : "translateX(-6px)" + } : { + width: "1px", + height: "16px", + transform: "translateY(-6px)" } - }, [ - disabled, - enableAriaHiddenSiblings, - root - ]); - // Cleanup lifecyle method for internalState. - (0, _reactHooks.useUnmount)(function() { - // Dispose of element references so the DOM Nodes can be garbage-collected - delete internalState.previouslyFocusedElementInTrapZone; + ], + valueLabel: [ + classNames2.valueLabel, + { + flexShrink: 1, + width: 30, + lineHeight: "1" + // using a string here meaning it's relative to the size of the font + }, + vertical ? { + margin: "0 auto", + whiteSpace: "nowrap", + width: 40 + } : { + margin: "0 8px", + whiteSpace: "nowrap", + width: 40 + } + ] + }; + }; + var Slider = styled(SliderBase, getStyles$3, void 0, { + scope: "Slider" + }); + var SpinnerSize; + (function(SpinnerSize2) { + SpinnerSize2[SpinnerSize2["xSmall"] = 0] = "xSmall"; + SpinnerSize2[SpinnerSize2["small"] = 1] = "small"; + SpinnerSize2[SpinnerSize2["medium"] = 2] = "medium"; + SpinnerSize2[SpinnerSize2["large"] = 3] = "large"; + })(SpinnerSize || (SpinnerSize = {})); + var SpinnerType; + (function(SpinnerType2) { + SpinnerType2[SpinnerType2["normal"] = 0] = "normal"; + SpinnerType2[SpinnerType2["large"] = 1] = "large"; + })(SpinnerType || (SpinnerType = {})); + var getClassNames$2 = classNamesFunction(); + var SpinnerBase = ( + /** @class */ + (function(_super) { + __extends(SpinnerBase2, _super); + function SpinnerBase2() { + return _super !== null && _super.apply(this, arguments) || this; + } + SpinnerBase2.prototype.render = function() { + var _a2 = this.props, type2 = _a2.type, size = _a2.size, ariaLabel2 = _a2.ariaLabel, ariaLive = _a2.ariaLive, styles = _a2.styles, label2 = _a2.label, theme = _a2.theme, className2 = _a2.className, labelPosition = _a2.labelPosition; + var statusMessage = ariaLabel2; + var nativeProps = getNativeProps(this.props, divProperties, ["size"]); + var styleSize = size; + if (styleSize === void 0 && type2 !== void 0) { + styleSize = type2 === SpinnerType.large ? SpinnerSize.large : SpinnerSize.medium; + } + var classNames2 = getClassNames$2(styles, { + theme, + size: styleSize, + className: className2, + labelPosition + }); + return React__namespace.createElement( + "div", + __assign$1({}, nativeProps, { className: classNames2.root }), + React__namespace.createElement("div", { className: classNames2.circle }), + label2 && React__namespace.createElement("div", { className: classNames2.label }, label2), + statusMessage && React__namespace.createElement( + "div", + { role: "status", "aria-live": ariaLive }, + React__namespace.createElement( + DelayedRender, + null, + React__namespace.createElement("div", { className: classNames2.screenReaderText }, statusMessage) + ) + ) + ); + }; + SpinnerBase2.defaultProps = { + size: SpinnerSize.medium, + ariaLive: "polite", + labelPosition: "bottom" + }; + return SpinnerBase2; + })(React__namespace.Component) + ); + var GlobalClassNames = { + root: "ms-Spinner", + circle: "ms-Spinner-circle", + label: "ms-Spinner-label" + }; + var spinAnimation = memoizeFunction(function() { + return keyframes({ + "0%": { + transform: "rotate(0deg)" + }, + "100%": { + transform: "rotate(360deg)" + } }); - useComponentRef(componentRef, internalState.previouslyFocusedElementInTrapZone, focusFTZ); - return _react.createElement("div", (0, _tslib.__assign)({ - "aria-labelledby": props.ariaLabelledBy - }, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)), { - ref: mergedRootRef, - onFocusCapture: onRootFocusCapture, - onBlurCapture: onRootBlurCapture - }), _react.createElement("div", (0, _tslib.__assign)({}, bumperProps, { - ref: firstBumper - })), children, _react.createElement("div", (0, _tslib.__assign)({}, bumperProps, { - ref: lastBumper - }))); -}); -FocusTrapZone.displayName = COMPONENT_NAME; -FocusTrapZone.focusStack = []; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@fluentui/react-hooks":"2LHjM","../../WindowProvider":"diLL7","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kcVY7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "animationDuration", ()=>animationDuration); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var animationDuration = (0, _styling.AnimationVariables).durationValue2; -var globalClassNames = { - root: 'ms-Modal', - main: 'ms-Dialog-main', - scrollableContent: 'ms-Modal-scrollableContent', - isOpen: 'is-open', - layer: 'ms-Modal-Layer' -}; -var getStyles = function(props) { - var _a; - var className = props.className, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, isOpen = props.isOpen, isVisible = props.isVisible, hasBeenOpened = props.hasBeenOpened, modalRectangleTop = props.modalRectangleTop, theme = props.theme, topOffsetFixed = props.topOffsetFixed, isModeless = props.isModeless, layerClassName = props.layerClassName, isDefaultDragHandle = props.isDefaultDragHandle, windowInnerHeight = props.windowInnerHeight; - var palette = theme.palette, effects = theme.effects, fonts = theme.fonts; - var classNames = (0, _styling.getGlobalClassNames)(globalClassNames, theme); + }); + var getStyles$2 = function(props) { + var _a2; + var theme = props.theme, size = props.size, className2 = props.className, labelPosition = props.labelPosition; + var palette = theme.palette; + var classNames2 = getGlobalClassNames(GlobalClassNames, theme); return { - root: [ - classNames.root, - fonts.medium, - { - backgroundColor: 'transparent', - position: 'fixed', - height: '100%', - width: '100%', - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - opacity: 0, - pointerEvents: 'none', - transition: "opacity ".concat(animationDuration) - }, - topOffsetFixed && typeof modalRectangleTop === 'number' && hasBeenOpened && { - alignItems: 'flex-start' - }, - isOpen && classNames.isOpen, - isVisible && { - opacity: 1 - }, - isVisible && !isModeless && { - pointerEvents: 'auto' - }, - className - ], - main: [ - classNames.main, - { - boxShadow: effects.elevation64, - borderRadius: effects.roundedCorner2, - backgroundColor: palette.white, - boxSizing: 'border-box', - position: 'relative', - textAlign: 'left', - outline: '3px solid transparent', - maxHeight: 'calc(100% - 32px)', - maxWidth: 'calc(100% - 32px)', - minHeight: '176px', - minWidth: '288px', - overflowY: 'auto', - zIndex: isModeless ? (0, _styling.ZIndexes).Layer : undefined - }, - isModeless && { - pointerEvents: 'auto' - }, - topOffsetFixed && typeof modalRectangleTop === 'number' && hasBeenOpened && { - top: modalRectangleTop - }, - isDefaultDragHandle && { - cursor: 'move' - }, - containerClassName + root: [ + classNames2.root, + { + display: "flex", + flexDirection: "column", + alignItems: "center", + justifyContent: "center" + }, + labelPosition === "top" && { + flexDirection: "column-reverse" + }, + labelPosition === "right" && { + flexDirection: "row" + }, + labelPosition === "left" && { + flexDirection: "row-reverse" + }, + className2 + ], + circle: [ + classNames2.circle, + { + boxSizing: "border-box", + borderRadius: "50%", + borderWidth: "1.5px", + borderStyle: "solid", + borderTopColor: palette.themePrimary, + borderRightColor: palette.themeLight, + borderBottomColor: palette.themeLight, + borderLeftColor: palette.themeLight, + animationName: spinAnimation(), + animationDuration: "1.3s", + animationIterationCount: "infinite", + animationTimingFunction: "cubic-bezier(.53,.21,.29,.67)", + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ borderTopColor: "Highlight" }, getHighContrastNoAdjustStyle()), _a2) + }, + size === SpinnerSize.xSmall && [ + "ms-Spinner--xSmall", + { + width: 12, + height: 12 + } ], - scrollableContent: [ - classNames.scrollableContent, - { - overflowY: 'auto', - flexGrow: 1, - maxHeight: '100vh', - selectors: (_a = {}, _a['@supports (-webkit-overflow-scrolling: touch)'] = { - maxHeight: windowInnerHeight - }, _a) - }, - scrollableContentClassName + size === SpinnerSize.small && [ + "ms-Spinner--small", + { + width: 16, + height: 16 + } ], - layer: isModeless && [ - layerClassName, - classNames.layer, - { - pointerEvents: 'none' - } + size === SpinnerSize.medium && [ + "ms-Spinner--medium", + { + width: 20, + height: 20 + } ], - keyboardMoveIconContainer: { - position: 'absolute', - display: 'flex', - justifyContent: 'center', - width: '100%', - padding: '3px 0px' - }, - keyboardMoveIcon: { - // eslint-disable-next-line deprecation/deprecation - fontSize: fonts.xLargePlus.fontSize, - width: '24px' - } - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eCuPP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Overlay/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Overlay/index":"fluGv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fluGv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _overlay = require("./Overlay"); -parcelHelpers.exportAll(_overlay, exports); -var _overlayBase = require("./Overlay.base"); -parcelHelpers.exportAll(_overlayBase, exports); -var _overlayTypes = require("./Overlay.types"); -parcelHelpers.exportAll(_overlayTypes, exports); - -},{"./Overlay":"fMVXG","./Overlay.base":false,"./Overlay.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fMVXG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Overlay", ()=>Overlay); -var _utilities = require("../../Utilities"); -var _overlayBase = require("./Overlay.base"); -var _overlayStyles = require("./Overlay.styles"); -var Overlay = (0, _utilities.styled)((0, _overlayBase.OverlayBase), (0, _overlayStyles.getStyles), undefined, { - scope: 'Overlay' -}); - -},{"../../Utilities":"1NZCy","./Overlay.base":"3Jzwk","./Overlay.styles":"fMY1q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Jzwk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverlayBase", ()=>OverlayBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var OverlayBase = /** @class */ function(_super) { - (0, _tslib.__extends)(OverlayBase, _super); - function OverlayBase(props) { - var _this = _super.call(this, props) || this; - (0, _utilities.initializeComponentRef)(_this); - var _a = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a === void 0 ? false : _a; - _this._allowTouchBodyScroll = allowTouchBodyScroll; - return _this; - } - OverlayBase.prototype.componentDidMount = function() { - !this._allowTouchBodyScroll && (0, _utilities.disableBodyScroll)(); - }; - OverlayBase.prototype.componentWillUnmount = function() { - !this._allowTouchBodyScroll && (0, _utilities.enableBodyScroll)(); - }; - OverlayBase.prototype.render = function() { - var _a = this.props, isDark = _a.isDarkThemed, className = _a.className, theme = _a.theme, styles = _a.styles; - var divProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - isDark: isDark - }); - return _react.createElement("div", (0, _tslib.__assign)({}, divProps, { - className: classNames.root - })); - }; - return OverlayBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fMY1q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-Overlay', - rootDark: 'ms-Overlay--dark' -}; -var getStyles = function(props) { - var _a; - var className = props.className, theme = props.theme, isNone = props.isNone, isDark = props.isDark; - var palette = theme.palette; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - root: [ - classNames.root, - theme.fonts.medium, - { - backgroundColor: palette.whiteTranslucent40, - top: 0, - right: 0, - bottom: 0, - left: 0, - position: 'absolute', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - border: '1px solid WindowText', - opacity: 0 - }, _a) - }, - isNone && { - visibility: 'hidden' - }, - isDark && [ - classNames.rootDark, - { - backgroundColor: palette.blackTranslucent40 - } - ], - className + size === SpinnerSize.large && [ + "ms-Spinner--large", + { + width: 28, + height: 28 + } ] + ], + label: [ + classNames2.label, + theme.fonts.small, + { + color: palette.themePrimary, + margin: "8px 0 0", + textAlign: "center" + }, + labelPosition === "top" && { + margin: "0 0 8px" + }, + labelPosition === "right" && { + margin: "0 0 0 8px" + }, + labelPosition === "left" && { + margin: "0 8px 0 0" + } + ], + screenReaderText: hiddenContentStyle }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gcdmd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _draggableZone = require("./DraggableZone"); -parcelHelpers.exportAll(_draggableZone, exports); -var _draggableZoneTypes = require("./DraggableZone.types"); -parcelHelpers.exportAll(_draggableZoneTypes, exports); -var _draggableZoneStyles = require("./DraggableZone.styles"); -parcelHelpers.exportAll(_draggableZoneStyles, exports); - -},{"./DraggableZone":"kP7CU","./DraggableZone.types":false,"./DraggableZone.styles":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kP7CU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DraggableZone", ()=>DraggableZone); -var _tslib = require("tslib"); -var _react = require("react"); -var _draggableZoneStyles = require("./DraggableZone.styles"); -var _utilities = require("../../Utilities"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../dom"); -var eventMapping = { - touch: { - start: 'touchstart', - move: 'touchmove', - stop: 'touchend' - }, - mouse: { - start: 'mousedown', - move: 'mousemove', - stop: 'mouseup' - } -}; -var DraggableZone = /** @class */ function(_super) { - (0, _tslib.__extends)(DraggableZone, _super); - function DraggableZone(props) { + }; + var Spinner = styled(SpinnerBase, getStyles$2, void 0, { scope: "Spinner" }); + var getClassNames$1 = classNamesFunction(); + var DEFAULT_STATE_VALUE = ""; + var COMPONENT_NAME$1 = "TextField"; + var REVEAL_ICON_NAME = "RedEye"; + var HIDE_ICON_NAME = "Hide"; + var TextFieldBase = ( + /** @class */ + (function(_super) { + __extends(TextFieldBase2, _super); + function TextFieldBase2(props) { var _this = _super.call(this, props) || this; - _this._currentEventType = eventMapping.mouse; - _this._events = []; - _this._onMouseDown = function(event) { - var onMouseDown = _react.Children.only(_this.props.children).props.onMouseDown; - if (onMouseDown) onMouseDown(event); - _this._currentEventType = eventMapping.mouse; - return _this._onDragStart(event); - }; - _this._onMouseUp = function(event) { - var onMouseUp = _react.Children.only(_this.props.children).props.onMouseUp; - if (onMouseUp) onMouseUp(event); - _this._currentEventType = eventMapping.mouse; - return _this._onDragStop(event); - }; - _this._onTouchStart = function(event) { - var onTouchStart = _react.Children.only(_this.props.children).props.onTouchStart; - if (onTouchStart) onTouchStart(event); - _this._currentEventType = eventMapping.touch; - return _this._onDragStart(event); - }; - _this._onTouchEnd = function(event) { - var onTouchEnd = _react.Children.only(_this.props.children).props.onTouchEnd; - if (onTouchEnd) onTouchEnd(event); - _this._currentEventType = eventMapping.touch; - _this._onDragStop(event); - }; - _this._onDragStart = function(event) { - // Only handle left click for dragging - if (typeof event.button === 'number' && event.button !== 0) return false; - // If the target doesn't match the handleSelector OR - // if the target does match the preventDragSelector, bail out - if (_this.props.handleSelector && !_this._matchesSelector(event.target, _this.props.handleSelector) || _this.props.preventDragSelector && _this._matchesSelector(event.target, _this.props.preventDragSelector)) return; - // Remember the touch identifier if this is a touch event so we can - // distinguish between individual touches in multitouch scenarios - // by remembering which touch point we were given - _this._touchId = _this._getTouchId(event); - var position = _this._getControlPosition(event); - if (position === undefined) return; - var dragData = _this._createDragDataFromPosition(position); - _this.props.onStart && _this.props.onStart(event, dragData); - _this.setState({ - isDragging: true, - lastPosition: position - }); - // hook up the appropriate mouse/touch events to the body to ensure - // smooth dragging - var doc = (0, _dom.getDocumentEx)(_this.context); - _this._events = [ - (0, _utilities.on)(doc.body, _this._currentEventType.move, _this._onDrag, true), - (0, _utilities.on)(doc.body, _this._currentEventType.stop, _this._onDragStop, true) - ]; - }; - _this._onDrag = function(event) { - // Prevent scrolling on mobile devices - if (event.type === 'touchmove') event.preventDefault(); - var position = _this._getControlPosition(event); - if (!position) return; - // create the updated drag data from the position data - var updatedData = _this._createUpdatedDragData(_this._createDragDataFromPosition(position)); - var updatedPosition = updatedData.position; - _this.props.onDragChange && _this.props.onDragChange(event, updatedData); - _this.setState({ - position: updatedPosition, - lastPosition: position - }); - }; - _this._onDragStop = function(event) { - if (!_this.state.isDragging) return; - var position = _this._getControlPosition(event); - if (!position) return; - var baseDragData = _this._createDragDataFromPosition(position); - // Set dragging to false and reset the lastPosition - _this.setState({ - isDragging: false, - lastPosition: undefined - }); - _this.props.onStop && _this.props.onStop(event, baseDragData); - if (_this.props.position) _this.setState({ - position: _this.props.position - }); - // Remove event handlers - _this._events.forEach(function(dispose) { - return dispose(); - }); + _this._textElement = React__namespace.createRef(); + _this._onFocus = function(ev) { + if (_this.props.onFocus) { + _this.props.onFocus(ev); + } + _this.setState({ isFocused: true }, function() { + if (_this.props.validateOnFocusIn) { + _this._validate(_this.value); + } + }); }; + _this._onBlur = function(ev) { + if (_this.props.onBlur) { + _this.props.onBlur(ev); + } + _this.setState({ isFocused: false }, function() { + if (_this.props.validateOnFocusOut) { + _this._validate(_this.value); + } + }); + }; + _this._onRenderLabel = function(props2) { + var label2 = props2.label, required2 = props2.required; + var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : void 0; + if (label2) { + return React__namespace.createElement(Label$2, { required: required2, htmlFor: _this._id, styles: labelStyles, disabled: props2.disabled, id: _this._labelId }, props2.label); + } + return null; + }; + _this._onRenderDescription = function(props2) { + if (props2.description) { + return React__namespace.createElement("span", { className: _this._classNames.description }, props2.description); + } + return null; + }; + _this._onRevealButtonClick = function(event2) { + _this.setState(function(prevState) { + return { isRevealingPassword: !prevState.isRevealingPassword }; + }); + }; + _this._onInputChange = function(event2) { + var _a22, _b2; + var element2 = event2.target; + var value2 = element2.value; + var previousValue = _getValue(_this.props, _this.state) || ""; + if (value2 === void 0 || value2 === _this._lastChangeValue || value2 === previousValue) { + _this._lastChangeValue = void 0; + return; + } + _this._lastChangeValue = value2; + (_b2 = (_a22 = _this.props).onChange) === null || _b2 === void 0 ? void 0 : _b2.call(_a22, event2, value2); + if (!_this._isControlled) { + _this.setState({ uncontrolledValue: value2 }); + } + }; + initializeComponentRef(_this); + _this._async = new Async(_this); + _this._fallbackId = getId(COMPONENT_NAME$1); + _this._descriptionId = getId(COMPONENT_NAME$1 + "Description"); + _this._labelId = getId(COMPONENT_NAME$1 + "Label"); + _this._prefixId = getId(COMPONENT_NAME$1 + "Prefix"); + _this._suffixId = getId(COMPONENT_NAME$1 + "Suffix"); + _this._warnControlledUsage(); + var _a2 = props.defaultValue, defaultValue = _a2 === void 0 ? DEFAULT_STATE_VALUE : _a2; + if (typeof defaultValue === "number") { + defaultValue = String(defaultValue); + } _this.state = { - isDragging: false, - position: _this.props.position || { - x: 0, - y: 0 - }, - lastPosition: undefined + uncontrolledValue: _this._isControlled ? void 0 : defaultValue, + isFocused: false, + errorMessage: "" }; + _this._delayedValidate = _this._async.debounce(_this._validate, _this.props.deferredValidationTime); + _this._lastValidation = 0; return _this; - } - DraggableZone.prototype.componentDidUpdate = function(prevProps) { - if (this.props.position && (!prevProps.position || this.props.position !== prevProps.position)) this.setState({ - position: this.props.position - }); - }; - DraggableZone.prototype.componentWillUnmount = function() { - this._events.forEach(function(dispose) { - return dispose(); + } + Object.defineProperty(TextFieldBase2.prototype, "value", { + /** + * Gets the current value of the text field. + */ + get: function() { + return _getValue(this.props, this.state); + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype.componentDidMount = function() { + this._adjustInputHeight(); + if (this.props.validateOnLoad) { + this._validate(this.value); + } + }; + TextFieldBase2.prototype.componentWillUnmount = function() { + this._async.dispose(); + }; + TextFieldBase2.prototype.getSnapshotBeforeUpdate = function(prevProps, prevState) { + return { + selection: [this.selectionStart, this.selectionEnd] + }; + }; + TextFieldBase2.prototype.componentDidUpdate = function(prevProps, prevState, snapshot) { + var props = this.props; + var _a2 = (snapshot || {}).selection, selection = _a2 === void 0 ? [null, null] : _a2; + var start = selection[0], end = selection[1]; + if (!!prevProps.multiline !== !!props.multiline && prevState.isFocused) { + this.focus(); + if (start !== null && end !== null && start >= 0 && end >= 0) { + this.setSelectionRange(start, end); + } + } + if (prevProps.value !== props.value) { + this._lastChangeValue = void 0; + } + var prevValue = _getValue(prevProps, prevState); + var value2 = this.value; + if (prevValue !== value2) { + this._warnControlledUsage(prevProps); + if (this.state.errorMessage && !props.errorMessage) { + this.setState({ errorMessage: "" }); + } + this._adjustInputHeight(); + if (_shouldValidateAllChanges(props)) { + this._delayedValidate(value2); + } + } + }; + TextFieldBase2.prototype.render = function() { + var _a2 = this.props, borderless = _a2.borderless, className2 = _a2.className, disabled = _a2.disabled, invalid = _a2.invalid, iconProps = _a2.iconProps, inputClassName = _a2.inputClassName, label2 = _a2.label, multiline = _a2.multiline, required2 = _a2.required, underlined = _a2.underlined, prefix = _a2.prefix, resizable = _a2.resizable, suffix = _a2.suffix, theme = _a2.theme, styles = _a2.styles, autoAdjustHeight = _a2.autoAdjustHeight, canRevealPassword = _a2.canRevealPassword, revealPasswordAriaLabel = _a2.revealPasswordAriaLabel, type2 = _a2.type, _b2 = _a2.onRenderPrefix, onRenderPrefix = _b2 === void 0 ? this._onRenderPrefix : _b2, _c2 = _a2.onRenderSuffix, onRenderSuffix = _c2 === void 0 ? this._onRenderSuffix : _c2, _d2 = _a2.onRenderLabel, onRenderLabel = _d2 === void 0 ? this._onRenderLabel : _d2, _e2 = _a2.onRenderDescription, onRenderDescription = _e2 === void 0 ? this._onRenderDescription : _e2; + var _f = this.state, isFocused = _f.isFocused, isRevealingPassword = _f.isRevealingPassword; + var errorMessage = this._errorMessage; + var isInvalid = typeof invalid === "boolean" ? invalid : !!errorMessage; + var hasRevealButton = !!canRevealPassword && type2 === "password" && _browserNeedsRevealButton(); + var classNames2 = this._classNames = getClassNames$1(styles, { + theme, + className: className2, + disabled, + focused: isFocused, + required: required2, + multiline, + hasLabel: !!label2, + hasErrorMessage: isInvalid, + borderless, + resizable, + hasIcon: !!iconProps, + underlined, + inputClassName, + autoAdjustHeight, + hasRevealButton }); - }; - DraggableZone.prototype.render = function() { - var child = _react.Children.only(this.props.children); - var props = child.props; - var position = this.props.position; - var _a = this.state, statePosition = _a.position, isDragging = _a.isDragging; - var x = statePosition.x; - var y = statePosition.y; - if (position && !isDragging) { - x = position.x; - y = position.y; - } - return _react.cloneElement(child, { - style: (0, _tslib.__assign)((0, _tslib.__assign)({}, props.style), { - transform: "translate(".concat(x, "px, ").concat(y, "px)") - }), - className: (0, _draggableZoneStyles.getClassNames)(props.className, this.state.isDragging).root, - onMouseDown: this._onMouseDown, - onMouseUp: this._onMouseUp, - onTouchStart: this._onTouchStart, - onTouchEnd: this._onTouchEnd + return ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + React__namespace.createElement( + "div", + { ref: this.props.elementRef, className: classNames2.root }, + React__namespace.createElement( + "div", + { className: classNames2.wrapper }, + onRenderLabel(this.props, this._onRenderLabel), + React__namespace.createElement( + "div", + { className: classNames2.fieldGroup }, + (prefix !== void 0 || this.props.onRenderPrefix) && React__namespace.createElement("div", { className: classNames2.prefix, id: this._prefixId }, onRenderPrefix(this.props, this._onRenderPrefix)), + multiline ? this._renderTextArea() : this._renderInput(), + iconProps && React__namespace.createElement(Icon, __assign$1({ className: classNames2.icon }, iconProps)), + hasRevealButton && // Explicitly set type="button" since the default button type within a form is "submit" + React__namespace.createElement( + "button", + { "aria-label": revealPasswordAriaLabel, className: classNames2.revealButton, onClick: this._onRevealButtonClick, "aria-pressed": !!isRevealingPassword, type: "button" }, + React__namespace.createElement( + "span", + { className: classNames2.revealSpan }, + React__namespace.createElement(Icon, { className: classNames2.revealIcon, iconName: isRevealingPassword ? HIDE_ICON_NAME : REVEAL_ICON_NAME }) + ) + ), + (suffix !== void 0 || this.props.onRenderSuffix) && React__namespace.createElement("div", { className: classNames2.suffix, id: this._suffixId }, onRenderSuffix(this.props, this._onRenderSuffix)) + ) + ), + this._isDescriptionAvailable && React__namespace.createElement( + "span", + { id: this._descriptionId }, + onRenderDescription(this.props, this._onRenderDescription), + errorMessage && React__namespace.createElement( + "div", + { role: "alert" }, + React__namespace.createElement(DelayedRender, null, this._renderErrorMessage()) + ) + ) + ) + ); + }; + TextFieldBase2.prototype.focus = function() { + if (this._textElement.current) { + this._textElement.current.focus(); + } + }; + TextFieldBase2.prototype.blur = function() { + if (this._textElement.current) { + this._textElement.current.blur(); + } + }; + TextFieldBase2.prototype.select = function() { + if (this._textElement.current) { + this._textElement.current.select(); + } + }; + TextFieldBase2.prototype.setSelectionStart = function(value2) { + if (this._textElement.current) { + this._textElement.current.selectionStart = value2; + } + }; + TextFieldBase2.prototype.setSelectionEnd = function(value2) { + if (this._textElement.current) { + this._textElement.current.selectionEnd = value2; + } + }; + Object.defineProperty(TextFieldBase2.prototype, "selectionStart", { + /** + * Gets the selection start of the text field + */ + get: function() { + return this._textElement.current ? this._textElement.current.selectionStart : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextFieldBase2.prototype, "selectionEnd", { + /** + * Gets the selection end of the text field + */ + get: function() { + return this._textElement.current ? this._textElement.current.selectionEnd : -1; + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype.setSelectionRange = function(start, end) { + if (this._textElement.current) { + this._textElement.current.setSelectionRange(start, end); + } + }; + TextFieldBase2.prototype._warnControlledUsage = function(prevProps) { + warnControlledUsage({ + componentId: this._id, + props: this.props }); - }; - /** - * Get the control position based off the event that fired - * @param event - The event to get offsets from - */ DraggableZone.prototype._getControlPosition = function(event) { - var touchObj = this._getActiveTouch(event); - // did we get the right touch? - if (this._touchId !== undefined && !touchObj) return undefined; - var eventToGetOffset = touchObj || event; - return { - x: eventToGetOffset.clientX, - y: eventToGetOffset.clientY + if (this.props.value === null && !this._hasWarnedNullValue) { + this._hasWarnedNullValue = true; + warn$1("Warning: 'value' prop on '".concat(COMPONENT_NAME$1, "' should not be null. Consider using an ") + "empty string to clear the component or undefined to indicate an uncontrolled component."); + } + }; + Object.defineProperty(TextFieldBase2.prototype, "_id", { + /** Returns `props.id` if available, or a fallback if not. */ + get: function() { + return this.props.id || this._fallbackId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextFieldBase2.prototype, "_isControlled", { + get: function() { + return isControlled(this.props, "value"); + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype._onRenderPrefix = function(props) { + var prefix = props.prefix; + return React__namespace.createElement("span", { style: { paddingBottom: "1px" } }, prefix); + }; + TextFieldBase2.prototype._onRenderSuffix = function(props) { + var suffix = props.suffix; + return React__namespace.createElement("span", { style: { paddingBottom: "1px" } }, suffix); + }; + Object.defineProperty(TextFieldBase2.prototype, "_errorMessage", { + /** + * Current error message from either `props.errorMessage` or the result of `props.onGetErrorMessage`. + * + * - If there is no validation error or we have not validated the input value, errorMessage is an empty string. + * - If we have done the validation and there is validation error, errorMessage is the validation error message. + */ + get: function() { + var _a2 = this.props.errorMessage, errorMessage = _a2 === void 0 ? this.state.errorMessage : _a2; + return errorMessage || ""; + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype._renderErrorMessage = function() { + var errorMessage = this._errorMessage; + return errorMessage ? typeof errorMessage === "string" ? React__namespace.createElement( + "p", + { className: this._classNames.errorMessage }, + React__namespace.createElement("span", { "data-automation-id": "error-message" }, errorMessage) + ) : React__namespace.createElement("div", { className: this._classNames.errorMessage, "data-automation-id": "error-message" }, errorMessage) : null; + }; + Object.defineProperty(TextFieldBase2.prototype, "_isDescriptionAvailable", { + /** + * If a custom description render function is supplied then treat description as always available. + * Otherwise defer to the presence of description or error message text. + */ + get: function() { + var props = this.props; + return !!(props.onRenderDescription || props.description || this._errorMessage); + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype._renderTextArea = function() { + var _a2 = this.props.invalid, invalid = _a2 === void 0 ? !!this._errorMessage : _a2; + var textAreaProps = getNativeProps(this.props, textAreaProperties, ["defaultValue"]); + var ariaLabelledBy = this.props["aria-labelledby"] || (this.props.label ? this._labelId : void 0); + return React__namespace.createElement("textarea", __assign$1({ id: this._id }, textAreaProps, { ref: this._textElement, value: this.value || "", onInput: this._onInputChange, onChange: this._onInputChange, className: this._classNames.field, "aria-labelledby": ariaLabelledBy, "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props["aria-describedby"], "aria-invalid": invalid, "aria-label": this.props.ariaLabel, readOnly: this.props.readOnly, onFocus: this._onFocus, onBlur: this._onBlur })); + }; + TextFieldBase2.prototype._renderInput = function() { + var _a2 = this.props, ariaLabel2 = _a2.ariaLabel, _b2 = _a2.invalid, invalid = _b2 === void 0 ? !!this._errorMessage : _b2, onRenderPrefix = _a2.onRenderPrefix, onRenderSuffix = _a2.onRenderSuffix, prefix = _a2.prefix, suffix = _a2.suffix, _c2 = _a2.type, type2 = _c2 === void 0 ? "text" : _c2, label2 = _a2.label; + var labelIds = []; + label2 && labelIds.push(this._labelId); + (prefix !== void 0 || onRenderPrefix) && labelIds.push(this._prefixId); + (suffix !== void 0 || onRenderSuffix) && labelIds.push(this._suffixId); + var inputProps = __assign$1(__assign$1({ type: this.state.isRevealingPassword ? "text" : type2, id: this._id }, getNativeProps(this.props, inputProperties, ["defaultValue", "type"])), { "aria-labelledby": this.props["aria-labelledby"] || (labelIds.length > 0 ? labelIds.join(" ") : void 0), ref: this._textElement, value: this.value || "", onInput: this._onInputChange, onChange: this._onInputChange, className: this._classNames.field, "aria-label": ariaLabel2, "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props["aria-describedby"], "aria-invalid": invalid, onFocus: this._onFocus, onBlur: this._onBlur }); + var defaultRender = function(updatedInputProps) { + return React__namespace.createElement("input", __assign$1({}, updatedInputProps)); }; - }; - /** - * Get the active touch point that we have saved from the event's TouchList - * @param event - The event used to get the TouchList for the active touch point - */ DraggableZone.prototype._getActiveTouch = function(event) { - return event.targetTouches && this._findTouchInTouchList(event.targetTouches) || event.changedTouches && this._findTouchInTouchList(event.changedTouches); - }; - /** - * Get the initial touch identifier associated with the given event - * @param event - The event that contains the TouchList - */ DraggableZone.prototype._getTouchId = function(event) { - var touch = event.targetTouches && event.targetTouches[0] || event.changedTouches && event.changedTouches[0]; - if (touch) return touch.identifier; - }; - /** - * Returns if an element (or any of the element's parents) match the given selector - */ DraggableZone.prototype._matchesSelector = function(element, selector) { - var _a; - if (!element || element === ((_a = (0, _dom.getDocumentEx)(this.context)) === null || _a === void 0 ? void 0 : _a.body)) return false; - var matchesSelectorFn = // eslint-disable-next-line deprecation/deprecation - element.matches || element.webkitMatchesSelector || element.msMatchesSelector; /* for IE */ - if (!matchesSelectorFn) return false; - return matchesSelectorFn.call(element, selector) || this._matchesSelector(element.parentElement, selector); - }; - /** - * Attempts to find the Touch that matches the identifier we stored in dragStart - * @param touchList The TouchList to look for the stored identifier from dragStart - */ DraggableZone.prototype._findTouchInTouchList = function(touchList) { - if (this._touchId === undefined) return; - for(var i = 0; i < touchList.length; i++){ - if (touchList[i].identifier === this._touchId) return touchList[i]; + var onRenderInput = this.props.onRenderInput || defaultRender; + return onRenderInput(inputProps, defaultRender); + }; + TextFieldBase2.prototype._validate = function(value2) { + var _this = this; + if (this._latestValidateValue === value2 && _shouldValidateAllChanges(this.props)) { + return; + } + this._latestValidateValue = value2; + var onGetErrorMessage = this.props.onGetErrorMessage; + var result = onGetErrorMessage && onGetErrorMessage(value2 || ""); + if (result !== void 0) { + if (typeof result === "string" || !("then" in result)) { + this.setState({ errorMessage: result }); + this._notifyAfterValidate(value2, result); + } else { + var currentValidation_1 = ++this._lastValidation; + result.then(function(errorMessage) { + if (currentValidation_1 === _this._lastValidation) { + _this.setState({ errorMessage }); + } + _this._notifyAfterValidate(value2, errorMessage); + }); + } + } else { + this._notifyAfterValidate(value2, ""); } - return undefined; + }; + TextFieldBase2.prototype._notifyAfterValidate = function(value2, errorMessage) { + if (value2 === this.value && this.props.onNotifyValidationResult) { + this.props.onNotifyValidationResult(errorMessage, value2); + } + }; + TextFieldBase2.prototype._adjustInputHeight = function() { + var _a2, _b2; + if (this._textElement.current && this.props.autoAdjustHeight && this.props.multiline) { + var scrollTop = (_b2 = (_a2 = this.props.scrollContainerRef) === null || _a2 === void 0 ? void 0 : _a2.current) === null || _b2 === void 0 ? void 0 : _b2.scrollTop; + var textField = this._textElement.current; + textField.style.height = ""; + textField.style.height = textField.scrollHeight + "px"; + if (scrollTop) { + this.props.scrollContainerRef.current.scrollTop = scrollTop; + } + } + }; + TextFieldBase2.defaultProps = { + resizable: true, + deferredValidationTime: 200, + validateOnLoad: true + }; + return TextFieldBase2; + })(React__namespace.Component) + ); + function _getValue(props, state) { + var _a2 = props.value, value2 = _a2 === void 0 ? state.uncontrolledValue : _a2; + if (typeof value2 === "number") { + return String(value2); + } + return value2; + } + function _shouldValidateAllChanges(props) { + return !(props.validateOnFocusIn || props.validateOnFocusOut); + } + var __browserNeedsRevealButton; + function _browserNeedsRevealButton() { + if (typeof __browserNeedsRevealButton !== "boolean") { + var win = getWindow(); + if (win === null || win === void 0 ? void 0 : win.navigator) { + var isEdge = /Edg/.test(win.navigator.userAgent || ""); + __browserNeedsRevealButton = !(isIE11() || isEdge); + } else { + __browserNeedsRevealButton = true; + } + } + return __browserNeedsRevealButton; + } + var globalClassNames = { + root: "ms-TextField", + description: "ms-TextField-description", + errorMessage: "ms-TextField-errorMessage", + field: "ms-TextField-field", + fieldGroup: "ms-TextField-fieldGroup", + prefix: "ms-TextField-prefix", + suffix: "ms-TextField-suffix", + wrapper: "ms-TextField-wrapper", + revealButton: "ms-TextField-reveal", + multiline: "ms-TextField--multiline", + borderless: "ms-TextField--borderless", + underlined: "ms-TextField--underlined", + unresizable: "ms-TextField--unresizable", + required: "is-required", + disabled: "is-disabled", + active: "is-active" + }; + function getLabelStyles(props) { + var underlined = props.underlined, disabled = props.disabled, focused = props.focused, theme = props.theme; + var palette = theme.palette, fonts = theme.fonts; + return function() { + var _a2; + return { + root: [ + underlined && disabled && { + color: palette.neutralTertiary + }, + underlined && { + fontSize: fonts.medium.fontSize, + marginRight: 8, + paddingLeft: 12, + paddingRight: 0, + lineHeight: "22px", + height: 32 + }, + underlined && focused && { + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + height: 31 + // -1px to prevent jumpiness in HC with the increased border-width to 2px + }, _a2) + } + ] + }; }; - /** - * Create DragData based off of the last known position and the new position passed in - * @param position The new position as part of the drag - */ DraggableZone.prototype._createDragDataFromPosition = function(position) { - var lastPosition = this.state.lastPosition; - // If we have no lastPosition, use the given position - // for last position - if (lastPosition === undefined) return { - delta: { - x: 0, - y: 0 - }, - lastPosition: position, - position: position - }; - return { - delta: { - x: position.x - lastPosition.x, - y: position.y - lastPosition.y - }, - lastPosition: lastPosition, - position: position - }; + } + function getStyles$1(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m; + var theme = props.theme, className2 = props.className, disabled = props.disabled, focused = props.focused, required2 = props.required, multiline = props.multiline, hasLabel = props.hasLabel, borderless = props.borderless, underlined = props.underlined, hasIcon = props.hasIcon, resizable = props.resizable, hasErrorMessage = props.hasErrorMessage, inputClassName = props.inputClassName, autoAdjustHeight = props.autoAdjustHeight, hasRevealButton = props.hasRevealButton; + var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; + var classNames2 = getGlobalClassNames(globalClassNames, theme); + var fieldPrefixSuffix = { + // Suffix/Prefix are not editable so the disabled slot perfectly fits. + background: semanticColors.disabledBackground, + color: !disabled ? semanticColors.inputPlaceholderText : semanticColors.disabledText, + display: "flex", + alignItems: "center", + padding: "0 10px", + lineHeight: 1, + whiteSpace: "nowrap", + flexShrink: 0, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + background: "Window", + color: disabled ? "GrayText" : "WindowText" + }, _a2) }; - /** - * Creates an updated DragData based off the current position and given baseDragData - * @param baseDragData The base DragData (from _createDragDataFromPosition) used to calculate the updated positions - */ DraggableZone.prototype._createUpdatedDragData = function(baseDragData) { - var position = this.state.position; - return { - position: { - x: position.x + baseDragData.delta.x, - y: position.y + baseDragData.delta.y - }, - delta: baseDragData.delta, - lastPosition: position - }; + var placeholderStyles = [ + { + color: semanticColors.inputPlaceholderText, + opacity: 1, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + color: "GrayText" + }, _b2) + } + ]; + var disabledPlaceholderStyles = { + color: semanticColors.disabledText, + selectors: (_c2 = {}, _c2[HighContrastSelector] = { + color: "GrayText" + }, _c2) }; - DraggableZone.contextType = (0, _reactWindowProvider.WindowContext); - return DraggableZone; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./DraggableZone.styles":"bCq86","../../Utilities":"1NZCy","@fluentui/react-window-provider":"iP8C0","../dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bCq86":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getClassNames", ()=>getClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getClassNames = (0, _utilities.memoizeFunction)(function(className, isDragging) { return { - root: (0, _styling.mergeStyles)(className, isDragging && { - touchAction: 'none', + root: [ + classNames2.root, + fonts.medium, + required2 && classNames2.required, + disabled && classNames2.disabled, + focused && classNames2.active, + multiline && classNames2.multiline, + borderless && classNames2.borderless, + underlined && classNames2.underlined, + normalize$1, + { + position: "relative" + }, + className2 + ], + wrapper: [ + classNames2.wrapper, + underlined && [ + { + display: "flex", + borderBottom: "1px solid ".concat(!hasErrorMessage ? semanticColors.inputBorder : semanticColors.errorText), + width: "100%" + }, + disabled && { + borderBottomColor: semanticColors.disabledBackground, + selectors: (_d2 = {}, _d2[HighContrastSelector] = __assign$1({ borderColor: "GrayText" }, getHighContrastNoAdjustStyle()), _d2) + }, + !disabled && { selectors: { - '& *': { - userSelect: 'none' - } + ":hover": { + borderBottomColor: !hasErrorMessage ? semanticColors.inputBorderHovered : semanticColors.errorText, + selectors: (_e2 = {}, _e2[HighContrastSelector] = __assign$1({ borderBottomColor: "Highlight" }, getHighContrastNoAdjustStyle()), _e2) + } } - }) - }; -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7qNNV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogContent", ()=>DialogContent); -var _utilities = require("../../Utilities"); -var _dialogContentBase = require("./DialogContent.base"); -var _dialogContentStyles = require("./DialogContent.styles"); -var DialogContent = (0, _utilities.styled)((0, _dialogContentBase.DialogContentBase), (0, _dialogContentStyles.getStyles), undefined, { - scope: 'DialogContent' -}); -DialogContent.displayName = 'DialogContent'; - -},{"../../Utilities":"1NZCy","./DialogContent.base":"duIEt","./DialogContent.styles":"a7LGo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"duIEt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogContentBase", ()=>DialogContentBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _dialogContentTypes = require("./DialogContent.types"); -var _button = require("../../Button"); -var _dialogFooter = require("./DialogFooter"); -var _responsiveMode = require("../../ResponsiveMode"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DialogFooterType = _react.createElement((0, _dialogFooter.DialogFooter), null).type; -var COMPONENT_NAME = 'DialogContent'; -// eslint-disable-next-line deprecation/deprecation -var DialogContentBase = /** @class */ function(_super) { - (0, _tslib.__extends)(DialogContentBase, _super); - function DialogContentBase(props) { - var _this = _super.call(this, props) || this; - (0, _utilities.initializeComponentRef)(_this); - (0, _utilities.warnDeprecations)(COMPONENT_NAME, props, { - titleId: 'titleProps.id' - }); - return _this; - } - DialogContentBase.prototype.render = function() { - var _a = this.props, showCloseButton = _a.showCloseButton, className = _a.className, closeButtonAriaLabel = _a.closeButtonAriaLabel, onDismiss = _a.onDismiss, subTextId = _a.subTextId, subText = _a.subText, _b = _a.titleProps, titleProps = _b === void 0 ? {} : _b, // eslint-disable-next-line deprecation/deprecation - titleId = _a.titleId, title = _a.title, type = _a.type, styles = _a.styles, theme = _a.theme, draggableHeaderClassName = _a.draggableHeaderClassName; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - isLargeHeader: type === (0, _dialogContentTypes.DialogType).largeHeader, - isClose: type === (0, _dialogContentTypes.DialogType).close, - draggableHeaderClassName: draggableHeaderClassName - }); - var groupings = this._groupChildren(); - var subTextContent; - if (subText) subTextContent = _react.createElement("p", { - className: classNames.subText, - id: subTextId - }, subText); - return _react.createElement("div", { - className: classNames.content - }, _react.createElement("div", { - className: classNames.header - }, _react.createElement("div", (0, _tslib.__assign)({ - id: titleId, - role: "heading", - "aria-level": 1 - }, titleProps, { - className: (0, _utilities.css)(classNames.title, titleProps.className) - }), title), _react.createElement("div", { - className: classNames.topButton - }, this.props.topButtonsProps.map(function(props, index) { - return _react.createElement((0, _button.IconButton), (0, _tslib.__assign)({ - key: props.uniqueId || index - }, props)); - }), (type === (0, _dialogContentTypes.DialogType).close || showCloseButton && type !== (0, _dialogContentTypes.DialogType).largeHeader) && _react.createElement((0, _button.IconButton), { - className: classNames.button, - iconProps: { - iconName: 'Cancel' + }, + focused && [ + { + position: "relative" + }, + getInputFocusStyle(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, 0, "borderBottom") + ] + ] + ], + fieldGroup: [ + classNames2.fieldGroup, + normalize$1, + { + border: "1px solid ".concat(semanticColors.inputBorder), + borderRadius: effects.roundedCorner2, + background: semanticColors.inputBackground, + cursor: "text", + height: 32, + display: "flex", + flexDirection: "row", + alignItems: "stretch", + position: "relative" + }, + multiline && { + minHeight: "60px", + height: "auto", + display: "flex" + }, + !focused && !disabled && { + selectors: { + ":hover": { + borderColor: semanticColors.inputBorderHovered, + selectors: (_f = {}, _f[HighContrastSelector] = __assign$1({ borderColor: "Highlight" }, getHighContrastNoAdjustStyle()), _f) + } + } + }, + focused && !underlined && getInputFocusStyle(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, effects.roundedCorner2), + disabled && { + borderColor: semanticColors.disabledBackground, + selectors: (_g = {}, _g[HighContrastSelector] = __assign$1({ borderColor: "GrayText" }, getHighContrastNoAdjustStyle()), _g), + cursor: "default" + }, + borderless && { + border: "none" + }, + borderless && focused && { + border: "none", + selectors: { + ":after": { + border: "none" + } + } + }, + underlined && { + flex: "1 1 0px", + border: "none", + textAlign: "left" + }, + underlined && disabled && { + backgroundColor: "transparent" + }, + hasErrorMessage && !underlined && { + borderColor: semanticColors.errorText, + selectors: { + "&:hover": { + borderColor: semanticColors.errorText + } + } + }, + !hasLabel && required2 && { + selectors: (_h = { + ":before": { + content: "'*'", + color: semanticColors.errorText, + position: "absolute", + top: -5, + right: -10 + } + }, _h[HighContrastSelector] = { + selectors: { + ":before": { + color: "WindowText", + right: -14 + // moving the * 4 pixel to right to alleviate border clipping in HC mode. + } + } + }, _h) + } + ], + field: [ + fonts.medium, + classNames2.field, + normalize$1, + { + borderRadius: 0, + border: "none", + background: "none", + backgroundColor: "transparent", + color: semanticColors.inputText, + padding: "0 8px", + width: "100%", + minWidth: 0, + textOverflow: "ellipsis", + outline: 0, + selectors: (_j = { + "&:active, &:focus, &:hover": { outline: 0 }, + "::-ms-clear": { + display: "none" + } + }, _j[HighContrastSelector] = { + background: "Window", + color: disabled ? "GrayText" : "WindowText" + }, _j) + }, + getPlaceholderStyles(placeholderStyles), + multiline && !resizable && [ + classNames2.unresizable, + { + resize: "none" + } + ], + multiline && { + minHeight: "inherit", + lineHeight: 17, + flexGrow: 1, + paddingTop: 6, + paddingBottom: 6, + overflow: "auto", + width: "100%" + }, + multiline && autoAdjustHeight && { + overflow: "hidden" + }, + hasIcon && !hasRevealButton && { + paddingRight: 24 + }, + multiline && hasIcon && { + paddingRight: 40 + }, + disabled && [ + { + backgroundColor: semanticColors.disabledBackground, + color: semanticColors.disabledText, + borderColor: semanticColors.disabledBackground + }, + getPlaceholderStyles(disabledPlaceholderStyles) + ], + underlined && { + textAlign: "left" + }, + focused && !borderless && { + selectors: (_k = {}, _k[HighContrastSelector] = { + paddingLeft: 11, + paddingRight: 11 + }, _k) + }, + focused && multiline && !borderless && { + selectors: (_l = {}, _l[HighContrastSelector] = { + paddingTop: 4 + // take into consideration the 2px increased border-width (not when borderless). + }, _l) + }, + inputClassName + ], + icon: [ + multiline && { + paddingRight: 24, + alignItems: "flex-end" + }, + { + pointerEvents: "none", + position: "absolute", + bottom: 6, + right: 8, + top: "auto", + fontSize: IconFontSizes.medium, + lineHeight: 18 + }, + disabled && { + color: semanticColors.disabledText + } + ], + description: [ + classNames2.description, + { + color: semanticColors.bodySubtext, + fontSize: fonts.xSmall.fontSize + } + ], + errorMessage: [ + classNames2.errorMessage, + AnimationClassNames.slideDownIn20, + fonts.small, + { + color: semanticColors.errorText, + margin: 0, + paddingTop: 5, + display: "flex", + alignItems: "center" + } + ], + prefix: [classNames2.prefix, fieldPrefixSuffix], + suffix: [classNames2.suffix, fieldPrefixSuffix], + revealButton: [ + classNames2.revealButton, + "ms-Button", + "ms-Button--icon", + getFocusStyle(theme, { inset: 1 }), + { + height: 30, + width: 32, + border: "none", + padding: "0px 4px", + backgroundColor: "transparent", + color: semanticColors.link, + selectors: { + ":hover": { + outline: 0, + color: semanticColors.primaryButtonBackgroundHovered, + backgroundColor: semanticColors.buttonBackgroundHovered, + selectors: (_m = {}, _m[HighContrastSelector] = { + borderColor: "Highlight", + color: "Highlight" + }, _m) }, - ariaLabel: closeButtonAriaLabel, - onClick: onDismiss - }))), _react.createElement("div", { - className: classNames.inner - }, _react.createElement("div", { - className: classNames.innerContent - }, subTextContent, groupings.contents), groupings.footers)); - }; - // @TODO - typing the footers as an array of DialogFooter is difficult because - // casing "child as DialogFooter" causes a problem because - // "Neither type 'ReactElement<any>' nor type 'DialogFooter' is assignable to the other." - DialogContentBase.prototype._groupChildren = function() { - var groupings = { - footers: [], - contents: [] - }; - _react.Children.map(this.props.children, function(child) { - if (typeof child === 'object' && child !== null && child.type === DialogFooterType) groupings.footers.push(child); - else groupings.contents.push(child); - }); - return groupings; + ":focus": { outline: 0 } + } + }, + hasIcon && { + marginRight: 28 + } + ], + revealSpan: { + display: "flex", + height: "100%", + alignItems: "center" + }, + revealIcon: { + margin: "0px 4px", + pointerEvents: "none", + bottom: 6, + right: 8, + top: "auto", + fontSize: IconFontSizes.medium, + lineHeight: 18 + }, + subComponentStyles: { + label: getLabelStyles(props) + } }; - DialogContentBase.defaultProps = { - showCloseButton: false, - className: '', - topButtonsProps: [], - closeButtonAriaLabel: 'Close' - }; - DialogContentBase = (0, _tslib.__decorate)([ - (0, _responsiveMode.withResponsiveMode) - ], DialogContentBase); - return DialogContentBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./DialogContent.types":"lz1qp","../../Button":"1457j","./DialogFooter":"8shIu","../../ResponsiveMode":"cFpqz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8shIu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogFooter", ()=>DialogFooter); -var _utilities = require("../../Utilities"); -var _dialogFooterBase = require("./DialogFooter.base"); -var _dialogFooterStyles = require("./DialogFooter.styles"); -var DialogFooter = (0, _utilities.styled)((0, _dialogFooterBase.DialogFooterBase), (0, _dialogFooterStyles.getStyles), undefined, { - scope: 'DialogFooter' -}); -DialogFooter.displayName = 'DialogFooter'; - -},{"../../Utilities":"1NZCy","./DialogFooter.base":"cL4C4","./DialogFooter.styles":"lWgMk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cL4C4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogFooterBase", ()=>DialogFooterBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DialogFooterBase = /** @class */ function(_super) { - (0, _tslib.__extends)(DialogFooterBase, _super); - function DialogFooterBase(props) { - var _this = _super.call(this, props) || this; - (0, _utilities.initializeComponentRef)(_this); - return _this; + } + var TextField = styled(TextFieldBase, getStyles$1, void 0, { + scope: "TextField" + }); + var getClassNames = classNamesFunction(); + var COMPONENT_NAME = "Toggle"; + var ToggleBase = React__namespace.forwardRef(function(props, forwardedRef) { + var _a2 = props.as, RootType = _a2 === void 0 ? "div" : _a2, ariaLabel2 = props.ariaLabel, controlledChecked = props.checked, className2 = props.className, _b2 = props.defaultChecked, defaultChecked = _b2 === void 0 ? false : _b2, disabled = props.disabled, inlineLabel = props.inlineLabel, label2 = props.label, offAriaLabel = props.offAriaLabel, offText = props.offText, onAriaLabel = props.onAriaLabel, onChange = props.onChange, onChanged = props.onChanged, onToggleClick = props.onClick, onText = props.onText, role = props.role, styles = props.styles, theme = props.theme; + var _c2 = useControllableValue(controlledChecked, defaultChecked, React__namespace.useCallback(function(ev, isChecked) { + onChange === null || onChange === void 0 ? void 0 : onChange(ev, isChecked); + onChanged === null || onChanged === void 0 ? void 0 : onChanged(isChecked); + }, [onChange, onChanged])), checked = _c2[0], setChecked = _c2[1]; + var classNames2 = getClassNames(styles, { + theme, + className: className2, + disabled, + checked, + inlineLabel, + onOffMissing: !onText && !offText + }); + var badAriaLabel = checked ? onAriaLabel : offAriaLabel; + var id2 = useId(COMPONENT_NAME, props.id); + var labelId = "".concat(id2, "-label"); + var stateTextId = "".concat(id2, "-stateText"); + var stateText = checked ? onText : offText; + var toggleNativeProps = getNativeProps(props, inputProperties, [ + "defaultChecked" + ]); + var labelledById = void 0; + if (!ariaLabel2 && !badAriaLabel) { + if (label2) { + labelledById = labelId; + } + if (stateText && !labelledById) { + labelledById = stateTextId; + } } - DialogFooterBase.prototype.render = function() { - var _a = this.props, className = _a.className, styles = _a.styles, theme = _a.theme; - this._classNames = getClassNames(styles, { - theme: theme, - className: className - }); - return _react.createElement("div", { - className: this._classNames.actions - }, _react.createElement("div", { - className: this._classNames.actionsRight - }, this._renderChildrenAsActions())); + var toggleButton = React__namespace.useRef(null); + useFocusRects(toggleButton); + useComponentRef(props, checked, toggleButton); + var onClick = function(ev) { + if (!disabled) { + setChecked(!checked, ev); + if (onToggleClick) { + onToggleClick(ev); + } + } }; - DialogFooterBase.prototype._renderChildrenAsActions = function() { - var _this = this; - return _react.Children.map(this.props.children, function(child) { - return child ? _react.createElement("span", { - className: _this._classNames.action - }, child) : null; - }); + var slotProps = { + root: { + className: classNames2.root, + hidden: toggleNativeProps.hidden + }, + label: { + children: label2, + className: classNames2.label, + htmlFor: id2, + id: labelId + }, + container: { + className: classNames2.container + }, + pill: __assign$1(__assign$1({}, toggleNativeProps), { "aria-disabled": disabled, "aria-checked": checked, "aria-label": ariaLabel2 ? ariaLabel2 : badAriaLabel, "aria-labelledby": labelledById, className: classNames2.pill, "data-is-focusable": true, "data-ktp-target": true, disabled, id: id2, onClick, ref: toggleButton, role: role ? role : "switch", type: "button" }), + thumb: { + className: classNames2.thumb + }, + stateText: { + children: stateText, + className: classNames2.text, + htmlFor: id2, + id: stateTextId + } }; - return DialogFooterBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lWgMk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - actions: 'ms-Dialog-actions', - action: 'ms-Dialog-action', - actionsRight: 'ms-Dialog-actionsRight' -}; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + return React__namespace.createElement( + RootType, + __assign$1({ ref: forwardedRef }, slotProps.root), + label2 && React__namespace.createElement(Label$2, __assign$1({}, slotProps.label)), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.container), + React__namespace.createElement( + "button", + __assign$1({}, slotProps.pill), + React__namespace.createElement("span", __assign$1({}, slotProps.thumb)) + ), + (checked && onText || offText) && React__namespace.createElement(Label$2, __assign$1({}, slotProps.stateText)) + ) + ); + }); + ToggleBase.displayName = COMPONENT_NAME + "Base"; + var useComponentRef = function(props, isChecked, toggleButtonRef) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + get checked() { + return !!isChecked; + }, + focus: function() { + if (toggleButtonRef.current) { + toggleButtonRef.current.focus(); + } + } + }; + }, [isChecked, toggleButtonRef]); + }; + var DEFAULT_PILL_WIDTH = 40; + var DEFAULT_PILL_HEIGHT = 20; + var DEFAULT_THUMB_SIZE = 12; + var getStyles = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g; + var theme = props.theme, className2 = props.className, disabled = props.disabled, checked = props.checked, inlineLabel = props.inlineLabel, onOffMissing = props.onOffMissing; + var semanticColors = theme.semanticColors, palette = theme.palette; + var pillUncheckedBackground = semanticColors.bodyBackground; + var pillCheckedBackground = semanticColors.inputBackgroundChecked; + var pillCheckedHoveredBackground = semanticColors.inputBackgroundCheckedHovered; + var thumbUncheckedHoveredBackground = palette.neutralDark; + var pillCheckedDisabledBackground = semanticColors.disabledBodySubtext; + var thumbBackground = semanticColors.smallInputBorder; + var thumbCheckedBackground = semanticColors.inputForegroundChecked; + var thumbDisabledBackground = semanticColors.disabledBodySubtext; + var thumbCheckedDisabledBackground = semanticColors.disabledBackground; + var pillBorderColor = semanticColors.smallInputBorder; + var pillBorderHoveredColor = semanticColors.inputBorderHovered; + var pillBorderDisabledColor = semanticColors.disabledBodySubtext; + var textDisabledColor = semanticColors.disabledText; return { - actions: [ - classNames.actions, - { - position: 'relative', - width: '100%', - minHeight: '24px', - lineHeight: '24px', - margin: '16px 0 0', - fontSize: '0', - selectors: { - '.ms-Button': { - lineHeight: 'normal', - verticalAlign: 'middle' - } + root: [ + "ms-Toggle", + checked && "is-checked", + !disabled && "is-enabled", + disabled && "is-disabled", + theme.fonts.medium, + { + marginBottom: "8px" + }, + inlineLabel && { + display: "flex", + alignItems: "center" + }, + className2 + ], + label: [ + "ms-Toggle-label", + { display: "inline-block" }, + disabled && { + color: textDisabledColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + color: "GrayText" + }, _a2) + }, + inlineLabel && !onOffMissing && { + marginRight: 16 + }, + onOffMissing && inlineLabel && { + order: 1, + marginLeft: 16 + }, + inlineLabel && { wordBreak: "break-word" } + ], + container: [ + "ms-Toggle-innerContainer", + { + display: "flex", + position: "relative" + } + ], + pill: [ + "ms-Toggle-background", + getFocusStyle(theme, { inset: -3 }), + { + fontSize: "20px", + boxSizing: "border-box", + width: DEFAULT_PILL_WIDTH, + height: DEFAULT_PILL_HEIGHT, + borderRadius: DEFAULT_PILL_HEIGHT / 2, + transition: "all 0.1s ease", + border: "1px solid ".concat(pillBorderColor), + background: pillUncheckedBackground, + cursor: "pointer", + display: "flex", + alignItems: "center", + padding: "0 3px", + overflow: "visible" + }, + !disabled && [ + !checked && { + selectors: { + ":hover": [ + { + borderColor: pillBorderHoveredColor } - }, - className - ], - action: [ - classNames.action, - { - margin: '0 4px' - } - ], - actionsRight: [ - classNames.actionsRight, - { - alignItems: 'center', - display: 'flex', - fontSize: '0', - justifyContent: 'flex-end', - marginRight: '-4px' - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a7LGo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - contentLgHeader: 'ms-Dialog-lgHeader', - close: 'ms-Dialog--close', - subText: 'ms-Dialog-subText', - header: 'ms-Dialog-header', - headerLg: 'ms-Dialog--lgHeader', - button: 'ms-Dialog-button ms-Dialog-button--close', - inner: 'ms-Dialog-inner', - content: 'ms-Dialog-content', - title: 'ms-Dialog-title' -}; -var getStyles = function(props) { - var _a, _b, _c; - var className = props.className, theme = props.theme, isLargeHeader = props.isLargeHeader, isClose = props.isClose, hidden = props.hidden, isMultiline = props.isMultiline, draggableHeaderClassName = props.draggableHeaderClassName; - var palette = theme.palette, fonts = theme.fonts, effects = theme.effects, semanticColors = theme.semanticColors; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - content: [ - isLargeHeader && [ - classNames.contentLgHeader, + ], + ":hover .ms-Toggle-thumb": [ { - borderTop: "4px solid ".concat(palette.themePrimary) + backgroundColor: thumbUncheckedHoveredBackground, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "Highlight" + }, _b2) } - ], - isClose && classNames.close, + ] + } + }, + checked && [ { - flexGrow: 1, - overflowY: 'hidden' + background: pillCheckedBackground, + borderColor: "transparent", + justifyContent: "flex-end" }, - className - ], - subText: [ - classNames.subText, - fonts.medium, { - margin: '0 0 24px 0', - color: semanticColors.bodySubtext, - lineHeight: '1.5', - wordWrap: 'break-word', - fontWeight: (0, _styling.FontWeights).regular + selectors: (_c2 = { + ":hover": [ + { + backgroundColor: pillCheckedHoveredBackground, + borderColor: "transparent", + selectors: (_d2 = {}, _d2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _d2) + } + ] + }, _c2[HighContrastSelector] = __assign$1({ backgroundColor: "Highlight" }, getHighContrastNoAdjustStyle()), _c2) } + ] ], - header: [ - classNames.header, + disabled && [ + { + cursor: "default" + }, + !checked && [ { - position: 'relative', - width: '100%', - boxSizing: 'border-box' - }, - isClose && classNames.close, - draggableHeaderClassName && [ - draggableHeaderClassName, - { - cursor: 'move' - } - ] - ], - button: [ - classNames.button, - hidden && { - selectors: { - '.ms-Icon.ms-Icon--Cancel': { - color: semanticColors.buttonText, - fontSize: (0, _styling.IconFontSizes).medium - } - } + borderColor: pillBorderDisabledColor } - ], - inner: [ - classNames.inner, + ], + checked && [ { - padding: '0 24px 24px', - selectors: (_a = {}, _a["@media (min-width: ".concat((0, _styling.ScreenWidthMinSmall), "px) and (max-width: ").concat((0, _styling.ScreenWidthMaxSmall), "px)")] = { - padding: '0 16px 16px' - }, _a) + backgroundColor: pillCheckedDisabledBackground, + borderColor: "transparent", + justifyContent: "flex-end" } + ] ], - innerContent: [ - classNames.content, - { - position: 'relative', - width: '100%' - } + !disabled && { + selectors: { + "&:hover": { + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + borderColor: "Highlight" + }, _e2) + } + } + } + ], + thumb: [ + "ms-Toggle-thumb", + { + display: "block", + width: DEFAULT_THUMB_SIZE, + height: DEFAULT_THUMB_SIZE, + borderRadius: "50%", + transition: "all 0.1s ease", + backgroundColor: thumbBackground, + /* Border is added to handle high contrast mode for Firefox */ + borderColor: "transparent", + borderWidth: DEFAULT_THUMB_SIZE / 2, + borderStyle: "solid", + boxSizing: "border-box" + }, + !disabled && checked && [ + { + backgroundColor: thumbCheckedBackground, + selectors: (_f = {}, _f[HighContrastSelector] = { + backgroundColor: "Window", + borderColor: "Window" + }, _f) + } ], - title: [ - classNames.title, - fonts.xLarge, + disabled && [ + !checked && [ { - color: semanticColors.bodyText, - margin: '0', - minHeight: fonts.xLarge.fontSize, - padding: '16px 46px 20px 24px', - lineHeight: 'normal', - selectors: (_b = {}, _b["@media (min-width: ".concat((0, _styling.ScreenWidthMinSmall), "px) and (max-width: ").concat((0, _styling.ScreenWidthMaxSmall), "px)")] = { - padding: '16px 46px 16px 16px' - }, _b) - }, - isLargeHeader && { - color: semanticColors.menuHeader - }, - isMultiline && { - fontSize: fonts.xxLarge.fontSize + backgroundColor: thumbDisabledBackground } - ], - topButton: [ + ], + checked && [ { - display: 'flex', - flexDirection: 'row', - flexWrap: 'nowrap', - position: 'absolute', - top: '0', - right: '0', - padding: '15px 15px 0 0', - selectors: (_c = { - '> *': { - flex: '0 0 auto' - }, - '.ms-Dialog-button': { - color: semanticColors.buttonText - }, - '.ms-Dialog-button:hover': { - color: semanticColors.buttonTextHovered, - borderRadius: effects.roundedCorner2 - } - }, _c["@media (min-width: ".concat((0, _styling.ScreenWidthMinSmall), "px) and (max-width: ").concat((0, _styling.ScreenWidthMaxSmall), "px)")] = { - padding: '15px 8px 0 0' - }, _c) + backgroundColor: thumbCheckedDisabledBackground } + ] ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73MTE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-Dialog' -}; -var getStyles = function(props) { - var _a; - var className = props.className, containerClassName = props.containerClassName, _b = props.dialogDefaultMinWidth, dialogDefaultMinWidth = _b === void 0 ? '288px' : _b, _c = props.dialogDefaultMaxWidth, dialogDefaultMaxWidth = _c === void 0 ? '340px' : _c, hidden = props.hidden, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - root: [ - classNames.root, - theme.fonts.medium, - className - ], - main: [ - { - width: dialogDefaultMinWidth, - outline: '3px solid transparent', - selectors: (_a = {}, _a["@media (min-width: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - width: 'auto', - maxWidth: dialogDefaultMaxWidth, - minWidth: dialogDefaultMinWidth - }, _a) - }, - !hidden && { - display: 'flex' - }, - containerClassName - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8LUqt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Dropdown/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Dropdown/index":"dXF00","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dXF00":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _dropdown = require("./Dropdown"); -parcelHelpers.exportAll(_dropdown, exports); -var _dropdownBase = require("./Dropdown.base"); -parcelHelpers.exportAll(_dropdownBase, exports); -var _dropdownTypes = require("./Dropdown.types"); -parcelHelpers.exportAll(_dropdownTypes, exports); - -},{"./Dropdown":"5RWqB","./Dropdown.base":false,"./Dropdown.types":"deOYw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5RWqB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dropdown", ()=>Dropdown); -var _utilities = require("../../Utilities"); -var _dropdownBase = require("./Dropdown.base"); -var _dropdownStyles = require("./Dropdown.styles"); -var Dropdown = (0, _utilities.styled)((0, _dropdownBase.DropdownBase), (0, _dropdownStyles.getStyles), undefined, { - scope: 'Dropdown' -}); -Dropdown.displayName = 'Dropdown'; - -},{"../../Utilities":"1NZCy","./Dropdown.base":"kXZn2","./Dropdown.styles":"cUemW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kXZn2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DropdownBase", ()=>DropdownBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _callout = require("../../Callout"); -var _button = require("../../Button"); -var _dropdownTypes = require("./Dropdown.types"); -var _dropdownSizePosCache = require("./utilities/DropdownSizePosCache"); -var _focusZone = require("../../FocusZone"); -var _icon = require("../../Icon"); -var _label = require("../../Label"); -var _panel = require("../../Panel"); -var _responsiveMode = require("../../ResponsiveMode"); -var _selectableOption = require("../../SelectableOption"); -// import and use V7 Checkbox to ensure no breaking changes. -var _checkbox = require("../../Checkbox"); -var _utilities1 = require("@fluentui/utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var COMPONENT_NAME = 'Dropdown'; -var getClassNames = (0, _utilities.classNamesFunction)(); -var DEFAULT_PROPS = { - options: [] -}; -function useSelectedItemsState(_a) { - var defaultSelectedKeys = _a.defaultSelectedKeys, selectedKeys = _a.selectedKeys, defaultSelectedKey = _a.defaultSelectedKey, selectedKey = _a.selectedKey, options = _a.options, multiSelect = _a.multiSelect; - var oldOptions = (0, _reactHooks.usePrevious)(options); - var _b = _react.useState([]), selectedIndices = _b[0], setSelectedIndices = _b[1]; - // In controlled component usage where selectedKey is provided, update the selectedIndex - // state if the key or options change. - var selectedKeyPropToUse; - // this does a shallow compare (assumes options are pure), for the purposes of determining whether - // defaultSelectedKey/defaultSelectedKeys are respected. - var didOptionsChange = options !== oldOptions; - if (multiSelect) { - if (didOptionsChange && defaultSelectedKeys !== undefined) selectedKeyPropToUse = defaultSelectedKeys; - else selectedKeyPropToUse = selectedKeys; - } else if (didOptionsChange && defaultSelectedKey !== undefined) selectedKeyPropToUse = defaultSelectedKey; - else selectedKeyPropToUse = selectedKey; - var oldSelectedKeyProp = (0, _reactHooks.usePrevious)(selectedKeyPropToUse); - _react.useEffect(function() { - /** Get all selected indexes for multi-select mode */ var getSelectedIndexes = function() { - if (selectedKeyPropToUse === undefined) { - if (multiSelect) return getAllSelectedIndices(); - var selectedIndex = getSelectedIndex(null); - return selectedIndex !== -1 ? [ - selectedIndex - ] : []; - } else if (!Array.isArray(selectedKeyPropToUse)) { - var selectedIndex = getSelectedIndex(selectedKeyPropToUse); - return selectedIndex !== -1 ? [ - selectedIndex - ] : []; + ], + text: [ + "ms-Toggle-stateText", + { + selectors: { + // Workaround: make rules more specific than Label rules. + "&&": { + padding: "0", + margin: "0 8px", + userSelect: "none", + fontWeight: FontWeights.regular } - var returnValue = []; - for(var _i = 0, selectedKeyPropToUse_1 = selectedKeyPropToUse; _i < selectedKeyPropToUse_1.length; _i++){ - var key = selectedKeyPropToUse_1[_i]; - var selectedIndex = getSelectedIndex(key); - selectedIndex !== -1 && returnValue.push(selectedIndex); + } + }, + disabled && { + selectors: { + "&&": { + color: textDisabledColor, + selectors: (_g = {}, _g[HighContrastSelector] = { + color: "GrayText" + }, _g) } - return returnValue; - }; - var getAllSelectedIndices = function() { - return options.map(function(option, index) { - return option.selected ? index : -1; - }).filter(function(index) { - return index !== -1; - }); - }; - var getSelectedIndex = function(searchKey) { - return (0, _utilities.findIndex)(options, function(option) { - // eslint-disable-next-line eqeqeq - if (searchKey != null) return option.key === searchKey; - else // eslint-disable-next-line deprecation/deprecation - return !!option.selected || !!option.isSelected; - }); - }; - if ((selectedKeyPropToUse !== undefined || !oldOptions) && (selectedKeyPropToUse !== oldSelectedKeyProp || didOptionsChange)) setSelectedIndices(getSelectedIndexes()); - }, [ - didOptionsChange, - multiSelect, - oldOptions, - oldSelectedKeyProp, - options, - selectedKeyPropToUse - ]); - return [ - selectedIndices, - setSelectedIndices - ]; -} -var DropdownBase = _react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var props = (0, _utilities1.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var rootRef = _react.useRef(null); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(forwardedRef, rootRef); - var responsiveMode = (0, _responsiveMode.useResponsiveMode)(rootRef, props.responsiveMode); - var _a = useSelectedItemsState(props), selectedIndices = _a[0], setSelectedIndices = _a[1]; - return _react.createElement(DropdownInternal, (0, _tslib.__assign)({}, props, { - responsiveMode: responsiveMode, - hoisted: { - rootRef: mergedRootRef, - selectedIndices: selectedIndices, - setSelectedIndices: setSelectedIndices + } } - })); -}); -DropdownBase.displayName = 'DropdownBase'; -var DropdownInternal = /** @class */ function(_super) { - (0, _tslib.__extends)(DropdownInternal, _super); - function DropdownInternal(props) { - var _this = _super.call(this, props) || this; - _this._host = _react.createRef(); - _this._focusZone = _react.createRef(); - _this._dropDown = _react.createRef(); - _this._scrollIdleDelay = 250 /* ms */ ; - _this._sizePosCache = new (0, _dropdownSizePosCache.DropdownSizePosCache)(); - _this._requestAnimationFrame = (0, _utilities.safeRequestAnimationFrame)(_this); - /** - * Close menu callout if it is open - */ _this.dismissMenu = function() { - var isOpen = _this.state.isOpen; - isOpen && _this.setState({ - isOpen: false - }); - }; - _this._onChange = function(event, options, index, checked, multiSelect) { - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, onChange = _a.onChange, onChanged = _a.onChanged; - if (onChange || onChanged) { - // for single-select, option passed in will always be selected. - // for multi-select, flip the checked value - var changedOpt = multiSelect ? (0, _tslib.__assign)((0, _tslib.__assign)({}, options[index]), { - selected: !checked - }) : options[index]; - onChange && onChange((0, _tslib.__assign)((0, _tslib.__assign)({}, event), { - target: _this._dropDown.current - }), changedOpt, index); - onChanged && onChanged(changedOpt, index); - } - }; - /** Get either props.placeholder (new name) or props.placeHolder (old name) */ _this._getPlaceholder = function() { - // eslint-disable-next-line deprecation/deprecation - return _this.props.placeholder || _this.props.placeHolder; - }; - /** Get text in dropdown input as a string */ _this._getTitle = function(items, _unused) { - var _a = _this.props.multiSelectDelimiter, multiSelectDelimiter = _a === void 0 ? ', ' : _a; - return items.map(function(i) { - return i.text; - }).join(multiSelectDelimiter); - }; - /** Render text in dropdown input */ _this._onRenderTitle = function(items) { - return _react.createElement(_react.Fragment, null, _this._getTitle(items)); - }; - /** Render placeholder text in dropdown input */ _this._onRenderPlaceholder = function(props) { - if (!_this._getPlaceholder()) return null; - return _react.createElement(_react.Fragment, null, _this._getPlaceholder()); - }; - /** Render Callout or Panel container and pass in list */ _this._onRenderContainer = function(props) { - var calloutProps = props.calloutProps, panelProps = props.panelProps; - var _a = _this.props, responsiveMode = _a.responsiveMode, dropdownWidth = _a.dropdownWidth; - var isSmall = responsiveMode <= (0, _responsiveMode.ResponsiveMode).medium; - var focusTrapZoneProps = { - firstFocusableTarget: "#".concat(_this._listId, "1") - }; - var panelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.panel : undefined; - var calloutWidth = undefined; - var calloutMinWidth = undefined; - if (dropdownWidth === 'auto') calloutMinWidth = _this._dropDown.current ? _this._dropDown.current.clientWidth : 0; - else calloutWidth = dropdownWidth || (_this._dropDown.current ? _this._dropDown.current.clientWidth : 0); - return isSmall ? _react.createElement((0, _panel.Panel), (0, _tslib.__assign)({ - closeButtonAriaLabel: "Close", - focusTrapZoneProps: focusTrapZoneProps, - hasCloseButton: true, - isOpen: true, - isLightDismiss: true, - onDismiss: _this._onDismiss, - styles: panelStyles - }, panelProps), _this._renderFocusableList(props)) : _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - isBeakVisible: false, - gapSpace: 0, - doNotLayer: false, - directionalHintFixed: false, - directionalHint: (0, _callout.DirectionalHint).bottomLeftEdge, - calloutWidth: calloutWidth, - calloutMinWidth: calloutMinWidth - }, calloutProps, { - className: _this._classNames.callout, - target: _this._dropDown.current, - onDismiss: _this._onDismiss, - onScroll: _this._onScroll, - onPositioned: _this._onPositioned - }), _this._renderFocusableList(props)); - }; - /** Render Caret Down Icon */ _this._onRenderCaretDown = function(props) { - return _react.createElement((0, _icon.Icon), { - className: _this._classNames.caretDown, - iconName: "ChevronDown", - "aria-hidden": true - }); - }; - /** Render List of items */ _this._onRenderList = function(props) { - var _a = props.onRenderItem, onRenderItem = _a === void 0 ? _this._onRenderItem : _a; - var queue = { - items: [] - }; - var renderedList = []; - var emptyQueue = function() { - var newGroup = queue.id ? [ - _react.createElement("div", { - role: "group", - key: queue.id, - "aria-labelledby": queue.id - }, queue.items) - ] : queue.items; - renderedList = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], renderedList, true), newGroup, true); - // Flush items and id - queue = { - items: [] - }; - }; - var placeRenderedOptionIntoQueue = function(item, index) { - /* - Case Header - empty queue if it's not already empty - ensure unique ID for header and set queue ID - push header into queue - Case Divider - push divider into queue if not first item - empty queue if not already empty - Default - push item into queue - */ switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - queue.items.length > 0 && emptyQueue(); - var id = _this._id + item.key; - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({ - id: id - }, item), { - index: index - }), _this._onRenderItem)); - queue.id = id; - break; - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - index > 0 && queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); - queue.items.length > 0 && emptyQueue(); - break; - default: - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); + ] + }; + }; + var Toggle = styled(ToggleBase, getStyles, void 0, { + scope: "Toggle" + }); + use(registerIcons$1); + initializeIcons(); + const fluentUI = { + ActionButton, + ChoiceGroup, + ComboBox, + CommandBar, + ContextualMenuItemType, + Customizer, + DefaultButton, + Dialog, + DialogFooter, + DialogType, + Dropdown, + DropdownMenuItemType: SelectableOptionMenuItemType, + Icon, + IconButton, + getFocusStyle, + getTheme, + Label: Label$2, + loadTheme, + Modal, + PrimaryButton, + Slider, + Spinner, + SpinnerSize, + TextField, + Toggle, + registerIcons: registerIcons$1, + unregisterIcons: unregisterIcons$1 + }; + const strings = { + buttonLoadData: "Load data", + buttonThemeDark: "Dark", + buttonThemeLight: "Light", + buttonExport: "Export", + menuUserData: "Use your own data", + menuLocal: "On this computer ...", + menuUrl: "Enter a URL ...", + menuSnapshotsExportAsJSON: "Export as .snapshots JSON file", + menuSnapshotsExportAs: "Export as ...", + menuSnapshotsImport: "Import a .snapshots JSON file", + dialogTitleLocal: "Use a file from your computer", + dialogSubtextLocal: "Your file will not be uploaded, it is only used by the browser on this computer. The currently supported data formats are json (the default), csv (comma-separated values), tsv (tab-separated values), and topojson.", + dialogTitleUrl: "Use a data file via URL", + dialogTitleSnapshotsExport: "Export as", + dialogTitleSnapshotsLocal: "Use a snapshots file from your computer", + dialogSubtextSnapshotsLocal: "Use a file that was previously exported snapshots file. Your file will not be uploaded, it is only used by the browser on this computer.", + dialogTitleSnapshotsUrl: "Use a snapshots file via URL", + dialogLoadButton: "Load", + labelLocal: "[local]", + labelColorFilter: "Note: Colors will be re-mapped to the filter when viewing this saved chart.", + labelPreferences: "Preferences", + labelCompactUI: "Compact UI", + labelCompactUIDescription: "Compact UI hides collapses labels on dropdown menus.", + labelSnapshotsExportHTMLTitle: "HTML", + labelSnapshotsExportHTMLDescription: "A self contained HTML page with current data and snapshots pre-loaded.", + labelSnapshotsExportMarkdownTitle: "Markdown", + labelSnapshotsExportMarkdownDescription: "Markdown is a language used by many blogging platforms. Exports a Markdown file with thumbnails of these snapshots which link back to the SandDance website.", + labelSnapshotsShortcut: "Tip: Your .snapshots JSON file can also be pre-loaded with this", + labelShare: "share", + labelLink: "link", + labelLinkDescription: "A URL to revive this snapshot.", + labelUrl: "Url", + labelDataFormat: "Data format", + labelDataUrlShortcut: "Tip: Your data file can also be pre-loaded with this", + urlInputPlaceholder: "paste URL", + sampleDataPrefix: "Sample data", + localFilePrefix: "Local file", + urlPrefix: "Url", + errorInvalidFileFormat: "Invalid file format", + errorNoUrl: "Please enter a url", + errorUrlHttp: 'Url must begin with "http"', + errorDownloadFailure: "Data could not be prepared for download.", + errorDataSourceFromLocal: (ds) => `Could not load ${ds.type} from local file.`, + errorDataSourceFromUrl: (ds) => `Could not load ${ds.type} from ${ds.dataUrl}` + }; + function invalidUrlError(url) { + if (!url) { + return strings.errorNoUrl; + } + if (url.toLocaleLowerCase().substr(0, 4) !== "http") { + return strings.errorUrlHttp; + } + } + function DataSourceButton(props) { + const picker = props.getPicker(); + if (!picker) + return null; + const menuProps = { + items: [ + { + key: "sample-section", + itemType: base.fluentUI.ContextualMenuItemType.Section, + sectionProps: { + title: strings.sampleDataPrefix, + items: props.dataSources.map((ds, i) => { + const item = { + key: ds.id, + text: ds.displayName, + onClick: (e) => { + picker.changeDataSource(ds); } + }; + return item; + }) + } + }, + { + key: "user-section", + itemType: base.fluentUI.ContextualMenuItemType.Section, + sectionProps: { + topDivider: true, + title: strings.menuUserData, + items: [ + { + key: "local", + text: strings.menuLocal, + onClick: (e) => picker.setState({ dialogMode: "local" }) + }, + { + key: "url", + text: strings.menuUrl, + onClick: (e) => picker.setState({ dialogMode: "url" }) + } + ] + } + } + ] + }; + return React__namespace.createElement(base.fluentUI.PrimaryButton, { className: "sanddance-datasource-picker", text: dataSourcePrefix(props.dataSource.dataSourceType, props.dataSource.displayName), menuProps }); + } + class DataSourcePicker extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + url: "", + urlType: DataSourcePicker.urlTypes[0], + working: false + }; + } + changeDataSource(dataSource) { + this.setState({ working: true }); + return new Promise((resolve2, reject) => { + const uploadFormatError = ""; + const urlError = ""; + this.setState({ uploadFormatError, urlError }); + this.props.changeDataSource(dataSource).then(() => { + this.setState({ + working: false, + uploadFormatError: "", + urlError: "", + dialogMode: null + }); + resolve2(); + }).catch((reason) => { + this.setState({ working: false }); + reject(reason); + }); + }); + } + upload(e) { + if (e.target.files) { + const file = e.target.files[0]; + const split = file.name.split("."); + const type2 = split[split.length - 1]; + if (DataSourcePicker.urlTypes.indexOf(type2) >= 0) { + const reader = new FileReader(); + reader.onload = () => { + const id2 = file.name; + const displayName = file.name; + const rawText = reader.result; + const ds = { + dataSourceType: "local", + displayName, + id: id2, + rawText, + type: type2 }; - // Place options into the queue. Queue will be emptied anytime a Header or Divider is encountered - props.options.forEach(function(item, index) { - placeRenderedOptionIntoQueue(item, index); - }); - // Push remaining items into all renderedList - queue.items.length > 0 && emptyQueue(); - return _react.createElement(_react.Fragment, null, renderedList); - }; - _this._onRenderItem = function(item) { - switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - return _this._renderSeparator(item); - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - return _this._renderHeader(item); - default: - return _this._renderOption(item); - } - }; - _this._renderOption = function(item) { - var _a; - var _b = _this.props, _c = _b.onRenderOption, onRenderOption = _c === void 0 ? _this._onRenderOption : _c, _d = _b.hoisted.selectedIndices, selectedIndices = _d === void 0 ? [] : _d; - var isItemSelected = item.index !== undefined && selectedIndices ? selectedIndices.indexOf(item.index) > -1 : false; - // select the right className based on the combination of selected/disabled - var itemClassName = item.hidden // predicate: item hidden - ? _this._classNames.dropdownItemHidden : isItemSelected && item.disabled === true // predicate: both selected and disabled - ? _this._classNames.dropdownItemSelectedAndDisabled : isItemSelected // predicate: selected only - ? _this._classNames.dropdownItemSelected : item.disabled === true // predicate: disabled only - ? _this._classNames.dropdownItemDisabled : _this._classNames.dropdownItem; - var title = item.title; - // define the id and label id (for multiselect checkboxes) - var id = _this._listId + item.index; - var labelId = (_a = item.id) !== null && _a !== void 0 ? _a : id + '-label'; - var multiSelectItemStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.multiSelectItem : undefined; - return !_this.props.multiSelect ? _react.createElement((0, _button.CommandButton), { - id: id, - key: item.key, - "data-index": item.index, - "data-is-focusable": !item.disabled, - disabled: item.disabled, - className: itemClassName, - onClick: _this._onItemClick(item), - // eslint-disable-next-line react/jsx-no-bind - onMouseEnter: _this._onItemMouseEnter.bind(_this, item), - // eslint-disable-next-line react/jsx-no-bind - onMouseLeave: _this._onMouseItemLeave.bind(_this, item), - // eslint-disable-next-line react/jsx-no-bind - onMouseMove: _this._onItemMouseMove.bind(_this, item), - role: "option", - "aria-selected": isItemSelected ? 'true' : 'false', - ariaLabel: item.ariaLabel, - title: title, - "aria-posinset": _this._sizePosCache.positionInSet(item.index), - "aria-setsize": _this._sizePosCache.optionSetSize - }, onRenderOption(item, _this._onRenderOption)) : _react.createElement((0, _checkbox.Checkbox), { - id: id, - key: item.key, - disabled: item.disabled, - onChange: _this._onItemClick(item), - inputProps: (0, _tslib.__assign)({ - 'aria-selected': isItemSelected, - onMouseEnter: _this._onItemMouseEnter.bind(_this, item), - onMouseLeave: _this._onMouseItemLeave.bind(_this, item), - onMouseMove: _this._onItemMouseMove.bind(_this, item), - role: 'option' - }, { - 'data-index': item.index, - 'data-is-focusable': !(item.disabled || item.hidden) - }), - label: item.text, - title: title, - // eslint-disable-next-line react/jsx-no-bind - onRenderLabel: _this._onRenderItemLabel.bind(_this, (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - id: labelId - })), - className: (0, _utilities.css)(itemClassName, 'is-multi-select'), - checked: isItemSelected, - styles: multiSelectItemStyles, - ariaPositionInSet: !item.hidden ? _this._sizePosCache.positionInSet(item.index) : undefined, - ariaSetSize: !item.hidden ? _this._sizePosCache.optionSetSize : undefined, - ariaLabel: item.ariaLabel, - ariaLabelledBy: item.ariaLabel ? undefined : labelId - }); - }; - /** Render content of item (i.e. text/icon inside of button) */ _this._onRenderOption = function(item) { - return _react.createElement("span", { - className: _this._classNames.dropdownOptionText - }, item.text); - }; - /* - * Render content of a multiselect item label. - * Text within the label is aria-hidden, to prevent duplicate input/label exposure - */ _this._onRenderMultiselectOption = function(item) { - return _react.createElement("span", { - id: item.id, - "aria-hidden": "true", - className: _this._classNames.dropdownOptionText - }, item.text); - }; - /** Render custom label for multiselect checkbox items */ _this._onRenderItemLabel = function(item) { - var _a = _this.props.onRenderOption, onRenderOption = _a === void 0 ? _this._onRenderMultiselectOption : _a; - return onRenderOption(item, _this._onRenderMultiselectOption); + this.changeDataSource(ds); + }; + reader.readAsText(file); + } else { + const uploadFormatError = strings.errorInvalidFileFormat; + this.setState({ uploadFormatError }); + } + } + } + loadUrl() { + if (!this.state.url) { + return this.setState({ urlError: strings.errorNoUrl }); + } + if (this.state.url.toLocaleLowerCase().substr(0, 4) !== "http") { + return this.setState({ urlError: strings.errorUrlHttp }); + } + const { url } = this.state; + const ds = { + dataSourceType: "url", + displayName: url, + id: url, + dataUrl: url, + type: this.state.urlType + }; + this.changeDataSource(ds).catch((e) => { + this.setState({ urlError: e.message }); + }); + } + getUrlShortcut(dataUrl, type2) { + const dss = { + dataSource: { + dataSourceType: "url", + dataUrl, + displayName: dataUrl.substring(dataUrl.lastIndexOf("/") + 1, dataUrl.lastIndexOf(".")), + id: "", + type: type2 + } + }; + return "#" + JSON.stringify(dss); + } + render() { + const closeDialog = () => { + this.setState({ dialogMode: null }); + }; + let shortcut; + if (this.state.url && !invalidUrlError(this.state.url) && !this.state.urlError) { + shortcut = this.getUrlShortcut(this.state.url, this.state.urlType); + } + return [React__namespace.createElement( + Dialog$1, + { key: "local", hidden: !(this.state.dialogMode === "local"), onDismiss: closeDialog, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleLocal, + subText: strings.dialogSubtextLocal + } }, + React__namespace.createElement("input", { type: "file", onChange: (e) => this.upload(e), disabled: this.state.working }), + this.state.uploadFormatError && React__namespace.createElement("div", { className: "error" }, this.state.uploadFormatError) + ), React__namespace.createElement( + Dialog$1, + { key: "url", hidden: !(this.state.dialogMode === "url"), onDismiss: closeDialog, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleUrl + }, buttons: [ + React__namespace.createElement(base.fluentUI.PrimaryButton, { key: 0, onClick: (e) => this.loadUrl(), iconProps: { iconName: "CloudDownload" }, text: strings.dialogLoadButton, disabled: this.state.working }) + ] }, + React__namespace.createElement( + "section", + null, + React__namespace.createElement(base.fluentUI.TextField, { label: strings.labelUrl, placeholder: strings.urlInputPlaceholder, onKeyUp: (e) => e.keyCode === 13 && this.loadUrl(), onChange: (e, url) => this.setState({ url, urlError: "" }), value: this.state.url, disabled: this.state.working }), + this.state.urlError && React__namespace.createElement("div", { className: "error" }, this.state.urlError) + ), + React__namespace.createElement( + "section", + null, + React__namespace.createElement(base.fluentUI.ChoiceGroup, { selectedKey: this.state.urlType, options: DataSourcePicker.urlTypes.map((urlType, i) => { + return { + key: urlType, + text: urlType, + disabled: this.state.working + }; + }), onChange: (ev, option) => this.setState({ urlType: option.text, urlError: "" }), label: strings.labelDataFormat }) + ), + React__namespace.createElement( + "section", + { className: "tip", style: { visibility: !invalidUrlError(this.state.url) && !this.state.urlError ? "visible" : "hidden" } }, + strings.labelDataUrlShortcut, + " ", + React__namespace.createElement("a", { href: shortcut, title: strings.labelLinkDescription, "aria-label": strings.labelLinkDescription }, strings.labelLink) + ) + )]; + } + } + DataSourcePicker.urlTypes = ["json", "csv", "tsv", "topojson"]; + function dataSourcePrefix(dt, displayName) { + switch (dt) { + case "sample": + return `${strings.sampleDataPrefix}: ${displayName}`; + case "local": + return strings.localFilePrefix; + case "url": + return strings.urlPrefix; + } + return strings.buttonLoadData; + } + function downloadData(data2, fileName) { + const a2 = document.createElement("a"); + a2.setAttribute("download", fileName); + document.body.appendChild(a2); + const blob = dataURIToBlob(data2); + a2.href = URL.createObjectURL(blob); + a2.onclick = () => { + requestAnimationFrame(() => URL.revokeObjectURL(a2.href)); + document.body.removeChild(a2); + }; + a2.click(); + } + function dataURIToBlob(binStr) { + const len2 = binStr.length, arr = new Uint8Array(len2); + for (let i = 0; i < len2; i++) { + arr[i] = binStr.charCodeAt(i); + } + return new Blob([arr]); + } + var util = util$4; + function markdownImageLink(alt, imageUrl, link2) { + return `[![${alt}](${imageUrl})](${link2})`; + } + function cleanSnapshots(snapshots) { + const clean = util.clone(snapshots); + clean.forEach((snapshot) => { + if (snapshot.dataSource) { + delete snapshot.dataSource.snapshotsUrl; + } + }); + return clean; + } + function downloadSnapshotsJSON(snapshots, filename) { + const clean = cleanSnapshots(snapshots); + downloadData(JSON.stringify(clean, null, 2), filename); + } + function serializeSnapshot(snapshotWithImage) { + const snapshot = util.clone(snapshotWithImage); + delete snapshot.bgColor; + delete snapshot.image; + if (snapshot.dataSource) { + delete snapshot.dataSource.rawText; + } + return JSON.stringify(snapshot); + } + function isSnapshot(snapshot) { + return snapshot.insight && snapshot.title; + } + function validSnapshots(snapshots) { + if (Array.isArray(snapshots)) { + for (let i = 0; i < snapshots.length; i++) { + if (!isSnapshot(snapshots[i])) { + return false; + } + } + return true; + } + return false; + } + class SnapshotImportLocal extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + working: false + }; + } + readFile(e) { + if (e.target.files) { + this.setState({ working: true }); + const file = e.target.files[0]; + const reader = new FileReader(); + reader.onload = () => { + const rawText = reader.result; + let snapshots; + try { + snapshots = JSON.parse(rawText); + } catch (e3) { + this.setState({ fileFormatError: strings.errorInvalidFileFormat, working: false }); + } + if (validSnapshots(snapshots)) { + this.props.onImportSnapshot(snapshots); + this.setState({ working: false }); + this.props.onDismiss(); + } else { + this.setState({ fileFormatError: strings.errorInvalidFileFormat, working: false }); + } }; - _this._onPositioned = function(positions) { - if (_this._focusZone.current) // Focusing an element can trigger a reflow. Making this wait until there is an animation - // frame can improve perf significantly. - _this._requestAnimationFrame(function() { - var selectedIndices = _this.props.hoisted.selectedIndices; - if (_this._focusZone.current) { - if (!_this._hasBeenPositioned && selectedIndices && selectedIndices[0] && !_this.props.options[selectedIndices[0]].disabled) { - var element = (0, _utilities.getDocument)().getElementById("".concat(_this._id, "-list").concat(selectedIndices[0])); - if (element) _this._focusZone.current.focusElement(element); - _this._hasBeenPositioned = true; - } else _this._focusZone.current.focus(); - } + reader.readAsText(file); + } + } + render() { + return React__namespace.createElement( + "div", + null, + React__namespace.createElement( + Dialog$1, + { hidden: false, onDismiss: this.props.onDismiss, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleSnapshotsLocal, + subText: strings.dialogSubtextSnapshotsLocal + } }, + React__namespace.createElement( + "section", + null, + React__namespace.createElement("input", { type: "file", onChange: (e) => this.readFile(e), disabled: this.state.working }), + this.state.fileFormatError && React__namespace.createElement("div", { className: "error" }, this.state.fileFormatError) + ) + ) + ); + } + } + class SnapshotImportRemote extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + working: false + }; + } + getUrlShortcut() { + const dataSource = util.clone(this.props.dataSource); + delete dataSource.snapshots; + dataSource.snapshotsUrl = this.state.url; + const dss = { + dataSource + }; + return "#" + JSON.stringify(dss); + } + loadUrl() { + const urlError = invalidUrlError(this.state.url); + if (urlError) { + return this.setState({ urlError }); + } + const { url } = this.state; + fetch(url).then((response) => { + if (response.status === 200) { + return response.json(); + } else { + this.setState({ urlError: response.statusText }); + } + }).then((snapshots) => { + if (validSnapshots(snapshots)) { + this.props.onImportSnapshot(snapshots); + this.props.onSnapshotsUrl(url); + this.setState({ working: false }); + this.props.onDismiss(); + } else { + this.setState({ fileFormatError: strings.errorInvalidFileFormat, working: false }); + } + }).catch((e) => { + this.setState({ urlError: e }); + }); + } + render() { + let shortcut; + if (this.props.dataSource.dataSourceType !== "local" && this.state.url && !invalidUrlError(this.state.url) && !this.state.urlError) { + shortcut = this.getUrlShortcut(); + } + return React__namespace.createElement( + "div", + null, + React__namespace.createElement( + Dialog$1, + { hidden: false, onDismiss: this.props.onDismiss, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleSnapshotsUrl + }, buttons: [ + React__namespace.createElement(base.fluentUI.PrimaryButton, { disabled: !this.state.url || !!this.state.urlError, key: 0, onClick: (e) => this.loadUrl(), iconProps: { iconName: "CloudDownload" }, text: strings.dialogLoadButton }) + ] }, + React__namespace.createElement( + "section", + null, + React__namespace.createElement(base.fluentUI.TextField, { label: strings.labelUrl, placeholder: strings.urlInputPlaceholder, onKeyUp: (e) => e.keyCode === 13 && this.loadUrl(), onChange: (e, url) => this.setState({ url, urlError: "" }), value: this.state.url, disabled: this.state.working }), + this.state.urlError && React__namespace.createElement("div", { className: "error" }, this.state.urlError) + ), + this.props.dataSource.dataSourceType !== "local" && React__namespace.createElement( + "section", + { className: "tip", style: { visibility: !invalidUrlError(this.state.url) && !this.state.urlError ? "visible" : "hidden" } }, + strings.labelSnapshotsShortcut, + " ", + React__namespace.createElement("a", { href: shortcut, title: strings.labelLinkDescription, "aria-label": strings.labelLinkDescription }, strings.labelShare) + ) + ) + ); + } + } + function SnapshotExport(props) { + return React__namespace.createElement( + Dialog$1, + { hidden: false, onDismiss: props.onDismiss, dialogContentProps: { + className: `sanddance-dialog ${props.theme} sanddance-export`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleSnapshotsExport + } }, + React__namespace.createElement( + "ul", + null, + React__namespace.createElement( + "li", + null, + React__namespace.createElement("strong", null, strings.labelSnapshotsExportHTMLTitle), + React__namespace.createElement("div", null, strings.labelSnapshotsExportHTMLDescription), + React__namespace.createElement(base.fluentUI.PrimaryButton, { iconProps: { iconName: "Download" }, text: `${strings.buttonExport} ${strings.labelSnapshotsExportHTMLTitle}`, onClick: (e) => { + const clean = cleanSnapshots(props.snapshots); + const html = getEmbedHTML(props.explorer.state.dataContent.data, props.dataSource.displayName, clean); + downloadData(html, `${props.dataSource.displayName}.html`); + } }) + ), + React__namespace.createElement( + "li", + null, + React__namespace.createElement("strong", null, strings.labelSnapshotsExportMarkdownTitle), + React__namespace.createElement("div", null, strings.labelSnapshotsExportMarkdownDescription), + React__namespace.createElement(base.fluentUI.PrimaryButton, { iconProps: { iconName: "Download" }, text: `${strings.buttonExport} ${strings.labelSnapshotsExportMarkdownTitle}`, onClick: (e) => { + const sections = props.snapshots.map((snapshot) => { + const section = [`## ${snapshot.title}`]; + section.push(snapshot.description); + section.push("\n"); + const url = `${location.origin}/#${encodeURIComponent(serializeSnapshot(snapshot))}`; + section.push(markdownImageLink(snapshot.title, snapshot.image, url)); + return section.join("\n"); }); - if (!_this.state.calloutRenderEdge || _this.state.calloutRenderEdge !== positions.targetEdge) _this.setState({ - calloutRenderEdge: positions.targetEdge + sections.unshift(`# ${props.dataSource.displayName}`); + downloadData(sections.join("\n\n"), `${props.dataSource.displayName}.snapshots.md`); + } }) + ) + ) + ); + } + function getViewerOptions(darkTheme2, themeColors2) { + const colors2 = themeColors2 && themeColors2[darkTheme2 ? "dark" : "light"]; + const viewerOptions = { + colors: Object.assign(Object.assign({}, getColorSettingsFromThemePalette(themePalettes[darkTheme2 ? "dark-theme" : ""])), colors2) + }; + return viewerOptions; + } + function getSnapshotFromHash() { + const hash = document.location.hash && document.location.hash.substring(1); + if (hash) { + try { + return JSON.parse(decodeURIComponent(hash)); + } catch (e) { + } + } + } + let snapshotOnLoad = getSnapshotFromHash(); + if (snapshotOnLoad && snapshotOnLoad.dataSource && snapshotOnLoad.dataSource.dataSourceType === "local") { + snapshotOnLoad = null; + } + class SandDanceApp extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + compactUI: !!localStorage.getItem("compactUI"), + dialogMode: null, + dataSource: snapshotOnLoad && snapshotOnLoad.dataSource || props.dataSources[0], + darkTheme: props.darkTheme + }; + this.viewerOptions = getViewerOptions(this.state.darkTheme, props.themeColors); + this.handlers = { + hashchange: (e) => { + const snapshot = getSnapshotFromHash(); + if (snapshot) { + this.explorer && this.explorer.calculate(() => this.hydrateSnapshot(snapshot)); + } + }, + resize: (e) => { + this.explorer && this.explorer.resize(); + } + }; + this.wireEventHandlers(true); + this.changeColorScheme(this.state.darkTheme); + } + wireEventHandlers(add2) { + for (const key2 in this.handlers) { + if (add2) { + window.addEventListener(key2, this.handlers[key2]); + } else { + window.removeEventListener(key2, this.handlers[key2]); + } + } + } + isSameDataSource(a2, b2) { + if (a2.dataSourceType === b2.dataSourceType && a2.type === b2.type && a2.id === b2.id) { + if (a2.dataSourceType === "url") { + return a2.dataUrl === b2.dataUrl; + } + return true; + } + return false; + } + hydrateSnapshot(snapshot, selectedSnapshotIndex = -1) { + if (snapshot.dataSource) { + if (this.isSameDataSource(snapshot.dataSource, this.state.dataSource)) { + if (selectedSnapshotIndex === -1) { + this.explorer.reviveSnapshot(snapshot); + } else { + this.explorer.reviveSnapshot(selectedSnapshotIndex); + } + if (snapshot.dataSource.snapshotsUrl && snapshot.dataSource.snapshotsUrl !== this.state.dataSource.snapshotsUrl) { + fetch(snapshot.dataSource.snapshotsUrl).then((response) => response.json()).then((snapshots) => { + if (validSnapshots(snapshots)) { + this.explorer.setState({ snapshots }); + const dataSource = Object.assign({}, this.state.dataSource); + dataSource.snapshotsUrl = snapshot.dataSource.snapshotsUrl; + this.setState({ dataSource }); + } }); - }; - _this._onItemClick = function(item) { - return function(event) { - if (!item.disabled) { - _this.setSelectedIndex(event, item.index); - if (!_this.props.multiSelect) // only close the callout when it's in single-select mode - _this.setState({ - isOpen: false - }); - } + } + } else { + if (snapshot.dataSource.dataSourceType === "local") { + this.dataSourcePicker.setState({ dialogMode: "local" }); + this.postLoad = (ds) => { + if (this.isSameDataSource(snapshot.dataSource, ds)) { + this.hydrateSnapshot(snapshot, selectedSnapshotIndex); + } }; - }; - /** - * Scroll handler for the callout to make sure the mouse events - * for updating focus are not interacting during scroll - */ _this._onScroll = function() { - var win = (0, _dom.getWindowEx)(_this.context); // can only be called on the client - if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) { - win.clearTimeout(_this._scrollIdleTimeoutId); - _this._scrollIdleTimeoutId = undefined; - } else _this._isScrollIdle = false; - _this._scrollIdleTimeoutId = win.setTimeout(function() { - _this._isScrollIdle = true; - }, _this._scrollIdleDelay); - }; - _this._onMouseItemLeave = function(item, ev) { - if (_this._shouldIgnoreMouseEvent()) return; - /** - * IE11 focus() method forces parents to scroll to top of element. - * Edge and IE expose a setActive() function for focusable divs that - * sets the page focus but does not scroll the parent element. - */ if (_this._host.current) { - if (_this._host.current.setActive) try { - _this._host.current.setActive(); - } catch (e) { - /* no-op */ } - else _this._host.current.focus(); - } - }; - _this._onDismiss = function() { - _this.setState({ - isOpen: false + } else { + this.load(snapshot.dataSource, snapshot.insight).then(() => { + this.explorer.setState({ sideTabId: SideTabId.Snapshots, note: snapshot.description }); + this.explorer.scrollSnapshotIntoView(selectedSnapshotIndex); + }).catch((e) => { + this.loadError(snapshot.dataSource); }); - }; - _this._onDropdownBlur = function(ev) { - // If Dropdown disabled do not proceed with this logic. - var disabled = _this._isDisabled(); - if (disabled) return; - if (_this.state.isOpen) // Do not call onBlur or update focus state when the callout is opened - return; - _this.setState({ - hasFocus: false - }); - if (_this.props.onBlur) _this.props.onBlur(ev); - }; - _this._onDropdownKeyDown = function(ev) { - // If Dropdown disabled do not process any keyboard events. - var disabled = _this._isDisabled(); - if (disabled) return; - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in _shouldHandleKeyUp for reasoning. - _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); - if (_this.props.onKeyDown) { - _this.props.onKeyDown(ev); - if (ev.defaultPrevented) return; - } - var newIndex; - var selectedIndex = _this.props.hoisted.selectedIndices.length ? _this.props.hoisted.selectedIndices[0] : -1; - var containsExpandCollapseModifier = ev.altKey || ev.metaKey; - var isOpen = _this.state.isOpen; - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).enter: - _this.setState({ - isOpen: !isOpen - }); - break; - case (0, _utilities.KeyCodes).escape: - if (!isOpen) return; - _this.setState({ - isOpen: false - }); - break; - case (0, _utilities.KeyCodes).up: - if (containsExpandCollapseModifier) { - if (isOpen) { - _this.setState({ - isOpen: false - }); - break; - } - return; - } - if (_this.props.multiSelect) _this.setState({ - isOpen: true - }); - else if (!_this._isDisabled()) newIndex = _this._moveIndex(ev, -1, selectedIndex - 1, selectedIndex); - break; - case (0, _utilities.KeyCodes).down: - if (containsExpandCollapseModifier) { - ev.stopPropagation(); - ev.preventDefault(); - } - if (containsExpandCollapseModifier && !isOpen || _this.props.multiSelect) _this.setState({ - isOpen: true - }); - else if (!_this._isDisabled()) newIndex = _this._moveIndex(ev, 1, selectedIndex + 1, selectedIndex); - break; - case (0, _utilities.KeyCodes).home: - if (!_this.props.multiSelect) newIndex = _this._moveIndex(ev, 1, 0, selectedIndex); - break; - case (0, _utilities.KeyCodes).end: - if (!_this.props.multiSelect) newIndex = _this._moveIndex(ev, -1, _this.props.options.length - 1, selectedIndex); - break; - case (0, _utilities.KeyCodes).space: - break; - default: - return; - } - if (newIndex !== selectedIndex) { - ev.stopPropagation(); - ev.preventDefault(); - } - }; - _this._onDropdownKeyUp = function(ev) { - // If Dropdown disabled do not process any keyboard events. - var disabled = _this._isDisabled(); - if (disabled) return; - var shouldHandleKey = _this._shouldHandleKeyUp(ev); - var isOpen = _this.state.isOpen; - if (_this.props.onKeyUp) { - _this.props.onKeyUp(ev); - if (ev.defaultPrevented) return; - } - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).space: - _this.setState({ - isOpen: !isOpen - }); - break; - default: - if (shouldHandleKey && isOpen) _this.setState({ - isOpen: false - }); - return; - } - ev.stopPropagation(); - ev.preventDefault(); - }; - _this._onZoneKeyDown = function(ev) { - var _a, _b; - var elementToFocus; - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in _shouldHandleKeyUp for reasoning. - _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); - var containsExpandCollapseModifier = ev.altKey || ev.metaKey; - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).up: - if (containsExpandCollapseModifier) _this.setState({ - isOpen: false - }); - else if (_this._host.current) elementToFocus = (0, _utilities.getLastFocusable)(_this._host.current, _this._host.current.lastChild, true); - break; - // All directional keystrokes should be canceled when the zone is rendered. - // This avoids the body scroll from reacting and thus dismissing the dropdown. - case (0, _utilities.KeyCodes).home: - case (0, _utilities.KeyCodes).end: - case (0, _utilities.KeyCodes).pageUp: - case (0, _utilities.KeyCodes).pageDown: - break; - case (0, _utilities.KeyCodes).down: - if (!containsExpandCollapseModifier && _this._host.current) elementToFocus = (0, _utilities.getFirstFocusable)(_this._host.current, _this._host.current.firstChild, true); - break; - case (0, _utilities.KeyCodes).escape: - _this.setState({ - isOpen: false - }); - break; - case (0, _utilities.KeyCodes).tab: - _this.setState({ - isOpen: false - }); - var document_1 = (0, _utilities.getDocument)(); - if (document_1) { - if (ev.shiftKey) (_a = (0, _utilities1.getPreviousElement)(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _a === void 0 || _a.focus(); - else (_b = (0, _utilities1.getNextElement)(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _b === void 0 || _b.focus(); + } + } + return true; + } + } + load(dataSource, partialInsight) { + dataSource = clone(dataSource); + this.setState({ dataSource }); + document.title = `SandDance - ${dataSource.displayName}`; + return this.explorer.load(dataSource, (columns) => { + return partialInsight || this.props.insights && this.props.insights[dataSource.id]; + }, this.props.initialOptions && deepMerge({}, this.props.initialOptions["*"], this.props.initialOptions[dataSource.id])); + } + dataSourceError(dataSource) { + switch (dataSource.dataSourceType) { + case "local": + return strings.errorDataSourceFromLocal(dataSource); + case "sample": + case "url": + return strings.errorDataSourceFromUrl(dataSource); + } + } + loadError(dataSource) { + const error2 = this.dataSourceError(dataSource); + this.explorer.setState({ errors: [error2] }); + this.setState({ dataSource: { dataSourceType: null, id: null, type: null } }); + } + updateExplorerViewerOptions(viewerOptions) { + this.viewerOptions = viewerOptions; + this.explorer && this.explorer.updateViewerOptions(this.viewerOptions); + } + getThemePalette(darkTheme2) { + const theme = darkTheme2 ? "dark-theme" : ""; + return themePalettes[theme]; + } + changeColorScheme(darkTheme2) { + this.updateExplorerViewerOptions(getViewerOptions(darkTheme2, this.props.themeColors)); + base$3.vega.scheme(ColorScaleNone, (x2) => this.explorer.viewer.options.colors.defaultCube); + this.explorer && this.explorer.viewer && this.explorer.viewer.renderSameLayout(this.viewerOptions); + base.fluentUI.loadTheme({ palette: this.getThemePalette(darkTheme2) }); + } + render() { + const theme = this.state.darkTheme ? "dark-theme" : ""; + const dataSourceProps = { + dataSource: this.state.dataSource, + dataSources: this.props.dataSources, + changeDataSource: (dataSource) => { + document.location.hash = ""; + return this.load(dataSource).then(() => { + if (this.postLoad) { + this.postLoad(dataSource); + this.postLoad = null; + } + }).catch(() => this.loadError(dataSource)); + } + }; + return React__namespace.createElement( + "section", + { className: "sanddance-app" }, + React__namespace.createElement(Explorer, { logoClickTarget: "_self", logoClickUrl: "/SandDance/", theme, snapshotProps: { + modifySnapShot: (snapshot) => { + snapshot.dataSource = this.state.dataSource; + }, + getTopActions: (snapshots) => { + const items = [ + { + key: "import", + text: strings.menuSnapshotsImport, + subMenuProps: { + items: [ + { + key: "import-local", + text: strings.menuLocal, + onClick: () => this.setState({ dialogMode: "import-local" }) + }, + { + key: "import-remote", + text: strings.menuUrl, + onClick: () => this.setState({ dialogMode: "import-remote" }) } - break; - default: - return; - } - if (elementToFocus) elementToFocus.focus(); - ev.stopPropagation(); - ev.preventDefault(); - }; - _this._onZoneKeyUp = function(ev) { - var shouldHandleKey = _this._shouldHandleKeyUp(ev); - if (shouldHandleKey && _this.state.isOpen) { - _this.setState({ - isOpen: false - }); - ev.preventDefault(); - } - }; - _this._onDropdownClick = function(ev) { - if (_this.props.onClick) { - _this.props.onClick(ev); - if (ev.defaultPrevented) return; - } - var isOpen = _this.state.isOpen; - var disabled = _this._isDisabled(); - if (!disabled && !_this._shouldOpenOnFocus()) _this.setState({ - isOpen: !isOpen - }); - _this._isFocusedByClick = false; // reset - }; - _this._onDropdownMouseDown = function() { - _this._isFocusedByClick = true; - }; - _this._onFocus = function(ev) { - var disabled = _this._isDisabled(); - if (!disabled) { - if (_this.props.onFocus) _this.props.onFocus(ev); - var state = { - hasFocus: true - }; - if (_this._shouldOpenOnFocus()) state.isOpen = true; - _this.setState(state); - } - }; - /** - * Because the isDisabled prop is deprecated, we have had to repeat this logic all over the place. - * This helper method avoids all the repetition. - */ _this._isDisabled = function() { - var disabled = _this.props.disabled; - // eslint-disable-next-line deprecation/deprecation - var isDisabled = _this.props.isDisabled; - // Remove this deprecation workaround at 1.0.0 - if (disabled === undefined) disabled = isDisabled; - return disabled; - }; - _this._onRenderLabel = function(props) { - var label = props.label, required = props.required, disabled = props.disabled; - var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined; - return label ? _react.createElement((0, _label.Label), { - className: _this._classNames.label, - id: _this._labelId, - required: required, - styles: labelStyles, - disabled: disabled - }, label) : null; - }; - (0, _utilities.initializeComponentRef)(_this); - var multiSelect = props.multiSelect, selectedKey = props.selectedKey, selectedKeys = props.selectedKeys, defaultSelectedKey = props.defaultSelectedKey, defaultSelectedKeys = props.defaultSelectedKeys, options = props.options; - var warnMultiSelect, warnNotMultiSelect; - _this._id = props.id || (0, _utilities.getId)('Dropdown'); - _this._labelId = _this._id + '-label'; - _this._listId = _this._id + '-list'; - _this._optionId = _this._id + '-option'; - _this._isScrollIdle = true; - _this._hasBeenPositioned = false; - _this._sizePosCache.updateOptions(options); - _this.state = { - isOpen: false, - hasFocus: false, - calloutRenderEdge: undefined - }; - return _this; + ] + } + }, + { + key: "export", + text: strings.menuSnapshotsExportAsJSON, + disabled: snapshots.length === 0, + onClick: () => downloadSnapshotsJSON(snapshots, `${this.state.dataSource.displayName}.snapshots`) + }, + { + key: "export-as", + text: strings.menuSnapshotsExportAs, + disabled: snapshots.length === 0, + onClick: () => this.setState({ dialogMode: "export" }) + } + ]; + return items; + }, + getChildren: (snapshots) => React__namespace.createElement( + "div", + null, + this.state.dialogMode === "import-local" && React__namespace.createElement(SnapshotImportLocal, { theme, dataSource: this.state.dataSource, onImportSnapshot: (snapshots2) => this.explorer.setState({ snapshots: snapshots2 }), onDismiss: () => this.setState({ dialogMode: null }) }), + this.state.dialogMode === "import-remote" && React__namespace.createElement(SnapshotImportRemote, { theme, dataSource: this.state.dataSource, onImportSnapshot: (snapshots2) => this.explorer.setState({ snapshots: snapshots2 }), onSnapshotsUrl: (snapshotsUrl) => { + const dataSource = Object.assign({}, this.state.dataSource); + dataSource.snapshotsUrl = snapshotsUrl; + this.setState({ dataSource }); + }, onDismiss: () => this.setState({ dialogMode: null }) }), + this.state.dialogMode === "export" && React__namespace.createElement(SnapshotExport, { explorer: this.explorer, dataSource: this.state.dataSource, snapshots, onDismiss: () => this.setState({ dialogMode: null }), theme }) + ), + getActions: (snapshot, i) => { + const url = "#" + serializeSnapshot(snapshot); + let element2; + if (snapshot.dataSource && snapshot.dataSource.dataSourceType === "local") { + element2 = React__namespace.createElement("span", { key: `link${i}` }, strings.labelLocal); + } else { + element2 = React__namespace.createElement("a", { key: `link${i}`, href: url, title: strings.labelLinkDescription, "aria-label": strings.labelLinkDescription }, strings.labelShare); + } + return [{ element: element2 }]; + }, + getTitle: (insight) => `${this.state.dataSource.displayName} ${insight.chart}`, + getDescription: (insight) => "" + //TODO create description from filter etc. + }, onSnapshotClick: (snapshot, selectedSnapshotIndex) => this.hydrateSnapshot(snapshot, selectedSnapshotIndex), initialView: "2d", mounted: (e) => { + this.explorer = e; + this.load(this.state.dataSource, snapshotOnLoad && snapshotOnLoad.insight).catch((e3) => { + this.loadError(this.state.dataSource); + }); + this.props.mounted(this); + }, dataExportHandler: (data2, datatype, displayName) => { + try { + downloadData(data2, `${displayName}.${datatype}`); + } catch (e) { + this.explorer.setState({ errors: [strings.errorDownloadFailure] }); + } + }, datasetElement: React__namespace.createElement(DataSourceButton, Object.assign({ getPicker: () => this.dataSourcePicker }, dataSourceProps)), topBarButtonProps: [ + { + key: "theme", + text: this.state.darkTheme ? strings.buttonThemeLight : strings.buttonThemeDark, + iconProps: { + iconName: this.state.darkTheme ? "Sunny" : "ClearNight" + }, + onClick: () => { + const darkTheme2 = !this.state.darkTheme; + this.props.setTheme && this.props.setTheme(darkTheme2); + this.setState({ darkTheme: darkTheme2 }); + this.changeColorScheme(darkTheme2); + } + } + ], viewerOptions: this.viewerOptions, compactUI: this.state.compactUI, additionalSettings: [ + { + groupLabel: strings.labelPreferences, + children: React__namespace.createElement(base.fluentUI.Toggle, { label: strings.labelCompactUI, title: strings.labelCompactUIDescription, checked: this.state.compactUI, onChange: (e, checked) => { + if (checked) { + localStorage.setItem("compactUI", "true"); + } else { + localStorage.removeItem("compactUI"); + } + this.setState({ compactUI: checked }); + } }) + } + ] }), + React__namespace.createElement(DataSourcePicker, Object.assign({ ref: (dsp) => { + if (dsp && !this.dataSourcePicker) + this.dataSourcePicker = dsp; + }, theme }, dataSourceProps)) + ); } - Object.defineProperty(DropdownInternal.prototype, "selectedOptions", { - /** - * All selected options - */ get: function() { - var _a = this.props, options = _a.options, selectedIndices = _a.hoisted.selectedIndices; - return (0, _selectableOption.getAllSelectedOptions)(options, selectedIndices); - }, - enumerable: false, - configurable: true - }); - DropdownInternal.prototype.componentWillUnmount = function() { - clearTimeout(this._scrollIdleTimeoutId); + } + function accessor(fn2, fields, name) { + fn2.fields = fields || []; + fn2.fname = name; + return fn2; + } + function accessorName(fn2) { + return fn2 == null ? null : fn2.fname; + } + function accessorFields(fn2) { + return fn2 == null ? null : fn2.fields; + } + function getter$1(path2) { + return path2.length === 1 ? get1(path2[0]) : getN(path2); + } + const get1 = (field2) => function(obj2) { + return obj2[field2]; + }; + const getN = (path2) => { + const len2 = path2.length; + return function(obj2) { + for (let i = 0; i < len2; ++i) { + obj2 = obj2[path2[i]]; + } + return obj2; }; - DropdownInternal.prototype.componentDidUpdate = function(prevProps, prevState) { - if (prevState.isOpen === true && this.state.isOpen === false) { - this._gotMouseMove = false; - this._hasBeenPositioned = false; - if (this.props.onDismiss) this.props.onDismiss(); + }; + function error(message) { + throw Error(message); + } + function splitAccessPath(p) { + const path2 = [], n = p.length; + let q = null, b2 = 0, s2 = "", i, j, c2; + p = p + ""; + function push2() { + path2.push(s2 + p.substring(i, j)); + s2 = ""; + i = j + 1; + } + for (i = j = 0; j < n; ++j) { + c2 = p[j]; + if (c2 === "\\") { + s2 += p.substring(i, j++); + i = j; + } else if (c2 === q) { + push2(); + q = null; + b2 = -1; + } else if (q) { + continue; + } else if (i === b2 && c2 === '"') { + i = j + 1; + q = c2; + } else if (i === b2 && c2 === "'") { + i = j + 1; + q = c2; + } else if (c2 === "." && !b2) { + if (j > i) { + push2(); + } else { + i = j + 1; + } + } else if (c2 === "[") { + if (j > i) push2(); + b2 = i = j + 1; + } else if (c2 === "]") { + if (!b2) error("Access path missing open bracket: " + p); + if (b2 > 0) push2(); + b2 = 0; + i = j + 1; + } + } + if (b2) error("Access path missing closing bracket: " + p); + if (q) error("Access path missing closing quote: " + p); + if (j > i) { + j++; + push2(); + } + return path2; + } + function field$1(field2, name, opt) { + const path2 = splitAccessPath(field2); + field2 = path2.length === 1 ? path2[0] : field2; + return accessor((opt && opt.get || getter$1)(path2), [field2], name || field2); + } + const id = field$1("id"); + const identity$2 = accessor((_) => _, [], "identity"); + const zero$1 = accessor(() => 0, [], "zero"); + const one$1 = accessor(() => 1, [], "one"); + const truthy = accessor(() => true, [], "true"); + const falsy = accessor(() => false, [], "false"); + const DisallowedObjectProperties = /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + function log$1$1(method2, level, input) { + const args = [level].concat([].slice.call(input)); + console[method2].apply(console, args); + } + const None$2 = 0; + const Error$1 = 1; + const Warn = 2; + const Info = 3; + const Debug = 4; + function logger(_, method2, handler = log$1$1) { + let level = _ || None$2; + return { + level(_2) { + if (arguments.length) { + level = +_2; + return this; + } else { + return level; } + }, + error() { + if (level >= Error$1) handler(method2 || "error", "ERROR", arguments); + return this; + }, + warn() { + if (level >= Warn) handler(method2 || "warn", "WARN", arguments); + return this; + }, + info() { + if (level >= Info) handler(method2 || "log", "INFO", arguments); + return this; + }, + debug() { + if (level >= Debug) handler(method2 || "log", "DEBUG", arguments); + return this; + } }; - DropdownInternal.prototype.render = function() { - var id = this._id; - var props = this.props; - var className = props.className, label = props.label, options = props.options, ariaLabel = props.ariaLabel, required = props.required, errorMessage = props.errorMessage, propStyles = props.styles, theme = props.theme, panelProps = props.panelProps, calloutProps = props.calloutProps, _a = props.onRenderTitle, onRenderTitle = _a === void 0 ? this._getTitle : _a, _b = props.onRenderContainer, onRenderContainer = _b === void 0 ? this._onRenderContainer : _b, _c = props.onRenderCaretDown, onRenderCaretDown = _c === void 0 ? this._onRenderCaretDown : _c, _d = props.onRenderLabel, onRenderLabel = _d === void 0 ? this._onRenderLabel : _d, _e = props.onRenderItem, onRenderItem = _e === void 0 ? this._onRenderItem : _e, selectedIndices = props.hoisted.selectedIndices; - var _f = this.state, isOpen = _f.isOpen, calloutRenderEdge = _f.calloutRenderEdge, hasFocus = _f.hasFocus; - // eslint-disable-next-line deprecation/deprecation - var onRenderPlaceholder = props.onRenderPlaceholder || props.onRenderPlaceHolder || this._getPlaceholder; - // If our cached options are out of date update our cache - if (options !== this._sizePosCache.cachedOptions) this._sizePosCache.updateOptions(options); - var selectedOptions = (0, _selectableOption.getAllSelectedOptions)(options, selectedIndices); - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)); - var disabled = this._isDisabled(); - var errorMessageId = id + '-errorMessage'; - this._classNames = getClassNames(propStyles, { - theme: theme, - className: className, - hasError: !!(errorMessage && errorMessage.length > 0), - hasLabel: !!label, - isOpen: isOpen, - required: required, - disabled: disabled, - isRenderingPlaceholder: !selectedOptions.length, - panelClassName: panelProps ? panelProps.className : undefined, - calloutClassName: calloutProps ? calloutProps.className : undefined, - calloutRenderEdge: calloutRenderEdge - }); - var hasErrorMessage = !!errorMessage && errorMessage.length > 0; - return _react.createElement("div", { - className: this._classNames.root, - ref: this.props.hoisted.rootRef, - "aria-owns": isOpen ? this._listId : undefined - }, onRenderLabel(this.props, this._onRenderLabel), _react.createElement("div", (0, _tslib.__assign)({ - "data-is-focusable": !disabled, - "data-ktp-target": true, - ref: this._dropDown, - id: id, - tabIndex: disabled ? -1 : 0, - role: "combobox", - "aria-haspopup": "listbox", - "aria-expanded": isOpen ? 'true' : 'false', - "aria-label": ariaLabel, - "aria-labelledby": label && !ariaLabel ? (0, _utilities.mergeAriaAttributeValues)(this._labelId, this._optionId) : undefined, - "aria-describedby": hasErrorMessage ? this._id + '-errorMessage' : undefined, - "aria-required": required, - "aria-disabled": disabled, - "aria-controls": isOpen ? this._listId : undefined - }, divProps, { - className: this._classNames.dropdown, - onBlur: this._onDropdownBlur, - onKeyDown: this._onDropdownKeyDown, - onKeyUp: this._onDropdownKeyUp, - onClick: this._onDropdownClick, - onMouseDown: this._onDropdownMouseDown, - onFocus: this._onFocus - }), _react.createElement("span", { - id: this._optionId, - className: this._classNames.title, - "aria-live": hasFocus ? 'polite' : undefined, - "aria-atomic": hasFocus ? true : undefined, - "aria-invalid": hasErrorMessage - }, // If option is selected render title, otherwise render the placeholder text - selectedOptions.length ? onRenderTitle(selectedOptions, this._onRenderTitle) : onRenderPlaceholder(props, this._onRenderPlaceholder)), _react.createElement("span", { - className: this._classNames.caretDownWrapper - }, onRenderCaretDown(props, this._onRenderCaretDown))), isOpen && onRenderContainer((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - onDismiss: this._onDismiss, - onRenderItem: onRenderItem - }), this._onRenderContainer), hasErrorMessage && _react.createElement("div", { - role: "alert", - id: errorMessageId, - className: this._classNames.errorMessage - }, errorMessage)); - }; - DropdownInternal.prototype.focus = function(shouldOpenOnFocus) { - if (this._dropDown.current) { - this._dropDown.current.focus(); - if (shouldOpenOnFocus) this.setState({ - isOpen: true - }); + } + var isArray = Array.isArray; + function isObject(_) { + return _ === Object(_); + } + const isLegalKey = (key2) => key2 !== "__proto__"; + function mergeConfig(...configs) { + return configs.reduce((out, source2) => { + for (const key2 in source2) { + if (key2 === "signals") { + out.signals = mergeNamed(out.signals, source2.signals); + } else { + const r = key2 === "legend" ? { + layout: 1 + } : key2 === "style" ? true : null; + writeConfig(out, key2, source2[key2], r); + } + } + return out; + }, {}); + } + function writeConfig(output2, key2, value2, recurse2) { + if (!isLegalKey(key2)) return; + let k, o; + if (isObject(value2) && !isArray(value2)) { + o = isObject(output2[key2]) ? output2[key2] : output2[key2] = {}; + for (k in value2) { + if (recurse2 && (recurse2 === true || recurse2[k])) { + writeConfig(o, k, value2[k]); + } else if (isLegalKey(k)) { + o[k] = value2[k]; } + } + } else { + output2[key2] = value2; + } + } + function mergeNamed(a2, b2) { + if (a2 == null) return b2; + const map2 = {}, out = []; + function add2(_) { + if (!map2[_.name]) { + map2[_.name] = 1; + out.push(_); + } + } + b2.forEach(add2); + a2.forEach(add2); + return out; + } + function peek$1(array2) { + return array2[array2.length - 1]; + } + function toNumber(_) { + return _ == null || _ === "" ? null : +_; + } + const exp$2 = (sign2) => (x2) => sign2 * Math.exp(x2); + const log$3 = (sign2) => (x2) => Math.log(sign2 * x2); + const symlog = (c2) => (x2) => Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); + const symexp = (c2) => (x2) => Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + const pow$3 = (exponent2) => (x2) => x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); + function pan(domain2, delta, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), dd = (d1 - d0) * delta; + return [ground(d0 - dd), ground(d1 - dd)]; + } + function panLinear(domain2, delta) { + return pan(domain2, delta, toNumber, identity$2); + } + function panLog(domain2, delta) { + var sign2 = Math.sign(domain2[0]); + return pan(domain2, delta, log$3(sign2), exp$2(sign2)); + } + function panPow(domain2, delta, exponent2) { + return pan(domain2, delta, pow$3(exponent2), pow$3(1 / exponent2)); + } + function panSymlog(domain2, delta, constant2) { + return pan(domain2, delta, symlog(constant2), symexp(constant2)); + } + function zoom(domain2, anchor, scale2, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; + return [ground(da + (d0 - da) * scale2), ground(da + (d1 - da) * scale2)]; + } + function zoomLinear(domain2, anchor, scale2) { + return zoom(domain2, anchor, scale2, toNumber, identity$2); + } + function zoomLog(domain2, anchor, scale2) { + const sign2 = Math.sign(domain2[0]); + return zoom(domain2, anchor, scale2, log$3(sign2), exp$2(sign2)); + } + function zoomPow(domain2, anchor, scale2, exponent2) { + return zoom(domain2, anchor, scale2, pow$3(exponent2), pow$3(1 / exponent2)); + } + function zoomSymlog(domain2, anchor, scale2, constant2) { + return zoom(domain2, anchor, scale2, symlog(constant2), symexp(constant2)); + } + function quarter(date2) { + return 1 + ~~(new Date(date2).getMonth() / 3); + } + function utcquarter(date2) { + return 1 + ~~(new Date(date2).getUTCMonth() / 3); + } + function array$4(_) { + return _ != null ? isArray(_) ? _ : [_] : []; + } + function clampRange(range2, min2, max2) { + let lo = range2[0], hi = range2[1], span2; + if (hi < lo) { + span2 = hi; + hi = lo; + lo = span2; + } + span2 = hi - lo; + return span2 >= max2 - min2 ? [min2, max2] : [lo = Math.min(Math.max(lo, min2), max2 - span2), lo + span2]; + } + function isFunction(_) { + return typeof _ === "function"; + } + const DESCENDING = "descending"; + function compare$1(fields, orders, opt) { + opt = opt || {}; + orders = array$4(orders) || []; + const ord = [], get2 = [], fmap = {}, gen = opt.comparator || comparator; + array$4(fields).forEach((f, i) => { + if (f == null) return; + ord.push(orders[i] === DESCENDING ? -1 : 1); + get2.push(f = isFunction(f) ? f : field$1(f, null, opt)); + (accessorFields(f) || []).forEach((_) => fmap[_] = 1); + }); + return get2.length === 0 ? null : accessor(gen(get2, ord), Object.keys(fmap)); + } + const ascending$1 = (u2, v) => (u2 < v || u2 == null) && v != null ? -1 : (u2 > v || v == null) && u2 != null ? 1 : (v = v instanceof Date ? +v : v, u2 = u2 instanceof Date ? +u2 : u2) !== u2 && v === v ? -1 : v !== v && u2 === u2 ? 1 : 0; + const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); + const compare1 = (field2, order) => function(a2, b2) { + return ascending$1(field2(a2), field2(b2)) * order; + }; + const compareN = (fields, orders, n) => { + orders.push(0); + return function(a2, b2) { + let f, c2 = 0, i = -1; + while (c2 === 0 && ++i < n) { + f = fields[i]; + c2 = ascending$1(f(a2), f(b2)); + } + return c2 * orders[i]; }; - DropdownInternal.prototype.setSelectedIndex = function(event, index) { - var _a = this.props, options = _a.options, selectedKey = _a.selectedKey, selectedKeys = _a.selectedKeys, multiSelect = _a.multiSelect, notifyOnReselect = _a.notifyOnReselect, _b = _a.hoisted.selectedIndices, selectedIndices = _b === void 0 ? [] : _b; - var checked = selectedIndices ? selectedIndices.indexOf(index) > -1 : false; - var newIndexes = []; - index = Math.max(0, Math.min(options.length - 1, index)); - // If this is a controlled component then no state change should take place. - if (selectedKey !== undefined || selectedKeys !== undefined) { - this._onChange(event, options, index, checked, multiSelect); - return; + }; + function constant$4(_) { + return isFunction(_) ? _ : () => _; + } + function debounce(delay, handler) { + let tid; + return (e) => { + if (tid) clearTimeout(tid); + tid = setTimeout(() => (handler(e), tid = null), delay); + }; + } + function extend(_) { + for (let x2, k, i = 1, len2 = arguments.length; i < len2; ++i) { + x2 = arguments[i]; + for (k in x2) { + _[k] = x2[k]; + } + } + return _; + } + function extent(array2, f) { + let i = 0, n, v, min2, max2; + if (array2 && (n = array2.length)) { + if (f == null) { + for (v = array2[i]; i < n && (v == null || v !== v); v = array2[++i]) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = array2[i]; + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + } + } else { + for (v = f(array2[i]); i < n && (v == null || v !== v); v = f(array2[++i])) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = f(array2[i]); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + } + } + } + return [min2, max2]; + } + function extentIndex(array2, f) { + const n = array2.length; + let i = -1, a2, b2, c2, u2, v; + if (f == null) { + while (++i < n) { + b2 = array2[i]; + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; + } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = array2[i]; + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } + } + } + } else { + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; + } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } + } + } + } + return [u2, v]; + } + function has$1(object2, property2) { + return Object.hasOwn(object2, property2); + } + const NULL = {}; + function fastmap(input) { + let obj2 = {}, test2; + function has$1$1(key2) { + return has$1(obj2, key2) && obj2[key2] !== NULL; + } + const map2 = { + size: 0, + empty: 0, + object: obj2, + has: has$1$1, + get(key2) { + return has$1$1(key2) ? obj2[key2] : void 0; + }, + set(key2, value2) { + if (!has$1$1(key2)) { + ++map2.size; + if (obj2[key2] === NULL) --map2.empty; + } + obj2[key2] = value2; + return this; + }, + delete(key2) { + if (has$1$1(key2)) { + --map2.size; + ++map2.empty; + obj2[key2] = NULL; } - if (!multiSelect && !notifyOnReselect && index === selectedIndices[0]) return; - else if (multiSelect) { - newIndexes = selectedIndices ? this._copyArray(selectedIndices) : []; - if (checked) { - var position = newIndexes.indexOf(index); - if (position > -1) // unchecked the current one - newIndexes.splice(position, 1); - } else // add the new selected index into the existing one - newIndexes.push(index); - } else // Set the selected option if this is an uncontrolled component - newIndexes = [ - index - ]; - event.persist(); - // Call onChange after state is updated - this.props.hoisted.setSelectedIndices(newIndexes); - this._onChange(event, options, index, checked, multiSelect); - }; - DropdownInternal.prototype._copyArray = function(array) { - var newArray = []; - for(var _i = 0, array_1 = array; _i < array_1.length; _i++){ - var element = array_1[_i]; - newArray.push(element); + return this; + }, + clear() { + map2.size = map2.empty = 0; + map2.object = obj2 = {}; + }, + test(_) { + if (arguments.length) { + test2 = _; + return map2; + } else { + return test2; } - return newArray; - }; - /** - * Finds the next valid Dropdown option and sets the selected index to it. - * @param stepValue - Value of how many items the function should traverse. Should be -1 or 1. - * @param index - Index of where the search should start - * @param selectedIndex - The selectedIndex Dropdown's state - * @returns The next valid dropdown option's index - */ DropdownInternal.prototype._moveIndex = function(event, stepValue, index, selectedIndex) { - var options = this.props.options; - // Return selectedIndex if nothing has changed or options is empty - if (selectedIndex === index || options.length === 0) return selectedIndex; - // If the user is pressing the up or down key we want to make - // sure that the dropdown cycles through the options without - // causing the screen to scroll. In _onDropdownKeyDown - // at the very end is a check to see if newIndex !== selectedIndex. - // If the index is less than 0 and we set it back to 0, then - // newIndex will equal selectedIndex and not stop the action - // of the key press happening and vice versa for indexes greater - // than or equal to the options length. - if (index >= options.length) index = 0; - else if (index < 0) index = options.length - 1; - var stepCounter = 0; - // If current index is a header or divider, or disabled, increment by step - while(options[index].itemType === (0, _dropdownTypes.DropdownMenuItemType).Header || options[index].itemType === (0, _dropdownTypes.DropdownMenuItemType).Divider || options[index].disabled){ - // If stepCounter exceeds length of options, then return selectedIndex (-1) - if (stepCounter >= options.length) return selectedIndex; - // If index + stepValue is out of bounds, wrap around - if (index + stepValue < 0) index = options.length; - else if (index + stepValue >= options.length) index = -1; - index = index + stepValue; - stepCounter++; - } - this.setSelectedIndex(event, index); - return index; - }; - /** Wrap item list in a FocusZone */ DropdownInternal.prototype._renderFocusableList = function(props) { - var _a = props.onRenderList, onRenderList = _a === void 0 ? this._onRenderList : _a, label = props.label, ariaLabel = props.ariaLabel, multiSelect = props.multiSelect; - return _react.createElement("div", { - className: this._classNames.dropdownItemsWrapper, - onKeyDown: this._onZoneKeyDown, - onKeyUp: this._onZoneKeyUp, - ref: this._host, - tabIndex: 0 - }, _react.createElement((0, _focusZone.FocusZone), { - ref: this._focusZone, - direction: (0, _focusZone.FocusZoneDirection).vertical, - id: this._listId, - className: this._classNames.dropdownItems, - role: "listbox", - "aria-label": ariaLabel, - "aria-labelledby": label && !ariaLabel ? this._labelId : undefined, - "aria-multiselectable": multiSelect - }, onRenderList(props, this._onRenderList))); - }; - DropdownInternal.prototype._renderSeparator = function(item) { - var index = item.index, key = item.key; - var separatorClassName = item.hidden ? this._classNames.dropdownDividerHidden : this._classNames.dropdownDivider; - if (index > 0) return _react.createElement("div", { - role: "presentation", - key: key, - className: separatorClassName - }); - return null; - }; - DropdownInternal.prototype._renderHeader = function(item) { - var _a = this.props.onRenderOption, onRenderOption = _a === void 0 ? this._onRenderOption : _a; - var key = item.key, id = item.id; - var headerClassName = item.hidden ? this._classNames.dropdownItemHeaderHidden : this._classNames.dropdownItemHeader; - return _react.createElement("div", { - id: id, - key: key, - className: headerClassName - }, onRenderOption(item, this._onRenderOption)); - }; - DropdownInternal.prototype._onItemMouseEnter = function(item, ev) { - if (this._shouldIgnoreMouseEvent()) return; - var targetElement = ev.currentTarget; - targetElement.focus(); - }; - DropdownInternal.prototype._onItemMouseMove = function(item, ev) { - var doc = (0, _dom.getDocumentEx)(this.context); // can only be called on the client - var targetElement = ev.currentTarget; - this._gotMouseMove = true; - if (!this._isScrollIdle || doc.activeElement === targetElement) return; - targetElement.focus(); + }, + clean() { + const next = {}; + let size = 0; + for (const key2 in obj2) { + const value2 = obj2[key2]; + if (value2 !== NULL && (!test2 || !test2(value2))) { + next[key2] = value2; + ++size; + } + } + map2.size = size; + map2.empty = 0; + map2.object = obj2 = next; + } }; - DropdownInternal.prototype._shouldIgnoreMouseEvent = function() { - return !this._isScrollIdle || !this._gotMouseMove; + if (input) Object.keys(input).forEach((key2) => { + map2.set(key2, input[key2]); + }); + return map2; + } + function flush(range2, value2, threshold2, left, right, center) { + if (!threshold2 && threshold2 !== 0) return center; + const t = +threshold2; + let a2 = range2[0], b2 = peek$1(range2), l; + if (b2 < a2) { + l = a2; + a2 = b2; + b2 = l; + } + l = Math.abs(value2 - a2); + const r = Math.abs(b2 - value2); + return l < r && l <= t ? left : r <= t ? right : center; + } + function inherits(child, parent, members) { + const proto = child.prototype = Object.create(parent.prototype); + Object.defineProperty(proto, "constructor", { + value: child, + writable: true, + enumerable: true, + configurable: true + }); + return extend(proto, members); + } + function inrange(value2, range2, left, right) { + let r0 = range2[0], r1 = range2[range2.length - 1], t; + if (r0 > r1) { + t = r0; + r0 = r1; + r1 = t; + } + left = left === void 0 || left; + right = right === void 0 || right; + return (left ? r0 <= value2 : r0 < value2) && (right ? value2 <= r1 : value2 < r1); + } + function isBoolean$1(_) { + return typeof _ === "boolean"; + } + function isDate$1(_) { + return Object.prototype.toString.call(_) === "[object Date]"; + } + function isIterable(_) { + return _ && isFunction(_[Symbol.iterator]); + } + function isNumber$1(_) { + return typeof _ === "number"; + } + function isRegExp(_) { + return Object.prototype.toString.call(_) === "[object RegExp]"; + } + function isString(_) { + return typeof _ === "string"; + } + function key(fields, flat, opt) { + if (fields) { + fields = flat ? array$4(fields).map((f) => f.replace(/\\(.)/g, "$1")) : array$4(fields); + } + const len2 = fields && fields.length, gen = opt && opt.get || getter$1, map2 = (f) => gen(flat ? [f] : splitAccessPath(f)); + let fn2; + if (!len2) { + fn2 = function() { + return ""; + }; + } else if (len2 === 1) { + const get2 = map2(fields[0]); + fn2 = function(_) { + return "" + get2(_); + }; + } else { + const get2 = fields.map(map2); + fn2 = function(_) { + let s2 = "" + get2[0](_), i = 0; + while (++i < len2) s2 += "|" + get2[i](_); + return s2; + }; + } + return accessor(fn2, fields, "key"); + } + function lerp(array2, frac) { + const lo = array2[0], hi = peek$1(array2), f = +frac; + return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); + } + const DEFAULT_MAX_SIZE = 1e4; + function lruCache(maxsize) { + maxsize = +maxsize || DEFAULT_MAX_SIZE; + let curr, prev, size; + const clear = () => { + curr = {}; + prev = {}; + size = 0; + }; + const update2 = (key2, value2) => { + if (++size > maxsize) { + prev = curr; + curr = {}; + size = 1; + } + return curr[key2] = value2; }; - /** - * Returns true if the key for the event is alt (Mac option) or meta (Mac command). - */ DropdownInternal.prototype._isAltOrMeta = function(ev) { - // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).alt || ev.key === 'Meta'; + clear(); + return { + clear, + has: (key2) => has$1(curr, key2) || has$1(prev, key2), + get: (key2) => has$1(curr, key2) ? curr[key2] : has$1(prev, key2) ? update2(key2, prev[key2]) : void 0, + set: (key2, value2) => has$1(curr, key2) ? curr[key2] = value2 : update2(key2, value2) }; - /** - * We close the menu on key up only if ALL of the following are true: - * - Most recent key down was alt or meta (command) - * - The alt/meta key down was NOT followed by some other key (such as down/up arrow to - * expand/collapse the menu) - * - We're not on a Mac (or iOS) - * - * This is because on Windows, pressing alt moves focus to the application menu bar or similar, - * closing any open context menus. There is not a similar behavior on Macs. - */ DropdownInternal.prototype._shouldHandleKeyUp = function(ev) { - var keyPressIsAltOrMetaAlone = this._lastKeyDownWasAltOrMeta && this._isAltOrMeta(ev); - this._lastKeyDownWasAltOrMeta = false; - return !!keyPressIsAltOrMetaAlone && !((0, _utilities.isMac)() || (0, _utilities.isIOS)()); + } + function merge$2(compare2, array0, array1, output2) { + const n0 = array0.length, n1 = array1.length; + if (!n1) return array0; + if (!n0) return array1; + const merged = output2 || new array0.constructor(n0 + n1); + let i0 = 0, i1 = 0, i = 0; + for (; i0 < n0 && i1 < n1; ++i) { + merged[i] = compare2(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; + } + for (; i0 < n0; ++i0, ++i) { + merged[i] = array0[i0]; + } + for (; i1 < n1; ++i1, ++i) { + merged[i] = array1[i1]; + } + return merged; + } + function repeat(str, reps) { + let s2 = ""; + while (--reps >= 0) s2 += str; + return s2; + } + function pad$1(str, length2, padchar, align) { + const c2 = padchar || " ", s2 = str + "", n = length2 - s2.length; + return n <= 0 ? s2 : align === "left" ? repeat(c2, n) + s2 : align === "center" ? repeat(c2, ~~(n / 2)) + s2 + repeat(c2, Math.ceil(n / 2)) : s2 + repeat(c2, n); + } + function span(array2) { + return array2 && peek$1(array2) - array2[0] || 0; + } + function $(x2) { + return isArray(x2) ? `[${x2.map((v) => v === null ? "null" : $(v))}]` : isObject(x2) || isString(x2) ? ( + // Output valid JSON and JS source strings. + // See https://github.com/judofyr/timeless/blob/master/posts/json-isnt-a-javascript-subset.md + JSON.stringify(x2).replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029") + ) : x2; + } + function toBoolean(_) { + return _ == null || _ === "" ? null : !_ || _ === "false" || _ === "0" ? false : !!_; + } + const defaultParser = (_) => isNumber$1(_) ? _ : isDate$1(_) ? _ : Date.parse(_); + function toDate(_, parser2) { + parser2 = parser2 || defaultParser; + return _ == null || _ === "" ? null : parser2(_); + } + function toString(_) { + return _ == null || _ === "" ? null : _ + ""; + } + function toSet(_) { + const s2 = {}, n = _.length; + for (let i = 0; i < n; ++i) s2[_[i]] = true; + return s2; + } + function truncate$1(str, length2, align, ellipsis) { + const e = ellipsis != null ? ellipsis : "…", s2 = str + "", n = s2.length, l = Math.max(0, length2 - e.length); + return n <= length2 ? s2 : align === "left" ? e + s2.slice(n - l) : align === "center" ? s2.slice(0, Math.ceil(l / 2)) + e + s2.slice(n - ~~(l / 2)) : s2.slice(0, l) + e; + } + function visitArray(array2, filter2, visitor) { + if (array2) { + if (filter2) { + const n = array2.length; + for (let i = 0; i < n; ++i) { + const t = filter2(array2[i]); + if (t) visitor(t, i, array2); + } + } else { + array2.forEach(visitor); + } + } + } + var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; + function objectConverter(columns) { + return new Function("d", "return {" + columns.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + '] || ""'; + }).join(",") + "}"); + } + function customConverter(columns, f) { + var object2 = objectConverter(columns); + return function(row, i) { + return f(object2(row), i, columns); }; - /** - * Returns true if dropdown should set to open on focus. - * Otherwise, isOpen state should be toggled on click - */ DropdownInternal.prototype._shouldOpenOnFocus = function() { - var hasFocus = this.state.hasFocus; - var openOnKeyboardFocus = this.props.openOnKeyboardFocus; - return !this._isFocusedByClick && openOnKeyboardFocus === true && !hasFocus; + } + function inferColumns(rows) { + var columnSet = /* @__PURE__ */ Object.create(null), columns = []; + rows.forEach(function(row) { + for (var column in row) { + if (!(column in columnSet)) { + columns.push(columnSet[column] = column); + } + } + }); + return columns; + } + function pad(value2, width2) { + var s2 = value2 + "", length2 = s2.length; + return length2 < width2 ? new Array(width2 - length2 + 1).join(0) + s2 : s2; + } + function formatYear(year) { + return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); + } + function formatDate(date2) { + var hours = date2.getUTCHours(), minutes = date2.getUTCMinutes(), seconds = date2.getUTCSeconds(), milliseconds = date2.getUTCMilliseconds(); + return isNaN(date2) ? "Invalid Date" : formatYear(date2.getUTCFullYear()) + "-" + pad(date2.getUTCMonth() + 1, 2) + "-" + pad(date2.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); + } + function dsvFormat(delimiter) { + var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); + function parse2(text2, f) { + var convert2, columns, rows = parseRows(text2, function(row, i) { + if (convert2) return convert2(row, i - 1); + columns = row, convert2 = f ? customConverter(row, f) : objectConverter(row); + }); + rows.columns = columns || []; + return rows; + } + function parseRows(text2, f) { + var rows = [], N = text2.length, I = 0, n = 0, t, eof = N <= 0, eol = false; + if (text2.charCodeAt(N - 1) === NEWLINE) --N; + if (text2.charCodeAt(N - 1) === RETURN) --N; + function token() { + if (eof) return EOF; + if (eol) return eol = false, EOL; + var i, j = I, c2; + if (text2.charCodeAt(j) === QUOTE) { + while (I++ < N && text2.charCodeAt(I) !== QUOTE || text2.charCodeAt(++I) === QUOTE) ; + if ((i = I) >= N) eof = true; + else if ((c2 = text2.charCodeAt(I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } + return text2.slice(j + 1, i - 1).replace(/""/g, '"'); + } + while (I < N) { + if ((c2 = text2.charCodeAt(i = I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } else if (c2 !== DELIMITER) continue; + return text2.slice(j, i); + } + return eof = true, text2.slice(j, N); + } + while ((t = token()) !== EOF) { + var row = []; + while (t !== EOL && t !== EOF) row.push(t), t = token(); + if (f && (row = f(row, n++)) == null) continue; + rows.push(row); + } + return rows; + } + function preformatBody(rows, columns) { + return rows.map(function(row) { + return columns.map(function(column) { + return formatValue2(row[column]); + }).join(delimiter); + }); + } + function format2(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return [columns.map(formatValue2).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); + } + function formatBody(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return preformatBody(rows, columns).join("\n"); + } + function formatRows(rows) { + return rows.map(formatRow).join("\n"); + } + function formatRow(row) { + return row.map(formatValue2).join(delimiter); + } + function formatValue2(value2) { + return value2 == null ? "" : value2 instanceof Date ? formatDate(value2) : reFormat.test(value2 += "") ? '"' + value2.replace(/"/g, '""') + '"' : value2; + } + return { + parse: parse2, + parseRows, + format: format2, + formatBody, + formatRows, + formatRow, + formatValue: formatValue2 }; - DropdownInternal.defaultProps = { - options: [] + } + function identity$1(x2) { + return x2; + } + function transform$3(transform2) { + if (transform2 == null) return identity$1; + var x02, y02, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1]; + return function(input, i) { + if (!i) x02 = y02 = 0; + var j = 2, n = input.length, output2 = new Array(n); + output2[0] = (x02 += input[0]) * kx + dx; + output2[1] = (y02 += input[1]) * ky + dy; + while (j < n) output2[j] = input[j], ++j; + return output2; }; - DropdownInternal.contextType = (0, _reactWindowProvider.WindowContext); - return DropdownInternal; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Callout":"g2jXk","../../Button":"1457j","./Dropdown.types":"deOYw","./utilities/DropdownSizePosCache":"52sRB","../../FocusZone":"k9nPH","../../Icon":"hiMUP","../../Label":"8FZUu","../../Panel":"9ziwh","../../ResponsiveMode":"cFpqz","../../SelectableOption":"jqbZ7","../../Checkbox":"dwb0b","@fluentui/utilities":"55bj3","@fluentui/react-hooks":"2LHjM","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"deOYw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DropdownMenuItemType", ()=>(0, _selectableOption.SelectableOptionMenuItemType)); -var _selectableOption = require("../../SelectableOption"); - -},{"../../SelectableOption":"jqbZ7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"52sRB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DropdownSizePosCache", ()=>DropdownSizePosCache); -var _tslib = require("tslib"); -var _dropdownTypes = require("../Dropdown.types"); -/** - * A utility class to cache size and position in cache. - * - * Dropdown options has non-selectable display types. It is therefore not cheap to determine - * the total number of actual selectable options as well as the position an option is in the - * list of options - O(n) cost for each lookup. - * - * Given that we potentially have to make this determination on every single render pass, this - * cache should provide a little bit of relief. - */ var DropdownSizePosCache = /** @class */ function() { - function DropdownSizePosCache() { - this._size = 0; + } + function reverse$1(array2, n) { + var t, j = array2.length, i = j - n; + while (i < --j) t = array2[i], array2[i++] = array2[j], array2[j] = t; + } + function feature(topology, o) { + if (typeof o === "string") o = topology.objects[o]; + return o.type === "GeometryCollection" ? { type: "FeatureCollection", features: o.geometries.map(function(o2) { + return feature$1(topology, o2); + }) } : feature$1(topology, o); + } + function feature$1(topology, o) { + var id2 = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o); + return id2 == null && bbox == null ? { type: "Feature", properties, geometry } : bbox == null ? { type: "Feature", id: id2, properties, geometry } : { type: "Feature", id: id2, bbox, properties, geometry }; + } + function object(topology, o) { + var transformPoint = transform$3(topology.transform), arcs = topology.arcs; + function arc2(i, points2) { + if (points2.length) points2.pop(); + for (var a2 = arcs[i < 0 ? ~i : i], k = 0, n = a2.length; k < n; ++k) { + points2.push(transformPoint(a2[k], k)); + } + if (i < 0) reverse$1(points2, n); + } + function point2(p) { + return transformPoint(p); + } + function line2(arcs2) { + var points2 = []; + for (var i = 0, n = arcs2.length; i < n; ++i) arc2(arcs2[i], points2); + if (points2.length < 2) points2.push(points2[0]); + return points2; + } + function ring(arcs2) { + var points2 = line2(arcs2); + while (points2.length < 4) points2.push(points2[0]); + return points2; + } + function polygon(arcs2) { + return arcs2.map(ring); + } + function geometry(o2) { + var type2 = o2.type, coordinates; + switch (type2) { + case "GeometryCollection": + return { type: type2, geometries: o2.geometries.map(geometry) }; + case "Point": + coordinates = point2(o2.coordinates); + break; + case "MultiPoint": + coordinates = o2.coordinates.map(point2); + break; + case "LineString": + coordinates = line2(o2.arcs); + break; + case "MultiLineString": + coordinates = o2.arcs.map(line2); + break; + case "Polygon": + coordinates = polygon(o2.arcs); + break; + case "MultiPolygon": + coordinates = o2.arcs.map(polygon); + break; + default: + return null; + } + return { type: type2, coordinates }; } - /** - * Invalidates the cache and recalculate the size of selectable options. - */ DropdownSizePosCache.prototype.updateOptions = function(options) { - var displayOnlyOptionsCache = []; - var notSelectableOptionsCache = []; - var size = 0; - for(var i = 0; i < options.length; i++){ - var _a = options[i], itemType = _a.itemType, hidden = _a.hidden; - if (itemType === (0, _dropdownTypes.DropdownMenuItemType).Divider || itemType === (0, _dropdownTypes.DropdownMenuItemType).Header) { - displayOnlyOptionsCache.push(i); - notSelectableOptionsCache.push(i); - } else if (hidden) notSelectableOptionsCache.push(i); - else size++; - } - this._size = size; - this._displayOnlyOptionsCache = displayOnlyOptionsCache; - this._notSelectableOptionsCache = notSelectableOptionsCache; - this._cachedOptions = (0, _tslib.__spreadArray)([], options, true); - }; - Object.defineProperty(DropdownSizePosCache.prototype, "optionSetSize", { - /** - * The size of all the selectable options. - */ get: function() { - return this._size; - }, - enumerable: false, - configurable: true + return geometry(o); + } + function stitch(topology, arcs) { + var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; + arcs.forEach(function(i, j) { + var arc2 = topology.arcs[i < 0 ? ~i : i], t; + if (arc2.length < 3 && !arc2[1][0] && !arc2[1][1]) { + t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; + } }); - Object.defineProperty(DropdownSizePosCache.prototype, "cachedOptions", { - /** - * The chached options array. - */ get: function() { - return this._cachedOptions; - }, - enumerable: false, - configurable: true + arcs.forEach(function(i) { + var e = ends(i), start = e[0], end = e[1], f, g; + if (f = fragmentByEnd[start]) { + delete fragmentByEnd[f.end]; + f.push(i); + f.end = end; + if (g = fragmentByStart[end]) { + delete fragmentByStart[g.start]; + var fg = g === f ? f : f.concat(g); + fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; + } else { + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; + } + } else if (f = fragmentByStart[end]) { + delete fragmentByStart[f.start]; + f.unshift(i); + f.start = start; + if (g = fragmentByEnd[start]) { + delete fragmentByEnd[g.end]; + var gf = g === f ? f : g.concat(f); + fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; + } else { + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; + } + } else { + f = [i]; + fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; + } }); - /** - * Returns the position of this option element relative to the full set of selectable option elements. - * Note: the first selectable element is position 1 in the set. - * @param index The raw index of the option element. - */ DropdownSizePosCache.prototype.positionInSet = function(index) { - if (index === undefined) return undefined; - // we could possibly memoize this too but this should be good enough, most of the time (the expectation is that - // when you have a lot of options, the selectable options will heavily dominate over the non-selectable options. - var offset = 0; - while(index > this._notSelectableOptionsCache[offset])offset++; - if (this._displayOnlyOptionsCache[offset] === index) throw new Error("Unexpected: Option at index ".concat(index, " is not a selectable element.")); - if (this._notSelectableOptionsCache[offset] === index) return undefined; - return index - offset + 1; - }; - return DropdownSizePosCache; -}(); - -},{"tslib":"9gizs","../Dropdown.types":"deOYw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ziwh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Panel/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Panel/index":"5kPn7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5kPn7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _panel = require("./Panel"); -parcelHelpers.exportAll(_panel, exports); -var _panelBase = require("./Panel.base"); -parcelHelpers.exportAll(_panelBase, exports); -var _panelTypes = require("./Panel.types"); -parcelHelpers.exportAll(_panelTypes, exports); - -},{"./Panel":"7cUsY","./Panel.base":false,"./Panel.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7cUsY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Panel", ()=>Panel); -var _utilities = require("../../Utilities"); -var _panelBase = require("./Panel.base"); -var _panelStyles = require("./Panel.styles"); -var Panel = (0, _utilities.styled)((0, _panelBase.PanelBase), (0, _panelStyles.getStyles), undefined, { - scope: 'Panel' -}); - -},{"../../Utilities":"1NZCy","./Panel.base":"a9rbr","./Panel.styles":"6pUAU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a9rbr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PanelBase", ()=>PanelBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _button = require("../../Button"); -var _layer = require("../../Layer"); -var _overlay = require("../../Overlay"); -var _popup = require("../../Popup"); -var _utilities = require("../../Utilities"); -var _index = require("../FocusTrapZone/index"); -var _panelTypes = require("./Panel.types"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var COMPONENT_NAME = 'Panel'; -var PanelVisibilityState; -(function(PanelVisibilityState) { - PanelVisibilityState[PanelVisibilityState["closed"] = 0] = "closed"; - PanelVisibilityState[PanelVisibilityState["animatingOpen"] = 1] = "animatingOpen"; - PanelVisibilityState[PanelVisibilityState["open"] = 2] = "open"; - PanelVisibilityState[PanelVisibilityState["animatingClosed"] = 3] = "animatingClosed"; -})(PanelVisibilityState || (PanelVisibilityState = {})); -var PanelBase = /** @class */ function(_super) { - (0, _tslib.__extends)(PanelBase, _super); - function PanelBase(props) { - var _this = _super.call(this, props) || this; - _this._panel = _react.createRef(); - _this._animationCallback = null; - _this._hasCustomNavigation = !!(_this.props.onRenderNavigation || _this.props.onRenderNavigationContent); - _this.dismiss = function(ev) { - if (_this.props.onDismiss && _this.isActive) _this.props.onDismiss(ev); - if (!ev || ev && !ev.defaultPrevented) _this.close(); - }; - // Allow the user to scroll within the panel but not on the body - _this._allowScrollOnPanel = function(elt) { - if (elt) { - if (_this._allowTouchBodyScroll) (0, _utilities.allowOverscrollOnElement)(elt, _this._events); - else (0, _utilities.allowScrollOnElement)(elt, _this._events); - } else _this._events.off(_this._scrollableContent); - _this._scrollableContent = elt; - }; - _this._onRenderNavigation = function(props) { - if (!_this.props.onRenderNavigationContent && !_this.props.onRenderNavigation && !_this.props.hasCloseButton) return null; - var _a = _this.props.onRenderNavigationContent, onRenderNavigationContent = _a === void 0 ? _this._onRenderNavigationContent : _a; - return _react.createElement("div", { - className: _this._classNames.navigation - }, onRenderNavigationContent(props, _this._onRenderNavigationContent)); - }; - _this._onRenderNavigationContent = function(props) { - var _a; - var closeButtonAriaLabel = props.closeButtonAriaLabel, hasCloseButton = props.hasCloseButton, _b = props.onRenderHeader, onRenderHeader = _b === void 0 ? _this._onRenderHeader : _b; - if (hasCloseButton) { - var iconButtonStyles = (_a = _this._classNames.subComponentStyles) === null || _a === void 0 ? void 0 : _a.closeButton(); - return _react.createElement(_react.Fragment, null, !_this._hasCustomNavigation && onRenderHeader(_this.props, _this._onRenderHeader, _this._headerTextId), _react.createElement((0, _button.IconButton), { - styles: iconButtonStyles, - className: _this._classNames.closeButton, - onClick: _this._onPanelClick, - ariaLabel: closeButtonAriaLabel, - title: closeButtonAriaLabel, - "data-is-visible": true, - iconProps: { - iconName: 'Cancel' - } - })); - } - return null; - }; - _this._onRenderHeader = function(props, defaultRender, headerTextId) { - var headerText = props.headerText, _a = props.headerTextProps, headerTextProps = _a === void 0 ? {} : _a; - if (headerText) return _react.createElement("div", { - className: _this._classNames.header - }, _react.createElement("div", (0, _tslib.__assign)({ - id: headerTextId, - role: "heading", - "aria-level": 1 - }, headerTextProps, { - className: (0, _utilities.css)(_this._classNames.headerText, headerTextProps.className) - }), headerText)); - return null; - }; - _this._onRenderBody = function(props) { - return _react.createElement("div", { - className: _this._classNames.content - }, props.children); - }; - _this._onRenderFooter = function(props) { - var _a = _this.props.onRenderFooterContent, onRenderFooterContent = _a === void 0 ? null : _a; - if (onRenderFooterContent) return _react.createElement("div", { - className: _this._classNames.footer - }, _react.createElement("div", { - className: _this._classNames.footerInner - }, onRenderFooterContent())); - return null; - }; - _this._animateTo = function(newVisibilityState) { - if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpen) _this.props.onOpen(); - _this._animationCallback = _this._async.setTimeout(function() { - _this.setState({ - visibility: newVisibilityState - }); - _this._onTransitionComplete(newVisibilityState); - }, 200); - }; - _this._clearExistingAnimationTimer = function() { - if (_this._animationCallback !== null) _this._async.clearTimeout(_this._animationCallback); - }; - _this._onPanelClick = function(ev) { - _this.dismiss(ev); - }; - _this._onTransitionComplete = function(newVisibilityState) { - _this._updateFooterPosition(); - if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpened) _this.props.onOpened(); - if (newVisibilityState === PanelVisibilityState.closed && _this.props.onDismissed) _this.props.onDismissed(); - }; - var _a = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a === void 0 ? false : _a; - _this._allowTouchBodyScroll = allowTouchBodyScroll; - (0, _utilities.initializeComponentRef)(_this); - (0, _utilities.warnDeprecations)(COMPONENT_NAME, props, { - ignoreExternalFocusing: 'focusTrapZoneProps', - forceFocusInsideTrap: 'focusTrapZoneProps', - firstFocusableSelector: 'focusTrapZoneProps' + function ends(i) { + var arc2 = topology.arcs[i < 0 ? ~i : i], p02 = arc2[0], p1; + if (topology.transform) p1 = [0, 0], arc2.forEach(function(dp) { + p1[0] += dp[0], p1[1] += dp[1]; + }); + else p1 = arc2[arc2.length - 1]; + return i < 0 ? [p1, p02] : [p02, p1]; + } + function flush2(fragmentByEnd2, fragmentByStart2) { + for (var k in fragmentByEnd2) { + var f = fragmentByEnd2[k]; + delete fragmentByStart2[f.start]; + delete f.start; + delete f.end; + f.forEach(function(i) { + stitchedArcs[i < 0 ? ~i : i] = 1; }); - _this.state = { - isFooterSticky: false, - // intentionally ignore props so animation takes place during componentDidMount - visibility: PanelVisibilityState.closed, - id: (0, _utilities.getId)('Panel') - }; - return _this; + fragments.push(f); + } + } + flush2(fragmentByEnd, fragmentByStart); + flush2(fragmentByStart, fragmentByEnd); + arcs.forEach(function(i) { + if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); + }); + return fragments; + } + function mesh(topology) { + return object(topology, meshArcs.apply(this, arguments)); + } + function meshArcs(topology, object2, filter2) { + var arcs, i, n; + if (arguments.length > 1) arcs = extractArcs(topology, object2, filter2); + else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; + return { type: "MultiLineString", arcs: stitch(topology, arcs) }; + } + function extractArcs(topology, object2, filter2) { + var arcs = [], geomsByArc = [], geom; + function extract0(i) { + var j = i < 0 ? ~i : i; + (geomsByArc[j] || (geomsByArc[j] = [])).push({ i, g: geom }); + } + function extract1(arcs2) { + arcs2.forEach(extract0); + } + function extract2(arcs2) { + arcs2.forEach(extract1); + } + function extract3(arcs2) { + arcs2.forEach(extract2); + } + function geometry(o) { + switch (geom = o, o.type) { + case "GeometryCollection": + o.geometries.forEach(geometry); + break; + case "LineString": + extract1(o.arcs); + break; + case "MultiLineString": + case "Polygon": + extract2(o.arcs); + break; + case "MultiPolygon": + extract3(o.arcs); + break; + } + } + geometry(object2); + geomsByArc.forEach(filter2 == null ? function(geoms) { + arcs.push(geoms[0].i); + } : function(geoms) { + if (filter2(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); + }); + return arcs; + } + const YEAR = "year"; + const QUARTER = "quarter"; + const MONTH = "month"; + const WEEK = "week"; + const DATE = "date"; + const DAY = "day"; + const DAYOFYEAR = "dayofyear"; + const HOURS = "hours"; + const MINUTES = "minutes"; + const SECONDS = "seconds"; + const MILLISECONDS = "milliseconds"; + const TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS]; + const UNITS = TIME_UNITS.reduce((o, u2, i) => (o[u2] = 1 + i, o), {}); + function timeUnits(units) { + const u2 = array$4(units).slice(), m2 = {}; + if (!u2.length) error("Missing time unit."); + u2.forEach((unit2) => { + if (has$1(UNITS, unit2)) { + m2[unit2] = 1; + } else { + error(`Invalid time unit: ${unit2}.`); + } + }); + const numTypes = (m2[WEEK] || m2[DAY] ? 1 : 0) + (m2[QUARTER] || m2[MONTH] || m2[DATE] ? 1 : 0) + (m2[DAYOFYEAR] ? 1 : 0); + if (numTypes > 1) { + error(`Incompatible time units: ${units}`); + } + u2.sort((a2, b2) => UNITS[a2] - UNITS[b2]); + return u2; + } + const defaultSpecifiers = { + [YEAR]: "%Y ", + [QUARTER]: "Q%q ", + [MONTH]: "%b ", + [DATE]: "%d ", + [WEEK]: "W%U ", + [DAY]: "%a ", + [DAYOFYEAR]: "%j ", + [HOURS]: "%H:00", + [MINUTES]: "00:%M", + [SECONDS]: ":%S", + [MILLISECONDS]: ".%L", + [`${YEAR}-${MONTH}`]: "%Y-%m ", + [`${YEAR}-${MONTH}-${DATE}`]: "%Y-%m-%d ", + [`${HOURS}-${MINUTES}`]: "%H:%M" + }; + function timeUnitSpecifier(units, specifiers) { + const s2 = extend({}, defaultSpecifiers, specifiers), u2 = timeUnits(units), n = u2.length; + let fmt = "", start = 0, end, key2; + for (start = 0; start < n; ) { + for (end = u2.length; end > start; --end) { + key2 = u2.slice(start, end).join("-"); + if (s2[key2] != null) { + fmt += s2[key2]; + start = end; + break; + } + } + } + return fmt.trim(); + } + const t0 = /* @__PURE__ */ new Date(); + function localYear(y2) { + t0.setFullYear(y2); + t0.setMonth(0); + t0.setDate(1); + t0.setHours(0, 0, 0, 0); + return t0; + } + function dayofyear(d2) { + return localDayOfYear(new Date(d2)); + } + function week(d2) { + return localWeekNum(new Date(d2)); + } + function localDayOfYear(d2) { + return timeDay.count(localYear(d2.getFullYear()) - 1, d2); + } + function localWeekNum(d2) { + return timeSunday.count(localYear(d2.getFullYear()) - 1, d2); + } + function localFirst(y2) { + return localYear(y2).getDay(); + } + function localDate(y2, m2, d2, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(-1, m2, d2, H, M2, S, L); + date2.setFullYear(y2); + return date2; + } + return new Date(y2, m2, d2, H, M2, S, L); + } + function utcdayofyear(d2) { + return utcDayOfYear(new Date(d2)); + } + function utcweek(d2) { + return utcWeekNum(new Date(d2)); + } + function utcDayOfYear(d2) { + const y2 = Date.UTC(d2.getUTCFullYear(), 0, 1); + return utcDay.count(y2 - 1, d2); + } + function utcWeekNum(d2) { + const y2 = Date.UTC(d2.getUTCFullYear(), 0, 1); + return utcSunday.count(y2 - 1, d2); + } + function utcFirst(y2) { + t0.setTime(Date.UTC(y2, 0, 1)); + return t0.getUTCDay(); + } + function utcDate(y2, m2, d2, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(Date.UTC(-1, m2, d2, H, M2, S, L)); + date2.setUTCFullYear(d2.y); + return date2; + } + return new Date(Date.UTC(y2, m2, d2, H, M2, S, L)); + } + function floor(units, step, get2, inv, newDate2) { + const s2 = step || 1, b2 = peek$1(units), _ = (unit2, p, key2) => { + key2 = key2 || unit2; + return getUnit(get2[key2], inv[key2], unit2 === b2 && s2, p); + }; + const t = /* @__PURE__ */ new Date(), u2 = toSet(units), y2 = u2[YEAR] ? _(YEAR) : constant$4(2012), m2 = u2[MONTH] ? _(MONTH) : u2[QUARTER] ? _(QUARTER) : zero$1, d2 = u2[WEEK] && u2[DAY] ? _(DAY, 1, WEEK + DAY) : u2[WEEK] ? _(WEEK, 1) : u2[DAY] ? _(DAY, 1) : u2[DATE] ? _(DATE, 1) : u2[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one$1, H = u2[HOURS] ? _(HOURS) : zero$1, M2 = u2[MINUTES] ? _(MINUTES) : zero$1, S = u2[SECONDS] ? _(SECONDS) : zero$1, L = u2[MILLISECONDS] ? _(MILLISECONDS) : zero$1; + return function(v) { + t.setTime(+v); + const year = y2(t); + return newDate2(year, m2(t), d2(t, year), H(t), M2(t), S(t), L(t)); + }; + } + function getUnit(f, inv, step, phase) { + const u2 = step <= 1 ? f : phase ? (d2, y2) => phase + step * Math.floor((f(d2, y2) - phase) / step) : (d2, y2) => step * Math.floor(f(d2, y2) / step); + return inv ? (d2, y2) => inv(u2(d2, y2), y2) : u2; + } + function weekday(week2, day, firstDay) { + return day + week2 * 7 - (firstDay + 6) % 7; + } + const localGet = { + [YEAR]: (d2) => d2.getFullYear(), + [QUARTER]: (d2) => Math.floor(d2.getMonth() / 3), + [MONTH]: (d2) => d2.getMonth(), + [DATE]: (d2) => d2.getDate(), + [HOURS]: (d2) => d2.getHours(), + [MINUTES]: (d2) => d2.getMinutes(), + [SECONDS]: (d2) => d2.getSeconds(), + [MILLISECONDS]: (d2) => d2.getMilliseconds(), + [DAYOFYEAR]: (d2) => localDayOfYear(d2), + [WEEK]: (d2) => localWeekNum(d2), + [WEEK + DAY]: (d2, y2) => weekday(localWeekNum(d2), d2.getDay(), localFirst(y2)), + [DAY]: (d2, y2) => weekday(1, d2.getDay(), localFirst(y2)) + }; + const localInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, localFirst(y2)) + }; + function timeFloor(units, step) { + return floor(units, step || 1, localGet, localInv, localDate); + } + const utcGet = { + [YEAR]: (d2) => d2.getUTCFullYear(), + [QUARTER]: (d2) => Math.floor(d2.getUTCMonth() / 3), + [MONTH]: (d2) => d2.getUTCMonth(), + [DATE]: (d2) => d2.getUTCDate(), + [HOURS]: (d2) => d2.getUTCHours(), + [MINUTES]: (d2) => d2.getUTCMinutes(), + [SECONDS]: (d2) => d2.getUTCSeconds(), + [MILLISECONDS]: (d2) => d2.getUTCMilliseconds(), + [DAYOFYEAR]: (d2) => utcDayOfYear(d2), + [WEEK]: (d2) => utcWeekNum(d2), + [DAY]: (d2, y2) => weekday(1, d2.getUTCDay(), utcFirst(y2)), + [WEEK + DAY]: (d2, y2) => weekday(utcWeekNum(d2), d2.getUTCDay(), utcFirst(y2)) + }; + const utcInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, utcFirst(y2)) + }; + function utcFloor(units, step) { + return floor(units, step || 1, utcGet, utcInv, utcDate); + } + const timeIntervals = { + [YEAR]: timeYear, + [QUARTER]: timeMonth.every(3), + [MONTH]: timeMonth, + [WEEK]: timeSunday, + [DATE]: timeDay, + [DAY]: timeDay, + [DAYOFYEAR]: timeDay, + [HOURS]: timeHour, + [MINUTES]: timeMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + const utcIntervals = { + [YEAR]: utcYear, + [QUARTER]: utcMonth.every(3), + [MONTH]: utcMonth, + [WEEK]: utcSunday, + [DATE]: utcDay, + [DAY]: utcDay, + [DAYOFYEAR]: utcDay, + [HOURS]: utcHour, + [MINUTES]: utcMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + function timeInterval(unit2) { + return timeIntervals[unit2]; + } + function utcInterval(unit2) { + return utcIntervals[unit2]; + } + function offset$3(ival, date2, step) { + return ival ? ival.offset(date2, step) : void 0; + } + function timeOffset(unit2, date2, step) { + return offset$3(timeInterval(unit2), date2, step); + } + function utcOffset(unit2, date2, step) { + return offset$3(utcInterval(unit2), date2, step); + } + function sequence$1(ival, start, stop2, step) { + return ival ? ival.range(start, stop2, step) : void 0; + } + function timeSequence(unit2, start, stop2, step) { + return sequence$1(timeInterval(unit2), start, stop2, step); + } + function utcSequence(unit2, start, stop2, step) { + return sequence$1(utcInterval(unit2), start, stop2, step); + } + const durationSecond = 1e3, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; + const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [YEAR, WEEK], Month = [YEAR, MONTH], Year = [YEAR]; + const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]]; + function bin$1(opt) { + const ext = opt.extent, max2 = opt.maxbins || 40, target2 = Math.abs(span(ext)) / max2; + let i = bisector((i2) => i2[2]).right(intervals, target2), units, step; + if (i === intervals.length) { + units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max2); + } else if (i) { + i = intervals[target2 / intervals[i - 1][2] < intervals[i][2] / target2 ? i - 1 : i]; + units = i[0]; + step = i[1]; + } else { + units = Milli; + step = Math.max(tickStep(ext[0], ext[1], max2), 1); } - PanelBase.getDerivedStateFromProps = function(nextProps, prevState) { - if (nextProps.isOpen === undefined) return null; // no state update - if (nextProps.isOpen && (prevState.visibility === PanelVisibilityState.closed || prevState.visibility === PanelVisibilityState.animatingClosed)) return { - visibility: PanelVisibilityState.animatingOpen - }; - if (!nextProps.isOpen && (prevState.visibility === PanelVisibilityState.open || prevState.visibility === PanelVisibilityState.animatingOpen)) return { - visibility: PanelVisibilityState.animatingClosed - }; - return null; + return { + units, + step }; - PanelBase.prototype.componentDidMount = function() { - this._async = new (0, _utilities.Async)(this); - this._events = new (0, _utilities.EventGroup)(this); - var win = (0, _dom.getWindowEx)(this.context); - var doc = (0, _dom.getDocumentEx)(this.context); - this._events.on(win, 'resize', this._updateFooterPosition); - if (this._shouldListenForOuterClick(this.props)) this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, 'mousedown', this._dismissOnOuterClick, true); - if (this.props.isOpen) this.setState({ - visibility: PanelVisibilityState.animatingOpen - }); + } + function memoize(method2) { + const cache2 = {}; + return (spec) => cache2[spec] || (cache2[spec] = method2(spec)); + } + function trimZeroes(numberFormat, decimalChar) { + return (x2) => { + const str = numberFormat(x2), dec = str.indexOf(decimalChar); + if (dec < 0) return str; + let idx = rightmostDigit(str, dec); + const end = idx < str.length ? str.slice(idx) : ""; + while (--idx > dec) if (str[idx] !== "0") { + ++idx; + break; + } + return str.slice(0, idx) + end; }; - PanelBase.prototype.componentDidUpdate = function(previousProps, previousState) { - var shouldListenOnOuterClick = this._shouldListenForOuterClick(this.props); - var previousShouldListenOnOuterClick = this._shouldListenForOuterClick(previousProps); - if (this.state.visibility !== previousState.visibility) { - this._clearExistingAnimationTimer(); - if (this.state.visibility === PanelVisibilityState.animatingOpen) this._animateTo(PanelVisibilityState.open); - else if (this.state.visibility === PanelVisibilityState.animatingClosed) this._animateTo(PanelVisibilityState.closed); + } + function rightmostDigit(str, dec) { + let i = str.lastIndexOf("e"), c2; + if (i > 0) return i; + for (i = str.length; --i > dec; ) { + c2 = str.charCodeAt(i); + if (c2 >= 48 && c2 <= 57) return i + 1; + } + } + function numberLocale(locale2) { + const format2 = memoize(locale2.format), formatPrefix2 = locale2.formatPrefix; + return { + format: format2, + formatPrefix: formatPrefix2, + formatFloat(spec) { + const s2 = formatSpecifier$1(spec || ","); + if (s2.precision == null) { + s2.precision = 12; + switch (s2.type) { + case "%": + s2.precision -= 2; + break; + case "e": + s2.precision -= 1; + break; + } + return trimZeroes( + format2(s2), + // number format + format2(".1f")(1)[1] + // decimal point character + ); + } else { + return format2(s2); } - var doc = (0, _dom.getDocumentEx)(this.context); - if (shouldListenOnOuterClick && !previousShouldListenOnOuterClick) this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, 'mousedown', this._dismissOnOuterClick, true); - else if (!shouldListenOnOuterClick && previousShouldListenOnOuterClick) this._events.off(doc === null || doc === void 0 ? void 0 : doc.body, 'mousedown', this._dismissOnOuterClick, true); - }; - PanelBase.prototype.componentWillUnmount = function() { - this._async.dispose(); - this._events.dispose(); - }; - PanelBase.prototype.render = function() { - var _a = this.props, _b = _a.className, className = _b === void 0 ? '' : _b, elementToFocusOnDismiss = _a.elementToFocusOnDismiss, /* eslint-disable deprecation/deprecation */ firstFocusableSelector = _a.firstFocusableSelector, focusTrapZoneProps = _a.focusTrapZoneProps, forceFocusInsideTrap = _a.forceFocusInsideTrap, hasCloseButton = _a.hasCloseButton, headerText = _a.headerText, _c = _a.headerClassName, headerClassName = _c === void 0 ? '' : _c, ignoreExternalFocusing = _a.ignoreExternalFocusing, isBlocking = _a.isBlocking, isFooterAtBottom = _a.isFooterAtBottom, isLightDismiss = _a.isLightDismiss, isHiddenOnDismiss = _a.isHiddenOnDismiss, layerProps = _a.layerProps, overlayProps = _a.overlayProps, popupProps = _a.popupProps, type = _a.type, styles = _a.styles, theme = _a.theme, customWidth = _a.customWidth, _d = _a.onLightDismissClick, onLightDismissClick = _d === void 0 ? this._onPanelClick : _d, _e = _a.onRenderNavigation, onRenderNavigation = _e === void 0 ? this._onRenderNavigation : _e, _f = _a.onRenderHeader, onRenderHeader = _f === void 0 ? this._onRenderHeader : _f, _g = _a.onRenderBody, onRenderBody = _g === void 0 ? this._onRenderBody : _g, _h = _a.onRenderFooter, onRenderFooter = _h === void 0 ? this._onRenderFooter : _h; - var _j = this.state, isFooterSticky = _j.isFooterSticky, visibility = _j.visibility, id = _j.id; - var isLeft = type === (0, _panelTypes.PanelType).smallFixedNear || type === (0, _panelTypes.PanelType).customNear ? true : false; - var isRTL = (0, _utilities.getRTL)(theme); - var isOnRightSide = isRTL ? isLeft : !isLeft; - var customWidthStyles = type === (0, _panelTypes.PanelType).custom || type === (0, _panelTypes.PanelType).customNear ? { - width: customWidth - } : {}; - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)); - var isOpen = this.isActive; - var isAnimating = visibility === PanelVisibilityState.animatingClosed || visibility === PanelVisibilityState.animatingOpen; - this._headerTextId = headerText && id + '-headerText'; - if (!isOpen && !isAnimating && !isHiddenOnDismiss) return null; - this._classNames = getClassNames(styles, { - theme: theme, - className: className, - focusTrapZoneClassName: focusTrapZoneProps ? focusTrapZoneProps.className : undefined, - hasCloseButton: hasCloseButton, - headerClassName: headerClassName, - isAnimating: isAnimating, - isFooterSticky: isFooterSticky, - isFooterAtBottom: isFooterAtBottom, - isOnRightSide: isOnRightSide, - isOpen: isOpen, - isHiddenOnDismiss: isHiddenOnDismiss, - type: type, - hasCustomNavigation: this._hasCustomNavigation - }); - var _k = this, _classNames = _k._classNames, _allowTouchBodyScroll = _k._allowTouchBodyScroll; - var overlay; - if (isBlocking && isOpen) overlay = _react.createElement((0, _overlay.Overlay), (0, _tslib.__assign)({ - className: _classNames.overlay, - isDarkThemed: false, - onClick: isLightDismiss ? onLightDismissClick : undefined, - allowTouchBodyScroll: _allowTouchBodyScroll - }, overlayProps)); - return _react.createElement((0, _layer.Layer), (0, _tslib.__assign)({}, layerProps), _react.createElement((0, _popup.Popup), (0, _tslib.__assign)({ - role: "dialog", - "aria-modal": isBlocking ? 'true' : undefined, - ariaLabelledBy: this._headerTextId ? this._headerTextId : undefined, - onDismiss: this.dismiss, - className: _classNames.hiddenPanel, - enableAriaHiddenSiblings: isOpen ? true : false - }, popupProps), _react.createElement("div", (0, _tslib.__assign)({ - "aria-hidden": !isOpen && isAnimating - }, nativeProps, { - ref: this._panel, - className: _classNames.root - }), overlay, _react.createElement((0, _index.FocusTrapZone), (0, _tslib.__assign)({ - ignoreExternalFocusing: ignoreExternalFocusing, - forceFocusInsideTrap: !isBlocking || isHiddenOnDismiss && !isOpen ? false : forceFocusInsideTrap, - firstFocusableSelector: firstFocusableSelector, - isClickableOutsideFocusTrap: true - }, focusTrapZoneProps, { - className: _classNames.main, - style: customWidthStyles, - elementToFocusOnDismiss: elementToFocusOnDismiss - }), _react.createElement("div", { - className: _classNames.contentInner - }, _react.createElement("div", { - ref: this._allowScrollOnPanel, - className: _classNames.scrollableContent, - "data-is-scrollable": true - }, _react.createElement("div", { - className: _classNames.commands, - "data-is-visible": true - }, onRenderNavigation(this.props, this._onRenderNavigation)), (this._hasCustomNavigation || !hasCloseButton) && onRenderHeader(this.props, this._onRenderHeader, this._headerTextId), onRenderBody(this.props, this._onRenderBody), onRenderFooter(this.props, this._onRenderFooter))))))); - }; - PanelBase.prototype.open = function() { - if (this.props.isOpen !== undefined) return; - if (this.isActive) return; - this.setState({ - visibility: PanelVisibilityState.animatingOpen - }); - }; - PanelBase.prototype.close = function() { - if (this.props.isOpen !== undefined) return; - if (!this.isActive) return; - this.setState({ - visibility: PanelVisibilityState.animatingClosed - }); + }, + formatSpan(start, stop2, count2, specifier) { + specifier = formatSpecifier$1(specifier == null ? ",f" : specifier); + const step = tickStep(start, stop2, count2), value2 = Math.max(Math.abs(start), Math.abs(stop2)); + let precision; + if (specifier.precision == null) { + switch (specifier.type) { + case "s": { + if (!isNaN(precision = precisionPrefix(step, value2))) { + specifier.precision = precision; + } + return formatPrefix2(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (!isNaN(precision = precisionRound(step, value2))) { + specifier.precision = precision - (specifier.type === "e"); + } + break; + } + case "f": + case "%": { + if (!isNaN(precision = precisionFixed(step))) { + specifier.precision = precision - (specifier.type === "%") * 2; + } + break; + } + } + } + return format2(specifier); + } }; - Object.defineProperty(PanelBase.prototype, "isActive", { - /** isActive is true when panel is open or opening. */ get: function() { - return this.state.visibility === PanelVisibilityState.open || this.state.visibility === PanelVisibilityState.animatingOpen; - }, - enumerable: false, - configurable: true + } + let defaultNumberLocale; + resetNumberFormatDefaultLocale(); + function resetNumberFormatDefaultLocale() { + return defaultNumberLocale = numberLocale({ + format: format$4, + formatPrefix }); - PanelBase.prototype._shouldListenForOuterClick = function(props) { - return !!props.isBlocking && !!props.isOpen; + } + function numberFormatLocale(definition2) { + return numberLocale(formatLocale$2(definition2)); + } + function numberFormatDefaultLocale(definition2) { + return arguments.length ? defaultNumberLocale = numberFormatLocale(definition2) : defaultNumberLocale; + } + function timeMultiFormat(format2, interval2, spec) { + spec = spec || {}; + if (!isObject(spec)) { + error(`Invalid time multi-format specifier: ${spec}`); + } + const second2 = interval2(SECONDS), minute = interval2(MINUTES), hour = interval2(HOURS), day = interval2(DATE), week2 = interval2(WEEK), month = interval2(MONTH), quarter2 = interval2(QUARTER), year = interval2(YEAR), L = format2(spec[MILLISECONDS] || ".%L"), S = format2(spec[SECONDS] || ":%S"), M2 = format2(spec[MINUTES] || "%I:%M"), H = format2(spec[HOURS] || "%I %p"), d2 = format2(spec[DATE] || spec[DAY] || "%a %d"), w2 = format2(spec[WEEK] || "%b %d"), m2 = format2(spec[MONTH] || "%B"), q = format2(spec[QUARTER] || "%B"), y2 = format2(spec[YEAR] || "%Y"); + return (date2) => (second2(date2) < date2 ? L : minute(date2) < date2 ? S : hour(date2) < date2 ? M2 : day(date2) < date2 ? H : month(date2) < date2 ? week2(date2) < date2 ? d2 : w2 : year(date2) < date2 ? quarter2(date2) < date2 ? m2 : q : y2)(date2); + } + function timeLocale(locale2) { + const timeFormat2 = memoize(locale2.format), utcFormat2 = memoize(locale2.utcFormat); + return { + timeFormat: (spec) => isString(spec) ? timeFormat2(spec) : timeMultiFormat(timeFormat2, timeInterval, spec), + utcFormat: (spec) => isString(spec) ? utcFormat2(spec) : timeMultiFormat(utcFormat2, utcInterval, spec), + timeParse: memoize(locale2.parse), + utcParse: memoize(locale2.utcParse) }; - PanelBase.prototype._updateFooterPosition = function() { - var scrollableContent = this._scrollableContent; - if (scrollableContent) { - var height = scrollableContent.clientHeight; - var innerHeight_1 = scrollableContent.scrollHeight; - this.setState({ - isFooterSticky: height < innerHeight_1 ? true : false - }); - } + } + let defaultTimeLocale; + resetTimeFormatDefaultLocale(); + function resetTimeFormatDefaultLocale() { + return defaultTimeLocale = timeLocale({ + format: timeFormat$1, + parse: timeParse$1, + utcFormat: utcFormat$1, + utcParse: utcParse$1 + }); + } + function timeFormatLocale(definition2) { + return timeLocale(formatLocale$1(definition2)); + } + function timeFormatDefaultLocale(definition2) { + return arguments.length ? defaultTimeLocale = timeFormatLocale(definition2) : defaultTimeLocale; + } + const createLocale = (number2, time2) => extend({}, number2, time2); + function locale(numberSpec, timeSpec) { + const number2 = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); + const time2 = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); + return createLocale(number2, time2); + } + function defaultLocale(numberSpec, timeSpec) { + const args = arguments.length; + if (args && args !== 2) { + error("defaultLocale expects either zero or two arguments."); + } + return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); + } + function resetDefaultLocale() { + resetNumberFormatDefaultLocale(); + resetTimeFormatDefaultLocale(); + return defaultLocale(); + } + const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; + const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; + const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; + const fileProtocol = "file://"; + function loaderFactory(fs) { + return (options2) => ({ + options: options2 || {}, + sanitize, + load: load$1, + fileAccess: false, + file: fileLoader(), + http: httpLoader + }); + } + async function load$1(uri, options2) { + const opt = await this.sanitize(uri, options2), url = opt.href; + return opt.localFile ? this.file(url) : this.http(url, options2?.http); + } + async function sanitize(uri, options2) { + options2 = extend({}, this.options, options2); + const fileAccess = this.fileAccess, result = { + href: null }; - PanelBase.prototype._dismissOnOuterClick = function(ev) { - var panel = this._panel.current; - if (this.isActive && panel && !ev.defaultPrevented) { - if (!(0, _utilities.elementContains)(panel, ev.target)) { - if (this.props.onOuterClick) this.props.onOuterClick(ev); - else this.dismiss(ev); - } + let isFile, loadFile, base2; + const isAllowed = allowed_re.test(uri.replace(whitespace_re, "")); + if (uri == null || typeof uri !== "string" || !isAllowed) { + error("Sanitize failure, invalid URI: " + $(uri)); + } + const hasProtocol = protocol_re.test(uri); + if ((base2 = options2.baseURL) && !hasProtocol) { + if (!uri.startsWith("/") && !base2.endsWith("/")) { + uri = "/" + uri; + } + uri = base2 + uri; + } + loadFile = (isFile = uri.startsWith(fileProtocol)) || options2.mode === "file" || options2.mode !== "http" && !hasProtocol && fileAccess; + if (isFile) { + uri = uri.slice(fileProtocol.length); + } else if (uri.startsWith("//")) { + if (options2.defaultProtocol === "file") { + uri = uri.slice(2); + loadFile = true; + } else { + uri = (options2.defaultProtocol || "http") + ":" + uri; + } + } + Object.defineProperty(result, "localFile", { + value: !!loadFile + }); + result.href = uri; + if (options2.target) { + result.target = options2.target + ""; + } + if (options2.rel) { + result.rel = options2.rel + ""; + } + if (options2.context === "image" && options2.crossOrigin) { + result.crossOrigin = options2.crossOrigin + ""; + } + return result; + } + function fileLoader(fs) { + return fileReject; + } + async function fileReject() { + error("No file system access."); + } + async function httpLoader(url, options2) { + const opt = extend({}, this.options.http, options2), type2 = options2 && options2.response, response = await fetch(url, opt); + return !response.ok ? error(response.status + "" + response.statusText) : isFunction(response[type2]) ? response[type2]() : response.text(); + } + const isValid = (_) => _ != null && _ === _; + const isBoolean = (_) => _ === "true" || _ === "false" || _ === true || _ === false; + const isDate = (_) => !Number.isNaN(Date.parse(_)); + const isNumber = (_) => !Number.isNaN(+_) && !(_ instanceof Date); + const isInteger = (_) => isNumber(_) && Number.isInteger(+_); + const typeParsers = { + boolean: toBoolean, + integer: toNumber, + number: toNumber, + date: toDate, + string: toString, + unknown: identity$2 + }; + const typeTests = [isBoolean, isInteger, isNumber, isDate]; + const typeList = ["boolean", "integer", "number", "date"]; + function inferType(values2, field2) { + if (!values2 || !values2.length) return "unknown"; + const n = values2.length, m2 = typeTests.length, a2 = typeTests.map((_, i) => i + 1); + for (let i = 0, t = 0, j, value2; i < n; ++i) { + value2 = field2 ? values2[i][field2] : values2[i]; + for (j = 0; j < m2; ++j) { + if (a2[j] && isValid(value2) && !typeTests[j](value2)) { + a2[j] = 0; + ++t; + if (t === typeTests.length) return "string"; } + } + } + return typeList[a2.reduce((u2, v) => u2 === 0 ? v : u2, 0) - 1]; + } + function inferTypes(data2, fields) { + return fields.reduce((types2, field2) => { + types2[field2] = inferType(data2, field2); + return types2; + }, {}); + } + function delimitedFormat(delimiter) { + const parse2 = function(data2, format2) { + const delim = { + delimiter + }; + return dsv(data2, format2 ? extend(format2, delim) : delim); + }; + parse2.responseType = "text"; + return parse2; + } + function dsv(data2, format2) { + if (format2.header) { + data2 = format2.header.map($).join(format2.delimiter) + "\n" + data2; + } + return dsvFormat(format2.delimiter).parse(data2 + ""); + } + dsv.responseType = "text"; + function isBuffer(_) { + return typeof Buffer === "function" && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; + } + function json(data2, format2) { + const prop = format2 && format2.property ? field$1(format2.property) : identity$2; + return isObject(data2) && !isBuffer(data2) ? parseJSON(prop(data2), format2) : prop(JSON.parse(data2)); + } + json.responseType = "json"; + function parseJSON(data2, format2) { + if (!isArray(data2) && isIterable(data2)) { + data2 = [...data2]; + } + return format2 && format2.copy ? JSON.parse(JSON.stringify(data2)) : data2; + } + const filters = { + interior: (a2, b2) => a2 !== b2, + exterior: (a2, b2) => a2 === b2 + }; + function topojson(data2, format2) { + let method2, object2, property2, filter2; + data2 = json(data2, format2); + if (format2 && format2.feature) { + method2 = feature; + property2 = format2.feature; + } else if (format2 && format2.mesh) { + method2 = mesh; + property2 = format2.mesh; + filter2 = filters[format2.filter]; + } else { + error("Missing TopoJSON feature or mesh parameter."); + } + object2 = (object2 = data2.objects[property2]) ? method2(data2, object2, filter2) : error("Invalid TopoJSON object: " + property2); + return object2 && object2.features || [object2]; + } + topojson.responseType = "json"; + const format$2 = { + dsv, + csv: delimitedFormat(","), + tsv: delimitedFormat(" "), + json, + topojson + }; + function formats$1(name, reader) { + if (arguments.length > 1) { + format$2[name] = reader; + return this; + } else { + return has$1(format$2, name) ? format$2[name] : null; + } + } + function responseType(type2) { + const f = formats$1(type2); + return f && f.responseType || "text"; + } + function read(data2, schema, timeParser, utcParser) { + schema = schema || {}; + const reader = formats$1(schema.type || "json"); + if (!reader) error("Unknown data format type: " + schema.type); + data2 = reader(data2, schema); + if (schema.parse) parse$6(data2, schema.parse, timeParser, utcParser); + if (has$1(data2, "columns")) delete data2.columns; + return data2; + } + function parse$6(data2, types2, timeParser, utcParser) { + if (!data2.length) return; + const locale2 = timeFormatDefaultLocale(); + timeParser = timeParser || locale2.timeParse; + utcParser = utcParser || locale2.utcParse; + let fields = data2.columns || Object.keys(data2[0]), datum2, field2, i, j, n, m2; + if (types2 === "auto") types2 = inferTypes(data2, fields); + fields = Object.keys(types2); + const parsers = fields.map((field3) => { + const type2 = types2[field3]; + let parts, pattern; + if (type2 && (type2.startsWith("date:") || type2.startsWith("utc:"))) { + parts = type2.split(/:(.+)?/, 2); + pattern = parts[1]; + if (pattern[0] === "'" && pattern[pattern.length - 1] === "'" || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { + pattern = pattern.slice(1, -1); + } + const parse2 = parts[0] === "utc" ? utcParser : timeParser; + return parse2(pattern); + } + if (!typeParsers[type2]) { + throw Error("Illegal format pattern: " + field3 + ":" + type2); + } + return typeParsers[type2]; + }); + for (i = 0, n = data2.length, m2 = fields.length; i < n; ++i) { + datum2 = data2[i]; + for (j = 0; j < m2; ++j) { + field2 = fields[j]; + datum2[field2] = parsers[j](datum2[field2]); + } + } + } + const loader = loaderFactory(); + function UniqueList(idFunc) { + const $2 = idFunc || identity$2, list = [], ids = {}; + list.add = (_) => { + const id2 = $2(_); + if (!ids[id2]) { + ids[id2] = 1; + list.push(_); + } + return list; + }; + list.remove = (_) => { + const id2 = $2(_); + if (ids[id2]) { + ids[id2] = 0; + const idx = list.indexOf(_); + if (idx >= 0) list.splice(idx, 1); + } + return list; }; - PanelBase.defaultProps = { - isHiddenOnDismiss: false, - isOpen: undefined, - isBlocking: true, - hasCloseButton: true, - type: (0, _panelTypes.PanelType).smallFixedFar - }; - PanelBase.contextType = (0, _reactWindowProvider.WindowContext); - return PanelBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Button":"1457j","../../Layer":"hQjxQ","../../Overlay":"eCuPP","../../Popup":"bOJlv","../../Utilities":"1NZCy","../FocusTrapZone/index":"dzHmS","./Panel.types":"kzGXk","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kzGXk":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Panel} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PanelType", ()=>PanelType); -var PanelType; -(function(PanelType) { - /** - * Renders the Panel with a `fluid` (full screen) width. - * Recommended for use on small screen breakpoints. - * - Small (320-479): full screen width, 16px left/right padding - * - Medium (480-639): full screen width, 16px left/right padding - * - Large (640-1023): full screen width, 32px left/right padding - * - XLarge (1024-1365): full screen width, 32px left/right padding - * - XXLarge (1366-up): full screen width, 40px left/right padding - */ PanelType[PanelType["smallFluid"] = 0] = "smallFluid"; - /** - * Renders the Panel in fixed-width `small` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): 340px width, 16px left/right padding - * - Large (640-1023): 340px width, 32px left/right padding - * - XLarge (1024-1365): 340px width, 32px left/right padding - * - XXLarge (1366-up): 340px width, 40px left/right padding - */ PanelType[PanelType["smallFixedFar"] = 1] = "smallFixedFar"; - /** - * Renders the Panel in fixed-width `small` size, anchored to the near side (left in LTR mode). - * - Small (320-479): 272px width, 16px left/right padding - * - Medium (480-639): 272px width, 16px left/right padding - * - Large (640-1023): 272px width, 32px left/right padding - * - XLarge (1024-1365): 272px width, 32px left/right padding - * - XXLarge (1366-up): 272px width, 40px left/right padding - */ PanelType[PanelType["smallFixedNear"] = 2] = "smallFixedNear"; - /** - * Renders the Panel in `medium` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): 592px width, 32px left/right padding - * - XLarge (1024-1365): 644px width, 32px left/right padding - * - XXLarge (1366-up): 644px width, 40px left/right padding - */ PanelType[PanelType["medium"] = 3] = "medium"; - /** - * Renders the Panel in `large` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint - * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding - * - XXLarge (1366-up): 428px fixed left margin, fluid width, 40px left/right padding - */ PanelType[PanelType["large"] = 4] = "large"; - /** - * Renders the Panel in `large` size, anchored to the far side (right in LTR mode), with a fixed width at - * XX-Large breakpoint. - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint - * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding - * - XXLarge (1366-up): 940px width, 40px left/right padding - */ PanelType[PanelType["largeFixed"] = 5] = "largeFixed"; - /** - * Renders the Panel in `extra large` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint - * - XLarge (1024-1365): adapts to `PanelType.large` at this breakpoint - * - XXLarge (1366-1919): 176px fixed left margin, fluid width, 40px left/right padding - * - XXXLarge (1920-up): 176px fixed left margin, fluid width, 40px left/right padding - */ PanelType[PanelType["extraLarge"] = 6] = "extraLarge"; - /** - * Renders the Panel in `custom` size using `customWidth`, anchored to the far side (right in LTR mode). - * - Has a fixed width provided by the `customWidth` prop - * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel - * taking up 100% of the viewport width - */ PanelType[PanelType["custom"] = 7] = "custom"; - /** - * Renders the Panel in `custom` size using `customWidth`, anchored to the near side (left in LTR mode). - * - Has a fixed width provided by the `customWidth` prop - * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel - * taking up 100% of the viewport width - */ PanelType[PanelType["customNear"] = 8] = "customNear"; -})(PanelType || (PanelType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6pUAU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _panelTypes = require("./Panel.types"); -var _styling = require("../../Styling"); -var _a, _b, _c, _d, _e; -var GlobalClassNames = { - root: 'ms-Panel', - main: 'ms-Panel-main', - commands: 'ms-Panel-commands', - contentInner: 'ms-Panel-contentInner', - scrollableContent: 'ms-Panel-scrollableContent', - navigation: 'ms-Panel-navigation', - closeButton: 'ms-Panel-closeButton ms-PanelAction-close', - header: 'ms-Panel-header', - headerText: 'ms-Panel-headerText', - content: 'ms-Panel-content', - footer: 'ms-Panel-footer', - footerInner: 'ms-Panel-footerInner', - isOpen: 'is-open', - hasCloseButton: 'ms-Panel--hasCloseButton', - smallFluid: 'ms-Panel--smFluid', - smallFixedNear: 'ms-Panel--smLeft', - smallFixedFar: 'ms-Panel--sm', - medium: 'ms-Panel--md', - large: 'ms-Panel--lg', - largeFixed: 'ms-Panel--fixed', - extraLarge: 'ms-Panel--xl', - custom: 'ms-Panel--custom', - customNear: 'ms-Panel--customLeft' -}; -var panelWidth = { - full: '100%', - auto: 'auto', - xs: 272, - sm: 340, - md1: 592, - md2: 644, - lg: 940 -}; -var panelMargin = { - auto: 'auto', - none: 0, - md: 48, - lg: 428, - xl: 176 -}; -// Following consts are used below in `getPanelBreakpoints()` function to provide -// necessary fallbacks for different types of Panel in different breakpoints. -var smallPanelSelectors = (_a = {}, _a["@media (min-width: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - width: panelWidth.sm -}, _a); -var mediumPanelSelectors = (_b = {}, _b["@media (min-width: ".concat((0, _styling.ScreenWidthMinLarge), "px)")] = { - width: panelWidth.md1 -}, _b["@media (min-width: ".concat((0, _styling.ScreenWidthMinXLarge), "px)")] = { - width: panelWidth.md2 -}, _b); -var largePanelSelectors = (_c = {}, _c["@media (min-width: ".concat((0, _styling.ScreenWidthMinUhfMobile), "px)")] = { - left: panelMargin.md, - width: panelWidth.auto -}, _c["@media (min-width: ".concat((0, _styling.ScreenWidthMinXXLarge), "px)")] = { - left: panelMargin.lg -}, _c); -var largeFixedPanelSelectors = (_d = {}, _d["@media (min-width: ".concat((0, _styling.ScreenWidthMinXXLarge), "px)")] = { - left: panelMargin.auto, - width: panelWidth.lg -}, _d); -var extraLargePanelSelectors = (_e = {}, _e["@media (min-width: ".concat((0, _styling.ScreenWidthMinXXLarge), "px)")] = { - left: panelMargin.xl -}, _e); -// Make sure Panels have fallbacks to different breakpoints by reusing same selectors. -// This is done in the effort to follow design redlines. -var getPanelBreakpoints = function(type) { - var selectors; - // Panel types `smallFluid`, `smallFixedNear`, `custom` and `customNear` - // are not checked in here because they render the same in all the breakpoints - // and have the checks done separately in the `getStyles` function below. - switch(type){ - case (0, _panelTypes.PanelType).smallFixedFar: - selectors = (0, _tslib.__assign)({}, smallPanelSelectors); - break; - case (0, _panelTypes.PanelType).medium: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors); - break; - case (0, _panelTypes.PanelType).large: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors); - break; - case (0, _panelTypes.PanelType).largeFixed: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), largeFixedPanelSelectors); - break; - case (0, _panelTypes.PanelType).extraLarge: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), extraLargePanelSelectors); - break; - default: - break; + return list; + } + async function asyncCallback(df, callback) { + try { + await callback(df); + } catch (err) { + df.error(err); } - return selectors; -}; -var commandBarHeight = '44px'; -var sharedPaddingStyles = { - paddingLeft: '24px', - paddingRight: '24px' -}; -var getStyles = function(props) { - var _a, _b, _c, _d; - var className = props.className, focusTrapZoneClassName = props.focusTrapZoneClassName, hasCloseButton = props.hasCloseButton, headerClassName = props.headerClassName, isAnimating = props.isAnimating, isFooterSticky = props.isFooterSticky, isFooterAtBottom = props.isFooterAtBottom, isOnRightSide = props.isOnRightSide, isOpen = props.isOpen, isHiddenOnDismiss = props.isHiddenOnDismiss, hasCustomNavigation = props.hasCustomNavigation, theme = props.theme, _e = props.type, type = _e === void 0 ? (0, _panelTypes.PanelType).smallFixedFar : _e; - var effects = theme.effects, fonts = theme.fonts, semanticColors = theme.semanticColors; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var isCustomPanel = type === (0, _panelTypes.PanelType).custom || type === (0, _panelTypes.PanelType).customNear; + } + const TUPLE_ID_KEY = Symbol("vega_id"); + let TUPLE_ID = 1; + function isTuple(t) { + return !!(t && tupleid(t)); + } + function tupleid(t) { + return t[TUPLE_ID_KEY]; + } + function setid(t, id2) { + t[TUPLE_ID_KEY] = id2; + return t; + } + function ingest$1(datum2) { + const t = datum2 === Object(datum2) ? datum2 : { + data: datum2 + }; + return tupleid(t) ? t : setid(t, TUPLE_ID++); + } + function derive(t) { + return rederive(t, ingest$1({})); + } + function rederive(t, d2) { + for (const k in t) d2[k] = t[k]; + return d2; + } + function replace$1(t, d2) { + return setid(d2, tupleid(t)); + } + function stableCompare(cmp, f) { + return !cmp ? null : f ? (a2, b2) => cmp(a2, b2) || tupleid(f(a2)) - tupleid(f(b2)) : (a2, b2) => cmp(a2, b2) || tupleid(a2) - tupleid(b2); + } + function isChangeSet(v) { + return v && v.constructor === changeset; + } + function changeset() { + const add2 = [], rem2 = [], mod = [], remp = [], modp = []; + let clean = null, reflow2 = false; return { - root: [ - classNames.root, - theme.fonts.medium, - isOpen && classNames.isOpen, - hasCloseButton && classNames.hasCloseButton, - { - pointerEvents: 'none', - position: 'absolute', - top: 0, - left: 0, - right: 0, - bottom: 0 - }, - isCustomPanel && isOnRightSide && classNames.custom, - isCustomPanel && !isOnRightSide && classNames.customNear, - className - ], - overlay: [ - { - pointerEvents: 'auto', - cursor: 'pointer' - }, - isOpen && isAnimating && (0, _styling.AnimationClassNames).fadeIn100, - !isOpen && isAnimating && (0, _styling.AnimationClassNames).fadeOut100 - ], - hiddenPanel: [ - !isOpen && !isAnimating && isHiddenOnDismiss && { - visibility: 'hidden' - } - ], - main: [ - classNames.main, - { - backgroundColor: semanticColors.bodyBackground, - boxShadow: effects.elevation64, - pointerEvents: 'auto', - position: 'absolute', - display: 'flex', - flexDirection: 'column', - overflowX: 'hidden', - overflowY: 'auto', - WebkitOverflowScrolling: 'touch', - bottom: 0, - top: 0, - // left, right, width are overridden depending on the type of the Panel and the screen breakpoint. - left: panelMargin.auto, - right: panelMargin.none, - width: panelWidth.full, - selectors: (0, _tslib.__assign)((_a = {}, _a[0, _styling.HighContrastSelector] = { - borderLeft: "3px solid ".concat(semanticColors.variantBorder), - borderRight: "3px solid ".concat(semanticColors.variantBorder) - }, _a), getPanelBreakpoints(type)) - }, - type === (0, _panelTypes.PanelType).smallFluid && { - left: panelMargin.none - }, - type === (0, _panelTypes.PanelType).smallFixedNear && { - left: panelMargin.none, - right: panelMargin.auto, - width: panelWidth.xs - }, - type === (0, _panelTypes.PanelType).customNear && { - right: 'auto', - left: 0 - }, - isCustomPanel && { - maxWidth: '100vw' - }, - isOpen && isAnimating && !isOnRightSide && (0, _styling.AnimationClassNames).slideRightIn40, - isOpen && isAnimating && isOnRightSide && (0, _styling.AnimationClassNames).slideLeftIn40, - !isOpen && isAnimating && !isOnRightSide && (0, _styling.AnimationClassNames).slideLeftOut40, - !isOpen && isAnimating && isOnRightSide && (0, _styling.AnimationClassNames).slideRightOut40, - focusTrapZoneClassName - ], - commands: [ - classNames.commands, - { - // Ensures that the sticky header always has a background to prevent overlaps on scroll. - backgroundColor: semanticColors.bodyBackground, - paddingTop: 18, - selectors: (_b = {}, _b["@media (min-height: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - position: 'sticky', - top: 0, - zIndex: 1 - }, _b) - }, - hasCustomNavigation && { - paddingTop: 'inherit' - } - ], - navigation: [ - classNames.navigation, - { - display: 'flex', - justifyContent: 'flex-end' - }, - hasCustomNavigation && { - height: commandBarHeight - } - ], - contentInner: [ - classNames.contentInner, - { - display: 'flex', - flexDirection: 'column', - flexGrow: 1, - overflowY: 'hidden' - } - ], - header: [ - classNames.header, - sharedPaddingStyles, - { - alignSelf: 'flex-start' - }, - hasCloseButton && !hasCustomNavigation && { - flexGrow: 1 - }, - hasCustomNavigation && { - // Ensure that title doesn't shrink if screen is too small - flexShrink: 0 - } - ], - headerText: [ - classNames.headerText, - fonts.xLarge, - { - color: semanticColors.bodyText, - lineHeight: '27px', - overflowWrap: 'break-word', - wordWrap: 'break-word', - wordBreak: 'break-word', - hyphens: 'auto' - }, - headerClassName - ], - scrollableContent: [ - classNames.scrollableContent, - { - overflowY: 'auto' - }, - isFooterAtBottom && { - flexGrow: 1, - display: 'inherit', - flexDirection: 'inherit' - } - ], - content: [ - classNames.content, - sharedPaddingStyles, - { - paddingBottom: 20 - }, - isFooterAtBottom && { - selectors: (_c = {}, _c["@media (min-height: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - flexGrow: 1 - }, _c) - } - ], - footer: [ - classNames.footer, - { - // Ensure that footer doesn't shrink if screen is too small - flexShrink: 0, - borderTop: '1px solid transparent', - transition: "opacity ".concat((0, _styling.AnimationVariables).durationValue3, " ").concat((0, _styling.AnimationVariables).easeFunction2), - selectors: (_d = {}, _d["@media (min-height: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - position: 'sticky', - bottom: 0 - }, _d) - }, - isFooterSticky && { - backgroundColor: semanticColors.bodyBackground, - borderTopColor: semanticColors.variantBorder - } - ], - footerInner: [ - classNames.footerInner, - sharedPaddingStyles, - { - paddingBottom: 16, - paddingTop: 16 - } - ], - subComponentStyles: { - closeButton: { - root: [ - classNames.closeButton, - { - marginRight: 14, - color: theme.palette.neutralSecondary, - fontSize: (0, _styling.IconFontSizes).large - }, - hasCustomNavigation && { - marginRight: 0, - height: 'auto', - width: '44px' - } - ], - rootHovered: { - color: theme.palette.neutralPrimary - } - } + constructor: changeset, + insert(t) { + const d2 = array$4(t), n = d2.length; + for (let i = 0; i < n; ++i) add2.push(d2[i]); + return this; + }, + remove(t) { + const a2 = isFunction(t) ? remp : rem2, d2 = array$4(t), n = d2.length; + for (let i = 0; i < n; ++i) a2.push(d2[i]); + return this; + }, + modify(t, field2, value2) { + const m2 = { + field: field2, + value: constant$4(value2) + }; + if (isFunction(t)) { + m2.filter = t; + modp.push(m2); + } else { + m2.tuple = t; + mod.push(m2); + } + return this; + }, + encode(t, set2) { + if (isFunction(t)) modp.push({ + filter: t, + field: set2 + }); + else mod.push({ + tuple: t, + field: set2 + }); + return this; + }, + clean(value2) { + clean = value2; + return this; + }, + reflow() { + reflow2 = true; + return this; + }, + pulse(pulse2, tuples) { + const cur = {}, out = {}; + let i, n, m2, f, t, id2; + for (i = 0, n = tuples.length; i < n; ++i) { + cur[tupleid(tuples[i])] = 1; + } + for (i = 0, n = rem2.length; i < n; ++i) { + t = rem2[i]; + cur[tupleid(t)] = -1; + } + for (i = 0, n = remp.length; i < n; ++i) { + f = remp[i]; + tuples.forEach((t4) => { + if (f(t4)) cur[tupleid(t4)] = -1; + }); + } + for (i = 0, n = add2.length; i < n; ++i) { + t = add2[i]; + id2 = tupleid(t); + if (cur[id2]) { + cur[id2] = 1; + } else { + pulse2.add.push(ingest$1(add2[i])); + } + } + for (i = 0, n = tuples.length; i < n; ++i) { + t = tuples[i]; + if (cur[tupleid(t)] < 0) pulse2.rem.push(t); + } + function modify2(t4, f2, v) { + if (v) { + t4[f2] = v(t4); + } else { + pulse2.encode = f2; + } + if (!reflow2) out[tupleid(t4)] = t4; + } + for (i = 0, n = mod.length; i < n; ++i) { + m2 = mod[i]; + t = m2.tuple; + f = m2.field; + id2 = cur[tupleid(t)]; + if (id2 > 0) { + modify2(t, f, m2.value); + pulse2.modifies(f); + } + } + for (i = 0, n = modp.length; i < n; ++i) { + m2 = modp[i]; + f = m2.filter; + tuples.forEach((t4) => { + if (f(t4) && cur[tupleid(t4)] > 0) { + modify2(t4, m2.field, m2.value); + } + }); + pulse2.modifies(m2.field); + } + if (reflow2) { + pulse2.mod = rem2.length || remp.length ? tuples.filter((t4) => cur[tupleid(t4)] > 0) : tuples.slice(); + } else { + for (id2 in out) pulse2.mod.push(out[id2]); } + if (clean || clean == null && (rem2.length || remp.length)) { + pulse2.clean(true); + } + return pulse2; + } }; -}; - -},{"tslib":"9gizs","./Panel.types":"kzGXk","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cUemW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _utilities = require("../../Utilities"); -var _positioning = require("../../Positioning"); -var _styling = require("../../Styling"); -var _a, _b, _c, _d, _e; -var GlobalClassNames = { - root: 'ms-Dropdown-container', - label: 'ms-Dropdown-label', - dropdown: 'ms-Dropdown', - title: 'ms-Dropdown-title', - caretDownWrapper: 'ms-Dropdown-caretDownWrapper', - caretDown: 'ms-Dropdown-caretDown', - callout: 'ms-Dropdown-callout', - panel: 'ms-Dropdown-panel', - dropdownItems: 'ms-Dropdown-items', - dropdownItem: 'ms-Dropdown-item', - dropdownDivider: 'ms-Dropdown-divider', - dropdownOptionText: 'ms-Dropdown-optionText', - dropdownItemHeader: 'ms-Dropdown-header', - titleIsPlaceHolder: 'ms-Dropdown-titleIsPlaceHolder', - titleHasError: 'ms-Dropdown-title--hasError' -}; -var DROPDOWN_HEIGHT = 32; -var DROPDOWN_ITEM_HEIGHT = 36; -var highContrastAdjustMixin = (_a = {}, _a["".concat((0, _styling.HighContrastSelector), ", ").concat((0, _styling.HighContrastSelectorWhite).replace('@media ', ''))] = (0, _tslib.__assign)({}, (0, _styling.getHighContrastNoAdjustStyle)()), _a); -var highContrastItemAndTitleStateMixin = { - selectors: (0, _tslib.__assign)((_b = {}, _b[0, _styling.HighContrastSelector] = (_c = { - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, _c[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus:after")] = { - borderColor: 'HighlightText' - }, _c), _b['.ms-Checkbox-checkbox'] = (_d = {}, _d[0, _styling.HighContrastSelector] = { - borderColor: 'HighlightText' - }, _d), _b), highContrastAdjustMixin) -}; -var highContrastBorderState = { - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight' - }, _e) -}; -var MinimumScreenSelector = (0, _styling.getScreenSelector)(0, (0, _styling.ScreenWidthMinMedium)); -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; - var theme = props.theme, hasError = props.hasError, hasLabel = props.hasLabel, className = props.className, isOpen = props.isOpen, disabled = props.disabled, required = props.required, isRenderingPlaceholder = props.isRenderingPlaceholder, panelClassName = props.panelClassName, calloutClassName = props.calloutClassName, calloutRenderEdge = props.calloutRenderEdge; - if (!theme) throw new Error('theme is undefined or null in base Dropdown getStyles function.'); - var globalClassnames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var palette = theme.palette, semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; - var rootHoverFocusActiveSelectorNeutralDarkMixin = { - color: semanticColors.menuItemTextHovered - }; - var rootHoverFocusActiveSelectorNeutralPrimaryMixin = { - color: semanticColors.menuItemText - }; - var borderColorError = { - borderColor: semanticColors.errorText - }; - var dropdownItemStyle = [ - globalClassnames.dropdownItem, - { - backgroundColor: 'transparent', - boxSizing: 'border-box', - cursor: 'pointer', - display: 'flex', - alignItems: 'center', - padding: '0 8px', - width: '100%', - minHeight: DROPDOWN_ITEM_HEIGHT, - lineHeight: 20, - height: 0, - position: 'relative', - border: '1px solid transparent', - borderRadius: 0, - wordWrap: 'break-word', - overflowWrap: 'break-word', - textAlign: 'left', - '.ms-Button-flexContainer': { - width: '100%' - } + } + const CACHE = "_:mod:_"; + function Parameters() { + Object.defineProperty(this, CACHE, { + writable: true, + value: {} + }); + } + Parameters.prototype = { + /** + * Set a parameter value. If the parameter value changes, the parameter + * will be recorded as modified. + * @param {string} name - The parameter name. + * @param {number} index - The index into an array-value parameter. Ignored if + * the argument is undefined, null or less than zero. + * @param {*} value - The parameter value to set. + * @param {boolean} [force=false] - If true, records the parameter as modified + * even if the value is unchanged. + * @return {Parameters} - This parameter object. + */ + set(name, index2, value2, force2) { + const o = this, v = o[name], mod = o[CACHE]; + if (index2 != null && index2 >= 0) { + if (v[index2] !== value2 || force2) { + v[index2] = value2; + mod[index2 + ":" + name] = -1; + mod[name] = -1; + } + } else if (v !== value2 || force2) { + o[name] = value2; + mod[name] = isArray(value2) ? 1 + value2.length : -1; + } + return o; + }, + /** + * Tests if one or more parameters has been modified. If invoked with no + * arguments, returns true if any parameter value has changed. If the first + * argument is array, returns trues if any parameter name in the array has + * changed. Otherwise, tests if the given name and optional array index has + * changed. + * @param {string} name - The parameter name to test. + * @param {number} [index=undefined] - The parameter array index to test. + * @return {boolean} - Returns true if a queried parameter was modified. + */ + modified(name, index2) { + const mod = this[CACHE]; + if (!arguments.length) { + for (const k in mod) { + if (mod[k]) return true; } - ]; - var dropdownHeaderStyle = [ - globalClassnames.dropdownItemHeader, - (0, _tslib.__assign)((0, _tslib.__assign)({}, fonts.medium), { - fontWeight: (0, _styling.FontWeights).semibold, - color: semanticColors.menuHeader, - background: 'none', - backgroundColor: 'transparent', - border: 'none', - height: DROPDOWN_ITEM_HEIGHT, - lineHeight: DROPDOWN_ITEM_HEIGHT, - cursor: 'default', - padding: '0 8px', - userSelect: 'none', - textAlign: 'left', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) - }) - ]; - var selectedItemBackgroundColor = semanticColors.menuItemBackgroundPressed; - var itemSelectors = function(isSelected) { - var _a, _b; - if (isSelected === void 0) isSelected = false; - return { - selectors: (_a = { - '&:hover': [ - { - color: semanticColors.menuItemTextHovered, - backgroundColor: !isSelected ? semanticColors.menuItemBackgroundHovered : selectedItemBackgroundColor - }, - highContrastItemAndTitleStateMixin - ], - '&.is-multi-select:hover': [ - { - backgroundColor: !isSelected ? 'transparent' : selectedItemBackgroundColor - }, - highContrastItemAndTitleStateMixin - ], - '&:active:hover': [ - { - color: semanticColors.menuItemTextHovered, - backgroundColor: !isSelected ? semanticColors.menuItemBackgroundPressed : semanticColors.menuItemBackgroundHovered - }, - highContrastItemAndTitleStateMixin - ] - }, _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus:after, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:after")] = (_b = { - left: 0, - top: 0, - bottom: 0, - right: 0 - }, _b[0, _styling.HighContrastSelector] = { - inset: '2px' - }, _b), _a[0, _styling.HighContrastSelector] = { - border: 'none' - }, _a) - }; + return false; + } else if (isArray(name)) { + for (let k = 0; k < name.length; ++k) { + if (mod[name[k]]) return true; + } + return false; + } + return index2 != null && index2 >= 0 ? index2 + 1 < mod[name] || !!mod[index2 + ":" + name] : !!mod[name]; + }, + /** + * Clears the modification records. After calling this method, + * all parameters are considered unmodified. + */ + clear() { + this[CACHE] = {}; + return this; + } + }; + let OP_ID = 0; + const PULSE = "pulse", NO_PARAMS = new Parameters(); + const SKIP$1$1 = 1, MODIFIED = 2; + function Operator(init2, update2, params2, react) { + this.id = ++OP_ID; + this.value = init2; + this.stamp = -1; + this.rank = -1; + this.qrank = -1; + this.flags = 0; + if (update2) { + this._update = update2; + } + if (params2) this.parameters(params2, react); + } + function flag(bit) { + return function(state) { + const f = this.flags; + if (arguments.length === 0) return !!(f & bit); + this.flags = state ? f | bit : f & ~bit; + return this; }; - var dropdownItemSelected = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - { - backgroundColor: selectedItemBackgroundColor, - color: semanticColors.menuItemTextHovered - }, - itemSelectors(true), - highContrastItemAndTitleStateMixin - ], false); - var dropdownItemDisabled = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - { - color: semanticColors.disabledText, - cursor: 'default', - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText', - border: 'none' - }, _b) + } + Operator.prototype = { + /** + * Returns a list of target operators dependent on this operator. + * If this list does not exist, it is created and then returned. + * @return {UniqueList} + */ + targets() { + return this._targets || (this._targets = UniqueList(id)); + }, + /** + * Sets the value of this operator. + * @param {*} value - the value to set. + * @return {Number} Returns 1 if the operator value has changed + * according to strict equality, returns 0 otherwise. + */ + set(value2) { + if (this.value !== value2) { + this.value = value2; + return 1; + } else { + return 0; + } + }, + /** + * Indicates that operator evaluation should be skipped on the next pulse. + * This operator will still propagate incoming pulses, but its update function + * will not be invoked. The skip flag is reset after every pulse, so calling + * this method will affect processing of the next pulse only. + */ + skip: flag(SKIP$1$1), + /** + * Indicates that this operator's value has been modified on its most recent + * pulse. Normally modification is checked via strict equality; however, in + * some cases it is more efficient to update the internal state of an object. + * In those cases, the modified flag can be used to trigger propagation. Once + * set, the modification flag persists across pulses until unset. The flag can + * be used with the last timestamp to test if a modification is recent. + */ + modified: flag(MODIFIED), + /** + * Sets the parameters for this operator. The parameter values are analyzed for + * operator instances. If found, this operator will be added as a dependency + * of the parameterizing operator. Operator values are dynamically marshalled + * from each operator parameter prior to evaluation. If a parameter value is + * an array, the array will also be searched for Operator instances. However, + * the search does not recurse into sub-arrays or object properties. + * @param {object} params - A hash of operator parameters. + * @param {boolean} [react=true] - A flag indicating if this operator should + * automatically update (react) when parameter values change. In other words, + * this flag determines if the operator registers itself as a listener on + * any upstream operators included in the parameters. + * @param {boolean} [initonly=false] - A flag indicating if this operator + * should calculate an update only upon its initial evaluation, then + * deregister dependencies and suppress all future update invocations. + * @return {Operator[]} - An array of upstream dependencies. + */ + parameters(params2, react, initonly) { + react = react !== false; + const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; + let name, value2, n, i; + const add2 = (name2, index2, value3) => { + if (value3 instanceof Operator) { + if (value3 !== this) { + if (react) value3.targets().add(this); + deps.push(value3); + } + argops.push({ + op: value3, + name: name2, + index: index2 + }); + } else { + argval.set(name2, index2, value3); + } + }; + for (name in params2) { + value2 = params2[name]; + if (name === PULSE) { + array$4(value2).forEach((op) => { + if (!(op instanceof Operator)) { + error("Pulse parameters must be operator instances."); + } else if (op !== this) { + op.targets().add(this); + deps.push(op); + } + }); + this.source = value2; + } else if (isArray(value2)) { + argval.set(name, -1, Array(n = value2.length)); + for (i = 0; i < n; ++i) add2(name, i, value2[i]); + } else { + add2(name, -1, value2); } - ], false); - var titleOpenBorderRadius = calloutRenderEdge === (0, _positioning.RectangleEdge).bottom ? "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0") : "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2); - var calloutOpenBorderRadius = calloutRenderEdge === (0, _positioning.RectangleEdge).bottom ? "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2) : "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0"); - return { - root: [ - globalClassnames.root, - className - ], - label: globalClassnames.label, - dropdown: [ - globalClassnames.dropdown, - (0, _styling.normalize), - fonts.medium, - { - color: semanticColors.menuItemText, - borderColor: semanticColors.focusBorder, - position: 'relative', - outline: 0, - userSelect: 'none', - selectors: (_c = {}, _c['&:hover .' + globalClassnames.title] = [ - !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, - { - borderColor: isOpen ? palette.neutralSecondary : palette.neutralPrimary - }, - highContrastBorderState - ], _c['&:focus .' + globalClassnames.title] = [ - !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, - { - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _d) - } - ], _c['&:focus:after'] = [ - { - pointerEvents: 'none', - content: "''", - position: 'absolute', - boxSizing: 'border-box', - top: '0px', - left: '0px', - width: '100%', - height: '100%', - // see https://github.com/microsoft/fluentui/pull/9182 for semantic color disc - border: !disabled ? "2px solid ".concat(palette.themePrimary) : 'none', - borderRadius: '2px', - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _e) - } - ], _c['&:active .' + globalClassnames.title] = [ - !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, - { - borderColor: palette.themePrimary - }, - highContrastBorderState - ], _c['&:hover .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:focus .' + globalClassnames.caretDown] = [ - !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, - { - selectors: (_f = {}, _f[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _f) - } - ], _c['&:active .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:hover .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:focus .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:active .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:hover .' + globalClassnames.titleHasError] = borderColorError, _c['&:active .' + globalClassnames.titleHasError] = borderColorError, _c) - }, - isOpen && 'is-open', - disabled && 'is-disabled', - required && 'is-required', - required && !hasLabel && { - selectors: (_g = { - ':before': { - content: "'*'", - color: semanticColors.errorText, - position: 'absolute', - top: -5, - right: -10 - } - }, _g[0, _styling.HighContrastSelector] = { - selectors: { - ':after': { - right: -14 - } - } - }, _g) - } - ], - title: [ - globalClassnames.title, - (0, _styling.normalize), - { - backgroundColor: semanticColors.inputBackground, - borderWidth: 1, - borderStyle: 'solid', - borderColor: semanticColors.inputBorder, - borderRadius: isOpen ? titleOpenBorderRadius : effects.roundedCorner2, - cursor: 'pointer', - display: 'block', - height: DROPDOWN_HEIGHT, - lineHeight: DROPDOWN_HEIGHT - 2, - padding: "0 28px 0 8px", - position: 'relative', - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis' - }, - isRenderingPlaceholder && [ - globalClassnames.titleIsPlaceHolder, - { - color: semanticColors.inputPlaceholderText - } - ], - hasError && [ - globalClassnames.titleHasError, - borderColorError - ], - disabled && { - backgroundColor: semanticColors.disabledBackground, - border: 'none', - color: semanticColors.disabledText, - cursor: 'default', - selectors: (_h = {}, _h[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - border: '1px solid GrayText', - color: 'GrayText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _h) - } - ], - caretDownWrapper: [ - globalClassnames.caretDownWrapper, - { - height: DROPDOWN_HEIGHT, - lineHeight: DROPDOWN_HEIGHT - 2, - paddingTop: 1, - position: 'absolute', - right: 8, - top: 0 - }, - !disabled && { - cursor: 'pointer' - } - ], - caretDown: [ - globalClassnames.caretDown, - { - color: palette.neutralSecondary, - fontSize: fonts.small.fontSize, - pointerEvents: 'none' - }, - disabled && { - color: semanticColors.disabledText, - selectors: (_j = {}, _j[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _j) - } - ], - errorMessage: (0, _tslib.__assign)((0, _tslib.__assign)({ - color: semanticColors.errorText - }, theme.fonts.small), { - paddingTop: 5 - }), - callout: [ - globalClassnames.callout, - { - boxShadow: effects.elevation8, - borderRadius: calloutOpenBorderRadius, - selectors: (_k = {}, _k['.ms-Callout-main'] = { - borderRadius: calloutOpenBorderRadius - }, _k) - }, - calloutClassName - ], - dropdownItemsWrapper: { - selectors: { - '&:focus': { - outline: 0 - } - } - }, - dropdownItems: [ - globalClassnames.dropdownItems, - { - display: 'block' - } - ], - dropdownItem: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - itemSelectors() - ], false), - dropdownItemSelected: dropdownItemSelected, - dropdownItemDisabled: dropdownItemDisabled, - dropdownItemSelectedAndDisabled: [ - dropdownItemSelected, - dropdownItemDisabled, - { - backgroundColor: 'transparent' - } - ], - dropdownItemHidden: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - { - display: 'none' - } - ], false), - dropdownDivider: [ - globalClassnames.dropdownDivider, - { - height: 1, - backgroundColor: semanticColors.bodyDivider - } - ], - dropdownDividerHidden: [ - globalClassnames.dropdownDivider, - { - display: 'none' - } - ], - dropdownOptionText: [ - globalClassnames.dropdownOptionText, - { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - minWidth: 0, - maxWidth: '100%', - wordWrap: 'break-word', - overflowWrap: 'break-word', - margin: '1px' - } - ], - dropdownItemHeader: dropdownHeaderStyle, - dropdownItemHeaderHidden: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownHeaderStyle, true), [ - { - display: 'none' - } - ], false), - subComponentStyles: { - label: { - root: { - display: 'inline-block' - } - }, - multiSelectItem: { - root: { - padding: 0 - }, - label: { - alignSelf: 'stretch', - padding: '0 8px', - width: '100%' - }, - input: { - selectors: (_l = {}, // eslint-disable-next-line @fluentui/max-len - _l[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus + label::before, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus + label::before")] = { - outlineOffset: '0px' - }, _l) - } - }, - panel: { - root: [ - panelClassName - ], - main: { - selectors: (_m = {}, // In case of extra small screen sizes - _m[MinimumScreenSelector] = { - // panelWidth xs - width: 272 - }, _m) - }, - contentInner: { - padding: '0 0 20px' - } - } + } + this.marshall().clear(); + if (initonly) argops.initonly = true; + return deps; + }, + /** + * Internal method for marshalling parameter values. + * Visits each operator dependency to pull the latest value. + * @return {Parameters} A Parameters object to pass to the update function. + */ + marshall(stamp) { + const argval = this._argval || NO_PARAMS, argops = this._argops; + let item, i, op, mod; + if (argops) { + const n = argops.length; + for (i = 0; i < n; ++i) { + item = argops[i]; + op = item.op; + mod = op.modified() && op.stamp === stamp; + argval.set(item.name, item.index, op.value, mod); + } + if (argops.initonly) { + for (i = 0; i < n; ++i) { + item = argops[i]; + item.op.targets().remove(this); + } + this._argops = null; + this._update = null; + } + } + return argval; + }, + /** + * Detach this operator from the dataflow. + * Unregisters listeners on upstream dependencies. + */ + detach() { + const argops = this._argops; + let i, n, item, op; + if (argops) { + for (i = 0, n = argops.length; i < n; ++i) { + item = argops[i]; + op = item.op; + if (op._targets) { + op._targets.remove(this); + } + } + } + this.pulse = null; + this.source = null; + }, + /** + * Delegate method to perform operator processing. + * Subclasses can override this method to perform custom processing. + * By default, it marshalls parameters and calls the update function + * if that function is defined. If the update function does not + * change the operator value then StopPropagation is returned. + * If no update function is defined, this method does nothing. + * @param {Pulse} pulse - the current dataflow pulse. + * @return The output pulse or StopPropagation. A falsy return value + * (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const update2 = this._update; + if (update2) { + const params2 = this.marshall(pulse2.stamp), v = update2.call(this, params2, pulse2); + params2.clear(); + if (v !== this.value) { + this.value = v; + } else if (!this.modified()) { + return pulse2.StopPropagation; + } + } + }, + /** + * Run this operator for the current pulse. If this operator has already + * been run at (or after) the pulse timestamp, returns StopPropagation. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + rv = 0; + } else { + rv = this.evaluate(pulse2); + } + return this.pulse = rv || pulse2; + } + }; + function add$3(init2, update2, params2, react) { + let shift = 1, op; + if (init2 instanceof Operator) { + op = init2; + } else if (init2 && init2.prototype instanceof Operator) { + op = new init2(); + } else if (isFunction(init2)) { + op = new Operator(null, init2); + } else { + shift = 0; + op = new Operator(init2, update2); + } + this.rank(op); + if (shift) { + react = params2; + params2 = update2; + } + if (params2) this.connect(op, op.parameters(params2, react)); + this.touch(op); + return op; + } + function connect(target2, sources) { + const targetRank = target2.rank, n = sources.length; + for (let i = 0; i < n; ++i) { + if (targetRank < sources[i].rank) { + this.rerank(target2); + return; + } + } + } + let STREAM_ID = 0; + function EventStream(filter2, apply2, receive) { + this.id = ++STREAM_ID; + this.value = null; + if (receive) this.receive = receive; + if (filter2) this._filter = filter2; + if (apply2) this._apply = apply2; + } + function stream(filter2, apply2, receive) { + return new EventStream(filter2, apply2, receive); + } + EventStream.prototype = { + _filter: truthy, + _apply: identity$2, + targets() { + return this._targets || (this._targets = UniqueList(id)); + }, + consume(_) { + if (!arguments.length) return !!this._consume; + this._consume = !!_; + return this; + }, + receive(evt) { + if (this._filter(evt)) { + const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; + for (let i = 0; i < n; ++i) trg[i].receive(val); + if (this._consume) { + evt.preventDefault(); + evt.stopPropagation(); } + } + }, + filter(filter2) { + const s2 = stream(filter2); + this.targets().add(s2); + return s2; + }, + apply(apply2) { + const s2 = stream(null, apply2); + this.targets().add(s2); + return s2; + }, + merge() { + const s2 = stream(); + this.targets().add(s2); + for (let i = 0, n = arguments.length; i < n; ++i) { + arguments[i].targets().add(s2); + } + return s2; + }, + throttle(pause) { + let t = -1; + return this.filter(() => { + const now2 = Date.now(); + if (now2 - t > pause) { + t = now2; + return 1; + } else { + return 0; + } + }); + }, + debounce(delay) { + const s2 = stream(); + this.targets().add(stream(null, null, debounce(delay, (e) => { + const df = e.dataflow; + s2.receive(e); + if (df && df.run) df.run(); + }))); + return s2; + }, + between(a2, b2) { + let active = false; + a2.targets().add(stream(null, null, () => active = true)); + b2.targets().add(stream(null, null, () => active = false)); + return this.filter(() => active); + }, + detach() { + this._filter = truthy; + this._targets = null; + } + }; + function events$1(source2, type2, filter2, apply2) { + const df = this, s2 = stream(filter2, apply2), send = function(e) { + e.dataflow = df; + try { + s2.receive(e); + } catch (error2) { + df.error(error2); + } finally { + df.run(); + } }; -}; - -},{"tslib":"9gizs","../../Utilities":"1NZCy","../../Positioning":"bWPOk","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1pQ7X":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializeIcons", ()=>initializeIcons); -parcelHelpers.export(exports, "use", ()=>use); -var _fabricIcons = require("./fabric-icons"); -let registerIcons; -let unregisterIcons; -function initializeIcons() { - [ - (0, _fabricIcons.initializeIcons) - ].forEach((initialize)=>{ - const subset = initialize(); - unregisterIcons && unregisterIcons(Object.keys(subset.icons)); - registerIcons(subset, { - disableWarnings: true - }); - }); -} -function use(_registerIcons, _unregisterIcons) { - registerIcons = _registerIcons; - unregisterIcons = _unregisterIcons; -} - -},{"./fabric-icons":"6P3kt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6P3kt":[function(require,module,exports,__globalThis) { -// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializeIcons", ()=>initializeIcons); -var _fabricIcons4Ac17Eec = require("./fabric_icons_4ac17eec"); -function initializeIcons() { - const subset = { - style: { - MozOsxFontSmoothing: 'grayscale', - WebkitFontSmoothing: 'antialiased', - fontStyle: 'normal', - fontWeight: 'normal', - speak: 'none' - }, - fontFace: { - fontFamily: '"FabricMDL2Icons"', - src: `url("${(0, _fabricIcons4Ac17Eec.fabricIconsWoff)}") format("woff")` - }, - icons: { - Accept: '\uE8FB', - Add: '\uE710', - BIDashboard: '\uF543', - Camera: '\uE722', - Cancel: '\uE711', - ChevronDown: '\uE70D', - ChevronLeftMed: '\uE973', - ChevronRightMed: '\uE974', - Clear: '\uE894', - ClearFilter: '\uEF8F', - ClearNight: '\uE9C2', - CloudDownload: '\uEBD3', - Color: '\uE790', - Copy: '\uE8C8', - CubeShape: '\uF1AA', - Delete: '\uE74D', - Diamond: '\uED02', - DiamondSolid: '\uF34C', - DoubleChevronLeft12: '\uEE98', - DoubleChevronRight12: '\uEE99', - Download: '\uE896', - Edit: '\uE70F', - Filter: '\uE71C', - Filters: '\uE795', - FiltersSolid: '\uF353', - Flow: '\uEF90', - History: '\uE81C', - HourGlass: '\uEA03', - More: '\uE712', - Next: '\uE893', - OpenInNewWindow: '\uE8A7', - Page: '\uE7C3', - Pause: '\uE769', - Photo2Add: '\uECAB', - Photo2Remove: '\uECAC', - PicturePosition: '\uF524', - Pin: '\uE718', - Pinned: '\uE840', - PlayResume: '\uF2C6', - PlayReverseResume: '\uF3E4', - Previous: '\uE892', - RadioBtnOff: '\uECCA', - RadioBtnOn: '\uECCB', - RadioBullet: '\uE915', - Redo: '\uE7A6', - RemoveFilter: '\uEB08', - ScaleVolume: '\uF18C', - Search: '\uE721', - Settings: '\uE713', - SortDown: '\uEE69', - SortUp: '\uEE68', - Sunny: '\uE9BD', - Table: '\uED86', - Undo: '\uE7A7' + let sources; + if (typeof source2 === "string" && typeof document !== "undefined") { + sources = document.querySelectorAll(source2); + } else { + sources = array$4(source2); + } + const n = sources.length; + for (let i = 0; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + return s2; + } + function parse$5(data2, format2) { + const locale2 = this.locale(); + return read(data2, format2, locale2.timeParse, locale2.utcParse); + } + function ingest(target2, data2, format2) { + data2 = this.parse(data2, format2); + return this.pulse(target2, this.changeset().insert(data2)); + } + async function request(url, format2) { + const df = this; + let status = 0, data2; + try { + data2 = await df.loader().load(url, { + context: "dataflow", + response: responseType(format2 && format2.type) + }); + try { + data2 = df.parse(data2, format2); + } catch (err) { + status = -2; + df.warn("Data ingestion failed", url, err); + } + } catch (err) { + status = -1; + df.warn("Loading failed", url, err); + } + return { + data: data2, + status + }; + } + async function preload(target2, url, format2) { + const df = this, pending = df._pending || loadPending(df); + pending.requests += 1; + const res = await df.request(url, format2); + df.pulse(target2, df.changeset().remove(truthy).insert(res.data || [])); + pending.done(); + return res; + } + function loadPending(df) { + let accept; + const pending = new Promise((a2) => accept = a2); + pending.requests = 0; + pending.done = () => { + if (--pending.requests === 0) { + df._pending = null; + accept(df); + } + }; + return df._pending = pending; + } + const SKIP$2 = { + skip: true + }; + function on(source2, target2, update2, params2, options2) { + const fn2 = source2 instanceof Operator ? onOperator : onStream; + fn2(this, source2, target2, update2, params2, options2); + return this; + } + function onStream(df, stream2, target2, update2, params2, options2) { + const opt = extend({}, options2, SKIP$2); + let func, op; + if (!isFunction(target2)) target2 = constant$4(target2); + if (update2 === void 0) { + func = (e) => df.touch(target2(e)); + } else if (isFunction(update2)) { + op = new Operator(null, update2, params2, false); + func = (e) => { + op.evaluate(e); + const t = target2(e), v = op.value; + isChangeSet(v) ? df.pulse(t, v, options2) : df.update(t, v, opt); + }; + } else { + func = (e) => df.update(target2(e), update2, opt); + } + stream2.apply(func); + } + function onOperator(df, source2, target2, update2, params2, options2) { + if (update2 === void 0) { + source2.targets().add(target2); + } else { + const opt = options2 || {}, op = new Operator(null, updater(target2, update2), params2, false); + op.modified(opt.force); + op.rank = source2.rank; + source2.targets().add(op); + if (target2) { + op.skip(true); + op.value = target2.value; + op.targets().add(target2); + df.connect(target2, [op]); + } + } + } + function updater(target2, update2) { + update2 = isFunction(update2) ? update2 : constant$4(update2); + return target2 ? function(_, pulse2) { + const value2 = update2(_, pulse2); + if (!target2.skip()) { + target2.skip(value2 !== this.value).value = value2; + } + return value2; + } : update2; + } + function rank(op) { + op.rank = ++this._rank; + } + function rerank(op) { + const queue = [op]; + let cur, list, i; + while (queue.length) { + this.rank(cur = queue.pop()); + if (list = cur._targets) { + for (i = list.length; --i >= 0; ) { + queue.push(cur = list[i]); + if (cur === op) error("Cycle detected in dataflow graph."); } - }; - return subset; -} - -},{"./fabric_icons_4ac17eec":"f8QKu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8QKu":[function(require,module,exports,__globalThis) { -// Auto-generated font data - do not edit manually -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fabricIconsWoff", ()=>fabricIconsWoff); -const fabricIconsWoff = 'data:font/woff;base64,d09GRgABAAAAABuQAA4AAAAAMIgABKj2AAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABRAAAAEgAAABgMVN8b2NtYXAAAAGMAAABEAAAArIn/BeDY3Z0IAAAApwAAAAgAAAAKgnZCa9mcGdtAAACvAAAAPAAAAFZ/J7mjmdhc3AAAAOsAAAADAAAAAwACAAbZ2x5ZgAAA7gAABITAAAepM100RhoZWFkAAAVzAAAADIAAAA2BVACQGhoZWEAABYAAAAAFQAAACQQAQgDaG10eAAAFhgAAABQAAAAchoOED5sb2NhAAAWaAAAAHAAAABw0ZDZvG1heHAAABbYAAAAHQAAACAAWQIibmFtZQAAFvgAAAP3AAAJ+pKX8lVwb3N0AAAa8AAAABQAAAAg/1EArnByZXAAABsEAAAAiQAAANN4vfIOeJxjYGH/xDiBgZWBgXUWqzEDA6M0hGa+yJDGJMTBysrFyMQIBgxAIMCAAL7BCgoMDs95vzpzgPkQkgGsjgXCU2BgAAD3EghqeJxjYGBgZoBgGQZGIMnAuAbIYwTzWRgnAOkEBgcGVgaF57zP+Z8LPhd6Lvxc4rnMc6Xnvs8zn094PvX5sufLnx9+IfPC4cWUF9NeLH9x4sXvl6IvS17ufXnoFfNrjteX36x+s+bNqTen3zK9bXuX+W7m+/73Ez72fFz16dhnn8/Bn598Vfnq/P8/AwPYBgG4DYpYbJiEZEMxDhsy3s3AboPEF4nfEp8kvkp8lHgr8QoID0jMl6iTqJLIkciU8BN/K35ZvEm8UbxQPFBcXpxNbKVYolismJyohIi/cKVwuXCMcJSwqtAiwYOCkwXmC8zlW8zXxpvN85znPk8AtyDXZ0jo0RYwstHejsEOAFLcpEl4nGPQYghlKGBoYFjFyMDYwOzAeIDBAYsIEAAAqhwHlXicXY+/TsNADMZzJLSEJ0A6IZ11KkOViJ3phksk1CUlDOelgNRKpO+AlIXFA8/ibhnzYgjMEf4utr/P+ny/c6f5yXx2nKVHKilWnDfhoNQLDurtmf35IU/vNmVhTNV5VvdlwWoJomtOF/VNsGjI0PWWTG0eH7acLWKXxY7w0nDShk7qbQB2qL/HHeJVPJLFI4QS30/xfYxL+rUsVobTiyasA/des/OoAUzFYxN49BoQf8ikP3VnE+NsOWXbwE5zgkSfygL3RJqE+0uPf/Wgkv+G+23Iv6tB9U3c9Bb0h2HBgrChl2fbUAkaYPkOhPxkxgABAAIACAAK//8AD3icnVh7cFRVmj/ffaYREm46SedFwk2nuwkhCelOp8E86EQSeSwkBgapboMwCktQMrqKGEDngKPgBHFMZtx1YLWUCZY7o7vrc2uYXdupLXGmZsQdtsbaSu38oQKzs+Jzq5TOvSf7nXNvd5rglu509+3zuOfxnfO9ft9HJHKKEOV76j1EJjohMcM0AqZhnpL/YL0qvWqvIeo96e//UFlP8APECxf0S1oDUbHh80AM9PGE5bW8CXlca8CafClh7cZx+MnDL7kGxxWbht8wo6YRMfKIFadWXE5RxS3llBXH8Z+Tz/V5+jw+3gO6B0K4tgd8SlJ6MWGvs9clpBft9QnpJemlhEKuaNrrcQhupxCNaHpaT5MYuYscJsdx56KS4iKtWJUDmu5V5RrNXxP0ywFvMIRdLcFoS2s04FVbY9gVbo2ESyI4qMQX8EInRFuCoVhIbYSQN6Q3gr9G00O6Nx/0gO7Lh+KiEp/uC1SBT/bFqiASbo35YnInxNQYhKuk4qJ8yV/TKEVbOiVvuBPLRmznY3+VpH0BAPJT7N3S8pXs4NOeQg/+nmYHV5aXsnefAhmA2U9BHb6F72bewnfxLdQ9xY5IiiJ9uIl9Wt0VXPHOD31LfaVNpePvrAjGF7JPN33ovIWCq99CwSZrbP3DO9radjy8PlPGtq6qq1u1NeaWSu3/jxg79yDsP3Ev3DG73YdXkpr79ipSpV25ZPHSpjmEiZJIBH95RKOkkoSRtwYyM2Tmy/VgmKEYChdevM/shIieL+tmCDlndMIKMKtkXx6Jrz/UxAorNw6NdMVtSqlE410jQxsr4aOmQ+vjpTUVvrn2XQWV9w8M3F9ZID0y11dRU6oRi17X0XZzd61E4nGJ1Hbf3NZx3Whe6YLaovq+YcM6Zgz31RfVLijN4+KO9BGaR3SKWlTApR7pMiCqmk4lj9iE4aPTy6howJWNTtrEmpQDMpmkAZvYAWlSJviCylSnCiVeEiJtuNIsiTK/pg2kotFfVORvrHBLueLrOhSa0/hGJZ5XokBUqhPHbkDE8CNPDAlvF4+gkzTqI38yd+PYA5X0cN6BDoaKyqlr/OuvCQXxiyyLVUlKJNypoMYoXGN0s5ibDdSs1lhrbSTsK/GVKAR2J9huZWl///pjx15LnX3hmScfODTY1FOyf9GzH0DJ4/vPn/nJnnh8z0/OnN9/6H/OPReDOkaosahky/3fg8aTZ1OvHTumEXuSjSVgTEremTorutb3L49t3/5wz+M31Dz22Qtb+fwPDjhrrX7on++mEmEfLexYcF9yy7f5xkTYnMy58kkRqSD13OZoOqjchHCBBDQRHinQKIegU86YAT2PhJemJ+3DT6qBpQe6e/Ylo5d7dz3hV5azyamlsHpOQ3ygUWVljbXF5vK19cHlzUvKtH/sPoBznpRGcE44mtw3dY//iV3KtRBIXzPQOBBvmCO/V7akeXmwfu1ys7i2sSznzv1oEbkUKSglCtca4IYw2hKDRrRzncpsE6XGt7184uBN4fBNB0+8vO2+81utj73l5UGvPL9vo9O393cnkskTv9vrlnge0e1M29hnfeINlpd7ZWPr+fucvimSM1yUwoOQrL5wGq/jkoGuJ2b6VDNk6lj9OmsKYW7hxWla88iXRApQ6VUKEyxA7VcpC+iow7tOj/b3j57elSn7ju7s6Nh5tM8t7UfLg0htMOiILOWfKaLQ3Cm8tGjOJFHKVMzDh181TiV4FLzvajxNA2kmUbIcT+Q3OP0mP4Dhj5r8FBGusgugToqaYBpFJdhGT+Q3IuA+OqFVLb2LLLKot6UKBY9rHVCudxKxCFCGKjaFuyukPGgjyeA+Gk3H+RQ+WU1RmtFYSqdJOs5pTSm4gPMQTm5GRprJLWQvGSVPkZfIGS4tSpVUWFwk5UuKe/eKe+9uu7BTqvXOaKrCucE1N+JwTHG4M8syzW67pTsHuXvle3lWWyGPgPbB6QdXr37w9Acs/Uh0sKfOW1lT6a3r2dISbIu2tK9Zyvv4a1CP5doBp87vAsdF2taE+4/ubBdzsY/NNnFwfFaHNHvE9lnt87PaecSl8RGW5hTX9QxGm1e3t0Tbgi1bslQPRt0DfUlzyXTqfCUxrn3n0f7mtW0RnMv7VDLbGMNVPewqgz79DcYQGTIyXE/ayVrH9ywAoW2OGBsZdhiORHPuQZRbaYf/2AUtrTFETKaYZGpCIGsMs8Lg20yjSA9Go4O9i6aFm+ItmXKZzh6GtoXzSudZcd5QkBYuzHFlXlmJlRJkEz6bz3P0Qqa8PYVaa2flXaJyPLaldI6HN2xKAAGpV7PwXMGMJUQrHRI4z7XJrqNRlfjWF0/Qm8JD26zTCXll36bkiXf23D5x9OD1MIHIAT3E0N5R3QrfRE+8uPXh6W3WLxJyT9/ZO/a8cyLZdduRVQgtWHLZ0OC6WLXw5e59KljMc+2b1/SI0tDJZaokAxBgk6jTaKrUyXQgD2ECBC4nVbTglznmBoV4xRqcdrNRdmxfiQ99qGO/UX0UHxJvKmj5rj94dOJ2TsymPnllwjq9bcghdePo3qHtty7DS9LIqiO3dfFj3XG2Txxy2/TDzqGrY+sGh5bxg7o+W39Tf5PUkm7cOR83DqE/4wqJAF1HeB7jTs4HQa6bCHxjoAm6OIl4vc7l8in6m+aK6/rCNdXswXlzy5t7l7D77beONEjL2f0Nva/cMrAW9mvFwZgJx2LNzCifl8eKypYsaapYfluj9PTCGn1e4Rz47/JmtciMBYs19mCwf1HXri3fWgKH7DMNR6RlcKihd00Z7K+uae5bucK028rh4+ZYZXM5K55TOFc3F9o3N962rKKpYUkZfJiHbJABfY9OBHbRiIfzJWIgU0IGSgqFOAYndhUIACPjN02+UArtL75qHqIek88EDQUwjVGNFZfeczyJTSTP1EeSx4mbkIeX9EtXxzfyGAZM1u6EPGYNYxAlj2N8c0XTGsYhHEPBBnQyDXl877mEBFDpvDwAQ8oBEC422OP2eALOUTiHnkA+Zx+T/irBFqvPpW+E3zsYDBBX6tzgF3JJQm+EKuA3eMQnnK2GAyhbloS3JuhlqhJUS47vGJ0QnSj9NvpFalGUZi7XiHZxrWuIQXyuZKPDjngjoQB3a+LBhdGZMiIncenAxIRFpcA0sZOcYIayqBBlcioA6LgYficmgaRRgQBvUsSaAYw1L3EM6dwWSBSPKHlVbyI9DgFpOGF/pBYm0mMiNpVwpopfvOurMLNC+o4OtbcPHe3rH+XlqEpzGv38pVgDDpMy9aJ+ke8Z8PAIV1eHrTL54og1Jg+PYEVUrbER3K+MlGkj7liHn9LYiDyML+WLVlkZVnGKVWaVkTk8NhD3xTF9PWkiEcQ7bWQFYp7rr6Z2NsrxIiSQOb4uNjGeiJpe3EvSwRvCK/FBSE4NntzX27vv5GCm7L77xkjkxru7u/fcGA7fuOeQADUKcnIKbxnofvZpAubLTVCQYJ8kkzA/MfWXSfZJQiO5i/DSJji9O3c5mXMHV1IEUoLFOJl9av0bzoYCuSmJS1qVSVwf5U3lMqJ/iXgI8ac3XNspFUZbpFCVmsEVtYj4qwAcFCGFSpx+vUSh6BbfP/3Q6pVd9E9vPXNX5+qHTr+PvvT7LH0xtbK6Q64+cP7MyT3x/sfeRgNy6J/eY5cfo9AjET4OtEceBHLX/MTR1979/CC6X77QqsNv3KsoDL3syTPnDxyZ/o+/ixx/Zox9/PnZv91u0COc99xWc/2gIp5BGfKi9AZ46ObqKsoCKhDaZERZPASBMTacgHEYT7BhGMOIhId2lNsM8F7Rz/hYvA++Pse7UcRaIk7AQNXJJWCMioY1guyNoPPslGNOAgLDBrTwCBqLuU/FIAhjCBPlAQfz8XwFwEWKTX57eJeNaIU62qtXrtvUHKivDzRvWreyur0DdRl7F65cuylcu2SmV0Nt3rRqQWv5tckV5hQ1VySvLW9dsGpTtk+Z6dPJrl9tbljT0eIz2hYvbjN8LR1rGjb/ahel2N+0uj1carRf2W+TgXv9+RXeRUMjh3t7D48MLfJW5PvvHfjKXuFrdojYfhW5Ae+mSubqUA/RSFYTNN3xfHowoxVtUOzPAkhfpyzirRhPSqEz1AY3P3Fn1/UjJwfjcVcLugv9xpz19/zNxt5DuzeWrd2QUX48xM9Hb7hh9Oe7GpsW7TpwdHXyuUdvZ13IvnPsXGKcKtPampEnNw+eHLmeCm3A5RRl46ND7Yv/4rZuf8aOUL4CX8nT8e2ewLLtxywNmX8OGhJj0oQbKz6g2zrPifmEDSDI1UgmgAGfHtJDsVDMF/OpukAHIfzjih7SIWKCbqjZeAN+/H7i/czPfrkr/QOdxONpkpLQbMJ1yT+egq4fsVfsipSacqMbqzxnyvtxlVrzu7rkO1jydYQbhP1L8r9OsZR04Q170qWV5zIcWuswmrmS1pyMnoc3RJPTWuxHLTHMGUoljDzwh17V+jHsmMIlaYbMVJIdt0lKnpihMeEMBYJFnB1PIpUY6WRo7ErCDiCcQjkbt1SgbdkwO16pbZS+OkLBUDcTBTcqHDrNjihctP5/BhBOUmDwp4/v27x06eZ9j/90MKc+G/O7q1wB8TMZhdxFtYVXLeXWr8ydVDhx/Dc76Z91sj/3BDmxJNq3ElJOqoiJuDHkZER0nnAIgUg5IGQ0wwgSS8CUEQebXo/Ci5AJ/jxSYMULq6sLrXiBB2helaFQoyoPqMf6Efv9b6RfWg+w38Ktv7H/KO1mf4AP4Rb7WqkB668A3Mp+ayspX+EU9fkUWugrLJBovmHk27RAamR4ifyxqV0i/cm6U36Ul1TcLEo4zWI6HVsFaPt9eNc8ihf0cz/A0U3UFXMMasok08h8IfOgPqBRvSzwC6PC0WKc7j7gPhxSpUV2TCYzsk5cJbGzTfHQ3H8q8Mk5QtTn9bTAnjrIfi/3TurzCfYCjmM/S8AluKTNS8ANX1q6LtqMwyH4d6Kpf6/bYp7I28sRL6gbk8zLCpMwgJNhg7QuwbxwCdfSpS9tDjclEiZlOsdDqkCuHPirAr8qY9Zj8ndGODSS3xbYiFf1YYGNZlASrwkZRqykvz2zDhIdECCYD7AQKn3Hesyudaq4hn6Rw6YZACVqwkc7OSPicokIjOkHv+BEBCIZZqjIBZvey1acsbF2L7xxxsLL51hWF5ds4XVz0yQjInLYxP+FXZnJ4VZw3jvZW462xbo+PWunyVUp3UDywoXk+fPiPye72xpws7uTmZf472RGhV7nIYIuz0gbmDw36jfqJPxDfG4iwnNiU/FETYgF3EOiUE/CQII9j5KscHzBnk/AAJucOsfFIcA43KA8mGQvJKwNMh5cQlrdQRJx38CG9PPOGrganwQbEnww3g/XGYH1S1E/diLvPBjDGhzr84in2KOIEsNYK2Wl5Lj9qHSndGf6LL96lT9npj5jN8PTSj48/QP2FnsLllk72etyM3RZZ+Vm9rp1lvOUC7gevzKmwnUxuEGhp2pqKkWl9+wqR2dsHpR9IXlEWIUxUSa+Lhf+1Cz+qiRFbhLDdDIW1EmizM5GKKlssmJKvMLDf1XOQaHZpISdkkQCAumqJK36By5+nEPySTH2oAQhPzEschjpkUxuAbHBjWANfAbPavAzuxPIL1mH9K/syR54Fj6zdrNfTxOmw260gVot01H/v4WWUKFTZwzl13i/xNr7D8ryqVf1NcjUbfkGl3IjH3dOYdRKc+NaP+eR7OHxaTol4tqZ+JRHtqrH/oKHtiQvK4+yyFWUoQUMoEQ2O1qG0blehnYjYsgi2+qAAa7CesgrQBeganhkrhqSyDBiqMeOp1JSRSDj39nBJA+gkxMTyWm0ackJO3nqVHJaxNTYxLrG58GON6QkOn37AreRWSQRSIIYlZ4vpiRPyZ/gQiBM5bRYlGdY3Lh0ti2/i3yXjJK/Jifd06CMqbPKTH+gJBuLtUMslA/cd5XkxmfZpIdIXFbiwXMSIZFsMBeCcCvCeMSuiPFB/EdEzxX9OXVJpHZ5WEXdylSmomYq7JKXyx6XU/hFeW9gcd00yfbwcnEdkNlDYPaQ9AaXJZp7u8GpC25FyvSgtFE0jAjBULhQnZECGX0XRu7jdYszS2lztS3lld5pMtPFSy+Qq8bA7DH27gxvZzLpLFub4Tz5X7oQ0KMAeJxjYGRgYGBZ8W1igahBPL/NVwZuDgYQ2P/3YAOIvmfgdQZEczCAxTkZmEAUAE1pCdgAAHicY2BkYOBgAAE4yciACpgAAsoAHQAAAHicY9ViWMbBwCDMwMDwmYGNAQQamBoYYADIYmxgBNKMLEAWEDIIMwaDxYWZGhjbmSSBbFYgD6EDrIvxMuMVBiMGSTgfCBlkGA6AOACflgxrAAAAFgAqAEIAZAFUAaQByAIcAjICngLsAzwDpAP+BQYFcgWuBdAGDAZ6BpYGsgbUBvQHGgdMB2QHhgecB7IILAiECLQJQgm0CgoKWgrQCyQLgAvWC/IMDgwyDFYMhgy8DRANQA1eDaQN5g4EDmYPUnicY2BkYGAwZzjBwMsAAoxgkguEGSNBTAAdRwF9AAAAeJy1VD+LHDcUf3u79l1wfARDwKWKEM7HMmtfzJnY1WHHla85mwM3Ae2MdkZ4diQkjYcxLlK6yMdIY8inCAmkTJ1PkDpVyrz3pNnb827MJZAdRvPT0/v7e08LALdHX8II4u8rfCMewS3cRbwDu/BNwmOUP0t4gvjbhK/Bp2ATvg6fwduEd+Fr+D7hPfgcfkn4BhzC7wnfHP08miS8D4c7v2KU0eQT3BU7fyY8gi/G5wnvwP74TcJjlL9LeIL4x4Svwe3xbwlfBzH+I+FdcJO9hPfgcDL4uQEvJj8kfHP8bvJXwvvwYu+7n96Lo7v3HohTnTvjzSKIx8ZZ42TQpsnESV2LM11WwYsz5ZV7rYrsqZw7nYvTJ8+OxIn3KvgzVba1dJsHm5Jz5Tx6Fvez4+N4Sofx7LkqjRLaCymCk4VaSvdKmIUIlVrLr3SmtSTOzdLKRiufbU2+CsE+nM26rsuWw3mGNrPQW1M6aat+tjBN8LMLc99aW2tVCDrIxEvTiqXsResVJoGJkVgEI3KnZFBTUWhva9lPhWwKYZ3G0xxVFH6lF1a5pQ4B3c17LqLWuWrIFx54YdwAFhRhulmqdaZo8zAVxDzaTslmCKAb0VU6r9Yy6zCobvK6LbBNq+xNU/fiQN8RajnHXC7U0cPHsmX1QjelcMoH7BSxehGAzFe+HjEDBxqjBLWkFjiNUQvTNbWRxWX2ZKRKOSrHYChc22DbIApFZZJOpWp7mVEcxqZP6tQQdIj8VHquMefs6t2G9yDgCO7CPXiA6BQ05ODAgMd3AQFljxE5vPO0SpRoRA1keHICNT4CzlBWQoVnnncKvwq1X+NaoOZTtJvjnnxTjCf4z3LE9p41yY6sSmjRn0TNq1hcReec8/ApZwH3MZtjfNZtB8t1u+ecjcFVoA5VJfENzECB0iVn+QplxBKdVKy7jb+S9y0yOGjn+F3iXmJOmtnK/gXzxHNA6UOY4dPxk6G/D+2zFGeGuGcvJfux6KFH6YK9UbWzrdE952yxI5r7KFYW1PuXXJNgJnr8tsxdZCIyNmiTzHDVDjWoDgVT3BesZ7njPUuID4pjuTPRNk9eVNpL9m25r1Rz4DOymnMeQydqroishryihecuuA3JYlXD9Epdtbwv0CbH/ZT5ijMf405XcT6sQPMkdsxTjut2zrpUKWnnWE3Lc1ds5Z5sakYHqH8HvzSh88TLNu8xh//K7YX3gj2VKHM8xyHdqWFWt1UwRN/M69HaDFAlsZbA8YZbQP5jrQVKOq7c8K382OzJS1OluC8mrbGqiFu+WS1bUrZDNwc/pFnzTf7nGY3/jE3qzIX34YboxDLND+U7Z6Zjb/+Hu/03hsc4mgB4nGNgZgCD/34M5QyYwBwAKWEB/3ic28CgzbCJkZNJm3ETF4jcztWaG2qrysChvZ07NdhBTwbE4onwsNCQBLF4nc215YVBLD4dFRkRHhCLX05CmI8DxBLg4+FkZwGxBMEAxBLaMKEgwADIYtjOCDeaCW40M9xoFrjRrHCj2eQkoUazw43mgBvNCTd6kzAju/YGBgXX2kwJFwDEASgaAAAA'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e6BwJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Slider/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Slider/index":"6LlnL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6LlnL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _slider = require("./Slider"); -parcelHelpers.exportAll(_slider, exports); -var _sliderBase = require("./Slider.base"); -parcelHelpers.exportAll(_sliderBase, exports); -var _sliderTypes = require("./Slider.types"); -parcelHelpers.exportAll(_sliderTypes, exports); - -},{"./Slider":"hVh6b","./Slider.base":false,"./Slider.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hVh6b":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Slider", ()=>Slider); -var _utilities = require("@fluentui/utilities"); -var _sliderBase = require("./Slider.base"); -var _sliderStyles = require("./Slider.styles"); -var Slider = (0, _utilities.styled)((0, _sliderBase.SliderBase), (0, _sliderStyles.getStyles), undefined, { - scope: 'Slider' -}); - -},{"@fluentui/utilities":"55bj3","./Slider.base":"6pnLq","./Slider.styles":"7YHnV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6pnLq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SliderBase", ()=>SliderBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _label = require("../Label/Label"); -var _useSlider = require("./useSlider"); -var COMPONENT_NAME = 'SliderBase'; -var SliderBase = _react.forwardRef(function(props, ref) { - var slotProps = (0, _useSlider.useSlider)(props, ref); - return _react.createElement("div", (0, _tslib.__assign)({}, slotProps.root), slotProps && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.label)), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.container), props.ranged && (props.vertical ? slotProps.valueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.valueLabel)) : slotProps.lowerValueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.lowerValueLabel))), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.sliderBox), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.sliderLine), props.ranged && _react.createElement("span", (0, _tslib.__assign)({}, slotProps.lowerValueThumb)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.thumb)), slotProps.zeroTick && _react.createElement("span", (0, _tslib.__assign)({}, slotProps.zeroTick)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.bottomInactiveTrack)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.activeTrack)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.topInactiveTrack)))), props.ranged && props.vertical ? slotProps.lowerValueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.lowerValueLabel)) : slotProps.valueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.valueLabel))), _react.createElement((0, _utilities.FocusRects), null)); -}); -SliderBase.displayName = COMPONENT_NAME; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../Label/Label":"4UD9B","./useSlider":"8W46H","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8W46H":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ONKEYDOWN_TIMEOUT_DURATION", ()=>ONKEYDOWN_TIMEOUT_DURATION); -parcelHelpers.export(exports, "useSlider", ()=>useSlider); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _dom = require("../../utilities/dom"); -var ONKEYDOWN_TIMEOUT_DURATION = 1000; -var getClassNames = (0, _utilities.classNamesFunction)(); -var getSlotStyleFn = function(sty) { - return function(value) { - var _a; - return _a = {}, _a[sty] = "".concat(value, "%"), _a; - }; -}; -var getPercent = function(value, sliderMin, sliderMax) { - return sliderMax === sliderMin ? 0 : (value - sliderMin) / (sliderMax - sliderMin) * 100; -}; -var useComponentRef = function(props, sliderBoxRef, value, range) { - _react.useImperativeHandle(props.componentRef, function() { - return { - get value () { - return value; - }, - get range () { - return range; - }, - focus: function() { - var _a; - (_a = sliderBoxRef.current) === null || _a === void 0 || _a.focus(); - } - }; - }, [ - range, - sliderBoxRef, - value - ]); -}; -var useSlider = function(props, ref) { - var _a = props.step, step = _a === void 0 ? 1 : _a, className = props.className, _b = props.disabled, disabled = _b === void 0 ? false : _b, label = props.label, _c = props.max, max = _c === void 0 ? 10 : _c, _d = props.min, min = _d === void 0 ? 0 : _d, _e = props.showValue, showValue = _e === void 0 ? true : _e, _f = props.buttonProps, buttonProps = _f === void 0 ? {} : _f, _g = props.vertical, vertical = _g === void 0 ? false : _g, snapToStep = props.snapToStep, valueFormat = props.valueFormat, styles = props.styles, theme = props.theme, originFromZero = props.originFromZero, ariaLabelledBy = props["aria-labelledby"], _h = props.ariaLabel, ariaLabel = _h === void 0 ? props['aria-label'] : _h, ranged = props.ranged, onChange = props.onChange, onChanged = props.onChanged; - var disposables = _react.useRef([]); - var _j = (0, _reactHooks.useSetTimeout)(), setTimeout = _j.setTimeout, clearTimeout = _j.clearTimeout; - var sliderLine = _react.useRef(null); - var win = (0, _dom.useWindowEx)(); - // Casting here is necessary because useControllableValue expects the event for the change callback - // to extend React.SyntheticEvent, when in fact for Slider, the event could be either a React event - // or a native browser event depending on the context. - var _k = (0, _reactHooks.useControllableValue)(props.value, props.defaultValue, function(ev, v) { - return onChange === null || onChange === void 0 ? void 0 : onChange(v, ranged ? [ - internalState.latestLowerValue, - v - ] : undefined, ev); - }), unclampedValue = _k[0], setValue = _k[1]; - var _l = (0, _reactHooks.useControllableValue)(props.lowerValue, props.defaultLowerValue, function(ev, lv) { - return onChange === null || onChange === void 0 ? void 0 : onChange(internalState.latestValue, [ - lv, - internalState.latestValue - ], ev); - }), unclampedLowerValue = _l[0], setLowerValue = _l[1]; - // Ensure that value is always a number and is clamped by min/max. - var value = Math.max(min, Math.min(max, unclampedValue || 0)); - var lowerValue = Math.max(min, Math.min(value, unclampedLowerValue || 0)); - var internalState = (0, _reactHooks.useConst)({ - onKeyDownTimer: -1, - isAdjustingLowerValue: false, - latestValue: value, - latestLowerValue: lowerValue - }); - // On each render, update this saved value used by callbacks. (This should be safe even if render - // is called multiple times, because an event handler or timeout callback will only run once.) - internalState.latestValue = value; - internalState.latestLowerValue = lowerValue; - var id = (0, _reactHooks.useId)('Slider', props.id || (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.id)); - var classNames = getClassNames(styles, { - className: className, - disabled: disabled, - vertical: vertical, - showTransitions: !snapToStep && !internalState.isBetweenSteps, - showValue: showValue, - ranged: ranged, - theme: theme + } + } + } + const StopPropagation = {}; + const ADD = 1 << 0, REM = 1 << 1, MOD$1 = 1 << 2, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD$1, ALL = ADD | REM | MOD$1, REFLOW = 1 << 3, SOURCE = 1 << 4, NO_SOURCE = 1 << 5, NO_FIELDS = 1 << 6; + function Pulse(dataflow, stamp, encode2) { + this.dataflow = dataflow; + this.stamp = stamp == null ? -1 : stamp; + this.add = []; + this.rem = []; + this.mod = []; + this.fields = null; + this.encode = encode2 || null; + } + function materialize(data2, filter2) { + const out = []; + visitArray(data2, filter2, (_) => out.push(_)); + return out; + } + function filter$1(pulse2, flags) { + const map2 = {}; + pulse2.visit(flags, (t) => { + map2[tupleid(t)] = 1; }); - var steps = (max - min) / step; - var clearOnKeyDownTimer = function() { - clearTimeout(internalState.onKeyDownTimer); - internalState.onKeyDownTimer = -1; - }; - var setOnKeyDownTimer = function(event) { - clearOnKeyDownTimer(); - if (onChanged) internalState.onKeyDownTimer = setTimeout(function() { - onChanged(event, internalState.latestValue, ranged ? [ - internalState.latestLowerValue, - internalState.latestValue - ] : undefined); - }, ONKEYDOWN_TIMEOUT_DURATION); - }; - var getAriaValueText = function(valueProps) { - var ariaValueText = props.ariaValueText; - if (valueProps !== undefined) return ariaValueText ? ariaValueText(valueProps) : valueProps.toString(); - return undefined; - }; + return (t) => map2[tupleid(t)] ? null : t; + } + function addFilter(a2, b2) { + return a2 ? (t, i) => a2(t, i) && b2(t, i) : b2; + } + Pulse.prototype = { /** - * Update `value` or `lowerValue`, including clamping between min/max and rounding to - * appropriate precision. - * @param newValue - New current value of the slider, possibly rounded to a whole step. - * @param newUnroundedValue - Like `newValue` but without the rounding to a step. If this is - * provided and not equal to `newValue`, `internalState.isBetweenSteps` will be set, which - * may cause thumb movement animations to be disabled. - */ var updateValue = function(ev, newValue, newUnroundedValue) { - newValue = Math.min(max, Math.max(min, newValue)); - newUnroundedValue = newUnroundedValue !== undefined ? Math.min(max, Math.max(min, newUnroundedValue)) : undefined; - var numDec = 0; - if (isFinite(step)) while(Math.round(step * Math.pow(10, numDec)) / Math.pow(10, numDec) !== step)numDec++; - // Make sure value has correct number of decimal places based on number of decimals in step - var roundedValue = parseFloat(newValue.toFixed(numDec)); - internalState.isBetweenSteps = newUnroundedValue !== undefined && newUnroundedValue !== roundedValue; - if (ranged) { - // decided which thumb value to change - if (internalState.isAdjustingLowerValue && (originFromZero ? roundedValue <= 0 : roundedValue <= internalState.latestValue)) setLowerValue(roundedValue, ev); - else if (!internalState.isAdjustingLowerValue && (originFromZero ? roundedValue >= 0 : roundedValue >= internalState.latestLowerValue)) setValue(roundedValue, ev); - } else setValue(roundedValue, ev); - }; - var onKeyDown = function(event) { - var newCurrentValue = internalState.isAdjustingLowerValue ? internalState.latestLowerValue : internalState.latestValue; - var diff = 0; - // eslint-disable-next-line deprecation/deprecation - switch(event.which){ - case (0, _utilities.getRTLSafeKeyCode)((0, _utilities.KeyCodes).left, props.theme): - case (0, _utilities.KeyCodes).down: - diff = -step; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - case (0, _utilities.getRTLSafeKeyCode)((0, _utilities.KeyCodes).right, props.theme): - case (0, _utilities.KeyCodes).up: - diff = step; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - case (0, _utilities.KeyCodes).home: - newCurrentValue = min; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - case (0, _utilities.KeyCodes).end: - newCurrentValue = max; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - default: - return; + * Sentinel value indicating pulse propagation should stop. + */ + StopPropagation, + /** + * Boolean flag indicating ADD (added) tuples. + */ + ADD, + /** + * Boolean flag indicating REM (removed) tuples. + */ + REM, + /** + * Boolean flag indicating MOD (modified) tuples. + */ + MOD: MOD$1, + /** + * Boolean flag indicating ADD (added) and REM (removed) tuples. + */ + ADD_REM, + /** + * Boolean flag indicating ADD (added) and MOD (modified) tuples. + */ + ADD_MOD, + /** + * Boolean flag indicating ADD, REM and MOD tuples. + */ + ALL, + /** + * Boolean flag indicating all tuples in a data source + * except for the ADD, REM and MOD tuples. + */ + REFLOW, + /** + * Boolean flag indicating a 'pass-through' to a + * backing data source, ignoring ADD, REM and MOD tuples. + */ + SOURCE, + /** + * Boolean flag indicating that source data should be + * suppressed when creating a forked pulse. + */ + NO_SOURCE, + /** + * Boolean flag indicating that field modifications should be + * suppressed when creating a forked pulse. + */ + NO_FIELDS, + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. + * @return {Pulse} - The forked pulse instance. + * @see init + */ + fork(flags) { + return new Pulse(this.dataflow).init(this, flags); + }, + /** + * Creates a copy of this pulse with new materialized array + * instances for the ADD, REM, MOD, and SOURCE arrays. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} - The cloned pulse instance. + * @see init + */ + clone() { + const p = this.fork(ALL); + p.add = p.add.slice(); + p.rem = p.rem.slice(); + p.mod = p.mod.slice(); + if (p.source) p.source = p.source.slice(); + return p.materialize(ALL | SOURCE); + }, + /** + * Returns a pulse that adds all tuples from a backing source. This is + * useful for cases where operators are added to a dataflow after an + * upstream data pipeline has already been processed, ensuring that + * new operators can observe all tuples within a stream. + * @return {Pulse} - A pulse instance with all source tuples included + * in the add array. If the current pulse already has all source + * tuples in its add array, it is returned directly. If the current + * pulse does not have a backing source, it is returned directly. + */ + addAll() { + let p = this; + const reuse = !p.source || p.add === p.rem || !p.rem.length && p.source.length === p.add.length; + if (reuse) { + return p; + } else { + p = new Pulse(this.dataflow).init(this); + p.add = p.source; + p.rem = []; + return p; + } + }, + /** + * Initialize this pulse based on the values of another pulse. This method + * is used internally by {@link fork} to initialize a new forked tuple. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {Pulse} src - The source pulse to copy from. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. By default, source data arrays are copied + * to the new pulse. Use the NO_SOURCE flag to enforce a null source. + * @return {Pulse} - Returns this Pulse instance. + */ + init(src, flags) { + const p = this; + p.stamp = src.stamp; + p.encode = src.encode; + if (src.fields && !(flags & NO_FIELDS)) { + p.fields = src.fields; + } + if (flags & ADD) { + p.addF = src.addF; + p.add = src.add; + } else { + p.addF = null; + p.add = []; + } + if (flags & REM) { + p.remF = src.remF; + p.rem = src.rem; + } else { + p.remF = null; + p.rem = []; + } + if (flags & MOD$1) { + p.modF = src.modF; + p.mod = src.mod; + } else { + p.modF = null; + p.mod = []; + } + if (flags & NO_SOURCE) { + p.srcF = null; + p.source = null; + } else { + p.srcF = src.srcF; + p.source = src.source; + if (src.cleans) p.cleans = src.cleans; + } + return p; + }, + /** + * Schedules a function to run after pulse propagation completes. + * @param {function} func - The function to run. + */ + runAfter(func) { + this.dataflow.runAfter(func); + }, + /** + * Indicates if tuples have been added, removed or modified. + * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. + * Defaults to ALL, returning true if any tuple type has changed. + * @return {boolean} - Returns true if one or more queried tuple types have + * changed, false otherwise. + */ + changed(flags) { + const f = flags || ALL; + return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD$1 && this.mod.length; + }, + /** + * Forces a "reflow" of tuple values, such that all tuples in the backing + * source are added to the MOD set, unless already present in the ADD set. + * @param {boolean} [fork=false] - If true, returns a forked copy of this + * pulse, and invokes reflow on that derived pulse. + * @return {Pulse} - The reflowed pulse instance. + */ + reflow(fork) { + if (fork) return this.fork(ALL).reflow(); + const len2 = this.add.length, src = this.source && this.source.length; + if (src && src !== len2) { + this.mod = this.source; + if (len2) this.filter(MOD$1, filter$1(this, ADD)); + } + return this; + }, + /** + * Get/set metadata to pulse requesting garbage collection + * to reclaim currently unused resources. + */ + clean(value2) { + if (arguments.length) { + this.cleans = !!value2; + return this; + } else { + return this.cleans; + } + }, + /** + * Marks one or more data field names as modified to assist dependency + * tracking and incremental processing by transform operators. + * @param {string|Array<string>} _ - The field(s) to mark as modified. + * @return {Pulse} - This pulse instance. + */ + modifies(_) { + const hash = this.fields || (this.fields = {}); + if (isArray(_)) { + _.forEach((f) => hash[f] = true); + } else { + hash[_] = true; + } + return this; + }, + /** + * Checks if one or more data fields have been modified during this pulse + * propagation timestamp. + * @param {string|Array<string>} _ - The field(s) to check for modified. + * @param {boolean} nomod - If true, will check the modified flag even if + * no mod tuples exist. If false (default), mod tuples must be present. + * @return {boolean} - Returns true if any of the provided fields has been + * marked as modified, false otherwise. + */ + modified(_, nomod) { + const fields = this.fields; + return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some((f) => fields[f]) : fields[_]; + }, + /** + * Adds a filter function to one more tuple sets. Filters are applied to + * backing tuple arrays, to determine the actual set of tuples considered + * added, removed or modified. They can be used to delay materialization of + * a tuple set in order to avoid expensive array copies. In addition, the + * filter functions can serve as value transformers: unlike standard predicate + * function (which return boolean values), Pulse filters should return the + * actual tuple value to process. If a tuple set is already filtered, the + * new filter function will be appended into a conjuntive ('and') query. + * @param {number} flags - Flags indicating the tuple set(s) to filter. + * @param {function(*):object} filter - Filter function that will be applied + * to the tuple set array, and should return a data tuple if the value + * should be included in the tuple set, and falsy (or null) otherwise. + * @return {Pulse} - Returns this pulse instance. + */ + filter(flags, filter2) { + const p = this; + if (flags & ADD) p.addF = addFilter(p.addF, filter2); + if (flags & REM) p.remF = addFilter(p.remF, filter2); + if (flags & MOD$1) p.modF = addFilter(p.modF, filter2); + if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter2); + return p; + }, + /** + * Materialize one or more tuple sets in this pulse. If the tuple set(s) have + * a registered filter function, it will be applied and the tuple set(s) will + * be replaced with materialized tuple arrays. + * @param {number} flags - Flags indicating the tuple set(s) to materialize. + * @return {Pulse} - Returns this pulse instance. + */ + materialize(flags) { + flags = flags || ALL; + const p = this; + if (flags & ADD && p.addF) { + p.add = materialize(p.add, p.addF); + p.addF = null; + } + if (flags & REM && p.remF) { + p.rem = materialize(p.rem, p.remF); + p.remF = null; + } + if (flags & MOD$1 && p.modF) { + p.mod = materialize(p.mod, p.modF); + p.modF = null; + } + if (flags & SOURCE && p.srcF) { + p.source = p.source.filter(p.srcF); + p.srcF = null; + } + return p; + }, + /** + * Visit one or more tuple sets in this pulse. + * @param {number} flags - Flags indicating the tuple set(s) to visit. + * Legal values are ADD, REM, MOD and SOURCE (if a backing data source + * has been set). + * @param {function(object):*} - Visitor function invoked per-tuple. + * @return {Pulse} - Returns this pulse instance. + */ + visit(flags, visitor) { + const p = this, v = visitor; + if (flags & SOURCE) { + visitArray(p.source, p.srcF, v); + return p; + } + if (flags & ADD) visitArray(p.add, p.addF, v); + if (flags & REM) visitArray(p.rem, p.remF, v); + if (flags & MOD$1) visitArray(p.mod, p.modF, v); + const src = p.source; + if (flags & REFLOW && src) { + const sum2 = p.add.length + p.mod.length; + if (sum2 === src.length) ; + else if (sum2) { + visitArray(src, filter$1(p, ADD_MOD), v); + } else { + visitArray(src, p.srcF, v); } - updateValue(event, newCurrentValue + diff); - event.preventDefault(); - event.stopPropagation(); - }; - var getPosition = function(event, verticalProp) { - var currentPosition = 0; - switch(event.type){ - case 'mousedown': - case 'mousemove': - currentPosition = !verticalProp ? event.clientX : event.clientY; - break; - case 'touchstart': - case 'touchmove': - currentPosition = !verticalProp ? event.touches[0].clientX : event.touches[0].clientY; - break; + } + return p; + } + }; + function MultiPulse(dataflow, stamp, pulses, encode2) { + const p = this; + let c2 = 0; + this.dataflow = dataflow; + this.stamp = stamp; + this.fields = null; + this.encode = encode2 || null; + this.pulses = pulses; + for (const pulse2 of pulses) { + if (pulse2.stamp !== stamp) continue; + if (pulse2.fields) { + const hash = p.fields || (p.fields = {}); + for (const f in pulse2.fields) { + hash[f] = 1; } - return currentPosition; - }; - var calculateCurrentSteps = function(event) { - // eslint-disable-next-line deprecation/deprecation - var sliderPositionRect = sliderLine.current.getBoundingClientRect(); - var sliderLength = !props.vertical ? sliderPositionRect.width : sliderPositionRect.height; - var stepLength = sliderLength / steps; - var currentSteps; - var distance; - if (!props.vertical) { - var left = getPosition(event, props.vertical); - distance = (0, _utilities.getRTL)(props.theme) ? sliderPositionRect.right - left : left - sliderPositionRect.left; - currentSteps = distance / stepLength; - } else { - var bottom = getPosition(event, props.vertical); - distance = sliderPositionRect.bottom - bottom; - currentSteps = distance / stepLength; - } - return currentSteps; - }; - var onMouseMoveOrTouchMove = function(event, suppressEventCancelation) { - var currentSteps = calculateCurrentSteps(event); - var newUnroundedValue = min + step * currentSteps; - var newCurrentValue = min + step * Math.round(currentSteps); - updateValue(event, newCurrentValue, newUnroundedValue); - if (!suppressEventCancelation) { - event.preventDefault(); - event.stopPropagation(); - } - }; - var onMouseDownOrTouchStart = function(event) { - if (ranged) { - var currentSteps = calculateCurrentSteps(event); - var newValue = min + step * currentSteps; - internalState.isAdjustingLowerValue = newValue <= internalState.latestLowerValue || newValue - internalState.latestLowerValue <= internalState.latestValue - newValue; - } - // safe to use `win!` since it can only be called on the client - if (event.type === 'mousedown') disposables.current.push((0, _utilities.on)(win, 'mousemove', onMouseMoveOrTouchMove, true), (0, _utilities.on)(win, 'mouseup', onMouseUpOrTouchEnd, true)); - else if (event.type === 'touchstart') disposables.current.push((0, _utilities.on)(win, 'touchmove', onMouseMoveOrTouchMove, true), (0, _utilities.on)(win, 'touchend', onMouseUpOrTouchEnd, true)); - onMouseMoveOrTouchMove(event, true); - }; - var onMouseUpOrTouchEnd = function(event) { - // Done adjusting, so clear this value - internalState.isBetweenSteps = undefined; - onChanged === null || onChanged === void 0 || onChanged(event, internalState.latestValue, ranged ? [ - internalState.latestLowerValue, - internalState.latestValue - ] : undefined); - disposeListeners(); - }; - var onThumbFocus = function(event) { - internalState.isAdjustingLowerValue = event.target === lowerValueThumbRef.current; - }; - var disposeListeners = _react.useCallback(function() { - disposables.current.forEach(function(dispose) { - return dispose(); + } + if (pulse2.changed(p.ADD)) c2 |= p.ADD; + if (pulse2.changed(p.REM)) c2 |= p.REM; + if (pulse2.changed(p.MOD)) c2 |= p.MOD; + } + this.changes = c2; + } + inherits(MultiPulse, Pulse, { + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} + */ + fork(flags) { + const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); + if (flags !== void 0) { + if (flags & p.ADD) this.visit(p.ADD, (t) => p.add.push(t)); + if (flags & p.REM) this.visit(p.REM, (t) => p.rem.push(t)); + if (flags & p.MOD) this.visit(p.MOD, (t) => p.mod.push(t)); + } + return p; + }, + changed(flags) { + return this.changes & flags; + }, + modified(_) { + const p = this, fields = p.fields; + return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some((f) => fields[f]) : fields[_]; + }, + filter() { + error("MultiPulse does not support filtering."); + }, + materialize() { + error("MultiPulse does not support materialization."); + }, + visit(flags, visitor) { + const p = this, pulses = p.pulses, n = pulses.length; + let i = 0; + if (flags & p.SOURCE) { + for (; i < n; ++i) { + pulses[i].visit(flags, visitor); + } + } else { + for (; i < n; ++i) { + if (pulses[i].stamp === p.stamp) { + pulses[i].visit(flags, visitor); + } + } + } + return p; + } + }); + async function evaluate(encode2, prerun, postrun) { + const df = this, async = []; + if (df._pulse) return reentrant(df); + if (df._pending) await df._pending; + if (prerun) await asyncCallback(df, prerun); + if (!df._touched.length) { + df.debug("Dataflow invoked, but nothing to do."); + return df; + } + const stamp = ++df._clock; + df._pulse = new Pulse(df, stamp, encode2); + df._touched.forEach((op2) => df._enqueue(op2, true)); + df._touched = UniqueList(id); + let count2 = 0, op, next, error2; + try { + while (df._heap.size() > 0) { + op = df._heap.pop(); + if (op.rank !== op.qrank) { + df._enqueue(op, true); + continue; + } + next = op.run(df._getPulse(op, encode2)); + if (next.then) { + next = await next; + } else if (next.async) { + async.push(next.async); + next = StopPropagation; + } + if (next !== StopPropagation) { + if (op._targets) op._targets.forEach((op2) => df._enqueue(op2)); + } + ++count2; + } + } catch (err) { + df._heap.clear(); + error2 = err; + } + df._input = {}; + df._pulse = null; + df.debug(`Pulse ${stamp}: ${count2} operators`); + if (error2) { + df._postrun = []; + df.error(error2); + } + if (df._postrun.length) { + const pr = df._postrun.sort((a2, b2) => b2.priority - a2.priority); + df._postrun = []; + for (let i = 0; i < pr.length; ++i) { + await asyncCallback(df, pr[i].callback); + } + } + if (postrun) await asyncCallback(df, postrun); + if (async.length) { + Promise.all(async).then((cb) => df.runAsync(null, () => { + cb.forEach((f) => { + try { + f(df); + } catch (err) { + df.error(err); + } }); - disposables.current = []; - }, []); - _react.useEffect(function() { - return disposeListeners; - }, [ - disposeListeners - ]); - var lowerValueThumbRef = _react.useRef(null); - var thumbRef = _react.useRef(null); - var sliderBoxRef = _react.useRef(null); - useComponentRef(props, sliderBoxRef, value, ranged ? [ - lowerValue, - value - ] : undefined); - var getPositionStyles = getSlotStyleFn(vertical ? 'bottom' : (0, _utilities.getRTL)(props.theme) ? 'right' : 'left'); - var getTrackStyles = getSlotStyleFn(vertical ? 'height' : 'width'); - var originValue = originFromZero ? 0 : min; - var valuePercent = getPercent(value, min, max); - var lowerValuePercent = getPercent(lowerValue, min, max); - var originPercentOfLine = getPercent(originValue, min, max); - var activeSectionWidth = ranged ? valuePercent - lowerValuePercent : Math.abs(originPercentOfLine - valuePercent); - var topSectionWidth = Math.min(100 - valuePercent, 100 - originPercentOfLine); - var bottomSectionWidth = ranged ? lowerValuePercent : Math.min(valuePercent, originPercentOfLine); - var rootProps = { - className: classNames.root, - ref: ref - }; - var labelProps = { - className: classNames.titleLabel, - children: label, - disabled: disabled, - htmlFor: ariaLabel ? undefined : id - }; - var valueLabelProps = showValue ? { - className: classNames.valueLabel, - children: valueFormat ? valueFormat(value) : value, - disabled: disabled, - htmlFor: disabled ? id : undefined - } : undefined; - var lowerValueLabelProps = ranged && showValue ? { - className: classNames.valueLabel, - children: valueFormat ? valueFormat(lowerValue) : lowerValue, - disabled: disabled - } : undefined; - var zeroTickProps = originFromZero ? { - className: classNames.zeroTick, - style: getPositionStyles(originPercentOfLine) - } : undefined; - var trackActiveProps = { - className: (0, _utilities.css)(classNames.lineContainer, classNames.activeSection), - style: getTrackStyles(activeSectionWidth) - }; - var trackTopInactiveProps = { - className: (0, _utilities.css)(classNames.lineContainer, classNames.inactiveSection), - style: getTrackStyles(topSectionWidth) - }; - var trackBottomInactiveProps = { - className: (0, _utilities.css)(classNames.lineContainer, classNames.inactiveSection), - style: getTrackStyles(bottomSectionWidth) - }; - var sliderProps = (0, _tslib.__assign)({ - 'aria-disabled': disabled, - role: 'slider', - tabIndex: disabled ? undefined : 0 - }, { - 'data-is-focusable': !disabled - }); - var sliderBoxProps = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({ - id: id, - className: (0, _utilities.css)(classNames.slideBox, buttonProps.className), - ref: sliderBoxRef - }, !disabled && { - onMouseDown: onMouseDownOrTouchStart, - onTouchStart: onMouseDownOrTouchStart, - onKeyDown: onKeyDown - }), buttonProps && (0, _utilities.getNativeProps)(buttonProps, (0, _utilities.divProperties), [ - 'id', - 'className' - ])), !ranged && (0, _tslib.__assign)((0, _tslib.__assign)({}, sliderProps), { - 'aria-valuemin': min, - 'aria-valuemax': max, - 'aria-valuenow': value, - 'aria-valuetext': getAriaValueText(value), - 'aria-label': ariaLabel || label, - 'aria-labelledby': ariaLabelledBy - })); - var onFocusProp = disabled ? {} : { - onFocus: onThumbFocus - }; - var thumbProps = (0, _tslib.__assign)({ - ref: thumbRef, - className: classNames.thumb, - style: getPositionStyles(valuePercent) - }, ranged && (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, sliderProps), onFocusProp), { - id: "max-".concat(id), - 'aria-valuemin': lowerValue, - 'aria-valuemax': max, - 'aria-valuenow': value, - 'aria-valuetext': getAriaValueText(value), - 'aria-label': "max ".concat(ariaLabel || label) - })); - var lowerValueThumbProps = ranged ? (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({ - ref: lowerValueThumbRef, - className: classNames.thumb, - style: getPositionStyles(lowerValuePercent) - }, sliderProps), onFocusProp), { - id: "min-".concat(id), - 'aria-valuemin': min, - 'aria-valuemax': value, - 'aria-valuenow': lowerValue, - 'aria-valuetext': getAriaValueText(lowerValue), - 'aria-label': "min ".concat(ariaLabel || label) - }) : undefined; - var containerProps = { - className: classNames.container - }; - var sliderLineProps = { - ref: sliderLine, - className: classNames.line - }; - return { - root: rootProps, - label: labelProps, - sliderBox: sliderBoxProps, - container: containerProps, - valueLabel: valueLabelProps, - lowerValueLabel: lowerValueLabelProps, - thumb: thumbProps, - lowerValueThumb: lowerValueThumbProps, - zeroTick: zeroTickProps, - activeTrack: trackActiveProps, - topInactiveTrack: trackTopInactiveProps, - bottomInactiveTrack: trackBottomInactiveProps, - sliderLine: sliderLineProps - }; -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7YHnV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styleUtilities = require("@fluentui/style-utilities"); -var _utilities = require("@fluentui/utilities"); -var GlobalClassNames = { - root: 'ms-Slider', - enabled: 'ms-Slider-enabled', - disabled: 'ms-Slider-disabled', - row: 'ms-Slider-row', - column: 'ms-Slider-column', - container: 'ms-Slider-container', - slideBox: 'ms-Slider-slideBox', - line: 'ms-Slider-line', - thumb: 'ms-Slider-thumb', - activeSection: 'ms-Slider-active', - inactiveSection: 'ms-Slider-inactive', - valueLabel: 'ms-Slider-value', - showValue: 'ms-Slider-showValue', - showTransitions: 'ms-Slider-showTransitions', - zeroTick: 'ms-Slider-zeroTick' -}; -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; - var className = props.className, titleLabelClassName = props.titleLabelClassName, theme = props.theme, vertical = props.vertical, disabled = props.disabled, showTransitions = props.showTransitions, showValue = props.showValue, ranged = props.ranged; - var semanticColors = theme.semanticColors, palette = theme.palette; - var classNames = (0, _styleUtilities.getGlobalClassNames)(GlobalClassNames, theme); - /** Tokens: - * The word "active" in the token refers to the selected section of the slider - * The word "inactive" in the token refers to the unselected section of the slider */ var pressedActiveSectionColor = semanticColors.inputBackgroundCheckedHovered; - var hoveredActiveSectionColor = semanticColors.inputBackgroundChecked; - var hoveredPressedinactiveSectionColor = palette.neutralSecondaryAlt; - var restActiveSectionColor = palette.neutralPrimary; - var restInactiveSectionColor = palette.neutralSecondaryAlt; - var disabledActiveSectionColor = semanticColors.disabledText; - var disabledInactiveSectionColor = semanticColors.disabledBackground; - var thumbBackgroundColor = semanticColors.inputBackground; - var thumbBorderColor = semanticColors.smallInputBorder; - var thumbDisabledBorderColor = semanticColors.disabledBorder; - var slideBoxActiveSectionStyles = !disabled && { - backgroundColor: pressedActiveSectionColor, - selectors: (_a = {}, _a[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _a) - }; - var slideBoxInactiveSectionStyles = !disabled && { - backgroundColor: hoveredPressedinactiveSectionColor, - selectors: (_b = {}, _b[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _b) - }; - var slideHoverSectionStyles = !disabled && { - backgroundColor: hoveredActiveSectionColor, - selectors: (_c = {}, _c[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _c) - }; - var slideBoxActiveThumbStyles = !disabled && { - border: "2px solid ".concat(pressedActiveSectionColor), - selectors: (_d = {}, _d[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _d) - }; - var slideBoxActiveZeroTickStyles = !props.disabled && { - backgroundColor: semanticColors.inputPlaceholderBackgroundChecked, - selectors: (_e = {}, _e[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _e) - }; - return { - root: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([ - classNames.root, - theme.fonts.medium, - { - userSelect: 'none' - }, - vertical && { - marginRight: 8 - } - ], [ - !disabled ? classNames.enabled : undefined - ], false), [ - disabled ? classNames.disabled : undefined - ], false), [ - !vertical ? classNames.row : undefined - ], false), [ - vertical ? classNames.column : undefined - ], false), [ - className - ], false), - titleLabel: [ - { - padding: 0 - }, - titleLabelClassName - ], - container: [ - classNames.container, - { - display: 'flex', - flexWrap: 'nowrap', - alignItems: 'center' - }, - vertical && { - flexDirection: 'column', - height: '100%', - textAlign: 'center', - margin: '8px 0' - } - ], - slideBox: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([ - classNames.slideBox, - !ranged && (0, _styleUtilities.getFocusStyle)(theme), - { - background: 'transparent', - border: 'none', - flexGrow: 1, - lineHeight: 28, - display: 'flex', - alignItems: 'center', - selectors: (_f = {}, _f[":active .".concat(classNames.activeSection)] = slideBoxActiveSectionStyles, _f[":hover .".concat(classNames.activeSection)] = slideHoverSectionStyles, _f[":active .".concat(classNames.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":hover .".concat(classNames.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":active .".concat(classNames.thumb)] = slideBoxActiveThumbStyles, _f[":hover .".concat(classNames.thumb)] = slideBoxActiveThumbStyles, _f[":active .".concat(classNames.zeroTick)] = slideBoxActiveZeroTickStyles, _f[":hover .".concat(classNames.zeroTick)] = slideBoxActiveZeroTickStyles, _f[0, _styleUtilities.HighContrastSelector] = { - forcedColorAdjust: 'none' - }, _f) - }, - vertical ? { - height: '100%', - width: 28, - padding: '8px 0' - } : { - height: 28, - width: 'auto', - padding: '0 8px' - } - ], [ - showValue ? classNames.showValue : undefined - ], false), [ - showTransitions ? classNames.showTransitions : undefined - ], false), - thumb: [ - classNames.thumb, - ranged && (0, _styleUtilities.getFocusStyle)(theme, { - inset: -4 - }), - { - borderWidth: 2, - borderStyle: 'solid', - borderColor: thumbBorderColor, - borderRadius: 10, - boxSizing: 'border-box', - background: thumbBackgroundColor, - display: 'block', - width: 16, - height: 16, - position: 'absolute' - }, - vertical ? { - left: -6, - margin: '0 auto', - transform: 'translateY(8px)' - } : { - top: -6, - transform: (0, _utilities.getRTL)(theme) ? 'translateX(50%)' : 'translateX(-50%)' - }, - showTransitions && { - transition: "left ".concat((0, _styleUtilities.AnimationVariables).durationValue3, " ").concat((0, _styleUtilities.AnimationVariables).easeFunction1) - }, - disabled && { - borderColor: thumbDisabledBorderColor, - selectors: (_g = {}, _g[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'GrayText' - }, _g) - } - ], - line: [ - classNames.line, - { - display: 'flex', - position: 'relative' - }, - vertical ? { - height: '100%', - width: 4, - margin: '0 auto', - flexDirection: 'column-reverse' - } : { - width: '100%' - } - ], - lineContainer: [ - { - borderRadius: 4, - boxSizing: 'border-box' - }, - vertical ? { - width: 4, - height: '100%' - } : { - height: 4, - width: '100%' - } - ], - activeSection: [ - classNames.activeSection, - { - background: restActiveSectionColor, - selectors: (_h = {}, _h[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _h) - }, - showTransitions && { - transition: "width ".concat((0, _styleUtilities.AnimationVariables).durationValue3, " ").concat((0, _styleUtilities.AnimationVariables).easeFunction1) - }, - disabled && { - background: disabledActiveSectionColor, - selectors: (_j = {}, _j[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'GrayText', - borderColor: 'GrayText' - }, _j) - } - ], - inactiveSection: [ - classNames.inactiveSection, - { - background: restInactiveSectionColor, - selectors: (_k = {}, _k[0, _styleUtilities.HighContrastSelector] = { - border: '1px solid WindowText' - }, _k) - }, - showTransitions && { - transition: "width ".concat((0, _styleUtilities.AnimationVariables).durationValue3, " ").concat((0, _styleUtilities.AnimationVariables).easeFunction1) - }, - disabled && { - background: disabledInactiveSectionColor, - selectors: (_l = {}, _l[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'GrayText' - }, _l) - } - ], - zeroTick: [ - classNames.zeroTick, - { - position: 'absolute', - background: semanticColors.disabledBorder, - selectors: (_m = {}, _m[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _m) - }, - props.disabled && { - background: semanticColors.disabledBackground, - selectors: (_o = {}, _o[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'GrayText' - }, _o) - }, - props.vertical ? { - width: '16px', - height: '1px', - transform: (0, _utilities.getRTL)(theme) ? 'translateX(6px)' : 'translateX(-6px)' - } : { - width: '1px', - height: '16px', - transform: 'translateY(-6px)' - } - ], - valueLabel: [ - classNames.valueLabel, - { - flexShrink: 1, - width: 30, - lineHeight: '1' - }, - vertical ? { - margin: '0 auto', - whiteSpace: 'nowrap', - width: 40 - } : { - margin: '0 8px', - whiteSpace: 'nowrap', - width: 40 - } - ] + })); + } + return df; + } + async function runAsync(encode2, prerun, postrun) { + while (this._running) await this._running; + const clear = () => this._running = null; + (this._running = this.evaluate(encode2, prerun, postrun)).then(clear, clear); + return this._running; + } + function run(encode2, prerun, postrun) { + return this._pulse ? reentrant(this) : (this.evaluate(encode2, prerun, postrun), this); + } + function runAfter(callback, enqueue2, priority) { + if (this._pulse || enqueue2) { + this._postrun.push({ + priority: priority || 0, + callback + }); + } else { + try { + callback(this); + } catch (err) { + this.error(err); + } + } + } + function reentrant(df) { + df.error("Dataflow already running. Use runAsync() to chain invocations."); + return df; + } + function enqueue(op, force2) { + const q = op.stamp < this._clock; + if (q) op.stamp = this._clock; + if (q || force2) { + op.qrank = op.rank; + this._heap.push(op); + } + } + function getPulse(op, encode2) { + const s2 = op.source, stamp = this._clock; + return s2 && isArray(s2) ? new MultiPulse(this, stamp, s2.map((_) => _.pulse), encode2) : this._input[op.id] || singlePulse(this._pulse, s2 && s2.pulse); + } + function singlePulse(p, s2) { + if (s2 && s2.stamp === p.stamp) { + return s2; + } + p = p.fork(); + if (s2 && s2 !== StopPropagation) { + p.source = s2.source; + } + return p; + } + const NO_OPT = { + skip: false, + force: false + }; + function touch(op, options2) { + const opt = options2 || NO_OPT; + if (this._pulse) { + this._enqueue(op); + } else { + this._touched.add(op); + } + if (opt.skip) op.skip(true); + return this; + } + function update$6(op, value2, options2) { + const opt = options2 || NO_OPT; + if (op.set(value2) || opt.force) { + this.touch(op, opt); + } + return this; + } + function pulse(op, changeset2, options2) { + this.touch(op, options2 || NO_OPT); + const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; + p.target = op; + this._input[op.id] = changeset2.pulse(p, t); + return this; + } + function Heap(cmp) { + let nodes = []; + return { + clear: () => nodes = [], + size: () => nodes.length, + peek: () => nodes[0], + push: (x2) => { + nodes.push(x2); + return siftdown(nodes, 0, nodes.length - 1, cmp); + }, + pop: () => { + const last = nodes.pop(); + let item; + if (nodes.length) { + item = nodes[0]; + nodes[0] = last; + siftup(nodes, 0, cmp); + } else { + item = last; + } + return item; + } }; -}; - -},{"tslib":"9gizs","@fluentui/style-utilities":"bJvmh","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4BGE1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Spinner/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Spinner/index":"6cGjO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6cGjO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _spinner = require("./Spinner"); -parcelHelpers.exportAll(_spinner, exports); -var _spinnerBase = require("./Spinner.base"); -parcelHelpers.exportAll(_spinnerBase, exports); -var _spinnerTypes = require("./Spinner.types"); -parcelHelpers.exportAll(_spinnerTypes, exports); - -},{"./Spinner":"ehJr7","./Spinner.base":false,"./Spinner.types":"lljUP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ehJr7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Spinner", ()=>Spinner); -var _utilities = require("../../Utilities"); -var _spinnerBase = require("./Spinner.base"); -var _spinnerStyles = require("./Spinner.styles"); -var Spinner = (0, _utilities.styled)((0, _spinnerBase.SpinnerBase), (0, _spinnerStyles.getStyles), undefined, { - scope: 'Spinner' -}); - -},{"../../Utilities":"1NZCy","./Spinner.base":"iBpcH","./Spinner.styles":"2rElf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iBpcH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SpinnerBase", ()=>SpinnerBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _spinnerTypes = require("./Spinner.types"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var SpinnerBase = /** @class */ function(_super) { - (0, _tslib.__extends)(SpinnerBase, _super); - function SpinnerBase() { - return _super !== null && _super.apply(this, arguments) || this; + } + function siftdown(array2, start, idx, cmp) { + let parent, pidx; + const item = array2[idx]; + while (idx > start) { + pidx = idx - 1 >> 1; + parent = array2[pidx]; + if (cmp(item, parent) < 0) { + array2[idx] = parent; + idx = pidx; + continue; + } + break; } - SpinnerBase.prototype.render = function() { - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, type = _a.type, size = _a.size, ariaLabel = _a.ariaLabel, ariaLive = _a.ariaLive, styles = _a.styles, label = _a.label, theme = _a.theme, className = _a.className, labelPosition = _a.labelPosition; - var statusMessage = ariaLabel; - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'size' - ]); - // SpinnerType is deprecated. If someone is still using this property, rather than putting the SpinnerType into the - // ISpinnerStyleProps, we'll map SpinnerType to its equivalent SpinnerSize and pass that in. Once SpinnerType - // finally goes away we should delete this. - var styleSize = size; - if (styleSize === undefined && type !== undefined) // eslint-disable-next-line deprecation/deprecation - styleSize = type === (0, _spinnerTypes.SpinnerType).large ? (0, _spinnerTypes.SpinnerSize).large : (0, _spinnerTypes.SpinnerSize).medium; - var classNames = getClassNames(styles, { - theme: theme, - size: styleSize, - className: className, - labelPosition: labelPosition - }); - return _react.createElement("div", (0, _tslib.__assign)({}, nativeProps, { - className: classNames.root - }), _react.createElement("div", { - className: classNames.circle - }), label && _react.createElement("div", { - className: classNames.label - }, label), statusMessage && _react.createElement("div", { - role: "status", - "aria-live": ariaLive - }, _react.createElement((0, _utilities.DelayedRender), null, _react.createElement("div", { - className: classNames.screenReaderText - }, statusMessage)))); - }; - SpinnerBase.defaultProps = { - size: (0, _spinnerTypes.SpinnerSize).medium, - ariaLive: 'polite', - labelPosition: 'bottom' - }; - return SpinnerBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./Spinner.types":"lljUP","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lljUP":[function(require,module,exports,__globalThis) { -/** - * Possible variations of the spinner circle size. - * {@docCategory Spinner} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SpinnerSize", ()=>SpinnerSize); -parcelHelpers.export(exports, "SpinnerType", ()=>SpinnerType); -var SpinnerSize; -(function(SpinnerSize) { + return array2[idx] = item; + } + function siftup(array2, idx, cmp) { + const start = idx, end = array2.length, item = array2[idx]; + let cidx = (idx << 1) + 1, ridx; + while (cidx < end) { + ridx = cidx + 1; + if (ridx < end && cmp(array2[cidx], array2[ridx]) >= 0) { + cidx = ridx; + } + array2[idx] = array2[cidx]; + idx = cidx; + cidx = (idx << 1) + 1; + } + array2[idx] = item; + return siftdown(array2, start, idx, cmp); + } + function Dataflow() { + this.logger(logger()); + this.logLevel(Error$1); + this._clock = 0; + this._rank = 0; + this._locale = defaultLocale(); + try { + this._loader = loader(); + } catch (e) { + } + this._touched = UniqueList(id); + this._input = {}; + this._pulse = null; + this._heap = Heap((a2, b2) => a2.qrank - b2.qrank); + this._postrun = []; + } + function logMethod(method2) { + return function() { + return this._log[method2].apply(this, arguments); + }; + } + Dataflow.prototype = { + /** + * The current timestamp of this dataflow. This value reflects the + * timestamp of the previous dataflow run. The dataflow is initialized + * with a stamp value of 0. The initial run of the dataflow will have + * a timestap of 1, and so on. This value will match the + * {@link Pulse.stamp} property. + * @return {number} - The current timestamp value. + */ + stamp() { + return this._clock; + }, + /** + * Gets or sets the loader instance to use for data file loading. A + * loader object must provide a "load" method for loading files and a + * "sanitize" method for checking URL/filename validity. Both methods + * should accept a URI and options hash as arguments, and return a Promise + * that resolves to the loaded file contents (load) or a hash containing + * sanitized URI data with the sanitized url assigned to the "href" property + * (sanitize). + * @param {object} _ - The loader instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current loader instance. Otherwise returns this Dataflow instance. + */ + loader(_) { + if (arguments.length) { + this._loader = _; + return this; + } else { + return this._loader; + } + }, + /** + * Gets or sets the locale instance to use for formatting and parsing + * string values. The locale object should be provided by the + * vega-format library, and include methods such as format, timeFormat, + * utcFormat, timeParse, and utcParse. + * @param {object} _ - The locale instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current locale instance. Otherwise returns this Dataflow instance. + */ + locale(_) { + if (arguments.length) { + this._locale = _; + return this; + } else { + return this._locale; + } + }, + /** + * Get or set the logger instance used to log messages. If no arguments are + * provided, returns the current logger instance. Otherwise, sets the logger + * and return this Dataflow instance. Provided loggers must support the full + * API of logger objects generated by the vega-util logger method. Note that + * by default the log level of the new logger will be used; use the logLevel + * method to adjust the log level as needed. + */ + logger(logger2) { + if (arguments.length) { + this._log = logger2; + return this; + } else { + return this._log; + } + }, /** - * 12px Spinner diameter - */ SpinnerSize[SpinnerSize["xSmall"] = 0] = "xSmall"; + * Logs an error message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit error messages. + */ + error: logMethod("error"), /** - * 16px Spinner diameter - */ SpinnerSize[SpinnerSize["small"] = 1] = "small"; + * Logs a warning message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit warning messages. + */ + warn: logMethod("warn"), /** - * 20px Spinner diameter - */ SpinnerSize[SpinnerSize["medium"] = 2] = "medium"; + * Logs a information message. By default, logged messages are written to + * console output. The message will only be logged if the current log level is + * high enough to permit information messages. + */ + info: logMethod("info"), /** - * 28px Spinner diameter - */ SpinnerSize[SpinnerSize["large"] = 3] = "large"; -})(SpinnerSize || (SpinnerSize = {})); -var SpinnerType; -(function(SpinnerType) { + * Logs a debug message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit debug messages. + */ + debug: logMethod("debug"), /** - * @deprecated Use `SpinnerSize.medium` instead. Will be removed at \>= 2.0.0. - */ SpinnerType[SpinnerType["normal"] = 0] = "normal"; + * Get or set the current log level. If an argument is provided, it + * will be used as the new log level. + * @param {number} [level] - Should be one of None, Warn, Info + * @return {number} - The current log level. + */ + logLevel: logMethod("level"), /** - * @deprecated Use `SpinnerSize.large` instead. Will be removed at \>= 2.0.0. - */ SpinnerType[SpinnerType["large"] = 1] = "large"; -})(SpinnerType || (SpinnerType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2rElf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _spinnerTypes = require("./Spinner.types"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var GlobalClassNames = { - root: 'ms-Spinner', - circle: 'ms-Spinner-circle', - label: 'ms-Spinner-label' -}; -var spinAnimation = (0, _utilities.memoizeFunction)(function() { - return (0, _styling.keyframes)({ - '0%': { - transform: 'rotate(0deg)' - }, - '100%': { - transform: 'rotate(360deg)' + * Empty entry threshold for garbage cleaning. Map data structures will + * perform cleaning once the number of empty entries exceeds this value. + */ + cleanThreshold: 1e4, + // OPERATOR REGISTRATION + add: add$3, + connect, + rank, + rerank, + // OPERATOR UPDATES + pulse, + touch, + update: update$6, + changeset, + // DATA LOADING + ingest, + parse: parse$5, + preload, + request, + // EVENT HANDLING + events: events$1, + on, + // PULSE PROPAGATION + evaluate, + run, + runAsync, + runAfter, + _enqueue: enqueue, + _getPulse: getPulse + }; + function Transform(init2, params2) { + Operator.call(this, init2, null, params2); + } + inherits(Transform, Operator, { + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + } else { + rv = this.evaluate(pulse2); + } + rv = rv || pulse2; + if (rv.then) { + rv = rv.then((_) => this.pulse = _); + } else if (rv !== pulse2.StopPropagation) { + this.pulse = rv; + } + return rv; + }, + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Marshalls parameter values and then invokes {@link transform}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + value (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const params2 = this.marshall(pulse2.stamp), out = this.transform(params2, pulse2); + params2.clear(); + return out; + }, + /** + * Process incoming pulses. + * Subclasses should override this method to implement transforms. + * @param {Parameters} _ - The operator parameter values. + * @param {Pulse} pulse - The current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + * value (including undefined) will let the input pulse pass through. + */ + transform() { + } + }); + const transforms = {}; + function definition$1(type2) { + const t = transform$2(type2); + return t && t.Definition || null; + } + function transform$2(type2) { + type2 = type2 && type2.toLowerCase(); + return has$1(transforms, type2) ? transforms[type2] : null; + } + function* numbers$1(values2, valueof) { + if (valueof == null) { + for (let value2 of values2) { + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; } - }); -}); -var getStyles = function(props) { - var _a; - var theme = props.theme, size = props.size, className = props.className, labelPosition = props.labelPosition; - var palette = theme.palette; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + } + } else { + let index2 = -1; + for (let value2 of values2) { + value2 = valueof(value2, ++index2, values2); + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; + } + } + } + } + function quantiles(array2, p, f) { + const values2 = Float64Array.from(numbers$1(array2, f)); + values2.sort(ascending$2); + return p.map((_) => quantileSorted(values2, _)); + } + function quartiles(array2, f) { + return quantiles(array2, [0.25, 0.5, 0.75], f); + } + function estimateBandwidth(array2, f) { + const n = array2.length, d2 = deviation(array2, f), q = quartiles(array2, f), h2 = (q[2] - q[0]) / 1.34, v = Math.min(d2, h2) || d2 || Math.abs(q[0]) || 1; + return 1.06 * v * Math.pow(n, -0.2); + } + function bin(_) { + const maxb = _.maxbins || 20, base2 = _.base || 10, logb = Math.log(base2), div = _.divide || [5, 2]; + let min2 = _.extent[0], max2 = _.extent[1], step, level, minstep, v, i, n; + const span2 = _.span || max2 - min2 || Math.abs(min2) || 1; + if (_.step) { + step = _.step; + } else if (_.steps) { + v = span2 / maxb; + for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i) ; + step = _.steps[Math.max(0, i - 1)]; + } else { + level = Math.ceil(Math.log(maxb) / logb); + minstep = _.minstep || 0; + step = Math.max(minstep, Math.pow(base2, Math.round(Math.log(span2) / logb) - level)); + while (Math.ceil(span2 / step) > maxb) { + step *= base2; + } + for (i = 0, n = div.length; i < n; ++i) { + v = step / div[i]; + if (v >= minstep && span2 / v <= maxb) step = v; + } + } + v = Math.log(step); + const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base2, -precision - 1); + if (_.nice || _.nice === void 0) { + v = Math.floor(min2 / step + eps) * step; + min2 = min2 < v ? v - step : v; + max2 = Math.ceil(max2 / step) * step; + } return { - root: [ - classNames.root, - { - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center' - }, - labelPosition === 'top' && { - flexDirection: 'column-reverse' - }, - labelPosition === 'right' && { - flexDirection: 'row' - }, - labelPosition === 'left' && { - flexDirection: 'row-reverse' - }, - className - ], - circle: [ - classNames.circle, - { - boxSizing: 'border-box', - borderRadius: '50%', - borderWidth: '1.5px', - borderStyle: 'solid', - borderTopColor: palette.themePrimary, - borderRightColor: palette.themeLight, - borderBottomColor: palette.themeLight, - borderLeftColor: palette.themeLight, - animationName: spinAnimation(), - animationDuration: '1.3s', - animationIterationCount: 'infinite', - animationTimingFunction: 'cubic-bezier(.53,.21,.29,.67)', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderTopColor: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) - }, - size === (0, _spinnerTypes.SpinnerSize).xSmall && [ - 'ms-Spinner--xSmall', - { - width: 12, - height: 12 - } - ], - size === (0, _spinnerTypes.SpinnerSize).small && [ - 'ms-Spinner--small', - { - width: 16, - height: 16 - } - ], - size === (0, _spinnerTypes.SpinnerSize).medium && [ - 'ms-Spinner--medium', - { - width: 20, - height: 20 - } - ], - size === (0, _spinnerTypes.SpinnerSize).large && [ - 'ms-Spinner--large', - { - width: 28, - height: 28 - } - ] - ], - label: [ - classNames.label, - theme.fonts.small, - { - color: palette.themePrimary, - margin: '8px 0 0', - textAlign: 'center' - }, - labelPosition === 'top' && { - margin: '0 0 8px' - }, - labelPosition === 'right' && { - margin: '0 0 0 8px' - }, - labelPosition === 'left' && { - margin: '0 8px 0 0' - } - ], - screenReaderText: (0, _styling.hiddenContentStyle) - }; -}; - -},{"tslib":"9gizs","./Spinner.types":"lljUP","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4CWIf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/TextField/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/TextField/index":"dasul","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dasul":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getTextFieldStyles", ()=>(0, _textFieldStyles.getStyles)); -var _textField = require("./TextField"); -parcelHelpers.exportAll(_textField, exports); -var _textFieldBase = require("./TextField.base"); -parcelHelpers.exportAll(_textFieldBase, exports); -var _textFieldStyles = require("./TextField.styles"); -var _textFieldTypes = require("./TextField.types"); -parcelHelpers.exportAll(_textFieldTypes, exports); -var _maskedTextField = require("./MaskedTextField/MaskedTextField"); -parcelHelpers.exportAll(_maskedTextField, exports); - -},{"./TextField":"iY6ic","./TextField.base":false,"./TextField.styles":false,"./TextField.types":false,"./MaskedTextField/MaskedTextField":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iY6ic":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextField", ()=>TextField); -var _utilities = require("../../Utilities"); -var _textFieldBase = require("./TextField.base"); -var _textFieldStyles = require("./TextField.styles"); -var TextField = (0, _utilities.styled)((0, _textFieldBase.TextFieldBase), (0, _textFieldStyles.getStyles), undefined, { - scope: 'TextField' -}); - -},{"../../Utilities":"1NZCy","./TextField.base":"eARAk","./TextField.styles":"eaSCw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eARAk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextFieldBase", ()=>TextFieldBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _label = require("../../Label"); -var _icon = require("../../Icon"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DEFAULT_STATE_VALUE = ''; -var COMPONENT_NAME = 'TextField'; -var REVEAL_ICON_NAME = 'RedEye'; -var HIDE_ICON_NAME = 'Hide'; -var TextFieldBase = /** @class */ function(_super) { - (0, _tslib.__extends)(TextFieldBase, _super); - function TextFieldBase(props) { - var _this = _super.call(this, props) || this; - _this._textElement = _react.createRef(); - _this._onFocus = function(ev) { - if (_this.props.onFocus) _this.props.onFocus(ev); - _this.setState({ - isFocused: true - }, function() { - if (_this.props.validateOnFocusIn) _this._validate(_this.value); - }); - }; - _this._onBlur = function(ev) { - if (_this.props.onBlur) _this.props.onBlur(ev); - _this.setState({ - isFocused: false - }, function() { - if (_this.props.validateOnFocusOut) _this._validate(_this.value); - }); - }; - _this._onRenderLabel = function(props) { - var label = props.label, required = props.required; - // IProcessedStyleSet definition requires casting for what Label expects as its styles prop - var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined; - if (label) return _react.createElement((0, _label.Label), { - required: required, - htmlFor: _this._id, - styles: labelStyles, - disabled: props.disabled, - id: _this._labelId - }, props.label); - return null; - }; - _this._onRenderDescription = function(props) { - if (props.description) return _react.createElement("span", { - className: _this._classNames.description - }, props.description); - return null; - }; - _this._onRevealButtonClick = function(event) { - _this.setState(function(prevState) { - return { - isRevealingPassword: !prevState.isRevealingPassword - }; - }); - }; - _this._onInputChange = function(event) { - // Previously, we needed to call both onInput and onChange due to some weird IE/React issues, - // which have *probably* been fixed now: - // - https://github.com/microsoft/fluentui/issues/744 (likely fixed) - // - https://github.com/microsoft/fluentui/issues/824 (confirmed fixed) - var _a, _b; - // TODO (Fabric 8?) - Switch to calling only onChange. This switch is pretty disruptive for - // tests (ours and maybe consumers' too), so it seemed best to do the switch in a major bump. - var element = event.target; - var value = element.value; - // Ignore this event if any of the following are true: - // - the value is undefined (in case one of the IE bugs comes back) - // - it's a duplicate event (important since onInputChange is called twice per actual user event) - // - it's the same as the previous value - var previousValue = _getValue(_this.props, _this.state) || ''; - if (value === undefined || value === _this._lastChangeValue || value === previousValue) { - _this._lastChangeValue = undefined; - return; - } - _this._lastChangeValue = value; - (_b = (_a = _this.props).onChange) === null || _b === void 0 || _b.call(_a, event, value); - if (!_this._isControlled) // ONLY if this is an uncontrolled component, update the displayed value. - // (Controlled components must update the `value` prop from `onChange`.) - _this.setState({ - uncontrolledValue: value - }); - }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); - _this._fallbackId = (0, _utilities.getId)(COMPONENT_NAME); - _this._descriptionId = (0, _utilities.getId)(COMPONENT_NAME + 'Description'); - _this._labelId = (0, _utilities.getId)(COMPONENT_NAME + 'Label'); - _this._prefixId = (0, _utilities.getId)(COMPONENT_NAME + 'Prefix'); - _this._suffixId = (0, _utilities.getId)(COMPONENT_NAME + 'Suffix'); - _this._warnControlledUsage(); - var _a = props.defaultValue, defaultValue = _a === void 0 ? DEFAULT_STATE_VALUE : _a; - if (typeof defaultValue === 'number') // This isn't allowed per the props, but happens anyway. - defaultValue = String(defaultValue); - _this.state = { - uncontrolledValue: _this._isControlled ? undefined : defaultValue, - isFocused: false, - errorMessage: '' - }; - _this._delayedValidate = _this._async.debounce(_this._validate, _this.props.deferredValidationTime); - _this._lastValidation = 0; - return _this; + start: min2, + stop: max2 === min2 ? min2 + step : max2, + step + }; + } + var random = Math.random; + function setRandom(r) { + random = r; + } + function bootstrapCI(array2, samples, alpha, f) { + if (!array2.length) return [void 0, void 0]; + const values2 = Float64Array.from(numbers$1(array2, f)), n = values2.length, m2 = samples; + let a2, i, j, mu; + for (j = 0, mu = Array(m2); j < m2; ++j) { + for (a2 = 0, i = 0; i < n; ++i) { + a2 += values2[~~(random() * n)]; + } + mu[j] = a2 / n; } - Object.defineProperty(TextFieldBase.prototype, "value", { - /** - * Gets the current value of the text field. - */ get: function() { - return _getValue(this.props, this.state); - }, - enumerable: false, - configurable: true - }); - TextFieldBase.prototype.componentDidMount = function() { - this._adjustInputHeight(); - if (this.props.validateOnLoad) this._validate(this.value); + mu.sort(ascending$2); + return [quantile$1(mu, alpha / 2), quantile$1(mu, 1 - alpha / 2)]; + } + function dotbin(array2, step, smooth, f) { + f = f || ((_) => _); + const n = array2.length, v = new Float64Array(n); + let i = 0, j = 1, a2 = f(array2[0]), b2 = a2, w2 = a2 + step, x2; + for (; j < n; ++j) { + x2 = f(array2[j]); + if (x2 >= w2) { + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + w2 = x2 + step; + a2 = x2; + } + b2 = x2; + } + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + return smooth ? smoothing(v, step + step / 4) : v; + } + function smoothing(v, thresh) { + const n = v.length; + let a2 = 0, b2 = 1, c2, d2; + while (v[a2] === v[b2]) ++b2; + while (b2 < n) { + c2 = b2 + 1; + while (v[b2] === v[c2]) ++c2; + if (v[b2] - v[b2 - 1] < thresh) { + d2 = b2 + (a2 + c2 - b2 - b2 >> 1); + while (d2 < b2) v[d2++] = v[b2]; + while (d2 > b2) v[d2--] = v[a2]; + } + a2 = b2; + b2 = c2; + } + return v; + } + function lcg$2(seed) { + return function() { + seed = (1103515245 * seed + 12345) % 2147483647; + return seed / 2147483647; }; - TextFieldBase.prototype.componentWillUnmount = function() { - this._async.dispose(); + } + function integer(min2, max2) { + if (max2 == null) { + max2 = min2; + min2 = 0; + } + let a2, b2, d2; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + d2 = b2 - a2; + return dist2; + } else { + return a2; + } + }, + max(_) { + if (arguments.length) { + b2 = _ || 0; + d2 = b2 - a2; + return dist2; + } else { + return b2; + } + }, + sample() { + return a2 + Math.floor(d2 * random()); + }, + pdf(x2) { + return x2 === Math.floor(x2) && x2 >= a2 && x2 < b2 ? 1 / d2 : 0; + }, + cdf(x2) { + const v = Math.floor(x2); + return v < a2 ? 0 : v >= b2 ? 1 : (v - a2 + 1) / d2; + }, + icdf(p) { + return p >= 0 && p <= 1 ? a2 - 1 + Math.floor(p * d2) : NaN; + } }; - TextFieldBase.prototype.getSnapshotBeforeUpdate = function(prevProps, prevState) { - return { - selection: [ - this.selectionStart, - this.selectionEnd - ] - }; + return dist2.min(min2).max(max2); + } + const SQRT2PI = Math.sqrt(2 * Math.PI); + const SQRT2 = Math.SQRT2; + let nextSample = NaN; + function sampleNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + let x2 = 0, y2 = 0, rds, c2; + if (nextSample === nextSample) { + x2 = nextSample; + nextSample = NaN; + } else { + do { + x2 = random() * 2 - 1; + y2 = random() * 2 - 1; + rds = x2 * x2 + y2 * y2; + } while (rds === 0 || rds > 1); + c2 = Math.sqrt(-2 * Math.log(rds) / rds); + x2 *= c2; + nextSample = y2 * c2; + } + return mean2 + x2 * stdev; + } + function densityNormal(value2, mean2, stdev) { + stdev = stdev == null ? 1 : stdev; + const z2 = (value2 - (mean2 || 0)) / stdev; + return Math.exp(-0.5 * z2 * z2) / (stdev * SQRT2PI); + } + function cumulativeNormal(value2, mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z2 = (value2 - mean2) / stdev, Z3 = Math.abs(z2); + let cd; + if (Z3 > 37) { + cd = 0; + } else { + const exp2 = Math.exp(-Z3 * Z3 / 2); + let sum2; + if (Z3 < 7.07106781186547) { + sum2 = 0.0352624965998911 * Z3 + 0.700383064443688; + sum2 = sum2 * Z3 + 6.37396220353165; + sum2 = sum2 * Z3 + 33.912866078383; + sum2 = sum2 * Z3 + 112.079291497871; + sum2 = sum2 * Z3 + 221.213596169931; + sum2 = sum2 * Z3 + 220.206867912376; + cd = exp2 * sum2; + sum2 = 0.0883883476483184 * Z3 + 1.75566716318264; + sum2 = sum2 * Z3 + 16.064177579207; + sum2 = sum2 * Z3 + 86.7807322029461; + sum2 = sum2 * Z3 + 296.564248779674; + sum2 = sum2 * Z3 + 637.333633378831; + sum2 = sum2 * Z3 + 793.826512519948; + sum2 = sum2 * Z3 + 440.413735824752; + cd = cd / sum2; + } else { + sum2 = Z3 + 0.65; + sum2 = Z3 + 4 / sum2; + sum2 = Z3 + 3 / sum2; + sum2 = Z3 + 2 / sum2; + sum2 = Z3 + 1 / sum2; + cd = exp2 / sum2 / 2.506628274631; + } + } + return z2 > 0 ? 1 - cd : cd; + } + function quantileNormal(p, mean2, stdev) { + if (p < 0 || p > 1) return NaN; + return (mean2 || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); + } + function erfinv(x2) { + let w2 = -Math.log((1 - x2) * (1 + x2)), p; + if (w2 < 6.25) { + w2 -= 3.125; + p = -364441206401782e-35; + p = -16850591381820166e-35 + p * w2; + p = 128584807152564e-32 + p * w2; + p = 11157877678025181e-33 + p * w2; + p = -1333171662854621e-31 + p * w2; + p = 20972767875968562e-33 + p * w2; + p = 6637638134358324e-30 + p * w2; + p = -4054566272975207e-29 + p * w2; + p = -8151934197605472e-29 + p * w2; + p = 26335093153082323e-28 + p * w2; + p = -12975133253453532e-27 + p * w2; + p = -5415412054294628e-26 + p * w2; + p = 10512122733215323e-25 + p * w2; + p = -4112633980346984e-24 + p * w2; + p = -29070369957882005e-24 + p * w2; + p = 42347877827932404e-23 + p * w2; + p = -13654692000834679e-22 + p * w2; + p = -13882523362786469e-21 + p * w2; + p = 18673420803405714e-20 + p * w2; + p = -740702534166267e-18 + p * w2; + p = -0.006033670871430149 + p * w2; + p = 0.24015818242558962 + p * w2; + p = 1.6536545626831027 + p * w2; + } else if (w2 < 16) { + w2 = Math.sqrt(w2) - 3.25; + p = 22137376921775787e-25; + p = 9075656193888539e-23 + p * w2; + p = -27517406297064545e-23 + p * w2; + p = 18239629214389228e-24 + p * w2; + p = 15027403968909828e-22 + p * w2; + p = -4013867526981546e-21 + p * w2; + p = 29234449089955446e-22 + p * w2; + p = 12475304481671779e-21 + p * w2; + p = -47318229009055734e-21 + p * w2; + p = 6828485145957318e-20 + p * w2; + p = 24031110387097894e-21 + p * w2; + p = -3550375203628475e-19 + p * w2; + p = 9532893797373805e-19 + p * w2; + p = -0.0016882755560235047 + p * w2; + p = 0.002491442096107851 + p * w2; + p = -0.003751208507569241 + p * w2; + p = 0.005370914553590064 + p * w2; + p = 1.0052589676941592 + p * w2; + p = 3.0838856104922208 + p * w2; + } else if (Number.isFinite(w2)) { + w2 = Math.sqrt(w2) - 5; + p = -27109920616438573e-27; + p = -2555641816996525e-25 + p * w2; + p = 15076572693500548e-25 + p * w2; + p = -3789465440126737e-24 + p * w2; + p = 761570120807834e-23 + p * w2; + p = -1496002662714924e-23 + p * w2; + p = 2914795345090108e-23 + p * w2; + p = -6771199775845234e-23 + p * w2; + p = 22900482228026655e-23 + p * w2; + p = -99298272942317e-20 + p * w2; + p = 4526062597223154e-21 + p * w2; + p = -1968177810553167e-20 + p * w2; + p = 7599527703001776e-20 + p * w2; + p = -21503011930044477e-20 + p * w2; + p = -13871931833623122e-20 + p * w2; + p = 1.0103004648645344 + p * w2; + p = 4.849906401408584 + p * w2; + } else { + p = Infinity; + } + return p * x2; + } + function gaussian(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; + } else { + return mu; + } + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; + } + }, + sample: () => sampleNormal(mu, sigma), + pdf: (value2) => densityNormal(value2, mu, sigma), + cdf: (value2) => cumulativeNormal(value2, mu, sigma), + icdf: (p) => quantileNormal(p, mu, sigma) }; - TextFieldBase.prototype.componentDidUpdate = function(prevProps, prevState, snapshot) { - var props = this.props; - var _a = (snapshot || {}).selection, selection = _a === void 0 ? [ - null, - null - ] : _a; - var start = selection[0], end = selection[1]; - if (!!prevProps.multiline !== !!props.multiline && prevState.isFocused) { - // The text field has just changed between single- and multi-line, so we need to reset focus - // and selection/cursor. - this.focus(); - if (start !== null && end !== null && start >= 0 && end >= 0) this.setSelectionRange(start, end); + return dist2.mean(mean2).stdev(stdev); + } + function kde(support, bandwidth2) { + const kernel = gaussian(); + let n = 0; + const dist2 = { + data(_) { + if (arguments.length) { + support = _; + n = _ ? _.length : 0; + return dist2.bandwidth(bandwidth2); + } else { + return support; + } + }, + bandwidth(_) { + if (!arguments.length) return bandwidth2; + bandwidth2 = _; + if (!bandwidth2 && support) bandwidth2 = estimateBandwidth(support); + return dist2; + }, + sample() { + return support[~~(random() * n)] + bandwidth2 * kernel.sample(); + }, + pdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.pdf((x2 - support[i]) / bandwidth2); } - if (prevProps.value !== props.value) // Only if the value in props changed, reset the record of the last value seen by a - // change/input event (don't do this if the value in state changed, since at least in tests - // the state update may happen before the second event in a series) - this._lastChangeValue = undefined; - var prevValue = _getValue(prevProps, prevState); - var value = this.value; - if (prevValue !== value) { - // Handle controlled/uncontrolled warnings and status - this._warnControlledUsage(prevProps); - // Clear error message if needed - // TODO: is there any way to do this without an extra render? - if (this.state.errorMessage && !props.errorMessage) this.setState({ - errorMessage: '' - }); - // Adjust height if needed based on new value - this._adjustInputHeight(); - // TODO: #5875 added logic to trigger validation in componentWillReceiveProps and other places. - // This seems a bit odd and hard to integrate with the new approach. - // (Starting to think we should just put the validation logic in a separate wrapper component...?) - if (_shouldValidateAllChanges(props)) this._delayedValidate(value); + return y2 / bandwidth2 / n; + }, + cdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.cdf((x2 - support[i]) / bandwidth2); } + return y2 / n; + }, + icdf() { + throw Error("KDE icdf not supported."); + } }; - TextFieldBase.prototype.render = function() { - var _a = this.props, borderless = _a.borderless, className = _a.className, disabled = _a.disabled, invalid = _a.invalid, iconProps = _a.iconProps, inputClassName = _a.inputClassName, label = _a.label, multiline = _a.multiline, required = _a.required, underlined = _a.underlined, prefix = _a.prefix, resizable = _a.resizable, suffix = _a.suffix, theme = _a.theme, styles = _a.styles, autoAdjustHeight = _a.autoAdjustHeight, canRevealPassword = _a.canRevealPassword, revealPasswordAriaLabel = _a.revealPasswordAriaLabel, type = _a.type, _b = _a.onRenderPrefix, onRenderPrefix = _b === void 0 ? this._onRenderPrefix : _b, _c = _a.onRenderSuffix, onRenderSuffix = _c === void 0 ? this._onRenderSuffix : _c, _d = _a.onRenderLabel, onRenderLabel = _d === void 0 ? this._onRenderLabel : _d, _e = _a.onRenderDescription, onRenderDescription = _e === void 0 ? this._onRenderDescription : _e; - var _f = this.state, isFocused = _f.isFocused, isRevealingPassword = _f.isRevealingPassword; - var errorMessage = this._errorMessage; - var isInvalid = typeof invalid === 'boolean' ? invalid : !!errorMessage; - var hasRevealButton = !!canRevealPassword && type === 'password' && _browserNeedsRevealButton(); - var classNames = this._classNames = getClassNames(styles, { - theme: theme, - className: className, - disabled: disabled, - focused: isFocused, - required: required, - multiline: multiline, - hasLabel: !!label, - hasErrorMessage: isInvalid, - borderless: borderless, - resizable: resizable, - hasIcon: !!iconProps, - underlined: underlined, - inputClassName: inputClassName, - autoAdjustHeight: autoAdjustHeight, - hasRevealButton: hasRevealButton - }); - return(// eslint-disable-next-line deprecation/deprecation - _react.createElement("div", { - ref: this.props.elementRef, - className: classNames.root - }, _react.createElement("div", { - className: classNames.wrapper - }, onRenderLabel(this.props, this._onRenderLabel), _react.createElement("div", { - className: classNames.fieldGroup - }, (prefix !== undefined || this.props.onRenderPrefix) && _react.createElement("div", { - className: classNames.prefix, - id: this._prefixId - }, onRenderPrefix(this.props, this._onRenderPrefix)), multiline ? this._renderTextArea() : this._renderInput(), iconProps && _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - className: classNames.icon - }, iconProps)), hasRevealButton && // Explicitly set type="button" since the default button type within a form is "submit" - _react.createElement("button", { - "aria-label": revealPasswordAriaLabel, - className: classNames.revealButton, - onClick: this._onRevealButtonClick, - "aria-pressed": !!isRevealingPassword, - type: "button" - }, _react.createElement("span", { - className: classNames.revealSpan - }, _react.createElement((0, _icon.Icon), { - className: classNames.revealIcon, - iconName: isRevealingPassword ? HIDE_ICON_NAME : REVEAL_ICON_NAME - }))), (suffix !== undefined || this.props.onRenderSuffix) && _react.createElement("div", { - className: classNames.suffix, - id: this._suffixId - }, onRenderSuffix(this.props, this._onRenderSuffix)))), this._isDescriptionAvailable && _react.createElement("span", { - id: this._descriptionId - }, onRenderDescription(this.props, this._onRenderDescription), errorMessage && _react.createElement("div", { - role: "alert" - }, _react.createElement((0, _utilities.DelayedRender), null, this._renderErrorMessage()))))); - }; - /** - * Sets focus on the text field - */ TextFieldBase.prototype.focus = function() { - if (this._textElement.current) this._textElement.current.focus(); - }; - /** - * Blurs the text field. - */ TextFieldBase.prototype.blur = function() { - if (this._textElement.current) this._textElement.current.blur(); + return dist2.data(support); + } + function sampleLogNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + return Math.exp(mean2 + sampleNormal() * stdev); + } + function densityLogNormal(value2, mean2, stdev) { + if (value2 <= 0) return 0; + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z2 = (Math.log(value2) - mean2) / stdev; + return Math.exp(-0.5 * z2 * z2) / (stdev * SQRT2PI * value2); + } + function cumulativeLogNormal(value2, mean2, stdev) { + return cumulativeNormal(Math.log(value2), mean2, stdev); + } + function quantileLogNormal(p, mean2, stdev) { + return Math.exp(quantileNormal(p, mean2, stdev)); + } + function lognormal(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; + } else { + return mu; + } + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; + } + }, + sample: () => sampleLogNormal(mu, sigma), + pdf: (value2) => densityLogNormal(value2, mu, sigma), + cdf: (value2) => cumulativeLogNormal(value2, mu, sigma), + icdf: (p) => quantileLogNormal(p, mu, sigma) }; - /** - * Selects the text field - */ TextFieldBase.prototype.select = function() { - if (this._textElement.current) this._textElement.current.select(); + return dist2.mean(mean2).stdev(stdev); + } + function mixture$1(dists, weights) { + let m2 = 0, w2; + function normalize2(x2) { + const w3 = []; + let sum2 = 0, i; + for (i = 0; i < m2; ++i) { + sum2 += w3[i] = x2[i] == null ? 1 : +x2[i]; + } + for (i = 0; i < m2; ++i) { + w3[i] /= sum2; + } + return w3; + } + const dist2 = { + weights(_) { + if (arguments.length) { + w2 = normalize2(weights = _ || []); + return dist2; + } + return weights; + }, + distributions(_) { + if (arguments.length) { + if (_) { + m2 = _.length; + dists = _; + } else { + m2 = 0; + dists = []; + } + return dist2.weights(weights); + } + return dists; + }, + sample() { + const r = random(); + let d2 = dists[m2 - 1], v = w2[0], i = 0; + for (; i < m2 - 1; v += w2[++i]) { + if (r < v) { + d2 = dists[i]; + break; + } + } + return d2.sample(); + }, + pdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].pdf(x2); + } + return p; + }, + cdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].cdf(x2); + } + return p; + }, + icdf() { + throw Error("Mixture icdf not supported."); + } }; - /** - * Sets the selection start of the text field to a specified value - */ TextFieldBase.prototype.setSelectionStart = function(value) { - if (this._textElement.current) this._textElement.current.selectionStart = value; + return dist2.distributions(dists).weights(weights); + } + function sampleUniform(min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return min2 + (max2 - min2) * random(); + } + function densityUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return value2 >= min2 && value2 <= max2 ? 1 / (max2 - min2) : 0; + } + function cumulativeUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return value2 < min2 ? 0 : value2 > max2 ? 1 : (value2 - min2) / (max2 - min2); + } + function quantileUniform(p, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return p >= 0 && p <= 1 ? min2 + p * (max2 - min2) : NaN; + } + function uniform(min2, max2) { + let a2, b2; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + return dist2; + } else { + return a2; + } + }, + max(_) { + if (arguments.length) { + b2 = _ == null ? 1 : _; + return dist2; + } else { + return b2; + } + }, + sample: () => sampleUniform(a2, b2), + pdf: (value2) => densityUniform(value2, a2, b2), + cdf: (value2) => cumulativeUniform(value2, a2, b2), + icdf: (p) => quantileUniform(p, a2, b2) }; - /** - * Sets the selection end of the text field to a specified value - */ TextFieldBase.prototype.setSelectionEnd = function(value) { - if (this._textElement.current) this._textElement.current.selectionEnd = value; + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return dist2.min(min2).max(max2); + } + function constant$3(data2, x2, y2) { + let mean2 = 0, n = 0; + for (const d2 of data2) { + const val = y2(d2); + if (x2(d2) == null || val == null || isNaN(val)) continue; + mean2 += (val - mean2) / ++n; + } + return { + coef: [mean2], + predict: () => mean2, + rSquared: 0 }; - Object.defineProperty(TextFieldBase.prototype, "selectionStart", { - /** - * Gets the selection start of the text field - */ get: function() { - return this._textElement.current ? this._textElement.current.selectionStart : -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextFieldBase.prototype, "selectionEnd", { - /** - * Gets the selection end of the text field - */ get: function() { - return this._textElement.current ? this._textElement.current.selectionEnd : -1; - }, - enumerable: false, - configurable: true + } + function ols(uX, uY, uXY, uX2) { + const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; + return [intercept, slope]; + } + function points(data2, x2, y2, sort2) { + data2 = data2.filter((d3) => { + let u2 = x2(d3), v = y2(d3); + return u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v; }); - /** - * Sets the start and end positions of a selection in a text field. - * @param start - Index of the start of the selection. - * @param end - Index of the end of the selection. - */ TextFieldBase.prototype.setSelectionRange = function(start, end) { - if (this._textElement.current) this._textElement.current.setSelectionRange(start, end); - }; - TextFieldBase.prototype._warnControlledUsage = function(prevProps) { - // Show warnings if props are being used in an invalid way - (0, _utilities.warnControlledUsage)({ - componentId: this._id, - componentName: COMPONENT_NAME, - props: this.props, - oldProps: prevProps, - valueProp: 'value', - defaultValueProp: 'defaultValue', - onChangeProp: 'onChange', - readOnlyProp: 'readOnly' - }); - if (this.props.value === null && !this._hasWarnedNullValue) { - this._hasWarnedNullValue = true; - (0, _utilities.warn)("Warning: 'value' prop on '".concat(COMPONENT_NAME, "' should not be null. Consider using an ") + 'empty string to clear the component or undefined to indicate an uncontrolled component.'); - } - }; - Object.defineProperty(TextFieldBase.prototype, "_id", { - /** Returns `props.id` if available, or a fallback if not. */ get: function() { - return this.props.id || this._fallbackId; - }, - enumerable: false, - configurable: true + if (sort2) { + data2.sort((a2, b2) => x2(a2) - x2(b2)); + } + const n = data2.length, X3 = new Float64Array(n), Y3 = new Float64Array(n); + let i = 0, ux = 0, uy = 0, xv, yv, d2; + for (d2 of data2) { + X3[i] = xv = +x2(d2); + Y3[i] = yv = +y2(d2); + ++i; + ux += (xv - ux) / i; + uy += (yv - uy) / i; + } + for (i = 0; i < n; ++i) { + X3[i] -= ux; + Y3[i] -= uy; + } + return [X3, Y3, ux, uy]; + } + function visitPoints(data2, x2, y2, callback) { + let i = -1, u2, v; + for (const d2 of data2) { + u2 = x2(d2); + v = y2(d2); + if (u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v) { + callback(u2, v, ++i); + } + } + } + function rSquared(data2, x2, y2, uY, predict) { + let SSE = 0, SST = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const sse = dy - predict(dx), sst = dy - uY; + SSE += sse * sse; + SST += sst * sst; }); - Object.defineProperty(TextFieldBase.prototype, "_isControlled", { - get: function() { - return (0, _utilities.isControlled)(this.props, 'value'); - }, - enumerable: false, - configurable: true + return 1 - SSE / SST; + } + function linear(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; }); - TextFieldBase.prototype._onRenderPrefix = function(props) { - var prefix = props.prefix; - return _react.createElement("span", { - style: { - paddingBottom: '1px' - } - }, prefix); - }; - TextFieldBase.prototype._onRenderSuffix = function(props) { - var suffix = props.suffix; - return _react.createElement("span", { - style: { - paddingBottom: '1px' - } - }, suffix); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * x3; + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) }; - Object.defineProperty(TextFieldBase.prototype, "_errorMessage", { - /** - * Current error message from either `props.errorMessage` or the result of `props.onGetErrorMessage`. - * - * - If there is no validation error or we have not validated the input value, errorMessage is an empty string. - * - If we have done the validation and there is validation error, errorMessage is the validation error message. - */ get: function() { - var _a = this.props.errorMessage, errorMessage = _a === void 0 ? this.state.errorMessage : _a; - return errorMessage || ''; - }, - enumerable: false, - configurable: true + } + function log$2(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + dx = Math.log(dx); + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; }); - /** - * Renders error message based on the type of the message. - * - * - If error message is string, it will render using the built in styles. - * - If error message is an element, user has full control over how it's rendered. - */ TextFieldBase.prototype._renderErrorMessage = function() { - var errorMessage = this._errorMessage; - return errorMessage ? typeof errorMessage === 'string' ? _react.createElement("p", { - className: this._classNames.errorMessage - }, _react.createElement("span", { - "data-automation-id": "error-message" - }, errorMessage)) : _react.createElement("div", { - className: this._classNames.errorMessage, - "data-automation-id": "error-message" - }, errorMessage) : null; - }; - Object.defineProperty(TextFieldBase.prototype, "_isDescriptionAvailable", { - /** - * If a custom description render function is supplied then treat description as always available. - * Otherwise defer to the presence of description or error message text. - */ get: function() { - var props = this.props; - return !!(props.onRenderDescription || props.description || this._errorMessage); - }, - enumerable: false, - configurable: true + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * Math.log(x3); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) + }; + } + function exp$1(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2); + let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly2, xy; + visitPoints(data2, x2, y2, (_, dy) => { + dx = xv[n++]; + ly2 = Math.log(dy); + xy = dx * dy; + YL += (dy * ly2 - YL) / n; + XY += (xy - XY) / n; + XYL += (xy * ly2 - XYL) / n; + X2Y += (dx * xy - X2Y) / n; }); - TextFieldBase.prototype._renderTextArea = function() { - var _a = this.props.invalid, invalid = _a === void 0 ? !!this._errorMessage : _a; - var textAreaProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.textAreaProperties), [ - 'defaultValue' - ]); - var ariaLabelledBy = this.props['aria-labelledby'] || (this.props.label ? this._labelId : undefined); - return _react.createElement("textarea", (0, _tslib.__assign)({ - id: this._id - }, textAreaProps, { - ref: this._textElement, - value: this.value || '', - onInput: this._onInputChange, - onChange: this._onInputChange, - className: this._classNames.field, - "aria-labelledby": ariaLabelledBy, - "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'], - "aria-invalid": invalid, - "aria-label": this.props.ariaLabel, - readOnly: this.props.readOnly, - onFocus: this._onFocus, - onBlur: this._onBlur - })); + const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x3) => Math.exp(c0 + c1 * (x3 - ux)); + return { + coef: [Math.exp(c0 - c1 * ux), c1], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) }; - TextFieldBase.prototype._renderInput = function() { - var _a = this.props, ariaLabel = _a.ariaLabel, _b = _a.invalid, invalid = _b === void 0 ? !!this._errorMessage : _b, onRenderPrefix = _a.onRenderPrefix, onRenderSuffix = _a.onRenderSuffix, prefix = _a.prefix, suffix = _a.suffix, _c = _a.type, type = _c === void 0 ? 'text' : _c, label = _a.label; - // build aria-labelledby list from label, prefix, and suffix - var labelIds = []; - label && labelIds.push(this._labelId); - (prefix !== undefined || onRenderPrefix) && labelIds.push(this._prefixId); - (suffix !== undefined || onRenderSuffix) && labelIds.push(this._suffixId); - var inputProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - type: this.state.isRevealingPassword ? 'text' : type, - id: this._id - }, (0, _utilities.getNativeProps)(this.props, (0, _utilities.inputProperties), [ - 'defaultValue', - 'type' - ])), { - 'aria-labelledby': this.props['aria-labelledby'] || (labelIds.length > 0 ? labelIds.join(' ') : undefined), - ref: this._textElement, - value: this.value || '', - onInput: this._onInputChange, - onChange: this._onInputChange, - className: this._classNames.field, - 'aria-label': ariaLabel, - 'aria-describedby': this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'], - 'aria-invalid': invalid, - onFocus: this._onFocus, - onBlur: this._onBlur - }); - var defaultRender = function(updatedInputProps) { - return _react.createElement("input", (0, _tslib.__assign)({}, updatedInputProps)); - }; - var onRenderInput = this.props.onRenderInput || defaultRender; - return onRenderInput(inputProps, defaultRender); + } + function pow$2(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, YS = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const lx2 = Math.log(dx), ly2 = Math.log(dy); + ++n; + X3 += (lx2 - X3) / n; + Y3 += (ly2 - Y3) / n; + XY += (lx2 * ly2 - XY) / n; + X22 += (lx2 * lx2 - X22) / n; + YS += (dy - YS) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] * Math.pow(x3, coef[1]); + coef[0] = Math.exp(coef[0]); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, YS, predict) }; - TextFieldBase.prototype._validate = function(value) { - var _this = this; - // In case _validate is called again while validation promise is executing - if (this._latestValidateValue === value && _shouldValidateAllChanges(this.props)) return; - this._latestValidateValue = value; - var onGetErrorMessage = this.props.onGetErrorMessage; - var result = onGetErrorMessage && onGetErrorMessage(value || ''); - if (result !== undefined) { - if (typeof result === 'string' || !('then' in result)) { - this.setState({ - errorMessage: result - }); - this._notifyAfterValidate(value, result); - } else { - var currentValidation_1 = ++this._lastValidation; - result.then(function(errorMessage) { - if (currentValidation_1 === _this._lastValidation) _this.setState({ - errorMessage: errorMessage - }); - _this._notifyAfterValidate(value, errorMessage); - }); - } - } else this._notifyAfterValidate(value, ''); + } + function quad(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length; + let X22 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x22; + for (i = 0; i < n; ) { + dx = xv[i]; + dy = yv[i++]; + x22 = dx * dx; + X22 += (x22 - X22) / i; + X3 += (x22 * dx - X3) / i; + X4 += (x22 * x22 - X4) / i; + XY += (dx * dy - XY) / i; + X2Y += (x22 * dy - X2Y) / i; + } + const X2X2 = X4 - X22 * X22, d2 = X22 * X2X2 - X3 * X3, a2 = (X2Y * X22 - XY * X3) / d2, b2 = (XY * X2X2 - X2Y * X3) / d2, c2 = -a2 * X22, predict = (x3) => { + x3 = x3 - ux; + return a2 * x3 * x3 + b2 * x3 + c2 + uy; }; - TextFieldBase.prototype._notifyAfterValidate = function(value, errorMessage) { - if (value === this.value && this.props.onNotifyValidationResult) this.props.onNotifyValidationResult(errorMessage, value); + return { + coef: [c2 - b2 * ux + a2 * ux * ux + uy, b2 - 2 * a2 * ux, a2], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) }; - TextFieldBase.prototype._adjustInputHeight = function() { - var _a, _b; - if (this._textElement.current && this.props.autoAdjustHeight && this.props.multiline) { - var scrollTop = (_b = (_a = this.props.scrollContainerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.scrollTop; - var textField = this._textElement.current; - textField.style.height = ''; - textField.style.height = textField.scrollHeight + 'px'; - if (scrollTop) // Safe to assert not null, otherwise we wouldn't have a scrollTop; - this.props.scrollContainerRef.current.scrollTop = scrollTop; + } + function poly(data2, x2, y2, order) { + if (order === 0) return constant$3(data2, x2, y2); + if (order === 1) return linear(data2, x2, y2); + if (order === 2) return quad(data2, x2, y2); + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length, lhs = [], rhs = [], k = order + 1; + let i, j, l, v, c2; + for (i = 0; i < k; ++i) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i) * yv[l]; + } + lhs.push(v); + c2 = new Float64Array(k); + for (j = 0; j < k; ++j) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i + j); } + c2[j] = v; + } + rhs.push(c2); + } + rhs.push(lhs); + const coef = gaussianElimination(rhs), predict = (x3) => { + x3 -= ux; + let y3 = uy + coef[0] + coef[1] * x3 + coef[2] * x3 * x3; + for (i = 3; i < k; ++i) y3 += coef[i] * Math.pow(x3, i); + return y3; }; - TextFieldBase.defaultProps = { - resizable: true, - deferredValidationTime: 200, - validateOnLoad: true + return { + coef: uncenter(k, coef, -ux, uy), + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) }; - return TextFieldBase; -}(_react.Component); -/** Get the value from the given state and props (converting from number to string if needed) */ function _getValue(props, state) { - var _a = props.value, value = _a === void 0 ? state.uncontrolledValue : _a; - if (typeof value === 'number') // not allowed per typings, but happens anyway - return String(value); - return value; -} -/** - * If `validateOnFocusIn` or `validateOnFocusOut` is true, validation should run **only** on that event. - * Otherwise, validation should run on every change. - */ function _shouldValidateAllChanges(props) { - return !(props.validateOnFocusIn || props.validateOnFocusOut); -} -// Only calculate this once across all TextFields, since will stay the same -var __browserNeedsRevealButton; -function _browserNeedsRevealButton() { - if (typeof __browserNeedsRevealButton !== 'boolean') { - var win = (0, _utilities.getWindow)(); - if (win === null || win === void 0 ? void 0 : win.navigator) { - // Edge, Chromium Edge - var isEdge = /Edg/.test(win.navigator.userAgent || ''); - __browserNeedsRevealButton = !((0, _utilities.isIE11)() || isEdge); - } else __browserNeedsRevealButton = true; + } + function uncenter(k, a2, x2, y2) { + const z2 = Array(k); + let i, j, v, c2; + for (i = 0; i < k; ++i) z2[i] = 0; + for (i = k - 1; i >= 0; --i) { + v = a2[i]; + c2 = 1; + z2[i] += v; + for (j = 1; j <= i; ++j) { + c2 *= (i + 1 - j) / j; + z2[i - j] += v * Math.pow(x2, j) * c2; + } + } + z2[0] += y2; + return z2; + } + function gaussianElimination(matrix) { + const n = matrix.length - 1, coef = []; + let i, j, k, r, t; + for (i = 0; i < n; ++i) { + r = i; + for (j = i + 1; j < n; ++j) { + if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { + r = j; + } + } + for (k = i; k < n + 1; ++k) { + t = matrix[k][i]; + matrix[k][i] = matrix[k][r]; + matrix[k][r] = t; + } + for (j = i + 1; j < n; ++j) { + for (k = n; k >= i; k--) { + matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; + } + } + } + for (j = n - 1; j >= 0; --j) { + t = 0; + for (k = j + 1; k < n; ++k) { + t += matrix[k][j] * coef[k]; + } + coef[j] = (matrix[n][j] - t) / matrix[j][j]; + } + return coef; + } + const maxiters = 2, epsilon$6 = 1e-12; + function loess(data2, x2, y2, bandwidth2) { + const [xv, yv, ux, uy] = points(data2, x2, y2, true), n = xv.length, bw = Math.max(2, ~~(bandwidth2 * n)), yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); + for (let iter = -1; ++iter <= maxiters; ) { + const interval2 = [0, bw - 1]; + for (let i = 0; i < n; ++i) { + const dx = xv[i], i0 = interval2[0], i1 = interval2[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; + let W = 0, X3 = 0, Y3 = 0, XY = 0, X22 = 0; + const denom = 1 / Math.abs(xv[edge] - dx || 1); + for (let k = i0; k <= i1; ++k) { + const xk = xv[k], yk = yv[k], w2 = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w2; + W += w2; + X3 += xkw; + Y3 += yk * w2; + XY += yk * xkw; + X22 += xk * xkw; + } + const [a2, b2] = ols(X3 / W, Y3 / W, XY / W, X22 / W); + yhat[i] = a2 + b2 * dx; + residuals[i] = Math.abs(yv[i] - yhat[i]); + updateInterval(xv, i + 1, interval2); + } + if (iter === maxiters) { + break; + } + const medianResidual = median(residuals); + if (Math.abs(medianResidual) < epsilon$6) break; + for (let i = 0, arg, w2; i < n; ++i) { + arg = residuals[i] / (6 * medianResidual); + robustWeights[i] = arg >= 1 ? epsilon$6 : (w2 = 1 - arg * arg) * w2; + } + } + return output$1(xv, yhat, ux, uy); + } + function tricube(x2) { + return (x2 = 1 - x2 * x2 * x2) * x2 * x2; + } + function updateInterval(xv, i, interval2) { + const val = xv[i]; + let left = interval2[0], right = interval2[1] + 1; + if (right >= xv.length) return; + while (i > left && xv[right] - val <= val - xv[left]) { + interval2[0] = ++left; + interval2[1] = right; + ++right; + } + } + function output$1(xv, yhat, ux, uy) { + const n = xv.length, out = []; + let i = 0, cnt = 0, prev = [], v; + for (; i < n; ++i) { + v = xv[i] + ux; + if (prev[0] === v) { + prev[1] += (yhat[i] - prev[1]) / ++cnt; + } else { + cnt = 0; + prev[1] += uy; + prev = [v, yhat[i]]; + out.push(prev); + } + } + prev[1] += uy; + return out; + } + const MIN_RADIANS = 0.5 * Math.PI / 180; + function sampleCurve(f, extent2, minSteps, maxSteps) { + minSteps = minSteps || 25; + maxSteps = Math.max(minSteps, maxSteps || 200); + const point2 = (x2) => [x2, f(x2)], minX = extent2[0], maxX = extent2[1], span2 = maxX - minX, stop2 = span2 / maxSteps, prev = [point2(minX)], next = []; + if (minSteps === maxSteps) { + for (let i = 1; i < maxSteps; ++i) { + prev.push(point2(minX + i / minSteps * span2)); + } + prev.push(point2(maxX)); + return prev; + } else { + next.push(point2(maxX)); + for (let i = minSteps; --i > 0; ) { + next.push(point2(minX + i / minSteps * span2)); + } + } + let p02 = prev[0]; + let p1 = next[next.length - 1]; + const sx = 1 / span2; + const sy = scaleY(p02[1], next); + while (p1) { + const pm = point2((p02[0] + p1[0]) / 2); + const dx = pm[0] - p02[0] >= stop2; + if (dx && angleDelta(p02, pm, p1, sx, sy) > MIN_RADIANS) { + next.push(pm); + } else { + p02 = p1; + prev.push(p1); + next.pop(); + } + p1 = next[next.length - 1]; + } + return prev; + } + function scaleY(init2, points2) { + let ymin = init2; + let ymax = init2; + const n = points2.length; + for (let i = 0; i < n; ++i) { + const y2 = points2[i][1]; + if (y2 < ymin) ymin = y2; + if (y2 > ymax) ymax = y2; + } + return 1 / (ymax - ymin); + } + function angleDelta(p, q, r, sx, sy) { + const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])), a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0])); + return Math.abs(a0 - a1); + } + function multikey(f) { + return (x2) => { + const n = f.length; + let i = 1, k = String(f[0](x2)); + for (; i < n; ++i) { + k += "|" + f[i](x2); + } + return k; + }; + } + function groupkey(fields) { + return !fields || !fields.length ? function() { + return ""; + } : fields.length === 1 ? fields[0] : multikey(fields); + } + function measureName(op, field2, as) { + return as || op + (!field2 ? "" : "_" + field2); + } + const noop$4 = () => { + }; + const base_op = { + init: noop$4, + add: noop$4, + rem: noop$4, + idx: 0 + }; + const AggregateOps = { + values: { + init: (m2) => m2.cell.store = true, + value: (m2) => m2.cell.data.values(), + idx: -1 + }, + count: { + value: (m2) => m2.cell.num + }, + __count__: { + value: (m2) => m2.missing + m2.valid + }, + missing: { + value: (m2) => m2.missing + }, + valid: { + value: (m2) => m2.valid + }, + sum: { + init: (m2) => m2.sum = 0, + value: (m2) => m2.valid ? m2.sum : void 0, + add: (m2, v) => m2.sum += +v, + rem: (m2, v) => m2.sum -= v + }, + product: { + init: (m2) => m2.product = 1, + value: (m2) => m2.valid ? m2.product : void 0, + add: (m2, v) => m2.product *= v, + rem: (m2, v) => m2.product /= v + }, + mean: { + init: (m2) => m2.mean = 0, + value: (m2) => m2.valid ? m2.mean : void 0, + add: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean += m2.mean_d / m2.valid), + rem: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean -= m2.valid ? m2.mean_d / m2.valid : m2.mean) + }, + average: { + value: (m2) => m2.valid ? m2.mean : void 0, + req: ["mean"], + idx: 1 + }, + variance: { + init: (m2) => m2.dev = 0, + value: (m2) => m2.valid > 1 ? m2.dev / (m2.valid - 1) : void 0, + add: (m2, v) => m2.dev += m2.mean_d * (v - m2.mean), + rem: (m2, v) => m2.dev -= m2.mean_d * (v - m2.mean), + req: ["mean"], + idx: 1 + }, + variancep: { + value: (m2) => m2.valid > 1 ? m2.dev / m2.valid : void 0, + req: ["variance"], + idx: 2 + }, + stdev: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid - 1)) : void 0, + req: ["variance"], + idx: 2 + }, + stdevp: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / m2.valid) : void 0, + req: ["variance"], + idx: 2 + }, + stderr: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid * (m2.valid - 1))) : void 0, + req: ["variance"], + idx: 2 + }, + distinct: { + value: (m2) => m2.cell.data.distinct(m2.get), + req: ["values"], + idx: 3 + }, + ci0: { + value: (m2) => m2.cell.data.ci0(m2.get), + req: ["values"], + idx: 3 + }, + ci1: { + value: (m2) => m2.cell.data.ci1(m2.get), + req: ["values"], + idx: 3 + }, + median: { + value: (m2) => m2.cell.data.q2(m2.get), + req: ["values"], + idx: 3 + }, + q1: { + value: (m2) => m2.cell.data.q1(m2.get), + req: ["values"], + idx: 3 + }, + q3: { + value: (m2) => m2.cell.data.q3(m2.get), + req: ["values"], + idx: 3 + }, + min: { + init: (m2) => m2.min = void 0, + value: (m2) => m2.min = Number.isNaN(m2.min) ? m2.cell.data.min(m2.get) : m2.min, + add: (m2, v) => { + if (v < m2.min || m2.min === void 0) m2.min = v; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.min = NaN; + }, + req: ["values"], + idx: 4 + }, + max: { + init: (m2) => m2.max = void 0, + value: (m2) => m2.max = Number.isNaN(m2.max) ? m2.cell.data.max(m2.get) : m2.max, + add: (m2, v) => { + if (v > m2.max || m2.max === void 0) m2.max = v; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.max = NaN; + }, + req: ["values"], + idx: 4 + }, + argmin: { + init: (m2) => m2.argmin = void 0, + value: (m2) => m2.argmin || m2.cell.data.argmin(m2.get), + add: (m2, v, t) => { + if (v < m2.min) m2.argmin = t; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.argmin = void 0; + }, + req: ["min", "values"], + idx: 3 + }, + argmax: { + init: (m2) => m2.argmax = void 0, + value: (m2) => m2.argmax || m2.cell.data.argmax(m2.get), + add: (m2, v, t) => { + if (v > m2.max) m2.argmax = t; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.argmax = void 0; + }, + req: ["max", "values"], + idx: 3 + }, + exponential: { + init: (m2, r) => { + m2.exp = 0; + m2.exp_r = r; + }, + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) / (1 - m2.exp_r ** m2.valid) : void 0, + add: (m2, v) => m2.exp = m2.exp_r * m2.exp + v, + rem: (m2, v) => m2.exp = (m2.exp - v / m2.exp_r ** (m2.valid - 1)) / m2.exp_r + }, + exponentialb: { + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) : void 0, + req: ["exponential"], + idx: 1 } - return __browserNeedsRevealButton; -} - -},{"tslib":"9gizs","react":"jGrId","../../Label":"8FZUu","../../Icon":"hiMUP","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eaSCw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var globalClassNames = { - root: 'ms-TextField', - description: 'ms-TextField-description', - errorMessage: 'ms-TextField-errorMessage', - field: 'ms-TextField-field', - fieldGroup: 'ms-TextField-fieldGroup', - prefix: 'ms-TextField-prefix', - suffix: 'ms-TextField-suffix', - wrapper: 'ms-TextField-wrapper', - revealButton: 'ms-TextField-reveal', - multiline: 'ms-TextField--multiline', - borderless: 'ms-TextField--borderless', - underlined: 'ms-TextField--underlined', - unresizable: 'ms-TextField--unresizable', - required: 'is-required', - disabled: 'is-disabled', - active: 'is-active' -}; -function getLabelStyles(props) { - var underlined = props.underlined, disabled = props.disabled, focused = props.focused, theme = props.theme; - var palette = theme.palette, fonts = theme.fonts; - return function() { - var _a; - return { - root: [ - underlined && disabled && { - color: palette.neutralTertiary - }, - underlined && { - fontSize: fonts.medium.fontSize, - marginRight: 8, - paddingLeft: 12, - paddingRight: 0, - lineHeight: '22px', - height: 32 - }, - underlined && focused && { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - height: 31 - }, _a) - } - ] - }; + }; + const ValidAggregateOps = Object.keys(AggregateOps).filter((d2) => d2 !== "__count__"); + function measure(key2, value2) { + return (out, aggregate_param) => extend({ + name: key2, + aggregate_param, + out: out || key2 + }, base_op, value2); + } + [...ValidAggregateOps, "__count__"].forEach((key2) => { + AggregateOps[key2] = measure(key2, AggregateOps[key2]); + }); + function createMeasure(op, param2, name) { + return AggregateOps[op](name, param2); + } + function compareIndex(a2, b2) { + return a2.idx - b2.idx; + } + function resolve(agg) { + const map2 = {}; + agg.forEach((a2) => map2[a2.name] = a2); + const getreqs = (a2) => { + if (!a2.req) return; + a2.req.forEach((key2) => { + if (!map2[key2]) getreqs(map2[key2] = AggregateOps[key2]()); + }); }; -} -function getStyles(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; - var theme = props.theme, className = props.className, disabled = props.disabled, focused = props.focused, required = props.required, multiline = props.multiline, hasLabel = props.hasLabel, borderless = props.borderless, underlined = props.underlined, hasIcon = props.hasIcon, resizable = props.resizable, hasErrorMessage = props.hasErrorMessage, inputClassName = props.inputClassName, autoAdjustHeight = props.autoAdjustHeight, hasRevealButton = props.hasRevealButton; - var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; - var classNames = (0, _styling.getGlobalClassNames)(globalClassNames, theme); - var fieldPrefixSuffix = { - // Suffix/Prefix are not editable so the disabled slot perfectly fits. - background: semanticColors.disabledBackground, - color: !disabled ? semanticColors.inputPlaceholderText : semanticColors.disabledText, - display: 'flex', - alignItems: 'center', - padding: '0 10px', - lineHeight: 1, - whiteSpace: 'nowrap', - flexShrink: 0, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - background: 'Window', - color: disabled ? 'GrayText' : 'WindowText' - }, _a) - }; - // placeholder style constants - var placeholderStyles = [ - { - color: semanticColors.inputPlaceholderText, - opacity: 1, - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _b) + agg.forEach(getreqs); + return Object.values(map2).sort(compareIndex); + } + function init() { + this.valid = 0; + this.missing = 0; + this._ops.forEach((op) => op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); + } + function add$2(v, t) { + if (v == null || v === "") { + ++this.missing; + return; + } + if (v !== v) return; + ++this.valid; + this._ops.forEach((op) => op.add(this, v, t)); + } + function rem(v, t) { + if (v == null || v === "") { + --this.missing; + return; + } + if (v !== v) return; + --this.valid; + this._ops.forEach((op) => op.rem(this, v, t)); + } + function set$3(t) { + this._out.forEach((op) => t[op.out] = op.value(this)); + return t; + } + function compileMeasures(agg, field2) { + const get2 = field2 || identity$2, ops2 = resolve(agg), out = agg.slice().sort(compareIndex); + function ctr(cell2) { + this._ops = ops2; + this._out = out; + this.cell = cell2; + this.init(); + } + ctr.prototype.init = init; + ctr.prototype.add = add$2; + ctr.prototype.rem = rem; + ctr.prototype.set = set$3; + ctr.prototype.get = get2; + ctr.fields = agg.map((op) => op.out); + return ctr; + } + function TupleStore(key2) { + this._key = key2 ? field$1(key2) : tupleid; + this.reset(); + } + const prototype$1 = TupleStore.prototype; + prototype$1.reset = function() { + this._add = []; + this._rem = []; + this._ext = null; + this._get = null; + this._q = null; + }; + prototype$1.add = function(v) { + this._add.push(v); + }; + prototype$1.rem = function(v) { + this._rem.push(v); + }; + prototype$1.values = function() { + this._get = null; + if (this._rem.length === 0) return this._add; + const a2 = this._add, r = this._rem, k = this._key, n = a2.length, m2 = r.length, x2 = Array(n - m2), map2 = {}; + let i, j, v; + for (i = 0; i < m2; ++i) { + map2[k(r[i])] = 1; + } + for (i = 0, j = 0; i < n; ++i) { + if (map2[k(v = a2[i])]) { + map2[k(v)] = 0; + } else { + x2[j++] = v; + } + } + this._rem = []; + return this._add = x2; + }; + prototype$1.distinct = function(get2) { + const v = this.values(), map2 = {}; + let n = v.length, count2 = 0, s2; + while (--n >= 0) { + s2 = get2(v[n]) + ""; + if (!has$1(map2, s2)) { + map2[s2] = 1; + ++count2; + } + } + return count2; + }; + prototype$1.extent = function(get2) { + if (this._get !== get2 || !this._ext) { + const v = this.values(), i = extentIndex(v, get2); + this._ext = [v[i[0]], v[i[1]]]; + this._get = get2; + } + return this._ext; + }; + prototype$1.argmin = function(get2) { + return this.extent(get2)[0] || {}; + }; + prototype$1.argmax = function(get2) { + return this.extent(get2)[1] || {}; + }; + prototype$1.min = function(get2) { + const m2 = this.extent(get2)[0]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.max = function(get2) { + const m2 = this.extent(get2)[1]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.quartile = function(get2) { + if (this._get !== get2 || !this._q) { + this._q = quartiles(this.values(), get2); + this._get = get2; + } + return this._q; + }; + prototype$1.q1 = function(get2) { + return this.quartile(get2)[0]; + }; + prototype$1.q2 = function(get2) { + return this.quartile(get2)[1]; + }; + prototype$1.q3 = function(get2) { + return this.quartile(get2)[2]; + }; + prototype$1.ci = function(get2) { + if (this._get !== get2 || !this._ci) { + this._ci = bootstrapCI(this.values(), 1e3, 0.05, get2); + this._get = get2; + } + return this._ci; + }; + prototype$1.ci0 = function(get2) { + return this.ci(get2)[0]; + }; + prototype$1.ci1 = function(get2) { + return this.ci(get2)[1]; + }; + function Aggregate$1(params2) { + Transform.call(this, null, params2); + this._adds = []; + this._mods = []; + this._alen = 0; + this._mlen = 0; + this._drop = true; + this._cross = false; + this._dims = []; + this._dnames = []; + this._measures = []; + this._countOnly = false; + this._counts = null; + this._prev = null; + this._inputs = null; + this._outputs = null; + } + Aggregate$1.Definition = { + "type": "Aggregate", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "drop", + "type": "boolean", + "default": true + }, { + "name": "cross", + "type": "boolean", + "default": false + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Aggregate$1, Transform, { + transform(_, pulse2) { + const aggr = this, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), mod = _.modified(); + aggr.stamp = out.stamp; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + aggr._prev = aggr.value; + aggr.value = mod ? aggr.init(_) : /* @__PURE__ */ Object.create(null); + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + aggr.value = aggr.value || aggr.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + out.modifies(aggr._outputs); + aggr._drop = _.drop !== false; + if (_.cross && aggr._dims.length > 1) { + aggr._drop = false; + aggr.cross(); + } + if (pulse2.clean() && aggr._drop) { + out.clean(true).runAfter(() => this.clean()); + } + return aggr.changes(out); + }, + cross() { + const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(() => ({})), n = dims.length; + function collect2(cells) { + let key2, i, t, v; + for (key2 in cells) { + t = cells[key2].tuple; + for (i = 0; i < n; ++i) { + vals[i][v = t[dims[i]]] = v; + } } - ]; - var disabledPlaceholderStyles = { - color: semanticColors.disabledText, - selectors: (_c = {}, _c[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _c) - }; - return { - root: [ - classNames.root, - fonts.medium, - required && classNames.required, - disabled && classNames.disabled, - focused && classNames.active, - multiline && classNames.multiline, - borderless && classNames.borderless, - underlined && classNames.underlined, - (0, _styling.normalize), - { - position: 'relative' - }, - className - ], - wrapper: [ - classNames.wrapper, - underlined && [ - { - display: 'flex', - borderBottom: "1px solid ".concat(!hasErrorMessage ? semanticColors.inputBorder : semanticColors.errorText), - width: '100%' - }, - disabled && { - borderBottomColor: semanticColors.disabledBackground, - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _d) - }, - !disabled && { - selectors: { - ':hover': { - borderBottomColor: !hasErrorMessage ? semanticColors.inputBorderHovered : semanticColors.errorText, - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderBottomColor: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _e) - } - } - }, - focused && [ - { - position: 'relative' - }, - (0, _styling.getInputFocusStyle)(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, 0, 'borderBottom') - ] - ] - ], - fieldGroup: [ - classNames.fieldGroup, - (0, _styling.normalize), - { - border: "1px solid ".concat(semanticColors.inputBorder), - borderRadius: effects.roundedCorner2, - background: semanticColors.inputBackground, - cursor: 'text', - height: 32, - display: 'flex', - flexDirection: 'row', - alignItems: 'stretch', - position: 'relative' - }, - multiline && { - minHeight: '60px', - height: 'auto', - display: 'flex' - }, - !focused && !disabled && { - selectors: { - ':hover': { - borderColor: semanticColors.inputBorderHovered, - selectors: (_f = {}, _f[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _f) - } - } - }, - focused && !underlined && (0, _styling.getInputFocusStyle)(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, effects.roundedCorner2), - disabled && { - borderColor: semanticColors.disabledBackground, - selectors: (_g = {}, _g[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _g), - cursor: 'default' - }, - borderless && { - border: 'none' - }, - borderless && focused && { - border: 'none', - selectors: { - ':after': { - border: 'none' - } - } - }, - underlined && { - flex: '1 1 0px', - border: 'none', - textAlign: 'left' - }, - underlined && disabled && { - backgroundColor: 'transparent' - }, - hasErrorMessage && !underlined && { - borderColor: semanticColors.errorText, - selectors: { - '&:hover': { - borderColor: semanticColors.errorText - } - } - }, - !hasLabel && required && { - selectors: (_h = { - ':before': { - content: "'*'", - color: semanticColors.errorText, - position: 'absolute', - top: -5, - right: -10 - } - }, _h[0, _styling.HighContrastSelector] = { - selectors: { - ':before': { - color: 'WindowText', - right: -14 - } - } - }, _h) - } - ], - field: [ - fonts.medium, - classNames.field, - (0, _styling.normalize), - { - borderRadius: 0, - border: 'none', - background: 'none', - backgroundColor: 'transparent', - color: semanticColors.inputText, - padding: '0 8px', - width: '100%', - minWidth: 0, - textOverflow: 'ellipsis', - outline: 0, - selectors: (_j = { - '&:active, &:focus, &:hover': { - outline: 0 - }, - '::-ms-clear': { - display: 'none' - } - }, _j[0, _styling.HighContrastSelector] = { - background: 'Window', - color: disabled ? 'GrayText' : 'WindowText' - }, _j) - }, - (0, _styling.getPlaceholderStyles)(placeholderStyles), - multiline && !resizable && [ - classNames.unresizable, - { - resize: 'none' - } - ], - multiline && { - minHeight: 'inherit', - lineHeight: 17, - flexGrow: 1, - paddingTop: 6, - paddingBottom: 6, - overflow: 'auto', - width: '100%' - }, - multiline && autoAdjustHeight && { - overflow: 'hidden' - }, - hasIcon && !hasRevealButton && { - paddingRight: 24 - }, - multiline && hasIcon && { - paddingRight: 40 - }, - disabled && [ - { - backgroundColor: semanticColors.disabledBackground, - color: semanticColors.disabledText, - borderColor: semanticColors.disabledBackground - }, - (0, _styling.getPlaceholderStyles)(disabledPlaceholderStyles) - ], - underlined && { - textAlign: 'left' - }, - focused && !borderless && { - selectors: (_k = {}, _k[0, _styling.HighContrastSelector] = { - paddingLeft: 11, - paddingRight: 11 - }, _k) - }, - focused && multiline && !borderless && { - selectors: (_l = {}, _l[0, _styling.HighContrastSelector] = { - paddingTop: 4 - }, _l) - }, - inputClassName - ], - icon: [ - multiline && { - paddingRight: 24, - alignItems: 'flex-end' - }, - { - pointerEvents: 'none', - position: 'absolute', - bottom: 6, - right: 8, - top: 'auto', - fontSize: (0, _styling.IconFontSizes).medium, - lineHeight: 18 - }, - disabled && { - color: semanticColors.disabledText - } - ], - description: [ - classNames.description, - { - color: semanticColors.bodySubtext, - fontSize: fonts.xSmall.fontSize - } - ], - errorMessage: [ - classNames.errorMessage, - (0, _styling.AnimationClassNames).slideDownIn20, - fonts.small, - { - color: semanticColors.errorText, - margin: 0, - paddingTop: 5, - display: 'flex', - alignItems: 'center' - } - ], - prefix: [ - classNames.prefix, - fieldPrefixSuffix - ], - suffix: [ - classNames.suffix, - fieldPrefixSuffix - ], - revealButton: [ - classNames.revealButton, - 'ms-Button', - 'ms-Button--icon', - (0, _styling.getFocusStyle)(theme, { - inset: 1 - }), - { - height: 30, - width: 32, - border: 'none', - padding: '0px 4px', - backgroundColor: 'transparent', - color: semanticColors.link, - selectors: { - ':hover': { - outline: 0, - color: semanticColors.primaryButtonBackgroundHovered, - backgroundColor: semanticColors.buttonBackgroundHovered, - selectors: (_m = {}, _m[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - color: 'Highlight' - }, _m) - }, - ':focus': { - outline: 0 - } - } - }, - hasIcon && { - marginRight: 28 - } - ], - revealSpan: { - display: 'flex', - height: '100%', - alignItems: 'center' - }, - revealIcon: { - margin: '0px 4px', - pointerEvents: 'none', - bottom: 6, - right: 8, - top: 'auto', - fontSize: (0, _styling.IconFontSizes).medium, - lineHeight: 18 - }, - subComponentStyles: { - label: getLabelStyles(props) - } - }; -} - -},{"tslib":"9gizs","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cpdGU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Toggle/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Toggle/index":"ejet7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ejet7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _toggle = require("./Toggle"); -parcelHelpers.exportAll(_toggle, exports); -var _toggleBase = require("./Toggle.base"); -parcelHelpers.exportAll(_toggleBase, exports); -var _toggleTypes = require("./Toggle.types"); -parcelHelpers.exportAll(_toggleTypes, exports); - -},{"./Toggle":"1L6df","./Toggle.base":false,"./Toggle.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1L6df":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Toggle", ()=>Toggle); -var _utilities = require("@fluentui/utilities"); -var _toggleBase = require("./Toggle.base"); -var _toggleStyles = require("./Toggle.styles"); -var Toggle = (0, _utilities.styled)((0, _toggleBase.ToggleBase), (0, _toggleStyles.getStyles), undefined, { - scope: 'Toggle' -}); - -},{"@fluentui/utilities":"55bj3","./Toggle.base":"fZ4mc","./Toggle.styles":"2Ls2q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fZ4mc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ToggleBase", ()=>ToggleBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _label = require("../Label/Label"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var COMPONENT_NAME = 'Toggle'; -var ToggleBase = _react.forwardRef(function(props, forwardedRef) { - var _a = props.as, RootType = _a === void 0 ? 'div' : _a, ariaLabel = props.ariaLabel, controlledChecked = props.checked, className = props.className, _b = props.defaultChecked, defaultChecked = _b === void 0 ? false : _b, disabled = props.disabled, inlineLabel = props.inlineLabel, label = props.label, // eslint-disable-next-line deprecation/deprecation - offAriaLabel = props.offAriaLabel, offText = props.offText, // eslint-disable-next-line deprecation/deprecation - onAriaLabel = props.onAriaLabel, onChange = props.onChange, // eslint-disable-next-line deprecation/deprecation - onChanged = props.onChanged, onToggleClick = props.onClick, onText = props.onText, role = props.role, styles = props.styles, theme = props.theme; - var _c = (0, _reactHooks.useControllableValue)(controlledChecked, defaultChecked, _react.useCallback(function(ev, isChecked) { - onChange === null || onChange === void 0 || onChange(ev, isChecked); - onChanged === null || onChanged === void 0 || onChanged(isChecked); - }, [ - onChange, - onChanged - ])), checked = _c[0], setChecked = _c[1]; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - disabled: disabled, - checked: checked, - inlineLabel: inlineLabel, - onOffMissing: !onText && !offText - }); - var badAriaLabel = checked ? onAriaLabel : offAriaLabel; - var id = (0, _reactHooks.useId)(COMPONENT_NAME, props.id); - var labelId = "".concat(id, "-label"); - var stateTextId = "".concat(id, "-stateText"); - var stateText = checked ? onText : offText; - var toggleNativeProps = (0, _utilities.getNativeProps)(props, (0, _utilities.inputProperties), [ - 'defaultChecked' - ]); - // The following properties take priority for what Narrator should read: - // 1. ariaLabel - // 2. onAriaLabel (if checked) or offAriaLabel (if not checked) - // 3. label, if existent - var labelledById = undefined; - if (!ariaLabel && !badAriaLabel) { - if (label) labelledById = labelId; - if (stateText && !labelledById) labelledById = stateTextId; - } - var toggleButton = _react.useRef(null); - (0, _utilities.useFocusRects)(toggleButton); - useComponentRef(props, checked, toggleButton); - var onClick = function(ev) { - if (!disabled) { - setChecked(!checked, ev); - if (onToggleClick) onToggleClick(ev); + } + collect2(aggr._prev); + collect2(curr); + function generate2(base2, tuple, index2) { + const name = dims[index2], v = vals[index2++]; + for (const k in v) { + const key2 = base2 ? base2 + "|" + k : k; + tuple[name] = v[k]; + if (index2 < n) generate2(key2, tuple, index2); + else if (!curr[key2]) aggr.cell(key2, tuple); } - }; - var slotProps = { - root: { - className: classNames.root, - hidden: toggleNativeProps.hidden - }, - label: { - children: label, - className: classNames.label, - htmlFor: id, - id: labelId - }, - container: { - className: classNames.container - }, - pill: (0, _tslib.__assign)((0, _tslib.__assign)({}, toggleNativeProps), { - 'aria-disabled': disabled, - 'aria-checked': checked, - 'aria-label': ariaLabel ? ariaLabel : badAriaLabel, - 'aria-labelledby': labelledById, - className: classNames.pill, - 'data-is-focusable': true, - 'data-ktp-target': true, - disabled: disabled, - id: id, - onClick: onClick, - ref: toggleButton, - role: role ? role : 'switch', - type: 'button' - }), - thumb: { - className: classNames.thumb - }, - stateText: { - children: stateText, - className: classNames.text, - htmlFor: id, - id: stateTextId - } - }; - return _react.createElement(RootType, (0, _tslib.__assign)({ - ref: forwardedRef - }, slotProps.root), label && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.label)), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.container), _react.createElement("button", (0, _tslib.__assign)({}, slotProps.pill), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.thumb))), (checked && onText || offText) && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.stateText)))); -}); -ToggleBase.displayName = COMPONENT_NAME + 'Base'; -var useComponentRef = function(props, isChecked, toggleButtonRef) { - _react.useImperativeHandle(props.componentRef, function() { - return { - get checked () { - return !!isChecked; - }, - focus: function() { - if (toggleButtonRef.current) toggleButtonRef.current.focus(); - } - }; - }, [ - isChecked, - toggleButtonRef - ]); -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../Label/Label":"4UD9B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Ls2q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styleUtilities = require("@fluentui/style-utilities"); -var DEFAULT_PILL_WIDTH = 40; -var DEFAULT_PILL_HEIGHT = 20; -var DEFAULT_THUMB_SIZE = 12; -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g; - var theme = props.theme, className = props.className, disabled = props.disabled, checked = props.checked, inlineLabel = props.inlineLabel, onOffMissing = props.onOffMissing; - var semanticColors = theme.semanticColors, palette = theme.palette; - // Tokens - var pillUncheckedBackground = semanticColors.bodyBackground; - var pillCheckedBackground = semanticColors.inputBackgroundChecked; - var pillCheckedHoveredBackground = semanticColors.inputBackgroundCheckedHovered; - var thumbUncheckedHoveredBackground = palette.neutralDark; - var pillCheckedDisabledBackground = semanticColors.disabledBodySubtext; - var thumbBackground = semanticColors.smallInputBorder; - var thumbCheckedBackground = semanticColors.inputForegroundChecked; - var thumbDisabledBackground = semanticColors.disabledBodySubtext; - var thumbCheckedDisabledBackground = semanticColors.disabledBackground; - var pillBorderColor = semanticColors.smallInputBorder; - var pillBorderHoveredColor = semanticColors.inputBorderHovered; - var pillBorderDisabledColor = semanticColors.disabledBodySubtext; - var textDisabledColor = semanticColors.disabledText; + } + generate2("", {}, 0); + }, + init(_) { + const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; + function inputVisit(get2) { + const fields2 = array$4(accessorFields(get2)), n2 = fields2.length; + let i2 = 0, f; + for (; i2 < n2; ++i2) { + if (!inputMap[f = fields2[i2]]) { + inputMap[f] = 1; + inputs.push(f); + } + } + } + this._dims = array$4(_.groupby); + this._dnames = this._dims.map((d2) => { + const dname = accessorName(d2); + inputVisit(d2); + outputs.push(dname); + return dname; + }); + this.cellkey = _.key ? _.key : groupkey(this._dims); + this._countOnly = true; + this._counts = []; + this._measures = []; + const fields = _.fields || [null], ops2 = _.ops || ["count"], aggregate_params = _.aggregate_params || [null], as = _.as || [], n = fields.length, map2 = {}; + let field2, op, aggregate_param, m2, mname, outname, i; + if (n !== ops2.length) { + error("Unmatched number of fields and aggregate ops."); + } + for (i = 0; i < n; ++i) { + field2 = fields[i]; + op = ops2[i]; + aggregate_param = aggregate_params[i] || null; + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + mname = accessorName(field2); + outname = measureName(op, mname, as[i]); + outputs.push(outname); + if (op === "count") { + this._counts.push(outname); + continue; + } + m2 = map2[mname]; + if (!m2) { + inputVisit(field2); + m2 = map2[mname] = []; + m2.field = field2; + this._measures.push(m2); + } + if (op !== "count") this._countOnly = false; + m2.push(createMeasure(op, aggregate_param, outname)); + } + this._measures = this._measures.map((m3) => compileMeasures(m3, m3.field)); + return /* @__PURE__ */ Object.create(null); + }, + // -- Cell Management ----- + cellkey: groupkey(), + cell(key2, t) { + let cell2 = this.value[key2]; + if (!cell2) { + cell2 = this.value[key2] = this.newcell(key2, t); + this._adds[this._alen++] = cell2; + } else if (cell2.num === 0 && this._drop && cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._adds[this._alen++] = cell2; + } else if (cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._mods[this._mlen++] = cell2; + } + return cell2; + }, + newcell(key2, t) { + const cell2 = { + key: key2, + num: 0, + agg: null, + tuple: this.newtuple(t, this._prev && this._prev[key2]), + stamp: this.stamp, + store: false + }; + if (!this._countOnly) { + const measures = this._measures, n = measures.length; + cell2.agg = Array(n); + for (let i = 0; i < n; ++i) { + cell2.agg[i] = new measures[i](cell2); + } + } + if (cell2.store) { + cell2.data = new TupleStore(); + } + return cell2; + }, + newtuple(t, p) { + const names = this._dnames, dims = this._dims, n = dims.length, x2 = {}; + for (let i = 0; i < n; ++i) { + x2[names[i]] = dims[i](t); + } + return p ? replace$1(p.tuple, x2) : ingest$1(x2); + }, + clean() { + const cells = this.value; + for (const key2 in cells) { + if (cells[key2].num === 0) { + delete cells[key2]; + } + } + }, + // -- Process Tuples ----- + add(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num += 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.add(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].add(agg[i].get(t), t); + } + }, + rem(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num -= 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.rem(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].rem(agg[i].get(t), t); + } + }, + celltuple(cell2) { + const tuple = cell2.tuple, counts = this._counts; + if (cell2.store) { + cell2.data.values(); + } + for (let i = 0, n = counts.length; i < n; ++i) { + tuple[counts[i]] = cell2.num; + } + if (!this._countOnly) { + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].set(tuple); + } + } + return tuple; + }, + changes(out) { + const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add2 = out.add, rem2 = out.rem, mod = out.mod; + let cell2, key2, i, n; + if (prev) for (key2 in prev) { + cell2 = prev[key2]; + if (!drop || cell2.num) rem2.push(cell2.tuple); + } + for (i = 0, n = this._alen; i < n; ++i) { + add2.push(this.celltuple(adds[i])); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + cell2 = mods[i]; + (cell2.num === 0 && drop ? rem2 : mod).push(this.celltuple(cell2)); + mods[i] = null; + } + this._alen = this._mlen = 0; + this._prev = null; + return out; + } + }); + const EPSILON$1 = 1e-14; + function Bin(params2) { + Transform.call(this, null, params2); + } + Bin.Definition = { + "type": "Bin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "anchor", + "type": "number" + }, { + "name": "maxbins", + "type": "number", + "default": 20 + }, { + "name": "base", + "type": "number", + "default": 10 + }, { + "name": "divide", + "type": "number", + "array": true, + "default": [5, 2] + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "span", + "type": "number" + }, { + "name": "step", + "type": "number" + }, { + "name": "steps", + "type": "number", + "array": true + }, { + "name": "minstep", + "type": "number", + "default": 0 + }, { + "name": "nice", + "type": "boolean", + "default": true + }, { + "name": "name", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["bin0", "bin1"] + }] + }; + inherits(Bin, Transform, { + transform(_, pulse2) { + const band2 = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || ["bin0", "bin1"], b0 = as[0], b1 = as[1]; + let flag2; + if (_.modified()) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + } else { + flag2 = pulse2.modified(accessorFields(_.field)) ? pulse2.ADD_MOD : pulse2.ADD; + } + pulse2.visit(flag2, band2 ? (t) => { + const v = bins(t); + t[b0] = v; + t[b1] = v == null ? null : start + step * (1 + (v - start) / step); + } : (t) => t[b0] = bins(t)); + return pulse2.modifies(band2 ? as : b0); + }, + _bins(_) { + if (this.value && !_.modified()) { + return this.value; + } + const field2 = _.field, bins = bin(_), step = bins.step; + let start = bins.start, stop2 = start + Math.ceil((bins.stop - start) / step) * step, a2, d2; + if ((a2 = _.anchor) != null) { + d2 = a2 - (start + step * Math.floor((a2 - start) / step)); + start += d2; + stop2 += d2; + } + const f = function(t) { + let v = toNumber(field2(t)); + return v == null ? null : v < start ? -Infinity : v > stop2 ? Infinity : (v = Math.max(start, Math.min(v, stop2 - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step)); + }; + f.start = start; + f.stop = bins.stop; + f.step = step; + return this.value = accessor(f, accessorFields(field2), _.name || "bin_" + accessorName(field2)); + } + }); + function SortedList(idFunc, source2, input) { + const $2 = idFunc; + let data2 = source2 || [], add2 = input || [], rem2 = {}, cnt = 0; return { - root: [ - 'ms-Toggle', - checked && 'is-checked', - !disabled && 'is-enabled', - disabled && 'is-disabled', - theme.fonts.medium, - { - marginBottom: '8px' - }, - inlineLabel && { - display: 'flex', - alignItems: 'center' - }, - className - ], - label: [ - 'ms-Toggle-label', - { - display: 'inline-block' - }, - disabled && { - color: textDisabledColor, - selectors: (_a = {}, _a[0, _styleUtilities.HighContrastSelector] = { - color: 'GrayText' - }, _a) - }, - inlineLabel && !onOffMissing && { - marginRight: 16 - }, - onOffMissing && inlineLabel && { - order: 1, - marginLeft: 16 - }, - inlineLabel && { - wordBreak: 'break-word' - } - ], - container: [ - 'ms-Toggle-innerContainer', - { - display: 'flex', - position: 'relative' - } - ], - pill: [ - 'ms-Toggle-background', - (0, _styleUtilities.getFocusStyle)(theme, { - inset: -3 - }), - { - fontSize: '20px', - boxSizing: 'border-box', - width: DEFAULT_PILL_WIDTH, - height: DEFAULT_PILL_HEIGHT, - borderRadius: DEFAULT_PILL_HEIGHT / 2, - transition: 'all 0.1s ease', - border: "1px solid ".concat(pillBorderColor), - background: pillUncheckedBackground, - cursor: 'pointer', - display: 'flex', - alignItems: 'center', - padding: '0 3px', - overflow: 'visible' - }, - !disabled && [ - !checked && { - selectors: { - ':hover': [ - { - borderColor: pillBorderHoveredColor - } - ], - ':hover .ms-Toggle-thumb': [ - { - backgroundColor: thumbUncheckedHoveredBackground, - selectors: (_b = {}, _b[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _b) - } - ] - } - }, - checked && [ - { - background: pillCheckedBackground, - borderColor: 'transparent', - justifyContent: 'flex-end' - }, - { - selectors: (_c = { - ':hover': [ - { - backgroundColor: pillCheckedHoveredBackground, - borderColor: 'transparent', - selectors: (_d = {}, _d[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _d) - } - ] - }, _c[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'Highlight' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _c) - } - ] - ], - disabled && [ - { - cursor: 'default' - }, - !checked && [ - { - borderColor: pillBorderDisabledColor - } - ], - checked && [ - { - backgroundColor: pillCheckedDisabledBackground, - borderColor: 'transparent', - justifyContent: 'flex-end' - } - ] - ], - !disabled && { - selectors: { - '&:hover': { - selectors: (_e = {}, _e[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _e) - } - } - } - ], - thumb: [ - 'ms-Toggle-thumb', - { - display: 'block', - width: DEFAULT_THUMB_SIZE, - height: DEFAULT_THUMB_SIZE, - borderRadius: '50%', - transition: 'all 0.1s ease', - backgroundColor: thumbBackground, - /* Border is added to handle high contrast mode for Firefox */ borderColor: 'transparent', - borderWidth: DEFAULT_THUMB_SIZE / 2, - borderStyle: 'solid', - boxSizing: 'border-box' - }, - !disabled && checked && [ - { - backgroundColor: thumbCheckedBackground, - selectors: (_f = {}, _f[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Window', - borderColor: 'Window' - }, _f) - } - ], - disabled && [ - !checked && [ - { - backgroundColor: thumbDisabledBackground - } - ], - checked && [ - { - backgroundColor: thumbCheckedDisabledBackground - } - ] - ] - ], - text: [ - 'ms-Toggle-stateText', - { - selectors: { - // Workaround: make rules more specific than Label rules. - '&&': { - padding: '0', - margin: '0 8px', - userSelect: 'none', - fontWeight: (0, _styleUtilities.FontWeights).regular - } - } - }, - disabled && { - selectors: { - '&&': { - color: textDisabledColor, - selectors: (_g = {}, _g[0, _styleUtilities.HighContrastSelector] = { - color: 'GrayText' - }, _g) - } - } - } - ] - }; -}; - -},{"tslib":"9gizs","@fluentui/style-utilities":"bJvmh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7pzEo":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SandDanceApp", ()=>SandDanceApp); -var _base = require("./base"); -var _dataSourcePicker = require("./dataSourcePicker"); -var _download = require("./download"); -var _language = require("./language"); -var _snapshots = require("./snapshots"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -function getViewerOptions(darkTheme, themeColors) { - const colors = themeColors && themeColors[darkTheme ? 'dark' : 'light']; - const viewerOptions = { - colors: Object.assign(Object.assign({}, (0, _sanddanceExplorer.getColorSettingsFromThemePalette)((0, _sanddanceExplorer.themePalettes)[darkTheme ? 'dark-theme' : ''])), colors) + add: (t) => add2.push(t), + remove: (t) => rem2[$2(t)] = ++cnt, + size: () => data2.length, + data: (compare2, resort) => { + if (cnt) { + data2 = data2.filter((t) => !rem2[$2(t)]); + rem2 = {}; + cnt = 0; + } + if (resort && compare2) { + data2.sort(compare2); + } + if (add2.length) { + data2 = compare2 ? merge$2(compare2, data2, add2.sort(compare2)) : data2.concat(add2); + add2 = []; + } + return data2; + } }; - return viewerOptions; -} -function getSnapshotFromHash() { - const hash = document.location.hash && document.location.hash.substring(1); - if (hash) try { - return JSON.parse(decodeURIComponent(hash)); - } catch (e) { - // continue regardless of error - } -} -let snapshotOnLoad = getSnapshotFromHash(); -if (snapshotOnLoad && snapshotOnLoad.dataSource && snapshotOnLoad.dataSource.dataSourceType === 'local') snapshotOnLoad = null; -class SandDanceApp extends _react.Component { - constructor(props){ - super(props); - this.state = { - compactUI: !!localStorage.getItem('compactUI'), - dialogMode: null, - dataSource: snapshotOnLoad && snapshotOnLoad.dataSource || props.dataSources[0], - darkTheme: props.darkTheme - }; - this.viewerOptions = getViewerOptions(this.state.darkTheme, props.themeColors); - this.handlers = { - hashchange: (e)=>{ - const snapshot = getSnapshotFromHash(); - if (snapshot) this.explorer && this.explorer.calculate(()=>this.hydrateSnapshot(snapshot)); - }, - resize: (e)=>{ - this.explorer && this.explorer.resize(); - } - }; - this.wireEventHandlers(true); - this.changeColorScheme(this.state.darkTheme); + } + function Collect$1(params2) { + Transform.call(this, [], params2); + } + Collect$1.Definition = { + "type": "Collect", + "metadata": { + "source": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }] + }; + inherits(Collect$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), sort2 = _.sort, mod = pulse2.changed() || sort2 && (_.modified("sort") || pulse2.modified(sort2.fields)); + out.visit(out.REM, list.remove); + this.modified(mod); + this.value = out.source = list.data(stableCompare(sort2), mod); + if (pulse2.source && pulse2.source.root) { + this.value.root = pulse2.source.root; + } + return out; } - wireEventHandlers(add) { - for(const key in this.handlers)if (add) window.addEventListener(key, this.handlers[key]); - else window.removeEventListener(key, this.handlers[key]); + }); + function Compare$1(params2) { + Operator.call(this, null, update$5, params2); + } + inherits(Compare$1, Operator); + function update$5(_) { + return this.value && !_.modified() ? this.value : compare$1(_.fields, _.orders); + } + function CountPattern(params2) { + Transform.call(this, null, params2); + } + CountPattern.Definition = { + "type": "CountPattern", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "case", + "type": "enum", + "values": ["upper", "lower", "mixed"], + "default": "mixed" + }, { + "name": "pattern", + "type": "string", + "default": '[\\w"]+' + }, { + "name": "stopwords", + "type": "string", + "default": "" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["text", "count"] + }] + }; + function tokenize(text2, tcase, match2) { + switch (tcase) { + case "upper": + text2 = text2.toUpperCase(); + break; + case "lower": + text2 = text2.toLowerCase(); + break; } - isSameDataSource(a, b) { - if (a.dataSourceType === b.dataSourceType && a.type === b.type && a.id === b.id) { - if (a.dataSourceType === 'url') return a.dataUrl === b.dataUrl; - return true; + return text2.match(match2); + } + inherits(CountPattern, Transform, { + transform(_, pulse2) { + const process = (update2) => (tuple) => { + var tokens = tokenize(get2(tuple), _.case, match2) || [], t; + for (var i = 0, n = tokens.length; i < n; ++i) { + if (!stop2.test(t = tokens[i])) update2(t); + } + }; + const init2 = this._parameterCheck(_, pulse2), counts = this._counts, match2 = this._match, stop2 = this._stop, get2 = _.field, as = _.as || ["text", "count"], add2 = process((t) => counts[t] = 1 + (counts[t] || 0)), rem2 = process((t) => counts[t] -= 1); + if (init2) { + pulse2.visit(pulse2.SOURCE, add2); + } else { + pulse2.visit(pulse2.ADD, add2); + pulse2.visit(pulse2.REM, rem2); + } + return this._finish(pulse2, as); + }, + _parameterCheck(_, pulse2) { + let init2 = false; + if (_.modified("stopwords") || !this._stop) { + this._stop = new RegExp("^" + (_.stopwords || "") + "$", "i"); + init2 = true; + } + if (_.modified("pattern") || !this._match) { + this._match = new RegExp(_.pattern || "[\\w']+", "g"); + init2 = true; + } + if (_.modified("field") || pulse2.modified(_.field.fields)) { + init2 = true; + } + if (init2) this._counts = {}; + return init2; + }, + _finish(pulse2, as) { + const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text2 = as[0], count2 = as[1], out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + let w2, t, c2; + for (w2 in counts) { + t = tuples[w2]; + c2 = counts[w2] || 0; + if (!t && c2) { + tuples[w2] = t = ingest$1({}); + t[text2] = w2; + t[count2] = c2; + out.add.push(t); + } else if (c2 === 0) { + if (t) out.rem.push(t); + counts[w2] = null; + tuples[w2] = null; + } else if (t[count2] !== c2) { + t[count2] = c2; + out.mod.push(t); } - return false; + } + return out.modifies(as); } - hydrateSnapshot(snapshot, selectedSnapshotIndex = -1) { - if (snapshot.dataSource) { - if (this.isSameDataSource(snapshot.dataSource, this.state.dataSource)) { - if (selectedSnapshotIndex === -1) this.explorer.reviveSnapshot(snapshot); - else this.explorer.reviveSnapshot(selectedSnapshotIndex); - if (snapshot.dataSource.snapshotsUrl && snapshot.dataSource.snapshotsUrl !== this.state.dataSource.snapshotsUrl) //load new snapshots url - fetch(snapshot.dataSource.snapshotsUrl).then((response)=>response.json()).then((snapshots)=>{ - if ((0, _snapshots.validSnapshots)(snapshots)) { - this.explorer.setState({ - snapshots - }); - const dataSource = Object.assign({}, this.state.dataSource); - dataSource.snapshotsUrl = snapshot.dataSource.snapshotsUrl; - this.setState({ - dataSource - }); - } - }); - } else if (snapshot.dataSource.dataSourceType === 'local') { - this.dataSourcePicker.setState({ - dialogMode: 'local' - }); - this.postLoad = (ds)=>{ - if (this.isSameDataSource(snapshot.dataSource, ds)) this.hydrateSnapshot(snapshot, selectedSnapshotIndex); - }; - } else this.load(snapshot.dataSource, snapshot.insight).then(()=>{ - this.explorer.setState({ - sideTabId: (0, _sanddanceExplorer.SideTabId).Snapshots, - note: snapshot.description - }); - this.explorer.scrollSnapshotIntoView(selectedSnapshotIndex); - }).catch((e)=>{ - this.loadError(snapshot.dataSource); - }); - return true; + }); + function Cross(params2) { + Transform.call(this, null, params2); + } + Cross.Definition = { + "type": "Cross", + "metadata": { + "generates": true + }, + "params": [{ + "name": "filter", + "type": "expr" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["a", "b"] + }] + }; + inherits(Cross, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), as = _.as || ["a", "b"], a2 = as[0], b2 = as[1], reset2 = !this.value || pulse2.changed(pulse2.ADD_REM) || _.modified("as") || _.modified("filter"); + let data2 = this.value; + if (reset2) { + if (data2) out.rem = data2; + data2 = pulse2.materialize(pulse2.SOURCE).source; + out.add = this.value = cross(data2, a2, b2, _.filter || truthy); + } else { + out.mod = data2; + } + out.source = this.value; + return out.modifies(as); + } + }); + function cross(input, a2, b2, filter2) { + var data2 = [], t = {}, n = input.length, i = 0, j, left; + for (; i < n; ++i) { + t[a2] = left = input[i]; + for (j = 0; j < n; ++j) { + t[b2] = input[j]; + if (filter2(t)) { + data2.push(ingest$1(t)); + t = {}; + t[a2] = left; } + } } - load(dataSource, partialInsight) { - //clone so that we do not modify original object - dataSource = (0, _sanddanceExplorer.SandDance).VegaMorphCharts.util.clone(dataSource); - this.setState({ - dataSource + return data2; + } + const Distributions = { + kde, + mixture: mixture$1, + normal: gaussian, + lognormal, + uniform + }; + const DISTRIBUTIONS = "distributions", FUNCTION = "function", FIELD = "field"; + function parse$4(def2, data2) { + const func = def2[FUNCTION]; + if (!has$1(Distributions, func)) { + error("Unknown distribution function: " + func); + } + const d2 = Distributions[func](); + for (const name in def2) { + if (name === FIELD) { + d2.data((def2.from || data2()).map(def2[name])); + } else if (name === DISTRIBUTIONS) { + d2[name](def2[name].map((_) => parse$4(_, data2))); + } else if (typeof d2[name] === FUNCTION) { + d2[name](def2[name]); + } + } + return d2; + } + function Density(params2) { + Transform.call(this, null, params2); + } + const distributions = [{ + "key": { + "function": "normal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "lognormal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "uniform" + }, + "params": [{ + "name": "min", + "type": "number", + "default": 0 + }, { + "name": "max", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "kde" + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "from", + "type": "data" + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }] + }]; + const mixture = { + "key": { + "function": "mixture" + }, + "params": [{ + "name": "distributions", + "type": "param", + "array": true, + "params": distributions + }, { + "name": "weights", + "type": "number", + "array": true + }] + }; + Density.Definition = { + "type": "Density", + "metadata": { + "generates": true + }, + "params": [{ + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "method", + "type": "string", + "default": "pdf", + "values": ["pdf", "cdf"] + }, { + "name": "distribution", + "type": "param", + "params": distributions.concat(mixture) + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(Density, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const dist2 = parse$4(_.distribution, source$1(pulse2)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + let method2 = _.method || "pdf"; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (!_.extent && !dist2.data) { + error("Missing density extent parameter."); + } + method2 = dist2[method2]; + const as = _.as || ["value", "density"], domain2 = _.extent || extent(dist2.data()), values2 = sampleCurve(method2, domain2, minsteps, maxsteps).map((v) => { + const tuple = {}; + tuple[as[0]] = v[0]; + tuple[as[1]] = v[1]; + return ingest$1(tuple); }); - document.title = `SandDance - ${dataSource.displayName}`; - return this.explorer.load(dataSource, (columns)=>{ - return partialInsight || this.props.insights && this.props.insights[dataSource.id]; - }, this.props.initialOptions && (0, _sanddanceExplorer.SandDance).VegaMorphCharts.util.deepMerge({}, this.props.initialOptions['*'], this.props.initialOptions[dataSource.id])); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; } - dataSourceError(dataSource) { - switch(dataSource.dataSourceType){ - case 'local': - return (0, _language.strings).errorDataSourceFromLocal(dataSource); - case 'sample': - case 'url': - return (0, _language.strings).errorDataSourceFromUrl(dataSource); + }); + function source$1(pulse2) { + return () => pulse2.materialize(pulse2.SOURCE).source; + } + function fieldNames(fields, as) { + if (!fields) return null; + return fields.map((f, i) => as[i] || accessorName(f)); + } + function partition$1$1(data2, groupby, field2) { + const groups = [], get2 = (f) => f(t); + let map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2.map(field2)); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); + } + g.push(field2(t)); + } + } + return groups; + } + const Output$5 = "bin"; + function DotBin(params2) { + Transform.call(this, null, params2); + } + DotBin.Definition = { + "type": "DotBin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "step", + "type": "number" + }, { + "name": "smooth", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": Output$5 + }] + }; + const autostep = (data2, field2) => span(extent(data2, field2)) / 30; + inherits(DotBin, Transform, { + transform(_, pulse2) { + if (this.value && !(_.modified() || pulse2.changed())) { + return pulse2; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(pulse2.source, _.groupby, identity$2), smooth = _.smooth || false, field2 = _.field, step = _.step || autostep(source2, field2), sort2 = stableCompare((a2, b2) => field2(a2) - field2(b2)), as = _.as || Output$5, n = groups.length; + let min2 = Infinity, max2 = -Infinity, i = 0, j; + for (; i < n; ++i) { + const g = groups[i].sort(sort2); + j = -1; + for (const v of dotbin(g, step, smooth, field2)) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + g[++j][as] = v; + } + } + this.value = { + start: min2, + stop: max2, + step + }; + return pulse2.reflow(true).modifies(as); + } + }); + function Expression$1(params2) { + Operator.call(this, null, update$4, params2); + this.modified(true); + } + inherits(Expression$1, Operator); + function update$4(_) { + const expr2 = _.expr; + return this.value && !_.modified("expr") ? this.value : accessor((datum2) => expr2(datum2, _), accessorFields(expr2), accessorName(expr2)); + } + function Extent(params2) { + Transform.call(this, [void 0, void 0], params2); + } + Extent.Definition = { + "type": "Extent", + "metadata": {}, + "params": [{ + "name": "field", + "type": "field", + "required": true + }] + }; + inherits(Extent, Transform, { + transform(_, pulse2) { + const extent2 = this.value, field2 = _.field, mod = pulse2.changed() || pulse2.modified(field2.fields) || _.modified("field"); + let min2 = extent2[0], max2 = extent2[1]; + if (mod || min2 == null) { + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(mod ? pulse2.SOURCE : pulse2.ADD, (t) => { + const v = toNumber(field2(t)); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + }); + if (!Number.isFinite(min2) || !Number.isFinite(max2)) { + let name = accessorName(field2); + if (name) name = ` for field "${name}"`; + pulse2.dataflow.warn(`Infinite extent${name}: [${min2}, ${max2}]`); + min2 = max2 = void 0; + } + this.value = [min2, max2]; + } + }); + function Subflow(pulse2, parent) { + Operator.call(this, pulse2); + this.parent = parent; + this.count = 0; + } + inherits(Subflow, Operator, { + /** + * Routes pulses from this subflow to a target transform. + * @param {Transform} target - A transform that receives the subflow of tuples. + */ + connect(target2) { + this.detachSubflow = target2.detachSubflow; + this.targets().add(target2); + return target2.source = this; + }, + /** + * Add an 'add' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being added. + */ + add(t) { + this.count += 1; + this.value.add.push(t); + }, + /** + * Add a 'rem' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being removed. + */ + rem(t) { + this.count -= 1; + this.value.rem.push(t); + }, + /** + * Add a 'mod' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being modified. + */ + mod(t) { + this.value.mod.push(t); + }, + /** + * Re-initialize this operator's pulse value. + * @param {Pulse} pulse - The pulse to copy from. + * @see Pulse.init + */ + init(pulse2) { + this.value.init(pulse2, pulse2.NO_SOURCE); + }, + /** + * Evaluate this operator. This method overrides the + * default behavior to simply return the contained pulse value. + * @return {Pulse} + */ + evaluate() { + return this.value; + } + }); + function Facet$1(params2) { + Transform.call(this, {}, params2); + this._keys = fastmap(); + const a2 = this._targets = []; + a2.active = 0; + a2.forEach = (f) => { + for (let i = 0, n = a2.active; i < n; ++i) { + f(a2[i], i, a2); + } + }; + } + inherits(Facet$1, Transform, { + activate(flow) { + this._targets[this._targets.active++] = flow; + }, + // parent argument provided by PreFacet subclass + subflow(key2, flow, pulse2, parent) { + const flows = this.value; + let sf = has$1(flows, key2) && flows[key2], df, p; + if (!sf) { + p = parent || (p = this._group[key2]) && p.tuple; + df = pulse2.dataflow; + sf = new Subflow(pulse2.fork(pulse2.NO_SOURCE), this); + df.add(sf).connect(flow(df, key2, p)); + flows[key2] = sf; + this.activate(sf); + } else if (sf.value.stamp < pulse2.stamp) { + sf.init(pulse2); + this.activate(sf); + } + return sf; + }, + clean() { + const flows = this.value; + let detached = 0; + for (const key2 in flows) { + if (flows[key2].count === 0) { + const detach = flows[key2].detachSubflow; + if (detach) detach(); + delete flows[key2]; + ++detached; + } + } + if (detached) { + const active = this._targets.filter((sf) => sf && sf.count > 0); + this.initTargets(active); + } + }, + initTargets(act) { + const a2 = this._targets, n = a2.length, m2 = act ? act.length : 0; + let i = 0; + for (; i < m2; ++i) { + a2[i] = act[i]; + } + for (; i < n && a2[i] != null; ++i) { + a2[i] = null; + } + a2.active = m2; + }, + transform(_, pulse2) { + const df = pulse2.dataflow, key2 = _.key, flow = _.subflow, cache2 = this._keys, rekey = _.modified("key"), subflow = (key3) => this.subflow(key3, flow, pulse2); + this._group = _.group || {}; + this.initTargets(); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t), k = cache2.get(id2); + if (k !== void 0) { + cache2.delete(id2); + subflow(k).rem(t); } - } - loadError(dataSource) { - const error = this.dataSourceError(dataSource); - this.explorer.setState({ - errors: [ - error - ] + }); + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + cache2.set(tupleid(t), k); + subflow(k).add(t); + }); + if (rekey || pulse2.modified(key2.fields)) { + pulse2.visit(pulse2.MOD, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 === k1) { + subflow(k1).mod(t); + } else { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } }); - this.setState({ - dataSource: { - dataSourceType: null, - id: null, - type: null - } + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => { + subflow(cache2.get(tupleid(t))).mod(t); }); - } - updateExplorerViewerOptions(viewerOptions) { - this.viewerOptions = viewerOptions; - this.explorer && this.explorer.updateViewerOptions(this.viewerOptions); - } - getThemePalette(darkTheme) { - const theme = darkTheme ? 'dark-theme' : ''; - return (0, _sanddanceExplorer.themePalettes)[theme]; - } - changeColorScheme(darkTheme) { - this.updateExplorerViewerOptions(getViewerOptions(darkTheme, this.props.themeColors)); - (0, _sanddanceExplorer.SandDance).VegaMorphCharts.base.vega.scheme((0, _sanddanceExplorer.SandDance).constants.ColorScaleNone, (x)=>this.explorer.viewer.options.colors.defaultCube); - this.explorer && this.explorer.viewer && this.explorer.viewer.renderSameLayout(this.viewerOptions); - (0, _base.base).fluentUI.loadTheme({ - palette: this.getThemePalette(darkTheme) + } + if (rekey) { + pulse2.visit(pulse2.REFLOW, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 !== k1) { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } + }); + } + if (pulse2.clean()) { + df.runAfter(() => { + this.clean(); + cache2.clean(); }); + } else if (cache2.empty > df.cleanThreshold) { + df.runAfter(cache2.clean); + } + return pulse2; } - render() { - const theme = this.state.darkTheme ? 'dark-theme' : ''; - const dataSourceProps = { - dataSource: this.state.dataSource, - dataSources: this.props.dataSources, - changeDataSource: (dataSource)=>{ - document.location.hash = ''; - return this.load(dataSource).then(()=>{ - if (this.postLoad) { - this.postLoad(dataSource); - this.postLoad = null; - } - }).catch(()=>this.loadError(dataSource)); - } - }; - return _react.createElement("section", { - className: "sanddance-app" - }, _react.createElement((0, _sanddanceExplorer.Explorer), { - logoClickTarget: "_self", - logoClickUrl: "/SandDance/", - theme: theme, - snapshotProps: { - modifySnapShot: (snapshot)=>{ - snapshot.dataSource = this.state.dataSource; - }, - getTopActions: (snapshots)=>{ - const items = [ - { - key: 'import', - text: (0, _language.strings).menuSnapshotsImport, - subMenuProps: { - items: [ - { - key: 'import-local', - text: (0, _language.strings).menuLocal, - onClick: ()=>this.setState({ - dialogMode: 'import-local' - }) - }, - { - key: 'import-remote', - text: (0, _language.strings).menuUrl, - onClick: ()=>this.setState({ - dialogMode: 'import-remote' - }) - } - ] - } - }, - { - key: 'export', - text: (0, _language.strings).menuSnapshotsExportAsJSON, - disabled: snapshots.length === 0, - onClick: ()=>(0, _snapshots.downloadSnapshotsJSON)(snapshots, `${this.state.dataSource.displayName}.snapshots`) - }, - { - key: 'export-as', - text: (0, _language.strings).menuSnapshotsExportAs, - disabled: snapshots.length === 0, - onClick: ()=>this.setState({ - dialogMode: 'export' - }) - } - ]; - return items; - }, - getChildren: (snapshots)=>_react.createElement("div", null, this.state.dialogMode === 'import-local' && _react.createElement((0, _snapshots.SnapshotImportLocal), { - theme: theme, - dataSource: this.state.dataSource, - onImportSnapshot: (snapshots)=>this.explorer.setState({ - snapshots - }), - onDismiss: ()=>this.setState({ - dialogMode: null - }) - }), this.state.dialogMode === 'import-remote' && _react.createElement((0, _snapshots.SnapshotImportRemote), { - theme: theme, - dataSource: this.state.dataSource, - onImportSnapshot: (snapshots)=>this.explorer.setState({ - snapshots - }), - onSnapshotsUrl: (snapshotsUrl)=>{ - const dataSource = Object.assign({}, this.state.dataSource); - dataSource.snapshotsUrl = snapshotsUrl; - this.setState({ - dataSource - }); - }, - onDismiss: ()=>this.setState({ - dialogMode: null - }) - }), this.state.dialogMode === 'export' && _react.createElement((0, _snapshots.SnapshotExport), { - explorer: this.explorer, - dataSource: this.state.dataSource, - snapshots: snapshots, - onDismiss: ()=>this.setState({ - dialogMode: null - }), - theme: theme - })), - getActions: (snapshot, i)=>{ - const url = '#' + (0, _snapshots.serializeSnapshot)(snapshot); - let element; - if (snapshot.dataSource && snapshot.dataSource.dataSourceType === 'local') element = _react.createElement("span", { - key: `link${i}` - }, (0, _language.strings).labelLocal); - else element = _react.createElement("a", { - key: `link${i}`, - href: url, - title: (0, _language.strings).labelLinkDescription, - "aria-label": (0, _language.strings).labelLinkDescription - }, (0, _language.strings).labelShare); - return [ - { - element - } - ]; - }, - getTitle: (insight)=>`${this.state.dataSource.displayName} ${insight.chart}`, - getDescription: (insight)=>'' - }, - onSnapshotClick: (snapshot, selectedSnapshotIndex)=>this.hydrateSnapshot(snapshot, selectedSnapshotIndex), - initialView: "2d", - mounted: (e)=>{ - this.explorer = e; - this.load(this.state.dataSource, snapshotOnLoad && snapshotOnLoad.insight).catch((e)=>{ - this.loadError(this.state.dataSource); - }); - this.props.mounted(this); - }, - dataExportHandler: (data, datatype, displayName)=>{ - try { - (0, _download.downloadData)(data, `${displayName}.${datatype}`); - } catch (e) { - this.explorer.setState({ - errors: [ - (0, _language.strings).errorDownloadFailure - ] - }); - } - }, - datasetElement: _react.createElement((0, _dataSourcePicker.DataSourceButton), Object.assign({ - getPicker: ()=>this.dataSourcePicker - }, dataSourceProps)), - topBarButtonProps: [ - { - key: 'theme', - text: this.state.darkTheme ? (0, _language.strings).buttonThemeLight : (0, _language.strings).buttonThemeDark, - iconProps: { - iconName: this.state.darkTheme ? 'Sunny' : 'ClearNight' - }, - onClick: ()=>{ - const darkTheme = !this.state.darkTheme; - this.props.setTheme && this.props.setTheme(darkTheme); - this.setState({ - darkTheme - }); - this.changeColorScheme(darkTheme); - } - } - ], - viewerOptions: this.viewerOptions, - compactUI: this.state.compactUI, - additionalSettings: [ - { - groupLabel: (0, _language.strings).labelPreferences, - children: _react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelCompactUI, - title: (0, _language.strings).labelCompactUIDescription, - checked: this.state.compactUI, - onChange: (e, checked)=>{ - if (checked) localStorage.setItem('compactUI', 'true'); - else localStorage.removeItem('compactUI'); - this.setState({ - compactUI: checked - }); - } - }) - } - ] - }), _react.createElement((0, _dataSourcePicker.DataSourcePicker), Object.assign({ - ref: (dsp)=>{ - if (dsp && !this.dataSourcePicker) this.dataSourcePicker = dsp; - }, - theme: theme - }, dataSourceProps))); - } -} - -},{"./base":"4CyyC","./dataSourcePicker":"1N9JZ","./download":"hRClM","./language":"ieP7V","./snapshots":"EBWBP","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1N9JZ":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataSourceButton", ()=>DataSourceButton); -parcelHelpers.export(exports, "DataSourcePicker", ()=>DataSourcePicker); -var _base = require("./base"); -var _language = require("./language"); -var _url = require("./url"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -function DataSourceButton(props) { - const picker = props.getPicker(); - if (!picker) return null; - const menuProps = { - items: [ - { - key: 'sample-section', - itemType: (0, _base.base).fluentUI.ContextualMenuItemType.Section, - sectionProps: { - title: (0, _language.strings).sampleDataPrefix, - items: props.dataSources.map((ds, i)=>{ - const item = { - key: ds.id, - text: ds.displayName, - onClick: (e)=>{ - picker.changeDataSource(ds); - } - }; - return item; - }) - } - }, - { - key: 'user-section', - itemType: (0, _base.base).fluentUI.ContextualMenuItemType.Section, - sectionProps: { - topDivider: true, - title: (0, _language.strings).menuUserData, - items: [ - { - key: 'local', - text: (0, _language.strings).menuLocal, - onClick: (e)=>picker.setState({ - dialogMode: 'local' - }) - }, - { - key: 'url', - text: (0, _language.strings).menuUrl, - onClick: (e)=>picker.setState({ - dialogMode: 'url' - }) - } - ] - } - } - ] - }; - return _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - className: "sanddance-datasource-picker", - text: dataSourcePrefix(props.dataSource.dataSourceType, props.dataSource.displayName), - menuProps: menuProps - }); -} -class DataSourcePicker extends _react.Component { - constructor(props){ - super(props); - this.state = { - url: '', - urlType: DataSourcePicker.urlTypes[0], - working: false - }; + }); + function Field$1(params2) { + Operator.call(this, null, update$3, params2); + } + inherits(Field$1, Operator); + function update$3(_) { + return this.value && !_.modified() ? this.value : isArray(_.name) ? array$4(_.name).map((f) => field$1(f)) : field$1(_.name, _.as); + } + function Filter(params2) { + Transform.call(this, fastmap(), params2); + } + Filter.Definition = { + "type": "Filter", + "metadata": { + "changes": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }] + }; + inherits(Filter, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, cache2 = this.value, output2 = pulse2.fork(), add2 = output2.add, rem2 = output2.rem, mod = output2.mod, test2 = _.expr; + let isMod = true; + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (!cache2.has(id2)) rem2.push(t); + else cache2.delete(id2); + }); + pulse2.visit(pulse2.ADD, (t) => { + if (test2(t, _)) add2.push(t); + else cache2.set(tupleid(t), 1); + }); + function revisit(t) { + const id2 = tupleid(t), b2 = test2(t, _), s2 = cache2.get(id2); + if (b2 && s2) { + cache2.delete(id2); + add2.push(t); + } else if (!b2 && !s2) { + cache2.set(id2, 1); + rem2.push(t); + } else if (isMod && b2 && !s2) { + mod.push(t); + } + } + pulse2.visit(pulse2.MOD, revisit); + if (_.modified()) { + isMod = false; + pulse2.visit(pulse2.REFLOW, revisit); + } + if (cache2.empty > df.cleanThreshold) df.runAfter(cache2.clean); + return output2; } - changeDataSource(dataSource) { - this.setState({ - working: true - }); - return new Promise((resolve, reject)=>{ - const uploadFormatError = ''; - const urlError = ''; - this.setState({ - uploadFormatError, - urlError - }); - this.props.changeDataSource(dataSource).then(()=>{ - this.setState({ - working: false, - uploadFormatError: '', - urlError: '', - dialogMode: null - }); - resolve(); - }).catch((reason)=>{ - this.setState({ - working: false - }); - reject(reason); - }); - }); + }); + function Flatten(params2) { + Transform.call(this, [], params2); + } + Flatten.Definition = { + "type": "Flatten", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "index", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Flatten, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index2 = _.index || null, m2 = as.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + const arrays = fields.map((f) => f(t)), maxlen = arrays.reduce((l, a2) => Math.max(l, a2.length), 0); + let i = 0, j, d2, v; + for (; i < maxlen; ++i) { + d2 = derive(t); + for (j = 0; j < m2; ++j) { + d2[as[j]] = (v = arrays[j][i]) == null ? null : v; + } + if (index2) { + d2[index2] = i; + } + out.add.push(d2); + } + }); + this.value = out.source = out.add; + if (index2) out.modifies(index2); + return out.modifies(as); } - upload(e) { - if (e.target.files) { - const file = e.target.files[0]; - const split = file.name.split('.'); - const type = split[split.length - 1]; - if (DataSourcePicker.urlTypes.indexOf(type) >= 0) { - const reader = new FileReader(); - reader.onload = ()=>{ - const id = file.name; - const displayName = file.name; - const rawText = reader.result; - const ds = { - dataSourceType: 'local', - displayName, - id, - rawText, - type - }; - this.changeDataSource(ds); - }; - reader.readAsText(file); - } else { - const uploadFormatError = (0, _language.strings).errorInvalidFileFormat; - this.setState({ - uploadFormatError - }); - } + }); + function Fold(params2) { + Transform.call(this, [], params2); + } + Fold.Definition = { + "type": "Fold", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["key", "value"] + }] + }; + inherits(Fold, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, fnames = fields.map(accessorName), as = _.as || ["key", "value"], k = as[0], v = as[1], n = fields.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + for (let i = 0, d2; i < n; ++i) { + d2 = derive(t); + d2[k] = fnames[i]; + d2[v] = fields[i](t); + out.add.push(d2); } + }); + this.value = out.source = out.add; + return out.modifies(as); } - loadUrl() { - if (!this.state.url) return this.setState({ - urlError: (0, _language.strings).errorNoUrl - }); - if (this.state.url.toLocaleLowerCase().substr(0, 4) !== 'http') return this.setState({ - urlError: (0, _language.strings).errorUrlHttp - }); - //TODO: check url - const { url } = this.state; - const ds = { - dataSourceType: 'url', - displayName: url, - id: url, - dataUrl: url, - type: this.state.urlType - }; - this.changeDataSource(ds).catch((e)=>{ - this.setState({ - urlError: e.message - }); - }); + }); + function Formula(params2) { + Transform.call(this, null, params2); + } + Formula.Definition = { + "type": "Formula", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }, { + "name": "as", + "type": "string", + "required": true + }, { + "name": "initonly", + "type": "boolean" + }] + }; + inherits(Formula, Transform, { + transform(_, pulse2) { + const func = _.expr, as = _.as, mod = _.modified(), flag2 = _.initonly ? pulse2.ADD : mod ? pulse2.SOURCE : pulse2.modified(func.fields) || pulse2.modified(as) ? pulse2.ADD_MOD : pulse2.ADD; + if (mod) { + pulse2 = pulse2.materialize().reflow(true); + } + if (!_.initonly) { + pulse2.modifies(as); + } + return pulse2.visit(flag2, (t) => t[as] = func(t, _)); } - getUrlShortcut(dataUrl, type) { - const dss = { - dataSource: { - dataSourceType: 'url', - dataUrl, - displayName: dataUrl.substring(dataUrl.lastIndexOf('/') + 1, dataUrl.lastIndexOf('.')), - id: '', - type - } - }; - return '#' + JSON.stringify(dss); + }); + function Generate(params2) { + Transform.call(this, [], params2); + } + inherits(Generate, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), gen = _.generator; + let data2 = this.value, num = _.size - data2.length, add2, rem2, t; + if (num > 0) { + for (add2 = []; --num >= 0; ) { + add2.push(t = ingest$1(gen(_))); + data2.push(t); + } + out.add = out.add.length ? out.materialize(out.ADD).add.concat(add2) : add2; + } else { + rem2 = data2.slice(0, -num); + out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem2) : rem2; + data2 = data2.slice(-num); + } + out.source = this.value = data2; + return out; } - render() { - const closeDialog = ()=>{ - this.setState({ - dialogMode: null - }); - }; - let shortcut; - if (this.state.url && !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError) shortcut = this.getUrlShortcut(this.state.url, this.state.urlType); - return [ - _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - key: 'local', - hidden: !(this.state.dialogMode === 'local'), - onDismiss: closeDialog, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleLocal, - subText: (0, _language.strings).dialogSubtextLocal - } - }, _react.createElement("input", { - type: "file", - onChange: (e)=>this.upload(e), - disabled: this.state.working - }), this.state.uploadFormatError && _react.createElement("div", { - className: "error" - }, this.state.uploadFormatError)), - _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - key: 'url', - hidden: !(this.state.dialogMode === 'url'), - onDismiss: closeDialog, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleUrl - }, - buttons: [ - _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 0, - onClick: (e)=>this.loadUrl(), - iconProps: { - iconName: 'CloudDownload' - }, - text: (0, _language.strings).dialogLoadButton, - disabled: this.state.working - }) - ] - }, _react.createElement("section", null, _react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelUrl, - placeholder: (0, _language.strings).urlInputPlaceholder, - onKeyUp: (e)=>e.keyCode === 13 && this.loadUrl(), - onChange: (e, url)=>this.setState({ - url, - urlError: '' - }), - value: this.state.url, - disabled: this.state.working - }), this.state.urlError && _react.createElement("div", { - className: "error" - }, this.state.urlError)), _react.createElement("section", null, _react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - selectedKey: this.state.urlType, - options: DataSourcePicker.urlTypes.map((urlType, i)=>{ - return { - key: urlType, - text: urlType, - disabled: this.state.working - }; - }), - onChange: (ev, option)=>this.setState({ - urlType: option.text, - urlError: '' - }), - label: (0, _language.strings).labelDataFormat - })), _react.createElement("section", { - className: 'tip', - style: { - visibility: !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError ? 'visible' : 'hidden' - } - }, (0, _language.strings).labelDataUrlShortcut, " ", _react.createElement("a", { - href: shortcut, - title: (0, _language.strings).labelLinkDescription, - "aria-label": (0, _language.strings).labelLinkDescription - }, (0, _language.strings).labelLink))) - ]; + }); + const Methods$1 = { + value: "value", + median, + mean, + min: min$2, + max: max$2 + }; + const Empty$1 = []; + function Impute(params2) { + Transform.call(this, [], params2); + } + Impute.Definition = { + "type": "Impute", + "metadata": { + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }, { + "name": "keyvals", + "array": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "enum", + "default": "value", + "values": ["value", "mean", "median", "max", "min"] + }, { + "name": "value", + "default": 0 + }] + }; + function getValue(_) { + var m2 = _.method || Methods$1.value, v; + if (Methods$1[m2] == null) { + error("Unrecognized imputation method: " + m2); + } else if (m2 === Methods$1.value) { + v = _.value !== void 0 ? _.value : 0; + return () => v; + } else { + return Methods$1[m2]; } -} -DataSourcePicker.urlTypes = [ - 'json', - 'csv', - 'tsv', - 'topojson' -]; -function dataSourcePrefix(dt, displayName) { - switch(dt){ - case 'sample': - return `${(0, _language.strings).sampleDataPrefix}: ${displayName}`; - case 'local': - return (0, _language.strings).localFilePrefix; - case 'url': - return (0, _language.strings).urlPrefix; - } - return (0, _language.strings).buttonLoadData; -} - -},{"./base":"4CyyC","./language":"ieP7V","./url":"c7hj5","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ieP7V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "strings", ()=>strings); -const strings = { - buttonLoadData: 'Load data', - buttonThemeDark: 'Dark', - buttonThemeLight: 'Light', - buttonExport: 'Export', - menuUserData: 'Use your own data', - menuLocal: 'On this computer ...', - menuUrl: 'Enter a URL ...', - menuSnapshotsExportAsJSON: 'Export as .snapshots JSON file', - menuSnapshotsExportAs: 'Export as ...', - menuSnapshotsImport: 'Import a .snapshots JSON file', - dialogTitleLocal: 'Use a file from your computer', - dialogSubtextLocal: 'Your file will not be uploaded, it is only used by the browser on this computer. The currently supported data formats are json (the default), csv (comma-separated values), tsv (tab-separated values), and topojson.', - dialogTitleUrl: 'Use a data file via URL', - dialogTitleSnapshotsExport: 'Export as', - dialogTitleSnapshotsLocal: 'Use a snapshots file from your computer', - dialogSubtextSnapshotsLocal: 'Use a file that was previously exported snapshots file. Your file will not be uploaded, it is only used by the browser on this computer.', - dialogTitleSnapshotsUrl: 'Use a snapshots file via URL', - dialogLoadButton: 'Load', - labelLocal: '[local]', - labelColorFilter: 'Note: Colors will be re-mapped to the filter when viewing this saved chart.', - labelPreferences: 'Preferences', - labelCompactUI: 'Compact UI', - labelCompactUIDescription: 'Compact UI hides collapses labels on dropdown menus.', - labelSnapshotsExportHTMLTitle: 'HTML', - labelSnapshotsExportHTMLDescription: 'A self contained HTML page with current data and snapshots pre-loaded.', - labelSnapshotsExportMarkdownTitle: 'Markdown', - labelSnapshotsExportMarkdownDescription: 'Markdown is a language used by many blogging platforms. Exports a Markdown file with thumbnails of these snapshots which link back to the SandDance website.', - labelSnapshotsShortcut: 'Tip: Your .snapshots JSON file can also be pre-loaded with this', - labelShare: 'share', - labelLink: 'link', - labelLinkDescription: 'A URL to revive this snapshot.', - labelUrl: 'Url', - labelDataFormat: 'Data format', - labelDataUrlShortcut: 'Tip: Your data file can also be pre-loaded with this', - urlInputPlaceholder: 'paste URL', - sampleDataPrefix: 'Sample data', - localFilePrefix: 'Local file', - urlPrefix: 'Url', - errorInvalidFileFormat: 'Invalid file format', - errorNoUrl: 'Please enter a url', - errorUrlHttp: 'Url must begin with "http"', - errorDownloadFailure: 'Data could not be prepared for download.', - errorDataSourceFromLocal: (ds)=>`Could not load ${ds.type} from local file.`, - errorDataSourceFromUrl: (ds)=>`Could not load ${ds.type} from ${ds.dataUrl}` -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c7hj5":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "invalidUrlError", ()=>invalidUrlError); -var _language = require("./language"); -function invalidUrlError(url) { - if (!url) return (0, _language.strings).errorNoUrl; - if (url.toLocaleLowerCase().substr(0, 4) !== 'http') return (0, _language.strings).errorUrlHttp; -} - -},{"./language":"ieP7V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hRClM":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "downloadData", ()=>downloadData); -function downloadData(data, fileName) { - // Adapted from https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server - const a = document.createElement('a'); - a.setAttribute('download', fileName); - document.body.appendChild(a); - const blob = dataURIToBlob(data); - a.href = URL.createObjectURL(blob); - // we must revoke the object URL, - // since we can't know when the download occured, we have to attach it on the click handler.. - a.onclick = ()=>{ - // ..and to wait a frame - requestAnimationFrame(()=>URL.revokeObjectURL(a.href)); - document.body.removeChild(a); - }; - a.click(); -} -//from https://stackoverflow.com/a/37151835/620501 -function dataURIToBlob(binStr) { - const len = binStr.length, arr = new Uint8Array(len); - for(let i = 0; i < len; i++)arr[i] = binStr.charCodeAt(i); - return new Blob([ - arr - ]); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"EBWBP":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cleanSnapshots", ()=>cleanSnapshots); -parcelHelpers.export(exports, "downloadSnapshotsJSON", ()=>downloadSnapshotsJSON); -parcelHelpers.export(exports, "serializeSnapshot", ()=>serializeSnapshot); -parcelHelpers.export(exports, "validSnapshots", ()=>validSnapshots); -parcelHelpers.export(exports, "SnapshotImportLocal", ()=>SnapshotImportLocal); -parcelHelpers.export(exports, "SnapshotImportRemote", ()=>SnapshotImportRemote); -parcelHelpers.export(exports, "SnapshotExport", ()=>SnapshotExport); -var _base = require("./base"); -var _download = require("./download"); -var _language = require("./language"); -var _url = require("./url"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -var util = (0, _sanddanceExplorer.SandDance).VegaMorphCharts.util; -function markdownImageLink(alt, imageUrl, link) { - return `[![${alt}](${imageUrl})](${link})`; -} -function cleanSnapshots(snapshots) { - //remove data sources from snapshots - const clean = util.clone(snapshots); - clean.forEach((snapshot)=>{ - if (snapshot.dataSource) delete snapshot.dataSource.snapshotsUrl; - }); - return clean; -} -function downloadSnapshotsJSON(snapshots, filename) { - //clean prior to exporting - const clean = cleanSnapshots(snapshots); - (0, _download.downloadData)(JSON.stringify(clean, null, 2), filename); -} -function serializeSnapshot(snapshotWithImage) { - const snapshot = util.clone(snapshotWithImage); - //remove the image data from the snapshot - delete snapshot.bgColor; - delete snapshot.image; - if (snapshot.dataSource) delete snapshot.dataSource.rawText; - return JSON.stringify(snapshot); -} -function isSnapshot(snapshot) { - return snapshot.insight && snapshot.title; -} -function validSnapshots(snapshots) { - if (Array.isArray(snapshots)) { - for(let i = 0; i < snapshots.length; i++){ - if (!isSnapshot(snapshots[i])) return false; + } + function getField$1(_) { + const f = _.field; + return (t) => t ? f(t) : NaN; + } + inherits(Impute, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), impute = getValue(_), field2 = getField$1(_), fName = accessorName(_.field), kName = accessorName(_.key), gNames = (_.groupby || []).map(accessorName), groups = partition$4(pulse2.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m2 = groups.domain.length, group2, value2, gVals, kVal, g, i, j, l, n, t; + for (g = 0, l = groups.length; g < l; ++g) { + group2 = groups[g]; + gVals = group2.values; + value2 = NaN; + for (j = 0; j < m2; ++j) { + if (group2[j] != null) continue; + kVal = groups.domain[j]; + t = { + _impute: true + }; + for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i]; + t[kName] = kVal; + t[fName] = Number.isNaN(value2) ? value2 = impute(group2, field2) : value2; + curr.push(ingest$1(t)); } - return true; + } + if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); + if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); + this.value = curr; + return out; } - return false; -} -class SnapshotImportLocal extends _react.Component { - constructor(props){ - super(props); - this.state = { - working: false - }; + }); + function partition$4(data2, groupby, key2, keyvals) { + var get2 = (f) => f(t), groups = [], domain2 = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group2, i, j, k, n, t; + domain2.forEach((k2, i2) => kMap[k2] = i2 + 1); + for (i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = key2(t); + j = kMap[k] || (kMap[k] = domain2.push(k)); + gKey = (gVals = groupby ? groupby.map(get2) : Empty$1) + ""; + if (!(group2 = gMap[gKey])) { + group2 = gMap[gKey] = []; + groups.push(group2); + group2.values = gVals; + } + group2[j - 1] = t; } - readFile(e) { - if (e.target.files) { - this.setState({ - working: true - }); - const file = e.target.files[0]; - const reader = new FileReader(); - reader.onload = ()=>{ - const rawText = reader.result; - let snapshots; - try { - snapshots = JSON.parse(rawText); - } catch (e) { - this.setState({ - fileFormatError: (0, _language.strings).errorInvalidFileFormat, - working: false - }); - } - //validate these are snapshots - if (validSnapshots(snapshots)) { - this.props.onImportSnapshot(snapshots); - this.setState({ - working: false - }); - this.props.onDismiss(); - } else this.setState({ - fileFormatError: (0, _language.strings).errorInvalidFileFormat, - working: false - }); - }; - reader.readAsText(file); - } + groups.domain = domain2; + return groups; + } + function JoinAggregate(params2) { + Aggregate$1.call(this, params2); + } + JoinAggregate.Definition = { + "type": "JoinAggregate", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "key", + "type": "field" + }] + }; + inherits(JoinAggregate, Aggregate$1, { + transform(_, pulse2) { + const aggr = this, mod = _.modified(); + let cells; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + cells = aggr.value = mod ? aggr.init(_) : {}; + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + cells = aggr.value = aggr.value || this.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + aggr.changes(); + pulse2.visit(pulse2.SOURCE, (t) => { + extend(t, cells[aggr.cellkey(t)].tuple); + }); + return pulse2.reflow(mod).modifies(this._outputs); + }, + changes() { + const adds = this._adds, mods = this._mods; + let i, n; + for (i = 0, n = this._alen; i < n; ++i) { + this.celltuple(adds[i]); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + this.celltuple(mods[i]); + mods[i] = null; + } + this._alen = this._mlen = 0; } - render() { - return _react.createElement("div", null, _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - hidden: false, - onDismiss: this.props.onDismiss, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleSnapshotsLocal, - subText: (0, _language.strings).dialogSubtextSnapshotsLocal + }); + function KDE(params2) { + Transform.call(this, null, params2); + } + KDE.Definition = { + "type": "KDE", + "metadata": { + "generates": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "cumulative", + "type": "boolean", + "default": false + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(KDE, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), bandwidth2 = _.bandwidth, method2 = _.cumulative ? "cdf" : "pdf", as = _.as || ["value", "density"], values2 = []; + let domain2 = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (_.resolve === "shared") { + if (!domain2) domain2 = extent(source2, _.field); + minsteps = maxsteps = _.steps || maxsteps; + } + groups.forEach((g) => { + const density2 = kde(g, bandwidth2)[method2], scale2 = _.counts ? g.length : 1, local = domain2 || extent(g); + sampleCurve(density2, local, minsteps, maxsteps).forEach((v) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; } - }, _react.createElement("section", null, _react.createElement("input", { - type: "file", - onChange: (e)=>this.readFile(e), - disabled: this.state.working - }), this.state.fileFormatError && _react.createElement("div", { - className: "error" - }, this.state.fileFormatError)))); - } -} -class SnapshotImportRemote extends _react.Component { - constructor(props){ - super(props); - this.state = { - working: false + t[as[0]] = v[0]; + t[as[1]] = v[1] * scale2; + values2.push(ingest$1(t)); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + function Key$1(params2) { + Operator.call(this, null, update$2, params2); + } + inherits(Key$1, Operator); + function update$2(_) { + return this.value && !_.modified() ? this.value : key(_.fields, _.flat); + } + function Load$1(params2) { + Transform.call(this, [], params2); + this._pending = null; + } + inherits(Load$1, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow; + if (this._pending) { + return output(this, pulse2, this._pending); + } + if (stop(_)) return pulse2.StopPropagation; + if (_.values) { + return output(this, pulse2, df.parse(_.values, _.format)); + } else if (_.async) { + const p = df.request(_.url, _.format).then((res) => { + this._pending = array$4(res.data); + return (df2) => df2.touch(this); + }); + return { + async: p }; + } else { + return df.request(_.url, _.format).then((res) => output(this, pulse2, array$4(res.data))); + } } - getUrlShortcut() { - const dataSource = util.clone(this.props.dataSource); - delete dataSource.snapshots; - dataSource.snapshotsUrl = this.state.url; - const dss = { - dataSource + }); + function stop(_) { + return _.modified("async") && !(_.modified("values") || _.modified("url") || _.modified("format")); + } + function output(op, pulse2, data2) { + data2.forEach(ingest$1); + const out = pulse2.fork(pulse2.NO_FIELDS & pulse2.NO_SOURCE); + out.rem = op.value; + op.value = out.source = out.add = data2; + op._pending = null; + if (out.rem.length) out.clean(true); + return out; + } + function Lookup(params2) { + Transform.call(this, {}, params2); + } + Lookup.Definition = { + "type": "Lookup", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "index", + "type": "index", + "params": [{ + "name": "from", + "type": "data", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }] + }, { + "name": "values", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true + }, { + "name": "default", + "default": null + }] + }; + inherits(Lookup, Transform, { + transform(_, pulse2) { + const keys2 = _.fields, index2 = _.index, values2 = _.values, defaultValue = _.default == null ? null : _.default, reset2 = _.modified(), n = keys2.length; + let flag2 = reset2 ? pulse2.SOURCE : pulse2.ADD, out = pulse2, as = _.as, set2, m2, mods; + if (values2) { + m2 = values2.length; + if (n > 1 && !as) { + error('Multi-field lookup requires explicit "as" parameter.'); + } + if (as && as.length !== n * m2) { + error('The "as" parameter has too few output field names.'); + } + as = as || values2.map(accessorName); + set2 = function(t) { + for (var i = 0, k = 0, j, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + if (v == null) for (j = 0; j < m2; ++j, ++k) t[as[k]] = defaultValue; + else for (j = 0; j < m2; ++j, ++k) t[as[k]] = values2[j](v); + } + }; + } else { + if (!as) { + error("Missing output field names."); + } + set2 = function(t) { + for (var i = 0, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + t[as[i]] = v == null ? defaultValue : v; + } }; - return '#' + JSON.stringify(dss); + } + if (reset2) { + out = pulse2.reflow(true); + } else { + mods = keys2.some((k) => pulse2.modified(k.fields)); + flag2 |= mods ? pulse2.MOD : 0; + } + pulse2.visit(flag2, set2); + return out.modifies(as); } - loadUrl() { - const urlError = (0, _url.invalidUrlError)(this.state.url); - if (urlError) return this.setState({ - urlError - }); - const { url } = this.state; - fetch(url).then((response)=>{ - if (response.status === 200) return response.json(); - else this.setState({ - urlError: response.statusText - }); - }).then((snapshots)=>{ - if (validSnapshots(snapshots)) { - this.props.onImportSnapshot(snapshots); - this.props.onSnapshotsUrl(url); - this.setState({ - working: false - }); - this.props.onDismiss(); - } else this.setState({ - fileFormatError: (0, _language.strings).errorInvalidFileFormat, - working: false - }); - }).catch((e)=>{ - this.setState({ - urlError: e - }); - }); + }); + function MultiExtent$1(params2) { + Operator.call(this, null, update$1, params2); + } + inherits(MultiExtent$1, Operator); + function update$1(_) { + if (this.value && !_.modified()) { + return this.value; + } + const ext = _.extents, n = ext.length; + let min2 = Infinity, max2 = -Infinity, i, e; + for (i = 0; i < n; ++i) { + e = ext[i]; + if (e[0] < min2) min2 = e[0]; + if (e[1] > max2) max2 = e[1]; + } + return [min2, max2]; + } + function MultiValues$1(params2) { + Operator.call(this, null, update, params2); + } + inherits(MultiValues$1, Operator); + function update(_) { + return this.value && !_.modified() ? this.value : _.values.reduce((data2, _2) => data2.concat(_2), []); + } + function Params$2(params2) { + Transform.call(this, null, params2); + } + inherits(Params$2, Transform, { + transform(_, pulse2) { + this.modified(_.modified()); + this.value = _; + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - render() { - let shortcut; - if (this.props.dataSource.dataSourceType !== 'local' && this.state.url && !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError) shortcut = this.getUrlShortcut(); - return _react.createElement("div", null, _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - hidden: false, - onDismiss: this.props.onDismiss, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleSnapshotsUrl - }, - buttons: [ - _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - disabled: !this.state.url || !!this.state.urlError, - key: 0, - onClick: (e)=>this.loadUrl(), - iconProps: { - iconName: 'CloudDownload' - }, - text: (0, _language.strings).dialogLoadButton - }) - ] - }, _react.createElement("section", null, _react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelUrl, - placeholder: (0, _language.strings).urlInputPlaceholder, - onKeyUp: (e)=>e.keyCode === 13 && this.loadUrl(), - onChange: (e, url)=>this.setState({ - url, - urlError: '' - }), - value: this.state.url, - disabled: this.state.working - }), this.state.urlError && _react.createElement("div", { - className: "error" - }, this.state.urlError)), this.props.dataSource.dataSourceType !== 'local' && _react.createElement("section", { - className: 'tip', - style: { - visibility: !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError ? 'visible' : 'hidden' - } - }, (0, _language.strings).labelSnapshotsShortcut, " ", _react.createElement("a", { - href: shortcut, - title: (0, _language.strings).labelLinkDescription, - "aria-label": (0, _language.strings).labelLinkDescription - }, (0, _language.strings).labelShare)))); - } -} -function SnapshotExport(props) { - return _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - hidden: false, - onDismiss: props.onDismiss, - dialogContentProps: { - className: `sanddance-dialog ${props.theme} sanddance-export`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleSnapshotsExport - } - }, _react.createElement("ul", null, _react.createElement("li", null, _react.createElement("strong", null, (0, _language.strings).labelSnapshotsExportHTMLTitle), _react.createElement("div", null, (0, _language.strings).labelSnapshotsExportHTMLDescription), _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - iconProps: { - iconName: 'Download' - }, - text: `${(0, _language.strings).buttonExport} ${(0, _language.strings).labelSnapshotsExportHTMLTitle}`, - onClick: (e)=>{ - const clean = cleanSnapshots(props.snapshots); - const html = (0, _sanddanceExplorer.getEmbedHTML)(props.explorer.state.dataContent.data, props.dataSource.displayName, clean); - (0, _download.downloadData)(html, `${props.dataSource.displayName}.html`); - } - })), _react.createElement("li", null, _react.createElement("strong", null, (0, _language.strings).labelSnapshotsExportMarkdownTitle), _react.createElement("div", null, (0, _language.strings).labelSnapshotsExportMarkdownDescription), _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - iconProps: { - iconName: 'Download' - }, - text: `${(0, _language.strings).buttonExport} ${(0, _language.strings).labelSnapshotsExportMarkdownTitle}`, - onClick: (e)=>{ - const sections = props.snapshots.map((snapshot)=>{ - const section = [ - `## ${snapshot.title}` - ]; - section.push(snapshot.description); - section.push('\n'); - const url = `${location.origin}/#${encodeURIComponent(serializeSnapshot(snapshot))}`; - section.push(markdownImageLink(snapshot.title, snapshot.image, url)); - return section.join('\n'); - }); - sections.unshift(`# ${props.dataSource.displayName}`); - (0, _download.downloadData)(sections.join('\n\n'), `${props.dataSource.displayName}.snapshots.md`); - } - })))); -} - -},{"./base":"4CyyC","./download":"hRClM","./language":"ieP7V","./url":"c7hj5","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"75mIL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>(0, _vegaDataflow.Dataflow)); -parcelHelpers.export(exports, "EventStream", ()=>(0, _vegaDataflow.EventStream)); -parcelHelpers.export(exports, "MultiPulse", ()=>(0, _vegaDataflow.MultiPulse)); -parcelHelpers.export(exports, "Operator", ()=>(0, _vegaDataflow.Operator)); -parcelHelpers.export(exports, "Parameters", ()=>(0, _vegaDataflow.Parameters)); -parcelHelpers.export(exports, "Pulse", ()=>(0, _vegaDataflow.Pulse)); -parcelHelpers.export(exports, "Transform", ()=>(0, _vegaDataflow.Transform)); -parcelHelpers.export(exports, "changeset", ()=>(0, _vegaDataflow.changeset)); -parcelHelpers.export(exports, "definition", ()=>(0, _vegaDataflow.definition)); -parcelHelpers.export(exports, "ingest", ()=>(0, _vegaDataflow.ingest)); -parcelHelpers.export(exports, "isTuple", ()=>(0, _vegaDataflow.isTuple)); -parcelHelpers.export(exports, "transform", ()=>(0, _vegaDataflow.transform)); -parcelHelpers.export(exports, "transforms", ()=>(0, _vegaDataflow.transforms)); -parcelHelpers.export(exports, "tupleid", ()=>(0, _vegaDataflow.tupleid)); -parcelHelpers.export(exports, "interpolate", ()=>(0, _vegaScale.interpolate)); -parcelHelpers.export(exports, "interpolateColors", ()=>(0, _vegaScale.interpolateColors)); -parcelHelpers.export(exports, "interpolateRange", ()=>(0, _vegaScale.interpolateRange)); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>(0, _vegaScale.quantizeInterpolator)); -parcelHelpers.export(exports, "scale", ()=>(0, _vegaScale.scale)); -parcelHelpers.export(exports, "scheme", ()=>(0, _vegaScale.scheme)); -parcelHelpers.export(exports, "projection", ()=>(0, _vegaProjection.projection)); -parcelHelpers.export(exports, "View", ()=>(0, _vegaView.View)); -parcelHelpers.export(exports, "defaultLocale", ()=>(0, _vegaFormat.defaultLocale)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _vegaFormat.numberFormatDefaultLocale)); -parcelHelpers.export(exports, "locale", ()=>(0, _vegaFormat.locale)); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>(0, _vegaFormat.resetDefaultLocale)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _vegaFormat.timeFormatDefaultLocale)); -parcelHelpers.export(exports, "expressionFunction", ()=>(0, _vegaFunctions.expressionFunction)); -parcelHelpers.export(exports, "parse", ()=>(0, _vegaParser.parse)); -parcelHelpers.export(exports, "runtimeContext", ()=>(0, _vegaRuntime.context)); -parcelHelpers.export(exports, "codegenExpression", ()=>(0, _vegaExpression.codegenExpression)); -parcelHelpers.export(exports, "parseExpression", ()=>(0, _vegaExpression.parseExpression)); -parcelHelpers.export(exports, "parseSelector", ()=>(0, _vegaEventSelector.parseSelector)); -parcelHelpers.export(exports, "version", ()=>version); -var _vegaUtil = require("vega-util"); -parcelHelpers.exportAll(_vegaUtil, exports); -var _vegaDataflow = require("vega-dataflow"); -var _vegaTransforms = require("vega-transforms"); -var _vegaViewTransforms = require("vega-view-transforms"); -var _vegaEncode = require("vega-encode"); -var _vegaGeo = require("vega-geo"); -var _vegaForce = require("vega-force"); -var _vegaHierarchy = require("vega-hierarchy"); -var _vegaLabel = require("vega-label"); -var _vegaRegression = require("vega-regression"); -var _vegaVoronoi = require("vega-voronoi"); -var _vegaWordcloud = require("vega-wordcloud"); -var _vegaCrossfilter = require("vega-crossfilter"); -var _vegaStatistics = require("vega-statistics"); -parcelHelpers.exportAll(_vegaStatistics, exports); -var _vegaTime = require("vega-time"); -parcelHelpers.exportAll(_vegaTime, exports); -var _vegaLoader = require("vega-loader"); -parcelHelpers.exportAll(_vegaLoader, exports); -var _vegaScenegraph = require("vega-scenegraph"); -parcelHelpers.exportAll(_vegaScenegraph, exports); -var _vegaScale = require("vega-scale"); -var _vegaProjection = require("vega-projection"); -var _vegaView = require("vega-view"); -var _vegaFormat = require("vega-format"); -var _vegaFunctions = require("vega-functions"); -var _vegaParser = require("vega-parser"); -var _vegaRuntime = require("vega-runtime"); -var _vegaExpression = require("vega-expression"); -var _vegaEventSelector = require("vega-event-selector"); -var version = "5.32.0"; -// -- Transforms ----- -(0, _vegaUtil.extend)((0, _vegaDataflow.transforms), _vegaTransforms, _vegaViewTransforms, _vegaEncode, _vegaGeo, _vegaForce, _vegaLabel, _vegaHierarchy, _vegaRegression, _vegaVoronoi, _vegaWordcloud, _vegaCrossfilter); - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","vega-transforms":"2YZ3v","vega-view-transforms":"hvqjl","vega-encode":"1JcF5","vega-geo":"5TaRi","vega-force":"7a0MQ","vega-hierarchy":"4Esn8","vega-label":"htBqA","vega-regression":"c1OiC","vega-voronoi":"g4ZwP","vega-wordcloud":"3Db9C","vega-crossfilter":"ipwtZ","vega-statistics":"4QSQj","vega-time":"kjkWX","vega-loader":"8kWcg","vega-scenegraph":"gJqm6","vega-scale":"gHN3E","vega-projection":"erWDs","vega-view":"15ELa","vega-format":"3VXXV","vega-functions":"6VJ1U","vega-parser":"4Bjyk","vega-runtime":"boQgz","vega-expression":"8Nghf","vega-event-selector":"b96Fh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f2ulH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Debug", ()=>Debug); -parcelHelpers.export(exports, "Error", ()=>Error$1); -parcelHelpers.export(exports, "Info", ()=>Info); -parcelHelpers.export(exports, "None", ()=>None); -parcelHelpers.export(exports, "Warn", ()=>Warn); -parcelHelpers.export(exports, "accessor", ()=>accessor); -parcelHelpers.export(exports, "accessorFields", ()=>accessorFields); -parcelHelpers.export(exports, "accessorName", ()=>accessorName); -parcelHelpers.export(exports, "array", ()=>array); -parcelHelpers.export(exports, "ascending", ()=>ascending); -parcelHelpers.export(exports, "clampRange", ()=>clampRange); -parcelHelpers.export(exports, "compare", ()=>compare); -parcelHelpers.export(exports, "constant", ()=>constant); -parcelHelpers.export(exports, "debounce", ()=>debounce); -parcelHelpers.export(exports, "error", ()=>error); -parcelHelpers.export(exports, "extend", ()=>extend); -parcelHelpers.export(exports, "extent", ()=>extent); -parcelHelpers.export(exports, "extentIndex", ()=>extentIndex); -parcelHelpers.export(exports, "falsy", ()=>falsy); -parcelHelpers.export(exports, "fastmap", ()=>fastmap); -parcelHelpers.export(exports, "field", ()=>field); -parcelHelpers.export(exports, "flush", ()=>flush); -parcelHelpers.export(exports, "hasOwnProperty", ()=>has); -parcelHelpers.export(exports, "id", ()=>id); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "inherits", ()=>inherits); -parcelHelpers.export(exports, "inrange", ()=>inrange); -parcelHelpers.export(exports, "isArray", ()=>isArray); -parcelHelpers.export(exports, "isBoolean", ()=>isBoolean); -parcelHelpers.export(exports, "isDate", ()=>isDate); -parcelHelpers.export(exports, "isFunction", ()=>isFunction); -parcelHelpers.export(exports, "isIterable", ()=>isIterable); -parcelHelpers.export(exports, "isNumber", ()=>isNumber); -parcelHelpers.export(exports, "isObject", ()=>isObject); -parcelHelpers.export(exports, "isRegExp", ()=>isRegExp); -parcelHelpers.export(exports, "isString", ()=>isString); -parcelHelpers.export(exports, "key", ()=>key); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "logger", ()=>logger); -parcelHelpers.export(exports, "lruCache", ()=>lruCache); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "mergeConfig", ()=>mergeConfig); -parcelHelpers.export(exports, "one", ()=>one); -parcelHelpers.export(exports, "pad", ()=>pad); -parcelHelpers.export(exports, "panLinear", ()=>panLinear); -parcelHelpers.export(exports, "panLog", ()=>panLog); -parcelHelpers.export(exports, "panPow", ()=>panPow); -parcelHelpers.export(exports, "panSymlog", ()=>panSymlog); -parcelHelpers.export(exports, "peek", ()=>peek); -parcelHelpers.export(exports, "quarter", ()=>quarter); -parcelHelpers.export(exports, "repeat", ()=>repeat); -parcelHelpers.export(exports, "span", ()=>span); -parcelHelpers.export(exports, "splitAccessPath", ()=>splitAccessPath); -parcelHelpers.export(exports, "stringValue", ()=>$); -parcelHelpers.export(exports, "toBoolean", ()=>toBoolean); -parcelHelpers.export(exports, "toDate", ()=>toDate); -parcelHelpers.export(exports, "toNumber", ()=>toNumber); -parcelHelpers.export(exports, "toSet", ()=>toSet); -parcelHelpers.export(exports, "toString", ()=>toString); -parcelHelpers.export(exports, "truncate", ()=>truncate); -parcelHelpers.export(exports, "truthy", ()=>truthy); -parcelHelpers.export(exports, "utcquarter", ()=>utcquarter); -parcelHelpers.export(exports, "visitArray", ()=>visitArray); -parcelHelpers.export(exports, "writeConfig", ()=>writeConfig); -parcelHelpers.export(exports, "zero", ()=>zero); -parcelHelpers.export(exports, "zoomLinear", ()=>zoomLinear); -parcelHelpers.export(exports, "zoomLog", ()=>zoomLog); -parcelHelpers.export(exports, "zoomPow", ()=>zoomPow); -parcelHelpers.export(exports, "zoomSymlog", ()=>zoomSymlog); -function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; -} -function accessorName(fn) { - return fn == null ? null : fn.fname; -} -function accessorFields(fn) { - return fn == null ? null : fn.fields; -} -function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); -} -const get1 = (field)=>function(obj) { - return obj[field]; - }; -const getN = (path)=>{ - const len = path.length; - return function(obj) { - for(let i = 0; i < len; ++i)obj = obj[path[i]]; - return obj; - }; -}; -function error(message) { - throw Error(message); -} -function splitAccessPath(p) { - const path = [], n = p.length; - let q = null, b = 0, s = '', i, j, c; - p = p + ''; - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; + }); + function Pivot(params2) { + Aggregate$1.call(this, params2); + } + Pivot.Definition = { + "type": "Pivot", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "value", + "type": "field", + "required": true + }, { + "name": "op", + "type": "enum", + "values": ValidAggregateOps, + "default": "sum" + }, { + "name": "limit", + "type": "number", + "default": 0 + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Pivot, Aggregate$1, { + _transform: Aggregate$1.prototype.transform, + transform(_, pulse2) { + return this._transform(aggregateParams(_, pulse2), pulse2); } - for(i = j = 0; j < n; ++j){ - c = p[j]; - if (c === '\\') { - s += p.substring(i, j++); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) continue; - else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) push(); - else i = j + 1; - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - if (j > i) { - j++; - push(); - } - return path; -} -function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [ - field - ], name || field); -} -const id = field('id'); -const identity = accessor((_)=>_, [], 'identity'); -const zero = accessor(()=>0, [], 'zero'); -const one = accessor(()=>1, [], 'one'); -const truthy = accessor(()=>true, [], 'true'); -const falsy = accessor(()=>false, [], 'false'); -function log$1(method, level, input) { - const args = [ - level - ].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console -} -const None = 0; -const Error$1 = 1; -const Warn = 2; -const Info = 3; -const Debug = 4; -function logger(_, method) { - let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1; - let level = _ || None; + }); + function aggregateParams(_, pulse2) { + const key2 = _.field, value2 = _.value, op = (_.op === "count" ? "__count__" : _.op) || "sum", fields = accessorFields(key2).concat(accessorFields(value2)), keys2 = pivotKeys(key2, _.limit || 0, pulse2); + if (pulse2.changed()) _.set("__pivot__", null, null, true); return { - level (_) { - if (arguments.length) { - level = +_; - return this; - } else return level; - }, - error () { - if (level >= Error$1) handler(method || 'error', 'ERROR', arguments); - return this; - }, - warn () { - if (level >= Warn) handler(method || 'warn', 'WARN', arguments); - return this; - }, - info () { - if (level >= Info) handler(method || 'log', 'INFO', arguments); - return this; - }, - debug () { - if (level >= Debug) handler(method || 'log', 'DEBUG', arguments); - return this; - } + key: _.key, + groupby: _.groupby, + ops: keys2.map(() => op), + fields: keys2.map((k) => get$4(k, key2, value2, fields)), + as: keys2.map((k) => k + ""), + modified: _.modified.bind(_) }; -} -var isArray = Array.isArray; -function isObject(_) { - return _ === Object(_); -} -const isLegalKey = (key)=>key !== '__proto__'; -function mergeConfig() { - for(var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++)configs[_key] = arguments[_key]; - return configs.reduce((out, source)=>{ - for(const key in source)if (key === 'signals') // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - const r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); - } - return out; - }, {}); -} -function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - let k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - for(k in value){ - if (recurse && (recurse === true || recurse[k])) writeConfig(o, k, value[k]); - else if (isLegalKey(k)) o[k] = value[k]; - } - } else output[key] = value; -} -function mergeNamed(a, b) { - if (a == null) return b; - const map = {}, out = []; - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - b.forEach(add); - a.forEach(add); - return out; -} -function peek(array) { - return array[array.length - 1]; -} -function toNumber(_) { - return _ == null || _ === '' ? null : +_; -} -const exp = (sign)=>(x)=>sign * Math.exp(x); -const log = (sign)=>(x)=>Math.log(sign * x); -const symlog = (c)=>(x)=>Math.sign(x) * Math.log1p(Math.abs(x / c)); -const symexp = (c)=>(x)=>Math.sign(x) * Math.expm1(Math.abs(x)) * c; -const pow = (exponent)=>(x)=>x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); -function pan(domain, delta, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), dd = (d1 - d0) * delta; - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; -} -function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); -} -function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log(sign), exp(sign)); -} -function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1 / exponent)); -} -function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); -} -function zoom(domain, anchor, scale, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; -} -function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); -} -function zoomLog(domain, anchor, scale) { - const sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log(sign), exp(sign)); -} -function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent)); -} -function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); -} -function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); -} -function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); -} -function array(_) { - return _ != null ? isArray(_) ? _ : [ - _ - ] : []; -} -/** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ function clampRange(range, min, max) { - let lo = range[0], hi = range[1], span; - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - return span >= max - min ? [ - min, - max - ] : [ - lo = Math.min(Math.max(lo, min), max - span), - lo + span - ]; -} -function isFunction(_) { - return typeof _ === 'function'; -} -const DESCENDING = 'descending'; -function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - const ord = [], get = [], fmap = {}, gen = opt.comparator || comparator; - array(fields).forEach((f, i)=>{ - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach((_)=>fmap[_] = 1); + } + function get$4(k, key2, value2, fields) { + return accessor((d2) => key2(d2) === k ? value2(d2) : NaN, fields, k + ""); + } + function pivotKeys(key2, limit, pulse2) { + const map2 = {}, list = []; + pulse2.visit(pulse2.SOURCE, (t) => { + const k = key2(t); + if (!map2[k]) { + map2[k] = 1; + list.push(k); + } }); - return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap)); -} -const ascending = (u, v)=>(u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; -const comparator = (fields, orders)=>fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); -const compare1 = (field, order)=>function(a, b) { - return ascending(field(a), field(b)) * order; - }; -const compareN = (fields, orders, n)=>{ - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while(c === 0 && ++i < n){ - f = fields[i]; - c = ascending(f(a), f(b)); - } - return c * orders[i]; - }; -}; -function constant(_) { - return isFunction(_) ? _ : ()=>_; -} -function debounce(delay, handler) { - let tid; - return (e)=>{ - if (tid) clearTimeout(tid); - tid = setTimeout(()=>(handler(e), tid = null), delay); - }; -} -function extend(_) { - for(let x, k, i = 1, len = arguments.length; i < len; ++i){ - x = arguments[i]; - for(k in x)_[k] = x[k]; - } - return _; -} -/** - * Return an array with minimum and maximum values, in the - * form [min, max]. Ignores null, undefined, and NaN values. - */ function extent(array, f) { - let i = 0, n, v, min, max; - if (array && (n = array.length)) { - if (f == null) { - // find first valid value - for(v = array[i]; i < n && (v == null || v !== v); v = array[++i]); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = array[i]; - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } else { - // find first valid value - for(v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = f(array[i]); - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } + list.sort(ascending$1); + return limit ? list.slice(0, limit) : list; + } + function PreFacet$1(params2) { + Facet$1.call(this, params2); + } + inherits(PreFacet$1, Facet$1, { + transform(_, pulse2) { + const flow = _.subflow, field2 = _.field, subflow = (t) => this.subflow(tupleid(t), flow, pulse2, t); + if (_.modified("field") || field2 && pulse2.modified(accessorFields(field2))) { + error("PreFacet does not support field modification."); + } + this.initTargets(); + if (field2) { + pulse2.visit(pulse2.MOD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.mod(_2)); + }); + pulse2.visit(pulse2.ADD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.add(ingest$1(_2))); + }); + pulse2.visit(pulse2.REM, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.rem(_2)); + }); + } else { + pulse2.visit(pulse2.MOD, (t) => subflow(t).mod(t)); + pulse2.visit(pulse2.ADD, (t) => subflow(t).add(t)); + pulse2.visit(pulse2.REM, (t) => subflow(t).rem(t)); + } + if (pulse2.clean()) { + pulse2.runAfter(() => this.clean()); + } + return pulse2; } - return [ - min, - max - ]; -} -function extentIndex(array, f) { - const n = array.length; - let i = -1, a, b, c, u, v; - if (f == null) { - while(++i < n){ - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while(++i < n){ - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } + }); + function Project(params2) { + Transform.call(this, null, params2); + } + Project.Definition = { + "type": "Project", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }] + }; + inherits(Project, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive2 = fields ? (s2, t) => project(s2, t, fields, as) : rederive; + let lut; + if (this.value) { + lut = this.value; + } else { + pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive2(t, ingest$1({})); + lut[tupleid(t)] = dt; + out.add.push(dt); + }); + pulse2.visit(pulse2.MOD, (t) => { + out.mod.push(derive2(t, lut[tupleid(t)])); + }); + return out; } - return [ - u, - v - ]; -} -function has(object, property) { - return Object.hasOwn(object, property); -} -const NULL = {}; -function fastmap(input) { - let obj = {}, test; - function has$1(key) { - return has(obj, key) && obj[key] !== NULL; - } - const map = { - size: 0, - empty: 0, - object: obj, - has: has$1, - get (key) { - return has$1(key) ? obj[key] : undefined; - }, - set (key, value) { - if (!has$1(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete (key) { - if (has$1(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear () { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test (_) { - if (arguments.length) { - test = _; - return map; - } else return test; - }, - clean () { - const next = {}; - let size = 0; - for(const key in obj){ - const value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = obj = next; - } - }; - if (input) Object.keys(input).forEach((key)=>{ - map.set(key, input[key]); - }); - return map; -} -function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - const t = +threshold; - let a = range[0], b = peek(range), l; - // swap endpoints if range is reversed - if (b < a) { - l = a; - a = b; - b = l; - } - // compare value to endpoints - l = Math.abs(value - a); - const r = Math.abs(b - value); - // adjust if value is within threshold distance of endpoint - return l < r && l <= t ? left : r <= t ? right : center; -} -function inherits(child, parent, members) { - const proto = child.prototype = Object.create(parent.prototype); - Object.defineProperty(proto, 'constructor', { - value: child, - writable: true, - enumerable: true, - configurable: true - }); - return extend(proto, members); -} -/** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ function inrange(value, range, left, right) { - let r0 = range[0], r1 = range[range.length - 1], t; - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1); -} -function isBoolean(_) { - return typeof _ === 'boolean'; -} -function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; -} -function isIterable(_) { - return _ && isFunction(_[Symbol.iterator]); -} -function isNumber(_) { - return typeof _ === 'number'; -} -function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; -} -function isString(_) { - return typeof _ === 'string'; -} -function key(fields, flat, opt) { - if (fields) fields = flat ? array(fields).map((f)=>f.replace(/\\(.)/g, '$1')) : array(fields); - const len = fields && fields.length, gen = opt && opt.get || getter, map = (f)=>gen(flat ? [ - f - ] : splitAccessPath(f)); - let fn; - if (!len) fn = function() { - return ''; - }; - else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { - return '' + get(_); - }; - } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while(++i < len)s += '|' + get[i](_); - return s; - }; + }); + function project(s2, t, fields, as) { + for (let i = 0, n = fields.length; i < n; ++i) { + t[as[i]] = fields[i](s2); } - return accessor(fn, fields, 'key'); -} -function lerp(array, frac) { - const lo = array[0], hi = peek(array), f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); -} -const DEFAULT_MAX_SIZE = 10000; -// adapted from https://github.com/dominictarr/hashlru/ (MIT License) -function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - let curr, prev, size; - const clear = ()=>{ - curr = {}; - prev = {}; - size = 0; - }; - const update = (key, value)=>{ - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return curr[key] = value; - }; - clear(); - return { - clear, - has: (key)=>has(curr, key) || has(prev, key), - get: (key)=>has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined, - set: (key, value)=>has(curr, key) ? curr[key] = value : update(key, value) - }; -} -function merge(compare, array0, array1, output) { - const n0 = array0.length, n1 = array1.length; - if (!n1) return array0; - if (!n0) return array1; - const merged = output || new array0.constructor(n0 + n1); - let i0 = 0, i1 = 0, i = 0; - for(; i0 < n0 && i1 < n1; ++i)merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; - for(; i0 < n0; ++i0, ++i)merged[i] = array0[i0]; - for(; i1 < n1; ++i1, ++i)merged[i] = array1[i1]; - return merged; -} -function repeat(str, reps) { - let s = ''; - while(--reps >= 0)s += str; - return s; -} -function pad(str, length, padchar, align) { - const c = padchar || ' ', s = str + '', n = length - s.length; - return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n); -} -/** - * Return the numerical span of an array: the difference between - * the last and first values. - */ function span(array) { - return array && peek(array) - array[0] || 0; -} -function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') : x; -} -function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; -} -const defaultParser = (_)=>isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); -function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); -} -function toString(_) { - return _ == null || _ === '' ? null : _ + ''; -} -function toSet(_) { - const s = {}, n = _.length; - for(let i = 0; i < n; ++i)s[_[i]] = true; - return s; -} -function truncate(str, length, align, ellipsis) { - const e = ellipsis != null ? ellipsis : '\u2026', s = str + '', n = s.length, l = Math.max(0, length - e.length); - return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; -} -function visitArray(array, filter, visitor) { - if (array) { - if (filter) { - const n = array.length; - for(let i = 0; i < n; ++i){ - const t = filter(array[i]); - if (t) visitor(t, i, array); - } - } else array.forEach(visitor); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cFRfY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>Dataflow); -parcelHelpers.export(exports, "EventStream", ()=>EventStream); -parcelHelpers.export(exports, "MultiPulse", ()=>MultiPulse); -parcelHelpers.export(exports, "Operator", ()=>Operator); -parcelHelpers.export(exports, "Parameters", ()=>Parameters); -parcelHelpers.export(exports, "Pulse", ()=>Pulse); -parcelHelpers.export(exports, "Transform", ()=>Transform); -parcelHelpers.export(exports, "UniqueList", ()=>UniqueList); -parcelHelpers.export(exports, "asyncCallback", ()=>asyncCallback); -parcelHelpers.export(exports, "changeset", ()=>changeset); -parcelHelpers.export(exports, "definition", ()=>definition); -parcelHelpers.export(exports, "derive", ()=>derive); -parcelHelpers.export(exports, "ingest", ()=>ingest$1); -parcelHelpers.export(exports, "isChangeSet", ()=>isChangeSet); -parcelHelpers.export(exports, "isTuple", ()=>isTuple); -parcelHelpers.export(exports, "rederive", ()=>rederive); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "stableCompare", ()=>stableCompare); -parcelHelpers.export(exports, "transform", ()=>transform); -parcelHelpers.export(exports, "transforms", ()=>transforms); -parcelHelpers.export(exports, "tupleid", ()=>tupleid); -var _vegaUtil = require("vega-util"); -var _vegaLoader = require("vega-loader"); -var _vegaFormat = require("vega-format"); -function UniqueList(idFunc) { - const $ = idFunc || (0, _vegaUtil.identity), list = [], ids = {}; - list.add = (_)=>{ - const id = $(_); - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - return list; - }; - list.remove = (_)=>{ - const id = $(_); - if (ids[id]) { - ids[id] = 0; - const idx = list.indexOf(_); - if (idx >= 0) list.splice(idx, 1); - } - return list; - }; - return list; -} -/** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ async function asyncCallback(df, callback) { - try { - await callback(df); - } catch (err) { - df.error(err); - } -} -const TUPLE_ID_KEY = Symbol('vega_id'); -let TUPLE_ID = 1; -/** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ function isTuple(t) { - return !!(t && tupleid(t)); -} -/** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ function tupleid(t) { - return t[TUPLE_ID_KEY]; -} -/** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ function setid(t, id) { - t[TUPLE_ID_KEY] = id; return t; -} -/** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ function ingest$1(datum) { - const t = datum === Object(datum) ? datum : { - data: datum - }; - return tupleid(t) ? t : setid(t, TUPLE_ID++); -} -/** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ function derive(t) { - return rederive(t, ingest$1({})); -} -/** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ function rederive(t, d) { - for(const k in t)d[k] = t[k]; - return d; -} -/** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ function replace(t, d) { - return setid(d, tupleid(t)); -} -/** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ function stableCompare(cmp, f) { - return !cmp ? null : f ? (a, b)=>cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b)=>cmp(a, b) || tupleid(a) - tupleid(b); -} -function isChangeSet(v) { - return v && v.constructor === changeset; -} -function changeset() { - const add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = []; // modify by predicate - let clean = null, reflow = false; - return { - constructor: changeset, - insert (t) { - const d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)add.push(d[i]); - return this; - }, - remove (t) { - const a = (0, _vegaUtil.isFunction)(t) ? remp : rem, d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)a.push(d[i]); - return this; - }, - modify (t, field, value) { - const m = { - field: field, - value: (0, _vegaUtil.constant)(value) - }; - if ((0, _vegaUtil.isFunction)(t)) { - m.filter = t; - modp.push(m); - } else { - m.tuple = t; - mod.push(m); - } - return this; - }, - encode (t, set) { - if ((0, _vegaUtil.isFunction)(t)) modp.push({ - filter: t, - field: set - }); - else mod.push({ - tuple: t, - field: set - }); - return this; - }, - clean (value) { - clean = value; - return this; - }, - reflow () { - reflow = true; - return this; - }, - pulse (pulse, tuples) { - const cur = {}, out = {}; - let i, n, m, f, t, id; - // build lookup table of current tuples - for(i = 0, n = tuples.length; i < n; ++i)cur[tupleid(tuples[i])] = 1; - // process individual tuples to remove - for(i = 0, n = rem.length; i < n; ++i){ - t = rem[i]; - cur[tupleid(t)] = -1; - } - // process predicate-based removals - for(i = 0, n = remp.length; i < n; ++i){ - f = remp[i]; - tuples.forEach((t)=>{ - if (f(t)) cur[tupleid(t)] = -1; - }); - } - // process all add tuples - for(i = 0, n = add.length; i < n; ++i){ - t = add[i]; - id = tupleid(t); - if (cur[id]) // tuple already resides in dataset - // if flagged for both add and remove, cancel - cur[id] = 1; - else // tuple does not reside in dataset, add - pulse.add.push(ingest$1(add[i])); - } - // populate pulse rem list - for(i = 0, n = tuples.length; i < n; ++i){ - t = tuples[i]; - if (cur[tupleid(t)] < 0) pulse.rem.push(t); - } - // modify helper method - function modify(t, f, v) { - if (v) t[f] = v(t); - else pulse.encode = f; - if (!reflow) out[tupleid(t)] = t; - } - // process individual tuples to modify - for(i = 0, n = mod.length; i < n; ++i){ - m = mod[i]; - t = m.tuple; - f = m.field; - id = cur[tupleid(t)]; - if (id > 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - // process predicate-based modifications - for(i = 0, n = modp.length; i < n; ++i){ - m = modp[i]; - f = m.filter; - tuples.forEach((t)=>{ - if (f(t) && cur[tupleid(t)] > 0) modify(t, m.field, m.value); - }); - pulse.modifies(m.field); - } - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) pulse.mod = rem.length || remp.length ? tuples.filter((t)=>cur[tupleid(t)] > 0) : tuples.slice(); - else for(id in out)pulse.mod.push(out[id]); - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) pulse.clean(true); - return pulse; - } - }; -} -const CACHE = '_:mod:_'; -/** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ function Parameters() { - Object.defineProperty(this, CACHE, { - writable: true, - value: {} - }); -} -Parameters.prototype = { - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ set (name, index, value, force) { - const o = this, v = o[name], mod = o[CACHE]; - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = (0, _vegaUtil.isArray)(value) ? 1 + value.length : -1; - } - return o; + } + function Proxy$1(params2) { + Transform.call(this, null, params2); + } + inherits(Proxy$1, Transform, { + transform(_, pulse2) { + this.value = _.value; + return _.modified("value") ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; + } + }); + function Quantile$1(params2) { + Transform.call(this, null, params2); + } + Quantile$1.Definition = { + "type": "Quantile", + "metadata": { + "generates": true, + "changes": true }, - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ modified (name, index) { - const mod = this[CACHE]; - if (!arguments.length) { - for(const k in mod){ - if (mod[k]) return true; - } - return false; - } else if ((0, _vegaUtil.isArray)(name)) { - for(let k = 0; k < name.length; ++k){ - if (mod[name[k]]) return true; - } - return false; + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "probs", + "type": "number", + "array": true + }, { + "name": "step", + "type": "number", + "default": 0.01 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["prob", "value"] + }] + }; + const EPSILON$2 = 1e-14; + inherits(Quantile$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), as = _.as || ["prob", "value"]; + if (this.value && !_.modified() && !pulse2.changed()) { + out.source = this.value; + return out; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), values2 = [], step = _.step || 0.01, p = _.probs || range$3(step / 2, 1 - EPSILON$2, step), n = p.length; + groups.forEach((g) => { + const q = quantiles(g, p); + for (let i = 0; i < n; ++i) { + const t = {}; + for (let i2 = 0; i2 < names.length; ++i2) { + t[names[i2]] = g.dims[i2]; + } + t[as[0]] = p[i]; + t[as[1]] = q[i]; + values2.push(ingest$1(t)); } - return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name]; - }, - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ clear () { - this[CACHE] = {}; - return this; + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + return out; } -}; -let OP_ID = 0; -const PULSE = 'pulse', NO_PARAMS = new Parameters(); -// Boolean Flags -const SKIP$1 = 1, MODIFIED = 2; -/** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - if (update) this._update = update; - if (params) this.parameters(params, react); -} -function flag(bit) { - return function(state) { - const f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? f | bit : f & ~bit; - return this; - }; -} -Operator.prototype = { - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); - }, - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ set (value) { - if (this.value !== value) { - this.value = value; - return 1; - } else return 0; - }, - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ skip: flag(SKIP$1), - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ modified: flag(MODIFIED), - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initial evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ parameters (params, react, initonly) { - react = react !== false; - const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; - let name, value, n, i; - const add = (name, index, value)=>{ - if (value instanceof Operator) { - if (value !== this) { - if (react) value.targets().add(this); - deps.push(value); - } - argops.push({ - op: value, - name: name, - index: index - }); - } else argval.set(name, index, value); - }; - for(name in params){ - value = params[name]; - if (name === PULSE) { - (0, _vegaUtil.array)(value).forEach((op)=>{ - if (!(op instanceof Operator)) (0, _vegaUtil.error)('Pulse parameters must be operator instances.'); - else if (op !== this) { - op.targets().add(this); - deps.push(op); - } - }); - this.source = value; - } else if ((0, _vegaUtil.isArray)(value)) { - argval.set(name, -1, Array(n = value.length)); - for(i = 0; i < n; ++i)add(name, i, value[i]); - } else add(name, -1, value); - } - this.marshall().clear(); // initialize values - if (initonly) argops.initonly = true; - return deps; - }, - /** - * Internal method for marshalling parameter values. - * Visits each operator dependency to pull the latest value. - * @return {Parameters} A Parameters object to pass to the update function. - */ marshall (stamp) { - const argval = this._argval || NO_PARAMS, argops = this._argops; - let item, i, op, mod; - if (argops) { - const n = argops.length; - for(i = 0; i < n; ++i){ - item = argops[i]; - op = item.op; - mod = op.modified() && op.stamp === stamp; - argval.set(item.name, item.index, op.value, mod); - } - if (argops.initonly) { - for(i = 0; i < n; ++i){ - item = argops[i]; - item.op.targets().remove(this); - } - this._argops = null; - this._update = null; - } + }); + function Relay$1(params2) { + Transform.call(this, null, params2); + } + inherits(Relay$1, Transform, { + transform(_, pulse2) { + let out, lut; + if (this.value) { + lut = this.value; + } else { + out = pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + if (_.derive) { + out = pulse2.fork(pulse2.NO_SOURCE); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive(t); + lut[tupleid(t)] = dt; + out.add.push(dt); + }); + pulse2.visit(pulse2.MOD, (t) => { + const dt = lut[tupleid(t)]; + for (const k in t) { + dt[k] = t[k]; + out.modifies(k); + } + out.mod.push(dt); + }); + } + return out; + } + }); + function Sample(params2) { + Transform.call(this, [], params2); + this.count = 0; + } + Sample.Definition = { + "type": "Sample", + "metadata": {}, + "params": [{ + "name": "size", + "type": "number", + "default": 1e3 + }] + }; + inherits(Sample, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), mod = _.modified("size"), num = _.size, map2 = this.value.reduce((m2, t) => (m2[tupleid(t)] = 1, m2), {}); + let res = this.value, cnt = this.count, cap = 0; + function update2(t) { + let p, idx; + if (res.length < num) { + res.push(t); + } else { + idx = ~~((cnt + 1) * random()); + if (idx < res.length && idx >= cap) { + p = res[idx]; + if (map2[tupleid(p)]) out.rem.push(p); + res[idx] = t; + } + } + ++cnt; + } + if (pulse2.rem.length) { + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (map2[id2]) { + map2[id2] = -1; + out.rem.push(t); + } + --cnt; + }); + res = res.filter((t) => map2[tupleid(t)] !== -1); + } + if ((pulse2.rem.length || mod) && res.length < num && pulse2.source) { + cap = cnt = res.length; + pulse2.visit(pulse2.SOURCE, (t) => { + if (!map2[tupleid(t)]) update2(t); + }); + cap = -1; + } + if (mod && res.length > num) { + const n = res.length - num; + for (let i = 0; i < n; ++i) { + map2[tupleid(res[i])] = -1; + out.rem.push(res[i]); } - return argval; + res = res.slice(n); + } + if (pulse2.mod.length) { + pulse2.visit(pulse2.MOD, (t) => { + if (map2[tupleid(t)]) out.mod.push(t); + }); + } + if (pulse2.add.length) { + pulse2.visit(pulse2.ADD, update2); + } + if (pulse2.add.length || cap < 0) { + out.add = res.filter((t) => !map2[tupleid(t)]); + } + this.count = cnt; + this.value = out.source = res; + return out; + } + }); + function Sequence(params2) { + Transform.call(this, null, params2); + } + Sequence.Definition = { + "type": "Sequence", + "metadata": { + "generates": true, + "changes": true }, - /** - * Detach this operator from the dataflow. - * Unregisters listeners on upstream dependencies. - */ detach () { - const argops = this._argops; - let i, n, item, op; - if (argops) for(i = 0, n = argops.length; i < n; ++i){ - item = argops[i]; - op = item.op; - if (op._targets) op._targets.remove(this); - } - // remove references to the source and pulse object, - // if present, to prevent memory leaks of old data. - this.pulse = null; - this.source = null; + "params": [{ + "name": "start", + "type": "number", + "required": true + }, { + "name": "stop", + "type": "number", + "required": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "as", + "type": "string", + "default": "data" + }] + }; + inherits(Sequence, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) return; + const out = pulse2.materialize().fork(pulse2.MOD), as = _.as || "data"; + out.rem = this.value ? pulse2.rem.concat(this.value) : pulse2.rem; + this.value = range$3(_.start, _.stop, _.step || 1).map((v) => { + const t = {}; + t[as] = v; + return ingest$1(t); + }); + out.add = pulse2.add.concat(this.value); + return out; + } + }); + function Sieve$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Sieve$1, Transform, { + transform(_, pulse2) { + this.value = pulse2.source; + return pulse2.changed() ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; + } + }); + function TimeUnit(params2) { + Transform.call(this, null, params2); + } + const OUTPUT = ["unit0", "unit1"]; + TimeUnit.Definition = { + "type": "TimeUnit", + "metadata": { + "modifies": true }, - /** - * Delegate method to perform operator processing. - * Subclasses can override this method to perform custom processing. - * By default, it marshalls parameters and calls the update function - * if that function is defined. If the update function does not - * change the operator value then StopPropagation is returned. - * If no update function is defined, this method does nothing. - * @param {Pulse} pulse - the current dataflow pulse. - * @return The output pulse or StopPropagation. A falsy return value - * (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const update = this._update; - if (update) { - const params = this.marshall(pulse.stamp), v = update.call(this, params, pulse); - params.clear(); - if (v !== this.value) this.value = v; - else if (!this.modified()) return pulse.StopPropagation; + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "units", + "type": "enum", + "values": TIME_UNITS, + "array": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "maxbins", + "type": "number", + "default": 40 + }, { + "name": "extent", + "type": "date", + "array": true + }, { + "name": "timezone", + "type": "enum", + "default": "local", + "values": ["local", "utc"] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": OUTPUT + }] + }; + inherits(TimeUnit, Transform, { + transform(_, pulse2) { + const field2 = _.field, band2 = _.interval !== false, utc = _.timezone === "utc", floor2 = this._floor(_, pulse2), offset2 = (utc ? utcInterval : timeInterval)(floor2.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor2.step; + let min2 = floor2.start || Infinity, max2 = floor2.stop || -Infinity, flag2 = pulse2.ADD; + if (_.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(field2))) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(flag2, (t) => { + const v = field2(t); + let a2, b2; + if (v == null) { + t[u0] = null; + if (band2) t[u1] = null; + } else { + t[u0] = a2 = b2 = floor2(v); + if (band2) t[u1] = b2 = offset2(a2, step); + if (a2 < min2) min2 = a2; + if (b2 > max2) max2 = b2; } + }); + floor2.start = min2; + floor2.stop = max2; + return pulse2.modifies(band2 ? as : u0); }, - /** - * Run this operator for the current pulse. If this operator has already - * been run at (or after) the pulse timestamp, returns StopPropagation. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) { - this.skip(false); - rv = 0; - } else rv = this.evaluate(pulse); - return this.pulse = rv || pulse; - } -}; -/** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ function add(init, update, params, react) { - let shift = 1, op; - if (init instanceof Operator) op = init; - else if (init && init.prototype instanceof Operator) op = new init(); - else if ((0, _vegaUtil.isFunction)(init)) op = new Operator(null, init); - else { - shift = 0; - op = new Operator(init, update); + _floor(_, pulse2) { + const utc = _.timezone === "utc"; + const { + units, + step + } = _.units ? { + units: _.units, + step: _.step || 1 + } : bin$1({ + extent: _.extent || extent(pulse2.materialize(pulse2.SOURCE).source, _.field), + maxbins: _.maxbins + }); + const tunits = timeUnits(units), prev = this.value || {}, floor2 = (utc ? utcFloor : timeFloor)(tunits, step); + floor2.unit = peek$1(tunits); + floor2.units = tunits; + floor2.step = step; + floor2.start = prev.start; + floor2.stop = prev.stop; + return this.value = floor2; } - this.rank(op); - if (shift) { - react = params; - params = update; + }); + function TupleIndex(params2) { + Transform.call(this, fastmap(), params2); + } + inherits(TupleIndex, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, field2 = _.field, index2 = this.value, set2 = (t) => index2.set(field2(t), t); + let mod = true; + if (_.modified("field") || pulse2.modified(field2.fields)) { + index2.clear(); + pulse2.visit(pulse2.SOURCE, set2); + } else if (pulse2.changed()) { + pulse2.visit(pulse2.REM, (t) => index2.delete(field2(t))); + pulse2.visit(pulse2.ADD, set2); + } else { + mod = false; + } + this.modified(mod); + if (index2.empty > df.cleanThreshold) df.runAfter(index2.clean); + return pulse2.fork(); } - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - return op; -} -/** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array<Operator>} - The source operators that should propagate - * to the target operator. - */ function connect(target, sources) { - const targetRank = target.rank, n = sources.length; - for(let i = 0; i < n; ++i)if (targetRank < sources[i].rank) { - this.rerank(target); - return; + }); + function Values$1(params2) { + Transform.call(this, null, params2); + } + inherits(Values$1, Transform, { + transform(_, pulse2) { + const run2 = !this.value || _.modified("field") || _.modified("sort") || pulse2.changed() || _.sort && pulse2.modified(_.sort.fields); + if (run2) { + this.value = (_.sort ? pulse2.source.slice().sort(stableCompare(_.sort)) : pulse2.source).map(_.field); + } } -} -let STREAM_ID = 0; -/** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; -} -/** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); -} -EventStream.prototype = { - _filter: (0, _vegaUtil.truthy), - _apply: (0, _vegaUtil.identity), - targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); + }); + function WindowOp(op, field2, param2, as) { + const fn2 = WindowOps[op](field2, param2); + return { + init: fn2.init || zero$1, + update: function(w2, t) { + t[as] = fn2.next(w2); + } + }; + } + const WindowOps = { + row_number: function() { + return { + next: (w2) => w2.index + 1 + }; }, - consume (_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; + rank: function() { + let rank2; + return { + init: () => rank2 = 1, + next: (w2) => { + const i = w2.index, data2 = w2.data; + return i && w2.compare(data2[i - 1], data2[i]) ? rank2 = i + 1 : rank2; + } + }; }, - receive (evt) { - if (this._filter(evt)) { - const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; - for(let i = 0; i < n; ++i)trg[i].receive(val); - if (this._consume) { - evt.preventDefault(); - evt.stopPropagation(); - } - } + dense_rank: function() { + let drank; + return { + init: () => drank = 1, + next: (w2) => { + const i = w2.index, d2 = w2.data; + return i && w2.compare(d2[i - 1], d2[i]) ? ++drank : drank; + } + }; + }, + percent_rank: function() { + const rank2 = WindowOps.rank(), next = rank2.next; + return { + init: rank2.init, + next: (w2) => (next(w2) - 1) / (w2.data.length - 1) + }; }, - filter (filter) { - const s = stream(filter); - this.targets().add(s); - return s; + cume_dist: function() { + let cume; + return { + init: () => cume = 0, + next: (w2) => { + const d2 = w2.data, c2 = w2.compare; + let i = w2.index; + if (cume < i) { + while (i + 1 < d2.length && !c2(d2[i], d2[i + 1])) ++i; + cume = i; + } + return (1 + cume) / d2.length; + } + }; }, - apply (apply) { - const s = stream(null, apply); - this.targets().add(s); - return s; + ntile: function(field2, num) { + num = +num; + if (!(num > 0)) error("ntile num must be greater than zero."); + const cume = WindowOps.cume_dist(), next = cume.next; + return { + init: cume.init, + next: (w2) => Math.ceil(num * next(w2)) + }; }, - merge () { - const s = stream(); - this.targets().add(s); - for(let i = 0, n = arguments.length; i < n; ++i)arguments[i].targets().add(s); - return s; + lag: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index - offset2; + return i >= 0 ? field2(w2.data[i]) : null; + } + }; }, - throttle (pause) { - let t = -1; - return this.filter(()=>{ - const now = Date.now(); - if (now - t > pause) { - t = now; - return 1; - } else return 0; - }); + lead: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index + offset2, d2 = w2.data; + return i < d2.length ? field2(d2[i]) : null; + } + }; }, - debounce (delay) { - const s = stream(); - this.targets().add(stream(null, null, (0, _vegaUtil.debounce)(delay, (e)=>{ - const df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }))); - return s; + first_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i0]) + }; }, - between (a, b) { - let active = false; - a.targets().add(stream(null, null, ()=>active = true)); - b.targets().add(stream(null, null, ()=>active = false)); - return this.filter(()=>active); + last_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i1 - 1]) + }; }, - detach () { - // ensures compatibility with operators (#2753) - // remove references to other streams and filter functions that may - // be bound to subcontexts that need to be garbage collected. - this._filter = (0, _vegaUtil.truthy); - this._targets = null; - } -}; -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ function events(source, type, filter, apply) { - const df = this, s = stream(filter, apply), send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally{ - df.run(); + nth_value: function(field2, nth) { + nth = +nth; + if (!(nth > 0)) error("nth_value nth must be greater than zero."); + return { + next: (w2) => { + const i = w2.i0 + (nth - 1); + return i < w2.i1 ? field2(w2.data[i]) : null; + } + }; + }, + prev_value: function(field2) { + let prev; + return { + init: () => prev = null, + next: (w2) => { + const v = field2(w2.data[w2.index]); + return v != null ? prev = v : prev; + } + }; + }, + next_value: function(field2) { + let v, i; + return { + init: () => (v = null, i = -1), + next: (w2) => { + const d2 = w2.data; + return w2.index <= i ? v : (i = find$2(field2, d2, w2.index)) < 0 ? (i = d2.length, v = null) : v = field2(d2[i]); } + }; + } + }; + function find$2(field2, data2, index2) { + for (let n = data2.length; index2 < n; ++index2) { + const v = field2(data2[index2]); + if (v != null) return index2; + } + return -1; + } + const ValidWindowOps = Object.keys(WindowOps); + function WindowState(_) { + const ops2 = array$4(_.ops), fields = array$4(_.fields), params2 = array$4(_.params), aggregate_params = array$4(_.aggregate_params), as = array$4(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map2 = {}, counts = [], measures = []; + let countOnly = true; + function visitInputs(f) { + array$4(accessorFields(f)).forEach((_2) => inputs[_2] = 1); + } + visitInputs(_.sort); + ops2.forEach((op, i) => { + const field2 = fields[i], param2 = params2[i], aggregate_param = aggregate_params[i] || null, mname = accessorName(field2), name = measureName(op, mname, as[i]); + visitInputs(field2); + outputs.push(name); + if (has$1(WindowOps, op)) { + windows.push(WindowOp(op, field2, param2, name)); + } else { + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + if (op === "count") { + counts.push(name); + return; + } + countOnly = false; + let m2 = map2[mname]; + if (!m2) { + m2 = map2[mname] = []; + m2.field = field2; + measures.push(m2); + } + m2.push(createMeasure(op, aggregate_param, name)); + } + }); + if (counts.length || measures.length) { + this.cell = cell(measures, counts, countOnly); + } + this.inputs = Object.keys(inputs); + } + const prototype = WindowState.prototype; + prototype.init = function() { + this.windows.forEach((_) => _.init()); + if (this.cell) this.cell.init(); + }; + prototype.update = function(w2, t) { + const cell2 = this.cell, wind = this.windows, data2 = w2.data, m2 = wind && wind.length; + let j; + if (cell2) { + for (j = w2.p0; j < w2.i0; ++j) cell2.rem(data2[j]); + for (j = w2.p1; j < w2.i1; ++j) cell2.add(data2[j]); + cell2.set(t); + } + for (j = 0; j < m2; ++j) wind[j].update(w2, t); + }; + function cell(measures, counts, countOnly) { + measures = measures.map((m2) => compileMeasures(m2, m2.field)); + const cell2 = { + num: 0, + agg: null, + store: false, + count: counts }; - let sources; - if (typeof source === 'string' && typeof document !== 'undefined') sources = document.querySelectorAll(source); - else sources = (0, _vegaUtil.array)(source); - const n = sources.length; - for(let i = 0; i < n; ++i)sources[i].addEventListener(type, send); - return s; -} -function parse(data, format) { - const locale = this.locale(); - return (0, _vegaLoader.read)(data, format, locale.timeParse, locale.utcParse); -} -/** - * Ingests new data into the dataflow. First parses the data using the - * vega-loader read method, then pulses a changeset to the target operator. - * @param {Operator} target - The Operator to target with ingested data, - * typically a Collect transform instance. - * @param {*} data - The input data, prior to parsing. For JSON this may - * be a string or an object. For CSV, TSV, etc should be a string. - * @param {object} format - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @returns {Dataflow} - */ function ingest(target, data, format) { - data = this.parse(data, format); - return this.pulse(target, this.changeset().insert(data)); -} -/** - * Request data from an external source, parse it, and return a Promise. - * @param {string} url - The URL from which to load the data. This string - * is passed to the vega-loader load method. - * @param {object} [format] - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @return {Promise} A Promise that resolves upon completion of the request. - * The resolved object contains the following properties: - * - data: an array of parsed data (or null upon error) - * - status: a code for success (0), load fail (-1), or parse fail (-2) - */ async function request(url, format) { - const df = this; - let status = 0, data; - try { - data = await df.loader().load(url, { - context: 'dataflow', - response: (0, _vegaLoader.responseType)(format && format.type) - }); - try { - data = df.parse(data, format); - } catch (err) { - status = -2; - df.warn('Data ingestion failed', url, err); - } - } catch (err) { - status = -1; - df.warn('Loading failed', url, err); + if (!countOnly) { + var n = measures.length, a2 = cell2.agg = Array(n), i = 0; + for (; i < n; ++i) a2[i] = new measures[i](cell2); + } + if (cell2.store) { + var store = cell2.data = new TupleStore(); + } + cell2.add = function(t) { + cell2.num += 1; + if (countOnly) return; + if (store) store.add(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].add(a2[i2].get(t), t); + } + }; + cell2.rem = function(t) { + cell2.num -= 1; + if (countOnly) return; + if (store) store.rem(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].rem(a2[i2].get(t), t); + } + }; + cell2.set = function(t) { + let i2, n2; + if (store) store.values(); + for (i2 = 0, n2 = counts.length; i2 < n2; ++i2) t[counts[i2]] = cell2.num; + if (!countOnly) for (i2 = 0, n2 = a2.length; i2 < n2; ++i2) a2[i2].set(t); + }; + cell2.init = function() { + cell2.num = 0; + if (store) store.reset(); + for (let i2 = 0; i2 < n; ++i2) a2[i2].init(); + }; + return cell2; + } + function Window(params2) { + Transform.call(this, {}, params2); + this._mlen = 0; + this._mods = []; + } + Window.Definition = { + "type": "Window", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidWindowOps.concat(ValidAggregateOps) + }, { + "name": "params", + "type": "number", + "null": true, + "array": true + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "frame", + "type": "number", + "null": true, + "array": true, + "length": 2, + "default": [null, 0] + }, { + "name": "ignorePeers", + "type": "boolean", + "default": false + }] + }; + inherits(Window, Transform, { + transform(_, pulse2) { + this.stamp = pulse2.stamp; + const mod = _.modified(), cmp = stableCompare(_.sort), key2 = groupkey(_.groupby), group2 = (t) => this.group(key2(t)); + let state = this.state; + if (!state || mod) { + state = this.state = new WindowState(_); + } + if (mod || pulse2.modified(state.inputs)) { + this.value = {}; + pulse2.visit(pulse2.SOURCE, (t) => group2(t).add(t)); + } else { + pulse2.visit(pulse2.REM, (t) => group2(t).remove(t)); + pulse2.visit(pulse2.ADD, (t) => group2(t).add(t)); + } + for (let i = 0, n = this._mlen; i < n; ++i) { + processPartition(this._mods[i], state, cmp, _); + } + this._mlen = 0; + this._mods = []; + return pulse2.reflow(mod).modifies(state.outputs); + }, + group(key2) { + let group2 = this.value[key2]; + if (!group2) { + group2 = this.value[key2] = SortedList(tupleid); + group2.stamp = -1; + } + if (group2.stamp < this.stamp) { + group2.stamp = this.stamp; + this._mods[this._mlen++] = group2; + } + return group2; + } + }); + function processPartition(list, state, cmp, _) { + const sort2 = _.sort, range2 = sort2 && !_.ignorePeers, frame2 = _.frame || [null, 0], data2 = list.data(cmp), n = data2.length, b2 = range2 ? bisector(sort2) : null, w2 = { + i0: 0, + i1: 0, + p0: 0, + p1: 0, + index: 0, + data: data2, + compare: sort2 || constant$4(-1) + }; + state.init(); + for (let i = 0; i < n; ++i) { + setWindow(w2, frame2, i, n); + if (range2) adjustRange(w2, b2); + state.update(w2, data2[i]); + } + } + function setWindow(w2, f, i, n) { + w2.p0 = w2.i0; + w2.p1 = w2.i1; + w2.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); + w2.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); + w2.index = i; + } + function adjustRange(w2, bisect2) { + const r0 = w2.i0, r1 = w2.i1 - 1, c2 = w2.compare, d2 = w2.data, n = d2.length - 1; + if (r0 > 0 && !c2(d2[r0], d2[r0 - 1])) w2.i0 = bisect2.left(d2, d2[r0]); + if (r1 < n && !c2(d2[r1], d2[r1 + 1])) w2.i1 = bisect2.right(d2, d2[r1]); + } + const tx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + aggregate: Aggregate$1, + bin: Bin, + collect: Collect$1, + compare: Compare$1, + countpattern: CountPattern, + cross: Cross, + density: Density, + dotbin: DotBin, + expression: Expression$1, + extent: Extent, + facet: Facet$1, + field: Field$1, + filter: Filter, + flatten: Flatten, + fold: Fold, + formula: Formula, + generate: Generate, + impute: Impute, + joinaggregate: JoinAggregate, + kde: KDE, + key: Key$1, + load: Load$1, + lookup: Lookup, + multiextent: MultiExtent$1, + multivalues: MultiValues$1, + params: Params$2, + pivot: Pivot, + prefacet: PreFacet$1, + project: Project, + proxy: Proxy$1, + quantile: Quantile$1, + relay: Relay$1, + sample: Sample, + sequence: Sequence, + sieve: Sieve$1, + subflow: Subflow, + timeunit: TimeUnit, + tupleindex: TupleIndex, + values: Values$1, + window: Window + }, Symbol.toStringTag, { value: "Module" })); + function constant$2(x2) { + return function constant2() { + return x2; + }; + } + const abs$2 = Math.abs; + const atan2$1 = Math.atan2; + const cos$2 = Math.cos; + const max$1 = Math.max; + const min$1 = Math.min; + const sin$2 = Math.sin; + const sqrt$2 = Math.sqrt; + const epsilon$5 = 1e-12; + const pi$3 = Math.PI; + const halfPi$2 = pi$3 / 2; + const tau$3 = 2 * pi$3; + function acos$1(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$3 : Math.acos(x2); + } + function asin$2(x2) { + return x2 >= 1 ? halfPi$2 : x2 <= -1 ? -halfPi$2 : Math.asin(x2); + } + const pi$2 = Math.PI, tau$2 = 2 * pi$2, epsilon$4 = 1e-6, tauEpsilon = tau$2 - epsilon$4; + function append$1(strings2) { + this._ += strings2[0]; + for (let i = 1, n = strings2.length; i < n; ++i) { + this._ += arguments[i] + strings2[i]; + } + } + function appendRound$1(digits) { + let d2 = Math.floor(digits); + if (!(d2 >= 0)) throw new Error(`invalid digits: ${digits}`); + if (d2 > 15) return append$1; + const k = 10 ** d2; + return function(strings2) { + this._ += strings2[0]; + for (let i = 1, n = strings2.length; i < n; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings2[i]; + } + }; + } + let Path$1 = class Path { + constructor(digits) { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + this._append = digits == null ? append$1 : appendRound$1(digits); } + moveTo(x2, y2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; + } + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._append`Z`; + } + } + lineTo(x2, y2) { + this._append`L${this._x1 = +x2},${this._y1 = +y2}`; + } + quadraticCurveTo(x12, y12, x2, y2) { + this._append`Q${+x12},${+y12},${this._x1 = +x2},${this._y1 = +y2}`; + } + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + this._append`C${+x12},${+y12},${+x2},${+y2},${this._x1 = +x3},${this._y1 = +y3}`; + } + arcTo(x12, y12, x2, y2, r) { + x12 = +x12, y12 = +y12, x2 = +x2, y2 = +y2, r = +r; + if (r < 0) throw new Error(`negative radius: ${r}`); + let x02 = this._x1, y02 = this._y1, x21 = x2 - x12, y21 = y2 - y12, x01 = x02 - x12, y01 = y02 - y12, l01_2 = x01 * x01 + y01 * y01; + if (this._x1 === null) { + this._append`M${this._x1 = x12},${this._y1 = y12}`; + } else if (!(l01_2 > epsilon$4)) ; + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$4) || !r) { + this._append`L${this._x1 = x12},${this._y1 = y12}`; + } else { + let x20 = x2 - x02, y20 = y2 - y02, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; + if (Math.abs(t01 - 1) > epsilon$4) { + this._append`L${x12 + t01 * x01},${y12 + t01 * y01}`; + } + this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x12 + t21 * x21},${this._y1 = y12 + t21 * y21}`; + } + } + arc(x2, y2, r, a0, a1, ccw) { + x2 = +x2, y2 = +y2, r = +r, ccw = !!ccw; + if (r < 0) throw new Error(`negative radius: ${r}`); + let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x02 = x2 + dx, y02 = y2 + dy, cw2 = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; + if (this._x1 === null) { + this._append`M${x02},${y02}`; + } else if (Math.abs(this._x1 - x02) > epsilon$4 || Math.abs(this._y1 - y02) > epsilon$4) { + this._append`L${x02},${y02}`; + } + if (!r) return; + if (da < 0) da = da % tau$2 + tau$2; + if (da > tauEpsilon) { + this._append`A${r},${r},0,1,${cw2},${x2 - dx},${y2 - dy}A${r},${r},0,1,${cw2},${this._x1 = x02},${this._y1 = y02}`; + } else if (da > epsilon$4) { + this._append`A${r},${r},0,${+(da >= pi$2)},${cw2},${this._x1 = x2 + r * Math.cos(a1)},${this._y1 = y2 + r * Math.sin(a1)}`; + } + } + rect(x2, y2, w2, h2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${w2 = +w2}v${+h2}h${-w2}Z`; + } + toString() { + return this._; + } + }; + function path$3() { + return new Path$1(); + } + path$3.prototype = Path$1.prototype; + function withPath(shape2) { + let digits = 3; + shape2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) { + digits = null; + } else { + const d2 = Math.floor(_); + if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d2; + } + return shape2; + }; + return () => new Path$1(digits); + } + function arcInnerRadius(d2) { + return d2.innerRadius; + } + function arcOuterRadius(d2) { + return d2.outerRadius; + } + function arcStartAngle(d2) { + return d2.startAngle; + } + function arcEndAngle(d2) { + return d2.endAngle; + } + function arcPadAngle(d2) { + return d2 && d2.padAngle; + } + function intersect$3(x02, y02, x12, y12, x2, y2, x3, y3) { + var x10 = x12 - x02, y10 = y12 - y02, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; + if (t * t < epsilon$5) return; + t = (x32 * (y02 - y2) - y32 * (x02 - x2)) / t; + return [x02 + t * x10, y02 + t * y10]; + } + function cornerTangents(x02, y02, x12, y12, r1, rc, cw2) { + var x01 = x02 - x12, y01 = y02 - y12, lo = (cw2 ? rc : -rc) / sqrt$2(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x02 + ox, y11 = y02 + oy, x10 = x12 + ox, y10 = y12 + oy, x002 = (x11 + x10) / 2, y002 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x11 * y10 - x10 * y11, d3 = (dy < 0 ? -1 : 1) * sqrt$2(max$1(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d3) / d2, cy0 = (-D2 * dx - dy * d3) / d2, cx1 = (D2 * dy + dx * d3) / d2, cy1 = (-D2 * dx + dy * d3) / d2, dx0 = cx0 - x002, dy0 = cy0 - y002, dx1 = cx1 - x002, dy1 = cy1 - y002; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; return { - data, - status + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r - 1), + y11: cy0 * (r1 / r - 1) }; -} -async function preload(target, url, format) { - const df = this, pending = df._pending || loadPending(df); - pending.requests += 1; - const res = await df.request(url, format); - df.pulse(target, df.changeset().remove((0, _vegaUtil.truthy)).insert(res.data || [])); - pending.done(); - return res; -} -function loadPending(df) { - let accept; - const pending = new Promise((a)=>accept = a); - pending.requests = 0; - pending.done = ()=>{ - if (--pending.requests === 0) { - df._pending = null; - accept(df); - } + } + function arc$2$1() { + var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant$2(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context2 = null, path2 = withPath(arc2); + function arc2() { + var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi$2, a1 = endAngle.apply(this, arguments) - halfPi$2, da = abs$2(a1 - a0), cw2 = a1 > a0; + if (!context2) context2 = buffer = path2(); + if (r1 < r0) r = r1, r1 = r0, r0 = r; + if (!(r1 > epsilon$5)) context2.moveTo(0, 0); + else if (da > tau$3 - epsilon$5) { + context2.moveTo(r1 * cos$2(a0), r1 * sin$2(a0)); + context2.arc(0, 0, r1, a0, a1, !cw2); + if (r0 > epsilon$5) { + context2.moveTo(r0 * cos$2(a1), r0 * sin$2(a1)); + context2.arc(0, 0, r0, a1, a0, cw2); + } + } else { + var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon$5 && (padRadius ? +padRadius.apply(this, arguments) : sqrt$2(r0 * r0 + r1 * r1)), rc = min$1(abs$2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t02, t12; + if (rp > epsilon$5) { + var p02 = asin$2(rp / r0 * sin$2(ap)), p1 = asin$2(rp / r1 * sin$2(ap)); + if ((da0 -= p02 * 2) > epsilon$5) p02 *= cw2 ? 1 : -1, a00 += p02, a10 -= p02; + else da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon$5) p1 *= cw2 ? 1 : -1, a01 += p1, a11 -= p1; + else da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + var x01 = r1 * cos$2(a01), y01 = r1 * sin$2(a01), x10 = r0 * cos$2(a10), y10 = r0 * sin$2(a10); + if (rc > epsilon$5) { + var x11 = r1 * cos$2(a11), y11 = r1 * sin$2(a11), x002 = r0 * cos$2(a00), y002 = r0 * sin$2(a00), oc; + if (da < pi$3) { + if (oc = intersect$3(x01, y01, x002, y002, x11, y11, x10, y10)) { + var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) / 2), lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = min$1(rc, (r0 - lc) / (kc - 1)); + rc1 = min$1(rc, (r1 - lc) / (kc + 1)); + } else { + rc0 = rc1 = 0; + } + } + } + if (!(da1 > epsilon$5)) context2.moveTo(x01, y01); + else if (rc1 > epsilon$5) { + t02 = cornerTangents(x002, y002, x01, y01, r1, rc1, cw2); + t12 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw2); + context2.moveTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc1 < rc) context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r1, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), !cw2); + context2.arc(t12.cx, t12.cy, rc1, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.moveTo(x01, y01), context2.arc(0, 0, r1, a01, a11, !cw2); + if (!(r0 > epsilon$5) || !(da0 > epsilon$5)) context2.lineTo(x10, y10); + else if (rc0 > epsilon$5) { + t02 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw2); + t12 = cornerTangents(x01, y01, x002, y002, r0, -rc0, cw2); + context2.lineTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc0 < rc) context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r0, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), cw2); + context2.arc(t12.cx, t12.cy, rc0, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.arc(0, 0, r0, a10, a00, cw2); + } + context2.closePath(); + if (buffer) return context2 = null, buffer + "" || null; + } + arc2.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$3 / 2; + return [cos$2(a2) * r, sin$2(a2) * r]; }; - return df._pending = pending; -} -const SKIP = { - skip: true -}; -/** - * Perform operator updates in response to events. Applies an - * update function to compute a new operator value. If the update function - * returns a {@link ChangeSet}, the operator will be pulsed with those tuple - * changes. Otherwise, the operator value will be updated to the return value. - * @param {EventStream|Operator} source - The event source to react to. - * This argument can be either an EventStream or an Operator. - * @param {Operator|function(object):Operator} target - The operator to update. - * This argument can either be an Operator instance or (if the source - * argument is an EventStream), a function that accepts an event object as - * input and returns an Operator to target. - * @param {function(Parameters,Event): *} [update] - Optional update function - * to compute the new operator value, or a literal value to set. Update - * functions expect to receive a parameter object and event as arguments. - * This function can either return a new operator value or (if the source - * argument is an EventStream) a {@link ChangeSet} instance to pulse - * the target operator with tuple changes. - * @param {object} [params] - The update function parameters. - * @param {object} [options] - Additional options hash. If not overridden, - * updated operators will be skipped by default. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @return {Dataflow} - */ function on(source, target, update, params, options) { - const fn = source instanceof Operator ? onOperator : onStream; - fn(this, source, target, update, params, options); - return this; -} -function onStream(df, stream, target, update, params, options) { - const opt = (0, _vegaUtil.extend)({}, options, SKIP); - let func, op; - if (!(0, _vegaUtil.isFunction)(target)) target = (0, _vegaUtil.constant)(target); - if (update === undefined) func = (e)=>df.touch(target(e)); - else if ((0, _vegaUtil.isFunction)(update)) { - op = new Operator(null, update, params, false); - func = (e)=>{ - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else func = (e)=>df.update(target(e), update, opt); - stream.apply(func); -} -function onOperator(df, source, target, update, params, options) { - if (update === undefined) source.targets().add(target); - else { - const opt = options || {}, op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [ - op - ]); // rerank as needed, #1672 - } - } -} -function updater(target, update) { - update = (0, _vegaUtil.isFunction)(update) ? update : (0, _vegaUtil.constant)(update); - return target ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) target.skip(value !== this.value).value = value; - return value; - } : update; -} -/** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ function rank(op) { - op.rank = ++this._rank; -} -/** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ function rerank(op) { - const queue = [ - op - ]; - let cur, list, i; - while(queue.length){ - this.rank(cur = queue.pop()); - if (list = cur._targets) for(i = list.length; --i >= 0;){ - queue.push(cur = list[i]); - if (cur === op) (0, _vegaUtil.error)('Cycle detected in dataflow graph.'); - } - } -} -/** - * Sentinel value indicating pulse propagation should stop. - */ const StopPropagation = {}; -// Pulse visit type flags -const ADD = 1, REM = 2, MOD = 4, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD, ALL = ADD | REM | MOD, REFLOW = 8, SOURCE = 16, NO_SOURCE = 32, NO_FIELDS = 64; -/** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; -} -function materialize(data, filter) { - const out = []; - (0, _vegaUtil.visitArray)(data, filter, (_)=>out.push(_)); - return out; -} -function filter(pulse, flags) { - const map = {}; - pulse.visit(flags, (t)=>{ - map[tupleid(t)] = 1; - }); - return (t)=>map[tupleid(t)] ? null : t; -} -function addFilter(a, b) { - return a ? (t, i)=>a(t, i) && b(t, i) : b; -} -Pulse.prototype = { - /** - * Sentinel value indicating pulse propagation should stop. - */ StopPropagation, - /** - * Boolean flag indicating ADD (added) tuples. - */ ADD, - /** - * Boolean flag indicating REM (removed) tuples. - */ REM, - /** - * Boolean flag indicating MOD (modified) tuples. - */ MOD, - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ ADD_REM, - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ ADD_MOD, - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ ALL, - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ REFLOW, - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ SOURCE, - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ NO_SOURCE, - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ NO_FIELDS, - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ fork (flags) { - return new Pulse(this.dataflow).init(this, flags); + arc2.innerRadius = function(_) { + return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$2(+_), arc2) : innerRadius; + }; + arc2.outerRadius = function(_) { + return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$2(+_), arc2) : outerRadius; + }; + arc2.cornerRadius = function(_) { + return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$2(+_), arc2) : cornerRadius; + }; + arc2.padRadius = function(_) { + return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), arc2) : padRadius; + }; + arc2.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$2(+_), arc2) : startAngle; + }; + arc2.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$2(+_), arc2) : endAngle; + }; + arc2.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$2(+_), arc2) : padAngle; + }; + arc2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, arc2) : context2; + }; + return arc2; + } + function array$3(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function Linear$1(context2) { + this._context = context2; + } + Linear$1.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ clone () { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: + this._context.lineTo(x2, y2); + break; + } + } + }; + function curveLinear(context2) { + return new Linear$1(context2); + } + function x$3(p) { + return p[0]; + } + function y$3(p) { + return p[1]; + } + function line$2$1(x2, y2) { + var defined = constant$2(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(line2); + x2 = typeof x2 === "function" ? x2 : x2 === void 0 ? x$3 : constant$2(x2); + y2 = typeof y2 === "function" ? y2 : y2 === void 0 ? y$3 : constant$2(y2); + function line2(data2) { + var i, n = (data2 = array$3(data2)).length, d2, defined0 = false, buffer; + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d2 = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) output2.lineStart(); + else output2.lineEnd(); + } + if (defined0) output2.point(+x2(d2, i, data2), +y2(d2, i, data2)); + } + if (buffer) return output2 = null, buffer + "" || null; + } + line2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$2(+_), line2) : x2; + }; + line2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$2(+_), line2) : y2; + }; + line2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$2(!!_), line2) : defined; + }; + line2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), line2) : curve2; + }; + line2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), line2) : context2; + }; + return line2; + } + function area$2$1(x02, y02, y12) { + var x12 = null, defined = constant$2(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(area2); + x02 = typeof x02 === "function" ? x02 : x02 === void 0 ? x$3 : constant$2(+x02); + y02 = typeof y02 === "function" ? y02 : y02 === void 0 ? constant$2(0) : constant$2(+y02); + y12 = typeof y12 === "function" ? y12 : y12 === void 0 ? y$3 : constant$2(+y12); + function area2(data2) { + var i, j, k, n = (data2 = array$3(data2)).length, d2, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d2 = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) { + j = i; + output2.areaStart(); + output2.lineStart(); + } else { + output2.lineEnd(); + output2.lineStart(); + for (k = i - 1; k >= j; --k) { + output2.point(x0z[k], y0z[k]); + } + output2.lineEnd(); + output2.areaEnd(); + } + } + if (defined0) { + x0z[i] = +x02(d2, i, data2), y0z[i] = +y02(d2, i, data2); + output2.point(x12 ? +x12(d2, i, data2) : x0z[i], y12 ? +y12(d2, i, data2) : y0z[i]); + } + } + if (buffer) return output2 = null, buffer + "" || null; + } + function arealine() { + return line$2$1().defined(defined).curve(curve2).context(context2); + } + area2.x = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$2(+_), x12 = null, area2) : x02; + }; + area2.x0 = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$2(+_), area2) : x02; + }; + area2.x1 = function(_) { + return arguments.length ? (x12 = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), area2) : x12; + }; + area2.y = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$2(+_), y12 = null, area2) : y02; + }; + area2.y0 = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$2(+_), area2) : y02; + }; + area2.y1 = function(_) { + return arguments.length ? (y12 = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), area2) : y12; + }; + area2.lineX0 = area2.lineY0 = function() { + return arealine().x(x02).y(y02); + }; + area2.lineY1 = function() { + return arealine().x(x02).y(y12); + }; + area2.lineX1 = function() { + return arealine().x(x12).y(y02); + }; + area2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$2(!!_), area2) : defined; + }; + area2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), area2) : curve2; + }; + area2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), area2) : context2; + }; + return area2; + } + const circle = { + draw(context2, size) { + const r = sqrt$2(size / pi$3); + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, tau$3); + } + }; + function Symbol$1(type2, size) { + let context2 = null, path2 = withPath(symbol2); + type2 = typeof type2 === "function" ? type2 : constant$2(type2 || circle); + size = typeof size === "function" ? size : constant$2(size === void 0 ? 64 : +size); + function symbol2() { + let buffer; + if (!context2) context2 = buffer = path2(); + type2.apply(this, arguments).draw(context2, +size.apply(this, arguments)); + if (buffer) return context2 = null, buffer + "" || null; + } + symbol2.type = function(_) { + return arguments.length ? (type2 = typeof _ === "function" ? _ : constant$2(_), symbol2) : type2; + }; + symbol2.size = function(_) { + return arguments.length ? (size = typeof _ === "function" ? _ : constant$2(+_), symbol2) : size; + }; + symbol2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, symbol2) : context2; + }; + return symbol2; + } + function noop$3() { + } + function point$5(that, x2, y2) { + that._context.bezierCurveTo( + (2 * that._x0 + that._x1) / 3, + (2 * that._y0 + that._y1) / 3, + (that._x0 + 2 * that._x1) / 3, + (that._y0 + 2 * that._y1) / 3, + (that._x0 + 4 * that._x1 + x2) / 6, + (that._y0 + 4 * that._y1 + y2) / 6 + ); + } + function Basis(context2) { + this._context = context2; + } + Basis.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ addAll () { - let p = this; - const reuse = !p.source || p.add === p.rem // special case for indexed set (e.g., crossfilter) - || !p.rem.length && p.source.length === p.add.length; - if (reuse) return p; - else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - p.rem = []; // new operators can ignore rem #2769 - return p; - } + areaEnd: function() { + this._line = NaN; }, - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ init (src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - if (src.fields && !(flags & NO_FIELDS)) p.fields = src.fields; - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - return p; + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; }, - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ runAfter (func) { - this.dataflow.runAfter(func); + lineEnd: function() { + switch (this._point) { + case 3: + point$5(this, this._x1, this._y1); + // falls through + case 2: + this._context.lineTo(this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; }, - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ changed (flags) { - const f = flags || ALL; - return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + } + }; + function curveBasis(context2) { + return new Basis(context2); + } + function BasisClosed(context2) { + this._context = context2; + } + BasisClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; + this._point = 0; }, - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ reflow (fork) { - if (fork) return this.fork(ALL).reflow(); - const len = this.add.length, src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x2, this._y2); + this._context.closePath(); + break; + } + case 2: { + this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); + this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x2, this._y2); + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + break; } - return this; - }, - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ clean (value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else return this.cleans; + } }, - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array<string>} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ modifies (_) { - const hash = this.fields || (this.fields = {}); - if ((0, _vegaUtil.isArray)(_)) _.forEach((f)=>hash[f] = true); - else hash[_] = true; - return this; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x2 = x2, this._y2 = y2; + break; + case 1: + this._point = 2; + this._x3 = x2, this._y3 = y2; + break; + case 2: + this._point = 3; + this._x4 = x2, this._y4 = y2; + this._context.moveTo((this._x0 + 4 * this._x1 + x2) / 6, (this._y0 + 4 * this._y1 + y2) / 6); + break; + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + } + }; + function curveBasisClosed(context2) { + return new BasisClosed(context2); + } + function BasisOpen(context2) { + this._context = context2; + } + BasisOpen.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array<string>} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ modified (_, nomod) { - const fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; + areaEnd: function() { + this._line = NaN; }, - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ filter (flags, filter) { - const p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; }, - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ materialize (flags) { - flags = flags || ALL; - const p = this; - if (flags & ADD && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if (flags & REM && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if (flags & MOD && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if (flags & SOURCE && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - return p; + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; }, - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ visit (flags, visitor) { - const p = this, v = visitor; - if (flags & SOURCE) { - (0, _vegaUtil.visitArray)(p.source, p.srcF, v); - return p; - } - if (flags & ADD) (0, _vegaUtil.visitArray)(p.add, p.addF, v); - if (flags & REM) (0, _vegaUtil.visitArray)(p.rem, p.remF, v); - if (flags & MOD) (0, _vegaUtil.visitArray)(p.mod, p.modF, v); - const src = p.source; - if (flags & REFLOW && src) { - const sum = p.add.length + p.mod.length; - if (sum === src.length) ; - else if (sum) (0, _vegaUtil.visitArray)(src, filter(p, ADD_MOD), v); - else // if no add/rem/mod tuples, visit source - (0, _vegaUtil.visitArray)(src, p.srcF, v); - } - return p; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + var x02 = (this._x0 + 4 * this._x1 + x2) / 6, y02 = (this._y0 + 4 * this._y1 + y2) / 6; + this._line ? this._context.lineTo(x02, y02) : this._context.moveTo(x02, y02); + break; + case 3: + this._point = 4; + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; } -}; -/** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse. - */ function MultiPulse(dataflow, stamp, pulses, encode) { - const p = this; - let c = 0; - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - for (const pulse of pulses){ - if (pulse.stamp !== stamp) continue; - if (pulse.fields) { - const hash = p.fields || (p.fields = {}); - for(const f in pulse.fields)hash[f] = 1; - } - if (pulse.changed(p.ADD)) c |= p.ADD; - if (pulse.changed(p.REM)) c |= p.REM; - if (pulse.changed(p.MOD)) c |= p.MOD; - } - this.changes = c; -} -(0, _vegaUtil.inherits)(MultiPulse, Pulse, { - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - */ fork (flags) { - const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); - if (flags !== undefined) { - if (flags & p.ADD) this.visit(p.ADD, (t)=>p.add.push(t)); - if (flags & p.REM) this.visit(p.REM, (t)=>p.rem.push(t)); - if (flags & p.MOD) this.visit(p.MOD, (t)=>p.mod.push(t)); + }; + function curveBasisOpen(context2) { + return new BasisOpen(context2); + } + function Bundle(context2, beta) { + this._basis = new Basis(context2); + this._beta = beta; + } + Bundle.prototype = { + lineStart: function() { + this._x = []; + this._y = []; + this._basis.lineStart(); + }, + lineEnd: function() { + var x2 = this._x, y2 = this._y, j = x2.length - 1; + if (j > 0) { + var x02 = x2[0], y02 = y2[0], dx = x2[j] - x02, dy = y2[j] - y02, i = -1, t; + while (++i <= j) { + t = i / j; + this._basis.point( + this._beta * x2[i] + (1 - this._beta) * (x02 + t * dx), + this._beta * y2[i] + (1 - this._beta) * (y02 + t * dy) + ); } - return p; + } + this._x = this._y = null; + this._basis.lineEnd(); }, - changed (flags) { - return this.changes & flags; + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); + } + }; + const curveBundle = (function custom2(beta) { + function bundle2(context2) { + return beta === 1 ? new Basis(context2) : new Bundle(context2, beta); + } + bundle2.beta = function(beta2) { + return custom2(+beta2); + }; + return bundle2; + })(0.85); + function point$4(that, x2, y2) { + that._context.bezierCurveTo( + that._x1 + that._k * (that._x2 - that._x0), + that._y1 + that._k * (that._y2 - that._y0), + that._x2 + that._k * (that._x1 - x2), + that._y2 + that._k * (that._y1 - y2), + that._x2, + that._y2 + ); + } + function Cardinal(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + Cardinal.prototype = { + areaStart: function() { + this._line = 0; }, - modified (_) { - const p = this, fields = p.fields; - return !(fields && p.changes & p.MOD) ? 0 : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; + areaEnd: function() { + this._line = NaN; }, - filter () { - (0, _vegaUtil.error)('MultiPulse does not support filtering.'); + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; }, - materialize () { - (0, _vegaUtil.error)('MultiPulse does not support materialization.'); + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + point$4(this, this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; }, - visit (flags, visitor) { - const p = this, pulses = p.pulses, n = pulses.length; - let i = 0; - if (flags & p.SOURCE) for(; i < n; ++i)pulses[i].visit(flags, visitor); - else { - for(; i < n; ++i)if (pulses[i].stamp === p.stamp) pulses[i].visit(flags, visitor); - } - return p; - } -}); -/* eslint-disable require-atomic-updates */ /** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function evaluate(encode, prerun, postrun) { - const df = this, async = []; - // if the pulse value is set, this is a re-entrant call - if (df._pulse) return reentrant(df); - // wait for pending datasets to load - if (df._pending) await df._pending; - // invoke prerun function, if provided - if (prerun) await asyncCallback(df, prerun); - // exit early if there are no updates - if (!df._touched.length) { - df.debug('Dataflow invoked, but nothing to do.'); - return df; - } - // increment timestamp clock - const stamp = ++df._clock; - // set the current pulse - df._pulse = new Pulse(df, stamp, encode); - // initialize priority queue, reset touched operators - df._touched.forEach((op)=>df._enqueue(op, true)); - df._touched = UniqueList((0, _vegaUtil.id)); - let count = 0, op, next, error; - try { - while(df._heap.size() > 0){ - // dequeue operator with highest priority - op = df._heap.pop(); - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - if (next.then) // await if operator returns a promise directly - next = await next; - else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach((op)=>df._enqueue(op)); - } - // increment visit counter - ++count; - } - } catch (err) { - df._heap.clear(); - error = err; - } - // reset pulse map - df._input = {}; - df._pulse = null; - df.debug(`Pulse ${stamp}: ${count} operators`); - if (error) { - df._postrun = []; - df.error(error); - } - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b)=>b.priority - a.priority); - df._postrun = []; - for(let i = 0; i < pr.length; ++i)await asyncCallback(df, pr[i].callback); + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + this._x1 = x2, this._y1 = y2; + break; + case 2: + this._point = 3; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - // invoke postrun function, if provided - if (postrun) await asyncCallback(df, postrun); - // handle non-blocking asynchronous callbacks - if (async.length) Promise.all(async).then((cb)=>df.runAsync(null, ()=>{ - cb.forEach((f)=>{ - try { - f(df); - } catch (err) { - df.error(err); - } - }); - })); - return df; -} -/** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while(this._running)await this._running; - // run dataflow, manage running promise - const clear = ()=>this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear); - return this._running; -} -/** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this); -} -/** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - else // pulse propagation already complete, invoke immediately - try { - callback(this); - } catch (err) { - this.error(err); + }; + const curveCardinal = (function custom2(tension) { + function cardinal(context2) { + return new Cardinal(context2, tension); } -} -/** - * Raise an error for re-entrant dataflow evaluation. - */ function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; -} -/** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ function enqueue(op, force) { - const q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } -} -/** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ function getPulse(op, encode) { - const s = op.source, stamp = this._clock; - return s && (0, _vegaUtil.isArray)(s) ? new MultiPulse(this, stamp, s.map((_)=>_.pulse), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); -} -function singlePulse(p, s) { - if (s && s.stamp === p.stamp) return s; - p = p.fork(); - if (s && s !== StopPropagation) p.source = s.source; - return p; -} -const NO_OPT = { - skip: false, - force: false -}; -/** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function touch(op, options) { - const opt = options || NO_OPT; - if (this._pulse) // if in midst of propagation, add to priority queue - this._enqueue(op); - else // otherwise, queue for next propagation - this._touched.add(op); - if (opt.skip) op.skip(true); - return this; -} -/** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function update(op, value, options) { - const opt = options || NO_OPT; - if (op.set(value) || opt.force) this.touch(op, opt); - return this; -} -/** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - return this; -} -function Heap(cmp) { - let nodes = []; - return { - clear: ()=>nodes = [], - size: ()=>nodes.length, - peek: ()=>nodes[0], - push: (x)=>{ - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: ()=>{ - const last = nodes.pop(); - let item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else item = last; - return item; - } - }; -} -function siftdown(array, start, idx, cmp) { - let parent, pidx; - const item = array[idx]; - while(idx > start){ - pidx = idx - 1 >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function CardinalClosed(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + CardinalClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; } - break; + } + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - return array[idx] = item; -} -function siftup(array, idx, cmp) { - const start = idx, end = array.length, item = array[idx]; - let cidx = (idx << 1) + 1, ridx; - while(cidx < end){ - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) cidx = ridx; - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); -} -/** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ function Dataflow() { - this.logger((0, _vegaUtil.logger)()); - this.logLevel((0, _vegaUtil.Error)); - this._clock = 0; - this._rank = 0; - this._locale = (0, _vegaFormat.defaultLocale)(); - try { - this._loader = (0, _vegaLoader.loader)(); - } catch (e) { - // do nothing if loader module is unavailable + }; + const curveCardinalClosed = (function custom2(tension) { + function cardinal(context2) { + return new CardinalClosed(context2, tension); } - this._touched = UniqueList((0, _vegaUtil.id)); - this._input = {}; - this._pulse = null; - this._heap = Heap((a, b)=>a.qrank - b.qrank); - this._postrun = []; -} -function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); + cardinal.tension = function(tension2) { + return custom2(+tension2); }; -} -Dataflow.prototype = { - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ stamp () { - return this._clock; - }, - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ loader (_) { - if (arguments.length) { - this._loader = _; - return this; - } else return this._loader; - }, - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ locale (_) { - if (arguments.length) { - this._locale = _; - return this; - } else return this._locale; + return cardinal; + })(0); + function CardinalOpen(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + CardinalOpen.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ logger (logger) { - if (arguments.length) { - this._log = logger; - return this; - } else return this._log; + areaEnd: function() { + this._line = NaN; }, - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ error: logMethod('error'), - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ warn: logMethod('warn'), - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ info: logMethod('info'), - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ debug: logMethod('debug'), - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ logLevel: logMethod('level'), - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ cleanThreshold: 1e4, - // OPERATOR REGISTRATION - add, - connect, - rank, - rerank, - // OPERATOR UPDATES - pulse, - touch, - update, - changeset, - // DATA LOADING - ingest, - parse, - preload, - request, - // EVENT HANDLING - events, - on, - // PULSE PROPAGATION - evaluate, - run, - runAsync, - runAfter, - _enqueue: enqueue, - _getPulse: getPulse -}; -/** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ function Transform(init, params) { - Operator.call(this, init, null, params); -} -(0, _vegaUtil.inherits)(Transform, Operator, { - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) this.skip(false); - else rv = this.evaluate(pulse); - rv = rv || pulse; - if (rv.then) rv = rv.then((_)=>this.pulse = _); - else if (rv !== pulse.StopPropagation) this.pulse = rv; - return rv; + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; }, - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const params = this.marshall(pulse.stamp), out = this.transform(params, pulse); - params.clear(); - return out; + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; }, - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ transform () {} -}); -const transforms = {}; -function definition(type) { - const t = transform(type); - return t && t.Definition || null; -} -function transform(type) { - type = type && type.toLowerCase(); - return (0, _vegaUtil.hasOwnProperty)(transforms, type) ? transforms[type] : null; -} - -},{"vega-util":"f2ulH","vega-loader":"8kWcg","vega-format":"3VXXV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8kWcg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formats", ()=>formats); -parcelHelpers.export(exports, "inferType", ()=>inferType); -parcelHelpers.export(exports, "inferTypes", ()=>inferTypes); -parcelHelpers.export(exports, "loader", ()=>loader); -parcelHelpers.export(exports, "read", ()=>read); -parcelHelpers.export(exports, "responseType", ()=>responseType); -parcelHelpers.export(exports, "typeParsers", ()=>typeParsers); -var _vegaUtil = require("vega-util"); -var _d3Dsv = require("d3-dsv"); -var _topojsonClient = require("topojson-client"); -var _vegaFormat = require("vega-format"); -var Buffer = require("d2bd1b4e1a5e867b").Buffer; -// Matches absolute URLs with optional protocol -// https://... file://... //... -const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; -// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// -const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape -const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex -// Special treatment in node.js for the file: protocol -const fileProtocol = 'file://'; -/** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ function loaderFactory(fetch1, fs) { - return (options)=>({ - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: false, - file: fileLoader(fs), - http: httpLoader(fetch1) - }); -} -/** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ async function load(uri, options) { - const opt = await this.sanitize(uri, options), url = opt.href; - return opt.localFile ? this.file(url) : this.http(url, options); -} -/** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ async function sanitize(uri, options) { - options = (0, _vegaUtil.extend)({}, this.options, options); - const fileAccess = this.fileAccess, result = { - href: null - }; - let isFile, loadFile, base; - const isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - if (uri == null || typeof uri !== 'string' || !isAllowed) (0, _vegaUtil.error)('Sanitize failure, invalid URI: ' + (0, _vegaUtil.stringValue)(uri)); - const hasProtocol = protocol_re.test(uri); - // if relative url (no protocol/host), prepend baseURL - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && !base.endsWith('/')) uri = '/' + uri; - uri = base + uri; - } - // should we load from file system? - loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess; - if (isFile) // strip file protocol - uri = uri.slice(fileProtocol.length); - else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - // set non-enumerable mode flag to indicate local file load - Object.defineProperty(result, 'localFile', { - value: !!loadFile - }); - // set uri - result.href = uri; - // set default result target, if specified - if (options.target) result.target = options.target + ''; - // set default result rel, if specified (#1542) - if (options.rel) result.rel = options.rel + ''; - // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - if (options.context === 'image' && options.crossOrigin) result.crossOrigin = options.crossOrigin + ''; - // return - return result; -} -/** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ function fileLoader(fs) { - return fs ? (filename)=>new Promise((accept, reject)=>{ - fs.readFile(filename, (error, data)=>{ - if (error) reject(error); - else accept(data); - }); - }) : fileReject; -} -/** - * Default file system loader that simply rejects. - */ async function fileReject() { - (0, _vegaUtil.error)('No file system access.'); -} -/** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ function httpLoader(fetch1) { - return fetch1 ? async function(url, options) { - const opt = (0, _vegaUtil.extend)({}, this.options.http, options), type = options && options.response, response = await fetch1(url, opt); - return !response.ok ? (0, _vegaUtil.error)(response.status + '' + response.statusText) : (0, _vegaUtil.isFunction)(response[type]) ? response[type]() : response.text(); - } : httpReject; -} -/** - * Default http request handler that simply rejects. - */ async function httpReject() { - (0, _vegaUtil.error)('No HTTP fetch method available.'); -} -const isValid = (_)=>_ != null && _ === _; -const isBoolean = (_)=>_ === 'true' || _ === 'false' || _ === true || _ === false; -const isDate = (_)=>!Number.isNaN(Date.parse(_)); -const isNumber = (_)=>!Number.isNaN(+_) && !(_ instanceof Date); -const isInteger = (_)=>isNumber(_) && Number.isInteger(+_); -const typeParsers = { - boolean: (0, _vegaUtil.toBoolean), - integer: (0, _vegaUtil.toNumber), - number: (0, _vegaUtil.toNumber), - date: (0, _vegaUtil.toDate), - string: (0, _vegaUtil.toString), - unknown: (0, _vegaUtil.identity) -}; -const typeTests = [ - isBoolean, - isInteger, - isNumber, - isDate -]; -const typeList = [ - 'boolean', - 'integer', - 'number', - 'date' -]; -function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - const n = values.length, m = typeTests.length, a = typeTests.map((_, i)=>i + 1); - for(let i = 0, t = 0, j, value; i < n; ++i){ - value = field ? values[i][field] : values[i]; - for(j = 0; j < m; ++j)if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - return typeList[a.reduce((u, v)=>u === 0 ? v : u, 0) - 1]; -} -function inferTypes(data, fields) { - return fields.reduce((types, field)=>{ - types[field] = inferType(data, field); - return types; - }, {}); -} -function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = { - delimiter: delimiter - }; - return dsv(data, format ? (0, _vegaUtil.extend)(format, delim) : delim); - }; - parse.responseType = 'text'; - return parse; -} -function dsv(data, format) { - if (format.header) data = format.header.map((0, _vegaUtil.stringValue)).join(format.delimiter) + '\n' + data; - return (0, _d3Dsv.dsvFormat)(format.delimiter).parse(data + ''); -} -dsv.responseType = 'text'; -function isBuffer(_) { - return typeof Buffer === 'function' && (0, _vegaUtil.isFunction)(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; -} -function json(data, format) { - const prop = format && format.property ? (0, _vegaUtil.field)(format.property) : (0, _vegaUtil.identity); - return (0, _vegaUtil.isObject)(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data)); -} -json.responseType = 'json'; -function parseJSON(data, format) { - if (!(0, _vegaUtil.isArray)(data) && (0, _vegaUtil.isIterable)(data)) data = [ - ...data - ]; - return format && format.copy ? JSON.parse(JSON.stringify(data)) : data; -} -const filters = { - interior: (a, b)=>a !== b, - exterior: (a, b)=>a === b -}; -function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - if (format && format.feature) { - method = (0, _topojsonClient.feature); - property = format.feature; - } else if (format && format.mesh) { - method = (0, _topojsonClient.mesh); - property = format.mesh; - filter = filters[format.filter]; - } else (0, _vegaUtil.error)('Missing TopoJSON feature or mesh parameter.'); - object = (object = data.objects[property]) ? method(data, object, filter) : (0, _vegaUtil.error)('Invalid TopoJSON object: ' + property); - return object && object.features || [ - object - ]; -} -topojson.responseType = 'json'; -const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson -}; -function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else return (0, _vegaUtil.hasOwnProperty)(format, name) ? format[name] : null; -} -function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; -} -function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - const reader = formats(schema.type || 'json'); - if (!reader) (0, _vegaUtil.error)('Unknown data format type: ' + schema.type); - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - if ((0, _vegaUtil.hasOwnProperty)(data, 'columns')) delete data.columns; - return data; -} -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - const locale = (0, _vegaFormat.timeFormatDefaultLocale)(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - let fields = data.columns || Object.keys(data[0]), datum, field, i, j, n, m; - if (types === 'auto') types = inferTypes(data, fields); - fields = Object.keys(types); - const parsers = fields.map((field)=>{ - const type = types[field]; - let parts, pattern; - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') pattern = pattern.slice(1, -1); - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - if (!typeParsers[type]) throw Error('Illegal format pattern: ' + field + ':' + type); - return typeParsers[type]; - }); - for(i = 0, n = data.length, m = fields.length; i < n; ++i){ - datum = data[i]; - for(j = 0; j < m; ++j){ - field = fields[j]; - datum[field] = parsers[j](datum[field]); - } - } -} -const loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API -null // no file system access -); - -},{"d2bd1b4e1a5e867b":"6tQNr","vega-util":"f2ulH","d3-dsv":"dYJ1x","topojson-client":"esWvi","vega-format":"3VXXV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6tQNr":[function(require,module,exports,__globalThis) { -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh <https://feross.org> - * @license MIT - */ /* eslint-disable no-proto */ 'use strict'; -const base64 = require("9c62938f1dccc73c"); -const ieee754 = require("aceacb6a4531a9d2"); -const customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null; -exports.Buffer = Buffer; -exports.SlowBuffer = SlowBuffer; -exports.INSPECT_MAX_BYTES = 50; -const K_MAX_LENGTH = 0x7fffffff; -exports.kMaxLength = K_MAX_LENGTH; -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); -function typedArraySupport() { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1); - const proto = { - foo: function() { - return 42; - } - }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -} -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.buffer; - } -}); -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.byteOffset; - } -}); -function createBuffer(length) { - if (length > K_MAX_LENGTH) throw new RangeError('The value "' + length + '" is invalid for option "size"'); - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ function Buffer(arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') throw new TypeError('The "string" argument must be of type string. Received type number'); - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); -} -Buffer.poolSize = 8192 // not used by this implementation -; -function from(value, encodingOrOffset, length) { - if (typeof value === 'string') return fromString(value, encodingOrOffset); - if (ArrayBuffer.isView(value)) return fromArrayView(value); - if (value == null) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof value === 'number') throw new TypeError('The "value" argument must not be of type number. Received type number'); - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); -} -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ Buffer.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); -}; -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); -Object.setPrototypeOf(Buffer, Uint8Array); -function assertSize(size) { - if (typeof size !== 'number') throw new TypeError('"size" argument must be of type number'); - else if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); -} -function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) return createBuffer(size); - if (fill !== undefined) // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - return createBuffer(size); -} -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ Buffer.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); -}; -function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); -} -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ Buffer.allocUnsafe = function(size) { - return allocUnsafe(size); -}; -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ Buffer.allocUnsafeSlow = function(size) { - return allocUnsafe(size); -}; -function fromString(string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'; - if (!Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual); - return buf; -} -function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for(let i = 0; i < length; i += 1)buf[i] = array[i] & 255; - return buf; -} -function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); -} -function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); - let buf; - if (byteOffset === undefined && length === undefined) buf = new Uint8Array(array); - else if (length === undefined) buf = new Uint8Array(array, byteOffset); - else buf = new Uint8Array(array, byteOffset, length); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -function fromObject(obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) return buf; - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) return createBuffer(0); - return fromArrayLike(obj); - } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) return fromArrayLike(obj.data); -} -function checked(length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + ' bytes'); - return length | 0; -} -function SlowBuffer(length) { - if (+length != length) length = 0; - return Buffer.alloc(+length); -} -Buffer.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false - ; -}; -Buffer.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - if (a === b) return 0; - let x = a.length; - let y = b.length; - for(let i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; + }; + const curveCardinalOpen = (function custom2(tension) { + function cardinal(context2) { + return new CardinalOpen(context2, tension); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -Buffer.isEncoding = function isEncoding(encoding) { - switch(String(encoding).toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true; + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function point$3(that, x2, y2) { + var x12 = that._x1, y12 = that._y1, x22 = that._x2, y22 = that._y2; + if (that._l01_a > epsilon$5) { + var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); + x12 = (x12 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; + y12 = (y12 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; + } + if (that._l23_a > epsilon$5) { + var b2 = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m2 = 3 * that._l23_a * (that._l23_a + that._l12_a); + x22 = (x22 * b2 + that._x1 * that._l23_2a - x2 * that._l12_2a) / m2; + y22 = (y22 * b2 + that._y1 * that._l23_2a - y2 * that._l12_2a) / m2; + } + that._context.bezierCurveTo(x12, y12, x22, y22, that._x2, that._y2); + } + function CatmullRom(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRom.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + this.point(this._x2, this._y2); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + // falls through default: - return false; + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; -Buffer.concat = function concat(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); - if (list.length === 0) return Buffer.alloc(0); - let i; - if (length === undefined) { - length = 0; - for(i = 0; i < list.length; ++i)length += list[i].length; - } - const buffer = Buffer.allocUnsafe(length); - let pos = 0; - for(i = 0; i < list.length; ++i){ - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf); - buf.copy(buffer, pos); - } else Uint8Array.prototype.set.call(buffer, buf, pos); - } else if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); - else buf.copy(buffer, pos); - pos += buf.length; - } - return buffer; -}; -function byteLength(string, encoding) { - if (Buffer.isBuffer(string)) return string.length; - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if (typeof string !== 'string') throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - // Use a for loop to avoid recursion - let loweredCase = false; - for(;;)switch(encoding){ - case 'ascii': - case 'latin1': - case 'binary': - return len; - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2; - case 'hex': - return len >>> 1; - case 'base64': - return base64ToBytes(string).length; - default: - if (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - ; - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } -} -Buffer.byteLength = byteLength; -function slowToString(encoding, start, end) { - let loweredCase = false; - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) start = 0; - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) return ''; - if (end === undefined || end > this.length) end = this.length; - if (end <= 0) return ''; - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0; - start >>>= 0; - if (end <= start) return ''; - if (!encoding) encoding = 'utf8'; - while(true)switch(encoding){ - case 'hex': - return hexSlice(this, start, end); - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end); - case 'ascii': - return asciiSlice(this, start, end); - case 'latin1': - case 'binary': - return latin1Slice(this, start, end); - case 'base64': - return base64Slice(this, start, end); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end); + }; + const curveCatmullRom = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRom(context2, alpha) : new Cardinal(context2, 0); + } + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function CatmullRomClosed(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRomClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = (encoding + '').toLowerCase(); - loweredCase = true; - } -} -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true; -function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; -} -Buffer.prototype.swap16 = function swap16() { - const len = this.length; - if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits'); - for(let i = 0; i < len; i += 2)swap(this, i, i + 1); - return this; -}; -Buffer.prototype.swap32 = function swap32() { - const len = this.length; - if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits'); - for(let i = 0; i < len; i += 4){ - swap(this, i, i + 3); - swap(this, i + 1, i + 2); + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - return this; -}; -Buffer.prototype.swap64 = function swap64() { - const len = this.length; - if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits'); - for(let i = 0; i < len; i += 8){ - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); + }; + const curveCatmullRomClosed = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomClosed(context2, alpha) : new CardinalClosed(context2, 0); } - return this; -}; -Buffer.prototype.toString = function toString() { - const length = this.length; - if (length === 0) return ''; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); -}; -Buffer.prototype.toLocaleString = Buffer.prototype.toString; -Buffer.prototype.equals = function equals(b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); - if (this === b) return true; - return Buffer.compare(this, b) === 0; -}; -Buffer.prototype.inspect = function inspect() { - let str = ''; - const max = exports.INSPECT_MAX_BYTES; - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); - if (this.length > max) str += ' ... '; - return '<Buffer ' + str + '>'; -}; -if (customInspectSymbol) Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; -Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) target = Buffer.from(target, target.offset, target.byteLength); - if (!Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (start === undefined) start = 0; - if (end === undefined) end = target ? target.length : 0; - if (thisStart === undefined) thisStart = 0; - if (thisEnd === undefined) thisEnd = this.length; - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError('out of range index'); - if (thisStart >= thisEnd && start >= end) return 0; - if (thisStart >= thisEnd) return -1; - if (start >= end) return 1; - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for(let i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function CatmullRomOpen(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRomOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1; - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff; - else if (byteOffset < -2147483648) byteOffset = -2147483648; - byteOffset = +byteOffset // Coerce to Number. - ; - if (numberIsNaN(byteOffset)) // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : buffer.length - 1; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - else byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - // Normalize val - if (typeof val === 'string') val = Buffer.from(val, encoding); - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) return -1; - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - ; - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - return arrayIndexOf(buffer, [ - val - ], byteOffset, encoding, dir); - } - throw new TypeError('val must be string, number or Buffer'); -} -function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase(); - if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) return -1; - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i) { - if (indexSize === 1) return buf[i]; - else return buf.readUInt16BE(i * indexSize); - } - let i; - if (dir) { - let foundIndex = -1; - for(i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for(i = byteOffset; i >= 0; i--){ - let found = true; - for(let j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - if (found) return i; - } + }; + const curveCatmullRomOpen = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomOpen(context2, alpha) : new CardinalOpen(context2, 0); } - return -1; -} -Buffer.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; -}; -Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); -}; -Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); -}; -function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) length = remaining; - else { - length = Number(length); - if (length > remaining) length = remaining; + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function LinearClosed(context2) { + this._context = context2; + } + LinearClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._point) this._context.closePath(); + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) this._context.lineTo(x2, y2); + else this._point = 1, this._context.moveTo(x2, y2); + } + }; + function curveLinearClosed(context2) { + return new LinearClosed(context2); + } + function sign$1(x2) { + return x2 < 0 ? -1 : 1; + } + function slope3(that, x2, y2) { + var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); + return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; + } + function slope2(that, t) { + var h2 = that._x1 - that._x0; + return h2 ? (3 * (that._y1 - that._y0) / h2 - t) / 2 : t; + } + function point$2(that, t02, t12) { + var x02 = that._x0, y02 = that._y0, x12 = that._x1, y12 = that._y1, dx = (x12 - x02) / 3; + that._context.bezierCurveTo(x02 + dx, y02 + dx * t02, x12 - dx, y12 - dx * t12, x12, y12); + } + function MonotoneX(context2) { + this._context = context2; + } + MonotoneX.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x1, this._y1); + break; + case 3: + point$2(this, this._t0, slope2(this, this._t0)); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + var t12 = NaN; + x2 = +x2, y2 = +y2; + if (x2 === this._x1 && y2 === this._y1) return; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + point$2(this, slope2(this, t12 = slope3(this, x2, y2)), t12); + break; + default: + point$2(this, this._t0, t12 = slope3(this, x2, y2)); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + this._t0 = t12; } - const strLen = string.length; - if (length > strLen / 2) length = strLen / 2; - let i; - for(i = 0; i < length; ++i){ - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; + }; + function MonotoneY(context2) { + this._context = new ReflectContext(context2); + } + (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) { + MonotoneX.prototype.point.call(this, y2, x2); + }; + function ReflectContext(context2) { + this._context = context2; + } + ReflectContext.prototype = { + moveTo: function(x2, y2) { + this._context.moveTo(y2, x2); + }, + closePath: function() { + this._context.closePath(); + }, + lineTo: function(x2, y2) { + this._context.lineTo(y2, x2); + }, + bezierCurveTo: function(x12, y12, x2, y2, x3, y3) { + this._context.bezierCurveTo(y12, x12, y2, x2, y3, x3); } - return i; -} -function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); -} -function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); -} -function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); -} -function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); -} -Buffer.prototype.write = function write(string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8'; - length = this.length; - offset = 0; - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset; - length = this.length; - offset = 0; - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === undefined) encoding = 'utf8'; + }; + function monotoneX(context2) { + return new MonotoneX(context2); + } + function monotoneY(context2) { + return new MonotoneY(context2); + } + function Natural(context2) { + this._context = context2; + } + Natural.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = []; + this._y = []; + }, + lineEnd: function() { + var x2 = this._x, y2 = this._y, n = x2.length; + if (n) { + this._line ? this._context.lineTo(x2[0], y2[0]) : this._context.moveTo(x2[0], y2[0]); + if (n === 2) { + this._context.lineTo(x2[1], y2[1]); } else { - encoding = length; - length = undefined; - } - } else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); - const remaining = this.length - offset; - if (length === undefined || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError('Attempt to write outside buffer bounds'); - if (!encoding) encoding = 'utf8'; - let loweredCase = false; - for(;;)switch(encoding){ - case 'hex': - return hexWrite(this, string, offset, length); - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length); - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; + var px2 = controlPoints(x2), py2 = controlPoints(y2); + for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { + this._context.bezierCurveTo(px2[0][i0], py2[0][i0], px2[1][i0], py2[1][i0], x2[i1], y2[i1]); + } + } + } + if (this._line || this._line !== 0 && n === 1) this._context.closePath(); + this._line = 1 - this._line; + this._x = this._y = null; + }, + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); } -}; -Buffer.prototype.toJSON = function toJSON() { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - }; -}; -function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) return base64.fromByteArray(buf); - else return base64.fromByteArray(buf.slice(start, end)); -} -function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while(i < end){ - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch(bytesPerSequence){ - case 1: - if (firstByte < 0x80) codePoint = firstByte; - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; - if (tempCodePoint > 0x7F) codePoint = tempCodePoint; - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) codePoint = tempCodePoint; - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) codePoint = tempCodePoint; - } - } + }; + function controlPoints(x2) { + var i, n = x2.length - 1, m2, a2 = new Array(n), b2 = new Array(n), r = new Array(n); + a2[0] = 0, b2[0] = 2, r[0] = x2[0] + 2 * x2[1]; + for (i = 1; i < n - 1; ++i) a2[i] = 1, b2[i] = 4, r[i] = 4 * x2[i] + 2 * x2[i + 1]; + a2[n - 1] = 2, b2[n - 1] = 7, r[n - 1] = 8 * x2[n - 1] + x2[n]; + for (i = 1; i < n; ++i) m2 = a2[i] / b2[i - 1], b2[i] -= m2, r[i] -= m2 * r[i - 1]; + a2[n - 1] = r[n - 1] / b2[n - 1]; + for (i = n - 2; i >= 0; --i) a2[i] = (r[i] - a2[i + 1]) / b2[i]; + b2[n - 1] = (x2[n] + a2[n - 1]) / 2; + for (i = 0; i < n - 1; ++i) b2[i] = 2 * x2[i + 1] - a2[i + 1]; + return [a2, b2]; + } + function curveNatural(context2) { + return new Natural(context2); + } + function Step(context2, t) { + this._context = context2; + this._t = t; + } + Step.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = this._y = NaN; + this._point = 0; + }, + lineEnd: function() { + if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: { + if (this._t <= 0) { + this._context.lineTo(this._x, y2); + this._context.lineTo(x2, y2); + } else { + var x12 = this._x * (1 - this._t) + x2 * this._t; + this._context.lineTo(x12, this._y); + this._context.lineTo(x12, y2); + } + break; } - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD; - bytesPerSequence = 1; - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000; - res.push(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | codePoint & 0x3FF; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); -} -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000; -function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - ; - // Decode in chunks to avoid "call stack size exceeded". - let res = ''; - let i = 0; - while(i < len)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - return res; -} -function asciiSlice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i] & 0x7F); - return ret; -} -function latin1Slice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); - return ret; -} -function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ''; - for(let i = start; i < end; ++i)out += hexSliceLookupTable[buf[i]]; - return out; -} -function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ''; - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for(let i = 0; i < bytes.length - 1; i += 2)res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - return res; -} -Buffer.prototype.slice = function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === undefined ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) start = len; - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) end = len; - if (end < start) end = start; - const newBuf = this.subarray(start, end); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype); - return newBuf; -}; -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); -} -Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - return val; -}; -Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset + --byteLength]; - let mul = 1; - while(byteLength > 0 && (mul *= 0x100))val += this[offset + --byteLength] * mul; - return val; -}; -Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; -}; -Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; -}; -Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; -}; -Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; -}; -Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); -}; -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const lo = first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 256 + this[++offset] * 2 ** 16 + last * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); -}); -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); -}); -Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let i = byteLength; - let mul = 1; - let val = this[offset + --i]; - while(i > 0 && (mul *= 0x100))val += this[offset + --i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 0x80)) return this[offset]; - return (0xff - this[offset] + 1) * -1; -}; -Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; -}; -Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; -}; -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = this[offset + 4] + this[offset + 5] * 256 + this[offset + 6] * 2 ** 16 + (last << 24 // Overflow - ); - return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); -}); -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last); -}); -Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); -}; -Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); -}; -Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); -}; -Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); -}; -function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError('Index out of range'); -} -Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let i = byteLength - 1; - let mul = 1; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; -} -function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; -} -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + this._x = x2, this._y = y2; } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - let i = byteLength - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128); - if (value < 0) value = 0xff + value + 1; - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; -}; -Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - if (value < 0) value = 0xffffffff + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); -} -function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; -} -Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); -}; -function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; -} -Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); -}; -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - // Copy 0 bytes; we're done - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - // Fatal error conditions - if (targetStart < 0) throw new RangeError('targetStart out of bounds'); - if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); - if (end < 0) throw new RangeError('sourceEnd out of bounds'); - // Are we oob? - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) end = target.length - targetStart + start; - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end); - else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); - return len; -}; -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill(val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === 'string') { - encoding = end; - end = this.length; - } - if (encoding !== undefined && typeof encoding !== 'string') throw new TypeError('encoding must be a string'); - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === 'utf8' && code < 128 || encoding === 'latin1') // Fast path: If `val` fits into a single byte, use that numeric value. - val = code; - } - } else if (typeof val === 'number') val = val & 255; - else if (typeof val === 'boolean') val = Number(val); - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) throw new RangeError('Out of range index'); - if (end <= start) return this; - start = start >>> 0; - end = end === undefined ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === 'number') for(i = start; i < end; ++i)this[i] = val; - else { - const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding); - const len = bytes.length; - if (len === 0) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; + }; + function curveStep(context2) { + return new Step(context2, 0.5); + } + function stepBefore(context2) { + return new Step(context2, 0); + } + function stepAfter(context2) { + return new Step(context2, 1); + } + function domCanvas(w2, h2) { + if (typeof document !== "undefined" && document.createElement) { + const c2 = document.createElement("canvas"); + if (c2 && c2.getContext) { + c2.width = w2; + c2.height = h2; + return c2; + } } - return this; -}; -// CUSTOM ERRORS -// ============= -// Simplified versions from Node, changed for Buffer-only usage -const errors = {}; -function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor(){ - super(); - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]`; - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - ; - // Reset the name to the actual name. - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }); + return null; + } + const domImage = () => typeof Image !== "undefined" ? Image : null; + function colors$1(specifier) { + var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0; + while (i < n) colors2[i] = "#" + specifier.slice(i * 6, ++i * 6); + return colors2; + } + const schemeCategory10 = colors$1("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); + const schemeAccent = colors$1("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); + const schemeDark2 = colors$1("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); + const schemeObservable10 = colors$1("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); + const schemePaired = colors$1("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); + const schemePastel1 = colors$1("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); + const schemePastel2 = colors$1("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); + const schemeSet1 = colors$1("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); + const schemeSet2 = colors$1("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); + const schemeSet3 = colors$1("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); + function bandSpace(count2, paddingInner, paddingOuter) { + const space = count2 - paddingInner + paddingOuter * 2; + return count2 ? space > 0 ? space : 1 : 0; + } + const Identity = "identity"; + const Linear = "linear"; + const Log = "log"; + const Pow = "pow"; + const Sqrt = "sqrt"; + const Symlog = "symlog"; + const Time = "time"; + const UTC = "utc"; + const Sequential = "sequential"; + const Diverging = "diverging"; + const Quantile = "quantile"; + const Quantize = "quantize"; + const Threshold = "threshold"; + const Ordinal = "ordinal"; + const Point = "point"; + const Band = "band"; + const BinOrdinal = "bin-ordinal"; + const Continuous = "continuous"; + const Discrete$1 = "discrete"; + const Discretizing = "discretizing"; + const Interpolating = "interpolating"; + const Temporal = "temporal"; + function invertRange(scale2) { + return function(_) { + let lo = _[0], hi = _[1], t; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + return [scale2.invert(lo), scale2.invert(hi)]; + }; + } + function invertRangeExtent(scale2) { + return function(_) { + const range2 = scale2.range(); + let lo = _[0], hi = _[1], min2 = -1, max2, t, i, n; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + for (i = 0, n = range2.length; i < n; ++i) { + if (range2[i] >= lo && range2[i] <= hi) { + if (min2 < 0) min2 = i; + max2 = i; } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; -} -E('ERR_BUFFER_OUT_OF_BOUNDS', function(name) { - if (name) return `${name} is outside of buffer bounds`; - return 'Attempt to access memory outside buffer bounds'; -}, RangeError); -E('ERR_INVALID_ARG_TYPE', function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; -}, TypeError); -E('ERR_OUT_OF_RANGE', function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) received = addNumericalSeparator(String(input)); - else if (typeof input === 'bigint') { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) received = addNumericalSeparator(received); - received += 'n'; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; -}, RangeError); -function addNumericalSeparator(val) { - let res = ''; - let i = val.length; - const start = val[0] === '-' ? 1 : 0; - for(; i >= start + 4; i -= 3)res = `_${val.slice(i - 3, i)}${res}`; - return `${val.slice(0, i)}${res}`; -} -// CHECK FUNCTIONS -// =============== -function checkBounds(buf, offset, byteLength) { - validateNumber(offset, 'offset'); - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) boundsError(offset, buf.length - (byteLength + 1)); -} -function checkIntBI(value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : ''; - let range; - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; - else range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}`; - } else range = `>= ${min}${n} and <= ${max}${n}`; - throw new errors.ERR_OUT_OF_RANGE('value', range, value); - } - checkBounds(buf, offset, byteLength); -} -function validateNumber(value, name) { - if (typeof value !== 'number') throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value); -} -function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value); - } - if (length < 0) throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', `>= ${type ? 1 : 0} and <= ${length}`, value); -} -// HELPER FUNCTIONS -// ================ -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; -function base64clean(str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0]; - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, ''); - // Node converts strings with length < 2 to '' - if (str.length < 2) return ''; - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while(str.length % 4 !== 0)str = str + '='; - return str; -} -function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for(let i = 0; i < length; ++i){ - codePoint = string.charCodeAt(i); - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - // valid lead - leadSurrogate = codePoint; - continue; - } - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - leadSurrogate = codePoint; - continue; - } - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; - } else if (leadSurrogate) // valid bmp char, but last char was a lead - { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - } - leadSurrogate = null; - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break; - bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break; - bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break; - bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else throw new Error('Invalid code point'); - } - return bytes; -} -function asciiToBytes(str) { - const byteArray = []; - for(let i = 0; i < str.length; ++i)// Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF); - return byteArray; -} -function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for(let i = 0; i < str.length; ++i){ - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; -} -function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); -} -function blitBuffer(src, dst, offset, length) { - let i; - for(i = 0; i < length; ++i){ - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; + } + if (min2 < 0) return void 0; + lo = scale2.invertExtent(range2[min2]); + hi = scale2.invertExtent(range2[max2]); + return [lo[0] === void 0 ? lo[1] : lo[0], hi[1] === void 0 ? hi[0] : hi[1]]; + }; + } + function band() { + const scale2 = ordinal().unknown(void 0), domain2 = scale2.domain, ordinalRange = scale2.range; + let range$12 = [0, 1], step, bandwidth2, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; + delete scale2.unknown; + function rescale() { + const n = domain2().length, reverse2 = range$12[1] < range$12[0], stop2 = range$12[1 - reverse2], space = bandSpace(n, paddingInner, paddingOuter); + let start = range$12[reverse2 - 0]; + step = (stop2 - start) / (space || 1); + if (round) { + step = Math.floor(step); + } + start += (stop2 - start - step * (n - paddingInner)) * align; + bandwidth2 = step * (1 - paddingInner); + if (round) { + start = Math.round(start); + bandwidth2 = Math.round(bandwidth2); + } + const values2 = range$3(n).map((i) => start + step * i); + return ordinalRange(reverse2 ? values2.reverse() : values2); } - return i; -} -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; -} -function numberIsNaN(obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare - ; -} -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = function() { - const alphabet = '0123456789abcdef'; - const table = new Array(256); - for(let i = 0; i < 16; ++i){ - const i16 = i * 16; - for(let j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; - } - return table; -}(); -// Return not function with Error if BigInt not supported -function defineBigIntMethod(fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn; -} -function BufferBigIntNotDefined() { - throw new Error('BigInt not supported'); -} - -},{"9c62938f1dccc73c":"7jAMi","aceacb6a4531a9d2":"hITcF"}],"7jAMi":[function(require,module,exports,__globalThis) { -'use strict'; -exports.byteLength = byteLength; -exports.toByteArray = toByteArray; -exports.fromByteArray = fromByteArray; -var lookup = []; -var revLookup = []; -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -for(var i = 0, len = code.length; i < len; ++i){ - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; -} -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62; -revLookup['_'.charCodeAt(0)] = 63; -function getLens(b64) { - var len = b64.length; - if (len % 4 > 0) throw new Error('Invalid string. Length must be a multiple of 4'); - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('='); - if (validLen === -1) validLen = len; - var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; - return [ - validLen, - placeHoldersLen - ]; -} -// base64 is 4/3 + up to two characters of the original data -function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i; - for(i = 0; i < len; i += 4){ - tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[curByte++] = tmp >> 16 & 0xFF; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - return arr; -} -function tripletToBase64(num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; -} -function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for(var i = start; i < end; i += 3){ - tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); - output.push(tripletToBase64(tmp)); - } - return output.join(''); -} -function fromByteArray(uint8) { - var tmp; - var len = uint8.length; - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - ; - var parts = []; - var maxChunkLength = 16383 // must be multiple of 3 - ; - // go through the array every three bytes, we'll deal with trailing stuff later - for(var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1]; - parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); - } - return parts.join(''); -} - -},{}],"hITcF":[function(require,module,exports,__globalThis) { -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ exports.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for(; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for(; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - if (e === 0) e = 1 - eBias; - else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity; - else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; -exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) value += rt / c; - else value += rt * Math.pow(2, 1 - eBias); - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for(; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for(; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - buffer[offset + i - d] |= s * 128; -}; - -},{}],"dYJ1x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dsvFormat", ()=>(0, _dsvJsDefault.default)); -parcelHelpers.export(exports, "csvParse", ()=>(0, _csvJs.csvParse)); -parcelHelpers.export(exports, "csvParseRows", ()=>(0, _csvJs.csvParseRows)); -parcelHelpers.export(exports, "csvFormat", ()=>(0, _csvJs.csvFormat)); -parcelHelpers.export(exports, "csvFormatBody", ()=>(0, _csvJs.csvFormatBody)); -parcelHelpers.export(exports, "csvFormatRows", ()=>(0, _csvJs.csvFormatRows)); -parcelHelpers.export(exports, "csvFormatRow", ()=>(0, _csvJs.csvFormatRow)); -parcelHelpers.export(exports, "csvFormatValue", ()=>(0, _csvJs.csvFormatValue)); -parcelHelpers.export(exports, "tsvParse", ()=>(0, _tsvJs.tsvParse)); -parcelHelpers.export(exports, "tsvParseRows", ()=>(0, _tsvJs.tsvParseRows)); -parcelHelpers.export(exports, "tsvFormat", ()=>(0, _tsvJs.tsvFormat)); -parcelHelpers.export(exports, "tsvFormatBody", ()=>(0, _tsvJs.tsvFormatBody)); -parcelHelpers.export(exports, "tsvFormatRows", ()=>(0, _tsvJs.tsvFormatRows)); -parcelHelpers.export(exports, "tsvFormatRow", ()=>(0, _tsvJs.tsvFormatRow)); -parcelHelpers.export(exports, "tsvFormatValue", ()=>(0, _tsvJs.tsvFormatValue)); -parcelHelpers.export(exports, "autoType", ()=>(0, _autoTypeJsDefault.default)); -var _dsvJs = require("./dsv.js"); -var _dsvJsDefault = parcelHelpers.interopDefault(_dsvJs); -var _csvJs = require("./csv.js"); -var _tsvJs = require("./tsv.js"); -var _autoTypeJs = require("./autoType.js"); -var _autoTypeJsDefault = parcelHelpers.interopDefault(_autoTypeJs); - -},{"./dsv.js":"kLCST","./csv.js":false,"./tsv.js":false,"./autoType.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kLCST":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - function parseRows(text, f) { - var rows = [], N = text.length, I = 0, n = 0, t, eof = N <= 0, eol = false; // current token followed by EOL? - // Strip the trailing newline. - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; - // Unescape quotes. - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while(I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); - if ((i = I) >= N) eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } - // Find next delimiter or newline. - while(I < N){ - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } else if (c !== DELIMITER) continue; - return text.slice(j, i); - } - // Return last token before EOF. - return eof = true, text.slice(j, N); - } - while((t = token()) !== EOF){ - var row = []; - while(t !== EOL && t !== EOF)row.push(t), t = token(); - if (f && (row = f(row, n++)) == null) continue; - rows.push(row); - } - return rows; - } - function preformatBody(rows, columns) { - return rows.map(function(row) { - return columns.map(function(column) { - return formatValue(row[column]); - }).join(delimiter); - }); - } - function format(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return [ - columns.map(formatValue).join(delimiter) - ].concat(preformatBody(rows, columns)).join("\n"); - } - function formatBody(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return preformatBody(rows, columns).join("\n"); - } - function formatRows(rows) { - return rows.map(formatRow).join("\n"); - } - function formatRow(row) { - return row.map(formatValue).join(delimiter); - } - function formatValue(value) { - return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; - } - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; - }); -var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; -function objectConverter(columns) { - return new Function("d", "return {" + columns.map(function(name, i) { - return JSON.stringify(name) + ": d[" + i + "] || \"\""; - }).join(",") + "}"); -} -function customConverter(columns, f) { - var object = objectConverter(columns); - return function(row, i) { - return f(object(row), i, columns); + scale2.domain = function(_) { + if (arguments.length) { + domain2(_); + return rescale(); + } else { + return domain2(); + } + }; + scale2.range = function(_) { + if (arguments.length) { + range$12 = [+_[0], +_[1]]; + return rescale(); + } else { + return range$12.slice(); + } + }; + scale2.rangeRound = function(_) { + range$12 = [+_[0], +_[1]]; + round = true; + return rescale(); + }; + scale2.bandwidth = function() { + return bandwidth2; + }; + scale2.step = function() { + return step; + }; + scale2.round = function(_) { + if (arguments.length) { + round = !!_; + return rescale(); + } else { + return round; + } + }; + scale2.padding = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + paddingInner = paddingOuter; + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingInner = function(_) { + if (arguments.length) { + paddingInner = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingOuter = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingOuter; + } + }; + scale2.align = function(_) { + if (arguments.length) { + align = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return align; + } + }; + scale2.invertRange = function(_) { + if (_[0] == null || _[1] == null) return; + const reverse2 = range$12[1] < range$12[0], values2 = reverse2 ? ordinalRange().reverse() : ordinalRange(), n = values2.length - 1; + let lo = +_[0], hi = +_[1], a2, b2, t; + if (lo !== lo || hi !== hi) return; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + if (hi < values2[0] || lo > range$12[1 - reverse2]) return; + a2 = Math.max(0, bisectRight$1(values2, lo) - 1); + b2 = lo === hi ? a2 : bisectRight$1(values2, hi) - 1; + if (lo - values2[a2] > bandwidth2 + 1e-10) ++a2; + if (reverse2) { + t = a2; + a2 = n - b2; + b2 = n - t; + } + return a2 > b2 ? void 0 : domain2().slice(a2, b2 + 1); + }; + scale2.invert = function(_) { + const value2 = scale2.invertRange([_, _]); + return value2 ? value2[0] : value2; + }; + scale2.copy = function() { + return band().domain(domain2()).range(range$12).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); }; -} -// Compute unique columns in order of discovery. -function inferColumns(rows) { - var columnSet = Object.create(null), columns = []; - rows.forEach(function(row) { - for(var column in row)if (!(column in columnSet)) columns.push(columnSet[column] = column); - }); - return columns; -} -function pad(value, width) { - var s = value + "", length = s.length; - return length < width ? new Array(width - length + 1).join(0) + s : s; -} -function formatYear(year) { - return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); -} -function formatDate(date) { - var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"esWvi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bbox", ()=>(0, _bboxJsDefault.default)); -parcelHelpers.export(exports, "feature", ()=>(0, _featureJsDefault.default)); -parcelHelpers.export(exports, "mesh", ()=>(0, _meshJsDefault.default)); -parcelHelpers.export(exports, "meshArcs", ()=>(0, _meshJs.meshArcs)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "mergeArcs", ()=>(0, _mergeJs.mergeArcs)); -parcelHelpers.export(exports, "neighbors", ()=>(0, _neighborsJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "transform", ()=>(0, _transformJsDefault.default)); -parcelHelpers.export(exports, "untransform", ()=>(0, _untransformJsDefault.default)); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _featureJs = require("./feature.js"); -var _featureJsDefault = parcelHelpers.interopDefault(_featureJs); -var _meshJs = require("./mesh.js"); -var _meshJsDefault = parcelHelpers.interopDefault(_meshJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _neighborsJs = require("./neighbors.js"); -var _neighborsJsDefault = parcelHelpers.interopDefault(_neighborsJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"4TJoC","./feature.js":"jKknB","./mesh.js":"lhGnJ","./merge.js":"JJVBO","./neighbors.js":"4qqBD","./quantize.js":"dGt9E","./transform.js":"fErFZ","./untransform.js":"hdkvK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4TJoC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - var t = (0, _transformJsDefault.default)(topology.transform), key, x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; - function bboxPoint(p) { - p = t(p); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - function bboxGeometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(bboxGeometry); - break; - case "Point": - bboxPoint(o.coordinates); - break; - case "MultiPoint": - o.coordinates.forEach(bboxPoint); - break; - } - } - topology.arcs.forEach(function(arc) { - var i = -1, n = arc.length, p; - while(++i < n){ - p = t(arc[i], i); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - }); - for(key in topology.objects)bboxGeometry(topology.objects[key]); - return [ - x0, - y0, - x1, - y1 - ]; - }); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./transform.js":"fErFZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fErFZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - while(j < n)output[j] = input[j], ++j; - return output; - }; - }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"3Ojm8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Ojm8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jKknB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function(o) { - return feature(topology, o); - }) - } : feature(topology, o); - }); -parcelHelpers.export(exports, "object", ()=>object); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -function feature(topology, o) { - var id = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o); - return id == null && bbox == null ? { - type: "Feature", - properties: properties, - geometry: geometry - } : bbox == null ? { - type: "Feature", - id: id, - properties: properties, - geometry: geometry - } : { - type: "Feature", - id: id, - bbox: bbox, - properties: properties, - geometry: geometry - }; -} -function object(topology, o) { - var transformPoint = (0, _transformJsDefault.default)(topology.transform), arcs = topology.arcs; - function arc(i, points) { - if (points.length) points.pop(); - for(var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k)points.push(transformPoint(a[k], k)); - if (i < 0) (0, _reverseJsDefault.default)(points, n); - } - function point(p) { - return transformPoint(p); - } - function line(arcs) { - var points = []; - for(var i = 0, n = arcs.length; i < n; ++i)arc(arcs[i], points); - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - return points; - } - function ring(arcs) { - var points = line(arcs); - while(points.length < 4)points.push(points[0]); // This may happen if an arc has only two points. - return points; - } - function polygon(arcs) { - return arcs.map(ring); - } - function geometry(o) { - var type = o.type, coordinates; - switch(type){ - case "GeometryCollection": - return { - type: type, - geometries: o.geometries.map(geometry) - }; - case "Point": - coordinates = point(o.coordinates); - break; - case "MultiPoint": - coordinates = o.coordinates.map(point); - break; - case "LineString": - coordinates = line(o.arcs); - break; - case "MultiLineString": - coordinates = o.arcs.map(line); - break; - case "Polygon": - coordinates = polygon(o.arcs); - break; - case "MultiPolygon": - coordinates = o.arcs.map(polygon); - break; - default: - return null; - } - return { - type: type, - coordinates: coordinates - }; + return rescale(); + } + function pointish(scale2) { + const copy2 = scale2.copy; + scale2.padding = scale2.paddingOuter; + delete scale2.paddingInner; + scale2.copy = function() { + return pointish(copy2()); + }; + return scale2; + } + function point$1() { + return pointish(band().paddingInner(1)); + } + var map = Array.prototype.map; + function numbers(_) { + return map.call(_, toNumber); + } + const slice$1 = Array.prototype.slice; + function scaleBinOrdinal() { + let domain2 = [], range2 = []; + function scale2(x2) { + return x2 == null || x2 !== x2 ? void 0 : range2[(bisectRight$1(domain2, x2) - 1) % range2.length]; + } + scale2.domain = function(_) { + if (arguments.length) { + domain2 = numbers(_); + return scale2; + } else { + return domain2.slice(); + } + }; + scale2.range = function(_) { + if (arguments.length) { + range2 = slice$1.call(_); + return scale2; + } else { + return range2.slice(); + } + }; + scale2.tickFormat = function(count2, specifier) { + return tickFormat$1(domain2[0], peek$1(domain2), count2 == null ? 10 : count2, specifier); + }; + scale2.copy = function() { + return scaleBinOrdinal().domain(scale2.domain()).range(scale2.range()); + }; + return scale2; + } + const scales = /* @__PURE__ */ new Map(); + const VEGA_SCALE = Symbol("vega_scale"); + function registerScale(scale2) { + scale2[VEGA_SCALE] = true; + return scale2; + } + function isRegisteredScale(scale2) { + return scale2 && scale2[VEGA_SCALE] === true; + } + function create$2(type2, constructor, metadata2) { + const ctr = function scale2() { + const s2 = constructor(); + if (!s2.invertRange) { + s2.invertRange = s2.invert ? invertRange(s2) : s2.invertExtent ? invertRangeExtent(s2) : void 0; + } + s2.type = type2; + return registerScale(s2); + }; + ctr.metadata = toSet(array$4(metadata2)); + return ctr; + } + function scale$4(type2, scale2, metadata2) { + if (arguments.length > 1) { + scales.set(type2, create$2(type2, scale2, metadata2)); + return this; + } else { + return isValidScaleType(type2) ? scales.get(type2) : void 0; } - return geometry(o); -} - -},{"./reverse.js":"fIOxk","./transform.js":"fErFZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fIOxk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(array, n) { - var t, j = array.length, i = j - n; - while(i < --j)t = array[i], array[i++] = array[j], array[j] = t; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lhGnJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, meshArcs.apply(this, arguments)); - }); -parcelHelpers.export(exports, "meshArcs", ()=>meshArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter); - else for(i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i)arcs[i] = i; - return { - type: "MultiLineString", - arcs: (0, _stitchJsDefault.default)(topology, arcs) + } + scale$4(Identity, identity$4); + scale$4(Linear, linear$1, Continuous); + scale$4(Log, log$4, [Continuous, Log]); + scale$4(Pow, pow$4, Continuous); + scale$4(Sqrt, sqrt$3, Continuous); + scale$4(Symlog, symlog$1, Continuous); + scale$4(Time, time$1, [Continuous, Temporal]); + scale$4(UTC, utcTime, [Continuous, Temporal]); + scale$4(Sequential, sequential, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Log}`, sequentialLog, [Continuous, Interpolating, Log]); + scale$4(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Linear}`, diverging$1, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Log}`, divergingLog, [Continuous, Interpolating, Log]); + scale$4(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); + scale$4(Quantile, quantile, [Discretizing, Quantile]); + scale$4(Quantize, quantize$1, Discretizing); + scale$4(Threshold, threshold, Discretizing); + scale$4(BinOrdinal, scaleBinOrdinal, [Discrete$1, Discretizing]); + scale$4(Ordinal, ordinal, Discrete$1); + scale$4(Band, band, Discrete$1); + scale$4(Point, point$1, Discrete$1); + function isValidScaleType(type2) { + return scales.has(type2); + } + function hasType(key2, type2) { + const s2 = scales.get(key2); + return s2 && s2.metadata[type2]; + } + function isContinuous(key2) { + return hasType(key2, Continuous); + } + function isDiscrete(key2) { + return hasType(key2, Discrete$1); + } + function isDiscretizing(key2) { + return hasType(key2, Discretizing); + } + function isLogarithmic(key2) { + return hasType(key2, Log); + } + function isTemporal(key2) { + return hasType(key2, Temporal); + } + function isInterpolating(key2) { + return hasType(key2, Interpolating); + } + function isQuantile(key2) { + return hasType(key2, Quantile); + } + const scaleProps = ["clamp", "base", "constant", "exponent"]; + function interpolateRange(interpolator, range2) { + const start = range2[0], span2 = peek$1(range2) - start; + return function(i) { + return interpolator(start + i * span2); }; -} -function extractArcs(topology, object, filter) { - var arcs = [], geomsByArc = [], geom; - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({ - i: i, - g: geom - }); + } + function interpolateColors(colors2, type2, gamma2) { + return piecewise(interpolate(type2 || "rgb", gamma2), colors2); + } + function quantizeInterpolator(interpolator, count2) { + const samples = new Array(count2), n = count2 + 1; + for (let i = 0; i < count2; ) samples[i] = interpolator(++i / n); + return samples; + } + function scaleFraction(scale$12, min2, max2) { + const delta = max2 - min2; + let i, t, s2; + if (!delta || !Number.isFinite(delta)) { + return constant$4(0.5); + } else { + i = (t = scale$12.type).indexOf("-"); + t = i < 0 ? t : t.slice(i + 1); + s2 = scale$4(t)().domain([min2, max2]).range([0, 1]); + scaleProps.forEach((m2) => scale$12[m2] ? s2[m2](scale$12[m2]()) : 0); + return s2; } - function extract1(arcs) { - arcs.forEach(extract0); + } + function interpolate(type2, gamma2) { + const interp = $$1[method(type2)]; + return gamma2 != null && interp && interp.gamma ? interp.gamma(gamma2) : interp; + } + function method(type2) { + return "interpolate" + type2.toLowerCase().split("-").map((s2) => s2[0].toUpperCase() + s2.slice(1)).join(""); + } + const continuous = { + blues: "cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90", + greens: "d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429", + greys: "e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e", + oranges: "fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303", + purples: "e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c", + reds: "fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13", + blueGreen: "d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429", + bluePurple: "ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71", + greenBlue: "d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1", + orangeRed: "fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403", + purpleBlue: "dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281", + purpleBlueGreen: "dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353", + purpleRed: "dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a", + redPurple: "fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174", + yellowGreen: "e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034", + yellowOrangeBrown: "feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204", + yellowOrangeRed: "fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225", + blueOrange: "134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07", + brownBlueGreen: "704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147", + purpleGreen: "5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29", + purpleOrange: "4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07", + redBlue: "8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85", + redGrey: "8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434", + yellowGreenBlue: "eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185", + redYellowBlue: "a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695", + redYellowGreen: "a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837", + pinkYellowGreen: "8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419", + spectral: "9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2", + viridis: "440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725", + magma: "0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf", + inferno: "0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4", + plasma: "0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921", + cividis: "00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647", + rainbow: "6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa", + sinebow: "ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040", + turbo: "23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00", + browns: "eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632", + tealBlues: "bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985", + teals: "bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667", + warmGreys: "dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e", + goldGreen: "f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36", + goldOrange: "f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26", + goldRed: "f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e", + lightGreyRed: "efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b", + lightGreyTeal: "e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc", + lightMulti: "e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c", + lightOrange: "f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b", + lightTealBlue: "e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988", + darkBlue: "3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff", + darkGold: "3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff", + darkGreen: "3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa", + darkMulti: "3737371f5287197d8c29a86995ce3fffe800ffffff", + darkRed: "3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c" + }; + const discrete = { + accent: schemeAccent, + category10: schemeCategory10, + category20: "1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5", + category20b: "393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6", + category20c: "3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9", + dark2: schemeDark2, + observable10: schemeObservable10, + paired: schemePaired, + pastel1: schemePastel1, + pastel2: schemePastel2, + set1: schemeSet1, + set2: schemeSet2, + set3: schemeSet3, + tableau10: "4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac", + tableau20: "4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5" + }; + function colors(palette) { + if (isArray(palette)) return palette; + const n = palette.length / 6 | 0, c2 = new Array(n); + for (let i = 0; i < n; ) { + c2[i] = "#" + palette.slice(i * 6, ++i * 6); } - function extract2(arcs) { - arcs.forEach(extract1); + return c2; + } + function apply(_, f) { + for (const k in _) scheme(k, f(_[k])); + } + const schemes = {}; + apply(discrete, colors); + apply(continuous, (_) => interpolateColors(colors(_))); + function scheme(name, scheme2) { + name = name && name.toLowerCase(); + if (arguments.length > 1) { + schemes[name] = scheme2; + return this; + } else { + return schemes[name]; } - function extract3(arcs) { - arcs.forEach(extract2); + } + const SymbolLegend = "symbol"; + const DiscreteLegend = "discrete"; + const GradientLegend = "gradient"; + const defaultFormatter = (value2) => isArray(value2) ? value2.map((v) => String(v)) : String(value2); + const ascending = (a2, b2) => a2[1] - b2[1]; + const descending = (a2, b2) => b2[1] - a2[1]; + function tickCount(scale2, count2, minStep) { + let step; + if (isNumber$1(count2)) { + if (scale2.bins) { + count2 = Math.max(count2, scale2.bins.length); + } + if (minStep != null) { + count2 = Math.min(count2, Math.floor(span(scale2.domain()) / minStep || 1) + 1); + } } - function geometry(o) { - switch(geom = o, o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "LineString": - extract1(o.arcs); - break; - case "MultiLineString": - case "Polygon": - extract2(o.arcs); - break; - case "MultiPolygon": - extract3(o.arcs); - break; - } + if (isObject(count2)) { + step = count2.step; + count2 = count2.interval; } - geometry(object); - geomsByArc.forEach(filter == null ? function(geoms) { - arcs.push(geoms[0].i); - } : function(geoms) { - if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); - }); - return arcs; -} - -},{"./feature.js":"jKknB","./stitch.js":"2rzgE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2rzgE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, arcs) { - var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - }); - arcs.forEach(function(i) { - var e = ends(i), start = e[0], end = e[1], f, g; - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else { - f = [ - i - ]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [ - 0, - 0 - ], arc.forEach(function(dp) { - p1[0] += dp[0], p1[1] += dp[1]; - }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [ - p1, - p0 - ] : [ - p0, - p1 - ]; - } - function flush(fragmentByEnd, fragmentByStart) { - for(var k in fragmentByEnd){ - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { - stitchedArcs[i < 0 ? ~i : i] = 1; - }); - fragments.push(f); - } - } - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { - if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([ - i - ]); - }); - return fragments; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"JJVBO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, mergeArcs.apply(this, arguments)); - }); -parcelHelpers.export(exports, "mergeArcs", ()=>mergeArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function planarRingArea(ring) { - var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; - while(++i < n)a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - return Math.abs(area); // Note: doubled area! -} -function mergeArcs(topology, objects) { - var polygonsByArc = {}, polygons = [], groups = []; - objects.forEach(geometry); - function geometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "Polygon": - extract(o.arcs); - break; - case "MultiPolygon": - o.arcs.forEach(extract); - break; - } + if (isString(count2)) { + count2 = scale2.type === Time ? timeInterval(count2) : scale2.type == UTC ? utcInterval(count2) : error("Only time and utc scales accept interval strings."); + if (step) count2 = count2.every(step); } - function extract(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); + return count2; + } + function validTicks(scale2, ticks2, count2) { + let range2 = scale2.range(), lo = range2[0], hi = peek$1(range2), cmp = ascending; + if (lo > hi) { + range2 = hi; + hi = lo; + lo = range2; + cmp = descending; } - function area(ring) { - return planarRingArea((0, _featureJs.object)(topology, { - type: "Polygon", - arcs: [ - ring - ] - }).coordinates[0]); + lo = Math.floor(lo); + hi = Math.ceil(hi); + ticks2 = ticks2.map((v) => [v, scale2(v)]).filter((_) => lo <= _[1] && _[1] <= hi).sort(cmp).map((_) => _[0]); + if (count2 > 0 && ticks2.length > 1) { + const endpoints = [ticks2[0], peek$1(ticks2)]; + while (ticks2.length > count2 && ticks2.length >= 3) { + ticks2 = ticks2.filter((_, i) => !(i % 2)); + } + if (ticks2.length < 3) { + ticks2 = endpoints; + } } - polygons.forEach(function(polygon) { - if (!polygon._) { - var group = [], neighbors = [ - polygon - ]; - polygon._ = 1; - groups.push(group); - while(polygon = neighbors.pop()){ - group.push(polygon); - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - polygons.forEach(function(polygon) { - delete polygon._; - }); - return { - type: "MultiPolygon", - arcs: groups.map(function(polygons) { - var arcs = [], n; - // Extract the exterior (unique) arcs. - polygons.forEach(function(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) arcs.push(arc); - }); - }); - }); - // Stitch the arcs into one or more rings. - arcs = (0, _stitchJsDefault.default)(topology, arcs); - // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - if ((n = arcs.length) > 1) { - for(var i = 1, k = area(arcs[0]), ki, t; i < n; ++i)if ((ki = area(arcs[i])) > k) t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - return arcs; - }).filter(function(arcs) { - return arcs.length > 0; - }) - }; -} - -},{"./feature.js":"jKknB","./stitch.js":"2rzgE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4qqBD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(objects) { - var indexesByArc = {}, neighbors = objects.map(function() { - return []; - }); - function line(arcs, i) { - arcs.forEach(function(a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i); - else indexesByArc[a] = [ - i - ]; - }); - } - function polygon(arcs, i) { - arcs.forEach(function(arc) { - line(arc, i); - }); - } - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { - geometry(o, i); - }); - else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs, i) { - arcs.forEach(function(arc) { - polygon(arc, i); - }); - } - }; - objects.forEach(geometry); - for(var i in indexesByArc){ - for(var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j)for(var k = j + 1; k < m; ++k){ - var ij = indexes[j], ik = indexes[k], n; - if ((n = neighbors[ij])[i = (0, _bisectJsDefault.default)(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = (0, _bisectJsDefault.default)(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - return neighbors; - }); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); - -},{"./bisect.js":"hkLok","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hkLok":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, x) { - var lo = 0, hi = a.length; - while(lo < hi){ - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dGt9E":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, transform) { - if (topology.transform) throw new Error("already quantized"); - if (!transform || !transform.scale) { - if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be \u22652"); - box = topology.bbox || (0, _bboxJsDefault.default)(topology); - var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n; - transform = { - scale: [ - x1 - x0 ? (x1 - x0) / (n - 1) : 1, - y1 - y0 ? (y1 - y0) / (n - 1) : 1 - ], - translate: [ - x0, - y0 - ] - }; - } else box = topology.bbox; - var t = (0, _untransformJsDefault.default)(transform), box, key, inputs = topology.objects, outputs = {}; - function quantizePoint(point) { - return t(point); - } - function quantizeGeometry(input) { - var output; - switch(input.type){ - case "GeometryCollection": - output = { - type: "GeometryCollection", - geometries: input.geometries.map(quantizeGeometry) - }; - break; - case "Point": - output = { - type: "Point", - coordinates: quantizePoint(input.coordinates) - }; - break; - case "MultiPoint": - output = { - type: "MultiPoint", - coordinates: input.coordinates.map(quantizePoint) - }; - break; - default: - return input; - } - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; - } - function quantizeArc(input) { - var i = 0, j = 1, n = input.length, p, output = new Array(n); // pessimistic - output[0] = t(input[0], 0); - while(++i < n)if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; // non-coincident points - if (j === 1) output[j++] = [ - 0, - 0 - ]; // an arc must have at least two points - output.length = j; - return output; - } - for(key in inputs)outputs[key] = quantizeGeometry(inputs[key]); - return { - type: "Topology", - bbox: box, - transform: transform, - objects: outputs, - arcs: topology.arcs.map(quantizeArc) - }; - }); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"4TJoC","./untransform.js":"hdkvK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdkvK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky); - output[0] = x1 - x0, x0 = x1; - output[1] = y1 - y0, y0 = y1; - while(j < n)output[j] = input[j], ++j; - return output; - }; - }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"3Ojm8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3VXXV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultLocale", ()=>defaultLocale); -parcelHelpers.export(exports, "locale", ()=>locale); -parcelHelpers.export(exports, "numberFormatDefaultLocale", ()=>numberFormatDefaultLocale); -parcelHelpers.export(exports, "numberFormatLocale", ()=>numberFormatLocale); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>resetDefaultLocale); -parcelHelpers.export(exports, "resetNumberFormatDefaultLocale", ()=>resetNumberFormatDefaultLocale); -parcelHelpers.export(exports, "resetTimeFormatDefaultLocale", ()=>resetTimeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>timeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatLocale", ()=>timeFormatLocale); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _vegaTime = require("vega-time"); -var _vegaUtil = require("vega-util"); -var _d3TimeFormat = require("d3-time-format"); -function memoize(method) { - const cache = {}; - return (spec)=>cache[spec] || (cache[spec] = method(spec)); -} -function trimZeroes(numberFormat, decimalChar) { - return (x)=>{ - const str = numberFormat(x), dec = str.indexOf(decimalChar); - if (dec < 0) return str; - let idx = rightmostDigit(str, dec); - const end = idx < str.length ? str.slice(idx) : ''; - while(--idx > dec)if (str[idx] !== '0') { - ++idx; - break; - } - return str.slice(0, idx) + end; - }; -} -function rightmostDigit(str, dec) { - let i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for(i = str.length; --i > dec;){ - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit + return ticks2; + } + function tickValues(scale2, count2) { + return scale2.bins ? validTicks(scale2, scale2.bins, count2) : scale2.ticks ? scale2.ticks(count2) : scale2.domain(); + } + function tickFormat(locale2, scale2, count2, specifier, formatType, noSkip) { + const type2 = scale2.type; + let format2 = defaultFormatter; + if (type2 === Time || formatType === Time) { + format2 = locale2.timeFormat(specifier); + } else if (type2 === UTC || formatType === UTC) { + format2 = locale2.utcFormat(specifier); + } else if (isLogarithmic(type2)) { + const varfmt = locale2.formatFloat(specifier); + if (noSkip || scale2.bins) { + format2 = varfmt; + } else { + const test2 = tickLog(scale2, count2, false); + format2 = (_) => test2(_) ? varfmt(_) : ""; + } + } else if (scale2.tickFormat) { + const d2 = scale2.domain(); + format2 = locale2.formatSpan(d2[0], d2[d2.length - 1], count2, specifier); + } else if (specifier) { + format2 = locale2.format(specifier); } -} -function numberLocale(locale) { - const format = memoize(locale.format), formatPrefix = locale.formatPrefix; - return { - format, - formatPrefix, - formatFloat (spec) { - const s = (0, _d3Format.formatSpecifier)(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch(s.type){ - case '%': - s.precision -= 2; - break; - case 'e': - s.precision -= 1; - break; - } - return trimZeroes(format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else return format(s); - }, - formatSpan (start, stop, count, specifier) { - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ',f' : specifier); - const step = (0, _d3Array.tickStep)(start, stop, count), value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - if (specifier.precision == null) switch(specifier.type){ - case 's': - if (!isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - case '': - case 'e': - case 'g': - case 'p': - case 'r': - if (!isNaN(precision = (0, _d3Format.precisionRound)(step, value))) specifier.precision = precision - (specifier.type === 'e'); - break; - case 'f': - case '%': - if (!isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === '%') * 2; - break; - } - return format(specifier); - } - }; -} -let defaultNumberLocale; -resetNumberFormatDefaultLocale(); -function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: (0, _d3Format.format), - formatPrefix: (0, _d3Format.formatPrefix) - }); -} -function numberFormatLocale(definition) { - return numberLocale((0, _d3Format.formatLocale)(definition)); -} -function numberFormatDefaultLocale(definition) { - return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale; -} -function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)(`Invalid time multi-format specifier: ${spec}`); - const second = interval((0, _vegaTime.SECONDS)), minute = interval((0, _vegaTime.MINUTES)), hour = interval((0, _vegaTime.HOURS)), day = interval((0, _vegaTime.DATE)), week = interval((0, _vegaTime.WEEK)), month = interval((0, _vegaTime.MONTH)), quarter = interval((0, _vegaTime.QUARTER)), year = interval((0, _vegaTime.YEAR)), L = format(spec[0, _vegaTime.MILLISECONDS] || '.%L'), S = format(spec[0, _vegaTime.SECONDS] || ':%S'), M = format(spec[0, _vegaTime.MINUTES] || '%I:%M'), H = format(spec[0, _vegaTime.HOURS] || '%I %p'), d = format(spec[0, _vegaTime.DATE] || spec[0, _vegaTime.DAY] || '%a %d'), w = format(spec[0, _vegaTime.WEEK] || '%b %d'), m = format(spec[0, _vegaTime.MONTH] || '%B'), q = format(spec[0, _vegaTime.QUARTER] || '%B'), y = format(spec[0, _vegaTime.YEAR] || '%Y'); - return (date)=>(second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date); -} -function timeLocale(locale) { - const timeFormat = memoize(locale.format), utcFormat = memoize(locale.utcFormat); - return { - timeFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? timeFormat(spec) : timeMultiFormat(timeFormat, (0, _vegaTime.timeInterval), spec), - utcFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? utcFormat(spec) : timeMultiFormat(utcFormat, (0, _vegaTime.utcInterval), spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; -} -let defaultTimeLocale; -resetTimeFormatDefaultLocale(); -function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: (0, _d3TimeFormat.timeFormat), - parse: (0, _d3TimeFormat.timeParse), - utcFormat: (0, _d3TimeFormat.utcFormat), - utcParse: (0, _d3TimeFormat.utcParse) - }); -} -function timeFormatLocale(definition) { - return timeLocale((0, _d3TimeFormat.timeFormatLocale)(definition)); -} -function timeFormatDefaultLocale(definition) { - return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale; -} -const createLocale = (number, time)=>(0, _vegaUtil.extend)({}, number, time); -function locale(numberSpec, timeSpec) { - const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); - const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); - return createLocale(number, time); -} -function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) (0, _vegaUtil.error)('defaultLocale expects either zero or two arguments.'); - return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); -} -function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); -} - -},{"d3-array":"5lCYW","d3-format":"4fjQY","vega-time":"kjkWX","vega-util":"f2ulH","d3-time-format":"eC6Bi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kjkWX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATE", ()=>DATE); -parcelHelpers.export(exports, "DAY", ()=>DAY); -parcelHelpers.export(exports, "DAYOFYEAR", ()=>DAYOFYEAR); -parcelHelpers.export(exports, "HOURS", ()=>HOURS); -parcelHelpers.export(exports, "MILLISECONDS", ()=>MILLISECONDS); -parcelHelpers.export(exports, "MINUTES", ()=>MINUTES); -parcelHelpers.export(exports, "MONTH", ()=>MONTH); -parcelHelpers.export(exports, "QUARTER", ()=>QUARTER); -parcelHelpers.export(exports, "SECONDS", ()=>SECONDS); -parcelHelpers.export(exports, "TIME_UNITS", ()=>TIME_UNITS); -parcelHelpers.export(exports, "WEEK", ()=>WEEK); -parcelHelpers.export(exports, "YEAR", ()=>YEAR); -parcelHelpers.export(exports, "dayofyear", ()=>dayofyear); -parcelHelpers.export(exports, "timeBin", ()=>bin); -parcelHelpers.export(exports, "timeFloor", ()=>timeFloor); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -parcelHelpers.export(exports, "timeOffset", ()=>timeOffset); -parcelHelpers.export(exports, "timeSequence", ()=>timeSequence); -parcelHelpers.export(exports, "timeUnitSpecifier", ()=>timeUnitSpecifier); -parcelHelpers.export(exports, "timeUnits", ()=>timeUnits); -parcelHelpers.export(exports, "utcFloor", ()=>utcFloor); -parcelHelpers.export(exports, "utcInterval", ()=>utcInterval); -parcelHelpers.export(exports, "utcOffset", ()=>utcOffset); -parcelHelpers.export(exports, "utcSequence", ()=>utcSequence); -parcelHelpers.export(exports, "utcdayofyear", ()=>utcdayofyear); -parcelHelpers.export(exports, "utcweek", ()=>utcweek); -parcelHelpers.export(exports, "week", ()=>week); -var _vegaUtil = require("vega-util"); -var _d3Time = require("d3-time"); -var _d3Array = require("d3-array"); -const YEAR = 'year'; -const QUARTER = 'quarter'; -const MONTH = 'month'; -const WEEK = 'week'; -const DATE = 'date'; -const DAY = 'day'; -const DAYOFYEAR = 'dayofyear'; -const HOURS = 'hours'; -const MINUTES = 'minutes'; -const SECONDS = 'seconds'; -const MILLISECONDS = 'milliseconds'; -const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -]; -const UNITS = TIME_UNITS.reduce((o, u, i)=>(o[u] = 1 + i, o), {}); -function timeUnits(units) { - const u = (0, _vegaUtil.array)(units).slice(), m = {}; - // check validity - if (!u.length) (0, _vegaUtil.error)('Missing time unit.'); - u.forEach((unit)=>{ - if ((0, _vegaUtil.hasOwnProperty)(UNITS, unit)) m[unit] = 1; - else (0, _vegaUtil.error)(`Invalid time unit: ${unit}.`); - }); - const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); - if (numTypes > 1) (0, _vegaUtil.error)(`Incompatible time units: ${units}`); - // ensure proper sort order - u.sort((a, b)=>UNITS[a] - UNITS[b]); - return u; -} -const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' -}; -function timeUnitSpecifier(units, specifiers) { - const s = (0, _vegaUtil.extend)({}, defaultSpecifiers, specifiers), u = timeUnits(units), n = u.length; - let fmt = '', start = 0, end, key; - for(start = 0; start < n;)for(end = u.length; end > start; --end){ - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } + return format2; + } + function tickLog(scale2, count2, values2) { + const ticks2 = tickValues(scale2, count2), base2 = scale2.base(), logb = Math.log(base2), k = Math.max(1, base2 * count2 / ticks2.length); + const test2 = (d2) => { + let i = d2 / Math.pow(base2, Math.round(Math.log(d2) / logb)); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k; + }; + return values2 ? ticks2.filter(test2) : test2; + } + const symbols$1 = { + [Quantile]: "quantiles", + [Quantize]: "thresholds", + [Threshold]: "domain" + }; + const formats = { + [Quantile]: "quantiles", + [Quantize]: "domain" + }; + function labelValues(scale2, count2) { + return scale2.bins ? binValues(scale2.bins) : scale2.type === Log ? tickLog(scale2, count2, true) : symbols$1[scale2.type] ? thresholdValues(scale2[symbols$1[scale2.type]]()) : tickValues(scale2, count2); + } + function thresholdFormat(locale2, scale2, specifier) { + const _ = scale2[formats[scale2.type]](), n = _.length; + let d2 = n > 1 ? _[1] - _[0] : _[0], i; + for (i = 1; i < n; ++i) { + d2 = Math.min(d2, _[i] - _[i - 1]); } - return fmt.trim(); -} -const t0 = new Date(); -function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; -} -function dayofyear(d) { - return localDayOfYear(new Date(d)); -} -function week(d) { - return localWeekNum(new Date(d)); -} -function localDayOfYear(d) { - return (0, _d3Time.timeDay).count(localYear(d.getFullYear()) - 1, d); -} -function localWeekNum(d) { - return (0, _d3Time.timeWeek).count(localYear(d.getFullYear()) - 1, d); -} -function localFirst(y) { - return localYear(y).getDay(); -} -function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); -} -function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); -} -function utcweek(d) { - return utcWeekNum(new Date(d)); -} -function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcDay).count(y - 1, d); -} -function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcWeek).count(y - 1, d); -} -function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); -} -function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); -} -function floor(units, step, get, inv, newDate) { - const s = step || 1, b = (0, _vegaUtil.peek)(units), _ = (unit, p, key)=>{ - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - const t = new Date(), u = (0, _vegaUtil.toSet)(units), y = u[YEAR] ? _(YEAR) : (0, _vegaUtil.constant)(2012), m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : (0, _vegaUtil.zero), d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : (0, _vegaUtil.one), H = u[HOURS] ? _(HOURS) : (0, _vegaUtil.zero), M = u[MINUTES] ? _(MINUTES) : (0, _vegaUtil.zero), S = u[SECONDS] ? _(SECONDS) : (0, _vegaUtil.zero), L = u[MILLISECONDS] ? _(MILLISECONDS) : (0, _vegaUtil.zero); - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; -} -function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f : phase ? (d, y)=>phase + step * Math.floor((f(d, y) - phase) / step) : (d, y)=>step * Math.floor(f(d, y) / step); - return inv ? (d, y)=>inv(u(d, y), y) : u; -} -// returns the day of the year based on week number, day of week, -// and the day of the week for the first day of the year -function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; -} -// -- LOCAL TIME -- -const localGet = { - [YEAR]: (d)=>d.getFullYear(), - [QUARTER]: (d)=>Math.floor(d.getMonth() / 3), - [MONTH]: (d)=>d.getMonth(), - [DATE]: (d)=>d.getDate(), - [HOURS]: (d)=>d.getHours(), - [MINUTES]: (d)=>d.getMinutes(), - [SECONDS]: (d)=>d.getSeconds(), - [MILLISECONDS]: (d)=>d.getMilliseconds(), - [DAYOFYEAR]: (d)=>localDayOfYear(d), - [WEEK]: (d)=>localWeekNum(d), - [WEEK + DAY]: (d, y)=>weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y)=>weekday(1, d.getDay(), localFirst(y)) -}; -const localInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, localFirst(y)) -}; -function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); -} -// -- UTC TIME -- -const utcGet = { - [YEAR]: (d)=>d.getUTCFullYear(), - [QUARTER]: (d)=>Math.floor(d.getUTCMonth() / 3), - [MONTH]: (d)=>d.getUTCMonth(), - [DATE]: (d)=>d.getUTCDate(), - [HOURS]: (d)=>d.getUTCHours(), - [MINUTES]: (d)=>d.getUTCMinutes(), - [SECONDS]: (d)=>d.getUTCSeconds(), - [MILLISECONDS]: (d)=>d.getUTCMilliseconds(), - [DAYOFYEAR]: (d)=>utcDayOfYear(d), - [WEEK]: (d)=>utcWeekNum(d), - [DAY]: (d, y)=>weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y)=>weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) -}; -const utcInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, utcFirst(y)) -}; -function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); -} -const timeIntervals = { - [YEAR]: (0, _d3Time.timeYear), - [QUARTER]: (0, _d3Time.timeMonth).every(3), - [MONTH]: (0, _d3Time.timeMonth), - [WEEK]: (0, _d3Time.timeWeek), - [DATE]: (0, _d3Time.timeDay), - [DAY]: (0, _d3Time.timeDay), - [DAYOFYEAR]: (0, _d3Time.timeDay), - [HOURS]: (0, _d3Time.timeHour), - [MINUTES]: (0, _d3Time.timeMinute), - [SECONDS]: (0, _d3Time.timeSecond), - [MILLISECONDS]: (0, _d3Time.timeMillisecond) -}; -const utcIntervals = { - [YEAR]: (0, _d3Time.utcYear), - [QUARTER]: (0, _d3Time.utcMonth).every(3), - [MONTH]: (0, _d3Time.utcMonth), - [WEEK]: (0, _d3Time.utcWeek), - [DATE]: (0, _d3Time.utcDay), - [DAY]: (0, _d3Time.utcDay), - [DAYOFYEAR]: (0, _d3Time.utcDay), - [HOURS]: (0, _d3Time.utcHour), - [MINUTES]: (0, _d3Time.utcMinute), - [SECONDS]: (0, _d3Time.utcSecond), - [MILLISECONDS]: (0, _d3Time.utcMillisecond) -}; -function timeInterval(unit) { - return timeIntervals[unit]; -} -function utcInterval(unit) { - return utcIntervals[unit]; -} -function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; -} -function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); -} -function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); -} -function sequence(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; -} -function timeSequence(unit, start, stop, step) { - return sequence(timeInterval(unit), start, stop, step); -} -function utcSequence(unit, start, stop, step) { - return sequence(utcInterval(unit), start, stop, step); -} -const durationSecond = 1000, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; -const Milli = [ - YEAR, - MONTH, - DATE, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [ - YEAR, - WEEK -], Month = [ - YEAR, - MONTH -], Year = [ - YEAR -]; -const intervals = [ - [ - Seconds, - 1, - durationSecond - ], - [ - Seconds, - 5, - 5 * durationSecond - ], - [ - Seconds, - 15, - 15 * durationSecond - ], - [ - Seconds, - 30, - 30 * durationSecond - ], - [ - Minutes, - 1, - durationMinute - ], - [ - Minutes, - 5, - 5 * durationMinute - ], - [ - Minutes, - 15, - 15 * durationMinute - ], - [ - Minutes, - 30, - 30 * durationMinute - ], - [ - Hours, - 1, - durationHour - ], - [ - Hours, - 3, - 3 * durationHour - ], - [ - Hours, - 6, - 6 * durationHour - ], - [ - Hours, - 12, - 12 * durationHour - ], - [ - Day, - 1, - durationDay - ], - [ - Week, - 1, - durationWeek - ], - [ - Month, - 1, - durationMonth - ], - [ - Month, - 3, - 3 * durationMonth - ], - [ - Year, - 1, - durationYear - ] -]; -function bin(opt) { - const ext = opt.extent, max = opt.maxbins || 40, target = Math.abs((0, _vegaUtil.span)(ext)) / max; - let i = (0, _d3Array.bisector)((i)=>i[2]).right(intervals, target), units, step; - if (i === intervals.length) units = Year, step = (0, _d3Array.tickStep)(ext[0] / durationYear, ext[1] / durationYear, max); - else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; + return locale2.formatSpan(0, d2, 3 * 10, specifier); + } + function thresholdValues(thresholds) { + const values2 = [-Infinity].concat(thresholds); + values2.max = Infinity; + return values2; + } + function binValues(bins) { + const values2 = bins.slice(0, -1); + values2.max = peek$1(bins); + return values2; + } + const isDiscreteRange = (scale2) => symbols$1[scale2.type] || scale2.bins; + function labelFormat(locale2, scale2, count2, type2, specifier, formatType, noSkip) { + const format2 = formats[scale2.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale2, scale2, specifier) : tickFormat(locale2, scale2, count2, specifier, formatType, noSkip); + return type2 === SymbolLegend && isDiscreteRange(scale2) ? formatRange(format2) : type2 === DiscreteLegend ? formatDiscrete(format2) : formatPoint(format2); + } + const formatRange = (format2) => (value2, index2, array2) => { + const limit = get$3(array2[index2 + 1], get$3(array2.max, Infinity)), lo = formatValue$1(value2, format2), hi = formatValue$1(limit, format2); + return lo && hi ? lo + " – " + hi : hi ? "< " + hi : "≥ " + lo; + }; + const get$3 = (value2, dflt) => value2 != null ? value2 : dflt; + const formatDiscrete = (format2) => (value2, index2) => index2 ? format2(value2) : null; + const formatPoint = (format2) => (value2) => format2(value2); + const formatValue$1 = (value2, format2) => Number.isFinite(value2) ? format2(value2) : null; + function labelFraction(scale2) { + const domain2 = scale2.domain(), count2 = domain2.length - 1; + let lo = +domain2[0], hi = +peek$1(domain2), span2 = hi - lo; + if (scale2.type === Threshold) { + const adjust = count2 ? span2 / count2 : 0.1; + lo -= adjust; + hi += adjust; + span2 = hi - lo; + } + return (value2) => (value2 - lo) / span2; + } + function format$1(locale2, scale2, specifier, formatType) { + const type2 = formatType || scale2.type; + if (isString(specifier) && isTemporal(type2)) { + specifier = specifier.replace(/%a/g, "%A").replace(/%b/g, "%B"); + } + return !specifier && type2 === Time ? locale2.timeFormat("%A, %d %B %Y, %X") : !specifier && type2 === UTC ? locale2.utcFormat("%A, %d %B %Y, %X UTC") : labelFormat(locale2, scale2, 5, null, specifier, formatType, true); + } + function domainCaption(locale2, scale2, opt) { + opt = opt || {}; + const max2 = Math.max(3, opt.maxlen || 7), fmt = format$1(locale2, scale2, opt.format, opt.formatType); + if (isDiscretizing(scale2.type)) { + const v = labelValues(scale2).slice(1).map(fmt), n = v.length; + return `${n} boundar${n === 1 ? "y" : "ies"}: ${v.join(", ")}`; + } else if (isDiscrete(scale2.type)) { + const d2 = scale2.domain(), n = d2.length, v = n > max2 ? d2.slice(0, max2 - 2).map(fmt).join(", ") + ", ending with " + d2.slice(-1).map(fmt) : d2.map(fmt).join(", "); + return `${n} value${n === 1 ? "" : "s"}: ${v}`; } else { - units = Milli; - step = Math.max((0, _d3Array.tickStep)(ext[0], ext[1], max), 1); + const d2 = scale2.domain(); + return `values from ${fmt(d2[0])} to ${fmt(peek$1(d2))}`; } - return { - units, - step + } + let gradient_id = 0; + function resetSVGGradientId() { + gradient_id = 0; + } + const patternPrefix = "p_"; + function isGradient(value2) { + return value2 && value2.gradient; + } + function gradientRef(g, defs, base2) { + const type2 = g.gradient; + let id2 = g.id, prefix = type2 === "radial" ? patternPrefix : ""; + if (!id2) { + id2 = g.id = "gradient_" + gradient_id++; + if (type2 === "radial") { + g.x1 = get$2(g.x1, 0.5); + g.y1 = get$2(g.y1, 0.5); + g.r1 = get$2(g.r1, 0); + g.x2 = get$2(g.x2, 0.5); + g.y2 = get$2(g.y2, 0.5); + g.r2 = get$2(g.r2, 0.5); + prefix = patternPrefix; + } else { + g.x1 = get$2(g.x1, 0); + g.y1 = get$2(g.y1, 0); + g.x2 = get$2(g.x2, 1); + g.y2 = get$2(g.y2, 0); + } + } + defs[id2] = g; + return "url(" + (base2 || "") + "#" + prefix + id2 + ")"; + } + function get$2(val, def2) { + return val != null ? val : def2; + } + function Gradient$1(p02, p1) { + var stops = [], gradient2; + return gradient2 = { + gradient: "linear", + x1: p02 ? p02[0] : 0, + y1: p02 ? p02[1] : 0, + x2: p1 ? p1[0] : 1, + y2: p1 ? p1[1] : 0, + stops, + stop: function(offset2, color2) { + stops.push({ + offset: offset2, + color: color2 + }); + return gradient2; + } }; -} - -},{"vega-util":"f2ulH","d3-time":"6KMda","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2YZ3v":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "aggregate", ()=>Aggregate); -parcelHelpers.export(exports, "bin", ()=>Bin); -parcelHelpers.export(exports, "collect", ()=>Collect); -parcelHelpers.export(exports, "compare", ()=>Compare); -parcelHelpers.export(exports, "countpattern", ()=>CountPattern); -parcelHelpers.export(exports, "cross", ()=>Cross); -parcelHelpers.export(exports, "density", ()=>Density); -parcelHelpers.export(exports, "dotbin", ()=>DotBin); -parcelHelpers.export(exports, "expression", ()=>Expression); -parcelHelpers.export(exports, "extent", ()=>Extent); -parcelHelpers.export(exports, "facet", ()=>Facet); -parcelHelpers.export(exports, "field", ()=>Field); -parcelHelpers.export(exports, "filter", ()=>Filter); -parcelHelpers.export(exports, "flatten", ()=>Flatten); -parcelHelpers.export(exports, "fold", ()=>Fold); -parcelHelpers.export(exports, "formula", ()=>Formula); -parcelHelpers.export(exports, "generate", ()=>Generate); -parcelHelpers.export(exports, "impute", ()=>Impute); -parcelHelpers.export(exports, "joinaggregate", ()=>JoinAggregate); -parcelHelpers.export(exports, "kde", ()=>KDE); -parcelHelpers.export(exports, "key", ()=>Key); -parcelHelpers.export(exports, "load", ()=>Load); -parcelHelpers.export(exports, "lookup", ()=>Lookup); -parcelHelpers.export(exports, "multiextent", ()=>MultiExtent); -parcelHelpers.export(exports, "multivalues", ()=>MultiValues); -parcelHelpers.export(exports, "params", ()=>Params); -parcelHelpers.export(exports, "pivot", ()=>Pivot); -parcelHelpers.export(exports, "prefacet", ()=>PreFacet); -parcelHelpers.export(exports, "project", ()=>Project); -parcelHelpers.export(exports, "proxy", ()=>Proxy); -parcelHelpers.export(exports, "quantile", ()=>Quantile); -parcelHelpers.export(exports, "relay", ()=>Relay); -parcelHelpers.export(exports, "sample", ()=>Sample); -parcelHelpers.export(exports, "sequence", ()=>Sequence); -parcelHelpers.export(exports, "sieve", ()=>Sieve); -parcelHelpers.export(exports, "subflow", ()=>Subflow); -parcelHelpers.export(exports, "timeunit", ()=>TimeUnit); -parcelHelpers.export(exports, "tupleindex", ()=>TupleIndex); -parcelHelpers.export(exports, "values", ()=>Values); -parcelHelpers.export(exports, "window", ()=>Window); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaStatistics = require("vega-statistics"); -var _d3Array = require("d3-array"); -var _vegaTime = require("vega-time"); -function multikey(f) { - return (x)=>{ - const n = f.length; - let i = 1, k = String(f[0](x)); - for(; i < n; ++i)k += '|' + f[i](x); - return k; - }; -} -function groupkey(fields) { - return !fields || !fields.length ? function() { - return ''; - } : fields.length === 1 ? fields[0] : multikey(fields); -} -function measureName(op, field, as) { - return as || op + (!field ? '' : '_' + field); -} -const noop = ()=>{}; -const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 -}; -const AggregateOps = { - values: { - init: (m)=>m.cell.store = true, - value: (m)=>m.cell.data.values(), - idx: -1 + } + const lookup$4 = { + "basis": { + curve: curveBasis }, - count: { - value: (m)=>m.cell.num + "basis-closed": { + curve: curveBasisClosed }, - __count__: { - value: (m)=>m.missing + m.valid + "basis-open": { + curve: curveBasisOpen }, - missing: { - value: (m)=>m.missing + "bundle": { + curve: curveBundle, + tension: "beta", + value: 0.85 }, - valid: { - value: (m)=>m.valid + "cardinal": { + curve: curveCardinal, + tension: "tension", + value: 0 }, - sum: { - init: (m)=>m.sum = 0, - value: (m)=>m.valid ? m.sum : undefined, - add: (m, v)=>m.sum += +v, - rem: (m, v)=>m.sum -= v + "cardinal-open": { + curve: curveCardinalOpen, + tension: "tension", + value: 0 }, - product: { - init: (m)=>m.product = 1, - value: (m)=>m.valid ? m.product : undefined, - add: (m, v)=>m.product *= v, - rem: (m, v)=>m.product /= v + "cardinal-closed": { + curve: curveCardinalClosed, + tension: "tension", + value: 0 }, - mean: { - init: (m)=>m.mean = 0, - value: (m)=>m.valid ? m.mean : undefined, - add: (m, v)=>(m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v)=>(m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) + "catmull-rom": { + curve: curveCatmullRom, + tension: "alpha", + value: 0.5 }, - average: { - value: (m)=>m.valid ? m.mean : undefined, - req: [ - 'mean' - ], - idx: 1 + "catmull-rom-closed": { + curve: curveCatmullRomClosed, + tension: "alpha", + value: 0.5 }, - variance: { - init: (m)=>m.dev = 0, - value: (m)=>m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v)=>m.dev += m.mean_d * (v - m.mean), - rem: (m, v)=>m.dev -= m.mean_d * (v - m.mean), - req: [ - 'mean' - ], - idx: 1 + "catmull-rom-open": { + curve: curveCatmullRomOpen, + tension: "alpha", + value: 0.5 }, - variancep: { - value: (m)=>m.valid > 1 ? m.dev / m.valid : undefined, - req: [ - 'variance' - ], - idx: 2 + "linear": { + curve: curveLinear }, - stdev: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: [ - 'variance' - ], - idx: 2 + "linear-closed": { + curve: curveLinearClosed }, - stdevp: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: [ - 'variance' - ], - idx: 2 + "monotone": { + horizontal: monotoneY, + vertical: monotoneX }, - stderr: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: [ - 'variance' - ], - idx: 2 + "natural": { + curve: curveNatural }, - distinct: { - value: (m)=>m.cell.data.distinct(m.get), - req: [ - 'values' - ], - idx: 3 + "step": { + curve: curveStep }, - ci0: { - value: (m)=>m.cell.data.ci0(m.get), - req: [ - 'values' - ], - idx: 3 + "step-after": { + curve: stepAfter }, - ci1: { - value: (m)=>m.cell.data.ci1(m.get), - req: [ - 'values' - ], - idx: 3 + "step-before": { + curve: stepBefore + } + }; + function curves(type2, orientation, tension) { + var entry2 = has$1(lookup$4, type2) && lookup$4[type2], curve2 = null; + if (entry2) { + curve2 = entry2.curve || entry2[orientation || "vertical"]; + if (entry2.tension && tension != null) { + curve2 = curve2[entry2.tension](tension); + } + } + return curve2; + } + const paramCounts = { + m: 2, + l: 2, + h: 1, + v: 1, + z: 0, + c: 6, + s: 4, + q: 4, + t: 2, + a: 7 + }; + const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; + const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; + const spacePattern = /^((\s+,?\s*)|(,\s*))/; + const flagPattern = /^[01]/; + function parse$3(path2) { + const commands = []; + const matches = path2.match(commandPattern) || []; + matches.forEach((str) => { + let cmd = str[0]; + const type2 = cmd.toLowerCase(); + const paramCount = paramCounts[type2]; + const params2 = parseParams(type2, paramCount, str.slice(1).trim()); + const count2 = params2.length; + if (count2 < paramCount || count2 && count2 % paramCount !== 0) { + throw Error("Invalid SVG path, incorrect parameter count"); + } + commands.push([cmd, ...params2.slice(0, paramCount)]); + if (count2 === paramCount) { + return; + } + if (type2 === "m") { + cmd = cmd === "M" ? "L" : "l"; + } + for (let i = paramCount; i < count2; i += paramCount) { + commands.push([cmd, ...params2.slice(i, i + paramCount)]); + } + }); + return commands; + } + function parseParams(type2, paramCount, segment) { + const params2 = []; + for (let index2 = 0; paramCount && index2 < segment.length; ) { + for (let i = 0; i < paramCount; ++i) { + const pattern = type2 === "a" && (i === 3 || i === 4) ? flagPattern : numberPattern; + const match2 = segment.slice(index2).match(pattern); + if (match2 === null) { + throw Error("Invalid SVG path, incorrect parameter type"); + } + index2 += match2[0].length; + params2.push(+match2[0]); + const ws = segment.slice(index2).match(spacePattern); + if (ws !== null) { + index2 += ws[0].length; + } + } + } + return params2; + } + const DegToRad = Math.PI / 180; + const Epsilon = 1e-14; + const HalfPi = Math.PI / 2; + const Tau = Math.PI * 2; + const HalfSqrt3 = Math.sqrt(3) / 2; + var segmentCache = {}; + var bezierCache = {}; + var join$1 = [].join; + function segments(x2, y2, rx, ry, large, sweep, rotateX2, ox, oy) { + const key2 = join$1.call(arguments); + if (segmentCache[key2]) { + return segmentCache[key2]; + } + const th = rotateX2 * DegToRad; + const sin_th = Math.sin(th); + const cos_th = Math.cos(th); + rx = Math.abs(rx); + ry = Math.abs(ry); + const px2 = cos_th * (ox - x2) * 0.5 + sin_th * (oy - y2) * 0.5; + const py2 = cos_th * (oy - y2) * 0.5 - sin_th * (ox - x2) * 0.5; + let pl = px2 * px2 / (rx * rx) + py2 * py2 / (ry * ry); + if (pl > 1) { + pl = Math.sqrt(pl); + rx *= pl; + ry *= pl; + } + const a00 = cos_th / rx; + const a01 = sin_th / rx; + const a10 = -sin_th / ry; + const a11 = cos_th / ry; + const x02 = a00 * ox + a01 * oy; + const y02 = a10 * ox + a11 * oy; + const x12 = a00 * x2 + a01 * y2; + const y12 = a10 * x2 + a11 * y2; + const d2 = (x12 - x02) * (x12 - x02) + (y12 - y02) * (y12 - y02); + let sfactor_sq = 1 / d2 - 0.25; + if (sfactor_sq < 0) sfactor_sq = 0; + let sfactor = Math.sqrt(sfactor_sq); + if (sweep == large) sfactor = -sfactor; + const xc = 0.5 * (x02 + x12) - sfactor * (y12 - y02); + const yc = 0.5 * (y02 + y12) + sfactor * (x12 - x02); + const th0 = Math.atan2(y02 - yc, x02 - xc); + const th1 = Math.atan2(y12 - yc, x12 - xc); + let th_arc = th1 - th0; + if (th_arc < 0 && sweep === 1) { + th_arc += Tau; + } else if (th_arc > 0 && sweep === 0) { + th_arc -= Tau; + } + const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 1e-3))); + const result = []; + for (let i = 0; i < segs; ++i) { + const th2 = th0 + i * th_arc / segs; + const th3 = th0 + (i + 1) * th_arc / segs; + result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th]; + } + return segmentCache[key2] = result; + } + function bezier(params2) { + const key2 = join$1.call(params2); + if (bezierCache[key2]) { + return bezierCache[key2]; + } + var cx = params2[0], cy = params2[1], th0 = params2[2], th1 = params2[3], rx = params2[4], ry = params2[5], sin_th = params2[6], cos_th = params2[7]; + const a00 = cos_th * rx; + const a01 = -sin_th * ry; + const a10 = sin_th * rx; + const a11 = cos_th * ry; + const cos_th0 = Math.cos(th0); + const sin_th0 = Math.sin(th0); + const cos_th1 = Math.cos(th1); + const sin_th1 = Math.sin(th1); + const th_half = 0.5 * (th1 - th0); + const sin_th_h2 = Math.sin(th_half * 0.5); + const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); + const x12 = cx + cos_th0 - t * sin_th0; + const y12 = cy + sin_th0 + t * cos_th0; + const x3 = cx + cos_th1; + const y3 = cy + sin_th1; + const x2 = x3 + t * sin_th1; + const y2 = y3 - t * cos_th1; + return bezierCache[key2] = [a00 * x12 + a01 * y12, a10 * x12 + a11 * y12, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3]; + } + const temp = ["l", 0, 0, 0, 0, 0, 0, 0]; + function scale$1$1(current, sX, sY) { + const c2 = temp[0] = current[0]; + if (c2 === "a" || c2 === "A") { + temp[1] = sX * current[1]; + temp[2] = sY * current[2]; + temp[3] = current[3]; + temp[4] = current[4]; + temp[5] = current[5]; + temp[6] = sX * current[6]; + temp[7] = sY * current[7]; + } else if (c2 === "h" || c2 === "H") { + temp[1] = sX * current[1]; + } else if (c2 === "v" || c2 === "V") { + temp[1] = sY * current[1]; + } else { + for (var i = 1, n = current.length; i < n; ++i) { + temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; + } + } + return temp; + } + function pathRender(context2, path2, l, t, sX, sY) { + var current, previous = null, x2 = 0, y2 = 0, controlX = 0, controlY = 0, tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; + if (l == null) l = 0; + if (t == null) t = 0; + if (sX == null) sX = 1; + if (sY == null) sY = sX; + if (context2.beginPath) context2.beginPath(); + for (var i = 0, len2 = path2.length; i < len2; ++i) { + current = path2[i]; + if (sX !== 1 || sY !== 1) { + current = scale$1$1(current, sX, sY); + } + switch (current[0]) { + // first letter + case "l": + x2 += current[1]; + y2 += current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "L": + x2 = current[1]; + y2 = current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "h": + x2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "H": + x2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "v": + y2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "V": + y2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "m": + x2 += current[1]; + y2 += current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "M": + x2 = current[1]; + y2 = current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "c": + tempX = x2 + current[5]; + tempY = y2 + current[6]; + controlX = x2 + current[3]; + controlY = y2 + current[4]; + context2.bezierCurveTo( + x2 + current[1] + l, + // x1 + y2 + current[2] + t, + // y1 + controlX + l, + // x2 + controlY + t, + // y2 + tempX + l, + tempY + t + ); + x2 = tempX; + y2 = tempY; + break; + case "C": + x2 = current[5]; + y2 = current[6]; + controlX = current[3]; + controlY = current[4]; + context2.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x2 + l, y2 + t); + break; + case "s": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, x2 + current[1] + l, y2 + current[2] + t, tempX + l, tempY + t); + controlX = x2 + current[1]; + controlY = y2 + current[2]; + x2 = tempX; + y2 = tempY; + break; + case "S": + tempX = current[3]; + tempY = current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "q": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "Q": + tempX = current[3]; + tempY = current[4]; + context2.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "t": + tempX = x2 + current[1]; + tempY = y2 + current[2]; + if (previous[0].match(/[QqTt]/) === null) { + controlX = x2; + controlY = y2; + } else if (previous[0] === "t") { + controlX = 2 * x2 - tempControlX; + controlY = 2 * y2 - tempControlY; + } else if (previous[0] === "q") { + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + } + tempControlX = controlX; + tempControlY = controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + break; + case "T": + tempX = current[1]; + tempY = current[2]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "a": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x2 + l, current[7] + y2 + t]); + x2 += current[6]; + y2 += current[7]; + break; + case "A": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]); + x2 = current[6]; + y2 = current[7]; + break; + case "z": + case "Z": + x2 = anchorX; + y2 = anchorY; + context2.closePath(); + break; + } + previous = current; + } + } + function drawArc(context2, x2, y2, coords) { + const seg = segments( + coords[5], + // end x + coords[6], + // end y + coords[0], + // radius x + coords[1], + // radius y + coords[3], + // large flag + coords[4], + // sweep flag + coords[2], + // rotation + x2, + y2 + ); + for (let i = 0; i < seg.length; ++i) { + const bez = bezier(seg[i]); + context2.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); + } + } + const Tan30 = 0.5773502691896257; + const builtins = { + "circle": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, Tau); + } }, - median: { - value: (m)=>m.cell.data.q2(m.get), - req: [ - 'values' - ], - idx: 3 + "cross": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, s2 = r / 2.5; + context2.moveTo(-r, -s2); + context2.lineTo(-r, s2); + context2.lineTo(-s2, s2); + context2.lineTo(-s2, r); + context2.lineTo(s2, r); + context2.lineTo(s2, s2); + context2.lineTo(r, s2); + context2.lineTo(r, -s2); + context2.lineTo(s2, -s2); + context2.lineTo(s2, -r); + context2.lineTo(-s2, -r); + context2.lineTo(-s2, -s2); + context2.closePath(); + } }, - q1: { - value: (m)=>m.cell.data.q1(m.get), - req: [ - 'values' - ], - idx: 3 + "diamond": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(-r, 0); + context2.lineTo(0, -r); + context2.lineTo(r, 0); + context2.lineTo(0, r); + context2.closePath(); + } }, - q3: { - value: (m)=>m.cell.data.q3(m.get), - req: [ - 'values' - ], - idx: 3 + "square": { + draw: function(context2, size) { + var w2 = Math.sqrt(size), x2 = -w2 / 2; + context2.rect(x2, x2, w2, w2); + } }, - min: { - init: (m)=>m.min = undefined, - value: (m)=>m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min, - add: (m, v)=>{ - if (v < m.min || m.min === undefined) m.min = v; - }, - rem: (m, v)=>{ - if (v <= m.min) m.min = NaN; - }, - req: [ - 'values' - ], - idx: 4 + "arrow": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, s2 = r / 7, t = r / 2.5, v = r / 8; + context2.moveTo(-s2, r); + context2.lineTo(s2, r); + context2.lineTo(s2, -v); + context2.lineTo(t, -v); + context2.lineTo(0, -r); + context2.lineTo(-t, -v); + context2.lineTo(-s2, -v); + context2.closePath(); + } }, - max: { - init: (m)=>m.max = undefined, - value: (m)=>m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max, - add: (m, v)=>{ - if (v > m.max || m.max === undefined) m.max = v; - }, - rem: (m, v)=>{ - if (v >= m.max) m.max = NaN; - }, - req: [ - 'values' - ], - idx: 4 + "wedge": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30, b2 = r / 4; + context2.moveTo(0, -h2 - o); + context2.lineTo(-b2, h2 - o); + context2.lineTo(b2, h2 - o); + context2.closePath(); + } }, - argmin: { - init: (m)=>m.argmin = undefined, - value: (m)=>m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t)=>{ - if (v < m.min) m.argmin = t; - }, - rem: (m, v)=>{ - if (v <= m.min) m.argmin = undefined; - }, - req: [ - 'min', - 'values' - ], - idx: 3 + "triangle": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30; + context2.moveTo(0, -h2 - o); + context2.lineTo(-r, h2 - o); + context2.lineTo(r, h2 - o); + context2.closePath(); + } }, - argmax: { - init: (m)=>m.argmax = undefined, - value: (m)=>m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t)=>{ - if (v > m.max) m.argmax = t; - }, - rem: (m, v)=>{ - if (v >= m.max) m.argmax = undefined; - }, - req: [ - 'max', - 'values' - ], - idx: 3 + "triangle-up": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, -h2); + context2.lineTo(-r, h2); + context2.lineTo(r, h2); + context2.closePath(); + } }, - exponential: { - init: (m, r)=>{ - m.exp = 0; - m.exp_r = r; - }, - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) / (1 - m.exp_r ** m.valid) : undefined, - add: (m, v)=>m.exp = m.exp_r * m.exp + v, - rem: (m, v)=>m.exp = (m.exp - v / m.exp_r ** (m.valid - 1)) / m.exp_r + "triangle-down": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, h2); + context2.lineTo(-r, -h2); + context2.lineTo(r, -h2); + context2.closePath(); + } }, - exponentialb: { - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) : undefined, - req: [ - 'exponential' - ], - idx: 1 - } -}; -const ValidAggregateOps = Object.keys(AggregateOps).filter((d)=>d !== '__count__'); -function measure(key, value) { - return (out, aggregate_param)=>(0, _vegaUtil.extend)({ - name: key, - aggregate_param: aggregate_param, - out: out || key - }, base_op, value); -} -[ - ...ValidAggregateOps, - '__count__' -].forEach((key)=>{ - AggregateOps[key] = measure(key, AggregateOps[key]); -}); -function createMeasure(op, param, name) { - return AggregateOps[op](name, param); -} -function compareIndex(a, b) { - return a.idx - b.idx; -} -function resolve(agg) { - const map = {}; - agg.forEach((a)=>map[a.name] = a); - const getreqs = (a)=>{ - if (!a.req) return; - a.req.forEach((key)=>{ - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - return Object.values(map).sort(compareIndex); -} -function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach((op)=>op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); -} -function add(v, t) { - if (v == null || v === '') { - ++this.missing; - return; - } - if (v !== v) return; - ++this.valid; - this._ops.forEach((op)=>op.add(this, v, t)); -} -function rem(v, t) { - if (v == null || v === '') { - --this.missing; - return; + "triangle-right": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(h2, 0); + context2.lineTo(-h2, -r); + context2.lineTo(-h2, r); + context2.closePath(); + } + }, + "triangle-left": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(-h2, 0); + context2.lineTo(h2, -r); + context2.lineTo(h2, r); + context2.closePath(); + } + }, + "stroke": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(-r, 0); + context2.lineTo(r, 0); + } } - if (v !== v) return; - --this.valid; - this._ops.forEach((op)=>op.rem(this, v, t)); -} -function set(t) { - this._out.forEach((op)=>t[op.out] = op.value(this)); - return t; -} -function compileMeasures(agg, field) { - const get = field || (0, _vegaUtil.identity), ops = resolve(agg), out = agg.slice().sort(compareIndex); - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); + }; + function symbols(_) { + return has$1(builtins, _) ? builtins[_] : customSymbol(_); + } + var custom = {}; + function customSymbol(path2) { + if (!has$1(custom, path2)) { + const parsed = parse$3(path2); + custom[path2] = { + draw: function(context2, size) { + pathRender(context2, parsed, 0, 0, Math.sqrt(size) / 2); + } + }; } - ctr.prototype.init = init; - ctr.prototype.add = add; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map((op)=>op.out); - return ctr; -} -function TupleStore(key) { - this._key = key ? (0, _vegaUtil.field)(key) : (0, _vegaDataflow.tupleid); - this.reset(); -} -const prototype$1 = TupleStore.prototype; -prototype$1.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; -}; -prototype$1.add = function(v) { - this._add.push(v); -}; -prototype$1.rem = function(v) { - this._rem.push(v); -}; -prototype$1.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - const a = this._add, r = this._rem, k = this._key, n = a.length, m = r.length, x = Array(n - m), map = {}; - let i, j, v; - // use unique key field to clear removed values - for(i = 0; i < m; ++i)map[k(r[i])] = 1; - for(i = 0, j = 0; i < n; ++i)if (map[k(v = a[i])]) map[k(v)] = 0; - else x[j++] = v; - this._rem = []; - return this._add = x; -}; -// memoizing statistics methods -prototype$1.distinct = function(get) { - const v = this.values(), map = {}; - let n = v.length, count = 0, s; - while(--n >= 0){ - s = get(v[n]) + ''; - if (!(0, _vegaUtil.hasOwnProperty)(map, s)) { - map[s] = 1; - ++count; - } - } - return count; -}; -prototype$1.extent = function(get) { - if (this._get !== get || !this._ext) { - const v = this.values(), i = (0, _vegaUtil.extentIndex)(v, get); - this._ext = [ - v[i[0]], - v[i[1]] - ]; - this._get = get; + return custom[path2]; + } + const C = 0.448084975506; + function rectangleX(d2) { + return d2.x; + } + function rectangleY(d2) { + return d2.y; + } + function rectangleWidth(d2) { + return d2.width; + } + function rectangleHeight(d2) { + return d2.height; + } + function number$3(_) { + return typeof _ === "function" ? _ : () => +_; + } + function clamp(value2, min2, max2) { + return Math.max(min2, Math.min(value2, max2)); + } + function vg_rect() { + var x2 = rectangleX, y2 = rectangleY, width2 = rectangleWidth, height2 = rectangleHeight, crTL = number$3(0), crTR = crTL, crBL = crTL, crBR = crTL, context2 = null; + function rectangle2(_, x02, y02) { + var buffer, x12 = x02 != null ? x02 : +x2.call(this, _), y12 = y02 != null ? y02 : +y2.call(this, _), w2 = +width2.call(this, _), h2 = +height2.call(this, _), s2 = Math.min(w2, h2) / 2, tl2 = clamp(+crTL.call(this, _), 0, s2), tr2 = clamp(+crTR.call(this, _), 0, s2), bl2 = clamp(+crBL.call(this, _), 0, s2), br2 = clamp(+crBR.call(this, _), 0, s2); + if (!context2) context2 = buffer = path$3(); + if (tl2 <= 0 && tr2 <= 0 && bl2 <= 0 && br2 <= 0) { + context2.rect(x12, y12, w2, h2); + } else { + var x22 = x12 + w2, y22 = y12 + h2; + context2.moveTo(x12 + tl2, y12); + context2.lineTo(x22 - tr2, y12); + context2.bezierCurveTo(x22 - C * tr2, y12, x22, y12 + C * tr2, x22, y12 + tr2); + context2.lineTo(x22, y22 - br2); + context2.bezierCurveTo(x22, y22 - C * br2, x22 - C * br2, y22, x22 - br2, y22); + context2.lineTo(x12 + bl2, y22); + context2.bezierCurveTo(x12 + C * bl2, y22, x12, y22 - C * bl2, x12, y22 - bl2); + context2.lineTo(x12, y12 + tl2); + context2.bezierCurveTo(x12, y12 + C * tl2, x12 + C * tl2, y12, x12 + tl2, y12); + context2.closePath(); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } } - return this._ext; -}; -prototype$1.argmin = function(get) { - return this.extent(get)[0] || {}; -}; -prototype$1.argmax = function(get) { - return this.extent(get)[1] || {}; -}; -prototype$1.min = function(get) { - const m = this.extent(get)[0]; - return m != null ? get(m) : undefined; -}; -prototype$1.max = function(get) { - const m = this.extent(get)[1]; - return m != null ? get(m) : undefined; -}; -prototype$1.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = (0, _vegaStatistics.quartiles)(this.values(), get); - this._get = get; + rectangle2.x = function(_) { + if (arguments.length) { + x2 = number$3(_); + return rectangle2; + } else { + return x2; + } + }; + rectangle2.y = function(_) { + if (arguments.length) { + y2 = number$3(_); + return rectangle2; + } else { + return y2; + } + }; + rectangle2.width = function(_) { + if (arguments.length) { + width2 = number$3(_); + return rectangle2; + } else { + return width2; + } + }; + rectangle2.height = function(_) { + if (arguments.length) { + height2 = number$3(_); + return rectangle2; + } else { + return height2; + } + }; + rectangle2.cornerRadius = function(tl2, tr2, br2, bl2) { + if (arguments.length) { + crTL = number$3(tl2); + crTR = tr2 != null ? number$3(tr2) : crTL; + crBR = br2 != null ? number$3(br2) : crTL; + crBL = bl2 != null ? number$3(bl2) : crTR; + return rectangle2; + } else { + return crTL; + } + }; + rectangle2.context = function(_) { + if (arguments.length) { + context2 = _ == null ? null : _; + return rectangle2; + } else { + return context2; + } + }; + return rectangle2; + } + function vg_trail() { + var x2, y2, size, defined, context2 = null, ready, x12, y12, r1; + function point2(x22, y22, w2) { + const r2 = w2 / 2; + if (ready) { + var ux = y12 - y22, uy = x22 - x12; + if (ux || uy) { + var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); + context2.moveTo(x12 - rx, y12 - ry); + context2.lineTo(x22 - ux * r2, y22 - uy * r2); + context2.arc(x22, y22, r2, t - Math.PI, t); + context2.lineTo(x12 + rx, y12 + ry); + context2.arc(x12, y12, r1, t, t + Math.PI); + } else { + context2.arc(x22, y22, r2, 0, Tau); + } + context2.closePath(); + } else { + ready = 1; + } + x12 = x22; + y12 = y22; + r1 = r2; + } + function trail2(data2) { + var i, n = data2.length, d2, defined0 = false, buffer; + if (context2 == null) context2 = buffer = path$3(); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d2 = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) ready = 0; + } + if (defined0) point2(+x2(d2, i, data2), +y2(d2, i, data2), +size(d2, i, data2)); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } } - return this._q; -}; -prototype$1.q1 = function(get) { - return this.quartile(get)[0]; -}; -prototype$1.q2 = function(get) { - return this.quartile(get)[1]; -}; -prototype$1.q3 = function(get) { - return this.quartile(get)[2]; -}; -prototype$1.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = (0, _vegaStatistics.bootstrapCI)(this.values(), 1000, 0.05, get); - this._get = get; + trail2.x = function(_) { + if (arguments.length) { + x2 = _; + return trail2; + } else { + return x2; + } + }; + trail2.y = function(_) { + if (arguments.length) { + y2 = _; + return trail2; + } else { + return y2; + } + }; + trail2.size = function(_) { + if (arguments.length) { + size = _; + return trail2; + } else { + return size; + } + }; + trail2.defined = function(_) { + if (arguments.length) { + defined = _; + return trail2; + } else { + return defined; + } + }; + trail2.context = function(_) { + if (arguments.length) { + if (_ == null) { + context2 = null; + } else { + context2 = _; + } + return trail2; + } else { + return context2; + } + }; + return trail2; + } + function value$1(a2, b2) { + return a2 != null ? a2 : b2; + } + const x$2 = (item) => item.x || 0, y$2 = (item) => item.y || 0, w = (item) => item.width || 0, h = (item) => item.height || 0, xw = (item) => (item.x || 0) + (item.width || 0), yh = (item) => (item.y || 0) + (item.height || 0), sa = (item) => item.startAngle || 0, ea = (item) => item.endAngle || 0, pa = (item) => item.padAngle || 0, ir = (item) => item.innerRadius || 0, or = (item) => item.outerRadius || 0, cr = (item) => item.cornerRadius || 0, tl = (item) => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item) => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item) => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item) => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item) => value$1(item.size, 64), ts = (item) => item.size || 1, def = (item) => !(item.defined === false), type = (item) => symbols(item.shape || "circle"); + const arcShape = arc$2$1().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = area$2$1().x(x$2).y1(y$2).y0(yh).defined(def), areahShape = area$2$1().y(y$2).x1(x$2).x0(xw).defined(def), lineShape = line$2$1().x(x$2).y(y$2).defined(def), rectShape = vg_rect().x(x$2).y(y$2).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = Symbol$1().type(type).size(sz), trailShape = vg_trail().x(x$2).y(y$2).defined(def).size(ts); + function hasCornerRadius(item) { + return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; + } + function arc$1(context2, item) { + return arcShape.context(context2)(item); + } + function area$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return (item.orient === "horizontal" ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function line$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return lineShape.curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function rectangle(context2, item, x2, y2) { + return rectShape.context(context2)(item, x2, y2); + } + function shape$1(context2, item) { + return (item.mark.shape || item.shape).context(context2)(item); + } + function symbol$1(context2, item) { + return symbolShape.context(context2)(item); + } + function trail$1(context2, items) { + return trailShape.context(context2)(items); + } + var clip_id = 1; + function resetSVGClipId() { + clip_id = 1; + } + function clip$1$1(renderer, item, size) { + var clip2 = item.clip, defs = renderer._defs, id2 = item.clip_id || (item.clip_id = "clip" + clip_id++), c2 = defs.clipping[id2] || (defs.clipping[id2] = { + id: id2 + }); + if (isFunction(clip2)) { + c2.path = clip2(null); + } else if (hasCornerRadius(size)) { + c2.path = rectangle(null, size, 0, 0); + } else { + c2.width = size.width || 0; + c2.height = size.height || 0; } - return this._ci; -}; -prototype$1.ci0 = function(get) { - return this.ci(get)[0]; -}; -prototype$1.ci1 = function(get) { - return this.ci(get)[1]; -}; -/** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<function(object): *>} [params.fields] - An array of accessors to aggregate. - * @param {Array<string>} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameters for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ function Aggregate(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names -} -Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': { - 'generates': true, - 'changes': true + return "url(#" + id2 + ")"; + } + function Bounds(b2) { + this.clear(); + if (b2) this.union(b2); + } + Bounds.prototype = { + clone() { + return new Bounds(this); }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'drop', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'cross', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Aggregate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const aggr = this, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), mod = _.modified(); - aggr.stamp = out.stamp; - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : Object.create(null); - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - if (pulse.clean() && aggr._drop) out.clean(true).runAfter(()=>this.clean()); - return aggr.changes(out); + clear() { + this.x1 = +Number.MAX_VALUE; + this.y1 = +Number.MAX_VALUE; + this.x2 = -Number.MAX_VALUE; + this.y2 = -Number.MAX_VALUE; + return this; }, - cross () { - const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(()=>({})), n = dims.length; - // collect all group-by domain values - function collect(cells) { - let key, i, t, v; - for(key in cells){ - t = cells[key].tuple; - for(i = 0; i < n; ++i)vals[i][v = t[dims[i]]] = v; - } - } - collect(aggr._prev); - collect(curr); - // iterate over key cross-product, create cells as needed - function generate(base, tuple, index) { - const name = dims[index], v = vals[index++]; - for(const k in v){ - const key = base ? base + '|' + k : k; - tuple[name] = v[k]; - if (index < n) generate(key, tuple, index); - else if (!curr[key]) aggr.cell(key, tuple); - } - } - generate('', {}, 0); + empty() { + return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; }, - init (_) { - // initialize input and output fields - const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; - function inputVisit(get) { - const fields = (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(get)), n = fields.length; - let i = 0, f; - for(; i < n; ++i)if (!inputMap[f = fields[i]]) { - inputMap[f] = 1; - inputs.push(f); - } - } - // initialize group-by dimensions - this._dims = (0, _vegaUtil.array)(_.groupby); - this._dnames = this._dims.map((d)=>{ - const dname = (0, _vegaUtil.accessorName)(d); - inputVisit(d); - outputs.push(dname); - return dname; - }); - this.cellkey = _.key ? _.key : groupkey(this._dims); - // initialize aggregate measures - this._countOnly = true; - this._counts = []; - this._measures = []; - const fields = _.fields || [ - null - ], ops = _.ops || [ - 'count' - ], aggregate_params = _.aggregate_params || [ - null - ], as = _.as || [], n = fields.length, map = {}; - let field, op, aggregate_param, m, mname, outname, i; - if (n !== ops.length) (0, _vegaUtil.error)('Unmatched number of fields and aggregate ops.'); - for(i = 0; i < n; ++i){ - field = fields[i]; - op = ops[i]; - aggregate_param = aggregate_params[i] || null; - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - mname = (0, _vegaUtil.accessorName)(field); - outname = measureName(op, mname, as[i]); - outputs.push(outname); - if (op === 'count') { - this._counts.push(outname); - continue; - } - m = map[mname]; - if (!m) { - inputVisit(field); - m = map[mname] = []; - m.field = field; - this._measures.push(m); - } - if (op !== 'count') this._countOnly = false; - m.push(createMeasure(op, aggregate_param, outname)); - } - this._measures = this._measures.map((m)=>compileMeasures(m, m.field)); - return Object.create(null); // aggregation cells (this.value) + equals(b2) { + return this.x1 === b2.x1 && this.y1 === b2.y1 && this.x2 === b2.x2 && this.y2 === b2.y2; }, - // -- Cell Management ----- - cellkey: groupkey(), - cell (key, t) { - let cell = this.value[key]; - if (!cell) { - cell = this.value[key] = this.newcell(key, t); - this._adds[this._alen++] = cell; - } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._adds[this._alen++] = cell; - } else if (cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._mods[this._mlen++] = cell; - } - return cell; + set(x12, y12, x2, y2) { + if (x2 < x12) { + this.x2 = x12; + this.x1 = x2; + } else { + this.x1 = x12; + this.x2 = x2; + } + if (y2 < y12) { + this.y2 = y12; + this.y1 = y2; + } else { + this.y1 = y12; + this.y2 = y2; + } + return this; }, - newcell (key, t) { - const cell = { - key: key, - num: 0, - agg: null, - tuple: this.newtuple(t, this._prev && this._prev[key]), - stamp: this.stamp, - store: false - }; - if (!this._countOnly) { - const measures = this._measures, n = measures.length; - cell.agg = Array(n); - for(let i = 0; i < n; ++i)cell.agg[i] = new measures[i](cell); - } - if (cell.store) cell.data = new TupleStore(); - return cell; + add(x2, y2) { + if (x2 < this.x1) this.x1 = x2; + if (y2 < this.y1) this.y1 = y2; + if (x2 > this.x2) this.x2 = x2; + if (y2 > this.y2) this.y2 = y2; + return this; }, - newtuple (t, p) { - const names = this._dnames, dims = this._dims, n = dims.length, x = {}; - for(let i = 0; i < n; ++i)x[names[i]] = dims[i](t); - return p ? (0, _vegaDataflow.replace)(p.tuple, x) : (0, _vegaDataflow.ingest)(x); + expand(d2) { + this.x1 -= d2; + this.y1 -= d2; + this.x2 += d2; + this.y2 += d2; + return this; }, - clean () { - const cells = this.value; - for(const key in cells)if (cells[key].num === 0) delete cells[key]; + round() { + this.x1 = Math.floor(this.x1); + this.y1 = Math.floor(this.y1); + this.x2 = Math.ceil(this.x2); + this.y2 = Math.ceil(this.y2); + return this; }, - // -- Process Tuples ----- - add (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num += 1; - if (this._countOnly) return; - if (cell.store) cell.data.add(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].add(agg[i].get(t), t); + scale(s2) { + this.x1 *= s2; + this.y1 *= s2; + this.x2 *= s2; + this.y2 *= s2; + return this; }, - rem (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num -= 1; - if (this._countOnly) return; - if (cell.store) cell.data.rem(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].rem(agg[i].get(t), t); + translate(dx, dy) { + this.x1 += dx; + this.x2 += dx; + this.y1 += dy; + this.y2 += dy; + return this; }, - celltuple (cell) { - const tuple = cell.tuple, counts = this._counts; - // consolidate stored values - if (cell.store) cell.data.values(); - // update tuple properties - for(let i = 0, n = counts.length; i < n; ++i)tuple[counts[i]] = cell.num; - if (!this._countOnly) { - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].set(tuple); - } - return tuple; + rotate(angle2, x2, y2) { + const p = this.rotatedPoints(angle2, x2, y2); + return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); }, - changes (out) { - const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add = out.add, rem = out.rem, mod = out.mod; - let cell, key, i, n; - if (prev) for(key in prev){ - cell = prev[key]; - if (!drop || cell.num) rem.push(cell.tuple); - } - for(i = 0, n = this._alen; i < n; ++i){ - add.push(this.celltuple(adds[i])); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - cell = mods[i]; - (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell)); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - this._prev = null; - return out; - } -}); -// epsilon bias to offset floating point error (#1737) -const EPSILON$1 = 1e-14; -/** - * Generates a binning function for discretizing data. - * @constructor - * @param {object} params - The parameters for this operator. The - * provided values should be valid options for the {@link bin} function. - * @param {function(object): *} params.field - The data field to bin. - */ function Bin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Bin.Definition = { - 'type': 'Bin', - 'metadata': { - 'modifies': true + rotatedPoints(angle2, x2, y2) { + var { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = this, cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), cx = x2 - x2 * cos2 + y2 * sin2, cy = y2 - x2 * sin2 - y2 * cos2; + return [cos2 * x12 - sin2 * y12 + cx, sin2 * x12 + cos2 * y12 + cy, cos2 * x12 - sin2 * y22 + cx, sin2 * x12 + cos2 * y22 + cy, cos2 * x22 - sin2 * y12 + cx, sin2 * x22 + cos2 * y12 + cy, cos2 * x22 - sin2 * y22 + cx, sin2 * x22 + cos2 * y22 + cy]; }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'anchor', - 'type': 'number' - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 20 - }, - { - 'name': 'base', - 'type': 'number', - 'default': 10 - }, - { - 'name': 'divide', - 'type': 'number', - 'array': true, - 'default': [ - 5, - 2 - ] - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'span', - 'type': 'number' - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'steps', - 'type': 'number', - 'array': true - }, - { - 'name': 'minstep', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'name', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'bin0', - 'bin1' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Bin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const band = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || [ - 'bin0', - 'bin1' - ], b0 = as[0], b1 = as[1]; - let flag; - if (_.modified()) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - } else flag = pulse.modified((0, _vegaUtil.accessorFields)(_.field)) ? pulse.ADD_MOD : pulse.ADD; - pulse.visit(flag, band ? (t)=>{ - const v = bins(t); - // minimum bin value (inclusive) - t[b0] = v; - // maximum bin value (exclusive) - // use convoluted math for better floating point agreement - // see https://github.com/vega/vega/issues/830 - // infinite values propagate through this formula! #2227 - t[b1] = v == null ? null : start + step * (1 + (v - start) / step); - } : (t)=>t[b0] = bins(t)); - return pulse.modifies(band ? as : b0); + union(b2) { + if (b2.x1 < this.x1) this.x1 = b2.x1; + if (b2.y1 < this.y1) this.y1 = b2.y1; + if (b2.x2 > this.x2) this.x2 = b2.x2; + if (b2.y2 > this.y2) this.y2 = b2.y2; + return this; }, - _bins (_) { - if (this.value && !_.modified()) return this.value; - const field = _.field, bins = (0, _vegaStatistics.bin)(_), step = bins.step; - let start = bins.start, stop = start + Math.ceil((bins.stop - start) / step) * step, a, d; - if ((a = _.anchor) != null) { - d = a - (start + step * Math.floor((a - start) / step)); - start += d; - stop += d; - } - const f = function(t) { - let v = (0, _vegaUtil.toNumber)(field(t)); - return v == null ? null : v < start ? -Infinity : v > stop ? Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step)); - }; - f.start = start; - f.stop = bins.stop; - f.step = step; - return this.value = (0, _vegaUtil.accessor)(f, (0, _vegaUtil.accessorFields)(field), _.name || 'bin_' + (0, _vegaUtil.accessorName)(field)); - } -}); -function SortedList(idFunc, source, input) { - const $ = idFunc; - let data = source || [], add = input || [], rem = {}, cnt = 0; - return { - add: (t)=>add.push(t), - remove: (t)=>rem[$(t)] = ++cnt, - size: ()=>data.length, - data: (compare, resort)=>{ - if (cnt) { - data = data.filter((t)=>!rem[$(t)]); - rem = {}; - cnt = 0; - } - if (resort && compare) data.sort(compare); - if (add.length) { - data = compare ? (0, _vegaUtil.merge)(compare, data, add.sort(compare)) : data.concat(add); - add = []; - } - return data; - } - }; -} -/** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ function Collect(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Collect.Definition = { - 'type': 'Collect', - 'metadata': { - 'source': true + intersect(b2) { + if (b2.x1 > this.x1) this.x1 = b2.x1; + if (b2.y1 > this.y1) this.y1 = b2.y1; + if (b2.x2 < this.x2) this.x2 = b2.x2; + if (b2.y2 < this.y2) this.y2 = b2.y2; + return this; }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - } - ] -}; -(0, _vegaUtil.inherits)(Collect, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), list = SortedList((0, _vegaDataflow.tupleid), this.value, out.materialize(out.ADD).add), sort = _.sort, mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields)); - out.visit(out.REM, list.remove); - this.modified(mod); - this.value = out.source = list.data((0, _vegaDataflow.stableCompare)(sort), mod); - // propagate tree root if defined - if (pulse.source && pulse.source.root) this.value.root = pulse.source.root; - return out; - } -}); -/** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string|function>} params.fields - The fields to compare. - * @param {Array<string>} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ function Compare(params) { - (0, _vegaDataflow.Operator).call(this, null, update$5, params); -} -(0, _vegaUtil.inherits)(Compare, (0, _vegaDataflow.Operator)); -function update$5(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.compare)(_.fields, _.orders); -} -/** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ function CountPattern(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': { - 'generates': true, - 'changes': true + encloses(b2) { + return b2 && this.x1 <= b2.x1 && this.x2 >= b2.x2 && this.y1 <= b2.y1 && this.y2 >= b2.y2; }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'case', - 'type': 'enum', - 'values': [ - 'upper', - 'lower', - 'mixed' - ], - 'default': 'mixed' - }, - { - 'name': 'pattern', - 'type': 'string', - 'default': '[\\w"]+' - }, - { - 'name': 'stopwords', - 'type': 'string', - 'default': '' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'text', - 'count' - ] - } - ] -}; -function tokenize(text, tcase, match) { - switch(tcase){ - case 'upper': - text = text.toUpperCase(); - break; - case 'lower': - text = text.toLowerCase(); - break; - } - return text.match(match); -} -(0, _vegaUtil.inherits)(CountPattern, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const process = (update)=>(tuple)=>{ - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for(var i = 0, n = tokens.length; i < n; ++i)if (!stop.test(t = tokens[i])) update(t); - }; - const init = this._parameterCheck(_, pulse), counts = this._counts, match = this._match, stop = this._stop, get = _.field, as = _.as || [ - 'text', - 'count' - ], add = process((t)=>counts[t] = 1 + (counts[t] || 0)), rem = process((t)=>counts[t] -= 1); - if (init) pulse.visit(pulse.SOURCE, add); - else { - pulse.visit(pulse.ADD, add); - pulse.visit(pulse.REM, rem); - } - return this._finish(pulse, as); // generate output tuples + alignsWith(b2) { + return b2 && (this.x1 == b2.x1 || this.x2 == b2.x2 || this.y1 == b2.y1 || this.y2 == b2.y2); }, - _parameterCheck (_, pulse) { - let init = false; - if (_.modified('stopwords') || !this._stop) { - this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i'); - init = true; - } - if (_.modified('pattern') || !this._match) { - this._match = new RegExp(_.pattern || '[\\w\']+', 'g'); - init = true; - } - if (_.modified('field') || pulse.modified(_.field.fields)) init = true; - if (init) this._counts = {}; - return init; + intersects(b2) { + return b2 && !(this.x2 < b2.x1 || this.x1 > b2.x2 || this.y2 < b2.y1 || this.y1 > b2.y2); }, - _finish (pulse, as) { - const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text = as[0], count = as[1], out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - let w, t, c; - for(w in counts){ - t = tuples[w]; - c = counts[w] || 0; - if (!t && c) { - tuples[w] = t = (0, _vegaDataflow.ingest)({}); - t[text] = w; - t[count] = c; - out.add.push(t); - } else if (c === 0) { - if (t) out.rem.push(t); - counts[w] = null; - tuples[w] = null; - } else if (t[count] !== c) { - t[count] = c; - out.mod.push(t); - } - } - return out.modifies(as); - } -}); -/** - * Perform a cross-product of a tuple stream with itself. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object):boolean} [params.filter] - An optional filter - * function for selectively including tuples in the cross product. - * @param {Array<string>} [params.as] - The names of the output fields. - */ function Cross(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Cross.Definition = { - 'type': 'Cross', - 'metadata': { - 'generates': true + contains(x2, y2) { + return !(x2 < this.x1 || x2 > this.x2 || y2 < this.y1 || y2 > this.y2); }, - 'params': [ - { - 'name': 'filter', - 'type': 'expr' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'a', - 'b' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Cross, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), as = _.as || [ - 'a', - 'b' - ], a = as[0], b = as[1], reset = !this.value || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter'); - let data = this.value; - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || (0, _vegaUtil.truthy)); - } else out.mod = data; - out.source = this.value; - return out.modifies(as); - } -}); -function cross(input, a, b, filter) { - var data = [], t = {}, n = input.length, i = 0, j, left; - for(; i < n; ++i){ - t[a] = left = input[i]; - for(j = 0; j < n; ++j){ - t[b] = input[j]; - if (filter(t)) { - data.push((0, _vegaDataflow.ingest)(t)); - t = {}; - t[a] = left; - } - } + width() { + return this.x2 - this.x1; + }, + height() { + return this.y2 - this.y1; } - return data; -} -const Distributions = { - kde: (0, _vegaStatistics.randomKDE), - mixture: (0, _vegaStatistics.randomMixture), - normal: (0, _vegaStatistics.randomNormal), - lognormal: (0, _vegaStatistics.randomLogNormal), - uniform: (0, _vegaStatistics.randomUniform) -}; -const DISTRIBUTIONS = 'distributions', FUNCTION = 'function', FIELD = 'field'; -/** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array<object>} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ function parse(def, data) { - const func = def[FUNCTION]; - if (!(0, _vegaUtil.hasOwnProperty)(Distributions, func)) (0, _vegaUtil.error)('Unknown distribution function: ' + func); - const d = Distributions[func](); - for(const name in def){ - // if data field, extract values - if (name === FIELD) d.data((def.from || data()).map(def[name])); - else if (name === DISTRIBUTIONS) d[name](def[name].map((_)=>parse(_, data))); - else if (typeof d[name] === FUNCTION) d[name](def[name]); - } - return d; -} -/** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array<number>} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function Density(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const distributions = [ - { - 'key': { - 'function': 'normal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] + }; + function Item(mark) { + this.mark = mark; + this.bounds = this.bounds || new Bounds(); + } + function GroupItem(mark) { + Item.call(this, mark); + this.items = this.items || []; + } + inherits(GroupItem, Item); + class ResourceLoader { + constructor(customLoader) { + this._pending = 0; + this._loader = customLoader || loader(); + } + pending() { + return this._pending; + } + sanitizeURL(uri) { + const loader2 = this; + increment(loader2); + return loader2._loader.sanitize(uri, { + context: "href" + }).then((opt) => { + decrement(loader2); + return opt; + }).catch(() => { + decrement(loader2); + return null; + }); + } + loadImage(uri) { + const loader2 = this, Image2 = domImage(); + increment(loader2); + return loader2._loader.sanitize(uri, { + context: "image" + }).then((opt) => { + const url = opt.href; + if (!url || !Image2) throw { + url + }; + const img = new Image2(); + const cors = has$1(opt, "crossOrigin") ? opt.crossOrigin : "anonymous"; + if (cors != null) img.crossOrigin = cors; + img.onload = () => decrement(loader2); + img.onerror = () => decrement(loader2); + img.src = url; + return img; + }).catch((e) => { + decrement(loader2); + return { + complete: false, + width: 0, + height: 0, + src: e && e.url || "" + }; + }); + } + ready() { + const loader2 = this; + return new Promise((accept) => { + function poll(value2) { + if (!loader2.pending()) accept(value2); + else setTimeout(() => { + poll(true); + }, 10); + } + poll(false); + }); + } + } + function increment(loader2) { + loader2._pending += 1; + } + function decrement(loader2) { + loader2._pending -= 1; + } + function boundStroke(bounds2, item, miter) { + if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { + const sw = item.strokeWidth != null ? +item.strokeWidth : 1; + bounds2.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); + } + return bounds2; + } + function miterAdjustment(item, strokeWidth) { + return item.strokeJoin && item.strokeJoin !== "miter" ? 0 : strokeWidth; + } + const circleThreshold = Tau - 1e-8; + let bounds, lx, ly, rot, ma, mb, mc, md; + const add$1 = (x2, y2) => bounds.add(x2, y2); + const addL = (x2, y2) => add$1(lx = x2, ly = y2); + const addX = (x2) => add$1(x2, bounds.y1); + const addY = (y2) => add$1(bounds.x1, y2); + const px = (x2, y2) => ma * x2 + mc * y2; + const py = (x2, y2) => mb * x2 + md * y2; + const addp = (x2, y2) => add$1(px(x2, y2), py(x2, y2)); + const addpL = (x2, y2) => addL(px(x2, y2), py(x2, y2)); + function boundContext(_, deg) { + bounds = _; + if (deg) { + rot = deg * DegToRad; + ma = md = Math.cos(rot); + mb = Math.sin(rot); + mc = -mb; + } else { + ma = md = 1; + rot = mb = mc = 0; + } + return context$1; + } + const context$1 = { + beginPath() { }, - { - 'key': { - 'function': 'lognormal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] + closePath() { }, - { - 'key': { - 'function': 'uniform' - }, - 'params': [ - { - 'name': 'min', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'max', - 'type': 'number', - 'default': 1 - } - ] + moveTo: addpL, + lineTo: addpL, + rect(x2, y2, w2, h2) { + if (rot) { + addp(x2 + w2, y2); + addp(x2 + w2, y2 + h2); + addp(x2, y2 + h2); + addpL(x2, y2); + } else { + add$1(x2 + w2, y2 + h2); + addL(x2, y2); + } }, - { - 'key': { - 'function': 'kde' - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'from', - 'type': 'data' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - } - ] - } -]; -const mixture = { - 'key': { - 'function': 'mixture' + quadraticCurveTo(x12, y12, x2, y2) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2); + quadExtrema(lx, px1, px2, addX); + quadExtrema(ly, py1, py2, addY); + addL(px2, py2); }, - 'params': [ - { - 'name': 'distributions', - 'type': 'param', - 'array': true, - 'params': distributions - }, - { - 'name': 'weights', - 'type': 'number', - 'array': true - } - ] -}; -Density.Definition = { - 'type': 'Density', - 'metadata': { - 'generates': true + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); + cubicExtrema(lx, px1, px2, px3, addX); + cubicExtrema(ly, py1, py2, py3, addY); + addL(px3, py3); }, - 'params': [ - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'pdf', - 'values': [ - 'pdf', - 'cdf' - ] - }, - { - 'name': 'distribution', - 'type': 'param', - 'params': distributions.concat(mixture) - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] + arc(cx, cy, r, sa2, ea2, ccw) { + sa2 += rot; + ea2 += rot; + lx = r * Math.cos(ea2) + cx; + ly = r * Math.sin(ea2) + cy; + if (Math.abs(ea2 - sa2) > circleThreshold) { + add$1(cx - r, cy - r); + add$1(cx + r, cy + r); + } else { + const update2 = (a2) => add$1(r * Math.cos(a2) + cx, r * Math.sin(a2) + cy); + let s2, i; + update2(sa2); + update2(ea2); + if (ea2 !== sa2) { + sa2 = sa2 % Tau; + if (sa2 < 0) sa2 += Tau; + ea2 = ea2 % Tau; + if (ea2 < 0) ea2 += Tau; + if (ea2 < sa2) { + ccw = !ccw; + s2 = sa2; + sa2 = ea2; + ea2 = s2; + } + if (ccw) { + ea2 -= Tau; + s2 = sa2 - sa2 % HalfPi; + for (i = 0; i < 4 && s2 > ea2; ++i, s2 -= HalfPi) update2(s2); + } else { + s2 = sa2 - sa2 % HalfPi + HalfPi; + for (i = 0; i < 4 && s2 < ea2; ++i, s2 = s2 + HalfPi) update2(s2); + } } - ] -}; -(0, _vegaUtil.inherits)(Density, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const dist = parse(_.distribution, source(pulse)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - let method = _.method || 'pdf'; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (!_.extent && !dist.data) (0, _vegaUtil.error)('Missing density extent parameter.'); - method = dist[method]; - const as = _.as || [ - 'value', - 'density' - ], domain = _.extent || (0, _vegaUtil.extent)(dist.data()), values = (0, _vegaStatistics.sampleCurve)(method, domain, minsteps, maxsteps).map((v)=>{ - const tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return (0, _vegaDataflow.ingest)(tuple); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + } + } + }; + function quadExtrema(x02, x12, x2, cb) { + const t = (x02 - x12) / (x02 + x2 - 2 * x12); + if (0 < t && t < 1) cb(x02 + (x12 - x02) * t); + } + function cubicExtrema(x02, x12, x2, x3, cb) { + const a2 = x3 - x02 + 3 * x12 - 3 * x2, b2 = x02 + x2 - 2 * x12, c2 = x02 - x12; + let t02 = 0, t12 = 0, r; + if (Math.abs(a2) > Epsilon) { + r = b2 * b2 + c2 * a2; + if (r >= 0) { + r = Math.sqrt(r); + t02 = (-b2 + r) / a2; + t12 = (-b2 - r) / a2; + } + } else { + t02 = 0.5 * c2 / b2; + } + if (0 < t02 && t02 < 1) cb(cubic(t02, x02, x12, x2, x3)); + if (0 < t12 && t12 < 1) cb(cubic(t12, x02, x12, x2, x3)); + } + function cubic(t, x02, x12, x2, x3) { + const s2 = 1 - t, s22 = s2 * s2, t22 = t * t; + return s22 * s2 * x02 + 3 * s22 * t * x12 + 3 * s2 * t22 * x2 + t22 * t * x3; + } + var context$2 = (context$2 = domCanvas(1, 1)) ? context$2.getContext("2d") : null; + const b = new Bounds(); + function intersectPath(draw2) { + return function(item, brush) { + if (!context$2) return true; + draw2(context$2, item); + b.clear().union(item.bounds).intersect(brush).round(); + const { + x1: x12, + y1: y12, + x2, + y2 + } = b; + for (let y3 = y12; y3 <= y2; ++y3) { + for (let x3 = x12; x3 <= x2; ++x3) { + if (context$2.isPointInPath(x3, y3)) { + return true; + } } - return out; + } + return false; + }; + } + function intersectPoint(item, box2) { + return box2.contains(item.x || 0, item.y || 0); + } + function intersectRect(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, w2 = item.width || 0, h2 = item.height || 0; + return box2.intersects(b.set(x2, y2, x2 + w2, y2 + h2)); + } + function intersectRule(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, x22 = item.x2 != null ? item.x2 : x2, y22 = item.y2 != null ? item.y2 : y2; + return intersectBoxLine(box2, x2, y2, x22, y22); + } + function intersectBoxLine(box2, x2, y2, u2, v) { + const { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = box2, dx = u2 - x2, dy = v - y2; + let t02 = 0, t12 = 1, p, q, r, e; + for (e = 0; e < 4; ++e) { + if (e === 0) { + p = -dx; + q = -(x12 - x2); + } + if (e === 1) { + p = dx; + q = x22 - x2; + } + if (e === 2) { + p = -dy; + q = -(y12 - y2); + } + if (e === 3) { + p = dy; + q = y22 - y2; + } + if (Math.abs(p) < 1e-10 && q < 0) return false; + r = q / p; + if (p < 0) { + if (r > t12) return false; + else if (r > t02) t02 = r; + } else if (p > 0) { + if (r < t02) return false; + else if (r < t12) t12 = r; + } + } + return true; + } + function blend(context2, item) { + context2.globalCompositeOperation = item.blend || "source-over"; + } + function value$2(value2, dflt) { + return value2 == null ? dflt : value2; + } + function addStops(gradient2, stops) { + const n = stops.length; + for (let i = 0; i < n; ++i) { + gradient2.addColorStop(stops[i].offset, stops[i].color); + } + return gradient2; + } + function gradient$1(context2, spec, bounds2) { + const w2 = bounds2.width(), h2 = bounds2.height(); + let gradient2; + if (spec.gradient === "radial") { + gradient2 = context2.createRadialGradient(bounds2.x1 + value$2(spec.x1, 0.5) * w2, bounds2.y1 + value$2(spec.y1, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r1, 0), bounds2.x1 + value$2(spec.x2, 0.5) * w2, bounds2.y1 + value$2(spec.y2, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r2, 0.5)); + } else { + const x12 = value$2(spec.x1, 0), y12 = value$2(spec.y1, 0), x2 = value$2(spec.x2, 1), y2 = value$2(spec.y2, 0); + if (x12 === x2 || y12 === y2 || w2 === h2) { + gradient2 = context2.createLinearGradient(bounds2.x1 + x12 * w2, bounds2.y1 + y12 * h2, bounds2.x1 + x2 * w2, bounds2.y1 + y2 * h2); + } else { + const image2 = domCanvas(Math.ceil(w2), Math.ceil(h2)), ictx = image2.getContext("2d"); + ictx.scale(w2, h2); + ictx.fillStyle = addStops(ictx.createLinearGradient(x12, y12, x2, y2), spec.stops); + ictx.fillRect(0, 0, w2, h2); + return context2.createPattern(image2, "no-repeat"); + } + } + return addStops(gradient2, spec.stops); + } + function color$1(context2, item, value2) { + return isGradient(value2) ? gradient$1(context2, value2, item.bounds) : value2; + } + function fill(context2, item, opacity2) { + opacity2 *= item.fillOpacity == null ? 1 : item.fillOpacity; + if (opacity2 > 0) { + context2.globalAlpha = opacity2; + context2.fillStyle = color$1(context2, item, item.fill); + return true; + } else { + return false; + } + } + var Empty = []; + function stroke(context2, item, opacity2) { + var lw = (lw = item.strokeWidth) != null ? lw : 1; + if (lw <= 0) return false; + opacity2 *= item.strokeOpacity == null ? 1 : item.strokeOpacity; + if (opacity2 > 0) { + context2.globalAlpha = opacity2; + context2.strokeStyle = color$1(context2, item, item.stroke); + context2.lineWidth = lw; + context2.lineCap = item.strokeCap || "butt"; + context2.lineJoin = item.strokeJoin || "miter"; + context2.miterLimit = item.strokeMiterLimit || 10; + if (context2.setLineDash) { + context2.setLineDash(item.strokeDash || Empty); + context2.lineDashOffset = item.strokeDashOffset || 0; + } + return true; + } else { + return false; + } + } + function compare(a2, b2) { + return a2.zindex - b2.zindex || a2.index - b2.index; + } + function zorder(scene) { + if (!scene.zdirty) return scene.zitems; + var items = scene.items, output2 = [], item, i, n; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + item.index = i; + if (item.zindex) output2.push(item); + } + scene.zdirty = false; + return scene.zitems = output2.sort(compare); + } + function visit(scene, visitor) { + var items = scene.items, i, n; + if (!items || !items.length) return; + const zitems = zorder(scene); + if (zitems && zitems.length) { + for (i = 0, n = items.length; i < n; ++i) { + if (!items[i].zindex) visitor(items[i]); + } + items = zitems; } -}); -function source(pulse) { - return ()=>pulse.materialize(pulse.SOURCE).source; -} -// use either provided alias or accessor field name -function fieldNames(fields, as) { - if (!fields) return null; - return fields.map((f, i)=>as[i] || (0, _vegaUtil.accessorName)(f)); -} -function partition$1(data, groupby, field) { - const groups = [], get = (f)=>f(t); - let map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data.map(field)); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - g.push(field(t)); + for (i = 0, n = items.length; i < n; ++i) { + visitor(items[i]); } - return groups; -} -const Output = 'bin'; -/** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ function DotBin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -DotBin.Definition = { - 'type': 'DotBin', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': Output - } - ] -}; -const autostep = (data, field)=>(0, _vegaUtil.span)((0, _vegaUtil.extent)(data, field)) / 30; -(0, _vegaUtil.inherits)(DotBin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) return pulse; // early exit - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(pulse.source, _.groupby, (0, _vegaUtil.identity)), smooth = _.smooth || false, field = _.field, step = _.step || autostep(source, field), sort = (0, _vegaDataflow.stableCompare)((a, b)=>field(a) - field(b)), as = _.as || Output, n = groups.length; - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for(; i < n; ++i){ - const g = groups[i].sort(sort); - j = -1; - for (const v of (0, _vegaStatistics.dotbin)(g, step, smooth, field)){ - if (v < min) min = v; - if (v > max) max = v; - g[++j][as] = v; - } + } + function pickVisit(scene, visitor) { + var items = scene.items, hit2, i; + if (!items || !items.length) return null; + const zitems = zorder(scene); + if (zitems && zitems.length) items = zitems; + for (i = items.length; --i >= 0; ) { + if (hit2 = visitor(items[i])) return hit2; + } + if (items === zitems) { + for (items = scene.items, i = items.length; --i >= 0; ) { + if (!items[i].zindex) { + if (hit2 = visitor(items[i])) return hit2; } - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - } -}); -/** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ function Expression(params) { - (0, _vegaDataflow.Operator).call(this, null, update$4, params); - this.modified(true); -} -(0, _vegaUtil.inherits)(Expression, (0, _vegaDataflow.Operator)); -function update$4(_) { - const expr = _.expr; - return this.value && !_.modified('expr') ? this.value : (0, _vegaUtil.accessor)((datum)=>expr(datum, _), (0, _vegaUtil.accessorFields)(expr), (0, _vegaUtil.accessorName)(expr)); -} -/** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ function Extent(params) { - (0, _vegaDataflow.Transform).call(this, [ - undefined, - undefined - ], params); -} -Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true + } + } + return null; + } + function drawAll(path2) { + return function(context2, scene, bounds2) { + visit(scene, (item) => { + if (!bounds2 || bounds2.intersects(item.bounds)) { + drawPath(path2, context2, item, item); } - ] -}; -(0, _vegaUtil.inherits)(Extent, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const extent = this.value, field = _.field, mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field'); - let min = extent[0], max = extent[1]; - if (mod || min == null) { - min = Infinity; - max = -Infinity; - } - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, (t)=>{ - const v = (0, _vegaUtil.toNumber)(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = (0, _vegaUtil.accessorName)(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [ - min, - max - ]; + }); + }; + } + function drawOne(path2) { + return function(context2, scene, bounds2) { + if (scene.items.length && (!bounds2 || bounds2.intersects(scene.bounds))) { + drawPath(path2, context2, scene.items[0], scene.items); + } + }; + } + function drawPath(path2, context2, item, items) { + var opacity2 = item.opacity == null ? 1 : item.opacity; + if (opacity2 === 0) return; + if (path2(context2, items)) return; + blend(context2, item); + if (item.fill && fill(context2, item, opacity2)) { + context2.fill(); } -}); -/** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ function Subflow(pulse, parent) { - (0, _vegaDataflow.Operator).call(this, pulse); - this.parent = parent; - this.count = 0; -} -(0, _vegaUtil.inherits)(Subflow, (0, _vegaDataflow.Operator), { - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ connect (target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return target.source = this; - }, - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ add (t) { - this.count += 1; - this.value.add.push(t); - }, - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ rem (t) { - this.count -= 1; - this.value.rem.push(t); - }, - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ mod (t) { - this.value.mod.push(t); - }, - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ init (pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }, - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ evaluate () { - // assert: this.value.stamp === pulse.stamp - return this.value; + if (item.stroke && stroke(context2, item, opacity2)) { + context2.stroke(); } -}); -/** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ function Facet(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._keys = (0, _vegaUtil.fastmap)(); // cache previously calculated key values - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = (f)=>{ - for(let i = 0, n = a.active; i < n; ++i)f(a[i], i, a); - }; -} -(0, _vegaUtil.inherits)(Facet, (0, _vegaDataflow.Transform), { - activate (flow) { - this._targets[this._targets.active++] = flow; - }, - // parent argument provided by PreFacet subclass - subflow (key, flow, pulse, parent) { - const flows = this.value; - let sf = (0, _vegaUtil.hasOwnProperty)(flows, key) && flows[key], df, p; - if (!sf) { - p = parent || (p = this._group[key]) && p.tuple; - df = pulse.dataflow; - sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this); - df.add(sf).connect(flow(df, key, p)); - flows[key] = sf; - this.activate(sf); - } else if (sf.value.stamp < pulse.stamp) { - sf.init(pulse); - this.activate(sf); - } - return sf; - }, - clean () { - const flows = this.value; - let detached = 0; - for(const key in flows)if (flows[key].count === 0) { - const detach = flows[key].detachSubflow; - if (detach) detach(); - delete flows[key]; - ++detached; - } - // remove inactive targets from the active targets array - if (detached) { - const active = this._targets.filter((sf)=>sf && sf.count > 0); - this.initTargets(active); - } - }, - initTargets (act) { - const a = this._targets, n = a.length, m = act ? act.length : 0; - let i = 0; - for(; i < m; ++i)a[i] = act[i]; - for(; i < n && a[i] != null; ++i)a[i] = null; // ensure old flows can be garbage collected - a.active = m; - }, - transform (_, pulse) { - const df = pulse.dataflow, key = _.key, flow = _.subflow, cache = this._keys, rekey = _.modified('key'), subflow = (key)=>this.subflow(key, flow, pulse); - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - cache.set((0, _vegaDataflow.tupleid)(t), k); - subflow(k).add(t); - }); - if (rekey || pulse.modified(key.fields)) pulse.visit(pulse.MOD, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 === k1) subflow(k1).mod(t); - else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - else if (pulse.changed(pulse.MOD)) pulse.visit(pulse.MOD, (t)=>{ - subflow(cache.get((0, _vegaDataflow.tupleid)(t))).mod(t); - }); - if (rekey) pulse.visit(pulse.REFLOW, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - if (pulse.clean()) df.runAfter(()=>{ - this.clean(); - cache.clean(); - }); - else if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return pulse; - } -}); -/** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ function Field(params) { - (0, _vegaDataflow.Operator).call(this, null, update$3, params); -} -(0, _vegaUtil.inherits)(Field, (0, _vegaDataflow.Operator)); -function update$3(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.isArray)(_.name) ? (0, _vegaUtil.array)(_.name).map((f)=>(0, _vegaUtil.field)(f)) : (0, _vegaUtil.field)(_.name, _.as); -} -/** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ function Filter(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -Filter.Definition = { - 'type': 'Filter', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Filter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), add = output.add, rem = output.rem, mod = output.mod, test = _.expr; - let isMod = true; - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - pulse.visit(pulse.ADD, (t)=>{ - if (test(t, _)) add.push(t); - else cache.set((0, _vegaDataflow.tupleid)(t), 1); - }); - function revisit(t) { - const id = (0, _vegaDataflow.tupleid)(t), b = test(t, _), s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) mod.push(t); - } - pulse.visit(pulse.MOD, revisit); - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - } -}); -/** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array<string>} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ function Flatten(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Flatten.Definition = { - 'type': 'Flatten', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'index', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true + } + function pick$1(test2) { + test2 = test2 || truthy; + return function(context2, scene, x2, y2, gx, gy) { + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return pickVisit(scene, (item) => { + const b2 = item.bounds; + if (b2 && !b2.contains(gx, gy) || !b2) return; + if (test2(context2, item, x2, y2, gx, gy)) return item; + }); + }; + } + function hitPath(path2, filled) { + return function(context2, o, x2, y2) { + var item = Array.isArray(o) ? o[0] : o, fill2 = filled == null ? item.fill : filled, stroke2 = item.stroke && context2.isPointInStroke, lw, lc; + if (stroke2) { + lw = item.strokeWidth; + lc = item.strokeCap; + context2.lineWidth = lw != null ? lw : 1; + context2.lineCap = lc != null ? lc : "butt"; + } + return path2(context2, o) ? false : fill2 && context2.isPointInPath(x2, y2) || stroke2 && context2.isPointInStroke(x2, y2); + }; + } + function pickPath(path2) { + return pick$1(hitPath(path2)); + } + function translate$1(x2, y2) { + return "translate(" + x2 + "," + y2 + ")"; + } + function rotate(a2) { + return "rotate(" + a2 + ")"; + } + function scale$3(scaleX, scaleY2) { + return "scale(" + scaleX + "," + scaleY2 + ")"; + } + function translateItem(item) { + return translate$1(item.x || 0, item.y || 0); + } + function rotateItem(item) { + return translate$1(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : ""); + } + function transformItem(item) { + return translate$1(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : "") + (item.scaleX || item.scaleY ? " " + scale$3(item.scaleX || 1, item.scaleY || 1) : ""); + } + function markItemPath(type2, shape2, isect) { + function attr2(emit2, item) { + emit2("transform", rotateItem(item)); + emit2("d", shape2(null, item)); + } + function bound2(bounds2, item) { + shape2(boundContext(bounds2, item.angle), item); + return boundStroke(bounds2, item).translate(item.x || 0, item.y || 0); + } + function draw2(context2, item) { + var x2 = item.x || 0, y2 = item.y || 0, a2 = item.angle || 0; + context2.translate(x2, y2); + if (a2) context2.rotate(a2 *= DegToRad); + context2.beginPath(); + shape2(context2, item); + if (a2) context2.rotate(-a2); + context2.translate(-x2, -y2); + } + return { + type: type2, + tag: "path", + nested: false, + attr: attr2, + bound: bound2, + draw: drawAll(draw2), + pick: pickPath(draw2), + isect: isect || intersectPath(draw2) + }; + } + var arc$2 = markItemPath("arc", arc$1); + function pickArea(a2, p) { + var v = a2[0].orient === "horizontal" ? p[1] : p[0], z2 = a2[0].orient === "horizontal" ? "y" : "x", i = a2.length, min2 = Infinity, hit2, d2; + while (--i >= 0) { + if (a2[i].defined === false) continue; + d2 = Math.abs(a2[i][z2] - v); + if (d2 < min2) { + min2 = d2; + hit2 = a2[i]; + } + } + return hit2; + } + function pickLine(a2, p) { + var t = Math.pow(a2[0].strokeWidth || 1, 2), i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + if (dd < t) return a2[i]; + } + return null; + } + function pickTrail(a2, p) { + var i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + dx = a2[i].size || 1; + if (dd < dx * dx) return a2[i]; + } + return null; + } + function markMultiItemPath(type2, shape2, tip) { + function attr2(emit2, item) { + var items = item.mark.items; + if (items.length) emit2("d", shape2(null, items)); + } + function bound2(bounds2, mark) { + var items = mark.items; + if (items.length === 0) { + return bounds2; + } else { + shape2(boundContext(bounds2), items); + return boundStroke(bounds2, items[0]); + } + } + function draw2(context2, items) { + context2.beginPath(); + shape2(context2, items); + } + const hit2 = hitPath(draw2); + function pick2(context2, scene, x2, y2, gx, gy) { + var items = scene.items, b2 = scene.bounds; + if (!items || !items.length || b2 && !b2.contains(gx, gy)) { + return null; + } + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return hit2(context2, items, x2, y2) ? items[0] : null; + } + return { + type: type2, + tag: "path", + nested: true, + attr: attr2, + bound: bound2, + draw: drawOne(draw2), + pick: pick2, + isect: intersectPoint, + tip + }; + } + var area$2 = markMultiItemPath("area", area$1, pickArea); + function clip$2(context2, scene) { + var clip2 = scene.clip; + context2.save(); + if (isFunction(clip2)) { + context2.beginPath(); + clip2(context2); + context2.clip(); + } else { + clipGroup(context2, scene.group); + } + } + function clipGroup(context2, group2) { + context2.beginPath(); + hasCornerRadius(group2) ? rectangle(context2, group2, 0, 0) : context2.rect(0, 0, group2.width || 0, group2.height || 0); + context2.clip(); + } + function offset$1(item) { + const sw = value$2(item.strokeWidth, 1); + return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; + } + function attr$5(emit2, item) { + emit2("transform", translateItem(item)); + } + function emitRectangle(emit2, item) { + const off = offset$1(item); + emit2("d", rectangle(null, item, off, off)); + } + function background$1(emit2, item) { + emit2("class", "background"); + emit2("aria-hidden", true); + emitRectangle(emit2, item); + } + function foreground(emit2, item) { + emit2("class", "foreground"); + emit2("aria-hidden", true); + if (item.strokeForeground) { + emitRectangle(emit2, item); + } else { + emit2("d", ""); + } + } + function content(emit2, item, renderer) { + const url = item.clip ? clip$1$1(renderer, item, item) : null; + emit2("clip-path", url); + } + function bound$5(bounds2, group2) { + if (!group2.clip && group2.items) { + const items = group2.items, m2 = items.length; + for (let j = 0; j < m2; ++j) { + bounds2.union(items[j].bounds); + } + } + if ((group2.clip || group2.width || group2.height) && !group2.noBound) { + bounds2.add(0, 0).add(group2.width || 0, group2.height || 0); + } + boundStroke(bounds2, group2); + return bounds2.translate(group2.x || 0, group2.y || 0); + } + function rectanglePath(context2, group2, x2, y2) { + const off = offset$1(group2); + context2.beginPath(); + rectangle(context2, group2, (x2 || 0) + off, (y2 || 0) + off); + } + const hitBackground = hitPath(rectanglePath); + const hitForeground = hitPath(rectanglePath, false); + const hitCorner = hitPath(rectanglePath, true); + function draw$4(context2, scene, bounds2, markTypes) { + visit(scene, (group2) => { + const gx = group2.x || 0, gy = group2.y || 0, fore = group2.strokeForeground, opacity2 = group2.opacity == null ? 1 : group2.opacity; + if ((group2.stroke || group2.fill) && opacity2) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (group2.fill && fill(context2, group2, opacity2)) { + context2.fill(); + } + if (group2.stroke && !fore && stroke(context2, group2, opacity2)) { + context2.stroke(); } - ] -}; -(0, _vegaUtil.inherits)(Flatten, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index = _.index || null, m = as.length; - // remove any previous results - out.rem = this.value; - // generate flattened tuples - pulse.visit(pulse.SOURCE, (t)=>{ - const arrays = fields.map((f)=>f(t)), maxlen = arrays.reduce((l, a)=>Math.max(l, a.length), 0); - let i = 0, j, d, v; - for(; i < maxlen; ++i){ - d = (0, _vegaDataflow.derive)(t); - for(j = 0; j < m; ++j)d[as[j]] = (v = arrays[j][i]) == null ? null : v; - if (index) d[index] = i; - out.add.push(d); - } - }); - this.value = out.source = out.add; - if (index) out.modifies(index); - return out.modifies(as); - } -}); -/** - * Folds one more tuple fields into multiple tuples in which the field - * name and values are available under new 'key' and 'value' fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.fields - An array of field accessors - * for the tuple fields that should be folded. - * @param {Array<string>} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ function Fold(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Fold.Definition = { - 'type': 'Fold', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'key', - 'value' - ] + } + context2.save(); + context2.translate(gx, gy); + if (group2.clip) clipGroup(context2, group2); + if (bounds2) bounds2.translate(-gx, -gy); + visit(group2, (item) => { + if (item.marktype === "group" || markTypes == null || markTypes.includes(item.marktype)) { + this.draw(context2, item, bounds2, markTypes); } - ] -}; -(0, _vegaUtil.inherits)(Fold, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, fnames = fields.map((0, _vegaUtil.accessorName)), as = _.as || [ - 'key', - 'value' - ], k = as[0], v = as[1], n = fields.length; - out.rem = this.value; - pulse.visit(pulse.SOURCE, (t)=>{ - for(let i = 0, d; i < n; ++i){ - d = (0, _vegaDataflow.derive)(t); - d[k] = fnames[i]; - d[v] = fields[i](t); - out.add.push(d); - } - }); - this.value = out.source = out.add; - return out.modifies(as); - } -}); -/** - * Invokes a function for each data tuple and saves the results as a new field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The formula function to invoke for each tuple. - * @param {string} params.as - The field name under which to save the result. - * @param {boolean} [params.initonly=false] - If true, the formula is applied to - * added tuples only, and does not update in response to modifications. - */ function Formula(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Formula.Definition = { - 'type': 'Formula', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'required': true - }, - { - 'name': 'initonly', - 'type': 'boolean' + }); + if (bounds2) bounds2.translate(gx, gy); + context2.restore(); + if (fore && group2.stroke && opacity2) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (stroke(context2, group2, opacity2)) { + context2.stroke(); } - ] -}; -(0, _vegaUtil.inherits)(Formula, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const func = _.expr, as = _.as, mod = _.modified(), flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD; - if (mod) // parameters updated, need to reflow - pulse = pulse.materialize().reflow(true); - if (!_.initonly) pulse.modifies(as); - return pulse.visit(flag, (t)=>t[as] = func(t, _)); - } -}); -/** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ function Generate(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(Generate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), gen = _.generator; - let data = this.value, num = _.size - data.length, add, rem, t; - if (num > 0) { - // need more tuples, generate and add - for(add = []; --num >= 0;){ - add.push(t = (0, _vegaDataflow.ingest)(gen(_))); - data.push(t); - } - out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem; - data = data.slice(-num); + } + }); + } + function pick(context2, scene, x2, y2, gx, gy) { + if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { + return null; + } + const cx = x2 * context2.pixelRatio, cy = y2 * context2.pixelRatio; + return pickVisit(scene, (group2) => { + let hit2, dx, dy; + const b2 = group2.bounds; + if (b2 && !b2.contains(gx, gy)) return; + dx = group2.x || 0; + dy = group2.y || 0; + const dw = dx + (group2.width || 0), dh = dy + (group2.height || 0), c2 = group2.clip; + if (c2 && (gx < dx || gx > dw || gy < dy || gy > dh)) return; + context2.save(); + context2.translate(dx, dy); + dx = gx - dx; + dy = gy - dy; + if (c2 && hasCornerRadius(group2) && !hitCorner(context2, group2, cx, cy)) { + context2.restore(); + return null; + } + const fore = group2.strokeForeground, ix = scene.interactive !== false; + if (ix && fore && group2.stroke && hitForeground(context2, group2, cx, cy)) { + context2.restore(); + return group2; + } + hit2 = pickVisit(group2, (mark) => pickMark(mark, dx, dy) ? this.pick(mark, x2, y2, dx, dy) : null); + if (!hit2 && ix && (group2.fill || !fore && group2.stroke) && hitBackground(context2, group2, cx, cy)) { + hit2 = group2; + } + context2.restore(); + return hit2 || null; + }); + } + function pickMark(mark, x2, y2) { + return (mark.interactive !== false || mark.marktype === "group") && mark.bounds && mark.bounds.contains(x2, y2); + } + var group = { + type: "group", + tag: "g", + nested: false, + attr: attr$5, + bound: bound$5, + draw: draw$4, + pick, + isect: intersectRect, + content, + background: background$1, + foreground + }; + var metadata = { + "xmlns": "http://www.w3.org/2000/svg", + "xmlns:xlink": "http://www.w3.org/1999/xlink", + "version": "1.1" + }; + function getImage(item, renderer) { + var image2 = item.image; + if (!image2 || item.url && item.url !== image2.url) { + image2 = { + complete: false, + width: 0, + height: 0 + }; + renderer.loadImage(item.url).then((image3) => { + item.image = image3; + item.image.url = item.url; + }); + } + return image2; + } + function imageWidth(item, image2) { + return item.width != null ? item.width : !image2 || !image2.width ? 0 : item.aspect !== false && item.height ? item.height * image2.width / image2.height : image2.width; + } + function imageHeight(item, image2) { + return item.height != null ? item.height : !image2 || !image2.height ? 0 : item.aspect !== false && item.width ? item.width * image2.height / image2.width : image2.height; + } + function imageXOffset(align, w2) { + return align === "center" ? w2 / 2 : align === "right" ? w2 : 0; + } + function imageYOffset(baseline2, h2) { + return baseline2 === "middle" ? h2 / 2 : baseline2 === "bottom" ? h2 : 0; + } + function attr$4(emit2, item, renderer) { + const img = getImage(item, renderer), w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ""; + emit2("href", i, metadata["xmlns:xlink"], "xlink:href"); + emit2("transform", translate$1(x2, y2)); + emit2("width", w2); + emit2("height", h2); + emit2("preserveAspectRatio", item.aspect === false ? "none" : "xMidYMid"); + } + function bound$4(bounds2, item) { + const img = item.image, w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2); + return bounds2.set(x2, y2, x2 + w2, y2 + h2); + } + function draw$3(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + const img = getImage(item, this); + let w2 = imageWidth(item, img); + let h2 = imageHeight(item, img); + if (w2 === 0 || h2 === 0) return; + let x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), opacity2, ar0, ar1, t; + if (item.aspect !== false) { + ar0 = img.width / img.height; + ar1 = item.width / item.height; + if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { + if (ar1 < ar0) { + t = w2 / ar0; + y2 += (h2 - t) / 2; + h2 = t; + } else { + t = h2 * ar0; + x2 += (w2 - t) / 2; + w2 = t; + } } - out.source = this.value = data; - return out; + } + if (img.complete || img.toDataURL) { + blend(context2, item); + context2.globalAlpha = (opacity2 = item.opacity) != null ? opacity2 : 1; + context2.imageSmoothingEnabled = item.smooth !== false; + context2.drawImage(img, x2, y2, w2, h2); + } + }); + } + var image = { + type: "image", + tag: "image", + nested: false, + attr: attr$4, + bound: bound$4, + draw: draw$3, + pick: pick$1(), + isect: truthy, + // bounds check is sufficient + get: getImage, + xOffset: imageXOffset, + yOffset: imageYOffset + }; + var line$2 = markMultiItemPath("line", line$1, pickLine); + function attr$3(emit2, item) { + var sx = item.scaleX || 1, sy = item.scaleY || 1; + if (sx !== 1 || sy !== 1) { + emit2("vector-effect", "non-scaling-stroke"); + } + emit2("transform", transformItem(item)); + emit2("d", item.path); + } + function path$1(context2, item) { + var path2 = item.path; + if (path2 == null) return true; + var x2 = item.x || 0, y2 = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a2 = (item.angle || 0) * DegToRad, cache2 = item.pathCache; + if (!cache2 || cache2.path !== path2) { + (item.pathCache = cache2 = parse$3(path2)).path = path2; + } + if (a2 && context2.rotate && context2.translate) { + context2.translate(x2, y2); + context2.rotate(a2); + pathRender(context2, cache2, 0, 0, sx, sy); + context2.rotate(-a2); + context2.translate(-x2, -y2); + } else { + pathRender(context2, cache2, x2, y2, sx, sy); + } + } + function bound$3(bounds2, item) { + return path$1(boundContext(bounds2, item.angle), item) ? bounds2.set(0, 0, 0, 0) : boundStroke(bounds2, item, true); + } + var path$2 = { + type: "path", + tag: "path", + nested: false, + attr: attr$3, + bound: bound$3, + draw: drawAll(path$1), + pick: pickPath(path$1), + isect: intersectPath(path$1) + }; + function attr$2(emit2, item) { + emit2("d", rectangle(null, item)); + } + function bound$2(bounds2, item) { + var x2, y2; + return boundStroke(bounds2.set(x2 = item.x || 0, y2 = item.y || 0, x2 + item.width || 0, y2 + item.height || 0), item); + } + function draw$2(context2, item) { + context2.beginPath(); + rectangle(context2, item); + } + var rect = { + type: "rect", + tag: "path", + nested: false, + attr: attr$2, + bound: bound$2, + draw: drawAll(draw$2), + pick: pickPath(draw$2), + isect: intersectRect + }; + function attr$1(emit2, item) { + emit2("transform", translateItem(item)); + emit2("x2", item.x2 != null ? item.x2 - (item.x || 0) : 0); + emit2("y2", item.y2 != null ? item.y2 - (item.y || 0) : 0); + } + function bound$1(bounds2, item) { + var x12, y12; + return boundStroke(bounds2.set(x12 = item.x || 0, y12 = item.y || 0, item.x2 != null ? item.x2 : x12, item.y2 != null ? item.y2 : y12), item); + } + function path(context2, item, opacity2) { + var x12, y12, x2, y2; + if (item.stroke && stroke(context2, item, opacity2)) { + x12 = item.x || 0; + y12 = item.y || 0; + x2 = item.x2 != null ? item.x2 : x12; + y2 = item.y2 != null ? item.y2 : y12; + context2.beginPath(); + context2.moveTo(x12, y12); + context2.lineTo(x2, y2); + return true; + } + return false; + } + function draw$1(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + var opacity2 = item.opacity == null ? 1 : item.opacity; + if (opacity2 && path(context2, item, opacity2)) { + blend(context2, item); + context2.stroke(); + } + }); + } + function hit$1(context2, item, x2, y2) { + if (!context2.isPointInStroke) return false; + return path(context2, item, 1) && context2.isPointInStroke(x2, y2); + } + var rule$1 = { + type: "rule", + tag: "line", + nested: false, + attr: attr$1, + bound: bound$1, + draw: draw$1, + pick: pick$1(hit$1), + isect: intersectRule + }; + var shape = markItemPath("shape", shape$1); + var symbol = markItemPath("symbol", symbol$1, intersectPoint); + const widthCache = lruCache(); + var textMetrics = { + height: fontSize, + measureWidth, + estimateWidth, + width: estimateWidth, + canvas: useCanvas + }; + useCanvas(true); + function useCanvas(use2) { + textMetrics.width = use2 && context$2 ? measureWidth : estimateWidth; + } + function estimateWidth(item, text2) { + return _estimateWidth(textValue(item, text2), fontSize(item)); + } + function _estimateWidth(text2, currentFontHeight) { + return ~~(0.8 * text2.length * currentFontHeight); + } + function measureWidth(item, text2) { + return fontSize(item) <= 0 || !(text2 = textValue(item, text2)) ? 0 : _measureWidth(text2, font(item)); + } + function _measureWidth(text2, currentFont) { + const key2 = `(${currentFont}) ${text2}`; + let width2 = widthCache.get(key2); + if (width2 === void 0) { + context$2.font = currentFont; + width2 = context$2.measureText(text2).width; + widthCache.set(key2, width2); + } + return width2; + } + function fontSize(item) { + return item.fontSize != null ? +item.fontSize || 0 : 11; + } + function lineHeight(item) { + return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; + } + function lineArray(_) { + return isArray(_) ? _.length > 1 ? _ : _[0] : _; + } + function textLines(item) { + return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text); + } + function multiLineOffset(item) { + const tl2 = textLines(item); + return (isArray(tl2) ? tl2.length - 1 : 0) * lineHeight(item); + } + function textValue(item, line2) { + const text2 = line2 == null ? "" : (line2 + "").trim(); + return item.limit > 0 && text2.length ? truncate(item, text2) : text2; + } + function widthGetter(item) { + if (textMetrics.width === measureWidth) { + const currentFont = font(item); + return (text2) => _measureWidth(text2, currentFont); + } else if (textMetrics.width === estimateWidth) { + const currentFontHeight = fontSize(item); + return (text2) => _estimateWidth(text2, currentFontHeight); + } else { + return (text2) => textMetrics.width(item, text2); } -}); -const Methods = { - value: 'value', - median: (0, _d3Array.median), - mean: (0, _d3Array.mean), - min: (0, _d3Array.min), - max: (0, _d3Array.max) -}; -const Empty = []; -/** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array<function(object): *>} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ function Impute(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Impute.Definition = { - 'type': 'Impute', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'keyvals', - 'array': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'value', - 'values': [ - 'value', - 'mean', - 'median', - 'max', - 'min' - ] - }, - { - 'name': 'value', - 'default': 0 - } - ] -}; -function getValue(_) { - var m = _.method || Methods.value, v; - if (Methods[m] == null) (0, _vegaUtil.error)('Unrecognized imputation method: ' + m); - else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return ()=>v; - } else return Methods[m]; -} -function getField(_) { - const f = _.field; - return (t)=>t ? f(t) : NaN; -} -(0, _vegaUtil.inherits)(Impute, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), impute = getValue(_), field = getField(_), fName = (0, _vegaUtil.accessorName)(_.field), kName = (0, _vegaUtil.accessorName)(_.key), gNames = (_.groupby || []).map((0, _vegaUtil.accessorName)), groups = partition(pulse.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m = groups.domain.length, group, value, gVals, kVal, g, i, j, l, n, t; - for(g = 0, l = groups.length; g < l; ++g){ - group = groups[g]; - gVals = group.values; - value = NaN; - // add tuples for missing values - for(j = 0; j < m; ++j){ - if (group[j] != null) continue; - kVal = groups.domain[j]; - t = { - _impute: true - }; - for(i = 0, n = gVals.length; i < n; ++i)t[gNames[i]] = gVals[i]; - t[kName] = kVal; - t[fName] = Number.isNaN(value) ? value = impute(group, field) : value; - curr.push((0, _vegaDataflow.ingest)(t)); - } - } - // update pulse with imputed tuples - if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); - if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); - this.value = curr; - return out; + } + function truncate(item, text2) { + var limit = +item.limit, width2 = widthGetter(item); + if (width2(text2) < limit) return text2; + var ellipsis = item.ellipsis || "…", rtl = item.dir === "rtl", lo = 0, hi = text2.length, mid; + limit -= width2(ellipsis); + if (rtl) { + while (lo < hi) { + mid = lo + hi >>> 1; + if (width2(text2.slice(mid)) > limit) lo = mid + 1; + else hi = mid; + } + return ellipsis + text2.slice(lo); + } else { + while (lo < hi) { + mid = 1 + (lo + hi >>> 1); + if (width2(text2.slice(0, mid)) < limit) lo = mid; + else hi = mid - 1; + } + return text2.slice(0, lo) + ellipsis; } -}); -function partition(data, groupby, key, keyvals) { - var get = (f)=>f(t), groups = [], domain = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group, i, j, k, n, t; - domain.forEach((k, i)=>kMap[k] = i + 1); - for(i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = key(t); - j = kMap[k] || (kMap[k] = domain.push(k)); - gKey = (gVals = groupby ? groupby.map(get) : Empty) + ''; - if (!(group = gMap[gKey])) { - group = gMap[gKey] = []; - groups.push(group); - group.values = gVals; - } - group[j - 1] = t; - } - groups.domain = domain; - return groups; -} -/** - * Extend input tuples with aggregate values. - * Calcuates aggregate values and joins them with the input stream. - * @constructor - */ function JoinAggregate(params) { - Aggregate.call(this, params); -} -JoinAggregate.Definition = { - 'type': 'JoinAggregate', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(JoinAggregate, Aggregate, { - transform (_, pulse) { - const aggr = this, mod = _.modified(); - let cells; - // process all input tuples to calculate aggregates - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - cells = aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - cells = aggr.value = aggr.value || this.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // update aggregation cells - aggr.changes(); - // write aggregate values to input tuples - pulse.visit(pulse.SOURCE, (t)=>{ - (0, _vegaUtil.extend)(t, cells[aggr.cellkey(t)].tuple); - }); - return pulse.reflow(mod).modifies(this._outputs); - }, - changes () { - const adds = this._adds, mods = this._mods; - let i, n; - for(i = 0, n = this._alen; i < n; ++i){ - this.celltuple(adds[i]); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - this.celltuple(mods[i]); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - } -}); -/** - * Compute kernel density estimates (KDE) for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array<number>} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function KDE(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE.Definition = { - 'type': 'KDE', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'cumulative', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] - } - ] -}; -(0, _vegaUtil.inherits)(KDE, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), bandwidth = _.bandwidth, method = _.cumulative ? 'cdf' : 'pdf', as = _.as || [ - 'value', - 'density' - ], values = []; - let domain = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (_.resolve === 'shared') { - if (!domain) domain = (0, _vegaUtil.extent)(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - groups.forEach((g)=>{ - const density = (0, _vegaStatistics.randomKDE)(g, bandwidth)[method], scale = _.counts ? g.length : 1, local = domain || (0, _vegaUtil.extent)(g); - (0, _vegaStatistics.sampleCurve)(density, local, minsteps, maxsteps).forEach((v)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = v[0]; - t[as[1]] = v[1] * scale; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - return out; + } + function fontFamily(item, quote) { + var font2 = item.font; + return (quote && font2 ? String(font2).replace(/"/g, "'") : font2) || "sans-serif"; + } + function font(item, quote) { + return (item.fontStyle ? item.fontStyle + " " : "") + (item.fontVariant ? item.fontVariant + " " : "") + (item.fontWeight ? item.fontWeight + " " : "") + fontSize(item) + "px " + fontFamily(item, quote); + } + function offset$2(item) { + var baseline2 = item.baseline, h2 = fontSize(item); + return Math.round(baseline2 === "top" ? 0.79 * h2 : baseline2 === "middle" ? 0.3 * h2 : baseline2 === "bottom" ? -0.21 * h2 : baseline2 === "line-top" ? 0.29 * h2 + 0.5 * lineHeight(item) : baseline2 === "line-bottom" ? 0.29 * h2 - 0.5 * lineHeight(item) : 0); + } + const textAlign = { + "left": "start", + "center": "middle", + "right": "end" + }; + const tempBounds$1 = new Bounds(); + function anchorPoint(item) { + var x2 = item.x || 0, y2 = item.y || 0, r = item.radius || 0, t; + if (r) { + t = (item.theta || 0) - HalfPi; + x2 += r * Math.cos(t); + y2 += r * Math.sin(t); } -}); -/** - * Generates a key function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string>} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ function Key(params) { - (0, _vegaDataflow.Operator).call(this, null, update$2, params); -} -(0, _vegaUtil.inherits)(Key, (0, _vegaDataflow.Operator)); -function update$2(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.key)(_.fields, _.flat); -} -/** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ function Load(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this._pending = null; -} -(0, _vegaUtil.inherits)(Load, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow; - if (this._pending) // update state and return pulse - return output(this, pulse, this._pending); - if (stop(_)) return pulse.StopPropagation; - if (_.values) // parse and ingest values, return output pulse - return output(this, pulse, df.parse(_.values, _.format)); - else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then((res)=>{ - this._pending = (0, _vegaUtil.array)(res.data); - return (df)=>df.touch(this); - }); - return { - async: p - }; - } else // return promise for synchronous loading - return df.request(_.url, _.format).then((res)=>output(this, pulse, (0, _vegaUtil.array)(res.data))); - } -}); -function stop(_) { - return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format')); -} -function output(op, pulse, data) { - data.forEach((0, _vegaDataflow.ingest)); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; -} -/** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array<function(object): *} params.fields - The fields to lookup. - * @param {Array<string>} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ function Lookup(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -Lookup.Definition = { - 'type': 'Lookup', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'index', - 'type': 'index', - 'params': [ - { - 'name': 'from', - 'type': 'data', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - } - ] - }, - { - 'name': 'values', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - }, - { - 'name': 'default', - 'default': null - } - ] -}; -(0, _vegaUtil.inherits)(Lookup, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const keys = _.fields, index = _.index, values = _.values, defaultValue = _.default == null ? null : _.default, reset = _.modified(), n = keys.length; - let flag = reset ? pulse.SOURCE : pulse.ADD, out = pulse, as = _.as, set, m, mods; - if (values) { - m = values.length; - if (n > 1 && !as) (0, _vegaUtil.error)('Multi-field lookup requires explicit "as" parameter.'); - if (as && as.length !== n * m) (0, _vegaUtil.error)('The "as" parameter has too few output field names.'); - as = as || values.map((0, _vegaUtil.accessorName)); - set = function(t) { - for(var i = 0, k = 0, j, v; i < n; ++i){ - v = index.get(keys[i](t)); - if (v == null) for(j = 0; j < m; ++j, ++k)t[as[k]] = defaultValue; - else for(j = 0; j < m; ++j, ++k)t[as[k]] = values[j](v); - } - }; - } else { - if (!as) (0, _vegaUtil.error)('Missing output field names.'); - set = function(t) { - for(var i = 0, v; i < n; ++i){ - v = index.get(keys[i](t)); - t[as[i]] = v == null ? defaultValue : v; - } - }; - } - if (reset) out = pulse.reflow(true); - else { - mods = keys.some((k)=>pulse.modified(k.fields)); - flag |= mods ? pulse.MOD : 0; - } - pulse.visit(flag, set); - return out.modifies(as); - } -}); -/** - * Computes global min/max extents over a collection of extents. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<number>>} params.extents - The input extents. - */ function MultiExtent(params) { - (0, _vegaDataflow.Operator).call(this, null, update$1, params); -} -(0, _vegaUtil.inherits)(MultiExtent, (0, _vegaDataflow.Operator)); -function update$1(_) { - if (this.value && !_.modified()) return this.value; - const ext = _.extents, n = ext.length; - let min = Infinity, max = -Infinity, i, e; - for(i = 0; i < n; ++i){ - e = ext[i]; - if (e[0] < min) min = e[0]; - if (e[1] > max) max = e[1]; + tempBounds$1.x1 = x2; + tempBounds$1.y1 = y2; + return tempBounds$1; + } + function attr(emit2, item) { + var dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item), p = anchorPoint(item), x2 = p.x1, y2 = p.y1, a2 = item.angle || 0, t; + emit2("text-anchor", textAlign[item.align] || "start"); + if (a2) { + t = translate$1(x2, y2) + " " + rotate(a2); + if (dx || dy) t += " " + translate$1(dx, dy); + } else { + t = translate$1(x2 + dx, y2 + dy); } - return [ - min, - max - ]; -} -/** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<*>>} params.values - The input value arrrays. - */ function MultiValues(params) { - (0, _vegaDataflow.Operator).call(this, null, update, params); -} -(0, _vegaUtil.inherits)(MultiValues, (0, _vegaDataflow.Operator)); -function update(_) { - return this.value && !_.modified() ? this.value : _.values.reduce((data, _)=>data.concat(_), []); -} -/** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Params(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Params, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - } -}); -/** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ function Pivot(params) { - Aggregate.call(this, params); -} -Pivot.Definition = { - 'type': 'Pivot', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'value', - 'type': 'field', - 'required': true - }, - { - 'name': 'op', - 'type': 'enum', - 'values': ValidAggregateOps, - 'default': 'sum' - }, - { - 'name': 'limit', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Pivot, Aggregate, { - _transform: Aggregate.prototype.transform, - transform (_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - } -}); -// Shoehorn a pivot transform into an aggregate transform! -// First collect all unique pivot field values. -// Then generate aggregate fields for each output pivot field. -function aggregateParams(_, pulse) { - const key = _.field, value = _.value, op = (_.op === 'count' ? '__count__' : _.op) || 'sum', fields = (0, _vegaUtil.accessorFields)(key).concat((0, _vegaUtil.accessorFields)(value)), keys = pivotKeys(key, _.limit || 0, pulse); - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(()=>op), - fields: keys.map((k)=>get(k, key, value, fields)), - as: keys.map((k)=>k + ''), - modified: _.modified.bind(_) - }; -} -// Generate aggregate field accessor. -// Output NaN for non-existent values; aggregator will ignore! -function get(k, key, value, fields) { - return (0, _vegaUtil.accessor)((d)=>key(d) === k ? value(d) : NaN, fields, k + ''); -} -// Collect (and optionally limit) all unique pivot values. -function pivotKeys(key, limit, pulse) { - const map = {}, list = []; - pulse.visit(pulse.SOURCE, (t)=>{ - const k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); + emit2("transform", t); + } + function bound(bounds2, item, mode) { + var h2 = textMetrics.height(item), a2 = item.align, p = anchorPoint(item), x2 = p.x1, y2 = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h2), tl2 = textLines(item), w2; + if (isArray(tl2)) { + h2 += lineHeight(item) * (tl2.length - 1); + w2 = tl2.reduce((w3, t) => Math.max(w3, textMetrics.width(item, t)), 0); + } else { + w2 = textMetrics.width(item, tl2); + } + if (a2 === "center") { + dx -= w2 / 2; + } else if (a2 === "right") { + dx -= w2; + } else ; + bounds2.set(dx += x2, dy += y2, dx + w2, dy + h2); + if (item.angle && !mode) { + bounds2.rotate(item.angle * DegToRad, x2, y2); + } else if (mode === 2) { + return bounds2.rotatedPoints(item.angle * DegToRad, x2, y2); + } + return bounds2; + } + function draw$5(context2, scene, bounds2) { + visit(scene, (item) => { + var opacity2 = item.opacity == null ? 1 : item.opacity, p, x2, y2, i, lh, tl2, str; + if (bounds2 && !bounds2.intersects(item.bounds) || // bounds check + opacity2 === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; + context2.font = font(item); + context2.textAlign = item.align || "left"; + p = anchorPoint(item); + x2 = p.x1, y2 = p.y1; + if (item.angle) { + context2.save(); + context2.translate(x2, y2); + context2.rotate(item.angle * DegToRad); + x2 = y2 = 0; + } + x2 += item.dx || 0; + y2 += (item.dy || 0) + offset$2(item); + tl2 = textLines(item); + blend(context2, item); + if (isArray(tl2)) { + lh = lineHeight(item); + for (i = 0; i < tl2.length; ++i) { + str = textValue(item, tl2[i]); + if (item.fill && fill(context2, item, opacity2)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity2)) { + context2.strokeText(str, x2, y2); + } + y2 += lh; + } + } else { + str = textValue(item, tl2); + if (item.fill && fill(context2, item, opacity2)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity2)) { + context2.strokeText(str, x2, y2); } + } + if (item.angle) context2.restore(); }); - list.sort((0, _vegaUtil.ascending)); - return limit ? list.slice(0, limit) : list; -} -/** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array<object>} params.field - The field - * accessor for an array of subflow tuple objects. - */ function PreFacet(params) { - Facet.call(this, params); -} -(0, _vegaUtil.inherits)(PreFacet, Facet, { - transform (_, pulse) { - const flow = _.subflow, field = _.field, subflow = (t)=>this.subflow((0, _vegaDataflow.tupleid)(t), flow, pulse, t); - if (_.modified('field') || field && pulse.modified((0, _vegaUtil.accessorFields)(field))) (0, _vegaUtil.error)('PreFacet does not support field modification.'); - this.initTargets(); // reset list of active subflows - if (field) { - pulse.visit(pulse.MOD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.mod(_)); - }); - pulse.visit(pulse.ADD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.add((0, _vegaDataflow.ingest)(_))); - }); - pulse.visit(pulse.REM, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, (t)=>subflow(t).mod(t)); - pulse.visit(pulse.ADD, (t)=>subflow(t).add(t)); - pulse.visit(pulse.REM, (t)=>subflow(t).rem(t)); - } - if (pulse.clean()) pulse.runAfter(()=>this.clean()); - return pulse; - } -}); -/** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *} params.fields - The fields to project, - * as an array of field accessors. If unspecified, all fields will be - * copied with names unchanged. - * @param {Array<string>} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ function Project(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Project.Definition = { - 'type': 'Project', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Project, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive = fields ? (s, t)=>project(s, t, fields, as) : (0, _vegaDataflow.rederive); - let lut; - if (this.value) lut = this.value; - else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = derive(t, (0, _vegaDataflow.ingest)({})); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - out.mod.push(derive(t, lut[(0, _vegaDataflow.tupleid)(t)])); - }); - return out; + } + function hit(context2, item, x2, y2, gx, gy) { + if (item.fontSize <= 0) return false; + if (!item.angle) return true; + var p = anchorPoint(item), ax = p.x1, ay = p.y1, b2 = bound(tempBounds$1, item, 1), a2 = -item.angle * DegToRad, cos2 = Math.cos(a2), sin2 = Math.sin(a2), px2 = cos2 * gx - sin2 * gy + (ax - cos2 * ax + sin2 * ay), py2 = sin2 * gx + cos2 * gy + (ay - sin2 * ax - cos2 * ay); + return b2.contains(px2, py2); + } + function intersectText(item, box2) { + const p = bound(tempBounds$1, item, 2); + return intersectBoxLine(box2, p[0], p[1], p[2], p[3]) || intersectBoxLine(box2, p[0], p[1], p[4], p[5]) || intersectBoxLine(box2, p[4], p[5], p[6], p[7]) || intersectBoxLine(box2, p[2], p[3], p[6], p[7]); + } + var text = { + type: "text", + tag: "text", + nested: false, + attr, + bound, + draw: draw$5, + pick: pick$1(hit), + isect: intersectText + }; + var trail = markMultiItemPath("trail", trail$1, pickTrail); + var Marks = { + arc: arc$2, + area: area$2, + group, + image, + line: line$2, + path: path$2, + rect, + rule: rule$1, + shape, + symbol, + text, + trail + }; + function boundItem$1(item, func, opt) { + var type2 = Marks[item.mark.marktype], bound2 = func || type2.bound; + if (type2.nested) item = item.mark; + return bound2(item.bounds || (item.bounds = new Bounds()), item, opt); + } + var DUMMY = { + mark: null + }; + function boundMark(mark, bounds2, opt) { + var type2 = Marks[mark.marktype], bound2 = type2.bound, items = mark.items, hasItems = items && items.length, i, n, item, b2; + if (type2.nested) { + if (hasItems) { + item = items[0]; + } else { + DUMMY.mark = mark; + item = DUMMY; + } + b2 = boundItem$1(item, bound2, opt); + bounds2 = bounds2 && bounds2.union(b2) || b2; + return bounds2; + } + bounds2 = bounds2 || mark.bounds && mark.bounds.clear() || new Bounds(); + if (hasItems) { + for (i = 0, n = items.length; i < n; ++i) { + bounds2.union(boundItem$1(items[i], bound2, opt)); + } } -}); -function project(s, t, fields, as) { - for(let i = 0, n = fields.length; i < n; ++i)t[as[i]] = fields[i](s); - return t; -} -/** - * Proxy the value of another operator as a pure signal value. - * Ensures no tuples are propagated. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {*} params.value - The value to proxy, becomes the value of this operator. - */ function Proxy(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Proxy, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = _.value; - return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Generates sample quantile values from an input data stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the data field - * over which to calculate quantile values. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {Array<number>} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array<number>} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ function Quantile(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Quantile.Definition = { - 'type': 'Quantile', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'probs', - 'type': 'number', - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 0.01 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'prob', - 'value' - ] - } - ] -}; -const EPSILON = 1e-14; -(0, _vegaUtil.inherits)(Quantile, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), as = _.as || [ - 'prob', - 'value' - ]; - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), values = [], step = _.step || 0.01, p = _.probs || (0, _d3Array.range)(step / 2, 1 - EPSILON, step), n = p.length; - groups.forEach((g)=>{ - const q = (0, _vegaStatistics.quantiles)(g, p); - for(let i = 0; i < n; ++i){ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[i]; - t[as[1]] = q[i]; - values.push((0, _vegaDataflow.ingest)(t)); - } + return mark.bounds = bounds2; + } + const keys$1 = [ + "marktype", + "name", + "role", + "interactive", + "clip", + "items", + "zindex", + "x", + "y", + "width", + "height", + "align", + "baseline", + // layout + "fill", + "fillOpacity", + "opacity", + "blend", + // fill + "stroke", + "strokeOpacity", + "strokeWidth", + "strokeCap", + // stroke + "strokeDash", + "strokeDashOffset", + // stroke dash + "strokeForeground", + "strokeOffset", + // group + "startAngle", + "endAngle", + "innerRadius", + "outerRadius", + // arc + "cornerRadius", + "padAngle", + // arc, rect + "cornerRadiusTopLeft", + "cornerRadiusTopRight", + // rect, group + "cornerRadiusBottomLeft", + "cornerRadiusBottomRight", + "interpolate", + "tension", + "orient", + "defined", + // area, line + "url", + "aspect", + "smooth", + // image + "path", + "scaleX", + "scaleY", + // path + "x2", + "y2", + // rule + "size", + "shape", + // symbol + "text", + "angle", + "theta", + "radius", + "dir", + "dx", + "dy", + // text + "ellipsis", + "limit", + "lineBreak", + "lineHeight", + "font", + "fontSize", + "fontWeight", + "fontStyle", + "fontVariant", + // font + "description", + "aria", + "ariaRole", + "ariaRoleDescription" + // aria + ]; + function sceneToJSON(scene, indent) { + return JSON.stringify(scene, keys$1, indent); + } + function sceneFromJSON(json2) { + const scene = typeof json2 === "string" ? JSON.parse(json2) : json2; + return initialize$1(scene); + } + function initialize$1(scene) { + var type2 = scene.marktype, items = scene.items, parent, i, n; + if (items) { + for (i = 0, n = items.length; i < n; ++i) { + parent = type2 ? "mark" : "group"; + items[i][parent] = scene; + if (items[i].zindex) items[i][parent].zdirty = true; + if ("group" === (type2 || parent)) initialize$1(items[i]); + } + } + if (type2) boundMark(scene); + return scene; + } + class Scenegraph { + constructor(scene) { + if (arguments.length) { + this.root = sceneFromJSON(scene); + } else { + this.root = createMark({ + marktype: "group", + name: "root", + role: "frame" }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - return out; + this.root.items = [new GroupItem(this.root)]; + } + } + toJSON(indent) { + return sceneToJSON(this.root, indent || 0); + } + mark(markdef, group2, index2) { + group2 = group2 || this.root.items[0]; + const mark = createMark(markdef, group2); + group2.items[index2] = mark; + if (mark.zindex) mark.group.zdirty = true; + return mark; + } + } + function createMark(def2, group2) { + const mark = { + bounds: new Bounds(), + clip: !!def2.clip, + group: group2, + interactive: def2.interactive === false ? false : true, + items: [], + marktype: def2.marktype, + name: def2.name || void 0, + role: def2.role || void 0, + zindex: def2.zindex || 0 + }; + if (def2.aria != null) { + mark.aria = def2.aria; + } + if (def2.description) { + mark.description = def2.description; + } + return mark; + } + function domCreate(doc, tag, ns) { + if (!doc && typeof document !== "undefined" && document.createElement) { + doc = document; + } + return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; + } + function domFind(el, tag) { + tag = tag.toLowerCase(); + var nodes = el.childNodes, i = 0, n = nodes.length; + for (; i < n; ++i) if (nodes[i].tagName.toLowerCase() === tag) { + return nodes[i]; + } + } + function domChild(el, index2, tag, ns) { + var a2 = el.childNodes[index2], b2; + if (!a2 || a2.tagName.toLowerCase() !== tag.toLowerCase()) { + b2 = a2 || null; + a2 = domCreate(el.ownerDocument, tag, ns); + el.insertBefore(a2, b2); + } + return a2; + } + function domClear(el, index2) { + var nodes = el.childNodes, curr = nodes.length; + while (curr > index2) el.removeChild(nodes[--curr]); + return el; + } + function cssClass(mark) { + return "mark-" + mark.marktype + (mark.role ? " role-" + mark.role : "") + (mark.name ? " " + mark.name : ""); + } + function point(event2, el) { + const rect2 = el.getBoundingClientRect(); + return [event2.clientX - rect2.left - (el.clientLeft || 0), event2.clientY - rect2.top - (el.clientTop || 0)]; + } + function resolveItem(item, event2, el, origin) { + var mark = item && item.mark, mdef, p; + if (mark && (mdef = Marks[mark.marktype]).tip) { + p = point(event2, el); + p[0] -= origin[0]; + p[1] -= origin[1]; + while (item = item.mark.group) { + p[0] -= item.x || 0; + p[1] -= item.y || 0; + } + item = mdef.tip(mark.items, p); + } + return item; + } + class Handler { + /** + * Create a new Handler instance. + * @param {object} [customLoader] - Optional loader instance for + * href URL sanitization. If not specified, a standard loader + * instance will be generated. + * @param {function} [customTooltip] - Optional tooltip handler + * function for custom tooltip display. + * @constructor + */ + constructor(customLoader, customTooltip) { + this._active = null; + this._handlers = {}; + this._loader = customLoader || loader(); + this._tooltip = customTooltip || defaultTooltip$1; + } + /** + * Initialize a new Handler instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {object} [obj] - Optional context object that should serve as + * the "this" context for event callbacks. + * @return {Handler} - This handler instance. + */ + initialize(el, origin, obj2) { + this._el = el; + this._obj = obj2 || null; + return this.origin(origin); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the origin coordinates of the visualization. + */ + origin(origin) { + if (arguments.length) { + this._origin = origin || [0, 0]; + return this; + } else { + return this._origin.slice(); + } } -}); -/** - * Relays a data stream between data processing pipelines. - * If the derive parameter is set, this transform will create derived - * copies of observed tuples. This provides derived data streams in which - * modifications to the tuples do not pollute an upstream data source. - * @param {object} params - The parameters for this operator. - * @param {number} [params.derive=false] - Boolean flag indicating if - * the transform should make derived copies of incoming tuples. - * @constructor - */ function Relay(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Relay, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let out, lut; - if (this.value) lut = this.value; - else { - out = pulse = pulse.addAll(); - lut = this.value = {}; - } - if (_.derive) { - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = (0, _vegaDataflow.derive)(t); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - const dt = lut[(0, _vegaDataflow.tupleid)(t)]; - for(const k in t){ - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); - } - return out; + /** + * Get / set the scenegraph root. + */ + scene(scene) { + if (!arguments.length) return this._scene; + this._scene = scene; + return this; } -}); -/** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ function Sample(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.count = 0; -} -Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'default': 1000 - } - ] -}; -(0, _vegaUtil.inherits)(Sample, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), mod = _.modified('size'), num = _.size, map = this.value.reduce((m, t)=>(m[(0, _vegaDataflow.tupleid)(t)] = 1, m), {}); - let res = this.value, cnt = this.count, cap = 0; - // sample reservoir update function - function update(t) { - let p, idx; - if (res.length < num) res.push(t); - else { - idx = ~~((cnt + 1) * (0, _vegaStatistics.random)()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[(0, _vegaDataflow.tupleid)(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - // filter removed tuples out of the sample reservoir - res = res.filter((t)=>map[(0, _vegaDataflow.tupleid)(t)] !== -1); - } - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, (t)=>{ - // update, but skip previously sampled tuples - if (!map[(0, _vegaDataflow.tupleid)(t)]) update(t); - }); - cap = -1; - } - if (mod && res.length > num) { - const n = res.length - num; - for(let i = 0; i < n; ++i){ - map[(0, _vegaDataflow.tupleid)(res[i])] = -1; - out.rem.push(res[i]); - } - res = res.slice(n); - } - if (pulse.mod.length) // propagate modified tuples in the sample reservoir - pulse.visit(pulse.MOD, (t)=>{ - if (map[(0, _vegaDataflow.tupleid)(t)]) out.mod.push(t); - }); - if (pulse.add.length) // update sample reservoir - pulse.visit(pulse.ADD, update); - if (pulse.add.length || cap < 0) // output newly added tuples - out.add = res.filter((t)=>!map[(0, _vegaDataflow.tupleid)(t)]); - this.count = cnt; - this.value = out.source = res; - return out; + /** + * Add an event handler. Subclasses should override this method. + */ + on() { } -}); -/** - * Generates data tuples for a specified sequence range of numbers. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} params.start - The first number in the sequence. - * @param {number} params.stop - The last number (exclusive) in the sequence. - * @param {number} [params.step=1] - The step size between numbers in the sequence. - */ function Sequence(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Sequence.Definition = { - 'type': 'Sequence', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'start', - 'type': 'number', - 'required': true - }, - { - 'name': 'stop', - 'type': 'number', - 'required': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'data' + /** + * Remove an event handler. Subclasses should override this method. + */ + off() { + } + /** + * Utility method for finding the array index of an event handler. + * @param {Array} h - An array of registered event handlers. + * @param {string} type - The event type. + * @param {function} handler - The event handler instance to find. + * @return {number} - The handler's array index or -1 if not registered. + */ + _handlerIndex(h2, type2, handler) { + for (let i = h2 ? h2.length : 0; --i >= 0; ) { + if (h2[i].type === type2 && (!handler || h2[i].handler === handler)) { + return i; } - ] -}; -(0, _vegaUtil.inherits)(Sequence, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return; - const out = pulse.materialize().fork(pulse.MOD), as = _.as || 'data'; - out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem; - this.value = (0, _d3Array.range)(_.start, _.stop, _.step || 1).map((v)=>{ - const t = {}; - t[as] = v; - return (0, _vegaDataflow.ingest)(t); - }); - out.add = pulse.add.concat(this.value); - return out; + } + return -1; } -}); -/** - * Propagates a new pulse without any tuples so long as the input - * pulse contains some added, removed or modified tuples. - * @param {object} params - The parameters for this operator. - * @constructor - */ function Sieve(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Sieve, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = pulse.source; - return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Discretize dates to specific time units. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The data field containing date/time values. - */ function TimeUnit(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const OUTPUT = [ - 'unit0', - 'unit1' -]; -TimeUnit.Definition = { - 'type': 'TimeUnit', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'units', - 'type': 'enum', - 'values': (0, _vegaTime.TIME_UNITS), - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 40 - }, - { - 'name': 'extent', - 'type': 'date', - 'array': true - }, - { - 'name': 'timezone', - 'type': 'enum', - 'default': 'local', - 'values': [ - 'local', - 'utc' - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': OUTPUT + /** + * Returns an array with registered event handlers. + * @param {string} [type] - The event type to query. Any annotations + * are ignored; for example, for the argument "click.foo", ".foo" will + * be ignored and the method returns all "click" handlers. If type is + * null or unspecified, this method returns handlers for all types. + * @return {Array} - A new array containing all registered event handlers. + */ + handlers(type2) { + const h2 = this._handlers, a2 = []; + if (type2) { + a2.push(...h2[this.eventName(type2)]); + } else { + for (const k in h2) { + a2.push(...h2[k]); } - ] -}; -(0, _vegaUtil.inherits)(TimeUnit, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const field = _.field, band = _.interval !== false, utc = _.timezone === 'utc', floor = this._floor(_, pulse), offset = (utc ? (0, _vegaTime.utcInterval) : (0, _vegaTime.timeInterval))(floor.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor.step; - let min = floor.start || Infinity, max = floor.stop || -Infinity, flag = pulse.ADD; - if (_.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(field))) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - min = Infinity; - max = -Infinity; - } - pulse.visit(flag, (t)=>{ - const v = field(t); - let a, b; - if (v == null) { - t[u0] = null; - if (band) t[u1] = null; - } else { - t[u0] = a = b = floor(v); - if (band) t[u1] = b = offset(a, step); - if (a < min) min = a; - if (b > max) max = b; - } - }); - floor.start = min; - floor.stop = max; - return pulse.modifies(band ? as : u0); - }, - _floor (_, pulse) { - const utc = _.timezone === 'utc'; - // get parameters - const { units, step } = _.units ? { - units: _.units, - step: _.step || 1 - } : (0, _vegaTime.timeBin)({ - extent: _.extent || (0, _vegaUtil.extent)(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins + } + return a2; + } + /** + * Parses an event name string to return the specific event type. + * For example, given "click.foo" returns "click" + * @param {string} name - The input event type string. + * @return {string} - A string with the event type only. + */ + eventName(name) { + const i = name.indexOf("."); + return i < 0 ? name : name.slice(0, i); + } + /** + * Handle hyperlink navigation in response to an item.href value. + * @param {Event} event - The event triggering hyperlink navigation. + * @param {Item} item - The scenegraph item. + * @param {string} href - The URL to navigate to. + */ + handleHref(event2, item, href2) { + this._loader.sanitize(href2, { + context: "href" + }).then((opt) => { + const e = new MouseEvent(event2.type, event2), a2 = domCreate(null, "a"); + for (const name in opt) a2.setAttribute(name, opt[name]); + a2.dispatchEvent(e); + }).catch(() => { + }); + } + /** + * Handle tooltip display in response to an item.tooltip value. + * @param {Event} event - The event triggering tooltip display. + * @param {Item} item - The scenegraph item. + * @param {boolean} show - A boolean flag indicating whether + * to show or hide a tooltip for the given item. + */ + handleTooltip(event2, item, show) { + if (item && item.tooltip != null) { + item = resolveItem(item, event2, this.canvas(), this._origin); + const value2 = show && item && item.tooltip || null; + this._tooltip.call(this._obj, this, event2, item, value2); + } + } + /** + * Returns the size of a scenegraph item and its position relative + * to the viewport. + * @param {Item} item - The scenegraph item. + * @return {object} - A bounding box object (compatible with the + * DOMRect type) consisting of x, y, width, heigh, top, left, + * right, and bottom properties. + */ + getItemBoundingClientRect(item) { + const el = this.canvas(); + if (!el) return; + const rect2 = el.getBoundingClientRect(), origin = this._origin, bounds2 = item.bounds, width2 = bounds2.width(), height2 = bounds2.height(); + let x2 = bounds2.x1 + origin[0] + rect2.left, y2 = bounds2.y1 + origin[1] + rect2.top; + while (item.mark && (item = item.mark.group)) { + x2 += item.x || 0; + y2 += item.y || 0; + } + return { + x: x2, + y: y2, + width: width2, + height: height2, + left: x2, + top: y2, + right: x2 + width2, + bottom: y2 + height2 + }; + } + } + function defaultTooltip$1(handler, event2, item, value2) { + handler.element().setAttribute("title", value2 || ""); + } + class Renderer { + /** + * Create a new Renderer instance. + * @param {object} [loader] - Optional loader instance for + * image and href URL sanitization. If not specified, a + * standard loader instance will be generated. + * @constructor + */ + constructor(loader2) { + this._el = null; + this._bgcolor = null; + this._loader = new ResourceLoader(loader2); + } + /** + * Initialize a new Renderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._el = el; + return this.resize(width2, height2, origin, scaleFactor); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length === 0) return this._bgcolor; + this._bgcolor = bgcolor; + return this; + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + this._width = width2; + this._height = height2; + this._origin = origin || [0, 0]; + this._scale = scaleFactor || 1; + return this; + } + /** + * Report a dirty item whose bounds should be redrawn. + * This base class method does nothing. Subclasses that perform + * incremental should implement this method. + * @param {Item} item - The dirty item whose bounds should be redrawn. + */ + dirty() { + } + /** + * Render an input scenegraph, potentially with a set of dirty items. + * This method will perform an immediate rendering with available resources. + * The renderer may also need to perform image loading to perform a complete + * render. This process can lead to asynchronous re-rendering of the scene + * after this method returns. To receive notification when rendering is + * complete, use the renderAsync method instead. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Renderer} - This renderer instance. + */ + render(scene, markTypes) { + const r = this; + r._call = function() { + r._render(scene, markTypes); + }; + r._call(); + r._call = null; + return r; + } + /** + * Internal rendering method. Renderer subclasses should override this + * method to actually perform rendering. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render() { + } + /** + * Asynchronous rendering method. Similar to render, but returns a Promise + * that resolves when all rendering is completed. Sometimes a renderer must + * perform image loading to get a complete rendering. The returned + * Promise will not resolve until this process completes. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Promise} - A Promise that resolves when rendering is complete. + */ + renderAsync(scene, markTypes) { + const r = this.render(scene, markTypes); + return this._ready ? this._ready.then(() => r) : Promise.resolve(r); + } + /** + * Internal method for asynchronous resource loading. + * Proxies method calls to the ImageLoader, and tracks loading + * progress to invoke a re-render once complete. + * @param {string} method - The method name to invoke on the ImageLoader. + * @param {string} uri - The URI for the requested resource. + * @return {Promise} - A Promise that resolves to the requested resource. + */ + _load(method2, uri) { + var r = this, p = r._loader[method2](uri); + if (!r._ready) { + const call = r._call; + r._ready = r._loader.ready().then((redraw) => { + if (redraw) call(); + r._ready = null; }); - // check / standardize time units - const tunits = (0, _vegaTime.timeUnits)(units), prev = this.value || {}, floor = (utc ? (0, _vegaTime.utcFloor) : (0, _vegaTime.timeFloor))(tunits, step); - floor.unit = (0, _vegaUtil.peek)(tunits); - floor.units = tunits; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - } -}); -/** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ function TupleIndex(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -(0, _vegaUtil.inherits)(TupleIndex, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, field = _.field, index = this.value, set = (t)=>index.set(field(t), t); - let mod = true; - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, (t)=>index.delete(field(t))); - pulse.visit(pulse.ADD, set); - } else mod = false; - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - } -}); -/** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ function Values(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Values, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields); - if (run) this.value = (_.sort ? pulse.source.slice().sort((0, _vegaDataflow.stableCompare)(_.sort)) : pulse.source).map(_.field); - } -}); -function WindowOp(op, field, param, as) { - const fn = WindowOps[op](field, param); - return { - init: fn.init || (0, _vegaUtil.zero), - update: function(w, t) { - t[as] = fn.next(w); - } - }; -} -const WindowOps = { - row_number: function() { - return { - next: (w)=>w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: ()=>rank = 1, - next: (w)=>{ - const i = w.index, data = w.data; - return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: ()=>drank = 1, - next: (w)=>{ - const i = w.index, d = w.data; - return i && w.compare(d[i - 1], d[i]) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - const rank = WindowOps.rank(), next = rank.next; - return { - init: rank.init, - next: (w)=>(next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: ()=>cume = 0, - next: (w)=>{ - const d = w.data, c = w.compare; - let i = w.index; - if (cume < i) { - while(i + 1 < d.length && !c(d[i], d[i + 1]))++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) (0, _vegaUtil.error)('ntile num must be greater than zero.'); - const cume = WindowOps.cume_dist(), next = cume.next; - return { - init: cume.init, - next: (w)=>Math.ceil(num * next(w)) - }; - }, - lag: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index + offset, d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - first_value: function(field) { - return { - next: (w)=>field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: (w)=>field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) (0, _vegaUtil.error)('nth_value nth must be greater than zero.'); - return { - next: (w)=>{ - const i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - prev_value: function(field) { - let prev; - return { - init: ()=>prev = null, - next: (w)=>{ - const v = field(w.data[w.index]); - return v != null ? prev = v : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: ()=>(v = null, i = -1), - next: (w)=>{ - const d = w.data; - return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]); - } - }; + } + return p; } -}; -function find(field, data, index) { - for(let n = data.length; index < n; ++index){ - const v = field(data[index]); - if (v != null) return index; + /** + * Sanitize a URL to include as a hyperlink in the rendered scene. + * This method proxies a call to ImageLoader.sanitizeURL, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string to sanitize. + * @return {Promise} - A Promise that resolves to the sanitized URL. + */ + sanitizeURL(uri) { + return this._load("sanitizeURL", uri); } - return -1; -} -const ValidWindowOps = Object.keys(WindowOps); -function WindowState(_) { - const ops = (0, _vegaUtil.array)(_.ops), fields = (0, _vegaUtil.array)(_.fields), params = (0, _vegaUtil.array)(_.params), aggregate_params = (0, _vegaUtil.array)(_.aggregate_params), as = (0, _vegaUtil.array)(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map = {}, counts = [], measures = []; - let countOnly = true; - function visitInputs(f) { - (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(f)).forEach((_)=>inputs[_] = 1); + /** + * Requests an image to include in the rendered scene. + * This method proxies a call to ImageLoader.loadImage, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string of the image. + * @return {Promise} - A Promise that resolves to the loaded Image. + */ + loadImage(uri) { + return this._load("loadImage", uri); } - visitInputs(_.sort); - ops.forEach((op, i)=>{ - const field = fields[i], param = params[i], aggregate_param = aggregate_params[i] || null, mname = (0, _vegaUtil.accessorName)(field), name = measureName(op, mname, as[i]); - visitInputs(field); - outputs.push(name); - // Window operation - if ((0, _vegaUtil.hasOwnProperty)(WindowOps, op)) windows.push(WindowOp(op, field, param, name)); - else { - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - if (op === 'count') { - counts.push(name); - return; - } - countOnly = false; - let m = map[mname]; - if (!m) { - m = map[mname] = []; - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, aggregate_param, name)); - } - }); - if (counts.length || measures.length) this.cell = cell(measures, counts, countOnly); - this.inputs = Object.keys(inputs); -} -const prototype = WindowState.prototype; -prototype.init = function() { - this.windows.forEach((_)=>_.init()); - if (this.cell) this.cell.init(); -}; -prototype.update = function(w, t) { - const cell = this.cell, wind = this.windows, data = w.data, m = wind && wind.length; - let j; - if (cell) { - for(j = w.p0; j < w.i0; ++j)cell.rem(data[j]); - for(j = w.p1; j < w.i1; ++j)cell.add(data[j]); - cell.set(t); - } - for(j = 0; j < m; ++j)wind[j].update(w, t); -}; -function cell(measures, counts, countOnly) { - measures = measures.map((m)=>compileMeasures(m, m.field)); - const cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - if (!countOnly) { - var n = measures.length, a = cell.agg = Array(n), i = 0; - for(; i < n; ++i)a[i] = new measures[i](cell); - } - if (cell.store) var store = cell.data = new TupleStore(); - cell.add = function(t) { - cell.num += 1; - if (countOnly) return; - if (store) store.add(t); - for(let i = 0; i < n; ++i)a[i].add(a[i].get(t), t); - }; - cell.rem = function(t) { - cell.num -= 1; - if (countOnly) return; - if (store) store.rem(t); - for(let i = 0; i < n; ++i)a[i].rem(a[i].get(t), t); - }; - cell.set = function(t) { - let i, n; - // consolidate stored values - if (store) store.values(); - // update tuple properties - for(i = 0, n = counts.length; i < n; ++i)t[counts[i]] = cell.num; - if (!countOnly) for(i = 0, n = a.length; i < n; ++i)a[i].set(t); - }; - cell.init = function() { - cell.num = 0; - if (store) store.reset(); - for(let i = 0; i < n; ++i)a[i].init(); - }; - return cell; -} -/** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array<string>} params.ops - An array of strings indicating window operations to perform. - * @param {Array<function(object): *>} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameter values for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for window operations. - * @param {Array<number>} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ function Window(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._mlen = 0; - this._mods = []; -} -Window.Definition = { - 'type': 'Window', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidWindowOps.concat(ValidAggregateOps) - }, - { - 'name': 'params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'frame', - 'type': 'number', - 'null': true, - 'array': true, - 'length': 2, - 'default': [ - null, - 0 - ] - }, - { - 'name': 'ignorePeers', - 'type': 'boolean', - 'default': false - } - ] -}; -(0, _vegaUtil.inherits)(Window, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.stamp = pulse.stamp; - const mod = _.modified(), cmp = (0, _vegaDataflow.stableCompare)(_.sort), key = groupkey(_.groupby), group = (t)=>this.group(key(t)); - // initialize window state - let state = this.state; - if (!state || mod) state = this.state = new WindowState(_); - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - this.value = {}; - pulse.visit(pulse.SOURCE, (t)=>group(t).add(t)); - } else { - pulse.visit(pulse.REM, (t)=>group(t).remove(t)); - pulse.visit(pulse.ADD, (t)=>group(t).add(t)); - } - // perform window calculations for each modified partition - for(let i = 0, n = this._mlen; i < n; ++i)processPartition(this._mods[i], state, cmp, _); - this._mlen = 0; - this._mods = []; - // TODO don't reflow everything? - return pulse.reflow(mod).modifies(state.outputs); - }, - group (key) { - let group = this.value[key]; - if (!group) { - group = this.value[key] = SortedList((0, _vegaDataflow.tupleid)); - group.stamp = -1; - } - if (group.stamp < this.stamp) { - group.stamp = this.stamp; - this._mods[this._mlen++] = group; + } + const KeyDownEvent = "keydown"; + const KeyPressEvent = "keypress"; + const KeyUpEvent = "keyup"; + const DragEnterEvent = "dragenter"; + const DragLeaveEvent = "dragleave"; + const DragOverEvent = "dragover"; + const PointerDownEvent = "pointerdown"; + const PointerUpEvent = "pointerup"; + const PointerMoveEvent = "pointermove"; + const PointerOutEvent = "pointerout"; + const PointerOverEvent = "pointerover"; + const MouseDownEvent = "mousedown"; + const MouseUpEvent = "mouseup"; + const MouseMoveEvent = "mousemove"; + const MouseOutEvent = "mouseout"; + const MouseOverEvent = "mouseover"; + const ClickEvent = "click"; + const DoubleClickEvent = "dblclick"; + const WheelEvent = "wheel"; + const MouseWheelEvent = "mousewheel"; + const TouchStartEvent = "touchstart"; + const TouchMoveEvent = "touchmove"; + const TouchEndEvent = "touchend"; + const Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, PointerDownEvent, PointerUpEvent, PointerMoveEvent, PointerOutEvent, PointerOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent]; + const TooltipShowEvent = PointerMoveEvent; + const TooltipHideEvent = MouseOutEvent; + const HrefEvent = ClickEvent; + class CanvasHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + this._down = null; + this._touch = null; + this._first = true; + this._events = {}; + this.events = Events; + this.pointermove = move([PointerMoveEvent, MouseMoveEvent], [PointerOverEvent, MouseOverEvent], [PointerOutEvent, MouseOutEvent]); + this.dragover = move([DragOverEvent], [DragEnterEvent], [DragLeaveEvent]), this.pointerout = inactive([PointerOutEvent, MouseOutEvent]); + this.dragleave = inactive([DragLeaveEvent]); + } + initialize(el, origin, obj2) { + this._canvas = el && domFind(el, "canvas"); + [ClickEvent, MouseDownEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, DragLeaveEvent].forEach((type2) => eventListenerCheck(this, type2)); + return super.initialize(el, origin, obj2); + } + // return the backing canvas instance + canvas() { + return this._canvas; + } + // retrieve the current canvas context + context() { + return this._canvas.getContext("2d"); + } + // to keep old versions of firefox happy + DOMMouseScroll(evt) { + this.fire(MouseWheelEvent, evt); + } + pointerdown(evt) { + this._down = this._active; + this.fire(PointerDownEvent, evt); + } + mousedown(evt) { + this._down = this._active; + this.fire(MouseDownEvent, evt); + } + click(evt) { + if (this._down === this._active) { + this.fire(ClickEvent, evt); + this._down = null; + } + } + touchstart(evt) { + this._touch = this.pickEvent(evt.changedTouches[0]); + if (this._first) { + this._active = this._touch; + this._first = false; + } + this.fire(TouchStartEvent, evt, true); + } + touchmove(evt) { + this.fire(TouchMoveEvent, evt, true); + } + touchend(evt) { + this.fire(TouchEndEvent, evt, true); + this._touch = null; + } + // fire an event + fire(type2, evt, touch2) { + const a2 = touch2 ? this._touch : this._active, h2 = this._handlers[type2]; + evt.vegaType = type2; + if (type2 === HrefEvent && a2 && a2.href) { + this.handleHref(evt, a2, a2.href); + } else if (type2 === TooltipShowEvent || type2 === TooltipHideEvent) { + this.handleTooltip(evt, a2, type2 !== TooltipHideEvent); + } + if (h2) { + for (let i = 0, len2 = h2.length; i < len2; ++i) { + h2[i].handler.call(this._obj, evt, a2); } - return group; + } } -}); -function processPartition(list, state, cmp, _) { - const sort = _.sort, range = sort && !_.ignorePeers, frame = _.frame || [ - null, - 0 - ], data = list.data(cmp), // use cmp for stable sort - n = data.length, b = range ? (0, _d3Array.bisector)(sort) : null, w = { - i0: 0, - i1: 0, - p0: 0, - p1: 0, - index: 0, - data: data, - compare: sort || (0, _vegaUtil.constant)(-1) - }; - state.init(); - for(let i = 0; i < n; ++i){ - setWindow(w, frame, i, n); - if (range) adjustRange(w, b); - state.update(w, data[i]); - } -} -function setWindow(w, f, i, n) { - w.p0 = w.i0; - w.p1 = w.i1; - w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); - w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); - w.index = i; -} -// if frame type is 'range', adjust window for peer values -function adjustRange(w, bisect) { - const r0 = w.i0, r1 = w.i1 - 1, c = w.compare, d = w.data, n = d.length - 1; - if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]); -} - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","vega-statistics":"4QSQj","d3-array":"5lCYW","vega-time":"kjkWX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4QSQj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bandwidthNRD", ()=>estimateBandwidth); -parcelHelpers.export(exports, "bin", ()=>bin); -parcelHelpers.export(exports, "bootstrapCI", ()=>bootstrapCI); -parcelHelpers.export(exports, "cumulativeLogNormal", ()=>cumulativeLogNormal); -parcelHelpers.export(exports, "cumulativeNormal", ()=>cumulativeNormal); -parcelHelpers.export(exports, "cumulativeUniform", ()=>cumulativeUniform); -parcelHelpers.export(exports, "densityLogNormal", ()=>densityLogNormal); -parcelHelpers.export(exports, "densityNormal", ()=>densityNormal); -parcelHelpers.export(exports, "densityUniform", ()=>densityUniform); -parcelHelpers.export(exports, "dotbin", ()=>dotbin); -parcelHelpers.export(exports, "quantileLogNormal", ()=>quantileLogNormal); -parcelHelpers.export(exports, "quantileNormal", ()=>quantileNormal); -parcelHelpers.export(exports, "quantileUniform", ()=>quantileUniform); -parcelHelpers.export(exports, "quantiles", ()=>quantiles); -parcelHelpers.export(exports, "quartiles", ()=>quartiles); -parcelHelpers.export(exports, "random", ()=>random); -parcelHelpers.export(exports, "randomInteger", ()=>integer); -parcelHelpers.export(exports, "randomKDE", ()=>kde); -parcelHelpers.export(exports, "randomLCG", ()=>lcg); -parcelHelpers.export(exports, "randomLogNormal", ()=>lognormal); -parcelHelpers.export(exports, "randomMixture", ()=>mixture); -parcelHelpers.export(exports, "randomNormal", ()=>gaussian); -parcelHelpers.export(exports, "randomUniform", ()=>uniform); -parcelHelpers.export(exports, "regressionConstant", ()=>constant); -parcelHelpers.export(exports, "regressionExp", ()=>exp); -parcelHelpers.export(exports, "regressionLinear", ()=>linear); -parcelHelpers.export(exports, "regressionLoess", ()=>loess); -parcelHelpers.export(exports, "regressionLog", ()=>log); -parcelHelpers.export(exports, "regressionPoly", ()=>poly); -parcelHelpers.export(exports, "regressionPow", ()=>pow); -parcelHelpers.export(exports, "regressionQuad", ()=>quad); -parcelHelpers.export(exports, "sampleCurve", ()=>sampleCurve); -parcelHelpers.export(exports, "sampleLogNormal", ()=>sampleLogNormal); -parcelHelpers.export(exports, "sampleNormal", ()=>sampleNormal); -parcelHelpers.export(exports, "sampleUniform", ()=>sampleUniform); -parcelHelpers.export(exports, "setRandom", ()=>setRandom); -var _d3Array = require("d3-array"); -function* numbers(values, valueof) { - if (valueof == null) { - for (let value of values)if (value != null && value !== '' && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values){ - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) yield value; - } - } -} -function quantiles(array, p, f) { - const values = Float64Array.from(numbers(array, f)); - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort((0, _d3Array.ascending)); - return p.map((_)=>(0, _d3Array.quantileSorted)(values, _)); -} -function quartiles(array, f) { - return quantiles(array, [ - 0.25, - 0.50, - 0.75 - ], f); -} -// Scott, D. W. (1992) Multivariate Density Estimation: -// Theory, Practice, and Visualization. Wiley. -function estimateBandwidth(array, f) { - const n = array.length, d = (0, _d3Array.deviation)(array, f), q = quartiles(array, f), h = (q[2] - q[0]) / 1.34, v = Math.min(d, h) || d || Math.abs(q[0]) || 1; - return 1.06 * v * Math.pow(n, -0.2); -} -function bin(_) { - // determine range - const maxb = _.maxbins || 20, base = _.base || 10, logb = Math.log(base), div = _.divide || [ - 5, - 2 - ]; - let min = _.extent[0], max = _.extent[1], step, level, minstep, v, i, n; - const span = _.span || max - min || Math.abs(min) || 1; - if (_.step) // if step size is explicitly given, use that - step = _.step; - else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for(i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i - 1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); - // increase step size if too many bins - while(Math.ceil(span / step) > maxb)step *= base; - // decrease step size if allowed - for(i = 0, n = div.length; i < n; ++i){ - v = step / div[i]; - if (v >= minstep && span / v <= maxb) step = v; - } - } - // update precision, min and max - v = Math.log(step); - const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + eventListenerCheck(this, type2); + (h2[name] || (h2[name] = [])).push({ + type: type2, + handler + }); + } + return this; } - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; -} -var random = Math.random; -function setRandom(r) { - random = r; -} -function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [ - undefined, - undefined - ]; - const values = Float64Array.from(numbers(array, f)), n = values.length, m = samples; - let a, i, j, mu; - for(j = 0, mu = Array(m); j < m; ++j){ - for(a = 0, i = 0; i < n; ++i)a += values[~~(random() * n)]; - mu[j] = a / n; + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + h2.splice(i, 1); + } + return this; + } + pickEvent(evt) { + const p = point(evt, this._canvas), o = this._origin; + return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); } - mu.sort((0, _d3Array.ascending)); - return [ - (0, _d3Array.quantile)(mu, alpha / 2), - (0, _d3Array.quantile)(mu, 1 - alpha / 2) - ]; -} -// Dot density binning for dot plot construction. -// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. -// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf -function dotbin(array, step, smooth, f) { - f = f || ((_)=>_); - const n = array.length, v = new Float64Array(n); - let i = 0, j = 1, a = f(array[0]), b = a, w = a + step, x; - for(; j < n; ++j){ - x = f(array[j]); - if (x >= w) { - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - w = x + step; - a = x; - } - b = x; - } - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - return smooth ? smoothing(v, step + step / 4) : v; -} -// perform smoothing to reduce variance -// swap points between "adjacent" stacks -// Wilkinson defines adjacent as within step/4 units -function smoothing(v, thresh) { - const n = v.length; - let a = 0, b = 1, c, d; - // get left stack - while(v[a] === v[b])++b; - while(b < n){ - // get right stack - c = b + 1; - while(v[b] === v[c])++c; - // are stacks adjacent? - // if so, compare sizes and swap as needed - if (v[b] - v[b - 1] < thresh) { - d = b + (a + c - b - b >> 1); - while(d < b)v[d++] = v[b]; - while(d > b)v[d--] = v[a]; - } - // update left stack indices - a = b; - b = c; + // find the scenegraph item at the current pointer position + // x, y -- the absolute x, y pointer coordinates on the canvas element + // gx, gy -- the relative coordinates within the current group + pick(scene, x2, y2, gx, gy) { + const g = this.context(), mark = Marks[scene.marktype]; + return mark.pick.call(this, g, scene, x2, y2, gx, gy); } - return v; -} -function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; -} -function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - let a, b, d; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else return b; - }, - sample () { - return a + Math.floor(d * random()); - }, - pdf (x) { - return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0; - }, - cdf (x) { - const v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }, - icdf (p) { - return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN; - } + } + const eventBundle = (type2) => type2 === TouchStartEvent || type2 === TouchMoveEvent || type2 === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type2]; + function eventListenerCheck(handler, type2) { + eventBundle(type2).forEach((_) => addEventListener(handler, _)); + } + function addEventListener(handler, type2) { + const canvas = handler.canvas(); + if (canvas && !handler._events[type2]) { + handler._events[type2] = 1; + canvas.addEventListener(type2, handler[type2] ? (evt) => handler[type2](evt) : (evt) => handler.fire(type2, evt)); + } + } + function fireAll(handler, types2, event2) { + types2.forEach((type2) => handler.fire(type2, event2)); + } + function move(moveEvents, overEvents, outEvents) { + return function(evt) { + const a2 = this._active, p = this.pickEvent(evt); + if (p === a2) { + fireAll(this, moveEvents, evt); + } else { + if (!a2 || !a2.exit) { + fireAll(this, outEvents, evt); + } + this._active = p; + fireAll(this, overEvents, evt); + fireAll(this, moveEvents, evt); + } }; - return dist.min(min).max(max); -} -const SQRT2PI = Math.sqrt(2 * Math.PI); -const SQRT2 = Math.SQRT2; -let nextSample = NaN; -function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = random() * 2 - 1; - y = random() * 2 - 1; - rds = x * x + y * y; - }while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; -} -function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); -} -// Approximation from West (2009) -// Better Approximations to Cumulative Normal Functions -function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (value - mean) / stdev, Z = Math.abs(z); - let cd; - if (Z > 37) cd = 0; - else { - const exp = Math.exp(-Z * Z / 2); - let sum; - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; -} -// Approximation of Probit function using inverse error function. -function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); -} -// Approximate inverse error function. Implementation from "Approximating -// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. -// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 -function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = -Math.log((1 - x) * (1 + x)), p; - if (w < 6.25) { - w -= 3.125; - p = -0.00000000000000000000364441206401782; - p = -0.00000000000000000016850591381820166 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -0.0000000000000001333171662854621 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -0.00000000000004054566272975207 + p * w; - p = -0.00000000000008151934197605472 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -0.000000000012975133253453532 + p * w; - p = -0.00000000005415412054294628 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -0.000000004112633980346984 + p * w; - p = -0.000000029070369957882005 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -0.0000013654692000834679 + p * w; - p = -0.000013882523362786469 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.000740702534166267 + p * w; - p = -0.006033670871430149 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -0.00000027517406297064545 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -0.000004013867526981546 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -0.000047318229009055734 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628475 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.003751208507569241 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -0.000000000027109920616438573; - p = -0.0000000002555641816996525 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -0.000000003789465440126737 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -0.00000001496002662714924 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -0.00000006771199775845234 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -0.00000099298272942317 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -0.00001968177810553167 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477 + p * w; - p = -0.00013871931833623122 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else p = Infinity; - return p * x; -} -function gaussian(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleNormal(mu, sigma), - pdf: (value)=>densityNormal(value, mu, sigma), - cdf: (value)=>cumulativeNormal(value, mu, sigma), - icdf: (p)=>quantileNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function kde(support, bandwidth) { - const kernel = gaussian(); - let n = 0; - const dist = { - data (_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else return support; - }, - bandwidth (_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = estimateBandwidth(support); - return dist; - }, - sample () { - return support[~~(random() * n)] + bandwidth * kernel.sample(); - }, - pdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.pdf((x - support[i]) / bandwidth); - return y / bandwidth / n; - }, - cdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.cdf((x - support[i]) / bandwidth); - return y / n; - }, - icdf () { - throw Error('KDE icdf not supported.'); - } + } + function inactive(types2) { + return function(evt) { + fireAll(this, types2, evt); + this._active = null; }; - return dist.data(support); -} -function sampleLogNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - return Math.exp(mean + sampleNormal() * stdev); -} -function densityLogNormal(value, mean, stdev) { - if (value <= 0) return 0; - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (Math.log(value) - mean) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value); -} -function cumulativeLogNormal(value, mean, stdev) { - return cumulativeNormal(Math.log(value), mean, stdev); -} -function quantileLogNormal(p, mean, stdev) { - return Math.exp(quantileNormal(p, mean, stdev)); -} -function lognormal(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleLogNormal(mu, sigma), - pdf: (value)=>densityLogNormal(value, mu, sigma), - cdf: (value)=>cumulativeLogNormal(value, mu, sigma), - icdf: (p)=>quantileLogNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function mixture(dists, weights) { - let m = 0, w; - function normalize(x) { - const w = []; - let sum = 0, i; - for(i = 0; i < m; ++i)sum += w[i] = x[i] == null ? 1 : +x[i]; - for(i = 0; i < m; ++i)w[i] /= sum; - return w; - } - const dist = { - weights (_) { - if (arguments.length) { - w = normalize(weights = _ || []); - return dist; - } - return weights; - }, - distributions (_) { - if (arguments.length) { - if (_) { - m = _.length; - dists = _; - } else { - m = 0; - dists = []; - } - return dist.weights(weights); - } - return dists; - }, - sample () { - const r = random(); - let d = dists[m - 1], v = w[0], i = 0; - // first select distribution - for(; i < m - 1; v += w[++i])if (r < v) { - d = dists[i]; - break; - } - // then sample from it - return d.sample(); - }, - pdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].pdf(x); - return p; - }, - cdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].cdf(x); - return p; - }, - icdf () { - throw Error('Mixture icdf not supported.'); - } - }; - return dist.distributions(dists).weights(weights); -} -function sampleUniform(min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return min + (max - min) * random(); -} -function densityUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value >= min && value <= max ? 1 / (max - min) : 0; -} -function cumulativeUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); -} -function quantileUniform(p, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return p >= 0 && p <= 1 ? min + p * (max - min) : NaN; -} -function uniform(min, max) { - let a, b; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else return b; - }, - sample: ()=>sampleUniform(a, b), - pdf: (value)=>densityUniform(value, a, b), - cdf: (value)=>cumulativeUniform(value, a, b), - icdf: (p)=>quantileUniform(p, a, b) - }; - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return dist.min(min).max(max); -} -function constant(data, x, y) { - let mean = 0, n = 0; - for (const d of data){ - const val = y(d); - if (x(d) == null || val == null || isNaN(val)) continue; - mean += (val - mean) / ++n; + } + function devicePixelRatio$1() { + return typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1; + } + function resize(canvas, width2, height2, origin, scaleFactor, opt) { + const inDOM = typeof HTMLElement !== "undefined" && canvas instanceof HTMLElement && canvas.parentNode != null, context2 = canvas.getContext("2d"), ratio = inDOM ? devicePixelRatio$1() : scaleFactor; + canvas.width = width2 * ratio; + canvas.height = height2 * ratio; + for (const key2 in opt) { + context2[key2] = opt[key2]; } - return { - coef: [ - mean - ], - predict: ()=>mean, - rSquared: 0 - }; -} -// Ordinary Least Squares -function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; - return [ - intercept, - slope - ]; -} -function points(data, x, y, sort) { - data = data.filter((d)=>{ - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - if (sort) data.sort((a, b)=>x(a) - x(b)); - const n = data.length, X = new Float64Array(n), Y = new Float64Array(n); - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data){ - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; + if (inDOM && ratio !== 1) { + canvas.style.width = width2 + "px"; + canvas.style.height = height2 + "px"; } - // mean center the data - for(i = 0; i < n; ++i){ - X[i] -= ux; - Y[i] -= uy; + context2.pixelRatio = ratio; + context2.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); + return canvas; + } + class CanvasRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._options = {}; + this._redraw = false; + this._dirty = new Bounds(); + this._tempb = new Bounds(); + } + initialize(el, width2, height2, origin, scaleFactor, options2) { + this._options = options2 || {}; + this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); + if (el && this._canvas) { + domClear(el, 0).appendChild(this._canvas); + this._canvas.setAttribute("class", "marks"); + } + return super.initialize(el, width2, height2, origin, scaleFactor); } - return [ - X, - Y, - ux, - uy - ]; -} -function visitPoints(data, x, y, callback) { - let i = -1, u, v; - for (const d of data){ - u = x(d); - v = y(d); - if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) callback(u, v, ++i); - } -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const sse = dy - predict(dx), sst = dy - uY; - SSE += sse * sse; - SST += sst * sst; - }); - return 1 - SSE / SST; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function linear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * x; - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function log(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * Math.log(x); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -function exp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - visitPoints(data, x, y, (_, dy)=>{ - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x)=>Math.exp(c0 + c1 * (x - ux)); - return { - coef: [ - Math.exp(c0 - c1 * ux), - c1 - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function pow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const lx = Math.log(dx), ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] * Math.pow(x, coef[1]); - coef[0] = Math.exp(coef[0]); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; -} -function quad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length; - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x2; - for(i = 0; i < n;){ - dx = xv[i]; - dy = yv[i++]; - x2 = dx * dx; - X2 += (x2 - X2) / i; - X3 += (x2 * dx - X3) / i; - X4 += (x2 * x2 - X4) / i; - XY += (dx * dy - XY) / i; - X2Y += (x2 * dy - X2Y) / i; - } - const X2X2 = X4 - X2 * X2, d = X2 * X2X2 - X3 * X3, a = (X2Y * X2 - XY * X3) / d, b = (XY * X2X2 - X2Y * X3) / d, c = -a * X2, predict = (x)=>{ - x = x - ux; - return a * x * x + b * x + c + uy; - }; - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -// ... which was adapted from regression-js by Tom Alexander -// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 -// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE -function poly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 0) return constant(data, x, y); - if (order === 1) return linear(data, x, y); - if (order === 2) return quad(data, x, y); - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length, lhs = [], rhs = [], k = order + 1; - let i, j, l, v, c; - for(i = 0; i < k; ++i){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i) * yv[l]; - lhs.push(v); - c = new Float64Array(k); - for(j = 0; j < k; ++j){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i + j); - c[j] = v; - } - rhs.push(c); + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._canvas) { + resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); + } else { + const ctx = this._options.externalContext; + if (!ctx) error("CanvasRenderer is missing a valid canvas or context"); + ctx.scale(this._scale, this._scale); + ctx.translate(this._origin[0], this._origin[1]); + } + this._redraw = true; + return this; } - rhs.push(lhs); - const coef = gaussianElimination(rhs), predict = (x)=>{ - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for(i = 3; i < k; ++i)y += coef[i] * Math.pow(x, i); - return y; - }; - return { - coef: uncenter(k, coef, -ux, uy), - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -function uncenter(k, a, x, y) { - const z = Array(k); - let i, j, v, c; - // initialize to zero - for(i = 0; i < k; ++i)z[i] = 0; - // polynomial expansion - for(i = k - 1; i >= 0; --i){ - v = a[i]; - c = 1; - z[i] += v; - for(j = 1; j <= i; ++j){ - c *= (i + 1 - j) / j; // binomial coefficent - z[i - j] += v * Math.pow(x, j) * c; - } - } - // bias term - z[0] += y; - return z; -} -// Given an array for a two-dimensional matrix and the polynomial order, -// solve A * x = b using Gaussian elimination. -function gaussianElimination(matrix) { - const n = matrix.length - 1, coef = []; - let i, j, k, r, t; - for(i = 0; i < n; ++i){ - r = i; // max row - for(j = i + 1; j < n; ++j)if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) r = j; - for(k = i; k < n + 1; ++k){ - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - for(j = i + 1; j < n; ++j)for(k = n; k >= i; k--)matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; + canvas() { + return this._canvas; } - for(j = n - 1; j >= 0; --j){ - t = 0; - for(k = j + 1; k < n; ++k)t += matrix[k][j] * coef[k]; - coef[j] = (matrix[n][j] - t) / matrix[j][j]; + context() { + return this._options.externalContext || (this._canvas ? this._canvas.getContext("2d") : null); } - return coef; -} -const maxiters = 2, epsilon = 1e-12; -// Adapted from science.js by Jason Davies -// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js -// License: https://github.com/jasondavies/science.js/blob/master/LICENSE -function loess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), n = xv.length, bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); - for(let iter = -1; ++iter <= maxiters;){ - const interval = [ - 0, - bw - 1 - ]; - for(let i = 0; i < n; ++i){ - const dx = xv[i], i0 = interval[0], i1 = interval[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0; - const denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - for(let k = i0; k <= i1; ++k){ - const xk = xv[k], yk = yv[k], w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w; - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - updateInterval(xv, i + 1, interval); - } - if (iter === maxiters) break; - const medianResidual = (0, _d3Array.median)(residuals); - if (Math.abs(medianResidual) < epsilon) break; - for(let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w; - } - } - return output(xv, yhat, ux, uy); -} -// weighting kernel for local regression -function tricube(x) { - return (x = 1 - x * x * x) * x * x; -} -// advance sliding window interval of nearest neighbors -function updateInterval(xv, i, interval) { - const val = xv[i]; - let left = interval[0], right = interval[1] + 1; - if (right >= xv.length) return; - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while(i > left && xv[right] - val <= val - xv[left]){ - interval[0] = ++left; - interval[1] = right; - ++right; - } -} -// generate smoothed output points -// average points with repeated x values -function output(xv, yhat, ux, uy) { - const n = xv.length, out = []; - let i = 0, cnt = 0, prev = [], v; - for(; i < n; ++i){ - v = xv[i] + ux; - if (prev[0] === v) // average output values via online update - prev[1] += (yhat[i] - prev[1]) / ++cnt; - else { - // add new output point - cnt = 0; - prev[1] += uy; - prev = [ - v, - yhat[i] - ]; - out.push(prev); + dirty(item) { + const b2 = this._tempb.clear().union(item.bounds); + let g = item.mark.group; + while (g) { + b2.translate(g.x || 0, g.y || 0); + g = g.mark.group; + } + this._dirty.union(b2); + } + _render(scene, markTypes) { + const g = this.context(), o = this._origin, w2 = this._width, h2 = this._height, db = this._dirty, vb = viewBounds(o, w2, h2); + g.save(); + const b2 = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); + this.clear(-o[0], -o[1], w2, h2); + this.draw(g, scene, b2, markTypes); + g.restore(); + db.clear(); + return this; + } + draw(ctx, scene, bounds2, markTypes) { + if (scene.marktype !== "group" && markTypes != null && !markTypes.includes(scene.marktype)) { + return; + } + const mark = Marks[scene.marktype]; + if (scene.clip) clip$2(ctx, scene); + mark.draw.call(this, ctx, scene, bounds2, markTypes); + if (scene.clip) ctx.restore(); + } + clear(x2, y2, w2, h2) { + const opt = this._options, g = this.context(); + if (opt.type !== "pdf" && !opt.externalContext) { + g.clearRect(x2, y2, w2, h2); + } + if (this._bgcolor != null) { + g.fillStyle = this._bgcolor; + g.fillRect(x2, y2, w2, h2); + } + } + } + const viewBounds = (origin, width2, height2) => new Bounds().set(0, 0, width2, height2).translate(-origin[0], -origin[1]); + function clipToBounds(g, b2, origin) { + b2.expand(1).round(); + if (g.pixelRatio % 1) { + b2.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); + } + b2.translate(-(origin[0] % 1), -(origin[1] % 1)); + g.beginPath(); + g.rect(b2.x1, b2.y1, b2.width(), b2.height()); + g.clip(); + return b2; + } + class SVGHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + const h2 = this; + h2._hrefHandler = listener(h2, (evt, item) => { + if (item && item.href) h2.handleHref(evt, item, item.href); + }); + h2._tooltipHandler = listener(h2, (evt, item) => { + h2.handleTooltip(evt, item, evt.type !== TooltipHideEvent); + }); + } + initialize(el, origin, obj2) { + let svg = this._svg; + if (svg) { + svg.removeEventListener(HrefEvent, this._hrefHandler); + svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); + svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); + } + this._svg = svg = el && domFind(el, "svg"); + if (svg) { + svg.addEventListener(HrefEvent, this._hrefHandler); + svg.addEventListener(TooltipShowEvent, this._tooltipHandler); + svg.addEventListener(TooltipHideEvent, this._tooltipHandler); + } + return super.initialize(el, origin, obj2); + } + canvas() { + return this._svg; + } + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + const x2 = { + type: type2, + handler, + listener: listener(this, handler) + }; + (h2[name] || (h2[name] = [])).push(x2); + if (this._svg) { + this._svg.addEventListener(name, x2.listener); } + } + return this; } - prev[1] += uy; - return out; -} -// subdivide up to accuracy of 0.5 degrees -const MIN_RADIANS = 0.5 * Math.PI / 180; -// Adaptively sample an interpolated function over a domain extent -function sampleCurve(f, extent, minSteps, maxSteps) { - minSteps = minSteps || 25; - maxSteps = Math.max(minSteps, maxSteps || 200); - const point = (x)=>[ - x, - f(x) - ], minX = extent[0], maxX = extent[1], span = maxX - minX, stop = span / maxSteps, prev = [ - point(minX) - ], next = []; - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for(let i = 1; i < maxSteps; ++i)prev.push(point(minX + i / minSteps * span)); - prev.push(point(maxX)); - return prev; + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + if (this._svg) { + this._svg.removeEventListener(name, h2[i].listener); + } + h2.splice(i, 1); + } + return this; + } + } + const listener = (context2, handler) => (evt) => { + let item = evt.target.__data__; + item = Array.isArray(item) ? item[0] : item; + evt.vegaType = evt.type; + handler.call(context2._obj, evt, item); + }; + const ARIA_HIDDEN = "aria-hidden"; + const ARIA_LABEL = "aria-label"; + const ARIA_ROLE = "role"; + const ARIA_ROLEDESCRIPTION = "aria-roledescription"; + const GRAPHICS_OBJECT = "graphics-object"; + const GRAPHICS_SYMBOL = "graphics-symbol"; + const bundle = (role, roledesc, label2) => ({ + [ARIA_ROLE]: role, + [ARIA_ROLEDESCRIPTION]: roledesc, + [ARIA_LABEL]: label2 || void 0 + }); + const AriaIgnore = toSet(["axis-domain", "axis-grid", "axis-label", "axis-tick", "axis-title", "legend-band", "legend-entry", "legend-gradient", "legend-label", "legend-title", "legend-symbol", "title"]); + const AriaGuides = { + "axis": { + desc: "axis", + caption: axisCaption + }, + "legend": { + desc: "legend", + caption: legendCaption + }, + "title-text": { + desc: "title", + caption: (item) => `Title text '${titleCaption(item)}'` + }, + "title-subtitle": { + desc: "subtitle", + caption: (item) => `Subtitle text '${titleCaption(item)}'` + } + }; + const AriaEncode = { + ariaRole: ARIA_ROLE, + ariaRoleDescription: ARIA_ROLEDESCRIPTION, + description: ARIA_LABEL + }; + function ariaItemAttributes(emit2, item) { + const hide = item.aria === false; + emit2(ARIA_HIDDEN, hide || void 0); + if (hide || item.description == null) { + for (const prop in AriaEncode) { + emit2(AriaEncode[prop], void 0); + } } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for(let i = minSteps; --i > 0;)next.push(point(minX + i / minSteps * span)); + const type2 = item.mark.marktype; + emit2(ARIA_LABEL, item.description); + emit2(ARIA_ROLE, item.ariaRole || (type2 === "group" ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); + emit2(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type2} mark`); } - let p0 = prev[0]; - let p1 = next[next.length - 1]; - const sx = 1 / span; - const sy = scaleY(p0[1], next); - while(p1){ - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - const dx = pm[0] - p0[0] >= stop; - if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) // maximum resolution has not yet been met, and - // subdivision midpoint is sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; + } + function ariaMarkAttributes(mark) { + return mark.aria === false ? { + [ARIA_HIDDEN]: true + } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); + } + function ariaMark(mark) { + const type2 = mark.marktype; + const recurse2 = type2 === "group" || type2 === "text" || mark.items.some((_) => _.description != null && _.aria !== false); + return bundle(recurse2 ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type2} mark container`, mark.description); + } + function ariaGuide(mark, opt) { + try { + const item = mark.items[0], caption = opt.caption || (() => ""); + return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); + } catch (err) { + return null; } - return prev; -} -function scaleY(init, points) { - let ymin = init; - let ymax = init; - const n = points.length; - for(let i = 0; i < n; ++i){ - const y = points[i][1]; - if (y < ymin) ymin = y; - if (y > ymax) ymax = y; + } + function titleCaption(item) { + return array$4(item.text).join(" "); + } + function axisCaption(item) { + const datum2 = item.datum, orient = item.orient, title = datum2.title ? extractTitle(item) : null, ctx = item.context, scale2 = ctx.scales[datum2.scale].value, locale2 = ctx.dataflow.locale(), type2 = scale2.type, xy = orient === "left" || orient === "right" ? "Y" : "X"; + return `${xy}-axis` + (title ? ` titled '${title}'` : "") + ` for a ${isDiscrete(type2) ? "discrete" : type2} scale with ${domainCaption(locale2, scale2, item)}`; + } + function legendCaption(item) { + const datum2 = item.datum, title = datum2.title ? extractTitle(item) : null, type2 = `${datum2.type || ""} legend`.trim(), scales2 = datum2.scales, props = Object.keys(scales2), ctx = item.context, scale2 = ctx.scales[scales2[props[0]]].value, locale2 = ctx.dataflow.locale(); + return capitalize(type2) + (title ? ` titled '${title}'` : "") + ` for ${channelCaption(props)} with ${domainCaption(locale2, scale2, item)}`; + } + function extractTitle(item) { + try { + return array$4(peek$1(item.items).items[0].text).join(" "); + } catch (err) { + return null; } - return 1 / (ymax - ymin); -} -function angleDelta(p, q, r, sx, sy) { - const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])), a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0])); - return Math.abs(a0 - a1); -} - -},{"d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hvqjl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bound", ()=>Bound); -parcelHelpers.export(exports, "identifier", ()=>Identifier); -parcelHelpers.export(exports, "mark", ()=>Mark); -parcelHelpers.export(exports, "overlap", ()=>Overlap); -parcelHelpers.export(exports, "render", ()=>Render); -parcelHelpers.export(exports, "viewlayout", ()=>ViewLayout); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaUtil = require("vega-util"); -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const TopLeft = 'top-left'; -const TopRight = 'top-right'; -const BottomLeft = 'bottom-left'; -const BottomRight = 'bottom-right'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const X = 'x'; -const Y = 'y'; -const Group = 'group'; -const AxisRole = 'axis'; -const TitleRole = 'title'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const LegendRole = 'legend'; -const RowHeader = 'row-header'; -const RowFooter = 'row-footer'; -const RowTitle = 'row-title'; -const ColHeader = 'column-header'; -const ColFooter = 'column-footer'; -const ColTitle = 'column-title'; -const Padding = 'padding'; -const Symbols = 'symbol'; -const Fit = 'fit'; -const FitX = 'fit-x'; -const FitY = 'fit-y'; -const Pad = 'pad'; -const None = 'none'; -const All = 'all'; -const Each = 'each'; -const Flush = 'flush'; -const Column = 'column'; -const Row = 'row'; -/** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ function Bound(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Bound, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow, mark = _.mark, type = mark.marktype, entry = (0, _vegaScenegraph.Marks)[type], bound = entry.bound; - let markBounds = mark.bounds, rebound; - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem(mark, bound); - mark.items.forEach((item)=>{ - item.bounds.clear().union(markBounds); - }); - } else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, (item)=>view.dirty(item)); - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(boundItem(item, bound))); - // force reflow for axes/legends/titles to propagate any layout changes - switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } + } + function channelCaption(props) { + props = props.map((p) => p + (p === "fill" || p === "stroke" ? " color" : "")); + return props.length < 2 ? props[0] : props.slice(0, -1).join(", ") + " and " + peek$1(props); + } + function capitalize(s2) { + return s2.length ? s2[0].toUpperCase() + s2.slice(1) : s2; + } + const innerText = (val) => (val + "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); + const attrText = (val) => innerText(val).replace(/"/g, """).replace(/\t/g, " ").replace(/\n/g, " ").replace(/\r/g, " "); + function markup() { + let buf = "", outer = "", inner = ""; + const stack = [], clear = () => outer = inner = "", push2 = (tag) => { + if (outer) { + buf += `${outer}>${inner}`; + clear(); + } + stack.push(tag); + }, attr2 = (name, value2) => { + if (value2 != null) outer += ` ${name}="${attrText(value2)}"`; + return m2; + }, m2 = { + open(tag, ...attrs) { + push2(tag); + outer = "<" + tag; + for (const set2 of attrs) { + for (const key2 in set2) attr2(key2, set2[key2]); + } + return m2; + }, + close() { + const tag = stack.pop(); + if (outer) { + buf += outer + (inner ? `>${inner}</${tag}>` : "/>"); } else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - pulse.visit(pulse.ADD, (item)=>{ - markBounds.union(boundItem(item, bound)); - }); - pulse.visit(pulse.MOD, (item)=>{ - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem(item, bound)); - }); - if (rebound) { - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(item.bounds)); - } - } - // ensure mark bounds do not exceed any clipping region - (0, _vegaScenegraph.boundClip)(mark); - return pulse.modifies('bounds'); - } -}); -function boundItem(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); -} -const COUNTER_NAME = ':vega_identifier:'; -/** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ function Identifier(params) { - (0, _vegaDataflow.Transform).call(this, 0, params); -} -Identifier.Definition = { - 'type': 'Identifier', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'as', - 'type': 'string', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Identifier, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const counter = getCounter(pulse.dataflow), as = _.as; - let id = counter.value; - pulse.visit(pulse.ADD, (t)=>t[as] = t[as] || ++id); - counter.set(this.value = id); - return pulse; - } -}); -function getCounter(view) { - return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); -} -/** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ function Mark(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Mark, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let mark = this.value; - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - // initialize entering items - const Init = mark.marktype === Group ? (0, _vegaScenegraph.GroupItem) : (0, _vegaScenegraph.Item); - pulse.visit(pulse.ADD, (item)=>Init.call(item, mark)); - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; - } -}); -function lookup$1(_) { - const g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; -} -/** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ function Overlap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const methods = { - parity: (items)=>items.filter((item, i)=>i % 2 ? item.opacity = 0 : 1), - greedy: (items, sep)=>{ - let a; - return items.filter((b, i)=>!i || !intersect(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0); - } -}; -// compute bounding box intersection -// including padding pixels of separation -const intersect = (a, b, sep)=>sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2); -const hasOverlap = (items, pad)=>{ - for(var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i){ - if (intersect(a, b = items[i].bounds, pad)) return true; - } -}; -const hasBounds = (item)=>{ - const b = item.bounds; - return b.width() > 1 && b.height() > 1; -}; -const boundTest = (scale, orient, tolerance)=>{ - var range = scale.range(), b = new (0, _vegaScenegraph.Bounds)(); - if (orient === Top || orient === Bottom) b.set(range[0], -Infinity, range[1], Infinity); - else b.set(-Infinity, range[0], Infinity, range[1]); - b.expand(tolerance || 1); - return (item)=>b.encloses(item.bounds); -}; -// reset all items to be fully opaque -const reset = (source)=>{ - source.forEach((item)=>item.opacity = 1); - return source; -}; -// add all tuples to mod, fork pulse if parameters were modified -// fork prevents cross-stream tuple pollution (e.g., pulse from scale) -const reflow = (pulse, _)=>pulse.reflow(_.modified()).modifies('opacity'); -(0, _vegaUtil.inherits)(Overlap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; - let source = pulse.materialize(pulse.SOURCE).source, items, test; - if (!source || !source.length) return; - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - // skip labels with no content - source = source.filter(hasBounds); - // early exit, nothing to do - if (!source.length) return; - if (_.sort) source = source.slice().sort(_.sort); - items = reset(source); - pulse = reflow(pulse, _); - if (items.length >= 3 && hasOverlap(items, sep)) { - do items = reduce(items, sep); - while (items.length >= 3 && hasOverlap(items, sep)); - if (items.length < 3 && !(0, _vegaUtil.peek)(source).opacity) { - if (items.length > 1) (0, _vegaUtil.peek)(items).opacity = 0; - (0, _vegaUtil.peek)(source).opacity = 1; - } + buf += `</${tag}>`; } - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach((item)=>{ - if (!test(item)) item.opacity = 0; - }); - } - // re-calculate mark bounds - const bounds = items[0].mark.bounds.clear(); - source.forEach((item)=>{ - if (item.opacity) bounds.union(item.bounds); + clear(); + return m2; + }, + attr: attr2, + text: (t) => (inner += innerText(t), m2), + toString: () => buf + }; + return m2; + } + const serializeXML = (node) => _serialize(markup(), node) + ""; + function _serialize(m2, node) { + m2.open(node.tagName); + if (node.hasAttributes()) { + const attrs = node.attributes, n = attrs.length; + for (let i = 0; i < n; ++i) { + m2.attr(attrs[i].name, attrs[i].value); + } + } + if (node.hasChildNodes()) { + const children2 = node.childNodes; + for (const child of children2) { + child.nodeType === 3 ? m2.text(child.nodeValue) : _serialize(m2, child); + } + } + return m2.close(); + } + const stylesAttr = { + fill: "fill", + fillOpacity: "fill-opacity", + stroke: "stroke", + strokeOpacity: "stroke-opacity", + strokeWidth: "stroke-width", + strokeCap: "stroke-linecap", + strokeJoin: "stroke-linejoin", + strokeDash: "stroke-dasharray", + strokeDashOffset: "stroke-dashoffset", + strokeMiterLimit: "stroke-miterlimit", + opacity: "opacity" + }; + const stylesCss = { + blend: "mix-blend-mode" + }; + const rootAttributes = { + "fill": "none", + "stroke-miterlimit": 10 + }; + const RootIndex = 0, xmlns = "http://www.w3.org/2000/xmlns/", svgns = metadata.xmlns; + class SVGRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._dirtyID = 0; + this._dirty = []; + this._svg = null; + this._root = null; + this._defs = null; + } + /** + * Initialize a new SVGRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._defs = {}; + this._clearDefs(); + if (el) { + this._svg = domChild(el, 0, "svg", svgns); + this._svg.setAttributeNS(xmlns, "xmlns", svgns); + this._svg.setAttributeNS(xmlns, "xmlns:xlink", metadata["xmlns:xlink"]); + this._svg.setAttribute("version", metadata["version"]); + this._svg.setAttribute("class", "marks"); + domClear(el, 1); + this._root = domChild(this._svg, RootIndex, "g", svgns); + setAttributes(this._root, rootAttributes); + domClear(this._svg, RootIndex + 1); + } + this.background(this._bgcolor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length && this._svg) { + this._svg.style.setProperty("background-color", bgcolor); + } + return super.background(...arguments); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._svg) { + setAttributes(this._svg, { + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` }); - return pulse; - } -}); -/** - * Queue modified scenegraph items for rendering. - * @constructor - */ function Render(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Render, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - pulse.visit(pulse.ALL, (item)=>view.dirty(item)); - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - const item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - } -}); -const tempBounds = new (0, _vegaScenegraph.Bounds)(); -function set(item, property, value) { - return item[property] === value ? 0 : (item[property] = value, 1); -} -function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; -} -function axisIndices(datum) { - let index = +datum.grid; - return [ - datum.ticks ? index++ : -1, - // ticks index - datum.labels ? index++ : -1, - // labels index - index + +datum.domain // title index - ]; -} -function axisLayout(view, axis, width, height) { - var item = axis.items[0], datum = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum), range = item.range, offset = item.offset, position = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds = item.bounds, dl = title && (0, _vegaScenegraph.multiLineOffset)(title), x = 0, y = 0, i, s; - tempBounds.clear().union(bounds); - bounds.clear(); - if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); - // position axis group and title - switch(orient){ - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - // update bounds - (0, _vegaScenegraph.boundStroke)(bounds.translate(x, y), item); - if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) { - item.bounds = tempBounds; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - return item.mark.bounds.clear().union(bounds); -} -function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - view.dirty(title); - isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - bounds.union(b); -} -// aggregation functions for grid margin determination -const min = (a, b)=>Math.floor(Math.min(a, b)); -const max = (a, b)=>Math.ceil(Math.max(a, b)); -function gridLayoutGroups(group) { - var groups = group.items, n = groups.length, i = 0, mark, items; - const views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - // layout axes, gather legends, collect bounds - for(; i < n; ++i){ - mark = groups[i]; - items = mark.items; - if (mark.marktype === Group) switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - break; - case RowHeader: - views.rowheaders.push(...items); - break; - case RowFooter: - views.rowfooters.push(...items); - break; - case ColHeader: - views.colheaders.push(...items); - break; - case ColFooter: - views.colfooters.push(...items); - break; - case RowTitle: - views.rowtitle = items[0]; - break; - case ColTitle: - views.coltitle = items[0]; - break; - default: - views.marks.push(...items); - } + this._root.setAttribute("transform", `translate(${this._origin})`); + } + this._dirty = []; + return this; } - return views; -} -function bboxFlush(item) { - return new (0, _vegaScenegraph.Bounds)().set(0, 0, item.width || 0, item.height || 0); -} -function bboxFull(item) { - const b = item.bounds.clone(); - return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0)); -} -function get(opt, key, d) { - const v = (0, _vegaUtil.isObject)(opt) ? opt[key] : opt; - return v != null ? v : d !== undefined ? d : 0; -} -function offsetValue(v) { - return v < 0 ? Math.ceil(-v) : 0; -} -function gridLayout(view, groups, opt) { - var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds = tempBounds.set(0, 0, 0, 0), alignCol = get(opt.align, Column), alignRow = get(opt.align, Row), padCol = get(opt.padding, Column), padRow = get(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m, i, c, r, b, g, px, py, x, y, offset; - for(i = 0; i < ncols; ++i)xExtent[i] = 0; - for(i = 0; i < nrows; ++i)yExtent[i] = 0; - // determine offsets for each group - for(i = 0; i < n; ++i){ - g = groups[i]; - b = boxes[i] = bbox(g); - g.x = g.x || 0; - dx[i] = 0; - g.y = g.y || 0; - dy[i] = 0; - c = i % ncols; - r = ~~(i / ncols); - xMax = Math.max(xMax, px = Math.ceil(b.x2)); - yMax = Math.max(yMax, py = Math.ceil(b.y2)); - xExtent[c] = Math.max(xExtent[c], px); - yExtent[r] = Math.max(yExtent[r], py); - xOffset[i] = padCol + offsetValue(b.x1); - yOffset[i] = padRow + offsetValue(b.y1); - if (dirty) view.dirty(groups[i]); - } - // set initial alignment offsets - for(i = 0; i < n; ++i){ - if (i % ncols === 0) xOffset[i] = 0; - if (i < ncols) yOffset[i] = 0; - } - // enforce column alignment constraints - if (alignCol === Each) for(c = 1; c < ncols; ++c){ - for(offset = 0, i = c; i < n; i += ncols)if (offset < xOffset[i]) offset = xOffset[i]; - for(i = c; i < n; i += ncols)xOffset[i] = offset + xExtent[c - 1]; - } - else if (alignCol === All) { - for(offset = 0, i = 0; i < n; ++i)if (i % ncols && offset < xOffset[i]) offset = xOffset[i]; - for(i = 0; i < n; ++i)if (i % ncols) xOffset[i] = offset + xMax; - } else { - for(alignCol = false, c = 1; c < ncols; ++c)for(i = c; i < n; i += ncols)xOffset[i] += xExtent[c - 1]; + /** + * Returns the SVG element of the visualization. + * @return {DOMElement} - The SVG element. + */ + canvas() { + return this._svg; } - // enforce row alignment constraints - if (alignRow === Each) for(r = 1; r < nrows; ++r){ - for(offset = 0, i = r * ncols, m = i + ncols; i < m; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = r * ncols; i < m; ++i)yOffset[i] = offset + yExtent[r - 1]; + /** + * Returns an SVG text string for the rendered content, + * or null if this renderer is currently headless. + */ + svg() { + const svg = this._svg, bg = this._bgcolor; + if (!svg) return null; + let node; + if (bg) { + svg.removeAttribute("style"); + node = domChild(svg, RootIndex, "rect", svgns); + setAttributes(node, { + width: this._width, + height: this._height, + fill: bg + }); + } + const text2 = serializeXML(svg); + if (bg) { + svg.removeChild(node); + this._svg.style.setProperty("background-color", bg); + } + return text2; } - else if (alignRow === All) { - for(offset = 0, i = ncols; i < n; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = ncols; i < n; ++i)yOffset[i] = offset + yMax; - } else { - for(alignRow = false, r = 1; r < nrows; ++r)for(i = r * ncols, m = i + ncols; i < m; ++i)yOffset[i] += yExtent[r - 1]; - } - // perform horizontal grid layout - for(x = 0, i = 0; i < n; ++i){ - x = xOffset[i] + (i % ncols ? x : 0); - dx[i] += x - groups[i].x; - } - // perform vertical grid layout - for(c = 0; c < ncols; ++c)for(y = 0, i = c; i < n; i += ncols){ - y += yOffset[i]; - dy[i] += y - groups[i].y; - } - // perform horizontal centering - if (alignCol && get(opt.center, Column) && nrows > 1) for(i = 0; i < n; ++i){ - b = alignCol === All ? xMax : xExtent[i % ncols]; - x = b - boxes[i].x2 - groups[i].x - dx[i]; - if (x > 0) dx[i] += x / 2; - } - // perform vertical centering - if (alignRow && get(opt.center, Row) && ncols !== 1) for(i = 0; i < n; ++i){ - b = alignRow === All ? yMax : yExtent[~~(i / ncols)]; - y = b - boxes[i].y2 - groups[i].y - dy[i]; - if (y > 0) dy[i] += y / 2; - } - // position grid relative to anchor - for(i = 0; i < n; ++i)bounds.union(boxes[i].translate(dx[i], dy[i])); - x = get(opt.anchor, X); - y = get(opt.anchor, Y); - switch(get(opt.anchor, Column)){ - case End: - x -= bounds.width(); - break; - case Middle: - x -= bounds.width() / 2; + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + if (this._dirtyCheck()) { + if (this._dirtyAll) this._clearDefs(); + this.mark(this._root, scene, void 0, markTypes); + domClear(this._root, 1); + } + this.defs(); + this._dirty = []; + ++this._dirtyID; + return this; } - switch(get(opt.anchor, Row)){ - case End: - y -= bounds.height(); - break; - case Middle: - y -= bounds.height() / 2; - } - x = Math.round(x); - y = Math.round(y); - // update mark positions, bounds, dirty - bounds.clear(); - for(i = 0; i < n; ++i)groups[i].mark.bounds.clear(); - for(i = 0; i < n; ++i){ - g = groups[i]; - g.x += dx[i] += x; - g.y += dy[i] += y; - bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); - if (dirty) view.dirty(g); - } - return bounds; -} -function trellisLayout(view, group, opt) { - var views = gridLayoutGroups(group), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x, y, x2, y2, anchor, band, offset; - // -- initial grid layout - const bounds = gridLayout(view, groups, opt); - if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid - // -- layout grid headers and footers -- - // perform row header layout - if (views.rowheaders) { - band = get(opt.headerBand, Row, null); - x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band); + // -- Manage rendering of items marked as dirty -- + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (item.dirty !== this._dirtyID) { + item.dirty = this._dirtyID; + this._dirty.push(item); + } } - // perform column header layout - if (views.colheaders) { - band = get(opt.headerBand, Column, null); - y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band); + /** + * Check if a mark item is considered dirty. + * @param {Item} item - The mark item. + */ + isDirty(item) { + return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; } - // perform row footer layout - if (views.rowfooters) { - band = get(opt.footerBand, Row, null); - x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band); + /** + * Internal method to check dirty status and, if possible, + * make targetted updates without a full rendering pass. + */ + _dirtyCheck() { + this._dirtyAll = true; + const items = this._dirty; + if (!items.length || !this._dirtyID) return true; + const id2 = ++this._dirtyID; + let item, mark, type2, mdef, i, n, o; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + mark = item.mark; + if (mark.marktype !== type2) { + type2 = mark.marktype; + mdef = Marks[type2]; + } + if (mark.zdirty && mark.dirty !== id2) { + this._dirtyAll = false; + dirtyParents(item, id2); + mark.items.forEach((i2) => { + i2.dirty = id2; + }); + } + if (mark.zdirty) continue; + if (item.exit) { + if (mdef.nested && mark.items.length) { + o = mark.items[0]; + if (o._svg) this._update(mdef, o._svg, o); + } else if (item._svg) { + o = item._svg.parentNode; + if (o) o.removeChild(item._svg); + } + item._svg = null; + continue; + } + item = mdef.nested ? mark.items[0] : item; + if (item._update === id2) continue; + if (!item._svg || !item._svg.ownerSVGElement) { + this._dirtyAll = false; + dirtyParents(item, id2); + } else { + this._update(mdef, item._svg, item); + } + item._update = id2; + } + return !this._dirtyAll; } - // perform column footer layout - if (views.colfooters) { - band = get(opt.footerBand, Column, null); - y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band); + // -- Construct & maintain scenegraph to SVG mapping --- + /** + * Render a set of mark items. + * @param {SVGElement} el - The parent element in the SVG tree. + * @param {object} scene - The mark parent to render. + * @param {SVGElement} prev - The previous sibling in the SVG tree. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + mark(el, scene, prev, markTypes) { + if (!this.isDirty(scene)) { + return scene._svg; + } + const svg = this._svg, markType2 = scene.marktype, mdef = Marks[markType2], events2 = scene.interactive === false ? "none" : null, isGroup = mdef.tag === "g"; + const parent = bind$1(scene, el, prev, "g", svg); + if (markType2 !== "group" && markTypes != null && !markTypes.includes(markType2)) { + domClear(parent, 0); + return scene._svg; + } + parent.setAttribute("class", cssClass(scene)); + const aria = ariaMarkAttributes(scene); + for (const key2 in aria) setAttribute(parent, key2, aria[key2]); + if (!isGroup) { + setAttribute(parent, "pointer-events", events2); + } + setAttribute(parent, "clip-path", scene.clip ? clip$1$1(this, scene, scene.group) : null); + let sibling = null, i = 0; + const process = (item) => { + const dirty = this.isDirty(item), node = bind$1(item, parent, sibling, mdef.tag, svg); + if (dirty) { + this._update(mdef, node, item); + if (isGroup) recurse(this, node, item, markTypes); + } + sibling = node; + ++i; + }; + if (mdef.nested) { + if (scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + domClear(parent, i); + return parent; } - // perform row title layout - if (views.rowtitle) { - anchor = get(opt.titleAnchor, Row); - offset = get(off, 'rowTitle'); - offset = anchor === End ? x2 + offset : x - offset; - band = get(opt.titleBand, Row, 0.5); - layoutTitle(view, views.rowtitle, offset, 0, bounds, band); + /** + * Update the attributes of an SVG element for a mark item. + * @param {object} mdef - The mark definition object + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + _update(mdef, el, item) { + element$1 = el; + values = el.__values__; + ariaItemAttributes(emit, item); + mdef.attr(emit, item, this); + const extra = mark_extras[mdef.type]; + if (extra) extra.call(this, mdef, el, item); + if (element$1) this.style(element$1, item); } - // perform column title layout - if (views.coltitle) { - anchor = get(opt.titleAnchor, Column); - offset = get(off, 'columnTitle'); - offset = anchor === End ? y2 + offset : y - offset; - band = get(opt.titleBand, Column, 0.5); - layoutTitle(view, views.coltitle, offset, 1, bounds, band); - } -} -function boundFlush(item, field) { - return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined; -} -function boundFull(item, field) { - return item.bounds[field]; -} -function layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) { - var n = groups.length, init = 0, edge = 0, i, j, k, m, b, h, g, x, y; - // if no groups, early exit and return 0 - if (!n) return init; - // compute margin - for(i = start; i < n; i += stride)if (groups[i]) init = agg(init, bound(groups[i], bf)); - // if no headers, return margin calculation - if (!headers.length) return init; - // check if number of headers exceeds number of rows or columns - if (headers.length > limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - // apply offset - init += offset; - // clear mark bounds for all headers - for(j = 0, m = headers.length; j < m; ++j){ - view.dirty(headers[j]); - headers[j].mark.bounds.clear(); - } - // layout each header - for(i = start, j = 0, m = headers.length; j < m; ++j, i += stride){ - h = headers[j]; - b = h.mark.bounds; - // search for nearest group to align to - // necessary if table has empty cells - for(k = i; k >= 0 && (g = groups[k]) == null; k -= back); - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; + /** + * Update the presentation attributes of an SVG element for a mark item. + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + style(el, item) { + if (item == null) return; + for (const prop in stylesAttr) { + let value2 = prop === "font" ? fontFamily(item) : item[prop]; + if (value2 === values[prop]) continue; + const name = stylesAttr[prop]; + if (value2 == null) { + el.removeAttribute(name); } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); + if (isGradient(value2)) { + value2 = gradientRef(value2, this._defs.gradient, href()); + } + el.setAttribute(name, value2 + ""); } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - // update current edge of layout bounds - edge = agg(edge, b[bf]); + values[prop] = value2; + } + for (const prop in stylesCss) { + setStyle(el, stylesCss[prop], item[prop]); + } } - return edge; -} -function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - // compute title coordinates - var x = offset, y = offset; - isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - // queue title for redraw - view.dirty(g); -} -// utility for looking up legend layout configuration -function lookup(config, orient) { - const opt = config[orient] || {}; - return (key, d)=>opt[key] != null ? opt[key] : config[key] != null ? config[key] : d; -} -// if legends specify offset directly, use the maximum specified value -function offsets(legends, value) { - let max = -Infinity; - legends.forEach((item)=>{ - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; -} -function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup(config, orient), offset = offsets(g, _('offset', 0)), anchor = _('anchor', Start), mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - switch(orient){ - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, - column: End, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, - row: End, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case TopLeft: - p.anchor = { - x: offset, - y: offset - }; - break; - case TopRight: - p.anchor = { - x: w - offset, - y: offset, - column: End - }; - break; - case BottomLeft: - p.anchor = { - x: offset, - y: h - offset, - row: End - }; - break; - case BottomRight: - p.anchor = { - x: w - offset, - y: h - offset, - column: End, - row: End - }; - break; + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + */ + defs() { + const svg = this._svg, defs = this._defs; + let el = defs.el, index2 = 0; + for (const id2 in defs.gradient) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateGradient(el, defs.gradient[id2], index2); + } + for (const id2 in defs.clipping) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateClipping(el, defs.clipping[id2], index2); + } + if (el) { + index2 === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index2); + } } - return p; -} -function legendLayout(view, legend) { - var item = legend.items[0], datum = item.datum, orient = item.orient, bounds = item.bounds, x = item.x, y = item.y, w, h; - // cache current bounds for later comparison - item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); - bounds.clear(); - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - if (datum.type === Symbols) legendEntryLayout(item.items[0].items[0].items[0].items); - if (orient !== None) { - item.x = x = 0; - item.y = y = 0; + /** + * Clear defs caches. + */ + _clearDefs() { + const def2 = this._defs; + def2.gradient = {}; + def2.clipping = {}; } - item.width = w; - item.height = h; - (0, _vegaScenegraph.boundStroke)(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - return item; -} -function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach((_)=>b.union(_.bounds)); - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - return b; -} -function legendGroupLayout(view, item, entry) { - var pad = item.padding, ex = pad - entry.x, ey = pad - entry.y; - if (!item.datum.title) { - if (ex || ey) translate(view, entry, ex, ey); + } + function dirtyParents(item, id2) { + for (; item && item.dirty !== id2; item = item.mark.group) { + item.dirty = id2; + if (item.mark && item.mark.dirty !== id2) { + item.mark.dirty = id2; + } else return; + } + } + function updateGradient(el, grad, index2) { + let i, n, stop2; + if (grad.gradient === "radial") { + let pt = domChild(el, index2++, "pattern", svgns); + setAttributes(pt, { + id: patternPrefix + grad.id, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + pt = domChild(pt, 0, "rect", svgns); + setAttributes(pt, { + width: 1, + height: 1, + fill: `url(${href()}#${grad.id})` + }); + el = domChild(el, index2++, "radialGradient", svgns); + setAttributes(el, { + id: grad.id, + fx: grad.x1, + fy: grad.y1, + fr: grad.r1, + cx: grad.x2, + cy: grad.y2, + r: grad.r2 + }); } else { - var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx = pad - title.x, ty = pad - title.y; - switch(title.orient){ - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate(view, entry, ex, ey); - switch(title.orient){ - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate(view, title, tx, ty); - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate(view, entry, -tx, 0); - translate(view, title, -tx, 0); - } + el = domChild(el, index2++, "linearGradient", svgns); + setAttributes(el, { + id: grad.id, + x1: grad.x1, + x2: grad.x2, + y1: grad.y1, + y2: grad.y2 + }); } -} -function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, s = e.bounds[y ? 'y2' : 'x2'] - item.padding, u = vgrad && lr ? s : 0, v = vgrad && lr ? 0 : s, o = y <= 0 ? 0 : (0, _vegaScenegraph.multiLineOffset)(title); - return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o)); -} -function translate(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); -} -function legendEntryLayout(entries) { - // get max widths for each column - const widths = entries.reduce((w, g)=>{ - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - // set dimensions of legend entry groups - entries.forEach((g)=>{ - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); -} -function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], frame = group.frame, orient = group.orient, anchor = group.anchor, offset = group.offset, padding = group.padding, title = group.items[0].items[0], subtitle = group.items[1] && group.items[1].items[0], end = orient === Left || orient === Right ? height : width, start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - if (frame !== Group) orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2); - else if (orient === Left) start = height, end = 0; - pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2; - if (subtitle && subtitle.text) { - // position subtitle - switch(orient){ - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - tempBounds.clear().union(subtitle.bounds); - tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds); - subtitle.mark.bounds.clear().union(tempBounds); - view.dirty(subtitle); - } - tempBounds.clear().union(subtitle.bounds); - } else tempBounds.clear(); - tempBounds.union(title.bounds); - // position title group - switch(orient){ - case Top: - x = pos; - y = viewBounds.y1 - tempBounds.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - if (set(group, 'x', x) | set(group, 'y', y)) { - tempBounds.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds); - mark.bounds.clear().union(tempBounds); - view.dirty(group); - } - return group.bounds; -} -/** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ function ViewLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(ViewLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - _.mark.items.forEach((group)=>{ - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - } -}); -function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; -} -function layoutGroup(view, group, _) { - var items = group.items, width = Math.max(0, group.width || 0), height = Math.max(0, group.height || 0), viewBounds = new (0, _vegaScenegraph.Bounds)().set(0, 0, width, height), xBounds = viewBounds.clone(), yBounds = viewBounds.clone(), legends = [], title, mark, orient, b, i, n; - // layout axes, gather legends, collect bounds - for(i = 0, n = items.length; i < n; ++i){ - mark = items[i]; - switch(mark.role){ - case AxisRole: - b = isYAxis(mark) ? xBounds : yBounds; - b.union(axisLayout(view, mark, width, height)); - break; - case TitleRole: - title = mark; - break; - case LegendRole: - legends.push(legendLayout(view, mark)); - break; - case FrameRole: - case ScopeRole: - case RowHeader: - case RowFooter: - case RowTitle: - case ColHeader: - case ColFooter: - case ColTitle: - xBounds.union(mark.bounds); - yBounds.union(mark.bounds); - break; - default: - viewBounds.union(mark.bounds); - } + for (i = 0, n = grad.stops.length; i < n; ++i) { + stop2 = domChild(el, i, "stop", svgns); + stop2.setAttribute("offset", grad.stops[i].offset); + stop2.setAttribute("stop-color", grad.stops[i].color); } - // layout legends, adjust viewBounds - if (legends.length) { - // group legends by orient - const l = {}; - legends.forEach((item)=>{ - orient = item.orient || Right; - if (orient !== None) (l[orient] || (l[orient] = [])).push(item); - }); - // perform grid layout for each orient group - for(const orient in l){ - const g = l[orient]; - gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height)); - } - // update view bounds - legends.forEach((item)=>{ - const b = item.bounds; - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient){ - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - else viewBounds.union(b); - }); + domClear(el, i); + return index2; + } + function updateClipping(el, clip2, index2) { + let mask; + el = domChild(el, index2, "clipPath", svgns); + el.setAttribute("id", clip2.id); + if (clip2.path) { + mask = domChild(el, 0, "path", svgns); + mask.setAttribute("d", clip2.path); + } else { + mask = domChild(el, 0, "rect", svgns); + setAttributes(mask, { + x: 0, + y: 0, + width: clip2.width, + height: clip2.height + }); } - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - // layout title, adjust bounds - if (title) viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - // override aggregated view bounds if content is clipped - if (group.clip) viewBounds.set(0, 0, group.width || 0, group.height || 0); - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); -} -function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, type = auto.type; - if (view._autosize < 1 || !type) return; - let viewWidth = view._width, viewHeight = view._height, width = Math.max(0, group.width || 0), left = Math.max(0, Math.ceil(-viewBounds.x1)), height = Math.max(0, group.height || 0), top = Math.max(0, Math.ceil(-viewBounds.y1)); - const right = Math.max(0, Math.ceil(viewBounds.x2 - width)), bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - if (type === None) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - view._resizeView(viewWidth, viewHeight, width, height, [ - left, - top - ], auto.resize); -} - -},{"vega-dataflow":"cFRfY","vega-scenegraph":"gJqm6","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gJqm6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "path", ()=>(0, _d3Path.path)); -parcelHelpers.export(exports, "Bounds", ()=>Bounds); -parcelHelpers.export(exports, "CanvasHandler", ()=>CanvasHandler); -parcelHelpers.export(exports, "CanvasRenderer", ()=>CanvasRenderer); -parcelHelpers.export(exports, "Gradient", ()=>Gradient); -parcelHelpers.export(exports, "GroupItem", ()=>GroupItem); -parcelHelpers.export(exports, "Handler", ()=>Handler); -parcelHelpers.export(exports, "HybridHandler", ()=>HybridHandler); -parcelHelpers.export(exports, "HybridRenderer", ()=>HybridRenderer); -parcelHelpers.export(exports, "Item", ()=>Item); -parcelHelpers.export(exports, "Marks", ()=>Marks); -parcelHelpers.export(exports, "RenderType", ()=>RenderType); -parcelHelpers.export(exports, "Renderer", ()=>Renderer); -parcelHelpers.export(exports, "ResourceLoader", ()=>ResourceLoader); -parcelHelpers.export(exports, "SVGHandler", ()=>SVGHandler); -parcelHelpers.export(exports, "SVGRenderer", ()=>SVGRenderer); -parcelHelpers.export(exports, "SVGStringRenderer", ()=>SVGStringRenderer); -parcelHelpers.export(exports, "Scenegraph", ()=>Scenegraph); -parcelHelpers.export(exports, "boundClip", ()=>boundClip); -parcelHelpers.export(exports, "boundContext", ()=>boundContext); -parcelHelpers.export(exports, "boundItem", ()=>boundItem); -parcelHelpers.export(exports, "boundMark", ()=>boundMark); -parcelHelpers.export(exports, "boundStroke", ()=>boundStroke); -parcelHelpers.export(exports, "domChild", ()=>domChild); -parcelHelpers.export(exports, "domClear", ()=>domClear); -parcelHelpers.export(exports, "domCreate", ()=>domCreate); -parcelHelpers.export(exports, "domFind", ()=>domFind); -parcelHelpers.export(exports, "font", ()=>font); -parcelHelpers.export(exports, "fontFamily", ()=>fontFamily); -parcelHelpers.export(exports, "fontSize", ()=>fontSize); -parcelHelpers.export(exports, "intersect", ()=>intersect); -parcelHelpers.export(exports, "intersectBoxLine", ()=>intersectBoxLine); -parcelHelpers.export(exports, "intersectPath", ()=>intersectPath); -parcelHelpers.export(exports, "intersectPoint", ()=>intersectPoint); -parcelHelpers.export(exports, "intersectRule", ()=>intersectRule); -parcelHelpers.export(exports, "lineHeight", ()=>lineHeight); -parcelHelpers.export(exports, "markup", ()=>markup); -parcelHelpers.export(exports, "multiLineOffset", ()=>multiLineOffset); -parcelHelpers.export(exports, "pathCurves", ()=>curves); -parcelHelpers.export(exports, "pathEqual", ()=>pathEqual); -parcelHelpers.export(exports, "pathParse", ()=>parse); -parcelHelpers.export(exports, "pathRectangle", ()=>vg_rect); -parcelHelpers.export(exports, "pathRender", ()=>pathRender); -parcelHelpers.export(exports, "pathSymbols", ()=>symbols); -parcelHelpers.export(exports, "pathTrail", ()=>vg_trail); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "renderModule", ()=>renderModule); -parcelHelpers.export(exports, "resetSVGClipId", ()=>resetSVGClipId); -parcelHelpers.export(exports, "resetSVGDefIds", ()=>resetSVGDefIds); -parcelHelpers.export(exports, "sceneEqual", ()=>sceneEqual); -parcelHelpers.export(exports, "sceneFromJSON", ()=>sceneFromJSON); -parcelHelpers.export(exports, "scenePickVisit", ()=>pickVisit); -parcelHelpers.export(exports, "sceneToJSON", ()=>sceneToJSON); -parcelHelpers.export(exports, "sceneVisit", ()=>visit); -parcelHelpers.export(exports, "sceneZOrder", ()=>zorder); -parcelHelpers.export(exports, "serializeXML", ()=>serializeXML); -parcelHelpers.export(exports, "setHybridRendererOptions", ()=>setHybridRendererOptions); -parcelHelpers.export(exports, "textMetrics", ()=>textMetrics); -var _vegaUtil = require("vega-util"); -var _d3Shape = require("d3-shape"); -var _d3Path = require("d3-path"); -var _vegaCanvas = require("vega-canvas"); -var _vegaLoader = require("vega-loader"); -var _vegaScale = require("vega-scale"); -let gradient_id = 0; -function resetSVGGradientId() { - gradient_id = 0; -} -const patternPrefix = 'p_'; -function isGradient(value) { - return value && value.gradient; -} -function gradientRef(g, defs, base) { - const type = g.gradient; - let id = g.id, prefix = type === 'radial' ? patternPrefix : ''; - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + gradient_id++; - if (type === 'radial') { - g.x1 = get(g.x1, 0.5); - g.y1 = get(g.y1, 0.5); - g.r1 = get(g.r1, 0); - g.x2 = get(g.x2, 0.5); - g.y2 = get(g.y2, 0.5); - g.r2 = get(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get(g.x1, 0); - g.y1 = get(g.y1, 0); - g.x2 = get(g.x2, 1); - g.y2 = get(g.y2, 0); - } - } - // register definition - defs[id] = g; - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; -} -function get(val, def) { - return val != null ? val : def; -} -function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({ - offset: offset, - color: color - }); - return gradient; - } - }; -} -const lookup = { - 'basis': { - curve: (0, _d3Shape.curveBasis) - }, - 'basis-closed': { - curve: (0, _d3Shape.curveBasisClosed) - }, - 'basis-open': { - curve: (0, _d3Shape.curveBasisOpen) - }, - 'bundle': { - curve: (0, _d3Shape.curveBundle), - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: (0, _d3Shape.curveCardinal), - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: (0, _d3Shape.curveCardinalOpen), - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: (0, _d3Shape.curveCardinalClosed), - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: (0, _d3Shape.curveCatmullRom), - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: (0, _d3Shape.curveCatmullRomClosed), - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: (0, _d3Shape.curveCatmullRomOpen), - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: (0, _d3Shape.curveLinear) - }, - 'linear-closed': { - curve: (0, _d3Shape.curveLinearClosed) - }, - 'monotone': { - horizontal: (0, _d3Shape.curveMonotoneY), - vertical: (0, _d3Shape.curveMonotoneX) - }, - 'natural': { - curve: (0, _d3Shape.curveNatural) - }, - 'step': { - curve: (0, _d3Shape.curveStep) - }, - 'step-after': { - curve: (0, _d3Shape.curveStepAfter) - }, - 'step-before': { - curve: (0, _d3Shape.curveStepBefore) - } -}; -function curves(type, orientation, tension) { - var entry = (0, _vegaUtil.hasOwnProperty)(lookup, type) && lookup[type], curve = null; - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) curve = curve[entry.tension](tension); - } - return curve; -} -const paramCounts = { - m: 2, - l: 2, - h: 1, - v: 1, - z: 0, - c: 6, - s: 4, - q: 4, - t: 2, - a: 7 -}; -const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; -const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; -const spacePattern = /^((\s+,?\s*)|(,\s*))/; -const flagPattern = /^[01]/; -function parse(path) { - const commands = []; - const matches = path.match(commandPattern) || []; - matches.forEach((str)=>{ - let cmd = str[0]; - const type = cmd.toLowerCase(); - // parse parameters - const paramCount = paramCounts[type]; - const params = parseParams(type, paramCount, str.slice(1).trim()); - const count = params.length; - // error checking based on parameter count - if (count < paramCount || count && count % paramCount !== 0) throw Error('Invalid SVG path, incorrect parameter count'); - // register the command - commands.push([ - cmd, - ...params.slice(0, paramCount) - ]); - // exit now if we're done, also handles zero-param 'z' - if (count === paramCount) return; - // handle implicit line-to - if (type === 'm') cmd = cmd === 'M' ? 'L' : 'l'; - // repeat command when given extended param list - for(let i = paramCount; i < count; i += paramCount)commands.push([ - cmd, - ...params.slice(i, i + paramCount) - ]); + domClear(el, 1); + return index2 + 1; + } + function recurse(renderer, el, group2, markTypes) { + el = el.lastChild.previousSibling; + let prev, idx = 0; + visit(group2, (item) => { + prev = renderer.mark(el, item, prev, markTypes); + ++idx; }); - return commands; -} -function parseParams(type, paramCount, segment) { - const params = []; - for(let index = 0; paramCount && index < segment.length;)for(let i = 0; i < paramCount; ++i){ - const pattern = type === 'a' && (i === 3 || i === 4) ? flagPattern : numberPattern; - const match = segment.slice(index).match(pattern); - if (match === null) throw Error('Invalid SVG path, incorrect parameter type'); - index += match[0].length; - params.push(+match[0]); - const ws = segment.slice(index).match(spacePattern); - if (ws !== null) index += ws[0].length; - } - return params; -} -const DegToRad = Math.PI / 180; -const Epsilon = 1e-14; -const HalfPi = Math.PI / 2; -const Tau = Math.PI * 2; -const HalfSqrt3 = Math.sqrt(3) / 2; -var segmentCache = {}; -var bezierCache = {}; -var join = [].join; -// Copied from Inkscape svgtopdf, thanks! -function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - const key = join.call(arguments); - if (segmentCache[key]) return segmentCache[key]; - const th = rotateX * DegToRad; - const sin_th = Math.sin(th); - const cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - let pl = px * px / (rx * rx) + py * py / (ry * ry); - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - const a00 = cos_th / rx; - const a01 = sin_th / rx; - const a10 = -sin_th / ry; - const a11 = cos_th / ry; - const x0 = a00 * ox + a01 * oy; - const y0 = a10 * ox + a11 * oy; - const x1 = a00 * x + a01 * y; - const y1 = a10 * x + a11 * y; - const d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - let sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - let sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - const xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - const yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - const th0 = Math.atan2(y0 - yc, x0 - xc); - const th1 = Math.atan2(y1 - yc, x1 - xc); - let th_arc = th1 - th0; - if (th_arc < 0 && sweep === 1) th_arc += Tau; - else if (th_arc > 0 && sweep === 0) th_arc -= Tau; - const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - const result = []; - for(let i = 0; i < segs; ++i){ - const th2 = th0 + i * th_arc / segs; - const th3 = th0 + (i + 1) * th_arc / segs; - result[i] = [ - xc, - yc, - th2, - th3, - rx, - ry, - sin_th, - cos_th - ]; - } - return segmentCache[key] = result; -} -function bezier(params) { - const key = join.call(params); - if (bezierCache[key]) return bezierCache[key]; - var cx = params[0], cy = params[1], th0 = params[2], th1 = params[3], rx = params[4], ry = params[5], sin_th = params[6], cos_th = params[7]; - const a00 = cos_th * rx; - const a01 = -sin_th * ry; - const a10 = sin_th * rx; - const a11 = cos_th * ry; - const cos_th0 = Math.cos(th0); - const sin_th0 = Math.sin(th0); - const cos_th1 = Math.cos(th1); - const sin_th1 = Math.sin(th1); - const th_half = 0.5 * (th1 - th0); - const sin_th_h2 = Math.sin(th_half * 0.5); - const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); - const x1 = cx + cos_th0 - t * sin_th0; - const y1 = cy + sin_th0 + t * cos_th0; - const x3 = cx + cos_th1; - const y3 = cy + sin_th1; - const x2 = x3 + t * sin_th1; - const y2 = y3 - t * cos_th1; - return bezierCache[key] = [ - a00 * x1 + a01 * y1, - a10 * x1 + a11 * y1, - a00 * x2 + a01 * y2, - a10 * x2 + a11 * y2, - a00 * x3 + a01 * y3, - a10 * x3 + a11 * y3 - ]; -} -const temp = [ - 'l', - 0, - 0, - 0, - 0, - 0, - 0, - 0 -]; -function scale$1(current, sX, sY) { - const c = temp[0] = current[0]; - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') temp[1] = sX * current[1]; - else if (c === 'v' || c === 'V') temp[1] = sY * current[1]; - else for(var i = 1, n = current.length; i < n; ++i)temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; - return temp; -} -function pathRender(context, path, l, t, sX, sY) { - var current, // current instruction - previous = null, x = 0, // current x - y = 0, // current y - controlX = 0, // current control point x - controlY = 0, // current control point y - tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; - if (l == null) l = 0; - if (t == null) t = 0; - if (sX == null) sX = 1; - if (sY == null) sY = sX; - if (context.beginPath) context.beginPath(); - for(var i = 0, len = path.length; i < len; ++i){ - current = path[i]; - if (sX !== 1 || sY !== 1) current = scale$1(current, sX, sY); - switch(current[0]){ - // first letter - case 'l': - // lineto, relative - x += current[1]; - y += current[2]; - context.lineTo(x + l, y + t); - break; - case 'L': - // lineto, absolute - x = current[1]; - y = current[2]; - context.lineTo(x + l, y + t); - break; - case 'h': - // horizontal lineto, relative - x += current[1]; - context.lineTo(x + l, y + t); - break; - case 'H': - // horizontal lineto, absolute - x = current[1]; - context.lineTo(x + l, y + t); - break; - case 'v': - // vertical lineto, relative - y += current[1]; - context.lineTo(x + l, y + t); - break; - case 'V': - // verical lineto, absolute - y = current[1]; - context.lineTo(x + l, y + t); - break; - case 'm': - // moveTo, relative - x += current[1]; - y += current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'M': - // moveTo, absolute - x = current[1]; - y = current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'c': - // bezierCurveTo, relative - tempX = x + current[5]; - tempY = y + current[6]; - controlX = x + current[3]; - controlY = y + current[4]; - context.bezierCurveTo(x + current[1] + l, // x1 - y + current[2] + t, // y1 - controlX + l, // x2 - controlY + t, // y2 - tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'C': - // bezierCurveTo, absolute - x = current[5]; - y = current[6]; - controlX = current[3]; - controlY = current[4]; - context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t); - break; - case 's': - // shorthand cubic bezierCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = x + current[1]; - controlY = y + current[2]; - x = tempX; - y = tempY; - break; - case 'S': - // shorthand cubic bezierCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = current[1]; - controlY = current[2]; - break; - case 'q': - // quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - controlX = x + current[1]; - controlY = y + current[2]; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'Q': - // quadraticCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = current[1]; - controlY = current[2]; - break; - case 't': - // shorthand quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[1]; - tempY = y + current[2]; - if (previous[0].match(/[QqTt]/) === null) { - // If there is no previous command or if the previous command was not a Q, q, T or t, - // assume the control point is coincident with the current point - controlX = x; - controlY = y; - } else if (previous[0] === 't') { - // calculate reflection of previous control points for t - controlX = 2 * x - tempControlX; - controlY = 2 * y - tempControlY; - } else if (previous[0] === 'q') { - // calculate reflection of previous control points for q - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - } - tempControlX = controlX; - tempControlY = controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = x + current[1]; - controlY = y + current[2]; - break; - case 'T': - tempX = current[1]; - tempY = current[2]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'a': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + x + l, - current[7] + y + t - ]); - x += current[6]; - y += current[7]; - break; - case 'A': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + l, - current[7] + t - ]); - x = current[6]; - y = current[7]; - break; - case 'z': - case 'Z': - x = anchorX; - y = anchorY; - context.closePath(); - break; - } - previous = current; - } -} -function drawArc(context, x, y, coords) { - const seg = segments(coords[5], // end x - coords[6], // end y - coords[0], // radius x - coords[1], // radius y - coords[3], // large flag - coords[4], // sweep flag - coords[2], // rotation - x, y); - for(let i = 0; i < seg.length; ++i){ - const bez = bezier(seg[i]); - context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); - } -} -const Tan30 = 0.5773502691896257; -const builtins = { - 'circle': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } - }, - 'cross': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); - } - }, - 'diamond': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); - } - }, - 'square': { - draw: function(context, size) { - var w = Math.sqrt(size), x = -w / 2; - context.rect(x, x, w, w); - } - }, - 'arrow': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 7, t = r / 2.5, v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } - }, - 'wedge': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30, b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); - } - }, - 'triangle': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30; - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } - }, - 'triangle-up': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); - } - }, - 'triangle-down': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); + domClear(el, 1 + idx); + } + function bind$1(item, el, sibling, tag, svg) { + let node = item._svg, doc; + if (!node) { + doc = el.ownerDocument; + node = domCreate(doc, tag, svgns); + item._svg = node; + if (item.mark) { + node.__data__ = item; + node.__values__ = { + fill: "default" + }; + if (tag === "g") { + const bg = domCreate(doc, "path", svgns); + node.appendChild(bg); + bg.__data__ = item; + const cg = domCreate(doc, "g", svgns); + node.appendChild(cg); + cg.__data__ = item; + const fg = domCreate(doc, "path", svgns); + node.appendChild(fg); + fg.__data__ = item; + fg.__values__ = { + fill: "default" + }; } + } + } + if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { + el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); + } + return node; + } + function siblingCheck(node, sibling) { + return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; + } + let element$1 = null, values = null; + const mark_extras = { + group(mdef, el, item) { + const fg = element$1 = el.childNodes[2]; + values = fg.__values__; + mdef.foreground(emit, item, this); + values = el.__values__; + element$1 = el.childNodes[1]; + mdef.content(emit, item, this); + const bg = element$1 = el.childNodes[0]; + mdef.background(emit, item, this); + const value2 = item.mark.interactive === false ? "none" : null; + if (value2 !== values.events) { + setAttribute(fg, "pointer-events", value2); + setAttribute(bg, "pointer-events", value2); + values.events = value2; + } + if (item.strokeForeground && item.stroke) { + const fill2 = item.fill; + setAttribute(fg, "display", null); + this.style(bg, item); + setAttribute(bg, "stroke", null); + if (fill2) item.fill = null; + values = fg.__values__; + this.style(fg, item); + if (fill2) item.fill = fill2; + element$1 = null; + } else { + setAttribute(fg, "display", "none"); + } }, - 'triangle-right': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } + image(mdef, el, item) { + if (item.smooth === false) { + setStyle(el, "image-rendering", "optimizeSpeed"); + setStyle(el, "image-rendering", "pixelated"); + } else { + setStyle(el, "image-rendering", null); + } }, - 'triangle-left': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); + text(mdef, el, item) { + const tl2 = textLines(item); + let key2, value2, doc, lh; + if (isArray(tl2)) { + value2 = tl2.map((_) => textValue(item, _)); + key2 = value2.join("\n"); + if (key2 !== values.text) { + domClear(el, 0); + doc = el.ownerDocument; + lh = lineHeight(item); + value2.forEach((t, i) => { + const ts2 = domCreate(doc, "tspan", svgns); + ts2.__data__ = item; + ts2.textContent = t; + if (i) { + ts2.setAttribute("x", 0); + ts2.setAttribute("dy", lh); + } + el.appendChild(ts2); + }); + values.text = key2; + } + } else { + value2 = textValue(item, tl2); + if (value2 !== values.text) { + el.textContent = value2; + values.text = value2; } - }, - 'stroke': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } -}; -function symbols(_) { - return (0, _vegaUtil.hasOwnProperty)(builtins, _) ? builtins[_] : customSymbol(_); -} -var custom = {}; -function customSymbol(path) { - if (!(0, _vegaUtil.hasOwnProperty)(custom, path)) { - const parsed = parse(path); - custom[path] = { - draw: function(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; + } + setAttribute(el, "font-family", fontFamily(item)); + setAttribute(el, "font-size", fontSize(item) + "px"); + setAttribute(el, "font-style", item.fontStyle); + setAttribute(el, "font-variant", item.fontVariant); + setAttribute(el, "font-weight", item.fontWeight); } - return custom[path]; -} -// See http://spencermortensen.com/articles/bezier-circle/ -const C = 0.448084975506; // C = 1 - c -function rectangleX(d) { - return d.x; -} -function rectangleY(d) { - return d.y; -} -function rectangleWidth(d) { - return d.width; -} -function rectangleHeight(d) { - return d.height; -} -function number(_) { - return typeof _ === 'function' ? _ : ()=>+_; -} -function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); -} -function vg_rect() { - var x = rectangleX, y = rectangleY, width = rectangleWidth, height = rectangleHeight, crTL = number(0), crTR = crTL, crBL = crTL, crBR = crTL, context = null; - function rectangle(_, x0, y0) { - var buffer, x1 = x0 != null ? x0 : +x.call(this, _), y1 = y0 != null ? y0 : +y.call(this, _), w = +width.call(this, _), h = +height.call(this, _), s = Math.min(w, h) / 2, tl = clamp(+crTL.call(this, _), 0, s), tr = clamp(+crTR.call(this, _), 0, s), bl = clamp(+crBL.call(this, _), 0, s), br = clamp(+crBR.call(this, _), 0, s); - if (!context) context = buffer = (0, _d3Path.path)(); - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) context.rect(x1, y1, w, h); - else { - var x2 = x1 + w, y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - if (buffer) { - context = null; - return buffer + '' || null; - } - } - rectangle.x = function(_) { - if (arguments.length) { - x = number(_); - return rectangle; - } else return x; - }; - rectangle.y = function(_) { - if (arguments.length) { - y = number(_); - return rectangle; - } else return y; - }; - rectangle.width = function(_) { - if (arguments.length) { - width = number(_); - return rectangle; - } else return width; - }; - rectangle.height = function(_) { - if (arguments.length) { - height = number(_); - return rectangle; - } else return height; - }; - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number(tl); - crTR = tr != null ? number(tr) : crTL; - crBR = br != null ? number(br) : crTL; - crBL = bl != null ? number(bl) : crTR; - return rectangle; - } else return crTL; - }; - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else return context; - }; - return rectangle; -} -function vg_trail() { - var x, y, size, defined, context = null, ready, x1, y1, r1; - function point(x2, y2, w2) { - const r2 = w2 / 2; - if (ready) { - var ux = y1 - y2, uy = x2 - x1; - if (ux || uy) { - // get normal vector - var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else context.arc(x2, y2, r2, 0, Tau); - context.closePath(); - } else ready = 1; - x1 = x2; - y1 = y2; - r1 = r2; - } - function trail(data) { - var i, n = data.length, d, defined0 = false, buffer; - if (context == null) context = buffer = (0, _d3Path.path)(); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - if (buffer) { - context = null; - return buffer + '' || null; - } + }; + function emit(name, value2, ns) { + if (value2 === values[name]) return; + if (ns) { + setAttributeNS(element$1, name, value2, ns); + } else { + setAttribute(element$1, name, value2); } - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else return x; - }; - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else return y; - }; - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else return size; - }; - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else return defined; - }; - trail.context = function(_) { - if (arguments.length) { - if (_ == null) context = null; - else context = _; - return trail; - } else return context; - }; - return trail; -} -function value$1(a, b) { - return a != null ? a : b; -} -const x = (item)=>item.x || 0, y = (item)=>item.y || 0, w = (item)=>item.width || 0, h = (item)=>item.height || 0, xw = (item)=>(item.x || 0) + (item.width || 0), yh = (item)=>(item.y || 0) + (item.height || 0), sa = (item)=>item.startAngle || 0, ea = (item)=>item.endAngle || 0, pa = (item)=>item.padAngle || 0, ir = (item)=>item.innerRadius || 0, or = (item)=>item.outerRadius || 0, cr = (item)=>item.cornerRadius || 0, tl = (item)=>value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item)=>value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item)=>value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item)=>value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item)=>value$1(item.size, 64), ts = (item)=>item.size || 1, def = (item)=>!(item.defined === false), type = (item)=>symbols(item.shape || 'circle'); -const arcShape = (0, _d3Shape.arc)().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = (0, _d3Shape.area)().x(x).y1(y).y0(yh).defined(def), areahShape = (0, _d3Shape.area)().y(y).x1(x).x0(xw).defined(def), lineShape = (0, _d3Shape.line)().x(x).y(y).defined(def), rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = (0, _d3Shape.symbol)().type(type).size(sz), trailShape = vg_trail().x(x).y(y).defined(def).size(ts); -function hasCornerRadius(item) { - return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; -} -function arc$1(context, item) { - return arcShape.context(context)(item); -} -function area$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function line$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); -} -function shape$1(context, item) { - return (item.mark.shape || item.shape).context(context)(item); -} -function symbol$1(context, item) { - return symbolShape.context(context)(item); -} -function trail$1(context, items) { - return trailShape.context(context)(items); -} -var clip_id = 1; -function resetSVGClipId() { - clip_id = 1; -} -function clip$1(renderer, item, size) { - var clip = item.clip, defs = renderer._defs, id = item.clip_id || (item.clip_id = 'clip' + clip_id++), c = defs.clipping[id] || (defs.clipping[id] = { - id: id - }); - if ((0, _vegaUtil.isFunction)(clip)) c.path = clip(null); - else if (hasCornerRadius(size)) c.path = rectangle(null, size, 0, 0); - else { - c.width = size.width || 0; - c.height = size.height || 0; + values[name] = value2; + } + function setStyle(el, name, value2) { + if (value2 !== values[name]) { + if (value2 == null) { + el.style.removeProperty(name); + } else { + el.style.setProperty(name, value2 + ""); + } + values[name] = value2; } - return 'url(#' + id + ')'; -} -function Bounds(b) { - this.clear(); - if (b) this.union(b); -} -Bounds.prototype = { - clone () { - return new Bounds(this); - }, - clear () { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }, - empty () { - return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; - }, - equals (b) { - return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2; - }, - set (x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; + } + function setAttributes(el, attrs) { + for (const key2 in attrs) { + setAttribute(el, key2, attrs[key2]); + } + } + function setAttribute(el, name, value2) { + if (value2 != null) { + el.setAttribute(name, value2); + } else { + el.removeAttribute(name); + } + } + function setAttributeNS(el, name, value2, ns) { + if (value2 != null) { + el.setAttributeNS(ns, name, value2); + } else { + el.removeAttributeNS(ns, name); + } + } + function href() { + let loc; + return typeof window === "undefined" ? "" : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; + } + class SVGStringRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._text = null; + this._defs = { + gradient: {}, + clipping: {} + }; + } + /** + * Returns the rendered SVG text string, + * or null if rendering has not yet occurred. + */ + svg() { + return this._text; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + */ + _render(scene) { + const m2 = markup(); + m2.open("svg", extend({}, metadata, { + class: "marks", + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` + })); + const bg = this._bgcolor; + if (bg && bg !== "transparent" && bg !== "none") { + m2.open("rect", { + width: this._width, + height: this._height, + fill: bg + }).close(); + } + m2.open("g", rootAttributes, { + transform: "translate(" + this._origin + ")" + }); + this.mark(m2, scene); + m2.close(); + this.defs(m2); + this._text = m2.close() + ""; + return this; + } + /** + * Render a set of mark items. + * @param {object} m - The markup context. + * @param {object} scene - The mark parent to render. + */ + mark(m2, scene) { + const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ariaItemAttributes, mdef.attr]; + m2.open("g", { + "class": cssClass(scene), + "clip-path": scene.clip ? clip$1$1(this, scene, scene.group) : null + }, ariaMarkAttributes(scene), { + "pointer-events": tag !== "g" && scene.interactive === false ? "none" : null + }); + const process = (item) => { + const href2 = this.href(item); + if (href2) m2.open("a", href2); + m2.open(tag, this.attr(scene, item, attrList, tag !== "g" ? tag : null)); + if (tag === "text") { + const tl2 = textLines(item); + if (isArray(tl2)) { + const attrs = { + x: 0, + dy: lineHeight(item) + }; + for (let i = 0; i < tl2.length; ++i) { + m2.open("tspan", i ? attrs : null).text(textValue(item, tl2[i])).close(); + } + } else { + m2.text(textValue(item, tl2)); + } + } else if (tag === "g") { + const fore = item.strokeForeground, fill2 = item.fill, stroke2 = item.stroke; + if (fore && stroke2) { + item.stroke = null; + } + m2.open("path", this.attr(scene, item, mdef.background, "bgrect")).close(); + m2.open("g", this.attr(scene, item, mdef.content)); + visit(item, (scene2) => this.mark(m2, scene2)); + m2.close(); + if (fore && stroke2) { + if (fill2) item.fill = null; + item.stroke = stroke2; + m2.open("path", this.attr(scene, item, mdef.foreground, "bgrect")).close(); + if (fill2) item.fill = fill2; + } else { + m2.open("path", this.attr(scene, item, mdef.foreground, "bgfore")).close(); + } + } + m2.close(); + if (href2) m2.close(); + }; + if (mdef.nested) { + if (scene.items && scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + return m2.close(); + } + /** + * Get href attributes for a hyperlinked mark item. + * @param {Item} item - The mark item. + */ + href(item) { + const href2 = item.href; + let attr2; + if (href2) { + if (attr2 = this._hrefs && this._hrefs[href2]) { + return attr2; } else { - this.x1 = x1; - this.x2 = x2; + this.sanitizeURL(href2).then((attr3) => { + attr3["xlink:href"] = attr3.href; + attr3.href = null; + (this._hrefs || (this._hrefs = {}))[href2] = attr3; + }); } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; + } + return null; + } + /** + * Get an object of SVG attributes for a mark item. + * @param {object} scene - The mark parent. + * @param {Item} item - The mark item. + * @param {array|function} attrs - One or more attribute emitters. + * @param {string} tag - The tag being rendered. + */ + attr(scene, item, attrs, tag) { + const object2 = {}, emit2 = (name, value2, ns, prefixed) => { + object2[prefixed || name] = value2; + }; + if (Array.isArray(attrs)) { + attrs.forEach((fn2) => fn2(emit2, item, this)); + } else { + attrs(emit2, item, this); + } + if (tag) { + style(object2, item, scene, tag, this._defs); + } + return object2; + } + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + * @param {object} m - The markup context. + */ + defs(m2) { + const gradient2 = this._defs.gradient, clipping = this._defs.clipping, count2 = Object.keys(gradient2).length + Object.keys(clipping).length; + if (count2 === 0) return; + m2.open("defs"); + for (const id2 in gradient2) { + const def2 = gradient2[id2], stops = def2.stops; + if (def2.gradient === "radial") { + m2.open("pattern", { + id: patternPrefix + id2, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + m2.open("rect", { + width: "1", + height: "1", + fill: "url(#" + id2 + ")" + }).close(); + m2.close(); + m2.open("radialGradient", { + id: id2, + fx: def2.x1, + fy: def2.y1, + fr: def2.r1, + cx: def2.x2, + cy: def2.y2, + r: def2.r2 + }); + } else { + m2.open("linearGradient", { + id: id2, + x1: def2.x1, + x2: def2.x2, + y1: def2.y1, + y2: def2.y2 + }); + } + for (let i = 0; i < stops.length; ++i) { + m2.open("stop", { + offset: stops[i].offset, + "stop-color": stops[i].color + }).close(); + } + m2.close(); + } + for (const id2 in clipping) { + const def2 = clipping[id2]; + m2.open("clipPath", { + id: id2 + }); + if (def2.path) { + m2.open("path", { + d: def2.path + }).close(); } else { - this.y1 = y1; - this.y2 = y2; + m2.open("rect", { + x: 0, + y: 0, + width: def2.width, + height: def2.height + }).close(); } - return this; - }, - add (x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }, - expand (d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }, - round () { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }, - scale (s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }, - translate (dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }, - rotate (angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); - }, - rotatedPoints (angle, x, y) { - var { x1, y1, x2, y2 } = this, cos = Math.cos(angle), sin = Math.sin(angle), cx = x - x * cos + y * sin, cy = y - x * sin - y * cos; - return [ - cos * x1 - sin * y1 + cx, - sin * x1 + cos * y1 + cy, - cos * x1 - sin * y2 + cx, - sin * x1 + cos * y2 + cy, - cos * x2 - sin * y1 + cx, - sin * x2 + cos * y1 + cy, - cos * x2 - sin * y2 + cx, - sin * x2 + cos * y2 + cy - ]; - }, - union (b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }, - intersect (b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }, - encloses (b) { - return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2; - }, - alignsWith (b) { - return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2); - }, - intersects (b) { - return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2); - }, - contains (x, y) { - return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2); - }, - width () { - return this.x2 - this.x1; - }, - height () { - return this.y2 - this.y1; + m2.close(); + } + m2.close(); } -}; -function Item(mark) { - this.mark = mark; - this.bounds = this.bounds || new Bounds(); -} -function GroupItem(mark) { - Item.call(this, mark); - this.items = this.items || []; -} -(0, _vegaUtil.inherits)(GroupItem, Item); -class ResourceLoader { - constructor(customLoader){ - this._pending = 0; - this._loader = customLoader || (0, _vegaLoader.loader)(); + } + function style(s2, item, scene, tag, defs) { + let styleList; + if (item == null) return s2; + if (tag === "bgrect" && scene.interactive === false) { + s2["pointer-events"] = "none"; } - pending() { - return this._pending; + if (tag === "bgfore") { + if (scene.interactive === false) { + s2["pointer-events"] = "none"; + } + s2.display = "none"; + if (item.fill !== null) return s2; + } + if (tag === "image" && item.smooth === false) { + styleList = ["image-rendering: optimizeSpeed;", "image-rendering: pixelated;"]; + } + if (tag === "text") { + s2["font-family"] = fontFamily(item); + s2["font-size"] = fontSize(item) + "px"; + s2["font-style"] = item.fontStyle; + s2["font-variant"] = item.fontVariant; + s2["font-weight"] = item.fontWeight; + } + for (const prop in stylesAttr) { + let value2 = item[prop]; + const name = stylesAttr[prop]; + if (value2 === "transparent" && (name === "fill" || name === "stroke")) ; + else if (value2 != null) { + if (isGradient(value2)) { + value2 = gradientRef(value2, defs.gradient, ""); + } + s2[name] = value2; + } } - sanitizeURL(uri) { - const loader = this; - increment(loader); - return loader._loader.sanitize(uri, { - context: 'href' - }).then((opt)=>{ - decrement(loader); - return opt; - }).catch(()=>{ - decrement(loader); - return null; - }); + for (const prop in stylesCss) { + const value2 = item[prop]; + if (value2 != null) { + styleList = styleList || []; + styleList.push(`${stylesCss[prop]}: ${value2};`); + } } - loadImage(uri) { - const loader = this, Image = (0, _vegaCanvas.image)(); - increment(loader); - return loader._loader.sanitize(uri, { - context: 'image' - }).then((opt)=>{ - const url = opt.href; - if (!url || !Image) throw { - url: url - }; - const img = new Image(); - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = (0, _vegaUtil.hasOwnProperty)(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - // attempt to load image resource - img.onload = ()=>decrement(loader); - img.onerror = ()=>decrement(loader); - img.src = url; - return img; - }).catch((e)=>{ - decrement(loader); - return { - complete: false, - width: 0, - height: 0, - src: e && e.url || '' - }; - }); + if (styleList) { + s2.style = styleList.join(" "); } - ready() { - const loader = this; - return new Promise((accept)=>{ - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(()=>{ - poll(true); - }, 10); - } - poll(false); - }); + return s2; + } + const OPTS = { + svgMarkTypes: ["text"], + svgOnTop: true, + debug: false + }; + function setHybridRendererOptions(options2) { + OPTS["svgMarkTypes"] = options2.svgMarkTypes ?? ["text"]; + OPTS["svgOnTop"] = options2.svgOnTop ?? true; + OPTS["debug"] = options2.debug ?? false; + } + class HybridRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._svgRenderer = new SVGRenderer(loader2); + this._canvasRenderer = new CanvasRenderer(loader2); } -} -function increment(loader) { - loader._pending += 1; -} -function decrement(loader) { - loader._pending -= 1; -} -function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; -} -function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; -} -const circleThreshold = Tau - 1e-8; -let bounds, lx, ly, rot, ma, mb, mc, md; -const add = (x, y)=>bounds.add(x, y); -const addL = (x, y)=>add(lx = x, ly = y); -const addX = (x)=>add(x, bounds.y1); -const addY = (y)=>add(bounds.x1, y); -const px = (x, y)=>ma * x + mc * y; -const py = (x, y)=>mb * x + md * y; -const addp = (x, y)=>add(px(x, y), py(x, y)); -const addpL = (x, y)=>addL(px(x, y), py(x, y)); -function boundContext(_, deg) { - bounds = _; - if (deg) { - rot = deg * DegToRad; - ma = md = Math.cos(rot); - mb = Math.sin(rot); - mc = -mb; + /** + * Initialize a new HybridRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {HybridRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._root_el = domChild(el, 0, "div"); + const bottomEl = domChild(this._root_el, 0, "div"); + const topEl = domChild(this._root_el, 1, "div"); + this._root_el.style.position = "relative"; + if (!OPTS.debug) { + bottomEl.style.height = "100%"; + topEl.style.position = "absolute"; + topEl.style.top = "0"; + topEl.style.left = "0"; + topEl.style.height = "100%"; + topEl.style.width = "100%"; + } + this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; + this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; + this._svgEl.style.pointerEvents = "none"; + this._canvasRenderer.initialize(this._canvasEl, width2, height2, origin, scaleFactor); + this._svgRenderer.initialize(this._svgEl, width2, height2, origin, scaleFactor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (OPTS.svgMarkTypes.includes(item.mark.marktype)) { + this._svgRenderer.dirty(item); + } else { + this._canvasRenderer.dirty(item); + } + return this; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + const allMarkTypes = markTypes ?? ["arc", "area", "image", "line", "path", "rect", "rule", "shape", "symbol", "text", "trail"]; + const canvasMarkTypes = allMarkTypes.filter((m2) => !OPTS.svgMarkTypes.includes(m2)); + this._svgRenderer.render(scene, OPTS.svgMarkTypes); + this._canvasRenderer.render(scene, canvasMarkTypes); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + this._svgRenderer.resize(width2, height2, origin, scaleFactor); + this._canvasRenderer.resize(width2, height2, origin, scaleFactor); + return this; + } + background(bgcolor) { + if (OPTS.svgOnTop) { + this._canvasRenderer.background(bgcolor); + } else { + this._svgRenderer.background(bgcolor); + } + return this; + } + } + class HybridHandler extends CanvasHandler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + } + initialize(el, origin, obj2) { + const canvas = domChild(domChild(el, 0, "div"), OPTS.svgOnTop ? 0 : 1, "div"); + return super.initialize(canvas, origin, obj2); + } + } + const Canvas = "canvas"; + const Hybrid = "hybrid"; + const PNG = "png"; + const SVG = "svg"; + const None$1 = "none"; + const RenderType = { + Canvas, + PNG, + SVG, + Hybrid, + None: None$1 + }; + const modules = {}; + modules[Canvas] = modules[PNG] = { + renderer: CanvasRenderer, + headless: CanvasRenderer, + handler: CanvasHandler + }; + modules[SVG] = { + renderer: SVGRenderer, + headless: SVGStringRenderer, + handler: SVGHandler + }; + modules[Hybrid] = { + renderer: HybridRenderer, + headless: HybridRenderer, + handler: HybridHandler + }; + modules[None$1] = {}; + function renderModule(name, _) { + name = String(name || "").toLowerCase(); + if (arguments.length > 1) { + modules[name] = _; + return this; } else { - ma = md = 1; - rot = mb = mc = 0; + return modules[name]; } - return context$1; -} -const context$1 = { - beginPath () {}, - closePath () {}, - moveTo: addpL, - lineTo: addpL, - rect (x, y, w, h) { - if (rot) { - addp(x + w, y); - addp(x + w, y + h); - addp(x, y + h); - addpL(x, y); - } else { - add(x + w, y + h); - addL(x, y); - } - }, - quadraticCurveTo (x1, y1, x2, y2) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2); - quadExtrema(lx, px1, px2, addX); - quadExtrema(ly, py1, py2, addY); - addL(px2, py2); - }, - bezierCurveTo (x1, y1, x2, y2, x3, y3) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); - cubicExtrema(lx, px1, px2, px3, addX); - cubicExtrema(ly, py1, py2, py3, addY); - addL(px3, py3); - }, - arc (cx, cy, r, sa, ea, ccw) { - sa += rot; - ea += rot; - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add(cx - r, cy - r); - add(cx + r, cy + r); - } else { - const update = (a)=>add(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - // sample end points - update(sa); - update(ea); - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; - if (sa < 0) sa += Tau; - ea = ea % Tau; - if (ea < 0) ea += Tau; - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; - sa = ea; - ea = s; // swap end-points - } - if (ccw) { - ea -= Tau; - s = sa - sa % HalfPi; - for(i = 0; i < 4 && s > ea; ++i, s -= HalfPi)update(s); - } else { - s = sa - sa % HalfPi + HalfPi; - for(i = 0; i < 4 && s < ea; ++i, s = s + HalfPi)update(s); - } - } + } + function intersect$2(scene, bounds2, filter2) { + const hits = [], box2 = new Bounds().union(bounds2), type2 = scene.marktype; + return type2 ? intersectMark(scene, box2, filter2, hits) : type2 === "group" ? intersectGroup(scene, box2, filter2, hits) : error("Intersect scene must be mark node or group item."); + } + function intersectMark(mark, box2, filter2, hits) { + if (visitMark(mark, box2, filter2)) { + const items = mark.items, type2 = mark.marktype, n = items.length; + let i = 0; + if (type2 === "group") { + for (; i < n; ++i) { + intersectGroup(items[i], box2, filter2, hits); + } + } else { + for (const test2 = Marks[type2].isect; i < n; ++i) { + const item = items[i]; + if (intersectItem(item, box2, test2)) hits.push(item); } + } } -}; -function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); -} -function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, b = x0 + x2 - 2 * x1, c = x0 - x1; - let t0 = 0, t1 = 0, r; - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else // linear equation - t0 = 0.5 * c / b; - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); -} -function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3; -} -var context = (context = (0, _vegaCanvas.canvas)(1, 1)) ? context.getContext('2d') : null; -const b = new Bounds(); -function intersectPath(draw) { - return function(item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context) return true; - // add path to offscreen graphics context - draw(context, item); - // get bounds intersection region - b.clear().union(item.bounds).intersect(brush).round(); - const { x1, y1, x2, y2 } = b; - // iterate over intersection region - // perform fine grained inclusion test - for(let y = y1; y <= y2; ++y)for(let x = x1; x <= x2; ++x){ - if (context.isPointInPath(x, y)) return true; - } - // false if no hits in intersection region - return false; - }; -} -function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); -} -function intersectRect(item, box) { - const x = item.x || 0, y = item.y || 0, w = item.width || 0, h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); -} -function intersectRule(item, box) { - const x = item.x || 0, y = item.y || 0, x2 = item.x2 != null ? item.x2 : x, y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); -} -function intersectBoxLine(box, x, y, u, v) { - const { x1, y1, x2, y2 } = box, dx = u - x, dy = v - y; - let t0 = 0, t1 = 1, p, q, r, e; - for(e = 0; e < 4; ++e){ - if (e === 0) { - p = -dx; - q = -(x1 - x); - } - if (e === 1) { - p = dx; - q = x2 - x; - } - if (e === 2) { - p = -dy; - q = -(y1 - y); - } - if (e === 3) { - p = dy; - q = y2 - y; - } - if (Math.abs(p) < 1e-10 && q < 0) return false; - r = q / p; - if (p < 0) { - if (r > t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } + return hits; + } + function visitMark(mark, box2, filter2) { + return mark.bounds && box2.intersects(mark.bounds) && (mark.marktype === "group" || mark.interactive !== false && (!filter2 || filter2(mark))); + } + function intersectGroup(group2, box2, filter2, hits) { + if (filter2 && filter2(group2.mark) && intersectItem(group2, box2, Marks.group.isect)) { + hits.push(group2); } - return true; -} -function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; -} -function value(value, dflt) { - return value == null ? dflt : value; -} -function addStops(gradient, stops) { - const n = stops.length; - for(let i = 0; i < n; ++i)gradient.addColorStop(stops[i].offset, stops[i].color); - return gradient; -} -function gradient(context, spec, bounds) { - const w = bounds.width(), h = bounds.height(); - let gradient; - if (spec.gradient === 'radial') gradient = context.createRadialGradient(bounds.x1 + value(spec.x1, 0.5) * w, bounds.y1 + value(spec.y1, 0.5) * h, Math.max(w, h) * value(spec.r1, 0), bounds.x1 + value(spec.x2, 0.5) * w, bounds.y1 + value(spec.y2, 0.5) * h, Math.max(w, h) * value(spec.r2, 0.5)); - else { - // linear gradient - const x1 = value(spec.x1, 0), y1 = value(spec.y1, 0), x2 = value(spec.x2, 1), y2 = value(spec.y2, 0); - if (x1 === x2 || y1 === y2 || w === h) // axis aligned: use normal gradient - gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h); - else { - // not axis aligned: render gradient into a pattern (#2365) - // this allows us to use normalized bounding box coordinates - const image = (0, _vegaCanvas.canvas)(Math.ceil(w), Math.ceil(h)), ictx = image.getContext('2d'); - ictx.scale(w, h); - ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops); - ictx.fillRect(0, 0, w, h); - return context.createPattern(image, 'no-repeat'); - } - } - return addStops(gradient, spec.stops); -} -function color(context, item, value) { - return isGradient(value) ? gradient(context, value, item.bounds) : value; -} -function fill(context, item, opacity) { - opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else return false; -} -var Empty = []; -function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - if (lw <= 0) return false; - opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty); - context.lineDashOffset = item.strokeDashOffset || 0; - } - return true; - } else return false; -} -function compare(a, b) { - return a.zindex - b.zindex || a.index - b.index; -} -function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - var items = scene.items, output = [], item, i, n; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - item.index = i; - if (item.zindex) output.push(item); + const marks = group2.items, n = marks && marks.length; + if (n) { + const x2 = group2.x || 0, y2 = group2.y || 0; + box2.translate(-x2, -y2); + for (let i = 0; i < n; ++i) { + intersectMark(marks[i], box2, filter2, hits); + } + box2.translate(x2, y2); } - scene.zdirty = false; - return scene.zitems = output.sort(compare); -} -function visit(scene, visitor) { - var items = scene.items, i, n; - if (!items || !items.length) return; - const zitems = zorder(scene); - if (zitems && zitems.length) { - for(i = 0, n = items.length; i < n; ++i)if (!items[i].zindex) visitor(items[i]); - items = zitems; + return hits; + } + function intersectItem(item, box2, test2) { + const bounds2 = item.bounds; + return box2.encloses(bounds2) || box2.intersects(bounds2) && test2(item, box2); + } + const clipBounds = new Bounds(); + function boundClip(mark) { + const clip2 = mark.clip; + if (isFunction(clip2)) { + clip2(boundContext(clipBounds.clear())); + } else if (clip2) { + clipBounds.set(0, 0, mark.group.width, mark.group.height); + } else return; + mark.bounds.intersect(clipBounds); + } + const TOLERANCE = 1e-9; + function sceneEqual(a2, b2, key2) { + return a2 === b2 ? true : key2 === "path" ? pathEqual(a2, b2) : a2 instanceof Date && b2 instanceof Date ? +a2 === +b2 : isNumber$1(a2) && isNumber$1(b2) ? Math.abs(a2 - b2) <= TOLERANCE : !a2 || !b2 || !isObject(a2) && !isObject(b2) ? a2 == b2 : objectEqual(a2, b2); + } + function pathEqual(a2, b2) { + return sceneEqual(parse$3(a2), parse$3(b2)); + } + function objectEqual(a2, b2) { + var ka = Object.keys(a2), kb = Object.keys(b2), key2, i; + if (ka.length !== kb.length) return false; + ka.sort(); + kb.sort(); + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) return false; } - for(i = 0, n = items.length; i < n; ++i)visitor(items[i]); -} -function pickVisit(scene, visitor) { - var items = scene.items, hit, i; - if (!items || !items.length) return null; - const zitems = zorder(scene); - if (zitems && zitems.length) items = zitems; - for(i = items.length; --i >= 0;){ - if (hit = visitor(items[i])) return hit; + for (i = ka.length - 1; i >= 0; i--) { + key2 = ka[i]; + if (!sceneEqual(a2[key2], b2[key2], key2)) return false; } - if (items === zitems) { - for(items = scene.items, i = items.length; --i >= 0;)if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; + return typeof a2 === typeof b2; + } + function resetSVGDefIds() { + resetSVGClipId(); + resetSVGGradientId(); + } + const Top$1 = "top"; + const Left$1 = "left"; + const Right$1 = "right"; + const Bottom$1 = "bottom"; + const TopLeft = "top-left"; + const TopRight = "top-right"; + const BottomLeft = "bottom-left"; + const BottomRight = "bottom-right"; + const Start$1 = "start"; + const Middle$1 = "middle"; + const End$1 = "end"; + const X = "x"; + const Y = "y"; + const Group = "group"; + const AxisRole$1 = "axis"; + const TitleRole$1 = "title"; + const FrameRole$1 = "frame"; + const ScopeRole$1 = "scope"; + const LegendRole$1 = "legend"; + const RowHeader = "row-header"; + const RowFooter = "row-footer"; + const RowTitle = "row-title"; + const ColHeader = "column-header"; + const ColFooter = "column-footer"; + const ColTitle = "column-title"; + const Padding$1 = "padding"; + const Symbols$1 = "symbol"; + const Fit = "fit"; + const FitX = "fit-x"; + const FitY = "fit-y"; + const Pad = "pad"; + const None = "none"; + const All = "all"; + const Each = "each"; + const Flush = "flush"; + const Column = "column"; + const Row = "row"; + function Bound$1(params2) { + Transform.call(this, null, params2); + } + inherits(Bound$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow, mark = _.mark, type2 = mark.marktype, entry2 = Marks[type2], bound2 = entry2.bound; + let markBounds = mark.bounds, rebound; + if (entry2.nested) { + if (mark.items.length) view.dirty(mark.items[0]); + markBounds = boundItem(mark, bound2); + mark.items.forEach((item) => { + item.bounds.clear().union(markBounds); + }); + } else if (type2 === Group || _.modified()) { + pulse2.visit(pulse2.MOD, (item) => view.dirty(item)); + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(boundItem(item, bound2))); + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + pulse2.reflow(); + } + } else { + rebound = pulse2.changed(pulse2.REM); + pulse2.visit(pulse2.ADD, (item) => { + markBounds.union(boundItem(item, bound2)); + }); + pulse2.visit(pulse2.MOD, (item) => { + rebound = rebound || markBounds.alignsWith(item.bounds); + view.dirty(item); + markBounds.union(boundItem(item, bound2)); + }); + if (rebound) { + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(item.bounds)); } + } + boundClip(mark); + return pulse2.modifies("bounds"); + } + }); + function boundItem(item, bound2, opt) { + return bound2(item.bounds.clear(), item, opt); + } + const COUNTER_NAME = ":vega_identifier:"; + function Identifier$1(params2) { + Transform.call(this, 0, params2); + } + Identifier$1.Definition = { + "type": "Identifier", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "as", + "type": "string", + "required": true + }] + }; + inherits(Identifier$1, Transform, { + transform(_, pulse2) { + const counter = getCounter(pulse2.dataflow), as = _.as; + let id2 = counter.value; + pulse2.visit(pulse2.ADD, (t) => t[as] = t[as] || ++id2); + counter.set(this.value = id2); + return pulse2; + } + }); + function getCounter(view) { + return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); + } + function Mark$1(params2) { + Transform.call(this, null, params2); + } + inherits(Mark$1, Transform, { + transform(_, pulse2) { + let mark = this.value; + if (!mark) { + mark = pulse2.dataflow.scenegraph().mark(_.markdef, lookup$1$1(_), _.index); + mark.group.context = _.context; + if (!_.context.group) _.context.group = mark.group; + mark.source = this.source; + mark.clip = _.clip; + mark.interactive = _.interactive; + this.value = mark; + } + const Init = mark.marktype === Group ? GroupItem : Item; + pulse2.visit(pulse2.ADD, (item) => Init.call(item, mark)); + if (_.modified("clip") || _.modified("interactive")) { + mark.clip = _.clip; + mark.interactive = !!_.interactive; + mark.zdirty = true; + pulse2.reflow(); + } + mark.items = pulse2.source; + return pulse2; } - return null; -} -function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, (item)=>{ - if (!bounds || bounds.intersects(item.bounds)) drawPath(path, context, item, item); - }); - }; -} -function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) drawPath(path, context, scene.items[0], scene.items); - }; -} -function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - if (path(context, items)) return; - blend(context, item); - if (item.fill && fill(context, item, opacity)) context.fill(); - if (item.stroke && stroke(context, item, opacity)) context.stroke(); -} -function pick$1(test) { - test = test || (0, _vegaUtil.truthy); - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - return pickVisit(scene, (item)=>{ - const b = item.bounds; - // first hit test against bounding box - if (b && !b.contains(gx, gy) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; - }); - }; -} -function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, fill = filled == null ? item.fill : filled, stroke = item.stroke && context.isPointInStroke, lw, lc; - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y); - }; -} -function pickPath(path) { - return pick$1(hitPath(path)); -} -function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} -function rotate(a) { - return 'rotate(' + a + ')'; -} -function scale(scaleX, scaleY) { - return 'scale(' + scaleX + ',' + scaleY + ')'; -} -function translateItem(item) { - return translate(item.x || 0, item.y || 0); -} -function rotateItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : ''); -} -function transformItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : ''); -} -function markItemPath(type, shape, isect) { - function attr(emit, item) { - emit('transform', rotateItem(item)); - emit('d', shape(null, item)); - } - function bound(bounds, item) { - shape(boundContext(bounds, item.angle), item); - return boundStroke(bounds, item).translate(item.x || 0, item.y || 0); - } - function draw(context, item) { - var x = item.x || 0, y = item.y || 0, a = item.angle || 0; - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); + }); + function lookup$1$1(_) { + const g = _.groups, p = _.parent; + return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; + } + function Overlap$1(params2) { + Transform.call(this, null, params2); + } + const methods = { + parity: (items) => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1), + greedy: (items, sep) => { + let a2; + return items.filter((b2, i) => !i || !intersect$1(a2.bounds, b2.bounds, sep) ? (a2 = b2, 1) : b2.opacity = 0); } - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; -} -var arc = markItemPath('arc', arc$1); -function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], z = a[0].orient === 'horizontal' ? 'y' : 'x', i = a.length, min = Infinity, hit, d; - while(--i >= 0){ - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - return hit; -} -function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; + }; + const intersect$1 = (a2, b2, sep) => sep > Math.max(b2.x1 - a2.x2, a2.x1 - b2.x2, b2.y1 - a2.y2, a2.y1 - b2.y2); + const hasOverlap = (items, pad2) => { + for (var i = 1, n = items.length, a2 = items[0].bounds, b2; i < n; a2 = b2, ++i) { + if (intersect$1(a2, b2 = items[i].bounds, pad2)) return true; } - return null; -} -function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx * dx) return a[i]; + }; + const hasBounds = (item) => { + const b2 = item.bounds; + return b2.width() > 1 && b2.height() > 1; + }; + const boundTest = (scale2, orient, tolerance) => { + var range2 = scale2.range(), b2 = new Bounds(); + if (orient === Top$1 || orient === Bottom$1) { + b2.set(range2[0], -Infinity, range2[1], Infinity); + } else { + b2.set(-Infinity, range2[0], Infinity, range2[1]); } - return null; -} -function markMultiItemPath(type, shape, tip) { - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) return bounds; - else { - shape(boundContext(bounds), items); - return boundStroke(bounds, items[0]); + b2.expand(tolerance || 1); + return (item) => b2.encloses(item.bounds); + }; + const reset = (source2) => { + source2.forEach((item) => item.opacity = 1); + return source2; + }; + const reflow = (pulse2, _) => pulse2.reflow(_.modified()).modifies("opacity"); + inherits(Overlap$1, Transform, { + transform(_, pulse2) { + const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; + let source2 = pulse2.materialize(pulse2.SOURCE).source, items, test2; + if (!source2 || !source2.length) return; + if (!_.method) { + if (_.modified("method")) { + reset(source2); + pulse2 = reflow(pulse2, _); + } + return pulse2; + } + source2 = source2.filter(hasBounds); + if (!source2.length) return; + if (_.sort) { + source2 = source2.slice().sort(_.sort); + } + items = reset(source2); + pulse2 = reflow(pulse2, _); + if (items.length >= 3 && hasOverlap(items, sep)) { + do { + items = reduce(items, sep); + } while (items.length >= 3 && hasOverlap(items, sep)); + if (items.length < 3 && !peek$1(source2).opacity) { + if (items.length > 1) peek$1(items).opacity = 0; + peek$1(source2).opacity = 1; } + } + if (_.boundScale && _.boundTolerance >= 0) { + test2 = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); + source2.forEach((item) => { + if (!test2(item)) item.opacity = 0; + }); + } + const bounds2 = items[0].mark.bounds.clear(); + source2.forEach((item) => { + if (item.opacity) bounds2.union(item.bounds); + }); + return pulse2; } - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - const hit = hitPath(draw); - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, b = scene.bounds; - if (!items || !items.length || b && !b.contains(gx, gy)) return null; - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; + }); + function Render$1(params2) { + Transform.call(this, null, params2); + } + inherits(Render$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + pulse2.visit(pulse2.ALL, (item) => view.dirty(item)); + if (pulse2.fields && pulse2.fields["zindex"]) { + const item = pulse2.source && pulse2.source[0]; + if (item) item.mark.zdirty = true; + } } - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; -} -var area = markMultiItemPath('area', area$1, pickArea); -function clip(context, scene) { - var clip = scene.clip; - context.save(); - if ((0, _vegaUtil.isFunction)(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else clipGroup(context, scene.group); -} -function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); -} -function offset$1(item) { - const sw = value(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; -} -function attr$5(emit, item) { - emit('transform', translateItem(item)); -} -function emitRectangle(emit, item) { - const off = offset$1(item); - emit('d', rectangle(null, item, off, off)); -} -function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); -} -function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) emitRectangle(emit, item); - else emit('d', ''); -} -function content(emit, item, renderer) { - const url = item.clip ? clip$1(renderer, item, item) : null; - emit('clip-path', url); -} -function bound$5(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for(let j = 0; j < m; ++j)bounds.union(items[j].bounds); - } - if ((group.clip || group.width || group.height) && !group.noBound) bounds.add(0, 0).add(group.width || 0, group.height || 0); - boundStroke(bounds, group); - return bounds.translate(group.x || 0, group.y || 0); -} -function rectanglePath(context, group, x, y) { - const off = offset$1(group); - context.beginPath(); - rectangle(context, group, (x || 0) + off, (y || 0) + off); -} -const hitBackground = hitPath(rectanglePath); -const hitForeground = hitPath(rectanglePath, false); -const hitCorner = hitPath(rectanglePath, true); -function draw$4(context, scene, bounds, markTypes) { - visit(scene, (group)=>{ - const gx = group.x || 0, gy = group.y || 0, fore = group.strokeForeground, opacity = group.opacity == null ? 1 : group.opacity; - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) context.fill(); - if (group.stroke && !fore && stroke(context, group, opacity)) context.stroke(); - } - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - // draw group contents - visit(group, (item)=>{ - if (item.marktype === 'group' || markTypes == null || markTypes.includes(item.marktype)) this.draw(context, item, bounds, markTypes); - }); - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) context.stroke(); - } - }); -} -function pick(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) return null; - const cx = x * context.pixelRatio, cy = y * context.pixelRatio; - return pickVisit(scene, (group)=>{ - let hit, dx, dy; - // first hit test bounding box - const b = group.bounds; - if (b && !b.contains(gx, gy)) return; - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - const dw = dx + (group.width || 0), dh = dy + (group.height || 0), c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitCorner(context, group, cx, cy)) { - context.restore(); - return null; + }); + const tempBounds = new Bounds(); + function set$2(item, property2, value2) { + return item[property2] === value2 ? 0 : (item[property2] = value2, 1); + } + function isYAxis(mark) { + var orient = mark.items[0].orient; + return orient === Left$1 || orient === Right$1; + } + function axisIndices(datum2) { + let index2 = +datum2.grid; + return [ + datum2.ticks ? index2++ : -1, + // ticks index + datum2.labels ? index2++ : -1, + // labels index + index2 + +datum2.domain + // title index + ]; + } + function axisLayout(view, axis, width2, height2) { + var item = axis.items[0], datum2 = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum2), range2 = item.range, offset2 = item.offset, position2 = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum2.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds2 = item.bounds, dl = title && multiLineOffset(title), x2 = 0, y2 = 0, i, s2; + tempBounds.clear().union(bounds2); + bounds2.clear(); + if ((i = indices[0]) > -1) bounds2.union(item.items[i].bounds); + if ((i = indices[1]) > -1) bounds2.union(item.items[i].bounds); + switch (orient) { + case Top$1: + x2 = position2 || 0; + y2 = -offset2; + s2 = Math.max(minExtent, Math.min(maxExtent, -bounds2.y1)); + bounds2.add(0, -s2).add(range2, 0); + if (title) axisTitleLayout(view, title, s2, titlePadding, dl, 0, -1, bounds2); + break; + case Left$1: + x2 = -offset2; + y2 = position2 || 0; + s2 = Math.max(minExtent, Math.min(maxExtent, -bounds2.x1)); + bounds2.add(-s2, 0).add(0, range2); + if (title) axisTitleLayout(view, title, s2, titlePadding, dl, 1, -1, bounds2); + break; + case Right$1: + x2 = width2 + offset2; + y2 = position2 || 0; + s2 = Math.max(minExtent, Math.min(maxExtent, bounds2.x2)); + bounds2.add(0, 0).add(s2, range2); + if (title) axisTitleLayout(view, title, s2, titlePadding, dl, 1, 1, bounds2); + break; + case Bottom$1: + x2 = position2 || 0; + y2 = height2 + offset2; + s2 = Math.max(minExtent, Math.min(maxExtent, bounds2.y2)); + bounds2.add(0, 0).add(range2, s2); + if (title) axisTitleLayout(view, title, s2, titlePadding, 0, 0, 1, bounds2); + break; + default: + x2 = item.x; + y2 = item.y; + } + boundStroke(bounds2.translate(x2, y2), item); + if (set$2(item, "x", x2 + delta) | set$2(item, "y", y2 + delta)) { + item.bounds = tempBounds; + view.dirty(item); + item.bounds = bounds2; + view.dirty(item); + } + return item.mark.bounds.clear().union(bounds2); + } + function axisTitleLayout(view, title, offset2, pad2, dl, isYAxis2, sign2, bounds2) { + const b2 = title.bounds; + if (title.auto) { + const v = sign2 * (offset2 + dl + pad2); + let dx = 0, dy = 0; + view.dirty(title); + isYAxis2 ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); + title.mark.bounds.clear().union(b2.translate(-dx, -dy)); + view.dirty(title); + } + bounds2.union(b2); + } + const min = (a2, b2) => Math.floor(Math.min(a2, b2)); + const max = (a2, b2) => Math.ceil(Math.max(a2, b2)); + function gridLayoutGroups(group2) { + var groups = group2.items, n = groups.length, i = 0, mark, items; + const views = { + marks: [], + rowheaders: [], + rowfooters: [], + colheaders: [], + colfooters: [], + rowtitle: null, + coltitle: null + }; + for (; i < n; ++i) { + mark = groups[i]; + items = mark.items; + if (mark.marktype === Group) { + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + break; + case RowHeader: + views.rowheaders.push(...items); + break; + case RowFooter: + views.rowfooters.push(...items); + break; + case ColHeader: + views.colheaders.push(...items); + break; + case ColFooter: + views.colfooters.push(...items); + break; + case RowTitle: + views.rowtitle = items[0]; + break; + case ColTitle: + views.coltitle = items[0]; + break; + default: + views.marks.push(...items); } - const fore = group.strokeForeground, ix = scene.interactive !== false; - // hit test against group foreground - if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - // hit test against contained marks - hit = pickVisit(group, (mark)=>pickMark(mark, dx, dy) ? this.pick(mark, x, y, dx, dy) : null); - // hit test against group background - if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) hit = group; - // restore state and return - context.restore(); - return hit || null; - }); -} -function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y); -} -var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr$5, - bound: bound$5, - draw: draw$4, - pick: pick, - isect: intersectRect, - content: content, - background: background, - foreground: foreground -}; -var metadata = { - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink', - 'version': '1.1' -}; -function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = { - complete: false, - width: 0, - height: 0 - }; - renderer.loadImage(item.url).then((image)=>{ - item.image = image; - item.image.url = item.url; - }); + } } - return image; -} -function imageWidth(item, image) { - return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width; -} -function imageHeight(item, image) { - return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height; -} -function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; -} -function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; -} -function attr$4(emit, item, renderer) { - const img = getImage(item, renderer), w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); -} -function bound$4(bounds, item) { - const img = item.image, w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h); - return bounds.set(x, y, x + w, y + h); -} -function draw$3(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - const img = getImage(item, this); - let w = imageWidth(item, img); - let h = imageHeight(item, img); - if (w === 0 || h === 0) return; // early exit - let x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), opacity, ar0, ar1, t; - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } + return views; + } + function bboxFlush(item) { + return new Bounds().set(0, 0, item.width || 0, item.height || 0); + } + function bboxFull(item) { + const b2 = item.bounds.clone(); + return b2.empty() ? b2.set(0, 0, 0, 0) : b2.translate(-(item.x || 0), -(item.y || 0)); + } + function get$1(opt, key2, d2) { + const v = isObject(opt) ? opt[key2] : opt; + return v != null ? v : d2 !== void 0 ? d2 : 0; + } + function offsetValue$1(v) { + return v < 0 ? Math.ceil(-v) : 0; + } + function gridLayout(view, groups, opt) { + var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds2 = tempBounds.set(0, 0, 0, 0), alignCol = get$1(opt.align, Column), alignRow = get$1(opt.align, Row), padCol = get$1(opt.padding, Column), padRow = get$1(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m2, i, c2, r, b2, g, px2, py2, x2, y2, offset2; + for (i = 0; i < ncols; ++i) xExtent[i] = 0; + for (i = 0; i < nrows; ++i) yExtent[i] = 0; + for (i = 0; i < n; ++i) { + g = groups[i]; + b2 = boxes[i] = bbox(g); + g.x = g.x || 0; + dx[i] = 0; + g.y = g.y || 0; + dy[i] = 0; + c2 = i % ncols; + r = ~~(i / ncols); + xMax = Math.max(xMax, px2 = Math.ceil(b2.x2)); + yMax = Math.max(yMax, py2 = Math.ceil(b2.y2)); + xExtent[c2] = Math.max(xExtent[c2], px2); + yExtent[r] = Math.max(yExtent[r], py2); + xOffset[i] = padCol + offsetValue$1(b2.x1); + yOffset[i] = padRow + offsetValue$1(b2.y1); + if (dirty) view.dirty(groups[i]); + } + for (i = 0; i < n; ++i) { + if (i % ncols === 0) xOffset[i] = 0; + if (i < ncols) yOffset[i] = 0; + } + if (alignCol === Each) { + for (c2 = 1; c2 < ncols; ++c2) { + for (offset2 = 0, i = c2; i < n; i += ncols) { + if (offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = c2; i < n; i += ncols) { + xOffset[i] = offset2 + xExtent[c2 - 1]; } - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); + } + } else if (alignCol === All) { + for (offset2 = 0, i = 0; i < n; ++i) { + if (i % ncols && offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = 0; i < n; ++i) { + if (i % ncols) xOffset[i] = offset2 + xMax; + } + } else { + for (alignCol = false, c2 = 1; c2 < ncols; ++c2) { + for (i = c2; i < n; i += ncols) { + xOffset[i] += xExtent[c2 - 1]; } - }); -} -var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick$1(), - isect: (0, _vegaUtil.truthy), - // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset -}; -var line = markMultiItemPath('line', line$1, pickLine); -function attr$3(emit, item) { - var sx = item.scaleX || 1, sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) emit('vector-effect', 'non-scaling-stroke'); - emit('transform', transformItem(item)); - emit('d', item.path); -} -function path$1(context, item) { - var path = item.path; - if (path == null) return true; - var x = item.x || 0, y = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a = (item.angle || 0) * DegToRad, cache = item.pathCache; - if (!cache || cache.path !== path) (item.pathCache = cache = parse(path)).path = path; - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else pathRender(context, cache, x, y, sx, sy); -} -function bound$3(bounds, item) { - return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true); -} -var path$2 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(path$1), - pick: pickPath(path$1), - isect: intersectPath(path$1) -}; -function attr$2(emit, item) { - emit('d', rectangle(null, item)); -} -function bound$2(bounds, item) { - var x, y; - return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item); -} -function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); -} -var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect -}; -function attr$1(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); -} -function bound$1(bounds, item) { - var x1, y1; - return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item); -} -function path(context, item, opacity) { - var x1, y1, x2, y2; - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; + } } - return false; -} -function draw$1(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path(context, item, opacity)) { - blend(context, item); - context.stroke(); + if (alignRow === Each) { + for (r = 1; r < nrows; ++r) { + for (offset2 = 0, i = r * ncols, m2 = i + ncols; i < m2; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; } - }); -} -function hit$1(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path(context, item, 1) && context.isPointInStroke(x, y); -} -var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick$1(hit$1), - isect: intersectRule -}; -var shape = markItemPath('shape', shape$1); -var symbol = markItemPath('symbol', symbol$1, intersectPoint); -// memoize text width measurement -const widthCache = (0, _vegaUtil.lruCache)(); -var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas -}; -useCanvas(true); -function useCanvas(use) { - textMetrics.width = use && context ? measureWidth : estimateWidth; -} -// make simple estimate if no canvas is available -function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); -} -function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); -} -// measure text width if canvas is available -function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item)); -} -function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context.font = currentFont; - width = context.measureText(text).width; - widthCache.set(key, width); - } - return width; -} -function fontSize(item) { - return item.fontSize != null ? +item.fontSize || 0 : 11; -} -function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; -} -function lineArray(_) { - return (0, _vegaUtil.isArray)(_) ? _.length > 1 ? _ : _[0] : _; -} -function textLines(item) { - return lineArray(item.lineBreak && item.text && !(0, _vegaUtil.isArray)(item.text) ? item.text.split(item.lineBreak) : item.text); -} -function multiLineOffset(item) { - const tl = textLines(item); - return ((0, _vegaUtil.isArray)(tl) ? tl.length - 1 : 0) * lineHeight(item); -} -function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate(item, text) : text; -} -function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return (text)=>_measureWidth(text, currentFont); - } else if (textMetrics.width === estimateWidth) { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return (text)=>_estimateWidth(text, currentFontHeight); - } else // User defined textMetrics.width function in use (e.g. vl-convert) - return (text)=>textMetrics.width(item, text); -} -function truncate(item, text) { - var limit = +item.limit, width = widthGetter(item); - if (width(text) < limit) return text; - var ellipsis = item.ellipsis || '\u2026', rtl = item.dir === 'rtl', lo = 0, hi = text.length, mid; - limit -= width(ellipsis); - if (rtl) { - while(lo < hi){ - mid = lo + hi >>> 1; - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; + for (i = r * ncols; i < m2; ++i) { + yOffset[i] = offset2 + yExtent[r - 1]; } - return ellipsis + text.slice(lo); + } + } else if (alignRow === All) { + for (offset2 = 0, i = ncols; i < n; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; + } + for (i = ncols; i < n; ++i) { + yOffset[i] = offset2 + yMax; + } } else { - while(lo < hi){ - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } -} -function fontFamily(item, quote) { - var font = item.font; - return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif'; -} -function font(item, quote) { - return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote); -} -function offset(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, h = fontSize(item); - return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0); -} -const textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' -}; -const tempBounds = new Bounds(); -function anchorPoint(item) { - var x = item.x || 0, y = item.y || 0, r = item.radius || 0, t; - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; -} -function attr(emit, item) { - var dx = item.dx || 0, dy = (item.dy || 0) + offset(item), p = anchorPoint(item), x = p.x1, y = p.y1, a = item.angle || 0, t; - emit('text-anchor', textAlign[item.align] || 'start'); - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else t = translate(x + dx, y + dy); - emit('transform', t); -} -function bound(bounds, item, mode) { - var h = textMetrics.height(item), a = item.align, p = anchorPoint(item), x = p.x1, y = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset(item) - Math.round(0.8 * h), // use 4/5 offset - tl = textLines(item), w; - // get dimensions - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t)=>Math.max(w, textMetrics.width(item, t)), 0); - } else // single-line text - w = textMetrics.width(item, tl); - // horizontal alignment - if (a === 'center') dx -= w / 2; - else if (a === 'right') dx -= w; - bounds.set(dx += x, dy += y, dx + w, dy + h); - if (item.angle && !mode) bounds.rotate(item.angle * DegToRad, x, y); - else if (mode === 2) return bounds.rotatedPoints(item.angle * DegToRad, x, y); - return bounds; -} -function draw(context, scene, bounds) { - visit(scene, (item)=>{ - var opacity = item.opacity == null ? 1 : item.opacity, p, x, y, i, lh, tl, str; - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; - context.font = font(item); - context.textAlign = item.align || 'left'; - p = anchorPoint(item); - x = p.x1, y = p.y1; - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += item.dx || 0; - y += (item.dy || 0) + offset(item); - tl = textLines(item); - blend(context, item); - if ((0, _vegaUtil.isArray)(tl)) { - lh = lineHeight(item); - for(i = 0; i < tl.length; ++i){ - str = textValue(item, tl[i]); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); - y += lh; - } - } else { - str = textValue(item, tl); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); - } - if (item.angle) context.restore(); - }); -} -function hit(context, item, x, y, gx, gy) { - if (item.fontSize <= 0) return false; - if (!item.angle) return true; // bounds sufficient if no rotation - // project point into space of unrotated bounds - var p = anchorPoint(item), ax = p.x1, ay = p.y1, b = bound(tempBounds, item, 1), a = -item.angle * DegToRad, cos = Math.cos(a), sin = Math.sin(a), px = cos * gx - sin * gy + (ax - cos * ax + sin * ay), py = sin * gx + cos * gy + (ay - sin * ax - cos * ay); - return b.contains(px, py); -} -function intersectText(item, box) { - const p = bound(tempBounds, item, 2); - return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]); -} -var text = { - type: 'text', - tag: 'text', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1(hit), - isect: intersectText -}; -var trail = markMultiItemPath('trail', trail$1, pickTrail); -var Marks = { - arc: arc, - area: area, - group: group, - image: image, - line: line, - path: path$2, - rect: rect, - rule: rule, - shape: shape, - symbol: symbol, - text: text, - trail: trail -}; -function boundItem(item, func, opt) { - var type = Marks[item.mark.marktype], bound = func || type.bound; - if (type.nested) item = item.mark; - return bound(item.bounds || (item.bounds = new Bounds()), item, opt); -} -var DUMMY = { - mark: null -}; -function boundMark(mark, bounds, opt) { - var type = Marks[mark.marktype], bound = type.bound, items = mark.items, hasItems = items && items.length, i, n, item, b; - if (type.nested) { - if (hasItems) item = items[0]; - else { - // no items, fake it - DUMMY.mark = mark; - item = DUMMY; - } - b = boundItem(item, bound, opt); - bounds = bounds && bounds.union(b) || b; - return bounds; - } - bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds(); - if (hasItems) for(i = 0, n = items.length; i < n; ++i)bounds.union(boundItem(items[i], bound, opt)); - return mark.bounds = bounds; -} -const keys = [ - 'marktype', - 'name', - 'role', - 'interactive', - 'clip', - 'items', - 'zindex', - 'x', - 'y', - 'width', - 'height', - 'align', - 'baseline', - // layout - 'fill', - 'fillOpacity', - 'opacity', - 'blend', - // fill - 'stroke', - 'strokeOpacity', - 'strokeWidth', - 'strokeCap', - // stroke - 'strokeDash', - 'strokeDashOffset', - // stroke dash - 'strokeForeground', - 'strokeOffset', - // group - 'startAngle', - 'endAngle', - 'innerRadius', - 'outerRadius', - // arc - 'cornerRadius', - 'padAngle', - // arc, rect - 'cornerRadiusTopLeft', - 'cornerRadiusTopRight', - // rect, group - 'cornerRadiusBottomLeft', - 'cornerRadiusBottomRight', - 'interpolate', - 'tension', - 'orient', - 'defined', - // area, line - 'url', - 'aspect', - 'smooth', - // image - 'path', - 'scaleX', - 'scaleY', - // path - 'x2', - 'y2', - // rule - 'size', - 'shape', - // symbol - 'text', - 'angle', - 'theta', - 'radius', - 'dir', - 'dx', - 'dy', - // text - 'ellipsis', - 'limit', - 'lineBreak', - 'lineHeight', - 'font', - 'fontSize', - 'fontWeight', - 'fontStyle', - 'fontVariant', - // font - 'description', - 'aria', - 'ariaRole', - 'ariaRoleDescription' // aria -]; -function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); -} -function sceneFromJSON(json) { - const scene = typeof json === 'string' ? JSON.parse(json) : json; - return initialize(scene); -} -function initialize(scene) { - var type = scene.marktype, items = scene.items, parent, i, n; - if (items) for(i = 0, n = items.length; i < n; ++i){ - parent = type ? 'mark' : 'group'; - items[i][parent] = scene; - if (items[i].zindex) items[i][parent].zdirty = true; - if ('group' === (type || parent)) initialize(items[i]); - } - if (type) boundMark(scene); - return scene; -} -class Scenegraph { - constructor(scene){ - if (arguments.length) this.root = sceneFromJSON(scene); - else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [ - new GroupItem(this.root) - ]; + for (alignRow = false, r = 1; r < nrows; ++r) { + for (i = r * ncols, m2 = i + ncols; i < m2; ++i) { + yOffset[i] += yExtent[r - 1]; } + } } - toJSON(indent) { - return sceneToJSON(this.root, indent || 0); + for (x2 = 0, i = 0; i < n; ++i) { + x2 = xOffset[i] + (i % ncols ? x2 : 0); + dx[i] += x2 - groups[i].x; } - mark(markdef, group, index) { - group = group || this.root.items[0]; - const mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; + for (c2 = 0; c2 < ncols; ++c2) { + for (y2 = 0, i = c2; i < n; i += ncols) { + y2 += yOffset[i]; + dy[i] += y2 - groups[i].y; + } } -} -function createMark(def, group) { - const mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; - // add accessibility properties if defined - if (def.aria != null) mark.aria = def.aria; - if (def.description) mark.description = def.description; - return mark; -} -// create a new DOM element -function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) doc = document; - return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; -} -// find first child element with matching tag -function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, i = 0, n = nodes.length; - for(; i < n; ++i)if (nodes[i].tagName.toLowerCase() === tag) return nodes[i]; -} -// retrieve child element at given index -// create & insert if doesn't exist or if tags do not match -function domChild(el, index, tag, ns) { - var a = el.childNodes[index], b; - if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) { - b = a || null; - a = domCreate(el.ownerDocument, tag, ns); - el.insertBefore(a, b); - } - return a; -} -// remove all child elements at or above the given index -function domClear(el, index) { - var nodes = el.childNodes, curr = nodes.length; - while(curr > index)el.removeChild(nodes[--curr]); - return el; -} -// generate css class name for mark -function cssClass(mark) { - return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : ''); -} -function point(event, el) { - const rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; -} -function resolveItem(item, event, el, origin) { - var mark = item && item.mark, mdef, p; - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while(item = item.mark.group){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - item = mdef.tip(mark.items, p); + if (alignCol && get$1(opt.center, Column) && nrows > 1) { + for (i = 0; i < n; ++i) { + b2 = alignCol === All ? xMax : xExtent[i % ncols]; + x2 = b2 - boxes[i].x2 - groups[i].x - dx[i]; + if (x2 > 0) dx[i] += x2 / 2; + } } - return item; -} -class Handler { - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ constructor(customLoader, customTooltip){ - this._active = null; - this._handlers = {}; - this._loader = customLoader || (0, _vegaLoader.loader)(); - this._tooltip = customTooltip || defaultTooltip; + if (alignRow && get$1(opt.center, Row) && ncols !== 1) { + for (i = 0; i < n; ++i) { + b2 = alignRow === All ? yMax : yExtent[~~(i / ncols)]; + y2 = b2 - boxes[i].y2 - groups[i].y - dy[i]; + if (y2 > 0) dy[i] += y2 / 2; + } } - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ initialize(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); + for (i = 0; i < n; ++i) { + bounds2.union(boxes[i].translate(dx[i], dy[i])); } - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; + x2 = get$1(opt.anchor, X); + y2 = get$1(opt.anchor, Y); + switch (get$1(opt.anchor, Column)) { + case End$1: + x2 -= bounds2.width(); + break; + case Middle$1: + x2 -= bounds2.width() / 2; } - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; + switch (get$1(opt.anchor, Row)) { + case End$1: + y2 -= bounds2.height(); + break; + case Middle$1: + y2 -= bounds2.height() / 2; + } + x2 = Math.round(x2); + y2 = Math.round(y2); + bounds2.clear(); + for (i = 0; i < n; ++i) { + groups[i].mark.bounds.clear(); + } + for (i = 0; i < n; ++i) { + g = groups[i]; + g.x += dx[i] += x2; + g.y += dy[i] += y2; + bounds2.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); + if (dirty) view.dirty(g); + } + return bounds2; + } + function trellisLayout(view, group2, opt) { + var views = gridLayoutGroups(group2), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x2, y2, x22, y22, anchor, band2, offset2; + const bounds2 = gridLayout(view, groups, opt); + if (bounds2.empty()) bounds2.set(0, 0, 0, 0); + if (views.rowheaders) { + band2 = get$1(opt.headerBand, Row, null); + x2 = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$1(off, "rowHeader"), min, 0, bbox, "x1", 0, ncols, 1, band2); } - /** - * Get / set the origin coordinates of the visualization. - */ origin(origin) { - if (arguments.length) { - this._origin = origin || [ - 0, - 0 - ]; - return this; - } else return this._origin.slice(); + if (views.colheaders) { + band2 = get$1(opt.headerBand, Column, null); + y2 = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$1(off, "columnHeader"), min, 1, bbox, "y1", 0, 1, ncols, band2); } - /** - * Get / set the scenegraph root. - */ scene(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; + if (views.rowfooters) { + band2 = get$1(opt.footerBand, Row, null); + x22 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$1(off, "rowFooter"), max, 0, bbox, "x2", ncols - 1, ncols, 1, band2); } - /** - * Add an event handler. Subclasses should override this method. - */ on() {} - /** - * Remove an event handler. Subclasses should override this method. - */ off() {} - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ _handlerIndex(h, type, handler) { - for(let i = h ? h.length : 0; --i >= 0;){ - if (h[i].type === type && (!handler || h[i].handler === handler)) return i; - } - return -1; + if (views.colfooters) { + band2 = get$1(opt.footerBand, Column, null); + y22 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$1(off, "columnFooter"), max, 1, bbox, "y2", cells - ncols, 1, ncols, band2); } - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ handlers(type) { - const h = this._handlers, a = []; - if (type) a.push(...h[this.eventName(type)]); - else for(const k in h)a.push(...h[k]); - return a; + if (views.rowtitle) { + anchor = get$1(opt.titleAnchor, Row); + offset2 = get$1(off, "rowTitle"); + offset2 = anchor === End$1 ? x22 + offset2 : x2 - offset2; + band2 = get$1(opt.titleBand, Row, 0.5); + layoutTitle(view, views.rowtitle, offset2, 0, bounds2, band2); } - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ eventName(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); + if (views.coltitle) { + anchor = get$1(opt.titleAnchor, Column); + offset2 = get$1(off, "columnTitle"); + offset2 = anchor === End$1 ? y22 + offset2 : y2 - offset2; + band2 = get$1(opt.titleBand, Column, 0.5); + layoutTitle(view, views.coltitle, offset2, 1, bounds2, band2); } - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ handleHref(event, item, href) { - this._loader.sanitize(href, { - context: 'href' - }).then((opt)=>{ - const e = new MouseEvent(event.type, event), a = domCreate(null, 'a'); - for(const name in opt)a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }).catch(()=>{}); + } + function boundFlush(item, field2) { + return field2 === "x1" ? item.x || 0 : field2 === "y1" ? item.y || 0 : field2 === "x2" ? (item.x || 0) + (item.width || 0) : field2 === "y2" ? (item.y || 0) + (item.height || 0) : void 0; + } + function boundFull(item, field2) { + return item.bounds[field2]; + } + function layoutHeaders(view, headers, groups, ncols, limit, offset2, agg, isX2, bound2, bf, start, stride, back, band2) { + var n = groups.length, init2 = 0, edge = 0, i, j, k, m2, b2, h2, g, x2, y2; + if (!n) return init2; + for (i = start; i < n; i += stride) { + if (groups[i]) init2 = agg(init2, bound2(groups[i], bf)); } - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ handleTooltip(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = show && item && item.tooltip || null; - this._tooltip.call(this._obj, this, event, item, value); - } + if (!headers.length) return init2; + if (headers.length > limit) { + view.warn("Grid headers exceed limit: " + limit); + headers = headers.slice(0, limit); + } + init2 += offset2; + for (j = 0, m2 = headers.length; j < m2; ++j) { + view.dirty(headers[j]); + headers[j].mark.bounds.clear(); + } + for (i = start, j = 0, m2 = headers.length; j < m2; ++j, i += stride) { + h2 = headers[j]; + b2 = h2.mark.bounds; + for (k = i; k >= 0 && (g = groups[k]) == null; k -= back) ; + if (isX2) { + x2 = band2 == null ? g.x : Math.round(g.bounds.x1 + band2 * g.bounds.width()); + y2 = init2; + } else { + x2 = init2; + y2 = band2 == null ? g.y : Math.round(g.bounds.y1 + band2 * g.bounds.height()); + } + b2.union(h2.bounds.translate(x2 - (h2.x || 0), y2 - (h2.y || 0))); + h2.x = x2; + h2.y = y2; + view.dirty(h2); + edge = agg(edge, b2[bf]); } - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ getItemBoundingClientRect(item) { - const el = this.canvas(); - if (!el) return; - const rect = el.getBoundingClientRect(), origin = this._origin, bounds = item.bounds, width = bounds.width(), height = bounds.height(); - let x = bounds.x1 + origin[0] + rect.left, y = bounds.y1 + origin[1] + rect.top; - // translate coordinate for each parent group - while(item.mark && (item = item.mark.group)){ - x += item.x || 0; - y += item.y || 0; - } - // return DOMRect-compatible bounding box - return { - x, - y, - width, - height, - left: x, - top: y, - right: x + width, - bottom: y + height + return edge; + } + function layoutTitle(view, g, offset2, isX2, bounds2, band2) { + if (!g) return; + view.dirty(g); + var x2 = offset2, y2 = offset2; + isX2 ? x2 = Math.round(bounds2.x1 + band2 * bounds2.width()) : y2 = Math.round(bounds2.y1 + band2 * bounds2.height()); + g.bounds.translate(x2 - (g.x || 0), y2 - (g.y || 0)); + g.mark.bounds.clear().union(g.bounds); + g.x = x2; + g.y = y2; + view.dirty(g); + } + function lookup$3(config, orient) { + const opt = config[orient] || {}; + return (key2, d2) => opt[key2] != null ? opt[key2] : config[key2] != null ? config[key2] : d2; + } + function offsets(legends, value2) { + let max2 = -Infinity; + legends.forEach((item) => { + if (item.offset != null) max2 = Math.max(max2, item.offset); + }); + return max2 > -Infinity ? max2 : value2; + } + function legendParams(g, orient, config, xb, yb, w2, h2) { + const _ = lookup$3(config, orient), offset2 = offsets(g, _("offset", 0)), anchor = _("anchor", Start$1), mult2 = anchor === End$1 ? 1 : anchor === Middle$1 ? 0.5 : 0; + const p = { + align: Each, + bounds: _("bounds", Flush), + columns: _("direction") === "vertical" ? 1 : g.length, + padding: _("margin", 8), + center: _("center"), + nodirty: true + }; + switch (orient) { + case Left$1: + p.anchor = { + x: Math.floor(xb.x1) - offset2, + column: End$1, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor }; - } -} -// The default tooltip display handler. -// Sets the HTML title attribute on the visualization container. -function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); -} -class Renderer { - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ constructor(loader){ - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - } - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; - } - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; - } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [ - 0, - 0 - ]; - this._scale = scaleFactor || 1; - return this; - } - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ dirty() {} - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Renderer} - This renderer instance. - */ render(scene, markTypes) { - const r = this; - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { - r._render(scene, markTypes); + break; + case Right$1: + p.anchor = { + x: Math.ceil(xb.x2) + offset2, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor + }; + break; + case Top$1: + p.anchor = { + y: Math.floor(yb.y1) - offset2, + row: End$1, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case Bottom$1: + p.anchor = { + y: Math.ceil(yb.y2) + offset2, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case TopLeft: + p.anchor = { + x: offset2, + y: offset2 }; - // invoke the renderer - r._call(); - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - return r; - } - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render() { - // subclasses to override - } - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Promise} - A Promise that resolves when rendering is complete. - */ renderAsync(scene, markTypes) { - const r = this.render(scene, markTypes); - return this._ready ? this._ready.then(()=>r) : Promise.resolve(r); - } - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ _load(method, uri) { - var r = this, p = r._loader[method](uri); - if (!r._ready) { - // re-render the scene when loading completes - const call = r._call; - r._ready = r._loader.ready().then((redraw)=>{ - if (redraw) call(); - r._ready = null; - }); - } - return p; - } - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ sanitizeURL(uri) { - return this._load('sanitizeURL', uri); - } - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ loadImage(uri) { - return this._load('loadImage', uri); - } -} -const KeyDownEvent = 'keydown'; -const KeyPressEvent = 'keypress'; -const KeyUpEvent = 'keyup'; -const DragEnterEvent = 'dragenter'; -const DragLeaveEvent = 'dragleave'; -const DragOverEvent = 'dragover'; -const PointerDownEvent = 'pointerdown'; -const PointerUpEvent = 'pointerup'; -const PointerMoveEvent = 'pointermove'; -const PointerOutEvent = 'pointerout'; -const PointerOverEvent = 'pointerover'; -const MouseDownEvent = 'mousedown'; -const MouseUpEvent = 'mouseup'; -const MouseMoveEvent = 'mousemove'; -const MouseOutEvent = 'mouseout'; -const MouseOverEvent = 'mouseover'; -const ClickEvent = 'click'; -const DoubleClickEvent = 'dblclick'; -const WheelEvent = 'wheel'; -const MouseWheelEvent = 'mousewheel'; -const TouchStartEvent = 'touchstart'; -const TouchMoveEvent = 'touchmove'; -const TouchEndEvent = 'touchend'; -const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - PointerDownEvent, - PointerUpEvent, - PointerMoveEvent, - PointerOutEvent, - PointerOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent -]; -const TooltipShowEvent = PointerMoveEvent; -const TooltipHideEvent = MouseOutEvent; -const HrefEvent = ClickEvent; -class CanvasHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - // supported events - this.events = Events; - this.pointermove = move([ - PointerMoveEvent, - MouseMoveEvent - ], [ - PointerOverEvent, - MouseOverEvent - ], [ - PointerOutEvent, - MouseOutEvent - ]); - this.dragover = move([ - DragOverEvent - ], [ - DragEnterEvent - ], [ - DragLeaveEvent - ]), this.pointerout = inactive([ - PointerOutEvent, - MouseOutEvent - ]); - this.dragleave = inactive([ - DragLeaveEvent - ]); + break; + case TopRight: + p.anchor = { + x: w2 - offset2, + y: offset2, + column: End$1 + }; + break; + case BottomLeft: + p.anchor = { + x: offset2, + y: h2 - offset2, + row: End$1 + }; + break; + case BottomRight: + p.anchor = { + x: w2 - offset2, + y: h2 - offset2, + column: End$1, + row: End$1 + }; + break; } - initialize(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - // add minimal events required for proper state management - [ - ClickEvent, - MouseDownEvent, - PointerDownEvent, - PointerMoveEvent, - PointerOutEvent, - DragLeaveEvent - ].forEach((type)=>eventListenerCheck(this, type)); - return super.initialize(el, origin, obj); + return p; + } + function legendLayout(view, legend2) { + var item = legend2.items[0], datum2 = item.datum, orient = item.orient, bounds2 = item.bounds, x2 = item.x, y2 = item.y, w2, h2; + item._bounds ? item._bounds.clear().union(bounds2) : item._bounds = bounds2.clone(); + bounds2.clear(); + legendGroupLayout(view, item, item.items[0].items[0]); + bounds2 = legendBounds(item, bounds2); + w2 = 2 * item.padding; + h2 = 2 * item.padding; + if (!bounds2.empty()) { + w2 = Math.ceil(bounds2.width() + w2); + h2 = Math.ceil(bounds2.height() + h2); } - // return the backing canvas instance - canvas() { - return this._canvas; + if (datum2.type === Symbols$1) { + legendEntryLayout(item.items[0].items[0].items[0].items); } - // retrieve the current canvas context - context() { - return this._canvas.getContext('2d'); + if (orient !== None) { + item.x = x2 = 0; + item.y = y2 = 0; } - // to keep old versions of firefox happy - DOMMouseScroll(evt) { - this.fire(MouseWheelEvent, evt); + item.width = w2; + item.height = h2; + boundStroke(bounds2.set(x2, y2, x2 + w2, y2 + h2), item); + item.mark.bounds.clear().union(bounds2); + return item; + } + function legendBounds(item, b2) { + item.items.forEach((_) => b2.union(_.bounds)); + b2.x1 = item.padding; + b2.y1 = item.padding; + return b2; + } + function legendGroupLayout(view, item, entry2) { + var pad2 = item.padding, ex = pad2 - entry2.x, ey = pad2 - entry2.y; + if (!item.datum.title) { + if (ex || ey) translate(view, entry2, ex, ey); + } else { + var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx2 = pad2 - title.x, ty2 = pad2 - title.y; + switch (title.orient) { + case Left$1: + ex += Math.ceil(title.bounds.width()) + tpad; + break; + case Right$1: + case Bottom$1: + break; + default: + ey += title.bounds.height() + tpad; + } + if (ex || ey) translate(view, entry2, ex, ey); + switch (title.orient) { + case Left$1: + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Right$1: + tx2 += legendTitleOffset(item, entry2, title, End$1, 0, 0) + tpad; + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Bottom$1: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + ty2 += legendTitleOffset(item, entry2, title, End$1, -1, 0, 1) + tpad; + break; + default: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + } + if (tx2 || ty2) translate(view, title, tx2, ty2); + if ((tx2 = Math.round(title.bounds.x1 - pad2)) < 0) { + translate(view, entry2, -tx2, 0); + translate(view, title, -tx2, 0); + } } - pointerdown(evt) { - this._down = this._active; - this.fire(PointerDownEvent, evt); + } + function legendTitleOffset(item, entry2, title, anchor, y2, lr, noBar) { + const grad = item.datum.type !== "symbol", vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry2.items[0] : entry2, s2 = e.bounds[y2 ? "y2" : "x2"] - item.padding, u2 = vgrad && lr ? s2 : 0, v = vgrad && lr ? 0 : s2, o = y2 <= 0 ? 0 : multiLineOffset(title); + return Math.round(anchor === Start$1 ? u2 : anchor === End$1 ? v - o : 0.5 * (s2 - o)); + } + function translate(view, item, dx, dy) { + item.x += dx; + item.y += dy; + item.bounds.translate(dx, dy); + item.mark.bounds.translate(dx, dy); + view.dirty(item); + } + function legendEntryLayout(entries) { + const widths = entries.reduce((w2, g) => { + w2[g.column] = Math.max(g.bounds.x2 - g.x, w2[g.column] || 0); + return w2; + }, {}); + entries.forEach((g) => { + g.width = widths[g.column]; + g.height = g.bounds.y2 - g.y; + }); + } + function titleLayout(view, mark, width2, height2, viewBounds2) { + var group2 = mark.items[0], frame2 = group2.frame, orient = group2.orient, anchor = group2.anchor, offset2 = group2.offset, padding2 = group2.padding, title = group2.items[0].items[0], subtitle = group2.items[1] && group2.items[1].items[0], end = orient === Left$1 || orient === Right$1 ? height2 : width2, start = 0, x2 = 0, y2 = 0, sx = 0, sy = 0, pos; + if (frame2 !== Group) { + orient === Left$1 ? (start = viewBounds2.y2, end = viewBounds2.y1) : orient === Right$1 ? (start = viewBounds2.y1, end = viewBounds2.y2) : (start = viewBounds2.x1, end = viewBounds2.x2); + } else if (orient === Left$1) { + start = height2, end = 0; + } + pos = anchor === Start$1 ? start : anchor === End$1 ? end : (start + end) / 2; + if (subtitle && subtitle.text) { + switch (orient) { + case Top$1: + case Bottom$1: + sy = title.bounds.height() + padding2; + break; + case Left$1: + sx = title.bounds.width() + padding2; + break; + case Right$1: + sx = -title.bounds.width() - padding2; + break; + } + tempBounds.clear().union(subtitle.bounds); + tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); + if (set$2(subtitle, "x", sx) | set$2(subtitle, "y", sy)) { + view.dirty(subtitle); + subtitle.bounds.clear().union(tempBounds); + subtitle.mark.bounds.clear().union(tempBounds); + view.dirty(subtitle); + } + tempBounds.clear().union(subtitle.bounds); + } else { + tempBounds.clear(); } - mousedown(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); + tempBounds.union(title.bounds); + switch (orient) { + case Top$1: + x2 = pos; + y2 = viewBounds2.y1 - tempBounds.height() - offset2; + break; + case Left$1: + x2 = viewBounds2.x1 - tempBounds.width() - offset2; + y2 = pos; + break; + case Right$1: + x2 = viewBounds2.x2 + tempBounds.width() + offset2; + y2 = pos; + break; + case Bottom$1: + x2 = pos; + y2 = viewBounds2.y2 + offset2; + break; + default: + x2 = group2.x; + y2 = group2.y; + } + if (set$2(group2, "x", x2) | set$2(group2, "y", y2)) { + tempBounds.translate(x2, y2); + view.dirty(group2); + group2.bounds.clear().union(tempBounds); + mark.bounds.clear().union(tempBounds); + view.dirty(group2); + } + return group2.bounds; + } + function ViewLayout$1(params2) { + Transform.call(this, null, params2); + } + inherits(ViewLayout$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + _.mark.items.forEach((group2) => { + if (_.layout) trellisLayout(view, group2, _.layout); + layoutGroup(view, group2, _); + }); + return shouldReflow(_.mark.group) ? pulse2.reflow() : pulse2; } - click(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } + }); + function shouldReflow(group2) { + return group2 && group2.mark.role !== "legend-entry"; + } + function layoutGroup(view, group2, _) { + var items = group2.items, width2 = Math.max(0, group2.width || 0), height2 = Math.max(0, group2.height || 0), viewBounds2 = new Bounds().set(0, 0, width2, height2), xBounds = viewBounds2.clone(), yBounds = viewBounds2.clone(), legends = [], title, mark, orient, b2, i, n; + for (i = 0, n = items.length; i < n; ++i) { + mark = items[i]; + switch (mark.role) { + case AxisRole$1: + b2 = isYAxis(mark) ? xBounds : yBounds; + b2.union(axisLayout(view, mark, width2, height2)); + break; + case TitleRole$1: + title = mark; + break; + case LegendRole$1: + legends.push(legendLayout(view, mark)); + break; + case FrameRole$1: + case ScopeRole$1: + case RowHeader: + case RowFooter: + case RowTitle: + case ColHeader: + case ColFooter: + case ColTitle: + xBounds.union(mark.bounds); + yBounds.union(mark.bounds); + break; + default: + viewBounds2.union(mark.bounds); + } } - touchstart(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - if (this._first) { - this._active = this._touch; - this._first = false; + if (legends.length) { + const l = {}; + legends.forEach((item) => { + orient = item.orient || Right$1; + if (orient !== None) (l[orient] || (l[orient] = [])).push(item); + }); + for (const orient2 in l) { + const g = l[orient2]; + gridLayout(view, g, legendParams(g, orient2, _.legends, xBounds, yBounds, width2, height2)); + } + legends.forEach((item) => { + const b3 = item.bounds; + if (!b3.equals(item._bounds)) { + item.bounds = item._bounds; + view.dirty(item); + item.bounds = b3; + view.dirty(item); + } + if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) { + switch (item.orient) { + case Left$1: + case Right$1: + viewBounds2.add(b3.x1, 0).add(b3.x2, 0); + break; + case Top$1: + case Bottom$1: + viewBounds2.add(0, b3.y1).add(0, b3.y2); + } + } else { + viewBounds2.union(b3); } - this.fire(TouchStartEvent, evt, true); + }); } - touchmove(evt) { - this.fire(TouchMoveEvent, evt, true); + viewBounds2.union(xBounds).union(yBounds); + if (title) { + viewBounds2.union(titleLayout(view, title, width2, height2, viewBounds2)); } - touchend(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; + if (group2.clip) { + viewBounds2.set(0, 0, group2.width || 0, group2.height || 0); } - // fire an event - fire(type, evt, touch) { - const a = touch ? this._touch : this._active, h = this._handlers[type]; - // set event type relative to scenegraph items - evt.vegaType = type; - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) this.handleHref(evt, a, a.href); - else if (type === TooltipShowEvent || type === TooltipHideEvent) this.handleTooltip(evt, a, type !== TooltipHideEvent); - // invoke all registered handlers - if (h) for(let i = 0, len = h.length; i < len; ++i)h[i].handler.call(this._obj, evt, a); + viewSizeLayout(view, group2, viewBounds2, _); + } + function viewSizeLayout(view, group2, viewBounds2, _) { + const auto = _.autosize || {}, type2 = auto.type; + if (view._autosize < 1 || !type2) return; + let viewWidth2 = view._width, viewHeight2 = view._height, width2 = Math.max(0, group2.width || 0), left = Math.max(0, Math.ceil(-viewBounds2.x1)), height2 = Math.max(0, group2.height || 0), top = Math.max(0, Math.ceil(-viewBounds2.y1)); + const right = Math.max(0, Math.ceil(viewBounds2.x2 - width2)), bottom = Math.max(0, Math.ceil(viewBounds2.y2 - height2)); + if (auto.contains === Padding$1) { + const padding2 = view.padding(); + viewWidth2 -= padding2.left + padding2.right; + viewHeight2 -= padding2.top + padding2.bottom; + } + if (type2 === None) { + left = 0; + top = 0; + width2 = viewWidth2; + height2 = viewHeight2; + } else if (type2 === Fit) { + width2 = Math.max(0, viewWidth2 - left - right); + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === FitX) { + width2 = Math.max(0, viewWidth2 - left - right); + viewHeight2 = height2 + top + bottom; + } else if (type2 === FitY) { + viewWidth2 = width2 + left + right; + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === Pad) { + viewWidth2 = width2 + left + right; + viewHeight2 = height2 + top + bottom; + } + view._resizeView(viewWidth2, viewHeight2, width2, height2, [left, top], auto.resize); + } + const vtx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + bound: Bound$1, + identifier: Identifier$1, + mark: Mark$1, + overlap: Overlap$1, + render: Render$1, + viewlayout: ViewLayout$1 + }, Symbol.toStringTag, { value: "Module" })); + function AxisTicks$1(params2) { + Transform.call(this, null, params2); + } + inherits(AxisTicks$1, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), ticks2 = this.value, scale2 = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count2 = tickCount(scale2, tally, _.minstep), format2 = _.format || tickFormat(locale2, scale2, count2, _.formatSpecifier, _.formatType, !!_.values), values2 = _.values ? validTicks(scale2, _.values, count2) : tickValues(scale2, count2); + if (ticks2) out.rem = ticks2; + ticks2 = values2.map((value2, i) => ingest$1({ + index: i / (values2.length - 1 || 1), + value: value2, + label: format2(value2) + })); + if (_.extra && ticks2.length) { + ticks2.push(ingest$1({ + index: -1, + extra: { + value: ticks2[0].value + }, + label: "" + })); + } + out.source = ticks2; + out.add = ticks2; + this.value = ticks2; + return out; } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - eventListenerCheck(this, type); - (h[name] || (h[name] = [])).push({ - type: type, - handler: handler - }); + }); + function DataJoin$1(params2) { + Transform.call(this, null, params2); + } + function defaultItemCreate() { + return ingest$1({}); + } + function newMap(key2) { + const map2 = fastmap().test((t) => t.exit); + map2.lookup = (t) => map2.get(key2(t)); + return map2; + } + inherits(DataJoin$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), item = _.item || defaultItemCreate, key2 = _.key || tupleid, map2 = this.value; + if (isArray(out.encode)) { + out.encode = null; + } + if (map2 && (_.modified("key") || pulse2.modified(key2))) { + error("DataJoin does not support modified key function or fields."); + } + if (!map2) { + pulse2 = pulse2.addAll(); + this.value = map2 = newMap(key2); + } + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + let x2 = map2.get(k); + if (x2) { + if (x2.exit) { + map2.empty--; + out.add.push(x2); + } else { + out.mod.push(x2); + } + } else { + x2 = item(t); + map2.set(k, x2); + out.add.push(x2); } - return this; - } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) h.splice(i, 1); - return this; - } - pickEvent(evt) { - const p = point(evt, this._canvas), o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); - } - // find the scenegraph item at the current pointer position - // x, y -- the absolute x, y pointer coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - pick(scene, x, y, gx, gy) { - const g = this.context(), mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - } -} -const eventBundle = (type)=>type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [ - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent - ] : [ - type - ]; -// lazily add listeners to the canvas as needed -function eventListenerCheck(handler, type) { - eventBundle(type).forEach((_)=>addEventListener(handler, _)); -} -function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] ? (evt)=>handler[type](evt) : (evt)=>handler.fire(type, evt)); - } -} -function fireAll(handler, types, event) { - types.forEach((type)=>handler.fire(type, event)); -} -function move(moveEvents, overEvents, outEvents) { - return function(evt) { - const a = this._active, p = this.pickEvent(evt); - if (p === a) // active item and picked item are the same - fireAll(this, moveEvents, evt); // fire move - else { - // active item and picked item are different - if (!a || !a.exit) // fire out for prior active item - // suppress if active item was removed from scene - fireAll(this, outEvents, evt); - this._active = p; // set new active item - fireAll(this, overEvents, evt); // fire over for new active item - fireAll(this, moveEvents, evt); // fire move for new active item + x2.datum = t; + x2.exit = false; + }); + pulse2.visit(pulse2.MOD, (t) => { + const k = key2(t), x2 = map2.get(k); + if (x2) { + x2.datum = t; + out.mod.push(x2); } - }; -} -function inactive(types) { - return function(evt) { - fireAll(this, types, evt); - this._active = null; - }; -} -function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; -} -function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null, context = canvas.getContext('2d'), ratio = inDOM ? devicePixelRatio() : scaleFactor; - canvas.width = width * ratio; - canvas.height = height * ratio; - for(const key in opt)context[key] = opt[key]; - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - context.pixelRatio = ratio; - context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); - return canvas; -} -class CanvasRenderer extends Renderer { - constructor(loader){ - super(loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - initialize(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - this._canvas = this._options.externalContext ? null : (0, _vegaCanvas.canvas)(1, 1, this._options.type); // instantiate a small canvas - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin, scaleFactor); - } - resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._canvas) // configure canvas size and transform - resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); - else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) (0, _vegaUtil.error)('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); + }); + pulse2.visit(pulse2.REM, (t) => { + const k = key2(t), x2 = map2.get(k); + if (t === x2.datum && !x2.exit) { + out.rem.push(x2); + x2.exit = true; + ++map2.empty; } - this._redraw = true; - return this; - } - canvas() { - return this._canvas; - } - context() { - return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null); + }); + if (pulse2.changed(pulse2.ADD_MOD)) out.modifies("datum"); + if (pulse2.clean() || _.clean && map2.empty > df.cleanThreshold) { + df.runAfter(map2.clean); + } + return out; } - dirty(item) { - const b = this._tempb.clear().union(item.bounds); - let g = item.mark.group; - while(g){ - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; + }); + function Encode$1(params2) { + Transform.call(this, null, params2); + } + inherits(Encode$1, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode2 = pulse2.encode; + if (isArray(encode2)) { + if (out.changed() || encode2.every((e) => encoders[e])) { + encode2 = encode2[0]; + out.encode = null; + } else { + return pulse2.StopPropagation; } - this._dirty.union(b); - } - _render(scene, markTypes) { - const g = this.context(), o = this._origin, w = this._width, h = this._height, db = this._dirty, vb = viewBounds(o, w, h); - // setup - g.save(); - const b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); - this.clear(-o[0], -o[1], w, h); - // render - this.draw(g, scene, b, markTypes); - // takedown - g.restore(); - db.clear(); - return this; - } - draw(ctx, scene, bounds, markTypes) { - if (scene.marktype !== 'group' && markTypes != null && !markTypes.includes(scene.marktype)) return; - const mark = Marks[scene.marktype]; - if (scene.clip) clip(ctx, scene); - mark.draw.call(this, ctx, scene, bounds, markTypes); - if (scene.clip) ctx.restore(); - } - clear(x, y, w, h) { - const opt = this._options, g = this.context(); - if (opt.type !== 'pdf' && !opt.externalContext) // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - } -} -const viewBounds = (origin, width, height)=>new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]); -function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - return b; -} -class SVGHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item)=>{ - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item)=>{ - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); + } + var reenter = encode2 === "enter", update2 = encoders.update || falsy, enter = encoders.enter || falsy, exit = encoders.exit || falsy, set2 = (encode2 && !reenter ? encoders[encode2] : update2) || falsy; + if (pulse2.changed(pulse2.ADD)) { + pulse2.visit(pulse2.ADD, (t) => { + enter(t, _); + update2(t, _); }); - } - initialize(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); + out.modifies(enter.output); + out.modifies(update2.output); + if (set2 !== falsy && set2 !== update2) { + pulse2.visit(pulse2.ADD, (t) => { + set2(t, _); + }); + out.modifies(set2.output); } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return super.initialize(el, origin, obj); - } - canvas() { - return this._svg; - } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - (h[name] || (h[name] = [])).push(x); - if (this._svg) this._svg.addEventListener(name, x.listener); + } + if (pulse2.changed(pulse2.REM) && exit !== falsy) { + pulse2.visit(pulse2.REM, (t) => { + exit(t, _); + }); + out.modifies(exit.output); + } + if (reenter || set2 !== falsy) { + const flag2 = pulse2.MOD | (_.modified() ? pulse2.REFLOW : 0); + if (reenter) { + pulse2.visit(flag2, (t) => { + const mod = enter(t, _) || fmod; + if (set2(t, _) || mod) out.mod.push(t); + }); + if (out.mod.length) out.modifies(enter.output); + } else { + pulse2.visit(flag2, (t) => { + if (set2(t, _) || fmod) out.mod.push(t); + }); } - return this; + if (out.mod.length) out.modifies(set2.output); + } + return out.changed() ? out : pulse2.StopPropagation; } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) { - if (this._svg) this._svg.removeEventListener(name, h[i].listener); - h.splice(i, 1); + }); + function LegendEntries$1(params2) { + Transform.call(this, [], params2); + } + inherits(LegendEntries$1, Transform, { + transform(_, pulse2) { + if (this.value != null && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), items = this.value, type2 = _.type || SymbolLegend, scale2 = _.scale, limit = +_.limit, count2 = tickCount(scale2, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type2 === SymbolLegend, format2 = _.format || labelFormat(locale2, scale2, count2, type2, _.formatSpecifier, _.formatType, lskip), values2 = _.values || labelValues(scale2, count2), domain2, fraction, size, offset2, ellipsis; + if (items) out.rem = items; + if (type2 === SymbolLegend) { + if (limit && values2.length > limit) { + pulse2.dataflow.warn("Symbol legend count exceeds limit, filtering items."); + items = values2.slice(0, limit - 1); + ellipsis = true; + } else { + items = values2; } - return this; + if (isFunction(size = _.size)) { + if (!_.values && scale2(items[0]) === 0) { + items = items.slice(1); + } + offset2 = items.reduce((max2, value2) => Math.max(max2, size(value2, _)), 0); + } else { + size = constant$4(offset2 = size || 8); + } + items = items.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, items), + value: value2, + offset: offset2, + size: size(value2, _) + })); + if (ellipsis) { + ellipsis = values2[items.length]; + items.push(ingest$1({ + index: items.length, + label: `…${values2.length - items.length} entries`, + value: ellipsis, + offset: offset2, + size: size(ellipsis, _) + })); + } + } else if (type2 === GradientLegend) { + domain2 = scale2.domain(), fraction = scaleFraction(scale2, domain2[0], peek$1(domain2)); + if (values2.length < 3 && !_.values && domain2[0] !== peek$1(domain2)) { + values2 = [domain2[0], peek$1(domain2)]; + } + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: fraction(value2) + })); + } else { + size = values2.length - 1; + fraction = labelFraction(scale2); + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: index2 ? fraction(value2) : 0, + perc2: index2 === size ? 1 : fraction(values2[index2 + 1]) + })); + } + out.source = items; + out.add = items; + this.value = items; + return out; } -} -// wrap an event listener for the SVG DOM -const listener = (context, handler)=>(evt)=>{ - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; -const ARIA_HIDDEN = 'aria-hidden'; -const ARIA_LABEL = 'aria-label'; -const ARIA_ROLE = 'role'; -const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; -const GRAPHICS_OBJECT = 'graphics-object'; -const GRAPHICS_SYMBOL = 'graphics-symbol'; -const bundle = (role, roledesc, label)=>({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined - }); -// these roles are covered by related roles -// we can ignore them, no need to generate attributes -const AriaIgnore = (0, _vegaUtil.toSet)([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' -]); -// aria attribute generators for guide roles -const AriaGuides = { - 'axis': { - desc: 'axis', - caption: axisCaption - }, - 'legend': { - desc: 'legend', - caption: legendCaption - }, - 'title-text': { - desc: 'title', - caption: (item)=>`Title text '${titleCaption(item)}'` + }); + const sourceX = (t) => t.source.x; + const sourceY = (t) => t.source.y; + const targetX = (t) => t.target.x; + const targetY = (t) => t.target.y; + function LinkPath(params2) { + Transform.call(this, {}, params2); + } + LinkPath.Definition = { + "type": "LinkPath", + "metadata": { + "modifies": true }, - 'title-subtitle': { - desc: 'subtitle', - caption: (item)=>`Subtitle text '${titleCaption(item)}'` - } -}; -// aria properties generated for mark item encoding channels -const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL -}; -function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - if (hide || item.description == null) for(const prop in AriaEncode)emit(AriaEncode[prop], undefined); - else { - const type = item.mark.marktype; - emit(ARIA_LABEL, item.description); - emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); - emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`); - } -} -function ariaMarkAttributes(mark) { - return mark.aria === false ? { - [ARIA_HIDDEN]: true - } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); -} -function ariaMark(mark) { - const type = mark.marktype; - const recurse = type === 'group' || type === 'text' || mark.items.some((_)=>_.description != null && _.aria !== false); - return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description); -} -function ariaGuide(mark, opt) { - try { - const item = mark.items[0], caption = opt.caption || (()=>''); - return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); - } catch (err) { - return null; - } -} -function titleCaption(item) { - return (0, _vegaUtil.array)(item.text).join(' '); -} -function axisCaption(item) { - const datum = item.datum, orient = item.orient, title = datum.title ? extractTitle(item) : null, ctx = item.context, scale = ctx.scales[datum.scale].value, locale = ctx.dataflow.locale(), type = scale.type, xy = orient === 'left' || orient === 'right' ? 'Y' : 'X'; - return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${(0, _vegaScale.isDiscrete)(type) ? 'discrete' : type} scale` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function legendCaption(item) { - const datum = item.datum, title = datum.title ? extractTitle(item) : null, type = `${datum.type || ''} legend`.trim(), scales = datum.scales, props = Object.keys(scales), ctx = item.context, scale = ctx.scales[scales[props[0]]].value, locale = ctx.dataflow.locale(); - return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function extractTitle(item) { - try { - return (0, _vegaUtil.array)((0, _vegaUtil.peek)(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } -} -function channelCaption(props) { - props = props.map((p)=>p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + (0, _vegaUtil.peek)(props); -} -function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; -} -const innerText = (val)=>(val + '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); -const attrText = (val)=>innerText(val).replace(/"/g, '"').replace(/\t/g, ' ').replace(/\n/g, ' ').replace(/\r/g, ' '); -function markup() { - let buf = '', outer = '', inner = ''; - const stack = [], clear = ()=>outer = inner = '', push = (tag)=>{ - if (outer) { - buf += `${outer}>${inner}`; - clear(); - } - stack.push(tag); - }, attr = (name, value)=>{ - if (value != null) outer += ` ${name}="${attrText(value)}"`; - return m; - }, m = { - open (tag) { - push(tag); - outer = '<' + tag; - for(var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)attrs[_key - 1] = arguments[_key]; - for (const set of attrs)for(const key in set)attr(key, set[key]); - return m; - }, - close () { - const tag = stack.pop(); - if (outer) buf += outer + (inner ? `>${inner}</${tag}>` : '/>'); - else buf += `</${tag}>`; - clear(); - return m; - }, - attr, - text: (t)=>(inner += innerText(t), m), - toString: ()=>buf - }; - return m; -} -const serializeXML = (node)=>_serialize(markup(), node) + ''; -function _serialize(m, node) { - m.open(node.tagName); - if (node.hasAttributes()) { - const attrs = node.attributes, n = attrs.length; - for(let i = 0; i < n; ++i)m.attr(attrs[i].name, attrs[i].value); - } - if (node.hasChildNodes()) { - const children = node.childNodes; - for (const child of children)child.nodeType === 3 // text node - ? m.text(child.nodeValue) : _serialize(m, child); - } - return m.close(); -} -const stylesAttr = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity' -}; -const stylesCss = { - blend: 'mix-blend-mode' -}; -// ensure miter limit default is consistent with canvas (#2498) -const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 -}; -const RootIndex = 0, xmlns = 'http://www.w3.org/2000/xmlns/', svgns = metadata.xmlns; -class SVGRenderer extends Renderer { - constructor(loader){ - super(loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - /** - * Initialize a new SVGRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - // create the svg definitions cache - this._defs = {}; - this._clearDefs(); - if (el) { - this._svg = domChild(el, 0, 'svg', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']); - this._svg.setAttribute('version', metadata['version']); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', svgns); - setAttributes(this._root, rootAttributes); - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - // set background color if defined - this.background(this._bgcolor); - return super.initialize(el, width, height, origin, scaleFactor); + "params": [{ + "name": "sourceX", + "type": "field", + "default": "source.x" + }, { + "name": "sourceY", + "type": "field", + "default": "source.y" + }, { + "name": "targetX", + "type": "field", + "default": "target.x" + }, { + "name": "targetY", + "type": "field", + "default": "target.y" + }, { + "name": "orient", + "type": "enum", + "default": "vertical", + "values": ["horizontal", "vertical", "radial"] + }, { + "name": "shape", + "type": "enum", + "default": "line", + "values": ["line", "arc", "curve", "diagonal", "orthogonal"] + }, { + "name": "require", + "type": "signal" + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(LinkPath, Transform, { + transform(_, pulse2) { + var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx2 = _.targetX || targetX, ty2 = _.targetY || targetY, as = _.as || "path", orient = _.orient || "vertical", shape2 = _.shape || "line", path2 = Paths.get(shape2 + "-" + orient) || Paths.get(shape2); + if (!path2) { + error("LinkPath unsupported type: " + _.shape + (_.orient ? "-" + _.orient : "")); + } + pulse2.visit(pulse2.SOURCE, (t) => { + t[as] = path2(sx(t), sy(t), tx2(t), ty2(t)); + }); + return pulse2.reflow(_.modified()).modifies(as); } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length && this._svg) this._svg.style.setProperty('background-color', bgcolor); - return super.background(...arguments); + }); + const line = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "L" + tx2 + "," + ty2; + const lineR = (sa2, sr, ta, tr2) => line(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const arc = (sx, sy, tx2, ty2) => { + var dx = tx2 - sx, dy = ty2 - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; + return "M" + sx + "," + sy + "A" + rr + "," + rr + " " + ra + " 0 1 " + tx2 + "," + ty2; + }; + const arcR = (sa2, sr, ta, tr2) => arc(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const curve = (sx, sy, tx2, ty2) => { + const dx = tx2 - sx, dy = ty2 - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); + return "M" + sx + "," + sy + "C" + (sx + ix) + "," + (sy + iy) + " " + (tx2 + iy) + "," + (ty2 - ix) + " " + tx2 + "," + ty2; + }; + const curveR = (sa2, sr, ta, tr2) => curve(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const orthoX = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "V" + ty2 + "H" + tx2; + const orthoY = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "H" + tx2 + "V" + ty2; + const orthoR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), sf = Math.abs(ta - sa2) > Math.PI ? ta <= sa2 : ta > sa2; + return "M" + sr * sc + "," + sr * ss + "A" + sr + "," + sr + " 0 0," + (sf ? 1 : 0) + " " + sr * tc + "," + sr * ts2 + "L" + tr2 * tc + "," + tr2 * ts2; + }; + const diagonalX = (sx, sy, tx2, ty2) => { + const m2 = (sx + tx2) / 2; + return "M" + sx + "," + sy + "C" + m2 + "," + sy + " " + m2 + "," + ty2 + " " + tx2 + "," + ty2; + }; + const diagonalY = (sx, sy, tx2, ty2) => { + const m2 = (sy + ty2) / 2; + return "M" + sx + "," + sy + "C" + sx + "," + m2 + " " + tx2 + "," + m2 + " " + tx2 + "," + ty2; + }; + const diagonalR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), mr = (sr + tr2) / 2; + return "M" + sr * sc + "," + sr * ss + "C" + mr * sc + "," + mr * ss + " " + mr * tc + "," + mr * ts2 + " " + tr2 * tc + "," + tr2 * ts2; + }; + const Paths = fastmap({ + "line": line, + "line-radial": lineR, + "arc": arc, + "arc-radial": arcR, + "curve": curve, + "curve-radial": curveR, + "orthogonal-horizontal": orthoX, + "orthogonal-vertical": orthoY, + "orthogonal-radial": orthoR, + "diagonal-horizontal": diagonalX, + "diagonal-vertical": diagonalY, + "diagonal-radial": diagonalR + }); + function Pie(params2) { + Transform.call(this, null, params2); + } + Pie.Definition = { + "type": "Pie", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "startAngle", + "type": "number", + "default": 0 + }, { + "name": "endAngle", + "type": "number", + "default": 6.283185307179586 + }, { + "name": "sort", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["startAngle", "endAngle"] + }] + }; + inherits(Pie, Transform, { + transform(_, pulse2) { + var as = _.as || ["startAngle", "endAngle"], startAngle = as[0], endAngle = as[1], field2 = _.field || one$1, start = _.startAngle || 0, stop2 = _.endAngle != null ? _.endAngle : 2 * Math.PI, data2 = pulse2.source, values2 = data2.map(field2), n = values2.length, a2 = start, k = (stop2 - start) / sum$1(values2), index2 = range$3(n), i, t, v; + if (_.sort) { + index2.sort((a3, b2) => values2[a3] - values2[b2]); + } + for (i = 0; i < n; ++i) { + v = values2[index2[i]]; + t = data2[index2[i]]; + t[startAngle] = a2; + t[endAngle] = a2 += v * k; + } + this.value = values2; + return pulse2.reflow(_.modified()).modifies(as); } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._svg) { - setAttributes(this._svg, { - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - }); - this._root.setAttribute('transform', `translate(${this._origin})`); - } - this._dirty = []; - return this; + }); + const DEFAULT_COUNT = 5; + function includeZero(scale2) { + const type2 = scale2.type; + return !scale2.bins && (type2 === Linear || type2 === Pow || type2 === Sqrt); + } + function includePad(type2) { + return isContinuous(type2) && type2 !== Sequential; + } + const SKIP$1 = toSet(["set", "modified", "clear", "type", "scheme", "schemeExtent", "schemeCount", "domain", "domainMin", "domainMid", "domainMax", "domainRaw", "domainImplicit", "nice", "zero", "bins", "range", "rangeStep", "round", "reverse", "interpolate", "interpolateGamma"]); + function Scale$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Scale$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, scale$12 = this.value, key2 = scaleKey(_); + if (!scale$12 || key2 !== scale$12.type) { + this.value = scale$12 = scale$4(key2)(); + } + for (key2 in _) if (!SKIP$1[key2]) { + if (key2 === "padding" && includePad(scale$12.type)) continue; + isFunction(scale$12[key2]) ? scale$12[key2](_[key2]) : df.warn("Unsupported scale property: " + key2); + } + configureRange(scale$12, _, configureBins(scale$12, _, configureDomain(scale$12, _, df))); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - /** - * Returns the SVG element of the visualization. - * @return {DOMElement} - The SVG element. - */ canvas() { - return this._svg; + }); + function scaleKey(_) { + var t = _.type, d2 = "", n; + if (t === Sequential) return Sequential + "-" + Linear; + if (isContinuousColor(_)) { + n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; + d2 = n === 2 ? Sequential + "-" : n === 3 ? Diverging + "-" : ""; } - /** - * Returns an SVG text string for the rendered content, - * or null if this renderer is currently headless. - */ svg() { - const svg = this._svg, bg = this._bgcolor; - if (!svg) return null; - let node; - if (bg) { - svg.removeAttribute('style'); - node = domChild(svg, RootIndex, 'rect', svgns); - setAttributes(node, { - width: this._width, - height: this._height, - fill: bg - }); - } - const text = serializeXML(svg); - if (bg) { - svg.removeChild(node); - this._svg.style.setProperty('background-color', bg); - } - return text; + return (d2 + t || Linear).toLowerCase(); + } + function isContinuousColor(_) { + const t = _.type; + return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString)); + } + function configureDomain(scale2, _, df) { + const raw = rawDomain(scale2, _.domainRaw, df); + if (raw > -1) return raw; + var domain2 = _.domain, type2 = scale2.type, zero2 = _.zero || _.zero === void 0 && includeZero(scale2), n, mid; + if (!domain2) return 0; + if (zero2 || _.domainMin != null || _.domainMax != null || _.domainMid != null) { + n = (domain2 = domain2.slice()).length - 1 || 1; + if (zero2) { + if (domain2[0] > 0) domain2[0] = 0; + if (domain2[n] < 0) domain2[n] = 0; + } + if (_.domainMin != null) domain2[0] = _.domainMin; + if (_.domainMax != null) domain2[n] = _.domainMax; + if (_.domainMid != null) { + mid = _.domainMid; + const i = mid > domain2[n] ? n + 1 : mid < domain2[0] ? 0 : n; + if (i !== n) df.warn("Scale domainMid exceeds domain min or max.", mid); + domain2.splice(i, 0, mid); + } } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._clearDefs(); - this.mark(this._root, scene, undefined, markTypes); - domClear(this._root, 1); - } - this.defs(); - this._dirty = []; - ++this._dirtyID; - return this; + if (includePad(type2) && _.padding && domain2[0] !== peek$1(domain2)) { + domain2 = padDomain(type2, domain2, _.range, _.padding, _.exponent, _.constant); } - // -- Manage rendering of items marked as dirty -- - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (item.dirty !== this._dirtyID) { - item.dirty = this._dirtyID; - this._dirty.push(item); - } + scale2.domain(domainCheck(type2, domain2, df)); + if (type2 === Ordinal) { + scale2.unknown(_.domainImplicit ? implicit : void 0); } - /** - * Check if a mark item is considered dirty. - * @param {Item} item - The mark item. - */ isDirty(item) { - return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; + if (_.nice && scale2.nice) { + scale2.nice(_.nice !== true && tickCount(scale2, _.nice) || null); } - /** - * Internal method to check dirty status and, if possible, - * make targetted updates without a full rendering pass. - */ _dirtyCheck() { - this._dirtyAll = true; - const items = this._dirty; - if (!items.length || !this._dirtyID) return true; - const id = ++this._dirtyID; - let item, mark, type, mdef, i, n, o; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - mark = item.mark; - if (mark.marktype !== type) { - // memoize mark instance lookup - type = mark.marktype; - mdef = Marks[type]; - } - if (mark.zdirty && mark.dirty !== id) { - this._dirtyAll = false; - dirtyParents(item, id); - mark.items.forEach((i)=>{ - i.dirty = id; - }); - } - if (mark.zdirty) continue; // handle in standard drawing pass - if (item.exit) { - // EXIT - if (mdef.nested && mark.items.length) { - // if nested mark with remaining points, update instead - o = mark.items[0]; - if (o._svg) this._update(mdef, o._svg, o); - } else if (item._svg) { - // otherwise remove from DOM - o = item._svg.parentNode; - if (o) o.removeChild(item._svg); - } - item._svg = null; - continue; - } - item = mdef.nested ? mark.items[0] : item; - if (item._update === id) continue; // already visited - if (!item._svg || !item._svg.ownerSVGElement) { - // ENTER - this._dirtyAll = false; - dirtyParents(item, id); - } else // IN-PLACE UPDATE - this._update(mdef, item._svg, item); - item._update = id; - } - return !this._dirtyAll; + return domain2.length; + } + function rawDomain(scale2, raw, df) { + if (raw) { + scale2.domain(domainCheck(scale2.type, raw, df)); + return raw.length; + } else { + return -1; } - // -- Construct & maintain scenegraph to SVG mapping --- - /** - * Render a set of mark items. - * @param {SVGElement} el - The parent element in the SVG tree. - * @param {object} scene - The mark parent to render. - * @param {SVGElement} prev - The previous sibling in the SVG tree. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ mark(el, scene, prev, markTypes) { - if (!this.isDirty(scene)) return scene._svg; - const svg = this._svg, markType = scene.marktype, mdef = Marks[markType], events = scene.interactive === false ? 'none' : null, isGroup = mdef.tag === 'g'; - const parent = bind(scene, el, prev, 'g', svg); - if (markType !== 'group' && markTypes != null && !markTypes.includes(markType)) { - domClear(parent, 0); - return scene._svg; - } - parent.setAttribute('class', cssClass(scene)); - // apply aria attributes to parent container element - const aria = ariaMarkAttributes(scene); - for(const key in aria)setAttribute(parent, key, aria[key]); - if (!isGroup) setAttribute(parent, 'pointer-events', events); - setAttribute(parent, 'clip-path', scene.clip ? clip$1(this, scene, scene.group) : null); - let sibling = null, i = 0; - const process = (item)=>{ - const dirty = this.isDirty(item), node = bind(item, parent, sibling, mdef.tag, svg); - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item, markTypes); - } - sibling = node; - ++i; - }; - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else visit(scene, process); - domClear(parent, i); - return parent; + } + function padDomain(type2, domain2, range2, pad2, exponent2, constant2) { + var span2 = Math.abs(peek$1(range2) - range2[0]), frac = span2 / (span2 - 2 * pad2), d2 = type2 === Log ? zoomLog(domain2, null, frac) : type2 === Sqrt ? zoomPow(domain2, null, frac, 0.5) : type2 === Pow ? zoomPow(domain2, null, frac, exponent2 || 1) : type2 === Symlog ? zoomSymlog(domain2, null, frac, constant2 || 1) : zoomLinear(domain2, null, frac); + domain2 = domain2.slice(); + domain2[0] = d2[0]; + domain2[domain2.length - 1] = d2[1]; + return domain2; + } + function domainCheck(type2, domain2, df) { + if (isLogarithmic(type2)) { + var s2 = Math.abs(domain2.reduce((s3, v) => s3 + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); + if (s2 !== domain2.length) { + df.warn("Log scale domain includes zero: " + $(domain2)); + } } - /** - * Update the attributes of an SVG element for a mark item. - * @param {object} mdef - The mark definition object - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ _update(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - // apply aria-specific properties - ariaItemAttributes(emit, item); - // apply svg attributes - mdef.attr(emit, item, this); - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - // apply svg style attributes - // note: element state may have been modified by 'extra' method - if (element) this.style(element, item); + return domain2; + } + function configureBins(scale2, _, count2) { + let bins = _.bins; + if (bins && !isArray(bins)) { + const domain2 = scale2.domain(), lo = domain2[0], hi = peek$1(domain2), step = bins.step; + let start = bins.start == null ? lo : bins.start, stop2 = bins.stop == null ? hi : bins.stop; + if (!step) error("Scale bins parameter missing step property."); + if (start < lo) start = step * Math.ceil(lo / step); + if (stop2 > hi) stop2 = step * Math.floor(hi / step); + bins = range$3(start, stop2 + step / 2, step); + } + if (bins) { + scale2.bins = bins; + } else if (scale2.bins) { + delete scale2.bins; + } + if (scale2.type === BinOrdinal) { + if (!bins) { + scale2.bins = scale2.domain(); + } else if (!_.domain && !_.domainRaw) { + scale2.domain(bins); + count2 = bins.length; + } } - /** - * Update the presentation attributes of an SVG element for a mark item. - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ style(el, item) { - if (item == null) return; - for(const prop in stylesAttr){ - let value = prop === 'font' ? fontFamily(item) : item[prop]; - if (value === values[prop]) continue; - const name = stylesAttr[prop]; - if (value == null) el.removeAttribute(name); - else { - if (isGradient(value)) value = gradientRef(value, this._defs.gradient, href()); - el.setAttribute(name, value + ''); - } - values[prop] = value; + return count2; + } + function configureRange(scale2, _, count2) { + var type2 = scale2.type, round = _.round || false, range2 = _.range; + if (_.rangeStep != null) { + range2 = configureRangeStep(type2, _, count2); + } else if (_.scheme) { + range2 = configureScheme(type2, _, count2); + if (isFunction(range2)) { + if (scale2.interpolator) { + return scale2.interpolator(range2); + } else { + error(`Scale type ${type2} does not support interpolating color schemes.`); } - for(const prop in stylesCss)setStyle(el, stylesCss[prop], item[prop]); + } } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - */ defs() { - const svg = this._svg, defs = this._defs; - let el = defs.el, index = 0; - for(const id in defs.gradient){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateGradient(el, defs.gradient[id], index); - } - for(const id in defs.clipping){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateClipping(el, defs.clipping[id], index); - } - // clean-up - if (el) index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index); + if (range2 && isInterpolating(type2)) { + return scale2.interpolator(interpolateColors(flip(range2, _.reverse), _.interpolate, _.interpolateGamma)); } - /** - * Clear defs caches. - */ _clearDefs() { - const def = this._defs; - def.gradient = {}; - def.clipping = {}; - } -} -// mark ancestor chain with a dirty id -function dirtyParents(item, id) { - for(; item && item.dirty !== id; item = item.mark.group){ - item.dirty = id; - if (item.mark && item.mark.dirty !== id) item.mark.dirty = id; - else return; - } -} -// update gradient definitions -function updateGradient(el, grad, index) { - let i, n, stop; - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - let pt = domChild(el, index++, 'pattern', svgns); - setAttributes(pt, { - id: patternPrefix + grad.id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - pt = domChild(pt, 0, 'rect', svgns); - setAttributes(pt, { - width: 1, - height: 1, - fill: `url(${href()}#${grad.id})` - }); - el = domChild(el, index++, 'radialGradient', svgns); - setAttributes(el, { - id: grad.id, - fx: grad.x1, - fy: grad.y1, - fr: grad.r1, - cx: grad.x2, - cy: grad.y2, - r: grad.r2 - }); - } else { - el = domChild(el, index++, 'linearGradient', svgns); - setAttributes(el, { - id: grad.id, - x1: grad.x1, - x2: grad.x2, - y1: grad.y1, - y2: grad.y2 - }); + if (range2 && _.interpolate && scale2.interpolate) { + scale2.interpolate(interpolate(_.interpolate, _.interpolateGamma)); + } else if (isFunction(scale2.round)) { + scale2.round(round); + } else if (isFunction(scale2.rangeRound)) { + scale2.interpolate(round ? interpolateRound : interpolate$1); } - for(i = 0, n = grad.stops.length; i < n; ++i){ - stop = domChild(el, i, 'stop', svgns); - stop.setAttribute('offset', grad.stops[i].offset); - stop.setAttribute('stop-color', grad.stops[i].color); + if (range2) scale2.range(flip(range2, _.reverse)); + } + function configureRangeStep(type2, _, count2) { + if (type2 !== Band && type2 !== Point) { + error("Only band and point scales support rangeStep."); } - domClear(el, i); - return index; -} -// update clipping path definitions -function updateClipping(el, clip, index) { - let mask; - el = domChild(el, index, 'clipPath', svgns); - el.setAttribute('id', clip.id); - if (clip.path) { - mask = domChild(el, 0, 'path', svgns); - mask.setAttribute('d', clip.path); + var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type2 === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; + return [0, _.rangeStep * bandSpace(count2, inner, outer)]; + } + function configureScheme(type2, _, count2) { + var extent2 = _.schemeExtent, name, scheme$1; + if (isArray(_.scheme)) { + scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); } else { - mask = domChild(el, 0, 'rect', svgns); - setAttributes(mask, { - x: 0, - y: 0, - width: clip.width, - height: clip.height - }); + name = _.scheme.toLowerCase(); + scheme$1 = scheme(name); + if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`); } - domClear(el, 1); - return index + 1; -} -// Recursively process group contents. -function recurse(renderer, el, group, markTypes) { - // child 'g' element is second to last among children (path, g, path) - // other children here are foreground and background path elements - el = el.lastChild.previousSibling; - let prev, idx = 0; - visit(group, (item)=>{ - prev = renderer.mark(el, item, prev, markTypes); - ++idx; - }); - // remove any extraneous DOM elements - domClear(el, 1 + idx); -} -// Bind a scenegraph item to an SVG DOM element. -// Create new SVG elements as needed. -function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, svgns); - item._svg = node; - if (item.mark) { - node.__data__ = item; - node.__values__ = { - fill: 'default' - }; - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', svgns); - node.appendChild(bg); - bg.__data__ = item; - const cg = domCreate(doc, 'g', svgns); - node.appendChild(cg); - cg.__data__ = item; - const fg = domCreate(doc, 'path', svgns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = { - fill: 'default' - }; - } - } + count2 = type2 === Threshold ? count2 + 1 : type2 === BinOrdinal ? count2 - 1 : type2 === Quantile || type2 === Quantize ? +_.schemeCount || DEFAULT_COUNT : count2; + return isInterpolating(type2) ? adjustScheme(scheme$1, extent2, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent2), count2) : type2 === Ordinal ? scheme$1 : scheme$1.slice(0, count2); + } + function adjustScheme(scheme2, extent2, reverse2) { + return isFunction(scheme2) && (extent2 || reverse2) ? interpolateRange(scheme2, flip(extent2 || [0, 1], reverse2)) : scheme2; + } + function flip(array2, reverse2) { + return reverse2 ? array2.slice().reverse() : array2; + } + function SortItems$1(params2) { + Transform.call(this, null, params2); + } + inherits(SortItems$1, Transform, { + transform(_, pulse2) { + const mod = _.modified("sort") || pulse2.changed(pulse2.ADD) || pulse2.modified(_.sort.fields) || pulse2.modified("datum"); + if (mod) pulse2.source.sort(stableCompare(_.sort)); + this.modified(mod); + return pulse2; } - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - return node; -} -// check if two nodes are ordered siblings -function siblingCheck(node, sibling) { - return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same -} -// -- Set attributes & styles on SVG elements --- -let element = null, // temp var for current SVG element -values = null; // temp var for current values hash -// Extra configuration for certain mark types -const mark_extras = { - group (mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - // leave element null to prevent downstream styling - element = null; - } else // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - }, - image (mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else setStyle(el, 'image-rendering', null); + }); + const Zero = "zero", Center$1 = "center", Normalize = "normalize", DefOutput = ["y0", "y1"]; + function Stack(params2) { + Transform.call(this, null, params2); + } + Stack.Definition = { + "type": "Stack", + "metadata": { + "modifies": true }, - text (mdef, el, item) { - const tl = textLines(item); - let key, value, doc, lh; - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - value = tl.map((_)=>textValue(item, _)); - key = value.join('\n'); // content cache key - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i)=>{ - const ts = domCreate(doc, 'tspan', svgns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } -}; -function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - // use appropriate method given namespace (ns) - if (ns) setAttributeNS(element, name, value, ns); - else setAttribute(element, name, value); - // note current value for future comparison - values[name] = value; -} -function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) el.style.removeProperty(name); - else el.style.setProperty(name, value + ''); - values[name] = value; - } -} -function setAttributes(el, attrs) { - for(const key in attrs)setAttribute(el, key, attrs[key]); -} -function setAttribute(el, name, value) { - if (value != null) // if value is provided, update DOM attribute - el.setAttribute(name, value); - else // else remove DOM attribute - el.removeAttribute(name); -} -function setAttributeNS(el, name, value, ns) { - if (value != null) // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - else // else remove DOM attribute - el.removeAttributeNS(ns, name); -} -function href() { - let loc; - return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; -} -class SVGStringRenderer extends Renderer { - constructor(loader){ - super(loader); - this._text = null; - this._defs = { - gradient: {}, - clipping: {} - }; + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "sort", + "type": "compare" + }, { + "name": "offset", + "type": "enum", + "default": Zero, + "values": [Zero, Center$1, Normalize] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": DefOutput + }] + }; + inherits(Stack, Transform, { + transform(_, pulse2) { + var as = _.as || DefOutput, y02 = as[0], y12 = as[1], sort2 = stableCompare(_.sort), field2 = _.field || one$1, stack = _.offset === Center$1 ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max2; + groups = partition$3(pulse2.source, _.groupby, sort2, field2); + for (i = 0, n = groups.length, max2 = groups.max; i < n; ++i) { + stack(groups[i], max2, field2, y02, y12); + } + return pulse2.reflow(_.modified()).modifies(as); } - /** - * Returns the rendered SVG text string, - * or null if rendering has not yet occurred. - */ svg() { - return this._text; + }); + function stackCenter(group2, max2, field2, y02, y12) { + var last = (max2 - group2.sum) / 2, m2 = group2.length, j = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last += Math.abs(field2(t)); } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - */ _render(scene) { - const m = markup(); - // svg tag - m.open('svg', (0, _vegaUtil.extend)({}, metadata, { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - })); - // background, if defined - const bg = this._bgcolor; - if (bg && bg !== 'transparent' && bg !== 'none') m.open('rect', { - width: this._width, - height: this._height, - fill: bg - }).close(); - // root content group - m.open('g', rootAttributes, { - transform: 'translate(' + this._origin + ')' - }); - this.mark(m, scene); - m.close(); // </g> - // defs - this.defs(m); - // get SVG text string - this._text = m.close() + ''; - return this; + } + function stackNormalize(group2, max2, field2, y02, y12) { + var scale2 = 1 / group2.sum, last = 0, m2 = group2.length, j = 0, v = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last = scale2 * (v += Math.abs(field2(t))); } - /** - * Render a set of mark items. - * @param {object} m - The markup context. - * @param {object} scene - The mark parent to render. - */ mark(m, scene) { - const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ - ariaItemAttributes, - mdef.attr - ]; - // render opening group tag - m.open('g', { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip$1(this, scene, scene.group) : null - }, ariaMarkAttributes(scene), { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - }); - // render contained elements - const process = (item)=>{ - const href = this.href(item); - if (href) m.open('a', href); - m.open(tag, this.attr(scene, item, attrList, tag !== 'g' ? tag : null)); - if (tag === 'text') { - const tl = textLines(item); - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - const attrs = { - x: 0, - dy: lineHeight(item) - }; - for(let i = 0; i < tl.length; ++i)m.open('tspan', i ? attrs : null).text(textValue(item, tl[i])).close(); - } else // single-line text - m.text(textValue(item, tl)); - } else if (tag === 'g') { - const fore = item.strokeForeground, fill = item.fill, stroke = item.stroke; - if (fore && stroke) item.stroke = null; - m.open('path', this.attr(scene, item, mdef.background, 'bgrect')).close(); - // recurse for group content - m.open('g', this.attr(scene, item, mdef.content)); - visit(item, (scene)=>this.mark(m, scene)); - m.close(); - if (fore && stroke) { - if (fill) item.fill = null; - item.stroke = stroke; - m.open('path', this.attr(scene, item, mdef.foreground, 'bgrect')).close(); - if (fill) item.fill = fill; - } else m.open('path', this.attr(scene, item, mdef.foreground, 'bgfore')).close(); - } - m.close(); // </tag> - if (href) m.close(); // </a> - }; - if (mdef.nested) { - if (scene.items && scene.items.length) process(scene.items[0]); - } else visit(scene, process); - // render closing group tag - return m.close(); // </g> + } + function stackZero(group2, max2, field2, y02, y12) { + var lastPos = 0, lastNeg = 0, m2 = group2.length, j = 0, v, t; + for (; j < m2; ++j) { + t = group2[j]; + v = +field2(t); + if (v < 0) { + t[y02] = lastNeg; + t[y12] = lastNeg += v; + } else { + t[y02] = lastPos; + t[y12] = lastPos += v; + } } - /** - * Get href attributes for a hyperlinked mark item. - * @param {Item} item - The mark item. - */ href(item) { - const href = item.href; - let attr; - if (href) { - if (attr = this._hrefs && this._hrefs[href]) return attr; - else this.sanitizeURL(href).then((attr)=>{ - // rewrite to use xlink namespace - attr['xlink:href'] = attr.href; - attr.href = null; - (this._hrefs || (this._hrefs = {}))[href] = attr; - }); + } + function partition$3(data2, groupby, sort2, field2) { + var groups = [], get2 = (f) => f(t), map2, i, n, m2, t, k, g, s2, max2; + if (groupby == null) { + groups.push(data2.slice()); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + groups.push(g); } - return null; + g.push(t); + } } - /** - * Get an object of SVG attributes for a mark item. - * @param {object} scene - The mark parent. - * @param {Item} item - The mark item. - * @param {array|function} attrs - One or more attribute emitters. - * @param {string} tag - The tag being rendered. - */ attr(scene, item, attrs, tag) { - const object = {}, emit = (name, value, ns, prefixed)=>{ - object[prefixed || name] = value; - }; - // apply mark specific attributes - if (Array.isArray(attrs)) attrs.forEach((fn)=>fn(emit, item, this)); - else attrs(emit, item, this); - // apply style attributes - if (tag) style(object, item, scene, tag, this._defs); - return object; + for (k = 0, max2 = 0, m2 = groups.length; k < m2; ++k) { + g = groups[k]; + for (i = 0, s2 = 0, n = g.length; i < n; ++i) { + s2 += Math.abs(field2(g[i])); + } + g.sum = s2; + if (s2 > max2) max2 = s2; + if (sort2) g.sort(sort2); } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - * @param {object} m - The markup context. - */ defs(m) { - const gradient = this._defs.gradient, clipping = this._defs.clipping, count = Object.keys(gradient).length + Object.keys(clipping).length; - if (count === 0) return; // nothing to do - m.open('defs'); - for(const id in gradient){ - const def = gradient[id], stops = def.stops; - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - m.open('pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - m.open('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }).close(); - m.close(); // </pattern> - m.open('radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else m.open('linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - for(let i = 0; i < stops.length; ++i)m.open('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }).close(); - m.close(); - } - for(const id in clipping){ - const def = clipping[id]; - m.open('clipPath', { - id: id - }); - if (def.path) m.open('path', { - d: def.path - }).close(); - else m.open('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }).close(); - m.close(); - } - m.close(); - } -} -// Helper function for attr for style presentation attributes -function style(s, item, scene, tag, defs) { - let styleList; - if (item == null) return s; - if (tag === 'bgrect' && scene.interactive === false) s['pointer-events'] = 'none'; - if (tag === 'bgfore') { - if (scene.interactive === false) s['pointer-events'] = 'none'; - s.display = 'none'; - if (item.fill !== null) return s; - } - if (tag === 'image' && item.smooth === false) styleList = [ - 'image-rendering: optimizeSpeed;', - 'image-rendering: pixelated;' - ]; - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - s['font-style'] = item.fontStyle; - s['font-variant'] = item.fontVariant; - s['font-weight'] = item.fontWeight; - } - for(const prop in stylesAttr){ - let value = item[prop]; - const name = stylesAttr[prop]; - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; - else if (value != null) { - if (isGradient(value)) value = gradientRef(value, defs.gradient, ''); - s[name] = value; - } - } - for(const prop in stylesCss){ - const value = item[prop]; - if (value != null) { - styleList = styleList || []; - styleList.push(`${stylesCss[prop]}: ${value};`); - } - } - if (styleList) s.style = styleList.join(' '); - return s; -} -/** - * @typedef {Object} HybridRendererOptions - * - * @property {string[]} [svgMarkTypes=['text']] - An array of SVG mark types to render - * in the SVG layer. All other mark types - * will be rendered in the Canvas layer. - * @property {boolean} [svgOnTop=true] - Flag to determine if SVG should be rendered on top. - * @property {boolean} [debug=false] - Flag to enable or disable debugging mode. When true, - * the top layer will be stacked below the bottom layer - * rather than overlaid on top. - */ /** @type {HybridRendererOptions} */ const OPTS = { - svgMarkTypes: [ - 'text' - ], - svgOnTop: true, - debug: false -}; -/** - * Configure the HybridRenderer - * - * @param {HybridRendererOptions} options - HybridRenderer configuration options. - */ function setHybridRendererOptions(options) { - OPTS['svgMarkTypes'] = options.svgMarkTypes ?? [ - 'text' - ]; - OPTS['svgOnTop'] = options.svgOnTop ?? true; - OPTS['debug'] = options.debug ?? false; -} -class HybridRenderer extends Renderer { - constructor(loader){ - super(loader); - this._svgRenderer = new SVGRenderer(loader); - this._canvasRenderer = new CanvasRenderer(loader); + groups.max = max2; + return groups; + } + const encode$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + axisticks: AxisTicks$1, + datajoin: DataJoin$1, + encode: Encode$1, + legendentries: LegendEntries$1, + linkpath: LinkPath, + pie: Pie, + scale: Scale$1, + sortitems: SortItems$1, + stack: Stack + }, Symbol.toStringTag, { value: "Module" })); + var epsilon$3 = 1e-6; + var epsilon2 = 1e-12; + var pi$1 = Math.PI; + var halfPi$1 = pi$1 / 2; + var quarterPi = pi$1 / 4; + var tau$1 = pi$1 * 2; + var degrees = 180 / pi$1; + var radians = pi$1 / 180; + var abs$1 = Math.abs; + var atan = Math.atan; + var atan2 = Math.atan2; + var cos$1 = Math.cos; + var ceil = Math.ceil; + var exp = Math.exp; + var hypot = Math.hypot; + var log$1 = Math.log; + var pow$1 = Math.pow; + var sin$1 = Math.sin; + var sign = Math.sign || function(x2) { + return x2 > 0 ? 1 : x2 < 0 ? -1 : 0; + }; + var sqrt$1 = Math.sqrt; + var tan = Math.tan; + function acos(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$1 : Math.acos(x2); + } + function asin$1(x2) { + return x2 > 1 ? halfPi$1 : x2 < -1 ? -halfPi$1 : Math.asin(x2); + } + function noop$2() { + } + function streamGeometry(geometry, stream2) { + if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { + streamGeometryType[geometry.type](geometry, stream2); } - /** - * Initialize a new HybridRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {HybridRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._root_el = domChild(el, 0, 'div'); - const bottomEl = domChild(this._root_el, 0, 'div'); - const topEl = domChild(this._root_el, 1, 'div'); - this._root_el.style.position = 'relative'; - // Set position absolute to overlay svg on top of canvas - if (!OPTS.debug) { - bottomEl.style.height = '100%'; - topEl.style.position = 'absolute'; - topEl.style.top = '0'; - topEl.style.left = '0'; - topEl.style.height = '100%'; - topEl.style.width = '100%'; - } - this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; - this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; - // pointer-events to none on SVG layer so that canvas gets all events - this._svgEl.style.pointerEvents = 'none'; - this._canvasRenderer.initialize(this._canvasEl, width, height, origin, scaleFactor); - this._svgRenderer.initialize(this._svgEl, width, height, origin, scaleFactor); - return super.initialize(el, width, height, origin, scaleFactor); + } + var streamObjectType = { + Feature: function(object2, stream2) { + streamGeometry(object2.geometry, stream2); + }, + FeatureCollection: function(object2, stream2) { + var features = object2.features, i = -1, n = features.length; + while (++i < n) streamGeometry(features[i].geometry, stream2); } - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (OPTS.svgMarkTypes.includes(item.mark.marktype)) this._svgRenderer.dirty(item); - else this._canvasRenderer.dirty(item); - return this; + }; + var streamGeometryType = { + Sphere: function(object2, stream2) { + stream2.sphere(); + }, + Point: function(object2, stream2) { + object2 = object2.coordinates; + stream2.point(object2[0], object2[1], object2[2]); + }, + MultiPoint: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) object2 = coordinates[i], stream2.point(object2[0], object2[1], object2[2]); + }, + LineString: function(object2, stream2) { + streamLine(object2.coordinates, stream2, 0); + }, + MultiLineString: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamLine(coordinates[i], stream2, 0); + }, + Polygon: function(object2, stream2) { + streamPolygon(object2.coordinates, stream2); + }, + MultiPolygon: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamPolygon(coordinates[i], stream2); + }, + GeometryCollection: function(object2, stream2) { + var geometries = object2.geometries, i = -1, n = geometries.length; + while (++i < n) streamGeometry(geometries[i], stream2); } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - const allMarkTypes = markTypes ?? [ - 'arc', - 'area', - 'image', - 'line', - 'path', - 'rect', - 'rule', - 'shape', - 'symbol', - 'text', - 'trail' - ]; - const canvasMarkTypes = allMarkTypes.filter((m)=>!OPTS.svgMarkTypes.includes(m)); - this._svgRenderer.render(scene, OPTS.svgMarkTypes); - this._canvasRenderer.render(scene, canvasMarkTypes); + }; + function streamLine(coordinates, stream2, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + stream2.lineStart(); + while (++i < n) coordinate = coordinates[i], stream2.point(coordinate[0], coordinate[1], coordinate[2]); + stream2.lineEnd(); + } + function streamPolygon(coordinates, stream2) { + var i = -1, n = coordinates.length; + stream2.polygonStart(); + while (++i < n) streamLine(coordinates[i], stream2, 1); + stream2.polygonEnd(); + } + function geoStream(object2, stream2) { + if (object2 && streamObjectType.hasOwnProperty(object2.type)) { + streamObjectType[object2.type](object2, stream2); + } else { + streamGeometry(object2, stream2); } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - this._svgRenderer.resize(width, height, origin, scaleFactor); - this._canvasRenderer.resize(width, height, origin, scaleFactor); - return this; + } + var areaRingSum$1 = new Adder(); + var areaSum$1 = new Adder(), lambda00$2, phi00$2, lambda0$1, cosPhi0, sinPhi0; + var areaStream$1 = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaRingSum$1 = new Adder(); + areaStream$1.lineStart = areaRingStart$1; + areaStream$1.lineEnd = areaRingEnd$1; + }, + polygonEnd: function() { + var areaRing = +areaRingSum$1; + areaSum$1.add(areaRing < 0 ? tau$1 + areaRing : areaRing); + this.lineStart = this.lineEnd = this.point = noop$2; + }, + sphere: function() { + areaSum$1.add(tau$1); } - background(bgcolor) { - // Propagate background color to lower canvas renderer - if (OPTS.svgOnTop) this._canvasRenderer.background(bgcolor); - else this._svgRenderer.background(bgcolor); - return this; + }; + function areaRingStart$1() { + areaStream$1.point = areaPointFirst$1; + } + function areaRingEnd$1() { + areaPoint$1(lambda00$2, phi00$2); + } + function areaPointFirst$1(lambda, phi2) { + areaStream$1.point = areaPoint$1; + lambda00$2 = lambda, phi00$2 = phi2; + lambda *= radians, phi2 *= radians; + lambda0$1 = lambda, cosPhi0 = cos$1(phi2 = phi2 / 2 + quarterPi), sinPhi0 = sin$1(phi2); + } + function areaPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + phi2 = phi2 / 2 + quarterPi; + var dLambda = lambda - lambda0$1, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos$1(phi2), sinPhi = sin$1(phi2), k = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k * cos$1(adLambda), v = k * sdLambda * sin$1(adLambda); + areaRingSum$1.add(atan2(v, u2)); + lambda0$1 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; + } + function geoArea$1(object2) { + areaSum$1 = new Adder(); + geoStream(object2, areaStream$1); + return areaSum$1 * 2; + } + function spherical(cartesian2) { + return [atan2(cartesian2[1], cartesian2[0]), asin$1(cartesian2[2])]; + } + function cartesian(spherical2) { + var lambda = spherical2[0], phi2 = spherical2[1], cosPhi = cos$1(phi2); + return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)]; + } + function cartesianDot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cartesianCross(a2, b2) { + return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]]; + } + function cartesianAddInPlace(a2, b2) { + a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2]; + } + function cartesianScale(vector, k) { + return [vector[0] * k, vector[1] * k, vector[2] * k]; + } + function cartesianNormalizeInPlace(d2) { + var l = sqrt$1(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]); + d2[0] /= l, d2[1] /= l, d2[2] /= l; + } + var lambda0, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, deltaSum, ranges, range$2; + var boundsStream$1 = { + point: boundsPoint$1, + lineStart: boundsLineStart, + lineEnd: boundsLineEnd, + polygonStart: function() { + boundsStream$1.point = boundsRingPoint; + boundsStream$1.lineStart = boundsRingStart; + boundsStream$1.lineEnd = boundsRingEnd; + deltaSum = new Adder(); + areaStream$1.polygonStart(); + }, + polygonEnd: function() { + areaStream$1.polygonEnd(); + boundsStream$1.point = boundsPoint$1; + boundsStream$1.lineStart = boundsLineStart; + boundsStream$1.lineEnd = boundsLineEnd; + if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); + else if (deltaSum > epsilon$3) phi1 = 90; + else if (deltaSum < -epsilon$3) phi0 = -90; + range$2[0] = lambda0, range$2[1] = lambda1; + }, + sphere: function() { + lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); } -} -class HybridHandler extends CanvasHandler { - constructor(loader, tooltip){ - super(loader, tooltip); - } - initialize(el, origin, obj) { - const canvas = domChild(domChild(el, 0, 'div'), OPTS.svgOnTop ? 0 : 1, 'div'); - return super.initialize(canvas, origin, obj); - } -} -const Canvas = 'canvas'; -const Hybrid = 'hybrid'; -const PNG = 'png'; -const SVG = 'svg'; -const None = 'none'; -const RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - Hybrid: Hybrid, - None: None -}; -const modules = {}; -modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler -}; -modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler -}; -modules[Hybrid] = { - renderer: HybridRenderer, - headless: HybridRenderer, - handler: HybridHandler -}; -modules[None] = {}; -function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else return modules[name]; -} -function intersect(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : (0, _vegaUtil.error)('Intersect scene must be mark node or group item.'); -} -function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, type = mark.marktype, n = items.length; - let i = 0; - if (type === 'group') for(; i < n; ++i)intersectGroup(items[i], box, filter, hits); - else for(const test = Marks[type].isect; i < n; ++i){ - const item = items[i]; - if (intersectItem(item, box, test)) hits.push(item); + }; + function boundsPoint$1(lambda, phi2) { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + function linePoint(lambda, phi2) { + var p = cartesian([lambda * radians, phi2 * radians]); + if (p0) { + var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal); + cartesianNormalizeInPlace(inflection); + inflection = spherical(inflection); + var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs$1(delta) > 180; + if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = inflection[1] * degrees; + if (phii > phi1) phi1 = phii; + } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = -inflection[1] * degrees; + if (phii < phi0) phi0 = phii; + } else { + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + if (antimeridian) { + if (lambda < lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } + } else { + if (lambda1 >= lambda0) { + if (lambda < lambda0) lambda0 = lambda; + if (lambda > lambda1) lambda1 = lambda; + } else { + if (lambda > lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } } + } + } else { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); } - return hits; -} -function visitMark(mark, box, filter) { - // process if bounds intersect and if - // (1) mark is a group mark (so we must recurse), or - // (2) mark is interactive and passes filter - return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark))); -} -function intersectGroup(group, box, filter, hits) { - // test intersect against group - // skip groups by default unless filter says otherwise - if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) hits.push(group); - // recursively test children marks - // translate box to group coordinate space - const marks = group.items, n = marks && marks.length; - if (n) { - const x = group.x || 0, y = group.y || 0; - box.translate(-x, -y); - for(let i = 0; i < n; ++i)intersectMark(marks[i], box, filter, hits); - box.translate(x, y); + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + p0 = p, lambda2 = lambda; + } + function boundsLineStart() { + boundsStream$1.point = linePoint; + } + function boundsLineEnd() { + range$2[0] = lambda0, range$2[1] = lambda1; + boundsStream$1.point = boundsPoint$1; + p0 = null; + } + function boundsRingPoint(lambda, phi2) { + if (p0) { + var delta = lambda - lambda2; + deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); + } else { + lambda00$1 = lambda, phi00$1 = phi2; } - return hits; -} -function intersectItem(item, box, test) { - // test bounds enclosure, bounds intersection, then detailed test - const bounds = item.bounds; - return box.encloses(bounds) || box.intersects(bounds) && test(item, box); -} -const clipBounds = new Bounds(); -function boundClip(mark) { - const clip = mark.clip; - if ((0, _vegaUtil.isFunction)(clip)) clip(boundContext(clipBounds.clear())); - else if (clip) clipBounds.set(0, 0, mark.group.width, mark.group.height); - else return; - mark.bounds.intersect(clipBounds); -} -const TOLERANCE = 1e-9; -function sceneEqual(a, b, key) { - return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : (0, _vegaUtil.isNumber)(a) && (0, _vegaUtil.isNumber)(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !(0, _vegaUtil.isObject)(a) && !(0, _vegaUtil.isObject)(b) ? a == b : objectEqual(a, b); -} -function pathEqual(a, b) { - return sceneEqual(parse(a), parse(b)); -} -function objectEqual(a, b) { - var ka = Object.keys(a), kb = Object.keys(b), key, i; - if (ka.length !== kb.length) return false; - ka.sort(); - kb.sort(); - for(i = ka.length - 1; i >= 0; i--){ - if (ka[i] != kb[i]) return false; + areaStream$1.point(lambda, phi2); + linePoint(lambda, phi2); + } + function boundsRingStart() { + areaStream$1.lineStart(); + } + function boundsRingEnd() { + boundsRingPoint(lambda00$1, phi00$1); + areaStream$1.lineEnd(); + if (abs$1(deltaSum) > epsilon$3) lambda0 = -(lambda1 = 180); + range$2[0] = lambda0, range$2[1] = lambda1; + p0 = null; + } + function angle(lambda02, lambda12) { + return (lambda12 -= lambda02) < 0 ? lambda12 + 360 : lambda12; + } + function rangeCompare(a2, b2) { + return a2[0] - b2[0]; + } + function rangeContains(range2, x2) { + return range2[0] <= range2[1] ? range2[0] <= x2 && x2 <= range2[1] : x2 < range2[0] || range2[1] < x2; + } + function geoBounds$1(feature2) { + var i, n, a2, b2, merged, deltaMax, delta; + phi1 = lambda1 = -(lambda0 = phi0 = Infinity); + ranges = []; + geoStream(feature2, boundsStream$1); + if (n = ranges.length) { + ranges.sort(rangeCompare); + for (i = 1, a2 = ranges[0], merged = [a2]; i < n; ++i) { + b2 = ranges[i]; + if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) { + if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1]; + if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0]; + } else { + merged.push(a2 = b2); + } + } + for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a2 = merged[n]; i <= n; a2 = b2, ++i) { + b2 = merged[i]; + if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda0 = b2[0], lambda1 = a2[1]; + } } - for(i = ka.length - 1; i >= 0; i--){ - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; + ranges = range$2 = null; + return lambda0 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]]; + } + var W0, W1, X0$1, Y0$1, Z0$1, X1$1, Y1$1, Z1$1, X2$1, Y2$1, Z2$1, lambda00, phi00, x0$4, y0$4, z0; + var centroidStream$1 = { + sphere: noop$2, + point: centroidPoint$1, + lineStart: centroidLineStart$1, + lineEnd: centroidLineEnd$1, + polygonStart: function() { + centroidStream$1.lineStart = centroidRingStart$1; + centroidStream$1.lineEnd = centroidRingEnd$1; + }, + polygonEnd: function() { + centroidStream$1.lineStart = centroidLineStart$1; + centroidStream$1.lineEnd = centroidLineEnd$1; } - return typeof a === typeof b; -} -function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); -} - -},{"vega-util":"f2ulH","d3-shape":"50n1e","d3-path":"7nzmW","vega-canvas":"4O1hR","vega-loader":"8kWcg","vega-scale":"gHN3E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"50n1e":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "arc", ()=>(0, _arcJsDefault.default)); -parcelHelpers.export(exports, "area", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "line", ()=>(0, _lineJsDefault.default)); -parcelHelpers.export(exports, "pie", ()=>(0, _pieJsDefault.default)); -parcelHelpers.export(exports, "areaRadial", ()=>(0, _areaRadialJsDefault.default)) // Note: radialArea is deprecated! -; -parcelHelpers.export(exports, "radialArea", ()=>(0, _areaRadialJsDefault.default)); -parcelHelpers.export(exports, "lineRadial", ()=>(0, _lineRadialJsDefault.default)) // Note: radialLine is deprecated! -; -parcelHelpers.export(exports, "radialLine", ()=>(0, _lineRadialJsDefault.default)); -parcelHelpers.export(exports, "pointRadial", ()=>(0, _pointRadialJsDefault.default)); -parcelHelpers.export(exports, "link", ()=>(0, _linkJs.link)); -parcelHelpers.export(exports, "linkHorizontal", ()=>(0, _linkJs.linkHorizontal)); -parcelHelpers.export(exports, "linkVertical", ()=>(0, _linkJs.linkVertical)); -parcelHelpers.export(exports, "linkRadial", ()=>(0, _linkJs.linkRadial)); -parcelHelpers.export(exports, "symbol", ()=>(0, _symbolJsDefault.default)); -parcelHelpers.export(exports, "symbolsStroke", ()=>(0, _symbolJs.symbolsStroke)); -parcelHelpers.export(exports, "symbolsFill", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbols", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbolAsterisk", ()=>(0, _asteriskJsDefault.default)); -parcelHelpers.export(exports, "symbolCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "symbolCross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond", ()=>(0, _diamondJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond2", ()=>(0, _diamond2JsDefault.default)); -parcelHelpers.export(exports, "symbolPlus", ()=>(0, _plusJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare", ()=>(0, _squareJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare2", ()=>(0, _square2JsDefault.default)); -parcelHelpers.export(exports, "symbolStar", ()=>(0, _starJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle", ()=>(0, _triangleJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle2", ()=>(0, _triangle2JsDefault.default)); -parcelHelpers.export(exports, "symbolWye", ()=>(0, _wyeJsDefault.default)); -parcelHelpers.export(exports, "symbolTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "symbolX", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "curveBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "curveBasisOpen", ()=>(0, _basisOpenJsDefault.default)); -parcelHelpers.export(exports, "curveBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "curveBumpX", ()=>(0, _bumpJs.bumpX)); -parcelHelpers.export(exports, "curveBumpY", ()=>(0, _bumpJs.bumpY)); -parcelHelpers.export(exports, "curveBundle", ()=>(0, _bundleJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalClosed", ()=>(0, _cardinalClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalOpen", ()=>(0, _cardinalOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCardinal", ()=>(0, _cardinalJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomClosed", ()=>(0, _catmullRomClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomOpen", ()=>(0, _catmullRomOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRom", ()=>(0, _catmullRomJsDefault.default)); -parcelHelpers.export(exports, "curveLinearClosed", ()=>(0, _linearClosedJsDefault.default)); -parcelHelpers.export(exports, "curveLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "curveMonotoneX", ()=>(0, _monotoneJs.monotoneX)); -parcelHelpers.export(exports, "curveMonotoneY", ()=>(0, _monotoneJs.monotoneY)); -parcelHelpers.export(exports, "curveNatural", ()=>(0, _naturalJsDefault.default)); -parcelHelpers.export(exports, "curveStep", ()=>(0, _stepJsDefault.default)); -parcelHelpers.export(exports, "curveStepAfter", ()=>(0, _stepJs.stepAfter)); -parcelHelpers.export(exports, "curveStepBefore", ()=>(0, _stepJs.stepBefore)); -parcelHelpers.export(exports, "stack", ()=>(0, _stackJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetExpand", ()=>(0, _expandJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetNone", ()=>(0, _noneJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetSilhouette", ()=>(0, _silhouetteJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetWiggle", ()=>(0, _wiggleJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAppearance", ()=>(0, _appearanceJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAscending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderDescending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderInsideOut", ()=>(0, _insideOutJsDefault.default)); -parcelHelpers.export(exports, "stackOrderNone", ()=>(0, _noneJsDefault1.default)); -parcelHelpers.export(exports, "stackOrderReverse", ()=>(0, _reverseJsDefault.default)); -var _arcJs = require("./arc.js"); -var _arcJsDefault = parcelHelpers.interopDefault(_arcJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pieJs = require("./pie.js"); -var _pieJsDefault = parcelHelpers.interopDefault(_pieJs); -var _areaRadialJs = require("./areaRadial.js"); -var _areaRadialJsDefault = parcelHelpers.interopDefault(_areaRadialJs); -var _lineRadialJs = require("./lineRadial.js"); -var _lineRadialJsDefault = parcelHelpers.interopDefault(_lineRadialJs); -var _pointRadialJs = require("./pointRadial.js"); -var _pointRadialJsDefault = parcelHelpers.interopDefault(_pointRadialJs); -var _linkJs = require("./link.js"); -var _symbolJs = require("./symbol.js"); -var _symbolJsDefault = parcelHelpers.interopDefault(_symbolJs); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _basisClosedJs = require("./curve/basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _basisOpenJs = require("./curve/basisOpen.js"); -var _basisOpenJsDefault = parcelHelpers.interopDefault(_basisOpenJs); -var _basisJs = require("./curve/basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _bumpJs = require("./curve/bump.js"); -var _bundleJs = require("./curve/bundle.js"); -var _bundleJsDefault = parcelHelpers.interopDefault(_bundleJs); -var _cardinalClosedJs = require("./curve/cardinalClosed.js"); -var _cardinalClosedJsDefault = parcelHelpers.interopDefault(_cardinalClosedJs); -var _cardinalOpenJs = require("./curve/cardinalOpen.js"); -var _cardinalOpenJsDefault = parcelHelpers.interopDefault(_cardinalOpenJs); -var _cardinalJs = require("./curve/cardinal.js"); -var _cardinalJsDefault = parcelHelpers.interopDefault(_cardinalJs); -var _catmullRomClosedJs = require("./curve/catmullRomClosed.js"); -var _catmullRomClosedJsDefault = parcelHelpers.interopDefault(_catmullRomClosedJs); -var _catmullRomOpenJs = require("./curve/catmullRomOpen.js"); -var _catmullRomOpenJsDefault = parcelHelpers.interopDefault(_catmullRomOpenJs); -var _catmullRomJs = require("./curve/catmullRom.js"); -var _catmullRomJsDefault = parcelHelpers.interopDefault(_catmullRomJs); -var _linearClosedJs = require("./curve/linearClosed.js"); -var _linearClosedJsDefault = parcelHelpers.interopDefault(_linearClosedJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _monotoneJs = require("./curve/monotone.js"); -var _naturalJs = require("./curve/natural.js"); -var _naturalJsDefault = parcelHelpers.interopDefault(_naturalJs); -var _stepJs = require("./curve/step.js"); -var _stepJsDefault = parcelHelpers.interopDefault(_stepJs); -var _stackJs = require("./stack.js"); -var _stackJsDefault = parcelHelpers.interopDefault(_stackJs); -var _expandJs = require("./offset/expand.js"); -var _expandJsDefault = parcelHelpers.interopDefault(_expandJs); -var _divergingJs = require("./offset/diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _noneJs = require("./offset/none.js"); -var _noneJsDefault = parcelHelpers.interopDefault(_noneJs); -var _silhouetteJs = require("./offset/silhouette.js"); -var _silhouetteJsDefault = parcelHelpers.interopDefault(_silhouetteJs); -var _wiggleJs = require("./offset/wiggle.js"); -var _wiggleJsDefault = parcelHelpers.interopDefault(_wiggleJs); -var _appearanceJs = require("./order/appearance.js"); -var _appearanceJsDefault = parcelHelpers.interopDefault(_appearanceJs); -var _ascendingJs = require("./order/ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./order/descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _insideOutJs = require("./order/insideOut.js"); -var _insideOutJsDefault = parcelHelpers.interopDefault(_insideOutJs); -var _noneJs1 = require("./order/none.js"); -var _noneJsDefault1 = parcelHelpers.interopDefault(_noneJs1); -var _reverseJs = require("./order/reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); - -},{"./arc.js":"lpXto","./area.js":"7vpk0","./line.js":"jLRWM","./pie.js":false,"./areaRadial.js":false,"./lineRadial.js":false,"./pointRadial.js":false,"./link.js":false,"./symbol.js":"hyGNI","./symbol/asterisk.js":false,"./symbol/circle.js":false,"./symbol/cross.js":false,"./symbol/diamond.js":false,"./symbol/diamond2.js":false,"./symbol/plus.js":false,"./symbol/square.js":false,"./symbol/square2.js":false,"./symbol/star.js":false,"./symbol/triangle.js":false,"./symbol/triangle2.js":false,"./symbol/wye.js":false,"./symbol/times.js":false,"./curve/basisClosed.js":"jDlXi","./curve/basisOpen.js":"ibrVq","./curve/basis.js":"7M9eM","./curve/bump.js":false,"./curve/bundle.js":"cEseX","./curve/cardinalClosed.js":"fflpg","./curve/cardinalOpen.js":"7Tvq2","./curve/cardinal.js":"2iU9W","./curve/catmullRomClosed.js":"bV8Z8","./curve/catmullRomOpen.js":"4v7dm","./curve/catmullRom.js":"3GXnl","./curve/linearClosed.js":"hl4Xi","./curve/linear.js":"bEzz9","./curve/monotone.js":"6A7Kk","./curve/natural.js":"1yP6t","./curve/step.js":"hq3zp","./stack.js":false,"./offset/expand.js":false,"./offset/diverging.js":false,"./offset/none.js":false,"./offset/silhouette.js":false,"./offset/wiggle.js":false,"./order/appearance.js":false,"./order/ascending.js":false,"./order/descending.js":false,"./order/insideOut.js":false,"./order/none.js":false,"./order/reverse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lpXto":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = (0, _constantJsDefault.default)(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = (0, _pathJs.withPath)(arc); - function arc() { - var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - (0, _mathJs.halfPi), a1 = endAngle.apply(this, arguments) - (0, _mathJs.halfPi), da = (0, _mathJs.abs)(a1 - a0), cw = a1 > a0; - if (!context) context = buffer = path(); - // Ensure that the outer radius is always larger than the inner radius. - if (r1 < r0) r = r1, r1 = r0, r0 = r; - // Is it a point? - if (!(r1 > (0, _mathJs.epsilon))) context.moveTo(0, 0); - else if (da > (0, _mathJs.tau) - (0, _mathJs.epsilon)) { - context.moveTo(r1 * (0, _mathJs.cos)(a0), r1 * (0, _mathJs.sin)(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > (0, _mathJs.epsilon)) { - context.moveTo(r0 * (0, _mathJs.cos)(a1), r0 * (0, _mathJs.sin)(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } else { - var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > (0, _mathJs.epsilon) && (padRadius ? +padRadius.apply(this, arguments) : (0, _mathJs.sqrt)(r0 * r0 + r1 * r1)), rc = (0, _mathJs.min)((0, _mathJs.abs)(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; - // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - if (rp > (0, _mathJs.epsilon)) { - var p0 = (0, _mathJs.asin)(rp / r0 * (0, _mathJs.sin)(ap)), p1 = (0, _mathJs.asin)(rp / r1 * (0, _mathJs.sin)(ap)); - if ((da0 -= p0 * 2) > (0, _mathJs.epsilon)) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; - else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > (0, _mathJs.epsilon)) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; - else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - var x01 = r1 * (0, _mathJs.cos)(a01), y01 = r1 * (0, _mathJs.sin)(a01), x10 = r0 * (0, _mathJs.cos)(a10), y10 = r0 * (0, _mathJs.sin)(a10); - // Apply rounded corners? - if (rc > (0, _mathJs.epsilon)) { - var x11 = r1 * (0, _mathJs.cos)(a11), y11 = r1 * (0, _mathJs.sin)(a11), x00 = r0 * (0, _mathJs.cos)(a00), y00 = r0 * (0, _mathJs.sin)(a00), oc; - // Restrict the corner radius according to the sector angle. If this - // intersection fails, it’s probably because the arc is too small, so - // disable the corner radius entirely. - if (da < (0, _mathJs.pi)) { - if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) { - var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / (0, _mathJs.sin)((0, _mathJs.acos)((ax * bx + ay * by) / ((0, _mathJs.sqrt)(ax * ax + ay * ay) * (0, _mathJs.sqrt)(bx * bx + by * by))) / 2), lc = (0, _mathJs.sqrt)(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = (0, _mathJs.min)(rc, (r0 - lc) / (kc - 1)); - rc1 = (0, _mathJs.min)(rc, (r1 - lc) / (kc + 1)); - } else rc0 = rc1 = 0; - } - } - // Is the sector collapsed to a line? - if (!(da1 > (0, _mathJs.epsilon))) context.moveTo(x01, y01); - else if (rc1 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); - context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); - // Is there no inner ring, and it’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - if (!(r0 > (0, _mathJs.epsilon)) || !(da0 > (0, _mathJs.epsilon))) context.lineTo(x10, y10); - else if (rc0 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); - context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.arc(0, 0, r0, a10, a00, cw); - } - context.closePath(); - if (buffer) return context = null, buffer + "" || null; - } - arc.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - (0, _mathJs.pi) / 2; - return [ - (0, _mathJs.cos)(a) * r, - (0, _mathJs.sin)(a) * r - ]; - }; - arc.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : innerRadius; - }; - arc.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : outerRadius; - }; - arc.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : cornerRadius; - }; - arc.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padRadius; - }; - arc.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : startAngle; - }; - arc.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : endAngle; - }; - arc.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padAngle; - }; - arc.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, arc) : context; - }; - return arc; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _pathJs = require("./path.js"); -function arcInnerRadius(d) { - return d.innerRadius; -} -function arcOuterRadius(d) { - return d.outerRadius; -} -function arcStartAngle(d) { - return d.startAngle; -} -function arcEndAngle(d) { - return d.endAngle; -} -function arcPadAngle(d) { - return d && d.padAngle; // Note: optional! -} -function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { - var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; - if (t * t < (0, _mathJs.epsilon)) return; - t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; - return [ - x0 + t * x10, - y0 + t * y10 - ]; -} -// Compute perpendicular offset line of length rc. -// http://mathworld.wolfram.com/Circle-LineIntersection.html -function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { - var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / (0, _mathJs.sqrt)(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * (0, _mathJs.sqrt)((0, _mathJs.max)(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; - // Pick the closer of the two intersection points. - // TODO Is there a faster way to determine which intersection to use? - if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + }; + function centroidPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)); + } + function centroidPointCartesian(x2, y2, z2) { + ++W0; + X0$1 += (x2 - X0$1) / W0; + Y0$1 += (y2 - Y0$1) / W0; + Z0$1 += (z2 - Z0$1) / W0; + } + function centroidLineStart$1() { + centroidStream$1.point = centroidLinePointFirst; + } + function centroidLinePointFirst(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidStream$1.point = centroidLinePoint; + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLinePoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z2 = sin$1(phi2), w2 = atan2(sqrt$1((w2 = y0$4 * z2 - z0 * y2) * w2 + (w2 = z0 * x2 - x0$4 * z2) * w2 + (w2 = x0$4 * y2 - y0$4 * x2) * w2), x0$4 * x2 + y0$4 * y2 + z0 * z2); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z2)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLineEnd$1() { + centroidStream$1.point = centroidPoint$1; + } + function centroidRingStart$1() { + centroidStream$1.point = centroidRingPointFirst; + } + function centroidRingEnd$1() { + centroidRingPoint(lambda00, phi00); + centroidStream$1.point = centroidPoint$1; + } + function centroidRingPointFirst(lambda, phi2) { + lambda00 = lambda, phi00 = phi2; + lambda *= radians, phi2 *= radians; + centroidStream$1.point = centroidRingPoint; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidRingPoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z2 = sin$1(phi2), cx = y0$4 * z2 - z0 * y2, cy = z0 * x2 - x0$4 * z2, cz = x0$4 * y2 - y0$4 * x2, m2 = hypot(cx, cy, cz), w2 = asin$1(m2), v = m2 && -w2 / m2; + X2$1.add(v * cx); + Y2$1.add(v * cy); + Z2$1.add(v * cz); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z2)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function geoCentroid$1(object2) { + W0 = W1 = X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = 0; + X2$1 = new Adder(); + Y2$1 = new Adder(); + Z2$1 = new Adder(); + geoStream(object2, centroidStream$1); + var x2 = +X2$1, y2 = +Y2$1, z2 = +Z2$1, m2 = hypot(x2, y2, z2); + if (m2 < epsilon2) { + x2 = X1$1, y2 = Y1$1, z2 = Z1$1; + if (W1 < epsilon$3) x2 = X0$1, y2 = Y0$1, z2 = Z0$1; + m2 = hypot(x2, y2, z2); + if (m2 < epsilon2) return [NaN, NaN]; + } + return [atan2(y2, x2) * degrees, asin$1(z2 / m2) * degrees]; + } + function compose(a2, b2) { + function compose2(x2, y2) { + return x2 = a2(x2, y2), b2(x2[0], x2[1]); + } + if (a2.invert && b2.invert) compose2.invert = function(x2, y2) { + return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]); + }; + return compose2; + } + function rotationIdentity(lambda, phi2) { + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + } + rotationIdentity.invert = rotationIdentity; + function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { + return (deltaLambda %= tau$1) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; + } + function forwardRotationLambda(deltaLambda) { + return function(lambda, phi2) { + lambda += deltaLambda; + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + }; + } + function rotationLambda(deltaLambda) { + var rotation2 = forwardRotationLambda(deltaLambda); + rotation2.invert = forwardRotationLambda(-deltaLambda); + return rotation2; + } + function rotationPhiGamma(deltaPhi, deltaGamma) { + var cosDeltaPhi = cos$1(deltaPhi), sinDeltaPhi = sin$1(deltaPhi), cosDeltaGamma = cos$1(deltaGamma), sinDeltaGamma = sin$1(deltaGamma); + function rotation2(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z2 = sin$1(phi2), k = z2 * cosDeltaPhi + x2 * sinDeltaPhi; + return [ + atan2(y2 * cosDeltaGamma - k * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi), + asin$1(k * cosDeltaGamma + y2 * sinDeltaGamma) + ]; + } + rotation2.invert = function(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z2 = sin$1(phi2), k = z2 * cosDeltaGamma - y2 * sinDeltaGamma; + return [ + atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k * sinDeltaPhi), + asin$1(k * cosDeltaPhi - x2 * sinDeltaPhi) + ]; + }; + return rotation2; + } + function rotation(rotate2) { + rotate2 = rotateRadians(rotate2[0] * radians, rotate2[1] * radians, rotate2.length > 2 ? rotate2[2] * radians : 0); + function forward(coordinates) { + coordinates = rotate2(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate2.invert(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + }; + return forward; + } + function circleStream(stream2, radius2, delta, direction, t02, t12) { + if (!delta) return; + var cosRadius = cos$1(radius2), sinRadius = sin$1(radius2), step = direction * delta; + if (t02 == null) { + t02 = radius2 + direction * tau$1; + t12 = radius2 - step / 2; + } else { + t02 = circleRadius(cosRadius, t02); + t12 = circleRadius(cosRadius, t12); + if (direction > 0 ? t02 < t12 : t02 > t12) t02 += direction * tau$1; + } + for (var point2, t = t02; direction > 0 ? t > t12 : t < t12; t -= step) { + point2 = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]); + stream2.point(point2[0], point2[1]); + } + } + function circleRadius(cosRadius, point2) { + point2 = cartesian(point2), point2[0] -= cosRadius; + cartesianNormalizeInPlace(point2); + var radius2 = acos(-point2[1]); + return ((-point2[2] < 0 ? -radius2 : radius2) + tau$1 - epsilon$3) % tau$1; + } + function clipBuffer() { + var lines = [], line2; return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; -} - -},{"./constant.js":"9zjIM","./math.js":"74irK","./path.js":"g9lLY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9zjIM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function constant() { - return x; - }; + point: function(x2, y2, m2) { + line2.push([x2, y2, m2]); + }, + lineStart: function() { + lines.push(line2 = []); + }, + lineEnd: noop$2, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + }, + result: function() { + var result = lines; + lines = []; + line2 = null; + return result; + } + }; + } + function pointEqual(a2, b2) { + return abs$1(a2[0] - b2[0]) < epsilon$3 && abs$1(a2[1] - b2[1]) < epsilon$3; + } + function Intersection(point2, points2, other, entry2) { + this.x = point2; + this.z = points2; + this.o = other; + this.e = entry2; + this.v = false; + this.n = this.p = null; + } + function clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2) { + var subject = [], clip2 = [], i, n; + segments2.forEach(function(segment) { + if ((n2 = segment.length - 1) <= 0) return; + var n2, p02 = segment[0], p1 = segment[n2], x2; + if (pointEqual(p02, p1)) { + if (!p02[2] && !p1[2]) { + stream2.lineStart(); + for (i = 0; i < n2; ++i) stream2.point((p02 = segment[i])[0], p02[1]); + stream2.lineEnd(); + return; + } + p1[0] += 2 * epsilon$3; + } + subject.push(x2 = new Intersection(p02, segment, null, true)); + clip2.push(x2.o = new Intersection(p02, null, x2, false)); + subject.push(x2 = new Intersection(p1, segment, null, false)); + clip2.push(x2.o = new Intersection(p1, null, x2, true)); }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"74irK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -const abs = Math.abs; -const atan2 = Math.atan2; -const cos = Math.cos; -const max = Math.max; -const min = Math.min; -const sin = Math.sin; -const sqrt = Math.sqrt; -const epsilon = 1e-12; -const pi = Math.PI; -const halfPi = pi / 2; -const tau = 2 * pi; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g9lLY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "withPath", ()=>withPath); -var _d3Path = require("d3-path"); -function withPath(shape) { - let digits = 3; - shape.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - return shape; - }; - return ()=>new (0, _d3Path.Path)(digits); -} - -},{"d3-path":"7nzmW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7nzmW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>(0, _pathJs.Path)); -parcelHelpers.export(exports, "path", ()=>(0, _pathJs.path)); -parcelHelpers.export(exports, "pathRound", ()=>(0, _pathJs.pathRound)); -var _pathJs = require("./path.js"); - -},{"./path.js":"5aBf0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5aBf0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>Path); -parcelHelpers.export(exports, "path", ()=>path); -parcelHelpers.export(exports, "pathRound", ()=>pathRound); -const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon; -function append(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - let d = Math.floor(digits); - if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`); - if (d > 15) return append; - const k = 10 ** d; - return function(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; - }; -} -class Path { - constructor(digits){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - this._append = digits == null ? append : appendRound(digits); - } - moveTo(x, y) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; + if (!subject.length) return; + clip2.sort(compareIntersection2); + link(subject); + link(clip2); + for (i = 0, n = clip2.length; i < n; ++i) { + clip2[i].e = startInside = !startInside; + } + var start = subject[0], points2, point2; + while (1) { + var current = start, isSubject = true; + while (current.v) if ((current = current.n) === start) return; + points2 = current.z; + stream2.lineStart(); + do { + current.v = current.o.v = true; + if (current.e) { + if (isSubject) { + for (i = 0, n = points2.length; i < n; ++i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.n.x, 1, stream2); + } + current = current.n; + } else { + if (isSubject) { + points2 = current.p.z; + for (i = points2.length - 1; i >= 0; --i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.p.x, -1, stream2); + } + current = current.p; + } + current = current.o; + points2 = current.z; + isSubject = !isSubject; + } while (!current.v); + stream2.lineEnd(); } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._append`Z`; + } + function link(array2) { + if (!(n = array2.length)) return; + var n, i = 0, a2 = array2[0], b2; + while (++i < n) { + a2.n = b2 = array2[i]; + b2.p = a2; + a2 = b2; + } + a2.n = b2 = array2[0]; + b2.p = a2; + } + function longitude(point2) { + return abs$1(point2[0]) <= pi$1 ? point2[0] : sign(point2[0]) * ((abs$1(point2[0]) + pi$1) % tau$1 - pi$1); + } + function polygonContains(polygon, point2) { + var lambda = longitude(point2), phi2 = point2[1], sinPhi = sin$1(phi2), normal = [sin$1(lambda), -cos$1(lambda), 0], angle2 = 0, winding = 0; + var sum2 = new Adder(); + if (sinPhi === 1) phi2 = halfPi$1 + epsilon$3; + else if (sinPhi === -1) phi2 = -halfPi$1 - epsilon$3; + for (var i = 0, n = polygon.length; i < n; ++i) { + if (!(m2 = (ring = polygon[i]).length)) continue; + var ring, m2, point0 = ring[m2 - 1], lambda02 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi02 = sin$1(phi02), cosPhi02 = cos$1(phi02); + for (var j = 0; j < m2; ++j, lambda02 = lambda12, sinPhi02 = sinPhi1, cosPhi02 = cosPhi1, point0 = point1) { + var point1 = ring[j], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin$1(phi12), cosPhi1 = cos$1(phi12), delta = lambda12 - lambda02, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi$1, k = sinPhi02 * sinPhi1; + sum2.add(atan2(k * sign2 * sin$1(absDelta), cosPhi02 * cosPhi1 + k * cos$1(absDelta))); + angle2 += antimeridian ? delta + sign2 * tau$1 : delta; + if (antimeridian ^ lambda02 >= lambda ^ lambda12 >= lambda) { + var arc2 = cartesianCross(cartesian(point0), cartesian(point1)); + cartesianNormalizeInPlace(arc2); + var intersection2 = cartesianCross(normal, arc2); + cartesianNormalizeInPlace(intersection2); + var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection2[2]); + if (phi2 > phiArc || phi2 === phiArc && (arc2[0] || arc2[1])) { + winding += antimeridian ^ delta >= 0 ? 1 : -1; + } } + } + } + return (angle2 < -epsilon$3 || angle2 < epsilon$3 && sum2 < -epsilon2) ^ winding & 1; + } + function clip$1(pointVisible, clipLine2, interpolate2, start) { + return function(sink) { + var line2 = clipLine2(sink), ringBuffer = clipBuffer(), ringSink = clipLine2(ringBuffer), polygonStarted = false, polygon, segments2, ring; + var clip2 = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + clip2.point = pointRing; + clip2.lineStart = ringStart; + clip2.lineEnd = ringEnd; + segments2 = []; + polygon = []; + }, + polygonEnd: function() { + clip2.point = point2; + clip2.lineStart = lineStart; + clip2.lineEnd = lineEnd; + segments2 = merge$4(segments2); + var startInside = polygonContains(polygon, start); + if (segments2.length) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + clipRejoin(segments2, compareIntersection, startInside, interpolate2, sink); + } else if (startInside) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + } + if (polygonStarted) sink.polygonEnd(), polygonStarted = false; + segments2 = polygon = null; + }, + sphere: function() { + sink.polygonStart(); + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + sink.polygonEnd(); + } + }; + function point2(lambda, phi2) { + if (pointVisible(lambda, phi2)) sink.point(lambda, phi2); + } + function pointLine(lambda, phi2) { + line2.point(lambda, phi2); + } + function lineStart() { + clip2.point = pointLine; + line2.lineStart(); + } + function lineEnd() { + clip2.point = point2; + line2.lineEnd(); + } + function pointRing(lambda, phi2) { + ring.push([lambda, phi2]); + ringSink.point(lambda, phi2); + } + function ringStart() { + ringSink.lineStart(); + ring = []; + } + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringSink.lineEnd(); + var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m2, segment, point3; + ring.pop(); + polygon.push(ring); + ring = null; + if (!n) return; + if (clean & 1) { + segment = ringSegments[0]; + if ((m2 = segment.length - 1) > 0) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + for (i = 0; i < m2; ++i) sink.point((point3 = segment[i])[0], point3[1]); + sink.lineEnd(); + } + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments2.push(ringSegments.filter(validSegment)); + } + return clip2; + }; + } + function validSegment(segment) { + return segment.length > 1; + } + function compareIntersection(a2, b2) { + return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi$1 - epsilon$3 : halfPi$1 - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi$1 - epsilon$3 : halfPi$1 - b2[1]); + } + const clipAntimeridian = clip$1( + function() { + return true; + }, + clipAntimeridianLine, + clipAntimeridianInterpolate, + [-pi$1, -halfPi$1] + ); + function clipAntimeridianLine(stream2) { + var lambda02 = NaN, phi02 = NaN, sign0 = NaN, clean; + return { + lineStart: function() { + stream2.lineStart(); + clean = 1; + }, + point: function(lambda12, phi12) { + var sign1 = lambda12 > 0 ? pi$1 : -pi$1, delta = abs$1(lambda12 - lambda02); + if (abs$1(delta - pi$1) < epsilon$3) { + stream2.point(lambda02, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi$1 : -halfPi$1); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + stream2.point(lambda12, phi02); + clean = 0; + } else if (sign0 !== sign1 && delta >= pi$1) { + if (abs$1(lambda02 - sign0) < epsilon$3) lambda02 -= sign0 * epsilon$3; + if (abs$1(lambda12 - sign1) < epsilon$3) lambda12 -= sign1 * epsilon$3; + phi02 = clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + clean = 0; + } + stream2.point(lambda02 = lambda12, phi02 = phi12); + sign0 = sign1; + }, + lineEnd: function() { + stream2.lineEnd(); + lambda02 = phi02 = NaN; + }, + clean: function() { + return 2 - clean; + } + }; + } + function clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12) { + var cosPhi02, cosPhi1, sinLambda0Lambda1 = sin$1(lambda02 - lambda12); + return abs$1(sinLambda0Lambda1) > epsilon$3 ? atan((sin$1(phi02) * (cosPhi1 = cos$1(phi12)) * sin$1(lambda12) - sin$1(phi12) * (cosPhi02 = cos$1(phi02)) * sin$1(lambda02)) / (cosPhi02 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2; + } + function clipAntimeridianInterpolate(from, to, direction, stream2) { + var phi2; + if (from == null) { + phi2 = direction * halfPi$1; + stream2.point(-pi$1, phi2); + stream2.point(0, phi2); + stream2.point(pi$1, phi2); + stream2.point(pi$1, 0); + stream2.point(pi$1, -phi2); + stream2.point(0, -phi2); + stream2.point(-pi$1, -phi2); + stream2.point(-pi$1, 0); + stream2.point(-pi$1, phi2); + } else if (abs$1(from[0] - to[0]) > epsilon$3) { + var lambda = from[0] < to[0] ? pi$1 : -pi$1; + phi2 = direction * lambda / 2; + stream2.point(-lambda, phi2); + stream2.point(0, phi2); + stream2.point(lambda, phi2); + } else { + stream2.point(to[0], to[1]); } - lineTo(x, y) { - this._append`L${this._x1 = +x},${this._y1 = +y}`; + } + function clipCircle(radius2) { + var cr2 = cos$1(radius2), delta = 2 * radians, smallRadius = cr2 > 0, notHemisphere = abs$1(cr2) > epsilon$3; + function interpolate2(from, to, direction, stream2) { + circleStream(stream2, radius2, delta, direction, from, to); } - quadraticCurveTo(x1, y1, x, y) { - this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`; + function visible(lambda, phi2) { + return cos$1(lambda) * cos$1(phi2) > cr2; } - bezierCurveTo(x1, y1, x2, y2, x, y) { - this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`; + function clipLine2(stream2) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(lambda, phi2) { + var point1 = [lambda, phi2], point2, v = visible(lambda, phi2), c2 = smallRadius ? v ? 0 : code(lambda, phi2) : v ? code(lambda + (lambda < 0 ? pi$1 : -pi$1), phi2) : 0; + if (!point0 && (v00 = v0 = v)) stream2.lineStart(); + if (v !== v0) { + point2 = intersect2(point0, point1); + if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) + point1[2] = 1; + } + if (v !== v0) { + clean = 0; + if (v) { + stream2.lineStart(); + point2 = intersect2(point1, point0); + stream2.point(point2[0], point2[1]); + } else { + point2 = intersect2(point0, point1); + stream2.point(point2[0], point2[1], 2); + stream2.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c2 & c0) && (t = intersect2(point1, point0, true))) { + clean = 0; + if (smallRadius) { + stream2.lineStart(); + stream2.point(t[0][0], t[0][1]); + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + } else { + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(t[0][0], t[0][1], 3); + } + } + } + if (v && (!point0 || !pointEqual(point0, point1))) { + stream2.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c2; + }, + lineEnd: function() { + if (v0) stream2.lineEnd(); + point0 = null; + }, + // Rejoin first and last segments if there were intersections and the first + // and last points were visible. + clean: function() { + return clean | (v00 && v0) << 1; + } + }; + } + function intersect2(a2, b2, two) { + var pa2 = cartesian(a2), pb = cartesian(b2); + var n1 = [1, 0, 0], n2 = cartesianCross(pa2, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a2; + var c1 = cr2 * n2n2 / determinant, c2 = -cr2 * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A5 = cartesianScale(n1, c1), B2 = cartesianScale(n2, c2); + cartesianAddInPlace(A5, B2); + var u2 = n1xn2, w2 = cartesianDot(A5, u2), uu = cartesianDot(u2, u2), t22 = w2 * w2 - uu * (cartesianDot(A5, A5) - 1); + if (t22 < 0) return; + var t = sqrt$1(t22), q = cartesianScale(u2, (-w2 - t) / uu); + cartesianAddInPlace(q, A5); + q = spherical(q); + if (!two) return q; + var lambda02 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2; + if (lambda12 < lambda02) z2 = lambda02, lambda02 = lambda12, lambda12 = z2; + var delta2 = lambda12 - lambda02, polar = abs$1(delta2 - pi$1) < epsilon$3, meridian = polar || delta2 < epsilon$3; + if (!polar && phi12 < phi02) z2 = phi02, phi02 = phi12, phi12 = z2; + if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs$1(q[0] - lambda02) < epsilon$3 ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi$1 ^ (lambda02 <= q[0] && q[0] <= lambda12)) { + var q1 = cartesianScale(u2, (-w2 + t) / uu); + cartesianAddInPlace(q1, A5); + return [q, spherical(q1)]; + } } - arcTo(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; - // Is this path empty? Move to (x1,y1). - if (this._x1 === null) this._append`M${this._x1 = x1},${this._y1 = y1}`; - else if (!(l01_2 > epsilon)) ; - else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._append`L${this._x1 = x1},${this._y1 = y1}`; - else { - let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; - // If the start tangent is not coincident with (x0,y0), line to. - if (Math.abs(t01 - 1) > epsilon) this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`; - this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`; - } - } - arc(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; - // Is this path empty? Move to (x0,y0). - if (this._x1 === null) this._append`M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._append`L${x0},${y0}`; - // Is this arc empty? We’re done. - if (!r) return; - // Does the angle go the wrong way? Flip the direction. - if (da < 0) da = da % tau + tau; - // Is this a complete circle? Draw two arcs to complete the circle. - if (da > tauEpsilon) this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`; - else if (da > epsilon) this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`; - } - rect(x, y, w, h) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`; + function code(lambda, phi2) { + var r = smallRadius ? radius2 : pi$1 - radius2, code2 = 0; + if (lambda < -r) code2 |= 1; + else if (lambda > r) code2 |= 2; + if (phi2 < -r) code2 |= 4; + else if (phi2 > r) code2 |= 8; + return code2; } - toString() { - return this._; - } -} -function path() { - return new Path; -} -// Allow instanceof d3.path -path.prototype = Path.prototype; -function pathRound(digits = 3) { - return new Path(+digits); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7vpk0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x0, y0, y1) { - var x1 = null, defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(area); - x0 = typeof x0 === "function" ? x0 : x0 === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(+x0); - y0 = typeof y0 === "function" ? y0 : y0 === undefined ? (0, _constantJsDefault.default)(0) : (0, _constantJsDefault.default)(+y0); - y1 = typeof y1 === "function" ? y1 : y1 === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(+y1); - function area(data) { - var i, j, k, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for(k = i - 1; k >= j; --k)output.point(x0z[k], y0z[k]); - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - if (buffer) return output = null, buffer + "" || null; - } - function arealine() { - return (0, _lineJsDefault.default)().defined(defined).curve(curve).context(context); - } - area.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), x1 = null, area) : x0; - }; - area.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x0; - }; - area.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x1; - }; - area.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), y1 = null, area) : y0; - }; - area.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y0; - }; - area.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y1; - }; - area.lineX0 = area.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - area.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - area.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - area.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), area) : defined; - }; - area.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - area.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - return area; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"Qn4uj","./constant.js":"9zjIM","./curve/linear.js":"bEzz9","./line.js":"jLRWM","./path.js":"g9lLY","./point.js":"dpSNq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Qn4uj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -var slice = Array.prototype.slice; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bEzz9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Linear(context); - }); -function Linear(context) { - this._context = context; -} -Linear.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - this._context.lineTo(x, y); - break; - } + return clip$1(visible, clipLine2, interpolate2, smallRadius ? [0, -radius2] : [-pi$1, radius2 - pi$1]); + } + function clipLine(a2, b2, x02, y02, x12, y12) { + var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r; + r = x02 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dx > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = x12 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dx > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + r = y02 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dy > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = y12 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dy > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + if (t02 > 0) a2[0] = ax + t02 * dx, a2[1] = ay + t02 * dy; + if (t12 < 1) b2[0] = ax + t12 * dx, b2[1] = ay + t12 * dy; + return true; + } + var clipMax = 1e9, clipMin = -clipMax; + function clipRectangle(x02, y02, x12, y12) { + function visible(x2, y2) { + return x02 <= x2 && x2 <= x12 && y02 <= y2 && y2 <= y12; + } + function interpolate2(from, to, direction, stream2) { + var a2 = 0, a1 = 0; + if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { + do + stream2.point(a2 === 0 || a2 === 3 ? x02 : x12, a2 > 1 ? y12 : y02); + while ((a2 = (a2 + direction + 4) % 4) !== a1); + } else { + stream2.point(to[0], to[1]); + } } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jLRWM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(line); - x = typeof x === "function" ? x : x === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(x); - y = typeof y === "function" ? y : y === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(y); - function line(data) { - var i, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer; - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart(); - else output.lineEnd(); - } - if (defined0) output.point(+x(d, i, data), +y(d, i, data)); + function corner(p, direction) { + return abs$1(p[0] - x02) < epsilon$3 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x12) < epsilon$3 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y02) < epsilon$3 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; + } + function compareIntersection2(a2, b2) { + return comparePoint(a2.x, b2.x); + } + function comparePoint(a2, b2) { + var ca = corner(a2, 1), cb = corner(b2, 1); + return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[0]; + } + return function(stream2) { + var activeStream = stream2, bufferStream = clipBuffer(), segments2, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; + var clipStream = { + point: point2, + lineStart, + lineEnd, + polygonStart, + polygonEnd + }; + function point2(x2, y2) { + if (visible(x2, y2)) activeStream.point(x2, y2); + } + function polygonInside() { + var winding = 0; + for (var i = 0, n = polygon.length; i < n; ++i) { + for (var ring2 = polygon[i], j = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j < m2; ++j) { + a0 = b0, a1 = b1, point3 = ring2[j], b0 = point3[0], b1 = point3[1]; + if (a1 <= y12) { + if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x02 - a0)) ++winding; + } else { + if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x02 - a0)) --winding; } - if (buffer) return output = null, buffer + "" || null; - } - line.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : x; - }; - line.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : y; - }; - line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), line) : defined; - }; - line.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - line.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - return line; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"Qn4uj","./constant.js":"9zjIM","./curve/linear.js":"bEzz9","./path.js":"g9lLY","./point.js":"dpSNq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dpSNq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -function x(p) { - return p[0]; -} -function y(p) { - return p[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hyGNI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symbolsFill", ()=>symbolsFill); -parcelHelpers.export(exports, "symbolsStroke", ()=>symbolsStroke); -parcelHelpers.export(exports, "default", ()=>Symbol); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _pathJs = require("./path.js"); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -const symbolsFill = [ - (0, _circleJsDefault.default), - (0, _crossJsDefault.default), - (0, _diamondJsDefault.default), - (0, _squareJsDefault.default), - (0, _starJsDefault.default), - (0, _triangleJsDefault.default), - (0, _wyeJsDefault.default) -]; -const symbolsStroke = [ - (0, _circleJsDefault.default), - (0, _plusJsDefault.default), - (0, _timesJsDefault.default), - (0, _triangle2JsDefault.default), - (0, _asteriskJsDefault.default), - (0, _square2JsDefault.default), - (0, _diamond2JsDefault.default) -]; -function Symbol(type, size) { - let context = null, path = (0, _pathJs.withPath)(symbol); - type = typeof type === "function" ? type : (0, _constantJsDefault.default)(type || (0, _circleJsDefault.default)); - size = typeof size === "function" ? size : (0, _constantJsDefault.default)(size === undefined ? 64 : +size); - function symbol() { - let buffer; - if (!context) context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), symbol) : type; - }; - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), symbol) : size; - }; - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - return symbol; -} - -},{"./constant.js":"9zjIM","./path.js":"g9lLY","./symbol/asterisk.js":"hRLT0","./symbol/circle.js":"crWIh","./symbol/cross.js":"6bCEC","./symbol/diamond.js":"ekOwj","./symbol/diamond2.js":"2a3OP","./symbol/plus.js":"lmTLp","./symbol/square.js":"kiI0g","./symbol/square2.js":"fJ0sL","./symbol/star.js":"j2VKI","./symbol/triangle.js":"lg6wx","./symbol/triangle2.js":"ejtY4","./symbol/wye.js":"2zs6m","./symbol/times.js":"dIFHp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hRLT0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size + (0, _mathJs.min)(size / 28, 0.75)) * 0.59436; - const t = r / 2; - const u = t * sqrt3; - context.moveTo(0, r); - context.lineTo(0, -r); - context.moveTo(-u, -t); - context.lineTo(u, t); - context.moveTo(-u, t); - context.lineTo(u, -t); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"crWIh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / (0, _mathJs.pi)); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, (0, _mathJs.tau)); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6bCEC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / 5) / 2; - context.moveTo(-3 * r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, -3 * r); - context.lineTo(r, -3 * r); - context.lineTo(r, -r); - context.lineTo(3 * r, -r); - context.lineTo(3 * r, r); - context.lineTo(r, r); - context.lineTo(r, 3 * r); - context.lineTo(-r, 3 * r); - context.lineTo(-r, r); - context.lineTo(-3 * r, r); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ekOwj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const tan30 = (0, _mathJs.sqrt)(1 / 3); -const tan30_2 = tan30 * 2; -exports.default = { - draw (context, size) { - const y = (0, _mathJs.sqrt)(size / tan30_2); - const x = y * tan30; - context.moveTo(0, -y); - context.lineTo(x, 0); - context.lineTo(0, y); - context.lineTo(-x, 0); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2a3OP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.62625; - context.moveTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.lineTo(-r, 0); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lmTLp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 7, 2)) * 0.87559; - context.moveTo(-r, 0); - context.lineTo(r, 0); - context.moveTo(0, r); - context.lineTo(0, -r); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kiI0g":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const w = (0, _mathJs.sqrt)(size); - const x = -w / 2; - context.rect(x, x, w, w); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fJ0sL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.4431; - context.moveTo(r, r); - context.lineTo(r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, r); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2VKI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const ka = 0.89081309152928522810; -const kr = (0, _mathJs.sin)((0, _mathJs.pi) / 10) / (0, _mathJs.sin)(7 * (0, _mathJs.pi) / 10); -const kx = (0, _mathJs.sin)((0, _mathJs.tau) / 10) * kr; -const ky = -(0, _mathJs.cos)((0, _mathJs.tau) / 10) * kr; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size * ka); - const x = kx * r; - const y = ky * r; - context.moveTo(0, -r); - context.lineTo(x, y); - for(let i = 1; i < 5; ++i){ - const a = (0, _mathJs.tau) * i / 5; - const c = (0, _mathJs.cos)(a); - const s = (0, _mathJs.sin)(a); - context.lineTo(s * r, -c * r); - context.lineTo(c * x - s * y, s * x + c * y); - } - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lg6wx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const y = -(0, _mathJs.sqrt)(size / (sqrt3 * 3)); - context.moveTo(0, y * 2); - context.lineTo(-sqrt3 * y, -y); - context.lineTo(sqrt3 * y, -y); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ejtY4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const s = (0, _mathJs.sqrt)(size) * 0.6824; - const t = s / 2; - const u = s * sqrt3 / 2; // cos(Math.PI / 6) - context.moveTo(0, -s); - context.lineTo(u, t); - context.lineTo(-u, t); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2zs6m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const c = -0.5; -const s = (0, _mathJs.sqrt)(3) / 2; -const k = 1 / (0, _mathJs.sqrt)(12); -const a = (k / 2 + 1) * 3; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / a); - const x0 = r / 2, y0 = r * k; - const x1 = x0, y1 = r * k + r; - const x2 = -x1, y2 = y1; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.lineTo(c * x0 - s * y0, s * x0 + c * y0); - context.lineTo(c * x1 - s * y1, s * x1 + c * y1); - context.lineTo(c * x2 - s * y2, s * x2 + c * y2); - context.lineTo(c * x0 + s * y0, c * y0 - s * x0); - context.lineTo(c * x1 + s * y1, c * y1 - s * x1); - context.lineTo(c * x2 + s * y2, c * y2 - s * x2); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dIFHp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 6, 1.7)) * 0.6189; - context.moveTo(-r, -r); - context.lineTo(r, r); - context.moveTo(-r, r); - context.lineTo(r, -r); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jDlXi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _basisJs = require("./basis.js"); -function BasisClosed(context) { - this._context = context; -} -BasisClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x2, this._y2); - this._context.closePath(); - break; - case 2: - this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); - this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); - this._context.closePath(); - break; - case 3: - this.point(this._x2, this._y2); - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - break; - } - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x2 = x, this._y2 = y; - break; - case 1: - this._point = 2; - this._x3 = x, this._y3 = y; - break; - case 2: - this._point = 3; - this._x4 = x, this._y4 = y; - this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); - break; - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"../noop.js":"1qyaT","./basis.js":"7M9eM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1qyaT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() {}); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7M9eM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Basis", ()=>Basis); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Basis(context); - }); -function point(that, x, y) { - that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6); -} -function Basis(context) { - this._context = context; -} -Basis.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 3: - point(this, this._x1, this._y1); // falls through - case 2: - this._context.lineTo(this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through - default: - point(this, x, y); - break; + } } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; + return winding; + } + function polygonStart() { + activeStream = bufferStream, segments2 = [], polygon = [], clean = true; + } + function polygonEnd() { + var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments2 = merge$4(segments2)).length; + if (cleanInside || visible2) { + stream2.polygonStart(); + if (cleanInside) { + stream2.lineStart(); + interpolate2(null, null, 1, stream2); + stream2.lineEnd(); + } + if (visible2) { + clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2); + } + stream2.polygonEnd(); + } + activeStream = stream2, segments2 = polygon = ring = null; + } + function lineStart() { + clipStream.point = linePoint2; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + function lineEnd() { + if (segments2) { + linePoint2(x__, y__); + if (v__ && v_) bufferStream.rejoin(); + segments2.push(bufferStream.result()); + } + clipStream.point = point2; + if (v_) activeStream.lineEnd(); + } + function linePoint2(x2, y2) { + var v = visible(x2, y2); + if (polygon) ring.push([x2, y2]); + if (first) { + x__ = x2, y__ = y2, v__ = v; + first = false; + if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + } + } else { + if (v && v_) activeStream.point(x2, y2); + else { + var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))]; + if (clipLine(a2, b2, x02, y02, x12, y12)) { + if (!v_) { + activeStream.lineStart(); + activeStream.point(a2[0], a2[1]); + } + activeStream.point(b2[0], b2[1]); + if (!v) activeStream.lineEnd(); + clean = false; + } else if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + clean = false; + } + } + } + x_ = x2, y_ = y2, v_ = v; + } + return clipStream; + }; + } + function graticuleX(y02, y12, dy) { + var y2 = range$3(y02, y12 - epsilon$3, dy).concat(y12); + return function(x2) { + return y2.map(function(y3) { + return [x2, y3]; + }); + }; + } + function graticuleY(x02, x12, dx) { + var x2 = range$3(x02, x12 - epsilon$3, dx).concat(x12); + return function(y2) { + return x2.map(function(x3) { + return [x3, y2]; + }); + }; + } + function graticule() { + var x12, x02, X12, X02, y12, y02, Y12, Y02, dx = 10, dy = dx, DX = 90, DY = 360, x2, y2, X3, Y3, precision = 2.5; + function graticule2() { + return { type: "MultiLineString", coordinates: lines() }; } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ibrVq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisOpen(context); - }); -var _basisJs = require("./basis.js"); -function BasisOpen(context) { - this._context = context; -} -BasisOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; - this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); - break; - case 3: - this._point = 4; // falls through - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"./basis.js":"7M9eM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEseX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _basisJs = require("./basis.js"); -function Bundle(context, beta) { - this._basis = new (0, _basisJs.Basis)(context); - this._beta = beta; -} -Bundle.prototype = { - lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); + function lines() { + return range$3(ceil(X02 / DX) * DX, X12, DX).map(X3).concat(range$3(ceil(Y02 / DY) * DY, Y12, DY).map(Y3)).concat(range$3(ceil(x02 / dx) * dx, x12, dx).filter(function(x3) { + return abs$1(x3 % DX) > epsilon$3; + }).map(x2)).concat(range$3(ceil(y02 / dy) * dy, y12, dy).filter(function(y3) { + return abs$1(y3 % DY) > epsilon$3; + }).map(y2)); + } + graticule2.lines = function() { + return lines().map(function(coordinates) { + return { type: "LineString", coordinates }; + }); + }; + graticule2.outline = function() { + return { + type: "Polygon", + coordinates: [ + X3(X02).concat( + Y3(Y12).slice(1), + X3(X12).reverse().slice(1), + Y3(Y02).reverse().slice(1) + ) + ] + }; + }; + graticule2.extent = function(_) { + if (!arguments.length) return graticule2.extentMinor(); + return graticule2.extentMajor(_).extentMinor(_); + }; + graticule2.extentMajor = function(_) { + if (!arguments.length) return [[X02, Y02], [X12, Y12]]; + X02 = +_[0][0], X12 = +_[1][0]; + Y02 = +_[0][1], Y12 = +_[1][1]; + if (X02 > X12) _ = X02, X02 = X12, X12 = _; + if (Y02 > Y12) _ = Y02, Y02 = Y12, Y12 = _; + return graticule2.precision(precision); + }; + graticule2.extentMinor = function(_) { + if (!arguments.length) return [[x02, y02], [x12, y12]]; + x02 = +_[0][0], x12 = +_[1][0]; + y02 = +_[0][1], y12 = +_[1][1]; + if (x02 > x12) _ = x02, x02 = x12, x12 = _; + if (y02 > y12) _ = y02, y02 = y12, y12 = _; + return graticule2.precision(precision); + }; + graticule2.step = function(_) { + if (!arguments.length) return graticule2.stepMinor(); + return graticule2.stepMajor(_).stepMinor(_); + }; + graticule2.stepMajor = function(_) { + if (!arguments.length) return [DX, DY]; + DX = +_[0], DY = +_[1]; + return graticule2; + }; + graticule2.stepMinor = function(_) { + if (!arguments.length) return [dx, dy]; + dx = +_[0], dy = +_[1]; + return graticule2; + }; + graticule2.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x2 = graticuleX(y02, y12, 90); + y2 = graticuleY(x02, x12, precision); + X3 = graticuleX(Y02, Y12, 90); + Y3 = graticuleY(X02, X12, precision); + return graticule2; + }; + return graticule2.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]); + } + const identity = (x2) => x2; + var areaSum = new Adder(), areaRingSum = new Adder(), x00$2, y00$2, x0$3, y0$3; + var areaStream = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaStream.lineStart = areaRingStart; + areaStream.lineEnd = areaRingEnd; }, - lineEnd: function() { - var x = this._x, y = this._y, j = x.length - 1; - if (j > 0) { - var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t; - while(++i <= j){ - t = i / j; - this._basis.point(this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)); - } - } - this._x = this._y = null; - this._basis.lineEnd(); + polygonEnd: function() { + areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$2; + areaSum.add(abs$1(areaRingSum)); + areaRingSum = new Adder(); }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -exports.default = function custom(beta) { - function bundle(context) { - return beta === 1 ? new (0, _basisJs.Basis)(context) : new Bundle(context, beta); - } - bundle.beta = function(beta) { - return custom(+beta); - }; - return bundle; -}(0.85); - -},{"./basis.js":"7M9eM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fflpg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalClosed", ()=>CardinalClosed); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _cardinalJs = require("./cardinal.js"); -function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 0; + result: function() { + var area2 = areaSum / 2; + areaSum = new Adder(); + return area2; + } + }; + function areaRingStart() { + areaStream.point = areaPointFirst; + } + function areaPointFirst(x2, y2) { + areaStream.point = areaPoint; + x00$2 = x0$3 = x2, y00$2 = y0$3 = y2; + } + function areaPoint(x2, y2) { + areaRingSum.add(y0$3 * x2 - x0$3 * y2); + x0$3 = x2, y0$3 = y2; + } + function areaRingEnd() { + areaPoint(x00$2, y00$2); + } + var x0$2 = Infinity, y0$2 = x0$2, x1 = -x0$2, y1 = x1; + var boundsStream = { + point: boundsPoint, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: noop$2, + polygonEnd: noop$2, + result: function() { + var bounds2 = [[x0$2, y0$2], [x1, y1]]; + x1 = y1 = -(y0$2 = x0$2 = Infinity); + return bounds2; + } + }; + function boundsPoint(x2, y2) { + if (x2 < x0$2) x0$2 = x2; + if (x2 > x1) x1 = x2; + if (y2 < y0$2) y0$2 = y2; + if (y2 > y1) y1 = y2; + } + var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00$1, y00$1, x0$1, y0$1; + var centroidStream = { + point: centroidPoint, + lineStart: centroidLineStart, + lineEnd: centroidLineEnd, + polygonStart: function() { + centroidStream.lineStart = centroidRingStart; + centroidStream.lineEnd = centroidRingEnd; }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } + polygonEnd: function() { + centroidStream.point = centroidPoint; + centroidStream.lineStart = centroidLineStart; + centroidStream.lineEnd = centroidLineEnd; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _cardinalJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalClosed(context, tension); + result: function() { + var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN]; + X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; + return centroid; } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"../noop.js":"1qyaT","./cardinal.js":"2iU9W","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2iU9W":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Cardinal", ()=>Cardinal); -function point(that, x, y) { - that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2); -} -function Cardinal(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -Cardinal.prototype = { - areaStart: function() { - this._line = 0; + }; + function centroidPoint(x2, y2) { + X0 += x2; + Y0 += y2; + ++Z0; + } + function centroidLineStart() { + centroidStream.point = centroidPointFirstLine; + } + function centroidPointFirstLine(x2, y2) { + centroidStream.point = centroidPointLine; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidPointLine(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z2 = sqrt$1(dx * dx + dy * dy); + X1 += z2 * (x0$1 + x2) / 2; + Y1 += z2 * (y0$1 + y2) / 2; + Z1 += z2; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidLineEnd() { + centroidStream.point = centroidPoint; + } + function centroidRingStart() { + centroidStream.point = centroidPointFirstRing; + } + function centroidRingEnd() { + centroidPointRing(x00$1, y00$1); + } + function centroidPointFirstRing(x2, y2) { + centroidStream.point = centroidPointRing; + centroidPoint(x00$1 = x0$1 = x2, y00$1 = y0$1 = y2); + } + function centroidPointRing(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z2 = sqrt$1(dx * dx + dy * dy); + X1 += z2 * (x0$1 + x2) / 2; + Y1 += z2 * (y0$1 + y2) / 2; + Z1 += z2; + z2 = y0$1 * x2 - x0$1 * y2; + X2 += z2 * (x0$1 + x2); + Y2 += z2 * (y0$1 + y2); + Z2 += z2 * 3; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function PathContext(context2) { + this._context = context2; + } + PathContext.prototype = { + _radius: 4.5, + pointRadius: function(_) { + return this._radius = _, this; }, - areaEnd: function() { - this._line = NaN; + polygonStart: function() { + this._line = 0; + }, + polygonEnd: function() { + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - point(this, this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + if (this._line === 0) this._context.closePath(); + this._point = NaN; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - this._x1 = x, this._y1 = y; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; + point: function(x2, y2) { + switch (this._point) { + case 0: { + this._context.moveTo(x2, y2); + this._point = 1; + break; } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new Cardinal(context, tension); - } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Tvq2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalOpen", ()=>CardinalOpen); -var _cardinalJs = require("./cardinal.js"); -function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; + case 1: { + this._context.lineTo(x2, y2); + break; + } + default: { + this._context.moveTo(x2 + this._radius, y2); + this._context.arc(x2, y2, this._radius, 0, tau$1); + break; + } + } }, + result: noop$2 + }; + var lengthSum = new Adder(), lengthRing, x00, y00, x0, y0; + var lengthStream = { + point: noop$2, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; + lengthStream.point = lengthPointFirst; }, lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; + if (lengthRing) lengthPoint(x00, y00); + lengthStream.point = noop$2; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _cardinalJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalOpen(context, tension); - } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"./cardinal.js":"2iU9W","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bV8Z8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalClosedJs = require("./cardinalClosed.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + polygonStart: function() { + lengthRing = true; }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } + polygonEnd: function() { + lengthRing = null; }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + result: function() { + var length2 = +lengthSum; + lengthSum = new Adder(); + return length2; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new (0, _cardinalClosedJs.CardinalClosed)(context, 0); + }; + function lengthPointFirst(x2, y2) { + lengthStream.point = lengthPoint; + x00 = x0 = x2, y00 = y0 = y2; + } + function lengthPoint(x2, y2) { + x0 -= x2, y0 -= y2; + lengthSum.add(sqrt$1(x0 * x0 + y0 * y0)); + x0 = x2, y0 = y2; + } + let cacheDigits, cacheAppend, cacheRadius, cacheCircle; + class PathString { + constructor(digits) { + this._append = digits == null ? append : appendRound(digits); + this._radius = 4.5; + this._ = ""; } - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - return catmullRom; -}(0.5); - -},{"./cardinalClosed.js":"fflpg","../noop.js":"1qyaT","./catmullRom.js":"3GXnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3GXnl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -var _mathJs = require("../math.js"); -var _cardinalJs = require("./cardinal.js"); -function point(that, x, y) { - var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2; - if (that._l01_a > (0, _mathJs.epsilon)) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - if (that._l23_a > (0, _mathJs.epsilon)) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; - } - that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); -} -function CatmullRom(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - this.point(this._x2, this._y2); - break; + pointRadius(_) { + this._radius = +_; + return this; + } + polygonStart() { + this._line = 0; + } + polygonEnd() { + this._line = NaN; + } + lineStart() { + this._point = 0; + } + lineEnd() { + if (this._line === 0) this._ += "Z"; + this._point = NaN; + } + point(x2, y2) { + switch (this._point) { + case 0: { + this._append`M${x2},${y2}`; + this._point = 1; + break; } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; + case 1: { + this._append`L${x2},${y2}`; + break; + } + default: { + this._append`M${x2},${y2}`; + if (this._radius !== cacheRadius || this._append !== cacheAppend) { + const r = this._radius; + const s2 = this._; + this._ = ""; + this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; + cacheRadius = r; + cacheAppend = this._append; + cacheCircle = this._; + this._ = s2; + } + this._ += cacheCircle; + break; } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new (0, _cardinalJs.Cardinal)(context, 0); + result() { + const result = this._; + this._ = ""; + return result.length ? result : null; } - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - return catmullRom; -}(0.5); - -},{"../math.js":"74irK","./cardinal.js":"2iU9W","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4v7dm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalOpenJs = require("./cardinalOpen.js"); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } + function append(strings2) { + let i = 1; + this._ += strings2[0]; + for (const j = strings2.length; i < j; ++i) { + this._ += arguments[i] + strings2[i]; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new (0, _cardinalOpenJs.CardinalOpen)(context, 0); + } + function appendRound(digits) { + const d2 = Math.floor(digits); + if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${digits}`); + if (d2 > 15) return append; + if (d2 !== cacheDigits) { + const k = 10 ** d2; + cacheDigits = d2; + cacheAppend = function append2(strings2) { + let i = 1; + this._ += strings2[0]; + for (const j = strings2.length; i < j; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings2[i]; + } + }; } - catmullRom.alpha = function(alpha) { - return custom(+alpha); + return cacheAppend; + } + function geoPath(projection2, context2) { + let digits = 3, pointRadius = 4.5, projectionStream, contextStream; + function path2(object2) { + if (object2) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + geoStream(object2, projectionStream(contextStream)); + } + return contextStream.result(); + } + path2.area = function(object2) { + geoStream(object2, projectionStream(areaStream)); + return areaStream.result(); + }; + path2.measure = function(object2) { + geoStream(object2, projectionStream(lengthStream)); + return lengthStream.result(); + }; + path2.bounds = function(object2) { + geoStream(object2, projectionStream(boundsStream)); + return boundsStream.result(); + }; + path2.centroid = function(object2) { + geoStream(object2, projectionStream(centroidStream)); + return centroidStream.result(); + }; + path2.projection = function(_) { + if (!arguments.length) return projection2; + projectionStream = _ == null ? (projection2 = null, identity) : (projection2 = _).stream; + return path2; + }; + path2.context = function(_) { + if (!arguments.length) return context2; + contextStream = _ == null ? (context2 = null, new PathString(digits)) : new PathContext(context2 = _); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return path2; + }; + path2.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path2; + }; + path2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) digits = null; + else { + const d2 = Math.floor(_); + if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d2; + } + if (context2 === null) contextStream = new PathString(digits); + return path2; }; - return catmullRom; -}(0.5); - -},{"./cardinalOpen.js":"7Tvq2","./catmullRom.js":"3GXnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hl4Xi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new LinearClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function LinearClosed(context) { - this._context = context; -} -LinearClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._point) this._context.closePath(); - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y); - else this._point = 1, this._context.moveTo(x, y); - } -}; - -},{"../noop.js":"1qyaT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6A7Kk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "monotoneX", ()=>monotoneX); -parcelHelpers.export(exports, "monotoneY", ()=>monotoneY); -function sign(x) { - return x < 0 ? -1 : 1; -} -// Calculate the slopes of the tangents (Hermite-type interpolation) based on -// the following paper: Steffen, M. 1990. A Simple Method for Monotonic -// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. -// NOV(II), P. 443, 1990. -function slope3(that, x2, y2) { - var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; -} -// Calculate a one-sided slope. -function slope2(that, t) { - var h = that._x1 - that._x0; - return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; -} -// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations -// "you can express cubic Hermite interpolation in terms of cubic Bézier curves -// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". -function point(that, t0, t1) { - var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); -} -function MonotoneX(context) { - this._context = context; -} -MonotoneX.prototype = { - areaStart: function() { - this._line = 0; + return path2.projection(projection2).digits(digits).context(context2); + } + function transformer(methods2) { + return function(stream2) { + var s2 = new TransformStream(); + for (var key2 in methods2) s2[key2] = methods2[key2]; + s2.stream = stream2; + return s2; + }; + } + function TransformStream() { + } + TransformStream.prototype = { + constructor: TransformStream, + point: function(x2, y2) { + this.stream.point(x2, y2); }, - areaEnd: function() { - this._line = NaN; + sphere: function() { + this.stream.sphere(); }, lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; - this._point = 0; + this.stream.lineStart(); }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x1, this._y1); - break; - case 3: - point(this, this._t0, slope2(this, this._t0)); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - var t1 = NaN; - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - point(this, slope2(this, t1 = slope3(this, x, y)), t1); - break; - default: - point(this, this._t0, t1 = slope3(this, x, y)); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } -}; -function MonotoneY(context) { - this._context = new ReflectContext(context); -} -(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { - MonotoneX.prototype.point.call(this, y, x); -}; -function ReflectContext(context) { - this._context = context; -} -ReflectContext.prototype = { - moveTo: function(x, y) { - this._context.moveTo(y, x); - }, - closePath: function() { - this._context.closePath(); + this.stream.lineEnd(); }, - lineTo: function(x, y) { - this._context.lineTo(y, x); + polygonStart: function() { + this.stream.polygonStart(); }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._context.bezierCurveTo(y1, x1, y2, x2, y, x); - } -}; -function monotoneX(context) { - return new MonotoneX(context); -} -function monotoneY(context) { - return new MonotoneY(context); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1yP6t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Natural(context); + polygonEnd: function() { + this.stream.polygonEnd(); + } + }; + function fit$1(projection2, fitBounds, object2) { + var clip2 = projection2.clipExtent && projection2.clipExtent(); + projection2.scale(150).translate([0, 0]); + if (clip2 != null) projection2.clipExtent(null); + geoStream(object2, projection2.stream(boundsStream)); + fitBounds(boundsStream.result()); + if (clip2 != null) projection2.clipExtent(clip2); + return projection2; + } + function fitExtent(projection2, extent2, object2) { + return fit$1(projection2, function(b2) { + var w2 = extent2[1][0] - extent2[0][0], h2 = extent2[1][1] - extent2[0][1], k = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent2[0][0] + (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = +extent2[0][1] + (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitSize(projection2, size, object2) { + return fitExtent(projection2, [[0, 0], size], object2); + } + function fitWidth(projection2, width2, object2) { + return fit$1(projection2, function(b2) { + var w2 = +width2, k = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = -k * b2[0][1]; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitHeight(projection2, height2, object2) { + return fit$1(projection2, function(b2) { + var h2 = +height2, k = h2 / (b2[1][1] - b2[0][1]), x2 = -k * b2[0][0], y2 = (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + var maxDepth = 16, cosMinDistance = cos$1(30 * radians); + function resample(project2, delta2) { + return +delta2 ? resample$1(project2, delta2) : resampleNone(project2); + } + function resampleNone(project2) { + return transformer({ + point: function(x2, y2) { + x2 = project2(x2, y2); + this.stream.point(x2[0], x2[1]); + } }); -function Natural(context) { - this._context = context; -} -Natural.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = []; - this._y = []; - }, - lineEnd: function() { - var x = this._x, y = this._y, n = x.length; - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - if (n === 2) this._context.lineTo(x[1], y[1]); - else { - var px = controlPoints(x), py = controlPoints(y); - for(var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1)this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); - } + } + function resample$1(project2, delta2) { + function resampleLineTo(x02, y02, lambda02, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream2) { + var dx = x12 - x02, dy = y12 - y02, d2 = dx * dx + dy * dy; + if (d2 > 4 * delta2 && depth--) { + var a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt$1(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin$1(c2 /= m2), lambda22 = abs$1(abs$1(c2) - 1) < epsilon$3 || abs$1(lambda02 - lambda12) < epsilon$3 ? (lambda02 + lambda12) / 2 : atan2(b2, a2), p = project2(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > delta2 || abs$1((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream2); + stream2.point(x2, y2); + resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream2); } - if (this._line || this._line !== 0 && n === 1) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = null; - }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -// See https://www.particleincell.com/2012/bezier-splines/ for derivation. -function controlPoints(x) { - var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - for(i = 1; i < n - 1; ++i)a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - for(i = 1; i < n; ++i)m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a[n - 1] = r[n - 1] / b[n - 1]; - for(i = n - 2; i >= 0; --i)a[i] = (r[i] - a[i + 1]) / b[i]; - b[n - 1] = (x[n] + a[n - 1]) / 2; - for(i = 0; i < n - 1; ++i)b[i] = 2 * x[i + 1] - a[i + 1]; + } + } + return function(stream2) { + var lambda002, x002, y002, a00, b00, c00, lambda02, x02, y02, a0, b0, c0; + var resampleStream = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + stream2.polygonStart(); + resampleStream.lineStart = ringStart; + }, + polygonEnd: function() { + stream2.polygonEnd(); + resampleStream.lineStart = lineStart; + } + }; + function point2(x2, y2) { + x2 = project2(x2, y2); + stream2.point(x2[0], x2[1]); + } + function lineStart() { + x02 = NaN; + resampleStream.point = linePoint2; + stream2.lineStart(); + } + function linePoint2(lambda, phi2) { + var c2 = cartesian([lambda, phi2]), p = project2(lambda, phi2); + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x02 = p[0], y02 = p[1], lambda02 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream2); + stream2.point(x02, y02); + } + function lineEnd() { + resampleStream.point = point2; + stream2.lineEnd(); + } + function ringStart() { + lineStart(); + resampleStream.point = ringPoint; + resampleStream.lineEnd = ringEnd; + } + function ringPoint(lambda, phi2) { + linePoint2(lambda002 = lambda, phi2), x002 = x02, y002 = y02, a00 = a0, b00 = b0, c00 = c0; + resampleStream.point = linePoint2; + } + function ringEnd() { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x002, y002, lambda002, a00, b00, c00, maxDepth, stream2); + resampleStream.lineEnd = lineEnd; + lineEnd(); + } + return resampleStream; + }; + } + var transformRadians = transformer({ + point: function(x2, y2) { + this.stream.point(x2 * radians, y2 * radians); + } + }); + function transformRotate(rotate2) { + return transformer({ + point: function(x2, y2) { + var r = rotate2(x2, y2); + return this.stream.point(r[0], r[1]); + } + }); + } + function scaleTranslate(k, dx, dy, sx, sy) { + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [dx + k * x2, dy - k * y2]; + } + transform2.invert = function(x2, y2) { + return [(x2 - dx) / k * sx, (dy - y2) / k * sy]; + }; + return transform2; + } + function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { + if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); + var cosAlpha = cos$1(alpha), sinAlpha = sin$1(alpha), a2 = cosAlpha * k, b2 = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2]; + } + transform2.invert = function(x2, y2) { + return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)]; + }; + return transform2; + } + function projection$1(project2) { + return projectionMutator(function() { + return project2; + })(); + } + function projectionMutator(projectAt) { + var project2, k = 150, x2 = 480, y2 = 250, lambda = 0, phi2 = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate2, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache2, cacheStream; + function projection2(point2) { + return projectRotateTransform(point2[0] * radians, point2[1] * radians); + } + function invert2(point2) { + point2 = projectRotateTransform.invert(point2[0], point2[1]); + return point2 && [point2[0] * degrees, point2[1] * degrees]; + } + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transformRadians(transformRotate(rotate2)(preclip(projectResample(postclip(cacheStream = stream2))))); + }; + projection2.preclip = function(_) { + return arguments.length ? (preclip = _, theta = void 0, reset2()) : preclip; + }; + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; + }; + projection2.clipAngle = function(_) { + return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset2()) : theta * degrees; + }; + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + projection2.scale = function(_) { + return arguments.length ? (k = +_, recenter()) : k; + }; + projection2.translate = function(_) { + return arguments.length ? (x2 = +_[0], y2 = +_[1], recenter()) : [x2, y2]; + }; + projection2.center = function(_) { + return arguments.length ? (lambda = _[0] % 360 * radians, phi2 = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi2 * degrees]; + }; + projection2.rotate = function(_) { + return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; + }; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; + }; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; + }; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; + }; + projection2.precision = function(_) { + return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset2()) : sqrt$1(delta2); + }; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); + }; + projection2.fitSize = function(size, object2) { + return fitSize(projection2, size, object2); + }; + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); + }; + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); + }; + function recenter() { + var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project2(lambda, phi2)), transform2 = scaleTranslateRotate(k, x2 - center[0], y2 - center[1], sx, sy, alpha); + rotate2 = rotateRadians(deltaLambda, deltaPhi, deltaGamma); + projectTransform = compose(project2, transform2); + projectRotateTransform = compose(rotate2, projectTransform); + projectResample = resample(projectTransform, delta2); + return reset2(); + } + function reset2() { + cache2 = cacheStream = null; + return projection2; + } + return function() { + project2 = projectAt.apply(this, arguments); + projection2.invert = project2.invert && invert2; + return recenter(); + }; + } + function conicProjection(projectAt) { + var phi02 = 0, phi12 = pi$1 / 3, m2 = projectionMutator(projectAt), p = m2(phi02, phi12); + p.parallels = function(_) { + return arguments.length ? m2(phi02 = _[0] * radians, phi12 = _[1] * radians) : [phi02 * degrees, phi12 * degrees]; + }; + return p; + } + function cylindricalEqualAreaRaw(phi02) { + var cosPhi02 = cos$1(phi02); + function forward(lambda, phi2) { + return [lambda * cosPhi02, sin$1(phi2) / cosPhi02]; + } + forward.invert = function(x2, y2) { + return [x2 / cosPhi02, asin$1(y2 * cosPhi02)]; + }; + return forward; + } + function conicEqualAreaRaw(y02, y12) { + var sy0 = sin$1(y02), n = (sy0 + sin$1(y12)) / 2; + if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y02); + var c2 = 1 + sy0 * (2 * n - sy0), r0 = sqrt$1(c2) / n; + function project2(x2, y2) { + var r = sqrt$1(c2 - 2 * n * sin$1(y2)) / n; + return [r * sin$1(x2 *= n), r0 - r * cos$1(x2)]; + } + project2.invert = function(x2, y2) { + var r0y = r0 - y2, l = atan2(x2, abs$1(r0y)) * sign(r0y); + if (r0y * n < 0) + l -= pi$1 * sign(x2) * sign(r0y); + return [l / n, asin$1((c2 - (x2 * x2 + r0y * r0y) * n * n) / (2 * n))]; + }; + return project2; + } + function geoConicEqualArea() { + return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); + } + function geoAlbers() { + return geoConicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]); + } + function multiplex(streams) { + var n = streams.length; + return { + point: function(x2, y2) { + var i = -1; + while (++i < n) streams[i].point(x2, y2); + }, + sphere: function() { + var i = -1; + while (++i < n) streams[i].sphere(); + }, + lineStart: function() { + var i = -1; + while (++i < n) streams[i].lineStart(); + }, + lineEnd: function() { + var i = -1; + while (++i < n) streams[i].lineEnd(); + }, + polygonStart: function() { + var i = -1; + while (++i < n) streams[i].polygonStart(); + }, + polygonEnd: function() { + var i = -1; + while (++i < n) streams[i].polygonEnd(); + } + }; + } + function geoAlbersUsa() { + var cache2, cacheStream, lower48 = geoAlbers(), lower48Point, alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point2, pointStream = { point: function(x2, y2) { + point2 = [x2, y2]; + } }; + function albersUsa(coordinates) { + var x2 = coordinates[0], y2 = coordinates[1]; + return point2 = null, (lower48Point.point(x2, y2), point2) || (alaskaPoint.point(x2, y2), point2) || (hawaiiPoint.point(x2, y2), point2); + } + albersUsa.invert = function(coordinates) { + var k = lower48.scale(), t = lower48.translate(), x2 = (coordinates[0] - t[0]) / k, y2 = (coordinates[1] - t[1]) / k; + return (y2 >= 0.12 && y2 < 0.234 && x2 >= -0.425 && x2 < -0.214 ? alaska : y2 >= 0.166 && y2 < 0.234 && x2 >= -0.214 && x2 < -0.115 ? hawaii : lower48).invert(coordinates); + }; + albersUsa.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = multiplex([lower48.stream(cacheStream = stream2), alaska.stream(stream2), hawaii.stream(stream2)]); + }; + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_), alaska.precision(_), hawaii.precision(_); + return reset2(); + }; + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x2 = +_[0], y2 = +_[1]; + lower48Point = lower48.translate(_).clipExtent([[x2 - 0.455 * k, y2 - 0.238 * k], [x2 + 0.455 * k, y2 + 0.238 * k]]).stream(pointStream); + alaskaPoint = alaska.translate([x2 - 0.307 * k, y2 + 0.201 * k]).clipExtent([[x2 - 0.425 * k + epsilon$3, y2 + 0.12 * k + epsilon$3], [x2 - 0.214 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + hawaiiPoint = hawaii.translate([x2 - 0.205 * k, y2 + 0.212 * k]).clipExtent([[x2 - 0.214 * k + epsilon$3, y2 + 0.166 * k + epsilon$3], [x2 - 0.115 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + return reset2(); + }; + albersUsa.fitExtent = function(extent2, object2) { + return fitExtent(albersUsa, extent2, object2); + }; + albersUsa.fitSize = function(size, object2) { + return fitSize(albersUsa, size, object2); + }; + albersUsa.fitWidth = function(width2, object2) { + return fitWidth(albersUsa, width2, object2); + }; + albersUsa.fitHeight = function(height2, object2) { + return fitHeight(albersUsa, height2, object2); + }; + function reset2() { + cache2 = cacheStream = null; + return albersUsa; + } + return albersUsa.scale(1070); + } + function azimuthalRaw(scale2) { + return function(x2, y2) { + var cx = cos$1(x2), cy = cos$1(y2), k = scale2(cx * cy); + if (k === Infinity) return [2, 0]; + return [ + k * cy * sin$1(x2), + k * sin$1(y2) + ]; + }; + } + function azimuthalInvert(angle2) { + return function(x2, y2) { + var z2 = sqrt$1(x2 * x2 + y2 * y2), c2 = angle2(z2), sc = sin$1(c2), cc = cos$1(c2); + return [ + atan2(x2 * sc, z2 * cc), + asin$1(z2 && y2 * sc / z2) + ]; + }; + } + var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { + return sqrt$1(2 / (1 + cxcy)); + }); + azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z2) { + return 2 * asin$1(z2 / 2); + }); + function geoAzimuthalEqualArea() { + return projection$1(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); + } + var azimuthalEquidistantRaw = azimuthalRaw(function(c2) { + return (c2 = acos(c2)) && c2 / sin$1(c2); + }); + azimuthalEquidistantRaw.invert = azimuthalInvert(function(z2) { + return z2; + }); + function geoAzimuthalEquidistant() { + return projection$1(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); + } + function mercatorRaw(lambda, phi2) { + return [lambda, log$1(tan((halfPi$1 + phi2) / 2))]; + } + mercatorRaw.invert = function(x2, y2) { + return [x2, 2 * atan(exp(y2)) - halfPi$1]; + }; + function geoMercator() { + return mercatorProjection(mercatorRaw).scale(961 / tau$1); + } + function mercatorProjection(project2) { + var m2 = projection$1(project2), center = m2.center, scale2 = m2.scale, translate2 = m2.translate, clipExtent = m2.clipExtent, x02 = null, y02, x12, y12; + m2.scale = function(_) { + return arguments.length ? (scale2(_), reclip()) : scale2(); + }; + m2.translate = function(_) { + return arguments.length ? (translate2(_), reclip()) : translate2(); + }; + m2.center = function(_) { + return arguments.length ? (center(_), reclip()) : center(); + }; + m2.clipExtent = function(_) { + return arguments.length ? (_ == null ? x02 = y02 = x12 = y12 = null : (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + function reclip() { + var k = pi$1 * scale2(), t = m2(rotation(m2.rotate()).invert([0, 0])); + return clipExtent(x02 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project2 === mercatorRaw ? [[Math.max(t[0] - k, x02), y02], [Math.min(t[0] + k, x12), y12]] : [[x02, Math.max(t[1] - k, y02)], [x12, Math.min(t[1] + k, y12)]]); + } + return reclip(); + } + function tany(y2) { + return tan((halfPi$1 + y2) / 2); + } + function conicConformalRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : log$1(cy0 / cos$1(y12)) / log$1(tany(y12) / tany(y02)), f = cy0 * pow$1(tany(y02), n) / n; + if (!n) return mercatorRaw; + function project2(x2, y2) { + if (f > 0) { + if (y2 < -halfPi$1 + epsilon$3) y2 = -halfPi$1 + epsilon$3; + } else { + if (y2 > halfPi$1 - epsilon$3) y2 = halfPi$1 - epsilon$3; + } + var r = f / pow$1(tany(y2), n); + return [r * sin$1(n * x2), f - r * cos$1(n * x2)]; + } + project2.invert = function(x2, y2) { + var fy = f - y2, r = sign(n) * sqrt$1(x2 * x2 + fy * fy), l = atan2(x2, abs$1(fy)) * sign(fy); + if (fy * n < 0) + l -= pi$1 * sign(x2) * sign(fy); + return [l / n, 2 * atan(pow$1(f / r, 1 / n)) - halfPi$1]; + }; + return project2; + } + function geoConicConformal() { + return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); + } + function equirectangularRaw(lambda, phi2) { + return [lambda, phi2]; + } + equirectangularRaw.invert = equirectangularRaw; + function geoEquirectangular() { + return projection$1(equirectangularRaw).scale(152.63); + } + function conicEquidistantRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : (cy0 - cos$1(y12)) / (y12 - y02), g = cy0 / n + y02; + if (abs$1(n) < epsilon$3) return equirectangularRaw; + function project2(x2, y2) { + var gy = g - y2, nx = n * x2; + return [gy * sin$1(nx), g - gy * cos$1(nx)]; + } + project2.invert = function(x2, y2) { + var gy = g - y2, l = atan2(x2, abs$1(gy)) * sign(gy); + if (gy * n < 0) + l -= pi$1 * sign(x2) * sign(gy); + return [l / n, g - sign(n) * sqrt$1(x2 * x2 + gy * gy)]; + }; + return project2; + } + function geoConicEquidistant() { + return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); + } + var A1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt$1(3) / 2, iterations = 12; + function equalEarthRaw(lambda, phi2) { + var l = asin$1(M * sin$1(phi2)), l2 = l * l, l6 = l2 * l2 * l2; return [ - a, - b + lambda * cos$1(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), + l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hq3zp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Step(context, 0.5); - }); -parcelHelpers.export(exports, "stepBefore", ()=>stepBefore); -parcelHelpers.export(exports, "stepAfter", ()=>stepAfter); -function Step(context, t) { - this._context = context; - this._t = t; -} -Step.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - if (this._t <= 0) { - this._context.lineTo(this._x, y); - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y); - } - break; - } - this._x = x, this._y = y; - } -}; -function stepBefore(context) { - return new Step(context, 0); -} -function stepAfter(context) { - return new Step(context, 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4O1hR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "canvas", ()=>domCanvas); -parcelHelpers.export(exports, "domCanvas", ()=>domCanvas); -parcelHelpers.export(exports, "image", ()=>domImage); -function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - const c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } + } + equalEarthRaw.invert = function(x2, y2) { + var l = y2, l2 = l * l, l6 = l2 * l2 * l2; + for (var i = 0, delta, fy, fpy; i < iterations; ++i) { + fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y2; + fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); + l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; + if (abs$1(delta) < epsilon2) break; } - return null; -} -const domImage = ()=>typeof Image !== 'undefined' ? Image : null; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gHN3E":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _d3Scale.scaleImplicit)); -parcelHelpers.export(exports, "Band", ()=>Band); -parcelHelpers.export(exports, "BinOrdinal", ()=>BinOrdinal); -parcelHelpers.export(exports, "DiscreteLegend", ()=>DiscreteLegend); -parcelHelpers.export(exports, "Diverging", ()=>Diverging); -parcelHelpers.export(exports, "GradientLegend", ()=>GradientLegend); -parcelHelpers.export(exports, "Identity", ()=>Identity); -parcelHelpers.export(exports, "Linear", ()=>Linear); -parcelHelpers.export(exports, "Log", ()=>Log); -parcelHelpers.export(exports, "Ordinal", ()=>Ordinal); -parcelHelpers.export(exports, "Point", ()=>Point); -parcelHelpers.export(exports, "Pow", ()=>Pow); -parcelHelpers.export(exports, "Quantile", ()=>Quantile); -parcelHelpers.export(exports, "Quantize", ()=>Quantize); -parcelHelpers.export(exports, "Sequential", ()=>Sequential); -parcelHelpers.export(exports, "Sqrt", ()=>Sqrt); -parcelHelpers.export(exports, "SymbolLegend", ()=>SymbolLegend); -parcelHelpers.export(exports, "Symlog", ()=>Symlog); -parcelHelpers.export(exports, "Threshold", ()=>Threshold); -parcelHelpers.export(exports, "Time", ()=>Time); -parcelHelpers.export(exports, "UTC", ()=>UTC); -parcelHelpers.export(exports, "bandSpace", ()=>bandSpace); -parcelHelpers.export(exports, "domainCaption", ()=>domainCaption); -parcelHelpers.export(exports, "interpolate", ()=>interpolate); -parcelHelpers.export(exports, "interpolateColors", ()=>interpolateColors); -parcelHelpers.export(exports, "interpolateRange", ()=>interpolateRange); -parcelHelpers.export(exports, "isContinuous", ()=>isContinuous); -parcelHelpers.export(exports, "isDiscrete", ()=>isDiscrete); -parcelHelpers.export(exports, "isDiscretizing", ()=>isDiscretizing); -parcelHelpers.export(exports, "isInterpolating", ()=>isInterpolating); -parcelHelpers.export(exports, "isLogarithmic", ()=>isLogarithmic); -parcelHelpers.export(exports, "isQuantile", ()=>isQuantile); -parcelHelpers.export(exports, "isRegisteredScale", ()=>isRegisteredScale); -parcelHelpers.export(exports, "isTemporal", ()=>isTemporal); -parcelHelpers.export(exports, "isValidScaleType", ()=>isValidScaleType); -parcelHelpers.export(exports, "labelFormat", ()=>labelFormat); -parcelHelpers.export(exports, "labelFraction", ()=>labelFraction); -parcelHelpers.export(exports, "labelValues", ()=>labelValues); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>quantizeInterpolator); -parcelHelpers.export(exports, "registerScale", ()=>registerScale); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleCopy", ()=>scaleCopy); -parcelHelpers.export(exports, "scaleFraction", ()=>scaleFraction); -parcelHelpers.export(exports, "scheme", ()=>scheme); -parcelHelpers.export(exports, "tickCount", ()=>tickCount); -parcelHelpers.export(exports, "tickFormat", ()=>tickFormat); -parcelHelpers.export(exports, "tickValues", ()=>tickValues); -parcelHelpers.export(exports, "validTicks", ()=>validTicks); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Scale = require("d3-scale"); -var _d3Interpolate = require("d3-interpolate"); -var _d3ScaleChromatic = require("d3-scale-chromatic"); -var _vegaTime = require("vega-time"); -function bandSpace(count, paddingInner, paddingOuter) { - const space = count - paddingInner + paddingOuter * 2; - return count ? space > 0 ? space : 1 : 0; -} -const Identity = 'identity'; -const Linear = 'linear'; -const Log = 'log'; -const Pow = 'pow'; -const Sqrt = 'sqrt'; -const Symlog = 'symlog'; -const Time = 'time'; -const UTC = 'utc'; -const Sequential = 'sequential'; -const Diverging = 'diverging'; -const Quantile = 'quantile'; -const Quantize = 'quantize'; -const Threshold = 'threshold'; -const Ordinal = 'ordinal'; -const Point = 'point'; -const Band = 'band'; -const BinOrdinal = 'bin-ordinal'; -// categories -const Continuous = 'continuous'; -const Discrete = 'discrete'; -const Discretizing = 'discretizing'; -const Interpolating = 'interpolating'; -const Temporal = 'temporal'; -function invertRange(scale) { - return function(_) { - let lo = _[0], hi = _[1], t; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; -} -function invertRangeExtent(scale) { - return function(_) { - const range = scale.range(); - let lo = _[0], hi = _[1], min = -1, max, t, i, n; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - for(i = 0, n = range.length; i < n; ++i)if (range[i] >= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - if (min < 0) return undefined; - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[1] - ]; + return [ + M * x2 * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), + asin$1(sin$1(l) / M) + ]; + }; + function geoEqualEarth() { + return projection$1(equalEarthRaw).scale(177.158); + } + function gnomonicRaw(x2, y2) { + var cy = cos$1(y2), k = cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + gnomonicRaw.invert = azimuthalInvert(atan); + function geoGnomonic() { + return projection$1(gnomonicRaw).scale(144.049).clipAngle(60); + } + function geoIdentity() { + var k = 1, tx2 = 0, ty2 = 0, sx = 1, sy = 1, alpha = 0, ca, sa2, x02 = null, y02, x12, y12, kx = 1, ky = 1, transform2 = transformer({ + point: function(x2, y2) { + var p = projection2([x2, y2]); + this.stream.point(p[0], p[1]); + } + }), postclip = identity, cache2, cacheStream; + function reset2() { + kx = k * sx; + ky = k * sy; + cache2 = cacheStream = null; + return projection2; + } + function projection2(p) { + var x2 = p[0] * kx, y2 = p[1] * ky; + if (alpha) { + var t = y2 * ca - x2 * sa2; + x2 = x2 * ca + y2 * sa2; + y2 = t; + } + return [x2 + tx2, y2 + ty2]; + } + projection2.invert = function(p) { + var x2 = p[0] - tx2, y2 = p[1] - ty2; + if (alpha) { + var t = y2 * ca + x2 * sa2; + x2 = x2 * ca - y2 * sa2; + y2 = t; + } + return [x2 / kx, y2 / ky]; }; -} -function band() { - const scale = (0, _d3Scale.scaleOrdinal)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range; - let range$1 = [ - 0, - 1 - ], step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - const n = domain().length, reverse = range$1[1] < range$1[0], stop = range$1[1 - reverse], space = bandSpace(n, paddingInner, paddingOuter); - let start = range$1[reverse - 0]; - step = (stop - start) / (space || 1); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - const values = (0, _d3Array.range)(n).map((i)=>start + step * i); - return ordinalRange(reverse ? values.reverse() : values); - } - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else return domain(); + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transform2(postclip(cacheStream = stream2)); }; - scale.range = function(_) { - if (arguments.length) { - range$1 = [ - +_[0], - +_[1] - ]; - return rescale(); - } else return range$1.slice(); + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; }; - scale.rangeRound = function(_) { - range$1 = [ - +_[0], - +_[1] - ]; - round = true; - return rescale(); + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; }; - scale.bandwidth = function() { - return bandwidth; + projection2.scale = function(_) { + return arguments.length ? (k = +_, reset2()) : k; }; - scale.step = function() { - return step; + projection2.translate = function(_) { + return arguments.length ? (tx2 = +_[0], ty2 = +_[1], reset2()) : [tx2, ty2]; }; - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else return round; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, sa2 = sin$1(alpha), ca = cos$1(alpha), reset2()) : alpha * degrees; }; - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else return paddingInner; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, reset2()) : sx < 0; }; - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingInner; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, reset2()) : sy < 0; }; - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingOuter; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); }; - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else return align; - }; - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - const reverse = range$1[1] < range$1[0], values = reverse ? ordinalRange().reverse() : ordinalRange(), n = values.length - 1; - let lo = +_[0], hi = +_[1], a, b, t; - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range$1[1 - reverse]) return; - // binary search to index into scale range - a = Math.max(0, (0, _d3Array.bisectRight)(values, lo) - 1); - b = lo === hi ? a : (0, _d3Array.bisectRight)(values, hi) - 1; - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return a > b ? undefined : domain().slice(a, b + 1); - }; - scale.invert = function(_) { - const value = scale.invertRange([ - _, - _ - ]); - return value ? value[0] : value; + projection2.fitSize = function(size, object2) { + return fitSize(projection2, size, object2); }; - scale.copy = function() { - return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); }; - return rescale(); -} -function pointish(scale) { - const copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band().paddingInner(1)); -} -var map = Array.prototype.map; -function numbers(_) { - return map.call(_, (0, _vegaUtil.toNumber)); -} -const slice = Array.prototype.slice; -function scaleBinOrdinal() { - let domain = [], range = []; - function scale(x) { - return x == null || x !== x ? undefined : range[((0, _d3Array.bisect)(domain, x) - 1) % range.length]; - } - scale.domain = function(_) { - if (arguments.length) { - domain = numbers(_); - return scale; - } else return domain.slice(); + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); }; - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else return range.slice(); - }; - scale.tickFormat = function(count, specifier) { - return (0, _d3Scale.tickFormat)(domain[0], (0, _vegaUtil.peek)(domain), count == null ? 10 : count, specifier); - }; - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - return scale; -} -/** Private scale registry: should not be exported */ const scales = new Map(); -const VEGA_SCALE = Symbol('vega_scale'); -function registerScale(scale) { - scale[VEGA_SCALE] = true; - return scale; -} -/** - * Return true if object was created by a constructor from the vega-scale `scale` function. - */ function isRegisteredScale(scale) { - return scale && scale[VEGA_SCALE] === true; -} -/** - * Augment scales with their type and needed inverse methods. - */ function create(type, constructor, metadata) { - const ctr = function scale() { - const s = constructor(); - if (!s.invertRange) s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined; - s.type = type; - return registerScale(s); - }; - ctr.metadata = (0, _vegaUtil.toSet)((0, _vegaUtil.array)(metadata)); - return ctr; -} -/** - * Registry function for adding and accessing scale constructor functions. - * The *type* argument is a String indicating the name of the scale type. - * - * If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found. - * If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name. - * The *metadata* argument provides additional information to guide appropriate use of scales within Vega. - * - * *metadata* can be either a string or string array. The valid string values are: - * - `"continuous"` - the scale is defined over a continuous-valued domain. - * - `"discrete"` - the scale is defined over a discrete domain and range. - * - `"discretizing"` - the scale discretizes a continuous domain to a discrete range. - * - `"interpolating"` - the scale range is defined using a color interpolator. - * - `"log"` - the scale performs a logarithmic transform of the continuous domain. - * - `"temporal"` - the scale domain is defined over date-time values. - */ function scale(type, scale, metadata) { - if (arguments.length > 1) { - scales.set(type, create(type, scale, metadata)); - return this; - } else return isValidScaleType(type) ? scales.get(type) : undefined; -} -// identity scale -scale(Identity, _d3Scale.scaleIdentity); -// continuous scales -scale(Linear, _d3Scale.scaleLinear, Continuous); -scale(Log, _d3Scale.scaleLog, [ - Continuous, - Log -]); -scale(Pow, _d3Scale.scalePow, Continuous); -scale(Sqrt, _d3Scale.scaleSqrt, Continuous); -scale(Symlog, _d3Scale.scaleSymlog, Continuous); -scale(Time, _d3Scale.scaleTime, [ - Continuous, - Temporal -]); -scale(UTC, _d3Scale.scaleUtc, [ - Continuous, - Temporal -]); -// sequential scales -scale(Sequential, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); // backwards compat -scale(`${Sequential}-${Linear}`, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Log}`, _d3Scale.scaleSequentialLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Sequential}-${Pow}`, _d3Scale.scaleSequentialPow, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Sqrt}`, _d3Scale.scaleSequentialSqrt, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Symlog}`, _d3Scale.scaleSequentialSymlog, [ - Continuous, - Interpolating -]); -// diverging scales -scale(`${Diverging}-${Linear}`, _d3Scale.scaleDiverging, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Log}`, _d3Scale.scaleDivergingLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Diverging}-${Pow}`, _d3Scale.scaleDivergingPow, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Sqrt}`, _d3Scale.scaleDivergingSqrt, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Symlog}`, _d3Scale.scaleDivergingSymlog, [ - Continuous, - Interpolating -]); -// discretizing scales -scale(Quantile, _d3Scale.scaleQuantile, [ - Discretizing, - Quantile -]); -scale(Quantize, _d3Scale.scaleQuantize, Discretizing); -scale(Threshold, _d3Scale.scaleThreshold, Discretizing); -// discrete scales -scale(BinOrdinal, scaleBinOrdinal, [ - Discrete, - Discretizing -]); -scale(Ordinal, _d3Scale.scaleOrdinal, Discrete); -scale(Band, band, Discrete); -scale(Point, point, Discrete); -function isValidScaleType(type) { - return scales.has(type); -} -function hasType(key, type) { - const s = scales.get(key); - return s && s.metadata[type]; -} -function isContinuous(key) { - return hasType(key, Continuous); -} -function isDiscrete(key) { - return hasType(key, Discrete); -} -function isDiscretizing(key) { - return hasType(key, Discretizing); -} -function isLogarithmic(key) { - return hasType(key, Log); -} -function isTemporal(key) { - return hasType(key, Temporal); -} -function isInterpolating(key) { - return hasType(key, Interpolating); -} -function isQuantile(key) { - return hasType(key, Quantile); -} -const scaleProps = [ - 'clamp', - 'base', - 'constant', - 'exponent' -]; -function interpolateRange(interpolator, range) { - const start = range[0], span = (0, _vegaUtil.peek)(range) - start; - return function(i) { - return interpolator(start + i * span); - }; -} -function interpolateColors(colors, type, gamma) { - return _d3Interpolate.piecewise(interpolate(type || 'rgb', gamma), colors); -} -function quantizeInterpolator(interpolator, count) { - const samples = new Array(count), n = count + 1; - for(let i = 0; i < count;)samples[i] = interpolator(++i / n); - return samples; -} -function scaleCopy(scale) { - const t = scale.type, s = scale.copy(); - s.type = t; - return s; -} -function scaleFraction(scale$1, min, max) { - const delta = max - min; - let i, t, s; - if (!delta || !Number.isFinite(delta)) return (0, _vegaUtil.constant)(0.5); - else { - i = (t = scale$1.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale(t)().domain([ - min, - max - ]).range([ - 0, - 1 - ]); - scaleProps.forEach((m)=>scale$1[m] ? s[m](scale$1[m]()) : 0); - return s; - } -} -function interpolate(type, gamma) { - const interp = _d3Interpolate[method(type)]; - return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp; -} -function method(type) { - return 'interpolate' + type.toLowerCase().split('-').map((s)=>s[0].toUpperCase() + s.slice(1)).join(''); -} -const continuous = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - cividis: '00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647', - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - turbo: '23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00', - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' -}; -const discrete = { - accent: (0, _d3ScaleChromatic.schemeAccent), - category10: (0, _d3ScaleChromatic.schemeCategory10), - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - dark2: (0, _d3ScaleChromatic.schemeDark2), - observable10: (0, _d3ScaleChromatic.schemeObservable10), - paired: (0, _d3ScaleChromatic.schemePaired), - pastel1: (0, _d3ScaleChromatic.schemePastel1), - pastel2: (0, _d3ScaleChromatic.schemePastel2), - set1: (0, _d3ScaleChromatic.schemeSet1), - set2: (0, _d3ScaleChromatic.schemeSet2), - set3: (0, _d3ScaleChromatic.schemeSet3), - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5' -}; -function colors(palette) { - if ((0, _vegaUtil.isArray)(palette)) return palette; - const n = palette.length / 6 | 0, c = new Array(n); - for(let i = 0; i < n;)c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; -} -function apply(_, f) { - for(const k in _)scheme(k, f(_[k])); -} -const schemes = {}; -apply(discrete, colors); -apply(continuous, (_)=>interpolateColors(colors(_))); -function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else return schemes[name]; -} -const SymbolLegend = 'symbol'; -const DiscreteLegend = 'discrete'; -const GradientLegend = 'gradient'; -const defaultFormatter = (value)=>(0, _vegaUtil.isArray)(value) ? value.map((v)=>String(v)) : String(value); -const ascending = (a, b)=>a[1] - b[1]; -const descending = (a, b)=>b[1] - a[1]; -/** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ function tickCount(scale, count, minStep) { - let step; - if ((0, _vegaUtil.isNumber)(count)) { - if (scale.bins) count = Math.max(count, scale.bins.length); - if (minStep != null) count = Math.min(count, Math.floor((0, _vegaUtil.span)(scale.domain()) / minStep || 1) + 1); - } - if ((0, _vegaUtil.isObject)(count)) { - step = count.step; - count = count.interval; - } - if ((0, _vegaUtil.isString)(count)) { - count = scale.type === Time ? (0, _vegaTime.timeInterval)(count) : scale.type == UTC ? (0, _vegaTime.utcInterval)(count) : (0, _vegaUtil.error)('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - return count; -} -/** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ function validTicks(scale, ticks, count) { - let range = scale.range(), lo = range[0], hi = (0, _vegaUtil.peek)(range), cmp = ascending; - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - lo = Math.floor(lo); - hi = Math.ceil(hi); - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map((v)=>[ - v, - scale(v) - ]).filter((_)=>lo <= _[1] && _[1] <= hi).sort(cmp).map((_)=>_[0]); - if (count > 0 && ticks.length > 1) { - const endpoints = [ - ticks[0], - (0, _vegaUtil.peek)(ticks) - ]; - while(ticks.length > count && ticks.length >= 3)ticks = ticks.filter((_, i)=>!(i % 2)); - if (ticks.length < 3) ticks = endpoints; - } - return ticks; -} -/** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins, count) : scale.ticks ? scale.ticks(count) : scale.domain(); -} -/** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ function tickFormat(locale, scale, count, specifier, formatType, noSkip) { - const type = scale.type; - let format = defaultFormatter; - if (type === Time || formatType === Time) format = locale.timeFormat(specifier); - else if (type === UTC || formatType === UTC) format = locale.utcFormat(specifier); - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) format = varfmt; - else { - const test = tickLog(scale, count, false); - format = (_)=>test(_) ? varfmt(_) : ''; - } - } else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } else if (specifier) format = locale.format(specifier); - return format; -} -function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), base = scale.base(), logb = Math.log(base), k = Math.max(1, base * count / ticks.length); - // apply d3-scale's log format filter criteria - const test = (d)=>{ - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - return values ? ticks.filter(test) : test; -} -const symbols = { - [Quantile]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' -}; -const formats = { - [Quantile]: 'quantiles', - [Quantize]: 'domain' -}; -function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : tickValues(scale, count); -} -function thresholdFormat(locale, scale, specifier) { - const _ = scale[formats[scale.type]](), n = _.length; - let d = n > 1 ? _[1] - _[0] : _[0], i; - for(i = 1; i < n; ++i)d = Math.min(d, _[i] - _[i - 1]); - // tickCount = 3 ticks times 10 for increased resolution - return locale.formatSpan(0, d, 30, specifier); -} -function thresholdValues(thresholds) { - const values = [ - -Infinity - ].concat(thresholds); - values.max = Infinity; - return values; -} -function binValues(bins) { - const values = bins.slice(0, -1); - values.max = (0, _vegaUtil.peek)(bins); - return values; -} -const isDiscreteRange = (scale)=>symbols[scale.type] || scale.bins; -function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) { - const format = formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat(locale, scale, count, specifier, formatType, noSkip); - return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format); -} -const formatRange = (format)=>(value, index, array)=>{ - const limit = get(array[index + 1], get(array.max, Infinity)), lo = formatValue(value, format), hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; -const get = (value, dflt)=>value != null ? value : dflt; -const formatDiscrete = (format)=>(value, index)=>index ? format(value) : null; -const formatPoint = (format)=>(value)=>format(value); -const formatValue = (value, format)=>Number.isFinite(value) ? format(value) : null; -function labelFraction(scale) { - const domain = scale.domain(), count = domain.length - 1; - let lo = +domain[0], hi = +(0, _vegaUtil.peek)(domain), span = hi - lo; - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - return (value)=>(value - lo) / span; -} -function format(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - // replace abbreviated time specifiers to improve screen reader experience - if ((0, _vegaUtil.isString)(specifier) && isTemporal(type)) specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true); -} -function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), fmt = format(locale, scale, opt.format, opt.formatType); - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } else if (isDiscrete(scale.type)) { - const d = scale.domain(), n = d.length, v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt((0, _vegaUtil.peek)(d))}`; - } -} - -},{"vega-util":"f2ulH","d3-array":"5lCYW","d3-scale":"1PRVx","d3-interpolate":"hWyQt","d3-scale-chromatic":"dU3kB","vega-time":"kjkWX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dU3kB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "schemeCategory10", ()=>(0, _category10JsDefault.default)); -parcelHelpers.export(exports, "schemeAccent", ()=>(0, _accentJsDefault.default)); -parcelHelpers.export(exports, "schemeDark2", ()=>(0, _dark2JsDefault.default)); -parcelHelpers.export(exports, "schemeObservable10", ()=>(0, _observable10JsDefault.default)); -parcelHelpers.export(exports, "schemePaired", ()=>(0, _pairedJsDefault.default)); -parcelHelpers.export(exports, "schemePastel1", ()=>(0, _pastel1JsDefault.default)); -parcelHelpers.export(exports, "schemePastel2", ()=>(0, _pastel2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet1", ()=>(0, _set1JsDefault.default)); -parcelHelpers.export(exports, "schemeSet2", ()=>(0, _set2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet3", ()=>(0, _set3JsDefault.default)); -parcelHelpers.export(exports, "schemeTableau10", ()=>(0, _tableau10JsDefault.default)); -parcelHelpers.export(exports, "interpolateBrBG", ()=>(0, _brBGJsDefault.default)); -parcelHelpers.export(exports, "schemeBrBG", ()=>(0, _brBGJs.scheme)); -parcelHelpers.export(exports, "interpolatePRGn", ()=>(0, _prgnJsDefault.default)); -parcelHelpers.export(exports, "schemePRGn", ()=>(0, _prgnJs.scheme)); -parcelHelpers.export(exports, "interpolatePiYG", ()=>(0, _piYGJsDefault.default)); -parcelHelpers.export(exports, "schemePiYG", ()=>(0, _piYGJs.scheme)); -parcelHelpers.export(exports, "interpolatePuOr", ()=>(0, _puOrJsDefault.default)); -parcelHelpers.export(exports, "schemePuOr", ()=>(0, _puOrJs.scheme)); -parcelHelpers.export(exports, "interpolateRdBu", ()=>(0, _rdBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdBu", ()=>(0, _rdBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdGy", ()=>(0, _rdGyJsDefault.default)); -parcelHelpers.export(exports, "schemeRdGy", ()=>(0, _rdGyJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlBu", ()=>(0, _rdYlBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlBu", ()=>(0, _rdYlBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlGn", ()=>(0, _rdYlGnJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlGn", ()=>(0, _rdYlGnJs.scheme)); -parcelHelpers.export(exports, "interpolateSpectral", ()=>(0, _spectralJsDefault.default)); -parcelHelpers.export(exports, "schemeSpectral", ()=>(0, _spectralJs.scheme)); -parcelHelpers.export(exports, "interpolateBuGn", ()=>(0, _buGnJsDefault.default)); -parcelHelpers.export(exports, "schemeBuGn", ()=>(0, _buGnJs.scheme)); -parcelHelpers.export(exports, "interpolateBuPu", ()=>(0, _buPuJsDefault.default)); -parcelHelpers.export(exports, "schemeBuPu", ()=>(0, _buPuJs.scheme)); -parcelHelpers.export(exports, "interpolateGnBu", ()=>(0, _gnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeGnBu", ()=>(0, _gnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateOrRd", ()=>(0, _orRdJsDefault.default)); -parcelHelpers.export(exports, "schemeOrRd", ()=>(0, _orRdJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBuGn", ()=>(0, _puBuGnJsDefault.default)); -parcelHelpers.export(exports, "schemePuBuGn", ()=>(0, _puBuGnJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBu", ()=>(0, _puBuJsDefault.default)); -parcelHelpers.export(exports, "schemePuBu", ()=>(0, _puBuJs.scheme)); -parcelHelpers.export(exports, "interpolatePuRd", ()=>(0, _puRdJsDefault.default)); -parcelHelpers.export(exports, "schemePuRd", ()=>(0, _puRdJs.scheme)); -parcelHelpers.export(exports, "interpolateRdPu", ()=>(0, _rdPuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdPu", ()=>(0, _rdPuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGnBu", ()=>(0, _ylGnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGnBu", ()=>(0, _ylGnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGn", ()=>(0, _ylGnJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGn", ()=>(0, _ylGnJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrBr", ()=>(0, _ylOrBrJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrBr", ()=>(0, _ylOrBrJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrRd", ()=>(0, _ylOrRdJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrRd", ()=>(0, _ylOrRdJs.scheme)); -parcelHelpers.export(exports, "interpolateBlues", ()=>(0, _bluesJsDefault.default)); -parcelHelpers.export(exports, "schemeBlues", ()=>(0, _bluesJs.scheme)); -parcelHelpers.export(exports, "interpolateGreens", ()=>(0, _greensJsDefault.default)); -parcelHelpers.export(exports, "schemeGreens", ()=>(0, _greensJs.scheme)); -parcelHelpers.export(exports, "interpolateGreys", ()=>(0, _greysJsDefault.default)); -parcelHelpers.export(exports, "schemeGreys", ()=>(0, _greysJs.scheme)); -parcelHelpers.export(exports, "interpolatePurples", ()=>(0, _purplesJsDefault.default)); -parcelHelpers.export(exports, "schemePurples", ()=>(0, _purplesJs.scheme)); -parcelHelpers.export(exports, "interpolateReds", ()=>(0, _redsJsDefault.default)); -parcelHelpers.export(exports, "schemeReds", ()=>(0, _redsJs.scheme)); -parcelHelpers.export(exports, "interpolateOranges", ()=>(0, _orangesJsDefault.default)); -parcelHelpers.export(exports, "schemeOranges", ()=>(0, _orangesJs.scheme)); -parcelHelpers.export(exports, "interpolateCividis", ()=>(0, _cividisJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixDefault", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateRainbow", ()=>(0, _rainbowJsDefault.default)); -parcelHelpers.export(exports, "interpolateWarm", ()=>(0, _rainbowJs.warm)); -parcelHelpers.export(exports, "interpolateCool", ()=>(0, _rainbowJs.cool)); -parcelHelpers.export(exports, "interpolateSinebow", ()=>(0, _sinebowJsDefault.default)); -parcelHelpers.export(exports, "interpolateTurbo", ()=>(0, _turboJsDefault.default)); -parcelHelpers.export(exports, "interpolateViridis", ()=>(0, _viridisJsDefault.default)); -parcelHelpers.export(exports, "interpolateMagma", ()=>(0, _viridisJs.magma)); -parcelHelpers.export(exports, "interpolateInferno", ()=>(0, _viridisJs.inferno)); -parcelHelpers.export(exports, "interpolatePlasma", ()=>(0, _viridisJs.plasma)); -var _category10Js = require("./categorical/category10.js"); -var _category10JsDefault = parcelHelpers.interopDefault(_category10Js); -var _accentJs = require("./categorical/Accent.js"); -var _accentJsDefault = parcelHelpers.interopDefault(_accentJs); -var _dark2Js = require("./categorical/Dark2.js"); -var _dark2JsDefault = parcelHelpers.interopDefault(_dark2Js); -var _observable10Js = require("./categorical/observable10.js"); -var _observable10JsDefault = parcelHelpers.interopDefault(_observable10Js); -var _pairedJs = require("./categorical/Paired.js"); -var _pairedJsDefault = parcelHelpers.interopDefault(_pairedJs); -var _pastel1Js = require("./categorical/Pastel1.js"); -var _pastel1JsDefault = parcelHelpers.interopDefault(_pastel1Js); -var _pastel2Js = require("./categorical/Pastel2.js"); -var _pastel2JsDefault = parcelHelpers.interopDefault(_pastel2Js); -var _set1Js = require("./categorical/Set1.js"); -var _set1JsDefault = parcelHelpers.interopDefault(_set1Js); -var _set2Js = require("./categorical/Set2.js"); -var _set2JsDefault = parcelHelpers.interopDefault(_set2Js); -var _set3Js = require("./categorical/Set3.js"); -var _set3JsDefault = parcelHelpers.interopDefault(_set3Js); -var _tableau10Js = require("./categorical/Tableau10.js"); -var _tableau10JsDefault = parcelHelpers.interopDefault(_tableau10Js); -var _brBGJs = require("./diverging/BrBG.js"); -var _brBGJsDefault = parcelHelpers.interopDefault(_brBGJs); -var _prgnJs = require("./diverging/PRGn.js"); -var _prgnJsDefault = parcelHelpers.interopDefault(_prgnJs); -var _piYGJs = require("./diverging/PiYG.js"); -var _piYGJsDefault = parcelHelpers.interopDefault(_piYGJs); -var _puOrJs = require("./diverging/PuOr.js"); -var _puOrJsDefault = parcelHelpers.interopDefault(_puOrJs); -var _rdBuJs = require("./diverging/RdBu.js"); -var _rdBuJsDefault = parcelHelpers.interopDefault(_rdBuJs); -var _rdGyJs = require("./diverging/RdGy.js"); -var _rdGyJsDefault = parcelHelpers.interopDefault(_rdGyJs); -var _rdYlBuJs = require("./diverging/RdYlBu.js"); -var _rdYlBuJsDefault = parcelHelpers.interopDefault(_rdYlBuJs); -var _rdYlGnJs = require("./diverging/RdYlGn.js"); -var _rdYlGnJsDefault = parcelHelpers.interopDefault(_rdYlGnJs); -var _spectralJs = require("./diverging/Spectral.js"); -var _spectralJsDefault = parcelHelpers.interopDefault(_spectralJs); -var _buGnJs = require("./sequential-multi/BuGn.js"); -var _buGnJsDefault = parcelHelpers.interopDefault(_buGnJs); -var _buPuJs = require("./sequential-multi/BuPu.js"); -var _buPuJsDefault = parcelHelpers.interopDefault(_buPuJs); -var _gnBuJs = require("./sequential-multi/GnBu.js"); -var _gnBuJsDefault = parcelHelpers.interopDefault(_gnBuJs); -var _orRdJs = require("./sequential-multi/OrRd.js"); -var _orRdJsDefault = parcelHelpers.interopDefault(_orRdJs); -var _puBuGnJs = require("./sequential-multi/PuBuGn.js"); -var _puBuGnJsDefault = parcelHelpers.interopDefault(_puBuGnJs); -var _puBuJs = require("./sequential-multi/PuBu.js"); -var _puBuJsDefault = parcelHelpers.interopDefault(_puBuJs); -var _puRdJs = require("./sequential-multi/PuRd.js"); -var _puRdJsDefault = parcelHelpers.interopDefault(_puRdJs); -var _rdPuJs = require("./sequential-multi/RdPu.js"); -var _rdPuJsDefault = parcelHelpers.interopDefault(_rdPuJs); -var _ylGnBuJs = require("./sequential-multi/YlGnBu.js"); -var _ylGnBuJsDefault = parcelHelpers.interopDefault(_ylGnBuJs); -var _ylGnJs = require("./sequential-multi/YlGn.js"); -var _ylGnJsDefault = parcelHelpers.interopDefault(_ylGnJs); -var _ylOrBrJs = require("./sequential-multi/YlOrBr.js"); -var _ylOrBrJsDefault = parcelHelpers.interopDefault(_ylOrBrJs); -var _ylOrRdJs = require("./sequential-multi/YlOrRd.js"); -var _ylOrRdJsDefault = parcelHelpers.interopDefault(_ylOrRdJs); -var _bluesJs = require("./sequential-single/Blues.js"); -var _bluesJsDefault = parcelHelpers.interopDefault(_bluesJs); -var _greensJs = require("./sequential-single/Greens.js"); -var _greensJsDefault = parcelHelpers.interopDefault(_greensJs); -var _greysJs = require("./sequential-single/Greys.js"); -var _greysJsDefault = parcelHelpers.interopDefault(_greysJs); -var _purplesJs = require("./sequential-single/Purples.js"); -var _purplesJsDefault = parcelHelpers.interopDefault(_purplesJs); -var _redsJs = require("./sequential-single/Reds.js"); -var _redsJsDefault = parcelHelpers.interopDefault(_redsJs); -var _orangesJs = require("./sequential-single/Oranges.js"); -var _orangesJsDefault = parcelHelpers.interopDefault(_orangesJs); -var _cividisJs = require("./sequential-multi/cividis.js"); -var _cividisJsDefault = parcelHelpers.interopDefault(_cividisJs); -var _cubehelixJs = require("./sequential-multi/cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _rainbowJs = require("./sequential-multi/rainbow.js"); -var _rainbowJsDefault = parcelHelpers.interopDefault(_rainbowJs); -var _sinebowJs = require("./sequential-multi/sinebow.js"); -var _sinebowJsDefault = parcelHelpers.interopDefault(_sinebowJs); -var _turboJs = require("./sequential-multi/turbo.js"); -var _turboJsDefault = parcelHelpers.interopDefault(_turboJs); -var _viridisJs = require("./sequential-multi/viridis.js"); -var _viridisJsDefault = parcelHelpers.interopDefault(_viridisJs); - -},{"./categorical/category10.js":"fNUpb","./categorical/Accent.js":"l6HfJ","./categorical/Dark2.js":"2WDW3","./categorical/observable10.js":"6iC9c","./categorical/Paired.js":"cEUm7","./categorical/Pastel1.js":"h7k3H","./categorical/Pastel2.js":"dc8lr","./categorical/Set1.js":"dPPYu","./categorical/Set2.js":"bLevt","./categorical/Set3.js":"idTTy","./categorical/Tableau10.js":false,"./diverging/BrBG.js":false,"./diverging/PRGn.js":false,"./diverging/PiYG.js":false,"./diverging/PuOr.js":false,"./diverging/RdBu.js":false,"./diverging/RdGy.js":false,"./diverging/RdYlBu.js":false,"./diverging/RdYlGn.js":false,"./diverging/Spectral.js":false,"./sequential-multi/BuGn.js":false,"./sequential-multi/BuPu.js":false,"./sequential-multi/GnBu.js":false,"./sequential-multi/OrRd.js":false,"./sequential-multi/PuBuGn.js":false,"./sequential-multi/PuBu.js":false,"./sequential-multi/PuRd.js":false,"./sequential-multi/RdPu.js":false,"./sequential-multi/YlGnBu.js":false,"./sequential-multi/YlGn.js":false,"./sequential-multi/YlOrBr.js":false,"./sequential-multi/YlOrRd.js":false,"./sequential-single/Blues.js":false,"./sequential-single/Greens.js":false,"./sequential-single/Greys.js":false,"./sequential-single/Purples.js":false,"./sequential-single/Reds.js":false,"./sequential-single/Oranges.js":false,"./sequential-multi/cividis.js":false,"./sequential-multi/cubehelix.js":false,"./sequential-multi/rainbow.js":false,"./sequential-multi/sinebow.js":false,"./sequential-multi/turbo.js":false,"./sequential-multi/viridis.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fNUpb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jNRnl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specifier) { - var n = specifier.length / 6 | 0, colors = new Array(n), i = 0; - while(i < n)colors[i] = "#" + specifier.slice(i * 6, ++i * 6); - return colors; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l6HfJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2WDW3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iC9c":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEUm7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7k3H":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dc8lr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dPPYu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bLevt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"idTTy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1JcF5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "axisticks", ()=>AxisTicks); -parcelHelpers.export(exports, "datajoin", ()=>DataJoin); -parcelHelpers.export(exports, "encode", ()=>Encode); -parcelHelpers.export(exports, "legendentries", ()=>LegendEntries); -parcelHelpers.export(exports, "linkpath", ()=>LinkPath); -parcelHelpers.export(exports, "pie", ()=>Pie); -parcelHelpers.export(exports, "scale", ()=>Scale); -parcelHelpers.export(exports, "sortitems", ()=>SortItems); -parcelHelpers.export(exports, "stack", ()=>Stack); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScale = require("vega-scale"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -/** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function AxisTicks(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(AxisTicks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), ticks = this.value, scale = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count = (0, _vegaScale.tickCount)(scale, tally, _.minstep), format = _.format || (0, _vegaScale.tickFormat)(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), values = _.values ? (0, _vegaScale.validTicks)(scale, _.values, count) : (0, _vegaScale.tickValues)(scale, count); - if (ticks) out.rem = ticks; - ticks = values.map((value, i)=>(0, _vegaDataflow.ingest)({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - })); - if (_.extra && ticks.length) // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push((0, _vegaDataflow.ingest)({ - index: -1, - extra: { - value: ticks[0].value - }, - label: '' - })); - out.source = ticks; - out.add = ticks; - this.value = ticks; - return out; - } -}); -/** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ function DataJoin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -function defaultItemCreate() { - return (0, _vegaDataflow.ingest)({}); -} -function newMap(key) { - const map = (0, _vegaUtil.fastmap)().test((t)=>t.exit); - map.lookup = (t)=>map.get(key(t)); - return map; -} -(0, _vegaUtil.inherits)(DataJoin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), item = _.item || defaultItemCreate, key = _.key || (0, _vegaDataflow.tupleid), map = this.value; - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if ((0, _vegaUtil.isArray)(out.encode)) out.encode = null; - if (map && (_.modified('key') || pulse.modified(key))) (0, _vegaUtil.error)('DataJoin does not support modified key function or fields.'); - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - let x = map.get(k); - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else out.mod.push(x); - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - x.datum = t; - x.exit = false; - }); - pulse.visit(pulse.MOD, (t)=>{ - const k = key(t), x = map.get(k); - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - pulse.visit(pulse.REM, (t)=>{ - const k = key(t), x = map.get(k); - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) df.runAfter(map.clean); - return out; - } -}); -/** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ function Encode(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Encode, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode = pulse.encode; - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if ((0, _vegaUtil.isArray)(encode)) { - if (out.changed() || encode.every((e)=>encoders[e])) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else return pulse.StopPropagation; - } - // marshall encoder functions - var reenter = encode === 'enter', update = encoders.update || (0, _vegaUtil.falsy), enter = encoders.enter || (0, _vegaUtil.falsy), exit = encoders.exit || (0, _vegaUtil.falsy), set = (encode && !reenter ? encoders[encode] : update) || (0, _vegaUtil.falsy); - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, (t)=>{ - enter(t, _); - update(t, _); - }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== (0, _vegaUtil.falsy) && set !== update) { - pulse.visit(pulse.ADD, (t)=>{ - set(t, _); - }); - out.modifies(set.output); - } - } - if (pulse.changed(pulse.REM) && exit !== (0, _vegaUtil.falsy)) { - pulse.visit(pulse.REM, (t)=>{ - exit(t, _); - }); - out.modifies(exit.output); - } - if (reenter || set !== (0, _vegaUtil.falsy)) { - const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, (t)=>{ - const mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else pulse.visit(flag, (t)=>{ - if (set(t, _) || fmod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(set.output); - } - return out.changed() ? out : pulse.StopPropagation; - } -}); -/** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function LegendEntries(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(LegendEntries, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value != null && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), items = this.value, type = _.type || (0, _vegaScale.SymbolLegend), scale = _.scale, limit = +_.limit, count = (0, _vegaScale.tickCount)(scale, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type === (0, _vegaScale.SymbolLegend), format = _.format || (0, _vegaScale.labelFormat)(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), values = _.values || (0, _vegaScale.labelValues)(scale, count), domain, fraction, size, offset, ellipsis; - if (items) out.rem = items; - if (type === (0, _vegaScale.SymbolLegend)) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else items = values; - if ((0, _vegaUtil.isFunction)(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) items = items.slice(1); - // compute size offset for legend entries - offset = items.reduce((max, value)=>Math.max(max, size(value, _)), 0); - } else size = (0, _vegaUtil.constant)(offset = size || 8); - items = items.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - })); - if (ellipsis) { - ellipsis = values[items.length]; - items.push((0, _vegaDataflow.ingest)({ - index: items.length, - label: `\u2026${values.length - items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } else if (type === (0, _vegaScale.GradientLegend)) { - domain = scale.domain(), fraction = (0, _vegaScale.scaleFraction)(scale, domain[0], (0, _vegaUtil.peek)(domain)); - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== (0, _vegaUtil.peek)(domain)) values = [ - domain[0], - (0, _vegaUtil.peek)(domain) - ]; - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - })); - } else { - size = values.length - 1; - fraction = (0, _vegaScale.labelFraction)(scale); - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index + 1]) - })); - } - out.source = items; - out.add = items; - this.value = items; - return out; - } -}); -const sourceX = (t)=>t.source.x; -const sourceY = (t)=>t.source.y; -const targetX = (t)=>t.target.x; -const targetY = (t)=>t.target.y; -/** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ function LinkPath(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sourceX', - 'type': 'field', - 'default': 'source.x' - }, - { - 'name': 'sourceY', - 'type': 'field', - 'default': 'source.y' - }, - { - 'name': 'targetX', - 'type': 'field', - 'default': 'target.x' - }, - { - 'name': 'targetY', - 'type': 'field', - 'default': 'target.y' - }, - { - 'name': 'orient', - 'type': 'enum', - 'default': 'vertical', - 'values': [ - 'horizontal', - 'vertical', - 'radial' - ] - }, - { - 'name': 'shape', - 'type': 'enum', - 'default': 'line', - 'values': [ - 'line', - 'arc', - 'curve', - 'diagonal', - 'orthogonal' - ] - }, - { - 'name': 'require', - 'type': 'signal' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(LinkPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx = _.targetX || targetX, ty = _.targetY || targetY, as = _.as || 'path', orient = _.orient || 'vertical', shape = _.shape || 'line', path = Paths.get(shape + '-' + orient) || Paths.get(shape); - if (!path) (0, _vegaUtil.error)('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : '')); - pulse.visit(pulse.SOURCE, (t)=>{ - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - return pulse.reflow(_.modified()).modifies(as); - } -}); -const line = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'L' + tx + ',' + ty; -const lineR = (sa, sr, ta, tr)=>line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const arc = (sx, sy, tx, ty)=>{ - var dx = tx - sx, dy = ty - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty; -}; -const arcR = (sa, sr, ta, tr)=>arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const curve = (sx, sy, tx, ty)=>{ - const dx = tx - sx, dy = ty - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty; -}; -const curveR = (sa, sr, ta, tr)=>curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const orthoX = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'V' + ty + 'H' + tx; -const orthoY = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'H' + tx + 'V' + ty; -const orthoR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts; -}; -const diagonalX = (sx, sy, tx, ty)=>{ - const m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty; -}; -const diagonalY = (sx, sy, tx, ty)=>{ - const m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty; -}; -const diagonalR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), mr = (sr + tr) / 2; - return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts; -}; -const Paths = (0, _vegaUtil.fastmap)({ - 'line': line, - 'line-radial': lineR, - 'arc': arc, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR -}); -/** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ function Pie(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Pie.Definition = { - 'type': 'Pie', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'startAngle', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'endAngle', - 'type': 'number', - 'default': 6.283185307179586 - }, - { - 'name': 'sort', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'startAngle', - 'endAngle' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Pie, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || [ - 'startAngle', - 'endAngle' - ], startAngle = as[0], endAngle = as[1], field = _.field || (0, _vegaUtil.one), start = _.startAngle || 0, stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, data = pulse.source, values = data.map(field), n = values.length, a = start, k = (stop - start) / (0, _d3Array.sum)(values), index = (0, _d3Array.range)(n), i, t, v; - if (_.sort) index.sort((a, b)=>values[a] - values[b]); - for(i = 0; i < n; ++i){ - v = values[index[i]]; - t = data[index[i]]; - t[startAngle] = a; - t[endAngle] = a += v * k; - } - this.value = values; - return pulse.reflow(_.modified()).modifies(as); - } -}); -const DEFAULT_COUNT = 5; -function includeZero(scale) { - const type = scale.type; - return !scale.bins && (type === (0, _vegaScale.Linear) || type === (0, _vegaScale.Pow) || type === (0, _vegaScale.Sqrt)); -} -function includePad(type) { - return (0, _vegaScale.isContinuous)(type) && type !== (0, _vegaScale.Sequential); -} -const SKIP = (0, _vegaUtil.toSet)([ - 'set', - 'modified', - 'clear', - 'type', - 'scheme', - 'schemeExtent', - 'schemeCount', - 'domain', - 'domainMin', - 'domainMid', - 'domainMax', - 'domainRaw', - 'domainImplicit', - 'nice', - 'zero', - 'bins', - 'range', - 'rangeStep', - 'round', - 'reverse', - 'interpolate', - 'interpolateGamma' -]); -/** - * Maintains a scale function mapping data values to visual channels. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Scale(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Scale, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, scale$1 = this.value, key = scaleKey(_); - if (!scale$1 || key !== scale$1.type) this.value = scale$1 = (0, _vegaScale.scale)(key)(); - for(key in _)if (!SKIP[key]) { - // padding is a scale property for band/point but not others - if (key === 'padding' && includePad(scale$1.type)) continue; - // invoke scale property setter, raise warning if not found - (0, _vegaUtil.isFunction)(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key); - } - configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df))); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function scaleKey(_) { - var t = _.type, d = '', n; - // backwards compatibility pre Vega 5. - if (t === (0, _vegaScale.Sequential)) return (0, _vegaScale.Sequential) + '-' + (0, _vegaScale.Linear); - if (isContinuousColor(_)) { - n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; - d = n === 2 ? (0, _vegaScale.Sequential) + '-' : n === 3 ? (0, _vegaScale.Diverging) + '-' : ''; - } - return (d + t || (0, _vegaScale.Linear)).toLowerCase(); -} -function isContinuousColor(_) { - const t = _.type; - return (0, _vegaScale.isContinuous)(t) && t !== (0, _vegaScale.Time) && t !== (0, _vegaScale.UTC) && (_.scheme || _.range && _.range.length && _.range.every((0, _vegaUtil.isString))); -} -function configureDomain(scale, _, df) { - // check raw domain, if provided use that and exit early - const raw = rawDomain(scale, _.domainRaw, df); - if (raw > -1) return raw; - var domain = _.domain, type = scale.type, zero = _.zero || _.zero === undefined && includeZero(scale), n, mid; - if (!domain) return 0; - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = (domain = domain.slice()).length - 1 || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== (0, _vegaUtil.peek)(domain)) domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === (0, _vegaScale.Ordinal)) scale.unknown(_.domainImplicit ? (0, _vegaScale.scaleImplicit) : undefined); - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) scale.nice(_.nice !== true && (0, _vegaScale.tickCount)(scale, _.nice) || null); - // return the cardinality of the domain - return domain.length; -} -function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else return -1; -} -function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs((0, _vegaUtil.peek)(range) - range[0]), frac = span / (span - 2 * pad), d = type === (0, _vegaScale.Log) ? (0, _vegaUtil.zoomLog)(domain, null, frac) : type === (0, _vegaScale.Sqrt) ? (0, _vegaUtil.zoomPow)(domain, null, frac, 0.5) : type === (0, _vegaScale.Pow) ? (0, _vegaUtil.zoomPow)(domain, null, frac, exponent || 1) : type === (0, _vegaScale.Symlog) ? (0, _vegaUtil.zoomSymlog)(domain, null, frac, constant || 1) : (0, _vegaUtil.zoomLinear)(domain, null, frac); - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length - 1] = d[1]; - return domain; -} -function domainCheck(type, domain, df) { - if ((0, _vegaScale.isLogarithmic)(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce((s, v)=>s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); - if (s !== domain.length) df.warn('Log scale domain includes zero: ' + (0, _vegaUtil.stringValue)(domain)); - } - return domain; -} -function configureBins(scale, _, count) { - let bins = _.bins; - if (bins && !(0, _vegaUtil.isArray)(bins)) { - // generate bin boundary array - const domain = scale.domain(), lo = domain[0], hi = (0, _vegaUtil.peek)(domain), step = bins.step; - let start = bins.start == null ? lo : bins.start, stop = bins.stop == null ? hi : bins.stop; - if (!step) (0, _vegaUtil.error)('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = (0, _d3Array.range)(start, stop + step / 2, step); - } - if (bins) // assign bin boundaries to scale instance - scale.bins = bins; - else if (scale.bins) // no current bins, remove bins if previously set - delete scale.bins; - // special handling for bin-ordinal scales - if (scale.type === (0, _vegaScale.BinOrdinal)) { - if (!bins) // the domain specifies the bins - scale.bins = scale.domain(); - else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - // return domain cardinality - return count; -} -function configureRange(scale, _, count) { - var type = scale.type, round = _.round || false, range = _.range; - // if range step specified, calculate full range extent - if (_.rangeStep != null) range = configureRangeStep(type, _, count); - else if (_.scheme) { - range = configureScheme(type, _, count); - if ((0, _vegaUtil.isFunction)(range)) { - if (scale.interpolator) return scale.interpolator(range); - else (0, _vegaUtil.error)(`Scale type ${type} does not support interpolating color schemes.`); - } - } - // given a range array for an interpolating scale, convert to interpolator - if (range && (0, _vegaScale.isInterpolating)(type)) return scale.interpolator((0, _vegaScale.interpolateColors)(flip(range, _.reverse), _.interpolate, _.interpolateGamma)); - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) scale.interpolate((0, _vegaScale.interpolate)(_.interpolate, _.interpolateGamma)); - else if ((0, _vegaUtil.isFunction)(scale.round)) scale.round(round); - else if ((0, _vegaUtil.isFunction)(scale.rangeRound)) scale.interpolate(round ? (0, _d3Interpolate.interpolateRound) : (0, _d3Interpolate.interpolate)); - if (range) scale.range(flip(range, _.reverse)); -} -function configureRangeStep(type, _, count) { - if (type !== (0, _vegaScale.Band) && type !== (0, _vegaScale.Point)) (0, _vegaUtil.error)('Only band and point scales support rangeStep.'); - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type === (0, _vegaScale.Point) ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; + return projection2; + } + function naturalEarth1Raw(lambda, phi2) { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; return [ - 0, - _.rangeStep * (0, _vegaScale.bandSpace)(count, inner, outer) + lambda * (0.8707 - 0.131979 * phi22 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi22 - 1529e-6 * phi4))), + phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) ]; -} -function configureScheme(type, _, count) { - var extent = _.schemeExtent, name, scheme$1; - if ((0, _vegaUtil.isArray)(_.scheme)) scheme$1 = (0, _vegaScale.interpolateColors)(_.scheme, _.interpolate, _.interpolateGamma); - else { - name = _.scheme.toLowerCase(); - scheme$1 = (0, _vegaScale.scheme)(name); - if (!scheme$1) (0, _vegaUtil.error)(`Unrecognized scheme name: ${_.scheme}`); - } - // determine size for potential discrete range - count = type === (0, _vegaScale.Threshold) ? count + 1 : type === (0, _vegaScale.BinOrdinal) ? count - 1 : type === (0, _vegaScale.Quantile) || type === (0, _vegaScale.Quantize) ? +_.schemeCount || DEFAULT_COUNT : count; - // adjust and/or quantize scheme as appropriate - return (0, _vegaScale.isInterpolating)(type) ? adjustScheme(scheme$1, extent, _.reverse) : (0, _vegaUtil.isFunction)(scheme$1) ? (0, _vegaScale.quantizeInterpolator)(adjustScheme(scheme$1, extent), count) : type === (0, _vegaScale.Ordinal) ? scheme$1 : scheme$1.slice(0, count); -} -function adjustScheme(scheme, extent, reverse) { - return (0, _vegaUtil.isFunction)(scheme) && (extent || reverse) ? (0, _vegaScale.interpolateRange)(scheme, flip(extent || [ - 0, - 1 - ], reverse)) : scheme; -} -function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; -} -/** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ function SortItems(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(SortItems, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum'); - if (mod) pulse.source.sort((0, _vegaDataflow.stableCompare)(_.sort)); - this.modified(mod); - return pulse; - } -}); -const Zero = 'zero', Center = 'center', Normalize = 'normalize', DefOutput = [ - 'y0', - 'y1' -]; -/** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ function Stack(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stack.Definition = { - 'type': 'Stack', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'offset', - 'type': 'enum', - 'default': Zero, - 'values': [ - Zero, - Center, - Normalize - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': DefOutput - } - ] -}; -(0, _vegaUtil.inherits)(Stack, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || DefOutput, y0 = as[0], y1 = as[1], sort = (0, _vegaDataflow.stableCompare)(_.sort), field = _.field || (0, _vegaUtil.one), stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max; - // partition, sum, and sort the stack groups - groups = partition(pulse.source, _.groupby, sort, field); - // compute stack layouts per group - for(i = 0, n = groups.length, max = groups.max; i < n; ++i)stack(groups[i], max, field, y0, y1); - return pulse.reflow(_.modified()).modifies(as); - } -}); -function stackCenter(group, max, field, y0, y1) { - var last = (max - group.sum) / 2, m = group.length, j = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last += Math.abs(field(t)); - } -} -function stackNormalize(group, max, field, y0, y1) { - var scale = 1 / group.sum, last = 0, m = group.length, j = 0, v = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last = scale * (v += Math.abs(field(t))); - } -} -function stackZero(group, max, field, y0, y1) { - var lastPos = 0, lastNeg = 0, m = group.length, j = 0, v, t; - for(; j < m; ++j){ - t = group[j]; - v = +field(t); - if (v < 0) { - t[y0] = lastNeg; - t[y1] = lastNeg += v; - } else { - t[y0] = lastPos; - t[y1] = lastPos += v; - } - } -} -function partition(data, groupby, sort, field) { - var groups = [], get = (f)=>f(t), map, i, n, m, t, k, g, s, max; - // partition data points into stack groups - if (groupby == null) groups.push(data.slice()); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - groups.push(g); - } - g.push(t); - } - // compute sums of groups, sort groups as needed - for(k = 0, max = 0, m = groups.length; k < m; ++k){ - g = groups[k]; - for(i = 0, s = 0, n = g.length; i < n; ++i)s += Math.abs(field(g[i])); - g.sum = s; - if (s > max) max = s; - if (sort) g.sort(sort); - } - groups.max = max; - return groups; -} - -},{"vega-dataflow":"cFRfY","vega-scale":"gHN3E","vega-util":"f2ulH","d3-array":"5lCYW","d3-interpolate":"hWyQt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5TaRi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "contour", ()=>Contour); -parcelHelpers.export(exports, "geojson", ()=>GeoJSON); -parcelHelpers.export(exports, "geopath", ()=>GeoPath); -parcelHelpers.export(exports, "geopoint", ()=>GeoPoint); -parcelHelpers.export(exports, "geoshape", ()=>GeoShape); -parcelHelpers.export(exports, "graticule", ()=>Graticule); -parcelHelpers.export(exports, "heatmap", ()=>Heatmap); -parcelHelpers.export(exports, "isocontour", ()=>Isocontour); -parcelHelpers.export(exports, "kde2d", ()=>KDE2D); -parcelHelpers.export(exports, "projection", ()=>Projection); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _vegaStatistics = require("vega-statistics"); -var _vegaProjection = require("vega-projection"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaCanvas = require("vega-canvas"); -function noop() {} -const cases = [ - [], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ], - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ], - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [] -]; -// Implementation adapted from d3/d3-contour. Thanks! -function contours() { - var dx = 1, dy = 1, smooth = smoothLinear; - function contours(values, tz) { - return tz.map((value)=>contour(values, value)); - } - // Accumulate, smooth contour rings, assign holes to exterior rings. - // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js - function contour(values, value) { - var polygons = [], holes = []; - isorings(values, value, (ring)=>{ - smooth(ring, values, value); - if (area(ring) > 0) polygons.push([ - ring - ]); - else holes.push(ring); - }); - holes.forEach((hole)=>{ - for(var i = 0, n = polygons.length, polygon; i < n; ++i)if (contains((polygon = polygons[i])[0], hole) !== -1) { - polygon.push(hole); - return; - } + } + naturalEarth1Raw.invert = function(x2, y2) { + var phi2 = y2, i = 25, delta; + do { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; + phi2 -= delta = (phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) - y2) / (1.007226 + phi22 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi22 - 5916e-6 * 11 * phi4))); + } while (abs$1(delta) > epsilon$3 && --i > 0); + return [ + x2 / (0.8707 + (phi22 = phi2 * phi2) * (-0.131979 + phi22 * (-0.013791 + phi22 * phi22 * phi22 * (3971e-6 - 1529e-6 * phi22)))), + phi2 + ]; + }; + function geoNaturalEarth1() { + return projection$1(naturalEarth1Raw).scale(175.295); + } + function orthographicRaw(x2, y2) { + return [cos$1(y2) * sin$1(x2), sin$1(y2)]; + } + orthographicRaw.invert = azimuthalInvert(asin$1); + function geoOrthographic() { + return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3); + } + function stereographicRaw(x2, y2) { + var cy = cos$1(y2), k = 1 + cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + stereographicRaw.invert = azimuthalInvert(function(z2) { + return 2 * atan(z2); + }); + function geoStereographic() { + return projection$1(stereographicRaw).scale(250).clipAngle(142); + } + function transverseMercatorRaw(lambda, phi2) { + return [log$1(tan((halfPi$1 + phi2) / 2)), -lambda]; + } + transverseMercatorRaw.invert = function(x2, y2) { + return [-y2, 2 * atan(exp(x2)) - halfPi$1]; + }; + function geoTransverseMercator() { + var m2 = mercatorProjection(transverseMercatorRaw), center = m2.center, rotate2 = m2.rotate; + m2.center = function(_) { + return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); + }; + m2.rotate = function(_) { + return arguments.length ? rotate2([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate2(), [_[0], _[1], _[2] - 90]); + }; + return rotate2([0, 0, 90]).scale(159.155); + } + var abs = Math.abs; + var cos = Math.cos; + var sin = Math.sin; + var epsilon$2 = 1e-6; + var pi = Math.PI; + var halfPi = pi / 2; + var sqrt2 = sqrt(2); + function asin(x2) { + return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2); + } + function sqrt(x2) { + return x2 > 0 ? Math.sqrt(x2) : 0; + } + function mollweideBromleyTheta(cp, phi2) { + var cpsinPhi = cp * sin(phi2), i = 30, delta; + do + phi2 -= delta = (phi2 + sin(phi2) - cpsinPhi) / (1 + cos(phi2)); + while (abs(delta) > epsilon$2 && --i > 0); + return phi2 / 2; + } + function mollweideBromleyRaw(cx, cy, cp) { + function forward(lambda, phi2) { + return [cx * lambda * cos(phi2 = mollweideBromleyTheta(cp, phi2)), cy * sin(phi2)]; + } + forward.invert = function(x2, y2) { + return y2 = asin(y2 / cy), [x2 / (cx * cos(y2)), asin((2 * y2 + sin(2 * y2)) / cp)]; + }; + return forward; + } + var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); + function geoMollweide() { + return projection$1(mollweideRaw).scale(169.529); + } + const defaultPath = geoPath(); + const projectionProperties = [ + // standard properties in d3-geo + "clipAngle", + "clipExtent", + "scale", + "translate", + "center", + "rotate", + "parallels", + "precision", + "reflectX", + "reflectY", + // extended properties in d3-geo-projections + "coefficient", + "distance", + "fraction", + "lobes", + "parallel", + "radius", + "ratio", + "spacing", + "tilt" + ]; + function create$1(type2, constructor) { + return function projection2() { + const p = constructor(); + p.type = type2; + p.path = geoPath().projection(p); + p.copy = p.copy || function() { + const c2 = projection2(); + projectionProperties.forEach((prop) => { + if (p[prop]) c2[prop](p[prop]()); }); - return { - type: 'MultiPolygon', - value: value, - coordinates: polygons - }; + c2.path.pointRadius(p.path.pointRadius()); + return c2; + }; + return registerScale(p); + }; + } + function projection(type2, proj) { + if (!type2 || typeof type2 !== "string") { + throw new Error("Projection type must be a name string."); } - // Marching squares with isolines stitched into rings. - // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = [], fragmentByEnd = [], x, y, t0, t1, t2, t3; - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - // General case for the intermediate rows. - while(++y < dy - 1){ - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - function stitch(line) { - var start = [ - line[0][0] + x, - line[0][1] + y - ], end = [ - line[1][0] + x, - line[1][1] + y - ], startIndex = index(start), endIndex = index(end), f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[f.start] = fragmentByEnd[g.end] = { - start: f.start, - end: g.end, - ring: f.ring.concat(g.ring) - }; - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[g.start] = fragmentByEnd[f.end] = { - start: g.start, - end: f.end, - ring: g.ring.concat(f.ring) - }; - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { - start: startIndex, - end: endIndex, - ring: [ - start, - end - ] - }; + type2 = type2.toLowerCase(); + if (arguments.length > 1) { + projections[type2] = create$1(type2, proj); + return this; + } else { + return projections[type2] || null; + } + } + function getProjectionPath(proj) { + return proj && proj.path || defaultPath; + } + const projections = { + // base d3-geo projection types + albers: geoAlbers, + albersusa: geoAlbersUsa, + azimuthalequalarea: geoAzimuthalEqualArea, + azimuthalequidistant: geoAzimuthalEquidistant, + conicconformal: geoConicConformal, + conicequalarea: geoConicEqualArea, + conicequidistant: geoConicEquidistant, + equalEarth: geoEqualEarth, + equirectangular: geoEquirectangular, + gnomonic: geoGnomonic, + identity: geoIdentity, + mercator: geoMercator, + mollweide: geoMollweide, + naturalEarth1: geoNaturalEarth1, + orthographic: geoOrthographic, + stereographic: geoStereographic, + transversemercator: geoTransverseMercator + }; + for (const key2 in projections) { + projection(key2, projections[key2]); + } + function noop$1() { + } + const cases = [[], [[[1, 1.5], [0.5, 1]]], [[[1.5, 1], [1, 1.5]]], [[[1.5, 1], [0.5, 1]]], [[[1, 0.5], [1.5, 1]]], [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]], [[[1, 0.5], [1, 1.5]]], [[[1, 0.5], [0.5, 1]]], [[[0.5, 1], [1, 0.5]]], [[[1, 1.5], [1, 0.5]]], [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]], [[[1.5, 1], [1, 0.5]]], [[[0.5, 1], [1.5, 1]]], [[[1, 1.5], [1.5, 1]]], [[[0.5, 1], [1, 1.5]]], []]; + function contours() { + var dx = 1, dy = 1, smooth = smoothLinear; + function contours2(values2, tz) { + return tz.map((value2) => contour(values2, value2)); + } + function contour(values2, value2) { + var polygons = [], holes = []; + isorings(values2, value2, (ring) => { + smooth(ring, values2, value2); + if (area(ring) > 0) polygons.push([ring]); + else holes.push(ring); + }); + holes.forEach((hole) => { + for (var i = 0, n = polygons.length, polygon; i < n; ++i) { + if (contains((polygon = polygons[i])[0], hole) !== -1) { + polygon.push(hole); + return; + } + } + }); + return { + type: "MultiPolygon", + value: value2, + coordinates: polygons + }; + } + function isorings(values2, value2, callback) { + var fragmentByStart = [], fragmentByEnd = [], x2, y2, t02, t12, t22, t32; + x2 = y2 = -1; + t12 = values2[0] >= value2; + cases[t12 << 1].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[x2 + 1] >= value2; + cases[t02 | t12 << 1].forEach(stitch2); + } + cases[t12 << 0].forEach(stitch2); + while (++y2 < dy - 1) { + x2 = -1; + t12 = values2[y2 * dx + dx] >= value2; + t22 = values2[y2 * dx] >= value2; + cases[t12 << 1 | t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[y2 * dx + dx + x2 + 1] >= value2; + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t02 | t12 << 1 | t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t12 | t22 << 3].forEach(stitch2); + } + x2 = -1; + t22 = values2[y2 * dx] >= value2; + cases[t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t22 << 3].forEach(stitch2); + function stitch2(line2) { + var start = [line2[0][0] + x2, line2[0][1] + y2], end = [line2[1][0] + x2, line2[1][1] + y2], startIndex = index2(start), endIndex = index2(end), f, g; + if (f = fragmentByEnd[startIndex]) { + if (g = fragmentByStart[endIndex]) { + delete fragmentByEnd[f.end]; + delete fragmentByStart[g.start]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[f.start] = fragmentByEnd[g.end] = { + start: f.start, + end: g.end, + ring: f.ring.concat(g.ring) + }; + } + } else { + delete fragmentByEnd[f.end]; + f.ring.push(end); + fragmentByEnd[f.end = endIndex] = f; + } + } else if (f = fragmentByStart[endIndex]) { + if (g = fragmentByEnd[startIndex]) { + delete fragmentByStart[f.start]; + delete fragmentByEnd[g.end]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[g.start] = fragmentByEnd[f.end] = { + start: g.start, + end: f.end, + ring: g.ring.concat(f.ring) + }; + } + } else { + delete fragmentByStart[f.start]; + f.ring.unshift(start); + fragmentByStart[f.start = startIndex] = f; + } + } else { + fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { + start: startIndex, + end: endIndex, + ring: [start, end] + }; } + } } - function index(point) { - return point[0] * 2 + point[1] * (dx + 1) * 4; + function index2(point2) { + return point2[0] * 2 + point2[1] * (dx + 1) * 4; } - function smoothLinear(ring, values, value) { - ring.forEach((point)=>{ - var x = point[0], y = point[1], xt = x | 0, yt = y | 0, v0, v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); + function smoothLinear(ring, values2, value2) { + ring.forEach((point2) => { + var x2 = point2[0], y2 = point2[1], xt = x2 | 0, yt = y2 | 0, v0, v1 = values2[yt * dx + xt]; + if (x2 > 0 && x2 < dx && xt === x2) { + v0 = values2[yt * dx + xt - 1]; + point2[0] = x2 + (value2 - v0) / (v1 - v0) - 0.5; + } + if (y2 > 0 && y2 < dy && yt === y2) { + v0 = values2[(yt - 1) * dx + xt]; + point2[1] = y2 + (value2 - v0) / (v1 - v0) - 0.5; + } + }); } - contours.contour = contour; - contours.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, contours; - }; - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear; - }; - return contours; -} -function area(ring) { - var i = 0, n = ring.length, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while(++i < n)area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; -} -function contains(ring, hole) { - var i = -1, n = hole.length, c; - while(++i < n)if (c = ringContains(ring, hole[i])) return c; + contours2.contour = contour; + contours2.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, contours2; + }; + contours2.smooth = function(_) { + return arguments.length ? (smooth = _ ? smoothLinear : noop$1, contours2) : smooth === smoothLinear; + }; + return contours2; + } + function area(ring) { + var i = 0, n = ring.length, area2 = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; + while (++i < n) area2 += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; + return area2; + } + function contains(ring, hole) { + var i = -1, n = hole.length, c2; + while (++i < n) if (c2 = ringContains(ring, hole[i])) return c2; return 0; -} -function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for(var i = 0, n = ring.length, j = n - 1; i < n; j = i++){ - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains; - } - return contains; -} -function segmentContains(a, b, c) { + } + function ringContains(ring, point2) { + var x2 = point2[0], y2 = point2[1], contains2 = -1; + for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { + var pi2 = ring[i], xi = pi2[0], yi = pi2[1], pj = ring[j], xj = pj[0], yj = pj[1]; + if (segmentContains(pi2, pj, point2)) return 0; + if (yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi) contains2 = -contains2; + } + return contains2; + } + function segmentContains(a2, b2, c2) { var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} -function within(p, q, r) { + return collinear$1(a2, b2, c2) && within(a2[i = +(a2[0] === b2[0])], c2[i], b2[i]); + } + function collinear$1(a2, b2, c2) { + return (b2[0] - a2[0]) * (c2[1] - a2[1]) === (c2[0] - a2[0]) * (b2[1] - a2[1]); + } + function within(p, q, r) { return p <= q && q <= r || r <= q && q <= p; -} -function quantize(k, nice, zero) { - return function(values) { - var ex = (0, _vegaUtil.extent)(values), start = zero ? Math.min(ex[0], 0) : ex[0], stop = ex[1], span = stop - start, step = nice ? (0, _d3Array.tickStep)(start, stop, k) : span / (k + 1); - return (0, _d3Array.range)(start + step, stop, step); - }; -} -/** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ function Isocontour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': { - 'generates': true + } + function quantize(k, nice2, zero2) { + return function(values2) { + var ex = extent(values2), start = zero2 ? Math.min(ex[0], 0) : ex[0], stop2 = ex[1], span2 = stop2 - start, step = nice2 ? tickStep(start, stop2, k) : span2 / (k + 1); + return range$3(start + step, stop2, step); + }; + } + function Isocontour(params2) { + Transform.call(this, null, params2); + } + Isocontour.Definition = { + "type": "Isocontour", + "metadata": { + "generates": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'levels', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'zero', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'scale', - 'type': 'number', - 'expr': true - }, - { - 'name': 'translate', - 'type': 'number', - 'array': true, - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'default': 'contour' - } - ] -}; -(0, _vegaUtil.inherits)(Isocontour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, field = _.field || (0, _vegaUtil.identity), contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source, field, _), as = _.as === null ? null : _.as || 'contour', values = []; - source.forEach((t)=>{ - const grid = field(t); - // generate contour paths in GeoJSON format - const paths = contour.size([ - grid.width, - grid.height - ])(grid.values, (0, _vegaUtil.isArray)(tz) ? tz : tz(grid.values)); - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - // ingest; copy source data properties to output - paths.forEach((p)=>{ - values.push((0, _vegaDataflow.rederive)(t, (0, _vegaDataflow.ingest)(as != null ? { - [as]: p - } : p))); - }); + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "levels", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "zero", + "type": "boolean", + "default": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }, { + "name": "scale", + "type": "number", + "expr": true + }, { + "name": "translate", + "type": "number", + "array": true, + "expr": true + }, { + "name": "as", + "type": "string", + "null": true, + "default": "contour" + }] + }; + inherits(Isocontour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, field2 = _.field || identity$2, contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source2, field2, _), as = _.as === null ? null : _.as || "contour", values2 = []; + source2.forEach((t) => { + const grid2 = field2(t); + const paths = contour.size([grid2.width, grid2.height])(grid2.values, isArray(tz) ? tz : tz(grid2.values)); + transformPaths(paths, grid2, t, _); + paths.forEach((p) => { + values2.push(rederive(t, ingest$1(as != null ? { + [as]: p + } : p))); }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; + }); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; } -}); -function levels(values, f, _) { + }); + function levels(values2, f, _) { const q = quantize(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' ? q : q(values.map((t)=>(0, _d3Array.max)(f(t).values))); -} -function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, t = _.translate || grid.translate; - if ((0, _vegaUtil.isFunction)(s)) s = s(datum, _); - if ((0, _vegaUtil.isFunction)(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - const sx = ((0, _vegaUtil.isNumber)(s) ? s : s[0]) || 1, sy = ((0, _vegaUtil.isNumber)(s) ? s : s[1]) || 1, tx = t && t[0] || 0, ty = t && t[1] || 0; - paths.forEach(transform(grid, sx, sy, tx, ty)); -} -function transform(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, y1 = grid.y1 || 0, flip = sx * sy < 0; + return _.resolve !== "shared" ? q : q(values2.map((t) => max$2(f(t).values))); + } + function transformPaths(paths, grid2, datum2, _) { + let s2 = _.scale || grid2.scale, t = _.translate || grid2.translate; + if (isFunction(s2)) s2 = s2(datum2, _); + if (isFunction(t)) t = t(datum2, _); + if ((s2 === 1 || s2 == null) && !t) return; + const sx = (isNumber$1(s2) ? s2 : s2[0]) || 1, sy = (isNumber$1(s2) ? s2 : s2[1]) || 1, tx2 = t && t[0] || 0, ty2 = t && t[1] || 0; + paths.forEach(transform$1(grid2, sx, sy, tx2, ty2)); + } + function transform$1(grid2, sx, sy, tx2, ty2) { + const x12 = grid2.x1 || 0, y12 = grid2.y1 || 0, flip2 = sx * sy < 0; function transformPolygon(coordinates) { - coordinates.forEach(transformRing); + coordinates.forEach(transformRing); } function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); + if (flip2) coordinates.reverse(); + coordinates.forEach(transformPoint); } function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; + coordinates[0] = (coordinates[0] - x12) * sx + tx2; + coordinates[1] = (coordinates[1] - y12) * sy + ty2; } return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; + geometry.coordinates.forEach(transformPolygon); + return geometry; }; -} -function radius(bw, data, f) { - const v = bw >= 0 ? bw : (0, _vegaStatistics.bandwidthNRD)(data, f); + } + function radius(bw, data2, f) { + const v = bw >= 0 ? bw : estimateBandwidth(data2, f); return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); -} -function number(_) { - return (0, _vegaUtil.isFunction)(_) ? _ : (0, _vegaUtil.constant)(+_); -} -// Implementation adapted from d3/d3-contour. Thanks! -function density2D() { - var x = (d)=>d[0], y = (d)=>d[1], weight = (0, _vegaUtil.one), bandwidth = [ - -1, - -1 - ], dx = 960, dy = 500, k = 2; // log2(cellSize) - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), values1 = new Float32Array(n * m); - let values = values0; - data.forEach((d)=>{ - const xi = ox + (+x(d) >> k), yi = oy + (+y(d) >> k); - if (xi >= 0 && xi < n && yi >= 0 && yi < m) values0[xi + yi * n] += +weight(d); - }); - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - // scale density estimates - // density in points per square pixel or probability density - const s = counts ? Math.pow(2, -2 * k) : 1 / (0, _d3Array.sum)(values); - for(let i = 0, sz = n * m; i < sz; ++i)values[i] *= s; - return { - values: values, - scale: 1 << k, - width: n, - height: m, - x1: ox, - y1: oy, - x2: ox + (dx >> k), - y2: oy + (dy >> k) - }; - } - density.x = function(_) { - return arguments.length ? (x = number(_), density) : x; - }; - density.y = function(_) { - return arguments.length ? (y = number(_), density) : y; - }; - density.weight = function(_) { - return arguments.length ? (weight = number(_), density) : weight; - }; - density.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, density; - }; - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) (0, _vegaUtil.error)('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = (0, _vegaUtil.array)(_); - if (_.length === 1) _ = [ - +_[0], - +_[0] - ]; - if (_.length !== 2) (0, _vegaUtil.error)('invalid bandwidth'); - return bandwidth = _, density; - }; - return density; -} -function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let j = 0; j < m; ++j)for(let i = 0, sr = 0; i < n + r; ++i){ - if (i < n) sr += source[i + j * n]; + } + function number$2(_) { + return isFunction(_) ? _ : constant$4(+_); + } + function density2D() { + var x2 = (d2) => d2[0], y2 = (d2) => d2[1], weight = one$1, bandwidth2 = [-1, -1], dx = 960, dy = 500, k = 2; + function density2(data2, counts) { + const rx = radius(bandwidth2[0], data2, x2) >> k, ry = radius(bandwidth2[1], data2, y2) >> k, ox = rx ? rx + 2 : 0, oy = ry ? ry + 2 : 0, n = 2 * ox + (dx >> k), m2 = 2 * oy + (dy >> k), values0 = new Float32Array(n * m2), values1 = new Float32Array(n * m2); + let values2 = values0; + data2.forEach((d2) => { + const xi = ox + (+x2(d2) >> k), yi = oy + (+y2(d2) >> k); + if (xi >= 0 && xi < n && yi >= 0 && yi < m2) { + values0[xi + yi * n] += +weight(d2); + } + }); + if (rx > 0 && ry > 0) { + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + } else if (rx > 0) { + blurX(n, m2, values0, values1, rx); + blurX(n, m2, values1, values0, rx); + blurX(n, m2, values0, values1, rx); + values2 = values1; + } else if (ry > 0) { + blurY(n, m2, values0, values1, ry); + blurY(n, m2, values1, values0, ry); + blurY(n, m2, values0, values1, ry); + values2 = values1; + } + const s2 = counts ? Math.pow(2, -2 * k) : 1 / sum$1(values2); + for (let i = 0, sz2 = n * m2; i < sz2; ++i) values2[i] *= s2; + return { + values: values2, + scale: 1 << k, + width: n, + height: m2, + x1: ox, + y1: oy, + x2: ox + (dx >> k), + y2: oy + (dy >> k) + }; + } + density2.x = function(_) { + return arguments.length ? (x2 = number$2(_), density2) : x2; + }; + density2.y = function(_) { + return arguments.length ? (y2 = number$2(_), density2) : y2; + }; + density2.weight = function(_) { + return arguments.length ? (weight = number$2(_), density2) : weight; + }; + density2.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = +_[0], _1 = +_[1]; + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, density2; + }; + density2.cellSize = function(_) { + if (!arguments.length) return 1 << k; + if (!((_ = +_) >= 1)) error("invalid cell size"); + k = Math.floor(Math.log(_) / Math.LN2); + return density2; + }; + density2.bandwidth = function(_) { + if (!arguments.length) return bandwidth2; + _ = array$4(_); + if (_.length === 1) _ = [+_[0], +_[0]]; + if (_.length !== 2) error("invalid bandwidth"); + return bandwidth2 = _, density2; + }; + return density2; + } + function blurX(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let j = 0; j < m2; ++j) { + for (let i = 0, sr = 0; i < n + r; ++i) { + if (i < n) { + sr += source2[i + j * n]; + } if (i >= r) { - if (i >= w) sr -= source[i - w + j * n]; - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); + if (i >= w2) { + sr -= source2[i - w2 + j * n]; + } + target2[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w2 - i, w2); } + } } -} -function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let i = 0; i < n; ++i)for(let j = 0, sr = 0; j < m + r; ++j){ - if (j < m) sr += source[i + j * n]; + } + function blurY(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let i = 0; i < n; ++i) { + for (let j = 0, sr = 0; j < m2 + r; ++j) { + if (j < m2) { + sr += source2[i + j * n]; + } if (j >= r) { - if (j >= w) sr -= source[i + (j - w) * n]; - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } -} -/** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array<number>} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ function KDE2D(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'grid' + if (j >= w2) { + sr -= source2[i + (j - w2) * n]; + } + target2[i + (j - r) * n] = sr / Math.min(j + 1, m2 - 1 + w2 - j, w2); } - ] -}; -const PARAMS = [ - 'x', - 'y', - 'weight', - 'size', - 'cellSize', - 'bandwidth' -]; -function params(obj, _) { - PARAMS.forEach((param)=>_[param] != null ? obj[param](_[param]) : 0); - return obj; -} -(0, _vegaUtil.inherits)(KDE2D, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), kde = params(density2D(), _), as = _.as || 'grid', values = []; - function set(t, vals) { - for(let i = 0; i < names.length; ++i)t[names[i]] = vals[i]; - return t; - } - // generate density raster grids - values = groups.map((g)=>(0, _vegaDataflow.ingest)(set({ - [as]: kde(g, _.counts) - }, g.dims))); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; + } + } + } + function KDE2D(params2) { + Transform.call(this, null, params2); + } + KDE2D.Definition = { + "type": "KDE2D", + "metadata": { + "generates": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "weight", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": "grid" + }] + }; + const PARAMS = ["x", "y", "weight", "size", "cellSize", "bandwidth"]; + function params(obj2, _) { + PARAMS.forEach((param2) => _[param2] != null ? obj2[param2](_[param2]) : 0); + return obj2; + } + inherits(KDE2D, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) return pulse2.StopPropagation; + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$2(source2, _.groupby), names = (_.groupby || []).map(accessorName), kde2 = params(density2D(), _), as = _.as || "grid", values2 = []; + function set2(t, vals) { + for (let i = 0; i < names.length; ++i) t[names[i]] = vals[i]; + return t; + } + values2 = groups.map((g) => ingest$1(set2({ + [as]: kde2(g, _.counts) + }, g.dims))); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; } -}); -function partition(data, groupby) { - var groups = [], get = (f)=>f(t), map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; + }); + function partition$2(data2, groupby) { + var groups = [], get2 = (f) => f(t), map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); + map2[k] = g = []; + g.dims = k; + groups.push(g); } g.push(t); + } } return groups; -} -/** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array<number>} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ function Contour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Contour.Definition = { - 'type': 'Contour', - 'metadata': { - 'generates': true + } + function Contour(params2) { + Transform.call(this, null, params2); + } + Contour.Definition = { + "type": "Contour", + "metadata": { + "generates": true }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'values', - 'type': 'number', - 'array': true - }, - { - 'name': 'x', - 'type': 'field' - }, - { - 'name': 'y', - 'type': 'field' - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number' - }, - { - 'name': 'count', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - } - ] -}; -(0, _vegaUtil.inherits)(Contour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values), size = _.size, grid, post; - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [ - grid.width, - grid.height - ]; - values = grid.values; - } - thresh = (0, _vegaUtil.isArray)(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map((0, _vegaDataflow.ingest)); - return out; + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "values", + "type": "number", + "array": true + }, { + "name": "x", + "type": "field" + }, { + "name": "y", + "type": "field" + }, { + "name": "weight", + "type": "field" + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number" + }, { + "name": "count", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }] + }; + inherits(Contour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values2 = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values2), size = _.size, grid2, post; + if (!values2) { + values2 = pulse2.materialize(pulse2.SOURCE).source; + grid2 = params(density2D(), _)(values2, true); + post = transform$1(grid2, grid2.scale || 1, grid2.scale || 1, 0, 0); + size = [grid2.width, grid2.height]; + values2 = grid2.values; + } + thresh = isArray(thresh) ? thresh : thresh(values2); + values2 = contour.size(size)(values2, thresh); + if (post) values2.forEach(post); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = (values2 || []).map(ingest$1); + return out; } -}); -const Feature = 'Feature'; -const FeatureCollection = 'FeatureCollection'; -const MultiPoint = 'MultiPoint'; -/** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ function GeoJSON(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'length': 2 - }, - { - 'name': 'geojson', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(GeoJSON, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var features = this._features, points = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && (0, _vegaUtil.identity), flag = pulse.ADD, mod; - mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(geojson)) || lon && pulse.modified((0, _vegaUtil.accessorFields)(lon)) || lat && pulse.modified((0, _vegaUtil.accessorFields)(lat)); - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = features = []; - this._points = points = []; - } - if (geojson) pulse.visit(flag, (t)=>features.push(geojson(t))); - if (lon && lat) { - pulse.visit(flag, (t)=>{ - var x = lon(t), y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) points.push([ - x, - y - ]); - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - this.value = { - type: FeatureCollection, - features: features - }; + }); + const Feature = "Feature"; + const FeatureCollection = "FeatureCollection"; + const MultiPoint = "MultiPoint"; + function GeoJSON(params2) { + Transform.call(this, null, params2); + } + GeoJSON.Definition = { + "type": "GeoJSON", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "length": 2 + }, { + "name": "geojson", + "type": "field" + }] + }; + inherits(GeoJSON, Transform, { + transform(_, pulse2) { + var features = this._features, points2 = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && identity$2, flag2 = pulse2.ADD, mod; + mod = _.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(geojson)) || lon && pulse2.modified(accessorFields(lon)) || lat && pulse2.modified(accessorFields(lat)); + if (!this.value || mod) { + flag2 = pulse2.SOURCE; + this._features = features = []; + this._points = points2 = []; + } + if (geojson) { + pulse2.visit(flag2, (t) => features.push(geojson(t))); + } + if (lon && lat) { + pulse2.visit(flag2, (t) => { + var x2 = lon(t), y2 = lat(t); + if (x2 != null && y2 != null && (x2 = +x2) === x2 && (y2 = +y2) === y2) { + points2.push([x2, y2]); + } + }); + features = features.concat({ + type: Feature, + geometry: { + type: MultiPoint, + coordinates: points2 + } + }); + } + this.value = { + type: FeatureCollection, + features + }; } -}); -/** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ function GeoPath(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(GeoPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), path = this.value, field = _.field || (0, _vegaUtil.identity), as = _.as || 'path', flag = out.SOURCE; - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = (0, _vegaProjection.getProjectionPath)(_.projection); - out.materialize().reflow(); - } else flag = field === (0, _vegaUtil.identity) || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD; - const prev = initPath(path, _.pointRadius); - out.visit(flag, (t)=>t[as] = path(field(t))); - path.pointRadius(prev); - return out.modifies(as); - } -}); -function initPath(path, pointRadius) { - const prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) path.pointRadius(pointRadius); - return prev; -} -/** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array<function(object): *>} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array<string>} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ function GeoPoint(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': { - 'modifies': true + }); + function GeoPath(params2) { + Transform.call(this, null, params2); + } + GeoPath.Definition = { + "type": "GeoPath", + "metadata": { + "modifies": true }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection', - 'required': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'x', - 'y' - ] - } - ] -}; -(0, _vegaUtil.inherits)(GeoPoint, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || [ - 'x', - 'y' - ], x = as[0], y = as[1], mod; - function set(t) { - const xy = proj([ - lon(t), - lat(t) - ]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - if (_.modified()) // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - return pulse.modifies(as); - } -}); -/** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ function GeoShape(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': { - 'modifies': true, - 'nomod': true + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(GeoPath, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), path2 = this.value, field2 = _.field || identity$2, as = _.as || "path", flag2 = out.SOURCE; + if (!path2 || _.modified()) { + this.value = path2 = getProjectionPath(_.projection); + out.materialize().reflow(); + } else { + flag2 = field2 === identity$2 || pulse2.modified(field2.fields) ? out.ADD_MOD : out.ADD; + } + const prev = initPath(path2, _.pointRadius); + out.visit(flag2, (t) => t[as] = path2(field2(t))); + path2.pointRadius(prev); + return out.modifies(as); + } + }); + function initPath(path2, pointRadius) { + const prev = path2.pointRadius(); + path2.context(null); + if (pointRadius != null) { + path2.pointRadius(pointRadius); + } + return prev; + } + function GeoPoint(params2) { + Transform.call(this, null, params2); + } + GeoPoint.Definition = { + "type": "GeoPoint", + "metadata": { + "modifies": true }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field', - 'default': 'datum' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'shape' + "params": [{ + "name": "projection", + "type": "projection", + "required": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["x", "y"] + }] + }; + inherits(GeoPoint, Transform, { + transform(_, pulse2) { + var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || ["x", "y"], x2 = as[0], y2 = as[1], mod; + function set2(t) { + const xy = proj([lon(t), lat(t)]); + if (xy) { + t[x2] = xy[0]; + t[y2] = xy[1]; + } else { + t[x2] = void 0; + t[y2] = void 0; } - ] -}; -(0, _vegaUtil.inherits)(GeoShape, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), shape = this.value, as = _.as || 'shape', flag = out.ADD; - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator((0, _vegaProjection.getProjectionPath)(_.projection), _.field || (0, _vegaUtil.field)('datum'), _.pointRadius); - out.materialize().reflow(); - flag = out.SOURCE; - } - out.visit(flag, (t)=>t[as] = shape); - return out.modifies(as); - } -}); -function shapeGenerator(path, field, pointRadius) { - const shape = pointRadius == null ? (_)=>path(field(_)) : (_)=>{ - var prev = path.pointRadius(), value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = (_)=>{ - path.context(_); - return shape; - }; - return shape; -} -/** - * GeoJSON feature generator for creating graticules. - * @constructor - */ function Graticule(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.generator = (0, _d3Geo.geoGraticule)(); -} -Graticule.Definition = { - 'type': 'Graticule', - 'metadata': { - 'changes': true, - 'generates': true + } + if (_.modified()) { + pulse2 = pulse2.materialize().reflow(true).visit(pulse2.SOURCE, set2); + } else { + mod = pulse2.modified(lon.fields) || pulse2.modified(lat.fields); + pulse2.visit(mod ? pulse2.ADD_MOD : pulse2.ADD, set2); + } + return pulse2.modifies(as); + } + }); + function GeoShape(params2) { + Transform.call(this, null, params2); + } + GeoShape.Definition = { + "type": "GeoShape", + "metadata": { + "modifies": true, + "nomod": true }, - 'params': [ - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMajor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMinor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'step', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'stepMajor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 90, - 360 - ] - }, - { - 'name': 'stepMinor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 10, - 10 - ] - }, - { - 'name': 'precision', - 'type': 'number', - 'default': 2.5 - } - ] -}; -(0, _vegaUtil.inherits)(Graticule, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var src = this.value, gen = this.generator, t; - if (!src.length || _.modified()) { - for(const prop in _)if ((0, _vegaUtil.isFunction)(gen[prop])) gen[prop](_[prop]); - } - t = gen(); - if (src.length) pulse.mod.push((0, _vegaDataflow.replace)(src[0], t)); - else pulse.add.push((0, _vegaDataflow.ingest)(t)); - src[0] = t; - return pulse; - } -}); -/** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ function Heatmap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': { - 'modifies': true + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field", + "default": "datum" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "shape" + }] + }; + inherits(GeoShape, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), shape2 = this.value, as = _.as || "shape", flag2 = out.ADD; + if (!shape2 || _.modified()) { + this.value = shape2 = shapeGenerator(getProjectionPath(_.projection), _.field || field$1("datum"), _.pointRadius); + out.materialize().reflow(); + flag2 = out.SOURCE; + } + out.visit(flag2, (t) => t[as] = shape2); + return out.modifies(as); + } + }); + function shapeGenerator(path2, field2, pointRadius) { + const shape2 = pointRadius == null ? (_) => path2(field2(_)) : (_) => { + var prev = path2.pointRadius(), value2 = path2.pointRadius(pointRadius)(field2(_)); + path2.pointRadius(prev); + return value2; + }; + shape2.context = (_) => { + path2.context(_); + return shape2; + }; + return shape2; + } + function Graticule(params2) { + Transform.call(this, [], params2); + this.generator = graticule(); + } + Graticule.Definition = { + "type": "Graticule", + "metadata": { + "changes": true, + "generates": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'color', - 'type': 'string', - 'expr': true - }, - { - 'name': 'opacity', - 'type': 'number', - 'expr': true - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'image' + "params": [{ + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMajor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMinor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "step", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "stepMajor", + "type": "number", + "array": true, + "length": 2, + "default": [90, 360] + }, { + "name": "stepMinor", + "type": "number", + "array": true, + "length": 2, + "default": [10, 10] + }, { + "name": "precision", + "type": "number", + "default": 2.5 + }] + }; + inherits(Graticule, Transform, { + transform(_, pulse2) { + var src = this.value, gen = this.generator, t; + if (!src.length || _.modified()) { + for (const prop in _) { + if (isFunction(gen[prop])) { + gen[prop](_[prop]); + } } - ] -}; -(0, _vegaUtil.inherits)(Heatmap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.changed() && !_.modified()) return pulse.StopPropagation; - var source = pulse.materialize(pulse.SOURCE).source, shared = _.resolve === 'shared', field = _.field || (0, _vegaUtil.identity), opacity = opacity_(_.opacity, _), color = color_(_.color, _), as = _.as || 'image', obj = { - $x: 0, - $y: 0, - $value: 0, - $max: shared ? (0, _d3Array.max)(source.map((t)=>(0, _d3Array.max)(field(t).values))) : 0 - }; - source.forEach((t)=>{ - const v = field(t); - // build proxy data object - const o = (0, _vegaUtil.extend)({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = (0, _d3Array.max)(v.values || []); - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, color.dep ? color : (0, _vegaUtil.constant)(color(o)), opacity.dep ? opacity : (0, _vegaUtil.constant)(opacity(o))); - }); - return pulse.reflow(true).modifies(as); + } + t = gen(); + if (src.length) { + pulse2.mod.push(replace$1(src[0], t)); + } else { + pulse2.add.push(ingest$1(t)); + } + src[0] = t; + return pulse2; + } + }); + function Heatmap(params2) { + Transform.call(this, null, params2); + } + Heatmap.Definition = { + "type": "heatmap", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "color", + "type": "string", + "expr": true + }, { + "name": "opacity", + "type": "number", + "expr": true + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "as", + "type": "string", + "default": "image" + }] + }; + inherits(Heatmap, Transform, { + transform(_, pulse2) { + if (!pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var source2 = pulse2.materialize(pulse2.SOURCE).source, shared = _.resolve === "shared", field2 = _.field || identity$2, opacity2 = opacity_(_.opacity, _), color2 = color_(_.color, _), as = _.as || "image", obj2 = { + $x: 0, + $y: 0, + $value: 0, + $max: shared ? max$2(source2.map((t) => max$2(field2(t).values))) : 0 + }; + source2.forEach((t) => { + const v = field2(t); + const o = extend({}, t, obj2); + if (!shared) o.$max = max$2(v.values || []); + t[as] = toCanvas(v, o, color2.dep ? color2 : constant$4(color2(o)), opacity2.dep ? opacity2 : constant$4(opacity2(o))); + }); + return pulse2.reflow(true).modifies(as); } -}); -// get image color function -function color_(color, _) { + }); + function color_(color2, _) { let f; - if ((0, _vegaUtil.isFunction)(color)) { - f = (obj)=>(0, _d3Color.rgb)(color(obj, _)); - f.dep = dependency(color); - } else // default to mid-grey - f = (0, _vegaUtil.constant)((0, _d3Color.rgb)(color || '#888')); + if (isFunction(color2)) { + f = (obj2) => rgb$1(color2(obj2, _)); + f.dep = dependency(color2); + } else { + f = constant$4(rgb$1(color2 || "#888")); + } return f; -} -// get image opacity function -function opacity_(opacity, _) { + } + function opacity_(opacity2, _) { let f; - if ((0, _vegaUtil.isFunction)(opacity)) { - f = (obj)=>opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) f = (0, _vegaUtil.constant)(opacity); - else { - // default to [0, max] opacity gradient - f = (obj)=>obj.$value / obj.$max || 0; - f.dep = true; + if (isFunction(opacity2)) { + f = (obj2) => opacity2(obj2, _); + f.dep = dependency(opacity2); + } else if (opacity2) { + f = constant$4(opacity2); + } else { + f = (obj2) => obj2.$value / obj2.$max || 0; + f.dep = true; } return f; -} -// check if function depends on individual pixel data -function dependency(f) { - if (!(0, _vegaUtil.isFunction)(f)) return false; - const set = (0, _vegaUtil.toSet)((0, _vegaUtil.accessorFields)(f)); - return set.$x || set.$y || set.$value || set.$max; -} -// render raster grid to canvas -function toCanvas(grid, obj, color, opacity) { - const n = grid.width, m = grid.height, x1 = grid.x1 || 0, y1 = grid.y1 || 0, x2 = grid.x2 || n, y2 = grid.y2 || m, val = grid.values, value = val ? (i)=>val[i] : (0, _vegaUtil.zero), can = (0, _vegaCanvas.canvas)(x2 - x1, y2 - y1), ctx = can.getContext('2d'), img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), pix = img.data; - for(let j = y1, k = 0; j < y2; ++j){ - obj.$y = j - y1; - for(let i = x1, r = j * n; i < x2; ++i, k += 4){ - obj.$x = i - x1; - obj.$value = value(i + r); - const v = color(obj); - pix[k + 0] = v.r; - pix[k + 1] = v.g; - pix[k + 2] = v.b; - pix[k + 3] = ~~(255 * opacity(obj)); - } + } + function dependency(f) { + if (!isFunction(f)) return false; + const set2 = toSet(accessorFields(f)); + return set2.$x || set2.$y || set2.$value || set2.$max; + } + function toCanvas(grid2, obj2, color2, opacity2) { + const n = grid2.width, m2 = grid2.height, x12 = grid2.x1 || 0, y12 = grid2.y1 || 0, x2 = grid2.x2 || n, y2 = grid2.y2 || m2, val = grid2.values, value2 = val ? (i) => val[i] : zero$1, can = domCanvas(x2 - x12, y2 - y12), ctx = can.getContext("2d"), img = ctx.getImageData(0, 0, x2 - x12, y2 - y12), pix = img.data; + for (let j = y12, k = 0; j < y2; ++j) { + obj2.$y = j - y12; + for (let i = x12, r = j * n; i < x2; ++i, k += 4) { + obj2.$x = i - x12; + obj2.$value = value2(i + r); + const v = color2(obj2); + pix[k + 0] = v.r; + pix[k + 1] = v.g; + pix[k + 2] = v.b; + pix[k + 3] = ~~(255 * opacity2(obj2)); + } } ctx.putImageData(img, 0, 0); return can; -} -/** - * Maintains a cartographic projection. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Projection(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Projection, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let proj = this.value; - if (!proj || _.modified('type')) { - this.value = proj = create(_.type); - (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_[prop] != null) set(proj, prop, _[prop]); - }); - } else (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_.modified(prop)) set(proj, prop, _[prop]); + } + function Projection$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Projection$1, Transform, { + transform(_, pulse2) { + let proj = this.value; + if (!proj || _.modified("type")) { + this.value = proj = create(_.type); + projectionProperties.forEach((prop) => { + if (_[prop] != null) set$1(proj, prop, _[prop]); }); - if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); - if (_.fit) fit(proj, _); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function fit(proj, _) { - const data = collectGeoJSON(_.fit); - _.extent ? proj.fitExtent(_.extent, data) : _.size && proj.fitSize(_.size, data); -} -function create(type) { - const constructor = (0, _vegaProjection.projection)((type || 'mercator').toLowerCase()); - if (!constructor) (0, _vegaUtil.error)('Unrecognized projection type: ' + type); - return constructor(); -} -function set(proj, key, value) { - if ((0, _vegaUtil.isFunction)(proj[key])) proj[key](value); -} -function collectGeoJSON(data) { - data = (0, _vegaUtil.array)(data); - return data.length === 1 ? data[0] : { - type: FeatureCollection, - features: data.reduce((a, f)=>a.concat(featurize(f)), []) - }; -} -function featurize(f) { - return f.type === FeatureCollection ? f.features : (0, _vegaUtil.array)(f).filter((d)=>d != null).map((d)=>d.type === Feature ? d : { - type: Feature, - geometry: d + } else { + projectionProperties.forEach((prop) => { + if (_.modified(prop)) set$1(proj, prop, _[prop]); }); -} - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-array":"5lCYW","vega-statistics":"4QSQj","vega-projection":"erWDs","d3-geo":"8qTbc","d3-color":"37LNF","vega-canvas":"4O1hR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erWDs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getProjectionPath", ()=>getProjectionPath); -parcelHelpers.export(exports, "projection", ()=>projection); -parcelHelpers.export(exports, "projectionProperties", ()=>projectionProperties); -var _d3Geo = require("d3-geo"); -var _d3GeoProjection = require("d3-geo-projection"); -var _vegaScale = require("vega-scale"); -const defaultPath = (0, _d3Geo.geoPath)(); -const projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; -/** - * Augment projections with their type and a copy method. - */ function create(type, constructor) { - return function projection() { - const p = constructor(); - p.type = type; - p.path = (0, _d3Geo.geoPath)().projection(p); - p.copy = p.copy || function() { - const c = projection(); - projectionProperties.forEach((prop)=>{ - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - return (0, _vegaScale.registerScale)(p); - }; -} -function projection(type, proj) { - if (!type || typeof type !== 'string') throw new Error('Projection type must be a name string.'); - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create(type, proj); - return this; - } else return projections[type] || null; -} -function getProjectionPath(proj) { - return proj && proj.path || defaultPath; -} -const projections = { - // base d3-geo projection types - albers: (0, _d3Geo.geoAlbers), - albersusa: (0, _d3Geo.geoAlbersUsa), - azimuthalequalarea: (0, _d3Geo.geoAzimuthalEqualArea), - azimuthalequidistant: (0, _d3Geo.geoAzimuthalEquidistant), - conicconformal: (0, _d3Geo.geoConicConformal), - conicequalarea: (0, _d3Geo.geoConicEqualArea), - conicequidistant: (0, _d3Geo.geoConicEquidistant), - equalEarth: (0, _d3Geo.geoEqualEarth), - equirectangular: (0, _d3Geo.geoEquirectangular), - gnomonic: (0, _d3Geo.geoGnomonic), - identity: (0, _d3Geo.geoIdentity), - mercator: (0, _d3Geo.geoMercator), - mollweide: (0, _d3GeoProjection.geoMollweide), - naturalEarth1: (0, _d3Geo.geoNaturalEarth1), - orthographic: (0, _d3Geo.geoOrthographic), - stereographic: (0, _d3Geo.geoStereographic), - transversemercator: (0, _d3Geo.geoTransverseMercator) -}; -for(const key in projections)projection(key, projections[key]); - -},{"d3-geo":"8qTbc","d3-geo-projection":"fqIqT","vega-scale":"gHN3E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8qTbc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoArea", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "geoBounds", ()=>(0, _boundsJsDefault.default)); -parcelHelpers.export(exports, "geoCentroid", ()=>(0, _centroidJsDefault.default)); -parcelHelpers.export(exports, "geoCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "geoClipAntimeridian", ()=>(0, _antimeridianJsDefault.default)); -parcelHelpers.export(exports, "geoClipCircle", ()=>(0, _circleJsDefault1.default)); -parcelHelpers.export(exports, "geoClipExtent", ()=>(0, _extentJsDefault.default)) // DEPRECATED! Use d3.geoIdentity().clipExtent(…). -; -parcelHelpers.export(exports, "geoClipRectangle", ()=>(0, _rectangleJsDefault.default)); -parcelHelpers.export(exports, "geoContains", ()=>(0, _containsJsDefault.default)); -parcelHelpers.export(exports, "geoDistance", ()=>(0, _distanceJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule", ()=>(0, _graticuleJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule10", ()=>(0, _graticuleJs.graticule10)); -parcelHelpers.export(exports, "geoInterpolate", ()=>(0, _interpolateJsDefault.default)); -parcelHelpers.export(exports, "geoLength", ()=>(0, _lengthJsDefault.default)); -parcelHelpers.export(exports, "geoPath", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoAlbers", ()=>(0, _albersJsDefault.default)); -parcelHelpers.export(exports, "geoAlbersUsa", ()=>(0, _albersUsaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualArea", ()=>(0, _azimuthalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualAreaRaw", ()=>(0, _azimuthalEqualAreaJs.azimuthalEqualAreaRaw)); -parcelHelpers.export(exports, "geoAzimuthalEquidistant", ()=>(0, _azimuthalEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEquidistantRaw", ()=>(0, _azimuthalEquidistantJs.azimuthalEquidistantRaw)); -parcelHelpers.export(exports, "geoConicConformal", ()=>(0, _conicConformalJsDefault.default)); -parcelHelpers.export(exports, "geoConicConformalRaw", ()=>(0, _conicConformalJs.conicConformalRaw)); -parcelHelpers.export(exports, "geoConicEqualArea", ()=>(0, _conicEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoConicEqualAreaRaw", ()=>(0, _conicEqualAreaJs.conicEqualAreaRaw)); -parcelHelpers.export(exports, "geoConicEquidistant", ()=>(0, _conicEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoConicEquidistantRaw", ()=>(0, _conicEquidistantJs.conicEquidistantRaw)); -parcelHelpers.export(exports, "geoEqualEarth", ()=>(0, _equalEarthJsDefault.default)); -parcelHelpers.export(exports, "geoEqualEarthRaw", ()=>(0, _equalEarthJs.equalEarthRaw)); -parcelHelpers.export(exports, "geoEquirectangular", ()=>(0, _equirectangularJsDefault.default)); -parcelHelpers.export(exports, "geoEquirectangularRaw", ()=>(0, _equirectangularJs.equirectangularRaw)); -parcelHelpers.export(exports, "geoGnomonic", ()=>(0, _gnomonicJsDefault.default)); -parcelHelpers.export(exports, "geoGnomonicRaw", ()=>(0, _gnomonicJs.gnomonicRaw)); -parcelHelpers.export(exports, "geoIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "geoProjection", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoProjectionMutator", ()=>(0, _indexJs1.projectionMutator)); -parcelHelpers.export(exports, "geoMercator", ()=>(0, _mercatorJsDefault.default)); -parcelHelpers.export(exports, "geoMercatorRaw", ()=>(0, _mercatorJs.mercatorRaw)); -parcelHelpers.export(exports, "geoNaturalEarth1", ()=>(0, _naturalEarth1JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth1Raw", ()=>(0, _naturalEarth1Js.naturalEarth1Raw)); -parcelHelpers.export(exports, "geoOrthographic", ()=>(0, _orthographicJsDefault.default)); -parcelHelpers.export(exports, "geoOrthographicRaw", ()=>(0, _orthographicJs.orthographicRaw)); -parcelHelpers.export(exports, "geoStereographic", ()=>(0, _stereographicJsDefault.default)); -parcelHelpers.export(exports, "geoStereographicRaw", ()=>(0, _stereographicJs.stereographicRaw)); -parcelHelpers.export(exports, "geoTransverseMercator", ()=>(0, _transverseMercatorJsDefault.default)); -parcelHelpers.export(exports, "geoTransverseMercatorRaw", ()=>(0, _transverseMercatorJs.transverseMercatorRaw)); -parcelHelpers.export(exports, "geoRotation", ()=>(0, _rotationJsDefault.default)); -parcelHelpers.export(exports, "geoStream", ()=>(0, _streamJsDefault.default)); -parcelHelpers.export(exports, "geoTransform", ()=>(0, _transformJsDefault.default)); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _circleJs = require("./circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _antimeridianJs = require("./clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs1 = require("./clip/circle.js"); -var _circleJsDefault1 = parcelHelpers.interopDefault(_circleJs1); -var _extentJs = require("./clip/extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _rectangleJs = require("./clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _containsJs = require("./contains.js"); -var _containsJsDefault = parcelHelpers.interopDefault(_containsJs); -var _distanceJs = require("./distance.js"); -var _distanceJsDefault = parcelHelpers.interopDefault(_distanceJs); -var _graticuleJs = require("./graticule.js"); -var _graticuleJsDefault = parcelHelpers.interopDefault(_graticuleJs); -var _interpolateJs = require("./interpolate.js"); -var _interpolateJsDefault = parcelHelpers.interopDefault(_interpolateJs); -var _lengthJs = require("./length.js"); -var _lengthJsDefault = parcelHelpers.interopDefault(_lengthJs); -var _indexJs = require("./path/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _albersJs = require("./projection/albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _albersUsaJs = require("./projection/albersUsa.js"); -var _albersUsaJsDefault = parcelHelpers.interopDefault(_albersUsaJs); -var _azimuthalEqualAreaJs = require("./projection/azimuthalEqualArea.js"); -var _azimuthalEqualAreaJsDefault = parcelHelpers.interopDefault(_azimuthalEqualAreaJs); -var _azimuthalEquidistantJs = require("./projection/azimuthalEquidistant.js"); -var _azimuthalEquidistantJsDefault = parcelHelpers.interopDefault(_azimuthalEquidistantJs); -var _conicConformalJs = require("./projection/conicConformal.js"); -var _conicConformalJsDefault = parcelHelpers.interopDefault(_conicConformalJs); -var _conicEqualAreaJs = require("./projection/conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _conicEquidistantJs = require("./projection/conicEquidistant.js"); -var _conicEquidistantJsDefault = parcelHelpers.interopDefault(_conicEquidistantJs); -var _equalEarthJs = require("./projection/equalEarth.js"); -var _equalEarthJsDefault = parcelHelpers.interopDefault(_equalEarthJs); -var _equirectangularJs = require("./projection/equirectangular.js"); -var _equirectangularJsDefault = parcelHelpers.interopDefault(_equirectangularJs); -var _gnomonicJs = require("./projection/gnomonic.js"); -var _gnomonicJsDefault = parcelHelpers.interopDefault(_gnomonicJs); -var _identityJs = require("./projection/identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _indexJs1 = require("./projection/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _mercatorJs = require("./projection/mercator.js"); -var _mercatorJsDefault = parcelHelpers.interopDefault(_mercatorJs); -var _naturalEarth1Js = require("./projection/naturalEarth1.js"); -var _naturalEarth1JsDefault = parcelHelpers.interopDefault(_naturalEarth1Js); -var _orthographicJs = require("./projection/orthographic.js"); -var _orthographicJsDefault = parcelHelpers.interopDefault(_orthographicJs); -var _stereographicJs = require("./projection/stereographic.js"); -var _stereographicJsDefault = parcelHelpers.interopDefault(_stereographicJs); -var _transverseMercatorJs = require("./projection/transverseMercator.js"); -var _transverseMercatorJsDefault = parcelHelpers.interopDefault(_transverseMercatorJs); -var _rotationJs = require("./rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./area.js":"3gH4a","./bounds.js":"9hzuk","./centroid.js":"copnD","./circle.js":false,"./clip/antimeridian.js":false,"./clip/circle.js":false,"./clip/extent.js":false,"./clip/rectangle.js":false,"./contains.js":false,"./distance.js":false,"./graticule.js":"24Rpv","./interpolate.js":false,"./length.js":false,"./path/index.js":"aay0S","./projection/albers.js":"lnSxc","./projection/albersUsa.js":"3HuY2","./projection/azimuthalEqualArea.js":"02C8V","./projection/azimuthalEquidistant.js":"7a1uH","./projection/conicConformal.js":"7BV5L","./projection/conicEqualArea.js":"g4p5m","./projection/conicEquidistant.js":"9oUmd","./projection/equalEarth.js":"eILUC","./projection/equirectangular.js":"73t8d","./projection/gnomonic.js":"93udH","./projection/identity.js":"9vqqR","./projection/index.js":"7QH2d","./projection/mercator.js":"a3UOt","./projection/naturalEarth1.js":"erpNS","./projection/orthographic.js":"7NqTM","./projection/stereographic.js":"grd1o","./projection/transverseMercator.js":"93Ws5","./rotation.js":false,"./stream.js":false,"./transform.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3gH4a":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "areaRingSum", ()=>areaRingSum); -parcelHelpers.export(exports, "areaStream", ()=>areaStream); -parcelHelpers.export(exports, "default", ()=>function(object) { - areaSum = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, areaStream); - return areaSum * 2; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var areaRingSum = new (0, _d3Array.Adder)(); -// hello? -var areaSum = new (0, _d3Array.Adder)(), lambda00, phi00, lambda0, cosPhi0, sinPhi0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaRingSum = new (0, _d3Array.Adder)(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? (0, _mathJs.tau) + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = (0, _noopJsDefault.default); - }, - sphere: function() { - areaSum.add((0, _mathJs.tau)); - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaRingEnd() { - areaPoint(lambda00, phi00); -} -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - lambda0 = lambda, cosPhi0 = (0, _mathJs.cos)(phi = phi / 2 + (0, _mathJs.quarterPi)), sinPhi0 = (0, _mathJs.sin)(phi); -} -function areaPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - phi = phi / 2 + (0, _mathJs.quarterPi); // half the angular distance from south pole - // Spherical excess E for a spherical triangle with vertices: south pole, - // previous point, current point. Uses a formula derived from Cagnoli’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = (0, _mathJs.cos)(phi), sinPhi = (0, _mathJs.sin)(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * (0, _mathJs.cos)(adLambda), v = k * sdLambda * (0, _mathJs.sin)(adLambda); - areaRingSum.add((0, _mathJs.atan2)(v, u)); - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} - -},{"d3-array":"5lCYW","./math.js":"kc9MU","./noop.js":"cEfoF","./stream.js":"hPbYn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kc9MU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "hypot", ()=>hypot); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "haversin", ()=>haversin); -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var ceil = Math.ceil; -var exp = Math.exp; -var floor = Math.floor; -var hypot = Math.hypot; -var log = Math.log; -var pow = Math.pow; -var sin = Math.sin; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sqrt = Math.sqrt; -var tan = Math.tan; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function haversin(x) { - return (x = sin(x / 2)) * x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEfoF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>noop); -function noop() {} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hPbYn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object, stream) { - if (object && streamObjectType.hasOwnProperty(object.type)) streamObjectType[object.type](object, stream); - else streamGeometry(object, stream); - }); -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) streamGeometryType[geometry.type](geometry, stream); -} -var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while(++i < n)streamGeometry(features[i].geometry, stream); - } -}; -var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); - }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)object = coordinates[i], stream.point(object[0], object[1], object[2]); - }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamLine(coordinates[i], stream, 0); - }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamPolygon(coordinates[i], stream); - }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while(++i < n)streamGeometry(geometries[i], stream); - } -}; -function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while(++i < n)coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} -function streamPolygon(coordinates, stream) { - var i = -1, n = coordinates.length; - stream.polygonStart(); - while(++i < n)streamLine(coordinates[i], stream, 1); - stream.polygonEnd(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9hzuk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(feature) { - var i, n, a, b, merged, deltaMax, delta; - phi1 = lambda1 = -(lambda0 = phi0 = Infinity); - ranges = []; - (0, _streamJsDefault.default)(feature, boundsStream); - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - // Then, merge any ranges that overlap. - for(i = 1, a = ranges[0], merged = [ - a - ]; i < n; ++i){ - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; - } else merged.push(a = b); - } - // Finally, find the largest gap between the merged ranges. - // The final bounding box will be the inverse of this gap. - for(deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i){ - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1]; - } - } - ranges = range = null; - return lambda0 === Infinity || phi0 === Infinity ? [ - [ - NaN, - NaN - ], - [ - NaN, - NaN - ] - ] : [ - [ - lambda0, - phi0 - ], - [ - lambda1, - phi1 - ] - ]; - }); -var _d3Array = require("d3-array"); -var _areaJs = require("./area.js"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var lambda0, phi0, lambda1, phi1, lambda2, lambda00, phi00, p0, deltaSum, ranges, range; -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum = new (0, _d3Array.Adder)(); - (0, _areaJs.areaStream).polygonStart(); - }, - polygonEnd: function() { - (0, _areaJs.areaStream).polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if ((0, _areaJs.areaRingSum) < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > (0, _mathJs.epsilon)) phi1 = 90; - else if (deltaSum < -(0, _mathJs.epsilon)) phi0 = -90; - range[0] = lambda0, range[1] = lambda1; - }, - sphere: function() { - lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } -}; -function boundsPoint(lambda, phi) { - ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; -} -function linePoint(lambda, phi) { - var p = (0, _cartesianJs.cartesian)([ - lambda * (0, _mathJs.radians), - phi * (0, _mathJs.radians) - ]); - if (p0) { - var normal = (0, _cartesianJs.cartesianCross)(p0, p), equatorial = [ - normal[1], - -normal[0], - 0 - ], inflection = (0, _cartesianJs.cartesianCross)(equatorial, normal); - (0, _cartesianJs.cartesianNormalizeInPlace)(inflection); - inflection = (0, _cartesianJs.spherical)(inflection); - var delta = lambda - lambda2, sign = delta > 0 ? 1 : -1, lambdai = inflection[0] * (0, _mathJs.degrees) * sign, phii, antimeridian = (0, _mathJs.abs)(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * (0, _mathJs.degrees); - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * (0, _mathJs.degrees); - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } else if (lambda1 >= lambda0) { - if (lambda < lambda0) lambda0 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } - } else ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; -} -function boundsLineStart() { - boundsStream.point = linePoint; -} -function boundsLineEnd() { - range[0] = lambda0, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add((0, _mathJs.abs)(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else lambda00 = lambda, phi00 = phi; - (0, _areaJs.areaStream).point(lambda, phi); - linePoint(lambda, phi); -} -function boundsRingStart() { - (0, _areaJs.areaStream).lineStart(); -} -function boundsRingEnd() { - boundsRingPoint(lambda00, phi00); - (0, _areaJs.areaStream).lineEnd(); - if ((0, _mathJs.abs)(deltaSum) > (0, _mathJs.epsilon)) lambda0 = -(lambda1 = 180); - range[0] = lambda0, range[1] = lambda1; - p0 = null; -} -// Finds the left-right distance between two longitudes. -// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want -// the distance between ±180° to be 360°. -function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; -} -function rangeCompare(a, b) { - return a[0] - b[0]; -} -function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; -} - -},{"d3-array":"5lCYW","./area.js":"3gH4a","./cartesian.js":"9WnrC","./math.js":"kc9MU","./stream.js":"hPbYn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9WnrC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "spherical", ()=>spherical); -parcelHelpers.export(exports, "cartesian", ()=>cartesian); -parcelHelpers.export(exports, "cartesianDot", ()=>cartesianDot); -parcelHelpers.export(exports, "cartesianCross", ()=>cartesianCross); -// TODO return a -parcelHelpers.export(exports, "cartesianAddInPlace", ()=>cartesianAddInPlace); -parcelHelpers.export(exports, "cartesianScale", ()=>cartesianScale); -// TODO return d -parcelHelpers.export(exports, "cartesianNormalizeInPlace", ()=>cartesianNormalizeInPlace); -var _mathJs = require("./math.js"); -function spherical(cartesian) { - return [ - (0, _mathJs.atan2)(cartesian[1], cartesian[0]), - (0, _mathJs.asin)(cartesian[2]) - ]; -} -function cartesian(spherical) { - var lambda = spherical[0], phi = spherical[1], cosPhi = (0, _mathJs.cos)(phi); - return [ - cosPhi * (0, _mathJs.cos)(lambda), - cosPhi * (0, _mathJs.sin)(lambda), - (0, _mathJs.sin)(phi) - ]; -} -function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cartesianCross(a, b) { - return [ - a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0] - ]; -} -function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; -} -function cartesianScale(vector, k) { - return [ - vector[0] * k, - vector[1] * k, - vector[2] * k - ]; -} -function cartesianNormalizeInPlace(d) { - var l = (0, _mathJs.sqrt)(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} - -},{"./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"copnD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object) { - W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0; - X2 = new (0, _d3Array.Adder)(); - Y2 = new (0, _d3Array.Adder)(); - Z2 = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, centroidStream); - var x = +X2, y = +Y2, z = +Z2, m = (0, _mathJs.hypot)(x, y, z); - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < (0, _mathJs.epsilon2)) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < (0, _mathJs.epsilon)) x = X0, y = Y0, z = Z0; - m = (0, _mathJs.hypot)(x, y, z); - // If the feature still has an undefined ccentroid, then return. - if (m < (0, _mathJs.epsilon2)) return [ - NaN, - NaN - ]; - } - return [ - (0, _mathJs.atan2)(y, x) * (0, _mathJs.degrees), - (0, _mathJs.asin)(z / m) * (0, _mathJs.degrees) - ]; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00, phi00, x0, y0, z0; // previous point -var centroidStream = { - sphere: (0, _noopJsDefault.default), - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; -// Arithmetic mean of Cartesian vectors. -function centroidPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - centroidPointCartesian(cosPhi * (0, _mathJs.cos)(lambda), cosPhi * (0, _mathJs.sin)(lambda), (0, _mathJs.sin)(phi)); -} -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} -function centroidLinePointFirst(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} -function centroidLinePoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), w = (0, _mathJs.atan2)((0, _mathJs.sqrt)((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, -// J. Applied Mechanics 42, 239 (1975). -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} -function centroidRingEnd() { - centroidRingPoint(lambda00, phi00); - centroidStream.point = centroidPoint; -} -function centroidRingPointFirst(lambda, phi) { - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - centroidStream.point = centroidRingPoint; - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidPointCartesian(x0, y0, z0); -} -function centroidRingPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = (0, _mathJs.hypot)(cx, cy, cz), w = (0, _mathJs.asin)(m), v = m && -w / m; // area weight multiplier - X2.add(v * cx); - Y2.add(v * cy); - Z2.add(v * cz); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -},{"d3-array":"5lCYW","./math.js":"kc9MU","./noop.js":"cEfoF","./stream.js":"hPbYn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"JRkjq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Generates a circle centered at [0°, 0°], with a given radius and precision. -parcelHelpers.export(exports, "circleStream", ()=>circleStream); -parcelHelpers.export(exports, "default", ()=>function() { - var center = (0, _constantJsDefault.default)([ - 0, - 0 - ]), radius = (0, _constantJsDefault.default)(90), precision = (0, _constantJsDefault.default)(2), ring, rotate, stream = { - point: point - }; - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= (0, _mathJs.degrees), x[1] *= (0, _mathJs.degrees); - } - function circle() { - var c = center.apply(this, arguments), r = radius.apply(this, arguments) * (0, _mathJs.radians), p = precision.apply(this, arguments) * (0, _mathJs.radians); - ring = []; - rotate = (0, _rotationJs.rotateRadians)(-c[0] * (0, _mathJs.radians), -c[1] * (0, _mathJs.radians), 0).invert; - circleStream(stream, r, p, 1); - c = { - type: "Polygon", - coordinates: [ - ring - ] - }; - ring = rotate = null; - return c; - } - circle.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - +_[0], - +_[1] - ]), circle) : center; - }; - circle.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : radius; - }; - circle.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : precision; - }; - return circle; - }); -var _cartesianJs = require("./cartesian.js"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _rotationJs = require("./rotation.js"); -function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = (0, _mathJs.cos)(radius), sinRadius = (0, _mathJs.sin)(radius), step = direction * delta; - if (t0 == null) { - t0 = radius + direction * (0, _mathJs.tau); - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * (0, _mathJs.tau); - } - for(var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step){ - point = (0, _cartesianJs.spherical)([ - cosRadius, - -sinRadius * (0, _mathJs.cos)(t), - -sinRadius * (0, _mathJs.sin)(t) - ]); - stream.point(point[0], point[1]); - } -} -// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. -function circleRadius(cosRadius, point) { - point = (0, _cartesianJs.cartesian)(point), point[0] -= cosRadius; - (0, _cartesianJs.cartesianNormalizeInPlace)(point); - var radius = (0, _mathJs.acos)(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + (0, _mathJs.tau) - (0, _mathJs.epsilon)) % (0, _mathJs.tau); -} - -},{"./cartesian.js":"9WnrC","./constant.js":"5lnun","./math.js":"kc9MU","./rotation.js":"7JtV8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5lnun":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7JtV8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rotateRadians", ()=>rotateRadians); -parcelHelpers.export(exports, "default", ()=>function(rotate) { - rotate = rotateRadians(rotate[0] * (0, _mathJs.radians), rotate[1] * (0, _mathJs.radians), rotate.length > 2 ? rotate[2] * (0, _mathJs.radians) : 0); - function forward(coordinates) { - coordinates = rotate(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - } - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - }; - return forward; - }); -var _composeJs = require("./compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _mathJs = require("./math.js"); -function rotationIdentity(lambda, phi) { - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; -} -rotationIdentity.invert = rotationIdentity; -function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= (0, _mathJs.tau)) ? deltaPhi || deltaGamma ? (0, _composeJsDefault.default)(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; -} -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - lambda += deltaLambda; - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; - }; -} -function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; -} -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = (0, _mathJs.cos)(deltaPhi), sinDeltaPhi = (0, _mathJs.sin)(deltaPhi), cosDeltaGamma = (0, _mathJs.cos)(deltaGamma), sinDeltaGamma = (0, _mathJs.sin)(deltaGamma); - function rotation(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaGamma + y * sinDeltaGamma) - ]; + } + if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); + if (_.fit) fit(proj, _); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - rotation.invert = function(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - return rotation; -} - -},{"./compose.js":"P6ZIv","./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"P6ZIv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6JM2n":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -exports.default = (0, _indexJsDefault.default)(function() { - return true; -}, clipAntimeridianLine, clipAntimeridianInterpolate, [ - -(0, _mathJs.pi), - -(0, _mathJs.halfPi) -]); -// Takes a line and cuts into visible segments. Return values: 0 - there were -// intersections or the line was empty; 1 - no intersections; 2 - there were -// intersections, and the first and last segments should be rejoined. -function clipAntimeridianLine(stream) { - var lambda0 = NaN, phi0 = NaN, sign0 = NaN, clean; // no intersections - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi), delta = (0, _mathJs.abs)(lambda1 - lambda0); - if ((0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon)) { - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? (0, _mathJs.halfPi) : -(0, _mathJs.halfPi)); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= (0, _mathJs.pi)) { - if ((0, _mathJs.abs)(lambda0 - sign0) < (0, _mathJs.epsilon)) lambda0 -= sign0 * (0, _mathJs.epsilon); // handle degeneracies - if ((0, _mathJs.abs)(lambda1 - sign1) < (0, _mathJs.epsilon)) lambda1 -= sign1 * (0, _mathJs.epsilon); - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; -} -function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, cosPhi1, sinLambda0Lambda1 = (0, _mathJs.sin)(lambda0 - lambda1); - return (0, _mathJs.abs)(sinLambda0Lambda1) > (0, _mathJs.epsilon) ? (0, _mathJs.atan)(((0, _mathJs.sin)(phi0) * (cosPhi1 = (0, _mathJs.cos)(phi1)) * (0, _mathJs.sin)(lambda1) - (0, _mathJs.sin)(phi1) * (cosPhi0 = (0, _mathJs.cos)(phi0)) * (0, _mathJs.sin)(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2; -} -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * (0, _mathJs.halfPi); - stream.point(-(0, _mathJs.pi), phi); - stream.point(0, phi); - stream.point((0, _mathJs.pi), phi); - stream.point((0, _mathJs.pi), 0); - stream.point((0, _mathJs.pi), -phi); - stream.point(0, -phi); - stream.point(-(0, _mathJs.pi), -phi); - stream.point(-(0, _mathJs.pi), 0); - stream.point(-(0, _mathJs.pi), phi); - } else if ((0, _mathJs.abs)(from[0] - to[0]) > (0, _mathJs.epsilon)) { - var lambda = from[0] < to[0] ? (0, _mathJs.pi) : -(0, _mathJs.pi); - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else stream.point(to[0], to[1]); -} - -},{"./index.js":"6CuX6","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6CuX6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(pointVisible, clipLine, interpolate, start) { - return function(sink) { - var line = clipLine(sink), ringBuffer = (0, _bufferJsDefault.default)(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon, segments, ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = (0, _d3Array.merge)(segments); - var startInside = (0, _polygonContainsJsDefault.default)(polygon, start); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function() { - sink.polygonStart(); - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - sink.polygonEnd(); - } - }; - function point(lambda, phi) { - if (pointVisible(lambda, phi)) sink.point(lambda, phi); - } - function pointLine(lambda, phi) { - line.point(lambda, phi); - } - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - function pointRing(lambda, phi) { - ring.push([ - lambda, - phi - ]); - ringSink.point(lambda, phi); - } - function ringStart() { - ringSink.lineStart(); - ring = []; - } - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for(i = 0; i < m; ++i)sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(validSegment)); - } - return clip; - }; - }); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _mathJs = require("../math.js"); -var _polygonContainsJs = require("../polygonContains.js"); -var _polygonContainsJsDefault = parcelHelpers.interopDefault(_polygonContainsJs); -var _d3Array = require("d3-array"); -function validSegment(segment) { - return segment.length > 1; -} -// Intersections are sorted along the clip edge. For both antimeridian cutting -// and circle clipping, the same comparison is used. -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - a[1]) - ((b = b.x)[0] < 0 ? b[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - b[1]); -} - -},{"./buffer.js":"k9qlR","./rejoin.js":"jrWAP","../math.js":"kc9MU","../polygonContains.js":"5DZUf","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k9qlR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var lines = [], line; - return { - point: function(x, y, m) { - line.push([ - x, - y, - m - ]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: (0, _noopJsDefault.default), - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; + }); + function fit(proj, _) { + const data2 = collectGeoJSON(_.fit); + _.extent ? proj.fitExtent(_.extent, data2) : _.size ? proj.fitSize(_.size, data2) : 0; + } + function create(type2) { + const constructor = projection((type2 || "mercator").toLowerCase()); + if (!constructor) error("Unrecognized projection type: " + type2); + return constructor(); + } + function set$1(proj, key2, value2) { + if (isFunction(proj[key2])) proj[key2](value2); + } + function collectGeoJSON(data2) { + data2 = array$4(data2); + return data2.length === 1 ? data2[0] : { + type: FeatureCollection, + features: data2.reduce((a2, f) => a2.concat(featurize(f)), []) + }; + } + function featurize(f) { + return f.type === FeatureCollection ? f.features : array$4(f).filter((d2) => d2 != null).map((d2) => d2.type === Feature ? d2 : { + type: Feature, + geometry: d2 }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); - -},{"../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jrWAP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A generalized polygon clipping algorithm: given a polygon that has been cut -// into its visible line segments, and rejoins the segments by interpolating -// along the clip edge. -parcelHelpers.export(exports, "default", ()=>function(segments, compareIntersection, startInside, interpolate, stream) { - var subject = [], clip = [], i, n; - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - if ((0, _pointEqualJsDefault.default)(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - for(i = 0; i < n; ++i)stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - // handle degenerate cases by moving the point - p1[0] += 2 * (0, _mathJs.epsilon); - } - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - if (!subject.length) return; - clip.sort(compareIntersection); - link(subject); - link(clip); - for(i = 0, n = clip.length; i < n; ++i)clip[i].e = startInside = !startInside; - var start = subject[0], points, point; - while(true){ - // Find first unvisited intersection. - var current = start, isSubject = true; - while(current.v)if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) for(i = 0, n = points.length; i < n; ++i)stream.point((point = points[i])[0], point[1]); - else interpolate(current.x, current.n.x, 1, stream); - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for(i = points.length - 1; i >= 0; --i)stream.point((point = points[i])[0], point[1]); - } else interpolate(current.x, current.p.x, -1, stream); - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - }while (!current.v); - stream.lineEnd(); + } + const geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + contour: Contour, + geojson: GeoJSON, + geopath: GeoPath, + geopoint: GeoPoint, + geoshape: GeoShape, + graticule: Graticule, + heatmap: Heatmap, + isocontour: Isocontour, + kde2d: KDE2D, + projection: Projection$1 + }, Symbol.toStringTag, { value: "Module" })); + function forceCenter(x2, y2) { + var nodes, strength = 1; + if (x2 == null) x2 = 0; + if (y2 == null) y2 = 0; + function force2() { + var i, n = nodes.length, node, sx = 0, sy = 0; + for (i = 0; i < n; ++i) { + node = nodes[i], sx += node.x, sy += node.y; + } + for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) { + node = nodes[i], node.x -= sx, node.y -= sy; + } + } + force2.initialize = function(_) { + nodes = _; + }; + force2.x = function(_) { + return arguments.length ? (x2 = +_, force2) : x2; + }; + force2.y = function(_) { + return arguments.length ? (y2 = +_, force2) : y2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + return force2; + } + function tree_add(d2) { + const x2 = +this._x.call(null, d2), y2 = +this._y.call(null, d2); + return add(this.cover(x2, y2), x2, y2, d2); + } + function add(tree2, x2, y2, d2) { + if (isNaN(x2) || isNaN(y2)) return tree2; + var parent, node = tree2._root, leaf = { data: d2 }, x02 = tree2._x0, y02 = tree2._y0, x12 = tree2._x1, y12 = tree2._y1, xm, ym, xp, yp, right, bottom, i, j; + if (!node) return tree2._root = leaf, tree2; + while (node.length) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree2; + } + xp = +tree2._x.call(null, node.data); + yp = +tree2._y.call(null, node.data); + if (x2 === xp && y2 === yp) return leaf.next = node, parent ? parent[i] = leaf : tree2._root = leaf, tree2; + do { + parent = parent ? parent[i] = new Array(4) : tree2._root = new Array(4); + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); + return parent[j] = node, parent[i] = leaf, tree2; + } + function addAll(data2) { + var d2, i, n = data2.length, x2, y2, xz = new Array(n), yz = new Array(n), x02 = Infinity, y02 = Infinity, x12 = -Infinity, y12 = -Infinity; + for (i = 0; i < n; ++i) { + if (isNaN(x2 = +this._x.call(null, d2 = data2[i])) || isNaN(y2 = +this._y.call(null, d2))) continue; + xz[i] = x2; + yz[i] = y2; + if (x2 < x02) x02 = x2; + if (x2 > x12) x12 = x2; + if (y2 < y02) y02 = y2; + if (y2 > y12) y12 = y2; + } + if (x02 > x12 || y02 > y12) return this; + this.cover(x02, y02).cover(x12, y12); + for (i = 0; i < n; ++i) { + add(this, xz[i], yz[i], data2[i]); + } + return this; + } + function tree_cover(x2, y2) { + if (isNaN(x2 = +x2) || isNaN(y2 = +y2)) return this; + var x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1; + if (isNaN(x02)) { + x12 = (x02 = Math.floor(x2)) + 1; + y12 = (y02 = Math.floor(y2)) + 1; + } else { + var z2 = x12 - x02 || 1, node = this._root, parent, i; + while (x02 > x2 || x2 >= x12 || y02 > y2 || y2 >= y12) { + i = (y2 < y02) << 1 | x2 < x02; + parent = new Array(4), parent[i] = node, node = parent, z2 *= 2; + switch (i) { + case 0: + x12 = x02 + z2, y12 = y02 + z2; + break; + case 1: + x02 = x12 - z2, y12 = y02 + z2; + break; + case 2: + x12 = x02 + z2, y02 = y12 - z2; + break; + case 3: + x02 = x12 - z2, y02 = y12 - z2; + break; } + } + if (this._root && this._root.length) this._root = node; + } + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + return this; + } + function tree_data() { + var data2 = []; + this.visit(function(node) { + if (!node.length) do + data2.push(node.data); + while (node = node.next); }); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _mathJs = require("../math.js"); -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = null; // next & previous -} -function link(array) { - if (!(n = array.length)) return; - var n, i = 0, a = array[0], b; - while(++i < n){ - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} - -},{"../pointEqual.js":"8yvsz","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8yvsz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return (0, _mathJs.abs)(a[0] - b[0]) < (0, _mathJs.epsilon) && (0, _mathJs.abs)(a[1] - b[1]) < (0, _mathJs.epsilon); - }); -var _mathJs = require("./math.js"); - -},{"./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5DZUf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(polygon, point) { - var lambda = longitude(point), phi = point[1], sinPhi = (0, _mathJs.sin)(phi), normal = [ - (0, _mathJs.sin)(lambda), - -(0, _mathJs.cos)(lambda), - 0 - ], angle = 0, winding = 0; - var sum = new (0, _d3Array.Adder)(); - if (sinPhi === 1) phi = (0, _mathJs.halfPi) + (0, _mathJs.epsilon); - else if (sinPhi === -1) phi = -(0, _mathJs.halfPi) - (0, _mathJs.epsilon); - for(var i = 0, n = polygon.length; i < n; ++i){ - if (!(m = (ring = polygon[i]).length)) continue; - var ring, m, point0 = ring[m - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + (0, _mathJs.quarterPi), sinPhi0 = (0, _mathJs.sin)(phi0), cosPhi0 = (0, _mathJs.cos)(phi0); - for(var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1){ - var point1 = ring[j], lambda1 = longitude(point1), phi1 = point1[1] / 2 + (0, _mathJs.quarterPi), sinPhi1 = (0, _mathJs.sin)(phi1), cosPhi1 = (0, _mathJs.cos)(phi1), delta = lambda1 - lambda0, sign = delta >= 0 ? 1 : -1, absDelta = sign * delta, antimeridian = absDelta > (0, _mathJs.pi), k = sinPhi0 * sinPhi1; - sum.add((0, _mathJs.atan2)(k * sign * (0, _mathJs.sin)(absDelta), cosPhi0 * cosPhi1 + k * (0, _mathJs.cos)(absDelta))); - angle += antimeridian ? delta + sign * (0, _mathJs.tau) : delta; - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = (0, _cartesianJs.cartesianCross)((0, _cartesianJs.cartesian)(point0), (0, _cartesianJs.cartesian)(point1)); - (0, _cartesianJs.cartesianNormalizeInPlace)(arc); - var intersection = (0, _cartesianJs.cartesianCross)(normal, arc); - (0, _cartesianJs.cartesianNormalizeInPlace)(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * (0, _mathJs.asin)(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) winding += antimeridian ^ delta >= 0 ? 1 : -1; - } - } + return data2; + } + function tree_extent(_) { + return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]]; + } + function Quad(node, x02, y02, x12, y12) { + this.node = node; + this.x0 = x02; + this.y0 = y02; + this.x1 = x12; + this.y1 = y12; + } + function tree_find(x2, y2, radius2) { + var data2, x02 = this._x0, y02 = this._y0, x12, y12, x22, y22, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; + if (node) quads.push(new Quad(node, x02, y02, x3, y3)); + if (radius2 == null) radius2 = Infinity; + else { + x02 = x2 - radius2, y02 = y2 - radius2; + x3 = x2 + radius2, y3 = y2 + radius2; + radius2 *= radius2; + } + while (q = quads.pop()) { + if (!(node = q.node) || (x12 = q.x0) > x3 || (y12 = q.y0) > y3 || (x22 = q.x1) < x02 || (y22 = q.y1) < y02) continue; + if (node.length) { + var xm = (x12 + x22) / 2, ym = (y12 + y22) / 2; + quads.push( + new Quad(node[3], xm, ym, x22, y22), + new Quad(node[2], x12, ym, xm, y22), + new Quad(node[1], xm, y12, x22, ym), + new Quad(node[0], x12, y12, xm, ym) + ); + if (i = (y2 >= ym) << 1 | x2 >= xm) { + q = quads[quads.length - 1]; + quads[quads.length - 1] = quads[quads.length - 1 - i]; + quads[quads.length - 1 - i] = q; + } + } else { + var dx = x2 - +this._x.call(null, node.data), dy = y2 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; + if (d2 < radius2) { + var d3 = Math.sqrt(radius2 = d2); + x02 = x2 - d3, y02 = y2 - d3; + x3 = x2 + d3, y3 = y2 + d3; + data2 = node.data; } - // First, determine whether the South pole is inside or outside: - // - // It is inside if: - // * the polygon winds around it in a clockwise direction. - // * the polygon does not (cumulatively) wind around it, but has a negative - // (counter-clockwise) area. - // - // Second, count the (signed) number of times a segment crosses a lambda - // from the point to the South pole. If it is zero, then the point is the - // same side as the South pole. - return (angle < -(0, _mathJs.epsilon) || angle < (0, _mathJs.epsilon) && sum < -(0, _mathJs.epsilon2)) ^ winding & 1; + } + } + return data2; + } + function tree_remove(d2) { + if (isNaN(x2 = +this._x.call(null, d2)) || isNaN(y2 = +this._y.call(null, d2))) return this; + var parent, node = this._root, retainer, previous, next, x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1, x2, y2, xm, ym, right, bottom, i, j; + if (!node) return this; + if (node.length) while (true) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (!(parent = node, node = node[i = bottom << 1 | right])) return this; + if (!node.length) break; + if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; + } + while (node.data !== d2) if (!(previous = node, node = node.next)) return this; + if (next = node.next) delete node.next; + if (previous) return next ? previous.next = next : delete previous.next, this; + if (!parent) return this._root = next, this; + next ? parent[i] = next : delete parent[i]; + if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { + if (retainer) retainer[j] = node; + else this._root = node; + } + return this; + } + function removeAll(data2) { + for (var i = 0, n = data2.length; i < n; ++i) this.remove(data2[i]); + return this; + } + function tree_root() { + return this._root; + } + function tree_size() { + var size = 0; + this.visit(function(node) { + if (!node.length) do + ++size; + while (node = node.next); }); -var _d3Array = require("d3-array"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -function longitude(point) { - return (0, _mathJs.abs)(point[0]) <= (0, _mathJs.pi) ? point[0] : (0, _mathJs.sign)(point[0]) * (((0, _mathJs.abs)(point[0]) + (0, _mathJs.pi)) % (0, _mathJs.tau) - (0, _mathJs.pi)); -} - -},{"d3-array":"5lCYW","./cartesian.js":"9WnrC","./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iw60F":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var cr = (0, _mathJs.cos)(radius), delta = 2 * (0, _mathJs.radians), smallRadius = cr > 0, notHemisphere = (0, _mathJs.abs)(cr) > (0, _mathJs.epsilon); // TODO optimise for this common case - function interpolate(from, to, direction, stream) { - (0, _circleJs.circleStream)(stream, radius, delta, direction, from, to); - } - function visible(lambda, phi) { - return (0, _mathJs.cos)(lambda) * (0, _mathJs.cos)(phi) > cr; - } - // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // should be rejoined. - function clipLine(stream) { - var point0, c0, v0, v00, clean; // no intersections - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [ - lambda, - phi - ], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi)), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || (0, _pointEqualJsDefault.default)(point0, point2) || (0, _pointEqualJsDefault.default)(point1, point2)) point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - // If the codes for two points are different, or are both zero, - // and there this segment intersects with the small circle. - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - } else { - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - stream.lineStart(); - stream.point(t[0][0], t[0][1], 3); - } - } - } - if (v && (!point0 || !(0, _pointEqualJsDefault.default)(point0, point1))) stream.point(point1[0], point1[1]); - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = null; - }, - // Rejoin first and last segments if there were intersections and the first - // and last points were visible. - clean: function() { - return clean | (v00 && v0) << 1; - } - }; + return size; + } + function tree_visit(callback) { + var quads = [], q, node = this._root, child, x02, y02, x12, y12; + if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + if (!callback(node = q.node, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1) && node.length) { + var xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[3]) quads.push(new Quad(child, xm, ym, x12, y12)); + if (child = node[2]) quads.push(new Quad(child, x02, ym, xm, y12)); + if (child = node[1]) quads.push(new Quad(child, xm, y02, x12, ym)); + if (child = node[0]) quads.push(new Quad(child, x02, y02, xm, ym)); + } + } + return this; + } + function tree_visitAfter(callback) { + var quads = [], next = [], q; + if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + var node = q.node; + if (node.length) { + var child, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1, xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[0]) quads.push(new Quad(child, x02, y02, xm, ym)); + if (child = node[1]) quads.push(new Quad(child, xm, y02, x12, ym)); + if (child = node[2]) quads.push(new Quad(child, x02, ym, xm, y12)); + if (child = node[3]) quads.push(new Quad(child, xm, ym, x12, y12)); + } + next.push(q); + } + while (q = next.pop()) { + callback(q.node, q.x0, q.y0, q.x1, q.y1); + } + return this; + } + function defaultX(d2) { + return d2[0]; + } + function tree_x(_) { + return arguments.length ? (this._x = _, this) : this._x; + } + function defaultY(d2) { + return d2[1]; + } + function tree_y(_) { + return arguments.length ? (this._y = _, this) : this._y; + } + function quadtree(nodes, x2, y2) { + var tree2 = new Quadtree(x2 == null ? defaultX : x2, y2 == null ? defaultY : y2, NaN, NaN, NaN, NaN); + return nodes == null ? tree2 : tree2.addAll(nodes); + } + function Quadtree(x2, y2, x02, y02, x12, y12) { + this._x = x2; + this._y = y2; + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + this._root = void 0; + } + function leaf_copy(leaf) { + var copy2 = { data: leaf.data }, next = copy2; + while (leaf = leaf.next) next = next.next = { data: leaf.data }; + return copy2; + } + var treeProto = quadtree.prototype = Quadtree.prototype; + treeProto.copy = function() { + var copy2 = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; + if (!node) return copy2; + if (!node.length) return copy2._root = leaf_copy(node), copy2; + nodes = [{ source: node, target: copy2._root = new Array(4) }]; + while (node = nodes.pop()) { + for (var i = 0; i < 4; ++i) { + if (child = node.source[i]) { + if (child.length) nodes.push({ source: child, target: node.target[i] = new Array(4) }); + else node.target[i] = leaf_copy(child); } - // Intersects the great circle between a and b with the clip circle. - function intersect(a, b, two) { - var pa = (0, _cartesianJs.cartesian)(a), pb = (0, _cartesianJs.cartesian)(b); - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [ - 1, - 0, - 0 - ], n2 = (0, _cartesianJs.cartesianCross)(pa, pb), n2n2 = (0, _cartesianJs.cartesianDot)(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; - // Two polar points. - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = (0, _cartesianJs.cartesianCross)(n1, n2), A = (0, _cartesianJs.cartesianScale)(n1, c1), B = (0, _cartesianJs.cartesianScale)(n2, c2); - (0, _cartesianJs.cartesianAddInPlace)(A, B); - // Solve |p(t)|^2 = 1. - var u = n1xn2, w = (0, _cartesianJs.cartesianDot)(A, u), uu = (0, _cartesianJs.cartesianDot)(u, u), t2 = w * w - uu * ((0, _cartesianJs.cartesianDot)(A, A) - 1); - if (t2 < 0) return; - var t = (0, _mathJs.sqrt)(t2), q = (0, _cartesianJs.cartesianScale)(u, (-w - t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q, A); - q = (0, _cartesianJs.spherical)(q); - if (!two) return q; - // Two intersection points. - var lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1], z; - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - var delta = lambda1 - lambda0, polar = (0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon), meridian = polar || delta < (0, _mathJs.epsilon); - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - // Check that the first point is between a and b. - if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < ((0, _mathJs.abs)(q[0] - lambda0) < (0, _mathJs.epsilon) ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > (0, _mathJs.pi) ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = (0, _cartesianJs.cartesianScale)(u, (-w + t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q1, A); - return [ - q, - (0, _cartesianJs.spherical)(q1) - ]; - } + } + } + return copy2; + }; + treeProto.add = tree_add; + treeProto.addAll = addAll; + treeProto.cover = tree_cover; + treeProto.data = tree_data; + treeProto.extent = tree_extent; + treeProto.find = tree_find; + treeProto.remove = tree_remove; + treeProto.removeAll = removeAll; + treeProto.root = tree_root; + treeProto.size = tree_size; + treeProto.visit = tree_visit; + treeProto.visitAfter = tree_visitAfter; + treeProto.x = tree_x; + treeProto.y = tree_y; + function constant$1(x2) { + return function() { + return x2; + }; + } + function jiggle(random2) { + return (random2() - 0.5) * 1e-6; + } + function x$1(d2) { + return d2.x + d2.vx; + } + function y$1(d2) { + return d2.y + d2.vy; + } + function forceCollide(radius2) { + var nodes, radii, random2, strength = 1, iterations2 = 1; + if (typeof radius2 !== "function") radius2 = constant$1(radius2 == null ? 1 : +radius2); + function force2() { + var i, n = nodes.length, tree2, node, xi, yi, ri, ri2; + for (var k = 0; k < iterations2; ++k) { + tree2 = quadtree(nodes, x$1, y$1).visitAfter(prepare2); + for (i = 0; i < n; ++i) { + node = nodes[i]; + ri = radii[node.index], ri2 = ri * ri; + xi = node.x + node.vx; + yi = node.y + node.vy; + tree2.visit(apply2); } - // Generates a 4-bit vector representing the location of a point relative to - // the small circle's bounding box. - function code(lambda, phi) { - var r = smallRadius ? radius : (0, _mathJs.pi) - radius, code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - return (0, _indexJsDefault.default)(visible, clipLine, interpolate, smallRadius ? [ - 0, - -radius - ] : [ - -(0, _mathJs.pi), - radius - (0, _mathJs.pi) - ]); - }); -var _cartesianJs = require("../cartesian.js"); -var _circleJs = require("../circle.js"); -var _mathJs = require("../math.js"); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); - -},{"../cartesian.js":"9WnrC","../circle.js":"JRkjq","../math.js":"kc9MU","../pointEqual.js":"8yvsz","./index.js":"6CuX6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4qylb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>clipRectangle); -var _mathJs = require("../math.js"); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _d3Array = require("d3-array"); -var clipMax = 1e9, clipMin = -clipMax; -function clipRectangle(x0, y0, x1, y1) { - function visible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - else stream.point(to[0], to[1]); + } + function apply2(quad2, x02, y02, x12, y12) { + var data2 = quad2.data, rj = quad2.r, r = ri + rj; + if (data2) { + if (data2.index > node.index) { + var x2 = xi - data2.x - data2.vx, y2 = yi - data2.y - data2.vy, l = x2 * x2 + y2 * y2; + if (l < r * r) { + if (x2 === 0) x2 = jiggle(random2), l += x2 * x2; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + l = (r - (l = Math.sqrt(l))) / l * strength; + node.vx += (x2 *= l) * (r = (rj *= rj) / (ri2 + rj)); + node.vy += (y2 *= l) * r; + data2.vx -= x2 * (r = 1 - r); + data2.vy -= y2 * r; + } + } + return; + } + return x02 > xi + r || x12 < xi - r || y02 > yi + r || y12 < yi - r; + } } - function corner(p, direction) { - return (0, _mathJs.abs)(p[0] - x0) < (0, _mathJs.epsilon) ? direction > 0 ? 0 : 3 : (0, _mathJs.abs)(p[0] - x1) < (0, _mathJs.epsilon) ? direction > 0 ? 2 : 1 : (0, _mathJs.abs)(p[1] - y0) < (0, _mathJs.epsilon) ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon - } - function compareIntersection(a, b) { - return comparePoint(a.x, b.x); - } - function comparePoint(a, b) { - var ca = corner(a, 1), cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - return function(stream) { - var activeStream = stream, bufferStream = (0, _bufferJsDefault.default)(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; - var clipStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: polygonStart, - polygonEnd: polygonEnd - }; - function point(x, y) { - if (visible(x, y)) activeStream.point(x, y); - } - function polygonInside() { - var winding = 0; - for(var i = 0, n = polygon.length; i < n; ++i)for(var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j){ - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { - if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; - } else if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; - } - return winding; - } - // Buffer geometry within a polygon and then clip it en masse. - function polygonStart() { - activeStream = bufferStream, segments = [], polygon = [], clean = true; - } - function polygonEnd() { - var startInside = polygonInside(), cleanInside = clean && startInside, visible = (segments = (0, _d3Array.merge)(segments)).length; - if (cleanInside || visible) { - stream.polygonStart(); - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - if (visible) (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, stream); - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - // TODO rather than special-case polygons, simply handle them separately. - // Ideally, coincident intersection points should be jittered to avoid - // clipping issues. - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferStream.rejoin(); - segments.push(bufferStream.result()); - } - clipStream.point = point; - if (v_) activeStream.lineEnd(); - } - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([ - x, - y - ]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else if (v && v_) activeStream.point(x, y); - else { - var a = [ - x_ = Math.max(clipMin, Math.min(clipMax, x_)), - y_ = Math.max(clipMin, Math.min(clipMax, y_)) - ], b = [ - x = Math.max(clipMin, Math.min(clipMax, x)), - y = Math.max(clipMin, Math.min(clipMax, y)) - ]; - if ((0, _lineJsDefault.default)(a, b, x0, y0, x1, y1)) { - if (!v_) { - activeStream.lineStart(); - activeStream.point(a[0], a[1]); - } - activeStream.point(b[0], b[1]); - if (!v) activeStream.lineEnd(); - clean = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - x_ = x, y_ = y, v_ = v; - } - return clipStream; - }; -} - -},{"../math.js":"kc9MU","./buffer.js":"k9qlR","./line.js":"gx2l4","./rejoin.js":"jrWAP","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gx2l4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b, x0, y0, x1, y1) { - var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"24Rpv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>graticule); -parcelHelpers.export(exports, "graticule10", ()=>graticule10); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -function graticuleX(y0, y1, dy) { - var y = (0, _d3Array.range)(y0, y1 - (0, _mathJs.epsilon), dy).concat(y1); - return function(x) { - return y.map(function(y) { - return [ - x, - y - ]; - }); + function prepare2(quad2) { + if (quad2.data) return quad2.r = radii[quad2.data.index]; + for (var i = quad2.r = 0; i < 4; ++i) { + if (quad2[i] && quad2[i].r > quad2.r) { + quad2.r = quad2[i].r; + } + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node; + radii = new Array(n); + for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius2(node, i, nodes); + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); }; -} -function graticuleY(x0, x1, dx) { - var x = (0, _d3Array.range)(x0, x1 - (0, _mathJs.epsilon), dx).concat(x1); - return function(y) { - return x.map(function(x) { - return [ - x, - y - ]; - }); + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; }; -} -function graticule() { - var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + force2.radius = function(_) { + return arguments.length ? (radius2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : radius2; + }; + return force2; + } + function index$1(d2) { + return d2.index; + } + function find$1(nodeById, nodeId) { + var node = nodeById.get(nodeId); + if (!node) throw new Error("node not found: " + nodeId); + return node; + } + function forceLink(links) { + var id2 = index$1, strength = defaultStrength, strengths, distance2 = constant$1(30), distances, nodes, count2, bias, random2, iterations2 = 1; + if (links == null) links = []; + function defaultStrength(link2) { + return 1 / Math.min(count2[link2.source.index], count2[link2.target.index]); + } + function force2(alpha) { + for (var k = 0, n = links.length; k < iterations2; ++k) { + for (var i = 0, link2, source2, target2, x2, y2, l, b2; i < n; ++i) { + link2 = links[i], source2 = link2.source, target2 = link2.target; + x2 = target2.x + target2.vx - source2.x - source2.vx || jiggle(random2); + y2 = target2.y + target2.vy - source2.y - source2.vy || jiggle(random2); + l = Math.sqrt(x2 * x2 + y2 * y2); + l = (l - distances[i]) / l * alpha * strengths[i]; + x2 *= l, y2 *= l; + target2.vx -= x2 * (b2 = bias[i]); + target2.vy -= y2 * b2; + source2.vx += x2 * (b2 = 1 - b2); + source2.vy += y2 * b2; + } + } } - function lines() { - return (0, _d3Array.range)((0, _mathJs.ceil)(X0 / DX) * DX, X1, DX).map(X).concat((0, _d3Array.range)((0, _mathJs.ceil)(Y0 / DY) * DY, Y1, DY).map(Y)).concat((0, _d3Array.range)((0, _mathJs.ceil)(x0 / dx) * dx, x1, dx).filter(function(x) { - return (0, _mathJs.abs)(x % DX) > (0, _mathJs.epsilon); - }).map(x)).concat((0, _d3Array.range)((0, _mathJs.ceil)(y0 / dy) * dy, y1, dy).filter(function(y) { - return (0, _mathJs.abs)(y % DY) > (0, _mathJs.epsilon); - }).map(y)); - } - graticule.lines = function() { - return lines().map(function(coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; - }); + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, m2 = links.length, nodeById = new Map(nodes.map((d2, i2) => [id2(d2, i2, nodes), d2])), link2; + for (i = 0, count2 = new Array(n); i < m2; ++i) { + link2 = links[i], link2.index = i; + if (typeof link2.source !== "object") link2.source = find$1(nodeById, link2.source); + if (typeof link2.target !== "object") link2.target = find$1(nodeById, link2.target); + count2[link2.source.index] = (count2[link2.source.index] || 0) + 1; + count2[link2.target.index] = (count2[link2.target.index] || 0) + 1; + } + for (i = 0, bias = new Array(m2); i < m2; ++i) { + link2 = links[i], bias[i] = count2[link2.source.index] / (count2[link2.source.index] + count2[link2.target.index]); + } + strengths = new Array(m2), initializeStrength(); + distances = new Array(m2), initializeDistance(); + } + function initializeStrength() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + strengths[i] = +strength(links[i], i, links); + } + } + function initializeDistance() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + distances[i] = +distance2(links[i], i, links); + } + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); }; - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) - ] - }; + force2.links = function(_) { + return arguments.length ? (links = _, initialize2(), force2) : links; }; - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - graticule.extentMajor = function(_) { - if (!arguments.length) return [ - [ - X0, - Y0 - ], - [ - X1, - Y1 - ] - ]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - graticule.extentMinor = function(_) { - if (!arguments.length) return [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - graticule.stepMajor = function(_) { - if (!arguments.length) return [ - DX, - DY - ]; - DX = +_[0], DY = +_[1]; - return graticule; + force2.id = function(_) { + return arguments.length ? (id2 = _, force2) : id2; }; - graticule.stepMinor = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - return graticule.extentMajor([ - [ - -180, - -90 + (0, _mathJs.epsilon) - ], - [ - 180, - 90 - (0, _mathJs.epsilon) - ] - ]).extentMinor([ - [ - -180, - -80 - (0, _mathJs.epsilon) - ], - [ - 180, - 80 + (0, _mathJs.epsilon) - ] - ]); -} -function graticule10() { - return graticule()(); -} - -},{"d3-array":"5lCYW","./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aay0S":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(projection, context) { - let digits = 3, pointRadius = 4.5, projectionStream, contextStream; - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - (0, _streamJsDefault.default)(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - path.area = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _areaJsDefault.default))); - return (0, _areaJsDefault.default).result(); - }; - path.measure = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _measureJsDefault.default))); - return (0, _measureJsDefault.default).result(); - }; - path.bounds = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _boundsJsDefault.default))); - return (0, _boundsJsDefault.default).result(); - }; - path.centroid = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _centroidJsDefault.default))); - return (0, _centroidJsDefault.default).result(); - }; - path.projection = function(_) { - if (!arguments.length) return projection; - projectionStream = _ == null ? (projection = null, _identityJsDefault.default) : (projection = _).stream; - return path; - }; - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new (0, _stringJsDefault.default)(digits)) : new (0, _contextJsDefault.default)(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - path.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - if (context === null) contextStream = new (0, _stringJsDefault.default)(digits); - return path; - }; - return path.projection(projection).digits(digits).context(context); + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force2) : strength; + }; + force2.distance = function(_) { + return arguments.length ? (distance2 = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force2) : distance2; + }; + return force2; + } + var noop = { value: () => { + } }; + function dispatch() { + for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { + if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); + _[t] = []; + } + return new Dispatch(_); + } + function Dispatch(_) { + this._ = _; + } + function parseTypenames(typenames, types2) { + return typenames.trim().split(/^|\s+/).map(function(t) { + var name = "", i = t.indexOf("."); + if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + if (t && !types2.hasOwnProperty(t)) throw new Error("unknown type: " + t); + return { type: t, name }; }); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _contextJs = require("./context.js"); -var _contextJsDefault = parcelHelpers.interopDefault(_contextJs); -var _measureJs = require("./measure.js"); -var _measureJsDefault = parcelHelpers.interopDefault(_measureJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); - -},{"../identity.js":"53el5","../stream.js":"hPbYn","./area.js":"l5Wy6","./bounds.js":"gWZWO","./centroid.js":"jis2d","./context.js":"gjaUo","./measure.js":"1UAzP","./string.js":"149At","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"53el5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l5Wy6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var areaSum = new (0, _d3Array.Adder)(), areaRingSum = new (0, _d3Array.Adder)(), x00, y00, x0, y0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - areaStream.lineStart = areaStream.lineEnd = areaStream.point = (0, _noopJsDefault.default); - areaSum.add((0, _mathJs.abs)(areaRingSum)); - areaRingSum = new (0, _d3Array.Adder)(); + } + Dispatch.prototype = dispatch.prototype = { + constructor: Dispatch, + on: function(typename, callback) { + var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; + if (arguments.length < 2) { + while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; + return; + } + if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); + while (++i < n) { + if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); + else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); + } + return this; }, - result: function() { - var area = areaSum / 2; - areaSum = new (0, _d3Array.Adder)(); - return area; - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaPointFirst(x, y) { - areaStream.point = areaPoint; - x00 = x0 = x, y00 = y0 = y; -} -function areaPoint(x, y) { - areaRingSum.add(y0 * x - x0 * y); - x0 = x, y0 = y; -} -function areaRingEnd() { - areaPoint(x00, y00); -} -exports.default = areaStream; - -},{"d3-array":"5lCYW","../math.js":"kc9MU","../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gWZWO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var x0 = Infinity, y0 = x0, x1 = -x0, y1 = x1; -var boundsStream = { - point: boundsPoint, - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: (0, _noopJsDefault.default), - polygonEnd: (0, _noopJsDefault.default), - result: function() { - var bounds = [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x1 = y1 = -(y0 = x0 = Infinity); - return bounds; - } -}; -function boundsPoint(x, y) { - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; -} -exports.default = boundsStream; - -},{"../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jis2d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -// TODO Enforce positive area for exterior, negative area for interior? -var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00, y00, x0, y0; -var centroidStream = { - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; + copy: function() { + var copy2 = {}, _ = this._; + for (var t in _) copy2[t] = _[t].slice(); + return new Dispatch(copy2); }, - polygonEnd: function() { - centroidStream.point = centroidPoint; - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; + call: function(type2, that) { + if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); }, - result: function() { - var centroid = Z2 ? [ - X2 / Z2, - Y2 / Z2 - ] : Z1 ? [ - X1 / Z1, - Y1 / Z1 - ] : Z0 ? [ - X0 / Z0, - Y0 / Z0 - ] : [ - NaN, - NaN - ]; - X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; - return centroid; + apply: function(type2, that, args) { + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (var t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); } -}; -function centroidPoint(x, y) { - X0 += x; - Y0 += y; - ++Z0; -} -function centroidLineStart() { - centroidStream.point = centroidPointFirstLine; -} -function centroidPointFirstLine(x, y) { - centroidStream.point = centroidPointLine; - centroidPoint(x0 = x, y0 = y); -} -function centroidPointLine(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - centroidPoint(x0 = x, y0 = y); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -function centroidRingStart() { - centroidStream.point = centroidPointFirstRing; -} -function centroidRingEnd() { - centroidPointRing(x00, y00); -} -function centroidPointFirstRing(x, y) { - centroidStream.point = centroidPointRing; - centroidPoint(x00 = x0 = x, y00 = y0 = y); -} -function centroidPointRing(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - z = y0 * x - x0 * y; - X2 += z * (x0 + x); - Y2 += z * (y0 + y); - Z2 += z * 3; - centroidPoint(x0 = x, y0 = y); -} -exports.default = centroidStream; - -},{"../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gjaUo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>PathContext); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function PathContext(context) { - this._context = context; -} -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function(x, y) { - switch(this._point){ - case 0: - this._context.moveTo(x, y); - this._point = 1; - break; - case 1: - this._context.lineTo(x, y); - break; - default: - this._context.moveTo(x + this._radius, y); - this._context.arc(x, y, this._radius, 0, (0, _mathJs.tau)); - break; - } - }, - result: (0, _noopJsDefault.default) -}; - -},{"../math.js":"kc9MU","../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1UAzP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var lengthSum = new (0, _d3Array.Adder)(), lengthRing, x00, y00, x0, y0; -var lengthStream = { - point: (0, _noopJsDefault.default), - lineStart: function() { - lengthStream.point = lengthPointFirst; - }, - lineEnd: function() { - if (lengthRing) lengthPoint(x00, y00); - lengthStream.point = (0, _noopJsDefault.default); - }, - polygonStart: function() { - lengthRing = true; - }, - polygonEnd: function() { - lengthRing = null; + }; + function get(type2, name) { + for (var i = 0, n = type2.length, c2; i < n; ++i) { + if ((c2 = type2[i]).name === name) { + return c2.value; + } + } + } + function set(type2, name, callback) { + for (var i = 0, n = type2.length; i < n; ++i) { + if (type2[i].name === name) { + type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1)); + break; + } + } + if (callback != null) type2.push({ name, value: callback }); + return type2; + } + var frame = 0, timeout = 0, interval$1 = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { + setTimeout(f, 17); + }; + function now() { + return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); + } + function clearNow() { + clockNow = 0; + } + function Timer$1() { + this._call = this._time = this._next = null; + } + Timer$1.prototype = timer$1.prototype = { + constructor: Timer$1, + restart: function(callback, delay, time2) { + if (typeof callback !== "function") throw new TypeError("callback is not a function"); + time2 = (time2 == null ? now() : +time2) + (delay == null ? 0 : +delay); + if (!this._next && taskTail !== this) { + if (taskTail) taskTail._next = this; + else taskHead = this; + taskTail = this; + } + this._call = callback; + this._time = time2; + sleep(); }, - result: function() { - var length = +lengthSum; - lengthSum = new (0, _d3Array.Adder)(); - return length; + stop: function() { + if (this._call) { + this._call = null; + this._time = Infinity; + sleep(); + } } -}; -function lengthPointFirst(x, y) { - lengthStream.point = lengthPoint; - x00 = x0 = x, y00 = y0 = y; -} -function lengthPoint(x, y) { - x0 -= x, y0 -= y; - lengthSum.add((0, _mathJs.sqrt)(x0 * x0 + y0 * y0)); - x0 = x, y0 = y; -} -exports.default = lengthStream; - -},{"d3-array":"5lCYW","../math.js":"kc9MU","../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"149At":[function(require,module,exports,__globalThis) { -// Simple caching for constant-radius points. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -let cacheDigits, cacheAppend, cacheRadius, cacheCircle; -class PathString { - constructor(digits){ - this._append = digits == null ? append : appendRound(digits); - this._radius = 4.5; - this._ = ""; + }; + function timer$1(callback, delay, time2) { + var t = new Timer$1(); + t.restart(callback, delay, time2); + return t; + } + function timerFlush() { + now(); + ++frame; + var t = taskHead, e; + while (t) { + if ((e = clockNow - t._time) >= 0) t._call.call(void 0, e); + t = t._next; } - pointRadius(_) { - this._radius = +_; - return this; + --frame; + } + function wake() { + clockNow = (clockLast = clock.now()) + clockSkew; + frame = timeout = 0; + try { + timerFlush(); + } finally { + frame = 0; + nap(); + clockNow = 0; } - polygonStart() { - this._line = 0; + } + function poke() { + var now2 = clock.now(), delay = now2 - clockLast; + if (delay > pokeDelay) clockSkew -= delay, clockLast = now2; + } + function nap() { + var t02, t12 = taskHead, t22, time2 = Infinity; + while (t12) { + if (t12._call) { + if (time2 > t12._time) time2 = t12._time; + t02 = t12, t12 = t12._next; + } else { + t22 = t12._next, t12._next = null; + t12 = t02 ? t02._next = t22 : taskHead = t22; + } } - polygonEnd() { - this._line = NaN; + taskTail = t02; + sleep(time2); + } + function sleep(time2) { + if (frame) return; + if (timeout) timeout = clearTimeout(timeout); + var delay = time2 - clockNow; + if (delay > 24) { + if (time2 < Infinity) timeout = setTimeout(wake, time2 - clock.now() - clockSkew); + if (interval$1) interval$1 = clearInterval(interval$1); + } else { + if (!interval$1) clockLast = clock.now(), interval$1 = setInterval(poke, pokeDelay); + frame = 1, setFrame(wake); } - lineStart() { - this._point = 0; + } + function interval(callback, delay, time2) { + var t = new Timer$1(), total = delay; + if (delay == null) return t.restart(callback, delay, time2), t; + t._restart = t.restart; + t.restart = function(callback2, delay2, time3) { + delay2 = +delay2, time3 = time3 == null ? now() : +time3; + t._restart(function tick(elapsed) { + elapsed += total; + t._restart(tick, total += delay2, time3); + callback2(elapsed); + }, delay2, time3); + }; + t.restart(callback, delay, time2); + return t; + } + const a$1 = 1664525; + const c$1 = 1013904223; + const m$1 = 4294967296; + function lcg$1() { + let s2 = 1; + return () => (s2 = (a$1 * s2 + c$1) % m$1) / m$1; + } + function x(d2) { + return d2.x; + } + function y(d2) { + return d2.y; + } + var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); + function forceSimulation(nodes) { + var simulation2, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = /* @__PURE__ */ new Map(), stepper = timer$1(step), event2 = dispatch("tick", "end"), random2 = lcg$1(); + if (nodes == null) nodes = []; + function step() { + tick(); + event2.call("tick", simulation2); + if (alpha < alphaMin) { + stepper.stop(); + event2.call("end", simulation2); + } } - lineEnd() { - if (this._line === 0) this._ += "Z"; - this._point = NaN; - } - point(x, y) { - switch(this._point){ - case 0: - this._append`M${x},${y}`; - this._point = 1; - break; - case 1: - this._append`L${x},${y}`; - break; - default: - this._append`M${x},${y}`; - if (this._radius !== cacheRadius || this._append !== cacheAppend) { - const r = this._radius; - const s = this._; - this._ = ""; // stash the old string so we can cache the circle path fragment - this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; - cacheRadius = r; - cacheAppend = this._append; - cacheCircle = this._; - this._ = s; - } - this._ += cacheCircle; - break; + function tick(iterations2) { + var i, n = nodes.length, node; + if (iterations2 === void 0) iterations2 = 1; + for (var k = 0; k < iterations2; ++k) { + alpha += (alphaTarget - alpha) * alphaDecay; + forces.forEach(function(force2) { + force2(alpha); + }); + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (node.fx == null) node.x += node.vx *= velocityDecay; + else node.x = node.fx, node.vx = 0; + if (node.fy == null) node.y += node.vy *= velocityDecay; + else node.y = node.fy, node.vy = 0; } + } + return simulation2; } - result() { - const result = this._; - this._ = ""; - return result.length ? result : null; - } -} -exports.default = PathString; -function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - const d = Math.floor(digits); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`); - if (d > 15) return append; - if (d !== cacheDigits) { - const k = 10 ** d; - cacheDigits = d; - cacheAppend = function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; - }; + function initializeNodes() { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.index = i; + if (node.fx != null) node.x = node.fx; + if (node.fy != null) node.y = node.fy; + if (isNaN(node.x) || isNaN(node.y)) { + var radius2 = initialRadius * Math.sqrt(0.5 + i), angle2 = i * initialAngle; + node.x = radius2 * Math.cos(angle2); + node.y = radius2 * Math.sin(angle2); + } + if (isNaN(node.vx) || isNaN(node.vy)) { + node.vx = node.vy = 0; + } + } } - return cacheAppend; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lnSxc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicEqualAreaJsDefault.default)().parallels([ - 29.5, - 45.5 - ]).scale(1070).translate([ - 480, - 250 - ]).rotate([ - 96, - 0 - ]).center([ - -0.6, - 38.7 - ]); - }); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); - -},{"./conicEqualArea.js":"g4p5m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g4p5m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEqualAreaRaw", ()=>conicEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEqualAreaRaw).scale(155.424).center([ - 0, - 33.6442 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -function conicEqualAreaRaw(y0, y1) { - var sy0 = (0, _mathJs.sin)(y0), n = (sy0 + (0, _mathJs.sin)(y1)) / 2; - // Are the parallels symmetrical around the Equator? - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return (0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)(y0); - var c = 1 + sy0 * (2 * n - sy0), r0 = (0, _mathJs.sqrt)(c) / n; - function project(x, y) { - var r = (0, _mathJs.sqrt)(c - 2 * n * (0, _mathJs.sin)(y)) / n; - return [ - r * (0, _mathJs.sin)(x *= n), - r0 - r * (0, _mathJs.cos)(x) - ]; + function initializeForce(force2) { + if (force2.initialize) force2.initialize(nodes, random2); + return force2; } - project.invert = function(x, y) { - var r0y = r0 - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(r0y)) * (0, _mathJs.sign)(r0y); - if (r0y * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(r0y); - return [ - l / n, - (0, _mathJs.asin)((c - (x * x + r0y * r0y) * n * n) / (2 * n)) - ]; - }; - return project; -} - -},{"../math.js":"kc9MU","./conic.js":"iEvpw","./cylindricalEqualArea.js":"7VwKL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iEvpw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicProjection", ()=>conicProjection); -var _mathJs = require("../math.js"); -var _indexJs = require("./index.js"); -function conicProjection(projectAt) { - var phi0 = 0, phi1 = (0, _mathJs.pi) / 3, m = (0, _indexJs.projectionMutator)(projectAt), p = m(phi0, phi1); - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * (0, _mathJs.radians), phi1 = _[1] * (0, _mathJs.radians)) : [ - phi0 * (0, _mathJs.degrees), - phi1 * (0, _mathJs.degrees) - ]; + initializeNodes(); + return simulation2 = { + tick, + restart: function() { + return stepper.restart(step), simulation2; + }, + stop: function() { + return stepper.stop(), simulation2; + }, + nodes: function(_) { + return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation2) : nodes; + }, + alpha: function(_) { + return arguments.length ? (alpha = +_, simulation2) : alpha; + }, + alphaMin: function(_) { + return arguments.length ? (alphaMin = +_, simulation2) : alphaMin; + }, + alphaDecay: function(_) { + return arguments.length ? (alphaDecay = +_, simulation2) : +alphaDecay; + }, + alphaTarget: function(_) { + return arguments.length ? (alphaTarget = +_, simulation2) : alphaTarget; + }, + velocityDecay: function(_) { + return arguments.length ? (velocityDecay = 1 - _, simulation2) : 1 - velocityDecay; + }, + randomSource: function(_) { + return arguments.length ? (random2 = _, forces.forEach(initializeForce), simulation2) : random2; + }, + force: function(name, _) { + return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation2) : forces.get(name); + }, + find: function(x2, y2, radius2) { + var i = 0, n = nodes.length, dx, dy, d2, node, closest; + if (radius2 == null) radius2 = Infinity; + else radius2 *= radius2; + for (i = 0; i < n; ++i) { + node = nodes[i]; + dx = x2 - node.x; + dy = y2 - node.y; + d2 = dx * dx + dy * dy; + if (d2 < radius2) closest = node, radius2 = d2; + } + return closest; + }, + on: function(name, _) { + return arguments.length > 1 ? (event2.on(name, _), simulation2) : event2.on(name); + } }; - return p; -} - -},{"../math.js":"kc9MU","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7QH2d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>projection); -parcelHelpers.export(exports, "projectionMutator", ()=>projectionMutator); -var _antimeridianJs = require("../clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs = require("../clip/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _composeJs = require("../compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _resampleJs = require("./resample.js"); -var _resampleJsDefault = parcelHelpers.interopDefault(_resampleJs); -var transformRadians = (0, _transformJs.transformer)({ - point: function(x, y) { - this.stream.point(x * (0, _mathJs.radians), y * (0, _mathJs.radians)); - } -}); -function transformRotate(rotate) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); + } + function forceManyBody() { + var nodes, node, random2, alpha, strength = constant$1(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; + function force2(_) { + var i, n = nodes.length, tree2 = quadtree(nodes, x, y).visitAfter(accumulate); + for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree2.visit(apply2); + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node2; + strengths = new Array(n); + for (i = 0; i < n; ++i) node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes); + } + function accumulate(quad2) { + var strength2 = 0, q, c2, weight = 0, x2, y2, i; + if (quad2.length) { + for (x2 = y2 = i = 0; i < 4; ++i) { + if ((q = quad2[i]) && (c2 = Math.abs(q.value))) { + strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y; + } + } + quad2.x = x2 / weight; + quad2.y = y2 / weight; + } else { + q = quad2; + q.x = q.data.x; + q.y = q.data.y; + do + strength2 += strengths[q.data.index]; + while (q = q.next); + } + quad2.value = strength2; + } + function apply2(quad2, x12, _, x2) { + if (!quad2.value) return true; + var x3 = quad2.x - node.x, y2 = quad2.y - node.y, w2 = x2 - x12, l = x3 * x3 + y2 * y2; + if (w2 * w2 / theta2 < l) { + if (l < distanceMax2) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + node.vx += x3 * quad2.value * alpha / l; + node.vy += y2 * quad2.value * alpha / l; } - }); -} -function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; - y *= sy; - return [ - dx + k * x, - dy - k * y - ]; - } - transform.invert = function(x, y) { - return [ - (x - dx) / k * sx, - (dy - y) / k * sy - ]; - }; - return transform; -} -function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); - var cosAlpha = (0, _mathJs.cos)(alpha), sinAlpha = (0, _mathJs.sin)(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform(x, y) { - x *= sx; - y *= sy; - return [ - a * x - b * y + dx, - dy - b * x - a * y - ]; + return true; + } else if (quad2.length || l >= distanceMax2) return; + if (quad2.data !== node || quad2.next) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + } + do + if (quad2.data !== node) { + w2 = strengths[quad2.data.index] * alpha / l; + node.vx += x3 * w2; + node.vy += y2 * w2; + } + while (quad2 = quad2.next); } - transform.invert = function(x, y) { - return [ - sx * (ai * x - bi * y + ci), - sy * (fi - bi * x - ai * y) - ]; + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); }; - return transform; -} -function projection(project) { - return projectionMutator(function() { - return project; - })(); -} -function projectionMutator(projectAt) { - var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = (0, _antimeridianJsDefault.default), x0 = null, y0, x1, y1, postclip = (0, _identityJsDefault.default), delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream; - function projection(point) { - return projectRotateTransform(point[0] * (0, _mathJs.radians), point[1] * (0, _mathJs.radians)); - } - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [ - point[0] * (0, _mathJs.degrees), - point[1] * (0, _mathJs.degrees) - ]; - } - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; }; - projection.preclip = function(_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; + force2.distanceMin = function(_) { + return arguments.length ? (distanceMin2 = _ * _, force2) : Math.sqrt(distanceMin2); }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; + force2.distanceMax = function(_) { + return arguments.length ? (distanceMax2 = _ * _, force2) : Math.sqrt(distanceMax2); }; - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? (0, _circleJsDefault.default)(theta = _ * (0, _mathJs.radians)) : (theta = null, _antimeridianJsDefault.default), reset()) : theta * (0, _mathJs.degrees); + force2.theta = function(_) { + return arguments.length ? (theta2 = _ * _, force2) : Math.sqrt(theta2); }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; + return force2; + } + function forceX(x2) { + var strength = constant$1(0.1), nodes, strengths, xz; + if (typeof x2 !== "function") x2 = constant$1(x2 == null ? 0 : +x2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + xz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(xz[i] = +x2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); }; - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; }; - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [ - x, - y - ]; + force2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : x2; }; - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * (0, _mathJs.radians), phi = _[1] % 360 * (0, _mathJs.radians), recenter()) : [ - lambda * (0, _mathJs.degrees), - phi * (0, _mathJs.degrees) - ]; + return force2; + } + function forceY(y2) { + var strength = constant$1(0.1), nodes, strengths, yz; + if (typeof y2 !== "function") y2 = constant$1(y2 == null ? 0 : +y2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + yz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(yz[i] = +y2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); }; - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * (0, _mathJs.radians), deltaPhi = _[1] % 360 * (0, _mathJs.radians), deltaGamma = _.length > 2 ? _[2] % 360 * (0, _mathJs.radians) : 0, recenter()) : [ - deltaLambda * (0, _mathJs.degrees), - deltaPhi * (0, _mathJs.degrees), - deltaGamma * (0, _mathJs.degrees) - ]; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), recenter()) : alpha * (0, _mathJs.degrees); + force2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : y2; }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; + return force2; + } + const ForceMap = { + center: forceCenter, + collide: forceCollide, + nbody: forceManyBody, + link: forceLink, + x: forceX, + y: forceY + }; + const Forces = "forces", ForceParams = ["alpha", "alphaMin", "alphaTarget", "velocityDecay", "forces"], ForceConfig = ["static", "iterations"], ForceOutput = ["x", "y", "vx", "vy"]; + function Force(params2) { + Transform.call(this, null, params2); + } + Force.Definition = { + "type": "Force", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "static", + "type": "boolean", + "default": false + }, { + "name": "restart", + "type": "boolean", + "default": false + }, { + "name": "iterations", + "type": "number", + "default": 300 + }, { + "name": "alpha", + "type": "number", + "default": 1 + }, { + "name": "alphaMin", + "type": "number", + "default": 1e-3 + }, { + "name": "alphaTarget", + "type": "number", + "default": 0 + }, { + "name": "velocityDecay", + "type": "number", + "default": 0.4 + }, { + "name": "forces", + "type": "param", + "array": true, + "params": [{ + "key": { + "force": "center" + }, + "params": [{ + "name": "x", + "type": "number", + "default": 0 + }, { + "name": "y", + "type": "number", + "default": 0 + }] + }, { + "key": { + "force": "collide" + }, + "params": [{ + "name": "radius", + "type": "number", + "expr": true + }, { + "name": "strength", + "type": "number", + "default": 0.7 + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "nbody" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": -30, + "expr": true + }, { + "name": "theta", + "type": "number", + "default": 0.9 + }, { + "name": "distanceMin", + "type": "number", + "default": 1 + }, { + "name": "distanceMax", + "type": "number" + }] + }, { + "key": { + "force": "link" + }, + "params": [{ + "name": "links", + "type": "data" + }, { + "name": "id", + "type": "field" + }, { + "name": "distance", + "type": "number", + "default": 30, + "expr": true + }, { + "name": "strength", + "type": "number", + "expr": true + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "x" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "x", + "type": "field" + }] + }, { + "key": { + "force": "y" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "y", + "type": "field" + }] + }] + }, { + "name": "as", + "type": "string", + "array": true, + "modify": false, + "default": ForceOutput + }] + }; + inherits(Force, Transform, { + transform(_, pulse2) { + var sim = this.value, change2 = pulse2.changed(pulse2.ADD_REM), params2 = _.modified(ForceParams), iters = _.iterations || 300; + if (!sim) { + this.value = sim = simulation(pulse2.source, _); + sim.on("tick", rerun(pulse2.dataflow, this)); + if (!_.static) { + change2 = true; + sim.tick(); + } + pulse2.modifies("index"); + } else { + if (change2) { + pulse2.modifies("index"); + sim.nodes(pulse2.source); + } + if (params2 || pulse2.changed(pulse2.MOD)) { + setup(sim, _, 0, pulse2); + } + } + if (params2 || change2 || _.modified(ForceConfig) || pulse2.changed() && _.restart) { + sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); + if (_.static) { + for (sim.stop(); --iters >= 0; ) sim.tick(); + } else { + if (sim.stopped()) sim.restart(); + if (!change2) return pulse2.StopPropagation; + } + } + return this.finish(_, pulse2); + }, + finish(_, pulse2) { + const dataflow = pulse2.dataflow; + for (let args = this._argops, j = 0, m2 = args.length, arg; j < m2; ++j) { + arg = args[j]; + if (arg.name !== Forces || arg.op._argval.force !== "link") { + continue; + } + for (var ops2 = arg.op._argops, i = 0, n = ops2.length, op; i < n; ++i) { + if (ops2[i].name === "links" && (op = ops2[i].op.source)) { + dataflow.pulse(op, dataflow.changeset().reflow()); + break; + } + } + } + return pulse2.reflow(_.modified()).modifies(ForceOutput); + } + }); + function rerun(df, op) { + return () => df.touch(op).run(); + } + function simulation(nodes, _) { + const sim = forceSimulation(nodes), stop2 = sim.stop, restart = sim.restart; + let stopped = false; + sim.stopped = () => stopped; + sim.restart = () => (stopped = false, restart()); + sim.stop = () => (stopped = true, stop2()); + return setup(sim, _, true).on("end", () => stopped = true); + } + function setup(sim, _, init2, pulse2) { + var f = array$4(_.forces), i, n, p, name; + for (i = 0, n = ForceParams.length; i < n; ++i) { + p = ForceParams[i]; + if (p !== Forces && _.modified(p)) sim[p](_[p]); + } + for (i = 0, n = f.length; i < n; ++i) { + name = Forces + i; + p = init2 || _.modified(Forces, i) ? getForce(f[i]) : pulse2 && modified(f[i], pulse2) ? sim.force(name) : null; + if (p) sim.force(name, p); + } + for (n = sim.numForces || 0; i < n; ++i) { + sim.force(Forces + i, null); + } + sim.numForces = f.length; + return sim; + } + function modified(f, pulse2) { + var k, v; + for (k in f) { + if (isFunction(v = f[k]) && pulse2.modified(accessorFields(v))) return 1; + } + return 0; + } + function getForce(_) { + var f, p; + if (!has$1(ForceMap, _.force)) { + error("Unrecognized force: " + _.force); + } + f = ForceMap[_.force](); + for (p in _) { + if (isFunction(f[p])) setForceParam(f[p], _[p], _); + } + return f; + } + function setForceParam(f, v, _) { + f(isFunction(v) ? (d2) => v(d2, _) : v); + } + const force = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + force: Force + }, Symbol.toStringTag, { value: "Module" })); + function defaultSeparation$2(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function meanX(children2) { + return children2.reduce(meanXReduce, 0) / children2.length; + } + function meanXReduce(x2, c2) { + return x2 + c2.x; + } + function maxY(children2) { + return 1 + children2.reduce(maxYReduce, 0); + } + function maxYReduce(y2, c2) { + return Math.max(y2, c2.y); + } + function leafLeft(node) { + var children2; + while (children2 = node.children) node = children2[0]; + return node; + } + function leafRight(node) { + var children2; + while (children2 = node.children) node = children2[children2.length - 1]; + return node; + } + function cluster() { + var separation = defaultSeparation$2, dx = 1, dy = 1, nodeSize = false; + function cluster2(root) { + var previousNode, x2 = 0; + root.eachAfter(function(node) { + var children2 = node.children; + if (children2) { + node.x = meanX(children2); + node.y = maxY(children2); + } else { + node.x = previousNode ? x2 += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = leafLeft(root), right = leafRight(root), x02 = left.x - separation(left, right) / 2, x12 = right.x + separation(right, left) / 2; + return root.eachAfter(nodeSize ? function(node) { + node.x = (node.x - root.x) * dx; + node.y = (root.y - node.y) * dy; + } : function(node) { + node.x = (node.x - x02) / (x12 - x02) * dx; + node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; + }); + } + cluster2.separation = function(x2) { + return arguments.length ? (separation = x2, cluster2) : separation; }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; + cluster2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? null : [dx, dy]; }; - projection.precision = function(_) { - return arguments.length ? (projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2 = _ * _), reset()) : (0, _mathJs.sqrt)(delta2); + cluster2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? [dx, dy] : null; }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); + return cluster2; + } + function count(node) { + var sum2 = 0, children2 = node.children, i = children2 && children2.length; + if (!i) sum2 = 1; + else while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + } + function node_count() { + return this.eachAfter(count); + } + function node_each(callback, that) { + let index2 = -1; + for (const node of this) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_eachBefore(callback, that) { + var node = this, nodes = [node], children2, i, index2 = -1; + while (node = nodes.pop()) { + callback.call(that, node, ++index2, this); + if (children2 = node.children) { + for (i = children2.length - 1; i >= 0; --i) { + nodes.push(children2[i]); + } + } + } + return this; + } + function node_eachAfter(callback, that) { + var node = this, nodes = [node], next = [], children2, i, n, index2 = -1; + while (node = nodes.pop()) { + next.push(node); + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + nodes.push(children2[i]); + } + } + } + while (node = next.pop()) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_find(callback, that) { + let index2 = -1; + for (const node of this) { + if (callback.call(that, node, ++index2, this)) { + return node; + } + } + } + function node_sum(value2) { + return this.eachAfter(function(node) { + var sum2 = +value2(node.data) || 0, children2 = node.children, i = children2 && children2.length; + while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + }); + } + function node_sort(compare2) { + return this.eachBefore(function(node) { + if (node.children) { + node.children.sort(compare2); + } + }); + } + function node_path(end) { + var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start]; + while (start !== ancestor) { + start = start.parent; + nodes.push(start); + } + var k = nodes.length; + while (end !== ancestor) { + nodes.splice(k, 0, end); + end = end.parent; + } + return nodes; + } + function leastCommonAncestor(a2, b2) { + if (a2 === b2) return a2; + var aNodes = a2.ancestors(), bNodes = b2.ancestors(), c2 = null; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + while (a2 === b2) { + c2 = a2; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + } + return c2; + } + function node_ancestors() { + var node = this, nodes = [node]; + while (node = node.parent) { + nodes.push(node); + } + return nodes; + } + function node_descendants() { + return Array.from(this); + } + function node_leaves() { + var leaves = []; + this.eachBefore(function(node) { + if (!node.children) { + leaves.push(node); + } + }); + return leaves; + } + function node_links() { + var root = this, links = []; + root.each(function(node) { + if (node !== root) { + links.push({ source: node.parent, target: node }); + } + }); + return links; + } + function* node_iterator() { + var node = this, current, next = [node], children2, i, n; + do { + current = next.reverse(), next = []; + while (node = current.pop()) { + yield node; + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + next.push(children2[i]); + } + } + } + } while (next.length); + } + function hierarchy(data2, children2) { + if (data2 instanceof Map) { + data2 = [void 0, data2]; + if (children2 === void 0) children2 = mapChildren; + } else if (children2 === void 0) { + children2 = objectChildren; + } + var root = new Node$2(data2), node, nodes = [root], child, childs, i, n; + while (node = nodes.pop()) { + if ((childs = children2(node.data)) && (n = (childs = Array.from(childs)).length)) { + node.children = childs; + for (i = n - 1; i >= 0; --i) { + nodes.push(child = childs[i] = new Node$2(childs[i])); + child.parent = node; + child.depth = node.depth + 1; + } + } + } + return root.eachBefore(computeHeight); + } + function node_copy() { + return hierarchy(this).eachBefore(copyData); + } + function objectChildren(d2) { + return d2.children; + } + function mapChildren(d2) { + return Array.isArray(d2) ? d2[1] : null; + } + function copyData(node) { + if (node.data.value !== void 0) node.value = node.data.value; + node.data = node.data.data; + } + function computeHeight(node) { + var height2 = 0; + do + node.height = height2; + while ((node = node.parent) && node.height < ++height2); + } + function Node$2(data2) { + this.data = data2; + this.depth = this.height = 0; + this.parent = null; + } + Node$2.prototype = hierarchy.prototype = { + constructor: Node$2, + count: node_count, + each: node_each, + eachAfter: node_eachAfter, + eachBefore: node_eachBefore, + find: node_find, + sum: node_sum, + sort: node_sort, + path: node_path, + ancestors: node_ancestors, + descendants: node_descendants, + leaves: node_leaves, + links: node_links, + copy: node_copy, + [Symbol.iterator]: node_iterator + }; + function optional(f) { + return f == null ? null : required(f); + } + function required(f) { + if (typeof f !== "function") throw new Error(); + return f; + } + function constantZero() { + return 0; + } + function constant(x2) { + return function() { + return x2; }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); + } + const a = 1664525; + const c = 1013904223; + const m = 4294967296; + function lcg() { + let s2 = 1; + return () => (s2 = (a * s2 + c) % m) / m; + } + function array$2(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function shuffle(array2, random2) { + let m2 = array2.length, t, i; + while (m2) { + i = random2() * m2-- | 0; + t = array2[m2]; + array2[m2] = array2[i]; + array2[i] = t; + } + return array2; + } + function packEncloseRandom(circles, random2) { + var i = 0, n = (circles = shuffle(Array.from(circles), random2)).length, B2 = [], p, e; + while (i < n) { + p = circles[i]; + if (e && enclosesWeak(e, p)) ++i; + else e = encloseBasis(B2 = extendBasis(B2, p)), i = 0; + } + return e; + } + function extendBasis(B2, p) { + var i, j; + if (enclosesWeakAll(p, B2)) return [p]; + for (i = 0; i < B2.length; ++i) { + if (enclosesNot(p, B2[i]) && enclosesWeakAll(encloseBasis2(B2[i], p), B2)) { + return [B2[i], p]; + } + } + for (i = 0; i < B2.length - 1; ++i) { + for (j = i + 1; j < B2.length; ++j) { + if (enclosesNot(encloseBasis2(B2[i], B2[j]), p) && enclosesNot(encloseBasis2(B2[i], p), B2[j]) && enclosesNot(encloseBasis2(B2[j], p), B2[i]) && enclosesWeakAll(encloseBasis3(B2[i], B2[j], p), B2)) { + return [B2[i], B2[j], p]; + } + } + } + throw new Error(); + } + function enclosesNot(a2, b2) { + var dr = a2.r - b2.r, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr < 0 || dr * dr < dx * dx + dy * dy; + } + function enclosesWeak(a2, b2) { + var dr = a2.r - b2.r + Math.max(a2.r, b2.r, 1) * 1e-9, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function enclosesWeakAll(a2, B2) { + for (var i = 0; i < B2.length; ++i) { + if (!enclosesWeak(a2, B2[i])) { + return false; + } + } + return true; + } + function encloseBasis(B2) { + switch (B2.length) { + case 1: + return encloseBasis1(B2[0]); + case 2: + return encloseBasis2(B2[0], B2[1]); + case 3: + return encloseBasis3(B2[0], B2[1], B2[2]); + } + } + function encloseBasis1(a2) { + return { + x: a2.x, + y: a2.y, + r: a2.r }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); + } + function encloseBasis2(a2, b2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x21 = x2 - x12, y21 = y2 - y12, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); + return { + x: (x12 + x2 + x21 / l * r21) / 2, + y: (y12 + y2 + y21 / l * r21) / 2, + r: (l + r1 + r2) / 2 }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); + } + function encloseBasis3(a2, b2, c2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x3 = c2.x, y3 = c2.y, r3 = c2.r, a22 = x12 - x2, a3 = x12 - x3, b22 = y12 - y2, b3 = y12 - y3, c22 = r2 - r1, c3 = r3 - r1, d1 = x12 * x12 + y12 * y12 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b22 - a22 * b3, xa = (b22 * d3 - b3 * d2) / (ab * 2) - x12, xb = (b3 * c22 - b22 * c3) / ab, ya = (a3 * d2 - a22 * d3) / (ab * 2) - y12, yb = (a22 * c3 - a3 * c22) / ab, A5 = xb * xb + yb * yb - 1, B2 = 2 * (r1 + xa * xb + ya * yb), C3 = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A5) > 1e-6 ? (B2 + Math.sqrt(B2 * B2 - 4 * A5 * C3)) / (2 * A5) : C3 / B2); + return { + x: x12 + xa + xb * r, + y: y12 + ya + yb * r, + r }; - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = (0, _rotationJs.rotateRadians)(deltaLambda, deltaPhi, deltaGamma); - projectTransform = (0, _composeJsDefault.default)(project, transform); - projectRotateTransform = (0, _composeJsDefault.default)(rotate, projectTransform); - projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2); - return reset(); - } - function reset() { - cache = cacheStream = null; - return projection; + } + function place(b2, a2, c2) { + var dx = b2.x - a2.x, x2, a22, dy = b2.y - a2.y, y2, b22, d2 = dx * dx + dy * dy; + if (d2) { + a22 = a2.r + c2.r, a22 *= a22; + b22 = b2.r + c2.r, b22 *= b22; + if (a22 > b22) { + x2 = (d2 + b22 - a22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, b22 / d2 - x2 * x2)); + c2.x = b2.x - x2 * dx - y2 * dy; + c2.y = b2.y - x2 * dy + y2 * dx; + } else { + x2 = (d2 + a22 - b22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, a22 / d2 - x2 * x2)); + c2.x = a2.x + x2 * dx - y2 * dy; + c2.y = a2.y + x2 * dy + y2 * dx; + } + } else { + c2.x = a2.x + c2.r; + c2.y = a2.y; } - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; -} - -},{"../clip/antimeridian.js":"6JM2n","../clip/circle.js":"iw60F","../clip/rectangle.js":"4qylb","../compose.js":"P6ZIv","../identity.js":"53el5","../math.js":"kc9MU","../rotation.js":"7JtV8","../transform.js":"7yOQv","./fit.js":"1SqNP","./resample.js":"gyxzZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7yOQv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(methods) { - return { - stream: transformer(methods) - }; - }); -parcelHelpers.export(exports, "transformer", ()=>transformer); -function transformer(methods) { - return function(stream) { - var s = new TransformStream; - for(var key in methods)s[key] = methods[key]; - s.stream = stream; - return s; - }; -} -function TransformStream() {} -TransformStream.prototype = { - constructor: TransformStream, - point: function(x, y) { - this.stream.point(x, y); - }, - sphere: function() { - this.stream.sphere(); - }, - lineStart: function() { - this.stream.lineStart(); - }, - lineEnd: function() { - this.stream.lineEnd(); - }, - polygonStart: function() { - this.stream.polygonStart(); - }, - polygonEnd: function() { - this.stream.polygonEnd(); - } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1SqNP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fitExtent", ()=>fitExtent); -parcelHelpers.export(exports, "fitSize", ()=>fitSize); -parcelHelpers.export(exports, "fitWidth", ()=>fitWidth); -parcelHelpers.export(exports, "fitHeight", ()=>fitHeight); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _boundsJs = require("../path/bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -function fit(projection, fitBounds, object) { - var clip = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([ - 0, - 0 - ]); - if (clip != null) projection.clipExtent(null); - (0, _streamJsDefault.default)(object, projection.stream((0, _boundsJsDefault.default))); - fitBounds((0, _boundsJsDefault.default).result()); - if (clip != null) projection.clipExtent(clip); - return projection; -} -function fitExtent(projection, extent, object) { - return fit(projection, function(b) { - var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitSize(projection, size, object) { - return fitExtent(projection, [ - [ - 0, - 0 - ], - size - ], object); -} -function fitWidth(projection, width, object) { - return fit(projection, function(b) { - var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1]; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitHeight(projection, height, object) { - return fit(projection, function(b) { - var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} - -},{"../stream.js":"hPbYn","../path/bounds.js":"gWZWO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gyxzZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(project, delta2) { - return +delta2 ? resample(project, delta2) : resampleNone(project); - }); -var _cartesianJs = require("../cartesian.js"); -var _mathJs = require("../math.js"); -var _transformJs = require("../transform.js"); -var maxDepth = 16, cosMinDistance = (0, _mathJs.cos)(30 * (0, _mathJs.radians)); // cos(minimum angular distance) -function resampleNone(project) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); -} -function resample(project, delta2) { - function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = (0, _mathJs.sqrt)(a * a + b * b + c * c), phi2 = (0, _mathJs.asin)(c /= m), lambda2 = (0, _mathJs.abs)((0, _mathJs.abs)(c) - 1) < (0, _mathJs.epsilon) || (0, _mathJs.abs)(lambda0 - lambda1) < (0, _mathJs.epsilon) ? (lambda0 + lambda1) / 2 : (0, _mathJs.atan2)(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > delta2 // perpendicular projected distance - || (0, _mathJs.abs)((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } + } + function intersects(a2, b2) { + var dr = a2.r + b2.r - 1e-6, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function score(node) { + var a2 = node._, b2 = node.next._, ab = a2.r + b2.r, dx = (a2.x * b2.r + b2.x * a2.r) / ab, dy = (a2.y * b2.r + b2.y * a2.r) / ab; + return dx * dx + dy * dy; + } + function Node$1(circle2) { + this._ = circle2; + this.next = null; + this.previous = null; + } + function packSiblingsRandom(circles, random2) { + if (!(n = (circles = array$2(circles)).length)) return 0; + var a2, b2, c2, n, aa, ca, i, j, k, sj, sk; + a2 = circles[0], a2.x = 0, a2.y = 0; + if (!(n > 1)) return a2.r; + b2 = circles[1], a2.x = -b2.r, b2.x = a2.r, b2.y = 0; + if (!(n > 2)) return a2.r + b2.r; + place(b2, a2, c2 = circles[2]); + a2 = new Node$1(a2), b2 = new Node$1(b2), c2 = new Node$1(c2); + a2.next = c2.previous = b2; + b2.next = a2.previous = c2; + c2.next = b2.previous = a2; + pack: for (i = 3; i < n; ++i) { + place(a2._, b2._, c2 = circles[i]), c2 = new Node$1(c2); + j = b2.next, k = a2.previous, sj = b2._.r, sk = a2._.r; + do { + if (sj <= sk) { + if (intersects(j._, c2._)) { + b2 = j, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sj += j._.r, j = j.next; + } else { + if (intersects(k._, c2._)) { + a2 = k, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sk += k._.r, k = k.previous; + } + } while (j !== k.next); + c2.previous = a2, c2.next = b2, a2.next = b2.previous = b2 = c2; + aa = score(a2); + while ((c2 = c2.next) !== b2) { + if ((ca = score(c2)) < aa) { + a2 = c2, aa = ca; } + } + b2 = a2.next; } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, lambda0, x0, y0, a0, b0, c0; // previous point - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - stream.polygonStart(); - resampleStream.lineStart = ringStart; - }, - polygonEnd: function() { - stream.polygonEnd(); - resampleStream.lineStart = lineStart; - } - }; - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - function linePoint(lambda, phi) { - var c = (0, _cartesianJs.cartesian)([ - lambda, - phi - ]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - return resampleStream; - }; -} - -},{"../cartesian.js":"9WnrC","../math.js":"kc9MU","../transform.js":"7yOQv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7VwKL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cylindricalEqualAreaRaw", ()=>cylindricalEqualAreaRaw); -var _mathJs = require("../math.js"); -function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = (0, _mathJs.cos)(phi0); - function forward(lambda, phi) { - return [ - lambda * cosPhi0, - (0, _mathJs.sin)(phi) / cosPhi0 - ]; + a2 = [b2._], c2 = b2; + while ((c2 = c2.next) !== b2) a2.push(c2._); + c2 = packEncloseRandom(a2, random2); + for (i = 0; i < n; ++i) a2 = circles[i], a2.x -= c2.x, a2.y -= c2.y; + return c2.r; + } + function defaultRadius(d2) { + return Math.sqrt(d2.value); + } + function pack() { + var radius2 = null, dx = 1, dy = 1, padding2 = constantZero; + function pack2(root) { + const random2 = lcg(); + root.x = dx / 2, root.y = dy / 2; + if (radius2) { + root.eachBefore(radiusLeaf(radius2)).eachAfter(packChildrenRandom(padding2, 0.5, random2)).eachBefore(translateChild(1)); + } else { + root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero, 1, random2)).eachAfter(packChildrenRandom(padding2, root.r / Math.min(dx, dy), random2)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); + } + return root; } - forward.invert = function(x, y) { - return [ - x / cosPhi0, - (0, _mathJs.asin)(y * cosPhi0) - ]; + pack2.radius = function(x2) { + return arguments.length ? (radius2 = optional(x2), pack2) : radius2; }; - return forward; -} - -},{"../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3HuY2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A composite projection for the United States, configured by default for -// 960×500. The projection also works quite well at 960×600 if you change the -// scale to 1285 and adjust the translate accordingly. The set of standard -// parallels for each region comes from USGS, which is published here: -// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers -parcelHelpers.export(exports, "default", ()=>function() { - var cache, cacheStream, lower48 = (0, _albersJsDefault.default)(), lower48Point, alaska = (0, _conicEqualAreaJsDefault.default)().rotate([ - 154, - 0 - ]).center([ - -2, - 58.5 - ]).parallels([ - 55, - 65 - ]), alaskaPoint, hawaii = (0, _conicEqualAreaJsDefault.default)().rotate([ - 157, - 0 - ]).center([ - -3, - 19.9 - ]).parallels([ - 8, - 18 - ]), hawaiiPoint, point, pointStream = { - point: function(x, y) { - point = [ - x, - y - ]; - } - }; - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point); - } - albersUsa.invert = function(coordinates) { - var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; - return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates); - }; - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([ - lower48.stream(cacheStream = stream), - alaska.stream(stream), - hawaii.stream(stream) - ]); - }; - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - albersUsa.scale = function(_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); - return albersUsa.translate(lower48.translate()); - }; - albersUsa.translate = function(_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([ - [ - x - 0.455 * k, - y - 0.238 * k - ], - [ - x + 0.455 * k, - y + 0.238 * k - ] - ]).stream(pointStream); - alaskaPoint = alaska.translate([ - x - 0.307 * k, - y + 0.201 * k - ]).clipExtent([ - [ - x - 0.425 * k + (0, _mathJs.epsilon), - y + 0.120 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.214 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - hawaiiPoint = hawaii.translate([ - x - 0.205 * k, - y + 0.212 * k - ]).clipExtent([ - [ - x - 0.214 * k + (0, _mathJs.epsilon), - y + 0.166 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.115 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - return reset(); - }; - albersUsa.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(albersUsa, extent, object); - }; - albersUsa.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(albersUsa, size, object); - }; - albersUsa.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(albersUsa, width, object); - }; - albersUsa.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(albersUsa, height, object); - }; - function reset() { - cache = cacheStream = null; - return albersUsa; - } - return albersUsa.scale(1070); - }); -var _mathJs = require("../math.js"); -var _albersJs = require("./albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _fitJs = require("./fit.js"); -// The projections must have mutually exclusive clip regions on the sphere, -// as this will avoid emitting interleaving lines and polygons. -function multiplex(streams) { - var n = streams.length; - return { - point: function(x, y) { - var i = -1; - while(++i < n)streams[i].point(x, y); - }, - sphere: function() { - var i = -1; - while(++i < n)streams[i].sphere(); - }, - lineStart: function() { - var i = -1; - while(++i < n)streams[i].lineStart(); - }, - lineEnd: function() { - var i = -1; - while(++i < n)streams[i].lineEnd(); - }, - polygonStart: function() { - var i = -1; - while(++i < n)streams[i].polygonStart(); - }, - polygonEnd: function() { - var i = -1; - while(++i < n)streams[i].polygonEnd(); - } - }; -} - -},{"../math.js":"kc9MU","./albers.js":"lnSxc","./conicEqualArea.js":"g4p5m","./fit.js":"1SqNP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"02C8V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEqualAreaRaw", ()=>azimuthalEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEqualAreaRaw).scale(124.75).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEqualAreaRaw = (0, _azimuthalJs.azimuthalRaw)(function(cxcy) { - return (0, _mathJs.sqrt)(2 / (1 + cxcy)); -}); -azimuthalEqualAreaRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.asin)(z / 2); -}); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ej3I1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalRaw", ()=>azimuthalRaw); -parcelHelpers.export(exports, "azimuthalInvert", ()=>azimuthalInvert); -var _mathJs = require("../math.js"); -function azimuthalRaw(scale) { - return function(x, y) { - var cx = (0, _mathJs.cos)(x), cy = (0, _mathJs.cos)(y), k = scale(cx * cy); - if (k === Infinity) return [ - 2, - 0 - ]; - return [ - k * cy * (0, _mathJs.sin)(x), - k * (0, _mathJs.sin)(y) - ]; + pack2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], pack2) : [dx, dy]; }; -} -function azimuthalInvert(angle) { - return function(x, y) { - var z = (0, _mathJs.sqrt)(x * x + y * y), c = angle(z), sc = (0, _mathJs.sin)(c), cc = (0, _mathJs.cos)(c); - return [ - (0, _mathJs.atan2)(x * sc, z * cc), - (0, _mathJs.asin)(z && y * sc / z) - ]; + pack2.padding = function(x2) { + return arguments.length ? (padding2 = typeof x2 === "function" ? x2 : constant(+x2), pack2) : padding2; }; -} - -},{"../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7a1uH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEquidistantRaw", ()=>azimuthalEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEquidistantRaw).scale(79.4188).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEquidistantRaw = (0, _azimuthalJs.azimuthalRaw)(function(c) { - return (c = (0, _mathJs.acos)(c)) && c / (0, _mathJs.sin)(c); -}); -azimuthalEquidistantRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return z; -}); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7BV5L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicConformalRaw", ()=>conicConformalRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicConformalRaw).scale(109.5).parallels([ - 30, - 30 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _mercatorJs = require("./mercator.js"); -function tany(y) { - return (0, _mathJs.tan)(((0, _mathJs.halfPi) + y) / 2); -} -function conicConformalRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (0, _mathJs.log)(cy0 / (0, _mathJs.cos)(y1)) / (0, _mathJs.log)(tany(y1) / tany(y0)), f = cy0 * (0, _mathJs.pow)(tany(y0), n) / n; - if (!n) return 0, _mercatorJs.mercatorRaw; - function project(x, y) { - if (f > 0) { - if (y < -(0, _mathJs.halfPi) + (0, _mathJs.epsilon)) y = -(0, _mathJs.halfPi) + (0, _mathJs.epsilon); - } else if (y > (0, _mathJs.halfPi) - (0, _mathJs.epsilon)) y = (0, _mathJs.halfPi) - (0, _mathJs.epsilon); - var r = f / (0, _mathJs.pow)(tany(y), n); - return [ - r * (0, _mathJs.sin)(n * x), - f - r * (0, _mathJs.cos)(n * x) - ]; - } - project.invert = function(x, y) { - var fy = f - y, r = (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + fy * fy), l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(fy)) * (0, _mathJs.sign)(fy); - if (fy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(fy); - return [ - l / n, - 2 * (0, _mathJs.atan)((0, _mathJs.pow)(f / r, 1 / n)) - (0, _mathJs.halfPi) - ]; + return pack2; + } + function radiusLeaf(radius2) { + return function(node) { + if (!node.children) { + node.r = Math.max(0, +radius2(node) || 0); + } }; - return project; -} - -},{"../math.js":"kc9MU","./conic.js":"iEvpw","./mercator.js":"a3UOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a3UOt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mercatorRaw", ()=>mercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return mercatorProjection(mercatorRaw).scale(961 / (0, _mathJs.tau)); - }); -parcelHelpers.export(exports, "mercatorProjection", ()=>mercatorProjection); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function mercatorRaw(lambda, phi) { - return [ - lambda, - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)) - ]; -} -mercatorRaw.invert = function(x, y) { - return [ - x, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(y)) - (0, _mathJs.halfPi) - ]; -}; -function mercatorProjection(project) { - var m = (0, _indexJsDefault.default)(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x0 = null, y0, x1, y1; // clip extent - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - m.clipExtent = function(_) { - return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; + } + function packChildrenRandom(padding2, k, random2) { + return function(node) { + if (children2 = node.children) { + var children2, i, n = children2.length, r = padding2(node) * k || 0, e; + if (r) for (i = 0; i < n; ++i) children2[i].r += r; + e = packSiblingsRandom(children2, random2); + if (r) for (i = 0; i < n; ++i) children2[i].r -= r; + node.r = e + r; + } }; - function reclip() { - var k = (0, _mathJs.pi) * scale(), t = m((0, _rotationJsDefault.default)(m.rotate()).invert([ - 0, - 0 - ])); - return clipExtent(x0 == null ? [ - [ - t[0] - k, - t[1] - k - ], - [ - t[0] + k, - t[1] + k - ] - ] : project === mercatorRaw ? [ - [ - Math.max(t[0] - k, x0), - y0 - ], - [ - Math.min(t[0] + k, x1), - y1 - ] - ] : [ - [ - x0, - Math.max(t[1] - k, y0) - ], - [ - x1, - Math.min(t[1] + k, y1) - ] - ]); - } - return reclip(); -} - -},{"../math.js":"kc9MU","../rotation.js":"7JtV8","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9oUmd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEquidistantRaw", ()=>conicEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEquidistantRaw).scale(131.154).center([ - 0, - 13.9389 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _equirectangularJs = require("./equirectangular.js"); -function conicEquidistantRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (cy0 - (0, _mathJs.cos)(y1)) / (y1 - y0), g = cy0 / n + y0; - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return 0, _equirectangularJs.equirectangularRaw; - function project(x, y) { - var gy = g - y, nx = n * x; - return [ - gy * (0, _mathJs.sin)(nx), - g - gy * (0, _mathJs.cos)(nx) - ]; - } - project.invert = function(x, y) { - var gy = g - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(gy)) * (0, _mathJs.sign)(gy); - if (gy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(gy); - return [ - l / n, - g - (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + gy * gy) - ]; + } + function translateChild(k) { + return function(node) { + var parent = node.parent; + node.r *= k; + if (parent) { + node.x = parent.x + k * node.x; + node.y = parent.y + k * node.y; + } }; - return project; -} - -},{"../math.js":"kc9MU","./conic.js":"iEvpw","./equirectangular.js":"73t8d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73t8d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equirectangularRaw", ()=>equirectangularRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equirectangularRaw).scale(152.63); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function equirectangularRaw(lambda, phi) { - return [ - lambda, - phi - ]; -} -equirectangularRaw.invert = equirectangularRaw; - -},{"./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eILUC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equalEarthRaw", ()=>equalEarthRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equalEarthRaw).scale(177.158); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -var A1 = 1.340264, A2 = -0.081106, A3 = 0.000893, A4 = 0.003796, M = (0, _mathJs.sqrt)(3) / 2, iterations = 12; -function equalEarthRaw(lambda, phi) { - var l = (0, _mathJs.asin)(M * (0, _mathJs.sin)(phi)), l2 = l * l, l6 = l2 * l2 * l2; - return [ - lambda * (0, _mathJs.cos)(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), - l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - ]; -} -equalEarthRaw.invert = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for(var i = 0, delta, fy, fpy; i < iterations; ++i){ - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if ((0, _mathJs.abs)(delta) < (0, _mathJs.epsilon2)) break; - } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / (0, _mathJs.cos)(l), - (0, _mathJs.asin)((0, _mathJs.sin)(l) / M) - ]; -}; - -},{"./index.js":"7QH2d","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93udH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gnomonicRaw", ()=>gnomonicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(gnomonicRaw).scale(144.049).clipAngle(60); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function gnomonicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -gnomonicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.atan)); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9vqqR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x0 = null, y0, x1, y1, kx = 1, ky = 1, transform = (0, _transformJs.transformer)({ - point: function(x, y) { - var p = projection([ - x, - y - ]); - this.stream.point(p[0], p[1]); - } - }), postclip = (0, _identityJsDefault.default), cache, cacheStream; - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - function projection(p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [ - x + tx, - y + ty - ]; - } - projection.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [ - x / kx, - y / ky - ]; - }; - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [ - tx, - ty - ]; - }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), sa = (0, _mathJs.sin)(alpha), ca = (0, _mathJs.cos)(alpha), reset()) : alpha * (0, _mathJs.degrees); - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); - }; - return projection; - }); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _mathJs = require("../math.js"); - -},{"../clip/rectangle.js":"4qylb","../identity.js":"53el5","../transform.js":"7yOQv","./fit.js":"1SqNP","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erpNS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "naturalEarth1Raw", ()=>naturalEarth1Raw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(naturalEarth1Raw).scale(175.295); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; -} -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.045255 + phi4 * (-0.311325 + 0.259866 * phi2 - 0.005916 * 11 * phi4))); - }while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; -}; - -},{"./index.js":"7QH2d","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7NqTM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orthographicRaw", ()=>orthographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(orthographicRaw).scale(249.5).clipAngle(90 + (0, _mathJs.epsilon)); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function orthographicRaw(x, y) { - return [ - (0, _mathJs.cos)(y) * (0, _mathJs.sin)(x), - (0, _mathJs.sin)(y) - ]; -} -orthographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.asin)); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"grd1o":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "stereographicRaw", ()=>stereographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(stereographicRaw).scale(250).clipAngle(142); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function stereographicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = 1 + (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -stereographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.atan)(z); -}); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93Ws5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "transverseMercatorRaw", ()=>transverseMercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - var m = (0, _mercatorJs.mercatorProjection)(transverseMercatorRaw), center = m.center, rotate = m.rotate; - m.center = function(_) { - return arguments.length ? center([ - -_[1], - _[0] - ]) : (_ = center(), [ - _[1], - -_[0] - ]); - }; - m.rotate = function(_) { - return arguments.length ? rotate([ - _[0], - _[1], - _.length > 2 ? _[2] + 90 : 90 - ]) : (_ = rotate(), [ - _[0], - _[1], - _[2] - 90 - ]); - }; - return rotate([ - 0, - 0, - 90 - ]).scale(159.155); - }); -var _mathJs = require("../math.js"); -var _mercatorJs = require("./mercator.js"); -function transverseMercatorRaw(lambda, phi) { - return [ - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)), - -lambda - ]; -} -transverseMercatorRaw.invert = function(x, y) { - return [ - -y, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(x)) - (0, _mathJs.halfPi) - ]; -}; - -},{"../math.js":"kc9MU","./mercator.js":"a3UOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fqIqT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoAiry", ()=>(0, _airyJsDefault.default)); -parcelHelpers.export(exports, "geoAiryRaw", ()=>(0, _airyJs.airyRaw)); -parcelHelpers.export(exports, "geoAitoff", ()=>(0, _aitoffJsDefault.default)); -parcelHelpers.export(exports, "geoAitoffRaw", ()=>(0, _aitoffJs.aitoffRaw)); -parcelHelpers.export(exports, "geoArmadillo", ()=>(0, _armadilloJsDefault.default)); -parcelHelpers.export(exports, "geoArmadilloRaw", ()=>(0, _armadilloJs.armadilloRaw)); -parcelHelpers.export(exports, "geoAugust", ()=>(0, _augustJsDefault.default)); -parcelHelpers.export(exports, "geoAugustRaw", ()=>(0, _augustJs.augustRaw)); -parcelHelpers.export(exports, "geoBaker", ()=>(0, _bakerJsDefault.default)); -parcelHelpers.export(exports, "geoBakerRaw", ()=>(0, _bakerJs.bakerRaw)); -parcelHelpers.export(exports, "geoBerghaus", ()=>(0, _berghausJsDefault.default)); -parcelHelpers.export(exports, "geoBerghausRaw", ()=>(0, _berghausJs.berghausRaw)); -parcelHelpers.export(exports, "geoBertin1953", ()=>(0, _bertinJsDefault.default)); -parcelHelpers.export(exports, "geoBertin1953Raw", ()=>(0, _bertinJs.bertin1953Raw)); -parcelHelpers.export(exports, "geoBoggs", ()=>(0, _boggsJsDefault.default)); -parcelHelpers.export(exports, "geoBoggsRaw", ()=>(0, _boggsJs.boggsRaw)); -parcelHelpers.export(exports, "geoBonne", ()=>(0, _bonneJsDefault.default)); -parcelHelpers.export(exports, "geoBonneRaw", ()=>(0, _bonneJs.bonneRaw)); -parcelHelpers.export(exports, "geoBottomley", ()=>(0, _bottomleyJsDefault.default)); -parcelHelpers.export(exports, "geoBottomleyRaw", ()=>(0, _bottomleyJs.bottomleyRaw)); -parcelHelpers.export(exports, "geoBromley", ()=>(0, _bromleyJsDefault.default)); -parcelHelpers.export(exports, "geoBromleyRaw", ()=>(0, _bromleyJs.bromleyRaw)); -parcelHelpers.export(exports, "geoChamberlin", ()=>(0, _chamberlinJsDefault.default)); -parcelHelpers.export(exports, "geoChamberlinRaw", ()=>(0, _chamberlinJs.chamberlinRaw)); -parcelHelpers.export(exports, "geoChamberlinAfrica", ()=>(0, _chamberlinJs.chamberlinAfrica)); -parcelHelpers.export(exports, "geoCollignon", ()=>(0, _collignonJsDefault.default)); -parcelHelpers.export(exports, "geoCollignonRaw", ()=>(0, _collignonJs.collignonRaw)); -parcelHelpers.export(exports, "geoCraig", ()=>(0, _craigJsDefault.default)); -parcelHelpers.export(exports, "geoCraigRaw", ()=>(0, _craigJs.craigRaw)); -parcelHelpers.export(exports, "geoCraster", ()=>(0, _crasterJsDefault.default)); -parcelHelpers.export(exports, "geoCrasterRaw", ()=>(0, _crasterJs.crasterRaw)); -parcelHelpers.export(exports, "geoCylindricalEqualArea", ()=>(0, _cylindricalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalEqualAreaRaw", ()=>(0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)); -parcelHelpers.export(exports, "geoCylindricalStereographic", ()=>(0, _cylindricalStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalStereographicRaw", ()=>(0, _cylindricalStereographicJs.cylindricalStereographicRaw)); -parcelHelpers.export(exports, "geoEckert1", ()=>(0, _eckert1JsDefault.default)); -parcelHelpers.export(exports, "geoEckert1Raw", ()=>(0, _eckert1Js.eckert1Raw)); -parcelHelpers.export(exports, "geoEckert2", ()=>(0, _eckert2JsDefault.default)); -parcelHelpers.export(exports, "geoEckert2Raw", ()=>(0, _eckert2Js.eckert2Raw)); -parcelHelpers.export(exports, "geoEckert3", ()=>(0, _eckert3JsDefault.default)); -parcelHelpers.export(exports, "geoEckert3Raw", ()=>(0, _eckert3Js.eckert3Raw)); -parcelHelpers.export(exports, "geoEckert4", ()=>(0, _eckert4JsDefault.default)); -parcelHelpers.export(exports, "geoEckert4Raw", ()=>(0, _eckert4Js.eckert4Raw)); -parcelHelpers.export(exports, "geoEckert5", ()=>(0, _eckert5JsDefault.default)); -parcelHelpers.export(exports, "geoEckert5Raw", ()=>(0, _eckert5Js.eckert5Raw)); -parcelHelpers.export(exports, "geoEckert6", ()=>(0, _eckert6JsDefault.default)); -parcelHelpers.export(exports, "geoEckert6Raw", ()=>(0, _eckert6Js.eckert6Raw)); -parcelHelpers.export(exports, "geoEisenlohr", ()=>(0, _eisenlohrJsDefault.default)); -parcelHelpers.export(exports, "geoEisenlohrRaw", ()=>(0, _eisenlohrJs.eisenlohrRaw)); -parcelHelpers.export(exports, "geoFahey", ()=>(0, _faheyJsDefault.default)); -parcelHelpers.export(exports, "geoFaheyRaw", ()=>(0, _faheyJs.faheyRaw)); -parcelHelpers.export(exports, "geoFoucaut", ()=>(0, _foucautJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautRaw", ()=>(0, _foucautJs.foucautRaw)); -parcelHelpers.export(exports, "geoFoucautSinusoidal", ()=>(0, _foucautSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautSinusoidalRaw", ()=>(0, _foucautSinusoidalJs.foucautSinusoidalRaw)); -parcelHelpers.export(exports, "geoGilbert", ()=>(0, _gilbertJsDefault.default)); -parcelHelpers.export(exports, "geoGingery", ()=>(0, _gingeryJsDefault.default)); -parcelHelpers.export(exports, "geoGingeryRaw", ()=>(0, _gingeryJs.gingeryRaw)); -parcelHelpers.export(exports, "geoGinzburg4", ()=>(0, _ginzburg4JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg4Raw", ()=>(0, _ginzburg4Js.ginzburg4Raw)); -parcelHelpers.export(exports, "geoGinzburg5", ()=>(0, _ginzburg5JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg5Raw", ()=>(0, _ginzburg5Js.ginzburg5Raw)); -parcelHelpers.export(exports, "geoGinzburg6", ()=>(0, _ginzburg6JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg6Raw", ()=>(0, _ginzburg6Js.ginzburg6Raw)); -parcelHelpers.export(exports, "geoGinzburg8", ()=>(0, _ginzburg8JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg8Raw", ()=>(0, _ginzburg8Js.ginzburg8Raw)); -parcelHelpers.export(exports, "geoGinzburg9", ()=>(0, _ginzburg9JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg9Raw", ()=>(0, _ginzburg9Js.ginzburg9Raw)); -parcelHelpers.export(exports, "geoGringorten", ()=>(0, _gringortenJsDefault.default)); -parcelHelpers.export(exports, "geoGringortenRaw", ()=>(0, _gringortenJs.gringortenRaw)); -parcelHelpers.export(exports, "geoGuyou", ()=>(0, _guyouJsDefault.default)); -parcelHelpers.export(exports, "geoGuyouRaw", ()=>(0, _guyouJs.guyouRaw)); -parcelHelpers.export(exports, "geoHammer", ()=>(0, _hammerJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRaw", ()=>(0, _hammerJs.hammerRaw)); -parcelHelpers.export(exports, "geoHammerRetroazimuthal", ()=>(0, _hammerRetroazimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRetroazimuthalRaw", ()=>(0, _hammerRetroazimuthalJs.hammerRetroazimuthalRaw)); -parcelHelpers.export(exports, "geoHealpix", ()=>(0, _healpixJsDefault.default)); -parcelHelpers.export(exports, "geoHealpixRaw", ()=>(0, _healpixJs.healpixRaw)); -parcelHelpers.export(exports, "geoHill", ()=>(0, _hillJsDefault.default)); -parcelHelpers.export(exports, "geoHillRaw", ()=>(0, _hillJs.hillRaw)); -parcelHelpers.export(exports, "geoHomolosine", ()=>(0, _homolosineJsDefault.default)); -parcelHelpers.export(exports, "geoHomolosineRaw", ()=>(0, _homolosineJs.homolosineRaw)); -parcelHelpers.export(exports, "geoHufnagel", ()=>(0, _hufnagelJsDefault.default)); -parcelHelpers.export(exports, "geoHufnagelRaw", ()=>(0, _hufnagelJs.hufnagelRaw)); -parcelHelpers.export(exports, "geoHyperelliptical", ()=>(0, _hyperellipticalJsDefault.default)); -parcelHelpers.export(exports, "geoHyperellipticalRaw", ()=>(0, _hyperellipticalJs.hyperellipticalRaw)); -parcelHelpers.export(exports, "geoInterrupt", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedBoggs", ()=>(0, _boggsJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedHomolosine", ()=>(0, _homolosineJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedMollweide", ()=>(0, _mollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedMollweideHemispheres", ()=>(0, _mollweideHemispheresJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinuMollweide", ()=>(0, _sinuMollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinusoidal", ()=>(0, _sinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7", ()=>(0, _kavrayskiy7JsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7Raw", ()=>(0, _kavrayskiy7Js.kavrayskiy7Raw)); -parcelHelpers.export(exports, "geoLagrange", ()=>(0, _lagrangeJsDefault.default)); -parcelHelpers.export(exports, "geoLagrangeRaw", ()=>(0, _lagrangeJs.lagrangeRaw)); -parcelHelpers.export(exports, "geoLarrivee", ()=>(0, _larriveeJsDefault.default)); -parcelHelpers.export(exports, "geoLarriveeRaw", ()=>(0, _larriveeJs.larriveeRaw)); -parcelHelpers.export(exports, "geoLaskowski", ()=>(0, _laskowskiJsDefault.default)); -parcelHelpers.export(exports, "geoLaskowskiRaw", ()=>(0, _laskowskiJs.laskowskiRaw)); -parcelHelpers.export(exports, "geoLittrow", ()=>(0, _littrowJsDefault.default)); -parcelHelpers.export(exports, "geoLittrowRaw", ()=>(0, _littrowJs.littrowRaw)); -parcelHelpers.export(exports, "geoLoximuthal", ()=>(0, _loximuthalJsDefault.default)); -parcelHelpers.export(exports, "geoLoximuthalRaw", ()=>(0, _loximuthalJs.loximuthalRaw)); -parcelHelpers.export(exports, "geoMiller", ()=>(0, _millerJsDefault.default)); -parcelHelpers.export(exports, "geoMillerRaw", ()=>(0, _millerJs.millerRaw)); -parcelHelpers.export(exports, "geoModifiedStereographic", ()=>(0, _modifiedStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoModifiedStereographicRaw", ()=>(0, _modifiedStereographicJs.modifiedStereographicRaw)); -parcelHelpers.export(exports, "geoModifiedStereographicAlaska", ()=>(0, _modifiedStereographicJs.modifiedStereographicAlaska)); -parcelHelpers.export(exports, "geoModifiedStereographicGs48", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs48)); -parcelHelpers.export(exports, "geoModifiedStereographicGs50", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs50)); -parcelHelpers.export(exports, "geoModifiedStereographicMiller", ()=>(0, _modifiedStereographicJs.modifiedStereographicMiller)); -parcelHelpers.export(exports, "geoModifiedStereographicLee", ()=>(0, _modifiedStereographicJs.modifiedStereographicLee)); -parcelHelpers.export(exports, "geoMollweide", ()=>(0, _mollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoMollweideRaw", ()=>(0, _mollweideJs1.mollweideRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolic", ()=>(0, _mtFlatPolarParabolicJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolicRaw", ()=>(0, _mtFlatPolarParabolicJs.mtFlatPolarParabolicRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarQuartic", ()=>(0, _mtFlatPolarQuarticJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarQuarticRaw", ()=>(0, _mtFlatPolarQuarticJs.mtFlatPolarQuarticRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidal", ()=>(0, _mtFlatPolarSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidalRaw", ()=>(0, _mtFlatPolarSinusoidalJs.mtFlatPolarSinusoidalRaw)); -parcelHelpers.export(exports, "geoNaturalEarth2", ()=>(0, _naturalEarth2JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth2Raw", ()=>(0, _naturalEarth2Js.naturalEarth2Raw)); -parcelHelpers.export(exports, "geoNellHammer", ()=>(0, _nellHammerJsDefault.default)); -parcelHelpers.export(exports, "geoNellHammerRaw", ()=>(0, _nellHammerJs.nellHammerRaw)); -parcelHelpers.export(exports, "geoInterruptedQuarticAuthalic", ()=>(0, _quarticAuthalicJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosi", ()=>(0, _nicolosiJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosiRaw", ()=>(0, _nicolosiJs.nicolosiRaw)); -parcelHelpers.export(exports, "geoPatterson", ()=>(0, _pattersonJsDefault.default)); -parcelHelpers.export(exports, "geoPattersonRaw", ()=>(0, _pattersonJs.pattersonRaw)); -parcelHelpers.export(exports, "geoPolyconic", ()=>(0, _polyconicJsDefault.default)); -parcelHelpers.export(exports, "geoPolyconicRaw", ()=>(0, _polyconicJs.polyconicRaw)); -parcelHelpers.export(exports, "geoPolyhedral", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralButterfly", ()=>(0, _butterflyJsDefault.default)); -parcelHelpers.export(exports, "geoPolyhedralCollignon", ()=>(0, _collignonJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralWaterman", ()=>(0, _watermanJsDefault.default)); -parcelHelpers.export(exports, "geoProject", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "geoGringortenQuincuncial", ()=>(0, _gringortenJsDefault1.default)); -parcelHelpers.export(exports, "geoPeirceQuincuncial", ()=>(0, _peirceJsDefault.default)); -parcelHelpers.export(exports, "geoQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "geoQuincuncial", ()=>(0, _indexJsDefault3.default)); -parcelHelpers.export(exports, "geoRectangularPolyconic", ()=>(0, _rectangularPolyconicJsDefault.default)); -parcelHelpers.export(exports, "geoRectangularPolyconicRaw", ()=>(0, _rectangularPolyconicJs.rectangularPolyconicRaw)); -parcelHelpers.export(exports, "geoRobinson", ()=>(0, _robinsonJsDefault.default)); -parcelHelpers.export(exports, "geoRobinsonRaw", ()=>(0, _robinsonJs.robinsonRaw)); -parcelHelpers.export(exports, "geoSatellite", ()=>(0, _satelliteJsDefault.default)); -parcelHelpers.export(exports, "geoSatelliteRaw", ()=>(0, _satelliteJs.satelliteRaw)); -parcelHelpers.export(exports, "geoSinuMollweide", ()=>(0, _sinuMollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoSinuMollweideRaw", ()=>(0, _sinuMollweideJs1.sinuMollweideRaw)); -parcelHelpers.export(exports, "geoSinusoidal", ()=>(0, _sinusoidalJsDefault1.default)); -parcelHelpers.export(exports, "geoSinusoidalRaw", ()=>(0, _sinusoidalJs1.sinusoidalRaw)); -parcelHelpers.export(exports, "geoStitch", ()=>(0, _stitchJsDefault.default)); -parcelHelpers.export(exports, "geoTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "geoTimesRaw", ()=>(0, _timesJs.timesRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthal", ()=>(0, _twoPointAzimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalRaw", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalUsa", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalUsa)); -parcelHelpers.export(exports, "geoTwoPointEquidistant", ()=>(0, _twoPointEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointEquidistantRaw", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantRaw)); -parcelHelpers.export(exports, "geoTwoPointEquidistantUsa", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantUsa)); -parcelHelpers.export(exports, "geoVanDerGrinten", ()=>(0, _vanDerGrintenJsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrintenRaw", ()=>(0, _vanDerGrintenJs.vanDerGrintenRaw)); -parcelHelpers.export(exports, "geoVanDerGrinten2", ()=>(0, _vanDerGrinten2JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten2Raw", ()=>(0, _vanDerGrinten2Js.vanDerGrinten2Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten3", ()=>(0, _vanDerGrinten3JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten3Raw", ()=>(0, _vanDerGrinten3Js.vanDerGrinten3Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten4", ()=>(0, _vanDerGrinten4JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten4Raw", ()=>(0, _vanDerGrinten4Js.vanDerGrinten4Raw)); -parcelHelpers.export(exports, "geoWagner", ()=>(0, _wagnerJsDefault.default)); -parcelHelpers.export(exports, "geoWagner7", ()=>(0, _wagnerJs.wagner7)); -parcelHelpers.export(exports, "geoWagnerRaw", ()=>(0, _wagnerJs.wagnerRaw)); -parcelHelpers.export(exports, "geoWagner4", ()=>(0, _wagner4JsDefault.default)); -parcelHelpers.export(exports, "geoWagner4Raw", ()=>(0, _wagner4Js.wagner4Raw)); -parcelHelpers.export(exports, "geoWagner6", ()=>(0, _wagner6JsDefault.default)); -parcelHelpers.export(exports, "geoWagner6Raw", ()=>(0, _wagner6Js.wagner6Raw)); -parcelHelpers.export(exports, "geoWiechel", ()=>(0, _wiechelJsDefault.default)); -parcelHelpers.export(exports, "geoWiechelRaw", ()=>(0, _wiechelJs.wiechelRaw)); -parcelHelpers.export(exports, "geoWinkel3", ()=>(0, _winkel3JsDefault.default)); -parcelHelpers.export(exports, "geoWinkel3Raw", ()=>(0, _winkel3Js.winkel3Raw)); -var _airyJs = require("./airy.js"); -var _airyJsDefault = parcelHelpers.interopDefault(_airyJs); -var _aitoffJs = require("./aitoff.js"); -var _aitoffJsDefault = parcelHelpers.interopDefault(_aitoffJs); -var _armadilloJs = require("./armadillo.js"); -var _armadilloJsDefault = parcelHelpers.interopDefault(_armadilloJs); -var _augustJs = require("./august.js"); -var _augustJsDefault = parcelHelpers.interopDefault(_augustJs); -var _bakerJs = require("./baker.js"); -var _bakerJsDefault = parcelHelpers.interopDefault(_bakerJs); -var _berghausJs = require("./berghaus.js"); -var _berghausJsDefault = parcelHelpers.interopDefault(_berghausJs); -var _bertinJs = require("./bertin.js"); -var _bertinJsDefault = parcelHelpers.interopDefault(_bertinJs); -var _boggsJs = require("./boggs.js"); -var _boggsJsDefault = parcelHelpers.interopDefault(_boggsJs); -var _bonneJs = require("./bonne.js"); -var _bonneJsDefault = parcelHelpers.interopDefault(_bonneJs); -var _bottomleyJs = require("./bottomley.js"); -var _bottomleyJsDefault = parcelHelpers.interopDefault(_bottomleyJs); -var _bromleyJs = require("./bromley.js"); -var _bromleyJsDefault = parcelHelpers.interopDefault(_bromleyJs); -var _chamberlinJs = require("./chamberlin.js"); -var _chamberlinJsDefault = parcelHelpers.interopDefault(_chamberlinJs); -var _collignonJs = require("./collignon.js"); -var _collignonJsDefault = parcelHelpers.interopDefault(_collignonJs); -var _craigJs = require("./craig.js"); -var _craigJsDefault = parcelHelpers.interopDefault(_craigJs); -var _crasterJs = require("./craster.js"); -var _crasterJsDefault = parcelHelpers.interopDefault(_crasterJs); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -var _cylindricalEqualAreaJsDefault = parcelHelpers.interopDefault(_cylindricalEqualAreaJs); -var _cylindricalStereographicJs = require("./cylindricalStereographic.js"); -var _cylindricalStereographicJsDefault = parcelHelpers.interopDefault(_cylindricalStereographicJs); -var _eckert1Js = require("./eckert1.js"); -var _eckert1JsDefault = parcelHelpers.interopDefault(_eckert1Js); -var _eckert2Js = require("./eckert2.js"); -var _eckert2JsDefault = parcelHelpers.interopDefault(_eckert2Js); -var _eckert3Js = require("./eckert3.js"); -var _eckert3JsDefault = parcelHelpers.interopDefault(_eckert3Js); -var _eckert4Js = require("./eckert4.js"); -var _eckert4JsDefault = parcelHelpers.interopDefault(_eckert4Js); -var _eckert5Js = require("./eckert5.js"); -var _eckert5JsDefault = parcelHelpers.interopDefault(_eckert5Js); -var _eckert6Js = require("./eckert6.js"); -var _eckert6JsDefault = parcelHelpers.interopDefault(_eckert6Js); -var _eisenlohrJs = require("./eisenlohr.js"); -var _eisenlohrJsDefault = parcelHelpers.interopDefault(_eisenlohrJs); -var _faheyJs = require("./fahey.js"); -var _faheyJsDefault = parcelHelpers.interopDefault(_faheyJs); -var _foucautJs = require("./foucaut.js"); -var _foucautJsDefault = parcelHelpers.interopDefault(_foucautJs); -var _foucautSinusoidalJs = require("./foucautSinusoidal.js"); -var _foucautSinusoidalJsDefault = parcelHelpers.interopDefault(_foucautSinusoidalJs); -var _gilbertJs = require("./gilbert.js"); -var _gilbertJsDefault = parcelHelpers.interopDefault(_gilbertJs); -var _gingeryJs = require("./gingery.js"); -var _gingeryJsDefault = parcelHelpers.interopDefault(_gingeryJs); -var _ginzburg4Js = require("./ginzburg4.js"); -var _ginzburg4JsDefault = parcelHelpers.interopDefault(_ginzburg4Js); -var _ginzburg5Js = require("./ginzburg5.js"); -var _ginzburg5JsDefault = parcelHelpers.interopDefault(_ginzburg5Js); -var _ginzburg6Js = require("./ginzburg6.js"); -var _ginzburg6JsDefault = parcelHelpers.interopDefault(_ginzburg6Js); -var _ginzburg8Js = require("./ginzburg8.js"); -var _ginzburg8JsDefault = parcelHelpers.interopDefault(_ginzburg8Js); -var _ginzburg9Js = require("./ginzburg9.js"); -var _ginzburg9JsDefault = parcelHelpers.interopDefault(_ginzburg9Js); -var _gringortenJs = require("./gringorten.js"); -var _gringortenJsDefault = parcelHelpers.interopDefault(_gringortenJs); -var _guyouJs = require("./guyou.js"); -var _guyouJsDefault = parcelHelpers.interopDefault(_guyouJs); -var _hammerJs = require("./hammer.js"); -var _hammerJsDefault = parcelHelpers.interopDefault(_hammerJs); -var _hammerRetroazimuthalJs = require("./hammerRetroazimuthal.js"); -var _hammerRetroazimuthalJsDefault = parcelHelpers.interopDefault(_hammerRetroazimuthalJs); -var _healpixJs = require("./healpix.js"); -var _healpixJsDefault = parcelHelpers.interopDefault(_healpixJs); -var _hillJs = require("./hill.js"); -var _hillJsDefault = parcelHelpers.interopDefault(_hillJs); -var _homolosineJs = require("./homolosine.js"); -var _homolosineJsDefault = parcelHelpers.interopDefault(_homolosineJs); -var _hufnagelJs = require("./hufnagel.js"); -var _hufnagelJsDefault = parcelHelpers.interopDefault(_hufnagelJs); -var _hyperellipticalJs = require("./hyperelliptical.js"); -var _hyperellipticalJsDefault = parcelHelpers.interopDefault(_hyperellipticalJs); -var _indexJs = require("./interrupted/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _boggsJs1 = require("./interrupted/boggs.js"); -var _boggsJsDefault1 = parcelHelpers.interopDefault(_boggsJs1); -var _homolosineJs1 = require("./interrupted/homolosine.js"); -var _homolosineJsDefault1 = parcelHelpers.interopDefault(_homolosineJs1); -var _mollweideJs = require("./interrupted/mollweide.js"); -var _mollweideJsDefault = parcelHelpers.interopDefault(_mollweideJs); -var _mollweideHemispheresJs = require("./interrupted/mollweideHemispheres.js"); -var _mollweideHemispheresJsDefault = parcelHelpers.interopDefault(_mollweideHemispheresJs); -var _sinuMollweideJs = require("./interrupted/sinuMollweide.js"); -var _sinuMollweideJsDefault = parcelHelpers.interopDefault(_sinuMollweideJs); -var _sinusoidalJs = require("./interrupted/sinusoidal.js"); -var _sinusoidalJsDefault = parcelHelpers.interopDefault(_sinusoidalJs); -var _kavrayskiy7Js = require("./kavrayskiy7.js"); -var _kavrayskiy7JsDefault = parcelHelpers.interopDefault(_kavrayskiy7Js); -var _lagrangeJs = require("./lagrange.js"); -var _lagrangeJsDefault = parcelHelpers.interopDefault(_lagrangeJs); -var _larriveeJs = require("./larrivee.js"); -var _larriveeJsDefault = parcelHelpers.interopDefault(_larriveeJs); -var _laskowskiJs = require("./laskowski.js"); -var _laskowskiJsDefault = parcelHelpers.interopDefault(_laskowskiJs); -var _littrowJs = require("./littrow.js"); -var _littrowJsDefault = parcelHelpers.interopDefault(_littrowJs); -var _loximuthalJs = require("./loximuthal.js"); -var _loximuthalJsDefault = parcelHelpers.interopDefault(_loximuthalJs); -var _millerJs = require("./miller.js"); -var _millerJsDefault = parcelHelpers.interopDefault(_millerJs); -var _modifiedStereographicJs = require("./modifiedStereographic.js"); -var _modifiedStereographicJsDefault = parcelHelpers.interopDefault(_modifiedStereographicJs); -var _mollweideJs1 = require("./mollweide.js"); -var _mollweideJsDefault1 = parcelHelpers.interopDefault(_mollweideJs1); -var _mtFlatPolarParabolicJs = require("./mtFlatPolarParabolic.js"); -var _mtFlatPolarParabolicJsDefault = parcelHelpers.interopDefault(_mtFlatPolarParabolicJs); -var _mtFlatPolarQuarticJs = require("./mtFlatPolarQuartic.js"); -var _mtFlatPolarQuarticJsDefault = parcelHelpers.interopDefault(_mtFlatPolarQuarticJs); -var _mtFlatPolarSinusoidalJs = require("./mtFlatPolarSinusoidal.js"); -var _mtFlatPolarSinusoidalJsDefault = parcelHelpers.interopDefault(_mtFlatPolarSinusoidalJs); -var _naturalEarth2Js = require("./naturalEarth2.js"); -var _naturalEarth2JsDefault = parcelHelpers.interopDefault(_naturalEarth2Js); -var _nellHammerJs = require("./nellHammer.js"); -var _nellHammerJsDefault = parcelHelpers.interopDefault(_nellHammerJs); -var _quarticAuthalicJs = require("./interrupted/quarticAuthalic.js"); -var _quarticAuthalicJsDefault = parcelHelpers.interopDefault(_quarticAuthalicJs); -var _nicolosiJs = require("./nicolosi.js"); -var _nicolosiJsDefault = parcelHelpers.interopDefault(_nicolosiJs); -var _pattersonJs = require("./patterson.js"); -var _pattersonJsDefault = parcelHelpers.interopDefault(_pattersonJs); -var _polyconicJs = require("./polyconic.js"); -var _polyconicJsDefault = parcelHelpers.interopDefault(_polyconicJs); -var _indexJs1 = require("./polyhedral/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _butterflyJs = require("./polyhedral/butterfly.js"); -var _butterflyJsDefault = parcelHelpers.interopDefault(_butterflyJs); -var _collignonJs1 = require("./polyhedral/collignon.js"); -var _collignonJsDefault1 = parcelHelpers.interopDefault(_collignonJs1); -var _watermanJs = require("./polyhedral/waterman.js"); -var _watermanJsDefault = parcelHelpers.interopDefault(_watermanJs); -var _indexJs2 = require("./project/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _gringortenJs1 = require("./quincuncial/gringorten.js"); -var _gringortenJsDefault1 = parcelHelpers.interopDefault(_gringortenJs1); -var _peirceJs = require("./quincuncial/peirce.js"); -var _peirceJsDefault = parcelHelpers.interopDefault(_peirceJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _indexJs3 = require("./quincuncial/index.js"); -var _indexJsDefault3 = parcelHelpers.interopDefault(_indexJs3); -var _rectangularPolyconicJs = require("./rectangularPolyconic.js"); -var _rectangularPolyconicJsDefault = parcelHelpers.interopDefault(_rectangularPolyconicJs); -var _robinsonJs = require("./robinson.js"); -var _robinsonJsDefault = parcelHelpers.interopDefault(_robinsonJs); -var _satelliteJs = require("./satellite.js"); -var _satelliteJsDefault = parcelHelpers.interopDefault(_satelliteJs); -var _sinuMollweideJs1 = require("./sinuMollweide.js"); -var _sinuMollweideJsDefault1 = parcelHelpers.interopDefault(_sinuMollweideJs1); -var _sinusoidalJs1 = require("./sinusoidal.js"); -var _sinusoidalJsDefault1 = parcelHelpers.interopDefault(_sinusoidalJs1); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -var _timesJs = require("./times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _twoPointAzimuthalJs = require("./twoPointAzimuthal.js"); -var _twoPointAzimuthalJsDefault = parcelHelpers.interopDefault(_twoPointAzimuthalJs); -var _twoPointEquidistantJs = require("./twoPointEquidistant.js"); -var _twoPointEquidistantJsDefault = parcelHelpers.interopDefault(_twoPointEquidistantJs); -var _vanDerGrintenJs = require("./vanDerGrinten.js"); -var _vanDerGrintenJsDefault = parcelHelpers.interopDefault(_vanDerGrintenJs); -var _vanDerGrinten2Js = require("./vanDerGrinten2.js"); -var _vanDerGrinten2JsDefault = parcelHelpers.interopDefault(_vanDerGrinten2Js); -var _vanDerGrinten3Js = require("./vanDerGrinten3.js"); -var _vanDerGrinten3JsDefault = parcelHelpers.interopDefault(_vanDerGrinten3Js); -var _vanDerGrinten4Js = require("./vanDerGrinten4.js"); -var _vanDerGrinten4JsDefault = parcelHelpers.interopDefault(_vanDerGrinten4Js); -var _wagnerJs = require("./wagner.js"); -var _wagnerJsDefault = parcelHelpers.interopDefault(_wagnerJs); -var _wagner4Js = require("./wagner4.js"); -var _wagner4JsDefault = parcelHelpers.interopDefault(_wagner4Js); -var _wagner6Js = require("./wagner6.js"); -var _wagner6JsDefault = parcelHelpers.interopDefault(_wagner6Js); -var _wiechelJs = require("./wiechel.js"); -var _wiechelJsDefault = parcelHelpers.interopDefault(_wiechelJs); -var _winkel3Js = require("./winkel3.js"); -var _winkel3JsDefault = parcelHelpers.interopDefault(_winkel3Js); - -},{"./airy.js":false,"./aitoff.js":false,"./armadillo.js":false,"./august.js":false,"./baker.js":false,"./berghaus.js":false,"./bertin.js":false,"./boggs.js":false,"./bonne.js":false,"./bottomley.js":false,"./bromley.js":false,"./chamberlin.js":false,"./collignon.js":false,"./craig.js":false,"./craster.js":false,"./cylindricalEqualArea.js":false,"./cylindricalStereographic.js":false,"./eckert1.js":false,"./eckert2.js":false,"./eckert3.js":false,"./eckert4.js":false,"./eckert5.js":false,"./eckert6.js":false,"./eisenlohr.js":false,"./fahey.js":false,"./foucaut.js":false,"./foucautSinusoidal.js":false,"./gilbert.js":false,"./gingery.js":false,"./ginzburg4.js":false,"./ginzburg5.js":false,"./ginzburg6.js":false,"./ginzburg8.js":false,"./ginzburg9.js":false,"./gringorten.js":false,"./guyou.js":false,"./hammer.js":false,"./hammerRetroazimuthal.js":false,"./healpix.js":false,"./hill.js":false,"./homolosine.js":false,"./hufnagel.js":false,"./hyperelliptical.js":false,"./interrupted/index.js":false,"./interrupted/boggs.js":false,"./interrupted/homolosine.js":false,"./interrupted/mollweide.js":false,"./interrupted/mollweideHemispheres.js":false,"./interrupted/sinuMollweide.js":false,"./interrupted/sinusoidal.js":false,"./kavrayskiy7.js":false,"./lagrange.js":false,"./larrivee.js":false,"./laskowski.js":false,"./littrow.js":false,"./loximuthal.js":false,"./miller.js":false,"./modifiedStereographic.js":false,"./mollweide.js":"7BhiE","./mtFlatPolarParabolic.js":false,"./mtFlatPolarQuartic.js":false,"./mtFlatPolarSinusoidal.js":false,"./naturalEarth2.js":false,"./nellHammer.js":false,"./interrupted/quarticAuthalic.js":false,"./nicolosi.js":false,"./patterson.js":false,"./polyconic.js":false,"./polyhedral/index.js":false,"./polyhedral/butterfly.js":false,"./polyhedral/collignon.js":false,"./polyhedral/waterman.js":false,"./project/index.js":false,"./quincuncial/gringorten.js":false,"./quincuncial/peirce.js":false,"./quantize.js":false,"./quincuncial/index.js":false,"./rectangularPolyconic.js":false,"./robinson.js":false,"./satellite.js":false,"./sinuMollweide.js":false,"./sinusoidal.js":false,"./stitch.js":false,"./times.js":false,"./twoPointAzimuthal.js":false,"./twoPointEquidistant.js":false,"./vanDerGrinten.js":false,"./vanDerGrinten2.js":false,"./vanDerGrinten3.js":false,"./vanDerGrinten4.js":false,"./wagner.js":false,"./wagner4.js":false,"./wagner6.js":false,"./wiechel.js":false,"./winkel3.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7BhiE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mollweideBromleyTheta", ()=>mollweideBromleyTheta); -parcelHelpers.export(exports, "mollweideBromleyRaw", ()=>mollweideBromleyRaw); -parcelHelpers.export(exports, "mollweideRaw", ()=>mollweideRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _d3Geo.geoProjection)(mollweideRaw).scale(169.529); - }); -var _d3Geo = require("d3-geo"); -var _mathJs = require("./math.js"); -function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * (0, _mathJs.sin)(phi), i = 30, delta; - do phi -= delta = (phi + (0, _mathJs.sin)(phi) - cpsinPhi) / (1 + (0, _mathJs.cos)(phi)); - while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return phi / 2; -} -function mollweideBromleyRaw(cx, cy, cp) { - function forward(lambda, phi) { - return [ - cx * lambda * (0, _mathJs.cos)(phi = mollweideBromleyTheta(cp, phi)), - cy * (0, _mathJs.sin)(phi) - ]; + } + function roundNode(node) { + node.x0 = Math.round(node.x0); + node.y0 = Math.round(node.y0); + node.x1 = Math.round(node.x1); + node.y1 = Math.round(node.y1); + } + function treemapDice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x12 - x02) / parent.value; + while (++i < n) { + node = nodes[i], node.y0 = y02, node.y1 = y12; + node.x0 = x02, node.x1 = x02 += node.value * k; } - forward.invert = function(x, y) { - return y = (0, _mathJs.asin)(y / cy), [ - x / (cx * (0, _mathJs.cos)(y)), - (0, _mathJs.asin)((2 * y + (0, _mathJs.sin)(2 * y)) / cp) - ]; - }; - return forward; -} -var mollweideRaw = mollweideBromleyRaw((0, _mathJs.sqrt2) / (0, _mathJs.halfPi), (0, _mathJs.sqrt2), (0, _mathJs.pi)); - -},{"d3-geo":"8qTbc","./math.js":"1h9uT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1h9uT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "round", ()=>round); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "sqrt1_2", ()=>sqrt1_2); -parcelHelpers.export(exports, "sqrt2", ()=>sqrt2); -parcelHelpers.export(exports, "sqrtPi", ()=>sqrtPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "sinci", ()=>sinci); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tanh", ()=>tanh); -parcelHelpers.export(exports, "sinh", ()=>sinh); -parcelHelpers.export(exports, "cosh", ()=>cosh); -parcelHelpers.export(exports, "arsinh", ()=>arsinh); -parcelHelpers.export(exports, "arcosh", ()=>arcosh); -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var ceil = Math.ceil; -var cos = Math.cos; -var exp = Math.exp; -var floor = Math.floor; -var log = Math.log; -var max = Math.max; -var min = Math.min; -var pow = Math.pow; -var round = Math.round; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sin = Math.sin; -var tan = Math.tan; -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var sqrt1_2 = Math.SQRT1_2; -var sqrt2 = sqrt(2); -var sqrtPi = sqrt(pi); -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -function sinci(x) { - return x ? x / Math.sin(x) : 1; -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function sqrt(x) { - return x > 0 ? Math.sqrt(x) : 0; -} -function tanh(x) { - x = exp(2 * x); - return (x - 1) / (x + 1); -} -function sinh(x) { - return (exp(x) - exp(-x)) / 2; -} -function cosh(x) { - return (exp(x) + exp(-x)) / 2; -} -function arsinh(x) { - return log(x + sqrt(x * x + 1)); -} -function arcosh(x) { - return log(x + sqrt(x * x - 1)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7a0MQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "force", ()=>Force); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Force = require("d3-force"); -const ForceMap = { - center: (0, _d3Force.forceCenter), - collide: (0, _d3Force.forceCollide), - nbody: (0, _d3Force.forceManyBody), - link: (0, _d3Force.forceLink), - x: (0, _d3Force.forceX), - y: (0, _d3Force.forceY) -}; -const Forces = 'forces', ForceParams = [ - 'alpha', - 'alphaMin', - 'alphaTarget', - 'velocityDecay', - 'forces' -], ForceConfig = [ - 'static', - 'iterations' -], ForceOutput = [ - 'x', - 'y', - 'vx', - 'vy' -]; -/** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<object>} params.forces - The forces to apply. - */ function Force(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Force.Definition = { - 'type': 'Force', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'static', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'restart', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 300 - }, - { - 'name': 'alpha', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'alphaMin', - 'type': 'number', - 'default': 0.001 - }, - { - 'name': 'alphaTarget', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'velocityDecay', - 'type': 'number', - 'default': 0.4 - }, - { - 'name': 'forces', - 'type': 'param', - 'array': true, - 'params': [ - { - 'key': { - 'force': 'center' - }, - 'params': [ - { - 'name': 'x', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'y', - 'type': 'number', - 'default': 0 - } - ] - }, - { - 'key': { - 'force': 'collide' - }, - 'params': [ - { - 'name': 'radius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'default': 0.7 - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'nbody' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': -30, - 'expr': true - }, - { - 'name': 'theta', - 'type': 'number', - 'default': 0.9 - }, - { - 'name': 'distanceMin', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'distanceMax', - 'type': 'number' - } - ] - }, - { - 'key': { - 'force': 'link' - }, - 'params': [ - { - 'name': 'links', - 'type': 'data' - }, - { - 'name': 'id', - 'type': 'field' - }, - { - 'name': 'distance', - 'type': 'number', - 'default': 30, - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'expr': true - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'x' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'x', - 'type': 'field' - } - ] - }, - { - 'key': { - 'force': 'y' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'y', - 'type': 'field' - } - ] - } - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'modify': false, - 'default': ForceOutput + } + function partition$1() { + var dx = 1, dy = 1, padding2 = 0, round = false; + function partition2(root) { + var n = root.height + 1; + root.x0 = root.y0 = padding2; + root.x1 = dx; + root.y1 = dy / n; + root.eachBefore(positionNode(dy, n)); + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(dy2, n) { + return function(node) { + if (node.children) { + treemapDice(node, node.x0, dy2 * (node.depth + 1) / n, node.x1, dy2 * (node.depth + 2) / n); + } + var x02 = node.x0, y02 = node.y0, x12 = node.x1 - padding2, y12 = node.y1 - padding2; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + }; + } + partition2.round = function(x2) { + return arguments.length ? (round = !!x2, partition2) : round; + }; + partition2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], partition2) : [dx, dy]; + }; + partition2.padding = function(x2) { + return arguments.length ? (padding2 = +x2, partition2) : padding2; + }; + return partition2; + } + var preroot = { depth: -1 }, ambiguous = {}, imputed = {}; + function defaultId(d2) { + return d2.id; + } + function defaultParentId(d2) { + return d2.parentId; + } + function stratify() { + var id2 = defaultId, parentId = defaultParentId, path2; + function stratify2(data2) { + var nodes = Array.from(data2), currentId = id2, currentParentId = parentId, n, d2, i, root, parent, node, nodeId, nodeKey, nodeByKey = /* @__PURE__ */ new Map(); + if (path2 != null) { + const I = nodes.map((d3, i2) => normalize(path2(d3, i2, data2))); + const P = I.map(parentof); + const S = new Set(I).add(""); + for (const i2 of P) { + if (!S.has(i2)) { + S.add(i2); + I.push(i2); + P.push(parentof(i2)); + nodes.push(imputed); + } + } + currentId = (_, i2) => I[i2]; + currentParentId = (_, i2) => P[i2]; + } + for (i = 0, n = nodes.length; i < n; ++i) { + d2 = nodes[i], node = nodes[i] = new Node$2(d2); + if ((nodeId = currentId(d2, i, data2)) != null && (nodeId += "")) { + nodeKey = node.id = nodeId; + nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); } - ] -}; -(0, _vegaUtil.inherits)(Force, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sim = this.value, change = pulse.changed(pulse.ADD_REM), params = _.modified(ForceParams), iters = _.iterations || 300; - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); + if ((nodeId = currentParentId(d2, i, data2)) != null && (nodeId += "")) { + node.parent = nodeId; + } + } + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (nodeId = node.parent) { + parent = nodeByKey.get(nodeId); + if (!parent) throw new Error("missing: " + nodeId); + if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); + if (parent.children) parent.children.push(node); + else parent.children = [node]; + node.parent = parent; } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) setup(sim, _, 0, pulse); - } - // run simulation - if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - if (_.static) for(sim.stop(); --iters >= 0;)sim.tick(); - else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } + if (root) throw new Error("multiple roots"); + root = node; } - return this.finish(_, pulse); - }, - finish (_, pulse) { - const dataflow = pulse.dataflow; - // inspect dependencies, touch link source data - for(let args = this._argops, j = 0, m = args.length, arg; j < m; ++j){ - arg = args[j]; - if (arg.name !== Forces || arg.op._argval.force !== 'link') continue; - for(var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i)if (ops[i].name === 'links' && (op = ops[i].op.source)) { - dataflow.pulse(op, dataflow.changeset().reflow()); - break; - } + } + if (!root) throw new Error("no root"); + if (path2 != null) { + while (root.data === imputed && root.children.length === 1) { + root = root.children[0], --n; } - // reflow all nodes - return pulse.reflow(_.modified()).modifies(ForceOutput); + for (let i2 = nodes.length - 1; i2 >= 0; --i2) { + node = nodes[i2]; + if (node.data !== imputed) break; + node.data = null; + } + } + root.parent = preroot; + root.eachBefore(function(node2) { + node2.depth = node2.parent.depth + 1; + --n; + }).eachBefore(computeHeight); + root.parent = null; + if (n > 0) throw new Error("cycle"); + return root; } -}); -function rerun(df, op) { - return ()=>df.touch(op).run(); -} -function simulation(nodes, _) { - const sim = (0, _d3Force.forceSimulation)(nodes), stop = sim.stop, restart = sim.restart; - let stopped = false; - sim.stopped = ()=>stopped; - sim.restart = ()=>(stopped = false, restart()); - sim.stop = ()=>(stopped = true, stop()); - return setup(sim, _, true).on('end', ()=>stopped = true); -} -function setup(sim, _, init, pulse) { - var f = (0, _vegaUtil.array)(_.forces), i, n, p, name; - for(i = 0, n = ForceParams.length; i < n; ++i){ - p = ForceParams[i]; - if (p !== Forces && _.modified(p)) sim[p](_[p]); - } - for(i = 0, n = f.length; i < n; ++i){ - name = Forces + i; - p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null; - if (p) sim.force(name, p); - } - for(n = sim.numForces || 0; i < n; ++i)sim.force(Forces + i, null); // remove - sim.numForces = f.length; - return sim; -} -function modified(f, pulse) { - var k, v; - for(k in f){ - if ((0, _vegaUtil.isFunction)(v = f[k]) && pulse.modified((0, _vegaUtil.accessorFields)(v))) return 1; + stratify2.id = function(x2) { + return arguments.length ? (id2 = optional(x2), stratify2) : id2; + }; + stratify2.parentId = function(x2) { + return arguments.length ? (parentId = optional(x2), stratify2) : parentId; + }; + stratify2.path = function(x2) { + return arguments.length ? (path2 = optional(x2), stratify2) : path2; + }; + return stratify2; + } + function normalize(path2) { + path2 = `${path2}`; + let i = path2.length; + if (slash(path2, i - 1) && !slash(path2, i - 2)) path2 = path2.slice(0, -1); + return path2[0] === "/" ? path2 : `/${path2}`; + } + function parentof(path2) { + let i = path2.length; + if (i < 2) return ""; + while (--i > 1) if (slash(path2, i)) break; + return path2.slice(0, i); + } + function slash(path2, i) { + if (path2[i] === "/") { + let k = 0; + while (i > 0 && path2[--i] === "\\") ++k; + if ((k & 1) === 0) return true; } - return 0; -} -function getForce(_) { - var f, p; - if (!(0, _vegaUtil.hasOwnProperty)(ForceMap, _.force)) (0, _vegaUtil.error)('Unrecognized force: ' + _.force); - f = ForceMap[_.force](); - for(p in _)if ((0, _vegaUtil.isFunction)(f[p])) setForceParam(f[p], _[p], _); - return f; -} -function setForceParam(f, v, _) { - f((0, _vegaUtil.isFunction)(v) ? (d)=>v(d, _) : v); -} - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-force":"40vzv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"40vzv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "forceCenter", ()=>(0, _centerJsDefault.default)); -parcelHelpers.export(exports, "forceCollide", ()=>(0, _collideJsDefault.default)); -parcelHelpers.export(exports, "forceLink", ()=>(0, _linkJsDefault.default)); -parcelHelpers.export(exports, "forceManyBody", ()=>(0, _manyBodyJsDefault.default)); -parcelHelpers.export(exports, "forceRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "forceSimulation", ()=>(0, _simulationJsDefault.default)); -parcelHelpers.export(exports, "forceX", ()=>(0, _xJsDefault.default)); -parcelHelpers.export(exports, "forceY", ()=>(0, _yJsDefault.default)); -var _centerJs = require("./center.js"); -var _centerJsDefault = parcelHelpers.interopDefault(_centerJs); -var _collideJs = require("./collide.js"); -var _collideJsDefault = parcelHelpers.interopDefault(_collideJs); -var _linkJs = require("./link.js"); -var _linkJsDefault = parcelHelpers.interopDefault(_linkJs); -var _manyBodyJs = require("./manyBody.js"); -var _manyBodyJsDefault = parcelHelpers.interopDefault(_manyBodyJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _simulationJs = require("./simulation.js"); -var _simulationJsDefault = parcelHelpers.interopDefault(_simulationJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); - -},{"./center.js":"hGtrR","./collide.js":"g4yWa","./link.js":"lHhAG","./manyBody.js":"e0pBR","./radial.js":false,"./simulation.js":"gj5vV","./x.js":"gU1Aq","./y.js":"ldvAB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hGtrR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var nodes, strength = 1; - if (x == null) x = 0; - if (y == null) y = 0; - function force() { - var i, n = nodes.length, node, sx = 0, sy = 0; - for(i = 0; i < n; ++i)node = nodes[i], sx += node.x, sy += node.y; - for(sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i)node = nodes[i], node.x -= sx, node.y -= sy; - } - force.initialize = function(_) { - nodes = _; - }; - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - return force; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g4yWa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var nodes, radii, random, strength = 1, iterations = 1; - if (typeof radius !== "function") radius = (0, _constantJsDefault.default)(radius == null ? 1 : +radius); - function force() { - var i, n = nodes.length, tree, node, xi, yi, ri, ri2; - for(var k = 0; k < iterations; ++k){ - tree = (0, _d3Quadtree.quadtree)(nodes, x, y).visitAfter(prepare); - for(i = 0; i < n; ++i){ - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, y = yi - data.y - data.vy, l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= y * r; - } - } - return; - } - return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; - } - } - function prepare(quad) { - if (quad.data) return quad.r = radii[quad.data.index]; - for(var i = quad.r = 0; i < 4; ++i)if (quad[i] && quad[i].r > quad.r) quad.r = quad[i].r; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : radius; - }; - return force; - }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function x(d) { - return d.x + d.vx; -} -function y(d) { - return d.y + d.vy; -} - -},{"d3-quadtree":"2k0t6","./constant.js":"2YYtK","./jiggle.js":"80LBz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2k0t6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "quadtree", ()=>(0, _quadtreeJsDefault.default)); -var _quadtreeJs = require("./quadtree.js"); -var _quadtreeJsDefault = parcelHelpers.interopDefault(_quadtreeJs); - -},{"./quadtree.js":"ayjpH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ayjpH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quadtree); -var _addJs = require("./add.js"); -var _addJsDefault = parcelHelpers.interopDefault(_addJs); -var _coverJs = require("./cover.js"); -var _coverJsDefault = parcelHelpers.interopDefault(_coverJs); -var _dataJs = require("./data.js"); -var _dataJsDefault = parcelHelpers.interopDefault(_dataJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _removeJs = require("./remove.js"); -var _removeJsDefault = parcelHelpers.interopDefault(_removeJs); -var _rootJs = require("./root.js"); -var _rootJsDefault = parcelHelpers.interopDefault(_rootJs); -var _sizeJs = require("./size.js"); -var _sizeJsDefault = parcelHelpers.interopDefault(_sizeJs); -var _visitJs = require("./visit.js"); -var _visitJsDefault = parcelHelpers.interopDefault(_visitJs); -var _visitAfterJs = require("./visitAfter.js"); -var _visitAfterJsDefault = parcelHelpers.interopDefault(_visitAfterJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); -function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? (0, _xJs.defaultX) : x, y == null ? (0, _yJs.defaultY) : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; -} -function leaf_copy(leaf) { - var copy = { - data: leaf.data - }, next = copy; - while(leaf = leaf.next)next = next.next = { - data: leaf.data - }; - return copy; -} -var treeProto = quadtree.prototype = Quadtree.prototype; -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; - if (!node) return copy; - if (!node.length) return copy._root = leaf_copy(node), copy; - nodes = [ - { - source: node, - target: copy._root = new Array(4) - } - ]; - while(node = nodes.pop()){ - for(var i = 0; i < 4; ++i)if (child = node.source[i]) { - if (child.length) nodes.push({ - source: child, - target: node.target[i] = new Array(4) - }); - else node.target[i] = leaf_copy(child); - } - } - return copy; -}; -treeProto.add = (0, _addJsDefault.default); -treeProto.addAll = (0, _addJs.addAll); -treeProto.cover = (0, _coverJsDefault.default); -treeProto.data = (0, _dataJsDefault.default); -treeProto.extent = (0, _extentJsDefault.default); -treeProto.find = (0, _findJsDefault.default); -treeProto.remove = (0, _removeJsDefault.default); -treeProto.removeAll = (0, _removeJs.removeAll); -treeProto.root = (0, _rootJsDefault.default); -treeProto.size = (0, _sizeJsDefault.default); -treeProto.visit = (0, _visitJsDefault.default); -treeProto.visitAfter = (0, _visitAfterJsDefault.default); -treeProto.x = (0, _xJsDefault.default); -treeProto.y = (0, _yJsDefault.default); - -},{"./add.js":"hFdIa","./cover.js":"bvF75","./data.js":"dtNPJ","./extent.js":"5rMqb","./find.js":"lNVWe","./remove.js":"K1L4u","./root.js":"iouwv","./size.js":"kFehL","./visit.js":"77UEv","./visitAfter.js":"210Zv","./x.js":"kTlM7","./y.js":"i1Jyy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hFdIa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - const x = +this._x.call(null, d), y = +this._y.call(null, d); - return add(this.cover(x, y), x, y, d); - }); -parcelHelpers.export(exports, "addAll", ()=>addAll); -function add(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points - var parent, node = tree._root, leaf = { - data: d - }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return tree._root = leaf, tree; - // Find the existing leaf for the new point, or add it. - while(node.length){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - }while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); - return parent[j] = node, parent[i] = leaf, tree; -} -function addAll(data) { - var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity; - // Compute the points and their extent. - for(i = 0; i < n; ++i){ - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; - } - // If there were no (valid) points, abort. - if (x0 > x1 || y0 > y1) return this; - // Expand the tree to cover the new points. - this.cover(x0, y0).cover(x1, y1); - // Add the new points. - for(i = 0; i < n; ++i)add(this, xz[i], yz[i], data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bvF75":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1; - // If the quadtree has no extent, initialize them. - // Integer extent are necessary so that if we later double the extent, - // the existing quadrant boundaries don’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } else { - var z = x1 - x0 || 1, node = this._root, parent, i; - while(x0 > x || x >= x1 || y0 > y || y >= y1){ - i = (y < y0) << 1 | x < x0; - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch(i){ - case 0: - x1 = x0 + z, y1 = y0 + z; - break; - case 1: - x0 = x1 - z, y1 = y0 + z; - break; - case 2: - x1 = x0 + z, y0 = y1 - z; - break; - case 3: - x0 = x1 - z, y0 = y1 - z; - break; - } - } - if (this._root && this._root.length) this._root = node; + return false; + } + function defaultSeparation$1(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function nextLeft(v) { + var children2 = v.children; + return children2 ? children2[0] : v.t; + } + function nextRight(v) { + var children2 = v.children; + return children2 ? children2[children2.length - 1] : v.t; + } + function moveSubtree(wm, wp, shift) { + var change2 = shift / (wp.i - wm.i); + wp.c -= change2; + wp.s += shift; + wm.c += change2; + wp.z += shift; + wp.m += shift; + } + function executeShifts(v) { + var shift = 0, change2 = 0, children2 = v.children, i = children2.length, w2; + while (--i >= 0) { + w2 = children2[i]; + w2.z += shift; + w2.m += shift; + shift += w2.s + (change2 += w2.c); + } + } + function nextAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; + } + function TreeNode(node, i) { + this._ = node; + this.parent = null; + this.children = null; + this.A = null; + this.a = this; + this.z = 0; + this.m = 0; + this.c = 0; + this.s = 0; + this.t = null; + this.i = i; + } + TreeNode.prototype = Object.create(Node$2.prototype); + function treeRoot(root) { + var tree2 = new TreeNode(root, 0), node, nodes = [tree2], child, children2, i, n; + while (node = nodes.pop()) { + if (children2 = node._.children) { + node.children = new Array(n = children2.length); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new TreeNode(children2[i], i)); + child.parent = node; } - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dtNPJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); - while (node = node.next); + } + } + (tree2.parent = new TreeNode(null, 0)).children = [tree2]; + return tree2; + } + function tree$1() { + var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null; + function tree2(root) { + var t = treeRoot(root); + t.eachAfter(firstWalk), t.parent.m = -t.z; + t.eachBefore(secondWalk); + if (nodeSize) root.eachBefore(sizeNode); + else { + var left = root, right = root, bottom = root; + root.eachBefore(function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; }); - return data; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5rMqb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [ - [ - this._x0, - this._y0 - ], - [ - this._x1, - this._y1 - ] - ]; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lNVWe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y, radius) { - var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; - if (node) quads.push(new (0, _quadJsDefault.default)(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - while(q = quads.pop()){ - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue; - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2; - quads.push(new (0, _quadJsDefault.default)(node[3], xm, ym, x2, y2), new (0, _quadJsDefault.default)(node[2], x1, ym, xm, y2), new (0, _quadJsDefault.default)(node[1], xm, y1, x2, ym), new (0, _quadJsDefault.default)(node[0], x1, y1, xm, ym)); - // Visit the closest quadrant first. - if (i = (y >= ym) << 1 | x >= xm) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } else { - var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - return data; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"5cUrX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5cUrX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"K1L4u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return this; - // Find the leaf node for the point. - // While descending, also retain the deepest parent with a non-removed sibling. - if (node.length) while(true){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; - } - // Find the point to remove. - while(node.data !== d)if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - // If there are multiple coincident points, remove just the point. - if (previous) return next ? previous.next = next : delete previous.next, this; - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; - } - return this; - }); -parcelHelpers.export(exports, "removeAll", ()=>removeAll); -function removeAll(data) { - for(var i = 0, n = data.length; i < n; ++i)this.remove(data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iouwv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this._root; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kFehL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; - while (node = node.next); + var s2 = left === right ? 1 : separation(left, right) / 2, tx2 = s2 - left.x, kx = dx / (right.x + s2 + tx2), ky = dy / (bottom.depth || 1); + root.eachBefore(function(node) { + node.x = (node.x + tx2) * kx; + node.y = node.depth * ky; }); - return size; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"77UEv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new (0, _quadJsDefault.default)(node, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop())if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); - } - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"5cUrX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"210Zv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new (0, _quadJsDefault.default)(this._root, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop()){ - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - } - next.push(q); - } - while(q = next.pop())callback(q.node, q.x0, q.y0, q.x1, q.y1); - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"5cUrX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kTlM7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultX", ()=>defaultX); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._x = _, this) : this._x; - }); -function defaultX(d) { - return d[0]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i1Jyy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultY", ()=>defaultY); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._y = _, this) : this._y; - }); -function defaultY(d) { - return d[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2YYtK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"80LBz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(random) { - return (random() - 0.5) * 1e-6; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lHhAG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(links) { - var id = index, strength = defaultStrength, strengths, distance = (0, _constantJsDefault.default)(30), distances, nodes, count, bias, random, iterations = 1; - if (links == null) links = []; - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - function force(alpha) { - for(var k = 0, n = links.length; k < iterations; ++k)for(var i = 0, link, source, target, x, y, l, b; i < n; ++i){ - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || (0, _jiggleJsDefault.default)(random); - y = target.y + target.vy - source.y - source.vy || (0, _jiggleJsDefault.default)(random); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, m = links.length, nodeById = new Map(nodes.map((d, i)=>[ - id(d, i, nodes), - d - ])), link; - for(i = 0, count = new Array(n); i < m; ++i){ - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find(nodeById, link.source); - if (typeof link.target !== "object") link.target = find(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - for(i = 0, bias = new Array(m); i < m; ++i)link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - function initializeStrength() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)strengths[i] = +strength(links[i], i, links); - } - function initializeDistance() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)distances[i] = +distance(links[i], i, links); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeStrength(), force) : strength; - }; - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeDistance(), force) : distance; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function index(d) { - return d.index; -} -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("node not found: " + nodeId); - return node; -} - -},{"./constant.js":"2YYtK","./jiggle.js":"80LBz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0pBR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var nodes, node, random, alpha, strength = (0, _constantJsDefault.default)(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; - function force(_) { - var i, n = nodes.length, tree = (0, _d3Quadtree.quadtree)(nodes, (0, _simulationJs.x), (0, _simulationJs.y)).visitAfter(accumulate); - for(alpha = _, i = 0; i < n; ++i)node = nodes[i], tree.visit(apply); - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for(x = y = i = 0; i < 4; ++i)if ((q = quad[i]) && (c = Math.abs(q.value))) strength += q.value, weight += c, x += c * q.x, y += c * q.y; - quad.x = x / weight; - quad.y = y / weight; - } else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - quad.value = strength; - } - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - var x = quad.x - node.x, y = quad.y - node.y, w = x2 - x1, l = x * x + y * y; - // Apply the Barnes-Hut approximation if possible. - // Limit forces for very close nodes; randomize direction if coincident. - if (w * w / theta2 < l) { - if (l < distanceMax2) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } else if (quad.length || l >= distanceMax2) return; - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } - while (quad = quad.next); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - return force; - }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -var _simulationJs = require("./simulation.js"); - -},{"d3-quadtree":"2k0t6","./constant.js":"2YYtK","./jiggle.js":"80LBz","./simulation.js":"gj5vV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gj5vV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -parcelHelpers.export(exports, "default", ()=>function(nodes) { - var simulation, alpha = 1, alphaMin = 0.001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = (0, _d3Timer.timer)(step), event = (0, _d3Dispatch.dispatch)("tick", "end"), random = (0, _lcgJsDefault.default)(); - if (nodes == null) nodes = []; - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); - } - } - function tick(iterations) { - var i, n = nodes.length, node; - if (iterations === undefined) iterations = 1; - for(var k = 0; k < iterations; ++k){ - alpha += (alphaTarget - alpha) * alphaDecay; - forces.forEach(function(force) { - force(alpha); - }); - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; - } - } - return simulation; - } - function initializeNodes() { - for(var i = 0, n = nodes.length, node; i < n; ++i){ - node = nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) node.vx = node.vy = 0; - } + } + return root; + } + function firstWalk(v) { + var children2 = v.children, siblings = v.parent.children, w2 = v.i ? siblings[v.i - 1] : null; + if (children2) { + executeShifts(v); + var midpoint = (children2[0].z + children2[children2.length - 1].z) / 2; + if (w2) { + v.z = w2.z + separation(v._, w2._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; } - function initializeForce(force) { - if (force.initialize) force.initialize(nodes, random); - return force; + } else if (w2) { + v.z = w2.z + separation(v._, w2._); + } + v.parent.A = apportion(v, w2, v.parent.A || siblings[0]); + } + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + function apportion(v, w2, ancestor) { + if (w2) { + var vip = v, vop = v, vim = w2, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; + while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { + vom = nextLeft(vom); + vop = nextRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + moveSubtree(nextAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !nextRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !nextLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; } - initializeNodes(); - return simulation = { - tick: tick, - restart: function() { - return stepper.restart(step), simulation; - }, - stop: function() { - return stepper.stop(), simulation; - }, - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes; - }, - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - randomSource: function(_) { - return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random; - }, - force: function(name, _) { - return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name); - }, - find: function(x, y, radius) { - var i = 0, n = nodes.length, dx, dy, d2, node, closest; - if (radius == null) radius = Infinity; - else radius *= radius; - for(i = 0; i < n; ++i){ - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - return closest; - }, - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; - }); -var _d3Dispatch = require("d3-dispatch"); -var _d3Timer = require("d3-timer"); -var _lcgJs = require("./lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function x(d) { - return d.x; -} -function y(d) { - return d.y; -} -var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); - -},{"d3-dispatch":"jYyZ6","d3-timer":"832oa","./lcg.js":"jy8z0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jYyZ6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dispatch", ()=>(0, _dispatchJsDefault.default)); -var _dispatchJs = require("./dispatch.js"); -var _dispatchJsDefault = parcelHelpers.interopDefault(_dispatchJs); - -},{"./dispatch.js":"9x2VR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9x2VR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var noop = { - value: ()=>{} -}; -function dispatch() { - for(var i = 0, n = arguments.length, _ = {}, t; i < n; ++i){ - if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); - _[t] = []; + } + return ancestor; } - return new Dispatch(_); -} -function Dispatch(_) { - this._ = _; -} -function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return { - type: t, - name: name - }; - }); -} -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; - // If no callback was specified, return the callback of the given type and name. - if (arguments.length < 2) { - while(++i < n)if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; - return; - } - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while(++i < n){ - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for(t in _)_[t] = set(_[t], typename.name, null); - } - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for(var t in _)copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for(var args = new Array(n), i = 0, n, t; i < n; ++i)args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(var t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - } -}; -function get(type, name) { - for(var i = 0, n = type.length, c; i < n; ++i){ - if ((c = type[i]).name === name) return c.value; - } -} -function set(type, name, callback) { - for(var i = 0, n = type.length; i < n; ++i)if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; + function sizeNode(node) { + node.x *= dx; + node.y = node.depth * dy; } - if (callback != null) type.push({ - name: name, - value: callback - }); - return type; -} -exports.default = dispatch; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"832oa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>(0, _timerJs.now)); -parcelHelpers.export(exports, "timer", ()=>(0, _timerJs.timer)); -parcelHelpers.export(exports, "timerFlush", ()=>(0, _timerJs.timerFlush)); -parcelHelpers.export(exports, "timeout", ()=>(0, _timeoutJsDefault.default)); -parcelHelpers.export(exports, "interval", ()=>(0, _intervalJsDefault.default)); -var _timerJs = require("./timer.js"); -var _timeoutJs = require("./timeout.js"); -var _timeoutJsDefault = parcelHelpers.interopDefault(_timeoutJs); -var _intervalJs = require("./interval.js"); -var _intervalJsDefault = parcelHelpers.interopDefault(_intervalJs); - -},{"./timer.js":"90OuR","./timeout.js":false,"./interval.js":"iKxV8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"90OuR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>now); -parcelHelpers.export(exports, "Timer", ()=>Timer); -parcelHelpers.export(exports, "timer", ()=>timer); -parcelHelpers.export(exports, "timerFlush", ()=>timerFlush); -var frame = 0, timeout = 0, interval = 0, pokeDelay = 1000, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { - setTimeout(f, 17); -}; -function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} -function clearNow() { - clockNow = 0; -} -function Timer() { - this._call = this._time = this._next = null; -} -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); + tree2.separation = function(x2) { + return arguments.length ? (separation = x2, tree2) : separation; + }; + tree2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? null : [dx, dy]; + }; + tree2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? [dx, dy] : null; + }; + return tree2; + } + function treemapSlice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y12 - y02) / parent.value; + while (++i < n) { + node = nodes[i], node.x0 = x02, node.x1 = x12; + node.y0 = y02, node.y1 = y02 += node.value * k; + } + } + var phi = (1 + Math.sqrt(5)) / 2; + function squarifyRatio(ratio, parent, x02, y02, x12, y12) { + var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value2 = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; + while (i0 < n) { + dx = x12 - x02, dy = y12 - y02; + do + sumValue = nodes[i1++].value; + while (!sumValue && i1 < n); + minValue = maxValue = sumValue; + alpha = Math.max(dy / dx, dx / dy) / (value2 * ratio); + beta = sumValue * sumValue * alpha; + minRatio = Math.max(maxValue / beta, beta / minValue); + for (; i1 < n; ++i1) { + sumValue += nodeValue = nodes[i1].value; + if (nodeValue < minValue) minValue = nodeValue; + if (nodeValue > maxValue) maxValue = nodeValue; + beta = sumValue * sumValue * alpha; + newRatio = Math.max(maxValue / beta, beta / minValue); + if (newRatio > minRatio) { + sumValue -= nodeValue; + break; } + minRatio = newRatio; + } + rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) }); + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += dy * sumValue / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += dx * sumValue / value2 : x12, y12); + value2 -= sumValue, i0 = i1; } -}; -function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; -} -function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while(t){ - if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e); - t = t._next; + return rows; + } + const treemapSquarify = (function custom2(ratio) { + function squarify(parent, x02, y02, x12, y12) { + squarifyRatio(ratio, parent, x02, y02, x12, y12); } - --frame; -} -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally{ - frame = 0; - nap(); - clockNow = 0; - } -} -function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; -} -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while(t1)if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - taskTail = t0; - sleep(time); -} -function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iKxV8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, delay, time) { - var t = new (0, _timerJs.Timer), total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - t._restart = t.restart; - t.restart = function(callback, delay, time) { - delay = +delay, time = time == null ? (0, _timerJs.now)() : +time; - t._restart(function tick(elapsed) { - elapsed += total; - t._restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - }; - t.restart(callback, delay, time); - return t; - }); -var _timerJs = require("./timer.js"); - -},{"./timer.js":"90OuR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jy8z0":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gU1Aq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, xz; - if (typeof x !== "function") x = (0, _constantJsDefault.default)(x == null ? 0 : +x); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : x; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"2YYtK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ldvAB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(y) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, yz; - if (typeof y !== "function") y = (0, _constantJsDefault.default)(y == null ? 0 : +y); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : y; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"2YYtK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Esn8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "nest", ()=>Nest); -parcelHelpers.export(exports, "pack", ()=>Pack); -parcelHelpers.export(exports, "partition", ()=>Partition); -parcelHelpers.export(exports, "stratify", ()=>Stratify); -parcelHelpers.export(exports, "tree", ()=>Tree); -parcelHelpers.export(exports, "treelinks", ()=>TreeLinks); -parcelHelpers.export(exports, "treemap", ()=>Treemap); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Hierarchy = require("d3-hierarchy"); -// Build lookup table mapping tuple keys to tree node instances -function lookup(tree, key, filter) { - const map = {}; - tree.each((node)=>{ - const t = node.data; - if (filter(t)) map[key(t)] = node; + squarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return squarify; + })(phi); + function treemap() { + var tile = treemapSquarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero; + function treemap2(root) { + root.x0 = root.y0 = 0; + root.x1 = dx; + root.y1 = dy; + root.eachBefore(positionNode); + paddingStack = [0]; + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(node) { + var p = paddingStack[node.depth], x02 = node.x0 + p, y02 = node.y0 + p, x12 = node.x1 - p, y12 = node.y1 - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + if (node.children) { + p = paddingStack[node.depth + 1] = paddingInner(node) / 2; + x02 += paddingLeft(node) - p; + y02 += paddingTop(node) - p; + x12 -= paddingRight(node) - p; + y12 -= paddingBottom(node) - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + tile(node, x02, y02, x12, y12); + } + } + treemap2.round = function(x2) { + return arguments.length ? (round = !!x2, treemap2) : round; + }; + treemap2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], treemap2) : [dx, dy]; + }; + treemap2.tile = function(x2) { + return arguments.length ? (tile = required(x2), treemap2) : tile; + }; + treemap2.padding = function(x2) { + return arguments.length ? treemap2.paddingInner(x2).paddingOuter(x2) : treemap2.paddingInner(); + }; + treemap2.paddingInner = function(x2) { + return arguments.length ? (paddingInner = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingInner; + }; + treemap2.paddingOuter = function(x2) { + return arguments.length ? treemap2.paddingTop(x2).paddingRight(x2).paddingBottom(x2).paddingLeft(x2) : treemap2.paddingTop(); + }; + treemap2.paddingTop = function(x2) { + return arguments.length ? (paddingTop = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingTop; + }; + treemap2.paddingRight = function(x2) { + return arguments.length ? (paddingRight = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingRight; + }; + treemap2.paddingBottom = function(x2) { + return arguments.length ? (paddingBottom = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingBottom; + }; + treemap2.paddingLeft = function(x2) { + return arguments.length ? (paddingLeft = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingLeft; + }; + return treemap2; + } + function treemapBinary(parent, x02, y02, x12, y12) { + var nodes = parent.children, i, n = nodes.length, sum2, sums = new Array(n + 1); + for (sums[0] = sum2 = i = 0; i < n; ++i) { + sums[i + 1] = sum2 += nodes[i].value; + } + partition2(0, n, parent.value, x02, y02, x12, y12); + function partition2(i2, j, value2, x03, y03, x13, y13) { + if (i2 >= j - 1) { + var node = nodes[i2]; + node.x0 = x03, node.y0 = y03; + node.x1 = x13, node.y1 = y13; + return; + } + var valueOffset = sums[i2], valueTarget = value2 / 2 + valueOffset, k = i2 + 1, hi = j - 1; + while (k < hi) { + var mid = k + hi >>> 1; + if (sums[mid] < valueTarget) k = mid + 1; + else hi = mid; + } + if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i2 + 1 < k) --k; + var valueLeft = sums[k] - valueOffset, valueRight = value2 - valueLeft; + if (x13 - x03 > y13 - y03) { + var xk = value2 ? (x03 * valueRight + x13 * valueLeft) / value2 : x13; + partition2(i2, k, valueLeft, x03, y03, xk, y13); + partition2(k, j, valueRight, xk, y03, x13, y13); + } else { + var yk = value2 ? (y03 * valueRight + y13 * valueLeft) / value2 : y13; + partition2(i2, k, valueLeft, x03, y03, x13, yk); + partition2(k, j, valueRight, x03, yk, x13, y13); + } + } + } + function treemapSliceDice(parent, x02, y02, x12, y12) { + (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x02, y02, x12, y12); + } + const treemapResquarify = (function custom2(ratio) { + function resquarify(parent, x02, y02, x12, y12) { + if ((rows = parent._squarify) && rows.ratio === ratio) { + var rows, row, nodes, i, j = -1, n, m2 = rows.length, value2 = parent.value; + while (++j < m2) { + row = rows[j], nodes = row.children; + for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += (y12 - y02) * row.value / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += (x12 - x02) * row.value / value2 : x12, y12); + value2 -= row.value; + } + } else { + parent._squarify = rows = squarifyRatio(ratio, parent, x02, y02, x12, y12); + rows.ratio = ratio; + } + } + resquarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return resquarify; + })(phi); + function lookup$2(tree2, key2, filter2) { + const map2 = {}; + tree2.each((node) => { + const t = node.data; + if (filter2(t)) map2[key2(t)] = node; }); - tree.lookup = map; - return tree; -} -/** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ function Nest(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Nest.Definition = { - 'type': 'Nest', - 'metadata': { - 'treesource': true, - 'changes': true - }, - 'params': [ - { - 'name': 'keys', - 'type': 'field', - 'array': true - }, - { - 'name': 'generate', - 'type': 'boolean' - } - ] -}; -const children = (n)=>n.values; -(0, _vegaUtil.inherits)(Nest, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Nest transform requires an upstream data source.'); - var gen = _.generate, mod = _.modified(), out = pulse.clone(), tree = this.value; - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) tree.each((node)=>{ - if (node.children && (0, _vegaDataflow.isTuple)(node.data)) out.rem.push(node.data); - }); - // generate new tree structure - this.value = tree = (0, _d3Hierarchy.hierarchy)({ - values: (0, _vegaUtil.array)(_.keys).reduce((n, k)=>{ - n.key(k); - return n; - }, nest()).entries(out.source) - }, children); - // collect nodes to add - if (gen) tree.each((node)=>{ - if (node.children) { - node = (0, _vegaDataflow.ingest)(node.data); - out.add.push(node); - out.source.push(node); - } - }); - // build lookup table - lookup(tree, (0, _vegaDataflow.tupleid), (0, _vegaDataflow.tupleid)); + tree2.lookup = map2; + return tree2; + } + function Nest(params2) { + Transform.call(this, null, params2); + } + Nest.Definition = { + "type": "Nest", + "metadata": { + "treesource": true, + "changes": true + }, + "params": [{ + "name": "keys", + "type": "field", + "array": true + }, { + "name": "generate", + "type": "boolean" + }] + }; + const children$1 = (n) => n.values; + inherits(Nest, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Nest transform requires an upstream data source."); + } + var gen = _.generate, mod = _.modified(), out = pulse2.clone(), tree2 = this.value; + if (!tree2 || mod || pulse2.changed()) { + if (tree2) { + tree2.each((node) => { + if (node.children && isTuple(node.data)) { + out.rem.push(node.data); + } + }); + } + this.value = tree2 = hierarchy({ + values: array$4(_.keys).reduce((n, k) => { + n.key(k); + return n; + }, nest()).entries(out.source) + }, children$1); + if (gen) { + tree2.each((node) => { + if (node.children) { + node = ingest$1(node.data); + out.add.push(node); + out.source.push(node); + } + }); } - out.source.root = tree; - return out; + lookup$2(tree2, tupleid, tupleid); + } + out.source.root = tree2; + return out; } -}); -function nest() { - const keys = [], nest = { - entries: (array)=>entries(apply(array, 0), 0), - key: (d)=>(keys.push(d), nest) - }; - function apply(array, depth) { - if (depth >= keys.length) return array; - const n = array.length, key = keys[depth++], valuesByKey = {}, result = {}; - let i = -1, keyValue, value, values; - while(++i < n){ - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) values.push(value); - else valuesByKey[keyValue] = [ - value - ]; + }); + function nest() { + const keys2 = [], nest2 = { + entries: (array2) => entries(apply2(array2, 0), 0), + key: (d2) => (keys2.push(d2), nest2) + }; + function apply2(array2, depth) { + if (depth >= keys2.length) { + return array2; + } + const n = array2.length, key2 = keys2[depth++], valuesByKey = {}, result = {}; + let i = -1, keyValue, value2, values2; + while (++i < n) { + keyValue = key2(value2 = array2[i]) + ""; + if (values2 = valuesByKey[keyValue]) { + values2.push(value2); + } else { + valuesByKey[keyValue] = [value2]; } - for(keyValue in valuesByKey)result[keyValue] = apply(valuesByKey[keyValue], depth); - return result; - } - function entries(map, depth) { - if (++depth > keys.length) return map; - const array = []; - for(const key in map)array.push({ - key, - values: entries(map[key], depth) + } + for (keyValue in valuesByKey) { + result[keyValue] = apply2(valuesByKey[keyValue], depth); + } + return result; + } + function entries(map2, depth) { + if (++depth > keys2.length) return map2; + const array2 = []; + for (const key2 in map2) { + array2.push({ + key: key2, + values: entries(map2[key2], depth) }); - return array; - } - return nest; -} -/** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function HierarchyLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const defaultSeparation = (a, b)=>a.parent === b.parent ? 1 : 2; -(0, _vegaUtil.inherits)(HierarchyLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source || !pulse.source.root) (0, _vegaUtil.error)(this.constructor.name + ' transform requires a backing tree data source.'); - const layout = this.layout(_.method), fields = this.fields, root = pulse.source.root, as = _.as || fields; - if (_.field) root.sum(_.field); - else root.count(); - if (_.sort) root.sort((0, _vegaDataflow.stableCompare)(_.sort, (d)=>d.data)); - setParams(layout, this.params, _); - if (layout.separation) layout.separation(_.separation !== false ? defaultSeparation : (0, _vegaUtil.one)); - try { - this.value = layout(root); - } catch (err) { - (0, _vegaUtil.error)(err); - } - root.each((node)=>setFields(node, fields, as)); - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); + } + return array2; + } + return nest2; + } + function HierarchyLayout(params2) { + Transform.call(this, null, params2); + } + const defaultSeparation = (a2, b2) => a2.parent === b2.parent ? 1 : 2; + inherits(HierarchyLayout, Transform, { + transform(_, pulse2) { + if (!pulse2.source || !pulse2.source.root) { + error(this.constructor.name + " transform requires a backing tree data source."); + } + const layout = this.layout(_.method), fields = this.fields, root = pulse2.source.root, as = _.as || fields; + if (_.field) root.sum(_.field); + else root.count(); + if (_.sort) root.sort(stableCompare(_.sort, (d2) => d2.data)); + setParams(layout, this.params, _); + if (layout.separation) { + layout.separation(_.separation !== false ? defaultSeparation : one$1); + } + try { + this.value = layout(root); + } catch (err) { + error(err); + } + root.each((node) => setFields(node, fields, as)); + return pulse2.reflow(_.modified()).modifies(as).modifies("leaf"); } -}); -function setParams(layout, params, _) { - for(let p, i = 0, n = params.length; i < n; ++i){ - p = params[i]; - if (p in _) layout[p](_[p]); + }); + function setParams(layout, params2, _) { + for (let p, i = 0, n = params2.length; i < n; ++i) { + p = params2[i]; + if (p in _) layout[p](_[p]); } -} -function setFields(node, fields, as) { + } + function setFields(node, fields, as) { const t = node.data, n = fields.length - 1; - for(let i = 0; i < n; ++i)t[as[i]] = node[fields[i]]; + for (let i = 0; i < n; ++i) { + t[as[i]] = node[fields[i]]; + } t[as[n]] = node.children ? node.children.length : 0; -} -const Output$3 = [ - 'x', - 'y', - 'r', - 'depth', - 'children' -]; -/** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Pack(params) { - HierarchyLayout.call(this, params); -} -Pack.Definition = { - 'type': 'Pack', - 'metadata': { - 'tree': true, - 'modifies': true + } + const Output$3 = ["x", "y", "r", "depth", "children"]; + function Pack(params2) { + HierarchyLayout.call(this, params2); + } + Pack.Definition = { + "type": "Pack", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'radius', - 'type': 'field', - 'default': null - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$3.length, - 'default': Output$3 - } - ] -}; -(0, _vegaUtil.inherits)(Pack, HierarchyLayout, { - layout: (0, _d3Hierarchy.pack), - params: [ - 'radius', - 'size', - 'padding' - ], + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "radius", + "type": "field", + "default": null + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$3.length, + "default": Output$3 + }] + }; + inherits(Pack, HierarchyLayout, { + layout: pack, + params: ["radius", "size", "padding"], fields: Output$3 -}); -const Output$2 = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Partition(params) { - HierarchyLayout.call(this, params); -} -Partition.Definition = { - 'type': 'Partition', - 'metadata': { - 'tree': true, - 'modifies': true + }); + const Output$2 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Partition(params2) { + HierarchyLayout.call(this, params2); + } + Partition.Definition = { + "type": "Partition", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$2.length, - 'default': Output$2 - } - ] -}; -(0, _vegaUtil.inherits)(Partition, HierarchyLayout, { - layout: (0, _d3Hierarchy.partition), - params: [ - 'size', - 'round', - 'padding' - ], + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$2.length, + "default": Output$2 + }] + }; + inherits(Partition, HierarchyLayout, { + layout: partition$1, + params: ["size", "round", "padding"], fields: Output$2 -}); -/** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ function Stratify(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stratify.Definition = { - 'type': 'Stratify', - 'metadata': { - 'treesource': true + }); + function Stratify(params2) { + Transform.call(this, null, params2); + } + Stratify.Definition = { + "type": "Stratify", + "metadata": { + "treesource": true }, - 'params': [ - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'parentKey', - 'type': 'field', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Stratify, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Stratify transform requires an upstream data source.'); - let tree = this.value; - const mod = _.modified(), out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), run = !tree || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); - // prevent upstream source pollution - out.source = out.source.slice(); - if (run) tree = out.source.length ? lookup((0, _d3Hierarchy.stratify)().id(_.key).parentId(_.parentKey)(out.source), _.key, (0, _vegaUtil.truthy)) : lookup((0, _d3Hierarchy.stratify)()([ - {} - ]), _.key, _.key); - out.source.root = this.value = tree; - return out; + "params": [{ + "name": "key", + "type": "field", + "required": true + }, { + "name": "parentKey", + "type": "field", + "required": true + }] + }; + inherits(Stratify, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Stratify transform requires an upstream data source."); + } + let tree2 = this.value; + const mod = _.modified(), out = pulse2.fork(pulse2.ALL).materialize(pulse2.SOURCE), run2 = !tree2 || mod || pulse2.changed(pulse2.ADD_REM) || pulse2.modified(_.key.fields) || pulse2.modified(_.parentKey.fields); + out.source = out.source.slice(); + if (run2) { + tree2 = out.source.length ? lookup$2(stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy) : lookup$2(stratify()([{}]), _.key, _.key); + } + out.source.root = this.value = tree2; + return out; } -}); -const Layouts = { - tidy: (0, _d3Hierarchy.tree), - cluster: (0, _d3Hierarchy.cluster) -}; -const Output$1 = [ - 'x', - 'y', - 'depth', - 'children' -]; -/** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Tree(params) { - HierarchyLayout.call(this, params); -} -Tree.Definition = { - 'type': 'Tree', - 'metadata': { - 'tree': true, - 'modifies': true + }); + const Layouts = { + tidy: tree$1, + cluster + }; + const Output$1$1 = ["x", "y", "depth", "children"]; + function Tree(params2) { + HierarchyLayout.call(this, params2); + } + Tree.Definition = { + "type": "Tree", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'tidy', - 'values': [ - 'tidy', - 'cluster' - ] - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'nodeSize', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'separation', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$1.length, - 'default': Output$1 - } - ] -}; -(0, _vegaUtil.inherits)(Tree, HierarchyLayout, { + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "tidy", + "values": ["tidy", "cluster"] + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "nodeSize", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "separation", + "type": "boolean", + "default": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$1$1.length, + "default": Output$1$1 + }] + }; + inherits(Tree, HierarchyLayout, { /** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ layout (method) { - const m = method || 'tidy'; - if ((0, _vegaUtil.hasOwnProperty)(Layouts, m)) return Layouts[m](); - else (0, _vegaUtil.error)('Unrecognized Tree layout method: ' + m); + * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. + */ + layout(method2) { + const m2 = method2 || "tidy"; + if (has$1(Layouts, m2)) return Layouts[m2](); + else error("Unrecognized Tree layout method: " + m2); }, - params: [ - 'size', - 'nodeSize' - ], - fields: Output$1 -}); -/** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ function TreeLinks(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': { - 'tree': true, - 'generates': true, - 'changes': true + params: ["size", "nodeSize"], + fields: Output$1$1 + }); + function TreeLinks(params2) { + Transform.call(this, [], params2); + } + TreeLinks.Definition = { + "type": "TreeLinks", + "metadata": { + "tree": true, + "generates": true, + "changes": true }, - 'params': [] -}; -(0, _vegaUtil.inherits)(TreeLinks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const links = this.value, tree = pulse.source && pulse.source.root, out = pulse.fork(pulse.NO_SOURCE), lut = {}; - if (!tree) (0, _vegaUtil.error)('TreeLinks transform requires a tree data source.'); - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; - // build lookup table of valid tuples - pulse.visit(pulse.SOURCE, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // generate links for all edges incident on valid tuples - tree.each((node)=>{ - const t = node.data, p = node.parent && node.parent.data; - if (p && lut[(0, _vegaDataflow.tupleid)(t)] && lut[(0, _vegaDataflow.tupleid)(p)]) out.add.push((0, _vegaDataflow.ingest)({ - source: p, - target: t - })); - }); - this.value = out.add; - } else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // gather links incident on modified tuples - links.forEach((link)=>{ - if (lut[(0, _vegaDataflow.tupleid)(link.source)] || lut[(0, _vegaDataflow.tupleid)(link.target)]) out.mod.push(link); - }); - } - return out; + "params": [] + }; + inherits(TreeLinks, Transform, { + transform(_, pulse2) { + const links = this.value, tree2 = pulse2.source && pulse2.source.root, out = pulse2.fork(pulse2.NO_SOURCE), lut = {}; + if (!tree2) error("TreeLinks transform requires a tree data source."); + if (pulse2.changed(pulse2.ADD_REM)) { + out.rem = links; + pulse2.visit(pulse2.SOURCE, (t) => lut[tupleid(t)] = 1); + tree2.each((node) => { + const t = node.data, p = node.parent && node.parent.data; + if (p && lut[tupleid(t)] && lut[tupleid(p)]) { + out.add.push(ingest$1({ + source: p, + target: t + })); + } + }); + this.value = out.add; + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => lut[tupleid(t)] = 1); + links.forEach((link2) => { + if (lut[tupleid(link2.source)] || lut[tupleid(link2.target)]) { + out.mod.push(link2); + } + }); + } + return out; } -}); -const Tiles = { - binary: (0, _d3Hierarchy.treemapBinary), - dice: (0, _d3Hierarchy.treemapDice), - slice: (0, _d3Hierarchy.treemapSlice), - slicedice: (0, _d3Hierarchy.treemapSliceDice), - squarify: (0, _d3Hierarchy.treemapSquarify), - resquarify: (0, _d3Hierarchy.treemapResquarify) -}; -const Output = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Treemap(params) { - HierarchyLayout.call(this, params); -} -Treemap.Definition = { - 'type': 'Treemap', - 'metadata': { - 'tree': true, - 'modifies': true + }); + const Tiles = { + binary: treemapBinary, + dice: treemapDice, + slice: treemapSlice, + slicedice: treemapSliceDice, + squarify: treemapSquarify, + resquarify: treemapResquarify + }; + const Output$4 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Treemap(params2) { + HierarchyLayout.call(this, params2); + } + Treemap.Definition = { + "type": "Treemap", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'squarify', - 'values': [ - 'squarify', - 'resquarify', - 'binary', - 'dice', - 'slice', - 'slicedice' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingInner', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingOuter', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingTop', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingRight', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingBottom', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingLeft', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'ratio', - 'type': 'number', - 'default': 1.618033988749895 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output.length, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Treemap, HierarchyLayout, { + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "squarify", + "values": ["squarify", "resquarify", "binary", "dice", "slice", "slicedice"] + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "paddingInner", + "type": "number", + "default": 0 + }, { + "name": "paddingOuter", + "type": "number", + "default": 0 + }, { + "name": "paddingTop", + "type": "number", + "default": 0 + }, { + "name": "paddingRight", + "type": "number", + "default": 0 + }, { + "name": "paddingBottom", + "type": "number", + "default": 0 + }, { + "name": "paddingLeft", + "type": "number", + "default": 0 + }, { + "name": "ratio", + "type": "number", + "default": 1.618033988749895 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$4.length, + "default": Output$4 + }] + }; + inherits(Treemap, HierarchyLayout, { /** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ layout () { - const x = (0, _d3Hierarchy.treemap)(); - x.ratio = (_)=>{ - const t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - x.method = (_)=>{ - if ((0, _vegaUtil.hasOwnProperty)(Tiles, _)) x.tile(Tiles[_]); - else (0, _vegaUtil.error)('Unrecognized Treemap layout method: ' + _); - }; - return x; + * Treemap layout generator. Adds 'method' and 'ratio' parameters + * to configure the underlying tile method. + */ + layout() { + const x2 = treemap(); + x2.ratio = (_) => { + const t = x2.tile(); + if (t.ratio) x2.tile(t.ratio(_)); + }; + x2.method = (_) => { + if (has$1(Tiles, _)) x2.tile(Tiles[_]); + else error("Unrecognized Treemap layout method: " + _); + }; + return x2; }, - params: [ - 'method', - 'ratio', - 'size', - 'round', - 'padding', - 'paddingInner', - 'paddingOuter', - 'paddingTop', - 'paddingRight', - 'paddingBottom', - 'paddingLeft' - ], - fields: Output -}); - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-hierarchy":"1ebQr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1ebQr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cluster", ()=>(0, _clusterJsDefault.default)); -parcelHelpers.export(exports, "hierarchy", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "Node", ()=>(0, _indexJs.Node)); -parcelHelpers.export(exports, "pack", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "packSiblings", ()=>(0, _siblingsJsDefault.default)); -parcelHelpers.export(exports, "packEnclose", ()=>(0, _encloseJsDefault.default)); -parcelHelpers.export(exports, "partition", ()=>(0, _partitionJsDefault.default)); -parcelHelpers.export(exports, "stratify", ()=>(0, _stratifyJsDefault.default)); -parcelHelpers.export(exports, "tree", ()=>(0, _treeJsDefault.default)); -parcelHelpers.export(exports, "treemap", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "treemapBinary", ()=>(0, _binaryJsDefault.default)); -parcelHelpers.export(exports, "treemapDice", ()=>(0, _diceJsDefault.default)); -parcelHelpers.export(exports, "treemapSlice", ()=>(0, _sliceJsDefault.default)); -parcelHelpers.export(exports, "treemapSliceDice", ()=>(0, _sliceDiceJsDefault.default)); -parcelHelpers.export(exports, "treemapSquarify", ()=>(0, _squarifyJsDefault.default)); -parcelHelpers.export(exports, "treemapResquarify", ()=>(0, _resquarifyJsDefault.default)); -var _clusterJs = require("./cluster.js"); -var _clusterJsDefault = parcelHelpers.interopDefault(_clusterJs); -var _indexJs = require("./hierarchy/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _indexJs1 = require("./pack/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _siblingsJs = require("./pack/siblings.js"); -var _siblingsJsDefault = parcelHelpers.interopDefault(_siblingsJs); -var _encloseJs = require("./pack/enclose.js"); -var _encloseJsDefault = parcelHelpers.interopDefault(_encloseJs); -var _partitionJs = require("./partition.js"); -var _partitionJsDefault = parcelHelpers.interopDefault(_partitionJs); -var _stratifyJs = require("./stratify.js"); -var _stratifyJsDefault = parcelHelpers.interopDefault(_stratifyJs); -var _treeJs = require("./tree.js"); -var _treeJsDefault = parcelHelpers.interopDefault(_treeJs); -var _indexJs2 = require("./treemap/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _binaryJs = require("./treemap/binary.js"); -var _binaryJsDefault = parcelHelpers.interopDefault(_binaryJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./treemap/slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _sliceDiceJs = require("./treemap/sliceDice.js"); -var _sliceDiceJsDefault = parcelHelpers.interopDefault(_sliceDiceJs); -var _squarifyJs = require("./treemap/squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _resquarifyJs = require("./treemap/resquarify.js"); -var _resquarifyJsDefault = parcelHelpers.interopDefault(_resquarifyJs); - -},{"./cluster.js":"iBepz","./hierarchy/index.js":"aKFc0","./pack/index.js":"lUJH5","./pack/siblings.js":false,"./pack/enclose.js":false,"./partition.js":"2uWl8","./stratify.js":"81qCy","./tree.js":"i82wc","./treemap/index.js":"gn3Lw","./treemap/binary.js":"lIsJs","./treemap/dice.js":"5Coec","./treemap/slice.js":"bB6OY","./treemap/sliceDice.js":"lS2RY","./treemap/squarify.js":"6L9bi","./treemap/resquarify.js":"3C5OD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iBepz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false; - function cluster(root) { - var previousNode, x = 0; - // First walk, computing the initial x & y values. - root.eachAfter(function(node) { - var children = node.children; - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - var left = leafLeft(root), right = leafRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; - // Second walk, normalizing x & y to the desired size. - return root.eachAfter(nodeSize ? function(node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); + params: ["method", "ratio", "size", "round", "padding", "paddingInner", "paddingOuter", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"], + fields: Output$4 + }); + const tree = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + nest: Nest, + pack: Pack, + partition: Partition, + stratify: Stratify, + tree: Tree, + treelinks: TreeLinks, + treemap: Treemap + }, Symbol.toStringTag, { value: "Module" })); + const ALPHA_MASK = 4278190080; + function baseBitmaps($2, data2) { + const bitmap = $2.bitmap(); + (data2 || []).forEach((d2) => bitmap.set($2(d2.boundary[0]), $2(d2.boundary[3]))); + return [bitmap, void 0]; + } + function markBitmaps($2, baseMark, avoidMarks, labelInside, isGroupArea) { + const width2 = $2.width, height2 = $2.height, border = labelInside || isGroupArea, context2 = domCanvas(width2, height2).getContext("2d"), baseMarkContext = domCanvas(width2, height2).getContext("2d"), strokeContext = border && domCanvas(width2, height2).getContext("2d"); + avoidMarks.forEach((items) => draw(context2, items, false)); + draw(baseMarkContext, baseMark, false); + if (border) { + draw(strokeContext, baseMark, true); + } + const buffer = getBuffer(context2, width2, height2), baseMarkBuffer = getBuffer(baseMarkContext, width2, height2), strokeBuffer = border && getBuffer(strokeContext, width2, height2), layer1 = $2.bitmap(), layer2 = border && $2.bitmap(); + let x2, y2, u2, v, index2, alpha, strokeAlpha, baseMarkAlpha; + for (y2 = 0; y2 < height2; ++y2) { + for (x2 = 0; x2 < width2; ++x2) { + index2 = y2 * width2 + x2; + alpha = buffer[index2] & ALPHA_MASK; + baseMarkAlpha = baseMarkBuffer[index2] & ALPHA_MASK; + strokeAlpha = border && strokeBuffer[index2] & ALPHA_MASK; + if (alpha || strokeAlpha || baseMarkAlpha) { + u2 = $2(x2); + v = $2(y2); + if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u2, v); + if (border && (alpha || strokeAlpha)) layer2.set(u2, v); } - cluster.separation = function(x) { - return arguments.length ? (separation = x, cluster) : separation; - }; - cluster.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : nodeSize ? null : [ - dx, - dy - ]; - }; - cluster.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : nodeSize ? [ - dx, - dy - ] : null; - }; - return cluster; - }); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -function meanX(children) { - return children.reduce(meanXReduce, 0) / children.length; -} -function meanXReduce(x, c) { - return x + c.x; -} -function maxY(children) { - return 1 + children.reduce(maxYReduce, 0); -} -function maxYReduce(y, c) { - return Math.max(y, c.y); -} -function leafLeft(node) { - var children; - while(children = node.children)node = children[0]; - return node; -} -function leafRight(node) { - var children; - while(children = node.children)node = children[children.length - 1]; - return node; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aKFc0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>hierarchy); -parcelHelpers.export(exports, "computeHeight", ()=>computeHeight); -parcelHelpers.export(exports, "Node", ()=>Node); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _eachJs = require("./each.js"); -var _eachJsDefault = parcelHelpers.interopDefault(_eachJs); -var _eachBeforeJs = require("./eachBefore.js"); -var _eachBeforeJsDefault = parcelHelpers.interopDefault(_eachBeforeJs); -var _eachAfterJs = require("./eachAfter.js"); -var _eachAfterJsDefault = parcelHelpers.interopDefault(_eachAfterJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _ancestorsJs = require("./ancestors.js"); -var _ancestorsJsDefault = parcelHelpers.interopDefault(_ancestorsJs); -var _descendantsJs = require("./descendants.js"); -var _descendantsJsDefault = parcelHelpers.interopDefault(_descendantsJs); -var _leavesJs = require("./leaves.js"); -var _leavesJsDefault = parcelHelpers.interopDefault(_leavesJs); -var _linksJs = require("./links.js"); -var _linksJsDefault = parcelHelpers.interopDefault(_linksJs); -var _iteratorJs = require("./iterator.js"); -var _iteratorJsDefault = parcelHelpers.interopDefault(_iteratorJs); -function hierarchy(data, children) { - if (data instanceof Map) { - data = [ - undefined, - data - ]; - if (children === undefined) children = mapChildren; - } else if (children === undefined) children = objectChildren; - var root = new Node(data), node, nodes = [ - root - ], child, childs, i, n; - while(node = nodes.pop())if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) { - node.children = childs; - for(i = n - 1; i >= 0; --i){ - nodes.push(child = childs[i] = new Node(childs[i])); - child.parent = node; - child.depth = node.depth + 1; + } + } + return [layer1, layer2]; + } + function getBuffer(context2, width2, height2) { + return new Uint32Array(context2.getImageData(0, 0, width2, height2).data.buffer); + } + function draw(context2, items, interior) { + if (!items.length) return; + const type2 = items[0].mark.marktype; + if (type2 === "group") { + items.forEach((group2) => { + group2.items.forEach((mark) => draw(context2, mark.items, interior)); + }); + } else { + Marks[type2].draw(context2, { + items: interior ? items.map(prepare) : items + }); + } + } + function prepare(source2) { + const item = rederive(source2, {}); + if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) { + return { + ...item, + strokeOpacity: 1, + stroke: "#000", + fillOpacity: 0 + }; + } + return item; + } + const DIV = 5, MOD = 31, SIZE = 32, RIGHT0 = new Uint32Array(SIZE + 1), RIGHT1 = new Uint32Array(SIZE + 1); + RIGHT1[0] = 0; + RIGHT0[0] = ~RIGHT1[0]; + for (let i = 1; i <= SIZE; ++i) { + RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; + RIGHT0[i] = ~RIGHT1[i]; + } + function Bitmap(w2, h2) { + const array2 = new Uint32Array(~~((w2 * h2 + SIZE) / SIZE)); + function _set(index2, mask) { + array2[index2] |= mask; + } + function _clear(index2, mask) { + array2[index2] &= mask; + } + return { + array: array2, + get: (x2, y2) => { + const index2 = y2 * w2 + x2; + return array2[index2 >>> DIV] & 1 << (index2 & MOD); + }, + set: (x2, y2) => { + const index2 = y2 * w2 + x2; + _set(index2 >>> DIV, 1 << (index2 & MOD)); + }, + clear: (x2, y2) => { + const index2 = y2 * w2 + x2; + _clear(index2 >>> DIV, ~(1 << (index2 & MOD))); + }, + getRange: (x2, y2, x22, y22) => { + let r = y22, start, end, indexStart, indexEnd; + for (; r >= y2; --r) { + start = r * w2 + x2; + end = r * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + if (array2[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) { + return true; + } + } else { + if (array2[indexStart] & RIGHT0[start & MOD]) return true; + if (array2[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; + for (let i = indexStart + 1; i < indexEnd; ++i) { + if (array2[i]) return true; + } + } + } + return false; + }, + setRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); + } else { + _set(indexStart, RIGHT0[start & MOD]); + _set(indexEnd, RIGHT1[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 4294967295); + } + } + }, + clearRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); + } else { + _clear(indexStart, RIGHT1[start & MOD]); + _clear(indexEnd, RIGHT0[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0); + } + } + }, + outOfBounds: (x2, y2, x22, y22) => x2 < 0 || y2 < 0 || y22 >= h2 || x22 >= w2 + }; + } + function scaler(width2, height2, padding2) { + const ratio = Math.max(1, Math.sqrt(width2 * height2 / 1e6)), w2 = ~~((width2 + 2 * padding2 + ratio) / ratio), h2 = ~~((height2 + 2 * padding2 + ratio) / ratio), scale2 = (_) => ~~((_ + padding2) / ratio); + scale2.invert = (_) => _ * ratio - padding2; + scale2.bitmap = () => Bitmap(w2, h2); + scale2.ratio = ratio; + scale2.padding = padding2; + scale2.width = width2; + scale2.height = height2; + return scale2; + } + function placeAreaLabelNaive($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height; + return function(d2) { + const items = d2.datum.datum.items[markIndex].items, n = items.length, textHeight = d2.datum.fontSize, textWidth = textMetrics.width(d2.datum, d2.datum.text); + let maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + areaWidth = Math.abs(x2 - x12 + y2 - y12); + if (areaWidth >= maxAreaWidth) { + maxAreaWidth = areaWidth; + d2.x = x3; + d2.y = y3; + } + } + x3 = textWidth / 2; + y3 = textHeight / 2; + x12 = d2.x - x3; + x2 = d2.x + x3; + y12 = d2.y - y3; + y2 = d2.y + y3; + d2.align = "center"; + if (x12 < 0 && x2 <= width2) { + d2.align = "left"; + } else if (0 <= x12 && width2 < x2) { + d2.align = "right"; + } + d2.baseline = "middle"; + if (y12 < 0 && y2 <= height2) { + d2.baseline = "top"; + } else if (0 <= y12 && height2 < y2) { + d2.baseline = "bottom"; + } + return true; + }; + } + function outOfBounds(x2, y2, textWidth, textHeight, width2, height2) { + let r = textWidth / 2; + return x2 - r < 0 || x2 + r > width2 || y2 - (r = textHeight / 2) < 0 || y2 + r > height2; + } + function collision($2, x2, y2, textHeight, textWidth, h2, bm0, bm1) { + const w2 = textWidth * h2 / (textHeight * 2), x12 = $2(x2 - w2), x22 = $2(x2 + w2), y12 = $2(y2 - (h2 = h2 / 2)), y22 = $2(y2 + h2); + return bm0.outOfBounds(x12, y12, x22, y22) || bm0.getRange(x12, y12, x22, y22) || bm1 && bm1.getRange(x12, y12, x22, y22); + } + function placeAreaLabelReducedSearch($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1]; + function tryLabel(_x, _y, maxSize, textWidth, textHeight) { + const x2 = $2.invert(_x), y2 = $2.invert(_y); + let lo = maxSize, hi = height2, mid; + if (!outOfBounds(x2, y2, textWidth, textHeight, width2, height2) && !collision($2, x2, y2, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x2, y2, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x2, y2, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + return [x2, y2, lo, true]; } + } } - return root.eachBefore(computeHeight); -} -function node_copy() { - return hierarchy(this).eachBefore(copyData); -} -function objectChildren(d) { - return d.children; -} -function mapChildren(d) { - return Array.isArray(d) ? d[1] : null; -} -function copyData(node) { - if (node.data.value !== undefined) node.value = node.data.value; - node.data = node.data.data; -} -function computeHeight(node) { - var height = 0; - do node.height = height; - while ((node = node.parent) && node.height < ++height); -} -function Node(data) { - this.data = data; - this.depth = this.height = 0; - this.parent = null; -} -Node.prototype = hierarchy.prototype = { - constructor: Node, - count: (0, _countJsDefault.default), - each: (0, _eachJsDefault.default), - eachAfter: (0, _eachAfterJsDefault.default), - eachBefore: (0, _eachBeforeJsDefault.default), - find: (0, _findJsDefault.default), - sum: (0, _sumJsDefault.default), - sort: (0, _sortJsDefault.default), - path: (0, _pathJsDefault.default), - ancestors: (0, _ancestorsJsDefault.default), - descendants: (0, _descendantsJsDefault.default), - leaves: (0, _leavesJsDefault.default), - links: (0, _linksJsDefault.default), - copy: node_copy, - [Symbol.iterator]: (0, _iteratorJsDefault.default) -}; - -},{"./count.js":"dvcf4","./each.js":"eTn7P","./eachBefore.js":"ieOTr","./eachAfter.js":"2hfOH","./find.js":"cbIl9","./sum.js":"6qKl0","./sort.js":"0VcFA","./path.js":"kCaNs","./ancestors.js":"ciAJo","./descendants.js":"exMS3","./leaves.js":"2HPU5","./links.js":"8bu7D","./iterator.js":"flf9N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dvcf4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this.eachAfter(count); - }); -function count(node) { - var sum = 0, children = node.children, i = children && children.length; - if (!i) sum = 1; - else while(--i >= 0)sum += children[i].value; - node.value = sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eTn7P":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this)callback.call(that, node, ++index, this); - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ieOTr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], children, i, index = -1; - while(node = nodes.pop()){ - callback.call(that, node, ++index, this); - if (children = node.children) for(i = children.length - 1; i >= 0; --i)nodes.push(children[i]); + return function(d2) { + const items = d2.datum.datum.items[markIndex].items, n = items.length, textHeight = d2.datum.fontSize, textWidth = textMetrics.width(d2.datum, d2.datum.text); + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + if (x12 > x2) { + swapTmp = x12; + x12 = x2; + x2 = swapTmp; + } + if (y12 > y2) { + swapTmp = y12; + y12 = y2; + y2 = swapTmp; + } + _x1 = $2(x12); + _x2 = $2(x2); + _xMid = ~~((_x1 + _x2) / 2); + _y1 = $2(y12); + _y2 = $2(y2); + _yMid = ~~((_y1 + _y2) / 2); + for (_x = _xMid; _x >= _x1; --_x) { + for (_y = _yMid; _y >= _y1; --_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d2.x, d2.y, maxSize, labelPlaced] = result; + } + } + } + for (_x = _xMid; _x <= _x2; ++_x) { + for (_y = _yMid; _y <= _y2; ++_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d2.x, d2.y, maxSize, labelPlaced] = result; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d2.x = x3; + d2.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d2.x - x3), $2(d2.y - y3), $2(d2.x + x3), $2(d2.y + y3)); + d2.align = "center"; + d2.baseline = "middle"; + return true; + } else { + return false; + } + }; + } + const X_DIR = [-1, -1, 1, 1]; + const Y_DIR = [-1, 1, -1, 1]; + function placeAreaLabelFloodFill($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], bm2 = $2.bitmap(); + return function(d2) { + const items = d2.datum.datum.items[markIndex].items, n = items.length, textHeight = d2.datum.fontSize, textWidth = textMetrics.width(d2.datum, d2.datum.text), stack = []; + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, lo, hi, mid, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + stack.push([$2((x12 + x2) / 2), $2((y12 + y2) / 2)]); + while (stack.length) { + [_x, _y] = stack.pop(); + if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; + bm2.set(_x, _y); + for (let j = 0; j < 4; ++j) { + x3 = _x + X_DIR[j]; + y3 = _y + Y_DIR[j]; + if (!bm2.outOfBounds(x3, y3, x3, y3)) stack.push([x3, y3]); + } + x3 = $2.invert(_x); + y3 = $2.invert(_y); + lo = maxSize; + hi = height2; + if (!outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x3, y3, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + d2.x = x3; + d2.y = y3; + maxSize = lo; + labelPlaced = true; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d2.x = x3; + d2.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d2.x - x3), $2(d2.y - y3), $2(d2.x + x3), $2(d2.y + y3)); + d2.align = "center"; + d2.baseline = "middle"; + return true; + } else { + return false; + } + }; + } + const Aligns = ["right", "center", "left"], Baselines = ["bottom", "middle", "top"]; + function placeMarkLabel($2, bitmaps, anchors, offsets2) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets2.length; + return function(d2) { + const boundary = d2.boundary, textHeight = d2.datum.fontSize; + if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width2 || boundary[3] > height2) { + return false; + } + let textWidth = d2.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x12, x2, y12, y2, xc, yc, _x1, _x2, _y1, _y2; + for (let i = 0; i < n; ++i) { + dx = (anchors[i] & 3) - 1; + dy = (anchors[i] >>> 2 & 3) - 1; + isInside = dx === 0 && dy === 0 || offsets2[i] < 0; + sizeFactor = dx && dy ? Math.SQRT1_2 : 1; + insideFactor = offsets2[i] < 0 ? -1 : 1; + x12 = boundary[1 + dx] + offsets2[i] * dx * sizeFactor; + yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets2[i] * dy * sizeFactor; + y12 = yc - textHeight / 2; + y2 = yc + textHeight / 2; + _x1 = $2(x12); + _y1 = $2(y12); + _y2 = $2(y2); + if (!textWidth) { + if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x12, x12, y12, y2, boundary, isInside)) { + continue; + } else { + textWidth = textMetrics.width(d2.datum, d2.datum.text); + } + } + xc = x12 + insideFactor * textWidth * dx / 2; + x12 = xc - textWidth / 2; + x2 = xc + textWidth / 2; + _x1 = $2(x12); + _x2 = $2(x2); + if (test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside)) { + d2.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x12; + d2.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y12; + d2.align = Aligns[dx * insideFactor + 1]; + d2.baseline = Baselines[dy * insideFactor + 1]; + bm0.setRange(_x1, _y1, _x2, _y2); + return true; } - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2hfOH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], next = [], children, i, n, index = -1; - while(node = nodes.pop()){ - next.push(node); - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)nodes.push(children[i]); - } - while(node = next.pop())callback.call(that, node, ++index, this); - return this; + } + return false; + }; + } + function test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside) { + return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); + } + const TOP = 0, MIDDLE = 4, BOTTOM = 8, LEFT = 0, CENTER = 1, RIGHT = 2; + const anchorCode = { + "top-left": TOP + LEFT, + "top": TOP + CENTER, + "top-right": TOP + RIGHT, + "left": MIDDLE + LEFT, + "middle": MIDDLE + CENTER, + "right": MIDDLE + RIGHT, + "bottom-left": BOTTOM + LEFT, + "bottom": BOTTOM + CENTER, + "bottom-right": BOTTOM + RIGHT + }; + const placeAreaLabel = { + "naive": placeAreaLabelNaive, + "reduced-search": placeAreaLabelReducedSearch, + "floodfill": placeAreaLabelFloodFill + }; + function labelLayout(texts, size, compare2, offset2, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding2, method2) { + if (!texts.length) return texts; + const positions2 = Math.max(offset2.length, anchor.length), offsets2 = getOffsets(offset2, positions2), anchors = getAnchors(anchor, positions2), marktype = markType(texts[0].datum), grouptype = marktype === "group" && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === "area", boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding2 === null || padding2 === Infinity, isNaiveGroupArea = isGroupArea && method2 === "naive"; + let maxTextWidth = -1, maxTextHeight = -1; + const data2 = texts.map((d2) => { + const textWidth = infPadding ? textMetrics.width(d2, d2.text) : void 0; + maxTextWidth = Math.max(maxTextWidth, textWidth); + maxTextHeight = Math.max(maxTextHeight, d2.fontSize); + return { + datum: d2, + opacity: 0, + x: void 0, + y: void 0, + align: void 0, + baseline: void 0, + boundary: boundary(d2), + textWidth + }; }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cbIl9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this){ - if (callback.call(that, node, ++index, this)) return node; + padding2 = padding2 === null || padding2 === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset2) : padding2; + const $2 = scaler(size[0], size[1], padding2); + let bitmaps; + if (!isNaiveGroupArea) { + if (compare2) { + data2.sort((a2, b2) => compare2(a2.datum, b2.datum)); + } + let labelInside = false; + for (let i = 0; i < anchors.length && !labelInside; ++i) { + labelInside = anchors[i] === 5 || offsets2[i] < 0; + } + const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d2) => d2.datum); + bitmaps = avoidMarks.length || baseMark ? markBitmaps($2, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($2, avoidBaseMark && data2); + } + const place2 = isGroupArea ? placeAreaLabel[method2]($2, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($2, bitmaps, anchors, offsets2); + data2.forEach((d2) => d2.opacity = +place2(d2)); + return data2; + } + function getOffsets(_, count2) { + const offsets2 = new Float64Array(count2), n = _.length; + for (let i = 0; i < n; ++i) offsets2[i] = _[i] || 0; + for (let i = n; i < count2; ++i) offsets2[i] = offsets2[n - 1]; + return offsets2; + } + function getAnchors(_, count2) { + const anchors = new Int8Array(count2), n = _.length; + for (let i = 0; i < n; ++i) anchors[i] |= anchorCode[_[i]]; + for (let i = n; i < count2; ++i) anchors[i] = anchors[n - 1]; + return anchors; + } + function markType(item) { + return item && item.mark && item.mark.marktype; + } + function markBoundary(marktype, grouptype, lineAnchor, markIndex) { + const xy = (d2) => [d2.x, d2.x, d2.x, d2.y, d2.y, d2.y]; + if (!marktype) { + return xy; + } else if (marktype === "line" || marktype === "area") { + return (d2) => xy(d2.datum); + } else if (grouptype === "line") { + return (d2) => { + const items = d2.datum.items[markIndex].items; + return xy(items.length ? items[lineAnchor === "start" ? 0 : items.length - 1] : { + x: NaN, + y: NaN + }); + }; + } else { + return (d2) => { + const b2 = d2.datum.bounds; + return [b2.x1, (b2.x1 + b2.x2) / 2, b2.x2, b2.y1, (b2.y1 + b2.y2) / 2, b2.y2]; + }; + } + } + const Output$1 = ["x", "y", "opacity", "align", "baseline"]; + const Anchors = ["top-left", "left", "bottom-left", "top", "bottom", "top-right", "right", "bottom-right"]; + function Label$1(params2) { + Transform.call(this, null, params2); + } + Label$1.Definition = { + type: "Label", + metadata: { + modifies: true + }, + params: [{ + name: "size", + type: "number", + array: true, + length: 2, + required: true + }, { + name: "sort", + type: "compare" + }, { + name: "anchor", + type: "string", + array: true, + default: Anchors + }, { + name: "offset", + type: "number", + array: true, + default: [1] + }, { + name: "padding", + type: "number", + default: 0, + null: true + }, { + name: "lineAnchor", + type: "string", + values: ["start", "end"], + default: "end" + }, { + name: "markIndex", + type: "number", + default: 0 + }, { + name: "avoidBaseMark", + type: "boolean", + default: true + }, { + name: "avoidMarks", + type: "data", + array: true + }, { + name: "method", + type: "string", + default: "naive" + }, { + name: "as", + type: "string", + array: true, + length: Output$1.length, + default: Output$1 + }] + }; + inherits(Label$1, Transform, { + transform(_, pulse2) { + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || modp("sort"))) return; + if (!_.size || _.size.length !== 2) { + error("Size parameter should be specified as a [width, height] array."); + } + const as = _.as || Output$1; + labelLayout(pulse2.materialize(pulse2.SOURCE).source || [], _.size, _.sort, array$4(_.offset == null ? 1 : _.offset), array$4(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || "end", _.markIndex || 0, _.padding === void 0 ? 0 : _.padding, _.method || "naive").forEach((l) => { + const t = l.datum; + t[as[0]] = l.x; + t[as[1]] = l.y; + t[as[2]] = l.opacity; + t[as[3]] = l.align; + t[as[4]] = l.baseline; + }); + return pulse2.reflow(mod).modifies(as); + } + }); + const label = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + label: Label$1 + }, Symbol.toStringTag, { value: "Module" })); + function partition(data2, groupby) { + var groups = [], get2 = function(f) { + return f(t); + }, map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6qKl0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, children = node.children, i = children && children.length; - while(--i >= 0)sum += children[i].value; - node.value = sum; + g.push(t); + } + } + return groups; + } + function Loess(params2) { + Transform.call(this, null, params2); + } + Loess.Definition = { + "type": "Loess", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "bandwidth", + "type": "number", + "default": 0.3 + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Loess, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), m2 = names.length, as = _.as || [accessorName(_.x), accessorName(_.y)], values2 = []; + groups.forEach((g) => { + loess(g, _.x, _.y, _.bandwidth || 0.3).forEach((p) => { + const t = {}; + for (let i = 0; i < m2; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }); }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0VcFA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(compare) { - return this.eachBefore(function(node) { - if (node.children) node.children.sort(compare); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const Methods = { + constant: constant$3, + linear, + log: log$2, + exp: exp$1, + pow: pow$2, + quad, + poly + }; + const degreesOfFreedom = (method2, order) => method2 === "poly" ? order : method2 === "quad" ? 2 : 1; + function Regression(params2) { + Transform.call(this, null, params2); + } + Regression.Definition = { + "type": "Regression", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "string", + "default": "linear", + "values": Object.keys(Methods) + }, { + "name": "order", + "type": "number", + "default": 3 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "params", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Regression, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), method2 = _.method || "linear", order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method2, order), as = _.as || [accessorName(_.x), accessorName(_.y)], fit2 = Methods[method2], values2 = []; + let domain2 = _.extent; + if (!has$1(Methods, method2)) { + error("Invalid regression method: " + method2); + } + if (domain2 != null) { + if (method2 === "log" && domain2[0] <= 0) { + pulse2.dataflow.warn("Ignoring extent with values <= 0 for log regression."); + domain2 = null; + } + } + groups.forEach((g) => { + const n = g.length; + if (n <= dof) { + pulse2.dataflow.warn("Skipping regression with more parameters than data points."); + return; + } + const model = fit2(g, _.x, _.y, order); + if (_.params) { + values2.push(ingest$1({ + keys: g.dims, + coef: model.coef, + rSquared: model.rSquared + })); + return; + } + const dom = domain2 || extent(g, _.x), add2 = (p) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }; + if (method2 === "linear" || method2 === "constant") { + dom.forEach((x2) => add2([x2, model.predict(x2)])); + } else { + sampleCurve(model.predict, dom, 25, 200).forEach(add2); + } }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kCaNs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(end) { - var start = this, ancestor = leastCommonAncestor(start, end), nodes = [ - start - ]; - while(start !== ancestor){ - start = start.parent; - nodes.push(start); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const reg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + loess: Loess, + regression: Regression + }, Symbol.toStringTag, { value: "Module" })); + const epsilon$1 = 11102230246251565e-32; + const splitter = 134217729; + const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1; + function sum(elen, e, flen, f, h2) { + let Q, Qnew, hh, bvirt; + let enow = e[0]; + let fnow = f[0]; + let eindex = 0; + let findex = 0; + if (fnow > enow === fnow > -enow) { + Q = enow; + enow = e[++eindex]; + } else { + Q = fnow; + fnow = f[++findex]; + } + let hindex = 0; + if (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = enow + Q; + hh = Q - (Qnew - enow); + enow = e[++eindex]; + } else { + Qnew = fnow + Q; + hh = Q - (Qnew - fnow); + fnow = f[++findex]; + } + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + while (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; + } else { + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; } - var k = nodes.length; - while(end !== ancestor){ - nodes.splice(k, 0, end); - end = end.parent; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; } - return nodes; - }); -function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null; - a = aNodes.pop(); - b = bNodes.pop(); - while(a === b){ - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - return c; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ciAJo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var node = this, nodes = [ - node - ]; - while(node = node.parent)nodes.push(node); - return nodes; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"exMS3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return Array.from(this); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2HPU5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) leaves.push(node); - }); - return leaves; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8bu7D":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) links.push({ - source: node.parent, - target: node - }); - }); - return links; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flf9N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function*() { - var node = this, current, next = [ - node - ], children, i, n; - do { - current = next.reverse(), next = []; - while(node = current.pop()){ - yield node; - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)next.push(children[i]); - } - }while (next.length); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lUJH5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var radius = null, dx = 1, dy = 1, padding = (0, _constantJs.constantZero); - function pack(root) { - const random = (0, _lcgJsDefault.default)(); - root.x = dx / 2, root.y = dy / 2; - if (radius) root.eachBefore(radiusLeaf(radius)).eachAfter(packChildrenRandom(padding, 0.5, random)).eachBefore(translateChild(1)); - else root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom((0, _constantJs.constantZero), 1, random)).eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); - return root; - } - pack.radius = function(x) { - return arguments.length ? (radius = (0, _accessorsJs.optional)(x), pack) : radius; - }; - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [ - dx, - dy - ]; - }; - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), pack) : padding; - }; - return pack; - }); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _siblingsJs = require("./siblings.js"); -function defaultRadius(d) { - return Math.sqrt(d.value); -} -function radiusLeaf(radius) { - return function(node) { - if (!node.children) node.r = Math.max(0, +radius(node) || 0); - }; -} -function packChildrenRandom(padding, k, random) { - return function(node) { - if (children = node.children) { - var children, i, n = children.length, r = padding(node) * k || 0, e; - if (r) for(i = 0; i < n; ++i)children[i].r += r; - e = (0, _siblingsJs.packSiblingsRandom)(children, random); - if (r) for(i = 0; i < n; ++i)children[i].r -= r; - node.r = e + r; + } + } + while (eindex < elen) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + while (findex < flen) { + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + if (Q !== 0 || hindex === 0) { + h2[hindex++] = Q; + } + return hindex; + } + function estimate(elen, e) { + let Q = e[0]; + for (let i = 1; i < elen; i++) Q += e[i]; + return Q; + } + function vec(n) { + return new Float64Array(n); + } + const ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1; + const ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1; + const ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1; + const B = vec(4); + const C1 = vec(8); + const C2 = vec(12); + const D = vec(16); + const u = vec(4); + function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { + let acxtail, acytail, bcxtail, bcytail; + let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3; + const acx = ax - cx; + const bcx = bx - cx; + const acy = ay - cy; + const bcy = by - cy; + s1 = acx * bcy; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcx; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + B[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + B[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + B[2] = _j - (u3 - bvirt) + (_i - bvirt); + B[3] = u3; + let det = estimate(4, B); + let errbound = ccwerrboundB * detsum; + if (det >= errbound || -det >= errbound) { + return det; + } + bvirt = ax - acx; + acxtail = ax - (acx + bvirt) + (bvirt - cx); + bvirt = bx - bcx; + bcxtail = bx - (bcx + bvirt) + (bvirt - cx); + bvirt = ay - acy; + acytail = ay - (acy + bvirt) + (bvirt - cy); + bvirt = by - bcy; + bcytail = by - (bcy + bvirt) + (bvirt - cy); + if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) { + return det; + } + errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); + det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); + if (det >= errbound || -det >= errbound) return det; + s1 = acxtail * bcy; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcx; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C1len = sum(4, B, 4, u, C1); + s1 = acx * bcytail; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcxtail; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C2len = sum(C1len, C1, 4, u, C2); + s1 = acxtail * bcytail; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcxtail; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const Dlen = sum(C2len, C2, 4, u, D); + return D[Dlen - 1]; + } + function orient2d(ax, ay, bx, by, cx, cy) { + const detleft = (ay - cy) * (bx - cx); + const detright = (ax - cx) * (by - cy); + const det = detleft - detright; + const detsum = Math.abs(detleft + detright); + if (Math.abs(det) >= ccwerrboundA * detsum) return det; + return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); + } + const EPSILON = Math.pow(2, -52); + const EDGE_STACK = new Uint32Array(512); + class Delaunator { + static from(points2, getX = defaultGetX, getY = defaultGetY) { + const n = points2.length; + const coords = new Float64Array(n * 2); + for (let i = 0; i < n; i++) { + const p = points2[i]; + coords[2 * i] = getX(p); + coords[2 * i + 1] = getY(p); + } + return new Delaunator(coords); + } + constructor(coords) { + const n = coords.length >> 1; + if (n > 0 && typeof coords[0] !== "number") throw new Error("Expected coords to contain numbers."); + this.coords = coords; + const maxTriangles = Math.max(2 * n - 5, 0); + this._triangles = new Uint32Array(maxTriangles * 3); + this._halfedges = new Int32Array(maxTriangles * 3); + this._hashSize = Math.ceil(Math.sqrt(n)); + this._hullPrev = new Uint32Array(n); + this._hullNext = new Uint32Array(n); + this._hullTri = new Uint32Array(n); + this._hullHash = new Int32Array(this._hashSize); + this._ids = new Uint32Array(n); + this._dists = new Float64Array(n); + this.update(); + } + update() { + const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; + const n = coords.length >> 1; + let minX = Infinity; + let minY = Infinity; + let maxX = -Infinity; + let maxY2 = -Infinity; + for (let i = 0; i < n; i++) { + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (x2 < minX) minX = x2; + if (y2 < minY) minY = y2; + if (x2 > maxX) maxX = x2; + if (y2 > maxY2) maxY2 = y2; + this._ids[i] = i; + } + const cx = (minX + maxX) / 2; + const cy = (minY + maxY2) / 2; + let i0, i1, i2; + for (let i = 0, minDist = Infinity; i < n; i++) { + const d2 = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); + if (d2 < minDist) { + i0 = i; + minDist = d2; } - }; -} -function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; -} - -},{"../accessors.js":"jK6n5","../constant.js":"72P4a","../lcg.js":"d0wK8","./siblings.js":"goIsb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jK6n5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "optional", ()=>optional); -parcelHelpers.export(exports, "required", ()=>required); -function optional(f) { - return f == null ? null : required(f); -} -function required(f) { - if (typeof f !== "function") throw new Error; - return f; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"72P4a":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "constantZero", ()=>constantZero); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); -function constantZero() { - return 0; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d0wK8":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"goIsb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "packSiblingsRandom", ()=>packSiblingsRandom); -parcelHelpers.export(exports, "default", ()=>function(circles) { - packSiblingsRandom(circles, (0, _lcgJsDefault.default)()); - return circles; - }); -var _arrayJs = require("../array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _encloseJs = require("./enclose.js"); -function place(b, a, c) { - var dx = b.x - a.x, x, a2, dy = b.y - a.y, y, b2, d2 = dx * dx + dy * dy; - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; + } + const i0x = coords[2 * i0]; + const i0y = coords[2 * i0 + 1]; + for (let i = 0, minDist = Infinity; i < n; i++) { + if (i === i0) continue; + const d2 = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); + if (d2 < minDist && d2 > 0) { + i1 = i; + minDist = d2; + } + } + let i1x = coords[2 * i1]; + let i1y = coords[2 * i1 + 1]; + let minRadius = Infinity; + for (let i = 0; i < n; i++) { + if (i === i0 || i === i1) continue; + const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); + if (r < minRadius) { + i2 = i; + minRadius = r; + } + } + let i2x = coords[2 * i2]; + let i2y = coords[2 * i2 + 1]; + if (minRadius === Infinity) { + for (let i = 0; i < n; i++) { + this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; + } + quicksort(this._ids, this._dists, 0, n - 1); + const hull = new Uint32Array(n); + let j = 0; + for (let i = 0, d0 = -Infinity; i < n; i++) { + const id2 = this._ids[i]; + const d2 = this._dists[id2]; + if (d2 > d0) { + hull[j++] = id2; + d0 = d2; + } + } + this.hull = hull.subarray(0, j); + this.triangles = new Uint32Array(0); + this.halfedges = new Uint32Array(0); + return; + } + if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { + const i = i1; + const x2 = i1x; + const y2 = i1y; + i1 = i2; + i1x = i2x; + i1y = i2y; + i2 = i; + i2x = x2; + i2y = y2; + } + const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); + this._cx = center.x; + this._cy = center.y; + for (let i = 0; i < n; i++) { + this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); + } + quicksort(this._ids, this._dists, 0, n - 1); + this._hullStart = i0; + let hullSize = 3; + hullNext[i0] = hullPrev[i2] = i1; + hullNext[i1] = hullPrev[i0] = i2; + hullNext[i2] = hullPrev[i1] = i0; + hullTri[i0] = 0; + hullTri[i1] = 1; + hullTri[i2] = 2; + hullHash.fill(-1); + hullHash[this._hashKey(i0x, i0y)] = i0; + hullHash[this._hashKey(i1x, i1y)] = i1; + hullHash[this._hashKey(i2x, i2y)] = i2; + this.trianglesLen = 0; + this._addTriangle(i0, i1, i2, -1, -1, -1); + for (let k = 0, xp, yp; k < this._ids.length; k++) { + const i = this._ids[k]; + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (k > 0 && Math.abs(x2 - xp) <= EPSILON && Math.abs(y2 - yp) <= EPSILON) continue; + xp = x2; + yp = y2; + if (i === i0 || i === i1 || i === i2) continue; + let start = 0; + for (let j = 0, key2 = this._hashKey(x2, y2); j < this._hashSize; j++) { + start = hullHash[(key2 + j) % this._hashSize]; + if (start !== -1 && start !== hullNext[start]) break; + } + start = hullPrev[start]; + let e = start, q; + while (q = hullNext[e], orient2d(x2, y2, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) { + e = q; + if (e === start) { + e = -1; + break; + } + } + if (e === -1) continue; + let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); + hullTri[i] = this._legalize(t + 2); + hullTri[e] = t; + hullSize++; + let n2 = hullNext[e]; + while (q = hullNext[n2], orient2d(x2, y2, coords[2 * n2], coords[2 * n2 + 1], coords[2 * q], coords[2 * q + 1]) < 0) { + t = this._addTriangle(n2, i, q, hullTri[i], -1, hullTri[n2]); + hullTri[i] = this._legalize(t + 2); + hullNext[n2] = n2; + hullSize--; + n2 = q; + } + if (e === start) { + while (q = hullPrev[e], orient2d(x2, y2, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) { + t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); + this._legalize(t + 2); + hullTri[q] = t; + hullNext[e] = e; + hullSize--; + e = q; + } + } + this._hullStart = hullPrev[i] = e; + hullNext[e] = hullPrev[n2] = i; + hullNext[i] = n2; + hullHash[this._hashKey(x2, y2)] = i; + hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; + } + this.hull = new Uint32Array(hullSize); + for (let i = 0, e = this._hullStart; i < hullSize; i++) { + this.hull[i] = e; + e = hullNext[e]; + } + this.triangles = this._triangles.subarray(0, this.trianglesLen); + this.halfedges = this._halfedges.subarray(0, this.trianglesLen); + } + _hashKey(x2, y2) { + return Math.floor(pseudoAngle(x2 - this._cx, y2 - this._cy) * this._hashSize) % this._hashSize; + } + _legalize(a2) { + const { _triangles: triangles, _halfedges: halfedges, coords } = this; + let i = 0; + let ar = 0; + while (true) { + const b2 = halfedges[a2]; + const a0 = a2 - a2 % 3; + ar = a0 + (a2 + 2) % 3; + if (b2 === -1) { + if (i === 0) break; + a2 = EDGE_STACK[--i]; + continue; + } + const b0 = b2 - b2 % 3; + const al = a0 + (a2 + 1) % 3; + const bl2 = b0 + (b2 + 2) % 3; + const p02 = triangles[ar]; + const pr = triangles[a2]; + const pl = triangles[al]; + const p1 = triangles[bl2]; + const illegal = inCircle( + coords[2 * p02], + coords[2 * p02 + 1], + coords[2 * pr], + coords[2 * pr + 1], + coords[2 * pl], + coords[2 * pl + 1], + coords[2 * p1], + coords[2 * p1 + 1] + ); + if (illegal) { + triangles[a2] = p1; + triangles[b2] = p02; + const hbl = halfedges[bl2]; + if (hbl === -1) { + let e = this._hullStart; + do { + if (this._hullTri[e] === bl2) { + this._hullTri[e] = a2; + break; + } + e = this._hullPrev[e]; + } while (e !== this._hullStart); + } + this._link(a2, hbl); + this._link(b2, halfedges[ar]); + this._link(ar, bl2); + const br2 = b0 + (b2 + 1) % 3; + if (i < EDGE_STACK.length) { + EDGE_STACK[i++] = br2; + } } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; + if (i === 0) break; + a2 = EDGE_STACK[--i]; } - } else { - c.x = a.x + c.r; - c.y = a.y; + } + return ar; } -} -function intersects(a, b) { - var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function score(node) { - var a = node._, b = node.next._, ab = a.r + b.r, dx = (a.x * b.r + b.x * a.r) / ab, dy = (a.y * b.r + b.y * a.r) / ab; + _link(a2, b2) { + this._halfedges[a2] = b2; + if (b2 !== -1) this._halfedges[b2] = a2; + } + // add a new triangle given vertex indices and adjacent half-edge ids + _addTriangle(i0, i1, i2, a2, b2, c2) { + const t = this.trianglesLen; + this._triangles[t] = i0; + this._triangles[t + 1] = i1; + this._triangles[t + 2] = i2; + this._link(t, a2); + this._link(t + 1, b2); + this._link(t + 2, c2); + this.trianglesLen += 3; + return t; + } + } + function pseudoAngle(dx, dy) { + const p = dx / (Math.abs(dx) + Math.abs(dy)); + return (dy > 0 ? 3 - p : 1 + p) / 4; + } + function dist(ax, ay, bx, by) { + const dx = ax - bx; + const dy = ay - by; return dx * dx + dy * dy; -} -function Node(circle) { - this._ = circle; - this.next = null; - this.previous = null; -} -function packSiblingsRandom(circles, random) { - if (!(n = (circles = (0, _arrayJsDefault.default)(circles)).length)) return 0; - var a, b, c, n, aa, ca, i, j, k, sj, sk; - // Place the first circle. - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; - // Place the second circle. - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; - // Place the third circle. - place(b, a, c = circles[2]); - // Initialize the front-chain using the first three circles a, b and c. - a = new Node(a), b = new Node(b), c = new Node(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; - // Attempt to place each remaining circle… - pack: for(i = 3; i < n; ++i){ - place(a._, b._, c = circles[i]), c = new Node(c); - // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - do if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - while (j !== k.next); - // Success! Insert the new circle c between a and b. - c.previous = a, c.next = b, a.next = b.previous = b = c; - // Compute the new closest circle pair to the centroid. - aa = score(a); - while((c = c.next) !== b)if ((ca = score(c)) < aa) a = c, aa = ca; - b = a.next; - } - // Compute the enclosing circle of the front chain. - a = [ - b._ - ], c = b; - while((c = c.next) !== b)a.push(c._); - c = (0, _encloseJs.packEncloseRandom)(a, random); - // Translate the circles to put the enclosing circle around the origin. - for(i = 0; i < n; ++i)a = circles[i], a.x -= c.x, a.y -= c.y; - return c.r; -} - -},{"../array.js":"2JoJW","../lcg.js":"d0wK8","./enclose.js":"4VLut","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2JoJW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -parcelHelpers.export(exports, "shuffle", ()=>shuffle); -function shuffle(array, random) { - let m = array.length, t, i; - while(m){ - i = random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4VLut":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(circles) { - return packEncloseRandom(circles, (0, _lcgJsDefault.default)()); - }); -parcelHelpers.export(exports, "packEncloseRandom", ()=>packEncloseRandom); -var _arrayJs = require("../array.js"); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function packEncloseRandom(circles, random) { - var i = 0, n = (circles = (0, _arrayJs.shuffle)(Array.from(circles), random)).length, B = [], p, e; - while(i < n){ - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i; - else e = encloseBasis(B = extendBasis(B, p)), i = 0; + } + function inCircle(ax, ay, bx, by, cx, cy, px2, py2) { + const dx = ax - px2; + const dy = ay - py2; + const ex = bx - px2; + const ey = by - py2; + const fx = cx - px2; + const fy = cy - py2; + const ap = dx * dx + dy * dy; + const bp = ex * ex + ey * ey; + const cp = fx * fx + fy * fy; + return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; + } + function circumradius(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d2 = 0.5 / (dx * ey - dy * ex); + const x2 = (ey * bl2 - dy * cl) * d2; + const y2 = (dx * cl - ex * bl2) * d2; + return x2 * x2 + y2 * y2; + } + function circumcenter(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d2 = 0.5 / (dx * ey - dy * ex); + const x2 = ax + (ey * bl2 - dy * cl) * d2; + const y2 = ay + (dx * cl - ex * bl2) * d2; + return { x: x2, y: y2 }; + } + function quicksort(ids, dists, left, right) { + if (right - left <= 20) { + for (let i = left + 1; i <= right; i++) { + const temp2 = ids[i]; + const tempDist = dists[temp2]; + let j = i - 1; + while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; + ids[j + 1] = temp2; + } + } else { + const median2 = left + right >> 1; + let i = left + 1; + let j = right; + swap(ids, median2, i); + if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); + if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); + if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); + const temp2 = ids[i]; + const tempDist = dists[temp2]; + while (true) { + do + i++; + while (dists[ids[i]] < tempDist); + do + j--; + while (dists[ids[j]] > tempDist); + if (j < i) break; + swap(ids, i, j); + } + ids[left + 1] = ids[j]; + ids[j] = temp2; + if (right - i + 1 >= j - left) { + quicksort(ids, dists, i, right); + quicksort(ids, dists, left, j - 1); + } else { + quicksort(ids, dists, left, j - 1); + quicksort(ids, dists, i, right); + } } - return e; -} -function extendBasis(B, p) { - var i, j; - if (enclosesWeakAll(p, B)) return [ - p - ]; - // If we get here then B must have at least one element. - for(i = 0; i < B.length; ++i){ - if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) return [ - B[i], - p - ]; + } + function swap(arr, i, j) { + const tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + } + function defaultGetX(p) { + return p[0]; + } + function defaultGetY(p) { + return p[1]; + } + const epsilon = 1e-6; + class Path { + constructor() { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; } - // If we get here then B must have at least two elements. - for(i = 0; i < B.length - 1; ++i)for(j = i + 1; j < B.length; ++j){ - if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) return [ - B[i], - B[j], - p - ]; + moveTo(x2, y2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; } - // If we get here then something is very wrong. - throw new Error; -} -function enclosesNot(a, b) { - var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; -} -function enclosesWeak(a, b) { - var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function enclosesWeakAll(a, B) { - for(var i = 0; i < B.length; ++i){ - if (!enclosesWeak(a, B[i])) return false; + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._ += "Z"; + } } - return true; -} -function encloseBasis(B) { - switch(B.length){ - case 1: - return encloseBasis1(B[0]); - case 2: - return encloseBasis2(B[0], B[1]); - case 3: - return encloseBasis3(B[0], B[1], B[2]); + lineTo(x2, y2) { + this._ += `L${this._x1 = +x2},${this._y1 = +y2}`; } -} -function encloseBasis1(a) { - return { - x: a.x, - y: a.y, - r: a.r - }; -} -function encloseBasis2(a, b) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); - return { - x: (x1 + x2 + x21 / l * r21) / 2, - y: (y1 + y2 + y21 / l * r21) / 2, - r: (l + r1 + r2) / 2 - }; -} -function encloseBasis3(a, b, c) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c.x, y3 = c.y, r3 = c.r, a2 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c2 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a2 * b3, xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb = (b3 * c2 - b2 * c3) / ab, ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, yb = (a2 * c3 - a3 * c2) / ab, A = xb * xb + yb * yb - 1, B = 2 * (r1 + xa * xb + ya * yb), C = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B); - return { - x: x1 + xa + xb * r, - y: y1 + ya + yb * r, - r: r - }; -} - -},{"../array.js":"2JoJW","../lcg.js":"d0wK8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2uWl8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var dx = 1, dy = 1, padding = 0, round = false; - function partition(root) { - var n = root.height + 1; - root.x0 = root.y0 = padding; - root.x1 = dx; - root.y1 = dy / n; - root.eachBefore(positionNode(dy, n)); - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(dy, n) { - return function(node) { - if (node.children) (0, _diceJsDefault.default)(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n); - var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - partition.round = function(x) { - return arguments.length ? (round = !!x, partition) : round; - }; - partition.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [ - dx, - dy - ]; - }; - partition.padding = function(x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - return partition; - }); -var _roundJs = require("./treemap/round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); - -},{"./treemap/round.js":"4XKsQ","./treemap/dice.js":"5Coec","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4XKsQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Coec":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value; - while(++i < n){ - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"81qCy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var id = defaultId, parentId = defaultParentId, path; - function stratify(data) { - var nodes = Array.from(data), currentId = id, currentParentId = parentId, n, d, i, root, parent, node, nodeId, nodeKey, nodeByKey = new Map; - if (path != null) { - const I = nodes.map((d, i)=>normalize(path(d, i, data))); - const P = I.map(parentof); - const S = new Set(I).add(""); - for (const i of P)if (!S.has(i)) { - S.add(i); - I.push(i); - P.push(parentof(i)); - nodes.push(imputed); - } - currentId = (_, i)=>I[i]; - currentParentId = (_, i)=>P[i]; - } - for(i = 0, n = nodes.length; i < n; ++i){ - d = nodes[i], node = nodes[i] = new (0, _indexJs.Node)(d); - if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) { - nodeKey = node.id = nodeId; - nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); - } - if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) node.parent = nodeId; - } - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (nodeId = node.parent) { - parent = nodeByKey.get(nodeId); - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node); - else parent.children = [ - node - ]; - node.parent = parent; - } else { - if (root) throw new Error("multiple roots"); - root = node; - } - } - if (!root) throw new Error("no root"); - // When imputing internal nodes, only introduce roots if needed. - // Then replace the imputed marker data with null. - if (path != null) { - while(root.data === imputed && root.children.length === 1)root = root.children[0], --n; - for(let i = nodes.length - 1; i >= 0; --i){ - node = nodes[i]; - if (node.data !== imputed) break; - node.data = null; - } - } - root.parent = preroot; - root.eachBefore(function(node) { - node.depth = node.parent.depth + 1; - --n; - }).eachBefore((0, _indexJs.computeHeight)); - root.parent = null; - if (n > 0) throw new Error("cycle"); - return root; - } - stratify.id = function(x) { - return arguments.length ? (id = (0, _accessorsJs.optional)(x), stratify) : id; - }; - stratify.parentId = function(x) { - return arguments.length ? (parentId = (0, _accessorsJs.optional)(x), stratify) : parentId; - }; - stratify.path = function(x) { - return arguments.length ? (path = (0, _accessorsJs.optional)(x), stratify) : path; - }; - return stratify; - }); -var _accessorsJs = require("./accessors.js"); -var _indexJs = require("./hierarchy/index.js"); -var preroot = { - depth: -1 -}, ambiguous = {}, imputed = {}; -function defaultId(d) { - return d.id; -} -function defaultParentId(d) { - return d.parentId; -} -// To normalize a path, we coerce to a string, strip the trailing slash if any -// (as long as the trailing slash is not immediately preceded by another slash), -// and add leading slash if missing. -function normalize(path) { - path = `${path}`; - let i = path.length; - if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1); - return path[0] === "/" ? path : `/${path}`; -} -// Walk backwards to find the first slash that is not the leading slash, e.g.: -// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased -// because the id of the root must be a truthy value.) -function parentof(path) { - let i = path.length; - if (i < 2) return ""; - while(--i > 1)if (slash(path, i)) break; - return path.slice(0, i); -} -// Slashes can be escaped; to determine whether a slash is a path delimiter, we -// count the number of preceding backslashes escaping the forward slash: an odd -// number indicates an escaped forward slash. -function slash(path, i) { - if (path[i] === "/") { - let k = 0; - while(i > 0 && path[--i] === "\\")++k; - if ((k & 1) === 0) return true; + arc(x2, y2, r) { + x2 = +x2, y2 = +y2, r = +r; + const x02 = x2 + r; + const y02 = y2; + if (r < 0) throw new Error("negative radius"); + if (this._x1 === null) this._ += `M${x02},${y02}`; + else if (Math.abs(this._x1 - x02) > epsilon || Math.abs(this._y1 - y02) > epsilon) this._ += "L" + x02 + "," + y02; + if (!r) return; + this._ += `A${r},${r},0,1,1,${x2 - r},${y2}A${r},${r},0,1,1,${this._x1 = x02},${this._y1 = y02}`; } - return false; -} - -},{"./accessors.js":"jK6n5","./hierarchy/index.js":"aKFc0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i82wc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null; - function tree(root) { - var t = treeRoot(root); - // Compute the layout using Buchheim et al.’s algorithm. - t.eachAfter(firstWalk), t.parent.m = -t.z; - t.eachBefore(secondWalk); - // If a fixed node size is specified, scale x and y. - if (nodeSize) root.eachBefore(sizeNode); - else { - var left = root, right = root, bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = node.depth * ky; - }); - } - return root; - } - // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is - // applied recursively to the children of v, as well as the function - // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the - // node v is placed to the midpoint of its outermost children. - function firstWalk(v) { - var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else v.z = midpoint; - } else if (w) v.z = w.z + separation(v._, w._); - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } - // Computes all real x-coordinates by summing up the modifiers recursively. - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += v.parent.m; - } - // The core of the algorithm. Here, a new subtree is combined with the - // previous subtrees. Threads are used to traverse the inside and outside - // contours of the left and right subtree up to the highest common level. The - // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the - // superscript o means outside and i means inside, the subscript - means left - // subtree and + means right subtree. For summing up the modifiers along the - // contour, we use respective variables si+, si-, so-, and so+. Whenever two - // nodes of the inside contours conflict, we compute the left one of the - // greatest uncommon ancestors using the function ANCESTOR and call MOVE - // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. - // Finally, we add a new thread (if necessary). - function apportion(v, w, ancestor) { - if (w) { - var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; - while(vim = nextRight(vim), vip = nextLeft(vip), vim && vip){ - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; - } - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; - } - tree.separation = function(x) { - return arguments.length ? (separation = x, tree) : separation; - }; - tree.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [ - dx, - dy - ]; - }; - tree.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : nodeSize ? [ - dx, - dy - ] : null; - }; - return tree; - }); -var _indexJs = require("./hierarchy/index.js"); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -// function radialSeparation(a, b) { -// return (a.parent === b.parent ? 1 : 2) / a.depth; -// } -// This function is used to traverse the left contour of a subtree (or -// subforest). It returns the successor of v on this contour. This successor is -// either given by the leftmost child of v or by the thread of v. The function -// returns null if and only if v is on the highest level of its subtree. -function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; -} -// This function works analogously to nextLeft. -function nextRight(v) { - var children = v.children; - return children ? children[children.length - 1] : v.t; -} -// Shifts the current subtree rooted at w+. This is done by increasing -// prelim(w+) and mod(w+) by shift. -function moveSubtree(wm, wp, shift) { - var change = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += shift; -} -// All other shifts, applied to the smaller subtrees between w- and w+, are -// performed by this function. To prepare the shifts, we have to adjust -// change(w+), shift(w+), and change(w-). -function executeShifts(v) { - var shift = 0, change = 0, children = v.children, i = children.length, w; - while(--i >= 0){ - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } -} -// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, -// returns the specified (default) ancestor. -function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; -} -function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - this.a = this; // ancestor - this.z = 0; // prelim - this.m = 0; // mod - this.c = 0; // change - this.s = 0; // shift - this.t = null; // thread - this.i = i; // number -} -TreeNode.prototype = Object.create((0, _indexJs.Node).prototype); -function treeRoot(root) { - var tree = new TreeNode(root, 0), node, nodes = [ - tree - ], child, children, i, n; - while(node = nodes.pop())if (children = node._.children) { - node.children = new Array(n = children.length); - for(i = n - 1; i >= 0; --i){ - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - (tree.parent = new TreeNode(null, 0)).children = [ - tree - ]; - return tree; -} - -},{"./hierarchy/index.js":"aKFc0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gn3Lw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var tile = (0, _squarifyJsDefault.default), round = false, dx = 1, dy = 1, paddingStack = [ - 0 - ], paddingInner = (0, _constantJs.constantZero), paddingTop = (0, _constantJs.constantZero), paddingRight = (0, _constantJs.constantZero), paddingBottom = (0, _constantJs.constantZero), paddingLeft = (0, _constantJs.constantZero); - function treemap(root) { - root.x0 = root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [ - 0 - ]; - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(node) { - var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } - } - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [ - dx, - dy - ]; - }; - treemap.tile = function(x) { - return arguments.length ? (tile = (0, _accessorsJs.required)(x), treemap) : tile; - }; - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingInner; - }; - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingTop; - }; - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingRight; - }; - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingBottom; - }; - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingLeft; - }; - return treemap; - }); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _squarifyJs = require("./squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./round.js":"4XKsQ","./squarify.js":"6L9bi","../accessors.js":"jK6n5","../constant.js":"72P4a","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6L9bi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "phi", ()=>phi); -parcelHelpers.export(exports, "squarifyRatio", ()=>squarifyRatio); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var phi = (1 + Math.sqrt(5)) / 2; -function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; - while(i0 < n){ - dx = x1 - x0, dy = y1 - y0; - // Find the next non-empty node. - do sumValue = nodes[i1++].value; - while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - // Keep adding nodes while the aspect ratio maintains or improves. - for(; i1 < n; ++i1){ - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { - sumValue -= nodeValue; - break; - } - minRatio = newRatio; - } - // Position and record the row orientation. - rows.push(row = { - value: sumValue, - dice: dx < dy, - children: nodes.slice(i0, i1) - }); - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; + rect(x2, y2, w2, h2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${+w2}v${+h2}h${-w2}Z`; } - return rows; -} -exports.default = function custom(ratio) { - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); + value() { + return this._ || null; } - squarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - return squarify; -}(phi); - -},{"./dice.js":"5Coec","./slice.js":"bB6OY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bB6OY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value; - while(++i < n){ - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lIsJs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1); - for(sums[0] = sum = i = 0; i < n; ++i)sums[i + 1] = sum += nodes[i].value; - partition(0, n, parent.value, x0, y0, x1, y1); - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - var valueOffset = sums[i], valueTarget = value / 2 + valueOffset, k = i + 1, hi = j - 1; - while(k < hi){ - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1; - else hi = mid; - } - if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i + 1 < k) --k; - var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft; - if (x1 - x0 > y1 - y0) { - var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lS2RY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? (0, _sliceJsDefault.default) : (0, _diceJsDefault.default))(parent, x0, y0, x1, y1); - }); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); - -},{"./dice.js":"5Coec","./slice.js":"bB6OY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3C5OD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _squarifyJs = require("./squarify.js"); -exports.default = function custom(ratio) { - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && rows.ratio === ratio) { - var rows, row, nodes, i, j = -1, n, m = rows.length, value = parent.value; - while(++j < m){ - row = rows[j], nodes = row.children; - for(i = row.value = 0, n = nodes.length; i < n; ++i)row.value += nodes[i].value; - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1); - value -= row.value; - } - } else { - parent._squarify = rows = (0, _squarifyJs.squarifyRatio)(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; - } + } + class Polygon { + constructor() { + this._ = []; } - resquarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - return resquarify; -}((0, _squarifyJs.phi)); - -},{"./dice.js":"5Coec","./slice.js":"bB6OY","./squarify.js":"6L9bi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"htBqA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "label", ()=>Label); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -// bit mask for getting first 2 bytes of alpha value -const ALPHA_MASK = 0xff000000; -function baseBitmaps($, data) { - const bitmap = $.bitmap(); - // when there is no base mark but data points are to be avoided - (data || []).forEach((d)=>bitmap.set($(d.boundary[0]), $(d.boundary[3]))); - return [ - bitmap, - undefined - ]; -} -function markBitmaps($, baseMark, avoidMarks, labelInside, isGroupArea) { - // create canvas - const width = $.width, height = $.height, border = labelInside || isGroupArea, context = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), baseMarkContext = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), strokeContext = border && (0, _vegaCanvas.canvas)(width, height).getContext('2d'); - // render all marks to be avoided into canvas - avoidMarks.forEach((items)=>draw(context, items, false)); - draw(baseMarkContext, baseMark, false); - if (border) draw(strokeContext, baseMark, true); - // get canvas buffer, create bitmaps - const buffer = getBuffer(context, width, height), baseMarkBuffer = getBuffer(baseMarkContext, width, height), strokeBuffer = border && getBuffer(strokeContext, width, height), layer1 = $.bitmap(), layer2 = border && $.bitmap(); - // populate bitmap layers - let x, y, u, v, index, alpha, strokeAlpha, baseMarkAlpha; - for(y = 0; y < height; ++y)for(x = 0; x < width; ++x){ - index = y * width + x; - alpha = buffer[index] & ALPHA_MASK; - baseMarkAlpha = baseMarkBuffer[index] & ALPHA_MASK; - strokeAlpha = border && strokeBuffer[index] & ALPHA_MASK; - if (alpha || strokeAlpha || baseMarkAlpha) { - u = $(x); - v = $(y); - if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u, v); // update interior bitmap - if (border && (alpha || strokeAlpha)) layer2.set(u, v); // update border bitmap - } + moveTo(x2, y2) { + this._.push([x2, y2]); } - return [ - layer1, - layer2 - ]; -} -function getBuffer(context, width, height) { - return new Uint32Array(context.getImageData(0, 0, width, height).data.buffer); -} -function draw(context, items, interior) { - if (!items.length) return; - const type = items[0].mark.marktype; - if (type === 'group') items.forEach((group)=>{ - group.items.forEach((mark)=>draw(context, mark.items, interior)); - }); - else (0, _vegaScenegraph.Marks)[type].draw(context, { - items: interior ? items.map(prepare) : items - }); -} -/** - * Prepare item before drawing into canvas (setting stroke and opacity) - * @param {object} source item to be prepared - * @returns prepared item - */ function prepare(source) { - const item = (0, _vegaDataflow.rederive)(source, {}); - if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) return { - ...item, - strokeOpacity: 1, - stroke: '#000', - fillOpacity: 0 - }; - return item; -} -const DIV = 5, // bit shift from x, y index to bit vector array index -MOD = 31, // bit mask for index lookup within a bit vector -SIZE = 32, // individual bit vector size -RIGHT0 = new Uint32Array(SIZE + 1), // left-anchored bit vectors, full -> 0 -RIGHT1 = new Uint32Array(SIZE + 1); // right-anchored bit vectors, 0 -> full -RIGHT1[0] = 0; -RIGHT0[0] = ~RIGHT1[0]; -for(let i = 1; i <= SIZE; ++i){ - RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; - RIGHT0[i] = ~RIGHT1[i]; -} -function Bitmap(w, h) { - const array = new Uint32Array(~~((w * h + SIZE) / SIZE)); - function _set(index, mask) { - array[index] |= mask; + closePath() { + this._.push(this._[0].slice()); } - function _clear(index, mask) { - array[index] &= mask; + lineTo(x2, y2) { + this._.push([x2, y2]); } - return { - array: array, - get: (x, y)=>{ - const index = y * w + x; - return array[index >>> DIV] & 1 << (index & MOD); - }, - set: (x, y)=>{ - const index = y * w + x; - _set(index >>> DIV, 1 << (index & MOD)); - }, - clear: (x, y)=>{ - const index = y * w + x; - _clear(index >>> DIV, ~(1 << (index & MOD))); - }, - getRange: (x, y, x2, y2)=>{ - let r = y2, start, end, indexStart, indexEnd; - for(; r >= y; --r){ - start = r * w + x; - end = r * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) { - if (array[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) return true; - } else { - if (array[indexStart] & RIGHT0[start & MOD]) return true; - if (array[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; - for(let i = indexStart + 1; i < indexEnd; ++i){ - if (array[i]) return true; - } - } - } - return false; - }, - setRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); - else { - _set(indexStart, RIGHT0[start & MOD]); - _set(indexEnd, RIGHT1[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_set(i, 0xffffffff); - } - } - }, - clearRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); - else { - _clear(indexStart, RIGHT1[start & MOD]); - _clear(indexEnd, RIGHT0[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_clear(i, 0); - } - } - }, - outOfBounds: (x, y, x2, y2)=>x < 0 || y < 0 || y2 >= h || x2 >= w - }; -} -function scaler(width, height, padding) { - const ratio = Math.max(1, Math.sqrt(width * height / 1e6)), w = ~~((width + 2 * padding + ratio) / ratio), h = ~~((height + 2 * padding + ratio) / ratio), scale = (_)=>~~((_ + padding) / ratio); - scale.invert = (_)=>_ * ratio - padding; - scale.bitmap = ()=>Bitmap(w, h); - scale.ratio = ratio; - scale.padding = padding; - scale.width = width; - scale.height = height; - return scale; -} -function placeAreaLabelNaive($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height; - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxAreaWidth = 0, x1, x2, y1, y2, x, y, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - areaWidth = Math.abs(x2 - x1 + y2 - y1); - if (areaWidth >= maxAreaWidth) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - } - } - x = textWidth / 2; - y = textHeight / 2; - x1 = d.x - x; - x2 = d.x + x; - y1 = d.y - y; - y2 = d.y + y; - d.align = 'center'; - if (x1 < 0 && x2 <= width) d.align = 'left'; - else if (0 <= x1 && width < x2) d.align = 'right'; - d.baseline = 'middle'; - if (y1 < 0 && y2 <= height) d.baseline = 'top'; - else if (0 <= y1 && height < y2) d.baseline = 'bottom'; - return true; - }; -} -function outOfBounds(x, y, textWidth, textHeight, width, height) { - let r = textWidth / 2; - return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height; -} -function collision($, x, y, textHeight, textWidth, h, bm0, bm1) { - const w = textWidth * h / (textHeight * 2), x1 = $(x - w), x2 = $(x + w), y1 = $(y - (h = h / 2)), y2 = $(y + h); - return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2); -} -function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1]; // area outlines - function tryLabel(_x, _y, maxSize, textWidth, textHeight) { - const x = $.invert(_x), y = $.invert(_y); - let lo = maxSize, hi = height, mid; - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) return [ - x, - y, - lo, - true - ]; - } + value() { + return this._.length ? this._ : null; } - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - if (x1 > x2) { - swapTmp = x1; - x1 = x2; - x2 = swapTmp; - } - if (y1 > y2) { - swapTmp = y1; - y1 = y2; - y2 = swapTmp; - } - _x1 = $(x1); - _x2 = $(x2); - _xMid = ~~((_x1 + _x2) / 2); - _y1 = $(y1); - _y2 = $(y2); - _yMid = ~~((_y1 + _y2) / 2); - // search along the line from mid point between the 2 border to lower border - for(_x = _xMid; _x >= _x1; --_x)for(_y = _yMid; _y >= _y1; --_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // search along the line from mid point between the 2 border to upper border - for(_x = _xMid; _x <= _x2; ++_x)for(_y = _yMid; _y <= _y2; ++_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } - } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; - }; -} -// pixel direction offsets for flood fill search -const X_DIR = [ - -1, - -1, - 1, - 1 -]; -const Y_DIR = [ - -1, - 1, - -1, - 1 -]; -function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1], // area outlines - bm2 = $.bitmap(); // flood-fill visitations - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text), // label height - stack = []; // flood fill stack - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, lo, hi, mid, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - // add scaled center point to stack - stack.push([ - $((x1 + x2) / 2), - $((y1 + y2) / 2) - ]); - // perform flood fill, visit points - while(stack.length){ - [_x, _y] = stack.pop(); - // exit if point already marked - if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; - // mark point in flood fill bitmap - // add search points for all (in bound) directions - bm2.set(_x, _y); - for(let j = 0; j < 4; ++j){ - x = _x + X_DIR[j]; - y = _y + Y_DIR[j]; - if (!bm2.outOfBounds(x, y, x, y)) stack.push([ - x, - y - ]); - } - // unscale point back to x, y space - x = $.invert(_x); - y = $.invert(_y); - lo = maxSize; - hi = height; // TODO: make this bound smaller - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) { - d.x = x; - d.y = y; - maxSize = lo; - labelPlaced = true; - } - } - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } - } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; - }; -} -const Aligns = [ - 'right', - 'center', - 'left' -], Baselines = [ - 'bottom', - 'middle', - 'top' -]; -function placeMarkLabel($, bitmaps, anchors, offsets) { - const width = $.width, height = $.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets.length; - return function(d) { - const boundary = d.boundary, textHeight = d.datum.fontSize; - // can not be placed if the mark is not visible in the graph bound - if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) return false; - let textWidth = d.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x1, x2, y1, y2, xc, yc, _x1, _x2, _y1, _y2; - // for each anchor and offset - for(let i = 0; i < n; ++i){ - dx = (anchors[i] & 0x3) - 1; - dy = (anchors[i] >>> 0x2 & 0x3) - 1; - isInside = dx === 0 && dy === 0 || offsets[i] < 0; - sizeFactor = dx && dy ? Math.SQRT1_2 : 1; - insideFactor = offsets[i] < 0 ? -1 : 1; - x1 = boundary[1 + dx] + offsets[i] * dx * sizeFactor; - yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets[i] * dy * sizeFactor; - y1 = yc - textHeight / 2; - y2 = yc + textHeight / 2; - _x1 = $(x1); - _y1 = $(y1); - _y2 = $(y2); - if (!textWidth) { - // to avoid finding width of text label, - if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) continue; - else // Otherwise, find the label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); - } - xc = x1 + insideFactor * textWidth * dx / 2; - x1 = xc - textWidth / 2; - x2 = xc + textWidth / 2; - _x1 = $(x1); - _x2 = $(x2); - if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) { - // place label if the position is placeable - d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1; - d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1; - d.align = Aligns[dx * insideFactor + 1]; - d.baseline = Baselines[dy * insideFactor + 1]; - bm0.setRange(_x1, _y1, _x2, _y2); - return true; + } + let Voronoi$1 = class Voronoi { + constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { + if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); + this.delaunay = delaunay; + this._circumcenters = new Float64Array(delaunay.points.length * 2); + this.vectors = new Float64Array(delaunay.points.length * 2); + this.xmax = xmax, this.xmin = xmin; + this.ymax = ymax, this.ymin = ymin; + this._init(); + } + update() { + this.delaunay.update(); + this._init(); + return this; + } + _init() { + const { delaunay: { points: points2, hull, triangles }, vectors } = this; + let bx, by; + const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); + for (let i = 0, j = 0, n = triangles.length, x2, y2; i < n; i += 3, j += 2) { + const t12 = triangles[i] * 2; + const t22 = triangles[i + 1] * 2; + const t32 = triangles[i + 2] * 2; + const x13 = points2[t12]; + const y13 = points2[t12 + 1]; + const x22 = points2[t22]; + const y22 = points2[t22 + 1]; + const x3 = points2[t32]; + const y3 = points2[t32 + 1]; + const dx = x22 - x13; + const dy = y22 - y13; + const ex = x3 - x13; + const ey = y3 - y13; + const ab = (dx * ey - dy * ex) * 2; + if (Math.abs(ab) < 1e-9) { + if (bx === void 0) { + bx = by = 0; + for (const i2 of hull) bx += points2[i2 * 2], by += points2[i2 * 2 + 1]; + bx /= hull.length, by /= hull.length; + } + const a2 = 1e9 * Math.sign((bx - x13) * ey - (by - y13) * ex); + x2 = (x13 + x3) / 2 - a2 * ey; + y2 = (y13 + y3) / 2 + a2 * ex; + } else { + const d2 = 1 / ab; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + x2 = x13 + (ey * bl2 - dy * cl) * d2; + y2 = y13 + (dx * cl - ex * bl2) * d2; + } + circumcenters[j] = x2; + circumcenters[j + 1] = y2; + } + let h2 = hull[hull.length - 1]; + let p02, p1 = h2 * 4; + let x02, x12 = points2[2 * h2]; + let y02, y12 = points2[2 * h2 + 1]; + vectors.fill(0); + for (let i = 0; i < hull.length; ++i) { + h2 = hull[i]; + p02 = p1, x02 = x12, y02 = y12; + p1 = h2 * 4, x12 = points2[2 * h2], y12 = points2[2 * h2 + 1]; + vectors[p02 + 2] = vectors[p1] = y02 - y12; + vectors[p02 + 3] = vectors[p1 + 1] = x12 - x02; + } + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; + if (hull.length <= 1) return null; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = Math.floor(i / 3) * 2; + const tj = Math.floor(j / 3) * 2; + const xi = circumcenters[ti]; + const yi = circumcenters[ti + 1]; + const xj = circumcenters[tj]; + const yj = circumcenters[tj + 1]; + this._renderSegment(xi, yi, xj, yj, context2); + } + let h0, h1 = hull[hull.length - 1]; + for (let i = 0; i < hull.length; ++i) { + h0 = h1, h1 = hull[i]; + const t = Math.floor(inedges[h1] / 3) * 2; + const x2 = circumcenters[t]; + const y2 = circumcenters[t + 1]; + const v = h0 * 4; + const p = this._project(x2, y2, vectors[v + 2], vectors[v + 3]); + if (p) this._renderSegment(x2, y2, p[0], p[1], context2); + } + return buffer && buffer.value(); + } + renderBounds(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + context2.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); + return buffer && buffer.value(); + } + renderCell(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const points2 = this._clip(i); + if (points2 === null || !points2.length) return; + context2.moveTo(points2[0], points2[1]); + let n = points2.length; + while (points2[0] === points2[n - 2] && points2[1] === points2[n - 1] && n > 1) n -= 2; + for (let i2 = 2; i2 < n; i2 += 2) { + if (points2[i2] !== points2[i2 - 2] || points2[i2 + 1] !== points2[i2 - 1]) + context2.lineTo(points2[i2], points2[i2 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + *cellPolygons() { + const { delaunay: { points: points2 } } = this; + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const cell2 = this.cellPolygon(i); + if (cell2) cell2.index = i, yield cell2; + } + } + cellPolygon(i) { + const polygon = new Polygon(); + this.renderCell(i, polygon); + return polygon.value(); + } + _renderSegment(x02, y02, x12, y12, context2) { + let S; + const c0 = this._regioncode(x02, y02); + const c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + context2.moveTo(x02, y02); + context2.lineTo(x12, y12); + } else if (S = this._clipSegment(x02, y02, x12, y12, c0, c1)) { + context2.moveTo(S[0], S[1]); + context2.lineTo(S[2], S[3]); + } + } + contains(i, x2, y2) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return false; + return this.delaunay._step(i, x2, y2) === i; + } + *neighbors(i) { + const ci = this._clip(i); + if (ci) for (const j of this.delaunay.neighbors(i)) { + const cj = this._clip(j); + if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { + for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { + if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { + yield j; + break loop; } + } } - return false; - }; -} -// Test if a label with the given dimensions can be added without overlap -function test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) { - return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); -} -// 8-bit representation of anchors -const TOP = 0x0, MIDDLE = 0x4, BOTTOM = 0x8, LEFT = 0x0, CENTER = 0x1, RIGHT = 0x2; -// Mapping from text anchor to number representation -const anchorCode = { - 'top-left': TOP + LEFT, - 'top': TOP + CENTER, - 'top-right': TOP + RIGHT, - 'left': MIDDLE + LEFT, - 'middle': MIDDLE + CENTER, - 'right': MIDDLE + RIGHT, - 'bottom-left': BOTTOM + LEFT, - 'bottom': BOTTOM + CENTER, - 'bottom-right': BOTTOM + RIGHT -}; -const placeAreaLabel = { - 'naive': placeAreaLabelNaive, - 'reduced-search': placeAreaLabelReducedSearch, - 'floodfill': placeAreaLabelFloodFill -}; -function labelLayout(texts, size, compare, offset, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding, method) { - // early exit for empty data - if (!texts.length) return texts; - const positions = Math.max(offset.length, anchor.length), offsets = getOffsets(offset, positions), anchors = getAnchors(anchor, positions), marktype = markType(texts[0].datum), grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === 'area', boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding === null || padding === Infinity, isNaiveGroupArea = isGroupArea && method === 'naive'; - let maxTextWidth = -1, maxTextHeight = -1; - // prepare text mark data for placing - const data = texts.map((d)=>{ - const textWidth = infPadding ? (0, _vegaScenegraph.textMetrics).width(d, d.text) : undefined; - maxTextWidth = Math.max(maxTextWidth, textWidth); - maxTextHeight = Math.max(maxTextHeight, d.fontSize); - return { - datum: d, - opacity: 0, - x: undefined, - y: undefined, - align: undefined, - baseline: undefined, - boundary: boundary(d), - textWidth - }; - }); - padding = padding === null || padding === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset) : padding; - const $ = scaler(size[0], size[1], padding); - let bitmaps; - if (!isNaiveGroupArea) { - // sort labels in priority order, if comparator is provided - if (compare) data.sort((a, b)=>compare(a.datum, b.datum)); - // flag indicating if label can be placed inside its base mark - let labelInside = false; - for(let i = 0; i < anchors.length && !labelInside; ++i)// label inside if anchor is at center - // label inside if offset to be inside the mark bound - labelInside = anchors[i] === 0x5 || offsets[i] < 0; - // extract data information from base mark when base mark is to be avoided - // base mark is implicitly avoided if it is a group area - const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d)=>d.datum); - // generate bitmaps for layout calculation - bitmaps = avoidMarks.length || baseMark ? markBitmaps($, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data); - } - // generate label placement function - const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets); - // place all labels - data.forEach((d)=>d.opacity = +place(d)); - return data; -} -function getOffsets(_, count) { - const offsets = new Float64Array(count), n = _.length; - for(let i = 0; i < n; ++i)offsets[i] = _[i] || 0; - for(let i = n; i < count; ++i)offsets[i] = offsets[n - 1]; - return offsets; -} -function getAnchors(_, count) { - const anchors = new Int8Array(count), n = _.length; - for(let i = 0; i < n; ++i)anchors[i] |= anchorCode[_[i]]; - for(let i = n; i < count; ++i)anchors[i] = anchors[n - 1]; - return anchors; -} -function markType(item) { - return item && item.mark && item.mark.marktype; -} -/** - * Factory function for function for getting base mark boundary, depending - * on mark and group type. When mark type is undefined, line or area: boundary - * is the coordinate of each data point. When base mark is grouped line, - * boundary is either at the start or end of the line depending on the - * value of lineAnchor. Otherwise, use bounds of base mark. - */ function markBoundary(marktype, grouptype, lineAnchor, markIndex) { - const xy = (d)=>[ - d.x, - d.x, - d.x, - d.y, - d.y, - d.y - ]; - if (!marktype) return xy; // no reactive geometry - else if (marktype === 'line' || marktype === 'area') return (d)=>xy(d.datum); - else if (grouptype === 'line') return (d)=>{ - const items = d.datum.items[markIndex].items; - return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : { - x: NaN, - y: NaN - }); - }; - else return (d)=>{ - const b = d.datum.bounds; - return [ - b.x1, - (b.x1 + b.x2) / 2, - b.x2, - b.y1, - (b.y1 + b.y2) / 2, - b.y2 - ]; - }; -} -const Output = [ - 'x', - 'y', - 'opacity', - 'align', - 'baseline' -]; -const Anchors = [ - 'top-left', - 'left', - 'bottom-left', - 'top', - 'bottom', - 'top-right', - 'right', - 'bottom-right' -]; -/** - * Compute text label layout to annotate marks. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The size of the layout, provided as a [width, height] array. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting label data in priority order. - * @param {Array<string>} [params.anchor] - Label anchor points relative to the base mark bounding box. - * The available options are 'top-left', 'left', 'bottom-left', 'top', - * 'bottom', 'top-right', 'right', 'bottom-right', 'middle'. - * @param {Array<number>} [params.offset] - Label offsets (in pixels) from the base mark bounding box. - * This parameter is parallel to the list of anchor points. - * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size. - * If this parameter is null, a label may exceed the layout size without any boundary. - * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor - * position for labels. One of 'start' or 'end'. - * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating - * which mark within the group should be labeled. - * @param {Array<number>} [params.avoidMarks] - A list of additional mark names for which the label - * layout should avoid overlap. - * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid - * overlap with the underlying base mark being labeled. - * @param {string} [params.method='naive'] - For area make labels only, a method for - * place labels. One of 'naive', 'reduced-search', or 'floodfill'. - * @param {Array<string>} [params.as] - The output fields written by the transform. - * The default is ['x', 'y', 'opacity', 'align', 'baseline']. - */ function Label(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Label.Definition = { - type: 'Label', - metadata: { - modifies: true - }, - params: [ - { - name: 'size', - type: 'number', - array: true, - length: 2, - required: true - }, - { - name: 'sort', - type: 'compare' - }, - { - name: 'anchor', - type: 'string', - array: true, - default: Anchors - }, - { - name: 'offset', - type: 'number', - array: true, - default: [ - 1 - ] - }, - { - name: 'padding', - type: 'number', - default: 0, - null: true - }, - { - name: 'lineAnchor', - type: 'string', - values: [ - 'start', - 'end' - ], - default: 'end' - }, - { - name: 'markIndex', - type: 'number', - default: 0 - }, - { - name: 'avoidBaseMark', - type: 'boolean', - default: true - }, - { - name: 'avoidMarks', - type: 'data', - array: true - }, - { - name: 'method', - type: 'string', - default: 'naive' - }, - { - name: 'as', - type: 'string', - array: true, - length: Output.length, - default: Output - } - ] -}; -(0, _vegaUtil.inherits)(Label, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || modp('sort'))) return; - if (!_.size || _.size.length !== 2) (0, _vegaUtil.error)('Size parameter should be specified as a [width, height] array.'); - const as = _.as || Output; - // run label layout - labelLayout(pulse.materialize(pulse.SOURCE).source || [], _.size, _.sort, (0, _vegaUtil.array)(_.offset == null ? 1 : _.offset), (0, _vegaUtil.array)(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || 'end', _.markIndex || 0, _.padding === undefined ? 0 : _.padding, _.method || 'naive').forEach((l)=>{ - // write layout results to data stream - const t = l.datum; - t[as[0]] = l.x; - t[as[1]] = l.y; - t[as[2]] = l.opacity; - t[as[3]] = l.align; - t[as[4]] = l.baseline; - }); - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-scenegraph":"gJqm6","vega-canvas":"4O1hR","vega-dataflow":"cFRfY","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c1OiC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loess", ()=>Loess); -parcelHelpers.export(exports, "regression", ()=>Regression); -var _vegaStatistics = require("vega-statistics"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -function partition(data, groupby) { - var groups = [], get = function(f) { - return f(t); - }, map, i, n, t, k, g; - // partition data points into stack groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - g.push(t); + } } - return groups; -} -/** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ function Loess(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Loess.Definition = { - 'type': 'Loess', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0.3 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Loess, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), m = names.length, as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], values = []; - groups.forEach((g)=>{ - (0, _vegaStatistics.regressionLoess)(g, _.x, _.y, _.bandwidth || 0.3).forEach((p)=>{ - const t = {}; - for(let i = 0; i < m; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + _cell(i) { + const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; + const e0 = inedges[i]; + if (e0 === -1) return null; + const points2 = []; + let e = e0; + do { + const t = Math.floor(e / 3); + points2.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + } while (e !== e0 && e !== -1); + return points2; + } + _clip(i) { + if (i === 0 && this.delaunay.hull.length === 1) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + const points2 = this._cell(i); + if (points2 === null) return null; + const { vectors: V } = this; + const v = i * 4; + return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points2, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points2)); + } + _clipFinite(i, points2) { + const n = points2.length; + let P = null; + let x02, y02, x12 = points2[n - 2], y12 = points2[n - 1]; + let c0, c1 = this._regioncode(x12, y12); + let e0, e1 = 0; + for (let j = 0; j < n; j += 2) { + x02 = x12, y02 = y12, x12 = points2[j], y12 = points2[j + 1]; + c0 = c1, c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + e0 = e1, e1 = 0; + if (P) P.push(x12, y12); + else P = [x12, y12]; + } else { + let S, sx0, sy0, sx1, sy1; + if (c0 === 0) { + if ((S = this._clipSegment(x02, y02, x12, y12, c0, c1)) === null) continue; + [sx0, sy0, sx1, sy1] = S; + } else { + if ((S = this._clipSegment(x12, y12, x02, y02, c1, c0)) === null) continue; + [sx1, sy1, sx0, sy0] = S; + e0 = e1, e1 = this._edgecode(sx0, sy0); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx0, sy0); + else P = [sx0, sy0]; + } + e0 = e1, e1 = this._edgecode(sx1, sy1); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx1, sy1); + else P = [sx1, sy1]; } - return out; + } + if (P) { + e0 = e1, e1 = this._edgecode(P[0], P[1]); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + return P; + } + _clipSegment(x02, y02, x12, y12, c0, c1) { + const flip2 = c0 < c1; + if (flip2) [x02, y02, x12, y12, c0, c1] = [x12, y12, x02, y02, c1, c0]; + while (true) { + if (c0 === 0 && c1 === 0) return flip2 ? [x12, y12, x02, y02] : [x02, y02, x12, y12]; + if (c0 & c1) return null; + let x2, y2, c2 = c0 || c1; + if (c2 & 8) x2 = x02 + (x12 - x02) * (this.ymax - y02) / (y12 - y02), y2 = this.ymax; + else if (c2 & 4) x2 = x02 + (x12 - x02) * (this.ymin - y02) / (y12 - y02), y2 = this.ymin; + else if (c2 & 2) y2 = y02 + (y12 - y02) * (this.xmax - x02) / (x12 - x02), x2 = this.xmax; + else y2 = y02 + (y12 - y02) * (this.xmin - x02) / (x12 - x02), x2 = this.xmin; + if (c0) x02 = x2, y02 = y2, c0 = this._regioncode(x02, y02); + else x12 = x2, y12 = y2, c1 = this._regioncode(x12, y12); + } } -}); -const Methods = { - constant: (0, _vegaStatistics.regressionConstant), - linear: (0, _vegaStatistics.regressionLinear), - log: (0, _vegaStatistics.regressionLog), - exp: (0, _vegaStatistics.regressionExp), - pow: (0, _vegaStatistics.regressionPow), - quad: (0, _vegaStatistics.regressionQuad), - poly: (0, _vegaStatistics.regressionPoly) -}; -const degreesOfFreedom = (method, order)=>method === 'poly' ? order : method === 'quad' ? 2 : 1; -/** - * Compute regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {string} [params.method='linear'] - The regression method to apply. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<number>} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ function Regression(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Regression.Definition = { - 'type': 'Regression', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'linear', - 'values': Object.keys(Methods) - }, - { - 'name': 'order', - 'type': 'number', - 'default': 3 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'params', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true + _clipInfinite(i, points2, vx0, vy0, vxn, vyn) { + let P = Array.from(points2), p; + if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); + if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); + if (P = this._clipFinite(i, P)) { + for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { + c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); + if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; + } + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; + } + return P; + } + _edge(i, e0, e1, P, j) { + while (e0 !== e1) { + let x2, y2; + switch (e0) { + case 5: + e0 = 4; + continue; + // top-left + case 4: + e0 = 6, x2 = this.xmax, y2 = this.ymin; + break; + // top + case 6: + e0 = 2; + continue; + // top-right + case 2: + e0 = 10, x2 = this.xmax, y2 = this.ymax; + break; + // right + case 10: + e0 = 8; + continue; + // bottom-right + case 8: + e0 = 9, x2 = this.xmin, y2 = this.ymax; + break; + // bottom + case 9: + e0 = 1; + continue; + // bottom-left + case 1: + e0 = 5, x2 = this.xmin, y2 = this.ymin; + break; } - ] -}; -(0, _vegaUtil.inherits)(Regression, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), method = _.method || 'linear', order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method, order), as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], fit = Methods[method], values = []; - let domain = _.extent; - if (!(0, _vegaUtil.hasOwnProperty)(Methods, method)) (0, _vegaUtil.error)('Invalid regression method: ' + method); - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - groups.forEach((g)=>{ - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - const model = fit(g, _.x, _.y, order); - if (_.params) { - // if parameter vectors requested return those - values.push((0, _vegaDataflow.ingest)({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - const dom = domain || (0, _vegaUtil.extent)(g, _.x), add = (p)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }; - if (method === 'linear' || method === 'constant') // for linear or constant regression we only need the end points - dom.forEach((x)=>add([ - x, - model.predict(x) - ])); - else // otherwise return trend line sample points - (0, _vegaStatistics.sampleCurve)(model.predict, dom, 25, 200).forEach(add); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + if ((P[j] !== x2 || P[j + 1] !== y2) && this.contains(i, x2, y2)) { + P.splice(j, 0, x2, y2), j += 2; } - return out; + } + return j; + } + _project(x02, y02, vx, vy) { + let t = Infinity, c2, x2, y2; + if (vy < 0) { + if (y02 <= this.ymin) return null; + if ((c2 = (this.ymin - y02) / vy) < t) y2 = this.ymin, x2 = x02 + (t = c2) * vx; + } else if (vy > 0) { + if (y02 >= this.ymax) return null; + if ((c2 = (this.ymax - y02) / vy) < t) y2 = this.ymax, x2 = x02 + (t = c2) * vx; + } + if (vx > 0) { + if (x02 >= this.xmax) return null; + if ((c2 = (this.xmax - x02) / vx) < t) x2 = this.xmax, y2 = y02 + (t = c2) * vy; + } else if (vx < 0) { + if (x02 <= this.xmin) return null; + if ((c2 = (this.xmin - x02) / vx) < t) x2 = this.xmin, y2 = y02 + (t = c2) * vy; + } + return [x2, y2]; } -}); - -},{"vega-statistics":"4QSQj","vega-dataflow":"cFRfY","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g4ZwP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "voronoi", ()=>Voronoi); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Delaunay = require("d3-delaunay"); -function Voronoi(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Voronoi.Definition = { - 'type': 'Voronoi', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'default': [ - [ - -100000, - -100000 - ], - [ - 1e5, - 1e5 - ] - ], - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -const defaultExtent = [ - -100000, - -100000, - 1e5, - 1e5 -]; -(0, _vegaUtil.inherits)(Voronoi, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const as = _.as || 'path', data = pulse.source; - // nothing to do if no data - if (!data || !data.length) return pulse; - // configure and construct voronoi diagram - let s = _.size; - s = s ? [ - 0, - 0, - s[0], - s[1] - ] : (s = _.extent) ? [ - s[0][0], - s[0][1], - s[1][0], - s[1][1] - ] : defaultExtent; - const voronoi = this.value = (0, _d3Delaunay.Delaunay).from(data, _.x, _.y).voronoi(s); - // map polygons to paths - for(let i = 0, n = data.length; i < n; ++i){ - const polygon = voronoi.cellPolygon(i); - data[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; - } - return pulse.reflow(_.modified()).modifies(as); - } -}); -// suppress duplicated end point vertices -function toPathString(p) { - const x = p[0][0], y = p[0][1]; - let n = p.length - 1; - for(; p[n][0] === x && p[n][1] === y; --n); - return 'M' + p.slice(0, n + 1).join('L') + 'Z'; -} -function isPoint(p) { - return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; -} - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-delaunay":"7xaDA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7xaDA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Delaunay", ()=>(0, _delaunayJsDefault.default)); -parcelHelpers.export(exports, "Voronoi", ()=>(0, _voronoiJsDefault.default)); -var _delaunayJs = require("./delaunay.js"); -var _delaunayJsDefault = parcelHelpers.interopDefault(_delaunayJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); - -},{"./delaunay.js":"hjOX3","./voronoi.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hjOX3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _delaunator = require("delaunator"); -var _delaunatorDefault = parcelHelpers.interopDefault(_delaunator); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); -const tau = 2 * Math.PI, pow = Math.pow; -function pointX(p) { + _edgecode(x2, y2) { + return (x2 === this.xmin ? 1 : x2 === this.xmax ? 2 : 0) | (y2 === this.ymin ? 4 : y2 === this.ymax ? 8 : 0); + } + _regioncode(x2, y2) { + return (x2 < this.xmin ? 1 : x2 > this.xmax ? 2 : 0) | (y2 < this.ymin ? 4 : y2 > this.ymax ? 8 : 0); + } + _simplify(P) { + if (P && P.length > 4) { + for (let i = 0; i < P.length; i += 2) { + const j = (i + 2) % P.length, k = (i + 4) % P.length; + if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) { + P.splice(j, 2), i -= 2; + } + } + if (!P.length) P = null; + } + return P; + } + }; + const tau = 2 * Math.PI, pow = Math.pow; + function pointX(p) { return p[0]; -} -function pointY(p) { + } + function pointY(p) { return p[1]; -} -// A triangulation is collinear if all its triangles have a non-null area -function collinear(d) { - const { triangles, coords } = d; - for(let i = 0; i < triangles.length; i += 3){ - const a = 2 * triangles[i], b = 2 * triangles[i + 1], c = 2 * triangles[i + 2], cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; + } + function collinear(d2) { + const { triangles, coords } = d2; + for (let i = 0; i < triangles.length; i += 3) { + const a2 = 2 * triangles[i], b2 = 2 * triangles[i + 1], c2 = 2 * triangles[i + 2], cross2 = (coords[c2] - coords[a2]) * (coords[b2 + 1] - coords[a2 + 1]) - (coords[b2] - coords[a2]) * (coords[c2 + 1] - coords[a2 + 1]); + if (cross2 > 1e-10) return false; } return true; -} -function jitter(x, y, r) { - return [ - x + Math.sin(x + y) * r, - y + Math.cos(x - y) * r - ]; -} -class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points){ - this._delaunator = new (0, _delaunatorDefault.default)(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); + } + function jitter(x2, y2, r) { + return [x2 + Math.sin(x2 + y2) * r, y2 + Math.cos(x2 - y2) * r]; + } + class Delaunay { + static from(points2, fx = pointX, fy = pointY, that) { + return new Delaunay("length" in points2 ? flatArray(points2, fx, fy, that) : Float64Array.from(flatIterable(points2, fx, fy, that))); + } + constructor(points2) { + this._delaunator = new Delaunator(points2); + this.inedges = new Int32Array(points2.length / 2); + this._hullIndex = new Int32Array(points2.length / 2); + this.points = this._delaunator.coords; + this._init(); } update() { - this._delaunator.update(); - this._init(); - return this; + this._delaunator.update(); + this._init(); + return this; + } + _init() { + const d2 = this._delaunator, points2 = this.points; + if (d2.hull && d2.hull.length > 2 && collinear(d2)) { + this.collinear = Int32Array.from({ length: points2.length / 2 }, (_, i) => i).sort((i, j) => points2[2 * i] - points2[2 * j] || points2[2 * i + 1] - points2[2 * j + 1]); + const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds2 = [points2[2 * e], points2[2 * e + 1], points2[2 * f], points2[2 * f + 1]], r = 1e-8 * Math.hypot(bounds2[3] - bounds2[1], bounds2[2] - bounds2[0]); + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const p = jitter(points2[2 * i], points2[2 * i + 1], r); + points2[2 * i] = p[0]; + points2[2 * i + 1] = p[1]; + } + this._delaunator = new Delaunator(points2); + } else { + delete this.collinear; + } + const halfedges = this.halfedges = this._delaunator.halfedges; + const hull = this.hull = this._delaunator.hull; + const triangles = this.triangles = this._delaunator.triangles; + const inedges = this.inedges.fill(-1); + const hullIndex = this._hullIndex.fill(-1); + for (let e = 0, n = halfedges.length; e < n; ++e) { + const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; + if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; + } + for (let i = 0, n = hull.length; i < n; ++i) { + hullIndex[hull[i]] = i; + } + if (hull.length <= 2 && hull.length > 0) { + this.triangles = new Int32Array(3).fill(-1); + this.halfedges = new Int32Array(3).fill(-1); + this.triangles[0] = hull[0]; + inedges[hull[0]] = 1; + if (hull.length === 2) { + inedges[hull[1]] = 0; + this.triangles[1] = hull[1]; + this.triangles[2] = hull[1]; + } + } + } + voronoi(bounds2) { + return new Voronoi$1(this, bounds2); + } + *neighbors(i) { + const { inedges, hull, _hullIndex, halfedges, triangles, collinear: collinear2 } = this; + if (collinear2) { + const l = collinear2.indexOf(i); + if (l > 0) yield collinear2[l - 1]; + if (l < collinear2.length - 1) yield collinear2[l + 1]; + return; + } + const e0 = inedges[i]; + if (e0 === -1) return; + let e = e0, p02 = -1; + do { + yield p02 = triangles[e]; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) return; + e = halfedges[e]; + if (e === -1) { + const p = hull[(_hullIndex[i] + 1) % hull.length]; + if (p !== p02) yield p; + return; + } + } while (e !== e0); + } + find(x2, y2, i = 0) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return -1; + const i0 = i; + let c2; + while ((c2 = this._step(i, x2, y2)) >= 0 && c2 !== i && c2 !== i0) i = c2; + return c2; + } + _step(i, x2, y2) { + const { inedges, hull, _hullIndex, halfedges, triangles, points: points2 } = this; + if (inedges[i] === -1 || !points2.length) return (i + 1) % (points2.length >> 1); + let c2 = i; + let dc = pow(x2 - points2[i * 2], 2) + pow(y2 - points2[i * 2 + 1], 2); + const e0 = inedges[i]; + let e = e0; + do { + let t = triangles[e]; + const dt = pow(x2 - points2[t * 2], 2) + pow(y2 - points2[t * 2 + 1], 2); + if (dt < dc) dc = dt, c2 = t; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + if (e === -1) { + e = hull[(_hullIndex[i] + 1) % hull.length]; + if (e !== t) { + if (pow(x2 - points2[e * 2], 2) + pow(y2 - points2[e * 2 + 1], 2) < dc) return e; + } + break; + } + } while (e !== e0); + return c2; + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, halfedges, triangles } = this; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = triangles[i] * 2; + const tj = triangles[j] * 2; + context2.moveTo(points2[ti], points2[ti + 1]); + context2.lineTo(points2[tj], points2[tj + 1]); + } + this.renderHull(context2); + return buffer && buffer.value(); + } + renderPoints(context2, r) { + if (r === void 0 && (!context2 || typeof context2.moveTo !== "function")) r = context2, context2 = null; + r = r == void 0 ? 2 : +r; + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2 } = this; + for (let i = 0, n = points2.length; i < n; i += 2) { + const x2 = points2[i], y2 = points2[i + 1]; + context2.moveTo(x2 + r, y2); + context2.arc(x2, y2, r, 0, tau); + } + return buffer && buffer.value(); + } + renderHull(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { hull, points: points2 } = this; + const h2 = hull[0] * 2, n = hull.length; + context2.moveTo(points2[h2], points2[h2 + 1]); + for (let i = 1; i < n; ++i) { + const h3 = 2 * hull[i]; + context2.lineTo(points2[h3], points2[h3 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + hullPolygon() { + const polygon = new Polygon(); + this.renderHull(polygon); + return polygon.value(); + } + renderTriangle(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, triangles } = this; + const t02 = triangles[i *= 3] * 2; + const t12 = triangles[i + 1] * 2; + const t22 = triangles[i + 2] * 2; + context2.moveTo(points2[t02], points2[t02 + 1]); + context2.lineTo(points2[t12], points2[t12 + 1]); + context2.lineTo(points2[t22], points2[t22 + 1]); + context2.closePath(); + return buffer && buffer.value(); + } + *trianglePolygons() { + const { triangles } = this; + for (let i = 0, n = triangles.length / 3; i < n; ++i) { + yield this.trianglePolygon(i); + } + } + trianglePolygon(i) { + const polygon = new Polygon(); + this.renderTriangle(i, polygon); + return polygon.value(); + } + } + function flatArray(points2, fx, fy, that) { + const n = points2.length; + const array2 = new Float64Array(n * 2); + for (let i = 0; i < n; ++i) { + const p = points2[i]; + array2[i * 2] = fx.call(that, p, i, points2); + array2[i * 2 + 1] = fy.call(that, p, i, points2); + } + return array2; + } + function* flatIterable(points2, fx, fy, that) { + let i = 0; + for (const p of points2) { + yield fx.call(that, p, i, points2); + yield fy.call(that, p, i, points2); + ++i; + } + } + function Voronoi(params2) { + Transform.call(this, null, params2); + } + Voronoi.Definition = { + "type": "Voronoi", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "default": [[-1e5, -1e5], [1e5, 1e5]], + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; + inherits(Voronoi, Transform, { + transform(_, pulse2) { + const as = _.as || "path", data2 = pulse2.source; + if (!data2 || !data2.length) return pulse2; + let s2 = _.size; + s2 = s2 ? [0, 0, s2[0], s2[1]] : (s2 = _.extent) ? [s2[0][0], s2[0][1], s2[1][0], s2[1][1]] : defaultExtent; + const voronoi2 = this.value = Delaunay.from(data2, _.x, _.y).voronoi(s2); + for (let i = 0, n = data2.length; i < n; ++i) { + const polygon = voronoi2.cellPolygon(i); + data2[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; + } + return pulse2.reflow(_.modified()).modifies(as); + } + }); + function toPathString(p) { + const x2 = p[0][0], y2 = p[0][1]; + let n = p.length - 1; + for (; p[n][0] === x2 && p[n][1] === y2; --n) ; + return "M" + p.slice(0, n + 1).join("L") + "Z"; + } + function isPoint(p) { + return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; + } + const voronoi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + voronoi: Voronoi + }, Symbol.toStringTag, { value: "Module" })); + var cloudRadians = Math.PI / 180, cw = 1 << 11 >> 5, ch = 1 << 11; + function cloud() { + var size = [256, 256], text2, font2, fontSize2, fontStyle, fontWeight, rotate2, padding2, spiral = archimedeanSpiral, words = [], random2 = Math.random, cloud2 = {}; + cloud2.layout = function() { + var contextAndRatio = getContext2(domCanvas()), board = zeroArray((size[0] >> 5) * size[1]), bounds2 = null, n = words.length, i = -1, tags = [], data2 = words.map((d3) => ({ + text: text2(d3), + font: font2(d3), + style: fontStyle(d3), + weight: fontWeight(d3), + rotate: rotate2(d3), + size: ~~(fontSize2(d3) + 1e-14), + padding: padding2(d3), + xoff: 0, + yoff: 0, + x1: 0, + y1: 0, + x0: 0, + y0: 0, + hasText: false, + sprite: null, + datum: d3 + })).sort((a2, b2) => b2.size - a2.size); + while (++i < n) { + var d2 = data2[i]; + d2.x = size[0] * (random2() + 0.5) >> 1; + d2.y = size[1] * (random2() + 0.5) >> 1; + cloudSprite(contextAndRatio, d2, data2, i); + if (d2.hasText && place2(board, d2, bounds2)) { + tags.push(d2); + if (bounds2) cloudBounds(bounds2, d2); + else bounds2 = [{ + x: d2.x + d2.x0, + y: d2.y + d2.y0 + }, { + x: d2.x + d2.x1, + y: d2.y + d2.y1 + }]; + d2.x -= size[0] >> 1; + d2.y -= size[1] >> 1; + } + } + return tags; + }; + function getContext2(canvas) { + canvas.width = canvas.height = 1; + var ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2); + canvas.width = (cw << 5) / ratio; + canvas.height = ch / ratio; + var context2 = canvas.getContext("2d"); + context2.fillStyle = context2.strokeStyle = "red"; + context2.textAlign = "center"; + return { + context: context2, + ratio + }; + } + function place2(board, tag, bounds2) { + var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size[0], size[1]), s2 = spiral(size), dt = random2() < 0.5 ? 1 : -1, t = -dt, dxdy, dx, dy; + while (dxdy = s2(t += dt)) { + dx = ~~dxdy[0]; + dy = ~~dxdy[1]; + if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; + tag.x = startX + dx; + tag.y = startY + dy; + if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; + if (!bounds2 || !cloudCollide(tag, board, size[0])) { + if (!bounds2 || collideRects(tag, bounds2)) { + var sprite = tag.sprite, w2 = tag.width >> 5, sw = size[0] >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + board[x2 + i] |= last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0); + } + x2 += sw; + } + tag.sprite = null; + return true; + } + } + } + return false; + } + cloud2.words = function(_) { + if (arguments.length) { + words = _; + return cloud2; + } else { + return words; + } + }; + cloud2.size = function(_) { + if (arguments.length) { + size = [+_[0], +_[1]]; + return cloud2; + } else { + return size; + } + }; + cloud2.font = function(_) { + if (arguments.length) { + font2 = functor(_); + return cloud2; + } else { + return font2; + } + }; + cloud2.fontStyle = function(_) { + if (arguments.length) { + fontStyle = functor(_); + return cloud2; + } else { + return fontStyle; + } + }; + cloud2.fontWeight = function(_) { + if (arguments.length) { + fontWeight = functor(_); + return cloud2; + } else { + return fontWeight; + } + }; + cloud2.rotate = function(_) { + if (arguments.length) { + rotate2 = functor(_); + return cloud2; + } else { + return rotate2; + } + }; + cloud2.text = function(_) { + if (arguments.length) { + text2 = functor(_); + return cloud2; + } else { + return text2; + } + }; + cloud2.spiral = function(_) { + if (arguments.length) { + spiral = spirals[_] || _; + return cloud2; + } else { + return spiral; + } + }; + cloud2.fontSize = function(_) { + if (arguments.length) { + fontSize2 = functor(_); + return cloud2; + } else { + return fontSize2; + } + }; + cloud2.padding = function(_) { + if (arguments.length) { + padding2 = functor(_); + return cloud2; + } else { + return padding2; + } + }; + cloud2.random = function(_) { + if (arguments.length) { + random2 = _; + return cloud2; + } else { + return random2; + } + }; + return cloud2; + } + function cloudSprite(contextAndRatio, d2, data2, di) { + if (d2.sprite) return; + var c2 = contextAndRatio.context, ratio = contextAndRatio.ratio; + c2.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); + var x2 = 0, y2 = 0, maxh = 0, n = data2.length, w2, w32, h2, i, j; + --di; + while (++di < n) { + d2 = data2[di]; + c2.save(); + c2.font = d2.style + " " + d2.weight + " " + ~~((d2.size + 1) / ratio) + "px " + d2.font; + w2 = c2.measureText(d2.text + "m").width * ratio; + h2 = d2.size << 1; + if (d2.rotate) { + var sr = Math.sin(d2.rotate * cloudRadians), cr2 = Math.cos(d2.rotate * cloudRadians), wcr = w2 * cr2, wsr = w2 * sr, hcr = h2 * cr2, hsr = h2 * sr; + w2 = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 31 >> 5 << 5; + h2 = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); + } else { + w2 = w2 + 31 >> 5 << 5; + } + if (h2 > maxh) maxh = h2; + if (x2 + w2 >= cw << 5) { + x2 = 0; + y2 += maxh; + maxh = 0; + } + if (y2 + h2 >= ch) break; + c2.translate((x2 + (w2 >> 1)) / ratio, (y2 + (h2 >> 1)) / ratio); + if (d2.rotate) c2.rotate(d2.rotate * cloudRadians); + c2.fillText(d2.text, 0, 0); + if (d2.padding) { + c2.lineWidth = 2 * d2.padding; + c2.strokeText(d2.text, 0, 0); + } + c2.restore(); + d2.width = w2; + d2.height = h2; + d2.xoff = x2; + d2.yoff = y2; + d2.x1 = w2 >> 1; + d2.y1 = h2 >> 1; + d2.x0 = -d2.x1; + d2.y0 = -d2.y1; + d2.hasText = true; + x2 += w2; + } + var pixels = c2.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; + while (--di >= 0) { + d2 = data2[di]; + if (!d2.hasText) continue; + w2 = d2.width; + w32 = w2 >> 5; + h2 = d2.y1 - d2.y0; + for (i = 0; i < h2 * w32; i++) sprite[i] = 0; + x2 = d2.xoff; + if (x2 == null) return; + y2 = d2.yoff; + var seen = 0, seenRow = -1; + for (j = 0; j < h2; j++) { + for (i = 0; i < w2; i++) { + var k = w32 * j + (i >> 5), m2 = pixels[(y2 + j) * (cw << 5) + (x2 + i) << 2] ? 1 << 31 - i % 32 : 0; + sprite[k] |= m2; + seen |= m2; + } + if (seen) seenRow = j; + else { + d2.y0++; + h2--; + j--; + y2++; + } + } + d2.y1 = d2.y0 + seenRow; + d2.sprite = sprite.slice(0, (d2.y1 - d2.y0) * w32); + } + } + function cloudCollide(tag, board, sw) { + sw >>= 5; + var sprite = tag.sprite, w2 = tag.width >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + if ((last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0)) & board[x2 + i]) return true; + } + x2 += sw; + } + return false; + } + function cloudBounds(bounds2, d2) { + var b0 = bounds2[0], b1 = bounds2[1]; + if (d2.x + d2.x0 < b0.x) b0.x = d2.x + d2.x0; + if (d2.y + d2.y0 < b0.y) b0.y = d2.y + d2.y0; + if (d2.x + d2.x1 > b1.x) b1.x = d2.x + d2.x1; + if (d2.y + d2.y1 > b1.y) b1.y = d2.y + d2.y1; + } + function collideRects(a2, b2) { + return a2.x + a2.x1 > b2[0].x && a2.x + a2.x0 < b2[1].x && a2.y + a2.y1 > b2[0].y && a2.y + a2.y0 < b2[1].y; + } + function archimedeanSpiral(size) { + var e = size[0] / size[1]; + return function(t) { + return [e * (t *= 0.1) * Math.cos(t), t * Math.sin(t)]; + }; + } + function rectangularSpiral(size) { + var dy = 4, dx = dy * size[0] / size[1], x2 = 0, y2 = 0; + return function(t) { + var sign2 = t < 0 ? -1 : 1; + switch (Math.sqrt(1 + 4 * sign2 * t) - sign2 & 3) { + case 0: + x2 += dx; + break; + case 1: + y2 += dy; + break; + case 2: + x2 -= dx; + break; + default: + y2 -= dy; + break; + } + return [x2, y2]; + }; + } + function zeroArray(n) { + var a2 = [], i = -1; + while (++i < n) a2[i] = 0; + return a2; + } + function functor(d2) { + return typeof d2 === "function" ? d2 : function() { + return d2; + }; + } + var spirals = { + archimedean: archimedeanSpiral, + rectangular: rectangularSpiral + }; + const Output = ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"]; + const Params$1 = ["text", "font", "rotate", "fontSize", "fontStyle", "fontWeight"]; + function Wordcloud(params2) { + Transform.call(this, cloud(), params2); + } + Wordcloud.Definition = { + "type": "Wordcloud", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "font", + "type": "string", + "expr": true, + "default": "sans-serif" + }, { + "name": "fontStyle", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontWeight", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontSize", + "type": "number", + "expr": true, + "default": 14 + }, { + "name": "fontSizeRange", + "type": "number", + "array": "nullable", + "default": [10, 50] + }, { + "name": "rotate", + "type": "number", + "expr": true, + "default": 0 + }, { + "name": "text", + "type": "field" + }, { + "name": "spiral", + "type": "string", + "values": ["archimedean", "rectangular"] + }, { + "name": "padding", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 7, + "default": Output + }] + }; + inherits(Wordcloud, Transform, { + transform(_, pulse2) { + if (_.size && !(_.size[0] && _.size[1])) { + error("Wordcloud size dimensions must be non-zero."); + } + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || Params$1.some(modp))) return; + const data2 = pulse2.materialize(pulse2.SOURCE).source, layout = this.value, as = _.as || Output; + let fontSize2 = _.fontSize || 14, range2; + isFunction(fontSize2) ? range2 = _.fontSizeRange : fontSize2 = constant$4(fontSize2); + if (range2) { + const fsize = fontSize2, sizeScale = scale$4("sqrt")().domain(extent(data2, fsize)).range(range2); + fontSize2 = (x2) => sizeScale(fsize(x2)); + } + data2.forEach((t) => { + t[as[0]] = NaN; + t[as[1]] = NaN; + t[as[3]] = 0; + }); + const words = layout.words(data2).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || "archimedean").rotate(_.rotate || 0).font(_.font || "sans-serif").fontStyle(_.fontStyle || "normal").fontWeight(_.fontWeight || "normal").fontSize(fontSize2).random(random).layout(); + const size = layout.size(), dx = size[0] >> 1, dy = size[1] >> 1, n = words.length; + for (let i = 0, w2, t; i < n; ++i) { + w2 = words[i]; + t = w2.datum; + t[as[0]] = w2.x + dx; + t[as[1]] = w2.y + dy; + t[as[2]] = w2.font; + t[as[3]] = w2.size; + t[as[4]] = w2.style; + t[as[5]] = w2.weight; + t[as[6]] = w2.rotate; + } + return pulse2.reflow(mod).modifies(as); } - _init() { - const d = this._delaunator, points = this.points; - // check for collinear - if (d.hull && d.hull.length > 2 && collinear(d)) { - this.collinear = Int32Array.from({ - length: points.length / 2 - }, (_, i)=>i).sort((i, j)=>points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds = [ - points[2 * e], - points[2 * e + 1], - points[2 * f], - points[2 * f + 1] - ], r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for(let i = 0, n = points.length / 2; i < n; ++i){ - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new (0, _delaunatorDefault.default)(points); - } else delete this.collinear; - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for(let e = 0, n = halfedges.length; e < n; ++e){ - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for(let i = 0, n = hull.length; i < n; ++i)hullIndex[hull[i]] = i; - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - inedges[hull[0]] = 1; - if (hull.length === 2) { - inedges[hull[1]] = 0; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - } + }); + const wordcloud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + wordcloud: Wordcloud + }, Symbol.toStringTag, { value: "Module" })); + const array8 = (n) => new Uint8Array(n); + const array16 = (n) => new Uint16Array(n); + const array32 = (n) => new Uint32Array(n); + function Bitmaps() { + let width2 = 8, data2 = [], seen = array32(0), curr = array$1(0, width2), prev = array$1(0, width2); + return { + data: () => data2, + seen: () => seen = lengthen(seen, data2.length), + add(array2) { + for (let i = 0, j = data2.length, n = array2.length, t; i < n; ++i) { + t = array2[i]; + t._index = j++; + data2.push(t); } - } - voronoi(bounds) { - return new (0, _voronoiJsDefault.default)(this, bounds); - } - *neighbors(i) { - const { inedges, hull, _hullIndex, halfedges, triangles, collinear } = this; - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; + }, + remove(num, map2) { + const n = data2.length, copy2 = Array(n - num), reindex = data2; + let t, i, j; + for (i = 0; !map2[i] && i < n; ++i) { + copy2[i] = data2[i]; + reindex[i] = i; + } + for (j = i; i < n; ++i) { + t = data2[i]; + if (!map2[i]) { + reindex[i] = j; + curr[j] = curr[i]; + prev[j] = prev[i]; + copy2[j] = t; + t._index = j++; + } else { + reindex[i] = -1; + } + curr[i] = 0; + } + data2 = copy2; + return reindex; + }, + size: () => data2.length, + curr: () => curr, + prev: () => prev, + reset: (k) => prev[k] = curr[k], + all: () => width2 < 257 ? 255 : width2 < 65537 ? 65535 : 4294967295, + set(k, one2) { + curr[k] |= one2; + }, + clear(k, one2) { + curr[k] &= ~one2; + }, + resize(n, m2) { + const k = curr.length; + if (n > k || m2 > width2) { + width2 = Math.max(m2, width2); + curr = array$1(n, width2, curr); + prev = array$1(n, width2); } - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - }while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0)i = c; - return c; - } - _step(i, x, y) { - const { inedges, hull, _hullIndex, halfedges, triangles, points } = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - }while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, halfedges, triangles } = this; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r) { - if (r === undefined && (!context || typeof context.moveTo !== "function")) r = context, context = null; - r = r == undefined ? 2 : +r; - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points } = this; - for(let i = 0, n = points.length; i < n; i += 2){ - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { hull, points } = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for(let i = 1; i < n; ++i){ - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); + } + }; + } + function lengthen(array2, length2, copy2) { + if (array2.length >= length2) return array2; + copy2 = copy2 || new array2.constructor(length2); + copy2.set(array2); + return copy2; + } + function array$1(n, m2, array2) { + const copy2 = (m2 < 257 ? array8 : m2 < 65537 ? array16 : array32)(n); + if (array2) copy2.set(array2); + return copy2; + } + function Dimension(index2, i, query) { + const bit = 1 << i; + return { + one: bit, + zero: ~bit, + range: query.slice(), + bisect: index2.bisect, + index: index2.index, + size: index2.size, + onAdd(added, curr) { + const dim = this, range2 = dim.bisect(dim.range, added.value), idx = added.index, lo = range2[0], hi = range2[1], n1 = idx.length; + let i2; + for (i2 = 0; i2 < lo; ++i2) curr[idx[i2]] |= bit; + for (i2 = hi; i2 < n1; ++i2) curr[idx[i2]] |= bit; + return dim; + } + }; + } + function SortedIndex() { + let index2 = array32(0), value2 = [], size = 0; + function insert2(key2, data2, base2) { + if (!data2.length) return []; + const n0 = size, n1 = data2.length, addi = array32(n1); + let addv = Array(n1), oldv, oldi, i; + for (i = 0; i < n1; ++i) { + addv[i] = key2(data2[i]); + addi[i] = i; + } + addv = sort$1(addv, addi); + if (n0) { + oldv = value2; + oldi = index2; + value2 = Array(n0 + n1); + index2 = array32(n0 + n1); + merge$1(base2, oldv, oldi, n0, addv, addi, n1, value2, index2); + } else { + if (base2 > 0) for (i = 0; i < n1; ++i) { + addi[i] += base2; + } + value2 = addv; + index2 = addi; + } + size = n0 + n1; + return { + index: addi, + value: addv + }; + } + function remove2(num, map2) { + const n = size; + let idx, i, j; + for (i = 0; !map2[index2[i]] && i < n; ++i) ; + for (j = i; i < n; ++i) { + if (!map2[idx = index2[i]]) { + index2[j] = idx; + value2[j] = value2[i]; + ++j; + } + } + size = n - num; } - hullPolygon() { - const polygon = new (0, _polygonJsDefault.default); - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, triangles } = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); + function reindex(map2) { + for (let i = 0, n = size; i < n; ++i) { + index2[i] = map2[index2[i]]; + } } - *trianglePolygons() { - const { triangles } = this; - for(let i = 0, n = triangles.length / 3; i < n; ++i)yield this.trianglePolygon(i); + function bisect2(range2, array2) { + let n; + if (array2) { + n = array2.length; + } else { + array2 = value2; + n = size; + } + return [bisectLeft$1(array2, range2[0], 0, n), bisectRight$1(array2, range2[1], 0, n)]; } - trianglePolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderTriangle(i, polygon); - return polygon.value(); - } -} -exports.default = Delaunay; -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for(let i = 0; i < n; ++i){ - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points){ - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; + return { + insert: insert2, + remove: remove2, + bisect: bisect2, + reindex, + index: () => index2, + size: () => size + }; + } + function sort$1(values2, index2) { + values2.sort.call(index2, (a2, b2) => { + const x2 = values2[a2], y2 = values2[b2]; + return x2 < y2 ? -1 : x2 > y2 ? 1 : 0; + }); + return permute(values2, index2); + } + function merge$1(base2, value0, index0, n0, value1, index1, n1, value2, index2) { + let i0 = 0, i1 = 0, i; + for (i = 0; i0 < n0 && i1 < n1; ++i) { + if (value0[i0] < value1[i1]) { + value2[i] = value0[i0]; + index2[i] = index0[i0++]; + } else { + value2[i] = value1[i1]; + index2[i] = index1[i1++] + base2; + } } -} - -},{"delaunator":"2B9KR","./path.js":"52EAe","./polygon.js":"1V5gi","./voronoi.js":"dCf1s","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2B9KR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _robustPredicates = require("robust-predicates"); -const EPSILON = Math.pow(2, -52); -const EDGE_STACK = new Uint32Array(512); -class Delaunator { - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - for(let i = 0; i < n; i++){ - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - return new Delaunator(coords); - } - constructor(coords){ - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - this.coords = coords; - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize); // angular edge hash - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); + for (; i0 < n0; ++i0, ++i) { + value2[i] = value0[i0]; + index2[i] = index0[i0]; } - update() { - const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; - const n = coords.length >> 1; - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - for(let i = 0; i < n; i++){ - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - let i0, i1, i2; - // pick a seed point close to the center - for(let i = 0, minDist = Infinity; i < n; i++){ - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } + for (; i1 < n1; ++i1, ++i) { + value2[i] = value1[i1]; + index2[i] = index1[i1] + base2; + } + } + function CrossFilter(params2) { + Transform.call(this, Bitmaps(), params2); + this._indices = null; + this._dims = null; + } + CrossFilter.Definition = { + "type": "CrossFilter", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "query", + "type": "array", + "array": true, + "required": true, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }] + }; + inherits(CrossFilter, Transform, { + transform(_, pulse2) { + if (!this._dims) { + return this.init(_, pulse2); + } else { + var init2 = _.modified("fields") || _.fields.some((f) => pulse2.modified(f.fields)); + return init2 ? this.reinit(_, pulse2) : this.eval(_, pulse2); + } + }, + init(_, pulse2) { + const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m2 = query.length; + let i = 0, key2, index2; + for (; i < m2; ++i) { + key2 = fields[i].fname; + index2 = indices[key2] || (indices[key2] = SortedIndex()); + dims.push(Dimension(index2, i, query[i])); + } + return this.eval(_, pulse2); + }, + reinit(_, pulse2) { + const output2 = pulse2.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output2.rem = output2.add, mod = output2.mod, m2 = query.length, adds = {}; + let add2, index2, key2, mods, remMap, modMap, i, n, f; + prev.set(curr); + if (pulse2.rem.length) { + remMap = this.remove(_, pulse2, output2); + } + if (pulse2.add.length) { + bits.add(pulse2.add); + } + if (pulse2.mod.length) { + modMap = {}; + for (mods = pulse2.mod, i = 0, n = mods.length; i < n; ++i) { + modMap[mods[i]._index] = 1; } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - // find the point closest to the seed - for(let i = 0, minDist = Infinity; i < n; i++){ - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } + } + for (i = 0; i < m2; ++i) { + f = fields[i]; + if (!dims[i] || _.modified("fields", i) || pulse2.modified(f.fields)) { + key2 = f.fname; + if (!(add2 = adds[key2])) { + indices[key2] = index2 = SortedIndex(); + adds[key2] = add2 = index2.insert(f, pulse2.source, 0); + } + dims[i] = Dimension(index2, i, query[i]).onAdd(add2, curr); } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - let minRadius = Infinity; - // find the third point which forms the smallest circumcircle with the first two - for(let i = 0; i < n; i++){ - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } + } + for (i = 0, n = bits.data().length; i < n; ++i) { + if (remMap[i]) { + continue; + } else if (prev[i] !== curr[i]) { + out.push(i); + } else if (modMap[i] && curr[i] !== all) { + mod.push(i); } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for(let i = 0; i < n; i++)this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for(let i = 0, d0 = -Infinity; i < n; i++){ - const id = this._ids[i]; - const d = this._dists[id]; - if (d > d0) { - hull[j++] = id; - d0 = d; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; + } + bits.mask = (1 << m2) - 1; + return output2; + }, + eval(_, pulse2) { + const output2 = pulse2.materialize().fork(), m2 = this._dims.length; + let mask = 0; + if (pulse2.rem.length) { + this.remove(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (_.modified("query") && !_.modified("fields")) { + mask |= this.update(_, pulse2, output2); + } + if (pulse2.add.length) { + this.insert(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (pulse2.mod.length) { + this.modify(pulse2, output2); + mask |= (1 << m2) - 1; + } + this.value.mask = mask; + return output2; + }, + insert(_, pulse2, output2) { + const tuples = pulse2.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output2.add, n = bits.size() + tuples.length, m2 = dims.length; + let k = bits.size(), j, key2, add2; + bits.resize(n, m2); + bits.add(tuples); + const curr = bits.curr(), prev = bits.prev(), all = bits.all(); + for (j = 0; j < m2; ++j) { + key2 = fields[j].fname; + add2 = adds[key2] || (adds[key2] = indices[key2].insert(fields[j], tuples, k)); + dims[j].onAdd(add2, curr); + } + for (; k < n; ++k) { + prev[k] = all; + if (curr[k] !== all) out.push(k); + } + }, + modify(pulse2, output2) { + const out = output2.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse2.mod; + let i, n, k; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + if (curr[k] !== all) out.push(k); + } + }, + remove(_, pulse2, output2) { + const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map2 = {}, out = output2.rem, tuples = pulse2.rem; + let i, n, k, f; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + map2[k] = 1; + prev[k] = f = curr[k]; + curr[k] = all; + if (f !== all) out.push(k); + } + for (k in indices) { + indices[k].remove(n, map2); + } + this.reindex(pulse2, n, map2); + return map2; + }, + // reindex filters and indices after propagation completes + reindex(pulse2, num, map2) { + const indices = this._indices, bits = this.value; + pulse2.runAfter(() => { + const indexMap = bits.remove(num, map2); + for (const key2 in indices) indices[key2].reindex(indexMap); + }); + }, + update(_, pulse2, output2) { + const dims = this._dims, query = _.query, stamp = pulse2.stamp, m2 = dims.length; + let mask = 0, i, q; + output2.filters = 0; + for (q = 0; q < m2; ++q) { + if (_.modified("query", q)) { + i = q; + ++mask; } - // swap the order of the seed points for counter-clockwise orientation - if ((0, _robustPredicates.orient2d)(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - for(let i = 0; i < n; i++)this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - for(let k = 0, xp, yp; k < this._ids.length; k++){ - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue; - xp = x; - yp = y; - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - // find a visible edge on the convex hull using edge hash - let start = 0; - for(let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++){ - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - start = hullPrev[start]; - let e = start, q; - while(q = hullNext[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0){ - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while(q = hullNext[n], (0, _robustPredicates.orient2d)(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0){ - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - // walk backward from the other side, adding more triangles and flipping - if (e === start) while(q = hullPrev[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0){ - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - this.hull = new Uint32Array(hullSize); - for(let i = 0, e = this._hullStart; i < hullSize; i++){ - this.hull[i] = e; - e = hullNext[e]; - } - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - _legalize(a) { - const { _triangles: triangles, _halfedges: halfedges, coords } = this; - let i = 0; - let ar = 0; - // recursion eliminated with a fixed-size stack - while(true){ - const b = halfedges[a]; - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - if (b === -1) { - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - const illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - const hbl = halfedges[bl]; - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - }while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - const br = b0 + (b + 1) % 3; - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) EDGE_STACK[i++] = br; - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } + } + if (mask === 1) { + mask = dims[i].one; + this.incrementOne(dims[i], query[i], output2.add, output2.rem); + } else { + for (q = 0, mask = 0; q < m2; ++q) { + if (!_.modified("query", q)) continue; + mask |= dims[q].one; + this.incrementAll(dims[q], query[q], stamp, output2.add); + output2.rem = output2.add; } - return ar; - } - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - this.trianglesLen += 3; - return t; - } -} -exports.default = Delaunator; -// monotonically increases with real angle, but doesn't need expensive trigonometry -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; -} -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - return x * x + y * y; -} -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - return { - x, - y - }; -} -function quicksort(ids, dists, left, right) { - if (right - left <= 20) for(let i = left + 1; i <= right; i++){ - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while(j >= left && dists[ids[j]] > tempDist)ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - else { - const median = left + right >> 1; - let i = left + 1; - let j = right; - swap(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); - const temp = ids[i]; - const tempDist = dists[temp]; - while(true){ - do i++; - while (dists[ids[i]] < tempDist); - do j--; - while (dists[ids[j]] > tempDist); - if (j < i) break; - swap(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); + } + return mask; + }, + incrementAll(dim, query, stamp, out) { + const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; } - } -} -function swap(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} - -},{"robust-predicates":"dNpb1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dNpb1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>(0, _orient2DJs.orient2d)); -parcelHelpers.export(exports, "orient2dfast", ()=>(0, _orient2DJs.orient2dfast)); -parcelHelpers.export(exports, "orient3d", ()=>(0, _orient3DJs.orient3d)); -parcelHelpers.export(exports, "orient3dfast", ()=>(0, _orient3DJs.orient3dfast)); -parcelHelpers.export(exports, "incircle", ()=>(0, _incircleJs.incircle)); -parcelHelpers.export(exports, "incirclefast", ()=>(0, _incircleJs.incirclefast)); -parcelHelpers.export(exports, "insphere", ()=>(0, _insphereJs.insphere)); -parcelHelpers.export(exports, "inspherefast", ()=>(0, _insphereJs.inspherefast)); -var _orient2DJs = require("./esm/orient2d.js"); -var _orient3DJs = require("./esm/orient3d.js"); -var _incircleJs = require("./esm/incircle.js"); -var _insphereJs = require("./esm/insphere.js"); - -},{"./esm/orient2d.js":"bI0hj","./esm/orient3d.js":"9tMOz","./esm/incircle.js":"60fkW","./esm/insphere.js":"hdazk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bI0hj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>orient2d); -parcelHelpers.export(exports, "orient2dfast", ()=>orient2dfast); -var _utilJs = require("./util.js"); -const ccwerrboundA = (3 + 16 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundB = (2 + 12 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundC = (9 + 64 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const B = (0, _utilJs.vec)(4); -const C1 = (0, _utilJs.vec)(8); -const C2 = (0, _utilJs.vec)(12); -const D = (0, _utilJs.vec)(16); -const u = (0, _utilJs.vec)(4); -function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { - let acxtail, acytail, bcxtail, bcytail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const acx = ax - cx; - const bcx = bx - cx; - const acy = ay - cy; - const bcy = by - cy; - s1 = acx * bcy; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcx; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - B[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - B[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - B[2] = _j - (u3 - bvirt) + (_i - bvirt); - B[3] = u3; - let det = (0, _utilJs.estimate)(4, B); - let errbound = ccwerrboundB * detsum; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - acx; - acxtail = ax - (acx + bvirt) + (bvirt - cx); - bvirt = bx - bcx; - bcxtail = bx - (bcx + bvirt) + (bvirt - cx); - bvirt = ay - acy; - acytail = ay - (acy + bvirt) + (bvirt - cy); - bvirt = by - bcy; - bcytail = by - (bcy + bvirt) + (bvirt - cy); - if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) return det; - errbound = ccwerrboundC * detsum + (0, _utilJs.resulterrbound) * Math.abs(det); - det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); - if (det >= errbound || -det >= errbound) return det; - s1 = acxtail * bcy; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcx; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C1len = (0, _utilJs.sum)(4, B, 4, u, C1); - s1 = acx * bcytail; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcxtail; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C2len = (0, _utilJs.sum)(C1len, C1, 4, u, C2); - s1 = acxtail * bcytail; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcxtail; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const Dlen = (0, _utilJs.sum)(C2len, C2, 4, u, D); - return D[Dlen - 1]; -} -function orient2d(ax, ay, bx, by, cx, cy) { - const detleft = (ay - cy) * (bx - cx); - const detright = (ax - cx) * (by - cy); - const det = detleft - detright; - const detsum = Math.abs(detleft + detright); - if (Math.abs(det) >= ccwerrboundA * detsum) return det; - return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); -} -function orient2dfast(ax, ay, bx, by, cx, cy) { - return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy); -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8D5If":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "splitter", ()=>splitter); -parcelHelpers.export(exports, "resulterrbound", ()=>resulterrbound); -// fast_expansion_sum_zeroelim routine from oritinal code -parcelHelpers.export(exports, "sum", ()=>sum); -parcelHelpers.export(exports, "sum_three", ()=>sum_three); -// scale_expansion_zeroelim routine from oritinal code -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "negate", ()=>negate); -parcelHelpers.export(exports, "estimate", ()=>estimate); -parcelHelpers.export(exports, "vec", ()=>vec); -const epsilon = 1.1102230246251565e-16; -const splitter = 134217729; -const resulterrbound = (3 + 8 * epsilon) * epsilon; -function sum(elen, e, flen, f, h) { - let Q, Qnew, hh, bvirt; - let enow = e[0]; - let fnow = f[0]; - let eindex = 0; - let findex = 0; - if (fnow > enow === fnow > -enow) { - Q = enow; - enow = e[++eindex]; - } else { - Q = fnow; - fnow = f[++findex]; - } - let hindex = 0; - if (eindex < elen && findex < flen) { - if (fnow > enow === fnow > -enow) { - Qnew = enow + Q; - hh = Q - (Qnew - enow); - enow = e[++eindex]; - } else { - Qnew = fnow + Q; - hh = Q - (Qnew - fnow); - fnow = f[++findex]; + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; - while(eindex < elen && findex < flen){ - if (fnow > enow === fnow > -enow) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - } else { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + } + dim.range = query.slice(); + }, + incrementOne(dim, query, add2, rem2) { + const bits = this.value, curr = bits.curr(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); + } + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); } + } + dim.range = query.slice(); } - while(eindex < elen){ - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + }); + function ResolveFilter(params2) { + Transform.call(this, null, params2); + } + ResolveFilter.Definition = { + "type": "ResolveFilter", + "metadata": {}, + "params": [{ + "name": "ignore", + "type": "number", + "required": true, + "description": "A bit mask indicating which filters to ignore." + }, { + "name": "filter", + "type": "object", + "required": true, + "description": "Per-tuple filter bitmaps from a CrossFilter transform." + }] + }; + inherits(ResolveFilter, Transform, { + transform(_, pulse2) { + const ignore = ~(_.ignore || 0), bitmap = _.filter, mask = bitmap.mask; + if ((mask & ignore) === 0) return pulse2.StopPropagation; + const output2 = pulse2.fork(pulse2.ALL), data2 = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k) => !(curr[k] & ignore) ? data2[k] : null; + output2.filter(output2.MOD, pass); + if (!(mask & mask - 1)) { + output2.filter(output2.ADD, pass); + output2.filter(output2.REM, (k) => (curr[k] & ignore) === mask ? data2[k] : null); + } else { + output2.filter(output2.ADD, (k) => { + const c2 = curr[k] & ignore, f = !c2 && c2 ^ prev[k] & ignore; + return f ? data2[k] : null; + }); + output2.filter(output2.REM, (k) => { + const c2 = curr[k] & ignore, f = c2 && !(c2 ^ (c2 ^ prev[k] & ignore)); + return f ? data2[k] : null; + }); + } + return output2.filter(output2.SOURCE, (t) => pass(t._index)); } - while(findex < flen){ - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + }); + const xf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + crossfilter: CrossFilter, + resolvefilter: ResolveFilter + }, Symbol.toStringTag, { value: "Module" })); + const RawCode = "RawCode"; + const Literal = "Literal"; + const Property = "Property"; + const Identifier = "Identifier"; + const ArrayExpression = "ArrayExpression"; + const BinaryExpression = "BinaryExpression"; + const CallExpression = "CallExpression"; + const ConditionalExpression = "ConditionalExpression"; + const LogicalExpression = "LogicalExpression"; + const MemberExpression = "MemberExpression"; + const ObjectExpression = "ObjectExpression"; + const UnaryExpression = "UnaryExpression"; + function ASTNode(type2) { + this.type = type2; + } + ASTNode.prototype.visit = function(visitor) { + let c2, i, n; + if (visitor(this)) return 1; + for (c2 = children(this), i = 0, n = c2.length; i < n; ++i) { + if (c2[i].visit(visitor)) return 1; } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function sum_three(alen, a, blen, b, clen, c, tmp, out) { - return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out); -} -function scale(elen, e, b, h) { - let Q, sum, hh, product1, product0; - let bvirt, c, ahi, alo, bhi, blo; - c = splitter * b; - bhi = c - (c - b); - blo = b - bhi; - let enow = e[0]; - Q = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo); - let hindex = 0; - if (hh !== 0) h[hindex++] = hh; - for(let i = 1; i < elen; i++){ - enow = e[i]; - product1 = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo); - sum = Q + product0; - bvirt = sum - Q; - hh = Q - (sum - bvirt) + (product0 - bvirt); - if (hh !== 0) h[hindex++] = hh; - Q = product1 + sum; - hh = sum - (Q - product1); - if (hh !== 0) h[hindex++] = hh; - } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function negate(elen, e) { - for(let i = 0; i < elen; i++)e[i] = -e[i]; - return elen; -} -function estimate(elen, e) { - let Q = e[0]; - for(let i = 1; i < elen; i++)Q += e[i]; - return Q; -} -function vec(n) { - return new Float64Array(n); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9tMOz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient3d", ()=>orient3d); -parcelHelpers.export(exports, "orient3dfast", ()=>orient3dfast); -var _utilJs = require("./util.js"); -const o3derrboundA = (7 + 56 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundB = (3 + 28 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundC = (26 + 288 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const at_b = (0, _utilJs.vec)(4); -const at_c = (0, _utilJs.vec)(4); -const bt_c = (0, _utilJs.vec)(4); -const bt_a = (0, _utilJs.vec)(4); -const ct_a = (0, _utilJs.vec)(4); -const ct_b = (0, _utilJs.vec)(4); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const u = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(8); -const _12 = (0, _utilJs.vec)(12); -let fin = (0, _utilJs.vec)(192); -let fin2 = (0, _utilJs.vec)(192); -function finadd(finlen, alen, a) { - finlen = (0, _utilJs.sum)(finlen, fin, alen, a, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function tailinit(xtail, ytail, ax, ay, bx, by, a, b) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3, negate; - if (xtail === 0) { - if (ytail === 0) { - a[0] = 0; - b[0] = 0; - return 1; - } else { - negate = -ytail; - s1 = negate * ax; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } - } else if (ytail === 0) { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - negate = -xtail; - s1 = negate * by; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; + }; + function children(node) { + switch (node.type) { + case ArrayExpression: + return node.elements; + case BinaryExpression: + case LogicalExpression: + return [node.left, node.right]; + case CallExpression: + return [node.callee].concat(node.arguments); + case ConditionalExpression: + return [node.test, node.consequent, node.alternate]; + case MemberExpression: + return [node.object, node.property]; + case ObjectExpression: + return node.properties; + case Property: + return [node.key, node.value]; + case UnaryExpression: + return [node.argument]; + case Identifier: + case Literal: + case RawCode: + default: + return []; + } + } + var TokenName, source, index, length, lookahead; + var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; + TokenName = {}; + TokenName[TokenBooleanLiteral] = "Boolean"; + TokenName[TokenEOF] = "<end>"; + TokenName[TokenIdentifier] = "Identifier"; + TokenName[TokenKeyword] = "Keyword"; + TokenName[TokenNullLiteral] = "Null"; + TokenName[TokenNumericLiteral] = "Numeric"; + TokenName[TokenPunctuator] = "Punctuator"; + TokenName[TokenStringLiteral] = "String"; + TokenName[TokenRegularExpression] = "RegularExpression"; + var SyntaxArrayExpression = "ArrayExpression", SyntaxBinaryExpression = "BinaryExpression", SyntaxCallExpression = "CallExpression", SyntaxConditionalExpression = "ConditionalExpression", SyntaxIdentifier = "Identifier", SyntaxLiteral = "Literal", SyntaxLogicalExpression = "LogicalExpression", SyntaxMemberExpression = "MemberExpression", SyntaxObjectExpression = "ObjectExpression", SyntaxProperty = "Property", SyntaxUnaryExpression = "UnaryExpression"; + var MessageUnexpectedToken = "Unexpected token %0", MessageUnexpectedNumber = "Unexpected number", MessageUnexpectedString = "Unexpected string", MessageUnexpectedIdentifier = "Unexpected identifier", MessageUnexpectedReserved = "Unexpected reserved word", MessageUnexpectedEOS = "Unexpected end of input", MessageInvalidRegExp = "Invalid regular expression", MessageUnterminatedRegExp = "Invalid regular expression: missing /", MessageStrictOctalLiteral = "Octal literals are not allowed in strict mode.", MessageStrictDuplicateProperty = "Duplicate data property in object literal not allowed in strict mode"; + var ILLEGAL$1 = "ILLEGAL", DISABLED = "Disabled."; + var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); + function assert(condition, message) { + if (!condition) { + throw new Error("ASSERT: " + message); + } + } + function isDecimalDigit(ch2) { + return ch2 >= 48 && ch2 <= 57; + } + function isHexDigit(ch2) { + return "0123456789abcdefABCDEF".includes(ch2); + } + function isOctalDigit(ch2) { + return "01234567".includes(ch2); + } + function isWhiteSpace(ch2) { + return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && [5760, 6158, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].includes(ch2); + } + function isLineTerminator(ch2) { + return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233; + } + function isIdentifierStart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch2)); + } + function isIdentifierPart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 >= 48 && ch2 <= 57 || // 0..9 + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch2)); + } + const keywords = { + "if": 1, + "in": 1, + "do": 1, + "var": 1, + "for": 1, + "new": 1, + "try": 1, + "let": 1, + "this": 1, + "else": 1, + "case": 1, + "void": 1, + "with": 1, + "enum": 1, + "while": 1, + "break": 1, + "catch": 1, + "throw": 1, + "const": 1, + "yield": 1, + "class": 1, + "super": 1, + "return": 1, + "typeof": 1, + "delete": 1, + "switch": 1, + "export": 1, + "import": 1, + "public": 1, + "static": 1, + "default": 1, + "finally": 1, + "extends": 1, + "package": 1, + "private": 1, + "function": 1, + "continue": 1, + "debugger": 1, + "interface": 1, + "protected": 1, + "instanceof": 1, + "implements": 1 + }; + function skipComment() { + while (index < length) { + const ch2 = source.charCodeAt(index); + if (isWhiteSpace(ch2) || isLineTerminator(ch2)) { + ++index; + } else { + break; + } + } + } + function scanHexEscape(prefix) { + var i, len2, ch2, code = 0; + len2 = prefix === "u" ? 4 : 2; + for (i = 0; i < len2; ++i) { + if (index < length && isHexDigit(source[index])) { + ch2 = source[index++]; + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + } + return String.fromCharCode(code); + } + function scanUnicodeCodePointEscape() { + var ch2, code, cu1, cu2; + ch2 = source[index]; + code = 0; + if (ch2 === "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + while (index < length) { + ch2 = source[index++]; + if (!isHexDigit(ch2)) { + break; + } + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); + } + if (code > 1114111 || ch2 !== "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + if (code <= 65535) { + return String.fromCharCode(code); + } + cu1 = (code - 65536 >> 10) + 55296; + cu2 = (code - 65536 & 1023) + 56320; + return String.fromCharCode(cu1, cu2); + } + function getEscapedIdentifier() { + var ch2, id2; + ch2 = source.charCodeAt(index++); + id2 = String.fromCharCode(ch2); + if (ch2 === 92) { + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierStart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + id2 = ch2; + } + while (index < length) { + ch2 = source.charCodeAt(index); + if (!isIdentifierPart(ch2)) { + break; + } + ++index; + id2 += String.fromCharCode(ch2); + if (ch2 === 92) { + id2 = id2.substr(0, id2.length - 1); + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierPart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + id2 += ch2; + } + } + return id2; + } + function getIdentifier() { + var start, ch2; + start = index++; + while (index < length) { + ch2 = source.charCodeAt(index); + if (ch2 === 92) { + index = start; + return getEscapedIdentifier(); + } + if (isIdentifierPart(ch2)) { + ++index; + } else { + break; + } + } + return source.slice(start, index); + } + function scanIdentifier() { + var start, id2, type2; + start = index; + id2 = source.charCodeAt(index) === 92 ? getEscapedIdentifier() : getIdentifier(); + if (id2.length === 1) { + type2 = TokenIdentifier; + } else if (keywords.hasOwnProperty(id2)) { + type2 = TokenKeyword; + } else if (id2 === "null") { + type2 = TokenNullLiteral; + } else if (id2 === "true" || id2 === "false") { + type2 = TokenBooleanLiteral; } else { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ytail * ax; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - a[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - a[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - a[2] = _j - (u3 - bvirt) + (_i - bvirt); - a[3] = u3; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = xtail * by; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - b[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - b[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - b[2] = _j - (u3 - bvirt) + (_i - bvirt); - b[3] = u3; - return 4; - } -} -function tailadd(finlen, a, b, k, z) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, u3; - s1 = a * b; - c = (0, _utilJs.splitter) * a; - ahi = c - (c - a); - alo = a - ahi; - c = (0, _utilJs.splitter) * b; - bhi = c - (c - b); - blo = b - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - c = (0, _utilJs.splitter) * k; - bhi = c - (c - k); - blo = k - bhi; - _i = s0 * k; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * k; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - if (z !== 0) { - c = (0, _utilJs.splitter) * z; - bhi = c - (c - z); - blo = z - bhi; - _i = s0 * z; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * z; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - } - return finlen; -} -function orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail; - let adytail, bdytail, cdytail; - let adztail, bdztail, cdztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)(4, bc, adz, _8), _8, (0, _utilJs.scale)(4, ca, bdz, _8b), _8b, _16), _16, (0, _utilJs.scale)(4, ab, cdz, _8), _8, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = o3derrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - bvirt = az - adz; - adztail = az - (adz + bvirt) + (bvirt - dz); - bvirt = bz - bdz; - bdztail = bz - (bdz + bvirt) + (bvirt - dz); - bvirt = cz - cdz; - cdztail = cz - (cdz + bvirt) + (bvirt - dz); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0 && adztail === 0 && bdztail === 0 && cdztail === 0) return det; - errbound = o3derrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += adz * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + adztail * (bdx * cdy - bdy * cdx) + bdz * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + bdztail * (cdx * ady - cdy * adx) + cdz * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + cdztail * (adx * bdy - ady * bdx); - if (det >= errbound || -det >= errbound) return det; - const at_len = tailinit(adxtail, adytail, bdx, bdy, cdx, cdy, at_b, at_c); - const bt_len = tailinit(bdxtail, bdytail, cdx, cdy, adx, ady, bt_c, bt_a); - const ct_len = tailinit(cdxtail, cdytail, adx, ady, bdx, bdy, ct_a, ct_b); - const bctlen = (0, _utilJs.sum)(bt_len, bt_c, ct_len, ct_b, bct); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adz, _16), _16); - const catlen = (0, _utilJs.sum)(ct_len, ct_a, at_len, at_c, cat); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdz, _16), _16); - const abtlen = (0, _utilJs.sum)(at_len, at_b, bt_len, bt_a, abt); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdz, _16), _16); - if (adztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, bc, adztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adztail, _16), _16); - } - if (bdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ca, bdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdztail, _16), _16); - } - if (cdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ab, cdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdztail, _16), _16); - } - if (adxtail !== 0) { - if (bdytail !== 0) finlen = tailadd(finlen, adxtail, bdytail, cdz, cdztail); - if (cdytail !== 0) finlen = tailadd(finlen, -adxtail, cdytail, bdz, bdztail); - } - if (bdxtail !== 0) { - if (cdytail !== 0) finlen = tailadd(finlen, bdxtail, cdytail, adz, adztail); - if (adytail !== 0) finlen = tailadd(finlen, -bdxtail, adytail, cdz, cdztail); - } - if (cdxtail !== 0) { - if (adytail !== 0) finlen = tailadd(finlen, cdxtail, adytail, bdz, bdztail); - if (bdytail !== 0) finlen = tailadd(finlen, -cdxtail, bdytail, adz, adztail); - } - return fin[finlen - 1]; -} -function orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const det = adz * (bdxcdy - cdxbdy) + bdz * (cdxady - adxcdy) + cdz * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz); - const errbound = o3derrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent); -} -function orient3dfast(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - return adx * (bdy * cdz - bdz * cdy) + bdx * (cdy * adz - cdz * ady) + cdx * (ady * bdz - adz * bdy); -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60fkW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "incircle", ()=>incircle); -parcelHelpers.export(exports, "incirclefast", ()=>incirclefast); -var _utilJs = require("./util.js"); -const iccerrboundA = (10 + 96 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundB = (4 + 48 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundC = (44 + 576 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const aa = (0, _utilJs.vec)(4); -const bb = (0, _utilJs.vec)(4); -const cc = (0, _utilJs.vec)(4); -const u = (0, _utilJs.vec)(4); -const v = (0, _utilJs.vec)(4); -const axtbc = (0, _utilJs.vec)(8); -const aytbc = (0, _utilJs.vec)(8); -const bxtca = (0, _utilJs.vec)(8); -const bytca = (0, _utilJs.vec)(8); -const cxtab = (0, _utilJs.vec)(8); -const cytab = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abtt = (0, _utilJs.vec)(4); -const bctt = (0, _utilJs.vec)(4); -const catt = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _16b = (0, _utilJs.vec)(16); -const _16c = (0, _utilJs.vec)(16); -const _32 = (0, _utilJs.vec)(32); -const _32b = (0, _utilJs.vec)(32); -const _48 = (0, _utilJs.vec)(48); -const _64 = (0, _utilJs.vec)(64); -let fin = (0, _utilJs.vec)(1152); -let fin2 = (0, _utilJs.vec)(1152); -function finadd(finlen, a, alen) { - finlen = (0, _utilJs.sum)(finlen, fin, a, alen, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail; - let axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen; - let abtlen, bctlen, catlen; - let abttlen, bcttlen, cattlen; - let n1, n0; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, bc, adx, _8), _8, adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bc, ady, _8), _8, ady, _16b), _16b, _32), _32, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdx, _8), _8, bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdy, _8), _8, bdy, _16b), _16b, _32b), _32b, _64), _64, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdx, _8), _8, cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdy, _8), _8, cdy, _16b), _16b, _32), _32, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = iccerrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0) return det; - errbound = iccerrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += (adx * adx + ady * ady) * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + 2 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx) + ((bdx * bdx + bdy * bdy) * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + 2 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) + ((cdx * cdx + cdy * cdy) * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + 2 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx)); - if (det >= errbound || -det >= errbound) return det; - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = adx * adx; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = ady * ady; - c = (0, _utilJs.splitter) * ady; - ahi = c - (c - ady); - alo = ady - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - aa[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - aa[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - aa[2] = _j - (u3 - bvirt) + (_i - bvirt); - aa[3] = u3; - } - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = bdx * bdx; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = bdy * bdy; - c = (0, _utilJs.splitter) * bdy; - ahi = c - (c - bdy); - alo = bdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - bb[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - bb[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - bb[2] = _j - (u3 - bvirt) + (_i - bvirt); - bb[3] = u3; - } - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = cdx * cdx; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = cdy * cdy; - c = (0, _utilJs.splitter) * cdy; - ahi = c - (c - cdy); - alo = cdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - cc[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - cc[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - cc[2] = _j - (u3 - bvirt) + (_i - bvirt); - cc[3] = u3; - } - if (adxtail !== 0) { - axtbclen = (0, _utilJs.scale)(4, bc, adxtail, axtbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(axtbclen, axtbc, 2 * adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adxtail, _8), _8, -cdy, _16c), _16c, _32, _48), _48); - } - if (adytail !== 0) { - aytbclen = (0, _utilJs.scale)(4, bc, adytail, aytbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(aytbclen, aytbc, 2 * ady, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adytail, _8), _8, cdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adytail, _8), _8, -bdx, _16c), _16c, _32, _48), _48); - } - if (bdxtail !== 0) { - bxtcalen = (0, _utilJs.scale)(4, ca, bdxtail, bxtca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bxtcalen, bxtca, 2 * bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdxtail, _8), _8, -ady, _16c), _16c, _32, _48), _48); - } - if (bdytail !== 0) { - bytcalen = (0, _utilJs.scale)(4, ca, bdytail, bytca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bytcalen, bytca, 2 * bdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdytail, _8), _8, adx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdytail, _8), _8, -cdx, _16c), _16c, _32, _48), _48); - } - if (cdxtail !== 0) { - cxtablen = (0, _utilJs.scale)(4, ab, cdxtail, cxtab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cxtablen, cxtab, 2 * cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, ady, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdxtail, _8), _8, -bdy, _16c), _16c, _32, _48), _48); - } - if (cdytail !== 0) { - cytablen = (0, _utilJs.scale)(4, ab, cdytail, cytab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cytablen, cytab, 2 * cdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdytail, _8), _8, bdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdytail, _8), _8, -adx, _16c), _16c, _32, _48), _48); - } - if (adxtail !== 0 || adytail !== 0) { - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = bdxtail * cdy; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * cdytail; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - s1 = cdxtail * -bdy; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * -bdy; - bhi = c - (c - -bdy); - blo = -bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * -bdytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * -bdytail; - bhi = c - (c - -bdytail); - blo = -bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - bctlen = (0, _utilJs.sum)(4, u, 4, v, bct); - s1 = bdxtail * cdytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdxtail * bdytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bctt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bctt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bctt[2] = _j - (u3 - bvirt) + (_i - bvirt); - bctt[3] = u3; - bcttlen = 4; - } else { - bct[0] = 0; - bctlen = 1; - bctt[0] = 0; - bcttlen = 1; - } - if (adxtail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(axtbclen, axtbc, adxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * adx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * adx, _16), _16, (0, _utilJs.scale)(len2, _8, adxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adxtail, _32), _32, _32b, _64), _64); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdytail, _16), _16); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, -adxtail, _8), _8, cdytail, _16), _16); - } - if (adytail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(aytbclen, aytbc, adytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * ady, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * ady, _16), _16, (0, _utilJs.scale)(len2, _8, adytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adytail, _32), _32, _32b, _64), _64); - } - } - if (bdxtail !== 0 || bdytail !== 0) { - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = cdxtail * ady; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * adytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -cdy; - n0 = -cdytail; - s1 = adxtail * n1; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * n0; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - catlen = (0, _utilJs.sum)(4, u, 4, v, cat); - s1 = cdxtail * adytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adxtail * cdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - catt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - catt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - catt[2] = _j - (u3 - bvirt) + (_i - bvirt); - catt[3] = u3; - cattlen = 4; - } else { - cat[0] = 0; - catlen = 1; - catt[0] = 0; - cattlen = 1; - } - if (bdxtail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bxtcalen, bxtca, bdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdx, _16), _16, (0, _utilJs.scale)(len2, _8, bdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdxtail, _32), _32, _32b, _64), _64); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdytail, _16), _16); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, -bdxtail, _8), _8, adytail, _16), _16); - } - if (bdytail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bytcalen, bytca, bdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdy, _16), _16, (0, _utilJs.scale)(len2, _8, bdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdytail, _32), _32, _32b, _64), _64); - } - } - if (cdxtail !== 0 || cdytail !== 0) { - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = adxtail * bdy; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * bdytail; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -ady; - n0 = -adytail; - s1 = bdxtail * n1; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * n0; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - abtlen = (0, _utilJs.sum)(4, u, 4, v, abt); - s1 = adxtail * bdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdxtail * adytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - abtt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - abtt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - abtt[2] = _j - (u3 - bvirt) + (_i - bvirt); - abtt[3] = u3; - abttlen = 4; - } else { - abt[0] = 0; - abtlen = 1; - abtt[0] = 0; - abttlen = 1; - } - if (cdxtail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cxtablen, cxtab, cdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdx, _16), _16, (0, _utilJs.scale)(len2, _8, cdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdxtail, _32), _32, _32b, _64), _64); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, adytail, _16), _16); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, -cdxtail, _8), _8, bdytail, _16), _16); - } - if (cdytail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cytablen, cytab, cdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdy, _16), _16, (0, _utilJs.scale)(len2, _8, cdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdytail, _32), _32, _32b, _64), _64); - } - } - return fin[finlen - 1]; -} -function incircle(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const alift = adx * adx + ady * ady; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const blift = bdx * bdx + bdy * bdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const clift = cdx * cdx + cdy * cdy; - const det = alift * (bdxcdy - cdxbdy) + blift * (cdxady - adxcdy) + clift * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * alift + (Math.abs(cdxady) + Math.abs(adxcdy)) * blift + (Math.abs(adxbdy) + Math.abs(bdxady)) * clift; - const errbound = iccerrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent); -} -function incirclefast(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const ady = ay - dy; - const bdx = bx - dx; - const bdy = by - dy; - const cdx = cx - dx; - const cdy = cy - dy; - const abdet = adx * bdy - bdx * ady; - const bcdet = bdx * cdy - cdx * bdy; - const cadet = cdx * ady - adx * cdy; - const alift = adx * adx + ady * ady; - const blift = bdx * bdx + bdy * bdy; - const clift = cdx * cdx + cdy * cdy; - return alift * bcdet + blift * cadet + clift * abdet; -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdazk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "insphere", ()=>insphere); -parcelHelpers.export(exports, "inspherefast", ()=>inspherefast); -var _utilJs = require("./util.js"); -const isperrboundA = (16 + 224 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundB = (5 + 72 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundC = (71 + 1408 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const ab = (0, _utilJs.vec)(4); -const bc = (0, _utilJs.vec)(4); -const cd = (0, _utilJs.vec)(4); -const de = (0, _utilJs.vec)(4); -const ea = (0, _utilJs.vec)(4); -const ac = (0, _utilJs.vec)(4); -const bd = (0, _utilJs.vec)(4); -const ce = (0, _utilJs.vec)(4); -const da = (0, _utilJs.vec)(4); -const eb = (0, _utilJs.vec)(4); -const abc = (0, _utilJs.vec)(24); -const bcd = (0, _utilJs.vec)(24); -const cde = (0, _utilJs.vec)(24); -const dea = (0, _utilJs.vec)(24); -const eab = (0, _utilJs.vec)(24); -const abd = (0, _utilJs.vec)(24); -const bce = (0, _utilJs.vec)(24); -const cda = (0, _utilJs.vec)(24); -const deb = (0, _utilJs.vec)(24); -const eac = (0, _utilJs.vec)(24); -const adet = (0, _utilJs.vec)(1152); -const bdet = (0, _utilJs.vec)(1152); -const cdet = (0, _utilJs.vec)(1152); -const ddet = (0, _utilJs.vec)(1152); -const edet = (0, _utilJs.vec)(1152); -const abdet = (0, _utilJs.vec)(2304); -const cddet = (0, _utilJs.vec)(2304); -const cdedet = (0, _utilJs.vec)(3456); -const deter = (0, _utilJs.vec)(5760); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _8c = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _24 = (0, _utilJs.vec)(24); -const _48 = (0, _utilJs.vec)(48); -const _48b = (0, _utilJs.vec)(48); -const _96 = (0, _utilJs.vec)(96); -const _192 = (0, _utilJs.vec)(192); -const _384x = (0, _utilJs.vec)(384); -const _384y = (0, _utilJs.vec)(384); -const _384z = (0, _utilJs.vec)(384); -const _768 = (0, _utilJs.vec)(768); -function sum_three_scale(a, b, c, az, bz, cz, out) { - return (0, _utilJs.sum_three)((0, _utilJs.scale)(4, a, az, _8), _8, (0, _utilJs.scale)(4, b, bz, _8b), _8b, (0, _utilJs.scale)(4, c, cz, _8c), _8c, _16, out); -} -function liftexact(alen, a, blen, b, clen, c, dlen, d, x, y, z, out) { - const len = (0, _utilJs.sum)((0, _utilJs.sum)(alen, a, blen, b, _48), _48, (0, _utilJs.negate)((0, _utilJs.sum)(clen, c, dlen, d, _48b), _48b), _48b, _96); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _96, x, _192), _192, x, _384x), _384x, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, y, _192), _192, y, _384y), _384y, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, z, _192), _192, z, _384z), _384z, _768, out); -} -function insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - s1 = ax * by; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ay; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - s1 = bx * cy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * by; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cx * dy; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * cy; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - cd[2] = _j - (u3 - bvirt) + (_i - bvirt); - cd[3] = u3; - s1 = dx * ey; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * dy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - de[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - de[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - de[2] = _j - (u3 - bvirt) + (_i - bvirt); - de[3] = u3; - s1 = ex * ay; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * ey; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ea[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ea[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ea[2] = _j - (u3 - bvirt) + (_i - bvirt); - ea[3] = u3; - s1 = ax * cy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * ay; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ac[2] = _j - (u3 - bvirt) + (_i - bvirt); - ac[3] = u3; - s1 = bx * dy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * by; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bd[2] = _j - (u3 - bvirt) + (_i - bvirt); - bd[3] = u3; - s1 = cx * ey; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * cy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ce[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ce[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ce[2] = _j - (u3 - bvirt) + (_i - bvirt); - ce[3] = u3; - s1 = dx * ay; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * dy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - da[2] = _j - (u3 - bvirt) + (_i - bvirt); - da[3] = u3; - s1 = ex * by; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ey; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - eb[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - eb[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - eb[2] = _j - (u3 - bvirt) + (_i - bvirt); - eb[3] = u3; - const abclen = sum_three_scale(ab, bc, ac, cz, az, -bz, abc); - const bcdlen = sum_three_scale(bc, cd, bd, dz, bz, -cz, bcd); - const cdelen = sum_three_scale(cd, de, ce, ez, cz, -dz, cde); - const dealen = sum_three_scale(de, ea, da, az, dz, -ez, dea); - const eablen = sum_three_scale(ea, ab, eb, bz, ez, -az, eab); - const abdlen = sum_three_scale(ab, bd, da, dz, az, bz, abd); - const bcelen = sum_three_scale(bc, ce, eb, ez, bz, cz, bce); - const cdalen = sum_three_scale(cd, da, ac, az, cz, dz, cda); - const deblen = sum_three_scale(de, eb, bd, bz, dz, ez, deb); - const eaclen = sum_three_scale(ea, ac, ce, cz, ez, az, eac); - const deterlen = (0, _utilJs.sum_three)(liftexact(cdelen, cde, bcelen, bce, deblen, deb, bcdlen, bcd, ax, ay, az, adet), adet, liftexact(dealen, dea, cdalen, cda, eaclen, eac, cdelen, cde, bx, by, bz, bdet), bdet, (0, _utilJs.sum_three)(liftexact(eablen, eab, deblen, deb, abdlen, abd, dealen, dea, cx, cy, cz, cdet), cdet, liftexact(abclen, abc, eaclen, eac, bcelen, bce, eablen, eab, dx, dy, dz, ddet), ddet, liftexact(bcdlen, bcd, abdlen, abd, cdalen, cda, abclen, abc, ex, ey, ez, edet), edet, cddet, cdedet), cdedet, abdet, deter); - return deter[deterlen - 1]; -} -const xdet = (0, _utilJs.vec)(96); -const ydet = (0, _utilJs.vec)(96); -const zdet = (0, _utilJs.vec)(96); -const fin = (0, _utilJs.vec)(1152); -function liftadapt(a, b, c, az, bz, cz, x, y, z, out) { - const len = sum_three_scale(a, b, c, az, bz, cz, _24); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _24, x, _48), _48, x, xdet), xdet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, y, _48), _48, y, ydet), ydet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, z, _48), _48, z, zdet), zdet, _192, out); -} -function insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent) { - let ab3, bc3, cd3, da3, ac3, bd3; - let aextail, bextail, cextail, dextail; - let aeytail, beytail, ceytail, deytail; - let aeztail, beztail, ceztail, deztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0; - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - s1 = aex * bey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bex * aey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - ab3 = _j + _i; - bvirt = ab3 - _j; - ab[2] = _j - (ab3 - bvirt) + (_i - bvirt); - ab[3] = ab3; - s1 = bex * cey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * bey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - bc3 = _j + _i; - bvirt = bc3 - _j; - bc[2] = _j - (bc3 - bvirt) + (_i - bvirt); - bc[3] = bc3; - s1 = cex * dey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * cey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - cd3 = _j + _i; - bvirt = cd3 - _j; - cd[2] = _j - (cd3 - bvirt) + (_i - bvirt); - cd[3] = cd3; - s1 = dex * aey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = aex * dey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - da3 = _j + _i; - bvirt = da3 - _j; - da[2] = _j - (da3 - bvirt) + (_i - bvirt); - da[3] = da3; - s1 = aex * cey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * aey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - ac3 = _j + _i; - bvirt = ac3 - _j; - ac[2] = _j - (ac3 - bvirt) + (_i - bvirt); - ac[3] = ac3; - s1 = bex * dey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * bey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - bd3 = _j + _i; - bvirt = bd3 - _j; - bd[2] = _j - (bd3 - bvirt) + (_i - bvirt); - bd[3] = bd3; - const finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(bc, cd, bd, dez, bez, -cez, aex, aey, aez, adet), adet), adet, liftadapt(cd, da, ac, aez, cez, dez, bex, bey, bez, bdet), bdet, abdet), abdet, (0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(da, ab, bd, bez, dez, aez, cex, cey, cez, cdet), cdet), cdet, liftadapt(ab, bc, ac, cez, aez, -bez, dex, dey, dez, ddet), ddet, cddet), cddet, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = isperrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - aex; - aextail = ax - (aex + bvirt) + (bvirt - ex); - bvirt = ay - aey; - aeytail = ay - (aey + bvirt) + (bvirt - ey); - bvirt = az - aez; - aeztail = az - (aez + bvirt) + (bvirt - ez); - bvirt = bx - bex; - bextail = bx - (bex + bvirt) + (bvirt - ex); - bvirt = by - bey; - beytail = by - (bey + bvirt) + (bvirt - ey); - bvirt = bz - bez; - beztail = bz - (bez + bvirt) + (bvirt - ez); - bvirt = cx - cex; - cextail = cx - (cex + bvirt) + (bvirt - ex); - bvirt = cy - cey; - ceytail = cy - (cey + bvirt) + (bvirt - ey); - bvirt = cz - cez; - ceztail = cz - (cez + bvirt) + (bvirt - ez); - bvirt = dx - dex; - dextail = dx - (dex + bvirt) + (bvirt - ex); - bvirt = dy - dey; - deytail = dy - (dey + bvirt) + (bvirt - ey); - bvirt = dz - dez; - deztail = dz - (dez + bvirt) + (bvirt - ez); - if (aextail === 0 && aeytail === 0 && aeztail === 0 && bextail === 0 && beytail === 0 && beztail === 0 && cextail === 0 && ceytail === 0 && ceztail === 0 && dextail === 0 && deytail === 0 && deztail === 0) return det; - errbound = isperrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - const abeps = aex * beytail + bey * aextail - (aey * bextail + bex * aeytail); - const bceps = bex * ceytail + cey * bextail - (bey * cextail + cex * beytail); - const cdeps = cex * deytail + dey * cextail - (cey * dextail + dex * ceytail); - const daeps = dex * aeytail + aey * dextail - (dey * aextail + aex * deytail); - const aceps = aex * ceytail + cey * aextail - (aey * cextail + cex * aeytail); - const bdeps = bex * deytail + dey * bextail - (bey * dextail + dex * beytail); - det += (bex * bex + bey * bey + bez * bez) * (cez * daeps + dez * aceps + aez * cdeps + (ceztail * da3 + deztail * ac3 + aeztail * cd3)) + (dex * dex + dey * dey + dez * dez) * (aez * bceps - bez * aceps + cez * abeps + (aeztail * bc3 - beztail * ac3 + ceztail * ab3)) - ((aex * aex + aey * aey + aez * aez) * (bez * cdeps - cez * bdeps + dez * bceps + (beztail * cd3 - ceztail * bd3 + deztail * bc3)) + (cex * cex + cey * cey + cez * cez) * (dez * abeps + aez * bdeps + bez * daeps + (deztail * ab3 + aeztail * bd3 + beztail * da3))) + 2 * ((bex * bextail + bey * beytail + bez * beztail) * (cez * da3 + dez * ac3 + aez * cd3) + (dex * dextail + dey * deytail + dez * deztail) * (aez * bc3 - bez * ac3 + cez * ab3) - ((aex * aextail + aey * aeytail + aez * aeztail) * (bez * cd3 - cez * bd3 + dez * bc3) + (cex * cextail + cey * ceytail + cez * ceztail) * (dez * ab3 + aez * bd3 + bez * da3))); - if (det >= errbound || -det >= errbound) return det; - return insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez); -} -function insphere(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - const aexbey = aex * bey; - const bexaey = bex * aey; - const ab = aexbey - bexaey; - const bexcey = bex * cey; - const cexbey = cex * bey; - const bc = bexcey - cexbey; - const cexdey = cex * dey; - const dexcey = dex * cey; - const cd = cexdey - dexcey; - const dexaey = dex * aey; - const aexdey = aex * dey; - const da = dexaey - aexdey; - const aexcey = aex * cey; - const cexaey = cex * aey; - const ac = aexcey - cexaey; - const bexdey = bex * dey; - const dexbey = dex * bey; - const bd = bexdey - dexbey; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - const det = clift * (dez * ab + aez * bd + bez * da) - dlift * (aez * bc - bez * ac + cez * ab) + (alift * (bez * cd - cez * bd + dez * bc) - blift * (cez * da + dez * ac + aez * cd)); - const aezplus = Math.abs(aez); - const bezplus = Math.abs(bez); - const cezplus = Math.abs(cez); - const dezplus = Math.abs(dez); - const aexbeyplus = Math.abs(aexbey) + Math.abs(bexaey); - const bexceyplus = Math.abs(bexcey) + Math.abs(cexbey); - const cexdeyplus = Math.abs(cexdey) + Math.abs(dexcey); - const dexaeyplus = Math.abs(dexaey) + Math.abs(aexdey); - const aexceyplus = Math.abs(aexcey) + Math.abs(cexaey); - const bexdeyplus = Math.abs(bexdey) + Math.abs(dexbey); - const permanent = (cexdeyplus * bezplus + bexdeyplus * cezplus + bexceyplus * dezplus) * alift + (dexaeyplus * cezplus + aexceyplus * dezplus + cexdeyplus * aezplus) * blift + (aexbeyplus * dezplus + bexdeyplus * aezplus + dexaeyplus * bezplus) * clift + (bexceyplus * aezplus + aexceyplus * bezplus + aexbeyplus * cezplus) * dlift; - const errbound = isperrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return -insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent); -} -function inspherefast(pax, pay, paz, pbx, pby, pbz, pcx, pcy, pcz, pdx, pdy, pdz, pex, pey, pez) { - const aex = pax - pex; - const bex = pbx - pex; - const cex = pcx - pex; - const dex = pdx - pex; - const aey = pay - pey; - const bey = pby - pey; - const cey = pcy - pey; - const dey = pdy - pey; - const aez = paz - pez; - const bez = pbz - pez; - const cez = pcz - pez; - const dez = pdz - pez; - const ab = aex * bey - bex * aey; - const bc = bex * cey - cex * bey; - const cd = cex * dey - dex * cey; - const da = dex * aey - aex * dey; - const ac = aex * cey - cex * aey; - const bd = bex * dey - dex * bey; - const abc = aez * bc - bez * ac + cez * ab; - const bcd = bez * cd - cez * bd + dez * bc; - const cda = cez * da + dez * ac + aez * cd; - const dab = dez * ab + aez * bd + bez * da; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - return clift * dab - dlift * abc + (alift * bcd - blift * cda); -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"52EAe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -const epsilon = 1e-6; -class Path { - constructor(){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; + type2 = TokenIdentifier; } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; + return { + type: type2, + value: id2, + start, + end: index + }; + } + function scanPunctuator() { + var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; + switch (code) { + // Check for most common single-character punctuators. + case 46: + // . dot + case 40: + // ( open bracket + case 41: + // ) close bracket + case 59: + // ; semicolon + case 44: + // , comma + case 123: + // { open curly brace + case 125: + // } close curly brace + case 91: + // [ + case 93: + // ] + case 58: + // : + case 63: + // ? + case 126: + ++index; + return { + type: TokenPunctuator, + value: String.fromCharCode(code), + start, + end: index + }; + default: + code2 = source.charCodeAt(index + 1); + if (code2 === 61) { + switch (code) { + case 43: + // + + case 45: + // - + case 47: + // / + case 60: + // < + case 62: + // > + case 94: + // ^ + case 124: + // | + case 37: + // % + case 38: + // & + case 42: + index += 2; + return { + type: TokenPunctuator, + value: String.fromCharCode(code) + String.fromCharCode(code2), + start, + end: index + }; + case 33: + // ! + case 61: + index += 2; + if (source.charCodeAt(index) === 61) { + ++index; + } + return { + type: TokenPunctuator, + value: source.slice(start, index), + start, + end: index + }; + } } } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; + ch4 = source.substr(index, 4); + if (ch4 === ">>>=") { + index += 4; + return { + type: TokenPunctuator, + value: ch4, + start, + end: index + }; } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; + ch3 = ch4.substr(0, 3); + if (ch3 === ">>>" || ch3 === "<<=" || ch3 === ">>=") { + index += 3; + return { + type: TokenPunctuator, + value: ch3, + start, + end: index + }; } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; + ch2 = ch3.substr(0, 2); + if (ch1 === ch2[1] && "+-<>&|".includes(ch1) || ch2 === "=>") { + index += 2; + return { + type: TokenPunctuator, + value: ch2, + start, + end: index + }; } - value() { - return this._ || null; - } -} -exports.default = Path; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1V5gi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -class Polygon { - constructor(){ - this._ = []; - } - moveTo(x, y) { - this._.push([ - x, - y - ]); + if (ch2 === "//") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - closePath() { - this._.push(this._[0].slice()); + if ("<>=!+-*%&|^/".includes(ch1)) { + ++index; + return { + type: TokenPunctuator, + value: ch1, + start, + end: index + }; } - lineTo(x, y) { - this._.push([ - x, - y - ]); + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + function scanHexLiteral(start) { + let number2 = ""; + while (index < length) { + if (!isHexDigit(source[index])) { + break; + } + number2 += source[index++]; } - value() { - return this._.length ? this._ : null; - } -} -exports.default = Polygon; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dCf1s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [ - 0, - 0, - 960, - 500 - ]){ - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); + if (number2.length === 0) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - update() { - this.delaunay.update(); - this._init(); - return this; + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - _init() { - const { delaunay: { points, hull, triangles }, vectors } = this; - let bx, by; // lazily computed barycenter of the hull - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for(let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2){ - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const ab = (dx * ey - dy * ex) * 2; - if (Math.abs(ab) < 1e-9) { - // For a degenerate triangle, the circumcenter is at the infinity, in a - // direction orthogonal to the halfedge and away from the “center” of - // the diagram <bx, by>, defined as the hull’s barycenter. - if (bx === undefined) { - bx = by = 0; - for (const i of hull)bx += points[i * 2], by += points[i * 2 + 1]; - bx /= hull.length, by /= hull.length; - } - const a = 1e9 * Math.sign((bx - x1) * ey - (by - y1) * ex); - x = (x1 + x3) / 2 - a * ey; - y = (y1 + y3) / 2 + a * ex; - } else { - const d = 1 / ab; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for(let i = 0; i < hull.length; ++i){ - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; - if (hull.length <= 1) return null; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for(let i = 0; i < hull.length; ++i){ - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while(points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1)n -= 2; - for(let i = 2; i < n; i += 2)if (points[i] !== points[i - 2] || points[i + 1] !== points[i - 1]) context.lineTo(points[i], points[i + 1]); - context.closePath(); - return buffer && buffer.value(); + return { + type: TokenNumericLiteral, + value: parseInt("0x" + number2, 16), + start, + end: index + }; + } + function scanOctalLiteral(start) { + let number2 = "0" + source[index++]; + while (index < length) { + if (!isOctalDigit(source[index])) { + break; + } + number2 += source[index++]; } - *cellPolygons() { - const { delaunay: { points } } = this; - for(let i = 0, n = points.length / 2; i < n; ++i){ - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; + if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + return { + type: TokenNumericLiteral, + value: parseInt(number2, 8), + octal: true, + start, + end: index + }; + } + function scanNumericLiteral() { + var number2, start, ch2; + ch2 = source[index]; + assert(isDecimalDigit(ch2.charCodeAt(0)) || ch2 === ".", "Numeric literal must start with a decimal digit or a decimal point"); + start = index; + number2 = ""; + if (ch2 !== ".") { + number2 = source[index++]; + ch2 = source[index]; + if (number2 === "0") { + if (ch2 === "x" || ch2 === "X") { + ++index; + return scanHexLiteral(start); + } + if (isOctalDigit(ch2)) { + return scanOctalLiteral(start); + } + if (ch2 && isDecimalDigit(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } + } + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; } - cellPolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); + if (ch2 === ".") { + number2 += source[index++]; + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; + } + if (ch2 === "e" || ch2 === "E") { + number2 += source[index++]; + ch2 = source[index]; + if (ch2 === "+" || ch2 === "-") { + number2 += source[index++]; + } + if (isDecimalDigit(source.charCodeAt(index))) { + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; } + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)){ - const cj = this._clip(j); - // find the common edge - if (cj) loop: for(let ai = 0, li = ci.length; ai < li; ai += 2){ - for(let aj = 0, lj = cj.length; aj < lj; aj += 2)if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { - yield j; - break loop; + return { + type: TokenNumericLiteral, + value: parseFloat(number2), + start, + end: index + }; + } + function scanStringLiteral() { + var str = "", quote, start, ch2, code, octal = false; + quote = source[index]; + assert(quote === "'" || quote === '"', "String literal must starts with a quote"); + start = index; + ++index; + while (index < length) { + ch2 = source[index++]; + if (ch2 === quote) { + quote = ""; + break; + } else if (ch2 === "\\") { + ch2 = source[index++]; + if (!ch2 || !isLineTerminator(ch2.charCodeAt(0))) { + switch (ch2) { + case "u": + case "x": + if (source[index] === "{") { + ++index; + str += scanUnicodeCodePointEscape(); + } else { + str += scanHexEscape(ch2); + } + break; + case "n": + str += "\n"; + break; + case "r": + str += "\r"; + break; + case "t": + str += " "; + break; + case "b": + str += "\b"; + break; + case "f": + str += "\f"; + break; + case "v": + str += "\v"; + break; + default: + if (isOctalDigit(ch2)) { + code = "01234567".indexOf(ch2); + if (code !== 0) { + octal = true; } - } + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + "01234567".indexOf(source[index++]); + if ("0123".includes(ch2) && index < length && isOctalDigit(source[index])) { + code = code * 8 + "01234567".indexOf(source[index++]); + } + } + str += String.fromCharCode(code); + } else { + str += ch2; + } + break; + } + } else { + if (ch2 === "\r" && source[index] === "\n") { + ++index; + } } + } else if (isLineTerminator(ch2.charCodeAt(0))) { + break; + } else { + str += ch2; + } } - _cell(i) { - const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - }while (e !== e0 && e !== -1); - return points; + if (quote !== "") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - const points = this._cell(i); - if (points === null) return null; - const { vectors: V } = this; - const v = i * 4; - return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points)); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1 = 0; - for(let j = 0; j < n; j += 2){ - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [ - x1, - y1 - ]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [ - sx0, - sy0 - ]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [ - sx1, - sy1 - ]; - } + return { + type: TokenStringLiteral, + value: str, + octal, + start, + end: index + }; + } + function testRegExp(pattern, flags) { + let tmp = pattern; + if (flags.includes("u")) { + tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1) => { + if (parseInt($1, 16) <= 1114111) { + return "x"; } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - // for more robustness, always consider the segment in the same order - const flip = c0 < c1; - if (flip) [x0, y0, x1, y1, c0, c1] = [ - x1, - y1, - x0, - y0, - c1, - c0 - ]; - while(true){ - if (c0 === 0 && c1 === 0) return flip ? [ - x1, - y1, - x0, - y0 - ] : [ - x0, - y0, - x1, - y1 - ]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 8) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 4) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 2) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) for(let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2){ - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) P = [ - this.xmin, - this.ymin, - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax - ]; - return P; + throwError({}, MessageInvalidRegExp); + }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"); } - _edge(i, e0, e1, P, j) { - while(e0 !== e1){ - let x, y; - switch(e0){ - case 5: - e0 = 4; - continue; // top-left - case 4: - e0 = 6, x = this.xmax, y = this.ymin; - break; // top - case 6: - e0 = 2; - continue; // top-right - case 2: - e0 = 10, x = this.xmax, y = this.ymax; - break; // right - case 10: - e0 = 8; - continue; // bottom-right - case 8: - e0 = 9, x = this.xmin, y = this.ymax; - break; // bottom - case 9: - e0 = 1; - continue; // bottom-left - case 1: - e0 = 5, x = this.xmin, y = this.ymin; - break; // left - } - // Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are - // undefined, the conditional statement will be executed. - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) P.splice(j, 0, x, y), j += 2; - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; + try { + new RegExp(tmp); + } catch (e) { + throwError({}, MessageInvalidRegExp); + } + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } + } + function scanRegExpBody() { + var ch2, str, classMarker, terminated, body; + ch2 = source[index]; + assert(ch2 === "/", "Regular expression literal must start with a slash"); + str = source[index++]; + classMarker = false; + terminated = false; + while (index < length) { + ch2 = source[index++]; + str += ch2; + if (ch2 === "\\") { + ch2 = source[index++]; + if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } + str += ch2; + } else if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } else if (classMarker) { + if (ch2 === "]") { + classMarker = false; + } + } else { + if (ch2 === "/") { + terminated = true; + break; + } else if (ch2 === "[") { + classMarker = true; } - return [ - x, - y - ]; + } + } + if (!terminated) { + throwError({}, MessageUnterminatedRegExp); + } + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; + } + function scanRegExpFlags() { + var ch2, str, flags; + str = ""; + flags = ""; + while (index < length) { + ch2 = source[index]; + if (!isIdentifierPart(ch2.charCodeAt(0))) { + break; + } + ++index; + if (ch2 === "\\" && index < length) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } else { + flags += ch2; + str += ch2; + } + } + if (flags.search(/[^gimuy]/g) >= 0) { + throwError({}, MessageInvalidRegExp, flags); + } + return { + value: flags, + literal: str + }; + } + function scanRegExp() { + var start, body, flags, value2; + lookahead = null; + skipComment(); + start = index; + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value2 = testRegExp(body.value, flags.value); + return { + literal: body.literal + flags.literal, + value: value2, + regex: { + pattern: body.value, + flags: flags.value + }, + start, + end: index + }; + } + function isIdentifierName(token) { + return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; + } + function advance() { + skipComment(); + if (index >= length) { + return { + type: TokenEOF, + start: index, + end: index + }; + } + const ch2 = source.charCodeAt(index); + if (isIdentifierStart(ch2)) { + return scanIdentifier(); + } + if (ch2 === 40 || ch2 === 41 || ch2 === 59) { + return scanPunctuator(); + } + if (ch2 === 39 || ch2 === 34) { + return scanStringLiteral(); + } + if (ch2 === 46) { + if (isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } + if (isDecimalDigit(ch2)) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } + function lex() { + const token = lookahead; + index = token.end; + lookahead = advance(); + index = token.end; + return token; + } + function peek() { + const pos = index; + lookahead = advance(); + index = pos; + } + function finishArrayExpression(elements) { + const node = new ASTNode(SyntaxArrayExpression); + node.elements = elements; + return node; + } + function finishBinaryExpression(operator2, left, right) { + const node = new ASTNode(operator2 === "||" || operator2 === "&&" ? SyntaxLogicalExpression : SyntaxBinaryExpression); + node.operator = operator2; + node.left = left; + node.right = right; + return node; + } + function finishCallExpression(callee, args) { + const node = new ASTNode(SyntaxCallExpression); + node.callee = callee; + node.arguments = args; + return node; + } + function finishConditionalExpression(test2, consequent, alternate) { + const node = new ASTNode(SyntaxConditionalExpression); + node.test = test2; + node.consequent = consequent; + node.alternate = alternate; + return node; + } + function finishIdentifier(name) { + const node = new ASTNode(SyntaxIdentifier); + node.name = name; + return node; + } + function finishLiteral(token) { + const node = new ASTNode(SyntaxLiteral); + node.value = token.value; + node.raw = source.slice(token.start, token.end); + if (token.regex) { + if (node.raw === "//") { + node.raw = "/(?:)/"; + } + node.regex = token.regex; + } + return node; + } + function finishMemberExpression(accessor2, object2, property2) { + const node = new ASTNode(SyntaxMemberExpression); + node.computed = accessor2 === "["; + node.object = object2; + node.property = property2; + if (!node.computed) property2.member = true; + return node; + } + function finishObjectExpression(properties) { + const node = new ASTNode(SyntaxObjectExpression); + node.properties = properties; + return node; + } + function finishProperty(kind, key2, value2) { + const node = new ASTNode(SyntaxProperty); + node.key = key2; + node.value = value2; + node.kind = kind; + return node; + } + function finishUnaryExpression(operator2, argument) { + const node = new ASTNode(SyntaxUnaryExpression); + node.operator = operator2; + node.argument = argument; + node.prefix = true; + return node; + } + function throwError(token, messageFormat) { + var error2, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index2) => { + assert(index2 < args.length, "Message reference must be in range"); + return args[index2]; + }); + error2 = new Error(msg); + error2.index = index; + error2.description = msg; + throw error2; + } + function throwUnexpected(token) { + if (token.type === TokenEOF) { + throwError(token, MessageUnexpectedEOS); + } + if (token.type === TokenNumericLiteral) { + throwError(token, MessageUnexpectedNumber); + } + if (token.type === TokenStringLiteral) { + throwError(token, MessageUnexpectedString); + } + if (token.type === TokenIdentifier) { + throwError(token, MessageUnexpectedIdentifier); + } + if (token.type === TokenKeyword) { + throwError(token, MessageUnexpectedReserved); + } + throwError(token, MessageUnexpectedToken, token.value); + } + function expect(value2) { + const token = lex(); + if (token.type !== TokenPunctuator || token.value !== value2) { + throwUnexpected(token); + } + } + function match(value2) { + return lookahead.type === TokenPunctuator && lookahead.value === value2; + } + function matchKeyword(keyword) { + return lookahead.type === TokenKeyword && lookahead.value === keyword; + } + function parseArrayInitialiser() { + const elements = []; + index = lookahead.start; + expect("["); + while (!match("]")) { + if (match(",")) { + lex(); + elements.push(null); + } else { + elements.push(parseConditionalExpression()); + if (!match("]")) { + expect(","); + } + } + } + lex(); + return finishArrayExpression(elements); + } + function parseObjectPropertyKey() { + index = lookahead.start; + const token = lex(); + if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { + if (token.octal) { + throwError(token, MessageStrictOctalLiteral); + } + return finishLiteral(token); + } + return finishIdentifier(token.value); + } + function parseObjectProperty() { + var token, key2, id2, value2; + index = lookahead.start; + token = lookahead; + if (token.type === TokenIdentifier) { + id2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", id2, value2); + } + if (token.type === TokenEOF || token.type === TokenPunctuator) { + throwUnexpected(token); + } else { + key2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", key2, value2); + } + } + function parseObjectInitialiser() { + var properties = [], property2, name, key2, map2 = {}, toString2 = String; + index = lookahead.start; + expect("{"); + while (!match("}")) { + property2 = parseObjectProperty(); + if (property2.key.type === SyntaxIdentifier) { + name = property2.key.name; + } else { + name = toString2(property2.key.value); + } + key2 = "$" + name; + if (Object.prototype.hasOwnProperty.call(map2, key2)) { + throwError({}, MessageStrictDuplicateProperty); + } else { + map2[key2] = true; + } + properties.push(property2); + if (!match("}")) { + expect(","); + } + } + expect("}"); + return finishObjectExpression(properties); + } + function parseGroupExpression() { + expect("("); + const expr2 = parseExpression(); + expect(")"); + return expr2; + } + const legalKeywords = { + "if": 1 + }; + function parsePrimaryExpression() { + var type2, token, expr2; + if (match("(")) { + return parseGroupExpression(); + } + if (match("[")) { + return parseArrayInitialiser(); + } + if (match("{")) { + return parseObjectInitialiser(); + } + type2 = lookahead.type; + index = lookahead.start; + if (type2 === TokenIdentifier || legalKeywords[lookahead.value]) { + expr2 = finishIdentifier(lex().value); + } else if (type2 === TokenStringLiteral || type2 === TokenNumericLiteral) { + if (lookahead.octal) { + throwError(lookahead, MessageStrictOctalLiteral); + } + expr2 = finishLiteral(lex()); + } else if (type2 === TokenKeyword) { + throw new Error(DISABLED); + } else if (type2 === TokenBooleanLiteral) { + token = lex(); + token.value = token.value === "true"; + expr2 = finishLiteral(token); + } else if (type2 === TokenNullLiteral) { + token = lex(); + token.value = null; + expr2 = finishLiteral(token); + } else if (match("/") || match("/=")) { + expr2 = finishLiteral(scanRegExp()); + peek(); + } else { + throwUnexpected(lex()); } - _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); + return expr2; + } + function parseArguments() { + const args = []; + expect("("); + if (!match(")")) { + while (index < length) { + args.push(parseConditionalExpression()); + if (match(")")) { + break; + } + expect(","); + } } - _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); + expect(")"); + return args; + } + function parseNonComputedProperty() { + index = lookahead.start; + const token = lex(); + if (!isIdentifierName(token)) { + throwUnexpected(token); } - _simplify(P) { - if (P && P.length > 4) { - for(let i = 0; i < P.length; i += 2){ - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) P.splice(j, 2), i -= 2; - } - if (!P.length) P = null; - } - return P; - } -} -exports.default = Voronoi; - -},{"./path.js":"52EAe","./polygon.js":"1V5gi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Db9C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "wordcloud", ()=>Wordcloud); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _vegaScale = require("vega-scale"); -var _vegaStatistics = require("vega-statistics"); -/* -Copyright (c) 2013, Jason Davies. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * The name Jason Davies may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ // Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ -// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf -var cloudRadians = Math.PI / 180, cw = 64, ch = 2048; -function cloud() { - var size = [ - 256, - 256 - ], text, font, fontSize, fontStyle, fontWeight, rotate, padding, spiral = archimedeanSpiral, words = [], random = Math.random, cloud = {}; - cloud.layout = function() { - var contextAndRatio = getContext((0, _vegaCanvas.canvas)()), board = zeroArray((size[0] >> 5) * size[1]), bounds = null, n = words.length, i = -1, tags = [], data = words.map((d)=>({ - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - })).sort((a, b)=>b.size - a.size); - while(++i < n){ - var d = data[i]; - d.x = size[0] * (random() + .5) >> 1; - d.y = size[1] * (random() + .5) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [ - { - x: d.x + d.x0, - y: d.y + d.y0 - }, - { - x: d.x + d.x1, - y: d.y + d.y1 - } - ]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - return tags; - }; - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - return { - context: context, - ratio: ratio - }; + return finishIdentifier(token.value); + } + function parseNonComputedMember() { + expect("."); + return parseNonComputedProperty(); + } + function parseComputedMember() { + expect("["); + const expr2 = parseExpression(); + expect("]"); + return expr2; + } + function parseLeftHandSideExpressionAllowCall() { + var expr2, args, property2; + expr2 = parsePrimaryExpression(); + for (; ; ) { + if (match(".")) { + property2 = parseNonComputedMember(); + expr2 = finishMemberExpression(".", expr2, property2); + } else if (match("(")) { + args = parseArguments(); + expr2 = finishCallExpression(expr2, args); + } else if (match("[")) { + property2 = parseComputedMember(); + expr2 = finishMemberExpression("[", expr2, property2); + } else { + break; + } } - function place(board, tag, bounds) { - var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size[0], size[1]), s = spiral(size), dt = random() < .5 ? 1 : -1, t = -dt, dxdy, dx, dy; - while(dxdy = s(t += dt)){ - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - tag.x = startX + dx; - tag.y = startY + dy; - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, w = tag.width >> 5, sw = size[0] >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++)board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; + return expr2; + } + function parsePostfixExpression() { + const expr2 = parseLeftHandSideExpressionAllowCall(); + if (lookahead.type === TokenPunctuator) { + if (match("++") || match("--")) { + throw new Error(DISABLED); + } } - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else return words; - }; - cloud.size = function(_) { - if (arguments.length) { - size = [ - +_[0], - +_[1] - ]; - return cloud; - } else return size; - }; - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else return font; - }; - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else return fontStyle; - }; - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else return fontWeight; - }; - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else return rotate; - }; - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else return text; - }; - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else return spiral; - }; - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else return fontSize; - }; - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else return padding; - }; - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else return random; - }; - return cloud; -} -// Fetches a monochrome sprite bitmap for the specified text. -// Load in batches for speed. -function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, ratio = contextAndRatio.ratio; - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, y = 0, maxh = 0, n = data.length, w, w32, h, i, j; - --di; - while(++di < n){ - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), cr = Math.cos(d.rotate * cloudRadians), wcr = w * cr, wsr = w * sr, hcr = h * cr, hsr = h * sr; - w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else w = w + 0x1f >> 5 << 5; - if (h > maxh) maxh = h; - if (x + w >= cw << 5) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; - while(--di >= 0){ - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for(i = 0; i < h * w32; i++)sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, seenRow = -1; - for(j = 0; j < h; j++){ - for(i = 0; i < w; i++){ - var k = w32 * j + (i >> 5), m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); + return expr2; + } + function parseUnaryExpression() { + var token, expr2; + if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { + expr2 = parsePostfixExpression(); + } else if (match("++") || match("--")) { + throw new Error(DISABLED); + } else if (match("+") || match("-") || match("~") || match("!")) { + token = lex(); + expr2 = parseUnaryExpression(); + expr2 = finishUnaryExpression(token.value, expr2); + } else if (matchKeyword("delete") || matchKeyword("void") || matchKeyword("typeof")) { + throw new Error(DISABLED); + } else { + expr2 = parsePostfixExpression(); } -} -// Use mask-based collision detection. -function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, w = tag.width >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++){ - if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true; - } - x += sw; + return expr2; + } + function binaryPrecedence(token) { + let prec = 0; + if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { + return 0; } - return false; -} -function cloudBounds(bounds, d) { - var b0 = bounds[0], b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; -} -function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; -} -function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [ - e * (t *= .1) * Math.cos(t), - t * Math.sin(t) - ]; - }; -} -function rectangularSpiral(size) { - var dy = 4, dx = dy * size[0] / size[1], x = 0, y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch(Math.sqrt(1 + 4 * sign * t) - sign & 3){ - case 0: - x += dx; - break; - case 1: - y += dy; - break; - case 2: - x -= dx; - break; - default: - y -= dy; - break; - } - return [ - x, - y - ]; - }; -} -// TODO reuse arrays? -function zeroArray(n) { - var a = [], i = -1; - while(++i < n)a[i] = 0; - return a; -} -function functor(d) { - return typeof d === 'function' ? d : function() { - return d; - }; -} -var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral -}; -const Output = [ - 'x', - 'y', - 'font', - 'fontSize', - 'fontStyle', - 'fontWeight', - 'angle' -]; -const Params = [ - 'text', - 'font', - 'rotate', - 'fontSize', - 'fontStyle', - 'fontWeight' -]; -function Wordcloud(params) { - (0, _vegaDataflow.Transform).call(this, cloud(), params); -} -Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'font', - 'type': 'string', - 'expr': true, - 'default': 'sans-serif' - }, - { - 'name': 'fontStyle', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontWeight', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontSize', - 'type': 'number', - 'expr': true, - 'default': 14 - }, - { - 'name': 'fontSizeRange', - 'type': 'number', - 'array': 'nullable', - 'default': [ - 10, - 50 - ] - }, - { - 'name': 'rotate', - 'type': 'number', - 'expr': true, - 'default': 0 - }, - { - 'name': 'text', - 'type': 'field' - }, - { - 'name': 'spiral', - 'type': 'string', - 'values': [ - 'archimedean', - 'rectangular' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 7, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Wordcloud, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) (0, _vegaUtil.error)('Wordcloud size dimensions must be non-zero.'); - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return; - const data = pulse.materialize(pulse.SOURCE).source, layout = this.value, as = _.as || Output; - let fontSize = _.fontSize || 14, range; - (0, _vegaUtil.isFunction)(fontSize) ? range = _.fontSizeRange : fontSize = (0, _vegaUtil.constant)(fontSize); - // create font size scaling function as needed - if (range) { - const fsize = fontSize, sizeScale = (0, _vegaScale.scale)('sqrt')().domain((0, _vegaUtil.extent)(data, fsize)).range(range); - fontSize = (x)=>sizeScale(fsize(x)); - } - data.forEach((t)=>{ - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - // configure layout - const words = layout.words(data).text(_.text).size(_.size || [ - 500, - 500 - ]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random((0, _vegaStatistics.random)).layout(); - const size = layout.size(), dx = size[0] >> 1, dy = size[1] >> 1, n = words.length; - for(let i = 0, w, t; i < n; ++i){ - w = words[i]; - t = w.datum; - t[as[0]] = w.x + dx; - t[as[1]] = w.y + dy; - t[as[2]] = w.font; - t[as[3]] = w.size; - t[as[4]] = w.style; - t[as[5]] = w.weight; - t[as[6]] = w.rotate; - } - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-canvas":"4O1hR","vega-dataflow":"cFRfY","vega-util":"f2ulH","vega-scale":"gHN3E","vega-statistics":"4QSQj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ipwtZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "crossfilter", ()=>CrossFilter); -parcelHelpers.export(exports, "resolvefilter", ()=>ResolveFilter); -var _d3Array = require("d3-array"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -const array8 = (n)=>new Uint8Array(n); -const array16 = (n)=>new Uint16Array(n); -const array32 = (n)=>new Uint32Array(n); -/** - * Maintains CrossFilter state. - */ function Bitmaps() { - let width = 8, data = [], seen = array32(0), curr = array(0, width), prev = array(0, width); - return { - data: ()=>data, - seen: ()=>seen = lengthen(seen, data.length), - add (array) { - for(let i = 0, j = data.length, n = array.length, t; i < n; ++i){ - t = array[i]; - t._index = j++; - data.push(t); - } - }, - remove (num, map) { - // map: index -> boolean (true => remove) - const n = data.length, copy = Array(n - num), reindex = data; // reuse old data array for index map - let t, i, j; - // seek forward to first removal - for(i = 0; !map[i] && i < n; ++i){ - copy[i] = data[i]; - reindex[i] = i; - } - // condense arrays - for(j = i; i < n; ++i){ - t = data[i]; - if (!map[i]) { - reindex[i] = j; - curr[j] = curr[i]; - prev[j] = prev[i]; - copy[j] = t; - t._index = j++; - } else reindex[i] = -1; - curr[i] = 0; // clear unused bits - } - data = copy; - return reindex; - }, - size: ()=>data.length, - curr: ()=>curr, - prev: ()=>prev, - reset: (k)=>prev[k] = curr[k], - all: ()=>width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff, - set (k, one) { - curr[k] |= one; - }, - clear (k, one) { - curr[k] &= ~one; - }, - resize (n, m) { - const k = curr.length; - if (n > k || m > width) { - width = Math.max(m, width); - curr = array(n, width, curr); - prev = array(n, width); - } - } - }; -} -function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; -} -function array(n, m, array) { - const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; -} -function Dimension(index, i, query) { - const bit = 1 << i; - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - onAdd (added, curr) { - const dim = this, range = dim.bisect(dim.range, added.value), idx = added.index, lo = range[0], hi = range[1], n1 = idx.length; - let i; - for(i = 0; i < lo; ++i)curr[idx[i]] |= bit; - for(i = hi; i < n1; ++i)curr[idx[i]] |= bit; - return dim; - } - }; -} -/** - * Maintains a list of values, sorted by key. - */ function SortedIndex() { - let index = array32(0), value = [], size = 0; - function insert(key, data, base) { - if (!data.length) return []; - const n0 = size, n1 = data.length, addi = array32(n1); - let addv = Array(n1), oldv, oldi, i; - for(i = 0; i < n1; ++i){ - addv[i] = key(data[i]); - addi[i] = i; - } - addv = sort(addv, addi); - if (n0) { - oldv = value; - oldi = index; - value = Array(n0 + n1); - index = array32(n0 + n1); - merge(base, oldv, oldi, n0, addv, addi, n1, value, index); - } else { - if (base > 0) for(i = 0; i < n1; ++i)addi[i] += base; - value = addv; - index = addi; - } - size = n0 + n1; - return { - index: addi, - value: addv - }; + switch (token.value) { + case "||": + prec = 1; + break; + case "&&": + prec = 2; + break; + case "|": + prec = 3; + break; + case "^": + prec = 4; + break; + case "&": + prec = 5; + break; + case "==": + case "!=": + case "===": + case "!==": + prec = 6; + break; + case "<": + case ">": + case "<=": + case ">=": + case "instanceof": + case "in": + prec = 7; + break; + case "<<": + case ">>": + case ">>>": + prec = 8; + break; + case "+": + case "-": + prec = 9; + break; + case "*": + case "/": + case "%": + prec = 11; + break; } - function remove(num, map) { - // map: index -> remove - const n = size; - let idx, i, j; - // seek forward to first removal - for(i = 0; !map[index[i]] && i < n; ++i); - // condense index and value arrays - for(j = i; i < n; ++i)if (!map[idx = index[i]]) { - index[j] = idx; - value[j] = value[i]; - ++j; - } - size = n - num; - } - function reindex(map) { - for(let i = 0, n = size; i < n; ++i)index[i] = map[index[i]]; - } - function bisect(range, array) { - let n; - if (array) n = array.length; - else { - array = value; - n = size; - } - return [ - (0, _d3Array.bisectLeft)(array, range[0], 0, n), - (0, _d3Array.bisectRight)(array, range[1], 0, n) - ]; + return prec; + } + function parseBinaryExpression() { + var marker, markers, expr2, token, prec, stack, right, operator2, left, i; + marker = lookahead; + left = parseUnaryExpression(); + token = lookahead; + prec = binaryPrecedence(token); + if (prec === 0) { + return left; } - return { - insert: insert, - remove: remove, - bisect: bisect, - reindex: reindex, - index: ()=>index, - size: ()=>size - }; -} -function sort(values, index) { - values.sort.call(index, (a, b)=>{ - const x = values[a], y = values[b]; - return x < y ? -1 : x > y ? 1 : 0; - }); - return (0, _d3Array.permute)(values, index); -} -function merge(base, value0, index0, n0, value1, index1, n1, value, index) { - let i0 = 0, i1 = 0, i; - for(i = 0; i0 < n0 && i1 < n1; ++i)if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - for(; i0 < n0; ++i0, ++i){ - value[i] = value0[i0]; - index[i] = index0[i0]; - } - for(; i1 < n1; ++i1, ++i){ - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } -} -/** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ function CrossFilter(params) { - (0, _vegaDataflow.Transform).call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; -} -CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'query', - 'type': 'array', - 'array': true, - 'required': true, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - } - ] -}; -(0, _vegaUtil.inherits)(CrossFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!this._dims) return this.init(_, pulse); - else { - var init = _.modified('fields') || _.fields.some((f)=>pulse.modified(f.fields)); - return init ? this.reinit(_, pulse) : this.eval(_, pulse); - } - }, - init (_, pulse) { - const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m = query.length; - let i = 0, key, index; - // instantiate indices and dimensions - for(; i < m; ++i){ - key = fields[i].fname; - index = indices[key] || (indices[key] = SortedIndex()); - dims.push(Dimension(index, i, query[i])); - } - return this.eval(_, pulse); - }, - reinit (_, pulse) { - const output = pulse.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output.rem = output.add, mod = output.mod, m = query.length, adds = {}; - let add, index, key, mods, remMap, modMap, i, n, f; - // set prev to current state - prev.set(curr); - // if pulse has remove tuples, process them first - if (pulse.rem.length) remMap = this.remove(_, pulse, output); - // if pulse has added tuples, add them to state - if (pulse.add.length) bits.add(pulse.add); - // if pulse has modified tuples, create an index map - if (pulse.mod.length) { - modMap = {}; - for(mods = pulse.mod, i = 0, n = mods.length; i < n; ++i)modMap[mods[i]._index] = 1; - } - // re-initialize indices as needed, update curr bitmap - for(i = 0; i < m; ++i){ - f = fields[i]; - if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) { - key = f.fname; - if (!(add = adds[key])) { - indices[key] = index = SortedIndex(); - adds[key] = add = index.insert(f, pulse.source, 0); - } - dims[i] = Dimension(index, i, query[i]).onAdd(add, curr); - } - } - // visit each tuple - // if filter state changed, push index to add/rem - // else if in mod and passes a filter, push index to mod - for(i = 0, n = bits.data().length; i < n; ++i){ - if (remMap[i]) continue; - else if (prev[i] !== curr[i]) // add if state changed - out.push(i); - else if (modMap[i] && curr[i] !== all) // otherwise, pass mods through - mod.push(i); - } - bits.mask = (1 << m) - 1; - return output; - }, - eval (_, pulse) { - const output = pulse.materialize().fork(), m = this._dims.length; - let mask = 0; - if (pulse.rem.length) { - this.remove(_, pulse, output); - mask |= (1 << m) - 1; - } - if (_.modified('query') && !_.modified('fields')) mask |= this.update(_, pulse, output); - if (pulse.add.length) { - this.insert(_, pulse, output); - mask |= (1 << m) - 1; - } - if (pulse.mod.length) { - this.modify(pulse, output); - mask |= (1 << m) - 1; - } - this.value.mask = mask; - return output; - }, - insert (_, pulse, output) { - const tuples = pulse.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output.add, n = bits.size() + tuples.length, m = dims.length; - let k = bits.size(), j, key, add; - // resize bitmaps and add tuples as needed - bits.resize(n, m); - bits.add(tuples); - const curr = bits.curr(), prev = bits.prev(), all = bits.all(); - // add to dimensional indices - for(j = 0; j < m; ++j){ - key = fields[j].fname; - add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k)); - dims[j].onAdd(add, curr); - } - // set previous filters, output if passes at least one filter - for(; k < n; ++k){ - prev[k] = all; - if (curr[k] !== all) out.push(k); - } - }, - modify (pulse, output) { - const out = output.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse.mod; - let i, n, k; - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - if (curr[k] !== all) out.push(k); - } - }, - remove (_, pulse, output) { - const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map = {}, out = output.rem, tuples = pulse.rem; - let i, n, k, f; - // process tuples, output if passes at least one filter - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - map[k] = 1; // build index map - prev[k] = f = curr[k]; - curr[k] = all; - if (f !== all) out.push(k); - } - // remove from dimensional indices - for(k in indices)indices[k].remove(n, map); - this.reindex(pulse, n, map); - return map; - }, - // reindex filters and indices after propagation completes - reindex (pulse, num, map) { - const indices = this._indices, bits = this.value; - pulse.runAfter(()=>{ - const indexMap = bits.remove(num, map); - for(const key in indices)indices[key].reindex(indexMap); - }); - }, - update (_, pulse, output) { - const dims = this._dims, query = _.query, stamp = pulse.stamp, m = dims.length; - let mask = 0, i, q; - // survey how many queries have changed - output.filters = 0; - for(q = 0; q < m; ++q)if (_.modified('query', q)) { - i = q; - ++mask; - } - if (mask === 1) { - // only one query changed, use more efficient update - mask = dims[i].one; - this.incrementOne(dims[i], query[i], output.add, output.rem); - } else // multiple queries changed, perform full record keeping - for(q = 0, mask = 0; q < m; ++q){ - if (!_.modified('query', q)) continue; - mask |= dims[q].one; - this.incrementAll(dims[q], query[q], stamp, output.add); - output.rem = output.add; // duplicate add/rem for downstream resolve - } - return mask; - }, - incrementAll (dim, query, stamp, out) { - const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - dim.range = query.slice(); - }, - incrementOne (dim, query, add, rem) { - const bits = this.value, curr = bits.curr(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - dim.range = query.slice(); - } -}); -/** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ function ResolveFilter(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'ignore', - 'type': 'number', - 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' - }, - { - 'name': 'filter', - 'type': 'object', - 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' - } - ] -}; -(0, _vegaUtil.inherits)(ResolveFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, mask = bitmap.mask; - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - const output = pulse.fork(pulse.ALL), data = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k)=>!(curr[k] & ignore) ? data[k] : null; - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - if (!(mask & mask - 1)) { - // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, (k)=>(curr[k] & ignore) === mask ? data[k] : null); - } else { - // multiple filters changed - output.filter(output.ADD, (k)=>{ - const c = curr[k] & ignore, f = !c && c ^ prev[k] & ignore; - return f ? data[k] : null; - }); - output.filter(output.REM, (k)=>{ - const c = curr[k] & ignore, f = c && !(c ^ (c ^ prev[k] & ignore)); - return f ? data[k] : null; - }); - } - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, (t)=>pass(t._index)); - } -}); - -},{"d3-array":"5lCYW","vega-dataflow":"cFRfY","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"15ELa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "View", ()=>View); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _d3Array = require("d3-array"); -var _vegaFunctions = require("vega-functions"); -var _vegaRuntime = require("vega-runtime"); -var _d3Timer = require("d3-timer"); -var _vegaFormat = require("vega-format"); -// initialize aria role and label attributes -function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } -} -// update aria-label if we have a DOM container element -function ariaLabel(el, desc) { - if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc); -} -function background(view) { - // respond to background signal - view.add(null, (_)=>{ - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { - bg: view._signals.background - }); -} -const Default = 'default'; -function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - // evaluate cursor on each pointermove event - view.on(view.events('view', 'pointermove'), cursor, (_, event)=>{ - const value = cursor.value, user = value ? (0, _vegaUtil.isString)(value) ? value : value.user : Default, item = event.item && event.item.cursor || null; - return value && user === value.user && item == value.item ? value : { - user: user, - item: item - }; - }); - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, item = this.value; - if (!(0, _vegaUtil.isString)(user)) { - item = user.item; - user = user.user; - } - setCursor(view, user && user !== Default ? user : item || user); - return item; - }, { - cursor: cursor - }); -} -function setCursor(view, cursor) { - const el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container(); - if (el) return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor; -} -function dataref(view, name) { - var data = view._runtime.data; - if (!(0, _vegaUtil.hasOwnProperty)(data, name)) (0, _vegaUtil.error)('Unrecognized data set: ' + name); - return data[name]; -} -function data(name, values) { - return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, (0, _vegaDataflow.changeset)().remove((0, _vegaUtil.truthy)).insert(values)); -} -function change(name, changes) { - if (!(0, _vegaDataflow.isChangeSet)(changes)) (0, _vegaUtil.error)('Second argument to changes must be a changeset.'); - const dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); -} -function insert(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().insert(_)); -} -function remove(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().remove(_)); -} -function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); -} -function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); -} -function offset(view) { - var padding = view.padding(), origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; -} -function resizeRenderer(view) { - var origin = offset(view), w = width(view), h = height(view); - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - view._resizeListeners.forEach((handler)=>{ - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); -} -/** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ function eventExtend(view, event, item) { - var r = view._renderer, el = r && r.canvas(), p, e, translate; - if (el) { - translate = offset(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = (0, _vegaScenegraph.point)(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; -} -function extension(view, item, point) { - const itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null; - function group(name) { - var g = itemGroup, i; - if (name) { - for(i = item; i; i = i.mark.group)if (i.mark.name === name) { - g = i; - break; - } - } - return g && g.mark && g.mark.interactive ? g : {}; + token.prec = prec; + lex(); + markers = [marker, lookahead]; + right = parseUnaryExpression(); + stack = [left, token, right]; + while ((prec = binaryPrecedence(lookahead)) > 0) { + while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { + right = stack.pop(); + operator2 = stack.pop().value; + left = stack.pop(); + markers.pop(); + expr2 = finishBinaryExpression(operator2, left, right); + stack.push(expr2); + } + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(lookahead); + expr2 = parseUnaryExpression(); + stack.push(expr2); } - function xy(item) { - if (!item) return point; - if ((0, _vegaUtil.isString)(item)) item = group(item); - const p = point.slice(); - while(item){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - return p; + i = stack.length - 1; + expr2 = stack[i]; + markers.pop(); + while (i > 1) { + markers.pop(); + expr2 = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr2); + i -= 2; } - return { - view: (0, _vegaUtil.constant)(view), - item: (0, _vegaUtil.constant)(item || {}), - group: group, - xy: xy, - x: (item)=>xy(item)[0], - y: (item)=>xy(item)[1] - }; -} -const VIEW = 'view', TIMER = 'timer', WINDOW = 'window', NO_TRAP = { - trap: false -}; -/** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ function initializeEventConfig(config) { - const events = (0, _vegaUtil.extend)({ - defaults: {} - }, config); - const unpack = (obj, keys)=>{ - keys.forEach((k)=>{ - if ((0, _vegaUtil.isArray)(obj[k])) obj[k] = (0, _vegaUtil.toSet)(obj[k]); - }); - }; - unpack(events.defaults, [ - 'prevent', - 'allow' - ]); - unpack(events, [ - 'view', - 'window', - 'selector' - ]); - return events; -} -function trackEventListener(view, sources, type, handler) { - view._eventListeners.push({ - type: type, - sources: (0, _vegaUtil.array)(sources), - handler: handler - }); -} -function prevent(view, type) { - var def = view._eventConfig.defaults, prevent = def.prevent, allow = def.allow; - return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault(); -} -function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - if (rule === false || (0, _vegaUtil.isObject)(rule) && !rule[type]) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; + return expr2; + } + function parseConditionalExpression() { + var expr2, consequent, alternate; + expr2 = parseBinaryExpression(); + if (match("?")) { + lex(); + consequent = parseConditionalExpression(); + expect(":"); + alternate = parseConditionalExpression(); + expr2 = finishConditionalExpression(expr2, consequent, alternate); + } + return expr2; + } + function parseExpression() { + const expr2 = parseConditionalExpression(); + if (match(",")) { + throw new Error(DISABLED); } - return true; -} -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ function events(source, type, filter) { - var view = this, s = new (0, _vegaDataflow.EventStream)(filter), send = function(e, item) { - view.runAsync(null, ()=>{ - if (source === VIEW && prevent(view, type)) e.preventDefault(); - s.receive(eventExtend(view, e, item)); - }); - }, sources; - if (source === TIMER) { - if (permit(view, 'timer', type)) view.timer(send, type); - } else if (source === VIEW) { - if (permit(view, 'view', type)) // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') sources = [ - window - ]; - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) sources = Array.from(document.querySelectorAll(source)); - } - if (!sources) view.warn('Can not resolve event source: ' + source); - else { - for(var i = 0, n = sources.length; i < n; ++i)sources[i].addEventListener(type, send); - trackEventListener(view, sources, type, send); - } - } - return s; -} -function itemFilter(event) { - return event.item; -} -function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; -} -function invoke(name) { - return function(_, event) { - return event.vega.view().changeset().encode(event.item, name); - }; -} -function hover(hoverSet, leaveSet) { - hoverSet = [ - hoverSet || 'hover' - ]; - leaveSet = [ - leaveSet || 'update', - hoverSet[0] - ]; - // invoke hover set upon pointerover - this.on(this.events('view', 'pointerover', itemFilter), markTarget, invoke(hoverSet)); - // invoke leave set upon pointerout - this.on(this.events('view', 'pointerout', itemFilter), markTarget, invoke(leaveSet)); - return this; -} -/** - * Finalize a View instance that is being removed. - * Cancel any running timers. - * Remove all external event listeners. - * Remove any currently displayed tooltip. - */ function finalize() { - var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m, e, h, t; - n = timers.length; - while(--n >= 0)timers[n].stop(); - n = listeners.length; - while(--n >= 0){ - e = listeners[n]; - m = e.sources.length; - while(--m >= 0)e.sources[m].removeEventListener(e.type, e.handler); + return expr2; + } + function parser$1(code) { + source = code; + index = 0; + length = source.length; + lookahead = null; + peek(); + const expr2 = parseExpression(); + if (lookahead.type !== TokenEOF) { + throw new Error("Unexpect token after expression."); } - if (tooltip) tooltip.call(this, this._handler, null, null, null); - // turn off all registered handlers - n = handlers.length; - while(--n >= 0){ - t = handlers[n].type; - h = handlers[n].handler; - this._handler.off(t, h); + return expr2; + } + var Constants = { + NaN: "NaN", + E: "Math.E", + LN2: "Math.LN2", + LN10: "Math.LN10", + LOG2E: "Math.LOG2E", + LOG10E: "Math.LOG10E", + PI: "Math.PI", + SQRT1_2: "Math.SQRT1_2", + SQRT2: "Math.SQRT2", + MIN_VALUE: "Number.MIN_VALUE", + MAX_VALUE: "Number.MAX_VALUE" + }; + function Functions(codegen2) { + function fncall(name, args, cast, type2) { + let obj2 = codegen2(args[0]); + if (cast) { + obj2 = cast + "(" + obj2 + ")"; + if (cast.lastIndexOf("new ", 0) === 0) obj2 = "(" + obj2 + ")"; + } + return obj2 + "." + name + (type2 < 0 ? "" : type2 === 0 ? "()" : "(" + args.slice(1).map(codegen2).join(",") + ")"); } - return this; -} -function element(tag, attr, text) { - const el = document.createElement(tag); - for(const key in attr)el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; -} -const BindClass = 'vega-bind', NameClass = 'vega-bind-name', RadioClass = 'vega-bind-radio'; -/** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ function bind(view, el, binding) { - if (!el) return; - const param = binding.param; - let bind = binding.state; - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: (value)=>{ - if (value != view.signal(param.signal)) view.runAsync(null, ()=>{ - bind.source = true; - view.signal(param.signal, value); - }); - } - }; - if (param.debounce) bind.update = (0, _vegaUtil.debounce)(param.debounce, bind.update); + function fn2(name, cast, type2) { + return (args) => fncall(name, args, cast, type2); } - const create = param.input == null && param.element ? target : generate; - create(bind, el, param, view); - if (!bind.active) { - view.on(view._signals[param.signal], null, ()=>{ - bind.source ? bind.source = false : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - return bind; -} -/** - * Bind the signal to an external EventTarget. - */ function target(bind, node, param, view) { - const type = param.event || 'input'; - const handler = ()=>bind.update(node.value); - // initialize signal value to external input value - view.signal(param.signal, node.value); - // listen for changes on the element - node.addEventListener(type, handler); - // register with view, so we can remove it upon finalization - trackEventListener(view, node, type, handler); - // propagate change to element - bind.set = (value)=>{ - node.value = value; - node.dispatchEvent(event(type)); - }; -} -function event(type) { - return typeof Event !== 'undefined' ? new Event(type) : { - type - }; -} -/** - * Generate an HTML input form element and bind it to a signal. - */ function generate(bind, el, param, view) { - const value = view.signal(param.signal); - const div = element('div', { - 'class': BindClass - }); - const wrapper = param.input === 'radio' ? div : div.appendChild(element('label')); - wrapper.appendChild(element('span', { - 'class': NameClass - }, param.name || param.signal)); - el.appendChild(div); - let input = form; - switch(param.input){ - case 'checkbox': - input = checkbox; - break; - case 'select': - input = select; - break; - case 'radio': - input = radio; - break; - case 'range': - input = range; - break; + const DATE2 = "new Date", STRING = "String", REGEXP = "RegExp"; + return { + // MATH functions + isNaN: "Number.isNaN", + isFinite: "Number.isFinite", + abs: "Math.abs", + acos: "Math.acos", + asin: "Math.asin", + atan: "Math.atan", + atan2: "Math.atan2", + ceil: "Math.ceil", + cos: "Math.cos", + exp: "Math.exp", + floor: "Math.floor", + hypot: "Math.hypot", + log: "Math.log", + max: "Math.max", + min: "Math.min", + pow: "Math.pow", + random: "Math.random", + round: "Math.round", + sin: "Math.sin", + sqrt: "Math.sqrt", + tan: "Math.tan", + clamp: function(args) { + if (args.length < 3) error("Missing arguments to clamp function."); + if (args.length > 3) error("Too many arguments to clamp function."); + const a2 = args.map(codegen2); + return "Math.max(" + a2[1] + ", Math.min(" + a2[2] + "," + a2[0] + "))"; + }, + // DATE functions + now: "Date.now", + utc: "Date.UTC", + datetime: DATE2, + date: fn2("getDate", DATE2, 0), + day: fn2("getDay", DATE2, 0), + year: fn2("getFullYear", DATE2, 0), + month: fn2("getMonth", DATE2, 0), + hours: fn2("getHours", DATE2, 0), + minutes: fn2("getMinutes", DATE2, 0), + seconds: fn2("getSeconds", DATE2, 0), + milliseconds: fn2("getMilliseconds", DATE2, 0), + time: fn2("getTime", DATE2, 0), + timezoneoffset: fn2("getTimezoneOffset", DATE2, 0), + utcdate: fn2("getUTCDate", DATE2, 0), + utcday: fn2("getUTCDay", DATE2, 0), + utcyear: fn2("getUTCFullYear", DATE2, 0), + utcmonth: fn2("getUTCMonth", DATE2, 0), + utchours: fn2("getUTCHours", DATE2, 0), + utcminutes: fn2("getUTCMinutes", DATE2, 0), + utcseconds: fn2("getUTCSeconds", DATE2, 0), + utcmilliseconds: fn2("getUTCMilliseconds", DATE2, 0), + // sequence functions + length: fn2("length", null, -1), + // STRING functions + parseFloat: "parseFloat", + parseInt: "parseInt", + upper: fn2("toUpperCase", STRING, 0), + lower: fn2("toLowerCase", STRING, 0), + substring: fn2("substring", STRING), + split: fn2("split", STRING), + trim: fn2("trim", STRING, 0), + // base64 encode/decode + btoa: "btoa", + atob: "atob", + // REGEXP functions + regexp: REGEXP, + test: fn2("test", REGEXP), + // Control Flow functions + if: function(args) { + if (args.length < 3) error("Missing arguments to if function."); + if (args.length > 3) error("Too many arguments to if function."); + const a2 = args.map(codegen2); + return "(" + a2[0] + "?" + a2[1] + ":" + a2[2] + ")"; + } + }; + } + function stripQuotes(s2) { + const n = s2 && s2.length - 1; + return n && (s2[0] === '"' && s2[n] === '"' || s2[0] === "'" && s2[n] === "'") ? s2.slice(1, -1) : s2; + } + function codegen(opt) { + opt = opt || {}; + const allowed = opt.allowed ? toSet(opt.allowed) : {}, forbidden = opt.forbidden ? toSet(opt.forbidden) : {}, constants2 = opt.constants || Constants, functions = (opt.functions || Functions)(visit2), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = isFunction(globalvar) ? globalvar : (id2) => `${globalvar}["${id2}"]`; + /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + let globals = {}, fields = {}, memberDepth = 0; + function visit2(ast) { + if (isString(ast)) return ast; + const generator = Generators[ast.type]; + if (generator == null) error("Unsupported type: " + ast.type); + return generator(ast); } - input(bind, wrapper, param, value); -} -/** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ function form(bind, el, param, value) { - const node = element('input'); - for(const key in param)if (key !== 'signal' && key !== 'element') node.setAttribute(key === 'input' ? 'type' : key, param[key]); - node.setAttribute('name', param.signal); - node.value = value; - el.appendChild(node); - node.addEventListener('input', ()=>bind.update(node.value)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.value = value; -} -/** - * Generates a checkbox input element. - */ function checkbox(bind, el, param, value) { - const attr = { - type: 'checkbox', - name: param.signal - }; - if (value) attr.checked = true; - const node = element('input', attr); - el.appendChild(node); - node.addEventListener('change', ()=>bind.update(node.checked)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.checked = !!value || null; -} -/** - * Generates a selection list input element. - */ function select(bind, el, param, value) { - const node = element('select', { - name: param.signal - }), labels = param.labels || []; - param.options.forEach((option, i)=>{ - const attr = { - value: option - }; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element('option', attr, (labels[i] || option) + '')); - }); - el.appendChild(node); - node.addEventListener('change', ()=>{ - bind.update(param.options[node.selectedIndex]); - }); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - for(let i = 0, n = param.options.length; i < n; ++i)if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; - return; + const Generators = { + Literal: (n) => n.raw, + Identifier: (n) => { + const id2 = n.name; + if (memberDepth > 0) { + return id2; + } else if (has$1(forbidden, id2)) { + return error("Illegal identifier: " + id2); + } else if (has$1(constants2, id2)) { + return constants2[id2]; + } else if (has$1(allowed, id2)) { + return id2; + } else { + globals[id2] = 1; + return outputGlobal(id2); } - }; -} -/** - * Generates a radio button group. - */ function radio(bind, el, param, value) { - const group = element('span', { - 'class': RadioClass - }), labels = param.labels || []; - el.appendChild(group); - bind.elements = param.options.map((option, i)=>{ - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - const input = element('input', attr); - input.addEventListener('change', ()=>bind.update(option)); - const label = element('label', {}, (labels[i] || option) + ''); - label.prepend(input); - group.appendChild(label); - return input; - }); - bind.set = (value)=>{ - const nodes = bind.elements, n = nodes.length; - for(let i = 0; i < n; ++i)if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - }; -} -/** - * Generates a slider input element. - */ function range(bind, el, param, value) { - value = value !== undefined ? value : (+param.max + +param.min) / 2; - const max = param.max != null ? param.max : Math.max(100, +value) || 100, min = param.min || Math.min(0, max, +value) || 0, step = param.step || (0, _d3Array.tickStep)(min, max, 100); - const node = element('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - const span = element('span', {}, +value); - el.appendChild(node); - el.appendChild(span); - const update = ()=>{ - span.textContent = node.value; - bind.update(+node.value); - }; - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - node.value = value; - span.textContent = value; - }; -} -function valuesEqual(a, b) { - return a === b || a + '' === b + ''; -} -function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); -} -function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); + }, + MemberExpression: (n) => { + const d2 = !n.computed, o = visit2(n.object); + if (d2) memberDepth += 1; + const p = visit2(n.property); + if (o === fieldvar) { + fields[stripQuotes(p)] = 1; + } + if (d2) memberDepth -= 1; + return o + (d2 ? "." + p : "[" + p + "]"); + }, + CallExpression: (n) => { + if (n.callee.type !== "Identifier") { + error("Illegal callee type: " + n.callee.type); } + const callee = n.callee.name, args = n.arguments, fn2 = has$1(functions, callee) && functions[callee]; + if (!fn2) error("Unrecognized function: " + callee); + return isFunction(fn2) ? fn2(args) : fn2 + "(" + args.map(visit2).join(",") + ")"; + }, + ArrayExpression: (n) => "[" + n.elements.map(visit2).join(",") + "]", + BinaryExpression: (n) => "(" + visit2(n.left) + " " + n.operator + " " + visit2(n.right) + ")", + UnaryExpression: (n) => "(" + n.operator + visit2(n.argument) + ")", + ConditionalExpression: (n) => "(" + visit2(n.test) + "?" + visit2(n.consequent) + ":" + visit2(n.alternate) + ")", + LogicalExpression: (n) => "(" + visit2(n.left) + n.operator + visit2(n.right) + ")", + ObjectExpression: (n) => { + for (const prop of n.properties) { + const keyName = prop.key.name; + if (DisallowedObjectProperties.has(keyName)) { + error("Illegal property: " + keyName); + } + } + return "{" + n.properties.map(visit2).join(",") + "}"; + }, + Property: (n) => { + memberDepth += 1; + const k = visit2(n.key); + memberDepth -= 1; + return k + ":" + visit2(n.value); + } }; -} -function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); - // transfer event handlers - if (prevHandler) prevHandler.handlers().forEach((h)=>{ - handler.on(h.type, h.handler); - }); - return handler; -} -function initialize(el, elBind) { - const view = this, type = view._renderType, config = view._eventConfig.bind, module = (0, _vegaScenegraph.renderModule)(type); - // containing dom element - el = view._el = el ? lookup(view, el, true) : null; - // initialize aria attributes - initializeAria(view); - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || (0, _vegaScenegraph.CanvasHandler), Renderer = el ? module.renderer : module.headless; - // initialize renderer and input handler - view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? view._elBind = lookup(view, elBind, true) : el.appendChild(element('form', { - 'class': 'vega-bindings' - })); - view._bind.forEach((_)=>{ - if (_.param.element && config !== 'container') _.element = lookup(view, _.param.element, !!_.param.input); - }); - view._bind.forEach((_)=>{ - bind(view, _.element || elBind, _); - }); + function codegen2(ast) { + const result = { + code: visit2(ast), + globals: Object.keys(globals), + fields: Object.keys(fields) + }; + globals = {}; + fields = {}; + return result; + } + codegen2.functions = functions; + codegen2.constants = constants2; + return codegen2; + } + const SELECTION_GETTER = Symbol("vega_selection_getter"); + function getter(f) { + if (!f.getter || !f.getter[SELECTION_GETTER]) { + f.getter = field$1(f.field); + f.getter[SELECTION_GETTER] = true; } - return view; -} -function lookup(view, el, clear) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; + return f.getter; + } + const Intersect = "intersect"; + const Union = "union"; + const VlMulti = "vlMulti"; + const VlPoint = "vlPoint"; + const Or = "or"; + const And = "and"; + const SelectionId = "_vgsid_"; + const $selectionId = field$1(SelectionId); + const TYPE_ENUM = "E", TYPE_RANGE_INC = "R", TYPE_RANGE_EXC = "R-E", TYPE_RANGE_LE = "R-LE", TYPE_RANGE_RE = "R-RE", TYPE_PRED_LT = "E-LT", TYPE_PRED_LTE = "E-LTE", TYPE_PRED_GT = "E-GT", TYPE_PRED_GTE = "E-GTE", TYPE_PRED_VALID = "E-VALID", TYPE_PRED_ONE_OF = "E-ONE", UNIT_INDEX = "index:unit"; + function testPoint(datum2, entry2) { + var fields = entry2.fields, values2 = entry2.values, n = fields.length, i = 0, dval, f; + for (; i < n; ++i) { + f = fields[i]; + dval = getter(f)(datum2); + if (isDate$1(dval)) dval = toNumber(dval); + if (isDate$1(values2[i])) values2[i] = toNumber(values2[i]); + if (isArray(values2[i]) && isDate$1(values2[i][0])) values2[i] = values2[i].map(toNumber); + if (f.type === TYPE_ENUM) { + if (isArray(values2[i]) ? !values2[i].includes(dval) : dval !== values2[i]) { + return false; + } + } else { + if (f.type === TYPE_RANGE_INC) { + if (!inrange(dval, values2[i])) return false; + } else if (f.type === TYPE_RANGE_RE) { + if (!inrange(dval, values2[i], true, false)) return false; + } else if (f.type === TYPE_RANGE_EXC) { + if (!inrange(dval, values2[i], false, false)) return false; + } else if (f.type === TYPE_RANGE_LE) { + if (!inrange(dval, values2[i], false, true)) return false; + } else if (f.type === TYPE_PRED_LT) { + if (dval >= values2[i]) return false; + } else if (f.type === TYPE_PRED_LTE) { + if (dval > values2[i]) return false; + } else if (f.type === TYPE_PRED_GT) { + if (dval <= values2[i]) return false; + } else if (f.type === TYPE_PRED_GTE) { + if (dval < values2[i]) return false; + } else if (f.type === TYPE_PRED_VALID) { + if (dval === null || isNaN(dval)) return false; + } else if (f.type === TYPE_PRED_ONE_OF) { + if (values2[i].indexOf(dval) === -1) return false; } + } } - if (el && clear) try { - el.textContent = ''; - } catch (e) { - el = null; - view.error(e); - } - return el; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ - }); -function padding(_) { - return (0, _vegaUtil.isObject)(_) ? { - top: number(_.top), - bottom: number(_.bottom), - left: number(_.left), - right: number(_.right) - } : paddingObject(number(_)); -} -/** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ async function renderHeadless(view, type, scaleFactor, opt) { - const module = (0, _vegaScenegraph.renderModule)(type), ctr = module && module.headless; - if (!ctr) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); -} -/** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ async function renderToImageURL(type, scaleFactor) { - if (type !== (0, _vegaScenegraph.RenderType).Canvas && type !== (0, _vegaScenegraph.RenderType).SVG && type !== (0, _vegaScenegraph.RenderType).PNG) (0, _vegaUtil.error)('Unrecognized image type: ' + type); - const r = await renderHeadless(this, type, scaleFactor); - return type === (0, _vegaScenegraph.RenderType).SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png'); -} -function toBlobURL(data, mime) { - const blob = new Blob([ - data - ], { - type: mime - }); - return window.URL.createObjectURL(blob); -} -/** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).Canvas, scaleFactor, opt); - return r.canvas(); -} -/** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).SVG, scaleFactor); - return r.svg(); -} -function runtime(view, spec, expr) { - return (0, _vegaRuntime.context)(view, (0, _vegaDataflow.transforms), (0, _vegaFunctions.functionContext), expr).parse(spec); -} -function scale(name) { - var scales = this._runtime.scales; - if (!(0, _vegaUtil.hasOwnProperty)(scales, name)) (0, _vegaUtil.error)('Unrecognized scale or projection: ' + name); - return scales[name].value; -} -var Width = 'width', Height = 'height', Padding = 'padding', Skip = { - skip: true -}; -function viewWidth(view, width) { - var a = view.autosize(), p = view.padding(); - return width - (a && a.contains === Padding ? p.left + p.right : 0); -} -function viewHeight(view, height) { - var a = view.autosize(), p = view.padding(); - return height - (a && a.contains === Padding ? p.top + p.bottom : 0); -} -function initializeResize(view) { - var s = view._signals, w = s[Width], h = s[Height], p = s[Padding]; - function resetSize() { - view._autosize = view._resize = 1; + return true; + } + function selectionTest(name, datum2, op) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, n = entries.length, i = 0, entry2, miss, count2, unit2, b2; + for (; i < n; ++i) { + entry2 = entries[i]; + if (unitIdx && intersect2) { + miss = miss || {}; + count2 = miss[unit2 = entry2.unit] || 0; + if (count2 === -1) continue; + b2 = testPoint(datum2, entry2); + miss[unit2] = b2 ? -1 : ++count2; + if (b2 && unitIdx.size === 1) return true; + if (!b2 && count2 === unitIdx.get(unit2).count) return false; + } else { + b2 = testPoint(datum2, entry2); + if (intersect2 ^ b2) return b2; + } } - // respond to width signal - view._resizeWidth = view.add(null, (_)=>{ - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, { - size: w - }); - // respond to height signal - view._resizeHeight = view.add(null, (_)=>{ - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, { - size: h - }); - // respond to padding signal - const resizePadding = view.add(null, resetSize, { - pad: p - }); - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; -} -function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter((view)=>{ - let rerun = 0; - // reset autosize flag - view._autosize = 0; - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter((v)=>v.resize()); - }, false, 1); -} -/** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ function getState(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); -} -function dataTest(name, data) { - return data.modified && (0, _vegaUtil.isArray)(data.input.value) && !name.startsWith('_:vega:_'); -} -function signalTest(name, op) { - return !(name === 'parent' || op instanceof (0, _vegaDataflow.transforms).proxy); -} -/** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ function setState(state) { - this.runAsync(null, (v)=>{ - v._trigger = false; - v._runtime.setState(state); - }, (v)=>{ - v._trigger = true; - }); - return this; -} -function timer(callback, delay) { - function tick(elapsed) { - callback({ - timestamp: Date.now(), - elapsed: elapsed - }); + return n && intersect2; + } + const bisect = bisector($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; + function selectionIdTest(name, datum2, op) { + const data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, value2 = $selectionId(datum2), index2 = bisectLeft(entries, value2); + if (index2 === entries.length) return false; + if ($selectionId(entries[index2]) !== value2) return false; + if (unitIdx && intersect2) { + if (unitIdx.size === 1) return true; + if (bisectRight(entries, value2) - index2 < unitIdx.size) return false; } - this._timers.push((0, _d3Timer.interval)(tick, delay)); -} -function defaultTooltip(handler, event, item, value) { - const el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); -} -function formatTooltip(value) { - return value == null ? '' : (0, _vegaUtil.isArray)(value) ? formatArray(value) : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? formatObject(value) : value + ''; -} -function formatObject(obj) { - return Object.keys(obj).map((key)=>{ - const v = obj[key]; - return key + ': ' + ((0, _vegaUtil.isArray)(v) ? formatArray(v) : formatValue(v)); - }).join('\n'); -} -function formatArray(value) { - return '[' + value.map(formatValue).join(', ') + ']'; -} -function formatValue(value) { - return (0, _vegaUtil.isArray)(value) ? '[\u2026]' : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? '{\u2026}' : value; -} -function watchPixelRatio() { - // based on https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes - if (this.renderer() === 'canvas' && this._renderer._canvas) { - let remove = null; - const updatePixelRatio = ()=>{ - if (remove != null) remove(); - const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); - media.addEventListener('change', updatePixelRatio); - remove = ()=>{ - media.removeEventListener('change', updatePixelRatio); - }; - this._renderer._canvas.getContext('2d').pixelRatio = window.devicePixelRatio || 1; - this._redraw = true; - this._resize = 1; - this.resize().runAsync(); - }; - updatePixelRatio(); - } -} -/** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ function View(spec, options) { - const view = this; - options = options || {}; - (0, _vegaDataflow.Dataflow).call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = (0, _vegaUtil.extend)({}, spec.locale, options.locale); - view.locale((0, _vegaFormat.locale)(loc.number, loc.time)); + return true; + } + function selectionTuples(array2, base2) { + if (!isArray(array2)) { + error("First argument to selectionTuples must be an array."); } - view._el = null; - view._elBind = null; - view._renderType = options.renderer || (0, _vegaScenegraph.RenderType).Canvas; - view._scenegraph = new (0, _vegaScenegraph.Scenegraph)(); - const root = view._scenegraph.root; - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip, view._redraw = true; - view._handler = new (0, _vegaScenegraph.CanvasHandler)().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map((_)=>({ - state: null, - param: (0, _vegaUtil.extend)({}, _) - })); - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [ - 0, - 0 - ]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - // initialize background color - background(view); - // initialize cursor - cursor(view); - // initialize view description - view.description(spec.description); - // initialize hover proessing, if requested - if (options.hover) view.hover(); - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); - if (options.watchPixelRatio) view._watchPixelRatio(); -} -function lookupSignal(view, name) { - return (0, _vegaUtil.hasOwnProperty)(view._signals, name) ? view._signals[name] : (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); -} -function findOperatorHandler(op, handler) { - const h = (op._targets || []).filter((op)=>op._update && op._update.handler === handler); - return h.length ? h[0] : null; -} -function addOperatorListener(view, name, op, handler) { - let h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, ()=>handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); + if (!isObject(base2)) { + error("Second argument to selectionTuples must be an object."); } - return view; -} -function removeOperatorListener(view, op, handler) { - const h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; -} -(0, _vegaUtil.inherits)(View, (0, _vegaDataflow.Dataflow), { - // -- DATAFLOW / RENDERING ---- - async evaluate (encode, prerun, postrun) { - // evaluate dataflow and prerun - await (0, _vegaDataflow.Dataflow).prototype.evaluate.call(this, encode, prerun); - // render as needed - if (this._redraw || this._resize) try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - // evaluate postrun - if (postrun) (0, _vegaDataflow.asyncCallback)(this, postrun); - return this; - }, - dirty (item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }, - // -- GET / SET ---- - description (text) { - if (arguments.length) { - const desc = text != null ? text + '' : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; - }, - container () { - return this._el; - }, - scenegraph () { - return this._scenegraph; - }, - origin () { - return this._origin.slice(); - }, - signal (name, value, options) { - const op = lookupSignal(this, name); - return arguments.length === 1 ? op.value : this.update(op, value, options); - }, - width (_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }, - height (_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }, - padding (_) { - return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding')); - }, - autosize (_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }, - background (_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }, - renderer (type) { - if (!arguments.length) return this._renderType; - if (!(0, _vegaScenegraph.renderModule)(type)) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; - }, - tooltip (handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; - }, - loader (loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - (0, _vegaDataflow.Dataflow).prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; - }, - resize () { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); - }, - _resetRenderer () { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }, - // -- SIZING ---- - _resizeView: resizeView, - // -- EVENT HANDLING ---- - addEventListener (type, handler, options) { - let callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; - }, - removeEventListener (type, handler) { - var handlers = this._handler.handlers(type), i = handlers.length, h, t; - // search registered handlers, remove if match found - while(--i >= 0){ - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } + return array2.map((x2) => extend(base2.fields ? { + values: base2.fields.map((f) => getter(f)(x2.datum)) + } : { + [SelectionId]: $selectionId(x2.datum) + }, base2)); + } + function selectionResolve(name, op, isMulti, vl5) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], resolved = {}, multiRes = {}, types2 = {}, entry2, fields, values2, unit2, field2, value2, res, resUnit, type2, union2, n = entries.length, i = 0, j, m2; + for (; i < n; ++i) { + entry2 = entries[i]; + unit2 = entry2.unit; + fields = entry2.fields; + values2 = entry2.values; + if (fields && values2) { + for (j = 0, m2 = fields.length; j < m2; ++j) { + field2 = fields[j]; + res = resolved[field2.field] || (resolved[field2.field] = {}); + resUnit = res[unit2] || (res[unit2] = []); + types2[field2.field] = type2 = field2.type.charAt(0); + union2 = ops[`${type2}_union`]; + res[unit2] = union2(resUnit, array$4(values2[j])); + } + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push(array$4(values2).reduce((obj2, curr, j2) => (obj2[fields[j2].field] = curr, obj2), {})); + } + } else { + field2 = SelectionId; + value2 = $selectionId(entry2); + res = resolved[field2] || (resolved[field2] = {}); + resUnit = res[unit2] || (res[unit2] = []); + resUnit.push(value2); + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push({ + [SelectionId]: value2 + }); } - return this; - }, - addResizeListener (handler) { - const l = this._resizeListeners; - if (!l.includes(handler)) // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - return this; - }, - removeResizeListener (handler) { - var l = this._resizeListeners, i = l.indexOf(handler); - if (i >= 0) l.splice(i, 1); - return this; - }, - addSignalListener (name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }, - removeSignalListener (name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }, - addDataListener (name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }, - removeDataListener (name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); + } + } + op = op || Union; + if (resolved[SelectionId]) { + resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); + } else { + Object.keys(resolved).forEach((field3) => { + resolved[field3] = Object.keys(resolved[field3]).map((unit3) => resolved[field3][unit3]).reduce((acc, curr) => acc === void 0 ? curr : ops[`${types2[field3]}_${op}`](acc, curr)); + }); + } + entries = Object.keys(multiRes); + if (isMulti && entries.length) { + const key2 = vl5 ? VlPoint : VlMulti; + resolved[key2] = op === Union ? { + [Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), []) + } : { + [And]: entries.map((k) => ({ + [Or]: multiRes[k] + })) + }; + } + return resolved; + } + var ops = { + [`${SelectionId}_union`]: union, + [`${SelectionId}_intersect`]: intersection, + E_union: function(base2, value2) { + if (!base2.length) return value2; + var i = 0, n = value2.length; + for (; i < n; ++i) if (!base2.includes(value2[i])) base2.push(value2[i]); + return base2; }, - globalCursor (_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else return this._globalCursor; + E_intersect: function(base2, value2) { + return !base2.length ? value2 : base2.filter((v) => value2.includes(v)); }, - preventDefault (_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else return this._preventDefault; + R_union: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (base2[0] > lo) base2[0] = lo; + if (base2[1] < hi) base2[1] = hi; + return base2; }, - timer, - events, - finalize, - hover, - // -- DATA ---- - data, - change, - insert, - remove, - // -- SCALES -- - scale, - // -- INITIALIZATION ---- - initialize, - // -- HEADLESS RENDERING ---- - toImageURL: renderToImageURL, - toCanvas: renderToCanvas, - toSVG: renderToSVG, - // -- SAVE / RESTORE STATE ---- - getState, - setState, - // RE-RENDER ON ZOOM - _watchPixelRatio: watchPixelRatio -}); - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","vega-scenegraph":"gJqm6","d3-array":"5lCYW","vega-functions":"6VJ1U","vega-runtime":"boQgz","d3-timer":"832oa","vega-format":"3VXXV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6VJ1U":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataPrefix", ()=>DataPrefix); -parcelHelpers.export(exports, "IndexPrefix", ()=>IndexPrefix); -parcelHelpers.export(exports, "ScalePrefix", ()=>ScalePrefix); -parcelHelpers.export(exports, "SignalPrefix", ()=>SignalPrefix); -parcelHelpers.export(exports, "bandspace", ()=>bandspace); -parcelHelpers.export(exports, "bandwidth", ()=>bandwidth); -parcelHelpers.export(exports, "codeGenerator", ()=>codeGenerator); -parcelHelpers.export(exports, "codegenParams", ()=>codegenParams); -parcelHelpers.export(exports, "containerSize", ()=>containerSize); -parcelHelpers.export(exports, "contrast", ()=>contrast); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "data", ()=>data); -parcelHelpers.export(exports, "dataVisitor", ()=>dataVisitor); -parcelHelpers.export(exports, "dayAbbrevFormat", ()=>dayAbbrevFormat); -parcelHelpers.export(exports, "dayFormat", ()=>dayFormat); -parcelHelpers.export(exports, "debug", ()=>debug); -parcelHelpers.export(exports, "domain", ()=>domain); -parcelHelpers.export(exports, "encode", ()=>encode); -parcelHelpers.export(exports, "expressionFunction", ()=>expressionFunction); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "functionContext", ()=>functionContext); -parcelHelpers.export(exports, "geoArea", ()=>geoArea); -parcelHelpers.export(exports, "geoBounds", ()=>geoBounds); -parcelHelpers.export(exports, "geoCentroid", ()=>geoCentroid); -parcelHelpers.export(exports, "geoScale", ()=>geoScale); -parcelHelpers.export(exports, "geoShape", ()=>geoShape); -parcelHelpers.export(exports, "inScope", ()=>inScope); -parcelHelpers.export(exports, "indata", ()=>indata); -parcelHelpers.export(exports, "indataVisitor", ()=>indataVisitor); -parcelHelpers.export(exports, "indexof", ()=>indexof); -parcelHelpers.export(exports, "info", ()=>info); -parcelHelpers.export(exports, "invert", ()=>invert); -parcelHelpers.export(exports, "join", ()=>join); -parcelHelpers.export(exports, "lastindexof", ()=>lastindexof); -parcelHelpers.export(exports, "luminance", ()=>luminance); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "modify", ()=>modify); -parcelHelpers.export(exports, "monthAbbrevFormat", ()=>monthAbbrevFormat); -parcelHelpers.export(exports, "monthFormat", ()=>monthFormat); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -parcelHelpers.export(exports, "pathShape", ()=>pathShape); -parcelHelpers.export(exports, "pinchAngle", ()=>pinchAngle); -parcelHelpers.export(exports, "pinchDistance", ()=>pinchDistance); -parcelHelpers.export(exports, "pluck", ()=>pluck); -parcelHelpers.export(exports, "range", ()=>range); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "reverse", ()=>reverse); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleGradient", ()=>scaleGradient); -parcelHelpers.export(exports, "scaleVisitor", ()=>scaleVisitor); -parcelHelpers.export(exports, "screen", ()=>screen); -parcelHelpers.export(exports, "setdata", ()=>setdata); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "sort", ()=>sort); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "treeAncestors", ()=>treeAncestors); -parcelHelpers.export(exports, "treePath", ()=>treePath); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "warn", ()=>warn); -parcelHelpers.export(exports, "windowSize", ()=>windowSize); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -var _vegaScale = require("vega-scale"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaSelections = require("vega-selections"); -var _vegaStatistics = require("vega-statistics"); -var _vegaTime = require("vega-time"); -var _d3Array = require("d3-array"); -function data(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; -} -function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; -} -function setdata(name, tuples) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input; - df.pulse(input, df.changeset().remove((0, _vegaUtil.truthy)).insert(tuples)); + R_intersect: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (hi < base2[0] || base2[1] < lo) { + return []; + } else { + if (base2[0] < lo) base2[0] = lo; + if (base2[1] > hi) base2[1] = hi; + } + return base2; + } + }; + const DataPrefix$1 = ":", IndexPrefix$1 = "@"; + function selectionVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to selection functions must be a string literal."); + const data2 = args[0].value, op = args.length >= 2 && peek$1(args).value, field2 = "unit", indexName = IndexPrefix$1 + field2, dataName = DataPrefix$1 + data2; + if (op === Intersect && !has$1(params2, indexName)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); + } + if (!has$1(params2, dataName)) { + params2[dataName] = scope.getData(data2).tuplesRef(); + } + } + function data$1(name) { + const data2 = this.context.data[name]; + return data2 ? data2.values.value : []; + } + function indata(name, field2, value2) { + const index2 = this.context.data[name]["index:" + field2], entry2 = index2 ? index2.value.get(value2) : void 0; + return entry2 ? entry2.count : entry2; + } + function setdata(name, tuples) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input; + df.pulse(input, df.changeset().remove(truthy).insert(tuples)); return 1; -} -function encode(item, name, retval) { + } + function encode(item, name, retval) { if (item) { - const df = this.context.dataflow, target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; -} -const wrap = (method)=>function(value, spec) { - const locale = this.context.dataflow.locale(); - return value === null ? 'null' : locale[method](spec)(value); - }; -const format = wrap('format'); -const timeFormat = wrap('timeFormat'); -const utcFormat = wrap('utcFormat'); -const timeParse = wrap('timeParse'); -const utcParse = wrap('utcParse'); -const dateObj = new Date(2000, 0, 1); -function time(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); + const df = this.context.dataflow, target2 = item.mark.source; + df.pulse(target2, df.changeset().encode(item, name)); + } + return retval !== void 0 ? retval : item; + } + const wrap = (method2) => function(value2, spec) { + const locale2 = this.context.dataflow.locale(); + return value2 === null ? "null" : locale2[method2](spec)(value2); + }; + const format = wrap("format"); + const timeFormat = wrap("timeFormat"); + const utcFormat = wrap("utcFormat"); + const timeParse = wrap("timeParse"); + const utcParse = wrap("utcParse"); + const dateObj = new Date(2e3, 0, 1); + function time(month, day, specifier) { + if (!Number.isInteger(month) || !Number.isInteger(day)) return ""; + dateObj.setYear(2e3); dateObj.setMonth(month); dateObj.setDate(day); return timeFormat.call(this, dateObj, specifier); -} -function monthFormat(month) { - return time.call(this, month, 1, '%B'); -} -function monthAbbrevFormat(month) { - return time.call(this, month, 1, '%b'); -} -function dayFormat(day) { - return time.call(this, 0, 2 + day, '%A'); -} -function dayAbbrevFormat(day) { - return time.call(this, 0, 2 + day, '%a'); -} -const DataPrefix = ':'; -const IndexPrefix = '@'; -const ScalePrefix = '%'; -const SignalPrefix = '$'; -function dataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to data functions must be a string literal.'); - const data = args[0].value, dataName = DataPrefix + data; - if (!(0, _vegaUtil.hasOwnProperty)(dataName, params)) try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } -} -function indataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to indata must be a string literal.'); - if (args[1].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('Second argument to indata must be a string literal.'); - const data = args[0].value, field = args[1].value, indexName = IndexPrefix + field; - if (!(0, _vegaUtil.hasOwnProperty)(indexName, params)) params[indexName] = scope.getData(data).indataRef(scope, field); -} -function scaleVisitor(name, args, scope, params) { - if (args[0].type === (0, _vegaExpression.Literal)) // add scale dependency - addScaleDependency(scope, params, args[0].value); - else // indirect scale lookup; add all scales as parameters - for(name in scope.scales)addScaleDependency(scope, params, name); -} -function addScaleDependency(scope, params, name) { + } + function monthFormat(month) { + return time.call(this, month, 1, "%B"); + } + function monthAbbrevFormat(month) { + return time.call(this, month, 1, "%b"); + } + function dayFormat(day) { + return time.call(this, 0, 2 + day, "%A"); + } + function dayAbbrevFormat(day) { + return time.call(this, 0, 2 + day, "%a"); + } + const DataPrefix = ":"; + const IndexPrefix = "@"; + const ScalePrefix = "%"; + const SignalPrefix = "$"; + function dataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) { + error("First argument to data functions must be a string literal."); + } + const data2 = args[0].value, dataName = DataPrefix + data2; + if (!has$1(dataName, params2)) { + try { + params2[dataName] = scope.getData(data2).tuplesRef(); + } catch (err) { + } + } + } + function indataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to indata must be a string literal."); + if (args[1].type !== Literal) error("Second argument to indata must be a string literal."); + const data2 = args[0].value, field2 = args[1].value, indexName = IndexPrefix + field2; + if (!has$1(indexName, params2)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); + } + } + function scaleVisitor(name, args, scope, params2) { + if (args[0].type === Literal) { + addScaleDependency(scope, params2, args[0].value); + } else { + for (name in scope.scales) { + addScaleDependency(scope, params2, name); + } + } + } + function addScaleDependency(scope, params2, name) { const scaleName = ScalePrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, scaleName)) try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } -} -/** - * Name must be a string. Return undefined if the scale is not registered. - */ function getScale(name, ctx) { - if ((0, _vegaUtil.isString)(name)) { - const maybeScale = ctx.scales[name]; - return maybeScale && (0, _vegaScale.isRegisteredScale)(maybeScale.value) ? maybeScale.value : undefined; - } - return undefined; -} -function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = (s)=>s && s.bandwidth ? s.bandwidth() : 0; - // register AST visitors for internal scale functions + if (!has$1(params2, scaleName)) { + try { + params2[scaleName] = scope.scaleRef(name); + } catch (err) { + } + } + } + function getScale(nameOrFunction, ctx) { + if (isString(nameOrFunction)) { + const maybeScale = ctx.scales[nameOrFunction]; + return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : void 0; + } else if (isFunction(nameOrFunction)) { + return isRegisteredScale(nameOrFunction) ? nameOrFunction : void 0; + } + return void 0; + } + function internalScaleFunctions(codegen2, fnctx, visitors) { + fnctx.__bandwidth = (s2) => s2 && s2.bandwidth ? s2.bandwidth() : 0; visitors._bandwidth = scaleVisitor; visitors._range = scaleVisitor; visitors._scale = scaleVisitor; - // resolve scale reference directly to the signal hash argument - const ref = (arg)=>'_[' + (arg.type === (0, _vegaExpression.Literal) ? (0, _vegaUtil.stringValue)(ScalePrefix + arg.value) : (0, _vegaUtil.stringValue)(ScalePrefix) + '+' + codegen(arg)) + ']'; - // define and return internal scale function code generators - // these internal functions are called by mark encoders + const ref2 = (arg) => "_[" + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + "+" + codegen2(arg)) + "]"; return { - _bandwidth: (args)=>`this.__bandwidth(${ref(args[0])})`, - _range: (args)=>`${ref(args[0])}.range()`, - _scale: (args)=>`${ref(args[0])}(${codegen(args[1])})` - }; -} -function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else // projection undefined, use global method + _bandwidth: (args) => `this.__bandwidth(${ref2(args[0])})`, + _range: (args) => `${ref2(args[0])}.range()`, + _scale: (args) => `${ref2(args[0])}(${codegen2(args[1])})` + }; + } + function geoMethod(methodName, globalMethod) { + return function(projection2, geojson, group2) { + if (projection2) { + const p = getScale(projection2, (group2 || this).context); + return p && p.path[methodName](geojson); + } else { return globalMethod(geojson); + } }; -} -const geoArea = geoMethod('area', (0, _d3Geo.geoArea)); -const geoBounds = geoMethod('bounds', (0, _d3Geo.geoBounds)); -const geoCentroid = geoMethod('centroid', (0, _d3Geo.geoCentroid)); -function geoScale(projection, group) { - const p = getScale(projection, (group || this).context); + } + const geoArea = geoMethod("area", geoArea$1); + const geoBounds = geoMethod("bounds", geoBounds$1); + const geoCentroid = geoMethod("centroid", geoCentroid$1); + function geoScale(projection2, group2) { + const p = getScale(projection2, (group2 || this).context); return p && p.scale(); -} -function inScope(item) { - const group = this.context.group; - let value = false; - if (group) while(item){ - if (item === group) { - value = true; - break; - } - item = item.mark.group; + } + function inScope(item) { + const group2 = this.context.group; + let value2 = false; + if (group2) while (item) { + if (item === group2) { + value2 = true; + break; + } + item = item.mark.group; } - return value; -} -function log(df, method, args) { + return value2; + } + function log(df, method2, args) { try { - df[method].apply(df, [ - 'EXPRESSION' - ].concat([].slice.call(args))); + df[method2].apply(df, ["EXPRESSION"].concat([].slice.call(args))); } catch (err) { - df.warn(err); + df.warn(err); } return args[args.length - 1]; -} -function warn() { - return log(this.context.dataflow, 'warn', arguments); -} -function info() { - return log(this.context.dataflow, 'info', arguments); -} -function debug() { - return log(this.context.dataflow, 'debug', arguments); -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef -function channel_luminance_value(channelValue) { + } + function warn() { + return log(this.context.dataflow, "warn", arguments); + } + function info() { + return log(this.context.dataflow, "info", arguments); + } + function debug() { + return log(this.context.dataflow, "debug", arguments); + } + function channel_luminance_value(channelValue) { const val = channelValue / 255; - if (val <= 0.03928) return val / 12.92; + if (val <= 0.03928) { + return val / 12.92; + } return Math.pow((val + 0.055) / 1.055, 2.4); -} -function luminance(color) { - const c = (0, _d3Color.rgb)(color), r = channel_luminance_value(c.r), g = channel_luminance_value(c.g), b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef -function contrast(color1, color2) { + } + function luminance(color2) { + const c2 = rgb$1(color2), r = channel_luminance_value(c2.r), g = channel_luminance_value(c2.g), b2 = channel_luminance_value(c2.b); + return 0.2126 * r + 0.7152 * g + 0.0722 * b2; + } + function contrast(color1, color2) { const lum1 = luminance(color1), lum2 = luminance(color2), lumL = Math.max(lum1, lum2), lumD = Math.min(lum1, lum2); return (lumL + 0.05) / (lumD + 0.05); -} -function merge() { + } + function merge() { const args = [].slice.call(arguments); args.unshift({}); - return (0, _vegaUtil.extend)(...args); -} -function equal(a, b) { - return a === b || a !== a && b !== b ? true : (0, _vegaUtil.isArray)(a) ? (0, _vegaUtil.isArray)(b) && a.length === b.length ? equalArray(a, b) : false : (0, _vegaUtil.isObject)(a) && (0, _vegaUtil.isObject)(b) ? equalObject(a, b) : false; -} -function equalArray(a, b) { - for(let i = 0, n = a.length; i < n; ++i){ - if (!equal(a[i], b[i])) return false; + return extend(...args); + } + function equal(a2, b2) { + return a2 === b2 || a2 !== a2 && b2 !== b2 ? true : isArray(a2) ? isArray(b2) && a2.length === b2.length ? equalArray(a2, b2) : false : isObject(a2) && isObject(b2) ? equalObject(a2, b2) : false; + } + function equalArray(a2, b2) { + for (let i = 0, n = a2.length; i < n; ++i) { + if (!equal(a2[i], b2[i])) return false; + } + return true; + } + function equalObject(a2, b2) { + for (const key2 in a2) { + if (!equal(a2[key2], b2[key2])) return false; } return true; -} -function equalObject(a, b) { - for(const key in a){ - if (!equal(a[key], b[key])) return false; + } + function removePredicate(props) { + return (_) => equalObject(props, _); + } + function modify(name, insert2, remove2, toggle, modify2, values2) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input, stamp = df.stamp(); + let changes = data2.changes, predicate, key2; + if (df._trigger === false || !(input.value.length || insert2 || toggle)) { + return 0; + } + if (!changes || changes.stamp < stamp) { + data2.changes = changes = df.changeset(); + changes.stamp = stamp; + df.runAfter(() => { + data2.modified = true; + df.pulse(input, changes).run(); + }, true, 1); + } + if (remove2) { + predicate = remove2 === true ? truthy : isArray(remove2) || isTuple(remove2) ? remove2 : removePredicate(remove2); + changes.remove(predicate); + } + if (insert2) { + changes.insert(insert2); + } + if (toggle) { + predicate = removePredicate(toggle); + if (input.value.some(predicate)) { + changes.remove(predicate); + } else { + changes.insert(toggle); + } + } + if (modify2) { + for (key2 in values2) { + changes.modify(modify2, key2, values2[key2]); + } + } + return 1; + } + function pinchDistance(event2) { + const t = event2.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; + return Math.hypot(dx, dy); + } + function pinchAngle(event2) { + const t = event2.touches; + return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); + } + const accessors = {}; + function pluck(data2, name) { + const accessor2 = accessors[name] || (accessors[name] = field$1(name)); + return isArray(data2) ? data2.map(accessor2) : accessor2(data2); + } + function array(seq) { + return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null; + } + function sequence(seq) { + return array(seq) || (isString(seq) ? seq : null); + } + function join(seq, ...args) { + return array(seq).join(...args); + } + function indexof(seq, ...args) { + return sequence(seq).indexOf(...args); + } + function lastindexof(seq, ...args) { + return sequence(seq).lastIndexOf(...args); + } + function slice(seq, ...args) { + return sequence(seq).slice(...args); + } + function replace(str, pattern, repl) { + if (isFunction(repl)) error("Function argument passed to replace."); + if (!isString(pattern) && !isRegExp(pattern)) error("Please pass a string or RegExp argument to replace."); + return String(str).replace(pattern, repl); + } + function reverse(seq) { + return array(seq).slice().reverse(); + } + function sort(seq) { + return array(seq).slice().sort(ascending$1); + } + function bandspace(count2, paddingInner, paddingOuter) { + return bandSpace(count2 || 0, paddingInner || 0, paddingOuter || 0); + } + function bandwidth(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 && s2.bandwidth ? s2.bandwidth() : 0; + } + function copy(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 ? s2.copy() : void 0; + } + function domain(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 ? s2.domain() : []; + } + function invert(name, range2, group2) { + const s2 = getScale(name, (group2 || this).context); + return !s2 ? void 0 : isArray(range2) ? (s2.invertRange || s2.invert)(range2) : (s2.invert || s2.invertExtent)(range2); + } + function range$1(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 && s2.range ? s2.range() : []; + } + function scale$2(name, value2, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 ? s2(value2) : void 0; + } + function scaleGradient(scale2, p02, p1, count2, group2) { + scale2 = getScale(scale2, (group2 || this).context); + const gradient2 = Gradient$1(p02, p1); + let stops = scale2.domain(), min2 = stops[0], max2 = peek$1(stops), fraction = identity$2; + if (!(max2 - min2)) { + scale2 = (scale2.interpolator ? scale$4("sequential")().interpolator(scale2.interpolator()) : scale$4("linear")().interpolate(scale2.interpolate()).range(scale2.range())).domain([min2 = 0, max2 = 1]); + } else { + fraction = scaleFraction(scale2, min2, max2); + } + if (scale2.ticks) { + stops = scale2.ticks(+count2 || 15); + if (min2 !== stops[0]) stops.unshift(min2); + if (max2 !== peek$1(stops)) stops.push(max2); + } + stops.forEach((_) => gradient2.stop(fraction(_), scale2(_))); + return gradient2; + } + function geoShape(projection2, geojson, group2) { + const p = getScale(projection2, (group2 || this).context); + return function(context2) { + return p ? p.path.context(context2)(geojson) : ""; + }; + } + function pathShape(path2) { + let p = null; + return function(context2) { + return context2 ? pathRender(context2, p = p || parse$3(path2)) : path2; + }; + } + const datum = (d2) => d2.data; + function treeNodes(name, context2) { + const tree2 = data$1.call(context2, name); + return tree2.root && tree2.root.lookup || {}; + } + function treePath(name, source2, target2) { + const nodes = treeNodes(name, this), s2 = nodes[source2], t = nodes[target2]; + return s2 && t ? s2.path(t).map(datum) : void 0; + } + function treeAncestors(name, node) { + const n = treeNodes(name, this)[node]; + return n ? n.ancestors().map(datum) : void 0; + } + const _window = () => typeof window !== "undefined" && window || null; + function screen() { + const w2 = _window(); + return w2 ? w2.screen : {}; + } + function windowSize() { + const w2 = _window(); + return w2 ? [w2.innerWidth, w2.innerHeight] : [void 0, void 0]; + } + function containerSize() { + const view = this.context.dataflow, el = view.container && view.container(); + return el ? [el.clientWidth, el.clientHeight] : [void 0, void 0]; + } + function intersect(b2, opt, group2) { + if (!b2) return []; + const [u2, v] = b2, box2 = new Bounds().set(u2[0], u2[1], v[0], v[1]), scene = group2 || this.context.dataflow.scenegraph().root; + return intersect$2(scene, box2, filter(opt)); + } + function filter(opt) { + let p = null; + if (opt) { + const types2 = array$4(opt.marktype), names = array$4(opt.markname); + p = (_) => (!types2.length || types2.some((t) => _.marktype === t)) && (!names.length || names.some((s2) => _.name === s2)); + } + return p; + } + function lassoAppend(lasso, x2, y2, minDist = 5) { + lasso = array$4(lasso); + const last = lasso[lasso.length - 1]; + return last === void 0 || Math.hypot(last[0] - x2, last[1] - y2) > minDist ? [...lasso, [x2, y2]] : lasso; + } + function lassoPath(lasso) { + return array$4(lasso).reduce((svg, [x2, y2], i) => { + return svg += i == 0 ? `M ${x2},${y2} ` : i === lasso.length - 1 ? " Z" : `L ${x2},${y2} `; + }, ""); + } + function intersectLasso(markname, pixelLasso, unit2) { + const { + x: x2, + y: y2, + mark + } = unit2; + const bb = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); + for (const [px2, py2] of pixelLasso) { + if (px2 < bb.x1) bb.x1 = px2; + if (px2 > bb.x2) bb.x2 = px2; + if (py2 < bb.y1) bb.y1 = py2; + if (py2 > bb.y2) bb.y2 = py2; + } + bb.translate(x2, y2); + const intersection2 = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark); + return intersection2.filter((tuple) => pointInPolygon(tuple.x, tuple.y, pixelLasso)); + } + function pointInPolygon(testx, testy, polygon) { + let intersections = 0; + for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { + const [prevX, prevY] = polygon[j]; + const [x2, y2] = polygon[i]; + if (y2 > testy != prevY > testy && testx < (prevX - x2) * (testy - y2) / (prevY - y2) + x2) { + intersections++; + } + } + return intersections & 1; + } + const functionContext = { + random() { + return random(); + }, + // override default + cumulativeNormal, + cumulativeLogNormal, + cumulativeUniform, + densityNormal, + densityLogNormal, + densityUniform, + quantileNormal, + quantileLogNormal, + quantileUniform, + sampleNormal, + sampleLogNormal, + sampleUniform, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isDefined(_) { + return _ !== void 0; + }, + isNumber: isNumber$1, + isObject, + isRegExp, + isString, + isTuple, + isValid(_) { + return _ != null && _ === _; + }, + toBoolean, + toDate(_) { + return toDate(_); + }, + // suppress extra arguments + toNumber, + toString, + indexof, + join, + lastindexof, + replace, + reverse, + sort, + slice, + flush, + lerp, + merge, + pad: pad$1, + peek: peek$1, + pluck, + span, + inrange, + truncate: truncate$1, + rgb: rgb$1, + lab: lab$1, + hcl: hcl$1, + hsl: hsl$1, + luminance, + contrast, + sequence: range$3, + format, + utcFormat, + utcParse, + utcOffset, + utcSequence, + timeFormat, + timeParse, + timeOffset, + timeSequence, + timeUnitSpecifier, + monthFormat, + monthAbbrevFormat, + dayFormat, + dayAbbrevFormat, + quarter, + utcquarter, + week, + utcweek, + dayofyear, + utcdayofyear, + warn, + info, + debug, + extent(_) { + return extent(_); + }, + // suppress extra arguments + inScope, + intersect, + clampRange, + pinchDistance, + pinchAngle, + screen, + containerSize, + windowSize, + bandspace, + setdata, + pathShape, + panLinear, + panLog, + panPow, + panSymlog, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog, + encode, + modify, + lassoAppend, + lassoPath, + intersectLasso + }; + const eventFunctions = ["view", "item", "group", "xy", "x", "y"], eventPrefix = "event.vega.", thisPrefix = "this.", astVisitors = {}; + const codegenParams = { + forbidden: ["_"], + allowed: ["datum", "event", "item"], + fieldvar: "datum", + globalvar: (id2) => `_[${$(SignalPrefix + id2)}]`, + functions: buildFunctions, + constants: Constants, + visitors: astVisitors + }; + const codeGenerator = codegen(codegenParams); + function buildFunctions(codegen2) { + const fn2 = Functions(codegen2); + eventFunctions.forEach((name) => fn2[name] = eventPrefix + name); + for (const name in functionContext) { + fn2[name] = thisPrefix + name; + } + extend(fn2, internalScaleFunctions(codegen2, functionContext, astVisitors)); + return fn2; + } + function expressionFunction(name, fn2, visitor) { + if (arguments.length === 1) { + return functionContext[name]; + } + functionContext[name] = fn2; + if (visitor) astVisitors[name] = visitor; + if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; + return this; + } + expressionFunction("bandwidth", bandwidth, scaleVisitor); + expressionFunction("copy", copy, scaleVisitor); + expressionFunction("domain", domain, scaleVisitor); + expressionFunction("range", range$1, scaleVisitor); + expressionFunction("invert", invert, scaleVisitor); + expressionFunction("scale", scale$2, scaleVisitor); + expressionFunction("gradient", scaleGradient, scaleVisitor); + expressionFunction("geoArea", geoArea, scaleVisitor); + expressionFunction("geoBounds", geoBounds, scaleVisitor); + expressionFunction("geoCentroid", geoCentroid, scaleVisitor); + expressionFunction("geoShape", geoShape, scaleVisitor); + expressionFunction("geoScale", geoScale, scaleVisitor); + expressionFunction("indata", indata, indataVisitor); + expressionFunction("data", data$1, dataVisitor); + expressionFunction("treePath", treePath, dataVisitor); + expressionFunction("treeAncestors", treeAncestors, dataVisitor); + expressionFunction("vlSelectionTest", selectionTest, selectionVisitor); + expressionFunction("vlSelectionIdTest", selectionIdTest, selectionVisitor); + expressionFunction("vlSelectionResolve", selectionResolve, selectionVisitor); + expressionFunction("vlSelectionTuples", selectionTuples); + function parser(expr2, scope) { + const params2 = {}; + let ast; + try { + expr2 = isString(expr2) ? expr2 : $(expr2) + ""; + ast = parser$1(expr2); + } catch (err) { + error("Expression parse error: " + expr2); + } + ast.visit((node) => { + if (node.type !== CallExpression) return; + const name = node.callee.name, visit2 = codegenParams.visitors[name]; + if (visit2) visit2(name, node.arguments, scope, params2); + }); + const gen = codeGenerator(ast); + gen.globals.forEach((name) => { + const signalName = SignalPrefix + name; + if (!has$1(params2, signalName) && scope.getSignal(name)) { + params2[signalName] = scope.signalRef(name); + } + }); + return { + $expr: extend({ + code: gen.code + }, scope.options.ast ? { + ast + } : null), + $fields: gen.fields, + $params: params2 + }; + } + function parse$2(spec) { + const ctx = this, operators = spec.operators || []; + if (spec.background) { + ctx.background = spec.background; + } + if (spec.eventConfig) { + ctx.eventConfig = spec.eventConfig; + } + if (spec.locale) { + ctx.locale = spec.locale; + } + operators.forEach((entry2) => ctx.parseOperator(entry2)); + operators.forEach((entry2) => ctx.parseOperatorParameters(entry2)); + (spec.streams || []).forEach((entry2) => ctx.parseStream(entry2)); + (spec.updates || []).forEach((entry2) => ctx.parseUpdate(entry2)); + return ctx.resolve(); + } + const Skip$2 = toSet(["rule"]), Swap = toSet(["group", "image", "rect"]); + function adjustSpatial(encode2, marktype) { + let code = ""; + if (Skip$2[marktype]) return code; + if (encode2.x2) { + if (encode2.x) { + if (Swap[marktype]) { + code += "if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"; + } + code += "o.width=o.x2-o.x;"; + } else { + code += "o.x=o.x2-(o.width||0);"; + } + } + if (encode2.xc) { + code += "o.x=o.xc-(o.width||0)/2;"; + } + if (encode2.y2) { + if (encode2.y) { + if (Swap[marktype]) { + code += "if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"; + } + code += "o.height=o.y2-o.y;"; + } else { + code += "o.y=o.y2-(o.height||0);"; + } + } + if (encode2.yc) { + code += "o.y=o.yc-(o.height||0)/2;"; + } + return code; + } + function canonicalType(type2) { + return (type2 + "").toLowerCase(); + } + function isOperator(type2) { + return canonicalType(type2) === "operator"; + } + function isCollect(type2) { + return canonicalType(type2) === "collect"; + } + function expression(ctx, args, code) { + if (!code.endsWith(";")) { + code = "return(" + code + ");"; + } + const fn2 = Function(...args.concat(code)); + return ctx && ctx.functions ? fn2.bind(ctx.functions) : fn2; + } + function _compare(u2, v, lt, gt) { + return `((u = ${u2}) < (v = ${v}) || u == null) && v != null ? ${lt} + : (u > v || v == null) && u != null ? ${gt} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} + : v !== v && u === u ? ${gt} : `; + } + var expressionCodegen = { + /** + * Parse an expression used to update an operator value. + */ + operator: (ctx, expr2) => expression(ctx, ["_"], expr2.code), + /** + * Parse an expression provided as an operator parameter value. + */ + parameter: (ctx, expr2) => expression(ctx, ["datum", "_"], expr2.code), + /** + * Parse an expression applied to an event stream. + */ + event: (ctx, expr2) => expression(ctx, ["event"], expr2.code), + /** + * Parse an expression used to handle an event-driven operator update. + */ + handler: (ctx, expr2) => { + const code = `var datum=event.item&&event.item.datum;return ${expr2.code};`; + return expression(ctx, ["_", "event"], code); + }, + /** + * Parse an expression that performs visual encoding. + */ + encode: (ctx, encode2) => { + const { + marktype, + channels + } = encode2; + let code = "var o=item,datum=o.datum,m=0,$;"; + for (const name in channels) { + const o = "o[" + $(name) + "]"; + code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; + } + code += adjustSpatial(channels, marktype); + code += "return m;"; + return expression(ctx, ["item", "_"], code); + }, + /** + * Optimized code generators for access and comparison. + */ + codegen: { + get(path2) { + const ref2 = `[${path2.map($).join("][")}]`; + const get2 = Function("_", `return _${ref2};`); + get2.path = ref2; + return get2; + }, + comparator(fields, orders) { + let t; + const map2 = (f, i) => { + const o = orders[i]; + let u2, v; + if (f.path) { + u2 = `a${f.path}`; + v = `b${f.path}`; + } else { + (t = t || {})["f" + i] = f; + u2 = `this.f${i}(a)`; + v = `this.f${i}(b)`; + } + return _compare(u2, v, -o, o); + }; + const fn2 = Function("a", "b", "var u, v; return " + fields.map(map2).join("") + "0;"); + return t ? fn2.bind(t) : fn2; + } + } + }; + function parseOperator(spec) { + const ctx = this; + if (isOperator(spec.type) || !spec.type) { + ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); + } else { + ctx.transform(spec, spec.type); + } + } + function parseOperatorParameters(spec) { + const ctx = this; + if (spec.params) { + const op = ctx.get(spec.id); + if (!op) error("Invalid operator id: " + spec.id); + ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); + } + } + function parseParameters$1(spec, params2) { + params2 = params2 || {}; + const ctx = this; + for (const key2 in spec) { + const value2 = spec[key2]; + params2[key2] = isArray(value2) ? value2.map((v) => parseParameter$2(v, ctx, params2)) : parseParameter$2(value2, ctx, params2); + } + return params2; + } + function parseParameter$2(spec, ctx, params2) { + if (!spec || !isObject(spec)) return spec; + for (let i = 0, n = PARSERS.length, p; i < n; ++i) { + p = PARSERS[i]; + if (has$1(spec, p.key)) { + return p.parse(spec, ctx, params2); + } + } + return spec; + } + var PARSERS = [{ + key: "$ref", + parse: getOperator + }, { + key: "$key", + parse: getKey + }, { + key: "$expr", + parse: getExpression + }, { + key: "$field", + parse: getField + }, { + key: "$encode", + parse: getEncode + }, { + key: "$compare", + parse: getCompare + }, { + key: "$context", + parse: getContext + }, { + key: "$subflow", + parse: getSubflow + }, { + key: "$tupleid", + parse: getTupleId + }]; + function getOperator(_, ctx) { + return ctx.get(_.$ref) || error("Operator not defined: " + _.$ref); + } + function getExpression(_, ctx, params2) { + if (_.$params) { + ctx.parseParameters(_.$params, params2); + } + const k = "e:" + _.$expr.code; + return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields)); + } + function getKey(_, ctx) { + const k = "k:" + _.$key + "_" + !!_.$flat; + return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat, ctx.expr.codegen)); + } + function getField(_, ctx) { + if (!_.$field) return null; + const k = "f:" + _.$field + "_" + _.$name; + return ctx.fn[k] || (ctx.fn[k] = field$1(_.$field, _.$name, ctx.expr.codegen)); + } + function getCompare(_, ctx) { + const k = "c:" + _.$compare + "_" + _.$order, c2 = array$4(_.$compare).map((_2) => _2 && _2.$tupleid ? tupleid : _2); + return ctx.fn[k] || (ctx.fn[k] = compare$1(c2, _.$order, ctx.expr.codegen)); + } + function getEncode(_, ctx) { + const spec = _.$encode, encode2 = {}; + for (const name in spec) { + const enc = spec[name]; + encode2[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); + encode2[name].output = enc.$output; + } + return encode2; + } + function getContext(_, ctx) { + return ctx; + } + function getSubflow(_, ctx) { + const spec = _.$subflow; + return function(dataflow, key2, parent) { + const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; + if (p) p.set(parent); + op.detachSubflow = () => ctx.detach(subctx); + return op; + }; + } + function getTupleId() { + return tupleid; + } + function parseStream$2(spec) { + var ctx = this, filter2 = spec.filter != null ? ctx.eventExpression(spec.filter) : void 0, stream2 = spec.stream != null ? ctx.get(spec.stream) : void 0, args; + if (spec.source) { + stream2 = ctx.events(spec.source, spec.type, filter2); + } else if (spec.merge) { + args = spec.merge.map((_) => ctx.get(_)); + stream2 = args[0].merge.apply(args[0], args.slice(1)); + } + if (spec.between) { + args = spec.between.map((_) => ctx.get(_)); + stream2 = stream2.between(args[0], args[1]); + } + if (spec.filter) { + stream2 = stream2.filter(filter2); + } + if (spec.throttle != null) { + stream2 = stream2.throttle(+spec.throttle); + } + if (spec.debounce != null) { + stream2 = stream2.debounce(+spec.debounce); + } + if (stream2 == null) { + error("Invalid stream definition: " + JSON.stringify(spec)); + } + if (spec.consume) stream2.consume(true); + ctx.stream(spec, stream2); + } + function parseUpdate$1(spec) { + var ctx = this, srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, source2 = ctx.get(srcid), target2 = null, update2 = spec.update, params2 = void 0; + if (!source2) error("Source not defined: " + spec.source); + target2 = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); + if (update2 && update2.$expr) { + if (update2.$params) { + params2 = ctx.parseParameters(update2.$params); + } + update2 = ctx.handlerExpression(update2.$expr); + } + ctx.update(spec, source2, target2, update2, params2); + } + const SKIP = { + skip: true + }; + function getState$1(options2) { + var ctx = this, state = {}; + if (options2.signals) { + var signals = state.signals = {}; + Object.keys(ctx.signals).forEach((key2) => { + const op = ctx.signals[key2]; + if (options2.signals(key2, op)) { + signals[key2] = op.value; + } + }); } - return true; -} -function removePredicate(props) { - return (_)=>equalObject(props, _); -} -function modify(name, insert, remove, toggle, modify, values) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input, stamp = df.stamp(); - let changes = data.changes, predicate, key; - if (df._trigger === false || !(input.value.length || insert || toggle)) // nothing to do! - return 0; - if (!changes || changes.stamp < stamp) { - data.changes = changes = df.changeset(); - changes.stamp = stamp; - df.runAfter(()=>{ - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - if (remove) { - predicate = remove === true ? (0, _vegaUtil.truthy) : (0, _vegaUtil.isArray)(remove) || (0, _vegaDataflow.isTuple)(remove) ? remove : removePredicate(remove); - changes.remove(predicate); + if (options2.data) { + var data2 = state.data = {}; + Object.keys(ctx.data).forEach((key2) => { + const dataset = ctx.data[key2]; + if (options2.data(key2, dataset)) { + data2[key2] = dataset.input.value; + } + }); } - if (insert) changes.insert(insert); - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) changes.remove(predicate); - else changes.insert(toggle); + if (ctx.subcontext && options2.recurse !== false) { + state.subcontext = ctx.subcontext.map((ctx2) => ctx2.getState(options2)); } - if (modify) for(key in values)changes.modify(modify, key, values[key]); - return 1; -} -function pinchDistance(event) { - const t = event.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; - return Math.hypot(dx, dy); -} -function pinchAngle(event) { - const t = event.touches; - return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); -} -// memoize accessor functions -const accessors = {}; -function pluck(data, name) { - const accessor = accessors[name] || (accessors[name] = (0, _vegaUtil.field)(name)); - return (0, _vegaUtil.isArray)(data) ? data.map(accessor) : accessor(data); -} -function array(seq) { - return (0, _vegaUtil.isArray)(seq) || ArrayBuffer.isView(seq) ? seq : null; -} -function sequence(seq) { - return array(seq) || ((0, _vegaUtil.isString)(seq) ? seq : null); -} -function join(seq) { - for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; - return array(seq).join(...args); -} -function indexof(seq) { - for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)args[_key2 - 1] = arguments[_key2]; - return sequence(seq).indexOf(...args); -} -function lastindexof(seq) { - for(var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)args[_key3 - 1] = arguments[_key3]; - return sequence(seq).lastIndexOf(...args); -} -function slice(seq) { - for(var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++)args[_key4 - 1] = arguments[_key4]; - return sequence(seq).slice(...args); -} -function replace(str, pattern, repl) { - if ((0, _vegaUtil.isFunction)(repl)) (0, _vegaUtil.error)('Function argument passed to replace.'); - if (!(0, _vegaUtil.isString)(pattern) && !(0, _vegaUtil.isRegExp)(pattern)) (0, _vegaUtil.error)('Please pass a string or RegExp argument to replace.'); - return String(str).replace(pattern, repl); -} -function reverse(seq) { - return array(seq).slice().reverse(); -} -function sort(seq) { - return array(seq).slice().sort((0, _vegaUtil.ascending)); -} -function bandspace(count, paddingInner, paddingOuter) { - return (0, _vegaScale.bandSpace)(count || 0, paddingInner || 0, paddingOuter || 0); -} -function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; -} -function copy(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; -} -function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; -} -function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined : (0, _vegaUtil.isArray)(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range); -} -function range(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; -} -function scale(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; -} -/** - * Passing a function is only used for for testing. - * Outside of tests, the first argument should be a string. - */ function scaleGradient(scaleOrFunction, p0, p1, count, group) { - let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction; - const gradient = (0, _vegaScenegraph.Gradient)(p0, p1); - let stops = scale.domain(), min = stops[0], max = (0, _vegaUtil.peek)(stops), fraction = (0, _vegaUtil.identity); - if (!(max - min)) // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator ? (0, _vegaScale.scale)('sequential')().interpolator(scale.interpolator()) : (0, _vegaScale.scale)('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([ - min = 0, - max = 1 - ]); - else fraction = (0, _vegaScale.scaleFraction)(scale, min, max); - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== (0, _vegaUtil.peek)(stops)) stops.push(max); - } - stops.forEach((_)=>gradient.stop(fraction(_), scale(_))); - return gradient; -} -function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; -} -function pathShape(path) { - let p = null; - return function(context) { - return context ? (0, _vegaScenegraph.pathRender)(context, p = p || (0, _vegaScenegraph.pathParse)(path)) : path; - }; -} -const datum = (d)=>d.data; -function treeNodes(name, context) { - const tree = data.call(context, name); - return tree.root && tree.root.lookup || {}; -} -function treePath(name, source, target) { - const nodes = treeNodes(name, this), s = nodes[source], t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; -} -function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; -} -const _window = ()=>typeof window !== 'undefined' && window || null; -function screen() { - const w = _window(); - return w ? w.screen : {}; -} -function windowSize() { - const w = _window(); - return w ? [ - w.innerWidth, - w.innerHeight - ] : [ - undefined, - undefined - ]; -} -function containerSize() { - const view = this.context.dataflow, el = view.container && view.container(); - return el ? [ - el.clientWidth, - el.clientHeight - ] : [ - undefined, - undefined - ]; -} -function intersect(b, opt, group) { - if (!b) return []; - const [u, v] = b, box = new (0, _vegaScenegraph.Bounds)().set(u[0], u[1], v[0], v[1]), scene = group || this.context.dataflow.scenegraph().root; - return (0, _vegaScenegraph.intersect)(scene, box, filter(opt)); -} -function filter(opt) { - let p = null; - if (opt) { - const types = (0, _vegaUtil.array)(opt.marktype), names = (0, _vegaUtil.array)(opt.markname); - p = (_)=>(!types.length || types.some((t)=>_.marktype === t)) && (!names.length || names.some((s)=>_.name === s)); + return state; + } + function setState$1(state) { + var ctx = this, df = ctx.dataflow, data2 = state.data, signals = state.signals; + Object.keys(signals || {}).forEach((key2) => { + df.update(ctx.signals[key2], signals[key2], SKIP); + }); + Object.keys(data2 || {}).forEach((key2) => { + df.pulse(ctx.data[key2].input, df.changeset().remove(truthy).insert(data2[key2])); + }); + (state.subcontext || []).forEach((substate, i) => { + const subctx = ctx.subcontext[i]; + if (subctx) subctx.setState(substate); + }); + } + function context(df, transforms2, functions, expr2) { + return new Context(df, transforms2, functions, expr2); + } + function Context(df, transforms2, functions, expr2) { + this.dataflow = df; + this.transforms = transforms2; + this.events = df.events.bind(df); + this.expr = expr2 || expressionCodegen, this.signals = {}; + this.scales = {}; + this.nodes = {}; + this.data = {}; + this.fn = {}; + if (functions) { + this.functions = Object.create(functions); + this.functions.context = this; } - return p; -} -/** - * Appends a new point to the lasso - * - * @param {*} lasso the lasso in pixel space - * @param {*} x the x coordinate in pixel space - * @param {*} y the y coordinate in pixel space - * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point - * @returns a new array containing the lasso with the new point - */ function lassoAppend(lasso, x, y) { - let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5; - lasso = (0, _vegaUtil.array)(lasso); - const last = lasso[lasso.length - 1]; - // Add point to lasso if its the first point or distance to last point exceed minDist - return last === undefined || Math.hypot(last[0] - x, last[1] - y) > minDist ? [ - ...lasso, - [ - x, - y - ] - ] : lasso; -} -/** - * Generates a svg path command which draws a lasso - * - * @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...] - * @returns the svg path command that draws the lasso - */ function lassoPath(lasso) { - return (0, _vegaUtil.array)(lasso).reduce((svg, _ref, i)=>{ - let [x, y] = _ref; - return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `; - }, ''); -} -/** - * Inverts the lasso from pixel space to an array of vega scenegraph tuples - * - * @param {*} data the dataset - * @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...] - * @param {*} unit the unit where the lasso is defined - * - * @returns an array of vega scenegraph tuples - */ function intersectLasso(markname, pixelLasso, unit) { - const { x, y, mark } = unit; - const bb = new (0, _vegaScenegraph.Bounds)().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); - // Get bounding box around lasso - for (const [px, py] of pixelLasso){ - if (px < bb.x1) bb.x1 = px; - if (px > bb.x2) bb.x2 = px; - if (py < bb.y1) bb.y1 = py; - if (py > bb.y2) bb.y2 = py; - } - // Translate bb against unit coordinates - bb.translate(x, y); - const intersection = intersect([ - [ - bb.x1, - bb.y1 - ], - [ - bb.x2, - bb.y2 - ] - ], markname, mark); - // Check every point against the lasso - return intersection.filter((tuple)=>pointInPolygon(tuple.x, tuple.y, pixelLasso)); -} -/** - * Performs a test if a point is inside a polygon based on the idea from - * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html - * - * This method will not need the same start/end point since it wraps around the edges of the array - * - * @param {*} test a point to test against - * @param {*} polygon a polygon in the form [[x,y], [x,y], ...] - * @returns true if the point lies inside the polygon, false otherwise - */ function pointInPolygon(testx, testy, polygon) { - let intersections = 0; - for(let i = 0, j = polygon.length - 1; i < polygon.length; j = i++){ - const [prevX, prevY] = polygon[j]; - const [x, y] = polygon[i]; - // count intersections - if (y > testy != prevY > testy && testx < (prevX - x) * (testy - y) / (prevY - y) + x) intersections++; + } + function Subcontext(ctx) { + this.dataflow = ctx.dataflow; + this.transforms = ctx.transforms; + this.events = ctx.events; + this.expr = ctx.expr; + this.signals = Object.create(ctx.signals); + this.scales = Object.create(ctx.scales); + this.nodes = Object.create(ctx.nodes); + this.data = Object.create(ctx.data); + this.fn = Object.create(ctx.fn); + if (ctx.functions) { + this.functions = Object.create(ctx.functions); + this.functions.context = this; } - // point is in polygon if intersection count is odd - return intersections & 1; -} -// Expression function context object -const functionContext = { - random () { - return (0, _vegaStatistics.random)(); + } + Context.prototype = Subcontext.prototype = { + fork() { + const ctx = new Subcontext(this); + (this.subcontext || (this.subcontext = [])).push(ctx); + return ctx; }, - cumulativeNormal: // override default - (0, _vegaStatistics.cumulativeNormal), - cumulativeLogNormal: (0, _vegaStatistics.cumulativeLogNormal), - cumulativeUniform: (0, _vegaStatistics.cumulativeUniform), - densityNormal: (0, _vegaStatistics.densityNormal), - densityLogNormal: (0, _vegaStatistics.densityLogNormal), - densityUniform: (0, _vegaStatistics.densityUniform), - quantileNormal: (0, _vegaStatistics.quantileNormal), - quantileLogNormal: (0, _vegaStatistics.quantileLogNormal), - quantileUniform: (0, _vegaStatistics.quantileUniform), - sampleNormal: (0, _vegaStatistics.sampleNormal), - sampleLogNormal: (0, _vegaStatistics.sampleLogNormal), - sampleUniform: (0, _vegaStatistics.sampleUniform), - isArray: (0, _vegaUtil.isArray), - isBoolean: (0, _vegaUtil.isBoolean), - isDate: (0, _vegaUtil.isDate), - isDefined (_) { - return _ !== undefined; + detach(ctx) { + this.subcontext = this.subcontext.filter((c2) => c2 !== ctx); + const keys2 = Object.keys(ctx.nodes); + for (const key2 of keys2) ctx.nodes[key2]._targets = null; + for (const key2 of keys2) ctx.nodes[key2].detach(); + ctx.nodes = null; }, - isNumber: (0, _vegaUtil.isNumber), - isObject: (0, _vegaUtil.isObject), - isRegExp: (0, _vegaUtil.isRegExp), - isString: (0, _vegaUtil.isString), - isTuple: (0, _vegaDataflow.isTuple), - isValid (_) { - return _ != null && _ === _; + get(id2) { + return this.nodes[id2]; }, - toBoolean: (0, _vegaUtil.toBoolean), - toDate (_) { - return (0, _vegaUtil.toDate)(_); + set(id2, node) { + return this.nodes[id2] = node; }, - toNumber: // suppress extra arguments - (0, _vegaUtil.toNumber), - toString: (0, _vegaUtil.toString), - indexof, - join, - lastindexof, - replace, - reverse, - sort, - slice, - flush: (0, _vegaUtil.flush), - lerp: (0, _vegaUtil.lerp), - merge, - pad: (0, _vegaUtil.pad), - peek: (0, _vegaUtil.peek), - pluck, - span: (0, _vegaUtil.span), - inrange: (0, _vegaUtil.inrange), - truncate: (0, _vegaUtil.truncate), - rgb: (0, _d3Color.rgb), - lab: (0, _d3Color.lab), - hcl: (0, _d3Color.hcl), - hsl: (0, _d3Color.hsl), - luminance, - contrast, - sequence: (0, _d3Array.range), - format, - utcFormat, - utcParse, - utcOffset: (0, _vegaTime.utcOffset), - utcSequence: (0, _vegaTime.utcSequence), - timeFormat, - timeParse, - timeOffset: (0, _vegaTime.timeOffset), - timeSequence: (0, _vegaTime.timeSequence), - timeUnitSpecifier: (0, _vegaTime.timeUnitSpecifier), - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter: (0, _vegaUtil.quarter), - utcquarter: (0, _vegaUtil.utcquarter), - week: (0, _vegaTime.week), - utcweek: (0, _vegaTime.utcweek), - dayofyear: (0, _vegaTime.dayofyear), - utcdayofyear: (0, _vegaTime.utcdayofyear), - warn, - info, - debug, - extent (_) { - return (0, _vegaUtil.extent)(_); + add(spec, op) { + const ctx = this, df = ctx.dataflow, data2 = spec.value; + ctx.set(spec.id, op); + if (isCollect(spec.type) && data2) { + if (data2.$ingest) { + df.ingest(op, data2.$ingest, data2.$format); + } else if (data2.$request) { + df.preload(op, data2.$request, data2.$format); + } else { + df.pulse(op, df.changeset().insert(data2)); + } + } + if (spec.root) { + ctx.root = op; + } + if (spec.parent) { + let p = ctx.get(spec.parent.$ref); + if (p) { + df.connect(p, [op]); + op.targets().add(p); + } else { + (ctx.unresolved = ctx.unresolved || []).push(() => { + p = ctx.get(spec.parent.$ref); + df.connect(p, [op]); + op.targets().add(p); + }); + } + } + if (spec.signal) { + ctx.signals[spec.signal] = op; + } + if (spec.scale) { + ctx.scales[spec.scale] = op; + } + if (spec.data) { + for (const name in spec.data) { + const data3 = ctx.data[name] || (ctx.data[name] = {}); + spec.data[name].forEach((role) => data3[role] = op); + } + } }, - // suppress extra arguments - inScope, - intersect, - clampRange: (0, _vegaUtil.clampRange), - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear: (0, _vegaUtil.panLinear), - panLog: (0, _vegaUtil.panLog), - panPow: (0, _vegaUtil.panPow), - panSymlog: (0, _vegaUtil.panSymlog), - zoomLinear: (0, _vegaUtil.zoomLinear), - zoomLog: (0, _vegaUtil.zoomLog), - zoomPow: (0, _vegaUtil.zoomPow), - zoomSymlog: (0, _vegaUtil.zoomSymlog), - encode, - modify, - lassoAppend, - lassoPath, - intersectLasso -}; -const eventFunctions = [ - 'view', - 'item', - 'group', - 'xy', - 'x', - 'y' -], // event functions -eventPrefix = 'event.vega.', // event function prefix -thisPrefix = 'this.', // function context prefix -astVisitors = {}; // AST visitors for dependency analysis -// export code generator parameters -const codegenParams = { - forbidden: [ - '_' - ], - allowed: [ - 'datum', - 'event', - 'item' - ], - fieldvar: 'datum', - globalvar: (id)=>`_[${(0, _vegaUtil.stringValue)(SignalPrefix + id)}]`, - functions: buildFunctions, - constants: (0, _vegaExpression.constants), - visitors: astVisitors -}; -// export code generator -const codeGenerator = (0, _vegaExpression.codegenExpression)(codegenParams); -// Build expression function registry -function buildFunctions(codegen) { - const fn = (0, _vegaExpression.functions)(codegen); - eventFunctions.forEach((name)=>fn[name] = eventPrefix + name); - for(const name in functionContext)fn[name] = thisPrefix + name; - (0, _vegaUtil.extend)(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; -} -// Register an expression function -function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) return functionContext[name]; - // register with the functionContext - functionContext[name] = fn; - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; -} -// register expression functions with ast visitors -expressionFunction('bandwidth', bandwidth, scaleVisitor); -expressionFunction('copy', copy, scaleVisitor); -expressionFunction('domain', domain, scaleVisitor); -expressionFunction('range', range, scaleVisitor); -expressionFunction('invert', invert, scaleVisitor); -expressionFunction('scale', scale, scaleVisitor); -expressionFunction('gradient', scaleGradient, scaleVisitor); -expressionFunction('geoArea', geoArea, scaleVisitor); -expressionFunction('geoBounds', geoBounds, scaleVisitor); -expressionFunction('geoCentroid', geoCentroid, scaleVisitor); -expressionFunction('geoShape', geoShape, scaleVisitor); -expressionFunction('geoScale', geoScale, scaleVisitor); -expressionFunction('indata', indata, indataVisitor); -expressionFunction('data', data, dataVisitor); -expressionFunction('treePath', treePath, dataVisitor); -expressionFunction('treeAncestors', treeAncestors, dataVisitor); -// register Vega-Lite selection functions -expressionFunction('vlSelectionTest', (0, _vegaSelections.selectionTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionIdTest', (0, _vegaSelections.selectionIdTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionResolve', (0, _vegaSelections.selectionResolve), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionTuples', (0, _vegaSelections.selectionTuples)); -function parser(expr, scope) { - const params = {}; - // parse the expression to an abstract syntax tree (ast) - let ast; - try { - expr = (0, _vegaUtil.isString)(expr) ? expr : (0, _vegaUtil.stringValue)(expr) + ''; - ast = (0, _vegaExpression.parseExpression)(expr); - } catch (err) { - (0, _vegaUtil.error)('Expression parse error: ' + expr); + resolve() { + (this.unresolved || []).forEach((fn2) => fn2()); + delete this.unresolved; + return this; + }, + operator(spec, update2) { + this.add(spec, this.dataflow.add(spec.value, update2)); + }, + transform(spec, type2) { + this.add(spec, this.dataflow.add(this.transforms[canonicalType(type2)])); + }, + stream(spec, stream2) { + this.set(spec.id, stream2); + }, + update(spec, stream2, target2, update2, params2) { + this.dataflow.on(stream2, target2, update2, params2, spec.options); + }, + // expression parsing + operatorExpression(expr2) { + return this.expr.operator(this, expr2); + }, + parameterExpression(expr2) { + return this.expr.parameter(this, expr2); + }, + eventExpression(expr2) { + return this.expr.event(this, expr2); + }, + handlerExpression(expr2) { + return this.expr.handler(this, expr2); + }, + encodeExpression(encode2) { + return this.expr.encode(this, encode2); + }, + // parse methods + parse: parse$2, + parseOperator, + parseOperatorParameters, + parseParameters: parseParameters$1, + parseStream: parseStream$2, + parseUpdate: parseUpdate$1, + // state methods + getState: getState$1, + setState: setState$1 + }; + function initializeAria(view) { + const el = view.container(); + if (el) { + el.setAttribute("role", "graphics-document"); + el.setAttribute("aria-roleDescription", "visualization"); + ariaLabel(el, view.description()); } - // analyze ast function calls for dependencies - ast.visit((node)=>{ - if (node.type !== (0, _vegaExpression.CallExpression)) return; - const name = node.callee.name, visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); + } + function ariaLabel(el, desc) { + if (el) desc == null ? el.removeAttribute("aria-label") : el.setAttribute("aria-label", desc); + } + function background(view) { + view.add(null, (_) => { + view._background = _.bg; + view._resize = 1; + return _.bg; + }, { + bg: view._signals.background }); - // perform code generation - const gen = codeGenerator(ast); - // collect signal dependencies - gen.globals.forEach((name)=>{ - const signalName = SignalPrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, signalName) && scope.getSignal(name)) params[signalName] = scope.signalRef(name); + } + const Default = "default"; + function cursor(view) { + const cursor2 = view._signals.cursor || (view._signals.cursor = view.add({ + user: Default, + item: null + })); + view.on(view.events("view", "pointermove"), cursor2, (_, event2) => { + const value2 = cursor2.value, user = value2 ? isString(value2) ? value2 : value2.user : Default, item = event2.item && event2.item.cursor || null; + return value2 && user === value2.user && item == value2.item ? value2 : { + user, + item + }; }); - // return generated expression code and dependencies - return { - $expr: (0, _vegaUtil.extend)({ - code: gen.code - }, scope.options.ast ? { - ast - } : null), - $fields: gen.fields, - $params: params - }; -} - -},{"vega-util":"f2ulH","vega-expression":"8Nghf","vega-scale":"gHN3E","d3-geo":"8qTbc","d3-color":"37LNF","vega-dataflow":"cFRfY","vega-scenegraph":"gJqm6","vega-selections":"inIVI","vega-statistics":"4QSQj","vega-time":"kjkWX","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Nghf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ASTNode", ()=>ASTNode); -parcelHelpers.export(exports, "ArrayExpression", ()=>ArrayExpression); -parcelHelpers.export(exports, "BinaryExpression", ()=>BinaryExpression); -parcelHelpers.export(exports, "CallExpression", ()=>CallExpression); -parcelHelpers.export(exports, "ConditionalExpression", ()=>ConditionalExpression); -parcelHelpers.export(exports, "Identifier", ()=>Identifier); -parcelHelpers.export(exports, "Literal", ()=>Literal); -parcelHelpers.export(exports, "LogicalExpression", ()=>LogicalExpression); -parcelHelpers.export(exports, "MemberExpression", ()=>MemberExpression); -parcelHelpers.export(exports, "ObjectExpression", ()=>ObjectExpression); -parcelHelpers.export(exports, "Property", ()=>Property); -parcelHelpers.export(exports, "RawCode", ()=>RawCode); -parcelHelpers.export(exports, "UnaryExpression", ()=>UnaryExpression); -parcelHelpers.export(exports, "codegenExpression", ()=>codegen); -parcelHelpers.export(exports, "constants", ()=>Constants); -parcelHelpers.export(exports, "functions", ()=>Functions); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -var _vegaUtil = require("vega-util"); -const RawCode = 'RawCode'; -const Literal = 'Literal'; -const Property = 'Property'; -const Identifier = 'Identifier'; -const ArrayExpression = 'ArrayExpression'; -const BinaryExpression = 'BinaryExpression'; -const CallExpression = 'CallExpression'; -const ConditionalExpression = 'ConditionalExpression'; -const LogicalExpression = 'LogicalExpression'; -const MemberExpression = 'MemberExpression'; -const ObjectExpression = 'ObjectExpression'; -const UnaryExpression = 'UnaryExpression'; -function ASTNode(type) { - this.type = type; -} -ASTNode.prototype.visit = function(visitor) { - let c, i, n; - if (visitor(this)) return 1; - for(c = children(this), i = 0, n = c.length; i < n; ++i){ - if (c[i].visit(visitor)) return 1; - } -}; -function children(node) { - switch(node.type){ - case ArrayExpression: - return node.elements; - case BinaryExpression: - case LogicalExpression: - return [ - node.left, - node.right - ]; - case CallExpression: - return [ - node.callee - ].concat(node.arguments); - case ConditionalExpression: - return [ - node.test, - node.consequent, - node.alternate - ]; - case MemberExpression: - return [ - node.object, - node.property - ]; - case ObjectExpression: - return node.properties; - case Property: - return [ - node.key, - node.value - ]; - case UnaryExpression: - return [ - node.argument - ]; - case Identifier: - case Literal: - case RawCode: - default: - return []; - } -} -/* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - - Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com> - Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> - Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com> - Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> - Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> - Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ var TokenName, source, index, length, lookahead; -var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; -TokenName = {}; -TokenName[TokenBooleanLiteral] = 'Boolean'; -TokenName[TokenEOF] = '<end>'; -TokenName[TokenIdentifier] = 'Identifier'; -TokenName[TokenKeyword] = 'Keyword'; -TokenName[TokenNullLiteral] = 'Null'; -TokenName[TokenNumericLiteral] = 'Numeric'; -TokenName[TokenPunctuator] = 'Punctuator'; -TokenName[TokenStringLiteral] = 'String'; -TokenName[TokenRegularExpression] = 'RegularExpression'; -var SyntaxArrayExpression = 'ArrayExpression', SyntaxBinaryExpression = 'BinaryExpression', SyntaxCallExpression = 'CallExpression', SyntaxConditionalExpression = 'ConditionalExpression', SyntaxIdentifier = 'Identifier', SyntaxLiteral = 'Literal', SyntaxLogicalExpression = 'LogicalExpression', SyntaxMemberExpression = 'MemberExpression', SyntaxObjectExpression = 'ObjectExpression', SyntaxProperty = 'Property', SyntaxUnaryExpression = 'UnaryExpression'; -// Error messages should be identical to V8. -var MessageUnexpectedToken = 'Unexpected token %0', MessageUnexpectedNumber = 'Unexpected number', MessageUnexpectedString = 'Unexpected string', MessageUnexpectedIdentifier = 'Unexpected identifier', MessageUnexpectedReserved = 'Unexpected reserved word', MessageUnexpectedEOS = 'Unexpected end of input', MessageInvalidRegExp = 'Invalid regular expression', MessageUnterminatedRegExp = 'Invalid regular expression: missing /', MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; -var ILLEGAL = 'ILLEGAL', DISABLED = 'Disabled.'; -// See also tools/generate-unicode-regex.py. -var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), // eslint-disable-next-line no-misleading-character-class -RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); -// Ensure the condition is true, otherwise throw an error. -// This is only to have a better contract semantic, i.e. another safety net -// to catch a logic error. The condition shall be fulfilled in normal case. -// Do NOT use this to enforce a certain condition on any user input. -function assert(condition, message) { - /* istanbul ignore next */ if (!condition) throw new Error('ASSERT: ' + message); -} -function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 -} -function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.includes(ch); -} -function isOctalDigit(ch) { - return '01234567'.includes(ch); -} -// 7.2 White Space -function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [ - 0x1680, - 0x180E, - 0x2000, - 0x2001, - 0x2002, - 0x2003, - 0x2004, - 0x2005, - 0x2006, - 0x2007, - 0x2008, - 0x2009, - 0x200A, - 0x202F, - 0x205F, - 0x3000, - 0xFEFF - ].includes(ch); -} -// 7.3 Line Terminators -function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; -} -// 7.6 Identifier Names and Identifiers -function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); -} -function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); -} -// 7.6.1.1 Keywords -const keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 -}; -function skipComment() { - while(index < length){ - const ch = source.charCodeAt(index); - if (isWhiteSpace(ch) || isLineTerminator(ch)) ++index; - else break; - } -} -function scanHexEscape(prefix) { - var i, len, ch, code = 0; - len = prefix === 'u' ? 4 : 2; - for(i = 0; i < len; ++i)if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else throwError({}, MessageUnexpectedToken, ILLEGAL); - return String.fromCharCode(code); -} -function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source[index]; - code = 0; - // At least, one hex digit is required. - if (ch === '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - while(index < length){ - ch = source[index++]; - if (!isHexDigit(ch)) break; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - if (code > 0x10FFFF || ch !== '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - // UTF-16 Encoding - if (code <= 0xFFFF) return String.fromCharCode(code); - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); -} -function getEscapedIdentifier() { - var ch, id; - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id = ch; + view.add(null, function(_) { + let user = _.cursor, item = this.value; + if (!isString(user)) { + item = user.item; + user = user.user; + } + setCursor(view, user && user !== Default ? user : item || user); + return item; + }, { + cursor: cursor2 + }); + } + function setCursor(view, cursor2) { + const el = view.globalCursor() ? typeof document !== "undefined" && document.body : view.container(); + if (el) { + return cursor2 == null ? el.style.removeProperty("cursor") : el.style.cursor = cursor2; } - while(index < length){ - ch = source.charCodeAt(index); - if (!isIdentifierPart(ch)) break; - ++index; - id += String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id += ch; - } + } + function dataref(view, name) { + var data2 = view._runtime.data; + if (!has$1(data2, name)) { + error("Unrecognized data set: " + name); } - return id; -} -function getIdentifier() { - var start, ch; - start = index++; - while(index < length){ - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); + return data2[name]; + } + function data(name, values2) { + return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values2)); + } + function change(name, changes) { + if (!isChangeSet(changes)) { + error("Second argument to changes must be a changeset."); + } + const dataset = dataref(this, name); + dataset.modified = true; + return this.pulse(dataset.input, changes); + } + function insert(name, _) { + return change.call(this, name, changeset().insert(_)); + } + function remove(name, _) { + return change.call(this, name, changeset().remove(_)); + } + function width(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewWidth + padding2.left + padding2.right); + } + function height(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewHeight + padding2.top + padding2.bottom); + } + function offset(view) { + var padding2 = view.padding(), origin = view._origin; + return [padding2.left + origin[0], padding2.top + origin[1]]; + } + function resizeRenderer(view) { + var origin = offset(view), w2 = width(view), h2 = height(view); + view._renderer.background(view.background()); + view._renderer.resize(w2, h2, origin); + view._handler.origin(origin); + view._resizeListeners.forEach((handler) => { + try { + handler(w2, h2); + } catch (error2) { + view.error(error2); + } + }); + } + function eventExtend(view, event2, item) { + var r = view._renderer, el = r && r.canvas(), p, e, translate2; + if (el) { + translate2 = offset(view); + e = event2.changedTouches ? event2.changedTouches[0] : event2; + p = point(e, el); + p[0] -= translate2[0]; + p[1] -= translate2[1]; + } + event2.dataflow = view; + event2.item = item; + event2.vega = extension(view, item, p); + return event2; + } + function extension(view, item, point2) { + const itemGroup = item ? item.mark.marktype === "group" ? item : item.mark.group : null; + function group2(name) { + var g = itemGroup, i; + if (name) for (i = item; i; i = i.mark.group) { + if (i.mark.name === name) { + g = i; + break; } - if (isIdentifierPart(ch)) ++index; - else break; + } + return g && g.mark && g.mark.interactive ? g : {}; + } + function xy(item2) { + if (!item2) return point2; + if (isString(item2)) item2 = group2(item2); + const p = point2.slice(); + while (item2) { + p[0] -= item2.x || 0; + p[1] -= item2.y || 0; + item2 = item2.mark && item2.mark.group; + } + return p; } - return source.slice(start, index); -} -function scanIdentifier() { - var start, id, type; - start = index; - // Backslash (U+005C) starts an escaped character. - id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) type = TokenIdentifier; - else if (keywords.hasOwnProperty(id)) // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - else if (id === 'null') type = TokenNullLiteral; - else if (id === 'true' || id === 'false') type = TokenBooleanLiteral; - else type = TokenIdentifier; return { - type: type, - value: id, - start: start, - end: index + view: constant$4(view), + item: constant$4(item || {}), + group: group2, + xy, + x: (item2) => xy(item2)[0], + y: (item2) => xy(item2)[1] }; -} -// 7.7 Punctuators -function scanPunctuator() { - var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; - switch(code){ - // Check for most common single-character punctuators. - case 0x2E: - case 0x28: - case 0x29: - case 0x3B: - case 0x2C: - case 0x7B: - case 0x7D: - case 0x5B: - case 0x5D: - case 0x3A: - case 0x3F: - case 0x7E: - // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - default: - code2 = source.charCodeAt(index + 1); - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) switch(code){ - case 0x2B: - case 0x2D: - case 0x2F: - case 0x3C: - case 0x3E: - case 0x5E: - case 0x7C: - case 0x25: - case 0x26: - case 0x2A: - // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - case 0x21: - case 0x3D: - // = - index += 2; - // !== and === - if (source.charCodeAt(index) === 0x3D) ++index; - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - // 4-character punctuator: >>>= - ch4 = source.substr(index, 4); - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - // 3-character punctuators: === !== >>> <<= >>= - ch3 = ch4.substr(0, 3); - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - if (ch1 === ch2[1] && '+-<>&|'.includes(ch1) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - if (ch2 === '//') throwError({}, MessageUnexpectedToken, ILLEGAL); - // 1-character punctuators: < > = ! + - * % & | ^ / - if ('<>=!+-*%&|^/'.includes(ch1)) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - throwError({}, MessageUnexpectedToken, ILLEGAL); -} -// 7.8.3 Numeric Literals -function scanHexLiteral(start) { - let number = ''; - while(index < length){ - if (!isHexDigit(source[index])) break; - number += source[index++]; - } - if (number.length === 0) throwError({}, MessageUnexpectedToken, ILLEGAL); - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index + } + const VIEW$1 = "view", TIMER = "timer", WINDOW = "window", NO_TRAP = { + trap: false + }; + function initializeEventConfig(config) { + const events2 = extend({ + defaults: {} + }, config); + const unpack = (obj2, keys2) => { + keys2.forEach((k) => { + if (isArray(obj2[k])) obj2[k] = toSet(obj2[k]); + }); }; -} -function scanOctalLiteral(start) { - let number = '0' + source[index++]; - while(index < length){ - if (!isOctalDigit(source[index])) break; - number += source[index++]; + unpack(events2.defaults, ["prevent", "allow"]); + unpack(events2, ["view", "window", "selector"]); + return events2; + } + function trackEventListener(view, sources, type2, handler) { + view._eventListeners.push({ + type: type2, + sources: array$4(sources), + handler + }); + } + function prevent(view, type2) { + var def2 = view._eventConfig.defaults, prevent2 = def2.prevent, allow = def2.allow; + return prevent2 === false || allow === true ? false : prevent2 === true || allow === false ? true : prevent2 ? prevent2[type2] : allow ? !allow[type2] : view.preventDefault(); + } + function permit(view, key2, type2) { + const rule2 = view._eventConfig && view._eventConfig[key2]; + if (rule2 === false || isObject(rule2) && !rule2[type2]) { + view.warn(`Blocked ${key2} ${type2} event listener.`); + return false; } - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; -} -function scanNumericLiteral() { - var number, start, ch; - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) return scanOctalLiteral(start); - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - } - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === '.') { - number += source[index++]; - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === 'e' || ch === 'E') { - number += source[index++]; - ch = source[index]; - if (ch === '+' || ch === '-') number += source[index++]; - if (isDecimalDigit(source.charCodeAt(index))) while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - else throwError({}, MessageUnexpectedToken, ILLEGAL); - } - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; -} -// 7.8.4 String Literals -function scanStringLiteral() { - var str = '', quote, start, ch, code, octal = false; - quote = source[index]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index; - ++index; - while(index < length){ - ch = source[index++]; - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) switch(ch){ - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else str += scanHexEscape(ch); - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - // \0 is not octal escape sequence - if (code !== 0) octal = true; - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.includes(ch) && index < length && isOctalDigit(source[index])) code = code * 8 + '01234567'.indexOf(source[index++]); - } - str += String.fromCharCode(code); - } else str += ch; - break; - } - else if (ch === '\r' && source[index] === '\n') ++index; - } else if (isLineTerminator(ch.charCodeAt(0))) break; - else str += ch; + return true; + } + function events(source2, type2, filter2) { + var view = this, s2 = new EventStream(filter2), send = function(e, item) { + view.runAsync(null, () => { + if (source2 === VIEW$1 && prevent(view, type2)) { + e.preventDefault(); + } + s2.receive(eventExtend(view, e, item)); + }); + }, sources; + if (source2 === TIMER) { + if (permit(view, "timer", type2)) { + view.timer(send, type2); + } + } else if (source2 === VIEW$1) { + if (permit(view, "view", type2)) { + view.addEventListener(type2, send, NO_TRAP); + } + } else { + if (source2 === WINDOW) { + if (permit(view, "window", type2) && typeof window !== "undefined") { + sources = [window]; + } + } else if (typeof document !== "undefined") { + if (permit(view, "selector", type2)) { + sources = Array.from(document.querySelectorAll(source2)); + } + } + if (!sources) { + view.warn("Can not resolve event source: " + source2); + } else { + for (var i = 0, n = sources.length; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + trackEventListener(view, sources, type2, send); + } } - if (quote !== '') throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index + return s2; + } + function itemFilter(event2) { + return event2.item; + } + function markTarget(event2) { + return event2.item.mark.source; + } + function invoke(name) { + return function(_, event2) { + return event2.vega.view().changeset().encode(event2.item, name); }; -} -function testRegExp(pattern, flags) { - let tmp = pattern; - if (flags.includes('u')) // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1)=>{ - if (parseInt($1, 16) <= 0x10FFFF) return 'x'; - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); + } + function hover(hoverSet, leaveSet) { + hoverSet = [hoverSet || "hover"]; + leaveSet = [leaveSet || "update", hoverSet[0]]; + this.on(this.events("view", "pointerover", itemFilter), markTarget, invoke(hoverSet)); + this.on(this.events("view", "pointerout", itemFilter), markTarget, invoke(leaveSet)); + return this; + } + function finalize() { + var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m2, e, h2, t; + n = timers.length; + while (--n >= 0) { + timers[n].stop(); } - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; + n = listeners.length; + while (--n >= 0) { + e = listeners[n]; + m2 = e.sources.length; + while (--m2 >= 0) { + e.sources[m2].removeEventListener(e.type, e.handler); + } } -} -function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - classMarker = false; - terminated = false; - while(index < length){ - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - else if (classMarker) { - if (ch === ']') classMarker = false; - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') classMarker = true; - } + if (tooltip) { + tooltip.call(this, this._handler, null, null, null); } - if (!terminated) throwError({}, MessageUnterminatedRegExp); - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; -} -function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - while(index < length){ - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) break; - ++index; - if (ch === '\\' && index < length) throwError({}, MessageUnexpectedToken, ILLEGAL); - else { - flags += ch; - str += ch; + n = handlers.length; + while (--n >= 0) { + t = handlers[n].type; + h2 = handlers[n].handler; + this._handler.off(t, h2); + } + return this; + } + function element(tag, attr2, text2) { + const el = document.createElement(tag); + for (const key2 in attr2) el.setAttribute(key2, attr2[key2]); + if (text2 != null) el.textContent = text2; + return el; + } + const BindClass = "vega-bind", NameClass = "vega-bind-name", RadioClass = "vega-bind-radio"; + function bind(view, el, binding) { + if (!el) return; + const param2 = binding.param; + let bind2 = binding.state; + if (!bind2) { + bind2 = binding.state = { + elements: null, + active: false, + set: null, + update: (value2) => { + if (value2 != view.signal(param2.signal)) { + view.runAsync(null, () => { + bind2.source = true; + view.signal(param2.signal, value2); + }); + } } + }; + if (param2.debounce) { + bind2.update = debounce(param2.debounce, bind2.update); + } } - if (flags.search(/[^gimuy]/g) >= 0) throwError({}, MessageInvalidRegExp, flags); - return { - value: flags, - literal: str - }; -} -function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index + const create2 = param2.input == null && param2.element ? target : generate; + create2(bind2, el, param2, view); + if (!bind2.active) { + view.on(view._signals[param2.signal], null, () => { + bind2.source ? bind2.source = false : bind2.set(view.signal(param2.signal)); + }); + bind2.active = true; + } + return bind2; + } + function target(bind2, node, param2, view) { + const type2 = param2.event || "input"; + const handler = () => bind2.update(node.value); + view.signal(param2.signal, node.value); + node.addEventListener(type2, handler); + trackEventListener(view, node, type2, handler); + bind2.set = (value2) => { + node.value = value2; + node.dispatchEvent(event(type2)); }; -} -function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; -} -function advance() { - skipComment(); - if (index >= length) return { - type: TokenEOF, - start: index, - end: index + } + function event(type2) { + return typeof Event !== "undefined" ? new Event(type2) : { + type: type2 }; - const ch = source.charCodeAt(index); - if (isIdentifierStart(ch)) return scanIdentifier(); - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) return scanPunctuator(); - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) return scanStringLiteral(); - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) return scanNumericLiteral(); - return scanPunctuator(); - } - if (isDecimalDigit(ch)) return scanNumericLiteral(); - return scanPunctuator(); -} -function lex() { - const token = lookahead; - index = token.end; - lookahead = advance(); - index = token.end; - return token; -} -function peek() { - const pos = index; - lookahead = advance(); - index = pos; -} -function finishArrayExpression(elements) { - const node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; -} -function finishBinaryExpression(operator, left, right) { - const node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; -} -function finishCallExpression(callee, args) { - const node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; -} -function finishConditionalExpression(test, consequent, alternate) { - const node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; -} -function finishIdentifier(name) { - const node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; -} -function finishLiteral(token) { - const node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') node.raw = '/(?:)/'; - node.regex = token.regex; - } - return node; -} -function finishMemberExpression(accessor, object, property) { - const node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; -} -function finishObjectExpression(properties) { - const node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; -} -function finishProperty(kind, key, value) { - const node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; -} -function finishUnaryExpression(operator, argument) { - const node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; -} -// Throw an exception -function throwError(token, messageFormat) { - var error, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index)=>{ - assert(index < args.length, 'Message reference must be in range'); - return args[index]; + } + function generate(bind2, el, param2, view) { + const value2 = view.signal(param2.signal); + const div = element("div", { + "class": BindClass }); - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; -} -// Throw an exception because of the token. -function throwUnexpected(token) { - if (token.type === TokenEOF) throwError(token, MessageUnexpectedEOS); - if (token.type === TokenNumericLiteral) throwError(token, MessageUnexpectedNumber); - if (token.type === TokenStringLiteral) throwError(token, MessageUnexpectedString); - if (token.type === TokenIdentifier) throwError(token, MessageUnexpectedIdentifier); - if (token.type === TokenKeyword) throwError(token, MessageUnexpectedReserved); - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); -} -// Expect the next token to match the specified punctuator. -// If not, an exception will be thrown. -function expect(value) { - const token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) throwUnexpected(token); -} -// Return true if the next token matches the specified punctuator. -function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; -} -// Return true if the next token matches the specified keyword -function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; -} -// 11.1.4 Array Initialiser -function parseArrayInitialiser() { - const elements = []; - index = lookahead.start; - expect('['); - while(!match(']'))if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - if (!match(']')) expect(','); + const wrapper = param2.input === "radio" ? div : div.appendChild(element("label")); + wrapper.appendChild(element("span", { + "class": NameClass + }, param2.name || param2.signal)); + el.appendChild(div); + let input = form; + switch (param2.input) { + case "checkbox": + input = checkbox; + break; + case "select": + input = select; + break; + case "radio": + input = radio; + break; + case "range": + input = range; + break; } - lex(); - return finishArrayExpression(elements); -} -// 11.1.5 Object Initialiser -function parseObjectPropertyKey() { - index = lookahead.start; - const token = lex(); - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) throwError(token, MessageStrictOctalLiteral); - return finishLiteral(token); + input(bind2, wrapper, param2, value2); + } + function form(bind2, el, param2, value2) { + const node = element("input"); + for (const key2 in param2) { + if (key2 !== "signal" && key2 !== "element") { + node.setAttribute(key2 === "input" ? "type" : key2, param2[key2]); + } } - return finishIdentifier(token.value); -} -function parseObjectProperty() { - var token, key, id, value; - index = lookahead.start; - token = lookahead; - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); + node.setAttribute("name", param2.signal); + node.value = value2; + el.appendChild(node); + node.addEventListener("input", () => bind2.update(node.value)); + bind2.elements = [node]; + bind2.set = (value3) => node.value = value3; + } + function checkbox(bind2, el, param2, value2) { + const attr2 = { + type: "checkbox", + name: param2.signal + }; + if (value2) attr2.checked = true; + const node = element("input", attr2); + el.appendChild(node); + node.addEventListener("change", () => bind2.update(node.checked)); + bind2.elements = [node]; + bind2.set = (value3) => node.checked = !!value3 || null; + } + function select(bind2, el, param2, value2) { + const node = element("select", { + name: param2.signal + }), labels = param2.labels || []; + param2.options.forEach((option, i) => { + const attr2 = { + value: option + }; + if (valuesEqual(option, value2)) attr2.selected = true; + node.appendChild(element("option", attr2, (labels[i] || option) + "")); + }); + el.appendChild(node); + node.addEventListener("change", () => { + bind2.update(param2.options[node.selectedIndex]); + }); + bind2.elements = [node]; + bind2.set = (value3) => { + for (let i = 0, n = param2.options.length; i < n; ++i) { + if (valuesEqual(param2.options[i], value3)) { + node.selectedIndex = i; + return; + } + } + }; + } + function radio(bind2, el, param2, value2) { + const group2 = element("span", { + "class": RadioClass + }), labels = param2.labels || []; + el.appendChild(group2); + bind2.elements = param2.options.map((option, i) => { + const attr2 = { + type: "radio", + name: param2.signal, + value: option + }; + if (valuesEqual(option, value2)) attr2.checked = true; + const input = element("input", attr2); + input.addEventListener("change", () => bind2.update(option)); + const label2 = element("label", {}, (labels[i] || option) + ""); + label2.prepend(input); + group2.appendChild(label2); + return input; + }); + bind2.set = (value3) => { + const nodes = bind2.elements, n = nodes.length; + for (let i = 0; i < n; ++i) { + if (valuesEqual(nodes[i].value, value3)) nodes[i].checked = true; + } + }; + } + function range(bind2, el, param2, value2) { + value2 = value2 !== void 0 ? value2 : (+param2.max + +param2.min) / 2; + const max2 = param2.max != null ? param2.max : Math.max(100, +value2) || 100, min2 = param2.min || Math.min(0, max2, +value2) || 0, step = param2.step || tickStep(min2, max2, 100); + const node = element("input", { + type: "range", + name: param2.signal, + min: min2, + max: max2, + step + }); + node.value = value2; + const span2 = element("span", {}, +value2); + el.appendChild(node); + el.appendChild(span2); + const update2 = () => { + span2.textContent = node.value; + bind2.update(+node.value); + }; + node.addEventListener("input", update2); + node.addEventListener("change", update2); + bind2.elements = [node]; + bind2.set = (value3) => { + node.value = value3; + span2.textContent = value3; + }; + } + function valuesEqual(a2, b2) { + return a2 === b2 || a2 + "" === b2 + ""; + } + function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { + r = r || new constructor(view.loader()); + return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); + } + function trap(view, fn2) { + return !fn2 ? null : function() { + try { + fn2.apply(this, arguments); + } catch (error2) { + view.error(error2); + } + }; + } + function initializeHandler(view, prevHandler, el, constructor) { + const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); + if (prevHandler) { + prevHandler.handlers().forEach((h2) => { + handler.on(h2.type, h2.handler); + }); } - if (token.type === TokenEOF || token.type === TokenPunctuator) throwUnexpected(token); - else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } -} -function parseObjectInitialiser() { - var properties = [], property, name, key, map = {}, toString = String; - index = lookahead.start; - expect('{'); - while(!match('}')){ - property = parseObjectProperty(); - if (property.key.type === SyntaxIdentifier) name = property.key.name; - else name = toString(property.key.value); - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) throwError({}, MessageStrictDuplicateProperty); - else map[key] = true; - properties.push(property); - if (!match('}')) expect(','); - } - expect('}'); - return finishObjectExpression(properties); -} -// 11.1.6 The Grouping Operator -function parseGroupExpression() { - expect('('); - const expr = parseExpression(); - expect(')'); - return expr; -} -// 11.1 Primary Expressions -const legalKeywords = { - 'if': 1 -}; -function parsePrimaryExpression() { - var type, token, expr; - if (match('(')) return parseGroupExpression(); - if (match('[')) return parseArrayInitialiser(); - if (match('{')) return parseObjectInitialiser(); - type = lookahead.type; - index = lookahead.start; - if (type === TokenIdentifier || legalKeywords[lookahead.value]) expr = finishIdentifier(lex().value); - else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) throwError(lookahead, MessageStrictOctalLiteral); - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) throw new Error(DISABLED); - else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else throwUnexpected(lex()); - return expr; -} -// 11.2 Left-Hand-Side Expressions -function parseArguments() { - const args = []; - expect('('); - if (!match(')')) while(index < length){ - args.push(parseConditionalExpression()); - if (match(')')) break; - expect(','); + return handler; + } + function initialize(el, elBind) { + const view = this, type2 = view._renderType, config = view._eventConfig.bind, module2 = renderModule(type2); + el = view._el = el ? lookup$1(view, el, true) : null; + initializeAria(view); + if (!module2) view.error("Unrecognized renderer type: " + type2); + const Handler2 = module2.handler || CanvasHandler, Renderer2 = el ? module2.renderer : module2.headless; + view._renderer = !Renderer2 ? null : initializeRenderer(view, view._renderer, el, Renderer2); + view._handler = initializeHandler(view, view._handler, el, Handler2); + view._redraw = true; + if (el && config !== "none") { + elBind = elBind ? view._elBind = lookup$1(view, elBind, true) : el.appendChild(element("form", { + "class": "vega-bindings" + })); + view._bind.forEach((_) => { + if (_.param.element && config !== "container") { + _.element = lookup$1(view, _.param.element, !!_.param.input); + } + }); + view._bind.forEach((_) => { + bind(view, _.element || elBind, _); + }); } - expect(')'); - return args; -} -function parseNonComputedProperty() { - index = lookahead.start; - const token = lex(); - if (!isIdentifierName(token)) throwUnexpected(token); - return finishIdentifier(token.value); -} -function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); -} -function parseComputedMember() { - expect('['); - const expr = parseExpression(); - expect(']'); - return expr; -} -function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - for(;;){ - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else break; - } - return expr; -} -// 11.3 Postfix Expressions -function parsePostfixExpression() { - const expr = parseLeftHandSideExpressionAllowCall(); - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) throw new Error(DISABLED); - } - return expr; -} -// 11.4 Unary Operators -function parseUnaryExpression() { - var token, expr; - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) expr = parsePostfixExpression(); - else if (match('++') || match('--')) throw new Error(DISABLED); - else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) throw new Error(DISABLED); - else expr = parsePostfixExpression(); - return expr; -} -function binaryPrecedence(token) { - let prec = 0; - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) return 0; - switch(token.value){ - case '||': - prec = 1; - break; - case '&&': - prec = 2; - break; - case '|': - prec = 3; - break; - case '^': - prec = 4; - break; - case '&': - prec = 5; - break; - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - case '+': - case '-': - prec = 9; - break; - case '*': - case '/': - case '%': - prec = 11; - break; + return view; + } + function lookup$1(view, el, clear) { + if (typeof el === "string") { + if (typeof document !== "undefined") { + el = document.querySelector(el); + if (!el) { + view.error("Signal bind element not found: " + el); + return null; + } + } else { + view.error("DOM document instance not found."); + return null; + } } - return prec; -} -// 11.5 Multiplicative Operators -// 11.6 Additive Operators -// 11.7 Bitwise Shift Operators -// 11.8 Relational Operators -// 11.9 Equality Operators -// 11.10 Binary Bitwise Operators -// 11.11 Binary Logical Operators -function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) return left; - token.prec = prec; - lex(); - markers = [ - marker, - lookahead - ]; - right = parseUnaryExpression(); - stack = [ - left, - token, - right - ]; - while((prec = binaryPrecedence(lookahead)) > 0){ - // Reduce: make a binary expression from the three topmost entries. - while(stack.length > 2 && prec <= stack[stack.length - 2].prec){ - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while(i > 1){ - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - return expr; -} -// 11.12 Conditional Operator -function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - return expr; -} -// 11.14 Comma Operator -function parseExpression() { - const expr = parseConditionalExpression(); - if (match(',')) throw new Error(DISABLED); // no sequence expressions - return expr; -} -function parser(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - peek(); - const expr = parseExpression(); - if (lookahead.type !== TokenEOF) throw new Error('Unexpect token after expression.'); - return expr; -} -var Constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' -}; -function Functions(codegen) { - function fncall(name, args, cast, type) { - let obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')'); - } - function fn(name, cast, type) { - return (args)=>fncall(name, args, cast, type); - } - const DATE = 'new Date', STRING = 'String', REGEXP = 'RegExp'; - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - hypot: 'Math.hypot', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - clamp: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to clamp function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to clamp function.'); - const a = args.map(codegen); - return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))'; - }, - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - // sequence functions - length: fn('length', null, -1), - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - trim: fn('trim', STRING, 0), - // base64 encode/decode - btoa: 'btoa', - atob: 'atob', - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - // Control Flow functions - if: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to if function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to if function.'); - const a = args.map(codegen); - return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')'; - } - }; -} -function stripQuotes(s) { - const n = s && s.length - 1; - return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s; -} -function codegen(opt) { - opt = opt || {}; - const allowed = opt.allowed ? (0, _vegaUtil.toSet)(opt.allowed) : {}, forbidden = opt.forbidden ? (0, _vegaUtil.toSet)(opt.forbidden) : {}, constants = opt.constants || Constants, functions = (opt.functions || Functions)(visit), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = (0, _vegaUtil.isFunction)(globalvar) ? globalvar : (id)=>`${globalvar}["${id}"]`; - let globals = {}, fields = {}, memberDepth = 0; - function visit(ast) { - if ((0, _vegaUtil.isString)(ast)) return ast; - const generator = Generators[ast.type]; - if (generator == null) (0, _vegaUtil.error)('Unsupported type: ' + ast.type); - return generator(ast); + if (el && clear) { + try { + el.textContent = ""; + } catch (e) { + el = null; + view.error(e); + } } - const Generators = { - Literal: (n)=>n.raw, - Identifier: (n)=>{ - const id = n.name; - if (memberDepth > 0) return id; - else if ((0, _vegaUtil.hasOwnProperty)(forbidden, id)) return (0, _vegaUtil.error)('Illegal identifier: ' + id); - else if ((0, _vegaUtil.hasOwnProperty)(constants, id)) return constants[id]; - else if ((0, _vegaUtil.hasOwnProperty)(allowed, id)) return id; - else { - globals[id] = 1; - return outputGlobal(id); - } - }, - MemberExpression: (n)=>{ - const d = !n.computed, o = visit(n.object); - if (d) memberDepth += 1; - const p = visit(n.property); - if (o === fieldvar) // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - if (d) memberDepth -= 1; - return o + (d ? '.' + p : '[' + p + ']'); - }, - CallExpression: (n)=>{ - if (n.callee.type !== 'Identifier') (0, _vegaUtil.error)('Illegal callee type: ' + n.callee.type); - const callee = n.callee.name, args = n.arguments, fn = (0, _vegaUtil.hasOwnProperty)(functions, callee) && functions[callee]; - if (!fn) (0, _vegaUtil.error)('Unrecognized function: ' + callee); - return (0, _vegaUtil.isFunction)(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')'; - }, - ArrayExpression: (n)=>'[' + n.elements.map(visit).join(',') + ']', - BinaryExpression: (n)=>'(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')', - UnaryExpression: (n)=>'(' + n.operator + visit(n.argument) + ')', - ConditionalExpression: (n)=>'(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')', - LogicalExpression: (n)=>'(' + visit(n.left) + n.operator + visit(n.right) + ')', - ObjectExpression: (n)=>'{' + n.properties.map(visit).join(',') + '}', - Property: (n)=>{ - memberDepth += 1; - const k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - function codegen(ast) { - const result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; + return el; + } + const number$1 = (_) => +_ || 0; + const paddingObject$1 = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function padding(_) { + return isObject(_) ? { + top: number$1(_.top), + bottom: number$1(_.bottom), + left: number$1(_.left), + right: number$1(_.right) + } : paddingObject$1(number$1(_)); + } + async function renderHeadless(view, type2, scaleFactor, opt) { + const module2 = renderModule(type2), ctr = module2 && module2.headless; + if (!ctr) error("Unrecognized renderer type: " + type2); + await view.runAsync(); + return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); + } + async function renderToImageURL(type2, scaleFactor) { + if (type2 !== RenderType.Canvas && type2 !== RenderType.SVG && type2 !== RenderType.PNG) { + error("Unrecognized image type: " + type2); } - codegen.functions = functions; - codegen.constants = constants; - return codegen; -} - -},{"vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"inIVI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "selectionIdTest", ()=>selectionIdTest); -parcelHelpers.export(exports, "selectionResolve", ()=>selectionResolve); -parcelHelpers.export(exports, "selectionTest", ()=>selectionTest); -parcelHelpers.export(exports, "selectionTuples", ()=>selectionTuples); -parcelHelpers.export(exports, "selectionVisitor", ()=>selectionVisitor); -var _d3Array = require("d3-array"); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -// Registers vega-util field accessors to protect against XSS attacks -const SELECTION_GETTER = Symbol('vega_selection_getter'); -function getter(f) { - if (!f.getter || !f.getter[SELECTION_GETTER]) { - f.getter = (0, _vegaUtil.field)(f.field); - f.getter[SELECTION_GETTER] = true; + const r = await renderHeadless(this, type2, scaleFactor); + return type2 === RenderType.SVG ? toBlobURL(r.svg(), "image/svg+xml") : r.canvas().toDataURL("image/png"); + } + function toBlobURL(data2, mime) { + const blob = new Blob([data2], { + type: mime + }); + return window.URL.createObjectURL(blob); + } + async function renderToCanvas(scaleFactor, opt) { + const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); + return r.canvas(); + } + async function renderToSVG(scaleFactor) { + const r = await renderHeadless(this, RenderType.SVG, scaleFactor); + return r.svg(); + } + function runtime(view, spec, expr2) { + return context(view, transforms, functionContext, expr2).parse(spec); + } + function scale$1(name) { + var scales2 = this._runtime.scales; + if (!has$1(scales2, name)) { + error("Unrecognized scale or projection: " + name); + } + return scales2[name].value; + } + var Width = "width", Height = "height", Padding = "padding", Skip$1 = { + skip: true + }; + function viewWidth(view, width2) { + var a2 = view.autosize(), p = view.padding(); + return width2 - (a2 && a2.contains === Padding ? p.left + p.right : 0); + } + function viewHeight(view, height2) { + var a2 = view.autosize(), p = view.padding(); + return height2 - (a2 && a2.contains === Padding ? p.top + p.bottom : 0); + } + function initializeResize(view) { + var s2 = view._signals, w2 = s2[Width], h2 = s2[Height], p = s2[Padding]; + function resetSize() { + view._autosize = view._resize = 1; } - return f.getter; -} -const Intersect = 'intersect'; -const Union = 'union'; -const VlMulti = 'vlMulti'; -const VlPoint = 'vlPoint'; -const Or = 'or'; -const And = 'and'; -const SelectionId = '_vgsid_'; -const $selectionId = (0, _vegaUtil.field)(SelectionId); -const TYPE_ENUM = 'E', TYPE_RANGE_INC = 'R', TYPE_RANGE_EXC = 'R-E', TYPE_RANGE_LE = 'R-LE', TYPE_RANGE_RE = 'R-RE', TYPE_PRED_LT = 'E-LT', TYPE_PRED_LTE = 'E-LTE', TYPE_PRED_GT = 'E-GT', TYPE_PRED_GTE = 'E-GTE', TYPE_PRED_VALID = 'E-VALID', TYPE_PRED_ONE_OF = 'E-ONE', UNIT_INDEX = 'index:unit'; -// TODO: revisit date coercion? -function testPoint(datum, entry) { - var fields = entry.fields, values = entry.values, n = fields.length, i = 0, dval, f; - for(; i < n; ++i){ - f = fields[i]; - dval = getter(f)(datum); - if ((0, _vegaUtil.isDate)(dval)) dval = (0, _vegaUtil.toNumber)(dval); - if ((0, _vegaUtil.isDate)(values[i])) values[i] = (0, _vegaUtil.toNumber)(values[i]); - if ((0, _vegaUtil.isArray)(values[i]) && (0, _vegaUtil.isDate)(values[i][0])) values[i] = values[i].map((0, _vegaUtil.toNumber)); - if (f.type === TYPE_ENUM) { - // Enumerated fields can either specify individual values (single/multi selections) - // or an array of values (interval selections). - if ((0, _vegaUtil.isArray)(values[i]) ? !values[i].includes(dval) : dval !== values[i]) return false; - } else { - if (f.type === TYPE_RANGE_INC) { - if (!(0, _vegaUtil.inrange)(dval, values[i])) return false; - } else if (f.type === TYPE_RANGE_RE) { - // Discrete selection of bins test within the range [bin_start, bin_end). - if (!(0, _vegaUtil.inrange)(dval, values[i], true, false)) return false; - } else if (f.type === TYPE_RANGE_EXC) { - // 'R-E'/'R-LE' included for completeness. - if (!(0, _vegaUtil.inrange)(dval, values[i], false, false)) return false; - } else if (f.type === TYPE_RANGE_LE) { - if (!(0, _vegaUtil.inrange)(dval, values[i], false, true)) return false; - } else if (f.type === TYPE_PRED_LT) { - if (dval >= values[i]) return false; - } else if (f.type === TYPE_PRED_LTE) { - if (dval > values[i]) return false; - } else if (f.type === TYPE_PRED_GT) { - if (dval <= values[i]) return false; - } else if (f.type === TYPE_PRED_GTE) { - if (dval < values[i]) return false; - } else if (f.type === TYPE_PRED_VALID) { - if (dval === null || isNaN(dval)) return false; - } else if (f.type === TYPE_PRED_ONE_OF) { - if (values[i].indexOf(dval) === -1) return false; - } - } + view._resizeWidth = view.add(null, (_) => { + view._width = _.size; + view._viewWidth = viewWidth(view, _.size); + resetSize(); + }, { + size: w2 + }); + view._resizeHeight = view.add(null, (_) => { + view._height = _.size; + view._viewHeight = viewHeight(view, _.size); + resetSize(); + }, { + size: h2 + }); + const resizePadding = view.add(null, resetSize, { + pad: p + }); + view._resizeWidth.rank = w2.rank + 1; + view._resizeHeight.rank = h2.rank + 1; + resizePadding.rank = p.rank + 1; + } + function resizeView(viewWidth2, viewHeight2, width2, height2, origin, auto) { + this.runAfter((view) => { + let rerun2 = 0; + view._autosize = 0; + if (view.width() !== width2) { + rerun2 = 1; + view.signal(Width, width2, Skip$1); + view._resizeWidth.skip(true); + } + if (view.height() !== height2) { + rerun2 = 1; + view.signal(Height, height2, Skip$1); + view._resizeHeight.skip(true); + } + if (view._viewWidth !== viewWidth2) { + view._resize = 1; + view._viewWidth = viewWidth2; + } + if (view._viewHeight !== viewHeight2) { + view._resize = 1; + view._viewHeight = viewHeight2; + } + if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { + view._resize = 1; + view._origin = origin; + } + if (rerun2) view.run("enter"); + if (auto) view.runAfter((v) => v.resize()); + }, false, 1); + } + function getState(options2) { + return this._runtime.getState(options2 || { + data: dataTest, + signals: signalTest, + recurse: true + }); + } + function dataTest(name, data2) { + return data2.modified && isArray(data2.input.value) && !name.startsWith("_:vega:_"); + } + function signalTest(name, op) { + return !(name === "parent" || op instanceof transforms.proxy); + } + function setState(state) { + this.runAsync(null, (v) => { + v._trigger = false; + v._runtime.setState(state); + }, (v) => { + v._trigger = true; + }); + return this; + } + function timer(callback, delay) { + function tick(elapsed) { + callback({ + timestamp: Date.now(), + elapsed + }); } - return true; -} -/** - * Tests if a tuple is contained within an interactive selection. - * @param {string} name - The name of the data set representing the selection. - * Tuples in the dataset are of the form - * {unit: string, fields: array<fielddef>, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ function selectionTest(name, datum, op) { - var data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, n = entries.length, i = 0, entry, miss, count, unit, b; - for(; i < n; ++i){ - entry = entries[i]; - if (unitIdx && intersect) { - // multi selections union within the same unit and intersect across units. - miss = miss || {}; - count = miss[unit = entry.unit] || 0; - // if we've already matched this unit, skip. - if (count === -1) continue; - b = testPoint(datum, entry); - miss[unit] = b ? -1 : ++count; - // if we match and there are no other units return true - // if we've missed against all tuples in this unit return false - if (b && unitIdx.size === 1) return true; - if (!b && count === unitIdx.get(unit).count) return false; - } else { - b = testPoint(datum, entry); - // if we find a miss and we do require intersection return false - // if we find a match and we don't require intersection return true - if (intersect ^ b) return b; - } - } - // if intersecting and we made it here, then we saw no misses - // if not intersecting, then we saw no matches - // if no active selections, return false - return n && intersect; -} -const bisect = (0, _d3Array.bisector)($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; -function selectionIdTest(name, datum, op) { - const data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, value = $selectionId(datum), index = bisectLeft(entries, value); - if (index === entries.length) return false; - if ($selectionId(entries[index]) !== value) return false; - if (unitIdx && intersect) { - if (unitIdx.size === 1) return true; - if (bisectRight(entries, value) - index < unitIdx.size) return false; + this._timers.push(interval(tick, delay)); + } + function defaultTooltip(handler, event2, item, value2) { + const el = handler.element(); + if (el) el.setAttribute("title", formatTooltip(value2)); + } + function formatTooltip(value2) { + return value2 == null ? "" : isArray(value2) ? formatArray(value2) : isObject(value2) && !isDate$1(value2) ? formatObject(value2) : value2 + ""; + } + function formatObject(obj2) { + return Object.keys(obj2).map((key2) => { + const v = obj2[key2]; + return key2 + ": " + (isArray(v) ? formatArray(v) : formatValue(v)); + }).join("\n"); + } + function formatArray(value2) { + return "[" + value2.map(formatValue).join(", ") + "]"; + } + function formatValue(value2) { + return isArray(value2) ? "[…]" : isObject(value2) && !isDate$1(value2) ? "{…}" : value2; + } + function watchPixelRatio() { + if (this.renderer() === "canvas" && this._renderer._canvas) { + let remove2 = null; + const updatePixelRatio = () => { + if (remove2 != null) { + remove2(); + } + const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); + media.addEventListener("change", updatePixelRatio); + remove2 = () => { + media.removeEventListener("change", updatePixelRatio); + }; + this._renderer._canvas.getContext("2d").pixelRatio = window.devicePixelRatio || 1; + this._redraw = true; + this._resize = 1; + this.resize().runAsync(); + }; + updatePixelRatio(); } - return true; -} -/** - * Maps an array of scene graph items to an array of selection tuples. - * @param {string} name - The name of the dataset representing the selection. - * @param {string} base - The base object that generated tuples extend. - * - * @returns {array} An array of selection entries for the given unit. - */ function selectionTuples(array, base) { - return array.map((x)=>(0, _vegaUtil.extend)(base.fields ? { - values: base.fields.map((f)=>getter(f)(x.datum)) - } : { - [SelectionId]: $selectionId(x.datum) - }, base)); -} -/** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @param {boolean} isMulti - Identifies a "multi" selection to perform more - * expensive resolution computation. - * @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point" - * selections, and thus the resolved tuple should reflect this name. - * This parameter allows us to reflect this change without triggering - * a major version bump for Vega. - * @returns {object} An object of selected fields and values. - */ function selectionResolve(name, op, isMulti, vl5) { - var data = this.context.data[name], entries = data ? data.values.value : [], resolved = {}, multiRes = {}, types = {}, entry, fields, values, unit, field, value, res, resUnit, type, union, n = entries.length, i = 0, j, m; - // First union all entries within the same unit. - for(; i < n; ++i){ - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - if (fields && values) { - // Intentional selection stores - for(j = 0, m = fields.length; j < m; ++j){ - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[`${type}_union`]; - res[unit] = union(resUnit, (0, _vegaUtil.array)(values[j])); - } - // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push((0, _vegaUtil.array)(values).reduce((obj, curr, j)=>(obj[fields[j].field] = curr, obj), {})); - } - } else { - // Short circuit extensional selectionId stores which hold sorted IDs unique to each unit. - field = SelectionId; - value = $selectionId(entry); - res = resolved[field] || (resolved[field] = {}); - resUnit = res[unit] || (res[unit] = []); - resUnit.push(value); - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push({ - [SelectionId]: value - }); - } - } + } + function View$1(spec, options2) { + const view = this; + options2 = options2 || {}; + Dataflow.call(view); + if (options2.loader) view.loader(options2.loader); + if (options2.logger) view.logger(options2.logger); + if (options2.logLevel != null) view.logLevel(options2.logLevel); + if (options2.locale || spec.locale) { + const loc = extend({}, spec.locale, options2.locale); + view.locale(locale(loc.number, loc.time)); } - // Then resolve fields across units as per the op. - op = op || Union; - if (resolved[SelectionId]) resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); - else Object.keys(resolved).forEach((field)=>{ - resolved[field] = Object.keys(resolved[field]).map((unit)=>resolved[field][unit]).reduce((acc, curr)=>acc === undefined ? curr : ops[`${types[field]}_${op}`](acc, curr)); - }); - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - const key = vl5 ? VlPoint : VlMulti; - resolved[key] = op === Union ? { - [Or]: entries.reduce((acc, k)=>(acc.push(...multiRes[k]), acc), []) - } : { - [And]: entries.map((k)=>({ - [Or]: multiRes[k] - })) - }; + view._el = null; + view._elBind = null; + view._renderType = options2.renderer || RenderType.Canvas; + view._scenegraph = new Scenegraph(); + const root = view._scenegraph.root; + view._renderer = null; + view._tooltip = options2.tooltip || defaultTooltip, view._redraw = true; + view._handler = new CanvasHandler().scene(root); + view._globalCursor = false; + view._preventDefault = false; + view._timers = []; + view._eventListeners = []; + view._resizeListeners = []; + view._eventConfig = initializeEventConfig(spec.eventConfig); + view.globalCursor(view._eventConfig.globalCursor); + const ctx = runtime(view, spec, options2.expr); + view._runtime = ctx; + view._signals = ctx.signals; + view._bind = (spec.bindings || []).map((_) => ({ + state: null, + param: extend({}, _) + })); + if (ctx.root) ctx.root.set(root); + root.source = ctx.data.root.input; + view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); + view._width = view.width(); + view._height = view.height(); + view._viewWidth = viewWidth(view, view._width); + view._viewHeight = viewHeight(view, view._height); + view._origin = [0, 0]; + view._resize = 0; + view._autosize = 1; + initializeResize(view); + background(view); + cursor(view); + view.description(spec.description); + if (options2.hover) view.hover(); + if (options2.container) view.initialize(options2.container, options2.bind); + if (options2.watchPixelRatio) view._watchPixelRatio(); + } + function lookupSignal(view, name) { + return has$1(view._signals, name) ? view._signals[name] : error("Unrecognized signal name: " + $(name)); + } + function findOperatorHandler(op, handler) { + const h2 = (op._targets || []).filter((op2) => op2._update && op2._update.handler === handler); + return h2.length ? h2[0] : null; + } + function addOperatorListener(view, name, op, handler) { + let h2 = findOperatorHandler(op, handler); + if (!h2) { + h2 = trap(view, () => handler(name, op.value)); + h2.handler = handler; + view.on(op, null, h2); } - return resolved; -} -var ops = { - [`${SelectionId}_union`]: (0, _d3Array.union), - [`${SelectionId}_intersect`]: (0, _d3Array.intersection), - E_union: function(base, value) { - if (!base.length) return value; - var i = 0, n = value.length; - for(; i < n; ++i)if (!base.includes(value[i])) base.push(value[i]); - return base; - }, - E_intersect: function(base, value) { - return !base.length ? value : base.filter((v)=>value.includes(v)); + return view; + } + function removeOperatorListener(view, op, handler) { + const h2 = findOperatorHandler(op, handler); + if (h2) op._targets.remove(h2); + return view; + } + inherits(View$1, Dataflow, { + // -- DATAFLOW / RENDERING ---- + async evaluate(encode2, prerun, postrun) { + await Dataflow.prototype.evaluate.call(this, encode2, prerun); + if (this._redraw || this._resize) { + try { + if (this._renderer) { + if (this._resize) { + this._resize = 0; + resizeRenderer(this); + } + await this._renderer.renderAsync(this._scenegraph.root); + } + this._redraw = false; + } catch (e) { + this.error(e); + } + } + if (postrun) asyncCallback(this, postrun); + return this; }, - R_union: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; + dirty(item) { + this._redraw = true; + this._renderer && this._renderer.dirty(item); }, - R_intersect: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (hi < base[0] || base[1] < lo) return []; - else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } -}; -const DataPrefix = ':', IndexPrefix = '@'; -function selectionVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to selection functions must be a string literal.'); - const data = args[0].value, op = args.length >= 2 && (0, _vegaUtil.peek)(args).value, field = 'unit', indexName = IndexPrefix + field, dataName = DataPrefix + data; - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !(0, _vegaUtil.hasOwnProperty)(params, indexName)) params[indexName] = scope.getData(data).indataRef(scope, field); - // eslint-disable-next-line no-prototype-builtins - if (!(0, _vegaUtil.hasOwnProperty)(params, dataName)) params[dataName] = scope.getData(data).tuplesRef(); -} - -},{"d3-array":"5lCYW","vega-util":"f2ulH","vega-expression":"8Nghf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"boQgz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "context", ()=>context); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -/** - * Parse a serialized dataflow specification. - */ function parse(spec) { - const ctx = this, operators = spec.operators || []; - // parse background - if (spec.background) ctx.background = spec.background; - // parse event configuration - if (spec.eventConfig) ctx.eventConfig = spec.eventConfig; - // parse locale configuration - if (spec.locale) ctx.locale = spec.locale; - // parse operators - operators.forEach((entry)=>ctx.parseOperator(entry)); - // parse operator parameters - operators.forEach((entry)=>ctx.parseOperatorParameters(entry)); - // parse streams - (spec.streams || []).forEach((entry)=>ctx.parseStream(entry)); - // parse updates - (spec.updates || []).forEach((entry)=>ctx.parseUpdate(entry)); - return ctx.resolve(); -} -const Skip = (0, _vegaUtil.toSet)([ - 'rule' -]), Swap = (0, _vegaUtil.toSet)([ - 'group', - 'image', - 'rect' -]); -function adjustSpatial(encode, marktype) { - let code = ''; - if (Skip[marktype]) return code; - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - code += 'o.width=o.x2-o.x;'; - } else code += 'o.x=o.x2-(o.width||0);'; - } - if (encode.xc) code += 'o.x=o.xc-(o.width||0)/2;'; - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - code += 'o.height=o.y2-o.y;'; - } else code += 'o.y=o.y2-(o.height||0);'; - } - if (encode.yc) code += 'o.y=o.yc-(o.height||0)/2;'; - return code; -} -function canonicalType(type) { - return (type + '').toLowerCase(); -} -function isOperator(type) { - return canonicalType(type) === 'operator'; -} -function isCollect(type) { - return canonicalType(type) === 'collect'; -} -function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (!code.endsWith(';')) code = 'return(' + code + ');'; - const fn = Function(...args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; -} -// generate code for comparing a single field -function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; -} -var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ operator: (ctx, expr)=>expression(ctx, [ - '_' - ], expr.code), - /** - * Parse an expression provided as an operator parameter value. - */ parameter: (ctx, expr)=>expression(ctx, [ - 'datum', - '_' - ], expr.code), - /** - * Parse an expression applied to an event stream. - */ event: (ctx, expr)=>expression(ctx, [ - 'event' - ], expr.code), - /** - * Parse an expression used to handle an event-driven operator update. - */ handler: (ctx, expr)=>{ - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, [ - '_', - 'event' - ], code); + // -- GET / SET ---- + description(text2) { + if (arguments.length) { + const desc = text2 != null ? text2 + "" : null; + if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); + return this; + } + return this._desc; }, - /** - * Parse an expression that performs visual encoding. - */ encode: (ctx, encode)=>{ - const { marktype, channels } = encode; - let code = 'var o=item,datum=o.datum,m=0,$;'; - for(const name in channels){ - const o = 'o[' + (0, _vegaUtil.stringValue)(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - return expression(ctx, [ - 'item', - '_' - ], code); + container() { + return this._el; }, - /** - * Optimized code generators for access and comparison. - */ codegen: { - get (path) { - const ref = `[${path.map((0, _vegaUtil.stringValue)).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator (fields, orders) { - let t; - const map = (f, i)=>{ - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f' + i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } -}; -/** - * Parse a dataflow operator. - */ function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); - else ctx.transform(spec, spec.type); -} -/** - * Parse and assign operator parameters. - */ function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) (0, _vegaUtil.error)('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); - } -} -/** - * Parse a set of operator parameters. - */ function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - for(const key in spec){ - const value = spec[key]; - params[key] = (0, _vegaUtil.isArray)(value) ? value.map((v)=>parseParameter(v, ctx, params)) : parseParameter(value, ctx, params); - } - return params; -} -/** - * Parse a single parameter. - */ function parseParameter(spec, ctx, params) { - if (!spec || !(0, _vegaUtil.isObject)(spec)) return spec; - for(let i = 0, n = PARSERS.length, p; i < n; ++i){ - p = PARSERS[i]; - if ((0, _vegaUtil.hasOwnProperty)(spec, p.key)) return p.parse(spec, ctx, params); - } - return spec; -} -/** Reference parsers. */ var PARSERS = [ - { - key: '$ref', - parse: getOperator + scenegraph() { + return this._scenegraph; }, - { - key: '$key', - parse: getKey + origin() { + return this._origin.slice(); }, - { - key: '$expr', - parse: getExpression + signal(name, value2, options2) { + const op = lookupSignal(this, name); + return arguments.length === 1 ? op.value : this.update(op, value2, options2); }, - { - key: '$field', - parse: getField + width(_) { + return arguments.length ? this.signal("width", _) : this.signal("width"); }, - { - key: '$encode', - parse: getEncode + height(_) { + return arguments.length ? this.signal("height", _) : this.signal("height"); }, - { - key: '$compare', - parse: getCompare + padding(_) { + return arguments.length ? this.signal("padding", padding(_)) : padding(this.signal("padding")); }, - { - key: '$context', - parse: getContext + autosize(_) { + return arguments.length ? this.signal("autosize", _) : this.signal("autosize"); }, - { - key: '$subflow', - parse: getSubflow + background(_) { + return arguments.length ? this.signal("background", _) : this.signal("background"); }, - { - key: '$tupleid', - parse: getTupleId - } -]; -/** - * Resolve an operator reference. - */ function getOperator(_, ctx) { - return ctx.get(_.$ref) || (0, _vegaUtil.error)('Operator not defined: ' + _.$ref); -} -/** - * Resolve an expression reference. - */ function getExpression(_, ctx, params) { - if (_.$params) // parse expression parameters - ctx.parseParameters(_.$params, params); - const k = 'e:' + _.$expr.code; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.accessor)(ctx.parameterExpression(_.$expr), _.$fields)); -} -/** - * Resolve a key accessor reference. - */ function getKey(_, ctx) { - const k = 'k:' + _.$key + '_' + !!_.$flat; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.key)(_.$key, _.$flat, ctx.expr.codegen)); -} -/** - * Resolve a field accessor reference. - */ function getField(_, ctx) { - if (!_.$field) return null; - const k = 'f:' + _.$field + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.field)(_.$field, _.$name, ctx.expr.codegen)); -} -/** - * Resolve a comparator function reference. - */ function getCompare(_, ctx) { - // As of Vega 5.5.3, $tupleid sort is no longer used. - // Keep here for now for backwards compatibility. - const k = 'c:' + _.$compare + '_' + _.$order, c = (0, _vegaUtil.array)(_.$compare).map((_)=>_ && _.$tupleid ? (0, _vegaDataflow.tupleid) : _); - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.compare)(c, _.$order, ctx.expr.codegen)); -} -/** - * Resolve an encode operator reference. - */ function getEncode(_, ctx) { - const spec = _.$encode, encode = {}; - for(const name in spec){ - const enc = spec[name]; - encode[name] = (0, _vegaUtil.accessor)(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; -} -/** - * Resolve a context reference. - */ function getContext(_, ctx) { - return ctx; -} -/** - * Resolve a recursive subflow specification. - */ function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = ()=>ctx.detach(subctx); - return op; - }; -} -/** - * Resolve a tuple id reference. - */ function getTupleId() { - return 0, _vegaDataflow.tupleid; -} -/** - * Parse an event stream specification. - */ function parseStream(spec) { - var ctx = this, filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, stream = spec.stream != null ? ctx.get(spec.stream) : undefined, args; - if (spec.source) stream = ctx.events(spec.source, spec.type, filter); - else if (spec.merge) { - args = spec.merge.map((_)=>ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - if (spec.between) { - args = spec.between.map((_)=>ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - if (spec.filter) stream = stream.filter(filter); - if (spec.throttle != null) stream = stream.throttle(+spec.throttle); - if (spec.debounce != null) stream = stream.debounce(+spec.debounce); - if (stream == null) (0, _vegaUtil.error)('Invalid stream definition: ' + JSON.stringify(spec)); - if (spec.consume) stream.consume(true); - ctx.stream(spec, stream); -} -/** - * Parse an event-driven operator update. - */ function parseUpdate(spec) { - var ctx = this, srcid = (0, _vegaUtil.isObject)(srcid = spec.source) ? srcid.$ref : srcid, source = ctx.get(srcid), target = null, update = spec.update, params = undefined; - if (!source) (0, _vegaUtil.error)('Source not defined: ' + spec.source); - target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); - if (update && update.$expr) { - if (update.$params) params = ctx.parseParameters(update.$params); - update = ctx.handlerExpression(update.$expr); - } - ctx.update(spec, source, target, update, params); -} -const SKIP = { - skip: true -}; -function getState(options) { - var ctx = this, state = {}; - if (options.signals) { - var signals = state.signals = {}; - Object.keys(ctx.signals).forEach((key)=>{ - const op = ctx.signals[key]; - if (options.signals(key, op)) signals[key] = op.value; - }); - } - if (options.data) { - var data = state.data = {}; - Object.keys(ctx.data).forEach((key)=>{ - const dataset = ctx.data[key]; - if (options.data(key, dataset)) data[key] = dataset.input.value; - }); - } - if (ctx.subcontext && options.recurse !== false) state.subcontext = ctx.subcontext.map((ctx)=>ctx.getState(options)); - return state; -} -function setState(state) { - var ctx = this, df = ctx.dataflow, data = state.data, signals = state.signals; - Object.keys(signals || {}).forEach((key)=>{ - df.update(ctx.signals[key], signals[key], SKIP); - }); - Object.keys(data || {}).forEach((key)=>{ - df.pulse(ctx.data[key].input, df.changeset().remove((0, _vegaUtil.truthy)).insert(data[key])); - }); - (state.subcontext || []).forEach((substate, i)=>{ - const subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); -} -/** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ function context(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); -} -function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } -} -function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } -} -Context.prototype = Subcontext.prototype = { - fork () { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; + renderer(type2) { + if (!arguments.length) return this._renderType; + if (!renderModule(type2)) error("Unrecognized renderer type: " + type2); + if (type2 !== this._renderType) { + this._renderType = type2; + this._resetRenderer(); + } + return this; }, - detach (ctx) { - this.subcontext = this.subcontext.filter((c)=>c !== ctx); - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys)ctx.nodes[key]._targets = null; - for (const key of keys)ctx.nodes[key].detach(); - ctx.nodes = null; + tooltip(handler) { + if (!arguments.length) return this._tooltip; + if (handler !== this._tooltip) { + this._tooltip = handler; + this._resetRenderer(); + } + return this; }, - get (id) { - return this.nodes[id]; + loader(loader2) { + if (!arguments.length) return this._loader; + if (loader2 !== this._loader) { + Dataflow.prototype.loader.call(this, loader2); + this._resetRenderer(); + } + return this; }, - set (id, node) { - return this.nodes[id] = node; + resize() { + this._autosize = 1; + return this.touch(lookupSignal(this, "autosize")); }, - add (spec, op) { - const ctx = this, df = ctx.dataflow, data = spec.value; - ctx.set(spec.id, op); - if (isCollect(spec.type) && data) { - if (data.$ingest) df.ingest(op, data.$ingest, data.$format); - else if (data.$request) df.preload(op, data.$request, data.$format); - else df.pulse(op, df.changeset().insert(data)); - } - if (spec.root) ctx.root = op; - if (spec.parent) { - let p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [ - op - ]); - op.targets().add(p); - } else (ctx.unresolved = ctx.unresolved || []).push(()=>{ - p = ctx.get(spec.parent.$ref); - df.connect(p, [ - op - ]); - op.targets().add(p); - }); - } - if (spec.signal) ctx.signals[spec.signal] = op; - if (spec.scale) ctx.scales[spec.scale] = op; - if (spec.data) for(const name in spec.data){ - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach((role)=>data[role] = op); - } + _resetRenderer() { + if (this._renderer) { + this._renderer = null; + this.initialize(this._el, this._elBind); + } }, - resolve () { - (this.unresolved || []).forEach((fn)=>fn()); - delete this.unresolved; - return this; + // -- SIZING ---- + _resizeView: resizeView, + // -- EVENT HANDLING ---- + addEventListener(type2, handler, options2) { + let callback = handler; + if (!(options2 && options2.trap === false)) { + callback = trap(this, handler); + callback.raw = handler; + } + this._handler.on(type2, callback); + return this; }, - operator (spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); + removeEventListener(type2, handler) { + var handlers = this._handler.handlers(type2), i = handlers.length, h2, t; + while (--i >= 0) { + t = handlers[i].type; + h2 = handlers[i].handler; + if (type2 === t && (handler === h2 || handler === h2.raw)) { + this._handler.off(t, h2); + break; + } + } + return this; }, - transform (spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); + addResizeListener(handler) { + const l = this._resizeListeners; + if (!l.includes(handler)) { + l.push(handler); + } + return this; }, - stream (spec, stream) { - this.set(spec.id, stream); + removeResizeListener(handler) { + var l = this._resizeListeners, i = l.indexOf(handler); + if (i >= 0) { + l.splice(i, 1); + } + return this; }, - update (spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); + addSignalListener(name, handler) { + return addOperatorListener(this, name, lookupSignal(this, name), handler); }, - // expression parsing - operatorExpression (expr) { - return this.expr.operator(this, expr); + removeSignalListener(name, handler) { + return removeOperatorListener(this, lookupSignal(this, name), handler); }, - parameterExpression (expr) { - return this.expr.parameter(this, expr); + addDataListener(name, handler) { + return addOperatorListener(this, name, dataref(this, name).values, handler); }, - eventExpression (expr) { - return this.expr.event(this, expr); + removeDataListener(name, handler) { + return removeOperatorListener(this, dataref(this, name).values, handler); }, - handlerExpression (expr) { - return this.expr.handler(this, expr); + globalCursor(_) { + if (arguments.length) { + if (this._globalCursor !== !!_) { + const prev = setCursor(this, null); + this._globalCursor = !!_; + if (prev) setCursor(this, prev); + } + return this; + } else { + return this._globalCursor; + } }, - encodeExpression (encode) { - return this.expr.encode(this, encode); + preventDefault(_) { + if (arguments.length) { + this._preventDefault = _; + return this; + } else { + return this._preventDefault; + } }, - // parse methods - parse, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - // state methods + timer, + events, + finalize, + hover, + // -- DATA ---- + data, + change, + insert, + remove, + // -- SCALES -- + scale: scale$1, + // -- INITIALIZATION ---- + initialize, + // -- HEADLESS RENDERING ---- + toImageURL: renderToImageURL, + toCanvas: renderToCanvas, + toSVG: renderToSVG, + // -- SAVE / RESTORE STATE ---- getState, - setState -}; - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Bjyk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisDomainRole", ()=>AxisDomainRole); -parcelHelpers.export(exports, "AxisGridRole", ()=>AxisGridRole); -parcelHelpers.export(exports, "AxisLabelRole", ()=>AxisLabelRole); -parcelHelpers.export(exports, "AxisRole", ()=>AxisRole); -parcelHelpers.export(exports, "AxisTickRole", ()=>AxisTickRole); -parcelHelpers.export(exports, "AxisTitleRole", ()=>AxisTitleRole); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -parcelHelpers.export(exports, "FrameRole", ()=>FrameRole); -parcelHelpers.export(exports, "LegendEntryRole", ()=>LegendEntryRole); -parcelHelpers.export(exports, "LegendLabelRole", ()=>LegendLabelRole); -parcelHelpers.export(exports, "LegendRole", ()=>LegendRole); -parcelHelpers.export(exports, "LegendSymbolRole", ()=>LegendSymbolRole); -parcelHelpers.export(exports, "LegendTitleRole", ()=>LegendTitleRole); -parcelHelpers.export(exports, "MarkRole", ()=>MarkRole); -parcelHelpers.export(exports, "Scope", ()=>Scope); -parcelHelpers.export(exports, "ScopeRole", ()=>ScopeRole); -parcelHelpers.export(exports, "config", ()=>defaults); -parcelHelpers.export(exports, "parse", ()=>parse); -parcelHelpers.export(exports, "signal", ()=>parseSignal); -parcelHelpers.export(exports, "signalUpdates", ()=>parseSignalUpdates); -parcelHelpers.export(exports, "stream", ()=>parseStream); -var _vegaUtil = require("vega-util"); -var _vegaFunctions = require("vega-functions"); -var _vegaEventSelector = require("vega-event-selector"); -var _vegaScale = require("vega-scale"); -var _vegaDataflow = require("vega-dataflow"); -function parseAutosize(spec) { - return (0, _vegaUtil.isObject)(spec) ? spec : { - type: spec || 'pad' - }; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ + setState, + // RE-RENDER ON ZOOM + _watchPixelRatio: watchPixelRatio + }); + const VIEW = "view", LBRACK = "[", RBRACK = "]", LBRACE = "{", RBRACE = "}", COLON = ":", COMMA = ",", NAME = "@", GT = ">", ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { + "*": 1, + arc: 1, + area: 1, + group: 1, + image: 1, + line: 1, + path: 1, + rect: 1, + rule: 1, + shape: 1, + symbol: 1, + text: 1, + trail: 1 + }; + let DEFAULT_SOURCE, MARKS; + function eventSelector(selector, source2, marks) { + DEFAULT_SOURCE = source2 || VIEW; + MARKS = marks || DEFAULT_MARKS; + return parseMerge(selector.trim()).map(parseSelector); + } + function isMarkType(type2) { + return MARKS[type2]; + } + function find(s2, i, endChar, pushChar, popChar) { + const n = s2.length; + let count2 = 0, c2; + for (; i < n; ++i) { + c2 = s2[i]; + if (!count2 && c2 === endChar) return i; + else if (popChar && popChar.includes(c2)) --count2; + else if (pushChar && pushChar.includes(c2)) ++count2; + } + return i; + } + function parseMerge(s2) { + const output2 = [], n = s2.length; + let start = 0, i = 0; + while (i < n) { + i = find(s2, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); + output2.push(s2.substring(start, i).trim()); + start = ++i; + } + if (output2.length === 0) { + throw "Empty event selector: " + s2; + } + return output2; + } + function parseSelector(s2) { + return s2[0] === "[" ? parseBetween(s2) : parseStream$1(s2); + } + function parseBetween(s2) { + const n = s2.length; + let i = 1, b2; + i = find(s2, i, RBRACK, LBRACK, RBRACK); + if (i === n) { + throw "Empty between selector: " + s2; + } + b2 = parseMerge(s2.substring(1, i)); + if (b2.length !== 2) { + throw "Between selector must have two elements: " + s2; + } + s2 = s2.slice(i + 1).trim(); + if (s2[0] !== GT) { + throw "Expected '>' after between selector: " + s2; + } + b2 = b2.map(parseSelector); + const stream2 = parseSelector(s2.slice(1).trim()); + if (stream2.between) { + return { + between: b2, + stream: stream2 + }; + } else { + stream2.between = b2; + } + return stream2; + } + function parseStream$1(s2) { + const stream2 = { + source: DEFAULT_SOURCE + }, source2 = []; + let throttle = [0, 0], markname = 0, start = 0, n = s2.length, i = 0, j, filter2; + if (s2[n - 1] === RBRACE) { + i = s2.lastIndexOf(LBRACE); + if (i >= 0) { + try { + throttle = parseThrottle(s2.substring(i + 1, n - 1)); + } catch (e) { + throw "Invalid throttle specification: " + s2; + } + s2 = s2.slice(0, i).trim(); + n = s2.length; + } else throw "Unmatched right brace: " + s2; + i = 0; + } + if (!n) throw s2; + if (s2[0] === NAME) markname = ++i; + j = find(s2, i, COLON); + if (j < n) { + source2.push(s2.substring(start, j).trim()); + start = i = ++j; + } + i = find(s2, i, LBRACK); + if (i === n) { + source2.push(s2.substring(start, n).trim()); + } else { + source2.push(s2.substring(start, i).trim()); + filter2 = []; + start = ++i; + if (start === n) throw "Unmatched left bracket: " + s2; + } + while (i < n) { + i = find(s2, i, RBRACK); + if (i === n) throw "Unmatched left bracket: " + s2; + filter2.push(s2.substring(start, i).trim()); + if (i < n - 1 && s2[++i] !== LBRACK) throw "Expected left bracket: " + s2; + start = ++i; + } + if (!(n = source2.length) || ILLEGAL.test(source2[n - 1])) { + throw "Invalid event selector: " + s2; + } + if (n > 1) { + stream2.type = source2[1]; + if (markname) { + stream2.markname = source2[0].slice(1); + } else if (isMarkType(source2[0])) { + stream2.marktype = source2[0]; + } else { + stream2.source = source2[0]; + } + } else { + stream2.type = source2[0]; + } + if (stream2.type.slice(-1) === "!") { + stream2.consume = true; + stream2.type = stream2.type.slice(0, -1); + } + if (filter2 != null) stream2.filter = filter2; + if (throttle[0]) stream2.throttle = throttle[0]; + if (throttle[1]) stream2.debounce = throttle[1]; + return stream2; + } + function parseThrottle(s2) { + const a2 = s2.split(COMMA); + if (!s2.length || a2.length > 2) throw s2; + return a2.map((_) => { + const x2 = +_; + if (x2 !== x2) throw s2; + return x2; }); -function parsePadding(spec) { - return !(0, _vegaUtil.isObject)(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { - top: number(spec.top), - bottom: number(spec.bottom), - left: number(spec.left), - right: number(spec.right) - }; -} -const encoder = (_)=>(0, _vegaUtil.isObject)(_) && !(0, _vegaUtil.isArray)(_) ? (0, _vegaUtil.extend)({}, _) : { - value: _ - }; -function addEncode(object, name, value, set) { - if (value != null) { - const isEncoder = (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isArray)(value) || (0, _vegaUtil.isArray)(value) && value.length && (0, _vegaUtil.isObject)(value[0]); - // Always assign signal to update, even if the signal is from the enter block - if (isEncoder) object.update[name] = value; - else object[set || 'enter'][name] = { - value: value + } + function parseAutosize(spec) { + return isObject(spec) ? spec : { + type: spec || "pad" + }; + } + const number = (_) => +_ || 0; + const paddingObject = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function parsePadding(spec) { + return !isObject(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { + top: number(spec.top), + bottom: number(spec.bottom), + left: number(spec.left), + right: number(spec.right) + }; + } + const encoder = (_) => isObject(_) && !isArray(_) ? extend({}, _) : { + value: _ + }; + function addEncode(object2, name, value2, set2) { + if (value2 != null) { + const isEncoder = isObject(value2) && !isArray(value2) || isArray(value2) && value2.length && isObject(value2[0]); + if (isEncoder) { + object2.update[name] = value2; + } else { + object2[set2 || "enter"][name] = { + value: value2 }; - return 1; - } else return 0; -} -function addEncoders(object, enter, update) { - for(const name in enter)addEncode(object, name, enter[name]); - for(const name in update)addEncode(object, name, update[name], 'update'); -} -function extendEncode(encode, extra, skip) { - for(const name in extra){ - if (skip && (0, _vegaUtil.hasOwnProperty)(skip, name)) continue; - encode[name] = (0, _vegaUtil.extend)(encode[name] || {}, extra[name]); - } - return encode; -} -function has(key, encode) { - return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]); -} -const MarkRole = 'mark'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const AxisRole = 'axis'; -const AxisDomainRole = 'axis-domain'; -const AxisGridRole = 'axis-grid'; -const AxisLabelRole = 'axis-label'; -const AxisTickRole = 'axis-tick'; -const AxisTitleRole = 'axis-title'; -const LegendRole = 'legend'; -const LegendBandRole = 'legend-band'; -const LegendEntryRole = 'legend-entry'; -const LegendGradientRole = 'legend-gradient'; -const LegendLabelRole = 'legend-label'; -const LegendSymbolRole = 'legend-symbol'; -const LegendTitleRole = 'legend-title'; -const TitleRole = 'title'; -const TitleTextRole = 'title-text'; -const TitleSubtitleRole = 'title-subtitle'; -function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) applyDefault(defaults, key, config[key]); - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) role = null; - // resolve mark config - props = role === FrameRole ? config.group : role === MarkRole ? (0, _vegaUtil.extend)({}, config.mark, config[type]) : null; - for(key in props){ - // do not apply defaults if relevant fields are defined - skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode)); - if (!skip) applyDefault(defaults, key, props[key]); - } - // resolve styles, apply with increasing precedence - (0, _vegaUtil.array)(style).forEach((name)=>{ - const props = config.style && config.style[name]; - for(const key in props)if (!has(key, encode)) applyDefault(defaults, key, props[key]); + } + return 1; + } else { + return 0; + } + } + function addEncoders(object2, enter, update2) { + for (const name in enter) { + addEncode(object2, name, enter[name]); + } + for (const name in update2) { + addEncode(object2, name, update2[name], "update"); + } + } + function extendEncode(encode2, extra, skip) { + for (const name in extra) { + if (skip && has$1(skip, name)) continue; + encode2[name] = extend(encode2[name] || {}, extra[name]); + } + return encode2; + } + function has(key2, encode2) { + return encode2 && (encode2.enter && encode2.enter[key2] || encode2.update && encode2.update[key2]); + } + const MarkRole = "mark"; + const FrameRole = "frame"; + const ScopeRole = "scope"; + const AxisRole = "axis"; + const AxisDomainRole = "axis-domain"; + const AxisGridRole = "axis-grid"; + const AxisLabelRole = "axis-label"; + const AxisTickRole = "axis-tick"; + const AxisTitleRole = "axis-title"; + const LegendRole = "legend"; + const LegendBandRole = "legend-band"; + const LegendEntryRole = "legend-entry"; + const LegendGradientRole = "legend-gradient"; + const LegendLabelRole = "legend-label"; + const LegendSymbolRole = "legend-symbol"; + const LegendTitleRole = "legend-title"; + const TitleRole = "title"; + const TitleTextRole = "title-text"; + const TitleSubtitleRole = "title-subtitle"; + function applyDefaults(encode2, type2, role, style2, config) { + const defaults2 = {}, enter = {}; + let update2, key2, skip, props; + key2 = "lineBreak"; + if (type2 === "text" && config[key2] != null && !has(key2, encode2)) { + applyDefault(defaults2, key2, config[key2]); + } + if (role == "legend" || String(role).startsWith("axis")) { + role = null; + } + props = role === FrameRole ? config.group : role === MarkRole ? extend({}, config.mark, config[type2]) : null; + for (key2 in props) { + skip = has(key2, encode2) || (key2 === "fill" || key2 === "stroke") && (has("fill", encode2) || has("stroke", encode2)); + if (!skip) applyDefault(defaults2, key2, props[key2]); + } + array$4(style2).forEach((name) => { + const props2 = config.style && config.style[name]; + for (const key3 in props2) { + if (!has(key3, encode2)) { + applyDefault(defaults2, key3, props2[key3]); + } + } }); - encode = (0, _vegaUtil.extend)({}, encode); // defensive copy - for(key in defaults){ - props = defaults[key]; - if (props.signal) (update = update || {})[key] = props; - else enter[key] = props; - } - encode.enter = (0, _vegaUtil.extend)(enter, encode.enter); - if (update) encode.update = (0, _vegaUtil.extend)(update, encode.update); - return encode; -} -function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal ? { - signal: value.signal + encode2 = extend({}, encode2); + for (key2 in defaults2) { + props = defaults2[key2]; + if (props.signal) { + (update2 = update2 || {})[key2] = props; + } else { + enter[key2] = props; + } + } + encode2.enter = extend(enter, encode2.enter); + if (update2) encode2.update = extend(update2, encode2.update); + return encode2; + } + function applyDefault(defaults2, key2, value2) { + defaults2[key2] = value2 && value2.signal ? { + signal: value2.signal } : { - value: value - }; -} -const scaleRef = (scale)=>(0, _vegaUtil.isString)(scale) ? (0, _vegaUtil.stringValue)(scale) : scale.signal ? `(${scale.signal})` : field(scale); -function entry$1(enc) { - if (enc.gradient != null) return gradient(enc); - let value = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? (0, _vegaUtil.stringValue)(enc.value) : undefined; - if (enc.scale != null) value = scale(enc, value); - if (value === undefined) value = null; - if (enc.exponent != null) value = `pow(${value},${property(enc.exponent)})`; - if (enc.mult != null) value += `*${property(enc.mult)}`; - if (enc.offset != null) value += `+${property(enc.offset)}`; - if (enc.round) value = `round(${value})`; - return value; -} -const _color = (type, x, y, z)=>`(${type}(${[ - x, - y, - z - ].map(entry$1).join(',')})+'')`; -function color(enc) { - return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null; -} -function gradient(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [ - enc.start, - enc.stop, - enc.count - ].map((_)=>_ == null ? null : (0, _vegaUtil.stringValue)(_)); - // trim null inputs from the end - while(args.length && (0, _vegaUtil.peek)(args) == null)args.pop(); + value: value2 + }; + } + const scaleRef = (scale2) => isString(scale2) ? $(scale2) : scale2.signal ? `(${scale2.signal})` : field(scale2); + function entry$1(enc) { + if (enc.gradient != null) { + return gradient(enc); + } + let value2 = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== void 0 ? $(enc.value) : void 0; + if (enc.scale != null) { + value2 = scale(enc, value2); + } + if (value2 === void 0) { + value2 = null; + } + if (enc.exponent != null) { + value2 = `pow(${value2},${property(enc.exponent)})`; + } + if (enc.mult != null) { + value2 += `*${property(enc.mult)}`; + } + if (enc.offset != null) { + value2 += `+${property(enc.offset)}`; + } + if (enc.round) { + value2 = `round(${value2})`; + } + return value2; + } + const _color = (type2, x2, y2, z2) => `(${type2}(${[x2, y2, z2].map(entry$1).join(",")})+'')`; + function color(enc) { + return enc.c ? _color("hcl", enc.h, enc.c, enc.l) : enc.h || enc.s ? _color("hsl", enc.h, enc.s, enc.l) : enc.l || enc.a ? _color("lab", enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color("rgb", enc.r, enc.g, enc.b) : null; + } + function gradient(enc) { + const args = [enc.start, enc.stop, enc.count].map((_) => _ == null ? null : $(_)); + while (args.length && peek$1(args) == null) args.pop(); args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; -} -function property(property) { - return (0, _vegaUtil.isObject)(property) ? '(' + entry$1(property) + ')' : property; -} -function field(ref) { - return resolveField((0, _vegaUtil.isObject)(ref) ? ref : { - datum: ref + return `gradient(${args.join(",")})`; + } + function property(property2) { + return isObject(property2) ? "(" + entry$1(property2) + ")" : property2; + } + function field(ref2) { + return resolveField(isObject(ref2) ? ref2 : { + datum: ref2 }); -} -function resolveField(ref) { - let object, level, field; - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - while(level-- > 0)object += '.mark.group'; - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else field = ref.group; - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else (0, _vegaUtil.error)('Invalid field reference: ' + (0, _vegaUtil.stringValue)(ref)); - if (!ref.signal) field = (0, _vegaUtil.isString)(field) ? (0, _vegaUtil.splitAccessPath)(field).map((0, _vegaUtil.stringValue)).join('][') : resolveField(field); - return object + '[' + field + ']'; -} -function scale(enc, value) { - const scale = scaleRef(enc.scale); - if (enc.range != null) // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - if (enc.band) { - value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + property(enc.band)); - if (enc.extra) // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - if (value == null) value = '0'; - } - return value; -} -function rule(enc) { - let code = ''; - enc.forEach((rule)=>{ - const value = entry$1(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; + } + function resolveField(ref2) { + let object2, level, field2; + if (ref2.signal) { + object2 = "datum"; + field2 = ref2.signal; + } else if (ref2.group || ref2.parent) { + level = Math.max(1, ref2.level || 1); + object2 = "item"; + while (level-- > 0) { + object2 += ".mark.group"; + } + if (ref2.parent) { + field2 = ref2.parent; + object2 += ".datum"; + } else { + field2 = ref2.group; + } + } else if (ref2.datum) { + object2 = "datum"; + field2 = ref2.datum; + } else { + error("Invalid field reference: " + $(ref2)); + } + if (!ref2.signal) { + field2 = isString(field2) ? splitAccessPath(field2).map($).join("][") : resolveField(field2); + } + return object2 + "[" + field2 + "]"; + } + function scale(enc, value2) { + const scale2 = scaleRef(enc.scale); + if (enc.range != null) { + value2 = `lerp(_range(${scale2}), ${+enc.range})`; + } else { + if (value2 !== void 0) value2 = `_scale(${scale2}, ${value2})`; + if (enc.band) { + value2 = (value2 ? value2 + "+" : "") + `_bandwidth(${scale2})` + (+enc.band === 1 ? "" : "*" + property(enc.band)); + if (enc.extra) { + value2 = `(datum.extra ? _scale(${scale2}, datum.extra.value) : ${value2})`; + } + } + if (value2 == null) value2 = "0"; + } + return value2; + } + function rule(enc) { + let code = ""; + enc.forEach((rule2) => { + const value2 = entry$1(rule2); + code += rule2.test ? `(${rule2.test})?${value2}:` : value2; }); - // if no else clause, terminate with null (#1366) - if ((0, _vegaUtil.peek)(code) === ':') code += 'null'; + if (peek$1(code) === ":") { + code += "null"; + } return code; -} -function parseEncode(encode, type, role, style, scope, params) { + } + function parseEncode(encode2, type2, role, style2, scope, params2) { const enc = {}; - params = params || {}; - params.encoders = { - $encode: enc - }; - encode = applyDefaults(encode, type, role, style, scope.config); - for(const key in encode)enc[key] = parseBlock(encode[key], type, params, scope); - return params; -} -function parseBlock(block, marktype, params, scope) { + params2 = params2 || {}; + params2.encoders = { + $encode: enc + }; + encode2 = applyDefaults(encode2, type2, role, style2, scope.config); + for (const key2 in encode2) { + enc[key2] = parseBlock(encode2[key2], type2, params2, scope); + } + return params2; + } + function parseBlock(block, marktype, params2, scope) { const channels = {}, fields = {}; - for(const name in block)if (block[name] != null) // skip any null entries - channels[name] = parse$1(expr(block[name]), scope, params, fields); + for (const name in block) { + if (block[name] != null) { + channels[name] = parse$1(expr(block[name]), scope, params2, fields); + } + } return { - $expr: { - marktype, - channels - }, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; -} -function expr(enc) { - return (0, _vegaUtil.isArray)(enc) ? rule(enc) : entry$1(enc); -} -function parse$1(code, scope, params, fields) { - const expr = (0, _vegaFunctions.parseExpression)(code, scope); - expr.$fields.forEach((name)=>fields[name] = 1); - (0, _vegaUtil.extend)(params, expr.$params); - return expr.$expr; -} -const OUTER = 'outer', OUTER_INVALID = [ - 'value', - 'update', - 'init', - 'react', - 'bind' -]; -function outerError(prefix, name) { - (0, _vegaUtil.error)(prefix + ' for "outer" push: ' + (0, _vegaUtil.stringValue)(name)); -} -function parseSignal(signal, scope) { + $expr: { + marktype, + channels + }, + $fields: Object.keys(fields), + $output: Object.keys(block) + }; + } + function expr(enc) { + return isArray(enc) ? rule(enc) : entry$1(enc); + } + function parse$1(code, scope, params2, fields) { + const expr2 = parser(code, scope); + expr2.$fields.forEach((name) => fields[name] = 1); + extend(params2, expr2.$params); + return expr2.$expr; + } + const OUTER = "outer", OUTER_INVALID = ["value", "update", "init", "react", "bind"]; + function outerError(prefix, name) { + error(prefix + ' for "outer" push: ' + $(name)); + } + function parseSignal(signal, scope) { const name = signal.name; if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach((prop)=>{ - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); + if (!scope.signals[name]) outerError("No prior signal definition", name); + OUTER_INVALID.forEach((prop) => { + if (signal[prop] !== void 0) outerError("Invalid property ", prop); + }); } else { - // define a new signal in the current scope - const op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); + const op = scope.addSignal(name, signal.value); + if (signal.react === false) op.react = false; + if (signal.bind) scope.addBinding(name, signal.bind); } -} -function Entry(type, value, params, parent) { + } + function Entry(type2, value2, params2, parent) { this.id = -1; - this.type = type; - this.value = value; - this.params = params; + this.type = type2; + this.value = value2; + this.params = params2; if (parent) this.parent = parent; -} -function entry(type, value, params, parent) { - return new Entry(type, value, params, parent); -} -function operator(value, params) { - return entry('operator', value, params); -} -// ----- -function ref(op) { - const ref = { - $ref: op.id - }; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; -} -function fieldRef$1(field, name) { + } + function entry(type2, value2, params2, parent) { + return new Entry(type2, value2, params2, parent); + } + function operator(value2, params2) { + return entry("operator", value2, params2); + } + function ref(op) { + const ref2 = { + $ref: op.id + }; + if (op.id < 0) (op.refs = op.refs || []).push(ref2); + return ref2; + } + function fieldRef$1(field2, name) { return name ? { - $field: field, - $name: name + $field: field2, + $name: name } : { - $field: field + $field: field2 }; -} -const keyFieldRef = fieldRef$1('key'); -function compareRef(fields, orders) { + } + const keyFieldRef = fieldRef$1("key"); + function compareRef(fields, orders) { return { - $compare: fields, - $order: orders - }; -} -function keyRef(fields, flat) { - const ref = { - $key: fields - }; - if (flat) ref.$flat = true; - return ref; -} -// ----- -const Ascending = 'ascending'; -const Descending = 'descending'; -function sortKey(sort) { - return !(0, _vegaUtil.isObject)(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field); -} -function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || ''); -} -// ----- -const Scope$1 = 'scope'; -const View = 'view'; -function isSignal(_) { + $compare: fields, + $order: orders + }; + } + function keyRef(fields, flat) { + const ref2 = { + $key: fields + }; + if (flat) ref2.$flat = true; + return ref2; + } + const Ascending = "ascending"; + const Descending = "descending"; + function sortKey(sort2) { + return !isObject(sort2) ? "" : (sort2.order === Descending ? "-" : "+") + aggrField(sort2.op, sort2.field); + } + function aggrField(op, field2) { + return (op && op.signal ? "$" + op.signal : op || "") + (op && field2 ? "_" : "") + (field2 && field2.signal ? "$" + field2.signal : field2 || ""); + } + const Scope$1 = "scope"; + const View = "view"; + function isSignal(_) { return _ && _.signal; -} -function isExpr$1(_) { + } + function isExpr$1(_) { return _ && _.expr; -} -function hasSignal(_) { + } + function hasSignal(_) { if (isSignal(_)) return true; - if ((0, _vegaUtil.isObject)(_)) for(const key in _){ - if (hasSignal(_[key])) return true; + if (isObject(_)) for (const key2 in _) { + if (hasSignal(_[key2])) return true; } return false; -} -function value(specValue, defaultValue) { + } + function value(specValue, defaultValue) { return specValue != null ? specValue : defaultValue; -} -function deref(v) { + } + function deref(v) { return v && v.signal || v; -} -const Timer = 'timer'; -function parseStream(stream, scope) { - const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : (0, _vegaUtil.error)('Invalid stream specification: ' + (0, _vegaUtil.stringValue)(stream)); - return method(stream, scope); -} -function eventSource(source) { - return source === Scope$1 ? View : source || View; -} -function mergeStream(stream, scope) { - const list = stream.merge.map((s)=>parseStream(s, scope)), entry = streamParameters({ - merge: list - }, stream, scope); - return scope.addStream(entry).id; -} -function nestedStream(stream, scope) { - const id = parseStream(stream.stream, scope), entry = streamParameters({ - stream: id - }, stream, scope); - return scope.addStream(entry).id; -} -function eventStream(stream, scope) { - let id; - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = { - between: stream.between, - filter: stream.filter - }; - } else id = scope.event(eventSource(stream.source), stream.type); - const entry = streamParameters({ - stream: id - }, stream, scope); - return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id; -} -function streamParameters(entry, stream, scope) { - let param = stream.between; - if (param) { - if (param.length !== 2) (0, _vegaUtil.error)('Stream "between" parameter must have 2 entries: ' + (0, _vegaUtil.stringValue)(stream)); - entry.between = [ - parseStream(param[0], scope), - parseStream(param[1], scope) - ]; + } + const Timer = "timer"; + function parseStream(stream2, scope) { + const method2 = stream2.merge ? mergeStream : stream2.stream ? nestedStream : stream2.type ? eventStream : error("Invalid stream specification: " + $(stream2)); + return method2(stream2, scope); + } + function eventSource(source2) { + return source2 === Scope$1 ? View : source2 || View; + } + function mergeStream(stream2, scope) { + const list = stream2.merge.map((s2) => parseStream(s2, scope)), entry2 = streamParameters({ + merge: list + }, stream2, scope); + return scope.addStream(entry2).id; + } + function nestedStream(stream2, scope) { + const id2 = parseStream(stream2.stream, scope), entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return scope.addStream(entry2).id; + } + function eventStream(stream2, scope) { + let id2; + if (stream2.type === Timer) { + id2 = scope.event(Timer, stream2.throttle); + stream2 = { + between: stream2.between, + filter: stream2.filter + }; + } else { + id2 = scope.event(eventSource(stream2.source), stream2.type); + } + const entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return Object.keys(entry2).length === 1 ? id2 : scope.addStream(entry2).id; + } + function streamParameters(entry2, stream2, scope) { + let param2 = stream2.between; + if (param2) { + if (param2.length !== 2) { + error('Stream "between" parameter must have 2 entries: ' + $(stream2)); + } + entry2.between = [parseStream(param2[0], scope), parseStream(param2[1], scope)]; + } + param2 = stream2.filter ? [].concat(stream2.filter) : []; + if (stream2.marktype || stream2.markname || stream2.markrole) { + param2.push(filterMark(stream2.marktype, stream2.markname, stream2.markrole)); + } + if (stream2.source === Scope$1) { + param2.push("inScope(event.item)"); + } + if (param2.length) { + entry2.filter = parser("(" + param2.join(")&&(") + ")", scope).$expr; + } + if ((param2 = stream2.throttle) != null) { + entry2.throttle = +param2; + } + if ((param2 = stream2.debounce) != null) { + entry2.debounce = +param2; + } + if (stream2.consume) { + entry2.consume = true; } - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - if (stream.source === Scope$1) // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - if (param.length) entry.filter = (0, _vegaFunctions.parseExpression)('(' + param.join(')&&(') + ')', scope).$expr; - if ((param = stream.throttle) != null) entry.throttle = +param; - if ((param = stream.debounce) != null) entry.debounce = +param; - if (stream.consume) entry.consume = true; - return entry; -} -function filterMark(type, name, role) { - const item = 'event.item'; - return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); -} -// bypass expression parser for internal operator references -const OP_VALUE_EXPR = { - code: '_.$value', + return entry2; + } + function filterMark(type2, name, role) { + const item = "event.item"; + return item + (type2 && type2 !== "*" ? "&&" + item + ".mark.marktype==='" + type2 + "'" : "") + (role ? "&&" + item + ".mark.role==='" + role + "'" : "") + (name ? "&&" + item + ".mark.name==='" + name + "'" : ""); + } + const OP_VALUE_EXPR = { + code: "_.$value", ast: { - type: 'Identifier', - value: 'value' - } -}; -function parseUpdate(spec, scope, target) { - const encode = spec.encode, entry = { - target: target - }; - let events = spec.events, update = spec.update, sources = []; - if (!events) (0, _vegaUtil.error)('Signal update missing events specification.'); - // interpret as an event selector string - if ((0, _vegaUtil.isString)(events)) events = (0, _vegaEventSelector.parseSelector)(events, scope.isSubscope() ? Scope$1 : View); - // separate event streams from signal updates - events = (0, _vegaUtil.array)(events).filter((s)=>s.signal || s.scale ? (sources.push(s), 0) : 1); - // merge internal operator listeners - if (sources.length > 1) sources = [ - mergeSources(sources) - ]; - // merge event streams, include as source - if (events.length) sources.push(events.length > 1 ? { - merge: events - } : events[0]); - if (encode != null) { - if (update) (0, _vegaUtil.error)('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + (0, _vegaUtil.stringValue)(encode) + ')'; - } - // resolve update value - entry.update = (0, _vegaUtil.isString)(update) ? (0, _vegaFunctions.parseExpression)(update, scope) : update.expr != null ? (0, _vegaFunctions.parseExpression)(update.expr, scope) : update.value != null ? update.value : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: { - $value: scope.signalRef(update.signal) - } - } : (0, _vegaUtil.error)('Invalid signal update specification.'); - if (spec.force) entry.options = { + type: "Identifier", + value: "value" + } + }; + function parseUpdate(spec, scope, target2) { + const encode2 = spec.encode, entry2 = { + target: target2 + }; + let events2 = spec.events, update2 = spec.update, sources = []; + if (!events2) { + error("Signal update missing events specification."); + } + if (isString(events2)) { + events2 = eventSelector(events2, scope.isSubscope() ? Scope$1 : View); + } + events2 = array$4(events2).filter((s2) => s2.signal || s2.scale ? (sources.push(s2), 0) : 1); + if (sources.length > 1) { + sources = [mergeSources(sources)]; + } + if (events2.length) { + sources.push(events2.length > 1 ? { + merge: events2 + } : events2[0]); + } + if (encode2 != null) { + if (update2) error("Signal encode and update are mutually exclusive."); + update2 = "encode(item()," + $(encode2) + ")"; + } + entry2.update = isString(update2) ? parser(update2, scope) : update2.expr != null ? parser(update2.expr, scope) : update2.value != null ? update2.value : update2.signal != null ? { + $expr: OP_VALUE_EXPR, + $params: { + $value: scope.signalRef(update2.signal) + } + } : error("Invalid signal update specification."); + if (spec.force) { + entry2.options = { force: true - }; - sources.forEach((source)=>scope.addUpdate((0, _vegaUtil.extend)(streamSource(source, scope), entry))); -} -function streamSource(stream, scope) { + }; + } + sources.forEach((source2) => scope.addUpdate(extend(streamSource(source2, scope), entry2))); + } + function streamSource(stream2, scope) { return { - source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream(stream, scope) + source: stream2.signal ? scope.signalRef(stream2.signal) : stream2.scale ? scope.scaleRef(stream2.scale) : parseStream(stream2, scope) }; -} -function mergeSources(sources) { + } + function mergeSources(sources) { return { - signal: '[' + sources.map((s)=>s.scale ? 'scale("' + s.scale + '")' : s.signal) + ']' + signal: "[" + sources.map((s2) => s2.scale ? 'scale("' + s2.scale + '")' : s2.signal) + "]" }; -} -function parseSignalUpdates(signal, scope) { + } + function parseSignalUpdates(signal, scope) { const op = scope.getSignal(signal.name); - let expr = signal.update; + let expr2 = signal.update; if (signal.init) { - if (expr) (0, _vegaUtil.error)('Signals can not include both init and update expressions.'); - else { - expr = signal.init; - op.initonly = true; - } - } - if (expr) { - expr = (0, _vegaFunctions.parseExpression)(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - if (signal.on) signal.on.forEach((_)=>parseUpdate(_, scope, op.id)); -} -const transform = (name)=>(params, value, parent)=>entry(name, value, params || undefined, parent); -const Aggregate = transform('aggregate'); -const AxisTicks = transform('axisticks'); -const Bound = transform('bound'); -const Collect = transform('collect'); -const Compare = transform('compare'); -const DataJoin = transform('datajoin'); -const Encode = transform('encode'); -const Expression = transform('expression'); -const Facet = transform('facet'); -const Field = transform('field'); -const Key = transform('key'); -const LegendEntries = transform('legendentries'); -const Load = transform('load'); -const Mark = transform('mark'); -const MultiExtent = transform('multiextent'); -const MultiValues = transform('multivalues'); -const Overlap = transform('overlap'); -const Params = transform('params'); -const PreFacet = transform('prefacet'); -const Projection = transform('projection'); -const Proxy = transform('proxy'); -const Relay = transform('relay'); -const Render = transform('render'); -const Scale = transform('scale'); -const Sieve = transform('sieve'); -const SortItems = transform('sortitems'); -const ViewLayout = transform('viewlayout'); -const Values = transform('values'); -let FIELD_REF_ID = 0; -const MULTIDOMAIN_SORT_OPS = { - min: 'min', - max: 'max', - count: 'sum' -}; -function initScale(spec, scope) { - const type = spec.type || 'linear'; - if (!(0, _vegaScale.isValidScaleType)(type)) (0, _vegaUtil.error)('Unrecognized scale type: ' + (0, _vegaUtil.stringValue)(type)); + if (expr2) { + error("Signals can not include both init and update expressions."); + } else { + expr2 = signal.init; + op.initonly = true; + } + } + if (expr2) { + expr2 = parser(expr2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + if (signal.on) { + signal.on.forEach((_) => parseUpdate(_, scope, op.id)); + } + } + const transform = (name) => (params2, value2, parent) => entry(name, value2, params2 || void 0, parent); + const Aggregate = transform("aggregate"); + const AxisTicks = transform("axisticks"); + const Bound = transform("bound"); + const Collect = transform("collect"); + const Compare = transform("compare"); + const DataJoin = transform("datajoin"); + const Encode = transform("encode"); + const Expression = transform("expression"); + const Facet = transform("facet"); + const Field = transform("field"); + const Key = transform("key"); + const LegendEntries = transform("legendentries"); + const Load = transform("load"); + const Mark = transform("mark"); + const MultiExtent = transform("multiextent"); + const MultiValues = transform("multivalues"); + const Overlap = transform("overlap"); + const Params = transform("params"); + const PreFacet = transform("prefacet"); + const Projection = transform("projection"); + const Proxy = transform("proxy"); + const Relay = transform("relay"); + const Render = transform("render"); + const Scale = transform("scale"); + const Sieve = transform("sieve"); + const SortItems = transform("sortitems"); + const ViewLayout = transform("viewlayout"); + const Values = transform("values"); + let FIELD_REF_ID = 0; + const MULTIDOMAIN_SORT_OPS = { + min: "min", + max: "max", + count: "sum" + }; + function initScale(spec, scope) { + const type2 = spec.type || "linear"; + if (!isValidScaleType(type2)) { + error("Unrecognized scale type: " + $(type2)); + } scope.addScale(spec.name, { - type, - domain: undefined + type: type2, + domain: void 0 }); -} -function parseScale(spec, scope) { - const params = scope.getScale(spec.name).params; - let key; - params.domain = parseScaleDomain(spec.domain, spec, scope); - if (spec.range != null) params.range = parseScaleRange(spec, scope, params); - if (spec.interpolate != null) parseScaleInterpolate(spec.interpolate, params); - if (spec.nice != null) params.nice = parseScaleNice(spec.nice, scope); - if (spec.bins != null) params.bins = parseScaleBins(spec.bins, scope); - for(key in spec){ - if ((0, _vegaUtil.hasOwnProperty)(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } -} -function parseLiteral(v, scope) { - return !(0, _vegaUtil.isObject)(v) ? v : v.signal ? scope.signalRef(v.signal) : (0, _vegaUtil.error)('Unsupported object: ' + (0, _vegaUtil.stringValue)(v)); -} -function parseArray(v, scope) { - return v.signal ? scope.signalRef(v.signal) : v.map((v)=>parseLiteral(v, scope)); -} -function dataLookupError(name) { - (0, _vegaUtil.error)('Can not find data set: ' + (0, _vegaUtil.stringValue)(name)); -} -// -- SCALE DOMAIN ---- -function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) (0, _vegaUtil.error)('No scale domain defined for domainMin/domainMax to override.'); - return; // default domain - } - return domain.signal ? scope.signalRef(domain.signal) : ((0, _vegaUtil.isArray)(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope); -} -function explicitDomain(domain, spec, scope) { - return domain.map((v)=>parseLiteral(v, scope)); -} -function singularDomain(domain, spec, scope) { - const data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - return (0, _vegaScale.isDiscrete)(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : (0, _vegaScale.isQuantile)(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field); -} -function multipleDomain(domain, spec, scope) { - const data = domain.data, fields = domain.fields.reduce((dom, d)=>{ - d = (0, _vegaUtil.isString)(d) ? { - data: data, - field: d - } : (0, _vegaUtil.isArray)(d) || d.signal ? fieldRef(d, scope) : d; - dom.push(d); - return dom; + } + function parseScale(spec, scope) { + const params2 = scope.getScale(spec.name).params; + let key2; + params2.domain = parseScaleDomain(spec.domain, spec, scope); + if (spec.range != null) { + params2.range = parseScaleRange(spec, scope, params2); + } + if (spec.interpolate != null) { + parseScaleInterpolate(spec.interpolate, params2); + } + if (spec.nice != null) { + params2.nice = parseScaleNice(spec.nice, scope); + } + if (spec.bins != null) { + params2.bins = parseScaleBins(spec.bins, scope); + } + for (key2 in spec) { + if (has$1(params2, key2) || key2 === "name") continue; + params2[key2] = parseLiteral(spec[key2], scope); + } + } + function parseLiteral(v, scope) { + return !isObject(v) ? v : v.signal ? scope.signalRef(v.signal) : error("Unsupported object: " + $(v)); + } + function parseArray(v, scope) { + return v.signal ? scope.signalRef(v.signal) : v.map((v2) => parseLiteral(v2, scope)); + } + function dataLookupError(name) { + error("Can not find data set: " + $(name)); + } + function parseScaleDomain(domain2, spec, scope) { + if (!domain2) { + if (spec.domainMin != null || spec.domainMax != null) { + error("No scale domain defined for domainMin/domainMax to override."); + } + return; + } + return domain2.signal ? scope.signalRef(domain2.signal) : (isArray(domain2) ? explicitDomain : domain2.fields ? multipleDomain : singularDomain)(domain2, spec, scope); + } + function explicitDomain(domain2, spec, scope) { + return domain2.map((v) => parseLiteral(v, scope)); + } + function singularDomain(domain2, spec, scope) { + const data2 = scope.getData(domain2.data); + if (!data2) dataLookupError(domain2.data); + return isDiscrete(spec.type) ? data2.valuesRef(scope, domain2.field, parseSort(domain2.sort, false)) : isQuantile(spec.type) ? data2.domainRef(scope, domain2.field) : data2.extentRef(scope, domain2.field); + } + function multipleDomain(domain2, spec, scope) { + const data2 = domain2.data, fields = domain2.fields.reduce((dom, d2) => { + d2 = isString(d2) ? { + data: data2, + field: d2 + } : isArray(d2) || d2.signal ? fieldRef(d2, scope) : d2; + dom.push(d2); + return dom; }, []); - return ((0, _vegaScale.isDiscrete)(spec.type) ? ordinalMultipleDomain : (0, _vegaScale.isQuantile)(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields); -} -function fieldRef(data, scope) { - const name = '_:vega:_' + FIELD_REF_ID++, coll = Collect({}); - if ((0, _vegaUtil.isArray)(data)) coll.value = { - $ingest: data - }; - else if (data.signal) { - const code = 'setdata(' + (0, _vegaUtil.stringValue)(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [ - coll, - Sieve({}) - ]); + return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain2, scope, fields); + } + function fieldRef(data2, scope) { + const name = "_:vega:_" + FIELD_REF_ID++, coll = Collect({}); + if (isArray(data2)) { + coll.value = { + $ingest: data2 + }; + } else if (data2.signal) { + const code = "setdata(" + $(name) + "," + data2.signal + ")"; + coll.params.input = scope.signalRef(code); + } + scope.addDataPipeline(name, [coll, Sieve({})]); return { - data: name, - field: 'data' - }; -} -function ordinalMultipleDomain(domain, scope, fields) { - const sort = parseSort(domain.sort, true); - let a, v; - // get value counts for each domain field - const counts = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); + data: name, + field: "data" + }; + } + function ordinalMultipleDomain(domain2, scope, fields) { + const sort2 = parseSort(domain2.sort, true); + let a2, v; + const counts = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.countsRef(scope, f.field, sort2); }); - // aggregate the results from each domain field const p = { - groupby: keyFieldRef, - pulse: counts - }; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [ - MULTIDOMAIN_SORT_OPS[a] - ]; - p.fields = [ - scope.fieldRef(v) - ]; - p.as = [ - v - ]; - } - a = scope.add(Aggregate(p)); - // collect aggregate output - const c = scope.add(Collect({ - pulse: ref(a) + groupby: keyFieldRef, + pulse: counts + }; + if (sort2) { + a2 = sort2.op || "count"; + v = sort2.field ? aggrField(a2, sort2.field) : "count"; + p.ops = [MULTIDOMAIN_SORT_OPS[a2]]; + p.fields = [scope.fieldRef(v)]; + p.as = [v]; + } + a2 = scope.add(Aggregate(p)); + const c2 = scope.add(Collect({ + pulse: ref(a2) })); - // extract values for combined domain v = scope.add(Values({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) + field: keyFieldRef, + sort: scope.sortRef(sort2), + pulse: ref(c2) })); return ref(v); -} -function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if ((0, _vegaUtil.isObject)(sort)) sort.field = 'key'; - else sort = { - field: 'key' - }; - } else if (!sort.field && sort.op !== 'count') (0, _vegaUtil.error)('No field provided for sort aggregate op: ' + sort.op); - else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) (0, _vegaUtil.error)('Multiple domain scales can not be sorted using ' + sort.op); - } - } - return sort; -} -function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - const values = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); + } + function parseSort(sort2, multidomain) { + if (sort2) { + if (!sort2.field && !sort2.op) { + if (isObject(sort2)) sort2.field = "key"; + else sort2 = { + field: "key" + }; + } else if (!sort2.field && sort2.op !== "count") { + error("No field provided for sort aggregate op: " + sort2.op); + } else if (multidomain && sort2.field) { + if (sort2.op && !MULTIDOMAIN_SORT_OPS[sort2.op]) { + error("Multiple domain scales can not be sorted using " + sort2.op); + } + } + } + return sort2; + } + function quantileMultipleDomain(domain2, scope, fields) { + const values2 = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.domainRef(scope, f.field); }); - // combine value arrays return ref(scope.add(MultiValues({ - values: values + values: values2 }))); -} -function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - const extents = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); + } + function numericMultipleDomain(domain2, scope, fields) { + const extents = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.extentRef(scope, f.field); }); - // combine extents return ref(scope.add(MultiExtent({ - extents: extents + extents }))); -} -// -- SCALE BINS ----- -function parseScaleBins(v, scope) { - return v.signal || (0, _vegaUtil.isArray)(v) ? parseArray(v, scope) : scope.objectProperty(v); -} -// -- SCALE NICE ----- -function parseScaleNice(nice, scope) { - return nice.signal ? scope.signalRef(nice.signal) : (0, _vegaUtil.isObject)(nice) ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } : parseLiteral(nice); -} -// -- SCALE INTERPOLATION ----- -function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) params.interpolateGamma = parseLiteral(interpolate.gamma); -} -// -- SCALE RANGE ----- -function parseScaleRange(spec, scope, params) { + } + function parseScaleBins(v, scope) { + return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v); + } + function parseScaleNice(nice2, scope) { + return nice2.signal ? scope.signalRef(nice2.signal) : isObject(nice2) ? { + interval: parseLiteral(nice2.interval), + step: parseLiteral(nice2.step) + } : parseLiteral(nice2); + } + function parseScaleInterpolate(interpolate2, params2) { + params2.interpolate = parseLiteral(interpolate2.type || interpolate2); + if (interpolate2.gamma != null) { + params2.interpolateGamma = parseLiteral(interpolate2.gamma); + } + } + function parseScaleRange(spec, scope, params2) { const config = scope.config.range; - let range = spec.range; - if (range.signal) return scope.signalRef(range.signal); - else if ((0, _vegaUtil.isString)(range)) { - if (config && (0, _vegaUtil.hasOwnProperty)(config, range)) { - spec = (0, _vegaUtil.extend)({}, spec, { - range: config[range] - }); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') range = [ - 0, - { - signal: 'width' - } - ]; - else if (range === 'height') range = (0, _vegaScale.isDiscrete)(spec.type) ? [ - 0, - { - signal: 'height' - } - ] : [ - { - signal: 'height' - }, - 0 - ]; - else (0, _vegaUtil.error)('Unrecognized scale range value: ' + (0, _vegaUtil.stringValue)(range)); - } else if (range.scheme) { - params.scheme = (0, _vegaUtil.isArray)(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if ((0, _vegaScale.isDiscrete)(spec.type) && !(0, _vegaUtil.isArray)(range)) return parseScaleDomain(range, spec, scope); - else if (!(0, _vegaUtil.isArray)(range)) (0, _vegaUtil.error)('Unsupported range type: ' + (0, _vegaUtil.stringValue)(range)); - return range.map((v)=>((0, _vegaUtil.isArray)(v) ? parseArray : parseLiteral)(v, scope)); -} -function parseProjection(proj, scope) { - const config = scope.config.projection || {}, params = {}; - for(const name in proj){ - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } - // apply projection defaults from config - for(const name in config)if (params[name] == null) params[name] = parseParameter$1(config[name], name, scope); - scope.addProjection(proj.name, params); -} -function parseParameter$1(_, name, scope) { - return (0, _vegaUtil.isArray)(_) ? _.map((_)=>parseParameter$1(_, name, scope)) : !(0, _vegaUtil.isObject)(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : (0, _vegaUtil.error)('Unsupported parameter object: ' + (0, _vegaUtil.stringValue)(_)); -} -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const Center = 'center'; -const Vertical = 'vertical'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const Index = 'index'; -const Label = 'label'; -const Offset = 'offset'; -const Perc = 'perc'; -const Perc2 = 'perc2'; -const Value = 'value'; -const GuideLabelStyle = 'guide-label'; -const GuideTitleStyle = 'guide-title'; -const GroupTitleStyle = 'group-title'; -const GroupSubtitleStyle = 'group-subtitle'; -/** All values of LegendType */ const Symbols = 'symbol'; -const Gradient = 'gradient'; -const Discrete = 'discrete'; -const Size = 'size'; -const Shape = 'shape'; -const Fill = 'fill'; -const Stroke = 'stroke'; -const StrokeWidth = 'strokeWidth'; -const StrokeDash = 'strokeDash'; -const Opacity = 'opacity'; -// Encoding channels supported by legends -// In priority order of 'canonical' scale -const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity -]; -const Skip = { + let range2 = spec.range; + if (range2.signal) { + return scope.signalRef(range2.signal); + } else if (isString(range2)) { + if (config && has$1(config, range2)) { + spec = extend({}, spec, { + range: config[range2] + }); + return parseScaleRange(spec, scope, params2); + } else if (range2 === "width") { + range2 = [0, { + signal: "width" + }]; + } else if (range2 === "height") { + range2 = isDiscrete(spec.type) ? [0, { + signal: "height" + }] : [{ + signal: "height" + }, 0]; + } else { + error("Unrecognized scale range value: " + $(range2)); + } + } else if (range2.scheme) { + params2.scheme = isArray(range2.scheme) ? parseArray(range2.scheme, scope) : parseLiteral(range2.scheme, scope); + if (range2.extent) params2.schemeExtent = parseArray(range2.extent, scope); + if (range2.count) params2.schemeCount = parseLiteral(range2.count, scope); + return; + } else if (range2.step) { + params2.rangeStep = parseLiteral(range2.step, scope); + return; + } else if (isDiscrete(spec.type) && !isArray(range2)) { + return parseScaleDomain(range2, spec, scope); + } else if (!isArray(range2)) { + error("Unsupported range type: " + $(range2)); + } + return range2.map((v) => (isArray(v) ? parseArray : parseLiteral)(v, scope)); + } + function parseProjection(proj, scope) { + const config = scope.config.projection || {}, params2 = {}; + for (const name in proj) { + if (name === "name") continue; + params2[name] = parseParameter$1(proj[name], name, scope); + } + for (const name in config) { + if (params2[name] == null) { + params2[name] = parseParameter$1(config[name], name, scope); + } + } + scope.addProjection(proj.name, params2); + } + function parseParameter$1(_, name, scope) { + return isArray(_) ? _.map((_2) => parseParameter$1(_2, name, scope)) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === "fit" ? _ : error("Unsupported parameter object: " + $(_)); + } + const Top = "top"; + const Left = "left"; + const Right = "right"; + const Bottom = "bottom"; + const Center = "center"; + const Vertical = "vertical"; + const Start = "start"; + const Middle = "middle"; + const End = "end"; + const Index = "index"; + const Label = "label"; + const Offset = "offset"; + const Perc = "perc"; + const Perc2 = "perc2"; + const Value = "value"; + const GuideLabelStyle = "guide-label"; + const GuideTitleStyle = "guide-title"; + const GroupTitleStyle = "group-title"; + const GroupSubtitleStyle = "group-subtitle"; + const Symbols = "symbol"; + const Gradient = "gradient"; + const Discrete = "discrete"; + const Size = "size"; + const Shape = "shape"; + const Fill = "fill"; + const Stroke = "stroke"; + const StrokeWidth = "strokeWidth"; + const StrokeDash = "strokeDash"; + const Opacity = "opacity"; + const LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity]; + const Skip = { name: 1, style: 1, interactive: 1 -}; -const zero = { + }; + const zero = { value: 0 -}; -const one = { + }; + const one = { value: 1 -}; -const GroupMark = 'group'; -const RectMark = 'rect'; -const RuleMark = 'rule'; -const SymbolMark = 'symbol'; -const TextMark = 'text'; -function guideGroup(mark) { + }; + const GroupMark = "group"; + const RectMark = "rect"; + const RuleMark = "rule"; + const SymbolMark = "symbol"; + const TextMark = "text"; + function guideGroup(mark) { mark.type = GroupMark; mark.interactive = mark.interactive || false; return mark; -} -function lookup(spec, config) { - const _ = (name, dflt)=>value(spec[name], value(config[name], dflt)); - _.isVertical = (s)=>Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); - _.gradientLength = ()=>value(spec.gradientLength, config.gradientLength || config.gradientWidth); - _.gradientThickness = ()=>value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); - _.entryColumns = ()=>value(spec.columns, value(config.columns, +_.isVertical(true))); + } + function lookup(spec, config) { + const _ = (name, dflt) => value(spec[name], value(config[name], dflt)); + _.isVertical = (s2) => Vertical === value(spec.direction, config.direction || (s2 ? config.symbolDirection : config.gradientDirection)); + _.gradientLength = () => value(spec.gradientLength, config.gradientLength || config.gradientWidth); + _.gradientThickness = () => value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); + _.entryColumns = () => value(spec.columns, value(config.columns, +_.isVertical(true))); return _; -} -function getEncoding(name, encode) { - const v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]); + } + function getEncoding(name, encode2) { + const v = encode2 && (encode2.update && encode2.update[name] || encode2.enter && encode2.enter[name]); return v && v.signal ? v : v ? v.value : null; -} -function getStyle(name, scope, style) { - const s = scope.config.style[style]; - return s && s[name]; -} -function anchorExpr(s, e, m) { - return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`; -} -const alignExpr$1 = anchorExpr((0, _vegaUtil.stringValue)(Left), (0, _vegaUtil.stringValue)(Right), (0, _vegaUtil.stringValue)(Center)); -function tickBand(_) { - const v = _('tickBand'); - let offset = _('tickOffset'), band, extra; + } + function getStyle(name, scope, style2) { + const s2 = scope.config.style[style2]; + return s2 && s2[name]; + } + function anchorExpr(s2, e, m2) { + return `item.anchor === '${Start}' ? ${s2} : item.anchor === '${End}' ? ${e} : ${m2}`; + } + const alignExpr$1 = anchorExpr($(Left), $(Right), $(Center)); + function tickBand(_) { + const v = _("tickBand"); + let offset2 = _("tickOffset"), band2, extra; if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); + band2 = _("bandPosition"); + extra = _("tickExtra"); } else if (v.signal) { - // if signal, augment code to interpret values - band = { - signal: `(${v.signal}) === 'extent' ? 1 : 0.5` - }; - extra = { - signal: `(${v.signal}) === 'extent'` + band2 = { + signal: `(${v.signal}) === 'extent' ? 1 : 0.5` + }; + extra = { + signal: `(${v.signal}) === 'extent'` + }; + if (!isObject(offset2)) { + offset2 = { + signal: `(${v.signal}) === 'extent' ? 0 : ${offset2}` }; - if (!(0, _vegaUtil.isObject)(offset)) offset = { - signal: `(${v.signal}) === 'extent' ? 0 : ${offset}` - }; - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; + } + } else if (v === "extent") { + band2 = 1; + extra = true; + offset2 = 0; } else { - band = 0.5; - extra = false; + band2 = 0.5; + extra = false; } return { - extra, - band, - offset - }; -} -function extendOffset(value, offset) { - return !offset ? value : !value ? offset : !(0, _vegaUtil.isObject)(value) ? { - value, - offset - } : Object.assign({}, value, { - offset: extendOffset(value.offset, offset) + extra, + band: band2, + offset: offset2 + }; + } + function extendOffset(value2, offset2) { + return !offset2 ? value2 : !value2 ? offset2 : !isObject(value2) ? { + value: value2, + offset: offset2 + } : Object.assign({}, value2, { + offset: extendOffset(value2.offset, offset2) }); -} -function guideMark(mark, extras) { + } + function guideMark(mark, extras) { if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip); - } else mark.interactive = false; + mark.name = extras.name; + mark.style = extras.style || mark.style; + mark.interactive = !!extras.interactive; + mark.encode = extendEncode(mark.encode, extras, Skip); + } else { + mark.interactive = false; + } return mark; -} -function legendGradient(spec, scale, config, userEncode) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let enter, start, stop, width, height; + } + function legendGradient(spec, scale2, config, userEncode) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let enter, start, stop2, width2, height2; if (vertical) { - start = [ - 0, - 1 - ]; - stop = [ - 0, - 0 - ]; - width = thickness; - height = length; + start = [0, 1]; + stop2 = [0, 0]; + width2 = thickness; + height2 = length2; } else { - start = [ - 0, - 0 - ]; - stop = [ - 1, - 0 - ]; - width = length; - height = thickness; - } - const encode = { - enter: enter = { - opacity: zero, - x: zero, - y: zero, - width: encoder(width), - height: encoder(height) - }, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one, - fill: { - gradient: scale, - start: start, - stop: stop - } - }), - exit: { - opacity: zero + start = [0, 0]; + stop2 = [1, 0]; + width2 = length2; + height2 = thickness; + } + const encode2 = { + enter: enter = { + opacity: zero, + x: zero, + y: zero, + width: encoder(width2), + height: encoder(height2) + }, + update: extend({}, enter, { + opacity: one, + fill: { + gradient: scale2, + start, + stop: stop2 } + }), + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode + type: RectMark, + role: LegendGradientRole, + encode: encode2 }, userEncode); -} -function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let u, v, uu, vv, adjust = ''; - vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); + } + function legendGradientDiscrete(spec, scale2, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let u2, v, uu, vv, adjust = ""; + vertical ? (u2 = "y", uu = "y2", v = "x", vv = "width", adjust = "1-") : (u2 = "x", uu = "x2", v = "y", vv = "height"); const enter = { - opacity: zero, - fill: { - scale: scale, - field: Value - } + opacity: zero, + fill: { + scale: scale2, + field: Value + } }; - enter[u] = { - signal: adjust + 'datum.' + Perc, - mult: length + enter[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 }; enter[v] = zero; enter[uu] = { - signal: adjust + 'datum.' + Perc2, - mult: length + signal: adjust + "datum." + Perc2, + mult: length2 }; enter[vv] = encoder(thickness); - const encode = { - enter: enter, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one - }), - exit: { - opacity: zero - } + const encode2 = { + enter, + update: extend({}, enter, { + opacity: one + }), + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode + type: RectMark, + role: LegendBandRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; -function legendGradientLabels(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length = _.gradientLength(); - let overlap = _('labelOverlap'), enter, update, u, v, adjust = ''; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one, - text: { - field: Label - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value(spec.labelLimit, config.gradientLabelLimit) + } + const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; + function legendGradientLabels(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length2 = _.gradientLength(); + let overlap = _("labelOverlap"), enter, update2, u2, v, adjust = ""; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one, + text: { + field: Label + } + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: value(spec.labelLimit, config.gradientLabelLimit) }); if (vertical) { - enter.align = { - value: 'left' - }; - enter.baseline = update.baseline = { - signal: baselineExpr - }; - u = 'y'; - v = 'x'; - adjust = '1-'; + enter.align = { + value: "left" + }; + enter.baseline = update2.baseline = { + signal: baselineExpr + }; + u2 = "y"; + v = "x"; + adjust = "1-"; } else { - enter.align = update.align = { - signal: alignExpr - }; - enter.baseline = { - value: 'top' - }; - u = 'x'; - v = 'y'; - } - enter[u] = update[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = update[v] = thickness; + enter.align = update2.align = { + signal: alignExpr + }; + enter.baseline = { + value: "top" + }; + u2 = "x"; + v = "y"; + } + enter[u2] = update2[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 + }; + enter[v] = update2[v] = thickness; thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0; overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - // type, role, style, key, dataRef, encode, extras + separation: _("labelSeparation"), + method: overlap, + order: "datum." + Index + } : void 0; return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -// userEncode is top-level, includes entries, symbols, labels -function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - const _ = lookup(spec, config), entries = userEncode.entries, interactive = !!(entries && entries.interactive), name = entries ? entries.name : undefined, height = _('clipHeight'), symbolOffset = _('symbolOffset'), valueRef = { - data: 'value' - }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height ? encoder(height) : { - field: Size - }, index = `datum.${Index}`, ncols = `max(1, ${columns})`; - let encode, enter, update, nrows, sort; + } + function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { + const _ = lookup(spec, config), entries = userEncode.entries, interactive2 = !!(entries && entries.interactive), name = entries ? entries.name : void 0, height2 = _("clipHeight"), symbolOffset = _("symbolOffset"), valueRef = { + data: "value" + }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height2 ? encoder(height2) : { + field: Size + }, index2 = `datum.${Index}`, ncols = `max(1, ${columns})`; + let encode2, enter, update2, nrows, sort2; yEncode.mult = 0.5; - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - mult: 0.5, - offset: symbolOffset - }, - y: yEncode - }, - update: update = { - opacity: one, - x: enter.x, - y: enter.y + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + mult: 0.5, + offset: symbolOffset }, - exit: { - opacity: zero - } + y: yEncode + }, + update: update2 = { + opacity: one, + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } }; let baseFill = null, baseStroke = null; if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') + baseFill = config.symbolBaseFillColor; + baseStroke = config.symbolBaseStrokeColor; + } + addEncoders(encode2, { + fill: _("symbolFillColor", baseFill), + shape: _("symbolType"), + size: _("symbolSize"), + stroke: _("symbolStrokeColor", baseStroke), + strokeDash: _("symbolDash"), + strokeDashOffset: _("symbolDashOffset"), + strokeWidth: _("symbolStrokeWidth") }, { - // update - opacity: _('symbolOpacity') + // update + opacity: _("symbolOpacity") }); - LegendScales.forEach((scale)=>{ - if (spec[scale]) update[scale] = enter[scale] = { - scale: spec[scale], - field: Value + LegendScales.forEach((scale2) => { + if (spec[scale2]) { + update2[scale2] = enter[scale2] = { + scale: spec[scale2], + field: Value }; + } }); - const symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode + const symbols2 = guideMark({ + type: SymbolMark, + role: LegendSymbolRole, + key: Value, + from: valueRef, + clip: height2 ? true : void 0, + encode: encode2 }, userEncode.symbols); - // -- LEGEND LABELS -- const labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - offset: labelOffset - }, - y: yEncode + labelOffset.offset = _("labelOffset"); + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + offset: labelOffset }, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y + y: yEncode + }, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + align: _("labelAlign"), + baseline: _("labelBaseline"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: _("labelLimit") }); const labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: valueRef, + encode: encode2 }, userEncode.labels); - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: { - value: !height - }, - // ignore width/height in bounds calc - width: zero, - height: height ? encoder(height) : zero, - opacity: zero - }, - exit: { - opacity: zero + encode2 = { + enter: { + noBound: { + value: !height2 + }, + // ignore width/height in bounds calc + width: zero, + height: height2 ? encoder(height2) : zero, + opacity: zero + }, + exit: { + opacity: zero + }, + update: update2 = { + opacity: one, + row: { + signal: null }, - update: update = { - opacity: one, - row: { - signal: null - }, - column: { - signal: null - } + column: { + signal: null } + } }; - // annotate and sort groups to ensure correct ordering if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = { - field: [ - 'row', - index - ] - }; + nrows = `ceil(item.mark.items.length / ${ncols})`; + update2.row.signal = `${index2}%${nrows}`; + update2.column.signal = `floor(${index2} / ${nrows})`; + sort2 = { + field: ["row", index2] + }; } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = { - field: index - }; + update2.row.signal = `floor(${index2} / ${ncols})`; + update2.column.signal = `${index2} % ${ncols}`; + sort2 = { + field: index2 + }; } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - // facet legend entries into sub-groups + update2.column.signal = `(${columns})?${update2.column.signal}:${index2}`; dataRef = { - facet: { - data: dataRef, - name: 'value', - groupby: Index - } + facet: { + data: dataRef, + name: "value", + groupby: Index + } }; return guideGroup({ - role: ScopeRole, - from: dataRef, - encode: extendEncode(encode, entries, Skip), - marks: [ - symbols, - labels - ], - name, - interactive, - sort + role: ScopeRole, + from: dataRef, + encode: extendEncode(encode2, entries, Skip), + marks: [symbols2, labels], + name, + interactive: interactive2, + sort: sort2 }); -} -function legendSymbolLayout(spec, config) { + } + function legendSymbolLayout(spec, config) { const _ = lookup(spec, config); - // layout parameters for legend entries return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } + align: _("gridAlign"), + columns: _.entryColumns(), + center: { + row: true, + column: false + }, + padding: { + row: _("rowPadding"), + column: _("columnPadding") + } }; -} -// expression logic for align, anchor, angle, and baseline calculation -const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; -function legendTitle(spec, config, userEncode, dataRef) { + } + const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; + function legendTitle(spec, config, userEncode, dataRef) { const _ = lookup(spec, config); - const encode = { - enter: { - opacity: zero - }, - update: { - opacity: one, - x: { - field: { - group: 'padding' - } - }, - y: { - field: { - group: 'padding' - } - } - }, - exit: { - opacity: zero + const encode2 = { + enter: { + opacity: zero + }, + update: { + opacity: one, + x: { + field: { + group: "padding" + } + }, + y: { + field: { + group: "padding" + } } + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: { - signal: exprAnchor - }, - angle: { - signal: exprAngle - }, - align: { - signal: exprAlign - }, - baseline: { - signal: exprBaseline - }, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + addEncoders(encode2, { + orient: _("titleOrient"), + _anchor: _("titleAnchor"), + anchor: { + signal: exprAnchor + }, + angle: { + signal: exprAngle + }, + align: { + signal: exprAlign + }, + baseline: { + signal: exprBaseline + }, + text: spec.title, + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - baseline: _('titleBaseline') + // require update + align: _("titleAlign"), + baseline: _("titleBaseline") }); return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: LegendTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function clip(clip, scope) { - let expr; - if ((0, _vegaUtil.isObject)(clip)) { - if (clip.signal) expr = clip.signal; - else if (clip.path) expr = 'pathShape(' + param(clip.path) + ')'; - else if (clip.sphere) expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - return expr ? scope.signalRef(expr) : !!clip; -} -function param(value) { - return (0, _vegaUtil.isObject)(value) && value.signal ? value.signal : (0, _vegaUtil.stringValue)(value); -} -function getRole(spec) { - const role = spec.role || ''; - return role.startsWith('axis') || role.startsWith('legend') || role.startsWith('title') ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; -} -function definition(spec) { + } + function clip(clip2, scope) { + let expr2; + if (isObject(clip2)) { + if (clip2.signal) { + expr2 = clip2.signal; + } else if (clip2.path) { + expr2 = "pathShape(" + param(clip2.path) + ")"; + } else if (clip2.sphere) { + expr2 = "geoShape(" + param(clip2.sphere) + ', {type: "Sphere"})'; + } + } + return expr2 ? scope.signalRef(expr2) : !!clip2; + } + function param(value2) { + return isObject(value2) && value2.signal ? value2.signal : $(value2); + } + function getRole(spec) { + const role = spec.role || ""; + return role.startsWith("axis") || role.startsWith("legend") || role.startsWith("title") ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; + } + function definition(spec) { return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; -} -function interactive(spec, scope) { + marktype: spec.type, + name: spec.name || void 0, + role: spec.role || getRole(spec), + zindex: +spec.zindex || void 0, + aria: spec.aria, + description: spec.description + }; + } + function interactive(spec, scope) { return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true; -} -/** - * Parse a data transform specification. - */ function parseTransform(spec, scope) { - const def = (0, _vegaDataflow.definition)(spec.type); - if (!def) (0, _vegaUtil.error)('Unrecognized transform type: ' + (0, _vegaUtil.stringValue)(spec.type)); - const t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope)); + } + function parseTransform(spec, scope) { + const def2 = definition$1(spec.type); + if (!def2) error("Unrecognized transform type: " + $(spec.type)); + const t = entry(def2.type.toLowerCase(), null, parseParameters(def2, spec, scope)); if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; + t.metadata = def2.metadata || {}; return t; -} -/** - * Parse all parameters of a data transform. - */ function parseParameters(def, spec, scope) { - const params = {}, n = def.params.length; - for(let i = 0; i < n; ++i){ - const pdef = def.params[i]; - params[pdef.name] = parseParameter(pdef, spec, scope); - } - return params; -} -/** - * Parse a data transform parameter. - */ function parseParameter(def, spec, scope) { - const type = def.type, value = spec[def.name]; - if (type === 'index') return parseIndexParameter(def, spec, scope); - else if (value === undefined) { - if (def.required) (0, _vegaUtil.error)('Missing required ' + (0, _vegaUtil.stringValue)(spec.type) + ' parameter: ' + (0, _vegaUtil.stringValue)(def.name)); - return; - } else if (type === 'param') return parseSubParameters(def, spec, scope); - else if (type === 'projection') return scope.projectionRef(spec[def.name]); - return def.array && !isSignal(value) ? value.map((v)=>parameterValue(def, v, scope)) : parameterValue(def, value, scope); -} -/** - * Parse a single parameter value. - */ function parameterValue(def, value, scope) { - const type = def.type; - if (isSignal(value)) return isExpr(type) ? (0, _vegaUtil.error)('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal); - else { - const expr = def.expr || isField(type); - return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : isExpr(type) ? (0, _vegaFunctions.parseExpression)(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value; - } -} -/** - * Parse parameter for accessing an index of another data set. - */ function parseIndexParameter(def, spec, scope) { - if (!(0, _vegaUtil.isString)(spec.from)) (0, _vegaUtil.error)('Lookup "from" parameter must be a string literal.'); + } + function parseParameters(def2, spec, scope) { + const params2 = {}, n = def2.params.length; + for (let i = 0; i < n; ++i) { + const pdef = def2.params[i]; + params2[pdef.name] = parseParameter(pdef, spec, scope); + } + return params2; + } + function parseParameter(def2, spec, scope) { + const type2 = def2.type, value2 = spec[def2.name]; + if (type2 === "index") { + return parseIndexParameter(def2, spec, scope); + } else if (value2 === void 0) { + if (def2.required) { + error("Missing required " + $(spec.type) + " parameter: " + $(def2.name)); + } + return; + } else if (type2 === "param") { + return parseSubParameters(def2, spec, scope); + } else if (type2 === "projection") { + return scope.projectionRef(spec[def2.name]); + } + return def2.array && !isSignal(value2) ? value2.map((v) => parameterValue(def2, v, scope)) : parameterValue(def2, value2, scope); + } + function parameterValue(def2, value2, scope) { + const type2 = def2.type; + if (isSignal(value2)) { + return isExpr(type2) ? error("Expression references can not be signals.") : isField(type2) ? scope.fieldRef(value2) : isCompare(type2) ? scope.compareRef(value2) : scope.signalRef(value2.signal); + } else { + const expr2 = def2.expr || isField(type2); + return expr2 && outerExpr(value2) ? scope.exprRef(value2.expr, value2.as) : expr2 && outerField(value2) ? fieldRef$1(value2.field, value2.as) : isExpr(type2) ? parser(value2, scope) : isData(type2) ? ref(scope.getData(value2).values) : isField(type2) ? fieldRef$1(value2) : isCompare(type2) ? scope.compareRef(value2) : value2; + } + } + function parseIndexParameter(def2, spec, scope) { + if (!isString(spec.from)) { + error('Lookup "from" parameter must be a string literal.'); + } return scope.getData(spec.from).lookupRef(scope, spec.key); -} -/** - * Parse a parameter that contains one or more sub-parameter objects. - */ function parseSubParameters(def, spec, scope) { - const value = spec[def.name]; - if (def.array) { - if (!(0, _vegaUtil.isArray)(value)) // signals not allowed! - (0, _vegaUtil.error)('Expected an array of sub-parameters. Instead: ' + (0, _vegaUtil.stringValue)(value)); - return value.map((v)=>parseSubParameter(def, v, scope)); - } else return parseSubParameter(def, value, scope); -} -/** - * Parse a sub-parameter object. - */ function parseSubParameter(def, value, scope) { - const n = def.params.length; + } + function parseSubParameters(def2, spec, scope) { + const value2 = spec[def2.name]; + if (def2.array) { + if (!isArray(value2)) { + error("Expected an array of sub-parameters. Instead: " + $(value2)); + } + return value2.map((v) => parseSubParameter(def2, v, scope)); + } else { + return parseSubParameter(def2, value2, scope); + } + } + function parseSubParameter(def2, value2, scope) { + const n = def2.params.length; let pdef; - // loop over defs to find matching key - for(let i = 0; i < n; ++i){ - pdef = def.params[i]; - for(const k in pdef.key)if (pdef.key[k] !== value[k]) { - pdef = null; - break; + for (let i = 0; i < n; ++i) { + pdef = def2.params[i]; + for (const k in pdef.key) { + if (pdef.key[k] !== value2[k]) { + pdef = null; + break; } - if (pdef) break; - } - // raise error if matching key not found - if (!pdef) (0, _vegaUtil.error)('Unsupported parameter: ' + (0, _vegaUtil.stringValue)(value)); - // parse params, create Params transform, return ref - const params = (0, _vegaUtil.extend)(parseParameters(pdef, value, scope), pdef.key); - return ref(scope.add(Params(params))); -} -// -- Utilities ----- -const outerExpr = (_)=>_ && _.expr; -const outerField = (_)=>_ && _.field; -const isData = (_)=>_ === 'data'; -const isExpr = (_)=>_ === 'expr'; -const isField = (_)=>_ === 'field'; -const isCompare = (_)=>_ === 'compare'; -function parseData$1(from, group, scope) { - let facet, key, op, dataRef, parent; - // if no source data, generate singleton datum - if (!from) dataRef = ref(scope.add(Collect(null, [ - {} - ]))); - else if (facet = from.facet) { - if (!group) (0, _vegaUtil.error)('Only group marks can be faceted.'); - // use pre-faceted source data, if available - if (facet.field != null) dataRef = parent = getDataRef(facet, scope); - else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform((0, _vegaUtil.extend)({ - type: 'aggregate', - groupby: (0, _vegaUtil.array)(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else parent = ref(scope.getData(from.data).aggregate); - key = scope.keyRef(facet.groupby, true); - } - } - // if not yet defined, get source data reference - if (!dataRef) dataRef = getDataRef(from, scope); + } + if (pdef) break; + } + if (!pdef) error("Unsupported parameter: " + $(value2)); + const params2 = extend(parseParameters(pdef, value2, scope), pdef.key); + return ref(scope.add(Params(params2))); + } + const outerExpr = (_) => _ && _.expr; + const outerField = (_) => _ && _.field; + const isData = (_) => _ === "data"; + const isExpr = (_) => _ === "expr"; + const isField = (_) => _ === "field"; + const isCompare = (_) => _ === "compare"; + function parseData$1(from, group2, scope) { + let facet, key2, op, dataRef, parent; + if (!from) { + dataRef = ref(scope.add(Collect(null, [{}]))); + } else if (facet = from.facet) { + if (!group2) error("Only group marks can be faceted."); + if (facet.field != null) { + dataRef = parent = getDataRef(facet, scope); + } else { + if (!from.data) { + op = parseTransform(extend({ + type: "aggregate", + groupby: array$4(facet.groupby) + }, facet.aggregate), scope); + op.params.key = scope.keyRef(facet.groupby); + op.params.pulse = getDataRef(facet, scope); + dataRef = parent = ref(scope.add(op)); + } else { + parent = ref(scope.getData(from.data).aggregate); + } + key2 = scope.keyRef(facet.groupby, true); + } + } + if (!dataRef) { + dataRef = getDataRef(from, scope); + } return { - key: key, - pulse: dataRef, - parent: parent + key: key2, + pulse: dataRef, + parent }; -} -function getDataRef(from, scope) { + } + function getDataRef(from, scope) { return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output); -} -function DataScope(scope, input, output, values, aggr) { - this.scope = scope; // parent scope object - this.input = input; // first operator in pipeline (tuple input) - this.output = output; // last operator in pipeline (tuple output) - this.values = values; // operator for accessing tuples (but not tuple flow) - // last aggregate in transform pipeline + } + function DataScope(scope, input, output2, values2, aggr) { + this.scope = scope; + this.input = input; + this.output = output2; + this.values = values2; this.aggregate = aggr; - // lookup table of field indices this.index = {}; -} -DataScope.fromEntries = function(scope, entries) { - const n = entries.length, values = entries[n - 1], output = entries[n - 2]; + } + DataScope.fromEntries = function(scope, entries) { + const n = entries.length, values2 = entries[n - 1], output2 = entries[n - 2]; let input = entries[0], aggr = null, i = 1; - if (input && input.type === 'load') input = entries[1]; - // add operator entries to this scope, wire up pulse chain + if (input && input.type === "load") { + input = entries[1]; + } scope.add(entries[0]); - for(; i < n; ++i){ - entries[i].params.pulse = ref(entries[i - 1]); - scope.add(entries[i]); - if (entries[i].type === 'aggregate') aggr = entries[i]; - } - return new DataScope(scope, input, output, values, aggr); -}; -function fieldKey(field) { - return (0, _vegaUtil.isString)(field) ? field : null; -} -function addSortField(scope, p, sort) { - const as = aggrField(sort.op, sort.field); - let s; - if (p.ops) for(let i = 0, n = p.as.length; i < n; ++i){ - if (p.as[i] === as) return; + for (; i < n; ++i) { + entries[i].params.pulse = ref(entries[i - 1]); + scope.add(entries[i]); + if (entries[i].type === "aggregate") aggr = entries[i]; } - else { - p.ops = [ - 'count' - ]; - p.fields = [ - null - ]; - p.as = [ - 'count' - ]; + return new DataScope(scope, input, output2, values2, aggr); + }; + function fieldKey(field2) { + return isString(field2) ? field2 : null; + } + function addSortField(scope, p, sort2) { + const as = aggrField(sort2.op, sort2.field); + let s2; + if (p.ops) { + for (let i = 0, n = p.as.length; i < n; ++i) { + if (p.as[i] === as) return; + } + } else { + p.ops = ["count"]; + p.fields = [null]; + p.as = ["count"]; } - if (sort.op) { - p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op); - p.fields.push(scope.fieldRef(sort.field)); - p.as.push(as); + if (sort2.op) { + p.ops.push((s2 = sort2.op.signal) ? scope.signalRef(s2) : sort2.op); + p.fields.push(scope.fieldRef(sort2.field)); + p.as.push(as); } -} -function cache(scope, ds, name, optype, field, counts, index) { - const cache = ds[name] || (ds[name] = {}), sort = sortKey(counts); - let k = fieldKey(field), v, op; + } + function cache(scope, ds, name, optype, field2, counts, index2) { + const cache2 = ds[name] || (ds[name] = {}), sort2 = sortKey(counts); + let k = fieldKey(field2), v, op; if (k != null) { - scope = ds.scope; - k = k + (sort ? '|' + sort : ''); - v = cache[k]; + scope = ds.scope; + k = k + (sort2 ? "|" + sort2 : ""); + v = cache2[k]; } if (!v) { - const params = counts ? { - field: keyFieldRef, - pulse: ds.countsRef(scope, field, counts) - } : { - field: scope.fieldRef(field), - pulse: ref(ds.output) - }; - if (sort) params.sort = scope.sortRef(counts); - op = scope.add(entry(optype, undefined, params)); - if (index) ds.index[field] = op; - v = ref(op); - if (k != null) cache[k] = v; + const params2 = counts ? { + field: keyFieldRef, + pulse: ds.countsRef(scope, field2, counts) + } : { + field: scope.fieldRef(field2), + pulse: ref(ds.output) + }; + if (sort2) params2.sort = scope.sortRef(counts); + op = scope.add(entry(optype, void 0, params2)); + if (index2) ds.index[field2] = op; + v = ref(op); + if (k != null) cache2[k] = v; } return v; -} -DataScope.prototype = { - countsRef (scope, field, sort) { - const ds = this, cache = ds.counts || (ds.counts = {}), k = fieldKey(field); - let v, a, p; - if (k != null) { - scope = ds.scope; - v = cache[k]; - } - if (!v) { - p = { - groupby: scope.fieldRef(field, 'key'), - pulse: ref(ds.output) - }; - if (sort && sort.field) addSortField(scope, p, sort); - a = scope.add(Aggregate(p)); - v = scope.add(Collect({ - pulse: ref(a) - })); - v = { - agg: a, - ref: ref(v) - }; - if (k != null) cache[k] = v; - } else if (sort && sort.field) addSortField(scope, v.agg.params, sort); - return v.ref; + } + DataScope.prototype = { + countsRef(scope, field2, sort2) { + const ds = this, cache2 = ds.counts || (ds.counts = {}), k = fieldKey(field2); + let v, a2, p; + if (k != null) { + scope = ds.scope; + v = cache2[k]; + } + if (!v) { + p = { + groupby: scope.fieldRef(field2, "key"), + pulse: ref(ds.output) + }; + if (sort2 && sort2.field) addSortField(scope, p, sort2); + a2 = scope.add(Aggregate(p)); + v = scope.add(Collect({ + pulse: ref(a2) + })); + v = { + agg: a2, + ref: ref(v) + }; + if (k != null) cache2[k] = v; + } else if (sort2 && sort2.field) { + addSortField(scope, v.agg.params, sort2); + } + return v.ref; }, - tuplesRef () { - return ref(this.values); + tuplesRef() { + return ref(this.values); }, - extentRef (scope, field) { - return cache(scope, this, 'extent', 'extent', field, false); + extentRef(scope, field2) { + return cache(scope, this, "extent", "extent", field2, false); }, - domainRef (scope, field) { - return cache(scope, this, 'domain', 'values', field, false); + domainRef(scope, field2) { + return cache(scope, this, "domain", "values", field2, false); }, - valuesRef (scope, field, sort) { - return cache(scope, this, 'vals', 'values', field, sort || true); + valuesRef(scope, field2, sort2) { + return cache(scope, this, "vals", "values", field2, sort2 || true); }, - lookupRef (scope, field) { - return cache(scope, this, 'lookup', 'tupleindex', field, false); + lookupRef(scope, field2) { + return cache(scope, this, "lookup", "tupleindex", field2, false); }, - indataRef (scope, field) { - return cache(scope, this, 'indata', 'tupleindex', field, true, true); + indataRef(scope, field2) { + return cache(scope, this, "indata", "tupleindex", field2, true, true); } -}; -function parseFacet(spec, scope, group) { - const facet = spec.from.facet, name = facet.name, data = getDataRef(facet, scope); + }; + function parseFacet(spec, scope, group2) { + const facet = spec.from.facet, name = facet.name, data2 = getDataRef(facet, scope); let op; - if (!facet.name) (0, _vegaUtil.error)('Facet must have a name: ' + (0, _vegaUtil.stringValue)(facet)); - if (!facet.data) (0, _vegaUtil.error)('Facet must reference a data set: ' + (0, _vegaUtil.stringValue)(facet)); - if (facet.field) op = scope.add(PreFacet({ + if (!facet.name) { + error("Facet must have a name: " + $(facet)); + } + if (!facet.data) { + error("Facet must reference a data set: " + $(facet)); + } + if (facet.field) { + op = scope.add(PreFacet({ field: scope.fieldRef(facet.field), - pulse: data - })); - else if (facet.groupby) op = scope.add(Facet({ + pulse: data2 + })); + } else if (facet.groupby) { + op = scope.add(Facet({ key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - else (0, _vegaUtil.error)('Facet must specify groupby or field: ' + (0, _vegaUtil.stringValue)(facet)); - // initialize facet subscope - const subscope = scope.fork(), source = subscope.add(Collect()), values = subscope.add(Sieve({ - pulse: ref(source) + group: ref(scope.proxy(group2.parent)), + pulse: data2 + })); + } else { + error("Facet must specify groupby or field: " + $(facet)); + } + const subscope = scope.fork(), source2 = subscope.add(Collect()), values2 = subscope.add(Sieve({ + pulse: ref(source2) })); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); - // parse faceted subflow + subscope.addData(name, new DataScope(subscope, source2, source2, values2)); + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() + $subflow: subscope.parse(spec).toRuntime() }; -} -function parseSubflow(spec, scope, input) { + } + function parseSubflow(spec, scope, input) { const op = scope.add(PreFacet({ - pulse: input.pulse + pulse: input.pulse })), subscope = scope.fork(); subscope.add(Sieve()); - subscope.addSignal('parent', null); - // parse group mark subflow + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} -function parseTrigger(spec, scope, name) { - const remove = spec.remove, insert = spec.insert, toggle = spec.toggle, modify = spec.modify, values = spec.values, op = scope.add(operator()); - const update = 'if(' + spec.trigger + ',modify("' + name + '",' + [ - insert, - remove, - toggle, - modify, - values - ].map((_)=>_ == null ? 'null' : _).join(',') + '),0)'; - const expr = (0, _vegaFunctions.parseExpression)(update, scope); - op.update = expr.$expr; - op.params = expr.$params; -} -function parseMark(spec, scope) { - const role = getRole(spec), group = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; - let layout = spec.layout || role === ScopeRole || role === FrameRole, ops, op, store, enc, name, layoutRef, boundRef; + $subflow: subscope.parse(spec).toRuntime() + }; + } + function parseTrigger(spec, scope, name) { + const remove2 = spec.remove, insert2 = spec.insert, toggle = spec.toggle, modify2 = spec.modify, values2 = spec.values, op = scope.add(operator()); + const update2 = "if(" + spec.trigger + ',modify("' + name + '",' + [insert2, remove2, toggle, modify2, values2].map((_) => _ == null ? "null" : _).join(",") + "),0)"; + const expr2 = parser(update2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + function parseMark(spec, scope) { + const role = getRole(spec), group2 = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; + let layout = spec.layout || role === ScopeRole || role === FrameRole, ops2, op, store, enc, name, layoutRef, boundRef; const nested = role === MarkRole || layout || facet; - // resolve input data - const input = parseData$1(spec.from, group, scope); - // data join to map tuples to visual items + const input = parseData$1(spec.from, group2, scope); op = scope.add(DataJoin({ - key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined), - pulse: input.pulse, - clean: !group + key: input.key || (spec.key ? fieldRef$1(spec.key) : void 0), + pulse: input.pulse, + clean: !group2 })); const joinRef = ref(op); - // collect visual items op = store = scope.add(Collect({ - pulse: joinRef + pulse: joinRef })); - // connect visual items to scenegraph op = scope.add(Mark({ - markdef: definition(spec), - interactive: interactive(spec.interactive, scope), - clip: clip(spec.clip, scope), - context: { - $context: true - }, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) + markdef: definition(spec), + interactive: interactive(spec.interactive, scope), + clip: clip(spec.clip, scope), + context: { + $context: true + }, + groups: scope.lookup(), + parent: scope.signals.parent ? scope.signalRef("parent") : null, + index: scope.markpath(), + pulse: ref(op) })); const markRef = ref(op); - // add visual encoders op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, { - mod: false, - pulse: markRef + mod: false, + pulse: markRef }))); - // monitor parent marks to propagate changes op.params.parent = scope.encode(); - // add post-encoding transforms, if defined - if (spec.transform) spec.transform.forEach((_)=>{ - const tx = parseTransform(_, scope), md = tx.metadata; - if (md.generates || md.changes) (0, _vegaUtil.error)('Mark transforms should not generate new data.'); - if (!md.nomod) enc.params.mod = true; // update encode mod handling - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - // if item sort specified, perform post-encoding - if (spec.sort) op = scope.add(SortItems({ + if (spec.transform) { + spec.transform.forEach((_) => { + const tx2 = parseTransform(_, scope), md2 = tx2.metadata; + if (md2.generates || md2.changes) { + error("Mark transforms should not generate new data."); + } + if (!md2.nomod) enc.params.mod = true; + tx2.params.pulse = ref(op); + scope.add(op = tx2); + }); + } + if (spec.sort) { + op = scope.add(SortItems({ sort: scope.compareRef(spec.sort), pulse: ref(op) - })); + })); + } const encodeRef = ref(op); - // add view layout operator if needed if (facet || layout) { - layout = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); - } - // compute bounding boxes - const bound = scope.add(Bound({ + layout = scope.add(ViewLayout({ + layout: scope.objectProperty(spec.layout), + legends: scope.legends, mark: markRef, - pulse: layoutRef || encodeRef + pulse: encodeRef + })); + layoutRef = ref(layout); + } + const bound2 = scope.add(Bound({ + mark: markRef, + pulse: layoutRef || encodeRef })); - boundRef = ref(bound); - // if group mark, recurse to parse nested content - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { - ops = scope.operators; - ops.pop(); - if (layout) ops.pop(); - } - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - scope.popState(); - if (nested) { - if (layout) ops.push(layout); - ops.push(bound); - } - } - // if requested, add overlap removal transform - if (overlap) boundRef = parseOverlap(overlap, boundRef, scope); - // render / sieve items + boundRef = ref(bound2); + if (group2) { + if (nested) { + ops2 = scope.operators; + ops2.pop(); + if (layout) ops2.pop(); + } + scope.pushState(encodeRef, layoutRef || boundRef, joinRef); + facet ? parseFacet(spec, scope, input) : nested ? parseSubflow(spec, scope, input) : scope.parse(spec); + scope.popState(); + if (nested) { + if (layout) ops2.push(layout); + ops2.push(bound2); + } + } + if (overlap) { + boundRef = parseOverlap(overlap, boundRef, scope); + } const render = scope.add(Render({ - pulse: boundRef + pulse: boundRef })), sieve = scope.add(Sieve({ - pulse: ref(render) - }, undefined, scope.parent())); - // if mark is named, make accessible as reactive geometry - // add trigger updates if defined + pulse: ref(render) + }, void 0, scope.parent())); if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach((on)=>{ - if (on.insert || on.remove || on.toggle) (0, _vegaUtil.error)('Marks only support modify triggers.'); - parseTrigger(on, scope, name); - }); + name = spec.name; + scope.addData(name, new DataScope(scope, store, render, sieve)); + if (spec.on) spec.on.forEach((on2) => { + if (on2.insert || on2.remove || on2.toggle) { + error("Marks only support modify triggers."); + } + parseTrigger(on2, scope, name); + }); } -} -function parseOverlap(overlap, source, scope) { - const method = overlap.method, bound = overlap.bound, sep = overlap.separation; - const params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - if (overlap.order) params.sort = scope.compareRef({ + } + function parseOverlap(overlap, source2, scope) { + const method2 = overlap.method, bound2 = overlap.bound, sep = overlap.separation; + const params2 = { + separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, + method: isSignal(method2) ? scope.signalRef(method2.signal) : method2, + pulse: source2 + }; + if (overlap.order) { + params2.sort = scope.compareRef({ field: overlap.order - }); - if (bound) { - const tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - return ref(scope.add(Overlap(params))); -} -function parseLegend(spec, scope) { - const config = scope.config.legend, encode = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode.legend || {}, name = legendEncode.name || undefined, interactive = legendEncode.interactive, style = legendEncode.style, scales = {}; - let scale = 0, entryLayout, params, children; - // resolve scales and 'canonical' scale name - LegendScales.forEach((s)=>spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0); - if (!scale) (0, _vegaUtil.error)('Missing valid scale for legend.'); - // resolve legend type (symbol, gradient, or discrete gradient) - const type = legendType(spec, scope.scaleType(scale)); - // single-element data source for legend group - const datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - const dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // encoding properties for legend entry sub-group + }); + } + if (bound2) { + const tol = bound2.tolerance; + params2.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; + params2.boundScale = scope.scaleRef(bound2.scale); + params2.boundOrient = bound2.orient; + } + return ref(scope.add(Overlap(params2))); + } + function parseLegend(spec, scope) { + const config = scope.config.legend, encode2 = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode2.legend || {}, name = legendEncode.name || void 0, interactive2 = legendEncode.interactive, style2 = legendEncode.style, scales2 = {}; + let scale2 = 0, entryLayout, params2, children2; + LegendScales.forEach((s2) => spec[s2] ? (scales2[s2] = spec[s2], scale2 = scale2 || spec[s2]) : 0); + if (!scale2) error("Missing valid scale for legend."); + const type2 = legendType(spec, scope.scaleType(scale2)); + const datum2 = { + title: spec.title != null, + scales: scales2, + type: type2, + vgrad: type2 !== "symbol" && _.isVertical() + }; + const dataRef = ref(scope.add(Collect(null, [datum2]))); const entryEncode = { - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } + enter: { + x: { + value: 0 + }, + y: { + value: 0 } + } }; - // data source for legend values - const entryRef = ref(scope.add(LegendEntries(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + const entryRef = ref(scope.add(LegendEntries(params2 = { + type: type2, + scale: scope.scaleRef(scale2), + count: scope.objectProperty(_("tickCount")), + limit: scope.property(_("symbolLimit")), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // continuous gradient legend - if (type === Gradient) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); - } else if (type === Discrete) children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - // include legend title if defined - if (datum.title) children.push(legendTitle(spec, config, encode.title, dataRef)); - // parse legend specification + if (type2 === Gradient) { + children2 = [legendGradient(spec, scale2, config, encode2.gradient), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + params2.count = params2.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); + } else if (type2 === Discrete) { + children2 = [legendGradientDiscrete(spec, scale2, config, encode2.gradient, entryRef), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + } else { + entryLayout = legendSymbolLayout(spec, config); + children2 = [legendSymbolGroups(spec, config, encode2, entryRef, deref(entryLayout.columns))]; + params2.size = sizeExpression(spec, scope, children2[0].marks); + } + children2 = [guideGroup({ + role: LegendEntryRole, + from: dataRef, + encode: entryEncode, + marks: children2, + layout: entryLayout, + interactive: interactive2 + })]; + if (datum2.title) { + children2.push(legendTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: LegendRole, - from: dataRef, - encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: LegendRole, + from: dataRef, + encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function legendType(spec, scaleType) { - let type = spec.type || Symbols; - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) type = (0, _vegaScale.isContinuous)(scaleType) ? Gradient : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Symbols; - return type !== Gradient ? type : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Gradient; -} -function scaleCount(spec) { - return LegendScales.reduce((count, type)=>count + (spec[type] ? 1 : 0), 0); -} -function buildLegendEncode(_, spec, config) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - // accessibility support - format: spec.format, - formatType: spec.formatType + } + function legendType(spec, scaleType) { + let type2 = spec.type || Symbols; + if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { + type2 = isContinuous(scaleType) ? Gradient : isDiscretizing(scaleType) ? Discrete : Symbols; + } + return type2 !== Gradient ? type2 : isDiscretizing(scaleType) ? Discrete : Gradient; + } + function scaleCount(spec) { + return LegendScales.reduce((count2, type2) => count2 + (spec[type2] ? 1 : 0), 0); + } + function buildLegendEncode(_, spec, config) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset"), + padding: _("padding"), + titlePadding: _("titlePadding"), + cornerRadius: _("cornerRadius"), + fill: _("fillColor"), + stroke: _("strokeColor"), + strokeWidth: config.strokeWidth, + strokeDash: config.strokeDash, + x: _("legendX"), + y: _("legendY"), + // accessibility support + format: spec.format, + formatType: spec.formatType }); - return encode; -} -function sizeExpression(spec, scope, marks) { - const size = deref(getChannel('size', spec, marks)), strokeWidth = deref(getChannel('strokeWidth', spec, marks)), fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - return (0, _vegaFunctions.parseExpression)(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope); -} -function getChannel(name, spec, marks) { + return encode2; + } + function sizeExpression(spec, scope, marks) { + const size = deref(getChannel("size", spec, marks)), strokeWidth = deref(getChannel("strokeWidth", spec, marks)), fontSize2 = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); + return parser(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize2})`, scope); + } + function getChannel(name, spec, marks) { return spec[name] ? `scale("${spec[name]}",datum)` : getEncoding(name, marks[0].encode); -} -function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); -} -const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; -function parseTitle(spec, scope) { - spec = (0, _vegaUtil.isString)(spec) ? { - text: spec + } + function getFontSize(encode2, scope, style2) { + return getEncoding("fontSize", encode2) || getStyle("fontSize", scope, style2); + } + const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; + function parseTitle(spec, scope) { + spec = isString(spec) ? { + text: spec } : spec; - const _ = lookup(spec, scope.config.title), encode = spec.encode || {}, userEncode = encode.group || {}, name = userEncode.name || undefined, interactive = userEncode.interactive, style = userEncode.style, children = []; - // single-element data source for group title - const datum = {}, dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - // include subtitle text - if (spec.subtitle) children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - // parse title specification + const _ = lookup(spec, scope.config.title), encode2 = spec.encode || {}, userEncode = encode2.group || {}, name = userEncode.name || void 0, interactive2 = userEncode.interactive, style2 = userEncode.style, children2 = []; + const datum2 = {}, dataRef = ref(scope.add(Collect(null, [datum2]))); + children2.push(buildTitle(spec, _, titleEncode(spec), dataRef)); + if (spec.subtitle) { + children2.push(buildSubTitle(spec, _, encode2.subtitle, dataRef)); + } return parseMark(guideGroup({ - role: TitleRole, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: TitleRole, + from: dataRef, + encode: groupEncode(_, userEncode), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -// provide backwards-compatibility for title custom encode; -// the top-level encode block has been *deprecated*. -function titleEncode(spec) { - const encode = spec.encode; - return encode && encode.title || (0, _vegaUtil.extend)({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); -} -function groupEncode(_, userEncode) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: { - signal: alignExpr$1 - }, - angle: { - signal: angleExpr - }, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') + } + function titleEncode(spec) { + const encode2 = spec.encode; + return encode2 && encode2.title || extend({ + name: spec.name, + interactive: spec.interactive, + style: spec.style + }, encode2); + } + function groupEncode(_, userEncode) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + anchor: _("anchor"), + align: { + signal: alignExpr$1 + }, + angle: { + signal: angleExpr + }, + limit: _("limit"), + frame: _("frame"), + offset: _("offset") || 0, + padding: _("subtitlePadding") }); - return extendEncode(encode, userEncode, Skip); -} -function buildTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.text, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + return extendEncode(encode2, userEncode, Skip); + } + function buildTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.text, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("color"), + font: _("font"), + fontSize: _("fontSize"), + fontStyle: _("fontStyle"), + fontWeight: _("fontWeight"), + lineHeight: _("lineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleTextRole, + style: GroupTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function buildSubTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.subtitle, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + } + function buildSubTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.subtitle, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("subtitleColor"), + font: _("subtitleFont"), + fontSize: _("subtitleFontSize"), + fontStyle: _("subtitleFontStyle"), + fontWeight: _("subtitleFontWeight"), + lineHeight: _("subtitleLineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleSubtitleRole, + style: GroupSubtitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function parseData(data, scope) { - const transforms = []; - if (data.transform) data.transform.forEach((tx)=>{ - transforms.push(parseTransform(tx, scope)); - }); - if (data.on) data.on.forEach((on)=>{ - parseTrigger(on, scope, data.name); - }); - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); -} -/** - * Analyze a data pipeline, add needed operators. - */ function analyze(data, scope, ops) { - const output = []; - let source = null, modify = false, generate = false, upstream, i, n, t, m; - if (data.values) { - // hard-wired input data set - if (isSignal(data.values) || hasSignal(data.format)) { - // if either values is signal or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format + } + function parseData(data2, scope) { + const transforms2 = []; + if (data2.transform) { + data2.transform.forEach((tx2) => { + transforms2.push(parseTransform(tx2, scope)); + }); + } + if (data2.on) { + data2.on.forEach((on2) => { + parseTrigger(on2, scope, data2.name); + }); + } + scope.addDataPipeline(data2.name, analyze(data2, scope, transforms2)); + } + function analyze(data2, scope, ops2) { + const output2 = []; + let source2 = null, modify2 = false, generate2 = false, upstream, i, n, t, m2; + if (data2.values) { + if (isSignal(data2.values) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $ingest: data2.values, + $format: data2.format })); - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format + } + } else if (data2.url) { + if (hasSignal(data2.url) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $request: data2.url, + $format: data2.format })); - } else if (data.source) { - // derives from one or more other data sets - source = upstream = (0, _vegaUtil.array)(data.source).map((d)=>ref(scope.getData(d).output)); - output.push(null); // populate later - } - // scan data transforms, add collectors as needed - for(i = 0, n = ops.length; i < n; ++i){ - t = ops[i]; - m = t.metadata; - if (!source && !m.source) output.push(source = collect()); - output.push(t); - if (m.generates) generate = true; - if (m.modifies && !generate) modify = true; - if (m.source) source = t; - else if (m.changes) source = null; + } + } else if (data2.source) { + source2 = upstream = array$4(data2.source).map((d2) => ref(scope.getData(d2).output)); + output2.push(null); + } + for (i = 0, n = ops2.length; i < n; ++i) { + t = ops2[i]; + m2 = t.metadata; + if (!source2 && !m2.source) { + output2.push(source2 = collect()); + } + output2.push(t); + if (m2.generates) generate2 = true; + if (m2.modifies && !generate2) modify2 = true; + if (m2.source) source2 = t; + else if (m2.changes) source2 = null; } if (upstream) { - n = upstream.length - 1; - output[0] = Relay({ - derive: modify, - pulse: n ? upstream : upstream[0] - }); - if (modify || n) // collect derived and multi-pulse tuples - output.splice(1, 0, collect()); - } - if (!source) output.push(collect()); - output.push(Sieve({})); - return output; -} -function collect(values) { - const s = Collect({}, values); - s.metadata = { - source: true - }; - return s; -} -function load(scope, data) { - return Load({ - url: data.url ? scope.property(data.url) : undefined, - async: data.async ? scope.property(data.async) : undefined, - values: data.values ? scope.property(data.values) : undefined, - format: scope.objectProperty(data.format) - }); -} -const isX = (orient)=>orient === Bottom || orient === Top; -// get sign coefficient based on axis orient -const getSign = (orient, a, b)=>isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left || orient === Top ? a : b; -// condition on axis x-direction -const ifX = (orient, a, b)=>isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; -// condition on axis y-direction -const ifY = (orient, a, b)=>isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a; -const ifTop = (orient, a, b)=>isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top ? { - value: a - } : { - value: b + n = upstream.length - 1; + output2[0] = Relay({ + derive: modify2, + pulse: n ? upstream : upstream[0] + }); + if (modify2 || n) { + output2.splice(1, 0, collect()); + } + } + if (!source2) output2.push(collect()); + output2.push(Sieve({})); + return output2; + } + function collect(values2) { + const s2 = Collect({}, values2); + s2.metadata = { + source: true }; -const ifRight = (orient, a, b)=>isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right ? { - value: a - } : { - value: b - }; -const ifXEnc = ($orient, a, b)=>ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b); -const ifYEnc = ($orient, a, b)=>ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b); -const ifLeftTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b); -const ifTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Top}'`, a, b); -const ifRightExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Right}'`, a, b); -const ifEnc = (test, a, b)=>{ - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? a.signal || (0, _vegaUtil.stringValue)(a.value) : null; - b = b ? b.signal || (0, _vegaUtil.stringValue)(b.value) : null; - return { - signal: `${test} ? (${a}) : (${b})` - }; - } else // otherwise generate rule set - return [ - (0, _vegaUtil.extend)({ - test - }, a) - ].concat(b || []); -}; -const isSimple = (enc)=>enc == null || Object.keys(enc).length === 1; -const ifExpr = (test, a, b)=>({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` - }); -const ifOrient = ($orient, t, b, l, r)=>({ - signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') + '(null)' + return s2; + } + function load(scope, data2) { + return Load({ + url: data2.url ? scope.property(data2.url) : void 0, + async: data2.async ? scope.property(data2.async) : void 0, + values: data2.values ? scope.property(data2.values) : void 0, + format: scope.objectProperty(data2.format) }); -const toExpr = (v)=>isSignal(v) ? v.signal : v == null ? null : (0, _vegaUtil.stringValue)(v); -const mult = (sign, value)=>value === 0 ? 0 : isSignal(sign) ? { - signal: `(${sign.signal}) * ${value}` - } : { - value: sign * value - }; -const patch = (value, base)=>{ - const s = value.signal; - return s && s.endsWith('(null)') ? { - signal: s.slice(0, -6) + base.signal - } : value; -}; -function fallback(prop, config, axisConfig, style) { + } + const isX = (orient) => orient === Bottom || orient === Top; + const getSign = (orient, a2, b2) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a2, b2) : orient === Left || orient === Top ? a2 : b2; + const ifX = (orient, a2, b2) => isSignal(orient) ? ifXEnc(orient.signal, a2, b2) : isX(orient) ? a2 : b2; + const ifY = (orient, a2, b2) => isSignal(orient) ? ifYEnc(orient.signal, a2, b2) : isX(orient) ? b2 : a2; + const ifTop = (orient, a2, b2) => isSignal(orient) ? ifTopExpr(orient.signal, a2, b2) : orient === Top ? { + value: a2 + } : { + value: b2 + }; + const ifRight = (orient, a2, b2) => isSignal(orient) ? ifRightExpr(orient.signal, a2, b2) : orient === Right ? { + value: a2 + } : { + value: b2 + }; + const ifXEnc = ($orient, a2, b2) => ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a2, b2); + const ifYEnc = ($orient, a2, b2) => ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a2, b2); + const ifLeftTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a2, b2); + const ifTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Top}'`, a2, b2); + const ifRightExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Right}'`, a2, b2); + const ifEnc = (test2, a2, b2) => { + a2 = a2 != null ? encoder(a2) : a2; + b2 = b2 != null ? encoder(b2) : b2; + if (isSimple(a2) && isSimple(b2)) { + a2 = a2 ? a2.signal || $(a2.value) : null; + b2 = b2 ? b2.signal || $(b2.value) : null; + return { + signal: `${test2} ? (${a2}) : (${b2})` + }; + } else { + return [extend({ + test: test2 + }, a2)].concat(b2 || []); + } + }; + const isSimple = (enc) => enc == null || Object.keys(enc).length === 1; + const ifExpr = (test2, a2, b2) => ({ + signal: `${test2} ? (${toExpr(a2)}) : (${toExpr(b2)})` + }); + const ifOrient = ($orient, t, b2, l, r) => ({ + signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : "") + (b2 != null ? `${$orient} === '${Bottom}' ? (${toExpr(b2)}) : ` : "") + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : "") + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : "") + "(null)" + }); + const toExpr = (v) => isSignal(v) ? v.signal : v == null ? null : $(v); + const mult = (sign2, value2) => value2 === 0 ? 0 : isSignal(sign2) ? { + signal: `(${sign2.signal}) * ${value2}` + } : { + value: sign2 * value2 + }; + const patch = (value2, base2) => { + const s2 = value2.signal; + return s2 && s2.endsWith("(null)") ? { + signal: s2.slice(0, -6) + base2.signal + } : value2; + }; + function fallback(prop, config, axisConfig2, style2) { let styleProp; - if (config && (0, _vegaUtil.hasOwnProperty)(config, prop)) return config[prop]; - else if ((0, _vegaUtil.hasOwnProperty)(axisConfig, prop)) return axisConfig[prop]; - else if (prop.startsWith('title')) { - switch(prop){ - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } else if (prop.startsWith('label')) { - switch(prop){ - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; + if (config && has$1(config, prop)) { + return config[prop]; + } else if (has$1(axisConfig2, prop)) { + return axisConfig2[prop]; + } else if (prop.startsWith("title")) { + switch (prop) { + case "titleColor": + styleProp = "fill"; + break; + case "titleFont": + case "titleFontSize": + case "titleFontWeight": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideTitleStyle][styleProp]; + } else if (prop.startsWith("label")) { + switch (prop) { + case "labelColor": + styleProp = "fill"; + break; + case "labelFont": + case "labelFontSize": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideLabelStyle][styleProp]; } return null; -} -function keys(objects) { - const map = {}; - for (const obj of objects){ - if (!obj) continue; - for(const key in obj)map[key] = 1; - } - return Object.keys(map); -} -function axisConfig(spec, scope) { - var config = scope.config, style = config.style, axis = config.axis, band = scope.scaleType(spec.scale) === 'band' && config.axisBand, orient = spec.orient, xy, or, key; + } + function keys(objects) { + const map2 = {}; + for (const obj2 of objects) { + if (!obj2) continue; + for (const key2 in obj2) map2[key2] = 1; + } + return Object.keys(map2); + } + function axisConfig(spec, scope) { + var config = scope.config, style2 = config.style, axis = config.axis, band2 = scope.scaleType(spec.scale) === "band" && config.axisBand, orient = spec.orient, xy, or2, key2; if (isSignal(orient)) { - const xyKeys = keys([ - config.axisX, - config.axisY - ]), orientKeys = keys([ - config.axisTop, - config.axisBottom, - config.axisLeft, - config.axisRight - ]); - xy = {}; - for (key of xyKeys)xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style)); - or = {}; - for (key of orientKeys)or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style)); + const xyKeys = keys([config.axisX, config.axisY]), orientKeys = keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]); + xy = {}; + for (key2 of xyKeys) { + xy[key2] = ifX(orient, fallback(key2, config.axisX, axis, style2), fallback(key2, config.axisY, axis, style2)); + } + or2 = {}; + for (key2 of orientKeys) { + or2[key2] = ifOrient(orient.signal, fallback(key2, config.axisTop, axis, style2), fallback(key2, config.axisBottom, axis, style2), fallback(key2, config.axisLeft, axis, style2), fallback(key2, config.axisRight, axis, style2)); + } } else { - xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; + xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; + or2 = config["axis" + orient[0].toUpperCase() + orient.slice(1)]; } - const result = xy || or || band ? (0, _vegaUtil.extend)({}, axis, xy, or, band) : axis; + const result = xy || or2 || band2 ? extend({}, axis, xy, or2, band2) : axis; return result; -} -function axisDomain(spec, config, userEncode, dataRef) { + } + function axisDomain(spec, config, userEncode, dataRef) { const _ = lookup(spec, config), orient = spec.orient; - let enter, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: { - opacity: zero - } + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') + addEncoders(encode2, { + stroke: _("domainColor"), + strokeCap: _("domainCap"), + strokeDash: _("domainDash"), + strokeDashOffset: _("domainDashOffset"), + strokeWidth: _("domainWidth"), + strokeOpacity: _("domainOpacity") }); const pos0 = position(spec, 0); const pos1 = position(spec, 1); - enter.x = update.x = ifX(orient, pos0, zero); - enter.x2 = update.x2 = ifX(orient, pos1); - enter.y = update.y = ifY(orient, pos0, zero); - enter.y2 = update.y2 = ifY(orient, pos1); + enter.x = update2.x = ifX(orient, pos0, zero); + enter.x2 = update2.x2 = ifX(orient, pos1); + enter.y = update2.y = ifY(orient, pos0, zero); + enter.y2 = update2.y2 = ifY(orient, pos1); return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode + type: RuleMark, + role: AxisDomainRole, + from: dataRef, + encode: encode2 }, userEncode); -} -function position(spec, pos) { + } + function position(spec, pos) { return { - scale: spec.scale, - range: pos - }; -} -function axisGrid(spec, config, userEncode, dataRef, band) { - const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign = getSign(orient, 1, -1), offset = offsetValue(spec.offset, sign); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero - } + scale: spec.scale, + range: pos + }; + } + function axisGrid(spec, config, userEncode, dataRef, band2) { + const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign2 = getSign(orient, 1, -1), offset2 = offsetValue(spec.offset, sign2); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') + addEncoders(encode2, { + stroke: _("gridColor"), + strokeCap: _("gridCap"), + strokeDash: _("gridDash"), + strokeDashOffset: _("gridDashOffset"), + strokeOpacity: _("gridOpacity"), + strokeWidth: _("gridWidth") }); const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - const sz = ifX(orient, { - signal: 'height' + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + const sz2 = ifX(orient, { + signal: "height" }, { - signal: 'width' + signal: "width" }); const gridStart = vscale ? { - scale: vscale, - range: 0, - mult: sign, - offset: offset + scale: vscale, + range: 0, + mult: sign2, + offset: offset2 } : { - value: 0, - offset: offset + value: 0, + offset: offset2 }; const gridEnd = vscale ? { - scale: vscale, - range: 1, - mult: sign, - offset: offset - } : (0, _vegaUtil.extend)(sz, { - mult: sign, - offset: offset + scale: vscale, + range: 1, + mult: sign2, + offset: offset2 + } : extend(sz2, { + mult: sign2, + offset: offset2 }); - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); + enter.x = update2.x = ifX(orient, tickPos, gridStart); + enter.y = update2.y = ifY(orient, tickPos, gridStart); + enter.x2 = update2.x2 = ifY(orient, gridEnd); + enter.y2 = update2.y2 = ifX(orient, gridEnd); exit.x = ifX(orient, tickPos); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisGridRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function offsetValue(offset, sign) { - if (sign === 1) ; - else if (!(0, _vegaUtil.isObject)(offset)) offset = isSignal(sign) ? { - signal: `(${sign.signal}) * (${offset || 0})` - } : sign * (offset || 0); - else { - let entry = offset = (0, _vegaUtil.extend)({}, offset); - while(entry.mult != null)if (!(0, _vegaUtil.isObject)(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? { - signal: `(${entry.mult}) * (${sign.signal})` - } : entry.mult * sign; - return offset; - } else entry = entry.mult = (0, _vegaUtil.extend)({}, entry.mult); - entry.mult = sign; - } - return offset; -} -function axisTicks(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero + } + function offsetValue(offset2, sign2) { + if (sign2 === 1) ; + else if (!isObject(offset2)) { + offset2 = isSignal(sign2) ? { + signal: `(${sign2.signal}) * (${offset2 || 0})` + } : sign2 * (offset2 || 0); + } else { + let entry2 = offset2 = extend({}, offset2); + while (entry2.mult != null) { + if (!isObject(entry2.mult)) { + entry2.mult = isSignal(sign2) ? { + signal: `(${entry2.mult}) * (${sign2.signal})` + } : entry2.mult * sign2; + return offset2; + } else { + entry2 = entry2.mult = extend({}, entry2.mult); } + } + entry2.mult = sign2; + } + return offset2; + } + function axisTicks(spec, config, userEncode, dataRef, size, band2) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') + addEncoders(encode2, { + stroke: _("tickColor"), + strokeCap: _("tickCap"), + strokeDash: _("tickDash"), + strokeDashOffset: _("tickDashOffset"), + strokeOpacity: _("tickOpacity"), + strokeWidth: _("tickWidth") }); const tickSize = encoder(size); - tickSize.mult = sign; + tickSize.mult = sign2; const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - update.y = enter.y = ifX(orient, zero, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + update2.y = enter.y = ifX(orient, zero, tickPos); + update2.y2 = enter.y2 = ifX(orient, tickSize); exit.x = ifX(orient, tickPos); - update.x = enter.x = ifY(orient, zero, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); + update2.x = enter.x = ifY(orient, zero, tickPos); + update2.x2 = enter.x2 = ifY(orient, tickSize); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisTickRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function flushExpr(scale, threshold, a, b, c) { + } + function flushExpr(scale2, threshold2, a2, b2, c2) { return { - signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')' + signal: 'flush(range("' + scale2 + '"), scale("' + scale2 + '", datum.value), ' + threshold2 + "," + a2 + "," + b2 + "," + c2 + ")" }; -} -function axisLabels(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, scale = spec.scale, sign = getSign(orient, -1, 1), flush = deref(_('labelFlush')), flushOffset = deref(_('labelFlushOffset')), labelAlign = _('labelAlign'), labelBaseline = _('labelBaseline'); - let flushOn = flush === 0 || !!flush, update; + } + function axisLabels(spec, config, userEncode, dataRef, size, band2) { + const _ = lookup(spec, config), orient = spec.orient, scale2 = spec.scale, sign2 = getSign(orient, -1, 1), flush2 = deref(_("labelFlush")), flushOffset = deref(_("labelFlushOffset")), labelAlign = _("labelAlign"), labelBaseline = _("labelBaseline"); + let flushOn = flush2 === 0 || !!flush2, update2; const tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; + tickSize.mult = sign2; + tickSize.offset = encoder(_("labelPadding") || 0); + tickSize.offset.mult = sign2; const tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - const align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : { - value: 'center' - }, ifRight(orient, 'left', 'right')); - const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : { - value: 'middle' + scale: scale2, + field: Value, + band: 0.5, + offset: extendOffset(band2.offset, _("labelOffset")) + }; + const align = ifX(orient, flushOn ? flushExpr(scale2, flush2, '"left"', '"right"', '"center"') : { + value: "center" + }, ifRight(orient, "left", "right")); + const baseline2 = ifX(orient, ifTop(orient, "bottom", "top"), flushOn ? flushExpr(scale2, flush2, '"top"', '"bottom"', '"middle"') : { + value: "middle" }); - const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); + const offsetExpr = flushExpr(scale2, flush2, `-(${flushOffset})`, flushOffset, 0); flushOn = flushOn && flushOffset; const enter = { - opacity: zero, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - const encode = { - enter: enter, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y, - align, - baseline + opacity: zero, + x: ifX(orient, tickPos, tickSize), + y: ifY(orient, tickPos, tickSize) + }; + const encode2 = { + enter, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero, - x: enter.x, - y: enter.y - } + x: enter.x, + y: enter.y, + align, + baseline: baseline2 + }, + exit: { + opacity: zero, + x: enter.x, + y: enter.y + } }; - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null + addEncoders(encode2, { + dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, + dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null }); - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') + addEncoders(encode2, { + angle: _("labelAngle"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontWeight: _("labelFontWeight"), + fontStyle: _("labelFontStyle"), + limit: _("labelLimit"), + lineHeight: _("labelLineHeight") }, { - align: labelAlign, - baseline: labelBaseline + align: labelAlign, + baseline: labelBaseline }); - const bound = _('labelBound'); - let overlap = _('labelOverlap'); - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? { - scale, - orient, - tolerance: bound - } : null - } : undefined; - if (update.align !== align) update.align = patch(update.align, align); - if (update.baseline !== baseline) update.baseline = patch(update.baseline, baseline); + const bound2 = _("labelBound"); + let overlap = _("labelOverlap"); + overlap = overlap || bound2 ? { + separation: _("labelSeparation"), + method: overlap, + order: "datum.index", + bound: bound2 ? { + scale: scale2, + orient, + tolerance: bound2 + } : null + } : void 0; + if (update2.align !== align) { + update2.align = patch(update2.align, align); + } + if (update2.baseline !== baseline2) { + update2.baseline = patch(update2.baseline, baseline2); + } return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: AxisLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -function axisTitle(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, update; - const encode = { - enter: enter = { - opacity: zero, - anchor: encoder(_('titleAnchor', null)), - align: { - signal: alignExpr$1 - } - }, - update: update = (0, _vegaUtil.extend)({}, enter, { - opacity: one, - text: encoder(spec.title) - }), - exit: { - opacity: zero + } + function axisTitle(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero, + anchor: encoder(_("titleAnchor", null)), + align: { + signal: alignExpr$1 } + }, + update: update2 = extend({}, enter, { + opacity: one, + text: encoder(spec.title) + }), + exit: { + opacity: zero + } }; const titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` + signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` }; - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero, mult(sign, 90)); + update2.x = ifX(orient, titlePos); + update2.y = ifY(orient, titlePos); + enter.angle = ifX(orient, zero, mult(sign2, 90)); enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), { - value: Bottom + value: Bottom }); - update.angle = enter.angle; - update.baseline = enter.baseline; - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + update2.angle = enter.angle; + update2.baseline = enter.baseline; + addEncoders(encode2, { + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') + // require update + align: _("titleAlign"), + angle: _("titleAngle"), + baseline: _("titleBaseline") }); - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); + autoLayout(_, orient, encode2, userEncode); + encode2.update.align = patch(encode2.update.align, enter.align); + encode2.update.angle = patch(encode2.update.angle, enter.angle); + encode2.update.baseline = patch(encode2.update.baseline, enter.baseline); return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: AxisTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim)=>value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false; - const autoY = auto(_('titleX'), 'x'), autoX = auto(_('titleY'), 'y'); - encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); -} -function parseAxis(spec, scope) { - const config = axisConfig(spec, scope), encode = spec.encode || {}, axisEncode = encode.axis || {}, name = axisEncode.name || undefined, interactive = axisEncode.interactive, style = axisEncode.style, _ = lookup(spec, config), band = tickBand(_); - // single-element data source for axis group - const datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - const dataRef = ref(scope.add(Collect({}, [ - datum - ]))); - // data source for axis ticks + } + function autoLayout(_, orient, encode2, userEncode) { + const auto = (value2, dim) => value2 != null ? (encode2.update[dim] = patch(encoder(value2), encode2.update[dim]), false) : !has(dim, userEncode) ? true : false; + const autoY = auto(_("titleX"), "x"), autoX = auto(_("titleY"), "y"); + encode2.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); + } + function parseAxis(spec, scope) { + const config = axisConfig(spec, scope), encode2 = spec.encode || {}, axisEncode = encode2.axis || {}, name = axisEncode.name || void 0, interactive2 = axisEncode.interactive, style2 = axisEncode.style, _ = lookup(spec, config), band2 = tickBand(_); + const datum2 = { + scale: spec.scale, + ticks: !!_("ticks"), + labels: !!_("labels"), + grid: !!_("grid"), + domain: !!_("domain"), + title: spec.title != null + }; + const dataRef = ref(scope.add(Collect({}, [datum2]))); const ticksRef = ref(scope.add(AxisTicks({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + scale: scope.scaleRef(spec.scale), + extra: scope.property(band2.extra), + count: scope.objectProperty(spec.tickCount), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // generate axis marks - const children = []; + const children2 = []; let size; - // include axis gridlines if requested - if (datum.grid) children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - // include axis domain path if requested - if (datum.domain) children.push(axisDomain(spec, config, encode.domain, dataRef)); - // include axis title if defined - if (datum.title) children.push(axisTitle(spec, config, encode.title, dataRef)); - // parse axis specification + if (datum2.grid) { + children2.push(axisGrid(spec, config, encode2.grid, ticksRef, band2)); + } + if (datum2.ticks) { + size = _("tickSize"); + children2.push(axisTicks(spec, config, encode2.ticks, ticksRef, size, band2)); + } + if (datum2.labels) { + size = datum2.ticks ? size : 0; + children2.push(axisLabels(spec, config, encode2.labels, ticksRef, size, band2)); + } + if (datum2.domain) { + children2.push(axisDomain(spec, config, encode2.domain, dataRef)); + } + if (datum2.title) { + children2.push(axisTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: AxisRole, - from: dataRef, - encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: AxisRole, + from: dataRef, + encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function buildAxisEncode(_, spec) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: { - signal: `abs(span(range("${spec.scale}")))` - }, - translate: _('translate'), - // accessibility support - format: spec.format, - formatType: spec.formatType + } + function buildAxisEncode(_, spec) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset") || 0, + position: value(spec.position, 0), + titlePadding: _("titlePadding"), + minExtent: _("minExtent"), + maxExtent: _("maxExtent"), + range: { + signal: `abs(span(range("${spec.scale}")))` + }, + translate: _("translate"), + // accessibility support + format: spec.format, + formatType: spec.formatType }); - return encode; -} -function parseScope(spec, scope, preprocessed) { - const signals = (0, _vegaUtil.array)(spec.signals), scales = (0, _vegaUtil.array)(spec.scales); - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach((_)=>parseSignal(_, scope)); - // parse cartographic projection definitions - (0, _vegaUtil.array)(spec.projections).forEach((_)=>parseProjection(_, scope)); - // initialize scale references - scales.forEach((_)=>initScale(_, scope)); - // parse data sources - (0, _vegaUtil.array)(spec.data).forEach((_)=>parseData(_, scope)); - // parse scale definitions - scales.forEach((_)=>parseScale(_, scope)); - // parse signal updates - (preprocessed || signals).forEach((_)=>parseSignalUpdates(_, scope)); - // parse axis definitions - (0, _vegaUtil.array)(spec.axes).forEach((_)=>parseAxis(_, scope)); - // parse mark definitions - (0, _vegaUtil.array)(spec.marks).forEach((_)=>parseMark(_, scope)); - // parse legend definitions - (0, _vegaUtil.array)(spec.legends).forEach((_)=>parseLegend(_, scope)); - // parse title, if defined + return encode2; + } + function parseScope(spec, scope, preprocessed) { + const signals = array$4(spec.signals), scales2 = array$4(spec.scales); + if (!preprocessed) signals.forEach((_) => parseSignal(_, scope)); + array$4(spec.projections).forEach((_) => parseProjection(_, scope)); + scales2.forEach((_) => initScale(_, scope)); + array$4(spec.data).forEach((_) => parseData(_, scope)); + scales2.forEach((_) => parseScale(_, scope)); + (preprocessed || signals).forEach((_) => parseSignalUpdates(_, scope)); + array$4(spec.axes).forEach((_) => parseAxis(_, scope)); + array$4(spec.marks).forEach((_) => parseMark(_, scope)); + array$4(spec.legends).forEach((_) => parseLegend(_, scope)); if (spec.title) parseTitle(spec.title, scope); - // parse collected lambda (anonymous) expressions scope.parseLambdas(); return scope; -} -const rootEncode = (spec)=>extendEncode({ - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - }, - update: { - width: { - signal: 'width' - }, - height: { - signal: 'height' - } - } - }, spec); -function parseView(spec, scope) { + } + const rootEncode = (spec) => extendEncode({ + enter: { + x: { + value: 0 + }, + y: { + value: 0 + } + }, + update: { + width: { + signal: "width" + }, + height: { + signal: "height" + } + } + }, spec); + function parseView(spec, scope) { const config = scope.config; - // add scenegraph root const root = ref(scope.root = scope.add(operator())); - // parse top-level signal definitions const signals = collectSignals(spec, config); - signals.forEach((_)=>parseSignal(_, scope)); - // assign description, event, legend, and locale configuration + signals.forEach((_) => parseSignal(_, scope)); scope.description = spec.description || config.description; scope.eventConfig = config.events; scope.legends = scope.objectProperty(config.legend && config.legend.layout); scope.locale = config.locale; - // store root group item const input = scope.add(Collect()); - // encode root group item - const encode = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { - pulse: ref(input) + const encode2 = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { + pulse: ref(input) }))); - // perform view layout const parent = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) + layout: scope.objectProperty(spec.layout), + legends: scope.legends, + autosize: scope.signalRef("autosize"), + mark: root, + pulse: ref(encode2) })); scope.operators.pop(); - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); + scope.pushState(ref(encode2), ref(parent), null); parseScope(spec, scope, signals); scope.operators.push(parent); - // bound / render / sieve root item let op = scope.add(Bound({ - mark: root, - pulse: ref(parent) + mark: root, + pulse: ref(parent) })); op = scope.add(Render({ - pulse: ref(op) + pulse: ref(op) })); op = scope.add(Sieve({ - pulse: ref(op) + pulse: ref(op) })); - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); + scope.addData("root", new DataScope(scope, input, input, op)); return scope; -} -function signalObject(name, value) { - return value && value.signal ? { - name, - update: value.signal + } + function signalObject(name, value2) { + return value2 && value2.signal ? { + name, + update: value2.signal } : { - name, - value - }; -} -/** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ function collectSignals(spec, config) { - const _ = (name)=>value(spec[name], config[name]), signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], pre = signals.reduce((p, s)=>(p[s.name] = s, p), {}), map = {}; - // add spec signal array - (0, _vegaUtil.array)(spec.signals).forEach((s)=>{ - if ((0, _vegaUtil.hasOwnProperty)(pre, s.name)) // merge if built-in signal - s = (0, _vegaUtil.extend)(pre[s.name], s); - else // otherwise add to signal list - signals.push(s); - map[s.name] = s; + name, + value: value2 + }; + } + function collectSignals(spec, config) { + const _ = (name) => value(spec[name], config[name]), signals = [signalObject("background", _("background")), signalObject("autosize", parseAutosize(_("autosize"))), signalObject("padding", parsePadding(_("padding"))), signalObject("width", _("width") || 0), signalObject("height", _("height") || 0)], pre = signals.reduce((p, s2) => (p[s2.name] = s2, p), {}), map2 = {}; + array$4(spec.signals).forEach((s2) => { + if (has$1(pre, s2.name)) { + s2 = extend(pre[s2.name], s2); + } else { + signals.push(s2); + } + map2[s2.name] = s2; }); - // add config signal array - (0, _vegaUtil.array)(config.signals).forEach((s)=>{ - if (!(0, _vegaUtil.hasOwnProperty)(map, s.name) && !(0, _vegaUtil.hasOwnProperty)(pre, s.name)) // add to signal list if not already defined - signals.push(s); + array$4(config.signals).forEach((s2) => { + if (!has$1(map2, s2.name) && !has$1(pre, s2.name)) { + signals.push(s2); + } }); return signals; -} -function Scope(config, options) { + } + function Scope(config, options2) { this.config = config || {}; - this.options = options || {}; + this.options = options2 || {}; this.bindings = []; this.field = {}; this.signals = {}; @@ -132577,15 +87160,13 @@ function Scope(config, options) { this.locale = null; this._id = 0; this._subid = 0; - this._nextsub = [ - 0 - ]; + this._nextsub = [0]; this._parent = []; this._encode = []; this._lookup = []; this._markpath = []; -} -function Subscope(scope) { + } + function Subscope(scope) { this.config = scope.config; this.options = scope.options; this.legends = scope.legends; @@ -132605,665 +87186,789 @@ function Subscope(scope) { this._encode = scope._encode.slice(); this._lookup = scope._lookup.slice(); this._markpath = scope._markpath; -} -Scope.prototype = Subscope.prototype = { - parse (spec) { - return parseScope(spec, this); + } + Scope.prototype = Subscope.prototype = { + parse(spec) { + return parseScope(spec, this); }, - fork () { - return new Subscope(this); + fork() { + return new Subscope(this); }, - isSubscope () { - return this._subid > 0; + isSubscope() { + return this._subid > 0; }, - toRuntime () { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; + toRuntime() { + this.finish(); + return { + description: this.description, + operators: this.operators, + streams: this.streams, + updates: this.updates, + bindings: this.bindings, + eventConfig: this.eventConfig, + locale: this.locale + }; }, - id () { - return (this._subid ? this._subid + ':' : 0) + this._id++; + id() { + return (this._subid ? this._subid + ":" : 0) + this._id++; }, - add (op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach((ref)=>{ - ref.$ref = op.id; - }); - op.refs = null; - } - return op; + add(op) { + this.operators.push(op); + op.id = this.id(); + if (op.refs) { + op.refs.forEach((ref2) => { + ref2.$ref = op.id; + }); + op.refs = null; + } + return op; }, - proxy (op) { - const vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy({ - value: vref - })); + proxy(op) { + const vref = op instanceof Entry ? ref(op) : op; + return this.add(Proxy({ + value: vref + })); }, - addStream (stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; + addStream(stream2) { + this.streams.push(stream2); + stream2.id = this.id(); + return stream2; }, - addUpdate (update) { - this.updates.push(update); - return update; + addUpdate(update2) { + this.updates.push(update2); + return update2; }, // Apply metadata - finish () { - let name, ds; - // annotate root - if (this.root) this.root.root = true; - // annotate signals - for(name in this.signals)this.signals[name].signal = name; - // annotate scales - for(name in this.scales)this.scales[name].scale = name; - // annotate data sets - function annotate(op, name, type) { - let data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } + finish() { + let name, ds; + if (this.root) this.root.root = true; + for (name in this.signals) { + this.signals[name].signal = name; + } + for (name in this.scales) { + this.scales[name].scale = name; + } + function annotate(op, name2, type2) { + let data2, list; + if (op) { + data2 = op.data || (op.data = {}); + list = data2[name2] || (data2[name2] = []); + list.push(type2); } - for(name in this.data){ - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for(const field in ds.index)annotate(ds.index[field], name, 'index:' + field); + } + for (name in this.data) { + ds = this.data[name]; + annotate(ds.input, name, "input"); + annotate(ds.output, name, "output"); + annotate(ds.values, name, "values"); + for (const field2 in ds.index) { + annotate(ds.index[field2], name, "index:" + field2); } - return this; + } + return this; }, // ---- - pushState (encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve({ - pulse: encode - })))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); + pushState(encode2, parent, lookup2) { + this._encode.push(ref(this.add(Sieve({ + pulse: encode2 + })))); + this._parent.push(parent); + this._lookup.push(lookup2 ? ref(this.proxy(lookup2)) : null); + this._markpath.push(-1); }, - popState () { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); + popState() { + this._encode.pop(); + this._parent.pop(); + this._lookup.pop(); + this._markpath.pop(); }, - parent () { - return (0, _vegaUtil.peek)(this._parent); + parent() { + return peek$1(this._parent); }, - encode () { - return (0, _vegaUtil.peek)(this._encode); + encode() { + return peek$1(this._encode); }, - lookup () { - return (0, _vegaUtil.peek)(this._lookup); + lookup() { + return peek$1(this._lookup); }, - markpath () { - const p = this._markpath; - return ++p[p.length - 1]; + markpath() { + const p = this._markpath; + return ++p[p.length - 1]; }, // ---- - fieldRef (field, name) { - if ((0, _vegaUtil.isString)(field)) return fieldRef$1(field, name); - if (!field.signal) (0, _vegaUtil.error)('Unsupported field reference: ' + (0, _vegaUtil.stringValue)(field)); - const s = field.signal; - let f = this.field[s]; - if (!f) { - const params = { - name: this.signalRef(s) - }; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field(params))); - } - return f; + fieldRef(field2, name) { + if (isString(field2)) return fieldRef$1(field2, name); + if (!field2.signal) { + error("Unsupported field reference: " + $(field2)); + } + const s2 = field2.signal; + let f = this.field[s2]; + if (!f) { + const params2 = { + name: this.signalRef(s2) + }; + if (name) params2.as = name; + this.field[s2] = f = ref(this.add(Field(params2))); + } + return f; }, - compareRef (cmp) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; - const fields = (0, _vegaUtil.array)(cmp.field).map(check), orders = (0, _vegaUtil.array)(cmp.order).map(check); - return signal ? ref(this.add(Compare({ - fields: fields, - orders: orders - }))) : compareRef(fields, orders); + compareRef(cmp) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; + const fields = array$4(cmp.field).map(check), orders = array$4(cmp.order).map(check); + return signal ? ref(this.add(Compare({ + fields, + orders + }))) : compareRef(fields, orders); }, - keyRef (fields, flat) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; - const sig = this.signals; - fields = (0, _vegaUtil.array)(fields).map(check); - return signal ? ref(this.add(Key({ - fields: fields, - flat: flat - }))) : keyRef(fields, flat); + keyRef(fields, flat) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; + const sig = this.signals; + fields = array$4(fields).map(check); + return signal ? ref(this.add(Key({ + fields, + flat + }))) : keyRef(fields, flat); }, - sortRef (sort) { - if (!sort) return sort; - // including id ensures stable sorting - const a = aggrField(sort.op, sort.field), o = sort.order || Ascending; - return o.signal ? ref(this.add(Compare({ - fields: a, - orders: this.signalRef(o.signal) - }))) : compareRef(a, o); + sortRef(sort2) { + if (!sort2) return sort2; + const a2 = aggrField(sort2.op, sort2.field), o = sort2.order || Ascending; + return o.signal ? ref(this.add(Compare({ + fields: a2, + orders: this.signalRef(o.signal) + }))) : compareRef(a2, o); }, // ---- - event (source, type) { - const key = source + ':' + type; - if (!this.events[key]) { - const id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; + event(source2, type2) { + const key2 = source2 + ":" + type2; + if (!this.events[key2]) { + const id2 = this.id(); + this.streams.push({ + id: id2, + source: source2, + type: type2 + }); + this.events[key2] = id2; + } + return this.events[key2]; }, // ---- - hasOwnSignal (name) { - return (0, _vegaUtil.hasOwnProperty)(this.signals, name); + hasOwnSignal(name) { + return has$1(this.signals, name); }, - addSignal (name, value) { - if (this.hasOwnSignal(name)) (0, _vegaUtil.error)('Duplicate signal name: ' + (0, _vegaUtil.stringValue)(name)); - const op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; + addSignal(name, value2) { + if (this.hasOwnSignal(name)) { + error("Duplicate signal name: " + $(name)); + } + const op = value2 instanceof Entry ? value2 : this.add(operator(value2)); + return this.signals[name] = op; }, - getSignal (name) { - if (!this.signals[name]) (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); - return this.signals[name]; + getSignal(name) { + if (!this.signals[name]) { + error("Unrecognized signal name: " + $(name)); + } + return this.signals[name]; }, - signalRef (s) { - if (this.signals[s]) return ref(this.signals[s]); - else if (!(0, _vegaUtil.hasOwnProperty)(this.lambdas, s)) this.lambdas[s] = this.add(operator(null)); - return ref(this.lambdas[s]); + signalRef(s2) { + if (this.signals[s2]) { + return ref(this.signals[s2]); + } else if (!has$1(this.lambdas, s2)) { + this.lambdas[s2] = this.add(operator(null)); + } + return ref(this.lambdas[s2]); }, - parseLambdas () { - const code = Object.keys(this.lambdas); - for(let i = 0, n = code.length; i < n; ++i){ - const s = code[i], e = (0, _vegaFunctions.parseExpression)(s, this), op = this.lambdas[s]; - op.params = e.$params; - op.update = e.$expr; - } + parseLambdas() { + const code = Object.keys(this.lambdas); + for (let i = 0, n = code.length; i < n; ++i) { + const s2 = code[i], e = parser(s2, this), op = this.lambdas[s2]; + op.params = e.$params; + op.update = e.$expr; + } }, - property (spec) { - return spec && spec.signal ? this.signalRef(spec.signal) : spec; + property(spec) { + return spec && spec.signal ? this.signalRef(spec.signal) : spec; }, - objectProperty (spec) { - return !spec || !(0, _vegaUtil.isObject)(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); + objectProperty(spec) { + return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); }, - exprRef (code, name) { - const params = { - expr: (0, _vegaFunctions.parseExpression)(code, this) - }; - if (name) params.expr.$name = name; - return ref(this.add(Expression(params))); + exprRef(code, name) { + const params2 = { + expr: parser(code, this) + }; + if (name) params2.expr.$name = name; + return ref(this.add(Expression(params2))); }, - addBinding (name, bind) { - if (!this.bindings) (0, _vegaUtil.error)('Nested signals do not support binding: ' + (0, _vegaUtil.stringValue)(name)); - this.bindings.push((0, _vegaUtil.extend)({ - signal: name - }, bind)); + addBinding(name, bind2) { + if (!this.bindings) { + error("Nested signals do not support binding: " + $(name)); + } + this.bindings.push(extend({ + signal: name + }, bind2)); }, // ---- - addScaleProj (name, transform) { - if ((0, _vegaUtil.hasOwnProperty)(this.scales, name)) (0, _vegaUtil.error)('Duplicate scale or projection name: ' + (0, _vegaUtil.stringValue)(name)); - this.scales[name] = this.add(transform); + addScaleProj(name, transform2) { + if (has$1(this.scales, name)) { + error("Duplicate scale or projection name: " + $(name)); + } + this.scales[name] = this.add(transform2); }, - addScale (name, params) { - this.addScaleProj(name, Scale(params)); + addScale(name, params2) { + this.addScaleProj(name, Scale(params2)); }, - addProjection (name, params) { - this.addScaleProj(name, Projection(params)); + addProjection(name, params2) { + this.addScaleProj(name, Projection(params2)); }, - getScale (name) { - if (!this.scales[name]) (0, _vegaUtil.error)('Unrecognized scale name: ' + (0, _vegaUtil.stringValue)(name)); - return this.scales[name]; + getScale(name) { + if (!this.scales[name]) { + error("Unrecognized scale name: " + $(name)); + } + return this.scales[name]; }, - scaleRef (name) { - return ref(this.getScale(name)); + scaleRef(name) { + return ref(this.getScale(name)); }, - scaleType (name) { - return this.getScale(name).params.type; + scaleType(name) { + return this.getScale(name).params.type; }, - projectionRef (name) { - return this.scaleRef(name); + projectionRef(name) { + return this.scaleRef(name); }, - projectionType (name) { - return this.scaleType(name); + projectionType(name) { + return this.scaleType(name); }, // ---- - addData (name, dataScope) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name] = dataScope; + addData(name, dataScope) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.data[name] = dataScope; }, - getData (name) { - if (!this.data[name]) (0, _vegaUtil.error)('Undefined data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name]; + getData(name) { + if (!this.data[name]) { + error("Undefined data set name: " + $(name)); + } + return this.data[name]; }, - addDataPipeline (name, entries) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.addData(name, DataScope.fromEntries(this, entries)); - } -}; -function propertyLambda(spec) { - return ((0, _vegaUtil.isArray)(spec) ? arrayLambda : objectLambda)(spec); -} -function arrayLambda(array) { - const n = array.length; - let code = '['; - for(let i = 0; i < n; ++i){ - const value = array[i]; - code += (i > 0 ? ',' : '') + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + ']'; -} -function objectLambda(obj) { - let code = '{', i = 0, key, value; - for(key in obj){ - value = obj[key]; - code += (++i > 1 ? ',' : '') + (0, _vegaUtil.stringValue)(key) + ':' + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + '}'; -} -/** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ function defaults() { - const defaultFont = 'sans-serif', defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = '#4c78a8', black = '#000', gray = '#888', lightGray = '#ddd'; + addDataPipeline(name, entries) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.addData(name, DataScope.fromEntries(this, entries)); + } + }; + function propertyLambda(spec) { + return (isArray(spec) ? arrayLambda : objectLambda)(spec); + } + function arrayLambda(array2) { + const n = array2.length; + let code = "["; + for (let i = 0; i < n; ++i) { + const value2 = array2[i]; + code += (i > 0 ? "," : "") + (isObject(value2) ? value2.signal || propertyLambda(value2) : $(value2)); + } + return code + "]"; + } + function objectLambda(obj2) { + let code = "{", i = 0, key2, value2; + for (key2 in obj2) { + value2 = obj2[key2]; + code += (++i > 1 ? "," : "") + $(key2) + ":" + (isObject(value2) ? value2.signal || propertyLambda(value2) : $(value2)); + } + return code + "}"; + } + function defaults() { + const defaultFont = "sans-serif", defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = "#4c78a8", black = "#000", gray = "#888", lightGray = "#ddd"; return { - // default visualization description - description: 'Vega visualization', - // default padding around visualization + // default visualization description + description: "Vega visualization", + // default padding around visualization + padding: 0, + // default for automatic sizing; options: 'none', 'pad', 'fit' + // or provide an object (e.g., {'type': 'pad', 'resize': true}) + autosize: "pad", + // default view background color + // covers the entire view component + background: null, + // default event handling configuration + // preventDefault for view-sourced event types except 'wheel' + events: { + defaults: { + allow: ["wheel"] + } + }, + // defaults for top-level group marks + // accepts mark properties (fill, stroke, etc) + // covers the data rectangle within group width/height + group: null, + // defaults for basic mark types + // each subset accepts mark properties (fill, stroke, etc) + mark: null, + arc: { + fill: defaultColor + }, + area: { + fill: defaultColor + }, + image: null, + line: { + stroke: defaultColor, + strokeWidth: defaultStrokeWidth + }, + path: { + stroke: defaultColor + }, + rect: { + fill: defaultColor + }, + rule: { + stroke: black + }, + shape: { + stroke: defaultColor + }, + symbol: { + fill: defaultColor, + size: 64 + }, + text: { + fill: black, + font: defaultFont, + fontSize: 11 + }, + trail: { + fill: defaultColor, + size: defaultStrokeWidth + }, + // style definitions + style: { + // axis & legend labels + "guide-label": { + fill: black, + font: defaultFont, + fontSize: 10 + }, + // axis & legend titles + "guide-title": { + fill: black, + font: defaultFont, + fontSize: 11, + fontWeight: "bold" + }, + // headers, including chart title + "group-title": { + fill: black, + font: defaultFont, + fontSize: 13, + fontWeight: "bold" + }, + // chart subtitle + "group-subtitle": { + fill: black, + font: defaultFont, + fontSize: 12 + }, + // defaults for styled point marks in Vega-Lite + point: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "circle" + }, + circle: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth + }, + square: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "square" + }, + // defaults for styled group marks in Vega-Lite + cell: { + fill: "transparent", + stroke: lightGray + }, + view: { + fill: "transparent" + } + }, + // defaults for title + title: { + orient: "top", + anchor: "middle", + offset: 4, + subtitlePadding: 3 + }, + // defaults for axes + axis: { + minExtent: 0, + maxExtent: 200, + bandPosition: 0.5, + domain: true, + domainWidth: 1, + domainColor: gray, + grid: false, + gridWidth: 1, + gridColor: lightGray, + labels: true, + labelAngle: 0, + labelLimit: 180, + labelOffset: 0, + labelPadding: 2, + ticks: true, + tickColor: gray, + tickOffset: 0, + tickRound: true, + tickSize: 5, + tickWidth: 1, + titlePadding: 4 + }, + // correction for centering bias + axisBand: { + tickOffset: -0.5 + }, + // defaults for cartographic projection + projection: { + type: "mercator" + }, + // defaults for legends + legend: { + orient: "right", padding: 0, - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - // default view background color - // covers the entire view component - background: null, - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: { - allow: [ - 'wheel' - ] - } - }, - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - }, - view: { - fill: 'transparent' - } - }, - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 + gridAlign: "each", + columnPadding: 10, + rowPadding: 2, + symbolDirection: "vertical", + gradientDirection: "vertical", + gradientLength: 200, + gradientThickness: 16, + gradientStrokeColor: lightGray, + gradientStrokeWidth: 0, + gradientLabelOffset: 2, + labelAlign: "left", + labelBaseline: "middle", + labelLimit: 160, + labelOffset: 4, + labelOverlap: true, + symbolLimit: 30, + symbolType: "circle", + symbolSize: 100, + symbolOffset: 0, + symbolStrokeWidth: 1.5, + symbolBaseFillColor: "transparent", + symbolBaseStrokeColor: gray, + titleLimit: 180, + titleOrient: "top", + titlePadding: 5, + layout: { + offset: 18, + direction: "horizontal", + left: { + direction: "vertical" + }, + right: { + direction: "vertical" + } + } + }, + // defaults for scale ranges + range: { + category: { + scheme: "tableau10" }, - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 + ordinal: { + scheme: "blues" }, - // correction for centering bias - axisBand: { - tickOffset: -0.5 + heatmap: { + scheme: "yellowgreenblue" }, - // defaults for cartographic projection - projection: { - type: 'mercator' + ramp: { + scheme: "blues" }, - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { - direction: 'vertical' - }, - right: { - direction: 'vertical' - } - } + diverging: { + scheme: "blueorange", + extent: [1, 0] }, - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [ - 1, - 0 - ] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } + symbol: ["circle", "square", "triangle-up", "cross", "diamond", "triangle-right", "triangle-down", "triangle-left"] + } }; -} -function parse(spec, config, options) { - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)('Input Vega specification must be an object.'); - config = (0, _vegaUtil.mergeConfig)(defaults(), config, spec.config); - return parseView(spec, new Scope(config, options)).toRuntime(); -} - -},{"vega-util":"f2ulH","vega-functions":"6VJ1U","vega-event-selector":"b96Fh","vega-scale":"gHN3E","vega-dataflow":"cFRfY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b96Fh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "parseSelector", ()=>eventSelector); -const VIEW = 'view', LBRACK = '[', RBRACK = ']', LBRACE = '{', RBRACE = '}', COLON = ':', COMMA = ',', NAME = '@', GT = '>', ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 -}; -let DEFAULT_SOURCE, MARKS; -/** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ function eventSelector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); -} -function isMarkType(type) { - return MARKS[type]; -} -function find(s, i, endChar, pushChar, popChar) { - const n = s.length; - let count = 0, c; - for(; i < n; ++i){ - c = s[i]; - if (!count && c === endChar) return i; - else if (popChar && popChar.indexOf(c) >= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; + } + function parse(spec, config, options2) { + if (!isObject(spec)) { + error("Input Vega specification must be an object."); } - return i; -} -function parseMerge(s) { - const output = [], n = s.length; - let start = 0, i = 0; - while(i < n){ - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - if (output.length === 0) throw 'Empty event selector: ' + s; - return output; -} -function parseSelector(s) { - return s[0] === '[' ? parseBetween(s) : parseStream(s); -} -function parseBetween(s) { - const n = s.length; - let i = 1, b; - i = find(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) throw 'Empty between selector: ' + s; - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) throw 'Between selector must have two elements: ' + s; - s = s.slice(i + 1).trim(); - if (s[0] !== GT) throw 'Expected \'>\' after between selector: ' + s; - b = b.map(parseSelector); - const stream = parseSelector(s.slice(1).trim()); - if (stream.between) return { - between: b, - stream: stream - }; - else stream.between = b; - return stream; -} -function parseStream(s) { - const stream = { - source: DEFAULT_SOURCE - }, source = []; - let throttle = [ - 0, - 0 - ], markname = 0, start = 0, n = s.length, i = 0, j, filter; - // extract throttle from end - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - if (!n) throw s; - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - // extract first part of multi-part stream selector - j = find(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; + config = mergeConfig(defaults(), config, spec.config); + return parseView(spec, new Scope(config, options2)).toRuntime(); + } + var version$1 = "6.2.0"; + extend(transforms, tx, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf); + const version = version$1; + const vega = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Bounds, + CanvasHandler, + CanvasRenderer, + DATE, + DAY, + DAYOFYEAR, + Dataflow, + Debug, + DisallowedObjectProperties, + Error: Error$1, + EventStream, + Gradient: Gradient$1, + GroupItem, + HOURS, + Handler, + HybridHandler, + HybridRenderer, + Info, + Item, + MILLISECONDS, + MINUTES, + MONTH, + Marks, + MultiPulse, + None: None$2, + Operator, + Parameters, + Pulse, + QUARTER, + RenderType, + Renderer, + ResourceLoader, + SECONDS, + SVGHandler, + SVGRenderer, + SVGStringRenderer, + Scenegraph, + TIME_UNITS, + Transform, + View: View$1, + WEEK, + Warn, + YEAR, + accessor, + accessorFields, + accessorName, + array: array$4, + ascending: ascending$1, + bandwidthNRD: estimateBandwidth, + bin, + bootstrapCI, + boundClip, + boundContext, + boundItem: boundItem$1, + boundMark, + boundStroke, + changeset, + clampRange, + codegenExpression: codegen, + compare: compare$1, + constant: constant$4, + cumulativeLogNormal, + cumulativeNormal, + cumulativeUniform, + dayofyear, + debounce, + defaultLocale, + definition: definition$1, + densityLogNormal, + densityNormal, + densityUniform, + domChild, + domClear, + domCreate, + domFind, + dotbin, + error, + expressionFunction, + extend, + extent, + extentIndex, + falsy, + fastmap, + field: field$1, + flush, + font, + fontFamily, + fontSize, + format: format$2, + formatLocale: numberFormatDefaultLocale, + formats: formats$1, + hasOwnProperty: has$1, + id, + identity: identity$2, + inferType, + inferTypes, + ingest: ingest$1, + inherits, + inrange, + interpolate, + interpolateColors, + interpolateRange, + intersect: intersect$2, + intersectBoxLine, + intersectPath, + intersectPoint, + intersectRule, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isFunction, + isIterable, + isNumber: isNumber$1, + isObject, + isRegExp, + isString, + isTuple, + key, + lerp, + lineHeight, + loader, + locale, + logger, + lruCache, + markup, + merge: merge$2, + mergeConfig, + multiLineOffset, + one: one$1, + pad: pad$1, + panLinear, + panLog, + panPow, + panSymlog, + parse, + parseExpression: parser$1, + parseSelector: eventSelector, + path: path$3, + pathCurves: curves, + pathEqual, + pathParse: parse$3, + pathRectangle: vg_rect, + pathRender, + pathSymbols: symbols, + pathTrail: vg_trail, + peek: peek$1, + point, + projection, + quantileLogNormal, + quantileNormal, + quantileUniform, + quantiles, + quantizeInterpolator, + quarter, + quartiles, + get random() { + return random; + }, + randomInteger: integer, + randomKDE: kde, + randomLCG: lcg$2, + randomLogNormal: lognormal, + randomMixture: mixture$1, + randomNormal: gaussian, + randomUniform: uniform, + read, + regressionConstant: constant$3, + regressionExp: exp$1, + regressionLinear: linear, + regressionLoess: loess, + regressionLog: log$2, + regressionPoly: poly, + regressionPow: pow$2, + regressionQuad: quad, + renderModule, + repeat, + resetDefaultLocale, + resetSVGDefIds, + responseType, + runtimeContext: context, + sampleCurve, + sampleLogNormal, + sampleNormal, + sampleUniform, + scale: scale$4, + sceneEqual, + sceneFromJSON, + scenePickVisit: pickVisit, + sceneToJSON, + sceneVisit: visit, + sceneZOrder: zorder, + scheme, + serializeXML, + setHybridRendererOptions, + setRandom, + span, + splitAccessPath, + stringValue: $, + textMetrics, + timeBin: bin$1, + timeFloor, + timeFormatLocale: timeFormatDefaultLocale, + timeInterval, + timeOffset, + timeSequence, + timeUnitSpecifier, + timeUnits, + toBoolean, + toDate, + toNumber, + toSet, + toString, + transform: transform$2, + transforms, + truncate: truncate$1, + truthy, + tupleid, + typeParsers, + utcFloor, + utcInterval, + utcOffset, + utcSequence, + utcdayofyear, + utcquarter, + utcweek, + version, + visitArray, + week, + writeConfig, + zero: zero$1, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog + }, Symbol.toStringTag, { value: "Module" })); + use$1(fluentUI, vega); + const staticContent = Array.from(document.querySelectorAll("a.sanddance-app-static-content")); + const dataSets = staticContent.filter((f) => f.id).map((n) => { + const forData = staticContent.filter((f) => f.dataset["for"] === n.id)[0]; + return { + dataSourceType: "sample", + id: n.id, + displayName: n.dataset["displayName"], + dataUrl: n.href, + type: n.dataset["type"], + snapshotsUrl: forData ? forData.href : null + }; + }); + let explorer; + const undef = "undefined"; + ReactDOM__namespace.render(React__namespace.createElement(SandDanceApp, { setTheme: typeof setTheme !== undef && setTheme, darkTheme: typeof darkTheme !== undef && darkTheme, insights: typeof insights !== undef && insights, initialOptions: typeof options !== undef && options, themeColors: typeof themeColors !== undef && themeColors, dataSources: dataSets, mounted: (app) => { + explorer = app.explorer; + } }), document.getElementById("app")); + const z = "z".charCodeAt(0); + const Z = "Z".charCodeAt(0); + document.onkeyup = (e) => { + if (e.ctrlKey && (e.keyCode === z || e.keyCode === Z)) { + if (e.shiftKey) { + explorer.redo(); + } else { + explorer.undo(); + } } - // extract remaining part of stream selector - i = find(s, i, LBRACK); - if (i === n) source.push(s.substring(start, n).trim()); - else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - // extract filters - while(i < n){ - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - // marshall event stream specification - if (!(n = source.length) || ILLEGAL.test(source[n - 1])) throw 'Invalid event selector: ' + s; - if (n > 1) { - stream.type = source[1]; - if (markname) stream.markname = source[0].slice(1); - else if (isMarkType(source[0])) stream.marktype = source[0]; - else stream.source = source[0]; - } else stream.type = source[0]; - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; -} -function parseThrottle(s) { - const a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map((_)=>{ - const x = +_; - if (x !== x) throw s; - return x; - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}]},["bxQeC"], "bxQeC", "parcelRequirec6f8", {}) - + }; + window["SandDanceApp"] = { explorer, SandDanceExplorer }; +})); diff --git a/docs/dist/sanddance-explorer/v4/sanddance-explorer.js b/docs/dist/sanddance-explorer/v4/sanddance-explorer.js index f47c41dbf..eae96a07d 100644 --- a/docs/dist/sanddance-explorer/v4/sanddance-explorer.js +++ b/docs/dist/sanddance-explorer/v4/sanddance-explorer.js @@ -418,276 +418,6 @@ function $6baf9f3c20fde4a8$export$8b58be045bf06082(parent, definition) { }); -parcelRegister("gwbX4", function(module, exports) { -module.exports = JSON.parse("[\"a\",\"abbr\",\"address\",\"area\",\"article\",\"aside\",\"audio\",\"b\",\"base\",\"bdi\",\"bdo\",\"blockquote\",\"body\",\"br\",\"button\",\"canvas\",\"caption\",\"cite\",\"code\",\"col\",\"colgroup\",\"data\",\"datalist\",\"dd\",\"del\",\"details\",\"dfn\",\"dialog\",\"div\",\"dl\",\"dt\",\"em\",\"embed\",\"fieldset\",\"figcaption\",\"figure\",\"footer\",\"form\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"header\",\"hgroup\",\"hr\",\"html\",\"i\",\"iframe\",\"img\",\"input\",\"ins\",\"kbd\",\"keygen\",\"label\",\"legend\",\"li\",\"link\",\"main\",\"map\",\"mark\",\"math\",\"menu\",\"menuitem\",\"meta\",\"meter\",\"nav\",\"noscript\",\"object\",\"ol\",\"optgroup\",\"option\",\"output\",\"p\",\"param\",\"picture\",\"pre\",\"progress\",\"q\",\"rb\",\"rp\",\"rt\",\"rtc\",\"ruby\",\"s\",\"samp\",\"script\",\"section\",\"select\",\"slot\",\"small\",\"source\",\"span\",\"strong\",\"style\",\"sub\",\"summary\",\"sup\",\"svg\",\"table\",\"tbody\",\"td\",\"template\",\"textarea\",\"tfoot\",\"th\",\"thead\",\"time\",\"title\",\"tr\",\"track\",\"u\",\"ul\",\"var\",\"video\",\"wbr\"]"); - -}); - -parcelRegister("4T7E6", function(module, exports) { -module.exports = JSON.parse("[\"a\",\"altGlyph\",\"altGlyphDef\",\"altGlyphItem\",\"animate\",\"animateColor\",\"animateMotion\",\"animateTransform\",\"circle\",\"clipPath\",\"color-profile\",\"cursor\",\"defs\",\"desc\",\"ellipse\",\"feBlend\",\"feColorMatrix\",\"feComponentTransfer\",\"feComposite\",\"feConvolveMatrix\",\"feDiffuseLighting\",\"feDisplacementMap\",\"feDistantLight\",\"feFlood\",\"feFuncA\",\"feFuncB\",\"feFuncG\",\"feFuncR\",\"feGaussianBlur\",\"feImage\",\"feMerge\",\"feMergeNode\",\"feMorphology\",\"feOffset\",\"fePointLight\",\"feSpecularLighting\",\"feSpotLight\",\"feTile\",\"feTurbulence\",\"filter\",\"font\",\"font-face\",\"font-face-format\",\"font-face-name\",\"font-face-src\",\"font-face-uri\",\"foreignObject\",\"g\",\"glyph\",\"glyphRef\",\"hkern\",\"image\",\"line\",\"linearGradient\",\"marker\",\"mask\",\"metadata\",\"missing-glyph\",\"mpath\",\"path\",\"pattern\",\"polygon\",\"polyline\",\"radialGradient\",\"rect\",\"script\",\"set\",\"stop\",\"style\",\"svg\",\"switch\",\"symbol\",\"text\",\"textPath\",\"title\",\"tref\",\"tspan\",\"use\",\"view\",\"vkern\"]"); - -}); - -parcelRegister("2FnuA", function(module, exports) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(module.exports, "__esModule", { - value: true -}); -module.exports.BarChartRecommender = module.exports.BarChartRecommenderSummary = void 0; - -var $1uICa = parcelRequire("1uICa"); -var $1f11a233e6d216bf$var$maxDistinctVal = 20; -var $1f11a233e6d216bf$var$minDistinctVal = 2; -var $1f11a233e6d216bf$var$BarChartRecommenderSummary = /** @class */ function() { - function BarChartRecommenderSummary(columns, data) { - var score = -1; - for(var i = 0; i < columns.length; i++){ - var recommendation = new $1f11a233e6d216bf$var$BarChartRecommender(columns[i], data).recommend(); - if (recommendation.score > score) { - this.best = recommendation; - score = recommendation.score; - } - if (score === 1) break; - } - for(var k = 0; k < columns.length; k++){ - var column = columns[k]; - if (column.name === this.best.columns.x || column.stats.isSequential) continue; - if (column.quantitative || column.stats.distinctValueCount < $1uICa.maxCategoricalColors && column.stats.distinctValueCount > 1) { - this.best.columns.color = this.best.columns.sort = column.name; - this.best.scheme = (0, $1uICa.defaultColorScheme)(column); - if (column.quantitative) this.best.colorBin = 'quantile'; - break; - } - } - } - BarChartRecommenderSummary.prototype.recommend = function() { - return this.best; - }; - return BarChartRecommenderSummary; -}(); -module.exports.BarChartRecommenderSummary = $1f11a233e6d216bf$var$BarChartRecommenderSummary; -var $1f11a233e6d216bf$var$BarChartRecommender = /** @class */ function() { - function BarChartRecommender(column, data) { - this.score = 0; - this.column = column; - //the total score for bar chart is 1 - this.rules = [ - function(column) { - if (column.stats.isSequential) return false; - else if (column.quantitative) return true; - else if (!column.quantitative && column.stats.distinctValueCount <= $1f11a233e6d216bf$var$maxDistinctVal && column.stats.distinctValueCount >= $1f11a233e6d216bf$var$minDistinctVal) return true; - else return false; - } - ]; - for(var i = 0; i < this.rules.length; i++)if (this.rules[i](column)) this.score++; - } - BarChartRecommender.prototype.recommend = function() { - var rec = { - chart: 'barchart', - columns: { - x: this.column.name - }, - score: this.score, - scheme: undefined, - view: '2d' - }; - return rec; - }; - return BarChartRecommender; -}(); -module.exports.BarChartRecommender = $1f11a233e6d216bf$var$BarChartRecommender; - -}); -parcelRegister("1uICa", function(module, exports) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(module.exports, "__esModule", { - value: true -}); -module.exports.Recommender = module.exports.maxCategoricalColors = void 0; -module.exports.defaultColorScheme = $116b334d4f77bc48$var$defaultColorScheme; -module.exports.maxCategoricalColors = 20; -var $116b334d4f77bc48$var$Recommender = /** @class */ function() { - function Recommender(columns, data) {} - return Recommender; -}(); -module.exports.Recommender = $116b334d4f77bc48$var$Recommender; -function $116b334d4f77bc48$var$defaultColorScheme(c) { - if (c.quantitative) return 'redyellowgreen'; - else if (c.stats.distinctValueCount === 2) return 'dual_redgreen'; - else if (c.stats.distinctValueCount <= 10) return 'category10'; - return 'category20'; -} - -}); - - -parcelRegister("bvDTm", function(module, exports) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(module.exports, "__esModule", { - value: true -}); -module.exports.isLongitude = $861188ad8c0733db$var$isLongitude; -module.exports.isLatitude = $861188ad8c0733db$var$isLatitude; -module.exports.isGeo = $861188ad8c0733db$var$isGeo; -//TODO: languages other than english -var $861188ad8c0733db$var$longitudeNames = [ - 'lon', - 'long', - 'longitude' -]; -var $861188ad8c0733db$var$latitudeNames = [ - 'lat', - 'latitude' -]; -function $861188ad8c0733db$var$isSpec(names, limits, column, data) { - var is = false; - var cname = column.name.toLowerCase(); - for(var i = 0; i < names.length; i++)if (names[i] === cname) { - is = true; - break; - } - data; - return is; -} -function $861188ad8c0733db$var$isLongitude(column, data) { - return $861188ad8c0733db$var$isSpec($861188ad8c0733db$var$longitudeNames, [ - -180, - 180 - ], column, data); -} -function $861188ad8c0733db$var$isLatitude(column, data) { - return $861188ad8c0733db$var$isSpec($861188ad8c0733db$var$latitudeNames, [ - -90, - 90 - ], column, data); -} -function $861188ad8c0733db$var$isGeo(column, data) { - return $861188ad8c0733db$var$isLatitude(column, data) || $861188ad8c0733db$var$isLongitude(column, data); -} - -}); - -parcelRegister("7Kus9", function(module, exports) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(module.exports, "__esModule", { - value: true -}); -module.exports.ScatterPlotRecommenderSummary = void 0; - -var $1uICa = parcelRequire("1uICa"); - -var $bvDTm = parcelRequire("bvDTm"); -var $5a44739e7f49bf14$var$ScatterPlotRecommenderSummary = /** @class */ function() { - function ScatterPlotRecommenderSummary(columns, data) { - var rec = { - chart: 'scatterplot', - score: undefined, - columns: {}, - scheme: undefined, - view: '2d' - }; - columns.forEach(function(column) { - if (!rec.columns.x) { - if (column.name.toLowerCase() === 'x') return rec.columns.x = column.name; - else if ((0, $bvDTm.isLongitude)(column)) return rec.columns.x = column.name; - } - if (!rec.columns.y) { - if (column.name.toLowerCase() === 'y') return rec.columns.y = column.name; - else if ((0, $bvDTm.isLatitude)(column)) return rec.columns.y = column.name; - } - if (!rec.columns.color && !column.stats.isSequential) { - if (column.quantitative || column.stats.distinctValueCount < $1uICa.maxCategoricalColors) { - rec.columns.color = rec.columns.sort = column.name; - rec.scheme = (0, $1uICa.defaultColorScheme)(column); - if (column.quantitative) rec.colorBin = 'quantile'; - return; - } - } - }); - if (rec.columns.x && rec.columns.y) this.best = rec; - } - ScatterPlotRecommenderSummary.prototype.recommend = function() { - return this.best; - }; - return ScatterPlotRecommenderSummary; -}(); -module.exports.ScatterPlotRecommenderSummary = $5a44739e7f49bf14$var$ScatterPlotRecommenderSummary; - -}); - -parcelRegister("lSaje", function(module, exports) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(module.exports, "__esModule", { - value: true -}); -module.exports.preferredColumnForTreemapSize = $fec6a34ab2606213$var$preferredColumnForTreemapSize; - -var $bvDTm = parcelRequire("bvDTm"); -function $fec6a34ab2606213$var$preferredColumnForTreemapSize(columns, strict) { - for(var i = 0; i < columns.length; i++){ - var c = columns[i]; - if (c.quantitative) { - if (strict && c.stats.hasNegative) continue; - if (strict && c.stats.isSequential) continue; - if (strict && (0, $bvDTm.isGeo)(c)) continue; - return c; - } - } -} - -}); - -parcelRegister("b7pOC", function(module, exports) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(module.exports, "__esModule", { - value: true -}); -module.exports.RecommenderSummary = void 0; - -var $2FnuA = parcelRequire("2FnuA"); - -var $7Kus9 = parcelRequire("7Kus9"); -var $81845f94dbd209f8$var$RecommenderSummary = /** @class */ function() { - function RecommenderSummary(columns, data) { - var quickRec = new $7Kus9.ScatterPlotRecommenderSummary(columns, data).recommend(); - if (quickRec) this.rec = quickRec; - else { - var barChartrec = new $2FnuA.BarChartRecommenderSummary(columns, data).recommend(); - if (barChartrec && barChartrec.score >= 1) this.rec = barChartrec; - else this.rec = { - chart: 'grid', - columns: {}, - score: 1 - }; - } - } - RecommenderSummary.prototype.recommend = function() { - return this.rec; - }; - return RecommenderSummary; -}(); -module.exports.RecommenderSummary = $81845f94dbd209f8$var$RecommenderSummary; - -}); - var $fa693121602b4446$exports = {}; $parcel$export($fa693121602b4446$exports, "controls", () => $5d1e60eb15fea085$exports); @@ -6100,6 +5830,12 @@ function $1c081eb26c39473d$export$3f8fe6489e95757d(specContext, currData) { +var $7c75b80e0404a7a0$exports = {}; +/*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ + var $ca675dc6df12c0ef$exports = {}; /*! * Copyright (c) Microsoft Corporation. @@ -6115,6 +5851,7 @@ var $46296c7ebdd844d1$exports = {}; $parcel$exportWildcard($502a84774beeb901$exports, $1c081eb26c39473d$exports); $parcel$exportWildcard($502a84774beeb901$exports, $8d0624e259fe9d79$exports); $parcel$exportWildcard($502a84774beeb901$exports, $2b29a67d615af3f6$exports); +$parcel$exportWildcard($502a84774beeb901$exports, $7c75b80e0404a7a0$exports); $parcel$exportWildcard($502a84774beeb901$exports, $ca675dc6df12c0ef$exports); $parcel$exportWildcard($502a84774beeb901$exports, $46296c7ebdd844d1$exports); @@ -6511,19 +6248,7 @@ $parcel$export($230d9e8a9013f7fd$exports, "Table", () => $837e7efbc300fecc$expor */ /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. -*/ var $141b8f2471dc141e$exports = {}; -'use strict'; - -$141b8f2471dc141e$exports = (parcelRequire("gwbX4")); - - -var $d92af7c54cf4754b$exports = {}; - -$d92af7c54cf4754b$exports = (parcelRequire("4T7E6")); - - -const $fe86f88c0c9aea93$var$htmlTagArray = $141b8f2471dc141e$exports.default || $141b8f2471dc141e$exports; -const $fe86f88c0c9aea93$var$svgTagArray = $d92af7c54cf4754b$exports.default || $d92af7c54cf4754b$exports; +*/ const $fe86f88c0c9aea93$var$SVG_NAMESPACE = "http://www.w3.org/2000/svg"; /** * Decamelizes a string with/without a custom separator (hyphen by default). * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript @@ -6536,11 +6261,15 @@ const $fe86f88c0c9aea93$var$svgTagArray = $d92af7c54cf4754b$exports.default || $ function $fe86f88c0c9aea93$export$c8a8987d4410bf2d(tag, attrs, ...children) { if (typeof tag === 'function') { const fn = tag; - const props = attrs; - props.children = children; + let props = attrs; + // Handle case where props is null but children are provided + if (props === null || props === undefined) props = { + children: children + }; + else props.children = children; return fn(props); } else { - const ns = $fe86f88c0c9aea93$var$tagNamespace(tag); + const ns = tag === 'svg' ? $fe86f88c0c9aea93$var$SVG_NAMESPACE : null; const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); const map = attrs; let ref; @@ -6570,11 +6299,57 @@ function $fe86f88c0c9aea93$var$flatten(o) { for(let prop in o)arr.push(`${$fe86f88c0c9aea93$var$decamelize(prop, '-')}:${o[prop]}`); return arr.join(';'); } +function $fe86f88c0c9aea93$var$isInsideForeignObject(element) { + let current = element; + while(current){ + if (current.tagName.toLowerCase() === 'foreignobject') return true; + current = current.parentElement; + } + return false; +} +function $fe86f88c0c9aea93$var$recreateWithSvgNamespace(element) { + const svgElement = document.createElementNS($fe86f88c0c9aea93$var$SVG_NAMESPACE, element.tagName.toLowerCase()); + // Copy attributes + for(let i = 0; i < element.attributes.length; i++){ + const attr = element.attributes[i]; + svgElement.setAttributeNS(null, attr.name, attr.value); + } + // Copy event handlers and other properties + // Common event handlers that need to be copied + const eventProperties = [ + 'onclick', + 'onmousedown', + 'onmouseup', + 'onmouseover', + 'onmouseout', + 'onmousemove', + 'onkeydown', + 'onkeyup', + 'onkeypress', + 'onfocus', + 'onblur' + ]; + for (const prop of eventProperties)if (element[prop]) svgElement[prop] = element[prop]; + // Copy children recursively + for(let i = 0; i < element.childNodes.length; i++){ + const child = element.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) svgElement.appendChild($fe86f88c0c9aea93$var$recreateWithSvgNamespace(child)); + else svgElement.appendChild(child.cloneNode(true)); + } + return svgElement; +} function $fe86f88c0c9aea93$export$59da04d16460addd(parentElement, child) { if (child === null || child === undefined || typeof child === "boolean") return; else if (Array.isArray(child)) $fe86f88c0c9aea93$var$appendChildren(parentElement, child); - else if ($fe86f88c0c9aea93$var$isElement(child)) parentElement.appendChild(child); - else parentElement.appendChild(document.createTextNode(child.toString())); + else if ($fe86f88c0c9aea93$var$isElement(child)) { + const childEl = child; + // If parent is SVG and child was created with wrong namespace, recreate it + // Exception: don't recreate elements inside foreignObject as they should remain HTML + if (parentElement.namespaceURI === $fe86f88c0c9aea93$var$SVG_NAMESPACE && childEl.namespaceURI !== $fe86f88c0c9aea93$var$SVG_NAMESPACE && childEl.tagName.toLowerCase() !== 'foreignobject' && !$fe86f88c0c9aea93$var$isInsideForeignObject(parentElement)) { + const recreated = $fe86f88c0c9aea93$var$recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } else parentElement.appendChild(childEl); + } else parentElement.appendChild(document.createTextNode(child.toString())); } function $fe86f88c0c9aea93$var$appendChildren(parentElement, children) { children.forEach((child)=>$fe86f88c0c9aea93$export$59da04d16460addd(parentElement, child)); @@ -6629,10 +6404,6 @@ function $fe86f88c0c9aea93$var$getChildPosition(element) { while(element = element.previousElementSibling)childPosition++; return childPosition; } -function $fe86f88c0c9aea93$var$tagNamespace(tag) { - //issue: this won't disambiguate certain tags which exist in both svg and html: <a>, <title> ... - if (tag === 'svg' || $fe86f88c0c9aea93$var$svgTagArray.indexOf(tag) >= 0 && !($fe86f88c0c9aea93$var$htmlTagArray.indexOf(tag) >= 0)) return "http://www.w3.org/2000/svg"; -} const $837e7efbc300fecc$var$KeyCodes = { @@ -6680,31 +6451,39 @@ $parcel$export($4ef7f72d8d2a203c$exports, "MorphChartsCore", () => $4a6417d29706 $parcel$export($14f38b7dd89457d7$exports, "EPSILON", () => $14f38b7dd89457d7$export$fd293b15f47e270); $parcel$export($14f38b7dd89457d7$exports, "ARRAY_TYPE", () => $14f38b7dd89457d7$export$b67359430d3b1b2); $parcel$export($14f38b7dd89457d7$exports, "RANDOM", () => $14f38b7dd89457d7$export$5ada478c8a628231); +$parcel$export($14f38b7dd89457d7$exports, "ANGLE_ORDER", () => $14f38b7dd89457d7$export$217057687ee20298); +$parcel$export($14f38b7dd89457d7$exports, "round", () => $14f38b7dd89457d7$export$2077e0241d6afd3c); $parcel$export($14f38b7dd89457d7$exports, "setMatrixArrayType", () => $14f38b7dd89457d7$export$cb2c0eb57f5e532c); $parcel$export($14f38b7dd89457d7$exports, "toRadian", () => $14f38b7dd89457d7$export$408b8ee5959eefd5); +$parcel$export($14f38b7dd89457d7$exports, "toDegree", () => $14f38b7dd89457d7$export$c796d9d3e501591f); $parcel$export($14f38b7dd89457d7$exports, "equals", () => $14f38b7dd89457d7$export$e9bab7fafb253603); /** * Common utilities * @module glMatrix */ // Configuration Constants var $14f38b7dd89457d7$export$fd293b15f47e270 = 0.000001; -var $14f38b7dd89457d7$export$b67359430d3b1b2 = typeof Float32Array !== 'undefined' ? Float32Array : Array; +var $14f38b7dd89457d7$export$b67359430d3b1b2 = typeof Float32Array !== "undefined" ? Float32Array : Array; var $14f38b7dd89457d7$export$5ada478c8a628231 = Math.random; +var $14f38b7dd89457d7$export$217057687ee20298 = "zyx"; +function $14f38b7dd89457d7$export$2077e0241d6afd3c(a) { + if (a >= 0) return Math.round(a); + return a % 0.5 === 0 ? Math.floor(a) : Math.round(a); +} function $14f38b7dd89457d7$export$cb2c0eb57f5e532c(type) { $14f38b7dd89457d7$export$b67359430d3b1b2 = type; } var $14f38b7dd89457d7$var$degree = Math.PI / 180; +var $14f38b7dd89457d7$var$radian = 180 / Math.PI; function $14f38b7dd89457d7$export$408b8ee5959eefd5(a) { return a * $14f38b7dd89457d7$var$degree; } +function $14f38b7dd89457d7$export$c796d9d3e501591f(a) { + return a * $14f38b7dd89457d7$var$radian; +} function $14f38b7dd89457d7$export$e9bab7fafb253603(a, b) { - return Math.abs(a - b) <= $14f38b7dd89457d7$export$fd293b15f47e270 * Math.max(1.0, Math.abs(a), Math.abs(b)); + var tolerance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : $14f38b7dd89457d7$export$fd293b15f47e270; + return Math.abs(a - b) <= tolerance * Math.max(1, Math.abs(a), Math.abs(b)); } -if (!Math.hypot) Math.hypot = function() { - var y = 0, i = arguments.length; - while(i--)y += arguments[i] * arguments[i]; - return Math.sqrt(y); -}; var $1ac1b59392edf35b$exports = {}; @@ -6736,6 +6515,7 @@ $parcel$export($1ac1b59392edf35b$exports, "fromQuat2", () => $1ac1b59392edf35b$e $parcel$export($1ac1b59392edf35b$exports, "getTranslation", () => $1ac1b59392edf35b$export$202e99f82f7f0395); $parcel$export($1ac1b59392edf35b$exports, "getScaling", () => $1ac1b59392edf35b$export$71dc54d92bd04b57); $parcel$export($1ac1b59392edf35b$exports, "getRotation", () => $1ac1b59392edf35b$export$df3937d3b537df0a); +$parcel$export($1ac1b59392edf35b$exports, "decompose", () => $1ac1b59392edf35b$export$4e06b4a690896b27); $parcel$export($1ac1b59392edf35b$exports, "fromRotationTranslationScale", () => $1ac1b59392edf35b$export$ddf9c55c9f2be172); $parcel$export($1ac1b59392edf35b$exports, "fromRotationTranslationScaleOrigin", () => $1ac1b59392edf35b$export$1def1f860edc4b1f); $parcel$export($1ac1b59392edf35b$exports, "fromQuat", () => $1ac1b59392edf35b$export$2ff2bbe382249af7); @@ -6933,7 +6713,8 @@ function $1ac1b59392edf35b$export$6897c284b6f9f4dc(out, a) { var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant + var b11 = a22 * a33 - a23 * a32; + // Calculate the determinant var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (!det) return null; det = 1.0 / det; @@ -6956,29 +6737,6 @@ function $1ac1b59392edf35b$export$6897c284b6f9f4dc(out, a) { return out; } function $1ac1b59392edf35b$export$33f3c024b4ae00a1(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); - out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); - out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); - out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); - out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); - out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); - out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); - out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); - return out; -} -function $1ac1b59392edf35b$export$a04698f914c55ed9(a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; @@ -6994,14 +6752,49 @@ function $1ac1b59392edf35b$export$a04698f914c55ed9(a) { var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + var b11 = a22 * a33 - a23 * a32; + out[0] = a11 * b11 - a12 * b10 + a13 * b09; + out[1] = a02 * b10 - a01 * b11 - a03 * b09; + out[2] = a31 * b05 - a32 * b04 + a33 * b03; + out[3] = a22 * b04 - a21 * b05 - a23 * b03; + out[4] = a12 * b08 - a10 * b11 - a13 * b07; + out[5] = a00 * b11 - a02 * b08 + a03 * b07; + out[6] = a32 * b02 - a30 * b05 - a33 * b01; + out[7] = a20 * b05 - a22 * b02 + a23 * b01; + out[8] = a10 * b10 - a11 * b08 + a13 * b06; + out[9] = a01 * b08 - a00 * b10 - a03 * b06; + out[10] = a30 * b04 - a31 * b02 + a33 * b00; + out[11] = a21 * b02 - a20 * b04 - a23 * b00; + out[12] = a11 * b07 - a10 * b09 - a12 * b06; + out[13] = a00 * b09 - a01 * b07 + a02 * b06; + out[14] = a31 * b01 - a30 * b03 - a32 * b00; + out[15] = a20 * b03 - a21 * b01 + a22 * b00; + return out; +} +function $1ac1b59392edf35b$export$a04698f914c55ed9(a) { + var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + var b0 = a00 * a11 - a01 * a10; + var b1 = a00 * a12 - a02 * a10; + var b2 = a01 * a12 - a02 * a11; + var b3 = a20 * a31 - a21 * a30; + var b4 = a20 * a32 - a22 * a30; + var b5 = a21 * a32 - a22 * a31; + var b6 = a00 * b5 - a01 * b4 + a02 * b3; + var b7 = a10 * b5 - a11 * b4 + a12 * b3; + var b8 = a20 * b2 - a21 * b1 + a22 * b0; + var b9 = a30 * b2 - a31 * b1 + a32 * b0; + // Calculate the determinant + return a13 * b6 - a03 * b7 + a33 * b8 - a23 * b9; } function $1ac1b59392edf35b$export$2060d2db72cce88f(out, a, b) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix + var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + // Cache only the current line of the second matrix var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; @@ -7097,7 +6890,7 @@ function $1ac1b59392edf35b$export$dcdf75081b88279d(out, a, v) { } function $1ac1b59392edf35b$export$bb628a54ab399bc9(out, a, rad, axis) { var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); + var len = Math.sqrt(x * x + y * y + z * z); var s, c, t; var a00, a01, a02, a03; var a10, a11, a12, a13; @@ -7124,7 +6917,8 @@ function $1ac1b59392edf35b$export$bb628a54ab399bc9(out, a, rad, axis) { a20 = a[8]; a21 = a[9]; a22 = a[10]; - a23 = a[11]; // Construct the elements of the rotation matrix + a23 = a[11]; + // Construct the elements of the rotation matrix b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; @@ -7133,7 +6927,8 @@ function $1ac1b59392edf35b$export$bb628a54ab399bc9(out, a, rad, axis) { b12 = z * y * t + x * s; b20 = x * z * t + y * s; b21 = y * z * t - x * s; - b22 = z * z * t + c; // Perform rotation-specific matrix multiplication + b22 = z * z * t + c; + // Perform rotation-specific matrix multiplication out[0] = a00 * b00 + a10 * b01 + a20 * b02; out[1] = a01 * b00 + a11 * b01 + a21 * b02; out[2] = a02 * b00 + a12 * b01 + a22 * b02; @@ -7176,7 +6971,8 @@ function $1ac1b59392edf35b$export$a59c8716592e09af(out, a, rad) { out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; - } // Perform axis-specific matrix multiplication + } + // Perform axis-specific matrix multiplication out[4] = a10 * c + a20 * s; out[5] = a11 * c + a21 * s; out[6] = a12 * c + a22 * s; @@ -7208,7 +7004,8 @@ function $1ac1b59392edf35b$export$cf71e4d4ca4d1cfd(out, a, rad) { out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; - } // Perform axis-specific matrix multiplication + } + // Perform axis-specific matrix multiplication out[0] = a00 * c - a20 * s; out[1] = a01 * c - a21 * s; out[2] = a02 * c - a22 * s; @@ -7240,7 +7037,8 @@ function $1ac1b59392edf35b$export$ea6eae3365de5b9c(out, a, rad) { out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; - } // Perform axis-specific matrix multiplication + } + // Perform axis-specific matrix multiplication out[0] = a00 * c + a10 * s; out[1] = a01 * c + a11 * s; out[2] = a02 * c + a12 * s; @@ -7291,7 +7089,7 @@ function $1ac1b59392edf35b$export$832ca188ffb1955d(out, v) { } function $1ac1b59392edf35b$export$926fc125ff3c666c(out, rad, axis) { var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); + var len = Math.sqrt(x * x + y * y + z * z); var s, c, t; if (len < $14f38b7dd89457d7$export$fd293b15f47e270) return null; len = 1 / len; @@ -7300,7 +7098,8 @@ function $1ac1b59392edf35b$export$926fc125ff3c666c(out, rad, axis) { z *= len; s = Math.sin(rad); c = Math.cos(rad); - t = 1 - c; // Perform rotation-specific matrix multiplication + t = 1 - c; + // Perform rotation-specific matrix multiplication out[0] = x * x * t + c; out[1] = y * x * t + z * s; out[2] = z * x * t - y * s; @@ -7321,7 +7120,8 @@ function $1ac1b59392edf35b$export$926fc125ff3c666c(out, rad, axis) { } function $1ac1b59392edf35b$export$dd47cc2f828c32ef(out, rad) { var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication + var c = Math.cos(rad); + // Perform axis-specific matrix multiplication out[0] = 1; out[1] = 0; out[2] = 0; @@ -7342,7 +7142,8 @@ function $1ac1b59392edf35b$export$dd47cc2f828c32ef(out, rad) { } function $1ac1b59392edf35b$export$7dc997d67d2b7f33(out, rad) { var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication + var c = Math.cos(rad); + // Perform axis-specific matrix multiplication out[0] = c; out[1] = 0; out[2] = -s; @@ -7363,7 +7164,8 @@ function $1ac1b59392edf35b$export$7dc997d67d2b7f33(out, rad) { } function $1ac1b59392edf35b$export$ad5ddaedc8f405df(out, rad) { var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication + var c = Math.cos(rad); + // Perform axis-specific matrix multiplication out[0] = c; out[1] = s; out[2] = 0; @@ -7418,7 +7220,8 @@ function $1ac1b59392edf35b$export$9545ac307f2a256b(out, q, v) { function $1ac1b59392edf35b$export$ff497f2be31cc6a(out, a) { var translation = new $14f38b7dd89457d7$export$b67359430d3b1b2(3); var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7]; - var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense + var magnitude = bx * bx + by * by + bz * bz + bw * bw; + //Only scale if it makes sense if (magnitude > 0) { translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; @@ -7447,9 +7250,9 @@ function $1ac1b59392edf35b$export$71dc54d92bd04b57(out, mat) { var m31 = mat[8]; var m32 = mat[9]; var m33 = mat[10]; - out[0] = Math.hypot(m11, m12, m13); - out[1] = Math.hypot(m21, m22, m23); - out[2] = Math.hypot(m31, m32, m33); + out[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); return out; } function $1ac1b59392edf35b$export$df3937d3b537df0a(out, mat) { @@ -7496,6 +7299,63 @@ function $1ac1b59392edf35b$export$df3937d3b537df0a(out, mat) { } return out; } +function $1ac1b59392edf35b$export$4e06b4a690896b27(out_r, out_t, out_s, mat) { + out_t[0] = mat[12]; + out_t[1] = mat[13]; + out_t[2] = mat[14]; + var m11 = mat[0]; + var m12 = mat[1]; + var m13 = mat[2]; + var m21 = mat[4]; + var m22 = mat[5]; + var m23 = mat[6]; + var m31 = mat[8]; + var m32 = mat[9]; + var m33 = mat[10]; + out_s[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13); + out_s[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23); + out_s[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33); + var is1 = 1 / out_s[0]; + var is2 = 1 / out_s[1]; + var is3 = 1 / out_s[2]; + var sm11 = m11 * is1; + var sm12 = m12 * is2; + var sm13 = m13 * is3; + var sm21 = m21 * is1; + var sm22 = m22 * is2; + var sm23 = m23 * is3; + var sm31 = m31 * is1; + var sm32 = m32 * is2; + var sm33 = m33 * is3; + var trace = sm11 + sm22 + sm33; + var S = 0; + if (trace > 0) { + S = Math.sqrt(trace + 1.0) * 2; + out_r[3] = 0.25 * S; + out_r[0] = (sm23 - sm32) / S; + out_r[1] = (sm31 - sm13) / S; + out_r[2] = (sm12 - sm21) / S; + } else if (sm11 > sm22 && sm11 > sm33) { + S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; + out_r[3] = (sm23 - sm32) / S; + out_r[0] = 0.25 * S; + out_r[1] = (sm12 + sm21) / S; + out_r[2] = (sm31 + sm13) / S; + } else if (sm22 > sm33) { + S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; + out_r[3] = (sm31 - sm13) / S; + out_r[0] = (sm12 + sm21) / S; + out_r[1] = 0.25 * S; + out_r[2] = (sm23 + sm32) / S; + } else { + S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; + out_r[3] = (sm12 - sm21) / S; + out_r[0] = (sm31 + sm13) / S; + out_r[1] = (sm23 + sm32) / S; + out_r[2] = 0.25 * S; + } + return out_r; +} function $1ac1b59392edf35b$export$ddf9c55c9f2be172(out, q, v, s) { // Quaternion math var x = q[0], y = q[1], z = q[2], w = q[3]; @@ -7635,7 +7495,7 @@ function $1ac1b59392edf35b$export$89b5708c387cac6c(out, left, right, bottom, top return out; } function $1ac1b59392edf35b$export$4cf19729ec9a96b8(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; + var f = 1.0 / Math.tan(fovy / 2); out[0] = f / aspect; out[1] = 0; out[2] = 0; @@ -7651,7 +7511,7 @@ function $1ac1b59392edf35b$export$4cf19729ec9a96b8(out, fovy, aspect, near, far) out[13] = 0; out[15] = 0; if (far != null && far !== Infinity) { - nf = 1 / (near - far); + var nf = 1 / (near - far); out[10] = (far + near) * nf; out[14] = 2 * far * near * nf; } else { @@ -7662,7 +7522,7 @@ function $1ac1b59392edf35b$export$4cf19729ec9a96b8(out, fovy, aspect, near, far) } var $1ac1b59392edf35b$export$541149539f3a4684 = $1ac1b59392edf35b$export$4cf19729ec9a96b8; function $1ac1b59392edf35b$export$294bba99a6af0c0c(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; + var f = 1.0 / Math.tan(fovy / 2); out[0] = f / aspect; out[1] = 0; out[2] = 0; @@ -7678,7 +7538,7 @@ function $1ac1b59392edf35b$export$294bba99a6af0c0c(out, fovy, aspect, near, far) out[13] = 0; out[15] = 0; if (far != null && far !== Infinity) { - nf = 1 / (near - far); + var nf = 1 / (near - far); out[10] = far * nf; out[14] = far * near * nf; } else { @@ -7772,14 +7632,14 @@ function $1ac1b59392edf35b$export$d924e14fd6d9aa66(out, eye, center, up) { z0 = eyex - centerx; z1 = eyey - centery; z2 = eyez - centerz; - len = 1 / Math.hypot(z0, z1, z2); + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); z0 *= len; z1 *= len; z2 *= len; x0 = upy * z2 - upz * z1; x1 = upz * z0 - upx * z2; x2 = upx * z1 - upy * z0; - len = Math.hypot(x0, x1, x2); + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); if (!len) { x0 = 0; x1 = 0; @@ -7793,7 +7653,7 @@ function $1ac1b59392edf35b$export$d924e14fd6d9aa66(out, eye, center, up) { y0 = z1 * x2 - z2 * x1; y1 = z2 * x0 - z0 * x2; y2 = z0 * x1 - z1 * x0; - len = Math.hypot(y0, y1, y2); + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); if (!len) { y0 = 0; y1 = 0; @@ -7862,7 +7722,7 @@ function $1ac1b59392edf35b$export$42d51816ce590c93(a) { return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; } function $1ac1b59392edf35b$export$326827e8268e9cdb(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8] + a[9] * a[9] + a[10] * a[10] + a[11] * a[11] + a[12] * a[12] + a[13] * a[13] + a[14] * a[14] + a[15] * a[15]); } function $1ac1b59392edf35b$export$e16d8520af44a096(out, a, b) { out[0] = a[0] + b[0]; @@ -8152,7 +8012,8 @@ function $ba3ca37806a2b6fa$export$6897c284b6f9f4dc(out, a) { var a20 = a[6], a21 = a[7], a22 = a[8]; var b01 = a22 * a11 - a12 * a21; var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; // Calculate the determinant + var b21 = a21 * a10 - a11 * a20; + // Calculate the determinant var det = a00 * b01 + a01 * b11 + a02 * b21; if (!det) return null; det = 1.0 / det; @@ -8335,7 +8196,8 @@ function $ba3ca37806a2b6fa$export$966b25ab6dc1b1f9(out, a) { var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant + var b11 = a22 * a33 - a23 * a32; + // Calculate the determinant var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (!det) return null; det = 1.0 / det; @@ -8366,7 +8228,7 @@ function $ba3ca37806a2b6fa$export$42d51816ce590c93(a) { return "mat3(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ")"; } function $ba3ca37806a2b6fa$export$326827e8268e9cdb(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]); + return Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3] + a[4] * a[4] + a[5] * a[5] + a[6] * a[6] + a[7] * a[7] + a[8] * a[8]); } function $ba3ca37806a2b6fa$export$e16d8520af44a096(out, a, b) { out[0] = a[0] + b[0]; @@ -8456,6 +8318,7 @@ $parcel$export($31054a6c69637582$exports, "normalize", () => $31054a6c69637582$e $parcel$export($31054a6c69637582$exports, "dot", () => $31054a6c69637582$export$94132a0e348806d4); $parcel$export($31054a6c69637582$exports, "cross", () => $31054a6c69637582$export$bb646b20bb93d339); $parcel$export($31054a6c69637582$exports, "lerp", () => $31054a6c69637582$export$3a89f8d6f6bf6c9f); +$parcel$export($31054a6c69637582$exports, "slerp", () => $31054a6c69637582$export$1544d9bc2995de08); $parcel$export($31054a6c69637582$exports, "hermite", () => $31054a6c69637582$export$ae8865616f30561c); $parcel$export($31054a6c69637582$exports, "bezier", () => $31054a6c69637582$export$b9c5f84610baddaf); $parcel$export($31054a6c69637582$exports, "random", () => $31054a6c69637582$export$4385e60b38654f68); @@ -8499,7 +8362,7 @@ function $31054a6c69637582$export$f24224f1c91d8156(a) { var x = a[0]; var y = a[1]; var z = a[2]; - return Math.hypot(x, y, z); + return Math.sqrt(x * x + y * y + z * z); } function $31054a6c69637582$export$a82be99ed2a44a7d(x, y, z) { var out = new $14f38b7dd89457d7$export$b67359430d3b1b2(3); @@ -8569,9 +8432,9 @@ function $31054a6c69637582$export$8960430cfd85939f(out, a, b) { return out; } function $31054a6c69637582$export$2077e0241d6afd3c(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); + out[0] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[0]); + out[1] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[1]); + out[2] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[2]); return out; } function $31054a6c69637582$export$dcdf75081b88279d(out, a, b) { @@ -8590,7 +8453,7 @@ function $31054a6c69637582$export$9f17032d917177de(a, b) { var x = b[0] - a[0]; var y = b[1] - a[1]; var z = b[2] - a[2]; - return Math.hypot(x, y, z); + return Math.sqrt(x * x + y * y + z * z); } function $31054a6c69637582$export$88e6ebb4fe54f538(a, b) { var x = b[0] - a[0]; @@ -8648,6 +8511,16 @@ function $31054a6c69637582$export$3a89f8d6f6bf6c9f(out, a, b, t) { out[2] = az + t * (b[2] - az); return out; } +function $31054a6c69637582$export$1544d9bc2995de08(out, a, b, t) { + var angle = Math.acos(Math.min(Math.max($31054a6c69637582$export$94132a0e348806d4(a, b), -1), 1)); + var sinTotal = Math.sin(angle); + var ratioA = Math.sin((1 - t) * angle) / sinTotal; + var ratioB = Math.sin(t * angle) / sinTotal; + out[0] = ratioA * a[0] + ratioB * b[0]; + out[1] = ratioA * a[1] + ratioB * b[1]; + out[2] = ratioA * a[2] + ratioB * b[2]; + return out; +} function $31054a6c69637582$export$ae8865616f30561c(out, a, b, c, d, t) { var factorTimes2 = t * t; var factor1 = factorTimes2 * (2 * t - 3) + 1; @@ -8673,7 +8546,7 @@ function $31054a6c69637582$export$b9c5f84610baddaf(out, a, b, c, d, t) { return out; } function $31054a6c69637582$export$4385e60b38654f68(out, scale) { - scale = scale || 1.0; + scale = scale === undefined ? 1.0 : scale; var r = $14f38b7dd89457d7$export$5ada478c8a628231() * 2.0 * Math.PI; var z = $14f38b7dd89457d7$export$5ada478c8a628231() * 2.0 - 1.0; var zScale = Math.sqrt(1.0 - z * z) * scale; @@ -8699,65 +8572,74 @@ function $31054a6c69637582$export$f0bfa0a0024626ee(out, a, m) { return out; } function $31054a6c69637582$export$c32adef9e939ce85(out, a, q) { - // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed + // Fast Vector Rotation using Quaternions by Robert Eisele + // https://raw.org/proof/vector-rotation-using-quaternions/ var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; - var x = a[0], y = a[1], z = a[2]; // var qvec = [qx, qy, qz]; - // var uv = vec3.cross([], qvec, a); - var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); - var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; // vec3.scale(uuv, uuv, 2); - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; + var vx = a[0], vy = a[1], vz = a[2]; + // t = q x v + var tx = qy * vz - qz * vy; + var ty = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + // t = 2t + tx = tx + tx; + ty = ty + ty; + tz = tz + tz; + // v + w t + q x t + out[0] = vx + qw * tx + qy * tz - qz * ty; + out[1] = vy + qw * ty + qz * tx - qx * tz; + out[2] = vz + qw * tz + qx * ty - qy * tx; return out; } function $31054a6c69637582$export$a59c8716592e09af(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin + var p = [], r = []; + //Translate point to the origin p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation + p[2] = a[2] - b[2]; + //perform rotation r[0] = p[0]; r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position + r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); + //translate to correct position out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } function $31054a6c69637582$export$cf71e4d4ca4d1cfd(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin + var p = [], r = []; + //Translate point to the origin p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation + p[2] = a[2] - b[2]; + //perform rotation r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position + r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); + //translate to correct position out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } function $31054a6c69637582$export$ea6eae3365de5b9c(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin + var p = [], r = []; + //Translate point to the origin p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation + p[2] = a[2] - b[2]; + //perform rotation r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; //translate to correct position + r[2] = p[2]; + //translate to correct position out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } function $31054a6c69637582$export$944b09d2ad10b378(a, b) { - var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && $31054a6c69637582$export$94132a0e348806d4(a, b) / mag; + var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)), cosine = mag && $31054a6c69637582$export$94132a0e348806d4(a, b) / mag; return Math.acos(Math.min(Math.max(cosine, -1), 1)); } function $31054a6c69637582$export$7f9972325ebfd559(out) { @@ -8947,10 +8829,10 @@ function $4c4ac78b213a9c07$export$8960430cfd85939f(out, a, b) { return out; } function $4c4ac78b213a9c07$export$2077e0241d6afd3c(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - out[3] = Math.round(a[3]); + out[0] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[0]); + out[1] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[1]); + out[2] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[2]); + out[3] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[3]); return out; } function $4c4ac78b213a9c07$export$dcdf75081b88279d(out, a, b) { @@ -8972,7 +8854,7 @@ function $4c4ac78b213a9c07$export$9f17032d917177de(a, b) { var y = b[1] - a[1]; var z = b[2] - a[2]; var w = b[3] - a[3]; - return Math.hypot(x, y, z, w); + return Math.sqrt(x * x + y * y + z * z + w * w); } function $4c4ac78b213a9c07$export$88e6ebb4fe54f538(a, b) { var x = b[0] - a[0]; @@ -8986,7 +8868,7 @@ function $4c4ac78b213a9c07$export$f24224f1c91d8156(a) { var y = a[1]; var z = a[2]; var w = a[3]; - return Math.hypot(x, y, z, w); + return Math.sqrt(x * x + y * y + z * z + w * w); } function $4c4ac78b213a9c07$export$ab44e1323ffc8376(a) { var x = a[0]; @@ -9049,21 +8931,21 @@ function $4c4ac78b213a9c07$export$3a89f8d6f6bf6c9f(out, a, b, t) { return out; } function $4c4ac78b213a9c07$export$4385e60b38654f68(out, scale) { - scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a + scale = scale === undefined ? 1.0 : scale; + // Marsaglia, George. Choosing a Point from the Surface of a // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. // http://projecteuclid.org/euclid.aoms/1177692644; var v1, v2, v3, v4; var s1, s2; - do { - v1 = $14f38b7dd89457d7$export$5ada478c8a628231() * 2 - 1; - v2 = $14f38b7dd89457d7$export$5ada478c8a628231() * 2 - 1; - s1 = v1 * v1 + v2 * v2; - }while (s1 >= 1); - do { - v3 = $14f38b7dd89457d7$export$5ada478c8a628231() * 2 - 1; - v4 = $14f38b7dd89457d7$export$5ada478c8a628231() * 2 - 1; - s2 = v3 * v3 + v4 * v4; - }while (s2 >= 1); + var rand; + rand = $14f38b7dd89457d7$export$5ada478c8a628231(); + v1 = rand * 2 - 1; + v2 = (4 * $14f38b7dd89457d7$export$5ada478c8a628231() - 2) * Math.sqrt(rand * -rand + rand); + s1 = v1 * v1 + v2 * v2; + rand = $14f38b7dd89457d7$export$5ada478c8a628231(); + v3 = rand * 2 - 1; + v4 = (4 * $14f38b7dd89457d7$export$5ada478c8a628231() - 2) * Math.sqrt(rand * -rand + rand); + s2 = v3 * v3 + v4 * v4; var d = Math.sqrt((1 - s1) / s2); out[0] = scale * v1; out[1] = scale * v2; @@ -9080,15 +8962,22 @@ function $4c4ac78b213a9c07$export$5ffbd13800309d59(out, a, m) { return out; } function $4c4ac78b213a9c07$export$c32adef9e939ce85(out, a, q) { - var x = a[0], y = a[1], z = a[2]; - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; + // Fast Vector Rotation using Quaternions by Robert Eisele + // https://raw.org/proof/vector-rotation-using-quaternions/ + var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; + var vx = a[0], vy = a[1], vz = a[2]; + // t = q x v + var tx = qy * vz - qz * vy; + var ty = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + // t = 2t + tx = tx + tx; + ty = ty + ty; + tz = tz + tz; + // v + w t + q x t + out[0] = vx + qw * tx + qy * tz - qz * ty; + out[1] = vy + qw * ty + qz * tx - qx * tz; + out[2] = vz + qw * tz + qx * ty - qy * tx; out[3] = a[3]; return out; } @@ -9265,15 +9154,18 @@ function $39ece26d1239bb77$export$1544d9bc2995de08(out, a, b, t) { // http://jsperf.com/quaternion-slerp-implementations var ax = a[0], ay = a[1], az = a[2], aw = a[3]; var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - var omega, cosom, sinom, scale0, scale1; // calc cosine - cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) + var omega, cosom, sinom, scale0, scale1; + // calc cosine + cosom = ax * bx + ay * by + az * bz + aw * bw; + // adjust signs (if necessary) if (cosom < 0.0) { cosom = -cosom; bx = -bx; by = -by; bz = -bz; bw = -bw; - } // calculate coefficients + } + // calculate coefficients if (1.0 - cosom > $14f38b7dd89457d7$export$fd293b15f47e270) { // standard case (slerp) omega = Math.acos(cosom); @@ -9285,7 +9177,8 @@ function $39ece26d1239bb77$export$1544d9bc2995de08(out, a, b, t) { // ... so we can do a linear interpolation scale0 = 1.0 - t; scale1 = t; - } // calculate final values + } + // calculate final values out[0] = scale0 * ax + scale1 * bx; out[1] = scale0 * ay + scale1 * by; out[2] = scale0 * az + scale1 * bz; @@ -9309,7 +9202,8 @@ function $39ece26d1239bb77$export$4385e60b38654f68(out) { function $39ece26d1239bb77$export$6897c284b6f9f4dc(out, a) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 + var invDot = dot ? 1.0 / dot : 0; + // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 out[0] = -a0 * invDot; out[1] = -a1 * invDot; out[2] = -a2 * invDot; @@ -9353,20 +9247,57 @@ function $39ece26d1239bb77$export$272a1eb8e5a4b55b(out, m) { return out; } function $39ece26d1239bb77$export$7a404a587ea85af(out, x, y, z) { - var halfToRad = 0.5 * Math.PI / 180.0; + var order = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : $14f38b7dd89457d7$export$217057687ee20298; + var halfToRad = Math.PI / 360; x *= halfToRad; - y *= halfToRad; z *= halfToRad; + y *= halfToRad; var sx = Math.sin(x); var cx = Math.cos(x); var sy = Math.sin(y); var cy = Math.cos(y); var sz = Math.sin(z); var cz = Math.cos(z); - out[0] = sx * cy * cz - cx * sy * sz; - out[1] = cx * sy * cz + sx * cy * sz; - out[2] = cx * cy * sz - sx * sy * cz; - out[3] = cx * cy * cz + sx * sy * sz; + switch(order){ + case "xyz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "xzy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yxz": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz - sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + case "yzx": + out[0] = sx * cy * cz + cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zxy": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz + sx * sy * cz; + out[3] = cx * cy * cz - sx * sy * sz; + break; + case "zyx": + out[0] = sx * cy * cz - cx * sy * sz; + out[1] = cx * sy * cz + sx * cy * sz; + out[2] = cx * cy * sz - sx * sy * cz; + out[3] = cx * cy * cz + sx * sy * sz; + break; + default: + throw new Error('Unknown angle order ' + order); + } return out; } function $39ece26d1239bb77$export$42d51816ce590c93(a) { @@ -9387,7 +9318,9 @@ var $39ece26d1239bb77$export$ab44e1323ffc8376 = $4c4ac78b213a9c07$export$ab44e13 var $39ece26d1239bb77$export$99d8dd3f32a3435 = $39ece26d1239bb77$export$ab44e1323ffc8376; var $39ece26d1239bb77$export$a3295358bff77e = $4c4ac78b213a9c07$export$a3295358bff77e; var $39ece26d1239bb77$export$f2599a5cf1109d8 = $4c4ac78b213a9c07$export$f2599a5cf1109d8; -var $39ece26d1239bb77$export$e9bab7fafb253603 = $4c4ac78b213a9c07$export$e9bab7fafb253603; +function $39ece26d1239bb77$export$e9bab7fafb253603(a, b) { + return Math.abs($4c4ac78b213a9c07$export$94132a0e348806d4(a, b)) >= 1 - $14f38b7dd89457d7$export$fd293b15f47e270; +} var $39ece26d1239bb77$export$72d66f5842c00904 = function() { var tmpvec3 = $31054a6c69637582$export$185802fd694ee1f5(); var xUnitVec3 = $31054a6c69637582$export$a82be99ed2a44a7d(1, 0, 0); @@ -9485,6 +9418,7 @@ $parcel$export($91b0cc4981465964$exports, "transformMat3", () => $91b0cc49814659 $parcel$export($91b0cc4981465964$exports, "transformMat4", () => $91b0cc4981465964$export$5ffbd13800309d59); $parcel$export($91b0cc4981465964$exports, "rotate", () => $91b0cc4981465964$export$bb628a54ab399bc9); $parcel$export($91b0cc4981465964$exports, "angle", () => $91b0cc4981465964$export$944b09d2ad10b378); +$parcel$export($91b0cc4981465964$exports, "signedAngle", () => $91b0cc4981465964$export$2c039ab0034c6824); $parcel$export($91b0cc4981465964$exports, "zero", () => $91b0cc4981465964$export$7f9972325ebfd559); $parcel$export($91b0cc4981465964$exports, "str", () => $91b0cc4981465964$export$42d51816ce590c93); $parcel$export($91b0cc4981465964$exports, "exactEquals", () => $91b0cc4981465964$export$f2599a5cf1109d8); @@ -9569,8 +9503,8 @@ function $91b0cc4981465964$export$8960430cfd85939f(out, a, b) { return out; } function $91b0cc4981465964$export$2077e0241d6afd3c(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); + out[0] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[0]); + out[1] = $14f38b7dd89457d7$export$2077e0241d6afd3c(a[1]); return out; } function $91b0cc4981465964$export$dcdf75081b88279d(out, a, b) { @@ -9585,7 +9519,7 @@ function $91b0cc4981465964$export$19cedf1da84ba854(out, a, b, scale) { } function $91b0cc4981465964$export$9f17032d917177de(a, b) { var x = b[0] - a[0], y = b[1] - a[1]; - return Math.hypot(x, y); + return Math.sqrt(x * x + y * y); } function $91b0cc4981465964$export$88e6ebb4fe54f538(a, b) { var x = b[0] - a[0], y = b[1] - a[1]; @@ -9593,7 +9527,7 @@ function $91b0cc4981465964$export$88e6ebb4fe54f538(a, b) { } function $91b0cc4981465964$export$f24224f1c91d8156(a) { var x = a[0], y = a[1]; - return Math.hypot(x, y); + return Math.sqrt(x * x + y * y); } function $91b0cc4981465964$export$ab44e1323ffc8376(a) { var x = a[0], y = a[1]; @@ -9634,7 +9568,7 @@ function $91b0cc4981465964$export$3a89f8d6f6bf6c9f(out, a, b, t) { return out; } function $91b0cc4981465964$export$4385e60b38654f68(out, scale) { - scale = scale || 1.0; + scale = scale === undefined ? 1.0 : scale; var r = $14f38b7dd89457d7$export$5ada478c8a628231() * 2.0 * Math.PI; out[0] = Math.cos(r) * scale; out[1] = Math.sin(r) * scale; @@ -9667,16 +9601,19 @@ function $91b0cc4981465964$export$5ffbd13800309d59(out, a, m) { } function $91b0cc4981465964$export$bb628a54ab399bc9(out, a, b, rad) { //Translate point to the origin - var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); //perform rotation and translate to correct position + var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); + //perform rotation and translate to correct position out[0] = p0 * cosC - p1 * sinC + b[0]; out[1] = p0 * sinC + p1 * cosC + b[1]; return out; } function $91b0cc4981465964$export$944b09d2ad10b378(a, b) { - var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], // mag is the product of the magnitudes of a and b - mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), // mag &&.. short circuits if mag == 0 - cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 - return Math.acos(Math.min(Math.max(cosine, -1), 1)); + var ax = a[0], ay = a[1], bx = b[0], by = b[1]; + return Math.abs(Math.atan2(ay * bx - ax * by, ax * bx + ay * by)); +} +function $91b0cc4981465964$export$2c039ab0034c6824(a, b) { + var ax = a[0], ay = a[1], bx = b[0], by = b[1]; + return Math.atan2(ax * by - ay * bx, ax * bx + ay * by); } function $91b0cc4981465964$export$7f9972325ebfd559(out) { out[0] = 0.0; @@ -10330,6 +10267,7 @@ class $3c8e74dd6c09e751$export$29cd7b75162a9425 { this.isTransitionPickingEnabled = false; this.backgroundColor = (0, $4c4ac78b213a9c07$exports).create(); this.theme = (0, $4a6417d29706362f$export$14faa19a0f3bbeb2).light; + this.ambientColor = (0, $31054a6c69637582$exports).create(); this.renderMode = (0, $4a6417d29706362f$export$2386c8c1d9db2d57).color; this.tilesX = 1; this.tilesY = 1; @@ -10485,6 +10423,8 @@ const $548ced3eab978a8c$export$de37189af674e8e1 = { redyellowgreen: "redyellowgreen", spectral: "spectral", accent: "accent", + category10: "category10", + category20: "category20", dark2: "dark2", paired: "paired", pastel1: "pastel1", @@ -11571,6 +11511,106 @@ class $548ced3eab978a8c$export$35624e624bb61356 { 102 ]) }, + "category10": { + type: $548ced3eab978a8c$export$8f5ef0b663dcd813.qualitative, + colors: new Uint8Array([ + 31, + 119, + 180, + 255, + 127, + 14, + 44, + 160, + 44, + 214, + 39, + 40, + 148, + 103, + 189, + 140, + 86, + 75, + 227, + 119, + 194, + 127, + 127, + 127, + 188, + 189, + 34, + 23, + 190, + 207 + ]) + }, + "category20": { + type: $548ced3eab978a8c$export$8f5ef0b663dcd813.qualitative, + colors: new Uint8Array([ + 31, + 119, + 180, + 174, + 199, + 232, + 255, + 127, + 14, + 255, + 187, + 120, + 44, + 160, + 44, + 152, + 223, + 138, + 214, + 39, + 40, + 255, + 152, + 150, + 148, + 103, + 189, + 197, + 176, + 213, + 140, + 86, + 75, + 196, + 156, + 148, + 227, + 119, + 194, + 247, + 182, + 210, + 127, + 127, + 127, + 199, + 199, + 199, + 188, + 189, + 34, + 219, + 219, + 141, + 23, + 190, + 207, + 158, + 218, + 229 + ]) + }, "dark2": { type: $548ced3eab978a8c$export$8f5ef0b663dcd813.qualitative, colors: new Uint8Array([ @@ -12292,8 +12332,98 @@ class $0a0587bd8b0d58e8$export$849e31d725692576 { static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { toBufferView.setUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); } + static getMatId(bufferView, index) { + return bufferView.getUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index, value) { + bufferView.setUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES, value); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index, value) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint16(offset) / 0xFF; + value[1] = bufferView.getUint16(offset + 2) / 0xFF; + value[2] = bufferView.getUint16(offset + 4) / 0xFF; + } + static setMatColor(bufferView, index, value) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFF); + bufferView.setUint16(offset + 2, value[1] * 0xFF); + bufferView.setUint16(offset + 4, value[2] * 0xFF); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset) / 0xFF; + } + static setMatFuzz(bufferView, index, value) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset, value * 0xFF); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset) / 0xFF; + } + static setMatGloss(bufferView, index, value) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset, value * 0xFF); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index) { + return bufferView.getFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index, value) { + bufferView.setFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, value, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index) { + return bufferView.getFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index, value) { + bufferView.setFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32($0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index, value) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint8(offset) / 0xFF; + value[1] = bufferView.getUint8(offset + 1) / 0xFF; + value[2] = bufferView.getUint8(offset + 2) / 0xFF; + value[3] = bufferView.getUint8(offset + 3) / 0xFF; + } + static setSegColor(bufferView, index, value) { + const offset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + bufferView.setUint8(offset + 2, value[2] * 0xFF); + bufferView.setUint8(offset + 3, value[3] * 0xFF); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = $0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); + } } -$0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES = 92; +$0a0587bd8b0d58e8$export$849e31d725692576.SIZE_BYTES = 120; $0a0587bd8b0d58e8$export$849e31d725692576.ID_HOVER_OFFSET_BYTES = 0; $0a0587bd8b0d58e8$export$849e31d725692576.ID_COLOR_OFFSET_BYTES = 4; $0a0587bd8b0d58e8$export$849e31d725692576.ORDER_OFFSET_BYTES = 8; @@ -12311,6 +12441,13 @@ $0a0587bd8b0d58e8$export$849e31d725692576.SDF_BUFFER_OFFSET_BYTES = 82; $0a0587bd8b0d58e8$export$849e31d725692576.SDF_BORDER_OFFSET_BYTES = 83; $0a0587bd8b0d58e8$export$849e31d725692576.PARAMETER_1_OFFSET_BYTES = 84; $0a0587bd8b0d58e8$export$849e31d725692576.PARAMETER_2_OFFSET_BYTES = 88; +$0a0587bd8b0d58e8$export$849e31d725692576.MAT_TYPE_OFFSET_BYTES = 92; +$0a0587bd8b0d58e8$export$849e31d725692576.MAT_COLOR_OFFSET_BYTES = 112; +$0a0587bd8b0d58e8$export$849e31d725692576.MAT_FUZZ_OFFSET_BYTES = 96; +$0a0587bd8b0d58e8$export$849e31d725692576.MAT_GLOSS_OFFSET_BYTES = 97; +$0a0587bd8b0d58e8$export$849e31d725692576.MAT_DENSITY_OFFSET_BYTES = 100; +$0a0587bd8b0d58e8$export$849e31d725692576.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; +$0a0587bd8b0d58e8$export$849e31d725692576.SEG_COLOR_OFFSET_BYTES = 108; class $636d0ad960a10a23$export$fac54d16266765a9 { @@ -17357,7 +17494,8 @@ const $4a6417d29706362f$export$80d48287646c9e3b = { hexPrismSdf: "hexPrismSdf", sdf: "sdf", disk: "disk", - ringSdf: "ringSdf" + ringSdf: "ringSdf", + tubeSdf: "tubeSdf" }; const $4a6417d29706362f$export$226dc1249c607930 = { none: "none", @@ -17429,158 +17567,755 @@ const $4a6417d29706362f$export$2386c8c1d9db2d57 = { /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. - */ -class $42b018e85c350e4a$export$c537fa0d021d010b { -} -$42b018e85c350e4a$export$c537fa0d021d010b.MediumVioletRed = (0, $31054a6c69637582$exports).fromValues(0xc7, 0x15, 0x85); -$42b018e85c350e4a$export$c537fa0d021d010b.DeepPink = (0, $31054a6c69637582$exports).fromValues(0xff, 0x14, 0x93); -$42b018e85c350e4a$export$c537fa0d021d010b.PaleVioletRed = (0, $31054a6c69637582$exports).fromValues(0xdb, 0x70, 0x93); -$42b018e85c350e4a$export$c537fa0d021d010b.HotPink = (0, $31054a6c69637582$exports).fromValues(0xff, 0x69, 0xb4); -$42b018e85c350e4a$export$c537fa0d021d010b.LightPink = (0, $31054a6c69637582$exports).fromValues(0xff, 0xb6, 0xc1); -$42b018e85c350e4a$export$c537fa0d021d010b.Pink = (0, $31054a6c69637582$exports).fromValues(0xff, 0xc0, 0xcb); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkRed = (0, $31054a6c69637582$exports).fromValues(0x8b, 0x00, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Red = (0, $31054a6c69637582$exports).fromValues(0xff, 0x00, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Firebrick = (0, $31054a6c69637582$exports).fromValues(0xb2, 0x22, 0x22); -$42b018e85c350e4a$export$c537fa0d021d010b.Crimson = (0, $31054a6c69637582$exports).fromValues(0xdc, 0x14, 0x3c); -$42b018e85c350e4a$export$c537fa0d021d010b.IndianRed = (0, $31054a6c69637582$exports).fromValues(0xcd, 0x5c, 0x5c); -$42b018e85c350e4a$export$c537fa0d021d010b.LightCoral = (0, $31054a6c69637582$exports).fromValues(0xf0, 0x80, 0x80); -$42b018e85c350e4a$export$c537fa0d021d010b.Salmon = (0, $31054a6c69637582$exports).fromValues(0xfa, 0x80, 0x72); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkSalmon = (0, $31054a6c69637582$exports).fromValues(0xe9, 0x96, 0x7a); -$42b018e85c350e4a$export$c537fa0d021d010b.LightSalmon = (0, $31054a6c69637582$exports).fromValues(0xff, 0xa0, 0x7a); -$42b018e85c350e4a$export$c537fa0d021d010b.OrangeRed = (0, $31054a6c69637582$exports).fromValues(0xff, 0x45, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Tomato = (0, $31054a6c69637582$exports).fromValues(0xff, 0x63, 0x47); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkOrange = (0, $31054a6c69637582$exports).fromValues(0xff, 0x8c, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Coral = (0, $31054a6c69637582$exports).fromValues(0xff, 0x7f, 0x50); -$42b018e85c350e4a$export$c537fa0d021d010b.Orange = (0, $31054a6c69637582$exports).fromValues(0xff, 0xa5, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkKhaki = (0, $31054a6c69637582$exports).fromValues(0xbd, 0xb7, 0x6b); -$42b018e85c350e4a$export$c537fa0d021d010b.Gold = (0, $31054a6c69637582$exports).fromValues(0xff, 0xd7, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Khaki = (0, $31054a6c69637582$exports).fromValues(0xf0, 0xe6, 0x8c); -$42b018e85c350e4a$export$c537fa0d021d010b.PeachPuff = (0, $31054a6c69637582$exports).fromValues(0xff, 0xda, 0xb9); -$42b018e85c350e4a$export$c537fa0d021d010b.Yellow = (0, $31054a6c69637582$exports).fromValues(0xff, 0xff, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.PaleGoldenrod = (0, $31054a6c69637582$exports).fromValues(0xee, 0xe8, 0xaa); -$42b018e85c350e4a$export$c537fa0d021d010b.Moccasin = (0, $31054a6c69637582$exports).fromValues(0xff, 0xe4, 0xb5); -$42b018e85c350e4a$export$c537fa0d021d010b.PapayaWhip = (0, $31054a6c69637582$exports).fromValues(0xff, 0xef, 0xd5); -$42b018e85c350e4a$export$c537fa0d021d010b.LightGoldenrodYellow = (0, $31054a6c69637582$exports).fromValues(0xfa, 0xfa, 0xd2); -$42b018e85c350e4a$export$c537fa0d021d010b.LemonChiffon = (0, $31054a6c69637582$exports).fromValues(0xff, 0xfa, 0xcd); -$42b018e85c350e4a$export$c537fa0d021d010b.LightYellow = (0, $31054a6c69637582$exports).fromValues(0xff, 0xff, 0xe0); -$42b018e85c350e4a$export$c537fa0d021d010b.Maroon = (0, $31054a6c69637582$exports).fromValues(0x80, 0x00, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Brown = (0, $31054a6c69637582$exports).fromValues(0xa5, 0x2a, 0x2a); -$42b018e85c350e4a$export$c537fa0d021d010b.SaddleBrown = (0, $31054a6c69637582$exports).fromValues(0x8b, 0x45, 0x13); -$42b018e85c350e4a$export$c537fa0d021d010b.Sienna = (0, $31054a6c69637582$exports).fromValues(0xa0, 0x52, 0x2d); -$42b018e85c350e4a$export$c537fa0d021d010b.Chocolate = (0, $31054a6c69637582$exports).fromValues(0xd2, 0x69, 0x1e); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkGoldenrod = (0, $31054a6c69637582$exports).fromValues(0xb8, 0x86, 0x0b); -$42b018e85c350e4a$export$c537fa0d021d010b.Peru = (0, $31054a6c69637582$exports).fromValues(0xcd, 0x85, 0x3f); -$42b018e85c350e4a$export$c537fa0d021d010b.RosyBrown = (0, $31054a6c69637582$exports).fromValues(0xbc, 0x8f, 0x8f); -$42b018e85c350e4a$export$c537fa0d021d010b.Goldenrod = (0, $31054a6c69637582$exports).fromValues(0xda, 0xa5, 0x20); -$42b018e85c350e4a$export$c537fa0d021d010b.SandyBrown = (0, $31054a6c69637582$exports).fromValues(0xf4, 0xa4, 0x60); -$42b018e85c350e4a$export$c537fa0d021d010b.Tan = (0, $31054a6c69637582$exports).fromValues(0xd2, 0xb4, 0x8c); -$42b018e85c350e4a$export$c537fa0d021d010b.Burlywood = (0, $31054a6c69637582$exports).fromValues(0xde, 0xb8, 0x87); -$42b018e85c350e4a$export$c537fa0d021d010b.Wheat = (0, $31054a6c69637582$exports).fromValues(0xf5, 0xde, 0xb3); -$42b018e85c350e4a$export$c537fa0d021d010b.NavajoWhite = (0, $31054a6c69637582$exports).fromValues(0xff, 0xde, 0xad); -$42b018e85c350e4a$export$c537fa0d021d010b.Bisque = (0, $31054a6c69637582$exports).fromValues(0xff, 0xe4, 0xc4); -$42b018e85c350e4a$export$c537fa0d021d010b.BlanchedAlmond = (0, $31054a6c69637582$exports).fromValues(0xff, 0xeb, 0xcd); -$42b018e85c350e4a$export$c537fa0d021d010b.Cornsilk = (0, $31054a6c69637582$exports).fromValues(0xff, 0xf8, 0xdc); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkGreen = (0, $31054a6c69637582$exports).fromValues(0x00, 0x64, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Green = (0, $31054a6c69637582$exports).fromValues(0x00, 0x80, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkOliveGreen = (0, $31054a6c69637582$exports).fromValues(0x55, 0x6b, 0x2f); -$42b018e85c350e4a$export$c537fa0d021d010b.ForestGreen = (0, $31054a6c69637582$exports).fromValues(0x22, 0x8b, 0x22); -$42b018e85c350e4a$export$c537fa0d021d010b.SeaGreen = (0, $31054a6c69637582$exports).fromValues(0x2e, 0x8b, 0x57); -$42b018e85c350e4a$export$c537fa0d021d010b.Olive = (0, $31054a6c69637582$exports).fromValues(0x80, 0x80, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.OliveDrab = (0, $31054a6c69637582$exports).fromValues(0x6b, 0x8e, 0x23); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumSeaGreen = (0, $31054a6c69637582$exports).fromValues(0x3c, 0xb3, 0x71); -$42b018e85c350e4a$export$c537fa0d021d010b.LimeGreen = (0, $31054a6c69637582$exports).fromValues(0x32, 0xcd, 0x32); -$42b018e85c350e4a$export$c537fa0d021d010b.Lime = (0, $31054a6c69637582$exports).fromValues(0x00, 0xff, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.SpringGreen = (0, $31054a6c69637582$exports).fromValues(0x00, 0xff, 0x7f); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumSpringGreen = (0, $31054a6c69637582$exports).fromValues(0x00, 0xfa, 0x9a); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkSeaGreen = (0, $31054a6c69637582$exports).fromValues(0x8f, 0xbc, 0x8f); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumAquamarine = (0, $31054a6c69637582$exports).fromValues(0x66, 0xcd, 0xaa); -$42b018e85c350e4a$export$c537fa0d021d010b.YellowGreen = (0, $31054a6c69637582$exports).fromValues(0x9a, 0xcd, 0x32); -$42b018e85c350e4a$export$c537fa0d021d010b.LawnGreen = (0, $31054a6c69637582$exports).fromValues(0x7c, 0xfc, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.Chartreuse = (0, $31054a6c69637582$exports).fromValues(0x7f, 0xff, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.LightGreen = (0, $31054a6c69637582$exports).fromValues(0x90, 0xee, 0x90); -$42b018e85c350e4a$export$c537fa0d021d010b.GreenYellow = (0, $31054a6c69637582$exports).fromValues(0xad, 0xff, 0x2f); -$42b018e85c350e4a$export$c537fa0d021d010b.PaleGreen = (0, $31054a6c69637582$exports).fromValues(0x98, 0xfb, 0x98); -$42b018e85c350e4a$export$c537fa0d021d010b.Teal = (0, $31054a6c69637582$exports).fromValues(0x00, 0x80, 0x80); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkCyan = (0, $31054a6c69637582$exports).fromValues(0x00, 0x8b, 0x8b); -$42b018e85c350e4a$export$c537fa0d021d010b.LightSeaGreen = (0, $31054a6c69637582$exports).fromValues(0x20, 0xb2, 0xaa); -$42b018e85c350e4a$export$c537fa0d021d010b.CadetBlue = (0, $31054a6c69637582$exports).fromValues(0x5f, 0x9e, 0xa0); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkTurquoise = (0, $31054a6c69637582$exports).fromValues(0x00, 0xce, 0xd1); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumTurquoise = (0, $31054a6c69637582$exports).fromValues(0x48, 0xd1, 0xcc); -$42b018e85c350e4a$export$c537fa0d021d010b.Turquoise = (0, $31054a6c69637582$exports).fromValues(0x40, 0xe0, 0xd0); -$42b018e85c350e4a$export$c537fa0d021d010b.Aqua = (0, $31054a6c69637582$exports).fromValues(0x00, 0xff, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.Cyan = (0, $31054a6c69637582$exports).fromValues(0x00, 0xff, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.Aquamarine = (0, $31054a6c69637582$exports).fromValues(0x7f, 0xff, 0xd4); -$42b018e85c350e4a$export$c537fa0d021d010b.PaleTurquoise = (0, $31054a6c69637582$exports).fromValues(0xaf, 0xee, 0xee); -$42b018e85c350e4a$export$c537fa0d021d010b.LightCyan = (0, $31054a6c69637582$exports).fromValues(0xe0, 0xff, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.Navy = (0, $31054a6c69637582$exports).fromValues(0x00, 0x00, 0x80); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkBlue = (0, $31054a6c69637582$exports).fromValues(0x00, 0x00, 0x8b); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumBlue = (0, $31054a6c69637582$exports).fromValues(0x00, 0x00, 0xcd); -$42b018e85c350e4a$export$c537fa0d021d010b.Blue = (0, $31054a6c69637582$exports).fromValues(0x00, 0x00, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.MidnightBlue = (0, $31054a6c69637582$exports).fromValues(0x19, 0x19, 0x70); -$42b018e85c350e4a$export$c537fa0d021d010b.RoyalBlue = (0, $31054a6c69637582$exports).fromValues(0x41, 0x69, 0xe1); -$42b018e85c350e4a$export$c537fa0d021d010b.SteelBlue = (0, $31054a6c69637582$exports).fromValues(0x46, 0x82, 0xb4); -$42b018e85c350e4a$export$c537fa0d021d010b.DodgerBlue = (0, $31054a6c69637582$exports).fromValues(0x1e, 0x90, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.DeepSkyBlue = (0, $31054a6c69637582$exports).fromValues(0x00, 0xbf, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.CornflowerBlue = (0, $31054a6c69637582$exports).fromValues(0x64, 0x95, 0xed); -$42b018e85c350e4a$export$c537fa0d021d010b.SkyBlue = (0, $31054a6c69637582$exports).fromValues(0x87, 0xce, 0xeb); -$42b018e85c350e4a$export$c537fa0d021d010b.LightSkyBlue = (0, $31054a6c69637582$exports).fromValues(0x87, 0xce, 0xfa); -$42b018e85c350e4a$export$c537fa0d021d010b.LightSteelBlue = (0, $31054a6c69637582$exports).fromValues(0xb0, 0xc4, 0xde); -$42b018e85c350e4a$export$c537fa0d021d010b.LightBlue = (0, $31054a6c69637582$exports).fromValues(0xad, 0xd8, 0xe6); -$42b018e85c350e4a$export$c537fa0d021d010b.PowderBlue = (0, $31054a6c69637582$exports).fromValues(0xb0, 0xe0, 0xe6); -$42b018e85c350e4a$export$c537fa0d021d010b.Indigo = (0, $31054a6c69637582$exports).fromValues(0x4b, 0x00, 0x82); -$42b018e85c350e4a$export$c537fa0d021d010b.Purple = (0, $31054a6c69637582$exports).fromValues(0x80, 0x00, 0x80); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkMagenta = (0, $31054a6c69637582$exports).fromValues(0x8b, 0x00, 0x8b); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkViolet = (0, $31054a6c69637582$exports).fromValues(0x94, 0x00, 0xd3); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkSlateBlue = (0, $31054a6c69637582$exports).fromValues(0x48, 0x3d, 0x8b); -$42b018e85c350e4a$export$c537fa0d021d010b.BlueViolet = (0, $31054a6c69637582$exports).fromValues(0x8a, 0x2b, 0xe2); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkOrchid = (0, $31054a6c69637582$exports).fromValues(0x99, 0x32, 0xcc); -$42b018e85c350e4a$export$c537fa0d021d010b.Fuchsia = (0, $31054a6c69637582$exports).fromValues(0xff, 0x00, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.Magenta = (0, $31054a6c69637582$exports).fromValues(0xff, 0x00, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.SlateBlue = (0, $31054a6c69637582$exports).fromValues(0x6a, 0x5a, 0xcd); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumSlateBlue = (0, $31054a6c69637582$exports).fromValues(0x7b, 0x68, 0xee); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumOrchid = (0, $31054a6c69637582$exports).fromValues(0xba, 0x55, 0xd3); -$42b018e85c350e4a$export$c537fa0d021d010b.MediumPurple = (0, $31054a6c69637582$exports).fromValues(0x93, 0x70, 0xdb); -$42b018e85c350e4a$export$c537fa0d021d010b.Orchid = (0, $31054a6c69637582$exports).fromValues(0xda, 0x70, 0xd6); -$42b018e85c350e4a$export$c537fa0d021d010b.Violet = (0, $31054a6c69637582$exports).fromValues(0xee, 0x82, 0xee); -$42b018e85c350e4a$export$c537fa0d021d010b.Plum = (0, $31054a6c69637582$exports).fromValues(0xdd, 0xa0, 0xdd); -$42b018e85c350e4a$export$c537fa0d021d010b.Thistle = (0, $31054a6c69637582$exports).fromValues(0xd8, 0xbf, 0xd8); -$42b018e85c350e4a$export$c537fa0d021d010b.Lavender = (0, $31054a6c69637582$exports).fromValues(0xe6, 0xe6, 0xfa); -$42b018e85c350e4a$export$c537fa0d021d010b.MistyRose = (0, $31054a6c69637582$exports).fromValues(0xff, 0xe4, 0xe1); -$42b018e85c350e4a$export$c537fa0d021d010b.AntiqueWhite = (0, $31054a6c69637582$exports).fromValues(0xfa, 0xeb, 0xd7); -$42b018e85c350e4a$export$c537fa0d021d010b.Linen = (0, $31054a6c69637582$exports).fromValues(0xfa, 0xf0, 0xe6); -$42b018e85c350e4a$export$c537fa0d021d010b.Beige = (0, $31054a6c69637582$exports).fromValues(0xf5, 0xf5, 0xdc); -$42b018e85c350e4a$export$c537fa0d021d010b.WhiteSmoke = (0, $31054a6c69637582$exports).fromValues(0xf5, 0xf5, 0xf5); -$42b018e85c350e4a$export$c537fa0d021d010b.LavenderBlush = (0, $31054a6c69637582$exports).fromValues(0xff, 0xf0, 0xf5); -$42b018e85c350e4a$export$c537fa0d021d010b.OldLace = (0, $31054a6c69637582$exports).fromValues(0xfd, 0xf5, 0xe6); -$42b018e85c350e4a$export$c537fa0d021d010b.AliceBlue = (0, $31054a6c69637582$exports).fromValues(0xf0, 0xf8, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.Seashell = (0, $31054a6c69637582$exports).fromValues(0xff, 0xf5, 0xee); -$42b018e85c350e4a$export$c537fa0d021d010b.GhostWhite = (0, $31054a6c69637582$exports).fromValues(0xf8, 0xf8, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.Honeydew = (0, $31054a6c69637582$exports).fromValues(0xf0, 0xff, 0xf0); -$42b018e85c350e4a$export$c537fa0d021d010b.FloralWhite = (0, $31054a6c69637582$exports).fromValues(0xff, 0xfa, 0xf0); -$42b018e85c350e4a$export$c537fa0d021d010b.Azure = (0, $31054a6c69637582$exports).fromValues(0xf0, 0xff, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.MintCream = (0, $31054a6c69637582$exports).fromValues(0xf5, 0xff, 0xfa); -$42b018e85c350e4a$export$c537fa0d021d010b.Snow = (0, $31054a6c69637582$exports).fromValues(0xff, 0xfa, 0xfa); -$42b018e85c350e4a$export$c537fa0d021d010b.Ivory = (0, $31054a6c69637582$exports).fromValues(0xff, 0xff, 0xf0); -$42b018e85c350e4a$export$c537fa0d021d010b.White = (0, $31054a6c69637582$exports).fromValues(0xff, 0xff, 0xff); -$42b018e85c350e4a$export$c537fa0d021d010b.Black = (0, $31054a6c69637582$exports).fromValues(0x00, 0x00, 0x00); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkSlateGray = (0, $31054a6c69637582$exports).fromValues(0x2f, 0x4f, 0x4f); -$42b018e85c350e4a$export$c537fa0d021d010b.DimGray = (0, $31054a6c69637582$exports).fromValues(0x69, 0x69, 0x69); -$42b018e85c350e4a$export$c537fa0d021d010b.SlateGray = (0, $31054a6c69637582$exports).fromValues(0x70, 0x80, 0x90); -$42b018e85c350e4a$export$c537fa0d021d010b.Gray = (0, $31054a6c69637582$exports).fromValues(0x80, 0x80, 0x80); -$42b018e85c350e4a$export$c537fa0d021d010b.LightSlateGray = (0, $31054a6c69637582$exports).fromValues(0x77, 0x88, 0x99); -$42b018e85c350e4a$export$c537fa0d021d010b.DarkGray = (0, $31054a6c69637582$exports).fromValues(0xa9, 0xa9, 0xa9); -$42b018e85c350e4a$export$c537fa0d021d010b.Silver = (0, $31054a6c69637582$exports).fromValues(0xc0, 0xc0, 0xc0); -$42b018e85c350e4a$export$c537fa0d021d010b.LightGray = (0, $31054a6c69637582$exports).fromValues(0xd3, 0xd3, 0xd3); -$42b018e85c350e4a$export$c537fa0d021d010b.Gainsboro = (0, $31054a6c69637582$exports).fromValues(0xdc, 0xdc, 0xdc); -$42b018e85c350e4a$export$c537fa0d021d010b.Copper = (0, $31054a6c69637582$exports).fromValues(0xb8, 0x73, 0x33); -$42b018e85c350e4a$export$c537fa0d021d010b.Bronze = (0, $31054a6c69637582$exports).fromValues(0xcd, 0x7f, 0x32); -$42b018e85c350e4a$export$c537fa0d021d010b.Steel = (0, $31054a6c69637582$exports).fromValues(0xce, 0xd2, 0xd7); -$42b018e85c350e4a$export$c537fa0d021d010b.Platinum = (0, $31054a6c69637582$exports).fromValues(0xe5, 0xe4, 0xe2); -$42b018e85c350e4a$export$c537fa0d021d010b.Gunmetal = (0, $31054a6c69637582$exports).fromValues(0x5c, 0x5d, 0x5b); -$42b018e85c350e4a$export$c537fa0d021d010b.Titanium = (0, $31054a6c69637582$exports).fromValues(0x87, 0x86, 0x81); -$42b018e85c350e4a$export$c537fa0d021d010b.RoseGold = (0, $31054a6c69637582$exports).fromValues(0xcb, 0xa3, 0xb2); -$42b018e85c350e4a$export$c537fa0d021d010b.AquaGlass = (0, $31054a6c69637582$exports).fromValues(0xd2, 0xe8, 0xdf); -$42b018e85c350e4a$export$c537fa0d021d010b.BlueGlass = (0, $31054a6c69637582$exports).fromValues(0xc7, 0xe3, 0xe1); + */ class $42b018e85c350e4a$export$6e15e29aac2b1db8 { +} +$42b018e85c350e4a$export$6e15e29aac2b1db8.colors = { + "mediumvioletred": [ + 0xc7, + 0x15, + 0x85 + ], + "deeppink": [ + 0xff, + 0x14, + 0x93 + ], + "palevioletred": [ + 0xdb, + 0x70, + 0x93 + ], + "hotpink": [ + 0xff, + 0x69, + 0xb4 + ], + "lightpink": [ + 0xff, + 0xb6, + 0xc1 + ], + "pink": [ + 0xff, + 0xc0, + 0xcb + ], + "darkred": [ + 0x8b, + 0x00, + 0x00 + ], + "red": [ + 0xff, + 0x00, + 0x00 + ], + "firebrick": [ + 0xb2, + 0x22, + 0x22 + ], + "crimson": [ + 0xdc, + 0x14, + 0x3c + ], + "indianred": [ + 0xcd, + 0x5c, + 0x5c + ], + "lightcoral": [ + 0xf0, + 0x80, + 0x80 + ], + "salmon": [ + 0xfa, + 0x80, + 0x72 + ], + "darksalmon": [ + 0xe9, + 0x96, + 0x7a + ], + "lightsalmon": [ + 0xff, + 0xa0, + 0x7a + ], + "orangered": [ + 0xff, + 0x45, + 0x00 + ], + "tomato": [ + 0xff, + 0x63, + 0x47 + ], + "darkorange": [ + 0xff, + 0x8c, + 0x00 + ], + "coral": [ + 0xff, + 0x7f, + 0x50 + ], + "orange": [ + 0xff, + 0xa5, + 0x00 + ], + "darkkhaki": [ + 0xbd, + 0xb7, + 0x6b + ], + "gold": [ + 0xff, + 0xd7, + 0x00 + ], + "khaki": [ + 0xf0, + 0xe6, + 0x8c + ], + "peachpuff": [ + 0xff, + 0xda, + 0xb9 + ], + "yellow": [ + 0xff, + 0xff, + 0x00 + ], + "palegoldenrod": [ + 0xee, + 0xe8, + 0xaa + ], + "moccasin": [ + 0xff, + 0xe4, + 0xb5 + ], + "papayawhip": [ + 0xff, + 0xef, + 0xd5 + ], + "lightgoldenrodyellow": [ + 0xfa, + 0xfa, + 0xd2 + ], + "lemonchiffon": [ + 0xff, + 0xfa, + 0xcd + ], + "lightyellow": [ + 0xff, + 0xff, + 0xe0 + ], + "maroon": [ + 0x80, + 0x00, + 0x00 + ], + "brown": [ + 0xa5, + 0x2a, + 0x2a + ], + "saddlebrown": [ + 0x8b, + 0x45, + 0x13 + ], + "sienna": [ + 0xa0, + 0x52, + 0x2d + ], + "chocolate": [ + 0xd2, + 0x69, + 0x1e + ], + "darkgoldenrod": [ + 0xb8, + 0x86, + 0x0b + ], + "peru": [ + 0xcd, + 0x85, + 0x3f + ], + "rosybrown": [ + 0xbc, + 0x8f, + 0x8f + ], + "goldenrod": [ + 0xda, + 0xa5, + 0x20 + ], + "sandybrown": [ + 0xf4, + 0xa4, + 0x60 + ], + "tan": [ + 0xd2, + 0xb4, + 0x8c + ], + "burlywood": [ + 0xde, + 0xb8, + 0x87 + ], + "wheat": [ + 0xf5, + 0xde, + 0xb3 + ], + "navajowhite": [ + 0xff, + 0xde, + 0xad + ], + "bisque": [ + 0xff, + 0xe4, + 0xc4 + ], + "blanchedalmond": [ + 0xff, + 0xeb, + 0xcd + ], + "cornsilk": [ + 0xff, + 0xf8, + 0xdc + ], + "darkgreen": [ + 0x00, + 0x64, + 0x00 + ], + "green": [ + 0x00, + 0x80, + 0x00 + ], + "darkolivegreen": [ + 0x55, + 0x6b, + 0x2f + ], + "forestgreen": [ + 0x22, + 0x8b, + 0x22 + ], + "seagreen": [ + 0x2e, + 0x8b, + 0x57 + ], + "olive": [ + 0x80, + 0x80, + 0x00 + ], + "olivedrab": [ + 0x6b, + 0x8e, + 0x23 + ], + "mediumseagreen": [ + 0x3c, + 0xb3, + 0x71 + ], + "limegreen": [ + 0x32, + 0xcd, + 0x32 + ], + "lime": [ + 0x00, + 0xff, + 0x00 + ], + "springgreen": [ + 0x00, + 0xff, + 0x7f + ], + "mediumspringgreen": [ + 0x00, + 0xfa, + 0x9a + ], + "darkseagreen": [ + 0x8f, + 0xbc, + 0x8f + ], + "mediumaquamarine": [ + 0x66, + 0xcd, + 0xaa + ], + "yellowgreen": [ + 0x9a, + 0xcd, + 0x32 + ], + "lawngreen": [ + 0x7c, + 0xfc, + 0x00 + ], + "chartreuse": [ + 0x7f, + 0xff, + 0x00 + ], + "lightgreen": [ + 0x90, + 0xee, + 0x90 + ], + "greenyellow": [ + 0xad, + 0xff, + 0x2f + ], + "palegreen": [ + 0x98, + 0xfb, + 0x98 + ], + "teal": [ + 0x00, + 0x80, + 0x80 + ], + "darkcyan": [ + 0x00, + 0x8b, + 0x8b + ], + "lightseagreen": [ + 0x20, + 0xb2, + 0xaa + ], + "cadetblue": [ + 0x5f, + 0x9e, + 0xa0 + ], + "darkturquoise": [ + 0x00, + 0xce, + 0xd1 + ], + "mediumturquoise": [ + 0x48, + 0xd1, + 0xcc + ], + "turquoise": [ + 0x40, + 0xe0, + 0xd0 + ], + "aqua": [ + 0x00, + 0xff, + 0xff + ], + "cyan": [ + 0x00, + 0xff, + 0xff + ], + "aquamarine": [ + 0x7f, + 0xff, + 0xd4 + ], + "paleturquoise": [ + 0xaf, + 0xee, + 0xee + ], + "lightcyan": [ + 0xe0, + 0xff, + 0xff + ], + "navy": [ + 0x00, + 0x00, + 0x80 + ], + "darkblue": [ + 0x00, + 0x00, + 0x8b + ], + "mediumblue": [ + 0x00, + 0x00, + 0xcd + ], + "blue": [ + 0x00, + 0x00, + 0xff + ], + "midnightblue": [ + 0x19, + 0x19, + 0x70 + ], + "royalblue": [ + 0x41, + 0x69, + 0xe1 + ], + "steelblue": [ + 0x46, + 0x82, + 0xb4 + ], + "dodgerblue": [ + 0x1e, + 0x90, + 0xff + ], + "deepskyblue": [ + 0x00, + 0xbf, + 0xff + ], + "cornflowerblue": [ + 0x64, + 0x95, + 0xed + ], + "skyblue": [ + 0x87, + 0xce, + 0xeb + ], + "lightskyblue": [ + 0x87, + 0xce, + 0xfa + ], + "lightsteelblue": [ + 0xb0, + 0xc4, + 0xde + ], + "lightblue": [ + 0xad, + 0xd8, + 0xe6 + ], + "powderblue": [ + 0xb0, + 0xe0, + 0xe6 + ], + "indigo": [ + 0x4b, + 0x00, + 0x82 + ], + "purple": [ + 0x80, + 0x00, + 0x80 + ], + "darkmagenta": [ + 0x8b, + 0x00, + 0x8b + ], + "darkviolet": [ + 0x94, + 0x00, + 0xd3 + ], + "darkslateblue": [ + 0x48, + 0x3d, + 0x8b + ], + "blueviolet": [ + 0x8a, + 0x2b, + 0xe2 + ], + "darkorchid": [ + 0x99, + 0x32, + 0xcc + ], + "fuchsia": [ + 0xff, + 0x00, + 0xff + ], + "magenta": [ + 0xff, + 0x00, + 0xff + ], + "slateblue": [ + 0x6a, + 0x5a, + 0xcd + ], + "mediumslateblue": [ + 0x7b, + 0x68, + 0xee + ], + "mediumorchid": [ + 0xba, + 0x55, + 0xd3 + ], + "mediumpurple": [ + 0x93, + 0x70, + 0xdb + ], + "orchid": [ + 0xda, + 0x70, + 0xd6 + ], + "violet": [ + 0xee, + 0x82, + 0xee + ], + "plum": [ + 0xdd, + 0xa0, + 0xdd + ], + "thistle": [ + 0xd8, + 0xbf, + 0xd8 + ], + "lavender": [ + 0xe6, + 0xe6, + 0xfa + ], + "mistyrose": [ + 0xff, + 0xe4, + 0xe1 + ], + "antiquewhite": [ + 0xfa, + 0xeb, + 0xd7 + ], + "linen": [ + 0xfa, + 0xf0, + 0xe6 + ], + "beige": [ + 0xf5, + 0xf5, + 0xdc + ], + "whitesmoke": [ + 0xf5, + 0xf5, + 0xf5 + ], + "lavenderblush": [ + 0xff, + 0xf0, + 0xf5 + ], + "oldlace": [ + 0xfd, + 0xf5, + 0xe6 + ], + "aliceblue": [ + 0xf0, + 0xf8, + 0xff + ], + "seashell": [ + 0xff, + 0xf5, + 0xee + ], + "ghostwhite": [ + 0xf8, + 0xf8, + 0xff + ], + "honeydew": [ + 0xf0, + 0xff, + 0xf0 + ], + "floralwhite": [ + 0xff, + 0xfa, + 0xf0 + ], + "azure": [ + 0xf0, + 0xff, + 0xff + ], + "mintcream": [ + 0xf5, + 0xff, + 0xfa + ], + "snow": [ + 0xff, + 0xfa, + 0xfa + ], + "ivory": [ + 0xff, + 0xff, + 0xf0 + ], + "white": [ + 0xff, + 0xff, + 0xff + ], + "black": [ + 0x00, + 0x00, + 0x00 + ], + "darkslategray": [ + 0x2f, + 0x4f, + 0x4f + ], + "dimgray": [ + 0x69, + 0x69, + 0x69 + ], + "slategray": [ + 0x70, + 0x80, + 0x90 + ], + "gray": [ + 0x80, + 0x80, + 0x80 + ], + "lightslategray": [ + 0x77, + 0x88, + 0x99 + ], + "darkgray": [ + 0xa9, + 0xa9, + 0xa9 + ], + "silver": [ + 0xc0, + 0xc0, + 0xc0 + ], + "lightgray": [ + 0xd3, + 0xd3, + 0xd3 + ], + "gainsboro": [ + 0xdc, + 0xdc, + 0xdc + ], + "copper": [ + 0xb8, + 0x73, + 0x33 + ], + "bronze": [ + 0xcd, + 0x7f, + 0x32 + ], + "steel": [ + 0xce, + 0xd2, + 0xd7 + ], + "platinum": [ + 0xe5, + 0xe4, + 0xe2 + ], + "gunmetal": [ + 0x5c, + 0x5d, + 0x5b + ], + "titanium": [ + 0x87, + 0x86, + 0x81 + ], + "rosegold": [ + 0xcb, + 0xa3, + 0xb2 + ], + "aquaglass": [ + 0xd2, + 0xe8, + 0xdf + ], + "blueglass": [ + 0xc7, + 0xe3, + 0xe1 + ] +}; @@ -18583,6 +19318,21 @@ class $715a174735ed4fbb$export$31008ffe97c96a49 { get mMatrix() { return this._mMatrix; } + get materialType() { + return this._materialType; + } + get materialColor() { + return this._materialColor; + } + get materialFuzz() { + return this._materialFuzz; + } + get materialGloss() { + return this._materialGloss; + } + get segmentColor() { + return this._segmentColor; + } get scale() { return this._scale; } @@ -18718,6 +19468,11 @@ class $715a174735ed4fbb$export$31008ffe97c96a49 { this._material = options.material; this.borderWidth = core.config.textBorderWidth; this.gamma = 0; + this._materialType = options.materialType || 0; + this._materialColor = options.materialColor || core.config.textColor; + this._materialFuzz = options.materialFuzz || 0; + this._materialGloss = options.materialGloss || 0; + this._segmentColor = options.segmentColor; } initialize() { this._vertices = new ArrayBuffer((0, $0a0587bd8b0d58e8$export$74c3c25430a16442).SIZE_BYTES * this._maxGlyphs * 4); @@ -18840,6 +19595,21 @@ class $715a174735ed4fbb$export$f51a22c5863d0d80 extends $715a174735ed4fbb$export get materials() { return this._materials; } + get materialTypes() { + return this._materialTypes; + } + get materialColors() { + return this._materialColors; + } + get materialFuzzes() { + return this._materialFuzzes; + } + get materialGlosses() { + return this._materialGlosses; + } + get segmentColors() { + return this._segmentColors; + } get minBoundsX() { return this._minBoundsX; } @@ -19060,6 +19830,9 @@ class $715a174735ed4fbb$export$f51a22c5863d0d80 extends $715a174735ed4fbb$export super(core, options); this._quat = (0, $39ece26d1239bb77$exports).create(); this._materials = options.materials; + this._materialType = options.materialType; + this._materialColor = options.materialColors ? null : options.materialColor || core.config.textColor; + this._materialColors = options.materialColors; this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; @@ -20116,6 +20889,31 @@ class $5c05d7e02492b136$export$1c460fb4285edadc extends (0, $9f62a2679ad52b29$ex _vec4[3] = options.texCoords[id * 4 + 3]; (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTexCoord(dataView, index, _vec4); } else (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTexCoord(dataView, index, _vec4); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [ + options.materialColors[id * 3], + options.materialColors[id * 3 + 1], + options.materialColors[id * 3 + 2] + ] : [ + 0, + 0, + 0 + ]); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [ + options.segmentColors[id * 4], + options.segmentColors[id * 4 + 1], + options.segmentColors[id * 4 + 2], + options.segmentColors[id * 4 + 3] + ] : [ + buffer.idColors[id * 4], + buffer.idColors[id * 4 + 1], + buffer.idColors[id * 4 + 2], + buffer.idColors[id * 4 + 3] + ]); } buffer.update(); this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); @@ -20620,6 +21418,7 @@ $parcel$export($92f02b8a0655b486$exports, "TableHelper", () => $38a1943f255fbbec $parcel$export($92f02b8a0655b486$exports, "TextHelper", () => $ee14aeb68f9f83d5$export$f080f423ca93034f); $parcel$export($92f02b8a0655b486$exports, "TextureHelper", () => $a25f5529f6cda489$export$c41e4fcbf45db179); $parcel$export($92f02b8a0655b486$exports, "TreeHelper", () => $f90460e72834bcbf$export$7b64922b0b192bef); +$parcel$export($92f02b8a0655b486$exports, "TreeMapHelper", () => $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75); $parcel$export($92f02b8a0655b486$exports, "SetHelper", () => $33e5ac524dde1fe2$export$a30f602ccece8e25); $parcel$export($92f02b8a0655b486$exports, "SdfHelper", () => $22ccc45c3c88d82f$export$98599ead9515fc06); $parcel$export($92f02b8a0655b486$exports, "VectorHelper", () => $8c233993336ed54a$export$1c9ca61bb2a30bed); @@ -20771,7 +21570,7 @@ class $c37f3938111fba7e$export$a33ddd5b3ba7b208 { const r2 = `0${Math.round(r * 255).toString(16)}`; const g2 = `0${Math.round(g * 255).toString(16)}`; const b2 = `0${Math.round(b * 255).toString(16)}`; - return `#${r2.substr(r2.length - 2, 2)}${g2.substr(g2.length - 2, 2)}${b2.substr(b2.length - 2, 2)}`; + return `#${r2.substring(r2.length - 2)}${g2.substring(g2.length - 2)}${b2.substring(b2.length - 2)}`; } static rgbToHsv(r, g, b, hsv) { let h, s, v, delta; @@ -21533,6 +22332,7 @@ class $18a78f0c92aa12a4$export$917b5ee4d724090b { const maxBins = (binsX - minQ) * binsY; const binCounts = new Float64Array(maxBins); const binLookup = new Uint32Array(maxBins); + const binIds = new Uint32Array(options.valuesX.length); const point = (0, $91b0cc4981465964$exports).create(); const hex = (0, $91b0cc4981465964$exports).create(); let nonEmptyBins = 0; @@ -21551,7 +22351,7 @@ class $18a78f0c92aa12a4$export$917b5ee4d724090b { nonEmptyBins++; } binCounts[binId]++; - options.binIds[id] = binId; + binIds[id] = binId; minCount = Math.min(minCount, binCounts[binId]); maxCount = Math.max(maxCount, binCounts[binId]); } @@ -21575,7 +22375,7 @@ class $18a78f0c92aa12a4$export$917b5ee4d724090b { } } const result = { - binIds: options.binIds, + binIds: binIds, positionsX: positionsX, positionsY: positionsY, counts: counts, @@ -22159,11 +22959,11 @@ class $a25f5529f6cda489$export$c41e4fcbf45db179 { degrees: degrees }; } - static tree(rootId, indices, children, positions, widths, descendents) { + static tree(rootId, indices, children, positions, widths, descendents, depths) { let nextId = 0; const idsArray = []; let maxDescendents = 0; - const buildTree = (parentId)=>{ + const buildTree = (parentId, depth)=>{ const index = indices[parentId]; idsArray.push(index); const childIds = children[parentId]; @@ -22171,8 +22971,11 @@ class $a25f5529f6cda489$export$c41e4fcbf45db179 { const start = nextId; let total = 0; for(let i = 0; i < childIds.length; i++){ - buildTree(childIds[i]); - total += descendents[indices[childIds[i]]] + 1; + const id = childIds[i]; + buildTree(id, depth + 1); + const index = indices[id]; + total += descendents[index] + 1; + depths[index] = depth + 1; } const end = nextId - 1; positions[index] = (start + end) / 2; @@ -22182,9 +22985,10 @@ class $a25f5529f6cda489$export$c41e4fcbf45db179 { } else { widths[index] = 1; positions[index] = nextId++; + depths[index] = depth; } }; - buildTree(rootId); + buildTree(rootId, 0); const maxPosition = nextId - 1; return { ids: new Uint32Array(idsArray), @@ -22195,6 +22999,214 @@ class $a25f5529f6cda489$export$c41e4fcbf45db179 { } +/*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ class $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75 { + static squarifiedLayout(options) { + if (options.from > options.to) return; + if (options.to - options.from < 2) { + $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75._sliceLayout({ + ids: options.ids, + sizes: options.sizes, + positionsX: options.positionsX, + positionsY: options.positionsY, + sizesX: options.sizesX, + sizesY: options.sizesY, + from: options.from, + to: options.to, + x: options.x, + y: options.y, + width: options.width, + height: options.height, + lookup: options.lookup + }); + return; + } + const totalSize = options.sizes ? $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.totalSize(options.ids, options.sizes, options.from, options.to) : options.to - options.from + 1; + const a = options.sizes ? options.sizes[options.ids[options.to]] / totalSize : 1 / totalSize; + let b = a; + let mid = options.to; + if (options.width < options.height) { + while(mid > options.from){ + const aspect = $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.aspect(options.height, options.width, a, b); + const q = options.sizes ? options.sizes[options.ids[mid - 1]] / totalSize : 1 / totalSize; + if ($ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.aspect(options.height, options.width, a, b + q) > aspect) break; + mid--; + b += q; + } + $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75._sliceLayout({ + ids: options.ids, + sizes: options.sizes, + positionsX: options.positionsX, + positionsY: options.positionsY, + sizesX: options.sizesX, + sizesY: options.sizesY, + from: mid, + to: options.to, + x: options.x, + y: options.y, + width: options.width, + height: options.height * b, + lookup: options.lookup + }); + $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.squarifiedLayout({ + ids: options.ids, + sizes: options.sizes, + positionsX: options.positionsX, + positionsY: options.positionsY, + sizesX: options.sizesX, + sizesY: options.sizesY, + from: options.from, + to: mid - 1, + x: options.x, + y: options.y + options.height * b, + width: options.width, + height: options.height * (1 - b), + lookup: options.lookup + }); + } else { + while(mid > options.from){ + const aspect = $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.aspect(options.width, options.height, a, b); + const q = options.sizes ? options.sizes[options.ids[mid - 1]] / totalSize : 1 / totalSize; + if ($ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.aspect(options.width, options.height, a, b + q) > aspect) break; + mid--; + b += q; + } + $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75._sliceLayout({ + ids: options.ids, + sizes: options.sizes, + positionsX: options.positionsX, + positionsY: options.positionsY, + sizesX: options.sizesX, + sizesY: options.sizesY, + from: mid, + to: options.to, + x: options.x, + y: options.y, + width: options.width * b, + height: options.height, + lookup: options.lookup + }); + $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.squarifiedLayout({ + ids: options.ids, + sizes: options.sizes, + positionsX: options.positionsX, + positionsY: options.positionsY, + sizesX: options.sizesX, + sizesY: options.sizesY, + from: options.from, + to: mid - 1, + x: options.x + options.width * b, + y: options.y, + width: options.width * (1 - b), + height: options.height, + lookup: options.lookup + }); + } + } + static totalSize(ids, sizes, from, to) { + let size = 0; + for(let i = from; i <= to; i++)size += sizes[ids[i]]; + return size; + } + static _sliceLayout(options) { + const totalSize = options.sizes ? $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.totalSize(options.ids, options.sizes, options.from, options.to) : options.to - options.from + 1; + let a = 0; + for(let i = options.to; i >= options.from; i--){ + const id = options.ids[i]; + const index = options.lookup[id]; + const b = options.sizes ? options.sizes[id] / totalSize : 1 / totalSize; + if (options.width > options.height) { + options.sizesY[index] = options.height; + options.sizesX[index] = options.width * b; + options.positionsY[index] = options.y + options.height / 2; + options.positionsX[index] = options.x + options.width * a + options.width * b / 2; + } else { + options.sizesX[index] = options.width; + options.sizesY[index] = options.height * b; + options.positionsX[index] = options.x + options.width / 2; + options.positionsY[index] = options.y + options.height * a + options.height * b / 2; + } + a += b; + } + } + static aspect(big, small, a, b) { + const x = big * b / (small * a / b); + if (x < 1) return 1 / x; + return x; + } + static cubifiedLayout(options) { + if (options.from > options.to) return; + let sliceHeight = 0; + let sliceTotal = 0; + let previousAspect = 0; + let mid = options.to; + while(mid >= options.from){ + const itemSize = options.sizes ? options.sizes[options.ids[mid]] : 1; + sliceTotal += itemSize; + sliceHeight = options.height * sliceTotal / options.total; + const remainingHeight = options.height - sliceHeight; + if (remainingHeight < options.minHeight) { + mid = options.from; + const totalSize = options.sizes ? this.totalSize(options.ids, options.sizes, mid, options.to) : options.to - options.from + 1; + sliceHeight = options.height * totalSize / options.total; + break; + } + const itemSide = Math.sqrt(itemSize / sliceTotal) * options.side; + const aspect = itemSide > sliceHeight ? sliceHeight / itemSide : itemSide / sliceHeight; + if (aspect < previousAspect || mid == options.from) break; + previousAspect = aspect; + mid--; + } + $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.squarifiedLayout({ + ids: options.ids, + sizes: options.sizes, + positionsX: options.positionsX, + positionsY: options.positionsZ, + sizesX: options.sizesX, + sizesY: options.sizesZ, + from: mid, + to: options.to, + x: options.x, + y: options.z, + width: options.width, + height: options.depth, + lookup: options.lookup + }); + for(let j = mid; j <= options.to; j++){ + const id = options.ids[j]; + const index = options.lookup[id]; + options.sizesY[index] = Math.max(sliceHeight, 0.01); + options.positionsY[index] = options.isTopToBottom ? options.positionsY[index] = options.y + sliceHeight / 2 : options.y + options.height - sliceHeight / 2; + } + $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75.cubifiedLayout({ + ids: options.ids, + sizes: options.sizes, + positionsX: options.positionsX, + positionsY: options.positionsY, + positionsZ: options.positionsZ, + sizesX: options.sizesX, + sizesY: options.sizesY, + sizesZ: options.sizesZ, + from: options.from, + to: mid - 1, + x: options.x, + y: options.isTopToBottom ? options.y + sliceHeight : options.y, + z: options.z, + width: options.width, + height: options.height - sliceHeight, + depth: options.depth, + side: options.side, + total: options.total - sliceTotal, + minHeight: options.minHeight, + isTopToBottom: options.isTopToBottom, + lookup: options.lookup + }); + } +} + + /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. @@ -22557,6 +23569,31 @@ class $e6a9bd14c029e5f0$export$a15f0a83a652dd40 extends (0, $9f62a2679ad52b29$ex (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [ + options.materialColors[id * 3], + options.materialColors[id * 3 + 1], + options.materialColors[id * 3 + 2] + ] : [ + 0, + 0, + 0 + ]); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [ + options.segmentColors[id * 4], + options.segmentColors[id * 4 + 1], + options.segmentColors[id * 4 + 2], + options.segmentColors[id * 4 + 3] + ] : [ + buffer.idColors[id * 4], + buffer.idColors[id * 4 + 1], + buffer.idColors[id * 4 + 2], + buffer.idColors[id * 4 + 3] + ]); } buffer.update(); this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); @@ -22777,6 +23814,31 @@ class $ba0727adc7665af3$export$17d680238e50603e extends (0, $9f62a2679ad52b29$ex (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [ + options.materialColors[id * 3], + options.materialColors[id * 3 + 1], + options.materialColors[id * 3 + 2] + ] : [ + 0, + 0, + 0 + ]); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [ + options.segmentColors[id * 4], + options.segmentColors[id * 4 + 1], + options.segmentColors[id * 4 + 2], + options.segmentColors[id * 4 + 3] + ] : [ + buffer.idColors[id * 4], + buffer.idColors[id * 4 + 1], + buffer.idColors[id * 4 + 2], + buffer.idColors[id * 4 + 3] + ]); } buffer.update(); this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); @@ -23223,6 +24285,31 @@ class $82ef55b00856d713$export$7fbedc92909ed28e extends (0, $9f62a2679ad52b29$ex (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [ + options.materialColors[id * 3], + options.materialColors[id * 3 + 1], + options.materialColors[id * 3 + 2] + ] : [ + 0, + 0, + 0 + ]); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [ + options.segmentColors[id * 4], + options.segmentColors[id * 4 + 1], + options.segmentColors[id * 4 + 2], + options.segmentColors[id * 4 + 3] + ] : [ + buffer.idColors[id * 4], + buffer.idColors[id * 4 + 1], + buffer.idColors[id * 4 + 2], + buffer.idColors[id * 4 + 3] + ]); } buffer.update(); this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); @@ -23442,372 +24529,312 @@ class $8be06baf1546635b$export$a9bf29f8d87ebbee extends (0, $9f62a2679ad52b29$ex (0, $0a0587bd8b0d58e8$export$849e31d725692576).setOrder(dataView, index, _vec2); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - - -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - - - - - -class $05bc96b85bb3a34e$export$ce1cde616fb0ca7e extends (0, $9f62a2679ad52b29$export$f4f11265faddf354) { - get positionsX() { - return this._positionsX; - } - get positionsY() { - return this._positionsY; - } - get sizesX() { - return this._sizesX; - } - get sizesY() { - return this._sizesY; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const size = options.size == undefined ? 1 : options.size; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } else if (size <= 0) return; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - } - $05bc96b85bb3a34e$export$ece3d818ad8f3b75.squarifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, sizeX, sizeY, buffer.lookup); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, $91b0cc4981465964$exports).create(); - const _vec3 = (0, $31054a6c69637582$exports).create(); - const _quat = (0, $39ece26d1239bb77$exports).create(); - const heights = options.heights; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, $39ece26d1239bb77$exports).rotationTo(_quat, this._core.config.identityRotation, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).VECTOR3_UNITY); - let maxHeight; - if (heights) { - maxHeight = 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - maxHeight = Math.max(heights[id], maxHeight); - } - } else maxHeight = 1; - const heightScaling = (this.maxLayoutBoundsZ - this.minLayoutBoundsZ) / maxHeight; - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(heights ? heights[id] * heightScaling : heightScaling, minHeight); - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this.minLayoutBoundsZ + height / 2; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = height * this._boundsScaling; - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setScale(dataView, index, _vec3); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, $91b0cc4981465964$exports).set(_vec2, color, color); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, _vec2); - } else (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).VECTOR2_ONE); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setOrder(dataView, index, _vec2); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class $05bc96b85bb3a34e$export$3ca73d0a8bf0e96e extends (0, $9f62a2679ad52b29$export$f4f11265faddf354) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - const sizeZ = this.maxLayoutBoundsZ - this.minLayoutBoundsZ; - const minHeight = this._core.config.minCubifiedTreeMapSlice / sizeY; - const side = Math.sqrt(sizeX * sizeZ); - const total = options.sizes ? $05bc96b85bb3a34e$export$ece3d818ad8f3b75.totalSize(ids, options.sizes, offset, offset + count - 1) : count; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - } - $05bc96b85bb3a34e$export$ece3d818ad8f3b75.cubifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, this.minLayoutBoundsZ, sizeX, sizeY, sizeZ, side, total, minHeight, isTopToBottom, buffer.lookup); - this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, $91b0cc4981465964$exports).create(); - const _vec3 = (0, $31054a6c69637582$exports).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setScale(dataView, index, _vec3); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRotation(dataView, index, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, $91b0cc4981465964$exports).set(_vec2, color, color); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, _vec2); - } else (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).VECTOR2_ONE); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setOrder(dataView, index, _vec2); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); } buffer.update(); - this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); } } -class $05bc96b85bb3a34e$export$ece3d818ad8f3b75 { - static squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - if (from > to) return; - if (to - from < 2) { - $05bc96b85bb3a34e$export$ece3d818ad8f3b75._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup); - return; - } - const totalSize = sizes ? $05bc96b85bb3a34e$export$ece3d818ad8f3b75.totalSize(ids, sizes, from, to) : to - from + 1; - const a = sizes ? sizes[ids[to]] / totalSize : 1 / totalSize; - let b = a; - let mid = to; - if (width < height) { - while(mid > from){ - const aspect = $05bc96b85bb3a34e$export$ece3d818ad8f3b75._aspect(height, width, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if ($05bc96b85bb3a34e$export$ece3d818ad8f3b75._aspect(height, width, a, b + q) > aspect) break; - mid--; - b += q; - } - $05bc96b85bb3a34e$export$ece3d818ad8f3b75._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width, height * b, lookup); - $05bc96b85bb3a34e$export$ece3d818ad8f3b75.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x, y + height * b, width, height * (1 - b), lookup); - } else { - while(mid > from){ - const aspect = $05bc96b85bb3a34e$export$ece3d818ad8f3b75._aspect(width, height, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if ($05bc96b85bb3a34e$export$ece3d818ad8f3b75._aspect(width, height, a, b + q) > aspect) break; - mid--; - b += q; + + +/*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + + + + + + +class $05bc96b85bb3a34e$export$ce1cde616fb0ca7e extends (0, $9f62a2679ad52b29$export$f4f11265faddf354) { + get positionsX() { + return this._positionsX; + } + get positionsY() { + return this._positionsY; + } + get sizesX() { + return this._sizesX; + } + get sizesY() { + return this._sizesY; + } + layout(buffer, ids, options) { + const start = window.performance.now(); + const size = options.size == undefined ? 1 : options.size; + let offset = options.offset === undefined ? 0 : options.offset; + let count = options.count === undefined ? ids.length : options.count; + this.minLayoutBoundsX = options.minBoundsX; + this.minLayoutBoundsY = options.minBoundsY; + this.minLayoutBoundsZ = options.minBoundsZ; + this.maxLayoutBoundsX = options.maxBoundsX; + this.maxLayoutBoundsY = options.maxBoundsY; + this.maxLayoutBoundsZ = options.maxBoundsZ; + const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; + const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; + if (options.sizes) { + for(let i = 0; i < count; i++){ + if (options.sizes[ids[offset]] > 0) break; + offset++; + count--; } - $05bc96b85bb3a34e$export$ece3d818ad8f3b75._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width * b, height, lookup); - $05bc96b85bb3a34e$export$ece3d818ad8f3b75.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x + width * b, y, width * (1 - b), height, lookup); + if (count == 0) return; + } else if (size <= 0) return; + if (!this._positionsX || this._positionsX.length < buffer.length) { + this._positionsX = new Float32Array(buffer.length); + this._positionsY = new Float32Array(buffer.length); + this._sizesX = new Float32Array(buffer.length); + this._sizesY = new Float32Array(buffer.length); } + (0, $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75).squarifiedLayout({ + ids: ids, + sizes: options.sizes, + positionsX: this._positionsX, + positionsY: this._positionsY, + sizesX: this._sizesX, + sizesY: this._sizesY, + from: offset, + to: offset + count - 1, + x: this.minLayoutBoundsX, + y: this.minLayoutBoundsY, + width: sizeX, + height: sizeY, + lookup: buffer.lookup + }); + this._updateCumulativeLayoutBounds(); + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); } - static totalSize(ids, sizes, from, to) { - let size = 0; - for(let i = from; i <= to; i++)size += sizes[ids[i]]; - return size; - } - static _sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - const totalSize = sizes ? $05bc96b85bb3a34e$export$ece3d818ad8f3b75.totalSize(ids, sizes, from, to) : to - from + 1; - let a = 0; - for(let i = to; i >= from; i--){ - const id = ids[i]; + update(buffer, ids, options) { + const start = window.performance.now(); + const offset = options.offset === undefined ? 0 : options.offset; + const count = options.count === undefined ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = (0, $91b0cc4981465964$exports).create(); + const _vec3 = (0, $31054a6c69637582$exports).create(); + const _quat = (0, $39ece26d1239bb77$exports).create(); + const heights = options.heights; + const minHeight = options.minHeight === undefined ? 0 : options.minHeight; + const minColor = options.minColor === undefined ? 0 : options.minColor; + const maxColor = options.maxColor === undefined ? 1 : options.maxColor; + const minOrder = options.minOrder === undefined ? 0 : options.minOrder; + const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; + const padding = options.padding === undefined ? 0 : options.padding; + const reverseX = options.reverseX === undefined ? false : options.reverseX; + const reverseY = options.reverseY === undefined ? false : options.reverseY; + const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; + this._updateModelBounds(options); + (0, $39ece26d1239bb77$exports).rotationTo(_quat, this._core.config.identityRotation, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).VECTOR3_UNITY); + let maxHeight; + if (heights) { + maxHeight = 0; + for(let i = 0; i < count; i++){ + const id = ids[i + offset]; + maxHeight = Math.max(heights[id], maxHeight); + } + } else maxHeight = 1; + const heightScaling = (this.maxLayoutBoundsZ - this.minLayoutBoundsZ) / maxHeight; + const lookup = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for(let i = 0; i < count; i++){ + const id = ids[i + offset]; const index = lookup[id]; - const b = sizes ? sizes[id] / totalSize : 1 / totalSize; - if (width > height) { - sizesY[index] = height; - sizesX[index] = width * b; - positionsY[index] = y + height / 2; - positionsX[index] = x + width * a + width * b / 2; + const height = Math.max(heights ? heights[id] * heightScaling : heightScaling, minHeight); + let positionX = this._positionsX[index]; + let positionY = this._positionsY[index]; + let positionZ = this.minLayoutBoundsZ + height / 2; + if (this._isFacetted) { + if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); } else { - sizesX[index] = width; - sizesY[index] = height * b; - positionsX[index] = x + width / 2; - positionsY[index] = y + height * a + height * b / 2; + if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; } - a += b; + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTranslation(dataView, index, _vec3); + _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); + _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); + _vec3[2] = height * this._boundsScaling; + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setScale(dataView, index, _vec3); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRotation(dataView, index, _quat); + if (options.colors) { + const size = 1 / (maxColor - minColor + 1); + const color = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); + (0, $91b0cc4981465964$exports).set(_vec2, color, color); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, _vec2); + } else (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).VECTOR2_ONE); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setIdHover(dataView, index, options.hover ? options.hover[id] : id); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); + if (options.order !== undefined) { + const order = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.order[id], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else _vec2[0] = count == 1 ? 0 : i / (count - 1); + if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; + else if (options.staggerOrders) { + const stagger = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else _vec2[1] = count == 1 ? 0 : i / (count - 1); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setOrder(dataView, index, _vec2); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); } + buffer.update(); + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); } - static _aspect(big, small, a, b) { - const x = big * b / (small * a / b); - if (x < 1) return 1 / x; - return x; - } - static cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, to, x, y, z, width, height, depth, side, total, minHeight, isTopToBottom, lookup) { - if (from > to) return; - let sliceHeight = 0; - let sliceTotal = 0; - let previousAspect = 0; - let mid = to; - while(mid >= from){ - const itemSize = sizes ? sizes[ids[mid]] : 1; - sliceTotal += itemSize; - sliceHeight = height * sliceTotal / total; - const remainingHeight = height - sliceHeight; - if (remainingHeight < minHeight) { - mid = from; - const totalSize = sizes ? this.totalSize(ids, sizes, mid, to) : to - from + 1; - sliceHeight = height * totalSize / total; - break; +} +class $05bc96b85bb3a34e$export$3ca73d0a8bf0e96e extends (0, $9f62a2679ad52b29$export$f4f11265faddf354) { + layout(buffer, ids, options) { + const start = window.performance.now(); + const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; + let offset = options.offset === undefined ? 0 : options.offset; + let count = options.count === undefined ? ids.length : options.count; + this.minLayoutBoundsX = options.minBoundsX; + this.minLayoutBoundsY = options.minBoundsY; + this.minLayoutBoundsZ = options.minBoundsZ; + this.maxLayoutBoundsX = options.maxBoundsX; + this.maxLayoutBoundsY = options.maxBoundsY; + this.maxLayoutBoundsZ = options.maxBoundsZ; + if (options.sizes) { + for(let i = 0; i < count; i++){ + if (options.sizes[ids[offset]] > 0) break; + offset++; + count--; } - const itemSide = Math.sqrt(itemSize / sliceTotal) * side; - const aspect = itemSide > sliceHeight ? sliceHeight / itemSide : itemSide / sliceHeight; - if (aspect < previousAspect || mid == from) break; - previousAspect = aspect; - mid--; + if (count == 0) return; } - $05bc96b85bb3a34e$export$ece3d818ad8f3b75.squarifiedLayout(ids, sizes, positionsX, positionsZ, sizesX, sizesZ, mid, to, x, z, width, depth, lookup); - for(let j = mid; j <= to; j++){ - const id = ids[j]; + const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; + const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; + const sizeZ = this.maxLayoutBoundsZ - this.minLayoutBoundsZ; + const minHeight = this._core.config.minCubifiedTreeMapSlice / sizeY; + const side = Math.sqrt(sizeX * sizeZ); + const total = options.sizes ? (0, $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75).totalSize(ids, options.sizes, offset, offset + count - 1) : count; + if (!this._positionsX || this._positionsX.length < buffer.length) { + this._positionsX = new Float32Array(buffer.length); + this._positionsY = new Float32Array(buffer.length); + this._positionsZ = new Float32Array(buffer.length); + this._sizesX = new Float32Array(buffer.length); + this._sizesY = new Float32Array(buffer.length); + this._sizesZ = new Float32Array(buffer.length); + } + (0, $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75).cubifiedLayout({ + ids: ids, + sizes: options.sizes, + positionsX: this._positionsX, + positionsY: this._positionsY, + positionsZ: this._positionsZ, + sizesX: this._sizesX, + sizesY: this._sizesY, + sizesZ: this._sizesZ, + from: offset, + to: offset + count - 1, + x: this.minLayoutBoundsX, + y: this.minLayoutBoundsY, + z: this.minLayoutBoundsZ, + width: sizeX, + height: sizeY, + depth: sizeZ, + side: side, + total: total, + minHeight: minHeight, + isTopToBottom: isTopToBottom, + lookup: buffer.lookup + }); + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, options) { + const start = window.performance.now(); + const offset = options.offset === undefined ? 0 : options.offset; + const count = options.count === undefined ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = (0, $91b0cc4981465964$exports).create(); + const _vec3 = (0, $31054a6c69637582$exports).create(); + const minColor = options.minColor === undefined ? 0 : options.minColor; + const maxColor = options.maxColor === undefined ? 1 : options.maxColor; + const minOrder = options.minOrder === undefined ? 0 : options.minOrder; + const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; + const padding = options.padding === undefined ? 0 : options.padding; + const paddingZ = options.thickness === undefined ? padding : 0; + const thickness = options.thickness === undefined ? 1 : options.thickness; + const reverseX = options.reverseX === undefined ? false : options.reverseX; + const reverseY = options.reverseY === undefined ? false : options.reverseY; + const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; + this._updateModelBounds(options); + const lookup = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for(let i = 0; i < count; i++){ + const id = ids[i + offset]; const index = lookup[id]; - sizesY[index] = Math.max(sliceHeight, 0.01); - positionsY[index] = isTopToBottom ? positionsY[index] = y + sliceHeight / 2 : y + height - sliceHeight / 2; + let positionX = this._positionsX[index]; + let positionY = this._positionsY[index]; + let positionZ = this._positionsZ[index]; + if (this._isFacetted) { + if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTranslation(dataView, index, _vec3); + _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); + _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); + _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setScale(dataView, index, _vec3); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRotation(dataView, index, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).QUAT_IDENTITY); + if (options.colors) { + const size = 1 / (maxColor - minColor + 1); + const color = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); + (0, $91b0cc4981465964$exports).set(_vec2, color, color); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, _vec2); + } else (0, $0a0587bd8b0d58e8$export$849e31d725692576).setColor(dataView, index, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).VECTOR2_ONE); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setIdHover(dataView, index, options.hover ? options.hover[id] : id); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); + if (options.order !== undefined) { + const order = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.order[id], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else _vec2[0] = count == 1 ? 0 : i / (count - 1); + if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; + else if (options.staggerOrders) { + const stagger = (0, $2d4d1eb6f32f02f2$export$80a8c44b8858d625).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else _vec2[1] = count == 1 ? 0 : i / (count - 1); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setOrder(dataView, index, _vec2); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); } - $05bc96b85bb3a34e$export$ece3d818ad8f3b75.cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, mid - 1, x, isTopToBottom ? y + sliceHeight : y, z, width, height - sliceHeight, depth, side, total - sliceTotal, minHeight, isTopToBottom, lookup); + buffer.update(); + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); } } @@ -23992,6 +25019,31 @@ class $385fd844fe700a1a$export$694e0d28c7ffc90c extends $385fd844fe700a1a$export _vec4[3] = options.texCoords[id * 4 + 3]; (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTexCoord(dataView, index, _vec4); } else (0, $0a0587bd8b0d58e8$export$849e31d725692576).setTexCoord(dataView, index, _vec4); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [ + options.materialColors[id * 3], + options.materialColors[id * 3 + 1], + options.materialColors[id * 3 + 2] + ] : [ + 0, + 0, + 0 + ]); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [ + options.segmentColors[id * 4], + options.segmentColors[id * 4 + 1], + options.segmentColors[id * 4 + 2], + options.segmentColors[id * 4 + 3] + ] : [ + buffer.idColors[id * 4], + buffer.idColors[id * 4 + 1], + buffer.idColors[id * 4 + 2], + buffer.idColors[id * 4 + 3] + ]); } buffer.update(); this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); @@ -24138,7 +25190,21 @@ class $385fd844fe700a1a$export$75310880a535fd3b extends $385fd844fe700a1a$export const groupHeight = height * groupValue / binValue; if (sizeZ == 1) { const positionX = spacingX / 2 + binIdX * (sizeX + spacingX); - (0, $05bc96b85bb3a34e$export$ece3d818ad8f3b75).squarifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, from, mid, positionX, positionY, sizeX, groupHeight, lookup); + (0, $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75).squarifiedLayout({ + ids: this._orderedIds, + sizes: options.sizes, + positionsX: this._positionsX, + positionsY: this._positionsY, + sizesX: this._sizesX, + sizesY: this._sizesY, + from: from, + to: mid, + x: positionX, + y: positionY, + width: sizeX, + height: groupHeight, + lookup: lookup + }); const isRightToLeft = true; for(let i = from; i <= mid; i++){ const id = this._orderedIds[i]; @@ -24148,7 +25214,29 @@ class $385fd844fe700a1a$export$75310880a535fd3b extends $385fd844fe700a1a$export if (isRightToLeft) this._positionsX[index] = positionX + sizeX - this._positionsX[index] + positionX; if (!isTopToBottom) this._positionsY[index] = positionY + groupHeight - this._positionsY[index] + positionY; } - } else (0, $05bc96b85bb3a34e$export$ece3d818ad8f3b75).cubifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, from, mid, spacingX / 2 + binIdX * (sizeX + spacingX), positionY, spacingZ / 2 + binIdZ * (sizeZ + spacingZ), sizeX, groupHeight, sizeZ, side, groupValue, minSliceHeight, isTopToBottom, lookup); + } else (0, $ce6a2b7bc7be40ee$export$ece3d818ad8f3b75).cubifiedLayout({ + ids: this._orderedIds, + sizes: options.sizes, + positionsX: this._positionsX, + positionsY: this._positionsY, + positionsZ: this._positionsZ, + sizesX: this._sizesX, + sizesY: this._sizesY, + sizesZ: this._sizesZ, + from: from, + to: mid, + x: spacingX / 2 + binIdX * (sizeX + spacingX), + y: positionY, + z: spacingZ / 2 + binIdZ * (sizeZ + spacingZ), + width: sizeX, + height: groupHeight, + depth: sizeZ, + side: side, + total: groupValue, + minHeight: minSliceHeight, + isTopToBottom: isTopToBottom, + lookup: lookup + }); if (isLastInGroup) { isLastInGroup = false; positionY += groupHeight; @@ -24387,6 +25475,7 @@ var $2d9c5cad0d6d7650$exports = {}; $parcel$export($2d9c5cad0d6d7650$exports, "RendererBase", () => $a123db7d2af0bebc$export$30686c90897c890d); $parcel$export($2d9c5cad0d6d7650$exports, "Basic", () => $124829f55b512dce$exports); $parcel$export($2d9c5cad0d6d7650$exports, "Advanced", () => $04aa67b4630f0de9$exports); +$parcel$export($2d9c5cad0d6d7650$exports, "BasicWebGPU", () => $14a55defd301d57e$exports); $parcel$export($2d9c5cad0d6d7650$exports, "RayTraceWebGPU", () => $9824374ee38ba7ca$exports); /*! * Copyright (c) Microsoft Corporation. @@ -24502,6 +25591,13 @@ class $96371271bb28b98d$export$c1cecec923d96e5c { (0, $0a0587bd8b0d58e8$export$849e31d725692576).copySdfBorder(fromDataView, index, toDataView, i); (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyParameter1(fromDataView, index, toDataView, i); (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyParameter2(fromDataView, index, toDataView, i); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyMatId(fromDataView, index, toDataView, i); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyMatColor(fromDataView, index, toDataView, i); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyMatFuzz(fromDataView, index, toDataView, i); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyMatRefractiveIndex(fromDataView, index, toDataView, i); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyMatGloss(fromDataView, index, toDataView, i); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).copyMatDensity(fromDataView, index, toDataView, i); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).copySegColor(fromDataView, index, toDataView, i); } else (0, $0a0587bd8b0d58e8$export$849e31d725692576).setRotation(toDataView, i, (0, $d4d7bd6cc65a5081$export$a002182e51710d39).QUAT_IDENTITY); } this.unitType = buffer.unitType; @@ -24575,11 +25671,18 @@ class $96371271bb28b98d$export$e17d4fc1dafc1240 { const dataView1 = this._buffer1.dataView; const dataView2 = this._buffer2.dataView; const _vec4 = (0, $4c4ac78b213a9c07$exports).create(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; for(let i = 0; i < this._length; i++){ const id = ids[i]; const pickId = (0, $a60d0d861ccf87e8$export$aadd933e49c67c12).nextPickId(); this._pickIdLookup[pickId] = id; (0, $a60d0d861ccf87e8$export$aadd933e49c67c12).encodeNumber(pickId, (0, $4a6417d29706362f$export$6fc3f4da94ff0be0).data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; (0, $0a0587bd8b0d58e8$export$849e31d725692576).setIdColor(dataView1, i, _vec4); (0, $0a0587bd8b0d58e8$export$849e31d725692576).setIdColor(dataView2, i, _vec4); } @@ -24779,6 +25882,12 @@ class $a123db7d2af0bebc$export$30686c90897c890d { set backgroundColor(value) { if (!(0, $4c4ac78b213a9c07$exports).exactEquals(value, this._backgroundColor)) this._backgroundColor = value; } + get ambientColor() { + return this._ambientColor; + } + set ambientColor(value) { + if (!(0, $31054a6c69637582$exports).exactEquals(value, this._ambientColor)) this._ambientColor = value; + } get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } @@ -31938,9 +33047,502 @@ class $8e6261810f478ee0$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex +var $14a55defd301d57e$exports = {}; + +$parcel$export($14a55defd301d57e$exports, "Main", () => $1d3eb987c5042c2f$export$861edd1ccea2f746); +/*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + + +/*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ +class $7aa9321c6c2cf59f$export$29cd7b75162a9425 extends (0, $a123db7d2af0bebc$export$ecd9923dfd29c8e1) { + constructor(){ + super(); + this.reset(); + } +} + + + +var $1d3eb987c5042c2f$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +class $1d3eb987c5042c2f$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$export$30686c90897c890d) { + constructor(options){ + super(options); + this._positions = new Float32Array([ + -0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + 0.5, + -0.5, + 0.5, + -0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + -0.5, + -0.5, + -0.5 + ]); + this._colors = new Float32Array([ + 0.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 0.0, + 1.0, + 0.0, + 0.0, + 1.0, + 0.0, + 1.0, + 0.0, + 1.0, + 1.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ]); + this._indices = new Uint16Array([ + 5, + 4, + 1, + 0, + 3, + 4, + 7, + 5, + 6, + 1, + 2, + 3, + 6, + 7 + ]); + this._vertShaderCode = ` +// Quaternion +let EPSILON: f32 = 0.000001; + +fn slerp(a: vec4<f32>, b: vec4<f32>, t: f32) -> vec4<f32> { + var c = b; + var cosom: f32 = dot(a, b); + if (cosom < 0.0) { + cosom = -cosom; + c = -c; + } + var scale0: f32; + var scale1: f32; + if (1.0 - cosom > EPSILON) { + // Standard case (slerp) + let omega: f32 = acos(cosom); + let sinom: f32 = sin(omega); + scale0 = sin((1.0 - t) * omega) / sinom; + scale1 = sin(t * omega) / sinom; + } + else { + // "From" and "to" quaternions are very close so we can do a linear interpolation + scale0 = 1.0 - t; + scale1 = t; + } + return vec4<f32>(scale0 * a + scale1 * c); +} + +fn rotate(p: vec3<f32>, q: vec4<f32>) -> vec3<f32> { + return p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p); +} + +struct VSOut { + @builtin(position) Position: vec4<f32>, + @location(0) color: vec3<f32>, +} + +struct Uniforms { + modelViewProj: mat4x4<f32>, +} + +struct Instance { + position : vec3<f32>, + size : vec3<f32>, + color : vec3<f32>, + rotation : vec4<f32>, +} + +@group(0) @binding(0) var<uniform> uniforms : Uniforms; + +@group(0) @binding(1) var<storage, read> instances : array<Instance>; + +@stage(vertex) +fn main( + @builtin(instance_index) instanceIdx: u32, + @location(0) inPos: vec3<f32>, + @location(1) inColor: vec3<f32>) -> VSOut { + var vsOut: VSOut; + + let instance = instances[instanceIdx]; + + // Size + var position = inPos * instance.size; + + // Slerp, rotate + if (instance.rotation.w != 1.0) { + position = rotate(position, instance.rotation); + } + + // Position + position = position + instance.position; + + vsOut.Position = uniforms.modelViewProj * vec4<f32>(position, 1.0); + + vsOut.color = inColor; + return vsOut; +}`; + this._fragShaderCode = ` +@stage(fragment) +fn main( + @location(0) inColor: vec3<f32>) -> @location(0) vec4<f32> { + return vec4<f32>(inColor, 1.0); +}`; + (0, $14f38b7dd89457d7$exports).setMatrixArrayType(Float32Array); + this._config = new (0, $7aa9321c6c2cf59f$export$29cd7b75162a9425)(); + this._mvpMatrix = (0, $1ac1b59392edf35b$exports).create(); + } + initialize(core) { + super.initialize(core); + this._initializeAPI().then(()=>{ + this._initializeResources().then(()=>{ + this._resizeBackings(); + this._isInitialized = true; + }); + }); + } + get isSupported() { + return navigator.gpu !== undefined; + } + _initializeAPI() { + return $1d3eb987c5042c2f$var$__awaiter(this, void 0, void 0, function*() { + try { + const gpu = navigator.gpu; + this._adapter = yield gpu.requestAdapter(); + this._device = yield this._adapter.requestDevice(); + this._queue = this._device.queue; + this._context = this._canvas.getContext("webgpu"); + } catch (e) { + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).error, e); + return false; + } + return true; + }); + } + _initializeResources() { + return $1d3eb987c5042c2f$var$__awaiter(this, void 0, void 0, function*() { + const canvasConfig = { + device: this._device, + format: "bgra8unorm", + alphaMode: "opaque" + }; + this._context.configure(canvasConfig); + let bufferDescriptor; + bufferDescriptor = { + size: this._positions.byteLength, + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true + }; + this._positionBuffer = this._device.createBuffer(bufferDescriptor); + new Float32Array(this._positionBuffer.getMappedRange()).set(this._positions); + this._positionBuffer.unmap(); + bufferDescriptor = { + size: this._colors.byteLength, + usage: GPUBufferUsage.VERTEX, + mappedAtCreation: true + }; + this._colorBuffer = this._device.createBuffer(bufferDescriptor); + new Float32Array(this._colorBuffer.getMappedRange()).set(this._colors); + this._colorBuffer.unmap(); + bufferDescriptor = { + size: this._indices.byteLength + 3 & -4, + usage: GPUBufferUsage.INDEX, + mappedAtCreation: true + }; + this._indexBuffer = this._device.createBuffer(bufferDescriptor); + new Uint16Array(this._indexBuffer.getMappedRange()).set(this._indices); + this._indexBuffer.unmap(); + const vertexShaderDescriptor = { + code: this._vertShaderCode + }; + this._vertModule = this._device.createShaderModule(vertexShaderDescriptor); + const fragmentShaderDescriptor = { + code: this._fragShaderCode + }; + this._fragModule = this._device.createShaderModule(fragmentShaderDescriptor); + const positionAttribDesc = { + shaderLocation: 0, + offset: 0, + format: "float32x3" + }; + const colorAttribDesc = { + shaderLocation: 1, + offset: 0, + format: "float32x3" + }; + const positionBufferDesc = { + attributes: [ + positionAttribDesc + ], + arrayStride: 12, + stepMode: "vertex" + }; + const colorBufferDesc = { + attributes: [ + colorAttribDesc + ], + arrayStride: 12, + stepMode: "vertex" + }; + const depthStencil = { + depthWriteEnabled: true, + depthCompare: "less", + format: "depth24plus-stencil8" + }; + const vertex = { + module: this._vertModule, + entryPoint: "main", + buffers: [ + positionBufferDesc, + colorBufferDesc + ] + }; + const colorState = { + format: "bgra8unorm" + }; + const fragment = { + module: this._fragModule, + entryPoint: "main", + targets: [ + colorState + ] + }; + const primitive = { + frontFace: "cw", + cullMode: "none", + topology: "triangle-strip", + stripIndexFormat: "uint16" + }; + const renderPipelineDescriptor = { + vertex: vertex, + fragment: fragment, + primitive: primitive, + depthStencil: depthStencil, + layout: "auto" + }; + this._renderPipeline = this._device.createRenderPipeline(renderPipelineDescriptor); + const uniformBufferSize1 = 64; + this._uniformBuffer = this._device.createBuffer({ + size: uniformBufferSize1, + usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST + }); + const stride = 16; + let instanceData; + if (this.transitionBuffers && this.transitionBuffers.length > 0) { + const buffer = this.transitionBuffers[0].currentBuffer; + this._instanceCount = buffer.length; + instanceData = new Float32Array(this._instanceCount * stride); + const position = (0, $31054a6c69637582$exports).create(); + const size = (0, $31054a6c69637582$exports).create(); + const color = (0, $91b0cc4981465964$exports).create(); + const rotation = (0, $39ece26d1239bb77$exports).create(); + const positionOffset = 0; + const sizeOffset = 4; + const colorOffset = 8; + const rotationOffset = 12; + for(let i = 0; i < buffer.length; i++){ + const offset = stride * i; + (0, $0a0587bd8b0d58e8$export$849e31d725692576).getTranslation(buffer.dataView, i, position); + instanceData.set(position, offset + positionOffset); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).getScale(buffer.dataView, i, size); + instanceData.set(size, offset + sizeOffset); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).getColor(buffer.dataView, i, color); + instanceData.set(color, offset + colorOffset); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).getRotation(buffer.dataView, i, rotation); + instanceData.set(rotation, offset + rotationOffset); + } + } else { + const side = 10; + this._instanceCount = side * side * side; + instanceData = new Float32Array(this._instanceCount * stride); + for(let i = 0; i < this._instanceCount; ++i){ + const offset = stride * i; + instanceData[offset] = (i % side - side / 2) / side; + instanceData[offset + 1] = (Math.floor(i / side) % side - side / 2) / side; + instanceData[offset + 2] = (Math.floor(i / side / side) - side / 2) / side; + instanceData[offset + 4] = 0.75 / side; + instanceData[offset + 5] = 0.75 / side; + instanceData[offset + 6] = 0.75 / side; + } + } + const instanceBuffer = this._device.createBuffer({ + size: instanceData.byteLength, + usage: GPUBufferUsage.VERTEX | GPUBufferUsage.STORAGE, + mappedAtCreation: true + }); + new Float32Array(instanceBuffer.getMappedRange()).set(instanceData); + instanceBuffer.unmap(); + this._uniformBindGroup = this._device.createBindGroup({ + layout: this._renderPipeline.getBindGroupLayout(0), + entries: [ + { + binding: 0, + resource: { + buffer: this._uniformBuffer + } + }, + { + binding: 1, + resource: { + buffer: instanceBuffer, + offset: 0, + size: instanceData.byteLength + } + } + ] + }); + this._colorAttachment = { + view: undefined, + clearValue: { + r: 0, + g: 0, + b: 0, + a: 1 + }, + loadOp: "clear", + storeOp: "store" + }; + this._depthAttachment = { + view: undefined, + depthClearValue: 1, + depthLoadOp: "clear", + depthStoreOp: "store", + stencilLoadOp: "clear", + stencilStoreOp: "store" + }; + this._renderPassDescriptor = { + colorAttachments: [ + this._colorAttachment + ], + depthStencilAttachment: this._depthAttachment + }; + }); + } + _resizeBackings() { + const size = [ + this.width, + this.height, + 1 + ]; + const depthTextureDesc = { + size: size, + dimension: "2d", + format: "depth24plus-stencil8", + usage: GPUTextureUsage.RENDER_ATTACHMENT + }; + this._depthTexture = this._device.createTexture(depthTextureDesc); + this._depthTextureView = this._depthTexture.createView(); + this._renderPassDescriptor.depthStencilAttachment.view = this._depthTextureView; + } + _encodeCommands() { + this._renderPassDescriptor.colorAttachments[0].view = this._context.getCurrentTexture().createView(); + const commandEncoder = this._device.createCommandEncoder(); + const passEncoder = commandEncoder.beginRenderPass(this._renderPassDescriptor); + passEncoder.setPipeline(this._renderPipeline); + passEncoder.setViewport(0, 0, this._canvas.width, this._canvas.height, 0, 1); + passEncoder.setScissorRect(0, 0, this._canvas.width, this._canvas.height); + passEncoder.setVertexBuffer(0, this._positionBuffer); + passEncoder.setVertexBuffer(1, this._colorBuffer); + passEncoder.setIndexBuffer(this._indexBuffer, "uint16"); + passEncoder.setBindGroup(0, this._uniformBindGroup); + passEncoder.drawIndexed(this._indices.length, this._instanceCount); + passEncoder.end(); + const commands = commandEncoder.finish(); + this._queue.submit([ + commands + ]); + } + update(elapsedTime) { + (0, $1ac1b59392edf35b$exports).multiply(this._mvpMatrix, this.pMatrices[0], this.mvMatrices[0]); + } + render(elapsedTime) { + return $1d3eb987c5042c2f$var$__awaiter(this, void 0, void 0, function*() { + const mvpMatrix = this._mvpMatrix; + this._device.queue.writeBuffer(this._uniformBuffer, 0, mvpMatrix.buffer, mvpMatrix.byteOffset, mvpMatrix.byteLength); + this._encodeCommands(); + }); + } + _resize(width, height) { + super._resize(width, height); + if (this._isInitialized) { + this._resizeBackings(); + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `buffers resized ${width},${height}`); + } + } +} + + + + var $9824374ee38ba7ca$exports = {}; $parcel$export($9824374ee38ba7ca$exports, "Main", () => $d5ed11dd11fe7749$export$861edd1ccea2f746); +$parcel$export($9824374ee38ba7ca$exports, "MaterialType", () => $62116d012d21b949$export$bd062416169c6728); $parcel$export($9824374ee38ba7ca$exports, "Material", () => $62116d012d21b949$export$a2d8b23205c25948); $parcel$export($9824374ee38ba7ca$exports, "MetalMaterial", () => $62116d012d21b949$export$bd17d4a4be11a968); $parcel$export($9824374ee38ba7ca$exports, "GlossyMaterial", () => $62116d012d21b949$export$5e39c2cd3ef82349); @@ -32065,7 +33667,7 @@ class $62116d012d21b949$export$a2d8b23205c25948 { return this._idColor; } constructor(options){ - this._idColor = options.idColor || (0, $4c4ac78b213a9c07$exports).fromValues(0, 0, 0, 0); + this._idColor = (options === null || options === void 0 ? void 0 : options.idColor) || (0, $4c4ac78b213a9c07$exports).fromValues(0, 0, 0, 0); } toBuffer(buffer, index, textureId) {} } @@ -32342,38 +33944,31 @@ class $cdd30208cd147f64$export$29cd7b75162a9425 extends (0, $a123db7d2af0bebc$ex const altitude = options && options.altitude ? options.altitude : this.lightingAltitude; const size = options && options.size ? options.size : this.lightingSize; const distance = options && options.distance ? options.distance : this.lightingDistance; - return [ - { - azimuth: -45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, $91b0cc4981465964$exports).fromValues(size, size), - yaw: -45 + azimuthOffset, - pitch: altitude, - color: (0, $31054a6c69637582$exports).fromValues(10, 10, 10) - }, - { - azimuth: 45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, $91b0cc4981465964$exports).fromValues(size, size), - yaw: 45 + azimuthOffset, - pitch: altitude, - color: (0, $31054a6c69637582$exports).fromValues(1, 1, 1) - }, - { - azimuth: -135 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, $91b0cc4981465964$exports).fromValues(size, size), - yaw: -135 + azimuthOffset, - pitch: altitude, - color: (0, $31054a6c69637582$exports).fromValues(1, 1, 1) - } + const azimuths = [ + -45, + 45, + -135 + ]; + const brightnesses = [ + 10, + 1, + 1 ]; + const lights = []; + for(let i = 0; i < azimuths.length; i++)lights.push({ + azimuth: azimuths[i] + azimuthOffset, + altitude: altitude, + distance: distance, + size: (0, $91b0cc4981465964$exports).fromValues(size, size), + yaw: azimuths[i] + azimuthOffset, + pitch: altitude, + color: (0, $31054a6c69637582$exports).fromValues(brightnesses[i], brightnesses[i], brightnesses[i]) + }); + return lights; } reset() { this.aperture = 0; + this.focusDistance = 0; this.exposure = 1; this.maxSamplesPerPixel = 10000; this.shutterSpeed = 0; @@ -32390,16 +33985,25 @@ class $cdd30208cd147f64$export$29cd7b75162a9425 extends (0, $a123db7d2af0bebc$ex }) }); this.groundSize = (0, $91b0cc4981465964$exports).fromValues(10, 10); - this.backgroundColor = (0, $4c4ac78b213a9c07$exports).fromValues(0, 0, 0, 1); - this.lightingAzimuthOffset = 0; + this.maxLights = 12; + this.backgroundColor = (0, $4c4ac78b213a9c07$exports).fromValues(1, 1, 1, 1); + this.ambientColor = (0, $31054a6c69637582$exports).fromValues(1, 1, 1); this.lightingAltitude = 30; this.lightingSize = 0.5; this.lightingDistance = 1.5; + this.lightingAzimuthOffset = 0; + this.lightingAltitudeOffset = 0; + this.lightingSizeOffset = 0; + this.lightingDistanceOffset = 0; + this.isDepthMultisampled = false; + this.isNormalMultisampled = false; this.autoDepth = true; this.minDepth = 1; this.maxDepth = 10; this.edgeDepth = 0.01; this.edgeNormal = 0.025; + this.edgeForeground = (0, $4c4ac78b213a9c07$exports).fromValues(1, 1, 1, 1); + this.edgeBackground = (0, $4c4ac78b213a9c07$exports).fromValues(0, 0, 0, 1); } } @@ -32519,7 +34123,9 @@ const $66964bfc3ddbcb4c$export$8daabe80e4a041 = { xYDisk: 18, rotatedXyDisk: 19, ringSdf: 20, - rotatedRingSdf: 21 + rotatedRingSdf: 21, + sphereSdf: 22, + tubeSdf: 23 }; class $66964bfc3ddbcb4c$export$1337e9dd34ffc243 extends Float32Array { constructor(count){ @@ -32543,6 +34149,15 @@ class $66964bfc3ddbcb4c$export$1337e9dd34ffc243 extends Float32Array { this.SDF_BORDER_OFFSET = 32; this.PARAMETER_1_OFFSET = 33; this.PARAMETER_2_OFFSET = 34; + this.MATERIAL_FUZZ_OFFSET = 35; + this.MATERIAL_GLOSS_OFFSET = 36; + this.MATERIAL_DENSITY_OFFSET = 37; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 38; + this.MATERIAL_COLOR_OFFSET = 40; + this.MATERIAL_TYPE_ID_OFFSET = 43; + this.SEGMENT_COLOR_OFFSET = 44; + this.TEXTURE_TYPE_ID_OFFSET = 48; + this.TEXTURE_ID_OFFSET = 49; } getType(index) { return this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.TYPE_OFFSET]; @@ -32602,12 +34217,6 @@ class $66964bfc3ddbcb4c$export$1337e9dd34ffc243 extends Float32Array { this[offset + 1] = value[1]; this[offset + 2] = value[2]; } - getMaterialId(index) { - return this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_ID_OFFSET]; - } - setMaterialId(index, value) { - this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_ID_OFFSET] = value; - } getRotation0(index, value) { const offset = $66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.ROTATION0_OFFSET; (0, $39ece26d1239bb77$exports).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); @@ -32690,8 +34299,64 @@ class $66964bfc3ddbcb4c$export$1337e9dd34ffc243 extends Float32Array { setSdfBorder(index, value) { this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.SDF_BORDER_OFFSET] = value; } + getMaterialTypeId(index) { + return this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET]; + } + setMaterialTypeId(index, value) { + this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET] = value; + } + getMaterialFuzz(index) { + return this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_FUZZ_OFFSET]; + } + setMaterialFuzz(index, value) { + this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_FUZZ_OFFSET] = value; + } + getMaterialDensity(index) { + return this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_DENSITY_OFFSET]; + } + setMaterialDensity(index, value) { + this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_DENSITY_OFFSET] = value; + } + getMaterialGloss(index) { + return this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_GLOSS_OFFSET]; + } + setMaterialGloss(index, value) { + this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_GLOSS_OFFSET] = value; + } + getMaterialRefractiveIndex(index) { + return this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; + } + setMaterialRefractiveIndex(index, value) { + this[$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value; + } + getMaterialColor(index, value) { + const offset = $66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + } + setMaterialColor(index, value) { + const offset = $66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.MATERIAL_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSegmentColor(index, value) { + const offset = $66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.SEGMENT_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + value[3] = this[offset + 3]; + } + setSegmentColor(index, value) { + const offset = $66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE * index + this.SEGMENT_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } } -$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE = 36; +$66964bfc3ddbcb4c$export$1337e9dd34ffc243.SIZE = 52; class $66964bfc3ddbcb4c$export$cb7224ab7735b16e { get center0() { return this._center0; @@ -32705,12 +34370,6 @@ class $66964bfc3ddbcb4c$export$cb7224ab7735b16e { get time1() { return this._time1; } - get material() { - return this._material; - } - set material(material) { - this._material = material; - } get bounds() { return this._bounds; } @@ -32725,17 +34384,29 @@ class $66964bfc3ddbcb4c$export$cb7224ab7735b16e { this._center1 = options.center1; this._time0 = options.time0; this._time1 = options.time1; - this._material = options.material; this._bounds = new (0, $f858a5fa67a435f5$export$8ec70f2db73b49aa)(); this._offset0 = (0, $31054a6c69637582$exports).create(); this._offset1 = (0, $31054a6c69637582$exports).create(); + this.materialFuzz = options.materialFuzz; + this.materialType = options.materialType; + this.materialGloss = options.materialGloss; + this.materialDensity = options.materialDensity; + this.materialRefractiveIndex = options.materialRefractiveIndex; + this.materialColor = options.materialColor; + this.segmentColor = options.segmentColor; } - toBuffer(buffer, index, materialId) { + toBuffer(buffer, index) { buffer.setCenter0(index, this._center0); buffer.setCenter1(index, this._center1); buffer.setTime0(index, this._time0); buffer.setTime1(index, this._time1); - buffer.setMaterialId(index, materialId); + buffer.setMaterialTypeId(index, this.materialType); + buffer.setMaterialFuzz(index, this.materialFuzz); + buffer.setMaterialGloss(index, this.materialGloss); + buffer.setMaterialDensity(index, this.materialDensity); + buffer.setMaterialRefractiveIndex(index, this.materialRefractiveIndex); + buffer.setMaterialColor(index, this.materialColor); + buffer.setSegmentColor(index, this.segmentColor); } } class $66964bfc3ddbcb4c$export$f44a85073ff35bb extends $66964bfc3ddbcb4c$export$cb7224ab7735b16e { @@ -32754,8 +34425,8 @@ class $66964bfc3ddbcb4c$export$f44a85073ff35bb extends $66964bfc3ddbcb4c$export$ min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.sphere); buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._radius, this._radius, this._radius)); } @@ -32783,8 +34454,8 @@ class $66964bfc3ddbcb4c$export$3f7e8ab42d22375 extends $66964bfc3ddbcb4c$export$ min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.xYDisk); buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._radius0, this._radius0, this._thickness)); buffer.setSize1(index, (0, $31054a6c69637582$exports).fromValues(this._radius1, this._radius1, this._thickness)); @@ -32813,8 +34484,8 @@ class $66964bfc3ddbcb4c$export$1d27985e95946d19 extends $66964bfc3ddbcb4c$export max0[2] = Math.max(max0[2], max1[2]); this._bounds = rotatedBounds0; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.rotatedXyDisk); buffer.setRotation0(index, this._rotation0); buffer.setRotation1(index, this._rotation1); @@ -32854,8 +34525,8 @@ class $66964bfc3ddbcb4c$export$d84131593262075b extends $66964bfc3ddbcb4c$export this.offset1[1] = (min[1] + max[1]) / 2 - this._center1[1]; this.offset1[2] = (min[2] + max[2]) / 2 - this._center1[2]; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.ringSdf); buffer.setSize0(index, this._size0); buffer.setSize1(index, this._size1); @@ -32885,13 +34556,36 @@ class $66964bfc3ddbcb4c$export$2d4dbfe5a7e22bdf extends $66964bfc3ddbcb4c$export max0[2] = Math.max(max0[2], max1[2]); this._bounds = rotatedBounds0; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.rotatedRingSdf); buffer.setRotation0(index, this._rotation0); buffer.setRotation1(index, this._rotation1); } } +class $66964bfc3ddbcb4c$export$8c6d7438a2b5cc70 extends $66964bfc3ddbcb4c$export$cb7224ab7735b16e { + constructor(options){ + super(options); + this._innerRadius = options.innerRadius; + this._outerRadius = options.outerRadius; + this._height = options.height; + this._rounding = options.rounding; + const min = this._bounds.min; + const max = this._bounds.max; + min[0] = this._center1[0] - this._outerRadius; + max[0] = this._center1[0] + this._outerRadius; + min[1] = this._center1[1] - this._height; + max[1] = this._center1[1] + this._height; + min[2] = this._center1[2] - this._outerRadius; + max[2] = this._center1[2] + this._outerRadius; + } + toBuffer(buffer, index) { + super.toBuffer(buffer, index); + buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.tubeSdf); + buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._innerRadius, this._height, this._outerRadius)); + buffer.setRounding(index, this._rounding); + } +} class $66964bfc3ddbcb4c$export$28497cc10fec95c2 extends $66964bfc3ddbcb4c$export$cb7224ab7735b16e { constructor(options){ super(options); @@ -32906,20 +34600,26 @@ class $66964bfc3ddbcb4c$export$28497cc10fec95c2 extends $66964bfc3ddbcb4c$export min[2] = Math.min(this._center0[2] - this._size0[2], this._center1[2] - this._size1[2]); max[2] = Math.max(this._center0[2] + this._size0[2], this._center1[2] + this._size1[2]); } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.box); buffer.setSize0(index, this._size0); buffer.setSize1(index, this._size1); } } +class $66964bfc3ddbcb4c$export$86630ee69b6c2fb extends $66964bfc3ddbcb4c$export$f44a85073ff35bb { + toBuffer(buffer, index) { + super.toBuffer(buffer, index); + buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.sphereSdf); + } +} class $66964bfc3ddbcb4c$export$dfaec831a2de7e90 extends $66964bfc3ddbcb4c$export$28497cc10fec95c2 { constructor(options){ super(options); this._rounding = options.rounding; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.boxSdf); buffer.setRounding(index, this._rounding); } @@ -32945,8 +34645,8 @@ class $66964bfc3ddbcb4c$export$e349e1996fd043a1 extends $66964bfc3ddbcb4c$export max0[2] = Math.max(max0[2], max1[2]); this._bounds = rotatedBounds0; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.rotatedBoxSdf); buffer.setRotation0(index, this._rotation0); buffer.setRotation1(index, this._rotation1); @@ -32973,8 +34673,8 @@ class $66964bfc3ddbcb4c$export$acdc70fb29a0312b extends $66964bfc3ddbcb4c$export max0[2] = Math.max(max0[2], max1[2]); this._bounds = rotatedBounds0; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.rotatedBox); buffer.setRotation0(index, this._rotation0); buffer.setRotation1(index, this._rotation1); @@ -33030,8 +34730,8 @@ class $66964bfc3ddbcb4c$export$cd2cb390b9add281 extends $66964bfc3ddbcb4c$export max0[2] = Math.max(max0[2], max1[2]); } } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.cylinder); buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._radius, this._height, this._radius)); buffer.setSize1(index, (0, $31054a6c69637582$exports).fromValues(this._radius, this._height, this._radius)); @@ -33044,8 +34744,8 @@ class $66964bfc3ddbcb4c$export$563880b935f7aee2 extends $66964bfc3ddbcb4c$export super(options); this._rounding = options.rounding; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.cylinderSdf); buffer.setRounding(index, this._rounding); } @@ -33070,8 +34770,8 @@ class $66964bfc3ddbcb4c$export$2104cbf9d09a457a extends $66964bfc3ddbcb4c$export min[2] = this._center0[2] - this._radius; max[2] = this._center0[2] + this._radius; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.hexPrism); buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._radius * (0, $d4d7bd6cc65a5081$export$a002182e51710d39).ROOT_THREE_OVER_TWO, this._height, this._radius)); } @@ -33081,8 +34781,8 @@ class $66964bfc3ddbcb4c$export$df234dab64f8469a extends $66964bfc3ddbcb4c$export super(options); this._rounding = options.rounding; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.hexPrismSdf); buffer.setRounding(index, this._rounding); } @@ -33103,8 +34803,8 @@ class $66964bfc3ddbcb4c$export$3d594d9378ccaeb1 extends $66964bfc3ddbcb4c$export this._texCoord1 = options.texCoord1; this._setBounds(); } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setTexCoord0(index, this._texCoord0); buffer.setTexCoord1(index, this._texCoord1); } @@ -33120,8 +34820,8 @@ class $66964bfc3ddbcb4c$export$379f0673f20ddbc9 extends $66964bfc3ddbcb4c$export min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.xyRect); buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._size0[0], this._size0[1], this._thickness)); buffer.setSize1(index, (0, $31054a6c69637582$exports).fromValues(this._size1[0], this._size1[1], this._thickness)); @@ -33138,8 +34838,8 @@ class $66964bfc3ddbcb4c$export$57071e021ef37bbb extends $66964bfc3ddbcb4c$export min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.xzRect); buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._size0[0], this._thickness, this._size0[1])); buffer.setSize1(index, (0, $31054a6c69637582$exports).fromValues(this._size1[0], this._thickness, this._size1[1])); @@ -33156,8 +34856,8 @@ class $66964bfc3ddbcb4c$export$c9a72925228aaa16 extends $66964bfc3ddbcb4c$export min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.yzRect); buffer.setSize0(index, (0, $31054a6c69637582$exports).fromValues(this._thickness, this._size0[0], this._size0[1])); buffer.setSize1(index, (0, $31054a6c69637582$exports).fromValues(this._thickness, this._size1[0], this._size1[1])); @@ -33168,8 +34868,8 @@ class $66964bfc3ddbcb4c$export$da0b2fe0ae5e85dd extends $66964bfc3ddbcb4c$export super(options); this._sdfBuffer = options.sdfBuffer; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setSdfBuffer(index, this._sdfBuffer); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.fontXyRect); } @@ -33181,8 +34881,8 @@ class $66964bfc3ddbcb4c$export$6d714417e0aa3f19 extends $66964bfc3ddbcb4c$export this._sdfBuffer = options.sdfBuffer; this._sdfBorder = options.sdfBorder; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setTexId(index, this._texId); buffer.setSdfBuffer(index, this._sdfBuffer); buffer.setSdfBorder(index, this._sdfBorder); @@ -33210,8 +34910,8 @@ class $66964bfc3ddbcb4c$export$71089e9c0fdb5c5 extends $66964bfc3ddbcb4c$export$ max0[2] = Math.max(max0[2], max1[2]); this._bounds = rotatedBounds0; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.rotatedXyRect); buffer.setRotation0(index, this._rotation0); buffer.setRotation1(index, this._rotation1); @@ -33222,8 +34922,8 @@ class $66964bfc3ddbcb4c$export$402b844452575dc9 extends $66964bfc3ddbcb4c$export super(options); this._sdfBuffer = options.sdfBuffer; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setSdfBuffer(index, this._sdfBuffer); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.rotatedFontXyRect); } @@ -33235,8 +34935,8 @@ class $66964bfc3ddbcb4c$export$c2e43d40ab2c967e extends $66964bfc3ddbcb4c$export this._sdfBuffer = options.sdfBuffer; this._sdfBorder = options.sdfBorder; } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + super.toBuffer(buffer, index); buffer.setTexId(index, this._texId); buffer.setSdfBuffer(index, this._sdfBuffer); buffer.setSdfBorder(index, this._sdfBorder); @@ -33252,15 +34952,14 @@ class $66964bfc3ddbcb4c$export$412c0ed39e393270 extends $66964bfc3ddbcb4c$export this._boundary = options.boundary; this._bounds = this._boundary.bounds; } - toBuffer(buffer, index, materialId) { - this._boundary.toBuffer(buffer, index, materialId); + toBuffer(buffer, index) { + this._boundary.toBuffer(buffer, index); buffer.setBoundaryType(index, buffer.getType(index)); buffer.setType(index, $66964bfc3ddbcb4c$export$8daabe80e4a041.constantMedium); } } - /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. @@ -33269,6 +34968,7 @@ const $e1b604d7f27d3d8e$export$7173403786dbea8d = ` const PI = 3.1415926535897932385f; const TWO_PI = 6.2831853071795864769f; const ROOT_THREE_OVER_TWO = 0.86602540378443864676f; +const ONE_OVER_LOG10 = 1f / log(10f); struct ColorBuffer { values: array<f32>, @@ -33295,7 +34995,7 @@ struct HitRecord { normal: vec3<f32>, t: f32, frontFace: bool, - materialId: u32, + // materialId: u32, uv: vec2<f32>, id: u32, previousId: u32, @@ -33313,7 +35013,6 @@ struct Camera { lowerLeftCorner: vec3<f32>, horizontal: vec3<f32>, vertical: vec3<f32>, - lookAt: vec3<f32>, u: vec3<f32>, v: vec3<f32>, w: vec3<f32>, @@ -33322,6 +35021,7 @@ struct Camera { viewportHeight: f32, fov: f32, aperture: f32, + focusDistance: f32, time0: f32, time1: f32, } @@ -33336,19 +35036,21 @@ struct Uniforms { // ------------------------------ seed: f32, // 44 4 4 forward: vec3<f32>, // 48 16 12 fov: f32, // 60 4 4 - lookAt: vec3<f32>, // 64 16 12 - aperture: f32, // 76 4 4 - backgroundColor: vec3<f32>, // 80 16 12 - time0: f32, // 92 4 4 - time1: f32, // 96 4 4 - tilesX : f32, // 100 4 4 - tilesY : f32, // 104 4 4 - tileOffsetX : f32, // 108 4 4 - tileOffsetY : f32, // 112 4 4 - raysPerFrame : f32, // 116 4 4 - // padding 120 4 8 + backgroundColor: vec3<f32>, // 64 16 12 + time0: f32, // 76 4 4 + ambientColor: vec3<f32>, // 80 16 12 + time1: f32, // 92 4 4 + tilesX : f32, // 96 4 4 + tilesY : f32, // 100 4 4 + tileOffsetX : f32, // 104 4 4 + tileOffsetY : f32, // 108 4 4 + lookAt: vec3<f32>, // 112 16 12 + aperture: f32, // 124 4 4 + focusDistance: f32, // 128 4 4 + raysPerFrame : f32, // 132 4 4 + // padding 136 4 4 // ------------------------------ - // 16 128 + // 16 144 } // id type @@ -33359,18 +35061,20 @@ struct Uniforms { // ------------------------------ // 3 sdfText // 4 checker // 5 grid - // offest align size stride -struct Texture { // --------------------------------------- + // offest align size +struct Texture { // ------------------------------ color0: vec3<f32>, // 0 16 12 typeId: f32, // 12 4 4 color1: vec3<f32>, // 16 12 12 - // padding 28 12 12 + // padding 28 4 12 size0: vec4<f32>, // 32 16 16 size1: vec4<f32>, // 48 16 16 clip: vec4<f32>, // 64 16 16 offset: vec2<f32>, // 80 8 8 -} // --------------------------------------- - // 16 88 96 +} // padding 88 4 8 + // ------------------------------ + // 16 96 + // id type // --------------- @@ -33381,8 +35085,8 @@ struct Texture { // --------------------------------------- // 4 glossy // 5 isotropic // 6 varnitsh - // offest align size stride -struct Material { // --------------------------------------- + // offest align size +struct Material { // ------------------------------ typeId: f32, // 0 4 4 fuzz: f32, // 4 4 4 refractiveIndex: f32, // 8 4 4 @@ -33391,8 +35095,9 @@ struct Material { // --------------------------------------- glossiness: f32, // 28 4 4 idColor: vec4<f32>, // 32 16 16 density: f32, // 48 4 4 - // --------------------------------------- -} // 16 52 64 + // padding 52 4 12 + // ------------------------------ +} // 16 64 // id type // ---------------- @@ -33402,16 +35107,17 @@ struct Material { // --------------------------------------- // 3 disk // 4 cylinder // 5 dome - // offest align size stride -struct Light { // --------------------------------------- + // offest align size +struct Light { // ------------------------------ rotation: vec4<f32>, // 0 16 16 center: vec3<f32>, // 16 16 12 typeId: f32, // 28 4 4 size: vec3<f32>, // 32 16 12 // padding 44 4 4 color: vec3<f32>, // 48 16 12 -} // --------------------------------------- - // 16 60 64 + // padding 60 4 4 +} // ------------------------------ + // 16 64 // id type // ---------------- @@ -33437,49 +35143,62 @@ struct Light { // --------------------------------------- // 19 rotatedXyDisk // 20 ringSdf // 21 rotatedRingSdf - // offest align size stride -struct Hittable { // --------------------------------------- - center0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - size0: vec3<f32>, // 16 16 12 - materialId: f32, // 28 4 4 - rotation0: vec4<f32>, // 32 16 16 - rotation1: vec4<f32>, // 48 16 16 - texCoord0: vec2<f32>, // 64 8 8 - texCoord1: vec2<f32>, // 72 8 8 - center1: vec3<f32>, // 80 16 12 - rounding: f32, // 92 4 4 - size1: vec3<f32>, // 96 16 12 - boundaryTypeId: f32, // 108 4 4 - time0: f32, // 112 4 4 - time1: f32, // 116 4 4 - texId: f32, // 120 4 4 - sdfBuffer: f32, // 124 4 4 - sdfBorder: f32, // 128 4 4 - parameter1: f32, // 132 4 4 - parameter2: f32, // 136 4 4 - // padding 140 4 4 -} // --------------------------------------- - // 16 144 144 - - // offest align size stride -struct LinearBVHNode { // --------------------------------------- +// 22 sphereSdf +// 23 tubeSdf + // offest align size +struct Hittable { // ------------------------------ + center0: vec3<f32>, // 0 16 12 + typeId: f32, // 12 4 4 + size0: vec3<f32>, // 16 16 12 + materialId: f32, // 28 4 4 + rotation0: vec4<f32>, // 32 16 16 + rotation1: vec4<f32>, // 48 16 16 + texCoord0: vec2<f32>, // 64 8 8 + texCoord1: vec2<f32>, // 72 8 8 + center1: vec3<f32>, // 80 16 12 + rounding: f32, // 92 4 4 + size1: vec3<f32>, // 96 16 12 + boundaryTypeId: f32, // 108 4 4 + time0: f32, // 112 4 4 + time1: f32, // 116 4 4 + texId: f32, // 120 4 4 + sdfBuffer: f32, // 124 4 4 + sdfBorder: f32, // 128 4 4 + parameter1: f32, // 132 4 4 + parameter2: f32, // 136 4 4 + materialFuzz: f32, // 140 4 4 + materialGloss: f32, // 144 4 4 + materialDensity: f32, // 148 4 4 + materialRefractiveIndex: f32, // 152 4 4 + // padding 156 4 4 + materialColor: vec3<f32>, // 160 16 12 + materialTypeId: f32, // 172 4 4 + segmentColor: vec4<f32>, // 176 16 16 + textureTypeId: f32, // 192 4 4 + textureId: f32, // 196 4 4 + // padding 200 4 8 +} // ------------------------------ + // 16 208 + + // offest align size +struct LinearBVHNode { // ------------------------------ center: vec3<f32>, // 0 16 12 primitivesOffset: f32, // 12 4 4 size: vec3<f32>, // 16 16 12 secondChildOffset: f32, // 28 4 4 nPrimitives: f32, // 32 4 4 axis: f32, // 36 4 4 -} // --------------------------------------- - // 16 40 48 +} // padding 40 4 8 + // ------------------------------ + // 16 48 struct HittableBuffer { hittables: array<Hittable>, } -struct MaterialBuffer { - materials: array<Material>, -} +// struct MaterialBuffer { +// materials: array<Material>, +// } struct TextureBuffer { textures: array<Texture>, @@ -33515,11 +35234,10 @@ fn getCamera(uniforms: Uniforms) -> Camera { camera.viewportHeight = 2f * tan(camera.fov / 2f); camera.viewportWidth = camera.aspectRatio * camera.viewportHeight; camera.origin = uniforms.position; - camera.lookAt = uniforms.lookAt; camera.u = uniforms.right; camera.v = uniforms.up; camera.w = uniforms.forward; - let focusDistance = dot(camera.w, camera.origin - camera.lookAt); + let focusDistance = dot(camera.w, camera.origin - uniforms.lookAt) + uniforms.focusDistance; camera.horizontal = camera.u * camera.viewportWidth * focusDistance; camera.vertical = camera.v * camera.viewportHeight * focusDistance; camera.lowerLeftCorner = camera.origin - camera.horizontal / 2f + camera.vertical / 2f - camera.w * focusDistance; @@ -33631,7 +35349,7 @@ fn hitBVH(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, s if (hit(id, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { hitAnything = true; closestSoFar = tempHitRecord.t; - tempHitRecord.materialId = u32(hittableBuffer.hittables[id].materialId); + // tempHitRecord.materialId = u32(hittableBuffer.hittables[id].materialId); tempHitRecord.id = id; } } @@ -33739,6 +35457,12 @@ fn hit(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: pt case 21u: { return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); } + case 22u: { + return hitSphereSdf(id, ray, tMin, tMax, hitRecord); + } + case 23u: { + return hitTubeSdf(id, ray, tMin, tMax, hitRecord); + } } } @@ -33770,7 +35494,8 @@ fn hitConstantMedium(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, } tempHitRecord1.t = max(tempHitRecord1.t, 0f); let distanceInsideBoundary = tempHitRecord2.t - tempHitRecord1.t; - let negativeInverseDensity = -1f / materialBuffer.materials[u32((*constantMedium).materialId)].density; + // let negativeInverseDensity = -1f / materialBuffer.materials[u32((*constantMedium).materialId)].density; + let negativeInverseDensity = -1f / constantMedium.materialDensity; let hitDistance = negativeInverseDensity * log(random(seed)); if (hitDistance > distanceInsideBoundary) { return false; } let t = tempHitRecord1.t + hitDistance; @@ -33817,14 +35542,19 @@ fn hitConstantMediumBoundary(id: u32, boundaryTypeId: u32, ray: Ray, invDir: vec case 21u: { return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); } + case 22u: { + return hitSphereSdf(id, ray, tMin, tMax, hitRecord); + } + case 23u: { + return hitTubeSdf(id, ray, tMin, tMax, hitRecord); + } } } fn hitSphere(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { let sphere = &hittableBuffer.hittables[id]; let radius = (*sphere).size0.x; - let time = min(max((ray.time - (*sphere).time0) / ((*sphere).time1 - (*sphere).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*sphere).center0 + time * ((*sphere).center1 - (*sphere).center0); + let center = (*sphere).center0; let oc = ray.origin - center; let b = dot(oc, ray.direction); let c = dot(oc, oc) - radius * radius; @@ -33838,18 +35568,18 @@ fn hitSphere(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, H root = -b + h; if (root < tMin || root > tMax) { return false; } } - + // (*hitRecord).t = root; // (*hitRecord).position = rayAt(ray, root); // let outwardNormal = ((*hitRecord).position - center) / radius; // setFaceNormal(ray, outwardNormal, hitRecord); - + // Reduce precision error in t by ensuring hit position is on sphere surface - let outwardNormal = normalize(ray.origin + ray.direction * root - center); + let outwardNormal = normalize(ray.origin + ray.direction * root - center); setFaceNormal(ray, outwardNormal, hitRecord); (*hitRecord).position = center + outwardNormal * radius; // Use outward normal with internal reflection (*hitRecord).t = root; // I should also re-calculate t, but this would involve another normalization. t is only used to check closest hit, so only important with overlapping geometry - + // UV let phi = atan2(outwardNormal.x, outwardNormal.z); // [-pi,pi] let theta = asin(outwardNormal.y); // [-pi/2, pi/2] @@ -33871,7 +35601,7 @@ fn hitBox(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: let tFar = min(min(t2.x, t2.y), t2.z); // if (tFar <= tNear) { return false; } if (tNear > tFar || tFar < 0f) { return false; } - + // Find nearest root in range var outwardNormal: vec3<f32>; var root = tNear; @@ -33883,7 +35613,7 @@ fn hitBox(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: else { outwardNormal = -sign(ray.direction) * step(t1.yzx, t1.xyz) * step(t1.zxy, t1.xyz); } - + (*hitRecord).t = root; (*hitRecord).position = rayAt(ray, root); setFaceNormal(ray, outwardNormal, hitRecord); @@ -33926,7 +35656,7 @@ fn hitXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, H // Bounds let radius = (*xyDisk).size0.x; if (dot(p, p) > radius * radius) { return false; } // dot(p, p) is squared distance from disk center to intersection point - + // Texture coords var uv = vec2<f32>(0.5 * p.xy / radius + vec2<f32>(0.5f, 0.5f)); let texCoord0 = (*xyDisk).texCoord0; @@ -34073,7 +35803,7 @@ fn hitXzRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, H // TODO: Share hit function with XyRect fn hitFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { let xyRect = &hittableBuffer.hittables[id]; - + // let oc = ray.origin - (*xyRect).center0; let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); @@ -34179,7 +35909,7 @@ fn hitSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function // sdfBorder let border = xyRect.sdfBorder / 0xff; (*hitRecord).sdfBorder = r - buffer < border; - + (*hitRecord).uv = uv; (*hitRecord).t = t; (*hitRecord).position = rayAt(ray, t); @@ -34274,7 +36004,7 @@ fn hitCylinder(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, let cr1 = (sy1 * ch - caoc) / card; let ct0 = select(10000000f, cr0, abs(b + a * cr0) < h); let ct1 = select(-10000000f, cr1, abs(b + a * cr1) < h); - + // Find the nearest root in range let tN = min(bt0, ct0); let tF = max(bt1, ct1); @@ -34299,13 +36029,13 @@ fn hitCylinder(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, else { let sy = select(sy1, sy0, root == ct0); outwardNormal = ca * sy; - + // TODO: Reduce precision error setFaceNormal(ray, outwardNormal, hitRecord); (*hitRecord).position = rayAt(ray, root); (*hitRecord).t = root; } - + // setFaceNormal(ray, outwardNormal, hitRecord); // (*hitRecord).position = rayAt(ray, root); // (*hitRecord).t = root; @@ -34423,6 +36153,40 @@ fn hitBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, H return false; } +fn mapSphereSdf(p: vec3<f32>, r: f32) -> f32 { + return length(p) - r; +} + +fn hitSphereSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { + let sphereSdf = &hittableBuffer.hittables[id]; + var t = tMin; + let center = (*sphereSdf).center0; + let r = (*sphereSdf).size0.x; + for (var i: u32 = 0u; i < 256u; i = i + 1u) { + let position = rayAt(ray, t); + let oc = position - center; + let distance = abs(mapSphereSdf(oc, r)); + t = t + distance; + if (t > tMax) { return false; } + if (distance < 0.000001f) { + (*hitRecord).t = t; + (*hitRecord).position = rayAt(ray, t); + + // Normal + let h = 0.000001f; // replace by an appropriate value + let k = vec2<f32>(1f, -1f); + let outwardNormal = normalize( + k.xyy * mapSphereSdf(oc + k.xyy * h, r) + + k.yyx * mapSphereSdf(oc + k.yyx * h, r) + + k.yxy * mapSphereSdf(oc + k.yxy * h, r) + + k.xxx * mapSphereSdf(oc + k.xxx * h, r)); + setFaceNormal(ray, outwardNormal, hitRecord); + return true; + } + } + return false; +} + fn hitRotatedBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { let rotatedBoxSdf = &hittableBuffer.hittables[id]; let time = min(max((ray.time - (*rotatedBoxSdf).time0) / ((*rotatedBoxSdf).time1 - (*rotatedBoxSdf).time0), 0f), 1f); // Normalize time to [0,1] @@ -34608,10 +36372,60 @@ fn hitRotatedRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<fun return false; } +fn mapTubeSdf(p: vec3<f32>, r: f32, th: f32, h: f32, rounding: f32) -> f32 { + // Circle + // return length(p) - r; + // Annular + // abs(sdShape(p)) - r + // Annular circle + let d = abs(length(p.xz) - r) - th / 2f; + + // Extrude + let w = vec2<f32>(d, abs(p.y) - h); + return min(max(w.x, w.y), 0f) + length(max(w, vec2<f32>(0f, 0f))) - rounding; +} + +fn hitTubeSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { + let tubeSdf = &hittableBuffer.hittables[id]; + var t = tMin; + let size = (*tubeSdf).size0; + let center = (*tubeSdf).center0; + let rounding = (*tubeSdf).rounding; + let outerr = size.z; + let innerr = size.x; + let e = size.y - rounding; + let r = (outerr + innerr) * 0.5f; + let th = (outerr - innerr) - rounding; + for (var i: u32 = 0u; i < 256u; i = i + 1u) { + let position = rayAt(ray, t); + let oc = position - center; + let distance = abs(mapTubeSdf(oc, r, th, e, rounding)); + t = t + distance; + if (t > tMax) { return false; } + if (distance < 0.000001f) { + (*hitRecord).t = t; + (*hitRecord).position = rayAt(ray, t); + + // Normal + let h = 0.00001f; // replace by an appropriate value + let k = vec2<f32>(1f, -1f); + let outwardNormal = normalize( + k.xyy * mapTubeSdf(oc + k.xyy * h, r, th, e, rounding) + + k.yyx * mapTubeSdf(oc + k.yyx * h, r, th, e, rounding) + + k.yxy * mapTubeSdf(oc + k.yxy * h, r, th, e, rounding) + + k.xxx * mapTubeSdf(oc + k.xxx * h, r, th, e, rounding)); + setFaceNormal(ray, outwardNormal, hitRecord); + return true; + } + } + return false; +} + fn hitLights(ray: Ray) -> vec3<f32> { var hit: bool; for (var i: u32 = 0u; i < arrayLength(&lightBuffer.lights); i = i + 1u) { // let light = lightBuffer.lights[i]; + // TODO: Directional lights switch u32(lightBuffer.lights[i].typeId) { default: { hit = hitSphereLight(i, ray); @@ -34624,11 +36438,14 @@ fn hitLights(ray: Ray) -> vec3<f32> { return lightBuffer.lights[i].color; } } - + // Background color // return vec3<f32>(0f, 0f, 0f); // return vec3<f32>(1f, 1f, 1f); - return uniforms.backgroundColor; + // return uniforms.backgroundColor; + + // Ambient light (not background color) + return uniforms.ambientColor; // TODO: Dome light // let t = 0.5f * (ray.direction.y + 1f); @@ -34670,17 +36487,20 @@ fn nearZero(v: vec3<f32>) -> bool { fn scatterLambertian(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { let scatterDirection = hitRecord.normal + randomUnitVector(seed); - + // Catch degenerate scatter direction (*ray).direction = select(normalize(scatterDirection), hitRecord.normal, nearZero(scatterDirection)); - + (*ray).origin = hitRecord.position; (*attenuation) = textureValue(hitRecord); return true; } fn scatterMetal(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + materialBuffer.materials[hitRecord.materialId].fuzz * randomInUnitSphere(seed)); + // let fuzz = materialBuffer.materials[hitRecord.materialId].fuzz; + let fuzz = hittableBuffer.hittables[hitRecord.id].materialFuzz; + (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + fuzz * randomInUnitSphere(seed)); + (*ray).origin = hitRecord.position; (*attenuation) = textureValue(hitRecord); @@ -34690,12 +36510,18 @@ fn scatterMetal(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr< fn scatterGlossy(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { // Specular - let material = &materialBuffer.materials[hitRecord.materialId]; - let refractiveIndex = (*material).refractiveIndex; + // let material = &materialBuffer.materials[hitRecord.materialId]; + // let fuzz = (*material).fuzz; + // let refractiveIndex = (*material).refractiveIndex; + // let glossiness = (*material).glossiness; + let hittable = hittableBuffer.hittables[hitRecord.id]; + let fuzz = hittable.materialFuzz; + let refractiveIndex = hittable.materialRefractiveIndex; + let glossiness = hittable.materialGloss; let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - if (reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + (*material).fuzz * randomInUnitSphere(seed)); + if (reflectance(cosTheta, refractionRatio) * glossiness > random(seed)) { + (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + fuzz * randomInUnitSphere(seed)); (*ray).origin = hitRecord.position; (*attenuation) = vec3<f32>(1f, 1f, 1f); @@ -34709,29 +36535,35 @@ fn scatterGlossy(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr } fn scatterDielectric(ray: ptr<function, Ray>, hitRecord: ptr<function, HitRecord>, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let material = &materialBuffer.materials[(*hitRecord).materialId]; - let refractiveIndex = (*material).refractiveIndex; + // let material = &materialBuffer.materials[(*hitRecord).materialId]; + // let refractiveIndex = (*material).refractiveIndex; + let hittable = hittableBuffer.hittables[hitRecord.id]; + let refractiveIndex = hittable.materialRefractiveIndex; // TODO: If still inside another material, use its refractive index let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, (*hitRecord).frontFace); let cosTheta = min(dot(-(*ray).direction, (*hitRecord).normal), 1f); let sinTheta = sqrt(1f - cosTheta * cosTheta); let cannotRefract = refractionRatio * sinTheta > 1f; // if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - if (cannotRefract || reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { + // if (cannotRefract || reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { + if (cannotRefract || reflectance(cosTheta, refractionRatio) * hittable.materialGloss > random(seed)) { (*ray).direction = reflect((*ray).direction, (*hitRecord).normal); } else { (*ray).direction = refraction((*ray).direction, (*hitRecord).normal, refractionRatio); } (*ray).origin = (*hitRecord).position; - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); - + // (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); + (*ray).direction = normalize((*ray).direction + hittable.materialFuzz * randomInUnitSphere(seed)); + // Did the ray enter/stay inside? (*attenuation) = vec3<f32>(1f, 1f, 1f); // if (dot((*ray).direction, (*hitRecord).normal) < 0f) { if (dot((*ray).direction, select(-(*hitRecord).normal, (*hitRecord).normal, (*hitRecord).frontFace)) < 0f) { (*hitRecord).isAbsorbing = true; - (*hitRecord).absorption = (*material).color; + // (*hitRecord).absorption = (*material).color; + // (*hitRecord).absorption = hittable.materialColor; + (*hitRecord).absorption = hittable.materialColor * hittable.materialDensity; // If already inside another absorbing dielectric, add to absorption if ((*hitRecord).previousIsAbsorbing && (*hitRecord).id != (*hitRecord).previousId) { @@ -34744,15 +36576,19 @@ fn scatterDielectric(ray: ptr<function, Ray>, hitRecord: ptr<function, HitRecord fn scatterIsotropic(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { (*ray).direction = randomUnitVector(seed); (*ray).origin = hitRecord.position; - (*attenuation) = materialBuffer.materials[hitRecord.materialId].color; + let hittable = hittableBuffer.hittables[hitRecord.id]; + (*attenuation) = hittable.materialColor; return true; } fn scatterVarnish(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { // Front-face only (no internal reflection or refraction) - let material = &materialBuffer.materials[hitRecord.materialId]; - if (hitRecord.frontFace && (*material).glossiness > random(seed)) { - let refractiveIndex = (*material).refractiveIndex; + // let material = &materialBuffer.materials[hitRecord.materialId]; + let hittable = hittableBuffer.hittables[hitRecord.id]; + // if (hitRecord.frontFace && (*material).glossiness > random(seed)) { + if (hitRecord.frontFace && hittable.materialGloss > random(seed)) { + // let refractiveIndex = (*material).refractiveIndex; + let refractiveIndex = hittable.materialRefractiveIndex; let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); let sinTheta = sqrt(1f - cosTheta * cosTheta); @@ -34764,7 +36600,8 @@ fn scatterVarnish(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: pt // Refraction improves definition at edges and deepens color on faces (*ray).direction = refraction((*ray).direction, hitRecord.normal, refractionRatio); } - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); + // (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); + (*ray).direction = normalize((*ray).direction + hittable.materialFuzz * randomInUnitSphere(seed)); } // Pass-through (*ray).origin = hitRecord.position; @@ -34773,8 +36610,10 @@ fn scatterVarnish(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: pt } fn textureValue(hitRecord: HitRecord) -> vec3<f32> { - let textureId = materialBuffer.materials[hitRecord.materialId].textureId; - let texture = &textureBuffer.textures[u32(textureId)]; + // let textureId = materialBuffer.materials[hitRecord.materialId].textureId; + let hittable = hittableBuffer.hittables[hitRecord.id]; + // let texture = &textureBuffer.textures[u32(textureId)]; + let texture = &textureBuffer.textures[u32(hittable.textureId)]; switch u32((*texture).typeId) { // No texture default: { @@ -34786,7 +36625,8 @@ fn textureValue(hitRecord: HitRecord) -> vec3<f32> { return (*texture).color1; } else { - return (*texture).color0; + // return (*texture).color0; + return hittableBuffer.hittables[hitRecord.id].materialColor; } // Debug uv @@ -34846,7 +36686,7 @@ fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { // First hit // if (depth == 0u) { // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - // // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f) + // // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f) // // result.depth = 1f / hitRecord.t; // result.depth = -1f / dot(hitRecord.position - (*ray).origin, uniforms.forward); // } @@ -34860,7 +36700,7 @@ fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { // return result; return vec3<f32>(0f, 0f, 0f); } - + // Bounce // If last hit was travelling INTO a dielectric, use last hit position to calculate distance // and apply Beer's law to attenuate the light. Modify the dielectric scattering function to @@ -34874,32 +36714,42 @@ fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { // Reset absorption hitRecord.isAbsorbing = false; hitRecord.absorption = vec3<f32>(0f, 0f, 0f); - switch u32(materialBuffer.materials[hitRecord.materialId].typeId) { - default: { - scatter = false; - } + + // switch u32(materialBuffer.materials[hitRecord.materialId].typeId) { + switch u32(hittableBuffer.hittables[hitRecord.id].materialTypeId) { case 0u: { scatter = scatterLambertian(ray, hitRecord, &attenuation, seed); + break; } case 1u: { scatter = scatterMetal(ray, hitRecord, &attenuation, seed); + break; } case 2u: { scatter = scatterDielectric(ray, &hitRecord, &attenuation, seed); + break; } case 3u: { scatter = scatterGlossy(ray, hitRecord, &attenuation, seed); + break; } case 4u: { // Diffuse light scatter = false; - emitted = materialBuffer.materials[hitRecord.materialId].color; + // emitted = materialBuffer.materials[hitRecord.materialId].color; + emitted = hittableBuffer.hittables[hitRecord.id].materialColor; + break; } case 5u: { scatter = scatterIsotropic(ray, hitRecord, &attenuation, seed); + break; } case 6u: { scatter = scatterVarnish(ray, hitRecord, &attenuation, seed); + break; + } + default: { + scatter = false; } } @@ -34943,16 +36793,16 @@ fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { @group(0) @binding(0) var<storage, read_write> outputColorBuffer: ColorBuffer; @group(0) @binding(1) var<uniform> uniforms: Uniforms; @group(0) @binding(2) var<storage, read> hittableBuffer: HittableBuffer; -@group(0) @binding(3) var<storage, read> materialBuffer: MaterialBuffer; -@group(0) @binding(4) var<storage, read> textureBuffer: TextureBuffer; -@group(0) @binding(5) var<storage, read> lightBuffer: LightBuffer; -@group(0) @binding(6) var<storage, read> linearBVHNodeBuffer: LinearBVHNodeBuffer; -@group(0) @binding(7) var linearSampler: sampler; -@group(0) @binding(8) var fontTexture: texture_2d<f32>; -@group(0) @binding(9) var backgroundTexture: texture_2d<f32>; -@group(0) @binding(10) var atlasTexture: texture_2d<f32>; -@group(0) @binding(11) var<storage, read_write> outputNormalDepthBuffer: NormalDepthBuffer; -@group(0) @binding(12) var<storage, read_write> depthMinMaxBuffer: DepthMinMaxBuffer; +// @group(0) @binding(3) var<storage, read> materialBuffer: MaterialBuffer; +@group(0) @binding(3) var<storage, read> textureBuffer: TextureBuffer; +@group(0) @binding(4) var<storage, read> lightBuffer: LightBuffer; +@group(0) @binding(5) var<storage, read> linearBVHNodeBuffer: LinearBVHNodeBuffer; +@group(0) @binding(6) var linearSampler: sampler; +@group(0) @binding(7) var fontTexture: texture_2d<f32>; +@group(0) @binding(8) var backgroundTexture: texture_2d<f32>; +@group(0) @binding(9) var atlasTexture: texture_2d<f32>; +@group(0) @binding(10) var<storage, read_write> outputNormalDepthBuffer: NormalDepthBuffer; +@group(0) @binding(11) var<storage, read_write> depthMinMaxBuffer: DepthMinMaxBuffer; // TODO: Move lighting to seperate bind group so I can update it independently @@ -34975,7 +36825,7 @@ fn clear(@builtin(global_invocation_id) globalId : vec3<u32>) { fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); let tileSize = vec2<f32>(uniforms.width, uniforms.height); - + // Tex coords [0,1] // let id = f32(globalId.x); // let v = floor(id / imageSize.x); @@ -34989,13 +36839,13 @@ fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { let tilePixelX = id - tilePixelY * tileSize.x; let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - + // Tex coords ([0,1], [0,1]) let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - + // Camera var camera = getCamera(uniforms); - + // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) let samplePos = vec2<f32>(texCoord); @@ -35013,7 +36863,7 @@ fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { } let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; + // let index = u32(tilePixelY * tileSize.x + tilePixelX) * 4u; outputNormalDepthBuffer.values[index] = normal.x; outputNormalDepthBuffer.values[index + 1u] = normal.y; outputNormalDepthBuffer.values[index + 2u] = normal.z; @@ -35028,10 +36878,10 @@ fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { } @compute @workgroup_size(256, 1, 1) -fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { +fn depthNormalMultisampled(@builtin(global_invocation_id) globalId : vec3<u32>) { let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); let tileSize = vec2<f32>(uniforms.width, uniforms.height); - + // Tex coords [0,1] // let id = f32(globalId.x); // let v = floor(id / imageSize.x); @@ -35045,13 +36895,72 @@ fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { let tilePixelX = id - tilePixelY * tileSize.x; let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - + // Tex coords ([0,1], [0,1]) let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - + // Camera var camera = getCamera(uniforms); - + + // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) + var frameSeed = u32(uniforms.seed); + var seed = u32(tilePixelY * tileSize.x + tilePixelX) + frameSeed * u32(tileSize.x * tileSize.y); + let samplePos = vec2<f32>(texCoord) + vec2<f32>(random(&seed), random(&seed)) / imageSize; + + // Ray + var ray = getCameraRay(camera, &seed, samplePos); + + // Result + var normal = vec3<f32>(0f, 0f, 0f); + var depth = 0f; + var hitRecord: HitRecord; + if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { + normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); + depth = -1f / dot(hitRecord.position - ray.origin, uniforms.forward); + } + + let index = globalId.x * 4u; + // let index = u32(tilePixelY * tileSize.x + tilePixelX) * 4u; + outputNormalDepthBuffer.values[index] += normal.x; + outputNormalDepthBuffer.values[index + 1u] += normal.y; + outputNormalDepthBuffer.values[index + 2u] += normal.z; + outputNormalDepthBuffer.values[index + 3u] += depth; + + // Min, max depth + // When depth is 0, it means no hit, so ignore + if (depth > 0f) { + atomicMin(&depthMinMaxBuffer.values[0], u32(depth * 1000f)); + } + atomicMax(&depthMinMaxBuffer.values[1], u32(depth * 1000f)); +} + +@compute @workgroup_size(256, 1, 1) +fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { + let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); + let tileSize = vec2<f32>(uniforms.width, uniforms.height); + + // Tex coords [0,1] + // let id = f32(globalId.x); + // let v = floor(id / imageSize.x); + // let u = (id - v * imageSize.x); + // let uv = vec2<f32>(u, v); + // let texCoord = uv / imageSize; + + // Pixel coords ([0,width-1], [0,height-1]) + let id = f32(globalId.x); + // let tilePixelY = floor(id / tileSize.x); + // let tilePixelX = id - tilePixelY * tileSize.x; + let tilePixelY = floor(id / (tileSize.x + 1)); // Overdispatched by 1 + let tilePixelX = id - tilePixelY * (tileSize.x + 1); // Overdispatched by 1 + let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; + let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; + + // Tex coords ([0,1], [0,1]), can be > 1 with overdispatching + let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); + + // Camera + var camera = getCamera(uniforms); + // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) let samplePos = vec2<f32>(texCoord); @@ -35064,22 +36973,29 @@ fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { var hitRecord: HitRecord; if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { // color = materialBuffer.materials[hitRecord.materialId].idColor; - let id = f32(hitRecord.id & 255u) / 255f; - color.x = id; - color.y = id; - color.z = id; + + // TODO: Generate unique id color in main if not supplied + // let id = f32(hitRecord.id & 255u) / 255f; + // color.x = id; + // color.y = id; + // color.z = id; + + color = hittableBuffer.hittables[hitRecord.id].segmentColor; + // let color3 = textureValue(hitRecord); // color.x = color3.x; // color.y = color3.y; // color.z = color3.z; } - + let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; + // let index = u32(tilePixelY * (tileSize.x + 1) + tilePixelX) * 4u; // Overdispatched by 1 outputNormalDepthBuffer.values[index] = color.x; outputNormalDepthBuffer.values[index + 1u] = color.y; outputNormalDepthBuffer.values[index + 2u] = color.z; - outputNormalDepthBuffer.values[index + 3u] = 1f; + outputNormalDepthBuffer.values[index + 3u] = color.w; + + // TODO: Expand outputNormalDepthBuffer to store additional color channel for filling edges, or use separate buffer } // @builtin(local_invocation_id) localId : vec3<u32>, @@ -35094,7 +37010,7 @@ fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); let tileSize = vec2<f32>(uniforms.width, uniforms.height); - // TODO: Is additional noise when tiling due to sdf iterations (try non-sdf), texel offsets, (size - 1) issues, overdispatching? + // TODO: Pixels at x=0 have noise when object overlaps right-side of screen at widths of 75, 150, 300, 600, 1200, 2400 // Tex coords [0,1] // let id = f32(globalId.x); @@ -35110,13 +37026,13 @@ fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { let tilePixelX = id - tilePixelY * tileSize.x; let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - + // Tex coords ([0,1], [0,1]) let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - + // Camera var camera = getCamera(uniforms); - + // Frame seed var frameSeed = u32(uniforms.seed); let raysPerFrame = u32(uniforms.raysPerFrame); @@ -35124,7 +37040,7 @@ fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { var depth = 0f; var normal = vec3<f32>(0f, 0f, 0f); var seed: u32; - + for (var i = 0u; i < raysPerFrame; i = i + 1u) { // Random number generator // See https://nelari.us/post/weekend_raytracing_with_wgpu_1/#implement-a-random-number-generator @@ -35133,7 +37049,7 @@ fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { // let seed = dot(pixel, vec2<u32>(1u, resolution.x)) ^ jenkinsHash(frame); // return jenkinsHash(seed); // } - // + // // fn jenkinsHash(input: u32) -> u32 { // var x = input; // x += x << 10u; @@ -35157,7 +37073,7 @@ fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(1f, 1f, 1f)); // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light color += clamp(rayColor(&ray, &seed), vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - + // Depth // let depth = 1f / rayColor(&ray, &seed).depth; // color = vec3<f32>(depth, depth, depth); @@ -35165,7 +37081,7 @@ fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { // Normal // normal += result.normal; - + // Next frame frameSeed = frameSeed + 1u; } @@ -35189,16 +37105,24 @@ class $e1b604d7f27d3d8e$export$893bf7cc4a794b30 extends Float32Array { this.SEED_OFFSET = 11; this.FORWARD_OFFSET = 12; this.FOV_OFFSET = 15; - this.LOOKAT_OFFSET = 16; - this.APERTURE_OFFSET = 19; - this.BACKGROUND_COLOR_OFFSET = 20; - this.TIME0_OFFSET = 23; - this.TIME1_OFFSET = 24; - this.TILES_X = 25; - this.TILES_Y = 26; - this.TILE_OFFSET_X = 27; - this.TILE_OFFSET_Y = 28; - this.RAYS_PER_FRAME_OFFSET = 29; + this.BACKGROUND_COLOR_OFFSET = 16; + this.TIME0_OFFSET = 19; + this.AMBIENT_COLOR_OFFSET = 20; + this.TIME1_OFFSET = 23; + this.TILES_X = 24; + this.TILES_Y = 25; + this.TILE_OFFSET_X = 26; + this.TILE_OFFSET_Y = 27; + this.LOOKAT_OFFSET = 28; + this.APERTURE_OFFSET = 31; + this.FOCUS_DISTANCE_OFFSET = 32; + this.RAYS_PER_FRAME_OFFSET = 33; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value) { + this[this.FOCUS_DISTANCE_OFFSET] = value; } getWidth() { return this[this.WIDTH_OFFSET]; @@ -35268,21 +37192,22 @@ class $e1b604d7f27d3d8e$export$893bf7cc4a794b30 extends Float32Array { this[this.FORWARD_OFFSET + 1] = value[1]; this[this.FORWARD_OFFSET + 2] = value[2]; } - getLookAt(value) { - (0, $31054a6c69637582$exports).set(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); - } - setLookAt(value) { - this[this.LOOKAT_OFFSET] = value[0]; - this[this.LOOKAT_OFFSET + 1] = value[1]; - this[this.LOOKAT_OFFSET + 2] = value[2]; - } getBackgroundColor(value) { - (0, $4c4ac78b213a9c07$exports).set(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], 1); + (0, $4c4ac78b213a9c07$exports).set(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); } setBackgroundColor(value) { this[this.BACKGROUND_COLOR_OFFSET] = value[0]; this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value[3]; + } + getAmbientColor(value) { + (0, $31054a6c69637582$exports).set(value, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); + } + setAmbientColor(value) { + this[this.AMBIENT_COLOR_OFFSET] = value[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value[2]; } getTime0() { return this[this.TIME0_OFFSET]; @@ -35320,14 +37245,23 @@ class $e1b604d7f27d3d8e$export$893bf7cc4a794b30 extends Float32Array { setTileOffsetY(value) { this[this.TILE_OFFSET_Y] = value; } + getLookAt(value) { + (0, $31054a6c69637582$exports).set(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value) { + this[this.LOOKAT_OFFSET] = value[0]; + this[this.LOOKAT_OFFSET + 1] = value[1]; + this[this.LOOKAT_OFFSET + 2] = value[2]; + } } -$e1b604d7f27d3d8e$export$893bf7cc4a794b30.SIZE = 32; +$e1b604d7f27d3d8e$export$893bf7cc4a794b30.SIZE = 36; /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. - */ const $e354276e6b56108d$export$739cc3561e95931b = ` + */ +const $e354276e6b56108d$export$739cc3561e95931b = ` const GAMMA = vec3<f32>(0.45454545f); // 1 / 2.2 struct ColorData { @@ -35338,18 +37272,20 @@ struct NormalDepthData { data : array<f32>, } - // offest align size -struct Uniforms { // ------------------------------ - width: f32, // 0 4 4 - height: f32, // 4 4 4 - samplesPerPixel: f32, // 8 4 4 - exposure: f32, // 12 4 4 - minDepth: f32, // 16 4 4 - maxDepth: f32, // 20 4 4 - normalEdge: f32, // 24 4 4 - depthEdge: f32, // 28 4 4 -} // ------------------------------ - // 4 32 + // offest align size +struct Uniforms { // ------------------------------ + width: f32, // 0 4 4 + height: f32, // 4 4 4 + samplesPerPixel: f32, // 8 4 4 + exposure: f32, // 12 4 4 + minDepth: f32, // 16 4 4 + maxDepth: f32, // 20 4 4 + normalEdge: f32, // 24 4 4 + depthEdge: f32, // 28 4 4 + edgeForeground: vec4<f32>, // 32 16 16 + edgeBackground: vec4<f32>, // 48 16 16 +} // ------------------------------ + // 16 64 @group(0) @binding(0) var<uniform> uniforms : Uniforms; @group(0) @binding(1) var<storage, read> colorBuffer : ColorData; @@ -35403,6 +37339,25 @@ fn frag_depth(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { } } +@fragment +fn frag_depthMultisampled(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { + let x = floor(coord.x); + let y = floor(coord.y); + let index = u32(x + y * uniforms.width) * 4u; + let depth = normalDepthBuffer.data[index + 3u] / uniforms.samplesPerPixel; + let minDepth = uniforms.minDepth; + let maxDepth = uniforms.maxDepth; + if (minDepth == maxDepth) { + // Raw, unnormalized depth + return vec4<f32>(vec3<f32>(depth, depth, depth), 1f); + } + else { + // Normalize depth + var normalizedDepth = (depth - minDepth) / (maxDepth - minDepth); + return vec4<f32>(normalizedDepth, normalizedDepth, normalizedDepth, 1f); + } +} + @fragment fn frag_normal(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { let x = floor(coord.x); @@ -35411,6 +37366,14 @@ fn frag_normal(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); } +@fragment +fn frag_normalMultisampled(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { + let x = floor(coord.x); + let y = floor(coord.y); + let index = u32(x + y * uniforms.width) * 4u; + return vec4<f32>(normalDepthBuffer.data[index + 0u] / uniforms.samplesPerPixel, normalDepthBuffer.data[index + 1u] / uniforms.samplesPerPixel, normalDepthBuffer.data[index + 2u] / uniforms.samplesPerPixel, 1f); +} + // @fragment // fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { // let x = floor(coord.x); @@ -35462,27 +37425,35 @@ fn frag_normal(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { let x = floor(coord.x); let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - + // let index = u32(x + y * uniforms.width) * 4u; + let index = u32(x + y * (uniforms.width + 1)) * 4u; // Overdispatched by 1 + let background = uniforms.edgeBackground; + let foreground = uniforms.edgeForeground; + // Prevent edge detection at screen edges - if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { - return vec4<f32>(0f, 0f, 0f, 1f); - } + // Over-dispatched, so this is not needed + // if (x == uniforms.width - 1 || y == uniforms.height - 1) { return background; } // Segment derivatives + // let yOffset = index + u32(uniforms.width) * 4u; + let yOffset = index + u32(uniforms.width + 1) * 4u; // Overdispatched by 1 let p = vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], normalDepthBuffer.data[index + 3u]); let px = vec4<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u], normalDepthBuffer.data[index + 7u]); - let py = vec4<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]); + let py = vec4<f32>(normalDepthBuffer.data[yOffset + 0u], normalDepthBuffer.data[yOffset + 1u], normalDepthBuffer.data[yOffset + 2u], normalDepthBuffer.data[yOffset + 3u]); let dpdx = px - p; let dpdy = py - p; let fwidth = abs(dpdx) + abs(dpdy); // Output white when magnitude of dpdx over a threshold if (dot(fwidth, fwidth) > 0f) { - return vec4<f32>(1f, 1f, 1f, 1f); + return foreground; } else { - return vec4<f32>(0f, 0f, 0f, 1f); + return background; + + // TODO: Add another mode for edgeFill, or a flag for edgeFill (0 = background, 1 = color) + // Use idColor // return p; + // return vec4<f32>(p.x, p.y, p.z, 1f); } } @@ -35490,7 +37461,9 @@ fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { fn frag_segment(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { let x = floor(coord.x); let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; + + // let index = u32(x + y * uniforms.width) * 4u; + let index = u32(x + y * (uniforms.width + 1)) * 4u; // Overdispatched by 1 return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); } @@ -35517,8 +37490,33 @@ fn frag_main_hdr(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> let e = 0.14f; color = (color * (a * color + b)) / (color * (c * color + d) + e); + // TODO: Can I get the avg luminance in the same way as the min/max depth? + + // sRGB? + // https://sotrh.github.io/learn-wgpu/intermediate/tutorial13-hdr/#output-too-dark-on-webgpu + +// // Maps HDR values to linear values +// // Based on http://www.oscars.org/science-technology/sci-tech-projects/aces +// fn aces_tone_map(hdr: vec3<f32>) -> vec3<f32> { +// let m1 = mat3x3( +// 0.59719, 0.07600, 0.02840, +// 0.35458, 0.90834, 0.13383, +// 0.04823, 0.01566, 0.83777, +// ); +// let m2 = mat3x3( +// 1.60475, -0.10208, -0.00327, +// -0.53108, 1.10813, -0.07276, +// -0.07367, -0.00605, 1.07602, +// ); +// let v = m1 * hdr; +// let a = v * (v + 0.0245786) - 0.000090537; +// let b = v * (0.983729 * v + 0.4329510) + 0.238081; +// return clamp(m2 * (a / b), vec3(0.0), vec3(1.0)); +// } + // See https://bruop.github.io/tonemapping/ // See https://www.shadertoy.com/view/WdjSW3 + // See https://sibras.github.io/OpenGL4-Tutorials/docs/Tutorials/10-Tutorial10/ // Gamma-correct return vec4<f32>(pow(color, GAMMA), 1f); @@ -35534,6 +37532,8 @@ class $e354276e6b56108d$export$186ae5dce927ebd1 extends Float32Array { this.MAX_DEPTH_OFFSET = 5; this.EDGE_NORMAL_OFFSET = 6; this.EDGE_DEPTH_OFFSET = 7; + this.EDGE_FOREGROUND_OFFSET = 8; + this.EDGE_BACKGROUND_OFFSET = 12; } getWidth() { return this[this.WIDTH_OFFSET]; @@ -35583,8 +37583,26 @@ class $e354276e6b56108d$export$186ae5dce927ebd1 extends Float32Array { setEdgeNormal(value) { this[this.EDGE_NORMAL_OFFSET] = value; } + getEdgeForeground(value) { + (0, $4c4ac78b213a9c07$exports).set(value, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); + } + setEdgeForeground(value) { + this[this.EDGE_FOREGROUND_OFFSET] = value[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value[3]; + } + getEdgeBackground(value) { + (0, $4c4ac78b213a9c07$exports).set(value, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); + } + setEdgeBackground(value) { + this[this.EDGE_BACKGROUND_OFFSET] = value[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value[3]; + } } -$e354276e6b56108d$export$186ae5dce927ebd1.SIZE = 8; +$e354276e6b56108d$export$186ae5dce927ebd1.SIZE = 16; /*! @@ -36099,7 +38117,6 @@ class $18e0078d8611e105$export$6f251cd327b2ff1 { update() { if (this._hasChanged && this._isInitialized) { this._hasChanged = false; - const material = this._image.material == -1 ? this._main.config.defaultMaterial : this._main.materials[this._image.material]; const modelPosition = (0, $31054a6c69637582$exports).create(); const modelScale = this._core.getModelScale(); const modelRotation = (0, $39ece26d1239bb77$exports).create(); @@ -36125,7 +38142,6 @@ class $18e0078d8611e105$export$6f251cd327b2ff1 { time1: 1, size0: (0, $91b0cc4981465964$exports).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), size1: (0, $91b0cc4981465964$exports).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - material: material, texCoord0: imageQuad.texCoord0, texCoord1: imageQuad.texCoord1, rotation0: imageQuad.rotation, @@ -36145,8 +38161,7 @@ class $18e0078d8611e105$export$6f251cd327b2ff1 { center1: position, time0: 1, time1: 1, - radius: imageSphere.radius * boundsScaling, - material: material + radius: imageSphere.radius * boundsScaling }; this.hittable = new (0, $66964bfc3ddbcb4c$export$f44a85073ff35bb)(hittableSphereOptions); } @@ -36199,7 +38214,28 @@ class $b084cfc4223cd4fe$export$97e93e7019ef67b9 { const labelCount = this._labelSet.text.length; let glyphIndex = 0; for(let i = 0; i < labelCount; i++){ - const material = this._labelSet.material !== undefined ? this._main.materials[this._labelSet.material] : this._labelSet.materials ? this._main.materials[this._labelSet.materials[i]] : this._main.config.defaultTextMaterial; + const materialType = this._labelSet.materialType !== undefined ? this._labelSet.materialType : this._labelSet.materialTypes ? this._labelSet.materialTypes[i] : 0; + const materialColor = this._labelSet.materialColor ? this._labelSet.materialColor : this._labelSet.materialColors ? [ + this._labelSet.materialColors[i * 3], + this._labelSet.materialColors[i * 3 + 1], + this._labelSet.materialColors[i * 3 + 2] + ] : this._core.config.textColor; + const materialFuzz = this._labelSet.materialFuzz !== undefined ? this._labelSet.materialFuzz : this._labelSet.materialFuzzes ? this._labelSet.materialFuzzes[i] : 0; + const materialGloss = this._labelSet.materialGloss !== undefined ? this._labelSet.materialGloss : this._labelSet.materialGlosses ? this._labelSet.materialGlosses[i] : 0; + const segmentColor = this._labelSet.segmentColor ? this._labelSet.segmentColor : this._labelSet.segmentColors ? [ + this._labelSet.segmentColors[i * 4], + this._labelSet.segmentColors[i * 4 + 1], + this._labelSet.segmentColors[i * 4 + 2], + this._labelSet.segmentColors[i * 4 + 3] + ] : [ + 0, + 0, + 0, + 0 + ]; + materialColor[0] = Math.pow(materialColor[0], 2.2); + materialColor[1] = Math.pow(materialColor[1], 2.2); + materialColor[2] = Math.pow(materialColor[2], 2.2); const glyphCount = this._labelSet.text[i].length; for(let j = 0; j < glyphCount; j++){ (0, $0a0587bd8b0d58e8$export$74c3c25430a16442).getPosition(dataView, glyphIndex * 4 + 2, position0); @@ -36236,12 +38272,16 @@ class $b084cfc4223cd4fe$export$97e93e7019ef67b9 { time1: 1, size0: (0, $91b0cc4981465964$exports).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), size1: (0, $91b0cc4981465964$exports).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - material: material, texCoord0: texCoord0, texCoord1: texCoord1, rotation0: rotation, rotation1: rotation, - sdfBuffer: this._core.config.sdfBuffer + sdfBuffer: this._core.config.sdfBuffer, + materialType: materialType, + materialColor: materialColor, + materialFuzz: materialFuzz, + materialGloss: materialGloss, + segmentColor: segmentColor }; const hittable = new (0, $66964bfc3ddbcb4c$export$402b844452575dc9)(hittableFontOptions); this.hittables.push(hittable); @@ -36349,6 +38389,17 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex const previousUnitRotation = (0, $39ece26d1239bb77$exports).create(); const unitOrder = (0, $91b0cc4981465964$exports).create(); const transitionDuration = this._duration / (this._duration + this._stagger); + const rgb = [ + 0, + 0, + 0 + ]; + const rgba = [ + 0, + 0, + 0, + 0 + ]; for(let j = 0; j < currentBuffer.ids.length; j++){ (0, $0a0587bd8b0d58e8$export$849e31d725692576).getOrder(currentBuffer.dataView, j, unitOrder); const startTime = unitOrder[1] * (1 - transitionDuration); @@ -36391,20 +38442,25 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex const endTime = startTime + transitionDuration; const time0 = Math.min(Math.max((startTime - this._time0) / (this._time1 - this.time0), 0), 1); const time1 = Math.min(Math.max((endTime - this._time0) / (this._time1 - this.time0), 0), 1); - const materialId = (0, $0a0587bd8b0d58e8$export$849e31d725692576).getMaterial(currentBuffer.dataView, j); - const material = this._main.materials && this._main.materials.length > materialId ? this._main.materials[materialId] : this._main.config.defaultMaterial; let hittable; let unitTexCoord; switch(currentBuffer.unitType){ case (0, $4a6417d29706362f$export$80d48287646c9e3b).sphere: - case (0, $4a6417d29706362f$export$80d48287646c9e3b).sphereSdf: hittable = new (0, $66964bfc3ddbcb4c$export$f44a85073ff35bb)({ center0: unitTranslation0, center1: unitTranslation1, time0: time0, time1: time1, - radius: unitScale0[0], - material: material + radius: unitScale0[0] + }); + break; + case (0, $4a6417d29706362f$export$80d48287646c9e3b).sphereSdf: + hittable = new (0, $66964bfc3ddbcb4c$export$86630ee69b6c2fb)({ + center0: unitTranslation0, + center1: unitTranslation1, + time0: time0, + time1: time1, + radius: unitScale0[0] }); break; case (0, $4a6417d29706362f$export$80d48287646c9e3b).disk: @@ -36417,7 +38473,6 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex time1: time1, radius0: unitScale0[0], radius1: unitScale1[0], - material: material, texCoord0: (0, $91b0cc4981465964$exports).fromValues(unitTexCoord[0], unitTexCoord[3]), texCoord1: (0, $91b0cc4981465964$exports).fromValues(unitTexCoord[2], unitTexCoord[1]) }); @@ -36430,7 +38485,6 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex radius1: unitScale1[0], rotation0: unitRotation0, rotation1: unitRotation1, - material: material, texCoord0: (0, $91b0cc4981465964$exports).fromValues(unitTexCoord[0], unitTexCoord[3]), texCoord1: (0, $91b0cc4981465964$exports).fromValues(unitTexCoord[2], unitTexCoord[1]) }); @@ -36442,8 +38496,7 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex time0: time0, time1: time1, size0: unitScale0, - size1: unitScale1, - material: material + size1: unitScale1 }); else hittable = new (0, $66964bfc3ddbcb4c$export$acdc70fb29a0312b)({ center0: unitTranslation0, @@ -36453,8 +38506,7 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex size0: unitScale0, size1: unitScale1, rotation0: unitRotation0, - rotation1: unitRotation1, - material: material + rotation1: unitRotation1 }); break; case (0, $4a6417d29706362f$export$80d48287646c9e3b).sdf: @@ -36474,7 +38526,6 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex texCoord1: (0, $91b0cc4981465964$exports).fromValues(unitTexCoord[2], unitTexCoord[1]), rotation0: unitRotation0, rotation1: unitRotation1, - material: material, texId: texId, sdfBuffer: sdfBuffer, sdfBorder: sdfBorder @@ -36489,8 +38540,7 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex time1: time1, size0: unitScale0, size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material + rounding: Math.min(Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]) }); else hittable = new (0, $66964bfc3ddbcb4c$export$e349e1996fd043a1)({ center0: unitTranslation0, @@ -36500,7 +38550,6 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex size0: unitScale0, size1: unitScale1, rounding: Math.min(Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, rotation0: unitRotation0, rotation1: unitRotation1 }); @@ -36515,8 +38564,7 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex size1: unitScale1, angle0: (0, $0a0587bd8b0d58e8$export$849e31d725692576).getParameter1(currentBuffer.dataView, j), innerRadius0: (0, $0a0587bd8b0d58e8$export$849e31d725692576).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material + rounding: Math.min(Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]) }); else hittable = new (0, $66964bfc3ddbcb4c$export$2d4dbfe5a7e22bdf)({ center0: unitTranslation0, @@ -36528,11 +38576,22 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex angle0: (0, $0a0587bd8b0d58e8$export$849e31d725692576).getParameter1(currentBuffer.dataView, j), innerRadius0: (0, $0a0587bd8b0d58e8$export$849e31d725692576).getParameter2(currentBuffer.dataView, j), rounding: Math.min(Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, rotation0: unitRotation0, rotation1: unitRotation1 }); break; + case (0, $4a6417d29706362f$export$80d48287646c9e3b).tubeSdf: + hittable = new (0, $66964bfc3ddbcb4c$export$8c6d7438a2b5cc70)({ + center0: unitTranslation0, + center1: unitTranslation1, + time0: time0, + time1: time1, + innerRadius: unitScale0[0], + outerRadius: unitScale0[2], + height: unitScale0[1], + rounding: Math.min(Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]) + }); + break; case (0, $4a6417d29706362f$export$80d48287646c9e3b).cylinder: hittable = new (0, $66964bfc3ddbcb4c$export$cd2cb390b9add281)({ center0: unitTranslation0, @@ -36542,8 +38601,7 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex radius: unitScale0[0], height: unitScale0[1], rotation0: unitRotation0, - rotation1: unitRotation1, - material: material + rotation1: unitRotation1 }); break; case (0, $4a6417d29706362f$export$80d48287646c9e3b).cylinderSdf: @@ -36555,7 +38613,6 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex radius: unitScale0[0], height: unitScale0[1], rounding: Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material, rotation0: unitRotation0, rotation1: unitRotation1 }); @@ -36567,8 +38624,7 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex time0: time0, time1: time1, radius: unitScale0[0], - height: unitScale0[1], - material: material + height: unitScale0[1] }); break; case (0, $4a6417d29706362f$export$80d48287646c9e3b).hexPrismSdf: @@ -36579,18 +38635,39 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex time1: time1, radius: unitScale0[0], height: unitScale0[1], - rounding: Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material + rounding: Math.min(Math.min((0, $0a0587bd8b0d58e8$export$849e31d725692576).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]) }); break; } - if (hittable.material instanceof (0, $62116d012d21b949$export$87cc275e72e16d48)) this.hittables.push(new (0, $66964bfc3ddbcb4c$export$412c0ed39e393270)({ + hittable.materialType = (0, $0a0587bd8b0d58e8$export$849e31d725692576).getMatId(currentBuffer.dataView, j); + hittable.materialFuzz = (0, $0a0587bd8b0d58e8$export$849e31d725692576).getMatFuzz(currentBuffer.dataView, j); + hittable.materialRefractiveIndex = (0, $0a0587bd8b0d58e8$export$849e31d725692576).getMatRefractiveIndex(currentBuffer.dataView, j); + hittable.materialDensity = (0, $0a0587bd8b0d58e8$export$849e31d725692576).getMatDensity(currentBuffer.dataView, j); + hittable.materialGloss = (0, $0a0587bd8b0d58e8$export$849e31d725692576).getMatGloss(currentBuffer.dataView, j); + (0, $0a0587bd8b0d58e8$export$849e31d725692576).getMatColor(currentBuffer.dataView, j, rgb); + rgb[0] = Math.pow(rgb[0], 2.2); + rgb[1] = Math.pow(rgb[1], 2.2); + rgb[2] = Math.pow(rgb[2], 2.2); + hittable.materialColor = [ + rgb[0], + rgb[1], + rgb[2] + ]; + (0, $0a0587bd8b0d58e8$export$849e31d725692576).getSegColor(currentBuffer.dataView, j, rgba); + hittable.segmentColor = [ + rgba[0], + rgba[1], + rgba[2], + rgba[3] + ]; + if (hittable.materialType == (0, $62116d012d21b949$export$bd062416169c6728).isotropic) this.hittables.push(new (0, $66964bfc3ddbcb4c$export$412c0ed39e393270)({ boundary: hittable, center0: unitTranslation0, center1: unitTranslation1, time0: time0, time1: time1, - material: hittable.material + materialDensity: hittable.materialDensity, + materialColor: hittable.materialColor })); else this.hittables.push(hittable); this.minY = Math.min(hittable.bounds.min[1], this.minY); @@ -36610,6 +38687,7 @@ class $93345e9ee93b28fb$export$76de936b3c1c4170 extends (0, $96371271bb28b98d$ex $ca7af8634961ee25$export$a002182e51710d39.SHADOW_OFFSET = 0.001; + var $d5ed11dd11fe7749$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function(resolve) { @@ -36672,8 +38750,8 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._up = (0, $31054a6c69637582$exports).create(); this._forward = (0, $31054a6c69637582$exports).create(); this._modelPosition = (0, $31054a6c69637582$exports).create(); - this._manipulationOrigin = (0, $31054a6c69637582$exports).create(); - this._backgroundColor = (0, $4c4ac78b213a9c07$exports).fromValues(0, 0, 0, 1); + this._backgroundColor = (0, $4c4ac78b213a9c07$exports).create(); + this._ambientColor = (0, $31054a6c69637582$exports).create(); } initialize(core) { super.initialize(core); @@ -36698,8 +38776,24 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex } }; this._device = yield this._adapter.requestDevice(gpuDeviceDescriptor); + this._maxComputeWorkgroupsPerDimension = this._device.limits.maxComputeWorkgroupsPerDimension; this._queue = this._device.queue; this._context = this._canvas.getContext("webgpu"); + this._device.lost.then(()=>{ + this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).error, "GPU lost"); + this._core.stop(); + this._queue = null; + this._device = null; + this._adapter = null; + this._context = null; + this._initializeAPI().then(()=>{ + this._initializeResources(); + this._hasWorldChanged = true; + this._lightBuffer = null; + this._haveLightsChanged = true; + this._core.start(); + }); + }); this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `WebGPU API initialized ${Math.round(window.performance.now() - start)}ms`); } catch (e) { this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).error, e); @@ -36816,79 +38910,10 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex } } } - const materials = []; - const materialIds = []; - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - const material = hittable.material; - let materialId; - let found; - for(let j = 0; j < materials.length; j++)if (materials[j] === material) { - found = true; - materialId = j; - break; - } - if (!found) { - materialId = materials.length; - materials.push(material); - } - materialIds.push(materialId); - } const textures = []; - const textureIds = []; - for(let i = 0; i < materials.length; i++){ - const material = materials[i]; - const texture = material.texture; - if (texture) { - let textureId; - let found; - for(let j = 0; j < textures.length; j++)if (textures[j] === texture) { - found = true; - textureId = j; - break; - } - if (!found) { - textureId = textures.length; - textures.push(texture); - if (texture instanceof (0, $6060da1e598714a9$export$3ad126b3fdb68b5e)) { - const imageData = texture.image; - if (imageData) { - let start = performance.now(); - const imageDataLinear = new ImageData(imageData.width, imageData.height); - for(let i = 0; i < imageData.data.length; i++)imageDataLinear.data[i] = Math.pow(imageData.data[i] / 0xff, 2.2) * 0xff; - this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `image inverse gamma ${Math.round(window.performance.now() - start)}ms`); - start = window.performance.now(); - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageDataLinear).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._backgroundTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap, - flipY: true - }; - const imageCopyTextureTagged = { - texture: this._backgroundTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `background image updated ${Math.round(window.performance.now() - start)}ms`); - }); - } - } - } - textureIds.push(textureId); - } else textureIds.push(0); - } + if (textures.length == 0) textures.push(new (0, $6060da1e598714a9$export$b696913510b740d6)({ + color: (0, $31054a6c69637582$exports).fromValues(1, 1, 1) + })); const textureBufferSizeBytes = textures.length * (0, $6060da1e598714a9$export$6aa93a36bc90f68e).SIZE * 4; const textureBufferDescriptor = { label: "Texture buffer", @@ -36898,15 +38923,6 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._textureBuffer = this._device.createBuffer(textureBufferDescriptor); this._textureBufferData = new (0, $6060da1e598714a9$export$6aa93a36bc90f68e)(textures.length); for(let i = 0; i < textures.length; i++)textures[i].toBuffer(this._textureBufferData, i); - const materialBufferSizeBytes = materials.length * (0, $62116d012d21b949$export$673ddcc6bf213111).SIZE * 4; - const materialBufferDescriptor = { - label: "Material buffer", - size: materialBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._materialBuffer = this._device.createBuffer(materialBufferDescriptor); - this._materialBufferData = new (0, $62116d012d21b949$export$673ddcc6bf213111)(materials.length); - for(let i = 0; i < materials.length; i++)materials[i].toBuffer(this._materialBufferData, i, textureIds[i]); const hittableBufferSizeBytes = hittables.length * (0, $66964bfc3ddbcb4c$export$1337e9dd34ffc243).SIZE * 4; const hittableBufferDescriptor = { label: "Hittable buffer", @@ -36917,7 +38933,7 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._hittableBufferData = new (0, $66964bfc3ddbcb4c$export$1337e9dd34ffc243)(hittables.length); for(let i = 0; i < hittables.length; i++){ const hittable = hittables[i]; - hittable.toBuffer(this._hittableBufferData, i, materialIds[i]); + hittable.toBuffer(this._hittableBufferData, i); } const linearBVHNodes = bvhAccel.nodes; const linearBVHNodeBufferSizeBytes = linearBVHNodes.length * (0, $ee56e2b41e5e87b5$export$9e920ed4165673f5).SIZE * 4; @@ -36930,25 +38946,34 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._linearBVHNodeBufferData = new (0, $ee56e2b41e5e87b5$export$9e920ed4165673f5)(linearBVHNodes.length); for(let i = 0; i < linearBVHNodes.length; i++)linearBVHNodes[i].toBuffer(this._linearBVHNodeBufferData, i); this._device.queue.writeBuffer(this._hittableBuffer, 0, this._hittableBufferData.buffer, this._hittableBufferData.byteOffset, this._hittableBufferData.byteLength); - this._device.queue.writeBuffer(this._materialBuffer, 0, this._materialBufferData.buffer, this._materialBufferData.byteOffset, this._materialBufferData.byteLength); this._device.queue.writeBuffer(this._textureBuffer, 0, this._textureBufferData.buffer, this._textureBufferData.byteOffset, this._textureBufferData.byteLength); this._device.queue.writeBuffer(this._linearBVHNodeBuffer, 0, this._linearBVHNodeBufferData.buffer, this._linearBVHNodeBufferData.byteOffset, this._linearBVHNodeBufferData.byteLength); this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, `create world ${Math.round(window.performance.now() - start)}ms`); }); } _createLights() { - if (!this._lights || this._lights.length == 0) return; + if (!this._lights || this._lights.length == 0) { + const options = { + center: (0, $31054a6c69637582$exports).fromValues(0, 0, 0), + size: (0, $91b0cc4981465964$exports).fromValues(0, 0), + color: (0, $31054a6c69637582$exports).fromValues(0, 0, 0), + rotation: (0, $39ece26d1239bb77$exports).create() + }; + this._lights = [ + new (0, $1596feb7c9451159$export$1f9284d52f5c21ca)(options) + ]; + } const modelScale = this._core.getModelScale(); (0, $31054a6c69637582$exports).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); if (!this._lightBuffer) { - const lightBufferSizeBytes = this._lights.length * (0, $1596feb7c9451159$export$82650fd3490ceb3f).SIZE * 4; + const lightBufferSizeBytes = this._config.maxLights * (0, $1596feb7c9451159$export$82650fd3490ceb3f).SIZE * 4; const lightBufferDescriptor = { label: "Light buffer", size: lightBufferSizeBytes, usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST }; this._lightBuffer = this._device.createBuffer(lightBufferDescriptor); - this._lightBufferData = new (0, $1596feb7c9451159$export$82650fd3490ceb3f)(this._lights.length); + this._lightBufferData = new (0, $1596feb7c9451159$export$82650fd3490ceb3f)(this._config.maxLights); } for(let i = 0; i < this._lights.length; i++){ const light = this._lights[i]; @@ -37029,6 +39054,11 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex (0, $91b0cc4981465964$exports).scale(groundSize, this.ground.size || this._config.groundSize, modelScale); if (this.ground.position) (0, $31054a6c69637582$exports).scale(groundPosition, this.ground.position, modelScale); else (0, $31054a6c69637582$exports).set(groundPosition, 0, minY - (0, $ca7af8634961ee25$export$a002182e51710d39).SHADOW_OFFSET, 0); + const color = this.ground.color || [ + 0.5, + 0.5, + 0.5 + ]; const options = { size0: groundSize, size1: groundSize, @@ -37038,7 +39068,18 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex time1: 1, texCoord0: (0, $91b0cc4981465964$exports).fromValues(0, 0), texCoord1: (0, $91b0cc4981465964$exports).fromValues(1, 1), - material: this.ground.material || this.config.defaultMaterial + materialType: (0, $62116d012d21b949$export$bd062416169c6728).lambertian, + materialColor: [ + Math.pow(color[0], 2.2), + Math.pow(color[1], 2.2), + Math.pow(color[2], 2.2) + ], + segmentColor: [ + 0, + 0, + 0, + 0 + ] }; (0, $31054a6c69637582$exports).add(options.center0, options.center0, modelPosition); hittables.push(new (0, $66964bfc3ddbcb4c$export$57071e021ef37bbb)(options)); @@ -37086,7 +39127,7 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC }; const outputColorBuffer = this._device.createBuffer(outputColorBufferDescriptor); - const outputNormalDepthBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * 4; + const outputNormalDepthBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * (width + 1) * (height + 1) * 4; const outputDepthBufferDescriptor = { label: "Output normal depth buffer", size: outputNormalDepthBufferSizeBytes, @@ -37144,19 +39185,12 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex { binding: 6, visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 7, - visibility: GPUShaderStage.COMPUTE, sampler: { type: "filtering" } }, { - binding: 8, + binding: 7, visibility: GPUShaderStage.COMPUTE, texture: { multisampled: false, @@ -37165,7 +39199,7 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex } }, { - binding: 9, + binding: 8, visibility: GPUShaderStage.COMPUTE, texture: { multisampled: false, @@ -37174,7 +39208,7 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex } }, { - binding: 10, + binding: 9, visibility: GPUShaderStage.COMPUTE, texture: { multisampled: false, @@ -37183,14 +39217,14 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex } }, { - binding: 11, + binding: 10, visibility: GPUShaderStage.COMPUTE, buffer: { type: "storage" } }, { - binding: 12, + binding: 11, visibility: GPUShaderStage.COMPUTE, buffer: { type: "storage" @@ -37223,52 +39257,46 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex }, { binding: 3, - resource: { - buffer: this._materialBuffer - } - }, - { - binding: 4, resource: { buffer: this._textureBuffer } }, { - binding: 5, + binding: 4, resource: { buffer: this._lightBuffer } }, { - binding: 6, + binding: 5, resource: { buffer: this._linearBVHNodeBuffer } }, { - binding: 7, + binding: 6, resource: this._sampler }, { - binding: 8, + binding: 7, resource: (this.fonts[this._core.font.name].texture || this._texture).createView() }, { - binding: 9, + binding: 8, resource: (this._backgroundTexture || this._texture).createView() }, { - binding: 10, + binding: 9, resource: (this._atlasTexture || this._texture).createView() }, { - binding: 11, + binding: 10, resource: { buffer: outputNormalDepthBuffer } }, { - binding: 12, + binding: 11, resource: { buffer: this._depthMinMaxBuffer } @@ -37303,6 +39331,16 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex compute: computeDepthNormal }; this._computeDepthNormalPipeline = this._device.createComputePipeline(computeDepthNormalPipelineDescriptor); + const computeDepthNormalMultisampled = { + module: computeModule, + entryPoint: "depthNormalMultisampled" + }; + const computeDepthNormalMultisampledPipelineDescriptor = { + label: "Depth normal multisampled pipeline descriptor", + layout: computePipelineLayout, + compute: computeDepthNormalMultisampled + }; + this._computeDepthNormalMultisampledPipeline = this._device.createComputePipeline(computeDepthNormalMultisampledPipelineDescriptor); const computeSegment = { module: computeModule, entryPoint: "segment" @@ -37324,14 +39362,14 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex } }, { - binding: 11, + binding: 10, visibility: GPUShaderStage.COMPUTE, buffer: { type: "storage" } }, { - binding: 12, + binding: 11, visibility: GPUShaderStage.COMPUTE, buffer: { type: "storage" @@ -37351,13 +39389,13 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex } }, { - binding: 11, + binding: 10, resource: { buffer: outputNormalDepthBuffer } }, { - binding: 12, + binding: 11, resource: { buffer: this._depthMinMaxBuffer } @@ -37501,6 +39539,21 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex primitive: primitive }; this._fullscreenQuadDepthPipeline = this._device.createRenderPipeline(fullscreenQuadDepthPiplelineDescriptor); + const fragmentDepthMultisampled = { + module: fullscreenQuadModule, + entryPoint: "frag_depthMultisampled", + targets: [ + colorState + ] + }; + const fullscreenQuadDepthMultisampledPiplelineDescriptor = { + label: "Fullscreen quad depth multisampled pipeline descriptor", + layout: fullscreenQuadPipelineLayout, + vertex: vertex, + fragment: fragmentDepthMultisampled, + primitive: primitive + }; + this._fullscreenQuadDepthMultisampledPipeline = this._device.createRenderPipeline(fullscreenQuadDepthMultisampledPiplelineDescriptor); const fragmentNormal = { module: fullscreenQuadModule, entryPoint: "frag_normal", @@ -37516,6 +39569,21 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex primitive: primitive }; this._fullscreenQuadNormalPipeline = this._device.createRenderPipeline(fullscreenQuadNormalPiplelineDescriptor); + const fragmentNormalMultisampled = { + module: fullscreenQuadModule, + entryPoint: "frag_normalMultisampled", + targets: [ + colorState + ] + }; + const fullscreenQuadNormalMultisampledPiplelineDescriptor = { + label: "Fullscreen quad normal multisampled pipeline descriptor", + layout: fullscreenQuadPipelineLayout, + vertex: vertex, + fragment: fragmentNormalMultisampled, + primitive: primitive + }; + this._fullscreenQuadNormalMultisampledPipeline = this._device.createRenderPipeline(fullscreenQuadNormalMultisampledPiplelineDescriptor); const fragmentEdge = { module: fullscreenQuadModule, entryPoint: "frag_edge", @@ -37552,12 +39620,17 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._fullscreenQuadUniformBufferData.setHeight(height); this._computeUniformBufferData.setTime0(0); this._computeUniformBufferData.setTime1(1); - this._computeDispatchCount = Math.min(Math.ceil(width * height / 256), this._device.limits.maxComputeWorkgroupsPerDimension); this._frameCount = 0; this._core.log.write((0, $4a6417d29706362f$export$243e62d78d3b544d).info, "backings resized"); } update(elapsedTime) { super.update(elapsedTime); + if (this._core.config.renderMode != this._previousRenderMode) { + const isPreviousDepthNormal = this._previousRenderMode == (0, $4a6417d29706362f$export$2386c8c1d9db2d57).depth || this._previousRenderMode == (0, $4a6417d29706362f$export$2386c8c1d9db2d57).normal; + const isCurrentDepthNormal = this._core.config.renderMode == (0, $4a6417d29706362f$export$2386c8c1d9db2d57).depth || this._core.config.renderMode == (0, $4a6417d29706362f$export$2386c8c1d9db2d57).normal; + if (isPreviousDepthNormal != isCurrentDepthNormal) this.clear(); + this._previousRenderMode = this._core.config.renderMode; + } for(let i = 0; i < this.transitionBuffers.length; i++){ const transitionBuffer = this.transitionBuffers[i]; if (transitionBuffer.isVisible) { @@ -37597,6 +39670,10 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._frameCount = 0; this._computeUniformBufferData.setAperture(this._config.aperture); } + if (Math.abs(this._computeUniformBufferData.getFocusDistance() - this._config.focusDistance) > epsilon) { + this._frameCount = 0; + this._computeUniformBufferData.setFocusDistance(this._config.focusDistance); + } const m = this.inverseVMatrices[0]; this._computeUniformBufferData.getPosition(this._position); this._computeUniformBufferData.getRight(this._right); @@ -37613,15 +39690,18 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._computeUniformBufferData.setUp(this._up); this._computeUniformBufferData.setForward(this._forward); this._core.getModelPosition(this._modelPosition); - this._core.getModelManipulationOrigin(this._manipulationOrigin); - (0, $31054a6c69637582$exports).add(this._modelPosition, this._modelPosition, this._manipulationOrigin); this._computeUniformBufferData.setLookAt(this._modelPosition); } this._computeUniformBufferData.getBackgroundColor(this._backgroundColor); + this._computeUniformBufferData.getAmbientColor(this._ambientColor); if (!(0, $4c4ac78b213a9c07$exports).equals(this._backgroundColor, this._config.backgroundColor)) { this._frameCount = 0; this._computeUniformBufferData.setBackgroundColor(this._config.backgroundColor); } + if (!(0, $31054a6c69637582$exports).equals(this._ambientColor, this._config.ambientColor)) { + this._frameCount = 0; + this._computeUniformBufferData.setAmbientColor(this._config.ambientColor); + } this._tilesX = this._computeUniformBufferData.getTilesX(); this._tilesY = this._computeUniformBufferData.getTilesY(); this._tileOffsetX = this._computeUniformBufferData.getTileOffsetX(); @@ -37649,10 +39729,10 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex this._frameCount += raysPerFrame; this._fullscreenQuadUniformBufferData.setSamplesPerPixel(this._frameCount); this._fullscreenQuadUniformBufferData.setExposure(this._config.exposure); + this._fullscreenQuadUniformBufferData.setEdgeForeground(this._config.edgeForeground); + this._fullscreenQuadUniformBufferData.setEdgeBackground(this._config.edgeBackground); this._fullscreenQuadUniformBufferData.setMinDepth(this._config.minDepth); this._fullscreenQuadUniformBufferData.setMaxDepth(this._config.maxDepth); - this._fullscreenQuadUniformBufferData.setEdgeDepth(this._config.edgeDepth); - this._fullscreenQuadUniformBufferData.setEdgeNormal(this._config.edgeNormal); this._device.queue.writeBuffer(this._fullscreenQuadUniformBuffer, 0, this._fullscreenQuadUniformBufferData.buffer, this._fullscreenQuadUniformBufferData.byteOffset, this._fullscreenQuadUniformBufferData.byteLength); yield this._encodeCommands(clear); this._duration = performance.now() - this._startTime; @@ -37665,24 +39745,33 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex return $d5ed11dd11fe7749$var$__awaiter(this, void 0, void 0, function*() { const commandEncoder = this._device.createCommandEncoder(); const computePassEncoder = commandEncoder.beginComputePass(); + let computeDispatchCount; + switch(this._core.config.renderMode){ + case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).segment: + case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).edge: + computeDispatchCount = Math.min(Math.ceil((this.width + 1) * (this.height + 1) / 256), this._maxComputeWorkgroupsPerDimension); + break; + default: + computeDispatchCount = Math.min(Math.ceil(this.width * this.height / 256), this._maxComputeWorkgroupsPerDimension); + } if (clear) { computePassEncoder.setPipeline(this._clearPipeline); computePassEncoder.setBindGroup(0, this._clearBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); + computePassEncoder.dispatchWorkgroups(computeDispatchCount, 1, 1); } switch(this._core.config.renderMode){ case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).color: case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).hdr: computePassEncoder.setPipeline(this._computePipeline); computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); + computePassEncoder.dispatchWorkgroups(computeDispatchCount, 1, 1); computePassEncoder.end(); break; case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).depth: case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).normal: - computePassEncoder.setPipeline(this._computeDepthNormalPipeline); + computePassEncoder.setPipeline(this.config.isDepthMultisampled || this.config.isNormalMultisampled ? this._computeDepthNormalMultisampledPipeline : this._computeDepthNormalPipeline); computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); + computePassEncoder.dispatchWorkgroups(computeDispatchCount, 1, 1); computePassEncoder.end(); commandEncoder.copyBufferToBuffer(this._depthMinMaxBuffer, 0, this._depthMinMaxResultBuffer, 0, this._depthMinMaxResultBuffer.size); if (this._config.autoDepth) { @@ -37690,7 +39779,6 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex const depthMinMax = new Uint32Array(this._depthMinMaxResultBuffer.getMappedRange()); const depthMin = depthMinMax[0] / 1000; const depthMax = depthMinMax[1] / 1000; - if (this._config.minDepth != depthMin || this._config.maxDepth != depthMax) console.log('depthMinMax', depthMin, depthMax); this._config.minDepth = depthMin; this._config.maxDepth = depthMax; this._depthMinMaxResultBuffer.unmap(); @@ -37700,7 +39788,7 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).segment: computePassEncoder.setPipeline(this._computeSegmentPipeline); computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); + computePassEncoder.dispatchWorkgroups(computeDispatchCount, 1, 1); computePassEncoder.end(); break; } @@ -37729,10 +39817,10 @@ class $d5ed11dd11fe7749$export$861edd1ccea2f746 extends (0, $a123db7d2af0bebc$ex renderPassEncoder.setPipeline(this._fullscreenQuadHdrPipeline); break; case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).depth: - renderPassEncoder.setPipeline(this._fullscreenQuadDepthPipeline); + renderPassEncoder.setPipeline(this.config.isDepthMultisampled ? this._fullscreenQuadDepthMultisampledPipeline : this._fullscreenQuadDepthPipeline); break; case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).normal: - renderPassEncoder.setPipeline(this._fullscreenQuadNormalPipeline); + renderPassEncoder.setPipeline(this.config.isNormalMultisampled ? this._fullscreenQuadNormalMultisampledPipeline : this._fullscreenQuadNormalPipeline); break; case (0, $4a6417d29706362f$export$2386c8c1d9db2d57).edge: renderPassEncoder.setPipeline(this._fullscreenQuadEdgePipeline); @@ -37767,7 +39855,7 @@ class $6fc486c90d5a34f3$export$c6957adcf93c393f { if (options) { this.position = options.position; this.size = options.size; - this.material = options.material; + this.color = options.color; } } } @@ -43622,41 +45710,207 @@ function $baf9c68afdd76912$export$c25acd513dcc8062(props) { /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. -*/ var $c0a1d2df3eff3893$exports = {}; -"use strict"; +*/ /*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ /*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ /*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ const $1bd1c9b4aadcc080$export$d4a30c86ebfe9b93 = 20; +class $1bd1c9b4aadcc080$export$a4585e6c8aa63810 { + constructor(columns, data){} +} +function $1bd1c9b4aadcc080$export$1ce96159c3ba4e5a(c) { + if (c.quantitative) return 'redyellowgreen'; + else if (c.stats.distinctValueCount === 2) return 'dual_redgreen'; + else if (c.stats.distinctValueCount <= 10) return 'category10'; + return 'category20'; +} + + +const $1b33c7f022f96886$var$maxDistinctVal = 20; +const $1b33c7f022f96886$var$minDistinctVal = 2; +class $1b33c7f022f96886$export$3f3e73d6f76170d5 { + constructor(columns, data){ + let score = -1; + for(let i = 0; i < columns.length; i++){ + const recommendation = new $1b33c7f022f96886$export$63cf70b2e8d83b38(columns[i], data).recommend(); + if (recommendation.score > score) { + this.best = recommendation; + score = recommendation.score; + } + if (score === 1) break; + } + for(let k = 0; k < columns.length; k++){ + const column = columns[k]; + if (column.name === this.best.columns.x || column.stats.isSequential) continue; + if (column.quantitative || column.stats.distinctValueCount < (0, $1bd1c9b4aadcc080$export$d4a30c86ebfe9b93) && column.stats.distinctValueCount > 1) { + this.best.columns.color = this.best.columns.sort = column.name; + this.best.scheme = (0, $1bd1c9b4aadcc080$export$1ce96159c3ba4e5a)(column); + if (column.quantitative) this.best.colorBin = 'quantile'; + break; + } + } + } + recommend() { + return this.best; + } +} +class $1b33c7f022f96886$export$63cf70b2e8d83b38 { + constructor(column, data){ + this.score = 0; + this.column = column; + //the total score for bar chart is 1 + this.rules = [ + (column)=>{ + if (column.stats.isSequential) return false; + else if (column.quantitative) return true; + else if (!column.quantitative && column.stats.distinctValueCount <= $1b33c7f022f96886$var$maxDistinctVal && column.stats.distinctValueCount >= $1b33c7f022f96886$var$minDistinctVal) return true; + else return false; + } + ]; + for(let i = 0; i < this.rules.length; i++)if (this.rules[i](column)) this.score++; + } + recommend() { + const rec = { + chart: 'barchart', + columns: { + x: this.column.name + }, + score: this.score, + scheme: undefined, + view: '2d' + }; + return rec; + } +} + + +/*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ //TODO: languages other than english +const $c0be89b17d0e5664$var$longitudeNames = [ + 'lon', + 'long', + 'longitude' +]; +const $c0be89b17d0e5664$var$latitudeNames = [ + 'lat', + 'latitude' +]; +function $c0be89b17d0e5664$var$isSpec(names, limits, column, data) { + let is = false; + const cname = column.name.toLowerCase(); + for(let i = 0; i < names.length; i++)if (names[i] === cname) { + is = true; + break; + } + data; + return is; +} +function $c0be89b17d0e5664$export$b0e111396640b96e(column, data) { + return $c0be89b17d0e5664$var$isSpec($c0be89b17d0e5664$var$longitudeNames, [ + -180, + 180 + ], column, data); +} +function $c0be89b17d0e5664$export$bf99c8928a43a542(column, data) { + return $c0be89b17d0e5664$var$isSpec($c0be89b17d0e5664$var$latitudeNames, [ + -90, + 90 + ], column, data); +} +function $c0be89b17d0e5664$export$e66a5fd74bbd95cc(column, data) { + return $c0be89b17d0e5664$export$bf99c8928a43a542(column, data) || $c0be89b17d0e5664$export$b0e111396640b96e(column, data); +} + + /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. -*/ var $c0a1d2df3eff3893$var$__createBinding = $c0a1d2df3eff3893$exports && $c0a1d2df3eff3893$exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = { - enumerable: true, - get: function() { - return m[k]; +*/ + +class $73347858f569d476$export$15d95472a5608ce4 { + constructor(columns, data){ + const rec = { + chart: 'scatterplot', + score: undefined, + columns: {}, + scheme: undefined, + view: '2d' + }; + columns.forEach((column)=>{ + if (!rec.columns.x) { + if (column.name.toLowerCase() === 'x') return rec.columns.x = column.name; + else if ((0, $c0be89b17d0e5664$export$b0e111396640b96e)(column)) return rec.columns.x = column.name; + } + if (!rec.columns.y) { + if (column.name.toLowerCase() === 'y') return rec.columns.y = column.name; + else if ((0, $c0be89b17d0e5664$export$bf99c8928a43a542)(column)) return rec.columns.y = column.name; + } + if (!rec.columns.color && !column.stats.isSequential) { + if (column.quantitative || column.stats.distinctValueCount < (0, $1bd1c9b4aadcc080$export$d4a30c86ebfe9b93)) { + rec.columns.color = rec.columns.sort = column.name; + rec.scheme = (0, $1bd1c9b4aadcc080$export$1ce96159c3ba4e5a)(column); + if (column.quantitative) rec.colorBin = 'quantile'; + return; + } + } + }); + if (rec.columns.x && rec.columns.y) this.best = rec; + } + recommend() { + return this.best; + } +} + + +/*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ +function $2231af94bc7593e4$export$29f7204f5c690e43(columns, strict) { + for(let i = 0; i < columns.length; i++){ + const c = columns[i]; + if (c.quantitative) { + if (strict && c.stats.hasNegative) continue; + if (strict && c.stats.isSequential) continue; + if (strict && (0, $c0be89b17d0e5664$export$e66a5fd74bbd95cc)(c)) continue; + return c; } - }; - Object.defineProperty(o, k2, desc); -} : function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); -var $c0a1d2df3eff3893$var$__exportStar = $c0a1d2df3eff3893$exports && $c0a1d2df3eff3893$exports.__exportStar || function(m, exports1) { - for(var p in m)if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports1, p)) $c0a1d2df3eff3893$var$__createBinding(exports1, m, p); -}; -Object.defineProperty($c0a1d2df3eff3893$exports, "__esModule", { - value: true -}); + } +} -$c0a1d2df3eff3893$var$__exportStar((parcelRequire("2FnuA")), $c0a1d2df3eff3893$exports); -$c0a1d2df3eff3893$var$__exportStar((parcelRequire("bvDTm")), $c0a1d2df3eff3893$exports); +/*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ -$c0a1d2df3eff3893$var$__exportStar((parcelRequire("7Kus9")), $c0a1d2df3eff3893$exports); +class $431d9b72caa01089$export$28206cc98a74452 { + constructor(columns, data){ + const quickRec = new (0, $73347858f569d476$export$15d95472a5608ce4)(columns, data).recommend(); + if (quickRec) this.rec = quickRec; + else { + const barChartrec = new (0, $1b33c7f022f96886$export$3f3e73d6f76170d5)(columns, data).recommend(); + if (barChartrec && barChartrec.score >= 1) this.rec = barChartrec; + else this.rec = { + chart: 'grid', + columns: {}, + score: 1 + }; + } + } + recommend() { + return this.rec; + } +} -$c0a1d2df3eff3893$var$__exportStar((parcelRequire("lSaje")), $c0a1d2df3eff3893$exports); -$c0a1d2df3eff3893$var$__exportStar((parcelRequire("b7pOC")), $c0a1d2df3eff3893$exports); @@ -43729,8 +45983,8 @@ function $cdd6162a40e9c08a$export$c2563952d877899(chart, totalStyle, insightColu } } function $cdd6162a40e9c08a$export$7e0d3b5c6570ae8b(columns) { - let column = (0, $c0a1d2df3eff3893$exports.preferredColumnForTreemapSize)(columns, true); - if (!column) column = (0, $c0a1d2df3eff3893$exports.preferredColumnForTreemapSize)(columns, false); + let column = (0, $2231af94bc7593e4$export$29f7204f5c690e43)(columns, true); + if (!column) column = (0, $2231af94bc7593e4$export$29f7204f5c690e43)(columns, false); return column; } function $cdd6162a40e9c08a$export$3351a8d90bcc13aa(insight, columns) { @@ -44544,7 +46798,7 @@ const $0edfbb46d4822ac6$export$12df67f310f5f846 = $0edfbb46d4822ac6$var$_ColumnT <body> <script src="https://unpkg.com/react@17/umd/react.production.min.js"></script> <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> - <script src="https://unpkg.com/vega@5.32/build/vega.min.js"></script> + <script src="https://unpkg.com/vega@6.2/build/vega.min.js"></script> <script src="https://unpkg.com/@fluentui/react@8/dist/fluentui-react.js"></script> <script src="https://unpkg.com/@msrvida/fluentui-icons@1/dist/umd/fluentui-icons.js"></script> <script src="https://unpkg.com/@msrvida/sanddance-explorer@4/dist/umd/sanddance-explorer.js"></script> @@ -45525,15 +47779,20 @@ function $7c89aab16f679c36$var$_Search(_props) { const groups = [ ...this.state.groups ]; - const group = groups[groupIndex]; - const maxKey = group.expressions.reduce((max, p)=>p.key > max ? p.key : max, group.expressions[0].key); + const group = Object.assign({}, groups[groupIndex]); + const expressions = [ + ...group.expressions + ]; + const maxKey = expressions.reduce((max, p)=>p.key > max ? p.key : max, expressions[0].key); const newEx = this.newExpression(maxKey + 1, '&&'); - group.expressions.push(newEx); - if (group.expressions.length === 2) newEx.unlocked = true; + expressions.push(newEx); + if (expressions.length === 2) newEx.unlocked = true; else { - group.expressions.forEach((ex)=>ex.unlocked = false); - newEx.clause = group.expressions[1].clause; + expressions.forEach((ex)=>ex.unlocked = false); + newEx.clause = expressions[1].clause; } + group.expressions = expressions; + groups[groupIndex] = group; this.setState({ groups: groups }); @@ -45542,24 +47801,29 @@ function $7c89aab16f679c36$var$_Search(_props) { const groups = [ ...this.state.groups ]; - const group = groups[groupIndex]; - const ex = (0, $1342cf7df79546f0$exports).VegaMorphCharts.util.clone(group.expressions[index]); - if (ex.name !== partialEx.name) { + const group = Object.assign({}, groups[groupIndex]); + const expressions = [ + ...group.expressions + ]; + const currentEx = expressions[index]; + if (currentEx.name !== partialEx.name) { //choose an appropriate operator when switching data type - const oldColumn = $7c89aab16f679c36$var$getColumnWithName(ex.name, this.state.sortedColumns); + const oldColumn = $7c89aab16f679c36$var$getColumnWithName(currentEx.name, this.state.sortedColumns); const newColumn = $7c89aab16f679c36$var$getColumnWithName(partialEx.name, this.state.sortedColumns); const oldType = oldColumn && oldColumn.type; const newType = newColumn && newColumn.type; if (oldType !== newType) { const newOperators = (0, $420fc835a380b3a6$export$c2b32f315f251228)(newColumn).map((validOperator)=>validOperator[0]); //see if old operator is compatible - if (newOperators.indexOf(ex.operator) < 0) //not compatible, so choose "equal" + if (newOperators.indexOf(currentEx.operator) < 0) //not compatible, so choose "equal" partialEx.operator = '=='; } } - Object.assign(ex, partialEx); + const ex = Object.assign(Object.assign({}, currentEx), partialEx); $7c89aab16f679c36$var$clearExpressionValidation(ex); - group.expressions[index] = ex; + expressions[index] = ex; + group.expressions = expressions; + groups[groupIndex] = group; this.setState({ groups: groups }); @@ -45568,13 +47832,14 @@ function $7c89aab16f679c36$var$_Search(_props) { const groups = [ ...this.state.groups ]; - const group = groups[groupIndex]; + const group = Object.assign({}, groups[groupIndex]); const expressions = [ ...group.expressions ]; expressions.splice(index, 1); if (expressions.length === 2) expressions[1].unlocked = true; group.expressions = expressions; + groups[groupIndex] = group; this.setState({ groups: groups }); @@ -52515,7 +54780,7 @@ function $688b2ed8e5aa6452$var$_Explorer(_props) { } if (!partialInsight) { //load recommendation - const r = new (0, $c0a1d2df3eff3893$exports.RecommenderSummary)(dataContent.columns, dataContent.data); + const r = new (0, $431d9b72caa01089$export$28206cc98a74452)(dataContent.columns, dataContent.data); partialInsight = r.recommend(); } partialInsight = Object.assign({ diff --git a/docs/dist/sanddance/v4/sanddance.js b/docs/dist/sanddance/v4/sanddance.js index c0085d793..dc53ba8e0 100644 --- a/docs/dist/sanddance/v4/sanddance.js +++ b/docs/dist/sanddance/v4/sanddance.js @@ -4,21 +4,6 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SandDance = {})); })(this, (function (exports) { 'use strict'; - function _mergeNamespaces(n, m) { - m.forEach(function (e) { - e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { - if (k !== 'default' && !(k in n)) { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - }); - return Object.freeze(n); - } - /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. @@ -5350,7 +5335,7 @@ * Licensed under the MIT License. */ - var index$4 = /*#__PURE__*/Object.freeze({ + var index$2 = /*#__PURE__*/Object.freeze({ __proto__: null, ColorScaleNone: ColorScaleNone, FieldNames: FieldNames, @@ -5715,7 +5700,7 @@ * Licensed under the MIT License. */ - var index$3 = /*#__PURE__*/Object.freeze({ + var index$1 = /*#__PURE__*/Object.freeze({ __proto__: null, Exec: Exec, compare: compare, @@ -5738,252 +5723,7 @@ __proto__: null }); - function getDefaultExportFromCjs (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - var require$$0$1 = [ - "a", - "abbr", - "address", - "area", - "article", - "aside", - "audio", - "b", - "base", - "bdi", - "bdo", - "blockquote", - "body", - "br", - "button", - "canvas", - "caption", - "cite", - "code", - "col", - "colgroup", - "data", - "datalist", - "dd", - "del", - "details", - "dfn", - "dialog", - "div", - "dl", - "dt", - "em", - "embed", - "fieldset", - "figcaption", - "figure", - "footer", - "form", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hgroup", - "hr", - "html", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "legend", - "li", - "link", - "main", - "map", - "mark", - "math", - "menu", - "menuitem", - "meta", - "meter", - "nav", - "noscript", - "object", - "ol", - "optgroup", - "option", - "output", - "p", - "param", - "picture", - "pre", - "progress", - "q", - "rb", - "rp", - "rt", - "rtc", - "ruby", - "s", - "samp", - "script", - "section", - "select", - "slot", - "small", - "source", - "span", - "strong", - "style", - "sub", - "summary", - "sup", - "svg", - "table", - "tbody", - "td", - "template", - "textarea", - "tfoot", - "th", - "thead", - "time", - "title", - "tr", - "track", - "u", - "ul", - "var", - "video", - "wbr" - ]; - - var htmlTags$1; - var hasRequiredHtmlTags; - - function requireHtmlTags () { - if (hasRequiredHtmlTags) return htmlTags$1; - hasRequiredHtmlTags = 1; - htmlTags$1 = require$$0$1; - return htmlTags$1; - } - - var htmlTagsExports = requireHtmlTags(); - var index$2 = /*@__PURE__*/getDefaultExportFromCjs(htmlTagsExports); - - var htmlTags = /*#__PURE__*/_mergeNamespaces({ - __proto__: null, - default: index$2 - }, [htmlTagsExports]); - - var require$$0 = [ - "a", - "altGlyph", - "altGlyphDef", - "altGlyphItem", - "animate", - "animateColor", - "animateMotion", - "animateTransform", - "circle", - "clipPath", - "color-profile", - "cursor", - "defs", - "desc", - "ellipse", - "feBlend", - "feColorMatrix", - "feComponentTransfer", - "feComposite", - "feConvolveMatrix", - "feDiffuseLighting", - "feDisplacementMap", - "feDistantLight", - "feFlood", - "feFuncA", - "feFuncB", - "feFuncG", - "feFuncR", - "feGaussianBlur", - "feImage", - "feMerge", - "feMergeNode", - "feMorphology", - "feOffset", - "fePointLight", - "feSpecularLighting", - "feSpotLight", - "feTile", - "feTurbulence", - "filter", - "font", - "font-face", - "font-face-format", - "font-face-name", - "font-face-src", - "font-face-uri", - "foreignObject", - "g", - "glyph", - "glyphRef", - "hkern", - "image", - "line", - "linearGradient", - "marker", - "mask", - "metadata", - "missing-glyph", - "mpath", - "path", - "pattern", - "polygon", - "polyline", - "radialGradient", - "rect", - "script", - "set", - "stop", - "style", - "svg", - "switch", - "symbol", - "text", - "textPath", - "title", - "tref", - "tspan", - "use", - "view", - "vkern" - ]; - - var lib; - var hasRequiredLib; - - function requireLib () { - if (hasRequiredLib) return lib; - hasRequiredLib = 1; - lib = require$$0; - return lib; - } - - var libExports = requireLib(); - var index$1 = /*@__PURE__*/getDefaultExportFromCjs(libExports); - - var svgTags = /*#__PURE__*/_mergeNamespaces({ - __proto__: null, - default: index$1 - }, [libExports]); - - const htmlTagArray = index$2 || htmlTags; - const svgTagArray = index$1 || svgTags; + const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; /** * Decamelizes a string with/without a custom separator (hyphen by default). * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript @@ -6000,12 +5740,18 @@ function createElement(tag, attrs, ...children) { if (typeof tag === 'function') { const fn = tag; - const props = attrs; - props.children = children; + let props = attrs; + // Handle case where props is null but children are provided + if (props === null || props === undefined) { + props = { children }; + } + else { + props.children = children; + } return fn(props); } else { - const ns = tagNamespace(tag); + const ns = (tag === 'svg') ? SVG_NAMESPACE : null; const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); const map = attrs; let ref; @@ -6061,6 +5807,44 @@ arr.push(`${decamelize(prop, '-')}:${o[prop]}`); return arr.join(';'); } + function isInsideForeignObject(element) { + let current = element; + while (current) { + if (current.tagName.toLowerCase() === 'foreignobject') { + return true; + } + current = current.parentElement; + } + return false; + } + function recreateWithSvgNamespace(element) { + const svgElement = document.createElementNS(SVG_NAMESPACE, element.tagName.toLowerCase()); + // Copy attributes + for (let i = 0; i < element.attributes.length; i++) { + const attr = element.attributes[i]; + svgElement.setAttributeNS(null, attr.name, attr.value); + } + // Copy event handlers and other properties + // Common event handlers that need to be copied + const eventProperties = ['onclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', + 'onmousemove', 'onkeydown', 'onkeyup', 'onkeypress', 'onfocus', 'onblur']; + for (const prop of eventProperties) { + if (element[prop]) { + svgElement[prop] = element[prop]; + } + } + // Copy children recursively + for (let i = 0; i < element.childNodes.length; i++) { + const child = element.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) { + svgElement.appendChild(recreateWithSvgNamespace(child)); + } + else { + svgElement.appendChild(child.cloneNode(true)); + } + } + return svgElement; + } function addChild(parentElement, child) { if (child === null || child === undefined || typeof child === "boolean") { return; @@ -6069,7 +5853,19 @@ appendChildren(parentElement, child); } else if (isElement(child)) { - parentElement.appendChild(child); + const childEl = child; + // If parent is SVG and child was created with wrong namespace, recreate it + // Exception: don't recreate elements inside foreignObject as they should remain HTML + if (parentElement.namespaceURI === SVG_NAMESPACE && + childEl.namespaceURI !== SVG_NAMESPACE && + childEl.tagName.toLowerCase() !== 'foreignobject' && + !isInsideForeignObject(parentElement)) { + const recreated = recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } + else { + parentElement.appendChild(childEl); + } } else { parentElement.appendChild(document.createTextNode(child.toString())); @@ -6138,12 +5934,6 @@ childPosition++; return childPosition; } - function tagNamespace(tag) { - //issue: this won't disambiguate certain tags which exist in both svg and html: <a>, <title> ... - if (tag === 'svg' || (svgTagArray.indexOf(tag) >= 0 && !(htmlTagArray.indexOf(tag) >= 0))) { - return "http://www.w3.org/2000/svg"; - } - } /*! * Copyright (c) Microsoft Corporation. @@ -6180,28 +5970,19 @@ * Common utilities * @module glMatrix */ + // Configuration Constants var EPSILON = 0.000001; - var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; + var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + /** * Sets the type of array used when creating new vectors and matrices * * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array */ - function setMatrixArrayType(type) { ARRAY_TYPE = type; } - if (!Math.hypot) Math.hypot = function () { - var y = 0, - i = arguments.length; - - while (i--) { - y += arguments[i] * arguments[i]; - } - - return Math.sqrt(y); - }; /** * 3x3 Matrix @@ -6213,10 +5994,8 @@ * * @returns {mat3} a new 3x3 matrix */ - function create$5() { var out = new ARRAY_TYPE(9); - if (ARRAY_TYPE != Float32Array) { out[1] = 0; out[2] = 0; @@ -6225,12 +6004,12 @@ out[6] = 0; out[7] = 0; } - out[0] = 1; out[4] = 1; out[8] = 1; return out; } + /** * Copies the upper-left 3x3 values into the given mat3. * @@ -6238,7 +6017,6 @@ * @param {ReadonlyMat4} a the source 4x4 matrix * @returns {mat3} out */ - function fromMat4(out, a) { out[0] = a[0]; out[1] = a[1]; @@ -6251,6 +6029,7 @@ out[8] = a[10]; return out; } + /** * Create a new mat3 with the given values * @@ -6265,7 +6044,6 @@ * @param {Number} m22 Component in column 2, row 2 position (index 8) * @returns {mat3} A new mat3 */ - function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { var out = new ARRAY_TYPE(9); out[0] = m00; @@ -6279,6 +6057,7 @@ out[8] = m22; return out; } + /** * Calculates a 3x3 matrix from the given quaternion * @@ -6287,12 +6066,11 @@ * * @returns {mat3} out */ - function fromQuat$1(out, q) { var x = q[0], - y = q[1], - z = q[2], - w = q[3]; + y = q[1], + z = q[2], + w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; @@ -6327,10 +6105,8 @@ * * @returns {mat4} a new 4x4 matrix */ - function create$4() { var out = new ARRAY_TYPE(16); - if (ARRAY_TYPE != Float32Array) { out[1] = 0; out[2] = 0; @@ -6345,13 +6121,13 @@ out[13] = 0; out[14] = 0; } - out[0] = 1; out[5] = 1; out[10] = 1; out[15] = 1; return out; } + /** * Copy the values from one mat4 to another * @@ -6359,7 +6135,6 @@ * @param {ReadonlyMat4} a the source matrix * @returns {mat4} out */ - function copy$5(out, a) { out[0] = a[0]; out[1] = a[1]; @@ -6379,6 +6154,7 @@ out[15] = a[15]; return out; } + /** * Create a new mat4 with the given values * @@ -6400,7 +6176,6 @@ * @param {Number} m33 Component in column 3, row 3 position (index 15) * @returns {mat4} A new mat4 */ - function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { var out = new ARRAY_TYPE(16); out[0] = m00; @@ -6421,13 +6196,13 @@ out[15] = m33; return out; } + /** * Set a mat4 to the identity matrix * * @param {mat4} out the receiving matrix * @returns {mat4} out */ - function identity$2(out) { out[0] = 1; out[1] = 0; @@ -6447,31 +6222,31 @@ out[15] = 1; return out; } + /** * Inverts a mat4 * * @param {mat4} out the receiving matrix * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out + * @returns {mat4 | null} out, or null if source matrix is not invertible */ - function invert(out, a) { var a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3]; + a01 = a[1], + a02 = a[2], + a03 = a[3]; var a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7]; + a11 = a[5], + a12 = a[6], + a13 = a[7]; var a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; + a21 = a[9], + a22 = a[10], + a23 = a[11]; var a30 = a[12], - a31 = a[13], - a32 = a[14], - a33 = a[15]; + a31 = a[13], + a32 = a[14], + a33 = a[15]; var b00 = a00 * a11 - a01 * a10; var b01 = a00 * a12 - a02 * a10; var b02 = a00 * a13 - a03 * a10; @@ -6483,14 +6258,13 @@ var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant + var b11 = a22 * a33 - a23 * a32; + // Calculate the determinant var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) { return null; } - det = 1.0 / det; out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; @@ -6510,6 +6284,7 @@ out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; return out; } + /** * Multiplies two mat4s * @@ -6518,29 +6293,29 @@ * @param {ReadonlyMat4} b the second operand * @returns {mat4} out */ - function multiply$2(out, a, b) { var a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3]; + a01 = a[1], + a02 = a[2], + a03 = a[3]; var a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7]; + a11 = a[5], + a12 = a[6], + a13 = a[7]; var a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; + a21 = a[9], + a22 = a[10], + a23 = a[11]; var a30 = a[12], - a31 = a[13], - a32 = a[14], - a33 = a[15]; // Cache only the current line of the second matrix + a31 = a[13], + a32 = a[14], + a33 = a[15]; + // Cache only the current line of the second matrix var b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3]; + b1 = b[1], + b2 = b[2], + b3 = b[3]; out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; @@ -6571,6 +6346,7 @@ out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; return out; } + /** * Translate a mat4 by the given vector * @@ -6579,15 +6355,13 @@ * @param {ReadonlyVec3} v vector to translate by * @returns {mat4} out */ - function translate(out, a, v) { var x = v[0], - y = v[1], - z = v[2]; + y = v[1], + z = v[2]; var a00, a01, a02, a03; var a10, a11, a12, a13; var a20, a21, a22, a23; - if (a === out) { out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; @@ -6623,9 +6397,9 @@ out[14] = a02 * x + a12 * y + a22 * z + a[14]; out[15] = a03 * x + a13 * y + a23 * z + a[15]; } - return out; } + /** * Scales the mat4 by the dimensions in the given vec3 not using vectorization * @@ -6634,11 +6408,10 @@ * @param {ReadonlyVec3} v the vec3 to scale the matrix by * @returns {mat4} out **/ - function scale$1(out, a, v) { var x = v[0], - y = v[1], - z = v[2]; + y = v[1], + z = v[2]; out[0] = a[0] * x; out[1] = a[1] * x; out[2] = a[2] * x; @@ -6657,6 +6430,7 @@ out[15] = a[15]; return out; } + /** * Creates a matrix from a vector scaling * This is equivalent to (but much faster than): @@ -6668,7 +6442,6 @@ * @param {ReadonlyVec3} v Scaling vector * @returns {mat4} out */ - function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; @@ -6688,30 +6461,30 @@ out[15] = 1; return out; } + /** * Creates a matrix from a quaternion rotation, vector translation and vector scale * This is equivalent to (but much faster than): * * mat4.identity(dest); - * mat4.translate(dest, vec); + * mat4.translate(dest, dest, vec); * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) + * mat4.fromQuat(quatMat, quat); + * mat4.multiply(dest, dest, quatMat); + * mat4.scale(dest, dest, scale) * * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion + * @param {quat} q Rotation quaternion * @param {ReadonlyVec3} v Translation vector * @param {ReadonlyVec3} s Scaling vector * @returns {mat4} out */ - function fromRotationTranslationScale(out, q, v, s) { // Quaternion math var x = q[0], - y = q[1], - z = q[2], - w = q[3]; + y = q[1], + z = q[2], + w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; @@ -6745,33 +6518,33 @@ out[15] = 1; return out; } + /** * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin * This is equivalent to (but much faster than): * * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); + * mat4.translate(dest, dest, vec); + * mat4.translate(dest, dest, origin); * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); + * mat4.fromQuat(quatMat, quat); + * mat4.multiply(dest, dest, quatMat); + * mat4.scale(dest, dest, scale) + * mat4.translate(dest, dest, negativeOrigin); * * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion + * @param {quat} q Rotation quaternion * @param {ReadonlyVec3} v Translation vector * @param {ReadonlyVec3} s Scaling vector * @param {ReadonlyVec3} o The origin vector around which to scale and rotate * @returns {mat4} out */ - function fromRotationTranslationScaleOrigin(out, q, v, s, o) { // Quaternion math var x = q[0], - y = q[1], - z = q[2], - w = q[3]; + y = q[1], + z = q[2], + w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; @@ -6817,6 +6590,7 @@ out[15] = 1; return out; } + /** * Calculates a 4x4 matrix from the given quaternion * @@ -6825,12 +6599,11 @@ * * @returns {mat4} out */ - function fromQuat(out, q) { var x = q[0], - y = q[1], - z = q[2], - w = q[3]; + y = q[1], + z = q[2], + w = q[3]; var x2 = x + x; var y2 = y + y; var z2 = z + z; @@ -6861,6 +6634,7 @@ out[15] = 1; return out; } + /** * Generates a frustum matrix with the given bounds * @@ -6873,7 +6647,6 @@ * @param {Number} far Far bound of the frustum * @returns {mat4} out */ - function frustum(out, left, right, bottom, top, near, far) { var rl = 1 / (right - left); var tb = 1 / (top - bottom); @@ -6896,6 +6669,7 @@ out[15] = 0; return out; } + /** * Generates a perspective projection matrix with the given bounds. * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], @@ -6909,10 +6683,8 @@ * @param {number} far Far bound of the frustum, can be null or Infinity * @returns {mat4} out */ - function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), - nf; + var f = 1.0 / Math.tan(fovy / 2); out[0] = f / aspect; out[1] = 0; out[2] = 0; @@ -6927,24 +6699,23 @@ out[12] = 0; out[13] = 0; out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); + var nf = 1 / (near - far); out[10] = (far + near) * nf; out[14] = 2 * far * near * nf; } else { out[10] = -1; out[14] = -2 * near; } - return out; } + /** * Alias for {@link mat4.perspectiveNO} * @function */ - var perspective = perspectiveNO; + /** * Generates a look-at matrix with the given eye position, focal point, and up axis. * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. @@ -6955,7 +6726,6 @@ * @param {ReadonlyVec3} up vec3 pointing up * @returns {mat4} out */ - function lookAt(out, eye, center, up) { var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; var eyex = eye[0]; @@ -6967,23 +6737,20 @@ var centerx = center[0]; var centery = center[1]; var centerz = center[2]; - if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) { return identity$2(out); } - z0 = eyex - centerx; z1 = eyey - centery; z2 = eyez - centerz; - len = 1 / Math.hypot(z0, z1, z2); + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); z0 *= len; z1 *= len; z2 *= len; x0 = upy * z2 - upz * z1; x1 = upz * z0 - upx * z2; x2 = upx * z1 - upy * z0; - len = Math.hypot(x0, x1, x2); - + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); if (!len) { x0 = 0; x1 = 0; @@ -6994,12 +6761,10 @@ x1 *= len; x2 *= len; } - y0 = z1 * x2 - z2 * x1; y1 = z2 * x0 - z0 * x2; y2 = z0 * x1 - z1 * x0; - len = Math.hypot(y0, y1, y2); - + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); if (!len) { y0 = 0; y1 = 0; @@ -7010,7 +6775,6 @@ y1 *= len; y2 *= len; } - out[0] = x0; out[1] = y0; out[2] = z0; @@ -7029,11 +6793,11 @@ out[15] = 1; return out; } + /** * Alias for {@link mat4.multiply} * @function */ - var mul = multiply$2; /** @@ -7046,25 +6810,22 @@ * * @returns {vec3} a new 3D vector */ - function create$3() { var out = new ARRAY_TYPE(3); - if (ARRAY_TYPE != Float32Array) { out[0] = 0; out[1] = 0; out[2] = 0; } - return out; } + /** * Creates a new vec3 initialized with values from an existing vector * * @param {ReadonlyVec3} a vector to clone * @returns {vec3} a new 3D vector */ - function clone$4(a) { var out = new ARRAY_TYPE(3); out[0] = a[0]; @@ -7072,19 +6833,20 @@ out[2] = a[2]; return out; } + /** * Calculates the length of a vec3 * * @param {ReadonlyVec3} a vector to calculate length of * @returns {Number} length of a */ - function length(a) { var x = a[0]; var y = a[1]; var z = a[2]; - return Math.hypot(x, y, z); + return Math.sqrt(x * x + y * y + z * z); } + /** * Creates a new vec3 initialized with the given values * @@ -7093,7 +6855,6 @@ * @param {Number} z Z component * @returns {vec3} a new 3D vector */ - function fromValues$3(x, y, z) { var out = new ARRAY_TYPE(3); out[0] = x; @@ -7101,6 +6862,7 @@ out[2] = z; return out; } + /** * Copy the values from one vec3 to another * @@ -7108,13 +6870,13 @@ * @param {ReadonlyVec3} a the source vector * @returns {vec3} out */ - function copy$4(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; return out; } + /** * Set the components of a vec3 to the given values * @@ -7124,13 +6886,13 @@ * @param {Number} z Z component * @returns {vec3} out */ - function set$3(out, x, y, z) { out[0] = x; out[1] = y; out[2] = z; return out; } + /** * Adds two vec3's * @@ -7139,13 +6901,13 @@ * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ - function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; return out; } + /** * Subtracts vector b from vector a * @@ -7154,13 +6916,13 @@ * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ - function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; return out; } + /** * Multiplies two vec3's * @@ -7169,13 +6931,13 @@ * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ - function multiply$1(out, a, b) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; out[2] = a[2] * b[2]; return out; } + /** * Returns the minimum of two vec3's * @@ -7184,13 +6946,13 @@ * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ - function min(out, a, b) { out[0] = Math.min(a[0], b[0]); out[1] = Math.min(a[1], b[1]); out[2] = Math.min(a[2], b[2]); return out; } + /** * Returns the maximum of two vec3's * @@ -7199,13 +6961,13 @@ * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ - function max(out, a, b) { out[0] = Math.max(a[0], b[0]); out[1] = Math.max(a[1], b[1]); out[2] = Math.max(a[2], b[2]); return out; } + /** * Scales a vec3 by a scalar number * @@ -7214,13 +6976,13 @@ * @param {Number} b amount to scale the vector by * @returns {vec3} out */ - function scale(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; return out; } + /** * Adds two vec3's after scaling the second operand by a scalar value * @@ -7230,13 +6992,13 @@ * @param {Number} scale the amount to scale b by before adding * @returns {vec3} out */ - function scaleAndAdd(out, a, b, scale) { out[0] = a[0] + b[0] * scale; out[1] = a[1] + b[1] * scale; out[2] = a[2] + b[2] * scale; return out; } + /** * Calculates the euclidian distance between two vec3's * @@ -7244,13 +7006,13 @@ * @param {ReadonlyVec3} b the second operand * @returns {Number} distance between a and b */ - function distance(a, b) { var x = b[0] - a[0]; var y = b[1] - a[1]; var z = b[2] - a[2]; - return Math.hypot(x, y, z); + return Math.sqrt(x * x + y * y + z * z); } + /** * Calculates the squared euclidian distance between two vec3's * @@ -7258,26 +7020,26 @@ * @param {ReadonlyVec3} b the second operand * @returns {Number} squared distance between a and b */ - function squaredDistance(a, b) { var x = b[0] - a[0]; var y = b[1] - a[1]; var z = b[2] - a[2]; return x * x + y * y + z * z; } + /** * Calculates the squared length of a vec3 * * @param {ReadonlyVec3} a vector to calculate squared length of * @returns {Number} squared length of a */ - function squaredLength(a) { var x = a[0]; var y = a[1]; var z = a[2]; return x * x + y * y + z * z; } + /** * Negates the components of a vec3 * @@ -7285,13 +7047,13 @@ * @param {ReadonlyVec3} a vector to negate * @returns {vec3} out */ - function negate(out, a) { out[0] = -a[0]; out[1] = -a[1]; out[2] = -a[2]; return out; } + /** * Normalize a vec3 * @@ -7299,23 +7061,21 @@ * @param {ReadonlyVec3} a vector to normalize * @returns {vec3} out */ - function normalize$3(out, a) { var x = a[0]; var y = a[1]; var z = a[2]; var len = x * x + y * y + z * z; - if (len > 0) { //TODO: evaluate use of glm_invsqrt here? len = 1 / Math.sqrt(len); } - out[0] = a[0] * len; out[1] = a[1] * len; out[2] = a[2] * len; return out; } + /** * Calculates the dot product of two vec3's * @@ -7323,10 +7083,10 @@ * @param {ReadonlyVec3} b the second operand * @returns {Number} dot product of a and b */ - - function dot(a, b) { + function dot$1(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } + /** * Computes the cross product of two vec3's * @@ -7335,19 +7095,19 @@ * @param {ReadonlyVec3} b the second operand * @returns {vec3} out */ - function cross(out, a, b) { var ax = a[0], - ay = a[1], - az = a[2]; + ay = a[1], + az = a[2]; var bx = b[0], - by = b[1], - bz = b[2]; + by = b[1], + bz = b[2]; out[0] = ay * bz - az * by; out[1] = az * bx - ax * bz; out[2] = ax * by - ay * bx; return out; } + /** * Performs a linear interpolation between two vec3's * @@ -7357,7 +7117,6 @@ * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {vec3} out */ - function lerp(out, a, b, t) { var ax = a[0]; var ay = a[1]; @@ -7367,6 +7126,7 @@ out[2] = az + t * (b[2] - az); return out; } + /** * Transforms the vec3 with a mat4. * 4th vector component is implicitly '1' @@ -7376,11 +7136,10 @@ * @param {ReadonlyMat4} m matrix to transform with * @returns {vec3} out */ - function transformMat4$2(out, a, m) { var x = a[0], - y = a[1], - z = a[2]; + y = a[1], + z = a[2]; var w = m[3] * x + m[7] * y + m[11] * z + m[15]; w = w || 1.0; out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; @@ -7388,6 +7147,7 @@ out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; return out; } + /** * Transforms the vec3 with a mat3. * @@ -7396,59 +7156,54 @@ * @param {ReadonlyMat3} m the 3x3 matrix to transform with * @returns {vec3} out */ - function transformMat3(out, a, m) { var x = a[0], - y = a[1], - z = a[2]; + y = a[1], + z = a[2]; out[0] = x * m[0] + y * m[3] + z * m[6]; out[1] = x * m[1] + y * m[4] + z * m[7]; out[2] = x * m[2] + y * m[5] + z * m[8]; return out; } + /** * Transforms the vec3 with a quat * Can also be used for dual quaternions. (Multiply it with the real part) * * @param {vec3} out the receiving vector * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with + * @param {ReadonlyQuat} q normalized quaternion to transform with * @returns {vec3} out */ - function transformQuat(out, a, q) { - // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed + // Fast Vector Rotation using Quaternions by Robert Eisele + // https://raw.org/proof/vector-rotation-using-quaternions/ + var qx = q[0], - qy = q[1], - qz = q[2], - qw = q[3]; - var x = a[0], - y = a[1], - z = a[2]; // var qvec = [qx, qy, qz]; - // var uv = vec3.cross([], qvec, a); - - var uvx = qy * z - qz * y, - uvy = qz * x - qx * z, - uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); - - var uuvx = qy * uvz - qz * uvy, - uuvy = qz * uvx - qx * uvz, - uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); - - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; // vec3.scale(uuv, uuv, 2); - - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); - - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; + qy = q[1], + qz = q[2], + qw = q[3]; + var vx = a[0], + vy = a[1], + vz = a[2]; + + // t = q x v + var tx = qy * vz - qz * vy; + var ty = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + + // t = 2t + tx = tx + tx; + ty = ty + ty; + tz = tz + tz; + + // v + w t + q x t + out[0] = vx + qw * tx + qy * tz - qz * ty; + out[1] = vy + qw * ty + qz * tx - qx * tz; + out[2] = vz + qw * tz + qx * ty - qy * tx; return out; } + /** * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) * @@ -7456,10 +7211,10 @@ * @param {ReadonlyVec3} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ - function exactEquals$1(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; } + /** * Returns whether or not the vectors have approximately the same elements in the same position. * @@ -7467,22 +7222,22 @@ * @param {ReadonlyVec3} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ - - function equals$3(a, b) { + function equals$2(a, b) { var a0 = a[0], - a1 = a[1], - a2 = a[2]; + a1 = a[1], + a2 = a[2]; var b0 = b[0], - b1 = b[1], - b2 = b[2]; + b1 = b[1], + b2 = b[2]; return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)); } + /** * Alias for {@link vec3.length} * @function */ - var len = length; + /** * Perform some operation over an array of vec3s. * @@ -7495,26 +7250,21 @@ * @returns {Array} a * @function */ - (function () { var vec = create$3(); return function (a, stride, offset, count, fn, arg) { var i, l; - if (!stride) { stride = 3; } - if (!offset) { offset = 0; } - if (count) { l = Math.min(count * stride + offset, a.length); } else { l = a.length; } - for (i = offset; i < l; i += stride) { vec[0] = a[i]; vec[1] = a[i + 1]; @@ -7524,7 +7274,6 @@ a[i + 1] = vec[1]; a[i + 2] = vec[2]; } - return a; }; })(); @@ -7539,26 +7288,23 @@ * * @returns {vec4} a new 4D vector */ - function create$2() { var out = new ARRAY_TYPE(4); - if (ARRAY_TYPE != Float32Array) { out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 0; } - return out; } + /** * Creates a new vec4 initialized with values from an existing vector * * @param {ReadonlyVec4} a vector to clone * @returns {vec4} a new 4D vector */ - function clone$3(a) { var out = new ARRAY_TYPE(4); out[0] = a[0]; @@ -7567,6 +7313,7 @@ out[3] = a[3]; return out; } + /** * Creates a new vec4 initialized with the given values * @@ -7576,7 +7323,6 @@ * @param {Number} w W component * @returns {vec4} a new 4D vector */ - function fromValues$2(x, y, z, w) { var out = new ARRAY_TYPE(4); out[0] = x; @@ -7585,6 +7331,7 @@ out[3] = w; return out; } + /** * Copy the values from one vec4 to another * @@ -7592,7 +7339,6 @@ * @param {ReadonlyVec4} a the source vector * @returns {vec4} out */ - function copy$3(out, a) { out[0] = a[0]; out[1] = a[1]; @@ -7600,6 +7346,7 @@ out[3] = a[3]; return out; } + /** * Set the components of a vec4 to the given values * @@ -7610,7 +7357,6 @@ * @param {Number} w W component * @returns {vec4} out */ - function set$2(out, x, y, z, w) { out[0] = x; out[1] = y; @@ -7618,6 +7364,7 @@ out[3] = w; return out; } + /** * Normalize a vec4 * @@ -7625,24 +7372,33 @@ * @param {ReadonlyVec4} a vector to normalize * @returns {vec4} out */ - function normalize$2(out, a) { var x = a[0]; var y = a[1]; var z = a[2]; var w = a[3]; var len = x * x + y * y + z * z + w * w; - if (len > 0) { len = 1 / Math.sqrt(len); } - out[0] = x * len; out[1] = y * len; out[2] = z * len; out[3] = w * len; return out; } + + /** + * Calculates the dot product of two vec4's + * + * @param {ReadonlyVec4} a the first operand + * @param {ReadonlyVec4} b the second operand + * @returns {Number} dot product of a and b + */ + function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + /** * Transforms the vec4 with a mat4. * @@ -7651,18 +7407,18 @@ * @param {ReadonlyMat4} m matrix to transform with * @returns {vec4} out */ - function transformMat4$1(out, a, m) { var x = a[0], - y = a[1], - z = a[2], - w = a[3]; + y = a[1], + z = a[2], + w = a[3]; out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; return out; } + /** * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) * @@ -7670,29 +7426,10 @@ * @param {ReadonlyVec4} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ - function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; } - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ - function equals$2(a, b) { - var a0 = a[0], - a1 = a[1], - a2 = a[2], - a3 = a[3]; - var b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3]; - return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); - } /** * Perform some operation over an array of vec4s. * @@ -7705,26 +7442,21 @@ * @returns {Array} a * @function */ - (function () { var vec = create$2(); return function (a, stride, offset, count, fn, arg) { var i, l; - if (!stride) { stride = 4; } - if (!offset) { offset = 0; } - if (count) { l = Math.min(count * stride + offset, a.length); } else { l = a.length; } - for (i = offset; i < l; i += stride) { vec[0] = a[i]; vec[1] = a[i + 1]; @@ -7736,13 +7468,12 @@ a[i + 2] = vec[2]; a[i + 3] = vec[3]; } - return a; }; })(); /** - * Quaternion + * Quaternion in the format XYZW * @module quat */ @@ -7751,19 +7482,17 @@ * * @returns {quat} a new quaternion */ - function create$1() { var out = new ARRAY_TYPE(4); - if (ARRAY_TYPE != Float32Array) { out[0] = 0; out[1] = 0; out[2] = 0; } - out[3] = 1; return out; } + /** * Sets a quat from the given angle and rotation axis, * then returns it. @@ -7773,7 +7502,6 @@ * @param {Number} rad the angle in radians * @returns {quat} out **/ - function setAxisAngle(out, axis, rad) { rad = rad * 0.5; var s = Math.sin(rad); @@ -7783,6 +7511,7 @@ out[3] = Math.cos(rad); return out; } + /** * Multiplies two quat's * @@ -7791,22 +7520,22 @@ * @param {ReadonlyQuat} b the second operand * @returns {quat} out */ - function multiply(out, a, b) { var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; + ay = a[1], + az = a[2], + aw = a[3]; var bx = b[0], - by = b[1], - bz = b[2], - bw = b[3]; + by = b[1], + bz = b[2], + bw = b[3]; out[0] = ax * bw + aw * bx + ay * bz - az * by; out[1] = ay * bw + aw * by + az * bx - ax * bz; out[2] = az * bw + aw * bz + ax * by - ay * bx; out[3] = aw * bw - ax * bx - ay * by - az * bz; return out; } + /** * Rotates a quaternion by the given angle about the X axis * @@ -7815,21 +7544,21 @@ * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ - function rotateX(out, a, rad) { rad *= 0.5; var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; + ay = a[1], + az = a[2], + aw = a[3]; var bx = Math.sin(rad), - bw = Math.cos(rad); + bw = Math.cos(rad); out[0] = ax * bw + aw * bx; out[1] = ay * bw + az * bx; out[2] = az * bw - ay * bx; out[3] = aw * bw - ax * bx; return out; } + /** * Rotates a quaternion by the given angle about the Y axis * @@ -7838,21 +7567,21 @@ * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ - function rotateY(out, a, rad) { rad *= 0.5; var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; + ay = a[1], + az = a[2], + aw = a[3]; var by = Math.sin(rad), - bw = Math.cos(rad); + bw = Math.cos(rad); out[0] = ax * bw - az * by; out[1] = ay * bw + aw * by; out[2] = az * bw + ax * by; out[3] = aw * bw - ay * by; return out; } + /** * Performs a spherical linear interpolation between two quat * @@ -7862,31 +7591,30 @@ * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {quat} out */ - function slerp(out, a, b, t) { // benchmarks: // http://jsperf.com/quaternion-slerp-implementations var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; + ay = a[1], + az = a[2], + aw = a[3]; var bx = b[0], - by = b[1], - bz = b[2], - bw = b[3]; - var omega, cosom, sinom, scale0, scale1; // calc cosine - - cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) - + by = b[1], + bz = b[2], + bw = b[3]; + var omega, cosom, sinom, scale0, scale1; + + // calc cosine + cosom = ax * bx + ay * by + az * bz + aw * bw; + // adjust signs (if necessary) if (cosom < 0.0) { cosom = -cosom; bx = -bx; by = -by; bz = -bz; bw = -bw; - } // calculate coefficients - - + } + // calculate coefficients if (1.0 - cosom > EPSILON) { // standard case (slerp) omega = Math.acos(cosom); @@ -7898,15 +7626,15 @@ // ... so we can do a linear interpolation scale0 = 1.0 - t; scale1 = t; - } // calculate final values - - + } + // calculate final values out[0] = scale0 * ax + scale1 * bx; out[1] = scale0 * ay + scale1 * by; out[2] = scale0 * az + scale1 * bz; out[3] = scale0 * aw + scale1 * bw; return out; } + /** * Calculates the conjugate of a quat * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. @@ -7915,7 +7643,6 @@ * @param {ReadonlyQuat} a quat to calculate conjugate of * @returns {quat} out */ - function conjugate(out, a) { out[0] = -a[0]; out[1] = -a[1]; @@ -7923,6 +7650,7 @@ out[3] = a[3]; return out; } + /** * Creates a quaternion from the given 3x3 rotation matrix. * @@ -7934,20 +7662,16 @@ * @returns {quat} out * @function */ - function fromMat3(out, m) { // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes // article "Quaternion Calculus and Fast Animation". var fTrace = m[0] + m[4] + m[8]; var fRoot; - if (fTrace > 0.0) { // |w| > 1/2, may as well choose w > 1/2 fRoot = Math.sqrt(fTrace + 1.0); // 2w - out[3] = 0.5 * fRoot; fRoot = 0.5 / fRoot; // 1/(4w) - out[0] = (m[5] - m[7]) * fRoot; out[1] = (m[6] - m[2]) * fRoot; out[2] = (m[1] - m[3]) * fRoot; @@ -7965,9 +7689,9 @@ out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; } - return out; } + /** * Creates a new quat initialized with values from an existing quaternion * @@ -7975,8 +7699,8 @@ * @returns {quat} a new quaternion * @function */ - var clone$2 = clone$3; + /** * Creates a new quat initialized with the given values * @@ -7987,8 +7711,8 @@ * @returns {quat} a new quaternion * @function */ - var fromValues$1 = fromValues$2; + /** * Copy the values from one quat to another * @@ -7997,8 +7721,8 @@ * @returns {quat} out * @function */ - var copy$2 = copy$3; + /** * Set the components of a quat to the given values * @@ -8010,8 +7734,8 @@ * @returns {quat} out * @function */ - var set$1 = set$2; + /** * Normalize a quat * @@ -8020,17 +7744,21 @@ * @returns {quat} out * @function */ - var normalize$1 = normalize$2; + /** - * Returns whether or not the quaternions have approximately the same elements in the same position. + * Returns whether or not the quaternions point approximately to the same direction. * - * @param {ReadonlyQuat} a The first vector. - * @param {ReadonlyQuat} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. + * Both quaternions are assumed to be unit length. + * + * @param {ReadonlyQuat} a The first unit quaternion. + * @param {ReadonlyQuat} b The second unit quaternion. + * @returns {Boolean} True if the quaternions are equal, false otherwise. */ + function equals$1(a, b) { + return Math.abs(dot(a, b)) >= 1 - EPSILON; + } - var equals$1 = equals$2; /** * Sets a quaternion to represent the shortest rotation from one * vector to another. @@ -8042,21 +7770,19 @@ * @param {ReadonlyVec3} b the destination vector * @returns {quat} out */ - var rotationTo = function () { var tmpvec3 = create$3(); var xUnitVec3 = fromValues$3(1, 0, 0); var yUnitVec3 = fromValues$3(0, 1, 0); return function (out, a, b) { - var dot$1 = dot(a, b); - - if (dot$1 < -0.999999) { + var dot = dot$1(a, b); + if (dot < -0.999999) { cross(tmpvec3, xUnitVec3, a); if (len(tmpvec3) < 0.000001) cross(tmpvec3, yUnitVec3, a); normalize$3(tmpvec3, tmpvec3); setAxisAngle(out, tmpvec3, Math.PI); return out; - } else if (dot$1 > 0.999999) { + } else if (dot > 0.999999) { out[0] = 0; out[1] = 0; out[2] = 0; @@ -8067,11 +7793,12 @@ out[0] = tmpvec3[0]; out[1] = tmpvec3[1]; out[2] = tmpvec3[2]; - out[3] = 1 + dot$1; + out[3] = 1 + dot; return normalize$1(out, out); } }; }(); + /** * Performs a spherical linear interpolation with two control points * @@ -8083,7 +7810,6 @@ * @param {Number} t interpolation amount, in the range [0-1], between the two inputs * @returns {quat} out */ - (function () { var temp1 = create$1(); var temp2 = create$1(); @@ -8094,6 +7820,7 @@ return out; }; })(); + /** * Sets the specified quaternion with values corresponding to the given * axes. Each axis is a vec3 and is expected to be unit length and @@ -8104,7 +7831,6 @@ * @param {ReadonlyVec3} up the vector representing the local "up" direction * @returns {quat} out */ - (function () { var matr = create$5(); return function (out, view, right, up) { @@ -8131,30 +7857,28 @@ * * @returns {vec2} a new 2D vector */ - function create() { var out = new ARRAY_TYPE(2); - if (ARRAY_TYPE != Float32Array) { out[0] = 0; out[1] = 0; } - return out; } + /** * Creates a new vec2 initialized with values from an existing vector * * @param {ReadonlyVec2} a vector to clone * @returns {vec2} a new 2D vector */ - function clone$1(a) { var out = new ARRAY_TYPE(2); out[0] = a[0]; out[1] = a[1]; return out; } + /** * Creates a new vec2 initialized with the given values * @@ -8162,13 +7886,13 @@ * @param {Number} y Y component * @returns {vec2} a new 2D vector */ - function fromValues(x, y) { var out = new ARRAY_TYPE(2); out[0] = x; out[1] = y; return out; } + /** * Copy the values from one vec2 to another * @@ -8176,12 +7900,12 @@ * @param {ReadonlyVec2} a the source vector * @returns {vec2} out */ - function copy$1(out, a) { out[0] = a[0]; out[1] = a[1]; return out; } + /** * Set the components of a vec2 to the given values * @@ -8190,12 +7914,12 @@ * @param {Number} y Y component * @returns {vec2} out */ - function set(out, x, y) { out[0] = x; out[1] = y; return out; } + /** * Transforms the vec2 with a mat4 * 3rd vector component is implicitly '0' @@ -8206,7 +7930,6 @@ * @param {ReadonlyMat4} m matrix to transform with * @returns {vec2} out */ - function transformMat4(out, a, m) { var x = a[0]; var y = a[1]; @@ -8214,6 +7937,7 @@ out[1] = m[1] * x + m[5] * y + m[13]; return out; } + /** * Returns whether or not the vectors have approximately the same elements in the same position. * @@ -8221,14 +7945,14 @@ * @param {ReadonlyVec2} b The second vector. * @returns {Boolean} True if the vectors are equal, false otherwise. */ - function equals(a, b) { var a0 = a[0], - a1 = a[1]; + a1 = a[1]; var b0 = b[0], - b1 = b[1]; + b1 = b[1]; return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)); } + /** * Perform some operation over an array of vec2s. * @@ -8241,26 +7965,21 @@ * @returns {Array} a * @function */ - (function () { var vec = create(); return function (a, stride, offset, count, fn, arg) { var i, l; - if (!stride) { stride = 2; } - if (!offset) { offset = 0; } - if (count) { l = Math.min(count * stride + offset, a.length); } else { l = a.length; } - for (i = offset; i < l; i += stride) { vec[0] = a[i]; vec[1] = a[i + 1]; @@ -8268,7 +7987,6 @@ a[i] = vec[0]; a[i + 1] = vec[1]; } - return a; }; })(); @@ -8424,8 +8142,8 @@ return 0; } else { - const dot$1 = MathHelper.clamp(dot(from, to), -1, 1); - return Math.acos(dot$1); + const dot = MathHelper.clamp(dot$1(from, to), -1, 1); + return Math.acos(dot); } } static signedAngleBetweenVectors(from, to, up) { @@ -8433,10 +8151,10 @@ return 0; } else { - const dot$1 = MathHelper.clamp(dot(from, to), -1, 1); - let angle = Math.acos(dot$1); + const dot = MathHelper.clamp(dot$1(from, to), -1, 1); + let angle = Math.acos(dot); cross(AngleHelper._vec3, from, to); - if (dot(AngleHelper._vec3, up) < 0) { + if (dot$1(AngleHelper._vec3, up) < 0) { angle = -angle; } return angle; @@ -8580,9 +8298,9 @@ view[8] = this._right[2]; view[9] = this._up[2]; view[10] = this._forward[2]; - view[12] = -dot(this._right, this._combinedPosition); - view[13] = -dot(this._up, this._combinedPosition); - view[14] = -dot(this._forward, this._combinedPosition); + view[12] = -dot$1(this._right, this._combinedPosition); + view[13] = -dot$1(this._up, this._combinedPosition); + view[14] = -dot$1(this._forward, this._combinedPosition); const aspectRatio = this.width / this.height; if (this._core.config.stereoMode == StereoMode.none) { if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { @@ -8779,8 +8497,8 @@ this.positionSmoothing = 0.02; this.focusSmoothing = 0.01; this.scaleSmoothing = 0.02; - this.mouseWheelZoomScale = -0.002; - this.mouseWheelRotationScale = -0.002; + this.mouseWheelZoomScale = -2e-3; + this.mouseWheelRotationScale = -2e-3; this.dragToleranceSquared = 100; this.manipulatorMinRelativeDistanceSquared = 100; this.isMultiTouchEnabled = true; @@ -8853,6 +8571,7 @@ this.isTransitionPickingEnabled = false; this.backgroundColor = create$2(); this.theme = Theme.light; + this.ambientColor = create$3(); this.renderMode = RenderMode.color; this.tilesX = 1; this.tilesY = 1; @@ -9004,6 +8723,8 @@ "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, + "category10": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 255, 127, 14, 44, 160, 44, 214, 39, 40, 148, 103, 189, 140, 86, 75, 227, 119, 194, 127, 127, 127, 188, 189, 34, 23, 190, 207]) }, + "category20": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 174, 199, 232, 255, 127, 14, 255, 187, 120, 44, 160, 44, 152, 223, 138, 214, 39, 40, 255, 152, 150, 148, 103, 189, 197, 176, 213, 140, 86, 75, 196, 156, 148, 227, 119, 194, 247, 182, 210, 127, 127, 127, 199, 199, 199, 188, 189, 34, 219, 219, 141, 23, 190, 207, 158, 218, 229]) }, "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, @@ -9430,8 +9151,98 @@ static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); } + static getMatId(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES, value); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint16(offset) / 0xFF; + value[1] = bufferView.getUint16(offset + 2) / 0xFF; + value[2] = bufferView.getUint16(offset + 4) / 0xFF; + } + static setMatColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFF); + bufferView.setUint16(offset + 2, value[1] * 0xFF); + bufferView.setUint16(offset + 4, value[2] * 0xFF); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset) / 0xFF; + } + static setMatFuzz(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset, value * 0xFF); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset) / 0xFF; + } + static setMatGloss(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset, value * 0xFF); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, value, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint8(offset) / 0xFF; + value[1] = bufferView.getUint8(offset + 1) / 0xFF; + value[2] = bufferView.getUint8(offset + 2) / 0xFF; + value[3] = bufferView.getUint8(offset + 3) / 0xFF; + } + static setSegColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + bufferView.setUint8(offset + 2, value[2] * 0xFF); + bufferView.setUint8(offset + 3, value[3] * 0xFF); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); + } } - UnitVertex.SIZE_BYTES = 92; + UnitVertex.SIZE_BYTES = 120; UnitVertex.ID_HOVER_OFFSET_BYTES = 0; UnitVertex.ID_COLOR_OFFSET_BYTES = 4; UnitVertex.ORDER_OFFSET_BYTES = 8; @@ -9449,6 +9260,13 @@ UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; + UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; + UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; + UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; + UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; + UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; + UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; + UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; /*! * Copyright (c) Microsoft Corporation. @@ -10601,7 +10419,7 @@ f 5/6/6 1/12/6 8/11/6`; multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); transformMat4$2(this._forward, this._vec3, this._mvMatrix); transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = dot(this._normal, this._forward) > 0; + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; } this._forward[0] = this._mat3[2]; this._forward[1] = this._mat3[5]; @@ -10613,7 +10431,7 @@ f 5/6/6 1/12/6 8/11/6`; const outsideEdge = forward1 != forward2; this._isOutsideEdge[edgeId] = outsideEdge; if (outsideEdge) { - this._isForwardEdge[edgeId] = dot(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; } this._distances[edgeId] = 0; } @@ -10678,14 +10496,14 @@ f 5/6/6 1/12/6 8/11/6`; const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if (dot(this._edgeNormalTemp, this._up) > 0) { + if (dot$1(this._edgeNormalTemp, this._up) > 0) { copy$4(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); } else { negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); negate(this._edgeNormalTemp, this._edgeNormalTemp); } - if (dot(this._edgePositiveTemp, this._right) > 0) { + if (dot$1(this._edgePositiveTemp, this._right) > 0) { this._isLeftToRightHorizontal[edgeId] = true; copy$4(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); } @@ -10695,7 +10513,7 @@ f 5/6/6 1/12/6 8/11/6`; negate(this._edgePositiveTemp, this._edgePositiveTemp); } cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if (dot(edgeHorizontalForward, this._forward) < 0) { + if (dot$1(edgeHorizontalForward, this._forward) < 0) { this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; negate(edgeHorizontalRight, edgeHorizontalRight); } @@ -10703,14 +10521,14 @@ f 5/6/6 1/12/6 8/11/6`; const edgeVerticalRight = this._edgeVerticalRight[edgeId]; const edgeVerticalUp = this._edgeVerticalUp[edgeId]; const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if (dot(this._edgeNormal, this._right) < 0) { + if (dot$1(this._edgeNormal, this._right) < 0) { copy$4(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); } else { negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); negate(this._edgeNormal, this._edgeNormal); } - if (dot(this._edgePositive, this._up) < 0) { + if (dot$1(this._edgePositive, this._up) < 0) { this._isLeftToRightVertical[edgeId] = true; copy$4(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); } @@ -10720,7 +10538,7 @@ f 5/6/6 1/12/6 8/11/6`; negate(this._edgePositive, this._edgePositive); } cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if (dot(edgeVerticalForward, this._forward) < 0) { + if (dot$1(edgeVerticalForward, this._forward) < 0) { this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; negate(edgeVerticalRight, edgeVerticalRight); } @@ -11576,13 +11394,13 @@ f 5/6/6 1/12/6 8/11/6`; for (let faceId = 0; faceId < 2; faceId++) { transformMat4$2(this._forward, Constants.VECTOR3_ZERO, this._mvMatrix); transformMat3(this._normal, Quad$2.FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = dot(this._normal, this._forward) > 0; + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; } this._forward[0] = this._mat3[2]; this._forward[1] = this._mat3[5]; this._forward[2] = this._mat3[8]; for (let edgeId = 0; edgeId < 4; edgeId++) { - this._isForwardEdge[edgeId] = dot(Quad$2.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._isForwardEdge[edgeId] = dot$1(Quad$2.EDGE_FORWARDS[edgeId], this._forward) < 0; this._distances[edgeId] = 0; } for (let axisId = 0; axisId < 2; axisId++) { @@ -11635,14 +11453,14 @@ f 5/6/6 1/12/6 8/11/6`; const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if (dot(this._edgeNormalTemp, this._up) > 0) { + if (dot$1(this._edgeNormalTemp, this._up) > 0) { copy$4(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); } else { negate(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); negate(this._edgeNormalTemp, this._edgeNormalTemp); } - if (dot(this._edgePositiveTemp, this._right) > 0) { + if (dot$1(this._edgePositiveTemp, this._right) > 0) { this._isLeftToRightHorizontal[edgeId] = true; copy$4(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); } @@ -11652,7 +11470,7 @@ f 5/6/6 1/12/6 8/11/6`; negate(this._edgePositiveTemp, this._edgePositiveTemp); } cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if (dot(edgeHorizontalForward, this._forward) < 0) { + if (dot$1(edgeHorizontalForward, this._forward) < 0) { this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; negate(edgeHorizontalRight, edgeHorizontalRight); } @@ -11660,14 +11478,14 @@ f 5/6/6 1/12/6 8/11/6`; const edgeVerticalRight = this._edgeVerticalRight[edgeId]; const edgeVerticalUp = this._edgeVerticalUp[edgeId]; const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if (dot(this._edgeNormal, this._right) < 0) { + if (dot$1(this._edgeNormal, this._right) < 0) { copy$4(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); } else { negate(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); negate(this._edgeNormal, this._edgeNormal); } - if (dot(this._edgePositive, this._up) < 0) { + if (dot$1(this._edgePositive, this._up) < 0) { this._isLeftToRightVertical[edgeId] = true; copy$4(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); } @@ -11677,7 +11495,7 @@ f 5/6/6 1/12/6 8/11/6`; negate(this._edgePositive, this._edgePositive); } cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if (dot(edgeVerticalForward, this._forward) < 0) { + if (dot$1(edgeVerticalForward, this._forward) < 0) { this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; negate(edgeVerticalRight, edgeVerticalRight); } @@ -13659,7 +13477,7 @@ f 5/6/6 1/12/6 8/11/6`; for (let i = 0; i < 4; i++) { cross(normals[i], directions[(i + 1) % 4], directions[i]); normalize$3(normals[i], normals[i]); - d.push(-dot(normals[i], nearPositions[i])); + d.push(-dot$1(normals[i], nearPositions[i])); } if (pickType == PickType.data) { const translation = create$3(); @@ -13677,7 +13495,7 @@ f 5/6/6 1/12/6 8/11/6`; UnitVertex.getTranslation(currentBuffer.dataView, index, translation); let isInside = true; for (let k = 0; k < 4; k++) { - let distance = dot(normals[k], translation); + let distance = dot$1(normals[k], translation); distance += d[k]; if (distance < 0) { isInside = false; @@ -13745,7 +13563,6 @@ f 5/6/6 1/12/6 8/11/6`; const UnitType = { block: "block", blockSdf: "blockSdf", - boxFrameSdf: "boxFrameSdf", sphere: "sphere", sphereSdf: "sphereSdf", cylinder: "cylinder", @@ -13754,16 +13571,13 @@ f 5/6/6 1/12/6 8/11/6`; hexPrismSdf: "hexPrismSdf", sdf: "sdf", disk: "disk", - ringSdf: "ringSdf", - }; + ringSdf: "ringSdf"}; const SingleTouchAction = { - none: "none", translate: "translate", rotate: "rotate", lasso: "lasso", }; const MouseWheelAction = { - none: "none", zoom: "zoom", rotateY: "rotateY", }; @@ -13778,178 +13592,11 @@ f 5/6/6 1/12/6 8/11/6`; topFront: 0, topRight: 1, topBack: 2, - topLeft: 3, - bottomFront: 4, bottomRight: 5, - bottomBack: 6, - bottomLeft: 7, frontRight: 8, - backRight: 9, - backLeft: 10, - frontLeft: 11, - }; + backRight: 9}; const RenderMode = { - color: "color", - hdr: "hdr", - depth: "depth", - normal: "normal", - segment: "segment", - edge: "edge", - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - fromValues$3(0xc7, 0x15, 0x85); - fromValues$3(0xff, 0x14, 0x93); - fromValues$3(0xdb, 0x70, 0x93); - fromValues$3(0xff, 0x69, 0xb4); - fromValues$3(0xff, 0xb6, 0xc1); - fromValues$3(0xff, 0xc0, 0xcb); - fromValues$3(0x8b, 0x00, 0x00); - fromValues$3(0xff, 0x00, 0x00); - fromValues$3(0xb2, 0x22, 0x22); - fromValues$3(0xdc, 0x14, 0x3c); - fromValues$3(0xcd, 0x5c, 0x5c); - fromValues$3(0xf0, 0x80, 0x80); - fromValues$3(0xfa, 0x80, 0x72); - fromValues$3(0xe9, 0x96, 0x7a); - fromValues$3(0xff, 0xa0, 0x7a); - fromValues$3(0xff, 0x45, 0x00); - fromValues$3(0xff, 0x63, 0x47); - fromValues$3(0xff, 0x8c, 0x00); - fromValues$3(0xff, 0x7f, 0x50); - fromValues$3(0xff, 0xa5, 0x00); - fromValues$3(0xbd, 0xb7, 0x6b); - fromValues$3(0xff, 0xd7, 0x00); - fromValues$3(0xf0, 0xe6, 0x8c); - fromValues$3(0xff, 0xda, 0xb9); - fromValues$3(0xff, 0xff, 0x00); - fromValues$3(0xee, 0xe8, 0xaa); - fromValues$3(0xff, 0xe4, 0xb5); - fromValues$3(0xff, 0xef, 0xd5); - fromValues$3(0xfa, 0xfa, 0xd2); - fromValues$3(0xff, 0xfa, 0xcd); - fromValues$3(0xff, 0xff, 0xe0); - fromValues$3(0x80, 0x00, 0x00); - fromValues$3(0xa5, 0x2a, 0x2a); - fromValues$3(0x8b, 0x45, 0x13); - fromValues$3(0xa0, 0x52, 0x2d); - fromValues$3(0xd2, 0x69, 0x1e); - fromValues$3(0xb8, 0x86, 0x0b); - fromValues$3(0xcd, 0x85, 0x3f); - fromValues$3(0xbc, 0x8f, 0x8f); - fromValues$3(0xda, 0xa5, 0x20); - fromValues$3(0xf4, 0xa4, 0x60); - fromValues$3(0xd2, 0xb4, 0x8c); - fromValues$3(0xde, 0xb8, 0x87); - fromValues$3(0xf5, 0xde, 0xb3); - fromValues$3(0xff, 0xde, 0xad); - fromValues$3(0xff, 0xe4, 0xc4); - fromValues$3(0xff, 0xeb, 0xcd); - fromValues$3(0xff, 0xf8, 0xdc); - fromValues$3(0x00, 0x64, 0x00); - fromValues$3(0x00, 0x80, 0x00); - fromValues$3(0x55, 0x6b, 0x2f); - fromValues$3(0x22, 0x8b, 0x22); - fromValues$3(0x2e, 0x8b, 0x57); - fromValues$3(0x80, 0x80, 0x00); - fromValues$3(0x6b, 0x8e, 0x23); - fromValues$3(0x3c, 0xb3, 0x71); - fromValues$3(0x32, 0xcd, 0x32); - fromValues$3(0x00, 0xff, 0x00); - fromValues$3(0x00, 0xff, 0x7f); - fromValues$3(0x00, 0xfa, 0x9a); - fromValues$3(0x8f, 0xbc, 0x8f); - fromValues$3(0x66, 0xcd, 0xaa); - fromValues$3(0x9a, 0xcd, 0x32); - fromValues$3(0x7c, 0xfc, 0x00); - fromValues$3(0x7f, 0xff, 0x00); - fromValues$3(0x90, 0xee, 0x90); - fromValues$3(0xad, 0xff, 0x2f); - fromValues$3(0x98, 0xfb, 0x98); - fromValues$3(0x00, 0x80, 0x80); - fromValues$3(0x00, 0x8b, 0x8b); - fromValues$3(0x20, 0xb2, 0xaa); - fromValues$3(0x5f, 0x9e, 0xa0); - fromValues$3(0x00, 0xce, 0xd1); - fromValues$3(0x48, 0xd1, 0xcc); - fromValues$3(0x40, 0xe0, 0xd0); - fromValues$3(0x00, 0xff, 0xff); - fromValues$3(0x00, 0xff, 0xff); - fromValues$3(0x7f, 0xff, 0xd4); - fromValues$3(0xaf, 0xee, 0xee); - fromValues$3(0xe0, 0xff, 0xff); - fromValues$3(0x00, 0x00, 0x80); - fromValues$3(0x00, 0x00, 0x8b); - fromValues$3(0x00, 0x00, 0xcd); - fromValues$3(0x00, 0x00, 0xff); - fromValues$3(0x19, 0x19, 0x70); - fromValues$3(0x41, 0x69, 0xe1); - fromValues$3(0x46, 0x82, 0xb4); - fromValues$3(0x1e, 0x90, 0xff); - fromValues$3(0x00, 0xbf, 0xff); - fromValues$3(0x64, 0x95, 0xed); - fromValues$3(0x87, 0xce, 0xeb); - fromValues$3(0x87, 0xce, 0xfa); - fromValues$3(0xb0, 0xc4, 0xde); - fromValues$3(0xad, 0xd8, 0xe6); - fromValues$3(0xb0, 0xe0, 0xe6); - fromValues$3(0x4b, 0x00, 0x82); - fromValues$3(0x80, 0x00, 0x80); - fromValues$3(0x8b, 0x00, 0x8b); - fromValues$3(0x94, 0x00, 0xd3); - fromValues$3(0x48, 0x3d, 0x8b); - fromValues$3(0x8a, 0x2b, 0xe2); - fromValues$3(0x99, 0x32, 0xcc); - fromValues$3(0xff, 0x00, 0xff); - fromValues$3(0xff, 0x00, 0xff); - fromValues$3(0x6a, 0x5a, 0xcd); - fromValues$3(0x7b, 0x68, 0xee); - fromValues$3(0xba, 0x55, 0xd3); - fromValues$3(0x93, 0x70, 0xdb); - fromValues$3(0xda, 0x70, 0xd6); - fromValues$3(0xee, 0x82, 0xee); - fromValues$3(0xdd, 0xa0, 0xdd); - fromValues$3(0xd8, 0xbf, 0xd8); - fromValues$3(0xe6, 0xe6, 0xfa); - fromValues$3(0xff, 0xe4, 0xe1); - fromValues$3(0xfa, 0xeb, 0xd7); - fromValues$3(0xfa, 0xf0, 0xe6); - fromValues$3(0xf5, 0xf5, 0xdc); - fromValues$3(0xf5, 0xf5, 0xf5); - fromValues$3(0xff, 0xf0, 0xf5); - fromValues$3(0xfd, 0xf5, 0xe6); - fromValues$3(0xf0, 0xf8, 0xff); - fromValues$3(0xff, 0xf5, 0xee); - fromValues$3(0xf8, 0xf8, 0xff); - fromValues$3(0xf0, 0xff, 0xf0); - fromValues$3(0xff, 0xfa, 0xf0); - fromValues$3(0xf0, 0xff, 0xff); - fromValues$3(0xf5, 0xff, 0xfa); - fromValues$3(0xff, 0xfa, 0xfa); - fromValues$3(0xff, 0xff, 0xf0); - fromValues$3(0xff, 0xff, 0xff); - fromValues$3(0x00, 0x00, 0x00); - fromValues$3(0x2f, 0x4f, 0x4f); - fromValues$3(0x69, 0x69, 0x69); - fromValues$3(0x70, 0x80, 0x90); - fromValues$3(0x80, 0x80, 0x80); - fromValues$3(0x77, 0x88, 0x99); - fromValues$3(0xa9, 0xa9, 0xa9); - fromValues$3(0xc0, 0xc0, 0xc0); - fromValues$3(0xd3, 0xd3, 0xd3); - fromValues$3(0xdc, 0xdc, 0xdc); - fromValues$3(0xb8, 0x73, 0x33); - fromValues$3(0xcd, 0x7f, 0x32); - fromValues$3(0xce, 0xd2, 0xd7); - fromValues$3(0xe5, 0xe4, 0xe2); - fromValues$3(0x5c, 0x5d, 0x5b); - fromValues$3(0x87, 0x86, 0x81); - fromValues$3(0xcb, 0xa3, 0xb2); - fromValues$3(0xd2, 0xe8, 0xdf); - fromValues$3(0xc7, 0xe3, 0xe1); + color: "color"}; /*! * Copyright (c) Microsoft Corporation. @@ -13970,6 +13617,11 @@ f 5/6/6 1/12/6 8/11/6`; get indexCount() { return this._indexCount; } get isInitialized() { return this._isInitialized; } get mMatrix() { return this._mMatrix; } + get materialType() { return this._materialType; } + get materialColor() { return this._materialColor; } + get materialFuzz() { return this._materialFuzz; } + get materialGloss() { return this._materialGloss; } + get segmentColor() { return this._segmentColor; } get scale() { return this._scale; } set scale(value) { if (this._scale != value) { @@ -14081,6 +13733,11 @@ f 5/6/6 1/12/6 8/11/6`; this._material = options.material; this.borderWidth = core.config.textBorderWidth; this.gamma = 0; + this._materialType = options.materialType || 0; + this._materialColor = options.materialColor || core.config.textColor; + this._materialFuzz = options.materialFuzz || 0; + this._materialGloss = options.materialGloss || 0; + this._segmentColor = options.segmentColor; } initialize() { this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); @@ -14092,6 +13749,11 @@ f 5/6/6 1/12/6 8/11/6`; } class LabelSet extends LabelBase { get materials() { return this._materials; } + get materialTypes() { return this._materialTypes; } + get materialColors() { return this._materialColors; } + get materialFuzzes() { return this._materialFuzzes; } + get materialGlosses() { return this._materialGlosses; } + get segmentColors() { return this._segmentColors; } get minBoundsX() { return this._minBoundsX; } set minBoundsX(value) { if (this._minBoundsX != value) { @@ -14264,6 +13926,9 @@ f 5/6/6 1/12/6 8/11/6`; super(core, options); this._quat = create$1(); this._materials = options.materials; + this._materialType = options.materialType; + this._materialColor = options.materialColors ? null : options.materialColor || core.config.textColor; + this._materialColors = options.materialColors; this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; @@ -14420,7 +14085,7 @@ f 5/6/6 1/12/6 8/11/6`; } get position() { return this._position; } set position(value) { - if (!equals$3(this._position, value)) { + if (!equals$2(this._position, value)) { copy$4(this._position, value); this._hasChanged = true; } @@ -14586,7 +14251,7 @@ f 5/6/6 1/12/6 8/11/6`; static cylinder(pa, pb, radius, minBounds, maxBounds) { const a = create$3(); subtract(a, pb, pa); - const aa = dot(a, a); + const aa = dot$1(a, a); const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); @@ -15004,6 +14669,13 @@ f 5/6/6 1/12/6 8/11/6`; else { UnitVertex.setTexCoord(dataView, index, _vec4); } + UnitVertex.setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + UnitVertex.setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id * 3], options.materialColors[id * 3 + 1], options.materialColors[id * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + UnitVertex.setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + UnitVertex.setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + UnitVertex.setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id * 4], options.segmentColors[id * 4 + 1], options.segmentColors[id * 4 + 2], options.segmentColors[id * 4 + 3]] : [buffer.idColors[id * 4], buffer.idColors[id * 4 + 1], buffer.idColors[id * 4 + 2], buffer.idColors[id * 4 + 3]]); } buffer.update(); this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); @@ -15378,6 +15050,13 @@ f 5/6/6 1/12/6 8/11/6`; UnitVertex.setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); UnitVertex.setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); UnitVertex.setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + UnitVertex.setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + UnitVertex.setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id * 3], options.materialColors[id * 3 + 1], options.materialColors[id * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + UnitVertex.setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + UnitVertex.setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + UnitVertex.setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id * 4], options.segmentColors[id * 4 + 1], options.segmentColors[id * 4 + 2], options.segmentColors[id * 4 + 3]] : [buffer.idColors[id * 4], buffer.idColors[id * 4 + 1], buffer.idColors[id * 4 + 2], buffer.idColors[id * 4 + 3]]); } buffer.update(); this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); @@ -15471,6 +15150,13 @@ f 5/6/6 1/12/6 8/11/6`; UnitVertex.copySdfBorder(fromDataView, index, toDataView, i); UnitVertex.copyParameter1(fromDataView, index, toDataView, i); UnitVertex.copyParameter2(fromDataView, index, toDataView, i); + UnitVertex.copyMatId(fromDataView, index, toDataView, i); + UnitVertex.copyMatColor(fromDataView, index, toDataView, i); + UnitVertex.copyMatFuzz(fromDataView, index, toDataView, i); + UnitVertex.copyMatRefractiveIndex(fromDataView, index, toDataView, i); + UnitVertex.copyMatGloss(fromDataView, index, toDataView, i); + UnitVertex.copyMatDensity(fromDataView, index, toDataView, i); + UnitVertex.copySegColor(fromDataView, index, toDataView, i); } else { UnitVertex.setRotation(toDataView, i, Constants.QUAT_IDENTITY); @@ -15529,11 +15215,18 @@ f 5/6/6 1/12/6 8/11/6`; const dataView1 = this._buffer1.dataView; const dataView2 = this._buffer2.dataView; const _vec4 = create$2(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; for (let i = 0; i < this._length; i++) { const id = ids[i]; const pickId = PickHelper.nextPickId(); this._pickIdLookup[pickId] = id; PickHelper.encodeNumber(pickId, PickType.data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; UnitVertex.setIdColor(dataView1, i, _vec4); UnitVertex.setIdColor(dataView2, i, _vec4); } @@ -15681,6 +15374,12 @@ f 5/6/6 1/12/6 8/11/6`; this._backgroundColor = value; } } + get ambientColor() { return this._ambientColor; } + set ambientColor(value) { + if (!exactEquals$1(value, this._ambientColor)) { + this._ambientColor = value; + } + } get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } set currentAxes(value) { if (this._isAxes1Current) { this._axes1 = value; @@ -22704,6 +22403,20 @@ f 5/6/6 1/12/6 8/11/6`; } } + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + /*! * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. @@ -22892,6 +22605,15 @@ f 5/6/6 1/12/6 8/11/6`; this.SDF_BORDER_OFFSET = 128 / 4; this.PARAMETER_1_OFFSET = 132 / 4; this.PARAMETER_2_OFFSET = 136 / 4; + this.MATERIAL_FUZZ_OFFSET = 140 / 4; + this.MATERIAL_GLOSS_OFFSET = 144 / 4; + this.MATERIAL_DENSITY_OFFSET = 148 / 4; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; + this.MATERIAL_COLOR_OFFSET = 160 / 4; + this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; + this.SEGMENT_COLOR_OFFSET = 176 / 4; + this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; + this.TEXTURE_ID_OFFSET = 196 / 4; } getType(index) { return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; @@ -22951,12 +22673,6 @@ f 5/6/6 1/12/6 8/11/6`; this[offset + 1] = value[1]; this[offset + 2] = value[2]; } - getMaterialId(index) { - return this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET]; - } - setMaterialId(index, value) { - this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET] = value; - } getRotation0(index, value) { const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; set$1(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); @@ -23039,8 +22755,64 @@ f 5/6/6 1/12/6 8/11/6`; setSdfBorder(index, value) { this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; } + getMaterialTypeId(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET]; + } + setMaterialTypeId(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET] = value; + } + getMaterialFuzz(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_FUZZ_OFFSET]; + } + setMaterialFuzz(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_FUZZ_OFFSET] = value; + } + getMaterialDensity(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_DENSITY_OFFSET]; + } + setMaterialDensity(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_DENSITY_OFFSET] = value; + } + getMaterialGloss(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_GLOSS_OFFSET]; + } + setMaterialGloss(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_GLOSS_OFFSET] = value; + } + getMaterialRefractiveIndex(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; + } + setMaterialRefractiveIndex(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value; + } + getMaterialColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.MATERIAL_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + } + setMaterialColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.MATERIAL_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSegmentColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.SEGMENT_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + value[3] = this[offset + 3]; + } + setSegmentColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.SEGMENT_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } } - HittableBufferData.SIZE = 144 / 4; + HittableBufferData.SIZE = 208 / 4; /*! * Copyright (c) Microsoft Corporation. @@ -23057,16 +22829,24 @@ f 5/6/6 1/12/6 8/11/6`; this.SEED_OFFSET = 44 / 4; this.FORWARD_OFFSET = 48 / 4; this.FOV_OFFSET = 60 / 4; - this.LOOKAT_OFFSET = 64 / 4; - this.APERTURE_OFFSET = 76 / 4; - this.BACKGROUND_COLOR_OFFSET = 80 / 4; - this.TIME0_OFFSET = 92 / 4; - this.TIME1_OFFSET = 96 / 4; - this.TILES_X = 100 / 4; - this.TILES_Y = 104 / 4; - this.TILE_OFFSET_X = 108 / 4; - this.TILE_OFFSET_Y = 112 / 4; - this.RAYS_PER_FRAME_OFFSET = 116 / 4; + this.BACKGROUND_COLOR_OFFSET = 64 / 4; + this.TIME0_OFFSET = 76 / 4; + this.AMBIENT_COLOR_OFFSET = 80 / 4; + this.TIME1_OFFSET = 92 / 4; + this.TILES_X = 96 / 4; + this.TILES_Y = 100 / 4; + this.TILE_OFFSET_X = 104 / 4; + this.TILE_OFFSET_Y = 108 / 4; + this.LOOKAT_OFFSET = 112 / 4; + this.APERTURE_OFFSET = 124 / 4; + this.FOCUS_DISTANCE_OFFSET = 128 / 4; + this.RAYS_PER_FRAME_OFFSET = 132 / 4; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value) { + this[this.FOCUS_DISTANCE_OFFSET] = value; } getWidth() { return this[this.WIDTH_OFFSET]; @@ -23136,21 +22916,22 @@ f 5/6/6 1/12/6 8/11/6`; this[this.FORWARD_OFFSET + 1] = value[1]; this[this.FORWARD_OFFSET + 2] = value[2]; } - getLookAt(value) { - set$3(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); - } - setLookAt(value) { - this[this.LOOKAT_OFFSET] = value[0]; - this[this.LOOKAT_OFFSET + 1] = value[1]; - this[this.LOOKAT_OFFSET + 2] = value[2]; - } getBackgroundColor(value) { - set$2(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], 1); + set$2(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); } setBackgroundColor(value) { this[this.BACKGROUND_COLOR_OFFSET] = value[0]; this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value[3]; + } + getAmbientColor(value) { + set$3(value, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); + } + setAmbientColor(value) { + this[this.AMBIENT_COLOR_OFFSET] = value[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value[2]; } getTime0() { return this[this.TIME0_OFFSET]; @@ -23188,8 +22969,16 @@ f 5/6/6 1/12/6 8/11/6`; setTileOffsetY(value) { this[this.TILE_OFFSET_Y] = value; } + getLookAt(value) { + set$3(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value) { + this[this.LOOKAT_OFFSET] = value[0]; + this[this.LOOKAT_OFFSET + 1] = value[1]; + this[this.LOOKAT_OFFSET + 2] = value[2]; + } } - ComputeUniformBufferData.SIZE = 128 / 4; + ComputeUniformBufferData.SIZE = 144 / 4; /*! * Copyright (c) Microsoft Corporation. @@ -23206,6 +22995,8 @@ f 5/6/6 1/12/6 8/11/6`; this.MAX_DEPTH_OFFSET = 20 / 4; this.EDGE_NORMAL_OFFSET = 24 / 4; this.EDGE_DEPTH_OFFSET = 28 / 4; + this.EDGE_FOREGROUND_OFFSET = 32 / 4; + this.EDGE_BACKGROUND_OFFSET = 48 / 4; } getWidth() { return this[this.WIDTH_OFFSET]; @@ -23255,8 +23046,26 @@ f 5/6/6 1/12/6 8/11/6`; setEdgeNormal(value) { this[this.EDGE_NORMAL_OFFSET] = value; } + getEdgeForeground(value) { + set$2(value, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); + } + setEdgeForeground(value) { + this[this.EDGE_FOREGROUND_OFFSET] = value[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value[3]; + } + getEdgeBackground(value) { + set$2(value, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); + } + setEdgeBackground(value) { + this[this.EDGE_BACKGROUND_OFFSET] = value[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value[3]; + } } - FullscreenQuadUniformBufferData.SIZE = 32 / 4; + FullscreenQuadUniformBufferData.SIZE = 64 / 4; /*! * Copyright (c) Microsoft Corporation. @@ -23414,14 +23223,14 @@ f 5/6/6 1/12/6 8/11/6`; * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. */ - function concat$1(...args) { + function concat(...args) { return args.reduce((p, c) => c ? p.concat(c) : p, []); } /** * Returns array with items which are truthy. * @param args array or arrays to concat into a single array. */ - function allTruthy$1(...args) { + function allTruthy(...args) { return args.reduce((p, c) => c ? p.concat(c) : p, []).filter(Boolean); } /** @@ -23680,12 +23489,12 @@ f 5/6/6 1/12/6 8/11/6`; __proto__: null, addDiv: addDiv, addEl: addEl, - allTruthy: allTruthy$1, + allTruthy: allTruthy, clone: clone, colorFromString: colorFromString, colorIsEqual: colorIsEqual, colorToString: colorToString, - concat: concat$1, + concat: concat, createElement: createElement, deepMerge: deepMerge, desaturate: desaturate, @@ -24781,7 +24590,7 @@ f 5/6/6 1/12/6 8/11/6`; */ const key = 'line'; const createLineLayer = (props) => { - const { height, ref, stage, width } = props; + const { height, ref, stage} = props; const { core } = ref; const lines = new Line(core); const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette, } = convert$1(stage, height); @@ -25168,7 +24977,7 @@ f 5/6/6 1/12/6 8/11/6`; if (modelTransitioner.shouldTransition) { modelTransitioner.begin(); } - const props = { ref, stage, height, width, config }; + const props = { ref, stage, height, config }; const cubeLayer = createCubeLayer(props); const lineLayer = createLineLayer(props); const textLayer = createTextLayer(props); @@ -26707,7 +26516,7 @@ f 5/6/6 1/12/6 8/11/6`; * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. */ - const { allTruthy, concat, push } = util$1; + const { push } = util$1; /*! * Copyright (c) Microsoft Corporation. @@ -28807,8 +28616,8 @@ f 5/6/6 1/12/6 8/11/6`; exports.Viewer = Viewer; exports.colorSchemes = colorSchemes; exports.constants = constants$1; - exports.searchExpression = index$3; - exports.specs = index$4; + exports.searchExpression = index$1; + exports.specs = index$2; exports.types = types$1; exports.use = use; exports.util = util; diff --git a/docs/dist/vega-morphcharts/v1/vega-morphcharts.js b/docs/dist/vega-morphcharts/v1/vega-morphcharts.js index dd46df483..d7eb42cf0 100644 --- a/docs/dist/vega-morphcharts/v1/vega-morphcharts.js +++ b/docs/dist/vega-morphcharts/v1/vega-morphcharts.js @@ -1,4045 +1,3863 @@ (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.VegaMorphCharts = {})); + 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.VegaMorphCharts = {})); })(this, (function (exports) { 'use strict'; - function _mergeNamespaces(n, m) { - m.forEach(function (e) { - e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { - if (k !== 'default' && !(k in n)) { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - }); - return Object.freeze(n); - } - - function getDefaultExportFromCjs (x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; - } - - var require$$0$1 = [ - "a", - "abbr", - "address", - "area", - "article", - "aside", - "audio", - "b", - "base", - "bdi", - "bdo", - "blockquote", - "body", - "br", - "button", - "canvas", - "caption", - "cite", - "code", - "col", - "colgroup", - "data", - "datalist", - "dd", - "del", - "details", - "dfn", - "dialog", - "div", - "dl", - "dt", - "em", - "embed", - "fieldset", - "figcaption", - "figure", - "footer", - "form", - "h1", - "h2", - "h3", - "h4", - "h5", - "h6", - "head", - "header", - "hgroup", - "hr", - "html", - "i", - "iframe", - "img", - "input", - "ins", - "kbd", - "keygen", - "label", - "legend", - "li", - "link", - "main", - "map", - "mark", - "math", - "menu", - "menuitem", - "meta", - "meter", - "nav", - "noscript", - "object", - "ol", - "optgroup", - "option", - "output", - "p", - "param", - "picture", - "pre", - "progress", - "q", - "rb", - "rp", - "rt", - "rtc", - "ruby", - "s", - "samp", - "script", - "section", - "select", - "slot", - "small", - "source", - "span", - "strong", - "style", - "sub", - "summary", - "sup", - "svg", - "table", - "tbody", - "td", - "template", - "textarea", - "tfoot", - "th", - "thead", - "time", - "title", - "tr", - "track", - "u", - "ul", - "var", - "video", - "wbr" - ]; - - var htmlTags$1; - var hasRequiredHtmlTags; - - function requireHtmlTags () { - if (hasRequiredHtmlTags) return htmlTags$1; - hasRequiredHtmlTags = 1; - htmlTags$1 = require$$0$1; - return htmlTags$1; - } - - var htmlTagsExports = requireHtmlTags(); - var index$1 = /*@__PURE__*/getDefaultExportFromCjs(htmlTagsExports); - - var htmlTags = /*#__PURE__*/_mergeNamespaces({ - __proto__: null, - default: index$1 - }, [htmlTagsExports]); - - var require$$0 = [ - "a", - "altGlyph", - "altGlyphDef", - "altGlyphItem", - "animate", - "animateColor", - "animateMotion", - "animateTransform", - "circle", - "clipPath", - "color-profile", - "cursor", - "defs", - "desc", - "ellipse", - "feBlend", - "feColorMatrix", - "feComponentTransfer", - "feComposite", - "feConvolveMatrix", - "feDiffuseLighting", - "feDisplacementMap", - "feDistantLight", - "feFlood", - "feFuncA", - "feFuncB", - "feFuncG", - "feFuncR", - "feGaussianBlur", - "feImage", - "feMerge", - "feMergeNode", - "feMorphology", - "feOffset", - "fePointLight", - "feSpecularLighting", - "feSpotLight", - "feTile", - "feTurbulence", - "filter", - "font", - "font-face", - "font-face-format", - "font-face-name", - "font-face-src", - "font-face-uri", - "foreignObject", - "g", - "glyph", - "glyphRef", - "hkern", - "image", - "line", - "linearGradient", - "marker", - "mask", - "metadata", - "missing-glyph", - "mpath", - "path", - "pattern", - "polygon", - "polyline", - "radialGradient", - "rect", - "script", - "set", - "stop", - "style", - "svg", - "switch", - "symbol", - "text", - "textPath", - "title", - "tref", - "tspan", - "use", - "view", - "vkern" - ]; - - var lib; - var hasRequiredLib; - - function requireLib () { - if (hasRequiredLib) return lib; - hasRequiredLib = 1; - lib = require$$0; - return lib; - } - - var libExports = requireLib(); - var index = /*@__PURE__*/getDefaultExportFromCjs(libExports); - - var svgTags = /*#__PURE__*/_mergeNamespaces({ - __proto__: null, - default: index - }, [libExports]); - - const htmlTagArray = index$1 || htmlTags; - const svgTagArray = index || svgTags; - /** - * Decamelizes a string with/without a custom separator (hyphen by default). - * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript - * - * @param str String in camelcase - * @param separator Separator for the new decamelized string. - */ - function decamelize(str, separator = '-') { - return str - .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') - .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2') - .toLowerCase(); - } - function createElement(tag, attrs, ...children) { - if (typeof tag === 'function') { - const fn = tag; - const props = attrs; - props.children = children; - return fn(props); - } - else { - const ns = tagNamespace(tag); - const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); - const map = attrs; - let ref; - for (let name in map) { - if (name && map.hasOwnProperty(name)) { - let value = map[name]; - if (name === 'className' && value !== void 0) { - setAttribute(el, ns, 'class', value.toString()); - } - else if (name === 'disabled' && !value) ; - else if (value === null || value === undefined) { - continue; - } - else if (value === true) { - setAttribute(el, ns, name, name); - } - else if (typeof value === 'function') { - if (name === 'ref') { - ref = value; - } - else { - el[name.toLowerCase()] = value; - } - } - else if (typeof value === 'object') { - setAttribute(el, ns, name, flatten(value)); - } - else { - setAttribute(el, ns, name, value.toString()); - } - } - } - if (children && children.length > 0) { - appendChildren(el, children); - } - if (ref) { - ref(el); - } - return el; - } - } - function setAttribute(el, ns, name, value) { - if (ns) { - el.setAttributeNS(null, name, value); - } - else { - el.setAttribute(name, value); - } - } - function flatten(o) { - const arr = []; - for (let prop in o) - arr.push(`${decamelize(prop, '-')}:${o[prop]}`); - return arr.join(';'); - } - function addChild(parentElement, child) { - if (child === null || child === undefined || typeof child === "boolean") { - return; - } - else if (Array.isArray(child)) { - appendChildren(parentElement, child); - } - else if (isElement(child)) { - parentElement.appendChild(child); - } - else { - parentElement.appendChild(document.createTextNode(child.toString())); - } - } - function appendChildren(parentElement, children) { - children.forEach(child => addChild(parentElement, child)); - } - function isElement(el) { - //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType - return !!el.nodeType; - } - function mount(element, container) { - container.innerHTML = ''; - if (element) { - addChild(container, element); - } - } - function findElementByChildPositions(childPositions, container) { - let element = container || document.body; - let childPosition; - while (element && childPositions.length) { - childPosition = childPositions.shift(); - element = element.children.item(childPosition); - } - if (element) { - return element; - } - } - function focusActiveElement(element, activeElementInfo) { - element.focus(); - element.scrollTop = activeElementInfo.scrollTop; - const input = element; - if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) { - input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); - } - } - function setActiveElement(activeElementInfo, container) { - if (activeElementInfo) { - const element = findElementByChildPositions(activeElementInfo.childPositions, container); - if (element) { - focusActiveElement(element, activeElementInfo); - } - } - } - function getActiveElementInfo(container) { - let element = document.activeElement; - const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element; - const activeElementInfo = { - childPositions: [], - scrollTop, - selectionDirection, - selectionEnd, - selectionStart - }; - while (element && element !== document.body && element !== container) { - activeElementInfo.childPositions.unshift(getChildPosition(element)); - element = element.parentElement; - } - if ((element === document.body || element === container) && activeElementInfo.childPositions.length) - return activeElementInfo; - } - function getChildPosition(element) { - let childPosition = 0; - while (element = element.previousElementSibling) - childPosition++; - return childPosition; - } - function tagNamespace(tag) { - //issue: this won't disambiguate certain tags which exist in both svg and html: <a>, <title> ... - if (tag === 'svg' || (svgTagArray.indexOf(tag) >= 0 && !(htmlTagArray.indexOf(tag) >= 0))) { - return "http://www.w3.org/2000/svg"; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const KeyCodes = { - ENTER: 'Enter', - }; - const Table = (props) => { - return (createElement("table", { className: props.className }, - props.children, - props.rows.map((row, i) => (createElement("tr", { className: props.rowClassName || '', onClick: e => props.onRowClick && props.onRowClick(e, i), tabIndex: props.onRowClick ? 0 : -1, onKeyUp: e => { - if (e.key === KeyCodes.ENTER && props.onRowClick) { - props.onRowClick(e, i); - } - } }, row.cells.map((cell, i) => (createElement("td", { className: cell.className || '', title: cell.title || '' }, cell.content)))))))); - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ - - var controls = /*#__PURE__*/Object.freeze({ - __proto__: null, - Table: Table - }); - - /** - * Common utilities - * @module glMatrix - */ - // Configuration Constants - var EPSILON = 0.000001; - var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; - /** - * Sets the type of array used when creating new vectors and matrices - * - * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array - */ - - function setMatrixArrayType(type) { - ARRAY_TYPE = type; - } - if (!Math.hypot) Math.hypot = function () { - var y = 0, - i = arguments.length; - - while (i--) { - y += arguments[i] * arguments[i]; - } - - return Math.sqrt(y); - }; - - /** - * 3x3 Matrix - * @module mat3 - */ - - /** - * Creates a new identity mat3 - * - * @returns {mat3} a new 3x3 matrix - */ - - function create$5() { - var out = new ARRAY_TYPE(9); - - if (ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; - } - - out[0] = 1; - out[4] = 1; - out[8] = 1; - return out; - } - /** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param {mat3} out the receiving 3x3 matrix - * @param {ReadonlyMat4} a the source 4x4 matrix - * @returns {mat3} out - */ - - function fromMat4(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; - return out; - } - /** - * Create a new mat3 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} A new mat3 - */ - - function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { - var out = new ARRAY_TYPE(9); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; - return out; - } - /** - * Calculates a 3x3 matrix from the given quaternion - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat3} out - */ - - function fromQuat$1(out, q) { - var x = q[0], - y = q[1], - z = q[2], - w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - yy - zz; - out[3] = yx - wz; - out[6] = zx + wy; - out[1] = yx + wz; - out[4] = 1 - xx - zz; - out[7] = zy - wx; - out[2] = zx - wy; - out[5] = zy + wx; - out[8] = 1 - xx - yy; - return out; - } - - /** - * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied. - * @module mat4 - */ - - /** - * Creates a new identity mat4 - * - * @returns {mat4} a new 4x4 matrix - */ - - function create$4() { - var out = new ARRAY_TYPE(16); - - if (ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - } - - out[0] = 1; - out[5] = 1; - out[10] = 1; - out[15] = 1; - return out; - } - /** - * Copy the values from one mat4 to another - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ - - function copy$4(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; - } - /** - * Create a new mat4 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} A new mat4 - */ - - function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - var out = new ARRAY_TYPE(16); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; - } - /** - * Set a mat4 to the identity matrix - * - * @param {mat4} out the receiving matrix - * @returns {mat4} out - */ - - function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; - } - /** - * Inverts a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ - - function invert(out, a) { - var a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3]; - var a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7]; - var a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; - var a30 = a[12], - a31 = a[13], - a32 = a[14], - a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - if (!det) { - return null; - } - - det = 1.0 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - return out; - } - /** - * Multiplies two mat4s - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ - - function multiply$2(out, a, b) { - var a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3]; - var a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7]; - var a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; - var a30 = a[12], - a31 = a[13], - a32 = a[14], - a33 = a[15]; // Cache only the current line of the second matrix - - var b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3]; - out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - return out; - } - /** - * Translate a mat4 by the given vector - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to translate - * @param {ReadonlyVec3} v vector to translate by - * @returns {mat4} out - */ - - function translate(out, a, v) { - var x = v[0], - y = v[1], - z = v[2]; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - - if (a === out) { - out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - } else { - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a03; - out[4] = a10; - out[5] = a11; - out[6] = a12; - out[7] = a13; - out[8] = a20; - out[9] = a21; - out[10] = a22; - out[11] = a23; - out[12] = a00 * x + a10 * y + a20 * z + a[12]; - out[13] = a01 * x + a11 * y + a21 * z + a[13]; - out[14] = a02 * x + a12 * y + a22 * z + a[14]; - out[15] = a03 * x + a13 * y + a23 * z + a[15]; - } - - return out; - } - /** - * Scales the mat4 by the dimensions in the given vec3 not using vectorization - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {ReadonlyVec3} v the vec3 to scale the matrix by - * @returns {mat4} out - **/ - - function scale$1(out, a, v) { - var x = v[0], - y = v[1], - z = v[2]; - out[0] = a[0] * x; - out[1] = a[1] * x; - out[2] = a[2] * x; - out[3] = a[3] * x; - out[4] = a[4] * y; - out[5] = a[5] * y; - out[6] = a[6] * y; - out[7] = a[7] * y; - out[8] = a[8] * z; - out[9] = a[9] * z; - out[10] = a[10] * z; - out[11] = a[11] * z; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; - } - /** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.scale(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Scaling vector - * @returns {mat4} out - */ - - function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = v[1]; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = v[2]; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; - } - /** - * Creates a matrix from a quaternion rotation, vector translation and vector scale - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @returns {mat4} out - */ - - function fromRotationTranslationScale(out, q, v, s) { - // Quaternion math - var x = q[0], - y = q[1], - z = q[2], - w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - out[0] = (1 - (yy + zz)) * sx; - out[1] = (xy + wz) * sx; - out[2] = (xz - wy) * sx; - out[3] = 0; - out[4] = (xy - wz) * sy; - out[5] = (1 - (xx + zz)) * sy; - out[6] = (yz + wx) * sy; - out[7] = 0; - out[8] = (xz + wy) * sz; - out[9] = (yz - wx) * sz; - out[10] = (1 - (xx + yy)) * sz; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; - } - /** - * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @param {ReadonlyVec3} o The origin vector around which to scale and rotate - * @returns {mat4} out - */ - - function fromRotationTranslationScaleOrigin(out, q, v, s, o) { - // Quaternion math - var x = q[0], - y = q[1], - z = q[2], - w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - var ox = o[0]; - var oy = o[1]; - var oz = o[2]; - var out0 = (1 - (yy + zz)) * sx; - var out1 = (xy + wz) * sx; - var out2 = (xz - wy) * sx; - var out4 = (xy - wz) * sy; - var out5 = (1 - (xx + zz)) * sy; - var out6 = (yz + wx) * sy; - var out8 = (xz + wy) * sz; - var out9 = (yz - wx) * sz; - var out10 = (1 - (xx + yy)) * sz; - out[0] = out0; - out[1] = out1; - out[2] = out2; - out[3] = 0; - out[4] = out4; - out[5] = out5; - out[6] = out6; - out[7] = 0; - out[8] = out8; - out[9] = out9; - out[10] = out10; - out[11] = 0; - out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); - out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); - out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); - out[15] = 1; - return out; - } - /** - * Calculates a 4x4 matrix from the given quaternion - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat4} out - */ - - function fromQuat(out, q) { - var x = q[0], - y = q[1], - z = q[2], - w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - yy - zz; - out[1] = yx + wz; - out[2] = zx - wy; - out[3] = 0; - out[4] = yx - wz; - out[5] = 1 - xx - zz; - out[6] = zy + wx; - out[7] = 0; - out[8] = zx + wy; - out[9] = zy - wx; - out[10] = 1 - xx - yy; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; - } - /** - * Generates a frustum matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Number} left Left bound of the frustum - * @param {Number} right Right bound of the frustum - * @param {Number} bottom Bottom bound of the frustum - * @param {Number} top Top bound of the frustum - * @param {Number} near Near bound of the frustum - * @param {Number} far Far bound of the frustum - * @returns {mat4} out - */ - - function frustum(out, left, right, bottom, top, near, far) { - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - out[0] = near * 2 * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = near * 2 * tb; - out[6] = 0; - out[7] = 0; - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = far * near * 2 * nf; - out[15] = 0; - return out; - } - /** - * Generates a perspective projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ - - function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), - nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = (far + near) * nf; - out[14] = 2 * far * near * nf; - } else { - out[10] = -1; - out[14] = -2 * near; - } - - return out; - } - /** - * Alias for {@link mat4.perspectiveNO} - * @function - */ - - var perspective = perspectiveNO; - /** - * Generates a look-at matrix with the given eye position, focal point, and up axis. - * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ - - function lookAt(out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; - var eyex = eye[0]; - var eyey = eye[1]; - var eyez = eye[2]; - var upx = up[0]; - var upy = up[1]; - var upz = up[2]; - var centerx = center[0]; - var centery = center[1]; - var centerz = center[2]; - - if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) { - return identity(out); - } - - z0 = eyex - centerx; - z1 = eyey - centery; - z2 = eyez - centerz; - len = 1 / Math.hypot(z0, z1, z2); - z0 *= len; - z1 *= len; - z2 *= len; - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len = Math.hypot(x0, x1, x2); - - if (!len) { - x0 = 0; - x1 = 0; - x2 = 0; - } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - len = Math.hypot(y0, y1, y2); - - if (!len) { - y0 = 0; - y1 = 0; - y2 = 0; - } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - return out; - } - /** - * Alias for {@link mat4.multiply} - * @function - */ - - var mul = multiply$2; - - /** - * 3 Dimensional Vector - * @module vec3 - */ - - /** - * Creates a new, empty vec3 - * - * @returns {vec3} a new 3D vector - */ - - function create$3() { - var out = new ARRAY_TYPE(3); - - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - - return out; - } - /** - * Creates a new vec3 initialized with values from an existing vector - * - * @param {ReadonlyVec3} a vector to clone - * @returns {vec3} a new 3D vector - */ - - function clone$4(a) { - var out = new ARRAY_TYPE(3); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; - } - /** - * Calculates the length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate length of - * @returns {Number} length of a - */ - - function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return Math.hypot(x, y, z); - } - /** - * Creates a new vec3 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} a new 3D vector - */ - - function fromValues$3(x, y, z) { - var out = new ARRAY_TYPE(3); - out[0] = x; - out[1] = y; - out[2] = z; - return out; - } - /** - * Copy the values from one vec3 to another - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the source vector - * @returns {vec3} out - */ - - function copy$3(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; - } - /** - * Set the components of a vec3 to the given values - * - * @param {vec3} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} out - */ - - function set$3(out, x, y, z) { - out[0] = x; - out[1] = y; - out[2] = z; - return out; - } - /** - * Adds two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ - - function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - return out; - } - /** - * Subtracts vector b from vector a - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ - - function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - return out; - } - /** - * Multiplies two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ - - function multiply$1(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - return out; - } - /** - * Returns the minimum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ - - function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - return out; - } - /** - * Returns the maximum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ - - function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - return out; - } - /** - * Scales a vec3 by a scalar number - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec3} out - */ - - function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - return out; - } - /** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec3} out - */ - - function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - return out; - } - /** - * Calculates the euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} distance between a and b - */ - - function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return Math.hypot(x, y, z); - } - /** - * Calculates the squared euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} squared distance between a and b - */ - - function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return x * x + y * y + z * z; - } - /** - * Calculates the squared length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate squared length of - * @returns {Number} squared length of a - */ - - function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return x * x + y * y + z * z; - } - /** - * Negates the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to negate - * @returns {vec3} out - */ - - function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - return out; - } - /** - * Normalize a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to normalize - * @returns {vec3} out - */ - - function normalize$2(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var len = x * x + y * y + z * z; - - if (len > 0) { - //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - } - - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - return out; - } - /** - * Calculates the dot product of two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} dot product of a and b - */ - - function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; - } - /** - * Computes the cross product of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ - - function cross(out, a, b) { - var ax = a[0], - ay = a[1], - az = a[2]; - var bx = b[0], - by = b[1], - bz = b[2]; - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; - } - /** - * Performs a linear interpolation between two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ - - function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - return out; - } - /** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec3} out - */ - - function transformMat4$2(out, a, m) { - var x = a[0], - y = a[1], - z = a[2]; - var w = m[3] * x + m[7] * y + m[11] * z + m[15]; - w = w || 1.0; - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return out; - } - /** - * Transforms the vec3 with a mat3. - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat3} m the 3x3 matrix to transform with - * @returns {vec3} out - */ - - function transformMat3(out, a, m) { - var x = a[0], - y = a[1], - z = a[2]; - out[0] = x * m[0] + y * m[3] + z * m[6]; - out[1] = x * m[1] + y * m[4] + z * m[7]; - out[2] = x * m[2] + y * m[5] + z * m[8]; - return out; - } - /** - * Transforms the vec3 with a quat - * Can also be used for dual quaternions. (Multiply it with the real part) - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec3} out - */ - - function transformQuat(out, a, q) { - // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed - var qx = q[0], - qy = q[1], - qz = q[2], - qw = q[3]; - var x = a[0], - y = a[1], - z = a[2]; // var qvec = [qx, qy, qz]; - // var uv = vec3.cross([], qvec, a); - - var uvx = qy * z - qz * y, - uvy = qz * x - qx * z, - uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); - - var uuvx = qy * uvz - qz * uvy, - uuvy = qz * uvx - qx * uvz, - uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); - - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; // vec3.scale(uuv, uuv, 2); - - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); - - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; - return out; - } - /** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ - - function exactEquals$1(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; - } - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ - - function equals$3(a, b) { - var a0 = a[0], - a1 = a[1], - a2 = a[2]; - var b0 = b[0], - b1 = b[1], - b2 = b[2]; - return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)); - } - /** - * Alias for {@link vec3.length} - * @function - */ - - var len = length; - /** - * Perform some operation over an array of vec3s. - * - * @param {Array} a the array of vectors to iterate over - * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed - * @param {Number} offset Number of elements to skip at the beginning of the array - * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array - * @param {Function} fn Function to call for each vector in the array - * @param {Object} [arg] additional argument to pass to fn - * @returns {Array} a - * @function - */ - - (function () { - var vec = create$3(); - return function (a, stride, offset, count, fn, arg) { - var i, l; - - if (!stride) { - stride = 3; - } - - if (!offset) { - offset = 0; - } - - if (count) { - l = Math.min(count * stride + offset, a.length); - } else { - l = a.length; - } - - for (i = offset; i < l; i += stride) { - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - } - - return a; - }; - })(); - - /** - * 4 Dimensional Vector - * @module vec4 - */ - - /** - * Creates a new, empty vec4 - * - * @returns {vec4} a new 4D vector - */ - - function create$2() { - var out = new ARRAY_TYPE(4); - - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - } - - return out; - } - /** - * Creates a new vec4 initialized with values from an existing vector - * - * @param {ReadonlyVec4} a vector to clone - * @returns {vec4} a new 4D vector - */ - - function clone$3(a) { - var out = new ARRAY_TYPE(4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; - } - /** - * Creates a new vec4 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} a new 4D vector - */ - - function fromValues$2(x, y, z, w) { - var out = new ARRAY_TYPE(4); - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; - } - /** - * Copy the values from one vec4 to another - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the source vector - * @returns {vec4} out - */ - - function copy$2(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; - } - /** - * Set the components of a vec4 to the given values - * - * @param {vec4} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} out - */ - - function set$2(out, x, y, z, w) { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; - } - /** - * Normalize a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to normalize - * @returns {vec4} out - */ - - function normalize$1(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - var len = x * x + y * y + z * z + w * w; - - if (len > 0) { - len = 1 / Math.sqrt(len); - } - - out[0] = x * len; - out[1] = y * len; - out[2] = z * len; - out[3] = w * len; - return out; - } - /** - * Transforms the vec4 with a mat4. - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec4} out - */ - - function transformMat4$1(out, a, m) { - var x = a[0], - y = a[1], - z = a[2], - w = a[3]; - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return out; - } - /** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ - - function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; - } - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ - - function equals$2(a, b) { - var a0 = a[0], - a1 = a[1], - a2 = a[2], - a3 = a[3]; - var b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3]; - return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); - } - /** - * Perform some operation over an array of vec4s. - * - * @param {Array} a the array of vectors to iterate over - * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed - * @param {Number} offset Number of elements to skip at the beginning of the array - * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array - * @param {Function} fn Function to call for each vector in the array - * @param {Object} [arg] additional argument to pass to fn - * @returns {Array} a - * @function - */ - - (function () { - var vec = create$2(); - return function (a, stride, offset, count, fn, arg) { - var i, l; - - if (!stride) { - stride = 4; - } - - if (!offset) { - offset = 0; - } - - if (count) { - l = Math.min(count * stride + offset, a.length); - } else { - l = a.length; - } - - for (i = offset; i < l; i += stride) { - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - vec[3] = a[i + 3]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - a[i + 3] = vec[3]; - } - - return a; - }; - })(); - - /** - * Quaternion - * @module quat - */ - - /** - * Creates a new identity quat - * - * @returns {quat} a new quaternion - */ - - function create$1() { - var out = new ARRAY_TYPE(4); - - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - - out[3] = 1; - return out; - } - /** - * Sets a quat from the given angle and rotation axis, - * then returns it. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyVec3} axis the axis around which to rotate - * @param {Number} rad the angle in radians - * @returns {quat} out - **/ - - function setAxisAngle(out, axis, rad) { - rad = rad * 0.5; - var s = Math.sin(rad); - out[0] = s * axis[0]; - out[1] = s * axis[1]; - out[2] = s * axis[2]; - out[3] = Math.cos(rad); - return out; - } - /** - * Multiplies two quat's - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @returns {quat} out - */ - - function multiply(out, a, b) { - var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; - var bx = b[0], - by = b[1], - bz = b[2], - bw = b[3]; - out[0] = ax * bw + aw * bx + ay * bz - az * by; - out[1] = ay * bw + aw * by + az * bx - ax * bz; - out[2] = az * bw + aw * bz + ax * by - ay * bx; - out[3] = aw * bw - ax * bx - ay * by - az * bz; - return out; - } - /** - * Rotates a quaternion by the given angle about the X axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ - - function rotateX(out, a, rad) { - rad *= 0.5; - var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; - var bx = Math.sin(rad), - bw = Math.cos(rad); - out[0] = ax * bw + aw * bx; - out[1] = ay * bw + az * bx; - out[2] = az * bw - ay * bx; - out[3] = aw * bw - ax * bx; - return out; - } - /** - * Rotates a quaternion by the given angle about the Y axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ - - function rotateY(out, a, rad) { - rad *= 0.5; - var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; - var by = Math.sin(rad), - bw = Math.cos(rad); - out[0] = ax * bw - az * by; - out[1] = ay * bw + aw * by; - out[2] = az * bw + ax * by; - out[3] = aw * bw - ay * by; - return out; - } - /** - * Performs a spherical linear interpolation between two quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {quat} out - */ - - function slerp(out, a, b, t) { - // benchmarks: - // http://jsperf.com/quaternion-slerp-implementations - var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; - var bx = b[0], - by = b[1], - bz = b[2], - bw = b[3]; - var omega, cosom, sinom, scale0, scale1; // calc cosine - - cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) - - if (cosom < 0.0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } // calculate coefficients - - - if (1.0 - cosom > EPSILON) { - // standard case (slerp) - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } else { - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - scale0 = 1.0 - t; - scale1 = t; - } // calculate final values - - - out[0] = scale0 * ax + scale1 * bx; - out[1] = scale0 * ay + scale1 * by; - out[2] = scale0 * az + scale1 * bz; - out[3] = scale0 * aw + scale1 * bw; - return out; - } - /** - * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate conjugate of - * @returns {quat} out - */ - - function conjugate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a[3]; - return out; - } - /** - * Creates a quaternion from the given 3x3 rotation matrix. - * - * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyMat3} m rotation matrix - * @returns {quat} out - * @function - */ - - function fromMat3(out, m) { - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var fTrace = m[0] + m[4] + m[8]; - var fRoot; - - if (fTrace > 0.0) { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w - - out[3] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; // 1/(4w) - - out[0] = (m[5] - m[7]) * fRoot; - out[1] = (m[6] - m[2]) * fRoot; - out[2] = (m[1] - m[3]) * fRoot; - } else { - // |w| <= 1/2 - var i = 0; - if (m[4] > m[0]) i = 1; - if (m[8] > m[i * 3 + i]) i = 2; - var j = (i + 1) % 3; - var k = (i + 2) % 3; - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; - out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; - } - - return out; - } - /** - * Creates a new quat initialized with values from an existing quaternion - * - * @param {ReadonlyQuat} a quaternion to clone - * @returns {quat} a new quaternion - * @function - */ - - var clone$2 = clone$3; - /** - * Creates a new quat initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {quat} a new quaternion - * @function - */ - - var fromValues$1 = fromValues$2; - /** - * Copy the values from one quat to another - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the source quaternion - * @returns {quat} out - * @function - */ - - var copy$1 = copy$2; - /** - * Set the components of a quat to the given values - * - * @param {quat} out the receiving quaternion - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {quat} out - * @function - */ - - var set$1 = set$2; - /** - * Normalize a quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quaternion to normalize - * @returns {quat} out - * @function - */ - - var normalize = normalize$1; - /** - * Returns whether or not the quaternions have approximately the same elements in the same position. - * - * @param {ReadonlyQuat} a The first vector. - * @param {ReadonlyQuat} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ - - var equals$1 = equals$2; - /** - * Sets a quaternion to represent the shortest rotation from one - * vector to another. - * - * Both vectors are assumed to be unit length. - * - * @param {quat} out the receiving quaternion. - * @param {ReadonlyVec3} a the initial vector - * @param {ReadonlyVec3} b the destination vector - * @returns {quat} out - */ - - var rotationTo = function () { - var tmpvec3 = create$3(); - var xUnitVec3 = fromValues$3(1, 0, 0); - var yUnitVec3 = fromValues$3(0, 1, 0); - return function (out, a, b) { - var dot$1 = dot(a, b); - - if (dot$1 < -0.999999) { - cross(tmpvec3, xUnitVec3, a); - if (len(tmpvec3) < 0.000001) cross(tmpvec3, yUnitVec3, a); - normalize$2(tmpvec3, tmpvec3); - setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot$1 > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; - } else { - cross(tmpvec3, a, b); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot$1; - return normalize(out, out); - } - }; - }(); - /** - * Performs a spherical linear interpolation with two control points - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @param {ReadonlyQuat} c the third operand - * @param {ReadonlyQuat} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {quat} out - */ - - (function () { - var temp1 = create$1(); - var temp2 = create$1(); - return function (out, a, b, c, d, t) { - slerp(temp1, a, d, t); - slerp(temp2, b, c, t); - slerp(out, temp1, temp2, 2 * t * (1 - t)); - return out; - }; - })(); - /** - * Sets the specified quaternion with values corresponding to the given - * axes. Each axis is a vec3 and is expected to be unit length and - * perpendicular to all other specified axes. - * - * @param {ReadonlyVec3} view the vector representing the viewing direction - * @param {ReadonlyVec3} right the vector representing the local "right" direction - * @param {ReadonlyVec3} up the vector representing the local "up" direction - * @returns {quat} out - */ - - (function () { - var matr = create$5(); - return function (out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - return normalize(out, fromMat3(out, matr)); - }; - })(); - - /** - * 2 Dimensional Vector - * @module vec2 - */ - - /** - * Creates a new, empty vec2 - * - * @returns {vec2} a new 2D vector - */ - - function create() { - var out = new ARRAY_TYPE(2); - - if (ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - } - - return out; - } - /** - * Creates a new vec2 initialized with values from an existing vector - * - * @param {ReadonlyVec2} a vector to clone - * @returns {vec2} a new 2D vector - */ - - function clone$1(a) { - var out = new ARRAY_TYPE(2); - out[0] = a[0]; - out[1] = a[1]; - return out; - } - /** - * Creates a new vec2 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} a new 2D vector - */ - - function fromValues(x, y) { - var out = new ARRAY_TYPE(2); - out[0] = x; - out[1] = y; - return out; - } - /** - * Copy the values from one vec2 to another - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the source vector - * @returns {vec2} out - */ - - function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - return out; - } - /** - * Set the components of a vec2 to the given values - * - * @param {vec2} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} out - */ - - function set(out, x, y) { - out[0] = x; - out[1] = y; - return out; - } - /** - * Transforms the vec2 with a mat4 - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec2} out - */ - - function transformMat4(out, a, m) { - var x = a[0]; - var y = a[1]; - out[0] = m[0] * x + m[4] * y + m[12]; - out[1] = m[1] * x + m[5] * y + m[13]; - return out; - } - /** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ - - function equals(a, b) { - var a0 = a[0], - a1 = a[1]; - var b0 = b[0], - b1 = b[1]; - return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)); - } - /** - * Perform some operation over an array of vec2s. - * - * @param {Array} a the array of vectors to iterate over - * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed - * @param {Number} offset Number of elements to skip at the beginning of the array - * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array - * @param {Function} fn Function to call for each vector in the array - * @param {Object} [arg] additional argument to pass to fn - * @returns {Array} a - * @function - */ - - (function () { - var vec = create(); - return function (a, stride, offset, count, fn, arg) { - var i, l; - - if (!stride) { - stride = 2; - } - - if (!offset) { - offset = 0; - } - - if (count) { - l = Math.min(count * stride + offset, a.length); - } else { - l = a.length; - } - - for (i = offset; i < l; i += stride) { - vec[0] = a[i]; - vec[1] = a[i + 1]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - } - - return a; - }; - })(); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Constants { - } - Constants.TWO_PI = 6.283185307179586; - Constants.PI = 3.141592653589793; - Constants.PI_OVER_TWO = 1.5707963267948966; - Constants.PI_OVER_THREE = 1.0471975511965976; - Constants.PI_OVER_FOUR = 0.7853981633974483; - Constants.PI_OVER_SIX = 0.5235987755982988; - Constants.LOG_2 = 0.6931471805599453; - Constants.RADIANS_PER_DEGREE = 0.017453292519943295; - Constants.DEGREES_PER_RADIAN = 57.29577951308232; - Constants.ROOT_TWO = 1.4142135623730951; - Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; - Constants.ROOT_THREE = 1.7320508075688772; - Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; - Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; - Constants.VECTOR2_ZERO = fromValues(0, 0); - Constants.VECTOR2_ONE = fromValues(1, 1); - Constants.VECTOR2_UNITX = fromValues(1, 0); - Constants.VECTOR2_UNITY = fromValues(0, 1); - Constants.VECTOR3_ZERO = fromValues$3(0, 0, 0); - Constants.VECTOR3_ONE = fromValues$3(1, 1, 1); - Constants.VECTOR3_UNITX = fromValues$3(1, 0, 0); - Constants.VECTOR3_UNITY = fromValues$3(0, 1, 0); - Constants.VECTOR3_UNITZ = fromValues$3(0, 0, 1); - Constants.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); - Constants.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); - Constants.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); - Constants.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); - Constants.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); - Constants.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); - Constants.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); - Constants.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); - Constants.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); - Constants.MAT3_IDENTITY = create$5(); - Constants.MAT4_IDENTITY = create$4(); - Constants.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - Constants.QUAT_IDENTITY = create$1(); - Constants.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); - Constants.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); - Constants.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); - Constants.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); - Constants.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); - Constants.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); - Constants.MILLISECONDS_PER_DAY = 86400000; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class MathHelper { - static simpleLinearRegression(points) { - const n = points.length; - let sumX = 0; - let sumY = 0; - let sumXY = 0; - let sumXX = 0; - for (let i = 0; i < n; i++) { - sumX += points[i].x; - sumY += points[i].y; - sumXY += points[i].x * points[i].y; - sumXX += points[i].x * points[i].x; - } - const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); - const yIntercept = (sumY - slope * sumX) / n; - return { slope, yIntercept }; - } - static clamp(value, min, max) { - return Math.max(Math.min(value, max), min); - } - static lerp(value1, value2, amount) { - return value1 + (value2 - value1) * amount; - } - static normalize(value, min, max, from = 0, to = 1) { - return max - min == 0 ? 0 : Math.max(Math.min((to - from) * (value - min) / (max - min) + from, to), from); - } - static splitExponent(value, result) { - let exponent = Math.round(Math.log10(Math.abs(value))); - let coefficient = value / Math.pow(10, exponent); - if (coefficient < 1) { - coefficient *= 10; - exponent--; - } - result[0] = coefficient; - result[1] = exponent; - } - static combineExponent(mantissa, exponent) { - return mantissa * Math.pow(10, exponent); - } - static isPowerOf2(value) { - return (value & (value - 1)) == 0; - } - } - class PseudoRandom { - constructor(seed) { - this._seed = seed % 2147483647; - if (this._seed <= 0) - this._seed += 2147483646; - } - next() { - return this._seed = this._seed * 16807 % 2147483647; - } - ; - nextFloat() { - return (this.next() - 1) / 2147483646; - } - ; - nextInteger(min, max) { - return Math.floor(this.nextFloat() * (max - min + 1) + min); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class AngleHelper { - static degreesToRadians(degrees) { - return degrees * Constants.RADIANS_PER_DEGREE; - } - static radiansToDegrees(radians) { - return radians * Constants.DEGREES_PER_RADIAN; - } - static wrapAngle(angle) { - if (angle > Constants.PI) - angle = angle - Constants.TWO_PI; - else if (angle < -Constants.PI) - angle += Constants.TWO_PI; - return angle; - } - static sphericalToCartesian(altitude, longitude, latitude, result) { - latitude = AngleHelper.degreesToRadians(latitude); - longitude = AngleHelper.degreesToRadians(longitude); - const scale = Math.cos(latitude); - result[0] = altitude * scale * Math.sin(longitude); - result[1] = altitude * Math.sin(latitude); - result[2] = altitude * scale * Math.cos(longitude); - } - static cartesianToSpherical(x, y, z, result) { - result[0] = Math.atan2(x, z); - result[1] = Math.asin(y); - } - static angleBetweenVectors(from, to) { - if (exactEquals$1(from, to)) { - return 0; - } - else { - const dot$1 = MathHelper.clamp(dot(from, to), -1, 1); - return Math.acos(dot$1); - } - } - static signedAngleBetweenVectors(from, to, up) { - if (exactEquals$1(from, to)) { - return 0; - } - else { - const dot$1 = MathHelper.clamp(dot(from, to), -1, 1); - let angle = Math.acos(dot$1); - cross(AngleHelper._vec3, from, to); - if (dot(AngleHelper._vec3, up) < 0) { - angle = -angle; - } - return angle; - } - } - } - AngleHelper._vec3 = create$3(); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class CameraBase { - getView(view) { - this.getPosition(view.position); - } - setView(view, isSmooth) { - this.setPosition(view.position, isSmooth); - } - lerpView(from, to, time) { - lerp(this._vec3, from.position, to.position, time); - this.setPosition(this._vec3, false); - } - get vMatrices() { return this._vMatrices; } - get inverseVMatrices() { return this._inverseVMatrices; } - get mvMatrices() { return this._mvMatrices; } - get pMatrices() { return this._pMatrices; } - get inversePMatrices() { return this._inversePMatrices; } - get pickVMatrix() { return this._pickVMatrix; } - get rMatrix() { return this._mat3; } - getOrbit(value) { copy$1(value, this._orbitRotation); } - setOrbit(value, isSmooth) { - copy$1(this._orbitRotation, value); - if (!isSmooth) { - copy$1(this._smoothedOrbitRotation, value); - } - } - ; - getPosition(value) { copy$3(value, this._cameraPosition); } - setPosition(value, isSmooth) { - copy$3(this._cameraPosition, value); - if (!isSmooth) { - copy$3(this._smoothedCameraPosition, value); - } - } - ; - constructor(core) { - this._core = core; - this._vec3 = create$3(); - this._quat = create$1(); - this._mat3 = create$5(); - this._right = create$3(); - this._up = create$3(); - this._forward = create$3(); - this._modelManipulationOrigin = create$3(); - this.modelPosition = create$3(); - this.modelScale = create$3(); - this.modelRotation = create$1(); - this._orbitRotation = create$1(); - this._orbitDirection = create$1(); - this._smoothedOrbitRotation = create$1(); - this._smoothedCameraPosition = create$3(); - this._smoothedCameraRotation = create$1(); - this._cameraPosition = create$3(); - this._cameraRotation = create$1(); - this._combinedPosition = create$3(); - this._combinedRotation = create$1(); - this._leftToRightEye = create$3(); - this._pickVMatrix = create$4(); - this._eyePositions = [create$3(), create$3()]; - this._vMatrices = [create$4(), create$4()]; - this._mvMatrices = [create$4(), create$4()]; - this._pMatrices = [create$4(), create$4()]; - this._inverseVMatrices = [create$4(), create$4()]; - this._inversePMatrices = [create$4(), create$4()]; - } - reset(isSmooth) { - copy$3(this._cameraPosition, Constants.VECTOR3_ZERO); - copy$1(this._cameraRotation, Constants.QUAT_IDENTITY); - copy$1(this._orbitRotation, Constants.QUAT_IDENTITY); - if (!isSmooth) { - this.syncSmooth(); - } - } - update(elapsedTime) { - let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); - lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); - amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); - slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); - slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); - const epsilon = 0.000001; - let x; - let y; - let z; - let w; - x = this._smoothedCameraPosition[0] - this._cameraPosition[0]; - y = this._smoothedCameraPosition[1] - this._cameraPosition[1]; - z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon) { - copy$3(this._smoothedCameraPosition, this._cameraPosition); - } - x = this._smoothedCameraRotation[0] - this._cameraRotation[0]; - y = this._smoothedCameraRotation[1] - this._cameraRotation[1]; - z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; - w = this._smoothedCameraRotation[3] - this._cameraRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) { - copy$1(this._smoothedCameraRotation, this._cameraRotation); - } - x = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; - y = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; - z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; - w = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) { - copy$1(this._smoothedOrbitRotation, this._orbitRotation); - } - normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); - normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); - conjugate(this._orbitDirection, this._smoothedOrbitRotation); - transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); - subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); - transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); - add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); - multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); - fromQuat$1(this._mat3, this._combinedRotation); - this._right[0] = this._mat3[0]; - this._right[1] = this._mat3[1]; - this._right[2] = this._mat3[2]; - this._up[0] = this._mat3[3]; - this._up[1] = this._mat3[4]; - this._up[2] = this._mat3[5]; - this._forward[0] = this._mat3[6]; - this._forward[1] = this._mat3[7]; - this._forward[2] = this._mat3[8]; - const view = this._vMatrices[0]; - view[0] = this._right[0]; - view[1] = this._up[0]; - view[2] = this._forward[0]; - view[4] = this._right[1]; - view[5] = this._up[1]; - view[6] = this._forward[1]; - view[8] = this._right[2]; - view[9] = this._up[2]; - view[10] = this._forward[2]; - view[12] = -dot(this._right, this._combinedPosition); - view[13] = -dot(this._up, this._combinedPosition); - view[14] = -dot(this._forward, this._combinedPosition); - const aspectRatio = this.width / this.height; - if (this._core.config.stereoMode == StereoMode.none) { - if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - const left = -aspectRatio * top; - const right = aspectRatio * top; - const width = right - left; - const height = top - bottom; - const tileWidth = width / this._core.config.tilesX; - const tileHeight = height / this._core.config.tilesY; - frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); - } - else { - perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); - } - multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - invert(this._inverseVMatrices[0], this.vMatrices[0]); - invert(this._inversePMatrices[0], this.pMatrices[0]); - } - else { - cross(this._leftToRightEye, this._forward, this._up); - normalize$2(this._leftToRightEye, this._leftToRightEye); - scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); - scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); - this._vMatrices[0][12] += this._core.config.ipd * 0.5; - copy$4(this._vMatrices[1], this._vMatrices[0]); - this._vMatrices[1][12] -= this._core.config.ipd; - const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - let left = -aspectRatio * top + frustumShift; - let right = aspectRatio * top + frustumShift; - frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - left = -aspectRatio * top - frustumShift; - right = aspectRatio * top - frustumShift; - frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); - invert(this._inverseVMatrices[0], this._vMatrices[0]); - invert(this._inversePMatrices[0], this._pMatrices[0]); - copy$4(this._inverseVMatrices[1], this._inverseVMatrices[0]); - this._inverseVMatrices[1][12] += this._core.config.ipd; - invert(this._inversePMatrices[1], this._pMatrices[1]); - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); - } - } - _zoom(direction, distance) { - scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance); - } - rotate(translationDelta) { } - zoom(zoomDelta, x, y) { - this.unproject(this._vec3, x, y, 1); - normalize$2(this._vec3, this._vec3); - const distance$1 = zoomDelta * distance(this._combinedPosition, this.modelPosition); - transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._zoom(this._vec3, distance$1); - } - _twist(axis, angle) { } - twist(angle, x, y) { } - updatePickVMatrix(x, y) { - this.unproject(this._vec3, x, y, 1); - lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); - } - syncSmooth() { - copy$3(this._smoothedCameraPosition, this._cameraPosition); - copy$1(this._smoothedCameraRotation, this._cameraRotation); - copy$1(this._smoothedOrbitRotation, this._orbitRotation); - } - updateModelManipulationOrigin(from, to) { - const a = create$3(); - const b = create$3(); - const c = create$3(); - const d = create$3(); - transformMat4$2(a, from, this.modelMMatrix); - transformMat4$2(b, to, this.modelMMatrix); - subtract(a, this._cameraPosition, a); - subtract(b, this._cameraPosition, b); - transformQuat(c, a, this._orbitDirection); - transformQuat(d, b, this._orbitDirection); - subtract(c, c, a); - subtract(d, d, b); - subtract(this._vec3, c, d); - transformQuat(this._vec3, this._vec3, this._orbitRotation); - add(this._cameraPosition, this._cameraPosition, this._vec3); - add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); - } - unproject(position, x, y, z) { - set$3(position, 2 * x / this.width - 1, 1 - 2 * y / this.height, z); - transformMat4$2(position, position, this._inversePMatrices[0]); - transformMat4$2(position, position, this._inverseVMatrices[0]); - } - translate(translationDelta) { - const distance$1 = distance(this.modelPosition, this._combinedPosition); - const height = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; - set$3(this._vec3, height * translationDelta[0], -height * translationDelta[1], 0); - transformQuat(this._vec3, this._vec3, this._combinedRotation); - transformQuat(this._vec3, this._vec3, this._orbitRotation); - subtract(this._cameraPosition, this._cameraPosition, this._vec3); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class AltAzimuthCamera extends CameraBase { - getView(view) { - super.getView(view); - view.altitude = this.altitude; - view.azimuth = this.azimuth; - view.fov = this._core.config.fov; - } - setView(view, isSmooth) { - super.setView(view, isSmooth); - this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); - this._core.config.fov = view.fov; - } - lerpView(from, to, time) { - super.lerpView(from, to, time); - this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time), MathHelper.lerp(from.azimuth, to.azimuth, time), false); - this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time); - } - update(elapsedTime) { - super.update(elapsedTime); - if (this._core.config.isDebugVisible) { - const altitude = AngleHelper.radiansToDegrees(this.altitude); - const azimuth = AngleHelper.radiansToDegrees(this.azimuth); - this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); - this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); - } - } - get altitude() { - transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); - transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); - return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITY, this._up, this._right); - } - get azimuth() { - transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); - transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); - return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITX, this._right, this._up); - } - setAltAzimuth(altitude, azimuth, isSmooth) { - setAxisAngle(this._quat, Constants.VECTOR3_UNITX, altitude); - multiply(this._orbitRotation, this._quat, Constants.QUAT_IDENTITY); - setAxisAngle(this._quat, Constants.VECTOR3_UNITY, azimuth); - multiply(this._orbitRotation, this._orbitRotation, this._quat); - if (!isSmooth) { - this.syncSmooth(); - } - } - rotate(translationDelta) { - const length = Math.min(this.width, this.height); - let angle = translationDelta[1] * Constants.PI / length; - setAxisAngle(this._quat, Constants.VECTOR3_UNITX, angle); - multiply(this._orbitRotation, this._quat, this._orbitRotation); - angle = translationDelta[0] * Constants.PI / length; - setAxisAngle(this._quat, Constants.VECTOR3_UNITY, angle); - multiply(this._orbitRotation, this._orbitRotation, this._quat); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Config$2 = class Config { - constructor(core) { - this.reset(); - } - reset() { - this.isDebugVisible = false; - this.logLevel = LogLevel.warn; - this.shaderPath = "shaders"; - this.fontPath = "fonts"; - this.modelDistance = 0.5; - this.modelSize = 0.25; - this.stereoMode = StereoMode.none; - this.ipd = 0.06; - this.screenDistance = 0.5; - this.fov = AngleHelper.degreesToRadians(30); - this.nearPlane = 0.01; - this.farPlane = 100; - this.pickWidth = 512; - this.pickHeight = 512; - this.pickHoldDelay = 1000; - this.pickSelectDelay = 100; - this.resizeMinimumDelay = 250; - this.rotationSmoothing = 0.02; - this.positionSmoothing = 0.02; - this.focusSmoothing = 0.01; - this.scaleSmoothing = 0.02; - this.mouseWheelZoomScale = -0.002; - this.mouseWheelRotationScale = -0.002; - this.dragToleranceSquared = 100; - this.manipulatorMinRelativeDistanceSquared = 100; - this.isMultiTouchEnabled = true; - this.isMultiTouchZoomEnabled = true; - this.isMultiTouchTwistEnabled = true; - this.isMultiTouchRotateEnabled = true; - this.isMultiTouchTranslateEnabled = true; - this.multiTouchZoomScale = 1; - this.cameraMinDistance = 0.1; - this.cameraMaxDistance = 10; - this.xrControllerRayColor = fromValues$3(0.5, 0.5, 0.5); - this.xrControllerProfile = "windows-mixed-reality"; - this.xrControllerHandedness = "right"; - this.paletteColor = new Uint8Array([0x80, 0x80, 0x80, 0]); - this.textColor = create$3(); - this.textHoverColor = create$3(); - this.textBorderColor = create$3(); - this.textBorderWidth = 0x18 / 0xff; - this.identityRotation = Constants.VECTOR3_UNITY; - this.axesTextLabelMaxGlyphs = 32; - this.axesTextColor = create$3(); - this.axesTextBorderColor = create$3(); - this.axesTextHoverColor = create$3(); - this.axesTextLabelMajorSize = 0.03; - this.axesTextLabelMinorSize = 0.02; - this.axesTextTitleMaxGlyphs = 127; - this.axesTextTitleSize = 0.05; - this.axesTextHeadingMaxGlyphs = 128; - this.axesTextHeadingSize = 0.075; - this.axesTextTitleLineHeight = 1.5; - this.axesTextHeadingLineHeight = 1.5; - this.axesTextLabelLineHeight = 1.5; - this.axesGridMajorThickness = 0.0002; - this.axesGridMinorThickness = 0.0001; - this.axesGridZeroThickness = 0.002; - this.axesGridPickDivisionHeight = 0.025; - this.axesGridBackgroundColor = create$3(); - this.axesGridHighlightColor = create$3(); - this.axesGridMinorColor = create$3(); - this.axesGridMajorColor = create$3(); - this.axesGridZeroColor = create$3(); - this.axesGridDefaultDivisions = 10; - this.keyTitleMaxGlyphs = 64; - this.keyLabelMaxGlyphs = 64; - this.selectionColor = create$3(); - this.hoverColor = create$3(); - this.activeColor = create$3(); - this.highlightMode = HighlightMode.color; - this.lassoThickness = 4; - this.lassoDashWidth = 2; - this.lassoColor = create$3(); - this.minCubifiedTreeMapSlice = 0.01; - this.sdfBuffer = 0xc0; - this.sdfBorder = 0x0; - this.forceDirectIsEnabled = false; - this.forceDirectAttraction = 1; - this.forceDirectRepulsion = 1; - this.forceDirectGravity = 1; - this.forceDirectInterval = 0.1; - this.forceDirectMaxDistance = 0.1; - this.forceDirectTheta = 1; - this.forceDirectIterationsPerLayout = 1; - this.forceDirectEdgeWeightPower = 1; - this.forceDirectLockX = false; - this.forceDirectLockY = false; - this.forceDirectLockZ = false; - this.transitionDuration = 400; - this.transitionStaggering = 100; - this.transitionView = true; - this.isTransitionPickingEnabled = false; - this.backgroundColor = create$2(); - this.theme = Theme.light; - this.renderMode = RenderMode.color; - this.tilesX = 1; - this.tilesY = 1; - this.tileOffsetX = 0; - this.tileOffsetY = 0; - } - get theme() { return this._theme; } - set theme(value) { - if (this._theme != value) { - this._theme = value; - switch (value) { - case Theme.dark: - set$2(this.backgroundColor, 0, 0, 0, 1); - set$3(this.textColor, 0.9, 0.9, 0.9); - set$3(this.textHoverColor, 1, 1, 1); - set$3(this.textBorderColor, 0, 0, 0); - set$3(this.axesTextColor, 0.9, 0.9, 0.9); - set$3(this.axesTextBorderColor, 0, 0, 0); - set$3(this.axesTextHoverColor, 1, 1, 1); - set$3(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); - set$3(this.axesGridHighlightColor, 0.04, 0.04, 0.04); - set$3(this.axesGridMinorColor, 0.05, 0.05, 0.05); - set$3(this.axesGridMajorColor, 0.1, 0.1, 0.1); - set$3(this.axesGridZeroColor, 0.05, 0.1, 0.1); - set$3(this.selectionColor, 1, 1, 0); - set$3(this.hoverColor, 1, 0, 1); - set$3(this.activeColor, 0, 1, 1); - set$3(this.lassoColor, 0.9, 0.9, 0.9); - break; - case Theme.light: - set$2(this.backgroundColor, 1, 1, 1, 1); - set$3(this.textColor, 0, 0, 0); - set$3(this.textHoverColor, 0.1, 0.1, 0.1); - set$3(this.textBorderColor, 1, 1, 1); - set$3(this.axesTextColor, 0, 0, 0); - set$3(this.axesTextBorderColor, 1, 1, 1); - set$3(this.axesTextHoverColor, 0.1, 0.1, 0.1); - set$3(this.axesGridBackgroundColor, 1, 1, 1); - set$3(this.axesGridHighlightColor, 0.925, 0.925, 0.925); - set$3(this.axesGridMinorColor, 0.9, 0.9, 0.9); - set$3(this.axesGridMajorColor, 0.8, 0.8, 0.8); - set$3(this.axesGridZeroColor, 0.7, 0.9, 0.9); - set$3(this.selectionColor, 1, 1, 0); - set$3(this.hoverColor, 1, 0, 1); - set$3(this.activeColor, 0, 1, 1); - set$3(this.lassoColor, 0.1, 0.1, 0.1); - break; - } - if (this.themeChangedCallback) { - this.themeChangedCallback(this._theme); - } - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class DebugText { - get text() { return this._text; } - constructor() { - this.clear(); - } - clear() { - this._text = ""; - } - addLine(value) { - this._text += value + "\n"; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Fps { - get frameCounter() { return this._frameCounter; } - get totalFrames() { return this._totalFrames; } - constructor(core) { - this._core = core; - this._totalFrames = 0; - this.reset(); - } - update(elapsedTime) { - this._elapsedTime += elapsedTime; - if (this._elapsedTime > 1000) { - this._elapsedTime -= 1000; - this._fps = this._frameCounter; - this._frameCounter = 0; - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`fps ${this._fps}`); - } - } - render() { - this._frameCounter++; - this._totalFrames++; - } - reset() { - this._fps = 0; - this._frameCounter = 0; - this._elapsedTime = 0; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const PaletteType = { - sequentialsinglehue: "sequentialsinglehue", - sequentialmultihue: "sequentialmultihue", - diverging: "diverging", - qualitative: "qualitative", - }; - class PaletteResources { - constructor() { - this.palettes = { - "blues": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 251, 255, 222, 235, 247, 198, 219, 239, 158, 202, 225, 107, 174, 214, 66, 146, 198, 33, 113, 181, 8, 81, 156, 8, 48, 107]) }, - "greens": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 252, 245, 229, 245, 224, 199, 233, 192, 161, 217, 155, 116, 196, 118, 65, 171, 93, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, - "greys": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 255, 255, 240, 240, 240, 217, 217, 217, 189, 189, 189, 150, 150, 150, 115, 115, 115, 82, 82, 82, 37, 37, 37, 0, 0, 0]) }, - "oranges": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 235, 254, 230, 206, 253, 208, 162, 253, 174, 107, 253, 141, 60, 241, 105, 19, 217, 72, 1, 166, 54, 3, 127, 39, 4]) }, - "purples": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([252, 251, 253, 239, 237, 245, 218, 218, 235, 188, 189, 220, 158, 154, 200, 128, 125, 186, 106, 81, 163, 84, 39, 143, 63, 0, 125]) }, - "reds": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 240, 254, 224, 210, 252, 187, 161, 252, 146, 114, 251, 106, 74, 239, 59, 44, 203, 24, 29, 165, 15, 21, 103, 0, 13]) }, - "viridis": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x48, 0x25, 0x75, 0x41, 0x44, 0x87, 0x35, 0x60, 0x8d, 0x2a, 0x78, 0x8e, 0x21, 0x91, 0x8d, 0x22, 0xa8, 0x84, 0x43, 0xbf, 0x71, 0x7a, 0xd1, 0x51, 0xbc, 0xdf, 0x27]) }, - "inferno": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x17, 0x0c, 0x3b, 0x42, 0x0a, 0x68, 0x6b, 0x17, 0x6e, 0x93, 0x26, 0x67, 0xbb, 0x37, 0x55, 0xdd, 0x51, 0x3a, 0xf3, 0x77, 0x1a, 0xfc, 0xa5, 0x0a, 0xf6, 0xd6, 0x45]) }, - "magma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x15, 0x0e, 0x37, 0x3b, 0x0f, 0x70, 0x65, 0x1a, 0x80, 0x8c, 0x29, 0x81, 0xb6, 0x37, 0x7a, 0xde, 0x49, 0x68, 0xf7, 0x6f, 0x5c, 0xfe, 0x9f, 0x6d, 0xfe, 0xce, 0x91]) }, - "plasma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x42, 0x03, 0x9d, 0x6a, 0x00, 0xa8, 0x90, 0x0d, 0xa4, 0xb1, 0x2a, 0x90, 0xcb, 0x47, 0x79, 0xe1, 0x64, 0x62, 0xf2, 0x83, 0x4c, 0xfc, 0xa6, 0x36, 0xfc, 0xce, 0x25]) }, - "bluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 229, 245, 249, 204, 236, 230, 153, 216, 201, 102, 194, 164, 65, 174, 118, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, - "bluepurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 224, 236, 244, 191, 211, 230, 158, 188, 218, 140, 150, 198, 140, 107, 177, 136, 65, 157, 129, 15, 124, 77, 0, 75]) }, - "greenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 240, 224, 243, 219, 204, 235, 197, 168, 221, 181, 123, 204, 196, 78, 179, 211, 43, 140, 190, 8, 104, 172, 8, 64, 129]) }, - "orangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 236, 254, 232, 200, 253, 212, 158, 253, 187, 132, 252, 141, 89, 239, 101, 72, 215, 48, 31, 179, 0, 0, 127, 0, 0]) }, - "purpleblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 231, 242, 208, 209, 230, 166, 189, 219, 116, 169, 207, 54, 144, 192, 5, 112, 176, 4, 90, 141, 2, 56, 88]) }, - "purplebluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 226, 240, 208, 209, 230, 166, 189, 219, 103, 169, 207, 54, 144, 192, 2, 129, 138, 1, 108, 89, 1, 70, 54]) }, - "purplered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 244, 249, 231, 225, 239, 212, 185, 218, 201, 148, 199, 223, 101, 176, 231, 41, 138, 206, 18, 86, 152, 0, 67, 103, 0, 31]) }, - "redpurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 243, 253, 224, 221, 252, 197, 192, 250, 159, 181, 247, 104, 161, 221, 52, 151, 174, 1, 126, 122, 1, 119, 73, 0, 106]) }, - "yellowgreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 247, 252, 185, 217, 240, 163, 173, 221, 142, 120, 198, 121, 65, 171, 93, 35, 132, 67, 0, 104, 55, 0, 69, 41]) }, - "yellowgreenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 217, 237, 248, 177, 199, 233, 180, 127, 205, 187, 65, 182, 196, 29, 145, 192, 34, 94, 168, 37, 52, 148, 8, 29, 88]) }, - "yelloworangebrown": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 255, 247, 188, 254, 227, 145, 254, 196, 79, 254, 153, 41, 236, 112, 20, 204, 76, 2, 153, 52, 4, 102, 37, 6]) }, - "yelloworangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 204, 255, 237, 160, 254, 217, 118, 254, 178, 76, 253, 141, 60, 252, 78, 42, 227, 26, 28, 189, 0, 38, 128, 0, 38]) }, - "brownbluegreen": { type: PaletteType.diverging, colors: new Uint8Array([84, 48, 5, 140, 81, 10, 191, 129, 45, 223, 194, 125, 246, 232, 195, 245, 245, 245, 199, 234, 229, 128, 205, 193, 53, 151, 143, 1, 102, 94, 0, 60, 48]) }, - "pinkyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([142, 1, 82, 197, 27, 125, 222, 119, 174, 241, 182, 218, 253, 224, 239, 247, 247, 247, 230, 245, 208, 184, 225, 134, 127, 188, 65, 77, 146, 33, 39, 100, 25]) }, - "purplegreen": { type: PaletteType.diverging, colors: new Uint8Array([64, 0, 75, 118, 42, 131, 153, 112, 171, 194, 165, 207, 231, 212, 232, 247, 247, 247, 217, 240, 211, 166, 219, 160, 90, 174, 97, 27, 120, 55, 0, 68, 27]) }, - "purpleorange": { type: PaletteType.diverging, colors: new Uint8Array([127, 59, 8, 179, 88, 6, 224, 130, 20, 253, 184, 99, 254, 224, 182, 247, 247, 247, 216, 218, 235, 178, 171, 210, 128, 115, 172, 84, 39, 136, 45, 0, 75]) }, - "redblue": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 247, 247, 247, 209, 229, 240, 146, 197, 222, 67, 147, 195, 33, 102, 172, 5, 48, 97]) }, - "redgrey": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 255, 255, 255, 224, 224, 224, 186, 186, 186, 135, 135, 135, 77, 77, 77, 26, 26, 26]) }, - "redyellowblue": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 144, 255, 255, 191, 224, 243, 248, 171, 217, 233, 116, 173, 209, 69, 117, 180, 49, 54, 149]) }, - "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, - "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, - "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, - "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, - "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, - "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, - "pastel2": { type: PaletteType.qualitative, colors: new Uint8Array([179, 226, 205, 253, 205, 172, 203, 213, 232, 244, 202, 228, 230, 245, 201, 255, 242, 174, 241, 226, 204, 204, 204, 204]) }, - "set1": { type: PaletteType.qualitative, colors: new Uint8Array([228, 26, 28, 55, 126, 184, 77, 175, 74, 152, 78, 163, 255, 127, 0, 255, 255, 51, 166, 86, 40, 247, 129, 191, 153, 153, 153]) }, - "set2": { type: PaletteType.qualitative, colors: new Uint8Array([102, 194, 165, 252, 141, 98, 141, 160, 203, 231, 138, 195, 166, 216, 84, 255, 217, 47, 229, 196, 148, 179, 179, 179]) }, - "set3": { type: PaletteType.qualitative, colors: new Uint8Array([141, 211, 199, 255, 255, 179, 190, 186, 218, 251, 128, 114, 128, 177, 211, 253, 180, 98, 179, 222, 105, 252, 205, 229, 217, 217, 217, 188, 128, 189, 204, 235, 197, 255, 237, 111]) }, - }; - } - } - class PaletteBase { - get colors() { return this._colors; } - set colors(value) { - if (this._colors != value) { - this._colors = value; - this._changed = true; - } - } - constructor() { - this._colors = null; - } - copyFrom(palette) { - if (palette.colors) { - this.colors = new Uint8Array(palette.colors); - } - else { - this.colors = null; - } - } - update() { } - } - let Palette$2 = class Palette extends PaletteBase { - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class PositionVertex { - static getPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - set$3(value, buffer[offset], buffer[offset + 1], buffer[offset + 2]); - } - static setPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - buffer[offset] = value[0]; - buffer[offset + 1] = value[1]; - buffer[offset + 2] = value[2]; - } - } - PositionVertex.SIZE = 3; - PositionVertex.SIZE_BYTES = 12; - class PositionColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - set$3(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } - } - PositionColorVertex.SIZE_BYTES = 16; - PositionColorVertex.POSITION_OFFSET_BYTES = 0; - PositionColorVertex.COLOR_OFFSET_BYTES = 12; - class PositionTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - } - PositionTextureVertex.SIZE_BYTES = 16; - PositionTextureVertex.POSITION_OFFSET_BYTES = 0; - PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; - class PositionTexturePickVertex { - static getPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - set$2(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - } - PositionTexturePickVertex.SIZE_BYTES = 20; - PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; - PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; - PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; - class PositionNormalTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - set$3(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - } - PositionNormalTextureVertex.SIZE_BYTES = 20; - PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; - PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; - PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; - class PickGridVertex { - static getTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - set$3(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - set$2(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - set$2(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF, bufferView.getUint16(offset + 4, true) / 0xFFFF, bufferView.getUint16(offset + 6, true) / 0xFFFF); - } - static setBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - bufferView.setUint16(offset + 4, value[2] * 0xFFFF, true); - bufferView.setUint16(offset + 6, value[3] * 0xFFFF, true); - } - } - PickGridVertex.SIZE_BYTES = 32; - PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; - PickGridVertex.NORMAL_OFFSET_BYTES = 12; - PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; - PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; - PickGridVertex.BOUNDS_OFFSET_BYTES = 24; - class UnitVertex { - static getIdHover(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, true); - } - static setIdHover(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, value, true); - } - static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); - } - static getTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - } - static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; - toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); - toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); - } - static getOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true)); - } - static setOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - } - static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - } - static getScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - set$1(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); - } - static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - set$1(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); - } - static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - set$2(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getSelected(bufferView, index) { - return bufferView.getInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES) / 0x7F; - } - static setSelected(bufferView, index, value) { - bufferView.setInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES, value * 0x7F); - } - static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); - } - static getRounding(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, true); - } - static setRounding(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, value, true); - } - static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); - } - static getParameter1(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, true); - } - static setParameter1(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, value, true); - } - static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); - } - static getParameter2(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, true); - } - static setParameter2(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, value, true); - } - static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); - } - static getMaterial(bufferView, index) { - return bufferView.getUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES); - } - static setMaterial(bufferView, index, value) { - bufferView.setUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES, value); - } - static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); - } - static getTexture(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES); - } - static setTexture(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES, value); - } - static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); - } - static getSdfBuffer(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES); - } - static setSdfBuffer(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES, value); - } - static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); - } - static getSdfBorder(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES); - } - static setSdfBorder(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES, value); - } - static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); - } - } - UnitVertex.SIZE_BYTES = 92; - UnitVertex.ID_HOVER_OFFSET_BYTES = 0; - UnitVertex.ID_COLOR_OFFSET_BYTES = 4; - UnitVertex.ORDER_OFFSET_BYTES = 8; - UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; - UnitVertex.SELECTED_OFFSET_BYTES = 80; - UnitVertex.TRANSLATION_OFFSET_BYTES = 16; - UnitVertex.COLOR_OFFSET_BYTES = 28; - UnitVertex.MATERIAL_OFFSET_BYTES = 30; - UnitVertex.SCALE_OFFSET_BYTES = 32; - UnitVertex.ROUNDING_OFFSET_BYTES = 44; - UnitVertex.ROTATION_OFFSET_BYTES = 48; - UnitVertex.TEXCOORD_OFFSET_BYTES = 64; - UnitVertex.TEXTURE_OFFSET_BYTES = 81; - UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; - UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; - UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; - UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class ObjMesh { - } - class ObjHelper { - constructor(core) { - this._core = core; - } - read(data) { - const start = window.performance.now(); - const indices = []; - const positions = []; - const normals = []; - const texCoords = []; - const meshes = []; - const indexOffsets = []; - const indexCounts = []; - const faceLookup = {}; - const lines = data.split("\n"); - let faceCount = 0; - for (let i = 0; i < lines.length; i++) { - const parts = lines[i].trim().split(" "); - if (parts.length > 0) { - switch (parts[0]) { - case "o": - meshes.push(parts[1]); - indexOffsets.push(indices.length); - break; - case "v": - positions.push(parseFloat(parts[1])); - positions.push(parseFloat(parts[2])); - positions.push(parseFloat(parts[3])); - break; - case "vt": - texCoords.push(parseFloat(parts[1])); - texCoords.push(parseFloat(parts[2])); - break; - case "vn": - normals.push(parseFloat(parts[1])); - normals.push(parseFloat(parts[2])); - normals.push(parseFloat(parts[3])); - break; - case "f": - for (let i = 0; i < parts.length - 1; i++) { - const part = parts[i + 1]; - if (faceLookup[part] == undefined) { - faceLookup[part] = faceCount++; - } - indices.push(faceLookup[part]); - } - break; - } - } - } - for (let i = 0; i < meshes.length - 1; i++) { - indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); - } - indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); - const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); - const dataView = new DataView(vertices); - let minX = Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let minZ = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - let maxZ = -Number.MAX_VALUE; - const faces = Object.keys(faceLookup); - const _vec2 = create(); - const _vec3 = create$3(); - let hasTexCoords, hasNormals; - if (faces.length > 0) { - const faceParts = faces[0].split("/"); - hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); - hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); - } - for (let i = 0; i < faces.length; i++) { - const faceParts = faces[i].split("/"); - let index = (parseInt(faceParts[0]) - 1) * 3; - const x = positions[index]; - const y = positions[index + 1]; - const z = positions[index + 2]; - set$3(_vec3, x, y, z); - PositionNormalTextureVertex.setPosition(dataView, i, _vec3); - minX = Math.min(x, minX); - minY = Math.min(y, minY); - minZ = Math.min(z, minZ); - maxX = Math.max(x, maxX); - maxY = Math.max(y, maxY); - maxZ = Math.max(z, maxZ); - if (hasNormals) { - index = (parseInt(faceParts[2]) - 1) * 3; - set$3(_vec3, normals[index], normals[index + 1], normals[index + 2]); - PositionNormalTextureVertex.setNormal(dataView, i, _vec3); - } - if (hasTexCoords) { - index = (parseInt(faceParts[1]) - 1) * 2; - set(_vec2, texCoords[index], texCoords[index + 1]); - PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); - } - } - const originX = (minX + maxX) / 2; - const originY = (minY + maxY) / 2; - const originZ = (minZ + maxZ) / 2; - const objMesh = new ObjMesh(); - objMesh.vertices = vertices; - objMesh.indices = new Uint16Array(indices); - objMesh.meshes = meshes; - objMesh.indexOffsets = indexOffsets; - objMesh.indexCounts = indexCounts; - objMesh.indexCount = indices.length; - objMesh.minX = minX; - objMesh.minY = minY; - objMesh.minZ = minZ; - objMesh.maxX = maxX; - objMesh.maxY = maxY; - objMesh.maxZ = maxZ; - objMesh.originX = originX; - objMesh.originY = originY; - objMesh.originZ = originZ; - this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); - return objMesh; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Cube { - } - Cube.POSITIONS = new Float32Array([ - -0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, - 0.5, -0.5, 0.5, - -0.5, -0.5, 0.5, - -0.5, 0.5, -0.5, - 0.5, 0.5, -0.5, - 0.5, -0.5, -0.5, - -0.5, -0.5, -0.5 - ]); - Cube.INDICES = new Uint16Array([5, 4, 1, 0, 3, 4, 7, 5, 6, 1, 2, 3, 6, 7]); - Cube.CUBE_MAP_INDICES = new Uint16Array([2, 3, 1, 0, 4, 3, 7, 2, 6, 1, 5, 4, 6, 7]); - Cube.FACE_NORMALS = [ - fromValues$3(0, 1, 0), - fromValues$3(1, 0, 0), - fromValues$3(0, -1, 0), - fromValues$3(-1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(0, 0, -1) - ]; - Cube.FACE_POSITIONS = [ - fromValues$3(0.0, 0.5, 0.0), - fromValues$3(0.5, 0.0, 0.0), - fromValues$3(0.0, -0.5, 0.0), - fromValues$3(-0.5, 0.0, 0.0), - fromValues$3(0.0, 0.0, 0.5), - fromValues$3(0.0, 0.0, -0.5) - ]; - Cube.FACE_ROTATIONS = [ - fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), - fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), - fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), - fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), - fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), - fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) - ]; - Cube.EDGE_POSITIONS = [ - fromValues$3(0, 0.5, 0.5), - fromValues$3(0.5, 0.5, 0), - fromValues$3(0, 0.5, -0.5), - fromValues$3(-0.5, 0.5, 0), - fromValues$3(0, -0.5, 0.5), - fromValues$3(0.5, -0.5, 0), - fromValues$3(0, -0.5, -0.5), - fromValues$3(-0.5, -0.5, 0), - fromValues$3(0.5, 0, 0.5), - fromValues$3(0.5, 0, -0.5), - fromValues$3(-0.5, 0, -0.5), - fromValues$3(-0.5, 0, 0.5) - ]; - Cube.EDGE_NORMALS = [ - fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO) - ]; - Cube.EDGE_CORNERS = [ - [0, 1], - [1, 5], - [4, 5], - [0, 4], - [2, 3], - [2, 6], - [6, 7], - [3, 7], - [1, 2], - [5, 6], - [4, 7], - [0, 3] - ]; - Cube.EDGE_FACES = [ - [0, 4], - [0, 1], - [0, 5], - [0, 3], - [2, 4], - [2, 1], - [2, 5], - [2, 3], - [1, 4], - [1, 5], - [3, 5], - [3, 4] - ]; - Cube.EDGE_AXIS = [ - 0, - 2, - 0, - 2, - 0, - 2, - 0, - 2, - 1, - 1, - 1, - 1 - ]; - Cube.AXIS_EDGES = [ - [0, 2, 4, 6], - [8, 9, 10, 11], - [1, 3, 5, 7] - ]; - Cube.AXIS_FACES = [ - [1, 3], - [0, 2], - [4, 5] - ]; - Cube.OPPOSITE_FACES = [ - 2, - 3, - 0, - 1, - 5, - 4 - ]; - Cube.EDGE_POSITIVES = [ - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(1, 0, 0), - fromValues$3(0, 0, 1), - fromValues$3(0, 1, 0), - fromValues$3(0, 1, 0), - fromValues$3(0, 1, 0), - fromValues$3(0, 1, 0) - ]; - Cube.EDGE_FORWARDS = [ - fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), - fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), - fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO) - ]; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let ControllerVisual$1 = class ControllerVisual { - render(elapsedTime, xrFrame) { } - update(elapsedTime) { } - constructor(controller) { - this.controller = controller; - } - }; - class Controller { - get isInitialized() { return this._isInitialized; } - get mMatrix() { return this._mMatrix; } - get indexCount() { return this._indexCount; } - get vertices() { return this._vertices; } - get indices() { return this._indices; } - get texture() { return this._texture; } - get rayMMatrix() { return this._rayMMatrix; } - get rayIndexCount() { return this._rayIndexCount; } - get rayVertices() { return this._rayVertices; } - get rayIndices() { return this._rayIndices; } - constructor(core, options) { - this._cubeObj = `o Cube + const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + /** + * Decamelizes a string with/without a custom separator (hyphen by default). + * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript + * + * @param str String in camelcase + * @param separator Separator for the new decamelized string. + */ + function decamelize(str, separator = '-') { + return str + .replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2') + .replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2') + .toLowerCase(); + } + function createElement(tag, attrs, ...children) { + if (typeof tag === 'function') { + const fn = tag; + let props = attrs; + // Handle case where props is null but children are provided + if (props === null || props === undefined) { + props = { children }; + } + else { + props.children = children; + } + return fn(props); + } + else { + const ns = (tag === 'svg') ? SVG_NAMESPACE : null; + const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); + const map = attrs; + let ref; + for (let name in map) { + if (name && map.hasOwnProperty(name)) { + let value = map[name]; + if (name === 'className' && value !== void 0) { + setAttribute(el, ns, 'class', value.toString()); + } + else if (name === 'disabled' && !value) ; + else if (value === null || value === undefined) { + continue; + } + else if (value === true) { + setAttribute(el, ns, name, name); + } + else if (typeof value === 'function') { + if (name === 'ref') { + ref = value; + } + else { + el[name.toLowerCase()] = value; + } + } + else if (typeof value === 'object') { + setAttribute(el, ns, name, flatten(value)); + } + else { + setAttribute(el, ns, name, value.toString()); + } + } + } + if (children && children.length > 0) { + appendChildren(el, children); + } + if (ref) { + ref(el); + } + return el; + } + } + function setAttribute(el, ns, name, value) { + if (ns) { + el.setAttributeNS(null, name, value); + } + else { + el.setAttribute(name, value); + } + } + function flatten(o) { + const arr = []; + for (let prop in o) + arr.push(`${decamelize(prop, '-')}:${o[prop]}`); + return arr.join(';'); + } + function isInsideForeignObject(element) { + let current = element; + while (current) { + if (current.tagName.toLowerCase() === 'foreignobject') { + return true; + } + current = current.parentElement; + } + return false; + } + function recreateWithSvgNamespace(element) { + const svgElement = document.createElementNS(SVG_NAMESPACE, element.tagName.toLowerCase()); + // Copy attributes + for (let i = 0; i < element.attributes.length; i++) { + const attr = element.attributes[i]; + svgElement.setAttributeNS(null, attr.name, attr.value); + } + // Copy event handlers and other properties + // Common event handlers that need to be copied + const eventProperties = ['onclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmouseout', + 'onmousemove', 'onkeydown', 'onkeyup', 'onkeypress', 'onfocus', 'onblur']; + for (const prop of eventProperties) { + if (element[prop]) { + svgElement[prop] = element[prop]; + } + } + // Copy children recursively + for (let i = 0; i < element.childNodes.length; i++) { + const child = element.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) { + svgElement.appendChild(recreateWithSvgNamespace(child)); + } + else { + svgElement.appendChild(child.cloneNode(true)); + } + } + return svgElement; + } + function addChild(parentElement, child) { + if (child === null || child === undefined || typeof child === "boolean") { + return; + } + else if (Array.isArray(child)) { + appendChildren(parentElement, child); + } + else if (isElement(child)) { + const childEl = child; + // If parent is SVG and child was created with wrong namespace, recreate it + // Exception: don't recreate elements inside foreignObject as they should remain HTML + if (parentElement.namespaceURI === SVG_NAMESPACE && + childEl.namespaceURI !== SVG_NAMESPACE && + childEl.tagName.toLowerCase() !== 'foreignobject' && + !isInsideForeignObject(parentElement)) { + const recreated = recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } + else { + parentElement.appendChild(childEl); + } + } + else { + parentElement.appendChild(document.createTextNode(child.toString())); + } + } + function appendChildren(parentElement, children) { + children.forEach(child => addChild(parentElement, child)); + } + function isElement(el) { + //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType + return !!el.nodeType; + } + function mount(element, container) { + container.innerHTML = ''; + if (element) { + addChild(container, element); + } + } + function findElementByChildPositions(childPositions, container) { + let element = container || document.body; + let childPosition; + while (element && childPositions.length) { + childPosition = childPositions.shift(); + element = element.children.item(childPosition); + } + if (element) { + return element; + } + } + function focusActiveElement(element, activeElementInfo) { + element.focus(); + element.scrollTop = activeElementInfo.scrollTop; + const input = element; + if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) { + input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); + } + } + function setActiveElement(activeElementInfo, container) { + if (activeElementInfo) { + const element = findElementByChildPositions(activeElementInfo.childPositions, container); + if (element) { + focusActiveElement(element, activeElementInfo); + } + } + } + function getActiveElementInfo(container) { + let element = document.activeElement; + const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element; + const activeElementInfo = { + childPositions: [], + scrollTop, + selectionDirection, + selectionEnd, + selectionStart + }; + while (element && element !== document.body && element !== container) { + activeElementInfo.childPositions.unshift(getChildPosition(element)); + element = element.parentElement; + } + if ((element === document.body || element === container) && activeElementInfo.childPositions.length) + return activeElementInfo; + } + function getChildPosition(element) { + let childPosition = 0; + while (element = element.previousElementSibling) + childPosition++; + return childPosition; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const KeyCodes = { + ENTER: 'Enter', + }; + const Table = (props) => { + return (createElement("table", { className: props.className }, + props.children, + props.rows.map((row, i) => (createElement("tr", { className: props.rowClassName || '', onClick: e => props.onRowClick && props.onRowClick(e, i), tabIndex: props.onRowClick ? 0 : -1, onKeyUp: e => { + if (e.key === KeyCodes.ENTER && props.onRowClick) { + props.onRowClick(e, i); + } + } }, row.cells.map((cell, i) => (createElement("td", { className: cell.className || '', title: cell.title || '' }, cell.content)))))))); + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * This file is for external facing export only, do not use this for internal references, + * as it may cause circular dependencies in Rollup. + */ + + var controls = /*#__PURE__*/Object.freeze({ + __proto__: null, + Table: Table + }); + + /** + * Common utilities + * @module glMatrix + */ + + // Configuration Constants + var EPSILON = 0.000001; + var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + + /** + * Sets the type of array used when creating new vectors and matrices + * + * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array + */ + function setMatrixArrayType(type) { + ARRAY_TYPE = type; + } + + /** + * 3x3 Matrix + * @module mat3 + */ + + /** + * Creates a new identity mat3 + * + * @returns {mat3} a new 3x3 matrix + */ + function create$5() { + var out = new ARRAY_TYPE(9); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; + } + out[0] = 1; + out[4] = 1; + out[8] = 1; + return out; + } + + /** + * Copies the upper-left 3x3 values into the given mat3. + * + * @param {mat3} out the receiving 3x3 matrix + * @param {ReadonlyMat4} a the source 4x4 matrix + * @returns {mat3} out + */ + function fromMat4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[4]; + out[4] = a[5]; + out[5] = a[6]; + out[6] = a[8]; + out[7] = a[9]; + out[8] = a[10]; + return out; + } + + /** + * Create a new mat3 with the given values + * + * @param {Number} m00 Component in column 0, row 0 position (index 0) + * @param {Number} m01 Component in column 0, row 1 position (index 1) + * @param {Number} m02 Component in column 0, row 2 position (index 2) + * @param {Number} m10 Component in column 1, row 0 position (index 3) + * @param {Number} m11 Component in column 1, row 1 position (index 4) + * @param {Number} m12 Component in column 1, row 2 position (index 5) + * @param {Number} m20 Component in column 2, row 0 position (index 6) + * @param {Number} m21 Component in column 2, row 1 position (index 7) + * @param {Number} m22 Component in column 2, row 2 position (index 8) + * @returns {mat3} A new mat3 + */ + function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { + var out = new ARRAY_TYPE(9); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m10; + out[4] = m11; + out[5] = m12; + out[6] = m20; + out[7] = m21; + out[8] = m22; + return out; + } + + /** + * Calculates a 3x3 matrix from the given quaternion + * + * @param {mat3} out mat3 receiving operation result + * @param {ReadonlyQuat} q Quaternion to create matrix from + * + * @returns {mat3} out + */ + function fromQuat$1(out, q) { + var x = q[0], + y = q[1], + z = q[2], + w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + + /** + * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied. + * @module mat4 + */ + + /** + * Creates a new identity mat4 + * + * @returns {mat4} a new 4x4 matrix + */ + function create$4() { + var out = new ARRAY_TYPE(16); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + } + out[0] = 1; + out[5] = 1; + out[10] = 1; + out[15] = 1; + return out; + } + + /** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the source matrix + * @returns {mat4} out + */ + function copy$4(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + + /** + * Create a new mat4 with the given values + * + * @param {Number} m00 Component in column 0, row 0 position (index 0) + * @param {Number} m01 Component in column 0, row 1 position (index 1) + * @param {Number} m02 Component in column 0, row 2 position (index 2) + * @param {Number} m03 Component in column 0, row 3 position (index 3) + * @param {Number} m10 Component in column 1, row 0 position (index 4) + * @param {Number} m11 Component in column 1, row 1 position (index 5) + * @param {Number} m12 Component in column 1, row 2 position (index 6) + * @param {Number} m13 Component in column 1, row 3 position (index 7) + * @param {Number} m20 Component in column 2, row 0 position (index 8) + * @param {Number} m21 Component in column 2, row 1 position (index 9) + * @param {Number} m22 Component in column 2, row 2 position (index 10) + * @param {Number} m23 Component in column 2, row 3 position (index 11) + * @param {Number} m30 Component in column 3, row 0 position (index 12) + * @param {Number} m31 Component in column 3, row 1 position (index 13) + * @param {Number} m32 Component in column 3, row 2 position (index 14) + * @param {Number} m33 Component in column 3, row 3 position (index 15) + * @returns {mat4} A new mat4 + */ + function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + var out = new ARRAY_TYPE(16); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m03; + out[4] = m10; + out[5] = m11; + out[6] = m12; + out[7] = m13; + out[8] = m20; + out[9] = m21; + out[10] = m22; + out[11] = m23; + out[12] = m30; + out[13] = m31; + out[14] = m32; + out[15] = m33; + return out; + } + + /** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ + function identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the source matrix + * @returns {mat4 | null} out, or null if source matrix is not invertible + */ + function invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1.0 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + + /** + * Multiplies two mat4s + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the first operand + * @param {ReadonlyMat4} b the second operand + * @returns {mat4} out + */ + function multiply$2(out, a, b) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + + // Cache only the current line of the second matrix + var b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4]; + b1 = b[5]; + b2 = b[6]; + b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8]; + b1 = b[9]; + b2 = b[10]; + b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12]; + b1 = b[13]; + b2 = b[14]; + b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; + } + + /** + * Translate a mat4 by the given vector + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the matrix to translate + * @param {ReadonlyVec3} v vector to translate by + * @returns {mat4} out + */ + function translate(out, a, v) { + var x = v[0], + y = v[1], + z = v[2]; + var a00, a01, a02, a03; + var a10, a11, a12, a13; + var a20, a21, a22, a23; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0]; + a01 = a[1]; + a02 = a[2]; + a03 = a[3]; + a10 = a[4]; + a11 = a[5]; + a12 = a[6]; + a13 = a[7]; + a20 = a[8]; + a21 = a[9]; + a22 = a[10]; + a23 = a[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + + /** + * Scales the mat4 by the dimensions in the given vec3 not using vectorization + * + * @param {mat4} out the receiving matrix + * @param {ReadonlyMat4} a the matrix to scale + * @param {ReadonlyVec3} v the vec3 to scale the matrix by + * @returns {mat4} out + **/ + function scale$1(out, a, v) { + var x = v[0], + y = v[1], + z = v[2]; + out[0] = a[0] * x; + out[1] = a[1] * x; + out[2] = a[2] * x; + out[3] = a[3] * x; + out[4] = a[4] * y; + out[5] = a[5] * y; + out[6] = a[6] * y; + out[7] = a[7] * y; + out[8] = a[8] * z; + out[9] = a[9] * z; + out[10] = a[10] * z; + out[11] = a[11] * z; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; + } + + /** + * Creates a matrix from a vector scaling + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.scale(dest, dest, vec); + * + * @param {mat4} out mat4 receiving operation result + * @param {ReadonlyVec3} v Scaling vector + * @returns {mat4} out + */ + function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * let quatMat = mat4.create(); + * mat4.fromQuat(quatMat, quat); + * mat4.multiply(dest, dest, quatMat); + * mat4.scale(dest, dest, scale) + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Rotation quaternion + * @param {ReadonlyVec3} v Translation vector + * @param {ReadonlyVec3} s Scaling vector + * @returns {mat4} out + */ + function fromRotationTranslationScale(out, q, v, s) { + // Quaternion math + var x = q[0], + y = q[1], + z = q[2], + w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz; + out[9] = (yz - wx) * sz; + out[10] = (1 - (xx + yy)) * sz; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + + /** + * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, dest, vec); + * mat4.translate(dest, dest, origin); + * let quatMat = mat4.create(); + * mat4.fromQuat(quatMat, quat); + * mat4.multiply(dest, dest, quatMat); + * mat4.scale(dest, dest, scale) + * mat4.translate(dest, dest, negativeOrigin); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat} q Rotation quaternion + * @param {ReadonlyVec3} v Translation vector + * @param {ReadonlyVec3} s Scaling vector + * @param {ReadonlyVec3} o The origin vector around which to scale and rotate + * @returns {mat4} out + */ + function fromRotationTranslationScaleOrigin(out, q, v, s, o) { + // Quaternion math + var x = q[0], + y = q[1], + z = q[2], + w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + var sx = s[0]; + var sy = s[1]; + var sz = s[2]; + var ox = o[0]; + var oy = o[1]; + var oz = o[2]; + var out0 = (1 - (yy + zz)) * sx; + var out1 = (xy + wz) * sx; + var out2 = (xz - wy) * sx; + var out4 = (xy - wz) * sy; + var out5 = (1 - (xx + zz)) * sy; + var out6 = (yz + wx) * sy; + var out8 = (xz + wy) * sz; + var out9 = (yz - wx) * sz; + var out10 = (1 - (xx + yy)) * sz; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + + /** + * Calculates a 4x4 matrix from the given quaternion + * + * @param {mat4} out mat4 receiving operation result + * @param {ReadonlyQuat} q Quaternion to create matrix from + * + * @returns {mat4} out + */ + function fromQuat(out, q) { + var x = q[0], + y = q[1], + z = q[2], + w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var yx = y * x2; + var yy = y * y2; + var zx = z * x2; + var zy = z * y2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + + /** + * Generates a frustum matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {Number} left Left bound of the frustum + * @param {Number} right Right bound of the frustum + * @param {Number} bottom Bottom bound of the frustum + * @param {Number} top Top bound of the frustum + * @param {Number} near Near bound of the frustum + * @param {Number} far Far bound of the frustum + * @returns {mat4} out + */ + function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near * 2 * nf; + out[15] = 0; + return out; + } + + /** + * Generates a perspective projection matrix with the given bounds. + * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], + * which matches WebGL/OpenGL's clip volume. + * Passing null/undefined/no value for far will generate infinite projection matrix. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum, can be null or Infinity + * @returns {mat4} out + */ + function perspectiveNO(out, fovy, aspect, near, far) { + var f = 1.0 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; + } + return out; + } + + /** + * Alias for {@link mat4.perspectiveNO} + * @function + */ + var perspective = perspectiveNO; + + /** + * Generates a look-at matrix with the given eye position, focal point, and up axis. + * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {ReadonlyVec3} eye Position of the viewer + * @param {ReadonlyVec3} center Point the viewer is looking at + * @param {ReadonlyVec3} up vec3 pointing up + * @returns {mat4} out + */ + function lookAt(out, eye, center, up) { + var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var centerx = center[0]; + var centery = center[1]; + var centerz = center[2]; + if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) { + return identity(out); + } + z0 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); + z0 *= len; + z1 *= len; + z2 *= len; + x0 = upy * z2 - upz * z1; + x1 = upz * z0 - upx * z2; + x2 = upx * z1 - upy * z0; + len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); + if (!len) { + x0 = 0; + x1 = 0; + x2 = 0; + } else { + len = 1 / len; + x0 *= len; + x1 *= len; + x2 *= len; + } + y0 = z1 * x2 - z2 * x1; + y1 = z2 * x0 - z0 * x2; + y2 = z0 * x1 - z1 * x0; + len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); + if (!len) { + y0 = 0; + y1 = 0; + y2 = 0; + } else { + len = 1 / len; + y0 *= len; + y1 *= len; + y2 *= len; + } + out[0] = x0; + out[1] = y0; + out[2] = z0; + out[3] = 0; + out[4] = x1; + out[5] = y1; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); + out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); + out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + + /** + * Alias for {@link mat4.multiply} + * @function + */ + var mul = multiply$2; + + /** + * 3 Dimensional Vector + * @module vec3 + */ + + /** + * Creates a new, empty vec3 + * + * @returns {vec3} a new 3D vector + */ + function create$3() { + var out = new ARRAY_TYPE(3); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + return out; + } + + /** + * Creates a new vec3 initialized with values from an existing vector + * + * @param {ReadonlyVec3} a vector to clone + * @returns {vec3} a new 3D vector + */ + function clone$4(a) { + var out = new ARRAY_TYPE(3); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + + /** + * Calculates the length of a vec3 + * + * @param {ReadonlyVec3} a vector to calculate length of + * @returns {Number} length of a + */ + function length(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + + /** + * Creates a new vec3 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} a new 3D vector + */ + function fromValues$3(x, y, z) { + var out = new ARRAY_TYPE(3); + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + + /** + * Copy the values from one vec3 to another + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the source vector + * @returns {vec3} out + */ + function copy$3(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + return out; + } + + /** + * Set the components of a vec3 to the given values + * + * @param {vec3} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @returns {vec3} out + */ + function set$3(out, x, y, z) { + out[0] = x; + out[1] = y; + out[2] = z; + return out; + } + + /** + * Adds two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function add(out, a, b) { + out[0] = a[0] + b[0]; + out[1] = a[1] + b[1]; + out[2] = a[2] + b[2]; + return out; + } + + /** + * Subtracts vector b from vector a + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function subtract(out, a, b) { + out[0] = a[0] - b[0]; + out[1] = a[1] - b[1]; + out[2] = a[2] - b[2]; + return out; + } + + /** + * Multiplies two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function multiply$1(out, a, b) { + out[0] = a[0] * b[0]; + out[1] = a[1] * b[1]; + out[2] = a[2] * b[2]; + return out; + } + + /** + * Returns the minimum of two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function min(out, a, b) { + out[0] = Math.min(a[0], b[0]); + out[1] = Math.min(a[1], b[1]); + out[2] = Math.min(a[2], b[2]); + return out; + } + + /** + * Returns the maximum of two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function max(out, a, b) { + out[0] = Math.max(a[0], b[0]); + out[1] = Math.max(a[1], b[1]); + out[2] = Math.max(a[2], b[2]); + return out; + } + + /** + * Scales a vec3 by a scalar number + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to scale + * @param {Number} b amount to scale the vector by + * @returns {vec3} out + */ + function scale(out, a, b) { + out[0] = a[0] * b; + out[1] = a[1] * b; + out[2] = a[2] * b; + return out; + } + + /** + * Adds two vec3's after scaling the second operand by a scalar value + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @param {Number} scale the amount to scale b by before adding + * @returns {vec3} out + */ + function scaleAndAdd(out, a, b, scale) { + out[0] = a[0] + b[0] * scale; + out[1] = a[1] + b[1] * scale; + out[2] = a[2] + b[2] * scale; + return out; + } + + /** + * Calculates the euclidian distance between two vec3's + * + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {Number} distance between a and b + */ + function distance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return Math.sqrt(x * x + y * y + z * z); + } + + /** + * Calculates the squared euclidian distance between two vec3's + * + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {Number} squared distance between a and b + */ + function squaredDistance(a, b) { + var x = b[0] - a[0]; + var y = b[1] - a[1]; + var z = b[2] - a[2]; + return x * x + y * y + z * z; + } + + /** + * Calculates the squared length of a vec3 + * + * @param {ReadonlyVec3} a vector to calculate squared length of + * @returns {Number} squared length of a + */ + function squaredLength(a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + return x * x + y * y + z * z; + } + + /** + * Negates the components of a vec3 + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a vector to negate + * @returns {vec3} out + */ + function negate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + return out; + } + + /** + * Normalize a vec3 + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a vector to normalize + * @returns {vec3} out + */ + function normalize$2(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var len = x * x + y * y + z * z; + if (len > 0) { + //TODO: evaluate use of glm_invsqrt here? + len = 1 / Math.sqrt(len); + } + out[0] = a[0] * len; + out[1] = a[1] * len; + out[2] = a[2] * len; + return out; + } + + /** + * Calculates the dot product of two vec3's + * + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {Number} dot product of a and b + */ + function dot$1(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; + } + + /** + * Computes the cross product of two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @returns {vec3} out + */ + function cross(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2]; + var bx = b[0], + by = b[1], + bz = b[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + + /** + * Performs a linear interpolation between two vec3's + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the first operand + * @param {ReadonlyVec3} b the second operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {vec3} out + */ + function lerp(out, a, b, t) { + var ax = a[0]; + var ay = a[1]; + var az = a[2]; + out[0] = ax + t * (b[0] - ax); + out[1] = ay + t * (b[1] - ay); + out[2] = az + t * (b[2] - az); + return out; + } + + /** + * Transforms the vec3 with a mat4. + * 4th vector component is implicitly '1' + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to transform + * @param {ReadonlyMat4} m matrix to transform with + * @returns {vec3} out + */ + function transformMat4$2(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + var w = m[3] * x + m[7] * y + m[11] * z + m[15]; + w = w || 1.0; + out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; + out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; + out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; + return out; + } + + /** + * Transforms the vec3 with a mat3. + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to transform + * @param {ReadonlyMat3} m the 3x3 matrix to transform with + * @returns {vec3} out + */ + function transformMat3(out, a, m) { + var x = a[0], + y = a[1], + z = a[2]; + out[0] = x * m[0] + y * m[3] + z * m[6]; + out[1] = x * m[1] + y * m[4] + z * m[7]; + out[2] = x * m[2] + y * m[5] + z * m[8]; + return out; + } + + /** + * Transforms the vec3 with a quat + * Can also be used for dual quaternions. (Multiply it with the real part) + * + * @param {vec3} out the receiving vector + * @param {ReadonlyVec3} a the vector to transform + * @param {ReadonlyQuat} q normalized quaternion to transform with + * @returns {vec3} out + */ + function transformQuat(out, a, q) { + // Fast Vector Rotation using Quaternions by Robert Eisele + // https://raw.org/proof/vector-rotation-using-quaternions/ + + var qx = q[0], + qy = q[1], + qz = q[2], + qw = q[3]; + var vx = a[0], + vy = a[1], + vz = a[2]; + + // t = q x v + var tx = qy * vz - qz * vy; + var ty = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + + // t = 2t + tx = tx + tx; + ty = ty + ty; + tz = tz + tz; + + // v + w t + q x t + out[0] = vx + qw * tx + qy * tz - qz * ty; + out[1] = vy + qw * ty + qz * tx - qx * tz; + out[2] = vz + qw * tz + qx * ty - qy * tx; + return out; + } + + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {ReadonlyVec3} a The first vector. + * @param {ReadonlyVec3} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function exactEquals$1(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; + } + + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {ReadonlyVec3} a The first vector. + * @param {ReadonlyVec3} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function equals$2(a, b) { + var a0 = a[0], + a1 = a[1], + a2 = a[2]; + var b0 = b[0], + b1 = b[1], + b2 = b[2]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)); + } + + /** + * Alias for {@link vec3.length} + * @function + */ + var len = length; + + /** + * Perform some operation over an array of vec3s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + (function () { + var vec = create$3(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + if (!stride) { + stride = 3; + } + if (!offset) { + offset = 0; + } + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + } + return a; + }; + })(); + + /** + * 4 Dimensional Vector + * @module vec4 + */ + + /** + * Creates a new, empty vec4 + * + * @returns {vec4} a new 4D vector + */ + function create$2() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + } + return out; + } + + /** + * Creates a new vec4 initialized with values from an existing vector + * + * @param {ReadonlyVec4} a vector to clone + * @returns {vec4} a new 4D vector + */ + function clone$3(a) { + var out = new ARRAY_TYPE(4); + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + + /** + * Creates a new vec4 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {vec4} a new 4D vector + */ + function fromValues$2(x, y, z, w) { + var out = new ARRAY_TYPE(4); + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + + /** + * Copy the values from one vec4 to another + * + * @param {vec4} out the receiving vector + * @param {ReadonlyVec4} a the source vector + * @returns {vec4} out + */ + function copy$2(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + return out; + } + + /** + * Set the components of a vec4 to the given values + * + * @param {vec4} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {vec4} out + */ + function set$2(out, x, y, z, w) { + out[0] = x; + out[1] = y; + out[2] = z; + out[3] = w; + return out; + } + + /** + * Normalize a vec4 + * + * @param {vec4} out the receiving vector + * @param {ReadonlyVec4} a vector to normalize + * @returns {vec4} out + */ + function normalize$1(out, a) { + var x = a[0]; + var y = a[1]; + var z = a[2]; + var w = a[3]; + var len = x * x + y * y + z * z + w * w; + if (len > 0) { + len = 1 / Math.sqrt(len); + } + out[0] = x * len; + out[1] = y * len; + out[2] = z * len; + out[3] = w * len; + return out; + } + + /** + * Calculates the dot product of two vec4's + * + * @param {ReadonlyVec4} a the first operand + * @param {ReadonlyVec4} b the second operand + * @returns {Number} dot product of a and b + */ + function dot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; + } + + /** + * Transforms the vec4 with a mat4. + * + * @param {vec4} out the receiving vector + * @param {ReadonlyVec4} a the vector to transform + * @param {ReadonlyMat4} m matrix to transform with + * @returns {vec4} out + */ + function transformMat4$1(out, a, m) { + var x = a[0], + y = a[1], + z = a[2], + w = a[3]; + out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; + out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; + out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; + out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; + return out; + } + + /** + * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) + * + * @param {ReadonlyVec4} a The first vector. + * @param {ReadonlyVec4} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function exactEquals(a, b) { + return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; + } + + /** + * Perform some operation over an array of vec4s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + (function () { + var vec = create$2(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + if (!stride) { + stride = 4; + } + if (!offset) { + offset = 0; + } + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + vec[2] = a[i + 2]; + vec[3] = a[i + 3]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + a[i + 2] = vec[2]; + a[i + 3] = vec[3]; + } + return a; + }; + })(); + + /** + * Quaternion in the format XYZW + * @module quat + */ + + /** + * Creates a new identity quat + * + * @returns {quat} a new quaternion + */ + function create$1() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + out[3] = 1; + return out; + } + + /** + * Sets a quat from the given angle and rotation axis, + * then returns it. + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyVec3} axis the axis around which to rotate + * @param {Number} rad the angle in radians + * @returns {quat} out + **/ + function setAxisAngle(out, axis, rad) { + rad = rad * 0.5; + var s = Math.sin(rad); + out[0] = s * axis[0]; + out[1] = s * axis[1]; + out[2] = s * axis[2]; + out[3] = Math.cos(rad); + return out; + } + + /** + * Multiplies two quat's + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a the first operand + * @param {ReadonlyQuat} b the second operand + * @returns {quat} out + */ + function multiply(out, a, b) { + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + + /** + * Rotates a quaternion by the given angle about the X axis + * + * @param {quat} out quat receiving operation result + * @param {ReadonlyQuat} a quat to rotate + * @param {number} rad angle (in radians) to rotate + * @returns {quat} out + */ + function rotateX(out, a, rad) { + rad *= 0.5; + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = Math.sin(rad), + bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + + /** + * Rotates a quaternion by the given angle about the Y axis + * + * @param {quat} out quat receiving operation result + * @param {ReadonlyQuat} a quat to rotate + * @param {number} rad angle (in radians) to rotate + * @returns {quat} out + */ + function rotateY(out, a, rad) { + rad *= 0.5; + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var by = Math.sin(rad), + bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + + /** + * Performs a spherical linear interpolation between two quat + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a the first operand + * @param {ReadonlyQuat} b the second operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {quat} out + */ + function slerp(out, a, b, t) { + // benchmarks: + // http://jsperf.com/quaternion-slerp-implementations + var ax = a[0], + ay = a[1], + az = a[2], + aw = a[3]; + var bx = b[0], + by = b[1], + bz = b[2], + bw = b[3]; + var omega, cosom, sinom, scale0, scale1; + + // calc cosine + cosom = ax * bx + ay * by + az * bz + aw * bw; + // adjust signs (if necessary) + if (cosom < 0.0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + // calculate coefficients + if (1.0 - cosom > EPSILON) { + // standard case (slerp) + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1.0 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + // "from" and "to" quaternions are very close + // ... so we can do a linear interpolation + scale0 = 1.0 - t; + scale1 = t; + } + // calculate final values + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + + /** + * Calculates the conjugate of a quat + * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a quat to calculate conjugate of + * @returns {quat} out + */ + function conjugate(out, a) { + out[0] = -a[0]; + out[1] = -a[1]; + out[2] = -a[2]; + out[3] = a[3]; + return out; + } + + /** + * Creates a quaternion from the given 3x3 rotation matrix. + * + * NOTE: The resultant quaternion is not normalized, so you should be sure + * to renormalize the quaternion yourself where necessary. + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyMat3} m rotation matrix + * @returns {quat} out + * @function + */ + function fromMat3(out, m) { + // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes + // article "Quaternion Calculus and Fast Animation". + var fTrace = m[0] + m[4] + m[8]; + var fRoot; + if (fTrace > 0.0) { + // |w| > 1/2, may as well choose w > 1/2 + fRoot = Math.sqrt(fTrace + 1.0); // 2w + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; // 1/(4w) + out[0] = (m[5] - m[7]) * fRoot; + out[1] = (m[6] - m[2]) * fRoot; + out[2] = (m[1] - m[3]) * fRoot; + } else { + // |w| <= 1/2 + var i = 0; + if (m[4] > m[0]) i = 1; + if (m[8] > m[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; + out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; + out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + } + return out; + } + + /** + * Creates a new quat initialized with values from an existing quaternion + * + * @param {ReadonlyQuat} a quaternion to clone + * @returns {quat} a new quaternion + * @function + */ + var clone$2 = clone$3; + + /** + * Creates a new quat initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {quat} a new quaternion + * @function + */ + var fromValues$1 = fromValues$2; + + /** + * Copy the values from one quat to another + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a the source quaternion + * @returns {quat} out + * @function + */ + var copy$1 = copy$2; + + /** + * Set the components of a quat to the given values + * + * @param {quat} out the receiving quaternion + * @param {Number} x X component + * @param {Number} y Y component + * @param {Number} z Z component + * @param {Number} w W component + * @returns {quat} out + * @function + */ + var set$1 = set$2; + + /** + * Normalize a quat + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a quaternion to normalize + * @returns {quat} out + * @function + */ + var normalize = normalize$1; + + /** + * Returns whether or not the quaternions point approximately to the same direction. + * + * Both quaternions are assumed to be unit length. + * + * @param {ReadonlyQuat} a The first unit quaternion. + * @param {ReadonlyQuat} b The second unit quaternion. + * @returns {Boolean} True if the quaternions are equal, false otherwise. + */ + function equals$1(a, b) { + return Math.abs(dot(a, b)) >= 1 - EPSILON; + } + + /** + * Sets a quaternion to represent the shortest rotation from one + * vector to another. + * + * Both vectors are assumed to be unit length. + * + * @param {quat} out the receiving quaternion. + * @param {ReadonlyVec3} a the initial vector + * @param {ReadonlyVec3} b the destination vector + * @returns {quat} out + */ + var rotationTo = function () { + var tmpvec3 = create$3(); + var xUnitVec3 = fromValues$3(1, 0, 0); + var yUnitVec3 = fromValues$3(0, 1, 0); + return function (out, a, b) { + var dot = dot$1(a, b); + if (dot < -0.999999) { + cross(tmpvec3, xUnitVec3, a); + if (len(tmpvec3) < 0.000001) cross(tmpvec3, yUnitVec3, a); + normalize$2(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); + return out; + } else if (dot > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + cross(tmpvec3, a, b); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot; + return normalize(out, out); + } + }; + }(); + + /** + * Performs a spherical linear interpolation with two control points + * + * @param {quat} out the receiving quaternion + * @param {ReadonlyQuat} a the first operand + * @param {ReadonlyQuat} b the second operand + * @param {ReadonlyQuat} c the third operand + * @param {ReadonlyQuat} d the fourth operand + * @param {Number} t interpolation amount, in the range [0-1], between the two inputs + * @returns {quat} out + */ + (function () { + var temp1 = create$1(); + var temp2 = create$1(); + return function (out, a, b, c, d, t) { + slerp(temp1, a, d, t); + slerp(temp2, b, c, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + })(); + + /** + * Sets the specified quaternion with values corresponding to the given + * axes. Each axis is a vec3 and is expected to be unit length and + * perpendicular to all other specified axes. + * + * @param {ReadonlyVec3} view the vector representing the viewing direction + * @param {ReadonlyVec3} right the vector representing the local "right" direction + * @param {ReadonlyVec3} up the vector representing the local "up" direction + * @returns {quat} out + */ + (function () { + var matr = create$5(); + return function (out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize(out, fromMat3(out, matr)); + }; + })(); + + /** + * 2 Dimensional Vector + * @module vec2 + */ + + /** + * Creates a new, empty vec2 + * + * @returns {vec2} a new 2D vector + */ + function create() { + var out = new ARRAY_TYPE(2); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + } + return out; + } + + /** + * Creates a new vec2 initialized with values from an existing vector + * + * @param {ReadonlyVec2} a vector to clone + * @returns {vec2} a new 2D vector + */ + function clone$1(a) { + var out = new ARRAY_TYPE(2); + out[0] = a[0]; + out[1] = a[1]; + return out; + } + + /** + * Creates a new vec2 initialized with the given values + * + * @param {Number} x X component + * @param {Number} y Y component + * @returns {vec2} a new 2D vector + */ + function fromValues(x, y) { + var out = new ARRAY_TYPE(2); + out[0] = x; + out[1] = y; + return out; + } + + /** + * Copy the values from one vec2 to another + * + * @param {vec2} out the receiving vector + * @param {ReadonlyVec2} a the source vector + * @returns {vec2} out + */ + function copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + return out; + } + + /** + * Set the components of a vec2 to the given values + * + * @param {vec2} out the receiving vector + * @param {Number} x X component + * @param {Number} y Y component + * @returns {vec2} out + */ + function set(out, x, y) { + out[0] = x; + out[1] = y; + return out; + } + + /** + * Transforms the vec2 with a mat4 + * 3rd vector component is implicitly '0' + * 4th vector component is implicitly '1' + * + * @param {vec2} out the receiving vector + * @param {ReadonlyVec2} a the vector to transform + * @param {ReadonlyMat4} m matrix to transform with + * @returns {vec2} out + */ + function transformMat4(out, a, m) { + var x = a[0]; + var y = a[1]; + out[0] = m[0] * x + m[4] * y + m[12]; + out[1] = m[1] * x + m[5] * y + m[13]; + return out; + } + + /** + * Returns whether or not the vectors have approximately the same elements in the same position. + * + * @param {ReadonlyVec2} a The first vector. + * @param {ReadonlyVec2} b The second vector. + * @returns {Boolean} True if the vectors are equal, false otherwise. + */ + function equals(a, b) { + var a0 = a[0], + a1 = a[1]; + var b0 = b[0], + b1 = b[1]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)); + } + + /** + * Perform some operation over an array of vec2s. + * + * @param {Array} a the array of vectors to iterate over + * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed + * @param {Number} offset Number of elements to skip at the beginning of the array + * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array + * @param {Function} fn Function to call for each vector in the array + * @param {Object} [arg] additional argument to pass to fn + * @returns {Array} a + * @function + */ + (function () { + var vec = create(); + return function (a, stride, offset, count, fn, arg) { + var i, l; + if (!stride) { + stride = 2; + } + if (!offset) { + offset = 0; + } + if (count) { + l = Math.min(count * stride + offset, a.length); + } else { + l = a.length; + } + for (i = offset; i < l; i += stride) { + vec[0] = a[i]; + vec[1] = a[i + 1]; + fn(vec, vec, arg); + a[i] = vec[0]; + a[i + 1] = vec[1]; + } + return a; + }; + })(); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Constants { + } + Constants.TWO_PI = 6.283185307179586; + Constants.PI = 3.141592653589793; + Constants.PI_OVER_TWO = 1.5707963267948966; + Constants.PI_OVER_THREE = 1.0471975511965976; + Constants.PI_OVER_FOUR = 0.7853981633974483; + Constants.PI_OVER_SIX = 0.5235987755982988; + Constants.LOG_2 = 0.6931471805599453; + Constants.RADIANS_PER_DEGREE = 0.017453292519943295; + Constants.DEGREES_PER_RADIAN = 57.29577951308232; + Constants.ROOT_TWO = 1.4142135623730951; + Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; + Constants.ROOT_THREE = 1.7320508075688772; + Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; + Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; + Constants.VECTOR2_ZERO = fromValues(0, 0); + Constants.VECTOR2_ONE = fromValues(1, 1); + Constants.VECTOR2_UNITX = fromValues(1, 0); + Constants.VECTOR2_UNITY = fromValues(0, 1); + Constants.VECTOR3_ZERO = fromValues$3(0, 0, 0); + Constants.VECTOR3_ONE = fromValues$3(1, 1, 1); + Constants.VECTOR3_UNITX = fromValues$3(1, 0, 0); + Constants.VECTOR3_UNITY = fromValues$3(0, 1, 0); + Constants.VECTOR3_UNITZ = fromValues$3(0, 0, 1); + Constants.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); + Constants.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); + Constants.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); + Constants.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); + Constants.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); + Constants.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); + Constants.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); + Constants.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); + Constants.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); + Constants.MAT3_IDENTITY = create$5(); + Constants.MAT4_IDENTITY = create$4(); + Constants.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + Constants.QUAT_IDENTITY = create$1(); + Constants.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); + Constants.MILLISECONDS_PER_DAY = 86400000; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class MathHelper { + static simpleLinearRegression(points) { + const n = points.length; + let sumX = 0; + let sumY = 0; + let sumXY = 0; + let sumXX = 0; + for (let i = 0; i < n; i++) { + sumX += points[i].x; + sumY += points[i].y; + sumXY += points[i].x * points[i].y; + sumXX += points[i].x * points[i].x; + } + const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); + const yIntercept = (sumY - slope * sumX) / n; + return { slope, yIntercept }; + } + static clamp(value, min, max) { + return Math.max(Math.min(value, max), min); + } + static lerp(value1, value2, amount) { + return value1 + (value2 - value1) * amount; + } + static normalize(value, min, max, from = 0, to = 1) { + return max - min == 0 ? 0 : Math.max(Math.min((to - from) * (value - min) / (max - min) + from, to), from); + } + static splitExponent(value, result) { + let exponent = Math.round(Math.log10(Math.abs(value))); + let coefficient = value / Math.pow(10, exponent); + if (coefficient < 1) { + coefficient *= 10; + exponent--; + } + result[0] = coefficient; + result[1] = exponent; + } + static combineExponent(mantissa, exponent) { + return mantissa * Math.pow(10, exponent); + } + static isPowerOf2(value) { + return (value & (value - 1)) == 0; + } + } + class PseudoRandom { + constructor(seed) { + this._seed = seed % 2147483647; + if (this._seed <= 0) + this._seed += 2147483646; + } + next() { + return this._seed = this._seed * 16807 % 2147483647; + } + ; + nextFloat() { + return (this.next() - 1) / 2147483646; + } + ; + nextInteger(min, max) { + return Math.floor(this.nextFloat() * (max - min + 1) + min); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AngleHelper { + static degreesToRadians(degrees) { + return degrees * Constants.RADIANS_PER_DEGREE; + } + static radiansToDegrees(radians) { + return radians * Constants.DEGREES_PER_RADIAN; + } + static wrapAngle(angle) { + if (angle > Constants.PI) + angle = angle - Constants.TWO_PI; + else if (angle < -Constants.PI) + angle += Constants.TWO_PI; + return angle; + } + static sphericalToCartesian(altitude, longitude, latitude, result) { + latitude = AngleHelper.degreesToRadians(latitude); + longitude = AngleHelper.degreesToRadians(longitude); + const scale = Math.cos(latitude); + result[0] = altitude * scale * Math.sin(longitude); + result[1] = altitude * Math.sin(latitude); + result[2] = altitude * scale * Math.cos(longitude); + } + static cartesianToSpherical(x, y, z, result) { + result[0] = Math.atan2(x, z); + result[1] = Math.asin(y); + } + static angleBetweenVectors(from, to) { + if (exactEquals$1(from, to)) { + return 0; + } + else { + const dot = MathHelper.clamp(dot$1(from, to), -1, 1); + return Math.acos(dot); + } + } + static signedAngleBetweenVectors(from, to, up) { + if (exactEquals$1(from, to)) { + return 0; + } + else { + const dot = MathHelper.clamp(dot$1(from, to), -1, 1); + let angle = Math.acos(dot); + cross(AngleHelper._vec3, from, to); + if (dot$1(AngleHelper._vec3, up) < 0) { + angle = -angle; + } + return angle; + } + } + } + AngleHelper._vec3 = create$3(); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class CameraBase { + getView(view) { + this.getPosition(view.position); + } + setView(view, isSmooth) { + this.setPosition(view.position, isSmooth); + } + lerpView(from, to, time) { + lerp(this._vec3, from.position, to.position, time); + this.setPosition(this._vec3, false); + } + get vMatrices() { return this._vMatrices; } + get inverseVMatrices() { return this._inverseVMatrices; } + get mvMatrices() { return this._mvMatrices; } + get pMatrices() { return this._pMatrices; } + get inversePMatrices() { return this._inversePMatrices; } + get pickVMatrix() { return this._pickVMatrix; } + get rMatrix() { return this._mat3; } + getOrbit(value) { copy$1(value, this._orbitRotation); } + setOrbit(value, isSmooth) { + copy$1(this._orbitRotation, value); + if (!isSmooth) { + copy$1(this._smoothedOrbitRotation, value); + } + } + ; + getPosition(value) { copy$3(value, this._cameraPosition); } + setPosition(value, isSmooth) { + copy$3(this._cameraPosition, value); + if (!isSmooth) { + copy$3(this._smoothedCameraPosition, value); + } + } + ; + constructor(core) { + this._core = core; + this._vec3 = create$3(); + this._quat = create$1(); + this._mat3 = create$5(); + this._right = create$3(); + this._up = create$3(); + this._forward = create$3(); + this._modelManipulationOrigin = create$3(); + this.modelPosition = create$3(); + this.modelScale = create$3(); + this.modelRotation = create$1(); + this._orbitRotation = create$1(); + this._orbitDirection = create$1(); + this._smoothedOrbitRotation = create$1(); + this._smoothedCameraPosition = create$3(); + this._smoothedCameraRotation = create$1(); + this._cameraPosition = create$3(); + this._cameraRotation = create$1(); + this._combinedPosition = create$3(); + this._combinedRotation = create$1(); + this._leftToRightEye = create$3(); + this._pickVMatrix = create$4(); + this._eyePositions = [create$3(), create$3()]; + this._vMatrices = [create$4(), create$4()]; + this._mvMatrices = [create$4(), create$4()]; + this._pMatrices = [create$4(), create$4()]; + this._inverseVMatrices = [create$4(), create$4()]; + this._inversePMatrices = [create$4(), create$4()]; + } + reset(isSmooth) { + copy$3(this._cameraPosition, Constants.VECTOR3_ZERO); + copy$1(this._cameraRotation, Constants.QUAT_IDENTITY); + copy$1(this._orbitRotation, Constants.QUAT_IDENTITY); + if (!isSmooth) { + this.syncSmooth(); + } + } + update(elapsedTime) { + let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); + lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); + amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); + slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); + slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); + const epsilon = 0.000001; + let x; + let y; + let z; + let w; + x = this._smoothedCameraPosition[0] - this._cameraPosition[0]; + y = this._smoothedCameraPosition[1] - this._cameraPosition[1]; + z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; + if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon) { + copy$3(this._smoothedCameraPosition, this._cameraPosition); + } + x = this._smoothedCameraRotation[0] - this._cameraRotation[0]; + y = this._smoothedCameraRotation[1] - this._cameraRotation[1]; + z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; + w = this._smoothedCameraRotation[3] - this._cameraRotation[3]; + if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) { + copy$1(this._smoothedCameraRotation, this._cameraRotation); + } + x = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; + y = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; + z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; + w = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; + if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) { + copy$1(this._smoothedOrbitRotation, this._orbitRotation); + } + normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); + normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); + conjugate(this._orbitDirection, this._smoothedOrbitRotation); + transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); + subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); + transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); + add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); + multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); + fromQuat$1(this._mat3, this._combinedRotation); + this._right[0] = this._mat3[0]; + this._right[1] = this._mat3[1]; + this._right[2] = this._mat3[2]; + this._up[0] = this._mat3[3]; + this._up[1] = this._mat3[4]; + this._up[2] = this._mat3[5]; + this._forward[0] = this._mat3[6]; + this._forward[1] = this._mat3[7]; + this._forward[2] = this._mat3[8]; + const view = this._vMatrices[0]; + view[0] = this._right[0]; + view[1] = this._up[0]; + view[2] = this._forward[0]; + view[4] = this._right[1]; + view[5] = this._up[1]; + view[6] = this._forward[1]; + view[8] = this._right[2]; + view[9] = this._up[2]; + view[10] = this._forward[2]; + view[12] = -dot$1(this._right, this._combinedPosition); + view[13] = -dot$1(this._up, this._combinedPosition); + view[14] = -dot$1(this._forward, this._combinedPosition); + const aspectRatio = this.width / this.height; + if (this._core.config.stereoMode == StereoMode.none) { + if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + const left = -aspectRatio * top; + const right = aspectRatio * top; + const width = right - left; + const height = top - bottom; + const tileWidth = width / this._core.config.tilesX; + const tileHeight = height / this._core.config.tilesY; + frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); + } + else { + perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); + } + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + invert(this._inverseVMatrices[0], this.vMatrices[0]); + invert(this._inversePMatrices[0], this.pMatrices[0]); + } + else { + cross(this._leftToRightEye, this._forward, this._up); + normalize$2(this._leftToRightEye, this._leftToRightEye); + scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); + scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); + this._vMatrices[0][12] += this._core.config.ipd * 0.5; + copy$4(this._vMatrices[1], this._vMatrices[0]); + this._vMatrices[1][12] -= this._core.config.ipd; + const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + let left = -aspectRatio * top + frustumShift; + let right = aspectRatio * top + frustumShift; + frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + left = -aspectRatio * top - frustumShift; + right = aspectRatio * top - frustumShift; + frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); + invert(this._inverseVMatrices[0], this._vMatrices[0]); + invert(this._inversePMatrices[0], this._pMatrices[0]); + copy$4(this._inverseVMatrices[1], this._inverseVMatrices[0]); + this._inverseVMatrices[1][12] += this._core.config.ipd; + invert(this._inversePMatrices[1], this._pMatrices[1]); + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } + } + _zoom(direction, distance) { + scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance); + } + rotate(translationDelta) { } + zoom(zoomDelta, x, y) { + this.unproject(this._vec3, x, y, 1); + normalize$2(this._vec3, this._vec3); + const distance$1 = zoomDelta * distance(this._combinedPosition, this.modelPosition); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + this._zoom(this._vec3, distance$1); + } + _twist(axis, angle) { } + twist(angle, x, y) { } + updatePickVMatrix(x, y) { + this.unproject(this._vec3, x, y, 1); + lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); + } + syncSmooth() { + copy$3(this._smoothedCameraPosition, this._cameraPosition); + copy$1(this._smoothedCameraRotation, this._cameraRotation); + copy$1(this._smoothedOrbitRotation, this._orbitRotation); + } + updateModelManipulationOrigin(from, to) { + const a = create$3(); + const b = create$3(); + const c = create$3(); + const d = create$3(); + transformMat4$2(a, from, this.modelMMatrix); + transformMat4$2(b, to, this.modelMMatrix); + subtract(a, this._cameraPosition, a); + subtract(b, this._cameraPosition, b); + transformQuat(c, a, this._orbitDirection); + transformQuat(d, b, this._orbitDirection); + subtract(c, c, a); + subtract(d, d, b); + subtract(this._vec3, c, d); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + add(this._cameraPosition, this._cameraPosition, this._vec3); + add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); + } + unproject(position, x, y, z) { + set$3(position, 2 * x / this.width - 1, 1 - 2 * y / this.height, z); + transformMat4$2(position, position, this._inversePMatrices[0]); + transformMat4$2(position, position, this._inverseVMatrices[0]); + } + translate(translationDelta) { + const distance$1 = distance(this.modelPosition, this._combinedPosition); + const height = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; + set$3(this._vec3, height * translationDelta[0], -height * translationDelta[1], 0); + transformQuat(this._vec3, this._vec3, this._combinedRotation); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + subtract(this._cameraPosition, this._cameraPosition, this._vec3); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AltAzimuthCamera extends CameraBase { + getView(view) { + super.getView(view); + view.altitude = this.altitude; + view.azimuth = this.azimuth; + view.fov = this._core.config.fov; + } + setView(view, isSmooth) { + super.setView(view, isSmooth); + this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); + this._core.config.fov = view.fov; + } + lerpView(from, to, time) { + super.lerpView(from, to, time); + this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time), MathHelper.lerp(from.azimuth, to.azimuth, time), false); + this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time); + } + update(elapsedTime) { + super.update(elapsedTime); + if (this._core.config.isDebugVisible) { + const altitude = AngleHelper.radiansToDegrees(this.altitude); + const azimuth = AngleHelper.radiansToDegrees(this.azimuth); + this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); + this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + } + } + get altitude() { + transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITY, this._up, this._right); + } + get azimuth() { + transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITX, this._right, this._up); + } + setAltAzimuth(altitude, azimuth, isSmooth) { + setAxisAngle(this._quat, Constants.VECTOR3_UNITX, altitude); + multiply(this._orbitRotation, this._quat, Constants.QUAT_IDENTITY); + setAxisAngle(this._quat, Constants.VECTOR3_UNITY, azimuth); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + if (!isSmooth) { + this.syncSmooth(); + } + } + rotate(translationDelta) { + const length = Math.min(this.width, this.height); + let angle = translationDelta[1] * Constants.PI / length; + setAxisAngle(this._quat, Constants.VECTOR3_UNITX, angle); + multiply(this._orbitRotation, this._quat, this._orbitRotation); + angle = translationDelta[0] * Constants.PI / length; + setAxisAngle(this._quat, Constants.VECTOR3_UNITY, angle); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Config$2 = class Config { + constructor(core) { + this.reset(); + } + reset() { + this.isDebugVisible = false; + this.logLevel = LogLevel.warn; + this.shaderPath = "shaders"; + this.fontPath = "fonts"; + this.modelDistance = 0.5; + this.modelSize = 0.25; + this.stereoMode = StereoMode.none; + this.ipd = 0.06; + this.screenDistance = 0.5; + this.fov = AngleHelper.degreesToRadians(30); + this.nearPlane = 0.01; + this.farPlane = 100; + this.pickWidth = 512; + this.pickHeight = 512; + this.pickHoldDelay = 1000; + this.pickSelectDelay = 100; + this.resizeMinimumDelay = 250; + this.rotationSmoothing = 0.02; + this.positionSmoothing = 0.02; + this.focusSmoothing = 0.01; + this.scaleSmoothing = 0.02; + this.mouseWheelZoomScale = -2e-3; + this.mouseWheelRotationScale = -2e-3; + this.dragToleranceSquared = 100; + this.manipulatorMinRelativeDistanceSquared = 100; + this.isMultiTouchEnabled = true; + this.isMultiTouchZoomEnabled = true; + this.isMultiTouchTwistEnabled = true; + this.isMultiTouchRotateEnabled = true; + this.isMultiTouchTranslateEnabled = true; + this.multiTouchZoomScale = 1; + this.cameraMinDistance = 0.1; + this.cameraMaxDistance = 10; + this.xrControllerRayColor = fromValues$3(0.5, 0.5, 0.5); + this.xrControllerProfile = "windows-mixed-reality"; + this.xrControllerHandedness = "right"; + this.paletteColor = new Uint8Array([0x80, 0x80, 0x80, 0]); + this.textColor = create$3(); + this.textHoverColor = create$3(); + this.textBorderColor = create$3(); + this.textBorderWidth = 0x18 / 0xff; + this.identityRotation = Constants.VECTOR3_UNITY; + this.axesTextLabelMaxGlyphs = 32; + this.axesTextColor = create$3(); + this.axesTextBorderColor = create$3(); + this.axesTextHoverColor = create$3(); + this.axesTextLabelMajorSize = 0.03; + this.axesTextLabelMinorSize = 0.02; + this.axesTextTitleMaxGlyphs = 127; + this.axesTextTitleSize = 0.05; + this.axesTextHeadingMaxGlyphs = 128; + this.axesTextHeadingSize = 0.075; + this.axesTextTitleLineHeight = 1.5; + this.axesTextHeadingLineHeight = 1.5; + this.axesTextLabelLineHeight = 1.5; + this.axesGridMajorThickness = 0.0002; + this.axesGridMinorThickness = 0.0001; + this.axesGridZeroThickness = 0.002; + this.axesGridPickDivisionHeight = 0.025; + this.axesGridBackgroundColor = create$3(); + this.axesGridHighlightColor = create$3(); + this.axesGridMinorColor = create$3(); + this.axesGridMajorColor = create$3(); + this.axesGridZeroColor = create$3(); + this.axesGridDefaultDivisions = 10; + this.keyTitleMaxGlyphs = 64; + this.keyLabelMaxGlyphs = 64; + this.selectionColor = create$3(); + this.hoverColor = create$3(); + this.activeColor = create$3(); + this.highlightMode = HighlightMode.color; + this.lassoThickness = 4; + this.lassoDashWidth = 2; + this.lassoColor = create$3(); + this.minCubifiedTreeMapSlice = 0.01; + this.sdfBuffer = 0xc0; + this.sdfBorder = 0x0; + this.forceDirectIsEnabled = false; + this.forceDirectAttraction = 1; + this.forceDirectRepulsion = 1; + this.forceDirectGravity = 1; + this.forceDirectInterval = 0.1; + this.forceDirectMaxDistance = 0.1; + this.forceDirectTheta = 1; + this.forceDirectIterationsPerLayout = 1; + this.forceDirectEdgeWeightPower = 1; + this.forceDirectLockX = false; + this.forceDirectLockY = false; + this.forceDirectLockZ = false; + this.transitionDuration = 400; + this.transitionStaggering = 100; + this.transitionView = true; + this.isTransitionPickingEnabled = false; + this.backgroundColor = create$2(); + this.theme = Theme.light; + this.ambientColor = create$3(); + this.renderMode = RenderMode.color; + this.tilesX = 1; + this.tilesY = 1; + this.tileOffsetX = 0; + this.tileOffsetY = 0; + } + get theme() { return this._theme; } + set theme(value) { + if (this._theme != value) { + this._theme = value; + switch (value) { + case Theme.dark: + set$2(this.backgroundColor, 0, 0, 0, 1); + set$3(this.textColor, 0.9, 0.9, 0.9); + set$3(this.textHoverColor, 1, 1, 1); + set$3(this.textBorderColor, 0, 0, 0); + set$3(this.axesTextColor, 0.9, 0.9, 0.9); + set$3(this.axesTextBorderColor, 0, 0, 0); + set$3(this.axesTextHoverColor, 1, 1, 1); + set$3(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); + set$3(this.axesGridHighlightColor, 0.04, 0.04, 0.04); + set$3(this.axesGridMinorColor, 0.05, 0.05, 0.05); + set$3(this.axesGridMajorColor, 0.1, 0.1, 0.1); + set$3(this.axesGridZeroColor, 0.05, 0.1, 0.1); + set$3(this.selectionColor, 1, 1, 0); + set$3(this.hoverColor, 1, 0, 1); + set$3(this.activeColor, 0, 1, 1); + set$3(this.lassoColor, 0.9, 0.9, 0.9); + break; + case Theme.light: + set$2(this.backgroundColor, 1, 1, 1, 1); + set$3(this.textColor, 0, 0, 0); + set$3(this.textHoverColor, 0.1, 0.1, 0.1); + set$3(this.textBorderColor, 1, 1, 1); + set$3(this.axesTextColor, 0, 0, 0); + set$3(this.axesTextBorderColor, 1, 1, 1); + set$3(this.axesTextHoverColor, 0.1, 0.1, 0.1); + set$3(this.axesGridBackgroundColor, 1, 1, 1); + set$3(this.axesGridHighlightColor, 0.925, 0.925, 0.925); + set$3(this.axesGridMinorColor, 0.9, 0.9, 0.9); + set$3(this.axesGridMajorColor, 0.8, 0.8, 0.8); + set$3(this.axesGridZeroColor, 0.7, 0.9, 0.9); + set$3(this.selectionColor, 1, 1, 0); + set$3(this.hoverColor, 1, 0, 1); + set$3(this.activeColor, 0, 1, 1); + set$3(this.lassoColor, 0.1, 0.1, 0.1); + break; + } + if (this.themeChangedCallback) { + this.themeChangedCallback(this._theme); + } + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class DebugText { + get text() { return this._text; } + constructor() { + this.clear(); + } + clear() { + this._text = ""; + } + addLine(value) { + this._text += value + "\n"; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Fps { + get frameCounter() { return this._frameCounter; } + get totalFrames() { return this._totalFrames; } + constructor(core) { + this._core = core; + this._totalFrames = 0; + this.reset(); + } + update(elapsedTime) { + this._elapsedTime += elapsedTime; + if (this._elapsedTime > 1000) { + this._elapsedTime -= 1000; + this._fps = this._frameCounter; + this._frameCounter = 0; + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`fps ${this._fps}`); + } + } + render() { + this._frameCounter++; + this._totalFrames++; + } + reset() { + this._fps = 0; + this._frameCounter = 0; + this._elapsedTime = 0; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const PaletteType = { + sequentialsinglehue: "sequentialsinglehue", + sequentialmultihue: "sequentialmultihue", + diverging: "diverging", + qualitative: "qualitative", + }; + class PaletteResources { + constructor() { + this.palettes = { + "blues": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 251, 255, 222, 235, 247, 198, 219, 239, 158, 202, 225, 107, 174, 214, 66, 146, 198, 33, 113, 181, 8, 81, 156, 8, 48, 107]) }, + "greens": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 252, 245, 229, 245, 224, 199, 233, 192, 161, 217, 155, 116, 196, 118, 65, 171, 93, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "greys": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 255, 255, 240, 240, 240, 217, 217, 217, 189, 189, 189, 150, 150, 150, 115, 115, 115, 82, 82, 82, 37, 37, 37, 0, 0, 0]) }, + "oranges": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 235, 254, 230, 206, 253, 208, 162, 253, 174, 107, 253, 141, 60, 241, 105, 19, 217, 72, 1, 166, 54, 3, 127, 39, 4]) }, + "purples": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([252, 251, 253, 239, 237, 245, 218, 218, 235, 188, 189, 220, 158, 154, 200, 128, 125, 186, 106, 81, 163, 84, 39, 143, 63, 0, 125]) }, + "reds": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 240, 254, 224, 210, 252, 187, 161, 252, 146, 114, 251, 106, 74, 239, 59, 44, 203, 24, 29, 165, 15, 21, 103, 0, 13]) }, + "viridis": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x48, 0x25, 0x75, 0x41, 0x44, 0x87, 0x35, 0x60, 0x8d, 0x2a, 0x78, 0x8e, 0x21, 0x91, 0x8d, 0x22, 0xa8, 0x84, 0x43, 0xbf, 0x71, 0x7a, 0xd1, 0x51, 0xbc, 0xdf, 0x27]) }, + "inferno": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x17, 0x0c, 0x3b, 0x42, 0x0a, 0x68, 0x6b, 0x17, 0x6e, 0x93, 0x26, 0x67, 0xbb, 0x37, 0x55, 0xdd, 0x51, 0x3a, 0xf3, 0x77, 0x1a, 0xfc, 0xa5, 0x0a, 0xf6, 0xd6, 0x45]) }, + "magma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x15, 0x0e, 0x37, 0x3b, 0x0f, 0x70, 0x65, 0x1a, 0x80, 0x8c, 0x29, 0x81, 0xb6, 0x37, 0x7a, 0xde, 0x49, 0x68, 0xf7, 0x6f, 0x5c, 0xfe, 0x9f, 0x6d, 0xfe, 0xce, 0x91]) }, + "plasma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([0x42, 0x03, 0x9d, 0x6a, 0x00, 0xa8, 0x90, 0x0d, 0xa4, 0xb1, 0x2a, 0x90, 0xcb, 0x47, 0x79, 0xe1, 0x64, 0x62, 0xf2, 0x83, 0x4c, 0xfc, 0xa6, 0x36, 0xfc, 0xce, 0x25]) }, + "bluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 229, 245, 249, 204, 236, 230, 153, 216, 201, 102, 194, 164, 65, 174, 118, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "bluepurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 224, 236, 244, 191, 211, 230, 158, 188, 218, 140, 150, 198, 140, 107, 177, 136, 65, 157, 129, 15, 124, 77, 0, 75]) }, + "greenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 240, 224, 243, 219, 204, 235, 197, 168, 221, 181, 123, 204, 196, 78, 179, 211, 43, 140, 190, 8, 104, 172, 8, 64, 129]) }, + "orangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 236, 254, 232, 200, 253, 212, 158, 253, 187, 132, 252, 141, 89, 239, 101, 72, 215, 48, 31, 179, 0, 0, 127, 0, 0]) }, + "purpleblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 231, 242, 208, 209, 230, 166, 189, 219, 116, 169, 207, 54, 144, 192, 5, 112, 176, 4, 90, 141, 2, 56, 88]) }, + "purplebluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 226, 240, 208, 209, 230, 166, 189, 219, 103, 169, 207, 54, 144, 192, 2, 129, 138, 1, 108, 89, 1, 70, 54]) }, + "purplered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 244, 249, 231, 225, 239, 212, 185, 218, 201, 148, 199, 223, 101, 176, 231, 41, 138, 206, 18, 86, 152, 0, 67, 103, 0, 31]) }, + "redpurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 243, 253, 224, 221, 252, 197, 192, 250, 159, 181, 247, 104, 161, 221, 52, 151, 174, 1, 126, 122, 1, 119, 73, 0, 106]) }, + "yellowgreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 247, 252, 185, 217, 240, 163, 173, 221, 142, 120, 198, 121, 65, 171, 93, 35, 132, 67, 0, 104, 55, 0, 69, 41]) }, + "yellowgreenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 217, 237, 248, 177, 199, 233, 180, 127, 205, 187, 65, 182, 196, 29, 145, 192, 34, 94, 168, 37, 52, 148, 8, 29, 88]) }, + "yelloworangebrown": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 255, 247, 188, 254, 227, 145, 254, 196, 79, 254, 153, 41, 236, 112, 20, 204, 76, 2, 153, 52, 4, 102, 37, 6]) }, + "yelloworangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 204, 255, 237, 160, 254, 217, 118, 254, 178, 76, 253, 141, 60, 252, 78, 42, 227, 26, 28, 189, 0, 38, 128, 0, 38]) }, + "brownbluegreen": { type: PaletteType.diverging, colors: new Uint8Array([84, 48, 5, 140, 81, 10, 191, 129, 45, 223, 194, 125, 246, 232, 195, 245, 245, 245, 199, 234, 229, 128, 205, 193, 53, 151, 143, 1, 102, 94, 0, 60, 48]) }, + "pinkyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([142, 1, 82, 197, 27, 125, 222, 119, 174, 241, 182, 218, 253, 224, 239, 247, 247, 247, 230, 245, 208, 184, 225, 134, 127, 188, 65, 77, 146, 33, 39, 100, 25]) }, + "purplegreen": { type: PaletteType.diverging, colors: new Uint8Array([64, 0, 75, 118, 42, 131, 153, 112, 171, 194, 165, 207, 231, 212, 232, 247, 247, 247, 217, 240, 211, 166, 219, 160, 90, 174, 97, 27, 120, 55, 0, 68, 27]) }, + "purpleorange": { type: PaletteType.diverging, colors: new Uint8Array([127, 59, 8, 179, 88, 6, 224, 130, 20, 253, 184, 99, 254, 224, 182, 247, 247, 247, 216, 218, 235, 178, 171, 210, 128, 115, 172, 84, 39, 136, 45, 0, 75]) }, + "redblue": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 247, 247, 247, 209, 229, 240, 146, 197, 222, 67, 147, 195, 33, 102, 172, 5, 48, 97]) }, + "redgrey": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 255, 255, 255, 224, 224, 224, 186, 186, 186, 135, 135, 135, 77, 77, 77, 26, 26, 26]) }, + "redyellowblue": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 144, 255, 255, 191, 224, 243, 248, 171, 217, 233, 116, 173, 209, 69, 117, 180, 49, 54, 149]) }, + "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, + "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, + "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, + "category10": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 255, 127, 14, 44, 160, 44, 214, 39, 40, 148, 103, 189, 140, 86, 75, 227, 119, 194, 127, 127, 127, 188, 189, 34, 23, 190, 207]) }, + "category20": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 174, 199, 232, 255, 127, 14, 255, 187, 120, 44, 160, 44, 152, 223, 138, 214, 39, 40, 255, 152, 150, 148, 103, 189, 197, 176, 213, 140, 86, 75, 196, 156, 148, 227, 119, 194, 247, 182, 210, 127, 127, 127, 199, 199, 199, 188, 189, 34, 219, 219, 141, 23, 190, 207, 158, 218, 229]) }, + "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, + "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, + "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, + "pastel2": { type: PaletteType.qualitative, colors: new Uint8Array([179, 226, 205, 253, 205, 172, 203, 213, 232, 244, 202, 228, 230, 245, 201, 255, 242, 174, 241, 226, 204, 204, 204, 204]) }, + "set1": { type: PaletteType.qualitative, colors: new Uint8Array([228, 26, 28, 55, 126, 184, 77, 175, 74, 152, 78, 163, 255, 127, 0, 255, 255, 51, 166, 86, 40, 247, 129, 191, 153, 153, 153]) }, + "set2": { type: PaletteType.qualitative, colors: new Uint8Array([102, 194, 165, 252, 141, 98, 141, 160, 203, 231, 138, 195, 166, 216, 84, 255, 217, 47, 229, 196, 148, 179, 179, 179]) }, + "set3": { type: PaletteType.qualitative, colors: new Uint8Array([141, 211, 199, 255, 255, 179, 190, 186, 218, 251, 128, 114, 128, 177, 211, 253, 180, 98, 179, 222, 105, 252, 205, 229, 217, 217, 217, 188, 128, 189, 204, 235, 197, 255, 237, 111]) }, + }; + } + } + class PaletteBase { + get colors() { return this._colors; } + set colors(value) { + if (this._colors != value) { + this._colors = value; + this._changed = true; + } + } + constructor() { + this._colors = null; + } + copyFrom(palette) { + if (palette.colors) { + this.colors = new Uint8Array(palette.colors); + } + else { + this.colors = null; + } + } + update() { } + } + let Palette$2 = class Palette extends PaletteBase { + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class PositionVertex { + static getPosition(buffer, index, value) { + const offset = index * PositionVertex.SIZE; + set$3(value, buffer[offset], buffer[offset + 1], buffer[offset + 2]); + } + static setPosition(buffer, index, value) { + const offset = index * PositionVertex.SIZE; + buffer[offset] = value[0]; + buffer[offset + 1] = value[1]; + buffer[offset + 2] = value[2]; + } + } + PositionVertex.SIZE = 3; + PositionVertex.SIZE_BYTES = 12; + class PositionColorVertex { + static getPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getColor(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + set$3(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); + } + static setColor(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + bufferView.setUint8(offset + 2, value[2] * 0xFF); + } + } + PositionColorVertex.SIZE_BYTES = 16; + PositionColorVertex.POSITION_OFFSET_BYTES = 0; + PositionColorVertex.COLOR_OFFSET_BYTES = 12; + class PositionTextureVertex { + static getPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getTexCoord(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); + } + static setTexCoord(bufferView, index, value) { + const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFFFF, true); + bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); + } + } + PositionTextureVertex.SIZE_BYTES = 16; + PositionTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; + class PositionTexturePickVertex { + static getPosition(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getTexCoord(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); + } + static setTexCoord(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFFFF, true); + bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); + } + static getIdColor(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + set$2(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); + } + static setIdColor(bufferView, index, value) { + const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + bufferView.setUint8(offset + 2, value[2] * 0xFF); + bufferView.setUint8(offset + 3, value[3] * 0xFF); + } + } + PositionTexturePickVertex.SIZE_BYTES = 20; + PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; + PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; + PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; + class PositionNormalTextureVertex { + static getPosition(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setPosition(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getNormal(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + set$3(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); + } + static setNormal(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset, value[0] * 0x7F); + bufferView.setInt8(offset + 1, value[1] * 0x7F); + bufferView.setInt8(offset + 2, value[2] * 0x7F); + } + static getTexCoord(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); + } + static setTexCoord(bufferView, index, value) { + const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFFFF, true); + bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); + } + } + PositionNormalTextureVertex.SIZE_BYTES = 20; + PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; + PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; + class PickGridVertex { + static getTranslation(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setTranslation(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static getNormal(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + set$3(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); + } + static setNormal(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset, value[0] * 0x7F); + bufferView.setInt8(offset + 1, value[1] * 0x7F); + bufferView.setInt8(offset + 2, value[2] * 0x7F); + } + static getIdColor(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + set$2(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); + } + static setIdColor(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + bufferView.setUint8(offset + 2, value[2] * 0xFF); + bufferView.setUint8(offset + 3, value[3] * 0xFF); + } + static getTexCoord(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); + } + static setTexCoord(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFFFF, true); + bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); + } + static getBounds(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; + set$2(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF, bufferView.getUint16(offset + 4, true) / 0xFFFF, bufferView.getUint16(offset + 6, true) / 0xFFFF); + } + static setBounds(bufferView, index, value) { + const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFFFF, true); + bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); + bufferView.setUint16(offset + 4, value[2] * 0xFFFF, true); + bufferView.setUint16(offset + 6, value[3] * 0xFFFF, true); + } + } + PickGridVertex.SIZE_BYTES = 32; + PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; + PickGridVertex.NORMAL_OFFSET_BYTES = 12; + PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; + PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; + PickGridVertex.BOUNDS_OFFSET_BYTES = 24; + class UnitVertex { + static getIdHover(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, true); + } + static setIdHover(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, value, true); + } + static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); + } + static getTranslation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setTranslation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF); + } + static setColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + } + static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + } + static getOrder(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; + set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true)); + } + static setOrder(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + } + static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + } + static getScale(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; + set$3(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + static setScale(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + } + static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getRotation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; + set$1(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); + } + static setRotation(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + bufferView.setFloat32(offset + 12, value[3], true); + } + static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getTexCoord(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; + set$1(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); + } + static setTexCoord(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; + bufferView.setFloat32(offset, value[0], true); + bufferView.setFloat32(offset + 4, value[1], true); + bufferView.setFloat32(offset + 8, value[2], true); + bufferView.setFloat32(offset + 12, value[3], true); + } + static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getIdColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + set$2(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); + } + static setIdColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + bufferView.setUint8(offset + 2, value[2] * 0xFF); + bufferView.setUint8(offset + 3, value[3] * 0xFF); + } + static getSelected(bufferView, index) { + return bufferView.getInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES) / 0x7F; + } + static setSelected(bufferView, index, value) { + bufferView.setInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES, value * 0x7F); + } + static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); + } + static getRounding(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, true); + } + static setRounding(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, value, true); + } + static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); + } + static getParameter1(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, true); + } + static setParameter1(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, value, true); + } + static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); + } + static getParameter2(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, true); + } + static setParameter2(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, value, true); + } + static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); + } + static getMaterial(bufferView, index) { + return bufferView.getUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES); + } + static setMaterial(bufferView, index, value) { + bufferView.setUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES, value); + } + static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); + } + static getTexture(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES); + } + static setTexture(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES, value); + } + static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); + } + static getSdfBuffer(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES); + } + static setSdfBuffer(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES, value); + } + static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); + } + static getSdfBorder(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES); + } + static setSdfBorder(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES, value); + } + static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); + } + static getMatId(bufferView, index) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index, value) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.MAT_TYPE_OFFSET_BYTES, value); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint16(offset) / 0xFF; + value[1] = bufferView.getUint16(offset + 2) / 0xFF; + value[2] = bufferView.getUint16(offset + 4) / 0xFF; + } + static setMatColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset, value[0] * 0xFF); + bufferView.setUint16(offset + 2, value[1] * 0xFF); + bufferView.setUint16(offset + 4, value[2] * 0xFF); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset) / 0xFF; + } + static setMatFuzz(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset, value * 0xFF); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset) / 0xFF; + } + static setMatGloss(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset, value * 0xFF); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_DENSITY_OFFSET_BYTES, value, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index, value) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + value[0] = bufferView.getUint8(offset) / 0xFF; + value[1] = bufferView.getUint8(offset + 1) / 0xFF; + value[2] = bufferView.getUint8(offset + 2) / 0xFF; + value[3] = bufferView.getUint8(offset + 3) / 0xFF; + } + static setSegColor(bufferView, index, value) { + const offset = UnitVertex.SIZE_BYTES * index + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset, value[0] * 0xFF); + bufferView.setUint8(offset + 1, value[1] * 0xFF); + bufferView.setUint8(offset + 2, value[2] * 0xFF); + bufferView.setUint8(offset + 3, value[3] * 0xFF); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); + } + } + UnitVertex.SIZE_BYTES = 120; + UnitVertex.ID_HOVER_OFFSET_BYTES = 0; + UnitVertex.ID_COLOR_OFFSET_BYTES = 4; + UnitVertex.ORDER_OFFSET_BYTES = 8; + UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; + UnitVertex.SELECTED_OFFSET_BYTES = 80; + UnitVertex.TRANSLATION_OFFSET_BYTES = 16; + UnitVertex.COLOR_OFFSET_BYTES = 28; + UnitVertex.MATERIAL_OFFSET_BYTES = 30; + UnitVertex.SCALE_OFFSET_BYTES = 32; + UnitVertex.ROUNDING_OFFSET_BYTES = 44; + UnitVertex.ROTATION_OFFSET_BYTES = 48; + UnitVertex.TEXCOORD_OFFSET_BYTES = 64; + UnitVertex.TEXTURE_OFFSET_BYTES = 81; + UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; + UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; + UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; + UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; + UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; + UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; + UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; + UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; + UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; + UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; + UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class ObjMesh { + } + class ObjHelper { + constructor(core) { + this._core = core; + } + read(data) { + const start = window.performance.now(); + const indices = []; + const positions = []; + const normals = []; + const texCoords = []; + const meshes = []; + const indexOffsets = []; + const indexCounts = []; + const faceLookup = {}; + const lines = data.split("\n"); + let faceCount = 0; + for (let i = 0; i < lines.length; i++) { + const parts = lines[i].trim().split(" "); + if (parts.length > 0) { + switch (parts[0]) { + case "o": + meshes.push(parts[1]); + indexOffsets.push(indices.length); + break; + case "v": + positions.push(parseFloat(parts[1])); + positions.push(parseFloat(parts[2])); + positions.push(parseFloat(parts[3])); + break; + case "vt": + texCoords.push(parseFloat(parts[1])); + texCoords.push(parseFloat(parts[2])); + break; + case "vn": + normals.push(parseFloat(parts[1])); + normals.push(parseFloat(parts[2])); + normals.push(parseFloat(parts[3])); + break; + case "f": + for (let i = 0; i < parts.length - 1; i++) { + const part = parts[i + 1]; + if (faceLookup[part] == undefined) { + faceLookup[part] = faceCount++; + } + indices.push(faceLookup[part]); + } + break; + } + } + } + for (let i = 0; i < meshes.length - 1; i++) { + indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); + } + indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); + const dataView = new DataView(vertices); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let minZ = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY = -Number.MAX_VALUE; + let maxZ = -Number.MAX_VALUE; + const faces = Object.keys(faceLookup); + const _vec2 = create(); + const _vec3 = create$3(); + let hasTexCoords, hasNormals; + if (faces.length > 0) { + const faceParts = faces[0].split("/"); + hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); + hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); + } + for (let i = 0; i < faces.length; i++) { + const faceParts = faces[i].split("/"); + let index = (parseInt(faceParts[0]) - 1) * 3; + const x = positions[index]; + const y = positions[index + 1]; + const z = positions[index + 2]; + set$3(_vec3, x, y, z); + PositionNormalTextureVertex.setPosition(dataView, i, _vec3); + minX = Math.min(x, minX); + minY = Math.min(y, minY); + minZ = Math.min(z, minZ); + maxX = Math.max(x, maxX); + maxY = Math.max(y, maxY); + maxZ = Math.max(z, maxZ); + if (hasNormals) { + index = (parseInt(faceParts[2]) - 1) * 3; + set$3(_vec3, normals[index], normals[index + 1], normals[index + 2]); + PositionNormalTextureVertex.setNormal(dataView, i, _vec3); + } + if (hasTexCoords) { + index = (parseInt(faceParts[1]) - 1) * 2; + set(_vec2, texCoords[index], texCoords[index + 1]); + PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); + } + } + const originX = (minX + maxX) / 2; + const originY = (minY + maxY) / 2; + const originZ = (minZ + maxZ) / 2; + const objMesh = new ObjMesh(); + objMesh.vertices = vertices; + objMesh.indices = new Uint16Array(indices); + objMesh.meshes = meshes; + objMesh.indexOffsets = indexOffsets; + objMesh.indexCounts = indexCounts; + objMesh.indexCount = indices.length; + objMesh.minX = minX; + objMesh.minY = minY; + objMesh.minZ = minZ; + objMesh.maxX = maxX; + objMesh.maxY = maxY; + objMesh.maxZ = maxZ; + objMesh.originX = originX; + objMesh.originY = originY; + objMesh.originZ = originZ; + this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); + return objMesh; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Cube { + } + Cube.POSITIONS = new Float32Array([ + -0.5, 0.5, 0.5, + 0.5, 0.5, 0.5, + 0.5, -0.5, 0.5, + -0.5, -0.5, 0.5, + -0.5, 0.5, -0.5, + 0.5, 0.5, -0.5, + 0.5, -0.5, -0.5, + -0.5, -0.5, -0.5 + ]); + Cube.INDICES = new Uint16Array([5, 4, 1, 0, 3, 4, 7, 5, 6, 1, 2, 3, 6, 7]); + Cube.CUBE_MAP_INDICES = new Uint16Array([2, 3, 1, 0, 4, 3, 7, 2, 6, 1, 5, 4, 6, 7]); + Cube.FACE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Cube.FACE_POSITIONS = [ + fromValues$3(0.0, 0.5, 0.0), + fromValues$3(0.5, 0.0, 0.0), + fromValues$3(0.0, -0.5, 0.0), + fromValues$3(-0.5, 0.0, 0.0), + fromValues$3(0.0, 0.0, 0.5), + fromValues$3(0.0, 0.0, -0.5) + ]; + Cube.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), + fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), + fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), + fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Cube.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0.5), + fromValues$3(0.5, 0.5, 0), + fromValues$3(0, 0.5, -0.5), + fromValues$3(-0.5, 0.5, 0), + fromValues$3(0, -0.5, 0.5), + fromValues$3(0.5, -0.5, 0), + fromValues$3(0, -0.5, -0.5), + fromValues$3(-0.5, -0.5, 0), + fromValues$3(0.5, 0, 0.5), + fromValues$3(0.5, 0, -0.5), + fromValues$3(-0.5, 0, -0.5), + fromValues$3(-0.5, 0, 0.5) + ]; + Cube.EDGE_NORMALS = [ + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO) + ]; + Cube.EDGE_CORNERS = [ + [0, 1], + [1, 5], + [4, 5], + [0, 4], + [2, 3], + [2, 6], + [6, 7], + [3, 7], + [1, 2], + [5, 6], + [4, 7], + [0, 3] + ]; + Cube.EDGE_FACES = [ + [0, 4], + [0, 1], + [0, 5], + [0, 3], + [2, 4], + [2, 1], + [2, 5], + [2, 3], + [1, 4], + [1, 5], + [3, 5], + [3, 4] + ]; + Cube.EDGE_AXIS = [ + 0, + 2, + 0, + 2, + 0, + 2, + 0, + 2, + 1, + 1, + 1, + 1 + ]; + Cube.AXIS_EDGES = [ + [0, 2, 4, 6], + [8, 9, 10, 11], + [1, 3, 5, 7] + ]; + Cube.AXIS_FACES = [ + [1, 3], + [0, 2], + [4, 5] + ]; + Cube.OPPOSITE_FACES = [ + 2, + 3, + 0, + 1, + 5, + 4 + ]; + Cube.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0) + ]; + Cube.EDGE_FORWARDS = [ + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO) + ]; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let ControllerVisual$1 = class ControllerVisual { + render(elapsedTime, xrFrame) { } + update(elapsedTime) { } + constructor(controller) { + this.controller = controller; + } + }; + class Controller { + get isInitialized() { return this._isInitialized; } + get mMatrix() { return this._mMatrix; } + get indexCount() { return this._indexCount; } + get vertices() { return this._vertices; } + get indices() { return this._indices; } + get texture() { return this._texture; } + get rayMMatrix() { return this._rayMMatrix; } + get rayIndexCount() { return this._rayIndexCount; } + get rayVertices() { return this._rayVertices; } + get rayIndices() { return this._rayIndices; } + constructor(core, options) { + this._cubeObj = `o Cube v 1.000000 -1.000000 -1.000000 v 1.000000 -1.000000 1.000000 v -1.000000 -1.000000 1.000000 @@ -4081,16414 +3899,16405 @@ f 1/12/3 5/6/3 2/8/3 f 2/12/4 6/8/4 3/4/4 f 4/13/5 3/9/5 8/11/5 f 5/6/6 1/12/6 8/11/6`; - this._core = core; - this._obj = options.obj; - this._texture = options.texture || new ImageData(new Uint8ClampedArray([0, 0, 0, 255]), 1, 1); - } - initialize() { - const _vec3 = create$3(); - this._mMatrix = create$4(); - const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); - if (!this._obj) { - this.useRayPose = true; - const modelThickness = 0.02; - const modelLength = 0.1; - set$3(_vec3, modelThickness, modelThickness, modelLength); - fromScaling(this._mMatrix, _vec3); - set$3(_vec3, 0, 0, 1); - translate(this._mMatrix, this._mMatrix, _vec3); - } - this._vertices = objMesh.vertices; - this._indices = objMesh.indices; - this._indexCount = objMesh.indexCount; - this._rayMMatrix = create$4(); - const rayVertices = Cube.POSITIONS; - this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); - const rayVerticesView = new DataView(this._rayVertices); - const rayIndices = Cube.INDICES; - this._rayIndices = new Uint16Array(rayIndices); - const rayVertexCount = rayVertices.length / PositionVertex.SIZE; - this._rayIndexCount = rayIndices.length; - for (let i = 0; i < rayVertexCount; i++) { - set$3(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); - PositionColorVertex.setPosition(rayVerticesView, i, _vec3); - PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); - } - const rayThickness = 0.0025; - const rayLength = 10; - set$3(_vec3, rayThickness, rayThickness, rayLength); - fromScaling(this._rayMMatrix, _vec3); - set$3(_vec3, 0, 0, -0.5); - translate(this._rayMMatrix, this._rayMMatrix, _vec3); - this._isInitialized = true; - this._core.log.write(LogLevel.info, "controller initialized"); - } - update(elapsedTime) { } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class MatrixHelper { - static fieldOfViewFromProjectionMatrix(p) { - return 2 * Math.atan(1 / p[5]); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class AxesVisual { - render(elapsedTime, xrFrame) { } - update(elapsedTime) { } - constructor(axes) { - this.axes = axes; - } - } - class AxesBase { - get isInitialized() { return this._isInitialized; } - set vMatrix(value) { this._vMatrix = value; } - pickGrid(id) { - const offset = id * 3; - return { - divisionX: this._pickGrid[offset] - 1, - divisionY: this._pickGrid[offset + 1] - 1, - divisionZ: this._pickGrid[offset + 2] - 1, - }; - } - pickTitle(id) { - return { axis: this._pickTitle[id], }; - } - pickLabel(id) { - const offset = id * 2; - return { - axis: this._pickLabel[offset], - label: this._pickLabel[offset + 1], - }; - } - pickHeading(id) { - return { axis: this._pickHeading[id], }; - } - getFromValues(index) { return this._fromValues[index]; } - setFromValues(index, value) { - if (this._fromValues[index] != value) { - this._fromValues[index] = value; - this._hasChanged = true; - } - } - getToValues(index) { return this._toValues[index]; } - setToValues(index, value) { - if (this._toValues[index] != value) { - this._toValues[index] = value; - this._hasChanged = true; - } - } - get font() { return this._font; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } - } - get gridPickDivisionHeight() { return this._gridPickDivisionHeight; } - set gridPickDivisionHeight(value) { - if (this._gridPickDivisionHeight != value) { - this._gridPickDivisionHeight = value; - this._hasChanged = true; - } - } - constructor(core) { - this._core = core; - this._mMatrix = create$4(); - this._mvMatrix = create$4(); - this._textMetric = { maxTop: 0, width: 0, maxHeight: 0 }; - this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; - this.textBorderWidth = core.config.textBorderWidth; - this.gamma = 0; - this.gridMajorThickness = core.config.axesGridMajorThickness; - this.gridMinorThickness = core.config.axesGridMinorThickness; - this.gridZeroThickness = core.config.axesGridZeroThickness; - this._font = core.font; - this.isGridPickingEnabled = false; - } - update(elapsedTime) { } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Quad$2 = class Quad { - static positions(transform) { - const positions = new Float32Array(12); - const position = create$3(); - for (let i = 0; i < 4; i++) { - set$3(position, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); - transformMat4$2(position, position, transform); - positions[i * 3] = position[0]; - positions[i * 3 + 1] = position[1]; - positions[i * 3 + 2] = position[2]; - } - return positions; - } - static textured(transform, texTransform = Constants.MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = create$3(); - const texCoord = create(); - for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { - set$3(position, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); - set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - transformMat4(texCoord, texCoord, texTransform); - PositionTextureVertex.setPosition(verticesView, i, position); - PositionTextureVertex.setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - static normalTextured(transform, texTransform = Constants.MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = create$3(); - const texCoord = create(); - const normal3 = create$3(); - const normal4 = create$2(); - for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { - set$3(position, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); - set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - transformMat4(texCoord, texCoord, texTransform); - PositionNormalTextureVertex.setPosition(verticesView, i, position); - set$2(normal4, 0.0, 0.0, 1.0, 0.0); - transformMat4$1(normal4, normal4, transform); - set$3(normal3, normal4[0], normal4[1], normal4[2]); - normalize$2(normal3, normal3); - PositionNormalTextureVertex.setNormal(verticesView, i, normal3); - PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - }; - Quad$2.FACE_NORMALS = [ - fromValues$3(0, 0, 1), - fromValues$3(0, 0, -1) - ]; - Quad$2.FACE_ROTATIONS = [ - fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), - fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) - ]; - Quad$2.EDGE_POSITIONS = [ - fromValues$3(0, 0.5, 0), - fromValues$3(0.5, 0, 0), - fromValues$3(0, -0.5, 0), - fromValues$3(-0.5, 0, 0) - ]; - Quad$2.EDGE_NORMALS = [ - fromValues$3(0, 1, 0), - fromValues$3(1, 0, 0), - fromValues$3(0, -1, 0), - fromValues$3(-1, 0, 0) - ]; - Quad$2.EDGE_POSITIVES = [ - fromValues$3(1, 0, 0), - fromValues$3(0, 1, 0), - fromValues$3(1, 0, 0), - fromValues$3(0, 1, 0) - ]; - Quad$2.EDGE_FORWARDS = [ - fromValues$3(0, 0, -1), - fromValues$3(0, 0, 1), - fromValues$3(0, 0, 1), - fromValues$3(0, 0, -1) - ]; - Quad$2.AXIS_EDGES = [ - [0, 2], - [1, 3] - ]; - Quad$2.POSITIONS = new Float32Array([ - -0.5, 0.5, 0, - 0.5, 0.5, 0, - -0.5, -0.5, 0, - 0.5, -0.5, 0 - ]); - Quad$2.INDICES = new Uint16Array([0, 2, 1, 1, 2, 3]); - Quad$2.TEX_COORDS = new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class TextHelper { - static truncate(text, length) { - return text.length > length ? `${text.substr(0, length - 1)}…` : text; - } - static measure(font, text, size) { - size.width = 0; - let maxDescent = 0; - for (const char of text) { - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - size.width += glyph.advance; - size.maxTop = Math.max(glyph.top, size.maxTop); - maxDescent = Math.max(glyph.height - glyph.top, maxDescent); - } - size.maxHeight = size.maxTop + maxDescent; - } - static wrap(font, text, maxWidth) { - const lines = []; - let width = 0; - let start = 0; - let lastBreakingChar = -1; - let widthAfterLastBreakingChar = 0; - for (let i = 0; i < text.length; i++) { - let char = text.charAt(i); - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - width += glyph.advance; - if (char == " " || char == "-") { - widthAfterLastBreakingChar = width; - lastBreakingChar = i; - } - if (width > maxWidth) { - if (lastBreakingChar == -1) { - lines.push(text.substring(start, i)); - start = i; - width += glyph.advance; - } - else { - lines.push(text.substring(start, lastBreakingChar)); - start = lastBreakingChar + 1; - width -= widthAfterLastBreakingChar; - widthAfterLastBreakingChar = 0; - lastBreakingChar = -1; - } - } - } - lines.push(text.substring(start, text.length)); - return lines; - } - static addString(font, text, vertices, indices, index, position, scale, offset, rotation, idColor) { - for (const char of text) { - this.addGlyph(font, char, vertices, indices, index++, position, scale, offset, rotation, idColor); - } - } - static addGlyph(font, char, vertices, indices, index, position, scale, offset, rotation, idColor) { - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const vertexOffset = index * 4; - const width = glyph.width * scale; - const height = glyph.height * scale; - const top = glyph.top * scale; - const border = font.border * scale; - const x0 = offset[0] - border; - const x1 = offset[0] + width + border; - const y0 = offset[1] + top + border; - const y1 = offset[1] + top - height - border; - const z0 = offset[2]; - set$3(this._topLeft, x0, y0, z0); - set$3(this._topRight, x1, y0, z0); - set$3(this._bottomLeft, x0, y1, z0); - set$3(this._bottomRight, x1, y1, z0); - if (rotation) { - transformQuat(this._topLeft, this._topLeft, rotation); - transformQuat(this._topRight, this._topRight, rotation); - transformQuat(this._bottomLeft, this._bottomLeft, rotation); - transformQuat(this._bottomRight, this._bottomRight, rotation); - } - add(this._vec3, this._topLeft, position); - PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); - add(this._vec3, this._topRight, position); - PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); - add(this._vec3, this._bottomLeft, position); - PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); - add(this._vec3, this._bottomRight, position); - PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); - set(this._vec2, glyph.u0, glyph.v0); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); - set(this._vec2, glyph.u1, glyph.v0); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); - set(this._vec2, glyph.u0, glyph.v1); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); - set(this._vec2, glyph.u1, glyph.v1); - PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); - PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); - offset[0] += glyph.advance * scale; - const indexTemplate = Quad$2.INDICES; - const indexOffset = index * 6; - for (let i = 0; i < 6; i++) { - indices[indexOffset + i] = indexTemplate[i] + vertexOffset; - } - } - } - TextHelper._vec2 = create(); - TextHelper._vec3 = create$3(); - TextHelper._topLeft = create$3(); - TextHelper._topRight = create$3(); - TextHelper._bottomLeft = create$3(); - TextHelper._bottomRight = create$3(); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class PickHelper { - static nextPickId() { return this._pickId++; } - static encodeNumber(number, type, color) { - const encoded = number | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16); - } - static encodeVec3(vec3, type, color) { - const encoded = vec3[0] | (vec3[1] << 8) | (vec3[2] << 16) | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeVec3(color, axes) { - axes[0] = color[0]; - axes[1] = color[1]; - axes[2] = color[2]; - } - static encodeType(type) { - return type << 24; - } - static decodeType(color) { - return color[3]; - } - static float32ToVec4(number, color) { - color[0] = ((number & 0xFF) >>> 0) / 0xFF; - color[1] = ((number & 0xFF00) >>> 8) / 0xFF; - color[2] = ((number & 0xFF0000) >>> 16) / 0xFF; - color[3] = ((number & 0xFF000000) >>> 24) / 0xFF; - } - static uint8ArrayToNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16) + (color[3] << 24); - } - } - PickHelper._pickId = 1; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Cartesian3dAxes extends AxesBase { - get size() { return this._size; } - get isDiscreteX() { return this._isDiscrete[0]; } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } - } - get isDiscreteY() { return this._isDiscrete[1]; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } - } - get isDiscreteZ() { return this._isDiscrete[2]; } - set isDiscreteZ(value) { - if (value != this._isDiscrete[2]) { - this._isDiscrete[2] = value; - this._hasChanged = true; - } - } - get minBoundsX() { return this._minBoundsX; } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } - } - get maxBoundsX() { return this._maxBoundsX; } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } - } - get minBoundsY() { return this._minBoundsY; } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } - } - get maxBoundsY() { return this._maxBoundsY; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } - } - get minBoundsZ() { return this._minBoundsZ; } - set minBoundsZ(value) { - if (value != this._minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } - } - get maxBoundsZ() { return this._maxBoundsZ; } - set maxBoundsZ(value) { - if (value != this._minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - getIsOutsideEdge(index) { return this._isOutsideEdge[index]; } - getIsForwardFace(index) { return this._isForwardFace[index]; } - get textVertices() { return this._textVertices; } - get textIndices() { return this._textIndices; } - getLabelMMatrix(index) { return this._labelMMatrices[index]; } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } - } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } - } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } - } - getLabelOrientation(index) { return this._orientations[index]; } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } - } - getTitleIndexCount(index) { return this._titleIndexCounts[index]; } - getTitleIndexOffset(index) { return this._titleIndexOffsets[index]; } - getTitleMMatrix(index) { return this._titleMMatrices[index]; } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } - } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } - } - getHeadingIndexCount(index) { return this._headingIndexCounts[index]; } - getHeadingIndexOffset(index) { return this._headingIndexOffsets[index]; } - getHeadingMMatrix(index) { return this._headingMMatrices[index]; } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } - } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } - } - getIsLeftToRightHorizontal(index) { return this._isLeftToRightHorizontal[index]; } - getIsLeftToRightVertical(index) { return this._isLeftToRightVertical[index]; } - getAxesLeftToRightIndexCount(index) { return this._axesLeftToRightIndexCounts[index]; } - getAxesRightToLeftIndexCount(index) { return this._axesRightToLeftIndexCounts[index]; } - getAxesLeftToRightIndexOffset(index) { return this._axesLeftToRightIndexOffsets[index]; } - getAxesRightToLeftIndexOffset(index) { return this._axesRightToLeftIndexOffsets[index]; } - get gridVertices() { return this._gridVertices; } - get gridIndices() { return this._gridIndices; } - getGridTicksIndexCount(index) { return this._gridTicksIndexCounts[index]; } - getGridTicksIndexOffset(index) { return this._gridTicksIndexOffsets[index]; } - getGridFaceIndexCount(index) { return this._gridFaceIndexCounts[index]; } - getGridFaceIndexOffset(index) { return this._gridFaceIndexOffsets[index]; } - getGridTicksMMatrix(index) { return this._gridTicksMMatrices[index]; } - getGridFaceMMatrix(index) { return this._gridFaceMMatrices[index]; } - getGridTicksScale(index) { return this._gridTicksScales[index]; } - getGridFaceZero(index) { return this._gridFaceZeros[index]; } - getGridTicksZero(index) { return this._gridTicksZeros[index]; } - getGridFaceMinorGridlines(index) { return this._gridFaceMinorGridlines[index]; } - getGridTicksMinorGridlines(index) { return this._gridTicksMinorGridlines[index]; } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } - } - get scalingX() { return this._scalingX; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } - } - get scalingY() { return this._scalingY; } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } - } - get scalingZ() { return this._scalingZ; } - set scalingZ(value) { - if (value != this._scalingZ) { - this._scalingZ = value; - this._hasChanged = true; - } - } - get offsetX() { return this._offset[12]; } - set offsetX(value) { - if (value != this._offset[12]) { - this._offset[12] = value; - } - } - get offsetY() { return this._offset[13]; } - set offsetY(value) { - if (value != this._offset[13]) { - this._offset[13] = value; - } - } - get offsetZ() { return this._offset[14]; } - set offsetZ(value) { - if (value != this._offset[14]) { - this._offset[14] = value; - } - } - constructor(core) { - super(core); - this._size = create$3(); - this._translation = create$3(); - this._normal = create$3(); - this._forward = create$3(); - this._right = create$3(); - this._up = create$3(); - this._texCoord = create(); - this._bounds = create$2(); - this._vec3 = create$3(); - this._vec4 = create$2(); - this._mat3 = create$5(); - this._isDiscrete = [false, false, false]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._minBoundsZ = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._maxBoundsZ = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for (let i = 0; i < 6; i++) { - this._isForwardFace.push(false); - } - for (let i = 0; i < 12; i++) { - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = create$3(); - this._textPosition = create$3(); - this._distances = []; - for (let i = 0; i < 12; i++) { - this._distances.push(0); - } - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for (let i = 0; i < 3; i++) { - this._maxLabelSize.push(create()); - this._orientations.push(AxesTextOrientation.parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for (let i = 0; i < 12; i++) { - this._labelMMatrices.push(create$4()); - } - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for (let i = 0; i < 3; i++) { - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for (let i = 0; i < 12; i++) { - this._titleMMatrices.push(create$4()); - } - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for (let i = 0; i < 3; i++) { - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for (let i = 0; i < 12; i++) { - this._headingMMatrices.push(create$4()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = create$3(); - this._edgePositive = create$3(); - this._edgeNormal = create$3(); - this._edgeNormalTemp = create$3(); - this._edgePositiveTemp = create$3(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for (let i = 0; i < 12; i++) { - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push(create$3()); - this._edgeHorizontalUp.push(create$3()); - this._edgeHorizontalForward.push(create$3()); - this._edgeVerticalRight.push(create$3()); - this._edgeVerticalUp.push(create$3()); - this._edgeVerticalForward.push(create$3()); - } - this.isFaceVisible = []; - for (let i = 0; i < 6; i++) { - this.isFaceVisible.push(true); - } - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = Quad$2.INDICES; - this.zero = create$3(); - this._gridTicksZeros = []; - this._gridFaceZeros = []; - this.minorGridlines = fromValues$3(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = []; - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = create$3(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for (let i = 0; i < 3; i++) { - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push(create()); - this._gridFaceZeros.push(create()); - this._gridTicksMinorGridlines.push(create()); - this._gridFaceMinorGridlines.push(create()); - this._gridTicksScales.push(create$3()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - } - for (let i = 0; i < 6; i++) { - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push(create$4()); - } - for (let i = 0; i < 12; i++) { - this._gridTicksMMatrices.push(create$4()); - this._gridTicksRotations.push(create$4()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = Cube.EDGE_POSITIVES[i][0]; - _mat4[1] = Cube.EDGE_POSITIVES[i][1]; - _mat4[2] = Cube.EDGE_POSITIVES[i][2]; - _mat4[4] = Cube.EDGE_NORMALS[i][0]; - _mat4[5] = Cube.EDGE_NORMALS[i][1]; - _mat4[6] = Cube.EDGE_NORMALS[i][2]; - cross(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [null, null, null]; - this._toValues = [null, null, null]; - this.isDivisionPickingEnabled = [false, false, false]; - this.isLabelPickingEnabled = [false, false, false]; - this.isTitlePickingEnabled = [false, false, false]; - this.isHeadingPickingEnabled = [false, false, false]; - this.isAxisReversed = [false, false, false]; - this._scalingX = 1; - this._scalingY = 1; - this._scalingZ = 1; - this._offset = create$4(); - } - initialize() { - this._isInitialized = true; - } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._size[2] *= this._scalingZ / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); - } - multiply$2(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = create$4(); - multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); - fromMat4(this._mat3, this._mvMatrix); - for (let faceId = 0; faceId < 6; faceId++) { - multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); - transformMat4$2(this._forward, this._vec3, this._mvMatrix); - transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for (let edgeId = 0; edgeId < 12; edgeId++) { - const faceIds = Cube.EDGE_FACES[edgeId]; - const forward1 = this._isForwardFace[faceIds[0]]; - const forward2 = this._isForwardFace[faceIds[1]]; - const outsideEdge = forward1 != forward2; - this._isOutsideEdge[edgeId] = outsideEdge; - if (outsideEdge) { - this._isForwardEdge[edgeId] = dot(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; - } - this._distances[edgeId] = 0; - } - for (let axisId = 0; axisId < 3; axisId++) { - if (this.arePickDivisionsVisible[axisId]) { - set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); - translate(gridTicksMMatrix, this._mMatrix, this._vec3); - multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) { - scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); - } - scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - } - for (let axisId = 0; axisId < 3; axisId++) { - if (this.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); - set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - if (this._size[axisId] > 0) { - translate(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); - } - } - } - } - } - for (let axisId = 0; axisId < 3; axisId++) { - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId]) { - multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); - transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); - normalize$2(this._forward, this._edgePosition); - negate(this._forward, this._forward); - cross(this._right, Constants.VECTOR3_UNITY, this._forward); - normalize$2(this._right, this._right); - cross(this._up, this._forward, this._right); - transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); - transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); - copy$3(this._edgeNormalTemp, this._edgeNormal); - copy$3(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if (dot(this._edgeNormalTemp, this._up) > 0) { - copy$3(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); - } - else { - negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); - negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if (dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - copy$3(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); - } - else { - this._isLeftToRightHorizontal[edgeId] = false; - negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); - negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if (dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - negate(edgeHorizontalRight, edgeHorizontalRight); - } - cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if (dot(this._edgeNormal, this._right) < 0) { - copy$3(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); - } - else { - negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); - negate(this._edgeNormal, this._edgeNormal); - } - if (dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - copy$3(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); - } - else { - this._isLeftToRightVertical[edgeId] = false; - negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); - negate(this._edgePositive, this._edgePositive); - } - cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if (dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - negate(edgeVerticalRight, edgeVerticalRight); - } - cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) { - this._updateLabels(axisId, edgeId); - } - if (this._titles[axisId]) { - this._updateTitle(axisId, edgeId); - } - } - if (this.isHeadingVisible[edgeId]) { - this._updateHeading(axisId, edgeId); - } - } - } - } - } - } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == AxesTextOrientation.parallel) - maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == AxesTextOrientation.parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == AxesTextOrientation.perpendicular) { - multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); - } - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; - } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; - } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; - } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + - 2 * (xDivisions * zDivisions) + - 2 * (yDivisions * zDivisions) + - xDivisions + - yDivisions + - zDivisions; - const byteLength = PickGridVertex.SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for (let axisId = 0; axisId < 3; axisId++) { - const width = size[axisId]; - set$3(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); - } - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for (let axisId = 0; axisId < 3; axisId++) { - const labels = this._labels[axisId]; - if (labels) { - for (let i = 0; i < labels.length; i++) { - count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - } - } - const title = this._titles[axisId]; - if (title) { - count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - } - const heading = this._headings[axisId]; - if (heading) { - count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - } - const byteLength = PositionTexturePickVertex.SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for (let axisId = 0; axisId < 3; axisId++) { - if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } - else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for (let axisId = 0; axisId < 3; axisId++) { - if (this._titles[axisId]) { - set$3(this._textPosition, 0, 0, 0); - set$3(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } - else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for (let axisId = 0; axisId < 3; axisId++) { - if (this._headings[axisId]) { - set$3(this._textPosition, 0, 0, 0); - set$3(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } - else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } - } - } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label = 0; label < labels.length; label++) { - const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$3(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width / 2; - } - else { - this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case AxesTextOrientation.perpendicular: - set$3(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } - else { - this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - } - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label = 0; label < labels.length; label++) { - const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$3(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width / 2; - } - else { - this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case AxesTextOrientation.perpendicular: - set$3(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } - else { - this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - } - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = create$3(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for (let position = 0; position < positions.length - 1; position++) { - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for (let j = 0; j < this._indexTemplate.length; j++) { - indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - } - set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - set$3(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = create$3(); - negate(this._normal, Cube.FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for (let position2 = 0; position2 < positions2.length - 1; position2++) { - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for (let position3 = 0; position3 < positions3.length - 1; position3++) { - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for (let i = 0; i < this._indexTemplate.length; i++) { - indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - } - set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Cartesian2dAxes extends AxesBase { - get size() { return this._size; } - get isDiscreteX() { return this._isDiscrete[0]; } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } - } - get isDiscreteY() { return this._isDiscrete[1]; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } - } - get minBoundsX() { return this._minBoundsX; } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } - } - get maxBoundsX() { return this._maxBoundsX; } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } - } - get minBoundsY() { return this._minBoundsY; } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } - } - get maxBoundsY() { return this._maxBoundsY; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } - } - getIsOutsideEdge(index) { return this._isOutsideEdge[index]; } - getIsForwardFace(index) { return this._isForwardFace[index]; } - get textVertices() { return this._textVertices; } - get textIndices() { return this._textIndices; } - getLabelMMatrix(index) { return this._labelMMatrices[index]; } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } - } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } - } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } - } - getLabelOrientation(index) { return this._orientations[index]; } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } - } - getTitleIndexCount(index) { return this._titleIndexCounts[index]; } - getTitleIndexOffset(index) { return this._titleIndexOffsets[index]; } - getTitleMMatrix(index) { return this._titleMMatrices[index]; } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } - } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } - } - getHeadingIndexCount(index) { return this._headingIndexCounts[index]; } - getHeadingIndexOffset(index) { return this._headingIndexOffsets[index]; } - getHeadingMMatrix(index) { return this._headingMMatrices[index]; } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } - } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } - } - getIsLeftToRightHorizontal(index) { return this._isLeftToRightHorizontal[index]; } - getIsLeftToRightVertical(index) { return this._isLeftToRightVertical[index]; } - getAxesLeftToRightIndexCount(index) { return this._axesLeftToRightIndexCounts[index]; } - getAxesRightToLeftIndexCount(index) { return this._axesRightToLeftIndexCounts[index]; } - getAxesLeftToRightIndexOffset(index) { return this._axesLeftToRightIndexOffsets[index]; } - getAxesRightToLeftIndexOffset(index) { return this._axesRightToLeftIndexOffsets[index]; } - get gridVertices() { return this._gridVertices; } - get gridIndices() { return this._gridIndices; } - getGridTicksIndexCount(index) { return this._gridTicksIndexCounts[index]; } - getGridTicksIndexOffset(index) { return this._gridTicksIndexOffsets[index]; } - getGridFaceIndexCount(index) { return this._gridFaceIndexCounts[index]; } - getGridFaceIndexOffset(index) { return this._gridFaceIndexOffsets[index]; } - getGridTicksMMatrix(index) { return this._gridTicksMMatrices[index]; } - getGridFaceMMatrix(index) { return this._gridFaceMMatrices[index]; } - getGridTicksScale(index) { return this._gridTicksScales[index]; } - getGridTicksZero(index) { return this._gridTicksZeros[index]; } - get gridFaceZero() { return this._gridFaceZeros; } - get gridFaceMinorGridlines() { return this._gridFaceMinorGridlines; } - getGridTicksMinorGridlines(index) { return this._gridTicksMinorGridlines[index]; } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } - } - get scalingX() { return this._scalingX; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } - } - get scalingY() { return this._scalingY; } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } - } - get offsetX() { return this._offset[12]; } - set offsetX(value) { - if (value != this._offset[12]) { - this._offset[12] = value; - } - } - get offsetY() { return this._offset[13]; } - set offsetY(value) { - if (value != this._offset[13]) { - this._offset[13] = value; - } - } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._rMatrix = create$4(); - fromQuat(this._rMatrix, value); - } - } - constructor(core) { - super(core); - this._size = create$3(); - this._translation = create$3(); - this._normal = create$3(); - this._forward = create$3(); - this._right = create$3(); - this._up = create$3(); - this._texCoord = create(); - this._bounds = create$2(); - this._vec3 = create$3(); - this._vec4 = create$2(); - this._mat3 = create$5(); - this._isDiscrete = [false, false]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for (let i = 0; i < 2; i++) { - this._isForwardFace.push(false); - } - for (let i = 0; i < 4; i++) { - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = create$3(); - this._textPosition = create$3(); - this._distances = []; - for (let i = 0; i < 4; i++) { - this._distances.push(0); - } - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for (let i = 0; i < 2; i++) { - this._maxLabelSize.push(create()); - this._orientations.push(AxesTextOrientation.parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for (let i = 0; i < 4; i++) { - this._labelMMatrices.push(create$4()); - } - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for (let i = 0; i < 2; i++) { - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for (let i = 0; i < 4; i++) { - this._titleMMatrices.push(create$4()); - } - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for (let i = 0; i < 2; i++) { - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for (let i = 0; i < 4; i++) { - this._headingMMatrices.push(create$4()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = create$3(); - this._edgePositive = create$3(); - this._edgeNormal = create$3(); - this._edgeNormalTemp = create$3(); - this._edgePositiveTemp = create$3(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for (let i = 0; i < 4; i++) { - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push(create$3()); - this._edgeHorizontalUp.push(create$3()); - this._edgeHorizontalForward.push(create$3()); - this._edgeVerticalRight.push(create$3()); - this._edgeVerticalUp.push(create$3()); - this._edgeVerticalForward.push(create$3()); - } - this.isFaceVisible = []; - for (let i = 0; i < 2; i++) { - this.isFaceVisible.push(true); - } - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = Quad$2.INDICES; - this.zero = create$3(); - this._gridTicksZeros = []; - this._gridFaceZeros = create(); - this.minorGridlines = fromValues$3(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = create(); - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = create$3(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for (let i = 0; i < 2; i++) { - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push(create()); - this._gridTicksMinorGridlines.push(create()); - this._gridTicksScales.push(create$3()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push(create$4()); - } - for (let i = 0; i < 4; i++) { - this._gridTicksMMatrices.push(create$4()); - this._gridTicksRotations.push(create$4()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = Quad$2.EDGE_POSITIVES[i][0]; - _mat4[1] = Quad$2.EDGE_POSITIVES[i][1]; - _mat4[2] = Quad$2.EDGE_POSITIVES[i][2]; - _mat4[4] = Quad$2.EDGE_NORMALS[i][0]; - _mat4[5] = Quad$2.EDGE_NORMALS[i][1]; - _mat4[6] = Quad$2.EDGE_NORMALS[i][2]; - cross(this._vec3, Quad$2.EDGE_POSITIVES[i], Quad$2.EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [null, null]; - this._toValues = [null, null]; - this.isDivisionPickingEnabled = [false, false]; - this.isLabelPickingEnabled = [false, false]; - this.isTitlePickingEnabled = [false, false]; - this.isHeadingPickingEnabled = [false, false]; - this.isAxisReversed = [false, false]; - this._scalingX = 1; - this._scalingY = 1; - this._offset = create$4(); - } - initialize() { - this._isInitialized = true; - } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); - const maxBounds = Math.max(this._size[0], this._size[1]); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); - } - if (this._rMatrix) { - mul(this._mMatrix, this.mMatrix, this._rMatrix); - mul(this._mMatrix, this._mMatrix, this._offset); - } - else { - multiply$2(this._mMatrix, this.mMatrix, this._offset); - } - this._mvMatrix = create$4(); - multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); - fromMat4(this._mat3, this._mvMatrix); - for (let faceId = 0; faceId < 2; faceId++) { - transformMat4$2(this._forward, Constants.VECTOR3_ZERO, this._mvMatrix); - transformMat3(this._normal, Quad$2.FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for (let edgeId = 0; edgeId < 4; edgeId++) { - this._isForwardEdge[edgeId] = dot(Quad$2.EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for (let axisId = 0; axisId < 2; axisId++) { - if (this.arePickDivisionsVisible[axisId]) { - set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; - if (this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); - translate(gridTicksMMatrix, this._mMatrix, this._vec3); - multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) { - scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); - } - scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - } - set(this._gridFaceZeros, this.zero[0], this.zero[1]); - set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); - for (let faceId = 0; faceId < 2; faceId++) { - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - } - } - for (let axisId = 0; axisId < 2; axisId++) { - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; - multiply$1(this._edgePosition, Quad$2.EDGE_POSITIONS[edgeId], this._size); - transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); - normalize$2(this._forward, this._edgePosition); - negate(this._forward, this._forward); - cross(this._right, Constants.VECTOR3_UNITY, this._forward); - normalize$2(this._right, this._right); - cross(this._up, this._forward, this._right); - transformMat3(this._edgeNormal, Quad$2.EDGE_NORMALS[edgeId], this._mat3); - transformMat3(this._edgePositive, Quad$2.EDGE_POSITIVES[edgeId], this._mat3); - copy$3(this._edgeNormalTemp, this._edgeNormal); - copy$3(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if (dot(this._edgeNormalTemp, this._up) > 0) { - copy$3(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); - } - else { - negate(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); - negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if (dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - copy$3(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); - } - else { - this._isLeftToRightHorizontal[edgeId] = false; - negate(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); - negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if (dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - negate(edgeHorizontalRight, edgeHorizontalRight); - } - cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if (dot(this._edgeNormal, this._right) < 0) { - copy$3(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); - } - else { - negate(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); - negate(this._edgeNormal, this._edgeNormal); - } - if (dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - copy$3(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); - } - else { - this._isLeftToRightVertical[edgeId] = false; - negate(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); - negate(this._edgePositive, this._edgePositive); - } - cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if (dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - negate(edgeVerticalRight, edgeVerticalRight); - } - cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) { - this._updateLabels(axisId, edgeId); - } - if (this._titles[axisId]) { - this._updateTitle(axisId, edgeId); - } - } - if (this.isHeadingVisible[edgeId]) { - this._updateHeading(axisId, edgeId); - } - } - } - } - } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == AxesTextOrientation.parallel) - maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == AxesTextOrientation.parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == AxesTextOrientation.perpendicular) { - multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); - } - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; - } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; - } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); - scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; - } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + - xDivisions + - yDivisions; - const byteLength = PickGridVertex.SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for (let axisId = 0; axisId < 2; axisId++) { - const width = size[axisId]; - set$3(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - const axisId = 2; - this._gridFaceScale[axisId] = 1; - for (let faceId = 0; faceId < 2; faceId++) { - offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); - } - } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for (let axisId = 0; axisId < 2; axisId++) { - const labels = this._labels[axisId]; - if (labels) { - for (let i = 0; i < labels.length; i++) { - count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - } - } - const title = this._titles[axisId]; - if (title) { - count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - } - const heading = this._headings[axisId]; - if (heading) { - count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - } - const byteLength = PositionTexturePickVertex.SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for (let axisId = 0; axisId < 2; axisId++) { - if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } - else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for (let axisId = 0; axisId < 2; axisId++) { - if (this._titles[axisId]) { - set$3(this._textPosition, 0, 0, 0); - set$3(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } - else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for (let axisId = 0; axisId < 2; axisId++) { - if (this._headings[axisId]) { - set$3(this._textPosition, 0, 0, 0); - set$3(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } - else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } - } - } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label = 0; label < labels.length; label++) { - const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$3(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width / 2; - } - else { - this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case AxesTextOrientation.perpendicular: - set$3(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } - else { - this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - } - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for (let label = 0; label < labels.length; label++) { - const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch (orientation) { - case AxesTextOrientation.parallel: - set$3(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) { - this._textOffset[0] = -width / 2; - } - else { - this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - } - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case AxesTextOrientation.perpendicular: - set$3(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) { - this._textOffset[1] = -maxGlyphTop / 2; - } - else { - this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - } - break; - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = create$3(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for (let position = 0; position < positions.length - 1; position++) { - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for (let j = 0; j < this._indexTemplate.length; j++) { - indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - } - set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - set$3(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = create$3(); - negate(this._normal, Quad$2.FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for (let position2 = 0; position2 < positions2.length - 1; position2++) { - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for (let position3 = 0; position3 < positions3.length - 1; position3++) { - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for (let i = 0; i < this._indexTemplate.length; i++) { - indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - } - set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); - PickGridVertex.setNormal(dataView, vertexOffset, this._normal); - PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); - PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); - PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Glyph { - toJSON() { - return { - key: this.key, - char: this.char, - width: this.width, - height: this.height, - top: this.top, - left: this.left, - advance: this.advance, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1, - }; - } - } - let FontVisual$2 = class FontVisual { - update() { } - constructor(font) { - this.font = font; - } - }; - class Font { - get atlas() { return this._rasterizer.fontAtlas; } - get count() { return this._chars.size; } - constructor(core, rasterizer) { - this._core = core; - this._rasterizer = rasterizer; - this._chars = new Set(); - this._previousSize = 0; - this.glyphs = {}; - } - addGlyph(char) { - if (!this._chars.has(char)) { - this._chars.add(char); - this._rasterizer.draw(char); - this._hasChanged = true; - } - } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); - this._previousSize = this._chars.size; - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - } - } - toJSON() { - const glyphs = []; - for (let key in this.glyphs) { - const glyph = this.glyphs[key]; - glyphs.push(glyph.toJSON()); - } - return { - name: this.name, - size: this.size, - border: this.border, - glyphs: glyphs, - edgeValue: this.edgeValue, - }; - } - } - class FontAtlas { - constructor(width, height) { - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } - } - class FontRasterizer { - get font() { return this._font; } - get fontAtlas() { return this._fontAtlas; } - constructor(core, options) { - let start = performance.now(); - this._core = core; - this._fontAtlas = options.fontAtlas; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._font = new Font(core, this); - this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); - this._font.size = this._fontSize; - this._font.border = this._border; - this._font.edgeValue = this._edgeValue; - const glyphRasterizerOptions = { - baseline: this._baseline, - border: this._border, - edgeValue: this._edgeValue, - fontFamily: this._fontFamily, - fontSize: this._fontSize, - fontStyle: this._fontStyle, - fontWeight: this._fontWeight, - maxDistance: this._maxDistance, - }; - this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); - this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const glyph = this._glyphRasterizer.draw(char); - const texWidth = glyph.width + 2 * this._border; - const texHeight = glyph.height + 2 * this._border; - const width = this._fontAtlas.imageData.width; - const height = this._fontAtlas.imageData.height; - if (this._fontAtlas.x + texWidth > width) { - this._fontAtlas.x = 0; - } - let y = 0; - for (let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++) { - y = Math.max(y, this._fontAtlas.top[x]); - } - if (y + texHeight > height) { - this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); - } - for (let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++) { - this._fontAtlas.top[x] = y + texHeight; - } - glyph.u0 = this._fontAtlas.x / width; - glyph.v0 = y / height; - glyph.u1 = (this._fontAtlas.x + texWidth) / width; - glyph.v1 = (y + texHeight) / height; - this._font.glyphs[char] = glyph; - for (let i = 0; i < glyph.distances.length; i++) { - const distance = glyph.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._fontAtlas.x + dataX + (y + dataY) * width) * 4; - this._fontAtlas.imageData.data[offset + 0] = distance; - this._fontAtlas.imageData.data[offset + 1] = distance; - this._fontAtlas.imageData.data[offset + 2] = distance; - this._fontAtlas.imageData.data[offset + 3] = 0xff; - } - this._fontAtlas.x += texWidth; - } - } - class GlyphRasterizer { - constructor(core, options) { - let start = performance.now(); - this._core = core; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._size = this._fontSize + this._border * 2; - this._size += this._border * 2; - this._gridOuter = new Float64Array(this._size * this._size); - this._gridInner = new Float64Array(this._size * this._size); - this._f = new Float64Array(this._size); - this._z = new Float64Array(this._size + 1); - this._v = new Uint16Array(this._size); - const canvas = document.createElement("canvas"); - canvas.width = canvas.height = this._size; - this._context = canvas.getContext("2d", { willReadFrequently: true }); - this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; - this._context.textBaseline = this._baseline; - this._context.textAlign = "left"; - this._context.fillStyle = "black"; - this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const textMetrics = this._context.measureText(char); - const glyphLeft = 0; - const glyphTop = Math.floor(textMetrics.actualBoundingBoxAscent); - let glyphWidth = Math.ceil(textMetrics.actualBoundingBoxRight); - let glyphHeight = Math.ceil(textMetrics.actualBoundingBoxAscent) + Math.ceil(textMetrics.actualBoundingBoxDescent); - glyphWidth = Math.min(this._size - this._border, glyphWidth); - glyphHeight = Math.min(this._size - this._border, glyphHeight); - const width = glyphWidth + 2 * this._border; - const height = glyphHeight + 2 * this._border; - const length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const glyph = new Glyph(); - glyph.char = char; - glyph.key = char.codePointAt(0); - glyph.distances = distances; - glyph.gradientsX = gradientsX; - glyph.gradientsY = gradientsY; - glyph.pixels = pixels; - glyph.width = glyphWidth; - glyph.height = glyphHeight; - glyph.top = glyphTop; - glyph.left = glyphLeft; - glyph.advance = textMetrics.width; - if (glyphWidth == 0 || glyphHeight == 0) { - return glyph; - } - this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); - this._context.fillText(char, this._border, this._border + glyphTop); - const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); - for (let i = 0; i < length; i++) { - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for (let y = 0; y < glyphHeight; y++) { - for (let x = 0; x < glyphWidth; x++) { - const a = imgData.data[4 * (y * glyphWidth + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - } - else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - pixels[j] = 0xff; - } - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for (let i = 0; i < length; i++) { - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for (let i = 0; i < length; i++) { - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return glyph; - } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for (let x = x0; x < x0 + width; x++) - this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for (let y = y0; y < y0 + height; y++) - this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for (let q = 1, k = 0, s = 0; q < n; q++) { - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - } while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for (let q = 0, k = 0; q < n; q++) { - while (z[k + 1] < q) { - k++; - } - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class ManipulationProcessor { - get manipulators() { return this._manipulators; } - get count() { return this._count; } - get isDragging() { return this._isDragging; } - constructor(core) { - this._core = core; - this._count = 0; - this._centroid = create$3(); - this._previousCentroid = create$3(); - this._relativePositionToCentroid = create$3(); - this._directionToCentroid = create$3(); - this._previousDirectionToCentroid = create$3(); - this._manipulators = {}; - this._removedManipulators = []; - this.cumulativeTranslation = create$3(); - this.translationDelta = create$3(); - this.centroid = create$3(); - this.maxScale = Number.MAX_VALUE; - this.twistAxis = fromValues$3(0, 0, 1); - this.initialize(); - } - update(elapsedTime, manipulators) { - for (const key in this._manipulators) { - const manipulator = this._manipulators[key]; - if (!manipulators[manipulator.id]) { - if (this.removeManipulator) { - this.removeManipulator(manipulator); - } - this._removedManipulators.push(manipulator.id); - } - } - if (this._removedManipulators.length > 0) { - for (let i = 0; i < this._removedManipulators.length; i++) { - delete this._manipulators[this._removedManipulators[i]]; - this._count--; - } - this._removedManipulators = []; - } - for (const key in manipulators) { - const manipulator = manipulators[key]; - if (!this._manipulators[manipulator.id]) { - if (!this.addManipulator || this.addManipulator(manipulator)) { - copy$3(manipulator.initialPosition, manipulator.position); - this._manipulators[manipulator.id] = manipulator; - this._count++; - } - } - } - set$3(this.translationDelta, 0, 0, 0); - this.scaleDelta = 0; - this.twistDelta = 0; - if (this._count > 0) { - if (this._previousCount > 0) { - if (this.prepareManipulation) { - this.prepareManipulation(); - } - this._process(); - if (this.processManipulation) { - this.processManipulation(elapsedTime); - } - } - else { - this.initialize(); - if (this.beginManipulation) { - this.beginManipulation(); - } - } - } - else { - if (this._previousCount > 0) { - if (this.endManipulation) { - this.endManipulation(); - } - } - } - this._isDragging = (this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared) || this._count > 1; - this._previousCount = this._count; - } - initialize() { - set$3(this.centroid, 0, 0, 0); - set$3(this.cumulativeTranslation, 0, 0, 0); - this.cumulativeScale = 1; - this.cumulativeTwist = 0; - } - _process() { - if (this._previousCount > 0) { - let persisted = 0; - for (const key in this._manipulators) { - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) { - persisted++; - } - } - const removed = this._previousCount - persisted; - if (persisted > 0) { - if (removed > 0) { - copy$3(this._centroid, this._previousCentroid); - } - else { - set$3(this._centroid, 0, 0, 0); - for (const key in this._manipulators) { - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) { - add(this._centroid, this._centroid, manipulator.position); - } - } - scale(this._centroid, this._centroid, 1 / persisted); - } - for (const key in this._manipulators) { - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) { - manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); - add(this.translationDelta, this.translationDelta, manipulator.position); - subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); - subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); - const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); - if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) { - this.scaleDelta += 1; - } - else { - const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); - const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); - const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); - this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; - scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); - scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); - this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); - } - } - } - scale(this.translationDelta, this.translationDelta, 1 / persisted); - add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); - this.scaleDelta /= persisted; - this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); - this.scaleDelta -= 1; - this.twistDelta /= persisted; - this.cumulativeTwist += this.twistDelta; - } - } - set$3(this.centroid, 0, 0, 0); - for (const key in this._manipulators) { - const manipulator = this._manipulators[key]; - add(this.centroid, this.centroid, manipulator.position); - } - scale(this.centroid, this.centroid, 1 / this._count); - for (const key in this._manipulators) { - const manipulator = this._manipulators[key]; - subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); - } - copy$3(this._previousCentroid, this.centroid); - for (const key in this._manipulators) { - const manipulator = this._manipulators[key]; - manipulator.isPersisted = true; - copy$3(manipulator.previousPosition, manipulator.position); - copy$3(manipulator.previousRotationAxis, manipulator.rotationAxis); - copy$3(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class MouseWheel { - constructor(core) { - this._core = core; - this._previousTotal = 0; - this.total = 0; - } - initialize(element) { - element.addEventListener("wheel", e => { - e.preventDefault(); - const wheelEvent = e; - this.total += wheelEvent.deltaY; - }, { passive: false }); - } - update(elapsedTime) { - const total = this.total; - this.delta = total - this._previousTotal; - this._previousTotal = total; - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Manipulator { - constructor() { - this.pickedIndex = 0; - this.maxTranslationSquared = 0; - this.initialPosition = create$3(); - this.position = create$3(); - this.previousPosition = create$3(); - this.holdOrigin = create$3(); - this.positionRelativeToCentroid = create$3(); - this.previousPositionRelativeToCentroid = create$3(); - this.rotationAxis = create$3(); - this.previousRotationAxis = create$3(); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Pointers { - get hoverX() { return this._hoverX; } - ; - get hoverY() { return this._hoverY; } - ; - get hoverId() { return this._hoverId; } - ; - constructor(core, manipulators) { - this._core = core; - this._manipulators = manipulators; - } - initialize(element) { - this._element = element; - element.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); - element.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); - element.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); - element.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); - element.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); - element.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); - } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); - this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); - } - } - _handlePointerDown(e) { - this._element.focus(); - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const manipulator = new Manipulator(); - const id = e.pointerId; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - manipulator.id = id; - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.type = e.pointerType; - manipulator.button = e.button; - manipulator.shiftKey = e.shiftKey; - manipulator.ctrlKey = e.ctrlKey; - manipulator.altKey = e.altKey; - manipulator.event = e; - this._manipulators[id] = manipulator; - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - } - _handlePointerMove(e) { - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - const id = e.pointerId; - const manipulator = this._manipulators[id]; - if (manipulator) { - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.event = e; - } - switch (e.pointerType) { - case "mouse": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - break; - case "pen": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - this._tiltX = e.tiltX; - this._tiltY = e.tiltY; - this._twist = e.twist; - break; - } - } - _handlePointerUp(e) { - const manipulator = this._manipulators[e.pointerId]; - if (manipulator) { - manipulator.event = e; - } - this._remove(e.pointerId); - } - _handlePointerCancel(e) { - this._remove(e.pointerId); - } - _handlePointerLeave(e) { - this._resetHover(); - this._remove(e.pointerId); - } - _handlePointerOut(e) { - this._resetHover(); - this._remove(e.pointerId); - } - _resetHover() { - this._hoverId = null; - this._hoverX = null; - this._hoverY = null; - } - _remove(pointerId) { - const manipulator = this._manipulators[pointerId]; - if (manipulator) { - delete this._manipulators[pointerId]; - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class AnimationHelper { - static smoothStep(value) { - return value * value * (3 - 2 * value); - } - static damp(value, target, threshold, dampening) { - if (Math.abs(target) < threshold) { - return MathHelper.lerp(value, 0, dampening); - } - else { - return MathHelper.lerp(value, target, dampening); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Keyboard { - constructor(core) { - this._core = core; - this._pressedKeys = new Set(); - this._previousPressedKeys = new Set(); - } - initialize(element) { - element.addEventListener("keydown", (e) => { this._handleKeyDown(e); }, false); - element.addEventListener("keyup", (e) => { this._handleKeyUp(e); }, false); - } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); - } - } - isKeyDown(key) { - return this._pressedKeys.has(key); - } - wasKeyReleased(key) { - if (this._pressedKeys.has(key)) { - if (!this._previousPressedKeys.has(key)) { - this._previousPressedKeys.add(key); - return true; - } - } - else { - this._previousPressedKeys.delete(key); - } - return false; - } - _handleKeyDown(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (!this._pressedKeys.has(key)) { - this._pressedKeys.add(key); - } - } - _handleKeyUp(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (this._pressedKeys.has(key)) { - this._pressedKeys.delete(key); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Manager { - constructor(core) { - this._manipulators = {}; - this._core = core; - this._vec3 = create$3(); - this._manipulationProcessor = new ManipulationProcessor(core); - this._manipulators = {}; - this._pointers = new Pointers(core, this._manipulators); - this._pointers.initialize(core.container); - this._mouseWheel = new MouseWheel(core); - this._mouseWheel.initialize(core.container); - this._keyboard = new Keyboard(core); - this._keyboard.initialize(core.container); - this.isPickingEnabled = true; - this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; - this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; - this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; - this.pickHoldDelay = this._core.config.pickHoldDelay; - this.pickSelectDelay = this._core.config.pickSelectDelay; - const rightButton = 2; - this.singleTouchAction = (manipulator) => { - if ((manipulator.type == "mouse" && manipulator.button == rightButton) || manipulator.shiftKey || manipulator.ctrlKey) { - return SingleTouchAction.translate; - } - else if (manipulator.altKey || (manipulator.type == "pen" && manipulator.button == rightButton)) { - return SingleTouchAction.lasso; - } - else { - return SingleTouchAction.rotate; - } - }; - this.mouseWheelAction = (keyboard) => { - if (this._keyboard.isKeyDown("Control")) { - return MouseWheelAction.rotateY; - } - else { - return MouseWheelAction.zoom; - } - }; - this.lassoPickType = PickType.data; - this._thumbstickX = 0; - this._previousControllerButtonPressed = [false, false, false, false]; - this._quat0 = create$1(); - this._quat1 = create$1(); - } - update(elapsedTime, xrFrame) { - if (xrFrame) { - const inputSources = this._core.webXRSession.inputSources; - if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { - const inputSource = inputSources[0]; - const controllerVisual = this._core.renderer.controllers[0]; - if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { - const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); - if (gripPose) { - controllerVisual.mMatrix = gripPose.transform.matrix; - } - const gamepad = inputSource.gamepad; - this._core.renderer.isPickingEnabled = false; - const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); - if (rayPose) { - controllerVisual.rayMMatrix = rayPose.transform.matrix; - if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { - this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; - this._core.renderer.isPickingEnabled = true; - } - } - const threshold = 0.2; - const dampening = Math.min(0.015 * elapsedTime, 1); - this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold, dampening); - if (this._thumbstickX != 0) { - setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); - this._core.getModelRotation(this._quat1); - multiply(this._quat1, this._quat0, this._quat1); - this._core.setModelRotation(this._quat1, true); - } - if (gamepad.buttons[2].pressed) { - if (!this._previousControllerButtonPressed[2]) { - this._previousControllerButtonPressed[2] = true; - if (this.controllerButtonPressedCallback) { - this.controllerButtonPressedCallback(2); - } - } - } - else { - this._previousControllerButtonPressed[2] = false; - } - } - } - } - else { - const camera = this._core.camera; - this._manipulationProcessor.update(elapsedTime, this._manipulators); - this._pointers.update(elapsedTime); - this._mouseWheel.update(elapsedTime); - this._keyboard.update(elapsedTime); - if (this._mouseWheel.delta != 0) { - switch (this.mouseWheelAction(this._keyboard)) { - case MouseWheelAction.zoom: - if (this._pointers.hoverX, this._pointers.hoverY) { - camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); - } - break; - case MouseWheelAction.rotateY: - setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); - camera.getOrbit(this._quat1); - multiply(this._quat1, this._quat1, this._quat0); - camera.setOrbit(this._quat1, true); - break; - } - } - const count = this._manipulationProcessor.count; - if (count == 0) { - if (this._isLassoPicking) { - this._isLassoPicking = false; - this._core.renderer.isLassoPicking = false; - const x0 = Math.min(this._lassoX0, this._lassoX1); - const y0 = Math.min(this._lassoY0, this._lassoY1); - const x1 = Math.max(this._lassoX0, this._lassoX1); - const y1 = Math.max(this._lassoY0, this._lassoY1); - if (x1 - x0 > 0 && y1 - y0 > 0) { - const sets = this._core.pickLasso(x0, y0, x1, y1, this.lassoPickType); - const result = { - x0: x0, - y0: y0, - x1: x1, - y1: y1, - pickType: this.lassoPickType, - ids: sets, - manipulator: this._manipulator, - }; - this.pickLassoCallback(result); - } - } - } - else if (count == 1) { - const translationDelta = this._manipulationProcessor.translationDelta; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - const manipulators = this._manipulationProcessor.manipulators; - for (const key in manipulators) { - const manipulator = manipulators[key]; - switch (this.singleTouchAction(manipulator)) { - case SingleTouchAction.rotate: - camera.rotate(translationDelta); - break; - case SingleTouchAction.translate: - camera.translate(translationDelta); - break; - case SingleTouchAction.lasso: - if (this.pickLassoCallback) { - if (!this._isLassoPicking) { - this._isLassoPicking = true; - this._core.renderer.isLassoPicking = true; - this._lassoX0 = manipulator.position[0]; - this._lassoY0 = manipulator.position[1]; - } - this._lassoX1 = manipulator.position[0]; - this._lassoY1 = manipulator.position[1]; - this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); - this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); - } - break; - } - break; - } - } - } - else { - const translationDelta = this._manipulationProcessor.translationDelta; - const camera = this._core.camera; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - camera.translate(translationDelta); - } - if (this._manipulationProcessor.scaleDelta != 0) { - const distance = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; - camera.zoom(distance, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this._manipulationProcessor.twistDelta != 0) { - camera.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - } - if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { - const camera = this._core.camera; - const renderer = this._core.renderer; - if (renderer.isCapturingPickImage) { - camera.updatePickVMatrix(renderer.width / 2, renderer.height / 2); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - this._pickedTime = 0; - } - else if (this._pointers.hoverId > -1) { - const pickingX = this._pointers.hoverX; - const pickingY = this._pointers.hoverY; - camera.updatePickVMatrix(pickingX, pickingY); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - if (this._pickedId != renderer.pickedId) { - this._pickedId = renderer.pickedId; - this._pickedTime = 0; - } - else { - if (this._manipulationProcessor.count == 1) { - this._pickedTime += elapsedTime; - for (const key in this._manipulators) { - this._manipulator = this._manipulators[key]; - break; - } - } - } - if (this._pickedTime > 0) { - switch (renderer.pickedType) { - case PickType.data: - if (this._pickedTime > this.pickHoldDelay) { - renderer.getVertexPosition(this._vec3, this._pickedId); - this._core.setModelManipulationOrigin(this._vec3); - this._pickedTime = 0; - } - else if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.transitionBuffers.length; i++) { - const transitionBuffer = renderer.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - transitionBuffer: i, - id: id, - manipulator: this._manipulator, - }; - this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); - if (this.pickItemCallback) { - this.pickItemCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.label: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.labelSets.length; i++) { - const labelSet = renderer.labelSets[i].label; - const id = labelSet.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - label: id, - set: i, - manipulator: this._manipulator, - }; - this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); - if (this.pickLabelSetCallback) { - this.pickLabelSetCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesDivision: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id = axes.pickGridLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickGrid(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); - if (this.pickAxesGridCallback) { - this.pickAxesGridCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesTitle: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id = axes.pickTitleLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickTitle(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); - if (this.pickAxesTitleCallback) { - this.pickAxesTitleCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesLabel: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id = axes.pickLabelLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickLabel(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); - if (this.pickAxesLabelCallback) { - this.pickAxesLabelCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - case PickType.axesHeading: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) { - for (let i = 0; i < renderer.currentAxes.length; i++) { - const axes = renderer.currentAxes[i].axes; - const id = axes.pickHeadingLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickHeading(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); - if (this.pickAxesHeadingCallback) { - this.pickAxesHeadingCallback(result); - } - break; - } - } - } - this._pickedTime = 0; - } - break; - } - } - } - else { - renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } - else { - this._core.renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); - this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Log { - constructor(core) { - this._core = core; - } - write(level, value) { - if (level >= this._core.config.logLevel) { - switch (level) { - case LogLevel.trace: - console.trace(value); - break; - case LogLevel.debug: - console.debug(value); - break; - case LogLevel.info: - console.info(value); - break; - case LogLevel.warn: - console.warn(value); - break; - case LogLevel.error: - console.error(value); - break; - } - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - var __awaiter$3 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - class Core { - get container() { return this._container; } - get started() { return this._started; } - get debugText() { return this._debugText; } - get log() { return this._log; } - get totalFrames() { return this._fps.totalFrames; } - get camera() { return this._camera; } - set camera(value) { this._camera = value; } - getModelRotation(value) { copy$1(value, this._modelRotation); } - setModelRotation(value, isSmooth) { - copy$1(this._modelRotation, value); - if (!isSmooth) { - copy$1(this._smoothedModelRotation, this._modelRotation); - } - } - getModelScale() { return this._modelScale[0]; } - setModelScale(value, isSmooth) { - set$3(this._modelScale, value, value, value); - if (!isSmooth) { - copy$3(this._smoothedModelScale, this._modelScale); - } - } - getModelManipulationOrigin(value) { copy$3(value, this._modelManipulationOrigin); } - setModelManipulationOrigin(value) { this._updateManipulationOrigin(value); } - getModelPosition(value) { copy$3(value, this._modelPosition); } - setModelPosition(value, isSmooth) { - copy$3(this._modelPosition, value); - if (!isSmooth) { - copy$3(this._smoothedModelPosition, this._modelPosition); - } - } - get webXRSession() { return this._webXRSession; } - get renderer() { return this._renderer; } - set renderer(renderer) { - if (this._renderer == renderer) { - return; - } - if (this._renderer) { - this.stop(); - this._renderer.remove(); - } - if (!renderer.isInitialized) { - renderer.initialize(this); - } - if (this._renderer) { - renderer.transitionTime = this._renderer.transitionTime; - for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { - const previousTransitionBuffer = this._renderer.transitionBuffers[i]; - const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); - transitionBuffer.copyFrom(previousTransitionBuffer); - renderer.transitionBuffers.push(transitionBuffer); - } - const currentAxes = this._renderer.currentAxes; - if (currentAxes) { - renderer.currentAxes = []; - for (let i = 0; i < currentAxes.length; i++) { - const axesVisual = currentAxes[i]; - const axes = axesVisual.axes; - if (axes instanceof Cartesian3dAxes) { - const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); - renderer.currentAxes.push(cartesian3dAxesVisual); - } - else if (axes instanceof Cartesian2dAxes) { - renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); - } - } - } - const labelSets = this._renderer.labelSets; - if (labelSets) { - renderer.labelSets = []; - for (let i = 0; i < labelSets.length; i++) { - renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); - } - } - const images = this._renderer.images; - if (images) { - renderer.images = []; - for (let i = 0; i < images.length; i++) { - renderer.images.push(renderer.createImageVisual(images[i].image)); - } - } - const fonts = this._renderer.fonts; - if (fonts) { - for (const key in fonts) { - const font = fonts[key].font; - renderer.fonts[font.name] = renderer.createFontVisual(font); - } - } - } - else { - renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); - } - if (this._renderer) { - this._renderer.finalize(); - } - this._renderer = renderer; - this._fps.reset(); - this.start(); - } - get font() { return this._font; } - get paletteResources() { return this._paletteResources; } - get config() { return this._config; } - get inputManager() { return this._inputManager; } - constructor(options) { - setMatrixArrayType(Array); - this._vec3 = create$3(); - this._quat = create$1(); - this._mat4 = create$4(); - this._container = options && options.container ? options.container : document.body; - this._config = new Config$2(this); - this._log = new Log(this); - this._debugText = new DebugText(); - this._inputManager = (options && options.useInputManager === false) ? null : new Manager(this); - const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { - fontAtlas: new FontAtlas(256, 512), - fontSize: 24, - border: 3, - fontFamily: "\"segoe ui semibold\", sans-serif", - fontWeight: "normal", - fontStyle: "normal", - baseline: "alphabetic", - maxDistance: 8, - edgeValue: 0xc0, - }; - const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); - this._font = fontRasterizer.font; - this._paletteResources = new PaletteResources(); - this._previousTime = 0; - this._fps = new Fps(this); - this._modelMMatrix = create$4(); - this._modelPosition = create$3(); - this._modelRotation = create$1(); - this._modelScale = create$3(); - this._smoothedModelPosition = create$3(); - this._smoothedModelRotation = create$1(); - this._smoothedModelScale = create$3(); - this._modelManipulationOrigin = create$3(); - this._camera = new AltAzimuthCamera(this); - this.resetModel(false); - } - getView(view) { - this.getModelPosition(view.position); - this.getModelRotation(view.rotation); - view.scale = this.getModelScale(); - } - setView(view, isSmooth) { - this.setModelPosition(view.position, isSmooth); - this.setModelRotation(view.rotation, isSmooth); - this.setModelScale(view.scale, isSmooth); - } - lerpView(from, to, time) { - lerp(this._vec3, from.position, to.position, time); - this.setModelPosition(this._vec3, false); - slerp(this._quat, from.rotation, to.rotation, time); - this.setModelRotation(this._quat, false); - this.setModelScale(MathHelper.lerp(from.scale, to.scale, time), false); - } - resetModel(isSmooth) { - set$3(this._modelPosition, 0, 0, -this._config.modelDistance); - set$3(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); - set$1(this._modelRotation, 0, 0, 0, 1); - if (!isSmooth) { - this._syncSmooth(); - } - } - resetManipulationOrigin() { - if (!exactEquals$1(this._modelManipulationOrigin, Constants.VECTOR3_ZERO)) { - this._updateManipulationOrigin(Constants.VECTOR3_ZERO); - } - } - reset(isSmooth) { - this.resetModel(isSmooth); - this.resetManipulationOrigin(); - this._camera.reset(isSmooth); - } - start() { - if (!this._started && this._renderer) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); - this._started = true; - this._log.write(LogLevel.info, "render loop started"); - if (this.startCallback) { - this.startCallback(); - } - } - } - stop() { - if (this._started) { - this._started = false; - if (this._windowAnimationFrame != null) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - this._log.write(LogLevel.info, "render loop stopped"); - } - if (this.stopCallback) { - this.stopCallback(); - } - } - } - checkWebXRSupport() { - const xrSystem = navigator.xr; - if (xrSystem) { - xrSystem.isSessionSupported("immersive-vr").then((supported) => { - if (supported) { - this._log.write(LogLevel.info, "WebXR supported"); - if (this.webXRSupportedCallback) { - this.webXRSupportedCallback(); - } - } - }); - } - } - requestWebXRSession() { - if (this._webXRSession) { - this._webXRSession.end(); - } - else { - navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); - } - } - _webXRSessionStarted(session) { - if (this.webXRSessionStartedCallback) { - this.webXRSessionStartedCallback(); - } - this._webXRSession = session; - session.onend = () => this._webXRSessionEnded(); - this._renderer.initializeWebXR(session).then(() => { - if (this._windowAnimationFrame) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - } - session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); - }); - session.oninputsourceschange = (event) => this._webXRInputSourcesChanged(event); - } - _webXRSessionEnded() { - if (this.webXRSessionEndedCallback) { - this.webXRSessionEndedCallback(); - } - this._webXRSession = null; - this._renderer.controllers.length = 0; - this.start(); - } - _webXRInputSourcesChanged(event) { - if (event.added.length > 0) { - const added = event.added[0]; - if (added.targetRayMode == "tracked-pointer") { - const profiles = added.profiles; - const handedness = added.handedness; - if (this.webXRInputSourceRequestCallback) { - this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { - const options = { - profiles: profiles, - handedness: handedness, - obj: response.obj, - texture: response.texture, - }; - const controller = new Controller(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - }, (e) => { - this._log.write(LogLevel.error, e); - }); - } - else { - const options = {}; - const controller = new Controller(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - } - } - } - if (event.removed.length > 0) { - this.renderer.controllers.length = 0; - } - } - _tick(currentTime, xrFrame) { - return __awaiter$3(this, void 0, void 0, function* () { - let elapsedTime = currentTime - this._previousTime; - this._previousTime = currentTime; - if (elapsedTime > 0) { - this.update(elapsedTime, xrFrame); - yield this.render(elapsedTime, xrFrame); - } - if (xrFrame) { - xrFrame.session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); - } - else if (this._started) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); - } - }); - } - update(elapsedTime, xrFrame) { - this._renderer.setSize(elapsedTime); - if (this.updateCallback) { - this.updateCallback(elapsedTime, xrFrame); - } - if (this._config.isDebugVisible) { - this._debugText.clear(); - } - this._fps.update(elapsedTime); - if (this._inputManager) { - this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; - this._inputManager.update(elapsedTime, xrFrame); - } - let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); - lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); - amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); - slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); - amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); - lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); - fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); - this._renderer.mMatrix = this._modelMMatrix; - if (this._config.isDebugVisible) { - this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); - this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); - this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); - this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); - this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); - this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); - this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); - } - if (!xrFrame) { - this._camera.width = this._renderer.width; - this._camera.height = this._renderer.height; - this._camera.modelMMatrix = this._modelMMatrix; - this._camera.modelPosition = this._smoothedModelPosition; - this._camera.modelRotation = this._smoothedModelRotation; - this._camera.modelScale = this._smoothedModelScale; - this._camera.modelManipulationOrigin = this._modelManipulationOrigin; - this._camera.update(elapsedTime); - this._renderer.vMatrices = this._camera.vMatrices; - this._renderer.mvMatrices = this._camera.mvMatrices; - this._renderer.pMatrices = this._camera.pMatrices; - this._renderer.inverseVMatrices = this._camera.inverseVMatrices; - this._renderer.inversePMatrices = this._camera.inversePMatrices; - } - this._renderer.prepare(xrFrame); - if (!xrFrame && this._config.stereoMode == StereoMode.none) { - this._renderer.pickPMatrix = this._camera.pMatrices[0]; - } - else { - const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); - perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); - this._renderer.pickPMatrix = this._mat4; - } - if (this._renderer.isInitialized) { - this._renderer.update(elapsedTime); - } - } - render(elapsedTime, xrFrame) { - return __awaiter$3(this, void 0, void 0, function* () { - this._fps.render(); - if (this._renderer.isInitialized) { - yield this._renderer.render(elapsedTime, xrFrame); - if (this.afterRenderCallback) { - this.afterRenderCallback(); - } - } - }); - } - _syncSmooth() { - copy$3(this._smoothedModelPosition, this._modelPosition); - copy$3(this._smoothedModelScale, this._modelScale); - copy$1(this._smoothedModelRotation, this._modelRotation); - } - _updateManipulationOrigin(position) { - this._log.write(LogLevel.info, `manipulation origin ${position[0].toFixed(3)},${position[1].toFixed(3)},${position[2].toFixed(3)}`); - this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position); - copy$3(this._modelManipulationOrigin, position); - transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); - subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); - copy$3(this._smoothedModelPosition, this._modelPosition); - if (this.manipulationOriginChangedCallback) { - const result = { - x: position[0], - y: position[1], - z: position[2], - }; - this.manipulationOriginChangedCallback(result); - } - } - pickLasso(x0, y0, x1, y1, pickType) { - const inverseMMatrix = create$4(); - invert(inverseMMatrix, this._modelMMatrix); - const sets = []; - const nearPositions = [create$3(), create$3(), create$3(), create$3()]; - const farPositions = [create$3(), create$3(), create$3(), create$3()]; - const directions = [create$3(), create$3(), create$3(), create$3()]; - this._camera.unproject(nearPositions[0], x0, y1, -1); - this._camera.unproject(farPositions[0], x0, y1, 1); - this._camera.unproject(nearPositions[1], x1, y1, -1); - this._camera.unproject(farPositions[1], x1, y1, 1); - this._camera.unproject(nearPositions[2], x1, y0, -1); - this._camera.unproject(farPositions[2], x1, y0, 1); - this._camera.unproject(nearPositions[3], x0, y0, -1); - this._camera.unproject(farPositions[3], x0, y0, 1); - for (let i = 0; i < 4; i++) { - transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); - transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); - subtract(directions[i], farPositions[i], nearPositions[i]); - normalize$2(directions[i], directions[i]); - } - const normals = [create$3(), create$3(), create$3(), create$3()]; - const d = []; - for (let i = 0; i < 4; i++) { - cross(normals[i], directions[(i + 1) % 4], directions[i]); - normalize$2(normals[i], normals[i]); - d.push(-dot(normals[i], nearPositions[i])); - } - if (pickType == PickType.data) { - const translation = create$3(); - for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { - const transitionBuffer = this._renderer.transitionBuffers[i]; - const set = new Set(); - if (transitionBuffer.isVisible) { - const start = window.performance.now(); - const currentBuffer = transitionBuffer.currentBuffer; - const lookup = currentBuffer.lookup; - for (let j = 0; j < currentBuffer.length; j++) { - const id = currentBuffer.ids[j]; - const index = lookup[id]; - if (index != null) { - UnitVertex.getTranslation(currentBuffer.dataView, index, translation); - let isInside = true; - for (let k = 0; k < 4; k++) { - let distance = dot(normals[k], translation); - distance += d[k]; - if (distance < 0) { - isInside = false; - break; - } - } - if (isInside) { - set.add(id); - } - } - } - if (set.size > 0) { - this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set.size} ${Math.round(window.performance.now() - start)}ms`); - } - } - sets.push(set); - } - } - return sets; - } - } - const StereoMode = { - none: "none", - split: "split", - anaglyph: "anaglyph", - left: "left", - right: "right", - }; - const HorizontalAlignment = { - left: "left", - center: "center", - right: "right", - }; - const VerticalAlignment = { - top: "top", - center: "center", - bottom: "bottom", - }; - const AxesTextOrientation = { - parallel: "parallel", - perpendicular: "perpendicular", - }; - const AxesVisibility = { - none: "none", - current: "current", - previous: "previous", - }; - const PickType = { - none: 0, - data: 1, - label: 2, - axesDivision: 3, - axesTitle: 4, - axesLabel: 5, - axesHeading: 6, - }; - const Theme = { - dark: "dark", - light: "light", - }; - const HighlightMode = { - luminance: "luminance", - color: "color", - }; - const UnitType = { - block: "block", - blockSdf: "blockSdf", - boxFrameSdf: "boxFrameSdf", - sphere: "sphere", - sphereSdf: "sphereSdf", - cylinder: "cylinder", - cylinderSdf: "cylinderSdf", - hexPrism: "hexPrism", - hexPrismSdf: "hexPrismSdf", - sdf: "sdf", - disk: "disk", - ringSdf: "ringSdf", - }; - const SingleTouchAction = { - none: "none", - translate: "translate", - rotate: "rotate", - lasso: "lasso", - }; - const MouseWheelAction = { - none: "none", - zoom: "zoom", - rotateY: "rotateY", - }; - const LogLevel = { - trace: 0, - debug: 1, - info: 2, - warn: 3, - error: 4, - }; - const Edge3D = { - topFront: 0, - topRight: 1, - topBack: 2, - topLeft: 3, - bottomFront: 4, - bottomRight: 5, - bottomBack: 6, - bottomLeft: 7, - frontRight: 8, - backRight: 9, - backLeft: 10, - frontLeft: 11, - }; - const RenderMode = { - color: "color", - hdr: "hdr", - depth: "depth", - normal: "normal", - segment: "segment", - edge: "edge", - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - fromValues$3(0xc7, 0x15, 0x85); - fromValues$3(0xff, 0x14, 0x93); - fromValues$3(0xdb, 0x70, 0x93); - fromValues$3(0xff, 0x69, 0xb4); - fromValues$3(0xff, 0xb6, 0xc1); - fromValues$3(0xff, 0xc0, 0xcb); - fromValues$3(0x8b, 0x00, 0x00); - fromValues$3(0xff, 0x00, 0x00); - fromValues$3(0xb2, 0x22, 0x22); - fromValues$3(0xdc, 0x14, 0x3c); - fromValues$3(0xcd, 0x5c, 0x5c); - fromValues$3(0xf0, 0x80, 0x80); - fromValues$3(0xfa, 0x80, 0x72); - fromValues$3(0xe9, 0x96, 0x7a); - fromValues$3(0xff, 0xa0, 0x7a); - fromValues$3(0xff, 0x45, 0x00); - fromValues$3(0xff, 0x63, 0x47); - fromValues$3(0xff, 0x8c, 0x00); - fromValues$3(0xff, 0x7f, 0x50); - fromValues$3(0xff, 0xa5, 0x00); - fromValues$3(0xbd, 0xb7, 0x6b); - fromValues$3(0xff, 0xd7, 0x00); - fromValues$3(0xf0, 0xe6, 0x8c); - fromValues$3(0xff, 0xda, 0xb9); - fromValues$3(0xff, 0xff, 0x00); - fromValues$3(0xee, 0xe8, 0xaa); - fromValues$3(0xff, 0xe4, 0xb5); - fromValues$3(0xff, 0xef, 0xd5); - fromValues$3(0xfa, 0xfa, 0xd2); - fromValues$3(0xff, 0xfa, 0xcd); - fromValues$3(0xff, 0xff, 0xe0); - fromValues$3(0x80, 0x00, 0x00); - fromValues$3(0xa5, 0x2a, 0x2a); - fromValues$3(0x8b, 0x45, 0x13); - fromValues$3(0xa0, 0x52, 0x2d); - fromValues$3(0xd2, 0x69, 0x1e); - fromValues$3(0xb8, 0x86, 0x0b); - fromValues$3(0xcd, 0x85, 0x3f); - fromValues$3(0xbc, 0x8f, 0x8f); - fromValues$3(0xda, 0xa5, 0x20); - fromValues$3(0xf4, 0xa4, 0x60); - fromValues$3(0xd2, 0xb4, 0x8c); - fromValues$3(0xde, 0xb8, 0x87); - fromValues$3(0xf5, 0xde, 0xb3); - fromValues$3(0xff, 0xde, 0xad); - fromValues$3(0xff, 0xe4, 0xc4); - fromValues$3(0xff, 0xeb, 0xcd); - fromValues$3(0xff, 0xf8, 0xdc); - fromValues$3(0x00, 0x64, 0x00); - fromValues$3(0x00, 0x80, 0x00); - fromValues$3(0x55, 0x6b, 0x2f); - fromValues$3(0x22, 0x8b, 0x22); - fromValues$3(0x2e, 0x8b, 0x57); - fromValues$3(0x80, 0x80, 0x00); - fromValues$3(0x6b, 0x8e, 0x23); - fromValues$3(0x3c, 0xb3, 0x71); - fromValues$3(0x32, 0xcd, 0x32); - fromValues$3(0x00, 0xff, 0x00); - fromValues$3(0x00, 0xff, 0x7f); - fromValues$3(0x00, 0xfa, 0x9a); - fromValues$3(0x8f, 0xbc, 0x8f); - fromValues$3(0x66, 0xcd, 0xaa); - fromValues$3(0x9a, 0xcd, 0x32); - fromValues$3(0x7c, 0xfc, 0x00); - fromValues$3(0x7f, 0xff, 0x00); - fromValues$3(0x90, 0xee, 0x90); - fromValues$3(0xad, 0xff, 0x2f); - fromValues$3(0x98, 0xfb, 0x98); - fromValues$3(0x00, 0x80, 0x80); - fromValues$3(0x00, 0x8b, 0x8b); - fromValues$3(0x20, 0xb2, 0xaa); - fromValues$3(0x5f, 0x9e, 0xa0); - fromValues$3(0x00, 0xce, 0xd1); - fromValues$3(0x48, 0xd1, 0xcc); - fromValues$3(0x40, 0xe0, 0xd0); - fromValues$3(0x00, 0xff, 0xff); - fromValues$3(0x00, 0xff, 0xff); - fromValues$3(0x7f, 0xff, 0xd4); - fromValues$3(0xaf, 0xee, 0xee); - fromValues$3(0xe0, 0xff, 0xff); - fromValues$3(0x00, 0x00, 0x80); - fromValues$3(0x00, 0x00, 0x8b); - fromValues$3(0x00, 0x00, 0xcd); - fromValues$3(0x00, 0x00, 0xff); - fromValues$3(0x19, 0x19, 0x70); - fromValues$3(0x41, 0x69, 0xe1); - fromValues$3(0x46, 0x82, 0xb4); - fromValues$3(0x1e, 0x90, 0xff); - fromValues$3(0x00, 0xbf, 0xff); - fromValues$3(0x64, 0x95, 0xed); - fromValues$3(0x87, 0xce, 0xeb); - fromValues$3(0x87, 0xce, 0xfa); - fromValues$3(0xb0, 0xc4, 0xde); - fromValues$3(0xad, 0xd8, 0xe6); - fromValues$3(0xb0, 0xe0, 0xe6); - fromValues$3(0x4b, 0x00, 0x82); - fromValues$3(0x80, 0x00, 0x80); - fromValues$3(0x8b, 0x00, 0x8b); - fromValues$3(0x94, 0x00, 0xd3); - fromValues$3(0x48, 0x3d, 0x8b); - fromValues$3(0x8a, 0x2b, 0xe2); - fromValues$3(0x99, 0x32, 0xcc); - fromValues$3(0xff, 0x00, 0xff); - fromValues$3(0xff, 0x00, 0xff); - fromValues$3(0x6a, 0x5a, 0xcd); - fromValues$3(0x7b, 0x68, 0xee); - fromValues$3(0xba, 0x55, 0xd3); - fromValues$3(0x93, 0x70, 0xdb); - fromValues$3(0xda, 0x70, 0xd6); - fromValues$3(0xee, 0x82, 0xee); - fromValues$3(0xdd, 0xa0, 0xdd); - fromValues$3(0xd8, 0xbf, 0xd8); - fromValues$3(0xe6, 0xe6, 0xfa); - fromValues$3(0xff, 0xe4, 0xe1); - fromValues$3(0xfa, 0xeb, 0xd7); - fromValues$3(0xfa, 0xf0, 0xe6); - fromValues$3(0xf5, 0xf5, 0xdc); - fromValues$3(0xf5, 0xf5, 0xf5); - fromValues$3(0xff, 0xf0, 0xf5); - fromValues$3(0xfd, 0xf5, 0xe6); - fromValues$3(0xf0, 0xf8, 0xff); - fromValues$3(0xff, 0xf5, 0xee); - fromValues$3(0xf8, 0xf8, 0xff); - fromValues$3(0xf0, 0xff, 0xf0); - fromValues$3(0xff, 0xfa, 0xf0); - fromValues$3(0xf0, 0xff, 0xff); - fromValues$3(0xf5, 0xff, 0xfa); - fromValues$3(0xff, 0xfa, 0xfa); - fromValues$3(0xff, 0xff, 0xf0); - fromValues$3(0xff, 0xff, 0xff); - fromValues$3(0x00, 0x00, 0x00); - fromValues$3(0x2f, 0x4f, 0x4f); - fromValues$3(0x69, 0x69, 0x69); - fromValues$3(0x70, 0x80, 0x90); - fromValues$3(0x80, 0x80, 0x80); - fromValues$3(0x77, 0x88, 0x99); - fromValues$3(0xa9, 0xa9, 0xa9); - fromValues$3(0xc0, 0xc0, 0xc0); - fromValues$3(0xd3, 0xd3, 0xd3); - fromValues$3(0xdc, 0xdc, 0xdc); - fromValues$3(0xb8, 0x73, 0x33); - fromValues$3(0xcd, 0x7f, 0x32); - fromValues$3(0xce, 0xd2, 0xd7); - fromValues$3(0xe5, 0xe4, 0xe2); - fromValues$3(0x5c, 0x5d, 0x5b); - fromValues$3(0x87, 0x86, 0x81); - fromValues$3(0xcb, 0xa3, 0xb2); - fromValues$3(0xd2, 0xe8, 0xdf); - fromValues$3(0xc7, 0xe3, 0xe1); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let LabelSetVisual$2 = class LabelSetVisual { - render(elapsedTime, xrFrame) { } - update(elapsedTime) { } - constructor(labelSet) { - this.label = labelSet; - } - }; - class LabelBase { - get material() { return this._material; } - get vertices() { return this._vertices; } - get verticesView() { return this._verticesView; } - get indices() { return this._indices; } - get indexCount() { return this._indexCount; } - get isInitialized() { return this._isInitialized; } - get mMatrix() { return this._mMatrix; } - get scale() { return this._scale; } - set scale(value) { - if (this._scale != value) { - this._scale = value; - this._hasChanged = true; - } - } - get font() { return this._font; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } - } - get rotation() { return this._rotation; } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._hasChanged = true; - } - } - set reverseX(value) { - if (this._reverseX != value) { - this._reverseX = value; - this._hasChanged = true; - } - } - set reverseY(value) { - if (this._reverseY != value) { - this._reverseY = value; - this._hasChanged = true; - } - } - set reverseZ(value) { - if (this._reverseZ != value) { - this._reverseZ = value; - this._hasChanged = true; - } - } - get horizontalAlignment() { return this._horizontalAlignment; } - set horizontalAlignment(value) { - if (this._horizontalAlignment != value) { - this._horizontalAlignment = value; - this._hasChanged = true; - } - } - get verticalAlignment() { return this._verticalAlignment; } - set verticalAlignment(value) { - if (this._verticalAlignment != value) { - this._verticalAlignment = value; - this._hasChanged = true; - } - } - get offsetX() { return this._offsetX; } - set offsetX(value) { - if (this._offsetX != value) { - this._offsetX = value; - this._hasChanged = true; - } - } - get offsetY() { return this._offsetY; } - set offsetY(value) { - if (this._offsetY != value) { - this._offsetY = value; - this._hasChanged = true; - } - } - get offsetZ() { return this._offsetZ; } - set offsetZ(value) { - if (this._offsetZ != value) { - this._offsetZ = value; - this._hasChanged = true; - } - } - get maxGlyphTop() { return this._maxGlyphTop; } - set maxGlyphTop(value) { - if (this._maxGlyphTop != value) { - this._maxGlyphTop = value; - this._hasChanged = true; - } - } - get maxGlyphHeight() { return this._maxGlyphHeight; } - set maxGlyphHeight(value) { - if (this._maxGlyphHeight != value) { - this._maxGlyphHeight = value; - this._hasChanged = true; - } - } - constructor(core, options) { - this._core = core; - this._offset = create$3(); - this._vec3 = create$3(); - this._vec4 = create$2(); - this._mMatrix = create$4(); - this._indexCount = 0; - this._maxGlyphs = options.maxGlyphs; - this._textMetric = { width: 0, maxHeight: 0, maxTop: 0 }; - this.scale = options.scale ? options.scale : 1; - this.offsetX = options.offsetX ? options.offsetX : 0; - this.offsetY = options.offsetY ? options.offsetY : 0; - this.offsetZ = options.offsetZ ? options.offsetZ : 0; - this.reverseX = options.reverseX; - this.reverseY = options.reverseY; - this.reverseZ = options.reverseZ; - this.rotation = options.rotation; - this.maxGlyphTop = options.maxGlyphTop; - this.horizontalAlignment = options.horizontalAlignment === undefined ? HorizontalAlignment.center : options.horizontalAlignment; - this.verticalAlignment = options.verticalAlignment === undefined ? VerticalAlignment.center : options.verticalAlignment; - this._material = options.material; - this.borderWidth = core.config.textBorderWidth; - this.gamma = 0; - } - initialize() { - this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); - this._verticesView = new DataView(this._vertices); - this._indices = new Uint32Array(this._maxGlyphs * 6); - this._isInitialized = true; - } - update(elapsedTime) { } - } - class LabelSet extends LabelBase { - get materials() { return this._materials; } - get minBoundsX() { return this._minBoundsX; } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; - } - } - get minBoundsY() { return this._minBoundsY; } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; - } - } - get minBoundsZ() { return this._minBoundsZ; } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } - } - get maxBoundsX() { return this._maxBoundsX; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } - } - get maxBoundsY() { return this._maxBoundsY; } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } - } - get maxBoundsZ() { return this._maxBoundsZ; } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - get positionsX() { return this._positionsX; } - set positionsX(value) { - if (this._positionsX != value) { - this._positionsX = value; - this._hasChanged = true; - } - } - get positionsY() { return this._positionsY; } - set positionsY(value) { - if (this._positionsY != value) { - this._positionsY = value; - this._hasChanged = true; - } - } - get positionsZ() { return this._positionsZ; } - set positionsZ(value) { - if (this._positionsZ != value) { - this._positionsZ = value; - this._hasChanged = true; - } - } - get positionScalingX() { return this._positionScalingX; } - set positionScalingX(value) { - if (this._positionScalingX != value) { - this._positionScalingX = value; - this._hasChanged = true; - } - } - get positionScalingY() { return this._positionScalingY; } - set positionScalingY(value) { - if (this._positionScalingY != value) { - this._positionScalingY = value; - this._hasChanged = true; - } - } - get positionScalingZ() { return this._positionScalingZ; } - set positionScalingZ(value) { - if (this._positionScalingZ != value) { - this._positionScalingZ = value; - this._hasChanged = true; - } - } - get rotations() { return this._rotations; } - set rotations(value) { - if (this._rotations != value) { - this._rotations = value; - this._hasChanged = true; - } - } - get offsetsX() { return this._offsetsX; } - set offsetsX(value) { - if (this._offsetsX != value) { - this._offsetsX = value; - this._hasChanged = true; - } - } - get offsetsY() { return this._offsetsY; } - set offsetsY(value) { - if (this._offsetsY != value) { - this._offsetsY = value; - this._hasChanged = true; - } - } - get offsetsZ() { return this._offsetsZ; } - set offsetsZ(value) { - if (this._offsetsZ != value) { - this._offsetsZ = value; - this._hasChanged = true; - } - } - get offsetScalingX() { return this._offsetScalingX; } - set offsetScalingX(value) { - if (this._offsetScalingX != value) { - this._offsetScalingX = value; - this._hasChanged = true; - } - } - get offsetScalingY() { return this._offsetScalingY; } - set offsetScalingY(value) { - if (this._offsetScalingY != value) { - this._offsetScalingY = value; - this._hasChanged = true; - } - } - get offsetScalingZ() { return this._offsetScalingZ; } - set offsetScalingZ(value) { - if (this._offsetScalingZ != value) { - this._offsetScalingZ = value; - this._hasChanged = true; - } - } - get text() { return this._text; } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; - } - } - get horizontalAlignments() { return this._horizontalAlignments; } - set horizontalAlignments(value) { - if (this._horizontalAlignments != value) { - this._horizontalAlignments = value; - this._hasChanged = true; - } - } - get verticalAlignments() { return this._verticalAlignments; } - set verticalAlignments(value) { - if (this._verticalAlignments != value) { - this._verticalAlignments = value; - this._hasChanged = true; - } - } - get scales() { return this._scales; } - set scales(value) { - if (this._scales != value) { - this._scales = value; - this._hasChanged = true; - } - } - get scalesScaling() { return this._scalesScaling; } - set scalesScaling(value) { - if (this._scalesScaling != value) { - this._scalesScaling = value; - this._hasChanged = true; - } - } - constructor(core, options) { - super(core, options); - this._quat = create$1(); - this._materials = options.materials; - this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - this._font = options.font || core.font; - this.text = options.text; - this.positionsX = options.positionsX; - this.positionsY = options.positionsY; - this.positionsZ = options.positionsZ; - this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - this.rotations = options.rotations; - this.offsetsX = options.offsetsX; - this.offsetsY = options.offsetsY; - this.offsetsZ = options.offsetsZ; - this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - if (options.horizontalAlignments) - this.horizontalAlignments = options.horizontalAlignments; - if (options.verticalAlignments) - this.verticalAlignments = options.verticalAlignments; - if (options.scales) - this.scales = options.scales; - this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; - } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.pickIdLookup = {}; - if (!this._text) { - this._indexCount = 0; - } - else { - const start = window.performance.now(); - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; - const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; - const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; - if (this._rotation) { - set$1(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); - } - let glyphs = 0; - for (let i = 0; i < this._text.length; i++) { - const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; - const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; - const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; - const text = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); - const scale = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; - TextHelper.measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const lineHeight = this._font.size * scale; - const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale; - const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; - switch (horizontalAlignment) { - case HorizontalAlignment.left: - this._offset[0] = offsetX; - break; - case HorizontalAlignment.center: - this._offset[0] = offsetX - width / 2; - break; - case HorizontalAlignment.right: - this._offset[0] = offsetX - width; - break; - } - const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; - switch (verticalAlignment) { - case VerticalAlignment.top: - this._offset[1] = offsetY - lineHeight / 2; - break; - case VerticalAlignment.center: - this._offset[1] = offsetY; - break; - case VerticalAlignment.bottom: - this._offset[1] = offsetY + lineHeight / 2; - break; - } - this._offset[1] -= maxGlyphTop / 2; - this._offset[2] = offsetZ; - let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; - let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; - let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; - if (this._reverseX) { - positionX = this.minBoundsX + this.maxBoundsX - positionX; - } - if (this._reverseY) { - positionY = this.minBoundsY + this.maxBoundsY - positionY; - } - if (this._reverseZ) { - positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; - } - set$3(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); - if (this._rotations) { - set$1(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); - } - const pickId = PickHelper.nextPickId(); - PickHelper.encodeNumber(pickId, PickType.label, this._vec4); - this.pickIdLookup[pickId] = i; - TextHelper.addString(this._font, text, this._verticesView, this._indices, glyphs, this._vec3, scale, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); - glyphs += text.length; - if (glyphs >= this._maxGlyphs) { - glyphs = this._maxGlyphs; - break; - } - } - this._indexCount = glyphs * 6; - this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - } - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let ImageVisual$2 = class ImageVisual { - render(elapsedTime, xrFrame) { } - update(elapsedTime) { } - constructor(image) { - this.image = image; - } - }; - class ImageBase { - get material() { return this._material; } - get vertices() { return this._vertices; } - get indices() { return this._indices; } - get indexCount() { return this._indexCount; } - get isInitialized() { return this._isInitialized; } - get mMatrix() { return this._mMatrix; } - get imageData() { return this._imageData; } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._hasChanged = true; - } - } - get rotation() { return this._rotation; } - set rotation(value) { - if (!equals$1(this._rotation, value)) { - copy$1(this._rotation, value); - this._hasChanged = true; - } - } - get position() { return this._position; } - set position(value) { - if (!equals$3(this._position, value)) { - copy$3(this._position, value); - this._hasChanged = true; - } - } - get texCoord0() { return this._texCoord0; } - set texCoord0(value) { - if (!equals(this._texCoord0, value)) { - copy(this._texCoord0, value); - this._hasChanged = true; - } - } - get texCoord1() { return this._texCoord1; } - set texCoord1(value) { - if (!equals(this._texCoord1, value)) { - copy(this._texCoord1, value); - this._hasChanged = true; - } - } - get minBoundsX() { return this._minBoundsX; } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; - } - } - get minBoundsY() { return this._minBoundsY; } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; - } - } - get minBoundsZ() { return this._minBoundsZ; } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } - } - get maxBoundsX() { return this._maxBoundsX; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } - } - get maxBoundsY() { return this._maxBoundsY; } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } - } - get maxBoundsZ() { return this._maxBoundsZ; } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - constructor(core, options) { - this._core = core; - this._mMatrix = create$4(); - this._origin = create$3(); - this._translation = create$3(); - this._scale = create$3(); - this._transform = create$4(); - this._imageData = options.imageData; - this._minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - this._minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - this._minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - this._maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - this._maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - this._maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - this._position = options.position ? clone$4(options.position) : create$3(); - this._rotation = options.rotation ? clone$2(options.rotation) : create$1(); - this._texCoord0 = options.texCoord0 ? clone$1(options.texCoord0) : fromValues(0, 0); - this._texCoord1 = options.texCoord1 ? clone$1(options.texCoord1) : fromValues(1, 1); - this._material = options.material === undefined ? -1 : options.material; - this._hasChanged = true; - } - } - class ImageQuad extends ImageBase { - get width() { return this._width; } - set width(value) { - if (this._width != value) { - this._width = value; - this._hasChanged = true; - } - } - get height() { return this._height; } - set height(value) { - if (this._height != value) { - this._height = value; - this._hasChanged = true; - } - } - constructor(core, options) { - super(core, options); - this._width = options.width === undefined ? 1 : options.width; - this._height = options.height === undefined ? 1 : options.height; - this._texTransform = create$4(); - translate(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); - scale$1(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); - } - initialize() { - this._vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); - this._indices = Quad$2.INDICES; - this._indexCount = this._indices.length; - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - set$3(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - subtract(this._translation, this._position, this._origin); - scale(this._translation, this._translation, boundsScaling); - set$3(this._scale, this._width, this._height, 1); - scale(this._scale, this._scale, boundsScaling); - fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); - this._verticesView = Quad$2.normalTextured(this._transform, this._texTransform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) { - this.hasChangedCallback(); - } - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class BoundsHelper { - static rotateBounds(minBounds, maxBounds, rotation, rotatedMinBounds, rotatedMaxBounds, offset) { - const sizeX = maxBounds[0] - minBounds[0]; - const sizeY = maxBounds[1] - minBounds[1]; - const sizeZ = maxBounds[2] - minBounds[2]; - const min$1 = rotatedMinBounds; - const max$1 = rotatedMaxBounds; - set$3(min$1, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - set$3(max$1, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const vertices = Cube.POSITIONS; - const position = create$3(); - for (let i = 0; i < 8; i++) { - set$3(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - add(position, position, offset); - transformQuat(position, position, rotation); - subtract(position, position, offset); - min(min$1, min$1, position); - max(max$1, max$1, position); - } - add(position, minBounds, maxBounds); - scale(position, position, 0.5); - add(min$1, min$1, position); - add(max$1, max$1, position); - } - static cylinder(pa, pb, radius, minBounds, maxBounds) { - const a = create$3(); - subtract(a, pb, pa); - const aa = dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - minBounds[0] = Math.min(pa[0] - ex, pb[0] - ex); - minBounds[1] = Math.min(pa[1] - ey, pb[1] - ey); - minBounds[2] = Math.min(pa[2] - ez, pb[2] - ez); - maxBounds[0] = Math.max(pa[0] + ex, pb[0] + ex); - maxBounds[1] = Math.max(pa[1] + ey, pb[1] + ey); - maxBounds[2] = Math.max(pa[2] + ez, pb[2] + ez); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class LayoutBase { - get facetScaling() { return this._facetScaling; } - offsetX(facetCoordX) { return (((facetCoordX + 0.5) / this._facetsX) - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; } - offsetY(facetCoordY) { return (((facetCoordY + 0.5) / this._facetsY) - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; } - offsetZ(facetCoordZ) { return (((facetCoordZ + 0.5) / this._facetsZ) - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; } - constructor(core) { - this._core = core; - this.modelOriginX = 0; - this.modelOriginY = 0; - this.modelOriginZ = 0; - this.minModelBoundsX = 0; - this.minModelBoundsY = 0; - this.minModelBoundsZ = 0; - this.maxModelBoundsX = 0; - this.maxModelBoundsY = 0; - this.maxModelBoundsZ = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._facetSpacingX = 0; - this._facetSpacingY = 0; - this._facetSpacingZ = 0; - this._facetSizeX = 0; - this._facetSizeY = 0; - this._facetSizeZ = 0; - this._facetsX = 1; - this._facetsY = 1; - this._facetsZ = 1; - } - _updateModelBounds(options) { - this.minModelBoundsX = options.minBoundsX === undefined ? this.minLayoutBoundsX : options.minBoundsX; - this.minModelBoundsY = options.minBoundsY === undefined ? this.minLayoutBoundsY : options.minBoundsY; - this.minModelBoundsZ = options.minBoundsZ === undefined ? this.minLayoutBoundsZ : options.minBoundsZ; - this.maxModelBoundsX = options.maxBoundsX === undefined ? this.maxLayoutBoundsX : options.maxBoundsX; - this.maxModelBoundsY = options.maxBoundsY === undefined ? this.maxLayoutBoundsY : options.maxBoundsY; - this.maxModelBoundsZ = options.maxBoundsZ === undefined ? this.maxLayoutBoundsZ : options.maxBoundsZ; - this._isFacetted = - (options.facetsX !== undefined && options.facetsX > 1 && options.facetCoordsX != null) || - (options.facetsY !== undefined && options.facetsY > 1 && options.facetCoordsY != null) || - (options.facetsZ !== undefined && options.facetsZ > 1 && options.facetCoordsZ != null); - this._facetSpacingX = options.facetSpacingX === undefined ? 0 : options.facetSpacingX; - this._facetSpacingY = options.facetSpacingY === undefined ? 0 : options.facetSpacingY; - this._facetSpacingZ = options.facetSpacingZ === undefined ? 0 : options.facetSpacingZ; - let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._facetSizeX = modelSizeX; - this._facetSizeY = modelSizeY; - this._facetSizeZ = modelSizeZ; - this._facetsX = options.facetCoordsX ? options.facetsX : 1; - this._facetsY = options.facetCoordsY ? options.facetsY : 1; - this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; - this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; - this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; - this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; - this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); - this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); - this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); - this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; - this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; - this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; - modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; - this._facetScaling = maxBounds / this._maxBounds; - } - resetCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = undefined; - this.minCumulativeLayoutBoundsY = undefined; - this.minCumulativeLayoutBoundsZ = undefined; - this.maxCumulativeLayoutBoundsX = undefined; - this.maxCumulativeLayoutBoundsY = undefined; - this.maxCumulativeLayoutBoundsZ = undefined; - } - _updateCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === undefined ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); - this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === undefined ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); - this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === undefined ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); - this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === undefined ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); - this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === undefined ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); - this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === undefined ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); - } - unitToModelSize(unitSize) { - return unitSize / this._boundsScaling; - } - unitToModelPositionX(unitPositionX) { - return this.unitToModelSize(unitPositionX) + this.modelOriginX; - } - unitToModelPositionY(unitPositionY) { - return this.unitToModelSize(unitPositionY) + this.modelOriginY; - } - unitToModelPositionZ(unitPositionZ) { - return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; - } - unitToModelPosition(unitPosition, modelPosition) { - modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); - modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); - modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); - } - modelToUnitSize(modelSize) { - return modelSize * this._boundsScaling; - } - modelToUnitPositionX(modelPositionX) { - return (modelPositionX - this.modelOriginX) * this._boundsScaling; - } - modelToUnitPositionY(modelPositionY) { - return (modelPositionY - this.modelOriginY) * this._boundsScaling; - } - modelToUnitPositionZ(modelPositionZ) { - return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; - } - modelToUnitPosition(modelPosition, unitPosition) { - unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); - unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); - unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); - } - inclusiveUnitBounds(buffer, ids, unitType, offset, count, minBounds, maxBounds) { - set$3(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - set$3(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const unitScale = create$3(); - const unitRotation = create$1(); - const unitTranslation = create$3(); - const lookup = buffer.lookup; - const dataView = buffer.dataView; - let minBounds0; - let maxBounds0; - let minBounds1; - let maxBounds1; - switch (unitType) { - case UnitType.sphere: - case UnitType.sphereSdf: - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const index = lookup[id]; - UnitVertex.getTranslation(dataView, index, unitTranslation); - UnitVertex.getScale(dataView, index, unitScale); - const radius = unitScale[0] / 2; - minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius); - minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius); - minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius); - maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius); - maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius); - maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius); - } - break; - case UnitType.hexPrism: - case UnitType.hexPrismSdf: - case UnitType.block: - case UnitType.blockSdf: - minBounds0 = create$3(); - maxBounds0 = create$3(); - minBounds1 = create$3(); - maxBounds1 = create$3(); - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const index = lookup[id]; - UnitVertex.getTranslation(dataView, index, unitTranslation); - UnitVertex.getRotation(dataView, index, unitRotation); - UnitVertex.getScale(dataView, index, unitScale); - minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; - minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; - minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; - maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; - maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; - maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; - BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants.VECTOR3_ZERO); - min(minBounds, minBounds, minBounds1); - max(maxBounds, maxBounds, maxBounds1); - } - break; - case UnitType.cylinder: - case UnitType.cylinderSdf: - minBounds0 = create$3(); - maxBounds0 = create$3(); - const pa = create$3(); - const pb = create$3(); - const identityRotation = Constants.VECTOR3_UNITY; - let ca; - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const index = lookup[id]; - UnitVertex.getTranslation(dataView, index, unitTranslation); - UnitVertex.getRotation(dataView, index, unitRotation); - UnitVertex.getScale(dataView, index, unitScale); - const length = unitScale[1]; - const radius = Math.max(unitScale[0], unitScale[2]); - if (length != 0 && radius != 0) { - if (equals$1(unitRotation, Constants.QUAT_IDENTITY)) { - ca = identityRotation; - } - else { - ca = create$3(); - transformQuat(ca, identityRotation, unitRotation); - } - scaleAndAdd(pa, unitTranslation, ca, -length * 0.5); - scaleAndAdd(pb, unitTranslation, ca, length * 0.5); - BoundsHelper.cylinder(pa, pb, radius, minBounds0, maxBounds0); - min(minBounds, minBounds, minBounds0); - max(maxBounds, maxBounds, maxBounds0); - } - } - break; - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Scatter extends LayoutBase { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const lookup = buffer.lookup; - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[id] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = create(); - const _vec3 = create$3(); - const _vec4 = create$2(); - const _quat = create$1(); - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const sizesX = options.sizes ? options.sizes : options.sizesX; - const sizesY = options.sizes ? options.sizes : options.sizesY; - const sizesZ = options.sizes ? options.sizes : options.sizesZ; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - if (options.rotation) { - _quat[0] = options.rotation[0]; - _quat[1] = options.rotation[1]; - _quat[2] = options.rotation[2]; - _quat[3] = options.rotation[3]; - } - else { - rotationTo(_quat, this._core.config.identityRotation, Constants.VECTOR3_UNITY); - } - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) { - positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - } - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } - else { - if (reverseX) { - positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - UnitVertex.setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id]) : 1) * sizeScalingX, minSize) * this._boundsScaling; - _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id]) : 1) * sizeScalingY, minSize) * this._boundsScaling; - _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; - UnitVertex.setScale(dataView, index, _vec3); - if (options.rotations) { - _quat[0] = options.rotations[id * 4]; - _quat[1] = options.rotations[id * 4 + 1]; - _quat[2] = options.rotations[id * 4 + 2]; - _quat[3] = options.rotations[id * 4 + 3]; - UnitVertex.setRotation(dataView, index, _quat); - } - else { - UnitVertex.setRotation(dataView, index, _quat); - } - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = MathHelper.normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = MathHelper.normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - set(_vec2, color, color1); - } - else { - set(_vec2, color, color); - } - UnitVertex.setColor(dataView, index, _vec2); - } - else { - UnitVertex.setColor(dataView, index, Constants.VECTOR2_ONE); - } - UnitVertex.setIdHover(dataView, index, options.hover ? options.hover[id] : id); - UnitVertex.setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = MathHelper.normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } - else { - _vec2[0] = count == 1 ? 0 : i / (count - 1); - } - if (options.staggerOrder !== undefined) { - _vec2[1] = options.staggerOrder; - } - else if (options.staggerOrders) { - const stagger = MathHelper.normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } - else { - _vec2[1] = count == 1 ? 0 : i / (count - 1); - } - UnitVertex.setOrder(dataView, index, _vec2); - UnitVertex.setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - UnitVertex.setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - UnitVertex.setParameter1(dataView, index, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id] : 0); - UnitVertex.setParameter2(dataView, index, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id] : 0); - UnitVertex.setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - UnitVertex.setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - UnitVertex.setTexCoord(dataView, index, _vec4); - } - else { - UnitVertex.setTexCoord(dataView, index, _vec4); - } - } - buffer.update(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - fromValues$3(0.2126, 0.7152, 0.0722); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - create$3(); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - create$3(); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class PathHelper { - static getFilenameWithoutExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1) { - return path; - } - else { - const start = path.lastIndexOf('/') == -1 ? 0 : path.lastIndexOf('/') + 1; - return path.substring(start, dot); - } - } - static getExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1 || dot == path.length - 1) { - return null; - } - else { - return path.substring(dot + 1, path.length); - } - } - static getFilename(path) { - if (path.lastIndexOf('/') == -1) { - return path; - } - else { - const start = path.lastIndexOf('/') + 1; - return path.substring(start, path.length); - } - } - static getPath(path) { - if (path.lastIndexOf('/') == -1) { - return ""; - } - else { - return path.substring(0, path.lastIndexOf('/')); - } - } - static combine(first, second) { - const seperator = first.lastIndexOf('/') == first.length - 1; - if (second.indexOf('/') == 0) { - if (seperator) { - return first.substring(0, first.length - 1) + second; - } - else { - return first + second; - } - } - else { - if (seperator) { - return first + second; - } - else { - return first + '/' + second; - } - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class TextureHelper { - static create(gl, width, height, format, type, filter, bytes, internalFormat = format) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, bytes); - return texture; - } - static fromImage(gl, image, mipmaps, filter) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - if (mipmaps && MathHelper.isPowerOf2(image.width) && MathHelper.isPowerOf2(image.height)) - gl.generateMipmap(gl.TEXTURE_2D); - else { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - } - gl.bindTexture(gl.TEXTURE_2D, null); - return texture; - } - static cubemapFromImages(gl, images) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); - const targets = [ - gl.TEXTURE_CUBE_MAP_POSITIVE_X, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X, - gl.TEXTURE_CUBE_MAP_POSITIVE_Y, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, - gl.TEXTURE_CUBE_MAP_POSITIVE_Z, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Z - ]; - for (let i = 0; i < 6; i++) { - gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - } - gl.generateMipmap(gl.TEXTURE_CUBE_MAP); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); - return texture; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Line extends LayoutBase { - layout(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const offsetScaling = options.offsetScaling === undefined ? 1 : options.offsetScaling; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - this._rotations = new Float32Array(buffer.length * 4); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const _vec3 = create$3(); - const _quat = create$1(); - const direction = create$3(); - const lookup = buffer.lookup; - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; - let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; - let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; - let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; - let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; - let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; - if (fromId == toId) { - this._sizes[index * 3] = 0; - this._sizes[index * 3 + 1] = 0; - this._sizes[index * 3 + 2] = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - } - else { - direction[0] = toPositionX - fromPositionX; - direction[1] = toPositionY - fromPositionY; - direction[2] = toPositionZ - fromPositionZ; - let length$1 = length(direction); - scale(direction, direction, 1 / length$1); - rotationTo(_quat, this._core.config.identityRotation, direction); - this._rotations[index * 4] = _quat[0]; - this._rotations[index * 4 + 1] = _quat[1]; - this._rotations[index * 4 + 2] = _quat[2]; - this._rotations[index * 4 + 3] = _quat[3]; - if (options.offsets) { - const fromOffset = options.offsets[fromId] * offsetScaling / 2; - const toOffset = options.offsets[toId] * offsetScaling / 2; - toPositionX -= direction[0] * toOffset; - toPositionY -= direction[1] * toOffset; - toPositionZ -= direction[2] * toOffset; - fromPositionX += direction[0] * fromOffset; - fromPositionY += direction[1] * fromOffset; - fromPositionZ += direction[2] * fromOffset; - length$1 = Math.max(length$1 - toOffset - fromOffset, minSize); - } - this._sizes[index * 3 + 1] = Math.max(length$1 * sizeScalingY, minSize); - if (options.lineSizes) { - this._sizes[index * 3] = Math.max(options.lineSizes[id] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.lineSizes[id] * sizeScalingZ, minSize); - } - else if (options.endSizes) { - this._sizes[index * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); - } - else { - this._sizes[index * 3] = sizeScalingX; - this._sizes[index * 3 + 2] = sizeScalingZ; - } - } - _vec3[0] = (fromPositionX + toPositionX) / 2; - _vec3[1] = (fromPositionY + toPositionY) / 2; - _vec3[2] = (fromPositionZ + toPositionZ) / 2; - this._positions[index * 3] = _vec3[0]; - this._positions[index * 3 + 1] = _vec3[1]; - this._positions[index * 3 + 2] = _vec3[2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = create(); - const _vec3 = create$3(); - const _quat = create$1(); - const endMinColor = options.endMinColor === undefined ? 0 : options.endMinColor; - const endMaxColor = options.endMaxColor === undefined ? 1 : options.endMaxColor; - const lineMinColor = options.lineMinColor === undefined ? 0 : options.lineMinColor; - const lineMaxColor = options.lineMaxColor === undefined ? 1 : options.lineMaxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) { - positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - } - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } - else { - if (reverseX) { - positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - } - if (reverseY) { - positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - } - if (reverseZ) { - positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - UnitVertex.setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - UnitVertex.setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - UnitVertex.setRotation(dataView, index, _quat); - let size; - if (options.endColors) { - size = 1 / (endMaxColor - endMinColor + 1); - const fromColor = MathHelper.normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - const toColor = MathHelper.normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - set(_vec2, fromColor, toColor); - UnitVertex.setColor(dataView, index, _vec2); - } - else if (options.lineColors) { - size = 1 / (lineMaxColor - lineMinColor + 1); - const color = MathHelper.normalize(options.lineColors[id], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); - set(_vec2, color, color); - UnitVertex.setColor(dataView, index, _vec2); - } - else { - UnitVertex.setColor(dataView, index, Constants.VECTOR2_ONE); - } - UnitVertex.setIdHover(dataView, index, options.hover ? options.hover[id] : id); - UnitVertex.setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = MathHelper.normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } - else { - _vec2[0] = count == 1 ? 0 : i / (count - 1); - } - if (options.staggerOrder !== undefined) { - _vec2[1] = options.staggerOrder; - } - else if (options.staggerOrders) { - const stagger = MathHelper.normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } - else { - _vec2[1] = count == 1 ? 0 : i / (count - 1); - } - UnitVertex.setOrder(dataView, index, _vec2); - UnitVertex.setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - UnitVertex.setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - UnitVertex.setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - UnitVertex.setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class AtlasBase { - get imageData() { return this._imageData; } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._changed = true; - } - } - constructor() { - this._imageData = null; - } - copyFrom(atlas) { - if (atlas.imageData) { - this._imageData = atlas.imageData; - this._changed = true; - } - else { - this.imageData = null; - } - } - update() { } - } - let Atlas$2 = class Atlas extends AtlasBase { - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class BufferBase { - get isInitialized() { return this._isInitialized; } - get ids() { return this._ids; } - get dataView() { return this._dataView; } - get vertices() { return this._vertices; } - get lookup() { return this._lookup; } - get length() { return this._length; } - get selected() { return this._selected; } - constructor(core, ids) { - this._core = core; - this._ids = ids; - this._length = ids.length; - this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); - this._dataView = new DataView(this._vertices); - this._selected = new Set(); - this.from = 0; - this.to = 1; - this.unitType = UnitType.block; - this._lookup = {}; - for (let i = 0; i < this._length; i++) { - const id = ids[i]; - this._lookup[id] = i; - UnitVertex.setRotation(this._dataView, i, Constants.QUAT_IDENTITY); - } - } - createShared() { - const buffer = Object.create(this); - buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); - buffer._dataView = new DataView(buffer._vertices); - return buffer; - } - copyFrom(buffer) { - const start = window.performance.now(); - const fromDataView = buffer.dataView; - const toDataView = this._dataView; - const lookup = buffer.lookup; - for (let i = 0; i < this._length; i++) { - const index = lookup[this._ids[i]]; - if (index != null) { - UnitVertex.copyIdHover(fromDataView, index, toDataView, i); - UnitVertex.copyTranslation(fromDataView, index, toDataView, i); - UnitVertex.copyScale(fromDataView, index, toDataView, i); - UnitVertex.copyRotation(fromDataView, index, toDataView, i); - UnitVertex.copyColor(fromDataView, index, toDataView, i); - UnitVertex.copySelected(fromDataView, index, toDataView, i); - UnitVertex.copyMaterial(fromDataView, index, toDataView, i); - UnitVertex.copyRounding(fromDataView, index, toDataView, i); - UnitVertex.copyOrder(fromDataView, index, toDataView, i); - UnitVertex.copyTexCoord(fromDataView, index, toDataView, i); - UnitVertex.copyTexture(fromDataView, index, toDataView, i); - UnitVertex.copySdfBuffer(fromDataView, index, toDataView, i); - UnitVertex.copySdfBorder(fromDataView, index, toDataView, i); - UnitVertex.copyParameter1(fromDataView, index, toDataView, i); - UnitVertex.copyParameter2(fromDataView, index, toDataView, i); - } - else { - UnitVertex.setRotation(toDataView, i, Constants.QUAT_IDENTITY); - } - } - this.unitType = buffer.unitType; - this._selected = buffer.selected; - this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - update() { } - updateSelection(options) { - const start = window.performance.now(); - const ids = options && options.ids ? options.ids : this._ids; - const offset = options && options.offset !== undefined ? options.offset : 0; - const count = options && options.count !== undefined ? options.count : ids.length; - const selection = this._selected.size > 0; - const dataView = this._dataView; - for (let i = 0; i < count; i++) { - const id = ids[i + offset]; - const index = this._lookup[id]; - UnitVertex.setSelected(dataView, index, selection ? this._selected.has(id) ? 1 : -1 : 0); - } - this.update(); - this._core.log.write(LogLevel.info, `buffer update selection ${count} ${Math.round(window.performance.now() - start)}ms`); - } - } - class TransitionBufferBase { - get pickIdLookup() { return this._pickIdLookup; } - get currentBuffer() { return this._isBuffer1Current ? this._buffer1 : this._buffer2; } - get previousBuffer() { return this._isBuffer1Current ? this._buffer2 : this._buffer1; } - get currentPalette() { return this._isBuffer1Current ? this._palette1 : this._palette2; } - get previousPalette() { return this._isBuffer1Current ? this._palette2 : this._palette1; } - get currentAtlas() { return this._isBuffer1Current ? this._atlas1 : this._atlas2; } - get previousAtlas() { return this._isBuffer1Current ? this._atlas2 : this._atlas1; } - get isInitialized() { return this._isInitialized; } - get length() { return this._length; } - constructor(core, ids, bufferType, paletteType, atlasType) { - this.bufferType = bufferType; - this.paletteType = paletteType; - this.atlasType = atlasType; - this._core = core; - this._length = ids.length; - this.id = TransitionBufferBase._id++; - this.isVisible = true; - this.transitionTime = 1; - this.activeId = -1; - const start = window.performance.now(); - this._buffer1 = new bufferType(core, ids); - this._buffer2 = this._buffer1.createShared(); - this._palette1 = new paletteType(); - this._palette2 = new paletteType(); - this._atlas1 = new atlasType(); - this._atlas2 = new atlasType(); - this.isPickingEnabled = true; - this._pickIdLookup = {}; - const dataView1 = this._buffer1.dataView; - const dataView2 = this._buffer2.dataView; - const _vec4 = create$2(); - for (let i = 0; i < this._length; i++) { - const id = ids[i]; - const pickId = PickHelper.nextPickId(); - this._pickIdLookup[pickId] = id; - PickHelper.encodeNumber(pickId, PickType.data, _vec4); - UnitVertex.setIdColor(dataView1, i, _vec4); - UnitVertex.setIdColor(dataView2, i, _vec4); - } - this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - swap() { - this._isBuffer1Current = !this._isBuffer1Current; - } - copyFrom(transitionBuffer) { - const start = window.performance.now(); - this.key = transitionBuffer.key; - this.isVisible = transitionBuffer.isVisible; - this.transitionTime = transitionBuffer.transitionTime; - this.isPickingEnabled = transitionBuffer.isPickingEnabled; - this.unitType = transitionBuffer.unitType; - this.activeId = transitionBuffer.activeId; - this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); - this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); - this.currentBuffer.update(); - this.previousBuffer.update(); - this.currentPalette.copyFrom(transitionBuffer.currentPalette); - this.previousPalette.copyFrom(transitionBuffer.previousPalette); - this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); - this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); - this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } - TransitionBufferBase._id = 1; - let Buffer$2 = class Buffer extends BufferBase { - constructor(core, ids) { - super(core, ids); - } - }; - let TransitionBuffer$2 = class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids) { - super(core, ids, Buffer$2, Palette$2, Atlas$2); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class DebugAxes { - get vertices() { return this._vertices; } - get indices() { return this._indices; } - get indexCount() { return this._indexCount; } - get isInitialized() { return this._isInitialized; } - initialize() { - let vertexOffset = 0; - let indexOffset = 0; - const axisVertices = Cube.POSITIONS; - const axisIndices = Cube.INDICES; - this._vertices = new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); - const verticesView = new DataView(this._vertices); - this._indices = new Uint16Array(3 * axisIndices.length + 4); - const vertexCount = axisVertices.length / PositionVertex.SIZE; - const indexCount = axisIndices.length; - const transform = create$4(); - const length = 1; - const width = 0.01; - transform[0] = length; - transform[5] = width; - transform[10] = width; - transform[12] = 0.5; - transform[13] = 0; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants.VECTOR3_UNITX, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = length; - transform[10] = width; - transform[12] = 0; - transform[13] = 0.5; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants.VECTOR3_UNITY, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = width; - transform[10] = length; - transform[12] = 0; - transform[13] = 0; - transform[14] = 0.5; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants.VECTOR3_UNITZ, transform, vertexOffset, indexOffset); - this._indexCount = this._indices.length; - this._isInitialized = true; - } - update(elapsedTime) { } - _createAxis(axisVertices, axisIndices, verticesView, indices, color, transform, vertexOffset, indexOffset) { - const position = create$3(); - const vertexCount = axisVertices.length / PositionVertex.SIZE; - const indexCount = axisIndices.length; - for (let i = 0; i < vertexCount; i++) { - set$3(position, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); - transformMat4$2(position, position, transform); - PositionColorVertex.setPosition(verticesView, vertexOffset + i, position); - PositionColorVertex.setColor(verticesView, vertexOffset + i, color); - } - for (let i = 0; i < indexCount; i++) { - indices[indexOffset + i] = axisIndices[i] + vertexOffset; - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - class RendererConfig { - reset() { } - } - class RendererBase { - get isInitialized() { return this._isInitialized; } - get config() { return this._config; } - get devicePixelRatio() { return this._devicePixelRatio; } - get width() { return this._canvas.width; } - set width(value) { this._options.width = value; } - get height() { return this._canvas.height; } - set height(value) { this._options.height = value; } - get webXRReferenceSpace() { return this._webXRReferenceSpace; } - get pickedType() { return this._pickedType; } - get pickedId() { return this._pickedId; } - get isCapturingPickImage() { return this._isCapturingPickImage; } - capturePickImage() { - this._isCapturingPickImage = true; - } - get backgroundColor() { return this._backgroundColor; } - set backgroundColor(value) { - if (!exactEquals(value, this._backgroundColor)) { - this._backgroundColor = value; - } - } - get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { if (this._isAxes1Current) { - this._axes1 = value; - } - else { - this._axes2 = value; - } } - get previousAxes() { return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { if (this._isAxes1Current) { - this._axes2 = value; - } - else { - this._axes1 = value; - } } - swapAxes() { this._isAxes1Current = !this._isAxes1Current; } - createCartesian2dAxesVisual(axes) { - return new AxesVisual(axes); - } - createCartesian3dAxesVisual(axes) { - return new AxesVisual(axes); - } - _createDebugAxesVisual(debugAxes) { return null; } - createLabelSetVisual(labelSet) { - return new LabelSetVisual$2(labelSet); - } - createControllerVisual(controller) { - return new ControllerVisual$1(controller); - } - ; - createTransitionBuffer(ids) { - return new TransitionBuffer$2(this._core, ids); - } - createImageVisual(image) { - return new ImageVisual$2(image); - } - ; - createFontVisual(font) { - return new FontVisual$2(font); - } - constructor(options) { - this._options = options; - this.fonts = {}; - } - get isWebXRSupported() { return false; } - initialize(core) { - this._core = core; - this._canvas = document.createElement("canvas"); - const contextmenu = this._options && this._options.contextmenu; - if (!contextmenu) { - this._canvas.addEventListener("contextmenu", (e) => { e.preventDefault(); }); - } - this._canvas.tabIndex = this._core.container.tabIndex; - this._canvas.style.display = "block"; - this._canvas.style.touchAction = "none"; - this._core.container.appendChild(this._canvas); - this._mvMatrices = [create$4(), create$4()]; - this.pickPMatrix = create$4(); - this.axesVisibility = AxesVisibility.current; - this._debugAxes = new DebugAxes(); - this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); - this.transitionTime = 1; - this.transitionBuffers = []; - this.areLabelsVisible = true; - this.labelSets = []; - this.controllers = []; - this.areImagesVisible = true; - this.images = []; - this._viewports = [new DOMRect(), new DOMRect()]; - this.isPickingEnabled = false; - this._pickedType = PickType.none; - this._pickedId = 0; - this._lassoMMatrix = create$4(); - this._lassoThickness = create(); - this._resizeMinimumDelay = -1; - this._previousResizeWidth = -1; - this._previousResizeHeight = -1; - } - remove() { - this._core.container.removeChild(this._canvas); - } - finalize() { - this._isInitialized = false; - } - setSize(elapsedTime) { - if (this._options && this._options.width && this._options.height) { - this._devicePixelRatio = 1; - this._resizeWidth = this._options.width; - this._resizeHeight = this._options.height; - } - else { - this._devicePixelRatio = window.devicePixelRatio || 1; - this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; - this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; - } - if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { - this._previousResizeWidth = this._resizeWidth; - this._previousResizeHeight = this._resizeHeight; - this._isResizing = true; - this._resizeElapsedTime = elapsedTime; - } - if (this._isResizing) { - if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { - this._isResizing = false; - this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; - this._resize(this._resizeWidth, this._resizeHeight); - } - else { - this._resizeElapsedTime += elapsedTime; - } - } - } - _resize(width, height) { - this._canvas.style.width = `${Math.floor(width / this._devicePixelRatio)}px`; - this._canvas.style.height = `${Math.floor(height / this._devicePixelRatio)}px`; - width = Math.floor(width); - height = Math.floor(height); - this._canvas.width = width; - this._canvas.height = height; - } - update(elapsedTime) { - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousPalette; - const current = transitionBuffer.currentPalette; - if (previous) { - previous.update(); - } - if (current) { - current.update(); - } - } - } - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousAtlas; - const current = transitionBuffer.currentAtlas; - if (previous) { - previous.update(); - } - if (current) { - current.update(); - } - } - } - if (this._core.config.isDebugVisible) { - if (this._debugAxesVisual) { - this._debugAxesVisual.mMatrix = this.mMatrix; - this._debugAxesVisual.vMatrices = this.vMatrices; - this._debugAxesVisual.pMatrices = this.pMatrices; - this._debugAxesVisual.viewports = this._viewports; - this._debugAxesVisual.viewportOffset = this._viewportOffset; - this._debugAxesVisual.viewportCount = this._viewportCount; - } - } - if (this.areLabelsVisible) { - for (let i = 0; i < this.labelSets.length; i++) { - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - this.labelSets[i].label.update(elapsedTime); - labelSetVisual.mMatrix = this.mMatrix; - labelSetVisual.vMatrices = this.vMatrices; - labelSetVisual.pMatrices = this.pMatrices; - labelSetVisual.isPickingEnabled = this.isPickingEnabled; - labelSetVisual.pickPMatrix = this.pickPMatrix; - labelSetVisual.pickVMatrix = this.pickVMatrix; - labelSetVisual.viewports = this._viewports; - labelSetVisual.viewportOffset = this._viewportOffset; - labelSetVisual.viewportCount = this._viewportCount; - labelSetVisual.update(elapsedTime); - } - } - } - if (this.areImagesVisible) { - for (let i = 0; i < this.images.length; i++) { - const imageVisual = this.images[i]; - if (imageVisual && imageVisual.isVisible) { - const image = this.images[i].image; - image.update(elapsedTime); - imageVisual.mMatrix = this.mMatrix; - imageVisual.vMatrices = this.vMatrices; - imageVisual.pMatrices = this.pMatrices; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.pickPMatrix = this.pickPMatrix; - imageVisual.pickVMatrix = this.pickVMatrix; - imageVisual.viewports = this._viewports; - imageVisual.viewportOffset = this._viewportOffset; - imageVisual.viewportCount = this._viewportCount; - imageVisual.update(elapsedTime); - } - } - } - for (let i = 0; i < this.controllers.length; i++) { - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - const controller = this.controllers[i].controller; - controller.update(elapsedTime); - controllerVisual.vMatrices = this.vMatrices; - controllerVisual.inverseVMatrices = this.vMatrices; - controllerVisual.pMatrices = this.pMatrices; - controllerVisual.viewports = this._viewports; - controllerVisual.viewportOffset = this._viewportOffset; - controllerVisual.viewportCount = this._viewportCount; - controllerVisual.update(elapsedTime); - } - } - const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; - if (axesVisuals) { - for (let i = 0; i < axesVisuals.length; i++) { - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - const axes = axesVisual.axes; - axes.mMatrix = this.mMatrix; - axes.vMatrix = this.vMatrices[0]; - axes.update(elapsedTime); - axesVisual.vMatrices = this.vMatrices; - axesVisual.pMatrices = this.pMatrices; - axesVisual.isPickingEnabled = this.isPickingEnabled; - axesVisual.pickPMatrix = this.pickPMatrix; - axesVisual.pickVMatrix = this.pickVMatrix; - axesVisual.viewports = this._viewports; - axesVisual.viewportOffset = this._viewportOffset; - axesVisual.viewportCount = this._viewportCount; - axesVisual.update(elapsedTime); - } - } - } - for (const key in this.fonts) { - const fontVisual = this.fonts[key]; - const font = fontVisual.font; - font.update(); - fontVisual.update(); - } - } - getVertexPosition(position, pickedId) { - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[pickedId]; - if (id > -1) { - const index = transitionBuffer.currentBuffer.lookup[id]; - const dataView = transitionBuffer.currentBuffer.dataView; - UnitVertex.getTranslation(dataView, index, position); - break; - } - } - } - render(elapsedTime, xrFrame) { - return __awaiter$2(this, void 0, void 0, function* () { }); - } - prepare(xrFrame) { } - initializeWebXR(session) { - return null; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Quad$1 = class Quad { - get isInitialized() { return this._isInitialized; } - get vertexBuffer() { return this._vertexBuffer; } - get indexBuffer() { return this._indexBuffer; } - get indexCount() { return this._indexCount; } - initializeContext(gl) { - const _vec3 = fromValues$3(2, 2, 2); - const _mat4 = create$4(); - fromScaling(_mat4, _vec3); - const vertices = Quad$2.positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$2.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Atlas$1 = class Atlas extends AtlasBase { - get texture() { return this._texture; } - get defaultTexture() { return this._defaultTexture; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([0xff, 0xff, 0xff, 0xff])); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._imageData) { - this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - } - else { - this._texture = null; - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Palette$1 = class Palette extends PaletteBase { - get texture() { return this._texture; } - get defaultTexture() { return this._defaultTexture; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for (let i = 0; i < colors.length; i++) { - colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - } - this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } - else { - this._texture = null; - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Buffer$1 = class Buffer extends BufferBase { - get vertexBuffer() { return this._vertexBuffer; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } - }; - let TransitionBuffer$1 = class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids) { - super(core, ids, Buffer$1, Palette$1, Atlas$1); - } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Config$1 = class Config extends RendererConfig { - constructor() { - super(); - this.reset(); - } - reset() { - this.specularIntensity = 0.15; - this.specularPower = 150; - this.lightPosition = fromValues$3(-0.5, 0.5, 0); - this.ambient = 0.01; - const _quat1 = create$1(); - const _quat2 = create$1(); - let angle = AngleHelper.degreesToRadians(15); - setAxisAngle(_quat1, Constants.VECTOR3_UNITX, angle); - multiply(_quat2, _quat1, _quat2); - angle = AngleHelper.degreesToRadians(-15); - setAxisAngle(_quat1, Constants.VECTOR3_UNITY, angle); - multiply(_quat2, _quat2, _quat1); - this.directionToLight = create$3(); - transformQuat(this.directionToLight, Constants.VECTOR3_UNITZ, _quat2); - this.halfAngle = create$3(); - add(this.halfAngle, Constants.VECTOR3_UNITZ, this.directionToLight); - normalize$2(this.halfAngle, this.halfAngle); - this.isFxaaEnabled = false; - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Resources$1 = class Resources { - bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } - } - initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); - this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); - this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); - this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } - }; - Resources$1.glsl = { - "anaglyph.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n", - "color.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n", - "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", - "lasso.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", - "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "model.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n", - "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", - "pickgrid.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n", - "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n", - "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", - "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", - "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", - "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n", - "unitblock.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitcylinder.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unithexprism.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unithexprism.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n", - "unitsdf.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitsphere.vertex.fx": "#version 100\n#include \"common.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", - "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", - "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n", - }; - let ShaderBase$1 = class ShaderBase { - get isInitialized() { return this._isInitialized; } - get vertexBuffer() { return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } - } - get indexBuffer() { return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } - } - constructor(core, main) { - this._core = core; - this._main = main; - } - initializeContext(gl) { - this._gl = gl; - } - _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); - } - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); - } - return shader; - } - _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = (index == -1) ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; - } - prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) { - this._main.shaderResources.currentShader.disableProgram(); - } - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } - else { - if (this._haveBuffersChanged) { - this.updateBuffers(); - } - if (this._haveTexturesChanged) { - this.updateTextures(); - } - } - } - apply() { } - applyModel() { } - applyView() { } - enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; - } - updateBuffers() { - this._haveBuffersChanged = false; - } - updateTextures() { - this._haveTexturesChanged = false; - } - disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; - } - _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); - } - _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource) => { - this._includesFromUrl(vsSource, 0, (vsIncSource) => { - this._sourceFromUrl(fsName, (fsSource) => { - this._includesFromUrl(fsSource, 0, (fsIncSource) => { - callback(vsIncSource, fsIncSource); - }); - }); - }); - }); - } - _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); - request.onreadystatechange = () => { - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) { - callback(request.responseText); - } - }; - request.send(); - } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources$1.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - } while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } - else { - callback(source); - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Color$1 = class Color extends ShaderBase$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._colorAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Texture$1 = class Texture extends ShaderBase$1 { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Lasso$3 = class Lasso extends ShaderBase$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; - } - apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); - } - applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Model extends ShaderBase$1 { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - } - applyView() { - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let SdfText$1 = class SdfText extends ShaderBase$1 { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let PickGrid$1 = class PickGrid extends ShaderBase$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let UnitShader$1 = class UnitShader extends ShaderBase$1 { - get paletteTexture() { return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } - } - get previousPaletteTexture() { return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } - } - get sdfTexture() { return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } - } - get previousSdfTexture() { return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } - } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } - } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } - } - initializeData() { - this._areBuffersInitialized = false; - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); - this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); - this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); - this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); - const vertices = Cube.POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Cube.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); - } - _updateCurrentBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); - } - _updatePreviousBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - if (this._previousInstanceBuffer != this._instanceBuffer) { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - } - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform1f(this._ambientUniform, this.ambient); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._activeColorUniform, this.activeColor); - this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0.0 : 1.0); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - } - updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let UnitBlock$1 = class UnitBlock extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let UnitSphere$1 = class UnitSphere extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.EXT_frag_depth == null) { - fsSource = this._removeDirective(fsSource, "FragDepth"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let UnitCylinder$1 = class UnitCylinder extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.EXT_frag_depth == null) { - fsSource = this._removeDirective(fsSource, "FragDepth"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class UnitHexPrism extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.EXT_frag_depth == null) { - fsSource = this._removeDirective(fsSource, "FragDepth"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let UnitSdf$1 = class UnitSdf extends UnitShader$1 { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); - this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Anaglyph extends ShaderBase$1 { - get texture2D1() { return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } - } - get texture2D2() { return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class DebugAxesVisual { - get isInitialized() { return this._isInitialized && this._main.colorShader.isInitialized; } - constructor(core, main, debugAxes) { - this._main = main; - this._debugAxes = debugAxes; - this.isVisible = true; - } - initializeContext(gl) { - if (!this._debugAxes.isInitialized) { - this._debugAxes.initialize(); - } - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const colorShader = this._main.colorShader; - const shaderResources = this._main.shaderResources; - colorShader.vertexBuffer = this._vertexBuffer; - colorShader.indexBuffer = this._indexBuffer; - colorShader.prepare(); - colorShader.mMatrix = this.mMatrix; - colorShader.apply(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - colorShader.vMatrix = this.vMatrices[viewport]; - colorShader.pMatrix = this.pMatrices[viewport]; - colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let AxesVisualBase$1 = class AxesVisualBase { - get isInitialized() { return this._isInitialized; } - get axes() { return this._axes; } - constructor(core) { - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; - } - update(elapsedTime) { } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() { } - _renderText() { } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Cartesian2dVisual$1 = class Cartesian2dVisual extends AxesVisualBase$1 { - get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core, main, cartesian2dAxes) { - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = () => { this._hasChanged = true; }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 2; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } - else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = Constants.VECTOR3_UNITZ; - gridShader.apply(); - for (let axisId = 0; axisId < 2; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width, height); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for (let face = 0; face < 2; face++) { - const faceId = face; - if (axes.getIsForwardFace(faceId)) { - this._renderGridFace(faceId, width, height); - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Cartesian3dVisual$1 = class Cartesian3dVisual extends AxesVisualBase$1 { - get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core, main, cartesian3dAxes) { - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = () => { this._hasChanged = true; }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 3; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } - else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = Constants.VECTOR3_UNITZ; - gridShader.apply(); - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width, height); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { - this._renderGridFace(faceId, width, height); - } - } - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class ControllerVisual { - get isInitialized() { return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; } - get controller() { return this._controller; } - constructor(core, main, controller) { - this._core = core; - this._main = main; - this._mMatrix = create$4(); - this._vec3 = create$3(); - this._controller = controller; - this._modelShader = main.modelShader; - this._colorShader = main.colorShader; - this.mMatrix = create$4(); - this.rayMMatrix = create$4(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._controller.isInitialized) { - this._controller.initialize(); - } - this._initialize(gl); - } - _initialize(gl) { - this._gl = gl; - this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); - this._modelVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); - this._modelIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); - this._rayVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); - this._rayIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._modelShader.vertexBuffer = this._modelVertexBuffer; - this._modelShader.indexBuffer = this._modelIndexBuffer; - this._modelShader.texture2D = this.modelTexture; - this._modelShader.prepare(); - multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); - this._modelShader.mMatrix = this._mMatrix; - this._modelShader.specularPower = 10; - this._modelShader.specularIntensity = 0.01; - this._modelShader.apply(); - this._modelShader.applyModel(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._modelShader.directionToLight = Constants.VECTOR3_UNITZ; - this._modelShader.halfAngle = Constants.VECTOR3_UNITZ; - this._modelShader.vMatrix = this.vMatrices[viewport]; - this._modelShader.pMatrix = this.pMatrices[viewport]; - this._modelShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isRayVisible) { - this._colorShader.vertexBuffer = this._rayVertexBuffer; - this._colorShader.indexBuffer = this._rayIndexBuffer; - this._colorShader.prepare(); - multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); - this._colorShader.mMatrix = this._mMatrix; - this._colorShader.apply(); - this._colorShader.applyModel(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._colorShader.vMatrix = this.vMatrices[viewport]; - this._colorShader.pMatrix = this.pMatrices[viewport]; - this._colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let ImageVisual$1 = class ImageVisual { - get isInitialized() { return this._isInitialized && this._main.textureShader.isInitialized; } - get image() { return this._image; } - constructor(core, main, image) { - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = () => { this._hasChanged = true; }; - this.mMatrix = create$4(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._image.isInitialized) { - this._image.initialize(); - } - this._gl = gl; - if (this._image.imageData) { - this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); - } - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - const shaderResources = this._main.shaderResources; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.isPickShader = false; - textureShader.apply(); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - textureShader.isPickShader = true; - textureShader.vMatrix = this.pickVMatrix; - textureShader.pMatrix = this.pickPMatrix; - textureShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let LabelVisualBase$1 = class LabelVisualBase { - get isInitialized() { return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; } - constructor(core, main, label) { - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = () => { this._hasChanged = true; }; - this._mMatrix = create$4(); - this.mMatrix = create$4(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._label.isInitialized) { - this._label.initialize(); - } - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - this._main.shaderResources.currentProgram = null; - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - } - } - } - }; - let LabelVisual$1 = class LabelVisual extends LabelVisualBase$1 { - get label() { return this._label; } - set text(value) { this._label.text = value; } - get text() { return this._label.text; } - constructor(core, main, label) { - super(core, main, label); - } - }; - let LabelSetVisual$1 = class LabelSetVisual extends LabelVisualBase$1 { - get label() { return this._label; } - constructor(core, main, label) { - super(core, main, label); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let FontVisual$1 = class FontVisual { - get isInitialized() { return this._isInitialized; } - get font() { return this._font; } - constructor(core, font) { - this._core = core; - this._font = font; - font.hasChangedCallback = () => { this._hasChanged = true; }; - } - initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) { - this._hasChanged = true; - } - } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Lasso$2 = class Lasso { - get isInitialized() { return this._isInitialized; } - get vertexBuffer() { return this._vertexBuffer; } - get indexBuffer() { return this._indexBuffer; } - get indexCount() { return this._indexCount; } - initializeContext(gl) { - const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$2.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - let Main$1 = class Main extends RendererBase { - get shaderResources() { return this._shaderResources; } - get colorShader() { return this._colorShader; } - get textureShader() { return this._textureShader; } - get lassoShader() { return this._lassoShader; } - get modelShader() { return this._modelShader; } - get sdfTextShader() { return this._sdfTextShader; } - get gridShader() { return this._gridShader; } - get blockShader() { return this._blockShader; } - get sphereShader() { return this._sphereShader; } - get cyclinderShader() { return this._cylinderShader; } - get hexPrismShader() { return this._hexPrismShader; } - get sdfShader() { return this._sdfShader; } - get anaglyphShader() { return this._anaglyphShader; } - get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { if (this._isAxes1Current) { - this._axes1 = value; - } - else { - this._axes2 = value; - } } - get previousAxes() { return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { if (this._isAxes1Current) { - this._axes2 = value; - } - else { - this._axes1 = value; - } } - get config() { return this._config; } - constructor(options) { - super(options); - this._config = new Config$1(); - this._quad = new Quad$1(); - this._lasso = new Lasso$2(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = create$2(); - this._mat3 = create$5(); - this._directionToCamera = create$3(); - this._directionToLight = create$3(); - this._halfAngle = create$3(); - this._cameraPosition = create$3(); - this._modelPosition = create$3(); - this.depthEnabled = true; - } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; - } - get isWebXRSupported() { - return true; - } - initialize(core) { - super.initialize(core); - this._shaderResources = new Resources$1(); - this._colorShader = new Color$1(this._core, this); - this._textureShader = new Texture$1(this._core, this); - this._lassoShader = new Lasso$3(this._core, this); - this._modelShader = new Model(this._core, this); - this._sdfTextShader = new SdfText$1(this._core, this); - this._gridShader = new PickGrid$1(this._core, this); - this._anaglyphShader = new Anaglyph(this._core, this); - this._blockShader = new UnitBlock$1(this._core, this); - this._sphereShader = new UnitSphere$1(this._core, this); - this._cylinderShader = new UnitCylinder$1(this._core, this); - this._hexPrismShader = new UnitHexPrism(this._core, this); - this._sdfShader = new UnitSdf$1(this._core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event) => { - this._core.log.write(LogLevel.warn, "WebGL context lost"); - this._isInitialized = false; - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", () => { - this._initializeContext(this._createContext(this._canvas)); - this._isInitialized = true; - this._core.log.write(LogLevel.info, "WebGL context restored"); - }, false); - this._isInitialized = true; - } - _initializeContext(gl) { - this._gl = gl; - for (const key in this.fonts) { - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._shaderResources.initializeContext(this._gl); - this._colorShader.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._modelShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._anaglyphShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._hexPrismShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._debugAxesVisual.initializeContext(this._gl); - this._framebuffers = [null, null]; - const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - this._anaglyphTextures = [null, null]; - this.anaglyphFramebuffers = [null, null]; - for (let i = 0; i < this.transitionBuffers.length; i++) { - this.transitionBuffers[i].initializeContext(this._gl); - } - if (this._axes1) { - for (let i = 0; i < this._axes1.length; i++) { - this._axes1[i].initializeContext(this._gl); - } - } - if (this._axes2) { - for (let i = 0; i < this._axes2.length; i++) { - this._axes2[i].initializeContext(this._gl); - } - } - for (let i = 0; i < this.labelSets.length; i++) { - this.labelSets[i].initializeContext(this._gl); - } - for (let i = 0; i < this.images.length; i++) { - this.images[i].initializeContext(this._gl); - } - for (let i = 0; i < this.controllers.length; i++) { - this.controllers[i].initializeContext(this._gl); - } - } - _resize(width, height) { - super._resize(width, height); - for (let i = 0; i < 2; i++) { - const texture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width, height); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._anaglyphTextures[i] = texture; - this.anaglyphFramebuffers[i] = framebuffer; - } - this._core.log.write(LogLevel.info, `buffers resized ${width},${height}`); - } - _createContext(canvas) { - const antialias = this._options ? this._options.antialias === undefined ? true : this._options.antialias : true; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - return canvas.getContext("webgl", { - stencil: true, - alpha: true, - antialias: antialias, - preserveDrawingBuffer: preserveDrawingBuffer, - }); - } - initializeWebXR(session) { - const promise = new Promise((resolve, reject) => { - this._gl.makeXRCompatible().then(() => { - session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, this._gl), - depthNear: this._core.config.nearPlane, - depthFar: this._core.config.farPlane - }); - session.requestReferenceSpace('local').then((refSpace) => { - this._webXRReferenceSpace = refSpace; - resolve(); - }); - }); - }); - return promise; - } - prepare(xrFrame) { - if (xrFrame) { - const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); - if (pose) { - const glLayer = xrFrame.session.renderState.baseLayer; - for (let i = 0; i < pose.views.length; i++) { - const view = pose.views[i]; - this.vMatrices[i] = view.transform.inverse.matrix; - this.inverseVMatrices[i] = view.transform.matrix; - multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); - this.mvMatrices[i] = this._mvMatrices[i]; - this.pMatrices[i] = view.projectionMatrix; - const viewport = glLayer.getViewport(view); - this._viewports[i].x = viewport.x; - this._viewports[i].y = viewport.y; - this._viewports[i].width = viewport.width; - this._viewports[i].height = viewport.height; - this._framebuffers[i] = glLayer.framebuffer; - } - } - this._viewportOffset = 0; - this._viewportCount = 2; - } - else { - let viewport; - switch (this._core.config.stereoMode) { - case StereoMode.none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case StereoMode.left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case StereoMode.right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - this._framebuffers[1] = null; - break; - case StereoMode.anaglyph: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = this.anaglyphFramebuffers[0]; - this._framebuffers[1] = this.anaglyphFramebuffers[1]; - break; - case StereoMode.split: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = this._canvas.width / 2; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = null; - this._framebuffers[1] = null; - break; - } - } - } - createTransitionBuffer(ids) { - const buffer = new TransitionBuffer$1(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; - } - createControllerVisual(controller) { - const visual = new ControllerVisual(this._core, this, controller); - visual.initializeContext(this._gl); - return visual; - } - createCartesian2dAxesVisual(axes) { - const visual = new Cartesian2dVisual$1(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - createCartesian3dAxesVisual(axes) { - const visual = new Cartesian3dVisual$1(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - _createDebugAxesVisual(debugAxes) { - return new DebugAxesVisual(this._core, this, debugAxes); - } - _createLabelVisual(label) { - return new LabelVisual$1(this._core, this, label); - } - createLabelSetVisual(labelSet) { - const visual = new LabelSetVisual$1(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; - } - createImageVisual(image) { - const visual = new ImageVisual$1(this._core, this, image); - visual.initializeContext(this._gl); - return visual; - } - createFontVisual(font) { - const visual = new FontVisual$1(this._core, font); - visual.initializeContext(this._gl); - return visual; - } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); - } - render(elapsedTime, xrFrame) { - return __awaiter$1(this, void 0, void 0, function* () { - if (this.depthEnabled) { - this._gl.enable(this._gl.DEPTH_TEST); - } - else { - this._gl.disable(this._gl.DEPTH_TEST); - } - this._gl.enable(this._gl.CULL_FACE); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); - if (xrFrame) { - const glLayer = xrFrame.session.renderState.baseLayer; - this._shaderResources.bindFramebuffer(glLayer.framebuffer); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - else if (this._core.config.stereoMode == StereoMode.anaglyph) { - for (let i = 0; i < 2; i++) { - this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - else { - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - if (this._core.config.isDebugVisible) { - this._debugAxesVisual.framebuffers = this._framebuffers; - this._debugAxesVisual.render(elapsedTime, xrFrame); - } - const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; - if (axesVisuals) { - for (let i = 0; i < axesVisuals.length; i++) { - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.framebuffers = this._framebuffers; - axesVisual.render(elapsedTime, xrFrame); - } - } - } - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - this._renderTransitionBuffer(xrFrame, transitionBuffer); - } - } - if (this.areLabelsVisible) { - for (let i = 0; i < this.labelSets.length; i++) { - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.framebuffers = this._framebuffers; - labelSetVisual.render(elapsedTime, xrFrame); - } - } - } - if (this.areImagesVisible) { - for (let i = 0; i < this.images.length; i++) { - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.framebuffers = this._framebuffers; - imageVisual.pickFramebuffer = this._pickFrameBuffer; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.render(elapsedTime, xrFrame); - } - } - } - for (let i = 0; i < this.controllers.length; i++) { - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - controllerVisual.isRayVisible = this.isPickingEnabled; - controllerVisual.framebuffers = this._framebuffers; - controllerVisual.render(elapsedTime, xrFrame); - } - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = PickHelper.decodeType(this._pickedPixels); - set$2(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = PickHelper.decodeNumber(this._pickedPixels); - if (this._isCapturingPickImage && this.capturePickImageCallback) { - this._isCapturingPickImage = false; - const data = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); - this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data); - for (let i = 0; i < data.length / 4; i++) { - if (data[i * 4 + 3] == PickType.data) { - data[i * 4 + 3] = 255; - } - else { - data[i * 4] = 0; - data[i * 4 + 1] = 0; - data[i * 4 + 2] = 0; - data[i * 4 + 3] = 0; - } - } - const length = this._core.config.pickWidth * this._core.config.pickHeight * 4; - const row = this._core.config.pickWidth * 4; - const end = (this._core.config.pickHeight - 1) * row; - const flipped = new Uint8ClampedArray(length); - for (let i = 0; i < length; i += row) { - flipped.set(data.subarray(i, i + row), end - i); - } - this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); - } - } - else { - set$2(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for (let i = 0; i < this._viewportCount; i++) { - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = ((this.lassoX0 + lassoWidth / 2) / viewport.width) * 2 - 1; - this._lassoMMatrix[13] = 1 - ((this.lassoY0 + lassoHeight / 2) / viewport.height) * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { - this._shaderResources.bindFramebuffer(null); - this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); - this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; - this._anaglyphShader.indexBuffer = this._quad.indexBuffer; - this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; - this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; - this._anaglyphShader.prepare(); - this._anaglyphShader.viewport = this._viewports[0]; - this._anaglyphShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - }); - } - _renderTransitionBuffer(xrFrame, transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = 0; - this._blockShader.rangeMax = transitionBuffer.length - 1; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.selectedColor = this._core.config.selectionColor; - this._blockShader.hoverColor = this._core.config.hoverColor; - this._blockShader.activeColor = this._core.config.activeColor; - this._blockShader.highlightMode = this._core.config.highlightMode; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.ambient = this._config.ambient; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$2(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$2(this._directionToCamera, this._directionToCamera); - add(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$2(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._blockShader.directionToLight = this._directionToLight; - this._blockShader.halfAngle = this._halfAngle; - } - else { - this._blockShader.directionToLight = this._config.directionToLight; - this._blockShader.halfAngle = this._config.halfAngle; - } - this._blockShader.vMatrix = vMatrix; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = 0; - this._sphereShader.rangeMax = transitionBuffer.length - 1; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.selectedColor = this._core.config.selectionColor; - this._sphereShader.hoverColor = this._core.config.hoverColor; - this._sphereShader.activeColor = this._core.config.activeColor; - this._sphereShader.highlightMode = this._core.config.highlightMode; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.ambient = this._config.ambient; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$2(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$2(this._directionToCamera, this._directionToCamera); - add(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$2(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sphereShader.directionToLight = this._directionToLight; - this._sphereShader.halfAngle = this._halfAngle; - } - else { - this._sphereShader.directionToLight = this._config.directionToLight; - this._sphereShader.halfAngle = this._config.halfAngle; - } - this._sphereShader.vMatrix = vMatrix; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = 0; - this._cylinderShader.rangeMax = transitionBuffer.length - 1; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.selectedColor = this._core.config.selectionColor; - this._cylinderShader.hoverColor = this._core.config.hoverColor; - this._cylinderShader.activeColor = this._core.config.activeColor; - this._cylinderShader.highlightMode = this._core.config.highlightMode; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.ambient = this._config.ambient; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$2(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$2(this._directionToCamera, this._directionToCamera); - add(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$2(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._cylinderShader.directionToLight = this._directionToLight; - this._cylinderShader.halfAngle = this._halfAngle; - } - else { - this._cylinderShader.directionToLight = this._config.directionToLight; - this._cylinderShader.halfAngle = this._config.halfAngle; - } - this._cylinderShader.vMatrix = vMatrix; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { - this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; - this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._hexPrismShader.prepare(); - this._hexPrismShader.mMatrix = this.mMatrix; - this._hexPrismShader.time = this.transitionTime; - this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._hexPrismShader.rangeMin = 0; - this._hexPrismShader.rangeMax = transitionBuffer.length - 1; - this._hexPrismShader.hover = hoverId; - this._hexPrismShader.active = activeId; - this._hexPrismShader.selectedColor = this._core.config.selectionColor; - this._hexPrismShader.hoverColor = this._core.config.hoverColor; - this._hexPrismShader.activeColor = this._core.config.activeColor; - this._hexPrismShader.highlightMode = this._core.config.highlightMode; - this._hexPrismShader.specularPower = this._config.specularPower; - this._hexPrismShader.specularIntensity = this._config.specularIntensity; - this._hexPrismShader.ambient = this._config.ambient; - this._hexPrismShader.apply(); - this._hexPrismShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$2(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$2(this._directionToCamera, this._directionToCamera); - add(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$2(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._hexPrismShader.directionToLight = this._directionToLight; - this._hexPrismShader.halfAngle = this._halfAngle; - } - else { - this._hexPrismShader.directionToLight = this._config.directionToLight; - this._hexPrismShader.halfAngle = this._config.halfAngle; - } - this._hexPrismShader.vMatrix = vMatrix; - this._hexPrismShader.pMatrix = this.pMatrices[viewport]; - this._hexPrismShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._hexPrismShader.isPickShader = true; - this._hexPrismShader.pMatrix = this.pickPMatrix; - this._hexPrismShader.vMatrix = this.pickVMatrix; - this._hexPrismShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = 0; - this._sdfShader.rangeMax = transitionBuffer.length - 1; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.selectedColor = this._core.config.selectionColor; - this._sdfShader.hoverColor = this._core.config.hoverColor; - this._sdfShader.activeColor = this._core.config.activeColor; - this._sdfShader.highlightMode = this._core.config.highlightMode; - this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 0xff; - this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.ambient = this._config.ambient; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - normalize$2(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - normalize$2(this._directionToCamera, this._directionToCamera); - add(this._halfAngle, this._directionToLight, this._directionToCamera); - normalize$2(this._halfAngle, this._halfAngle); - fromMat4(this._mat3, vMatrix); - transformMat3(this._directionToLight, this._directionToLight, this._mat3); - transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sdfShader.directionToLight = this._directionToLight; - this._sdfShader.halfAngle = this._halfAngle; - } - else { - this._sdfShader.directionToLight = this._config.directionToLight; - this._sdfShader.halfAngle = this._config.halfAngle; - } - this._sdfShader.vMatrix = vMatrix; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Quad { - get isInitialized() { return this._isInitialized; } - get vertexBuffer() { return this._vertexBuffer; } - get indexBuffer() { return this._indexBuffer; } - get indexCount() { return this._indexCount; } - initializeContext(gl) { - const _vec3 = fromValues$3(2, 2, 2); - const _mat4 = create$4(); - fromScaling(_mat4, _vec3); - const vertices = Quad$2.positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$2.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Atlas extends AtlasBase { - get texture() { return this._texture; } - get defaultTexture() { return this._defaultTexture; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([0xff, 0xff, 0xff, 0xff])); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._imageData) { - this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - } - else { - this._texture = null; - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Palette extends PaletteBase { - get texture() { return this._texture; } - get defaultTexture() { return this._defaultTexture; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); - } - update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } - } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for (let i = 0; i < colors.length; i++) { - colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - } - this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } - else { - this._texture = null; - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Buffer extends BufferBase { - get vertexBuffer() { return this._vertexBuffer; } - constructor(core, ids) { - super(core, ids); - } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } - } - class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids) { - super(core, ids, Buffer, Palette, Atlas); - } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Config extends RendererConfig { - get keyLightAltitude() { return this._keyLightAltitude; } - set keyLightAltitude(value) { - this._keyLightAltitude = value; - this._updateLights(); - } - get keyLightAzimuth() { return this._keyLightAzimuth; } - set keyLightAzimuth(value) { - this._keyLightAzimuth = value; - this._updateLights(); - } - get keyLightDistance() { return this._keyLightDistance; } - set keyLightDistance(value) { - this._keyLightDistance = value; - this._updateLights(); - } - get fillLight1Altitude() { return this._fillLight1Altitude; } - set fillLight1Altitude(value) { - this._fillLight1Altitude = value; - this._updateLights(); - } - get fillLight1Azimuth() { return this._fillLight1Azimuth; } - set fillLight1Azimuth(value) { - this._fillLight1Azimuth = value; - this._updateLights(); - } - get fillLight2Altitude() { return this._fillLight2Altitude; } - set fillLight2Altitude(value) { - this._fillLight2Altitude = value; - this._updateLights(); - } - get fillLight2Azimuth() { return this._fillLight2Azimuth; } - set fillLight2Azimuth(value) { - this._fillLight2Azimuth = value; - this._updateLights(); - } - constructor() { - super(); - this._rotation = create$1(); - this.keyLightPosition = create$3(); - this.fillLight1Position = create$3(); - this.fillLight2Position = create$3(); - this.reset(); - } - _updateLights() { - this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); - this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); - this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); - } - _updateLight(altitude, azimuth, distance, position) { - rotateY(this._rotation, Constants.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); - rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); - transformQuat(position, Constants.VECTOR3_UNITZ, this._rotation); - scale(position, position, distance); - } - reset() { - this.isSsaoEnabled = true; - this.ssaoWidth = 1024; - this.ssaoHeight = 1024; - this.ssaoBlurEnabled = true; - this.ssaoKernelSize = 8; - this.ssaoNoiseSize = 4; - this.ssaoRadius = 0.02; - this.ssaoPower = 1; - this.isShadowEnabled = true; - this.shadowWidth = 1024; - this.shadowHeight = 1024; - this.isDofEnabled = false; - this.dofAutoFocus = true; - this.dofFocusDistance = 0.5; - this.dofFocusRange = 0.5; - this.dofMaxBackgroundBlur = 0.75; - this.isBloomEnabled = false; - this.bloomIntensity = 2; - this.specularIntensity = 0.15; - this.specularPower = 150; - this.ambientIntensity = 0.1; - this.materialIntensity = 0.5; - this.keyLightIntensity = 1.5; - this.fillLight1Intensity = 0.25; - this.fillLight2Intensity = 0.25; - this._keyLightAltitude = 30; - this._keyLightAzimuth = -45; - this._keyLightDistance = 1; - this._fillLight1Altitude = 30; - this._fillLight1Azimuth = 45; - this._fillLight2Altitude = 30; - this._fillLight2Azimuth = -135; - this._updateLights(); - this.isFxaaEnabled = false; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Resources { - bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } - } - initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.OES_texture_float = gl.getExtension("OES_texture_float"); - this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } - } - Resources.glsl = { - "background.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n", - "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", - "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", - "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", - "deferred.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n", - "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", - "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", - "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", - "fxaa.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n", - "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", - "lasso.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", - "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "pickgrid.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n", - "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", - "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", - "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", - "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", - "texture.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n", - "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitblock.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitcylinder.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n", - "unitsdf.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitsphere.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", - "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", - "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.x+rd.x*h)<size.x ) t = h;\n}\n}\n{\nfloat a = dd.z + dd.x;\nfloat b = od.z + od.x;\nfloat c = oo.z + oo.x - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.y+rd.y*h)<size.y ) t = h;\n}\n}\n{\nfloat a = dd.x + dd.y;\nfloat b = od.x + od.y;\nfloat c = oo.x + oo.y - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.z+rd.z*h)<size.z ) t = h;\n}\n}\nif( t>1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", - "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n", - }; - class ShaderBase { - get isInitialized() { return this._isInitialized; } - get vertexBuffer() { return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } - } - get indexBuffer() { return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } - } - constructor(core, main) { - this._core = core; - this._main = main; - } - initializeContext(gl) { - this._gl = gl; - } - _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); - } - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { - this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); - } - return shader; - } - _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = (index == -1) ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; - } - prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) { - this._main.shaderResources.currentShader.disableProgram(); - } - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } - else { - if (this._haveBuffersChanged) { - this.updateBuffers(); - } - if (this._haveTexturesChanged) { - this.updateTextures(); - } - } - } - apply() { } - applyModel() { } - applyView() { } - enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; - } - updateBuffers() { - this._haveBuffersChanged = false; - } - updateTextures() { - this._haveTexturesChanged = false; - } - disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; - } - _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); - } - _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource) => { - this._includesFromUrl(vsSource, 0, (vsIncSource) => { - this._sourceFromUrl(fsName, (fsSource) => { - this._includesFromUrl(fsSource, 0, (fsIncSource) => { - callback(vsIncSource, fsIncSource); - }); - }); - }); - }); - } - _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); - request.onreadystatechange = () => { - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) { - callback(request.responseText); - } - }; - request.send(); - } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - } while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } - else { - callback(source); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Texture extends ShaderBase { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let Lasso$1 = class Lasso extends ShaderBase { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; - } - apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); - } - applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class SdfText extends ShaderBase { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class PickGrid extends ShaderBase { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); - } - applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class UnitShader extends ShaderBase { - get paletteTexture() { return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } - } - get previousPaletteTexture() { return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } - } - get sdfTexture() { return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } - } - get previousSdfTexture() { return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } - } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } - } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } - } - initializeData() { - this._areBuffersInitialized = false; - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - const vertices = Cube.POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Cube.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); - } - _updateCurrentBuffer() { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); - } - _updatePreviousBuffer() { - if (this._previousInstanceBuffer != this._instanceBuffer) { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - } - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); - } - updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._translationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); - this._gl.vertexAttribDivisor(this._scaleAttribute, 0); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); - this._gl.vertexAttribDivisor(this._colorAttribute, 0); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); - this._gl.vertexAttribDivisor(this._selectedAttribute, 0); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); - this._gl.vertexAttribDivisor(this._orderAttribute, 0); - this._gl.vertexAttribDivisor(this._idAttribute, 0); - this._gl.vertexAttribDivisor(this._idColorAttribute, 0); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class UnitBlock extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class UnitSphere extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class UnitCylinder extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class UnitSdf extends UnitShader { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Background extends ShaderBase { - constructor(core, main) { - super(core, main); - this._quad = new Quad(); - } - initializeContext(gl) { - super.initializeContext(gl); - this._quad.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._isInitialized = true; - this._vao = gl.createVertexArray(); - gl.bindVertexArray(this._vao); - gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); - gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - gl.enableVertexAttribArray(this._positionAttribute); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); - gl.bindVertexArray(null); - } - apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindVertexArray(this._vao); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Ssao extends ShaderBase { - get texture2D1() { return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } - } - get texture2D2() { return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } - } - get texture2D3() { return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); - this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); - this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); - this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); - this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); - this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); - this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); - } - applyView() { - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Box extends ShaderBase { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Deferred extends ShaderBase { - get texture2D1() { return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } - } - get texture2D2() { return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } - } - get texture2D3() { return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } - } - get texture2D4() { return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } - } - get texture2D5() { return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } - } - constructor(core, main) { - super(core, main); - this.directionToKeyLight = create$3(); - this.directionToFillLight1 = create$3(); - this.directionToFillLight2 = create$3(); - this.keyLightHalfAngle = create$3(); - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); - this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); - this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); - this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); - this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); - this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); - this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); - this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); - this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); - this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); - this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); - this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); - this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); - this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); - this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); - this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); - this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); - this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); - this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); - this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); - this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); - this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); - this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); - this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); - this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Combine extends ShaderBase { - get texture2D1() { return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } - } - get texture2D2() { return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } - } - get texture2D3() { return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } - } - get texture2D4() { return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } - } - get texture2D5() { return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1f(this._intensityUniform, this.intensity); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - } - updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class DofBlur extends ShaderBase { - get texture2D1() { return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } - } - get texture2D2() { return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); - this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); - this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); - this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); - this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Downsample extends ShaderBase { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Gaussian extends ShaderBase { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class DofCombine extends ShaderBase { - get texture2D1() { return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } - } - get texture2D2() { return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } - } - get texture2D3() { return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._apertureUniform, this.aperture); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Fxaa extends ShaderBase { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; - } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Bright extends ShaderBase { - get texture2D() { return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) { - this._initializeShader(gl, this._vsSource, this._fsSource); - } - else { - this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._isInitialized = true; - } - apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class AxesVisualBase { - get isInitialized() { return this._isInitialized; } - get axes() { return this._axes; } - constructor(core) { - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; - } - update(elapsedTime) { } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() { } - _renderText() { } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Cartesian2dVisual extends AxesVisualBase { - get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core, main, cartesian2dAxes) { - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = () => { this._hasChanged = true; }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 2; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } - else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - _renderGrid() { - const gridShader = this._main.gridShader; - const axes = this._axes; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for (let axisId = 0; axisId < 2; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 2; edge++) { - const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width, height); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for (let face = 0; face < 2; face++) { - const faceId = face; - if (axes.getIsForwardFace(faceId)) { - this._renderGridFace(faceId, width, height); - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Cartesian3dVisual extends AxesVisualBase { - get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core, main, cartesian3dAxes) { - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = () => { this._hasChanged = true; }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) { - axes.initialize(); - } - if (axes.gridVertices) { - this._createGridBuffers(); - } - if (axes.textVertices) { - this._createTextBuffers(); - } - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { - this._createGridBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { - this._createTextBuffers(); - } - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for (let axisId = 0; axisId < 3; axisId++) { - const orientation = axes.getLabelOrientation(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } - else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for (let edge = 0; edge < 4; edge++) { - const edgeId = Cube.AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { - this._renderGridTicks(axisId, edgeId, width, height); - } - } - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for (let axisId = 0; axisId < 3; axisId++) { - if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for (let face = 0; face < 2; face++) { - const faceId = Cube.AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { - this._renderGridFace(faceId, width, height); - } - } - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class FontVisual { - get isInitialized() { return this._isInitialized; } - get font() { return this._font; } - constructor(core, font) { - this._core = core; - this._font = font; - font.hasChangedCallback = () => { this._hasChanged = true; }; - } - initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) { - this._hasChanged = true; - } - } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class LabelVisualBase { - get isInitialized() { return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; } - constructor(core, main, label) { - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = () => { this._hasChanged = true; }; - this._mMatrix = create$4(); - this.mMatrix = create$4(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._label.isInitialized) { - this._label.initialize(); - } - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - } - class LabelVisual extends LabelVisualBase { - get label() { return this._label; } - set text(value) { this._label.text = value; } - get text() { return this._label.text; } - constructor(core, main, label) { - super(core, main, label); - } - } - class LabelSetVisual extends LabelVisualBase { - get label() { return this._label; } - constructor(core, main, label) { - super(core, main, label); - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class ImageVisual { - get isInitialized() { return this._isInitialized && this._main.textureShader.isInitialized; } - get image() { return this._image; } - constructor(core, main, image) { - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = () => { this._hasChanged = true; }; - this.mMatrix = create$4(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._image.isInitialized) { - this._image.initialize(); - } - this._gl = gl; - if (this._image.imageData) { - this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); - } - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.apply(); - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for (let i = 0; i < this.viewportCount; i++) { - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Lasso { - get isInitialized() { return this._isInitialized; } - get vertexBuffer() { return this._vertexBuffer; } - get indexBuffer() { return this._indexBuffer; } - get indexCount() { return this._indexCount; } - initializeContext(gl) { - const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = Quad$2.INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - class Main extends RendererBase { - get shaderResources() { return this._shaderResources; } - get textureShader() { return this._textureShader; } - get lassoShader() { return this._lassoShader; } - get sdfTextShader() { return this._sdfTextShader; } - get gridShader() { return this._gridShader; } - get blockShader() { return this._blockShader; } - get sphereShader() { return this._sphereShader; } - get cyclinderShader() { return this._cylinderShader; } - get sdfShader() { return this._sdfShader; } - get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { if (this._isAxes1Current) { - this._axes1 = value; - } - else { - this._axes2 = value; - } } - get previousAxes() { return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { if (this._isAxes1Current) { - this._axes2 = value; - } - else { - this._axes1 = value; - } } - get config() { return this._config; } - constructor(options) { - super(options); - this._config = new Config(); - this._quad = new Quad(); - this._lasso = new Lasso(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = create$2(); - this._position = create$3(); - this._direction = create$3(); - this._cameraRotation = create$5(); - this._cameraPosition = create$3(); - this._modelPosition = create$3(); - this._modelManipulationOrigin = create$3(); - this._shadowVMatrix = create$4(); - this._shadowPMatrix = create$4(); - } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; - } - initialize(core) { - super.initialize(core); - this._shaderResources = new Resources(); - this._textureShader = new Texture(core, this); - this._lassoShader = new Lasso$1(core, this); - this._sdfTextShader = new SdfText(core, this); - this._gridShader = new PickGrid(core, this); - this._blockShader = new UnitBlock(core, this); - this._sphereShader = new UnitSphere(core, this); - this._cylinderShader = new UnitCylinder(core, this); - this._sdfShader = new UnitSdf(core, this); - this._backgroundShader = new Background(core, this); - this._ssaoShader = new Ssao(core, this); - this._boxShader = new Box(core, this); - this._deferredShader = new Deferred(core, this); - this._combineShader = new Combine(core, this); - this._dofBlurShader = new DofBlur(core, this); - this._downsampleShader = new Downsample(core, this); - this._gaussianShader = new Gaussian(core, this); - this._dofCombineShader = new DofCombine(core, this); - this._fxaaShader = new Fxaa(core, this); - this._brightPassShader = new Bright(core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event) => { - this._core.log.write(LogLevel.warn, "WebGL context lost"); - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", () => { - this._initializeContext(this._createContext(this._canvas)); - this._core.log.write(LogLevel.info, "WebGL context restored"); - }, false); - this._isInitialized = true; - } - _initializeContext(gl) { - this._gl = gl; - for (const key in this.fonts) { - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); - const random = new PseudoRandom(0); - const _vec3 = create$3(); - for (let i = 0; i < this._config.ssaoKernelSize; i++) { - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - _vec3[2] = random.nextFloat(); - normalize$2(_vec3, _vec3); - scale(_vec3, _vec3, random.nextFloat()); - let scale$1 = i / this._config.ssaoKernelSize; - scale$1 = MathHelper.lerp(0.1, 1, scale$1 * scale$1); - scale(_vec3, _vec3, scale$1); - this._ssaoSampleKernel[i * 3] = _vec3[0]; - this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; - this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; - } - const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); - _vec3[2] = 0; - for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - normalize$2(_vec3, _vec3); - noise[i * 4] = _vec3[0]; - noise[i * 4 + 1] = _vec3[1]; - } - this._ssaoNoiseTexture = this._gl.createTexture(); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); - this._ssaoWidth = -1; - this._ssaoHeight = -1; - this._shadowWidth = -1; - this._shadowHeight = -1; - this._shaderResources.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._backgroundShader.initializeContext(this._gl); - this._ssaoShader.initializeContext(this._gl); - this._boxShader.initializeContext(this._gl); - this._deferredShader.initializeContext(this._gl); - this._combineShader.initializeContext(this._gl); - this._dofBlurShader.initializeContext(this._gl); - this._downsampleShader.initializeContext(this._gl); - this._gaussianShader.initializeContext(this._gl); - this._dofCombineShader.initializeContext(this._gl); - this._fxaaShader.initializeContext(this._gl); - this._brightPassShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._framebuffers = [null, null]; - const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - for (let i = 0; i < this.transitionBuffers.length; i++) { - this.transitionBuffers[i].initializeContext(this._gl); - } - if (this._axes1) { - for (let i = 0; i < this._axes1.length; i++) { - this._axes1[i].initializeContext(this._gl); - } - } - if (this._axes2) { - for (let i = 0; i < this._axes2.length; i++) { - this._axes2[i].initializeContext(this._gl); - } - } - for (let i = 0; i < this.labelSets.length; i++) { - this.labelSets[i].initializeContext(this._gl); - } - for (let i = 0; i < this.images.length; i++) { - this.images[i].initializeContext(this._gl); - } - } - _resize(width, height) { - super._resize(width, height); - this._positionTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); - this._colorTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._normalTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._geometryFrameBuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width, height); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._gl.drawBuffers([this._gl.COLOR_ATTACHMENT0, this._gl.COLOR_ATTACHMENT1, this._gl.COLOR_ATTACHMENT2]); - this._postProcessTexture1 = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessDepthTexture = TextureHelper.create(this._gl, width, height, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); - this._postProcessTexture2 = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); - this._postProcessDofTexture = TextureHelper.create(this._gl, width, height, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); - this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); - const widthHalf = Math.round(width / 2); - const heightHalf = Math.round(height / 2); - this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); - this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); - this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); - this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); - const widthSixteenth = Math.round(widthEighth / 2); - const hgeightSixteenth = Math.round(heightEighth / 2); - this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); - this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); - this._core.log.write(LogLevel.info, `buffers resized ${width},${height}`); - } - _createContext(canvas) { - let supported = false; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - const options = { - stencil: true, - alpha: false, - antialias: false, - preserveDrawingBuffer: preserveDrawingBuffer, - }; - const gl = canvas.getContext("webgl2", options); - if (gl) { - const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); - if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { - const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); - const framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); - if (status == gl.FRAMEBUFFER_COMPLETE) { - supported = true; - } - gl.bindTexture(gl.TEXTURE_2D, null); - } - } - return supported ? gl : null; - } - prepare() { - let viewport; - switch (this._core.config.stereoMode) { - case StereoMode.none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case StereoMode.left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case StereoMode.right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - break; - } - } - createTransitionBuffer(ids) { - const buffer = new TransitionBuffer(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; - } - createCartesian2dAxesVisual(axes) { - const visual = new Cartesian2dVisual(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - createCartesian3dAxesVisual(axes) { - const visual = new Cartesian3dVisual(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - _createLabelVisual(label) { - return new LabelVisual(this._core, this, label); - } - createLabelSetVisual(labelSet) { - const visual = new LabelSetVisual(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; - } - createImageVisual(image) { - const visual = new ImageVisual(this._core, this, image); - visual.initializeContext(this._gl); - return visual; - } - createFontVisual(font) { - const visual = new FontVisual(this._core, font); - visual.initializeContext(this._gl); - return visual; - } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); - } - update(elapsedTime) { - super.update(elapsedTime); - if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { - this._shadowWidth = this._config.shadowWidth; - this._shadowHeight = this._config.shadowHeight; - this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._shadowFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); - this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); - } - if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { - this._ssaoWidth = this._config.ssaoWidth; - this._ssaoHeight = this._config.ssaoHeight; - this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); - this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); - this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); - } - if (this._config.isDofEnabled && this._config.dofAutoFocus) { - this._core.getModelManipulationOrigin(this._modelManipulationOrigin); - this._core.getModelPosition(this._modelPosition); - add(this._position, this._modelManipulationOrigin, this._modelPosition); - this._core.camera.getPosition(this._cameraPosition); - subtract(this._position, this._position, this._cameraPosition); - const distance = -this._position[2]; - const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); - this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance, amount); - } - } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function* () { - this._gl.enable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.cullFace(this._gl.BACK); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); - if (this.config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.clear(this._gl.DEPTH_BUFFER_BIT); - perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); - set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - fromMat4(this._cameraRotation, this.inverseVMatrices[0]); - transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); - add(this._position, this._position, this._modelPosition); - lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants.VECTOR3_UNITY); - } - for (let i = 0; i < this.transitionBuffers.length; i++) { - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - this._renderTransitionBuffer(transitionBuffer); - } - } - const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; - if (axesVisuals) { - for (let i = 0; i < axesVisuals.length; i++) { - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.geometryFramebuffer = this._geometryFrameBuffer; - axesVisual.render(elapsedTime); - } - } - } - if (this.areLabelsVisible) { - for (let i = 0; i < this.labelSets.length; i++) { - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; - labelSetVisual.render(elapsedTime); - } - } - } - if (this.areImagesVisible) { - for (let i = 0; i < this.images.length; i++) { - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.geometryFramebuffer = this._geometryFrameBuffer; - imageVisual.render(elapsedTime); - } - } - } - if (this._backgroundShader.isInitialized) { - this._backgroundShader.prepare(); - this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._backgroundShader.apply(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._gl.bindVertexArray(null); - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = PickHelper.decodeType(this._pickedPixels); - set$2(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = PickHelper.decodeNumber(this._pickedPixels); - } - else { - set$2(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { - const viewport = this._viewportOffset; - this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for (let i = 0; i < this._viewportCount; i++) { - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = ((this.lassoX0 + lassoWidth / 2) / viewport.width) * 2 - 1; - this._lassoMMatrix[13] = 1 - ((this.lassoY0 + lassoHeight / 2) / viewport.height) * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - }); - } - _renderTransitionBuffer(transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = currentBuffer.from; - this._blockShader.rangeMax = currentBuffer.to; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._blockShader.vMatrix = this.vMatrices[viewport]; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = true; - this._blockShader.vMatrix = this._shadowVMatrix; - this._blockShader.pMatrix = this._shadowPMatrix; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.isShadowMap = false; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = currentBuffer.from; - this._sphereShader.rangeMax = currentBuffer.to; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sphereShader.vMatrix = this.vMatrices[viewport]; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = true; - this._sphereShader.vMatrix = this._shadowVMatrix; - this._sphereShader.pMatrix = this._shadowPMatrix; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.isShadowMap = false; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = currentBuffer.from; - this._cylinderShader.rangeMax = currentBuffer.to; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._cylinderShader.vMatrix = this.vMatrices[viewport]; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = true; - this._cylinderShader.vMatrix = this._shadowVMatrix; - this._cylinderShader.pMatrix = this._shadowPMatrix; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.isShadowMap = false; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = currentBuffer.from; - this._sdfShader.rangeMax = currentBuffer.to; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for (let i = 0; i < this._viewportCount; i++) { - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sdfShader.vMatrix = this.vMatrices[viewport]; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = true; - this._sdfShader.vMatrix = this._shadowVMatrix; - this._sdfShader.pMatrix = this._shadowPMatrix; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.isShadowMap = false; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } - } - _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { - if (this._deferredShader.isInitialized) { - this._gl.disable(this._gl.DEPTH_TEST); - let ssaoTexture; - if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { - this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); - ssaoTexture = this._ssaoTexture1; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); - this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; - this._ssaoShader.indexBuffer = this._quad.indexBuffer; - this._ssaoShader.texture2D1 = this._positionTexture; - this._ssaoShader.texture2D2 = this._normalTexture; - this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; - this._ssaoShader.prepare(); - this._ssaoShader.pMatrix = pMatrix; - this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; - this._ssaoShader.ssaoRadius = this._config.ssaoRadius; - this._ssaoShader.ssaoPower = this._config.ssaoPower; - this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; - this._ssaoShader.left = 0; - this._ssaoShader.top = 0; - this._ssaoShader.width = this._config.ssaoWidth; - this._ssaoShader.height = this._config.ssaoHeight; - this._ssaoShader.apply(); - this._ssaoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { - ssaoTexture = this._ssaoTexture2; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); - this._boxShader.vertexBuffer = this._quad.vertexBuffer; - this._boxShader.indexBuffer = this._quad.indexBuffer; - this._boxShader.texture2D = this._ssaoTexture1; - this._boxShader.prepare(); - this._boxShader.left = 0; - this._boxShader.top = 0; - this._boxShader.width = this._config.ssaoWidth; - this._boxShader.height = this._config.ssaoHeight; - this._boxShader.apply(); - this._boxShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); - let postProcessFrameBuffer = this._postProcessFrameBuffer1; - this._shaderResources.bindFramebuffer(postProcessFrameBuffer); - this._deferredShader.vertexBuffer = this._quad.vertexBuffer; - this._deferredShader.indexBuffer = this._quad.indexBuffer; - this._deferredShader.texture2D1 = this._positionTexture; - this._deferredShader.texture2D2 = this._colorTexture; - this._deferredShader.texture2D3 = this._normalTexture; - this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; - this._deferredShader.texture2D5 = this._shadowDepthTexture; - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); - this._deferredShader.prepare(); - this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; - this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; - this._deferredShader.inverseVMatrix = inverseVMatrix; - this._deferredShader.shadowVMatrix = this._shadowVMatrix; - this._deferredShader.shadowPMatrix = this._shadowPMatrix; - this._deferredShader.vMatrix = vMatrix; - this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; - this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; - this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; - this._core.camera.getPosition(this._cameraPosition); - fromMat4(this._cameraRotation, vMatrix); - set$3(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - normalize$2(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); - subtract(this._direction, this._cameraPosition, this._position); - normalize$2(this._direction, this._direction); - add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); - normalize$2(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); - copy$3(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); - copy$3(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); - this._deferredShader.left = viewport.left; - this._deferredShader.top = viewport.top; - this._deferredShader.width = viewport.width; - this._deferredShader.height = viewport.height; - this._deferredShader.shadowMapWidth = this._config.shadowWidth; - this._deferredShader.shadowMapHeight = this._config.shadowHeight; - this._deferredShader.ambientIntensity = this._config.ambientIntensity; - this._deferredShader.materialIntensity = this._config.materialIntensity; - this._deferredShader.specularPower = this._config.specularPower; - this._deferredShader.specularIntensity = this._config.specularIntensity; - this._deferredShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - const widthHalf = Math.round(viewport.width / 2); - const heightHalf = Math.round(viewport.height / 2); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - const widthSixteenth = Math.round(widthEighth / 2); - const heightSixteenth = Math.round(heightEighth / 2); - if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; - this._dofBlurShader.indexBuffer = this._quad.indexBuffer; - this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofBlurShader.texture2D2 = this._positionTexture; - this._dofBlurShader.prepare(); - this._dofBlurShader.focusDepth = this._config.dofFocusDistance; - this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; - this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; - this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; - this._dofBlurShader.left = viewport.left; - this._dofBlurShader.top = viewport.top; - this._dofBlurShader.width = viewport.width; - this._dofBlurShader.height = viewport.height; - this._dofBlurShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; - this._dofCombineShader.indexBuffer = this._quad.indexBuffer; - this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofCombineShader.texture2D2 = this._postProcessDofTexture; - this._dofCombineShader.prepare(); - this._dofCombineShader.focusDepth = this._config.dofFocusDistance; - this._dofCombineShader.left = viewport.left; - this._dofCombineShader.top = viewport.top; - this._dofCombineShader.width = viewport.width; - this._dofCombineShader.height = viewport.height; - this._dofCombineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthHalf; - this._brightPassShader.height = heightHalf; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessHalfTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthQuarter; - this._brightPassShader.height = heightQuarter; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessQuarterTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthEighth; - this._brightPassShader.height = heightEighth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessEighthTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthSixteenth; - this._brightPassShader.height = heightSixteenth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessHalfTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthHalf; - this._gaussianShader.height = heightHalf; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessHalfTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessQuarterTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthQuarter; - this._gaussianShader.height = heightQuarter; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessQuarterTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessEighthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthEighth; - this._gaussianShader.height = heightEighth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessEighthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthSixteenth; - this._gaussianShader.height = heightSixteenth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; - this._fxaaShader.indexBuffer = this._quad.indexBuffer; - this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._fxaaShader.prepare(); - this._fxaaShader.left = viewport.left; - this._fxaaShader.top = viewport.top; - this._fxaaShader.width = viewport.width; - this._fxaaShader.height = viewport.height; - this._fxaaShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._combineShader.vertexBuffer = this._quad.vertexBuffer; - this._combineShader.indexBuffer = this._quad.indexBuffer; - this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - if (this._config.isBloomEnabled) { - this._combineShader.texture2D2 = this._postProcessHalfTexture1; - this._combineShader.texture2D3 = this._postProcessQuarterTexture1; - this._combineShader.texture2D4 = this._postProcessEighthTexture1; - this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; - } - else { - this._combineShader.texture2D2 = null; - this._combineShader.texture2D3 = null; - this._combineShader.texture2D4 = null; - this._combineShader.texture2D5 = null; - } - this._combineShader.prepare(); - this._combineShader.viewport = viewport; - this._combineShader.intensity = this._config.bloomIntensity; - this._combineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class MaterialBufferData extends Float32Array { - constructor(count) { - super(count * MaterialBufferData.SIZE); - this.TYPE_OFFSET = 0 / 4; - this.FUZZ_OFFSET = 4 / 4; - this.REFRACTIVE_INDEX_OFFSET = 8 / 4; - this.TEXTURE_ID_OFFSET = 12 / 4; - this.COLOR_OFFSET = 16 / 4; - this.GLOSSINESS_OFFSET = 28 / 4; - this.ID_COLOR_OFFSET = 32 / 4; - this.DENSITY_OFFSET = 48 / 4; - } - getType(index) { - return this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getFuzz(index) { - return this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET]; - } - setFuzz(index, value) { - this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET] = value; - } - getRefractiveIndex(index) { - return this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET]; - } - setRefractiveIndex(index, value) { - this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET] = value; - } - getTextureId(index) { - return this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET]; - } - setTextureId(index, value) { - this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET] = value; - } - getColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getGlossiness(index) { - return this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET]; - } - setGlossiness(index, value) { - this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET] = value; - } - getDensity(index) { - return this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET]; - } - setDensity(index, value) { - this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET] = value; - } - getIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - } - MaterialBufferData.SIZE = 64 / 4; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class TextureBufferData extends Float32Array { - constructor(count) { - super(count * TextureBufferData.SIZE); - this.COLOR0_OFFSET = 0 / 4; - this.TYPE_OFFSET = 12 / 4; - this.COLOR1_OFFSET = 16 / 4; - this.SIZE0_OFFSET = 32 / 4; - this.SIZE1_OFFSET = 48 / 4; - this.CLIP_OFFSET = 64 / 4; - this.OFFSET_OFFSET = 80 / 4; - } - getType(index) { - return this[TextureBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[TextureBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - set(value, this[offset], this[offset + 1]); - } - setOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - } - } - TextureBufferData.SIZE = 96 / 4; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class HittableBufferData extends Float32Array { - constructor(count) { - super(count * HittableBufferData.SIZE); - this.CENTER0_OFFSET = 0 / 4; - this.TYPE_OFFSET = 12 / 4; - this.SIZE0_OFFSET = 16 / 4; - this.MATERIAL_ID_OFFSET = 28 / 4; - this.ROTATION0_OFFSET = 32 / 4; - this.ROTATION1_OFFSET = 48 / 4; - this.TEXCOORD0_OFFSET = 64 / 4; - this.TEXCOORD1_OFFSET = 72 / 4; - this.CENTER1_OFFSET = 80 / 4; - this.ROUNDING_OFFSET = 92 / 4; - this.SIZE1_OFFSET = 96 / 4; - this.BOUNDARY_TYPE_OFFSET = 108 / 4; - this.TIME0_OFFSET = 112 / 4; - this.TIME1_OFFSET = 116 / 4; - this.TEX_ID_OFFSET = 120 / 4; - this.SDF_BUFFER_OFFSET = 124 / 4; - this.SDF_BORDER_OFFSET = 128 / 4; - this.PARAMETER_1_OFFSET = 132 / 4; - this.PARAMETER_2_OFFSET = 136 / 4; - } - getType(index) { - return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[HittableBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getTime0(index) { - return this[HittableBufferData.SIZE * index + this.TIME0_OFFSET]; - } - setTime0(index, value) { - this[HittableBufferData.SIZE * index + this.TIME0_OFFSET] = value; - } - getTime1(index) { - return this[HittableBufferData.SIZE * index + this.TIME1_OFFSET]; - } - setTime1(index, value) { - this[HittableBufferData.SIZE * index + this.TIME1_OFFSET] = value; - } - getSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getMaterialId(index) { - return this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET]; - } - setMaterialId(index, value) { - this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET] = value; - } - getRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - set$1(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - set$1(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - set(value, this[offset], this[offset + 1]); - } - setTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - } - getTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - set(value, this[offset], this[offset + 1]); - } - setTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - } - getRounding(index) { - return this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET]; - } - setRounding(index, value) { - this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET] = value; - } - getParameter1(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET]; - } - setParameter1(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET] = value; - } - getParameter2(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET]; - } - setParameter2(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET] = value; - } - getBoundaryType(index) { - return this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET]; - } - setBoundaryType(index, value) { - this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET] = value; - } - getTexId(index) { - return this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET]; - } - setTexId(index, value) { - this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET] = value; - } - getSdfBuffer(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET]; - } - setSdfBuffer(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET] = value; - } - getSdfBorder(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET]; - } - setSdfBorder(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; - } - } - HittableBufferData.SIZE = 144 / 4; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class ComputeUniformBufferData extends Float32Array { - constructor() { - super(ComputeUniformBufferData.SIZE); - this.POSITION_OFFSET = 0 / 4; - this.WIDTH_OFFSET = 12 / 4; - this.RIGHT_OFFSET = 16 / 4; - this.HEIGHT_OFFSET = 28 / 4; - this.UP_OFFSET = 32 / 4; - this.SEED_OFFSET = 44 / 4; - this.FORWARD_OFFSET = 48 / 4; - this.FOV_OFFSET = 60 / 4; - this.LOOKAT_OFFSET = 64 / 4; - this.APERTURE_OFFSET = 76 / 4; - this.BACKGROUND_COLOR_OFFSET = 80 / 4; - this.TIME0_OFFSET = 92 / 4; - this.TIME1_OFFSET = 96 / 4; - this.TILES_X = 100 / 4; - this.TILES_Y = 104 / 4; - this.TILE_OFFSET_X = 108 / 4; - this.TILE_OFFSET_Y = 112 / 4; - this.RAYS_PER_FRAME_OFFSET = 116 / 4; - } - getWidth() { - return this[this.WIDTH_OFFSET]; - } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; - } - getHeight() { - return this[this.HEIGHT_OFFSET]; - } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; - } - getSeed() { - return this[this.SEED_OFFSET]; - } - setSeed(value) { - this[this.SEED_OFFSET] = value; - } - getRaysPerFrame() { - return this[this.RAYS_PER_FRAME_OFFSET]; - } - setRaysPerFrame(value) { - this[this.RAYS_PER_FRAME_OFFSET] = value; - } - getFieldOfView() { - return this[this.FOV_OFFSET]; - } - setFieldOfView(value) { - this[this.FOV_OFFSET] = value; - } - getAperture() { - return this[this.APERTURE_OFFSET]; - } - setAperture(value) { - this[this.APERTURE_OFFSET] = value; - } - getPosition(value) { - set$3(value, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); - } - setPosition(value) { - this[this.POSITION_OFFSET] = value[0]; - this[this.POSITION_OFFSET + 1] = value[1]; - this[this.POSITION_OFFSET + 2] = value[2]; - } - getRight(value) { - set$3(value, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); - } - setRight(value) { - this[this.RIGHT_OFFSET] = value[0]; - this[this.RIGHT_OFFSET + 1] = value[1]; - this[this.RIGHT_OFFSET + 2] = value[2]; - } - getUp(value) { - set$3(value, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); - } - setUp(value) { - this[this.UP_OFFSET] = value[0]; - this[this.UP_OFFSET + 1] = value[1]; - this[this.UP_OFFSET + 2] = value[2]; - } - getForward(value) { - set$3(value, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); - } - setForward(value) { - this[this.FORWARD_OFFSET] = value[0]; - this[this.FORWARD_OFFSET + 1] = value[1]; - this[this.FORWARD_OFFSET + 2] = value[2]; - } - getLookAt(value) { - set$3(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); - } - setLookAt(value) { - this[this.LOOKAT_OFFSET] = value[0]; - this[this.LOOKAT_OFFSET + 1] = value[1]; - this[this.LOOKAT_OFFSET + 2] = value[2]; - } - getBackgroundColor(value) { - set$2(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], 1); - } - setBackgroundColor(value) { - this[this.BACKGROUND_COLOR_OFFSET] = value[0]; - this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; - this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; - } - getTime0() { - return this[this.TIME0_OFFSET]; - } - setTime0(value) { - this[this.TIME0_OFFSET] = value; - } - getTime1() { - return this[this.TIME1_OFFSET]; - } - setTime1(value) { - this[this.TIME1_OFFSET] = value; - } - getTilesX() { - return this[this.TILES_X]; - } - setTilesX(value) { - this[this.TILES_X] = value; - } - getTilesY() { - return this[this.TILES_Y]; - } - setTilesY(value) { - this[this.TILES_Y] = value; - } - getTileOffsetX() { - return this[this.TILE_OFFSET_X]; - } - setTileOffsetX(value) { - this[this.TILE_OFFSET_X] = value; - } - getTileOffsetY() { - return this[this.TILE_OFFSET_Y]; - } - setTileOffsetY(value) { - this[this.TILE_OFFSET_Y] = value; - } - } - ComputeUniformBufferData.SIZE = 128 / 4; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class FullscreenQuadUniformBufferData extends Float32Array { - constructor() { - super(FullscreenQuadUniformBufferData.SIZE); - this.WIDTH_OFFSET = 0 / 4; - this.HEIGHT_OFFSET = 4 / 4; - this.SPP_OFFSET = 8 / 4; - this.EXPOSURE_OFFSET = 12 / 4; - this.MIN_DEPTH_OFFSET = 16 / 4; - this.MAX_DEPTH_OFFSET = 20 / 4; - this.EDGE_NORMAL_OFFSET = 24 / 4; - this.EDGE_DEPTH_OFFSET = 28 / 4; - } - getWidth() { - return this[this.WIDTH_OFFSET]; - } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; - } - getHeight() { - return this[this.HEIGHT_OFFSET]; - } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; - } - getSamplesPerPixel() { - return this[this.SPP_OFFSET]; - } - setSamplesPerPixel(value) { - this[this.SPP_OFFSET] = value; - } - getExposure() { - return this[this.EXPOSURE_OFFSET]; - } - setExposure(value) { - this[this.EXPOSURE_OFFSET] = value; - } - getMinDepth() { - return this[this.MIN_DEPTH_OFFSET]; - } - setMinDepth(value) { - this[this.MIN_DEPTH_OFFSET] = value; - } - getMaxDepth() { - return this[this.MAX_DEPTH_OFFSET]; - } - setMaxDepth(value) { - this[this.MAX_DEPTH_OFFSET] = value; - } - getEdgeDepth() { - return this[this.EDGE_DEPTH_OFFSET]; - } - setEdgeDepth(value) { - this[this.EDGE_DEPTH_OFFSET] = value; - } - getEdgeNormal() { - return this[this.EDGE_NORMAL_OFFSET]; - } - setEdgeNormal(value) { - this[this.EDGE_NORMAL_OFFSET] = value; - } - } - FullscreenQuadUniformBufferData.SIZE = 32 / 4; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class LinearBVHNodeBufferData extends Float32Array { - constructor(count) { - super(count * LinearBVHNodeBufferData.SIZE); - this.CENTER_OFFSET = 0 / 4; - this.SIZE_OFFSET = 16 / 4; - this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; - this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; - this.N_PRIMITIVES_OFFSET = 32 / 4; - this.AXIS_OFFSET = 36 / 4; - } - getCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getPrimitivesOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET]; - } - setPrimitivesOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET] = value; - } - getSecondChildOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET]; - } - setSecondChildOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET] = value; - } - getNPrimitives(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET]; - } - setNPrimitives(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET] = value; - } - getAxis(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET]; - } - setAxis(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET] = value; - } - } - LinearBVHNodeBufferData.SIZE = 48 / 4; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class LightBufferData extends Float32Array { - constructor(count) { - super(count * LightBufferData.SIZE); - this.ROTATION_OFFSET = 0 / 4; - this.CENTER_OFFSET = 16 / 4; - this.TYPE_OFFSET = 28 / 4; - this.SIZE_OFFSET = 32 / 4; - this.COLOR_OFFSET = 48 / 4; - } - getType(index) { - return this[LightBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[LightBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - set$3(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - set$1(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - } - LightBufferData.SIZE = 64 / 4; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ - - var types = /*#__PURE__*/Object.freeze({ - __proto__: null, - MorphChartsCore: Core - }); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function concat(...args) { - return args.reduce((p, c) => c ? p.concat(c) : p, []); - } - /** - * Returns array with items which are truthy. - * @param args array or arrays to concat into a single array. - */ - function allTruthy(...args) { - return args.reduce((p, c) => c ? p.concat(c) : p, []).filter(Boolean); - } - /** - * Add an array to an existing array in place. - * @param arr Array to append to. - * @param items Arrof of items to append. - */ - function push(arr, items) { - arr.push.apply(arr, items); - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - /** - * Create a new element as a child of another element. - * @param tagName Tag name of the new tag to create. - * @param parentElement Reference of the element to append to. - * @returns new HTMLElement. - */ - function addEl(tagName, parentElement) { - const el = document.createElement(tagName); - parentElement.appendChild(el); - return el; - } - /** - * Create a new div HTMLElement as a child of another element. - * @param parentElement Reference of the element to append to. - * @param className Optional css class name to apply to the div. - */ - function addDiv(parentElement, className) { - const div = addEl('div', parentElement); - if (className) { - div.className = className; - } - return div; - } - /** - * Measure the outer height and width of an HTMLElement, including margin, padding and border. - * @param el HTML Element to measure. - */ - function outerSize(el) { - const cs = getComputedStyle(el); - const height = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); - const width = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); - return { height, width }; - } - - var isMergeableObject = function isMergeableObject(value) { - return isNonNullObject(value) - && !isSpecial(value) - }; - - function isNonNullObject(value) { - return !!value && typeof value === 'object' - } - - function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - - return stringValue === '[object RegExp]' - || stringValue === '[object Date]' - || isReactElement(value) - } - - // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 - var canUseSymbol = typeof Symbol === 'function' && Symbol.for; - var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; - - function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE - } - - function emptyTarget(val) { - return Array.isArray(val) ? [] : {} - } - - function cloneUnlessOtherwiseSpecified(value, options) { - return (options.clone !== false && options.isMergeableObject(value)) - ? deepmerge$1(emptyTarget(value), value, options) - : value - } - - function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options) - }) - } - - function mergeObject(target, source, options) { - var destination = {}; - if (options.isMergeableObject(target)) { - Object.keys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - } - Object.keys(source).forEach(function(key) { - if (!options.isMergeableObject(source[key]) || !target[key]) { - destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); - } else { - destination[key] = deepmerge$1(target[key], source[key], options); - } - }); - return destination - } - - function deepmerge$1(target, source, options) { - options = options || {}; - options.arrayMerge = options.arrayMerge || defaultArrayMerge; - options.isMergeableObject = options.isMergeableObject || isMergeableObject; - - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); - var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - - if (!sourceAndTargetTypesMatch) { - return cloneUnlessOtherwiseSpecified(source, options) - } else if (sourceIsArray) { - return options.arrayMerge(target, source, options) - } else { - return mergeObject(target, source, options) - } - } - - deepmerge$1.all = function deepmergeAll(array, options) { - if (!Array.isArray(array)) { - throw new Error('first argument should be an array') - } - - return array.reduce(function(prev, next) { - return deepmerge$1(prev, next, options) - }, {}) - }; - - var deepmerge_1 = deepmerge$1; - - var _deepmerge = /*#__PURE__*/Object.freeze({ - __proto__: null, - default: deepmerge_1 - }); - - /*! - * is-plain-object <https://github.com/jonschlinkert/is-plain-object> - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ - - function isObject(o) { - return Object.prototype.toString.call(o) === '[object Object]'; - } - - function isPlainObject(o) { - var ctor,prot; - - if (isObject(o) === false) return false; - - // If has modified constructor - ctor = o.constructor; - if (ctor === undefined) return true; - - // If has modified prototype - prot = ctor.prototype; - if (isObject(prot) === false) return false; - - // If constructor does not have an Object-specific method - if (prot.hasOwnProperty('isPrototypeOf') === false) { - return false; - } - - // Most likely a plain Object - return true; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const deepmerge = (deepmerge_1 || _deepmerge); - function clone(objectToClone) { - if (!objectToClone) - return objectToClone; - return deepmerge.all([objectToClone]); - } - const dontMerge = (destination, source) => source; - function deepMerge(...objectsToMerge) { - const objects = objectsToMerge.filter(Boolean); - return deepmerge.all(objects, { arrayMerge: dontMerge, isMergeableObject: isPlainObject }); - } - - function define(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - } - - function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for (var key in definition) prototype[key] = definition[key]; - return prototype; - } - - function Color() {} - - var darker = 0.7; - var brighter = 1 / darker; - - var reI = "\\s*([+-]?\\d+)\\s*", - reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", - reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", - reHex = /^#([0-9a-f]{3,8})$/, - reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), - reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), - reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), - reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), - reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), - reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); - - var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 - }; - - define(Color, color, { - copy(channels) { - return Object.assign(new this.constructor, this, channels); - }, - displayable() { - return this.rgb().displayable(); - }, - hex: color_formatHex, // Deprecated! Use color.formatHex. - formatHex: color_formatHex, - formatHex8: color_formatHex8, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb - }); - - function color_formatHex() { - return this.rgb().formatHex(); - } - - function color_formatHex8() { - return this.rgb().formatHex8(); - } - - function color_formatHsl() { - return hslConvert(this).formatHsl(); - } - - function color_formatRgb() { - return this.rgb().formatRgb(); - } - - function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 - : null) // invalid hex - : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) - : null; - } - - function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); - } - - function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); - } - - function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); - } - - function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); - } - - function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; - } - - define(Rgb, rgb, extend(Color, { - brighter(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb() { - return this; - }, - clamp() { - return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); - }, - displayable() { - return (-0.5 <= this.r && this.r < 255.5) - && (-0.5 <= this.g && this.g < 255.5) - && (-0.5 <= this.b && this.b < 255.5) - && (0 <= this.opacity && this.opacity <= 1); - }, - hex: rgb_formatHex, // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatHex8: rgb_formatHex8, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb - })); - - function rgb_formatHex() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; - } - - function rgb_formatHex8() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; - } - - function rgb_formatRgb() { - const a = clampa(this.opacity); - return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; - } - - function clampa(opacity) { - return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); - } - - function clampi(value) { - return Math.max(0, Math.min(255, Math.round(value) || 0)); - } - - function hex(value) { - value = clampi(value); - return (value < 16 ? "0" : "") + value.toString(16); - } - - function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); - } - - function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - return new Hsl(h, s, l, o.opacity); - } - - function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); - } - - function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } - - define(Hsl, hsl, extend(Color, { - brighter(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb( - hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), - hsl2rgb(h, m1, m2), - hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), - this.opacity - ); - }, - clamp() { - return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); - }, - displayable() { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) - && (0 <= this.l && this.l <= 1) - && (0 <= this.opacity && this.opacity <= 1); - }, - formatHsl() { - const a = clampa(this.opacity); - return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; - } - })); - - function clamph(value) { - value = (value || 0) % 360; - return value < 0 ? value + 360 : value; - } - - function clampt(value) { - return Math.max(0, Math.min(1, value || 0)); - } - - /* From FvD 13.37, CSS Color Module Level 3 */ - function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 - : h < 180 ? m2 - : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 - : m1) * 255; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function rgbToDeckglColor(c) { - return [c.r, c.g, c.b, c.opacity * 255]; - } - /** - * Compares 2 colors to see if they are equal. - * @param a RGBAColor to compare - * @param b RGBAColor to compare - * @returns True if colors are equal. - */ - function colorIsEqual(a, b) { - if (a.length !== b.length) - return false; - for (let i = 0; i < a.length; i++) { - if (a[i] !== b[i]) - return false; - } - return true; - } - /** - * Convert a CSS color string to a Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.). - * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. - */ - function colorFromString(cssColorSpecifier) { - if (cssColorSpecifier) { - const dc = color(cssColorSpecifier); - if (dc) { - const c = dc.rgb(); - return rgbToDeckglColor(c); - } - } - } - /** - * Convert a Deck.gl color to a CSS rgba() string. - * @param color A Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.) - */ - function colorToString(color) { - const c = [...color]; - if (c.length > 3) { - c[3] /= 255; - } - return `rgba(${c.join(',')})`; - } - function desaturate(color, value) { - const rgb$1 = rgb(color[0], color[1], color[2], color[3] / 255); - const hslColor = hsl(rgb$1); - hslColor.s = value; - const c = hslColor.rgb(); - return rgbToDeckglColor(c); - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ - - var util = /*#__PURE__*/Object.freeze({ - __proto__: null, - addDiv: addDiv, - addEl: addEl, - allTruthy: allTruthy, - clone: clone, - colorFromString: colorFromString, - colorIsEqual: colorIsEqual, - colorToString: colorToString, - concat: concat, - createElement: createElement, - deepMerge: deepMerge, - desaturate: desaturate, - getActiveElementInfo: getActiveElementInfo, - mount: mount, - outerSize: outerSize, - push: push, - setActiveElement: setActiveElement - }); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const minHeight = '100px'; - const minWidth = '100px'; - const defaultPresenterStyle = { - cssPrefix: 'vega-morphcharts-', - defaultCubeColor: [128, 128, 128, 255], - highlightColor: [0, 0, 0, 255], - }; - const defaultPresenterConfig = { - onCubeClick: (e, cube) => { }, - onCubeHover: (e, cube) => { }, - transitionDurations: { - position: 600, - stagger: 600, - view: 600, - }, - renderer: { - advanced: false, - advancedOptions: {}, - basicOptions: { - antialias: true, - }, - }, - }; - function createStage(view) { - const stage = { - view, - cubeData: [], - pathData: [], - axes: { - x: [], - y: [], - z: [], - }, - gridLines: [], - textData: [], - legend: { - rows: {}, - }, - facets: [], - }; - return stage; - } - const groupStrokeWidth = 1; - const lineZ = 0; - const defaultView = '2d'; - const minZ = 0.5; - const min3dDepth = 0.05; - const minPixelSize = 0.5; - const zAxisEncodeColor = [7, 7, 7, 255]; - const zAxisOutColor = [0, 0, 0, 255]; - function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { - if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { - stageItem.color = zAxisOutColor; - if (currAxis.axisRole !== 'z') { - const previousAxisRole = removeCurrentAxes(stage, currAxis); - if (previousAxisRole) { - currAxis.axisRole = 'z'; - stage.axes.z.push(currAxis); - } - } - } - } - function removeCurrentAxes(stage, currAxis) { - //find the current axis, remove it from parent - for (const axisRole in stage.axes) { - const axes = stage.axes[axisRole]; - for (let i = 0; i < axes.length; i++) { - if (axes[i] === currAxis) { - axes.splice(i, 1); - return axisRole; - } - } - } - } - - var defaults = /*#__PURE__*/Object.freeze({ - __proto__: null, - createStage: createStage, - defaultOnAxisItem: defaultOnAxisItem, - defaultPresenterConfig: defaultPresenterConfig, - defaultPresenterStyle: defaultPresenterStyle, - defaultView: defaultView, - groupStrokeWidth: groupStrokeWidth, - lineZ: lineZ, - min3dDepth: min3dDepth, - minHeight: minHeight, - minPixelSize: minPixelSize, - minWidth: minWidth, - minZ: minZ - }); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const vega = { - CanvasHandler: null, - inferType: null, - inferTypes: null, - loader: null, - parse: null, - read: null, - renderModule: null, - Renderer: null, - sceneVisit: null, - scheme: null, - truncate: null, - View: null, - }; - /** - * References to dependency libraries. - */ - const base = { - vega, - }; - /** - * Specify the dependency libraries to use for rendering. - * @param vega Vega library. - */ - function use(vega) { - base.vega = vega; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - /** - * HTML elements outputted by the presenter. - */ - exports.PresenterElement = void 0; - (function (PresenterElement) { - PresenterElement[PresenterElement["root"] = 0] = "root"; - PresenterElement[PresenterElement["gl"] = 1] = "gl"; - PresenterElement[PresenterElement["panel"] = 2] = "panel"; - PresenterElement[PresenterElement["legend"] = 3] = "legend"; - PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls"; - })(exports.PresenterElement || (exports.PresenterElement = {})); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const LegendView = (props) => { - const rows = []; - const addRow = (row, i) => { - const fn = symbolMap[row.symbol.shape]; - let jsx; - if (fn) { - jsx = fn(row.symbol); - } - else { - jsx = createElement("span", null, "x"); - //console.log(`need to render ${row.symbol.shape} symbol shape`); - } - rows.push({ - cells: [ - { className: 'symbol', content: jsx }, - { className: 'label', content: row.label, title: row.label }, - ], - }); - }; - const sorted = Object.keys(props.legend.rows).sort((a, b) => +a - +b); - sorted.forEach(i => addRow(props.legend.rows[i])); - if (sorted.length) { - return (createElement(Table, { rows: rows, rowClassName: "legend-row", onRowClick: (e, i) => props.onClick(e, props.legend, i) }, props.legend.title !== void 0 && createElement("tr", { onClick: e => props.onClick(e, props.legend, null) }, - createElement("th", { colSpan: 2 }, props.legend.title)))); - } - }; - const symbolMap = { - square: function (symbol) { - return (createElement("div", { style: { - height: `${symbol.bounds.y2 - symbol.bounds.y1}px`, - width: `${symbol.bounds.x2 - symbol.bounds.x1}px`, - backgroundColor: symbol.fill, - borderColor: symbol.fill, - } })); - }, - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function initializePanel(presenter) { - const rootDiv = (createElement("div", { className: className(exports.PresenterElement.root, presenter) }, - createElement("div", { className: className(exports.PresenterElement.gl, presenter), style: { minHeight, minWidth } }), - createElement("div", { className: className(exports.PresenterElement.panel, presenter) }, - createElement("div", { className: className(exports.PresenterElement.vegaControls, presenter) }), - createElement("div", { className: className(exports.PresenterElement.legend, presenter) })))); - mount(rootDiv, presenter.el); - } - function className(type, presenter) { - return `${presenter.style.cssPrefix}${exports.PresenterElement[type]}`; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function patchCubeArray(allocatedSize, empty, cubes) { - const patched = new Array(allocatedSize); - patched.fill(empty); - cubes.forEach(cube => patched[cube.ordinal] = cube); - return patched; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const legendMap = { - 'legend-title': function (legend, textItem) { - legend.title = textItem.text; - }, - 'legend-symbol': function (legend, symbol) { - const { bounds, fill, shape } = symbol; - //this object is safe for serialization - const legendRowSymbol = { bounds, fill, shape }; - const i = symbol.datum.index; - legend.rows[i] = legend.rows[i] || {}; - legend.rows[i].symbol = legendRowSymbol; - }, - 'legend-label': function (legend, label) { - const i = label.datum.index; - legend.rows[i] = legend.rows[i] || {}; - const row = legend.rows[i]; - row.label = label.text; - row.value = label.datum.value; - }, - }; - const markStager$5 = (options, stage, scene, x, y, groupType) => { - base.vega.sceneVisit(scene, function (item) { - const fn = legendMap[item.mark.role]; - if (fn) { - fn(stage.legend, item); - } - }); - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const markStager$4 = (options, stage, scene, x, y, groupType) => { - base.vega.sceneVisit(scene, function (item) { - const { bounds, height, url, width } = item; - let { x1, x2, y1, y2 } = bounds; - x1 += x; - x2 += x; - y1 += y; - y2 += y; - if (!stage.backgroundImages) { - stage.backgroundImages = []; - } - stage.backgroundImages.push({ bounds: { x1, x2, y1, y2 }, height, url, width }); - }); - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const markStager$3 = (options, stage, scene, x, y, groupType) => { - base.vega.sceneVisit(scene, function (item) { - const noZ = item.z === undefined; - const z = noZ ? 0 : (item.z || 0) + minZ; - const depth = (noZ ? 0 : (item.depth || 0)) + min3dDepth; - //change direction of y from SVG to GL - const ty = -1; - const ordinal = options.assignCubeOrdinal(item.datum); - if (ordinal > options.maxOrdinal) { - options.maxOrdinal = ordinal; - } - if (ordinal === undefined) ; - else { - const cube = { - ordinal, - size: [item.width, item.height, depth], - position: [x + ((+item.x) || 0), ty * (y + ((+item.y) || 0)) - (+item.height), z], - color: colorFromString(item.fill) || options.defaultCubeColor || [128, 128, 128, 128], - }; - cube.color[3] = item.opacity === undefined ? 255 : 255 * item.opacity; - stage.cubeData.push(cube); - } - }); - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const markStager$2 = (options, stage, scene, x, y, groupType) => { - base.vega.sceneVisit(scene, function (item) { - const x1 = item.x || 0; - const y1 = item.y || 0; - const x2 = item.x2 != null ? item.x2 : x1; - const y2 = item.y2 != null ? item.y2 : y1; - const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth); - const { currAxis } = options; - if (options.modifyAxis) { - options.modifyAxis(item, lineItem, stage, currAxis); - } - if (item.mark.role === 'axis-tick') { - currAxis.ticks.push(lineItem); - } - else if (item.mark.role === 'axis-domain') { - currAxis.domain = lineItem; - } - else { - stage.gridLines.push(lineItem); - } - }); - }; - function styledLine(x1, y1, x2, y2, stroke, strokeWidth) { - const line = { - sourcePosition: [x1, -y1, lineZ], //-1 = change direction of y from SVG to GL - targetPosition: [x2, -y2, lineZ], - color: colorFromString(stroke), - strokeWidth: strokeWidth, - }; - return line; - } - function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) { - const lines = [ - styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), - styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), - styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), - styledLine(gx, gy + height, gx, gy, stroke, strokeWidth), - ]; - if (diagonals) { - lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth)); - lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth)); - } - return lines; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - //change direction of y from SVG to GL - const ty = -1; - const markStager$1 = (options, stage, scene, x, y, groupType) => { - const g = Object.assign({ opacity: 1, strokeOpacity: 1, strokeWidth: 1 }, scene.items[0]); - const path = { - strokeWidth: g.strokeWidth, - strokeColor: colorFromString(g.stroke), - positions: scene.items.map((it) => [ - it.x, - ty * it.y, - it.z || 0, - ]), - }; - path.strokeColor[3] *= g.strokeOpacity; - path.strokeColor[3] *= g.opacity; - stage.pathData.push(path); - }; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - // import { AlignmentBaseline, TextAnchor } from '@deck.gl/layers/text-layer/text-layer'; - const markStager = (options, stage, scene, x, y, groupType) => { - //change direction of y from SVG to GL - const ty = -1; - base.vega.sceneVisit(scene, function (item) { - if (!item.text) - return; - const size = item.fontSize; - //const alignmentBaseline = convertBaseline(item.baseline); - //const yOffset = alignmentBaseline === 'top' ? item.fontSize / 2 : 0; //fixup to get tick text correct - const yOffset = 0; - const textItem = { - color: colorFromString(item.fill), - text: item.limit === undefined ? item.text : base.vega.truncate(item.text, item.limit, 'right', item.ellipsis || '...'), //use dots instead of unicode ellipsis for - position: [x + (item.x || 0), ty * (y + (item.y || 0) + yOffset), 0], - size, - angle: convertAngle(item.angle), - //textAnchor: convertAlignment(item.align), - //alignmentBaseline, - metaData: item.metaData, - }; - const { currAxis } = options; - if (options.modifyAxis) { - options.modifyAxis(item, textItem, stage, currAxis); - } - if (item.mark.role === 'axis-label') { - const tickText = textItem; - tickText.value = item.datum.value; - currAxis.tickText.push(tickText); - } - else if (item.mark.role === 'axis-title') { - currAxis.title = textItem; - } - else { - stage.textData.push(textItem); - } - }); - }; - function convertAngle(vegaTextAngle) { - if (vegaTextAngle && !isNaN(vegaTextAngle)) { - return 360 - vegaTextAngle; - } - return 0; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - var GroupType; - (function (GroupType) { - GroupType[GroupType["none"] = 0] = "none"; - GroupType[GroupType["legend"] = 1] = "legend"; - GroupType[GroupType["xAxis"] = 2] = "xAxis"; - GroupType[GroupType["yAxis"] = 3] = "yAxis"; - GroupType[GroupType["zAxis"] = 4] = "zAxis"; - })(GroupType || (GroupType = {})); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function getAxisGroupType(item, options) { - const axisItem = item; - const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; - if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== undefined) { - return GroupType.zAxis; - } - switch (axisItem.orient) { - case 'bottom': - case 'top': - return GroupType.xAxis; - case 'left': - case 'right': - return GroupType.yAxis; - } - } - function convertGroupRole(item, options) { - if (item.mark.role === 'legend') - return GroupType.legend; - if (item.mark.role === 'axis') { - const groupType = getAxisGroupType(item, options); - if (groupType !== undefined) { - return groupType; - } - } - } - const group = (options, stage, scene, x, y, groupType) => { - base.vega.sceneVisit(scene, function (g) { - const gx = g.x || 0, gy = g.y || 0; - if (g.context && g.context.background && !stage.backgroundColor) { - stage.backgroundColor = colorFromString(g.context.background); - } - if (g.stroke) { - const facetRect = { - datum: g.datum, - lines: box(gx + x, gy + y, g.height, g.width, g.stroke, groupStrokeWidth), - }; - stage.facets.push(facetRect); - } - groupType = convertGroupRole(g, options) || groupType; - setCurrentAxis(options, stage, groupType); - // draw group contents - base.vega.sceneVisit(g, function (item) { - mainStager(options, stage, item, gx + x, gy + y, groupType); - }); - }); - }; - function setCurrentAxis(options, stage, groupType) { - let axisRole; - switch (groupType) { - case GroupType.xAxis: - axisRole = 'x'; - break; - case GroupType.yAxis: - axisRole = 'y'; - break; - case GroupType.zAxis: - axisRole = 'z'; - break; - default: - return; - } - options.currAxis = { - axisRole, - domain: null, - tickText: [], - ticks: [], - }; - stage.axes[axisRole].push(options.currAxis); - } - const markStagers = { - group, - legend: markStager$5, - image: markStager$4, - rect: markStager$3, - rule: markStager$2, - line: markStager$1, - text: markStager, - }; - const mainStager = (options, stage, scene, x, y, groupType) => { - if (scene.marktype !== 'group' && groupType === GroupType.legend) { - markStager$5(options, stage, scene); - } - else { - const markStager = markStagers[scene.marktype]; - if (markStager) { - markStager(options, stage, scene, x, y, groupType); - } - } - }; - function sceneToStage(options, stage, scene) { - mainStager(options, stage, scene, 0, 0, null); - sortAxis(stage.axes.x, 0); - sortAxis(stage.axes.y, 1); - sortAxis(stage.axes.z, 1); - } - function sortAxis(axes, dim) { - axes.forEach(axis => { - if (axis.domain) - orderDomain(axis.domain, dim); - axis.ticks.sort((a, b) => a.sourcePosition[dim] - b.sourcePosition[dim]); - axis.tickText.sort((a, b) => a.position[dim] - b.position[dim]); - }); - } - function orderDomain(domain, dim) { - if (domain.sourcePosition[dim] > domain.targetPosition[dim]) { - const temp = domain.targetPosition; - domain.targetPosition = domain.sourcePosition; - domain.sourcePosition = temp; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function outerBounds(b1, b2) { - if (!b1 && !b2) - return; - if (!b1) - return b2; - if (!b2) - return b1; - const minProps = [ - 'minBoundsX', - 'minBoundsY', - 'minBoundsZ', - ]; - const maxProps = [ - 'maxBoundsX', - 'maxBoundsY', - 'maxBoundsZ', - ]; - const result = {}; - minProps.forEach(p => result[p] = notNull(Math.min, b1[p], b2[p])); - maxProps.forEach(p => result[p] = notNull(Math.max, b1[p], b2[p])); - return result; - } - function notNull(fn, v1, v2) { - if (v1 == null && v2 == null) - return null; - if (v1 == null) - return v2; - if (v2 == null) - return v1; - return fn(v1, v2); - } - function increment(b, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { - return outerBounds(b, { - minBoundsX, - minBoundsY, - minBoundsZ, - maxBoundsX, - maxBoundsY, - maxBoundsZ, - }); - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const createAxesLayer = (props) => { - const { config, height, ref, stage } = props; - const { core } = ref; - const { renderer } = core; - const { x, y, z } = stage.axes; - const xyz = [...x, ...y, ...z]; - renderer.currentAxes = []; - if (!xyz.length) { - renderer.axesVisibility = AxesVisibility.none; - return; - } - renderer.axesVisibility = AxesVisibility.current; - const correlation = new AxesCorrelation(stage, 3); - const { axesSets, labels } = correlation; - const grid = correlation.getGrid(); - if (grid.byColumn[0]) { - grid.byColumn[0].forEach(row => { row.axesSet.showFacetTitleY = true; }); - grid.byRow[0].forEach(col => { col.axesSet.showFacetTitleX = true; }); - } - if (grid.rows > 1) { - const { byRow } = grid; - byRow[0].forEach(({ axesSet }, col) => { - if (!axesSet.y) { - if (byRow[1][col].axesSet) { - //move x up - byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; - byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; - delete axesSet.x; - } - } - }); - } - let bounds; - const allAxesSetBounds = []; - let anyZ = false; - for (let i = 0; i < axesSets.length; i++) { - if (axesSets[i].z) { - anyZ = true; - break; - } - } - const is3d = stage.view === '3d' && anyZ; - axesSets.forEach(axesSet => { - if (!axesSet.x && !axesSet.y) - return; - const axesSetBounds = { - axesSet, - maxBoundsX: null, - maxBoundsY: null, - maxBoundsZ: null, - minBoundsX: null, - minBoundsY: null, - minBoundsZ: null, - }; - if (is3d) { - const zBounds = getDomainBounds(1, axesSet.z); - axesSetBounds.minBoundsZ = -zBounds.maxBounds; - axesSetBounds.maxBoundsZ = -zBounds.minBounds; - } - const yBounds = getDomainBounds(1, axesSet.y); - axesSetBounds.minBoundsY = yBounds.minBounds; - axesSetBounds.maxBoundsY = yBounds.maxBounds; - axesSetBounds.y = yBounds.minBounds; - axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; - const xBounds = getDomainBounds(0, axesSet.x); - axesSetBounds.minBoundsX = xBounds.minBounds; - axesSetBounds.maxBoundsX = xBounds.maxBounds; - axesSetBounds.x = xBounds.minBounds; - axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; - allAxesSetBounds.push(axesSetBounds); - bounds = outerBounds(bounds, axesSetBounds); - }); - const facetLabelX = labels.filter(label => label.axisRole === 'x')[0]; - const facetLabelY = labels.filter(label => label.axisRole === 'y')[0]; - core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { - const axesSet = axesSets[axes]; - let a; - let f; - switch (axis) { - case 0: { - a = axesSet.x; - f = facetLabelX; - break; - } - case 1: { - a = axesSet.y; - f = facetLabelY; - break; - } - case 2: { - a = axesSet.z; - break; - } - } - if (a) { - config.onTextClick(manipulator.event, a.title || f.title); - } - }; - allAxesSetBounds.forEach(axesSetBounds => { - const { axesSet } = axesSetBounds; - if (!axesSet.x && !axesSet.y) - return; - const cartesian = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); - cartesian.isDivisionPickingEnabled = [false, false, false]; - cartesian.arePickDivisionsVisible = [false, false, false]; - cartesian.isLabelPickingEnabled = [false, false, false]; - cartesian.isTitlePickingEnabled = [false, false, false]; - cartesian.isGridPickingEnabled = false; - cartesian.isHeadingPickingEnabled = [false, false, false]; - createAxes(cartesian, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height, props, axesSet.showFacetTitleX && facetLabelX); - createAxes(cartesian, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height, props, axesSet.showFacetTitleY && facetLabelY); - if (is3d) { - createAxes(cartesian, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height, props); - } - configCartesianAxes(is3d, bounds, cartesian); - const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY, } = bounds; - const w = maxBoundsX - minBoundsX; - const h = maxBoundsY - minBoundsY; - cartesian.scalingX = axesSetBounds.w / w; - cartesian.scalingY = axesSetBounds.h / h; - cartesian.offsetX = ((axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w) - 0.5; - cartesian.offsetY = ((axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h) - 0.5; - const aspect = (h / w); - if (aspect > 1) { - cartesian.offsetX /= aspect; - } - else { - cartesian.offsetY *= aspect; - } - const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian) : renderer.createCartesian2dAxesVisual(cartesian); - renderer.currentAxes.push(axes); - props.config.onAxesComplete && props.config.onAxesComplete(cartesian); - }); - return { bounds }; - }; - const nullDomain = { - sourcePosition: [0, 0, 0], - targetPosition: [0, 0, 0], - }; - class AxesCorrelation { - constructor(stage, dimensions) { - this.dimensions = dimensions; - const { x, y, z } = stage.axes; - this.axesSets = []; - this.labels = []; - [x, y, z].forEach(axes => { - axes.forEach(axis => { - if (this.axesSets.length === 0) { - this.initialize(axis); - } - else { - this.correlate(axis); - } - }); - }); - } - getGrid() { - const mapCols = {}; - const mapRows = {}; - this.axesSets.forEach(axesSet => { - var _a; - const domain = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; - if (!domain) - return; - const col = domain.sourcePosition[0].toString(); - const row = domain.sourcePosition[1].toString(); - if (!mapCols[col]) { - mapCols[col] = {}; - } - mapCols[col][row] = axesSet; - mapRows[row] = null; - }); - const colKeys = Object.keys(mapCols).sort((a, b) => +a - +b); - const rowKeys = Object.keys(mapRows).sort((a, b) => +a - +b); - return { - cols: colKeys.length, - rows: rowKeys.length, - byColumn: colKeys.map(colKey => rowKeys.map(rowKey => { return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; })), - byRow: rowKeys.map(rowKey => colKeys.map(colKey => { return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; })), - }; - } - initialize(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - const axesSet = {}; - axesSet[axis.axisRole] = axis; - this.axesSets.push(axesSet); - } - correlate(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - for (let i = 0; i < this.axesSets.length; i++) { - const axesSet = this.axesSets[i]; - for (const axisRole in axesSet) { - const test = axesSet[axisRole]; - if (this.matchDomains(axis.domain, test.domain)) { - //prefer the axes with titles - if (!axesSet[axis.axisRole] || (!axesSet[axis.axisRole].tickText.length && axis.tickText.length)) { - axesSet[axis.axisRole] = axis; - } - return; - } - } - } - this.initialize(axis); - } - matchDomains(a, b) { - if (this.matchPoint(a.sourcePosition, b.sourcePosition)) - return true; - if (this.matchPoint(a.sourcePosition, b.targetPosition)) - return true; - if (this.matchPoint(a.targetPosition, b.targetPosition)) - return true; - if (this.matchPoint(a.targetPosition, b.sourcePosition)) - return true; - return false; - } - matchPoint(a, b) { - for (let i = 0; i < this.dimensions; i++) { - if (a[i] !== b[i]) - return false; - } - return true; - } - } - function createAxes(cartesian, dim2d, dim3d, axis, orientation, height, props, facetLabel) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain, dim2d, height); - if (axis.axisRole === 'z') { - tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); - textPos.forEach((t, i) => textPos[i] = 1 - t); - tickText.reverse(); - tickPositions.reverse(); - textPos.reverse(); - } - cartesian.setTickPositions(dim3d, tickPositions); - cartesian.zero[dim3d] = 0; //TODO get any "zero" gridline position from vega - cartesian.setLabelPositions(dim3d, textPos); - cartesian.setLabels(dim3d, tickText); - cartesian.setLabelSizes(dim3d, textSize); - const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); - if (title === null || title === void 0 ? void 0 : title.text) { - cartesian.setTitle(dim3d, title.text); - cartesian.setTitleSize(dim3d, title.size / height); - } - cartesian.setLabelOrientation(dim3d, orientation); - props.config.onAxisConfig && props.config.onAxisConfig(cartesian, dim3d, axis); - return { - tickText, - }; - } - function configCartesianAxes(is3d, bounds, cartesian) { - if (is3d) { - cartesian.isEdgeVisible[Edge3D.topBack] = false; - } - cartesian.isEdgeVisible[Edge3D.backRight] = false; - cartesian.isEdgeVisible[Edge3D.bottomRight] = false; - cartesian.isEdgeVisible[Edge3D.frontRight] = false; - cartesian.isEdgeVisible[Edge3D.topFront] = false; - cartesian.isEdgeVisible[Edge3D.topRight] = false; - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ, } = bounds; - cartesian.minBoundsX = minBoundsX; - cartesian.maxBoundsX = maxBoundsX; - cartesian.minBoundsY = minBoundsY; - cartesian.maxBoundsY = maxBoundsY; - if (is3d) { - cartesian.minBoundsZ = minBoundsZ; - cartesian.maxBoundsZ = maxBoundsZ; - } - } - function getDomainBounds(dim2d, axis) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const minBounds = domain.sourcePosition[dim2d]; - const maxBounds = domain.targetPosition[dim2d]; - return { - maxBounds, - minBounds, - }; - } - function convertAxis(axis, domain, dim, height) { - const start = domain.sourcePosition[dim]; - const span = domain.targetPosition[dim] - start; - const tickPositions = axis - ? - axis.ticks.map(t => (t.sourcePosition[dim] - start) / span) - : - []; - const tickText = axis ? - axis.tickText.map(t => t.text) - : - []; - const textPos = axis ? - axis.tickText.map(t => (t.position[dim] - start) / span) - : - []; - const textSize = axis ? - axis.tickText.map(t => t.size / height) - : - []; - if (tickPositions.length) { - if (tickPositions[0] !== 0) { - tickPositions[0] = 0; - } - if (tickPositions[tickPositions.length - 1] !== 1) { - tickPositions[tickPositions.length - 1] = 1; - } - } - return { - tickPositions, - tickText, - textPos, - textSize, - }; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class ColorMap { - constructor(quant = 5) { - this.quant = quant; - this.colorMap = {}; - this.colorArray = []; - } - getColorKey(rgbaColor) { - const color = rgbaColor.slice(0, 3).map(e => Math.floor(e / this.quant) * this.quant); - color[3] = rgbaColor[3]; //retain alpha - return JSON.stringify(color); - } - registerColor(rgbaColor) { - const colorKey = this.getColorKey(rgbaColor); - if (!this.colorMap[colorKey]) { - this.colorMap[colorKey] = { - index: this.colorArray.length, - rgbaColor, - }; - this.colorArray.push(rgbaColor); - } - return this.colorMap[colorKey].index; - } - getPalette() { - return { - palette: new Uint8Array(this.colorArray.flat()), - maxColor: this.colorArray.length - 1, - }; - } - } - function convert$3(newColor) { - const c = colorFromString(newColor).slice(0, 3); - return c.map(v => v / 255); - } - function colorConfig(ref, colors) { - if (!colors) - return; - const { config } = ref.core; - config.activeColor = convert$3(colors.activeItemColor); - config.backgroundColor = new Float32Array(convert$3(colors.backgroundColor)); - config.textColor = convert$3(colors.textColor); - config.textBorderColor = convert$3(colors.textBorderColor); - config.axesTextColor = convert$3(colors.axesTextLabelColor); - config.axesGridBackgroundColor = convert$3(colors.axesGridBackgroundColor); - config.axesGridHighlightColor = convert$3(colors.axesGridHighlightColor); - config.axesGridMinorColor = convert$3(colors.axesGridMinorColor); - config.axesGridMajorColor = convert$3(colors.axesGridMajorColor); - config.axesGridZeroColor = convert$3(colors.axesGridZeroColor); - //TODO fix this - hack to reset the background color - ref.core.renderer['_theme'] = null; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const key$1 = 'cube'; - const createCubeLayer = (props) => { - const { ref, stage } = props; - const { core } = ref; - const scatter = new Scatter(core); - const { ids, colors, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds, maxColor, palette, } = convert$2(stage); - if (!ids.length) - return; - const { renderer } = core; - let cubeTransitionBuffer = renderer.transitionBuffers.find(t => t.key === key$1); - if (!cubeTransitionBuffer) { - cubeTransitionBuffer = renderer.createTransitionBuffer(ids); - cubeTransitionBuffer.key = key$1; - renderer.transitionBuffers.push(cubeTransitionBuffer); - } - else { - cubeTransitionBuffer.swap(); - } - scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { - positionsX, - positionsY, - positionsZ, - }); - const layer = { - positionsX, - positionsY, - positionsZ, - update: (newBounds, selected, stagger) => { - const { colors, maxColor, minColor, palette } = layer.unitColorMap; - // reference off of core.renderer to get the actual buffer - const currCubeTransitionBuffer = core.renderer.transitionBuffers.find(t => t.key === key$1); - currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; - currCubeTransitionBuffer.currentPalette.colors = palette; - let options = Object.assign({ selected, - colors, - minColor, - maxColor, - sizesX, - sizesY, - sizesZ }, newBounds); - if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { - const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; - options = Object.assign(Object.assign({}, options), { maxStaggerOrder, - minStaggerOrder, - staggerOrders }); - } - scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); - }, - bounds, - unitColorMap: { - colors, - ids, - minColor: 0, - maxColor, - palette, - }, - }; - return layer; - }; - function convert$2(stage) { - const { cubeData } = stage; - const { length } = cubeData; - const ids = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizesX = new Float64Array(length); - const sizesY = new Float64Array(length); - const sizesZ = new Float64Array(length); - let bounds; - const colorMap = new ColorMap(); - cubeData.forEach((cube, i) => { - ids.push(i); - if (cube.isEmpty) { - positionsX[i] = 0; - positionsY[i] = 0; - positionsZ[i] = 0; - sizesX[i] = 0; - sizesY[i] = 0; - sizesZ[i] = 0; - colors[i] = 0; - } - else { - //ids.push(cube.ordinal); - positionsX[i] = cube.position[0] + cube.size[0] * 0.5; - positionsY[i] = cube.position[1] + cube.size[1] * 0.5; - positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; - sizesX[i] = cube.size[0]; - sizesY[i] = cube.size[1]; - sizesZ[i] = cube.size[2]; - bounds = increment(bounds, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); - colors[i] = colorMap.registerColor(cube.color); - } - }); - const { palette, maxColor } = colorMap.getPalette(); - return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizesX, - sizesY, - sizesZ, - bounds, - maxColor, - palette, - }; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const key = 'line'; - const createLineLayer = (props) => { - const { height, ref, stage, width } = props; - const { core } = ref; - const lines = new Line(core); - const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette, } = convert$1(stage, height); - if (!ids.length) - return; - const { renderer } = core; - let lineTransitionBuffer = renderer.transitionBuffers.find(t => t.key === key); - if (!lineTransitionBuffer) { - lineTransitionBuffer = renderer.createTransitionBuffer(ids); - lineTransitionBuffer.key = key; - renderer.transitionBuffers.push(lineTransitionBuffer); - } - else { - lineTransitionBuffer.swap(); - } - lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { - positionsX, - positionsY, - positionsZ, - lineSizes, - sizeScaling: 1, - }); - let options = { - lineColors, - lineMinColor: 0, - lineMaxColor, - }; - // Unit type - lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; - lineTransitionBuffer.currentPalette.colors = palette; - return { - update: newBounds => { - options = Object.assign(Object.assign({}, options), newBounds); - // reference off of core.renderer to get the actual buffer - const currLineTransitionBuffer = core.renderer.transitionBuffers.find(t => t.key === key); - lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); - }, - bounds, - unitColorMap: { - ids, - colors: lineColors, - minColor: 0, - maxColor: lineMaxColor, - palette, - }, - }; - }; - function convert$1(stage, height, width) { - const { pathData } = stage; - const positions = []; - const lines = []; - const colorMap = new ColorMap(); - pathData.forEach(path => { - const color = colorMap.registerColor(path.strokeColor); - let from = positions.length; - positions.push(path.positions[0]); - for (let i = 1; i < path.positions.length; i++) { - const to = positions.length; - positions.push(path.positions[i]); - lines.push({ - id: lines.length, - from, - to, - color, - size: path.strokeWidth, - }); - from = to; - } - }); - const ids = new Uint32Array(lines.length); - const fromIds = new Uint32Array(lines.length); - const toIds = new Uint32Array(lines.length); - const lineColors = new Float64Array(lines.length); - const lineSizes = new Float64Array(lines.length); - lines.forEach((line, i) => { - ids[i] = i; - fromIds[i] = line.from; - toIds[i] = line.to; - lineColors[i] = line.color; - lineSizes[i] = line.size; - }); - const positionsX = new Float64Array(positions.length); - const positionsY = new Float64Array(positions.length); - const positionsZ = new Float64Array(positions.length); - let bounds; - positions.forEach((p, i) => { - positionsX[i] = p[0]; - positionsY[i] = p[1] + height; - positionsZ[i] = p[2]; - bounds = increment(bounds, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); - }); - const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); - return { - ids, - fromIds, - toIds, - lineColors, - lineSizes, - bounds, - positionsX, - positionsY, - positionsZ, - lineMaxColor, - palette, - }; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const createTextLayer = (props) => { - const { ref, stage } = props; - const { core } = ref; - const { positionsX, positionsY, positionsZ, sizes, bounds, maxGlyphs, text, } = convert(stage); - if (text.length === 0) { - core.renderer.labelSets = []; - return; - } - const options = { - text, - maxGlyphs, - scales: sizes, - }; - const labelSet = new LabelSet(core, options); - labelSet.positionsX = positionsX; - labelSet.positionsY = positionsY; - labelSet.positionsZ = positionsZ; - labelSet.horizontalAlignment = HorizontalAlignment.center; - labelSet.verticalAlignment = VerticalAlignment.center; - const layer = { - update: bounds => { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ, } = bounds; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - }, - bounds, - }; - const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); - core.renderer.labelSets = [labelSetVisual]; - return layer; - }; - function convert(stage) { - const { textData } = stage; - const { length } = textData; - const ids = []; - const text = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizes = new Float64Array(length); - let bounds; - let maxGlyphs = 0; - const colorMap = new ColorMap(); - textData.forEach((t, i) => { - ids.push(i); - text.push(t.text); - maxGlyphs += t.text.length; - positionsX[i] = t.position[0]; - positionsY[i] = t.position[1]; - positionsZ[i] = t.position[2]; - sizes[i] = 1.5 * t.size; //scale similar to axes - bounds = increment(bounds, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); - colors[i] = colorMap.registerColor(t.color); - }); - const { palette, maxColor } = colorMap.getPalette(); - return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizes, - bounds, - maxColor, - maxGlyphs, - palette, - text, - }; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function getImageData(url) { - return new Promise((resolve, reject) => { - const imageElement = document.createElement('img'); - imageElement.onload = () => { - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - const { height, width } = imageElement; - canvas.width = width; - canvas.height = height; - ctx.drawImage(imageElement, 0, 0); - resolve(ctx.getImageData(0, 0, width, height)); - }; - imageElement.src = url; - }); - } - function createImageQuad(core, imageData, bounds, position, width, height) { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - const imageOptions = { - imageData, - position, - height, - width, - minBoundsX, - maxBoundsX, - minBoundsZ, - maxBoundsZ, - minBoundsY, - maxBoundsY, - }; - return new ImageQuad(core, imageOptions); - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function createCameraDefaults() { - const qModelRotation2d = create$1(); - const qModelRotation3d = Constants.QUAT_ROTATEX_MINUS_90; - const qCameraRotation2d = create$1(); - const qCameraRotation3d = create$1(); - const qAngle = create$1(); - const vCameraPosition = create$3(); - // Altitude (pitch around local right axis) - setAxisAngle(qCameraRotation3d, Constants.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); - // Azimuth (yaw around global up axis) - setAxisAngle(qAngle, Constants.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); - multiply(qCameraRotation3d, qCameraRotation3d, qAngle); - return { - qModelRotation2d, - qModelRotation3d, - qCameraRotation2d, - qCameraRotation3d, - vCameraPosition, - }; - } - const cameraDefaults = createCameraDefaults(); - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; - function applyCameraCallbacks(ref, lastPresenterConfig, lastView, transistion2dOnly) { - const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref; - ref.reset = () => { - core.reset(true); - if (lastView === '3d') { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = qCameraRotation3d; - cameraTransitioner.vPosition.to = vCameraPosition; - } - else { - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = qCameraRotation2d; - cameraTransitioner.vPosition.to = vCameraPosition; - } - slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); - core.setModelRotation(modelTransitioner.qRotation.current, true); - core.camera.setOrbit(cameraTransitioner.qRotation.to, true); - core.camera.setPosition(cameraTransitioner.vPosition.to, true); - }; - const cam = (t) => { - slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); - lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); - core.camera.setOrbit(cameraTransitioner.qRotation.current, false); - core.camera.setPosition(cameraTransitioner.vPosition.current, false); - // disable picking during transitions, as the performance degradation could reduce the framerate - core.inputManager.isPickingEnabled = false; - }; - core.updateCallback = (elapsedTime) => { - const { transitionDurations } = lastPresenterConfig; - if (positionTransitioner.isTransitioning) { - const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); - core.renderer.transitionTime = t; - setTransitionTimeAxesVisibility(transistion2dOnly, core); - } - else { - core.inputManager.isPickingEnabled = true; - } - if (modelTransitioner.isTransitioning) { - const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); - if (modelTransitioner.shouldTransition) { - slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); - core.setModelRotation(modelTransitioner.qRotation.current, false); - } - cam(tm); - } - if (cameraTransitioner.isTransitioning) { - const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); - cam(t); - } - }; - } - function setTransitionTimeAxesVisibility(transistion2dOnly, core) { - const t = core.renderer.transitionTime; - if (transistion2dOnly) { - if (t < 0.5) { - core.renderer.axesVisibility = AxesVisibility.previous; - } - else { - core.renderer.axesVisibility = AxesVisibility.current; - } - } - else { - if (t <= 0.01) { - core.renderer.axesVisibility = AxesVisibility.previous; - } - else if (t >= 0.99) { - core.renderer.axesVisibility = AxesVisibility.current; - } - else { - core.renderer.axesVisibility = AxesVisibility.none; - } - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function morphChartsRender(ref, prevStage, stage, height, width, preStage, colors, config) { - const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; - const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref; - let transistion2dOnly = false; - let cameraTo; - let holdCamera; - if (config.camera === 'hold') { - holdCamera = true; - } - else { - cameraTo = config.camera; - } - if (prevStage && (prevStage.view !== stage.view)) { - modelTransitioner.shouldTransition = !holdCamera; - if (stage.view === '2d') { - modelTransitioner.qRotation.from = qModelRotation3d; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - else { - modelTransitioner.qRotation.from = qModelRotation2d; - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - } - else { - modelTransitioner.shouldTransition = false; - if (stage.view === '2d') { - transistion2dOnly = true; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - else { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - } - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - if (!prevStage) { - core.setModelRotation(modelTransitioner.qRotation.to, false); - core.camera.setOrbit(cameraTransitioner.qRotation.to, false); - core.camera.setPosition(cameraTransitioner.vPosition.to, false); - } - else if (!holdCamera) { - cameraTransitioner.begin(); - } - positionTransitioner.begin(); - if (modelTransitioner.shouldTransition) { - modelTransitioner.begin(); - } - const props = { ref, stage, height, width, config }; - const cubeLayer = createCubeLayer(props); - const lineLayer = createLineLayer(props); - const textLayer = createTextLayer(props); - const { backgroundImages } = stage; - let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); - backgroundImages === null || backgroundImages === void 0 ? void 0 : backgroundImages.forEach(backgroundImage => { - contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); - }); - props.bounds = contentBounds; - core.renderer.previousAxes = core.renderer.currentAxes; - const axesLayer = createAxesLayer(props); - core.config.transitionStaggering = config.transitionDurations.stagger; - core.config.transitionDuration = config.transitionDurations.position; - let bounds; - if (axesLayer && axesLayer.bounds) { - bounds = axesLayer.bounds; - } - else { - bounds = contentBounds; - } - ref.setMorphChartsRendererOptions(config.renderer); - if (preStage) { - preStage(stage, cubeLayer); - } - //add images - core.renderer.images = []; - if (backgroundImages) { - const addImage = (imageBounds, imageData) => { - const imageWidth = imageBounds.maxBoundsX - imageBounds.minBoundsX; - const imageHeight = imageBounds.maxBoundsY - imageBounds.minBoundsY; - const position = [imageBounds.minBoundsX + imageWidth / 2, imageBounds.minBoundsY + imageHeight / 2, 0]; - const imageQuad = createImageQuad(core, imageData, contentBounds, position, imageWidth, imageHeight); - const imageVisual = core.renderer.createImageVisual(imageQuad); - core.renderer.images.push(imageVisual); - }; - const imageDataCache = {}; - backgroundImages.forEach(backgroundImage => { - const imageBounds = convertBounds(backgroundImage.bounds); - const imageData = imageDataCache[backgroundImage.url]; - if (imageData) { - addImage(imageBounds, imageData); - } - else { - getImageData(backgroundImage.url).then(imageData => { - imageDataCache[backgroundImage.url] = imageData; - addImage(imageBounds, imageData); - }); - } - }); - } - //Now call update on each layout - layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds, ref.layerStagger); - applyCameraCallbacks(ref, config, stage.view, transistion2dOnly); - core.renderer.transitionTime = 0; // Set renderer transition time for this render pass to prevent rendering target buffer for single frame - colorConfig(ref, colors); - return { - bounds, - getCubeLayer: () => cubeLayer, - update: layerSelection => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, ref.layerStagger), - activate: id => core.renderer.transitionBuffers[0].activeId = id, - moveCamera: (camera) => { - if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - cameraTransitioner.move(camera.position, camera.rotation); - } - }, - setTransitionTimeAxesVisibility: () => { - setTransitionTimeAxesVisibility(transistion2dOnly, core); - }, - }; - } - function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, layerStagger) { - const layerItems = [ - { - layer: cubeLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes, - }, - { - layer: lineLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines, - }, - { - layer: textLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts, - }, - ]; - layerItems.forEach(layerItem => { var _a; return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds, layerItem.selection, layerItem.stagger); }); - } - function convertBounds(bounds) { - if (!bounds) - return; - return { - minBoundsX: bounds.x1, - maxBoundsX: bounds.x2, - minBoundsY: -bounds.y2, - maxBoundsY: -bounds.y1, - minBoundsZ: minZ, - maxBoundsZ: minZ, - }; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function shouldChangeRenderer(prev, next) { - var _a, _b; - if (!prev || !next) - return true; - if (prev.advanced !== next.advanced) - return true; - if (!prev.advanced) { - return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); - } - } - function getRenderer(mcRendererOptions, core) { - const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; - const r = advanced ? - new Main() - : - new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); - core.renderer = r; - setRendererOptions(r, mcRendererOptions); - return r; - } - function setRendererOptions(renderer, mcRendererOptions) { - const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; - if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) { - for (const key in o) { - renderer.config[key] = o[key]; - } - } - } - function rendererEnabled(advanced) { - const r = advanced ? - new Main() - : - new Main$1(); - return r.isSupported; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const rightButton = 2; - function listenCanvasEvents(core, options) { - const { container, pickGridCallback } = options; - const { inputManager } = core; - if (options.onLasso) { - inputManager.pickLassoCallback = result => { - options.onLasso(result.ids[0], result.manipulator.event); - }; - } - inputManager.singleTouchAction = manipulator => { - if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) { - return SingleTouchAction.rotate; - } - else if (manipulator.altKey) { - return SingleTouchAction.lasso; - } - else { - return SingleTouchAction.translate; - } - }; - inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { - clearClickTimeout(); - const { altKey, button, shiftKey } = manipulator; - const me = { altKey, shiftKey, button }; - const e = me; - pickGridCallback([divisionX, divisionY, divisionZ], e); - }; - const canvas = container.getElementsByTagName('canvas')[0]; - let pickedId; - const hover = (e) => { - if (core.renderer.pickedId !== pickedId) { - pickedId = core.renderer.pickedId; - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeHover(e, ordinal); - } - }; - canvas.addEventListener('mousemove', (e) => { - clearClickTimeout(); - if (mousedown) { - options.onCubeHover(e, null); - } - hover(e); - }); - canvas.addEventListener('mouseout', hover); - canvas.addEventListener('mouseover', hover); - let mousedown; - canvas.addEventListener('mousedown', () => { - mousedown = true; - }); - canvas.addEventListener('mouseup', (e) => { - mousedown = false; - }); - let canvasClickTimeout; - const clearClickTimeout = () => { - clearTimeout(canvasClickTimeout); - canvasClickTimeout = null; - }; - canvas.addEventListener('click', (e) => { - canvasClickTimeout = setTimeout(() => { - options.onCanvasClick(e); - }, 50); - }); - inputManager.pickItemCallback = ({ manipulator }) => { - clearClickTimeout(); - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeClick(manipulator.event, ordinal); - }; - } - - function cubicInOut(t) { - return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function easing(t) { - if (t === 0 || t === 1) - return t; - return cubicInOut(t); - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - class Transitioner { - constructor() { - this.isTransitioning = false; - } - begin() { - this.isTransitioning = true; - this.time = 0; - } - elapse(elapsedTime, totalTime, ease = false) { - this.time += elapsedTime; - if (this.time >= totalTime) { - this.isTransitioning = false; - this.time = totalTime; - this.ended && this.ended(); - } - const t = this.time / totalTime; - return ease ? easing(t) : t; - } - } - class CameraTransitioner extends Transitioner { - constructor() { - super(); - this.qRotation = { - from: create$1(), - to: null, - current: create$1(), - }; - this.vPosition = { - from: create$3(), - to: null, - current: create$3(), - }; - } - move(position, rotation) { - this.begin(); - this.qRotation.to = rotation; - this.vPosition.to = position; - } - } - class ModelTransitioner extends Transitioner { - constructor() { - super(); - this.shouldTransition = false; - this.qRotation = { - from: null, - to: null, - current: create$1(), - }; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - function init(options, mcRendererOptions) { - const { container } = options; - const core = new Core({ container }); - getRenderer(mcRendererOptions, core); - listenCanvasEvents(core, options); - core.config.pickSelectDelay = 50; - const cameraTransitioner = new CameraTransitioner(); - const modelTransitioner = new ModelTransitioner(); - const positionTransitioner = new Transitioner(); - positionTransitioner.ended = () => { - core.renderer.axesVisibility = AxesVisibility.current; - }; - const ref = { - supportedRenders: { - advanced: rendererEnabled(true), - basic: rendererEnabled(false), - }, - reset: null, - cameraTransitioner, - modelTransitioner, - positionTransitioner, - core, - setMorphChartsRendererOptions(mcRendererOptions) { - if (shouldChangeRenderer(ref.lastMorphChartsRendererOptions, mcRendererOptions)) { - getRenderer(mcRendererOptions, core); - listenCanvasEvents(core, options); - } - else { - if (mcRendererOptions.advanced) { - //same renderer, poke the config - setRendererOptions(core.renderer, mcRendererOptions); - } - } - ref.lastMorphChartsRendererOptions = mcRendererOptions; - }, - lastMorphChartsRendererOptions: mcRendererOptions, - layerStagger: {}, - }; - return ref; - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - /** - * Class which presents a Stage of chart data using MorphCharts to render. - */ - class Presenter { - /** - * Get the previously rendered Stage object. - */ - get stage() { - return this._last.stage; - } - /** - * Get the current View camera type. - */ - get view() { - return this._last.view; - } - /** - * Instantiate a new Presenter. - * @param el Parent HTMLElement to present within. - * @param style Optional PresenterStyle styling options. - */ - constructor(el, style) { - this.el = el; - this.style = deepMerge(defaultPresenterStyle, style); - initializePanel(this); - this._last = { view: null, height: null, width: null, cubeCount: null, stage: null }; - } - /** - * Cancels any pending animation, calling animationCanceled() on original queue. - */ - animationCancel() { - if (this.animationTimer) { - clearTimeout(this.animationTimer); - this.animationTimer = null; - if (this.logger) { - this.logger(`canceling animation ${(this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel) || 'handler'}`); - } - if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) { - this.queuedAnimationOptions.animationCanceled.call(null); - } - } - } - /** - * Stops the current animation and queues a new animation. - * @param handler Function to invoke when timeout is complete. - * @param timeout Length of time to wait before invoking the handler. - * @param options Optional QueuedAnimationOptions object. - */ - animationQueue(handler, timeout, options) { - if (this.logger) { - this.logger(`queueing animation ${(options && options.waitingLabel) || 'waiting'}...(${timeout})`); - } - this.animationCancel(); - this.animationTimer = setTimeout(() => { - if (this.logger) { - this.logger(`queueing animation ${(options && options.handlerLabel) || 'handler'}...`); - } - handler(); - }, timeout); - } - /** - * Retrieve a sub-element of the rendered output. - * @param type PresenterElement type of the HTMLElement to retrieve. - */ - getElement(type) { - const elements = this.el.getElementsByClassName(className(type, this)); - if (elements && elements.length) { - return elements[0]; - } - } - /** - * Present the Vega Scene, or Stage object using Morphcharts. - * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. - * @param height Height of the rendering area. - * @param width Width of the rendering area. - * @param config Optional presentation configuration object. - */ - present(sceneOrStage, height, width, config) { - this.animationCancel(); - const scene = sceneOrStage; - let stage; - const options = { - maxOrdinal: 0, - currAxis: null, - defaultCubeColor: this.style.defaultCubeColor, - assignCubeOrdinal: (config && config.onSceneRectAssignCubeOrdinal) || (() => options.maxOrdinal++), - modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, - zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex, - }; - //determine if this is a vega scene - if (scene.marktype) { - stage = createStage(scene.view); - sceneToStage(options, stage, scene); - } - else { - stage = sceneOrStage; - } - const c = deepMerge(defaultPresenterConfig, config); - if (!this.morphchartsref) { - this._morphChartsOptions = { - container: this.getElement(exports.PresenterElement.gl), - pickGridCallback: c.axisPickGridCallback, - onCubeHover: (e, ordinal) => { - c.onCubeHover(e, { ordinal, color: null, position: null, size: null }); - }, - onCubeClick: (e, ordinal) => { - c.onCubeClick(e, { ordinal, color: null, position: null, size: null }); - }, - onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, - onLasso: config === null || config === void 0 ? void 0 : config.onLasso, - }; - this.morphchartsref = init(this._morphChartsOptions, c.renderer || defaultPresenterConfig.renderer); - } - let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); - if (options.maxOrdinal) { - cubeCount = Math.max(cubeCount, options.maxOrdinal); - const empty = { - isEmpty: true, - }; - stage.cubeData = patchCubeArray(cubeCount, empty, stage.cubeData); - } - config.preLayer && config.preLayer(stage); - this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height, width, config && config.preStage, config && config.morphChartsColors, c); - delete stage.cubeData; - delete stage.redraw; - this._last = { - cubeCount, - height, - width, - stage, - view: stage.view, - }; - const a = getActiveElementInfo(); - mount(LegendView({ legend: stage.legend, onClick: config && config.onLegendClick }), this.getElement(exports.PresenterElement.legend)); - setActiveElement(a); - if (config && config.onPresent) { - config.onPresent(); - } - } - canvasToDataURL() { - return new Promise((resolve, reject) => { - this.morphchartsref.core.afterRenderCallback = () => { - this.morphchartsref.core.afterRenderCallback = null; - const canvas = this.getElement(exports.PresenterElement.gl).getElementsByTagName('canvas')[0]; - const png = canvas.toDataURL('image/png'); - resolve(png); - }; - }); - } - configColors(mcColors) { - colorConfig(this.morphchartsref, mcColors); - } - /** - * Home the camera to the last initial position. - */ - homeCamera() { - var _a; - (_a = this.morphchartsref) === null || _a === void 0 ? void 0 : _a.reset(); - } - /** - * Show guidelines of rendering height/width and center of OrbitView. - */ - showGuides() { - this.getElement(exports.PresenterElement.gl).classList.add('show-center'); - //TODO Morphcharts gridlines - } - finalize() { - this.animationCancel(); - if (this.morphchartsref) - this.morphchartsref.core.stop(); - if (this.el) - this.el.innerHTML = ''; - this._last = null; - this.morphchartsref = null; - this.el = null; - this.logger = null; - this.queuedAnimationOptions = null; - } - } - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - //pass in the SuperClass, which should be a vega.View - function _RendererGl(loader) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class RendererGlInternal extends base.vega.Renderer { - initialize(el, width, height, origin) { - this.height = height; - this.width = width; - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin); - } - resize(width, height, origin) { - super.resize(width, height, origin); - this.origin = origin; - this.height = height; - this.width = width; - //rteturn this for vega - return this; - } - _render(scene, items) { - const scene3d = scene; - scene3d.view = this.getView(); - this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); - //return this for vega - return this; - } - } - const instance = new RendererGlInternal(loader); - return instance; - } - //signature to allow this function to be used with the 'new' keyword. - //need to trick the compiler by casting to 'any'. - /** - * Subclass of Vega.Renderer, with added properties for accessing a Presenter. - * This is instantiated by ViewGl. - */ - const RendererGl = _RendererGl; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - let registered = false; - //dynamic superclass lets us create a subclass at execution phase instead of declaration phase. - //This allows us to retrieve vega.View from either UMD or ES6 consumers of this class. - //pass in the SuperClass, which should be a vega.View - function _ViewGl(runtime, config) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class ViewGlInternal extends base.vega.View { - constructor(runtime, config = {}) { - super(runtime, config); - this.config = config; - this.presenter = config.presenter; - config.presenterConfig = config.presenterConfig || {}; - config.presenterConfig.redraw = () => { - this._redraw = true; //use Vega View private member _redraw - this.run(); - }; - } - renderer(...args) { - if (args && args.length) { - const renderer = args[0]; - if (renderer === 'morphcharts' && !registered) { - base.vega.renderModule('morphcharts', { handler: base.vega.CanvasHandler, renderer: RendererGl }); - registered = true; - } - return super.renderer(renderer); - } - else { - return super.renderer(); - } - } - initialize(el) { - if (!this.presenter) { - this.presenter = new Presenter(el); - } - super.initialize(this.presenter.getElement(exports.PresenterElement.vegaControls)); - const renderer = this._renderer; - renderer.presenterConfig = this.config.presenterConfig; - renderer.presenter = this.presenter; - renderer.getView = this.config && this.config.getView || (() => this.presenter.view || defaultView); - return this; - } - error(e) { - if (this.presenter.logger) { - this.presenter.logger(e); - } - } - } - const instance = new ViewGlInternal(runtime, config); - return instance; - } - //signature to allow this function to be used with the 'new' keyword. - //need to trick the compiler by casting to 'any'. - /** - * Subclass of Vega.View, with added properties for accessing a Presenter. - * This is instantiatable by calling `new ViewGl()`. See https://vega.github.io/vega/docs/api/view/ - */ - const ViewGl = _ViewGl; - - /*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ - const version = '1.0.6'; - - exports.Presenter = Presenter; - exports.ViewGl = ViewGl; - exports.base = base; - exports.controls = controls; - exports.defaults = defaults; - exports.types = types; - exports.use = use; - exports.util = util; - exports.version = version; + this._core = core; + this._obj = options.obj; + this._texture = options.texture || new ImageData(new Uint8ClampedArray([0, 0, 0, 255]), 1, 1); + } + initialize() { + const _vec3 = create$3(); + this._mMatrix = create$4(); + const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); + if (!this._obj) { + this.useRayPose = true; + const modelThickness = 0.02; + const modelLength = 0.1; + set$3(_vec3, modelThickness, modelThickness, modelLength); + fromScaling(this._mMatrix, _vec3); + set$3(_vec3, 0, 0, 1); + translate(this._mMatrix, this._mMatrix, _vec3); + } + this._vertices = objMesh.vertices; + this._indices = objMesh.indices; + this._indexCount = objMesh.indexCount; + this._rayMMatrix = create$4(); + const rayVertices = Cube.POSITIONS; + this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); + const rayVerticesView = new DataView(this._rayVertices); + const rayIndices = Cube.INDICES; + this._rayIndices = new Uint16Array(rayIndices); + const rayVertexCount = rayVertices.length / PositionVertex.SIZE; + this._rayIndexCount = rayIndices.length; + for (let i = 0; i < rayVertexCount; i++) { + set$3(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); + PositionColorVertex.setPosition(rayVerticesView, i, _vec3); + PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); + } + const rayThickness = 0.0025; + const rayLength = 10; + set$3(_vec3, rayThickness, rayThickness, rayLength); + fromScaling(this._rayMMatrix, _vec3); + set$3(_vec3, 0, 0, -0.5); + translate(this._rayMMatrix, this._rayMMatrix, _vec3); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "controller initialized"); + } + update(elapsedTime) { } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class MatrixHelper { + static fieldOfViewFromProjectionMatrix(p) { + return 2 * Math.atan(1 / p[5]); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AxesVisual { + render(elapsedTime, xrFrame) { } + update(elapsedTime) { } + constructor(axes) { + this.axes = axes; + } + } + class AxesBase { + get isInitialized() { return this._isInitialized; } + set vMatrix(value) { this._vMatrix = value; } + pickGrid(id) { + const offset = id * 3; + return { + divisionX: this._pickGrid[offset] - 1, + divisionY: this._pickGrid[offset + 1] - 1, + divisionZ: this._pickGrid[offset + 2] - 1, + }; + } + pickTitle(id) { + return { axis: this._pickTitle[id], }; + } + pickLabel(id) { + const offset = id * 2; + return { + axis: this._pickLabel[offset], + label: this._pickLabel[offset + 1], + }; + } + pickHeading(id) { + return { axis: this._pickHeading[id], }; + } + getFromValues(index) { return this._fromValues[index]; } + setFromValues(index, value) { + if (this._fromValues[index] != value) { + this._fromValues[index] = value; + this._hasChanged = true; + } + } + getToValues(index) { return this._toValues[index]; } + setToValues(index, value) { + if (this._toValues[index] != value) { + this._toValues[index] = value; + this._hasChanged = true; + } + } + get font() { return this._font; } + set font(value) { + if (this._font != value) { + this._font = value; + this._hasChanged = true; + } + } + get gridPickDivisionHeight() { return this._gridPickDivisionHeight; } + set gridPickDivisionHeight(value) { + if (this._gridPickDivisionHeight != value) { + this._gridPickDivisionHeight = value; + this._hasChanged = true; + } + } + constructor(core) { + this._core = core; + this._mMatrix = create$4(); + this._mvMatrix = create$4(); + this._textMetric = { maxTop: 0, width: 0, maxHeight: 0 }; + this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; + this.textBorderWidth = core.config.textBorderWidth; + this.gamma = 0; + this.gridMajorThickness = core.config.axesGridMajorThickness; + this.gridMinorThickness = core.config.axesGridMinorThickness; + this.gridZeroThickness = core.config.axesGridZeroThickness; + this._font = core.font; + this.isGridPickingEnabled = false; + } + update(elapsedTime) { } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Quad$2 = class Quad { + static positions(transform) { + const positions = new Float32Array(12); + const position = create$3(); + for (let i = 0; i < 4; i++) { + set$3(position, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); + transformMat4$2(position, position, transform); + positions[i * 3] = position[0]; + positions[i * 3 + 1] = position[1]; + positions[i * 3 + 2] = position[2]; + } + return positions; + } + static textured(transform, texTransform = Constants.MAT4_IDENTITY) { + const positions = this.positions(transform); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position = create$3(); + const texCoord = create(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$3(position, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionTextureVertex.setPosition(verticesView, i, position); + PositionTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + static normalTextured(transform, texTransform = Constants.MAT4_IDENTITY) { + const positions = this.positions(transform); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position = create$3(); + const texCoord = create(); + const normal3 = create$3(); + const normal4 = create$2(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$3(position, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionNormalTextureVertex.setPosition(verticesView, i, position); + set$2(normal4, 0.0, 0.0, 1.0, 0.0); + transformMat4$1(normal4, normal4, transform); + set$3(normal3, normal4[0], normal4[1], normal4[2]); + normalize$2(normal3, normal3); + PositionNormalTextureVertex.setNormal(verticesView, i, normal3); + PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + }; + Quad$2.FACE_NORMALS = [ + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$2.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Quad$2.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0) + ]; + Quad$2.EDGE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0) + ]; + Quad$2.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0) + ]; + Quad$2.EDGE_FORWARDS = [ + fromValues$3(0, 0, -1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$2.AXIS_EDGES = [ + [0, 2], + [1, 3] + ]; + Quad$2.POSITIONS = new Float32Array([ + -0.5, 0.5, 0, + 0.5, 0.5, 0, + -0.5, -0.5, 0, + 0.5, -0.5, 0 + ]); + Quad$2.INDICES = new Uint16Array([0, 2, 1, 1, 2, 3]); + Quad$2.TEX_COORDS = new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class TextHelper { + static truncate(text, length) { + return text.length > length ? `${text.substr(0, length - 1)}…` : text; + } + static measure(font, text, size) { + size.width = 0; + let maxDescent = 0; + for (const char of text) { + let glyph = font.glyphs[char]; + if (!glyph) { + font.addGlyph(char); + glyph = font.glyphs[char]; + } + size.width += glyph.advance; + size.maxTop = Math.max(glyph.top, size.maxTop); + maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + } + size.maxHeight = size.maxTop + maxDescent; + } + static wrap(font, text, maxWidth) { + const lines = []; + let width = 0; + let start = 0; + let lastBreakingChar = -1; + let widthAfterLastBreakingChar = 0; + for (let i = 0; i < text.length; i++) { + let char = text.charAt(i); + let glyph = font.glyphs[char]; + if (!glyph) { + font.addGlyph(char); + glyph = font.glyphs[char]; + } + width += glyph.advance; + if (char == " " || char == "-") { + widthAfterLastBreakingChar = width; + lastBreakingChar = i; + } + if (width > maxWidth) { + if (lastBreakingChar == -1) { + lines.push(text.substring(start, i)); + start = i; + width += glyph.advance; + } + else { + lines.push(text.substring(start, lastBreakingChar)); + start = lastBreakingChar + 1; + width -= widthAfterLastBreakingChar; + widthAfterLastBreakingChar = 0; + lastBreakingChar = -1; + } + } + } + lines.push(text.substring(start, text.length)); + return lines; + } + static addString(font, text, vertices, indices, index, position, scale, offset, rotation, idColor) { + for (const char of text) { + this.addGlyph(font, char, vertices, indices, index++, position, scale, offset, rotation, idColor); + } + } + static addGlyph(font, char, vertices, indices, index, position, scale, offset, rotation, idColor) { + let glyph = font.glyphs[char]; + if (!glyph) { + font.addGlyph(char); + glyph = font.glyphs[char]; + } + const vertexOffset = index * 4; + const width = glyph.width * scale; + const height = glyph.height * scale; + const top = glyph.top * scale; + const border = font.border * scale; + const x0 = offset[0] - border; + const x1 = offset[0] + width + border; + const y0 = offset[1] + top + border; + const y1 = offset[1] + top - height - border; + const z0 = offset[2]; + set$3(this._topLeft, x0, y0, z0); + set$3(this._topRight, x1, y0, z0); + set$3(this._bottomLeft, x0, y1, z0); + set$3(this._bottomRight, x1, y1, z0); + if (rotation) { + transformQuat(this._topLeft, this._topLeft, rotation); + transformQuat(this._topRight, this._topRight, rotation); + transformQuat(this._bottomLeft, this._bottomLeft, rotation); + transformQuat(this._bottomRight, this._bottomRight, rotation); + } + add(this._vec3, this._topLeft, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); + add(this._vec3, this._topRight, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); + add(this._vec3, this._bottomLeft, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); + add(this._vec3, this._bottomRight, position); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); + set(this._vec2, glyph.u0, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); + set(this._vec2, glyph.u1, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); + set(this._vec2, glyph.u0, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); + set(this._vec2, glyph.u1, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); + offset[0] += glyph.advance * scale; + const indexTemplate = Quad$2.INDICES; + const indexOffset = index * 6; + for (let i = 0; i < 6; i++) { + indices[indexOffset + i] = indexTemplate[i] + vertexOffset; + } + } + } + TextHelper._vec2 = create(); + TextHelper._vec3 = create$3(); + TextHelper._topLeft = create$3(); + TextHelper._topRight = create$3(); + TextHelper._bottomLeft = create$3(); + TextHelper._bottomRight = create$3(); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class PickHelper { + static nextPickId() { return this._pickId++; } + static encodeNumber(number, type, color) { + const encoded = number | PickHelper.encodeType(type); + PickHelper.float32ToVec4(encoded, color); + } + static decodeNumber(color) { + return color[0] + (color[1] << 8) + (color[2] << 16); + } + static encodeVec3(vec3, type, color) { + const encoded = vec3[0] | (vec3[1] << 8) | (vec3[2] << 16) | PickHelper.encodeType(type); + PickHelper.float32ToVec4(encoded, color); + } + static decodeVec3(color, axes) { + axes[0] = color[0]; + axes[1] = color[1]; + axes[2] = color[2]; + } + static encodeType(type) { + return type << 24; + } + static decodeType(color) { + return color[3]; + } + static float32ToVec4(number, color) { + color[0] = ((number & 0xFF) >>> 0) / 0xFF; + color[1] = ((number & 0xFF00) >>> 8) / 0xFF; + color[2] = ((number & 0xFF0000) >>> 16) / 0xFF; + color[3] = ((number & 0xFF000000) >>> 24) / 0xFF; + } + static uint8ArrayToNumber(color) { + return color[0] + (color[1] << 8) + (color[2] << 16) + (color[3] << 24); + } + } + PickHelper._pickId = 1; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Cartesian3dAxes extends AxesBase { + get size() { return this._size; } + get isDiscreteX() { return this._isDiscrete[0]; } + set isDiscreteX(value) { + if (value != this._isDiscrete[0]) { + this._isDiscrete[0] = value; + this._hasChanged = true; + } + } + get isDiscreteY() { return this._isDiscrete[1]; } + set isDiscreteY(value) { + if (value != this._isDiscrete[1]) { + this._isDiscrete[1] = value; + this._hasChanged = true; + } + } + get isDiscreteZ() { return this._isDiscrete[2]; } + set isDiscreteZ(value) { + if (value != this._isDiscrete[2]) { + this._isDiscrete[2] = value; + this._hasChanged = true; + } + } + get minBoundsX() { return this._minBoundsX; } + set minBoundsX(value) { + if (value != this._minBoundsX) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsX() { return this._maxBoundsX; } + set maxBoundsX(value) { + if (value != this._minBoundsX) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { return this._minBoundsY; } + set minBoundsY(value) { + if (value != this._minBoundsY) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsY() { return this._maxBoundsY; } + set maxBoundsY(value) { + if (value != this._minBoundsY) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + get minBoundsZ() { return this._minBoundsZ; } + set minBoundsZ(value) { + if (value != this._minBoundsZ) { + this._minBoundsZ = value; + this._hasChanged = true; + } + } + get maxBoundsZ() { return this._maxBoundsZ; } + set maxBoundsZ(value) { + if (value != this._minBoundsZ) { + this._maxBoundsZ = value; + this._hasChanged = true; + } + } + getIsOutsideEdge(index) { return this._isOutsideEdge[index]; } + getIsForwardFace(index) { return this._isForwardFace[index]; } + get textVertices() { return this._textVertices; } + get textIndices() { return this._textIndices; } + getLabelMMatrix(index) { return this._labelMMatrices[index]; } + setLabelPositions(index, value) { + if (this._labelPositions[index] != value) { + this._labelPositions[index] = value; + this._hasChanged = true; + } + } + setLabels(index, value) { + if (this._labels[index] != value) { + this._labels[index] = value; + this._hasChanged = true; + } + } + setLabelSizes(index, value) { + if (this._labelSizes[index] != value) { + this._labelSizes[index] = value; + this._hasChanged = true; + } + } + getLabelOrientation(index) { return this._orientations[index]; } + setLabelOrientation(index, orientation) { + if (this._orientations[index] != orientation) { + this._orientations[index] = orientation; + this._hasChanged = true; + } + } + getTitleIndexCount(index) { return this._titleIndexCounts[index]; } + getTitleIndexOffset(index) { return this._titleIndexOffsets[index]; } + getTitleMMatrix(index) { return this._titleMMatrices[index]; } + setTitle(index, value) { + if (this._titles[index] != value) { + this._titles[index] = value; + this._hasChanged = true; + } + } + setTitleSize(index, value) { + if (this._titleSizes[index] != value) { + this._titleSizes[index] = value; + this._hasChanged = true; + } + } + getHeadingIndexCount(index) { return this._headingIndexCounts[index]; } + getHeadingIndexOffset(index) { return this._headingIndexOffsets[index]; } + getHeadingMMatrix(index) { return this._headingMMatrices[index]; } + setHeading(index, value) { + if (this._headings[index] != value) { + this._headings[index] = value; + this._hasChanged = true; + } + } + setHeadingSize(index, value) { + if (this._headingSizes[index] != value) { + this._headingSizes[index] = value; + this._hasChanged = true; + } + } + getIsLeftToRightHorizontal(index) { return this._isLeftToRightHorizontal[index]; } + getIsLeftToRightVertical(index) { return this._isLeftToRightVertical[index]; } + getAxesLeftToRightIndexCount(index) { return this._axesLeftToRightIndexCounts[index]; } + getAxesRightToLeftIndexCount(index) { return this._axesRightToLeftIndexCounts[index]; } + getAxesLeftToRightIndexOffset(index) { return this._axesLeftToRightIndexOffsets[index]; } + getAxesRightToLeftIndexOffset(index) { return this._axesRightToLeftIndexOffsets[index]; } + get gridVertices() { return this._gridVertices; } + get gridIndices() { return this._gridIndices; } + getGridTicksIndexCount(index) { return this._gridTicksIndexCounts[index]; } + getGridTicksIndexOffset(index) { return this._gridTicksIndexOffsets[index]; } + getGridFaceIndexCount(index) { return this._gridFaceIndexCounts[index]; } + getGridFaceIndexOffset(index) { return this._gridFaceIndexOffsets[index]; } + getGridTicksMMatrix(index) { return this._gridTicksMMatrices[index]; } + getGridFaceMMatrix(index) { return this._gridFaceMMatrices[index]; } + getGridTicksScale(index) { return this._gridTicksScales[index]; } + getGridFaceZero(index) { return this._gridFaceZeros[index]; } + getGridTicksZero(index) { return this._gridTicksZeros[index]; } + getGridFaceMinorGridlines(index) { return this._gridFaceMinorGridlines[index]; } + getGridTicksMinorGridlines(index) { return this._gridTicksMinorGridlines[index]; } + setTickPositions(index, value) { + if (this._gridTicksPositions[index] != value) { + this._gridTicksPositions[index] = value; + this._hasChanged = true; + } + } + get scalingX() { return this._scalingX; } + set scalingX(value) { + if (value != this._scalingX) { + this._scalingX = value; + this._hasChanged = true; + } + } + get scalingY() { return this._scalingY; } + set scalingY(value) { + if (value != this._scalingY) { + this._scalingY = value; + this._hasChanged = true; + } + } + get scalingZ() { return this._scalingZ; } + set scalingZ(value) { + if (value != this._scalingZ) { + this._scalingZ = value; + this._hasChanged = true; + } + } + get offsetX() { return this._offset[12]; } + set offsetX(value) { + if (value != this._offset[12]) { + this._offset[12] = value; + } + } + get offsetY() { return this._offset[13]; } + set offsetY(value) { + if (value != this._offset[13]) { + this._offset[13] = value; + } + } + get offsetZ() { return this._offset[14]; } + set offsetZ(value) { + if (value != this._offset[14]) { + this._offset[14] = value; + } + } + constructor(core) { + super(core); + this._size = create$3(); + this._translation = create$3(); + this._normal = create$3(); + this._forward = create$3(); + this._right = create$3(); + this._up = create$3(); + this._texCoord = create(); + this._bounds = create$2(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mat3 = create$5(); + this._isDiscrete = [false, false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._minBoundsZ = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._maxBoundsZ = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 6; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 12; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$3(); + this._textPosition = create$3(); + this._distances = []; + for (let i = 0; i < 12; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 3; i++) { + this._maxLabelSize.push(create()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._labelMMatrices.push(create$4()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 3; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._titleMMatrices.push(create$4()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 3; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._headingMMatrices.push(create$4()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$3(); + this._edgePositive = create$3(); + this._edgeNormal = create$3(); + this._edgeNormalTemp = create$3(); + this._edgePositiveTemp = create$3(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 12; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$3()); + this._edgeHorizontalUp.push(create$3()); + this._edgeHorizontalForward.push(create$3()); + this._edgeVerticalRight.push(create$3()); + this._edgeVerticalUp.push(create$3()); + this._edgeVerticalForward.push(create$3()); + } + this.isFaceVisible = []; + for (let i = 0; i < 6; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$3(); + this._gridTicksZeros = []; + this._gridFaceZeros = []; + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = []; + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$3(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 3; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create()); + this._gridFaceZeros.push(create()); + this._gridTicksMinorGridlines.push(create()); + this._gridFaceMinorGridlines.push(create()); + this._gridTicksScales.push(create$3()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + } + for (let i = 0; i < 6; i++) { + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$4()); + } + for (let i = 0; i < 12; i++) { + this._gridTicksMMatrices.push(create$4()); + this._gridTicksRotations.push(create$4()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Cube.EDGE_POSITIVES[i][0]; + _mat4[1] = Cube.EDGE_POSITIVES[i][1]; + _mat4[2] = Cube.EDGE_POSITIVES[i][2]; + _mat4[4] = Cube.EDGE_NORMALS[i][0]; + _mat4[5] = Cube.EDGE_NORMALS[i][1]; + _mat4[6] = Cube.EDGE_NORMALS[i][2]; + cross(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null, null]; + this._toValues = [null, null, null]; + this.isDivisionPickingEnabled = [false, false, false]; + this.isLabelPickingEnabled = [false, false, false]; + this.isTitlePickingEnabled = [false, false, false]; + this.isHeadingPickingEnabled = [false, false, false]; + this.isAxisReversed = [false, false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._scalingZ = 1; + this._offset = create$4(); + } + initialize() { + this._isInitialized = true; + } + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); + const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._size[2] *= this._scalingZ / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); + } + multiply$2(this._mMatrix, this.mMatrix, this._offset); + this._mvMatrix = create$4(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 6; faceId++) { + multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); + transformMat4$2(this._forward, this._vec3, this._mvMatrix); + transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 12; edgeId++) { + const faceIds = Cube.EDGE_FACES[edgeId]; + const forward1 = this._isForwardFace[faceIds[0]]; + const forward2 = this._isForwardFace[faceIds[1]]; + const outsideEdge = forward1 != forward2; + this._isOutsideEdge[edgeId] = outsideEdge; + if (outsideEdge) { + this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; + } + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { + let distance = this._distances[edgeId]; + distance += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + translate(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); + } + scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance; + } + } + } + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); + set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + if (this._size[axisId] > 0) { + translate(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); + } + } + } + } + } + for (let axisId = 0; axisId < 3; axisId++) { + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId]) { + multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$2(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross(this._right, Constants.VECTOR3_UNITY, this._forward); + normalize$2(this._right, this._right); + cross(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); + copy$3(this._edgeNormalTemp, this._edgeNormal); + copy$3(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$3(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + } + else { + negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$3(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + } + else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$3(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + } + else { + negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$3(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + } + else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } + } + } + } + } + } + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance += maxLabelSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); + } + distance += maxLabelSize * 0.5; + this._distances[edgeId] = distance; + } + _updateTitle(axisId, edgeId) { + let distance = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance += titleTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance += titleTextSize * 0.5; + this._distances[edgeId] = distance; + } + _updateHeading(axisId, edgeId) { + let distance = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance += headingTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance += headingTextSize * 0.5; + this._distances[edgeId] = distance; + } + _updateGrids(size) { + let offset = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; + const count = 2 * (xDivisions * yDivisions) + + 2 * (xDivisions * zDivisions) + + 2 * (yDivisions * zDivisions) + + xDivisions + + yDivisions + + zDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count * 6); + } + for (let axisId = 0; axisId < 3; axisId++) { + const width = size[axisId]; + set$3(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); + offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); + } + this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; + } + } + _updateText(size) { + let glyphOffset = 0; + let count = 0; + for (let axisId = 0; axisId < 3; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._labels[axisId]) { + const width = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } + else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._titles[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } + else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._headings[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } + else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } + } + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (position - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width / 2; + } + else { + this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + maxSize[0] = Math.max(width, maxSize[0]); + maxSize[1] = Math.max(lineHeight, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (position - 0.5) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } + else { + this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; + } + maxSize[0] = Math.max(lineHeight, maxSize[0]); + maxSize[1] = Math.max(width, maxSize[1]); + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (0.5 - position) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width / 2; + } + else { + this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (0.5 - position) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } + else { + this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; + } + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateGridTicks(axisId, dataView, indices, offset) { + this._gridTicksIndexOffsets[axisId] = offset * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$3(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset * 4; + for (let position = 0; position < positions.length - 1; position++) { + const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; + const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; + axes[axisId] = position + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; + return offset; + } + _updateGridFace(axisId, faceId, dataView, indices, offset) { + set$3(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$3(); + negate(this._normal, Cube.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; + return offset; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Cartesian2dAxes extends AxesBase { + get size() { return this._size; } + get isDiscreteX() { return this._isDiscrete[0]; } + set isDiscreteX(value) { + if (value != this._isDiscrete[0]) { + this._isDiscrete[0] = value; + this._hasChanged = true; + } + } + get isDiscreteY() { return this._isDiscrete[1]; } + set isDiscreteY(value) { + if (value != this._isDiscrete[1]) { + this._isDiscrete[1] = value; + this._hasChanged = true; + } + } + get minBoundsX() { return this._minBoundsX; } + set minBoundsX(value) { + if (value != this._minBoundsX) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsX() { return this._maxBoundsX; } + set maxBoundsX(value) { + if (value != this._minBoundsX) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { return this._minBoundsY; } + set minBoundsY(value) { + if (value != this._minBoundsY) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsY() { return this._maxBoundsY; } + set maxBoundsY(value) { + if (value != this._minBoundsY) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + getIsOutsideEdge(index) { return this._isOutsideEdge[index]; } + getIsForwardFace(index) { return this._isForwardFace[index]; } + get textVertices() { return this._textVertices; } + get textIndices() { return this._textIndices; } + getLabelMMatrix(index) { return this._labelMMatrices[index]; } + setLabelPositions(index, value) { + if (this._labelPositions[index] != value) { + this._labelPositions[index] = value; + this._hasChanged = true; + } + } + setLabels(index, value) { + if (this._labels[index] != value) { + this._labels[index] = value; + this._hasChanged = true; + } + } + setLabelSizes(index, value) { + if (this._labelSizes[index] != value) { + this._labelSizes[index] = value; + this._hasChanged = true; + } + } + getLabelOrientation(index) { return this._orientations[index]; } + setLabelOrientation(index, orientation) { + if (this._orientations[index] != orientation) { + this._orientations[index] = orientation; + this._hasChanged = true; + } + } + getTitleIndexCount(index) { return this._titleIndexCounts[index]; } + getTitleIndexOffset(index) { return this._titleIndexOffsets[index]; } + getTitleMMatrix(index) { return this._titleMMatrices[index]; } + setTitle(index, value) { + if (this._titles[index] != value) { + this._titles[index] = value; + this._hasChanged = true; + } + } + setTitleSize(index, value) { + if (this._titleSizes[index] != value) { + this._titleSizes[index] = value; + this._hasChanged = true; + } + } + getHeadingIndexCount(index) { return this._headingIndexCounts[index]; } + getHeadingIndexOffset(index) { return this._headingIndexOffsets[index]; } + getHeadingMMatrix(index) { return this._headingMMatrices[index]; } + setHeading(index, value) { + if (this._headings[index] != value) { + this._headings[index] = value; + this._hasChanged = true; + } + } + setHeadingSize(index, value) { + if (this._headingSizes[index] != value) { + this._headingSizes[index] = value; + this._hasChanged = true; + } + } + getIsLeftToRightHorizontal(index) { return this._isLeftToRightHorizontal[index]; } + getIsLeftToRightVertical(index) { return this._isLeftToRightVertical[index]; } + getAxesLeftToRightIndexCount(index) { return this._axesLeftToRightIndexCounts[index]; } + getAxesRightToLeftIndexCount(index) { return this._axesRightToLeftIndexCounts[index]; } + getAxesLeftToRightIndexOffset(index) { return this._axesLeftToRightIndexOffsets[index]; } + getAxesRightToLeftIndexOffset(index) { return this._axesRightToLeftIndexOffsets[index]; } + get gridVertices() { return this._gridVertices; } + get gridIndices() { return this._gridIndices; } + getGridTicksIndexCount(index) { return this._gridTicksIndexCounts[index]; } + getGridTicksIndexOffset(index) { return this._gridTicksIndexOffsets[index]; } + getGridFaceIndexCount(index) { return this._gridFaceIndexCounts[index]; } + getGridFaceIndexOffset(index) { return this._gridFaceIndexOffsets[index]; } + getGridTicksMMatrix(index) { return this._gridTicksMMatrices[index]; } + getGridFaceMMatrix(index) { return this._gridFaceMMatrices[index]; } + getGridTicksScale(index) { return this._gridTicksScales[index]; } + getGridTicksZero(index) { return this._gridTicksZeros[index]; } + get gridFaceZero() { return this._gridFaceZeros; } + get gridFaceMinorGridlines() { return this._gridFaceMinorGridlines; } + getGridTicksMinorGridlines(index) { return this._gridTicksMinorGridlines[index]; } + setTickPositions(index, value) { + if (this._gridTicksPositions[index] != value) { + this._gridTicksPositions[index] = value; + this._hasChanged = true; + } + } + get scalingX() { return this._scalingX; } + set scalingX(value) { + if (value != this._scalingX) { + this._scalingX = value; + this._hasChanged = true; + } + } + get scalingY() { return this._scalingY; } + set scalingY(value) { + if (value != this._scalingY) { + this._scalingY = value; + this._hasChanged = true; + } + } + get offsetX() { return this._offset[12]; } + set offsetX(value) { + if (value != this._offset[12]) { + this._offset[12] = value; + } + } + get offsetY() { return this._offset[13]; } + set offsetY(value) { + if (value != this._offset[13]) { + this._offset[13] = value; + } + } + set rotation(value) { + if (this._rotation != value) { + this._rotation = value; + this._rMatrix = create$4(); + fromQuat(this._rMatrix, value); + } + } + constructor(core) { + super(core); + this._size = create$3(); + this._translation = create$3(); + this._normal = create$3(); + this._forward = create$3(); + this._right = create$3(); + this._up = create$3(); + this._texCoord = create(); + this._bounds = create$2(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mat3 = create$5(); + this._isDiscrete = [false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 2; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 4; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$3(); + this._textPosition = create$3(); + this._distances = []; + for (let i = 0; i < 4; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 2; i++) { + this._maxLabelSize.push(create()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._labelMMatrices.push(create$4()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 2; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._titleMMatrices.push(create$4()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 2; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._headingMMatrices.push(create$4()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$3(); + this._edgePositive = create$3(); + this._edgeNormal = create$3(); + this._edgeNormalTemp = create$3(); + this._edgePositiveTemp = create$3(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 4; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$3()); + this._edgeHorizontalUp.push(create$3()); + this._edgeHorizontalForward.push(create$3()); + this._edgeVerticalRight.push(create$3()); + this._edgeVerticalUp.push(create$3()); + this._edgeVerticalForward.push(create$3()); + } + this.isFaceVisible = []; + for (let i = 0; i < 2; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$3(); + this._gridTicksZeros = []; + this._gridFaceZeros = create(); + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = create(); + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$3(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 2; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create()); + this._gridTicksMinorGridlines.push(create()); + this._gridTicksScales.push(create$3()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$4()); + } + for (let i = 0; i < 4; i++) { + this._gridTicksMMatrices.push(create$4()); + this._gridTicksRotations.push(create$4()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Quad$2.EDGE_POSITIVES[i][0]; + _mat4[1] = Quad$2.EDGE_POSITIVES[i][1]; + _mat4[2] = Quad$2.EDGE_POSITIVES[i][2]; + _mat4[4] = Quad$2.EDGE_NORMALS[i][0]; + _mat4[5] = Quad$2.EDGE_NORMALS[i][1]; + _mat4[6] = Quad$2.EDGE_NORMALS[i][2]; + cross(this._vec3, Quad$2.EDGE_POSITIVES[i], Quad$2.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null]; + this._toValues = [null, null]; + this.isDivisionPickingEnabled = [false, false]; + this.isLabelPickingEnabled = [false, false]; + this.isTitlePickingEnabled = [false, false]; + this.isHeadingPickingEnabled = [false, false]; + this.isAxisReversed = [false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._offset = create$4(); + } + initialize() { + this._isInitialized = true; + } + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); + const maxBounds = Math.max(this._size[0], this._size[1]); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); + } + if (this._rMatrix) { + mul(this._mMatrix, this.mMatrix, this._rMatrix); + mul(this._mMatrix, this._mMatrix, this._offset); + } + else { + multiply$2(this._mMatrix, this.mMatrix, this._offset); + } + this._mvMatrix = create$4(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 2; faceId++) { + transformMat4$2(this._forward, Constants.VECTOR3_ZERO, this._mvMatrix); + transformMat3(this._normal, Quad$2.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 4; edgeId++) { + this._isForwardEdge[edgeId] = dot$1(Quad$2.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 2; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (this.isEdgeVisible[edgeId]) { + let distance = this._distances[edgeId]; + distance += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + translate(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); + } + scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance; + } + } + } + } + set(this._gridFaceZeros, this.zero[0], this.zero[1]); + set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); + for (let faceId = 0; faceId < 2; faceId++) { + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + } + } + for (let axisId = 0; axisId < 2; axisId++) { + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + multiply$1(this._edgePosition, Quad$2.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$2(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross(this._right, Constants.VECTOR3_UNITY, this._forward); + normalize$2(this._right, this._right); + cross(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Quad$2.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Quad$2.EDGE_POSITIVES[edgeId], this._mat3); + copy$3(this._edgeNormalTemp, this._edgeNormal); + copy$3(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$3(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + } + else { + negate(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$3(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } + else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$3(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + } + else { + negate(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$3(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } + else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } + } + } + } + } + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance += maxLabelSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); + } + distance += maxLabelSize * 0.5; + this._distances[edgeId] = distance; + } + _updateTitle(axisId, edgeId) { + let distance = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance += titleTextSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance += titleTextSize * 0.5; + this._distances[edgeId] = distance; + } + _updateHeading(axisId, edgeId) { + let distance = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance += headingTextSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance += headingTextSize * 0.5; + this._distances[edgeId] = distance; + } + _updateGrids(size) { + let offset = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const count = 2 * (xDivisions * yDivisions) + + xDivisions + + yDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count * 6); + } + for (let axisId = 0; axisId < 2; axisId++) { + const width = size[axisId]; + set$3(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); + offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); + this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; + } + const axisId = 2; + this._gridFaceScale[axisId] = 1; + for (let faceId = 0; faceId < 2; faceId++) { + offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); + } + } + _updateText(size) { + let glyphOffset = 0; + let count = 0; + for (let axisId = 0; axisId < 2; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._labels[axisId]) { + const width = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } + else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._titles[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } + else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._headings[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const lineHeight = this._font.size * scale; + this._textOffset[0] -= width / 2; + this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } + else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } + } + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (position - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width / 2; + } + else { + this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + maxSize[0] = Math.max(width, maxSize[0]); + maxSize[1] = Math.max(lineHeight, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (position - 0.5) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } + else { + this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; + } + maxSize[0] = Math.max(lineHeight, maxSize[0]); + maxSize[1] = Math.max(width, maxSize[1]); + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label = 0; label < labels.length; label++) { + const text = TextHelper.truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight = scales[label]; + const scale = lineHeight / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const maxGlyphTop = this._textMetric.maxTop * scale; + const position = isAxisReversed ? 1 - positions[label] : positions[label]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (0.5 - position) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width / 2; + } + else { + this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (0.5 - position) * size, 0); + this._textOffset[0] = -width / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } + else { + this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; + } + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label); + TextHelper.addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); + glyphOffset += text.length; + } + return glyphOffset; + } + _updateGridTicks(axisId, dataView, indices, offset) { + this._gridTicksIndexOffsets[axisId] = offset * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$3(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset * 4; + for (let position = 0; position < positions.length - 1; position++) { + const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; + const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; + axes[axisId] = position + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; + return offset; + } + _updateGridFace(axisId, faceId, dataView, indices, offset) { + set$3(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$3(); + negate(this._normal, Quad$2.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; + return offset; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Glyph { + toJSON() { + return { + key: this.key, + char: this.char, + width: this.width, + height: this.height, + top: this.top, + left: this.left, + advance: this.advance, + u0: this.u0, + v0: this.v0, + u1: this.u1, + v1: this.v1, + }; + } + } + let FontVisual$2 = class FontVisual { + update() { } + constructor(font) { + this.font = font; + } + }; + class Font { + get atlas() { return this._rasterizer.fontAtlas; } + get count() { return this._chars.size; } + constructor(core, rasterizer) { + this._core = core; + this._rasterizer = rasterizer; + this._chars = new Set(); + this._previousSize = 0; + this.glyphs = {}; + } + addGlyph(char) { + if (!this._chars.has(char)) { + this._chars.add(char); + this._rasterizer.draw(char); + this._hasChanged = true; + } + } + update() { + if (this._hasChanged) { + this._hasChanged = false; + this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); + this._previousSize = this._chars.size; + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + } + } + toJSON() { + const glyphs = []; + for (let key in this.glyphs) { + const glyph = this.glyphs[key]; + glyphs.push(glyph.toJSON()); + } + return { + name: this.name, + size: this.size, + border: this.border, + glyphs: glyphs, + edgeValue: this.edgeValue, + }; + } + } + class FontAtlas { + constructor(width, height) { + const canvas = document.createElement("canvas"); + canvas.width = width; + canvas.height = height; + const context = canvas.getContext("2d"); + context.clearRect(0, 0, width, height); + this.imageData = context.getImageData(0, 0, width, height); + this.x = 0; + this.top = new Uint16Array(width); + } + } + class FontRasterizer { + get font() { return this._font; } + get fontAtlas() { return this._fontAtlas; } + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontAtlas = options.fontAtlas; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._font = new Font(core, this); + this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); + this._font.size = this._fontSize; + this._font.border = this._border; + this._font.edgeValue = this._edgeValue; + const glyphRasterizerOptions = { + baseline: this._baseline, + border: this._border, + edgeValue: this._edgeValue, + fontFamily: this._fontFamily, + fontSize: this._fontSize, + fontStyle: this._fontStyle, + fontWeight: this._fontWeight, + maxDistance: this._maxDistance, + }; + this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); + this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); + } + draw(char) { + const glyph = this._glyphRasterizer.draw(char); + const texWidth = glyph.width + 2 * this._border; + const texHeight = glyph.height + 2 * this._border; + const width = this._fontAtlas.imageData.width; + const height = this._fontAtlas.imageData.height; + if (this._fontAtlas.x + texWidth > width) { + this._fontAtlas.x = 0; + } + let y = 0; + for (let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++) { + y = Math.max(y, this._fontAtlas.top[x]); + } + if (y + texHeight > height) { + this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); + } + for (let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++) { + this._fontAtlas.top[x] = y + texHeight; + } + glyph.u0 = this._fontAtlas.x / width; + glyph.v0 = y / height; + glyph.u1 = (this._fontAtlas.x + texWidth) / width; + glyph.v1 = (y + texHeight) / height; + this._font.glyphs[char] = glyph; + for (let i = 0; i < glyph.distances.length; i++) { + const distance = glyph.distances[i]; + const dataX = i % texWidth; + const dataY = Math.floor(i / texWidth); + const offset = (this._fontAtlas.x + dataX + (y + dataY) * width) * 4; + this._fontAtlas.imageData.data[offset + 0] = distance; + this._fontAtlas.imageData.data[offset + 1] = distance; + this._fontAtlas.imageData.data[offset + 2] = distance; + this._fontAtlas.imageData.data[offset + 3] = 0xff; + } + this._fontAtlas.x += texWidth; + } + } + class GlyphRasterizer { + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._size = this._fontSize + this._border * 2; + this._size += this._border * 2; + this._gridOuter = new Float64Array(this._size * this._size); + this._gridInner = new Float64Array(this._size * this._size); + this._f = new Float64Array(this._size); + this._z = new Float64Array(this._size + 1); + this._v = new Uint16Array(this._size); + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = this._size; + this._context = canvas.getContext("2d", { willReadFrequently: true }); + this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; + this._context.textBaseline = this._baseline; + this._context.textAlign = "left"; + this._context.fillStyle = "black"; + this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); + } + draw(char) { + const textMetrics = this._context.measureText(char); + const glyphLeft = 0; + const glyphTop = Math.floor(textMetrics.actualBoundingBoxAscent); + let glyphWidth = Math.ceil(textMetrics.actualBoundingBoxRight); + let glyphHeight = Math.ceil(textMetrics.actualBoundingBoxAscent) + Math.ceil(textMetrics.actualBoundingBoxDescent); + glyphWidth = Math.min(this._size - this._border, glyphWidth); + glyphHeight = Math.min(this._size - this._border, glyphHeight); + const width = glyphWidth + 2 * this._border; + const height = glyphHeight + 2 * this._border; + const length = width * height; + const distances = new Uint8ClampedArray(length); + const gradientsX = new Uint8ClampedArray(length); + const gradientsY = new Uint8ClampedArray(length); + const pixels = new Uint8ClampedArray(length); + const glyph = new Glyph(); + glyph.char = char; + glyph.key = char.codePointAt(0); + glyph.distances = distances; + glyph.gradientsX = gradientsX; + glyph.gradientsY = gradientsY; + glyph.pixels = pixels; + glyph.width = glyphWidth; + glyph.height = glyphHeight; + glyph.top = glyphTop; + glyph.left = glyphLeft; + glyph.advance = textMetrics.width; + if (glyphWidth == 0 || glyphHeight == 0) { + return glyph; + } + this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); + this._context.fillText(char, this._border, this._border + glyphTop); + const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); + for (let i = 0; i < length; i++) { + this._gridOuter[i] = Number.MAX_VALUE; + this._gridInner[i] = 0; + } + for (let y = 0; y < glyphHeight; y++) { + for (let x = 0; x < glyphWidth; x++) { + const a = imgData.data[4 * (y * glyphWidth + x) + 3] / 0xff; + if (a > 0) { + const j = (y + this._border) * width + x + this._border; + if (a == 1) { + this._gridOuter[j] = 0; + this._gridInner[j] = Number.MAX_VALUE; + } + else { + const d = 0.5 - a; + this._gridOuter[j] = d > 0 ? d * d : 0; + this._gridInner[j] = d < 0 ? d * d : 0; + pixels[j] = 0xff; + } + } + } + } + this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); + this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width, this._f, this._v, this._z); + const distances2 = new Float32Array(length); + for (let i = 0; i < length; i++) { + const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); + distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); + distances2[i] = distance; + } + for (let i = 0; i < length; i++) { + const x = i % width; + const y = Math.floor(i / width); + const d = distances2[i]; + const sign = d < 0 ? -1 : 1; + const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; + const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; + const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; + const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; + let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; + let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; + gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); + gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); + } + return glyph; + } + _edt(data, x0, y0, width, height, gridSize, f, v, z) { + for (let x = x0; x < x0 + width; x++) + this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); + for (let y = y0; y < y0 + height; y++) + this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); + } + _edt1d(grid, offset, stride, n, f, v, z) { + v[0] = 0; + z[0] = -Number.MAX_VALUE; + z[1] = Number.MAX_VALUE; + f[0] = grid[offset]; + for (let q = 1, k = 0, s = 0; q < n; q++) { + f[q] = grid[offset + q * stride]; + const q2 = q * q; + do { + const r = v[k]; + s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; + } while (s <= z[k] && --k > -1); + k++; + v[k] = q; + z[k] = s; + z[k + 1] = Number.MAX_VALUE; + } + for (let q = 0, k = 0; q < n; q++) { + while (z[k + 1] < q) { + k++; + } + const r = v[k]; + const qr = q - r; + grid[offset + q * stride] = f[r] + qr * qr; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class ManipulationProcessor { + get manipulators() { return this._manipulators; } + get count() { return this._count; } + get isDragging() { return this._isDragging; } + constructor(core) { + this._core = core; + this._count = 0; + this._centroid = create$3(); + this._previousCentroid = create$3(); + this._relativePositionToCentroid = create$3(); + this._directionToCentroid = create$3(); + this._previousDirectionToCentroid = create$3(); + this._manipulators = {}; + this._removedManipulators = []; + this.cumulativeTranslation = create$3(); + this.translationDelta = create$3(); + this.centroid = create$3(); + this.maxScale = Number.MAX_VALUE; + this.twistAxis = fromValues$3(0, 0, 1); + this.initialize(); + } + update(elapsedTime, manipulators) { + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + if (!manipulators[manipulator.id]) { + if (this.removeManipulator) { + this.removeManipulator(manipulator); + } + this._removedManipulators.push(manipulator.id); + } + } + if (this._removedManipulators.length > 0) { + for (let i = 0; i < this._removedManipulators.length; i++) { + delete this._manipulators[this._removedManipulators[i]]; + this._count--; + } + this._removedManipulators = []; + } + for (const key in manipulators) { + const manipulator = manipulators[key]; + if (!this._manipulators[manipulator.id]) { + if (!this.addManipulator || this.addManipulator(manipulator)) { + copy$3(manipulator.initialPosition, manipulator.position); + this._manipulators[manipulator.id] = manipulator; + this._count++; + } + } + } + set$3(this.translationDelta, 0, 0, 0); + this.scaleDelta = 0; + this.twistDelta = 0; + if (this._count > 0) { + if (this._previousCount > 0) { + if (this.prepareManipulation) { + this.prepareManipulation(); + } + this._process(); + if (this.processManipulation) { + this.processManipulation(elapsedTime); + } + } + else { + this.initialize(); + if (this.beginManipulation) { + this.beginManipulation(); + } + } + } + else { + if (this._previousCount > 0) { + if (this.endManipulation) { + this.endManipulation(); + } + } + } + this._isDragging = (this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared) || this._count > 1; + this._previousCount = this._count; + } + initialize() { + set$3(this.centroid, 0, 0, 0); + set$3(this.cumulativeTranslation, 0, 0, 0); + this.cumulativeScale = 1; + this.cumulativeTwist = 0; + } + _process() { + if (this._previousCount > 0) { + let persisted = 0; + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + if (manipulator.isPersisted) { + persisted++; + } + } + const removed = this._previousCount - persisted; + if (persisted > 0) { + if (removed > 0) { + copy$3(this._centroid, this._previousCentroid); + } + else { + set$3(this._centroid, 0, 0, 0); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + if (manipulator.isPersisted) { + add(this._centroid, this._centroid, manipulator.position); + } + } + scale(this._centroid, this._centroid, 1 / persisted); + } + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + if (manipulator.isPersisted) { + manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); + add(this.translationDelta, this.translationDelta, manipulator.position); + subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); + subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); + const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); + if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) { + this.scaleDelta += 1; + } + else { + const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); + const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); + const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); + this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; + scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); + scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); + this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); + } + } + } + scale(this.translationDelta, this.translationDelta, 1 / persisted); + add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); + this.scaleDelta /= persisted; + this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); + this.scaleDelta -= 1; + this.twistDelta /= persisted; + this.cumulativeTwist += this.twistDelta; + } + } + set$3(this.centroid, 0, 0, 0); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + add(this.centroid, this.centroid, manipulator.position); + } + scale(this.centroid, this.centroid, 1 / this._count); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); + } + copy$3(this._previousCentroid, this.centroid); + for (const key in this._manipulators) { + const manipulator = this._manipulators[key]; + manipulator.isPersisted = true; + copy$3(manipulator.previousPosition, manipulator.position); + copy$3(manipulator.previousRotationAxis, manipulator.rotationAxis); + copy$3(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class MouseWheel { + constructor(core) { + this._core = core; + this._previousTotal = 0; + this.total = 0; + } + initialize(element) { + element.addEventListener("wheel", e => { + e.preventDefault(); + const wheelEvent = e; + this.total += wheelEvent.deltaY; + }, { passive: false }); + } + update(elapsedTime) { + const total = this.total; + this.delta = total - this._previousTotal; + this._previousTotal = total; + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Manipulator { + constructor() { + this.pickedIndex = 0; + this.maxTranslationSquared = 0; + this.initialPosition = create$3(); + this.position = create$3(); + this.previousPosition = create$3(); + this.holdOrigin = create$3(); + this.positionRelativeToCentroid = create$3(); + this.previousPositionRelativeToCentroid = create$3(); + this.rotationAxis = create$3(); + this.previousRotationAxis = create$3(); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Pointers { + get hoverX() { return this._hoverX; } + ; + get hoverY() { return this._hoverY; } + ; + get hoverId() { return this._hoverId; } + ; + constructor(core, manipulators) { + this._core = core; + this._manipulators = manipulators; + } + initialize(element) { + this._element = element; + element.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); + element.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); + element.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); + element.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); + element.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); + element.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); + } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); + this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); + } + } + _handlePointerDown(e) { + this._element.focus(); + const devicePixelRatio = this._core.renderer.devicePixelRatio; + const manipulator = new Manipulator(); + const id = e.pointerId; + const x = e.offsetX * devicePixelRatio; + const y = e.offsetY * devicePixelRatio; + manipulator.id = id; + manipulator.position[0] = x; + manipulator.position[1] = y; + manipulator.type = e.pointerType; + manipulator.button = e.button; + manipulator.shiftKey = e.shiftKey; + manipulator.ctrlKey = e.ctrlKey; + manipulator.altKey = e.altKey; + manipulator.event = e; + this._manipulators[id] = manipulator; + this._hoverId = id; + this._hoverX = x; + this._hoverY = y; + } + _handlePointerMove(e) { + const devicePixelRatio = this._core.renderer.devicePixelRatio; + const x = e.offsetX * devicePixelRatio; + const y = e.offsetY * devicePixelRatio; + const id = e.pointerId; + const manipulator = this._manipulators[id]; + if (manipulator) { + manipulator.position[0] = x; + manipulator.position[1] = y; + manipulator.event = e; + } + switch (e.pointerType) { + case "mouse": + this._hoverId = id; + this._hoverX = x; + this._hoverY = y; + break; + case "pen": + this._hoverId = id; + this._hoverX = x; + this._hoverY = y; + this._tiltX = e.tiltX; + this._tiltY = e.tiltY; + this._twist = e.twist; + break; + } + } + _handlePointerUp(e) { + const manipulator = this._manipulators[e.pointerId]; + if (manipulator) { + manipulator.event = e; + } + this._remove(e.pointerId); + } + _handlePointerCancel(e) { + this._remove(e.pointerId); + } + _handlePointerLeave(e) { + this._resetHover(); + this._remove(e.pointerId); + } + _handlePointerOut(e) { + this._resetHover(); + this._remove(e.pointerId); + } + _resetHover() { + this._hoverId = null; + this._hoverX = null; + this._hoverY = null; + } + _remove(pointerId) { + const manipulator = this._manipulators[pointerId]; + if (manipulator) { + delete this._manipulators[pointerId]; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AnimationHelper { + static smoothStep(value) { + return value * value * (3 - 2 * value); + } + static damp(value, target, threshold, dampening) { + if (Math.abs(target) < threshold) { + return MathHelper.lerp(value, 0, dampening); + } + else { + return MathHelper.lerp(value, target, dampening); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Keyboard { + constructor(core) { + this._core = core; + this._pressedKeys = new Set(); + this._previousPressedKeys = new Set(); + } + initialize(element) { + element.addEventListener("keydown", (e) => { this._handleKeyDown(e); }, false); + element.addEventListener("keyup", (e) => { this._handleKeyUp(e); }, false); + } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + } + } + isKeyDown(key) { + return this._pressedKeys.has(key); + } + wasKeyReleased(key) { + if (this._pressedKeys.has(key)) { + if (!this._previousPressedKeys.has(key)) { + this._previousPressedKeys.add(key); + return true; + } + } + else { + this._previousPressedKeys.delete(key); + } + return false; + } + _handleKeyDown(e) { + const keyboardEvent = e; + const key = keyboardEvent.key; + if (!this._pressedKeys.has(key)) { + this._pressedKeys.add(key); + } + } + _handleKeyUp(e) { + const keyboardEvent = e; + const key = keyboardEvent.key; + if (this._pressedKeys.has(key)) { + this._pressedKeys.delete(key); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Manager { + constructor(core) { + this._manipulators = {}; + this._core = core; + this._vec3 = create$3(); + this._manipulationProcessor = new ManipulationProcessor(core); + this._manipulators = {}; + this._pointers = new Pointers(core, this._manipulators); + this._pointers.initialize(core.container); + this._mouseWheel = new MouseWheel(core); + this._mouseWheel.initialize(core.container); + this._keyboard = new Keyboard(core); + this._keyboard.initialize(core.container); + this.isPickingEnabled = true; + this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; + this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; + this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; + this.pickHoldDelay = this._core.config.pickHoldDelay; + this.pickSelectDelay = this._core.config.pickSelectDelay; + const rightButton = 2; + this.singleTouchAction = (manipulator) => { + if ((manipulator.type == "mouse" && manipulator.button == rightButton) || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.translate; + } + else if (manipulator.altKey || (manipulator.type == "pen" && manipulator.button == rightButton)) { + return SingleTouchAction.lasso; + } + else { + return SingleTouchAction.rotate; + } + }; + this.mouseWheelAction = (keyboard) => { + if (this._keyboard.isKeyDown("Control")) { + return MouseWheelAction.rotateY; + } + else { + return MouseWheelAction.zoom; + } + }; + this.lassoPickType = PickType.data; + this._thumbstickX = 0; + this._previousControllerButtonPressed = [false, false, false, false]; + this._quat0 = create$1(); + this._quat1 = create$1(); + } + update(elapsedTime, xrFrame) { + if (xrFrame) { + const inputSources = this._core.webXRSession.inputSources; + if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { + const inputSource = inputSources[0]; + const controllerVisual = this._core.renderer.controllers[0]; + if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { + const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); + if (gripPose) { + controllerVisual.mMatrix = gripPose.transform.matrix; + } + const gamepad = inputSource.gamepad; + this._core.renderer.isPickingEnabled = false; + const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); + if (rayPose) { + controllerVisual.rayMMatrix = rayPose.transform.matrix; + if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { + this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; + this._core.renderer.isPickingEnabled = true; + } + } + const threshold = 0.2; + const dampening = Math.min(0.015 * elapsedTime, 1); + this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold, dampening); + if (this._thumbstickX != 0) { + setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); + this._core.getModelRotation(this._quat1); + multiply(this._quat1, this._quat0, this._quat1); + this._core.setModelRotation(this._quat1, true); + } + if (gamepad.buttons[2].pressed) { + if (!this._previousControllerButtonPressed[2]) { + this._previousControllerButtonPressed[2] = true; + if (this.controllerButtonPressedCallback) { + this.controllerButtonPressedCallback(2); + } + } + } + else { + this._previousControllerButtonPressed[2] = false; + } + } + } + } + else { + const camera = this._core.camera; + this._manipulationProcessor.update(elapsedTime, this._manipulators); + this._pointers.update(elapsedTime); + this._mouseWheel.update(elapsedTime); + this._keyboard.update(elapsedTime); + if (this._mouseWheel.delta != 0) { + switch (this.mouseWheelAction(this._keyboard)) { + case MouseWheelAction.zoom: + if (this._pointers.hoverX, this._pointers.hoverY) { + camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); + } + break; + case MouseWheelAction.rotateY: + setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); + camera.getOrbit(this._quat1); + multiply(this._quat1, this._quat1, this._quat0); + camera.setOrbit(this._quat1, true); + break; + } + } + const count = this._manipulationProcessor.count; + if (count == 0) { + if (this._isLassoPicking) { + this._isLassoPicking = false; + this._core.renderer.isLassoPicking = false; + const x0 = Math.min(this._lassoX0, this._lassoX1); + const y0 = Math.min(this._lassoY0, this._lassoY1); + const x1 = Math.max(this._lassoX0, this._lassoX1); + const y1 = Math.max(this._lassoY0, this._lassoY1); + if (x1 - x0 > 0 && y1 - y0 > 0) { + const sets = this._core.pickLasso(x0, y0, x1, y1, this.lassoPickType); + const result = { + x0: x0, + y0: y0, + x1: x1, + y1: y1, + pickType: this.lassoPickType, + ids: sets, + manipulator: this._manipulator, + }; + this.pickLassoCallback(result); + } + } + } + else if (count == 1) { + const translationDelta = this._manipulationProcessor.translationDelta; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + const manipulators = this._manipulationProcessor.manipulators; + for (const key in manipulators) { + const manipulator = manipulators[key]; + switch (this.singleTouchAction(manipulator)) { + case SingleTouchAction.rotate: + camera.rotate(translationDelta); + break; + case SingleTouchAction.translate: + camera.translate(translationDelta); + break; + case SingleTouchAction.lasso: + if (this.pickLassoCallback) { + if (!this._isLassoPicking) { + this._isLassoPicking = true; + this._core.renderer.isLassoPicking = true; + this._lassoX0 = manipulator.position[0]; + this._lassoY0 = manipulator.position[1]; + } + this._lassoX1 = manipulator.position[0]; + this._lassoY1 = manipulator.position[1]; + this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); + this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); + } + break; + } + break; + } + } + } + else { + const translationDelta = this._manipulationProcessor.translationDelta; + const camera = this._core.camera; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + camera.translate(translationDelta); + } + if (this._manipulationProcessor.scaleDelta != 0) { + const distance = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; + camera.zoom(distance, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + if (this._manipulationProcessor.twistDelta != 0) { + camera.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + } + if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { + const camera = this._core.camera; + const renderer = this._core.renderer; + if (renderer.isCapturingPickImage) { + camera.updatePickVMatrix(renderer.width / 2, renderer.height / 2); + renderer.pickVMatrix = camera.pickVMatrix; + renderer.isPickingEnabled = true; + this._pickedTime = 0; + } + else if (this._pointers.hoverId > -1) { + const pickingX = this._pointers.hoverX; + const pickingY = this._pointers.hoverY; + camera.updatePickVMatrix(pickingX, pickingY); + renderer.pickVMatrix = camera.pickVMatrix; + renderer.isPickingEnabled = true; + if (this._pickedId != renderer.pickedId) { + this._pickedId = renderer.pickedId; + this._pickedTime = 0; + } + else { + if (this._manipulationProcessor.count == 1) { + this._pickedTime += elapsedTime; + for (const key in this._manipulators) { + this._manipulator = this._manipulators[key]; + break; + } + } + } + if (this._pickedTime > 0) { + switch (renderer.pickedType) { + case PickType.data: + if (this._pickedTime > this.pickHoldDelay) { + renderer.getVertexPosition(this._vec3, this._pickedId); + this._core.setModelManipulationOrigin(this._vec3); + this._pickedTime = 0; + } + else if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.transitionBuffers.length; i++) { + const transitionBuffer = renderer.transitionBuffers[i]; + const id = transitionBuffer.pickIdLookup[this._pickedId]; + if (id > -1) { + const result = { + transitionBuffer: i, + id: id, + manipulator: this._manipulator, + }; + this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); + if (this.pickItemCallback) { + this.pickItemCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.label: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.labelSets.length; i++) { + const labelSet = renderer.labelSets[i].label; + const id = labelSet.pickIdLookup[this._pickedId]; + if (id > -1) { + const result = { + label: id, + set: i, + manipulator: this._manipulator, + }; + this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); + if (this.pickLabelSetCallback) { + this.pickLabelSetCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesDivision: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickGridLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickGrid(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); + if (this.pickAxesGridCallback) { + this.pickAxesGridCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesTitle: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickTitleLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickTitle(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); + if (this.pickAxesTitleCallback) { + this.pickAxesTitleCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesLabel: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickLabelLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickLabel(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); + if (this.pickAxesLabelCallback) { + this.pickAxesLabelCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesHeading: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id = axes.pickHeadingLookup[this._pickedId]; + if (id > -1) { + const result = axes.pickHeading(id); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); + if (this.pickAxesHeadingCallback) { + this.pickAxesHeadingCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + } + } + } + else { + renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } + else { + this._core.renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); + this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Log { + constructor(core) { + this._core = core; + } + write(level, value) { + if (level >= this._core.config.logLevel) { + switch (level) { + case LogLevel.trace: + console.trace(value); + break; + case LogLevel.debug: + console.debug(value); + break; + case LogLevel.info: + console.info(value); + break; + case LogLevel.warn: + console.warn(value); + break; + case LogLevel.error: + console.error(value); + break; + } + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter$3 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Core { + get container() { return this._container; } + get started() { return this._started; } + get debugText() { return this._debugText; } + get log() { return this._log; } + get totalFrames() { return this._fps.totalFrames; } + get camera() { return this._camera; } + set camera(value) { this._camera = value; } + getModelRotation(value) { copy$1(value, this._modelRotation); } + setModelRotation(value, isSmooth) { + copy$1(this._modelRotation, value); + if (!isSmooth) { + copy$1(this._smoothedModelRotation, this._modelRotation); + } + } + getModelScale() { return this._modelScale[0]; } + setModelScale(value, isSmooth) { + set$3(this._modelScale, value, value, value); + if (!isSmooth) { + copy$3(this._smoothedModelScale, this._modelScale); + } + } + getModelManipulationOrigin(value) { copy$3(value, this._modelManipulationOrigin); } + setModelManipulationOrigin(value) { this._updateManipulationOrigin(value); } + getModelPosition(value) { copy$3(value, this._modelPosition); } + setModelPosition(value, isSmooth) { + copy$3(this._modelPosition, value); + if (!isSmooth) { + copy$3(this._smoothedModelPosition, this._modelPosition); + } + } + get webXRSession() { return this._webXRSession; } + get renderer() { return this._renderer; } + set renderer(renderer) { + if (this._renderer == renderer) { + return; + } + if (this._renderer) { + this.stop(); + this._renderer.remove(); + } + if (!renderer.isInitialized) { + renderer.initialize(this); + } + if (this._renderer) { + renderer.transitionTime = this._renderer.transitionTime; + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const previousTransitionBuffer = this._renderer.transitionBuffers[i]; + const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); + transitionBuffer.copyFrom(previousTransitionBuffer); + renderer.transitionBuffers.push(transitionBuffer); + } + const currentAxes = this._renderer.currentAxes; + if (currentAxes) { + renderer.currentAxes = []; + for (let i = 0; i < currentAxes.length; i++) { + const axesVisual = currentAxes[i]; + const axes = axesVisual.axes; + if (axes instanceof Cartesian3dAxes) { + const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); + renderer.currentAxes.push(cartesian3dAxesVisual); + } + else if (axes instanceof Cartesian2dAxes) { + renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); + } + } + } + const labelSets = this._renderer.labelSets; + if (labelSets) { + renderer.labelSets = []; + for (let i = 0; i < labelSets.length; i++) { + renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); + } + } + const images = this._renderer.images; + if (images) { + renderer.images = []; + for (let i = 0; i < images.length; i++) { + renderer.images.push(renderer.createImageVisual(images[i].image)); + } + } + const fonts = this._renderer.fonts; + if (fonts) { + for (const key in fonts) { + const font = fonts[key].font; + renderer.fonts[font.name] = renderer.createFontVisual(font); + } + } + } + else { + renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); + } + if (this._renderer) { + this._renderer.finalize(); + } + this._renderer = renderer; + this._fps.reset(); + this.start(); + } + get font() { return this._font; } + get paletteResources() { return this._paletteResources; } + get config() { return this._config; } + get inputManager() { return this._inputManager; } + constructor(options) { + setMatrixArrayType(Array); + this._vec3 = create$3(); + this._quat = create$1(); + this._mat4 = create$4(); + this._container = options && options.container ? options.container : document.body; + this._config = new Config$2(this); + this._log = new Log(this); + this._debugText = new DebugText(); + this._inputManager = (options && options.useInputManager === false) ? null : new Manager(this); + const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { + fontAtlas: new FontAtlas(256, 512), + fontSize: 24, + border: 3, + fontFamily: "\"segoe ui semibold\", sans-serif", + fontWeight: "normal", + fontStyle: "normal", + baseline: "alphabetic", + maxDistance: 8, + edgeValue: 0xc0, + }; + const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); + this._font = fontRasterizer.font; + this._paletteResources = new PaletteResources(); + this._previousTime = 0; + this._fps = new Fps(this); + this._modelMMatrix = create$4(); + this._modelPosition = create$3(); + this._modelRotation = create$1(); + this._modelScale = create$3(); + this._smoothedModelPosition = create$3(); + this._smoothedModelRotation = create$1(); + this._smoothedModelScale = create$3(); + this._modelManipulationOrigin = create$3(); + this._camera = new AltAzimuthCamera(this); + this.resetModel(false); + } + getView(view) { + this.getModelPosition(view.position); + this.getModelRotation(view.rotation); + view.scale = this.getModelScale(); + } + setView(view, isSmooth) { + this.setModelPosition(view.position, isSmooth); + this.setModelRotation(view.rotation, isSmooth); + this.setModelScale(view.scale, isSmooth); + } + lerpView(from, to, time) { + lerp(this._vec3, from.position, to.position, time); + this.setModelPosition(this._vec3, false); + slerp(this._quat, from.rotation, to.rotation, time); + this.setModelRotation(this._quat, false); + this.setModelScale(MathHelper.lerp(from.scale, to.scale, time), false); + } + resetModel(isSmooth) { + set$3(this._modelPosition, 0, 0, -this._config.modelDistance); + set$3(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); + set$1(this._modelRotation, 0, 0, 0, 1); + if (!isSmooth) { + this._syncSmooth(); + } + } + resetManipulationOrigin() { + if (!exactEquals$1(this._modelManipulationOrigin, Constants.VECTOR3_ZERO)) { + this._updateManipulationOrigin(Constants.VECTOR3_ZERO); + } + } + reset(isSmooth) { + this.resetModel(isSmooth); + this.resetManipulationOrigin(); + this._camera.reset(isSmooth); + } + start() { + if (!this._started && this._renderer) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + this._started = true; + this._log.write(LogLevel.info, "render loop started"); + if (this.startCallback) { + this.startCallback(); + } + } + } + stop() { + if (this._started) { + this._started = false; + if (this._windowAnimationFrame != null) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + this._log.write(LogLevel.info, "render loop stopped"); + } + if (this.stopCallback) { + this.stopCallback(); + } + } + } + checkWebXRSupport() { + const xrSystem = navigator.xr; + if (xrSystem) { + xrSystem.isSessionSupported("immersive-vr").then((supported) => { + if (supported) { + this._log.write(LogLevel.info, "WebXR supported"); + if (this.webXRSupportedCallback) { + this.webXRSupportedCallback(); + } + } + }); + } + } + requestWebXRSession() { + if (this._webXRSession) { + this._webXRSession.end(); + } + else { + navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); + } + } + _webXRSessionStarted(session) { + if (this.webXRSessionStartedCallback) { + this.webXRSessionStartedCallback(); + } + this._webXRSession = session; + session.onend = () => this._webXRSessionEnded(); + this._renderer.initializeWebXR(session).then(() => { + if (this._windowAnimationFrame) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + } + session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + }); + session.oninputsourceschange = (event) => this._webXRInputSourcesChanged(event); + } + _webXRSessionEnded() { + if (this.webXRSessionEndedCallback) { + this.webXRSessionEndedCallback(); + } + this._webXRSession = null; + this._renderer.controllers.length = 0; + this.start(); + } + _webXRInputSourcesChanged(event) { + if (event.added.length > 0) { + const added = event.added[0]; + if (added.targetRayMode == "tracked-pointer") { + const profiles = added.profiles; + const handedness = added.handedness; + if (this.webXRInputSourceRequestCallback) { + this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { + const options = { + profiles: profiles, + handedness: handedness, + obj: response.obj, + texture: response.texture, + }; + const controller = new Controller(this, options); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + }, (e) => { + this._log.write(LogLevel.error, e); + }); + } + else { + const options = {}; + const controller = new Controller(this, options); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + } + } + } + if (event.removed.length > 0) { + this.renderer.controllers.length = 0; + } + } + _tick(currentTime, xrFrame) { + return __awaiter$3(this, void 0, void 0, function* () { + let elapsedTime = currentTime - this._previousTime; + this._previousTime = currentTime; + if (elapsedTime > 0) { + this.update(elapsedTime, xrFrame); + yield this.render(elapsedTime, xrFrame); + } + if (xrFrame) { + xrFrame.session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + } + else if (this._started) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + } + }); + } + update(elapsedTime, xrFrame) { + this._renderer.setSize(elapsedTime); + if (this.updateCallback) { + this.updateCallback(elapsedTime, xrFrame); + } + if (this._config.isDebugVisible) { + this._debugText.clear(); + } + this._fps.update(elapsedTime); + if (this._inputManager) { + this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; + this._inputManager.update(elapsedTime, xrFrame); + } + let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); + lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); + amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); + slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); + amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); + lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); + fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); + this._renderer.mMatrix = this._modelMMatrix; + if (this._config.isDebugVisible) { + this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); + this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); + this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); + this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); + this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); + this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); + this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); + } + if (!xrFrame) { + this._camera.width = this._renderer.width; + this._camera.height = this._renderer.height; + this._camera.modelMMatrix = this._modelMMatrix; + this._camera.modelPosition = this._smoothedModelPosition; + this._camera.modelRotation = this._smoothedModelRotation; + this._camera.modelScale = this._smoothedModelScale; + this._camera.modelManipulationOrigin = this._modelManipulationOrigin; + this._camera.update(elapsedTime); + this._renderer.vMatrices = this._camera.vMatrices; + this._renderer.mvMatrices = this._camera.mvMatrices; + this._renderer.pMatrices = this._camera.pMatrices; + this._renderer.inverseVMatrices = this._camera.inverseVMatrices; + this._renderer.inversePMatrices = this._camera.inversePMatrices; + } + this._renderer.prepare(xrFrame); + if (!xrFrame && this._config.stereoMode == StereoMode.none) { + this._renderer.pickPMatrix = this._camera.pMatrices[0]; + } + else { + const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); + perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); + this._renderer.pickPMatrix = this._mat4; + } + if (this._renderer.isInitialized) { + this._renderer.update(elapsedTime); + } + } + render(elapsedTime, xrFrame) { + return __awaiter$3(this, void 0, void 0, function* () { + this._fps.render(); + if (this._renderer.isInitialized) { + yield this._renderer.render(elapsedTime, xrFrame); + if (this.afterRenderCallback) { + this.afterRenderCallback(); + } + } + }); + } + _syncSmooth() { + copy$3(this._smoothedModelPosition, this._modelPosition); + copy$3(this._smoothedModelScale, this._modelScale); + copy$1(this._smoothedModelRotation, this._modelRotation); + } + _updateManipulationOrigin(position) { + this._log.write(LogLevel.info, `manipulation origin ${position[0].toFixed(3)},${position[1].toFixed(3)},${position[2].toFixed(3)}`); + this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position); + copy$3(this._modelManipulationOrigin, position); + transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); + subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); + copy$3(this._smoothedModelPosition, this._modelPosition); + if (this.manipulationOriginChangedCallback) { + const result = { + x: position[0], + y: position[1], + z: position[2], + }; + this.manipulationOriginChangedCallback(result); + } + } + pickLasso(x0, y0, x1, y1, pickType) { + const inverseMMatrix = create$4(); + invert(inverseMMatrix, this._modelMMatrix); + const sets = []; + const nearPositions = [create$3(), create$3(), create$3(), create$3()]; + const farPositions = [create$3(), create$3(), create$3(), create$3()]; + const directions = [create$3(), create$3(), create$3(), create$3()]; + this._camera.unproject(nearPositions[0], x0, y1, -1); + this._camera.unproject(farPositions[0], x0, y1, 1); + this._camera.unproject(nearPositions[1], x1, y1, -1); + this._camera.unproject(farPositions[1], x1, y1, 1); + this._camera.unproject(nearPositions[2], x1, y0, -1); + this._camera.unproject(farPositions[2], x1, y0, 1); + this._camera.unproject(nearPositions[3], x0, y0, -1); + this._camera.unproject(farPositions[3], x0, y0, 1); + for (let i = 0; i < 4; i++) { + transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); + transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); + subtract(directions[i], farPositions[i], nearPositions[i]); + normalize$2(directions[i], directions[i]); + } + const normals = [create$3(), create$3(), create$3(), create$3()]; + const d = []; + for (let i = 0; i < 4; i++) { + cross(normals[i], directions[(i + 1) % 4], directions[i]); + normalize$2(normals[i], normals[i]); + d.push(-dot$1(normals[i], nearPositions[i])); + } + if (pickType == PickType.data) { + const translation = create$3(); + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const transitionBuffer = this._renderer.transitionBuffers[i]; + const set = new Set(); + if (transitionBuffer.isVisible) { + const start = window.performance.now(); + const currentBuffer = transitionBuffer.currentBuffer; + const lookup = currentBuffer.lookup; + for (let j = 0; j < currentBuffer.length; j++) { + const id = currentBuffer.ids[j]; + const index = lookup[id]; + if (index != null) { + UnitVertex.getTranslation(currentBuffer.dataView, index, translation); + let isInside = true; + for (let k = 0; k < 4; k++) { + let distance = dot$1(normals[k], translation); + distance += d[k]; + if (distance < 0) { + isInside = false; + break; + } + } + if (isInside) { + set.add(id); + } + } + } + if (set.size > 0) { + this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set.size} ${Math.round(window.performance.now() - start)}ms`); + } + } + sets.push(set); + } + } + return sets; + } + } + const StereoMode = { + none: "none", + split: "split", + anaglyph: "anaglyph", + left: "left", + right: "right", + }; + const HorizontalAlignment = { + left: "left", + center: "center", + right: "right", + }; + const VerticalAlignment = { + top: "top", + center: "center", + bottom: "bottom", + }; + const AxesTextOrientation = { + parallel: "parallel", + perpendicular: "perpendicular", + }; + const AxesVisibility = { + none: "none", + current: "current", + previous: "previous", + }; + const PickType = { + none: 0, + data: 1, + label: 2, + axesDivision: 3, + axesTitle: 4, + axesLabel: 5, + axesHeading: 6, + }; + const Theme = { + dark: "dark", + light: "light", + }; + const HighlightMode = { + luminance: "luminance", + color: "color", + }; + const UnitType = { + block: "block", + blockSdf: "blockSdf", + sphere: "sphere", + sphereSdf: "sphereSdf", + cylinder: "cylinder", + cylinderSdf: "cylinderSdf", + hexPrism: "hexPrism", + hexPrismSdf: "hexPrismSdf", + sdf: "sdf", + disk: "disk", + ringSdf: "ringSdf"}; + const SingleTouchAction = { + translate: "translate", + rotate: "rotate", + lasso: "lasso", + }; + const MouseWheelAction = { + zoom: "zoom", + rotateY: "rotateY", + }; + const LogLevel = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4, + }; + const Edge3D = { + topFront: 0, + topRight: 1, + topBack: 2, + bottomRight: 5, + frontRight: 8, + backRight: 9}; + const RenderMode = { + color: "color"}; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let LabelSetVisual$2 = class LabelSetVisual { + render(elapsedTime, xrFrame) { } + update(elapsedTime) { } + constructor(labelSet) { + this.label = labelSet; + } + }; + class LabelBase { + get material() { return this._material; } + get vertices() { return this._vertices; } + get verticesView() { return this._verticesView; } + get indices() { return this._indices; } + get indexCount() { return this._indexCount; } + get isInitialized() { return this._isInitialized; } + get mMatrix() { return this._mMatrix; } + get materialType() { return this._materialType; } + get materialColor() { return this._materialColor; } + get materialFuzz() { return this._materialFuzz; } + get materialGloss() { return this._materialGloss; } + get segmentColor() { return this._segmentColor; } + get scale() { return this._scale; } + set scale(value) { + if (this._scale != value) { + this._scale = value; + this._hasChanged = true; + } + } + get font() { return this._font; } + set font(value) { + if (this._font != value) { + this._font = value; + this._hasChanged = true; + } + } + get rotation() { return this._rotation; } + set rotation(value) { + if (this._rotation != value) { + this._rotation = value; + this._hasChanged = true; + } + } + set reverseX(value) { + if (this._reverseX != value) { + this._reverseX = value; + this._hasChanged = true; + } + } + set reverseY(value) { + if (this._reverseY != value) { + this._reverseY = value; + this._hasChanged = true; + } + } + set reverseZ(value) { + if (this._reverseZ != value) { + this._reverseZ = value; + this._hasChanged = true; + } + } + get horizontalAlignment() { return this._horizontalAlignment; } + set horizontalAlignment(value) { + if (this._horizontalAlignment != value) { + this._horizontalAlignment = value; + this._hasChanged = true; + } + } + get verticalAlignment() { return this._verticalAlignment; } + set verticalAlignment(value) { + if (this._verticalAlignment != value) { + this._verticalAlignment = value; + this._hasChanged = true; + } + } + get offsetX() { return this._offsetX; } + set offsetX(value) { + if (this._offsetX != value) { + this._offsetX = value; + this._hasChanged = true; + } + } + get offsetY() { return this._offsetY; } + set offsetY(value) { + if (this._offsetY != value) { + this._offsetY = value; + this._hasChanged = true; + } + } + get offsetZ() { return this._offsetZ; } + set offsetZ(value) { + if (this._offsetZ != value) { + this._offsetZ = value; + this._hasChanged = true; + } + } + get maxGlyphTop() { return this._maxGlyphTop; } + set maxGlyphTop(value) { + if (this._maxGlyphTop != value) { + this._maxGlyphTop = value; + this._hasChanged = true; + } + } + get maxGlyphHeight() { return this._maxGlyphHeight; } + set maxGlyphHeight(value) { + if (this._maxGlyphHeight != value) { + this._maxGlyphHeight = value; + this._hasChanged = true; + } + } + constructor(core, options) { + this._core = core; + this._offset = create$3(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mMatrix = create$4(); + this._indexCount = 0; + this._maxGlyphs = options.maxGlyphs; + this._textMetric = { width: 0, maxHeight: 0, maxTop: 0 }; + this.scale = options.scale ? options.scale : 1; + this.offsetX = options.offsetX ? options.offsetX : 0; + this.offsetY = options.offsetY ? options.offsetY : 0; + this.offsetZ = options.offsetZ ? options.offsetZ : 0; + this.reverseX = options.reverseX; + this.reverseY = options.reverseY; + this.reverseZ = options.reverseZ; + this.rotation = options.rotation; + this.maxGlyphTop = options.maxGlyphTop; + this.horizontalAlignment = options.horizontalAlignment === undefined ? HorizontalAlignment.center : options.horizontalAlignment; + this.verticalAlignment = options.verticalAlignment === undefined ? VerticalAlignment.center : options.verticalAlignment; + this._material = options.material; + this.borderWidth = core.config.textBorderWidth; + this.gamma = 0; + this._materialType = options.materialType || 0; + this._materialColor = options.materialColor || core.config.textColor; + this._materialFuzz = options.materialFuzz || 0; + this._materialGloss = options.materialGloss || 0; + this._segmentColor = options.segmentColor; + } + initialize() { + this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); + this._verticesView = new DataView(this._vertices); + this._indices = new Uint32Array(this._maxGlyphs * 6); + this._isInitialized = true; + } + update(elapsedTime) { } + } + class LabelSet extends LabelBase { + get materials() { return this._materials; } + get materialTypes() { return this._materialTypes; } + get materialColors() { return this._materialColors; } + get materialFuzzes() { return this._materialFuzzes; } + get materialGlosses() { return this._materialGlosses; } + get segmentColors() { return this._segmentColors; } + get minBoundsX() { return this._minBoundsX; } + set minBoundsX(value) { + if (this._minBoundsX != value) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { return this._minBoundsY; } + set minBoundsY(value) { + if (this._minBoundsY != value) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get minBoundsZ() { return this._minBoundsZ; } + set minBoundsZ(value) { + if (this._minBoundsZ != value) { + this._minBoundsZ = value; + this._hasChanged = true; + } + } + get maxBoundsX() { return this._maxBoundsX; } + set maxBoundsX(value) { + if (this._maxBoundsX != value) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsY() { return this._maxBoundsY; } + set maxBoundsY(value) { + if (this._maxBoundsY != value) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsZ() { return this._maxBoundsZ; } + set maxBoundsZ(value) { + if (this._maxBoundsZ != value) { + this._maxBoundsZ = value; + this._hasChanged = true; + } + } + get positionsX() { return this._positionsX; } + set positionsX(value) { + if (this._positionsX != value) { + this._positionsX = value; + this._hasChanged = true; + } + } + get positionsY() { return this._positionsY; } + set positionsY(value) { + if (this._positionsY != value) { + this._positionsY = value; + this._hasChanged = true; + } + } + get positionsZ() { return this._positionsZ; } + set positionsZ(value) { + if (this._positionsZ != value) { + this._positionsZ = value; + this._hasChanged = true; + } + } + get positionScalingX() { return this._positionScalingX; } + set positionScalingX(value) { + if (this._positionScalingX != value) { + this._positionScalingX = value; + this._hasChanged = true; + } + } + get positionScalingY() { return this._positionScalingY; } + set positionScalingY(value) { + if (this._positionScalingY != value) { + this._positionScalingY = value; + this._hasChanged = true; + } + } + get positionScalingZ() { return this._positionScalingZ; } + set positionScalingZ(value) { + if (this._positionScalingZ != value) { + this._positionScalingZ = value; + this._hasChanged = true; + } + } + get rotations() { return this._rotations; } + set rotations(value) { + if (this._rotations != value) { + this._rotations = value; + this._hasChanged = true; + } + } + get offsetsX() { return this._offsetsX; } + set offsetsX(value) { + if (this._offsetsX != value) { + this._offsetsX = value; + this._hasChanged = true; + } + } + get offsetsY() { return this._offsetsY; } + set offsetsY(value) { + if (this._offsetsY != value) { + this._offsetsY = value; + this._hasChanged = true; + } + } + get offsetsZ() { return this._offsetsZ; } + set offsetsZ(value) { + if (this._offsetsZ != value) { + this._offsetsZ = value; + this._hasChanged = true; + } + } + get offsetScalingX() { return this._offsetScalingX; } + set offsetScalingX(value) { + if (this._offsetScalingX != value) { + this._offsetScalingX = value; + this._hasChanged = true; + } + } + get offsetScalingY() { return this._offsetScalingY; } + set offsetScalingY(value) { + if (this._offsetScalingY != value) { + this._offsetScalingY = value; + this._hasChanged = true; + } + } + get offsetScalingZ() { return this._offsetScalingZ; } + set offsetScalingZ(value) { + if (this._offsetScalingZ != value) { + this._offsetScalingZ = value; + this._hasChanged = true; + } + } + get text() { return this._text; } + set text(value) { + if (this._text != value) { + this._text = value; + this._hasChanged = true; + } + } + get horizontalAlignments() { return this._horizontalAlignments; } + set horizontalAlignments(value) { + if (this._horizontalAlignments != value) { + this._horizontalAlignments = value; + this._hasChanged = true; + } + } + get verticalAlignments() { return this._verticalAlignments; } + set verticalAlignments(value) { + if (this._verticalAlignments != value) { + this._verticalAlignments = value; + this._hasChanged = true; + } + } + get scales() { return this._scales; } + set scales(value) { + if (this._scales != value) { + this._scales = value; + this._hasChanged = true; + } + } + get scalesScaling() { return this._scalesScaling; } + set scalesScaling(value) { + if (this._scalesScaling != value) { + this._scalesScaling = value; + this._hasChanged = true; + } + } + constructor(core, options) { + super(core, options); + this._quat = create$1(); + this._materials = options.materials; + this._materialType = options.materialType; + this._materialColor = options.materialColors ? null : options.materialColor || core.config.textColor; + this._materialColors = options.materialColors; + this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; + this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; + this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; + this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; + this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; + this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; + this._font = options.font || core.font; + this.text = options.text; + this.positionsX = options.positionsX; + this.positionsY = options.positionsY; + this.positionsZ = options.positionsZ; + this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; + this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; + this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; + this.rotations = options.rotations; + this.offsetsX = options.offsetsX; + this.offsetsY = options.offsetsY; + this.offsetsZ = options.offsetsZ; + this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; + this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; + this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; + if (options.horizontalAlignments) + this.horizontalAlignments = options.horizontalAlignments; + if (options.verticalAlignments) + this.verticalAlignments = options.verticalAlignments; + if (options.scales) + this.scales = options.scales; + this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; + } + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.pickIdLookup = {}; + if (!this._text) { + this._indexCount = 0; + } + else { + const start = window.performance.now(); + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; + const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; + const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; + if (this._rotation) { + set$1(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); + } + let glyphs = 0; + for (let i = 0; i < this._text.length; i++) { + const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; + const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; + const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; + const text = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); + const scale = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; + TextHelper.measure(this._font, text, this._textMetric); + const width = this._textMetric.width * scale; + const lineHeight = this._font.size * scale; + const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale; + const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; + switch (horizontalAlignment) { + case HorizontalAlignment.left: + this._offset[0] = offsetX; + break; + case HorizontalAlignment.center: + this._offset[0] = offsetX - width / 2; + break; + case HorizontalAlignment.right: + this._offset[0] = offsetX - width; + break; + } + const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; + switch (verticalAlignment) { + case VerticalAlignment.top: + this._offset[1] = offsetY - lineHeight / 2; + break; + case VerticalAlignment.center: + this._offset[1] = offsetY; + break; + case VerticalAlignment.bottom: + this._offset[1] = offsetY + lineHeight / 2; + break; + } + this._offset[1] -= maxGlyphTop / 2; + this._offset[2] = offsetZ; + let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; + let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; + let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; + if (this._reverseX) { + positionX = this.minBoundsX + this.maxBoundsX - positionX; + } + if (this._reverseY) { + positionY = this.minBoundsY + this.maxBoundsY - positionY; + } + if (this._reverseZ) { + positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; + } + set$3(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); + if (this._rotations) { + set$1(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.label, this._vec4); + this.pickIdLookup[pickId] = i; + TextHelper.addString(this._font, text, this._verticesView, this._indices, glyphs, this._vec3, scale, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); + glyphs += text.length; + if (glyphs >= this._maxGlyphs) { + glyphs = this._maxGlyphs; + break; + } + } + this._indexCount = glyphs * 6; + this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + } + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let ImageVisual$2 = class ImageVisual { + render(elapsedTime, xrFrame) { } + update(elapsedTime) { } + constructor(image) { + this.image = image; + } + }; + class ImageBase { + get material() { return this._material; } + get vertices() { return this._vertices; } + get indices() { return this._indices; } + get indexCount() { return this._indexCount; } + get isInitialized() { return this._isInitialized; } + get mMatrix() { return this._mMatrix; } + get imageData() { return this._imageData; } + set imageData(value) { + if (this._imageData != value) { + this._imageData = value; + this._hasChanged = true; + } + } + get rotation() { return this._rotation; } + set rotation(value) { + if (!equals$1(this._rotation, value)) { + copy$1(this._rotation, value); + this._hasChanged = true; + } + } + get position() { return this._position; } + set position(value) { + if (!equals$2(this._position, value)) { + copy$3(this._position, value); + this._hasChanged = true; + } + } + get texCoord0() { return this._texCoord0; } + set texCoord0(value) { + if (!equals(this._texCoord0, value)) { + copy(this._texCoord0, value); + this._hasChanged = true; + } + } + get texCoord1() { return this._texCoord1; } + set texCoord1(value) { + if (!equals(this._texCoord1, value)) { + copy(this._texCoord1, value); + this._hasChanged = true; + } + } + get minBoundsX() { return this._minBoundsX; } + set minBoundsX(value) { + if (this._minBoundsX != value) { + this._minBoundsX = value; + this._hasChanged = true; + } + } + get minBoundsY() { return this._minBoundsY; } + set minBoundsY(value) { + if (this._minBoundsY != value) { + this._minBoundsY = value; + this._hasChanged = true; + } + } + get minBoundsZ() { return this._minBoundsZ; } + set minBoundsZ(value) { + if (this._minBoundsZ != value) { + this._minBoundsZ = value; + this._hasChanged = true; + } + } + get maxBoundsX() { return this._maxBoundsX; } + set maxBoundsX(value) { + if (this._maxBoundsX != value) { + this._maxBoundsX = value; + this._hasChanged = true; + } + } + get maxBoundsY() { return this._maxBoundsY; } + set maxBoundsY(value) { + if (this._maxBoundsY != value) { + this._maxBoundsY = value; + this._hasChanged = true; + } + } + get maxBoundsZ() { return this._maxBoundsZ; } + set maxBoundsZ(value) { + if (this._maxBoundsZ != value) { + this._maxBoundsZ = value; + this._hasChanged = true; + } + } + constructor(core, options) { + this._core = core; + this._mMatrix = create$4(); + this._origin = create$3(); + this._translation = create$3(); + this._scale = create$3(); + this._transform = create$4(); + this._imageData = options.imageData; + this._minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; + this._minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; + this._minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; + this._maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; + this._maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; + this._maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; + this._position = options.position ? clone$4(options.position) : create$3(); + this._rotation = options.rotation ? clone$2(options.rotation) : create$1(); + this._texCoord0 = options.texCoord0 ? clone$1(options.texCoord0) : fromValues(0, 0); + this._texCoord1 = options.texCoord1 ? clone$1(options.texCoord1) : fromValues(1, 1); + this._material = options.material === undefined ? -1 : options.material; + this._hasChanged = true; + } + } + class ImageQuad extends ImageBase { + get width() { return this._width; } + set width(value) { + if (this._width != value) { + this._width = value; + this._hasChanged = true; + } + } + get height() { return this._height; } + set height(value) { + if (this._height != value) { + this._height = value; + this._hasChanged = true; + } + } + constructor(core, options) { + super(core, options); + this._width = options.width === undefined ? 1 : options.width; + this._height = options.height === undefined ? 1 : options.height; + this._texTransform = create$4(); + translate(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); + scale$1(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); + } + initialize() { + this._vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); + this._indices = Quad$2.INDICES; + this._indexCount = this._indices.length; + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + set$3(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); + subtract(this._translation, this._position, this._origin); + scale(this._translation, this._translation, boundsScaling); + set$3(this._scale, this._width, this._height, 1); + scale(this._scale, this._scale, boundsScaling); + fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); + this._verticesView = Quad$2.normalTextured(this._transform, this._texTransform); + this._vertices = this._verticesView.buffer; + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class BoundsHelper { + static rotateBounds(minBounds, maxBounds, rotation, rotatedMinBounds, rotatedMaxBounds, offset) { + const sizeX = maxBounds[0] - minBounds[0]; + const sizeY = maxBounds[1] - minBounds[1]; + const sizeZ = maxBounds[2] - minBounds[2]; + const min$1 = rotatedMinBounds; + const max$1 = rotatedMaxBounds; + set$3(min$1, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$3(max$1, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const vertices = Cube.POSITIONS; + const position = create$3(); + for (let i = 0; i < 8; i++) { + set$3(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); + add(position, position, offset); + transformQuat(position, position, rotation); + subtract(position, position, offset); + min(min$1, min$1, position); + max(max$1, max$1, position); + } + add(position, minBounds, maxBounds); + scale(position, position, 0.5); + add(min$1, min$1, position); + add(max$1, max$1, position); + } + static cylinder(pa, pb, radius, minBounds, maxBounds) { + const a = create$3(); + subtract(a, pb, pa); + const aa = dot$1(a, a); + const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); + const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); + const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); + minBounds[0] = Math.min(pa[0] - ex, pb[0] - ex); + minBounds[1] = Math.min(pa[1] - ey, pb[1] - ey); + minBounds[2] = Math.min(pa[2] - ez, pb[2] - ez); + maxBounds[0] = Math.max(pa[0] + ex, pb[0] + ex); + maxBounds[1] = Math.max(pa[1] + ey, pb[1] + ey); + maxBounds[2] = Math.max(pa[2] + ez, pb[2] + ez); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class LayoutBase { + get facetScaling() { return this._facetScaling; } + offsetX(facetCoordX) { return (((facetCoordX + 0.5) / this._facetsX) - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; } + offsetY(facetCoordY) { return (((facetCoordY + 0.5) / this._facetsY) - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; } + offsetZ(facetCoordZ) { return (((facetCoordZ + 0.5) / this._facetsZ) - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; } + constructor(core) { + this._core = core; + this.modelOriginX = 0; + this.modelOriginY = 0; + this.modelOriginZ = 0; + this.minModelBoundsX = 0; + this.minModelBoundsY = 0; + this.minModelBoundsZ = 0; + this.maxModelBoundsX = 0; + this.maxModelBoundsY = 0; + this.maxModelBoundsZ = 0; + this.minLayoutBoundsX = 0; + this.minLayoutBoundsY = 0; + this.minLayoutBoundsZ = 0; + this.maxLayoutBoundsX = 0; + this.maxLayoutBoundsY = 0; + this.maxLayoutBoundsZ = 0; + this._facetSpacingX = 0; + this._facetSpacingY = 0; + this._facetSpacingZ = 0; + this._facetSizeX = 0; + this._facetSizeY = 0; + this._facetSizeZ = 0; + this._facetsX = 1; + this._facetsY = 1; + this._facetsZ = 1; + } + _updateModelBounds(options) { + this.minModelBoundsX = options.minBoundsX === undefined ? this.minLayoutBoundsX : options.minBoundsX; + this.minModelBoundsY = options.minBoundsY === undefined ? this.minLayoutBoundsY : options.minBoundsY; + this.minModelBoundsZ = options.minBoundsZ === undefined ? this.minLayoutBoundsZ : options.minBoundsZ; + this.maxModelBoundsX = options.maxBoundsX === undefined ? this.maxLayoutBoundsX : options.maxBoundsX; + this.maxModelBoundsY = options.maxBoundsY === undefined ? this.maxLayoutBoundsY : options.maxBoundsY; + this.maxModelBoundsZ = options.maxBoundsZ === undefined ? this.maxLayoutBoundsZ : options.maxBoundsZ; + this._isFacetted = + (options.facetsX !== undefined && options.facetsX > 1 && options.facetCoordsX != null) || + (options.facetsY !== undefined && options.facetsY > 1 && options.facetCoordsY != null) || + (options.facetsZ !== undefined && options.facetsZ > 1 && options.facetCoordsZ != null); + this._facetSpacingX = options.facetSpacingX === undefined ? 0 : options.facetSpacingX; + this._facetSpacingY = options.facetSpacingY === undefined ? 0 : options.facetSpacingY; + this._facetSpacingZ = options.facetSpacingZ === undefined ? 0 : options.facetSpacingZ; + let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._facetSizeX = modelSizeX; + this._facetSizeY = modelSizeY; + this._facetSizeZ = modelSizeZ; + this._facetsX = options.facetCoordsX ? options.facetsX : 1; + this._facetsY = options.facetCoordsY ? options.facetsY : 1; + this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; + this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; + this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; + this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; + this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); + this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); + this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); + this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; + this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; + this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; + modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; + this._facetScaling = maxBounds / this._maxBounds; + } + resetCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = undefined; + this.minCumulativeLayoutBoundsY = undefined; + this.minCumulativeLayoutBoundsZ = undefined; + this.maxCumulativeLayoutBoundsX = undefined; + this.maxCumulativeLayoutBoundsY = undefined; + this.maxCumulativeLayoutBoundsZ = undefined; + } + _updateCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === undefined ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); + this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === undefined ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); + this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === undefined ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); + this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === undefined ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); + this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === undefined ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); + this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === undefined ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); + } + unitToModelSize(unitSize) { + return unitSize / this._boundsScaling; + } + unitToModelPositionX(unitPositionX) { + return this.unitToModelSize(unitPositionX) + this.modelOriginX; + } + unitToModelPositionY(unitPositionY) { + return this.unitToModelSize(unitPositionY) + this.modelOriginY; + } + unitToModelPositionZ(unitPositionZ) { + return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; + } + unitToModelPosition(unitPosition, modelPosition) { + modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); + modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); + modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); + } + modelToUnitSize(modelSize) { + return modelSize * this._boundsScaling; + } + modelToUnitPositionX(modelPositionX) { + return (modelPositionX - this.modelOriginX) * this._boundsScaling; + } + modelToUnitPositionY(modelPositionY) { + return (modelPositionY - this.modelOriginY) * this._boundsScaling; + } + modelToUnitPositionZ(modelPositionZ) { + return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + } + modelToUnitPosition(modelPosition, unitPosition) { + unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); + unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); + unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); + } + inclusiveUnitBounds(buffer, ids, unitType, offset, count, minBounds, maxBounds) { + set$3(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$3(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const unitScale = create$3(); + const unitRotation = create$1(); + const unitTranslation = create$3(); + const lookup = buffer.lookup; + const dataView = buffer.dataView; + let minBounds0; + let maxBounds0; + let minBounds1; + let maxBounds1; + switch (unitType) { + case UnitType.sphere: + case UnitType.sphereSdf: + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = lookup[id]; + UnitVertex.getTranslation(dataView, index, unitTranslation); + UnitVertex.getScale(dataView, index, unitScale); + const radius = unitScale[0] / 2; + minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius); + minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius); + minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius); + maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius); + maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius); + maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius); + } + break; + case UnitType.hexPrism: + case UnitType.hexPrismSdf: + case UnitType.block: + case UnitType.blockSdf: + minBounds0 = create$3(); + maxBounds0 = create$3(); + minBounds1 = create$3(); + maxBounds1 = create$3(); + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = lookup[id]; + UnitVertex.getTranslation(dataView, index, unitTranslation); + UnitVertex.getRotation(dataView, index, unitRotation); + UnitVertex.getScale(dataView, index, unitScale); + minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; + minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; + minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; + maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; + maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; + maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; + BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants.VECTOR3_ZERO); + min(minBounds, minBounds, minBounds1); + max(maxBounds, maxBounds, maxBounds1); + } + break; + case UnitType.cylinder: + case UnitType.cylinderSdf: + minBounds0 = create$3(); + maxBounds0 = create$3(); + const pa = create$3(); + const pb = create$3(); + const identityRotation = Constants.VECTOR3_UNITY; + let ca; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = lookup[id]; + UnitVertex.getTranslation(dataView, index, unitTranslation); + UnitVertex.getRotation(dataView, index, unitRotation); + UnitVertex.getScale(dataView, index, unitScale); + const length = unitScale[1]; + const radius = Math.max(unitScale[0], unitScale[2]); + if (length != 0 && radius != 0) { + if (equals$1(unitRotation, Constants.QUAT_IDENTITY)) { + ca = identityRotation; + } + else { + ca = create$3(); + transformQuat(ca, identityRotation, unitRotation); + } + scaleAndAdd(pa, unitTranslation, ca, -length * 0.5); + scaleAndAdd(pb, unitTranslation, ca, length * 0.5); + BoundsHelper.cylinder(pa, pb, radius, minBounds0, maxBounds0); + min(minBounds, minBounds, minBounds0); + max(maxBounds, maxBounds, maxBounds0); + } + } + break; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Scatter extends LayoutBase { + layout(buffer, ids, options) { + const start = window.performance.now(); + const offset = options.offset === undefined ? 0 : options.offset; + const count = options.count === undefined ? ids.length : options.count; + const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const lookup = buffer.lookup; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = lookup[id]; + let positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; + let positionY = options.positionsY ? options.positionsY[id] * positionScalingY : 0; + let positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; + this._positions[index * 3] = positionX; + this._positions[index * 3 + 1] = positionY; + this._positions[index * 3 + 2] = positionZ; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, options) { + const start = window.performance.now(); + const offset = options.offset === undefined ? 0 : options.offset; + const count = options.count === undefined ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create(); + const _vec3 = create$3(); + const _vec4 = create$2(); + const _quat = create$1(); + const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; + const sizesX = options.sizes ? options.sizes : options.sizesX; + const sizesY = options.sizes ? options.sizes : options.sizesY; + const sizesZ = options.sizes ? options.sizes : options.sizesZ; + const minSize = options.minSize === undefined ? 0 : options.minSize; + const minColor = options.minColor === undefined ? 0 : options.minColor; + const maxColor = options.maxColor === undefined ? 1 : options.maxColor; + const minOrder = options.minOrder === undefined ? 0 : options.minOrder; + const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === undefined ? false : options.reverseX; + const reverseY = options.reverseY === undefined ? false : options.reverseY; + const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; + this._updateModelBounds(options); + if (options.rotation) { + _quat[0] = options.rotation[0]; + _quat[1] = options.rotation[1]; + _quat[2] = options.rotation[2]; + _quat[3] = options.rotation[3]; + } + else { + rotationTo(_quat, this._core.config.identityRotation, Constants.VECTOR3_UNITY); + } + if (options.texCoord) { + _vec4[0] = options.texCoord[0]; + _vec4[1] = options.texCoord[1]; + _vec4[2] = options.texCoord[2]; + _vec4[3] = options.texCoord[3]; + } + const lookup = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = lookup[id]; + let positionX = this._positions[index * 3]; + let positionY = this._positions[index * 3 + 1]; + let positionZ = this._positions[index * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } + else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index, _vec3); + _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id]) : 1) * sizeScalingX, minSize) * this._boundsScaling; + _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id]) : 1) * sizeScalingY, minSize) * this._boundsScaling; + _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; + UnitVertex.setScale(dataView, index, _vec3); + if (options.rotations) { + _quat[0] = options.rotations[id * 4]; + _quat[1] = options.rotations[id * 4 + 1]; + _quat[2] = options.rotations[id * 4 + 2]; + _quat[3] = options.rotations[id * 4 + 3]; + UnitVertex.setRotation(dataView, index, _quat); + } + else { + UnitVertex.setRotation(dataView, index, _quat); + } + if (options.colors) { + const size = 1 / (maxColor - minColor + 1); + const color = MathHelper.normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); + if (options.colors1) { + const color1 = MathHelper.normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); + set(_vec2, color, color1); + } + else { + set(_vec2, color, color); + } + UnitVertex.setColor(dataView, index, _vec2); + } + else { + UnitVertex.setColor(dataView, index, Constants.VECTOR2_ONE); + } + UnitVertex.setIdHover(dataView, index, options.hover ? options.hover[id] : id); + UnitVertex.setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); + if (options.order !== undefined) { + const order = MathHelper.normalize(options.order[id], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } + else { + _vec2[0] = count == 1 ? 0 : i / (count - 1); + } + if (options.staggerOrder !== undefined) { + _vec2[1] = options.staggerOrder; + } + else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } + else { + _vec2[1] = count == 1 ? 0 : i / (count - 1); + } + UnitVertex.setOrder(dataView, index, _vec2); + UnitVertex.setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); + UnitVertex.setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); + UnitVertex.setParameter1(dataView, index, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id] : 0); + UnitVertex.setParameter2(dataView, index, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id] : 0); + UnitVertex.setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + if (options.texCoords) { + _vec4[0] = options.texCoords[id * 4]; + _vec4[1] = options.texCoords[id * 4 + 1]; + _vec4[2] = options.texCoords[id * 4 + 2]; + _vec4[3] = options.texCoords[id * 4 + 3]; + UnitVertex.setTexCoord(dataView, index, _vec4); + } + else { + UnitVertex.setTexCoord(dataView, index, _vec4); + } + UnitVertex.setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + UnitVertex.setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id * 3], options.materialColors[id * 3 + 1], options.materialColors[id * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + UnitVertex.setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + UnitVertex.setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + UnitVertex.setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id * 4], options.segmentColors[id * 4 + 1], options.segmentColors[id * 4 + 2], options.segmentColors[id * 4 + 3]] : [buffer.idColors[id * 4], buffer.idColors[id * 4 + 1], buffer.idColors[id * 4 + 2], buffer.idColors[id * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + fromValues$3(0.2126, 0.7152, 0.0722); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + create$3(); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + create$3(); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class PathHelper { + static getFilenameWithoutExtension(path) { + const dot = path.lastIndexOf('.'); + if (dot == -1) { + return path; + } + else { + const start = path.lastIndexOf('/') == -1 ? 0 : path.lastIndexOf('/') + 1; + return path.substring(start, dot); + } + } + static getExtension(path) { + const dot = path.lastIndexOf('.'); + if (dot == -1 || dot == path.length - 1) { + return null; + } + else { + return path.substring(dot + 1, path.length); + } + } + static getFilename(path) { + if (path.lastIndexOf('/') == -1) { + return path; + } + else { + const start = path.lastIndexOf('/') + 1; + return path.substring(start, path.length); + } + } + static getPath(path) { + if (path.lastIndexOf('/') == -1) { + return ""; + } + else { + return path.substring(0, path.lastIndexOf('/')); + } + } + static combine(first, second) { + const seperator = first.lastIndexOf('/') == first.length - 1; + if (second.indexOf('/') == 0) { + if (seperator) { + return first.substring(0, first.length - 1) + second; + } + else { + return first + second; + } + } + else { + if (seperator) { + return first + second; + } + else { + return first + '/' + second; + } + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class TextureHelper { + static create(gl, width, height, format, type, filter, bytes, internalFormat = format) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, bytes); + return texture; + } + static fromImage(gl, image, mipmaps, filter) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); + if (mipmaps && MathHelper.isPowerOf2(image.width) && MathHelper.isPowerOf2(image.height)) + gl.generateMipmap(gl.TEXTURE_2D); + else { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + } + gl.bindTexture(gl.TEXTURE_2D, null); + return texture; + } + static cubemapFromImages(gl, images) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + const targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (let i = 0; i < 6; i++) { + gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + return texture; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Line extends LayoutBase { + layout(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset = options.offset === undefined ? 0 : options.offset; + const count = options.count === undefined ? ids.length : options.count; + const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; + const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; + const minSize = options.minSize === undefined ? 0 : options.minSize; + const offsetScaling = options.offsetScaling === undefined ? 1 : options.offsetScaling; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + this._sizes = new Float32Array(buffer.length * 3); + this._rotations = new Float32Array(buffer.length * 4); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const _vec3 = create$3(); + const _quat = create$1(); + const direction = create$3(); + const lookup = buffer.lookup; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const fromId = fromIds[id]; + const toId = toIds[id]; + const index = lookup[id]; + let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; + let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; + let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; + let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; + let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; + let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; + if (fromId == toId) { + this._sizes[index * 3] = 0; + this._sizes[index * 3 + 1] = 0; + this._sizes[index * 3 + 2] = 0; + this._rotations[index * 4] = 0; + this._rotations[index * 4 + 1] = 0; + this._rotations[index * 4 + 2] = 0; + this._rotations[index * 4 + 3] = 1; + } + else { + direction[0] = toPositionX - fromPositionX; + direction[1] = toPositionY - fromPositionY; + direction[2] = toPositionZ - fromPositionZ; + let length$1 = length(direction); + scale(direction, direction, 1 / length$1); + rotationTo(_quat, this._core.config.identityRotation, direction); + this._rotations[index * 4] = _quat[0]; + this._rotations[index * 4 + 1] = _quat[1]; + this._rotations[index * 4 + 2] = _quat[2]; + this._rotations[index * 4 + 3] = _quat[3]; + if (options.offsets) { + const fromOffset = options.offsets[fromId] * offsetScaling / 2; + const toOffset = options.offsets[toId] * offsetScaling / 2; + toPositionX -= direction[0] * toOffset; + toPositionY -= direction[1] * toOffset; + toPositionZ -= direction[2] * toOffset; + fromPositionX += direction[0] * fromOffset; + fromPositionY += direction[1] * fromOffset; + fromPositionZ += direction[2] * fromOffset; + length$1 = Math.max(length$1 - toOffset - fromOffset, minSize); + } + this._sizes[index * 3 + 1] = Math.max(length$1 * sizeScalingY, minSize); + if (options.lineSizes) { + this._sizes[index * 3] = Math.max(options.lineSizes[id] * sizeScalingX, minSize); + this._sizes[index * 3 + 2] = Math.max(options.lineSizes[id] * sizeScalingZ, minSize); + } + else if (options.endSizes) { + this._sizes[index * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); + this._sizes[index * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); + } + else { + this._sizes[index * 3] = sizeScalingX; + this._sizes[index * 3 + 2] = sizeScalingZ; + } + } + _vec3[0] = (fromPositionX + toPositionX) / 2; + _vec3[1] = (fromPositionY + toPositionY) / 2; + _vec3[2] = (fromPositionZ + toPositionZ) / 2; + this._positions[index * 3] = _vec3[0]; + this._positions[index * 3 + 1] = _vec3[1]; + this._positions[index * 3 + 2] = _vec3[2]; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset = options.offset === undefined ? 0 : options.offset; + const count = options.count === undefined ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create(); + const _vec3 = create$3(); + const _quat = create$1(); + const endMinColor = options.endMinColor === undefined ? 0 : options.endMinColor; + const endMaxColor = options.endMaxColor === undefined ? 1 : options.endMaxColor; + const lineMinColor = options.lineMinColor === undefined ? 0 : options.lineMinColor; + const lineMaxColor = options.lineMaxColor === undefined ? 1 : options.lineMaxColor; + const minOrder = options.minOrder === undefined ? 0 : options.minOrder; + const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === undefined ? false : options.reverseX; + const reverseY = options.reverseY === undefined ? false : options.reverseY; + const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; + this._updateModelBounds(options); + const lookup = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const fromId = fromIds[id]; + const toId = toIds[id]; + const index = lookup[id]; + let positionX = this._positions[index * 3]; + let positionY = this._positions[index * 3 + 1]; + let positionZ = this._positions[index * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } + else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index, _vec3); + _vec3[0] = this._sizes[index * 3] * this._boundsScaling; + _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; + _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; + UnitVertex.setScale(dataView, index, _vec3); + _quat[0] = this._rotations[index * 4]; + _quat[1] = this._rotations[index * 4 + 1]; + _quat[2] = this._rotations[index * 4 + 2]; + _quat[3] = this._rotations[index * 4 + 3]; + if (reverseX) { + _quat[1] = -_quat[1]; + _quat[2] = -_quat[2]; + } + if (reverseY) { + _quat[0] = -_quat[0]; + _quat[2] = -_quat[2]; + } + if (reverseZ) { + _quat[0] = -_quat[0]; + _quat[1] = -_quat[1]; + } + UnitVertex.setRotation(dataView, index, _quat); + let size; + if (options.endColors) { + size = 1 / (endMaxColor - endMinColor + 1); + const fromColor = MathHelper.normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + const toColor = MathHelper.normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + set(_vec2, fromColor, toColor); + UnitVertex.setColor(dataView, index, _vec2); + } + else if (options.lineColors) { + size = 1 / (lineMaxColor - lineMinColor + 1); + const color = MathHelper.normalize(options.lineColors[id], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); + set(_vec2, color, color); + UnitVertex.setColor(dataView, index, _vec2); + } + else { + UnitVertex.setColor(dataView, index, Constants.VECTOR2_ONE); + } + UnitVertex.setIdHover(dataView, index, options.hover ? options.hover[id] : id); + UnitVertex.setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); + if (options.order !== undefined) { + const order = MathHelper.normalize(options.order[id], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } + else { + _vec2[0] = count == 1 ? 0 : i / (count - 1); + } + if (options.staggerOrder !== undefined) { + _vec2[1] = options.staggerOrder; + } + else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } + else { + _vec2[1] = count == 1 ? 0 : i / (count - 1); + } + UnitVertex.setOrder(dataView, index, _vec2); + UnitVertex.setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); + UnitVertex.setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); + UnitVertex.setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); + UnitVertex.setMatId(dataView, index, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id] : 0); + UnitVertex.setMatColor(dataView, index, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id * 3], options.materialColors[id * 3 + 1], options.materialColors[id * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id] : 0); + UnitVertex.setMatGloss(dataView, index, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id] : 0); + UnitVertex.setMatDensity(dataView, index, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id] : 0); + UnitVertex.setSegColor(dataView, index, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id * 4], options.segmentColors[id * 4 + 1], options.segmentColors[id * 4 + 2], options.segmentColors[id * 4 + 3]] : [buffer.idColors[id * 4], buffer.idColors[id * 4 + 1], buffer.idColors[id * 4 + 2], buffer.idColors[id * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AtlasBase { + get imageData() { return this._imageData; } + set imageData(value) { + if (this._imageData != value) { + this._imageData = value; + this._changed = true; + } + } + constructor() { + this._imageData = null; + } + copyFrom(atlas) { + if (atlas.imageData) { + this._imageData = atlas.imageData; + this._changed = true; + } + else { + this.imageData = null; + } + } + update() { } + } + let Atlas$2 = class Atlas extends AtlasBase { + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class BufferBase { + get isInitialized() { return this._isInitialized; } + get ids() { return this._ids; } + get dataView() { return this._dataView; } + get vertices() { return this._vertices; } + get lookup() { return this._lookup; } + get length() { return this._length; } + get selected() { return this._selected; } + constructor(core, ids) { + this._core = core; + this._ids = ids; + this._length = ids.length; + this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); + this._dataView = new DataView(this._vertices); + this._selected = new Set(); + this.from = 0; + this.to = 1; + this.unitType = UnitType.block; + this._lookup = {}; + for (let i = 0; i < this._length; i++) { + const id = ids[i]; + this._lookup[id] = i; + UnitVertex.setRotation(this._dataView, i, Constants.QUAT_IDENTITY); + } + } + createShared() { + const buffer = Object.create(this); + buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); + buffer._dataView = new DataView(buffer._vertices); + return buffer; + } + copyFrom(buffer) { + const start = window.performance.now(); + const fromDataView = buffer.dataView; + const toDataView = this._dataView; + const lookup = buffer.lookup; + for (let i = 0; i < this._length; i++) { + const index = lookup[this._ids[i]]; + if (index != null) { + UnitVertex.copyIdHover(fromDataView, index, toDataView, i); + UnitVertex.copyTranslation(fromDataView, index, toDataView, i); + UnitVertex.copyScale(fromDataView, index, toDataView, i); + UnitVertex.copyRotation(fromDataView, index, toDataView, i); + UnitVertex.copyColor(fromDataView, index, toDataView, i); + UnitVertex.copySelected(fromDataView, index, toDataView, i); + UnitVertex.copyMaterial(fromDataView, index, toDataView, i); + UnitVertex.copyRounding(fromDataView, index, toDataView, i); + UnitVertex.copyOrder(fromDataView, index, toDataView, i); + UnitVertex.copyTexCoord(fromDataView, index, toDataView, i); + UnitVertex.copyTexture(fromDataView, index, toDataView, i); + UnitVertex.copySdfBuffer(fromDataView, index, toDataView, i); + UnitVertex.copySdfBorder(fromDataView, index, toDataView, i); + UnitVertex.copyParameter1(fromDataView, index, toDataView, i); + UnitVertex.copyParameter2(fromDataView, index, toDataView, i); + UnitVertex.copyMatId(fromDataView, index, toDataView, i); + UnitVertex.copyMatColor(fromDataView, index, toDataView, i); + UnitVertex.copyMatFuzz(fromDataView, index, toDataView, i); + UnitVertex.copyMatRefractiveIndex(fromDataView, index, toDataView, i); + UnitVertex.copyMatGloss(fromDataView, index, toDataView, i); + UnitVertex.copyMatDensity(fromDataView, index, toDataView, i); + UnitVertex.copySegColor(fromDataView, index, toDataView, i); + } + else { + UnitVertex.setRotation(toDataView, i, Constants.QUAT_IDENTITY); + } + } + this.unitType = buffer.unitType; + this._selected = buffer.selected; + this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + update() { } + updateSelection(options) { + const start = window.performance.now(); + const ids = options && options.ids ? options.ids : this._ids; + const offset = options && options.offset !== undefined ? options.offset : 0; + const count = options && options.count !== undefined ? options.count : ids.length; + const selection = this._selected.size > 0; + const dataView = this._dataView; + for (let i = 0; i < count; i++) { + const id = ids[i + offset]; + const index = this._lookup[id]; + UnitVertex.setSelected(dataView, index, selection ? this._selected.has(id) ? 1 : -1 : 0); + } + this.update(); + this._core.log.write(LogLevel.info, `buffer update selection ${count} ${Math.round(window.performance.now() - start)}ms`); + } + } + class TransitionBufferBase { + get pickIdLookup() { return this._pickIdLookup; } + get currentBuffer() { return this._isBuffer1Current ? this._buffer1 : this._buffer2; } + get previousBuffer() { return this._isBuffer1Current ? this._buffer2 : this._buffer1; } + get currentPalette() { return this._isBuffer1Current ? this._palette1 : this._palette2; } + get previousPalette() { return this._isBuffer1Current ? this._palette2 : this._palette1; } + get currentAtlas() { return this._isBuffer1Current ? this._atlas1 : this._atlas2; } + get previousAtlas() { return this._isBuffer1Current ? this._atlas2 : this._atlas1; } + get isInitialized() { return this._isInitialized; } + get length() { return this._length; } + constructor(core, ids, bufferType, paletteType, atlasType) { + this.bufferType = bufferType; + this.paletteType = paletteType; + this.atlasType = atlasType; + this._core = core; + this._length = ids.length; + this.id = TransitionBufferBase._id++; + this.isVisible = true; + this.transitionTime = 1; + this.activeId = -1; + const start = window.performance.now(); + this._buffer1 = new bufferType(core, ids); + this._buffer2 = this._buffer1.createShared(); + this._palette1 = new paletteType(); + this._palette2 = new paletteType(); + this._atlas1 = new atlasType(); + this._atlas2 = new atlasType(); + this.isPickingEnabled = true; + this._pickIdLookup = {}; + const dataView1 = this._buffer1.dataView; + const dataView2 = this._buffer2.dataView; + const _vec4 = create$2(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; + for (let i = 0; i < this._length; i++) { + const id = ids[i]; + const pickId = PickHelper.nextPickId(); + this._pickIdLookup[pickId] = id; + PickHelper.encodeNumber(pickId, PickType.data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; + UnitVertex.setIdColor(dataView1, i, _vec4); + UnitVertex.setIdColor(dataView2, i, _vec4); + } + this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + swap() { + this._isBuffer1Current = !this._isBuffer1Current; + } + copyFrom(transitionBuffer) { + const start = window.performance.now(); + this.key = transitionBuffer.key; + this.isVisible = transitionBuffer.isVisible; + this.transitionTime = transitionBuffer.transitionTime; + this.isPickingEnabled = transitionBuffer.isPickingEnabled; + this.unitType = transitionBuffer.unitType; + this.activeId = transitionBuffer.activeId; + this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); + this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); + this.currentBuffer.update(); + this.previousBuffer.update(); + this.currentPalette.copyFrom(transitionBuffer.currentPalette); + this.previousPalette.copyFrom(transitionBuffer.previousPalette); + this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); + this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); + this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + } + TransitionBufferBase._id = 1; + let Buffer$2 = class Buffer extends BufferBase { + constructor(core, ids) { + super(core, ids); + } + }; + let TransitionBuffer$2 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$2, Palette$2, Atlas$2); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class DebugAxes { + get vertices() { return this._vertices; } + get indices() { return this._indices; } + get indexCount() { return this._indexCount; } + get isInitialized() { return this._isInitialized; } + initialize() { + let vertexOffset = 0; + let indexOffset = 0; + const axisVertices = Cube.POSITIONS; + const axisIndices = Cube.INDICES; + this._vertices = new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); + const verticesView = new DataView(this._vertices); + this._indices = new Uint16Array(3 * axisIndices.length + 4); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices.length; + const transform = create$4(); + const length = 1; + const width = 0.01; + transform[0] = length; + transform[5] = width; + transform[10] = width; + transform[12] = 0.5; + transform[13] = 0; + transform[14] = 0; + this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants.VECTOR3_UNITX, transform, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices[0] + vertexOffset; + transform[0] = width; + transform[5] = length; + transform[10] = width; + transform[12] = 0; + transform[13] = 0.5; + transform[14] = 0; + this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants.VECTOR3_UNITY, transform, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices[0] + vertexOffset; + transform[0] = width; + transform[5] = width; + transform[10] = length; + transform[12] = 0; + transform[13] = 0; + transform[14] = 0.5; + this._createAxis(axisVertices, axisIndices, verticesView, this._indices, Constants.VECTOR3_UNITZ, transform, vertexOffset, indexOffset); + this._indexCount = this._indices.length; + this._isInitialized = true; + } + update(elapsedTime) { } + _createAxis(axisVertices, axisIndices, verticesView, indices, color, transform, vertexOffset, indexOffset) { + const position = create$3(); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices.length; + for (let i = 0; i < vertexCount; i++) { + set$3(position, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); + transformMat4$2(position, position, transform); + PositionColorVertex.setPosition(verticesView, vertexOffset + i, position); + PositionColorVertex.setColor(verticesView, vertexOffset + i, color); + } + for (let i = 0; i < indexCount; i++) { + indices[indexOffset + i] = axisIndices[i] + vertexOffset; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class RendererConfig { + reset() { } + } + class RendererBase { + get isInitialized() { return this._isInitialized; } + get config() { return this._config; } + get devicePixelRatio() { return this._devicePixelRatio; } + get width() { return this._canvas.width; } + set width(value) { this._options.width = value; } + get height() { return this._canvas.height; } + set height(value) { this._options.height = value; } + get webXRReferenceSpace() { return this._webXRReferenceSpace; } + get pickedType() { return this._pickedType; } + get pickedId() { return this._pickedId; } + get isCapturingPickImage() { return this._isCapturingPickImage; } + capturePickImage() { + this._isCapturingPickImage = true; + } + get backgroundColor() { return this._backgroundColor; } + set backgroundColor(value) { + if (!exactEquals(value, this._backgroundColor)) { + this._backgroundColor = value; + } + } + get ambientColor() { return this._ambientColor; } + set ambientColor(value) { + if (!exactEquals$1(value, this._ambientColor)) { + this._ambientColor = value; + } + } + get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } + set currentAxes(value) { if (this._isAxes1Current) { + this._axes1 = value; + } + else { + this._axes2 = value; + } } + get previousAxes() { return this._isAxes1Current ? this._axes2 : this._axes1; } + set previousAxes(value) { if (this._isAxes1Current) { + this._axes2 = value; + } + else { + this._axes1 = value; + } } + swapAxes() { this._isAxes1Current = !this._isAxes1Current; } + createCartesian2dAxesVisual(axes) { + return new AxesVisual(axes); + } + createCartesian3dAxesVisual(axes) { + return new AxesVisual(axes); + } + _createDebugAxesVisual(debugAxes) { return null; } + createLabelSetVisual(labelSet) { + return new LabelSetVisual$2(labelSet); + } + createControllerVisual(controller) { + return new ControllerVisual$1(controller); + } + ; + createTransitionBuffer(ids) { + return new TransitionBuffer$2(this._core, ids); + } + createImageVisual(image) { + return new ImageVisual$2(image); + } + ; + createFontVisual(font) { + return new FontVisual$2(font); + } + constructor(options) { + this._options = options; + this.fonts = {}; + } + get isWebXRSupported() { return false; } + initialize(core) { + this._core = core; + this._canvas = document.createElement("canvas"); + const contextmenu = this._options && this._options.contextmenu; + if (!contextmenu) { + this._canvas.addEventListener("contextmenu", (e) => { e.preventDefault(); }); + } + this._canvas.tabIndex = this._core.container.tabIndex; + this._canvas.style.display = "block"; + this._canvas.style.touchAction = "none"; + this._core.container.appendChild(this._canvas); + this._mvMatrices = [create$4(), create$4()]; + this.pickPMatrix = create$4(); + this.axesVisibility = AxesVisibility.current; + this._debugAxes = new DebugAxes(); + this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); + this.transitionTime = 1; + this.transitionBuffers = []; + this.areLabelsVisible = true; + this.labelSets = []; + this.controllers = []; + this.areImagesVisible = true; + this.images = []; + this._viewports = [new DOMRect(), new DOMRect()]; + this.isPickingEnabled = false; + this._pickedType = PickType.none; + this._pickedId = 0; + this._lassoMMatrix = create$4(); + this._lassoThickness = create(); + this._resizeMinimumDelay = -1; + this._previousResizeWidth = -1; + this._previousResizeHeight = -1; + } + remove() { + this._core.container.removeChild(this._canvas); + } + finalize() { + this._isInitialized = false; + } + setSize(elapsedTime) { + if (this._options && this._options.width && this._options.height) { + this._devicePixelRatio = 1; + this._resizeWidth = this._options.width; + this._resizeHeight = this._options.height; + } + else { + this._devicePixelRatio = window.devicePixelRatio || 1; + this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; + this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; + } + if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { + this._previousResizeWidth = this._resizeWidth; + this._previousResizeHeight = this._resizeHeight; + this._isResizing = true; + this._resizeElapsedTime = elapsedTime; + } + if (this._isResizing) { + if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { + this._isResizing = false; + this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; + this._resize(this._resizeWidth, this._resizeHeight); + } + else { + this._resizeElapsedTime += elapsedTime; + } + } + } + _resize(width, height) { + this._canvas.style.width = `${Math.floor(width / this._devicePixelRatio)}px`; + this._canvas.style.height = `${Math.floor(height / this._devicePixelRatio)}px`; + width = Math.floor(width); + height = Math.floor(height); + this._canvas.width = width; + this._canvas.height = height; + } + update(elapsedTime) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousPalette; + const current = transitionBuffer.currentPalette; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousAtlas; + const current = transitionBuffer.currentAtlas; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + if (this._core.config.isDebugVisible) { + if (this._debugAxesVisual) { + this._debugAxesVisual.mMatrix = this.mMatrix; + this._debugAxesVisual.vMatrices = this.vMatrices; + this._debugAxesVisual.pMatrices = this.pMatrices; + this._debugAxesVisual.viewports = this._viewports; + this._debugAxesVisual.viewportOffset = this._viewportOffset; + this._debugAxesVisual.viewportCount = this._viewportCount; + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + this.labelSets[i].label.update(elapsedTime); + labelSetVisual.mMatrix = this.mMatrix; + labelSetVisual.vMatrices = this.vMatrices; + labelSetVisual.pMatrices = this.pMatrices; + labelSetVisual.isPickingEnabled = this.isPickingEnabled; + labelSetVisual.pickPMatrix = this.pickPMatrix; + labelSetVisual.pickVMatrix = this.pickVMatrix; + labelSetVisual.viewports = this._viewports; + labelSetVisual.viewportOffset = this._viewportOffset; + labelSetVisual.viewportCount = this._viewportCount; + labelSetVisual.update(elapsedTime); + } + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual && imageVisual.isVisible) { + const image = this.images[i].image; + image.update(elapsedTime); + imageVisual.mMatrix = this.mMatrix; + imageVisual.vMatrices = this.vMatrices; + imageVisual.pMatrices = this.pMatrices; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.pickPMatrix = this.pickPMatrix; + imageVisual.pickVMatrix = this.pickVMatrix; + imageVisual.viewports = this._viewports; + imageVisual.viewportOffset = this._viewportOffset; + imageVisual.viewportCount = this._viewportCount; + imageVisual.update(elapsedTime); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + const controller = this.controllers[i].controller; + controller.update(elapsedTime); + controllerVisual.vMatrices = this.vMatrices; + controllerVisual.inverseVMatrices = this.vMatrices; + controllerVisual.pMatrices = this.pMatrices; + controllerVisual.viewports = this._viewports; + controllerVisual.viewportOffset = this._viewportOffset; + controllerVisual.viewportCount = this._viewportCount; + controllerVisual.update(elapsedTime); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + const axes = axesVisual.axes; + axes.mMatrix = this.mMatrix; + axes.vMatrix = this.vMatrices[0]; + axes.update(elapsedTime); + axesVisual.vMatrices = this.vMatrices; + axesVisual.pMatrices = this.pMatrices; + axesVisual.isPickingEnabled = this.isPickingEnabled; + axesVisual.pickPMatrix = this.pickPMatrix; + axesVisual.pickVMatrix = this.pickVMatrix; + axesVisual.viewports = this._viewports; + axesVisual.viewportOffset = this._viewportOffset; + axesVisual.viewportCount = this._viewportCount; + axesVisual.update(elapsedTime); + } + } + } + for (const key in this.fonts) { + const fontVisual = this.fonts[key]; + const font = fontVisual.font; + font.update(); + fontVisual.update(); + } + } + getVertexPosition(position, pickedId) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + const id = transitionBuffer.pickIdLookup[pickedId]; + if (id > -1) { + const index = transitionBuffer.currentBuffer.lookup[id]; + const dataView = transitionBuffer.currentBuffer.dataView; + UnitVertex.getTranslation(dataView, index, position); + break; + } + } + } + render(elapsedTime, xrFrame) { + return __awaiter$2(this, void 0, void 0, function* () { }); + } + prepare(xrFrame) { } + initializeWebXR(session) { + return null; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Quad$1 = class Quad { + get isInitialized() { return this._isInitialized; } + get vertexBuffer() { return this._vertexBuffer; } + get indexBuffer() { return this._indexBuffer; } + get indexCount() { return this._indexCount; } + initializeContext(gl) { + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$4(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Atlas$1 = class Atlas extends AtlasBase { + get texture() { return this._texture; } + get defaultTexture() { return this._defaultTexture; } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([0xff, 0xff, 0xff, 0xff])); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } + else { + this._texture = null; + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Palette$1 = class Palette extends PaletteBase { + get texture() { return this._texture; } + get defaultTexture() { return this._defaultTexture; } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._colors) { + const colors = new Uint8Array(this._colors); + for (let i = 0; i < colors.length; i++) { + colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); + } + else { + this._texture = null; + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Buffer$1 = class Buffer extends BufferBase { + get vertexBuffer() { return this._vertexBuffer; } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update() { + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + } + }; + let TransitionBuffer$1 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$1, Palette$1, Atlas$1); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Config$1 = class Config extends RendererConfig { + constructor() { + super(); + this.reset(); + } + reset() { + this.specularIntensity = 0.15; + this.specularPower = 150; + this.lightPosition = fromValues$3(-0.5, 0.5, 0); + this.ambient = 0.01; + const _quat1 = create$1(); + const _quat2 = create$1(); + let angle = AngleHelper.degreesToRadians(15); + setAxisAngle(_quat1, Constants.VECTOR3_UNITX, angle); + multiply(_quat2, _quat1, _quat2); + angle = AngleHelper.degreesToRadians(-15); + setAxisAngle(_quat1, Constants.VECTOR3_UNITY, angle); + multiply(_quat2, _quat2, _quat1); + this.directionToLight = create$3(); + transformQuat(this.directionToLight, Constants.VECTOR3_UNITZ, _quat2); + this.halfAngle = create$3(); + add(this.halfAngle, Constants.VECTOR3_UNITZ, this.directionToLight); + normalize$2(this.halfAngle, this.halfAngle); + this.isFxaaEnabled = false; + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Resources$1 = class Resources { + bindFramebuffer(framebuffer) { + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } + } + initializeContext(gl) { + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); + this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); + this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); + this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + }; + Resources$1.glsl = { + "anaglyph.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "color.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n", + "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", + "lasso.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", + "model.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", + "pickgrid.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n", + "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", + "sdftext.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n", + "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", + "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", + "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", + "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", + "unitblock.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n", + "unitblock.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unitcylinder.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", + "unitcylinder.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unithexprism.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", + "unithexprism.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n", + "unitsdf.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n", + "unitsdf.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", + "unitsphere.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", + "unitsphere.vertex.fx": "#version 100\n#include \"common.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", + "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n", + }; + let ShaderBase$1 = class ShaderBase { + get isInitialized() { return this._isInitialized; } + get vertexBuffer() { return this._vertexBuffer; } + set vertexBuffer(value) { + if (this._vertexBuffer != value) { + this._vertexBuffer = value; + this._haveBuffersChanged = true; + } + } + get indexBuffer() { return this._indexBuffer; } + set indexBuffer(value) { + if (this._indexBuffer != value) { + this._indexBuffer = value; + this._haveBuffersChanged = true; + } + } + constructor(core, main) { + this._core = core; + this._main = main; + } + initializeContext(gl) { + this._gl = gl; + } + _createProgram(vs, fs) { + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source, type) { + const shader = this._gl.createShader(type); + this._gl.shaderSource(shader, source); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; + } + _removeDirective(shaderSource, directive) { + const remove = `#define ${directive}`; + const index = shaderSource.indexOf(remove); + shaderSource = (index == -1) ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); + return shaderSource; + } + prepare() { + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); + } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } + else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); + } + } + } + apply() { } + applyModel() { } + applyView() { } + enableProgram(program) { + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; + } + updateBuffers() { + this._haveBuffersChanged = false; + } + updateTextures() { + this._haveTexturesChanged = false; + } + disableProgram() { + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; + } + _shaderFromFile(vsName, fsName, callback) { + callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); + } + _shaderFromUrl(vsName, fsName, callback) { + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); + }); + }); + }); + }); + } + _sourceFromUrl(url, callback) { + const request = new XMLHttpRequest(); + request.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request.onreadystatechange = () => { + if (request.readyState == XMLHttpRequest.DONE && request.status == 200) { + callback(request.responseText); + } + }; + request.send(); + } + _includesFromFile(source) { + let index = 0; + do { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + const inc = Resources$1.glsl[name]; + source = source.substring(0, index) + inc + source.substring(end + 1); + } + } while (index != -1); + return source; + } + _includesFromUrl(source, index, callback) { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source = source.substring(0, index) + include + source.substring(end + 1); + this._includesFromUrl(source, index, callback); + }); + } + else { + callback(source); + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Color$1 = class Color extends ShaderBase$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._colorAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Texture$1 = class Texture extends ShaderBase$1 { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Lasso$3 = class Lasso extends ShaderBase$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; + } + apply() { + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + } + applyView() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Model extends ShaderBase$1 { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + } + applyView() { + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let SdfText$1 = class SdfText extends ShaderBase$1 { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyModel() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let PickGrid$1 = class PickGrid extends ShaderBase$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + ApplyFace() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let UnitShader$1 = class UnitShader extends ShaderBase$1 { + get paletteTexture() { return this._paletteTexture; } + set paletteTexture(value) { + if (this._paletteTexture != value) { + this._paletteTexture = value; + this._haveTexturesChanged = true; + } + } + get previousPaletteTexture() { return this._previousPaletteTexture; } + set previousPaletteTexture(value) { + if (this._previousPaletteTexture != value) { + this._previousPaletteTexture = value; + this._haveTexturesChanged = true; + } + } + get sdfTexture() { return this._sdfTexture; } + set sdfTexture(value) { + if (this._sdfTexture != value) { + this._sdfTexture = value; + this._haveTexturesChanged = true; + } + } + get previousSdfTexture() { return this._previousSdfTexture; } + set previousSdfTexture(value) { + if (this._previousSdfTexture != value) { + this._previousSdfTexture = value; + this._haveTexturesChanged = true; + } + } + set instanceBuffer(value) { + if (this._instanceBuffer != value) { + this._instanceBuffer = value; + this._haveBuffersChanged = true; + } + } + set previousInstanceBuffer(value) { + if (this._previousInstanceBuffer != value) { + this._previousInstanceBuffer = value; + this._haveBuffersChanged = true; + } + } + initializeData() { + this._areBuffersInitialized = false; + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); + this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); + this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); + this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); + } + _updateCurrentBuffer() { + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); + } + _updatePreviousBuffer() { + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform1f(this._ambientUniform, this.ambient); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._activeColorUniform, this.activeColor); + this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0.0 : 1.0); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + } + updateTextures() { + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let UnitBlock$1 = class UnitBlock extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let UnitSphere$1 = class UnitSphere extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let UnitCylinder$1 = class UnitCylinder extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class UnitHexPrism extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let UnitSdf$1 = class UnitSdf extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + apply() { + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); + this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Anaglyph extends ShaderBase$1 { + get texture2D1() { return this._texture2D1; } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { return this._texture2D2; } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class DebugAxesVisual { + get isInitialized() { return this._isInitialized && this._main.colorShader.isInitialized; } + constructor(core, main, debugAxes) { + this._main = main; + this._debugAxes = debugAxes; + this.isVisible = true; + } + initializeContext(gl) { + if (!this._debugAxes.isInitialized) { + this._debugAxes.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const colorShader = this._main.colorShader; + const shaderResources = this._main.shaderResources; + colorShader.vertexBuffer = this._vertexBuffer; + colorShader.indexBuffer = this._indexBuffer; + colorShader.prepare(); + colorShader.mMatrix = this.mMatrix; + colorShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + colorShader.vMatrix = this.vMatrices[viewport]; + colorShader.pMatrix = this.pMatrices[viewport]; + colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let AxesVisualBase$1 = class AxesVisualBase { + get isInitialized() { return this._isInitialized; } + get axes() { return this._axes; } + constructor(core) { + this._core = core; + this.isVisible = true; + } + initializeContext(gl) { + this._gl = gl; + } + update(elapsedTime) { } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { } + _renderText() { } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Cartesian2dVisual$1 = class Cartesian2dVisual extends AxesVisualBase$1 { + get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { this._hasChanged = true; }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 0xff; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } + else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width, height); + } + } + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width, height); + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Cartesian3dVisual$1 = class Cartesian3dVisual extends AxesVisualBase$1 { + get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { this._hasChanged = true; }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 0xff; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } + else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width, height); + } + } + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width, height); + } + } + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class ControllerVisual { + get isInitialized() { return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; } + get controller() { return this._controller; } + constructor(core, main, controller) { + this._core = core; + this._main = main; + this._mMatrix = create$4(); + this._vec3 = create$3(); + this._controller = controller; + this._modelShader = main.modelShader; + this._colorShader = main.colorShader; + this.mMatrix = create$4(); + this.rayMMatrix = create$4(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._controller.isInitialized) { + this._controller.initialize(); + } + this._initialize(gl); + } + _initialize(gl) { + this._gl = gl; + this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); + this._modelVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); + this._modelIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); + this._rayVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); + this._rayIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._modelShader.vertexBuffer = this._modelVertexBuffer; + this._modelShader.indexBuffer = this._modelIndexBuffer; + this._modelShader.texture2D = this.modelTexture; + this._modelShader.prepare(); + multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); + this._modelShader.mMatrix = this._mMatrix; + this._modelShader.specularPower = 10; + this._modelShader.specularIntensity = 0.01; + this._modelShader.apply(); + this._modelShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._modelShader.directionToLight = Constants.VECTOR3_UNITZ; + this._modelShader.halfAngle = Constants.VECTOR3_UNITZ; + this._modelShader.vMatrix = this.vMatrices[viewport]; + this._modelShader.pMatrix = this.pMatrices[viewport]; + this._modelShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isRayVisible) { + this._colorShader.vertexBuffer = this._rayVertexBuffer; + this._colorShader.indexBuffer = this._rayIndexBuffer; + this._colorShader.prepare(); + multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); + this._colorShader.mMatrix = this._mMatrix; + this._colorShader.apply(); + this._colorShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._colorShader.vMatrix = this.vMatrices[viewport]; + this._colorShader.pMatrix = this.pMatrices[viewport]; + this._colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let ImageVisual$1 = class ImageVisual { + get isInitialized() { return this._isInitialized && this._main.textureShader.isInitialized; } + get image() { return this._image; } + constructor(core, main, image) { + this._core = core; + this._main = main; + this._image = image; + this._image.hasChangedCallback = () => { this._hasChanged = true; }; + this.mMatrix = create$4(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + const shaderResources = this._main.shaderResources; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.isPickShader = false; + textureShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + textureShader.isPickShader = true; + textureShader.vMatrix = this.pickVMatrix; + textureShader.pMatrix = this.pickPMatrix; + textureShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let LabelVisualBase$1 = class LabelVisualBase { + get isInitialized() { return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; } + constructor(core, main, label) { + this._core = core; + this._main = main; + this._label = label; + this._label.hasChangedCallback = () => { this._hasChanged = true; }; + this._mMatrix = create$4(); + this.mMatrix = create$4(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 0xff; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + } + } + } + }; + let LabelVisual$1 = class LabelVisual extends LabelVisualBase$1 { + get label() { return this._label; } + set text(value) { this._label.text = value; } + get text() { return this._label.text; } + constructor(core, main, label) { + super(core, main, label); + } + }; + let LabelSetVisual$1 = class LabelSetVisual extends LabelVisualBase$1 { + get label() { return this._label; } + constructor(core, main, label) { + super(core, main, label); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let FontVisual$1 = class FontVisual { + get isInitialized() { return this._isInitialized; } + get font() { return this._font; } + constructor(core, font) { + this._core = core; + this._font = font; + font.hasChangedCallback = () => { this._hasChanged = true; }; + } + initializeContext(gl) { + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } + } + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Lasso$2 = class Lasso { + get isInitialized() { return this._isInitialized; } + get vertexBuffer() { return this._vertexBuffer; } + get indexBuffer() { return this._indexBuffer; } + get indexCount() { return this._indexCount; } + initializeContext(gl) { + const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + let Main$1 = class Main extends RendererBase { + get shaderResources() { return this._shaderResources; } + get colorShader() { return this._colorShader; } + get textureShader() { return this._textureShader; } + get lassoShader() { return this._lassoShader; } + get modelShader() { return this._modelShader; } + get sdfTextShader() { return this._sdfTextShader; } + get gridShader() { return this._gridShader; } + get blockShader() { return this._blockShader; } + get sphereShader() { return this._sphereShader; } + get cyclinderShader() { return this._cylinderShader; } + get hexPrismShader() { return this._hexPrismShader; } + get sdfShader() { return this._sdfShader; } + get anaglyphShader() { return this._anaglyphShader; } + get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } + set currentAxes(value) { if (this._isAxes1Current) { + this._axes1 = value; + } + else { + this._axes2 = value; + } } + get previousAxes() { return this._isAxes1Current ? this._axes2 : this._axes1; } + set previousAxes(value) { if (this._isAxes1Current) { + this._axes2 = value; + } + else { + this._axes1 = value; + } } + get config() { return this._config; } + constructor(options) { + super(options); + this._config = new Config$1(); + this._quad = new Quad$1(); + this._lasso = new Lasso$2(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$2(); + this._mat3 = create$5(); + this._directionToCamera = create$3(); + this._directionToLight = create$3(); + this._halfAngle = create$3(); + this._cameraPosition = create$3(); + this._modelPosition = create$3(); + this.depthEnabled = true; + } + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; + } + get isWebXRSupported() { + return true; + } + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources$1(); + this._colorShader = new Color$1(this._core, this); + this._textureShader = new Texture$1(this._core, this); + this._lassoShader = new Lasso$3(this._core, this); + this._modelShader = new Model(this._core, this); + this._sdfTextShader = new SdfText$1(this._core, this); + this._gridShader = new PickGrid$1(this._core, this); + this._anaglyphShader = new Anaglyph(this._core, this); + this._blockShader = new UnitBlock$1(this._core, this); + this._sphereShader = new UnitSphere$1(this._core, this); + this._cylinderShader = new UnitCylinder$1(this._core, this); + this._hexPrismShader = new UnitHexPrism(this._core, this); + this._sdfShader = new UnitSdf$1(this._core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + this._isInitialized = false; + event.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; + } + _initializeContext(gl) { + this._gl = gl; + for (const key in this.fonts) { + const fontVisual = this.fonts[key]; + fontVisual.initializeContext(gl); + } + this._shaderResources.initializeContext(this._gl); + this._colorShader.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._modelShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._anaglyphShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._hexPrismShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._debugAxesVisual.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + this._anaglyphTextures = [null, null]; + this.anaglyphFramebuffers = [null, null]; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + for (let i = 0; i < this.controllers.length; i++) { + this.controllers[i].initializeContext(this._gl); + } + } + _resize(width, height) { + super._resize(width, height); + for (let i = 0; i < 2; i++) { + const texture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width, height); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._anaglyphTextures[i] = texture; + this.anaglyphFramebuffers[i] = framebuffer; + } + this._core.log.write(LogLevel.info, `buffers resized ${width},${height}`); + } + _createContext(canvas) { + const antialias = this._options ? this._options.antialias === undefined ? true : this._options.antialias : true; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; + return canvas.getContext("webgl", { + stencil: true, + alpha: true, + antialias: antialias, + preserveDrawingBuffer: preserveDrawingBuffer, + }); + } + initializeWebXR(session) { + const promise = new Promise((resolve, reject) => { + this._gl.makeXRCompatible().then(() => { + session.updateRenderState({ + baseLayer: new XRWebGLLayer(session, this._gl), + depthNear: this._core.config.nearPlane, + depthFar: this._core.config.farPlane + }); + session.requestReferenceSpace('local').then((refSpace) => { + this._webXRReferenceSpace = refSpace; + resolve(); + }); + }); + }); + return promise; + } + prepare(xrFrame) { + if (xrFrame) { + const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); + if (pose) { + const glLayer = xrFrame.session.renderState.baseLayer; + for (let i = 0; i < pose.views.length; i++) { + const view = pose.views[i]; + this.vMatrices[i] = view.transform.inverse.matrix; + this.inverseVMatrices[i] = view.transform.matrix; + multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); + this.mvMatrices[i] = this._mvMatrices[i]; + this.pMatrices[i] = view.projectionMatrix; + const viewport = glLayer.getViewport(view); + this._viewports[i].x = viewport.x; + this._viewports[i].y = viewport.y; + this._viewports[i].width = viewport.width; + this._viewports[i].height = viewport.height; + this._framebuffers[i] = glLayer.framebuffer; + } + } + this._viewportOffset = 0; + this._viewportCount = 2; + } + else { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + this._framebuffers[1] = null; + break; + case StereoMode.anaglyph: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = this.anaglyphFramebuffers[0]; + this._framebuffers[1] = this.anaglyphFramebuffers[1]; + break; + case StereoMode.split: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = this._canvas.width / 2; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = null; + this._framebuffers[1] = null; + break; + } + } + } + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer$1(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createControllerVisual(controller) { + const visual = new ControllerVisual(this._core, this, controller); + visual.initializeContext(this._gl); + return visual; + } + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + _createDebugAxesVisual(debugAxes) { + return new DebugAxesVisual(this._core, this, debugAxes); + } + _createLabelVisual(label) { + return new LabelVisual$1(this._core, this, label); + } + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual$1(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; + } + createImageVisual(image) { + const visual = new ImageVisual$1(this._core, this, image); + visual.initializeContext(this._gl); + return visual; + } + createFontVisual(font) { + const visual = new FontVisual$1(this._core, font); + visual.initializeContext(this._gl); + return visual; + } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); + } + render(elapsedTime, xrFrame) { + return __awaiter$1(this, void 0, void 0, function* () { + if (this.depthEnabled) { + this._gl.enable(this._gl.DEPTH_TEST); + } + else { + this._gl.disable(this._gl.DEPTH_TEST); + } + this._gl.enable(this._gl.CULL_FACE); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); + if (xrFrame) { + const glLayer = xrFrame.session.renderState.baseLayer; + this._shaderResources.bindFramebuffer(glLayer.framebuffer); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + else if (this._core.config.stereoMode == StereoMode.anaglyph) { + for (let i = 0; i < 2; i++) { + this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + else { + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + if (this._core.config.isDebugVisible) { + this._debugAxesVisual.framebuffers = this._framebuffers; + this._debugAxesVisual.render(elapsedTime, xrFrame); + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.framebuffers = this._framebuffers; + axesVisual.render(elapsedTime, xrFrame); + } + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(xrFrame, transitionBuffer); + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.framebuffers = this._framebuffers; + labelSetVisual.render(elapsedTime, xrFrame); + } + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.framebuffers = this._framebuffers; + imageVisual.pickFramebuffer = this._pickFrameBuffer; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.render(elapsedTime, xrFrame); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + controllerVisual.isRayVisible = this.isPickingEnabled; + controllerVisual.framebuffers = this._framebuffers; + controllerVisual.render(elapsedTime, xrFrame); + } + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$2(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + if (this._isCapturingPickImage && this.capturePickImageCallback) { + this._isCapturingPickImage = false; + const data = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); + this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data); + for (let i = 0; i < data.length / 4; i++) { + if (data[i * 4 + 3] == PickType.data) { + data[i * 4 + 3] = 255; + } + else { + data[i * 4] = 0; + data[i * 4 + 1] = 0; + data[i * 4 + 2] = 0; + data[i * 4 + 3] = 0; + } + } + const length = this._core.config.pickWidth * this._core.config.pickHeight * 4; + const row = this._core.config.pickWidth * 4; + const end = (this._core.config.pickHeight - 1) * row; + const flipped = new Uint8ClampedArray(length); + for (let i = 0; i < length; i += row) { + flipped.set(data.subarray(i, i + row), end - i); + } + this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); + } + } + else { + set$2(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = ((this.lassoX0 + lassoWidth / 2) / viewport.width) * 2 - 1; + this._lassoMMatrix[13] = 1 - ((this.lassoY0 + lassoHeight / 2) / viewport.height) * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { + this._shaderResources.bindFramebuffer(null); + this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); + this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; + this._anaglyphShader.indexBuffer = this._quad.indexBuffer; + this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; + this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; + this._anaglyphShader.prepare(); + this._anaglyphShader.viewport = this._viewports[0]; + this._anaglyphShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + }); + } + _renderTransitionBuffer(xrFrame, transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; + const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = 0; + this._blockShader.rangeMax = transitionBuffer.length - 1; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.selectedColor = this._core.config.selectionColor; + this._blockShader.hoverColor = this._core.config.hoverColor; + this._blockShader.activeColor = this._core.config.activeColor; + this._blockShader.highlightMode = this._core.config.highlightMode; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.ambient = this._config.ambient; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._blockShader.directionToLight = this._directionToLight; + this._blockShader.halfAngle = this._halfAngle; + } + else { + this._blockShader.directionToLight = this._config.directionToLight; + this._blockShader.halfAngle = this._config.halfAngle; + } + this._blockShader.vMatrix = vMatrix; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = 0; + this._sphereShader.rangeMax = transitionBuffer.length - 1; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.selectedColor = this._core.config.selectionColor; + this._sphereShader.hoverColor = this._core.config.hoverColor; + this._sphereShader.activeColor = this._core.config.activeColor; + this._sphereShader.highlightMode = this._core.config.highlightMode; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.ambient = this._config.ambient; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sphereShader.directionToLight = this._directionToLight; + this._sphereShader.halfAngle = this._halfAngle; + } + else { + this._sphereShader.directionToLight = this._config.directionToLight; + this._sphereShader.halfAngle = this._config.halfAngle; + } + this._sphereShader.vMatrix = vMatrix; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = 0; + this._cylinderShader.rangeMax = transitionBuffer.length - 1; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.selectedColor = this._core.config.selectionColor; + this._cylinderShader.hoverColor = this._core.config.hoverColor; + this._cylinderShader.activeColor = this._core.config.activeColor; + this._cylinderShader.highlightMode = this._core.config.highlightMode; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.ambient = this._config.ambient; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._cylinderShader.directionToLight = this._directionToLight; + this._cylinderShader.halfAngle = this._halfAngle; + } + else { + this._cylinderShader.directionToLight = this._config.directionToLight; + this._cylinderShader.halfAngle = this._config.halfAngle; + } + this._cylinderShader.vMatrix = vMatrix; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { + this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; + this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._hexPrismShader.prepare(); + this._hexPrismShader.mMatrix = this.mMatrix; + this._hexPrismShader.time = this.transitionTime; + this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._hexPrismShader.rangeMin = 0; + this._hexPrismShader.rangeMax = transitionBuffer.length - 1; + this._hexPrismShader.hover = hoverId; + this._hexPrismShader.active = activeId; + this._hexPrismShader.selectedColor = this._core.config.selectionColor; + this._hexPrismShader.hoverColor = this._core.config.hoverColor; + this._hexPrismShader.activeColor = this._core.config.activeColor; + this._hexPrismShader.highlightMode = this._core.config.highlightMode; + this._hexPrismShader.specularPower = this._config.specularPower; + this._hexPrismShader.specularIntensity = this._config.specularIntensity; + this._hexPrismShader.ambient = this._config.ambient; + this._hexPrismShader.apply(); + this._hexPrismShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._hexPrismShader.directionToLight = this._directionToLight; + this._hexPrismShader.halfAngle = this._halfAngle; + } + else { + this._hexPrismShader.directionToLight = this._config.directionToLight; + this._hexPrismShader.halfAngle = this._config.halfAngle; + } + this._hexPrismShader.vMatrix = vMatrix; + this._hexPrismShader.pMatrix = this.pMatrices[viewport]; + this._hexPrismShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._hexPrismShader.isPickShader = true; + this._hexPrismShader.pMatrix = this.pickPMatrix; + this._hexPrismShader.vMatrix = this.pickVMatrix; + this._hexPrismShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = 0; + this._sdfShader.rangeMax = transitionBuffer.length - 1; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.selectedColor = this._core.config.selectionColor; + this._sdfShader.hoverColor = this._core.config.hoverColor; + this._sdfShader.activeColor = this._core.config.activeColor; + this._sdfShader.highlightMode = this._core.config.highlightMode; + this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 0xff; + this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.ambient = this._config.ambient; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sdfShader.directionToLight = this._directionToLight; + this._sdfShader.halfAngle = this._halfAngle; + } + else { + this._sdfShader.directionToLight = this._config.directionToLight; + this._sdfShader.halfAngle = this._config.halfAngle; + } + this._sdfShader.vMatrix = vMatrix; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Quad { + get isInitialized() { return this._isInitialized; } + get vertexBuffer() { return this._vertexBuffer; } + get indexBuffer() { return this._indexBuffer; } + get indexCount() { return this._indexCount; } + initializeContext(gl) { + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$4(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Atlas extends AtlasBase { + get texture() { return this._texture; } + get defaultTexture() { return this._defaultTexture; } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([0xff, 0xff, 0xff, 0xff])); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } + else { + this._texture = null; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Palette extends PaletteBase { + get texture() { return this._texture; } + get defaultTexture() { return this._defaultTexture; } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); + } + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } + } + _updateTexture() { + if (this._colors) { + const colors = new Uint8Array(this._colors); + for (let i = 0; i < colors.length; i++) { + colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); + } + else { + this._texture = null; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Buffer extends BufferBase { + get vertexBuffer() { return this._vertexBuffer; } + constructor(core, ids) { + super(core, ids); + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update() { + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + } + } + class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer, Palette, Atlas); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Config extends RendererConfig { + get keyLightAltitude() { return this._keyLightAltitude; } + set keyLightAltitude(value) { + this._keyLightAltitude = value; + this._updateLights(); + } + get keyLightAzimuth() { return this._keyLightAzimuth; } + set keyLightAzimuth(value) { + this._keyLightAzimuth = value; + this._updateLights(); + } + get keyLightDistance() { return this._keyLightDistance; } + set keyLightDistance(value) { + this._keyLightDistance = value; + this._updateLights(); + } + get fillLight1Altitude() { return this._fillLight1Altitude; } + set fillLight1Altitude(value) { + this._fillLight1Altitude = value; + this._updateLights(); + } + get fillLight1Azimuth() { return this._fillLight1Azimuth; } + set fillLight1Azimuth(value) { + this._fillLight1Azimuth = value; + this._updateLights(); + } + get fillLight2Altitude() { return this._fillLight2Altitude; } + set fillLight2Altitude(value) { + this._fillLight2Altitude = value; + this._updateLights(); + } + get fillLight2Azimuth() { return this._fillLight2Azimuth; } + set fillLight2Azimuth(value) { + this._fillLight2Azimuth = value; + this._updateLights(); + } + constructor() { + super(); + this._rotation = create$1(); + this.keyLightPosition = create$3(); + this.fillLight1Position = create$3(); + this.fillLight2Position = create$3(); + this.reset(); + } + _updateLights() { + this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); + this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); + this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); + } + _updateLight(altitude, azimuth, distance, position) { + rotateY(this._rotation, Constants.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); + rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); + transformQuat(position, Constants.VECTOR3_UNITZ, this._rotation); + scale(position, position, distance); + } + reset() { + this.isSsaoEnabled = true; + this.ssaoWidth = 1024; + this.ssaoHeight = 1024; + this.ssaoBlurEnabled = true; + this.ssaoKernelSize = 8; + this.ssaoNoiseSize = 4; + this.ssaoRadius = 0.02; + this.ssaoPower = 1; + this.isShadowEnabled = true; + this.shadowWidth = 1024; + this.shadowHeight = 1024; + this.isDofEnabled = false; + this.dofAutoFocus = true; + this.dofFocusDistance = 0.5; + this.dofFocusRange = 0.5; + this.dofMaxBackgroundBlur = 0.75; + this.isBloomEnabled = false; + this.bloomIntensity = 2; + this.specularIntensity = 0.15; + this.specularPower = 150; + this.ambientIntensity = 0.1; + this.materialIntensity = 0.5; + this.keyLightIntensity = 1.5; + this.fillLight1Intensity = 0.25; + this.fillLight2Intensity = 0.25; + this._keyLightAltitude = 30; + this._keyLightAzimuth = -45; + this._keyLightDistance = 1; + this._fillLight1Altitude = 30; + this._fillLight1Azimuth = 45; + this._fillLight2Altitude = 30; + this._fillLight2Azimuth = -135; + this._updateLights(); + this.isFxaaEnabled = false; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Resources { + bindFramebuffer(framebuffer) { + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } + } + initializeContext(gl) { + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.OES_texture_float = gl.getExtension("OES_texture_float"); + this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + } + Resources.glsl = { + "background.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n", + "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", + "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", + "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", + "deferred.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n", + "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", + "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", + "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", + "fxaa.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n", + "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", + "lasso.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", + "pickgrid.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n", + "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", + "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", + "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", + "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", + "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", + "texture.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n", + "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", + "unitblock.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", + "unitblock.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unitcylinder.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", + "unitcylinder.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", + "unitsdf.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n", + "unitsdf.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", + "unitsphere.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", + "unitsphere.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", + "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.x+rd.x*h)<size.x ) t = h;\n}\n}\n{\nfloat a = dd.z + dd.x;\nfloat b = od.z + od.x;\nfloat c = oo.z + oo.x - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.y+rd.y*h)<size.y ) t = h;\n}\n}\n{\nfloat a = dd.x + dd.y;\nfloat b = od.x + od.y;\nfloat c = oo.x + oo.y - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.z+rd.z*h)<size.z ) t = h;\n}\n}\nif( t>1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", + "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n", + }; + class ShaderBase { + get isInitialized() { return this._isInitialized; } + get vertexBuffer() { return this._vertexBuffer; } + set vertexBuffer(value) { + if (this._vertexBuffer != value) { + this._vertexBuffer = value; + this._haveBuffersChanged = true; + } + } + get indexBuffer() { return this._indexBuffer; } + set indexBuffer(value) { + if (this._indexBuffer != value) { + this._indexBuffer = value; + this._haveBuffersChanged = true; + } + } + constructor(core, main) { + this._core = core; + this._main = main; + } + initializeContext(gl) { + this._gl = gl; + } + _createProgram(vs, fs) { + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source, type) { + const shader = this._gl.createShader(type); + this._gl.shaderSource(shader, source); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; + } + _removeDirective(shaderSource, directive) { + const remove = `#define ${directive}`; + const index = shaderSource.indexOf(remove); + shaderSource = (index == -1) ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); + return shaderSource; + } + prepare() { + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); + } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } + else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); + } + } + } + apply() { } + applyModel() { } + applyView() { } + enableProgram(program) { + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; + } + updateBuffers() { + this._haveBuffersChanged = false; + } + updateTextures() { + this._haveTexturesChanged = false; + } + disableProgram() { + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; + } + _shaderFromFile(vsName, fsName, callback) { + callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + } + _shaderFromUrl(vsName, fsName, callback) { + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); + }); + }); + }); + }); + } + _sourceFromUrl(url, callback) { + const request = new XMLHttpRequest(); + request.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request.onreadystatechange = () => { + if (request.readyState == XMLHttpRequest.DONE && request.status == 200) { + callback(request.responseText); + } + }; + request.send(); + } + _includesFromFile(source) { + let index = 0; + do { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + const inc = Resources.glsl[name]; + source = source.substring(0, index) + inc + source.substring(end + 1); + } + } while (index != -1); + return source; + } + _includesFromUrl(source, index, callback) { + index = source.indexOf("#include", index); + if (index != -1) { + const start = source.indexOf("\"", index); + const end = source.indexOf("\"", start + 1); + const name = source.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source = source.substring(0, index) + include + source.substring(end + 1); + this._includesFromUrl(source, index, callback); + }); + } + else { + callback(source); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Texture extends ShaderBase { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let Lasso$1 = class Lasso extends ShaderBase { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; + } + apply() { + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + } + applyView() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class SdfText extends ShaderBase { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyModel() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class PickGrid extends ShaderBase { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + } + applyView() { + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + ApplyFace() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class UnitShader extends ShaderBase { + get paletteTexture() { return this._paletteTexture; } + set paletteTexture(value) { + if (this._paletteTexture != value) { + this._paletteTexture = value; + this._haveTexturesChanged = true; + } + } + get previousPaletteTexture() { return this._previousPaletteTexture; } + set previousPaletteTexture(value) { + if (this._previousPaletteTexture != value) { + this._previousPaletteTexture = value; + this._haveTexturesChanged = true; + } + } + get sdfTexture() { return this._sdfTexture; } + set sdfTexture(value) { + if (this._sdfTexture != value) { + this._sdfTexture = value; + this._haveTexturesChanged = true; + } + } + get previousSdfTexture() { return this._previousSdfTexture; } + set previousSdfTexture(value) { + if (this._previousSdfTexture != value) { + this._previousSdfTexture = value; + this._haveTexturesChanged = true; + } + } + set instanceBuffer(value) { + if (this._instanceBuffer != value) { + this._instanceBuffer = value; + this._haveBuffersChanged = true; + } + } + set previousInstanceBuffer(value) { + if (this._previousInstanceBuffer != value) { + this._previousInstanceBuffer = value; + this._haveBuffersChanged = true; + } + } + initializeData() { + this._areBuffersInitialized = false; + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); + } + _updateCurrentBuffer() { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); + } + _updatePreviousBuffer() { + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); + } + updateTextures() { + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._translationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); + this._gl.vertexAttribDivisor(this._scaleAttribute, 0); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); + this._gl.vertexAttribDivisor(this._colorAttribute, 0); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); + this._gl.vertexAttribDivisor(this._selectedAttribute, 0); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); + this._gl.vertexAttribDivisor(this._orderAttribute, 0); + this._gl.vertexAttribDivisor(this._idAttribute, 0); + this._gl.vertexAttribDivisor(this._idColorAttribute, 0); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class UnitBlock extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class UnitSphere extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class UnitCylinder extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class UnitSdf extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + apply() { + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Background extends ShaderBase { + constructor(core, main) { + super(core, main); + this._quad = new Quad(); + } + initializeContext(gl) { + super.initializeContext(gl); + this._quad.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._isInitialized = true; + this._vao = gl.createVertexArray(); + gl.bindVertexArray(this._vao); + gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); + gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + gl.enableVertexAttribArray(this._positionAttribute); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); + gl.bindVertexArray(null); + } + apply() { + this._gl.uniform3fv(this._colorUniform, this.color); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindVertexArray(this._vao); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Ssao extends ShaderBase { + get texture2D1() { return this._texture2D1; } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { return this._texture2D2; } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { return this._texture2D3; } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); + this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); + this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); + this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); + this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); + this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); + this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); + } + applyView() { + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Box extends ShaderBase { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Deferred extends ShaderBase { + get texture2D1() { return this._texture2D1; } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { return this._texture2D2; } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { return this._texture2D3; } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + get texture2D4() { return this._texture2D4; } + set texture2D4(value) { + if (this._texture2D4 != value) { + this._texture2D4 = value; + this._haveTexturesChanged = true; + } + } + get texture2D5() { return this._texture2D5; } + set texture2D5(value) { + if (this._texture2D5 != value) { + this._texture2D5 = value; + this._haveTexturesChanged = true; + } + } + constructor(core, main) { + super(core, main); + this.directionToKeyLight = create$3(); + this.directionToFillLight1 = create$3(); + this.directionToFillLight2 = create$3(); + this.keyLightHalfAngle = create$3(); + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); + this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); + this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); + this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); + this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); + this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); + this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); + this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); + this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); + this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); + this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); + this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); + this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); + this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); + this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); + this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); + this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); + this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); + this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); + this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); + this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); + this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); + this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); + this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); + this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Combine extends ShaderBase { + get texture2D1() { return this._texture2D1; } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { return this._texture2D2; } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { return this._texture2D3; } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + get texture2D4() { return this._texture2D4; } + set texture2D4(value) { + if (this._texture2D4 != value) { + this._texture2D4 = value; + this._haveTexturesChanged = true; + } + } + get texture2D5() { return this._texture2D5; } + set texture2D5(value) { + if (this._texture2D5 != value) { + this._texture2D5 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1f(this._intensityUniform, this.intensity); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + } + updateBuffers() { + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class DofBlur extends ShaderBase { + get texture2D1() { return this._texture2D1; } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { return this._texture2D2; } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); + this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); + this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); + this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); + this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Downsample extends ShaderBase { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Gaussian extends ShaderBase { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class DofCombine extends ShaderBase { + get texture2D1() { return this._texture2D1; } + set texture2D1(value) { + if (this._texture2D1 != value) { + this._texture2D1 = value; + this._haveTexturesChanged = true; + } + } + get texture2D2() { return this._texture2D2; } + set texture2D2(value) { + if (this._texture2D2 != value) { + this._texture2D2 = value; + this._haveTexturesChanged = true; + } + } + get texture2D3() { return this._texture2D3; } + set texture2D3(value) { + if (this._texture2D3 != value) { + this._texture2D3 = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._apertureUniform, this.aperture); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Fxaa extends ShaderBase { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; + } + apply() { + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Bright extends ShaderBase { + get texture2D() { return this._texture2D; } + set texture2D(value) { + if (this._texture2D != value) { + this._texture2D = value; + this._haveTexturesChanged = true; + } + } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } + else { + this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._isInitialized = true; + } + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + } + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AxesVisualBase { + get isInitialized() { return this._isInitialized; } + get axes() { return this._axes; } + constructor(core) { + this._core = core; + this.isVisible = true; + } + initializeContext(gl) { + this._gl = gl; + } + update(elapsedTime) { } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { } + _renderText() { } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Cartesian2dVisual extends AxesVisualBase { + get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { this._hasChanged = true; }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 0xff; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } + else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + _renderGrid() { + const gridShader = this._main.gridShader; + const axes = this._axes; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width, height); + } + } + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width, height); + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Cartesian3dVisual extends AxesVisualBase { + get isInitialized() { return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { this._hasChanged = true; }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } + else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } + } + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 0xff; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if ((orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId)) || (orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId))) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } + else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + } + } + } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width = gridTicksScale[0]; + const height = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width, height); + } + } + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width = size[axisId2]; + const height = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width, height); + } + } + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + } + _renderGridFace(faceId, width, height) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width; + gridShader.faceHeight = height; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class FontVisual { + get isInitialized() { return this._isInitialized; } + get font() { return this._font; } + constructor(core, font) { + this._core = core; + this._font = font; + font.hasChangedCallback = () => { this._hasChanged = true; }; + } + initializeContext(gl) { + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } + } + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class LabelVisualBase { + get isInitialized() { return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; } + constructor(core, main, label) { + this._core = core; + this._main = main; + this._label = label; + this._label.hasChangedCallback = () => { this._hasChanged = true; }; + this._mMatrix = create$4(); + this.mMatrix = create$4(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 0xff; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + } + } + class LabelVisual extends LabelVisualBase { + get label() { return this._label; } + set text(value) { this._label.text = value; } + get text() { return this._label.text; } + constructor(core, main, label) { + super(core, main, label); + } + } + class LabelSetVisual extends LabelVisualBase { + get label() { return this._label; } + constructor(core, main, label) { + super(core, main, label); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class ImageVisual { + get isInitialized() { return this._isInitialized && this._main.textureShader.isInitialized; } + get image() { return this._image; } + constructor(core, main, image) { + this._core = core; + this._main = main; + this._image = image; + this._image.hasChangedCallback = () => { this._hasChanged = true; }; + this.mMatrix = create$4(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.apply(); + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Lasso { + get isInitialized() { return this._isInitialized; } + get vertexBuffer() { return this._vertexBuffer; } + get indexBuffer() { return this._indexBuffer; } + get indexCount() { return this._indexCount; } + initializeContext(gl) { + const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Main extends RendererBase { + get shaderResources() { return this._shaderResources; } + get textureShader() { return this._textureShader; } + get lassoShader() { return this._lassoShader; } + get sdfTextShader() { return this._sdfTextShader; } + get gridShader() { return this._gridShader; } + get blockShader() { return this._blockShader; } + get sphereShader() { return this._sphereShader; } + get cyclinderShader() { return this._cylinderShader; } + get sdfShader() { return this._sdfShader; } + get currentAxes() { return this._isAxes1Current ? this._axes1 : this._axes2; } + set currentAxes(value) { if (this._isAxes1Current) { + this._axes1 = value; + } + else { + this._axes2 = value; + } } + get previousAxes() { return this._isAxes1Current ? this._axes2 : this._axes1; } + set previousAxes(value) { if (this._isAxes1Current) { + this._axes2 = value; + } + else { + this._axes1 = value; + } } + get config() { return this._config; } + constructor(options) { + super(options); + this._config = new Config(); + this._quad = new Quad(); + this._lasso = new Lasso(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$2(); + this._position = create$3(); + this._direction = create$3(); + this._cameraRotation = create$5(); + this._cameraPosition = create$3(); + this._modelPosition = create$3(); + this._modelManipulationOrigin = create$3(); + this._shadowVMatrix = create$4(); + this._shadowPMatrix = create$4(); + } + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; + } + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources(); + this._textureShader = new Texture(core, this); + this._lassoShader = new Lasso$1(core, this); + this._sdfTextShader = new SdfText(core, this); + this._gridShader = new PickGrid(core, this); + this._blockShader = new UnitBlock(core, this); + this._sphereShader = new UnitSphere(core, this); + this._cylinderShader = new UnitCylinder(core, this); + this._sdfShader = new UnitSdf(core, this); + this._backgroundShader = new Background(core, this); + this._ssaoShader = new Ssao(core, this); + this._boxShader = new Box(core, this); + this._deferredShader = new Deferred(core, this); + this._combineShader = new Combine(core, this); + this._dofBlurShader = new DofBlur(core, this); + this._downsampleShader = new Downsample(core, this); + this._gaussianShader = new Gaussian(core, this); + this._dofCombineShader = new DofCombine(core, this); + this._fxaaShader = new Fxaa(core, this); + this._brightPassShader = new Bright(core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + event.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; + } + _initializeContext(gl) { + this._gl = gl; + for (const key in this.fonts) { + const fontVisual = this.fonts[key]; + fontVisual.initializeContext(gl); + } + this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); + const random = new PseudoRandom(0); + const _vec3 = create$3(); + for (let i = 0; i < this._config.ssaoKernelSize; i++) { + _vec3[0] = random.nextFloat() * 2 - 1; + _vec3[1] = random.nextFloat() * 2 - 1; + _vec3[2] = random.nextFloat(); + normalize$2(_vec3, _vec3); + scale(_vec3, _vec3, random.nextFloat()); + let scale$1 = i / this._config.ssaoKernelSize; + scale$1 = MathHelper.lerp(0.1, 1, scale$1 * scale$1); + scale(_vec3, _vec3, scale$1); + this._ssaoSampleKernel[i * 3] = _vec3[0]; + this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; + this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; + } + const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); + _vec3[2] = 0; + for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { + _vec3[0] = random.nextFloat() * 2 - 1; + _vec3[1] = random.nextFloat() * 2 - 1; + normalize$2(_vec3, _vec3); + noise[i * 4] = _vec3[0]; + noise[i * 4 + 1] = _vec3[1]; + } + this._ssaoNoiseTexture = this._gl.createTexture(); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); + this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); + this._ssaoWidth = -1; + this._ssaoHeight = -1; + this._shadowWidth = -1; + this._shadowHeight = -1; + this._shaderResources.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._backgroundShader.initializeContext(this._gl); + this._ssaoShader.initializeContext(this._gl); + this._boxShader.initializeContext(this._gl); + this._deferredShader.initializeContext(this._gl); + this._combineShader.initializeContext(this._gl); + this._dofBlurShader.initializeContext(this._gl); + this._downsampleShader.initializeContext(this._gl); + this._gaussianShader.initializeContext(this._gl); + this._dofCombineShader.initializeContext(this._gl); + this._fxaaShader.initializeContext(this._gl); + this._brightPassShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + } + _resize(width, height) { + super._resize(width, height); + this._positionTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); + this._colorTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._normalTexture = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._geometryFrameBuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width, height); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._gl.drawBuffers([this._gl.COLOR_ATTACHMENT0, this._gl.COLOR_ATTACHMENT1, this._gl.COLOR_ATTACHMENT2]); + this._postProcessTexture1 = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessDepthTexture = TextureHelper.create(this._gl, width, height, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); + this._postProcessTexture2 = TextureHelper.create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); + this._postProcessDofTexture = TextureHelper.create(this._gl, width, height, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); + this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); + const widthHalf = Math.round(width / 2); + const heightHalf = Math.round(height / 2); + this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); + this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); + this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); + this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); + const widthSixteenth = Math.round(widthEighth / 2); + const hgeightSixteenth = Math.round(heightEighth / 2); + this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); + this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); + this._core.log.write(LogLevel.info, `buffers resized ${width},${height}`); + } + _createContext(canvas) { + let supported = false; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; + const options = { + stencil: true, + alpha: false, + antialias: false, + preserveDrawingBuffer: preserveDrawingBuffer, + }; + const gl = canvas.getContext("webgl2", options); + if (gl) { + const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); + if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { + const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); + const framebuffer = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + if (status == gl.FRAMEBUFFER_COMPLETE) { + supported = true; + } + gl.bindTexture(gl.TEXTURE_2D, null); + } + } + return supported ? gl : null; + } + prepare() { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + break; + } + } + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + _createLabelVisual(label) { + return new LabelVisual(this._core, this, label); + } + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; + } + createImageVisual(image) { + const visual = new ImageVisual(this._core, this, image); + visual.initializeContext(this._gl); + return visual; + } + createFontVisual(font) { + const visual = new FontVisual(this._core, font); + visual.initializeContext(this._gl); + return visual; + } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); + } + update(elapsedTime) { + super.update(elapsedTime); + if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { + this._shadowWidth = this._config.shadowWidth; + this._shadowHeight = this._config.shadowHeight; + this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._shadowFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); + this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); + } + if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { + this._ssaoWidth = this._config.ssaoWidth; + this._ssaoHeight = this._config.ssaoHeight; + this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); + this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); + this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); + } + if (this._config.isDofEnabled && this._config.dofAutoFocus) { + this._core.getModelManipulationOrigin(this._modelManipulationOrigin); + this._core.getModelPosition(this._modelPosition); + add(this._position, this._modelManipulationOrigin, this._modelPosition); + this._core.camera.getPosition(this._cameraPosition); + subtract(this._position, this._position, this._cameraPosition); + const distance = -this._position[2]; + const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); + this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance, amount); + } + } + render(elapsedTime) { + return __awaiter(this, void 0, void 0, function* () { + this._gl.enable(this._gl.DEPTH_TEST); + this._gl.enable(this._gl.CULL_FACE); + this._gl.cullFace(this._gl.BACK); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); + if (this.config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.clear(this._gl.DEPTH_BUFFER_BIT); + perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + fromMat4(this._cameraRotation, this.inverseVMatrices[0]); + transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); + add(this._position, this._position, this._modelPosition); + lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants.VECTOR3_UNITY); + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(transitionBuffer); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.geometryFramebuffer = this._geometryFrameBuffer; + axesVisual.render(elapsedTime); + } + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; + labelSetVisual.render(elapsedTime); + } + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.geometryFramebuffer = this._geometryFrameBuffer; + imageVisual.render(elapsedTime); + } + } + } + if (this._backgroundShader.isInitialized) { + this._backgroundShader.prepare(); + this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._backgroundShader.apply(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._gl.bindVertexArray(null); + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$2(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + } + else { + set$2(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { + const viewport = this._viewportOffset; + this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = ((this.lassoX0 + lassoWidth / 2) / viewport.width) * 2 - 1; + this._lassoMMatrix[13] = 1 - ((this.lassoY0 + lassoHeight / 2) / viewport.height) * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + }); + } + _renderTransitionBuffer(transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; + const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = currentBuffer.from; + this._blockShader.rangeMax = currentBuffer.to; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._blockShader.vMatrix = this.vMatrices[viewport]; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = true; + this._blockShader.vMatrix = this._shadowVMatrix; + this._blockShader.pMatrix = this._shadowPMatrix; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.isShadowMap = false; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = currentBuffer.from; + this._sphereShader.rangeMax = currentBuffer.to; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sphereShader.vMatrix = this.vMatrices[viewport]; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = true; + this._sphereShader.vMatrix = this._shadowVMatrix; + this._sphereShader.pMatrix = this._shadowPMatrix; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.isShadowMap = false; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = currentBuffer.from; + this._cylinderShader.rangeMax = currentBuffer.to; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._cylinderShader.vMatrix = this.vMatrices[viewport]; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = true; + this._cylinderShader.vMatrix = this._shadowVMatrix; + this._cylinderShader.pMatrix = this._shadowPMatrix; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.isShadowMap = false; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = currentBuffer.from; + this._sdfShader.rangeMax = currentBuffer.to; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sdfShader.vMatrix = this.vMatrices[viewport]; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = true; + this._sdfShader.vMatrix = this._shadowVMatrix; + this._sdfShader.pMatrix = this._shadowPMatrix; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.isShadowMap = false; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } + } + _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { + if (this._deferredShader.isInitialized) { + this._gl.disable(this._gl.DEPTH_TEST); + let ssaoTexture; + if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { + this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); + ssaoTexture = this._ssaoTexture1; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); + this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; + this._ssaoShader.indexBuffer = this._quad.indexBuffer; + this._ssaoShader.texture2D1 = this._positionTexture; + this._ssaoShader.texture2D2 = this._normalTexture; + this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; + this._ssaoShader.prepare(); + this._ssaoShader.pMatrix = pMatrix; + this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; + this._ssaoShader.ssaoRadius = this._config.ssaoRadius; + this._ssaoShader.ssaoPower = this._config.ssaoPower; + this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; + this._ssaoShader.left = 0; + this._ssaoShader.top = 0; + this._ssaoShader.width = this._config.ssaoWidth; + this._ssaoShader.height = this._config.ssaoHeight; + this._ssaoShader.apply(); + this._ssaoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { + ssaoTexture = this._ssaoTexture2; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); + this._boxShader.vertexBuffer = this._quad.vertexBuffer; + this._boxShader.indexBuffer = this._quad.indexBuffer; + this._boxShader.texture2D = this._ssaoTexture1; + this._boxShader.prepare(); + this._boxShader.left = 0; + this._boxShader.top = 0; + this._boxShader.width = this._config.ssaoWidth; + this._boxShader.height = this._config.ssaoHeight; + this._boxShader.apply(); + this._boxShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); + let postProcessFrameBuffer = this._postProcessFrameBuffer1; + this._shaderResources.bindFramebuffer(postProcessFrameBuffer); + this._deferredShader.vertexBuffer = this._quad.vertexBuffer; + this._deferredShader.indexBuffer = this._quad.indexBuffer; + this._deferredShader.texture2D1 = this._positionTexture; + this._deferredShader.texture2D2 = this._colorTexture; + this._deferredShader.texture2D3 = this._normalTexture; + this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; + this._deferredShader.texture2D5 = this._shadowDepthTexture; + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); + this._deferredShader.prepare(); + this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; + this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; + this._deferredShader.inverseVMatrix = inverseVMatrix; + this._deferredShader.shadowVMatrix = this._shadowVMatrix; + this._deferredShader.shadowPMatrix = this._shadowPMatrix; + this._deferredShader.vMatrix = vMatrix; + this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; + this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; + this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; + this._core.camera.getPosition(this._cameraPosition); + fromMat4(this._cameraRotation, vMatrix); + set$3(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + normalize$2(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); + subtract(this._direction, this._cameraPosition, this._position); + normalize$2(this._direction, this._direction); + add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); + normalize$2(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); + copy$3(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); + copy$3(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); + this._deferredShader.left = viewport.left; + this._deferredShader.top = viewport.top; + this._deferredShader.width = viewport.width; + this._deferredShader.height = viewport.height; + this._deferredShader.shadowMapWidth = this._config.shadowWidth; + this._deferredShader.shadowMapHeight = this._config.shadowHeight; + this._deferredShader.ambientIntensity = this._config.ambientIntensity; + this._deferredShader.materialIntensity = this._config.materialIntensity; + this._deferredShader.specularPower = this._config.specularPower; + this._deferredShader.specularIntensity = this._config.specularIntensity; + this._deferredShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + const widthHalf = Math.round(viewport.width / 2); + const heightHalf = Math.round(viewport.height / 2); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + const widthSixteenth = Math.round(widthEighth / 2); + const heightSixteenth = Math.round(heightEighth / 2); + if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; + this._dofBlurShader.indexBuffer = this._quad.indexBuffer; + this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofBlurShader.texture2D2 = this._positionTexture; + this._dofBlurShader.prepare(); + this._dofBlurShader.focusDepth = this._config.dofFocusDistance; + this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; + this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; + this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; + this._dofBlurShader.left = viewport.left; + this._dofBlurShader.top = viewport.top; + this._dofBlurShader.width = viewport.width; + this._dofBlurShader.height = viewport.height; + this._dofBlurShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; + this._dofCombineShader.indexBuffer = this._quad.indexBuffer; + this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofCombineShader.texture2D2 = this._postProcessDofTexture; + this._dofCombineShader.prepare(); + this._dofCombineShader.focusDepth = this._config.dofFocusDistance; + this._dofCombineShader.left = viewport.left; + this._dofCombineShader.top = viewport.top; + this._dofCombineShader.width = viewport.width; + this._dofCombineShader.height = viewport.height; + this._dofCombineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthHalf; + this._brightPassShader.height = heightHalf; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessHalfTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthQuarter; + this._brightPassShader.height = heightQuarter; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessQuarterTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthEighth; + this._brightPassShader.height = heightEighth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessEighthTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthSixteenth; + this._brightPassShader.height = heightSixteenth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessHalfTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthHalf; + this._gaussianShader.height = heightHalf; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessHalfTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessQuarterTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthQuarter; + this._gaussianShader.height = heightQuarter; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessQuarterTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessEighthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthEighth; + this._gaussianShader.height = heightEighth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessEighthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthSixteenth; + this._gaussianShader.height = heightSixteenth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; + this._fxaaShader.indexBuffer = this._quad.indexBuffer; + this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._fxaaShader.prepare(); + this._fxaaShader.left = viewport.left; + this._fxaaShader.top = viewport.top; + this._fxaaShader.width = viewport.width; + this._fxaaShader.height = viewport.height; + this._fxaaShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._combineShader.vertexBuffer = this._quad.vertexBuffer; + this._combineShader.indexBuffer = this._quad.indexBuffer; + this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + if (this._config.isBloomEnabled) { + this._combineShader.texture2D2 = this._postProcessHalfTexture1; + this._combineShader.texture2D3 = this._postProcessQuarterTexture1; + this._combineShader.texture2D4 = this._postProcessEighthTexture1; + this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; + } + else { + this._combineShader.texture2D2 = null; + this._combineShader.texture2D3 = null; + this._combineShader.texture2D4 = null; + this._combineShader.texture2D5 = null; + } + this._combineShader.prepare(); + this._combineShader.viewport = viewport; + this._combineShader.intensity = this._config.bloomIntensity; + this._combineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class MaterialBufferData extends Float32Array { + constructor(count) { + super(count * MaterialBufferData.SIZE); + this.TYPE_OFFSET = 0 / 4; + this.FUZZ_OFFSET = 4 / 4; + this.REFRACTIVE_INDEX_OFFSET = 8 / 4; + this.TEXTURE_ID_OFFSET = 12 / 4; + this.COLOR_OFFSET = 16 / 4; + this.GLOSSINESS_OFFSET = 28 / 4; + this.ID_COLOR_OFFSET = 32 / 4; + this.DENSITY_OFFSET = 48 / 4; + } + getType(index) { + return this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getFuzz(index) { + return this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET]; + } + setFuzz(index, value) { + this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET] = value; + } + getRefractiveIndex(index) { + return this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET]; + } + setRefractiveIndex(index, value) { + this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET] = value; + } + getTextureId(index) { + return this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET]; + } + setTextureId(index, value) { + this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET] = value; + } + getColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getGlossiness(index) { + return this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET]; + } + setGlossiness(index, value) { + this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET] = value; + } + getDensity(index) { + return this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET]; + } + setDensity(index, value) { + this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET] = value; + } + getIdColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; + set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setIdColor(index, value) { + const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + } + MaterialBufferData.SIZE = 64 / 4; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class TextureBufferData extends Float32Array { + constructor(count) { + super(count * TextureBufferData.SIZE); + this.COLOR0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.COLOR1_OFFSET = 16 / 4; + this.SIZE0_OFFSET = 32 / 4; + this.SIZE1_OFFSET = 48 / 4; + this.CLIP_OFFSET = 64 / 4; + this.OFFSET_OFFSET = 80 / 4; + } + getType(index) { + return this[TextureBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[TextureBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getColor0(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor0(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getColor1(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor1(index, value) { + const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize0(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; + set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setSize0(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getSize1(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; + set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setSize1(index, value) { + const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getClip(index, value) { + const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; + set$2(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setClip(index, value) { + const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getOffset(index, value) { + const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; + set(value, this[offset], this[offset + 1]); + } + setOffset(index, value) { + const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + } + } + TextureBufferData.SIZE = 96 / 4; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class HittableBufferData extends Float32Array { + constructor(count) { + super(count * HittableBufferData.SIZE); + this.CENTER0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.SIZE0_OFFSET = 16 / 4; + this.MATERIAL_ID_OFFSET = 28 / 4; + this.ROTATION0_OFFSET = 32 / 4; + this.ROTATION1_OFFSET = 48 / 4; + this.TEXCOORD0_OFFSET = 64 / 4; + this.TEXCOORD1_OFFSET = 72 / 4; + this.CENTER1_OFFSET = 80 / 4; + this.ROUNDING_OFFSET = 92 / 4; + this.SIZE1_OFFSET = 96 / 4; + this.BOUNDARY_TYPE_OFFSET = 108 / 4; + this.TIME0_OFFSET = 112 / 4; + this.TIME1_OFFSET = 116 / 4; + this.TEX_ID_OFFSET = 120 / 4; + this.SDF_BUFFER_OFFSET = 124 / 4; + this.SDF_BORDER_OFFSET = 128 / 4; + this.PARAMETER_1_OFFSET = 132 / 4; + this.PARAMETER_2_OFFSET = 136 / 4; + this.MATERIAL_FUZZ_OFFSET = 140 / 4; + this.MATERIAL_GLOSS_OFFSET = 144 / 4; + this.MATERIAL_DENSITY_OFFSET = 148 / 4; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; + this.MATERIAL_COLOR_OFFSET = 160 / 4; + this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; + this.SEGMENT_COLOR_OFFSET = 176 / 4; + this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; + this.TEXTURE_ID_OFFSET = 196 / 4; + } + getType(index) { + return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[HittableBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getCenter0(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter0(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getCenter1(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter1(index, value) { + const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getTime0(index) { + return this[HittableBufferData.SIZE * index + this.TIME0_OFFSET]; + } + setTime0(index, value) { + this[HittableBufferData.SIZE * index + this.TIME0_OFFSET] = value; + } + getTime1(index) { + return this[HittableBufferData.SIZE * index + this.TIME1_OFFSET]; + } + setTime1(index, value) { + this[HittableBufferData.SIZE * index + this.TIME1_OFFSET] = value; + } + getSize0(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize0(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize1(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize1(index, value) { + const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getRotation0(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; + set$1(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setRotation0(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getRotation1(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; + set$1(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setRotation1(index, value) { + const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + getTexCoord0(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; + set(value, this[offset], this[offset + 1]); + } + setTexCoord0(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + } + getTexCoord1(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; + set(value, this[offset], this[offset + 1]); + } + setTexCoord1(index, value) { + const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + } + getRounding(index) { + return this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET]; + } + setRounding(index, value) { + this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET] = value; + } + getParameter1(index) { + return this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET]; + } + setParameter1(index, value) { + this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET] = value; + } + getParameter2(index) { + return this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET]; + } + setParameter2(index, value) { + this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET] = value; + } + getBoundaryType(index) { + return this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET]; + } + setBoundaryType(index, value) { + this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET] = value; + } + getTexId(index) { + return this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET]; + } + setTexId(index, value) { + this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET] = value; + } + getSdfBuffer(index) { + return this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET]; + } + setSdfBuffer(index, value) { + this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET] = value; + } + getSdfBorder(index) { + return this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET]; + } + setSdfBorder(index, value) { + this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; + } + getMaterialTypeId(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET]; + } + setMaterialTypeId(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_TYPE_ID_OFFSET] = value; + } + getMaterialFuzz(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_FUZZ_OFFSET]; + } + setMaterialFuzz(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_FUZZ_OFFSET] = value; + } + getMaterialDensity(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_DENSITY_OFFSET]; + } + setMaterialDensity(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_DENSITY_OFFSET] = value; + } + getMaterialGloss(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_GLOSS_OFFSET]; + } + setMaterialGloss(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_GLOSS_OFFSET] = value; + } + getMaterialRefractiveIndex(index) { + return this[HittableBufferData.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; + } + setMaterialRefractiveIndex(index, value) { + this[HittableBufferData.SIZE * index + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value; + } + getMaterialColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.MATERIAL_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + } + setMaterialColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.MATERIAL_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSegmentColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.SEGMENT_COLOR_OFFSET; + value[0] = this[offset]; + value[1] = this[offset + 1]; + value[2] = this[offset + 2]; + value[3] = this[offset + 3]; + } + setSegmentColor(index, value) { + const offset = HittableBufferData.SIZE * index + this.SEGMENT_COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + } + HittableBufferData.SIZE = 208 / 4; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class ComputeUniformBufferData extends Float32Array { + constructor() { + super(ComputeUniformBufferData.SIZE); + this.POSITION_OFFSET = 0 / 4; + this.WIDTH_OFFSET = 12 / 4; + this.RIGHT_OFFSET = 16 / 4; + this.HEIGHT_OFFSET = 28 / 4; + this.UP_OFFSET = 32 / 4; + this.SEED_OFFSET = 44 / 4; + this.FORWARD_OFFSET = 48 / 4; + this.FOV_OFFSET = 60 / 4; + this.BACKGROUND_COLOR_OFFSET = 64 / 4; + this.TIME0_OFFSET = 76 / 4; + this.AMBIENT_COLOR_OFFSET = 80 / 4; + this.TIME1_OFFSET = 92 / 4; + this.TILES_X = 96 / 4; + this.TILES_Y = 100 / 4; + this.TILE_OFFSET_X = 104 / 4; + this.TILE_OFFSET_Y = 108 / 4; + this.LOOKAT_OFFSET = 112 / 4; + this.APERTURE_OFFSET = 124 / 4; + this.FOCUS_DISTANCE_OFFSET = 128 / 4; + this.RAYS_PER_FRAME_OFFSET = 132 / 4; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value) { + this[this.FOCUS_DISTANCE_OFFSET] = value; + } + getWidth() { + return this[this.WIDTH_OFFSET]; + } + setWidth(value) { + this[this.WIDTH_OFFSET] = value; + } + getHeight() { + return this[this.HEIGHT_OFFSET]; + } + setHeight(value) { + this[this.HEIGHT_OFFSET] = value; + } + getSeed() { + return this[this.SEED_OFFSET]; + } + setSeed(value) { + this[this.SEED_OFFSET] = value; + } + getRaysPerFrame() { + return this[this.RAYS_PER_FRAME_OFFSET]; + } + setRaysPerFrame(value) { + this[this.RAYS_PER_FRAME_OFFSET] = value; + } + getFieldOfView() { + return this[this.FOV_OFFSET]; + } + setFieldOfView(value) { + this[this.FOV_OFFSET] = value; + } + getAperture() { + return this[this.APERTURE_OFFSET]; + } + setAperture(value) { + this[this.APERTURE_OFFSET] = value; + } + getPosition(value) { + set$3(value, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); + } + setPosition(value) { + this[this.POSITION_OFFSET] = value[0]; + this[this.POSITION_OFFSET + 1] = value[1]; + this[this.POSITION_OFFSET + 2] = value[2]; + } + getRight(value) { + set$3(value, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); + } + setRight(value) { + this[this.RIGHT_OFFSET] = value[0]; + this[this.RIGHT_OFFSET + 1] = value[1]; + this[this.RIGHT_OFFSET + 2] = value[2]; + } + getUp(value) { + set$3(value, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); + } + setUp(value) { + this[this.UP_OFFSET] = value[0]; + this[this.UP_OFFSET + 1] = value[1]; + this[this.UP_OFFSET + 2] = value[2]; + } + getForward(value) { + set$3(value, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); + } + setForward(value) { + this[this.FORWARD_OFFSET] = value[0]; + this[this.FORWARD_OFFSET + 1] = value[1]; + this[this.FORWARD_OFFSET + 2] = value[2]; + } + getBackgroundColor(value) { + set$2(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); + } + setBackgroundColor(value) { + this[this.BACKGROUND_COLOR_OFFSET] = value[0]; + this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; + this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value[3]; + } + getAmbientColor(value) { + set$3(value, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); + } + setAmbientColor(value) { + this[this.AMBIENT_COLOR_OFFSET] = value[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value[2]; + } + getTime0() { + return this[this.TIME0_OFFSET]; + } + setTime0(value) { + this[this.TIME0_OFFSET] = value; + } + getTime1() { + return this[this.TIME1_OFFSET]; + } + setTime1(value) { + this[this.TIME1_OFFSET] = value; + } + getTilesX() { + return this[this.TILES_X]; + } + setTilesX(value) { + this[this.TILES_X] = value; + } + getTilesY() { + return this[this.TILES_Y]; + } + setTilesY(value) { + this[this.TILES_Y] = value; + } + getTileOffsetX() { + return this[this.TILE_OFFSET_X]; + } + setTileOffsetX(value) { + this[this.TILE_OFFSET_X] = value; + } + getTileOffsetY() { + return this[this.TILE_OFFSET_Y]; + } + setTileOffsetY(value) { + this[this.TILE_OFFSET_Y] = value; + } + getLookAt(value) { + set$3(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value) { + this[this.LOOKAT_OFFSET] = value[0]; + this[this.LOOKAT_OFFSET + 1] = value[1]; + this[this.LOOKAT_OFFSET + 2] = value[2]; + } + } + ComputeUniformBufferData.SIZE = 144 / 4; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class FullscreenQuadUniformBufferData extends Float32Array { + constructor() { + super(FullscreenQuadUniformBufferData.SIZE); + this.WIDTH_OFFSET = 0 / 4; + this.HEIGHT_OFFSET = 4 / 4; + this.SPP_OFFSET = 8 / 4; + this.EXPOSURE_OFFSET = 12 / 4; + this.MIN_DEPTH_OFFSET = 16 / 4; + this.MAX_DEPTH_OFFSET = 20 / 4; + this.EDGE_NORMAL_OFFSET = 24 / 4; + this.EDGE_DEPTH_OFFSET = 28 / 4; + this.EDGE_FOREGROUND_OFFSET = 32 / 4; + this.EDGE_BACKGROUND_OFFSET = 48 / 4; + } + getWidth() { + return this[this.WIDTH_OFFSET]; + } + setWidth(value) { + this[this.WIDTH_OFFSET] = value; + } + getHeight() { + return this[this.HEIGHT_OFFSET]; + } + setHeight(value) { + this[this.HEIGHT_OFFSET] = value; + } + getSamplesPerPixel() { + return this[this.SPP_OFFSET]; + } + setSamplesPerPixel(value) { + this[this.SPP_OFFSET] = value; + } + getExposure() { + return this[this.EXPOSURE_OFFSET]; + } + setExposure(value) { + this[this.EXPOSURE_OFFSET] = value; + } + getMinDepth() { + return this[this.MIN_DEPTH_OFFSET]; + } + setMinDepth(value) { + this[this.MIN_DEPTH_OFFSET] = value; + } + getMaxDepth() { + return this[this.MAX_DEPTH_OFFSET]; + } + setMaxDepth(value) { + this[this.MAX_DEPTH_OFFSET] = value; + } + getEdgeDepth() { + return this[this.EDGE_DEPTH_OFFSET]; + } + setEdgeDepth(value) { + this[this.EDGE_DEPTH_OFFSET] = value; + } + getEdgeNormal() { + return this[this.EDGE_NORMAL_OFFSET]; + } + setEdgeNormal(value) { + this[this.EDGE_NORMAL_OFFSET] = value; + } + getEdgeForeground(value) { + set$2(value, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); + } + setEdgeForeground(value) { + this[this.EDGE_FOREGROUND_OFFSET] = value[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value[3]; + } + getEdgeBackground(value) { + set$2(value, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); + } + setEdgeBackground(value) { + this[this.EDGE_BACKGROUND_OFFSET] = value[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value[3]; + } + } + FullscreenQuadUniformBufferData.SIZE = 64 / 4; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class LinearBVHNodeBufferData extends Float32Array { + constructor(count) { + super(count * LinearBVHNodeBufferData.SIZE); + this.CENTER_OFFSET = 0 / 4; + this.SIZE_OFFSET = 16 / 4; + this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; + this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; + this.N_PRIMITIVES_OFFSET = 32 / 4; + this.AXIS_OFFSET = 36 / 4; + } + getCenter(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize(index, value) { + const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getPrimitivesOffset(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET]; + } + setPrimitivesOffset(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET] = value; + } + getSecondChildOffset(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET]; + } + setSecondChildOffset(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET] = value; + } + getNPrimitives(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET]; + } + setNPrimitives(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET] = value; + } + getAxis(index) { + return this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET]; + } + setAxis(index, value) { + this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET] = value; + } + } + LinearBVHNodeBufferData.SIZE = 48 / 4; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class LightBufferData extends Float32Array { + constructor(count) { + super(count * LightBufferData.SIZE); + this.ROTATION_OFFSET = 0 / 4; + this.CENTER_OFFSET = 16 / 4; + this.TYPE_OFFSET = 28 / 4; + this.SIZE_OFFSET = 32 / 4; + this.COLOR_OFFSET = 48 / 4; + } + getType(index) { + return this[LightBufferData.SIZE * index + this.TYPE_OFFSET]; + } + setType(index, value) { + this[LightBufferData.SIZE * index + this.TYPE_OFFSET] = value; + } + getCenter(index, value) { + const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setCenter(index, value) { + const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getSize(index, value) { + const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setSize(index, value) { + const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getColor(index, value) { + const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; + set$3(value, this[offset], this[offset + 1], this[offset + 2]); + } + setColor(index, value) { + const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + } + getRotation(index, value) { + const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; + set$1(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); + } + setRotation(index, value) { + const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; + this[offset] = value[0]; + this[offset + 1] = value[1]; + this[offset + 2] = value[2]; + this[offset + 3] = value[3]; + } + } + LightBufferData.SIZE = 64 / 4; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * This file is for external facing export only, do not use this for internal references, + * as it may cause circular dependencies in Rollup. + */ + + var types = /*#__PURE__*/Object.freeze({ + __proto__: null, + MorphChartsCore: Core + }); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function concat(...args) { + return args.reduce((p, c) => c ? p.concat(c) : p, []); + } + /** + * Returns array with items which are truthy. + * @param args array or arrays to concat into a single array. + */ + function allTruthy(...args) { + return args.reduce((p, c) => c ? p.concat(c) : p, []).filter(Boolean); + } + /** + * Add an array to an existing array in place. + * @param arr Array to append to. + * @param items Arrof of items to append. + */ + function push(arr, items) { + arr.push.apply(arr, items); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Create a new element as a child of another element. + * @param tagName Tag name of the new tag to create. + * @param parentElement Reference of the element to append to. + * @returns new HTMLElement. + */ + function addEl(tagName, parentElement) { + const el = document.createElement(tagName); + parentElement.appendChild(el); + return el; + } + /** + * Create a new div HTMLElement as a child of another element. + * @param parentElement Reference of the element to append to. + * @param className Optional css class name to apply to the div. + */ + function addDiv(parentElement, className) { + const div = addEl('div', parentElement); + if (className) { + div.className = className; + } + return div; + } + /** + * Measure the outer height and width of an HTMLElement, including margin, padding and border. + * @param el HTML Element to measure. + */ + function outerSize(el) { + const cs = getComputedStyle(el); + const height = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); + const width = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); + return { height, width }; + } + + var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) + && !isSpecial(value) + }; + + function isNonNullObject(value) { + return !!value && typeof value === 'object' + } + + function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + + return stringValue === '[object RegExp]' + || stringValue === '[object Date]' + || isReactElement(value) + } + + // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 + var canUseSymbol = typeof Symbol === 'function' && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; + + function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE + } + + function emptyTarget(val) { + return Array.isArray(val) ? [] : {} + } + + function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge$1(emptyTarget(value), value, options) + : value + } + + function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) + } + + function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + Object.keys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + Object.keys(source).forEach(function(key) { + if (!options.isMergeableObject(source[key]) || !target[key]) { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + } else { + destination[key] = deepmerge$1(target[key], source[key], options); + } + }); + return destination + } + + function deepmerge$1(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + + var sourceIsArray = Array.isArray(source); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } + } + + deepmerge$1.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge$1(prev, next, options) + }, {}) + }; + + var deepmerge_1 = deepmerge$1; + + var _deepmerge = /*#__PURE__*/Object.freeze({ + __proto__: null, + default: deepmerge_1 + }); + + /*! + * is-plain-object <https://github.com/jonschlinkert/is-plain-object> + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + + function isObject(o) { + return Object.prototype.toString.call(o) === '[object Object]'; + } + + function isPlainObject(o) { + var ctor,prot; + + if (isObject(o) === false) return false; + + // If has modified constructor + ctor = o.constructor; + if (ctor === undefined) return true; + + // If has modified prototype + prot = ctor.prototype; + if (isObject(prot) === false) return false; + + // If constructor does not have an Object-specific method + if (prot.hasOwnProperty('isPrototypeOf') === false) { + return false; + } + + // Most likely a plain Object + return true; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const deepmerge = (deepmerge_1 || _deepmerge); + function clone(objectToClone) { + if (!objectToClone) + return objectToClone; + return deepmerge.all([objectToClone]); + } + const dontMerge = (destination, source) => source; + function deepMerge(...objectsToMerge) { + const objects = objectsToMerge.filter(Boolean); + return deepmerge.all(objects, { arrayMerge: dontMerge, isMergeableObject: isPlainObject }); + } + + function define(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; + } + + function extend(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } + + function Color() {} + + var darker = 0.7; + var brighter = 1 / darker; + + var reI = "\\s*([+-]?\\d+)\\s*", + reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", + reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", + reHex = /^#([0-9a-f]{3,8})$/, + reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), + reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), + reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), + reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), + reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), + reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + + var named = { + aliceblue: 0xf0f8ff, + antiquewhite: 0xfaebd7, + aqua: 0x00ffff, + aquamarine: 0x7fffd4, + azure: 0xf0ffff, + beige: 0xf5f5dc, + bisque: 0xffe4c4, + black: 0x000000, + blanchedalmond: 0xffebcd, + blue: 0x0000ff, + blueviolet: 0x8a2be2, + brown: 0xa52a2a, + burlywood: 0xdeb887, + cadetblue: 0x5f9ea0, + chartreuse: 0x7fff00, + chocolate: 0xd2691e, + coral: 0xff7f50, + cornflowerblue: 0x6495ed, + cornsilk: 0xfff8dc, + crimson: 0xdc143c, + cyan: 0x00ffff, + darkblue: 0x00008b, + darkcyan: 0x008b8b, + darkgoldenrod: 0xb8860b, + darkgray: 0xa9a9a9, + darkgreen: 0x006400, + darkgrey: 0xa9a9a9, + darkkhaki: 0xbdb76b, + darkmagenta: 0x8b008b, + darkolivegreen: 0x556b2f, + darkorange: 0xff8c00, + darkorchid: 0x9932cc, + darkred: 0x8b0000, + darksalmon: 0xe9967a, + darkseagreen: 0x8fbc8f, + darkslateblue: 0x483d8b, + darkslategray: 0x2f4f4f, + darkslategrey: 0x2f4f4f, + darkturquoise: 0x00ced1, + darkviolet: 0x9400d3, + deeppink: 0xff1493, + deepskyblue: 0x00bfff, + dimgray: 0x696969, + dimgrey: 0x696969, + dodgerblue: 0x1e90ff, + firebrick: 0xb22222, + floralwhite: 0xfffaf0, + forestgreen: 0x228b22, + fuchsia: 0xff00ff, + gainsboro: 0xdcdcdc, + ghostwhite: 0xf8f8ff, + gold: 0xffd700, + goldenrod: 0xdaa520, + gray: 0x808080, + green: 0x008000, + greenyellow: 0xadff2f, + grey: 0x808080, + honeydew: 0xf0fff0, + hotpink: 0xff69b4, + indianred: 0xcd5c5c, + indigo: 0x4b0082, + ivory: 0xfffff0, + khaki: 0xf0e68c, + lavender: 0xe6e6fa, + lavenderblush: 0xfff0f5, + lawngreen: 0x7cfc00, + lemonchiffon: 0xfffacd, + lightblue: 0xadd8e6, + lightcoral: 0xf08080, + lightcyan: 0xe0ffff, + lightgoldenrodyellow: 0xfafad2, + lightgray: 0xd3d3d3, + lightgreen: 0x90ee90, + lightgrey: 0xd3d3d3, + lightpink: 0xffb6c1, + lightsalmon: 0xffa07a, + lightseagreen: 0x20b2aa, + lightskyblue: 0x87cefa, + lightslategray: 0x778899, + lightslategrey: 0x778899, + lightsteelblue: 0xb0c4de, + lightyellow: 0xffffe0, + lime: 0x00ff00, + limegreen: 0x32cd32, + linen: 0xfaf0e6, + magenta: 0xff00ff, + maroon: 0x800000, + mediumaquamarine: 0x66cdaa, + mediumblue: 0x0000cd, + mediumorchid: 0xba55d3, + mediumpurple: 0x9370db, + mediumseagreen: 0x3cb371, + mediumslateblue: 0x7b68ee, + mediumspringgreen: 0x00fa9a, + mediumturquoise: 0x48d1cc, + mediumvioletred: 0xc71585, + midnightblue: 0x191970, + mintcream: 0xf5fffa, + mistyrose: 0xffe4e1, + moccasin: 0xffe4b5, + navajowhite: 0xffdead, + navy: 0x000080, + oldlace: 0xfdf5e6, + olive: 0x808000, + olivedrab: 0x6b8e23, + orange: 0xffa500, + orangered: 0xff4500, + orchid: 0xda70d6, + palegoldenrod: 0xeee8aa, + palegreen: 0x98fb98, + paleturquoise: 0xafeeee, + palevioletred: 0xdb7093, + papayawhip: 0xffefd5, + peachpuff: 0xffdab9, + peru: 0xcd853f, + pink: 0xffc0cb, + plum: 0xdda0dd, + powderblue: 0xb0e0e6, + purple: 0x800080, + rebeccapurple: 0x663399, + red: 0xff0000, + rosybrown: 0xbc8f8f, + royalblue: 0x4169e1, + saddlebrown: 0x8b4513, + salmon: 0xfa8072, + sandybrown: 0xf4a460, + seagreen: 0x2e8b57, + seashell: 0xfff5ee, + sienna: 0xa0522d, + silver: 0xc0c0c0, + skyblue: 0x87ceeb, + slateblue: 0x6a5acd, + slategray: 0x708090, + slategrey: 0x708090, + snow: 0xfffafa, + springgreen: 0x00ff7f, + steelblue: 0x4682b4, + tan: 0xd2b48c, + teal: 0x008080, + thistle: 0xd8bfd8, + tomato: 0xff6347, + turquoise: 0x40e0d0, + violet: 0xee82ee, + wheat: 0xf5deb3, + white: 0xffffff, + whitesmoke: 0xf5f5f5, + yellow: 0xffff00, + yellowgreen: 0x9acd32 + }; + + define(Color, color, { + copy(channels) { + return Object.assign(new this.constructor, this, channels); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + + function color_formatHex() { + return this.rgb().formatHex(); + } + + function color_formatHex8() { + return this.rgb().formatHex8(); + } + + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + + function color_formatRgb() { + return this.rgb().formatRgb(); + } + + function color(format) { + var m, l; + format = (format + "").trim().toLowerCase(); + return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 + : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 + : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 + : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 + : null) // invalid hex + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; + } + + function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); + } + + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } + + function rgbConvert(o) { + if (!(o instanceof Color)) o = color(o); + if (!o) return new Rgb; + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } + + function rgb(r, g, b, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); + } + + function Rgb(r, g, b, opacity) { + this.r = +r; + this.g = +g; + this.b = +b; + this.opacity = +opacity; + } + + define(Rgb, rgb, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return (-0.5 <= this.r && this.r < 255.5) + && (-0.5 <= this.g && this.g < 255.5) + && (-0.5 <= this.b && this.b < 255.5) + && (0 <= this.opacity && this.opacity <= 1); + }, + hex: rgb_formatHex, // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + + function rgb_formatRgb() { + const a = clampa(this.opacity); + return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; + } + + function clampa(opacity) { + return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); + } + + function clampi(value) { + return Math.max(0, Math.min(255, Math.round(value) || 0)); + } + + function hex(value) { + value = clampi(value); + return (value < 16 ? "0" : "") + value.toString(16); + } + + function hsla(h, s, l, a) { + if (a <= 0) h = s = l = NaN; + else if (l <= 0 || l >= 1) h = s = NaN; + else if (s <= 0) h = NaN; + return new Hsl(h, s, l, a); + } + + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color)) o = color(o); + if (!o) return new Hsl; + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + min = Math.min(r, g, b), + max = Math.max(r, g, b), + h = NaN, + s = max - min, + l = (max + min) / 2; + if (s) { + if (r === max) h = (g - b) / s + (g < b) * 6; + else if (g === max) h = (b - r) / s + 2; + else h = (r - g) / s + 4; + s /= l < 0.5 ? max + min : 2 - max - min; + h *= 60; + } else { + s = l > 0 && l < 1 ? 0 : h; + } + return new Hsl(h, s, l, o.opacity); + } + + function hsl(h, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); + } + + function Hsl(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + + define(Hsl, hsl, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h = this.h % 360 + (this.h < 0) * 360, + s = isNaN(h) || isNaN(this.s) ? 0 : this.s, + l = this.l, + m2 = l + (l < 0.5 ? l : 1 - l) * s, + m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), + hsl2rgb(h, m1, m2), + hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), + this.opacity + ); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) + && (0 <= this.l && this.l <= 1) + && (0 <= this.opacity && this.opacity <= 1); + }, + formatHsl() { + const a = clampa(this.opacity); + return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; + } + })); + + function clamph(value) { + value = (value || 0) % 360; + return value < 0 ? value + 360 : value; + } + + function clampt(value) { + return Math.max(0, Math.min(1, value || 0)); + } + + /* From FvD 13.37, CSS Color Module Level 3 */ + function hsl2rgb(h, m1, m2) { + return (h < 60 ? m1 + (m2 - m1) * h / 60 + : h < 180 ? m2 + : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 + : m1) * 255; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function rgbToDeckglColor(c) { + return [c.r, c.g, c.b, c.opacity * 255]; + } + /** + * Compares 2 colors to see if they are equal. + * @param a RGBAColor to compare + * @param b RGBAColor to compare + * @returns True if colors are equal. + */ + function colorIsEqual(a, b) { + if (a.length !== b.length) + return false; + for (let i = 0; i < a.length; i++) { + if (a[i] !== b[i]) + return false; + } + return true; + } + /** + * Convert a CSS color string to a Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.). + * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. + */ + function colorFromString(cssColorSpecifier) { + if (cssColorSpecifier) { + const dc = color(cssColorSpecifier); + if (dc) { + const c = dc.rgb(); + return rgbToDeckglColor(c); + } + } + } + /** + * Convert a Deck.gl color to a CSS rgba() string. + * @param color A Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.) + */ + function colorToString(color) { + const c = [...color]; + if (c.length > 3) { + c[3] /= 255; + } + return `rgba(${c.join(',')})`; + } + function desaturate(color, value) { + const rgb$1 = rgb(color[0], color[1], color[2], color[3] / 255); + const hslColor = hsl(rgb$1); + hslColor.s = value; + const c = hslColor.rgb(); + return rgbToDeckglColor(c); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * This file is for external facing export only, do not use this for internal references, + * as it may cause circular dependencies in Rollup. + */ + + var util = /*#__PURE__*/Object.freeze({ + __proto__: null, + addDiv: addDiv, + addEl: addEl, + allTruthy: allTruthy, + clone: clone, + colorFromString: colorFromString, + colorIsEqual: colorIsEqual, + colorToString: colorToString, + concat: concat, + createElement: createElement, + deepMerge: deepMerge, + desaturate: desaturate, + getActiveElementInfo: getActiveElementInfo, + mount: mount, + outerSize: outerSize, + push: push, + setActiveElement: setActiveElement + }); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const minHeight = '100px'; + const minWidth = '100px'; + const defaultPresenterStyle = { + cssPrefix: 'vega-morphcharts-', + defaultCubeColor: [128, 128, 128, 255], + highlightColor: [0, 0, 0, 255], + }; + const defaultPresenterConfig = { + onCubeClick: (e, cube) => { }, + onCubeHover: (e, cube) => { }, + transitionDurations: { + position: 600, + stagger: 600, + view: 600, + }, + renderer: { + advanced: false, + advancedOptions: {}, + basicOptions: { + antialias: true, + }, + }, + }; + function createStage(view) { + const stage = { + view, + cubeData: [], + pathData: [], + axes: { + x: [], + y: [], + z: [], + }, + gridLines: [], + textData: [], + legend: { + rows: {}, + }, + facets: [], + }; + return stage; + } + const groupStrokeWidth = 1; + const lineZ = 0; + const defaultView = '2d'; + const minZ = 0.5; + const min3dDepth = 0.05; + const minPixelSize = 0.5; + const zAxisEncodeColor = [7, 7, 7, 255]; + const zAxisOutColor = [0, 0, 0, 255]; + function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { + if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { + stageItem.color = zAxisOutColor; + if (currAxis.axisRole !== 'z') { + const previousAxisRole = removeCurrentAxes(stage, currAxis); + if (previousAxisRole) { + currAxis.axisRole = 'z'; + stage.axes.z.push(currAxis); + } + } + } + } + function removeCurrentAxes(stage, currAxis) { + //find the current axis, remove it from parent + for (const axisRole in stage.axes) { + const axes = stage.axes[axisRole]; + for (let i = 0; i < axes.length; i++) { + if (axes[i] === currAxis) { + axes.splice(i, 1); + return axisRole; + } + } + } + } + + var defaults = /*#__PURE__*/Object.freeze({ + __proto__: null, + createStage: createStage, + defaultOnAxisItem: defaultOnAxisItem, + defaultPresenterConfig: defaultPresenterConfig, + defaultPresenterStyle: defaultPresenterStyle, + defaultView: defaultView, + groupStrokeWidth: groupStrokeWidth, + lineZ: lineZ, + min3dDepth: min3dDepth, + minHeight: minHeight, + minPixelSize: minPixelSize, + minWidth: minWidth, + minZ: minZ + }); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const vega = { + CanvasHandler: null, + inferType: null, + inferTypes: null, + loader: null, + parse: null, + read: null, + renderModule: null, + Renderer: null, + sceneVisit: null, + scheme: null, + truncate: null, + View: null, + }; + /** + * References to dependency libraries. + */ + const base = { + vega, + }; + /** + * Specify the dependency libraries to use for rendering. + * @param vega Vega library. + */ + function use(vega) { + base.vega = vega; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * HTML elements outputted by the presenter. + */ + exports.PresenterElement = void 0; + (function (PresenterElement) { + PresenterElement[PresenterElement["root"] = 0] = "root"; + PresenterElement[PresenterElement["gl"] = 1] = "gl"; + PresenterElement[PresenterElement["panel"] = 2] = "panel"; + PresenterElement[PresenterElement["legend"] = 3] = "legend"; + PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls"; + })(exports.PresenterElement || (exports.PresenterElement = {})); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const LegendView = (props) => { + const rows = []; + const addRow = (row, i) => { + const fn = symbolMap[row.symbol.shape]; + let jsx; + if (fn) { + jsx = fn(row.symbol); + } + else { + jsx = createElement("span", null, "x"); + //console.log(`need to render ${row.symbol.shape} symbol shape`); + } + rows.push({ + cells: [ + { className: 'symbol', content: jsx }, + { className: 'label', content: row.label, title: row.label }, + ], + }); + }; + const sorted = Object.keys(props.legend.rows).sort((a, b) => +a - +b); + sorted.forEach(i => addRow(props.legend.rows[i])); + if (sorted.length) { + return (createElement(Table, { rows: rows, rowClassName: "legend-row", onRowClick: (e, i) => props.onClick(e, props.legend, i) }, props.legend.title !== void 0 && createElement("tr", { onClick: e => props.onClick(e, props.legend, null) }, + createElement("th", { colSpan: 2 }, props.legend.title)))); + } + }; + const symbolMap = { + square: function (symbol) { + return (createElement("div", { style: { + height: `${symbol.bounds.y2 - symbol.bounds.y1}px`, + width: `${symbol.bounds.x2 - symbol.bounds.x1}px`, + backgroundColor: symbol.fill, + borderColor: symbol.fill, + } })); + }, + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function initializePanel(presenter) { + const rootDiv = (createElement("div", { className: className(exports.PresenterElement.root, presenter) }, + createElement("div", { className: className(exports.PresenterElement.gl, presenter), style: { minHeight, minWidth } }), + createElement("div", { className: className(exports.PresenterElement.panel, presenter) }, + createElement("div", { className: className(exports.PresenterElement.vegaControls, presenter) }), + createElement("div", { className: className(exports.PresenterElement.legend, presenter) })))); + mount(rootDiv, presenter.el); + } + function className(type, presenter) { + return `${presenter.style.cssPrefix}${exports.PresenterElement[type]}`; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function patchCubeArray(allocatedSize, empty, cubes) { + const patched = new Array(allocatedSize); + patched.fill(empty); + cubes.forEach(cube => patched[cube.ordinal] = cube); + return patched; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const legendMap = { + 'legend-title': function (legend, textItem) { + legend.title = textItem.text; + }, + 'legend-symbol': function (legend, symbol) { + const { bounds, fill, shape } = symbol; + //this object is safe for serialization + const legendRowSymbol = { bounds, fill, shape }; + const i = symbol.datum.index; + legend.rows[i] = legend.rows[i] || {}; + legend.rows[i].symbol = legendRowSymbol; + }, + 'legend-label': function (legend, label) { + const i = label.datum.index; + legend.rows[i] = legend.rows[i] || {}; + const row = legend.rows[i]; + row.label = label.text; + row.value = label.datum.value; + }, + }; + const markStager$5 = (options, stage, scene, x, y, groupType) => { + base.vega.sceneVisit(scene, function (item) { + const fn = legendMap[item.mark.role]; + if (fn) { + fn(stage.legend, item); + } + }); + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const markStager$4 = (options, stage, scene, x, y, groupType) => { + base.vega.sceneVisit(scene, function (item) { + const { bounds, height, url, width } = item; + let { x1, x2, y1, y2 } = bounds; + x1 += x; + x2 += x; + y1 += y; + y2 += y; + if (!stage.backgroundImages) { + stage.backgroundImages = []; + } + stage.backgroundImages.push({ bounds: { x1, x2, y1, y2 }, height, url, width }); + }); + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const markStager$3 = (options, stage, scene, x, y, groupType) => { + base.vega.sceneVisit(scene, function (item) { + const noZ = item.z === undefined; + const z = noZ ? 0 : (item.z || 0) + minZ; + const depth = (noZ ? 0 : (item.depth || 0)) + min3dDepth; + //change direction of y from SVG to GL + const ty = -1; + const ordinal = options.assignCubeOrdinal(item.datum); + if (ordinal > options.maxOrdinal) { + options.maxOrdinal = ordinal; + } + if (ordinal === undefined) ; + else { + const cube = { + ordinal, + size: [item.width, item.height, depth], + position: [x + ((+item.x) || 0), ty * (y + ((+item.y) || 0)) - (+item.height), z], + color: colorFromString(item.fill) || options.defaultCubeColor || [128, 128, 128, 128], + }; + cube.color[3] = item.opacity === undefined ? 255 : 255 * item.opacity; + stage.cubeData.push(cube); + } + }); + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const markStager$2 = (options, stage, scene, x, y, groupType) => { + base.vega.sceneVisit(scene, function (item) { + const x1 = item.x || 0; + const y1 = item.y || 0; + const x2 = item.x2 != null ? item.x2 : x1; + const y2 = item.y2 != null ? item.y2 : y1; + const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth); + const { currAxis } = options; + if (options.modifyAxis) { + options.modifyAxis(item, lineItem, stage, currAxis); + } + if (item.mark.role === 'axis-tick') { + currAxis.ticks.push(lineItem); + } + else if (item.mark.role === 'axis-domain') { + currAxis.domain = lineItem; + } + else { + stage.gridLines.push(lineItem); + } + }); + }; + function styledLine(x1, y1, x2, y2, stroke, strokeWidth) { + const line = { + sourcePosition: [x1, -y1, lineZ], //-1 = change direction of y from SVG to GL + targetPosition: [x2, -y2, lineZ], + color: colorFromString(stroke), + strokeWidth: strokeWidth, + }; + return line; + } + function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) { + const lines = [ + styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), + styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), + styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), + styledLine(gx, gy + height, gx, gy, stroke, strokeWidth), + ]; + if (diagonals) { + lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth)); + lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth)); + } + return lines; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //change direction of y from SVG to GL + const ty = -1; + const markStager$1 = (options, stage, scene, x, y, groupType) => { + const g = Object.assign({ opacity: 1, strokeOpacity: 1, strokeWidth: 1 }, scene.items[0]); + const path = { + strokeWidth: g.strokeWidth, + strokeColor: colorFromString(g.stroke), + positions: scene.items.map((it) => [ + it.x, + ty * it.y, + it.z || 0, + ]), + }; + path.strokeColor[3] *= g.strokeOpacity; + path.strokeColor[3] *= g.opacity; + stage.pathData.push(path); + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + // import { AlignmentBaseline, TextAnchor } from '@deck.gl/layers/text-layer/text-layer'; + const markStager = (options, stage, scene, x, y, groupType) => { + //change direction of y from SVG to GL + const ty = -1; + base.vega.sceneVisit(scene, function (item) { + if (!item.text) + return; + const size = item.fontSize; + //const alignmentBaseline = convertBaseline(item.baseline); + //const yOffset = alignmentBaseline === 'top' ? item.fontSize / 2 : 0; //fixup to get tick text correct + const yOffset = 0; + const textItem = { + color: colorFromString(item.fill), + text: item.limit === undefined ? item.text : base.vega.truncate(item.text, item.limit, 'right', item.ellipsis || '...'), //use dots instead of unicode ellipsis for + position: [x + (item.x || 0), ty * (y + (item.y || 0) + yOffset), 0], + size, + angle: convertAngle(item.angle), + //textAnchor: convertAlignment(item.align), + //alignmentBaseline, + metaData: item.metaData, + }; + const { currAxis } = options; + if (options.modifyAxis) { + options.modifyAxis(item, textItem, stage, currAxis); + } + if (item.mark.role === 'axis-label') { + const tickText = textItem; + tickText.value = item.datum.value; + currAxis.tickText.push(tickText); + } + else if (item.mark.role === 'axis-title') { + currAxis.title = textItem; + } + else { + stage.textData.push(textItem); + } + }); + }; + function convertAngle(vegaTextAngle) { + if (vegaTextAngle && !isNaN(vegaTextAngle)) { + return 360 - vegaTextAngle; + } + return 0; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + var GroupType; + (function (GroupType) { + GroupType[GroupType["none"] = 0] = "none"; + GroupType[GroupType["legend"] = 1] = "legend"; + GroupType[GroupType["xAxis"] = 2] = "xAxis"; + GroupType[GroupType["yAxis"] = 3] = "yAxis"; + GroupType[GroupType["zAxis"] = 4] = "zAxis"; + })(GroupType || (GroupType = {})); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getAxisGroupType(item, options) { + const axisItem = item; + const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; + if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== undefined) { + return GroupType.zAxis; + } + switch (axisItem.orient) { + case 'bottom': + case 'top': + return GroupType.xAxis; + case 'left': + case 'right': + return GroupType.yAxis; + } + } + function convertGroupRole(item, options) { + if (item.mark.role === 'legend') + return GroupType.legend; + if (item.mark.role === 'axis') { + const groupType = getAxisGroupType(item, options); + if (groupType !== undefined) { + return groupType; + } + } + } + const group = (options, stage, scene, x, y, groupType) => { + base.vega.sceneVisit(scene, function (g) { + const gx = g.x || 0, gy = g.y || 0; + if (g.context && g.context.background && !stage.backgroundColor) { + stage.backgroundColor = colorFromString(g.context.background); + } + if (g.stroke) { + const facetRect = { + datum: g.datum, + lines: box(gx + x, gy + y, g.height, g.width, g.stroke, groupStrokeWidth), + }; + stage.facets.push(facetRect); + } + groupType = convertGroupRole(g, options) || groupType; + setCurrentAxis(options, stage, groupType); + // draw group contents + base.vega.sceneVisit(g, function (item) { + mainStager(options, stage, item, gx + x, gy + y, groupType); + }); + }); + }; + function setCurrentAxis(options, stage, groupType) { + let axisRole; + switch (groupType) { + case GroupType.xAxis: + axisRole = 'x'; + break; + case GroupType.yAxis: + axisRole = 'y'; + break; + case GroupType.zAxis: + axisRole = 'z'; + break; + default: + return; + } + options.currAxis = { + axisRole, + domain: null, + tickText: [], + ticks: [], + }; + stage.axes[axisRole].push(options.currAxis); + } + const markStagers = { + group, + legend: markStager$5, + image: markStager$4, + rect: markStager$3, + rule: markStager$2, + line: markStager$1, + text: markStager, + }; + const mainStager = (options, stage, scene, x, y, groupType) => { + if (scene.marktype !== 'group' && groupType === GroupType.legend) { + markStager$5(options, stage, scene); + } + else { + const markStager = markStagers[scene.marktype]; + if (markStager) { + markStager(options, stage, scene, x, y, groupType); + } + } + }; + function sceneToStage(options, stage, scene) { + mainStager(options, stage, scene, 0, 0, null); + sortAxis(stage.axes.x, 0); + sortAxis(stage.axes.y, 1); + sortAxis(stage.axes.z, 1); + } + function sortAxis(axes, dim) { + axes.forEach(axis => { + if (axis.domain) + orderDomain(axis.domain, dim); + axis.ticks.sort((a, b) => a.sourcePosition[dim] - b.sourcePosition[dim]); + axis.tickText.sort((a, b) => a.position[dim] - b.position[dim]); + }); + } + function orderDomain(domain, dim) { + if (domain.sourcePosition[dim] > domain.targetPosition[dim]) { + const temp = domain.targetPosition; + domain.targetPosition = domain.sourcePosition; + domain.sourcePosition = temp; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function outerBounds(b1, b2) { + if (!b1 && !b2) + return; + if (!b1) + return b2; + if (!b2) + return b1; + const minProps = [ + 'minBoundsX', + 'minBoundsY', + 'minBoundsZ', + ]; + const maxProps = [ + 'maxBoundsX', + 'maxBoundsY', + 'maxBoundsZ', + ]; + const result = {}; + minProps.forEach(p => result[p] = notNull(Math.min, b1[p], b2[p])); + maxProps.forEach(p => result[p] = notNull(Math.max, b1[p], b2[p])); + return result; + } + function notNull(fn, v1, v2) { + if (v1 == null && v2 == null) + return null; + if (v1 == null) + return v2; + if (v2 == null) + return v1; + return fn(v1, v2); + } + function increment(b, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { + return outerBounds(b, { + minBoundsX, + minBoundsY, + minBoundsZ, + maxBoundsX, + maxBoundsY, + maxBoundsZ, + }); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const createAxesLayer = (props) => { + const { config, height, ref, stage } = props; + const { core } = ref; + const { renderer } = core; + const { x, y, z } = stage.axes; + const xyz = [...x, ...y, ...z]; + renderer.currentAxes = []; + if (!xyz.length) { + renderer.axesVisibility = AxesVisibility.none; + return; + } + renderer.axesVisibility = AxesVisibility.current; + const correlation = new AxesCorrelation(stage, 3); + const { axesSets, labels } = correlation; + const grid = correlation.getGrid(); + if (grid.byColumn[0]) { + grid.byColumn[0].forEach(row => { row.axesSet.showFacetTitleY = true; }); + grid.byRow[0].forEach(col => { col.axesSet.showFacetTitleX = true; }); + } + if (grid.rows > 1) { + const { byRow } = grid; + byRow[0].forEach(({ axesSet }, col) => { + if (!axesSet.y) { + if (byRow[1][col].axesSet) { + //move x up + byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; + byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; + delete axesSet.x; + } + } + }); + } + let bounds; + const allAxesSetBounds = []; + let anyZ = false; + for (let i = 0; i < axesSets.length; i++) { + if (axesSets[i].z) { + anyZ = true; + break; + } + } + const is3d = stage.view === '3d' && anyZ; + axesSets.forEach(axesSet => { + if (!axesSet.x && !axesSet.y) + return; + const axesSetBounds = { + axesSet, + maxBoundsX: null, + maxBoundsY: null, + maxBoundsZ: null, + minBoundsX: null, + minBoundsY: null, + minBoundsZ: null, + }; + if (is3d) { + const zBounds = getDomainBounds(1, axesSet.z); + axesSetBounds.minBoundsZ = -zBounds.maxBounds; + axesSetBounds.maxBoundsZ = -zBounds.minBounds; + } + const yBounds = getDomainBounds(1, axesSet.y); + axesSetBounds.minBoundsY = yBounds.minBounds; + axesSetBounds.maxBoundsY = yBounds.maxBounds; + axesSetBounds.y = yBounds.minBounds; + axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; + const xBounds = getDomainBounds(0, axesSet.x); + axesSetBounds.minBoundsX = xBounds.minBounds; + axesSetBounds.maxBoundsX = xBounds.maxBounds; + axesSetBounds.x = xBounds.minBounds; + axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; + allAxesSetBounds.push(axesSetBounds); + bounds = outerBounds(bounds, axesSetBounds); + }); + const facetLabelX = labels.filter(label => label.axisRole === 'x')[0]; + const facetLabelY = labels.filter(label => label.axisRole === 'y')[0]; + core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { + const axesSet = axesSets[axes]; + let a; + let f; + switch (axis) { + case 0: { + a = axesSet.x; + f = facetLabelX; + break; + } + case 1: { + a = axesSet.y; + f = facetLabelY; + break; + } + case 2: { + a = axesSet.z; + break; + } + } + if (a) { + config.onTextClick(manipulator.event, a.title || f.title); + } + }; + allAxesSetBounds.forEach(axesSetBounds => { + const { axesSet } = axesSetBounds; + if (!axesSet.x && !axesSet.y) + return; + const cartesian = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); + cartesian.isDivisionPickingEnabled = [false, false, false]; + cartesian.arePickDivisionsVisible = [false, false, false]; + cartesian.isLabelPickingEnabled = [false, false, false]; + cartesian.isTitlePickingEnabled = [false, false, false]; + cartesian.isGridPickingEnabled = false; + cartesian.isHeadingPickingEnabled = [false, false, false]; + createAxes(cartesian, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height, props, axesSet.showFacetTitleX && facetLabelX); + createAxes(cartesian, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height, props, axesSet.showFacetTitleY && facetLabelY); + if (is3d) { + createAxes(cartesian, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height, props); + } + configCartesianAxes(is3d, bounds, cartesian); + const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY, } = bounds; + const w = maxBoundsX - minBoundsX; + const h = maxBoundsY - minBoundsY; + cartesian.scalingX = axesSetBounds.w / w; + cartesian.scalingY = axesSetBounds.h / h; + cartesian.offsetX = ((axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w) - 0.5; + cartesian.offsetY = ((axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h) - 0.5; + const aspect = (h / w); + if (aspect > 1) { + cartesian.offsetX /= aspect; + } + else { + cartesian.offsetY *= aspect; + } + const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian) : renderer.createCartesian2dAxesVisual(cartesian); + renderer.currentAxes.push(axes); + props.config.onAxesComplete && props.config.onAxesComplete(cartesian); + }); + return { bounds }; + }; + const nullDomain = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0], + }; + class AxesCorrelation { + constructor(stage, dimensions) { + this.dimensions = dimensions; + const { x, y, z } = stage.axes; + this.axesSets = []; + this.labels = []; + [x, y, z].forEach(axes => { + axes.forEach(axis => { + if (this.axesSets.length === 0) { + this.initialize(axis); + } + else { + this.correlate(axis); + } + }); + }); + } + getGrid() { + const mapCols = {}; + const mapRows = {}; + this.axesSets.forEach(axesSet => { + var _a; + const domain = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; + if (!domain) + return; + const col = domain.sourcePosition[0].toString(); + const row = domain.sourcePosition[1].toString(); + if (!mapCols[col]) { + mapCols[col] = {}; + } + mapCols[col][row] = axesSet; + mapRows[row] = null; + }); + const colKeys = Object.keys(mapCols).sort((a, b) => +a - +b); + const rowKeys = Object.keys(mapRows).sort((a, b) => +a - +b); + return { + cols: colKeys.length, + rows: rowKeys.length, + byColumn: colKeys.map(colKey => rowKeys.map(rowKey => { return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; })), + byRow: rowKeys.map(rowKey => colKeys.map(colKey => { return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; })), + }; + } + initialize(axis) { + if (!axis.domain) { + this.labels.push(axis); + return; + } + const axesSet = {}; + axesSet[axis.axisRole] = axis; + this.axesSets.push(axesSet); + } + correlate(axis) { + if (!axis.domain) { + this.labels.push(axis); + return; + } + for (let i = 0; i < this.axesSets.length; i++) { + const axesSet = this.axesSets[i]; + for (const axisRole in axesSet) { + const test = axesSet[axisRole]; + if (this.matchDomains(axis.domain, test.domain)) { + //prefer the axes with titles + if (!axesSet[axis.axisRole] || (!axesSet[axis.axisRole].tickText.length && axis.tickText.length)) { + axesSet[axis.axisRole] = axis; + } + return; + } + } + } + this.initialize(axis); + } + matchDomains(a, b) { + if (this.matchPoint(a.sourcePosition, b.sourcePosition)) + return true; + if (this.matchPoint(a.sourcePosition, b.targetPosition)) + return true; + if (this.matchPoint(a.targetPosition, b.targetPosition)) + return true; + if (this.matchPoint(a.targetPosition, b.sourcePosition)) + return true; + return false; + } + matchPoint(a, b) { + for (let i = 0; i < this.dimensions; i++) { + if (a[i] !== b[i]) + return false; + } + return true; + } + } + function createAxes(cartesian, dim2d, dim3d, axis, orientation, height, props, facetLabel) { + const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain, dim2d, height); + if (axis.axisRole === 'z') { + tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); + textPos.forEach((t, i) => textPos[i] = 1 - t); + tickText.reverse(); + tickPositions.reverse(); + textPos.reverse(); + } + cartesian.setTickPositions(dim3d, tickPositions); + cartesian.zero[dim3d] = 0; //TODO get any "zero" gridline position from vega + cartesian.setLabelPositions(dim3d, textPos); + cartesian.setLabels(dim3d, tickText); + cartesian.setLabelSizes(dim3d, textSize); + const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); + if (title === null || title === void 0 ? void 0 : title.text) { + cartesian.setTitle(dim3d, title.text); + cartesian.setTitleSize(dim3d, title.size / height); + } + cartesian.setLabelOrientation(dim3d, orientation); + props.config.onAxisConfig && props.config.onAxisConfig(cartesian, dim3d, axis); + return { + tickText, + }; + } + function configCartesianAxes(is3d, bounds, cartesian) { + if (is3d) { + cartesian.isEdgeVisible[Edge3D.topBack] = false; + } + cartesian.isEdgeVisible[Edge3D.backRight] = false; + cartesian.isEdgeVisible[Edge3D.bottomRight] = false; + cartesian.isEdgeVisible[Edge3D.frontRight] = false; + cartesian.isEdgeVisible[Edge3D.topFront] = false; + cartesian.isEdgeVisible[Edge3D.topRight] = false; + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ, } = bounds; + cartesian.minBoundsX = minBoundsX; + cartesian.maxBoundsX = maxBoundsX; + cartesian.minBoundsY = minBoundsY; + cartesian.maxBoundsY = maxBoundsY; + if (is3d) { + cartesian.minBoundsZ = minBoundsZ; + cartesian.maxBoundsZ = maxBoundsZ; + } + } + function getDomainBounds(dim2d, axis) { + const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const minBounds = domain.sourcePosition[dim2d]; + const maxBounds = domain.targetPosition[dim2d]; + return { + maxBounds, + minBounds, + }; + } + function convertAxis(axis, domain, dim, height) { + const start = domain.sourcePosition[dim]; + const span = domain.targetPosition[dim] - start; + const tickPositions = axis + ? + axis.ticks.map(t => (t.sourcePosition[dim] - start) / span) + : + []; + const tickText = axis ? + axis.tickText.map(t => t.text) + : + []; + const textPos = axis ? + axis.tickText.map(t => (t.position[dim] - start) / span) + : + []; + const textSize = axis ? + axis.tickText.map(t => t.size / height) + : + []; + if (tickPositions.length) { + if (tickPositions[0] !== 0) { + tickPositions[0] = 0; + } + if (tickPositions[tickPositions.length - 1] !== 1) { + tickPositions[tickPositions.length - 1] = 1; + } + } + return { + tickPositions, + tickText, + textPos, + textSize, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class ColorMap { + constructor(quant = 5) { + this.quant = quant; + this.colorMap = {}; + this.colorArray = []; + } + getColorKey(rgbaColor) { + const color = rgbaColor.slice(0, 3).map(e => Math.floor(e / this.quant) * this.quant); + color[3] = rgbaColor[3]; //retain alpha + return JSON.stringify(color); + } + registerColor(rgbaColor) { + const colorKey = this.getColorKey(rgbaColor); + if (!this.colorMap[colorKey]) { + this.colorMap[colorKey] = { + index: this.colorArray.length, + rgbaColor, + }; + this.colorArray.push(rgbaColor); + } + return this.colorMap[colorKey].index; + } + getPalette() { + return { + palette: new Uint8Array(this.colorArray.flat()), + maxColor: this.colorArray.length - 1, + }; + } + } + function convert$3(newColor) { + const c = colorFromString(newColor).slice(0, 3); + return c.map(v => v / 255); + } + function colorConfig(ref, colors) { + if (!colors) + return; + const { config } = ref.core; + config.activeColor = convert$3(colors.activeItemColor); + config.backgroundColor = new Float32Array(convert$3(colors.backgroundColor)); + config.textColor = convert$3(colors.textColor); + config.textBorderColor = convert$3(colors.textBorderColor); + config.axesTextColor = convert$3(colors.axesTextLabelColor); + config.axesGridBackgroundColor = convert$3(colors.axesGridBackgroundColor); + config.axesGridHighlightColor = convert$3(colors.axesGridHighlightColor); + config.axesGridMinorColor = convert$3(colors.axesGridMinorColor); + config.axesGridMajorColor = convert$3(colors.axesGridMajorColor); + config.axesGridZeroColor = convert$3(colors.axesGridZeroColor); + //TODO fix this - hack to reset the background color + ref.core.renderer['_theme'] = null; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const key$1 = 'cube'; + const createCubeLayer = (props) => { + const { ref, stage } = props; + const { core } = ref; + const scatter = new Scatter(core); + const { ids, colors, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds, maxColor, palette, } = convert$2(stage); + if (!ids.length) + return; + const { renderer } = core; + let cubeTransitionBuffer = renderer.transitionBuffers.find(t => t.key === key$1); + if (!cubeTransitionBuffer) { + cubeTransitionBuffer = renderer.createTransitionBuffer(ids); + cubeTransitionBuffer.key = key$1; + renderer.transitionBuffers.push(cubeTransitionBuffer); + } + else { + cubeTransitionBuffer.swap(); + } + scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { + positionsX, + positionsY, + positionsZ, + }); + const layer = { + positionsX, + positionsY, + positionsZ, + update: (newBounds, selected, stagger) => { + const { colors, maxColor, minColor, palette } = layer.unitColorMap; + // reference off of core.renderer to get the actual buffer + const currCubeTransitionBuffer = core.renderer.transitionBuffers.find(t => t.key === key$1); + currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; + currCubeTransitionBuffer.currentPalette.colors = palette; + let options = Object.assign({ selected, + colors, + minColor, + maxColor, + sizesX, + sizesY, + sizesZ }, newBounds); + if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { + const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; + options = Object.assign(Object.assign({}, options), { maxStaggerOrder, + minStaggerOrder, + staggerOrders }); + } + scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); + }, + bounds, + unitColorMap: { + colors, + ids, + minColor: 0, + maxColor, + palette, + }, + }; + return layer; + }; + function convert$2(stage) { + const { cubeData } = stage; + const { length } = cubeData; + const ids = []; + const colors = new Float64Array(length); + const positionsX = new Float64Array(length); + const positionsY = new Float64Array(length); + const positionsZ = new Float64Array(length); + const sizesX = new Float64Array(length); + const sizesY = new Float64Array(length); + const sizesZ = new Float64Array(length); + let bounds; + const colorMap = new ColorMap(); + cubeData.forEach((cube, i) => { + ids.push(i); + if (cube.isEmpty) { + positionsX[i] = 0; + positionsY[i] = 0; + positionsZ[i] = 0; + sizesX[i] = 0; + sizesY[i] = 0; + sizesZ[i] = 0; + colors[i] = 0; + } + else { + //ids.push(cube.ordinal); + positionsX[i] = cube.position[0] + cube.size[0] * 0.5; + positionsY[i] = cube.position[1] + cube.size[1] * 0.5; + positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; + sizesX[i] = cube.size[0]; + sizesY[i] = cube.size[1]; + sizesZ[i] = cube.size[2]; + bounds = increment(bounds, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); + colors[i] = colorMap.registerColor(cube.color); + } + }); + const { palette, maxColor } = colorMap.getPalette(); + return { + ids: new Uint32Array(ids), + colors, + positionsX, + positionsY, + positionsZ, + sizesX, + sizesY, + sizesZ, + bounds, + maxColor, + palette, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const key = 'line'; + const createLineLayer = (props) => { + const { height, ref, stage} = props; + const { core } = ref; + const lines = new Line(core); + const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette, } = convert$1(stage, height); + if (!ids.length) + return; + const { renderer } = core; + let lineTransitionBuffer = renderer.transitionBuffers.find(t => t.key === key); + if (!lineTransitionBuffer) { + lineTransitionBuffer = renderer.createTransitionBuffer(ids); + lineTransitionBuffer.key = key; + renderer.transitionBuffers.push(lineTransitionBuffer); + } + else { + lineTransitionBuffer.swap(); + } + lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { + positionsX, + positionsY, + positionsZ, + lineSizes, + sizeScaling: 1, + }); + let options = { + lineColors, + lineMinColor: 0, + lineMaxColor, + }; + // Unit type + lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; + lineTransitionBuffer.currentPalette.colors = palette; + return { + update: newBounds => { + options = Object.assign(Object.assign({}, options), newBounds); + // reference off of core.renderer to get the actual buffer + const currLineTransitionBuffer = core.renderer.transitionBuffers.find(t => t.key === key); + lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); + }, + bounds, + unitColorMap: { + ids, + colors: lineColors, + minColor: 0, + maxColor: lineMaxColor, + palette, + }, + }; + }; + function convert$1(stage, height, width) { + const { pathData } = stage; + const positions = []; + const lines = []; + const colorMap = new ColorMap(); + pathData.forEach(path => { + const color = colorMap.registerColor(path.strokeColor); + let from = positions.length; + positions.push(path.positions[0]); + for (let i = 1; i < path.positions.length; i++) { + const to = positions.length; + positions.push(path.positions[i]); + lines.push({ + id: lines.length, + from, + to, + color, + size: path.strokeWidth, + }); + from = to; + } + }); + const ids = new Uint32Array(lines.length); + const fromIds = new Uint32Array(lines.length); + const toIds = new Uint32Array(lines.length); + const lineColors = new Float64Array(lines.length); + const lineSizes = new Float64Array(lines.length); + lines.forEach((line, i) => { + ids[i] = i; + fromIds[i] = line.from; + toIds[i] = line.to; + lineColors[i] = line.color; + lineSizes[i] = line.size; + }); + const positionsX = new Float64Array(positions.length); + const positionsY = new Float64Array(positions.length); + const positionsZ = new Float64Array(positions.length); + let bounds; + positions.forEach((p, i) => { + positionsX[i] = p[0]; + positionsY[i] = p[1] + height; + positionsZ[i] = p[2]; + bounds = increment(bounds, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); + }); + const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); + return { + ids, + fromIds, + toIds, + lineColors, + lineSizes, + bounds, + positionsX, + positionsY, + positionsZ, + lineMaxColor, + palette, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const createTextLayer = (props) => { + const { ref, stage } = props; + const { core } = ref; + const { positionsX, positionsY, positionsZ, sizes, bounds, maxGlyphs, text, } = convert(stage); + if (text.length === 0) { + core.renderer.labelSets = []; + return; + } + const options = { + text, + maxGlyphs, + scales: sizes, + }; + const labelSet = new LabelSet(core, options); + labelSet.positionsX = positionsX; + labelSet.positionsY = positionsY; + labelSet.positionsZ = positionsZ; + labelSet.horizontalAlignment = HorizontalAlignment.center; + labelSet.verticalAlignment = VerticalAlignment.center; + const layer = { + update: bounds => { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ, } = bounds; + labelSet.minBoundsX = minBoundsX; + labelSet.minBoundsY = minBoundsY; + labelSet.minBoundsZ = minBoundsZ; + labelSet.maxBoundsX = maxBoundsX; + labelSet.maxBoundsY = maxBoundsY; + labelSet.maxBoundsZ = maxBoundsZ; + }, + bounds, + }; + const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); + core.renderer.labelSets = [labelSetVisual]; + return layer; + }; + function convert(stage) { + const { textData } = stage; + const { length } = textData; + const ids = []; + const text = []; + const colors = new Float64Array(length); + const positionsX = new Float64Array(length); + const positionsY = new Float64Array(length); + const positionsZ = new Float64Array(length); + const sizes = new Float64Array(length); + let bounds; + let maxGlyphs = 0; + const colorMap = new ColorMap(); + textData.forEach((t, i) => { + ids.push(i); + text.push(t.text); + maxGlyphs += t.text.length; + positionsX[i] = t.position[0]; + positionsY[i] = t.position[1]; + positionsZ[i] = t.position[2]; + sizes[i] = 1.5 * t.size; //scale similar to axes + bounds = increment(bounds, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); + colors[i] = colorMap.registerColor(t.color); + }); + const { palette, maxColor } = colorMap.getPalette(); + return { + ids: new Uint32Array(ids), + colors, + positionsX, + positionsY, + positionsZ, + sizes, + bounds, + maxColor, + maxGlyphs, + palette, + text, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getImageData(url) { + return new Promise((resolve, reject) => { + const imageElement = document.createElement('img'); + imageElement.onload = () => { + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + const { height, width } = imageElement; + canvas.width = width; + canvas.height = height; + ctx.drawImage(imageElement, 0, 0); + resolve(ctx.getImageData(0, 0, width, height)); + }; + imageElement.src = url; + }); + } + function createImageQuad(core, imageData, bounds, position, width, height) { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + const imageOptions = { + imageData, + position, + height, + width, + minBoundsX, + maxBoundsX, + minBoundsZ, + maxBoundsZ, + minBoundsY, + maxBoundsY, + }; + return new ImageQuad(core, imageOptions); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function createCameraDefaults() { + const qModelRotation2d = create$1(); + const qModelRotation3d = Constants.QUAT_ROTATEX_MINUS_90; + const qCameraRotation2d = create$1(); + const qCameraRotation3d = create$1(); + const qAngle = create$1(); + const vCameraPosition = create$3(); + // Altitude (pitch around local right axis) + setAxisAngle(qCameraRotation3d, Constants.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); + // Azimuth (yaw around global up axis) + setAxisAngle(qAngle, Constants.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); + multiply(qCameraRotation3d, qCameraRotation3d, qAngle); + return { + qModelRotation2d, + qModelRotation3d, + qCameraRotation2d, + qCameraRotation3d, + vCameraPosition, + }; + } + const cameraDefaults = createCameraDefaults(); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + function applyCameraCallbacks(ref, lastPresenterConfig, lastView, transistion2dOnly) { + const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref; + ref.reset = () => { + core.reset(true); + if (lastView === '3d') { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = qCameraRotation3d; + cameraTransitioner.vPosition.to = vCameraPosition; + } + else { + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = qCameraRotation2d; + cameraTransitioner.vPosition.to = vCameraPosition; + } + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); + core.setModelRotation(modelTransitioner.qRotation.current, true); + core.camera.setOrbit(cameraTransitioner.qRotation.to, true); + core.camera.setPosition(cameraTransitioner.vPosition.to, true); + }; + const cam = (t) => { + slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); + lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); + core.camera.setOrbit(cameraTransitioner.qRotation.current, false); + core.camera.setPosition(cameraTransitioner.vPosition.current, false); + // disable picking during transitions, as the performance degradation could reduce the framerate + core.inputManager.isPickingEnabled = false; + }; + core.updateCallback = (elapsedTime) => { + const { transitionDurations } = lastPresenterConfig; + if (positionTransitioner.isTransitioning) { + const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); + core.renderer.transitionTime = t; + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } + else { + core.inputManager.isPickingEnabled = true; + } + if (modelTransitioner.isTransitioning) { + const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); + if (modelTransitioner.shouldTransition) { + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); + core.setModelRotation(modelTransitioner.qRotation.current, false); + } + cam(tm); + } + if (cameraTransitioner.isTransitioning) { + const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); + cam(t); + } + }; + } + function setTransitionTimeAxesVisibility(transistion2dOnly, core) { + const t = core.renderer.transitionTime; + if (transistion2dOnly) { + if (t < 0.5) { + core.renderer.axesVisibility = AxesVisibility.previous; + } + else { + core.renderer.axesVisibility = AxesVisibility.current; + } + } + else { + if (t <= 0.01) { + core.renderer.axesVisibility = AxesVisibility.previous; + } + else if (t >= 0.99) { + core.renderer.axesVisibility = AxesVisibility.current; + } + else { + core.renderer.axesVisibility = AxesVisibility.none; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function morphChartsRender(ref, prevStage, stage, height, width, preStage, colors, config) { + const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref; + let transistion2dOnly = false; + let cameraTo; + let holdCamera; + if (config.camera === 'hold') { + holdCamera = true; + } + else { + cameraTo = config.camera; + } + if (prevStage && (prevStage.view !== stage.view)) { + modelTransitioner.shouldTransition = !holdCamera; + if (stage.view === '2d') { + modelTransitioner.qRotation.from = qModelRotation3d; + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } + else { + modelTransitioner.qRotation.from = qModelRotation2d; + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } + } + else { + modelTransitioner.shouldTransition = false; + if (stage.view === '2d') { + transistion2dOnly = true; + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } + else { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; + } + } + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + if (!prevStage) { + core.setModelRotation(modelTransitioner.qRotation.to, false); + core.camera.setOrbit(cameraTransitioner.qRotation.to, false); + core.camera.setPosition(cameraTransitioner.vPosition.to, false); + } + else if (!holdCamera) { + cameraTransitioner.begin(); + } + positionTransitioner.begin(); + if (modelTransitioner.shouldTransition) { + modelTransitioner.begin(); + } + const props = { ref, stage, height, config }; + const cubeLayer = createCubeLayer(props); + const lineLayer = createLineLayer(props); + const textLayer = createTextLayer(props); + const { backgroundImages } = stage; + let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); + backgroundImages === null || backgroundImages === void 0 ? void 0 : backgroundImages.forEach(backgroundImage => { + contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); + }); + props.bounds = contentBounds; + core.renderer.previousAxes = core.renderer.currentAxes; + const axesLayer = createAxesLayer(props); + core.config.transitionStaggering = config.transitionDurations.stagger; + core.config.transitionDuration = config.transitionDurations.position; + let bounds; + if (axesLayer && axesLayer.bounds) { + bounds = axesLayer.bounds; + } + else { + bounds = contentBounds; + } + ref.setMorphChartsRendererOptions(config.renderer); + if (preStage) { + preStage(stage, cubeLayer); + } + //add images + core.renderer.images = []; + if (backgroundImages) { + const addImage = (imageBounds, imageData) => { + const imageWidth = imageBounds.maxBoundsX - imageBounds.minBoundsX; + const imageHeight = imageBounds.maxBoundsY - imageBounds.minBoundsY; + const position = [imageBounds.minBoundsX + imageWidth / 2, imageBounds.minBoundsY + imageHeight / 2, 0]; + const imageQuad = createImageQuad(core, imageData, contentBounds, position, imageWidth, imageHeight); + const imageVisual = core.renderer.createImageVisual(imageQuad); + core.renderer.images.push(imageVisual); + }; + const imageDataCache = {}; + backgroundImages.forEach(backgroundImage => { + const imageBounds = convertBounds(backgroundImage.bounds); + const imageData = imageDataCache[backgroundImage.url]; + if (imageData) { + addImage(imageBounds, imageData); + } + else { + getImageData(backgroundImage.url).then(imageData => { + imageDataCache[backgroundImage.url] = imageData; + addImage(imageBounds, imageData); + }); + } + }); + } + //Now call update on each layout + layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds, ref.layerStagger); + applyCameraCallbacks(ref, config, stage.view, transistion2dOnly); + core.renderer.transitionTime = 0; // Set renderer transition time for this render pass to prevent rendering target buffer for single frame + colorConfig(ref, colors); + return { + bounds, + getCubeLayer: () => cubeLayer, + update: layerSelection => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, ref.layerStagger), + activate: id => core.renderer.transitionBuffers[0].activeId = id, + moveCamera: (camera) => { + if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + cameraTransitioner.move(camera.position, camera.rotation); + } + }, + setTransitionTimeAxesVisibility: () => { + setTransitionTimeAxesVisibility(transistion2dOnly, core); + }, + }; + } + function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, layerStagger) { + const layerItems = [ + { + layer: cubeLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes, + }, + { + layer: lineLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines, + }, + { + layer: textLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts, + }, + ]; + layerItems.forEach(layerItem => { var _a; return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds, layerItem.selection, layerItem.stagger); }); + } + function convertBounds(bounds) { + if (!bounds) + return; + return { + minBoundsX: bounds.x1, + maxBoundsX: bounds.x2, + minBoundsY: -bounds.y2, + maxBoundsY: -bounds.y1, + minBoundsZ: minZ, + maxBoundsZ: minZ, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function shouldChangeRenderer(prev, next) { + var _a, _b; + if (!prev || !next) + return true; + if (prev.advanced !== next.advanced) + return true; + if (!prev.advanced) { + return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); + } + } + function getRenderer(mcRendererOptions, core) { + const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; + const r = advanced ? + new Main() + : + new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); + core.renderer = r; + setRendererOptions(r, mcRendererOptions); + return r; + } + function setRendererOptions(renderer, mcRendererOptions) { + const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; + if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) { + for (const key in o) { + renderer.config[key] = o[key]; + } + } + } + function rendererEnabled(advanced) { + const r = advanced ? + new Main() + : + new Main$1(); + return r.isSupported; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const rightButton = 2; + function listenCanvasEvents(core, options) { + const { container, pickGridCallback } = options; + const { inputManager } = core; + if (options.onLasso) { + inputManager.pickLassoCallback = result => { + options.onLasso(result.ids[0], result.manipulator.event); + }; + } + inputManager.singleTouchAction = manipulator => { + if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.rotate; + } + else if (manipulator.altKey) { + return SingleTouchAction.lasso; + } + else { + return SingleTouchAction.translate; + } + }; + inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { + clearClickTimeout(); + const { altKey, button, shiftKey } = manipulator; + const me = { altKey, shiftKey, button }; + const e = me; + pickGridCallback([divisionX, divisionY, divisionZ], e); + }; + const canvas = container.getElementsByTagName('canvas')[0]; + let pickedId; + const hover = (e) => { + if (core.renderer.pickedId !== pickedId) { + pickedId = core.renderer.pickedId; + const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeHover(e, ordinal); + } + }; + canvas.addEventListener('mousemove', (e) => { + clearClickTimeout(); + if (mousedown) { + options.onCubeHover(e, null); + } + hover(e); + }); + canvas.addEventListener('mouseout', hover); + canvas.addEventListener('mouseover', hover); + let mousedown; + canvas.addEventListener('mousedown', () => { + mousedown = true; + }); + canvas.addEventListener('mouseup', (e) => { + mousedown = false; + }); + let canvasClickTimeout; + const clearClickTimeout = () => { + clearTimeout(canvasClickTimeout); + canvasClickTimeout = null; + }; + canvas.addEventListener('click', (e) => { + canvasClickTimeout = setTimeout(() => { + options.onCanvasClick(e); + }, 50); + }); + inputManager.pickItemCallback = ({ manipulator }) => { + clearClickTimeout(); + const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeClick(manipulator.event, ordinal); + }; + } + + function cubicInOut(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function easing(t) { + if (t === 0 || t === 1) + return t; + return cubicInOut(t); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Transitioner { + constructor() { + this.isTransitioning = false; + } + begin() { + this.isTransitioning = true; + this.time = 0; + } + elapse(elapsedTime, totalTime, ease = false) { + this.time += elapsedTime; + if (this.time >= totalTime) { + this.isTransitioning = false; + this.time = totalTime; + this.ended && this.ended(); + } + const t = this.time / totalTime; + return ease ? easing(t) : t; + } + } + class CameraTransitioner extends Transitioner { + constructor() { + super(); + this.qRotation = { + from: create$1(), + to: null, + current: create$1(), + }; + this.vPosition = { + from: create$3(), + to: null, + current: create$3(), + }; + } + move(position, rotation) { + this.begin(); + this.qRotation.to = rotation; + this.vPosition.to = position; + } + } + class ModelTransitioner extends Transitioner { + constructor() { + super(); + this.shouldTransition = false; + this.qRotation = { + from: null, + to: null, + current: create$1(), + }; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function init(options, mcRendererOptions) { + const { container } = options; + const core = new Core({ container }); + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options); + core.config.pickSelectDelay = 50; + const cameraTransitioner = new CameraTransitioner(); + const modelTransitioner = new ModelTransitioner(); + const positionTransitioner = new Transitioner(); + positionTransitioner.ended = () => { + core.renderer.axesVisibility = AxesVisibility.current; + }; + const ref = { + supportedRenders: { + advanced: rendererEnabled(true), + basic: rendererEnabled(false), + }, + reset: null, + cameraTransitioner, + modelTransitioner, + positionTransitioner, + core, + setMorphChartsRendererOptions(mcRendererOptions) { + if (shouldChangeRenderer(ref.lastMorphChartsRendererOptions, mcRendererOptions)) { + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options); + } + else { + if (mcRendererOptions.advanced) { + //same renderer, poke the config + setRendererOptions(core.renderer, mcRendererOptions); + } + } + ref.lastMorphChartsRendererOptions = mcRendererOptions; + }, + lastMorphChartsRendererOptions: mcRendererOptions, + layerStagger: {}, + }; + return ref; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Class which presents a Stage of chart data using MorphCharts to render. + */ + class Presenter { + /** + * Get the previously rendered Stage object. + */ + get stage() { + return this._last.stage; + } + /** + * Get the current View camera type. + */ + get view() { + return this._last.view; + } + /** + * Instantiate a new Presenter. + * @param el Parent HTMLElement to present within. + * @param style Optional PresenterStyle styling options. + */ + constructor(el, style) { + this.el = el; + this.style = deepMerge(defaultPresenterStyle, style); + initializePanel(this); + this._last = { view: null, height: null, width: null, cubeCount: null, stage: null }; + } + /** + * Cancels any pending animation, calling animationCanceled() on original queue. + */ + animationCancel() { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + if (this.logger) { + this.logger(`canceling animation ${(this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel) || 'handler'}`); + } + if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) { + this.queuedAnimationOptions.animationCanceled.call(null); + } + } + } + /** + * Stops the current animation and queues a new animation. + * @param handler Function to invoke when timeout is complete. + * @param timeout Length of time to wait before invoking the handler. + * @param options Optional QueuedAnimationOptions object. + */ + animationQueue(handler, timeout, options) { + if (this.logger) { + this.logger(`queueing animation ${(options && options.waitingLabel) || 'waiting'}...(${timeout})`); + } + this.animationCancel(); + this.animationTimer = setTimeout(() => { + if (this.logger) { + this.logger(`queueing animation ${(options && options.handlerLabel) || 'handler'}...`); + } + handler(); + }, timeout); + } + /** + * Retrieve a sub-element of the rendered output. + * @param type PresenterElement type of the HTMLElement to retrieve. + */ + getElement(type) { + const elements = this.el.getElementsByClassName(className(type, this)); + if (elements && elements.length) { + return elements[0]; + } + } + /** + * Present the Vega Scene, or Stage object using Morphcharts. + * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. + * @param height Height of the rendering area. + * @param width Width of the rendering area. + * @param config Optional presentation configuration object. + */ + present(sceneOrStage, height, width, config) { + this.animationCancel(); + const scene = sceneOrStage; + let stage; + const options = { + maxOrdinal: 0, + currAxis: null, + defaultCubeColor: this.style.defaultCubeColor, + assignCubeOrdinal: (config && config.onSceneRectAssignCubeOrdinal) || (() => options.maxOrdinal++), + modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, + zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex, + }; + //determine if this is a vega scene + if (scene.marktype) { + stage = createStage(scene.view); + sceneToStage(options, stage, scene); + } + else { + stage = sceneOrStage; + } + const c = deepMerge(defaultPresenterConfig, config); + if (!this.morphchartsref) { + this._morphChartsOptions = { + container: this.getElement(exports.PresenterElement.gl), + pickGridCallback: c.axisPickGridCallback, + onCubeHover: (e, ordinal) => { + c.onCubeHover(e, { ordinal, color: null, position: null, size: null }); + }, + onCubeClick: (e, ordinal) => { + c.onCubeClick(e, { ordinal, color: null, position: null, size: null }); + }, + onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, + onLasso: config === null || config === void 0 ? void 0 : config.onLasso, + }; + this.morphchartsref = init(this._morphChartsOptions, c.renderer || defaultPresenterConfig.renderer); + } + let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); + if (options.maxOrdinal) { + cubeCount = Math.max(cubeCount, options.maxOrdinal); + const empty = { + isEmpty: true, + }; + stage.cubeData = patchCubeArray(cubeCount, empty, stage.cubeData); + } + config.preLayer && config.preLayer(stage); + this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height, width, config && config.preStage, config && config.morphChartsColors, c); + delete stage.cubeData; + delete stage.redraw; + this._last = { + cubeCount, + height, + width, + stage, + view: stage.view, + }; + const a = getActiveElementInfo(); + mount(LegendView({ legend: stage.legend, onClick: config && config.onLegendClick }), this.getElement(exports.PresenterElement.legend)); + setActiveElement(a); + if (config && config.onPresent) { + config.onPresent(); + } + } + canvasToDataURL() { + return new Promise((resolve, reject) => { + this.morphchartsref.core.afterRenderCallback = () => { + this.morphchartsref.core.afterRenderCallback = null; + const canvas = this.getElement(exports.PresenterElement.gl).getElementsByTagName('canvas')[0]; + const png = canvas.toDataURL('image/png'); + resolve(png); + }; + }); + } + configColors(mcColors) { + colorConfig(this.morphchartsref, mcColors); + } + /** + * Home the camera to the last initial position. + */ + homeCamera() { + var _a; + (_a = this.morphchartsref) === null || _a === void 0 ? void 0 : _a.reset(); + } + /** + * Show guidelines of rendering height/width and center of OrbitView. + */ + showGuides() { + this.getElement(exports.PresenterElement.gl).classList.add('show-center'); + //TODO Morphcharts gridlines + } + finalize() { + this.animationCancel(); + if (this.morphchartsref) + this.morphchartsref.core.stop(); + if (this.el) + this.el.innerHTML = ''; + this._last = null; + this.morphchartsref = null; + this.el = null; + this.logger = null; + this.queuedAnimationOptions = null; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //pass in the SuperClass, which should be a vega.View + function _RendererGl(loader) { + //dynamic superclass, since we don't know have vega.View in the declaration phase + class RendererGlInternal extends base.vega.Renderer { + initialize(el, width, height, origin) { + this.height = height; + this.width = width; + // this method will invoke resize to size the canvas appropriately + return super.initialize(el, width, height, origin); + } + resize(width, height, origin) { + super.resize(width, height, origin); + this.origin = origin; + this.height = height; + this.width = width; + //rteturn this for vega + return this; + } + _render(scene, items) { + const scene3d = scene; + scene3d.view = this.getView(); + this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); + //return this for vega + return this; + } + } + const instance = new RendererGlInternal(loader); + return instance; + } + //signature to allow this function to be used with the 'new' keyword. + //need to trick the compiler by casting to 'any'. + /** + * Subclass of Vega.Renderer, with added properties for accessing a Presenter. + * This is instantiated by ViewGl. + */ + const RendererGl = _RendererGl; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + let registered = false; + //dynamic superclass lets us create a subclass at execution phase instead of declaration phase. + //This allows us to retrieve vega.View from either UMD or ES6 consumers of this class. + //pass in the SuperClass, which should be a vega.View + function _ViewGl(runtime, config) { + //dynamic superclass, since we don't know have vega.View in the declaration phase + class ViewGlInternal extends base.vega.View { + constructor(runtime, config = {}) { + super(runtime, config); + this.config = config; + this.presenter = config.presenter; + config.presenterConfig = config.presenterConfig || {}; + config.presenterConfig.redraw = () => { + this._redraw = true; //use Vega View private member _redraw + this.run(); + }; + } + renderer(...args) { + if (args && args.length) { + const renderer = args[0]; + if (renderer === 'morphcharts' && !registered) { + base.vega.renderModule('morphcharts', { handler: base.vega.CanvasHandler, renderer: RendererGl }); + registered = true; + } + return super.renderer(renderer); + } + else { + return super.renderer(); + } + } + initialize(el) { + if (!this.presenter) { + this.presenter = new Presenter(el); + } + super.initialize(this.presenter.getElement(exports.PresenterElement.vegaControls)); + const renderer = this._renderer; + renderer.presenterConfig = this.config.presenterConfig; + renderer.presenter = this.presenter; + renderer.getView = this.config && this.config.getView || (() => this.presenter.view || defaultView); + return this; + } + error(e) { + if (this.presenter.logger) { + this.presenter.logger(e); + } + } + } + const instance = new ViewGlInternal(runtime, config); + return instance; + } + //signature to allow this function to be used with the 'new' keyword. + //need to trick the compiler by casting to 'any'. + /** + * Subclass of Vega.View, with added properties for accessing a Presenter. + * This is instantiatable by calling `new ViewGl()`. See https://vega.github.io/vega/docs/api/view/ + */ + const ViewGl = _ViewGl; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const version = '1.0.6'; + + exports.Presenter = Presenter; + exports.ViewGl = ViewGl; + exports.base = base; + exports.controls = controls; + exports.defaults = defaults; + exports.types = types; + exports.use = use; + exports.util = util; + exports.version = version; })); diff --git a/docs/embed/v4/sanddance-embed.html b/docs/embed/v4/sanddance-embed.html index fb4ea1f19..21686b4c7 100644 --- a/docs/embed/v4/sanddance-embed.html +++ b/docs/embed/v4/sanddance-embed.html @@ -10,7 +10,7 @@ <body> <script src="https://unpkg.com/react@17/umd/react.production.min.js"></script> <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> - <script src="https://unpkg.com/vega@5.32/build/vega.min.js"></script> + <script src="https://unpkg.com/vega@6.2/build/vega.min.js"></script> <script src="https://unpkg.com/@fluentui/react@8/dist/fluentui-react.js"></script> <script src="https://unpkg.com/@msrvida/fluentui-icons@1/dist/umd/fluentui-icons.js"></script> <script src="https://unpkg.com/@msrvida/sanddance-explorer@4/dist/umd/sanddance-explorer.js"></script> diff --git a/docs/examples/index.md b/docs/examples/index.md index c6f5744a7..7ebc2bdb1 100644 --- a/docs/examples/index.md +++ b/docs/examples/index.md @@ -8,10 +8,10 @@ title: Examples ## Subsystem ### data-inference -* [data-inference test](../tests/data-inference/v1/) using UMD/CDN +* [data-inference test](../tests/data-inference/v2/) using UMD/CDN ### sanddance-specs -* [sanddance-specs 2D vega specs tests](../tests/sanddance-specs/v1/) using UMD/CDN +* [sanddance-specs 2D vega specs tests](../tests/sanddance-specs/v2/) using UMD/CDN ### vega-morphcharts * [simple vega spec](../tests/v4/umd/vega-morphcharts.test.html) using UMD/CDN diff --git a/docs/examples/v3.md b/docs/examples/v3.md index 0baaaa967..c1c1733e3 100644 --- a/docs/examples/v3.md +++ b/docs/examples/v3.md @@ -8,7 +8,7 @@ title: V3 Examples ## Subsystem ### sanddance-specs -* [sanddance-specs 2D vega specs tests](../tests/sanddance-specs/v1/) using UMD/CDN +* [sanddance-specs 2D vega specs tests](../tests/sanddance-specs/v2/) using UMD/CDN ### deck.gl cube-layer * [cubeTest](../tests/v3/umd/cubeTest.html) using UMD/CDN diff --git a/docs/tests/data-inference/v1/index.html b/docs/tests/data-inference/v1/index.html index f969245b0..f9c900315 100644 --- a/docs/tests/data-inference/v1/index.html +++ b/docs/tests/data-inference/v1/index.html @@ -6,7 +6,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Data-Inference test - + diff --git a/docs/tests/data-inference/v2/index.html b/docs/tests/data-inference/v2/index.html new file mode 100644 index 000000000..f9c900315 --- /dev/null +++ b/docs/tests/data-inference/v2/index.html @@ -0,0 +1,300 @@ + + + + + + + Data-Inference test + + + + + + + + + + +
+

Data-Inference test

+ +
+ +
+ + + + Pandas simulation: +

head

+

+
+        

info

+

+
+        
+ + + Columns: +
+ +
+ + + + + + \ No newline at end of file diff --git a/docs/tests/data-inference/v2/js/data-inference.js b/docs/tests/data-inference/v2/js/data-inference.js new file mode 100644 index 000000000..bf83d9379 --- /dev/null +++ b/docs/tests/data-inference/v2/js/data-inference.js @@ -0,0 +1,725 @@ +(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.DataInference = {})); +})(this, (function (exports) { 'use strict'; + + function define(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; + } + + function extend(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } + + function Color() {} + + var darker = 0.7; + var brighter = 1 / darker; + + var reI = "\\s*([+-]?\\d+)\\s*", + reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", + reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", + reHex = /^#([0-9a-f]{3,8})$/, + reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), + reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), + reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), + reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), + reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), + reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + + var named = { + aliceblue: 0xf0f8ff, + antiquewhite: 0xfaebd7, + aqua: 0x00ffff, + aquamarine: 0x7fffd4, + azure: 0xf0ffff, + beige: 0xf5f5dc, + bisque: 0xffe4c4, + black: 0x000000, + blanchedalmond: 0xffebcd, + blue: 0x0000ff, + blueviolet: 0x8a2be2, + brown: 0xa52a2a, + burlywood: 0xdeb887, + cadetblue: 0x5f9ea0, + chartreuse: 0x7fff00, + chocolate: 0xd2691e, + coral: 0xff7f50, + cornflowerblue: 0x6495ed, + cornsilk: 0xfff8dc, + crimson: 0xdc143c, + cyan: 0x00ffff, + darkblue: 0x00008b, + darkcyan: 0x008b8b, + darkgoldenrod: 0xb8860b, + darkgray: 0xa9a9a9, + darkgreen: 0x006400, + darkgrey: 0xa9a9a9, + darkkhaki: 0xbdb76b, + darkmagenta: 0x8b008b, + darkolivegreen: 0x556b2f, + darkorange: 0xff8c00, + darkorchid: 0x9932cc, + darkred: 0x8b0000, + darksalmon: 0xe9967a, + darkseagreen: 0x8fbc8f, + darkslateblue: 0x483d8b, + darkslategray: 0x2f4f4f, + darkslategrey: 0x2f4f4f, + darkturquoise: 0x00ced1, + darkviolet: 0x9400d3, + deeppink: 0xff1493, + deepskyblue: 0x00bfff, + dimgray: 0x696969, + dimgrey: 0x696969, + dodgerblue: 0x1e90ff, + firebrick: 0xb22222, + floralwhite: 0xfffaf0, + forestgreen: 0x228b22, + fuchsia: 0xff00ff, + gainsboro: 0xdcdcdc, + ghostwhite: 0xf8f8ff, + gold: 0xffd700, + goldenrod: 0xdaa520, + gray: 0x808080, + green: 0x008000, + greenyellow: 0xadff2f, + grey: 0x808080, + honeydew: 0xf0fff0, + hotpink: 0xff69b4, + indianred: 0xcd5c5c, + indigo: 0x4b0082, + ivory: 0xfffff0, + khaki: 0xf0e68c, + lavender: 0xe6e6fa, + lavenderblush: 0xfff0f5, + lawngreen: 0x7cfc00, + lemonchiffon: 0xfffacd, + lightblue: 0xadd8e6, + lightcoral: 0xf08080, + lightcyan: 0xe0ffff, + lightgoldenrodyellow: 0xfafad2, + lightgray: 0xd3d3d3, + lightgreen: 0x90ee90, + lightgrey: 0xd3d3d3, + lightpink: 0xffb6c1, + lightsalmon: 0xffa07a, + lightseagreen: 0x20b2aa, + lightskyblue: 0x87cefa, + lightslategray: 0x778899, + lightslategrey: 0x778899, + lightsteelblue: 0xb0c4de, + lightyellow: 0xffffe0, + lime: 0x00ff00, + limegreen: 0x32cd32, + linen: 0xfaf0e6, + magenta: 0xff00ff, + maroon: 0x800000, + mediumaquamarine: 0x66cdaa, + mediumblue: 0x0000cd, + mediumorchid: 0xba55d3, + mediumpurple: 0x9370db, + mediumseagreen: 0x3cb371, + mediumslateblue: 0x7b68ee, + mediumspringgreen: 0x00fa9a, + mediumturquoise: 0x48d1cc, + mediumvioletred: 0xc71585, + midnightblue: 0x191970, + mintcream: 0xf5fffa, + mistyrose: 0xffe4e1, + moccasin: 0xffe4b5, + navajowhite: 0xffdead, + navy: 0x000080, + oldlace: 0xfdf5e6, + olive: 0x808000, + olivedrab: 0x6b8e23, + orange: 0xffa500, + orangered: 0xff4500, + orchid: 0xda70d6, + palegoldenrod: 0xeee8aa, + palegreen: 0x98fb98, + paleturquoise: 0xafeeee, + palevioletred: 0xdb7093, + papayawhip: 0xffefd5, + peachpuff: 0xffdab9, + peru: 0xcd853f, + pink: 0xffc0cb, + plum: 0xdda0dd, + powderblue: 0xb0e0e6, + purple: 0x800080, + rebeccapurple: 0x663399, + red: 0xff0000, + rosybrown: 0xbc8f8f, + royalblue: 0x4169e1, + saddlebrown: 0x8b4513, + salmon: 0xfa8072, + sandybrown: 0xf4a460, + seagreen: 0x2e8b57, + seashell: 0xfff5ee, + sienna: 0xa0522d, + silver: 0xc0c0c0, + skyblue: 0x87ceeb, + slateblue: 0x6a5acd, + slategray: 0x708090, + slategrey: 0x708090, + snow: 0xfffafa, + springgreen: 0x00ff7f, + steelblue: 0x4682b4, + tan: 0xd2b48c, + teal: 0x008080, + thistle: 0xd8bfd8, + tomato: 0xff6347, + turquoise: 0x40e0d0, + violet: 0xee82ee, + wheat: 0xf5deb3, + white: 0xffffff, + whitesmoke: 0xf5f5f5, + yellow: 0xffff00, + yellowgreen: 0x9acd32 + }; + + define(Color, color, { + copy(channels) { + return Object.assign(new this.constructor, this, channels); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + + function color_formatHex() { + return this.rgb().formatHex(); + } + + function color_formatHex8() { + return this.rgb().formatHex8(); + } + + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + + function color_formatRgb() { + return this.rgb().formatRgb(); + } + + function color(format) { + var m, l; + format = (format + "").trim().toLowerCase(); + return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 + : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 + : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 + : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 + : null) // invalid hex + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; + } + + function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); + } + + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } + + function rgbConvert(o) { + if (!(o instanceof Color)) o = color(o); + if (!o) return new Rgb; + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } + + function rgb(r, g, b, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); + } + + function Rgb(r, g, b, opacity) { + this.r = +r; + this.g = +g; + this.b = +b; + this.opacity = +opacity; + } + + define(Rgb, rgb, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return (-0.5 <= this.r && this.r < 255.5) + && (-0.5 <= this.g && this.g < 255.5) + && (-0.5 <= this.b && this.b < 255.5) + && (0 <= this.opacity && this.opacity <= 1); + }, + hex: rgb_formatHex, // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + + function rgb_formatRgb() { + const a = clampa(this.opacity); + return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; + } + + function clampa(opacity) { + return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); + } + + function clampi(value) { + return Math.max(0, Math.min(255, Math.round(value) || 0)); + } + + function hex(value) { + value = clampi(value); + return (value < 16 ? "0" : "") + value.toString(16); + } + + function hsla(h, s, l, a) { + if (a <= 0) h = s = l = NaN; + else if (l <= 0 || l >= 1) h = s = NaN; + else if (s <= 0) h = NaN; + return new Hsl(h, s, l, a); + } + + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color)) o = color(o); + if (!o) return new Hsl; + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + min = Math.min(r, g, b), + max = Math.max(r, g, b), + h = NaN, + s = max - min, + l = (max + min) / 2; + if (s) { + if (r === max) h = (g - b) / s + (g < b) * 6; + else if (g === max) h = (b - r) / s + 2; + else h = (r - g) / s + 4; + s /= l < 0.5 ? max + min : 2 - max - min; + h *= 60; + } else { + s = l > 0 && l < 1 ? 0 : h; + } + return new Hsl(h, s, l, o.opacity); + } + + function hsl(h, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); + } + + function Hsl(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + + define(Hsl, hsl, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h = this.h % 360 + (this.h < 0) * 360, + s = isNaN(h) || isNaN(this.s) ? 0 : this.s, + l = this.l, + m2 = l + (l < 0.5 ? l : 1 - l) * s, + m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), + hsl2rgb(h, m1, m2), + hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), + this.opacity + ); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) + && (0 <= this.l && this.l <= 1) + && (0 <= this.opacity && this.opacity <= 1); + }, + formatHsl() { + const a = clampa(this.opacity); + return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; + } + })); + + function clamph(value) { + value = (value || 0) % 360; + return value < 0 ? value + 360 : value; + } + + function clampt(value) { + return Math.max(0, Math.min(1, value || 0)); + } + + /* From FvD 13.37, CSS Color Module Level 3 */ + function hsl2rgb(h, m1, m2) { + return (h < 60 ? m1 + (m2 - m1) * h / 60 + : h < 180 ? m2 + : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 + : m1) * 255; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function isColor(cssColorSpecifier) { + return !!color(cssColorSpecifier); + } + function checkIsColorData(data, column) { + if (!column.stats.hasColorData) { + column.isColorData = false; + return; + } + for (let i = 0; i < data.length; i++) { + if (!isColor(data[i][column.name])) { + column.isColorData = false; + return; + } + } + column.isColorData = true; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function isQuantitative(column) { + return column.type === 'number' || column.type === 'integer'; + } + function detectNegative(columnName, data) { + for (let i = 1; i < data.length; i++) { + const value = columnName == null ? data[i] : data[i][columnName]; + if (value < 0) + return true; + } + return false; + } + function detectSequentialColumn(columnName, data) { + if (data.length < 2) + return false; + for (let i = 1; i < data.length; i++) { + const curr = columnName == null ? data[i] : data[i][columnName]; + const prev = columnName == null ? data[i - 1] : data[i - 1][columnName]; + if (curr !== prev + 1) + return false; + } + return true; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getStats(data, ...args) { + let columnName; + let columnType; + let columnQuantitative; + let distinctValuesCallback; + if (args.length <= 2) { + const column = args[0]; + columnName = column.name; + columnType = column.type; + columnQuantitative = column.quantitative; + distinctValuesCallback = args[1]; + } + else { + columnName = args[0]; + columnType = args[1]; + columnQuantitative = args[2]; + distinctValuesCallback = args[3]; + } + const distinctMap = {}; + const stats = { + nonNull: 0, + distinctValueCount: null, + max: null, + mean: null, + min: null, + }; + const columnIsString = columnType === 'string'; + let sum = 0; + for (let i = 0; i < data.length; i++) { + const row = data[i]; + const value = columnName == null ? row : row[columnName]; + if (columnIsString) { + if (value !== '') { + stats.nonNull++; + } + } + else if (value != null) { + stats.nonNull++; + } + const num = +value; + distinctMap[value] = true; + if (!isNaN(num)) { + if (stats.max === null || num > stats.max) { + stats.max = num; + } + if (stats.min === null || num < stats.min) { + stats.min = num; + } + sum += num; + } + // hex codes, ex. #003300, are parsed as dates + if ((columnType === 'date' || columnIsString) && !stats.hasColorData && isColor(value)) { + stats.hasColorData = true; + } + } + if (columnQuantitative) { + stats.mean = data.length > 0 && (sum / data.length); + stats.hasNegative = detectNegative(columnName, data); + if (columnType === 'integer') { + stats.isSequential = detectSequentialColumn(columnName, data); + } + } + const distinctValues = Object.keys(distinctMap); + if (distinctValuesCallback) { + distinctValues.sort(); + distinctValuesCallback(distinctValues); + } + stats.distinctValueCount = distinctValues.length; + return stats; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Derive column metadata from the data array. + * @param data Array of data objects. + */ + function getColumnsFromData(inferTypesFn, data, columnTypes) { + const sample = data[0]; + const fields = sample ? Object.keys(sample) : []; + const inferences = Object.assign(Object.assign({}, inferTypesFn(data, fields)), columnTypes); + const columns = fields.map(name => { + const column = { + name, + type: inferences[name], + }; + return column; + }); + inferAll(columns, data); + return columns; + } + /** + * Populate columns with type inferences and stats. + * @param columns Array of columns. + * @param data Array of data objects. + */ + function inferAll(columns, data) { + columns.forEach(column => { + if (column) { + if (typeof column.quantitative !== 'boolean') { + column.quantitative = isQuantitative(column); + } + if (!column.stats) { + column.stats = getStats(data, column); + } + // hex codes, ex. #003300, are parsed as dates + if ((column.type === 'date' || column.type === 'string') && typeof column.isColorData !== 'boolean') { + checkIsColorData(data, column); + } + } + }); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Table { + constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = 'right') { + this.columns = columns; + this.rows = rows; + this.maxWidth = maxWidth; + this.underlineHeaders = underlineHeaders; + this.align = align; + // Calculate maximum width for each column + this.columnWidths = this.columns.map((col, idx) => Math.max(col.length, ...this.rows.map(row => { var _a; return ((_a = row[idx]) === null || _a === void 0 ? void 0 : _a.length) || 0; }))); + } + createSpaces(num) { + return ' '.repeat(num); + } + groupColumns() { + let cumulativeWidth = 0; + const columnGroups = []; + let currentGroup = []; + this.columns.forEach((col, idx) => { + const columnSpace = this.columnWidths[idx] + 1; // account for one space between columns + if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { + columnGroups.push(currentGroup); + cumulativeWidth = columnSpace; + currentGroup = [col]; + } + else { + cumulativeWidth += columnSpace; + currentGroup.push(col); + } + }); + if (currentGroup.length > 0) { + columnGroups.push(currentGroup); + } + return columnGroups; + } + formatRow(row, group) { + return group.map(col => { + const idx = this.columns.indexOf(col); + const cellValue = row[idx] == null ? '' : row[idx].toString(); + return this.align === 'right' + ? cellValue.padStart(this.columnWidths[idx], ' ') + : cellValue.padEnd(this.columnWidths[idx], ' '); + }).join(this.createSpaces(1)); + } + formatHeader(group) { + return group.map(col => { + const idx = this.columns.indexOf(col); + return this.align === 'right' + ? col.padStart(this.columnWidths[idx], ' ') + : col.padEnd(this.columnWidths[idx], ' '); + }).join(this.createSpaces(1)); + } + underlineHeader(group) { + return group.map(col => '-'.repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); + } + render() { + const output = []; + const columnGroups = this.groupColumns(); + columnGroups.forEach((group, groupIndex) => { + const headerRow = this.formatHeader(group); + let section = headerRow + (groupIndex < columnGroups.length - 1 ? ' \\' : '') + '\n'; + if (this.underlineHeaders) { + section += this.underlineHeader(group) + '\n'; + } + this.rows.forEach((row) => { + section += this.formatRow(row, group) + '\n'; + }); + output.push(section); + if (groupIndex < columnGroups.length - 1) { + output.push('\n'); + } + }); + return output.join(''); + } + } + exports.pandasSimulation = void 0; + (function (pandasSimulation) { + // Mapping TypeScript types to Python-like dtypes + const typeMapping = { + boolean: 'bool', + number: 'float64', // Assuming 'number' is used for floating-point numbers + date: 'datetime64[ns]', + string: 'object', + integer: 'int64', + }; + function head(columns, data, maxWidth = 80) { + const numRows = 5; // Number of rows as in `head(5)` from pandas + const top = data.slice(0, numRows); // Get the top `numRows` rows + // Create a "fake" row number column + const rowNumbers = Array.from({ length: numRows }, (_, i) => (i + 1).toString()); + // Extract column names and rows for the table + const columnNames = [''].concat(columns.map(col => col.name)); + const rows = top.map((row, i) => [rowNumbers[i]].concat(columns.map(col => { var _a; return ((_a = row[col.name]) === null || _a === void 0 ? void 0 : _a.toString()) || ''; }))); + // Create and render the table with right alignment + const table = new Table(columnNames, rows, maxWidth, false, 'right'); // Right alignment + return table.render(); + } + pandasSimulation.head = head; + function info(columns, data, maxWidth = 80) { + const numRows = data.length; + const output = []; + // Summary header + output.push(''); + output.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); + output.push(`Data columns (total ${columns.length} columns):\n`); + // Column headers and details + const columnHeaders = ['#', 'Column', 'Non-Null Count', 'Dtype']; + const rows = columns.map((col, idx) => { + const nonNullCount = col.stats.nonNull.toString(); + const dtype = typeMapping[col.type] || 'unknown'; + return [idx.toString(), col.name, `${nonNullCount} non-null`, dtype]; + }); + // Create and render the table with left alignment and header underline + const table = new Table(columnHeaders, rows, maxWidth, true, 'left'); // Left alignment + output.push(table.render()); + // Memory usage estimation + const memoryUsage = columns.reduce((total, col) => { + var _a; + const exampleValue = (_a = data.find(row => row[col.name] != null)) === null || _a === void 0 ? void 0 : _a[col.name]; + if (exampleValue == null) + return total; + const size = new Blob([exampleValue.toString()]).size; + return total + (size * numRows); + }, 0); + output.push(`\ndtypes: ${columns.filter(col => col.type === 'number').length} float64, ` + + `${columns.filter(col => col.type === 'integer').length} int64, ` + + `${columns.filter(col => col.type === 'string').length} object`); + output.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); + return output.join('\n'); + } + pandasSimulation.info = info; + })(exports.pandasSimulation || (exports.pandasSimulation = {})); + + exports.checkIsColorData = checkIsColorData; + exports.detectNegative = detectNegative; + exports.detectSequentialColumn = detectSequentialColumn; + exports.getColumnsFromData = getColumnsFromData; + exports.getStats = getStats; + exports.inferAll = inferAll; + exports.isColor = isColor; + exports.isQuantitative = isQuantitative; + +})); diff --git a/docs/tests/sanddance-specs/v1/index.html b/docs/tests/sanddance-specs/v1/index.html index 8c1aa27f5..3ad4be862 100644 --- a/docs/tests/sanddance-specs/v1/index.html +++ b/docs/tests/sanddance-specs/v1/index.html @@ -6,7 +6,7 @@ SandDance-Specs test - + + + + +
+

SandDance-Specs test

+ +
+ +
+
+ +
+ + + + + + \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/js/index.js b/docs/tests/sanddance-specs/v2/js/index.js new file mode 100644 index 000000000..08b8bc80b --- /dev/null +++ b/docs/tests/sanddance-specs/v2/js/index.js @@ -0,0 +1,79 @@ +var dataUrl = '/SandDance/sample-data/demovote.tsv'; +var specViewOptions = { + colors: { + defaultCube: "steelblue", + axisLine: "#000", + axisText: "#000" + }, + language: { + count: "Count" + }, + maxLegends: 20, + tickSize: 10, +}; +var data; +var columns; +var container = document.getElementById('vis'); +var select = document.getElementById('select-spec'); +var insightTextarea = document.getElementById('insight-json'); +var insightUdateButton = document.getElementById('insight-update'); +var vegaOutput = document.getElementById('vega-spec'); +var vegaCopy = document.getElementById('vega-spec-copy'); +select.onchange = function () { return selected(select.selectedIndex); }; +insightUdateButton.onclick = function () { + var insight = JSON.parse(insightTextarea.value); + render(insight); +}; +vegaCopy.onclick = function () { + vegaOutput.select(); + document.execCommand('copy'); + vegaCopy.innerText = 'copied'; + setTimeout(function () { + vegaCopy.innerText = 'copy'; + }, 2000); +}; +function selected(selectedIndex) { + container.innerHTML = "loading spec..."; + fetchInsight(select.options[selectedIndex].value); +} +function fetchInsight(specFilename) { + fetch("specs/".concat(specFilename)) + .then(function (response) { return response.json(); }) + .then(function (insight) { return render(insight); }) + .catch(function (error) { return container.innerText = error; }); +} +function render(insight) { + insightTextarea.value = JSON.stringify(insight, null, 2); + var specColumns = SandDanceSpecs.getSpecColumns(insight, columns); + var context = { specColumns: specColumns, insight: insight, specViewOptions: specViewOptions }; + var specResult = SandDanceSpecs.build(context, data); + if (specResult.errors) { + container.innerText = specResult.errors.map(function (error) { return error; }).join('\n'); + } + else { + renderVegaSpec(specResult.vegaSpec); + } +} +function renderVegaSpec(vegaSpec) { + var runtime = vega.parse(vegaSpec); + var vegaView = new vega.View(runtime, { container: container }); + vegaView + .runAsync() + .catch(function (e) { return container.innerHTML = "error ".concat(e); }) + .then(function () { + var d0 = vegaSpec.data[0]; + delete d0.values; + d0.format = { + parse: 'auto', + type: 'tsv' + }; + d0.url = 'https://microsoft.github.io' + dataUrl; + vegaOutput.value = JSON.stringify(vegaSpec, null, 2); + }); +} +container.innerHTML = "loading ".concat(dataUrl, "..."); +vega.loader().load(dataUrl).then(function (tsv_data) { + data = vega.read(tsv_data, { type: 'tsv', parse: 'auto' }); + columns = SandDanceSpecs.getColumnsFromData(vega.inferTypes, data); + selected(0); +}); diff --git a/docs/tests/sanddance-specs/v2/js/sanddance-specs.js b/docs/tests/sanddance-specs/v2/js/sanddance-specs.js new file mode 100644 index 000000000..ef66d9d6b --- /dev/null +++ b/docs/tests/sanddance-specs/v2/js/sanddance-specs.js @@ -0,0 +1,5344 @@ +(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.SandDanceSpecs = {})); +})(this, (function (exports) { 'use strict'; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const FieldNames = { + Active: '__SandDance__Active', + Collapsed: '__SandDance__Collapsed', + Contains: '__SandDance__Contains', + Count: '__SandDance__Count', + Sum: '__SandDance__Sum', + SumOfCount: '__SandDance__CountSum', + SumOfSum: '__SandDance__SumSum', + Selected: '__SandDance__Selected', + First: '__SandDance__First', + Last: '__SandDance__Last', + Top: '__SandDance__Top', + TopColor: '__SandDance__TopColor', + TopIndex: '__SandDance__TopIndex', + PowerBISelectionId: '__SandDance__PowerBISelectionId', + FacetSearch: '__SandDance__FacetSearch', + FacetTitle: '__SandDance__FacetTitle', + Ordinal: '__SandDance__Ordinal', + WrapCol: '__SandDance__WrapCol', + WrapRow: '__SandDance__WrapRow', + Value: '__SandDance__Value', + OffsetX: '__SandDance__X', + OffsetY: '__SandDance__Y', + OffsetHeight: '__SandDance__H', + OffsetWidth: '__SandDance__W', + }; + const ScaleNames = { + Color: 'scale_color', + X: 'scale_x', + Y: 'scale_y', + Z: 'scale_z', + }; + //Signal names + const SignalNames = { + ViewportWidth: 'ViewportWidth', + ViewportHeight: 'ViewportHeight', + MinCellWidth: 'MinCellWidth', + MinCellHeight: 'MinCellHeight', + PlotOffsetLeft: 'PlotOffsetLeft', + PlotOffsetTop: 'PlotOffsetTop', + PlotOffsetBottom: 'PlotOffsetBottom', + PlotOffsetRight: 'PlotOffsetRight', + PlotHeightIn: 'PlotHeightIn', + PlotWidthIn: 'PlotWidthIn', + PlotHeightOut: 'PlotHeightOut', + PlotWidthOut: 'PlotWidthOut', + ColorBinCount: 'RoleColor_BinCountSignal', + ColorReverse: 'RoleColor_ReverseSignal', + FacetAxesAdjustX: 'RoleFacet_AxesAdjustSignalX', + FacetAxesAdjustY: 'RoleFacet_AxesAdjustSignalY', + FacetBins: 'RoleFacet_BinsSignal', + FacetVBins: 'RoleFacetV_BinsSignal', + FacetPaddingTop: 'FacetPaddingTop', + FacetPaddingBottom: 'FacetPaddingBottom', + FacetPaddingLeft: 'FacetPaddingLeft', + MarkOpacity: 'Mark_OpacitySignal', + PointScale: 'Chart_PointScaleSignal', + TextAngleX: 'Text_AngleXSignal', + TextAngleY: 'Text_AngleYSignal', + TextScale: 'Text_ScaleSignal', + TextSize: 'Text_SizeSignal', + TextTitleSize: 'Text_TitleSizeSignal', + TreeMapMethod: 'Chart_TreeMapMethodSignal', + XBins: 'RoleX_BinsSignal', + YBins: 'RoleY_BinsSignal', + ZHeight: 'RoleZ_HeightSignal', + ZGrounded: 'RoleZ_Grounded', + ZProportion: 'RoleZ_ProportionSignal', + }; + //These are special formulaic data values + const Other = '__Other'; + //name of the "no-color" palette + const ColorScaleNone = 'none'; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + //TODO move these to options + const defaultBins = 10; + const maxbins = 100; + const minBarBandWidth = 15; + const minFacetWidth = 140; + const minFacetHeight = 180; + const facetPaddingLeft = 40; + const facetPaddingTop = 40; + const facetPaddingBottom = 40; + const facetPaddingRight = 40; + const axesLabelLimit = 100; + const axesTitleLimit = 100; + const axesTitlePaddingX = 30; + const axesTitlePaddingY = 60; + const axesTitlePaddingFacetX = 69; + const axesTitlePaddingFacetY = 92; + const axesOffsetX = 120; + const axesOffsetY = 120; + const scatterSizedDiv = 20; + const debounce = 250; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function allowNoneForSize(specContext) { + switch (specContext.insight.totalStyle) { + case 'sum-strip': + case 'sum-strip-percent': + case 'sum-treemap': + return false; + default: + //if totalStyle is blank, count is assumed + return true; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function barchartH (specContext) { + var _a, _b, _c, _d; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: 'horizontal', + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins, + }, + minBandWidth: minBarBandWidth, + showAxes, + }; + const x = { title: null }; + const axisScales = { + x, + y: { title: (_a = specColumns.y) === null || _a === void 0 ? void 0 : _a.name }, + z: { title: (_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.name }, + }; + const layouts = [{ + layoutType: 'Band', + props: bandProps, + }]; + const { totalStyle, view } = insight; + if (totalStyle === 'sum-strip-percent') { + x.aggregate = 'percent'; + x.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: 'ascending', + orientation: 'horizontal', + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + } + else { + const aggProps = { + niceScale: true, + dock: 'left', + globalAggregateMaxExtentSignal: 'aggMaxExtent', + globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', + sumBy: specColumns.size, + showAxes, + }; + layouts.push({ + layoutType: 'AggregateContainer', + props: aggProps, + }); + switch (totalStyle) { + case 'sum-treemap': { + x.aggregate = 'sum'; + x.title = language.sum; + const treemapProps = { + corner: 'top-left', + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Treemap', + props: treemapProps, + }); + break; + } + case 'sum-strip': { + x.aggregate = 'sum'; + x.title = language.sum; + const stripProps = { + sortOrder: 'ascending', + orientation: 'horizontal', + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + break; + } + case 'count-strip': { + x.aggregate = 'count'; + x.title = language.count; + const stripProps = { + sortOrder: 'ascending', + orientation: 'horizontal', + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + break; + } + default: { + x.aggregate = 'count'; + x.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: 'down-right', + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Square', + props: squareProps, + }); + break; + } + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: 'y', + binnable: true, + axisSelection: ((_c = specColumns.y) === null || _c === void 0 ? void 0 : _c.quantitative) ? 'range' : 'exact', + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins], + }, + { + role: 'z', + axisSelection: ((_d = specColumns.z) === null || _d === void 0 ? void 0 : _d.quantitative) ? 'range' : 'exact', + allowNone: true, + disabled: view === '2d', + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'sort', + allowNone: true, + }, + { + role: 'size', + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod], + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function barchartV (specContext) { + var _a, _b; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: 'vertical', + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins, + }, + minBandWidth: minBarBandWidth, + showAxes, + }; + const y = { title: null }; + const axisScales = { + x: { title: specColumns.x && specColumns.x.name }, + y, + z: { title: specColumns.z && specColumns.z.name }, + }; + const layouts = [{ + layoutType: 'Band', + props: bandProps, + }]; + const { totalStyle, view } = insight; + if (totalStyle === 'sum-strip-percent') { + y.aggregate = 'percent'; + y.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: 'descending', + orientation: 'vertical', + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + } + else { + const aggProps = { + niceScale: true, + dock: 'bottom', + globalAggregateMaxExtentSignal: 'aggMaxExtent', + globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', + sumBy: specColumns.size, + showAxes, + }; + layouts.push({ + layoutType: 'AggregateContainer', + props: aggProps, + }); + switch (totalStyle) { + case 'sum-treemap': { + y.aggregate = 'sum'; + y.title = language.sum; + const treemapProps = { + corner: 'bottom-left', + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Treemap', + props: treemapProps, + }); + break; + } + case 'sum-strip': { + y.aggregate = 'sum'; + y.title = language.sum; + const stripProps = { + sortOrder: 'descending', + orientation: 'vertical', + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + break; + } + case 'count-strip': { + y.aggregate = 'count'; + y.title = language.count; + const stripProps = { + sortOrder: 'descending', + orientation: 'vertical', + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + break; + } + default: { + y.aggregate = 'count'; + y.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: 'right-up', + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Square', + props: squareProps, + }); + break; + } + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: 'x', + binnable: true, + axisSelection: ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins], + }, + { + role: 'z', + axisSelection: ((_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.quantitative) ? 'range' : 'exact', + allowNone: true, + disabled: view === '2d', + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'sort', + allowNone: true, + }, + { + role: 'size', + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod], + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function density (specContext) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const { insight, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name }, + y: { title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name }, + z: { title: (_c = specColumns.z) === null || _c === void 0 ? void 0 : _c.name }, + }; + const backgroundImage = ((_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: 'horizontal', + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins, + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom }, + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: 'vertical', + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins, + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left }, + }; + const aggProps = { + onBuild: null, + aggregation: null, + sumBy: specColumns.size, + }; + const layouts = [ + { + layoutType: 'Band', + props: vBandProps, + }, + { + layoutType: 'Band', + props: hBandProps, + }, + { + layoutType: 'AggregateSquare', + props: aggProps, + }, + ]; + const { totalStyle, view } = insight; + switch (totalStyle) { + case 'sum-treemap': { + aggProps.aggregation = 'sum'; + const treemapProps = { + corner: 'bottom-left', + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Treemap', + props: treemapProps, + }); + break; + } + case 'sum-strip': { + aggProps.aggregation = 'sum'; + const stripProps = { + sortOrder: 'ascending', + orientation: 'vertical', + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + break; + } + case 'count-strip': { + aggProps.aggregation = 'count'; + const stripProps = { + sortOrder: 'ascending', + orientation: 'vertical', + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view, + }; + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + break; + } + default: { + aggProps.aggregation = 'count'; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: 'right-down', + z: specColumns.z, + maxGroupedUnits: null, + maxGroupedFillSize: null, + showAxes, + view, + }; + aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled) => { + squareProps.maxGroupedUnits = aggMaxExtent; + squareProps.maxGroupedFillSize = aggMaxExtentScaled; + }; + layouts.push({ + layoutType: 'Square', + props: squareProps, + }); + break; + } + } + return { + axisScales, + layouts, + specCapabilities: { + backgroundImage: true, + countsAndSums: true, + roles: [ + { + role: 'x', + binnable: true, + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins], + }, + { + role: 'y', + binnable: true, + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact', + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins], + }, + { + role: 'z', + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', + allowNone: true, + disabled: view === '2d', + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'sort', + allowNone: true, + }, + { + role: 'size', + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod], + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function grid (specContext) { + var _a; + const { insight, specColumns } = specContext; + const { view } = insight; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: 'right-down', + z: specColumns.z, + collapseYHeight: true, + showAxes: !insight.hideAxes, + view, + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name }, + }; + return { + axisScales, + layouts: [ + { + layoutType: 'Square', + props: squareProps, + }, + ], + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: 'z', + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', + allowNone: true, + disabled: view === '2d', + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'sort', + allowNone: true, + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function scatterplot (specContext) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const { insight, specColumns, specViewOptions } = specContext; + const backgroundImageExtents = ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative) && ((_c = insight.backgroundImage) === null || _c === void 0 ? void 0 : _c.extents); + const scatterProps = { + x: specColumns.x, + y: specColumns.y, + z: specColumns.z, + size: specColumns.size, + scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, + zGrounded: specViewOptions.language.zGrounded, + backgroundImageExtents, + showAxes: !(backgroundImageExtents || insight.hideAxes), + view: insight.view, + }; + const axisScales = { + x: { title: (_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.name }, + y: { title: (_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.name }, + z: { title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name }, + }; + return { + axisScales, + layouts: [ + { + layoutType: 'Scatter', + props: scatterProps, + }, + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: 'x', + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', + }, + { + role: 'y', + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact', + }, + { + role: 'z', + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', + allowNone: true, + disabled: false, + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'size', + excludeCategoric: true, + allowNone: true, + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + signals: [SignalNames.PointScale, SignalNames.ZGrounded], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function stacks (specContext) { + var _a, _b, _c, _d, _e, _f, _g; + const { insight, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name }, + y: { title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name }, + z: { title: specViewOptions.language.count }, + }; + const backgroundImage = ((_c = specColumns.x) === null || _c === void 0 ? void 0 : _c.quantitative) && ((_d = specColumns.y) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = insight.backgroundImage) === null || _e === void 0 ? void 0 : _e.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: 'horizontal', + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins, + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom }, + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: 'vertical', + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins, + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left }, + }; + const stackProps = { + sort: specColumns.sort, + showAxes, + }; + return { + axisScales, + customZScale: true, + layouts: [ + { + layoutType: 'Band', + props: vBandProps, + }, + { + layoutType: 'Band', + props: hBandProps, + }, + { + layoutType: 'Stack', + props: stackProps, + }, + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: 'x', + binnable: true, + axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? 'range' : 'exact', + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins], + }, + { + role: 'y', + binnable: true, + axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins], + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'sort', + allowNone: true, + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function strips (specContext) { + var _a; + const { insight, specColumns } = specContext; + const { view } = insight; + const stripProps = { + sortOrder: 'ascending', + orientation: 'vertical', + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes: !insight.hideAxes, + view, + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name }, + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: specColumns.size ? 'sum' : 'count', + }; + const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; + const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; + const props = { + dock: 'top', + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false, + }; + layouts.push({ + layoutType: 'AggregateContainer', + props, + }); + } + layouts.push({ + layoutType: 'Strip', + props: stripProps, + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: 'size', + allowNone: true, //size by none is a count + excludeCategoric: true, + }, + { + role: 'z', + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', + allowNone: true, + disabled: view === '2d', + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'sort', + allowNone: true, + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function treemap (specContext) { + var _a; + const { insight, specColumns, specViewOptions } = specContext; + const { view } = insight; + const treemapProps = { + corner: 'top-left', + group: specColumns.group, + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes: !insight.hideAxes, + view, + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name }, + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: 'sum', + }; + const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; + const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; + const props = { + dock: 'top', + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false, + }; + layouts.push({ + layoutType: 'AggregateContainer', + props, + }); + } + layouts.push({ + layoutType: 'Treemap', + props: treemapProps, + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: 'size', + excludeCategoric: true, + }, + { + role: 'group', + allowNone: true, + }, + { + role: 'z', + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', + allowNone: true, + disabled: view === '2d', + }, + { + role: 'color', + allowNone: true, + }, + { + role: 'facet', + allowNone: true, + signals: [SignalNames.FacetBins], + }, + { + role: 'facetV', + allowNone: true, + signals: [SignalNames.FacetVBins], + }, + ], + signals: [SignalNames.TreeMapMethod], + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { + let layoutPair; + const groupby = facetColumn; + const plotPadding = { + x: 0, + y: 0, + }; + let facetPadding; + switch (facetStyle) { + case 'cross': { + const props = { + axisTextColor, + colRowTitles: true, + groupbyX: groupby, + groupbyY: facetVColumn, + }; + layoutPair = { + layoutType: 'Cross', + props, + }; + facetPadding = { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: 0, + }; + plotPadding.y = facetPaddingTop; + plotPadding.x = facetPaddingRight; + break; + } + case 'wrap': + default: { + const props = { + axisTextColor, + cellTitles: true, + groupby, + }; + layoutPair = { + layoutType: 'Wrap', + props, + }; + facetPadding = + { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: facetPaddingTop, + }; + break; + } + } + const facetLayout = { + facetPadding, + plotPadding, + }; + return { + layoutPair, + facetLayout, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const map = { + barchart: barchartV, + barchartH, + barchartV, + density, + grid, + scatterplot, + stacks, + strips, + treemap, + }; + function getSpecBuilderPropsForChart(specContext) { + const { insight, specColumns, specViewOptions } = specContext; + const fn = map[insight.chart]; + if (fn) { + const props = fn(specContext); + if (insight.columns.facet) { + const discreteFacetColumn = { + column: specColumns.facet, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, + maxbinsSignalName: SignalNames.FacetBins, + }; + const discreteFacetVColumn = { + column: specColumns.facetV, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, + maxbinsSignalName: SignalNames.FacetVBins, + }; + const { facetLayout, layoutPair } = getFacetLayout(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); + props.layouts.unshift(layoutPair); + props.facetLayout = facetLayout; + props.collapseFacetAxes = specViewOptions.collapseFacetAxes; + } + return props; + } + } + + function define(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; + } + + function extend(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } + + function Color() {} + + var darker = 0.7; + var brighter = 1 / darker; + + var reI = "\\s*([+-]?\\d+)\\s*", + reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", + reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", + reHex = /^#([0-9a-f]{3,8})$/, + reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), + reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), + reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), + reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), + reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), + reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + + var named = { + aliceblue: 0xf0f8ff, + antiquewhite: 0xfaebd7, + aqua: 0x00ffff, + aquamarine: 0x7fffd4, + azure: 0xf0ffff, + beige: 0xf5f5dc, + bisque: 0xffe4c4, + black: 0x000000, + blanchedalmond: 0xffebcd, + blue: 0x0000ff, + blueviolet: 0x8a2be2, + brown: 0xa52a2a, + burlywood: 0xdeb887, + cadetblue: 0x5f9ea0, + chartreuse: 0x7fff00, + chocolate: 0xd2691e, + coral: 0xff7f50, + cornflowerblue: 0x6495ed, + cornsilk: 0xfff8dc, + crimson: 0xdc143c, + cyan: 0x00ffff, + darkblue: 0x00008b, + darkcyan: 0x008b8b, + darkgoldenrod: 0xb8860b, + darkgray: 0xa9a9a9, + darkgreen: 0x006400, + darkgrey: 0xa9a9a9, + darkkhaki: 0xbdb76b, + darkmagenta: 0x8b008b, + darkolivegreen: 0x556b2f, + darkorange: 0xff8c00, + darkorchid: 0x9932cc, + darkred: 0x8b0000, + darksalmon: 0xe9967a, + darkseagreen: 0x8fbc8f, + darkslateblue: 0x483d8b, + darkslategray: 0x2f4f4f, + darkslategrey: 0x2f4f4f, + darkturquoise: 0x00ced1, + darkviolet: 0x9400d3, + deeppink: 0xff1493, + deepskyblue: 0x00bfff, + dimgray: 0x696969, + dimgrey: 0x696969, + dodgerblue: 0x1e90ff, + firebrick: 0xb22222, + floralwhite: 0xfffaf0, + forestgreen: 0x228b22, + fuchsia: 0xff00ff, + gainsboro: 0xdcdcdc, + ghostwhite: 0xf8f8ff, + gold: 0xffd700, + goldenrod: 0xdaa520, + gray: 0x808080, + green: 0x008000, + greenyellow: 0xadff2f, + grey: 0x808080, + honeydew: 0xf0fff0, + hotpink: 0xff69b4, + indianred: 0xcd5c5c, + indigo: 0x4b0082, + ivory: 0xfffff0, + khaki: 0xf0e68c, + lavender: 0xe6e6fa, + lavenderblush: 0xfff0f5, + lawngreen: 0x7cfc00, + lemonchiffon: 0xfffacd, + lightblue: 0xadd8e6, + lightcoral: 0xf08080, + lightcyan: 0xe0ffff, + lightgoldenrodyellow: 0xfafad2, + lightgray: 0xd3d3d3, + lightgreen: 0x90ee90, + lightgrey: 0xd3d3d3, + lightpink: 0xffb6c1, + lightsalmon: 0xffa07a, + lightseagreen: 0x20b2aa, + lightskyblue: 0x87cefa, + lightslategray: 0x778899, + lightslategrey: 0x778899, + lightsteelblue: 0xb0c4de, + lightyellow: 0xffffe0, + lime: 0x00ff00, + limegreen: 0x32cd32, + linen: 0xfaf0e6, + magenta: 0xff00ff, + maroon: 0x800000, + mediumaquamarine: 0x66cdaa, + mediumblue: 0x0000cd, + mediumorchid: 0xba55d3, + mediumpurple: 0x9370db, + mediumseagreen: 0x3cb371, + mediumslateblue: 0x7b68ee, + mediumspringgreen: 0x00fa9a, + mediumturquoise: 0x48d1cc, + mediumvioletred: 0xc71585, + midnightblue: 0x191970, + mintcream: 0xf5fffa, + mistyrose: 0xffe4e1, + moccasin: 0xffe4b5, + navajowhite: 0xffdead, + navy: 0x000080, + oldlace: 0xfdf5e6, + olive: 0x808000, + olivedrab: 0x6b8e23, + orange: 0xffa500, + orangered: 0xff4500, + orchid: 0xda70d6, + palegoldenrod: 0xeee8aa, + palegreen: 0x98fb98, + paleturquoise: 0xafeeee, + palevioletred: 0xdb7093, + papayawhip: 0xffefd5, + peachpuff: 0xffdab9, + peru: 0xcd853f, + pink: 0xffc0cb, + plum: 0xdda0dd, + powderblue: 0xb0e0e6, + purple: 0x800080, + rebeccapurple: 0x663399, + red: 0xff0000, + rosybrown: 0xbc8f8f, + royalblue: 0x4169e1, + saddlebrown: 0x8b4513, + salmon: 0xfa8072, + sandybrown: 0xf4a460, + seagreen: 0x2e8b57, + seashell: 0xfff5ee, + sienna: 0xa0522d, + silver: 0xc0c0c0, + skyblue: 0x87ceeb, + slateblue: 0x6a5acd, + slategray: 0x708090, + slategrey: 0x708090, + snow: 0xfffafa, + springgreen: 0x00ff7f, + steelblue: 0x4682b4, + tan: 0xd2b48c, + teal: 0x008080, + thistle: 0xd8bfd8, + tomato: 0xff6347, + turquoise: 0x40e0d0, + violet: 0xee82ee, + wheat: 0xf5deb3, + white: 0xffffff, + whitesmoke: 0xf5f5f5, + yellow: 0xffff00, + yellowgreen: 0x9acd32 + }; + + define(Color, color, { + copy(channels) { + return Object.assign(new this.constructor, this, channels); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + + function color_formatHex() { + return this.rgb().formatHex(); + } + + function color_formatHex8() { + return this.rgb().formatHex8(); + } + + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + + function color_formatRgb() { + return this.rgb().formatRgb(); + } + + function color(format) { + var m, l; + format = (format + "").trim().toLowerCase(); + return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 + : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 + : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 + : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 + : null) // invalid hex + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; + } + + function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); + } + + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } + + function rgbConvert(o) { + if (!(o instanceof Color)) o = color(o); + if (!o) return new Rgb; + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } + + function rgb(r, g, b, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); + } + + function Rgb(r, g, b, opacity) { + this.r = +r; + this.g = +g; + this.b = +b; + this.opacity = +opacity; + } + + define(Rgb, rgb, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return (-0.5 <= this.r && this.r < 255.5) + && (-0.5 <= this.g && this.g < 255.5) + && (-0.5 <= this.b && this.b < 255.5) + && (0 <= this.opacity && this.opacity <= 1); + }, + hex: rgb_formatHex, // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + + function rgb_formatRgb() { + const a = clampa(this.opacity); + return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; + } + + function clampa(opacity) { + return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); + } + + function clampi(value) { + return Math.max(0, Math.min(255, Math.round(value) || 0)); + } + + function hex(value) { + value = clampi(value); + return (value < 16 ? "0" : "") + value.toString(16); + } + + function hsla(h, s, l, a) { + if (a <= 0) h = s = l = NaN; + else if (l <= 0 || l >= 1) h = s = NaN; + else if (s <= 0) h = NaN; + return new Hsl(h, s, l, a); + } + + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color)) o = color(o); + if (!o) return new Hsl; + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + min = Math.min(r, g, b), + max = Math.max(r, g, b), + h = NaN, + s = max - min, + l = (max + min) / 2; + if (s) { + if (r === max) h = (g - b) / s + (g < b) * 6; + else if (g === max) h = (b - r) / s + 2; + else h = (r - g) / s + 4; + s /= l < 0.5 ? max + min : 2 - max - min; + h *= 60; + } else { + s = l > 0 && l < 1 ? 0 : h; + } + return new Hsl(h, s, l, o.opacity); + } + + function hsl(h, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); + } + + function Hsl(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + + define(Hsl, hsl, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h = this.h % 360 + (this.h < 0) * 360, + s = isNaN(h) || isNaN(this.s) ? 0 : this.s, + l = this.l, + m2 = l + (l < 0.5 ? l : 1 - l) * s, + m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), + hsl2rgb(h, m1, m2), + hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), + this.opacity + ); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) + && (0 <= this.l && this.l <= 1) + && (0 <= this.opacity && this.opacity <= 1); + }, + formatHsl() { + const a = clampa(this.opacity); + return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; + } + })); + + function clamph(value) { + value = (value || 0) % 360; + return value < 0 ? value + 360 : value; + } + + function clampt(value) { + return Math.max(0, Math.min(1, value || 0)); + } + + /* From FvD 13.37, CSS Color Module Level 3 */ + function hsl2rgb(h, m1, m2) { + return (h < 60 ? m1 + (m2 - m1) * h / 60 + : h < 180 ? m2 + : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 + : m1) * 255; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function isColor(cssColorSpecifier) { + return !!color(cssColorSpecifier); + } + function checkIsColorData(data, column) { + if (!column.stats.hasColorData) { + column.isColorData = false; + return; + } + for (let i = 0; i < data.length; i++) { + if (!isColor(data[i][column.name])) { + column.isColorData = false; + return; + } + } + column.isColorData = true; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function isQuantitative(column) { + return column.type === 'number' || column.type === 'integer'; + } + function detectNegative(columnName, data) { + for (let i = 1; i < data.length; i++) { + const value = columnName == null ? data[i] : data[i][columnName]; + if (value < 0) + return true; + } + return false; + } + function detectSequentialColumn(columnName, data) { + if (data.length < 2) + return false; + for (let i = 1; i < data.length; i++) { + const curr = columnName == null ? data[i] : data[i][columnName]; + const prev = columnName == null ? data[i - 1] : data[i - 1][columnName]; + if (curr !== prev + 1) + return false; + } + return true; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getStats(data, ...args) { + let columnName; + let columnType; + let columnQuantitative; + let distinctValuesCallback; + if (args.length <= 2) { + const column = args[0]; + columnName = column.name; + columnType = column.type; + columnQuantitative = column.quantitative; + distinctValuesCallback = args[1]; + } + else { + columnName = args[0]; + columnType = args[1]; + columnQuantitative = args[2]; + distinctValuesCallback = args[3]; + } + const distinctMap = {}; + const stats = { + nonNull: 0, + distinctValueCount: null, + max: null, + mean: null, + min: null, + }; + const columnIsString = columnType === 'string'; + let sum = 0; + for (let i = 0; i < data.length; i++) { + const row = data[i]; + const value = columnName == null ? row : row[columnName]; + if (columnIsString) { + if (value !== '') { + stats.nonNull++; + } + } + else if (value != null) { + stats.nonNull++; + } + const num = +value; + distinctMap[value] = true; + if (!isNaN(num)) { + if (stats.max === null || num > stats.max) { + stats.max = num; + } + if (stats.min === null || num < stats.min) { + stats.min = num; + } + sum += num; + } + // hex codes, ex. #003300, are parsed as dates + if ((columnType === 'date' || columnIsString) && !stats.hasColorData && isColor(value)) { + stats.hasColorData = true; + } + } + if (columnQuantitative) { + stats.mean = data.length > 0 && (sum / data.length); + stats.hasNegative = detectNegative(columnName, data); + if (columnType === 'integer') { + stats.isSequential = detectSequentialColumn(columnName, data); + } + } + const distinctValues = Object.keys(distinctMap); + if (distinctValuesCallback) { + distinctValues.sort(); + distinctValuesCallback(distinctValues); + } + stats.distinctValueCount = distinctValues.length; + return stats; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Derive column metadata from the data array. + * @param data Array of data objects. + */ + function getColumnsFromData(inferTypesFn, data, columnTypes) { + const sample = data[0]; + const fields = sample ? Object.keys(sample) : []; + const inferences = Object.assign(Object.assign({}, inferTypesFn(data, fields)), columnTypes); + const columns = fields.map(name => { + const column = { + name, + type: inferences[name], + }; + return column; + }); + inferAll(columns, data); + return columns; + } + /** + * Populate columns with type inferences and stats. + * @param columns Array of columns. + * @param data Array of data objects. + */ + function inferAll(columns, data) { + columns.forEach(column => { + if (column) { + if (typeof column.quantitative !== 'boolean') { + column.quantitative = isQuantitative(column); + } + if (!column.stats) { + column.stats = getStats(data, column); + } + // hex codes, ex. #003300, are parsed as dates + if ((column.type === 'date' || column.type === 'string') && typeof column.isColorData !== 'boolean') { + checkIsColorData(data, column); + } + } + }); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Table { + constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = 'right') { + this.columns = columns; + this.rows = rows; + this.maxWidth = maxWidth; + this.underlineHeaders = underlineHeaders; + this.align = align; + // Calculate maximum width for each column + this.columnWidths = this.columns.map((col, idx) => Math.max(col.length, ...this.rows.map(row => { var _a; return ((_a = row[idx]) === null || _a === void 0 ? void 0 : _a.length) || 0; }))); + } + createSpaces(num) { + return ' '.repeat(num); + } + groupColumns() { + let cumulativeWidth = 0; + const columnGroups = []; + let currentGroup = []; + this.columns.forEach((col, idx) => { + const columnSpace = this.columnWidths[idx] + 1; // account for one space between columns + if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { + columnGroups.push(currentGroup); + cumulativeWidth = columnSpace; + currentGroup = [col]; + } + else { + cumulativeWidth += columnSpace; + currentGroup.push(col); + } + }); + if (currentGroup.length > 0) { + columnGroups.push(currentGroup); + } + return columnGroups; + } + formatRow(row, group) { + return group.map(col => { + const idx = this.columns.indexOf(col); + const cellValue = row[idx] == null ? '' : row[idx].toString(); + return this.align === 'right' + ? cellValue.padStart(this.columnWidths[idx], ' ') + : cellValue.padEnd(this.columnWidths[idx], ' '); + }).join(this.createSpaces(1)); + } + formatHeader(group) { + return group.map(col => { + const idx = this.columns.indexOf(col); + return this.align === 'right' + ? col.padStart(this.columnWidths[idx], ' ') + : col.padEnd(this.columnWidths[idx], ' '); + }).join(this.createSpaces(1)); + } + underlineHeader(group) { + return group.map(col => '-'.repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); + } + render() { + const output = []; + const columnGroups = this.groupColumns(); + columnGroups.forEach((group, groupIndex) => { + const headerRow = this.formatHeader(group); + let section = headerRow + (groupIndex < columnGroups.length - 1 ? ' \\' : '') + '\n'; + if (this.underlineHeaders) { + section += this.underlineHeader(group) + '\n'; + } + this.rows.forEach((row) => { + section += this.formatRow(row, group) + '\n'; + }); + output.push(section); + if (groupIndex < columnGroups.length - 1) { + output.push('\n'); + } + }); + return output.join(''); + } + } + var pandasSimulation; + (function (pandasSimulation) { + // Mapping TypeScript types to Python-like dtypes + const typeMapping = { + boolean: 'bool', + number: 'float64', // Assuming 'number' is used for floating-point numbers + date: 'datetime64[ns]', + string: 'object', + integer: 'int64', + }; + function head(columns, data, maxWidth = 80) { + const numRows = 5; // Number of rows as in `head(5)` from pandas + const top = data.slice(0, numRows); // Get the top `numRows` rows + // Create a "fake" row number column + const rowNumbers = Array.from({ length: numRows }, (_, i) => (i + 1).toString()); + // Extract column names and rows for the table + const columnNames = [''].concat(columns.map(col => col.name)); + const rows = top.map((row, i) => [rowNumbers[i]].concat(columns.map(col => { var _a; return ((_a = row[col.name]) === null || _a === void 0 ? void 0 : _a.toString()) || ''; }))); + // Create and render the table with right alignment + const table = new Table(columnNames, rows, maxWidth, false, 'right'); // Right alignment + return table.render(); + } + pandasSimulation.head = head; + function info(columns, data, maxWidth = 80) { + const numRows = data.length; + const output = []; + // Summary header + output.push(''); + output.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); + output.push(`Data columns (total ${columns.length} columns):\n`); + // Column headers and details + const columnHeaders = ['#', 'Column', 'Non-Null Count', 'Dtype']; + const rows = columns.map((col, idx) => { + const nonNullCount = col.stats.nonNull.toString(); + const dtype = typeMapping[col.type] || 'unknown'; + return [idx.toString(), col.name, `${nonNullCount} non-null`, dtype]; + }); + // Create and render the table with left alignment and header underline + const table = new Table(columnHeaders, rows, maxWidth, true, 'left'); // Left alignment + output.push(table.render()); + // Memory usage estimation + const memoryUsage = columns.reduce((total, col) => { + var _a; + const exampleValue = (_a = data.find(row => row[col.name] != null)) === null || _a === void 0 ? void 0 : _a[col.name]; + if (exampleValue == null) + return total; + const size = new Blob([exampleValue.toString()]).size; + return total + (size * numRows); + }, 0); + output.push(`\ndtypes: ${columns.filter(col => col.type === 'number').length} float64, ` + + `${columns.filter(col => col.type === 'integer').length} int64, ` + + `${columns.filter(col => col.type === 'string').length} object`); + output.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); + return output.join('\n'); + } + pandasSimulation.info = info; + })(pandasSimulation || (pandasSimulation = {})); + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Get columns associated with each Insight role. + * @param insight Insight to specify column roles. + * @param columns Array of Columns inferred from the data. + */ + function getSpecColumns(insight, columns) { + function getColumnByName(name) { + return columns.filter(c => c.name === name)[0]; + } + return { + color: getColumnByName(insight.columns && insight.columns.color), + facet: getColumnByName(insight.columns && insight.columns.facet), + facetV: getColumnByName(insight.columns && insight.columns.facetV), + group: getColumnByName(insight.columns && insight.columns.group), + size: getColumnByName(insight.columns && insight.columns.size), + sort: getColumnByName(insight.columns && insight.columns.sort), + uid: getColumnByName(insight.columns && insight.columns.uid), + x: getColumnByName(insight.columns && insight.columns.x), + y: getColumnByName(insight.columns && insight.columns.y), + z: getColumnByName(insight.columns && insight.columns.z), + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addAxes(scope, ...axes) { + if (!axes || !axes.length) + return; + if (!scope.axes) + scope.axes = []; + scope.axes.push(...axes.filter(Boolean)); + } + function addData(scope, ...datas) { + if (!datas || !datas.length) + return; + if (!scope.data) + scope.data = []; + scope.data.push(...datas.filter(Boolean)); + } + function addMarks(scope, ...marks) { + if (!marks || !marks.length) + return; + if (!scope.marks) + scope.marks = []; + scope.marks.push(...marks.filter(Boolean)); + } + function addScales(scope, ...scales) { + if (!scales || !scales.length) + return; + if (!scope.scales) + scope.scales = []; + scope.scales.push(...scales.filter(Boolean)); + } + function addSignals(scope, ...signals) { + if (!signals || !signals.length) + return; + if (!scope.signals) + scope.signals = []; + scope.signals.push(...signals.filter(Boolean)); + } + function addTransforms(data, ...transforms) { + if (!transforms || !transforms.length) + return; + if (!data.transform) + data.transform = []; + data.transform.push(...transforms.filter(Boolean)); + } + function getDataByName(data, dataName) { + for (let i = 0; i < data.length; i++) { + if (data[i].name === dataName) + return { data: data[i], index: i }; + } + } + function getGroupBy(groupings) { + const groupby = groupings.map(g => g.groupby); + return groupby.reduce((acc, val) => acc.concat(val), []); + } + function addOffsets(...offsets) { + return offsets.filter(Boolean).join(' + '); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addGlobalAxes(props) { + const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; + const { scope } = globalScope; + allGlobalScales.forEach(globalScales => { + const { scales } = globalScales; + for (const xyz in scales) { + const _scales = scales[xyz]; + if (_scales) { + addScales(scope, ..._scales); + let { showAxes } = globalScales; + let zindex = undefined; + if (xyz === 'z') { + showAxes = false; + if (props.view === '3d' && specViewOptions.zAxisOptions && !props.hideZAxis) { + if (specViewOptions.zAxisOptions.showZAxis) { + showAxes = true; + zindex = specViewOptions.zAxisOptions.zIndex; + } + } + } + if (showAxes && axisScales) { + const axisScale = axisScales[xyz]; + if (axisScale) { + const lineColor = specViewOptions.colors.axisLine; + const horizontal = xyz === 'x'; + const column = specColumns[xyz] || { quantitative: true }; + const title = axisScale.title; + const props = { + title, + horizontal, + column, + specViewOptions, + lineColor, + titlePadding: axesTitlePadding[xyz], + labelBaseline: labelBaseline[xyz], + zindex, + }; + axesScopes['main'].forEach(a => addAxes(a.scope, createAxis(Object.assign(Object.assign({}, props), { scale: a.scale || _scales[0], showTitle: a.title, showLabels: a.labels, showLines: a.lines })))); + if (axesScopes[xyz]) { + axesScopes[xyz].forEach(a => addAxes(a.scope, createAxis(Object.assign(Object.assign({}, props), { scale: a.scale || _scales[0], showTitle: a.title, showLabels: a.labels, showLines: a.lines })))); + } + if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { + const plotOffsetSignal = plotOffsetSignals[xyz]; + plotOffsetSignal.update = `${axesOffsets[xyz]}`; + } + } + } + } + } + }); + } + function createAxis(props) { + const { column, horizontal, labelBaseline, lineColor, scale, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; + const axis = Object.assign(Object.assign(Object.assign(Object.assign({ zindex, scale: scale.name, orient: horizontal ? 'bottom' : 'left', domain: showLines, ticks: showLines }, showLines && { + domainColor: lineColor, + tickColor: lineColor, + tickSize: specViewOptions.tickSize, + }), showTitle && { + title, + titleAlign: horizontal ? 'left' : 'right', + titleAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY, + }, + titleColor: specViewOptions.colors.axisText, + titleFontSize: { + signal: SignalNames.TextTitleSize, + }, + titleLimit: axesTitleLimit, + titlePadding, + }), { labels: showLabels }), showLabels && { + labelAlign: horizontal ? 'left' : 'right', + labelBaseline, + labelAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY, + }, + labelColor: specViewOptions.colors.axisText, + labelFontSize: { + signal: SignalNames.TextSize, + }, + labelLimit: axesLabelLimit, + }); + if (column.quantitative) { + axis.format = '~r'; + } + return axis; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + /** + * Make sure that the field name is accessible via Vega's Field type + * https://vega.github.io/vega/docs/types/#Field + * examples: "source.x", "target['x']", "[my.field]" + */ + function safeFieldName(field) { + return field + .replace(/\\/g, '\\\\') //escape backslashes + .replace(/'/g, '\\\'') //escape single quotes + .replace(/"/g, '\\"') //escape double quotes + .replace(/\./g, '\\.') //escape periods + .replace(/\[/g, '\\[') //escape left square brackets + .replace(/\]/g, '\\]') //escape right square brackets + ; + } + /** + * Make sure the field name is usable in a Vega expression + */ + function exprSafeFieldName(field) { + //remove whitespace, period, accessors and logical modifiers + return field.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ''); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function linearScale(scaleName, domain, range, reverse, zero, nice = true) { + const scale = { + name: scaleName, + type: 'linear', + range, + round: true, + reverse, + domain, + zero, + nice, + }; + return scale; + } + function pointScale(scaleName, data, range, field, reverse) { + const scale = { + name: scaleName, + type: 'point', + range, + domain: { + data, + field: safeFieldName(field), + sort: true, + }, + padding: 0.5, + }; + if (reverse !== undefined) { + scale.reverse = reverse; + } + return scale; + } + function binnableColorScale(scaleName, colorBin, data, field, scheme) { + scheme = scheme || ColorScaleNone; + const domain = { + data, + field: safeFieldName(field), + }; + const range = { + scheme, + }; + const reverse = { signal: SignalNames.ColorReverse }; + if (colorBin !== 'continuous') { + range.count = { signal: SignalNames.ColorBinCount }; + } + switch (colorBin) { + case 'continuous': { + const sequentialScale = { + name: scaleName, + type: 'linear', + domain, + range, + reverse, + }; + return sequentialScale; + } + case 'quantile': { + const quantileScale = { + name: scaleName, + type: 'quantile', + domain, + range, + reverse, + }; + return quantileScale; + } + default: { + const quantizeScale = { + name: scaleName, + type: 'quantize', + domain, + range, + reverse, + }; + return quantizeScale; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const defaultZProportion = 0.6; + function textSignals(context, heightSignal) { + const { specViewOptions } = context; + const signals = [ + { + name: SignalNames.ZProportion, + value: defaultZProportion, + bind: { + name: specViewOptions.language.zScaleProportion, + debounce, + input: 'range', + min: 0.1, + max: 2, + step: 0.1, + }, + }, + { + name: SignalNames.ZHeight, + update: `${heightSignal} * ${SignalNames.ZProportion}`, + }, + { + name: SignalNames.TextScale, + value: 1.2, + bind: { + name: specViewOptions.language.textScaleSignal, + debounce, + input: 'range', + min: 0.5, + max: 2, + step: 0.1, + }, + }, + { + name: SignalNames.TextSize, + update: `${SignalNames.TextScale} * 10`, + }, + { + name: SignalNames.TextTitleSize, + update: `${SignalNames.TextScale} * 15`, + }, + { + name: SignalNames.TextAngleX, + value: 30, + bind: { + name: specViewOptions.language.xAxisTextAngleSignal, + debounce, + input: 'range', + min: 0, + max: 90, + step: 1, + }, + }, + { + name: SignalNames.TextAngleY, + value: 0, + bind: { + name: specViewOptions.language.yAxisTextAngleSignal, + debounce, + input: 'range', + min: -90, + max: 0, + step: 1, + }, + }, + { + name: SignalNames.MarkOpacity, + value: 1, + bind: { + name: specViewOptions.language.markOpacitySignal, + debounce, + input: 'range', + min: 0.1, + max: 1, + step: 0.05, + }, + }, + ]; + return signals; + } + function colorBinCountSignal(context) { + const { specViewOptions } = context; + const signal = { + name: SignalNames.ColorBinCount, + value: 7, + bind: { + name: specViewOptions.language.colorBinCount, + debounce, + input: 'range', + min: 1, + max: specViewOptions.maxLegends + 1, + step: 1, + }, + }; + return signal; + } + function colorReverseSignal(context) { + const { specViewOptions } = context; + const signal = { + name: SignalNames.ColorReverse, + value: false, + bind: { + name: specViewOptions.language.colorReverse, + input: 'checkbox', + }, + }; + return signal; + } + function modifySignal(s, fn, update) { + s.update = `${fn}((${s.update}), (${update}))`; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function legend(column, fill) { + const legend = { + orient: 'none', + title: column.name, + fill, + encode: { + symbols: { + update: { + shape: { + value: 'square', + }, + }, + }, + }, + }; + if (column.quantitative) { + legend.type = 'symbol'; + legend.format = '~r'; + } + return legend; + } + function getLegends(context, fill) { + const { specColumns, insight } = context; + if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) { + return [legend(specColumns.color, fill)]; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function topLookup(column, count, source, legend, lookupName, fieldName, indexName) { + const data = [ + { + name: lookupName, + source, + transform: [ + { + type: 'aggregate', + groupby: [safeFieldName(column.name)], + }, + { + type: 'window', + ops: ['count'], + as: [indexName], + }, + { + type: 'filter', + expr: `datum[${JSON.stringify(indexName)}] <= ${count}`, + }, + ], + }, + { + name: legend, + source, + transform: [ + { + type: 'lookup', + from: lookupName, + key: safeFieldName(column.name), + fields: [column.name].map(safeFieldName), + values: [column.name].map(safeFieldName), + as: [fieldName], + }, + { + type: 'formula', + expr: `datum[${JSON.stringify(fieldName)}] == null ? '${Other}' : datum[${JSON.stringify(fieldName)}]`, + as: fieldName, + }, + ], + }, + ]; + return data; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addColor(props) { + const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; + let colorDataName = dataName; + const { insight, specColumns, specViewOptions } = specContext; + const legends = getLegends(specContext, scaleName); + if (legends) { + scope.legends = legends; + } + const categoricalColor = specColumns.color && !specColumns.color.quantitative; + if (categoricalColor) { + addData(scope, ...topLookup(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, FieldNames.TopColor, FieldNames.TopIndex)); + colorDataName = legendDataName; + } + if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) { + if (specColumns.color.quantitative) { + addScales(scope, binnableColorScale(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); + } + else { + addScales(scope, { + name: scaleName, + type: 'ordinal', + domain: { + data: colorDataName, + field: FieldNames.TopColor, + sort: true, + }, + range: { + scheme: insight.scheme || ColorScaleNone, + }, + reverse: { signal: colorReverseSignalName }, + }); + } + } + addSignals(scope, colorBinCountSignal(specContext), colorReverseSignal(specContext)); + return { topColorField: FieldNames.TopColor, colorDataName }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { + const titleSignal = `parent[${JSON.stringify(FieldNames.FacetTitle)}]`; + const index = `datum[${JSON.stringify(FieldNames.Ordinal)}] - 1`; + const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index); + const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index); + addMarks(globalScope, col.header, row.footer); + addMarks(col.header, { + type: 'text', + encode: { + enter: { + align: { + value: 'center', + }, + baseline: { + value: 'middle', + }, + fill: { + value: axisTextColor, + }, + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}`, + }, + x: { + signal: `${sizeSignals.layoutWidth} / 2`, + }, + limit: { + signal: sizeSignals.layoutWidth, + }, + fontSize: { + signal: SignalNames.TextSize, + }, + text: { + signal: titleSignal, + }, + }, + }, + }); + addMarks(row.footer, { + type: 'text', + encode: { + enter: { + align: { + value: 'left', + }, + baseline: { + value: 'middle', + }, + fill: { + value: axisTextColor, + }, + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}`, + }, + y: { + signal: `${sizeSignals.layoutHeight} / 2`, + }, + limit: { + signal: SignalNames.PlotOffsetRight, + }, + fontSize: { + signal: SignalNames.TextSize, + }, + text: { + signal: titleSignal, + }, + }, + }, + }); + } + function addFacetCellTitles(scope, sizeSignals, axisTextColor) { + addMarks(scope, { + type: 'text', + encode: { + enter: { + align: { + value: 'center', + }, + baseline: { + value: 'bottom', + }, + fill: { + value: axisTextColor, + }, + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}`, + }, + x: { + signal: `(${sizeSignals.layoutWidth}) / 2`, + }, + text: { + signal: `parent[${JSON.stringify(FieldNames.FacetTitle)}]`, + }, + fontSize: { + signal: SignalNames.TextSize, + }, + limit: { + signal: sizeSignals.layoutWidth, + }, + y: { + signal: `-${SignalNames.FacetPaddingTop} / 2`, + }, + }, + }, + }); + } + function addFacetAxesGroupMarks(props) { + const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; + const { sizeSignals } = facetScope; + const colSequence = createSequence(colSeqName, sizeSignals.colCount); + const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); + const index = 'datum.data'; + const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index); + const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index); + addData(globalScope, colSequence, rowSequence); + addMarks(globalScope, col.footer, row.header); + addScales(globalScope, colTitleScale, rowTitleScale); + const map = { + main: [ + { + scope: facetScope.facetScope, + lines: true, + labels: false, + title: false, + }, + ], + x: [ + { + scope: col.footer, + lines: true, + labels: true, + title: false, + }, + { + scope: plotScope, + scale: colTitleScale, + lines: false, + labels: false, + title: true, + }, + ], + y: [ + { + scope: row.header, + lines: true, + labels: true, + title: false, + }, + { + scope: plotScope, + scale: rowTitleScale, + lines: false, + labels: false, + title: true, + }, + ], + }; + return map; + } + function facetRowHeaderFooter(data, sizeSignals, index) { + const rowFn = (xSignal) => { + return { + type: 'group', + from: { data }, + encode: { + update: { + x: { signal: xSignal }, + y: { + signal: `${SignalNames.PlotOffsetTop} + ${SignalNames.FacetPaddingTop} + (${index}) * (${sizeSignals.layoutHeight} + ${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})`, + }, + height: { signal: sizeSignals.layoutHeight }, + }, + }, + }; + }; + const header = rowFn(SignalNames.PlotOffsetLeft); + const footer = rowFn(`${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetRight} / 2`); + return { header, footer }; + } + function facetColumnHeaderFooter(data, sizeSignals, index) { + const colFn = (ySignal) => { + return { + type: 'group', + from: { data }, + encode: { + update: { + x: { + signal: `(${index}) * (${sizeSignals.layoutWidth} + ${SignalNames.FacetPaddingLeft}) + ${SignalNames.FacetPaddingLeft} + ${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}`, + }, + y: { signal: `${ySignal} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: sizeSignals.layoutWidth }, + }, + }, + }; + }; + //create group marks based on data sequences + const header = colFn(`${SignalNames.PlotOffsetTop} / 2`); + const footer = colFn(`${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut}`); + return { header, footer }; + } + function createSequence(dataName, countSignal) { + return { + name: dataName, + transform: [ + { + type: 'sequence', + start: 0, + stop: { + signal: countSignal, + }, + }, + ], + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function fill(context, colorFieldName, scale) { + const { specColumns, insight, specViewOptions } = context; + const colorColumn = specColumns.color; + return colorColumn ? + colorColumn.isColorData || insight.directColor ? + { + field: safeFieldName(colorColumn.name), + } + : + { + scale, + field: colorColumn.quantitative ? safeFieldName(colorColumn.name) : colorFieldName, + } + : + { + value: specViewOptions.colors.defaultCube, + }; + } + function opacity(context) { + const result = { + signal: SignalNames.MarkOpacity, + }; + return result; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class GlobalScope { + constructor(props) { + const { dataName, markGroup, scope, signals } = props; + this.scope = scope; + this._markGroup = markGroup; + this.signals = signals; + this.data = getDataByName(scope.data, dataName).data; + this._markDataName = dataName; + this.offsets = { + x: '0', + y: '0', + h: SignalNames.PlotHeightIn, + w: SignalNames.PlotWidthIn, + }; + this.sizeSignals = { + layoutHeight: SignalNames.PlotHeightIn, + layoutWidth: SignalNames.PlotWidthIn, + }; + this.zSize = SignalNames.PlotHeightIn; + } + get markDataName() { + return this._markDataName; + } + setMarkDataName(markDataName) { + this._markDataName = markDataName; + } + get markGroup() { + return this._markGroup; + } + setMarkGroup(markGroup) { + this._markGroup = markGroup; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Layout { + constructor(props) { + this.props = props; + this.id = props.id; + } + getGrouping() { + return null; + } + getAggregateSumOp() { + return null; + } + build() { + throw 'Not implemented'; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function testForCollapseSelection() { + return `datum.${FieldNames.Collapsed}`; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AggregateContainer extends Layout { + constructor(props) { + super(props); + this.props = props; + const a = this.aggregation = this.getAggregation(); + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a}_extent`, + scale: `scale_${p}`, + extentData: `data_${p}_extent`, + offsets: `data_${p}_offsets`, + }; + } + getAggregateSumOp() { + if (this.aggregation === 'sum') { + const fieldOp = { + field: safeFieldName(this.props.sumBy.name), + op: 'sum', + as: FieldNames.Sum, + }; + return fieldOp; + } + } + build() { + const { aggregation, names, props } = this; + const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: 'extent', + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal, + }); + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentSignal, + update: `${names.globalAggregateExtentSignal}[1]`, + }); + const horizontal = dock === 'left'; + const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; + const offsets = { + x: parentScope.offsets.x, + y: addOffsets(parentScope.offsets.y, dock === 'bottom' ? + groupScaled + : + ''), + h: horizontal ? + parentScope.offsets.h + : + dock === 'top' + ? groupScaled + : `${parentScope.offsets.h} - ${groupScaled}`, + w: horizontal ? + groupScaled + : + parentScope.offsets.w, + }; + const scale = { + type: 'linear', + name: names.scale, + domain: [ + 0, + { + signal: props.globalAggregateMaxExtentSignal, + }, + ], + range: horizontal ? + [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth, + }, + ] + : + [ + { + signal: parentScope.sizeSignals.layoutHeight, + }, + 0, + ], + nice: niceScale, + zero: true, + reverse: dock === 'top', + }; + const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentScaledSignal, + update: dock === 'bottom' + ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` + : globalAggregateMaxExtentScaledValue, + }); + return { + offsets, + sizeSignals: horizontal ? + { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: null, + } + : + { + layoutHeight: null, + layoutWidth: parentScope.sizeSignals.layoutWidth, + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? [scale] : undefined, + y: horizontal ? undefined : [scale], + }, + }, + encodingRuleMap: horizontal ? + { + x: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.x, + }], + width: [{ + test: testForCollapseSelection(), + value: 0, + }], + } + : + { + y: [{ + test: testForCollapseSelection(), + signal: dock === 'top' + ? parentScope.offsets.y + : addOffsets(parentScope.offsets.y, parentScope.offsets.h), + }], + height: [{ + test: testForCollapseSelection(), + value: 0, + }], + }, + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: 'joinaggregate', + groupby: groupby.map(safeFieldName), + ops: [aggregation], + }; + if (aggregation === 'sum') { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; + } + getAggregation() { + const { props } = this; + let s; + if (props.dock === 'left') { + s = props.axesScales.x; + } + else { + s = props.axesScales.y; + } + switch (s.aggregate) { + case 'sum': + return 'sum'; + default: + return 'count'; + } + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class AggregateSquare extends Layout { + constructor(props) { + super(props); + this.props = props; + const a = this.props.aggregation; + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a}_extent`, + extentData: `data_${p}_extent`, + }; + } + build() { + const { names, props } = this; + const { aggregation, globalScope, groupings, onBuild, parentScope } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: 'extent', + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal, + }); + const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; + const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; + const squareMaxArea = `(${[squareMaxSide, squareMaxSide].join(' * ')})`; + const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; + const squareArea = `(${[squareMaxArea, shrinkRatio].join(' * ')})`; + const squareSide = `sqrt(${squareArea})`; + const localAggregateMaxExtentScaled = squareSide; + onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); + const offsets = { + x: addOffsets(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), + y: addOffsets(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), + h: squareSide, + w: squareSide, + }; + return { + offsets, + sizeSignals: { + layoutHeight: null, + layoutWidth: null, + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: offsets.y, + }], + height: [{ + test: testForCollapseSelection(), + value: 0, + }], + }, + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: 'joinaggregate', + groupby: groupby.map(safeFieldName), + ops: [aggregation], + }; + if (aggregation === 'sum') { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function dataExtent(column, signal) { + return { + type: 'extent', + field: safeFieldName(column.name), + signal, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { + const { column, defaultBins, maxbins, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; + if (column.quantitative) { + const field = `${prefix}_bin_${exprSafeFieldName(column.name)}`; + const fieldEnd = `${field}_end`; + const binSignal = `${field}_bins`; + const dataExtentSignal = `${field}_bin_extent`; + const dataExtentSpanSignal = `${field}_bin_extent_span`; + const outerSignal = `${field}_outer_extent`; + domainDataName = `${field}_sequence`; //override the data name + const extentTransform = dataExtent(column, dataExtentSignal); + let imageSignal; + if (outerSignalExtents) { + imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); + } + const maxbinsSignal = { + name: maxbinsSignalName, + value: defaultBins, + bind: { + name: maxbinsSignalDisplayName, + debounce, + input: 'range', + min: 1, + max: maxbins, + step: 1, + }, + }; + const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; + const binTransform = { + type: 'bin', + field: safeFieldName(column.name), + as: [ + field, + fieldEnd, + ], + signal: binSignal, + extent: { + signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]`, //add a tiny bit to the upper extent to force the extra bin - https://github.com/vega/vega/issues/2899 + }, + minstep: shouldBeIntegralBinStep(column) ? 1 : 0, + maxbins: { + signal: maxbinsSignalName, + }, + }; + const dataSequence = { + name: domainDataName, + transform: [ + { + type: 'sequence', + start: { + signal: `${binSignal}.start`, + }, + stop: { + signal: `${binSignal}.stop`, + }, + step: { + signal: `${binSignal}.step`, + }, + }, + { + type: 'formula', + expr: 'datum.data', + as: field, + }, + { + type: 'formula', + expr: `datum.data + ${binSignal}.step`, + as: fieldEnd, + }, + { + type: 'window', + ops: ['row_number'], + as: [FieldNames.Ordinal], + }, + { + type: 'formula', + expr: `datum.data === ${binSignal}.start`, + as: FieldNames.First, + }, + { + type: 'formula', + expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, + as: FieldNames.Last, + }, + { + // when there is only one bin, use only first sequence element + type: 'filter', + expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify(FieldNames.First)}] : true`, + }, + ], + }; + const signals = [ + maxbinsSignal, + { + name: dataExtentSpanSignal, + update: `${extentSignal}[1] - ${extentSignal}[0]`, + }, + ]; + if (imageSignal) { + signals.push(imageSignal); + } + const augmentBinnable = { + discreteColumn, + native: false, + transforms: [extentTransform, binTransform], + fields: [field, fieldEnd], + binSignal, + extentSignal, + dataSequence, + domainDataName, + signals, + fullScaleDataname: dataSequence.name, + }; + return augmentBinnable; + } + else { + const nativeBinnable = { + discreteColumn, + native: true, + fields: [column.name], + domainDataName, + fullScaleDataname: domainDataName, + }; + return nativeBinnable; + } + } + function outerExtentSignal(name, min, max, dataExtent) { + return { + name, + update: `[min(${min}, ${dataExtent}[0]), max(${max}, ${dataExtent}[1])]`, + }; + } + function shouldBeIntegralBinStep(column) { + //prevent Vega from showing ".5" steps between integer scale values + return column.quantitative && (column.type === 'integer' && (column.stats.max - column.stats.min) <= 7); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const bandScaleLinearSuffix = '_linear'; + class Band extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `band_${this.id}`; + this.names = { + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + bandWidth: `${p}_bandwidth`, + accumulative: `${p}_accumulative`, + }; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); + } + getGrouping() { + return this.bin.fields; + } + build() { + const { bin, names, props } = this; + const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; + const binField = bin.fields[0]; + if (bin.native === false) { + addSignals(globalScope.scope, ...bin.signals); + addTransforms(globalScope.data, ...bin.transforms); + addData(globalScope.scope, bin.dataSequence); + } + //TODO don't add this, use existing dataset + addData(globalScope.scope, { + name: names.accumulative, + source: bin.fullScaleDataname, + transform: [ + { + type: 'aggregate', + groupby: this.getGrouping().map(safeFieldName), + ops: ['count'], + }, + ], + }); + const horizontal = orientation === 'horizontal'; + const minCellSignal = (horizontal) ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; + modifySignal(minCellSignal, 'max', `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); + addSignals(globalScope.scope, { + name: names.bandWidth, + update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})`, + }); + const scale = this.getScale(bin, horizontal); + if (props.outerSignalExtents && bin.native === false) { + //add a linear scale for use by background image + addScales(globalScope.scope, linearScale(scale.name + bandScaleLinearSuffix, { signal: bin.extentSignal }, scale.range, scale.reverse, false, false)); + } + let encodingRuleMap; + if (!props.excludeEncodingRuleMap) { + encodingRuleMap = horizontal ? + { + x: [ + { + test: testForCollapseSelection(), + signal: parentScope.offsets.x, + }, + ], + width: [ + { + test: testForCollapseSelection(), + value: 0, + }, + ], + } + : + { + y: [ + { + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.offsets.h), + }, + ], + height: [ + { + test: testForCollapseSelection(), + value: 0, + }, + ], + }; + } + return { + offsets: this.getOffset(horizontal, binField), + sizeSignals: horizontal ? + { + layoutHeight: names.bandWidth, + layoutWidth: parentScope.sizeSignals.layoutWidth, + } + : + { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: names.bandWidth, + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? undefined : [scale], + y: horizontal ? [scale] : undefined, + }, + }, + encodingRuleMap, + }; + } + getOffset(horizontal, binField) { + const { names, props } = this; + const { parentScope } = props; + return { + x: addOffsets(parentScope.offsets.x, horizontal ? + '' + : + `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), + y: addOffsets(parentScope.offsets.y, horizontal ? + `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` + : + ''), + h: horizontal ? + names.bandWidth + : + parentScope.offsets.h, + w: horizontal ? + parentScope.offsets.w + : + names.bandWidth, + }; + } + getScale(bin, horizontal) { + const { names } = this; + const { parentScope } = this.props; + const binField = safeFieldName(bin.fields[0]); + let bandScale; + if (horizontal) { + bandScale = { + type: 'band', + name: names.yScale, + range: [ + 0, + { + signal: parentScope.sizeSignals.layoutHeight, + }, + ], + padding: 0.1, + domain: { + data: bin.domainDataName, + field: binField, + sort: true, + }, + reverse: true, + }; + } + else { + bandScale = { + type: 'band', + name: names.xScale, + range: [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth, + }, + ], + padding: 0.1, + domain: { + data: bin.domainDataName, + field: binField, + sort: true, + }, + }; + } + return bandScale; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function displayBin(bin) { + const val = (index) => `datum[${JSON.stringify(bin.fields[index])}]`; + return bin.discreteColumn.column.quantitative ? + `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` + : + val(0); + } + function obj(nameValues, clause) { + return `{${nameValues.join()}}`; + } + function serializeAsVegaExpression(bin, firstFieldName, lastFieldName, clause) { + if (bin.discreteColumn.column.quantitative) { + const low = [ + `name:${JSON.stringify(bin.discreteColumn.column.name)}`, + 'operator:\'>=\'', + `value:datum[${JSON.stringify(bin.fields[0])}]`, + ]; + const high = [ + 'clause:\'&&\'', + `name:${JSON.stringify(bin.discreteColumn.column.name)}`, + 'operator:\'<\'', + `value:datum[${JSON.stringify(bin.fields[1])}]`, + ]; + return obj([ + `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]`, + ]); + } + else { + const exact = [ + `name:${JSON.stringify(bin.discreteColumn.column.name)}`, + 'operator:\'==\'', + `value:datum[${JSON.stringify(bin.fields[0])}]`, + ]; + return obj([ + `expressions:[${obj(exact)}]`, + ]); + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function createOrdinals(source, prefix, binFields, sortOrder) { + const _binFields = binFields.map(safeFieldName); + const dataName = `${prefix}_bin_order`; + const data = { + name: dataName, + source, + transform: [ + { + type: 'aggregate', + groupby: _binFields, + }, + { + type: 'collect', + sort: { + field: _binFields, + order: _binFields.map(f => sortOrder), + }, + }, + { + type: 'window', + ops: ['row_number'], + as: [FieldNames.Ordinal], + }, + ], + }; + return { + data, + scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields), + }; + } + function ordinalScale(dataName, scaleName, binFields) { + return { + type: 'ordinal', + name: scaleName, + domain: { + data: dataName, + field: safeFieldName(binFields[0]), + }, + range: { + data: dataName, + field: FieldNames.Ordinal, + }, + }; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Cross extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `cross_${this.id}`; + this.binX = binnable(`${p}_x`, props.globalScope.data.name, props.groupbyX); + this.binY = binnable(`${p}_y`, props.globalScope.data.name, props.groupbyY); + this.names = { + facetDataName: `data_${p}_facet`, + searchUnion: `data_${p}_search`, + dimScale: `scale_${p}`, + dimCount: `${p}_count`, + dimCategorical: `data_${p}_cat`, + dimCellSize: `${p}_cell_size`, + dimCellSizeCalc: `${p}_cell_calc`, + }; + } + getGrouping() { + return this.binX.fields.concat(this.binY.fields); + } + build() { + const { binX, binY, names, prefix, props } = this; + const { axisTextColor, colRowTitles, globalScope, parentScope } = props; + const titles = { x: { dataName: null, quantitative: null }, y: { dataName: null, quantitative: null } }; + const dx = { + dim: 'x', + bin: binX, + sortOrder: 'ascending', + size: parentScope.sizeSignals.layoutWidth, + layout: parentScope.sizeSignals.layoutWidth, + min: globalScope.signals.minCellWidth.name, + out: globalScope.signals.plotWidthOut, + offset: SignalNames.FacetPaddingLeft, + padding: SignalNames.FacetPaddingLeft, + dataOut: null, + scaleName: null, + position: null, + }; + const dy = { + dim: 'y', + bin: binY, + sortOrder: 'ascending', + size: parentScope.sizeSignals.layoutHeight, + layout: parentScope.sizeSignals.layoutHeight, + min: globalScope.signals.minCellHeight.name, + out: globalScope.signals.plotHeightOut, + offset: SignalNames.FacetPaddingTop, + padding: `(${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})`, + dataOut: null, + scaleName: null, + position: null, + }; + const dimensions = [dx, dy]; + dimensions.forEach(d => { + const { bin, dim, padding, sortOrder } = d; + let data; + let dataName; + let countSignal; + let scale; + const titleSource = titles[dim]; + if (bin.native === false) { + addSignals(globalScope.scope, ...bin.signals); + addTransforms(globalScope.data, ...bin.transforms); + addData(globalScope.scope, bin.dataSequence); + addTransforms(bin.dataSequence, { + type: 'formula', + expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, + as: FieldNames.Contains, + }); + data = bin.dataSequence; + dataName = bin.dataSequence.name; + countSignal = `length(data(${JSON.stringify(dataName)}))`; + scale = ordinalScale(dataName, `${names.dimScale}_${dim}`, bin.fields); + titleSource.dataName = bin.dataSequence.name; + } + else { + dataName = globalScope.markDataName; + const ord = createOrdinals(dataName, `${prefix}_${dim}`, bin.fields, sortOrder); + data = ord.data; + addData(globalScope.scope, ord.data); + countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; + scale = ord.scale; + titleSource.dataName = ord.data.name; + } + titleSource.quantitative = bin.discreteColumn.column.quantitative; + d.dataOut = data; + d.scaleName = scale.name; + addTransforms(data, { + type: 'formula', + expr: serializeAsVegaExpression(bin, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch, + }, { + type: 'formula', + expr: displayBin(bin), + as: FieldNames.FacetTitle, + }); + addScales(globalScope.scope, scale); + const count = `${names.dimCount}_${dim}`; + const calc = `${names.dimCellSizeCalc}_${dim}`; + const size = `${names.dimCellSize}_${dim}`; + addSignals(globalScope.scope, { name: count, update: countSignal }); + addSignals(globalScope.scope, { + name: calc, + update: `${d.layout} / ${count}`, + }, { + name: size, + update: `max(${d.min}, (${calc} - ${padding}))`, + }); + modifySignal(d.out, 'max', `((${size} + ${padding}) * ${count})`); + d.position = this.dimensionOffset(d); + }); + const groupRow = { + type: 'group', + encode: { + update: { + y: { + signal: dy.position, + }, + }, + }, + from: { + data: dy.dataOut.name, + }, + data: [ + { + name: names.searchUnion, + source: dx.dataOut.name, + transform: [ + { + type: 'formula', + expr: `[datum[${JSON.stringify(FieldNames.FacetSearch)}], merge(parent[${JSON.stringify(FieldNames.FacetSearch)}], { clause: '&&'})]`, + as: FieldNames.FacetSearch, + }, + ], + }, + ], + }; + const groupCol = { + style: 'cell', + name: prefix, + type: 'group', + encode: { + update: { + height: { + signal: `${names.dimCellSize}_y`, + }, + width: { + signal: `${names.dimCellSize}_x`, + }, + x: { + signal: dx.position, + }, + }, + }, + from: { + data: names.searchUnion, + }, + }; + addMarks(globalScope.markGroup, groupRow); + addMarks(groupRow, groupCol); + const offsets = { + x: this.dimensionOffset(dx), + y: this.dimensionOffset(dy), + h: `${names.dimCellSize}_y`, + w: `${names.dimCellSize}_x`, + }; + const sizeSignals = { + layoutHeight: `${names.dimCellSize}_y`, + layoutWidth: `${names.dimCellSize}_x`, + colCount: `${names.dimCount}_x`, + rowCount: `${names.dimCount}_y`, + }; + if (colRowTitles) { + addFacetColRowTitles(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); + } + return { + facetScope: groupCol, + offsets, + sizeSignals, + titles, + }; + } + dimensionOffset(d) { + const { names } = this; + return `${d.offset} + (scale(${JSON.stringify(d.scaleName)}, datum[${JSON.stringify(d.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d.dim} + ${d.padding})`; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Scatter extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `scatter_${this.id}`; + this.names = { + aggregateData: `data_${p}_aggregate`, + markData: `data_${p}_mark`, + xDataExtent: `${p}_xDataExtent`, + yDataExtent: `${p}_yDataExtent`, + xExtent: `${p}_xExtent`, + yExtent: `${p}_yExtent`, + sizeExtent: `${p}_sizeExtent`, + sizeRange: `${p}_sizeRange`, + sizeScale: `${p}_sizeScale`, + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + zScale: `scale_${p}_z`, + }; + } + build() { + const { names, prefix, props } = this; + const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x, y, z, zGrounded } = props; + const qsize = size && size.quantitative && size; + addSignals(globalScope.scope, { + name: SignalNames.PointScale, + value: 5, + bind: { + name: scatterPointScaleDisplay, + debounce, + input: 'range', + min: 1, + max: 10, + step: 0.1, + }, + }, { + name: SignalNames.ZGrounded, + value: false, + bind: { + name: zGrounded, + input: 'checkbox', + }, + }); + if (backgroundImageExtents) { + addTransforms(globalScope.data, dataExtent(x, names.xDataExtent), dataExtent(y, names.yDataExtent)); + const xSignal = outerExtentSignal(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); + const ySignal = outerExtentSignal(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); + addSignals(globalScope.scope, xSignal, ySignal); + } + if (qsize) { + addTransforms(globalScope.data, { + type: 'extent', + field: safeFieldName(qsize.name), + signal: names.sizeExtent, + }); + addScales(globalScope.scope, { + name: names.sizeScale, + type: 'pow', + exponent: 0.5, + domain: [0, { signal: `${names.sizeExtent}[1]` }], + range: [0, { signal: names.sizeRange }], + }); + addSignals(globalScope.scope, { + name: names.sizeRange, + update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${scatterSizedDiv}`, + }); + } + addData(globalScope.scope, { + name: names.markData, + source: globalScope.markDataName, + transform: [x, y, z].map(c => { + if (!c || !c.quantitative) + return; + const t = { + type: 'filter', + expr: `isValid(datum[${JSON.stringify(c.name)}])`, + }; + return t; + }).filter(Boolean), + }); + globalScope.setMarkDataName(names.markData); + const globalScales = { showAxes, scales: {} }; + const zValue = z ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z.name)}])` : null; + const sizeValueSignal = qsize ? + `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${SignalNames.PointScale}` + : SignalNames.PointScale; + const update = Object.assign({ height: [ + { + test: testForCollapseSelection(), + value: 0, + }, + { + signal: sizeValueSignal, + }, + ], width: { + signal: sizeValueSignal, + } }, z && { + z: [ + { + test: testForCollapseSelection(), + value: 0, + }, + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}`, + }, + ], + zindex: [ + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}`, + }, + ], + depth: [ + { + test: testForCollapseSelection(), + value: 0, + }, + { + signal: view === '3d' + ? `${SignalNames.ZGrounded} ? ${zValue} : ${sizeValueSignal}` + : '0', + }, + ], + }); + const columnSignals = [ + { + column: x, + xyz: 'x', + scaleName: names.xScale, + domain: backgroundImageExtents ? + { + signal: names.xExtent, + } + : + { + data: globalScope.data.name, + field: safeFieldName(x.name), + }, + reverse: false, + signal: parentScope.sizeSignals.layoutWidth, + }, + { + column: y, + xyz: 'y', + scaleName: names.yScale, + domain: backgroundImageExtents ? + { + signal: names.yExtent, + } + : + { + data: globalScope.data.name, + field: safeFieldName(y.name), + }, + reverse: true, + signal: parentScope.sizeSignals.layoutHeight, + }, + { + column: z, + xyz: 'z', + scaleName: names.zScale, + domain: { + data: globalScope.data.name, + field: z ? safeFieldName(z.name) : null, + }, + reverse: false, + signal: view === '3d' + ? `(${globalScope.zSize}) * ${SignalNames.ZProportion}` + : `10 * ${SignalNames.ZProportion}`, + }, + ]; + columnSignals.forEach(cs => { + const { column, domain, reverse, scaleName, signal, xyz } = cs; + if (!column) + return; + let scale; + if (column.quantitative) { + scale = linearScale(scaleName, domain, [0, { signal }], reverse, false, showAxes); + if (shouldBeIntegralBinStep(column)) { + scale.bins = { step: 1 }; + } + } + else { + scale = pointScale(scaleName, globalScope.data.name, [0, { signal }], column.name, reverse); + } + globalScales.scales[xyz] = [scale]; + }); + const mark = { + name: prefix, + type: 'rect', + from: { data: globalScope.markDataName }, + encode: { update }, + }; + addMarks(globalScope.markGroup, mark); + return { + offsets: { + x: addOffsets(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x.name)}])`), + y: addOffsets(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y.name)}]) - ${sizeValueSignal}`), + h: sizeValueSignal, + w: sizeValueSignal, + }, + sizeSignals: { + layoutHeight: null, + layoutWidth: null, + }, + globalScales, + mark, + encodingRuleMap: { + y: [ + { + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight), + }, + ], + }, + }; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function addZScale(z, zSize, dataName, zScaleName) { + if (z) { + const zRange = [0, { signal: `(${zSize}) * ${SignalNames.ZProportion}` }]; + const scale = z.quantitative + ? + linearScale(zScaleName, { + data: dataName, + field: safeFieldName(z.name), + }, zRange, false, true) + : + pointScale(zScaleName, dataName, zRange, z.name, false); + return scale; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Square extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `square_${this.id}`; + this.names = { + bandWidth: this.getBandWidth(), + maxGroupField: `${p}_max_group`, + maxGroupSignal: `${p}_max_grouping`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + zScale: `scale_${p}_z`, + }; + } + build() { + const { names, prefix, props } = this; + const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + addTransforms(globalScope.data, Object.assign({ type: 'stack', groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sortBy && { + sort: { + field: safeFieldName(sortBy.name), + order: 'ascending', + }, + })); + const { gap, levelSize, size, squaresPerBand } = this.addSignals(); + const heightSignal = { + signal: fillDirection === 'down-right' ? size : levelSize, + }; + const mark = { + name: prefix, + type: 'rect', + from: { + data: globalScope.markDataName, + }, + encode: { + update: Object.assign({ height: collapseYHeight ? + [ + { + test: testForCollapseSelection(), + value: 0, + }, + heightSignal, + ] + : + heightSignal, width: { + signal: fillDirection === 'down-right' ? levelSize : size, + } }, z && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0, + }, + view === '3d' + ? + { + scale: names.zScale, + field: safeFieldName(z.name), + } + : + { + value: 0, + }, + ], + }), + }, + }; + addMarks(globalScope.markGroup, mark); + const { tx, ty } = this.transformXY(gap, levelSize, squaresPerBand); + return Object.assign(Object.assign(Object.assign({}, z && { + globalScales: { + showAxes, + scales: { + z: [zScale], + }, + }, + }), { offsets: { + x: addOffsets(parentScope.offsets.x, tx.expr), + y: addOffsets(parentScope.offsets.y, ty.expr), + h: size, + w: size, + }, mark, sizeSignals: { + layoutHeight: size, + layoutWidth: size, + } }), collapseYHeight && { + encodingRuleMap: { + y: [ + { + test: testForCollapseSelection(), + signal: parentScope.offsets.y, + }, + ], + }, + }); + } + getBandWidth() { + const { offsets } = this.props.parentScope; + switch (this.props.fillDirection) { + case 'down-right': + return offsets.h; + default: + return offsets.w; + } + } + addSignals() { + const { names, props } = this; + const { fillDirection, globalScope, groupings, parentScope } = props; + let { maxGroupedFillSize, maxGroupedUnits } = props; + if (!maxGroupedUnits) { + if (groupings) { + addTransforms(globalScope.data, { + type: 'joinaggregate', + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ['count'], + as: [names.maxGroupField], + }, { + type: 'extent', + field: names.maxGroupField, + signal: names.maxGroupSignal, + }); + maxGroupedUnits = `(${names.maxGroupSignal}[1])`; + } + else { + maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; + } + } + if (!maxGroupedFillSize) { + maxGroupedFillSize = fillDirection === 'down-right' ? parentScope.offsets.w : parentScope.offsets.h; + } + const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; + const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; + const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; + const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; + const levels = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; + const levelSize = `(((${maxGroupedFillSize}) / ${levels}) - ${gap})`; + return { gap, levelSize, size, squaresPerBand }; + } + transformXY(gap, levelSize, squaresPerBand) { + const { names, prefix } = this; + const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; + const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; + const { fillDirection, parentScope } = this.props; + const tx = { + type: 'formula', + expr: null, + as: `${prefix}_${FieldNames.OffsetX}`, + }; + const ty = { + type: 'formula', + expr: null, + as: `${prefix}_${FieldNames.OffsetY}`, + }; + switch (fillDirection) { + case 'down-right': { + tx.expr = `${level} * (${levelSize} + ${gap})`; + ty.expr = compartment; + break; + } + case 'right-up': { + tx.expr = compartment; + ty.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; + break; + } + case 'right-down': + default: { + tx.expr = compartment; + ty.expr = `${level} * (${levelSize} + ${gap})`; + break; + } + } + return { tx, ty }; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Stack extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `stack_${this.id}`; + this.names = { + cube: `${p}_cube`, + globalDataName: `data_${p}_count`, + globalExtent: `${p}_global_extent`, + levelDataName: `data_${p}_level`, + count: `${p}_count`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + sequence: `data_${p}_sequence`, + sides: `${p}_sides`, + size: `${p}_size`, + squared: `${p}_squared`, + maxCount: `${p}_maxCount`, + maxLevels: `${p}_maxLevels`, + zScale: `${p}_zScale`, + }; + } + build() { + const { names, props } = this; + const { globalScope, groupings, parentScope, showAxes, sort } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, { + type: 'joinaggregate', + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ['count'], + as: [names.count], + }, { + type: 'extent', + field: names.count, + signal: names.globalExtent, + }, Object.assign({ type: 'stack', groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sort && { + sort: { + field: safeFieldName(sort.name), + order: 'ascending', + }, + })); + addData(globalScope.scope, { + name: names.sequence, + transform: [ + { + type: 'sequence', + start: 1, + stop: { + signal: `sqrt(${names.globalExtent}[1])`, + }, + }, + { + type: 'formula', + expr: 'datum.data * datum.data', + as: 'squared', + }, + { + type: 'formula', + expr: `ceil(${names.globalExtent}[1] / datum.squared)`, + as: 'maxlevels', + }, + { + type: 'formula', + expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, + as: 'side', + }, + { + type: 'formula', + expr: 'datum.side * datum.maxlevels + datum.maxlevels - 1', + as: 'sidecubeheight', + }, + { + type: 'formula', + expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, + as: 'heightmatch', + }, + { + type: 'collect', + sort: { + field: 'heightmatch', + order: 'ascending', + }, + }, + { + type: 'window', + ops: ['row_number'], + }, + { + type: 'filter', + expr: 'datum.row_number === 1', + }, + ], + }); + addSignals(globalScope.scope, { + name: names.size, + update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`, + }, { + name: names.squared, + update: `data('${names.sequence}')[0].squared`, + }, { + name: names.sides, + update: `sqrt(${names.squared})`, + }, { + name: names.cube, + update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}`, + }, { + name: names.maxLevels, + update: `data('${names.sequence}')[0].maxlevels`, + }, { + name: names.maxCount, + update: `${names.maxLevels} * ${names.squared}`, + }); + const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; + const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; + const cubeX = `(${layerOrdinal} % ${names.sides})`; + const cubeY = `floor(${layerOrdinal} / ${names.sides})`; + const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; + const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; + const offsets = { + x: addOffsets(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), + y: addOffsets(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), + h: names.size, + w: names.size, + }; + const mark = { + type: 'rect', + from: { data: this.names.levelDataName }, + encode: { + update: { + z: { + signal: `${zLevel} * (${names.cube} + 1)`, + }, + height: { + signal: names.cube, + }, + width: { + signal: names.cube, + }, + depth: { + signal: names.cube, + }, + }, + }, + }; + addMarks(globalScope.markGroup, mark); + const zScale = { + type: 'linear', + name: names.zScale, + domain: [ + 0, + { + signal: names.maxCount, + }, + ], + range: [ + 0, + { + signal: `${names.maxLevels} * (${names.cube} + 1) - 1`, + }, + ], + nice: false, + }; + return { + offsets, + mark, + sizeSignals: { + layoutHeight: names.size, + layoutWidth: names.size, + }, + globalScales: { + showAxes, + scales: { + z: [zScale], + }, + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.y, + }], + z: [{ + test: testForCollapseSelection(), + value: 0, + }], + depth: [{ + test: testForCollapseSelection(), + value: 0, + }], + height: [{ + test: testForCollapseSelection(), + value: 0, + }], + }, + }; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Strip extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `strip_${this.id}`; + this.names = { + firstField: `${p}${FieldNames.First}`, + lastField: `${p}${FieldNames.Last}`, + valueField: `${p}${FieldNames.Value}`, + scale: `scale_${p}`, + zScale: `scale_${p}_z`, + }; + } + build() { + const { names, prefix, props } = this; + const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort, sortOrder, parentScope, view, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + const horizontal = orientation === 'horizontal'; + const transform = []; + if (sort) { + transform.push({ + type: 'collect', + sort: { + field: safeFieldName(sort.name), + order: sortOrder, + }, + }); + } + let stackField; + if (size) { + stackField = size.name; + transform.push({ + type: 'filter', + expr: `datum[${JSON.stringify(size.name)}] > 0`, + }); + } + else { + stackField = names.valueField; + transform.push({ + type: 'formula', + expr: '1', + as: stackField, + }); + } + const stackTransform = { + type: 'stack', + field: safeFieldName(stackField), + offset: 'normalize', + as: [names.firstField, names.lastField], + }; + if (groupings.length) { + stackTransform.groupby = getGroupBy(groupings).map(safeFieldName); + } + transform.push(stackTransform); + addTransforms(globalScope.data, ...transform); + const span = [names.lastField, names.firstField].map(f => `datum[${JSON.stringify(f)}]`).join(' - '); + const offsets = { + x: addOffsets(parentScope.offsets.x, horizontal ? + `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` + : + ''), + y: addOffsets(parentScope.offsets.y, horizontal ? + '' + : + `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), + h: horizontal + ? parentScope.offsets.h + : `(${span}) * (${parentScope.offsets.h})`, + w: horizontal + ? `(${span}) * (${parentScope.offsets.w})` + : parentScope.offsets.w, + }; + const mark = { + name: prefix, + type: 'rect', + from: { data: globalScope.markDataName }, + encode: { + update: Object.assign({ height: { + signal: offsets.h, + }, width: { + signal: offsets.w, + } }, z && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0, + }, + view === '3d' + ? + { + scale: names.zScale, + field: safeFieldName(z.name), + } + : + { + value: 0, + }, + ], + }), + }, + }; + addMarks(globalScope.markGroup, mark); + let percentageScale; + if (addPercentageScale) { + percentageScale = [{ + type: 'linear', + name: names.scale, + domain: [0, 100], + range: horizontal ? + [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth, + }, + ] + : + [ + { + signal: parentScope.sizeSignals.layoutHeight, + }, + 0, + ], + }]; + } + return { + globalScales: { + showAxes, + scales: { + x: horizontal ? percentageScale : undefined, + y: horizontal ? undefined : percentageScale, + z: zScale && [zScale], + }, + }, + offsets, + sizeSignals: { + layoutHeight: null, + layoutWidth: null, + }, + mark, + }; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Treemap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `treemap_${this.id}`; + this.names = { + dataName: `data_${p}`, + dataHeightWidth: `data_${p}_hw`, + dataExtents: `data_${p}_extents`, + dataFacet: `data_${p}_facet`, + dataFacetMark: `data_${p}_facetMark`, + fieldChildren: `${p}_children`, + fieldDepth: `${p}_depth`, + fieldX0: `${p}_x0`, + fieldX1: `${p}_x1`, + fieldY0: `${p}_y0`, + fieldY1: `${p}_y1`, + fieldHeight: `${p}_h`, + fieldWidth: `${p}_w`, + heightExtent: `${p}_heightExtent`, + widthExtent: `${p}_widthExtent`, + zScale: `scale_${p}_z`, + }; + } + build() { + const { names, props } = this; + const { globalScope, parentScope, showAxes, treeMapMethod, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + const offsets = { + x: addOffsets(parentScope.offsets.x, fn(names.fieldX0)), + y: addOffsets(parentScope.offsets.y, fn(names.fieldY0)), + h: subtract(names.fieldY1, names.fieldY0), + w: subtract(names.fieldX1, names.fieldX0), + }; + const mark = this.transformedMark(offsets); + addSignals(globalScope.scope, { + name: SignalNames.TreeMapMethod, + value: 'squarify', + bind: { + name: treeMapMethod, + input: 'select', + options: [ + 'squarify', 'binary', + ], + }, + }); + return Object.assign(Object.assign({}, z && { + globalScales: { + showAxes, + scales: { + z: [zScale], + }, + }, + }), { mark, + offsets, sizeSignals: { + layoutHeight: null, + layoutWidth: null, + } }); + } + transformedMark(offsets) { + const { names, props } = this; + const { globalScope, groupings, parentScope } = props; + if (groupings.length) { + //treemap transform can't have it's boundary size grouped, so we need to facet the data. + addData(globalScope.scope, { + name: names.dataHeightWidth, + source: globalScope.markDataName, + transform: [ + { + type: 'formula', + expr: parentScope.offsets.h, + as: names.fieldHeight, + }, + { + type: 'formula', + expr: parentScope.offsets.w, + as: names.fieldWidth, + }, + ], + }); + const treemapData = { + name: names.dataFacetMark, + source: names.dataFacet, + }; + const facets = { + type: 'group', + from: { + facet: { + name: names.dataFacet, + data: names.dataHeightWidth, + groupby: getGroupBy(groupings).map(safeFieldName), + }, + }, + data: [ + { + name: names.dataExtents, + source: names.dataFacet, + transform: [ + { + type: 'extent', + field: names.fieldHeight, + signal: names.heightExtent, + }, + { + type: 'extent', + field: names.fieldWidth, + signal: names.widthExtent, + }, + ], + }, + treemapData, + ], + }; + globalScope.setMarkDataName(names.dataFacetMark); + addMarks(globalScope.markGroup, facets); + //assign new markgroup after adding mark to original group + globalScope.setMarkGroup(facets); + this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); + return this.addMark(offsets, facets, globalScope.markDataName); + } + else { + this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); + return this.addMark(offsets, globalScope.markGroup, globalScope.markDataName); + } + } + addMark(offsets, markParent, markDataName) { + const { names, prefix, props } = this; + const { view, z } = props; + const mark = { + name: prefix, + type: 'rect', + from: { data: markDataName }, + encode: { + update: Object.assign({ width: { + signal: offsets.w, + }, height: { + signal: offsets.h, + } }, z && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0, + }, + view === '3d' + ? + { + scale: names.zScale, + field: safeFieldName(z.name), + } + : + { + value: 0, + }, + ], + }), + }, + }; + addMarks(markParent, mark); + return mark; + } + treemapTransform(treemapData, widthSignal, heightSignal) { + const { names, props } = this; + const { group, size } = props; + addTransforms(treemapData, { + type: 'filter', + expr: `datum[${JSON.stringify(size.name)}] > 0`, + }, { + type: 'nest', + keys: [(group && group.name) || '__NONE__'], + }, { + type: 'treemap', + field: safeFieldName(size.name), + sort: { field: 'value', order: 'descending' }, + round: true, + method: { signal: SignalNames.TreeMapMethod }, + paddingInner: 1, + paddingOuter: 0, + size: [ + { signal: widthSignal }, + { signal: heightSignal }, + ], + as: [ + names.fieldX0, + names.fieldY0, + names.fieldX1, + names.fieldY1, + names.fieldDepth, + names.fieldChildren, + ], + }); + } + } + function fn(n) { + return `datum[${JSON.stringify(n)}]`; + } + function subtract(...fields) { + return fields.map(n => fn(n)).join(' - '); + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class Wrap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `wrap_${this.id}`; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby); + this.names = { + outputData: `data_${p}_out`, + rowColumnDataName: `data_${p}_row_col`, + cellHeight: `${p}_cellHeight`, + cellWidth: `${p}_cellWidth`, + fits: `${p}_fits`, + target: `${p}_target`, + minArea: `${p}_minArea`, + aspect: `${p}_aspect`, + minAspect: `${p}_minAspect`, + idealAspect: `${p}_idealAspect`, + dataLength: `${p}_dataLength`, + rxc0: `${p}_rxc0`, + rxc1: `${p}_rxc1`, + rxc2: `${p}_rxc2`, + rxc: `${p}_rxc`, + growColCount: `${p}_growColCount`, + growCellWidth: `${p}_growCellWidth`, + fitsArea: `${p}_fitsArea`, + colCount: `${p}_colCount`, + }; + } + getGrouping() { + return this.bin.fields; + } + build() { + const { bin, names, prefix, props } = this; + const { axisTextColor, cellTitles, globalScope, parentScope } = props; + let ordinalBinData; + if (bin.native === false) { + addSignals(globalScope.scope, ...bin.signals); + addTransforms(globalScope.data, ...bin.transforms); + addData(globalScope.scope, bin.dataSequence); + addTransforms(bin.dataSequence, { + type: 'formula', + expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, + as: FieldNames.Contains, + }); + ordinalBinData = bin.dataSequence.name; + } + else { + const ord = createOrdinals(globalScope.data.name, prefix, bin.fields, 'ascending'); + addData(globalScope.scope, ord.data); + ordinalBinData = ord.data.name; + } + addData(globalScope.scope, { + name: names.rxc0, + transform: [ + { + type: 'sequence', + start: 1, + stop: { + signal: `ceil(sqrt(${names.dataLength})) + 1`, + }, + }, + { + type: 'formula', + expr: `ceil(${names.dataLength} / datum.data)`, + as: 'complement', + }, + ], + }, { + name: names.rxc1, + source: names.rxc0, + transform: [ + { + type: 'project', + fields: ['data'], + as: ['cols'], + }, + ], + }, { + name: names.rxc2, + source: names.rxc0, + transform: [ + { + type: 'project', + fields: ['complement'], + as: ['cols'], + }, + ], + }, { + name: names.rxc, + source: [names.rxc1, names.rxc2], + transform: [ + { + type: 'formula', + expr: `ceil(${names.dataLength} / datum.cols)`, + as: 'rows', + }, + { + type: 'formula', + expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, + as: 'cellw', + }, + { + type: 'formula', + expr: `datum.cols === 1 ? max(datum.cellw, ${SignalNames.MinCellWidth}) : datum.cellw`, + as: 'cellw', + }, + { + type: 'formula', + expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, + as: 'cellh', + }, + { + type: 'formula', + expr: `datum.rows === 1 ? max(datum.cellh, ${SignalNames.MinCellHeight}) : datum.cellh`, + as: 'cellh', + }, + { + type: 'formula', + expr: `(datum.cellw >= ${SignalNames.MinCellWidth} && datum.cellh >= ${SignalNames.MinCellHeight})`, + as: 'meetsmin', + }, + { + type: 'filter', + expr: 'datum.meetsmin', + }, + { + type: 'formula', + expr: 'datum.cellw / datum.cellh', + as: names.aspect, + }, + { + type: 'formula', + expr: `abs(datum.${names.aspect} - ${names.target})`, + as: names.idealAspect, + }, + { + type: 'formula', + expr: `${names.dataLength} / (datum.cols * datum.rows)`, + as: 'coverage', + }, + { + type: 'collect', + sort: { + field: [names.idealAspect, 'coverage'], + order: ['ascending', 'descending'], + }, + }, + ], + }, { + name: names.rowColumnDataName, + source: ordinalBinData, + transform: [ + { + type: 'formula', + expr: `floor((datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) / ${names.colCount})`, + as: FieldNames.WrapRow, + }, + { + type: 'formula', + expr: `(datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) % ${names.colCount}`, + as: FieldNames.WrapCol, + }, + { + type: 'formula', + expr: serializeAsVegaExpression(bin, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch, + }, + { + type: 'formula', + expr: displayBin(bin), + as: FieldNames.FacetTitle, + }, + ], + }); + const dataOut = { + name: names.outputData, + source: globalScope.data.name, + transform: [ + { + type: 'lookup', + from: names.rowColumnDataName, + key: safeFieldName(bin.fields[0]), + fields: [bin.fields[0]].map(safeFieldName), + values: [FieldNames.WrapRow, FieldNames.WrapCol], + }, + ], + }; + addData(globalScope.scope, dataOut); + globalScope.setMarkDataName(names.outputData); + addSignals(globalScope.scope, { + name: names.minAspect, + update: `${SignalNames.MinCellWidth} / ${SignalNames.MinCellHeight}`, + }, { + name: names.target, + update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}`, + }, { + name: names.minArea, + update: `${SignalNames.MinCellWidth}*${SignalNames.MinCellHeight}`, + }, { + name: names.aspect, + update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}`, + }, { + name: names.dataLength, + update: `data(${JSON.stringify(ordinalBinData)}).length`, + }, { + name: names.growColCount, + update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${SignalNames.MinCellWidth}), 1)`, + }, { + name: names.growCellWidth, + update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}`, + }, { + name: names.fitsArea, + update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))`, + }, { + name: names.fits, + update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0`, + }, { + name: names.colCount, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}`, + }, { + name: names.cellWidth, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}`, + }, { + name: names.cellHeight, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${SignalNames.MinCellHeight}`, + }); + modifySignal(globalScope.signals.plotHeightOut, 'max', `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); + modifySignal(globalScope.signals.plotWidthOut, 'max', `(${names.cellWidth} * ${names.colCount})`); + const signalH = [names.cellHeight, SignalNames.FacetPaddingTop, SignalNames.FacetPaddingBottom].join(' - '); + const signalW = [names.cellWidth, SignalNames.FacetPaddingLeft].join(' - '); + const signalX = addOffsets(parentScope.offsets.x, `datum[${JSON.stringify(FieldNames.WrapCol)}] * ${names.cellWidth}`, SignalNames.FacetPaddingLeft); + const signalY = addOffsets(parentScope.offsets.y, `datum[${JSON.stringify(FieldNames.WrapRow)}] * ${names.cellHeight}`, SignalNames.FacetPaddingTop); + const update = { + height: { + signal: signalH, + }, + width: { + signal: signalW, + }, + x: { + signal: signalX, + }, + y: { + signal: signalY, + }, + }; + const offsets = { + x: signalX, + y: signalY, + h: signalH, + w: signalW, + }; + const group = { + style: 'cell', + name: prefix, + type: 'group', + from: { + data: names.rowColumnDataName, + }, + encode: { update }, + }; + addMarks(globalScope.markGroup, group); + const sizeSignals = { + layoutHeight: `(${names.cellHeight} - ${SignalNames.FacetPaddingTop} - ${SignalNames.FacetPaddingBottom})`, + layoutWidth: `(${names.cellWidth} - ${SignalNames.FacetPaddingLeft})`, + colCount: names.colCount, + rowCount: `ceil(${names.dataLength} / ${names.colCount})`, + }; + if (cellTitles) { + addFacetCellTitles(group, sizeSignals, axisTextColor); + } + return { + facetScope: group, + sizeSignals, + offsets, + }; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + const layoutClasses = { + AggregateContainer, + AggregateSquare, + Band, + Cross, + Scatter, + Square, + Stack, + Strip, + Treemap, + Wrap, + }; + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function getImageMark(backgroundImage, allGlobalScales) { + const xScale = allGlobalScales.filter(s => s.scales.x)[0].scales.x[0]; + const yScale = allGlobalScales.filter(s => s.scales.y)[0].scales.y[0]; + const [xScaleName, yScaleName] = [xScale, yScale].map(s => s.name + (xScale.type === 'band' ? bandScaleLinearSuffix : '')); + return { + type: 'image', + encode: { + update: { + url: { + value: backgroundImage.url, + }, + aspect: { + value: false, + }, + baseline: { + value: 'bottom', + }, + height: { + signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top), + }, + y: { + signal: getScaledValue(yScaleName, backgroundImage.extents.bottom), + }, + width: { + signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left), + }, + x: { + signal: getScaledValue(xScaleName, backgroundImage.extents.left), + }, + }, + }, + }; + } + function getScaledSpan(scaleName, low, high) { + return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; + } + function getScaledValue(scaleName, value) { + return `scale('${scaleName}', ${value})`; + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + class SpecBuilder { + constructor(props, specContext) { + this.props = props; + this.specContext = specContext; + this.globalSignals = { + facetAxesAdjustX: { name: SignalNames.FacetAxesAdjustX, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingLeft.toString() : '0' }, + facetAxesAdjustY: { name: SignalNames.FacetAxesAdjustY, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingBottom.toString() : '0' }, + minCellWidth: { + name: SignalNames.MinCellWidth, + update: `${minFacetWidth}`, + }, + minCellHeight: { name: SignalNames.MinCellHeight, update: `${minFacetHeight}` }, + plotOffsetLeft: { name: SignalNames.PlotOffsetLeft, update: '0' }, + plotOffsetTop: { name: SignalNames.PlotOffsetTop, update: '0' }, + plotOffsetBottom: { name: SignalNames.PlotOffsetBottom, update: '0' }, + plotOffsetRight: { name: SignalNames.PlotOffsetRight, update: '0' }, + plotHeightOut: { name: SignalNames.PlotHeightOut, update: SignalNames.PlotHeightIn }, + plotWidthOut: { name: SignalNames.PlotWidthOut, update: SignalNames.PlotWidthIn }, + }; + } + validate() { + const { specContext } = this; + const { specCapabilities } = this.props; + const { roles } = specCapabilities; + const required = roles.filter(r => { + switch (typeof r.allowNone) { + case 'boolean': + return !r.allowNone; + case 'undefined': + return true; + case 'function': + return !r.allowNone(specContext); + } + }); + const numeric = roles.filter(r => r.excludeCategoric); + const errors = required + .map(r => { + if (specContext.specColumns[r.role]) { + return null; + } + else { + return `Field ${r.role} is required.`; + } + }) + .concat(numeric.map(r => { + if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) { + return `Field ${r.role} must be quantitative.`; + } + else { + return null; + } + })) + .filter(Boolean); + const { backgroundImage } = specContext.insight; + if (backgroundImage && !backgroundImage.extents) { + errors.push('BackgroundImage must have extents.'); + } + return errors; + } + build() { + var _a, _b; + const { globalSignals, specContext } = this; + const { facetLayout, specCapabilities } = this.props; + const { insight, specColumns, specViewOptions } = specContext; + const dataName = 'data_source'; + const { vegaSpec, groupMark } = this.initSpec(dataName); + const { topColorField, colorDataName } = addColor({ + scope: vegaSpec, + dataName, + specContext, + scaleName: ScaleNames.Color, + legendDataName: 'data_legend', + topLookupName: 'data_topcolorlookup', + colorReverseSignalName: SignalNames.ColorReverse, + }); + const globalScope = new GlobalScope({ + dataName: colorDataName, + markGroup: groupMark, + scope: vegaSpec, + signals: globalSignals, + }); + if (facetLayout) { + addSignals(vegaSpec, { + name: SignalNames.FacetPaddingBottom, + update: `${facetLayout.facetPadding.bottom}`, + }, { + name: SignalNames.FacetPaddingLeft, + update: `${facetLayout.facetPadding.left}`, + }, { + name: SignalNames.FacetPaddingTop, + update: `${facetLayout.facetPadding.top}`, + }); + globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; + globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; + } + const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules, } = this.iterateLayouts(globalScope, (i, innerScope) => { + if (facetLayout && i === 0) { + globalScope.zSize = innerScope.offsets.h; + } + }); + if (specResult) { + return specResult; + } + if (allGlobalScales.length > 0) { + const plotHeightOut = globalSignals.plotHeightOut.name; + const plotWidthOut = globalSignals.plotWidthOut.name; + const colTitleScale = { + type: 'linear', + name: 'scale_facet_col_title', + domain: [0, 1], + range: [0, { signal: plotWidthOut }], + }; + const rowTitleScale = { + type: 'linear', + name: 'scale_facet_row_title', + domain: [0, 1], + range: [{ signal: plotHeightOut }, 0], + }; + const facetScope = facetLayout ? firstScope : null; + const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; + //TODO if capability and numeric x,y + if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative)) { + //backgroundGroup.encode.update.fill = { value: 'pink' } + if (!backgroundGroup.marks) { + backgroundGroup.marks = []; + } + const imageMark = getImageMark(insight.backgroundImage, allGlobalScales); + backgroundGroup.marks.unshift(imageMark); + } + const axesScopes = facetLayout ? + addFacetAxesGroupMarks({ + globalScope: globalScope.scope, + plotScope: groupMark, + facetScope, + colTitleScale, + rowTitleScale, + colSeqName: 'data_FacetCellColTitles', + rowSeqName: 'data_FacetCellRowTitles', + }) + : + { + main: [{ + scope: groupMark, + lines: true, + labels: true, + title: true, + }], + }; + addGlobalAxes({ + globalScope, + allGlobalScales, + axisScales: this.props.axisScales, + plotOffsetSignals: { x: globalSignals.plotOffsetLeft, y: globalSignals.plotOffsetBottom }, + axesOffsets: { x: axesOffsetX, y: axesOffsetY }, + axesTitlePadding: facetLayout ? { x: axesTitlePaddingFacetX, y: axesTitlePaddingFacetY } : { x: axesTitlePaddingX, y: axesTitlePaddingY }, + labelBaseline: { x: 'top', y: 'middle' }, + specColumns, + specViewOptions, + axesScopes, + hideZAxis: !!facetLayout, + view: insight.view, + }); + } + //add mark to the final scope + if (finalScope.mark) { + const { update } = finalScope.mark.encode; + const outputDataName = 'output'; + finalScope.mark.from.data = outputDataName; + addData(globalScope.markGroup, { + name: outputDataName, + source: globalScope.markDataName, + transform: [ + { + type: 'formula', + expr: finalScope.offsets.x, + as: FieldNames.OffsetX, + }, + { + type: 'formula', + expr: finalScope.offsets.y, + as: FieldNames.OffsetY, + }, + ], + }); + update.x = { + field: FieldNames.OffsetX, + }; + update.y = { + field: FieldNames.OffsetY, + }; + allEncodingRules.forEach(map => { + for (const key in map) { + if (update[key]) { + const arrIn = map[key]; + if (!Array.isArray(update[key])) { + const value = update[key]; + const arrOut = []; + update[key] = arrOut; + arrIn.forEach(rule => arrOut.push(rule)); + arrOut.push(value); + } + else { + const arrOut = update[key]; + arrIn.forEach(rule => arrOut.unshift(rule)); + } + } + } + }); + update.fill = fill(specContext, topColorField, ScaleNames.Color); + update.opacity = opacity(); + } + return { + specCapabilities, + vegaSpec, + }; + } + initSpec(dataName) { + const { globalSignals } = this; + const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; + const { specContext } = this; + const { insight } = specContext; + const groupMark = { + type: 'group', + //style: 'cell', + encode: { + update: { + x: { signal: `${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, + y: { signal: SignalNames.PlotOffsetTop }, + height: { signal: `${SignalNames.PlotHeightOut} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: `${SignalNames.PlotWidthOut} + ${SignalNames.FacetAxesAdjustX}` }, + }, + }, + }; + const inputDataname = 'input'; + const vegaSpec = { + $schema: 'https://vega.github.io/schema/vega/v5.json', + //style: 'cell', + data: [{ name: inputDataname }, { name: dataName, source: inputDataname, transform: [] }], + marks: [groupMark], + signals: textSignals(specContext, SignalNames.ViewportHeight).concat([ + minCellWidth, + minCellHeight, + { + name: SignalNames.ViewportHeight, + update: `max(${SignalNames.MinCellHeight}, ${insight.size.height})`, + }, + { + name: SignalNames.ViewportWidth, + update: `max(${SignalNames.MinCellWidth}, ${insight.size.width})`, + }, + plotOffsetLeft, + plotOffsetTop, + plotOffsetBottom, + plotOffsetRight, + facetAxesAdjustX, + facetAxesAdjustY, + { + name: SignalNames.PlotHeightIn, + update: `${SignalNames.ViewportHeight} - ${SignalNames.PlotOffsetBottom} + ${SignalNames.FacetAxesAdjustY}`, + }, + { + name: SignalNames.PlotWidthIn, + update: `${SignalNames.ViewportWidth} - ${SignalNames.PlotOffsetLeft} - ${SignalNames.PlotOffsetRight}`, + }, + plotHeightOut, + plotWidthOut, + { + name: 'height', + update: `${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut} + ${SignalNames.PlotOffsetBottom} - ${SignalNames.FacetAxesAdjustY}`, + }, + { + name: 'width', + update: `${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotOffsetRight}`, + }, + ]), + }; + return { vegaSpec, groupMark }; + } + iterateLayouts(globalScope, onLayoutBuild) { + let specResult; + let parentScope = { + sizeSignals: globalScope.sizeSignals, + offsets: globalScope.offsets, + }; + let firstScope; + let childScope; + const groupings = []; + const { layouts, specCapabilities } = this.props; + const allGlobalScales = []; + const allEncodingRules = []; + for (let i = 0; i < layouts.length; i++) { + if (!parentScope) + continue; + const buildProps = { + globalScope, + parentScope, + axesScales: this.props.axisScales, + groupings, + id: i, + }; + const layout = this.createLayout(layouts[i], buildProps); + try { + childScope = layout.build(); + childScope.id = i; + const groupby = layout.getGrouping(); + if (groupby) { + groupings.push({ + id: i, + groupby, + fieldOps: [ + { field: null, op: 'count', as: FieldNames.Count }, + ], + }); + } + const sumOp = layout.getAggregateSumOp(); + if (sumOp) { + groupings[groupings.length - 1].fieldOps.push(sumOp); + } + onLayoutBuild(i, childScope); + } + catch (e) { + specResult = { + errors: [e.stack], + specCapabilities, + vegaSpec: null, + }; + break; + } + if (childScope && childScope.globalScales) { + allGlobalScales.push(childScope.globalScales); + } + if (childScope.encodingRuleMap) { + allEncodingRules.push(childScope.encodingRuleMap); + } + if (i === 0) { + firstScope = childScope; + } + parentScope = childScope; + } + return { firstScope, finalScope: parentScope, specResult, allGlobalScales, allEncodingRules }; + } + createLayout(layoutPair, buildProps) { + const { layoutType, props } = layoutPair; + const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); + const layoutClass = layoutClasses[layoutType]; + const layout = new layoutClass(layoutBuildProps); + layout.id = buildProps.id; + return layout; + } + } + + /*! + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + */ + function build(specContext, currData) { + const { specColumns } = specContext; + const columns = [ + specColumns.color, + specColumns.facet, + specColumns.facetV, + specColumns.group, + specColumns.size, + specColumns.sort, + specColumns.x, + specColumns.y, + specColumns.z, + ]; + inferAll(columns, currData); + const specBuilderProps = getSpecBuilderPropsForChart(specContext); + const specBuilder = new SpecBuilder(specBuilderProps, specContext); + let specResult; + if (specBuilder) { + try { + const errors = specBuilder.validate(); + if (errors.length) { + specResult = { + errors, + specCapabilities: specBuilderProps.specCapabilities, + vegaSpec: null, + }; + } + else { + specResult = specBuilder.build(); + } + } + catch (e) { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [e.stack], + }; + } + if (!specResult.errors) { + const data0 = specResult.vegaSpec.data[0]; + data0.values = currData; + } + } + else { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [`could not build spec for ${specContext.insight.chart}`], + }; + } + return specResult; + } + + exports.ColorScaleNone = ColorScaleNone; + exports.FieldNames = FieldNames; + exports.Other = Other; + exports.ScaleNames = ScaleNames; + exports.SignalNames = SignalNames; + exports.build = build; + exports.getColumnsFromData = getColumnsFromData; + exports.getSpecColumns = getSpecColumns; + exports.getStats = getStats; + exports.inferAll = inferAll; + +})); diff --git a/docs/tests/sanddance-specs/v2/specs/column-categoric.json b/docs/tests/sanddance-specs/v2/specs/column-categoric.json new file mode 100644 index 000000000..8f20dfb30 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/column-categoric.json @@ -0,0 +1,14 @@ +{ + "columns": { + "x": "State", + "color": "Obama", + "z": "Education" + }, + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "barchartV", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/column-facet-cross.json b/docs/tests/sanddance-specs/v2/specs/column-facet-cross.json new file mode 100644 index 000000000..5709f81e9 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/column-facet-cross.json @@ -0,0 +1,17 @@ +{ + "columns": { + "x": "Income", + "color": "Obama", + "z": "Education", + "facet": "MedAge", + "facetV": "Income" + }, + "facetStyle": "cross", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "barchartV", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/column-facet-wrap.json b/docs/tests/sanddance-specs/v2/specs/column-facet-wrap.json new file mode 100644 index 000000000..69ee2204e --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/column-facet-wrap.json @@ -0,0 +1,16 @@ +{ + "columns": { + "x": "Income", + "color": "Obama", + "z": "Education", + "facet": "MedAge" + }, + "facetStyle": "wrap", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "barchartV", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/column-sum-strip-pct.json b/docs/tests/sanddance-specs/v2/specs/column-sum-strip-pct.json new file mode 100644 index 000000000..eacab9c51 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/column-sum-strip-pct.json @@ -0,0 +1,16 @@ +{ + "columns": { + "x": "Income", + "color": "Obama", + "z": "Education", + "size": "TotalPop" + }, + "totalStyle": "sum-strip-percent", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "barchartV", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/column-sum-strip.json b/docs/tests/sanddance-specs/v2/specs/column-sum-strip.json new file mode 100644 index 000000000..bf7c5c666 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/column-sum-strip.json @@ -0,0 +1,16 @@ +{ + "columns": { + "x": "Income", + "color": "Obama", + "z": "Education", + "size": "TotalPop" + }, + "totalStyle": "sum-strip", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "barchartV", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/column-sum-treemap.json b/docs/tests/sanddance-specs/v2/specs/column-sum-treemap.json new file mode 100644 index 000000000..65a891ec1 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/column-sum-treemap.json @@ -0,0 +1,16 @@ +{ + "columns": { + "x": "Income", + "color": "Obama", + "z": "Education", + "size": "TotalPop" + }, + "totalStyle": "sum-treemap", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "barchartV", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/column.json b/docs/tests/sanddance-specs/v2/specs/column.json new file mode 100644 index 000000000..5a5f5838f --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/column.json @@ -0,0 +1,14 @@ +{ + "columns": { + "x": "Income", + "color": "Obama", + "z": "Education" + }, + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "barchartV", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/density-facet-cross.json b/docs/tests/sanddance-specs/v2/specs/density-facet-cross.json new file mode 100644 index 000000000..314f02b77 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/density-facet-cross.json @@ -0,0 +1,18 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "facet": "MedAge", + "facetV": "Income" + }, + "facetStyle": "cross", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "density", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/density-facet-wrap.json b/docs/tests/sanddance-specs/v2/specs/density-facet-wrap.json new file mode 100644 index 000000000..ed14c6ada --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/density-facet-wrap.json @@ -0,0 +1,17 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "facet": "MedAge" + }, + "facetStyle": "wrap", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "density", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/density-treemap.json b/docs/tests/sanddance-specs/v2/specs/density-treemap.json new file mode 100644 index 000000000..92567e2a3 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/density-treemap.json @@ -0,0 +1,19 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "sort": "State", + "size": "TotalPop" + }, + "facetStyle": "wrap", + "scheme": "redblue", + "totalStyle": "sum-treemap", + "size": { + "height": 600, + "width": 800 + }, + "chart": "density", + "view": "2d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/density.json b/docs/tests/sanddance-specs/v2/specs/density.json new file mode 100644 index 000000000..45a9b771e --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/density.json @@ -0,0 +1,15 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education" + }, + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "density", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/scatter-facet-cross.json b/docs/tests/sanddance-specs/v2/specs/scatter-facet-cross.json new file mode 100644 index 000000000..6e1c18392 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/scatter-facet-cross.json @@ -0,0 +1,18 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "facet": "MedAge", + "facetV": "Income" + }, + "facetStyle": "cross", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "scatterplot", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/scatter-facet-wrap-with-image.json b/docs/tests/sanddance-specs/v2/specs/scatter-facet-wrap-with-image.json new file mode 100644 index 000000000..e7dc76e62 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/scatter-facet-wrap-with-image.json @@ -0,0 +1,26 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "facet": "MedAge" + }, + "facetStyle": "wrap", + "scheme": "redblue", + "backgroundImage": { + "url": "img/usa-counties-equirectangular.png", + "extents": { + "bottom": 24, + "left": -125.5, + "right": -66.5, + "top": 49.75 + } + }, + "size": { + "height": 784, + "width": 1417 + }, + "chart": "scatterplot", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/scatter-facet-wrap.json b/docs/tests/sanddance-specs/v2/specs/scatter-facet-wrap.json new file mode 100644 index 000000000..ce7269303 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/scatter-facet-wrap.json @@ -0,0 +1,17 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "facet": "MedAge" + }, + "facetStyle": "wrap", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "scatterplot", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/scatter-with-image.json b/docs/tests/sanddance-specs/v2/specs/scatter-with-image.json new file mode 100644 index 000000000..49151aaf1 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/scatter-with-image.json @@ -0,0 +1,24 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education" + }, + "scheme": "redblue", + "backgroundImage": { + "url": "img/usa-counties-equirectangular.png", + "extents": { + "bottom": 24, + "left": -125.5, + "right": -66.5, + "top": 49.75 + } + }, + "size": { + "height": 800, + "width": 1200 + }, + "chart": "scatterplot", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/scatter.json b/docs/tests/sanddance-specs/v2/specs/scatter.json new file mode 100644 index 000000000..539fce9a3 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/scatter.json @@ -0,0 +1,15 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Income", + "z": "Income" + }, + "scheme": "redyellowgreen", + "size": { + "height": 600, + "width": 800 + }, + "chart": "scatterplot", + "view": "2d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/stacks-facet-cross.json b/docs/tests/sanddance-specs/v2/specs/stacks-facet-cross.json new file mode 100644 index 000000000..8279ec478 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/stacks-facet-cross.json @@ -0,0 +1,19 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "sort": "State", + "facet": "MedAge", + "facetV": "Income" + }, + "facetStyle": "cross", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "stacks", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/stacks-facet-wrap-with-image.json b/docs/tests/sanddance-specs/v2/specs/stacks-facet-wrap-with-image.json new file mode 100644 index 000000000..966c29b24 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/stacks-facet-wrap-with-image.json @@ -0,0 +1,27 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "sort": "State", + "facet": "MedAge" + }, + "facetStyle": "wrap", + "scheme": "redblue", + "backgroundImage": { + "url": "img/usa-counties-equirectangular.png", + "extents": { + "bottom": 24, + "left": -125.5, + "right": -66.5, + "top": 49.75 + } + }, + "size": { + "height": 600, + "width": 800 + }, + "chart": "stacks", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/stacks-facet-wrap.json b/docs/tests/sanddance-specs/v2/specs/stacks-facet-wrap.json new file mode 100644 index 000000000..870cf4670 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/stacks-facet-wrap.json @@ -0,0 +1,18 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "sort": "State", + "facet": "MedAge" + }, + "facetStyle": "wrap", + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "stacks", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/stacks-with-image.json b/docs/tests/sanddance-specs/v2/specs/stacks-with-image.json new file mode 100644 index 000000000..fcbf3e466 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/stacks-with-image.json @@ -0,0 +1,25 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "sort": "State" + }, + "scheme": "redblue", + "backgroundImage": { + "url": "img/usa-counties-equirectangular.png", + "extents": { + "bottom": 24, + "left": -125.5, + "right": -66.5, + "top": 49.75 + } + }, + "size": { + "height": 600, + "width": 800 + }, + "chart": "stacks", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/sanddance-specs/v2/specs/stacks.json b/docs/tests/sanddance-specs/v2/specs/stacks.json new file mode 100644 index 000000000..8c6592989 --- /dev/null +++ b/docs/tests/sanddance-specs/v2/specs/stacks.json @@ -0,0 +1,16 @@ +{ + "columns": { + "x": "Longitude", + "y": "Latitude", + "color": "Obama", + "z": "Education", + "sort": "State" + }, + "scheme": "redblue", + "size": { + "height": 600, + "width": 800 + }, + "chart": "stacks", + "view": "3d" +} \ No newline at end of file diff --git a/docs/tests/v4/es6/js/sanddance-app.js b/docs/tests/v4/es6/js/sanddance-app.js index bfeb0fd18..cdba06e5a 100644 --- a/docs/tests/v4/es6/js/sanddance-app.js +++ b/docs/tests/v4/es6/js/sanddance-app.js @@ -1,17600 +1,8447 @@ -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles - -(function ( - modules, - entry, - mainEntry, - parcelRequireName, - externals, - distDir, - publicUrl, - devServer -) { - /* eslint-disable no-undef */ - var globalObject = - typeof globalThis !== 'undefined' - ? globalThis - : typeof self !== 'undefined' - ? self - : typeof window !== 'undefined' - ? window - : typeof global !== 'undefined' - ? global - : {}; - /* eslint-enable no-undef */ - - // Save the require from previous bundle to this closure if any - var previousRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - - var importMap = previousRequire.i || {}; - var cache = previousRequire.cache || {}; - // Do not use `require` to prevent Webpack from trying to bundle this call - var nodeRequire = - typeof module !== 'undefined' && - typeof module.require === 'function' && - module.require.bind(module); - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - if (externals[name]) { - return externals[name]; - } - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error("Cannot find module '" + name + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = (cache[name] = new newRequire.Module(name)); - - modules[name][0].call( - module.exports, - localRequire, - module, - module.exports, - globalObject - ); +(function(global2, factory) { + typeof exports === "object" && typeof module !== "undefined" ? factory(require("react"), require("react-dom")) : typeof define === "function" && define.amd ? define(["react", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.React, global2.ReactDOM)); +})(this, (function(React, ReactDOM) { + "use strict"; + function _interopNamespaceDefault(e) { + const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } }); + if (e) { + for (const k in e) { + if (k !== "default") { + const d2 = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d2.get ? d2 : { + enumerable: true, + get: () => e[k] + }); + } + } } - - return cache[name].exports; - - function localRequire(x) { - var res = localRequire.resolve(x); - return res === false ? {} : newRequire(res); - } - - function resolve(x) { - var id = modules[name][1][x]; - return id != null ? id : x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.require = nodeRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.distDir = distDir; - newRequire.publicUrl = publicUrl; - newRequire.devServer = devServer; - newRequire.i = importMap; - newRequire.register = function (id, exports) { - modules[id] = [ - function (require, module) { - module.exports = exports; - }, - {}, - ]; + n.default = e; + return Object.freeze(n); + } + const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React); + const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM); + const FieldNames = { + Active: "__SandDance__Active", + Collapsed: "__SandDance__Collapsed", + Contains: "__SandDance__Contains", + Count: "__SandDance__Count", + Sum: "__SandDance__Sum", + SumOfCount: "__SandDance__CountSum", + SumOfSum: "__SandDance__SumSum", + Selected: "__SandDance__Selected", + First: "__SandDance__First", + Last: "__SandDance__Last", + Top: "__SandDance__Top", + TopColor: "__SandDance__TopColor", + TopIndex: "__SandDance__TopIndex", + PowerBISelectionId: "__SandDance__PowerBISelectionId", + FacetSearch: "__SandDance__FacetSearch", + FacetTitle: "__SandDance__FacetTitle", + Ordinal: "__SandDance__Ordinal", + WrapCol: "__SandDance__WrapCol", + WrapRow: "__SandDance__WrapRow", + Value: "__SandDance__Value", + OffsetX: "__SandDance__X", + OffsetY: "__SandDance__Y", + OffsetHeight: "__SandDance__H", + OffsetWidth: "__SandDance__W" }; - - // Only insert newRequire.load when it is actually used. - // The code in this file is linted against ES5, so dynamic import is not allowed. - // INSERT_LOAD_HERE - - Object.defineProperty(newRequire, 'root', { - get: function () { - return globalObject[parcelRequireName]; - }, - }); - - globalObject[parcelRequireName] = newRequire; - - for (var i = 0; i < entry.length; i++) { - newRequire(entry[i]); - } - - if (mainEntry) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(mainEntry); - - // CommonJS - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === 'function' && define.amd) { - define(function () { - return mainExports; - }); + const ScaleNames = { + Color: "scale_color", + X: "scale_x", + Y: "scale_y", + Z: "scale_z" + }; + const SignalNames = { + ViewportWidth: "ViewportWidth", + ViewportHeight: "ViewportHeight", + MinCellWidth: "MinCellWidth", + MinCellHeight: "MinCellHeight", + PlotOffsetLeft: "PlotOffsetLeft", + PlotOffsetTop: "PlotOffsetTop", + PlotOffsetBottom: "PlotOffsetBottom", + PlotOffsetRight: "PlotOffsetRight", + PlotHeightIn: "PlotHeightIn", + PlotWidthIn: "PlotWidthIn", + PlotHeightOut: "PlotHeightOut", + PlotWidthOut: "PlotWidthOut", + ColorBinCount: "RoleColor_BinCountSignal", + ColorReverse: "RoleColor_ReverseSignal", + FacetAxesAdjustX: "RoleFacet_AxesAdjustSignalX", + FacetAxesAdjustY: "RoleFacet_AxesAdjustSignalY", + FacetBins: "RoleFacet_BinsSignal", + FacetVBins: "RoleFacetV_BinsSignal", + FacetPaddingTop: "FacetPaddingTop", + FacetPaddingBottom: "FacetPaddingBottom", + FacetPaddingLeft: "FacetPaddingLeft", + MarkOpacity: "Mark_OpacitySignal", + PointScale: "Chart_PointScaleSignal", + TextAngleX: "Text_AngleXSignal", + TextAngleY: "Text_AngleYSignal", + TextScale: "Text_ScaleSignal", + TextSize: "Text_SizeSignal", + TextTitleSize: "Text_TitleSizeSignal", + TreeMapMethod: "Chart_TreeMapMethodSignal", + XBins: "RoleX_BinsSignal", + YBins: "RoleY_BinsSignal", + ZHeight: "RoleZ_HeightSignal", + ZGrounded: "RoleZ_Grounded", + ZProportion: "RoleZ_ProportionSignal" + }; + const Other = "__Other"; + const ColorScaleNone = "none"; + const defaultBins = 10; + const maxbins = 100; + const minBarBandWidth = 15; + const minFacetWidth = 140; + const minFacetHeight = 180; + const facetPaddingLeft = 40; + const facetPaddingTop = 40; + const facetPaddingBottom = 40; + const facetPaddingRight = 40; + const axesLabelLimit = 100; + const axesTitleLimit = 100; + const axesTitlePaddingX = 30; + const axesTitlePaddingY = 60; + const axesTitlePaddingFacetX = 69; + const axesTitlePaddingFacetY = 92; + const axesOffsetX = 120; + const axesOffsetY = 120; + const scatterSizedDiv = 20; + const debounce$1 = 250; + function allowNoneForSize(specContext) { + switch (specContext.insight.totalStyle) { + case "sum-strip": + case "sum-strip-percent": + case "sum-treemap": + return false; + default: + return true; } } -})({"bxQeC":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var _base = require("./base"); -var _fluentUIComponents = require("./fluentUIComponents"); -var _sanddanceApp = require("./sanddanceApp"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -var _reactDom = require("react-dom"); -var _vega = require("vega"); -(0, _base.use)((0, _fluentUIComponents.fluentUI), _vega); -const staticContent = Array.from(document.querySelectorAll('a.sanddance-app-static-content')); -const dataSets = staticContent.filter((f)=>f.id).map((n)=>{ - const forData = staticContent.filter((f)=>f.dataset['for'] === n.id)[0]; - return { - dataSourceType: 'sample', - id: n.id, - displayName: n.dataset['displayName'], - dataUrl: n.href, - type: n.dataset['type'], - snapshotsUrl: forData ? forData.href : null - }; -}); -let explorer; -const undef = "undefined"; -_reactDom.render(_react.createElement((0, _sanddanceApp.SandDanceApp), { - setTheme: typeof setTheme !== undef && setTheme, - darkTheme: typeof darkTheme !== undef && darkTheme, - insights: typeof insights !== undef && insights, - initialOptions: typeof options !== undef && options, - themeColors: typeof themeColors !== undef && themeColors, - dataSources: dataSets, - mounted: (app)=>{ - explorer = app.explorer; - } -}), document.getElementById('app')); -const z = 'z'.charCodeAt(0); -const Z = 'Z'.charCodeAt(0); -document.onkeyup = (e)=>{ - //look for CTRL Z or CTRL SHIFT Z - if (e.ctrlKey && (e.keyCode === z || e.keyCode === Z)) { - if (e.shiftKey) explorer.redo(); - else explorer.undo(); - } -}; -window['SandDanceApp'] = { - explorer, - SandDanceExplorer: _sanddanceExplorer -}; - -},{"./base":"4CyyC","./fluentUIComponents":"dtgCh","./sanddanceApp":"7pzEo","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","react-dom":"1a3X3","vega":"75mIL"}],"4CyyC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param fluentUI FluentUI React library. - * @param vega Vega library. - * @param deck @deck.gl/core library. - * @param layers @deck.gl/layers library. - * @param luma @luma.gl/core library. - */ parcelHelpers.export(exports, "use", ()=>use); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -var _reactDom = require("react-dom"); -const base = { - fluentUI: null -}; -function use(fluentUI, vega) { - _sanddanceExplorer.use(fluentUI, _react, _reactDom, vega); - base.fluentUI = fluentUI; -} - -},{"@msrvida/sanddance-explorer":"cEojs","react":"jGrId","react-dom":"1a3X3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEojs":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getEmbedHTML", ()=>(0, _dataExporter.getEmbedHTML)); -parcelHelpers.export(exports, "SideTabId", ()=>(0, _interfaces.SideTabId)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "capabilities", ()=>(0, _canvas.capabilities)); -parcelHelpers.export(exports, "getColorSettingsFromThemePalette", ()=>(0, _themes.getColorSettingsFromThemePalette)); -parcelHelpers.export(exports, "themePalettes", ()=>(0, _themes.themePalettes)); -parcelHelpers.export(exports, "SandDance", ()=>(0, _sanddanceReact.SandDance)); -parcelHelpers.export(exports, "util", ()=>(0, _sanddanceReact.util)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "controls", ()=>_controls); -parcelHelpers.export(exports, "SandDanceReact", ()=>_sanddanceReact); -var _controls = require("./controls"); -var _dataExporter = require("./controls/dataExporter"); -var _interfaces = require("./interfaces"); -var _base = require("./base"); -var _canvas = require("./canvas"); -var _themes = require("./themes"); -var _explorer = require("./explorer"); -parcelHelpers.exportAll(_explorer, exports); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _version = require("./version"); - -},{"./controls":"j1PTB","./controls/dataExporter":"7XSio","./interfaces":"k3BwW","./base":"3TPz5","./canvas":"55nq5","./themes":"g7FJh","./explorer":"cQRoj","@msrvida/sanddance-react":"lPyTZ","./version":"CFT5Q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j1PTB":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _dialog = require("./dialog"); -parcelHelpers.exportAll(_dialog, exports); - -},{"./dialog":"OQi9w","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"OQi9w":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dialog", ()=>Dialog); -var _base = require("../base"); -var _language = require("../language"); -function Dialog(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Dialog, Object.assign({}, props, { - dialogContentProps: Object.assign({ - type: (0, _base.base).fluentUI.DialogType.normal, - title: props.title - }, props.dialogContentProps) - }), (0, _base.base).react.createElement("div", { - onKeyUp: (e)=>{ - e.nativeEvent.stopImmediatePropagation(); - } - }, props.children), (0, _base.base).react.createElement((0, _base.base).fluentUI.DialogFooter, null, props.buttons, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - iconProps: { - iconName: 'Cancel' - }, - onClick: props.onDismiss, - text: (0, _language.strings).buttonClose - }))); -} - -},{"../base":"3TPz5","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3TPz5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param fluentUI FluentUI React library. - * @param react React library. - * @param vega Vega library. - * @param deck @deck.gl/core library. - * @param layers @deck.gl/layers library. - * @param luma @luma.gl/core library. - */ parcelHelpers.export(exports, "use", ()=>use); -var _backgroundImageEditor = require("./dialogs/backgroundImageEditor"); -var _clickableTextLayer = require("./clickableTextLayer"); -var _columnTypeChanger = require("./controls/columnTypeChanger"); -var _dataExporter = require("./controls/dataExporter"); -var _chart = require("./dialogs/chart"); -var _search = require("./dialogs/search"); -var _settings = require("./dialogs/settings"); -var _snapshotEditor = require("./dialogs/snapshotEditor"); -var _snapshots = require("./dialogs/snapshots"); -var _transition = require("./dialogs/transition"); -var _explorer = require("./explorer"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _renderer = require("./controls/renderer"); -const base = { - fluentUI: null, - react: null, - reactDOM: null -}; -function use(fluentUI, react, reactDOM, vega) { - (0, _sanddanceReact.use)(react, reactDOM, vega); - base.fluentUI = fluentUI; - base.react = react; - base.reactDOM = reactDOM; - //inform React that we are using a dynamic base class - (0, _backgroundImageEditor.BackgroundImageEditor).prototype = react.Component.prototype; - (0, _chart.Chart).prototype = react.Component.prototype; - (0, _columnTypeChanger.ColumnTypeChanger).prototype = react.Component.prototype; - (0, _dataExporter.DataExportPicker).prototype = react.Component.prototype; - (0, _explorer.Explorer).prototype = react.Component.prototype; - (0, _clickableTextLayer.PositionedColumnMap).prototype = react.Component.prototype; - (0, _renderer.Renderer).prototype = react.Component.prototype; - (0, _search.Search).prototype = react.Component.prototype; - (0, _snapshotEditor.SnapshotEditor).prototype = react.Component.prototype; - (0, _snapshots.Snapshots).prototype = react.Component.prototype; - (0, _settings.Settings).prototype = react.Component.prototype; - (0, _transition.TransitionEditor).prototype = react.Component.prototype; -} - -},{"./dialogs/backgroundImageEditor":"hTdbK","./clickableTextLayer":"2iqEH","./controls/columnTypeChanger":"7dBYz","./controls/dataExporter":"7XSio","./dialogs/chart":"dwBpS","./dialogs/search":"eXzPo","./dialogs/settings":"2xbhO","./dialogs/snapshotEditor":"g29jp","./dialogs/snapshots":"sTI5I","./dialogs/transition":"3tDGl","./explorer":"cQRoj","@msrvida/sanddance-react":"lPyTZ","./controls/renderer":"4tj9B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hTdbK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BackgroundImageEditor", ()=>BackgroundImageEditor); -parcelHelpers.export(exports, "setInsightBackgroundImage", ()=>setInsightBackgroundImage); -var _base = require("../base"); -var _dialog = require("../controls/dialog"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -var _iconButton = require("../controls/iconButton"); -var _columns = require("../columns"); -function _BackgroundImageEditor(_props) { - class __BackgroundImageEditor extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - backgroundImageColumnBounds: [], - readyToApply: false, - hidden: true - }; - } - show(insightColumns) { - const { explorer, quantitativeColumns } = this.props; - if (!quantitativeColumns.length) //TODO show error - return; - const xCol = quantitativeColumns.filter((c)=>c.name === insightColumns.x)[0]; - const yCol = quantitativeColumns.filter((c)=>c.name === insightColumns.y)[0]; - let backgroundImageColumnBounds; - if (explorer.imageHolder.backgroundImageColumnBounds.length < quantitativeColumns.length * 4) backgroundImageColumnBounds = (0, _columns.getBackgroundImageColumnBounds)(explorer.state.dataContent.columns); - else backgroundImageColumnBounds = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(explorer.imageHolder.backgroundImageColumnBounds); - const newState = { - hidden: false, - xCol, - yCol, - backgroundImageColumnBounds - }; - !xCol || yCol; - this.setState(newState); - this.checkReady(); - } - render() { - const { props, state } = this; - const { explorer } = props; - return (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: state.hidden, - onDismiss: ()=>this.setState({ - hidden: true, - backgroundImageFileFormatError: null - }), - modalProps: { - containerClassName: 'sanddance-background-image-dialog' - }, - dialogContentProps: { - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelBackgroundImageDialogTitle, - subText: (0, _language.strings).labelBackgroundImageSubtext - }, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 'apply', - iconProps: { - iconName: 'Photo2Add' - }, - text: (0, _language.strings).buttonApply, - onClick: ()=>this.applyImage(true), - disabled: !state.readyToApply - }) - ] - }, explorer.imageHolder.img ? (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, (0, _base.base).react.createElement("img", { - src: explorer.imageHolder.img.src - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: 'remove', - iconProps: { - iconName: 'Photo2Remove' - }, - text: (0, _language.strings).buttonRemove, - onClick: ()=>{ - explorer.imageHolder.img = null; - this.applyImage(false); - this.setState({ - readyToApply: false - }); - } - })) : (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, (0, _base.base).react.createElement("input", { - type: "file", - onChange: (e)=>this.readBackgroundImage(e) - }), state.backgroundImageFileFormatError && (0, _base.base).react.createElement("div", { - className: "error" - }, state.backgroundImageFileFormatError)), this.inputForColumn(state.xCol, 'X axis', 'x', (0, _language.strings).labelBackgroundLeft, (0, _language.strings).labelBackgroundRight), this.inputForColumn(state.yCol, 'Y axis', 'y', (0, _language.strings).labelBackgroundBottom, (0, _language.strings).labelBackgroundTop)); - } - inputForColumn(column, label, dimension, minLabel, maxLabel) { - const { props, state } = this; - const fieldInput = (label, dataExtent, getDefault)=>{ - const bounds = state.backgroundImageColumnBounds.filter((b)=>b.columnName === (column === null || column === void 0 ? void 0 : column.name) && b.dimension === dimension && b.dataExtent === dataExtent)[0]; - if (!bounds) return null; - return (0, _base.base).react.createElement("div", { - className: 'axis-bound-field' - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: label, - onChange: (e, value)=>{ - const numericValue = +value; - bounds.stringValue = value; - bounds.valid = !(!value || isNaN(numericValue)); - if (bounds.valid) bounds.numericValue = numericValue; - this.setState({ - backgroundImageColumnBounds: [ - ...state.backgroundImageColumnBounds - ] - }); - this.checkReady(); - }, - value: bounds.stringValue, - errorMessage: bounds.valid ? null : (0, _language.strings).errorNumericValue, - onRenderSuffix: (a)=>{ - return (0, _base.base).react.createElement((0, _iconButton.IconButton), { - iconName: 'ScaleVolume', - themePalette: props.themePalette, - title: 'Use data extent' //TODO - , - onClick: ()=>{ - bounds.numericValue = getDefault(); - bounds.stringValue = bounds.numericValue.toString(); - bounds.valid = true; - this.setState({ - backgroundImageColumnBounds: [ - ...state.backgroundImageColumnBounds - ] - }); - this.checkReady(); - } - }); - } - })); - }; - return (0, _base.base).react.createElement("div", { - className: 'axis-bounds' - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Dropdown, { - label: label, - options: props.quantitativeColumns.map((c)=>{ - const option = { - key: c.name, - text: c.name - }; - return option; - }), - onChange: (e, o)=>{ - const newState = { - readyToApply: false - }; - const newColumn = props.quantitativeColumns.filter((c)=>c.name === o.key)[0]; - switch(dimension){ - case 'x': - newState.xCol = newColumn; - break; - case 'y': - newState.yCol = newColumn; - break; - } - this.setState(newState); - this.checkReady(); - }, - selectedKey: column === null || column === void 0 ? void 0 : column.name - }), (0, _base.base).react.createElement("div", { - className: 'axis-bound-fields' - }, fieldInput(minLabel, 'min', ()=>column.stats.min), fieldInput(maxLabel, 'max', ()=>column.stats.max))); - } - readBackgroundImage(e) { - if (e.target.files) { - const file = e.target.files[0]; - const reader = new FileReader(); - reader.onload = ()=>{ - const img = new Image(); - img.onerror = ()=>{ - this.setState({ - backgroundImageFileFormatError: (0, _language.strings).errorImageFormat - }); - }; - img.onload = ()=>{ - //success - const { src, height, width } = img; - this.props.explorer.imageHolder.img = { - src, - height, - width - }; - this.checkReady(); - }; - try { - img.src = reader.result; - } catch (e) { - this.setState({ - backgroundImageFileFormatError: (0, _language.strings).errorImageFormat - }); - } - }; - reader.readAsDataURL(file); - } - } - checkReady() { - //allow state to resolve - setTimeout(()=>{ - const { state, props } = this; - const { explorer } = props; - const { backgroundImageColumnBounds } = state; - let valid = true; - const dimensions = [ - 'x', - 'y' - ]; - const dataExtents = [ - 'max', - 'min' - ]; - [ - state.xCol, - state.yCol - ].forEach((c)=>dimensions.forEach((dimension)=>dataExtents.forEach((dataExtent)=>{ - const bounds = backgroundImageColumnBounds.filter((b)=>b.columnName === c.name && b.dataExtent === dataExtent && b.dimension === dimension)[0]; - if (!bounds.valid) valid = false; - }))); - const readyToApply = explorer.imageHolder.img && valid; //TODO if not already applied - this.setState({ - readyToApply - }); - }, 0); + function barchartH(specContext) { + var _a2, _b2, _c2, _d2; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes + }; + const x2 = { title: null }; + const axisScales = { + x: x2, + y: { title: (_a2 = specColumns.y) === null || _a2 === void 0 ? void 0 : _a2.name }, + z: { title: (_b2 = specColumns.z) === null || _b2 === void 0 ? void 0 : _b2.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight; + if (totalStyle === "sum-strip-percent") { + x2.aggregate = "percent"; + x2.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "left", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + x2.aggregate = "sum"; + x2.title = language.sum; + const treemapProps = { + corner: "top-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + x2.aggregate = "sum"; + x2.title = language.sum; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + x2.aggregate = "count"; + x2.title = language.count; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; } - applyImage(showBackgroundImage) { - const { props, state } = this; - const { explorer } = props; - explorer.imageHolder.showBackgroundImage = showBackgroundImage; - explorer.imageHolder.backgroundImageColumnBounds = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(state.backgroundImageColumnBounds); - if (showBackgroundImage) switch(props.chart){ - case 'density': - case 'scatterplot': - case 'stacks': - break; - default: - //TODO use xcol & ycol - //make sure x & y are numeric - explorer.changeChartType('scatterplot'); - return; - } - explorer.forceUpdate(); + default: { + x2.aggregate = "count"; + x2.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "down-right", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; } + } } - return new __BackgroundImageEditor(_props); -} -const BackgroundImageEditor = _BackgroundImageEditor; -function setInsightBackgroundImage(insight, imageHolder, columns) { - if (!imageHolder.showBackgroundImage || !columns.x || !columns.y) return; - const { backgroundImageColumnBounds } = imageHolder; - const xBounds = backgroundImageColumnBounds.filter((b)=>b.columnName === columns.x && b.dimension === 'x'); - const yBounds = backgroundImageColumnBounds.filter((b)=>b.columnName === columns.y && b.dimension === 'y'); - if (!xBounds.length || !yBounds.length) return; - const allBounds = [ - ...xBounds, - ...yBounds - ]; - for(let i = 0; i < allBounds.length; i++){ - if (!allBounds[i].valid) return; - } - const bottom = yBounds.filter((b)=>b.dataExtent === 'min')[0]; - const left = xBounds.filter((b)=>b.dataExtent === 'min')[0]; - const right = xBounds.filter((b)=>b.dataExtent === 'max')[0]; - const top = yBounds.filter((b)=>b.dataExtent === 'max')[0]; - const all = [ - bottom, - left, - right, - top - ]; - for(let i = 0; i < all.length; i++){ - if (!all[i]) return; - } - const { src, height, width } = imageHolder.img; - insight.backgroundImage = { - url: src, - size: { - height, - width - }, - extents: { - bottom: bottom.numericValue, - left: left.numericValue, - right: right.numericValue, - top: top.numericValue - } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "y", + binnable: true, + axisSelection: ((_c2 = specColumns.y) === null || _c2 === void 0 ? void 0 : _c2.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_d2 = specColumns.z) === null || _d2 === void 0 ? void 0 : _d2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } }; - insight.size = insight.backgroundImage.size; -} - -},{"../base":"3TPz5","../controls/dialog":"OQi9w","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","../controls/iconButton":"6pZiK","../columns":"7ZE4v","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPyTZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Viewer", ()=>(0, _viewer.Viewer)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "SandDance", ()=>_sanddance); -parcelHelpers.export(exports, "util", ()=>_util); -var _sanddance = require("@msrvida/sanddance"); -var _util = require("./util"); -var _viewer = require("./viewer"); -var _base = require("./base"); -var _version = require("./version"); - -},{"@msrvida/sanddance":"ganM8","./util":"71zHd","./viewer":"2yfj3","./base":"e2btd","./version":"g42QN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ganM8":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "colorSchemes", ()=>(0, _colorSchemes.colorSchemes)); -parcelHelpers.export(exports, "constants", ()=>_constants); -parcelHelpers.export(exports, "searchExpression", ()=>_searchExpression); -parcelHelpers.export(exports, "specs", ()=>_sanddanceSpecs); -parcelHelpers.export(exports, "types", ()=>_types); -parcelHelpers.export(exports, "use", ()=>use); -parcelHelpers.export(exports, "util", ()=>_util); -parcelHelpers.export(exports, "VegaMorphCharts", ()=>_vegaMorphcharts); -parcelHelpers.export(exports, "Viewer", ()=>(0, _viewer.Viewer)); -var _constants = require("./constants"); -var _searchExpression = require("@msrvida/search-expression"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _types = require("./types"); -var _util = require("./util"); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _colorSchemes = require("./colorSchemes"); -var _viewer = require("./viewer"); -var _version = require("./version"); -const use = (0, _vegaMorphcharts.use); - -},{"./constants":"ix2qh","@msrvida/search-expression":"4F93b","@msrvida/sanddance-specs":"aOvSr","./types":"bD3z1","./util":"g08sL","@msrvida/vega-morphcharts":"9Sd5M","./colorSchemes":"iDNR0","./viewer":"9IMa3","./version":"7m9yM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ix2qh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorScaleNone", ()=>(0, _sanddanceSpecs.ColorScaleNone)); -parcelHelpers.export(exports, "FieldNames", ()=>(0, _sanddanceSpecs.FieldNames)); -parcelHelpers.export(exports, "ScaleNames", ()=>(0, _sanddanceSpecs.ScaleNames)); -parcelHelpers.export(exports, "SignalNames", ()=>(0, _sanddanceSpecs.SignalNames)); -parcelHelpers.export(exports, "GL_ORDINAL", ()=>GL_ORDINAL); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -const GL_ORDINAL = 'GL_ORDINAL'; - -},{"@msrvida/sanddance-specs":"aOvSr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aOvSr":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _build = require("./build"); -parcelHelpers.exportAll(_build, exports); -var _constants = require("./constants"); -parcelHelpers.exportAll(_constants, exports); -var _inference = require("./inference"); -parcelHelpers.exportAll(_inference, exports); -var _interfaces = require("./interfaces"); -parcelHelpers.exportAll(_interfaces, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./build":"dNBKI","./constants":"22TRA","./inference":"aEiKQ","./interfaces":"d6Ht8","./types":"1NHSP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dNBKI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "build", ()=>build); -var _charts = require("./charts"); -var _inference = require("./inference"); -var _specBuilder = require("./specBuilder"); -function build(specContext, currData) { - const { specColumns } = specContext; - const columns = [ - specColumns.color, - specColumns.facet, - specColumns.facetV, - specColumns.group, - specColumns.size, - specColumns.sort, - specColumns.x, - specColumns.y, - specColumns.z - ]; - (0, _inference.inferAll)(columns, currData); - const specBuilderProps = (0, _charts.getSpecBuilderPropsForChart)(specContext); - const specBuilder = new (0, _specBuilder.SpecBuilder)(specBuilderProps, specContext); - let specResult; - if (specBuilder) { - try { - const errors = specBuilder.validate(); - if (errors.length) specResult = { - errors, - specCapabilities: specBuilderProps.specCapabilities, - vegaSpec: null - }; - else specResult = specBuilder.build(); - } catch (e) { - specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [ - e.stack - ] - }; + } + function barchartV(specContext) { + var _a2, _b2; + const { insight, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight.hideAxes; + const bandProps = { + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes + }; + const y2 = { title: null }; + const axisScales = { + x: { title: specColumns.x && specColumns.x.name }, + y: y2, + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight; + if (totalStyle === "sum-strip-percent") { + y2.aggregate = "percent"; + y2.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "bottom", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + y2.aggregate = "sum"; + y2.title = language.sum; + const treemapProps = { + corner: "bottom-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + y2.aggregate = "sum"; + y2.title = language.sum; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + y2.aggregate = "count"; + y2.title = language.count; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; } - if (!specResult.errors) { - const data0 = specResult.vegaSpec.data[0]; - data0.values = currData; + default: { + y2.aggregate = "count"; + y2.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-up", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; } - } else specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [ - `could not build spec for ${specContext.insight.chart}` + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "z", + axisSelection: ((_b2 = specColumns.z) === null || _b2 === void 0 ? void 0 : _b2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } ] + } }; - return specResult; -} - -},{"./charts":"gjBpZ","./inference":"aEiKQ","./specBuilder":"h5flx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gjBpZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSpecBuilderPropsForChart", ()=>getSpecBuilderPropsForChart); -var _barchartH = require("./barchartH"); -var _barchartHDefault = parcelHelpers.interopDefault(_barchartH); -var _barchartV = require("./barchartV"); -var _barchartVDefault = parcelHelpers.interopDefault(_barchartV); -var _density = require("./density"); -var _densityDefault = parcelHelpers.interopDefault(_density); -var _grid = require("./grid"); -var _gridDefault = parcelHelpers.interopDefault(_grid); -var _scatterplot = require("./scatterplot"); -var _scatterplotDefault = parcelHelpers.interopDefault(_scatterplot); -var _stacks = require("./stacks"); -var _stacksDefault = parcelHelpers.interopDefault(_stacks); -var _strips = require("./strips"); -var _stripsDefault = parcelHelpers.interopDefault(_strips); -var _treemap = require("./treemap"); -var _treemapDefault = parcelHelpers.interopDefault(_treemap); -var _facetLayout = require("../facetLayout"); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -const map = { - barchart: (0, _barchartVDefault.default), - barchartH: (0, _barchartHDefault.default), - barchartV: (0, _barchartVDefault.default), - density: (0, _densityDefault.default), - grid: (0, _gridDefault.default), - scatterplot: (0, _scatterplotDefault.default), - stacks: (0, _stacksDefault.default), - strips: (0, _stripsDefault.default), - treemap: (0, _treemapDefault.default) -}; -function getSpecBuilderPropsForChart(specContext) { + } + function density(specContext) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; const { insight, specColumns, specViewOptions } = specContext; - const fn = map[insight.chart]; - if (fn) { - const props = fn(specContext); - if (insight.columns.facet) { - const discreteFacetColumn = { - column: specColumns.facet, - defaultBins: (0, _defaults.defaultBins), - maxbins: (0, _defaults.maxbins), - maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, - maxbinsSignalName: (0, _constants.SignalNames).FacetBins - }; - const discreteFacetVColumn = { - column: specColumns.facetV, - defaultBins: (0, _defaults.defaultBins), - maxbins: (0, _defaults.maxbins), - maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, - maxbinsSignalName: (0, _constants.SignalNames).FacetVBins - }; - const { facetLayout, layoutPair } = (0, _facetLayout.getFacetLayout)(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); - props.layouts.unshift(layoutPair); - props.facetLayout = facetLayout; - props.collapseFacetAxes = specViewOptions.collapseFacetAxes; - } - return props; - } -} - -},{"./barchartH":"36QjZ","./barchartV":"6xzC3","./density":"3nLmY","./grid":"8jSVp","./scatterplot":"cktKX","./stacks":"7r3BC","./strips":"8tBSJ","./treemap":"3rGzu","../facetLayout":"5wBmI","../constants":"22TRA","../defaults":"jpVjH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"36QjZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes + const axisScales = { + x: { title: (_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.name }, + y: { title: (_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.name }, + z: { title: (_c2 = specColumns.z) === null || _c2 === void 0 ? void 0 : _c2.name } + }; + const backgroundImage = ((_d2 = specColumns.x) === null || _d2 === void 0 ? void 0 : _d2.quantitative) && ((_e2 = specColumns.y) === null || _e2 === void 0 ? void 0 : _e2.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } + }; + const aggProps = { + onBuild: null, + aggregation: null, + sumBy: specColumns.size + }; + const layouts = [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "AggregateSquare", + props: aggProps + } + ]; + const { totalStyle, view } = insight; + switch (totalStyle) { + case "sum-treemap": { + aggProps.aggregation = "sum"; + const treemapProps = { + corner: "bottom-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view }; - const x = { - title: null + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + aggProps.aggregation = "sum"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view }; - const axisScales = { - x, - y: { - title: (_a = specColumns.y) === null || _a === void 0 ? void 0 : _a.name - }, - z: { - title: (_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.name - } + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + aggProps.aggregation = "count"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view }; - const layouts = [ - { - layoutType: 'Band', - props: bandProps - } - ]; - const { totalStyle, view } = insight; - if (totalStyle === 'sum-strip-percent') { - x.aggregate = 'percent'; - x.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: 'left', - globalAggregateMaxExtentSignal: 'aggMaxExtent', - globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: 'AggregateContainer', - props: aggProps - }); - switch(totalStyle){ - case 'sum-treemap': - { - x.aggregate = 'sum'; - x.title = language.sum; - const treemapProps = { - corner: 'top-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - x.aggregate = 'sum'; - x.title = language.sum; - const stripProps = { - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - x.aggregate = 'count'; - x.title = language.count; - const stripProps = { - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - x.aggregate = 'count'; - x.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'down-right', - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: 'y', - binnable: true, - axisSelection: ((_c = specColumns.y) === null || _c === void 0 ? void 0 : _c.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'z', - axisSelection: ((_d = specColumns.z) === null || _d === void 0 ? void 0 : _d.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + default: { + aggProps.aggregation = "count"; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + maxGroupedUnits: null, + maxGroupedFillSize: null, + showAxes, + view + }; + aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled) => { + squareProps.maxGroupedUnits = aggMaxExtent; + squareProps.maxGroupedFillSize = aggMaxExtentScaled; }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"22TRA","../defaults":"jpVjH","../size":"h7gMN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"22TRA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FieldNames", ()=>FieldNames); -parcelHelpers.export(exports, "ScaleNames", ()=>ScaleNames); -parcelHelpers.export(exports, "SignalNames", ()=>SignalNames); -parcelHelpers.export(exports, "Other", ()=>Other); -parcelHelpers.export(exports, "ColorScaleNone", ()=>ColorScaleNone); -const FieldNames = { - Active: '__SandDance__Active', - Collapsed: '__SandDance__Collapsed', - Contains: '__SandDance__Contains', - Count: '__SandDance__Count', - Sum: '__SandDance__Sum', - SumOfCount: '__SandDance__CountSum', - SumOfSum: '__SandDance__SumSum', - Selected: '__SandDance__Selected', - First: '__SandDance__First', - Last: '__SandDance__Last', - Top: '__SandDance__Top', - TopColor: '__SandDance__TopColor', - TopIndex: '__SandDance__TopIndex', - PowerBISelectionId: '__SandDance__PowerBISelectionId', - FacetSearch: '__SandDance__FacetSearch', - FacetTitle: '__SandDance__FacetTitle', - Ordinal: '__SandDance__Ordinal', - WrapCol: '__SandDance__WrapCol', - WrapRow: '__SandDance__WrapRow', - Value: '__SandDance__Value', - OffsetX: '__SandDance__X', - OffsetY: '__SandDance__Y', - OffsetHeight: '__SandDance__H', - OffsetWidth: '__SandDance__W' -}; -const ScaleNames = { - Color: 'scale_color', - X: 'scale_x', - Y: 'scale_y', - Z: 'scale_z' -}; -const SignalNames = { - ViewportWidth: 'ViewportWidth', - ViewportHeight: 'ViewportHeight', - MinCellWidth: 'MinCellWidth', - MinCellHeight: 'MinCellHeight', - PlotOffsetLeft: 'PlotOffsetLeft', - PlotOffsetTop: 'PlotOffsetTop', - PlotOffsetBottom: 'PlotOffsetBottom', - PlotOffsetRight: 'PlotOffsetRight', - PlotHeightIn: 'PlotHeightIn', - PlotWidthIn: 'PlotWidthIn', - PlotHeightOut: 'PlotHeightOut', - PlotWidthOut: 'PlotWidthOut', - ColorBinCount: 'RoleColor_BinCountSignal', - ColorReverse: 'RoleColor_ReverseSignal', - FacetAxesAdjustX: 'RoleFacet_AxesAdjustSignalX', - FacetAxesAdjustY: 'RoleFacet_AxesAdjustSignalY', - FacetBins: 'RoleFacet_BinsSignal', - FacetVBins: 'RoleFacetV_BinsSignal', - FacetPaddingTop: 'FacetPaddingTop', - FacetPaddingBottom: 'FacetPaddingBottom', - FacetPaddingLeft: 'FacetPaddingLeft', - MarkOpacity: 'Mark_OpacitySignal', - PointScale: 'Chart_PointScaleSignal', - TextAngleX: 'Text_AngleXSignal', - TextAngleY: 'Text_AngleYSignal', - TextScale: 'Text_ScaleSignal', - TextSize: 'Text_SizeSignal', - TextTitleSize: 'Text_TitleSizeSignal', - TreeMapMethod: 'Chart_TreeMapMethodSignal', - XBins: 'RoleX_BinsSignal', - YBins: 'RoleY_BinsSignal', - ZHeight: 'RoleZ_HeightSignal', - ZGrounded: 'RoleZ_Grounded', - ZProportion: 'RoleZ_ProportionSignal' -}; -const Other = '__Other'; -const ColorScaleNone = 'none'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j7FRh":[function(require,module,exports,__globalThis) { -exports.interopDefault = function(a) { - return a && a.__esModule ? a : { - default: a - }; -}; -exports.defineInteropFlag = function(a) { - Object.defineProperty(a, '__esModule', { - value: true - }); -}; -exports.exportAll = function(source, dest) { - Object.keys(source).forEach(function(key) { - if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return; - Object.defineProperty(dest, key, { - enumerable: true, - get: function() { - return source[key]; - } + layouts.push({ + layoutType: "Square", + props: squareProps }); - }); - return dest; -}; -exports.export = function(dest, destName, get) { - Object.defineProperty(dest, destName, { - enumerable: true, - get: get - }); -}; - -},{}],"jpVjH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ //TODO move these to options -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultBins", ()=>defaultBins); -parcelHelpers.export(exports, "maxbins", ()=>maxbins); -parcelHelpers.export(exports, "minBarBandWidth", ()=>minBarBandWidth); -parcelHelpers.export(exports, "minFacetWidth", ()=>minFacetWidth); -parcelHelpers.export(exports, "minFacetHeight", ()=>minFacetHeight); -parcelHelpers.export(exports, "facetPaddingLeft", ()=>facetPaddingLeft); -parcelHelpers.export(exports, "facetPaddingTop", ()=>facetPaddingTop); -parcelHelpers.export(exports, "facetPaddingBottom", ()=>facetPaddingBottom); -parcelHelpers.export(exports, "facetPaddingRight", ()=>facetPaddingRight); -parcelHelpers.export(exports, "axesLabelLimit", ()=>axesLabelLimit); -parcelHelpers.export(exports, "axesTitleLimit", ()=>axesTitleLimit); -parcelHelpers.export(exports, "axesTitlePaddingX", ()=>axesTitlePaddingX); -parcelHelpers.export(exports, "axesTitlePaddingY", ()=>axesTitlePaddingY); -parcelHelpers.export(exports, "axesTitlePaddingFacetX", ()=>axesTitlePaddingFacetX); -parcelHelpers.export(exports, "axesTitlePaddingFacetY", ()=>axesTitlePaddingFacetY); -parcelHelpers.export(exports, "axesOffsetX", ()=>axesOffsetX); -parcelHelpers.export(exports, "axesOffsetY", ()=>axesOffsetY); -parcelHelpers.export(exports, "scatterSizedMin", ()=>scatterSizedMin); -parcelHelpers.export(exports, "scatterSizedDiv", ()=>scatterSizedDiv); -parcelHelpers.export(exports, "debounce", ()=>debounce); -const defaultBins = 10; -const maxbins = 100; -const minBarBandWidth = 15; -const minFacetWidth = 140; -const minFacetHeight = 180; -const facetPaddingLeft = 40; -const facetPaddingTop = 40; -const facetPaddingBottom = 40; -const facetPaddingRight = 40; -const axesLabelLimit = 100; -const axesTitleLimit = 100; -const axesTitlePaddingX = 30; -const axesTitlePaddingY = 60; -const axesTitlePaddingFacetX = 69; -const axesTitlePaddingFacetY = 92; -const axesOffsetX = 120; -const axesOffsetY = 120; -const scatterSizedMin = 10; -const scatterSizedDiv = 20; -const debounce = 250; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7gMN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "allowNoneForSize", ()=>allowNoneForSize); -function allowNoneForSize(specContext) { - switch(specContext.insight.totalStyle){ - case 'sum-strip': - case 'sum-strip-percent': - case 'sum-treemap': - return false; - default: - //if totalStyle is blank, count is assumed - return true; + break; + } } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6xzC3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes - }; - const y = { - title: null - }; - const axisScales = { - x: { - title: specColumns.x && specColumns.x.name - }, - y, - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = [ - { - layoutType: 'Band', - props: bandProps - } - ]; - const { totalStyle, view } = insight; - if (totalStyle === 'sum-strip-percent') { - y.aggregate = 'percent'; - y.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: 'descending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: 'bottom', - globalAggregateMaxExtentSignal: 'aggMaxExtent', - globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: 'AggregateContainer', - props: aggProps - }); - switch(totalStyle){ - case 'sum-treemap': - { - y.aggregate = 'sum'; - y.title = language.sum; - const treemapProps = { - corner: 'bottom-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - y.aggregate = 'sum'; - y.title = language.sum; - const stripProps = { - sortOrder: 'descending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - y.aggregate = 'count'; - y.title = language.count; - const stripProps = { - sortOrder: 'descending', - orientation: 'vertical', - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - y.aggregate = 'count'; - y.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-up', - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'z', - axisSelection: ((_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"22TRA","../defaults":"jpVjH","../size":"h7gMN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3nLmY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { - title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name - }, - y: { - title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name - }, - z: { - title: (_c = specColumns.z) === null || _c === void 0 ? void 0 : _c.name - } - }; - const backgroundImage = ((_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.top, - min: backgroundImage.extents.bottom - } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.right, - min: backgroundImage.extents.left - } - }; - const aggProps = { - onBuild: null, - aggregation: null, - sumBy: specColumns.size - }; - const layouts = [ - { - layoutType: 'Band', - props: vBandProps - }, - { - layoutType: 'Band', - props: hBandProps - }, - { - layoutType: 'AggregateSquare', - props: aggProps - } - ]; - const { totalStyle, view } = insight; - switch(totalStyle){ - case 'sum-treemap': - { - aggProps.aggregation = 'sum'; - const treemapProps = { - corner: 'bottom-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - aggProps.aggregation = 'sum'; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - aggProps.aggregation = 'count'; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - aggProps.aggregation = 'count'; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-down', - z: specColumns.z, - maxGroupedUnits: null, - maxGroupedFillSize: null, - showAxes, - view - }; - aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled)=>{ - squareProps.maxGroupedUnits = aggMaxExtent; - squareProps.maxGroupedFillSize = aggMaxExtentScaled; - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - return { - axisScales, - layouts, - specCapabilities: { - backgroundImage: true, - countsAndSums: true, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'y', - binnable: true, - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'z', - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"22TRA","../defaults":"jpVjH","../size":"h7gMN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8jSVp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns } = specContext; - const { view } = insight; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-down', - z: specColumns.z, - collapseYHeight: true, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - return { - axisScales, - layouts: [ - { - layoutType: 'Square', - props: squareProps - } - ], - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cktKX":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const backgroundImageExtents = ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative) && ((_c = insight.backgroundImage) === null || _c === void 0 ? void 0 : _c.extents); - const scatterProps = { - x: specColumns.x, - y: specColumns.y, - z: specColumns.z, - size: specColumns.size, - scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, - zGrounded: specViewOptions.language.zGrounded, - backgroundImageExtents, - showAxes: !(backgroundImageExtents || insight.hideAxes), - view: insight.view - }; - const axisScales = { - x: { - title: (_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.name - }, - y: { - title: (_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.name - }, - z: { - title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name - } - }; - return { - axisScales, - layouts: [ - { - layoutType: 'Scatter', - props: scatterProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: 'x', - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact' - }, - { - role: 'y', - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact' - }, - { - role: 'z', - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: false - }, - { - role: 'color', - allowNone: true - }, - { - role: 'size', - excludeCategoric: true, - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ], - signals: [ - (0, _constants.SignalNames).PointScale, - (0, _constants.SignalNames).ZGrounded - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7r3BC":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { - title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name - }, - y: { - title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name - }, - z: { - title: specViewOptions.language.count - } - }; - const backgroundImage = ((_c = specColumns.x) === null || _c === void 0 ? void 0 : _c.quantitative) && ((_d = specColumns.y) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = insight.backgroundImage) === null || _e === void 0 ? void 0 : _e.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.top, - min: backgroundImage.extents.bottom - } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.right, - min: backgroundImage.extents.left - } - }; - const stackProps = { - sort: specColumns.sort, - showAxes - }; - return { - axisScales, - customZScale: true, - layouts: [ - { - layoutType: 'Band', - props: vBandProps - }, - { - layoutType: 'Band', - props: hBandProps - }, - { - layoutType: 'Stack', - props: stackProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'y', - binnable: true, - axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _defaults = require("../defaults"); -var _constants = require("../constants"); - -},{"../defaults":"jpVjH","../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8tBSJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns } = specContext; - const { view } = insight; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: specColumns.size ? 'sum' : 'count' - }; - const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; - const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; - const props = { - dock: 'top', - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: 'AggregateContainer', - props - }); - } - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'size', - allowNone: true, - excludeCategoric: true - }, - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rGzu":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns, specViewOptions } = specContext; - const { view } = insight; - const treemapProps = { - corner: 'top-left', - group: specColumns.group, - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes: !insight.hideAxes, - view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: 'sum' - }; - const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; - const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; - const props = { - dock: 'top', - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: 'AggregateContainer', - props - }); - } - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'size', - excludeCategoric: true - }, - { - role: 'group', - allowNone: true - }, - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ], - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5wBmI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getFacetLayout", ()=>getFacetLayout); -var _defaults = require("./defaults"); -function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { - let layoutPair; - const groupby = facetColumn; - const plotPadding = { - x: 0, - y: 0 - }; - let facetPadding; - switch(facetStyle){ - case 'cross': - { - const props = { - axisTextColor, - colRowTitles: true, - groupbyX: groupby, - groupbyY: facetVColumn - }; - layoutPair = { - layoutType: 'Cross', - props - }; - facetPadding = { - bottom: (0, _defaults.facetPaddingBottom), - left: (0, _defaults.facetPaddingLeft), - top: 0 - }; - plotPadding.y = (0, _defaults.facetPaddingTop); - plotPadding.x = (0, _defaults.facetPaddingRight); - break; - } - case 'wrap': - default: - { - const props = { - axisTextColor, - cellTitles: true, - groupby - }; - layoutPair = { - layoutType: 'Wrap', - props - }; - facetPadding = { - bottom: (0, _defaults.facetPaddingBottom), - left: (0, _defaults.facetPaddingLeft), - top: (0, _defaults.facetPaddingTop) - }; - break; - } - } - const facetLayout = { - facetPadding, - plotPadding - }; - return { - layoutPair, - facetLayout - }; -} - -},{"./defaults":"jpVjH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aEiKQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnsFromData", ()=>(0, _dataInference.getColumnsFromData)); -parcelHelpers.export(exports, "getStats", ()=>(0, _dataInference.getStats)); -parcelHelpers.export(exports, "inferAll", ()=>(0, _dataInference.inferAll)); -/** - * Get columns associated with each Insight role. - * @param insight Insight to specify column roles. - * @param columns Array of Columns inferred from the data. - */ parcelHelpers.export(exports, "getSpecColumns", ()=>getSpecColumns); -var _dataInference = require("@msrvida/data-inference"); -function getSpecColumns(insight, columns) { - function getColumnByName(name) { - return columns.filter((c)=>c.name === name)[0]; - } - return { - color: getColumnByName(insight.columns && insight.columns.color), - facet: getColumnByName(insight.columns && insight.columns.facet), - facetV: getColumnByName(insight.columns && insight.columns.facetV), - group: getColumnByName(insight.columns && insight.columns.group), - size: getColumnByName(insight.columns && insight.columns.size), - sort: getColumnByName(insight.columns && insight.columns.sort), - uid: getColumnByName(insight.columns && insight.columns.uid), - x: getColumnByName(insight.columns && insight.columns.x), - y: getColumnByName(insight.columns && insight.columns.y), - z: getColumnByName(insight.columns && insight.columns.z) - }; -} - -},{"@msrvida/data-inference":"wjoyE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"wjoyE":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _color = require("./color"); -parcelHelpers.exportAll(_color, exports); -var _inference = require("./inference"); -parcelHelpers.exportAll(_inference, exports); -var _numeric = require("./numeric"); -parcelHelpers.exportAll(_numeric, exports); -var _stats = require("./stats"); -parcelHelpers.exportAll(_stats, exports); -var _summary = require("./summary"); -parcelHelpers.exportAll(_summary, exports); - -},{"./color":"jS4V7","./inference":"2vdcV","./numeric":"hDLgJ","./stats":"jRSDf","./summary":"4Nkk9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jS4V7":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isColor", ()=>isColor); -parcelHelpers.export(exports, "checkIsColorData", ()=>checkIsColorData); -var _d3Color = require("d3-color"); -function isColor(cssColorSpecifier) { - return !!(0, _d3Color.color)(cssColorSpecifier); -} -function checkIsColorData(data, column) { - if (!column.stats.hasColorData) { - column.isColorData = false; - return; - } - for(let i = 0; i < data.length; i++)if (!isColor(data[i][column.name])) { - column.isColorData = false; - return; - } - column.isColorData = true; -} - -},{"d3-color":"37LNF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"37LNF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "color", ()=>(0, _colorJsDefault.default)); -parcelHelpers.export(exports, "rgb", ()=>(0, _colorJs.rgb)); -parcelHelpers.export(exports, "hsl", ()=>(0, _colorJs.hsl)); -parcelHelpers.export(exports, "lab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "hcl", ()=>(0, _labJs.hcl)); -parcelHelpers.export(exports, "lch", ()=>(0, _labJs.lch)); -parcelHelpers.export(exports, "gray", ()=>(0, _labJs.gray)); -parcelHelpers.export(exports, "cubehelix", ()=>(0, _cubehelixJsDefault.default)); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); - -},{"./color.js":"1ttKl","./lab.js":"1NJbB","./cubehelix.js":"ddL6Z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1ttKl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -parcelHelpers.export(exports, "darker", ()=>darker); -parcelHelpers.export(exports, "brighter", ()=>brighter); -parcelHelpers.export(exports, "default", ()=>color); -parcelHelpers.export(exports, "rgbConvert", ()=>rgbConvert); -parcelHelpers.export(exports, "rgb", ()=>rgb); -parcelHelpers.export(exports, "Rgb", ()=>Rgb); -parcelHelpers.export(exports, "hslConvert", ()=>hslConvert); -parcelHelpers.export(exports, "hsl", ()=>hsl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -function Color() {} -var darker = 0.7; -var brighter = 1 / darker; -var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); -var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 -}; -(0, _defineJsDefault.default)(Color, color, { - copy (channels) { - return Object.assign(new this.constructor, this, channels); - }, - displayable () { - return this.rgb().displayable(); - }, - hex: color_formatHex, - formatHex: color_formatHex, - formatHex8: color_formatHex8, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb -}); -function color_formatHex() { - return this.rgb().formatHex(); -} -function color_formatHex8() { - return this.rgb().formatHex8(); -} -function color_formatHsl() { - return hslConvert(this).formatHsl(); -} -function color_formatRgb() { - return this.rgb().formatRgb(); -} -function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 - : null // invalid hex - ) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; -} -function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); -} -function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); -} -function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); -} -function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} -function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Rgb, rgb, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb () { - return this; - }, - clamp () { - return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); - }, - displayable () { - return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; - }, - hex: rgb_formatHex, - formatHex: rgb_formatHex, - formatHex8: rgb_formatHex8, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb -})); -function rgb_formatHex() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; -} -function rgb_formatHex8() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; -} -function rgb_formatRgb() { - const a = clampa(this.opacity); - return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; -} -function clampa(opacity) { - return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); -} -function clampi(value) { - return Math.max(0, Math.min(255, Math.round(value) || 0)); -} -function hex(value) { - value = clampi(value); - return (value < 16 ? "0" : "") + value.toString(16); -} -function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); -} -function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else s = l > 0 && l < 1 ? 0 : h; - return new Hsl(h, s, l, o.opacity); -} -function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} -function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Hsl, hsl, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; - return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); - }, - clamp () { - return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); - }, - displayable () { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; - }, - formatHsl () { - const a = clampa(this.opacity); - return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; - } -})); -function clamph(value) { - value = (value || 0) % 360; - return value < 0 ? value + 360 : value; -} -function clampt(value) { - return Math.max(0, Math.min(1, value || 0)); -} -/* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; -} - -},{"./define.js":"kwMap","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwMap":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - }); -parcelHelpers.export(exports, "extend", ()=>extend); -function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for(var key in definition)prototype[key] = definition[key]; - return prototype; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NJbB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gray", ()=>gray); -parcelHelpers.export(exports, "default", ()=>lab); -parcelHelpers.export(exports, "Lab", ()=>Lab); -parcelHelpers.export(exports, "lch", ()=>lch); -parcelHelpers.export(exports, "hcl", ()=>hcl); -parcelHelpers.export(exports, "Hcl", ()=>Hcl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -// https://observablehq.com/@mbostock/lab-and-rgb -const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; -function labConvert(o) { - if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); - if (o instanceof Hcl) return hcl2lab(o); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; - else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); - } - return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); -} -function gray(l, opacity) { - return new Lab(l, 0, 0, opacity == null ? 1 : opacity); -} -function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} -function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Lab, lab, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker (k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb () { - var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = Zn * lab2xyz(z); - return new (0, _colorJs.Rgb)(lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity); - } -})); -function xyz2lab(t) { - return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; -} -function lab2xyz(t) { - return t > t1 ? t * t * t : t2 * (t - t0); -} -function lrgb2rgb(x) { - return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); -} -function hclConvert(o) { - if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); - if (!(o instanceof Lab)) o = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = Math.atan2(o.b, o.a) * (0, _mathJs.degrees); - return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); -} -function lch(l, c, h, opacity) { - return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; -} -function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * (0, _mathJs.radians); - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); -} -(0, _defineJsDefault.default)(Hcl, hcl, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker (k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb () { - return hcl2lab(this).rgb(); - } -})); - -},{"./define.js":"kwMap","./color.js":"1ttKl","./math.js":"k7vm2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k7vm2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "degrees", ()=>degrees); -const radians = Math.PI / 180; -const degrees = 180 / Math.PI; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ddL6Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cubehelix); -parcelHelpers.export(exports, "Cubehelix", ()=>Cubehelix); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -var A = -0.14861, B = 1.78277, C = -0.29227, D = -0.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; -function cubehelixConvert(o) { - if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * (0, _mathJs.degrees) - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); -} -function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} -function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Cubehelix, cubehelix, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - k = k == null ? (0, _colorJs.brighter) : Math.pow((0, _colorJs.brighter), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? (0, _colorJs.darker) : Math.pow((0, _colorJs.darker), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = isNaN(this.h) ? 0 : (this.h + 120) * (0, _mathJs.radians), l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); - return new (0, _colorJs.Rgb)(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); - } -})); - -},{"./define.js":"kwMap","./color.js":"1ttKl","./math.js":"k7vm2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2vdcV":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Derive column metadata from the data array. - * @param data Array of data objects. - */ parcelHelpers.export(exports, "getColumnsFromData", ()=>getColumnsFromData); -/** - * Populate columns with type inferences and stats. - * @param columns Array of columns. - * @param data Array of data objects. - */ parcelHelpers.export(exports, "inferAll", ()=>inferAll); -var _color = require("./color"); -var _numeric = require("./numeric"); -var _stats = require("./stats"); -function getColumnsFromData(inferTypesFn, data, columnTypes) { - const sample = data[0]; - const fields = sample ? Object.keys(sample) : []; - const inferences = Object.assign(Object.assign({}, inferTypesFn(data, fields)), columnTypes); - const columns = fields.map((name)=>{ - const column = { - name, - type: inferences[name] - }; - return column; - }); - inferAll(columns, data); - return columns; -} -function inferAll(columns, data) { - columns.forEach((column)=>{ - if (column) { - if (typeof column.quantitative !== 'boolean') column.quantitative = (0, _numeric.isQuantitative)(column); - if (!column.stats) column.stats = (0, _stats.getStats)(data, column); - // hex codes, ex. #003300, are parsed as dates - if ((column.type === 'date' || column.type === 'string') && typeof column.isColorData !== 'boolean') (0, _color.checkIsColorData)(data, column); - } - }); -} - -},{"./color":"jS4V7","./numeric":"hDLgJ","./stats":"jRSDf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hDLgJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isQuantitative", ()=>isQuantitative); -parcelHelpers.export(exports, "detectNegative", ()=>detectNegative); -parcelHelpers.export(exports, "detectSequentialColumn", ()=>detectSequentialColumn); -function isQuantitative(column) { - return column.type === 'number' || column.type === 'integer'; -} -function detectNegative(columnName, data) { - for(let i = 1; i < data.length; i++){ - const value = columnName == null ? data[i] : data[i][columnName]; - if (value < 0) return true; - } - return false; -} -function detectSequentialColumn(columnName, data) { - if (data.length < 2) return false; - for(let i = 1; i < data.length; i++){ - const curr = columnName == null ? data[i] : data[i][columnName]; - const prev = columnName == null ? data[i - 1] : data[i - 1][columnName]; - if (curr !== prev + 1) return false; - } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jRSDf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStats", ()=>getStats); -var _color = require("./color"); -var _numeric = require("./numeric"); -function getStats(data, ...args) { - let columnName; - let columnType; - let columnQuantitative; - let distinctValuesCallback; - if (args.length <= 2) { - const column = args[0]; - columnName = column.name; - columnType = column.type; - columnQuantitative = column.quantitative; - distinctValuesCallback = args[1]; - } else { - columnName = args[0]; - columnType = args[1]; - columnQuantitative = args[2]; - distinctValuesCallback = args[3]; - } - const distinctMap = {}; - const stats = { - nonNull: 0, - distinctValueCount: null, - max: null, - mean: null, - min: null - }; - const columnIsString = columnType === 'string'; - let sum = 0; - for(let i = 0; i < data.length; i++){ - const row = data[i]; - const value = columnName == null ? row : row[columnName]; - if (columnIsString) { - if (value !== '') stats.nonNull++; - } else if (value != null) stats.nonNull++; - const num = +value; - distinctMap[value] = true; - if (!isNaN(num)) { - if (stats.max === null || num > stats.max) stats.max = num; - if (stats.min === null || num < stats.min) stats.min = num; - sum += num; - } - // hex codes, ex. #003300, are parsed as dates - if ((columnType === 'date' || columnIsString) && !stats.hasColorData && (0, _color.isColor)(value)) stats.hasColorData = true; - } - if (columnQuantitative) { - stats.mean = data.length > 0 && sum / data.length; - stats.hasNegative = (0, _numeric.detectNegative)(columnName, data); - if (columnType === 'integer') stats.isSequential = (0, _numeric.detectSequentialColumn)(columnName, data); - } - const distinctValues = Object.keys(distinctMap); - if (distinctValuesCallback) { - distinctValues.sort(); - distinctValuesCallback(distinctValues); - } - stats.distinctValueCount = distinctValues.length; - return stats; -} - -},{"./color":"jS4V7","./numeric":"hDLgJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Nkk9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "pandasSimulation", ()=>pandasSimulation); -class Table { - constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = 'right'){ - this.columns = columns; - this.rows = rows; - this.maxWidth = maxWidth; - this.underlineHeaders = underlineHeaders; - this.align = align; - // Calculate maximum width for each column - this.columnWidths = this.columns.map((col, idx)=>Math.max(col.length, ...this.rows.map((row)=>{ - var _a; - return ((_a = row[idx]) === null || _a === void 0 ? void 0 : _a.length) || 0; - }))); - } - createSpaces(num) { - return ' '.repeat(num); - } - groupColumns() { - let cumulativeWidth = 0; - const columnGroups = []; - let currentGroup = []; - this.columns.forEach((col, idx)=>{ - const columnSpace = this.columnWidths[idx] + 1; // account for one space between columns - if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { - columnGroups.push(currentGroup); - cumulativeWidth = columnSpace; - currentGroup = [ - col - ]; - } else { - cumulativeWidth += columnSpace; - currentGroup.push(col); - } - }); - if (currentGroup.length > 0) columnGroups.push(currentGroup); - return columnGroups; - } - formatRow(row, group) { - return group.map((col)=>{ - const idx = this.columns.indexOf(col); - const cellValue = row[idx] == null ? '' : row[idx].toString(); - return this.align === 'right' ? cellValue.padStart(this.columnWidths[idx], ' ') : cellValue.padEnd(this.columnWidths[idx], ' '); - }).join(this.createSpaces(1)); - } - formatHeader(group) { - return group.map((col)=>{ - const idx = this.columns.indexOf(col); - return this.align === 'right' ? col.padStart(this.columnWidths[idx], ' ') : col.padEnd(this.columnWidths[idx], ' '); - }).join(this.createSpaces(1)); - } - underlineHeader(group) { - return group.map((col)=>'-'.repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); - } - render() { - const output = []; - const columnGroups = this.groupColumns(); - columnGroups.forEach((group, groupIndex)=>{ - const headerRow = this.formatHeader(group); - let section = headerRow + (groupIndex < columnGroups.length - 1 ? ' \\' : '') + '\n'; - if (this.underlineHeaders) section += this.underlineHeader(group) + '\n'; - this.rows.forEach((row)=>{ - section += this.formatRow(row, group) + '\n'; - }); - output.push(section); - if (groupIndex < columnGroups.length - 1) output.push('\n'); - }); - return output.join(''); - } -} -var pandasSimulation; -(function(pandasSimulation) { - // Mapping TypeScript types to Python-like dtypes - const typeMapping = { - boolean: 'bool', - number: 'float64', - date: 'datetime64[ns]', - string: 'object', - integer: 'int64' - }; - function head(columns, data, maxWidth = 80) { - const numRows = 5; // Number of rows as in `head(5)` from pandas - const top = data.slice(0, numRows); // Get the top `numRows` rows - // Create a "fake" row number column - const rowNumbers = Array.from({ - length: numRows - }, (_, i)=>(i + 1).toString()); - // Extract column names and rows for the table - const columnNames = [ - '' - ].concat(columns.map((col)=>col.name)); - const rows = top.map((row, i)=>[ - rowNumbers[i] - ].concat(columns.map((col)=>{ - var _a; - return ((_a = row[col.name]) === null || _a === void 0 ? void 0 : _a.toString()) || ''; - }))); - // Create and render the table with right alignment - const table = new Table(columnNames, rows, maxWidth, false, 'right'); // Right alignment - return table.render(); - } - pandasSimulation.head = head; - function info(columns, data, maxWidth = 80) { - const numRows = data.length; - const output = []; - // Summary header - output.push(''); - output.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); - output.push(`Data columns (total ${columns.length} columns):\n`); - // Column headers and details - const columnHeaders = [ - '#', - 'Column', - 'Non-Null Count', - 'Dtype' - ]; - const rows = columns.map((col, idx)=>{ - const nonNullCount = col.stats.nonNull.toString(); - const dtype = typeMapping[col.type] || 'unknown'; - return [ - idx.toString(), - col.name, - `${nonNullCount} non-null`, - dtype - ]; - }); - // Create and render the table with left alignment and header underline - const table = new Table(columnHeaders, rows, maxWidth, true, 'left'); // Left alignment - output.push(table.render()); - // Memory usage estimation - const memoryUsage = columns.reduce((total, col)=>{ - var _a; - const exampleValue = (_a = data.find((row)=>row[col.name] != null)) === null || _a === void 0 ? void 0 : _a[col.name]; - if (exampleValue == null) return total; - const size = new Blob([ - exampleValue.toString() - ]).size; - return total + size * numRows; - }, 0); - output.push(`\ndtypes: ${columns.filter((col)=>col.type === 'number').length} float64, ` + `${columns.filter((col)=>col.type === 'integer').length} int64, ` + `${columns.filter((col)=>col.type === 'string').length} object`); - output.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); - return output.join('\n'); - } - pandasSimulation.info = info; -})(pandasSimulation || (pandasSimulation = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h5flx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SpecBuilder", ()=>SpecBuilder); -var _axes = require("./axes"); -var _color = require("./color"); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -var _facetTitle = require("./facetTitle"); -var _fill = require("./fill"); -var _globalScope = require("./globalScope"); -var _scope = require("./scope"); -var _signals = require("./signals"); -var _index = require("./layouts/index"); -var _image = require("./image"); -class SpecBuilder { - constructor(props, specContext){ - this.props = props; - this.specContext = specContext; - this.globalSignals = { - facetAxesAdjustX: { - name: (0, _constants.SignalNames).FacetAxesAdjustX, - update: props.facetLayout && props.collapseFacetAxes ? (0, _defaults.facetPaddingLeft).toString() : '0' - }, - facetAxesAdjustY: { - name: (0, _constants.SignalNames).FacetAxesAdjustY, - update: props.facetLayout && props.collapseFacetAxes ? (0, _defaults.facetPaddingBottom).toString() : '0' - }, - minCellWidth: { - name: (0, _constants.SignalNames).MinCellWidth, - update: `${0, _defaults.minFacetWidth}` - }, - minCellHeight: { - name: (0, _constants.SignalNames).MinCellHeight, - update: `${0, _defaults.minFacetHeight}` - }, - plotOffsetLeft: { - name: (0, _constants.SignalNames).PlotOffsetLeft, - update: '0' - }, - plotOffsetTop: { - name: (0, _constants.SignalNames).PlotOffsetTop, - update: '0' - }, - plotOffsetBottom: { - name: (0, _constants.SignalNames).PlotOffsetBottom, - update: '0' - }, - plotOffsetRight: { - name: (0, _constants.SignalNames).PlotOffsetRight, - update: '0' - }, - plotHeightOut: { - name: (0, _constants.SignalNames).PlotHeightOut, - update: (0, _constants.SignalNames).PlotHeightIn - }, - plotWidthOut: { - name: (0, _constants.SignalNames).PlotWidthOut, - update: (0, _constants.SignalNames).PlotWidthIn - } - }; - } - validate() { - const { specContext } = this; - const { specCapabilities } = this.props; - const { roles } = specCapabilities; - const required = roles.filter((r)=>{ - switch(typeof r.allowNone){ - case 'boolean': - return !r.allowNone; - case 'undefined': - return true; - case 'function': - return !r.allowNone(specContext); - } - }); - const numeric = roles.filter((r)=>r.excludeCategoric); - const errors = required.map((r)=>{ - if (specContext.specColumns[r.role]) return null; - else return `Field ${r.role} is required.`; - }).concat(numeric.map((r)=>{ - if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) return `Field ${r.role} must be quantitative.`; - else return null; - })).filter(Boolean); - const { backgroundImage } = specContext.insight; - if (backgroundImage && !backgroundImage.extents) errors.push('BackgroundImage must have extents.'); - return errors; - } - build() { - var _a, _b; - const { globalSignals, specContext } = this; - const { facetLayout, specCapabilities } = this.props; - const { insight, specColumns, specViewOptions } = specContext; - const dataName = 'data_source'; - const { vegaSpec, groupMark } = this.initSpec(dataName); - const { topColorField, colorDataName } = (0, _color.addColor)({ - scope: vegaSpec, - dataName, - specContext, - scaleName: (0, _constants.ScaleNames).Color, - legendDataName: 'data_legend', - topLookupName: 'data_topcolorlookup', - colorReverseSignalName: (0, _constants.SignalNames).ColorReverse - }); - const globalScope = new (0, _globalScope.GlobalScope)({ - dataName: colorDataName, - markGroup: groupMark, - scope: vegaSpec, - signals: globalSignals - }); - if (facetLayout) { - (0, _scope.addSignals)(vegaSpec, { - name: (0, _constants.SignalNames).FacetPaddingBottom, - update: `${facetLayout.facetPadding.bottom}` - }, { - name: (0, _constants.SignalNames).FacetPaddingLeft, - update: `${facetLayout.facetPadding.left}` - }, { - name: (0, _constants.SignalNames).FacetPaddingTop, - update: `${facetLayout.facetPadding.top}` - }); - globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; - globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; - } - const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope)=>{ - if (facetLayout && i === 0) globalScope.zSize = innerScope.offsets.h; - }); - if (specResult) return specResult; - if (allGlobalScales.length > 0) { - const plotHeightOut = globalSignals.plotHeightOut.name; - const plotWidthOut = globalSignals.plotWidthOut.name; - const colTitleScale = { - type: 'linear', - name: 'scale_facet_col_title', - domain: [ - 0, - 1 - ], - range: [ - 0, - { - signal: plotWidthOut - } - ] - }; - const rowTitleScale = { - type: 'linear', - name: 'scale_facet_row_title', - domain: [ - 0, - 1 - ], - range: [ - { - signal: plotHeightOut - }, - 0 - ] - }; - const facetScope = facetLayout ? firstScope : null; - const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; - //TODO if capability and numeric x,y - if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative)) { - //backgroundGroup.encode.update.fill = { value: 'pink' } - if (!backgroundGroup.marks) backgroundGroup.marks = []; - const imageMark = (0, _image.getImageMark)(insight.backgroundImage, allGlobalScales); - backgroundGroup.marks.unshift(imageMark); - } - const axesScopes = facetLayout ? (0, _facetTitle.addFacetAxesGroupMarks)({ - globalScope: globalScope.scope, - plotScope: groupMark, - facetScope, - colTitleScale, - rowTitleScale, - colSeqName: 'data_FacetCellColTitles', - rowSeqName: 'data_FacetCellRowTitles' - }) : { - main: [ - { - scope: groupMark, - lines: true, - labels: true, - title: true - } - ] - }; - (0, _axes.addGlobalAxes)({ - globalScope, - allGlobalScales, - axisScales: this.props.axisScales, - plotOffsetSignals: { - x: globalSignals.plotOffsetLeft, - y: globalSignals.plotOffsetBottom - }, - axesOffsets: { - x: (0, _defaults.axesOffsetX), - y: (0, _defaults.axesOffsetY) - }, - axesTitlePadding: facetLayout ? { - x: (0, _defaults.axesTitlePaddingFacetX), - y: (0, _defaults.axesTitlePaddingFacetY) - } : { - x: (0, _defaults.axesTitlePaddingX), - y: (0, _defaults.axesTitlePaddingY) - }, - labelBaseline: { - x: 'top', - y: 'middle' - }, - specColumns, - specViewOptions, - axesScopes, - hideZAxis: !!facetLayout, - view: insight.view - }); - } - //add mark to the final scope - if (finalScope.mark) { - const { update } = finalScope.mark.encode; - const outputDataName = 'output'; - finalScope.mark.from.data = outputDataName; - (0, _scope.addData)(globalScope.markGroup, { - name: outputDataName, - source: globalScope.markDataName, - transform: [ - { - type: 'formula', - expr: finalScope.offsets.x, - as: (0, _constants.FieldNames).OffsetX - }, - { - type: 'formula', - expr: finalScope.offsets.y, - as: (0, _constants.FieldNames).OffsetY - } - ] - }); - update.x = { - field: (0, _constants.FieldNames).OffsetX - }; - update.y = { - field: (0, _constants.FieldNames).OffsetY - }; - allEncodingRules.forEach((map)=>{ - for(const key in map)if (update[key]) { - const arrIn = map[key]; - if (!Array.isArray(update[key])) { - const value = update[key]; - const arrOut = []; - update[key] = arrOut; - arrIn.forEach((rule)=>arrOut.push(rule)); - arrOut.push(value); - } else { - const arrOut = update[key]; - arrIn.forEach((rule)=>arrOut.unshift(rule)); - } - } - }); - update.fill = (0, _fill.fill)(specContext, topColorField, (0, _constants.ScaleNames).Color); - update.opacity = (0, _fill.opacity)(specContext); - } - return { - specCapabilities, - vegaSpec - }; - } - initSpec(dataName) { - const { globalSignals } = this; - const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; - const { specContext } = this; - const { insight } = specContext; - const groupMark = { - type: 'group', - //style: 'cell', - encode: { - update: { - x: { - signal: `${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).FacetAxesAdjustX}` - }, - y: { - signal: (0, _constants.SignalNames).PlotOffsetTop - }, - height: { - signal: `${(0, _constants.SignalNames).PlotHeightOut} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - width: { - signal: `${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).FacetAxesAdjustX}` - } - } - } - }; - const inputDataname = 'input'; - const vegaSpec = { - $schema: 'https://vega.github.io/schema/vega/v5.json', - //style: 'cell', - data: [ - { - name: inputDataname - }, - { - name: dataName, - source: inputDataname, - transform: [] - } - ], - marks: [ - groupMark - ], - signals: (0, _signals.textSignals)(specContext, (0, _constants.SignalNames).ViewportHeight).concat([ - minCellWidth, - minCellHeight, - { - name: (0, _constants.SignalNames).ViewportHeight, - update: `max(${(0, _constants.SignalNames).MinCellHeight}, ${insight.size.height})` - }, - { - name: (0, _constants.SignalNames).ViewportWidth, - update: `max(${(0, _constants.SignalNames).MinCellWidth}, ${insight.size.width})` - }, - plotOffsetLeft, - plotOffsetTop, - plotOffsetBottom, - plotOffsetRight, - facetAxesAdjustX, - facetAxesAdjustY, - { - name: (0, _constants.SignalNames).PlotHeightIn, - update: `${(0, _constants.SignalNames).ViewportHeight} - ${(0, _constants.SignalNames).PlotOffsetBottom} + ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - { - name: (0, _constants.SignalNames).PlotWidthIn, - update: `${(0, _constants.SignalNames).ViewportWidth} - ${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).PlotOffsetRight}` - }, - plotHeightOut, - plotWidthOut, - { - name: 'height', - update: `${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).PlotHeightOut} + ${(0, _constants.SignalNames).PlotOffsetBottom} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - { - name: 'width', - update: `${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).PlotOffsetLeft} + ${(0, _constants.SignalNames).PlotOffsetRight}` - } - ]) - }; - return { - vegaSpec, - groupMark - }; - } - iterateLayouts(globalScope, onLayoutBuild) { - let specResult; - let parentScope = { - sizeSignals: globalScope.sizeSignals, - offsets: globalScope.offsets - }; - let firstScope; - let childScope; - const groupings = []; - const { layouts, specCapabilities } = this.props; - const allGlobalScales = []; - const allEncodingRules = []; - for(let i = 0; i < layouts.length; i++){ - if (!parentScope) continue; - const buildProps = { - globalScope, - parentScope, - axesScales: this.props.axisScales, - groupings, - id: i - }; - const layout = this.createLayout(layouts[i], buildProps); - try { - childScope = layout.build(); - childScope.id = i; - const groupby = layout.getGrouping(); - if (groupby) groupings.push({ - id: i, - groupby, - fieldOps: [ - { - field: null, - op: 'count', - as: (0, _constants.FieldNames).Count - } - ] - }); - const sumOp = layout.getAggregateSumOp(); - if (sumOp) groupings[groupings.length - 1].fieldOps.push(sumOp); - onLayoutBuild(i, childScope); - } catch (e) { - specResult = { - errors: [ - e.stack - ], - specCapabilities, - vegaSpec: null - }; - break; - } - if (childScope && childScope.globalScales) allGlobalScales.push(childScope.globalScales); - if (childScope.encodingRuleMap) allEncodingRules.push(childScope.encodingRuleMap); - if (i === 0) firstScope = childScope; - parentScope = childScope; - } - return { - firstScope, - finalScope: parentScope, - specResult, - allGlobalScales, - allEncodingRules - }; - } - createLayout(layoutPair, buildProps) { - const { layoutType, props } = layoutPair; - const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); - const layoutClass = (0, _index.layoutClasses)[layoutType]; - const layout = new layoutClass(layoutBuildProps); - layout.id = buildProps.id; - return layout; - } -} - -},{"./axes":"iTLIR","./color":"gKKJ5","./constants":"22TRA","./defaults":"jpVjH","./facetTitle":"a1RbZ","./fill":"aaLsK","./globalScope":"iaGl2","./scope":"9ojhQ","./signals":"Bq6BR","./layouts/index":"i7uNc","./image":"akfUH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iTLIR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addGlobalAxes", ()=>addGlobalAxes); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -var _scope = require("./scope"); -function addGlobalAxes(props) { - const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; - const { scope } = globalScope; - allGlobalScales.forEach((globalScales)=>{ - const { scales } = globalScales; - for(const xyz in scales){ - const _scales = scales[xyz]; - if (_scales) { - (0, _scope.addScales)(scope, ..._scales); - let { showAxes } = globalScales; - let zindex = undefined; - if (xyz === 'z') { - showAxes = false; - if (props.view === '3d' && specViewOptions.zAxisOptions && !props.hideZAxis) { - if (specViewOptions.zAxisOptions.showZAxis) { - showAxes = true; - zindex = specViewOptions.zAxisOptions.zIndex; - } - } - } - if (showAxes && axisScales) { - const axisScale = axisScales[xyz]; - if (axisScale) { - const lineColor = specViewOptions.colors.axisLine; - const horizontal = xyz === 'x'; - const column = specColumns[xyz] || { - quantitative: true - }; - const title = axisScale.title; - const props = { - title, - horizontal, - column, - specViewOptions, - lineColor, - titlePadding: axesTitlePadding[xyz], - labelBaseline: labelBaseline[xyz], - zindex - }; - axesScopes['main'].forEach((a)=>(0, _scope.addAxes)(a.scope, createAxis(Object.assign(Object.assign({}, props), { - scale: a.scale || _scales[0], - showTitle: a.title, - showLabels: a.labels, - showLines: a.lines - })))); - if (axesScopes[xyz]) axesScopes[xyz].forEach((a)=>(0, _scope.addAxes)(a.scope, createAxis(Object.assign(Object.assign({}, props), { - scale: a.scale || _scales[0], - showTitle: a.title, - showLabels: a.labels, - showLines: a.lines - })))); - if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { - const plotOffsetSignal = plotOffsetSignals[xyz]; - plotOffsetSignal.update = `${axesOffsets[xyz]}`; - } - } - } - } - } - }); -} -function createAxis(props) { - const { column, horizontal, labelBaseline, lineColor, scale, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; - const axis = Object.assign(Object.assign(Object.assign(Object.assign({ - zindex, - scale: scale.name, - orient: horizontal ? 'bottom' : 'left', - domain: showLines, - ticks: showLines - }, showLines && { - domainColor: lineColor, - tickColor: lineColor, - tickSize: specViewOptions.tickSize - }), showTitle && { - title, - titleAlign: horizontal ? 'left' : 'right', - titleAngle: { - signal: horizontal ? (0, _constants.SignalNames).TextAngleX : (0, _constants.SignalNames).TextAngleY - }, - titleColor: specViewOptions.colors.axisText, - titleFontSize: { - signal: (0, _constants.SignalNames).TextTitleSize - }, - titleLimit: (0, _defaults.axesTitleLimit), - titlePadding - }), { - labels: showLabels - }), showLabels && { - labelAlign: horizontal ? 'left' : 'right', - labelBaseline, - labelAngle: { - signal: horizontal ? (0, _constants.SignalNames).TextAngleX : (0, _constants.SignalNames).TextAngleY - }, - labelColor: specViewOptions.colors.axisText, - labelFontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - labelLimit: (0, _defaults.axesLabelLimit) - }); - if (column.quantitative) axis.format = '~r'; - return axis; -} - -},{"./constants":"22TRA","./defaults":"jpVjH","./scope":"9ojhQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ojhQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addAxes", ()=>addAxes); -parcelHelpers.export(exports, "addData", ()=>addData); -parcelHelpers.export(exports, "addMarks", ()=>addMarks); -parcelHelpers.export(exports, "addScales", ()=>addScales); -parcelHelpers.export(exports, "addSignals", ()=>addSignals); -parcelHelpers.export(exports, "addTransforms", ()=>addTransforms); -parcelHelpers.export(exports, "getDataByName", ()=>getDataByName); -parcelHelpers.export(exports, "getGroupBy", ()=>getGroupBy); -parcelHelpers.export(exports, "addOffsets", ()=>addOffsets); -function addAxes(scope, ...axes) { - if (!axes || !axes.length) return; - if (!scope.axes) scope.axes = []; - scope.axes.push(...axes.filter(Boolean)); -} -function addData(scope, ...datas) { - if (!datas || !datas.length) return; - if (!scope.data) scope.data = []; - scope.data.push(...datas.filter(Boolean)); -} -function addMarks(scope, ...marks) { - if (!marks || !marks.length) return; - if (!scope.marks) scope.marks = []; - scope.marks.push(...marks.filter(Boolean)); -} -function addScales(scope, ...scales) { - if (!scales || !scales.length) return; - if (!scope.scales) scope.scales = []; - scope.scales.push(...scales.filter(Boolean)); -} -function addSignals(scope, ...signals) { - if (!signals || !signals.length) return; - if (!scope.signals) scope.signals = []; - scope.signals.push(...signals.filter(Boolean)); -} -function addTransforms(data, ...transforms) { - if (!transforms || !transforms.length) return; - if (!data.transform) data.transform = []; - data.transform.push(...transforms.filter(Boolean)); -} -function getDataByName(data, dataName) { - for(let i = 0; i < data.length; i++){ - if (data[i].name === dataName) return { - data: data[i], - index: i - }; - } -} -function getGroupBy(groupings) { - const groupby = groupings.map((g)=>g.groupby); - return groupby.reduce((acc, val)=>acc.concat(val), []); -} -function addOffsets(...offsets) { - return offsets.filter(Boolean).join(' + '); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gKKJ5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addColor", ()=>addColor); -var _scope = require("./scope"); -var _scales = require("./scales"); -var _signals = require("./signals"); -var _constants = require("./constants"); -var _legends = require("./legends"); -var _top = require("./top"); -function addColor(props) { - const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; - let colorDataName = dataName; - const { insight, specColumns, specViewOptions } = specContext; - const legends = (0, _legends.getLegends)(specContext, scaleName); - if (legends) scope.legends = legends; - const categoricalColor = specColumns.color && !specColumns.color.quantitative; - if (categoricalColor) { - (0, _scope.addData)(scope, ...(0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, (0, _constants.FieldNames).TopColor, (0, _constants.FieldNames).TopIndex)); - colorDataName = legendDataName; - } - if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) { - if (specColumns.color.quantitative) (0, _scope.addScales)(scope, (0, _scales.binnableColorScale)(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); - else (0, _scope.addScales)(scope, { - name: scaleName, - type: 'ordinal', - domain: { - data: colorDataName, - field: (0, _constants.FieldNames).TopColor, - sort: true - }, - range: { - scheme: insight.scheme || (0, _constants.ColorScaleNone) - }, - reverse: { - signal: colorReverseSignalName - } - }); - } - (0, _scope.addSignals)(scope, (0, _signals.colorBinCountSignal)(specContext), (0, _signals.colorReverseSignal)(specContext)); - return { - topColorField: (0, _constants.FieldNames).TopColor, - colorDataName - }; -} - -},{"./scope":"9ojhQ","./scales":"feLP9","./signals":"Bq6BR","./constants":"22TRA","./legends":"7TJVK","./top":"83rkq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"feLP9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "linearScale", ()=>linearScale); -parcelHelpers.export(exports, "pointScale", ()=>pointScale); -parcelHelpers.export(exports, "binnableColorScale", ()=>binnableColorScale); -var _constants = require("./constants"); -var _expr = require("./expr"); -function linearScale(scaleName, domain, range, reverse, zero, nice = true) { - const scale = { - name: scaleName, - type: 'linear', - range, - round: true, - reverse, - domain, - zero, - nice - }; - return scale; -} -function pointScale(scaleName, data, range, field, reverse) { - const scale = { - name: scaleName, - type: 'point', - range, - domain: { - data, - field: (0, _expr.safeFieldName)(field), - sort: true - }, - padding: 0.5 - }; - if (reverse !== undefined) scale.reverse = reverse; - return scale; -} -function binnableColorScale(scaleName, colorBin, data, field, scheme) { - scheme = scheme || (0, _constants.ColorScaleNone); - const domain = { - data, - field: (0, _expr.safeFieldName)(field) - }; - const range = { - scheme - }; - const reverse = { - signal: (0, _constants.SignalNames).ColorReverse - }; - if (colorBin !== 'continuous') range.count = { - signal: (0, _constants.SignalNames).ColorBinCount - }; - switch(colorBin){ - case 'continuous': - { - const sequentialScale = { - name: scaleName, - type: 'linear', - domain, - range, - reverse - }; - return sequentialScale; - } - case 'quantile': - { - const quantileScale = { - name: scaleName, - type: 'quantile', - domain, - range, - reverse - }; - return quantileScale; - } - default: - { - const quantizeScale = { - name: scaleName, - type: 'quantize', - domain, - range, - reverse - }; - return quantizeScale; - } - } -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eSi6o":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * Make sure that the field name is accessible via Vega's Field type - * https://vega.github.io/vega/docs/types/#Field - * examples: "source.x", "target['x']", "[my.field]" - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "safeFieldName", ()=>safeFieldName); -/** - * Make sure the field name is usable in a Vega expression - */ parcelHelpers.export(exports, "exprSafeFieldName", ()=>exprSafeFieldName); -function safeFieldName(field) { - return field.replace(/\\/g, '\\\\') //escape backslashes - .replace(/'/g, '\\\'') //escape single quotes - .replace(/"/g, '\\"') //escape double quotes - .replace(/\./g, '\\.') //escape periods - .replace(/\[/g, '\\[') //escape left square brackets - .replace(/\]/g, '\\]') //escape right square brackets - ; -} -function exprSafeFieldName(field) { - //remove whitespace, period, accessors and logical modifiers - return field.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ''); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Bq6BR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultZProportion", ()=>defaultZProportion); -parcelHelpers.export(exports, "textSignals", ()=>textSignals); -parcelHelpers.export(exports, "colorBinCountSignal", ()=>colorBinCountSignal); -parcelHelpers.export(exports, "colorReverseSignal", ()=>colorReverseSignal); -parcelHelpers.export(exports, "modifySignal", ()=>modifySignal); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -const defaultZProportion = 0.6; -function textSignals(context, heightSignal) { - const { specViewOptions } = context; - const signals = [ - { - name: (0, _constants.SignalNames).ZProportion, - value: defaultZProportion, - bind: { - name: specViewOptions.language.zScaleProportion, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.1, - max: 2, - step: 0.1 - } - }, - { - name: (0, _constants.SignalNames).ZHeight, - update: `${heightSignal} * ${(0, _constants.SignalNames).ZProportion}` - }, - { - name: (0, _constants.SignalNames).TextScale, - value: 1.2, - bind: { - name: specViewOptions.language.textScaleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.5, - max: 2, - step: 0.1 - } - }, - { - name: (0, _constants.SignalNames).TextSize, - update: `${(0, _constants.SignalNames).TextScale} * 10` - }, - { - name: (0, _constants.SignalNames).TextTitleSize, - update: `${(0, _constants.SignalNames).TextScale} * 15` - }, - { - name: (0, _constants.SignalNames).TextAngleX, - value: 30, - bind: { - name: specViewOptions.language.xAxisTextAngleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0, - max: 90, - step: 1 - } - }, - { - name: (0, _constants.SignalNames).TextAngleY, - value: 0, - bind: { - name: specViewOptions.language.yAxisTextAngleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: -90, - max: 0, - step: 1 - } - }, - { - name: (0, _constants.SignalNames).MarkOpacity, - value: 1, - bind: { - name: specViewOptions.language.markOpacitySignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.1, - max: 1, - step: 0.05 - } - } - ]; - return signals; -} -function colorBinCountSignal(context) { - const { specViewOptions } = context; - const signal = { - name: (0, _constants.SignalNames).ColorBinCount, - value: 7, - bind: { - name: specViewOptions.language.colorBinCount, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: specViewOptions.maxLegends + 1, - step: 1 - } - }; - return signal; -} -function colorReverseSignal(context) { - const { specViewOptions } = context; - const signal = { - name: (0, _constants.SignalNames).ColorReverse, - value: false, - bind: { - name: specViewOptions.language.colorReverse, - input: 'checkbox' - } - }; - return signal; -} -function modifySignal(s, fn, update) { - s.update = `${fn}((${s.update}), (${update}))`; -} - -},{"./constants":"22TRA","./defaults":"jpVjH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7TJVK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getLegends", ()=>getLegends); -function legend(column, fill) { - const legend = { - orient: 'none', - title: column.name, - fill, - encode: { - symbols: { - update: { - shape: { - value: 'square' - } - } - } - } - }; - if (column.quantitative) { - legend.type = 'symbol'; - legend.format = '~r'; - } - return legend; -} -function getLegends(context, fill) { - const { specColumns, insight } = context; - if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) return [ - legend(specColumns.color, fill) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"83rkq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "topLookup", ()=>topLookup); -var _constants = require("./constants"); -var _expr = require("./expr"); -function topLookup(column, count, source, legend, lookupName, fieldName, indexName) { - const data = [ - { - name: lookupName, - source, - transform: [ - { - type: 'aggregate', - groupby: [ - (0, _expr.safeFieldName)(column.name) - ] - }, - { - type: 'window', - ops: [ - 'count' - ], - as: [ - indexName - ] - }, - { - type: 'filter', - expr: `datum[${JSON.stringify(indexName)}] <= ${count}` - } - ] - }, - { - name: legend, - source, - transform: [ - { - type: 'lookup', - from: lookupName, - key: (0, _expr.safeFieldName)(column.name), - fields: [ - column.name - ].map((0, _expr.safeFieldName)), - values: [ - column.name - ].map((0, _expr.safeFieldName)), - as: [ - fieldName - ] - }, - { - type: 'formula', - expr: `datum[${JSON.stringify(fieldName)}] == null ? '${(0, _constants.Other)}' : datum[${JSON.stringify(fieldName)}]`, - as: fieldName - } - ] - } - ]; - return data; -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a1RbZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addFacetColRowTitles", ()=>addFacetColRowTitles); -parcelHelpers.export(exports, "addFacetCellTitles", ()=>addFacetCellTitles); -parcelHelpers.export(exports, "addFacetAxesGroupMarks", ()=>addFacetAxesGroupMarks); -parcelHelpers.export(exports, "facetRowHeaderFooter", ()=>facetRowHeaderFooter); -parcelHelpers.export(exports, "facetColumnHeaderFooter", ()=>facetColumnHeaderFooter); -var _scope = require("./scope"); -var _constants = require("./constants"); -function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { - const titleSignal = `parent[${JSON.stringify((0, _constants.FieldNames).FacetTitle)}]`; - const index = `datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1`; - const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index); - const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index); - (0, _scope.addMarks)(globalScope, col.header, row.footer); - (0, _scope.addMarks)(col.header, { - type: 'text', - encode: { - enter: { - align: { - value: 'center' - }, - baseline: { - value: 'middle' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - x: { - signal: `${sizeSignals.layoutWidth} / 2` - }, - limit: { - signal: sizeSignals.layoutWidth - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - text: { - signal: titleSignal - } - } - } - }); - (0, _scope.addMarks)(row.footer, { - type: 'text', - encode: { - enter: { - align: { - value: 'left' - }, - baseline: { - value: 'middle' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - y: { - signal: `${sizeSignals.layoutHeight} / 2` - }, - limit: { - signal: (0, _constants.SignalNames).PlotOffsetRight - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - text: { - signal: titleSignal - } - } - } - }); -} -function addFacetCellTitles(scope, sizeSignals, axisTextColor) { - (0, _scope.addMarks)(scope, { - type: 'text', - encode: { - enter: { - align: { - value: 'center' - }, - baseline: { - value: 'bottom' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - x: { - signal: `(${sizeSignals.layoutWidth}) / 2` - }, - text: { - signal: `parent[${JSON.stringify((0, _constants.FieldNames).FacetTitle)}]` - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - limit: { - signal: sizeSignals.layoutWidth - }, - y: { - signal: `-${(0, _constants.SignalNames).FacetPaddingTop} / 2` - } - } - } - }); -} -function addFacetAxesGroupMarks(props) { - const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; - const { sizeSignals } = facetScope; - const colSequence = createSequence(colSeqName, sizeSignals.colCount); - const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); - const index = 'datum.data'; - const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index); - const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index); - (0, _scope.addData)(globalScope, colSequence, rowSequence); - (0, _scope.addMarks)(globalScope, col.footer, row.header); - (0, _scope.addScales)(globalScope, colTitleScale, rowTitleScale); - const map = { - main: [ - { - scope: facetScope.facetScope, - lines: true, - labels: false, - title: false - } - ], - x: [ - { - scope: col.footer, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: colTitleScale, - lines: false, - labels: false, - title: true - } - ], - y: [ - { - scope: row.header, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: rowTitleScale, - lines: false, - labels: false, - title: true - } - ] - }; - return map; -} -function facetRowHeaderFooter(data, sizeSignals, index) { - const rowFn = (xSignal)=>{ - return { - type: 'group', - from: { - data - }, - encode: { - update: { - x: { - signal: xSignal - }, - y: { - signal: `${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).FacetPaddingTop} + (${index}) * (${sizeSignals.layoutHeight} + ${(0, _constants.SignalNames).FacetPaddingTop} + ${(0, _constants.SignalNames).FacetPaddingBottom})` - }, - height: { - signal: sizeSignals.layoutHeight - } - } - } - }; - }; - const header = rowFn((0, _constants.SignalNames).PlotOffsetLeft); - const footer = rowFn(`${(0, _constants.SignalNames).PlotOffsetLeft} + ${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).PlotOffsetRight} / 2`); - return { - header, - footer - }; -} -function facetColumnHeaderFooter(data, sizeSignals, index) { - const colFn = (ySignal)=>{ - return { - type: 'group', - from: { - data - }, - encode: { - update: { - x: { - signal: `(${index}) * (${sizeSignals.layoutWidth} + ${(0, _constants.SignalNames).FacetPaddingLeft}) + ${(0, _constants.SignalNames).FacetPaddingLeft} + ${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).FacetAxesAdjustX}` - }, - y: { - signal: `${ySignal} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - width: { - signal: sizeSignals.layoutWidth - } - } - } - }; - }; - //create group marks based on data sequences - const header = colFn(`${(0, _constants.SignalNames).PlotOffsetTop} / 2`); - const footer = colFn(`${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).PlotHeightOut}`); - return { - header, - footer - }; -} -function createSequence(dataName, countSignal) { - return { - name: dataName, - transform: [ - { - type: 'sequence', - start: 0, - stop: { - signal: countSignal - } - } - ] - }; -} - -},{"./scope":"9ojhQ","./constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aaLsK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fill", ()=>fill); -parcelHelpers.export(exports, "opacity", ()=>opacity); -var _constants = require("./constants"); -var _expr = require("./expr"); -function fill(context, colorFieldName, scale) { - const { specColumns, insight, specViewOptions } = context; - const colorColumn = specColumns.color; - return colorColumn ? colorColumn.isColorData || insight.directColor ? { - field: (0, _expr.safeFieldName)(colorColumn.name) - } : { - scale, - field: colorColumn.quantitative ? (0, _expr.safeFieldName)(colorColumn.name) : colorFieldName - } : { - value: specViewOptions.colors.defaultCube - }; -} -function opacity(context) { - const result = { - signal: (0, _constants.SignalNames).MarkOpacity - }; - return result; -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iaGl2":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GlobalScope", ()=>GlobalScope); -var _constants = require("./constants"); -var _scope = require("./scope"); -class GlobalScope { - constructor(props){ - const { dataName, markGroup, scope, signals } = props; - this.scope = scope; - this._markGroup = markGroup; - this.signals = signals; - this.data = (0, _scope.getDataByName)(scope.data, dataName).data; - this._markDataName = dataName; - this.offsets = { - x: '0', - y: '0', - h: (0, _constants.SignalNames).PlotHeightIn, - w: (0, _constants.SignalNames).PlotWidthIn - }; - this.sizeSignals = { - layoutHeight: (0, _constants.SignalNames).PlotHeightIn, - layoutWidth: (0, _constants.SignalNames).PlotWidthIn - }; - this.zSize = (0, _constants.SignalNames).PlotHeightIn; - } - get markDataName() { - return this._markDataName; - } - setMarkDataName(markDataName) { - this._markDataName = markDataName; - } - get markGroup() { - return this._markGroup; - } - setMarkGroup(markGroup) { - this._markGroup = markGroup; - } -} - -},{"./constants":"22TRA","./scope":"9ojhQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i7uNc":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "layoutClasses", ()=>layoutClasses); -var _aggregateContainer = require("./aggregateContainer"); -var _aggregateSquare = require("./aggregateSquare"); -var _band = require("./band"); -var _cross = require("./cross"); -var _scatter = require("./scatter"); -var _square = require("./square"); -var _stack = require("./stack"); -var _strip = require("./strip"); -var _treemap = require("./treemap"); -var _wrap = require("./wrap"); -const layoutClasses = { - AggregateContainer: (0, _aggregateContainer.AggregateContainer), - AggregateSquare: (0, _aggregateSquare.AggregateSquare), - Band: (0, _band.Band), - Cross: (0, _cross.Cross), - Scatter: (0, _scatter.Scatter), - Square: (0, _square.Square), - Stack: (0, _stack.Stack), - Strip: (0, _strip.Strip), - Treemap: (0, _treemap.Treemap), - Wrap: (0, _wrap.Wrap) -}; - -},{"./aggregateContainer":"23lsA","./aggregateSquare":"ksGXP","./band":"3pFuA","./cross":"iXWbC","./scatter":"eLCwq","./square":"5vsTh","./stack":"l09WI","./strip":"7mPSq","./treemap":"caw7y","./wrap":"iDL5r","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"23lsA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AggregateContainer", ()=>AggregateContainer); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class AggregateContainer extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const a = this.aggregation = this.getAggregation(); - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a}_extent`, - scale: `scale_${p}`, - extentData: `data_${p}_extent`, - offsets: `data_${p}_offsets` - }; - } - getAggregateSumOp() { - if (this.aggregation === 'sum') { - const fieldOp = { - field: (0, _expr.safeFieldName)(this.props.sumBy.name), - op: 'sum', - as: (0, _constants.FieldNames).Sum - }; - return fieldOp; - } - } - build() { - const { aggregation, names, props } = this; - const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; - (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), { - as: [ - names.aggregateField - ] - }), { - type: 'extent', - field: (0, _expr.safeFieldName)(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - (0, _scope.addSignals)(globalScope.scope, { - name: props.globalAggregateMaxExtentSignal, - update: `${names.globalAggregateExtentSignal}[1]` - }); - const horizontal = dock === 'left'; - const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; - const offsets = { - x: parentScope.offsets.x, - y: (0, _scope.addOffsets)(parentScope.offsets.y, dock === 'bottom' ? groupScaled : ''), - h: horizontal ? parentScope.offsets.h : dock === 'top' ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, - w: horizontal ? groupScaled : parentScope.offsets.w - }; - const scale = { - type: 'linear', - name: names.scale, - domain: [ - 0, - { - signal: props.globalAggregateMaxExtentSignal - } - ], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ], - nice: niceScale, - zero: true, - reverse: dock === 'top' - }; - const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; - (0, _scope.addSignals)(globalScope.scope, { - name: props.globalAggregateMaxExtentScaledSignal, - update: dock === 'bottom' ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue - }); - return { - offsets, - sizeSignals: horizontal ? { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: null - } : { - layoutHeight: null, - layoutWidth: parentScope.sizeSignals.layoutWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? [ - scale - ] : undefined, - y: horizontal ? undefined : [ - scale - ] - } - }, - encodingRuleMap: horizontal ? { - x: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.x - } - ], - width: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } : { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: dock === 'top' ? parentScope.offsets.y : (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.offsets.h) - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: 'joinaggregate', - groupby: groupby.map((0, _expr.safeFieldName)), - ops: [ - aggregation - ] - }; - if (aggregation === 'sum') trans.fields = [ - this.props.sumBy.name - ].map((0, _expr.safeFieldName)); - return trans; - } - getAggregation() { - const { props } = this; - let s; - if (props.dock === 'left') s = props.axesScales.x; - else s = props.axesScales.y; - switch(s.aggregate){ - case 'sum': - return 'sum'; - default: - return 'count'; - } - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i2QIi":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Layout", ()=>Layout); -class Layout { - constructor(props){ - this.props = props; - this.id = props.id; - } - getGrouping() { - return null; - } - getAggregateSumOp() { - return null; - } - build() { - throw 'Not implemented'; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ef2qR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "testForCollapseSelection", ()=>testForCollapseSelection); -var _constants = require("./constants"); -function testForCollapseSelection() { - return `datum.${(0, _constants.FieldNames).Collapsed}`; -} - -},{"./constants":"22TRA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ksGXP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AggregateSquare", ()=>AggregateSquare); -var _layout = require("./layout"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class AggregateSquare extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const a = this.props.aggregation; - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a}_extent`, - extentData: `data_${p}_extent` - }; - } - build() { - const { names, props } = this; - const { aggregation, globalScope, groupings, onBuild, parentScope } = props; - const { sizeSignals } = parentScope; - (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), { - as: [ - names.aggregateField - ] - }), { - type: 'extent', - field: (0, _expr.safeFieldName)(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; - const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; - const squareMaxArea = `(${[ - squareMaxSide, - squareMaxSide - ].join(' * ')})`; - const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; - const squareArea = `(${[ - squareMaxArea, - shrinkRatio - ].join(' * ')})`; - const squareSide = `sqrt(${squareArea})`; - const localAggregateMaxExtentScaled = squareSide; - onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), - h: squareSide, - w: squareSide - }; - return { - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: offsets.y - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: 'joinaggregate', - groupby: groupby.map((0, _expr.safeFieldName)), - ops: [ - aggregation - ] - }; - if (aggregation === 'sum') trans.fields = [ - this.props.sumBy.name - ].map((0, _expr.safeFieldName)); - return trans; - } -} - -},{"./layout":"i2QIi","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3pFuA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bandScaleLinearSuffix", ()=>bandScaleLinearSuffix); -parcelHelpers.export(exports, "Band", ()=>Band); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _signals = require("../signals"); -var _scales = require("../scales"); -const bandScaleLinearSuffix = '_linear'; -class Band extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `band_${this.id}`; - this.names = { - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - bandWidth: `${p}_bandwidth`, - accumulative: `${p}_accumulative` - }; - this.bin = (0, _bin.binnable)(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); - } - getGrouping() { - return this.bin.fields; - } - build() { - const { bin, names, props } = this; - const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; - const binField = bin.fields[0]; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - } - //TODO don't add this, use existing dataset - (0, _scope.addData)(globalScope.scope, { - name: names.accumulative, - source: bin.fullScaleDataname, - transform: [ - { - type: 'aggregate', - groupby: this.getGrouping().map((0, _expr.safeFieldName)), - ops: [ - 'count' - ] - } - ] - }); - const horizontal = orientation === 'horizontal'; - const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; - (0, _signals.modifySignal)(minCellSignal, 'max', `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); - (0, _scope.addSignals)(globalScope.scope, { - name: names.bandWidth, - update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` - }); - const scale = this.getScale(bin, horizontal); - if (props.outerSignalExtents && bin.native === false) //add a linear scale for use by background image - (0, _scope.addScales)(globalScope.scope, (0, _scales.linearScale)(scale.name + bandScaleLinearSuffix, { - signal: bin.extentSignal - }, scale.range, scale.reverse, false, false)); - let encodingRuleMap; - if (!props.excludeEncodingRuleMap) encodingRuleMap = horizontal ? { - x: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.x - } - ], - width: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } : { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.offsets.h) - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - }; - return { - offsets: this.getOffset(horizontal, binField), - sizeSignals: horizontal ? { - layoutHeight: names.bandWidth, - layoutWidth: parentScope.sizeSignals.layoutWidth - } : { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: names.bandWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? undefined : [ - scale - ], - y: horizontal ? [ - scale - ] : undefined - } - }, - encodingRuleMap - }; - } - getOffset(horizontal, binField) { - const { names, props } = this; - const { parentScope } = props; - return { - x: (0, _scope.addOffsets)(parentScope.offsets.x, horizontal ? '' : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ''), - h: horizontal ? names.bandWidth : parentScope.offsets.h, - w: horizontal ? parentScope.offsets.w : names.bandWidth - }; - } - getScale(bin, horizontal) { - const { names } = this; - const { parentScope } = this.props; - const binField = (0, _expr.safeFieldName)(bin.fields[0]); - let bandScale; - if (horizontal) bandScale = { - type: 'band', - name: names.yScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutHeight - } - ], - padding: 0.1, - domain: { - data: bin.domainDataName, - field: binField, - sort: true - }, - reverse: true - }; - else bandScale = { - type: 'band', - name: names.xScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ], - padding: 0.1, - domain: { - data: bin.domainDataName, - field: binField, - sort: true - } - }; - return bandScale; - } -} - -},{"./layout":"i2QIi","../bin":"2ZuOQ","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../signals":"Bq6BR","../scales":"feLP9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2ZuOQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "binnable", ()=>binnable); -parcelHelpers.export(exports, "outerExtentSignal", ()=>outerExtentSignal); -parcelHelpers.export(exports, "shouldBeIntegralBinStep", ()=>shouldBeIntegralBinStep); -var _constants = require("./constants"); -var _expr = require("./expr"); -var _defaults = require("./defaults"); -var _transforms = require("./transforms"); -function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { - const { column, defaultBins, maxbins, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; - if (column.quantitative) { - const field = `${prefix}_bin_${(0, _expr.exprSafeFieldName)(column.name)}`; - const fieldEnd = `${field}_end`; - const binSignal = `${field}_bins`; - const dataExtentSignal = `${field}_bin_extent`; - const dataExtentSpanSignal = `${field}_bin_extent_span`; - const outerSignal = `${field}_outer_extent`; - domainDataName = `${field}_sequence`; //override the data name - const extentTransform = (0, _transforms.dataExtent)(column, dataExtentSignal); - let imageSignal; - if (outerSignalExtents) imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); - const maxbinsSignal = { - name: maxbinsSignalName, - value: defaultBins, - bind: { - name: maxbinsSignalDisplayName, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: maxbins, - step: 1 - } - }; - const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; - const binTransform = { - type: 'bin', - field: (0, _expr.safeFieldName)(column.name), - as: [ - field, - fieldEnd - ], - signal: binSignal, - extent: { - signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` - }, - minstep: shouldBeIntegralBinStep(column) ? 1 : 0, - maxbins: { - signal: maxbinsSignalName - } - }; - const dataSequence = { - name: domainDataName, - transform: [ - { - type: 'sequence', - start: { - signal: `${binSignal}.start` - }, - stop: { - signal: `${binSignal}.stop` - }, - step: { - signal: `${binSignal}.step` - } - }, - { - type: 'formula', - expr: 'datum.data', - as: field - }, - { - type: 'formula', - expr: `datum.data + ${binSignal}.step`, - as: fieldEnd - }, - { - type: 'window', - ops: [ - 'row_number' - ], - as: [ - (0, _constants.FieldNames).Ordinal - ] - }, - { - type: 'formula', - expr: `datum.data === ${binSignal}.start`, - as: (0, _constants.FieldNames).First - }, - { - type: 'formula', - expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, - as: (0, _constants.FieldNames).Last - }, - { - // when there is only one bin, use only first sequence element - type: 'filter', - expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify((0, _constants.FieldNames).First)}] : true` - } - ] - }; - const signals = [ - maxbinsSignal, - { - name: dataExtentSpanSignal, - update: `${extentSignal}[1] - ${extentSignal}[0]` - } - ]; - if (imageSignal) signals.push(imageSignal); - const augmentBinnable = { - discreteColumn, - native: false, - transforms: [ - extentTransform, - binTransform - ], - fields: [ - field, - fieldEnd - ], - binSignal, - extentSignal, - dataSequence, - domainDataName, - signals, - fullScaleDataname: dataSequence.name - }; - return augmentBinnable; - } else { - const nativeBinnable = { - discreteColumn, - native: true, - fields: [ - column.name - ], - domainDataName, - fullScaleDataname: domainDataName - }; - return nativeBinnable; - } -} -function outerExtentSignal(name, min, max, dataExtent) { - return { - name, - update: `[min(${min}, ${dataExtent}[0]), max(${max}, ${dataExtent}[1])]` - }; -} -function shouldBeIntegralBinStep(column) { - //prevent Vega from showing ".5" steps between integer scale values - return column.quantitative && column.type === 'integer' && column.stats.max - column.stats.min <= 7; -} - -},{"./constants":"22TRA","./expr":"eSi6o","./defaults":"jpVjH","./transforms":"iZfe4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iZfe4":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dataExtent", ()=>dataExtent); -var _expr = require("./expr"); -function dataExtent(column, signal) { - return { - type: 'extent', - field: (0, _expr.safeFieldName)(column.name), - signal - }; -} - -},{"./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iXWbC":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cross", ()=>Cross); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _constants = require("../constants"); -var _facetSearch = require("../facetSearch"); -var _facetTitle = require("../facetTitle"); -var _ordinal = require("../ordinal"); -var _scope = require("../scope"); -var _signals = require("../signals"); -class Cross extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `cross_${this.id}`; - this.binX = (0, _bin.binnable)(`${p}_x`, props.globalScope.data.name, props.groupbyX); - this.binY = (0, _bin.binnable)(`${p}_y`, props.globalScope.data.name, props.groupbyY); - this.names = { - facetDataName: `data_${p}_facet`, - searchUnion: `data_${p}_search`, - dimScale: `scale_${p}`, - dimCount: `${p}_count`, - dimCategorical: `data_${p}_cat`, - dimCellSize: `${p}_cell_size`, - dimCellSizeCalc: `${p}_cell_calc` - }; - } - getGrouping() { - return this.binX.fields.concat(this.binY.fields); - } - build() { - const { binX, binY, names, prefix, props } = this; - const { axisTextColor, colRowTitles, globalScope, parentScope } = props; - const titles = { - x: { - dataName: null, - quantitative: null - }, - y: { - dataName: null, - quantitative: null - } - }; - const dx = { - dim: 'x', - bin: binX, - sortOrder: 'ascending', - size: parentScope.sizeSignals.layoutWidth, - layout: parentScope.sizeSignals.layoutWidth, - min: globalScope.signals.minCellWidth.name, - out: globalScope.signals.plotWidthOut, - offset: (0, _constants.SignalNames).FacetPaddingLeft, - padding: (0, _constants.SignalNames).FacetPaddingLeft, - dataOut: null, - scaleName: null, - position: null - }; - const dy = { - dim: 'y', - bin: binY, - sortOrder: 'ascending', - size: parentScope.sizeSignals.layoutHeight, - layout: parentScope.sizeSignals.layoutHeight, - min: globalScope.signals.minCellHeight.name, - out: globalScope.signals.plotHeightOut, - offset: (0, _constants.SignalNames).FacetPaddingTop, - padding: `(${(0, _constants.SignalNames).FacetPaddingTop} + ${(0, _constants.SignalNames).FacetPaddingBottom})`, - dataOut: null, - scaleName: null, - position: null - }; - const dimensions = [ - dx, - dy - ]; - dimensions.forEach((d)=>{ - const { bin, dim, padding, sortOrder } = d; - let data; - let dataName; - let countSignal; - let scale; - const titleSource = titles[dim]; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - (0, _scope.addTransforms)(bin.dataSequence, { - type: 'formula', - expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, - as: (0, _constants.FieldNames).Contains - }); - data = bin.dataSequence; - dataName = bin.dataSequence.name; - countSignal = `length(data(${JSON.stringify(dataName)}))`; - scale = (0, _ordinal.ordinalScale)(dataName, `${names.dimScale}_${dim}`, bin.fields); - titleSource.dataName = bin.dataSequence.name; - } else { - dataName = globalScope.markDataName; - const ord = (0, _ordinal.createOrdinals)(dataName, `${prefix}_${dim}`, bin.fields, sortOrder); - data = ord.data; - (0, _scope.addData)(globalScope.scope, ord.data); - countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; - scale = ord.scale; - titleSource.dataName = ord.data.name; - } - titleSource.quantitative = bin.discreteColumn.column.quantitative; - d.dataOut = data; - d.scaleName = scale.name; - (0, _scope.addTransforms)(data, { - type: 'formula', - expr: (0, _facetSearch.serializeAsVegaExpression)(bin, (0, _constants.FieldNames).First, (0, _constants.FieldNames).Last), - as: (0, _constants.FieldNames).FacetSearch - }, { - type: 'formula', - expr: (0, _facetSearch.displayBin)(bin), - as: (0, _constants.FieldNames).FacetTitle - }); - (0, _scope.addScales)(globalScope.scope, scale); - const count = `${names.dimCount}_${dim}`; - const calc = `${names.dimCellSizeCalc}_${dim}`; - const size = `${names.dimCellSize}_${dim}`; - (0, _scope.addSignals)(globalScope.scope, { - name: count, - update: countSignal - }); - (0, _scope.addSignals)(globalScope.scope, { - name: calc, - update: `${d.layout} / ${count}` - }, { - name: size, - update: `max(${d.min}, (${calc} - ${padding}))` - }); - (0, _signals.modifySignal)(d.out, 'max', `((${size} + ${padding}) * ${count})`); - d.position = this.dimensionOffset(d); - }); - const groupRow = { - type: 'group', - encode: { - update: { - y: { - signal: dy.position - } - } - }, - from: { - data: dy.dataOut.name - }, - data: [ - { - name: names.searchUnion, - source: dx.dataOut.name, - transform: [ - { - type: 'formula', - expr: `[datum[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}], merge(parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}], { clause: '&&'})]`, - as: (0, _constants.FieldNames).FacetSearch - } - ] - } - ] - }; - const groupCol = { - style: 'cell', - name: prefix, - type: 'group', - encode: { - update: { - height: { - signal: `${names.dimCellSize}_y` - }, - width: { - signal: `${names.dimCellSize}_x` - }, - x: { - signal: dx.position - } - } - }, - from: { - data: names.searchUnion - } - }; - (0, _scope.addMarks)(globalScope.markGroup, groupRow); - (0, _scope.addMarks)(groupRow, groupCol); - const offsets = { - x: this.dimensionOffset(dx), - y: this.dimensionOffset(dy), - h: `${names.dimCellSize}_y`, - w: `${names.dimCellSize}_x` - }; - const sizeSignals = { - layoutHeight: `${names.dimCellSize}_y`, - layoutWidth: `${names.dimCellSize}_x`, - colCount: `${names.dimCount}_x`, - rowCount: `${names.dimCount}_y` - }; - if (colRowTitles) (0, _facetTitle.addFacetColRowTitles)(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); - return { - facetScope: groupCol, - offsets, - sizeSignals, - titles - }; - } - dimensionOffset(d) { - const { names } = this; - return `${d.offset} + (scale(${JSON.stringify(d.scaleName)}, datum[${JSON.stringify(d.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d.dim} + ${d.padding})`; - } -} - -},{"./layout":"i2QIi","../bin":"2ZuOQ","../constants":"22TRA","../facetSearch":"7jRmp","../facetTitle":"a1RbZ","../ordinal":"hxe8x","../scope":"9ojhQ","../signals":"Bq6BR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7jRmp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "displayBin", ()=>displayBin); -parcelHelpers.export(exports, "serializeAsVegaExpression", ()=>serializeAsVegaExpression); -function displayBin(bin) { - const val = (index)=>`datum[${JSON.stringify(bin.fields[index])}]`; - return bin.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); -} -function obj(nameValues, clause) { - if (clause) nameValues = [ - clause, - ...nameValues - ]; - return `{${nameValues.join()}}`; -} -function serializeAsVegaExpression(bin, firstFieldName, lastFieldName, clause) { - if (bin.discreteColumn.column.quantitative) { - const low = [ - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'>=\'', - `value:datum[${JSON.stringify(bin.fields[0])}]` - ]; - const high = [ - 'clause:\'&&\'', - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'<\'', - `value:datum[${JSON.stringify(bin.fields[1])}]` - ]; - return obj([ - `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]` - ], clause); - } else { - const exact = [ - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'==\'', - `value:datum[${JSON.stringify(bin.fields[0])}]` - ]; - return obj([ - `expressions:[${obj(exact)}]` - ], clause); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hxe8x":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createOrdinals", ()=>createOrdinals); -parcelHelpers.export(exports, "ordinalScale", ()=>ordinalScale); -var _constants = require("./constants"); -var _expr = require("./expr"); -function createOrdinals(source, prefix, binFields, sortOrder) { - const _binFields = binFields.map((0, _expr.safeFieldName)); - const dataName = `${prefix}_bin_order`; - const data = { - name: dataName, - source, - transform: [ - { - type: 'aggregate', - groupby: _binFields - }, - { - type: 'collect', - sort: { - field: _binFields, - order: _binFields.map((f)=>sortOrder) - } - }, - { - type: 'window', - ops: [ - 'row_number' - ], - as: [ - (0, _constants.FieldNames).Ordinal - ] - } - ] - }; - return { - data, - scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) - }; -} -function ordinalScale(dataName, scaleName, binFields) { - return { - type: 'ordinal', - name: scaleName, - domain: { - data: dataName, - field: (0, _expr.safeFieldName)(binFields[0]) - }, - range: { - data: dataName, - field: (0, _constants.FieldNames).Ordinal - } - }; -} - -},{"./constants":"22TRA","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eLCwq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scatter", ()=>Scatter); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _expr = require("../expr"); -var _scales = require("../scales"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _transforms = require("../transforms"); -var _bin = require("../bin"); -class Scatter extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `scatter_${this.id}`; - this.names = { - aggregateData: `data_${p}_aggregate`, - markData: `data_${p}_mark`, - xDataExtent: `${p}_xDataExtent`, - yDataExtent: `${p}_yDataExtent`, - xExtent: `${p}_xExtent`, - yExtent: `${p}_yExtent`, - sizeExtent: `${p}_sizeExtent`, - sizeRange: `${p}_sizeRange`, - sizeScale: `${p}_sizeScale`, - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x, y, z, zGrounded } = props; - const qsize = size && size.quantitative && size; - (0, _scope.addSignals)(globalScope.scope, { - name: (0, _constants.SignalNames).PointScale, - value: 5, - bind: { - name: scatterPointScaleDisplay, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: 10, - step: 0.1 - } - }, { - name: (0, _constants.SignalNames).ZGrounded, - value: false, - bind: { - name: zGrounded, - input: 'checkbox' - } - }); - if (backgroundImageExtents) { - (0, _scope.addTransforms)(globalScope.data, (0, _transforms.dataExtent)(x, names.xDataExtent), (0, _transforms.dataExtent)(y, names.yDataExtent)); - const xSignal = (0, _bin.outerExtentSignal)(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); - const ySignal = (0, _bin.outerExtentSignal)(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); - (0, _scope.addSignals)(globalScope.scope, xSignal, ySignal); - } - if (qsize) { - (0, _scope.addTransforms)(globalScope.data, { - type: 'extent', - field: (0, _expr.safeFieldName)(qsize.name), - signal: names.sizeExtent - }); - (0, _scope.addScales)(globalScope.scope, { - name: names.sizeScale, - type: 'pow', - exponent: 0.5, - domain: [ - 0, - { - signal: `${names.sizeExtent}[1]` - } - ], - range: [ - 0, - { - signal: names.sizeRange - } - ] - }); - (0, _scope.addSignals)(globalScope.scope, { - name: names.sizeRange, - update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${(0, _defaults.scatterSizedDiv)}` - }); - } - (0, _scope.addData)(globalScope.scope, { - name: names.markData, - source: globalScope.markDataName, - transform: [ - x, - y, - z - ].map((c)=>{ - if (!c || !c.quantitative) return; - const t = { - type: 'filter', - expr: `isValid(datum[${JSON.stringify(c.name)}])` - }; - return t; - }).filter(Boolean) - }); - globalScope.setMarkDataName(names.markData); - const globalScales = { - showAxes, - scales: {} - }; - const zValue = z ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z.name)}])` : null; - const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${(0, _constants.SignalNames).PointScale}` : (0, _constants.SignalNames).PointScale; - const update = Object.assign({ - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: sizeValueSignal - } - ], - width: { - signal: sizeValueSignal - } - }, z && { - z: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: `${(0, _constants.SignalNames).ZGrounded} ? 0 : ${zValue}` - } - ], - zindex: [ - { - signal: `${(0, _constants.SignalNames).ZGrounded} ? 0 : ${zValue}` - } - ], - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: view === '3d' ? `${(0, _constants.SignalNames).ZGrounded} ? ${zValue} : ${sizeValueSignal}` : '0' - } - ] - }); - const columnSignals = [ - { - column: x, - xyz: 'x', - scaleName: names.xScale, - domain: backgroundImageExtents ? { - signal: names.xExtent - } : { - data: globalScope.data.name, - field: (0, _expr.safeFieldName)(x.name) - }, - reverse: false, - signal: parentScope.sizeSignals.layoutWidth - }, - { - column: y, - xyz: 'y', - scaleName: names.yScale, - domain: backgroundImageExtents ? { - signal: names.yExtent - } : { - data: globalScope.data.name, - field: (0, _expr.safeFieldName)(y.name) - }, - reverse: true, - signal: parentScope.sizeSignals.layoutHeight - }, - { - column: z, - xyz: 'z', - scaleName: names.zScale, - domain: { - data: globalScope.data.name, - field: z ? (0, _expr.safeFieldName)(z.name) : null - }, - reverse: false, - signal: view === '3d' ? `(${globalScope.zSize}) * ${(0, _constants.SignalNames).ZProportion}` : `10 * ${(0, _constants.SignalNames).ZProportion}` - } - ]; - columnSignals.forEach((cs)=>{ - const { column, domain, reverse, scaleName, signal, xyz } = cs; - if (!column) return; - let scale; - if (column.quantitative) { - scale = (0, _scales.linearScale)(scaleName, domain, [ - 0, - { - signal - } - ], reverse, false, showAxes); - if ((0, _bin.shouldBeIntegralBinStep)(column)) scale.bins = { - step: 1 - }; - } else scale = (0, _scales.pointScale)(scaleName, globalScope.data.name, [ - 0, - { - signal - } - ], column.name, reverse); - globalScales.scales[xyz] = [ - scale - ]; - }); - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - return { - offsets: { - x: (0, _scope.addOffsets)(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x.name)}])`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y.name)}]) - ${sizeValueSignal}`), - h: sizeValueSignal, - w: sizeValueSignal - }, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - globalScales, - mark, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) - } - ] - } - }; - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../defaults":"jpVjH","../expr":"eSi6o","../scales":"feLP9","../scope":"9ojhQ","../selection":"ef2qR","../transforms":"iZfe4","../bin":"2ZuOQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5vsTh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Square", ()=>Square); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Square extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `square_${this.id}`; - this.names = { - bandWidth: this.getBandWidth(), - maxGroupField: `${p}_max_group`, - maxGroupSignal: `${p}_max_grouping`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - (0, _scope.addTransforms)(globalScope.data, Object.assign({ - type: 'stack', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - as: [ - names.stack0, - names.stack1 - ] - }, sortBy && { - sort: { - field: (0, _expr.safeFieldName)(sortBy.name), - order: 'ascending' - } - })); - const { gap, levelSize, size, squaresPerBand } = this.addSignals(); - const heightSignal = { - signal: fillDirection === 'down-right' ? size : levelSize - }; - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update: Object.assign({ - height: collapseYHeight ? [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - heightSignal - ] : heightSignal, - width: { - signal: fillDirection === 'down-right' ? levelSize : size - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - const { tx, ty } = this.transformXY(gap, levelSize, squaresPerBand); - return Object.assign(Object.assign(Object.assign({}, z && { - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - } - }), { - offsets: { - x: (0, _scope.addOffsets)(parentScope.offsets.x, tx.expr), - y: (0, _scope.addOffsets)(parentScope.offsets.y, ty.expr), - h: size, - w: size - }, - mark, - sizeSignals: { - layoutHeight: size, - layoutWidth: size - } - }), collapseYHeight && { - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.y - } - ] - } - }); - } - getBandWidth() { - const { offsets } = this.props.parentScope; - switch(this.props.fillDirection){ - case 'down-right': - return offsets.h; - default: - return offsets.w; - } - } - addSignals() { - const { names, props } = this; - const { fillDirection, globalScope, groupings, parentScope } = props; - let { maxGroupedFillSize, maxGroupedUnits } = props; - if (!maxGroupedUnits) { - if (groupings) { - (0, _scope.addTransforms)(globalScope.data, { - type: 'joinaggregate', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - ops: [ - 'count' - ], - as: [ - names.maxGroupField - ] - }, { - type: 'extent', - field: names.maxGroupField, - signal: names.maxGroupSignal - }); - maxGroupedUnits = `(${names.maxGroupSignal}[1])`; - } else maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; - } - if (!maxGroupedFillSize) maxGroupedFillSize = fillDirection === 'down-right' ? parentScope.offsets.w : parentScope.offsets.h; - const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; - const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; - const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; - const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; - const levels = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; - const levelSize = `(((${maxGroupedFillSize}) / ${levels}) - ${gap})`; - return { - gap, - levelSize, - size, - squaresPerBand - }; - } - transformXY(gap, levelSize, squaresPerBand) { - const { names, prefix } = this; - const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; - const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; - const { fillDirection, parentScope } = this.props; - const tx = { - type: 'formula', - expr: null, - as: `${prefix}_${(0, _constants.FieldNames).OffsetX}` - }; - const ty = { - type: 'formula', - expr: null, - as: `${prefix}_${(0, _constants.FieldNames).OffsetY}` - }; - switch(fillDirection){ - case 'down-right': - tx.expr = `${level} * (${levelSize} + ${gap})`; - ty.expr = compartment; - break; - case 'right-up': - tx.expr = compartment; - ty.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; - break; - case 'right-down': - default: - tx.expr = compartment; - ty.expr = `${level} * (${levelSize} + ${gap})`; - break; - } - return { - tx, - ty - }; - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../zBase":"iUpjg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUpjg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addZScale", ()=>addZScale); -var _constants = require("./constants"); -var _scales = require("./scales"); -var _expr = require("./expr"); -function addZScale(z, zSize, dataName, zScaleName) { - if (z) { - const zRange = [ - 0, - { - signal: `(${zSize}) * ${(0, _constants.SignalNames).ZProportion}` - } - ]; - const scale = z.quantitative ? (0, _scales.linearScale)(zScaleName, { - data: dataName, - field: (0, _expr.safeFieldName)(z.name) - }, zRange, false, true) : (0, _scales.pointScale)(zScaleName, dataName, zRange, z.name, false); - return scale; - } -} - -},{"./constants":"22TRA","./scales":"feLP9","./expr":"eSi6o","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l09WI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Stack", ()=>Stack); -var _layout = require("./layout"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class Stack extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `stack_${this.id}`; - this.names = { - cube: `${p}_cube`, - globalDataName: `data_${p}_count`, - globalExtent: `${p}_global_extent`, - levelDataName: `data_${p}_level`, - count: `${p}_count`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - sequence: `data_${p}_sequence`, - sides: `${p}_sides`, - size: `${p}_size`, - squared: `${p}_squared`, - maxCount: `${p}_maxCount`, - maxLevels: `${p}_maxLevels`, - zScale: `${p}_zScale` - }; - } - build() { - const { names, props } = this; - const { globalScope, groupings, parentScope, showAxes, sort } = props; - const { sizeSignals } = parentScope; - (0, _scope.addTransforms)(globalScope.data, { - type: 'joinaggregate', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - ops: [ - 'count' - ], - as: [ - names.count - ] - }, { - type: 'extent', - field: names.count, - signal: names.globalExtent - }, Object.assign({ - type: 'stack', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - as: [ - names.stack0, - names.stack1 - ] - }, sort && { - sort: { - field: (0, _expr.safeFieldName)(sort.name), - order: 'ascending' - } - })); - (0, _scope.addData)(globalScope.scope, { - name: names.sequence, - transform: [ - { - type: 'sequence', - start: 1, - stop: { - signal: `sqrt(${names.globalExtent}[1])` - } - }, - { - type: 'formula', - expr: 'datum.data * datum.data', - as: 'squared' - }, - { - type: 'formula', - expr: `ceil(${names.globalExtent}[1] / datum.squared)`, - as: 'maxlevels' - }, - { - type: 'formula', - expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, - as: 'side' - }, - { - type: 'formula', - expr: 'datum.side * datum.maxlevels + datum.maxlevels - 1', - as: 'sidecubeheight' - }, - { - type: 'formula', - expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, - as: 'heightmatch' - }, - { - type: 'collect', - sort: { - field: 'heightmatch', - order: 'ascending' - } - }, - { - type: 'window', - ops: [ - 'row_number' - ] - }, - { - type: 'filter', - expr: 'datum.row_number === 1' - } - ] - }); - (0, _scope.addSignals)(globalScope.scope, { - name: names.size, - update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` - }, { - name: names.squared, - update: `data('${names.sequence}')[0].squared` - }, { - name: names.sides, - update: `sqrt(${names.squared})` - }, { - name: names.cube, - update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` - }, { - name: names.maxLevels, - update: `data('${names.sequence}')[0].maxlevels` - }, { - name: names.maxCount, - update: `${names.maxLevels} * ${names.squared}` - }); - const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; - const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; - const cubeX = `(${layerOrdinal} % ${names.sides})`; - const cubeY = `floor(${layerOrdinal} / ${names.sides})`; - const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; - const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), - h: names.size, - w: names.size - }; - const mark = { - type: 'rect', - from: { - data: this.names.levelDataName - }, - encode: { - update: { - z: { - signal: `${zLevel} * (${names.cube} + 1)` - }, - height: { - signal: names.cube - }, - width: { - signal: names.cube - }, - depth: { - signal: names.cube - } - } - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - const zScale = { - type: 'linear', - name: names.zScale, - domain: [ - 0, - { - signal: names.maxCount - } - ], - range: [ - 0, - { - signal: `${names.maxLevels} * (${names.cube} + 1) - 1` - } - ], - nice: false - }; - return { - offsets, - mark, - sizeSignals: { - layoutHeight: names.size, - layoutWidth: names.size - }, - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - }, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.y - } - ], - z: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ], - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } -} - -},{"./layout":"i2QIi","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7mPSq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Strip", ()=>Strip); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Strip extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `strip_${this.id}`; - this.names = { - firstField: `${p}${(0, _constants.FieldNames).First}`, - lastField: `${p}${(0, _constants.FieldNames).Last}`, - valueField: `${p}${(0, _constants.FieldNames).Value}`, - scale: `scale_${p}`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort, sortOrder, parentScope, view, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - const horizontal = orientation === 'horizontal'; - const transform = []; - if (sort) transform.push({ - type: 'collect', - sort: { - field: (0, _expr.safeFieldName)(sort.name), - order: sortOrder - } - }); - let stackField; - if (size) { - stackField = size.name; - transform.push({ - type: 'filter', - expr: `datum[${JSON.stringify(size.name)}] > 0` - }); - } else { - stackField = names.valueField; - transform.push({ - type: 'formula', - expr: '1', - as: stackField - }); - } - const stackTransform = { - type: 'stack', - field: (0, _expr.safeFieldName)(stackField), - offset: 'normalize', - as: [ - names.firstField, - names.lastField - ] - }; - if (groupings.length) stackTransform.groupby = (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)); - transform.push(stackTransform); - (0, _scope.addTransforms)(globalScope.data, ...transform); - const span = [ - names.lastField, - names.firstField - ].map((f)=>`datum[${JSON.stringify(f)}]`).join(' - '); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ''), - y: (0, _scope.addOffsets)(parentScope.offsets.y, horizontal ? '' : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), - h: horizontal ? parentScope.offsets.h : `(${span}) * (${parentScope.offsets.h})`, - w: horizontal ? `(${span}) * (${parentScope.offsets.w})` : parentScope.offsets.w - }; - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update: Object.assign({ - height: { - signal: offsets.h - }, - width: { - signal: offsets.w - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - let percentageScale; - if (addPercentageScale) percentageScale = [ - { - type: 'linear', - name: names.scale, - domain: [ - 0, - 100 - ], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ] - } - ]; - return { - globalScales: { - showAxes, - scales: { - x: horizontal ? percentageScale : undefined, - y: horizontal ? undefined : percentageScale, - z: zScale && [ - zScale - ] - } - }, - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - mark - }; - } -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../zBase":"iUpjg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"caw7y":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Treemap", ()=>Treemap); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Treemap extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `treemap_${this.id}`; - this.names = { - dataName: `data_${p}`, - dataHeightWidth: `data_${p}_hw`, - dataExtents: `data_${p}_extents`, - dataFacet: `data_${p}_facet`, - dataFacetMark: `data_${p}_facetMark`, - fieldChildren: `${p}_children`, - fieldDepth: `${p}_depth`, - fieldX0: `${p}_x0`, - fieldX1: `${p}_x1`, - fieldY0: `${p}_y0`, - fieldY1: `${p}_y1`, - fieldHeight: `${p}_h`, - fieldWidth: `${p}_w`, - heightExtent: `${p}_heightExtent`, - widthExtent: `${p}_widthExtent`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, props } = this; - const { globalScope, parentScope, showAxes, treeMapMethod, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, fn(names.fieldX0)), - y: (0, _scope.addOffsets)(parentScope.offsets.y, fn(names.fieldY0)), - h: subtract(names.fieldY1, names.fieldY0), - w: subtract(names.fieldX1, names.fieldX0) - }; - const mark = this.transformedMark(offsets); - (0, _scope.addSignals)(globalScope.scope, { - name: (0, _constants.SignalNames).TreeMapMethod, - value: 'squarify', - bind: { - name: treeMapMethod, - input: 'select', - options: [ - 'squarify', - 'binary' - ] - } - }); - return Object.assign(Object.assign({}, z && { - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - } - }), { - mark, - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - } - }); - } - transformedMark(offsets) { - const { names, props } = this; - const { globalScope, groupings, parentScope } = props; - if (groupings.length) { - //treemap transform can't have it's boundary size grouped, so we need to facet the data. - (0, _scope.addData)(globalScope.scope, { - name: names.dataHeightWidth, - source: globalScope.markDataName, - transform: [ - { - type: 'formula', - expr: parentScope.offsets.h, - as: names.fieldHeight - }, - { - type: 'formula', - expr: parentScope.offsets.w, - as: names.fieldWidth - } - ] - }); - const treemapData = { - name: names.dataFacetMark, - source: names.dataFacet - }; - const facets = { - type: 'group', - from: { - facet: { - name: names.dataFacet, - data: names.dataHeightWidth, - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)) - } - }, - data: [ - { - name: names.dataExtents, - source: names.dataFacet, - transform: [ - { - type: 'extent', - field: names.fieldHeight, - signal: names.heightExtent - }, - { - type: 'extent', - field: names.fieldWidth, - signal: names.widthExtent - } - ] - }, - treemapData - ] - }; - globalScope.setMarkDataName(names.dataFacetMark); - (0, _scope.addMarks)(globalScope.markGroup, facets); - //assign new markgroup after adding mark to original group - globalScope.setMarkGroup(facets); - this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); - return this.addMark(offsets, facets, globalScope.markDataName); - } else { - this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); - return this.addMark(offsets, globalScope.markGroup, globalScope.markDataName); - } - } - addMark(offsets, markParent, markDataName) { - const { names, prefix, props } = this; - const { view, z } = props; - const mark = { - name: prefix, - type: 'rect', - from: { - data: markDataName - }, - encode: { - update: Object.assign({ - width: { - signal: offsets.w - }, - height: { - signal: offsets.h - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(markParent, mark); - return mark; - } - treemapTransform(treemapData, widthSignal, heightSignal) { - const { names, props } = this; - const { group, size } = props; - (0, _scope.addTransforms)(treemapData, { - type: 'filter', - expr: `datum[${JSON.stringify(size.name)}] > 0` - }, { - type: 'nest', - keys: [ - group && group.name || '__NONE__' - ] - }, { - type: 'treemap', - field: (0, _expr.safeFieldName)(size.name), - sort: { - field: 'value', - order: 'descending' - }, - round: true, - method: { - signal: (0, _constants.SignalNames).TreeMapMethod - }, - paddingInner: 1, - paddingOuter: 0, - size: [ - { - signal: widthSignal - }, - { - signal: heightSignal - } - ], - as: [ - names.fieldX0, - names.fieldY0, - names.fieldX1, - names.fieldY1, - names.fieldDepth, - names.fieldChildren - ] - }); - } -} -function fn(n) { - return `datum[${JSON.stringify(n)}]`; -} -function subtract(...fields) { - return fields.map((n)=>fn(n)).join(' - '); -} - -},{"./layout":"i2QIi","../constants":"22TRA","../expr":"eSi6o","../scope":"9ojhQ","../selection":"ef2qR","../zBase":"iUpjg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iDL5r":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Wrap", ()=>Wrap); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _facetSearch = require("../facetSearch"); -var _facetTitle = require("../facetTitle"); -var _ordinal = require("../ordinal"); -var _scope = require("../scope"); -var _signals = require("../signals"); -class Wrap extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `wrap_${this.id}`; - this.bin = (0, _bin.binnable)(this.prefix, props.globalScope.data.name, props.groupby); - this.names = { - outputData: `data_${p}_out`, - rowColumnDataName: `data_${p}_row_col`, - cellHeight: `${p}_cellHeight`, - cellWidth: `${p}_cellWidth`, - fits: `${p}_fits`, - target: `${p}_target`, - minArea: `${p}_minArea`, - aspect: `${p}_aspect`, - minAspect: `${p}_minAspect`, - idealAspect: `${p}_idealAspect`, - dataLength: `${p}_dataLength`, - rxc0: `${p}_rxc0`, - rxc1: `${p}_rxc1`, - rxc2: `${p}_rxc2`, - rxc: `${p}_rxc`, - growColCount: `${p}_growColCount`, - growCellWidth: `${p}_growCellWidth`, - fitsArea: `${p}_fitsArea`, - colCount: `${p}_colCount` - }; + return { + axisScales, + layouts, + specCapabilities: { + backgroundImage: true, + countsAndSums: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function grid(specContext) { + var _a2; + const { insight, specColumns } = specContext; + const { view } = insight; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + collapseYHeight: true, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + return { + axisScales, + layouts: [ + { + layoutType: "Square", + props: squareProps + } + ], + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "z", + axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function scatterplot(specContext) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; + const { insight, specColumns, specViewOptions } = specContext; + const backgroundImageExtents = ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) && ((_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.quantitative) && ((_c2 = insight.backgroundImage) === null || _c2 === void 0 ? void 0 : _c2.extents); + const scatterProps = { + x: specColumns.x, + y: specColumns.y, + z: specColumns.z, + size: specColumns.size, + scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, + zGrounded: specViewOptions.language.zGrounded, + backgroundImageExtents, + showAxes: !(backgroundImageExtents || insight.hideAxes), + view: insight.view + }; + const axisScales = { + x: { title: (_d2 = specColumns.x) === null || _d2 === void 0 ? void 0 : _d2.name }, + y: { title: (_e2 = specColumns.y) === null || _e2 === void 0 ? void 0 : _e2.name }, + z: { title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name } + }; + return { + axisScales, + layouts: [ + { + layoutType: "Scatter", + props: scatterProps + } + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact" + }, + { + role: "y", + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact" + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: false + }, + { + role: "color", + allowNone: true + }, + { + role: "size", + excludeCategoric: true, + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.PointScale, SignalNames.ZGrounded] + } + }; + } + function stacks(specContext) { + var _a2, _b2, _c2, _d2, _e2, _f, _g; + const { insight, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.name }, + y: { title: (_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.name }, + z: { title: specViewOptions.language.count } + }; + const backgroundImage = ((_c2 = specColumns.x) === null || _c2 === void 0 ? void 0 : _c2.quantitative) && ((_d2 = specColumns.y) === null || _d2 === void 0 ? void 0 : _d2.quantitative) && ((_e2 = insight.backgroundImage) === null || _e2 === void 0 ? void 0 : _e2.extents) && insight.backgroundImage; + const showAxes = !(backgroundImage || insight.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } + }; + const stackProps = { + sort: specColumns.sort, + showAxes + }; + return { + axisScales, + customZScale: true, + layouts: [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "Stack", + props: stackProps + } + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function strips(specContext) { + var _a2; + const { insight, specColumns } = specContext; + const { view } = insight; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: specColumns.size ? "sum" : "count" + }; + const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; + const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); } - getGrouping() { - return this.bin.fields; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + allowNone: true, + //size by none is a count + excludeCategoric: true + }, + { + role: "z", + axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function treemap$1(specContext) { + var _a2; + const { insight, specColumns, specViewOptions } = specContext; + const { view } = insight; + const treemapProps = { + corner: "top-left", + group: specColumns.group, + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes: !insight.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: "sum" + }; + const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; + const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); } - build() { - const { bin, names, prefix, props } = this; - const { axisTextColor, cellTitles, globalScope, parentScope } = props; - let ordinalBinData; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - (0, _scope.addTransforms)(bin.dataSequence, { - type: 'formula', - expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, - as: (0, _constants.FieldNames).Contains - }); - ordinalBinData = bin.dataSequence.name; - } else { - const ord = (0, _ordinal.createOrdinals)(globalScope.data.name, prefix, bin.fields, 'ascending'); - (0, _scope.addData)(globalScope.scope, ord.data); - ordinalBinData = ord.data.name; - } - (0, _scope.addData)(globalScope.scope, { - name: names.rxc0, - transform: [ - { - type: 'sequence', - start: 1, - stop: { - signal: `ceil(sqrt(${names.dataLength})) + 1` - } - }, - { - type: 'formula', - expr: `ceil(${names.dataLength} / datum.data)`, - as: 'complement' - } - ] - }, { - name: names.rxc1, - source: names.rxc0, - transform: [ - { - type: 'project', - fields: [ - 'data' - ], - as: [ - 'cols' - ] - } - ] - }, { - name: names.rxc2, - source: names.rxc0, - transform: [ - { - type: 'project', - fields: [ - 'complement' - ], - as: [ - 'cols' - ] - } - ] - }, { - name: names.rxc, - source: [ - names.rxc1, - names.rxc2 - ], - transform: [ - { - type: 'formula', - expr: `ceil(${names.dataLength} / datum.cols)`, - as: 'rows' - }, - { - type: 'formula', - expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, - as: 'cellw' - }, - { - type: 'formula', - expr: `datum.cols === 1 ? max(datum.cellw, ${(0, _constants.SignalNames).MinCellWidth}) : datum.cellw`, - as: 'cellw' - }, - { - type: 'formula', - expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, - as: 'cellh' - }, - { - type: 'formula', - expr: `datum.rows === 1 ? max(datum.cellh, ${(0, _constants.SignalNames).MinCellHeight}) : datum.cellh`, - as: 'cellh' - }, - { - type: 'formula', - expr: `(datum.cellw >= ${(0, _constants.SignalNames).MinCellWidth} && datum.cellh >= ${(0, _constants.SignalNames).MinCellHeight})`, - as: 'meetsmin' - }, - { - type: 'filter', - expr: 'datum.meetsmin' - }, - { - type: 'formula', - expr: 'datum.cellw / datum.cellh', - as: names.aspect - }, - { - type: 'formula', - expr: `abs(datum.${names.aspect} - ${names.target})`, - as: names.idealAspect - }, - { - type: 'formula', - expr: `${names.dataLength} / (datum.cols * datum.rows)`, - as: 'coverage' - }, - { - type: 'collect', - sort: { - field: [ - names.idealAspect, - 'coverage' - ], - order: [ - 'ascending', - 'descending' - ] - } - } - ] - }, { - name: names.rowColumnDataName, - source: ordinalBinData, - transform: [ - { - type: 'formula', - expr: `floor((datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1) / ${names.colCount})`, - as: (0, _constants.FieldNames).WrapRow - }, - { - type: 'formula', - expr: `(datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1) % ${names.colCount}`, - as: (0, _constants.FieldNames).WrapCol - }, - { - type: 'formula', - expr: (0, _facetSearch.serializeAsVegaExpression)(bin, (0, _constants.FieldNames).First, (0, _constants.FieldNames).Last), - as: (0, _constants.FieldNames).FacetSearch - }, - { - type: 'formula', - expr: (0, _facetSearch.displayBin)(bin), - as: (0, _constants.FieldNames).FacetTitle - } - ] - }); - const dataOut = { - name: names.outputData, - source: globalScope.data.name, - transform: [ - { - type: 'lookup', - from: names.rowColumnDataName, - key: (0, _expr.safeFieldName)(bin.fields[0]), - fields: [ - bin.fields[0] - ].map((0, _expr.safeFieldName)), - values: [ - (0, _constants.FieldNames).WrapRow, - (0, _constants.FieldNames).WrapCol - ] - } - ] - }; - (0, _scope.addData)(globalScope.scope, dataOut); - globalScope.setMarkDataName(names.outputData); - (0, _scope.addSignals)(globalScope.scope, { - name: names.minAspect, - update: `${(0, _constants.SignalNames).MinCellWidth} / ${(0, _constants.SignalNames).MinCellHeight}` - }, { - name: names.target, - update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}` - }, { - name: names.minArea, - update: `${(0, _constants.SignalNames).MinCellWidth}*${(0, _constants.SignalNames).MinCellHeight}` - }, { - name: names.aspect, - update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` - }, { - name: names.dataLength, - update: `data(${JSON.stringify(ordinalBinData)}).length` - }, { - name: names.growColCount, - update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${(0, _constants.SignalNames).MinCellWidth}), 1)` - }, { - name: names.growCellWidth, - update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` - }, { - name: names.fitsArea, - update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` - }, { - name: names.fits, - update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` - }, { - name: names.colCount, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` - }, { - name: names.cellWidth, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` - }, { - name: names.cellHeight, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${(0, _constants.SignalNames).MinCellHeight}` - }); - (0, _signals.modifySignal)(globalScope.signals.plotHeightOut, 'max', `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); - (0, _signals.modifySignal)(globalScope.signals.plotWidthOut, 'max', `(${names.cellWidth} * ${names.colCount})`); - const signalH = [ - names.cellHeight, - (0, _constants.SignalNames).FacetPaddingTop, - (0, _constants.SignalNames).FacetPaddingBottom - ].join(' - '); - const signalW = [ - names.cellWidth, - (0, _constants.SignalNames).FacetPaddingLeft - ].join(' - '); - const signalX = (0, _scope.addOffsets)(parentScope.offsets.x, `datum[${JSON.stringify((0, _constants.FieldNames).WrapCol)}] * ${names.cellWidth}`, (0, _constants.SignalNames).FacetPaddingLeft); - const signalY = (0, _scope.addOffsets)(parentScope.offsets.y, `datum[${JSON.stringify((0, _constants.FieldNames).WrapRow)}] * ${names.cellHeight}`, (0, _constants.SignalNames).FacetPaddingTop); - const update = { - height: { - signal: signalH - }, - width: { - signal: signalW - }, - x: { - signal: signalX - }, - y: { - signal: signalY - } - }; - const offsets = { - x: signalX, - y: signalY, - h: signalH, - w: signalW - }; - const group = { - style: 'cell', - name: prefix, - type: 'group', - from: { - data: names.rowColumnDataName - }, - encode: { - update - } - }; - (0, _scope.addMarks)(globalScope.markGroup, group); - const sizeSignals = { - layoutHeight: `(${names.cellHeight} - ${(0, _constants.SignalNames).FacetPaddingTop} - ${(0, _constants.SignalNames).FacetPaddingBottom})`, - layoutWidth: `(${names.cellWidth} - ${(0, _constants.SignalNames).FacetPaddingLeft})`, - colCount: names.colCount, - rowCount: `ceil(${names.dataLength} / ${names.colCount})` - }; - if (cellTitles) (0, _facetTitle.addFacetCellTitles)(group, sizeSignals, axisTextColor); - return { - facetScope: group, - sizeSignals, - offsets + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + excludeCategoric: true + }, + { + role: "group", + allowNone: true + }, + { + role: "z", + axisSelection: ((_a2 = specColumns.z) === null || _a2 === void 0 ? void 0 : _a2.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.TreeMapMethod] + } + }; + } + function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { + let layoutPair; + const groupby = facetColumn; + const plotPadding = { + x: 0, + y: 0 + }; + let facetPadding; + switch (facetStyle) { + case "cross": { + const props = { + axisTextColor, + colRowTitles: true, + groupbyX: groupby, + groupbyY: facetVColumn + }; + layoutPair = { + layoutType: "Cross", + props + }; + facetPadding = { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: 0 + }; + plotPadding.y = facetPaddingTop; + plotPadding.x = facetPaddingRight; + break; + } + case "wrap": + default: { + const props = { + axisTextColor, + cellTitles: true, + groupby + }; + layoutPair = { + layoutType: "Wrap", + props + }; + facetPadding = { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: facetPaddingTop }; + break; + } } -} - -},{"./layout":"i2QIi","../bin":"2ZuOQ","../constants":"22TRA","../expr":"eSi6o","../facetSearch":"7jRmp","../facetTitle":"a1RbZ","../ordinal":"hxe8x","../scope":"9ojhQ","../signals":"Bq6BR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"akfUH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getImageMark", ()=>getImageMark); -var _band = require("./layouts/band"); -function getImageMark(backgroundImage, allGlobalScales) { - const xScale = allGlobalScales.filter((s)=>s.scales.x)[0].scales.x[0]; - const yScale = allGlobalScales.filter((s)=>s.scales.y)[0].scales.y[0]; - const [xScaleName, yScaleName] = [ - xScale, - yScale - ].map((s)=>s.name + (xScale.type === 'band' ? (0, _band.bandScaleLinearSuffix) : '')); + const facetLayout = { + facetPadding, + plotPadding + }; return { - type: 'image', - encode: { - update: { - url: { - value: backgroundImage.url - }, - aspect: { - value: false - }, - baseline: { - value: 'bottom' - }, - height: { - signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) - }, - y: { - signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) - }, - width: { - signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) - }, - x: { - signal: getScaledValue(xScaleName, backgroundImage.extents.left) - } - } - } + layoutPair, + facetLayout }; -} -function getScaledSpan(scaleName, low, high) { - return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; -} -function getScaledValue(scaleName, value) { - return `scale('${scaleName}', ${value})`; -} - -},{"./layouts/band":"3pFuA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d6Ht8":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NHSP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4F93b":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _compare = require("./compare"); -parcelHelpers.exportAll(_compare, exports); -var _exec = require("./exec"); -parcelHelpers.exportAll(_exec, exports); -var _group = require("./group"); -parcelHelpers.exportAll(_group, exports); -var _invert = require("./invert"); -parcelHelpers.exportAll(_invert, exports); -var _narrow = require("./narrow"); -parcelHelpers.exportAll(_narrow, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./compare":"lDdGy","./exec":"ekkGf","./group":"4OkbD","./invert":"DMPkf","./narrow":"jhXKW","./types":"eHpZP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lDdGy":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "compareExpression", ()=>compareExpression); -parcelHelpers.export(exports, "compareGroup", ()=>compareGroup); -parcelHelpers.export(exports, "compare", ()=>compare); -parcelHelpers.export(exports, "startsWith", ()=>startsWith); -var _group = require("./group"); -const expressionKeys = Object.keys({ - clause: null, - name: null, - operator: null, - value: null -}); -function compareExpression(a, b) { - if (a && b) for(let k = 0; k < expressionKeys.length; k++){ - const key = expressionKeys[k]; - if (a[key] != b[key]) return false; - } - else return !a && !b; - return true; -} -const groupKeys = Object.keys({ - clause: null -}); -function compareGroup(a, b) { - for(let k = 0; k < groupKeys.length; k++){ - const key = groupKeys[k]; - if (a[key] != b[key]) return false; - } - if (!a.expressions && !b.expressions) return true; - if (!a.expressions || !b.expressions) return false; - if (a.expressions.length != b.expressions.length) return false; - for(let i = 0; i < a.expressions.length; i++){ - if (!compareExpression(a.expressions[i], b.expressions[i])) return false; + } + const map$4 = { + barchart: barchartV, + barchartH, + barchartV, + density, + grid, + scatterplot, + stacks, + strips, + treemap: treemap$1 + }; + function getSpecBuilderPropsForChart(specContext) { + const { insight, specColumns, specViewOptions } = specContext; + const fn2 = map$4[insight.chart]; + if (fn2) { + const props = fn2(specContext); + if (insight.columns.facet) { + const discreteFacetColumn = { + column: specColumns.facet, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, + maxbinsSignalName: SignalNames.FacetBins + }; + const discreteFacetVColumn = { + column: specColumns.facetV, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, + maxbinsSignalName: SignalNames.FacetVBins + }; + const { facetLayout, layoutPair } = getFacetLayout(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); + props.layouts.unshift(layoutPair); + props.facetLayout = facetLayout; + props.collapseFacetAxes = specViewOptions.collapseFacetAxes; + } + return props; } - return true; -} -function compare(a, b) { - if (a == b) return true; - if (!a || !b) return false; - const arrs = [ - a, - b - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [arrA, arrB] = arrs; - if (arrA.length != arrB.length) return false; - for(let i = 0; i < arrA.length; i++){ - if (!compareGroup(arrA[i], arrB[i])) return false; + } + function define2(constructor, factory, prototype2) { + constructor.prototype = factory.prototype = prototype2; + prototype2.constructor = constructor; + } + function extend$1(parent, definition2) { + var prototype2 = Object.create(parent.prototype); + for (var key2 in definition2) prototype2[key2] = definition2[key2]; + return prototype2; + } + function Color$2() { + } + var darker = 0.7; + var brighter = 1 / darker; + var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + var named = { + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 + }; + define2(Color$2, color$2, { + copy(channels) { + return Object.assign(new this.constructor(), this, channels); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, + // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + function color_formatHex() { + return this.rgb().formatHex(); + } + function color_formatHex8() { + return this.rgb().formatHex8(); + } + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + function color_formatRgb() { + return this.rgb().formatRgb(); + } + function color$2(format2) { + var m2, l; + format2 = (format2 + "").trim().toLowerCase(); + return (m2 = reHex.exec(format2)) ? (l = m2[1].length, m2 = parseInt(m2[1], 16), l === 6 ? rgbn(m2) : l === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; + } + function rgbn(n) { + return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); + } + function rgba(r, g, b2, a2) { + if (a2 <= 0) r = g = b2 = NaN; + return new Rgb(r, g, b2, a2); + } + function rgbConvert(o) { + if (!(o instanceof Color$2)) o = color$2(o); + if (!o) return new Rgb(); + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } + function rgb$1(r, g, b2, opacity2) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b2, opacity2 == null ? 1 : opacity2); + } + function Rgb(r, g, b2, opacity2) { + this.r = +r; + this.g = +g; + this.b = +b2; + this.opacity = +opacity2; + } + define2(Rgb, rgb$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); + }, + hex: rgb_formatHex, + // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + function rgb_formatRgb() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`; + } + function clampa(opacity2) { + return isNaN(opacity2) ? 1 : Math.max(0, Math.min(1, opacity2)); + } + function clampi(value2) { + return Math.max(0, Math.min(255, Math.round(value2) || 0)); + } + function hex(value2) { + value2 = clampi(value2); + return (value2 < 16 ? "0" : "") + value2.toString(16); + } + function hsla(h2, s2, l, a2) { + if (a2 <= 0) h2 = s2 = l = NaN; + else if (l <= 0 || l >= 1) h2 = s2 = NaN; + else if (s2 <= 0) h2 = NaN; + return new Hsl(h2, s2, l, a2); + } + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color$2)) o = color$2(o); + if (!o) return new Hsl(); + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, min2 = Math.min(r, g, b2), max2 = Math.max(r, g, b2), h2 = NaN, s2 = max2 - min2, l = (max2 + min2) / 2; + if (s2) { + if (r === max2) h2 = (g - b2) / s2 + (g < b2) * 6; + else if (g === max2) h2 = (b2 - r) / s2 + 2; + else h2 = (r - g) / s2 + 4; + s2 /= l < 0.5 ? max2 + min2 : 2 - max2 - min2; + h2 *= 60; + } else { + s2 = l > 0 && l < 1 ? 0 : h2; } - return true; -} -function startsWith(whole, part) { - if (!part) return true; - const arrs = [ - whole, - part - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [wholeArray, partArray] = arrs; - if (partArray.length > wholeArray.length) return false; - for(let i = 0; i < partArray.length; i++){ - if (!compareGroup(wholeArray[i], partArray[i])) return false; + return new Hsl(h2, s2, l, o.opacity); + } + function hsl$1(h2, s2, l, opacity2) { + return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l, opacity2 == null ? 1 : opacity2); + } + function Hsl(h2, s2, l, opacity2) { + this.h = +h2; + this.s = +s2; + this.l = +l; + this.opacity = +opacity2; + } + define2(Hsl, hsl$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s2, m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2), + hsl2rgb(h2, m1, m2), + hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2), + this.opacity + ); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); + }, + formatHsl() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`; + } + })); + function clamph(value2) { + value2 = (value2 || 0) % 360; + return value2 < 0 ? value2 + 360 : value2; + } + function clampt(value2) { + return Math.max(0, Math.min(1, value2 || 0)); + } + function hsl2rgb(h2, m1, m2) { + return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255; + } + const radians$1 = Math.PI / 180; + const degrees$2 = 180 / Math.PI; + const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0$2 = 4 / 29, t1$1 = 6 / 29, t2 = 3 * t1$1 * t1$1, t3 = t1$1 * t1$1 * t1$1; + function labConvert(o) { + if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); + if (o instanceof Hcl) return hcl2lab(o); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b2 = rgb2lrgb(o.b), y2 = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b2) / Yn), x2, z2; + if (r === g && g === b2) x2 = z2 = y2; + else { + x2 = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b2) / Xn); + z2 = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b2) / Zn); } - return true; -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4OkbD":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isSearchExpressionGroup", ()=>isSearchExpressionGroup); -parcelHelpers.export(exports, "createGroupFromExpression", ()=>createGroupFromExpression); -parcelHelpers.export(exports, "ensureSearchExpressionGroupArray", ()=>ensureSearchExpressionGroupArray); -function isSearchExpressionGroup(search) { - if (!search) return false; - return !!search.expressions; -} -function createGroupFromExpression(input) { - const output = { - expressions: [ - input - ] - }; - return output; -} -function ensureSearchExpressionGroupArray(search) { - if (Array.isArray(search)) return [ - ...search - ]; - else if (isSearchExpressionGroup(search)) return [ - search - ]; - else return [ - createGroupFromExpression(search) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ekkGf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Exec", ()=>Exec); -var _group = require("./group"); -function valueToBoolean(value) { - if (typeof value === 'string') switch(value.toLowerCase()){ - case 'true': - return true; - case 'false': - return false; + return new Lab(116 * y2 - 16, 500 * (x2 - y2), 200 * (y2 - z2), o.opacity); + } + function lab$1(l, a2, b2, opacity2) { + return arguments.length === 1 ? labConvert(l) : new Lab(l, a2, b2, opacity2 == null ? 1 : opacity2); + } + function Lab(l, a2, b2, opacity2) { + this.l = +l; + this.a = +a2; + this.b = +b2; + this.opacity = +opacity2; + } + define2(Lab, lab$1, extend$1(Color$2, { + brighter(k) { + return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + darker(k) { + return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + rgb() { + var y2 = (this.l + 16) / 116, x2 = isNaN(this.a) ? y2 : y2 + this.a / 500, z2 = isNaN(this.b) ? y2 : y2 - this.b / 200; + x2 = Xn * lab2xyz(x2); + y2 = Yn * lab2xyz(y2); + z2 = Zn * lab2xyz(z2); + return new Rgb( + lrgb2rgb(3.1338561 * x2 - 1.6168667 * y2 - 0.4906146 * z2), + lrgb2rgb(-0.9787684 * x2 + 1.9161415 * y2 + 0.033454 * z2), + lrgb2rgb(0.0719453 * x2 - 0.2289914 * y2 + 1.4052427 * z2), + this.opacity + ); } - return !!value; -} -function valueToString(value) { - if (value == null) return ''; - switch(typeof value){ - case 'string': - return value; - case 'boolean': - case 'number': - return value.toString(); - } - return ''; -} -function isStringOperation(ex) { - switch(ex.operator){ - case 'contains': - case '!contains': - case 'starts': - case '!starts': - return true; + })); + function xyz2lab(t) { + return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$2; + } + function lab2xyz(t) { + return t > t1$1 ? t * t * t : t2 * (t - t0$2); + } + function lrgb2rgb(x2) { + return 255 * (x2 <= 31308e-7 ? 12.92 * x2 : 1.055 * Math.pow(x2, 1 / 2.4) - 0.055); + } + function rgb2lrgb(x2) { + return (x2 /= 255) <= 0.04045 ? x2 / 12.92 : Math.pow((x2 + 0.055) / 1.055, 2.4); + } + function hclConvert(o) { + if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); + if (!(o instanceof Lab)) o = labConvert(o); + if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); + var h2 = Math.atan2(o.b, o.a) * degrees$2; + return new Hcl(h2 < 0 ? h2 + 360 : h2, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); + } + function hcl$1(h2, c2, l, opacity2) { + return arguments.length === 1 ? hclConvert(h2) : new Hcl(h2, c2, l, opacity2 == null ? 1 : opacity2); + } + function Hcl(h2, c2, l, opacity2) { + this.h = +h2; + this.c = +c2; + this.l = +l; + this.opacity = +opacity2; + } + function hcl2lab(o) { + if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); + var h2 = o.h * radians$1; + return new Lab(o.l, Math.cos(h2) * o.c, Math.sin(h2) * o.c, o.opacity); + } + define2(Hcl, hcl$1, extend$1(Color$2, { + brighter(k) { + return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); + }, + darker(k) { + return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); + }, + rgb() { + return hcl2lab(this).rgb(); } - return false; -} -function isnullorEmpty(value) { - if (value == null) return true; //double equal sign to also catch undefined - if (typeof value === 'string' && value.length === 0) return true; - return false; -} -class Exec { - constructor(search, columns){ - this.columns = columns; - this.groups = (0, _group.ensureSearchExpressionGroupArray)(search).map((g)=>{ - const expressions = g.expressions.filter(Boolean); - expressions.forEach((ex)=>{ - ex.column = this.getColumn(ex.name); - ex.valueBool = valueToBoolean(ex.value); - ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); - ex.stringOperation = isStringOperation(ex); - }); - const group = Object.assign(Object.assign({}, g), { - expressions - }); - return group; - }); + })); + var A = -0.14861, B$1 = 1.78277, C$1 = -0.29227, D$1 = -0.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C$1 - D$1 * A; + function cubehelixConvert(o) { + if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, l = (BC_DA * b2 + ED * r - EB * g) / (BC_DA + ED - EB), bl2 = b2 - l, k = (E * (g - l) - C$1 * bl2) / D$1, s2 = Math.sqrt(k * k + bl2 * bl2) / (E * l * (1 - l)), h2 = s2 ? Math.atan2(k, bl2) * degrees$2 - 120 : NaN; + return new Cubehelix(h2 < 0 ? h2 + 360 : h2, s2, l, o.opacity); + } + function cubehelix$1(h2, s2, l, opacity2) { + return arguments.length === 1 ? cubehelixConvert(h2) : new Cubehelix(h2, s2, l, opacity2 == null ? 1 : opacity2); + } + function Cubehelix(h2, s2, l, opacity2) { + this.h = +h2; + this.s = +s2; + this.l = +l; + this.opacity = +opacity2; + } + define2(Cubehelix, cubehelix$1, extend$1(Color$2, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = isNaN(this.h) ? 0 : (this.h + 120) * radians$1, l = +this.l, a2 = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh2 = Math.cos(h2), sinh2 = Math.sin(h2); + return new Rgb( + 255 * (l + a2 * (A * cosh2 + B$1 * sinh2)), + 255 * (l + a2 * (C$1 * cosh2 + D$1 * sinh2)), + 255 * (l + a2 * (E * cosh2)), + this.opacity + ); } - getColumn(name) { - for(let i = 0; i < this.columns.length; i++){ - if (this.columns[i].name == name) return this.columns[i]; - } - } - runExpressionOnColumn(datum, ex) { - const actualDataValue = datum[ex.name]; - if (ex.operator === 'isnullorEmpty') return isnullorEmpty(actualDataValue); - else if (ex.operator === '!isnullorEmpty') return !isnullorEmpty(actualDataValue); - let dataValue = actualDataValue; - let expressionValue = ex.value; - if (ex.column) { - if (ex.column.type === 'string' || ex.stringOperation) { - dataValue = valueToString(actualDataValue).toLocaleLowerCase(); - expressionValue = ex.valueLow; - } else if (ex.column.type === 'boolean') { - dataValue = valueToBoolean(actualDataValue); - expressionValue = ex.valueBool; - } else if (ex.column.quantitative) { - dataValue = +actualDataValue; - expressionValue = +ex.value; - } - } - switch(ex.operator){ - case '!=': - return dataValue != expressionValue; - case '<': - return dataValue < expressionValue; - case '<=': - return dataValue <= expressionValue; - case '==': - return dataValue == expressionValue; - case '>': - return dataValue > expressionValue; - case '>=': - return dataValue >= expressionValue; - case 'contains': - return dataValue.indexOf(expressionValue) >= 0; - case '!contains': - return dataValue.indexOf(expressionValue) < 0; - case 'starts': - return dataValue.indexOf(expressionValue) == 0; - case '!starts': - return dataValue.indexOf(expressionValue) !== 0; - } - } - runExpression(datum, ex) { - if (ex.name == null) { - //run on all columns - const group = { - expressions: this.columns.map((column, i)=>{ - const ex2 = Object.assign(Object.assign({}, ex), { - column, - name: column.name - }); - if (i) ex2.clause = '||'; - return ex2; - }) - }; - return this.runGroup(datum, group); - } else return this.runExpressionOnColumn(datum, ex); - } - runGroup(datum, group) { - let accumulator = this.runExpression(datum, group.expressions[0]); - for(let i = 1; i < group.expressions.length; i++){ - const ex = group.expressions[i]; - switch(ex.clause){ - case '&&': - accumulator = accumulator && this.runExpression(datum, ex); - break; - case '||': - accumulator = accumulator || this.runExpression(datum, ex); - break; - } - } - return accumulator; + })); + function isColor(cssColorSpecifier) { + return !!color$2(cssColorSpecifier); + } + function checkIsColorData(data2, column) { + if (!column.stats.hasColorData) { + column.isColorData = false; + return; } - run(datum) { - let accumulator = this.runGroup(datum, this.groups[0]); - for(let i = 1; i < this.groups.length; i++){ - const group = this.groups[i]; - switch(group.clause){ - case '&&': - accumulator = accumulator && this.runGroup(datum, group); - break; - case '||': - accumulator = accumulator || this.runGroup(datum, group); - break; - } - } - return accumulator; - } -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"DMPkf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "invert", ()=>invert); -var _group = require("./group"); -function invertSearchExpressionGroup(input) { - //this only works if all expressions in this group have the same clause - const output = { - expressions: input.expressions.map(invertSearchExpression) - }; - if (input.clause) output.clause = invertedClauses[input.clause]; - return output; -} -const invertedOperators = { - '!=': '==', - '==': '!=', - '<': '>=', - '>=': '<', - '<=': '>', - '>': '<=', - '!contains': 'contains', - 'contains': '!contains', - '!isnullorEmpty': 'isnullorEmpty', - 'isnullorEmpty': '!isnullorEmpty', - '!starts': 'starts', - 'starts': '!starts' -}; -const invertedClauses = { - '&&': '||', - '||': '&&' -}; -function invertSearchExpression(input) { - const operator = invertedOperators[input.operator]; - const output = Object.assign(Object.assign({}, input), { - operator - }); - if (input.clause) output.clause = invertedClauses[input.clause]; - return output; -} -function invert(search) { - if (Array.isArray(search)) return search.map(invertSearchExpressionGroup); - else if ((0, _group.isSearchExpressionGroup)(search)) return invertSearchExpressionGroup(search); - else return invertSearchExpression(search); -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jhXKW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "narrow", ()=>narrow); -var _group = require("./group"); -function narrow(a, b) { - if (!a) return b; - const arrs = [ - a, - b - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [arrA, arrB] = arrs; - arrB[0].clause = '&&'; - return arrA.concat(arrB); -} - -},{"./group":"4OkbD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eHpZP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bD3z1":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g08sL":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnsFromData", ()=>(0, _sanddanceSpecs.getColumnsFromData)); -parcelHelpers.export(exports, "getStats", ()=>(0, _sanddanceSpecs.getStats)); -parcelHelpers.export(exports, "inferAll", ()=>(0, _sanddanceSpecs.inferAll)); -parcelHelpers.export(exports, "getPresenterStyle", ()=>(0, _defaults.getPresenterStyle)); -parcelHelpers.export(exports, "isInternalFieldName", ()=>isInternalFieldName); -var _constants = require("./constants"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _defaults = require("./defaults"); -function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { - if (includeVegaMorphChartsFields) { - if (columnName === (0, _constants.GL_ORDINAL)) return true; + for (let i = 0; i < data2.length; i++) { + if (!isColor(data2[i][column.name])) { + column.isColorData = false; + return; + } } - for(const f in 0, _constants.FieldNames){ - if (columnName === (0, _constants.FieldNames)[f]) return true; + column.isColorData = true; + } + function isQuantitative(column) { + return column.type === "number" || column.type === "integer"; + } + function detectNegative(columnName, data2) { + for (let i = 1; i < data2.length; i++) { + const value2 = columnName == null ? data2[i] : data2[i][columnName]; + if (value2 < 0) + return true; } return false; -} - -},{"./constants":"ix2qh","@msrvida/sanddance-specs":"aOvSr","./defaults":"7bMd0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7bMd0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultViewerOptions", ()=>defaultViewerOptions); -parcelHelpers.export(exports, "getPresenterStyle", ()=>getPresenterStyle); -parcelHelpers.export(exports, "cssPrefix", ()=>cssPrefix); -parcelHelpers.export(exports, "dualColorSchemeColors", ()=>dualColorSchemeColors); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -const { defaultPresenterStyle } = _vegaMorphcharts.defaults; -const defaultViewerOptions = { - colors: { - activeCube: 'purple', - defaultCube: _vegaMorphcharts.util.colorToString(defaultPresenterStyle.defaultCubeColor), - hoveredCube: _vegaMorphcharts.util.colorToString(defaultPresenterStyle.highlightColor), - selectedCube: 'yellow', - axisSelectHighlight: _vegaMorphcharts.util.colorToString([ - 128, - 128, - 128, - 128 - ]), - axisLine: '#000', - axisText: '#000', - gridLine: '#CCC', - backgroundColor: '#FFF' - }, - language: { - headers: { - chart: 'Chart', - details: 'Details', - legend: 'Legend', - selection: 'Select & Filter' - }, - bing: 'bing', - newColorMap: 'remap color to filtered items', - oldColorMap: 'keep same colors', - deselect: 'deselect', - exclude: 'exclude', - isolate: 'isolate', - legendOther: 'other', - nextDetail: '>', - previousDetail: '<', - reset: 'reset', - colorBinCount: 'Color bin count', - colorReverse: 'Color reverse', - count: 'Count', - percent: 'Percent', - sum: 'Sum', - scatterPointScale: 'Point scale', - FacetMaxBins: 'Facet max bins', - FacetVMaxBins: 'Cross facet max bins', - XMaxBins: 'X axis max bins', - YMaxBins: 'Y axis max bins', - XGridSize: 'X grid size', - YGridSize: 'Y grid size', - InnerPaddingSize: 'Inner padding size', - OuterPaddingSize: 'Outer padding size', - treeMapMethod: 'Treemap layout', - facetColumns: 'Facet columns', - facetRows: 'Facet rows', - markOpacitySignal: 'Mark opacity', - textScaleSignal: 'Text scale', - xAxisTextAngleSignal: 'X axis text angle', - yAxisTextAngleSignal: 'Y axis text angle', - zGrounded: 'Z grounded', - zScaleProportion: 'Z scale proportion to Y', - selectionCount: (count)=>`${count} items selected` - }, - maxLegends: 19, - onError: (errors)=>{ - //console.log(`UnitVisViewer errors: ${errors.join('\n')}`); - }, - filterRenderingTimerPadding: 200, - selectionPolygonZ: -1, - tickSize: 10 -}; -function getPresenterStyle(options) { - const style = { - cssPrefix, - fontFamily: options.fontFamily, - defaultCubeColor: _vegaMorphcharts.util.colorFromString(options.colors.defaultCube) - }; - if (options.colors.hoveredCube) style.highlightColor = _vegaMorphcharts.util.colorFromString(options.colors.hoveredCube); - //if (options.lightSettings) { - // style.lightSettings = options.lightSettings; - //} - return style; -} -const cssPrefix = 'sanddance-'; -const dualColorSchemeColors = { - black: '#212121', - gray: '#D2D2D2', - blue: '#0060F0', - green: '#00C000', - orange: '#FF9900', - red: '#E00000' -}; - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Sd5M":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>(0, _base.base)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "Presenter", ()=>(0, _presenter.Presenter)); -parcelHelpers.export(exports, "ViewGl", ()=>(0, _viewGl.ViewGl)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "controls", ()=>_controls); -parcelHelpers.export(exports, "defaults", ()=>_defaults); -parcelHelpers.export(exports, "types", ()=>_types); -parcelHelpers.export(exports, "util", ()=>_util); -var _controls = require("./exports/controls"); -var _types = require("./exports/types"); -var _util = require("./exports/util"); -var _defaults = require("./defaults"); -var _base = require("./base"); -var _presenter = require("./presenter"); -var _viewGl = require("./vega-classes/viewGl"); -var _enums = require("./enums"); -parcelHelpers.exportAll(_enums, exports); -var _version = require("./version"); - -},{"./exports/controls":"7DYOW","./exports/types":"jWJzt","./exports/util":"iZ1f5","./defaults":"4Q1zd","./base":"hIePf","./presenter":"9yYY0","./vega-classes/viewGl":"3abZO","./enums":"hnVHt","./version":"eMVZG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7DYOW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize variables for documentation -parcelHelpers.export(exports, "Table", ()=>(0, _controls.Table)); -var _controls = require("../controls"); - -},{"../controls":"9lm1L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9lm1L":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -var _tsxCreateElement = require("tsx-create-element"); -const KeyCodes = { - ENTER: 'Enter' -}; -const Table = (props)=>{ - return (0, _tsxCreateElement.createElement)("table", { - className: props.className - }, props.children, props.rows.map((row, i)=>(0, _tsxCreateElement.createElement)("tr", { - className: props.rowClassName || '', - onClick: (e)=>props.onRowClick && props.onRowClick(e, i), - tabIndex: props.onRowClick ? 0 : -1, - onKeyUp: (e)=>{ - if (e.key === KeyCodes.ENTER && props.onRowClick) props.onRowClick(e, i); - } - }, row.cells.map((cell, i)=>(0, _tsxCreateElement.createElement)("td", { - className: cell.className || '', - title: cell.title || '' - }, cell.content))))); -}; - -},{"tsx-create-element":"dPDUq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dPDUq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createElement", ()=>createElement); -parcelHelpers.export(exports, "addChild", ()=>addChild); -parcelHelpers.export(exports, "mount", ()=>mount); -parcelHelpers.export(exports, "findElementByChildPositions", ()=>findElementByChildPositions); -parcelHelpers.export(exports, "focusActiveElement", ()=>focusActiveElement); -parcelHelpers.export(exports, "setActiveElement", ()=>setActiveElement); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>getActiveElementInfo); -var _htmlTags = require("html-tags"); -var _svgTags = require("svg-tags"); -const htmlTagArray = _htmlTags.default || _htmlTags; -const svgTagArray = _svgTags.default || _svgTags; -/** - * Decamelizes a string with/without a custom separator (hyphen by default). - * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript - * - * @param str String in camelcase - * @param separator Separator for the new decamelized string. - */ function decamelize(str, separator = '-') { - return str.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2').replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2').toLowerCase(); -} -function createElement(tag, attrs, ...children) { - if (typeof tag === 'function') { - const fn = tag; - const props = attrs; - props.children = children; - return fn(props); + } + function detectSequentialColumn(columnName, data2) { + if (data2.length < 2) + return false; + for (let i = 1; i < data2.length; i++) { + const curr = columnName == null ? data2[i] : data2[i][columnName]; + const prev = columnName == null ? data2[i - 1] : data2[i - 1][columnName]; + if (curr !== prev + 1) + return false; + } + return true; + } + function getStats(data2, ...args) { + let columnName; + let columnType; + let columnQuantitative; + let distinctValuesCallback; + if (args.length <= 2) { + const column = args[0]; + columnName = column.name; + columnType = column.type; + columnQuantitative = column.quantitative; + distinctValuesCallback = args[1]; } else { - const ns = tagNamespace(tag); - const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); - const map = attrs; - let ref; - for(let name in map)if (name && map.hasOwnProperty(name)) { - let value = map[name]; - if (name === 'className' && value !== void 0) setAttribute(el, ns, 'class', value.toString()); - else if (name === 'disabled' && !value) ; - else if (value === null || value === undefined) continue; - else if (value === true) setAttribute(el, ns, name, name); - else if (typeof value === 'function') { - if (name === 'ref') ref = value; - else el[name.toLowerCase()] = value; - } else if (typeof value === 'object') setAttribute(el, ns, name, flatten(value)); - else setAttribute(el, ns, name, value.toString()); - } - if (children && children.length > 0) appendChildren(el, children); - if (ref) ref(el); - return el; + columnName = args[0]; + columnType = args[1]; + columnQuantitative = args[2]; + distinctValuesCallback = args[3]; } -} -function setAttribute(el, ns, name, value) { - if (ns) el.setAttributeNS(null, name, value); - else el.setAttribute(name, value); -} -function flatten(o) { - const arr = []; - for(let prop in o)arr.push(`${decamelize(prop, '-')}:${o[prop]}`); - return arr.join(';'); -} -function addChild(parentElement, child) { - if (child === null || child === undefined || typeof child === "boolean") return; - else if (Array.isArray(child)) appendChildren(parentElement, child); - else if (isElement(child)) parentElement.appendChild(child); - else parentElement.appendChild(document.createTextNode(child.toString())); -} -function appendChildren(parentElement, children) { - children.forEach((child)=>addChild(parentElement, child)); -} -function isElement(el) { - //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType - return !!el.nodeType; -} -function mount(element, container) { - container.innerHTML = ''; - if (element) addChild(container, element); -} -function findElementByChildPositions(childPositions, container) { - let element = container || document.body; - let childPosition; - while(element && childPositions.length){ - childPosition = childPositions.shift(); - element = element.children.item(childPosition); - } - if (element) return element; -} -function focusActiveElement(element, activeElementInfo) { - element.focus(); - element.scrollTop = activeElementInfo.scrollTop; - const input = element; - if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); -} -function setActiveElement(activeElementInfo, container) { - if (activeElementInfo) { - const element = findElementByChildPositions(activeElementInfo.childPositions, container); - if (element) focusActiveElement(element, activeElementInfo); + const distinctMap = {}; + const stats = { + nonNull: 0, + distinctValueCount: null, + max: null, + mean: null, + min: null + }; + const columnIsString = columnType === "string"; + let sum2 = 0; + for (let i = 0; i < data2.length; i++) { + const row = data2[i]; + const value2 = columnName == null ? row : row[columnName]; + if (columnIsString) { + if (value2 !== "") { + stats.nonNull++; + } + } else if (value2 != null) { + stats.nonNull++; + } + const num = +value2; + distinctMap[value2] = true; + if (!isNaN(num)) { + if (stats.max === null || num > stats.max) { + stats.max = num; + } + if (stats.min === null || num < stats.min) { + stats.min = num; + } + sum2 += num; + } + if ((columnType === "date" || columnIsString) && !stats.hasColorData && isColor(value2)) { + stats.hasColorData = true; + } } -} -function getActiveElementInfo(container) { - let element = document.activeElement; - const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element; - const activeElementInfo = { - childPositions: [], - scrollTop, - selectionDirection, - selectionEnd, - selectionStart - }; - while(element && element !== document.body && element !== container){ - activeElementInfo.childPositions.unshift(getChildPosition(element)); - element = element.parentElement; - } - if ((element === document.body || element === container) && activeElementInfo.childPositions.length) return activeElementInfo; -} -function getChildPosition(element) { - let childPosition = 0; - while(element = element.previousElementSibling)childPosition++; - return childPosition; -} -function tagNamespace(tag) { - //issue: this won't disambiguate certain tags which exist in both svg and html:
, ... - if (tag === 'svg' || svgTagArray.indexOf(tag) >= 0 && !(htmlTagArray.indexOf(tag) >= 0)) return "http://www.w3.org/2000/svg"; -} - -},{"html-tags":"d5cAX","svg-tags":"kuFQD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d5cAX":[function(require,module,exports,__globalThis) { -'use strict'; -module.exports = require("6c9bf1ded7f8a5a1"); - -},{"6c9bf1ded7f8a5a1":"6OgGY"}],"6OgGY":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"abbr\",\"address\",\"area\",\"article\",\"aside\",\"audio\",\"b\",\"base\",\"bdi\",\"bdo\",\"blockquote\",\"body\",\"br\",\"button\",\"canvas\",\"caption\",\"cite\",\"code\",\"col\",\"colgroup\",\"data\",\"datalist\",\"dd\",\"del\",\"details\",\"dfn\",\"dialog\",\"div\",\"dl\",\"dt\",\"em\",\"embed\",\"fieldset\",\"figcaption\",\"figure\",\"footer\",\"form\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"header\",\"hgroup\",\"hr\",\"html\",\"i\",\"iframe\",\"img\",\"input\",\"ins\",\"kbd\",\"keygen\",\"label\",\"legend\",\"li\",\"link\",\"main\",\"map\",\"mark\",\"math\",\"menu\",\"menuitem\",\"meta\",\"meter\",\"nav\",\"noscript\",\"object\",\"ol\",\"optgroup\",\"option\",\"output\",\"p\",\"param\",\"picture\",\"pre\",\"progress\",\"q\",\"rb\",\"rp\",\"rt\",\"rtc\",\"ruby\",\"s\",\"samp\",\"script\",\"section\",\"select\",\"slot\",\"small\",\"source\",\"span\",\"strong\",\"style\",\"sub\",\"summary\",\"sup\",\"svg\",\"table\",\"tbody\",\"td\",\"template\",\"textarea\",\"tfoot\",\"th\",\"thead\",\"time\",\"title\",\"tr\",\"track\",\"u\",\"ul\",\"var\",\"video\",\"wbr\"]"); - -},{}],"kuFQD":[function(require,module,exports,__globalThis) { -module.exports = require("8c03a2b8d2417863"); - -},{"8c03a2b8d2417863":"d3wrv"}],"d3wrv":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"altGlyph\",\"altGlyphDef\",\"altGlyphItem\",\"animate\",\"animateColor\",\"animateMotion\",\"animateTransform\",\"circle\",\"clipPath\",\"color-profile\",\"cursor\",\"defs\",\"desc\",\"ellipse\",\"feBlend\",\"feColorMatrix\",\"feComponentTransfer\",\"feComposite\",\"feConvolveMatrix\",\"feDiffuseLighting\",\"feDisplacementMap\",\"feDistantLight\",\"feFlood\",\"feFuncA\",\"feFuncB\",\"feFuncG\",\"feFuncR\",\"feGaussianBlur\",\"feImage\",\"feMerge\",\"feMergeNode\",\"feMorphology\",\"feOffset\",\"fePointLight\",\"feSpecularLighting\",\"feSpotLight\",\"feTile\",\"feTurbulence\",\"filter\",\"font\",\"font-face\",\"font-face-format\",\"font-face-name\",\"font-face-src\",\"font-face-uri\",\"foreignObject\",\"g\",\"glyph\",\"glyphRef\",\"hkern\",\"image\",\"line\",\"linearGradient\",\"marker\",\"mask\",\"metadata\",\"missing-glyph\",\"mpath\",\"path\",\"pattern\",\"polygon\",\"polyline\",\"radialGradient\",\"rect\",\"script\",\"set\",\"stop\",\"style\",\"svg\",\"switch\",\"symbol\",\"text\",\"textPath\",\"title\",\"tref\",\"tspan\",\"use\",\"view\",\"vkern\"]"); - -},{}],"jWJzt":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize interfaces for documentation -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _interfaces.MorphChartsCore)); -var _interfaces = require("../interfaces"); - -},{"../interfaces":"5p3aO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5p3aO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _morphcharts.Core)); -var _morphcharts = require("morphcharts"); - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9s7CR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Core", ()=>(0, _mainJs.Core)); -parcelHelpers.export(exports, "ModelView", ()=>(0, _mainJs.ModelView)); -parcelHelpers.export(exports, "SingleTouchAction", ()=>(0, _mainJs.SingleTouchAction)); -parcelHelpers.export(exports, "UnitType", ()=>(0, _mainJs.UnitType)); -parcelHelpers.export(exports, "Theme", ()=>(0, _mainJs.Theme)); -parcelHelpers.export(exports, "PickType", ()=>(0, _mainJs.PickType)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _mainJs.SelectionMode)); -parcelHelpers.export(exports, "HighlightMode", ()=>(0, _mainJs.HighlightMode)); -parcelHelpers.export(exports, "FilterMode", ()=>(0, _mainJs.FilterMode)); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>(0, _mainJs.AxesTextOrientation)); -parcelHelpers.export(exports, "Orientation", ()=>(0, _mainJs.Orientation)); -parcelHelpers.export(exports, "StereoMode", ()=>(0, _mainJs.StereoMode)); -parcelHelpers.export(exports, "RenderMode", ()=>(0, _mainJs.RenderMode)); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>(0, _mainJs.HorizontalAlignment)); -parcelHelpers.export(exports, "VerticalAlignment", ()=>(0, _mainJs.VerticalAlignment)); -parcelHelpers.export(exports, "LogLevel", ()=>(0, _mainJs.LogLevel)); -parcelHelpers.export(exports, "AxesVisibility", ()=>(0, _mainJs.AxesVisibility)); -parcelHelpers.export(exports, "Edge2D", ()=>(0, _mainJs.Edge2D)); -parcelHelpers.export(exports, "Edge3D", ()=>(0, _mainJs.Edge3D)); -parcelHelpers.export(exports, "Face2D", ()=>(0, _mainJs.Face2D)); -parcelHelpers.export(exports, "Face3D", ()=>(0, _mainJs.Face3D)); -parcelHelpers.export(exports, "PaletteName", ()=>(0, _paletteJs.PaletteName)); -parcelHelpers.export(exports, "PaletteResources", ()=>(0, _paletteJs.PaletteResources)); -parcelHelpers.export(exports, "PaletteType", ()=>(0, _paletteJs.PaletteType)); -parcelHelpers.export(exports, "Config", ()=>(0, _configJs.Config)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -parcelHelpers.export(exports, "Colors", ()=>(0, _colorsJs.Colors)); -parcelHelpers.export(exports, "Font", ()=>(0, _fontJs.Font)); -parcelHelpers.export(exports, "FontRasterizer", ()=>(0, _fontJs.FontRasterizer)); -parcelHelpers.export(exports, "FontAtlas", ()=>(0, _fontJs.FontAtlas)); -parcelHelpers.export(exports, "Map", ()=>(0, _mapJs.Map)); -parcelHelpers.export(exports, "MapRasterizer", ()=>(0, _mapJs.MapRasterizer)); -parcelHelpers.export(exports, "MapAtlas", ()=>(0, _mapJs.MapAtlas)); -parcelHelpers.export(exports, "Icons", ()=>(0, _iconsJs.Icons)); -parcelHelpers.export(exports, "IconsRasterizer", ()=>(0, _iconsJs.IconsRasterizer)); -parcelHelpers.export(exports, "IconsAtlas", ()=>(0, _iconsJs.IconsAtlas)); -parcelHelpers.export(exports, "Components", ()=>_indexJs); -parcelHelpers.export(exports, "Axes", ()=>_indexJs1); -parcelHelpers.export(exports, "Helpers", ()=>_indexJs2); -parcelHelpers.export(exports, "Layouts", ()=>_indexJs3); -parcelHelpers.export(exports, "Input", ()=>_indexJs4); -parcelHelpers.export(exports, "Providers", ()=>_indexJs5); -parcelHelpers.export(exports, "Meshes", ()=>_indexJs6); -parcelHelpers.export(exports, "Renderers", ()=>_indexJs7); -parcelHelpers.export(exports, "Tables", ()=>_indexJs8); -parcelHelpers.export(exports, "Cameras", ()=>_indexJs9); -var _mainJs = require("./main.js"); -var _paletteJs = require("./palette.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _colorsJs = require("./colors.js"); -var _fontJs = require("./font.js"); -var _mapJs = require("./map.js"); -var _iconsJs = require("./icons.js"); -var _indexJs = require("./components/index.js"); -var _indexJs1 = require("./components/axes/index.js"); -var _indexJs2 = require("./helpers/index.js"); -var _indexJs3 = require("./layouts/index.js"); -var _indexJs4 = require("./input/index.js"); -var _indexJs5 = require("./providers/index.js"); -var _indexJs6 = require("./meshes/index.js"); -var _indexJs7 = require("./renderers/index.js"); -var _indexJs8 = require("./tables/index.js"); -var _indexJs9 = require("./cameras/index.js"); - -},{"./main.js":"f421K","./palette.js":"hZb65","./config.js":"bCTP3","./constants.js":"lD0bG","./colors.js":"cYEeU","./font.js":"ibkbS","./map.js":"5JhCv","./icons.js":"lPq9g","./components/index.js":"5C4Hk","./components/axes/index.js":"eiGCN","./helpers/index.js":"9v1at","./layouts/index.js":"duBHP","./input/index.js":"flmwt","./providers/index.js":"hACG3","./meshes/index.js":"6XXZT","./renderers/index.js":"1IHvF","./tables/index.js":"dUaaI","./cameras/index.js":"h7YGk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f421K":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ModelView", ()=>ModelView); -parcelHelpers.export(exports, "Core", ()=>Core); -parcelHelpers.export(exports, "CameraMode", ()=>CameraMode); -parcelHelpers.export(exports, "StereoMode", ()=>StereoMode); -parcelHelpers.export(exports, "SelectionMode", ()=>SelectionMode); -parcelHelpers.export(exports, "FilterMode", ()=>FilterMode); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>HorizontalAlignment); -parcelHelpers.export(exports, "VerticalAlignment", ()=>VerticalAlignment); -parcelHelpers.export(exports, "TextAlignment", ()=>TextAlignment); -parcelHelpers.export(exports, "Orientation", ()=>Orientation); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>AxesTextOrientation); -parcelHelpers.export(exports, "AxesVisibility", ()=>AxesVisibility); -parcelHelpers.export(exports, "PickType", ()=>PickType); -parcelHelpers.export(exports, "Theme", ()=>Theme); -parcelHelpers.export(exports, "HighlightMode", ()=>HighlightMode); -parcelHelpers.export(exports, "UnitType", ()=>UnitType); -parcelHelpers.export(exports, "SingleTouchAction", ()=>SingleTouchAction); -parcelHelpers.export(exports, "MouseWheelAction", ()=>MouseWheelAction); -parcelHelpers.export(exports, "LogLevel", ()=>LogLevel); -parcelHelpers.export(exports, "Edge2D", ()=>Edge2D); -parcelHelpers.export(exports, "Face2D", ()=>Face2D); -parcelHelpers.export(exports, "Edge3D", ()=>Edge3D); -parcelHelpers.export(exports, "Face3D", ()=>Face3D); -parcelHelpers.export(exports, "HexOrientation", ()=>HexOrientation); -parcelHelpers.export(exports, "RenderMode", ()=>RenderMode); -var _glMatrix = require("gl-matrix"); -var _altazimuthJs = require("./cameras/altazimuth.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _debugJs = require("./debug.js"); -var _fpsJs = require("./fps.js"); -var _angleJs = require("./helpers/angle.js"); -var _paletteJs = require("./palette.js"); -var _controllerJs = require("./components/controller.js"); -var _matrixJs = require("./helpers/matrix.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _fontJs = require("./font.js"); -var _vertexJs = require("./vertex.js"); -var _managerJs = require("./input/manager.js"); -var _logJs = require("./log.js"); -var _mathJs = require("./helpers/math.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + if (columnQuantitative) { + stats.mean = data2.length > 0 && sum2 / data2.length; + stats.hasNegative = detectNegative(columnName, data2); + if (columnType === "integer") { + stats.isSequential = detectSequentialColumn(columnName, data2); + } } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } + const distinctValues = Object.keys(distinctMap); + if (distinctValuesCallback) { + distinctValues.sort(); + distinctValuesCallback(distinctValues); + } + stats.distinctValueCount = distinctValues.length; + return stats; + } + function getColumnsFromData(inferTypesFn, data2, columnTypes) { + const sample = data2[0]; + const fields = sample ? Object.keys(sample) : []; + const inferences = Object.assign(Object.assign({}, inferTypesFn(data2, fields)), columnTypes); + const columns = fields.map((name) => { + const column = { + name, + type: inferences[name] + }; + return column; + }); + inferAll(columns, data2); + return columns; + } + function inferAll(columns, data2) { + columns.forEach((column) => { + if (column) { + if (typeof column.quantitative !== "boolean") { + column.quantitative = isQuantitative(column); } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + if (!column.stats) { + column.stats = getStats(data2, column); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + if ((column.type === "date" || column.type === "string") && typeof column.isColorData !== "boolean") { + checkIsColorData(data2, column); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } }); -}; -class ModelView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - this.manipulationOrigin = (0, _glMatrix.vec3).create(); - this.rotation = (0, _glMatrix.quat).create(); - (0, _glMatrix.vec3).set(this.position, 0, 0, -core.config.modelDistance); - this.scale = core.config.modelSize; - } -} -class Core { - get container() { - return this._container; - } - get started() { - return this._started; - } - get debugText() { - return this._debugText; - } - get log() { - return this._log; - } - get totalFrames() { - return this._fps.totalFrames; - } - get camera() { - return this._camera; - } - set camera(value) { - this._camera = value; - } - getModelRotation(value) { - (0, _glMatrix.quat).copy(value, this._modelRotation); - } - setModelRotation(value, isSmooth) { - (0, _glMatrix.quat).copy(this._modelRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - getModelScale() { - return this._modelScale[0]; - } - setModelScale(value, isSmooth) { - (0, _glMatrix.vec3).set(this._modelScale, value, value, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); - } - getModelManipulationOrigin(value) { - (0, _glMatrix.vec3).copy(value, this._modelManipulationOrigin); + } + let Table$2 = class Table { + constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = "right") { + this.columns = columns; + this.rows = rows; + this.maxWidth = maxWidth; + this.underlineHeaders = underlineHeaders; + this.align = align; + this.columnWidths = this.columns.map((col, idx) => Math.max(col.length, ...this.rows.map((row) => { + var _a2; + return ((_a2 = row[idx]) === null || _a2 === void 0 ? void 0 : _a2.length) || 0; + }))); } - setModelManipulationOrigin(value) { - this._updateManipulationOrigin(value); + createSpaces(num) { + return " ".repeat(num); } - getModelPosition(value) { - (0, _glMatrix.vec3).copy(value, this._modelPosition); + groupColumns() { + let cumulativeWidth = 0; + const columnGroups = []; + let currentGroup = []; + this.columns.forEach((col, idx) => { + const columnSpace = this.columnWidths[idx] + 1; + if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { + columnGroups.push(currentGroup); + cumulativeWidth = columnSpace; + currentGroup = [col]; + } else { + cumulativeWidth += columnSpace; + currentGroup.push(col); + } + }); + if (currentGroup.length > 0) { + columnGroups.push(currentGroup); + } + return columnGroups; } - setModelPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._modelPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); + formatRow(row, group2) { + return group2.map((col) => { + const idx = this.columns.indexOf(col); + const cellValue = row[idx] == null ? "" : row[idx].toString(); + return this.align === "right" ? cellValue.padStart(this.columnWidths[idx], " ") : cellValue.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); } - get webXRSession() { - return this._webXRSession; + formatHeader(group2) { + return group2.map((col) => { + const idx = this.columns.indexOf(col); + return this.align === "right" ? col.padStart(this.columnWidths[idx], " ") : col.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); } - get renderer() { - return this._renderer; + underlineHeader(group2) { + return group2.map((col) => "-".repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); } - set renderer(renderer) { - if (this._renderer == renderer) return; - if (this._renderer) { - this.stop(); - this._renderer.remove(); - } - if (!renderer.isInitialized) renderer.initialize(this); - if (this._renderer) { - renderer.transitionTime = this._renderer.transitionTime; - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const previousTransitionBuffer = this._renderer.transitionBuffers[i]; - const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); - transitionBuffer.copyFrom(previousTransitionBuffer); - renderer.transitionBuffers.push(transitionBuffer); - } - const currentAxes = this._renderer.currentAxes; - if (currentAxes) { - renderer.currentAxes = []; - for(let i = 0; i < currentAxes.length; i++){ - const axesVisual = currentAxes[i]; - const axes = axesVisual.axes; - if (axes instanceof (0, _cartesian3DJs.Cartesian3dAxes)) { - const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); - renderer.currentAxes.push(cartesian3dAxesVisual); - } else if (axes instanceof (0, _cartesian2DJs.Cartesian2dAxes)) renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); - } - } - const labelSets = this._renderer.labelSets; - if (labelSets) { - renderer.labelSets = []; - for(let i = 0; i < labelSets.length; i++)renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); - } - const images = this._renderer.images; - if (images) { - renderer.images = []; - for(let i = 0; i < images.length; i++)renderer.images.push(renderer.createImageVisual(images[i].image)); - } - const fonts = this._renderer.fonts; - if (fonts) for(const key in fonts){ - const font = fonts[key].font; - renderer.fonts[font.name] = renderer.createFontVisual(font); - } - } else renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); - if (this._renderer) this._renderer.finalize(); - this._renderer = renderer; - this._fps.reset(); - this.start(); + render() { + const output2 = []; + const columnGroups = this.groupColumns(); + columnGroups.forEach((group2, groupIndex) => { + const headerRow = this.formatHeader(group2); + let section = headerRow + (groupIndex < columnGroups.length - 1 ? " \\" : "") + "\n"; + if (this.underlineHeaders) { + section += this.underlineHeader(group2) + "\n"; + } + this.rows.forEach((row) => { + section += this.formatRow(row, group2) + "\n"; + }); + output2.push(section); + if (groupIndex < columnGroups.length - 1) { + output2.push("\n"); + } + }); + return output2.join(""); } - get font() { - return this._font; + }; + var pandasSimulation; + (function(pandasSimulation2) { + const typeMapping = { + boolean: "bool", + number: "float64", + // Assuming 'number' is used for floating-point numbers + date: "datetime64[ns]", + string: "object", + integer: "int64" + }; + function head(columns, data2, maxWidth = 80) { + const numRows = 5; + const top = data2.slice(0, numRows); + const rowNumbers = Array.from({ length: numRows }, (_, i) => (i + 1).toString()); + const columnNames = [""].concat(columns.map((col) => col.name)); + const rows = top.map((row, i) => [rowNumbers[i]].concat(columns.map((col) => { + var _a2; + return ((_a2 = row[col.name]) === null || _a2 === void 0 ? void 0 : _a2.toString()) || ""; + }))); + const table = new Table$2(columnNames, rows, maxWidth, false, "right"); + return table.render(); + } + pandasSimulation2.head = head; + function info2(columns, data2, maxWidth = 80) { + const numRows = data2.length; + const output2 = []; + output2.push("<class 'pandas.core.frame.DataFrame'>"); + output2.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); + output2.push(`Data columns (total ${columns.length} columns): +`); + const columnHeaders = ["#", "Column", "Non-Null Count", "Dtype"]; + const rows = columns.map((col, idx) => { + const nonNullCount = col.stats.nonNull.toString(); + const dtype = typeMapping[col.type] || "unknown"; + return [idx.toString(), col.name, `${nonNullCount} non-null`, dtype]; + }); + const table = new Table$2(columnHeaders, rows, maxWidth, true, "left"); + output2.push(table.render()); + const memoryUsage = columns.reduce((total, col) => { + var _a2; + const exampleValue = (_a2 = data2.find((row) => row[col.name] != null)) === null || _a2 === void 0 ? void 0 : _a2[col.name]; + if (exampleValue == null) + return total; + const size = new Blob([exampleValue.toString()]).size; + return total + size * numRows; + }, 0); + output2.push(` +dtypes: ${columns.filter((col) => col.type === "number").length} float64, ${columns.filter((col) => col.type === "integer").length} int64, ${columns.filter((col) => col.type === "string").length} object`); + output2.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); + return output2.join("\n"); + } + pandasSimulation2.info = info2; + })(pandasSimulation || (pandasSimulation = {})); + function getSpecColumns(insight, columns) { + function getColumnByName(name) { + return columns.filter((c2) => c2.name === name)[0]; } - get paletteResources() { - return this._paletteResources; + return { + color: getColumnByName(insight.columns && insight.columns.color), + facet: getColumnByName(insight.columns && insight.columns.facet), + facetV: getColumnByName(insight.columns && insight.columns.facetV), + group: getColumnByName(insight.columns && insight.columns.group), + size: getColumnByName(insight.columns && insight.columns.size), + sort: getColumnByName(insight.columns && insight.columns.sort), + uid: getColumnByName(insight.columns && insight.columns.uid), + x: getColumnByName(insight.columns && insight.columns.x), + y: getColumnByName(insight.columns && insight.columns.y), + z: getColumnByName(insight.columns && insight.columns.z) + }; + } + function addAxes(scope, ...axes) { + if (!axes || !axes.length) + return; + if (!scope.axes) + scope.axes = []; + scope.axes.push(...axes.filter(Boolean)); + } + function addData(scope, ...datas) { + if (!datas || !datas.length) + return; + if (!scope.data) + scope.data = []; + scope.data.push(...datas.filter(Boolean)); + } + function addMarks(scope, ...marks) { + if (!marks || !marks.length) + return; + if (!scope.marks) + scope.marks = []; + scope.marks.push(...marks.filter(Boolean)); + } + function addScales(scope, ...scales2) { + if (!scales2 || !scales2.length) + return; + if (!scope.scales) + scope.scales = []; + scope.scales.push(...scales2.filter(Boolean)); + } + function addSignals(scope, ...signals) { + if (!signals || !signals.length) + return; + if (!scope.signals) + scope.signals = []; + scope.signals.push(...signals.filter(Boolean)); + } + function addTransforms(data2, ...transforms2) { + if (!transforms2 || !transforms2.length) + return; + if (!data2.transform) + data2.transform = []; + data2.transform.push(...transforms2.filter(Boolean)); + } + function getDataByName(data2, dataName) { + for (let i = 0; i < data2.length; i++) { + if (data2[i].name === dataName) + return { data: data2[i], index: i }; } - get config() { - return this._config; + } + function getGroupBy(groupings) { + const groupby = groupings.map((g) => g.groupby); + return groupby.reduce((acc, val) => acc.concat(val), []); + } + function addOffsets(...offsets2) { + return offsets2.filter(Boolean).join(" + "); + } + function addGlobalAxes(props) { + const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; + const { scope } = globalScope; + allGlobalScales.forEach((globalScales) => { + const { scales: scales2 } = globalScales; + for (const xyz in scales2) { + const _scales = scales2[xyz]; + if (_scales) { + addScales(scope, ..._scales); + let { showAxes } = globalScales; + let zindex = void 0; + if (xyz === "z") { + showAxes = false; + if (props.view === "3d" && specViewOptions.zAxisOptions && !props.hideZAxis) { + if (specViewOptions.zAxisOptions.showZAxis) { + showAxes = true; + zindex = specViewOptions.zAxisOptions.zIndex; + } + } + } + if (showAxes && axisScales) { + const axisScale = axisScales[xyz]; + if (axisScale) { + const lineColor = specViewOptions.colors.axisLine; + const horizontal = xyz === "x"; + const column = specColumns[xyz] || { quantitative: true }; + const title = axisScale.title; + const props2 = { + title, + horizontal, + column, + specViewOptions, + lineColor, + titlePadding: axesTitlePadding[xyz], + labelBaseline: labelBaseline[xyz], + zindex + }; + axesScopes["main"].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); + if (axesScopes[xyz]) { + axesScopes[xyz].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); + } + if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { + const plotOffsetSignal = plotOffsetSignals[xyz]; + plotOffsetSignal.update = `${axesOffsets[xyz]}`; + } + } + } + } + } + }); + } + function createAxis(props) { + const { column, horizontal, labelBaseline, lineColor, scale: scale2, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; + const axis = Object.assign(Object.assign(Object.assign(Object.assign({ zindex, scale: scale2.name, orient: horizontal ? "bottom" : "left", domain: showLines, ticks: showLines }, showLines && { + domainColor: lineColor, + tickColor: lineColor, + tickSize: specViewOptions.tickSize + }), showTitle && { + title, + titleAlign: horizontal ? "left" : "right", + titleAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY + }, + titleColor: specViewOptions.colors.axisText, + titleFontSize: { + signal: SignalNames.TextTitleSize + }, + titleLimit: axesTitleLimit, + titlePadding + }), { labels: showLabels }), showLabels && { + labelAlign: horizontal ? "left" : "right", + labelBaseline, + labelAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY + }, + labelColor: specViewOptions.colors.axisText, + labelFontSize: { + signal: SignalNames.TextSize + }, + labelLimit: axesLabelLimit + }); + if (column.quantitative) { + axis.format = "~r"; } - get inputManager() { - return this._inputManager; - } - constructor(options){ - (0, _glMatrix.glMatrix).setMatrixArrayType(Array); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat4 = (0, _glMatrix.mat4).create(); - this._container = options && options.container ? options.container : document.body; - this._config = new (0, _configJs.Config)(this); - this._log = new (0, _logJs.Log)(this); - this._debugText = new (0, _debugJs.DebugText)(); - this._inputManager = options && options.useInputManager === false ? null : new (0, _managerJs.Manager)(this); - const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { - fontAtlas: new (0, _fontJs.FontAtlas)(256, 512), - fontSize: 24, - border: 3, - fontFamily: "\"segoe ui semibold\", sans-serif", - fontWeight: "normal", - fontStyle: "normal", - baseline: "alphabetic", - maxDistance: 8, - edgeValue: 0xc0 - }; - const fontRasterizer = new (0, _fontJs.FontRasterizer)(this, fontRasterizerOptions); - this._font = fontRasterizer.font; - this._paletteResources = new (0, _paletteJs.PaletteResources)(); - this._previousTime = 0; - this._fps = new (0, _fpsJs.Fps)(this); - this._modelMMatrix = (0, _glMatrix.mat4).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelRotation = (0, _glMatrix.quat).create(); - this._modelScale = (0, _glMatrix.vec3).create(); - this._smoothedModelPosition = (0, _glMatrix.vec3).create(); - this._smoothedModelRotation = (0, _glMatrix.quat).create(); - this._smoothedModelScale = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._camera = new (0, _altazimuthJs.AltAzimuthCamera)(this); - this.resetModel(false); + return axis; + } + function safeFieldName(field2) { + return field2.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"').replace(/\./g, "\\.").replace(/\[/g, "\\[").replace(/\]/g, "\\]"); + } + function exprSafeFieldName(field2) { + return field2.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ""); + } + function linearScale(scaleName, domain2, range2, reverse2, zero2, nice2 = true) { + const scale2 = { + name: scaleName, + type: "linear", + range: range2, + round: true, + reverse: reverse2, + domain: domain2, + zero: zero2, + nice: nice2 + }; + return scale2; + } + function pointScale(scaleName, data2, range2, field2, reverse2) { + const scale2 = { + name: scaleName, + type: "point", + range: range2, + domain: { + data: data2, + field: safeFieldName(field2), + sort: true + }, + padding: 0.5 + }; + if (reverse2 !== void 0) { + scale2.reverse = reverse2; } - getView(view) { - this.getModelPosition(view.position); - this.getModelRotation(view.rotation); - view.scale = this.getModelScale(); + return scale2; + } + function binnableColorScale(scaleName, colorBin, data2, field2, scheme2) { + scheme2 = scheme2 || ColorScaleNone; + const domain2 = { + data: data2, + field: safeFieldName(field2) + }; + const range2 = { + scheme: scheme2 + }; + const reverse2 = { signal: SignalNames.ColorReverse }; + if (colorBin !== "continuous") { + range2.count = { signal: SignalNames.ColorBinCount }; + } + switch (colorBin) { + case "continuous": { + const sequentialScale = { + name: scaleName, + type: "linear", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return sequentialScale; + } + case "quantile": { + const quantileScale = { + name: scaleName, + type: "quantile", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return quantileScale; + } + default: { + const quantizeScale = { + name: scaleName, + type: "quantize", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return quantizeScale; + } } - setView(view, isSmooth) { - this.setModelPosition(view.position, isSmooth); - this.setModelRotation(view.rotation, isSmooth); - this.setModelScale(view.scale, isSmooth); + } + const defaultZProportion = 0.6; + function textSignals(context2, heightSignal) { + const { specViewOptions } = context2; + const signals = [ + { + name: SignalNames.ZProportion, + value: defaultZProportion, + bind: { + name: specViewOptions.language.zScaleProportion, + debounce: debounce$1, + input: "range", + min: 0.1, + max: 2, + step: 0.1 + } + }, + { + name: SignalNames.ZHeight, + update: `${heightSignal} * ${SignalNames.ZProportion}` + }, + { + name: SignalNames.TextScale, + value: 1.2, + bind: { + name: specViewOptions.language.textScaleSignal, + debounce: debounce$1, + input: "range", + min: 0.5, + max: 2, + step: 0.1 + } + }, + { + name: SignalNames.TextSize, + update: `${SignalNames.TextScale} * 10` + }, + { + name: SignalNames.TextTitleSize, + update: `${SignalNames.TextScale} * 15` + }, + { + name: SignalNames.TextAngleX, + value: 30, + bind: { + name: specViewOptions.language.xAxisTextAngleSignal, + debounce: debounce$1, + input: "range", + min: 0, + max: 90, + step: 1 + } + }, + { + name: SignalNames.TextAngleY, + value: 0, + bind: { + name: specViewOptions.language.yAxisTextAngleSignal, + debounce: debounce$1, + input: "range", + min: -90, + max: 0, + step: 1 + } + }, + { + name: SignalNames.MarkOpacity, + value: 1, + bind: { + name: specViewOptions.language.markOpacitySignal, + debounce: debounce$1, + input: "range", + min: 0.1, + max: 1, + step: 0.05 + } + } + ]; + return signals; + } + function colorBinCountSignal(context2) { + const { specViewOptions } = context2; + const signal = { + name: SignalNames.ColorBinCount, + value: 7, + bind: { + name: specViewOptions.language.colorBinCount, + debounce: debounce$1, + input: "range", + min: 1, + max: specViewOptions.maxLegends + 1, + step: 1 + } + }; + return signal; + } + function colorReverseSignal(context2) { + const { specViewOptions } = context2; + const signal = { + name: SignalNames.ColorReverse, + value: false, + bind: { + name: specViewOptions.language.colorReverse, + input: "checkbox" + } + }; + return signal; + } + function modifySignal(s2, fn2, update2) { + s2.update = `${fn2}((${s2.update}), (${update2}))`; + } + function legend(column, fill2) { + const legend2 = { + orient: "none", + title: column.name, + fill: fill2, + encode: { + symbols: { + update: { + shape: { + value: "square" + } + } + } + } + }; + if (column.quantitative) { + legend2.type = "symbol"; + legend2.format = "~r"; } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setModelPosition(this._vec3, false); - (0, _glMatrix.quat).slerp(this._quat, from.rotation, to.rotation, time); - this.setModelRotation(this._quat, false); - this.setModelScale((0, _mathJs.MathHelper).lerp(from.scale, to.scale, time), false); + return legend2; + } + function getLegends(context2, fill2) { + const { specColumns, insight } = context2; + if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) { + return [legend(specColumns.color, fill2)]; } - resetModel(isSmooth) { - (0, _glMatrix.vec3).set(this._modelPosition, 0, 0, -this._config.modelDistance); - (0, _glMatrix.vec3).set(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); - (0, _glMatrix.quat).set(this._modelRotation, 0, 0, 0, 1); - if (!isSmooth) this._syncSmooth(); + } + function topLookup(column, count2, source2, legend2, lookupName, fieldName, indexName) { + const data2 = [ + { + name: lookupName, + source: source2, + transform: [ + { + type: "aggregate", + groupby: [safeFieldName(column.name)] + }, + { + type: "window", + ops: ["count"], + as: [indexName] + }, + { + type: "filter", + expr: `datum[${JSON.stringify(indexName)}] <= ${count2}` + } + ] + }, + { + name: legend2, + source: source2, + transform: [ + { + type: "lookup", + from: lookupName, + key: safeFieldName(column.name), + fields: [column.name].map(safeFieldName), + values: [column.name].map(safeFieldName), + as: [fieldName] + }, + { + type: "formula", + expr: `datum[${JSON.stringify(fieldName)}] == null ? '${Other}' : datum[${JSON.stringify(fieldName)}]`, + as: fieldName + } + ] + } + ]; + return data2; + } + function addColor(props) { + const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; + let colorDataName = dataName; + const { insight, specColumns, specViewOptions } = specContext; + const legends = getLegends(specContext, scaleName); + if (legends) { + scope.legends = legends; } - resetManipulationOrigin() { - if (!(0, _glMatrix.vec3).exactEquals(this._modelManipulationOrigin, (0, _constantsJs.Constants).VECTOR3_ZERO)) this._updateManipulationOrigin((0, _constantsJs.Constants).VECTOR3_ZERO); + const categoricalColor = specColumns.color && !specColumns.color.quantitative; + if (categoricalColor) { + addData(scope, ...topLookup(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, FieldNames.TopColor, FieldNames.TopIndex)); + colorDataName = legendDataName; } - reset(isSmooth) { - this.resetModel(isSmooth); - this.resetManipulationOrigin(); - this._camera.reset(isSmooth); + if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) { + if (specColumns.color.quantitative) { + addScales(scope, binnableColorScale(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); + } else { + addScales(scope, { + name: scaleName, + type: "ordinal", + domain: { + data: colorDataName, + field: FieldNames.TopColor, + sort: true + }, + range: { + scheme: insight.scheme || ColorScaleNone + }, + reverse: { signal: colorReverseSignalName } + }); + } } - start() { - if (!this._started && this._renderer) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - this._started = true; - this._log.write(LogLevel.info, "render loop started"); - if (this.startCallback) this.startCallback(); + addSignals(scope, colorBinCountSignal(specContext), colorReverseSignal(specContext)); + return { topColorField: FieldNames.TopColor, colorDataName }; + } + function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { + const titleSignal = `parent[${JSON.stringify(FieldNames.FacetTitle)}]`; + const index2 = `datum[${JSON.stringify(FieldNames.Ordinal)}] - 1`; + const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index2); + const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index2); + addMarks(globalScope, col.header, row.footer); + addMarks(col.header, { + type: "text", + encode: { + enter: { + align: { + value: "center" + }, + baseline: { + value: "middle" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + x: { + signal: `${sizeSignals.layoutWidth} / 2` + }, + limit: { + signal: sizeSignals.layoutWidth + }, + fontSize: { + signal: SignalNames.TextSize + }, + text: { + signal: titleSignal + } + } + } + }); + addMarks(row.footer, { + type: "text", + encode: { + enter: { + align: { + value: "left" + }, + baseline: { + value: "middle" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + y: { + signal: `${sizeSignals.layoutHeight} / 2` + }, + limit: { + signal: SignalNames.PlotOffsetRight + }, + fontSize: { + signal: SignalNames.TextSize + }, + text: { + signal: titleSignal + } + } + } + }); + } + function addFacetCellTitles(scope, sizeSignals, axisTextColor) { + addMarks(scope, { + type: "text", + encode: { + enter: { + align: { + value: "center" + }, + baseline: { + value: "bottom" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + x: { + signal: `(${sizeSignals.layoutWidth}) / 2` + }, + text: { + signal: `parent[${JSON.stringify(FieldNames.FacetTitle)}]` + }, + fontSize: { + signal: SignalNames.TextSize + }, + limit: { + signal: sizeSignals.layoutWidth + }, + y: { + signal: `-${SignalNames.FacetPaddingTop} / 2` + } + } + } + }); + } + function addFacetAxesGroupMarks(props) { + const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; + const { sizeSignals } = facetScope; + const colSequence = createSequence(colSeqName, sizeSignals.colCount); + const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); + const index2 = "datum.data"; + const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index2); + const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index2); + addData(globalScope, colSequence, rowSequence); + addMarks(globalScope, col.footer, row.header); + addScales(globalScope, colTitleScale, rowTitleScale); + const map2 = { + main: [ + { + scope: facetScope.facetScope, + lines: true, + labels: false, + title: false } - } - stop() { - if (this._started) { - this._started = false; - if (this._windowAnimationFrame != null) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - this._log.write(LogLevel.info, "render loop stopped"); - } - if (this.stopCallback) this.stopCallback(); + ], + x: [ + { + scope: col.footer, + lines: true, + labels: true, + title: false + }, + { + scope: plotScope, + scale: colTitleScale, + lines: false, + labels: false, + title: true + } + ], + y: [ + { + scope: row.header, + lines: true, + labels: true, + title: false + }, + { + scope: plotScope, + scale: rowTitleScale, + lines: false, + labels: false, + title: true + } + ] + }; + return map2; + } + function facetRowHeaderFooter(data2, sizeSignals, index2) { + const rowFn = (xSignal) => { + return { + type: "group", + from: { data: data2 }, + encode: { + update: { + x: { signal: xSignal }, + y: { + signal: `${SignalNames.PlotOffsetTop} + ${SignalNames.FacetPaddingTop} + (${index2}) * (${sizeSignals.layoutHeight} + ${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})` + }, + height: { signal: sizeSignals.layoutHeight } + } + } + }; + }; + const header = rowFn(SignalNames.PlotOffsetLeft); + const footer = rowFn(`${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetRight} / 2`); + return { header, footer }; + } + function facetColumnHeaderFooter(data2, sizeSignals, index2) { + const colFn = (ySignal) => { + return { + type: "group", + from: { data: data2 }, + encode: { + update: { + x: { + signal: `(${index2}) * (${sizeSignals.layoutWidth} + ${SignalNames.FacetPaddingLeft}) + ${SignalNames.FacetPaddingLeft} + ${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` + }, + y: { signal: `${ySignal} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: sizeSignals.layoutWidth } + } + } + }; + }; + const header = colFn(`${SignalNames.PlotOffsetTop} / 2`); + const footer = colFn(`${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut}`); + return { header, footer }; + } + function createSequence(dataName, countSignal) { + return { + name: dataName, + transform: [ + { + type: "sequence", + start: 0, + stop: { + signal: countSignal + } } + ] + }; + } + function fill$1(context2, colorFieldName, scale2) { + const { specColumns, insight, specViewOptions } = context2; + const colorColumn = specColumns.color; + return colorColumn ? colorColumn.isColorData || insight.directColor ? { + field: safeFieldName(colorColumn.name) + } : { + scale: scale2, + field: colorColumn.quantitative ? safeFieldName(colorColumn.name) : colorFieldName + } : { + value: specViewOptions.colors.defaultCube + }; + } + function opacity(context2) { + const result = { + signal: SignalNames.MarkOpacity + }; + return result; + } + class GlobalScope { + constructor(props) { + const { dataName, markGroup, scope, signals } = props; + this.scope = scope; + this._markGroup = markGroup; + this.signals = signals; + this.data = getDataByName(scope.data, dataName).data; + this._markDataName = dataName; + this.offsets = { + x: "0", + y: "0", + h: SignalNames.PlotHeightIn, + w: SignalNames.PlotWidthIn + }; + this.sizeSignals = { + layoutHeight: SignalNames.PlotHeightIn, + layoutWidth: SignalNames.PlotWidthIn + }; + this.zSize = SignalNames.PlotHeightIn; } - checkWebXRSupport() { - const xrSystem = navigator.xr; - if (xrSystem) xrSystem.isSessionSupported("immersive-vr").then((supported)=>{ - if (supported) { - this._log.write(LogLevel.info, "WebXR supported"); - if (this.webXRSupportedCallback) this.webXRSupportedCallback(); - } - }); + get markDataName() { + return this._markDataName; } - requestWebXRSession() { - if (this._webXRSession) this._webXRSession.end(); - else navigator.xr.requestSession("immersive-vr").then((session)=>this._webXRSessionStarted(session)); + setMarkDataName(markDataName) { + this._markDataName = markDataName; } - _webXRSessionStarted(session) { - if (this.webXRSessionStartedCallback) this.webXRSessionStartedCallback(); - this._webXRSession = session; - session.onend = ()=>this._webXRSessionEnded(); - this._renderer.initializeWebXR(session).then(()=>{ - if (this._windowAnimationFrame) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - } - session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - }); - session.oninputsourceschange = (event)=>this._webXRInputSourcesChanged(event); + get markGroup() { + return this._markGroup; } - _webXRSessionEnded() { - if (this.webXRSessionEndedCallback) this.webXRSessionEndedCallback(); - this._webXRSession = null; - this._renderer.controllers.length = 0; - this.start(); - } - _webXRInputSourcesChanged(event) { - if (event.added.length > 0) { - const added = event.added[0]; - if (added.targetRayMode == "tracked-pointer") { - const profiles = added.profiles; - const handedness = added.handedness; - if (this.webXRInputSourceRequestCallback) this.webXRInputSourceRequestCallback(profiles, handedness, (response)=>{ - const options = { - profiles: profiles, - handedness: handedness, - obj: response.obj, - texture: response.texture - }; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - }, (e)=>{ - this._log.write(LogLevel.error, e); - }); - else { - const options = {}; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - } - } - } - if (event.removed.length > 0) this.renderer.controllers.length = 0; + setMarkGroup(markGroup) { + this._markGroup = markGroup; } - _tick(currentTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - let elapsedTime = currentTime - this._previousTime; - this._previousTime = currentTime; - if (elapsedTime > 0) { - this.update(elapsedTime, xrFrame); - yield this.render(elapsedTime, xrFrame); - } - if (xrFrame) xrFrame.session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - else if (this._started) this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - }); + } + class Layout { + constructor(props) { + this.props = props; + this.id = props.id; } - update(elapsedTime, xrFrame) { - this._renderer.setSize(elapsedTime); - if (this.updateCallback) this.updateCallback(elapsedTime, xrFrame); - if (this._config.isDebugVisible) this._debugText.clear(); - this._fps.update(elapsedTime); - if (this._inputManager) { - this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; - this._inputManager.update(elapsedTime, xrFrame); - } - let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); - amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); - amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); - this._renderer.mMatrix = this._modelMMatrix; - if (this._config.isDebugVisible) { - this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); - this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); - this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); - this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); - this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); - this._debugText.addLine(`cam fov ${Math.round((0, _angleJs.AngleHelper).radiansToDegrees(this._config.fov))}`); - this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); - } - if (!xrFrame) { - this._camera.width = this._renderer.width; - this._camera.height = this._renderer.height; - this._camera.modelMMatrix = this._modelMMatrix; - this._camera.modelPosition = this._smoothedModelPosition; - this._camera.modelRotation = this._smoothedModelRotation; - this._camera.modelScale = this._smoothedModelScale; - this._camera.modelManipulationOrigin = this._modelManipulationOrigin; - this._camera.update(elapsedTime); - this._renderer.vMatrices = this._camera.vMatrices; - this._renderer.mvMatrices = this._camera.mvMatrices; - this._renderer.pMatrices = this._camera.pMatrices; - this._renderer.inverseVMatrices = this._camera.inverseVMatrices; - this._renderer.inversePMatrices = this._camera.inversePMatrices; - } - this._renderer.prepare(xrFrame); - if (!xrFrame && this._config.stereoMode == StereoMode.none) this._renderer.pickPMatrix = this._camera.pMatrices[0]; - else { - const fov = (0, _matrixJs.MatrixHelper).fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); - (0, _glMatrix.mat4).perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); - this._renderer.pickPMatrix = this._mat4; - } - if (this._renderer.isInitialized) this._renderer.update(elapsedTime); + getGrouping() { + return null; } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - this._fps.render(); - if (this._renderer.isInitialized) { - yield this._renderer.render(elapsedTime, xrFrame); - if (this.afterRenderCallback) this.afterRenderCallback(); - } - }); + getAggregateSumOp() { + return null; } - _syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); - (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - _updateManipulationOrigin(position) { - this._log.write(LogLevel.info, `manipulation origin ${position[0].toFixed(3)},${position[1].toFixed(3)},${position[2].toFixed(3)}`); - this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).copy(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).transformMat4(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); - (0, _glMatrix.vec3).subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - if (this.manipulationOriginChangedCallback) { - const result = { - x: position[0], - y: position[1], - z: position[2] - }; - this.manipulationOriginChangedCallback(result); - } - } - pickLasso(x0, y0, x1, y1, pickType) { - const inverseMMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).invert(inverseMMatrix, this._modelMMatrix); - const sets = []; - const nearPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const farPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const directions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._camera.unproject(nearPositions[0], x0, y1, -1); - this._camera.unproject(farPositions[0], x0, y1, 1); - this._camera.unproject(nearPositions[1], x1, y1, -1); - this._camera.unproject(farPositions[1], x1, y1, 1); - this._camera.unproject(nearPositions[2], x1, y0, -1); - this._camera.unproject(farPositions[2], x1, y0, 1); - this._camera.unproject(nearPositions[3], x0, y0, -1); - this._camera.unproject(farPositions[3], x0, y0, 1); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).transformMat4(nearPositions[i], nearPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).transformMat4(farPositions[i], farPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).subtract(directions[i], farPositions[i], nearPositions[i]); - (0, _glMatrix.vec3).normalize(directions[i], directions[i]); - } - const normals = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const d = []; - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).cross(normals[i], directions[(i + 1) % 4], directions[i]); - (0, _glMatrix.vec3).normalize(normals[i], normals[i]); - d.push(-(0, _glMatrix.vec3).dot(normals[i], nearPositions[i])); - } - if (pickType == PickType.data) { - const translation = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const transitionBuffer = this._renderer.transitionBuffers[i]; - const set = new Set(); - if (transitionBuffer.isVisible) { - const start = window.performance.now(); - const currentBuffer = transitionBuffer.currentBuffer; - const lookup = currentBuffer.lookup; - for(let j = 0; j < currentBuffer.length; j++){ - const id = currentBuffer.ids[j]; - const index = lookup[id]; - if (index != null) { - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, index, translation); - let isInside = true; - for(let k = 0; k < 4; k++){ - let distance = (0, _glMatrix.vec3).dot(normals[k], translation); - distance += d[k]; - if (distance < 0) { - isInside = false; - break; - } - } - if (isInside) set.add(id); - } - } - if (set.size > 0) this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set.size} ${Math.round(window.performance.now() - start)}ms`); - } - sets.push(set); - } - } - return sets; + build() { + throw "Not implemented"; } -} -const CameraMode = { - orbit: "orbit", - altAzimuth: "altAzimuth" -}; -const StereoMode = { - none: "none", - split: "split", - anaglyph: "anaglyph", - left: "left", - right: "right" -}; -const SelectionMode = { - new: "new", - add: "add", - subtract: "subtract", - intersect: "intersect" -}; -const FilterMode = { - isolate: "isolate", - exclude: "exclude" -}; -const HorizontalAlignment = { - left: "left", - center: "center", - right: "right" -}; -const VerticalAlignment = { - top: "top", - center: "center", - bottom: "bottom" -}; -const TextAlignment = { - left: "left", - center: "center", - right: "right" -}; -const Orientation = { - horizontal: "horizontal", - vertical: "vertical" -}; -const AxesTextOrientation = { - parallel: "parallel", - perpendicular: "perpendicular" -}; -const AxesVisibility = { - none: "none", - current: "current", - previous: "previous" -}; -const PickType = { - none: 0, - data: 1, - label: 2, - axesDivision: 3, - axesTitle: 4, - axesLabel: 5, - axesHeading: 6 -}; -const Theme = { - dark: "dark", - light: "light" -}; -const HighlightMode = { - luminance: "luminance", - color: "color" -}; -const UnitType = { - block: "block", - blockSdf: "blockSdf", - boxFrameSdf: "boxFrameSdf", - sphere: "sphere", - sphereSdf: "sphereSdf", - cylinder: "cylinder", - cylinderSdf: "cylinderSdf", - hexPrism: "hexPrism", - hexPrismSdf: "hexPrismSdf", - sdf: "sdf", - disk: "disk", - ringSdf: "ringSdf" -}; -const SingleTouchAction = { - none: "none", - translate: "translate", - rotate: "rotate", - lasso: "lasso" -}; -const MouseWheelAction = { - none: "none", - zoom: "zoom", - rotateY: "rotateY" -}; -const LogLevel = { - trace: 0, - debug: 1, - info: 2, - warn: 3, - error: 4 -}; -const Edge2D = { - top: 0, - right: 1, - bottom: 2, - left: 3 -}; -const Face2D = { - front: 0, - back: 1 -}; -const Edge3D = { - topFront: 0, - topRight: 1, - topBack: 2, - topLeft: 3, - bottomFront: 4, - bottomRight: 5, - bottomBack: 6, - bottomLeft: 7, - frontRight: 8, - backRight: 9, - backLeft: 10, - frontLeft: 11 -}; -const Face3D = { - top: 0, - right: 1, - bottom: 2, - left: 3, - front: 4, - back: 5 -}; -const HexOrientation = { - pointyTop: "pointyTop", - flatTop: "flatTop" -}; -const RenderMode = { - color: "color", - hdr: "hdr", - depth: "depth", - normal: "normal", - segment: "segment", - edge: "edge" -}; - -},{"gl-matrix":"5x28d","./cameras/altazimuth.js":"gRqOf","./config.js":"bCTP3","./constants.js":"lD0bG","./debug.js":"eYPBQ","./fps.js":"9OHgw","./helpers/angle.js":"53hwW","./palette.js":"hZb65","./components/controller.js":"f5tIG","./helpers/matrix.js":"7gWc5","./components/axes/cartesian3d.js":"jfjef","./components/axes/cartesian2d.js":"d0jS2","./font.js":"ibkbS","./vertex.js":"4J2YE","./input/manager.js":"8nDg6","./log.js":"c6yiP","./helpers/math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5x28d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "glMatrix", ()=>_commonJs); -parcelHelpers.export(exports, "mat2", ()=>_mat2Js); -parcelHelpers.export(exports, "mat2d", ()=>_mat2DJs); -parcelHelpers.export(exports, "mat3", ()=>_mat3Js); -parcelHelpers.export(exports, "mat4", ()=>_mat4Js); -parcelHelpers.export(exports, "quat", ()=>_quatJs); -parcelHelpers.export(exports, "quat2", ()=>_quat2Js); -parcelHelpers.export(exports, "vec2", ()=>_vec2Js); -parcelHelpers.export(exports, "vec3", ()=>_vec3Js); -parcelHelpers.export(exports, "vec4", ()=>_vec4Js); -var _commonJs = require("./common.js"); -var _mat2Js = require("./mat2.js"); -var _mat2DJs = require("./mat2d.js"); -var _mat3Js = require("./mat3.js"); -var _mat4Js = require("./mat4.js"); -var _quatJs = require("./quat.js"); -var _quat2Js = require("./quat2.js"); -var _vec2Js = require("./vec2.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); - -},{"./common.js":"7GML7","./mat2.js":false,"./mat2d.js":false,"./mat3.js":"80EZI","./mat4.js":"e5zmM","./quat.js":"2chmr","./quat2.js":false,"./vec2.js":"eovGI","./vec3.js":"9zs5l","./vec4.js":"ao75m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7GML7":[function(require,module,exports,__globalThis) { -/** - * Common utilities - * @module glMatrix - */ // Configuration Constants -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "EPSILON", ()=>EPSILON); -parcelHelpers.export(exports, "ARRAY_TYPE", ()=>ARRAY_TYPE); -parcelHelpers.export(exports, "RANDOM", ()=>RANDOM); -/** - * Sets the type of array used when creating new vectors and matrices - * - * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array - */ parcelHelpers.export(exports, "setMatrixArrayType", ()=>setMatrixArrayType); -/** - * Convert Degree To Radian - * - * @param {Number} a Angle in Degrees - */ parcelHelpers.export(exports, "toRadian", ()=>toRadian); -/** - * Tests whether or not the arguments have approximately the same value, within an absolute - * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less - * than or equal to 1.0, and a relative tolerance is used for larger values) - * - * @param {Number} a The first number to test. - * @param {Number} b The second number to test. - * @returns {Boolean} True if the numbers are approximately equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -var EPSILON = 0.000001; -var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; -var RANDOM = Math.random; -function setMatrixArrayType(type) { - ARRAY_TYPE = type; -} -var degree = Math.PI / 180; -function toRadian(a) { - return a * degree; -} -function equals(a, b) { - return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b)); -} -if (!Math.hypot) Math.hypot = function() { - var y = 0, i = arguments.length; - while(i--)y += arguments[i] * arguments[i]; - return Math.sqrt(y); -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"80EZI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3x3 Matrix - * @module mat3 - */ /** - * Creates a new identity mat3 - * - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param {mat3} out the receiving 3x3 matrix - * @param {ReadonlyMat4} a the source 4x4 matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromMat4", ()=>fromMat4); -/** - * Creates a new mat3 initialized with values from an existing matrix - * - * @param {ReadonlyMat3} a matrix to clone - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat3 to another - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat3 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} A new mat3 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat3 to the given values - * - * @param {mat3} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat3 to the identity matrix - * - * @param {mat3} out the receiving matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat3 - * - * @param {ReadonlyMat3} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat3 by the given vector - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to translate - * @param {ReadonlyVec2} v vector to translate by - * @returns {mat3} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Rotates a mat3 by the given angle - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Scales the mat3 by the dimensions in the given vec2 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {ReadonlyVec2} v the vec2 to scale the matrix by - * @returns {mat3} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.translate(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Translation vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a given angle - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.rotate(dest, dest, rad); - * - * @param {mat3} out mat3 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.scale(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Scaling vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Copies the values from a mat2d into a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat2d} a the matrix to copy - * @returns {mat3} out - **/ parcelHelpers.export(exports, "fromMat2d", ()=>fromMat2d); -/** - * Calculates a 3x3 matrix from the given quaternion - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "normalFromMat4", ()=>normalFromMat4); -/** - * Generates a 2D projection matrix with the given bounds - * - * @param {mat3} out mat3 frustum matrix will be written into - * @param {number} width Width of your gl context - * @param {number} height Height of gl context - * @returns {mat3} out - */ parcelHelpers.export(exports, "projection", ()=>projection); -/** - * Returns a string representation of a mat3 - * - * @param {ReadonlyMat3} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat3 - * - * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat3's after multiplying each element of the second operand by a scalar value. - * - * @param {mat3} out the receiving vector - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(9); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; + } + function testForCollapseSelection() { + return `datum.${FieldNames.Collapsed}`; + } + class AggregateContainer extends Layout { + constructor(props) { + super(props); + this.props = props; + const a2 = this.aggregation = this.getAggregation(); + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a2}_extent`, + scale: `scale_${p}`, + extentData: `data_${p}_extent`, + offsets: `data_${p}_offsets` + }; } - out[0] = 1; - out[4] = 1; - out[8] = 1; - return out; -} -function fromMat4(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; - return out; -} -function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) { - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; - return out; -} -function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a12 = a[5]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a01; - out[5] = a[7]; - out[6] = a02; - out[7] = a12; - } else { - out[0] = a[0]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a[1]; - out[4] = a[4]; - out[5] = a[7]; - out[6] = a[2]; - out[7] = a[5]; - out[8] = a[8]; + getAggregateSumOp() { + if (this.aggregation === "sum") { + const fieldOp = { + field: safeFieldName(this.props.sumBy.name), + op: "sum", + as: FieldNames.Sum + }; + return fieldOp; + } } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b01 = a22 * a11 - a12 * a21; - var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21; - if (!det) return null; - det = 1.0 / det; - out[0] = b01 * det; - out[1] = (-a22 * a01 + a02 * a21) * det; - out[2] = (a12 * a01 - a02 * a11) * det; - out[3] = b11 * det; - out[4] = (a22 * a00 - a02 * a20) * det; - out[5] = (-a12 * a00 + a02 * a10) * det; - out[6] = b21 * det; - out[7] = (-a21 * a00 + a01 * a20) * det; - out[8] = (a11 * a00 - a01 * a10) * det; - return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - out[0] = a11 * a22 - a12 * a21; - out[1] = a02 * a21 - a01 * a22; - out[2] = a01 * a12 - a02 * a11; - out[3] = a12 * a20 - a10 * a22; - out[4] = a00 * a22 - a02 * a20; - out[5] = a02 * a10 - a00 * a12; - out[6] = a10 * a21 - a11 * a20; - out[7] = a01 * a20 - a00 * a21; - out[8] = a00 * a11 - a01 * a10; - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b00 = b[0], b01 = b[1], b02 = b[2]; - var b10 = b[3], b11 = b[4], b12 = b[5]; - var b20 = b[6], b21 = b[7], b22 = b[8]; - out[0] = b00 * a00 + b01 * a10 + b02 * a20; - out[1] = b00 * a01 + b01 * a11 + b02 * a21; - out[2] = b00 * a02 + b01 * a12 + b02 * a22; - out[3] = b10 * a00 + b11 * a10 + b12 * a20; - out[4] = b10 * a01 + b11 * a11 + b12 * a21; - out[5] = b10 * a02 + b11 * a12 + b12 * a22; - out[6] = b20 * a00 + b21 * a10 + b22 * a20; - out[7] = b20 * a01 + b21 * a11 + b22 * a21; - out[8] = b20 * a02 + b21 * a12 + b22 * a22; - return out; -} -function translate(out, a, v) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], x = v[0], y = v[1]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a10; - out[4] = a11; - out[5] = a12; - out[6] = x * a00 + y * a10 + a20; - out[7] = x * a01 + y * a11 + a21; - out[8] = x * a02 + y * a12 + a22; - return out; -} -function rotate(out, a, rad) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], s = Math.sin(rad), c = Math.cos(rad); - out[0] = c * a00 + s * a10; - out[1] = c * a01 + s * a11; - out[2] = c * a02 + s * a12; - out[3] = c * a10 - s * a00; - out[4] = c * a11 - s * a01; - out[5] = c * a12 - s * a02; - out[6] = a20; - out[7] = a21; - out[8] = a22; - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1]; - out[0] = x * a[0]; - out[1] = x * a[1]; - out[2] = x * a[2]; - out[3] = y * a[3]; - out[4] = y * a[4]; - out[5] = y * a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = v[0]; - out[7] = v[1]; - out[8] = 1; - return out; -} -function fromRotation(out, rad) { - var s = Math.sin(rad), c = Math.cos(rad); - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = -s; - out[4] = c; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = v[1]; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromMat2d(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = 0; - out[3] = a[2]; - out[4] = a[3]; - out[5] = 0; - out[6] = a[4]; - out[7] = a[5]; - out[8] = 1; - return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - yy - zz; - out[3] = yx - wz; - out[6] = zx + wy; - out[1] = yx + wz; - out[4] = 1 - xx - zz; - out[7] = zy - wx; - out[2] = zx - wy; - out[5] = zy + wx; - out[8] = 1 - xx - yy; - return out; -} -function normalFromMat4(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - return out; -} -function projection(out, width, height) { - out[0] = 2 / width; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = -2 / height; - out[5] = 0; - out[6] = -1; - out[7] = 1; - out[8] = 1; - return out; -} -function str(a) { - return "mat3(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; - return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7], a8 = a[8]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e5zmM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied. - * @module mat4 - */ /** - * Creates a new identity mat4 - * - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new mat4 initialized with values from an existing matrix - * - * @param {ReadonlyMat4} a matrix to clone - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat4 to another - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat4 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} A new mat4 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat4 to the given values - * - * @param {mat4} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat4 to the identity matrix - * - * @param {mat4} out the receiving matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat4 - * - * @param {ReadonlyMat4} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat4s - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat4 by the given vector - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to translate - * @param {ReadonlyVec3} v vector to translate by - * @returns {mat4} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Scales the mat4 by the dimensions in the given vec3 not using vectorization - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {ReadonlyVec3} v the vec3 to scale the matrix by - * @returns {mat4} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Rotates a mat4 by the given angle around the given axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Rotates a matrix by the given angle around the X axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a matrix by the given angle around the Y axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a matrix by the given angle around the Z axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.scale(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Creates a matrix from a given angle around a given axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotate(dest, dest, rad, axis); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from the given angle around the X axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateX(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromXRotation", ()=>fromXRotation); -/** - * Creates a matrix from the given angle around the Y axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateY(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromYRotation", ()=>fromYRotation); -/** - * Creates a matrix from the given angle around the Z axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateZ(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromZRotation", ()=>fromZRotation); -/** - * Creates a matrix from a quaternion rotation and vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslation", ()=>fromRotationTranslation); -/** - * Creates a new mat4 from a dual quat. - * - * @param {mat4} out Matrix - * @param {ReadonlyQuat2} a Dual Quaternion - * @returns {mat4} mat4 receiving operation result - */ parcelHelpers.export(exports, "fromQuat2", ()=>fromQuat2); -/** - * Returns the translation vector component of a transformation - * matrix. If a matrix is built with fromRotationTranslation, - * the returned vector will be the same as the translation vector - * originally supplied. - * @param {vec3} out Vector to receive translation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getTranslation", ()=>getTranslation); -/** - * Returns the scaling factor component of a transformation - * matrix. If a matrix is built with fromRotationTranslationScale - * with a normalized Quaternion paramter, the returned vector will be - * the same as the scaling vector - * originally supplied. - * @param {vec3} out Vector to receive scaling factor component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getScaling", ()=>getScaling); -/** - * Returns a quaternion representing the rotational component - * of a transformation matrix. If a matrix is built with - * fromRotationTranslation, the returned quaternion will be the - * same as the quaternion originally supplied. - * @param {quat} out Quaternion to receive the rotation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {quat} out - */ parcelHelpers.export(exports, "getRotation", ()=>getRotation); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScale", ()=>fromRotationTranslationScale); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @param {ReadonlyVec3} o The origin vector around which to scale and rotate - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScaleOrigin", ()=>fromRotationTranslationScaleOrigin); -/** - * Calculates a 4x4 matrix from the given quaternion - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Generates a frustum matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Number} left Left bound of the frustum - * @param {Number} right Right bound of the frustum - * @param {Number} bottom Bottom bound of the frustum - * @param {Number} top Top bound of the frustum - * @param {Number} near Near bound of the frustum - * @param {Number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "frustum", ()=>frustum); -/** - * Generates a perspective projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveNO", ()=>perspectiveNO); -parcelHelpers.export(exports, "perspective", ()=>perspective); -/** - * Generates a perspective projection matrix suitable for WebGPU with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveZO", ()=>perspectiveZO); -/** - * Generates a perspective projection matrix with the given field of view. - * This is primarily useful for generating projection matrices to be used - * with the still experiemental WebVR API. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveFromFieldOfView", ()=>perspectiveFromFieldOfView); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoNO", ()=>orthoNO); -parcelHelpers.export(exports, "ortho", ()=>ortho); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoZO", ()=>orthoZO); -/** - * Generates a look-at matrix with the given eye position, focal point, and up axis. - * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "lookAt", ()=>lookAt); -/** - * Generates a matrix that makes something look at something else. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "targetTo", ()=>targetTo); -/** - * Returns a string representation of a mat4 - * - * @param {ReadonlyMat4} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat4 - * - * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat4's - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat4's after multiplying each element of the second operand by a scalar value. - * - * @param {mat4} out the receiving vector - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(16); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; + build() { + const { aggregation, names, props } = this; + const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentSignal, + update: `${names.globalAggregateExtentSignal}[1]` + }); + const horizontal = dock === "left"; + const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; + const offsets2 = { + x: parentScope.offsets.x, + y: addOffsets(parentScope.offsets.y, dock === "bottom" ? groupScaled : ""), + h: horizontal ? parentScope.offsets.h : dock === "top" ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, + w: horizontal ? groupScaled : parentScope.offsets.w + }; + const scale2 = { + type: "linear", + name: names.scale, + domain: [ + 0, + { + signal: props.globalAggregateMaxExtentSignal + } + ], + range: horizontal ? [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ] : [ + { + signal: parentScope.sizeSignals.layoutHeight + }, + 0 + ], + nice: niceScale, + zero: true, + reverse: dock === "top" + }; + const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentScaledSignal, + update: dock === "bottom" ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue + }); + return { + offsets: offsets2, + sizeSignals: horizontal ? { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: null + } : { + layoutHeight: null, + layoutWidth: parentScope.sizeSignals.layoutWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? [scale2] : void 0, + y: horizontal ? void 0 : [scale2] + } + }, + encodingRuleMap: horizontal ? { + x: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.x + }], + width: [{ + test: testForCollapseSelection(), + value: 0 + }] + } : { + y: [{ + test: testForCollapseSelection(), + signal: dock === "top" ? parentScope.offsets.y : addOffsets(parentScope.offsets.y, parentScope.offsets.h) + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; } - out[0] = 1; - out[5] = 1; - out[10] = 1; - out[15] = 1; - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; -} -function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; - return out; -} -function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a03 = a[3]; - var a12 = a[6], a13 = a[7]; - var a23 = a[11]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a01; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a02; - out[9] = a12; - out[11] = a[14]; - out[12] = a03; - out[13] = a13; - out[14] = a23; - } else { - out[0] = a[0]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a[1]; - out[5] = a[5]; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a[2]; - out[9] = a[6]; - out[10] = a[10]; - out[11] = a[14]; - out[12] = a[3]; - out[13] = a[7]; - out[14] = a[11]; - out[15] = a[15]; + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); - out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); - out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); - out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); - out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); - out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); - out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); - out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - return out; -} -function translate(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - if (a === out) { - out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - } else { - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a03; - out[4] = a10; - out[5] = a11; - out[6] = a12; - out[7] = a13; - out[8] = a20; - out[9] = a21; - out[10] = a22; - out[11] = a23; - out[12] = a00 * x + a10 * y + a20 * z + a[12]; - out[13] = a01 * x + a11 * y + a21 * z + a[13]; - out[14] = a02 * x + a12 * y + a22 * z + a[14]; - out[15] = a03 * x + a13 * y + a23 * z + a[15]; + getAggregation() { + const { props } = this; + let s2; + if (props.dock === "left") { + s2 = props.axesScales.x; + } else { + s2 = props.axesScales.y; + } + switch (s2.aggregate) { + case "sum": + return "sum"; + default: + return "count"; + } } - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - out[0] = a[0] * x; - out[1] = a[1] * x; - out[2] = a[2] * x; - out[3] = a[3] * x; - out[4] = a[4] * y; - out[5] = a[5] * y; - out[6] = a[6] * y; - out[7] = a[7] * y; - out[8] = a[8] * z; - out[9] = a[9] * z; - out[10] = a[10] * z; - out[11] = a[11] * z; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function rotate(out, a, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - var b00, b01, b02; - var b10, b11, b12; - var b20, b21, b22; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; // Construct the elements of the rotation matrix - b00 = x * x * t + c; - b01 = y * x * t + z * s; - b02 = z * x * t - y * s; - b10 = x * y * t - z * s; - b11 = y * y * t + c; - b12 = z * y * t + x * s; - b20 = x * z * t + y * s; - b21 = y * z * t - x * s; - b22 = z * z * t + c; // Perform rotation-specific matrix multiplication - out[0] = a00 * b00 + a10 * b01 + a20 * b02; - out[1] = a01 * b00 + a11 * b01 + a21 * b02; - out[2] = a02 * b00 + a12 * b01 + a22 * b02; - out[3] = a03 * b00 + a13 * b01 + a23 * b02; - out[4] = a00 * b10 + a10 * b11 + a20 * b12; - out[5] = a01 * b10 + a11 * b11 + a21 * b12; - out[6] = a02 * b10 + a12 * b11 + a22 * b12; - out[7] = a03 * b10 + a13 * b11 + a23 * b12; - out[8] = a00 * b20 + a10 * b21 + a20 * b22; - out[9] = a01 * b20 + a11 * b21 + a21 * b22; - out[10] = a02 * b20 + a12 * b21 + a22 * b22; - out[11] = a03 * b20 + a13 * b21 + a23 * b22; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; + } + class AggregateSquare extends Layout { + constructor(props) { + super(props); + this.props = props; + const a2 = this.props.aggregation; + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a2}_extent`, + extentData: `data_${p}_extent` + }; } - return out; -} -function rotateX(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[4] = a10 * c + a20 * s; - out[5] = a11 * c + a21 * s; - out[6] = a12 * c + a22 * s; - out[7] = a13 * c + a23 * s; - out[8] = a20 * c - a10 * s; - out[9] = a21 * c - a11 * s; - out[10] = a22 * c - a12 * s; - out[11] = a23 * c - a13 * s; - return out; -} -function rotateY(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c - a20 * s; - out[1] = a01 * c - a21 * s; - out[2] = a02 * c - a22 * s; - out[3] = a03 * c - a23 * s; - out[8] = a00 * s + a20 * c; - out[9] = a01 * s + a21 * c; - out[10] = a02 * s + a22 * c; - out[11] = a03 * s + a23 * c; - return out; -} -function rotateZ(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c + a10 * s; - out[1] = a01 * c + a11 * s; - out[2] = a02 * c + a12 * s; - out[3] = a03 * c + a13 * s; - out[4] = a10 * c - a00 * s; - out[5] = a11 * c - a01 * s; - out[6] = a12 * c - a02 * s; - out[7] = a13 * c - a03 * s; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = v[1]; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = v[2]; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotation(out, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; // Perform rotation-specific matrix multiplication - out[0] = x * x * t + c; - out[1] = y * x * t + z * s; - out[2] = z * x * t - y * s; - out[3] = 0; - out[4] = x * y * t - z * s; - out[5] = y * y * t + c; - out[6] = z * y * t + x * s; - out[7] = 0; - out[8] = x * z * t + y * s; - out[9] = y * z * t - x * s; - out[10] = z * z * t + c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromXRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = c; - out[6] = s; - out[7] = 0; - out[8] = 0; - out[9] = -s; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromYRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = 0; - out[2] = -s; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = s; - out[9] = 0; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromZRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = 0; - out[4] = -s; - out[5] = c; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotationTranslation(out, q, v) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromQuat2(out, a) { - var translation = new _commonJs.ARRAY_TYPE(3); - var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7]; - var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense - if (magnitude > 0) { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; + build() { + const { names, props } = this; + const { aggregation, globalScope, groupings, onBuild, parentScope } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; + const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; + const squareMaxArea = `(${[squareMaxSide, squareMaxSide].join(" * ")})`; + const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; + const squareArea = `(${[squareMaxArea, shrinkRatio].join(" * ")})`; + const squareSide = `sqrt(${squareArea})`; + const localAggregateMaxExtentScaled = squareSide; + onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), + y: addOffsets(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), + h: squareSide, + w: squareSide + }; + return { + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: offsets2.y + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; + } + } + function dataExtent(column, signal) { + return { + type: "extent", + field: safeFieldName(column.name), + signal + }; + } + function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { + const { column, defaultBins: defaultBins2, maxbins: maxbins2, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; + if (column.quantitative) { + const field2 = `${prefix}_bin_${exprSafeFieldName(column.name)}`; + const fieldEnd = `${field2}_end`; + const binSignal = `${field2}_bins`; + const dataExtentSignal = `${field2}_bin_extent`; + const dataExtentSpanSignal = `${field2}_bin_extent_span`; + const outerSignal = `${field2}_outer_extent`; + domainDataName = `${field2}_sequence`; + const extentTransform = dataExtent(column, dataExtentSignal); + let imageSignal; + if (outerSignalExtents) { + imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); + } + const maxbinsSignal = { + name: maxbinsSignalName, + value: defaultBins2, + bind: { + name: maxbinsSignalDisplayName, + debounce: debounce$1, + input: "range", + min: 1, + max: maxbins2, + step: 1 + } + }; + const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; + const binTransform = { + type: "bin", + field: safeFieldName(column.name), + as: [ + field2, + fieldEnd + ], + signal: binSignal, + extent: { + signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` + //add a tiny bit to the upper extent to force the extra bin - https://github.com/vega/vega/issues/2899 + }, + minstep: shouldBeIntegralBinStep(column) ? 1 : 0, + maxbins: { + signal: maxbinsSignalName + } + }; + const dataSequence = { + name: domainDataName, + transform: [ + { + type: "sequence", + start: { + signal: `${binSignal}.start` + }, + stop: { + signal: `${binSignal}.stop` + }, + step: { + signal: `${binSignal}.step` + } + }, + { + type: "formula", + expr: "datum.data", + as: field2 + }, + { + type: "formula", + expr: `datum.data + ${binSignal}.step`, + as: fieldEnd + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.start`, + as: FieldNames.First + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, + as: FieldNames.Last + }, + { + // when there is only one bin, use only first sequence element + type: "filter", + expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify(FieldNames.First)}] : true` + } + ] + }; + const signals = [ + maxbinsSignal, + { + name: dataExtentSpanSignal, + update: `${extentSignal}[1] - ${extentSignal}[0]` + } + ]; + if (imageSignal) { + signals.push(imageSignal); + } + const augmentBinnable = { + discreteColumn, + native: false, + transforms: [extentTransform, binTransform], + fields: [field2, fieldEnd], + binSignal, + extentSignal, + dataSequence, + domainDataName, + signals, + fullScaleDataname: dataSequence.name + }; + return augmentBinnable; } else { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; + const nativeBinnable = { + discreteColumn, + native: true, + fields: [column.name], + domainDataName, + fullScaleDataname: domainDataName + }; + return nativeBinnable; + } + } + function outerExtentSignal(name, min2, max2, dataExtent2) { + return { + name, + update: `[min(${min2}, ${dataExtent2}[0]), max(${max2}, ${dataExtent2}[1])]` + }; + } + function shouldBeIntegralBinStep(column) { + return column.quantitative && (column.type === "integer" && column.stats.max - column.stats.min <= 7); + } + const bandScaleLinearSuffix = "_linear"; + let Band$1 = class Band extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `band_${this.id}`; + this.names = { + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + bandWidth: `${p}_bandwidth`, + accumulative: `${p}_accumulative` + }; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); + } + getGrouping() { + return this.bin.fields; + } + build() { + const { bin: bin2, names, props } = this; + const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; + const binField = bin2.fields[0]; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + } + addData(globalScope.scope, { + name: names.accumulative, + source: bin2.fullScaleDataname, + transform: [ + { + type: "aggregate", + groupby: this.getGrouping().map(safeFieldName), + ops: ["count"] + } + ] + }); + const horizontal = orientation === "horizontal"; + const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; + modifySignal(minCellSignal, "max", `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); + addSignals(globalScope.scope, { + name: names.bandWidth, + update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` + }); + const scale2 = this.getScale(bin2, horizontal); + if (props.outerSignalExtents && bin2.native === false) { + addScales(globalScope.scope, linearScale(scale2.name + bandScaleLinearSuffix, { signal: bin2.extentSignal }, scale2.range, scale2.reverse, false, false)); + } + let encodingRuleMap; + if (!props.excludeEncodingRuleMap) { + encodingRuleMap = horizontal ? { + x: [ + { + test: testForCollapseSelection(), + signal: parentScope.offsets.x + } + ], + width: [ + { + test: testForCollapseSelection(), + value: 0 + } + ] + } : { + y: [ + { + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.offsets.h) + } + ], + height: [ + { + test: testForCollapseSelection(), + value: 0 + } + ] + }; + } + return { + offsets: this.getOffset(horizontal, binField), + sizeSignals: horizontal ? { + layoutHeight: names.bandWidth, + layoutWidth: parentScope.sizeSignals.layoutWidth + } : { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: names.bandWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? void 0 : [scale2], + y: horizontal ? [scale2] : void 0 + } + }, + encodingRuleMap + }; } - fromRotationTranslation(out, a, translation); - return out; -} -function getTranslation(out, mat) { - out[0] = mat[12]; - out[1] = mat[13]; - out[2] = mat[14]; - return out; -} -function getScaling(out, mat) { - var m11 = mat[0]; - var m12 = mat[1]; - var m13 = mat[2]; - var m21 = mat[4]; - var m22 = mat[5]; - var m23 = mat[6]; - var m31 = mat[8]; - var m32 = mat[9]; - var m33 = mat[10]; - out[0] = Math.hypot(m11, m12, m13); - out[1] = Math.hypot(m21, m22, m23); - out[2] = Math.hypot(m31, m32, m33); - return out; -} -function getRotation(out, mat) { - var scaling = new _commonJs.ARRAY_TYPE(3); - getScaling(scaling, mat); - var is1 = 1 / scaling[0]; - var is2 = 1 / scaling[1]; - var is3 = 1 / scaling[2]; - var sm11 = mat[0] * is1; - var sm12 = mat[1] * is2; - var sm13 = mat[2] * is3; - var sm21 = mat[4] * is1; - var sm22 = mat[5] * is2; - var sm23 = mat[6] * is3; - var sm31 = mat[8] * is1; - var sm32 = mat[9] * is2; - var sm33 = mat[10] * is3; - var trace = sm11 + sm22 + sm33; - var S = 0; - if (trace > 0) { - S = Math.sqrt(trace + 1.0) * 2; - out[3] = 0.25 * S; - out[0] = (sm23 - sm32) / S; - out[1] = (sm31 - sm13) / S; - out[2] = (sm12 - sm21) / S; - } else if (sm11 > sm22 && sm11 > sm33) { - S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; - out[3] = (sm23 - sm32) / S; - out[0] = 0.25 * S; - out[1] = (sm12 + sm21) / S; - out[2] = (sm31 + sm13) / S; - } else if (sm22 > sm33) { - S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; - out[3] = (sm31 - sm13) / S; - out[0] = (sm12 + sm21) / S; - out[1] = 0.25 * S; - out[2] = (sm23 + sm32) / S; - } else { - S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; - out[3] = (sm12 - sm21) / S; - out[0] = (sm31 + sm13) / S; - out[1] = (sm23 + sm32) / S; - out[2] = 0.25 * S; + getOffset(horizontal, binField) { + const { names, props } = this; + const { parentScope } = props; + return { + x: addOffsets(parentScope.offsets.x, horizontal ? "" : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), + y: addOffsets(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ""), + h: horizontal ? names.bandWidth : parentScope.offsets.h, + w: horizontal ? parentScope.offsets.w : names.bandWidth + }; + } + getScale(bin2, horizontal) { + const { names } = this; + const { parentScope } = this.props; + const binField = safeFieldName(bin2.fields[0]); + let bandScale; + if (horizontal) { + bandScale = { + type: "band", + name: names.yScale, + range: [ + 0, + { + signal: parentScope.sizeSignals.layoutHeight + } + ], + padding: 0.1, + domain: { + data: bin2.domainDataName, + field: binField, + sort: true + }, + reverse: true + }; + } else { + bandScale = { + type: "band", + name: names.xScale, + range: [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ], + padding: 0.1, + domain: { + data: bin2.domainDataName, + field: binField, + sort: true + } + }; + } + return bandScale; } - return out; -} -function fromRotationTranslationScale(out, q, v, s) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - out[0] = (1 - (yy + zz)) * sx; - out[1] = (xy + wz) * sx; - out[2] = (xz - wy) * sx; - out[3] = 0; - out[4] = (xy - wz) * sy; - out[5] = (1 - (xx + zz)) * sy; - out[6] = (yz + wx) * sy; - out[7] = 0; - out[8] = (xz + wy) * sz; - out[9] = (yz - wx) * sz; - out[10] = (1 - (xx + yy)) * sz; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromRotationTranslationScaleOrigin(out, q, v, s, o) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - var sx = s[0]; - var sy = s[1]; - var sz = s[2]; - var ox = o[0]; - var oy = o[1]; - var oz = o[2]; - var out0 = (1 - (yy + zz)) * sx; - var out1 = (xy + wz) * sx; - var out2 = (xz - wy) * sx; - var out4 = (xy - wz) * sy; - var out5 = (1 - (xx + zz)) * sy; - var out6 = (yz + wx) * sy; - var out8 = (xz + wy) * sz; - var out9 = (yz - wx) * sz; - var out10 = (1 - (xx + yy)) * sz; - out[0] = out0; - out[1] = out1; - out[2] = out2; - out[3] = 0; - out[4] = out4; - out[5] = out5; - out[6] = out6; - out[7] = 0; - out[8] = out8; - out[9] = out9; - out[10] = out10; - out[11] = 0; - out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); - out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); - out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); - out[15] = 1; - return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - yy - zz; - out[1] = yx + wz; - out[2] = zx - wy; - out[3] = 0; - out[4] = yx - wz; - out[5] = 1 - xx - zz; - out[6] = zy + wx; - out[7] = 0; - out[8] = zx + wy; - out[9] = zy - wx; - out[10] = 1 - xx - yy; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function frustum(out, left, right, bottom, top, near, far) { - var rl = 1 / (right - left); - var tb = 1 / (top - bottom); - var nf = 1 / (near - far); - out[0] = near * 2 * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = near * 2 * tb; - out[6] = 0; - out[7] = 0; - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = far * near * 2 * nf; - out[15] = 0; - return out; -} -function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = (far + near) * nf; - out[14] = 2 * far * near * nf; + }; + function displayBin(bin2) { + const val = (index2) => `datum[${JSON.stringify(bin2.fields[index2])}]`; + return bin2.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); + } + function obj(nameValues, clause) { + return `{${nameValues.join()}}`; + } + function serializeAsVegaExpression(bin2, firstFieldName, lastFieldName, clause) { + if (bin2.discreteColumn.column.quantitative) { + const low = [ + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'>='", + `value:datum[${JSON.stringify(bin2.fields[0])}]` + ]; + const high = [ + "clause:'&&'", + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'<'", + `value:datum[${JSON.stringify(bin2.fields[1])}]` + ]; + return obj([ + `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]` + ]); } else { - out[10] = -1; - out[14] = -2 * near; + const exact = [ + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'=='", + `value:datum[${JSON.stringify(bin2.fields[0])}]` + ]; + return obj([ + `expressions:[${obj(exact)}]` + ]); } - return out; -} -var perspective = perspectiveNO; -function perspectiveZO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = far * nf; - out[14] = far * near * nf; - } else { - out[10] = -1; - out[14] = -near; + } + function createOrdinals(source2, prefix, binFields, sortOrder) { + const _binFields = binFields.map(safeFieldName); + const dataName = `${prefix}_bin_order`; + const data2 = { + name: dataName, + source: source2, + transform: [ + { + type: "aggregate", + groupby: _binFields + }, + { + type: "collect", + sort: { + field: _binFields, + order: _binFields.map((f) => sortOrder) + } + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + } + ] + }; + return { + data: data2, + scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) + }; + } + function ordinalScale(dataName, scaleName, binFields) { + return { + type: "ordinal", + name: scaleName, + domain: { + data: dataName, + field: safeFieldName(binFields[0]) + }, + range: { + data: dataName, + field: FieldNames.Ordinal + } + }; + } + let Cross$1 = class Cross extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `cross_${this.id}`; + this.binX = binnable(`${p}_x`, props.globalScope.data.name, props.groupbyX); + this.binY = binnable(`${p}_y`, props.globalScope.data.name, props.groupbyY); + this.names = { + facetDataName: `data_${p}_facet`, + searchUnion: `data_${p}_search`, + dimScale: `scale_${p}`, + dimCount: `${p}_count`, + dimCategorical: `data_${p}_cat`, + dimCellSize: `${p}_cell_size`, + dimCellSizeCalc: `${p}_cell_calc` + }; } - return out; -} -function perspectiveFromFieldOfView(out, fov, near, far) { - var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0); - var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0); - var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0); - var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0); - var xScale = 2.0 / (leftTan + rightTan); - var yScale = 2.0 / (upTan + downTan); - out[0] = xScale; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - out[4] = 0.0; - out[5] = yScale; - out[6] = 0.0; - out[7] = 0.0; - out[8] = -((leftTan - rightTan) * xScale * 0.5); - out[9] = (upTan - downTan) * yScale * 0.5; - out[10] = far / (near - far); - out[11] = -1; - out[12] = 0.0; - out[13] = 0.0; - out[14] = far * near / (near - far); - out[15] = 0.0; - return out; -} -function orthoNO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - return out; -} -var ortho = orthoNO; -function orthoZO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = near * nf; - out[15] = 1; - return out; -} -function lookAt(out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; - var eyex = eye[0]; - var eyey = eye[1]; - var eyez = eye[2]; - var upx = up[0]; - var upy = up[1]; - var upz = up[2]; - var centerx = center[0]; - var centery = center[1]; - var centerz = center[2]; - if (Math.abs(eyex - centerx) < _commonJs.EPSILON && Math.abs(eyey - centery) < _commonJs.EPSILON && Math.abs(eyez - centerz) < _commonJs.EPSILON) return identity(out); - z0 = eyex - centerx; - z1 = eyey - centery; - z2 = eyez - centerz; - len = 1 / Math.hypot(z0, z1, z2); - z0 *= len; - z1 *= len; - z2 *= len; - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len = Math.hypot(x0, x1, x2); - if (!len) { - x0 = 0; - x1 = 0; - x2 = 0; - } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - len = Math.hypot(y0, y1, y2); - if (!len) { - y0 = 0; - y1 = 0; - y2 = 0; - } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - return out; -} -function targetTo(out, eye, target, up) { - var eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2]; - var z0 = eyex - target[0], z1 = eyey - target[1], z2 = eyez - target[2]; - var len = z0 * z0 + z1 * z1 + z2 * z2; - if (len > 0) { - len = 1 / Math.sqrt(len); - z0 *= len; - z1 *= len; - z2 *= len; - } - var x0 = upy * z2 - upz * z1, x1 = upz * z0 - upx * z2, x2 = upx * z1 - upy * z0; - len = x0 * x0 + x1 * x1 + x2 * x2; - if (len > 0) { - len = 1 / Math.sqrt(len); - x0 *= len; - x1 *= len; - x2 *= len; - } - out[0] = x0; - out[1] = x1; - out[2] = x2; - out[3] = 0; - out[4] = z1 * x2 - z2 * x1; - out[5] = z2 * x0 - z0 * x2; - out[6] = z0 * x1 - z1 * x0; - out[7] = 0; - out[8] = z0; - out[9] = z1; - out[10] = z2; - out[11] = 0; - out[12] = eyex; - out[13] = eyey; - out[14] = eyez; - out[15] = 1; - return out; -} -function str(a) { - return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - out[9] = a[9] + b[9]; - out[10] = a[10] + b[10]; - out[11] = a[11] + b[11]; - out[12] = a[12] + b[12]; - out[13] = a[13] + b[13]; - out[14] = a[14] + b[14]; - out[15] = a[15] + b[15]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - out[9] = a[9] - b[9]; - out[10] = a[10] - b[10]; - out[11] = a[11] - b[11]; - out[12] = a[12] - b[12]; - out[13] = a[13] - b[13]; - out[14] = a[14] - b[14]; - out[15] = a[15] - b[15]; - return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - out[9] = a[9] * b; - out[10] = a[10] * b; - out[11] = a[11] * b; - out[12] = a[12] * b; - out[13] = a[13] * b; - out[14] = a[14] * b; - out[15] = a[15] * b; - return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; - out[9] = a[9] + b[9] * scale; - out[10] = a[10] + b[10] * scale; - out[11] = a[11] + b[11] * scale; - out[12] = a[12] + b[12] * scale; - out[13] = a[13] + b[13] * scale; - out[14] = a[14] + b[14] * scale; - out[15] = a[15] + b[15] * scale; - return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7]; - var a8 = a[8], a9 = a[9], a10 = a[10], a11 = a[11]; - var a12 = a[12], a13 = a[13], a14 = a[14], a15 = a[15]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - var b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7]; - var b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11]; - var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2chmr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Quaternion - * @module quat - */ /** - * Creates a new identity quat - * - * @returns {quat} a new quaternion - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Set a quat to the identity quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Sets a quat from the given angle and rotation axis, - * then returns it. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyVec3} axis the axis around which to rotate - * @param {Number} rad the angle in radians - * @returns {quat} out - **/ parcelHelpers.export(exports, "setAxisAngle", ()=>setAxisAngle); -/** - * Gets the rotation axis and angle for a given - * quaternion. If a quaternion is created with - * setAxisAngle, this method will return the same - * values as providied in the original parameter list - * OR functionally equivalent values. - * Example: The quaternion formed by axis [0, 0, 1] and - * angle -90 is the same as the quaternion formed by - * [0, 0, 1] and 270. This method favors the latter. - * @param {vec3} out_axis Vector receiving the axis of rotation - * @param {ReadonlyQuat} q Quaternion to be decomposed - * @return {Number} Angle, in radians, of the rotation - */ parcelHelpers.export(exports, "getAxisAngle", ()=>getAxisAngle); -/** - * Gets the angular distance between two unit quaternions - * - * @param {ReadonlyQuat} a Origin unit quaternion - * @param {ReadonlyQuat} b Destination unit quaternion - * @return {Number} Angle, in radians, between the two quaternions - */ parcelHelpers.export(exports, "getAngle", ()=>getAngle); -/** - * Multiplies two quat's - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @returns {quat} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Rotates a quaternion by the given angle about the X axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a quaternion by the given angle about the Y axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a quaternion by the given angle about the Z axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Calculates the W component of a quat from the X, Y, and Z components. - * Assumes that quaternion is 1 unit in length. - * Any existing W component will be ignored. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate W component of - * @returns {quat} out - */ parcelHelpers.export(exports, "calculateW", ()=>calculateW); -/** - * Calculate the exponential of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "exp", ()=>exp); -/** - * Calculate the natural logarithm of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "ln", ()=>ln); -/** - * Calculate the scalar power of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @param {Number} b amount to scale the quaternion by - * @returns {quat} out - */ parcelHelpers.export(exports, "pow", ()=>pow); -/** - * Performs a spherical linear interpolation between two quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {quat} out - */ parcelHelpers.export(exports, "slerp", ()=>slerp); -/** - * Generates a random unit quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Calculates the inverse of a quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate inverse of - * @returns {quat} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate conjugate of - * @returns {quat} out - */ parcelHelpers.export(exports, "conjugate", ()=>conjugate); -/** - * Creates a quaternion from the given 3x3 rotation matrix. - * - * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyMat3} m rotation matrix - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromMat3", ()=>fromMat3); -/** - * Creates a quaternion from the given euler angle x, y, z. - * - * @param {quat} out the receiving quaternion - * @param {x} Angle to rotate around X axis in degrees. - * @param {y} Angle to rotate around Y axis in degrees. - * @param {z} Angle to rotate around Z axis in degrees. - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromEuler", ()=>fromEuler); -/** - * Returns a string representation of a quatenion - * - * @param {ReadonlyQuat} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "fromValues", ()=>fromValues); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "set", ()=>set); -parcelHelpers.export(exports, "add", ()=>add); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "dot", ()=>dot); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "length", ()=>length); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "normalize", ()=>normalize); -parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "rotationTo", ()=>rotationTo); -parcelHelpers.export(exports, "sqlerp", ()=>sqlerp); -parcelHelpers.export(exports, "setAxes", ()=>setAxes); -var _commonJs = require("./common.js"); -var _mat3Js = require("./mat3.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; + getGrouping() { + return this.binX.fields.concat(this.binY.fields); + } + build() { + const { binX, binY, names, prefix, props } = this; + const { axisTextColor, colRowTitles, globalScope, parentScope } = props; + const titles = { x: { dataName: null, quantitative: null }, y: { dataName: null, quantitative: null } }; + const dx = { + dim: "x", + bin: binX, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutWidth, + layout: parentScope.sizeSignals.layoutWidth, + min: globalScope.signals.minCellWidth.name, + out: globalScope.signals.plotWidthOut, + offset: SignalNames.FacetPaddingLeft, + padding: SignalNames.FacetPaddingLeft, + dataOut: null, + scaleName: null, + position: null + }; + const dy = { + dim: "y", + bin: binY, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutHeight, + layout: parentScope.sizeSignals.layoutHeight, + min: globalScope.signals.minCellHeight.name, + out: globalScope.signals.plotHeightOut, + offset: SignalNames.FacetPaddingTop, + padding: `(${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})`, + dataOut: null, + scaleName: null, + position: null + }; + const dimensions = [dx, dy]; + dimensions.forEach((d2) => { + const { bin: bin2, dim, padding: padding2, sortOrder } = d2; + let data2; + let dataName; + let countSignal; + let scale2; + const titleSource = titles[dim]; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + addTransforms(bin2.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, + as: FieldNames.Contains + }); + data2 = bin2.dataSequence; + dataName = bin2.dataSequence.name; + countSignal = `length(data(${JSON.stringify(dataName)}))`; + scale2 = ordinalScale(dataName, `${names.dimScale}_${dim}`, bin2.fields); + titleSource.dataName = bin2.dataSequence.name; + } else { + dataName = globalScope.markDataName; + const ord = createOrdinals(dataName, `${prefix}_${dim}`, bin2.fields, sortOrder); + data2 = ord.data; + addData(globalScope.scope, ord.data); + countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; + scale2 = ord.scale; + titleSource.dataName = ord.data.name; + } + titleSource.quantitative = bin2.discreteColumn.column.quantitative; + d2.dataOut = data2; + d2.scaleName = scale2.name; + addTransforms(data2, { + type: "formula", + expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch + }, { + type: "formula", + expr: displayBin(bin2), + as: FieldNames.FacetTitle + }); + addScales(globalScope.scope, scale2); + const count2 = `${names.dimCount}_${dim}`; + const calc = `${names.dimCellSizeCalc}_${dim}`; + const size = `${names.dimCellSize}_${dim}`; + addSignals(globalScope.scope, { name: count2, update: countSignal }); + addSignals(globalScope.scope, { + name: calc, + update: `${d2.layout} / ${count2}` + }, { + name: size, + update: `max(${d2.min}, (${calc} - ${padding2}))` + }); + modifySignal(d2.out, "max", `((${size} + ${padding2}) * ${count2})`); + d2.position = this.dimensionOffset(d2); + }); + const groupRow = { + type: "group", + encode: { + update: { + y: { + signal: dy.position + } + } + }, + from: { + data: dy.dataOut.name + }, + data: [ + { + name: names.searchUnion, + source: dx.dataOut.name, + transform: [ + { + type: "formula", + expr: `[datum[${JSON.stringify(FieldNames.FacetSearch)}], merge(parent[${JSON.stringify(FieldNames.FacetSearch)}], { clause: '&&'})]`, + as: FieldNames.FacetSearch + } + ] + } + ] + }; + const groupCol = { + style: "cell", + name: prefix, + type: "group", + encode: { + update: { + height: { + signal: `${names.dimCellSize}_y` + }, + width: { + signal: `${names.dimCellSize}_x` + }, + x: { + signal: dx.position + } + } + }, + from: { + data: names.searchUnion + } + }; + addMarks(globalScope.markGroup, groupRow); + addMarks(groupRow, groupCol); + const offsets2 = { + x: this.dimensionOffset(dx), + y: this.dimensionOffset(dy), + h: `${names.dimCellSize}_y`, + w: `${names.dimCellSize}_x` + }; + const sizeSignals = { + layoutHeight: `${names.dimCellSize}_y`, + layoutWidth: `${names.dimCellSize}_x`, + colCount: `${names.dimCount}_x`, + rowCount: `${names.dimCount}_y` + }; + if (colRowTitles) { + addFacetColRowTitles(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); + } + return { + facetScope: groupCol, + offsets: offsets2, + sizeSignals, + titles + }; + } + dimensionOffset(d2) { + const { names } = this; + return `${d2.offset} + (scale(${JSON.stringify(d2.scaleName)}, datum[${JSON.stringify(d2.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d2.dim} + ${d2.padding})`; + } + }; + let Scatter$1 = class Scatter extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `scatter_${this.id}`; + this.names = { + aggregateData: `data_${p}_aggregate`, + markData: `data_${p}_mark`, + xDataExtent: `${p}_xDataExtent`, + yDataExtent: `${p}_yDataExtent`, + xExtent: `${p}_xExtent`, + yExtent: `${p}_yExtent`, + sizeExtent: `${p}_sizeExtent`, + sizeRange: `${p}_sizeRange`, + sizeScale: `${p}_sizeScale`, + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + zScale: `scale_${p}_z` + }; } - out[3] = 1; - return out; -} -function identity(out) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; -} -function setAxisAngle(out, axis, rad) { - rad = rad * 0.5; - var s = Math.sin(rad); - out[0] = s * axis[0]; - out[1] = s * axis[1]; - out[2] = s * axis[2]; - out[3] = Math.cos(rad); - return out; -} -function getAxisAngle(out_axis, q) { - var rad = Math.acos(q[3]) * 2.0; - var s = Math.sin(rad / 2.0); - if (s > _commonJs.EPSILON) { - out_axis[0] = q[0] / s; - out_axis[1] = q[1] / s; - out_axis[2] = q[2] / s; - } else { - // If s is zero, return any axis (no rotation - axis does not matter) - out_axis[0] = 1; - out_axis[1] = 0; - out_axis[2] = 0; - } - return rad; -} -function getAngle(a, b) { - var dotproduct = dot(a, b); - return Math.acos(2 * dotproduct * dotproduct - 1); -} -function multiply(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - out[0] = ax * bw + aw * bx + ay * bz - az * by; - out[1] = ay * bw + aw * by + az * bx - ax * bz; - out[2] = az * bw + aw * bz + ax * by - ay * bx; - out[3] = aw * bw - ax * bx - ay * by - az * bz; - return out; -} -function rotateX(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + aw * bx; - out[1] = ay * bw + az * bx; - out[2] = az * bw - ay * bx; - out[3] = aw * bw - ax * bx; - return out; -} -function rotateY(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var by = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw - az * by; - out[1] = ay * bw + aw * by; - out[2] = az * bw + ax * by; - out[3] = aw * bw - ay * by; - return out; -} -function rotateZ(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bz = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + ay * bz; - out[1] = ay * bw - ax * bz; - out[2] = az * bw + aw * bz; - out[3] = aw * bw - az * bz; - return out; -} -function calculateW(out, a) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); - return out; -} -function exp(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var et = Math.exp(w); - var s = r > 0 ? et * Math.sin(r) / r : 0; - out[0] = x * s; - out[1] = y * s; - out[2] = z * s; - out[3] = et * Math.cos(r); - return out; -} -function ln(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var t = r > 0 ? Math.atan2(r, w) / r : 0; - out[0] = x * t; - out[1] = y * t; - out[2] = z * t; - out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); - return out; -} -function pow(out, a, b) { - ln(out, a); - scale(out, out, b); - exp(out, out); - return out; -} -function slerp(out, a, b, t) { - // benchmarks: - // http://jsperf.com/quaternion-slerp-implementations - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - var omega, cosom, sinom, scale0, scale1; // calc cosine - cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) - if (cosom < 0.0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } // calculate coefficients - if (1.0 - cosom > _commonJs.EPSILON) { - // standard case (slerp) - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } else { - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - scale0 = 1.0 - t; - scale1 = t; - } // calculate final values - out[0] = scale0 * ax + scale1 * bx; - out[1] = scale0 * ay + scale1 * by; - out[2] = scale0 * az + scale1 * bz; - out[3] = scale0 * aw + scale1 * bw; - return out; -} -function random(out) { - // Implementation of http://planning.cs.uiuc.edu/node198.html - // TODO: Calling random 3 times is probably not the fastest solution - var u1 = _commonJs.RANDOM(); - var u2 = _commonJs.RANDOM(); - var u3 = _commonJs.RANDOM(); - var sqrt1MinusU1 = Math.sqrt(1 - u1); - var sqrtU1 = Math.sqrt(u1); - out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); - out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); - out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); - out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); - return out; -} -function invert(out, a) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - out[0] = -a0 * invDot; - out[1] = -a1 * invDot; - out[2] = -a2 * invDot; - out[3] = a3 * invDot; - return out; -} -function conjugate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a[3]; - return out; -} -function fromMat3(out, m) { - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var fTrace = m[0] + m[4] + m[8]; - var fRoot; - if (fTrace > 0.0) { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w - out[3] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; // 1/(4w) - out[0] = (m[5] - m[7]) * fRoot; - out[1] = (m[6] - m[2]) * fRoot; - out[2] = (m[1] - m[3]) * fRoot; - } else { - // |w| <= 1/2 - var i = 0; - if (m[4] > m[0]) i = 1; - if (m[8] > m[i * 3 + i]) i = 2; - var j = (i + 1) % 3; - var k = (i + 2) % 3; - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; - out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + build() { + const { names, prefix, props } = this; + const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x: x2, y: y2, z: z2, zGrounded } = props; + const qsize = size && size.quantitative && size; + addSignals(globalScope.scope, { + name: SignalNames.PointScale, + value: 5, + bind: { + name: scatterPointScaleDisplay, + debounce: debounce$1, + input: "range", + min: 1, + max: 10, + step: 0.1 + } + }, { + name: SignalNames.ZGrounded, + value: false, + bind: { + name: zGrounded, + input: "checkbox" + } + }); + if (backgroundImageExtents) { + addTransforms(globalScope.data, dataExtent(x2, names.xDataExtent), dataExtent(y2, names.yDataExtent)); + const xSignal = outerExtentSignal(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); + const ySignal = outerExtentSignal(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); + addSignals(globalScope.scope, xSignal, ySignal); + } + if (qsize) { + addTransforms(globalScope.data, { + type: "extent", + field: safeFieldName(qsize.name), + signal: names.sizeExtent + }); + addScales(globalScope.scope, { + name: names.sizeScale, + type: "pow", + exponent: 0.5, + domain: [0, { signal: `${names.sizeExtent}[1]` }], + range: [0, { signal: names.sizeRange }] + }); + addSignals(globalScope.scope, { + name: names.sizeRange, + update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${scatterSizedDiv}` + }); + } + addData(globalScope.scope, { + name: names.markData, + source: globalScope.markDataName, + transform: [x2, y2, z2].map((c2) => { + if (!c2 || !c2.quantitative) + return; + const t = { + type: "filter", + expr: `isValid(datum[${JSON.stringify(c2.name)}])` + }; + return t; + }).filter(Boolean) + }); + globalScope.setMarkDataName(names.markData); + const globalScales = { showAxes, scales: {} }; + const zValue = z2 ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z2.name)}])` : null; + const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${SignalNames.PointScale}` : SignalNames.PointScale; + const update2 = Object.assign({ height: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: sizeValueSignal + } + ], width: { + signal: sizeValueSignal + } }, z2 && { + z: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` + } + ], + zindex: [ + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` + } + ], + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: view === "3d" ? `${SignalNames.ZGrounded} ? ${zValue} : ${sizeValueSignal}` : "0" + } + ] + }); + const columnSignals = [ + { + column: x2, + xyz: "x", + scaleName: names.xScale, + domain: backgroundImageExtents ? { + signal: names.xExtent + } : { + data: globalScope.data.name, + field: safeFieldName(x2.name) + }, + reverse: false, + signal: parentScope.sizeSignals.layoutWidth + }, + { + column: y2, + xyz: "y", + scaleName: names.yScale, + domain: backgroundImageExtents ? { + signal: names.yExtent + } : { + data: globalScope.data.name, + field: safeFieldName(y2.name) + }, + reverse: true, + signal: parentScope.sizeSignals.layoutHeight + }, + { + column: z2, + xyz: "z", + scaleName: names.zScale, + domain: { + data: globalScope.data.name, + field: z2 ? safeFieldName(z2.name) : null + }, + reverse: false, + signal: view === "3d" ? `(${globalScope.zSize}) * ${SignalNames.ZProportion}` : `10 * ${SignalNames.ZProportion}` + } + ]; + columnSignals.forEach((cs) => { + const { column, domain: domain2, reverse: reverse2, scaleName, signal, xyz } = cs; + if (!column) + return; + let scale2; + if (column.quantitative) { + scale2 = linearScale(scaleName, domain2, [0, { signal }], reverse2, false, showAxes); + if (shouldBeIntegralBinStep(column)) { + scale2.bins = { step: 1 }; + } + } else { + scale2 = pointScale(scaleName, globalScope.data.name, [0, { signal }], column.name, reverse2); + } + globalScales.scales[xyz] = [scale2]; + }); + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { update: update2 } + }; + addMarks(globalScope.markGroup, mark); + return { + offsets: { + x: addOffsets(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x2.name)}])`), + y: addOffsets(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y2.name)}]) - ${sizeValueSignal}`), + h: sizeValueSignal, + w: sizeValueSignal + }, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + globalScales, + mark, + encodingRuleMap: { + y: [ + { + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) + } + ] + } + }; } - return out; -} -function fromEuler(out, x, y, z) { - var halfToRad = 0.5 * Math.PI / 180.0; - x *= halfToRad; - y *= halfToRad; - z *= halfToRad; - var sx = Math.sin(x); - var cx = Math.cos(x); - var sy = Math.sin(y); - var cy = Math.cos(y); - var sz = Math.sin(z); - var cz = Math.cos(z); - out[0] = sx * cy * cz - cx * sy * sz; - out[1] = cx * sy * cz + sx * cy * sz; - out[2] = cx * cy * sz - sx * sy * cz; - out[3] = cx * cy * cz + sx * sy * sz; - return out; -} -function str(a) { - return "quat(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -var clone = _vec4Js.clone; -var fromValues = _vec4Js.fromValues; -var copy = _vec4Js.copy; -var set = _vec4Js.set; -var add = _vec4Js.add; -var mul = multiply; -var scale = _vec4Js.scale; -var dot = _vec4Js.dot; -var lerp = _vec4Js.lerp; -var length = _vec4Js.length; -var len = length; -var squaredLength = _vec4Js.squaredLength; -var sqrLen = squaredLength; -var normalize = _vec4Js.normalize; -var exactEquals = _vec4Js.exactEquals; -var equals = _vec4Js.equals; -var rotationTo = function() { - var tmpvec3 = _vec3Js.create(); - var xUnitVec3 = _vec3Js.fromValues(1, 0, 0); - var yUnitVec3 = _vec3Js.fromValues(0, 1, 0); - return function(out, a, b) { - var dot = _vec3Js.dot(a, b); - if (dot < -0.999999) { - _vec3Js.cross(tmpvec3, xUnitVec3, a); - if (_vec3Js.len(tmpvec3) < 0.000001) _vec3Js.cross(tmpvec3, yUnitVec3, a); - _vec3Js.normalize(tmpvec3, tmpvec3); - setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; + }; + function addZScale(z2, zSize, dataName, zScaleName) { + if (z2) { + const zRange = [0, { signal: `(${zSize}) * ${SignalNames.ZProportion}` }]; + const scale2 = z2.quantitative ? linearScale(zScaleName, { + data: dataName, + field: safeFieldName(z2.name) + }, zRange, false, true) : pointScale(zScaleName, dataName, zRange, z2.name, false); + return scale2; + } + } + class Square extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `square_${this.id}`; + this.names = { + bandWidth: this.getBandWidth(), + maxGroupField: `${p}_max_group`, + maxGroupSignal: `${p}_max_grouping`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, prefix, props } = this; + const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z: z2 } = props; + const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); + addTransforms(globalScope.data, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sortBy && { + sort: { + field: safeFieldName(sortBy.name), + order: "ascending" + } + })); + const { gap, levelSize, size, squaresPerBand } = this.addSignals(); + const heightSignal = { + signal: fillDirection === "down-right" ? size : levelSize + }; + const mark = { + name: prefix, + type: "rect", + from: { + data: globalScope.markDataName + }, + encode: { + update: Object.assign({ height: collapseYHeight ? [ + { + test: testForCollapseSelection(), + value: 0 + }, + heightSignal + ] : heightSignal, width: { + signal: fillDirection === "down-right" ? levelSize : size + } }, z2 && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z2.name) + } : { + value: 0 + } + ] + }) + } + }; + addMarks(globalScope.markGroup, mark); + const { tx: tx2, ty: ty2 } = this.transformXY(gap, levelSize, squaresPerBand); + return Object.assign(Object.assign(Object.assign({}, z2 && { + globalScales: { + showAxes, + scales: { + z: [zScale] + } + } + }), { offsets: { + x: addOffsets(parentScope.offsets.x, tx2.expr), + y: addOffsets(parentScope.offsets.y, ty2.expr), + h: size, + w: size + }, mark, sizeSignals: { + layoutHeight: size, + layoutWidth: size + } }), collapseYHeight && { + encodingRuleMap: { + y: [ + { + test: testForCollapseSelection(), + signal: parentScope.offsets.y + } + ] + } + }); + } + getBandWidth() { + const { offsets: offsets2 } = this.props.parentScope; + switch (this.props.fillDirection) { + case "down-right": + return offsets2.h; + default: + return offsets2.w; + } + } + addSignals() { + const { names, props } = this; + const { fillDirection, globalScope, groupings, parentScope } = props; + let { maxGroupedFillSize, maxGroupedUnits } = props; + if (!maxGroupedUnits) { + if (groupings) { + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.maxGroupField] + }, { + type: "extent", + field: names.maxGroupField, + signal: names.maxGroupSignal + }); + maxGroupedUnits = `(${names.maxGroupSignal}[1])`; } else { - _vec3Js.cross(tmpvec3, a, b); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot; - return normalize(out, out); - } - }; -}(); -var sqlerp = function() { - var temp1 = create(); - var temp2 = create(); - return function(out, a, b, c, d, t) { - slerp(temp1, a, d, t); - slerp(temp2, b, c, t); - slerp(out, temp1, temp2, 2 * t * (1 - t)); - return out; - }; -}(); -var setAxes = function() { - var matr = _mat3Js.create(); - return function(out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - return normalize(out, fromMat3(out, matr)); - }; -}(); - -},{"./common.js":"7GML7","./mat3.js":"80EZI","./vec3.js":"9zs5l","./vec4.js":"ao75m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9zs5l":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3 Dimensional Vector - * @module vec3 - */ /** - * Creates a new, empty vec3 - * - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec3 initialized with values from an existing vector - * - * @param {ReadonlyVec3} a vector to clone - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Calculates the length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Creates a new vec3 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec3 to another - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the source vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec3 to the given values - * - * @param {vec3} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to ceil - * @returns {vec3} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to floor - * @returns {vec3} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to round - * @returns {vec3} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec3 by a scalar number - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec3} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec3} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the squared length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to negate - * @returns {vec3} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to invert - * @returns {vec3} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to normalize - * @returns {vec3} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Performs a hermite interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "hermite", ()=>hermite); -/** - * Performs a bezier interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "bezier", ()=>bezier); -/** - * Generates a random vector with the given scale - * - * @param {vec3} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec3} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec3 with a mat3. - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat3} m the 3x3 matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec3 with a quat - * Can also be used for dual quaternions. (Multiply it with the real part) - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Rotate a 3D vector around the x-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotate a 3D vector around the y-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotate a 3D vector around the z-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Get the angle between two 3D vectors - * @param {ReadonlyVec3} a The first operand - * @param {ReadonlyVec3} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec3 to zero - * - * @param {vec3} out the receiving vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec3} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(3); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; + maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; + } + } + if (!maxGroupedFillSize) { + maxGroupedFillSize = fillDirection === "down-right" ? parentScope.offsets.w : parentScope.offsets.h; + } + const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; + const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; + const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; + const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; + const levels2 = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; + const levelSize = `(((${maxGroupedFillSize}) / ${levels2}) - ${gap})`; + return { gap, levelSize, size, squaresPerBand }; } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return Math.hypot(x, y, z); -} -function fromValues(x, y, z) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function set(out, x, y, z) { - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return Math.hypot(x, y, z); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return x * x + y * y + z * z; -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return x * x + y * y + z * z; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var len = x * x + y * y + z * z; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cross(out, a, b) { - var ax = a[0], ay = a[1], az = a[2]; - var bx = b[0], by = b[1], bz = b[2]; - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - return out; -} -function hermite(out, a, b, c, d, t) { - var factorTimes2 = t * t; - var factor1 = factorTimes2 * (2 * t - 3) + 1; - var factor2 = factorTimes2 * (t - 2) + t; - var factor3 = factorTimes2 * (t - 1); - var factor4 = factorTimes2 * (3 - 2 * t); - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function bezier(out, a, b, c, d, t) { - var inverseFactor = 1 - t; - var inverseFactorTimesTwo = inverseFactor * inverseFactor; - var factorTimes2 = t * t; - var factor1 = inverseFactorTimesTwo * inverseFactor; - var factor2 = 3 * t * inverseFactorTimesTwo; - var factor3 = 3 * factorTimes2 * inverseFactor; - var factor4 = factorTimes2 * t; - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - var z = _commonJs.RANDOM() * 2.0 - 1.0; - var zScale = Math.sqrt(1.0 - z * z) * scale; - out[0] = Math.cos(r) * zScale; - out[1] = Math.sin(r) * zScale; - out[2] = z * scale; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - var w = m[3] * x + m[7] * y + m[11] * z + m[15]; - w = w || 1.0; - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x * m[0] + y * m[3] + z * m[6]; - out[1] = x * m[1] + y * m[4] + z * m[7]; - out[2] = x * m[2] + y * m[5] + z * m[8]; - return out; -} -function transformQuat(out, a, q) { - // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; - var x = a[0], y = a[1], z = a[2]; // var qvec = [qx, qy, qz]; - // var uv = vec3.cross([], qvec, a); - var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); - var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; // vec3.scale(uuv, uuv, 2); - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; - return out; -} -function rotateX(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateY(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateZ(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function angle(a, b) { - var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b) / mag; - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - return out; -} -function str(a) { - return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2]; - var b0 = b[0], b1 = b[1], b2 = b[2]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 3; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - } - return a; - }; -}(); - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ao75m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4 Dimensional Vector - * @module vec4 - */ /** - * Creates a new, empty vec4 - * - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec4 initialized with values from an existing vector - * - * @param {ReadonlyVec4} a vector to clone - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec4 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec4 to another - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the source vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec4 to the given values - * - * @param {vec4} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to ceil - * @returns {vec4} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to floor - * @returns {vec4} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to round - * @returns {vec4} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec4 by a scalar number - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec4} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec4's after scaling the second operand by a scalar value - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec4} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to negate - * @returns {vec4} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to invert - * @returns {vec4} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to normalize - * @returns {vec4} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Returns the cross-product of three vectors in a 4-dimensional space - * - * @param {ReadonlyVec4} result the receiving vector - * @param {ReadonlyVec4} U the first vector - * @param {ReadonlyVec4} V the second vector - * @param {ReadonlyVec4} W the third vector - * @returns {vec4} result - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec4} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec4} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec4} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec4 with a mat4. - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec4 with a quat - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Set the components of a vec4 to zero - * - * @param {vec4} out the receiving vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec4} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; + transformXY(gap, levelSize, squaresPerBand) { + const { names, prefix } = this; + const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; + const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; + const { fillDirection, parentScope } = this.props; + const tx2 = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetX}` + }; + const ty2 = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetY}` + }; + switch (fillDirection) { + case "down-right": { + tx2.expr = `${level} * (${levelSize} + ${gap})`; + ty2.expr = compartment; + break; + } + case "right-up": { + tx2.expr = compartment; + ty2.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; + break; + } + case "right-down": + default: { + tx2.expr = compartment; + ty2.expr = `${level} * (${levelSize} + ${gap})`; + break; + } + } + return { tx: tx2, ty: ty2 }; } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function fromValues(x, y, z, w) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function set(out, x, y, z, w) { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - out[3] = a[3] * b[3]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - out[3] = a[3] / b[3]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - out[3] = Math.ceil(a[3]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - out[3] = Math.floor(a[3]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - out[3] = Math.min(a[3], b[3]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - out[3] = Math.max(a[3], b[3]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - out[3] = Math.round(a[3]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return Math.hypot(x, y, z, w); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return x * x + y * y + z * z + w * w; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return Math.hypot(x, y, z, w); -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return x * x + y * y + z * z + w * w; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = -a[3]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - out[3] = 1.0 / a[3]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - var len = x * x + y * y + z * z + w * w; - if (len > 0) len = 1 / Math.sqrt(len); - out[0] = x * len; - out[1] = y * len; - out[2] = z * len; - out[3] = w * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; -} -function cross(out, u, v, w) { - var A = v[0] * w[1] - v[1] * w[0], B = v[0] * w[2] - v[2] * w[0], C = v[0] * w[3] - v[3] * w[0], D = v[1] * w[2] - v[2] * w[1], E = v[1] * w[3] - v[3] * w[1], F = v[2] * w[3] - v[3] * w[2]; - var G = u[0]; - var H = u[1]; - var I = u[2]; - var J = u[3]; - out[0] = H * F - I * E + J * D; - out[1] = -(G * F) + I * C - J * B; - out[2] = G * E - H * C + J * A; - out[3] = -(G * D) + H * B - I * A; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - var aw = a[3]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - out[3] = aw + t * (b[3] - aw); - return out; -} -function random(out, scale) { - scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a - // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. - // http://projecteuclid.org/euclid.aoms/1177692644; - var v1, v2, v3, v4; - var s1, s2; - do { - v1 = _commonJs.RANDOM() * 2 - 1; - v2 = _commonJs.RANDOM() * 2 - 1; - s1 = v1 * v1 + v2 * v2; - }while (s1 >= 1); - do { - v3 = _commonJs.RANDOM() * 2 - 1; - v4 = _commonJs.RANDOM() * 2 - 1; - s2 = v3 * v3 + v4 * v4; - }while (s2 >= 1); - var d = Math.sqrt((1 - s1) / s2); - out[0] = scale * v1; - out[1] = scale * v2; - out[2] = scale * v3 * d; - out[3] = scale * v4 * d; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return out; -} -function transformQuat(out, a, q) { - var x = a[0], y = a[1], z = a[2]; - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; - out[3] = a[3]; - return out; -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - return out; -} -function str(a) { - return "vec4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 4; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - vec[3] = a[i + 3]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - a[i + 3] = vec[3]; - } - return a; - }; -}(); - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eovGI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 2 Dimensional Vector - * @module vec2 - */ /** - * Creates a new, empty vec2 - * - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec2 initialized with values from an existing vector - * - * @param {ReadonlyVec2} a vector to clone - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec2 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec2 to another - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the source vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec2 to the given values - * - * @param {vec2} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to ceil - * @returns {vec2} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to floor - * @returns {vec2} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to round - * @returns {vec2} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec2 by a scalar number - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec2} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec2's after scaling the second operand by a scalar value - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec2} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to negate - * @returns {vec2} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to invert - * @returns {vec2} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to normalize - * @returns {vec2} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec2's - * Note that the cross product must by definition produce a 3D vector - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec2} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec2} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec2} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec2 with a mat2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2", ()=>transformMat2); -/** - * Transforms the vec2 with a mat2d - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2d} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2d", ()=>transformMat2d); -/** - * Transforms the vec2 with a mat3 - * 3rd vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat3} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec2 with a mat4 - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Rotate a 2D vector - * @param {vec2} out The receiving vec2 - * @param {ReadonlyVec2} a The vec2 point to rotate - * @param {ReadonlyVec2} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec2} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Get the angle between two 2D vectors - * @param {ReadonlyVec2} a The first operand - * @param {ReadonlyVec2} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec2 to zero - * - * @param {vec2} out the receiving vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec2} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(2); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; + } + let Stack$1 = class Stack extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `stack_${this.id}`; + this.names = { + cube: `${p}_cube`, + globalDataName: `data_${p}_count`, + globalExtent: `${p}_global_extent`, + levelDataName: `data_${p}_level`, + count: `${p}_count`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + sequence: `data_${p}_sequence`, + sides: `${p}_sides`, + size: `${p}_size`, + squared: `${p}_squared`, + maxCount: `${p}_maxCount`, + maxLevels: `${p}_maxLevels`, + zScale: `${p}_zScale` + }; } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function fromValues(x, y) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = x; - out[1] = y; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function set(out, x, y) { - out[0] = x; - out[1] = y; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return Math.hypot(x, y); -} -function squaredDistance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return x * x + y * y; -} -function length(a) { - var x = a[0], y = a[1]; - return Math.hypot(x, y); -} -function squaredLength(a) { - var x = a[0], y = a[1]; - return x * x + y * y; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - return out; -} -function normalize(out, a) { - var x = a[0], y = a[1]; - var len = x * x + y * y; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1]; -} -function cross(out, a, b) { - var z = a[0] * b[1] - a[1] * b[0]; - out[0] = out[1] = 0; - out[2] = z; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0], ay = a[1]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - out[0] = Math.cos(r) * scale; - out[1] = Math.sin(r) * scale; - return out; -} -function transformMat2(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y; - out[1] = m[1] * x + m[3] * y; - return out; -} -function transformMat2d(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y + m[4]; - out[1] = m[1] * x + m[3] * y + m[5]; - return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[3] * y + m[6]; - out[1] = m[1] * x + m[4] * y + m[7]; - return out; -} -function transformMat4(out, a, m) { - var x = a[0]; - var y = a[1]; - out[0] = m[0] * x + m[4] * y + m[12]; - out[1] = m[1] * x + m[5] * y + m[13]; - return out; -} -function rotate(out, a, b, rad) { - //Translate point to the origin - var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); //perform rotation and translate to correct position - out[0] = p0 * cosC - p1 * sinC + b[0]; - out[1] = p0 * sinC + p1 * cosC + b[1]; - return out; -} -function angle(a, b) { - var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], // mag is the product of the magnitudes of a and b - mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), // mag &&.. short circuits if mag == 0 - cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - return out; -} -function str(a) { - return "vec2(" + a[0] + ", " + a[1] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1]; - var b0 = b[0], b1 = b[1]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)); -} -var len = length; -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 2; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - } - return a; - }; -}(); - -},{"./common.js":"7GML7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gRqOf":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>AltAzimuthCameraView); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>AltAzimuthCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _cameraJs = require("./camera.js"); -class AltAzimuthCameraView extends (0, _cameraJs.CameraView) { - constructor(core){ - super(core); - this.fov = core.config.fov; - this.altitude = 0; - this.azimuth = 0; - } -} -class AltAzimuthCamera extends (0, _cameraJs.CameraBase) { - getView(view) { - super.getView(view); - view.altitude = this.altitude; - view.azimuth = this.azimuth; - view.fov = this._core.config.fov; + build() { + const { names, props } = this; + const { globalScope, groupings, parentScope, showAxes, sort: sort2 } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.count] + }, { + type: "extent", + field: names.count, + signal: names.globalExtent + }, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sort2 && { + sort: { + field: safeFieldName(sort2.name), + order: "ascending" + } + })); + addData(globalScope.scope, { + name: names.sequence, + transform: [ + { + type: "sequence", + start: 1, + stop: { + signal: `sqrt(${names.globalExtent}[1])` + } + }, + { + type: "formula", + expr: "datum.data * datum.data", + as: "squared" + }, + { + type: "formula", + expr: `ceil(${names.globalExtent}[1] / datum.squared)`, + as: "maxlevels" + }, + { + type: "formula", + expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, + as: "side" + }, + { + type: "formula", + expr: "datum.side * datum.maxlevels + datum.maxlevels - 1", + as: "sidecubeheight" + }, + { + type: "formula", + expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, + as: "heightmatch" + }, + { + type: "collect", + sort: { + field: "heightmatch", + order: "ascending" + } + }, + { + type: "window", + ops: ["row_number"] + }, + { + type: "filter", + expr: "datum.row_number === 1" + } + ] + }); + addSignals(globalScope.scope, { + name: names.size, + update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` + }, { + name: names.squared, + update: `data('${names.sequence}')[0].squared` + }, { + name: names.sides, + update: `sqrt(${names.squared})` + }, { + name: names.cube, + update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` + }, { + name: names.maxLevels, + update: `data('${names.sequence}')[0].maxlevels` + }, { + name: names.maxCount, + update: `${names.maxLevels} * ${names.squared}` + }); + const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; + const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; + const cubeX = `(${layerOrdinal} % ${names.sides})`; + const cubeY = `floor(${layerOrdinal} / ${names.sides})`; + const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; + const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; + const offsets2 = { + x: addOffsets(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), + y: addOffsets(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), + h: names.size, + w: names.size + }; + const mark = { + type: "rect", + from: { data: this.names.levelDataName }, + encode: { + update: { + z: { + signal: `${zLevel} * (${names.cube} + 1)` + }, + height: { + signal: names.cube + }, + width: { + signal: names.cube + }, + depth: { + signal: names.cube + } + } + } + }; + addMarks(globalScope.markGroup, mark); + const zScale = { + type: "linear", + name: names.zScale, + domain: [ + 0, + { + signal: names.maxCount + } + ], + range: [ + 0, + { + signal: `${names.maxLevels} * (${names.cube} + 1) - 1` + } + ], + nice: false + }; + return { + offsets: offsets2, + mark, + sizeSignals: { + layoutHeight: names.size, + layoutWidth: names.size + }, + globalScales: { + showAxes, + scales: { + z: [zScale] + } + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.y + }], + z: [{ + test: testForCollapseSelection(), + value: 0 + }], + depth: [{ + test: testForCollapseSelection(), + value: 0 + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; } - setView(view, isSmooth) { - super.setView(view, isSmooth); - this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); - this._core.config.fov = view.fov; + }; + class Strip extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `strip_${this.id}`; + this.names = { + firstField: `${p}${FieldNames.First}`, + lastField: `${p}${FieldNames.Last}`, + valueField: `${p}${FieldNames.Value}`, + scale: `scale_${p}`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, prefix, props } = this; + const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort: sort2, sortOrder, parentScope, view, z: z2 } = props; + const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); + const horizontal = orientation === "horizontal"; + const transform2 = []; + if (sort2) { + transform2.push({ + type: "collect", + sort: { + field: safeFieldName(sort2.name), + order: sortOrder + } + }); + } + let stackField; + if (size) { + stackField = size.name; + transform2.push({ + type: "filter", + expr: `datum[${JSON.stringify(size.name)}] > 0` + }); + } else { + stackField = names.valueField; + transform2.push({ + type: "formula", + expr: "1", + as: stackField + }); + } + const stackTransform = { + type: "stack", + field: safeFieldName(stackField), + offset: "normalize", + as: [names.firstField, names.lastField] + }; + if (groupings.length) { + stackTransform.groupby = getGroupBy(groupings).map(safeFieldName); + } + transform2.push(stackTransform); + addTransforms(globalScope.data, ...transform2); + const span2 = [names.lastField, names.firstField].map((f) => `datum[${JSON.stringify(f)}]`).join(" - "); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ""), + y: addOffsets(parentScope.offsets.y, horizontal ? "" : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), + h: horizontal ? parentScope.offsets.h : `(${span2}) * (${parentScope.offsets.h})`, + w: horizontal ? `(${span2}) * (${parentScope.offsets.w})` : parentScope.offsets.w + }; + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { + update: Object.assign({ height: { + signal: offsets2.h + }, width: { + signal: offsets2.w + } }, z2 && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z2.name) + } : { + value: 0 + } + ] + }) + } + }; + addMarks(globalScope.markGroup, mark); + let percentageScale; + if (addPercentageScale) { + percentageScale = [{ + type: "linear", + name: names.scale, + domain: [0, 100], + range: horizontal ? [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ] : [ + { + signal: parentScope.sizeSignals.layoutHeight + }, + 0 + ] + }]; + } + return { + globalScales: { + showAxes, + scales: { + x: horizontal ? percentageScale : void 0, + y: horizontal ? void 0 : percentageScale, + z: zScale && [zScale] + } + }, + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + mark + }; + } + } + let Treemap$1 = class Treemap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `treemap_${this.id}`; + this.names = { + dataName: `data_${p}`, + dataHeightWidth: `data_${p}_hw`, + dataExtents: `data_${p}_extents`, + dataFacet: `data_${p}_facet`, + dataFacetMark: `data_${p}_facetMark`, + fieldChildren: `${p}_children`, + fieldDepth: `${p}_depth`, + fieldX0: `${p}_x0`, + fieldX1: `${p}_x1`, + fieldY0: `${p}_y0`, + fieldY1: `${p}_y1`, + fieldHeight: `${p}_h`, + fieldWidth: `${p}_w`, + heightExtent: `${p}_heightExtent`, + widthExtent: `${p}_widthExtent`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, props } = this; + const { globalScope, parentScope, showAxes, treeMapMethod, z: z2 } = props; + const zScale = addZScale(z2, globalScope.zSize, globalScope.data.name, names.zScale); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, fn(names.fieldX0)), + y: addOffsets(parentScope.offsets.y, fn(names.fieldY0)), + h: subtract$1(names.fieldY1, names.fieldY0), + w: subtract$1(names.fieldX1, names.fieldX0) + }; + const mark = this.transformedMark(offsets2); + addSignals(globalScope.scope, { + name: SignalNames.TreeMapMethod, + value: "squarify", + bind: { + name: treeMapMethod, + input: "select", + options: [ + "squarify", + "binary" + ] + } + }); + return Object.assign(Object.assign({}, z2 && { + globalScales: { + showAxes, + scales: { + z: [zScale] + } + } + }), { + mark, + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + } + }); } - lerpView(from, to, time) { - super.lerpView(from, to, time); - this.setAltAzimuth((0, _mathJs.MathHelper).lerp(from.altitude, to.altitude, time), (0, _mathJs.MathHelper).lerp(from.azimuth, to.azimuth, time), false); - this._core.config.fov = (0, _mathJs.MathHelper).lerp(from.fov, to.fov, time); + transformedMark(offsets2) { + const { names, props } = this; + const { globalScope, groupings, parentScope } = props; + if (groupings.length) { + addData(globalScope.scope, { + name: names.dataHeightWidth, + source: globalScope.markDataName, + transform: [ + { + type: "formula", + expr: parentScope.offsets.h, + as: names.fieldHeight + }, + { + type: "formula", + expr: parentScope.offsets.w, + as: names.fieldWidth + } + ] + }); + const treemapData = { + name: names.dataFacetMark, + source: names.dataFacet + }; + const facets = { + type: "group", + from: { + facet: { + name: names.dataFacet, + data: names.dataHeightWidth, + groupby: getGroupBy(groupings).map(safeFieldName) + } + }, + data: [ + { + name: names.dataExtents, + source: names.dataFacet, + transform: [ + { + type: "extent", + field: names.fieldHeight, + signal: names.heightExtent + }, + { + type: "extent", + field: names.fieldWidth, + signal: names.widthExtent + } + ] + }, + treemapData + ] + }; + globalScope.setMarkDataName(names.dataFacetMark); + addMarks(globalScope.markGroup, facets); + globalScope.setMarkGroup(facets); + this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); + return this.addMark(offsets2, facets, globalScope.markDataName); + } else { + this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); + return this.addMark(offsets2, globalScope.markGroup, globalScope.markDataName); + } } - update(elapsedTime) { - super.update(elapsedTime); - if (this._core.config.isDebugVisible) { - const altitude = (0, _angleJs.AngleHelper).radiansToDegrees(this.altitude); - const azimuth = (0, _angleJs.AngleHelper).radiansToDegrees(this.azimuth); - this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); - this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + addMark(offsets2, markParent, markDataName) { + const { names, prefix, props } = this; + const { view, z: z2 } = props; + const mark = { + name: prefix, + type: "rect", + from: { data: markDataName }, + encode: { + update: Object.assign({ width: { + signal: offsets2.w + }, height: { + signal: offsets2.h + } }, z2 && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z2.name) + } : { + value: 0 + } + ] + }) } + }; + addMarks(markParent, mark); + return mark; } - get altitude() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITY, this._up, this._right); + treemapTransform(treemapData, widthSignal, heightSignal) { + const { names, props } = this; + const { group: group2, size } = props; + addTransforms(treemapData, { + type: "filter", + expr: `datum[${JSON.stringify(size.name)}] > 0` + }, { + type: "nest", + keys: [group2 && group2.name || "__NONE__"] + }, { + type: "treemap", + field: safeFieldName(size.name), + sort: { field: "value", order: "descending" }, + round: true, + method: { signal: SignalNames.TreeMapMethod }, + paddingInner: 1, + paddingOuter: 0, + size: [ + { signal: widthSignal }, + { signal: heightSignal } + ], + as: [ + names.fieldX0, + names.fieldY0, + names.fieldX1, + names.fieldY1, + names.fieldDepth, + names.fieldChildren + ] + }); } - get azimuth() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITX, this._right, this._up); + }; + function fn(n) { + return `datum[${JSON.stringify(n)}]`; + } + function subtract$1(...fields) { + return fields.map((n) => fn(n)).join(" - "); + } + class Wrap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `wrap_${this.id}`; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby); + this.names = { + outputData: `data_${p}_out`, + rowColumnDataName: `data_${p}_row_col`, + cellHeight: `${p}_cellHeight`, + cellWidth: `${p}_cellWidth`, + fits: `${p}_fits`, + target: `${p}_target`, + minArea: `${p}_minArea`, + aspect: `${p}_aspect`, + minAspect: `${p}_minAspect`, + idealAspect: `${p}_idealAspect`, + dataLength: `${p}_dataLength`, + rxc0: `${p}_rxc0`, + rxc1: `${p}_rxc1`, + rxc2: `${p}_rxc2`, + rxc: `${p}_rxc`, + growColCount: `${p}_growColCount`, + growCellWidth: `${p}_growCellWidth`, + fitsArea: `${p}_fitsArea`, + colCount: `${p}_colCount` + }; } - setAltAzimuth(altitude, azimuth, isSmooth) { - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, altitude); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, azimuth); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - if (!isSmooth) this.syncSmooth(); + getGrouping() { + return this.bin.fields; } - rotate(translationDelta) { - const length = Math.min(this.width, this.height); - let angle = translationDelta[1] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - angle = translationDelta[0] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/angle.js":"53hwW","../helpers/math.js":"f65d0","./camera.js":"h35rS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lD0bG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -var _glMatrix = require("gl-matrix"); -class Constants { -} -Constants.TWO_PI = 6.283185307179586; -Constants.PI = 3.141592653589793; -Constants.PI_OVER_TWO = 1.5707963267948966; -Constants.PI_OVER_THREE = 1.0471975511965976; -Constants.PI_OVER_FOUR = 0.7853981633974483; -Constants.PI_OVER_SIX = 0.5235987755982988; -Constants.LOG_2 = 0.6931471805599453; -Constants.RADIANS_PER_DEGREE = 0.017453292519943295; -Constants.DEGREES_PER_RADIAN = 57.29577951308232; -Constants.ROOT_TWO = 1.4142135623730951; -Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; -Constants.ROOT_THREE = 1.7320508075688772; -Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; -Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; -Constants.VECTOR2_ZERO = (0, _glMatrix.vec2).fromValues(0, 0); -Constants.VECTOR2_ONE = (0, _glMatrix.vec2).fromValues(1, 1); -Constants.VECTOR2_UNITX = (0, _glMatrix.vec2).fromValues(1, 0); -Constants.VECTOR2_UNITY = (0, _glMatrix.vec2).fromValues(0, 1); -Constants.VECTOR3_ZERO = (0, _glMatrix.vec3).fromValues(0, 0, 0); -Constants.VECTOR3_ONE = (0, _glMatrix.vec3).fromValues(1, 1, 1); -Constants.VECTOR3_UNITX = (0, _glMatrix.vec3).fromValues(1, 0, 0); -Constants.VECTOR3_UNITY = (0, _glMatrix.vec3).fromValues(0, 1, 0); -Constants.VECTOR3_UNITZ = (0, _glMatrix.vec3).fromValues(0, 0, 1); -Constants.VECTOR3_REFLECTX = (0, _glMatrix.vec3).fromValues(1, -1, -1); -Constants.VECTOR3_REFLECTY = (0, _glMatrix.vec3).fromValues(-1, 1, -1); -Constants.VECTOR3_REFLECTZ = (0, _glMatrix.vec3).fromValues(-1, -1, 1); -Constants.VECTOR4_ZERO = (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); -Constants.VECTOR4_ONE = (0, _glMatrix.vec4).fromValues(1, 1, 1, 1); -Constants.VECTOR4_UNITX = (0, _glMatrix.vec4).fromValues(1, 0, 0, 0); -Constants.VECTOR4_UNITY = (0, _glMatrix.vec4).fromValues(0, 1, 0, 0); -Constants.VECTOR4_UNITZ = (0, _glMatrix.vec4).fromValues(0, 0, 1, 0); -Constants.VECTOR4_UNITW = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); -Constants.MAT3_IDENTITY = (0, _glMatrix.mat3).create(); -Constants.MAT4_IDENTITY = (0, _glMatrix.mat4).create(); -Constants.MAT4_ROTATION_MINUS_90 = (0, _glMatrix.mat4).fromValues(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); -Constants.QUAT_IDENTITY = (0, _glMatrix.quat).create(); -Constants.QUAT_ROTATEX_PLUS_90 = (0, _glMatrix.quat).fromValues(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEX_MINUS_90 = (0, _glMatrix.quat).fromValues(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_PLUS_90 = (0, _glMatrix.quat).fromValues(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_MINUS_90 = (0, _glMatrix.quat).fromValues(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_PLUS_90 = (0, _glMatrix.quat).fromValues(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_MINUS_90 = (0, _glMatrix.quat).fromValues(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.MILLISECONDS_PER_DAY = 86400000; - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"53hwW":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>AngleHelper); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("./math.js"); -var _constantsJs = require("../constants.js"); -class AngleHelper { - static degreesToRadians(degrees) { - return degrees * (0, _constantsJs.Constants).RADIANS_PER_DEGREE; - } - static radiansToDegrees(radians) { - return radians * (0, _constantsJs.Constants).DEGREES_PER_RADIAN; - } - static wrapAngle(angle) { - if (angle > (0, _constantsJs.Constants).PI) angle = angle - (0, _constantsJs.Constants).TWO_PI; - else if (angle < -(0, _constantsJs.Constants).PI) angle += (0, _constantsJs.Constants).TWO_PI; - return angle; - } - static sphericalToCartesian(altitude, longitude, latitude, result) { - latitude = AngleHelper.degreesToRadians(latitude); - longitude = AngleHelper.degreesToRadians(longitude); - const scale = Math.cos(latitude); - result[0] = altitude * scale * Math.sin(longitude); - result[1] = altitude * Math.sin(latitude); - result[2] = altitude * scale * Math.cos(longitude); - } - static cartesianToSpherical(x, y, z, result) { - result[0] = Math.atan2(x, z); - result[1] = Math.asin(y); + build() { + const { bin: bin2, names, prefix, props } = this; + const { axisTextColor, cellTitles, globalScope, parentScope } = props; + let ordinalBinData; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + addTransforms(bin2.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, + as: FieldNames.Contains + }); + ordinalBinData = bin2.dataSequence.name; + } else { + const ord = createOrdinals(globalScope.data.name, prefix, bin2.fields, "ascending"); + addData(globalScope.scope, ord.data); + ordinalBinData = ord.data.name; + } + addData(globalScope.scope, { + name: names.rxc0, + transform: [ + { + type: "sequence", + start: 1, + stop: { + signal: `ceil(sqrt(${names.dataLength})) + 1` + } + }, + { + type: "formula", + expr: `ceil(${names.dataLength} / datum.data)`, + as: "complement" + } + ] + }, { + name: names.rxc1, + source: names.rxc0, + transform: [ + { + type: "project", + fields: ["data"], + as: ["cols"] + } + ] + }, { + name: names.rxc2, + source: names.rxc0, + transform: [ + { + type: "project", + fields: ["complement"], + as: ["cols"] + } + ] + }, { + name: names.rxc, + source: [names.rxc1, names.rxc2], + transform: [ + { + type: "formula", + expr: `ceil(${names.dataLength} / datum.cols)`, + as: "rows" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, + as: "cellw" + }, + { + type: "formula", + expr: `datum.cols === 1 ? max(datum.cellw, ${SignalNames.MinCellWidth}) : datum.cellw`, + as: "cellw" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, + as: "cellh" + }, + { + type: "formula", + expr: `datum.rows === 1 ? max(datum.cellh, ${SignalNames.MinCellHeight}) : datum.cellh`, + as: "cellh" + }, + { + type: "formula", + expr: `(datum.cellw >= ${SignalNames.MinCellWidth} && datum.cellh >= ${SignalNames.MinCellHeight})`, + as: "meetsmin" + }, + { + type: "filter", + expr: "datum.meetsmin" + }, + { + type: "formula", + expr: "datum.cellw / datum.cellh", + as: names.aspect + }, + { + type: "formula", + expr: `abs(datum.${names.aspect} - ${names.target})`, + as: names.idealAspect + }, + { + type: "formula", + expr: `${names.dataLength} / (datum.cols * datum.rows)`, + as: "coverage" + }, + { + type: "collect", + sort: { + field: [names.idealAspect, "coverage"], + order: ["ascending", "descending"] + } + } + ] + }, { + name: names.rowColumnDataName, + source: ordinalBinData, + transform: [ + { + type: "formula", + expr: `floor((datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) / ${names.colCount})`, + as: FieldNames.WrapRow + }, + { + type: "formula", + expr: `(datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) % ${names.colCount}`, + as: FieldNames.WrapCol + }, + { + type: "formula", + expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch + }, + { + type: "formula", + expr: displayBin(bin2), + as: FieldNames.FacetTitle + } + ] + }); + const dataOut = { + name: names.outputData, + source: globalScope.data.name, + transform: [ + { + type: "lookup", + from: names.rowColumnDataName, + key: safeFieldName(bin2.fields[0]), + fields: [bin2.fields[0]].map(safeFieldName), + values: [FieldNames.WrapRow, FieldNames.WrapCol] + } + ] + }; + addData(globalScope.scope, dataOut); + globalScope.setMarkDataName(names.outputData); + addSignals(globalScope.scope, { + name: names.minAspect, + update: `${SignalNames.MinCellWidth} / ${SignalNames.MinCellHeight}` + }, { + name: names.target, + update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}` + }, { + name: names.minArea, + update: `${SignalNames.MinCellWidth}*${SignalNames.MinCellHeight}` + }, { + name: names.aspect, + update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` + }, { + name: names.dataLength, + update: `data(${JSON.stringify(ordinalBinData)}).length` + }, { + name: names.growColCount, + update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${SignalNames.MinCellWidth}), 1)` + }, { + name: names.growCellWidth, + update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` + }, { + name: names.fitsArea, + update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` + }, { + name: names.fits, + update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` + }, { + name: names.colCount, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` + }, { + name: names.cellWidth, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` + }, { + name: names.cellHeight, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${SignalNames.MinCellHeight}` + }); + modifySignal(globalScope.signals.plotHeightOut, "max", `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); + modifySignal(globalScope.signals.plotWidthOut, "max", `(${names.cellWidth} * ${names.colCount})`); + const signalH = [names.cellHeight, SignalNames.FacetPaddingTop, SignalNames.FacetPaddingBottom].join(" - "); + const signalW = [names.cellWidth, SignalNames.FacetPaddingLeft].join(" - "); + const signalX = addOffsets(parentScope.offsets.x, `datum[${JSON.stringify(FieldNames.WrapCol)}] * ${names.cellWidth}`, SignalNames.FacetPaddingLeft); + const signalY = addOffsets(parentScope.offsets.y, `datum[${JSON.stringify(FieldNames.WrapRow)}] * ${names.cellHeight}`, SignalNames.FacetPaddingTop); + const update2 = { + height: { + signal: signalH + }, + width: { + signal: signalW + }, + x: { + signal: signalX + }, + y: { + signal: signalY + } + }; + const offsets2 = { + x: signalX, + y: signalY, + h: signalH, + w: signalW + }; + const group2 = { + style: "cell", + name: prefix, + type: "group", + from: { + data: names.rowColumnDataName + }, + encode: { update: update2 } + }; + addMarks(globalScope.markGroup, group2); + const sizeSignals = { + layoutHeight: `(${names.cellHeight} - ${SignalNames.FacetPaddingTop} - ${SignalNames.FacetPaddingBottom})`, + layoutWidth: `(${names.cellWidth} - ${SignalNames.FacetPaddingLeft})`, + colCount: names.colCount, + rowCount: `ceil(${names.dataLength} / ${names.colCount})` + }; + if (cellTitles) { + addFacetCellTitles(group2, sizeSignals, axisTextColor); + } + return { + facetScope: group2, + sizeSignals, + offsets: offsets2 + }; } - static angleBetweenVectors(from, to) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - return Math.acos(dot); + } + const layoutClasses = { + AggregateContainer, + AggregateSquare, + Band: Band$1, + Cross: Cross$1, + Scatter: Scatter$1, + Square, + Stack: Stack$1, + Strip, + Treemap: Treemap$1, + Wrap + }; + function getImageMark(backgroundImage, allGlobalScales) { + const xScale = allGlobalScales.filter((s2) => s2.scales.x)[0].scales.x[0]; + const yScale = allGlobalScales.filter((s2) => s2.scales.y)[0].scales.y[0]; + const [xScaleName, yScaleName] = [xScale, yScale].map((s2) => s2.name + (xScale.type === "band" ? bandScaleLinearSuffix : "")); + return { + type: "image", + encode: { + update: { + url: { + value: backgroundImage.url + }, + aspect: { + value: false + }, + baseline: { + value: "bottom" + }, + height: { + signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) + }, + y: { + signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) + }, + width: { + signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) + }, + x: { + signal: getScaledValue(xScaleName, backgroundImage.extents.left) + } } + } + }; + } + function getScaledSpan(scaleName, low, high) { + return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; + } + function getScaledValue(scaleName, value2) { + return `scale('${scaleName}', ${value2})`; + } + class SpecBuilder { + constructor(props, specContext) { + this.props = props; + this.specContext = specContext; + this.globalSignals = { + facetAxesAdjustX: { name: SignalNames.FacetAxesAdjustX, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingLeft.toString() : "0" }, + facetAxesAdjustY: { name: SignalNames.FacetAxesAdjustY, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingBottom.toString() : "0" }, + minCellWidth: { + name: SignalNames.MinCellWidth, + update: `${minFacetWidth}` + }, + minCellHeight: { name: SignalNames.MinCellHeight, update: `${minFacetHeight}` }, + plotOffsetLeft: { name: SignalNames.PlotOffsetLeft, update: "0" }, + plotOffsetTop: { name: SignalNames.PlotOffsetTop, update: "0" }, + plotOffsetBottom: { name: SignalNames.PlotOffsetBottom, update: "0" }, + plotOffsetRight: { name: SignalNames.PlotOffsetRight, update: "0" }, + plotHeightOut: { name: SignalNames.PlotHeightOut, update: SignalNames.PlotHeightIn }, + plotWidthOut: { name: SignalNames.PlotWidthOut, update: SignalNames.PlotWidthIn } + }; } - static signedAngleBetweenVectors(from, to, up) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - let angle = Math.acos(dot); - (0, _glMatrix.vec3).cross(AngleHelper._vec3, from, to); - if ((0, _glMatrix.vec3).dot(AngleHelper._vec3, up) < 0) angle = -angle; - return angle; - } - } -} -AngleHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","./math.js":"f65d0","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f65d0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MathHelper", ()=>MathHelper); -parcelHelpers.export(exports, "PseudoRandom", ()=>PseudoRandom); -class MathHelper { - static simpleLinearRegression(points) { - const n = points.length; - let sumX = 0; - let sumY = 0; - let sumXY = 0; - let sumXX = 0; - for(let i = 0; i < n; i++){ - sumX += points[i].x; - sumY += points[i].y; - sumXY += points[i].x * points[i].y; - sumXX += points[i].x * points[i].x; - } - const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); - const yIntercept = (sumY - slope * sumX) / n; - return { - slope, - yIntercept - }; - } - static clamp(value, min, max) { - return Math.max(Math.min(value, max), min); + validate() { + const { specContext } = this; + const { specCapabilities } = this.props; + const { roles } = specCapabilities; + const required2 = roles.filter((r) => { + switch (typeof r.allowNone) { + case "boolean": + return !r.allowNone; + case "undefined": + return true; + case "function": + return !r.allowNone(specContext); + } + }); + const numeric = roles.filter((r) => r.excludeCategoric); + const errors = required2.map((r) => { + if (specContext.specColumns[r.role]) { + return null; + } else { + return `Field ${r.role} is required.`; + } + }).concat(numeric.map((r) => { + if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) { + return `Field ${r.role} must be quantitative.`; + } else { + return null; + } + })).filter(Boolean); + const { backgroundImage } = specContext.insight; + if (backgroundImage && !backgroundImage.extents) { + errors.push("BackgroundImage must have extents."); + } + return errors; } - static lerp(value1, value2, amount) { - return value1 + (value2 - value1) * amount; + build() { + var _a2, _b2; + const { globalSignals, specContext } = this; + const { facetLayout, specCapabilities } = this.props; + const { insight, specColumns, specViewOptions } = specContext; + const dataName = "data_source"; + const { vegaSpec, groupMark } = this.initSpec(dataName); + const { topColorField, colorDataName } = addColor({ + scope: vegaSpec, + dataName, + specContext, + scaleName: ScaleNames.Color, + legendDataName: "data_legend", + topLookupName: "data_topcolorlookup", + colorReverseSignalName: SignalNames.ColorReverse + }); + const globalScope = new GlobalScope({ + dataName: colorDataName, + markGroup: groupMark, + scope: vegaSpec, + signals: globalSignals + }); + if (facetLayout) { + addSignals(vegaSpec, { + name: SignalNames.FacetPaddingBottom, + update: `${facetLayout.facetPadding.bottom}` + }, { + name: SignalNames.FacetPaddingLeft, + update: `${facetLayout.facetPadding.left}` + }, { + name: SignalNames.FacetPaddingTop, + update: `${facetLayout.facetPadding.top}` + }); + globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; + globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; + } + const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope) => { + if (facetLayout && i === 0) { + globalScope.zSize = innerScope.offsets.h; + } + }); + if (specResult) { + return specResult; + } + if (allGlobalScales.length > 0) { + const plotHeightOut = globalSignals.plotHeightOut.name; + const plotWidthOut = globalSignals.plotWidthOut.name; + const colTitleScale = { + type: "linear", + name: "scale_facet_col_title", + domain: [0, 1], + range: [0, { signal: plotWidthOut }] + }; + const rowTitleScale = { + type: "linear", + name: "scale_facet_row_title", + domain: [0, 1], + range: [{ signal: plotHeightOut }, 0] + }; + const facetScope = facetLayout ? firstScope : null; + const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; + if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a2 = specColumns.x) === null || _a2 === void 0 ? void 0 : _a2.quantitative) && ((_b2 = specColumns.y) === null || _b2 === void 0 ? void 0 : _b2.quantitative)) { + if (!backgroundGroup.marks) { + backgroundGroup.marks = []; + } + const imageMark = getImageMark(insight.backgroundImage, allGlobalScales); + backgroundGroup.marks.unshift(imageMark); + } + const axesScopes = facetLayout ? addFacetAxesGroupMarks({ + globalScope: globalScope.scope, + plotScope: groupMark, + facetScope, + colTitleScale, + rowTitleScale, + colSeqName: "data_FacetCellColTitles", + rowSeqName: "data_FacetCellRowTitles" + }) : { + main: [{ + scope: groupMark, + lines: true, + labels: true, + title: true + }] + }; + addGlobalAxes({ + globalScope, + allGlobalScales, + axisScales: this.props.axisScales, + plotOffsetSignals: { x: globalSignals.plotOffsetLeft, y: globalSignals.plotOffsetBottom }, + axesOffsets: { x: axesOffsetX, y: axesOffsetY }, + axesTitlePadding: facetLayout ? { x: axesTitlePaddingFacetX, y: axesTitlePaddingFacetY } : { x: axesTitlePaddingX, y: axesTitlePaddingY }, + labelBaseline: { x: "top", y: "middle" }, + specColumns, + specViewOptions, + axesScopes, + hideZAxis: !!facetLayout, + view: insight.view + }); + } + if (finalScope.mark) { + const { update: update2 } = finalScope.mark.encode; + const outputDataName = "output"; + finalScope.mark.from.data = outputDataName; + addData(globalScope.markGroup, { + name: outputDataName, + source: globalScope.markDataName, + transform: [ + { + type: "formula", + expr: finalScope.offsets.x, + as: FieldNames.OffsetX + }, + { + type: "formula", + expr: finalScope.offsets.y, + as: FieldNames.OffsetY + } + ] + }); + update2.x = { + field: FieldNames.OffsetX + }; + update2.y = { + field: FieldNames.OffsetY + }; + allEncodingRules.forEach((map2) => { + for (const key2 in map2) { + if (update2[key2]) { + const arrIn = map2[key2]; + if (!Array.isArray(update2[key2])) { + const value2 = update2[key2]; + const arrOut = []; + update2[key2] = arrOut; + arrIn.forEach((rule2) => arrOut.push(rule2)); + arrOut.push(value2); + } else { + const arrOut = update2[key2]; + arrIn.forEach((rule2) => arrOut.unshift(rule2)); + } + } + } + }); + update2.fill = fill$1(specContext, topColorField, ScaleNames.Color); + update2.opacity = opacity(); + } + return { + specCapabilities, + vegaSpec + }; } - static normalize(value, min, max, from = 0, to = 1) { - return max - min == 0 ? 0 : Math.max(Math.min((to - from) * (value - min) / (max - min) + from, to), from); + initSpec(dataName) { + const { globalSignals } = this; + const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; + const { specContext } = this; + const { insight } = specContext; + const groupMark = { + type: "group", + //style: 'cell', + encode: { + update: { + x: { signal: `${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, + y: { signal: SignalNames.PlotOffsetTop }, + height: { signal: `${SignalNames.PlotHeightOut} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: `${SignalNames.PlotWidthOut} + ${SignalNames.FacetAxesAdjustX}` } + } + } + }; + const inputDataname = "input"; + const vegaSpec = { + $schema: "https://vega.github.io/schema/vega/v5.json", + //style: 'cell', + data: [{ name: inputDataname }, { name: dataName, source: inputDataname, transform: [] }], + marks: [groupMark], + signals: textSignals(specContext, SignalNames.ViewportHeight).concat([ + minCellWidth, + minCellHeight, + { + name: SignalNames.ViewportHeight, + update: `max(${SignalNames.MinCellHeight}, ${insight.size.height})` + }, + { + name: SignalNames.ViewportWidth, + update: `max(${SignalNames.MinCellWidth}, ${insight.size.width})` + }, + plotOffsetLeft, + plotOffsetTop, + plotOffsetBottom, + plotOffsetRight, + facetAxesAdjustX, + facetAxesAdjustY, + { + name: SignalNames.PlotHeightIn, + update: `${SignalNames.ViewportHeight} - ${SignalNames.PlotOffsetBottom} + ${SignalNames.FacetAxesAdjustY}` + }, + { + name: SignalNames.PlotWidthIn, + update: `${SignalNames.ViewportWidth} - ${SignalNames.PlotOffsetLeft} - ${SignalNames.PlotOffsetRight}` + }, + plotHeightOut, + plotWidthOut, + { + name: "height", + update: `${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut} + ${SignalNames.PlotOffsetBottom} - ${SignalNames.FacetAxesAdjustY}` + }, + { + name: "width", + update: `${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotOffsetRight}` + } + ]) + }; + return { vegaSpec, groupMark }; } - static splitExponent(value, result) { - let exponent = Math.round(Math.log10(Math.abs(value))); - let coefficient = value / Math.pow(10, exponent); - if (coefficient < 1) { - coefficient *= 10; - exponent--; + iterateLayouts(globalScope, onLayoutBuild) { + let specResult; + let parentScope = { + sizeSignals: globalScope.sizeSignals, + offsets: globalScope.offsets + }; + let firstScope; + let childScope; + const groupings = []; + const { layouts, specCapabilities } = this.props; + const allGlobalScales = []; + const allEncodingRules = []; + for (let i = 0; i < layouts.length; i++) { + if (!parentScope) + continue; + const buildProps = { + globalScope, + parentScope, + axesScales: this.props.axisScales, + groupings, + id: i + }; + const layout = this.createLayout(layouts[i], buildProps); + try { + childScope = layout.build(); + childScope.id = i; + const groupby = layout.getGrouping(); + if (groupby) { + groupings.push({ + id: i, + groupby, + fieldOps: [ + { field: null, op: "count", as: FieldNames.Count } + ] + }); + } + const sumOp = layout.getAggregateSumOp(); + if (sumOp) { + groupings[groupings.length - 1].fieldOps.push(sumOp); + } + onLayoutBuild(i, childScope); + } catch (e) { + specResult = { + errors: [e.stack], + specCapabilities, + vegaSpec: null + }; + break; + } + if (childScope && childScope.globalScales) { + allGlobalScales.push(childScope.globalScales); } - result[0] = coefficient; - result[1] = exponent; + if (childScope.encodingRuleMap) { + allEncodingRules.push(childScope.encodingRuleMap); + } + if (i === 0) { + firstScope = childScope; + } + parentScope = childScope; + } + return { firstScope, finalScope: parentScope, specResult, allGlobalScales, allEncodingRules }; } - static combineExponent(mantissa, exponent) { - return mantissa * Math.pow(10, exponent); + createLayout(layoutPair, buildProps) { + const { layoutType, props } = layoutPair; + const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); + const layoutClass = layoutClasses[layoutType]; + const layout = new layoutClass(layoutBuildProps); + layout.id = buildProps.id; + return layout; } - static isPowerOf2(value) { - return (value & value - 1) == 0; + } + function build(specContext, currData) { + const { specColumns } = specContext; + const columns = [ + specColumns.color, + specColumns.facet, + specColumns.facetV, + specColumns.group, + specColumns.size, + specColumns.sort, + specColumns.x, + specColumns.y, + specColumns.z + ]; + inferAll(columns, currData); + const specBuilderProps = getSpecBuilderPropsForChart(specContext); + const specBuilder = new SpecBuilder(specBuilderProps, specContext); + let specResult; + if (specBuilder) { + try { + const errors = specBuilder.validate(); + if (errors.length) { + specResult = { + errors, + specCapabilities: specBuilderProps.specCapabilities, + vegaSpec: null + }; + } else { + specResult = specBuilder.build(); + } + } catch (e) { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [e.stack] + }; + } + if (!specResult.errors) { + const data0 = specResult.vegaSpec.data[0]; + data0.values = currData; + } + } else { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [`could not build spec for ${specContext.insight.chart}`] + }; } -} -class PseudoRandom { - constructor(seed){ - this._seed = seed % 2147483647; - if (this._seed <= 0) this._seed += 2147483646; + return specResult; + } + const index$7 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + ColorScaleNone, + FieldNames, + Other, + ScaleNames, + SignalNames, + build, + getColumnsFromData, + getSpecColumns, + getStats, + inferAll + }, Symbol.toStringTag, { value: "Module" })); + const GL_ORDINAL = "GL_ORDINAL"; + const constants$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + ColorScaleNone, + FieldNames, + GL_ORDINAL, + ScaleNames, + SignalNames + }, Symbol.toStringTag, { value: "Module" })); + function isSearchExpressionGroup(search) { + if (!search) { + return false; } - next() { - return this._seed = this._seed * 16807 % 2147483647; + return !!search.expressions; + } + function createGroupFromExpression(input) { + const output2 = { + expressions: [input] + }; + return output2; + } + function ensureSearchExpressionGroupArray(search) { + if (Array.isArray(search)) { + return [...search]; + } else if (isSearchExpressionGroup(search)) { + return [search]; + } else { + return [createGroupFromExpression(search)]; } - nextFloat() { - return (this.next() - 1) / 2147483646; - } - nextInteger(min, max) { - return Math.floor(this.nextFloat() * (max - min + 1) + min); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h35rS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraView", ()=>CameraView); -parcelHelpers.export(exports, "CameraBase", ()=>CameraBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _constantsJs = require("../constants.js"); -class CameraView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - } -} -class CameraBase { - getView(view) { - this.getPosition(view.position); + } + const expressionKeys = Object.keys({ + clause: null, + name: null, + operator: null, + value: null + }); + function compareExpression(a2, b2) { + if (a2 && b2) { + for (let k = 0; k < expressionKeys.length; k++) { + const key2 = expressionKeys[k]; + if (a2[key2] != b2[key2]) + return false; + } + } else { + return !a2 && !b2; } - setView(view, isSmooth) { - this.setPosition(view.position, isSmooth); + return true; + } + const groupKeys = Object.keys({ + clause: null + }); + function compareGroup$1(a2, b2) { + for (let k = 0; k < groupKeys.length; k++) { + const key2 = groupKeys[k]; + if (a2[key2] != b2[key2]) + return false; } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setPosition(this._vec3, false); + if (!a2.expressions && !b2.expressions) + return true; + if (!a2.expressions || !b2.expressions) + return false; + if (a2.expressions.length != b2.expressions.length) + return false; + for (let i = 0; i < a2.expressions.length; i++) { + if (!compareExpression(a2.expressions[i], b2.expressions[i])) + return false; } - get vMatrices() { - return this._vMatrices; + return true; + } + function compare$4(a2, b2) { + if (a2 == b2) + return true; + if (!a2 || !b2) + return false; + const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); + const [arrA, arrB] = arrs; + if (arrA.length != arrB.length) + return false; + for (let i = 0; i < arrA.length; i++) { + if (!compareGroup$1(arrA[i], arrB[i])) + return false; } - get inverseVMatrices() { - return this._inverseVMatrices; + return true; + } + function startsWith(whole, part) { + if (!part) + return true; + const arrs = [whole, part].map(ensureSearchExpressionGroupArray); + const [wholeArray, partArray] = arrs; + if (partArray.length > wholeArray.length) + return false; + for (let i = 0; i < partArray.length; i++) { + if (!compareGroup$1(wholeArray[i], partArray[i])) + return false; } - get mvMatrices() { - return this._mvMatrices; + return true; + } + function valueToBoolean(value2) { + if (typeof value2 === "string") { + switch (value2.toLowerCase()) { + case "true": + return true; + case "false": + return false; + } } - get pMatrices() { - return this._pMatrices; + return !!value2; + } + function valueToString(value2) { + if (value2 == null) { + return ""; + } + switch (typeof value2) { + case "string": + return value2; + case "boolean": + case "number": + return value2.toString(); + } + return ""; + } + function isStringOperation(ex) { + switch (ex.operator) { + case "contains": + case "!contains": + case "starts": + case "!starts": + return true; } - get inversePMatrices() { - return this._inversePMatrices; + return false; + } + function isnullorEmpty(value2) { + if (value2 == null) + return true; + if (typeof value2 === "string" && value2.length === 0) + return true; + return false; + } + class Exec { + constructor(search, columns) { + this.columns = columns; + this.groups = ensureSearchExpressionGroupArray(search).map((g) => { + const expressions = g.expressions.filter(Boolean); + expressions.forEach((ex) => { + ex.column = this.getColumn(ex.name); + ex.valueBool = valueToBoolean(ex.value); + ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); + ex.stringOperation = isStringOperation(ex); + }); + const group2 = Object.assign(Object.assign({}, g), { expressions }); + return group2; + }); } - get pickVMatrix() { - return this._pickVMatrix; + getColumn(name) { + for (let i = 0; i < this.columns.length; i++) { + if (this.columns[i].name == name) { + return this.columns[i]; + } + } } - get rMatrix() { - return this._mat3; - } - getOrbit(value) { - (0, _glMatrix.quat).copy(value, this._orbitRotation); - } - setOrbit(value, isSmooth) { - (0, _glMatrix.quat).copy(this._orbitRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, value); - } - getPosition(value) { - (0, _glMatrix.vec3).copy(value, this._cameraPosition); - } - setPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, value); - } - constructor(core){ - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this.modelPosition = (0, _glMatrix.vec3).create(); - this.modelScale = (0, _glMatrix.vec3).create(); - this.modelRotation = (0, _glMatrix.quat).create(); - this._orbitRotation = (0, _glMatrix.quat).create(); - this._orbitDirection = (0, _glMatrix.quat).create(); - this._smoothedOrbitRotation = (0, _glMatrix.quat).create(); - this._smoothedCameraPosition = (0, _glMatrix.vec3).create(); - this._smoothedCameraRotation = (0, _glMatrix.quat).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.quat).create(); - this._combinedPosition = (0, _glMatrix.vec3).create(); - this._combinedRotation = (0, _glMatrix.quat).create(); - this._leftToRightEye = (0, _glMatrix.vec3).create(); - this._pickVMatrix = (0, _glMatrix.mat4).create(); - this._eyePositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._vMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._pMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inverseVMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inversePMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; + runExpressionOnColumn(datum2, ex) { + const actualDataValue = datum2[ex.name]; + if (ex.operator === "isnullorEmpty") { + return isnullorEmpty(actualDataValue); + } else if (ex.operator === "!isnullorEmpty") { + return !isnullorEmpty(actualDataValue); + } + let dataValue = actualDataValue; + let expressionValue = ex.value; + if (ex.column) { + if (ex.column.type === "string" || ex.stringOperation) { + dataValue = valueToString(actualDataValue).toLocaleLowerCase(); + expressionValue = ex.valueLow; + } else if (ex.column.type === "boolean") { + dataValue = valueToBoolean(actualDataValue); + expressionValue = ex.valueBool; + } else if (ex.column.quantitative) { + dataValue = +actualDataValue; + expressionValue = +ex.value; + } + } + switch (ex.operator) { + case "!=": + return dataValue != expressionValue; + case "<": + return dataValue < expressionValue; + case "<=": + return dataValue <= expressionValue; + case "==": + return dataValue == expressionValue; + case ">": + return dataValue > expressionValue; + case ">=": + return dataValue >= expressionValue; + case "contains": + return dataValue.indexOf(expressionValue) >= 0; + case "!contains": + return dataValue.indexOf(expressionValue) < 0; + case "starts": + return dataValue.indexOf(expressionValue) == 0; + case "!starts": + return dataValue.indexOf(expressionValue) !== 0; + } } - reset(isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.quat).copy(this._cameraRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).copy(this._orbitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (!isSmooth) this.syncSmooth(); + runExpression(datum2, ex) { + if (ex.name == null) { + const group2 = { + expressions: this.columns.map((column, i) => { + const ex2 = Object.assign(Object.assign({}, ex), { column, name: column.name }); + if (i) { + ex2.clause = "||"; + } + return ex2; + }) + }; + return this.runGroup(datum2, group2); + } else { + return this.runExpressionOnColumn(datum2, ex); + } } - update(elapsedTime) { - let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); - amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); - (0, _glMatrix.quat).slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); - const epsilon = 0.000001; - let x; - let y; - let z; - let w; - x = this._smoothedCameraPosition[0] - this._cameraPosition[0]; - y = this._smoothedCameraPosition[1] - this._cameraPosition[1]; - z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - x = this._smoothedCameraRotation[0] - this._cameraRotation[0]; - y = this._smoothedCameraRotation[1] - this._cameraRotation[1]; - z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; - w = this._smoothedCameraRotation[3] - this._cameraRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - x = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; - y = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; - z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; - w = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); - (0, _glMatrix.quat).normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); - (0, _glMatrix.quat).normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); - (0, _glMatrix.quat).conjugate(this._orbitDirection, this._smoothedOrbitRotation); - (0, _glMatrix.vec3).transformMat4(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); - (0, _glMatrix.vec3).transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); - (0, _glMatrix.vec3).add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); - (0, _glMatrix.quat).multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); - (0, _glMatrix.mat3).fromQuat(this._mat3, this._combinedRotation); - this._right[0] = this._mat3[0]; - this._right[1] = this._mat3[1]; - this._right[2] = this._mat3[2]; - this._up[0] = this._mat3[3]; - this._up[1] = this._mat3[4]; - this._up[2] = this._mat3[5]; - this._forward[0] = this._mat3[6]; - this._forward[1] = this._mat3[7]; - this._forward[2] = this._mat3[8]; - const view = this._vMatrices[0]; - view[0] = this._right[0]; - view[1] = this._up[0]; - view[2] = this._forward[0]; - view[4] = this._right[1]; - view[5] = this._up[1]; - view[6] = this._forward[1]; - view[8] = this._right[2]; - view[9] = this._up[2]; - view[10] = this._forward[2]; - view[12] = -(0, _glMatrix.vec3).dot(this._right, this._combinedPosition); - view[13] = -(0, _glMatrix.vec3).dot(this._up, this._combinedPosition); - view[14] = -(0, _glMatrix.vec3).dot(this._forward, this._combinedPosition); - const aspectRatio = this.width / this.height; - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).none) { - if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - const left = -aspectRatio * top; - const right = aspectRatio * top; - const width = right - left; - const height = top - bottom; - const tileWidth = width / this._core.config.tilesX; - const tileHeight = height / this._core.config.tilesY; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); - } else (0, _glMatrix.mat4).perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this.vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this.pMatrices[0]); - } else { - (0, _glMatrix.vec3).cross(this._leftToRightEye, this._forward, this._up); - (0, _glMatrix.vec3).normalize(this._leftToRightEye, this._leftToRightEye); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); - this._vMatrices[0][12] += this._core.config.ipd * 0.5; - (0, _glMatrix.mat4).copy(this._vMatrices[1], this._vMatrices[0]); - this._vMatrices[1][12] -= this._core.config.ipd; - const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - let left = -aspectRatio * top + frustumShift; - let right = aspectRatio * top + frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - left = -aspectRatio * top - frustumShift; - right = aspectRatio * top - frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).multiply(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this._vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this._pMatrices[0]); - (0, _glMatrix.mat4).copy(this._inverseVMatrices[1], this._inverseVMatrices[0]); - this._inverseVMatrices[1][12] += this._core.config.ipd; - (0, _glMatrix.mat4).invert(this._inversePMatrices[1], this._pMatrices[1]); + runGroup(datum2, group2) { + let accumulator = this.runExpression(datum2, group2.expressions[0]); + for (let i = 1; i < group2.expressions.length; i++) { + const ex = group2.expressions[i]; + switch (ex.clause) { + case "&&": + accumulator = accumulator && this.runExpression(datum2, ex); + break; + case "||": + accumulator = accumulator || this.runExpression(datum2, ex); + break; } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } + return accumulator; + } + run(datum2) { + let accumulator = this.runGroup(datum2, this.groups[0]); + for (let i = 1; i < this.groups.length; i++) { + const group2 = this.groups[i]; + switch (group2.clause) { + case "&&": + accumulator = accumulator && this.runGroup(datum2, group2); + break; + case "||": + accumulator = accumulator || this.runGroup(datum2, group2); + break; } + } + return accumulator; } - _zoom(direction, distance) { - (0, _glMatrix.vec3).scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance); - } - rotate(translationDelta) {} - zoom(zoomDelta, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - const distance = zoomDelta * (0, _glMatrix.vec3).distance(this._combinedPosition, this.modelPosition); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._zoom(this._vec3, distance); - } - _twist(axis, angle) {} - twist(angle, x, y) {} - updatePickVMatrix(x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.mat4).lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); - } - syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); + } + function invertSearchExpressionGroup(input) { + const output2 = { + expressions: input.expressions.map(invertSearchExpression) + }; + if (input.clause) { + output2.clause = invertedClauses[input.clause]; } - updateModelManipulationOrigin(from, to) { - const a = (0, _glMatrix.vec3).create(); - const b = (0, _glMatrix.vec3).create(); - const c = (0, _glMatrix.vec3).create(); - const d = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformMat4(a, from, this.modelMMatrix); - (0, _glMatrix.vec3).transformMat4(b, to, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(a, this._cameraPosition, a); - (0, _glMatrix.vec3).subtract(b, this._cameraPosition, b); - (0, _glMatrix.vec3).transformQuat(c, a, this._orbitDirection); - (0, _glMatrix.vec3).transformQuat(d, b, this._orbitDirection); - (0, _glMatrix.vec3).subtract(c, c, a); - (0, _glMatrix.vec3).subtract(d, d, b); - (0, _glMatrix.vec3).subtract(this._vec3, c, d); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).add(this._cameraPosition, this._cameraPosition, this._vec3); - (0, _glMatrix.vec3).add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); - } - unproject(position, x, y, z) { - (0, _glMatrix.vec3).set(position, 2 * x / this.width - 1, 1 - 2 * y / this.height, z); - (0, _glMatrix.vec3).transformMat4(position, position, this._inversePMatrices[0]); - (0, _glMatrix.vec3).transformMat4(position, position, this._inverseVMatrices[0]); + return output2; + } + const invertedOperators = { + "!=": "==", + "==": "!=", + "<": ">=", + ">=": "<", + "<=": ">", + ">": "<=", + "!contains": "contains", + "contains": "!contains", + "!isnullorEmpty": "isnullorEmpty", + "isnullorEmpty": "!isnullorEmpty", + "!starts": "starts", + "starts": "!starts" + }; + const invertedClauses = { + "&&": "||", + "||": "&&" + }; + function invertSearchExpression(input) { + const operator2 = invertedOperators[input.operator]; + const output2 = Object.assign(Object.assign({}, input), { operator: operator2 }); + if (input.clause) { + output2.clause = invertedClauses[input.clause]; } - translate(translationDelta) { - const distance = (0, _glMatrix.vec3).distance(this.modelPosition, this._combinedPosition); - const height = 2 * Math.tan(this._core.config.fov / 2) * distance / this.height; - (0, _glMatrix.vec3).set(this._vec3, height * translationDelta[0], -height * translationDelta[1], 0); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).subtract(this._cameraPosition, this._cameraPosition, this._vec3); - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bCTP3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _mainJs = require("./main.js"); -var _angleJs = require("./helpers/angle.js"); -class Config { - constructor(core){ - this.reset(); + return output2; + } + function invert$2(search) { + if (Array.isArray(search)) { + return search.map(invertSearchExpressionGroup); + } else if (isSearchExpressionGroup(search)) { + return invertSearchExpressionGroup(search); + } else { + return invertSearchExpression(search); } - reset() { - this.isDebugVisible = false; - this.logLevel = (0, _mainJs.LogLevel).warn; - this.shaderPath = "shaders"; - this.fontPath = "fonts"; - this.modelDistance = 0.5; - this.modelSize = 0.25; - this.stereoMode = (0, _mainJs.StereoMode).none; - this.ipd = 0.06; - this.screenDistance = 0.5; - this.fov = (0, _angleJs.AngleHelper).degreesToRadians(30); - this.nearPlane = 0.01; - this.farPlane = 100; - this.pickWidth = 512; - this.pickHeight = 512; - this.pickHoldDelay = 1000; - this.pickSelectDelay = 100; - this.resizeMinimumDelay = 250; - this.rotationSmoothing = 0.02; - this.positionSmoothing = 0.02; - this.focusSmoothing = 0.01; - this.scaleSmoothing = 0.02; - this.mouseWheelZoomScale = -0.002; - this.mouseWheelRotationScale = -0.002; - this.dragToleranceSquared = 100; - this.manipulatorMinRelativeDistanceSquared = 100; - this.isMultiTouchEnabled = true; - this.isMultiTouchZoomEnabled = true; - this.isMultiTouchTwistEnabled = true; - this.isMultiTouchRotateEnabled = true; - this.isMultiTouchTranslateEnabled = true; - this.multiTouchZoomScale = 1; - this.cameraMinDistance = 0.1; - this.cameraMaxDistance = 10; - this.xrControllerRayColor = (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5); - this.xrControllerProfile = "windows-mixed-reality"; - this.xrControllerHandedness = "right"; - this.paletteColor = new Uint8Array([ - 0x80, - 0x80, - 0x80, - 0 - ]); - this.textColor = (0, _glMatrix.vec3).create(); - this.textHoverColor = (0, _glMatrix.vec3).create(); - this.textBorderColor = (0, _glMatrix.vec3).create(); - this.textBorderWidth = 0x18 / 0xff; - this.identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - this.axesTextLabelMaxGlyphs = 32; - this.axesTextColor = (0, _glMatrix.vec3).create(); - this.axesTextBorderColor = (0, _glMatrix.vec3).create(); - this.axesTextHoverColor = (0, _glMatrix.vec3).create(); - this.axesTextLabelMajorSize = 0.03; - this.axesTextLabelMinorSize = 0.02; - this.axesTextTitleMaxGlyphs = 127; - this.axesTextTitleSize = 0.05; - this.axesTextHeadingMaxGlyphs = 128; - this.axesTextHeadingSize = 0.075; - this.axesTextTitleLineHeight = 1.5; - this.axesTextHeadingLineHeight = 1.5; - this.axesTextLabelLineHeight = 1.5; - this.axesGridMajorThickness = 0.0002; - this.axesGridMinorThickness = 0.0001; - this.axesGridZeroThickness = 0.002; - this.axesGridPickDivisionHeight = 0.025; - this.axesGridBackgroundColor = (0, _glMatrix.vec3).create(); - this.axesGridHighlightColor = (0, _glMatrix.vec3).create(); - this.axesGridMinorColor = (0, _glMatrix.vec3).create(); - this.axesGridMajorColor = (0, _glMatrix.vec3).create(); - this.axesGridZeroColor = (0, _glMatrix.vec3).create(); - this.axesGridDefaultDivisions = 10; - this.keyTitleMaxGlyphs = 64; - this.keyLabelMaxGlyphs = 64; - this.selectionColor = (0, _glMatrix.vec3).create(); - this.hoverColor = (0, _glMatrix.vec3).create(); - this.activeColor = (0, _glMatrix.vec3).create(); - this.highlightMode = (0, _mainJs.HighlightMode).color; - this.lassoThickness = 4; - this.lassoDashWidth = 2; - this.lassoColor = (0, _glMatrix.vec3).create(); - this.minCubifiedTreeMapSlice = 0.01; - this.sdfBuffer = 0xc0; - this.sdfBorder = 0x0; - this.forceDirectIsEnabled = false; - this.forceDirectAttraction = 1; - this.forceDirectRepulsion = 1; - this.forceDirectGravity = 1; - this.forceDirectInterval = 0.1; - this.forceDirectMaxDistance = 0.1; - this.forceDirectTheta = 1; - this.forceDirectIterationsPerLayout = 1; - this.forceDirectEdgeWeightPower = 1; - this.forceDirectLockX = false; - this.forceDirectLockY = false; - this.forceDirectLockZ = false; - this.transitionDuration = 400; - this.transitionStaggering = 100; - this.transitionView = true; - this.isTransitionPickingEnabled = false; - this.backgroundColor = (0, _glMatrix.vec4).create(); - this.theme = (0, _mainJs.Theme).light; - this.renderMode = (0, _mainJs.RenderMode).color; - this.tilesX = 1; - this.tilesY = 1; - this.tileOffsetX = 0; - this.tileOffsetY = 0; + } + function narrow(a2, b2) { + if (!a2) { + return b2; } - get theme() { - return this._theme; - } - set theme(value) { - if (this._theme != value) { - this._theme = value; - switch(value){ - case (0, _mainJs.Theme).dark: - (0, _glMatrix.vec4).set(this.backgroundColor, 0, 0, 0, 1); - (0, _glMatrix.vec3).set(this.textColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.textHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.04, 0.04, 0.04); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.05, 0.05, 0.05); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.05, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.9, 0.9, 0.9); - break; - case (0, _mainJs.Theme).light: - (0, _glMatrix.vec4).set(this.backgroundColor, 1, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.textHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.textBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.925, 0.925, 0.925); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.8, 0.8, 0.8); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.7, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.1, 0.1, 0.1); - break; + const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); + const [arrA, arrB] = arrs; + arrB[0].clause = "&&"; + return arrA.concat(arrB); + } + const index$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Exec, + compare: compare$4, + compareExpression, + compareGroup: compareGroup$1, + createGroupFromExpression, + ensureSearchExpressionGroupArray, + invert: invert$2, + isSearchExpressionGroup, + narrow, + startsWith + }, Symbol.toStringTag, { value: "Module" })); + const types$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null + }, Symbol.toStringTag, { value: "Module" })); + const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + function decamelize(str, separator = "-") { + return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2").toLowerCase(); + } + function createElement(tag, attrs, ...children2) { + if (typeof tag === "function") { + const fn2 = tag; + let props = attrs; + if (props === null || props === void 0) { + props = { children: children2 }; + } else { + props.children = children2; + } + return fn2(props); + } else { + const ns = tag === "svg" ? SVG_NAMESPACE : null; + const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); + const map2 = attrs; + let ref2; + for (let name in map2) { + if (name && map2.hasOwnProperty(name)) { + let value2 = map2[name]; + if (name === "className" && value2 !== void 0) { + setAttribute$1(el, ns, "class", value2.toString()); + } else if (name === "disabled" && !value2) ; + else if (value2 === null || value2 === void 0) { + continue; + } else if (value2 === true) { + setAttribute$1(el, ns, name, name); + } else if (typeof value2 === "function") { + if (name === "ref") { + ref2 = value2; + } else { + el[name.toLowerCase()] = value2; } - if (this.themeChangedCallback) this.themeChangedCallback(this._theme); - } - } -} - -},{"gl-matrix":"5x28d","./constants.js":"lD0bG","./main.js":"f421K","./helpers/angle.js":"53hwW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eYPBQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugText", ()=>DebugText); -class DebugText { - get text() { - return this._text; + } else if (typeof value2 === "object") { + setAttribute$1(el, ns, name, flatten$1(value2)); + } else { + setAttribute$1(el, ns, name, value2.toString()); + } + } + } + if (children2 && children2.length > 0) { + appendChildren(el, children2); + } + if (ref2) { + ref2(el); + } + return el; } - constructor(){ - this.clear(); + } + function setAttribute$1(el, ns, name, value2) { + if (ns) { + el.setAttributeNS(null, name, value2); + } else { + el.setAttribute(name, value2); } - clear() { - this._text = ""; - } - addLine(value) { - this._text += value + "\n"; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9OHgw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fps", ()=>Fps); -class Fps { - get frameCounter() { - return this._frameCounter; + } + function flatten$1(o) { + const arr = []; + for (let prop in o) + arr.push(`${decamelize(prop, "-")}:${o[prop]}`); + return arr.join(";"); + } + function isInsideForeignObject(element2) { + let current = element2; + while (current) { + if (current.tagName.toLowerCase() === "foreignobject") { + return true; + } + current = current.parentElement; + } + return false; + } + function recreateWithSvgNamespace(element2) { + const svgElement = document.createElementNS(SVG_NAMESPACE, element2.tagName.toLowerCase()); + for (let i = 0; i < element2.attributes.length; i++) { + const attr2 = element2.attributes[i]; + svgElement.setAttributeNS(null, attr2.name, attr2.value); + } + const eventProperties = [ + "onclick", + "onmousedown", + "onmouseup", + "onmouseover", + "onmouseout", + "onmousemove", + "onkeydown", + "onkeyup", + "onkeypress", + "onfocus", + "onblur" + ]; + for (const prop of eventProperties) { + if (element2[prop]) { + svgElement[prop] = element2[prop]; + } } - get totalFrames() { - return this._totalFrames; + for (let i = 0; i < element2.childNodes.length; i++) { + const child = element2.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) { + svgElement.appendChild(recreateWithSvgNamespace(child)); + } else { + svgElement.appendChild(child.cloneNode(true)); + } } - constructor(core){ - this._core = core; - this._totalFrames = 0; - this.reset(); + return svgElement; + } + function addChild(parentElement, child) { + if (child === null || child === void 0 || typeof child === "boolean") { + return; + } else if (Array.isArray(child)) { + appendChildren(parentElement, child); + } else if (isElement(child)) { + const childEl = child; + if (parentElement.namespaceURI === SVG_NAMESPACE && childEl.namespaceURI !== SVG_NAMESPACE && childEl.tagName.toLowerCase() !== "foreignobject" && !isInsideForeignObject(parentElement)) { + const recreated = recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } else { + parentElement.appendChild(childEl); + } + } else { + parentElement.appendChild(document.createTextNode(child.toString())); } - update(elapsedTime) { - this._elapsedTime += elapsedTime; - if (this._elapsedTime > 1000) { - this._elapsedTime -= 1000; - this._fps = this._frameCounter; - this._frameCounter = 0; - } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`fps ${this._fps}`); + } + function appendChildren(parentElement, children2) { + children2.forEach((child) => addChild(parentElement, child)); + } + function isElement(el) { + return !!el.nodeType; + } + function mount(element2, container) { + container.innerHTML = ""; + if (element2) { + addChild(container, element2); } - render() { - this._frameCounter++; - this._totalFrames++; + } + function findElementByChildPositions(childPositions, container) { + let element2 = container || document.body; + let childPosition; + while (element2 && childPositions.length) { + childPosition = childPositions.shift(); + element2 = element2.children.item(childPosition); } - reset() { - this._fps = 0; - this._frameCounter = 0; - this._elapsedTime = 0; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hZb65":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteType", ()=>PaletteType); -parcelHelpers.export(exports, "PaletteName", ()=>PaletteName); -parcelHelpers.export(exports, "PaletteResources", ()=>PaletteResources); -parcelHelpers.export(exports, "PaletteBase", ()=>PaletteBase); -parcelHelpers.export(exports, "Palette", ()=>Palette); -const PaletteType = { - sequentialsinglehue: "sequentialsinglehue", - sequentialmultihue: "sequentialmultihue", - diverging: "diverging", - qualitative: "qualitative" -}; -const PaletteName = { - blues: "blues", - greens: "greens", - greys: "greys", - oranges: "oranges", - purples: "purples", - reds: "reds", - viridis: "viridis", - inferno: "inferno", - magma: "magma", - plasma: "plasma", - bluegreen: "bluegreen", - bluepurple: "bluepurple", - greenblue: "greenblue", - orangered: "orangered", - purpleblue: "purpleblue", - purplebluegreen: "purplebluegreen", - purplered: "purplered", - redpurple: "redpurple", - yellowgreen: "yellowgreen", - yellowgreenblue: "yellowgreenblue", - yelloworangebrown: "yelloworangebrown", - yelloworangered: "yelloworangered", - brownbluegreen: "brownbluegreen", - pinkyellowgreen: "pinkyellowgreen", - purplegreen: "purplegreen", - purpleorange: "purpleorange", - redblue: "redblue", - redgrey: "redgrey", - redyellowblue: "redyellowblue", - redyellowgreen: "redyellowgreen", - spectral: "spectral", - accent: "accent", - dark2: "dark2", - paired: "paired", - pastel1: "pastel1", - pastel2: "pastel2", - set1: "set1", - set2: "set2", - set3: "set3" -}; -class PaletteResources { - constructor(){ - this.palettes = { - "blues": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 251, - 255, - 222, - 235, - 247, - 198, - 219, - 239, - 158, - 202, - 225, - 107, - 174, - 214, - 66, - 146, - 198, - 33, - 113, - 181, - 8, - 81, - 156, - 8, - 48, - 107 - ]) - }, - "greens": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 252, - 245, - 229, - 245, - 224, - 199, - 233, - 192, - 161, - 217, - 155, - 116, - 196, - 118, - 65, - 171, - 93, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "greys": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 255, - 255, - 240, - 240, - 240, - 217, - 217, - 217, - 189, - 189, - 189, - 150, - 150, - 150, - 115, - 115, - 115, - 82, - 82, - 82, - 37, - 37, - 37, - 0, - 0, - 0 - ]) - }, - "oranges": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 235, - 254, - 230, - 206, - 253, - 208, - 162, - 253, - 174, - 107, - 253, - 141, - 60, - 241, - 105, - 19, - 217, - 72, - 1, - 166, - 54, - 3, - 127, - 39, - 4 - ]) - }, - "purples": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 252, - 251, - 253, - 239, - 237, - 245, - 218, - 218, - 235, - 188, - 189, - 220, - 158, - 154, - 200, - 128, - 125, - 186, - 106, - 81, - 163, - 84, - 39, - 143, - 63, - 0, - 125 - ]) - }, - "reds": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 240, - 254, - 224, - 210, - 252, - 187, - 161, - 252, - 146, - 114, - 251, - 106, - 74, - 239, - 59, - 44, - 203, - 24, - 29, - 165, - 15, - 21, - 103, - 0, - 13 - ]) - }, - "viridis": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x48, - 0x25, - 0x75, - 0x41, - 0x44, - 0x87, - 0x35, - 0x60, - 0x8d, - 0x2a, - 0x78, - 0x8e, - 0x21, - 0x91, - 0x8d, - 0x22, - 0xa8, - 0x84, - 0x43, - 0xbf, - 0x71, - 0x7a, - 0xd1, - 0x51, - 0xbc, - 0xdf, - 0x27 - ]) - }, - "inferno": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x17, - 0x0c, - 0x3b, - 0x42, - 0x0a, - 0x68, - 0x6b, - 0x17, - 0x6e, - 0x93, - 0x26, - 0x67, - 0xbb, - 0x37, - 0x55, - 0xdd, - 0x51, - 0x3a, - 0xf3, - 0x77, - 0x1a, - 0xfc, - 0xa5, - 0x0a, - 0xf6, - 0xd6, - 0x45 - ]) - }, - "magma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x15, - 0x0e, - 0x37, - 0x3b, - 0x0f, - 0x70, - 0x65, - 0x1a, - 0x80, - 0x8c, - 0x29, - 0x81, - 0xb6, - 0x37, - 0x7a, - 0xde, - 0x49, - 0x68, - 0xf7, - 0x6f, - 0x5c, - 0xfe, - 0x9f, - 0x6d, - 0xfe, - 0xce, - 0x91 - ]) - }, - "plasma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x42, - 0x03, - 0x9d, - 0x6a, - 0x00, - 0xa8, - 0x90, - 0x0d, - 0xa4, - 0xb1, - 0x2a, - 0x90, - 0xcb, - 0x47, - 0x79, - 0xe1, - 0x64, - 0x62, - 0xf2, - 0x83, - 0x4c, - 0xfc, - 0xa6, - 0x36, - 0xfc, - 0xce, - 0x25 - ]) - }, - "bluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 229, - 245, - 249, - 204, - 236, - 230, - 153, - 216, - 201, - 102, - 194, - 164, - 65, - 174, - 118, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "bluepurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 224, - 236, - 244, - 191, - 211, - 230, - 158, - 188, - 218, - 140, - 150, - 198, - 140, - 107, - 177, - 136, - 65, - 157, - 129, - 15, - 124, - 77, - 0, - 75 - ]) - }, - "greenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 240, - 224, - 243, - 219, - 204, - 235, - 197, - 168, - 221, - 181, - 123, - 204, - 196, - 78, - 179, - 211, - 43, - 140, - 190, - 8, - 104, - 172, - 8, - 64, - 129 - ]) - }, - "orangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 236, - 254, - 232, - 200, - 253, - 212, - 158, - 253, - 187, - 132, - 252, - 141, - 89, - 239, - 101, - 72, - 215, - 48, - 31, - 179, - 0, - 0, - 127, - 0, - 0 - ]) - }, - "purpleblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 231, - 242, - 208, - 209, - 230, - 166, - 189, - 219, - 116, - 169, - 207, - 54, - 144, - 192, - 5, - 112, - 176, - 4, - 90, - 141, - 2, - 56, - 88 - ]) - }, - "purplebluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 226, - 240, - 208, - 209, - 230, - 166, - 189, - 219, - 103, - 169, - 207, - 54, - 144, - 192, - 2, - 129, - 138, - 1, - 108, - 89, - 1, - 70, - 54 - ]) - }, - "purplered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 244, - 249, - 231, - 225, - 239, - 212, - 185, - 218, - 201, - 148, - 199, - 223, - 101, - 176, - 231, - 41, - 138, - 206, - 18, - 86, - 152, - 0, - 67, - 103, - 0, - 31 - ]) - }, - "redpurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 243, - 253, - 224, - 221, - 252, - 197, - 192, - 250, - 159, - 181, - 247, - 104, - 161, - 221, - 52, - 151, - 174, - 1, - 126, - 122, - 1, - 119, - 73, - 0, - 106 - ]) - }, - "yellowgreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 247, - 252, - 185, - 217, - 240, - 163, - 173, - 221, - 142, - 120, - 198, - 121, - 65, - 171, - 93, - 35, - 132, - 67, - 0, - 104, - 55, - 0, - 69, - 41 - ]) - }, - "yellowgreenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 217, - 237, - 248, - 177, - 199, - 233, - 180, - 127, - 205, - 187, - 65, - 182, - 196, - 29, - 145, - 192, - 34, - 94, - 168, - 37, - 52, - 148, - 8, - 29, - 88 - ]) - }, - "yelloworangebrown": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 255, - 247, - 188, - 254, - 227, - 145, - 254, - 196, - 79, - 254, - 153, - 41, - 236, - 112, - 20, - 204, - 76, - 2, - 153, - 52, - 4, - 102, - 37, - 6 - ]) - }, - "yelloworangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 204, - 255, - 237, - 160, - 254, - 217, - 118, - 254, - 178, - 76, - 253, - 141, - 60, - 252, - 78, - 42, - 227, - 26, - 28, - 189, - 0, - 38, - 128, - 0, - 38 - ]) - }, - "brownbluegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 84, - 48, - 5, - 140, - 81, - 10, - 191, - 129, - 45, - 223, - 194, - 125, - 246, - 232, - 195, - 245, - 245, - 245, - 199, - 234, - 229, - 128, - 205, - 193, - 53, - 151, - 143, - 1, - 102, - 94, - 0, - 60, - 48 - ]) - }, - "pinkyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 142, - 1, - 82, - 197, - 27, - 125, - 222, - 119, - 174, - 241, - 182, - 218, - 253, - 224, - 239, - 247, - 247, - 247, - 230, - 245, - 208, - 184, - 225, - 134, - 127, - 188, - 65, - 77, - 146, - 33, - 39, - 100, - 25 - ]) - }, - "purplegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 64, - 0, - 75, - 118, - 42, - 131, - 153, - 112, - 171, - 194, - 165, - 207, - 231, - 212, - 232, - 247, - 247, - 247, - 217, - 240, - 211, - 166, - 219, - 160, - 90, - 174, - 97, - 27, - 120, - 55, - 0, - 68, - 27 - ]) - }, - "purpleorange": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 127, - 59, - 8, - 179, - 88, - 6, - 224, - 130, - 20, - 253, - 184, - 99, - 254, - 224, - 182, - 247, - 247, - 247, - 216, - 218, - 235, - 178, - 171, - 210, - 128, - 115, - 172, - 84, - 39, - 136, - 45, - 0, - 75 - ]) - }, - "redblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 247, - 247, - 247, - 209, - 229, - 240, - 146, - 197, - 222, - 67, - 147, - 195, - 33, - 102, - 172, - 5, - 48, - 97 - ]) - }, - "redgrey": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 255, - 255, - 255, - 224, - 224, - 224, - 186, - 186, - 186, - 135, - 135, - 135, - 77, - 77, - 77, - 26, - 26, - 26 - ]) - }, - "redyellowblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 144, - 255, - 255, - 191, - 224, - 243, - 248, - 171, - 217, - 233, - 116, - 173, - 209, - 69, - 117, - 180, - 49, - 54, - 149 - ]) - }, - "redyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 217, - 239, - 139, - 166, - 217, - 106, - 102, - 189, - 99, - 26, - 152, - 80, - 0, - 104, - 55 - ]) - }, - "spectral": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 158, - 1, - 66, - 213, - 62, - 79, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 230, - 245, - 152, - 171, - 221, - 164, - 102, - 194, - 165, - 50, - 136, - 189, - 94, - 79, - 162 - ]) - }, - "accent": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 127, - 201, - 127, - 190, - 174, - 212, - 253, - 192, - 134, - 255, - 255, - 153, - 56, - 108, - 176, - 240, - 2, - 127, - 191, - 91, - 23, - 102, - 102, - 102 - ]) - }, - "dark2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 27, - 158, - 119, - 217, - 95, - 2, - 117, - 112, - 179, - 231, - 41, - 138, - 102, - 166, - 30, - 230, - 171, - 2, - 166, - 118, - 29, - 102, - 102, - 102 - ]) - }, - "paired": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 166, - 206, - 227, - 31, - 120, - 180, - 178, - 223, - 138, - 51, - 160, - 44, - 251, - 154, - 153, - 227, - 26, - 28, - 253, - 191, - 111, - 255, - 127, - 0, - 202, - 178, - 214, - 106, - 61, - 154, - 255, - 255, - 153, - 177, - 89, - 40 - ]) - }, - "pastel1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 251, - 180, - 174, - 179, - 205, - 227, - 204, - 235, - 197, - 222, - 203, - 228, - 254, - 217, - 166, - 255, - 255, - 204, - 229, - 216, - 189, - 253, - 218, - 236, - 242, - 242, - 242 - ]) - }, - "pastel2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 179, - 226, - 205, - 253, - 205, - 172, - 203, - 213, - 232, - 244, - 202, - 228, - 230, - 245, - 201, - 255, - 242, - 174, - 241, - 226, - 204, - 204, - 204, - 204 - ]) - }, - "set1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 228, - 26, - 28, - 55, - 126, - 184, - 77, - 175, - 74, - 152, - 78, - 163, - 255, - 127, - 0, - 255, - 255, - 51, - 166, - 86, - 40, - 247, - 129, - 191, - 153, - 153, - 153 - ]) - }, - "set2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 102, - 194, - 165, - 252, - 141, - 98, - 141, - 160, - 203, - 231, - 138, - 195, - 166, - 216, - 84, - 255, - 217, - 47, - 229, - 196, - 148, - 179, - 179, - 179 - ]) - }, - "set3": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 141, - 211, - 199, - 255, - 255, - 179, - 190, - 186, - 218, - 251, - 128, - 114, - 128, - 177, - 211, - 253, - 180, - 98, - 179, - 222, - 105, - 252, - 205, - 229, - 217, - 217, - 217, - 188, - 128, - 189, - 204, - 235, - 197, - 255, - 237, - 111 - ]) - } - }; + if (element2) { + return element2; } -} -class PaletteBase { - get colors() { - return this._colors; + } + function focusActiveElement(element2, activeElementInfo) { + element2.focus(); + element2.scrollTop = activeElementInfo.scrollTop; + const input = element2; + if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) { + input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); } - set colors(value) { - if (this._colors != value) { - this._colors = value; - this._changed = true; - } + } + function setActiveElement(activeElementInfo, container) { + if (activeElementInfo) { + const element2 = findElementByChildPositions(activeElementInfo.childPositions, container); + if (element2) { + focusActiveElement(element2, activeElementInfo); + } } - constructor(){ - this._colors = null; + } + function getActiveElementInfo(container) { + let element2 = document.activeElement; + const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element2; + const activeElementInfo = { + childPositions: [], + scrollTop, + selectionDirection, + selectionEnd, + selectionStart + }; + while (element2 && element2 !== document.body && element2 !== container) { + activeElementInfo.childPositions.unshift(getChildPosition(element2)); + element2 = element2.parentElement; + } + if ((element2 === document.body || element2 === container) && activeElementInfo.childPositions.length) + return activeElementInfo; + } + function getChildPosition(element2) { + let childPosition = 0; + while (element2 = element2.previousElementSibling) + childPosition++; + return childPosition; + } + const KeyCodes$2 = { + ENTER: "Enter" + }; + const Table$1 = (props) => { + return createElement( + "table", + { className: props.className }, + props.children, + props.rows.map((row, i) => createElement("tr", { className: props.rowClassName || "", onClick: (e) => props.onRowClick && props.onRowClick(e, i), tabIndex: props.onRowClick ? 0 : -1, onKeyUp: (e) => { + if (e.key === KeyCodes$2.ENTER && props.onRowClick) { + props.onRowClick(e, i); + } + } }, row.cells.map((cell2, i2) => createElement("td", { className: cell2.className || "", title: cell2.title || "" }, cell2.content)))) + ); + }; + const controls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Table: Table$1 + }, Symbol.toStringTag, { value: "Module" })); + var EPSILON$3 = 1e-6; + var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + function setMatrixArrayType(type2) { + ARRAY_TYPE = type2; + } + function create$8() { + var out = new ARRAY_TYPE(9); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; } - copyFrom(palette) { - if (palette.colors) this.colors = new Uint8Array(palette.colors); - else this.colors = null; - } - update() {} -} -class Palette extends PaletteBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f5tIG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -parcelHelpers.export(exports, "Controller", ()=>Controller); -var _mainJs = require("../main.js"); -var _objJs = require("../helpers/obj.js"); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class ControllerVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(controller){ - this.controller = controller; - } -} -class Controller { - get isInitialized() { - return this._isInitialized; + out[0] = 1; + out[4] = 1; + out[8] = 1; + return out; + } + function fromMat4(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[4]; + out[4] = a2[5]; + out[5] = a2[6]; + out[6] = a2[8]; + out[7] = a2[9]; + out[8] = a2[10]; + return out; + } + function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { + var out = new ARRAY_TYPE(9); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m10; + out[4] = m11; + out[5] = m12; + out[6] = m20; + out[7] = m21; + out[8] = m22; + return out; + } + function fromQuat$1(out, q) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z2 * x22; + var zy = z2 * y22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + out[0] = 1 - yy - zz; + out[3] = yx - wz; + out[6] = zx + wy; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; + return out; + } + function create$7() { + var out = new ARRAY_TYPE(16); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; } - get mMatrix() { - return this._mMatrix; + out[0] = 1; + out[5] = 1; + out[10] = 1; + out[15] = 1; + return out; + } + function copy$7(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + out[4] = a2[4]; + out[5] = a2[5]; + out[6] = a2[6]; + out[7] = a2[7]; + out[8] = a2[8]; + out[9] = a2[9]; + out[10] = a2[10]; + out[11] = a2[11]; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; + return out; + } + function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + var out = new ARRAY_TYPE(16); + out[0] = m00; + out[1] = m01; + out[2] = m02; + out[3] = m03; + out[4] = m10; + out[5] = m11; + out[6] = m12; + out[7] = m13; + out[8] = m20; + out[9] = m21; + out[10] = m22; + out[11] = m23; + out[12] = m30; + out[13] = m31; + out[14] = m32; + out[15] = m33; + return out; + } + function identity$8(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + function invert$1(out, a2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; } - get indexCount() { - return this._indexCount; + det = 1 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + function multiply$2(out, a2, b2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3]; + out[0] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[4]; + b1 = b2[5]; + b22 = b2[6]; + b3 = b2[7]; + out[4] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[8]; + b1 = b2[9]; + b22 = b2[10]; + b3 = b2[11]; + out[8] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[12]; + b1 = b2[13]; + b22 = b2[14]; + b3 = b2[15]; + out[12] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + return out; + } + function translate$2(out, a2, v) { + var x2 = v[0], y2 = v[1], z2 = v[2]; + var a00, a01, a02, a03; + var a10, a11, a12, a13; + var a20, a21, a22, a23; + if (a2 === out) { + out[12] = a2[0] * x2 + a2[4] * y2 + a2[8] * z2 + a2[12]; + out[13] = a2[1] * x2 + a2[5] * y2 + a2[9] * z2 + a2[13]; + out[14] = a2[2] * x2 + a2[6] * y2 + a2[10] * z2 + a2[14]; + out[15] = a2[3] * x2 + a2[7] * y2 + a2[11] * z2 + a2[15]; + } else { + a00 = a2[0]; + a01 = a2[1]; + a02 = a2[2]; + a03 = a2[3]; + a10 = a2[4]; + a11 = a2[5]; + a12 = a2[6]; + a13 = a2[7]; + a20 = a2[8]; + a21 = a2[9]; + a22 = a2[10]; + a23 = a2[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x2 + a10 * y2 + a20 * z2 + a2[12]; + out[13] = a01 * x2 + a11 * y2 + a21 * z2 + a2[13]; + out[14] = a02 * x2 + a12 * y2 + a22 * z2 + a2[14]; + out[15] = a03 * x2 + a13 * y2 + a23 * z2 + a2[15]; } - get vertices() { - return this._vertices; + return out; + } + function scale$6(out, a2, v) { + var x2 = v[0], y2 = v[1], z2 = v[2]; + out[0] = a2[0] * x2; + out[1] = a2[1] * x2; + out[2] = a2[2] * x2; + out[3] = a2[3] * x2; + out[4] = a2[4] * y2; + out[5] = a2[5] * y2; + out[6] = a2[6] * y2; + out[7] = a2[7] * y2; + out[8] = a2[8] * z2; + out[9] = a2[9] * z2; + out[10] = a2[10] * z2; + out[11] = a2[11] * z2; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; + return out; + } + function fromScaling(out, v) { + out[0] = v[0]; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = v[1]; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = v[2]; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + function fromRotationTranslationScale(out, q, v, s2) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z22; + var yy = y2 * y22; + var yz = y2 * z22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + var sx = s2[0]; + var sy = s2[1]; + var sz2 = s2[2]; + out[0] = (1 - (yy + zz)) * sx; + out[1] = (xy + wz) * sx; + out[2] = (xz - wy) * sx; + out[3] = 0; + out[4] = (xy - wz) * sy; + out[5] = (1 - (xx + zz)) * sy; + out[6] = (yz + wx) * sy; + out[7] = 0; + out[8] = (xz + wy) * sz2; + out[9] = (yz - wx) * sz2; + out[10] = (1 - (xx + yy)) * sz2; + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + function fromRotationTranslationScaleOrigin(out, q, v, s2, o) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z22; + var yy = y2 * y22; + var yz = y2 * z22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + var sx = s2[0]; + var sy = s2[1]; + var sz2 = s2[2]; + var ox = o[0]; + var oy = o[1]; + var oz = o[2]; + var out0 = (1 - (yy + zz)) * sx; + var out1 = (xy + wz) * sx; + var out2 = (xz - wy) * sx; + var out4 = (xy - wz) * sy; + var out5 = (1 - (xx + zz)) * sy; + var out6 = (yz + wx) * sy; + var out8 = (xz + wy) * sz2; + var out9 = (yz - wx) * sz2; + var out10 = (1 - (xx + yy)) * sz2; + out[0] = out0; + out[1] = out1; + out[2] = out2; + out[3] = 0; + out[4] = out4; + out[5] = out5; + out[6] = out6; + out[7] = 0; + out[8] = out8; + out[9] = out9; + out[10] = out10; + out[11] = 0; + out[12] = v[0] + ox - (out0 * ox + out4 * oy + out8 * oz); + out[13] = v[1] + oy - (out1 * ox + out5 * oy + out9 * oz); + out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); + out[15] = 1; + return out; + } + function fromQuat(out, q) { + var x2 = q[0], y2 = q[1], z2 = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; + var z22 = z2 + z2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z2 * x22; + var zy = z2 * y22; + var zz = z2 * z22; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z22; + out[0] = 1 - yy - zz; + out[1] = yx + wz; + out[2] = zx - wy; + out[3] = 0; + out[4] = yx - wz; + out[5] = 1 - xx - zz; + out[6] = zy + wx; + out[7] = 0; + out[8] = zx + wy; + out[9] = zy - wx; + out[10] = 1 - xx - yy; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; + } + function frustum(out, left, right, bottom, top, near, far) { + var rl = 1 / (right - left); + var tb = 1 / (top - bottom); + var nf = 1 / (near - far); + out[0] = near * 2 * rl; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = near * 2 * tb; + out[6] = 0; + out[7] = 0; + out[8] = (right + left) * rl; + out[9] = (top + bottom) * tb; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = far * near * 2 * nf; + out[15] = 0; + return out; + } + function perspectiveNO(out, fovy, aspect, near, far) { + var f = 1 / Math.tan(fovy / 2); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[15] = 0; + if (far != null && far !== Infinity) { + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; + } else { + out[10] = -1; + out[14] = -2 * near; } - get indices() { - return this._indices; + return out; + } + var perspective = perspectiveNO; + function lookAt(out, eye, center, up) { + var x02, x12, x2, y02, y12, y2, z02, z1, z2, len2; + var eyex = eye[0]; + var eyey = eye[1]; + var eyez = eye[2]; + var upx = up[0]; + var upy = up[1]; + var upz = up[2]; + var centerx = center[0]; + var centery = center[1]; + var centerz = center[2]; + if (Math.abs(eyex - centerx) < EPSILON$3 && Math.abs(eyey - centery) < EPSILON$3 && Math.abs(eyez - centerz) < EPSILON$3) { + return identity$8(out); } - get texture() { - return this._texture; + z02 = eyex - centerx; + z1 = eyey - centery; + z2 = eyez - centerz; + len2 = 1 / Math.sqrt(z02 * z02 + z1 * z1 + z2 * z2); + z02 *= len2; + z1 *= len2; + z2 *= len2; + x02 = upy * z2 - upz * z1; + x12 = upz * z02 - upx * z2; + x2 = upx * z1 - upy * z02; + len2 = Math.sqrt(x02 * x02 + x12 * x12 + x2 * x2); + if (!len2) { + x02 = 0; + x12 = 0; + x2 = 0; + } else { + len2 = 1 / len2; + x02 *= len2; + x12 *= len2; + x2 *= len2; + } + y02 = z1 * x2 - z2 * x12; + y12 = z2 * x02 - z02 * x2; + y2 = z02 * x12 - z1 * x02; + len2 = Math.sqrt(y02 * y02 + y12 * y12 + y2 * y2); + if (!len2) { + y02 = 0; + y12 = 0; + y2 = 0; + } else { + len2 = 1 / len2; + y02 *= len2; + y12 *= len2; + y2 *= len2; + } + out[0] = x02; + out[1] = y02; + out[2] = z02; + out[3] = 0; + out[4] = x12; + out[5] = y12; + out[6] = z1; + out[7] = 0; + out[8] = x2; + out[9] = y2; + out[10] = z2; + out[11] = 0; + out[12] = -(x02 * eyex + x12 * eyey + x2 * eyez); + out[13] = -(y02 * eyex + y12 * eyey + y2 * eyez); + out[14] = -(z02 * eyex + z1 * eyey + z2 * eyez); + out[15] = 1; + return out; + } + var mul = multiply$2; + function create$6() { + var out = new ARRAY_TYPE(3); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; } - get rayMMatrix() { - return this._rayMMatrix; + return out; + } + function clone$4(a2) { + var out = new ARRAY_TYPE(3); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function length$1(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2); + } + function fromValues$3(x2, y2, z2) { + var out = new ARRAY_TYPE(3); + out[0] = x2; + out[1] = y2; + out[2] = z2; + return out; + } + function copy$6(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function set$8(out, x2, y2, z2) { + out[0] = x2; + out[1] = y2; + out[2] = z2; + return out; + } + function add$4(out, a2, b2) { + out[0] = a2[0] + b2[0]; + out[1] = a2[1] + b2[1]; + out[2] = a2[2] + b2[2]; + return out; + } + function subtract(out, a2, b2) { + out[0] = a2[0] - b2[0]; + out[1] = a2[1] - b2[1]; + out[2] = a2[2] - b2[2]; + return out; + } + function multiply$1(out, a2, b2) { + out[0] = a2[0] * b2[0]; + out[1] = a2[1] * b2[1]; + out[2] = a2[2] * b2[2]; + return out; + } + function min$3(out, a2, b2) { + out[0] = Math.min(a2[0], b2[0]); + out[1] = Math.min(a2[1], b2[1]); + out[2] = Math.min(a2[2], b2[2]); + return out; + } + function max$3(out, a2, b2) { + out[0] = Math.max(a2[0], b2[0]); + out[1] = Math.max(a2[1], b2[1]); + out[2] = Math.max(a2[2], b2[2]); + return out; + } + function scale$5(out, a2, b2) { + out[0] = a2[0] * b2; + out[1] = a2[1] * b2; + out[2] = a2[2] * b2; + return out; + } + function scaleAndAdd(out, a2, b2, scale2) { + out[0] = a2[0] + b2[0] * scale2; + out[1] = a2[1] + b2[1] * scale2; + out[2] = a2[2] + b2[2] * scale2; + return out; + } + function distance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z2 = b2[2] - a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2); + } + function squaredDistance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z2 = b2[2] - a2[2]; + return x2 * x2 + y2 * y2 + z2 * z2; + } + function squaredLength(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + return x2 * x2 + y2 * y2 + z2 * z2; + } + function negate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + return out; + } + function normalize$5(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + var len2 = x2 * x2 + y2 * y2 + z2 * z2; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = a2[0] * len2; + out[1] = a2[1] * len2; + out[2] = a2[2] * len2; + return out; + } + function dot$1(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cross$1(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2]; + var bx = b2[0], by = b2[1], bz = b2[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + function lerp$1(out, a2, b2, t) { + var ax = a2[0]; + var ay = a2[1]; + var az = a2[2]; + out[0] = ax + t * (b2[0] - ax); + out[1] = ay + t * (b2[1] - ay); + out[2] = az + t * (b2[2] - az); + return out; + } + function transformMat4$2(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z2 = a2[2]; + var w2 = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15]; + w2 = w2 || 1; + out[0] = (m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12]) / w2; + out[1] = (m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13]) / w2; + out[2] = (m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14]) / w2; + return out; + } + function transformMat3(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z2 = a2[2]; + out[0] = x2 * m2[0] + y2 * m2[3] + z2 * m2[6]; + out[1] = x2 * m2[1] + y2 * m2[4] + z2 * m2[7]; + out[2] = x2 * m2[2] + y2 * m2[5] + z2 * m2[8]; + return out; + } + function transformQuat(out, a2, q) { + var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; + var vx = a2[0], vy = a2[1], vz = a2[2]; + var tx2 = qy * vz - qz * vy; + var ty2 = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + tx2 = tx2 + tx2; + ty2 = ty2 + ty2; + tz = tz + tz; + out[0] = vx + qw * tx2 + qy * tz - qz * ty2; + out[1] = vy + qw * ty2 + qz * tx2 - qx * tz; + out[2] = vz + qw * tz + qx * ty2 - qy * tx2; + return out; + } + function exactEquals$1(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2]; + } + function equals$2(a2, b2) { + var a0 = a2[0], a1 = a2[1], a22 = a2[2]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2]; + return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b22) <= EPSILON$3 * Math.max(1, Math.abs(a22), Math.abs(b22)); + } + var len = length$1; + (function() { + var vec2 = create$6(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 3; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + } + return a2; + }; + })(); + function create$5() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; } - get rayIndexCount() { - return this._rayIndexCount; + return out; + } + function clone$3(a2) { + var out = new ARRAY_TYPE(4); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + return out; + } + function fromValues$2(x2, y2, z2, w2) { + var out = new ARRAY_TYPE(4); + out[0] = x2; + out[1] = y2; + out[2] = z2; + out[3] = w2; + return out; + } + function copy$5(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + return out; + } + function set$7(out, x2, y2, z2, w2) { + out[0] = x2; + out[1] = y2; + out[2] = z2; + out[3] = w2; + return out; + } + function normalize$4(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z2 = a2[2]; + var w2 = a2[3]; + var len2 = x2 * x2 + y2 * y2 + z2 * z2 + w2 * w2; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = x2 * len2; + out[1] = y2 * len2; + out[2] = z2 * len2; + out[3] = w2 * len2; + return out; + } + function dot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2] + a2[3] * b2[3]; + } + function transformMat4$1(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z2 = a2[2], w2 = a2[3]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[8] * z2 + m2[12] * w2; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[9] * z2 + m2[13] * w2; + out[2] = m2[2] * x2 + m2[6] * y2 + m2[10] * z2 + m2[14] * w2; + out[3] = m2[3] * x2 + m2[7] * y2 + m2[11] * z2 + m2[15] * w2; + return out; + } + function exactEquals(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2] && a2[3] === b2[3]; + } + (function() { + var vec2 = create$5(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 4; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + vec2[3] = a2[i + 3]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + a2[i + 3] = vec2[3]; + } + return a2; + }; + })(); + function create$4() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; } - get rayVertices() { - return this._rayVertices; + out[3] = 1; + return out; + } + function setAxisAngle(out, axis, rad) { + rad = rad * 0.5; + var s2 = Math.sin(rad); + out[0] = s2 * axis[0]; + out[1] = s2 * axis[1]; + out[2] = s2 * axis[2]; + out[3] = Math.cos(rad); + return out; + } + function multiply(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; + out[0] = ax * bw + aw * bx + ay * bz - az * by; + out[1] = ay * bw + aw * by + az * bx - ax * bz; + out[2] = az * bw + aw * bz + ax * by - ay * bx; + out[3] = aw * bw - ax * bx - ay * by - az * bz; + return out; + } + function rotateX(out, a2, rad) { + rad *= 0.5; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = Math.sin(rad), bw = Math.cos(rad); + out[0] = ax * bw + aw * bx; + out[1] = ay * bw + az * bx; + out[2] = az * bw - ay * bx; + out[3] = aw * bw - ax * bx; + return out; + } + function rotateY(out, a2, rad) { + rad *= 0.5; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var by = Math.sin(rad), bw = Math.cos(rad); + out[0] = ax * bw - az * by; + out[1] = ay * bw + aw * by; + out[2] = az * bw + ax * by; + out[3] = aw * bw - ay * by; + return out; + } + function slerp(out, a2, b2, t) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; + var omega, cosom, sinom, scale0, scale1; + cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > EPSILON$3) { + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; + } else { + scale0 = 1 - t; + scale1 = t; } - get rayIndices() { - return this._rayIndices; + out[0] = scale0 * ax + scale1 * bx; + out[1] = scale0 * ay + scale1 * by; + out[2] = scale0 * az + scale1 * bz; + out[3] = scale0 * aw + scale1 * bw; + return out; + } + function conjugate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + out[3] = a2[3]; + return out; + } + function fromMat3(out, m2) { + var fTrace = m2[0] + m2[4] + m2[8]; + var fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m2[5] - m2[7]) * fRoot; + out[1] = (m2[6] - m2[2]) * fRoot; + out[2] = (m2[1] - m2[3]) * fRoot; + } else { + var i = 0; + if (m2[4] > m2[0]) i = 1; + if (m2[8] > m2[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m2[i * 3 + i] - m2[j * 3 + j] - m2[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m2[j * 3 + k] - m2[k * 3 + j]) * fRoot; + out[j] = (m2[j * 3 + i] + m2[i * 3 + j]) * fRoot; + out[k] = (m2[k * 3 + i] + m2[i * 3 + k]) * fRoot; } - constructor(core, options){ - this._cubeObj = `o Cube -v 1.000000 -1.000000 -1.000000 -v 1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 -0.999999 -v 0.999999 1.000000 1.000001 -v -1.000000 1.000000 1.000000 -v -1.000000 1.000000 -1.000000 -vt 1.000000 0.333333 -vt 1.000000 0.666667 -vt 0.666667 0.666667 -vt 0.666667 0.333333 -vt 0.666667 0.000000 -vt 0.000000 0.333333 -vt 0.000000 0.000000 -vt 0.333333 0.000000 -vt 0.333333 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.666667 -vt 0.333333 0.333333 -vt 0.333333 0.666667 -vt 1.000000 0.000000 -vn 0.000000 -1.000000 0.000000 -vn 0.000000 1.000000 0.000000 -vn 1.000000 0.000000 0.000000 -vn -0.000000 0.000000 1.000000 -vn -1.000000 -0.000000 -0.000000 -vn 0.000000 0.000000 -1.000000 -s off -f 2/1/1 3/2/1 4/3/1 -f 8/1/2 7/4/2 6/5/2 -f 5/6/3 6/7/3 2/8/3 -f 6/8/4 7/5/4 3/4/4 -f 3/9/5 7/10/5 8/11/5 -f 1/12/6 4/13/6 8/11/6 -f 1/4/1 2/1/1 4/3/1 -f 5/14/2 8/1/2 6/5/2 -f 1/12/3 5/6/3 2/8/3 -f 2/12/4 6/8/4 3/4/4 -f 4/13/5 3/9/5 8/11/5 -f 5/6/6 1/12/6 8/11/6`; - this._core = core; - this._obj = options.obj; - this._texture = options.texture || new ImageData(new Uint8ClampedArray([ - 0, - 0, - 0, - 255 - ]), 1, 1); + return out; + } + var clone$2 = clone$3; + var fromValues$1 = fromValues$2; + var copy$4 = copy$5; + var set$6 = set$7; + var normalize$3 = normalize$4; + function equals$1(a2, b2) { + return Math.abs(dot(a2, b2)) >= 1 - EPSILON$3; + } + var rotationTo = (function() { + var tmpvec3 = create$6(); + var xUnitVec3 = fromValues$3(1, 0, 0); + var yUnitVec3 = fromValues$3(0, 1, 0); + return function(out, a2, b2) { + var dot2 = dot$1(a2, b2); + if (dot2 < -0.999999) { + cross$1(tmpvec3, xUnitVec3, a2); + if (len(tmpvec3) < 1e-6) cross$1(tmpvec3, yUnitVec3, a2); + normalize$5(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); + return out; + } else if (dot2 > 0.999999) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 1; + return out; + } else { + cross$1(tmpvec3, a2, b2); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot2; + return normalize$3(out, out); + } + }; + })(); + (function() { + var temp1 = create$4(); + var temp2 = create$4(); + return function(out, a2, b2, c2, d2, t) { + slerp(temp1, a2, d2, t); + slerp(temp2, b2, c2, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + })(); + (function() { + var matr = create$8(); + return function(out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize$3(out, fromMat3(out, matr)); + }; + })(); + function create$3() { + var out = new ARRAY_TYPE(2); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; } - initialize() { - const _vec3 = (0, _glMatrix.vec3).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - const objMesh = new (0, _objJs.ObjHelper)(this._core).read(this._obj || this._cubeObj); - if (!this._obj) { - this.useRayPose = true; - const modelThickness = 0.02; - const modelLength = 0.1; - (0, _glMatrix.vec3).set(_vec3, modelThickness, modelThickness, modelLength); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, 1); - (0, _glMatrix.mat4).translate(this._mMatrix, this._mMatrix, _vec3); - } - this._vertices = objMesh.vertices; - this._indices = objMesh.indices; - this._indexCount = objMesh.indexCount; - this._rayMMatrix = (0, _glMatrix.mat4).create(); - const rayVertices = (0, _cubeJs.Cube).POSITIONS; - this._rayVertices = new ArrayBuffer((0, _vertexJs.PositionColorVertex).SIZE_BYTES * rayVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const rayVerticesView = new DataView(this._rayVertices); - const rayIndices = (0, _cubeJs.Cube).INDICES; - this._rayIndices = new Uint16Array(rayIndices); - const rayVertexCount = rayVertices.length / (0, _vertexJs.PositionVertex).SIZE; - this._rayIndexCount = rayIndices.length; - for(let i = 0; i < rayVertexCount; i++){ - (0, _glMatrix.vec3).set(_vec3, rayVertices[i * (0, _vertexJs.PositionVertex).SIZE], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _vertexJs.PositionColorVertex).setPosition(rayVerticesView, i, _vec3); - (0, _vertexJs.PositionColorVertex).setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); - } - const rayThickness = 0.0025; - const rayLength = 10; - (0, _glMatrix.vec3).set(_vec3, rayThickness, rayThickness, rayLength); - (0, _glMatrix.mat4).fromScaling(this._rayMMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, -0.5); - (0, _glMatrix.mat4).translate(this._rayMMatrix, this._rayMMatrix, _vec3); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "controller initialized"); - } - update(elapsedTime) {} -} - -},{"../main.js":"f421K","../helpers/obj.js":"kBT24","gl-matrix":"5x28d","../meshes/cube.js":"79I5N","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBT24":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ObjMesh", ()=>ObjMesh); -parcelHelpers.export(exports, "ObjHelper", ()=>ObjHelper); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class ObjMesh { -} -class ObjHelper { - constructor(core){ - this._core = core; - } - read(data) { - const start = window.performance.now(); - const indices = []; - const positions = []; - const normals = []; - const texCoords = []; - const meshes = []; - const indexOffsets = []; - const indexCounts = []; - const faceLookup = {}; - const lines = data.split("\n"); - let faceCount = 0; - for(let i = 0; i < lines.length; i++){ - const parts = lines[i].trim().split(" "); - if (parts.length > 0) switch(parts[0]){ - case "o": - meshes.push(parts[1]); - indexOffsets.push(indices.length); - break; - case "v": - positions.push(parseFloat(parts[1])); - positions.push(parseFloat(parts[2])); - positions.push(parseFloat(parts[3])); - break; - case "vt": - texCoords.push(parseFloat(parts[1])); - texCoords.push(parseFloat(parts[2])); - break; - case "vn": - normals.push(parseFloat(parts[1])); - normals.push(parseFloat(parts[2])); - normals.push(parseFloat(parts[3])); - break; - case "f": - for(let i = 0; i < parts.length - 1; i++){ - const part = parts[i + 1]; - if (faceLookup[part] == undefined) faceLookup[part] = faceCount++; - indices.push(faceLookup[part]); - } - break; - case "usemtl": - case "mtllib": - default: - break; - } - } - for(let i = 0; i < meshes.length - 1; i++)indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); - indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * Object.keys(faceLookup).length); - const dataView = new DataView(vertices); - let minX = Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let minZ = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - let maxZ = -Number.MAX_VALUE; - const faces = Object.keys(faceLookup); - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - let hasTexCoords, hasNormals; - if (faces.length > 0) { - const faceParts = faces[0].split("/"); - hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); - hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); - } - for(let i = 0; i < faces.length; i++){ - const faceParts = faces[i].split("/"); - let index = (parseInt(faceParts[0]) - 1) * 3; - const x = positions[index]; - const y = positions[index + 1]; - const z = positions[index + 2]; - (0, _glMatrix.vec3).set(_vec3, x, y, z); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(dataView, i, _vec3); - minX = Math.min(x, minX); - minY = Math.min(y, minY); - minZ = Math.min(z, minZ); - maxX = Math.max(x, maxX); - maxY = Math.max(y, maxY); - maxZ = Math.max(z, maxZ); - if (hasNormals) { - index = (parseInt(faceParts[2]) - 1) * 3; - (0, _glMatrix.vec3).set(_vec3, normals[index], normals[index + 1], normals[index + 2]); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(dataView, i, _vec3); - } - if (hasTexCoords) { - index = (parseInt(faceParts[1]) - 1) * 2; - (0, _glMatrix.vec2).set(_vec2, texCoords[index], texCoords[index + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(dataView, i, _vec2); - } - } - const originX = (minX + maxX) / 2; - const originY = (minY + maxY) / 2; - const originZ = (minZ + maxZ) / 2; - const objMesh = new ObjMesh(); - objMesh.vertices = vertices; - objMesh.indices = new Uint16Array(indices); - objMesh.meshes = meshes; - objMesh.indexOffsets = indexOffsets; - objMesh.indexCounts = indexCounts; - objMesh.indexCount = indices.length; - objMesh.minX = minX; - objMesh.minY = minY; - objMesh.minZ = minZ; - objMesh.maxX = maxX; - objMesh.maxY = maxY; - objMesh.maxZ = maxZ; - objMesh.originX = originX; - objMesh.originY = originY; - objMesh.originZ = originZ; - this._core.log.write((0, _mainJs.LogLevel).info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); - return objMesh; - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4J2YE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PositionVertex", ()=>PositionVertex); -parcelHelpers.export(exports, "PositionColorVertex", ()=>PositionColorVertex); -parcelHelpers.export(exports, "PositionTextureVertex", ()=>PositionTextureVertex); -parcelHelpers.export(exports, "PositionTexturePickVertex", ()=>PositionTexturePickVertex); -parcelHelpers.export(exports, "PositionNormalVertex", ()=>PositionNormalVertex); -parcelHelpers.export(exports, "PositionNormalColorVertex", ()=>PositionNormalColorVertex); -parcelHelpers.export(exports, "PositionNormalTextureVertex", ()=>PositionNormalTextureVertex); -parcelHelpers.export(exports, "PickGridVertex", ()=>PickGridVertex); -parcelHelpers.export(exports, "UnitVertex", ()=>UnitVertex); -var _glMatrix = require("gl-matrix"); -class PositionVertex { - static getPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - (0, _glMatrix.vec3).set(value, buffer[offset], buffer[offset + 1], buffer[offset + 2]); - } - static setPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - buffer[offset] = value[0]; - buffer[offset + 1] = value[1]; - buffer[offset + 2] = value[2]; - } -} -PositionVertex.SIZE = 3; -PositionVertex.SIZE_BYTES = 12; -class PositionColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionColorVertex.SIZE_BYTES = 16; -PositionColorVertex.POSITION_OFFSET_BYTES = 0; -PositionColorVertex.COLOR_OFFSET_BYTES = 12; -class PositionTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionTextureVertex.SIZE_BYTES = 16; -PositionTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; -class PositionTexturePickVertex { - static getPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } -} -PositionTexturePickVertex.SIZE_BYTES = 20; -PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; -PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; -PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; -class PositionNormalVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } -} -PositionNormalVertex.SIZE_BYTES = 16; -PositionNormalVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalVertex.NORMAL_OFFSET_BYTES = 12; -class PositionNormalColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionNormalColorVertex.SIZE_BYTES = 20; -PositionNormalColorVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalColorVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalColorVertex.COLOR_OFFSET_BYTES = 16; -class PositionNormalTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionNormalTextureVertex.SIZE_BYTES = 20; -PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; -class PickGridVertex { - static getTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF, bufferView.getUint16(offset + 4, true) / 0xFFFF, bufferView.getUint16(offset + 6, true) / 0xFFFF); - } - static setBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - bufferView.setUint16(offset + 4, value[2] * 0xFFFF, true); - bufferView.setUint16(offset + 6, value[3] * 0xFFFF, true); - } -} -PickGridVertex.SIZE_BYTES = 32; -PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; -PickGridVertex.NORMAL_OFFSET_BYTES = 12; -PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; -PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; -PickGridVertex.BOUNDS_OFFSET_BYTES = 24; -class UnitVertex { - static getIdHover(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, true); - } - static setIdHover(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, value, true); + return out; + } + function clone$1(a2) { + var out = new ARRAY_TYPE(2); + out[0] = a2[0]; + out[1] = a2[1]; + return out; + } + function fromValues(x2, y2) { + var out = new ARRAY_TYPE(2); + out[0] = x2; + out[1] = y2; + return out; + } + function copy$3(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + return out; + } + function set$5(out, x2, y2) { + out[0] = x2; + out[1] = y2; + return out; + } + function transformMat4(out, a2, m2) { + var x2 = a2[0]; + var y2 = a2[1]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[12]; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[13]; + return out; + } + function equals(a2, b2) { + var a0 = a2[0], a1 = a2[1]; + var b0 = b2[0], b1 = b2[1]; + return Math.abs(a0 - b0) <= EPSILON$3 * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON$3 * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + (function() { + var vec2 = create$3(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 2; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + } + return a2; + }; + })(); + let Constants$1 = class Constants { + }; + Constants$1.TWO_PI = 6.283185307179586; + Constants$1.PI = 3.141592653589793; + Constants$1.PI_OVER_TWO = 1.5707963267948966; + Constants$1.PI_OVER_THREE = 1.0471975511965976; + Constants$1.PI_OVER_FOUR = 0.7853981633974483; + Constants$1.PI_OVER_SIX = 0.5235987755982988; + Constants$1.LOG_2 = 0.6931471805599453; + Constants$1.RADIANS_PER_DEGREE = 0.017453292519943295; + Constants$1.DEGREES_PER_RADIAN = 57.29577951308232; + Constants$1.ROOT_TWO = 1.4142135623730951; + Constants$1.ROOT_TWO_OVER_TWO = 0.7071067811865476; + Constants$1.ROOT_THREE = 1.7320508075688772; + Constants$1.ROOT_THREE_OVER_TWO = 0.8660254037844386; + Constants$1.ROOT_THREE_OVER_THREE = 0.5773502691896257; + Constants$1.VECTOR2_ZERO = fromValues(0, 0); + Constants$1.VECTOR2_ONE = fromValues(1, 1); + Constants$1.VECTOR2_UNITX = fromValues(1, 0); + Constants$1.VECTOR2_UNITY = fromValues(0, 1); + Constants$1.VECTOR3_ZERO = fromValues$3(0, 0, 0); + Constants$1.VECTOR3_ONE = fromValues$3(1, 1, 1); + Constants$1.VECTOR3_UNITX = fromValues$3(1, 0, 0); + Constants$1.VECTOR3_UNITY = fromValues$3(0, 1, 0); + Constants$1.VECTOR3_UNITZ = fromValues$3(0, 0, 1); + Constants$1.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); + Constants$1.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); + Constants$1.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); + Constants$1.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); + Constants$1.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); + Constants$1.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); + Constants$1.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); + Constants$1.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); + Constants$1.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); + Constants$1.MAT3_IDENTITY = create$8(); + Constants$1.MAT4_IDENTITY = create$7(); + Constants$1.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + Constants$1.QUAT_IDENTITY = create$4(); + Constants$1.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants$1.ROOT_TWO_OVER_TWO, 0, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants$1.ROOT_TWO_OVER_TWO, 0, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO); + Constants$1.MILLISECONDS_PER_DAY = 864e5; + class MathHelper { + static simpleLinearRegression(points2) { + const n = points2.length; + let sumX = 0; + let sumY = 0; + let sumXY = 0; + let sumXX = 0; + for (let i = 0; i < n; i++) { + sumX += points2[i].x; + sumY += points2[i].y; + sumXY += points2[i].x * points2[i].y; + sumXX += points2[i].x * points2[i].x; + } + const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); + const yIntercept = (sumY - slope * sumX) / n; + return { slope, yIntercept }; } - static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); + static clamp(value2, min2, max2) { + return Math.max(Math.min(value2, max2), min2); } - static getTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + static lerp(value1, value2, amount) { + return value1 + (value2 - value1) * amount; } - static setTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + static normalize(value2, min2, max2, from = 0, to = 1) { + return max2 - min2 == 0 ? 0 : Math.max(Math.min((to - from) * (value2 - min2) / (max2 - min2) + from, to), from); } - static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + static splitExponent(value2, result) { + let exponent2 = Math.round(Math.log10(Math.abs(value2))); + let coefficient = value2 / Math.pow(10, exponent2); + if (coefficient < 1) { + coefficient *= 10; + exponent2--; + } + result[0] = coefficient; + result[1] = exponent2; } - static getColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF); + static combineExponent(mantissa, exponent2) { + return mantissa * Math.pow(10, exponent2); } - static setColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); + static isPowerOf2(value2) { + return (value2 & value2 - 1) == 0; } - static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; - toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); - toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + } + class PseudoRandom { + constructor(seed) { + this._seed = seed % 2147483647; + if (this._seed <= 0) + this._seed += 2147483646; } - static getOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true)); + next() { + return this._seed = this._seed * 16807 % 2147483647; } - static setOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); + nextFloat() { + return (this.next() - 1) / 2147483646; } - static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + nextInteger(min2, max2) { + return Math.floor(this.nextFloat() * (max2 - min2 + 1) + min2); } - static getScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + } + class AngleHelper { + static degreesToRadians(degrees2) { + return degrees2 * Constants$1.RADIANS_PER_DEGREE; + } + static radiansToDegrees(radians2) { + return radians2 * Constants$1.DEGREES_PER_RADIAN; + } + static wrapAngle(angle2) { + if (angle2 > Constants$1.PI) + angle2 = angle2 - Constants$1.TWO_PI; + else if (angle2 < -Constants$1.PI) + angle2 += Constants$1.TWO_PI; + return angle2; + } + static sphericalToCartesian(altitude, longitude2, latitude, result) { + latitude = AngleHelper.degreesToRadians(latitude); + longitude2 = AngleHelper.degreesToRadians(longitude2); + const scale2 = Math.cos(latitude); + result[0] = altitude * scale2 * Math.sin(longitude2); + result[1] = altitude * Math.sin(latitude); + result[2] = altitude * scale2 * Math.cos(longitude2); + } + static cartesianToSpherical(x2, y2, z2, result) { + result[0] = Math.atan2(x2, z2); + result[1] = Math.asin(y2); } - static setScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + static angleBetweenVectors(from, to) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + return Math.acos(dot2); + } } - static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + static signedAngleBetweenVectors(from, to, up) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + let angle2 = Math.acos(dot2); + cross$1(AngleHelper._vec3, from, to); + if (dot$1(AngleHelper._vec3, up) < 0) { + angle2 = -angle2; + } + return angle2; + } } - static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + } + AngleHelper._vec3 = create$6(); + class CameraBase { + getView(view) { + this.getPosition(view.position); } - static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getSelected(bufferView, index) { - return bufferView.getInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES) / 0x7F; - } - static setSelected(bufferView, index, value) { - bufferView.setInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES, value * 0x7F); + setView(view, isSmooth) { + this.setPosition(view.position, isSmooth); } - static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); + lerpView(from, to, time2) { + lerp$1(this._vec3, from.position, to.position, time2); + this.setPosition(this._vec3, false); } - static getRounding(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, true); + get vMatrices() { + return this._vMatrices; } - static setRounding(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, value, true); + get inverseVMatrices() { + return this._inverseVMatrices; } - static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); + get mvMatrices() { + return this._mvMatrices; } - static getParameter1(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, true); + get pMatrices() { + return this._pMatrices; } - static setParameter1(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, value, true); + get inversePMatrices() { + return this._inversePMatrices; } - static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); + get pickVMatrix() { + return this._pickVMatrix; } - static getParameter2(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, true); + get rMatrix() { + return this._mat3; } - static setParameter2(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, value, true); + getOrbit(value2) { + copy$4(value2, this._orbitRotation); } - static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); + setOrbit(value2, isSmooth) { + copy$4(this._orbitRotation, value2); + if (!isSmooth) { + copy$4(this._smoothedOrbitRotation, value2); + } } - static getMaterial(bufferView, index) { - return bufferView.getUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES); + getPosition(value2) { + copy$6(value2, this._cameraPosition); } - static setMaterial(bufferView, index, value) { - bufferView.setUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES, value); + setPosition(value2, isSmooth) { + copy$6(this._cameraPosition, value2); + if (!isSmooth) { + copy$6(this._smoothedCameraPosition, value2); + } } - static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); + constructor(core) { + this._core = core; + this._vec3 = create$6(); + this._quat = create$4(); + this._mat3 = create$8(); + this._right = create$6(); + this._up = create$6(); + this._forward = create$6(); + this._modelManipulationOrigin = create$6(); + this.modelPosition = create$6(); + this.modelScale = create$6(); + this.modelRotation = create$4(); + this._orbitRotation = create$4(); + this._orbitDirection = create$4(); + this._smoothedOrbitRotation = create$4(); + this._smoothedCameraPosition = create$6(); + this._smoothedCameraRotation = create$4(); + this._cameraPosition = create$6(); + this._cameraRotation = create$4(); + this._combinedPosition = create$6(); + this._combinedRotation = create$4(); + this._leftToRightEye = create$6(); + this._pickVMatrix = create$7(); + this._eyePositions = [create$6(), create$6()]; + this._vMatrices = [create$7(), create$7()]; + this._mvMatrices = [create$7(), create$7()]; + this._pMatrices = [create$7(), create$7()]; + this._inverseVMatrices = [create$7(), create$7()]; + this._inversePMatrices = [create$7(), create$7()]; } - static getTexture(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES); + reset(isSmooth) { + copy$6(this._cameraPosition, Constants$1.VECTOR3_ZERO); + copy$4(this._cameraRotation, Constants$1.QUAT_IDENTITY); + copy$4(this._orbitRotation, Constants$1.QUAT_IDENTITY); + if (!isSmooth) { + this.syncSmooth(); + } } - static setTexture(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES, value); + update(elapsedTime) { + let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); + lerp$1(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); + amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); + slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); + slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); + const epsilon3 = 1e-6; + let x2; + let y2; + let z2; + let w2; + x2 = this._smoothedCameraPosition[0] - this._cameraPosition[0]; + y2 = this._smoothedCameraPosition[1] - this._cameraPosition[1]; + z2 = this._smoothedCameraPosition[2] - this._cameraPosition[2]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3) { + copy$6(this._smoothedCameraPosition, this._cameraPosition); + } + x2 = this._smoothedCameraRotation[0] - this._cameraRotation[0]; + y2 = this._smoothedCameraRotation[1] - this._cameraRotation[1]; + z2 = this._smoothedCameraRotation[2] - this._cameraRotation[2]; + w2 = this._smoothedCameraRotation[3] - this._cameraRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$4(this._smoothedCameraRotation, this._cameraRotation); + } + x2 = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; + y2 = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; + z2 = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; + w2 = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z2) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$4(this._smoothedOrbitRotation, this._orbitRotation); + } + normalize$3(this._smoothedCameraRotation, this._smoothedCameraRotation); + normalize$3(this._smoothedOrbitRotation, this._smoothedOrbitRotation); + conjugate(this._orbitDirection, this._smoothedOrbitRotation); + transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); + subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); + transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); + add$4(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); + multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); + fromQuat$1(this._mat3, this._combinedRotation); + this._right[0] = this._mat3[0]; + this._right[1] = this._mat3[1]; + this._right[2] = this._mat3[2]; + this._up[0] = this._mat3[3]; + this._up[1] = this._mat3[4]; + this._up[2] = this._mat3[5]; + this._forward[0] = this._mat3[6]; + this._forward[1] = this._mat3[7]; + this._forward[2] = this._mat3[8]; + const view = this._vMatrices[0]; + view[0] = this._right[0]; + view[1] = this._up[0]; + view[2] = this._forward[0]; + view[4] = this._right[1]; + view[5] = this._up[1]; + view[6] = this._forward[1]; + view[8] = this._right[2]; + view[9] = this._up[2]; + view[10] = this._forward[2]; + view[12] = -dot$1(this._right, this._combinedPosition); + view[13] = -dot$1(this._up, this._combinedPosition); + view[14] = -dot$1(this._forward, this._combinedPosition); + const aspectRatio = this.width / this.height; + if (this._core.config.stereoMode == StereoMode.none) { + if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + const left = -aspectRatio * top; + const right = aspectRatio * top; + const width2 = right - left; + const height2 = top - bottom; + const tileWidth = width2 / this._core.config.tilesX; + const tileHeight = height2 / this._core.config.tilesY; + frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); + } else { + perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); + } + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + invert$1(this._inverseVMatrices[0], this.vMatrices[0]); + invert$1(this._inversePMatrices[0], this.pMatrices[0]); + } else { + cross$1(this._leftToRightEye, this._forward, this._up); + normalize$5(this._leftToRightEye, this._leftToRightEye); + scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); + scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); + this._vMatrices[0][12] += this._core.config.ipd * 0.5; + copy$7(this._vMatrices[1], this._vMatrices[0]); + this._vMatrices[1][12] -= this._core.config.ipd; + const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + let left = -aspectRatio * top + frustumShift; + let right = aspectRatio * top + frustumShift; + frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + left = -aspectRatio * top - frustumShift; + right = aspectRatio * top - frustumShift; + frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); + invert$1(this._inverseVMatrices[0], this._vMatrices[0]); + invert$1(this._inversePMatrices[0], this._pMatrices[0]); + copy$7(this._inverseVMatrices[1], this._inverseVMatrices[0]); + this._inverseVMatrices[1][12] += this._core.config.ipd; + invert$1(this._inversePMatrices[1], this._pMatrices[1]); + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } } - static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); + _zoom(direction, distance2) { + scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance2); } - static getSdfBuffer(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES); + rotate(translationDelta) { } - static setSdfBuffer(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES, value); + zoom(zoomDelta, x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + normalize$5(this._vec3, this._vec3); + const distance$1 = zoomDelta * distance(this._combinedPosition, this.modelPosition); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + this._zoom(this._vec3, distance$1); } - static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); + _twist(axis, angle2) { } - static getSdfBorder(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES); + twist(angle2, x2, y2) { } - static setSdfBorder(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES, value); + updatePickVMatrix(x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); } - static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); - } -} -UnitVertex.SIZE_BYTES = 92; -UnitVertex.ID_HOVER_OFFSET_BYTES = 0; -UnitVertex.ID_COLOR_OFFSET_BYTES = 4; -UnitVertex.ORDER_OFFSET_BYTES = 8; -UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; -UnitVertex.SELECTED_OFFSET_BYTES = 80; -UnitVertex.TRANSLATION_OFFSET_BYTES = 16; -UnitVertex.COLOR_OFFSET_BYTES = 28; -UnitVertex.MATERIAL_OFFSET_BYTES = 30; -UnitVertex.SCALE_OFFSET_BYTES = 32; -UnitVertex.ROUNDING_OFFSET_BYTES = 44; -UnitVertex.ROTATION_OFFSET_BYTES = 48; -UnitVertex.TEXCOORD_OFFSET_BYTES = 64; -UnitVertex.TEXTURE_OFFSET_BYTES = 81; -UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; -UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; -UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; -UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"79I5N":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class Cube { -} -Cube.POSITIONS = new Float32Array([ - -0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - 0.5, - -0.5, - 0.5, - -0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - -0.5, - -0.5, - -0.5 -]); -Cube.INDICES = new Uint16Array([ - 5, - 4, - 1, - 0, - 3, - 4, - 7, - 5, - 6, - 1, - 2, - 3, - 6, - 7 -]); -Cube.CUBE_MAP_INDICES = new Uint16Array([ - 2, - 3, - 1, - 0, - 4, - 3, - 7, - 2, - 6, - 1, - 5, - 4, - 6, - 7 -]); -Cube.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Cube.FACE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0.0, 0.5, 0.0), - (0, _glMatrix.vec3).fromValues(0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, -0.5, 0.0), - (0, _glMatrix.vec3).fromValues(-0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, 0.5), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, -0.5) -]; -Cube.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, -1, 0, 1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, -1, 0, 1, 0, 1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, 1, 0, -1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, 1, 0, 1, 0, -1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Cube.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, 0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0.5) -]; -Cube.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; -Cube.EDGE_CORNERS = [ - [ - 0, - 1 - ], - [ - 1, - 5 - ], - [ - 4, - 5 - ], - [ - 0, - 4 - ], - [ - 2, - 3 - ], - [ - 2, - 6 - ], - [ - 6, - 7 - ], - [ - 3, - 7 - ], - [ - 1, - 2 - ], - [ - 5, - 6 - ], - [ - 4, - 7 - ], - [ - 0, - 3 - ] -]; -Cube.EDGE_FACES = [ - [ - 0, - 4 - ], - [ - 0, - 1 - ], - [ - 0, - 5 - ], - [ - 0, - 3 - ], - [ - 2, - 4 - ], - [ - 2, - 1 - ], - [ - 2, - 5 - ], - [ - 2, - 3 - ], - [ - 1, - 4 - ], - [ - 1, - 5 - ], - [ - 3, - 5 - ], - [ - 3, - 4 - ] -]; -Cube.EDGE_AXIS = [ - 0, - 2, - 0, - 2, - 0, - 2, - 0, - 2, - 1, - 1, - 1, - 1 -]; -Cube.AXIS_EDGES = [ - [ - 0, - 2, - 4, - 6 - ], - [ - 8, - 9, - 10, - 11 - ], - [ - 1, - 3, - 5, - 7 - ] -]; -Cube.AXIS_FACES = [ - [ - 1, - 3 - ], - [ - 0, - 2 - ], - [ - 4, - 5 - ] -]; -Cube.OPPOSITE_FACES = [ - 2, - 3, - 0, - 1, - 5, - 4 -]; -Cube.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Cube.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7gWc5":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MatrixHelper", ()=>MatrixHelper); -class MatrixHelper { - static fieldOfViewFromProjectionMatrix(p) { - return 2 * Math.atan(1 / p[5]); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jfjef":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>Cartesian3dAxesHelper); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>Cartesian3dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _cubeJs = require("../../meshes/cube.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian3dAxesHelper { - static create(core, options) { - const cartesian3dAxes = new Cartesian3dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const minValueZ = options.minValueZ === undefined ? 0 : options.minValueZ; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const maxValueZ = options.maxValueZ === undefined ? 1 : options.maxValueZ; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian3dAxes.minBoundsX = minBoundsX; - cartesian3dAxes.minBoundsY = minBoundsY; - cartesian3dAxes.minBoundsZ = minBoundsZ; - cartesian3dAxes.maxBoundsX = maxBoundsX; - cartesian3dAxes.maxBoundsY = maxBoundsY; - cartesian3dAxes.maxBoundsZ = maxBoundsZ; - cartesian3dAxes.scalingX = scaling; - cartesian3dAxes.scalingY = scaling; - cartesian3dAxes.scalingZ = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, Math.max(maxBoundsY - minBoundsY, maxBoundsZ - minBoundsZ)); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY, - options.divisionsZ == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsZ - minBoundsZ) / maxLength), 1) : options.divisionsZ - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY, - options.minorGridlinesZ == undefined ? 2 : options.minorGridlinesZ - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY, - options.labelMajorSizeZ === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeZ - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY, - options.labelMinorSizeZ === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeZ - ]; - cartesian3dAxes.isDiscreteX = options.isDiscreteX; - cartesian3dAxes.isDiscreteY = options.isDiscreteY; - cartesian3dAxes.isDiscreteZ = options.isDiscreteZ; - cartesian3dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY, - options.isDivisionPickingEnabledZ - ]; - const isLabelPickingEnabledArray = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY, - options.isLabelPickingEnabledZ - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY, - options.reverseZ - ]; - const labelsArray = [ - options.labelsX, - options.labelsY, - options.labelsZ - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY, - options.labelOrientationZ - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const areTicksVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY, - options.arePickDivisionsVisibleZ - ]; - const minValueArray = [ - minValueX, - minValueY, - minValueZ - ]; - const maxValueArray = [ - maxValueX, - maxValueY, - maxValueZ - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY, - options.isDiscreteZ - ]; - const titleArray = [ - options.titleX, - options.titleY, - options.titleZ - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY, - options.titleSizeZ - ]; - const headingArray = [ - options.headingX, - options.headingY, - options.headingZ - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY, - options.headingSizeZ - ]; - for(let axisId = 0; axisId < 3; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian3dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian3dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian3dAxes.setLabels(axisId, discreteAxis.labels); - cartesian3dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian3dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian3dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian3dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian3dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabels(axisId, continuousAxis.labels); - cartesian3dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian3dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian3dAxes.setLabelSizes(axisId, labelSizes); - cartesian3dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian3dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian3dAxes.setTitle(axisId, titleArray[axisId]); - cartesian3dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian3dAxes.setHeading(axisId, headingArray[axisId]); - cartesian3dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian3dAxes.arePickDivisionsVisible[axisId] = areTicksVisibleArray[axisId] === undefined ? true : areTicksVisibleArray[axisId]; - cartesian3dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian3dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabledArray[axisId]; - cartesian3dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian3dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian3dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian3dAxes; - } -} -class Cartesian3dAxes extends (0, _axesJs.AxesBase) { - get size() { - return this._size; + syncSmooth() { + copy$6(this._smoothedCameraPosition, this._cameraPosition); + copy$4(this._smoothedCameraRotation, this._cameraRotation); + copy$4(this._smoothedOrbitRotation, this._orbitRotation); } - get isDiscreteX() { - return this._isDiscrete[0]; + updateModelManipulationOrigin(from, to) { + const a2 = create$6(); + const b2 = create$6(); + const c2 = create$6(); + const d2 = create$6(); + transformMat4$2(a2, from, this.modelMMatrix); + transformMat4$2(b2, to, this.modelMMatrix); + subtract(a2, this._cameraPosition, a2); + subtract(b2, this._cameraPosition, b2); + transformQuat(c2, a2, this._orbitDirection); + transformQuat(d2, b2, this._orbitDirection); + subtract(c2, c2, a2); + subtract(d2, d2, b2); + subtract(this._vec3, c2, d2); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + add$4(this._cameraPosition, this._cameraPosition, this._vec3); + add$4(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); + } + unproject(position2, x2, y2, z2) { + set$8(position2, 2 * x2 / this.width - 1, 1 - 2 * y2 / this.height, z2); + transformMat4$2(position2, position2, this._inversePMatrices[0]); + transformMat4$2(position2, position2, this._inverseVMatrices[0]); } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } + translate(translationDelta) { + const distance$1 = distance(this.modelPosition, this._combinedPosition); + const height2 = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; + set$8(this._vec3, height2 * translationDelta[0], -height2 * translationDelta[1], 0); + transformQuat(this._vec3, this._vec3, this._combinedRotation); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + subtract(this._cameraPosition, this._cameraPosition, this._vec3); } - get isDiscreteY() { - return this._isDiscrete[1]; + } + class AltAzimuthCamera extends CameraBase { + getView(view) { + super.getView(view); + view.altitude = this.altitude; + view.azimuth = this.azimuth; + view.fov = this._core.config.fov; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } + setView(view, isSmooth) { + super.setView(view, isSmooth); + this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); + this._core.config.fov = view.fov; } - get isDiscreteZ() { - return this._isDiscrete[2]; + lerpView(from, to, time2) { + super.lerpView(from, to, time2); + this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time2), MathHelper.lerp(from.azimuth, to.azimuth, time2), false); + this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time2); } - set isDiscreteZ(value) { - if (value != this._isDiscrete[2]) { - this._isDiscrete[2] = value; - this._hasChanged = true; - } + update(elapsedTime) { + super.update(elapsedTime); + if (this._core.config.isDebugVisible) { + const altitude = AngleHelper.radiansToDegrees(this.altitude); + const azimuth = AngleHelper.radiansToDegrees(this.azimuth); + this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); + this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + } } - get minBoundsX() { - return this._minBoundsX; + get altitude() { + transformQuat(this._up, Constants$1.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants$1.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants$1.VECTOR3_UNITY, this._up, this._right); } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + get azimuth() { + transformQuat(this._up, Constants$1.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants$1.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants$1.VECTOR3_UNITX, this._right, this._up); } - get maxBoundsX() { - return this._maxBoundsX; + setAltAzimuth(altitude, azimuth, isSmooth) { + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITX, altitude); + multiply(this._orbitRotation, this._quat, Constants$1.QUAT_IDENTITY); + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITY, azimuth); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + if (!isSmooth) { + this.syncSmooth(); + } } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + rotate(translationDelta) { + const length2 = Math.min(this.width, this.height); + let angle2 = translationDelta[1] * Constants$1.PI / length2; + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITX, angle2); + multiply(this._orbitRotation, this._quat, this._orbitRotation); + angle2 = translationDelta[0] * Constants$1.PI / length2; + setAxisAngle(this._quat, Constants$1.VECTOR3_UNITY, angle2); + multiply(this._orbitRotation, this._orbitRotation, this._quat); } - get minBoundsY() { - return this._minBoundsY; + } + let Config$2 = class Config { + constructor(core) { + this.reset(); } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; + reset() { + this.isDebugVisible = false; + this.logLevel = LogLevel.warn; + this.shaderPath = "shaders"; + this.fontPath = "fonts"; + this.modelDistance = 0.5; + this.modelSize = 0.25; + this.stereoMode = StereoMode.none; + this.ipd = 0.06; + this.screenDistance = 0.5; + this.fov = AngleHelper.degreesToRadians(30); + this.nearPlane = 0.01; + this.farPlane = 100; + this.pickWidth = 512; + this.pickHeight = 512; + this.pickHoldDelay = 1e3; + this.pickSelectDelay = 100; + this.resizeMinimumDelay = 250; + this.rotationSmoothing = 0.02; + this.positionSmoothing = 0.02; + this.focusSmoothing = 0.01; + this.scaleSmoothing = 0.02; + this.mouseWheelZoomScale = -2e-3; + this.mouseWheelRotationScale = -2e-3; + this.dragToleranceSquared = 100; + this.manipulatorMinRelativeDistanceSquared = 100; + this.isMultiTouchEnabled = true; + this.isMultiTouchZoomEnabled = true; + this.isMultiTouchTwistEnabled = true; + this.isMultiTouchRotateEnabled = true; + this.isMultiTouchTranslateEnabled = true; + this.multiTouchZoomScale = 1; + this.cameraMinDistance = 0.1; + this.cameraMaxDistance = 10; + this.xrControllerRayColor = fromValues$3(0.5, 0.5, 0.5); + this.xrControllerProfile = "windows-mixed-reality"; + this.xrControllerHandedness = "right"; + this.paletteColor = new Uint8Array([128, 128, 128, 0]); + this.textColor = create$6(); + this.textHoverColor = create$6(); + this.textBorderColor = create$6(); + this.textBorderWidth = 24 / 255; + this.identityRotation = Constants$1.VECTOR3_UNITY; + this.axesTextLabelMaxGlyphs = 32; + this.axesTextColor = create$6(); + this.axesTextBorderColor = create$6(); + this.axesTextHoverColor = create$6(); + this.axesTextLabelMajorSize = 0.03; + this.axesTextLabelMinorSize = 0.02; + this.axesTextTitleMaxGlyphs = 127; + this.axesTextTitleSize = 0.05; + this.axesTextHeadingMaxGlyphs = 128; + this.axesTextHeadingSize = 0.075; + this.axesTextTitleLineHeight = 1.5; + this.axesTextHeadingLineHeight = 1.5; + this.axesTextLabelLineHeight = 1.5; + this.axesGridMajorThickness = 2e-4; + this.axesGridMinorThickness = 1e-4; + this.axesGridZeroThickness = 2e-3; + this.axesGridPickDivisionHeight = 0.025; + this.axesGridBackgroundColor = create$6(); + this.axesGridHighlightColor = create$6(); + this.axesGridMinorColor = create$6(); + this.axesGridMajorColor = create$6(); + this.axesGridZeroColor = create$6(); + this.axesGridDefaultDivisions = 10; + this.keyTitleMaxGlyphs = 64; + this.keyLabelMaxGlyphs = 64; + this.selectionColor = create$6(); + this.hoverColor = create$6(); + this.activeColor = create$6(); + this.highlightMode = HighlightMode.color; + this.lassoThickness = 4; + this.lassoDashWidth = 2; + this.lassoColor = create$6(); + this.minCubifiedTreeMapSlice = 0.01; + this.sdfBuffer = 192; + this.sdfBorder = 0; + this.forceDirectIsEnabled = false; + this.forceDirectAttraction = 1; + this.forceDirectRepulsion = 1; + this.forceDirectGravity = 1; + this.forceDirectInterval = 0.1; + this.forceDirectMaxDistance = 0.1; + this.forceDirectTheta = 1; + this.forceDirectIterationsPerLayout = 1; + this.forceDirectEdgeWeightPower = 1; + this.forceDirectLockX = false; + this.forceDirectLockY = false; + this.forceDirectLockZ = false; + this.transitionDuration = 400; + this.transitionStaggering = 100; + this.transitionView = true; + this.isTransitionPickingEnabled = false; + this.backgroundColor = create$5(); + this.theme = Theme.light; + this.ambientColor = create$6(); + this.renderMode = RenderMode.color; + this.tilesX = 1; + this.tilesY = 1; + this.tileOffsetX = 0; + this.tileOffsetY = 0; + } + get theme() { + return this._theme; + } + set theme(value2) { + if (this._theme != value2) { + this._theme = value2; + switch (value2) { + case Theme.dark: + set$7(this.backgroundColor, 0, 0, 0, 1); + set$8(this.textColor, 0.9, 0.9, 0.9); + set$8(this.textHoverColor, 1, 1, 1); + set$8(this.textBorderColor, 0, 0, 0); + set$8(this.axesTextColor, 0.9, 0.9, 0.9); + set$8(this.axesTextBorderColor, 0, 0, 0); + set$8(this.axesTextHoverColor, 1, 1, 1); + set$8(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); + set$8(this.axesGridHighlightColor, 0.04, 0.04, 0.04); + set$8(this.axesGridMinorColor, 0.05, 0.05, 0.05); + set$8(this.axesGridMajorColor, 0.1, 0.1, 0.1); + set$8(this.axesGridZeroColor, 0.05, 0.1, 0.1); + set$8(this.selectionColor, 1, 1, 0); + set$8(this.hoverColor, 1, 0, 1); + set$8(this.activeColor, 0, 1, 1); + set$8(this.lassoColor, 0.9, 0.9, 0.9); + break; + case Theme.light: + set$7(this.backgroundColor, 1, 1, 1, 1); + set$8(this.textColor, 0, 0, 0); + set$8(this.textHoverColor, 0.1, 0.1, 0.1); + set$8(this.textBorderColor, 1, 1, 1); + set$8(this.axesTextColor, 0, 0, 0); + set$8(this.axesTextBorderColor, 1, 1, 1); + set$8(this.axesTextHoverColor, 0.1, 0.1, 0.1); + set$8(this.axesGridBackgroundColor, 1, 1, 1); + set$8(this.axesGridHighlightColor, 0.925, 0.925, 0.925); + set$8(this.axesGridMinorColor, 0.9, 0.9, 0.9); + set$8(this.axesGridMajorColor, 0.8, 0.8, 0.8); + set$8(this.axesGridZeroColor, 0.7, 0.9, 0.9); + set$8(this.selectionColor, 1, 1, 0); + set$8(this.hoverColor, 1, 0, 1); + set$8(this.activeColor, 0, 1, 1); + set$8(this.lassoColor, 0.1, 0.1, 0.1); + break; + } + if (this.themeChangedCallback) { + this.themeChangedCallback(this._theme); } + } + } + }; + class DebugText { + get text() { + return this._text; + } + constructor() { + this.clear(); + } + clear() { + this._text = ""; + } + addLine(value2) { + this._text += value2 + "\n"; + } + } + class Fps { + get frameCounter() { + return this._frameCounter; + } + get totalFrames() { + return this._totalFrames; + } + constructor(core) { + this._core = core; + this._totalFrames = 0; + this.reset(); + } + update(elapsedTime) { + this._elapsedTime += elapsedTime; + if (this._elapsedTime > 1e3) { + this._elapsedTime -= 1e3; + this._fps = this._frameCounter; + this._frameCounter = 0; + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`fps ${this._fps}`); + } + } + render() { + this._frameCounter++; + this._totalFrames++; + } + reset() { + this._fps = 0; + this._frameCounter = 0; + this._elapsedTime = 0; } - get maxBoundsY() { - return this._maxBoundsY; + } + const PaletteType = { + sequentialsinglehue: "sequentialsinglehue", + sequentialmultihue: "sequentialmultihue", + diverging: "diverging", + qualitative: "qualitative" + }; + class PaletteResources { + constructor() { + this.palettes = { + "blues": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 251, 255, 222, 235, 247, 198, 219, 239, 158, 202, 225, 107, 174, 214, 66, 146, 198, 33, 113, 181, 8, 81, 156, 8, 48, 107]) }, + "greens": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 252, 245, 229, 245, 224, 199, 233, 192, 161, 217, 155, 116, 196, 118, 65, 171, 93, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "greys": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 255, 255, 240, 240, 240, 217, 217, 217, 189, 189, 189, 150, 150, 150, 115, 115, 115, 82, 82, 82, 37, 37, 37, 0, 0, 0]) }, + "oranges": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 235, 254, 230, 206, 253, 208, 162, 253, 174, 107, 253, 141, 60, 241, 105, 19, 217, 72, 1, 166, 54, 3, 127, 39, 4]) }, + "purples": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([252, 251, 253, 239, 237, 245, 218, 218, 235, 188, 189, 220, 158, 154, 200, 128, 125, 186, 106, 81, 163, 84, 39, 143, 63, 0, 125]) }, + "reds": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 240, 254, 224, 210, 252, 187, 161, 252, 146, 114, 251, 106, 74, 239, 59, 44, 203, 24, 29, 165, 15, 21, 103, 0, 13]) }, + "viridis": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([72, 37, 117, 65, 68, 135, 53, 96, 141, 42, 120, 142, 33, 145, 141, 34, 168, 132, 67, 191, 113, 122, 209, 81, 188, 223, 39]) }, + "inferno": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([23, 12, 59, 66, 10, 104, 107, 23, 110, 147, 38, 103, 187, 55, 85, 221, 81, 58, 243, 119, 26, 252, 165, 10, 246, 214, 69]) }, + "magma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([21, 14, 55, 59, 15, 112, 101, 26, 128, 140, 41, 129, 182, 55, 122, 222, 73, 104, 247, 111, 92, 254, 159, 109, 254, 206, 145]) }, + "plasma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([66, 3, 157, 106, 0, 168, 144, 13, 164, 177, 42, 144, 203, 71, 121, 225, 100, 98, 242, 131, 76, 252, 166, 54, 252, 206, 37]) }, + "bluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 229, 245, 249, 204, 236, 230, 153, 216, 201, 102, 194, 164, 65, 174, 118, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "bluepurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 224, 236, 244, 191, 211, 230, 158, 188, 218, 140, 150, 198, 140, 107, 177, 136, 65, 157, 129, 15, 124, 77, 0, 75]) }, + "greenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 240, 224, 243, 219, 204, 235, 197, 168, 221, 181, 123, 204, 196, 78, 179, 211, 43, 140, 190, 8, 104, 172, 8, 64, 129]) }, + "orangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 236, 254, 232, 200, 253, 212, 158, 253, 187, 132, 252, 141, 89, 239, 101, 72, 215, 48, 31, 179, 0, 0, 127, 0, 0]) }, + "purpleblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 231, 242, 208, 209, 230, 166, 189, 219, 116, 169, 207, 54, 144, 192, 5, 112, 176, 4, 90, 141, 2, 56, 88]) }, + "purplebluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 226, 240, 208, 209, 230, 166, 189, 219, 103, 169, 207, 54, 144, 192, 2, 129, 138, 1, 108, 89, 1, 70, 54]) }, + "purplered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 244, 249, 231, 225, 239, 212, 185, 218, 201, 148, 199, 223, 101, 176, 231, 41, 138, 206, 18, 86, 152, 0, 67, 103, 0, 31]) }, + "redpurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 243, 253, 224, 221, 252, 197, 192, 250, 159, 181, 247, 104, 161, 221, 52, 151, 174, 1, 126, 122, 1, 119, 73, 0, 106]) }, + "yellowgreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 247, 252, 185, 217, 240, 163, 173, 221, 142, 120, 198, 121, 65, 171, 93, 35, 132, 67, 0, 104, 55, 0, 69, 41]) }, + "yellowgreenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 217, 237, 248, 177, 199, 233, 180, 127, 205, 187, 65, 182, 196, 29, 145, 192, 34, 94, 168, 37, 52, 148, 8, 29, 88]) }, + "yelloworangebrown": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 255, 247, 188, 254, 227, 145, 254, 196, 79, 254, 153, 41, 236, 112, 20, 204, 76, 2, 153, 52, 4, 102, 37, 6]) }, + "yelloworangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 204, 255, 237, 160, 254, 217, 118, 254, 178, 76, 253, 141, 60, 252, 78, 42, 227, 26, 28, 189, 0, 38, 128, 0, 38]) }, + "brownbluegreen": { type: PaletteType.diverging, colors: new Uint8Array([84, 48, 5, 140, 81, 10, 191, 129, 45, 223, 194, 125, 246, 232, 195, 245, 245, 245, 199, 234, 229, 128, 205, 193, 53, 151, 143, 1, 102, 94, 0, 60, 48]) }, + "pinkyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([142, 1, 82, 197, 27, 125, 222, 119, 174, 241, 182, 218, 253, 224, 239, 247, 247, 247, 230, 245, 208, 184, 225, 134, 127, 188, 65, 77, 146, 33, 39, 100, 25]) }, + "purplegreen": { type: PaletteType.diverging, colors: new Uint8Array([64, 0, 75, 118, 42, 131, 153, 112, 171, 194, 165, 207, 231, 212, 232, 247, 247, 247, 217, 240, 211, 166, 219, 160, 90, 174, 97, 27, 120, 55, 0, 68, 27]) }, + "purpleorange": { type: PaletteType.diverging, colors: new Uint8Array([127, 59, 8, 179, 88, 6, 224, 130, 20, 253, 184, 99, 254, 224, 182, 247, 247, 247, 216, 218, 235, 178, 171, 210, 128, 115, 172, 84, 39, 136, 45, 0, 75]) }, + "redblue": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 247, 247, 247, 209, 229, 240, 146, 197, 222, 67, 147, 195, 33, 102, 172, 5, 48, 97]) }, + "redgrey": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 255, 255, 255, 224, 224, 224, 186, 186, 186, 135, 135, 135, 77, 77, 77, 26, 26, 26]) }, + "redyellowblue": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 144, 255, 255, 191, 224, 243, 248, 171, 217, 233, 116, 173, 209, 69, 117, 180, 49, 54, 149]) }, + "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, + "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, + "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, + "category10": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 255, 127, 14, 44, 160, 44, 214, 39, 40, 148, 103, 189, 140, 86, 75, 227, 119, 194, 127, 127, 127, 188, 189, 34, 23, 190, 207]) }, + "category20": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 174, 199, 232, 255, 127, 14, 255, 187, 120, 44, 160, 44, 152, 223, 138, 214, 39, 40, 255, 152, 150, 148, 103, 189, 197, 176, 213, 140, 86, 75, 196, 156, 148, 227, 119, 194, 247, 182, 210, 127, 127, 127, 199, 199, 199, 188, 189, 34, 219, 219, 141, 23, 190, 207, 158, 218, 229]) }, + "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, + "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, + "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, + "pastel2": { type: PaletteType.qualitative, colors: new Uint8Array([179, 226, 205, 253, 205, 172, 203, 213, 232, 244, 202, 228, 230, 245, 201, 255, 242, 174, 241, 226, 204, 204, 204, 204]) }, + "set1": { type: PaletteType.qualitative, colors: new Uint8Array([228, 26, 28, 55, 126, 184, 77, 175, 74, 152, 78, 163, 255, 127, 0, 255, 255, 51, 166, 86, 40, 247, 129, 191, 153, 153, 153]) }, + "set2": { type: PaletteType.qualitative, colors: new Uint8Array([102, 194, 165, 252, 141, 98, 141, 160, 203, 231, 138, 195, 166, 216, 84, 255, 217, 47, 229, 196, 148, 179, 179, 179]) }, + "set3": { type: PaletteType.qualitative, colors: new Uint8Array([141, 211, 199, 255, 255, 179, 190, 186, 218, 251, 128, 114, 128, 177, 211, 253, 180, 98, 179, 222, 105, 252, 205, 229, 217, 217, 217, 188, 128, 189, 204, 235, 197, 255, 237, 111]) } + }; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + } + class PaletteBase { + get colors() { + return this._colors; } - get minBoundsZ() { - return this._minBoundsZ; + set colors(value2) { + if (this._colors != value2) { + this._colors = value2; + this._changed = true; + } } - set minBoundsZ(value) { - if (value != this._minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } + constructor() { + this._colors = null; } - get maxBoundsZ() { - return this._maxBoundsZ; + copyFrom(palette) { + if (palette.colors) { + this.colors = new Uint8Array(palette.colors); + } else { + this.colors = null; + } } - set maxBoundsZ(value) { - if (value != this._minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + update() { } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; + } + let Palette$3 = class Palette extends PaletteBase { + }; + class PositionVertex { + static getPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + set$8(value2, buffer[offset2], buffer[offset2 + 1], buffer[offset2 + 2]); } - getIsForwardFace(index) { - return this._isForwardFace[index]; + static setPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + buffer[offset2] = value2[0]; + buffer[offset2 + 1] = value2[1]; + buffer[offset2 + 2] = value2[2]; } - get textVertices() { - return this._textVertices; + } + PositionVertex.SIZE = 3; + PositionVertex.SIZE_BYTES = 12; + class PositionColorVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set$8(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255); + } + static setColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); } - get textIndices() { - return this._textIndices; + } + PositionColorVertex.SIZE_BYTES = 16; + PositionColorVertex.POSITION_OFFSET_BYTES = 0; + PositionColorVertex.COLOR_OFFSET_BYTES = 12; + class PositionTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; + } + PositionTextureVertex.SIZE_BYTES = 16; + PositionTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; + class PositionTexturePickVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } + } + PositionTexturePickVertex.SIZE_BYTES = 20; + PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; + PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; + PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; + class PositionNormalTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$8(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } + } + PositionNormalTextureVertex.SIZE_BYTES = 20; + PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; + PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; + class PickGridVertex { + static getTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$8(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set$5(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + set$7(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535, bufferView.getUint16(offset2 + 4, true) / 65535, bufferView.getUint16(offset2 + 6, true) / 65535); + } + static setBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + bufferView.setUint16(offset2 + 4, value2[2] * 65535, true); + bufferView.setUint16(offset2 + 6, value2[3] * 65535, true); } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } + } + PickGridVertex.SIZE_BYTES = 32; + PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; + PickGridVertex.NORMAL_OFFSET_BYTES = 12; + PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; + PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; + PickGridVertex.BOUNDS_OFFSET_BYTES = 24; + class UnitVertex { + static getIdHover(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, true); + } + static setIdHover(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, value2, true); } - getLabelOrientation(index) { - return this._orientations[index]; + static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } + static getTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; + static setTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; + static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; + static getColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set$5(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255); } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } + static setColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } + static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; + static getOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + set$5(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true)); } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; + static setOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; + static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } + static getScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + set$8(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } + static setScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; + static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + set$6(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; + static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + set$6(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; + static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$7(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getSelected(bufferView, index2) { + return bufferView.getInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES) / 127; + } + static setSelected(bufferView, index2, value2) { + bufferView.setInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES, value2 * 127); } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; + static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; + static getRounding(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, true); } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; + static setRounding(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, value2, true); } - get gridVertices() { - return this._gridVertices; + static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); } - get gridIndices() { - return this._gridIndices; + static getParameter1(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, true); } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; + static setParameter1(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, value2, true); } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; + static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; + static getParameter2(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, true); } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; + static setParameter2(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, value2, true); } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; + static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; + static getMaterial(bufferView, index2) { + return bufferView.getUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES); } - getGridTicksScale(index) { - return this._gridTicksScales[index]; + static setMaterial(bufferView, index2, value2) { + bufferView.setUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES, value2); } - getGridFaceZero(index) { - return this._gridFaceZeros[index]; + static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; + static getTexture(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES); } - getGridFaceMinorGridlines(index) { - return this._gridFaceMinorGridlines[index]; + static setTexture(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES, value2); } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + static getSdfBuffer(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES); } - get scalingX() { - return this._scalingX; + static setSdfBuffer(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES, value2); } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); } - get scalingY() { - return this._scalingY; + static getSdfBorder(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES); } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } + static setSdfBorder(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES, value2); } - get scalingZ() { - return this._scalingZ; + static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); + } + static getMatId(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES, value2); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint16(offset2) / 255; + value2[1] = bufferView.getUint16(offset2 + 2) / 255; + value2[2] = bufferView.getUint16(offset2 + 4) / 255; + } + static setMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 255); + bufferView.setUint16(offset2 + 2, value2[1] * 255); + bufferView.setUint16(offset2 + 4, value2[2] * 255); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatFuzz(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatGloss(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, value2, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value2, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint8(offset2) / 255; + value2[1] = bufferView.getUint8(offset2 + 1) / 255; + value2[2] = bufferView.getUint8(offset2 + 2) / 255; + value2[3] = bufferView.getUint8(offset2 + 3) / 255; + } + static setSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); } - set scalingZ(value) { - if (value != this._scalingZ) { - this._scalingZ = value; - this._hasChanged = true; + } + UnitVertex.SIZE_BYTES = 120; + UnitVertex.ID_HOVER_OFFSET_BYTES = 0; + UnitVertex.ID_COLOR_OFFSET_BYTES = 4; + UnitVertex.ORDER_OFFSET_BYTES = 8; + UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; + UnitVertex.SELECTED_OFFSET_BYTES = 80; + UnitVertex.TRANSLATION_OFFSET_BYTES = 16; + UnitVertex.COLOR_OFFSET_BYTES = 28; + UnitVertex.MATERIAL_OFFSET_BYTES = 30; + UnitVertex.SCALE_OFFSET_BYTES = 32; + UnitVertex.ROUNDING_OFFSET_BYTES = 44; + UnitVertex.ROTATION_OFFSET_BYTES = 48; + UnitVertex.TEXCOORD_OFFSET_BYTES = 64; + UnitVertex.TEXTURE_OFFSET_BYTES = 81; + UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; + UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; + UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; + UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; + UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; + UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; + UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; + UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; + UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; + UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; + UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; + class ObjMesh { + } + class ObjHelper { + constructor(core) { + this._core = core; + } + read(data2) { + const start = window.performance.now(); + const indices = []; + const positions2 = []; + const normals = []; + const texCoords = []; + const meshes = []; + const indexOffsets = []; + const indexCounts = []; + const faceLookup = {}; + const lines = data2.split("\n"); + let faceCount = 0; + for (let i = 0; i < lines.length; i++) { + const parts = lines[i].trim().split(" "); + if (parts.length > 0) { + switch (parts[0]) { + case "o": + meshes.push(parts[1]); + indexOffsets.push(indices.length); + break; + case "v": + positions2.push(parseFloat(parts[1])); + positions2.push(parseFloat(parts[2])); + positions2.push(parseFloat(parts[3])); + break; + case "vt": + texCoords.push(parseFloat(parts[1])); + texCoords.push(parseFloat(parts[2])); + break; + case "vn": + normals.push(parseFloat(parts[1])); + normals.push(parseFloat(parts[2])); + normals.push(parseFloat(parts[3])); + break; + case "f": + for (let i2 = 0; i2 < parts.length - 1; i2++) { + const part = parts[i2 + 1]; + if (faceLookup[part] == void 0) { + faceLookup[part] = faceCount++; + } + indices.push(faceLookup[part]); + } + break; + } + } + } + for (let i = 0; i < meshes.length - 1; i++) { + indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); + } + indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); + const dataView = new DataView(vertices); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let minZ2 = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY2 = -Number.MAX_VALUE; + let maxZ = -Number.MAX_VALUE; + const faces = Object.keys(faceLookup); + const _vec2 = create$3(); + const _vec3 = create$6(); + let hasTexCoords, hasNormals; + if (faces.length > 0) { + const faceParts = faces[0].split("/"); + hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); + hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); + } + for (let i = 0; i < faces.length; i++) { + const faceParts = faces[i].split("/"); + let index2 = (parseInt(faceParts[0]) - 1) * 3; + const x2 = positions2[index2]; + const y2 = positions2[index2 + 1]; + const z2 = positions2[index2 + 2]; + set$8(_vec3, x2, y2, z2); + PositionNormalTextureVertex.setPosition(dataView, i, _vec3); + minX = Math.min(x2, minX); + minY = Math.min(y2, minY); + minZ2 = Math.min(z2, minZ2); + maxX = Math.max(x2, maxX); + maxY2 = Math.max(y2, maxY2); + maxZ = Math.max(z2, maxZ); + if (hasNormals) { + index2 = (parseInt(faceParts[2]) - 1) * 3; + set$8(_vec3, normals[index2], normals[index2 + 1], normals[index2 + 2]); + PositionNormalTextureVertex.setNormal(dataView, i, _vec3); + } + if (hasTexCoords) { + index2 = (parseInt(faceParts[1]) - 1) * 2; + set$5(_vec2, texCoords[index2], texCoords[index2 + 1]); + PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); } + } + const originX = (minX + maxX) / 2; + const originY = (minY + maxY2) / 2; + const originZ = (minZ2 + maxZ) / 2; + const objMesh = new ObjMesh(); + objMesh.vertices = vertices; + objMesh.indices = new Uint16Array(indices); + objMesh.meshes = meshes; + objMesh.indexOffsets = indexOffsets; + objMesh.indexCounts = indexCounts; + objMesh.indexCount = indices.length; + objMesh.minX = minX; + objMesh.minY = minY; + objMesh.minZ = minZ2; + objMesh.maxX = maxX; + objMesh.maxY = maxY2; + objMesh.maxZ = maxZ; + objMesh.originX = originX; + objMesh.originY = originY; + objMesh.originZ = originZ; + this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); + return objMesh; } - get offsetX() { - return this._offset[12]; + } + class Cube { + } + Cube.POSITIONS = new Float32Array([ + -0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + 0.5, + -0.5, + 0.5, + -0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + -0.5, + -0.5, + -0.5 + ]); + Cube.INDICES = new Uint16Array([5, 4, 1, 0, 3, 4, 7, 5, 6, 1, 2, 3, 6, 7]); + Cube.CUBE_MAP_INDICES = new Uint16Array([2, 3, 1, 0, 4, 3, 7, 2, 6, 1, 5, 4, 6, 7]); + Cube.FACE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Cube.FACE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0), + fromValues$3(0, 0, 0.5), + fromValues$3(0, 0, -0.5) + ]; + Cube.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), + fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), + fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), + fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Cube.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0.5), + fromValues$3(0.5, 0.5, 0), + fromValues$3(0, 0.5, -0.5), + fromValues$3(-0.5, 0.5, 0), + fromValues$3(0, -0.5, 0.5), + fromValues$3(0.5, -0.5, 0), + fromValues$3(0, -0.5, -0.5), + fromValues$3(-0.5, -0.5, 0), + fromValues$3(0.5, 0, 0.5), + fromValues$3(0.5, 0, -0.5), + fromValues$3(-0.5, 0, -0.5), + fromValues$3(-0.5, 0, 0.5) + ]; + Cube.EDGE_NORMALS = [ + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO) + ]; + Cube.EDGE_CORNERS = [ + [0, 1], + [1, 5], + [4, 5], + [0, 4], + [2, 3], + [2, 6], + [6, 7], + [3, 7], + [1, 2], + [5, 6], + [4, 7], + [0, 3] + ]; + Cube.EDGE_FACES = [ + [0, 4], + [0, 1], + [0, 5], + [0, 3], + [2, 4], + [2, 1], + [2, 5], + [2, 3], + [1, 4], + [1, 5], + [3, 5], + [3, 4] + ]; + Cube.EDGE_AXIS = [ + 0, + 2, + 0, + 2, + 0, + 2, + 0, + 2, + 1, + 1, + 1, + 1 + ]; + Cube.AXIS_EDGES = [ + [0, 2, 4, 6], + [8, 9, 10, 11], + [1, 3, 5, 7] + ]; + Cube.AXIS_FACES = [ + [1, 3], + [0, 2], + [4, 5] + ]; + Cube.OPPOSITE_FACES = [ + 2, + 3, + 0, + 1, + 5, + 4 + ]; + Cube.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0) + ]; + Cube.EDGE_FORWARDS = [ + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, -Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, Constants$1.ROOT_TWO_OVER_TWO, 0), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants$1.ROOT_TWO_OVER_TWO, 0, -Constants$1.ROOT_TWO_OVER_TWO) + ]; + let ControllerVisual$1 = class ControllerVisual { + render(elapsedTime, xrFrame) { } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; + update(elapsedTime) { } - get offsetY() { - return this._offset[13]; + constructor(controller) { + this.controller = controller; } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; + }; + class Controller { + get isInitialized() { + return this._isInitialized; } - get offsetZ() { - return this._offset[14]; - } - set offsetZ(value) { - if (value != this._offset[14]) this._offset[14] = value; - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._minBoundsZ = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._maxBoundsZ = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 6; i++)this._isForwardFace.push(false); - for(let i = 0; i < 12; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 12; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 3; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 3; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 3; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 12; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 6; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = []; - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = []; - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 3; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridFaceZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridFaceMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - } - for(let i = 0; i < 6; i++){ - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 12; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _cubeJs.Cube).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _cubeJs.Cube).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _cubeJs.Cube).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIVES[i], (0, _cubeJs.Cube).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null, - null - ]; - this._toValues = [ - null, - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false, - false - ]; - this.isAxisReversed = [ - false, - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._scalingZ = 1; - this._offset = (0, _glMatrix.mat4).create(); + get mMatrix() { + return this._mMatrix; } - initialize() { - this._isInitialized = true; + get indexCount() { + return this._indexCount; } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._size[2] *= this._scalingZ / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); - } - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 6; faceId++){ - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).FACE_POSITIONS[faceId], this._size); - (0, _glMatrix.vec3).transformMat4(this._forward, this._vec3, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 12; edgeId++){ - const faceIds = (0, _cubeJs.Cube).EDGE_FACES[edgeId]; - const forward1 = this._isForwardFace[faceIds[0]]; - const forward2 = this._isForwardFace[faceIds[1]]; - const outsideEdge = forward1 != forward2; - this._isOutsideEdge[edgeId] = outsideEdge; - if (outsideEdge) this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _cubeJs.Cube).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 3; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - for(let axisId = 0; axisId < 3; axisId++)if (this.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - (0, _glMatrix.vec2).set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - if (this._size[axisId] > 0) (0, _glMatrix.mat4).translate(gridFaceMMatrix, gridFaceMMatrix, (0, _cubeJs.Cube).FACE_POSITIONS[faceId]); - } - } - } - for(let axisId = 0; axisId < 3; axisId++)for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId]) { - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); - } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); - } - } - } + get vertices() { + return this._vertices; } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; + get indices() { + return this._indices; } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; + get texture() { + return this._texture; } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; + get rayMMatrix() { + return this._rayMMatrix; } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 3; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); - } - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } + get rayIndexCount() { + return this._rayIndexCount; } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 3; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } + get rayVertices() { + return this._rayVertices; } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; + get rayIndices() { + return this._rayIndices; } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../main.js":"f421K","./axes.js":"8Tmim","../../meshes/quad.js":"3PqJr","../../meshes/cube.js":"79I5N","../../vertex.js":"4J2YE","../../helpers/axes.js":"99ajO","../../helpers/text.js":"fG2oi","../../helpers/pick.js":"1t2sb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Tmim":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisual", ()=>AxesVisual); -parcelHelpers.export(exports, "AxesBase", ()=>AxesBase); -var _glMatrix = require("gl-matrix"); -class AxesVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(axes){ - this.axes = axes; - } -} -class AxesBase { - get isInitialized() { - return this._isInitialized; + constructor(core, options2) { + this._cubeObj = `o Cube +v 1.000000 -1.000000 -1.000000 +v 1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 -1.000000 +v 1.000000 1.000000 -0.999999 +v 0.999999 1.000000 1.000001 +v -1.000000 1.000000 1.000000 +v -1.000000 1.000000 -1.000000 +vt 1.000000 0.333333 +vt 1.000000 0.666667 +vt 0.666667 0.666667 +vt 0.666667 0.333333 +vt 0.666667 0.000000 +vt 0.000000 0.333333 +vt 0.000000 0.000000 +vt 0.333333 0.000000 +vt 0.333333 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.666667 +vt 0.333333 0.333333 +vt 0.333333 0.666667 +vt 1.000000 0.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn -0.000000 0.000000 1.000000 +vn -1.000000 -0.000000 -0.000000 +vn 0.000000 0.000000 -1.000000 +s off +f 2/1/1 3/2/1 4/3/1 +f 8/1/2 7/4/2 6/5/2 +f 5/6/3 6/7/3 2/8/3 +f 6/8/4 7/5/4 3/4/4 +f 3/9/5 7/10/5 8/11/5 +f 1/12/6 4/13/6 8/11/6 +f 1/4/1 2/1/1 4/3/1 +f 5/14/2 8/1/2 6/5/2 +f 1/12/3 5/6/3 2/8/3 +f 2/12/4 6/8/4 3/4/4 +f 4/13/5 3/9/5 8/11/5 +f 5/6/6 1/12/6 8/11/6`; + this._core = core; + this._obj = options2.obj; + this._texture = options2.texture || new ImageData(new Uint8ClampedArray([0, 0, 0, 255]), 1, 1); } - set vMatrix(value) { - this._vMatrix = value; + initialize() { + const _vec3 = create$6(); + this._mMatrix = create$7(); + const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); + if (!this._obj) { + this.useRayPose = true; + const modelThickness = 0.02; + const modelLength = 0.1; + set$8(_vec3, modelThickness, modelThickness, modelLength); + fromScaling(this._mMatrix, _vec3); + set$8(_vec3, 0, 0, 1); + translate$2(this._mMatrix, this._mMatrix, _vec3); + } + this._vertices = objMesh.vertices; + this._indices = objMesh.indices; + this._indexCount = objMesh.indexCount; + this._rayMMatrix = create$7(); + const rayVertices = Cube.POSITIONS; + this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); + const rayVerticesView = new DataView(this._rayVertices); + const rayIndices = Cube.INDICES; + this._rayIndices = new Uint16Array(rayIndices); + const rayVertexCount = rayVertices.length / PositionVertex.SIZE; + this._rayIndexCount = rayIndices.length; + for (let i = 0; i < rayVertexCount; i++) { + set$8(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); + PositionColorVertex.setPosition(rayVerticesView, i, _vec3); + PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); + } + const rayThickness = 25e-4; + const rayLength = 10; + set$8(_vec3, rayThickness, rayThickness, rayLength); + fromScaling(this._rayMMatrix, _vec3); + set$8(_vec3, 0, 0, -0.5); + translate$2(this._rayMMatrix, this._rayMMatrix, _vec3); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "controller initialized"); } - pickGrid(id) { - const offset = id * 3; - return { - divisionX: this._pickGrid[offset] - 1, - divisionY: this._pickGrid[offset + 1] - 1, - divisionZ: this._pickGrid[offset + 2] - 1 - }; + update(elapsedTime) { } - pickTitle(id) { - return { - axis: this._pickTitle[id] - }; + } + class MatrixHelper { + static fieldOfViewFromProjectionMatrix(p) { + return 2 * Math.atan(1 / p[5]); } - pickLabel(id) { - const offset = id * 2; - return { - axis: this._pickLabel[offset], - label: this._pickLabel[offset + 1] - }; + } + class AxesVisual { + render(elapsedTime, xrFrame) { } - pickHeading(id) { - return { - axis: this._pickHeading[id] - }; + update(elapsedTime) { } - getFromValues(index) { - return this._fromValues[index]; + constructor(axes) { + this.axes = axes; } - setFromValues(index, value) { - if (this._fromValues[index] != value) { - this._fromValues[index] = value; - this._hasChanged = true; - } + } + class AxesBase { + get isInitialized() { + return this._isInitialized; + } + set vMatrix(value2) { + this._vMatrix = value2; + } + pickGrid(id2) { + const offset2 = id2 * 3; + return { + divisionX: this._pickGrid[offset2] - 1, + divisionY: this._pickGrid[offset2 + 1] - 1, + divisionZ: this._pickGrid[offset2 + 2] - 1 + }; + } + pickTitle(id2) { + return { axis: this._pickTitle[id2] }; + } + pickLabel(id2) { + const offset2 = id2 * 2; + return { + axis: this._pickLabel[offset2], + label: this._pickLabel[offset2 + 1] + }; + } + pickHeading(id2) { + return { axis: this._pickHeading[id2] }; + } + getFromValues(index2) { + return this._fromValues[index2]; + } + setFromValues(index2, value2) { + if (this._fromValues[index2] != value2) { + this._fromValues[index2] = value2; + this._hasChanged = true; + } } - getToValues(index) { - return this._toValues[index]; + getToValues(index2) { + return this._toValues[index2]; } - setToValues(index, value) { - if (this._toValues[index] != value) { - this._toValues[index] = value; - this._hasChanged = true; - } + setToValues(index2, value2) { + if (this._toValues[index2] != value2) { + this._toValues[index2] = value2; + this._hasChanged = true; + } } get font() { - return this._font; + return this._font; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } get gridPickDivisionHeight() { - return this._gridPickDivisionHeight; - } - set gridPickDivisionHeight(value) { - if (this._gridPickDivisionHeight != value) { - this._gridPickDivisionHeight = value; - this._hasChanged = true; - } - } - constructor(core){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._mvMatrix = (0, _glMatrix.mat4).create(); - this._textMetric = { - maxTop: 0, - width: 0, - maxHeight: 0 - }; - this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; - this.textBorderWidth = core.config.textBorderWidth; - this.gamma = 0; - this.gridMajorThickness = core.config.axesGridMajorThickness; - this.gridMinorThickness = core.config.axesGridMinorThickness; - this.gridZeroThickness = core.config.axesGridZeroThickness; - this._font = core.font; - this.isGridPickingEnabled = false; - } - update(elapsedTime) {} -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3PqJr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -parcelHelpers.export(exports, "Grid", ()=>Grid); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -class Quad { - static positions(transform) { - const positions = new Float32Array(12); - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).set(position, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - positions[i * 3] = position[0]; - positions[i * 3 + 1] = position[1]; - positions[i * 3 + 2] = position[2]; - } - return positions; - } - static textured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - static normalTextured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal3 = (0, _glMatrix.vec3).create(); - const normal4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _glMatrix.vec4).set(normal4, 0.0, 0.0, 1.0, 0.0); - (0, _glMatrix.vec4).transformMat4(normal4, normal4, transform); - (0, _glMatrix.vec3).set(normal3, normal4[0], normal4[1], normal4[2]); - (0, _glMatrix.vec3).normalize(normal3, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } -} -Quad.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Quad.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0) -]; -Quad.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0) -]; -Quad.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Quad.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, 0, -1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.AXIS_EDGES = [ - [ - 0, - 2 - ], - [ - 1, - 3 - ] -]; -Quad.POSITIONS = new Float32Array([ + return this._gridPickDivisionHeight; + } + set gridPickDivisionHeight(value2) { + if (this._gridPickDivisionHeight != value2) { + this._gridPickDivisionHeight = value2; + this._hasChanged = true; + } + } + constructor(core) { + this._core = core; + this._mMatrix = create$7(); + this._mvMatrix = create$7(); + this._textMetric = { maxTop: 0, width: 0, maxHeight: 0 }; + this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; + this.textBorderWidth = core.config.textBorderWidth; + this.gamma = 0; + this.gridMajorThickness = core.config.axesGridMajorThickness; + this.gridMinorThickness = core.config.axesGridMinorThickness; + this.gridZeroThickness = core.config.axesGridZeroThickness; + this._font = core.font; + this.isGridPickingEnabled = false; + } + update(elapsedTime) { + } + } + let Quad$3 = class Quad { + static positions(transform2) { + const positions2 = new Float32Array(12); + const position2 = create$6(); + for (let i = 0; i < 4; i++) { + set$8(position2, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); + transformMat4$2(position2, position2, transform2); + positions2[i * 3] = position2[0]; + positions2[i * 3 + 1] = position2[1]; + positions2[i * 3 + 2] = position2[2]; + } + return positions2; + } + static textured(transform2, texTransform = Constants$1.MAT4_IDENTITY) { + const positions2 = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions2.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$6(); + const texCoord = create$3(); + for (let i = 0; i < positions2.length / PositionVertex.SIZE; i++) { + set$8(position2, positions2[i * PositionVertex.SIZE], positions2[i * PositionVertex.SIZE + 1], positions2[i * PositionVertex.SIZE + 2]); + set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionTextureVertex.setPosition(verticesView, i, position2); + PositionTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + static normalTextured(transform2, texTransform = Constants$1.MAT4_IDENTITY) { + const positions2 = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions2.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$6(); + const texCoord = create$3(); + const normal3 = create$6(); + const normal4 = create$5(); + for (let i = 0; i < positions2.length / PositionVertex.SIZE; i++) { + set$8(position2, positions2[i * PositionVertex.SIZE], positions2[i * PositionVertex.SIZE + 1], positions2[i * PositionVertex.SIZE + 2]); + set$5(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionNormalTextureVertex.setPosition(verticesView, i, position2); + set$7(normal4, 0, 0, 1, 0); + transformMat4$1(normal4, normal4, transform2); + set$8(normal3, normal4[0], normal4[1], normal4[2]); + normalize$5(normal3, normal3); + PositionNormalTextureVertex.setNormal(verticesView, i, normal3); + PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + }; + Quad$3.FACE_NORMALS = [ + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$3.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Quad$3.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0) + ]; + Quad$3.EDGE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0) + ]; + Quad$3.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0) + ]; + Quad$3.EDGE_FORWARDS = [ + fromValues$3(0, 0, -1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$3.AXIS_EDGES = [ + [0, 2], + [1, 3] + ]; + Quad$3.POSITIONS = new Float32Array([ -0.5, 0.5, 0, @@ -17607,23958 +8454,13859 @@ Quad.POSITIONS = new Float32Array([ 0.5, -0.5, 0 -]); -Quad.INDICES = new Uint16Array([ - 0, - 2, - 1, - 1, - 2, - 3 -]); -Quad.TEX_COORDS = new Float32Array([ - 0, - 1, - 1, - 1, - 0, - 0, - 1, - 0 -]); -class Grid { - static positions(cols, rows, transform) { - const vertices = new Float32Array((cols + 1) * (rows + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec3).set(position, col / cols - 0.5, 0.5 - row / rows, 0); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - return vertices; - } - static indices(cols, rows) { - const indices = new Uint16Array(cols * rows * 6); - let index = 0; - for(let row = 0; row < rows; row++)for(let col = 0; col < cols; col++){ - indices[index++] = col + row * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1) + 1; - } - return indices; - } - static textured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static normalTextured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, index, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static _texCoords(cols, rows, transform) { - const texCoords = new Float32Array((cols + 1) * (rows + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec2).set(texCoord, col / cols, 1 - row / rows); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"99ajO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisHelper", ()=>AxisHelper); -class AxisHelper { - static continuous(options) { - const labels = []; - const positions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - for(let i = 0; i <= options.divisions; i++){ - positions.push(options.divisions == 0 ? 0.5 : i / options.divisions); - const value = options.divisions == 0 ? (options.min + options.max) / 2 : options.min + i * (options.max - options.min) / options.divisions; - labels.push(label(value)); - if (i == 0) fromValues.push(options.min); - else if (i < options.divisions) { - toValues.push(value); - fromValues.push(value); - } - } - toValues.push(options.max); - return { - labels: labels, - positions: positions, - fromValues: fromValues, - toValues: toValues - }; - } - static discrete(options) { - const divisions = options.maxDivisions !== undefined ? Math.min(options.divisions, options.maxDivisions) : options.divisions; - const divisionStep = 1 / options.divisions; - const labelStep = 1 / divisions; - const valueStep = (options.max - options.min + 1) / options.divisions; - let nextDivision, toValue, nextPosition; - const labels = []; - const labelPositions = []; - const tickPositions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - const fromToLabel = options.fromToLabel || ((fromValue, toValue)=>{ - return `${label(fromValue)}-${label(toValue)}`; - }); - for(let i = 0; i < divisions; i++){ - const division = Math.round(i * labelStep / divisionStep); - const tickPosition = division / options.divisions; - const fromValue = options.min + Math.ceil(division * valueStep); - if (i == divisions - 1) { - nextDivision = divisions; - nextPosition = 1; - toValue = options.max; - } else { - nextDivision = Math.round((i + 1) * labelStep / divisionStep); - nextPosition = nextDivision / options.divisions; - toValue = options.min + Math.ceil(nextDivision * valueStep) - 1; - } - labelPositions.push((tickPosition + nextPosition) / 2); - labels.push(fromValue == toValue ? label(fromValue) : fromToLabel(fromValue, toValue)); - fromValues.push(fromValue); - toValues.push(toValue); - tickPositions.push(tickPosition); + ]); + Quad$3.INDICES = new Uint16Array([0, 2, 1, 1, 2, 3]); + Quad$3.TEX_COORDS = new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]); + class TextHelper { + static truncate(text2, length2) { + return text2.length > length2 ? `${text2.substr(0, length2 - 1)}…` : text2; + } + static measure(font2, text2, size) { + size.width = 0; + let maxDescent = 0; + for (const char of text2) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; } - tickPositions.push(1); - return { - labels: labels, - labelPositions: labelPositions, - tickPositions: tickPositions, - fromValues: fromValues, - toValues: toValues - }; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fG2oi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextHelper", ()=>TextHelper); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -class TextHelper { - static truncate(text, length) { - return text.length > length ? `${text.substr(0, length - 1)}\u{2026}` : text; - } - static measure(font, text, size) { - size.width = 0; - let maxDescent = 0; - for (const char of text){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - size.width += glyph.advance; - size.maxTop = Math.max(glyph.top, size.maxTop); - maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + size.width += glyph.advance; + size.maxTop = Math.max(glyph.top, size.maxTop); + maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + } + size.maxHeight = size.maxTop + maxDescent; + } + static wrap(font2, text2, maxWidth) { + const lines = []; + let width2 = 0; + let start = 0; + let lastBreakingChar = -1; + let widthAfterLastBreakingChar = 0; + for (let i = 0; i < text2.length; i++) { + let char = text2.charAt(i); + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + width2 += glyph.advance; + if (char == " " || char == "-") { + widthAfterLastBreakingChar = width2; + lastBreakingChar = i; + } + if (width2 > maxWidth) { + if (lastBreakingChar == -1) { + lines.push(text2.substring(start, i)); + start = i; + width2 += glyph.advance; + } else { + lines.push(text2.substring(start, lastBreakingChar)); + start = lastBreakingChar + 1; + width2 -= widthAfterLastBreakingChar; + widthAfterLastBreakingChar = 0; + lastBreakingChar = -1; + } } - size.maxHeight = size.maxTop + maxDescent; + } + lines.push(text2.substring(start, text2.length)); + return lines; } - static wrap(font, text, maxWidth) { - const lines = []; - let width = 0; - let start = 0; - let lastBreakingChar = -1; - let widthAfterLastBreakingChar = 0; - for(let i = 0; i < text.length; i++){ - let char = text.charAt(i); - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - width += glyph.advance; - if (char == " " || char == "-") { - widthAfterLastBreakingChar = width; - lastBreakingChar = i; - } - if (width > maxWidth) { - if (lastBreakingChar == -1) { - lines.push(text.substring(start, i)); - start = i; - width += glyph.advance; - } else { - lines.push(text.substring(start, lastBreakingChar)); - start = lastBreakingChar + 1; - width -= widthAfterLastBreakingChar; - widthAfterLastBreakingChar = 0; - lastBreakingChar = -1; - } - } - } - lines.push(text.substring(start, text.length)); - return lines; + static addString(font2, text2, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + for (const char of text2) { + this.addGlyph(font2, char, vertices, indices, index2++, position2, scale2, offset2, rotation2, idColor); + } } - static addString(font, text, vertices, indices, index, position, scale, offset, rotation, idColor) { - for (const char of text)this.addGlyph(font, char, vertices, indices, index++, position, scale, offset, rotation, idColor); + static addGlyph(font2, char, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + const vertexOffset = index2 * 4; + const width2 = glyph.width * scale2; + const height2 = glyph.height * scale2; + const top = glyph.top * scale2; + const border = font2.border * scale2; + const x02 = offset2[0] - border; + const x12 = offset2[0] + width2 + border; + const y02 = offset2[1] + top + border; + const y12 = offset2[1] + top - height2 - border; + const z02 = offset2[2]; + set$8(this._topLeft, x02, y02, z02); + set$8(this._topRight, x12, y02, z02); + set$8(this._bottomLeft, x02, y12, z02); + set$8(this._bottomRight, x12, y12, z02); + if (rotation2) { + transformQuat(this._topLeft, this._topLeft, rotation2); + transformQuat(this._topRight, this._topRight, rotation2); + transformQuat(this._bottomLeft, this._bottomLeft, rotation2); + transformQuat(this._bottomRight, this._bottomRight, rotation2); + } + add$4(this._vec3, this._topLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); + add$4(this._vec3, this._topRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); + add$4(this._vec3, this._bottomLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); + add$4(this._vec3, this._bottomRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); + set$5(this._vec2, glyph.u0, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); + set$5(this._vec2, glyph.u1, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); + set$5(this._vec2, glyph.u0, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); + set$5(this._vec2, glyph.u1, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); + offset2[0] += glyph.advance * scale2; + const indexTemplate = Quad$3.INDICES; + const indexOffset = index2 * 6; + for (let i = 0; i < 6; i++) { + indices[indexOffset + i] = indexTemplate[i] + vertexOffset; + } } - static addGlyph(font, char, vertices, indices, index, position, scale, offset, rotation, idColor) { - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const vertexOffset = index * 4; - const width = glyph.width * scale; - const height = glyph.height * scale; - const top = glyph.top * scale; - const border = font.border * scale; - const x0 = offset[0] - border; - const x1 = offset[0] + width + border; - const y0 = offset[1] + top + border; - const y1 = offset[1] + top - height - border; - const z0 = offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (rotation) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, rotation); - } - (0, _glMatrix.vec3).add(this._vec3, this._topLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._topRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 1, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 2, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 3, this._vec3); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 1, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 2, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 3, this._vec2); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 1, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 2, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 3, idColor); - offset[0] += glyph.advance * scale; - const indexTemplate = (0, _quadJs.Quad).INDICES; - const indexOffset = index * 6; - for(let i = 0; i < 6; i++)indices[indexOffset + i] = indexTemplate[i] + vertexOffset; - } -} -TextHelper._vec2 = (0, _glMatrix.vec2).create(); -TextHelper._vec3 = (0, _glMatrix.vec3).create(); -TextHelper._topLeft = (0, _glMatrix.vec3).create(); -TextHelper._topRight = (0, _glMatrix.vec3).create(); -TextHelper._bottomLeft = (0, _glMatrix.vec3).create(); -TextHelper._bottomRight = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","../vertex.js":"4J2YE","../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1t2sb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickHelper", ()=>PickHelper); -class PickHelper { + } + TextHelper._vec2 = create$3(); + TextHelper._vec3 = create$6(); + TextHelper._topLeft = create$6(); + TextHelper._topRight = create$6(); + TextHelper._bottomLeft = create$6(); + TextHelper._bottomRight = create$6(); + class PickHelper { static nextPickId() { - return this._pickId++; - } - static encodeNumber(number, type, color) { - const encoded = number | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16); - } - static encodeVec3(vec3, type, color) { - const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeVec3(color, axes) { - axes[0] = color[0]; - axes[1] = color[1]; - axes[2] = color[2]; - } - static encodeType(type) { - return type << 24; - } - static decodeType(color) { - return color[3]; - } - static float32ToVec4(number, color) { - color[0] = ((number & 0xFF) >>> 0) / 0xFF; - color[1] = ((number & 0xFF00) >>> 8) / 0xFF; - color[2] = ((number & 0xFF0000) >>> 16) / 0xFF; - color[3] = ((number & 0xFF000000) >>> 24) / 0xFF; - } - static uint8ArrayToNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16) + (color[3] << 24); - } -} -PickHelper._pickId = 1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d0jS2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>Cartesian2dAxesHelper); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>Cartesian2dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian2dAxesHelper { - static create(core, options) { - const cartesian2dAxes = new Cartesian2dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian2dAxes.minBoundsX = minBoundsX; - cartesian2dAxes.minBoundsY = minBoundsY; - cartesian2dAxes.maxBoundsX = maxBoundsX; - cartesian2dAxes.maxBoundsY = maxBoundsY; - cartesian2dAxes.scalingX = scaling; - cartesian2dAxes.scalingY = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, maxBoundsY - minBoundsY); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY - ]; - cartesian2dAxes.isDiscreteX = options.isDiscreteX; - cartesian2dAxes.isDiscreteY = options.isDiscreteY; - cartesian2dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY - ]; - const isLabelPickingEnabled = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY - ]; - const labelsArray = [ - options.labelsX, - options.labelsY - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const arePickDivisionsVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY - ]; - const minValueArray = [ - minValueX, - minValueY - ]; - const maxValueArray = [ - maxValueX, - maxValueY - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY - ]; - const titleArray = [ - options.titleX, - options.titleY - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY - ]; - const headingArray = [ - options.headingX, - options.headingY - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY - ]; - for(let axisId = 0; axisId < 2; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian2dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian2dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian2dAxes.setLabels(axisId, discreteAxis.labels); - cartesian2dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian2dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian2dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian2dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian2dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabels(axisId, continuousAxis.labels); - cartesian2dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian2dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian2dAxes.setLabelSizes(axisId, labelSizes); - cartesian2dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian2dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian2dAxes.setTitle(axisId, titleArray[axisId]); - cartesian2dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian2dAxes.setHeading(axisId, headingArray[axisId]); - cartesian2dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian2dAxes.arePickDivisionsVisible[axisId] = arePickDivisionsVisibleArray[axisId] === undefined ? true : arePickDivisionsVisibleArray[axisId]; - cartesian2dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian2dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabled[axisId]; - cartesian2dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian2dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian2dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian2dAxes; - } -} -class Cartesian2dAxes extends (0, _axesJs.AxesBase) { + return this._pickId++; + } + static encodeNumber(number2, type2, color2) { + const encoded = number2 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16); + } + static encodeVec3(vec3, type2, color2) { + const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeVec3(color2, axes) { + axes[0] = color2[0]; + axes[1] = color2[1]; + axes[2] = color2[2]; + } + static encodeType(type2) { + return type2 << 24; + } + static decodeType(color2) { + return color2[3]; + } + static float32ToVec4(number2, color2) { + color2[0] = ((number2 & 255) >>> 0) / 255; + color2[1] = ((number2 & 65280) >>> 8) / 255; + color2[2] = ((number2 & 16711680) >>> 16) / 255; + color2[3] = ((number2 & 4278190080) >>> 24) / 255; + } + static uint8ArrayToNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16) + (color2[3] << 24); + } + } + PickHelper._pickId = 1; + class Cartesian3dAxes extends AxesBase { get size() { - return this._size; + return this._size; } get isDiscreteX() { - return this._isDiscrete[0]; + return this._isDiscrete[0]; } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } get isDiscreteY() { - return this._isDiscrete[1]; + return this._isDiscrete[1]; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } + } + get isDiscreteZ() { + return this._isDiscrete[2]; + } + set isDiscreteZ(value2) { + if (value2 != this._isDiscrete[2]) { + this._isDiscrete[2] = value2; + this._hasChanged = true; + } } get minBoundsX() { - return this._minBoundsX; + return this._minBoundsX; } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } get maxBoundsX() { - return this._maxBoundsX; + return this._maxBoundsX; } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } get minBoundsY() { - return this._minBoundsY; + return this._minBoundsY; } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } get maxBoundsY() { - return this._maxBoundsY; + return this._maxBoundsY; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; + get minBoundsZ() { + return this._minBoundsZ; + } + set minBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._minBoundsZ = value2; + this._hasChanged = true; + } + } + get maxBoundsZ() { + return this._maxBoundsZ; + } + set maxBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } + } + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; } - getIsForwardFace(index) { - return this._isForwardFace[index]; + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } get textVertices() { - return this._textVertices; + return this._textVertices; } get textIndices() { - return this._textIndices; + return this._textIndices; } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } - getLabelOrientation(index) { - return this._orientations[index]; + getLabelOrientation(index2) { + return this._orientations[index2]; } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } get gridVertices() { - return this._gridVertices; + return this._gridVertices; } get gridIndices() { - return this._gridIndices; + return this._gridIndices; } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; } - getGridTicksScale(index) { - return this._gridTicksScales[index]; + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; + getGridFaceZero(index2) { + return this._gridFaceZeros[index2]; } - get gridFaceZero() { - return this._gridFaceZeros; + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; } - get gridFaceMinorGridlines() { - return this._gridFaceMinorGridlines; + getGridFaceMinorGridlines(index2) { + return this._gridFaceMinorGridlines[index2]; } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } } get scalingX() { - return this._scalingX; + return this._scalingX; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } } get scalingY() { - return this._scalingY; + return this._scalingY; } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } + } + get scalingZ() { + return this._scalingZ; + } + set scalingZ(value2) { + if (value2 != this._scalingZ) { + this._scalingZ = value2; + this._hasChanged = true; + } } get offsetX() { - return this._offset[12]; + return this._offset[12]; } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } } get offsetY() { - return this._offset[13]; - } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; - } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._rMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromQuat(this._rMatrix, value); - } - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 2; i++)this._isForwardFace.push(false); - for(let i = 0; i < 4; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 4; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 2; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 2; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 2; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 4; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 2; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = (0, _glMatrix.vec2).create(); - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = (0, _glMatrix.vec2).create(); - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 2; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 4; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _quadJs.Quad).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _quadJs.Quad).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _quadJs.Quad).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _quadJs.Quad).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _quadJs.Quad).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _quadJs.Quad).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _quadJs.Quad).EDGE_POSITIVES[i], (0, _quadJs.Quad).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null - ]; - this._toValues = [ - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false - ]; - this.isAxisReversed = [ - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._offset = (0, _glMatrix.mat4).create(); + return this._offset[13]; + } + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } + } + get offsetZ() { + return this._offset[14]; + } + set offsetZ(value2) { + if (value2 != this._offset[14]) { + this._offset[14] = value2; + } + } + constructor(core) { + super(core); + this._size = create$6(); + this._translation = create$6(); + this._normal = create$6(); + this._forward = create$6(); + this._right = create$6(); + this._up = create$6(); + this._texCoord = create$3(); + this._bounds = create$5(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mat3 = create$8(); + this._isDiscrete = [false, false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._minBoundsZ = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._maxBoundsZ = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 6; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 12; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$6(); + this._textPosition = create$6(); + this._distances = []; + for (let i = 0; i < 12; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 3; i++) { + this._maxLabelSize.push(create$3()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._labelMMatrices.push(create$7()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 3; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._titleMMatrices.push(create$7()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 3; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._headingMMatrices.push(create$7()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$6(); + this._edgePositive = create$6(); + this._edgeNormal = create$6(); + this._edgeNormalTemp = create$6(); + this._edgePositiveTemp = create$6(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 12; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$6()); + this._edgeHorizontalUp.push(create$6()); + this._edgeHorizontalForward.push(create$6()); + this._edgeVerticalRight.push(create$6()); + this._edgeVerticalUp.push(create$6()); + this._edgeVerticalForward.push(create$6()); + } + this.isFaceVisible = []; + for (let i = 0; i < 6; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$3.INDICES; + this.zero = create$6(); + this._gridTicksZeros = []; + this._gridFaceZeros = []; + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = []; + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$6(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 3; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create$3()); + this._gridFaceZeros.push(create$3()); + this._gridTicksMinorGridlines.push(create$3()); + this._gridFaceMinorGridlines.push(create$3()); + this._gridTicksScales.push(create$6()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + } + for (let i = 0; i < 6; i++) { + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$7()); + } + for (let i = 0; i < 12; i++) { + this._gridTicksMMatrices.push(create$7()); + this._gridTicksRotations.push(create$7()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Cube.EDGE_POSITIVES[i][0]; + _mat4[1] = Cube.EDGE_POSITIVES[i][1]; + _mat4[2] = Cube.EDGE_POSITIVES[i][2]; + _mat4[4] = Cube.EDGE_NORMALS[i][0]; + _mat4[5] = Cube.EDGE_NORMALS[i][1]; + _mat4[6] = Cube.EDGE_NORMALS[i][2]; + cross$1(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null, null]; + this._toValues = [null, null, null]; + this.isDivisionPickingEnabled = [false, false, false]; + this.isLabelPickingEnabled = [false, false, false]; + this.isTitlePickingEnabled = [false, false, false]; + this.isHeadingPickingEnabled = [false, false, false]; + this.isAxisReversed = [false, false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._scalingZ = 1; + this._offset = create$7(); } initialize() { - this._isInitialized = true; + this._isInitialized = true; } update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); - const maxBounds = Math.max(this._size[0], this._size[1]); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); - } - if (this._rMatrix) { - (0, _glMatrix.mat4).mul(this._mMatrix, this.mMatrix, this._rMatrix); - (0, _glMatrix.mat4).mul(this._mMatrix, this._mMatrix, this._offset); - } else (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 2; faceId++){ - (0, _glMatrix.vec3).transformMat4(this._forward, (0, _constantsJs.Constants).VECTOR3_ZERO, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 4; edgeId++){ - this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _quadJs.Quad).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 2; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); + const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._size[2] *= this._scalingZ / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); + } + multiply$2(this._mMatrix, this.mMatrix, this._offset); + this._mvMatrix = create$7(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 6; faceId++) { + multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); + transformMat4$2(this._forward, this._vec3, this._mvMatrix); + transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 12; edgeId++) { + const faceIds = Cube.EDGE_FACES[edgeId]; + const forward1 = this._isForwardFace[faceIds[0]]; + const forward2 = this._isForwardFace[faceIds[1]]; + const outsideEdge = forward1 != forward2; + this._isOutsideEdge[edgeId] = outsideEdge; + if (outsideEdge) { + this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; + } + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$1.VECTOR3_REFLECTX); } + scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } } - (0, _glMatrix.vec2).set(this._gridFaceZeros, this.zero[0], this.zero[1]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); - for(let faceId = 0; faceId < 2; faceId++)if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - } - for(let axisId = 0; axisId < 2; axisId++)for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); + } + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + set$5(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); + set$5(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + if (this._size[axisId] > 0) { + translate$2(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); + } + } + } + } + for (let axisId = 0; axisId < 3; axisId++) { + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId]) { + multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$5(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross$1(this._right, Constants$1.VECTOR3_UNITY, this._forward); + normalize$5(this._right, this._right); + cross$1(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); + copy$6(this._edgeNormalTemp, this._edgeNormal); + copy$6(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$6(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$6(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$6(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$6(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } } + } } + } } _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; - } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { const right = this._edgeHorizontalRight[edgeId]; const up = this._edgeHorizontalUp[edgeId]; const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants$1.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; + } + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; } _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 2; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - const axisId = 2; - this._gridFaceScale[axisId] = 1; - for(let faceId = 0; faceId < 2; faceId++)offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId = 0; axisId < 3; axisId++) { + const width2 = size[axisId]; + set$8(this._gridTicksScales[axisId], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset2); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } + this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; + } } _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 2; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 3; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._labels[axisId]) { + const width2 = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set$5(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._titles[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._headings[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; } + } } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (position2 - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (position2 - 0.5) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } - return glyphOffset; - } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (0.5 - position2) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (0.5 - position2) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; } + break; } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$6(); + const positions2 = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const right = isAxisReversed ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$7(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../main.js":"f421K","./axes.js":"8Tmim","../../meshes/quad.js":"3PqJr","../../vertex.js":"4J2YE","../../helpers/axes.js":"99ajO","../../helpers/text.js":"fG2oi","../../helpers/pick.js":"1t2sb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ibkbS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Glyph", ()=>Glyph); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -parcelHelpers.export(exports, "Font", ()=>Font); -parcelHelpers.export(exports, "FontAtlas", ()=>FontAtlas); -parcelHelpers.export(exports, "FontRasterizer", ()=>FontRasterizer); -parcelHelpers.export(exports, "GlyphRasterizer", ()=>GlyphRasterizer); -var _mainJs = require("./main.js"); -class Glyph { - toJSON() { - return { - key: this.key, - char: this.char, - width: this.width, - height: this.height, - top: this.top, - left: this.left, - advance: this.advance, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$8(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$6(); + negate(this._normal, Cube.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$7(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } -} -class FontVisual { - update() {} - constructor(font){ - this.font = font; + } + class Cartesian2dAxes extends AxesBase { + get size() { + return this._size; } -} -class Font { - get atlas() { - return this._rasterizer.fontAtlas; + get isDiscreteX() { + return this._isDiscrete[0]; } - get count() { - return this._chars.size; + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._chars = new Set(); - this._previousSize = 0; - this.glyphs = {}; + get isDiscreteY() { + return this._isDiscrete[1]; } - addGlyph(char) { - if (!this._chars.has(char)) { - this._chars.add(char); - this._rasterizer.draw(char); - this._hasChanged = true; - } + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); - this._previousSize = this._chars.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } + get minBoundsX() { + return this._minBoundsX; } - toJSON() { - const glyphs = []; - for(let key in this.glyphs){ - const glyph = this.glyphs[key]; - glyphs.push(glyph.toJSON()); - } - return { - name: this.name, - size: this.size, - border: this.border, - glyphs: glyphs, - edgeValue: this.edgeValue - }; + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } -} -class FontAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class FontRasterizer { - get font() { - return this._font; + get maxBoundsX() { + return this._maxBoundsX; } - get fontAtlas() { - return this._fontAtlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontAtlas = options.fontAtlas; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._font = new Font(core, this); - this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); - this._font.size = this._fontSize; - this._font.border = this._border; - this._font.edgeValue = this._edgeValue; - const glyphRasterizerOptions = { - baseline: this._baseline, - border: this._border, - edgeValue: this._edgeValue, - fontFamily: this._fontFamily, - fontSize: this._fontSize, - fontStyle: this._fontStyle, - fontWeight: this._fontWeight, - maxDistance: this._maxDistance - }; - this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - draw(char) { - const glyph = this._glyphRasterizer.draw(char); - const texWidth = glyph.width + 2 * this._border; - const texHeight = glyph.height + 2 * this._border; - const width = this._fontAtlas.imageData.width; - const height = this._fontAtlas.imageData.height; - if (this._fontAtlas.x + texWidth > width) this._fontAtlas.x = 0; - let y = 0; - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)y = Math.max(y, this._fontAtlas.top[x]); - if (y + texHeight > height) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._font.name} height overflow`); - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)this._fontAtlas.top[x] = y + texHeight; - glyph.u0 = this._fontAtlas.x / width; - glyph.v0 = y / height; - glyph.u1 = (this._fontAtlas.x + texWidth) / width; - glyph.v1 = (y + texHeight) / height; - this._font.glyphs[char] = glyph; - for(let i = 0; i < glyph.distances.length; i++){ - const distance = glyph.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._fontAtlas.x + dataX + (y + dataY) * width) * 4; - this._fontAtlas.imageData.data[offset + 0] = distance; - this._fontAtlas.imageData.data[offset + 1] = distance; - this._fontAtlas.imageData.data[offset + 2] = distance; - this._fontAtlas.imageData.data[offset + 3] = 0xff; - } - this._fontAtlas.x += texWidth; - } -} -class GlyphRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._size = this._fontSize + this._border * 2; - this._size += this._border * 2; - this._gridOuter = new Float64Array(this._size * this._size); - this._gridInner = new Float64Array(this._size * this._size); - this._f = new Float64Array(this._size); - this._z = new Float64Array(this._size + 1); - this._v = new Uint16Array(this._size); - const canvas = document.createElement("canvas"); - canvas.width = canvas.height = this._size; - this._context = canvas.getContext("2d", { - willReadFrequently: true - }); - this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; - this._context.textBaseline = this._baseline; - this._context.textAlign = "left"; - this._context.fillStyle = "black"; - this._core.log.write((0, _mainJs.LogLevel).info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); + get minBoundsY() { + return this._minBoundsY; } - draw(char) { - const textMetrics = this._context.measureText(char); - const glyphLeft = 0; - const glyphTop = Math.floor(textMetrics.actualBoundingBoxAscent); - let glyphWidth = Math.ceil(textMetrics.actualBoundingBoxRight); - let glyphHeight = Math.ceil(textMetrics.actualBoundingBoxAscent) + Math.ceil(textMetrics.actualBoundingBoxDescent); - glyphWidth = Math.min(this._size - this._border, glyphWidth); - glyphHeight = Math.min(this._size - this._border, glyphHeight); - const width = glyphWidth + 2 * this._border; - const height = glyphHeight + 2 * this._border; - const length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const glyph = new Glyph(); - glyph.char = char; - glyph.key = char.codePointAt(0); - glyph.distances = distances; - glyph.gradientsX = gradientsX; - glyph.gradientsY = gradientsY; - glyph.pixels = pixels; - glyph.width = glyphWidth; - glyph.height = glyphHeight; - glyph.top = glyphTop; - glyph.left = glyphLeft; - glyph.advance = textMetrics.width; - if (glyphWidth == 0 || glyphHeight == 0) return glyph; - this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); - this._context.fillText(char, this._border, this._border + glyphTop); - const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < glyphHeight; y++)for(let x = 0; x < glyphWidth; x++){ - const a = imgData.data[4 * (y * glyphWidth + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - pixels[j] = 0xff; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return glyph; + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8nDg6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manager", ()=>Manager); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _animationJs = require("../helpers/animation.js"); -var _constantsJs = require("../constants.js"); -var _keyboardJs = require("./keyboard.js"); -class Manager { - constructor(core){ - this._manipulators = {}; - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._manipulationProcessor = new (0, _manipulationprocessorJs.ManipulationProcessor)(core); - this._manipulators = {}; - this._pointers = new (0, _pointersJs.Pointers)(core, this._manipulators); - this._pointers.initialize(core.container); - this._mouseWheel = new (0, _mousewheelJs.MouseWheel)(core); - this._mouseWheel.initialize(core.container); - this._keyboard = new (0, _keyboardJs.Keyboard)(core); - this._keyboard.initialize(core.container); - this.isPickingEnabled = true; - this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; - this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; - this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; - this.pickHoldDelay = this._core.config.pickHoldDelay; - this.pickSelectDelay = this._core.config.pickSelectDelay; - const rightButton = 2; - this.singleTouchAction = (manipulator)=>{ - if (manipulator.type == "mouse" && manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _mainJs.SingleTouchAction).translate; - else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton) return (0, _mainJs.SingleTouchAction).lasso; - else return (0, _mainJs.SingleTouchAction).rotate; - }; - this.mouseWheelAction = (keyboard)=>{ - if (this._keyboard.isKeyDown("Control")) return (0, _mainJs.MouseWheelAction).rotateY; - else return (0, _mainJs.MouseWheelAction).zoom; - }; - this.lassoPickType = (0, _mainJs.PickType).data; - this._thumbstickX = 0; - this._previousControllerButtonPressed = [ - false, - false, - false, - false - ]; - this._quat0 = (0, _glMatrix.quat).create(); - this._quat1 = (0, _glMatrix.quat).create(); + get maxBoundsY() { + return this._maxBoundsY; } - update(elapsedTime, xrFrame) { - if (xrFrame) { - const inputSources = this._core.webXRSession.inputSources; - if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { - const inputSource = inputSources[0]; - const controllerVisual = this._core.renderer.controllers[0]; - if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { - const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); - if (gripPose) controllerVisual.mMatrix = gripPose.transform.matrix; - const gamepad = inputSource.gamepad; - this._core.renderer.isPickingEnabled = false; - const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); - if (rayPose) { - controllerVisual.rayMMatrix = rayPose.transform.matrix; - if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { - this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; - this._core.renderer.isPickingEnabled = true; - } - } - const threshold = 0.2; - const dampening = Math.min(0.015 * elapsedTime, 1); - this._thumbstickX = (0, _animationJs.AnimationHelper).damp(this._thumbstickX, gamepad.axes[2], threshold, dampening); - if (this._thumbstickX != 0) { - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); - this._core.getModelRotation(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat0, this._quat1); - this._core.setModelRotation(this._quat1, true); - } - if (gamepad.buttons[2].pressed) { - if (!this._previousControllerButtonPressed[2]) { - this._previousControllerButtonPressed[2] = true; - if (this.controllerButtonPressedCallback) this.controllerButtonPressedCallback(2); - } - } else this._previousControllerButtonPressed[2] = false; - } - } - } else { - const camera = this._core.camera; - this._manipulationProcessor.update(elapsedTime, this._manipulators); - this._pointers.update(elapsedTime); - this._mouseWheel.update(elapsedTime); - this._keyboard.update(elapsedTime); - if (this._mouseWheel.delta != 0) switch(this.mouseWheelAction(this._keyboard)){ - case (0, _mainJs.MouseWheelAction).zoom: - if (this._pointers.hoverX, this._pointers.hoverY) camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); - break; - case (0, _mainJs.MouseWheelAction).rotateY: - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); - camera.getOrbit(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat1, this._quat0); - camera.setOrbit(this._quat1, true); - break; - } - const count = this._manipulationProcessor.count; - if (count == 0) { - if (this._isLassoPicking) { - this._isLassoPicking = false; - this._core.renderer.isLassoPicking = false; - const x0 = Math.min(this._lassoX0, this._lassoX1); - const y0 = Math.min(this._lassoY0, this._lassoY1); - const x1 = Math.max(this._lassoX0, this._lassoX1); - const y1 = Math.max(this._lassoY0, this._lassoY1); - if (x1 - x0 > 0 && y1 - y0 > 0) { - const sets = this._core.pickLasso(x0, y0, x1, y1, this.lassoPickType); - const result = { - x0: x0, - y0: y0, - x1: x1, - y1: y1, - pickType: this.lassoPickType, - ids: sets, - manipulator: this._manipulator - }; - this.pickLassoCallback(result); - } - } - } else if (count == 1) { - const translationDelta = this._manipulationProcessor.translationDelta; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - const manipulators = this._manipulationProcessor.manipulators; - for(const key in manipulators){ - const manipulator = manipulators[key]; - switch(this.singleTouchAction(manipulator)){ - case (0, _mainJs.SingleTouchAction).rotate: - camera.rotate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).translate: - camera.translate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).lasso: - if (this.pickLassoCallback) { - if (!this._isLassoPicking) { - this._isLassoPicking = true; - this._core.renderer.isLassoPicking = true; - this._lassoX0 = manipulator.position[0]; - this._lassoY0 = manipulator.position[1]; - } - this._lassoX1 = manipulator.position[0]; - this._lassoY1 = manipulator.position[1]; - this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); - this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); - } - break; - } - break; - } - } - } else { - const translationDelta = this._manipulationProcessor.translationDelta; - const camera = this._core.camera; - if (translationDelta[0] != 0 || translationDelta[1] != 0) camera.translate(translationDelta); - if (this._manipulationProcessor.scaleDelta != 0) { - const distance = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; - camera.zoom(distance, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this._manipulationProcessor.twistDelta != 0) camera.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { - const camera = this._core.camera; - const renderer = this._core.renderer; - if (renderer.isCapturingPickImage) { - camera.updatePickVMatrix(renderer.width / 2, renderer.height / 2); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - this._pickedTime = 0; - } else if (this._pointers.hoverId > -1) { - const pickingX = this._pointers.hoverX; - const pickingY = this._pointers.hoverY; - camera.updatePickVMatrix(pickingX, pickingY); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - if (this._pickedId != renderer.pickedId) { - this._pickedId = renderer.pickedId; - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 1) { - this._pickedTime += elapsedTime; - for(const key in this._manipulators){ - this._manipulator = this._manipulators[key]; - break; - } - } - if (this._pickedTime > 0) switch(renderer.pickedType){ - case (0, _mainJs.PickType).data: - if (this._pickedTime > this.pickHoldDelay) { - renderer.getVertexPosition(this._vec3, this._pickedId); - this._core.setModelManipulationOrigin(this._vec3); - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.transitionBuffers.length; i++){ - const transitionBuffer = renderer.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - transitionBuffer: i, - id: id, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked id ${result.id}, transition buffer ${i}`); - if (this.pickItemCallback) this.pickItemCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).label: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.labelSets.length; i++){ - const labelSet = renderer.labelSets[i].label; - const id = labelSet.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - label: id, - set: i, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, set ${result.set}`); - if (this.pickLabelSetCallback) this.pickLabelSetCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesDivision: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickGridLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickGrid(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); - if (this.pickAxesGridCallback) this.pickAxesGridCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesTitle: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickTitleLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickTitle(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked title ${result.axis}, axes ${result.axes}`); - if (this.pickAxesTitleCallback) this.pickAxesTitleCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesLabel: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickLabelLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickLabel(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); - if (this.pickAxesLabelCallback) this.pickAxesLabelCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesHeading: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickHeadingLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickHeading(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked heading ${result.axis}, axes ${result.axes}`); - if (this.pickAxesHeadingCallback) this.pickAxesHeadingCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - } - } else { - renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } else { - this._core.renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); - this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); - } - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","./manipulationprocessor.js":"20HDq","./mousewheel.js":"dfHmP","./pointers.js":"7LFJO","../helpers/animation.js":"02nn8","../constants.js":"lD0bG","./keyboard.js":"fXys0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"20HDq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>ManipulationProcessor); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("../helpers/math.js"); -var _angleJs = require("../helpers/angle.js"); -class ManipulationProcessor { - get manipulators() { - return this._manipulators; + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - get count() { - return this._count; + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; } - get isDragging() { - return this._isDragging; - } - constructor(core){ - this._core = core; - this._count = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._previousCentroid = (0, _glMatrix.vec3).create(); - this._relativePositionToCentroid = (0, _glMatrix.vec3).create(); - this._directionToCentroid = (0, _glMatrix.vec3).create(); - this._previousDirectionToCentroid = (0, _glMatrix.vec3).create(); - this._manipulators = {}; - this._removedManipulators = []; - this.cumulativeTranslation = (0, _glMatrix.vec3).create(); - this.translationDelta = (0, _glMatrix.vec3).create(); - this.centroid = (0, _glMatrix.vec3).create(); - this.maxScale = Number.MAX_VALUE; - this.twistAxis = (0, _glMatrix.vec3).fromValues(0, 0, 1); - this.initialize(); + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } - update(elapsedTime, manipulators) { - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (!manipulators[manipulator.id]) { - if (this.removeManipulator) this.removeManipulator(manipulator); - this._removedManipulators.push(manipulator.id); - } - } - if (this._removedManipulators.length > 0) { - for(let i = 0; i < this._removedManipulators.length; i++){ - delete this._manipulators[this._removedManipulators[i]]; - this._count--; - } - this._removedManipulators = []; - } - for(const key in manipulators){ - const manipulator = manipulators[key]; - if (!this._manipulators[manipulator.id]) { - if (!this.addManipulator || this.addManipulator(manipulator)) { - (0, _glMatrix.vec3).copy(manipulator.initialPosition, manipulator.position); - this._manipulators[manipulator.id] = manipulator; - this._count++; - } - } - } - (0, _glMatrix.vec3).set(this.translationDelta, 0, 0, 0); - this.scaleDelta = 0; - this.twistDelta = 0; - if (this._count > 0) { - if (this._previousCount > 0) { - if (this.prepareManipulation) this.prepareManipulation(); - this._process(); - if (this.processManipulation) this.processManipulation(elapsedTime); - } else { - this.initialize(); - if (this.beginManipulation) this.beginManipulation(); - } - } else { - if (this._previousCount > 0) { - if (this.endManipulation) this.endManipulation(); - } - } - this._isDragging = this._count == 1 && (0, _glMatrix.vec3).squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; - this._previousCount = this._count; + get textVertices() { + return this._textVertices; } - initialize() { - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - (0, _glMatrix.vec3).set(this.cumulativeTranslation, 0, 0, 0); - this.cumulativeScale = 1; - this.cumulativeTwist = 0; + get textIndices() { + return this._textIndices; } - _process() { - if (this._previousCount > 0) { - let persisted = 0; - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) persisted++; - } - const removed = this._previousCount - persisted; - if (persisted > 0) { - if (removed > 0) (0, _glMatrix.vec3).copy(this._centroid, this._previousCentroid); - else { - (0, _glMatrix.vec3).set(this._centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) (0, _glMatrix.vec3).add(this._centroid, this._centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this._centroid, this._centroid, 1 / persisted); - } - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) { - manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, (0, _glMatrix.vec3).squaredDistance(manipulator.position, manipulator.initialPosition)); - (0, _glMatrix.vec3).add(this.translationDelta, this.translationDelta, manipulator.position); - (0, _glMatrix.vec3).subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); - (0, _glMatrix.vec3).subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); - const distanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(this._relativePositionToCentroid); - if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) this.scaleDelta += 1; - else { - const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); - const previousDistanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(manipulator.previousPositionRelativeToCentroid); - const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); - this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; - (0, _glMatrix.vec3).scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); - (0, _glMatrix.vec3).scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); - this.twistDelta += (0, _angleJs.AngleHelper).signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); - } - } - } - (0, _glMatrix.vec3).scale(this.translationDelta, this.translationDelta, 1 / persisted); - (0, _glMatrix.vec3).add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); - this.scaleDelta /= persisted; - this.cumulativeScale = (0, _mathJs.MathHelper).clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); - this.scaleDelta -= 1; - this.twistDelta /= persisted; - this.cumulativeTwist += this.twistDelta; - } - } - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).add(this.centroid, this.centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this.centroid, this.centroid, 1 / this._count); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); - } - (0, _glMatrix.vec3).copy(this._previousCentroid, this.centroid); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - manipulator.isPersisted = true; - (0, _glMatrix.vec3).copy(manipulator.previousPosition, manipulator.position); - (0, _glMatrix.vec3).copy(manipulator.previousRotationAxis, manipulator.rotationAxis); - (0, _glMatrix.vec3).copy(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); - } - } -} - -},{"gl-matrix":"5x28d","../helpers/math.js":"f65d0","../helpers/angle.js":"53hwW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfHmP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MouseWheel", ()=>MouseWheel); -class MouseWheel { - constructor(core){ - this._core = core; - this._previousTotal = 0; - this.total = 0; - } - initialize(element) { - element.addEventListener("wheel", (e)=>{ - e.preventDefault(); - const wheelEvent = e; - this.total += wheelEvent.deltaY; - }, { - passive: false - }); + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - update(elapsedTime) { - const total = this.total; - this.delta = total - this._previousTotal; - this._previousTotal = total; - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7LFJO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Pointers", ()=>Pointers); -var _manipulatorJs = require("../input/manipulator.js"); -class Pointers { - get hoverX() { - return this._hoverX; + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } - get hoverY() { - return this._hoverY; + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } - get hoverId() { - return this._hoverId; + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } - constructor(core, manipulators){ - this._core = core; - this._manipulators = manipulators; + getLabelOrientation(index2) { + return this._orientations[index2]; } - initialize(element) { - this._element = element; - element.addEventListener("pointerdown", (e)=>this._handlePointerDown(e), { - passive: true - }); - element.addEventListener("pointermove", (e)=>this._handlePointerMove(e), { - passive: true - }); - element.addEventListener("pointerup", (e)=>this._handlePointerUp(e), { - passive: true - }); - element.addEventListener("pointercancel", (e)=>this._handlePointerCancel(e), { - passive: true - }); - element.addEventListener("pointerleave", (e)=>this._handlePointerLeave(e), { - passive: true - }); - element.addEventListener("pointerout", (e)=>this._handlePointerOut(e), { - passive: true - }); + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); - this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); - } + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - _handlePointerDown(e) { - this._element.focus(); - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const manipulator = new (0, _manipulatorJs.Manipulator)(); - const id = e.pointerId; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - manipulator.id = id; - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.type = e.pointerType; - manipulator.button = e.button; - manipulator.shiftKey = e.shiftKey; - manipulator.ctrlKey = e.ctrlKey; - manipulator.altKey = e.altKey; - manipulator.event = e; - this._manipulators[id] = manipulator; - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } - _handlePointerMove(e) { - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - const id = e.pointerId; - const manipulator = this._manipulators[id]; - if (manipulator) { - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.event = e; - } - switch(e.pointerType){ - case "mouse": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - break; - case "pen": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - this._tiltX = e.tiltX; - this._tiltY = e.tiltY; - this._twist = e.twist; - break; - } + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } - _handlePointerUp(e) { - const manipulator = this._manipulators[e.pointerId]; - if (manipulator) manipulator.event = e; - this._remove(e.pointerId); + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } - _handlePointerCancel(e) { - this._remove(e.pointerId); + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } - _handlePointerLeave(e) { - this._resetHover(); - this._remove(e.pointerId); + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; } - _handlePointerOut(e) { - this._resetHover(); - this._remove(e.pointerId); + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; } - _resetHover() { - this._hoverId = null; - this._hoverX = null; - this._hoverY = null; + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - _remove(pointerId) { - const manipulator = this._manipulators[pointerId]; - if (manipulator) delete this._manipulators[pointerId]; - } -} - -},{"../input/manipulator.js":"bYqKJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bYqKJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manipulator", ()=>Manipulator); -var _glMatrix = require("gl-matrix"); -class Manipulator { - constructor(){ - this.pickedIndex = 0; - this.maxTranslationSquared = 0; - this.initialPosition = (0, _glMatrix.vec3).create(); - this.position = (0, _glMatrix.vec3).create(); - this.previousPosition = (0, _glMatrix.vec3).create(); - this.holdOrigin = (0, _glMatrix.vec3).create(); - this.positionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.previousPositionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.rotationAxis = (0, _glMatrix.vec3).create(); - this.previousRotationAxis = (0, _glMatrix.vec3).create(); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"02nn8":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationHelper", ()=>AnimationHelper); -var _mathJs = require("./math.js"); -class AnimationHelper { - static smoothStep(value) { - return value * value * (3 - 2 * value); - } - static damp(value, target, threshold, dampening) { - if (Math.abs(target) < threshold) return (0, _mathJs.MathHelper).lerp(value, 0, dampening); - else return (0, _mathJs.MathHelper).lerp(value, target, dampening); - } -} - -},{"./math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fXys0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>Keyboard); -class Keyboard { - constructor(core){ - this._core = core; - this._pressedKeys = new Set(); - this._previousPressedKeys = new Set(); - } - initialize(element) { - element.addEventListener("keydown", (e)=>{ - this._handleKeyDown(e); - }, false); - element.addEventListener("keyup", (e)=>{ - this._handleKeyUp(e); - }, false); + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } - isKeyDown(key) { - return this._pressedKeys.has(key); + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - wasKeyReleased(key) { - if (this._pressedKeys.has(key)) { - if (!this._previousPressedKeys.has(key)) { - this._previousPressedKeys.add(key); - return true; - } - } else this._previousPressedKeys.delete(key); - return false; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - _handleKeyDown(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (!this._pressedKeys.has(key)) this._pressedKeys.add(key); + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - _handleKeyUp(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (this._pressedKeys.has(key)) this._pressedKeys.delete(key); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c6yiP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Log", ()=>Log); -var _mainJs = require("./main.js"); -class Log { - constructor(core){ - this._core = core; - } - write(level, value) { - if (level >= this._core.config.logLevel) switch(level){ - case (0, _mainJs.LogLevel).trace: - console.trace(value); - break; - case (0, _mainJs.LogLevel).debug: - console.debug(value); - break; - case (0, _mainJs.LogLevel).info: - console.info(value); - break; - case (0, _mainJs.LogLevel).warn: - console.warn(value); - break; - case (0, _mainJs.LogLevel).error: - console.error(value); - break; - } + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } -} - -},{"./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cYEeU":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Colors", ()=>Colors); -var _glMatrix = require("gl-matrix"); -class Colors { -} -Colors.MediumVioletRed = (0, _glMatrix.vec3).fromValues(0xc7, 0x15, 0x85); -Colors.DeepPink = (0, _glMatrix.vec3).fromValues(0xff, 0x14, 0x93); -Colors.PaleVioletRed = (0, _glMatrix.vec3).fromValues(0xdb, 0x70, 0x93); -Colors.HotPink = (0, _glMatrix.vec3).fromValues(0xff, 0x69, 0xb4); -Colors.LightPink = (0, _glMatrix.vec3).fromValues(0xff, 0xb6, 0xc1); -Colors.Pink = (0, _glMatrix.vec3).fromValues(0xff, 0xc0, 0xcb); -Colors.DarkRed = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x00); -Colors.Red = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0x00); -Colors.Firebrick = (0, _glMatrix.vec3).fromValues(0xb2, 0x22, 0x22); -Colors.Crimson = (0, _glMatrix.vec3).fromValues(0xdc, 0x14, 0x3c); -Colors.IndianRed = (0, _glMatrix.vec3).fromValues(0xcd, 0x5c, 0x5c); -Colors.LightCoral = (0, _glMatrix.vec3).fromValues(0xf0, 0x80, 0x80); -Colors.Salmon = (0, _glMatrix.vec3).fromValues(0xfa, 0x80, 0x72); -Colors.DarkSalmon = (0, _glMatrix.vec3).fromValues(0xe9, 0x96, 0x7a); -Colors.LightSalmon = (0, _glMatrix.vec3).fromValues(0xff, 0xa0, 0x7a); -Colors.OrangeRed = (0, _glMatrix.vec3).fromValues(0xff, 0x45, 0x00); -Colors.Tomato = (0, _glMatrix.vec3).fromValues(0xff, 0x63, 0x47); -Colors.DarkOrange = (0, _glMatrix.vec3).fromValues(0xff, 0x8c, 0x00); -Colors.Coral = (0, _glMatrix.vec3).fromValues(0xff, 0x7f, 0x50); -Colors.Orange = (0, _glMatrix.vec3).fromValues(0xff, 0xa5, 0x00); -Colors.DarkKhaki = (0, _glMatrix.vec3).fromValues(0xbd, 0xb7, 0x6b); -Colors.Gold = (0, _glMatrix.vec3).fromValues(0xff, 0xd7, 0x00); -Colors.Khaki = (0, _glMatrix.vec3).fromValues(0xf0, 0xe6, 0x8c); -Colors.PeachPuff = (0, _glMatrix.vec3).fromValues(0xff, 0xda, 0xb9); -Colors.Yellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0x00); -Colors.PaleGoldenrod = (0, _glMatrix.vec3).fromValues(0xee, 0xe8, 0xaa); -Colors.Moccasin = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xb5); -Colors.PapayaWhip = (0, _glMatrix.vec3).fromValues(0xff, 0xef, 0xd5); -Colors.LightGoldenrodYellow = (0, _glMatrix.vec3).fromValues(0xfa, 0xfa, 0xd2); -Colors.LemonChiffon = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xcd); -Colors.LightYellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xe0); -Colors.Maroon = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x00); -Colors.Brown = (0, _glMatrix.vec3).fromValues(0xa5, 0x2a, 0x2a); -Colors.SaddleBrown = (0, _glMatrix.vec3).fromValues(0x8b, 0x45, 0x13); -Colors.Sienna = (0, _glMatrix.vec3).fromValues(0xa0, 0x52, 0x2d); -Colors.Chocolate = (0, _glMatrix.vec3).fromValues(0xd2, 0x69, 0x1e); -Colors.DarkGoldenrod = (0, _glMatrix.vec3).fromValues(0xb8, 0x86, 0x0b); -Colors.Peru = (0, _glMatrix.vec3).fromValues(0xcd, 0x85, 0x3f); -Colors.RosyBrown = (0, _glMatrix.vec3).fromValues(0xbc, 0x8f, 0x8f); -Colors.Goldenrod = (0, _glMatrix.vec3).fromValues(0xda, 0xa5, 0x20); -Colors.SandyBrown = (0, _glMatrix.vec3).fromValues(0xf4, 0xa4, 0x60); -Colors.Tan = (0, _glMatrix.vec3).fromValues(0xd2, 0xb4, 0x8c); -Colors.Burlywood = (0, _glMatrix.vec3).fromValues(0xde, 0xb8, 0x87); -Colors.Wheat = (0, _glMatrix.vec3).fromValues(0xf5, 0xde, 0xb3); -Colors.NavajoWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xde, 0xad); -Colors.Bisque = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xc4); -Colors.BlanchedAlmond = (0, _glMatrix.vec3).fromValues(0xff, 0xeb, 0xcd); -Colors.Cornsilk = (0, _glMatrix.vec3).fromValues(0xff, 0xf8, 0xdc); -Colors.DarkGreen = (0, _glMatrix.vec3).fromValues(0x00, 0x64, 0x00); -Colors.Green = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x00); -Colors.DarkOliveGreen = (0, _glMatrix.vec3).fromValues(0x55, 0x6b, 0x2f); -Colors.ForestGreen = (0, _glMatrix.vec3).fromValues(0x22, 0x8b, 0x22); -Colors.SeaGreen = (0, _glMatrix.vec3).fromValues(0x2e, 0x8b, 0x57); -Colors.Olive = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x00); -Colors.OliveDrab = (0, _glMatrix.vec3).fromValues(0x6b, 0x8e, 0x23); -Colors.MediumSeaGreen = (0, _glMatrix.vec3).fromValues(0x3c, 0xb3, 0x71); -Colors.LimeGreen = (0, _glMatrix.vec3).fromValues(0x32, 0xcd, 0x32); -Colors.Lime = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x00); -Colors.SpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x7f); -Colors.MediumSpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xfa, 0x9a); -Colors.DarkSeaGreen = (0, _glMatrix.vec3).fromValues(0x8f, 0xbc, 0x8f); -Colors.MediumAquamarine = (0, _glMatrix.vec3).fromValues(0x66, 0xcd, 0xaa); -Colors.YellowGreen = (0, _glMatrix.vec3).fromValues(0x9a, 0xcd, 0x32); -Colors.LawnGreen = (0, _glMatrix.vec3).fromValues(0x7c, 0xfc, 0x00); -Colors.Chartreuse = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0x00); -Colors.LightGreen = (0, _glMatrix.vec3).fromValues(0x90, 0xee, 0x90); -Colors.GreenYellow = (0, _glMatrix.vec3).fromValues(0xad, 0xff, 0x2f); -Colors.PaleGreen = (0, _glMatrix.vec3).fromValues(0x98, 0xfb, 0x98); -Colors.Teal = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x80); -Colors.DarkCyan = (0, _glMatrix.vec3).fromValues(0x00, 0x8b, 0x8b); -Colors.LightSeaGreen = (0, _glMatrix.vec3).fromValues(0x20, 0xb2, 0xaa); -Colors.CadetBlue = (0, _glMatrix.vec3).fromValues(0x5f, 0x9e, 0xa0); -Colors.DarkTurquoise = (0, _glMatrix.vec3).fromValues(0x00, 0xce, 0xd1); -Colors.MediumTurquoise = (0, _glMatrix.vec3).fromValues(0x48, 0xd1, 0xcc); -Colors.Turquoise = (0, _glMatrix.vec3).fromValues(0x40, 0xe0, 0xd0); -Colors.Aqua = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Cyan = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Aquamarine = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0xd4); -Colors.PaleTurquoise = (0, _glMatrix.vec3).fromValues(0xaf, 0xee, 0xee); -Colors.LightCyan = (0, _glMatrix.vec3).fromValues(0xe0, 0xff, 0xff); -Colors.Navy = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x80); -Colors.DarkBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x8b); -Colors.MediumBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xcd); -Colors.Blue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xff); -Colors.MidnightBlue = (0, _glMatrix.vec3).fromValues(0x19, 0x19, 0x70); -Colors.RoyalBlue = (0, _glMatrix.vec3).fromValues(0x41, 0x69, 0xe1); -Colors.SteelBlue = (0, _glMatrix.vec3).fromValues(0x46, 0x82, 0xb4); -Colors.DodgerBlue = (0, _glMatrix.vec3).fromValues(0x1e, 0x90, 0xff); -Colors.DeepSkyBlue = (0, _glMatrix.vec3).fromValues(0x00, 0xbf, 0xff); -Colors.CornflowerBlue = (0, _glMatrix.vec3).fromValues(0x64, 0x95, 0xed); -Colors.SkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xeb); -Colors.LightSkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xfa); -Colors.LightSteelBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xc4, 0xde); -Colors.LightBlue = (0, _glMatrix.vec3).fromValues(0xad, 0xd8, 0xe6); -Colors.PowderBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xe0, 0xe6); -Colors.Indigo = (0, _glMatrix.vec3).fromValues(0x4b, 0x00, 0x82); -Colors.Purple = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x80); -Colors.DarkMagenta = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x8b); -Colors.DarkViolet = (0, _glMatrix.vec3).fromValues(0x94, 0x00, 0xd3); -Colors.DarkSlateBlue = (0, _glMatrix.vec3).fromValues(0x48, 0x3d, 0x8b); -Colors.BlueViolet = (0, _glMatrix.vec3).fromValues(0x8a, 0x2b, 0xe2); -Colors.DarkOrchid = (0, _glMatrix.vec3).fromValues(0x99, 0x32, 0xcc); -Colors.Fuchsia = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.Magenta = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.SlateBlue = (0, _glMatrix.vec3).fromValues(0x6a, 0x5a, 0xcd); -Colors.MediumSlateBlue = (0, _glMatrix.vec3).fromValues(0x7b, 0x68, 0xee); -Colors.MediumOrchid = (0, _glMatrix.vec3).fromValues(0xba, 0x55, 0xd3); -Colors.MediumPurple = (0, _glMatrix.vec3).fromValues(0x93, 0x70, 0xdb); -Colors.Orchid = (0, _glMatrix.vec3).fromValues(0xda, 0x70, 0xd6); -Colors.Violet = (0, _glMatrix.vec3).fromValues(0xee, 0x82, 0xee); -Colors.Plum = (0, _glMatrix.vec3).fromValues(0xdd, 0xa0, 0xdd); -Colors.Thistle = (0, _glMatrix.vec3).fromValues(0xd8, 0xbf, 0xd8); -Colors.Lavender = (0, _glMatrix.vec3).fromValues(0xe6, 0xe6, 0xfa); -Colors.MistyRose = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xe1); -Colors.AntiqueWhite = (0, _glMatrix.vec3).fromValues(0xfa, 0xeb, 0xd7); -Colors.Linen = (0, _glMatrix.vec3).fromValues(0xfa, 0xf0, 0xe6); -Colors.Beige = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xdc); -Colors.WhiteSmoke = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xf5); -Colors.LavenderBlush = (0, _glMatrix.vec3).fromValues(0xff, 0xf0, 0xf5); -Colors.OldLace = (0, _glMatrix.vec3).fromValues(0xfd, 0xf5, 0xe6); -Colors.AliceBlue = (0, _glMatrix.vec3).fromValues(0xf0, 0xf8, 0xff); -Colors.Seashell = (0, _glMatrix.vec3).fromValues(0xff, 0xf5, 0xee); -Colors.GhostWhite = (0, _glMatrix.vec3).fromValues(0xf8, 0xf8, 0xff); -Colors.Honeydew = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xf0); -Colors.FloralWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xf0); -Colors.Azure = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xff); -Colors.MintCream = (0, _glMatrix.vec3).fromValues(0xf5, 0xff, 0xfa); -Colors.Snow = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xfa); -Colors.Ivory = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xf0); -Colors.White = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xff); -Colors.Black = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x00); -Colors.DarkSlateGray = (0, _glMatrix.vec3).fromValues(0x2f, 0x4f, 0x4f); -Colors.DimGray = (0, _glMatrix.vec3).fromValues(0x69, 0x69, 0x69); -Colors.SlateGray = (0, _glMatrix.vec3).fromValues(0x70, 0x80, 0x90); -Colors.Gray = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x80); -Colors.LightSlateGray = (0, _glMatrix.vec3).fromValues(0x77, 0x88, 0x99); -Colors.DarkGray = (0, _glMatrix.vec3).fromValues(0xa9, 0xa9, 0xa9); -Colors.Silver = (0, _glMatrix.vec3).fromValues(0xc0, 0xc0, 0xc0); -Colors.LightGray = (0, _glMatrix.vec3).fromValues(0xd3, 0xd3, 0xd3); -Colors.Gainsboro = (0, _glMatrix.vec3).fromValues(0xdc, 0xdc, 0xdc); -Colors.Copper = (0, _glMatrix.vec3).fromValues(0xb8, 0x73, 0x33); -Colors.Bronze = (0, _glMatrix.vec3).fromValues(0xcd, 0x7f, 0x32); -Colors.Steel = (0, _glMatrix.vec3).fromValues(0xce, 0xd2, 0xd7); -Colors.Platinum = (0, _glMatrix.vec3).fromValues(0xe5, 0xe4, 0xe2); -Colors.Gunmetal = (0, _glMatrix.vec3).fromValues(0x5c, 0x5d, 0x5b); -Colors.Titanium = (0, _glMatrix.vec3).fromValues(0x87, 0x86, 0x81); -Colors.RoseGold = (0, _glMatrix.vec3).fromValues(0xcb, 0xa3, 0xb2); -Colors.AquaGlass = (0, _glMatrix.vec3).fromValues(0xd2, 0xe8, 0xdf); -Colors.BlueGlass = (0, _glMatrix.vec3).fromValues(0xc7, 0xe3, 0xe1); - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5JhCv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MapItem", ()=>MapItem); -parcelHelpers.export(exports, "MapVisual", ()=>MapVisual); -parcelHelpers.export(exports, "Map", ()=>Map); -parcelHelpers.export(exports, "MapAtlas", ()=>MapAtlas); -parcelHelpers.export(exports, "MapRasterizer", ()=>MapRasterizer); -parcelHelpers.export(exports, "GeoJSONRasterizer", ()=>GeoJSONRasterizer); -var _mapJs = require("./helpers/map.js"); -var _mainJs = require("./main.js"); -class MapItem { - toJSON() { - return { - key: this.key, - scale: this.scale, - minLat: this.minLat, - maxLat: this.maxLat, - minLon: this.minLon, - maxLon: this.maxLon, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } -} -class MapVisual { - update() {} - constructor(map){ - this.map = map; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } -} -class Map { - get atlas() { - return this._rasterizer.atlas; + get gridVertices() { + return this._gridVertices; } - get count() { - return this._keys.size; - } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; - } - add(key) { - if (!this._keys.has(key)) { - if (this._rasterizer.draw(key) !== null) { - this._keys.add(key); - this._hasChanged = true; - } - } + get gridIndices() { + return this._gridIndices; } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); - } - return { - key: this.key, - items: items - }; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } -} -class MapAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class MapRasterizer { - get map() { - return this._map; + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - get atlas() { - return this._atlas; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - get scale() { - return this._scale; - } - set scale(value) { - this._scale = value; - this._geoJSONRasterizer.scale = value; - } - get geoJSON() { - return this._geoJSON; - } - set geoJSON(value) { - this._geoJSON = value; - this._geoJSONRasterizer.geoJSON = value; - } - get property() { - return this._property; - } - set property(value) { - this._property = value; - this._geoJSONRasterizer.property = value; - } - get mapProjection() { - return this._mapProjection; - } - set mapProjection(value) { - this._mapProjection = value; - this._geoJSONRasterizer.mapProjection = value; - } - get scaleFactor() { - return this._scaleFactor; - } - set scaleFactor(value) { - this._scaleFactor = value; - this._geoJSONRasterizer.scaleFactor = this._scaleFactor; - } - get minLongitude() { - return this._minLogitude; - } - set minLongitude(value) { - this._minLogitude = value; - this._geoJSONRasterizer.minLongitude = this._minLogitude; - } - get maxLongitude() { - return this._maxLongitude; - } - set maxLongitude(value) { - this._maxLongitude = value; - this._geoJSONRasterizer.maxLongitude = this._maxLongitude; - } - get minLatitude() { - return this._minLatitude; - } - set minLatitude(value) { - this._minLatitude = value; - this._geoJSONRasterizer.minLatitude = this._minLatitude; - } - get maxLatitude() { - return this._maxLatitude; - } - set maxLatitude(value) { - this._maxLatitude = value; - this._geoJSONRasterizer.maxLatitude = this._maxLatitude; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._mapProjection = options.mapProjection; - this._map = new Map(core, this); - this._map.key = this._key; - const geoJSONRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance, - geoJSON: this._geoJSON, - scale: this._scale, - property: this._property, - mapProjection: this._mapProjection - }; - this._geoJSONRasterizer = new GeoJSONRasterizer(core, geoJSONRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `map rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key) { - const item = this._geoJSONRasterizer.draw(key); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._map.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._map.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; - } - this._atlas.x += texWidth; - } - return item; + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; + } + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; + } + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; + } + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; + } + get gridFaceZero() { + return this._gridFaceZeros; + } + get gridFaceMinorGridlines() { + return this._gridFaceMinorGridlines; + } + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; } -} -class GeoJSONRasterizer { - get scale() { - return this._scale; + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } } - set scale(value) { - this._scale = value; + get scalingX() { + return this._scalingX; } - get geoJSON() { - return this._geoJSON; + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } } - set geoJSON(value) { - this._geoJSON = value; + get scalingY() { + return this._scalingY; } - get property() { - return this._property; + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } } - set property(value) { - this._property = value; + get offsetX() { + return this._offset[12]; } - get mapProjection() { - return this._mapProjection; + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } } - set mapProjection(value) { - this._mapProjection = value; + get offsetY() { + return this._offset[13]; } - get scaleFactor() { - return this._scaleFactor; + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } } - set scaleFactor(value) { - this._scaleFactor = value; + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._rMatrix = create$7(); + fromQuat(this._rMatrix, value2); + } } - get minLongitude() { - return this._minLongitude; + constructor(core) { + super(core); + this._size = create$6(); + this._translation = create$6(); + this._normal = create$6(); + this._forward = create$6(); + this._right = create$6(); + this._up = create$6(); + this._texCoord = create$3(); + this._bounds = create$5(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mat3 = create$8(); + this._isDiscrete = [false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 2; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 4; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$6(); + this._textPosition = create$6(); + this._distances = []; + for (let i = 0; i < 4; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 2; i++) { + this._maxLabelSize.push(create$3()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._labelMMatrices.push(create$7()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 2; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._titleMMatrices.push(create$7()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 2; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._headingMMatrices.push(create$7()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$6(); + this._edgePositive = create$6(); + this._edgeNormal = create$6(); + this._edgeNormalTemp = create$6(); + this._edgePositiveTemp = create$6(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 4; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$6()); + this._edgeHorizontalUp.push(create$6()); + this._edgeHorizontalForward.push(create$6()); + this._edgeVerticalRight.push(create$6()); + this._edgeVerticalUp.push(create$6()); + this._edgeVerticalForward.push(create$6()); + } + this.isFaceVisible = []; + for (let i = 0; i < 2; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$3.INDICES; + this.zero = create$6(); + this._gridTicksZeros = []; + this._gridFaceZeros = create$3(); + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = create$3(); + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$6(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 2; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create$3()); + this._gridTicksMinorGridlines.push(create$3()); + this._gridTicksScales.push(create$6()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$7()); + } + for (let i = 0; i < 4; i++) { + this._gridTicksMMatrices.push(create$7()); + this._gridTicksRotations.push(create$7()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Quad$3.EDGE_POSITIVES[i][0]; + _mat4[1] = Quad$3.EDGE_POSITIVES[i][1]; + _mat4[2] = Quad$3.EDGE_POSITIVES[i][2]; + _mat4[4] = Quad$3.EDGE_NORMALS[i][0]; + _mat4[5] = Quad$3.EDGE_NORMALS[i][1]; + _mat4[6] = Quad$3.EDGE_NORMALS[i][2]; + cross$1(this._vec3, Quad$3.EDGE_POSITIVES[i], Quad$3.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null]; + this._toValues = [null, null]; + this.isDivisionPickingEnabled = [false, false]; + this.isLabelPickingEnabled = [false, false]; + this.isTitlePickingEnabled = [false, false]; + this.isHeadingPickingEnabled = [false, false]; + this.isAxisReversed = [false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._offset = create$7(); } - set minLongitude(value) { - this._minLongitude = value; + initialize() { + this._isInitialized = true; } - get maxLongitude() { - return this._maxLongitude; + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$8(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); + const maxBounds = Math.max(this._size[0], this._size[1]); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); + } + if (this._rMatrix) { + mul(this._mMatrix, this.mMatrix, this._rMatrix); + mul(this._mMatrix, this._mMatrix, this._offset); + } else { + multiply$2(this._mMatrix, this.mMatrix, this._offset); + } + this._mvMatrix = create$7(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 2; faceId++) { + transformMat4$2(this._forward, Constants$1.VECTOR3_ZERO, this._mvMatrix); + transformMat3(this._normal, Quad$3.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 4; edgeId++) { + this._isForwardEdge[edgeId] = dot$1(Quad$3.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 2; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set$5(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set$5(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + translate$2(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$6(gridTicksMMatrix, gridTicksMMatrix, Constants$1.VECTOR3_REFLECTX); + } + scale$6(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } + } + } + } + set$5(this._gridFaceZeros, this.zero[0], this.zero[1]); + set$5(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); + for (let faceId = 0; faceId < 2; faceId++) { + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$6(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + } + } + for (let axisId = 0; axisId < 2; axisId++) { + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + multiply$1(this._edgePosition, Quad$3.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$5(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross$1(this._right, Constants$1.VECTOR3_UNITY, this._forward); + normalize$5(this._right, this._right); + cross$1(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Quad$3.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Quad$3.EDGE_POSITIVES[edgeId], this._mat3); + copy$6(this._edgeNormalTemp, this._edgeNormal); + copy$6(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$6(edgeHorizontalUp, Quad$3.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Quad$3.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$6(edgeHorizontalRight, Quad$3.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Quad$3.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross$1(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross$1(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$6(edgeVerticalUp, Quad$3.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Quad$3.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$6(edgeVerticalRight, Quad$3.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Quad$3.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross$1(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross$1(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } + } + } + } } - set maxLongitude(value) { - this._maxLongitude = value; + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants$1.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; } - get minLatitude() { - return this._minLatitude; + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } - set minLatitude(value) { - this._minLatitude = value; + _updateHeading(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Quad$3.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$3.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; } - get maxLatitude() { - return this._maxLatitude; + _updateGrids(size) { + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId2 = 0; axisId2 < 2; axisId2++) { + const width2 = size[axisId2]; + set$8(this._gridTicksScales[axisId2], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId2, this._gridVerticesView, this._gridIndices, offset2); + this._gridFaceScale[axisId2] = size[axisId2] == 0 ? 1 : size[axisId2]; + } + const axisId = 2; + this._gridFaceScale[axisId] = 1; + for (let faceId = 0; faceId < 2; faceId++) { + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } } - set maxLatitude(value) { - this._maxLatitude = value; + _updateText(size) { + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 2; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._labels[axisId]) { + const width2 = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set$5(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._titles[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._headings[axisId]) { + set$8(this._textPosition, 0, 0, 0); + set$8(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._mapProjection = options.mapProjection; - this._lonLat = [ - 0, - 0 - ]; - this._geoJSONHelper = new (0, _mapJs.GeoJSONHelper)(); - this._core.log.write((0, _mainJs.LogLevel).info, `geoJSON rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key) { - let feature = this._geoJSONHelper.feature(this._geoJSON, this._property, key); - if (feature) { - let geometry = feature.geometry; - const clip = { - minLon: this._minLongitude, - maxLon: this._maxLongitude, - minLat: this._minLatitude, - maxLat: this._maxLatitude - }; - const bounds = this._geoJSONHelper.bounds(geometry, clip, this._mapProjection); - if (bounds) { - let minX = bounds.minX; - let maxX = bounds.maxX; - let minY = bounds.minY; - let maxY = bounds.maxY; - let sizeX = bounds.maxX - bounds.minX; - let sizeY = bounds.maxY - bounds.minY; - if (sizeX > 0 && sizeY > 0) { - const scale = this._scale * this._scaleFactor; - sizeX = Math.ceil(sizeX * scale); - sizeY = Math.ceil(sizeY * scale); - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new MapItem(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - item.minLon = minX; - item.maxLon = maxX; - item.minLat = minY; - item.maxLat = maxY; - item.scale = this._scaleFactor; - ctx.clearRect(this._border, this._border, sizeX, sizeY); - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.coordinates.length; k++){ - const inner = polygon.coordinates[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.length; k++){ - const inner = polygon[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - } - break; - } - const imgData = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return item; - } + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (position2 - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (position2 - 0.5) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } - if (!feature) this._core.log.write((0, _mainJs.LogLevel).warn, `geoJSON rasterizer ${key} not found`); - return null; - } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./helpers/map.js":"27ECm","./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"27ECm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MercatorHelper", ()=>MercatorHelper); -parcelHelpers.export(exports, "AlbersHelper", ()=>AlbersHelper); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>GeoJSONHelper); -var _mathJs = require("./math.js"); -var _angleJs = require("./angle.js"); -var _constantsJs = require("../constants.js"); -class MercatorHelper { - constructor(){ - this.minLatitude = -85.05112878; - this.maxLatitude = 85.05112878; - this.minLongitude = -180; - this.maxLongitude = 180; - this.minX = -1; - this.minY = -1; - this.maxX = 1; - this.maxY = 1; - } - project(longitude, latitude, xy) { - const x = longitude / 180; - latitude = (0, _mathJs.MathHelper).clamp(latitude, this.minLatitude, this.maxLatitude); - latitude = (0, _angleJs.AngleHelper).degreesToRadians(latitude); - const sinLatitude = Math.sin(latitude); - let y = Math.log((1 + sinLatitude) / (1 - sinLatitude)) / 2; - y = (0, _mathJs.MathHelper).clamp(y / Math.PI, this.minY, this.maxY); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const longitude = x * 180; - y *= Math.PI; - let latitude = (0, _constantsJs.Constants).PI_OVER_TWO - 2 * Math.atan(Math.exp(-y)); - latitude = (0, _angleJs.AngleHelper).radiansToDegrees(latitude); - lonLat[0] = longitude; - lonLat[1] = latitude; - } -} -class AlbersHelper { - constructor(){ - this._phi1 = 29.5; - this._phi2 = 45.5; - this._lat0 = 37.5; - this._lon0 = -96; - } - get standardParallel1() { - return this._phi1; - } - set standardParallel1(value) { - this._phi1 = value; - } - get standardParallel2() { - return this._phi2; - } - set standardParallel2(value) { - this._phi2 = value; - } - get latitudeOfOrigin() { - return this._lat0; - } - set latitudeOfOrigin(value) { - this._lat0 = value; - } - get centralMeridian() { - return this._lon0; - } - set centralMeridian(value) { - this._lon0 = value; - } - project(lon, lat, xy) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - lat = (0, _angleJs.AngleHelper).degreesToRadians(lat); - lon = (0, _angleJs.AngleHelper).degreesToRadians(lon); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - const theta = n * (lon - lon0); - const p = Math.sqrt(C - 2 * n * Math.sin(lat)) / n; - const x = p * Math.sin(theta); - const y = p0 - p * Math.cos(theta); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - let theta = Math.atan(x / Math.abs(p0 - y) * Math.sign(p0 - y)); - if ((p0 - y) * n < 0) theta -= Math.PI * Math.sign(x) * Math.sign(p0 - y); - const p = Math.sqrt(x * x + Math.pow(p0 - y, 2)); - const lon = lon0 + theta / n; - const lat = Math.asin((C - p * p * n * n) / (2 * n)); - lonLat[0] = (0, _angleJs.AngleHelper).radiansToDegrees(lon); - lonLat[1] = (0, _angleJs.AngleHelper).radiansToDegrees(lat); - } -} -class GeoJSONHelper { - constructor(){ - this._lonLat = [ - 0, - 0 - ]; - } - feature(geoJSON, property, key) { - for(let i = 0; i < geoJSON.features.length; i++){ - let feature = geoJSON.features[i]; - if (feature.properties[property] == key) return feature; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions2, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions2[label2] : positions2[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$8(this._textPosition, (0.5 - position2) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$8(this._textPosition, 0, (0.5 - position2) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; + } + break; } - return null; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; } - bounds(geometry, clip, projection) { - let minX = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } - } - break; + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$6(); + const positions2 = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const right = isAxisReversed ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$7(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants$1.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; } - if (minX == Number.MAX_VALUE) { - minX = 0; - maxX = 0; - minY = 0; - maxY = 0; + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$8(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$6(); + negate(this._normal, Quad$3.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$7(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } } - return { - minX: minX, - maxX: maxX, - minY: minY, - maxY: maxY - }; + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } -} - -},{"./math.js":"f65d0","./angle.js":"53hwW","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPq9g":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Icon", ()=>Icon); -parcelHelpers.export(exports, "IconsVisual", ()=>IconsVisual); -parcelHelpers.export(exports, "Icons", ()=>Icons); -parcelHelpers.export(exports, "IconsAtlas", ()=>IconsAtlas); -parcelHelpers.export(exports, "IconsRasterizer", ()=>IconsRasterizer); -parcelHelpers.export(exports, "IconRasterizer", ()=>IconRasterizer); -var _mainJs = require("./main.js"); -class Icon { + } + class Glyph { toJSON() { - return { - key: this.key, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + return { + key: this.key, + char: this.char, + width: this.width, + height: this.height, + top: this.top, + left: this.left, + advance: this.advance, + u0: this.u0, + v0: this.v0, + u1: this.u1, + v1: this.v1 + }; } -} -class IconsVisual { - update() {} - constructor(icons){ - this.icons = icons; + } + let FontVisual$2 = class FontVisual { + update() { } -} -class Icons { + constructor(font2) { + this.font = font2; + } + }; + class Font { get atlas() { - return this._rasterizer.atlas; + return this._rasterizer.fontAtlas; } get count() { - return this._keys.size; + return this._chars.size; } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; + constructor(core, rasterizer) { + this._core = core; + this._rasterizer = rasterizer; + this._chars = /* @__PURE__ */ new Set(); + this._previousSize = 0; + this.glyphs = {}; } - add(key, imgData) { - if (!this._keys.has(key)) { - this._keys.add(key); - this._rasterizer.draw(key, imgData); - } + addGlyph(char) { + if (!this._chars.has(char)) { + this._chars.add(char); + this._rasterizer.draw(char); + this._hasChanged = true; + } } update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); + if (this._hasChanged) { + this._hasChanged = false; + this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); + this._previousSize = this._chars.size; + if (this.hasChangedCallback) { + this.hasChangedCallback(); } + } } toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); - } - return { - key: this.key, - items: items - }; - } -} -class IconsAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class IconsRasterizer { - get icons() { - return this._icons; + const glyphs = []; + for (let key2 in this.glyphs) { + const glyph = this.glyphs[key2]; + glyphs.push(glyph.toJSON()); + } + return { + name: this.name, + size: this.size, + border: this.border, + glyphs, + edgeValue: this.edgeValue + }; } - get atlas() { - return this._atlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._icons = new Icons(core, this); - this._icons.key = this._key; - const iconRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance - }; - this._iconRasterizer = new IconRasterizer(core, iconRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `icons rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData) { - const item = this._iconRasterizer.draw(key, imgData); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._icons.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._icons.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; - } - this._atlas.x += texWidth; - } - } -} -class IconRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._core.log.write((0, _mainJs.LogLevel).info, `icon rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData0) { - const sizeX = imgData0.width; - const sizeY = imgData0.height; - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new Icon(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - ctx.clearRect(this._border, this._border, sizeX, sizeY); - ctx.putImageData(imgData0, this._border, this._border); - const imgData1 = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData1.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return item; + } + class FontAtlas { + constructor(width2, height2) { + const canvas = document.createElement("canvas"); + canvas.width = width2; + canvas.height = height2; + const context2 = canvas.getContext("2d"); + context2.clearRect(0, 0, width2, height2); + this.imageData = context2.getImageData(0, 0, width2, height2); + this.x = 0; + this.top = new Uint16Array(width2); } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5C4Hk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Controller", ()=>(0, _controllerJs.Controller)); -parcelHelpers.export(exports, "ControllerVisual", ()=>(0, _controllerJs.ControllerVisual)); -parcelHelpers.export(exports, "Label", ()=>(0, _labelsJs.Label)); -parcelHelpers.export(exports, "LabelVisual", ()=>(0, _labelsJs.LabelVisual)); -parcelHelpers.export(exports, "LabelSet", ()=>(0, _labelsJs.LabelSet)); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>(0, _labelsJs.TransitionLabelSet)); -parcelHelpers.export(exports, "LabelSetVisual", ()=>(0, _labelsJs.LabelSetVisual)); -parcelHelpers.export(exports, "ImageVisual", ()=>(0, _imageJs.ImageVisual)); -parcelHelpers.export(exports, "ImageQuad", ()=>(0, _imageJs.ImageQuad)); -parcelHelpers.export(exports, "ImageSphere", ()=>(0, _imageJs.ImageSphere)); -parcelHelpers.export(exports, "NominalKey", ()=>(0, _keysJs.NominalKey)); -var _controllerJs = require("./controller.js"); -var _labelsJs = require("./labels.js"); -var _imageJs = require("./image.js"); -var _keysJs = require("./keys.js"); - -},{"./controller.js":"f5tIG","./labels.js":"PwNrz","./image.js":"kwtZG","./keys.js":"bmBQh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"PwNrz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -parcelHelpers.export(exports, "LabelBase", ()=>LabelBase); -parcelHelpers.export(exports, "Label", ()=>Label); -parcelHelpers.export(exports, "LabelSet", ()=>LabelSet); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>TransitionLabelSet); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -var _pickJs = require("../helpers/pick.js"); -var _mathJs = require("../helpers/math.js"); -class LabelVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(label){ - this.label = label; - } -} -class LabelSetVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(labelSet){ - this.label = labelSet; - } -} -class LabelBase { - get material() { - return this._material; + } + class FontRasterizer { + get font() { + return this._font; } - get vertices() { - return this._vertices; + get fontAtlas() { + return this._fontAtlas; + } + constructor(core, options2) { + let start = performance.now(); + this._core = core; + this._fontAtlas = options2.fontAtlas; + this._fontSize = options2.fontSize; + this._border = options2.border; + this._fontFamily = options2.fontFamily; + this._fontWeight = options2.fontWeight; + this._fontStyle = options2.fontStyle; + this._baseline = options2.baseline; + this._maxDistance = options2.maxDistance; + this._edgeValue = options2.edgeValue; + this._font = new Font(core, this); + this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); + this._font.size = this._fontSize; + this._font.border = this._border; + this._font.edgeValue = this._edgeValue; + const glyphRasterizerOptions = { + baseline: this._baseline, + border: this._border, + edgeValue: this._edgeValue, + fontFamily: this._fontFamily, + fontSize: this._fontSize, + fontStyle: this._fontStyle, + fontWeight: this._fontWeight, + maxDistance: this._maxDistance + }; + this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); + this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); } - get verticesView() { - return this._verticesView; + draw(char) { + const glyph = this._glyphRasterizer.draw(char); + const texWidth = glyph.width + 2 * this._border; + const texHeight = glyph.height + 2 * this._border; + const width2 = this._fontAtlas.imageData.width; + const height2 = this._fontAtlas.imageData.height; + if (this._fontAtlas.x + texWidth > width2) { + this._fontAtlas.x = 0; + } + let y2 = 0; + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + y2 = Math.max(y2, this._fontAtlas.top[x2]); + } + if (y2 + texHeight > height2) { + this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); + } + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + this._fontAtlas.top[x2] = y2 + texHeight; + } + glyph.u0 = this._fontAtlas.x / width2; + glyph.v0 = y2 / height2; + glyph.u1 = (this._fontAtlas.x + texWidth) / width2; + glyph.v1 = (y2 + texHeight) / height2; + this._font.glyphs[char] = glyph; + for (let i = 0; i < glyph.distances.length; i++) { + const distance2 = glyph.distances[i]; + const dataX = i % texWidth; + const dataY = Math.floor(i / texWidth); + const offset2 = (this._fontAtlas.x + dataX + (y2 + dataY) * width2) * 4; + this._fontAtlas.imageData.data[offset2 + 0] = distance2; + this._fontAtlas.imageData.data[offset2 + 1] = distance2; + this._fontAtlas.imageData.data[offset2 + 2] = distance2; + this._fontAtlas.imageData.data[offset2 + 3] = 255; + } + this._fontAtlas.x += texWidth; } - get indices() { - return this._indices; + } + class GlyphRasterizer { + constructor(core, options2) { + let start = performance.now(); + this._core = core; + this._fontSize = options2.fontSize; + this._border = options2.border; + this._fontFamily = options2.fontFamily; + this._fontWeight = options2.fontWeight; + this._fontStyle = options2.fontStyle; + this._baseline = options2.baseline; + this._maxDistance = options2.maxDistance; + this._edgeValue = options2.edgeValue; + this._size = this._fontSize + this._border * 2; + this._size += this._border * 2; + this._gridOuter = new Float64Array(this._size * this._size); + this._gridInner = new Float64Array(this._size * this._size); + this._f = new Float64Array(this._size); + this._z = new Float64Array(this._size + 1); + this._v = new Uint16Array(this._size); + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = this._size; + this._context = canvas.getContext("2d", { willReadFrequently: true }); + this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; + this._context.textBaseline = this._baseline; + this._context.textAlign = "left"; + this._context.fillStyle = "black"; + this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); } - get indexCount() { - return this._indexCount; + draw(char) { + const textMetrics2 = this._context.measureText(char); + const glyphLeft = 0; + const glyphTop = Math.floor(textMetrics2.actualBoundingBoxAscent); + let glyphWidth = Math.ceil(textMetrics2.actualBoundingBoxRight); + let glyphHeight = Math.ceil(textMetrics2.actualBoundingBoxAscent) + Math.ceil(textMetrics2.actualBoundingBoxDescent); + glyphWidth = Math.min(this._size - this._border, glyphWidth); + glyphHeight = Math.min(this._size - this._border, glyphHeight); + const width2 = glyphWidth + 2 * this._border; + const height2 = glyphHeight + 2 * this._border; + const length2 = width2 * height2; + const distances = new Uint8ClampedArray(length2); + const gradientsX = new Uint8ClampedArray(length2); + const gradientsY = new Uint8ClampedArray(length2); + const pixels = new Uint8ClampedArray(length2); + const glyph = new Glyph(); + glyph.char = char; + glyph.key = char.codePointAt(0); + glyph.distances = distances; + glyph.gradientsX = gradientsX; + glyph.gradientsY = gradientsY; + glyph.pixels = pixels; + glyph.width = glyphWidth; + glyph.height = glyphHeight; + glyph.top = glyphTop; + glyph.left = glyphLeft; + glyph.advance = textMetrics2.width; + if (glyphWidth == 0 || glyphHeight == 0) { + return glyph; + } + this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); + this._context.fillText(char, this._border, this._border + glyphTop); + const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); + for (let i = 0; i < length2; i++) { + this._gridOuter[i] = Number.MAX_VALUE; + this._gridInner[i] = 0; + } + for (let y2 = 0; y2 < glyphHeight; y2++) { + for (let x2 = 0; x2 < glyphWidth; x2++) { + const a2 = imgData.data[4 * (y2 * glyphWidth + x2) + 3] / 255; + if (a2 > 0) { + const j = (y2 + this._border) * width2 + x2 + this._border; + if (a2 == 1) { + this._gridOuter[j] = 0; + this._gridInner[j] = Number.MAX_VALUE; + } else { + const d2 = 0.5 - a2; + this._gridOuter[j] = d2 > 0 ? d2 * d2 : 0; + this._gridInner[j] = d2 < 0 ? d2 * d2 : 0; + pixels[j] = 255; + } + } + } + } + this._edt(this._gridOuter, 0, 0, width2, height2, width2, this._f, this._v, this._z); + this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width2, this._f, this._v, this._z); + const distances2 = new Float32Array(length2); + for (let i = 0; i < length2; i++) { + const distance2 = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); + distances[i] = Math.round(this._edgeValue - distance2 * 255 / this._maxDistance); + distances2[i] = distance2; + } + for (let i = 0; i < length2; i++) { + const x2 = i % width2; + const y2 = Math.floor(i / width2); + const d2 = distances2[i]; + const sign2 = d2 < 0 ? -1 : 1; + const x02 = x2 > 0 ? distances2[i - 1] : Number.MAX_VALUE; + const x12 = x2 < width2 - 1 ? distances2[i + 1] : Number.MAX_VALUE; + const y02 = y2 > 0 ? distances2[i - width2] : Number.MAX_VALUE; + const y12 = y2 < height2 - 1 ? distances2[i + width2] : Number.MAX_VALUE; + let gradientX = sign2 * x02 < sign2 * x12 ? d2 - x02 : x12 - d2; + let gradientY = sign2 * y02 < sign2 * y12 ? y02 - d2 : d2 - y12; + gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 255); + gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 255); + } + return glyph; + } + _edt(data2, x02, y02, width2, height2, gridSize, f, v, z2) { + for (let x2 = x02; x2 < x02 + width2; x2++) + this._edt1d(data2, y02 * gridSize + x2, gridSize, height2, f, v, z2); + for (let y2 = y02; y2 < y02 + height2; y2++) + this._edt1d(data2, y2 * gridSize + x02, 1, width2, f, v, z2); + } + _edt1d(grid2, offset2, stride, n, f, v, z2) { + v[0] = 0; + z2[0] = -Number.MAX_VALUE; + z2[1] = Number.MAX_VALUE; + f[0] = grid2[offset2]; + for (let q = 1, k = 0, s2 = 0; q < n; q++) { + f[q] = grid2[offset2 + q * stride]; + const q2 = q * q; + do { + const r = v[k]; + s2 = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; + } while (s2 <= z2[k] && --k > -1); + k++; + v[k] = q; + z2[k] = s2; + z2[k + 1] = Number.MAX_VALUE; + } + for (let q = 0, k = 0; q < n; q++) { + while (z2[k + 1] < q) { + k++; + } + const r = v[k]; + const qr = q - r; + grid2[offset2 + q * stride] = f[r] + qr * qr; + } } - get isInitialized() { - return this._isInitialized; + } + class ManipulationProcessor { + get manipulators() { + return this._manipulators; } - get mMatrix() { - return this._mMatrix; + get count() { + return this._count; } - get scale() { - return this._scale; + get isDragging() { + return this._isDragging; + } + constructor(core) { + this._core = core; + this._count = 0; + this._centroid = create$6(); + this._previousCentroid = create$6(); + this._relativePositionToCentroid = create$6(); + this._directionToCentroid = create$6(); + this._previousDirectionToCentroid = create$6(); + this._manipulators = {}; + this._removedManipulators = []; + this.cumulativeTranslation = create$6(); + this.translationDelta = create$6(); + this.centroid = create$6(); + this.maxScale = Number.MAX_VALUE; + this.twistAxis = fromValues$3(0, 0, 1); + this.initialize(); } - set scale(value) { - if (this._scale != value) { - this._scale = value; - this._hasChanged = true; + update(elapsedTime, manipulators) { + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (!manipulators[manipulator.id]) { + if (this.removeManipulator) { + this.removeManipulator(manipulator); + } + this._removedManipulators.push(manipulator.id); + } + } + if (this._removedManipulators.length > 0) { + for (let i = 0; i < this._removedManipulators.length; i++) { + delete this._manipulators[this._removedManipulators[i]]; + this._count--; + } + this._removedManipulators = []; + } + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + if (!this._manipulators[manipulator.id]) { + if (!this.addManipulator || this.addManipulator(manipulator)) { + copy$6(manipulator.initialPosition, manipulator.position); + this._manipulators[manipulator.id] = manipulator; + this._count++; + } + } + } + set$8(this.translationDelta, 0, 0, 0); + this.scaleDelta = 0; + this.twistDelta = 0; + if (this._count > 0) { + if (this._previousCount > 0) { + if (this.prepareManipulation) { + this.prepareManipulation(); + } + this._process(); + if (this.processManipulation) { + this.processManipulation(elapsedTime); + } + } else { + this.initialize(); + if (this.beginManipulation) { + this.beginManipulation(); + } + } + } else { + if (this._previousCount > 0) { + if (this.endManipulation) { + this.endManipulation(); + } } + } + this._isDragging = this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; + this._previousCount = this._count; } - get font() { - return this._font; + initialize() { + set$8(this.centroid, 0, 0, 0); + set$8(this.cumulativeTranslation, 0, 0, 0); + this.cumulativeScale = 1; + this.cumulativeTwist = 0; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; + _process() { + if (this._previousCount > 0) { + let persisted = 0; + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + persisted++; + } + } + const removed = this._previousCount - persisted; + if (persisted > 0) { + if (removed > 0) { + copy$6(this._centroid, this._previousCentroid); + } else { + set$8(this._centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + add$4(this._centroid, this._centroid, manipulator.position); + } + } + scale$5(this._centroid, this._centroid, 1 / persisted); + } + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); + add$4(this.translationDelta, this.translationDelta, manipulator.position); + subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); + subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); + const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); + if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) { + this.scaleDelta += 1; + } else { + const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); + const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); + const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); + this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; + scale$5(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); + scale$5(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); + this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); + } + } + } + scale$5(this.translationDelta, this.translationDelta, 1 / persisted); + add$4(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); + this.scaleDelta /= persisted; + this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); + this.scaleDelta -= 1; + this.twistDelta /= persisted; + this.cumulativeTwist += this.twistDelta; } + } + set$8(this.centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + add$4(this.centroid, this.centroid, manipulator.position); + } + scale$5(this.centroid, this.centroid, 1 / this._count); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); + } + copy$6(this._previousCentroid, this.centroid); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + manipulator.isPersisted = true; + copy$6(manipulator.previousPosition, manipulator.position); + copy$6(manipulator.previousRotationAxis, manipulator.rotationAxis); + copy$6(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); + } } - get rotation() { - return this._rotation; + } + class MouseWheel { + constructor(core) { + this._core = core; + this._previousTotal = 0; + this.total = 0; + } + initialize(element2) { + element2.addEventListener("wheel", (e) => { + e.preventDefault(); + const wheelEvent = e; + this.total += wheelEvent.deltaY; + }, { passive: false }); } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._hasChanged = true; - } + update(elapsedTime) { + const total = this.total; + this.delta = total - this._previousTotal; + this._previousTotal = total; + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); + } } - set reverseX(value) { - if (this._reverseX != value) { - this._reverseX = value; - this._hasChanged = true; - } + } + class Manipulator { + constructor() { + this.pickedIndex = 0; + this.maxTranslationSquared = 0; + this.initialPosition = create$6(); + this.position = create$6(); + this.previousPosition = create$6(); + this.holdOrigin = create$6(); + this.positionRelativeToCentroid = create$6(); + this.previousPositionRelativeToCentroid = create$6(); + this.rotationAxis = create$6(); + this.previousRotationAxis = create$6(); } - set reverseY(value) { - if (this._reverseY != value) { - this._reverseY = value; - this._hasChanged = true; - } + } + class Pointers { + get hoverX() { + return this._hoverX; } - set reverseZ(value) { - if (this._reverseZ != value) { - this._reverseZ = value; - this._hasChanged = true; - } + get hoverY() { + return this._hoverY; } - get horizontalAlignment() { - return this._horizontalAlignment; + get hoverId() { + return this._hoverId; } - set horizontalAlignment(value) { - if (this._horizontalAlignment != value) { - this._horizontalAlignment = value; - this._hasChanged = true; - } + constructor(core, manipulators) { + this._core = core; + this._manipulators = manipulators; } - get verticalAlignment() { - return this._verticalAlignment; + initialize(element2) { + this._element = element2; + element2.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); + element2.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); + element2.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); + element2.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); + element2.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); + element2.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); } - set verticalAlignment(value) { - if (this._verticalAlignment != value) { - this._verticalAlignment = value; - this._hasChanged = true; - } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); + this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); + } } - get offsetX() { - return this._offsetX; + _handlePointerDown(e) { + this._element.focus(); + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const manipulator = new Manipulator(); + const id2 = e.pointerId; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + manipulator.id = id2; + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.type = e.pointerType; + manipulator.button = e.button; + manipulator.shiftKey = e.shiftKey; + manipulator.ctrlKey = e.ctrlKey; + manipulator.altKey = e.altKey; + manipulator.event = e; + this._manipulators[id2] = manipulator; + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; } - set offsetX(value) { - if (this._offsetX != value) { - this._offsetX = value; - this._hasChanged = true; - } + _handlePointerMove(e) { + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + const id2 = e.pointerId; + const manipulator = this._manipulators[id2]; + if (manipulator) { + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.event = e; + } + switch (e.pointerType) { + case "mouse": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + break; + case "pen": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + this._tiltX = e.tiltX; + this._tiltY = e.tiltY; + this._twist = e.twist; + break; + } } - get offsetY() { - return this._offsetY; + _handlePointerUp(e) { + const manipulator = this._manipulators[e.pointerId]; + if (manipulator) { + manipulator.event = e; + } + this._remove(e.pointerId); } - set offsetY(value) { - if (this._offsetY != value) { - this._offsetY = value; - this._hasChanged = true; - } + _handlePointerCancel(e) { + this._remove(e.pointerId); } - get offsetZ() { - return this._offsetZ; + _handlePointerLeave(e) { + this._resetHover(); + this._remove(e.pointerId); } - set offsetZ(value) { - if (this._offsetZ != value) { - this._offsetZ = value; - this._hasChanged = true; - } + _handlePointerOut(e) { + this._resetHover(); + this._remove(e.pointerId); } - get maxGlyphTop() { - return this._maxGlyphTop; + _resetHover() { + this._hoverId = null; + this._hoverX = null; + this._hoverY = null; } - set maxGlyphTop(value) { - if (this._maxGlyphTop != value) { - this._maxGlyphTop = value; - this._hasChanged = true; - } + _remove(pointerId) { + const manipulator = this._manipulators[pointerId]; + if (manipulator) { + delete this._manipulators[pointerId]; + } } - get maxGlyphHeight() { - return this._maxGlyphHeight; - } - set maxGlyphHeight(value) { - if (this._maxGlyphHeight != value) { - this._maxGlyphHeight = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._offset = (0, _glMatrix.vec3).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - this._indexCount = 0; - this._maxGlyphs = options.maxGlyphs; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this.scale = options.scale ? options.scale : 1; - this.offsetX = options.offsetX ? options.offsetX : 0; - this.offsetY = options.offsetY ? options.offsetY : 0; - this.offsetZ = options.offsetZ ? options.offsetZ : 0; - this.reverseX = options.reverseX; - this.reverseY = options.reverseY; - this.reverseZ = options.reverseZ; - this.rotation = options.rotation; - this.maxGlyphTop = options.maxGlyphTop; - this.horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - this.verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - this._material = options.material; - this.borderWidth = core.config.textBorderWidth; - this.gamma = 0; + } + class AnimationHelper { + static smoothStep(value2) { + return value2 * value2 * (3 - 2 * value2); + } + static damp(value2, target2, threshold2, dampening) { + if (Math.abs(target2) < threshold2) { + return MathHelper.lerp(value2, 0, dampening); + } else { + return MathHelper.lerp(value2, target2, dampening); + } } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * this._maxGlyphs * 4); - this._verticesView = new DataView(this._vertices); - this._indices = new Uint32Array(this._maxGlyphs * 6); - this._isInitialized = true; + } + class Keyboard { + constructor(core) { + this._core = core; + this._pressedKeys = /* @__PURE__ */ new Set(); + this._previousPressedKeys = /* @__PURE__ */ new Set(); + } + initialize(element2) { + element2.addEventListener("keydown", (e) => { + this._handleKeyDown(e); + }, false); + element2.addEventListener("keyup", (e) => { + this._handleKeyUp(e); + }, false); + } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + } } - update(elapsedTime) {} -} -class Label extends LabelBase { - get textAlignment() { - return this._textAlignment; + isKeyDown(key2) { + return this._pressedKeys.has(key2); } - set textAlignment(value) { - if (this._textAlignment != value) { - this._textAlignment = value; - this._hasChanged = true; + wasKeyReleased(key2) { + if (this._pressedKeys.has(key2)) { + if (!this._previousPressedKeys.has(key2)) { + this._previousPressedKeys.add(key2); + return true; } + } else { + this._previousPressedKeys.delete(key2); + } + return false; } - get text() { - return this._text; + _handleKeyDown(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (!this._pressedKeys.has(key2)) { + this._pressedKeys.add(key2); + } } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; - } + _handleKeyUp(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (this._pressedKeys.has(key2)) { + this._pressedKeys.delete(key2); + } } - constructor(core, options){ - super(core, options); - this._font = options.font || core.font; - this._text = options.text; - this._textAlignment = options.textAlignment === undefined ? (0, _mainJs.TextAlignment).left : options.textAlignment; + } + class Manager { + constructor(core) { + this._manipulators = {}; + this._core = core; + this._vec3 = create$6(); + this._manipulationProcessor = new ManipulationProcessor(core); + this._manipulators = {}; + this._pointers = new Pointers(core, this._manipulators); + this._pointers.initialize(core.container); + this._mouseWheel = new MouseWheel(core); + this._mouseWheel.initialize(core.container); + this._keyboard = new Keyboard(core); + this._keyboard.initialize(core.container); + this.isPickingEnabled = true; + this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; + this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; + this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; + this.pickHoldDelay = this._core.config.pickHoldDelay; + this.pickSelectDelay = this._core.config.pickSelectDelay; + const rightButton2 = 2; + this.singleTouchAction = (manipulator) => { + if (manipulator.type == "mouse" && manipulator.button == rightButton2 || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.translate; + } else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton2) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.rotate; + } + }; + this.mouseWheelAction = (keyboard) => { + if (this._keyboard.isKeyDown("Control")) { + return MouseWheelAction.rotateY; + } else { + return MouseWheelAction.zoom; + } + }; + this.lassoPickType = PickType.data; + this._thumbstickX = 0; + this._previousControllerButtonPressed = [false, false, false, false]; + this._quat0 = create$4(); + this._quat1 = create$4(); } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - if (!this._text) { - this._indexCount = 0; - this.width = 0; - this.height = 0; - } else { - const widths = []; - const truncated = []; - let maxWidth = 0; - let maxGlyphHeight = 0; - let maxGlyphTop = 0; - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - widths.push(this._textMetric.width); - maxWidth = Math.max(this._textMetric.width, maxWidth); - maxGlyphHeight = Math.max(this._textMetric.maxHeight, maxGlyphHeight); - maxGlyphTop = Math.max(this._textMetric.maxTop, maxGlyphTop); - glyphs += text.length; - truncated.push(text); - if (glyphs >= this._maxGlyphs) break; - } - if (this._maxGlyphHeight) maxGlyphHeight = this._maxGlyphHeight; - if (this._maxGlyphTop) maxGlyphTop = this._maxGlyphTop; - const lineHeight = this._font.size; - const height = truncated.length * lineHeight; - switch(this._horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._originX = this._offsetX + maxWidth / 2; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._originX = this._offsetX; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._originX = this._offsetX - maxWidth / 2; - break; + update(elapsedTime, xrFrame) { + if (xrFrame) { + const inputSources = this._core.webXRSession.inputSources; + if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { + const inputSource = inputSources[0]; + const controllerVisual = this._core.renderer.controllers[0]; + if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { + const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); + if (gripPose) { + controllerVisual.mMatrix = gripPose.transform.matrix; + } + const gamepad = inputSource.gamepad; + this._core.renderer.isPickingEnabled = false; + const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); + if (rayPose) { + controllerVisual.rayMMatrix = rayPose.transform.matrix; + if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { + this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; + this._core.renderer.isPickingEnabled = true; + } + } + const threshold2 = 0.2; + const dampening = Math.min(0.015 * elapsedTime, 1); + this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold2, dampening); + if (this._thumbstickX != 0) { + setAxisAngle(this._quat0, Constants$1.VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); + this._core.getModelRotation(this._quat1); + multiply(this._quat1, this._quat0, this._quat1); + this._core.setModelRotation(this._quat1, true); + } + if (gamepad.buttons[2].pressed) { + if (!this._previousControllerButtonPressed[2]) { + this._previousControllerButtonPressed[2] = true; + if (this.controllerButtonPressedCallback) { + this.controllerButtonPressedCallback(2); } - switch(this._verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._originY = this._offsetY - height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._originY = this._offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._originY = this._offsetY + height / 2; - break; + } + } else { + this._previousControllerButtonPressed[2] = false; + } + } + } + } else { + const camera = this._core.camera; + this._manipulationProcessor.update(elapsedTime, this._manipulators); + this._pointers.update(elapsedTime); + this._mouseWheel.update(elapsedTime); + this._keyboard.update(elapsedTime); + if (this._mouseWheel.delta != 0) { + switch (this.mouseWheelAction(this._keyboard)) { + case MouseWheelAction.zoom: + if (this._pointers.hoverX, this._pointers.hoverY) { + camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); + } + break; + case MouseWheelAction.rotateY: + setAxisAngle(this._quat0, Constants$1.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); + camera.getOrbit(this._quat1); + multiply(this._quat1, this._quat1, this._quat0); + camera.setOrbit(this._quat1, true); + break; + } + } + const count2 = this._manipulationProcessor.count; + if (count2 == 0) { + if (this._isLassoPicking) { + this._isLassoPicking = false; + this._core.renderer.isLassoPicking = false; + const x02 = Math.min(this._lassoX0, this._lassoX1); + const y02 = Math.min(this._lassoY0, this._lassoY1); + const x12 = Math.max(this._lassoX0, this._lassoX1); + const y12 = Math.max(this._lassoY0, this._lassoY1); + if (x12 - x02 > 0 && y12 - y02 > 0) { + const sets = this._core.pickLasso(x02, y02, x12, y12, this.lassoPickType); + const result = { + x0: x02, + y0: y02, + x1: x12, + y1: y12, + pickType: this.lassoPickType, + ids: sets, + manipulator: this._manipulator + }; + this.pickLassoCallback(result); + } + } + } else if (count2 == 1) { + const translationDelta = this._manipulationProcessor.translationDelta; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + const manipulators = this._manipulationProcessor.manipulators; + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + switch (this.singleTouchAction(manipulator)) { + case SingleTouchAction.rotate: + camera.rotate(translationDelta); + break; + case SingleTouchAction.translate: + camera.translate(translationDelta); + break; + case SingleTouchAction.lasso: + if (this.pickLassoCallback) { + if (!this._isLassoPicking) { + this._isLassoPicking = true; + this._core.renderer.isLassoPicking = true; + this._lassoX0 = manipulator.position[0]; + this._lassoY0 = manipulator.position[1]; + } + this._lassoX1 = manipulator.position[0]; + this._lassoY1 = manipulator.position[1]; + this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); + this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); + } + break; + } + break; + } + } + } else { + const translationDelta = this._manipulationProcessor.translationDelta; + const camera2 = this._core.camera; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + camera2.translate(translationDelta); + } + if (this._manipulationProcessor.scaleDelta != 0) { + const distance2 = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; + camera2.zoom(distance2, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + if (this._manipulationProcessor.twistDelta != 0) { + camera2.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + } + if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { + const camera2 = this._core.camera; + const renderer = this._core.renderer; + if (renderer.isCapturingPickImage) { + camera2.updatePickVMatrix(renderer.width / 2, renderer.height / 2); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + this._pickedTime = 0; + } else if (this._pointers.hoverId > -1) { + const pickingX = this._pointers.hoverX; + const pickingY = this._pointers.hoverY; + camera2.updatePickVMatrix(pickingX, pickingY); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + if (this._pickedId != renderer.pickedId) { + this._pickedId = renderer.pickedId; + this._pickedTime = 0; + } else { + if (this._manipulationProcessor.count == 1) { + this._pickedTime += elapsedTime; + for (const key2 in this._manipulators) { + this._manipulator = this._manipulators[key2]; + break; } - glyphs = 0; - for(let i = 0; i < truncated.length; i++){ - switch(this._textAlignment){ - case (0, _mainJs.TextAlignment).left: - this._offset[0] = this._originX - maxWidth / 2; - break; - case (0, _mainJs.TextAlignment).center: - this._offset[0] = this._originX - widths[i] / 2; - break; - case (0, _mainJs.TextAlignment).right: - this._offset[0] = this._originX + maxWidth / 2 - widths[i]; - break; + } + } + if (this._pickedTime > 0) { + switch (renderer.pickedType) { + case PickType.data: + if (this._pickedTime > this.pickHoldDelay) { + renderer.getVertexPosition(this._vec3, this._pickedId); + this._core.setModelManipulationOrigin(this._vec3); + this._pickedTime = 0; + } else if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.transitionBuffers.length; i++) { + const transitionBuffer = renderer.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + transitionBuffer: i, + id: id2, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); + if (this.pickItemCallback) { + this.pickItemCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.label: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.labelSets.length; i++) { + const labelSet = renderer.labelSets[i].label; + const id2 = labelSet.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + label: id2, + set: i, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); + if (this.pickLabelSetCallback) { + this.pickLabelSetCallback(result); + } + break; + } + } } - this._offset[1] = this._originY + height / 2 - i * lineHeight - lineHeight / 2 - maxGlyphTop / 2; - const pickingId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickingId, (0, _mainJs.PickType).label, this._vec4); - const text = truncated[i]; - if (text.length > 0) { - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, (0, _constantsJs.Constants).VECTOR3_ZERO, 1, this._offset, null, this._vec4); - glyphs += text.length; + this._pickedTime = 0; + } + break; + case PickType.axesDivision: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickGridLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickGrid(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); + if (this.pickAxesGridCallback) { + this.pickAxesGridCallback(result); + } + break; + } + } } - } - const scaling = this._scale / this._font.size; - this.width = maxWidth * scaling; - this.height = height * scaling; - this._indexCount = glyphs * 6; - (0, _glMatrix.vec3).set(this._vec3, scaling, scaling, scaling); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, this._vec3); - if (this.hasChangedCallback) this.hasChangedCallback(); - } + this._pickedTime = 0; + } + break; + case PickType.axesTitle: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickTitleLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickTitle(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); + if (this.pickAxesTitleCallback) { + this.pickAxesTitleCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesLabel: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickLabelLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickLabel(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); + if (this.pickAxesLabelCallback) { + this.pickAxesLabelCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesHeading: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickHeadingLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickHeading(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); + if (this.pickAxesHeadingCallback) { + this.pickAxesHeadingCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + } + } + } else { + renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } else { + this._core.renderer.isPickingEnabled = false; + this._pickedTime = 0; } + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); + this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); + } } -} -class LabelSet extends LabelBase { - get materials() { - return this._materials; - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; + } + let Log$1 = class Log { + constructor(core) { + this._core = core; + } + write(level, value2) { + if (level >= this._core.config.logLevel) { + switch (level) { + case LogLevel.trace: + console.trace(value2); + break; + case LogLevel.debug: + console.debug(value2); + break; + case LogLevel.info: + console.info(value2); + break; + case LogLevel.warn: + console.warn(value2); + break; + case LogLevel.error: + console.error(value2); + break; } + } } - get minBoundsY() { - return this._minBoundsY; + }; + var __awaiter$4 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Core { + get container() { + return this._container; } - get maxBoundsX() { - return this._maxBoundsX; + get started() { + return this._started; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + get debugText() { + return this._debugText; } - get maxBoundsY() { - return this._maxBoundsY; + get log() { + return this._log; } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } + get totalFrames() { + return this._fps.totalFrames; } - get maxBoundsZ() { - return this._maxBoundsZ; + get camera() { + return this._camera; } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + set camera(value2) { + this._camera = value2; } - get positionsX() { - return this._positionsX; + getModelRotation(value2) { + copy$4(value2, this._modelRotation); } - set positionsX(value) { - if (this._positionsX != value) { - this._positionsX = value; - this._hasChanged = true; - } + setModelRotation(value2, isSmooth) { + copy$4(this._modelRotation, value2); + if (!isSmooth) { + copy$4(this._smoothedModelRotation, this._modelRotation); + } } - get positionsY() { - return this._positionsY; + getModelScale() { + return this._modelScale[0]; } - set positionsY(value) { - if (this._positionsY != value) { - this._positionsY = value; - this._hasChanged = true; - } + setModelScale(value2, isSmooth) { + set$8(this._modelScale, value2, value2, value2); + if (!isSmooth) { + copy$6(this._smoothedModelScale, this._modelScale); + } } - get positionsZ() { - return this._positionsZ; + getModelManipulationOrigin(value2) { + copy$6(value2, this._modelManipulationOrigin); } - set positionsZ(value) { - if (this._positionsZ != value) { - this._positionsZ = value; - this._hasChanged = true; - } + setModelManipulationOrigin(value2) { + this._updateManipulationOrigin(value2); } - get positionScalingX() { - return this._positionScalingX; + getModelPosition(value2) { + copy$6(value2, this._modelPosition); } - set positionScalingX(value) { - if (this._positionScalingX != value) { - this._positionScalingX = value; - this._hasChanged = true; - } + setModelPosition(value2, isSmooth) { + copy$6(this._modelPosition, value2); + if (!isSmooth) { + copy$6(this._smoothedModelPosition, this._modelPosition); + } } - get positionScalingY() { - return this._positionScalingY; + get webXRSession() { + return this._webXRSession; } - set positionScalingY(value) { - if (this._positionScalingY != value) { - this._positionScalingY = value; - this._hasChanged = true; - } + get renderer() { + return this._renderer; } - get positionScalingZ() { - return this._positionScalingZ; + set renderer(renderer) { + if (this._renderer == renderer) { + return; + } + if (this._renderer) { + this.stop(); + this._renderer.remove(); + } + if (!renderer.isInitialized) { + renderer.initialize(this); + } + if (this._renderer) { + renderer.transitionTime = this._renderer.transitionTime; + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const previousTransitionBuffer = this._renderer.transitionBuffers[i]; + const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); + transitionBuffer.copyFrom(previousTransitionBuffer); + renderer.transitionBuffers.push(transitionBuffer); + } + const currentAxes = this._renderer.currentAxes; + if (currentAxes) { + renderer.currentAxes = []; + for (let i = 0; i < currentAxes.length; i++) { + const axesVisual = currentAxes[i]; + const axes = axesVisual.axes; + if (axes instanceof Cartesian3dAxes) { + const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); + renderer.currentAxes.push(cartesian3dAxesVisual); + } else if (axes instanceof Cartesian2dAxes) { + renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); + } + } + } + const labelSets = this._renderer.labelSets; + if (labelSets) { + renderer.labelSets = []; + for (let i = 0; i < labelSets.length; i++) { + renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); + } + } + const images = this._renderer.images; + if (images) { + renderer.images = []; + for (let i = 0; i < images.length; i++) { + renderer.images.push(renderer.createImageVisual(images[i].image)); + } + } + const fonts = this._renderer.fonts; + if (fonts) { + for (const key2 in fonts) { + const font2 = fonts[key2].font; + renderer.fonts[font2.name] = renderer.createFontVisual(font2); + } + } + } else { + renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); + } + if (this._renderer) { + this._renderer.finalize(); + } + this._renderer = renderer; + this._fps.reset(); + this.start(); } - set positionScalingZ(value) { - if (this._positionScalingZ != value) { - this._positionScalingZ = value; - this._hasChanged = true; - } + get font() { + return this._font; } - get rotations() { - return this._rotations; + get paletteResources() { + return this._paletteResources; } - set rotations(value) { - if (this._rotations != value) { - this._rotations = value; - this._hasChanged = true; - } + get config() { + return this._config; } - get offsetsX() { - return this._offsetsX; + get inputManager() { + return this._inputManager; + } + constructor(options2) { + setMatrixArrayType(Array); + this._vec3 = create$6(); + this._quat = create$4(); + this._mat4 = create$7(); + this._container = options2 && options2.container ? options2.container : document.body; + this._config = new Config$2(this); + this._log = new Log$1(this); + this._debugText = new DebugText(); + this._inputManager = options2 && options2.useInputManager === false ? null : new Manager(this); + const fontRasterizerOptions = options2 && options2.fontRasterizerOptions ? options2.fontRasterizerOptions : { + fontAtlas: new FontAtlas(256, 512), + fontSize: 24, + border: 3, + fontFamily: '"segoe ui semibold", sans-serif', + fontWeight: "normal", + fontStyle: "normal", + baseline: "alphabetic", + maxDistance: 8, + edgeValue: 192 + }; + const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); + this._font = fontRasterizer.font; + this._paletteResources = new PaletteResources(); + this._previousTime = 0; + this._fps = new Fps(this); + this._modelMMatrix = create$7(); + this._modelPosition = create$6(); + this._modelRotation = create$4(); + this._modelScale = create$6(); + this._smoothedModelPosition = create$6(); + this._smoothedModelRotation = create$4(); + this._smoothedModelScale = create$6(); + this._modelManipulationOrigin = create$6(); + this._camera = new AltAzimuthCamera(this); + this.resetModel(false); } - set offsetsX(value) { - if (this._offsetsX != value) { - this._offsetsX = value; - this._hasChanged = true; - } + getView(view) { + this.getModelPosition(view.position); + this.getModelRotation(view.rotation); + view.scale = this.getModelScale(); } - get offsetsY() { - return this._offsetsY; + setView(view, isSmooth) { + this.setModelPosition(view.position, isSmooth); + this.setModelRotation(view.rotation, isSmooth); + this.setModelScale(view.scale, isSmooth); } - set offsetsY(value) { - if (this._offsetsY != value) { - this._offsetsY = value; - this._hasChanged = true; - } + lerpView(from, to, time2) { + lerp$1(this._vec3, from.position, to.position, time2); + this.setModelPosition(this._vec3, false); + slerp(this._quat, from.rotation, to.rotation, time2); + this.setModelRotation(this._quat, false); + this.setModelScale(MathHelper.lerp(from.scale, to.scale, time2), false); } - get offsetsZ() { - return this._offsetsZ; + resetModel(isSmooth) { + set$8(this._modelPosition, 0, 0, -this._config.modelDistance); + set$8(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); + set$6(this._modelRotation, 0, 0, 0, 1); + if (!isSmooth) { + this._syncSmooth(); + } } - set offsetsZ(value) { - if (this._offsetsZ != value) { - this._offsetsZ = value; - this._hasChanged = true; - } + resetManipulationOrigin() { + if (!exactEquals$1(this._modelManipulationOrigin, Constants$1.VECTOR3_ZERO)) { + this._updateManipulationOrigin(Constants$1.VECTOR3_ZERO); + } } - get offsetScalingX() { - return this._offsetScalingX; + reset(isSmooth) { + this.resetModel(isSmooth); + this.resetManipulationOrigin(); + this._camera.reset(isSmooth); } - set offsetScalingX(value) { - if (this._offsetScalingX != value) { - this._offsetScalingX = value; - this._hasChanged = true; + start() { + if (!this._started && this._renderer) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + this._started = true; + this._log.write(LogLevel.info, "render loop started"); + if (this.startCallback) { + this.startCallback(); } + } } - get offsetScalingY() { - return this._offsetScalingY; - } - set offsetScalingY(value) { - if (this._offsetScalingY != value) { - this._offsetScalingY = value; - this._hasChanged = true; + stop() { + if (this._started) { + this._started = false; + if (this._windowAnimationFrame != null) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + this._log.write(LogLevel.info, "render loop stopped"); } - } - get offsetScalingZ() { - return this._offsetScalingZ; - } - set offsetScalingZ(value) { - if (this._offsetScalingZ != value) { - this._offsetScalingZ = value; - this._hasChanged = true; + if (this.stopCallback) { + this.stopCallback(); } + } } - get text() { - return this._text; + checkWebXRSupport() { + const xrSystem = navigator.xr; + if (xrSystem) { + xrSystem.isSessionSupported("immersive-vr").then((supported) => { + if (supported) { + this._log.write(LogLevel.info, "WebXR supported"); + if (this.webXRSupportedCallback) { + this.webXRSupportedCallback(); + } + } + }); + } } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; - } + requestWebXRSession() { + if (this._webXRSession) { + this._webXRSession.end(); + } else { + navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); + } } - get horizontalAlignments() { - return this._horizontalAlignments; + _webXRSessionStarted(session) { + if (this.webXRSessionStartedCallback) { + this.webXRSessionStartedCallback(); + } + this._webXRSession = session; + session.onend = () => this._webXRSessionEnded(); + this._renderer.initializeWebXR(session).then(() => { + if (this._windowAnimationFrame) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + } + session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + }); + session.oninputsourceschange = (event2) => this._webXRInputSourcesChanged(event2); } - set horizontalAlignments(value) { - if (this._horizontalAlignments != value) { - this._horizontalAlignments = value; - this._hasChanged = true; + _webXRSessionEnded() { + if (this.webXRSessionEndedCallback) { + this.webXRSessionEndedCallback(); + } + this._webXRSession = null; + this._renderer.controllers.length = 0; + this.start(); + } + _webXRInputSourcesChanged(event2) { + if (event2.added.length > 0) { + const added = event2.added[0]; + if (added.targetRayMode == "tracked-pointer") { + const profiles = added.profiles; + const handedness = added.handedness; + if (this.webXRInputSourceRequestCallback) { + this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { + const options2 = { + profiles, + handedness, + obj: response.obj, + texture: response.texture + }; + const controller = new Controller(this, options2); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + }, (e) => { + this._log.write(LogLevel.error, e); + }); + } else { + const options2 = {}; + const controller = new Controller(this, options2); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + } } + } + if (event2.removed.length > 0) { + this.renderer.controllers.length = 0; + } } - get verticalAlignments() { - return this._verticalAlignments; - } - set verticalAlignments(value) { - if (this._verticalAlignments != value) { - this._verticalAlignments = value; - this._hasChanged = true; + _tick(currentTime, xrFrame) { + return __awaiter$4(this, void 0, void 0, function* () { + let elapsedTime = currentTime - this._previousTime; + this._previousTime = currentTime; + if (elapsedTime > 0) { + this.update(elapsedTime, xrFrame); + yield this.render(elapsedTime, xrFrame); + } + if (xrFrame) { + xrFrame.session.requestAnimationFrame((currentTime2, xrframe) => this._tick(currentTime2, xrframe)); + } else if (this._started) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime2) => this._tick(currentTime2)); } + }); } - get scales() { - return this._scales; + update(elapsedTime, xrFrame) { + this._renderer.setSize(elapsedTime); + if (this.updateCallback) { + this.updateCallback(elapsedTime, xrFrame); + } + if (this._config.isDebugVisible) { + this._debugText.clear(); + } + this._fps.update(elapsedTime); + if (this._inputManager) { + this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; + this._inputManager.update(elapsedTime, xrFrame); + } + let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); + lerp$1(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); + amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); + slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); + amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); + lerp$1(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); + fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); + this._renderer.mMatrix = this._modelMMatrix; + if (this._config.isDebugVisible) { + this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); + this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); + this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); + this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); + this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); + this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); + this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); + } + if (!xrFrame) { + this._camera.width = this._renderer.width; + this._camera.height = this._renderer.height; + this._camera.modelMMatrix = this._modelMMatrix; + this._camera.modelPosition = this._smoothedModelPosition; + this._camera.modelRotation = this._smoothedModelRotation; + this._camera.modelScale = this._smoothedModelScale; + this._camera.modelManipulationOrigin = this._modelManipulationOrigin; + this._camera.update(elapsedTime); + this._renderer.vMatrices = this._camera.vMatrices; + this._renderer.mvMatrices = this._camera.mvMatrices; + this._renderer.pMatrices = this._camera.pMatrices; + this._renderer.inverseVMatrices = this._camera.inverseVMatrices; + this._renderer.inversePMatrices = this._camera.inversePMatrices; + } + this._renderer.prepare(xrFrame); + if (!xrFrame && this._config.stereoMode == StereoMode.none) { + this._renderer.pickPMatrix = this._camera.pMatrices[0]; + } else { + const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); + perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); + this._renderer.pickPMatrix = this._mat4; + } + if (this._renderer.isInitialized) { + this._renderer.update(elapsedTime); + } } - set scales(value) { - if (this._scales != value) { - this._scales = value; - this._hasChanged = true; + render(elapsedTime, xrFrame) { + return __awaiter$4(this, void 0, void 0, function* () { + this._fps.render(); + if (this._renderer.isInitialized) { + yield this._renderer.render(elapsedTime, xrFrame); + if (this.afterRenderCallback) { + this.afterRenderCallback(); + } } + }); } - get scalesScaling() { - return this._scalesScaling; - } - set scalesScaling(value) { - if (this._scalesScaling != value) { - this._scalesScaling = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._quat = (0, _glMatrix.quat).create(); - this._materials = options.materials; - this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - this._font = options.font || core.font; - this.text = options.text; - this.positionsX = options.positionsX; - this.positionsY = options.positionsY; - this.positionsZ = options.positionsZ; - this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - this.rotations = options.rotations; - this.offsetsX = options.offsetsX; - this.offsetsY = options.offsetsY; - this.offsetsZ = options.offsetsZ; - this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - if (options.horizontalAlignments) this.horizontalAlignments = options.horizontalAlignments; - if (options.verticalAlignments) this.verticalAlignments = options.verticalAlignments; - if (options.scales) this.scales = options.scales; - this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; + _syncSmooth() { + copy$6(this._smoothedModelPosition, this._modelPosition); + copy$6(this._smoothedModelScale, this._modelScale); + copy$4(this._smoothedModelRotation, this._modelRotation); + } + _updateManipulationOrigin(position2) { + this._log.write(LogLevel.info, `manipulation origin ${position2[0].toFixed(3)},${position2[1].toFixed(3)},${position2[2].toFixed(3)}`); + this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position2); + copy$6(this._modelManipulationOrigin, position2); + transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); + subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); + copy$6(this._smoothedModelPosition, this._modelPosition); + if (this.manipulationOriginChangedCallback) { + const result = { + x: position2[0], + y: position2[1], + z: position2[2] + }; + this.manipulationOriginChangedCallback(result); + } } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.pickIdLookup = {}; - if (!this._text) this._indexCount = 0; - else { - const start = window.performance.now(); - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; - const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; - const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; - if (this._rotation) (0, _glMatrix.quat).set(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; - const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; - const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - const scale = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const lineHeight = this._font.size * scale; - const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale; - const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = offsetX - width; - break; - } - const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = offsetY + lineHeight / 2; - break; - } - this._offset[1] -= maxGlyphTop / 2; - this._offset[2] = offsetZ; - let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; - let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; - let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; - if (this._reverseX) positionX = this.minBoundsX + this.maxBoundsX - positionX; - if (this._reverseY) positionY = this.minBoundsY + this.maxBoundsY - positionY; - if (this._reverseZ) positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; - (0, _glMatrix.vec3).set(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); - if (this._rotations) (0, _glMatrix.quat).set(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = i; - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, this._vec3, scale, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); - glyphs += text.length; - if (glyphs >= this._maxGlyphs) { - glyphs = this._maxGlyphs; - break; - } + pickLasso(x02, y02, x12, y12, pickType) { + const inverseMMatrix = create$7(); + invert$1(inverseMMatrix, this._modelMMatrix); + const sets = []; + const nearPositions = [create$6(), create$6(), create$6(), create$6()]; + const farPositions = [create$6(), create$6(), create$6(), create$6()]; + const directions = [create$6(), create$6(), create$6(), create$6()]; + this._camera.unproject(nearPositions[0], x02, y12, -1); + this._camera.unproject(farPositions[0], x02, y12, 1); + this._camera.unproject(nearPositions[1], x12, y12, -1); + this._camera.unproject(farPositions[1], x12, y12, 1); + this._camera.unproject(nearPositions[2], x12, y02, -1); + this._camera.unproject(farPositions[2], x12, y02, 1); + this._camera.unproject(nearPositions[3], x02, y02, -1); + this._camera.unproject(farPositions[3], x02, y02, 1); + for (let i = 0; i < 4; i++) { + transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); + transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); + subtract(directions[i], farPositions[i], nearPositions[i]); + normalize$5(directions[i], directions[i]); + } + const normals = [create$6(), create$6(), create$6(), create$6()]; + const d2 = []; + for (let i = 0; i < 4; i++) { + cross$1(normals[i], directions[(i + 1) % 4], directions[i]); + normalize$5(normals[i], normals[i]); + d2.push(-dot$1(normals[i], nearPositions[i])); + } + if (pickType == PickType.data) { + const translation = create$6(); + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const transitionBuffer = this._renderer.transitionBuffers[i]; + const set2 = /* @__PURE__ */ new Set(); + if (transitionBuffer.isVisible) { + const start = window.performance.now(); + const currentBuffer = transitionBuffer.currentBuffer; + const lookup2 = currentBuffer.lookup; + for (let j = 0; j < currentBuffer.length; j++) { + const id2 = currentBuffer.ids[j]; + const index2 = lookup2[id2]; + if (index2 != null) { + UnitVertex.getTranslation(currentBuffer.dataView, index2, translation); + let isInside = true; + for (let k = 0; k < 4; k++) { + let distance2 = dot$1(normals[k], translation); + distance2 += d2[k]; + if (distance2 < 0) { + isInside = false; + break; + } } - this._indexCount = glyphs * 6; - this._core.log.write((0, _mainJs.LogLevel).info, `label set updated ${Math.round(window.performance.now() - start)}ms`); - if (this.hasChangedCallback) this.hasChangedCallback(); + if (isInside) { + set2.add(id2); + } + } + } + if (set2.size > 0) { + this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set2.size} ${Math.round(window.performance.now() - start)}ms`); } + } + sets.push(set2); } + } + return sets; + } + } + const StereoMode = { + none: "none", + split: "split", + anaglyph: "anaglyph", + left: "left", + right: "right" + }; + const HorizontalAlignment = { + left: "left", + center: "center", + right: "right" + }; + const VerticalAlignment = { + top: "top", + center: "center", + bottom: "bottom" + }; + const AxesTextOrientation = { + parallel: "parallel", + perpendicular: "perpendicular" + }; + const AxesVisibility = { + none: "none", + current: "current", + previous: "previous" + }; + const PickType = { + none: 0, + data: 1, + label: 2, + axesDivision: 3, + axesTitle: 4, + axesLabel: 5, + axesHeading: 6 + }; + const Theme = { + dark: "dark", + light: "light" + }; + const HighlightMode = { + luminance: "luminance", + color: "color" + }; + const UnitType = { + block: "block", + blockSdf: "blockSdf", + sphere: "sphere", + sphereSdf: "sphereSdf", + cylinder: "cylinder", + cylinderSdf: "cylinderSdf", + hexPrism: "hexPrism", + hexPrismSdf: "hexPrismSdf", + sdf: "sdf", + disk: "disk", + ringSdf: "ringSdf" + }; + const SingleTouchAction = { + translate: "translate", + rotate: "rotate", + lasso: "lasso" + }; + const MouseWheelAction = { + zoom: "zoom", + rotateY: "rotateY" + }; + const LogLevel = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4 + }; + const Edge3D = { + topFront: 0, + topRight: 1, + topBack: 2, + bottomRight: 5, + frontRight: 8, + backRight: 9 + }; + const RenderMode = { + color: "color" + }; + let LabelSetVisual$2 = class LabelSetVisual { + render(elapsedTime, xrFrame) { } -} -class TransitionLabelSet { - constructor(core){ - this._core = core; - this._vec2 = (0, _glMatrix.vec2).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._quat = (0, _glMatrix.quat).create(); - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this._topLeft = (0, _glMatrix.vec3).create(); - this._topRight = (0, _glMatrix.vec3).create(); - this._bottomLeft = (0, _glMatrix.vec3).create(); - this._bottomRight = (0, _glMatrix.vec3).create(); - this._offset = (0, _glMatrix.vec3).create(); + update(elapsedTime) { } - update(buffer, labelIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.text.length : options.count; - const dataView = buffer.dataView; - const minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - const minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - const minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - const maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - const maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - const maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - const positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - const positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - const positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - const offsetX = options.offsetX ? options.offsetX : 0; - const offsetY = options.offsetY ? options.offsetY : 0; - const offsetZ = options.offsetZ ? options.offsetZ : 0; - const offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - const offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - const offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const scale = options.scale ? options.scale : 1; - const scalesScaling = options.scalesScaling ? options.scalesScaling : 1; - const font = options.font || this._core.font; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const modelSizeX = maxBoundsX - minBoundsX; - const modelSizeY = maxBoundsY - minBoundsY; - const modelSizeZ = maxBoundsZ - minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (minBoundsX + maxBoundsX) / 2; - const modelOriginY = (minBoundsY + maxBoundsY) / 2; - const modelOriginZ = (minBoundsZ + maxBoundsZ) / 2; - if (options.rotation) { - this._quat[0] = options.rotation[0]; - this._quat[1] = options.rotation[1]; - this._quat[2] = options.rotation[2]; - this._quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(this._quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - this.pickIdLookup = {}; - for(let i = 0; i < count; i++){ - const labelIndex = labelIds[i + offset]; - const _offsetX = (options.offsetsX ? options.offsetsX[labelIndex] / 2 : offsetX) * boundsScaling * offsetScalingX; - const _offsetY = (options.offsetsY ? options.offsetsY[labelIndex] / 2 : offsetY) * boundsScaling * offsetScalingY; - const _offsetZ = (options.offsetsZ ? options.offsetsZ[labelIndex] / 2 : offsetZ) * boundsScaling * offsetScalingZ; - const label = options.text[labelIndex]; - const _scale = (options.scales ? options.scales[labelIndex] * scalesScaling : scale) * boundsScaling / font.size; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width * _scale; - const lineHeight = font.size * _scale; - const _maxGlyphTop = (options.maxGlyphTop ? options.maxGlyphTop : this._textMetric.maxTop) * _scale; - const _horizontalAlignment = options.horizontalAlignments ? options.horizontalAlignments[labelIndex] : horizontalAlignment; - switch(_horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = _offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = _offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = _offsetX - width; - break; - } - const _verticalAlignment = options.verticalAlignments ? options.verticalAlignments[labelIndex] : verticalAlignment; - switch(_verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = _offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = _offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = _offsetY + lineHeight / 2; - break; - } - this._offset[1] -= _maxGlyphTop / 2; - this._offset[2] = _offsetZ; - let positionX = options.positionsX ? options.positionsX[labelIndex] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[labelIndex] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[labelIndex] * positionScalingZ : 0; - if (options.reverseX) positionX = minBoundsX + maxBoundsX - positionX; - if (options.reverseY) positionY = minBoundsY + maxBoundsY - positionY; - if (options.reverseZ) positionZ = minBoundsZ + maxBoundsZ - positionZ; - positionX = (positionX - modelOriginX) * boundsScaling; - positionY = (positionY - modelOriginY) * boundsScaling; - positionZ = (positionZ - modelOriginZ) * boundsScaling; - if (options.rotations) (0, _glMatrix.quat).set(this._quat, options.rotations[labelIndex * 4], options.rotations[labelIndex * 4 + 1], options.rotations[labelIndex * 4 + 2], options.rotations[labelIndex * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = labelIndex; - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[labelIndex], minOrder, maxOrder, 0, 1); - this._vec2[0] = orderReverse ? 1 - order : order; - } else this._vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) this._vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[labelIndex], minStaggerOrder, maxStaggerOrder, 0, 1); - this._vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else this._vec2[1] = count == 1 ? 0 : i / (count - 1); - let glyphIndex = options.glyphOffsets[labelIndex]; - for (const char of label){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const width = glyph.width * _scale; - const height = glyph.height * _scale; - const top = glyph.top * _scale; - const border = font.border * _scale; - const x0 = this._offset[0] - border; - const x1 = this._offset[0] + width + border; - const y0 = this._offset[1] + top + border; - const y1 = this._offset[1] + top - height - border; - const z0 = this._offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (options.rotation || options.rotations) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, this._quat); - } - (0, _vertexJs.UnitVertex).setRotation(dataView, glyphIndex, this._quat); - this._vec3[0] = positionX + (this._topLeft[0] + this._bottomRight[0]) / 2; - this._vec3[1] = positionY + (this._topLeft[1] + this._bottomRight[1]) / 2; - this._vec3[2] = positionZ + (this._topLeft[2] + this._bottomRight[2]) / 2; - (0, _vertexJs.UnitVertex).setTranslation(dataView, glyphIndex, this._vec3); - this._vec3[0] = Math.abs(x1 - x0); - this._vec3[1] = Math.abs(y1 - y0); - this._vec3[2] = 0.001; - (0, _vertexJs.UnitVertex).setScale(dataView, glyphIndex, this._vec3); - this._vec4[0] = glyph.u0; - this._vec4[1] = glyph.v0; - this._vec4[2] = glyph.u1; - this._vec4[3] = glyph.v1; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, glyphIndex, this._vec4); - (0, _vertexJs.UnitVertex).setIdHover(dataView, glyphIndex, options.hover ? options.hover[labelIndex] : labelIndex); - (0, _vertexJs.UnitVertex).setOrder(dataView, glyphIndex, this._vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, glyphIndex, options.material ? options.material : options.materials ? options.materials[labelIndex] : 0); - (0, _vertexJs.UnitVertex).setTexture(dataView, glyphIndex, 1); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, glyphIndex, this._core.config.sdfBuffer); - this._offset[0] += glyph.advance * _scale; - glyphIndex++; - } - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../helpers/text.js":"fG2oi","../constants.js":"lD0bG","../vertex.js":"4J2YE","../helpers/pick.js":"1t2sb","../helpers/math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwtZG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -parcelHelpers.export(exports, "ImageBase", ()=>ImageBase); -parcelHelpers.export(exports, "ImageQuad", ()=>ImageQuad); -parcelHelpers.export(exports, "ImageSphere", ()=>ImageSphere); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -var _sphereJs = require("../meshes/sphere.js"); -var _constantsJs = require("../constants.js"); -class ImageVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(image){ - this.image = image; - } -} -class ImageBase { + constructor(labelSet) { + this.label = labelSet; + } + }; + let LabelBase$1 = class LabelBase { get material() { - return this._material; + return this._material; } get vertices() { - return this._vertices; + return this._vertices; + } + get verticesView() { + return this._verticesView; } get indices() { - return this._indices; + return this._indices; } get indexCount() { - return this._indexCount; + return this._indexCount; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get mMatrix() { - return this._mMatrix; + return this._mMatrix; } - get imageData() { - return this._imageData; + get materialType() { + return this._materialType; } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._hasChanged = true; - } + get materialColor() { + return this._materialColor; } - get rotation() { - return this._rotation; + get materialFuzz() { + return this._materialFuzz; } - set rotation(value) { - if (!(0, _glMatrix.quat).equals(this._rotation, value)) { - (0, _glMatrix.quat).copy(this._rotation, value); - this._hasChanged = true; - } + get materialGloss() { + return this._materialGloss; } - get position() { - return this._position; + get segmentColor() { + return this._segmentColor; } - set position(value) { - if (!(0, _glMatrix.vec3).equals(this._position, value)) { - (0, _glMatrix.vec3).copy(this._position, value); - this._hasChanged = true; - } + get scale() { + return this._scale; } - get texCoord0() { - return this._texCoord0; + set scale(value2) { + if (this._scale != value2) { + this._scale = value2; + this._hasChanged = true; + } } - set texCoord0(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord0, value)) { - (0, _glMatrix.vec2).copy(this._texCoord0, value); - this._hasChanged = true; - } + get font() { + return this._font; } - get texCoord1() { - return this._texCoord1; + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } - set texCoord1(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord1, value)) { - (0, _glMatrix.vec2).copy(this._texCoord1, value); - this._hasChanged = true; - } + get rotation() { + return this._rotation; } - get minBoundsX() { - return this._minBoundsX; + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._hasChanged = true; + } } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; - } + set reverseX(value2) { + if (this._reverseX != value2) { + this._reverseX = value2; + this._hasChanged = true; + } } - get minBoundsY() { - return this._minBoundsY; + set reverseY(value2) { + if (this._reverseY != value2) { + this._reverseY = value2; + this._hasChanged = true; + } } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; - } + set reverseZ(value2) { + if (this._reverseZ != value2) { + this._reverseZ = value2; + this._hasChanged = true; + } } - get minBoundsZ() { - return this._minBoundsZ; + get horizontalAlignment() { + return this._horizontalAlignment; } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } + set horizontalAlignment(value2) { + if (this._horizontalAlignment != value2) { + this._horizontalAlignment = value2; + this._hasChanged = true; + } } - get maxBoundsX() { - return this._maxBoundsX; + get verticalAlignment() { + return this._verticalAlignment; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + set verticalAlignment(value2) { + if (this._verticalAlignment != value2) { + this._verticalAlignment = value2; + this._hasChanged = true; + } } - get maxBoundsY() { - return this._maxBoundsY; + get offsetX() { + return this._offsetX; } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } + set offsetX(value2) { + if (this._offsetX != value2) { + this._offsetX = value2; + this._hasChanged = true; + } } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._origin = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._scale = (0, _glMatrix.vec3).create(); - this._transform = (0, _glMatrix.mat4).create(); - this._imageData = options.imageData; - this._minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - this._minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - this._minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - this._maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - this._maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - this._maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - this._position = options.position ? (0, _glMatrix.vec3).clone(options.position) : (0, _glMatrix.vec3).create(); - this._rotation = options.rotation ? (0, _glMatrix.quat).clone(options.rotation) : (0, _glMatrix.quat).create(); - this._texCoord0 = options.texCoord0 ? (0, _glMatrix.vec2).clone(options.texCoord0) : (0, _glMatrix.vec2).fromValues(0, 0); - this._texCoord1 = options.texCoord1 ? (0, _glMatrix.vec2).clone(options.texCoord1) : (0, _glMatrix.vec2).fromValues(1, 1); - this._material = options.material === undefined ? -1 : options.material; + get offsetY() { + return this._offsetY; + } + set offsetY(value2) { + if (this._offsetY != value2) { + this._offsetY = value2; this._hasChanged = true; + } } -} -class ImageQuad extends ImageBase { - get width() { - return this._width; + get offsetZ() { + return this._offsetZ; } - set width(value) { - if (this._width != value) { - this._width = value; - this._hasChanged = true; - } + set offsetZ(value2) { + if (this._offsetZ != value2) { + this._offsetZ = value2; + this._hasChanged = true; + } } - get height() { - return this._height; + get maxGlyphTop() { + return this._maxGlyphTop; } - set height(value) { - if (this._height != value) { - this._height = value; - this._hasChanged = true; - } + set maxGlyphTop(value2) { + if (this._maxGlyphTop != value2) { + this._maxGlyphTop = value2; + this._hasChanged = true; + } } - constructor(core, options){ - super(core, options); - this._width = options.width === undefined ? 1 : options.width; - this._height = options.height === undefined ? 1 : options.height; - this._texTransform = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).translate(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(0, 1, 0)); - (0, _glMatrix.mat4).scale(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(1, -1, 1)); + get maxGlyphHeight() { + return this._maxGlyphHeight; } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * 4); - this._indices = (0, _quadJs.Quad).INDICES; - this._indexCount = this._indices.length; - this._isInitialized = true; + set maxGlyphHeight(value2) { + if (this._maxGlyphHeight != value2) { + this._maxGlyphHeight = value2; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(this._translation, this._position, this._origin); - (0, _glMatrix.vec3).scale(this._translation, this._translation, boundsScaling); - (0, _glMatrix.vec3).set(this._scale, this._width, this._height, 1); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); - this._verticesView = (0, _quadJs.Quad).normalTextured(this._transform, this._texTransform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} -class ImageSphere extends ImageBase { - get radius() { - return this._radius; - } - set radius(value) { - if (this._radius != value) { - this._radius = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._radius = options.radius === undefined ? 0.5 : options.radius; - this._slices = options.slices === undefined ? 72 : options.slices; - this._stacks = options.stacks === undefined ? 36 : options.stacks; + constructor(core, options2) { + this._core = core; + this._offset = create$6(); + this._vec3 = create$6(); + this._vec4 = create$5(); + this._mMatrix = create$7(); + this._indexCount = 0; + this._maxGlyphs = options2.maxGlyphs; + this._textMetric = { width: 0, maxHeight: 0, maxTop: 0 }; + this.scale = options2.scale ? options2.scale : 1; + this.offsetX = options2.offsetX ? options2.offsetX : 0; + this.offsetY = options2.offsetY ? options2.offsetY : 0; + this.offsetZ = options2.offsetZ ? options2.offsetZ : 0; + this.reverseX = options2.reverseX; + this.reverseY = options2.reverseY; + this.reverseZ = options2.reverseZ; + this.rotation = options2.rotation; + this.maxGlyphTop = options2.maxGlyphTop; + this.horizontalAlignment = options2.horizontalAlignment === void 0 ? HorizontalAlignment.center : options2.horizontalAlignment; + this.verticalAlignment = options2.verticalAlignment === void 0 ? VerticalAlignment.center : options2.verticalAlignment; + this._material = options2.material; + this.borderWidth = core.config.textBorderWidth; + this.gamma = 0; + this._materialType = options2.materialType || 0; + this._materialColor = options2.materialColor || core.config.textColor; + this._materialFuzz = options2.materialFuzz || 0; + this._materialGloss = options2.materialGloss || 0; + this._segmentColor = options2.segmentColor; } initialize() { - this._sphere = new (0, _sphereJs.Sphere)(this._core); - this._vertices = this._sphere.normalTextured(this._slices, this._stacks, (0, _constantsJs.Constants).MAT4_IDENTITY).buffer; - this._indices = this._sphere.indices(this._slices, this._stacks); - this._indexCount = this._indices.length; - this._isInitialized = true; + this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); + this._verticesView = new DataView(this._vertices); + this._indices = new Uint32Array(this._maxGlyphs * 6); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).set(this._scale, this._radius, this._radius, this._radius); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._transform, this._rotation, this._position, this._scale, this._origin); - this._verticesView = this._sphere.normalTextured(this._slices, this._stacks, this._transform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"5x28d","../vertex.js":"4J2YE","../meshes/quad.js":"3PqJr","../meshes/sphere.js":"aj6T2","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aj6T2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sphere", ()=>Sphere); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _vertexJs = require("../vertex.js"); -class Sphere { - constructor(core){} - positions(slices, stacks, transform) { - const vertices = new Float32Array((slices + 1) * (stacks + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++){ - const latitude = 90 - 180 * stack / stacks; - for(let slice = 0; slice <= slices; slice++){ - const longitude = 360 * slice / slices - 180; - (0, _angleJs.AngleHelper).sphericalToCartesian(1, longitude, latitude, position); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - } - return vertices; - } - indices(slices, stacks) { - const indices = new Uint16Array(slices * stacks * 6); - let index = 0; - for(let stack = 0; stack < stacks; stack++){ - const top = stack * (slices + 1); - const bottom = (stack + 1) * (slices + 1); - for(let slice = 0; slice < slices; slice++){ - if (stack != 0) { - indices[index++] = top + slice; - indices[index++] = bottom + slice; - indices[index++] = top + slice + 1; - } - if (stack != stacks - 1) { - indices[index++] = top + slice + 1; - indices[index++] = bottom + slice; - indices[index++] = bottom + slice + 1; - } - } - } - return indices; - } - textured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - normalTextured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal = (0, _glMatrix.vec3).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - (0, _glMatrix.vec3).set(normal, position[0] - transform[12], position[1] - transform[13], position[2] - transform[14]); - (0, _glMatrix.vec3).normalize(normal, normal); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal); - } - return verticesView; - } - _texCoords(slices, stacks, transform) { - const texCoords = new Float32Array((slices + 1) * (stacks + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++)for(let slice = 0; slice <= slices; slice++){ - (0, _glMatrix.vec2).set(texCoord, slice / slices, stack / stacks); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/angle.js":"53hwW","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmBQh":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyVisual", ()=>KeyVisual); -parcelHelpers.export(exports, "KeyBase", ()=>KeyBase); -parcelHelpers.export(exports, "NominalKey", ()=>NominalKey); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _scatterJs = require("../layouts/scatter.js"); -var _mathJs = require("../helpers/math.js"); -var _labelsJs = require("./labels.js"); -class KeyVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(key){ - this.key = key; - } -} -class KeyBase { - get isInitialized() { - return this._isInitialized; - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value) { - if (value != this.minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } - } - get maxBoundsX() { - return this._maxBoundsX; - } - set maxBoundsX(value) { - if (value != this.minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } - } - get minBoundsY() { - return this._minBoundsY; - } - set minBoundsY(value) { - if (value != this.minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } - } - get maxBoundsY() { - return this._maxBoundsY; - } - set maxBoundsY(value) { - if (value != this.minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value) { - if (value != this.minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } - } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value) { - if (value != this.minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - get unitType() { - return this._unitType; - } - set unitType(value) { - if (this._unitType != value) { - this._unitType = value; - this._hasChanged = true; - } - } - get palette() { - return this._palette; - } - set palette(value) { - if (this._palette != value) { - this._palette = value; - this._hasChanged = true; - } } + }; + class LabelSet extends LabelBase$1 { get materials() { - return this._materials; - } - set materials(value) { - if (this._materials != value) { - this._materials = value; - this._hasChanged = true; - } - } - get sizesX() { - return this._sizesX; + return this._materials; } - set sizesX(value) { - if (this._sizesX != value) { - this._sizesX = value; - this._hasChanged = true; - } - } - get sizesY() { - return this._sizesY; - } - set sizesY(value) { - if (this._sizesY != value) { - this._sizesY = value; - this._hasChanged = true; - } - } - get sizesZ() { - return this._sizesZ; - } - set sizesZ(value) { - if (this._sizesZ != value) { - this._sizesZ = value; - this._hasChanged = true; - } - } - get spacing() { - return this._spacing; + get materialTypes() { + return this._materialTypes; } - set spacing(value) { - if (this._spacing != value) { - this._spacing = value; - this._hasChanged = true; - } - } - get textVertices() { - return this._textVertices; - } - get textIndices() { - return this._textIndices; - } - get labelMMatrix() { - return this._labelMMatrix; + get materialColors() { + return this._materialColors; } - set labelPositions(value) { - if (this._labelPositions != value) { - this._labelPositions = value; - this._hasChanged = true; - } + get materialFuzzes() { + return this._materialFuzzes; } - set labels(value) { - if (this._labels != value) { - this._labels = value; - this._hasChanged = true; - } + get materialGlosses() { + return this._materialGlosses; } - set labelSize(value) { - if (this._labelSize != value) { - this._labelSize = value; - this._hasChanged = true; - } + get segmentColors() { + return this._segmentColors; } - get labelOrientation() { - return this._orientation; + get minBoundsX() { + return this._minBoundsX; } - set labelOrientation(value) { - if (this._orientation != value) { - this._orientation = value; - this._hasChanged = true; - } + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - get titleIndexCount() { - return this._titleIndexCount; + get minBoundsY() { + return this._minBoundsY; } - get titleIndexOffset() { - return this._titleIndexOffset; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - get titleMMatrix() { - return this._titleMMatrix; + get minBoundsZ() { + return this._minBoundsZ; } - set title(value) { - if (this._title != value) { - this._title = value; - this._hasChanged = true; - } + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - set titleSize(value) { - if (this._titleSize != value) { - this._titleSize = value; - this._hasChanged = true; - } + get maxBoundsX() { + return this._maxBoundsX; } - constructor(core, options){ - this._core = core; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - initialize() { - this._isInitialized = true; + get maxBoundsY() { + return this._maxBoundsY; } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._size[0], this._size[1]), this._size[2]); - (0, _glMatrix.vec3).scale(this._size, this._size, 1 / maxBounds); - this._update(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `key updated ${Math.round(window.performance.now() - start)}ms`); - } - } + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - _update(size) {} -} -class NominalKey extends KeyBase { - constructor(core, options){ - super(core, options); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 0 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 0 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 0 : options.maxBoundsZ; - const positionX = options.positionX === undefined ? 0 : options.positionX; - const positionY = options.positionY === undefined ? 0 : options.positionY; - const positionZ = options.positionZ === undefined ? 0 : options.positionZ; - const sizeX = options.sizeX === undefined ? 1 : options.sizeX; - const sizeY = options.sizeY === undefined ? 1 : options.sizeY; - const sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - const spacing = options.spacing === undefined ? 1 : options.spacing; - const labelScale = options.labelScale === undefined ? 1 : options.labelScale; - const labelMaxGlyphs = options.labelMaxGlyphs === undefined ? this._core.config.keyLabelMaxGlyphs : options.labelMaxGlyphs; - const titleScale = options.titleScale === undefined ? 1 : options.titleScale; - const titleMaxGlyphs = options.titleMaxGlyphs === undefined ? this._core.config.keyTitleMaxGlyphs : options.titleMaxGlyphs; - const font = options.font ? options.font : this._core.font; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const orientation = options.orientation === undefined ? (0, _mainJs.Orientation).horizontal : options.orientation; - const labelPosition = options.labelPosition === undefined ? (0, _mainJs.Edge2D).right : options.labelPosition; - const labelOrientation = options.labelOrientation === undefined ? (0, _mainJs.Orientation).horizontal : options.labelOrientation; - const rotation = (0, _glMatrix.quat).create(); - let count = options.values.length; - const ids = new Uint32Array(count); - let minValue = Number.MAX_VALUE; - let maxValue = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - ids[i] = i; - const value = options.values[i]; - minValue = Math.min(minValue, value); - maxValue = Math.max(maxValue, value); - } - const materialIds = new Uint32Array(count); - for(let i = 0; i < count; i++)materialIds[i] = (0, _mathJs.MathHelper).normalize(options.values[i], minValue, maxValue, 0, options.palette.length / 4 - 1); - let glyphCount = 0; - let totalLabelWidth = 0; - let maxLabelWidth = 0; - for(let i = 0; i < count; i++){ - const label = (0, _textJs.TextHelper).truncate(options.labels[i], labelMaxGlyphs); - glyphCount += label.length; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width; - totalLabelWidth += width; - maxLabelWidth = Math.max(width, maxLabelWidth); - } - let titleWidth = 0; - let title; - if (options.title) { - title = (0, _textJs.TextHelper).truncate(options.title, titleMaxGlyphs); - glyphCount += title.length; - (0, _textJs.TextHelper).measure(font, title, this._textMetric); - titleWidth = this._textMetric.width; - } - let width; - let height; - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - case (0, _mainJs.Orientation).vertical: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - } - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - width = Math.max(sizeX * count + spacing * (count - 1) + totalLabelWidth, titleWidth); - height = sizeY; - if (options.title) height += titleScale; - break; - case (0, _mainJs.Orientation).vertical: - width = Math.max(sizeX + labelScale / 2 + maxLabelWidth, titleWidth); - height = sizeY * count + spacing * (count - 1); - if (options.title) height += titleScale; - break; - } - let originX = positionX; - let originY = positionY; - let originZ = positionZ; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).center: - break; - case (0, _mainJs.HorizontalAlignment).left: - originX += width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - originX -= width / 2; - break; - } - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).bottom: - originY += height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - break; - case (0, _mainJs.VerticalAlignment).top: - originY -= height / 2; - break; - } - const positionsX = new Float64Array(count); - const positionsY = new Float64Array(count); - const positionsZ = new Float64Array(count); - for(let i = 0; i < count; i++){ - positionsX[i] = originX - width / 2 + sizeX / 2; - positionsY[i] = originY + height / 2 - i * (sizeY + spacing); - positionsZ[i] = originZ + sizeZ / 2; - } - const scatter = new (0, _scatterJs.Scatter)(this._core); - const scatterLayoutOptions = { - positionsX: positionsX, - positionsY: positionsY, - positionsZ: positionsZ - }; - scatter.layout(this._transitionBuffer.currentBuffer, ids, scatterLayoutOptions); - const scatterVertexOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - colors: options.values, - minColor: minValue, - maxColor: maxValue, - sizeScalingX: sizeX, - sizeScalingY: sizeY, - sizeScalingZ: sizeZ, - materials: materialIds - }; - scatter.update(this._transitionBuffer.currentBuffer, ids, scatterVertexOptions); - const labelSetOptions = { - text: options.labels, - maxGlyphs: glyphCount, - scale: labelScale, - font: font - }; - const labelSet = new (0, _labelsJs.LabelSet)(this._core, labelSetOptions); - if (options.title) count++; - const labelPositionsX = new Float64Array(count); - const labelPositionsY = new Float64Array(count); - const labelPositionsZ = new Float64Array(count); - for(let i = 0; i < (options.title ? count - 1 : count); i++){ - labelPositionsX[i] = originX - width / 2 + sizeX + labelScale / 2; - labelPositionsY[i] = positionsY[i]; - labelPositionsZ[i] = originZ; - } - options.title; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - labelSet.positionsX = positionsX; - labelSet.positionsY = positionsY; - labelSet.positionsZ = positionsZ; - labelSet.rotation = new Float64Array([ - rotation[0], - rotation[1], - rotation[2], - rotation[3] - ]); - labelSet.horizontalAlignment = (0, _mainJs.HorizontalAlignment).left; - } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../helpers/text.js":"fG2oi","../layouts/scatter.js":"bwpY2","../helpers/math.js":"f65d0","./labels.js":"PwNrz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bwpY2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scatter", ()=>Scatter); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Scatter extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[id] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const sizesX = options.sizes ? options.sizes : options.sizesX; - const sizesY = options.sizes ? options.sizes : options.sizesY; - const sizesZ = options.sizes ? options.sizes : options.sizesZ; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - if (options.rotation) { - _quat[0] = options.rotation[0]; - _quat[1] = options.rotation[1]; - _quat[2] = options.rotation[2]; - _quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id]) : 1) * sizeScalingX, minSize) * this._boundsScaling; - _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id]) : 1) * sizeScalingY, minSize) * this._boundsScaling; - _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - if (options.rotations) { - _quat[0] = options.rotations[id * 4]; - _quat[1] = options.rotations[id * 4 + 1]; - _quat[2] = options.rotations[id * 4 + 2]; - _quat[3] = options.rotations[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - } else (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setParameter1(dataView, index, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id] : 0); - (0, _vertexJs.UnitVertex).setParameter2(dataView, index, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id] : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kYBiT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LayoutBase", ()=>LayoutBase); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _boundsJs = require("../helpers/bounds.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class LayoutBase { - get facetScaling() { - return this._facetScaling; + get maxBoundsZ() { + return this._maxBoundsZ; } - offsetX(facetCoordX) { - return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - offsetY(facetCoordY) { - return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; + get positionsX() { + return this._positionsX; } - offsetZ(facetCoordZ) { - return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; - } - constructor(core){ - this._core = core; - this.modelOriginX = 0; - this.modelOriginY = 0; - this.modelOriginZ = 0; - this.minModelBoundsX = 0; - this.minModelBoundsY = 0; - this.minModelBoundsZ = 0; - this.maxModelBoundsX = 0; - this.maxModelBoundsY = 0; - this.maxModelBoundsZ = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._facetSpacingX = 0; - this._facetSpacingY = 0; - this._facetSpacingZ = 0; - this._facetSizeX = 0; - this._facetSizeY = 0; - this._facetSizeZ = 0; - this._facetsX = 1; - this._facetsY = 1; - this._facetsZ = 1; - } - _updateModelBounds(options) { - this.minModelBoundsX = options.minBoundsX === undefined ? this.minLayoutBoundsX : options.minBoundsX; - this.minModelBoundsY = options.minBoundsY === undefined ? this.minLayoutBoundsY : options.minBoundsY; - this.minModelBoundsZ = options.minBoundsZ === undefined ? this.minLayoutBoundsZ : options.minBoundsZ; - this.maxModelBoundsX = options.maxBoundsX === undefined ? this.maxLayoutBoundsX : options.maxBoundsX; - this.maxModelBoundsY = options.maxBoundsY === undefined ? this.maxLayoutBoundsY : options.maxBoundsY; - this.maxModelBoundsZ = options.maxBoundsZ === undefined ? this.maxLayoutBoundsZ : options.maxBoundsZ; - this._isFacetted = options.facetsX !== undefined && options.facetsX > 1 && options.facetCoordsX != null || options.facetsY !== undefined && options.facetsY > 1 && options.facetCoordsY != null || options.facetsZ !== undefined && options.facetsZ > 1 && options.facetCoordsZ != null; - this._facetSpacingX = options.facetSpacingX === undefined ? 0 : options.facetSpacingX; - this._facetSpacingY = options.facetSpacingY === undefined ? 0 : options.facetSpacingY; - this._facetSpacingZ = options.facetSpacingZ === undefined ? 0 : options.facetSpacingZ; - let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._facetSizeX = modelSizeX; - this._facetSizeY = modelSizeY; - this._facetSizeZ = modelSizeZ; - this._facetsX = options.facetCoordsX ? options.facetsX : 1; - this._facetsY = options.facetCoordsY ? options.facetsY : 1; - this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; - this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; - this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; - this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; - this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); - this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); - this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); - this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; - this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; - this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; - modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; - this._facetScaling = maxBounds / this._maxBounds; + set positionsX(value2) { + if (this._positionsX != value2) { + this._positionsX = value2; + this._hasChanged = true; + } } - resetCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = undefined; - this.minCumulativeLayoutBoundsY = undefined; - this.minCumulativeLayoutBoundsZ = undefined; - this.maxCumulativeLayoutBoundsX = undefined; - this.maxCumulativeLayoutBoundsY = undefined; - this.maxCumulativeLayoutBoundsZ = undefined; + get positionsY() { + return this._positionsY; } - _updateCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === undefined ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); - this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === undefined ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); - this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === undefined ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); - this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === undefined ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); - this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === undefined ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); - this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === undefined ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); + set positionsY(value2) { + if (this._positionsY != value2) { + this._positionsY = value2; + this._hasChanged = true; + } } - unitToModelSize(unitSize) { - return unitSize / this._boundsScaling; + get positionsZ() { + return this._positionsZ; } - unitToModelPositionX(unitPositionX) { - return this.unitToModelSize(unitPositionX) + this.modelOriginX; + set positionsZ(value2) { + if (this._positionsZ != value2) { + this._positionsZ = value2; + this._hasChanged = true; + } } - unitToModelPositionY(unitPositionY) { - return this.unitToModelSize(unitPositionY) + this.modelOriginY; + get positionScalingX() { + return this._positionScalingX; } - unitToModelPositionZ(unitPositionZ) { - return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; + set positionScalingX(value2) { + if (this._positionScalingX != value2) { + this._positionScalingX = value2; + this._hasChanged = true; + } } - unitToModelPosition(unitPosition, modelPosition) { - modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); - modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); - modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); + get positionScalingY() { + return this._positionScalingY; } - modelToUnitSize(modelSize) { - return modelSize * this._boundsScaling; + set positionScalingY(value2) { + if (this._positionScalingY != value2) { + this._positionScalingY = value2; + this._hasChanged = true; + } } - modelToUnitPositionX(modelPositionX) { - return (modelPositionX - this.modelOriginX) * this._boundsScaling; + get positionScalingZ() { + return this._positionScalingZ; } - modelToUnitPositionY(modelPositionY) { - return (modelPositionY - this.modelOriginY) * this._boundsScaling; + set positionScalingZ(value2) { + if (this._positionScalingZ != value2) { + this._positionScalingZ = value2; + this._hasChanged = true; + } } - modelToUnitPositionZ(modelPositionZ) { - return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + get rotations() { + return this._rotations; } - modelToUnitPosition(modelPosition, unitPosition) { - unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); - unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); - unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); - } - inclusiveUnitBounds(buffer, ids, unitType, offset, count, minBounds, maxBounds) { - (0, _glMatrix.vec3).set(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const unitScale = (0, _glMatrix.vec3).create(); - const unitRotation = (0, _glMatrix.quat).create(); - const unitTranslation = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - const dataView = buffer.dataView; - let minBounds0; - let maxBounds0; - let minBounds1; - let maxBounds1; - switch(unitType){ - case (0, _mainJs.UnitType).sphere: - case (0, _mainJs.UnitType).sphereSdf: - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const radius = unitScale[0] / 2; - minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius); - minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius); - minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius); - maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius); - maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius); - maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius); - } - break; - case (0, _mainJs.UnitType).hexPrism: - case (0, _mainJs.UnitType).hexPrismSdf: - case (0, _mainJs.UnitType).block: - case (0, _mainJs.UnitType).blockSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - minBounds1 = (0, _glMatrix.vec3).create(); - maxBounds1 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; - minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; - minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; - maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; - maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; - maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; - (0, _boundsJs.BoundsHelper).rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds1); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds1); - } - break; - case (0, _mainJs.UnitType).cylinder: - case (0, _mainJs.UnitType).cylinderSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - const pa = (0, _glMatrix.vec3).create(); - const pb = (0, _glMatrix.vec3).create(); - const identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - let ca; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const length = unitScale[1]; - const radius = Math.max(unitScale[0], unitScale[2]); - if (length != 0 && radius != 0) { - if ((0, _glMatrix.quat).equals(unitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY)) ca = identityRotation; - else { - ca = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca, identityRotation, unitRotation); - } - (0, _glMatrix.vec3).scaleAndAdd(pa, unitTranslation, ca, -length * 0.5); - (0, _glMatrix.vec3).scaleAndAdd(pb, unitTranslation, ca, length * 0.5); - (0, _boundsJs.BoundsHelper).cylinder(pa, pb, radius, minBounds0, maxBounds0); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds0); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds0); - } - } - break; - } + set rotations(value2) { + if (this._rotations != value2) { + this._rotations = value2; + this._hasChanged = true; + } } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/bounds.js":"beD2A","../main.js":"f421K","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"beD2A":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BoundsHelper", ()=>BoundsHelper); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -class BoundsHelper { - static rotateBounds(minBounds, maxBounds, rotation, rotatedMinBounds, rotatedMaxBounds, offset) { - const sizeX = maxBounds[0] - minBounds[0]; - const sizeY = maxBounds[1] - minBounds[1]; - const sizeZ = maxBounds[2] - minBounds[2]; - const min = rotatedMinBounds; - const max = rotatedMaxBounds; - (0, _glMatrix.vec3).set(min, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(max, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const vertices = (0, _cubeJs.Cube).POSITIONS; - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).add(position, position, offset); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).subtract(position, position, offset); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).add(position, minBounds, maxBounds); - (0, _glMatrix.vec3).scale(position, position, 0.5); - (0, _glMatrix.vec3).add(min, min, position); - (0, _glMatrix.vec3).add(max, max, position); - } - static cylinder(pa, pb, radius, minBounds, maxBounds) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - minBounds[0] = Math.min(pa[0] - ex, pb[0] - ex); - minBounds[1] = Math.min(pa[1] - ey, pb[1] - ey); - minBounds[2] = Math.min(pa[2] - ez, pb[2] - ez); - maxBounds[0] = Math.max(pa[0] + ex, pb[0] + ex); - maxBounds[1] = Math.max(pa[1] + ey, pb[1] + ey); - maxBounds[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"5x28d","../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eiGCN":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesBase", ()=>(0, _axesJs.AxesBase)); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>(0, _cartesian2DJs.Cartesian2dAxes)); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>(0, _cartesian2DJs.Cartesian2dAxesHelper)); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>(0, _cartesian3DJs.Cartesian3dAxes)); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>(0, _cartesian3DJs.Cartesian3dAxesHelper)); -var _axesJs = require("./axes.js"); -var _cartesian2DJs = require("./cartesian2d.js"); -var _cartesian3DJs = require("./cartesian3d.js"); - -},{"./axes.js":"8Tmim","./cartesian2d.js":"d0jS2","./cartesian3d.js":"jfjef","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9v1at":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>(0, _angleJs.AngleHelper)); -parcelHelpers.export(exports, "AnimationHelper", ()=>(0, _animationJs.AnimationHelper)); -parcelHelpers.export(exports, "ArrayHelper", ()=>(0, _arrayJs.ArrayHelper)); -parcelHelpers.export(exports, "AxisHelper", ()=>(0, _axesJs.AxisHelper)); -parcelHelpers.export(exports, "Base64Helper", ()=>(0, _base64Js.Base64Helper)); -parcelHelpers.export(exports, "BinHelper", ()=>(0, _binJs.BinHelper)); -parcelHelpers.export(exports, "ColorHelper", ()=>(0, _colorJs.ColorHelper)); -parcelHelpers.export(exports, "CsvHelper", ()=>(0, _csvJs.CsvHelper)); -parcelHelpers.export(exports, "FacetHelper", ()=>(0, _facetJs.FacetHelper)); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>(0, _forcedirectJs.ForceDirectHelper)); -parcelHelpers.export(exports, "HexHelper", ()=>(0, _hexJs.HexHelper)); -parcelHelpers.export(exports, "HexBinHelper", ()=>(0, _hexbinJs.HexBinHelper)); -parcelHelpers.export(exports, "LineHelper", ()=>(0, _lineJs.LineHelper)); -parcelHelpers.export(exports, "MathHelper", ()=>(0, _mathJs.MathHelper)); -parcelHelpers.export(exports, "PseudoRandom", ()=>(0, _mathJs.PseudoRandom)); -parcelHelpers.export(exports, "MatrixHelper", ()=>(0, _matrixJs.MatrixHelper)); -parcelHelpers.export(exports, "MercatorHelper", ()=>(0, _mapJs.MercatorHelper)); -parcelHelpers.export(exports, "AlbersHelper", ()=>(0, _mapJs.AlbersHelper)); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>(0, _mapJs.GeoJSONHelper)); -parcelHelpers.export(exports, "OctTreeHelper", ()=>(0, _octtreeJs.OctTreeHelper)); -parcelHelpers.export(exports, "PaletteHelper", ()=>(0, _paletteJs.PaletteHelper)); -parcelHelpers.export(exports, "PathHelper", ()=>(0, _pathJs.PathHelper)); -parcelHelpers.export(exports, "PickHelper", ()=>(0, _pickJs.PickHelper)); -parcelHelpers.export(exports, "TableHelper", ()=>(0, _tableJs.TableHelper)); -parcelHelpers.export(exports, "TextHelper", ()=>(0, _textJs.TextHelper)); -parcelHelpers.export(exports, "TextureHelper", ()=>(0, _textureJs.TextureHelper)); -parcelHelpers.export(exports, "TreeHelper", ()=>(0, _treeJs.TreeHelper)); -parcelHelpers.export(exports, "SetHelper", ()=>(0, _setJs.SetHelper)); -parcelHelpers.export(exports, "SdfHelper", ()=>(0, _sdfJs.SdfHelper)); -parcelHelpers.export(exports, "VectorHelper", ()=>(0, _vectorJs.VectorHelper)); -var _angleJs = require("./angle.js"); -var _animationJs = require("./animation.js"); -var _arrayJs = require("./array.js"); -var _axesJs = require("./axes.js"); -var _base64Js = require("./base64.js"); -var _binJs = require("./bin.js"); -var _colorJs = require("./color.js"); -var _csvJs = require("./csv.js"); -var _facetJs = require("./facet.js"); -var _forcedirectJs = require("./forcedirect.js"); -var _hexJs = require("./hex.js"); -var _hexbinJs = require("./hexbin.js"); -var _lineJs = require("./line.js"); -var _mathJs = require("./math.js"); -var _matrixJs = require("./matrix.js"); -var _mapJs = require("./map.js"); -var _octtreeJs = require("./octtree.js"); -var _paletteJs = require("./palette.js"); -var _pathJs = require("./path.js"); -var _pickJs = require("./pick.js"); -var _tableJs = require("./table.js"); -var _textJs = require("./text.js"); -var _textureJs = require("./texture.js"); -var _treeJs = require("./tree.js"); -var _setJs = require("./set.js"); -var _sdfJs = require("./sdf.js"); -var _vectorJs = require("./vector.js"); - -},{"./angle.js":"53hwW","./animation.js":"02nn8","./array.js":"9Rnft","./axes.js":"99ajO","./base64.js":"e5eoY","./bin.js":"5rVTq","./color.js":"4LgMf","./csv.js":"g6LJR","./facet.js":"iYn0I","./forcedirect.js":"gazw2","./hex.js":"ahk7A","./hexbin.js":"bm0M4","./line.js":"iEeyT","./math.js":"f65d0","./matrix.js":"7gWc5","./map.js":"27ECm","./octtree.js":"lv4D9","./palette.js":"7fuDW","./path.js":"dvdia","./pick.js":"1t2sb","./table.js":"cn0Qv","./text.js":"fG2oi","./texture.js":"bUoBU","./tree.js":"4ts5g","./set.js":"7s3Z5","./sdf.js":"2PdqK","./vector.js":"2r8XP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Rnft":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ArrayHelper", ()=>ArrayHelper); -class ArrayHelper { - static minIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) { - index = ~index; - index = Math.max(0, index); - } else while(index > 0 && orderedValues[index - 1] == value)index--; - return index; - } - static maxIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) index = ~index - 1; - else { - while(index < length - 1 && orderedValues[index + 1] == value)index++; - index = Math.min(length, index); - } - return index; - } - static binarySearch(array, index, length, value) { - let low = index; - let high = index + length - 1; - while(low <= high){ - const mid = low + (high - low >> 1); - if (array[mid] == value) return mid; - if (array[mid] <= value) low = mid + 1; - else high = mid - 1; - } - return ~low; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e5eoY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Base64Helper", ()=>Base64Helper); -class Base64Helper { - uint6ToB64(nUint6) { - return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65; - } - base64EncArr(aBytes) { - let nMod3 = 2; - let sB64Enc = ""; - let nLen = aBytes.byteLength; - let nUint24 = 0; - for(let nIdx = 0; nIdx < nLen; nIdx++){ - nMod3 = nIdx % 3; - if (nIdx > 0 && nIdx * 4 / 3 % 76 === 0) sB64Enc += "\r\n"; - nUint24 |= aBytes.getUint8(nIdx) << (16 >>> nMod3 & 24); - if (nMod3 === 2 || aBytes.byteLength - nIdx === 1) { - sB64Enc += String.fromCharCode(this.uint6ToB64(nUint24 >>> 18 & 63), this.uint6ToB64(nUint24 >>> 12 & 63), this.uint6ToB64(nUint24 >>> 6 & 63), this.uint6ToB64(nUint24 & 63)); - nUint24 = 0; - } - } - return sB64Enc.substring(0, sB64Enc.length - 2 + nMod3) + (nMod3 === 2 ? "" : nMod3 === 1 ? "=" : "=="); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5rVTq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BinHelper", ()=>BinHelper); -class BinHelper { - static quantile(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const itemsPerBin = count / options.bins; - let bin = 0; - if (options.froms && options.tos) { - const firstId = options.ids[offset]; - options.froms[0] = options.values[firstId]; - } - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - if (i > Math.floor(itemsPerBin * (bin + 1))) { - bin++; - if (options.froms && options.tos) { - options.tos[bin - 1] = options.values[id]; - const nextId = options.ids[i + offset + 1]; - options.froms[bin] = options.values[nextId]; - } - } - options.binIds[id] = bin; - } - if (options.froms && options.tos) { - const lastId = options.ids[count - 1 + offset]; - options.tos[options.bins - 1] = options.values[lastId]; - } - return Math.floor(itemsPerBin); - } - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const counts = options.counts ? options.counts : new Float64Array(options.bins); - let minValue = options.minValue; - let maxValue = options.maxValue; - if (options.isDiscrete || maxValue == minValue) { - minValue -= 0.5; - maxValue += 0.5; - } - const binSize = (maxValue - minValue) / options.bins; - let maxCount = 0; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - const value = options.values[id]; - const binId = Math.max(Math.min(Math.floor((value - minValue) / binSize), options.bins - 1), 0); - options.binIds[id] = binId; - counts[binId]++; - maxCount = Math.max(counts[binId], maxCount); - } - if (options.froms && options.tos) { - for(let i = 0; i < options.bins; i++)if (options.isDiscrete || maxValue == minValue) { - options.froms[i] = Math.ceil(minValue + binSize * i); - options.tos[i] = Math.floor(minValue + binSize * (i + 1)); - } else { - options.froms[i] = minValue + binSize * i; - options.tos[i] = minValue + binSize * (i + 1); - } - } - return maxCount; - } - static maxBins(minValue, maxValue, isDiscrete, maxBins) { - if (isDiscrete) return Math.min(maxValue - minValue + 1, maxBins); - else return maxBins; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4LgMf":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorHelper", ()=>ColorHelper); -var _glMatrix = require("gl-matrix"); -class ColorHelper { - static luminance(rgb) { - return rgb[0] * ColorHelper.LUMINANCE[0] + rgb[1] * ColorHelper.LUMINANCE[1] + rgb[2] * ColorHelper.LUMINANCE[2]; - } - static rgbToHex(r, g, b) { - const r2 = `0${Math.round(r * 255).toString(16)}`; - const g2 = `0${Math.round(g * 255).toString(16)}`; - const b2 = `0${Math.round(b * 255).toString(16)}`; - return `#${r2.substr(r2.length - 2, 2)}${g2.substr(g2.length - 2, 2)}${b2.substr(b2.length - 2, 2)}`; - } - static rgbToHsv(r, g, b, hsv) { - let h, s, v, delta; - const min = Math.min(Math.min(r, g), b); - const max = Math.max(Math.max(r, g), b); - delta = max - min; - v = max; - if (delta == 0) { - h = -1; - if (max == 0) s = -1; - else s = 0; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - s = delta / max; - if (r == max) h = (g - b) / delta; - else if (g == max) h = 2 + (b - r) / delta; - else h = 4 + (r - g) / delta; - h *= 60; - if (h < 0) h += 360; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - static hsvToRgb(h, s, v, rgb) { - let sextant, r, g, b; - if (s == 0) { - r = g = b = v; - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } - let frac, p, q, t; - h %= 360; - h /= 60; - sextant = Math.floor(h); - frac = h - sextant; - p = v * (1 - s); - q = v * (1 - s * frac); - t = v * (1 - s * (1 - frac)); - switch(sextant){ - case 0: - r = v; - g = t; - b = p; - break; - case 1: - r = q; - g = v; - b = p; - break; - case 2: - r = p; - g = v; - b = t; - break; - case 3: - r = p; - g = q; - b = v; - break; - case 4: - r = t; - g = p; - b = v; - break; - default: - r = v; - g = p; - b = q; - break; - } - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } -} -ColorHelper.LUMINANCE = (0, _glMatrix.vec3).fromValues(0.2126, 0.7152, 0.0722); - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g6LJR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CsvHelper", ()=>CsvHelper); -var _mainJs = require("../main.js"); -class CsvHelper { - constructor(core){ - this.QUOTE = '"'; - this.DELIMETER = ','; - this.LINE_BREAKS = [ - '\n', - '\r' - ]; - this._core = core; + get offsetsX() { + return this._offsetsX; } - readline(text, row) { - return this.read(text, row, 1)[0]; + set offsetsX(value2) { + if (this._offsetsX != value2) { + this._offsetsX = value2; + this._hasChanged = true; + } } - read(text, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const rows = []; - let rowBuffer = []; - let row = 0; - let columnBuffer = ""; - let quoted = false; - for(let i = 0; i < text.length; i++){ - const char = text.charAt(i); - if (char == this.QUOTE) { - if (text.charAt(i + 1) == this.QUOTE) { - i++; - columnBuffer += this.QUOTE; - } else quoted = !quoted; - } else if (quoted) columnBuffer += char; - else { - if (char == this.DELIMETER) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - } else if (this.LINE_BREAKS.indexOf(char) > -1) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - while(this.LINE_BREAKS.indexOf(text.charAt(i + 1)) > -1)i++; - if (row++ >= firstRow) rows.push(rowBuffer); - rowBuffer = []; - if (rows.length == maxRows) break; - } else columnBuffer += char; - } - } - if (columnBuffer != "") rowBuffer.push(columnBuffer); - if (rowBuffer.length > 0) rows.push(rowBuffer); - if (maxRows > 1) this._core.log.write((0, _mainJs.LogLevel).info, `csv ${rows.length} rows ${Math.round(window.performance.now() - start)}ms`); - return rows; - } - writeLine(data) { - let text = ""; - for(let i = 0; i < data.length; i++){ - let column = data[i]; - if (column) { - const quotes = column.indexOf(this.DELIMETER) > -1 || column.indexOf(this.QUOTE) > -1; - column = column.replace(/"/g, '""'); - if (quotes) column = `${this.QUOTE}${column}${this.QUOTE}`; - } - text += column; - if (i < data.length - 1) text += this.DELIMETER; - } - return text; - } - writeAsJavaScriptArray(headings, data) { - let text = "[["; - for (let column of headings)text += `"${column}",`; - text = text.slice(0, -1); - text += "]\n"; - let row; - for(let i = 0; i < data.length; i++){ - const line = data[i]; - row = "["; - for(let j = 0; j < line.length; j++){ - const column = line[j]; - row += `"${column.replace(/"/g, '\\"')}",`; - } - row = row.slice(0, -1); - row += "],\n"; - text += row; - } - text += "];"; - return text; - } -} - -},{"../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iYn0I":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FacetHelper", ()=>FacetHelper); -var _mainJs = require("../main.js"); -class FacetHelper { - constructor(core){ - this._core = core; - } - split1d(ids, facetsX, valuesX, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, undefined, undefined, valuesX, null, null, orderedIds, facetIds, offsets, counts); - } - split2d(ids, facetsX, facetsY, valuesX, valuesY, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, facetsY, undefined, valuesX, valuesY, null, orderedIds, facetIds, offsets, counts); - } - split3d(ids, facetsX, facetsY, facetsZ, valuesX, valuesY, valuesZ, orderedIds, facetIds, offsets, counts) { - if (valuesX && facetIds.length != valuesX.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesX"); - if (valuesY && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - if (valuesZ && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - const start = window.performance.now(); - if (facetsX === undefined) facetsX = 1; - if (facetsY === undefined) facetsY = 1; - if (facetsZ === undefined) facetsZ = 1; - const maxFacetId = facetsX * facetsY * facetsZ - 1; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const valueX = valuesX ? valuesX[id] : 0; - const valueY = valuesY ? valuesY[id] : 0; - const valueZ = valuesZ ? valuesZ[id] : 0; - const facetId = valueX + valueY * facetsX + valueZ * facetsX * facetsZ; - facetIds[id] = facetId; - if (facetId > maxFacetId) this._core.log.write((0, _mainJs.LogLevel).warn, "facet overflow"); - counts[facetId]++; - } - let offset = 0; - for(let i = 0; i < offsets.length; i++){ - const count = counts[i]; - offsets[i] = offset; - offset += count; - } - const tempOffsets = new Uint32Array(offsets); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const facetId = facetIds[id]; - offset = tempOffsets[facetId]++; - orderedIds[offset] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet split ${Math.round(window.performance.now() - start)}ms`); - } - wrap1d(ids, values, columns, coordsX, coordsY) { - const start = window.performance.now(); - let rows = 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const value = values[id]; - coordsX[id] = value % columns; - const row = Math.floor(value / columns); - coordsY[id] = row; - rows = Math.max(row, rows); - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet wrap ${Math.round(window.performance.now() - start)}ms`); - return rows + 1; + get offsetsY() { + return this._offsetsY; } -} - -},{"../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gazw2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>ForceDirectHelper); -var _octtreeJs = require("./octtree.js"); -class ForceDirectHelper { - set gravity(value) { - this._gravity = value; - } - get gravity() { - return this._gravity; - } - set attraction(value) { - this._attraction = value; - } - get attraction() { - return this._attraction; - } - set repulsion(value) { - this._repulsion = value; - } - get repulsion() { - return this._repulsion; - } - set interval(value) { - this._interval = value; - } - get interval() { - return this._interval; - } - set maxDistance(value) { - this._maxDistance = value; - } - get maxDistance() { - return this._maxDistance; - } - set iterationsPerLayout(value) { - this._iteractionsPerLayout = value; - } - get iterationsPerLayout() { - return this._iteractionsPerLayout; - } - set edgeWeightPower(value) { - this._edgeWeightPower = value; - } - get edgeWeightPower() { - return this._edgeWeightPower; - } - set theta(value) { - this._theta = value; - } - get theta() { - return this._theta; - } - get iterations() { - return this._totalIterations; - } - get totalRepulsion() { - return this._totalRepulsion; - } - get nodePositionsX() { - return this._nodePositionsX; - } - get nodePositionsY() { - return this._nodePositionsY; - } - get nodePositionsZ() { - return this._nodePositionsZ; - } - get lockX() { - return this._lockX; - } - set lockX(value) { - this._lockX = value; - } - get lockY() { - return this._lockY; - } - set lockY(value) { - this._lockY = value; - } - get lockZ() { - return this._lockZ; - } - set lockZ(value) { - this._lockZ = value; - } - constructor(options){ - this._forcesX = new Float64Array(options.nodeIds.length); - this._forcesY = new Float64Array(options.nodeIds.length); - this._forcesZ = new Float64Array(options.nodeIds.length); - this._totalIterations = 0; - this._totalRepulsion = 0; - this._repulsion = options.repulsion || 1; - this._attraction = options.attraction || 1; - this._gravity = options.gravity || 1; - this._interval = options.interval || 1; - this._maxDistance = options.maxDistance || 1; - this._iteractionsPerLayout = options.iterationsPerLayout || 1; - this._theta = options.theta || 1; - this._nodeIds = options.nodeIds; - this._nodePositionsX = options.nodePositionsX; - this._nodePositionsY = options.nodePositionsY; - this._nodePositionsZ = options.nodePositionsZ; - this._nodeWeights = options.nodeWeights || new Float64Array(this._nodeIds.length).fill(1); - this._edgeIds = options.edgeIds; - this._edgeFromIds = options.edgeFromIds; - this._edgeToIds = options.edgeToIds; - this._edgeWeights = options.edgeWeights || new Float64Array(this._edgeIds.length).fill(1); - this._edgeWeightPower = options.edgeWeightPower || 1; + set offsetsY(value2) { + if (this._offsetsY != value2) { + this._offsetsY = value2; + this._hasChanged = true; + } } - layout() { - this._minBoundsX = Number.MAX_VALUE; - this._minBoundsY = Number.MAX_VALUE; - this._minBoundsZ = Number.MAX_VALUE; - this._maxBoundsX = -Number.MAX_VALUE; - this._maxBoundsY = -Number.MAX_VALUE; - this._maxBoundsZ = -Number.MAX_VALUE; - for(let i = 0; i < this._nodeIds.length; i++){ - this._minBoundsX = Math.min(this._minBoundsX, this._nodePositionsX[i]); - this._minBoundsY = Math.min(this._minBoundsY, this._nodePositionsY[i]); - this._minBoundsZ = Math.min(this._minBoundsZ, this._nodePositionsZ[i]); - this._maxBoundsX = Math.max(this._maxBoundsX, this._nodePositionsX[i]); - this._maxBoundsY = Math.max(this._maxBoundsY, this._nodePositionsY[i]); - this._maxBoundsZ = Math.max(this._maxBoundsZ, this._nodePositionsZ[i]); - } - for(let iteration = 0; iteration < this._iteractionsPerLayout; iteration++){ - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forcesX[id] = 0; - this._forcesY[id] = 0; - this._forcesZ[id] = 0; - } - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - let dx = this._nodePositionsX[id]; - let dy = this._nodePositionsY[id]; - let dz = this._nodePositionsZ[id]; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -this._nodeWeights[id] * this._gravity; - this._forcesX[id] += magnitude * dx; - this._forcesY[id] += magnitude * dy; - this._forcesZ[id] += magnitude * dz; - } - } - for(let i = 0; i < this._edgeIds.length; i++){ - const id = this._edgeIds[i]; - const fromId = this._edgeFromIds[id]; - const toId = this._edgeToIds[id]; - const x1 = this._nodePositionsX[fromId]; - const y1 = this._nodePositionsY[fromId]; - const z1 = this._nodePositionsZ[fromId]; - const x2 = this._nodePositionsX[toId]; - const y2 = this._nodePositionsY[toId]; - const z2 = this._nodePositionsZ[toId]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -distance * this._attraction * Math.pow(this._edgeWeights[id], this._edgeWeightPower); - this._forcesX[fromId] += magnitude * dx; - this._forcesY[fromId] += magnitude * dy; - this._forcesZ[fromId] += magnitude * dz; - this._forcesX[toId] -= magnitude * dx; - this._forcesY[toId] -= magnitude * dy; - this._forcesZ[toId] -= magnitude * dz; - } - } - const minBounds = Math.min(Math.min(this._minBoundsX, this._minBoundsY), this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._maxBoundsX, this._maxBoundsY), this._maxBoundsZ); - const size = maxBounds - minBounds; - const maxLevel = 10; - const minBoundsX = minBounds; - const minBoundsY = minBounds; - const minBoundsZ = minBounds; - const maxBoundsX = maxBounds; - const maxBoundsY = maxBounds; - const maxBoundsZ = maxBounds; - const octTreeOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - maxLevel: maxLevel, - ids: this._nodeIds, - positionsX: this._nodePositionsX, - positionsY: this._nodePositionsY, - positionsZ: this._nodePositionsZ, - masses: this._nodeWeights - }; - const octTree = new (0, _octtreeJs.OctTreeHelper)(octTreeOptions); - this._totalRepulsion = 0; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forceX = 0; - this._forceY = 0; - this._forceZ = 0; - this.calculateRepulsion(octTree.root, id); - this._forcesX[id] += this._forceX; - this._forcesY[id] += this._forceY; - this._forcesZ[id] += this._forceZ; - this._totalRepulsion += Math.sqrt(this._forceX * this._forceX + this._forceY * this._forceY + this._forceZ * this._forceZ); - } - const timeSquared = this._interval * this._interval; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - const mass = this._nodeWeights[id]; - const ax = this._forcesX[id] / mass; - const ay = this._forcesY[id] / mass; - const az = this._forcesZ[id] / mass; - let dx = ax * timeSquared / 2; - let dy = ay * timeSquared / 2; - let dz = az * timeSquared / 2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - const distance = Math.sqrt(distanceSquared); - if (distance > this._maxDistance * size) { - dx *= this._maxDistance * size / distance; - dy *= this._maxDistance * size / distance; - dz *= this._maxDistance * size / distance; - } - if (!this._lockX) this._nodePositionsX[id] += dx; - if (!this._lockY) this._nodePositionsY[id] += dy; - if (!this._lockZ) this._nodePositionsZ[id] += dz; - } - } - if (this.layoutCallback) this.layoutCallback(); - } - calculateRepulsion(parent, id1) { - const x1 = this._nodePositionsX[id1]; - const y1 = this._nodePositionsY[id1]; - const z1 = this._nodePositionsZ[id1]; - for(let k = 0; k < parent.children.length; k++){ - const child = parent.children[k]; - if (!child.children) for(let i = 0; i < child.ids.length; i++){ - const id2 = child.ids[i]; - if (id1 != id2) { - const x2 = this._nodePositionsX[id2]; - const y2 = this._nodePositionsY[id2]; - const z2 = this._nodePositionsZ[id2]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - let distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = this._repulsion * this._nodeWeights[id1] * this._nodeWeights[id2] / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } - } - } - else { - let dx = x1 - child.centerOfMassX; - let dy = y1 - child.centerOfMassY; - let dz = z1 - child.centerOfMassZ; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const width = child.maxBoundsX - child.minBoundsX; - if (width / distance < this._theta) { - const magnitude = this._repulsion * this._nodeWeights[id1] * child.mass / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } else this.calculateRepulsion(child, id1); - } - } - } + get offsetsZ() { + return this._offsetsZ; } -} - -},{"./octtree.js":"lv4D9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lv4D9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OctTreeNode", ()=>OctTreeNode); -parcelHelpers.export(exports, "OctTreeHelper", ()=>OctTreeHelper); -class OctTreeNode { -} -class OctTreeHelper { - constructor(options){ - this._ids = options.ids; - this._positionsX = options.positionsX; - this._positionsY = options.positionsY; - this._positionsZ = options.positionsZ; - this._masses = options.masses; - this._maxLevel = options.maxLevel; - this.root = new OctTreeNode(); - this.root.minBoundsX = options.minBoundsX; - this.root.minBoundsY = options.minBoundsY; - this.root.minBoundsZ = options.minBoundsZ; - this.root.maxBoundsX = options.maxBoundsX; - this.root.maxBoundsY = options.maxBoundsY; - this.root.maxBoundsZ = options.maxBoundsZ; - this.root.level = 0; - this.root.octKey = ""; - this._buildTree(this.root, this._ids); - } - _buildTree(parent, ids) { - const centerX = (parent.minBoundsX + parent.maxBoundsX) / 2; - const centerY = (parent.minBoundsY + parent.maxBoundsY) / 2; - const centerZ = (parent.minBoundsZ + parent.maxBoundsZ) / 2; - const minBoundsX = []; - const minBoundsY = []; - const minBoundsZ = []; - const maxBoundsX = []; - const maxBoundsY = []; - const maxBoundsZ = []; - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - const masses = new Float64Array(8); - const centerOfMassesX = new Float64Array(8); - const centerOfMassesY = new Float64Array(8); - const centerOfMassesZ = new Float64Array(8); - const buckets = [ - [], - [], - [], - [], - [], - [], - [], - [] - ]; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const x = this._positionsX[index]; - const y = this._positionsY[index]; - const z = this._positionsZ[index]; - const mass = this._masses[index]; - for(let j = 0; j < 8; j++)if (minBoundsX[j] <= x && maxBoundsX[j] >= x && minBoundsY[j] <= y && maxBoundsY[j] >= y && minBoundsZ[j] <= z && maxBoundsZ[j] >= z) { - buckets[j].push(index); - masses[j] += mass; - centerOfMassesX[j] += x * mass; - centerOfMassesY[j] += y * mass; - centerOfMassesZ[j] += z * mass; - break; - } - } - parent.children = []; - for(let i = 0; i < 8; i++)if (buckets[i].length > 0) { - const child = new OctTreeNode(); - child.minBoundsX = minBoundsX[i]; - child.minBoundsY = minBoundsY[i]; - child.minBoundsZ = minBoundsZ[i]; - child.maxBoundsX = maxBoundsX[i]; - child.maxBoundsY = maxBoundsY[i]; - child.maxBoundsZ = maxBoundsZ[i]; - child.mass = masses[i]; - child.centerOfMassX = centerOfMassesX[i] / masses[i]; - child.centerOfMassY = centerOfMassesY[i] / masses[i]; - child.centerOfMassZ = centerOfMassesZ[i] / masses[i]; - child.level = parent.level + 1; - child.octKey += i.toString(); - child.parent = parent; - child.ids = new Uint32Array(buckets[i]); - parent.children.push(child); - if (child.ids.length > 1 && child.level < this._maxLevel) this._buildTree(child, child.ids); - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ahk7A":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexHelper", ()=>HexHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _angleJs = require("./angle.js"); -class HexHelper { - static width(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return (0, _constantsJs.Constants).ROOT_THREE * size; - else return 2 * size; - } - static height(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return 2 * size; - else return (0, _constantsJs.Constants).ROOT_THREE * size; - } - static pointyHexCorner(center, size, i, position) { - const angle = (0, _angleJs.AngleHelper).degreesToRadians(60 * i - 30); - position[0] = center[0] + size * Math.cos(angle); - position[1] = center[1] + size * Math.sin(angle); - } - static cubeToAxial(cube, hex) { - hex[0] = cube[0]; - hex[1] = cube[2]; - } - static axialToCube(hex, cube) { - const x = hex[0]; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static cubeToOddr(cube, hex) { - const col = cube[0] + (cube[2] - (cube[2] & 1)) / 2; - const row = cube[2]; - hex[0] = col; - hex[1] = row; - } - static oddrToCube(hex, cube) { - const x = hex[0] - (hex[1] - (hex[1] & 1)) / 2; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static pointyHexToPixel(hex, size, point) { - point[0] = size * ((0, _constantsJs.Constants).ROOT_THREE * hex[0] + (0, _constantsJs.Constants).ROOT_THREE / 2 * hex[1]); - point[1] = size * (1.5 * hex[1]); - } - static pixelToPointyHex(point, size, hex) { - hex[0] = ((0, _constantsJs.Constants).ROOT_THREE / 3 * point[0] - 1 / 3 * point[1]) / size; - hex[1] = 2 / 3 * point[1] / size; - this.hexRound(hex, hex); - } - static hexRound(hex, hexRound) { - const cube = this._vec3; - this.axialToCube(hex, cube); - this.cubeRound(cube, cube); - this.cubeToAxial(cube, hexRound); - } - static cubeRound(cube, cubeRound) { - let rx = Math.round(cube[0]); - let ry = Math.round(cube[1]); - let rz = Math.round(cube[2]); - const x_diff = Math.abs(rx - cube[0]); - const y_diff = Math.abs(ry - cube[1]); - const z_diff = Math.abs(rz - cube[2]); - if (x_diff > y_diff && x_diff > z_diff) rx = -ry - rz; - else if (y_diff > z_diff) ry = -rx - rz; - else rz = -rx - ry; - cubeRound[0] = rx; - cubeRound[1] = ry; - cubeRound[2] = rz; - } -} -HexHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../main.js":"f421K","./angle.js":"53hwW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bm0M4":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexBinHelper", ()=>HexBinHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _hexJs = require("./hex.js"); -class HexBinHelper { - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const width = (options.maxValueX - options.minValueX) / options.binsX; - const minValueX = options.minValueX - width / 2; - const binsX = options.binsX + 1; - const size = width / (0, _constantsJs.Constants).ROOT_THREE; - const height = 2 * size; - const heightBetweenCenters = 3 * height / 4; - const binsY = Math.ceil((options.maxValueY - options.minValueY) / heightBetweenCenters) + 1; - const minValueY = options.minValueY; - const minQ = -Math.floor(binsY / 2); - const maxBins = (binsX - minQ) * binsY; - const binCounts = new Float64Array(maxBins); - const binLookup = new Uint32Array(maxBins); - const point = (0, _glMatrix.vec2).create(); - const hex = (0, _glMatrix.vec2).create(); - let nonEmptyBins = 0; - let minCount = Number.MAX_VALUE; - let maxCount = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - point[0] = options.valuesX[id] - minValueX; - point[1] = options.valuesY[id] - minValueY; - (0, _hexJs.HexHelper).pixelToPointyHex(point, size, hex); - const q = hex[0] - minQ; - const r = hex[1]; - const binId = q + r * (binsX - minQ); - if (binCounts[binId] == 0) { - binLookup[binId] = nonEmptyBins; - nonEmptyBins++; - } - binCounts[binId]++; - options.binIds[id] = binId; - minCount = Math.min(minCount, binCounts[binId]); - maxCount = Math.max(maxCount, binCounts[binId]); - } - const positionsX = new Float64Array(nonEmptyBins); - const positionsY = new Float64Array(nonEmptyBins); - const counts = new Uint32Array(nonEmptyBins); - const lookup = {}; - for(let i = 0; i < maxBins; i++){ - const count = binCounts[i]; - if (count > 0) { - const index = binLookup[i]; - lookup[i] = index; - counts[index] = count; - const q = i % (binsX - minQ); - const r = Math.floor(i / (binsX - minQ)); - hex[0] = q + minQ; - hex[1] = r; - (0, _hexJs.HexHelper).pointyHexToPixel(hex, size, point); - positionsX[index] = point[0] + minValueX; - positionsY[index] = point[1] + minValueY; - } - } - const result = { - binIds: options.binIds, - positionsX: positionsX, - positionsY: positionsY, - counts: counts, - minCount: minCount, - maxCount: maxCount, - orientation: (0, _mainJs.HexOrientation).pointyTop, - size: size, - lookup: lookup, - binsY: binsY - }; - return result; + set offsetsZ(value2) { + if (this._offsetsZ != value2) { + this._offsetsZ = value2; + this._hasChanged = true; + } } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../main.js":"f421K","./hex.js":"ahk7A","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iEeyT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LineHelper", ()=>LineHelper); -var _mainJs = require("../main.js"); -class LineHelper { - constructor(core){ - this._core = core; - } - connect(orderedIds, series, toIds, offset = 0, count = orderedIds.length) { - const start = window.performance.now(); - const lines = new Set(); - const lookup = {}; - for(let i = offset; i < count; i++){ - const id = orderedIds[i + offset]; - const value = series[id]; - const fromId = lookup[value]; - if (fromId != null) { - toIds[fromId] = id; - lines.add(value); - } - lookup[value] = id; - toIds[id] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `${lines.size} lines connected ${Math.round(window.performance.now() - start)}ms`); - return lines.size; - } -} - -},{"../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7fuDW":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteHelper", ()=>PaletteHelper); -var _glMatrix = require("gl-matrix"); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -class PaletteHelper { - static resample(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < divisionsOut; i++){ - const positionOut = (i + 0.5) / divisionsOut; - const positionIn = positionOut * (divisionsIn - 1); - const stepIn = Math.floor(positionIn); - const fractIn = positionIn - stepIn; - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3], colorsIn[(stepIn + 1) * 3], fractIn); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 1], colorsIn[(stepIn + 1) * 3 + 1], fractIn); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 2], colorsIn[(stepIn + 1) * 3 + 2], fractIn); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static truncate(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < Math.min(divisionsIn, divisionsOut); i++){ - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = colorsIn[i * 3]; - colorsOut[j * 4 + 1] = colorsIn[i * 3 + 1]; - colorsOut[j * 4 + 2] = colorsIn[i * 3 + 2]; - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static resampleStops(stops, divisions, reverse) { - const colorsOut = new Uint8Array(divisions * 4); - let from = 0; - let to = 0; - for(let i = 0; i < divisions; i++){ - const positionOut = (i + 0.5) / divisions; - while(stops[from].position < positionOut && from < stops.length - 1)from++; - from = Math.max(from - 1, 0); - to = Math.min(from + 1, stops.length - 1); - const fromStop = stops[from]; - const toStop = stops[to]; - const fract = from == to ? 0 : (positionOut - fromStop.position) / (toStop.position - fromStop.position); - const j = reverse ? divisions - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(fromStop.r, toStop.r, fract); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(fromStop.g, toStop.g, fract); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(fromStop.b, toStop.b, fract); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static lerpRgb(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - colors[i * 4] = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - colors[i * 4 + 1] = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - colors[i * 4 + 2] = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - colors[i * 4 + 3] = 0xff; - } - return colors; - } - static lerpHsv(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - const h = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - const s = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - const v = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - (0, _colorJs.ColorHelper).hsvToRgb(h, s, v, PaletteHelper._rgb); - colors[i * 4] = PaletteHelper._rgb[0] * 0xff; - colors[i * 4 + 1] = PaletteHelper._rgb[1] * 0xff; - colors[i * 4 + 2] = PaletteHelper._rgb[2] * 0xff; - colors[i * 4 + 3] = 0xff; - } - return colors; - } -} -PaletteHelper._rgb = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"5x28d","./color.js":"4LgMf","./math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dvdia":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PathHelper", ()=>PathHelper); -class PathHelper { - static getFilenameWithoutExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1) return path; - else { - const start = path.lastIndexOf('/') == -1 ? 0 : path.lastIndexOf('/') + 1; - return path.substring(start, dot); - } + get offsetScalingX() { + return this._offsetScalingX; } - static getExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1 || dot == path.length - 1) return null; - else return path.substring(dot + 1, path.length); + set offsetScalingX(value2) { + if (this._offsetScalingX != value2) { + this._offsetScalingX = value2; + this._hasChanged = true; + } } - static getFilename(path) { - if (path.lastIndexOf('/') == -1) return path; - else { - const start = path.lastIndexOf('/') + 1; - return path.substring(start, path.length); - } + get offsetScalingY() { + return this._offsetScalingY; } - static getPath(path) { - if (path.lastIndexOf('/') == -1) return ""; - else return path.substring(0, path.lastIndexOf('/')); + set offsetScalingY(value2) { + if (this._offsetScalingY != value2) { + this._offsetScalingY = value2; + this._hasChanged = true; + } } - static combine(first, second) { - const seperator = first.lastIndexOf('/') == first.length - 1; - if (second.indexOf('/') == 0) { - if (seperator) return first.substring(0, first.length - 1) + second; - else return first + second; - } else { - if (seperator) return first + second; - else return first + '/' + second; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cn0Qv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TableHelper", ()=>TableHelper); -var _mainJs = require("../main.js"); -var _tableJs = require("../tables/table.js"); -class TableHelper { - constructor(core){ - this._core = core; - } - compatibleTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const types = []; - const integers = []; - let values = data[firstRow]; - let parsedFloat, parsedDate; - for(let i = 0; i < values.length; i++){ - const value = values[i]; - parsedFloat = Number(value); - parsedDate = Date.parse(value); - let integer = false; - let type; - if (!isNaN(parsedFloat)) { - type = (0, _tableJs.ColumnType).float; - integer = Number.isSafeInteger(parsedFloat); - } else if (!isNaN(parsedDate)) type = (0, _tableJs.ColumnType).date; - else type = (0, _tableJs.ColumnType).string; - types.push(type); - integers.push(integer); - } - for(let i = firstRow + 1; i < Math.min(data.length, firstRow + maxRows); i++){ - values = data[i]; - for(let j = 0; j < values.length; j++)if (types[j] != (0, _tableJs.ColumnType).string) { - const value = values[j]; - parsedFloat = Number(value); - if (types[j] == (0, _tableJs.ColumnType).float) { - if (isNaN(parsedFloat)) { - types[j] = (0, _tableJs.ColumnType).string; - integers[j] = false; - } else if (integers[j]) integers[j] = Number.isSafeInteger(parsedFloat); - } else if (types[j] == (0, _tableJs.ColumnType).date) { - parsedDate = Date.parse(value); - if (isNaN(parsedDate)) types[j] = (0, _tableJs.ColumnType).string; - } - } - } - const compatibleTypes = []; - for(let i = 0; i < types.length; i++){ - let compatible = types[i] | (0, _tableJs.ColumnType).string; - if (integers[i]) compatible |= (0, _tableJs.ColumnType).integer; - compatibleTypes.push(compatible); - } - this._core.log.write((0, _mainJs.LogLevel).info, `compatible types ${Math.round(window.performance.now() - start)}ms`); - return compatibleTypes; - } - inferTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const columnTypes = []; - const compatibleTypes = this.compatibleTypes(data, firstRow, maxRows); - for(let i = 0; i < compatibleTypes.length; i++){ - let columnType; - const compatibleType = compatibleTypes[i]; - if (compatibleType & (0, _tableJs.ColumnType).integer) columnType = (0, _tableJs.ColumnType).integer; - else if (compatibleType & (0, _tableJs.ColumnType).float) columnType = (0, _tableJs.ColumnType).float; - else if (compatibleType & (0, _tableJs.ColumnType).date) columnType = (0, _tableJs.ColumnType).date; - else columnType = (0, _tableJs.ColumnType).string; - columnTypes.push(columnType); - } - return columnTypes; - } - convertToObject(table) { - const headings = table.headings; - const jsonObject = []; - for(let i = 0; i < table.all.ids.length; i++){ - const row = {}; - for(let j = 0; j < headings.length; j++){ - const column = headings[j]; - const value = table.all.columnValues(j)[i]; - switch(table.getColumnType(j)){ - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - row[column] = value; - break; - case (0, _tableJs.ColumnType).string: - case (0, _tableJs.ColumnType).date: - default: - row[column] = table.data[i][j]; - break; - } - jsonObject.push(row); - } - } - return jsonObject; - } -} - -},{"../main.js":"f421K","../tables/table.js":"1Nyfw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Nyfw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -parcelHelpers.export(exports, "ColumnType", ()=>ColumnType); -var _filterJs = require("./filter.js"); -class Table { - get data() { - return this._data; - } - get headings() { - return this._headings; - } - get all() { - return this._all; + get offsetScalingZ() { + return this._offsetScalingZ; } - get isInitialized() { - return this._isInitialized; + set offsetScalingZ(value2) { + if (this._offsetScalingZ != value2) { + this._offsetScalingZ = value2; + this._hasChanged = true; + } } - get filter() { - return this._filter; + get text() { + return this._text; } - set filter(value) { - if (this._filter !== value) { - this._filter = value; - if (this.filterChangedCallback) this.filterChangedCallback(); - } + set text(value2) { + if (this._text != value2) { + this._text = value2; + this._hasChanged = true; + } } - getColumnType(column) { - return this._columnTypes[column]; + get horizontalAlignments() { + return this._horizontalAlignments; } - isColumnDiscrete(column) { - return (this._columnTypes[column] & ColumnType.discrete) > 0; + set horizontalAlignments(value2) { + if (this._horizontalAlignments != value2) { + this._horizontalAlignments = value2; + this._hasChanged = true; + } } - isColumnNumeric(column) { - return (this._columnTypes[column] & ColumnType.numeric) > 0; + get verticalAlignments() { + return this._verticalAlignments; } - isColumnContinuous(column) { - return (this._columnTypes[column] & ColumnType.continuous) > 0; + set verticalAlignments(value2) { + if (this._verticalAlignments != value2) { + this._verticalAlignments = value2; + this._hasChanged = true; + } } - constructor(core, headings, data, columnTypes){ - this._core = core; - this._headings = headings; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = Array(columnTypes.length).fill(null); - const indices = new Uint32Array(data.length); - for(let i = 0; i < indices.length; i++)indices[i] = i; - this._all = new (0, _filterJs.Filter)(core, indices, data, headings, columnTypes, this._numericValues); - this._isInitialized = true; + get scales() { + return this._scales; } - createFilter(ids) { - return new (0, _filterJs.Filter)(this._core, ids, this._data, this._headings, this._columnTypes, this._numericValues); + set scales(value2) { + if (this._scales != value2) { + this._scales = value2; + this._hasChanged = true; + } } -} -const ColumnType = { - none: 0, - float: 1, - integer: 2, - string: 4, - date: 8, - continuous: 9, - discrete: 6, - numeric: 11 -}; - -},{"./filter.js":"b6FuS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b6FuS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Filter", ()=>Filter); -var _mainJs = require("../main.js"); -var _tableJs = require("./table.js"); -class Filter { - get ids() { - return this._ids; - } - constructor(core, ids, data, headings, columnTypes, numericValues){ - this._core = core; - this._ids = ids; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = numericValues; - this._stringValues = Array(columnTypes.length).fill(null); - this._hasMinMaxValues = Array(columnTypes.length).fill(false); - this._minValues = Array(columnTypes.length).fill(0); - this._maxValues = Array(columnTypes.length).fill(0); - this._distinctStrings = Array(columnTypes.length).fill(null); - this._orderedIds = Array(columnTypes.length).fill(null); - this._orderedValues = Array(columnTypes.length).fill(null); - } - columnValues(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) return this._createStringValues(column); - else return this._createNumericValues(column); - } - minValue(column) { - this._createMinMaxValues(column); - return this._minValues[column]; - } - maxValue(column) { - this._createMinMaxValues(column); - return this._maxValues[column]; - } - distinctStrings(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - return this._distinctStrings[column]; - } else return null; - } - toJSON(ids, columns) { - const rows = []; - for(let i = 0; i < ids.length; i++){ - const rowIndex = ids[i]; - const row = []; - for(let j = 0; j < columns.length; j++){ - const columnIndex = columns[j]; - switch(this._columnTypes[columnIndex]){ - case (0, _tableJs.ColumnType).date: - case (0, _tableJs.ColumnType).string: - row.push(this._data[rowIndex][columnIndex]); - break; - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - const numericValues = this._createNumericValues(columnIndex); - row.push(numericValues[rowIndex]); - break; - } - } - rows.push(row); - } - return JSON.stringify(rows); + get scalesScaling() { + return this._scalesScaling; } - orderedIds(column) { - if (!this._orderedIds[column]) { - const start = window.performance.now(); - const orderedIds = new Uint32Array(this._ids); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - orderedIds.sort(function(a, b) { - return values[a] - values[b]; - }); - this._orderedIds[column] = orderedIds; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered ids ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedIds[column]; + set scalesScaling(value2) { + if (this._scalesScaling != value2) { + this._scalesScaling = value2; + this._hasChanged = true; + } } - orderedValues(column) { - if (!this._orderedValues[column]) { - const start = window.performance.now(); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - const orderedIds = this.orderedIds(column); - const orderedValues = new Float64Array(this._ids.length); - for(let i = 0; i < this._ids.length; i++)orderedValues[i] = values[orderedIds[i]]; - this._orderedValues[column] = orderedValues; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered values ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedValues[column]; - } - distinctStringsOrdered(ids, column, stringValues) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - const distinctStrings = []; - const distinctStringValues = {}; - const set = new Set(); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const string = this._data[id][column]; - let value; - if (!set.has(string)) { - distinctStrings.push(string); - value = set.size; - distinctStringValues[string] = value; - set.add(string); - } else value = distinctStringValues[string]; - stringValues[id] = value; - } - return distinctStrings; - } else return null; - } - _createMinMaxValues(column) { - if (!this._hasMinMaxValues[column]) { - const type = this._columnTypes[column]; - let min, max; - if (type == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - min = 0; - max = this._distinctStrings[column].length - 1; - } else { - const numericValues = this._createNumericValues(column); - min = Number.MAX_VALUE; - max = -Number.MAX_VALUE; - for(let i = 0; i < this._ids.length; i++){ - const id = this._ids[i]; - const value = numericValues[id]; - min = Math.min(min, value); - max = Math.max(max, value); - } - } - this._minValues[column] = min; - this._maxValues[column] = max; - this._hasMinMaxValues[column] = true; - } - } - _createNumericValues(column) { - if (!this._numericValues[column]) { - const numericValues = new Float64Array(this._data.length); - const type = this._columnTypes[column]; - if (type == (0, _tableJs.ColumnType).float) for(let i = 0; i < this._data.length; i++){ - const value = parseFloat(this._data[i][column]); - numericValues[i] = value; - } - else if (type == (0, _tableJs.ColumnType).integer) for(let i = 0; i < this._data.length; i++){ - const value = parseInt(this._data[i][column]); - numericValues[i] = value; - } - else if (type == (0, _tableJs.ColumnType).date) for(let i = 0; i < this._data.length; i++){ - const value = Date.parse(this._data[i][column]); - numericValues[i] = value; - } - this._numericValues[column] = numericValues; - } - return this._numericValues[column]; - } - _createStringValues(column) { - if (!this._stringValues[column]) { - this._stringValues[column] = new Float64Array(this._data.length); - this._distinctStrings[column] = this.distinctStringsOrdered(this._ids, column, this._stringValues[column]); - this._minValues[column] = 0; - this._maxValues[column] = this._distinctStrings[column].length - 1; - this._hasMinMaxValues[column] = true; - } - return this._stringValues[column]; - } -} - -},{"../main.js":"f421K","./table.js":"1Nyfw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bUoBU":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureHelper", ()=>TextureHelper); -var _mathJs = require("./math.js"); -class TextureHelper { - static create(gl, width, height, format, type, filter, bytes, internalFormat = format) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, bytes); - return texture; - } - static fromImage(gl, image, mipmaps, filter) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - if (mipmaps && (0, _mathJs.MathHelper).isPowerOf2(image.width) && (0, _mathJs.MathHelper).isPowerOf2(image.height)) gl.generateMipmap(gl.TEXTURE_2D); - else { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - } - gl.bindTexture(gl.TEXTURE_2D, null); - return texture; + constructor(core, options2) { + super(core, options2); + this._quat = create$4(); + this._materials = options2.materials; + this._materialType = options2.materialType; + this._materialColor = options2.materialColors ? null : options2.materialColor || core.config.textColor; + this._materialColors = options2.materialColors; + this.minBoundsX = options2.minBoundsX ? options2.minBoundsX : 0; + this.minBoundsY = options2.minBoundsY ? options2.minBoundsY : 0; + this.minBoundsZ = options2.minBoundsZ ? options2.minBoundsZ : 0; + this.maxBoundsX = options2.maxBoundsX ? options2.maxBoundsX : 1; + this.maxBoundsY = options2.maxBoundsY ? options2.maxBoundsY : 1; + this.maxBoundsZ = options2.maxBoundsZ ? options2.maxBoundsZ : 1; + this._font = options2.font || core.font; + this.text = options2.text; + this.positionsX = options2.positionsX; + this.positionsY = options2.positionsY; + this.positionsZ = options2.positionsZ; + this.positionScalingX = options2.positionScalingX ? options2.positionScalingX : 1; + this.positionScalingY = options2.positionScalingY ? options2.positionScalingY : 1; + this.positionScalingZ = options2.positionScalingZ ? options2.positionScalingZ : 1; + this.rotations = options2.rotations; + this.offsetsX = options2.offsetsX; + this.offsetsY = options2.offsetsY; + this.offsetsZ = options2.offsetsZ; + this.offsetScalingX = options2.offsetScalingX ? options2.offsetScalingX : 1; + this.offsetScalingY = options2.offsetScalingY ? options2.offsetScalingY : 1; + this.offsetScalingZ = options2.offsetScalingZ ? options2.offsetScalingZ : 1; + if (options2.horizontalAlignments) + this.horizontalAlignments = options2.horizontalAlignments; + if (options2.verticalAlignments) + this.verticalAlignments = options2.verticalAlignments; + if (options2.scales) + this.scales = options2.scales; + this.scalesScaling = options2.scalesScaling ? options2.scalesScaling : 1; } - static cubemapFromImages(gl, images) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); - const targets = [ - gl.TEXTURE_CUBE_MAP_POSITIVE_X, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X, - gl.TEXTURE_CUBE_MAP_POSITIVE_Y, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, - gl.TEXTURE_CUBE_MAP_POSITIVE_Z, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Z - ]; - for(let i = 0; i < 6; i++){ - gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - } - gl.generateMipmap(gl.TEXTURE_CUBE_MAP); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); - return texture; - } -} - -},{"./math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4ts5g":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TreeHelper", ()=>TreeHelper); -class TreeHelper { - static parentChildren(ids, parentIds, childIds) { - const rootIds = []; - const degrees = new Uint32Array(ids.length); - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const parentId = parentIds[index]; - const childId = childIds[index]; - indices[childId] = index; - if (children[parentId] === undefined) { - children[parentId] = []; - degrees[index] = 1; + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.pickIdLookup = {}; + if (!this._text) { + this._indexCount = 0; + } else { + const start = window.performance.now(); + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; + const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; + const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; + if (this._rotation) { + set$6(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); + } + let glyphs = 0; + for (let i = 0; i < this._text.length; i++) { + const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; + const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; + const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; + const text2 = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); + const scale2 = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const lineHeight2 = this._font.size * scale2; + const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale2; + const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; + switch (horizontalAlignment) { + case HorizontalAlignment.left: + this._offset[0] = offsetX; + break; + case HorizontalAlignment.center: + this._offset[0] = offsetX - width2 / 2; + break; + case HorizontalAlignment.right: + this._offset[0] = offsetX - width2; + break; } - if (parentId < 0 || parentId == childId) rootIds.push(parentId); - else { - children[parentId].push(childId); - degrees[index]++; + const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; + switch (verticalAlignment) { + case VerticalAlignment.top: + this._offset[1] = offsetY - lineHeight2 / 2; + break; + case VerticalAlignment.center: + this._offset[1] = offsetY; + break; + case VerticalAlignment.bottom: + this._offset[1] = offsetY + lineHeight2 / 2; + break; } + this._offset[1] -= maxGlyphTop / 2; + this._offset[2] = offsetZ; + let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; + let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; + let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; + if (this._reverseX) { + positionX = this.minBoundsX + this.maxBoundsX - positionX; + } + if (this._reverseY) { + positionY = this.minBoundsY + this.maxBoundsY - positionY; + } + if (this._reverseZ) { + positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; + } + set$8(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); + if (this._rotations) { + set$6(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.label, this._vec4); + this.pickIdLookup[pickId] = i; + TextHelper.addString(this._font, text2, this._verticesView, this._indices, glyphs, this._vec3, scale2, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); + glyphs += text2.length; + if (glyphs >= this._maxGlyphs) { + glyphs = this._maxGlyphs; + break; + } + } + this._indexCount = glyphs * 6; + this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } } - return { - rootIds: rootIds, - indices: indices, - children: children, - degrees: degrees - }; + } } - static tree(rootId, indices, children, positions, widths, descendents) { - let nextId = 0; - const idsArray = []; - let maxDescendents = 0; - const buildTree = (parentId)=>{ - const index = indices[parentId]; - idsArray.push(index); - const childIds = children[parentId]; - if (childIds !== undefined) { - const start = nextId; - let total = 0; - for(let i = 0; i < childIds.length; i++){ - buildTree(childIds[i]); - total += descendents[indices[childIds[i]]] + 1; - } - const end = nextId - 1; - positions[index] = (start + end) / 2; - descendents[index] = total; - maxDescendents = Math.max(maxDescendents, total); - widths[index] = end - start + 1; - } else { - widths[index] = 1; - positions[index] = nextId++; - } - }; - buildTree(rootId); - const maxPosition = nextId - 1; - return { - ids: new Uint32Array(idsArray), - maxDescendents: maxDescendents, - maxPosition: maxPosition - }; + } + let ImageVisual$2 = class ImageVisual { + render(elapsedTime, xrFrame) { } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7s3Z5":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SetHelper", ()=>SetHelper); -class SetHelper { - static new(a, b) { - a.clear(); - for (let item of b)a.add(item); - } - static union(a, b) { - for (let item of b)a.add(item); - } - static intersection(a, b) { - const c = new Set(b); - for (let item of a)if (!c.has(item)) a.delete(item); - for (let item of b)if (!a.has(item)) a.delete(item); - } - static symmetricDifference(a, b) { - for (let item of b)if (a.has(item)) a.delete(item); - else a.add(item); - } - static difference(a, b) { - for (let item of b)a.delete(item); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2PdqK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfHelper", ()=>SdfHelper); -class SdfHelper { - static _circle(px, py, r) { - return Math.sqrt(px * px + py * py) - r; - } - static _box(px, py, bx, by) { - const dx0 = Math.abs(px) - bx; - const dy0 = Math.abs(py) - by; - const dx1 = Math.max(dx0, 0); - const dy1 = Math.max(dy0, 0); - return Math.sqrt(dx1 * dx1 + dy1 * dy1) + Math.min(Math.max(dx0, dy0), 0); - } - static _create(width, height, edge, sdf) { - const pixels = new Uint8ClampedArray(width * height * 4); - for(let y = 0; y < height; y++)for(let x = 0; x < width; x++){ - const d = edge - sdf(x - width / 2, y - height / 2); - const offset = (x + y * height) * 4; - pixels[offset] = d; - pixels[offset + 1] = d; - pixels[offset + 2] = d; - pixels[offset + 3] = 0xff; - } - return new ImageData(pixels, width, height); - } - static circle(imageWidth, imageHeight, radius, edgeValue) { - const sdf = (x, y)=>this._circle(x, y, radius); - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } - static box(imageWidth, imageHeight, boxWidth, boxHeight, edgeValue, rounding = 0) { - const sdf = (x, y)=>this._box(x, y, boxWidth - rounding, boxHeight - rounding) - rounding; - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2r8XP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VectorHelper", ()=>VectorHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class VectorHelper { - static orthonormalBasis(n, b1, b2) { - if (n[0] > 0.9) (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITY); - else (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITX); - (0, _glMatrix.vec3).scaleAndAdd(b1, b1, n, -(0, _glMatrix.vec3).dot(b1, n)); - (0, _glMatrix.vec3).normalize(b1, b1); - (0, _glMatrix.vec3).cross(b2, n, b1); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"duBHP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>(0, _barJs.Bar)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Line", ()=>(0, _lineJs.Line)); -parcelHelpers.export(exports, "Tree", ()=>(0, _treeJs.Tree)); -parcelHelpers.export(exports, "PythagorasTree", ()=>(0, _treeJs.PythagorasTree)); -parcelHelpers.export(exports, "Scatter", ()=>(0, _scatterJs.Scatter)); -parcelHelpers.export(exports, "Sheet", ()=>(0, _sheetJs.Sheet)); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>(0, _treemapJs.SquarifiedTreeMap)); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>(0, _treemapJs.CubifiedTreeMap)); -parcelHelpers.export(exports, "Stack", ()=>(0, _stackJs.Stack)); -parcelHelpers.export(exports, "StackTreeMap", ()=>(0, _stackJs.StackTreeMap)); -var _barJs = require("./bar.js"); -var _cubeJs = require("./cube.js"); -var _lineJs = require("./line.js"); -var _treeJs = require("./tree.js"); -var _scatterJs = require("./scatter.js"); -var _sheetJs = require("./sheet.js"); -var _treemapJs = require("./treemap.js"); -var _stackJs = require("./stack.js"); - -},{"./bar.js":"6wdpr","./cube.js":"g6aRn","./line.js":"a7d6z","./tree.js":"2Odry","./scatter.js":"bwpY2","./sheet.js":"fGQjs","./treemap.js":"1HzJp","./stack.js":"f8244","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6wdpr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>Bar); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Bar extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const heightScaling = options.heightScaling === undefined ? 1 : options.heightScaling; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const paddingX = options.paddingX == undefined ? 0 : options.paddingX * positionScalingX; - const paddingZ = options.paddingZ == undefined ? 0 : options.paddingZ * positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - let positionX, positionY, positionZ; - let sizeX, sizeY, sizeZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(options.heights ? options.heights[id] * heightScaling : heightScaling, minHeight); - positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - positionY = height / 2; - positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - sizeX = (options.sizeX === undefined ? options.sizesX ? options.sizesX[id] : 1 : options.sizeX) * positionScalingX; - sizeY = Math.abs(height); - sizeZ = (options.sizeZ === undefined ? options.sizesZ ? options.sizesZ[id] : 1 : options.sizeZ) * positionScalingZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX - sizeX / 2); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY - sizeY / 2); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ - sizeZ / 2); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX + sizeX / 2); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY + sizeY / 2); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ + sizeZ / 2); - this._sizes[index * 3] = Math.max(sizeX - paddingX, 0); - this._sizes[index * 3 + 1] = sizeY; - this._sizes[index * 3 + 2] = Math.max(sizeZ - paddingZ, 0); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g6aRn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Cube extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.cbrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / (side * side)); - const z = Math.floor((i - y * side * side) / side); - const x = i - y * side * side - z * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = z; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, z); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - _vec2[0] = color; - _vec2[1] = color; - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a7d6z":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Line", ()=>Line); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Line extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const offsetScaling = options.offsetScaling === undefined ? 1 : options.offsetScaling; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - this._rotations = new Float32Array(buffer.length * 4); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const direction = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; - let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; - let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; - let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; - let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; - let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; - if (fromId == toId) { - this._sizes[index * 3] = 0; - this._sizes[index * 3 + 1] = 0; - this._sizes[index * 3 + 2] = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - } else { - direction[0] = toPositionX - fromPositionX; - direction[1] = toPositionY - fromPositionY; - direction[2] = toPositionZ - fromPositionZ; - let length = (0, _glMatrix.vec3).length(direction); - (0, _glMatrix.vec3).scale(direction, direction, 1 / length); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, direction); - this._rotations[index * 4] = _quat[0]; - this._rotations[index * 4 + 1] = _quat[1]; - this._rotations[index * 4 + 2] = _quat[2]; - this._rotations[index * 4 + 3] = _quat[3]; - if (options.offsets) { - const fromOffset = options.offsets[fromId] * offsetScaling / 2; - const toOffset = options.offsets[toId] * offsetScaling / 2; - toPositionX -= direction[0] * toOffset; - toPositionY -= direction[1] * toOffset; - toPositionZ -= direction[2] * toOffset; - fromPositionX += direction[0] * fromOffset; - fromPositionY += direction[1] * fromOffset; - fromPositionZ += direction[2] * fromOffset; - length = Math.max(length - toOffset - fromOffset, minSize); - } - this._sizes[index * 3 + 1] = Math.max(length * sizeScalingY, minSize); - if (options.lineSizes) { - this._sizes[index * 3] = Math.max(options.lineSizes[id] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.lineSizes[id] * sizeScalingZ, minSize); - } else if (options.endSizes) { - this._sizes[index * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); - } else { - this._sizes[index * 3] = sizeScalingX; - this._sizes[index * 3 + 2] = sizeScalingZ; - } - } - _vec3[0] = (fromPositionX + toPositionX) / 2; - _vec3[1] = (fromPositionY + toPositionY) / 2; - _vec3[2] = (fromPositionZ + toPositionZ) / 2; - this._positions[index * 3] = _vec3[0]; - this._positions[index * 3 + 1] = _vec3[1]; - this._positions[index * 3 + 2] = _vec3[2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const endMinColor = options.endMinColor === undefined ? 0 : options.endMinColor; - const endMaxColor = options.endMaxColor === undefined ? 1 : options.endMaxColor; - const lineMinColor = options.lineMinColor === undefined ? 0 : options.lineMinColor; - const lineMaxColor = options.lineMaxColor === undefined ? 1 : options.lineMaxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - let size; - if (options.endColors) { - size = 1 / (endMaxColor - endMinColor + 1); - const fromColor = (0, _mathJs.MathHelper).normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - const toColor = (0, _mathJs.MathHelper).normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, fromColor, toColor); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else if (options.lineColors) { - size = 1 / (lineMaxColor - lineMinColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.lineColors[id], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Odry":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PythagorasTree", ()=>PythagorasTree); -parcelHelpers.export(exports, "Tree", ()=>Tree); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class PythagorasTree extends (0, _layoutJs.LayoutBase) { - get levels() { - return this._levels; - } - get maxLevel() { - return this._maxLevel; - } - get volumes() { - return this._volumes; - } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentTranslation = (0, _glMatrix.vec3).create(); - this._parentScale = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - } - static calculateTotalVertices(level) { - return (2 << level) - 1; - } - static calculateMaxLevel(vertices) { - return Math.ceil(Math.log2(vertices + 1)) - 1; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const scalingX = options.scalingX === undefined ? 1 : options.scalingX; - const scalingY = options.scalingY === undefined ? 1 : options.scalingY; - const scalingZ = options.scalingZ === undefined ? 1 : options.scalingZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._levels = new Uint32Array(buffer.length); - this._volumes = new Float64Array(buffer.length); - } - this._maxLevel = PythagorasTree.calculateMaxLevel(ids.length); - const lookup = buffer.lookup; - const id = ids[0]; - const index = lookup[id]; - this._levels[index] = 0; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3] = scalingX; - this._sizes[index * 3 + 1] = scalingY; - this._sizes[index * 3 + 2] = scalingZ; - this._volumes[index] = scalingX * scalingY * scalingZ; - this._count = 1; - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(index, ids, lookup, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentIndex, ids, lookup, pseudoRandom) { - const parentLevel = this._levels[parentIndex]; - if (parentLevel < this._maxLevel && this._count < ids.length) { - let angle = this._angle + (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - this._parentTranslation[0] = this._positions[parentIndex * 3]; - this._parentTranslation[1] = this._positions[parentIndex * 3 + 1]; - this._parentTranslation[2] = this._positions[parentIndex * 3 + 2]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - this._parentScale[0] = this._sizes[parentIndex * 3]; - this._parentScale[1] = this._sizes[parentIndex * 3 + 1]; - this._parentScale[2] = this._sizes[parentIndex * 3 + 2]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - const childId1 = ids[this._count++]; - const childIndex1 = lookup[childId1]; - let cos = Math.cos(angle); - this._sizes[childIndex1 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex1 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex1 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex1 * 4] = this._childRotation[0]; - this._rotations[childIndex1 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex1 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex1 * 4 + 3] = this._childRotation[3]; - const halfparentScaleX = this._parentScale[0] * 0.5; - const halfparentScaleY = this._parentScale[1] * 0.5; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos + this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos + this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos + this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY - this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY - this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY - this._parentRight[2] * halfparentScaleX; - this._positions[childIndex1 * 3] = childTranslationX; - this._positions[childIndex1 * 3 + 1] = childTranslationY; - this._positions[childIndex1 * 3 + 2] = childTranslationZ; - this._levels[childIndex1] = parentLevel + 1; - this._volumes[childIndex1] = this._sizes[childIndex1 * 3] * this._sizes[childIndex1 * 3 + 1] * this._sizes[childIndex1 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (this._count < ids.length) { - const childId2 = ids[this._count++]; - const childIndex2 = lookup[childId2]; - cos = Math.cos((0, _constantsJs.Constants).PI_OVER_TWO - angle); - this._sizes[childIndex2 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex2 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex2 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle - (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex2 * 4] = this._childRotation[0]; - this._rotations[childIndex2 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex2 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex2 * 4 + 3] = this._childRotation[3]; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos - this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos - this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos - this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY + this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY + this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY + this._parentRight[2] * halfparentScaleX; - this._positions[childIndex2 * 3] = childTranslationX; - this._positions[childIndex2 * 3 + 1] = childTranslationY; - this._positions[childIndex2 * 3 + 2] = childTranslationZ; - this._levels[childIndex2] = parentLevel + 1; - this._volumes[childIndex2] = this._sizes[childIndex2 * 3] * this._sizes[childIndex2 * 3 + 1] * this._sizes[childIndex2 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - this._branch(childIndex1, ids, lookup, pseudoRandom); - this._branch(childIndex2, ids, lookup, pseudoRandom); - } - } + update(elapsedTime) { } -} -class Tree extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; + constructor(image2) { + this.image = image2; } - getPositionY(index) { - return this._positions[index * 3 + 1]; + }; + let ImageBase$1 = class ImageBase { + get material() { + return this._material; } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + get vertices() { + return this._vertices; } - getSizeX(index) { - return this._sizes[index * 3]; + get indices() { + return this._indices; } - getSizeY(index) { - return this._sizes[index * 3 + 1]; + get indexCount() { + return this._indexCount; } - getSizeZ(index) { - return this._sizes[index * 3 + 2]; + get isInitialized() { + return this._isInitialized; } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); + get mMatrix() { + return this._mMatrix; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const rootId = options.rootId; - this._sizeX = options.sizeX === undefined ? 1 : options.sizeX; - this._sizeY = options.sizeY === undefined ? 1 : options.sizeY; - this._sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._lengthScaling = options.lengthScaling === undefined ? 1 : options.lengthScaling; - this._thicknessScaling = options.thicknessScaling === undefined ? 1 : options.thicknessScaling; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - this._randomSplit = options.randomSplit === undefined ? 0 : options.randomSplit; - this._randomLengthScaling = options.randomLengthScaling === undefined ? 0 : options.randomLengthScaling; - this._randomThicknessScaling = options.randomThicknessScaling === undefined ? 0 : options.randomThicknessScaling; - this._minLength = options.minLength === undefined ? 0 : options.minLength; - this._minThickness = options.minThickness === undefined ? 0 : options.minThickness; - this._lengthScalings = options.lengthScalings; - this._thicknessScalings = options.thicknessScalings; - this._splitAngles = options.splitAngles; - this._angles = options.angles; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._parentRights = new Float64Array(buffer.length * 3); - this._parentUps = new Float64Array(buffer.length * 3); - this._parentForwards = new Float64Array(buffer.length * 3); - this._parentTwists = new Float64Array(buffer.length * 4); - } - const lookup = buffer.lookup; - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - const parentId = options.parentIds[index]; - const childId = options.childIds[index]; - indices[childId] = index; - if (childId === rootId) children[rootId] = []; - else { - if (children[parentId] === undefined) children[parentId] = []; - children[parentId].push(childId); - } - } - const index = indices[rootId]; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3 + 1] = this._sizeY; - this._sizes[index * 3] = this._sizeX; - this._sizes[index * 3 + 2] = this._sizeZ; - if (this._lengthScalings) { - this._lengthScaling = this._lengthScalings[index]; - this._sizes[index * 3 + 1] *= this._lengthScaling; - } - if (this._thicknessScalings) { - this._thicknessScaling = this._thicknessScalings[index]; - this._sizes[index * 3] *= this._thicknessScaling; - this._sizes[index * 3 + 2] *= this._thicknessScaling; - } - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(rootId, indices, children, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentId, indices, children, pseudoRandom) { - const childIds = children[parentId]; - const parentIndex = indices[parentId]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - this._parentUps[parentIndex * 3] = this._parentUp[0]; - this._parentUps[parentIndex * 3 + 1] = this._parentUp[1]; - this._parentUps[parentIndex * 3 + 2] = this._parentUp[2]; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - this._parentTwists[parentIndex * 4] = this._parentTwist[0]; - this._parentTwists[parentIndex * 4 + 1] = this._parentTwist[1]; - this._parentTwists[parentIndex * 4 + 2] = this._parentTwist[2]; - this._parentTwists[parentIndex * 4 + 3] = this._parentTwist[3]; - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - this._parentRights[parentIndex * 3] = this._parentRight[0]; - this._parentRights[parentIndex * 3 + 1] = this._parentRight[1]; - this._parentRights[parentIndex * 3 + 2] = this._parentRight[2]; - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - this._parentForwards[parentIndex * 3] = this._parentForward[0]; - this._parentForwards[parentIndex * 3 + 1] = this._parentForward[1]; - this._parentForwards[parentIndex * 3 + 2] = this._parentForward[2]; - for(let i = 0; i < childIds.length; i++){ - const childId = childIds[i]; - const childIndex = indices[childId]; - const parentScaleX = this._sizes[parentIndex * 3]; - const parentScaleY = this._sizes[parentIndex * 3 + 1]; - const parentScaleZ = this._sizes[parentIndex * 3 + 2]; - this._parentUp[0] = this._parentUps[parentIndex * 3]; - this._parentUp[1] = this._parentUps[parentIndex * 3 + 1]; - this._parentUp[2] = this._parentUps[parentIndex * 3 + 2]; - this._parentTwist[0] = this._parentTwists[parentIndex * 4]; - this._parentTwist[1] = this._parentTwists[parentIndex * 4 + 1]; - this._parentTwist[2] = this._parentTwists[parentIndex * 4 + 2]; - this._parentTwist[3] = this._parentTwists[parentIndex * 4 + 3]; - if (this._lengthScalings) { - const lengthScale = this._lengthScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(this._sizeY * lengthScale, this._minLength); - } else { - const lengthScale = this._lengthScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(parentScaleY * lengthScale, this._minLength); - } - if (this._thicknessScalings) { - const thicknessScale = this._thicknessScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(this._sizeX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(this._sizeZ * thicknessScale, this._minThickness); - } else { - const thicknessScale = this._thicknessScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(parentScaleX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(parentScaleZ * thicknessScale, this._minThickness); - } - let split; - if (this._splitAngles) split = this._splitAngles[childIndex]; - else split = (0, _constantsJs.Constants).TWO_PI * i / childIds.length; - split += (pseudoRandom.nextFloat() * 2 - 1) * this._randomSplit; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, split); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - let angle; - if (this._angles) angle = this._angles[childIndex]; - else angle = this._angle; - angle += (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._childRotation, this._quat); - this._rotations[childIndex * 4] = this._childRotation[0]; - this._rotations[childIndex * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex * 4 + 3] = this._childRotation[3]; - const halfParentScaleY = parentScaleY * 0.5; - const halfChildScaleY = this._sizes[childIndex * 3 + 1] * 0.5; - (0, _glMatrix.vec3).transformQuat(this._vec3, (0, _constantsJs.Constants).VECTOR3_UNITY, this._childRotation); - const childTranslationX = this._positions[parentIndex * 3] + this._parentUp[0] * halfParentScaleY + this._vec3[0] * halfChildScaleY; - const childTranslationY = this._positions[parentIndex * 3 + 1] + this._parentUp[1] * halfParentScaleY + this._vec3[1] * halfChildScaleY; - const childTranslationZ = this._positions[parentIndex * 3 + 2] + this._parentUp[2] * halfParentScaleY + this._vec3[2] * halfChildScaleY; - this._positions[childIndex * 3] = childTranslationX; - this._positions[childIndex * 3 + 1] = childTranslationY; - this._positions[childIndex * 3 + 2] = childTranslationZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (children[childId]) this._branch(childId, indices, children, pseudoRandom); - } - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/angle.js":"53hwW","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fGQjs":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sheet", ()=>Sheet); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Sheet extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.sqrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / side); - const x = i - y * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = 0; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1HzJp":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>SquarifiedTreeMap); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>CubifiedTreeMap); -parcelHelpers.export(exports, "TreeMapHelper", ()=>TreeMapHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class SquarifiedTreeMap extends (0, _layoutJs.LayoutBase) { - get positionsX() { - return this._positionsX; + get imageData() { + return this._imageData; } - get positionsY() { - return this._positionsY; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._hasChanged = true; + } } - get sizesX() { - return this._sizesX; + get rotation() { + return this._rotation; } - get sizesY() { - return this._sizesY; + set rotation(value2) { + if (!equals$1(this._rotation, value2)) { + copy$4(this._rotation, value2); + this._hasChanged = true; + } } - layout(buffer, ids, options) { - const start = window.performance.now(); - const size = options.size == undefined ? 1 : options.size; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } else if (size <= 0) return; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - } - TreeMapHelper.squarifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, sizeX, sizeY, buffer.lookup); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const heights = options.heights; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - let maxHeight; - if (heights) { - maxHeight = 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - maxHeight = Math.max(heights[id], maxHeight); - } - } else maxHeight = 1; - const heightScaling = (this.maxLayoutBoundsZ - this.minLayoutBoundsZ) / maxHeight; - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(heights ? heights[id] * heightScaling : heightScaling, minHeight); - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this.minLayoutBoundsZ + height / 2; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = height * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class CubifiedTreeMap extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - const sizeZ = this.maxLayoutBoundsZ - this.minLayoutBoundsZ; - const minHeight = this._core.config.minCubifiedTreeMapSlice / sizeY; - const side = Math.sqrt(sizeX * sizeZ); - const total = options.sizes ? TreeMapHelper.totalSize(ids, options.sizes, offset, offset + count - 1) : count; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - } - TreeMapHelper.cubifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, this.minLayoutBoundsZ, sizeX, sizeY, sizeZ, side, total, minHeight, isTopToBottom, buffer.lookup); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TreeMapHelper { - static squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - if (from > to) return; - if (to - from < 2) { - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup); - return; - } - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - const a = sizes ? sizes[ids[to]] / totalSize : 1 / totalSize; - let b = a; - let mid = to; - if (width < height) { - while(mid > from){ - const aspect = TreeMapHelper._aspect(height, width, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(height, width, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width, height * b, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x, y + height * b, width, height * (1 - b), lookup); - } else { - while(mid > from){ - const aspect = TreeMapHelper._aspect(width, height, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(width, height, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width * b, height, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x + width * b, y, width * (1 - b), height, lookup); - } + get position() { + return this._position; } - static totalSize(ids, sizes, from, to) { - let size = 0; - for(let i = from; i <= to; i++)size += sizes[ids[i]]; - return size; + set position(value2) { + if (!equals$2(this._position, value2)) { + copy$6(this._position, value2); + this._hasChanged = true; + } } - static _sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - let a = 0; - for(let i = to; i >= from; i--){ - const id = ids[i]; - const index = lookup[id]; - const b = sizes ? sizes[id] / totalSize : 1 / totalSize; - if (width > height) { - sizesY[index] = height; - sizesX[index] = width * b; - positionsY[index] = y + height / 2; - positionsX[index] = x + width * a + width * b / 2; - } else { - sizesX[index] = width; - sizesY[index] = height * b; - positionsX[index] = x + width / 2; - positionsY[index] = y + height * a + height * b / 2; - } - a += b; - } - } - static _aspect(big, small, a, b) { - const x = big * b / (small * a / b); - if (x < 1) return 1 / x; - return x; - } - static cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, to, x, y, z, width, height, depth, side, total, minHeight, isTopToBottom, lookup) { - if (from > to) return; - let sliceHeight = 0; - let sliceTotal = 0; - let previousAspect = 0; - let mid = to; - while(mid >= from){ - const itemSize = sizes ? sizes[ids[mid]] : 1; - sliceTotal += itemSize; - sliceHeight = height * sliceTotal / total; - const remainingHeight = height - sliceHeight; - if (remainingHeight < minHeight) { - mid = from; - const totalSize = sizes ? this.totalSize(ids, sizes, mid, to) : to - from + 1; - sliceHeight = height * totalSize / total; - break; - } - const itemSide = Math.sqrt(itemSize / sliceTotal) * side; - const aspect = itemSide > sliceHeight ? sliceHeight / itemSide : itemSide / sliceHeight; - if (aspect < previousAspect || mid == from) break; - previousAspect = aspect; - mid--; - } - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsZ, sizesX, sizesZ, mid, to, x, z, width, depth, lookup); - for(let j = mid; j <= to; j++){ - const id = ids[j]; - const index = lookup[id]; - sizesY[index] = Math.max(sliceHeight, 0.01); - positionsY[index] = isTopToBottom ? positionsY[index] = y + sliceHeight / 2 : y + height - sliceHeight / 2; - } - TreeMapHelper.cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, mid - 1, x, isTopToBottom ? y + sliceHeight : y, z, width, height - sliceHeight, depth, side, total - sliceTotal, minHeight, isTopToBottom, lookup); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../helpers/math.js":"f65d0","../main.js":"f421K","../vertex.js":"4J2YE","./layout.js":"kYBiT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8244":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "StackBase", ()=>StackBase); -parcelHelpers.export(exports, "Stack", ()=>Stack); -parcelHelpers.export(exports, "StackTreeMap", ()=>StackTreeMap); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _vertexJs = require("../vertex.js"); -var _treemapJs = require("./treemap.js"); -var _layoutJs = require("./layout.js"); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -class StackBase extends (0, _layoutJs.LayoutBase) { - get maxCount() { - return this._maxCount; - } - get levels() { - return this._levels; - } - get binCounts() { - return this._binCounts; - } - getPositionX(index) { - return this._positionsX[index]; - } - getPositionY(index) { - return this._positionsY[index]; - } - getPositionZ(index) { - return this._positionsZ[index]; - } -} -class Stack extends StackBase { - get maxLevel() { - return this._maxLevel; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - this._maxLevel = 0; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - this._height = options.height == undefined ? 1 : options.height; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._levels = new Uint32Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinLevel = 0; - let positionX, positionY, positionZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - const binCount = this._binCounts[binId]; - const level = Math.floor(binCount / sizeX / sizeZ); - this._levels[index] = level; - const levelCount = binCount - level * sizeX * sizeZ; - const itemZ = Math.floor(levelCount / sizeX); - const itemX = levelCount - itemZ * sizeX; - positionX = spacingX / 2 + binIdX * (sizeX + spacingX) + itemX + 0.5; - positionY = this._height * (level + 0.5); - positionZ = spacingZ / 2 + binIdZ * (sizeZ + spacingZ) + itemZ + 0.5; - this._positionsX[index] = positionX; - this._positionsY[index] = positionY; - this._positionsZ[index] = positionZ; - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - maxBinLevel = Math.max(maxBinLevel, level); - } - this._maxLevel = maxBinLevel + 1; - this._maxCount = maxBinCount; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = this._maxLevel * this._height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 - padding : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (this._height - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class StackTreeMap extends StackBase { - get maxTotal() { - return this._maxTotal; - } - get binGroupIds() { - return this._binGroupIds; - } - getSizeX(index) { - return this._sizesX[index]; - } - getSizeY(index) { - return this._sizesY[index]; - } - getSizeZ(index) { - return this._sizesZ[index]; - } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const isNormalized = options.isNormalized === undefined ? false : options.isNormalized; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const maxHeight = options.maxHeight === undefined ? 0 : options.maxHeight; - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - this._binIds = new Uint32Array(buffer.length); - this._binGroupIds = new Float64Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - this._binTotals = new Float64Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinTotal = 0; - let height; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - this._binIds[index] = binId; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - this._binTotals[binId] += options.sizes ? options.sizes[id] : 1; - maxBinTotal = Math.max(maxBinTotal, this._binTotals[binId]); - } - if (maxHeight - minHeight > 0) height = maxHeight - minHeight; - else height = Math.ceil(maxBinCount / sizeX / sizeZ); - if (!this._orderedIds || this._orderedIds.length < buffer.length) this._orderedIds = new Uint32Array(buffer.length); - let ids2; - if (options.groupIds || options.sizes) { - if (count == ids.length) this._ids = new Uint32Array(ids); - else { - this._ids = new Uint32Array(count); - for(let i = 0; i < count; i++)this._ids[i] = ids[offset + i]; - } - if (options.groupIds && options.sizes) { - this._ids.sort(function(a, b) { - return options.groupIds[a] == options.groupIds[b] ? options.sizes[a] - options.sizes[b] : options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.groupIds) { - this._ids.sort(function(a, b) { - return options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.sizes) { - this._ids.sort(function(a, b) { - return options.sizes[a] - options.sizes[b]; - }); - ids2 = this._ids; - } - } else ids2 = ids; - const binOffsets = new Uint32Array(this._binCounts.length); - let binOffset = 0; - for(let i = 0; i < this._binCounts.length; i++){ - const binCount = this._binCounts[i]; - binOffsets[i] = binOffset; - binOffset += binCount; - } - for(let i = 0; i < count; i++){ - const id = ids2[i]; - const index = lookup[id]; - const binId = this._binIds[index]; - binOffset = binOffsets[binId]++; - this._orderedIds[binOffset + offset] = id; - } - const minSliceHeight = this._core.config.minCubifiedTreeMapSlice * height; - const side = Math.sqrt(sizeX * sizeZ); - let from = offset; - let isLastInGroup = false; - let isLastInBin = false; - let groupCount = 0; - let groupTotal = 0; - let positionY = 0; - for(let i = 0; i < count; i++){ - const id = this._orderedIds[i + offset]; - const index = lookup[id]; - groupCount++; - groupTotal += options.sizes ? options.sizes[id] : 1; - const binId = this._binIds[index]; - const groupId = options.groupIds ? options.groupIds[id] : 0; - if (i == count - 1) { - isLastInBin = true; - isLastInGroup = true; - } else { - const nextId = this._orderedIds[i + 1 + offset]; - const nextIndex = lookup[nextId]; - const nextBinId = this._binIds[nextIndex]; - const nextGroupId = options.groupIds ? options.groupIds[nextId] : 0; - isLastInBin = binId != nextBinId; - isLastInGroup = groupId != nextGroupId; - } - if (isLastInBin || isLastInGroup) { - const mid = i + offset; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - let groupValue, binValue; - if (options.sizes) { - groupValue = groupTotal; - binValue = isNormalized ? this._binTotals[binId] : maxBinTotal; - } else { - groupValue = groupCount; - binValue = isNormalized ? this._binCounts[binId] : maxBinCount; - } - const groupHeight = height * groupValue / binValue; - if (sizeZ == 1) { - const positionX = spacingX / 2 + binIdX * (sizeX + spacingX); - (0, _treemapJs.TreeMapHelper).squarifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, from, mid, positionX, positionY, sizeX, groupHeight, lookup); - const isRightToLeft = true; - for(let i = from; i <= mid; i++){ - const id = this._orderedIds[i]; - const index = lookup[id]; - this._sizesZ[index] = sizeZ; - this._positionsZ[index] = (binIdZ + 0.5) * (sizeZ + spacingZ); - if (isRightToLeft) this._positionsX[index] = positionX + sizeX - this._positionsX[index] + positionX; - if (!isTopToBottom) this._positionsY[index] = positionY + groupHeight - this._positionsY[index] + positionY; - } - } else (0, _treemapJs.TreeMapHelper).cubifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, from, mid, spacingX / 2 + binIdX * (sizeX + spacingX), positionY, spacingZ / 2 + binIdZ * (sizeZ + spacingZ), sizeX, groupHeight, sizeZ, side, groupValue, minSliceHeight, isTopToBottom, lookup); - if (isLastInGroup) { - isLastInGroup = false; - positionY += groupHeight; - } - if (isLastInBin) { - isLastInBin = false; - positionY = 0; - } - groupCount = 0; - groupTotal = 0; - from = mid + 1; - } - } - this._maxCount = maxBinCount; - this._maxTotal = maxBinTotal; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); - } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"../constants.js":"lD0bG","../helpers/math.js":"f65d0","../vertex.js":"4J2YE","./treemap.js":"1HzJp","./layout.js":"kYBiT","gl-matrix":"5x28d","../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flmwt":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>(0, _keyboardJs.Keyboard)); -parcelHelpers.export(exports, "MouseWheel", ()=>(0, _mousewheelJs.MouseWheel)); -parcelHelpers.export(exports, "Pointers", ()=>(0, _pointersJs.Pointers)); -parcelHelpers.export(exports, "Manipulator", ()=>(0, _manipulatorJs.Manipulator)); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>(0, _manipulationprocessorJs.ManipulationProcessor)); -parcelHelpers.export(exports, "Manager", ()=>(0, _managerJs.Manager)); -var _keyboardJs = require("./keyboard.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _manipulatorJs = require("./manipulator.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _managerJs = require("./manager.js"); - -},{"./keyboard.js":"fXys0","./mousewheel.js":"dfHmP","./pointers.js":"7LFJO","./manipulator.js":"bYqKJ","./manipulationprocessor.js":"20HDq","./manager.js":"8nDg6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hACG3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>(0, _fileJs.LocalFile)); -parcelHelpers.export(exports, "XmlHttp", ()=>(0, _xmlHttpJs.XmlHttp)); -var _fileJs = require("./file.js"); -var _xmlHttpJs = require("./xmlHttp.js"); - -},{"./file.js":"kwLAM","./xmlHttp.js":"49880","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwLAM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>LocalFile); -class LocalFile { - constructor(core){} - loadText(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - completed(text); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsText(file); + get texCoord0() { + return this._texCoord0; } - loadImage(file, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - image.src = text; - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsDataURL(file); + set texCoord0(value2) { + if (!equals(this._texCoord0, value2)) { + copy$3(this._texCoord0, value2); + this._hasChanged = true; + } } - loadArrayBuffer(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const arrayBuffer = event.target.result; - completed(arrayBuffer); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsArrayBuffer(file); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49880":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "XmlHttp", ()=>XmlHttp); -class XmlHttp { - constructor(core){} - loadText(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.responseText); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } - loadImage(url, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - image.src = url; - } - loadArrayBuffer(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.responseType = "arraybuffer"; - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.response); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6XXZT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>(0, _quadJs.Quad)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Sphere", ()=>(0, _sphereJs.Sphere)); -var _quadJs = require("./quad.js"); -var _cubeJs = require("./cube.js"); -var _sphereJs = require("./sphere.js"); - -},{"./quad.js":"3PqJr","./cube.js":"79I5N","./sphere.js":"aj6T2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1IHvF":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererBase", ()=>(0, _rendererJs.RendererBase)); -parcelHelpers.export(exports, "Basic", ()=>_indexJs); -parcelHelpers.export(exports, "Advanced", ()=>_indexJs1); -parcelHelpers.export(exports, "RayTraceWebGPU", ()=>_indexJs2); -var _rendererJs = require("./renderer.js"); -var _indexJs = require("./basic/index.js"); -var _indexJs1 = require("./advanced/index.js"); -var _indexJs2 = require("./raytracewebgpu/index.js"); - -},{"./renderer.js":"8zmPQ","./basic/index.js":"fYCHg","./advanced/index.js":"gKCQy","./raytracewebgpu/index.js":"2SNte","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8zmPQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererConfig", ()=>RendererConfig); -parcelHelpers.export(exports, "RendererBase", ()=>RendererBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _axesJs = require("../components/axes/axes.js"); -var _bufferJs = require("../buffer.js"); -var _vertexJs = require("../vertex.js"); -var _labelsJs = require("../components/labels.js"); -var _debugJs = require("../components/debug.js"); -var _controllerJs = require("../components/controller.js"); -var _imageJs = require("../components/image.js"); -var _fontJs = require("../font.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + get texCoord1() { + return this._texCoord1; } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class RendererConfig { - reset() {} -} -class RendererBase { - get isInitialized() { - return this._isInitialized; + set texCoord1(value2) { + if (!equals(this._texCoord1, value2)) { + copy$3(this._texCoord1, value2); + this._hasChanged = true; + } } - get config() { - return this._config; + get minBoundsX() { + return this._minBoundsX; } - get devicePixelRatio() { - return this._devicePixelRatio; + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - get width() { - return this._canvas.width; + get minBoundsY() { + return this._minBoundsY; } - set width(value) { - this._options.width = value; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - get height() { - return this._canvas.height; + get minBoundsZ() { + return this._minBoundsZ; } - set height(value) { - this._options.height = value; + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - get webXRReferenceSpace() { - return this._webXRReferenceSpace; + get maxBoundsX() { + return this._maxBoundsX; } - get pickedType() { - return this._pickedType; + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - get pickedId() { - return this._pickedId; + get maxBoundsY() { + return this._maxBoundsY; } - get isCapturingPickImage() { - return this._isCapturingPickImage; + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - capturePickImage() { - this._isCapturingPickImage = true; + get maxBoundsZ() { + return this._maxBoundsZ; } - get backgroundColor() { - return this._backgroundColor; + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - set backgroundColor(value) { - if (!(0, _glMatrix.vec4).exactEquals(value, this._backgroundColor)) this._backgroundColor = value; + constructor(core, options2) { + this._core = core; + this._mMatrix = create$7(); + this._origin = create$6(); + this._translation = create$6(); + this._scale = create$6(); + this._transform = create$7(); + this._imageData = options2.imageData; + this._minBoundsX = options2.minBoundsX === void 0 ? 0 : options2.minBoundsX; + this._minBoundsY = options2.minBoundsY === void 0 ? 0 : options2.minBoundsY; + this._minBoundsZ = options2.minBoundsZ === void 0 ? 0 : options2.minBoundsZ; + this._maxBoundsX = options2.maxBoundsX === void 0 ? 1 : options2.maxBoundsX; + this._maxBoundsY = options2.maxBoundsY === void 0 ? 1 : options2.maxBoundsY; + this._maxBoundsZ = options2.maxBoundsZ === void 0 ? 1 : options2.maxBoundsZ; + this._position = options2.position ? clone$4(options2.position) : create$6(); + this._rotation = options2.rotation ? clone$2(options2.rotation) : create$4(); + this._texCoord0 = options2.texCoord0 ? clone$1(options2.texCoord0) : fromValues(0, 0); + this._texCoord1 = options2.texCoord1 ? clone$1(options2.texCoord1) : fromValues(1, 1); + this._material = options2.material === void 0 ? -1 : options2.material; + this._hasChanged = true; } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + }; + class ImageQuad extends ImageBase$1 { + get width() { + return this._width; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set width(value2) { + if (this._width != value2) { + this._width = value2; + this._hasChanged = true; + } } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + get height() { + return this._height; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set height(value2) { + if (this._height != value2) { + this._height = value2; + this._hasChanged = true; + } } - swapAxes() { - this._isAxes1Current = !this._isAxes1Current; + constructor(core, options2) { + super(core, options2); + this._width = options2.width === void 0 ? 1 : options2.width; + this._height = options2.height === void 0 ? 1 : options2.height; + this._texTransform = create$7(); + translate$2(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); + scale$6(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); } - createCartesian2dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + initialize() { + this._vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); + this._indices = Quad$3.INDICES; + this._indexCount = this._indices.length; + this._isInitialized = true; } - createCartesian3dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + set$8(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); + subtract(this._translation, this._position, this._origin); + scale$5(this._translation, this._translation, boundsScaling); + set$8(this._scale, this._width, this._height, 1); + scale$5(this._scale, this._scale, boundsScaling); + fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); + this._verticesView = Quad$3.normalTextured(this._transform, this._texTransform); + this._vertices = this._verticesView.buffer; + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + } } - _createDebugAxesVisual(debugAxes) { - return null; + } + class BoundsHelper { + static rotateBounds(minBounds, maxBounds, rotation2, rotatedMinBounds, rotatedMaxBounds, offset2) { + const sizeX = maxBounds[0] - minBounds[0]; + const sizeY = maxBounds[1] - minBounds[1]; + const sizeZ = maxBounds[2] - minBounds[2]; + const min2 = rotatedMinBounds; + const max2 = rotatedMaxBounds; + set$8(min2, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$8(max2, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const vertices = Cube.POSITIONS; + const position2 = create$6(); + for (let i = 0; i < 8; i++) { + set$8(position2, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); + add$4(position2, position2, offset2); + transformQuat(position2, position2, rotation2); + subtract(position2, position2, offset2); + min$3(min2, min2, position2); + max$3(max2, max2, position2); + } + add$4(position2, minBounds, maxBounds); + scale$5(position2, position2, 0.5); + add$4(min2, min2, position2); + add$4(max2, max2, position2); + } + static cylinder(pa2, pb, radius2, minBounds, maxBounds) { + const a2 = create$6(); + subtract(a2, pb, pa2); + const aa = dot$1(a2, a2); + const ex = radius2 * Math.sqrt(1 - a2[0] * a2[0] / aa); + const ey = radius2 * Math.sqrt(1 - a2[1] * a2[1] / aa); + const ez = radius2 * Math.sqrt(1 - a2[2] * a2[2] / aa); + minBounds[0] = Math.min(pa2[0] - ex, pb[0] - ex); + minBounds[1] = Math.min(pa2[1] - ey, pb[1] - ey); + minBounds[2] = Math.min(pa2[2] - ez, pb[2] - ez); + maxBounds[0] = Math.max(pa2[0] + ex, pb[0] + ex); + maxBounds[1] = Math.max(pa2[1] + ey, pb[1] + ey); + maxBounds[2] = Math.max(pa2[2] + ez, pb[2] + ez); } - createLabelSetVisual(labelSet) { - return new (0, _labelsJs.LabelSetVisual)(labelSet); + } + class LayoutBase { + get facetScaling() { + return this._facetScaling; } - createControllerVisual(controller) { - return new (0, _controllerJs.ControllerVisual)(controller); + offsetX(facetCoordX) { + return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; } - createTransitionBuffer(ids) { - return new (0, _bufferJs.TransitionBuffer)(this._core, ids); + offsetY(facetCoordY) { + return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; } - createImageVisual(image) { - return new (0, _imageJs.ImageVisual)(image); + offsetZ(facetCoordZ) { + return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; + } + constructor(core) { + this._core = core; + this.modelOriginX = 0; + this.modelOriginY = 0; + this.modelOriginZ = 0; + this.minModelBoundsX = 0; + this.minModelBoundsY = 0; + this.minModelBoundsZ = 0; + this.maxModelBoundsX = 0; + this.maxModelBoundsY = 0; + this.maxModelBoundsZ = 0; + this.minLayoutBoundsX = 0; + this.minLayoutBoundsY = 0; + this.minLayoutBoundsZ = 0; + this.maxLayoutBoundsX = 0; + this.maxLayoutBoundsY = 0; + this.maxLayoutBoundsZ = 0; + this._facetSpacingX = 0; + this._facetSpacingY = 0; + this._facetSpacingZ = 0; + this._facetSizeX = 0; + this._facetSizeY = 0; + this._facetSizeZ = 0; + this._facetsX = 1; + this._facetsY = 1; + this._facetsZ = 1; + } + _updateModelBounds(options2) { + this.minModelBoundsX = options2.minBoundsX === void 0 ? this.minLayoutBoundsX : options2.minBoundsX; + this.minModelBoundsY = options2.minBoundsY === void 0 ? this.minLayoutBoundsY : options2.minBoundsY; + this.minModelBoundsZ = options2.minBoundsZ === void 0 ? this.minLayoutBoundsZ : options2.minBoundsZ; + this.maxModelBoundsX = options2.maxBoundsX === void 0 ? this.maxLayoutBoundsX : options2.maxBoundsX; + this.maxModelBoundsY = options2.maxBoundsY === void 0 ? this.maxLayoutBoundsY : options2.maxBoundsY; + this.maxModelBoundsZ = options2.maxBoundsZ === void 0 ? this.maxLayoutBoundsZ : options2.maxBoundsZ; + this._isFacetted = options2.facetsX !== void 0 && options2.facetsX > 1 && options2.facetCoordsX != null || options2.facetsY !== void 0 && options2.facetsY > 1 && options2.facetCoordsY != null || options2.facetsZ !== void 0 && options2.facetsZ > 1 && options2.facetCoordsZ != null; + this._facetSpacingX = options2.facetSpacingX === void 0 ? 0 : options2.facetSpacingX; + this._facetSpacingY = options2.facetSpacingY === void 0 ? 0 : options2.facetSpacingY; + this._facetSpacingZ = options2.facetSpacingZ === void 0 ? 0 : options2.facetSpacingZ; + let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._facetSizeX = modelSizeX; + this._facetSizeY = modelSizeY; + this._facetSizeZ = modelSizeZ; + this._facetsX = options2.facetCoordsX ? options2.facetsX : 1; + this._facetsY = options2.facetCoordsY ? options2.facetsY : 1; + this._facetsZ = options2.facetCoordsZ ? options2.facetsZ : 1; + this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; + this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; + this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; + this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); + this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); + this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); + this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; + this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; + this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; + modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; + this._facetScaling = maxBounds / this._maxBounds; } - createFontVisual(font) { - return new (0, _fontJs.FontVisual)(font); + resetCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = void 0; + this.minCumulativeLayoutBoundsY = void 0; + this.minCumulativeLayoutBoundsZ = void 0; + this.maxCumulativeLayoutBoundsX = void 0; + this.maxCumulativeLayoutBoundsY = void 0; + this.maxCumulativeLayoutBoundsZ = void 0; } - constructor(options){ - this._options = options; - this.fonts = {}; + _updateCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === void 0 ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); + this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === void 0 ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); + this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === void 0 ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); + this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === void 0 ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); + this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === void 0 ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); + this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === void 0 ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); } - get isWebXRSupported() { - return false; + unitToModelSize(unitSize) { + return unitSize / this._boundsScaling; } - initialize(core) { - this._core = core; - this._canvas = document.createElement("canvas"); - const contextmenu = this._options && this._options.contextmenu; - if (!contextmenu) this._canvas.addEventListener("contextmenu", (e)=>{ - e.preventDefault(); - }); - this._canvas.tabIndex = this._core.container.tabIndex; - this._canvas.style.display = "block"; - this._canvas.style.touchAction = "none"; - this._core.container.appendChild(this._canvas); - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this.pickPMatrix = (0, _glMatrix.mat4).create(); - this.axesVisibility = (0, _mainJs.AxesVisibility).current; - this._debugAxes = new (0, _debugJs.DebugAxes)(); - this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); - this.transitionTime = 1; - this.transitionBuffers = []; - this.areLabelsVisible = true; - this.labelSets = []; - this.controllers = []; - this.areImagesVisible = true; - this.images = []; - this._viewports = [ - new DOMRect(), - new DOMRect() - ]; - this.isPickingEnabled = false; - this._pickedType = (0, _mainJs.PickType).none; - this._pickedId = 0; - this._lassoMMatrix = (0, _glMatrix.mat4).create(); - this._lassoThickness = (0, _glMatrix.vec2).create(); - this._resizeMinimumDelay = -1; - this._previousResizeWidth = -1; - this._previousResizeHeight = -1; + unitToModelPositionX(unitPositionX) { + return this.unitToModelSize(unitPositionX) + this.modelOriginX; } - remove() { - this._core.container.removeChild(this._canvas); + unitToModelPositionY(unitPositionY) { + return this.unitToModelSize(unitPositionY) + this.modelOriginY; } - finalize() { - this._isInitialized = false; + unitToModelPositionZ(unitPositionZ) { + return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; } - setSize(elapsedTime) { - if (this._options && this._options.width && this._options.height) { - this._devicePixelRatio = 1; - this._resizeWidth = this._options.width; - this._resizeHeight = this._options.height; - } else { - this._devicePixelRatio = window.devicePixelRatio || 1; - this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; - this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; - } - if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { - this._previousResizeWidth = this._resizeWidth; - this._previousResizeHeight = this._resizeHeight; - this._isResizing = true; - this._resizeElapsedTime = elapsedTime; - } - if (this._isResizing) { - if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { - this._isResizing = false; - this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; - this._resize(this._resizeWidth, this._resizeHeight); - } else this._resizeElapsedTime += elapsedTime; - } - } - _resize(width, height) { - this._canvas.style.width = `${Math.floor(width / this._devicePixelRatio)}px`; - this._canvas.style.height = `${Math.floor(height / this._devicePixelRatio)}px`; - width = Math.floor(width); - height = Math.floor(height); - this._canvas.width = width; - this._canvas.height = height; + unitToModelPosition(unitPosition, modelPosition) { + modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); + modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); + modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); } - update(elapsedTime) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousPalette; - const current = transitionBuffer.currentPalette; - if (previous) previous.update(); - if (current) current.update(); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousAtlas; - const current = transitionBuffer.currentAtlas; - if (previous) previous.update(); - if (current) current.update(); - } - } - if (this._core.config.isDebugVisible) { - if (this._debugAxesVisual) { - this._debugAxesVisual.mMatrix = this.mMatrix; - this._debugAxesVisual.vMatrices = this.vMatrices; - this._debugAxesVisual.pMatrices = this.pMatrices; - this._debugAxesVisual.viewports = this._viewports; - this._debugAxesVisual.viewportOffset = this._viewportOffset; - this._debugAxesVisual.viewportCount = this._viewportCount; - } + modelToUnitSize(modelSize) { + return modelSize * this._boundsScaling; + } + modelToUnitPositionX(modelPositionX) { + return (modelPositionX - this.modelOriginX) * this._boundsScaling; + } + modelToUnitPositionY(modelPositionY) { + return (modelPositionY - this.modelOriginY) * this._boundsScaling; + } + modelToUnitPositionZ(modelPositionZ) { + return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + } + modelToUnitPosition(modelPosition, unitPosition) { + unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); + unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); + unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); + } + inclusiveUnitBounds(buffer, ids, unitType, offset2, count2, minBounds, maxBounds) { + set$8(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$8(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const unitScale = create$6(); + const unitRotation = create$4(); + const unitTranslation = create$6(); + const lookup2 = buffer.lookup; + const dataView = buffer.dataView; + let minBounds0; + let maxBounds0; + let minBounds1; + let maxBounds1; + switch (unitType) { + case UnitType.sphere: + case UnitType.sphereSdf: + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getScale(dataView, index2, unitScale); + const radius2 = unitScale[0] / 2; + minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius2); + minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius2); + minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius2); + maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius2); + maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius2); + maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius2); + } + break; + case UnitType.hexPrism: + case UnitType.hexPrismSdf: + case UnitType.block: + case UnitType.blockSdf: + minBounds0 = create$6(); + maxBounds0 = create$6(); + minBounds1 = create$6(); + maxBounds1 = create$6(); + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; + minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; + minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; + maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; + maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; + maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; + BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants$1.VECTOR3_ZERO); + min$3(minBounds, minBounds, minBounds1); + max$3(maxBounds, maxBounds, maxBounds1); + } + break; + case UnitType.cylinder: + case UnitType.cylinderSdf: + minBounds0 = create$6(); + maxBounds0 = create$6(); + const pa2 = create$6(); + const pb = create$6(); + const identityRotation = Constants$1.VECTOR3_UNITY; + let ca; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + const length2 = unitScale[1]; + const radius2 = Math.max(unitScale[0], unitScale[2]); + if (length2 != 0 && radius2 != 0) { + if (equals$1(unitRotation, Constants$1.QUAT_IDENTITY)) { + ca = identityRotation; + } else { + ca = create$6(); + transformQuat(ca, identityRotation, unitRotation); + } + scaleAndAdd(pa2, unitTranslation, ca, -length2 * 0.5); + scaleAndAdd(pb, unitTranslation, ca, length2 * 0.5); + BoundsHelper.cylinder(pa2, pb, radius2, minBounds0, maxBounds0); + min$3(minBounds, minBounds, minBounds0); + max$3(maxBounds, maxBounds, maxBounds0); + } + } + break; + } + } + } + class Scatter extends LayoutBase { + layout(buffer, ids, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const positionScalingX = options2.positionScalingX === void 0 ? 1 : options2.positionScalingX; + const positionScalingY = options2.positionScalingY === void 0 ? 1 : options2.positionScalingY; + const positionScalingZ = options2.positionScalingZ === void 0 ? 1 : options2.positionScalingZ; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = options2.positionsX ? options2.positionsX[id2] * positionScalingX : 0; + let positionY = options2.positionsY ? options2.positionsY[id2] * positionScalingY : 0; + let positionZ = options2.positionsZ ? options2.positionsZ[id2] * positionScalingZ : 0; + this._positions[index2 * 3] = positionX; + this._positions[index2 * 3 + 1] = positionY; + this._positions[index2 * 3 + 2] = positionZ; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const dataView = buffer.dataView; + const _vec2 = create$3(); + const _vec3 = create$6(); + const _vec4 = create$5(); + const _quat = create$4(); + const sizeScalingX = options2.sizeScaling === void 0 ? options2.sizeScalingX === void 0 ? 1 : options2.sizeScalingX : options2.sizeScaling; + const sizeScalingY = options2.sizeScaling === void 0 ? options2.sizeScalingY === void 0 ? 1 : options2.sizeScalingY : options2.sizeScaling; + const sizeScalingZ = options2.sizeScaling === void 0 ? options2.sizeScalingZ === void 0 ? 1 : options2.sizeScalingZ : options2.sizeScaling; + const sizesX = options2.sizes ? options2.sizes : options2.sizesX; + const sizesY = options2.sizes ? options2.sizes : options2.sizesY; + const sizesZ = options2.sizes ? options2.sizes : options2.sizesZ; + const minSize = options2.minSize === void 0 ? 0 : options2.minSize; + const minColor = options2.minColor === void 0 ? 0 : options2.minColor; + const maxColor = options2.maxColor === void 0 ? 1 : options2.maxColor; + const minOrder = options2.minOrder === void 0 ? 0 : options2.minOrder; + const maxOrder = options2.maxOrder === void 0 ? 1 : options2.maxOrder; + const orderReverse = options2.orderReverse === void 0 ? false : options2.orderReverse; + const minStaggerOrder = options2.minStaggerOrder === void 0 ? 0 : options2.minStaggerOrder; + const maxStaggerOrder = options2.maxStaggerOrder === void 0 ? 1 : options2.maxStaggerOrder; + const staggerOrderReverse = options2.staggerOrderReverse === void 0 ? false : options2.staggerOrderReverse; + const reverseX = options2.reverseX === void 0 ? false : options2.reverseX; + const reverseY = options2.reverseY === void 0 ? false : options2.reverseY; + const reverseZ = options2.reverseZ === void 0 ? false : options2.reverseZ; + this._updateModelBounds(options2); + if (options2.rotation) { + _quat[0] = options2.rotation[0]; + _quat[1] = options2.rotation[1]; + _quat[2] = options2.rotation[2]; + _quat[3] = options2.rotation[3]; + } else { + rotationTo(_quat, this._core.config.identityRotation, Constants$1.VECTOR3_UNITY); + } + if (options2.texCoord) { + _vec4[0] = options2.texCoord[0]; + _vec4[1] = options2.texCoord[1]; + _vec4[2] = options2.texCoord[2]; + _vec4[3] = options2.texCoord[3]; + } + const lookup2 = buffer.lookup; + const selection = options2.selected && options2.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options2.facetCoordsX ? options2.facetCoordsX[id2] : 0; + const facetY = options2.facetCoordsY ? options2.facetCoordsY[id2] : 0; + const facetZ = options2.facetCoordsZ ? options2.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id2]) : 1) * sizeScalingX, minSize) * this._boundsScaling; + _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id2]) : 1) * sizeScalingY, minSize) * this._boundsScaling; + _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id2]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + if (options2.rotations) { + _quat[0] = options2.rotations[id2 * 4]; + _quat[1] = options2.rotations[id2 * 4 + 1]; + _quat[2] = options2.rotations[id2 * 4 + 2]; + _quat[3] = options2.rotations[id2 * 4 + 3]; + UnitVertex.setRotation(dataView, index2, _quat); + } else { + UnitVertex.setRotation(dataView, index2, _quat); + } + if (options2.colors) { + const size = 1 / (maxColor - minColor + 1); + const color2 = MathHelper.normalize(options2.colors[id2], minColor, maxColor, size / 2, 1 - size / 2); + if (options2.colors1) { + const color1 = MathHelper.normalize(options2.colors1[id2], minColor, maxColor, size / 2, 1 - size / 2); + set$5(_vec2, color2, color1); + } else { + set$5(_vec2, color2, color2); + } + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants$1.VECTOR2_ONE); } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - this.labelSets[i].label.update(elapsedTime); - labelSetVisual.mMatrix = this.mMatrix; - labelSetVisual.vMatrices = this.vMatrices; - labelSetVisual.pMatrices = this.pMatrices; - labelSetVisual.isPickingEnabled = this.isPickingEnabled; - labelSetVisual.pickPMatrix = this.pickPMatrix; - labelSetVisual.pickVMatrix = this.pickVMatrix; - labelSetVisual.viewports = this._viewports; - labelSetVisual.viewportOffset = this._viewportOffset; - labelSetVisual.viewportCount = this._viewportCount; - labelSetVisual.update(elapsedTime); - } + UnitVertex.setIdHover(dataView, index2, options2.hover ? options2.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options2.selected.has(id2) ? 1 : -1 : 0); + if (options2.order !== void 0) { + const order = MathHelper.normalize(options2.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual && imageVisual.isVisible) { - const image = this.images[i].image; - image.update(elapsedTime); - imageVisual.mMatrix = this.mMatrix; - imageVisual.vMatrices = this.vMatrices; - imageVisual.pMatrices = this.pMatrices; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.pickPMatrix = this.pickPMatrix; - imageVisual.pickVMatrix = this.pickVMatrix; - imageVisual.viewports = this._viewports; - imageVisual.viewportOffset = this._viewportOffset; - imageVisual.viewportCount = this._viewportCount; - imageVisual.update(elapsedTime); - } + if (options2.staggerOrder !== void 0) { + _vec2[1] = options2.staggerOrder; + } else if (options2.staggerOrders) { + const stagger = MathHelper.normalize(options2.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options2.material ? options2.material : options2.materials ? options2.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options2.rounding ? options2.rounding * this._boundsScaling : options2.roundings ? options2.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setParameter1(dataView, index2, options2.parameter1 ? options2.parameter1 : options2.parameters1 ? options2.parameters1[id2] : 0); + UnitVertex.setParameter2(dataView, index2, options2.parameter2 ? options2.parameter2 : options2.parameters2 ? options2.parameters2[id2] : 0); + UnitVertex.setSdfBuffer(dataView, index2, options2.sdfBuffer ? options2.sdfBuffer : options2.sdfBuffers ? options2.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options2.sdfBorder ? options2.sdfBorder : options2.sdfBorders ? options2.sdfBorders[id2] : this._core.config.sdfBorder); + if (options2.texCoords) { + _vec4[0] = options2.texCoords[id2 * 4]; + _vec4[1] = options2.texCoords[id2 * 4 + 1]; + _vec4[2] = options2.texCoords[id2 * 4 + 2]; + _vec4[3] = options2.texCoords[id2 * 4 + 3]; + UnitVertex.setTexCoord(dataView, index2, _vec4); + } else { + UnitVertex.setTexCoord(dataView, index2, _vec4); + } + UnitVertex.setMatId(dataView, index2, options2.materialType ? options2.materialType : options2.materialTypes ? options2.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options2.materialColor ? options2.materialColor : options2.materialColors ? [options2.materialColors[id2 * 3], options2.materialColors[id2 * 3 + 1], options2.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options2.materialFuzz ? options2.materialFuzz : options2.materialFuzzes ? options2.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options2.materialGloss ? options2.materialGloss : options2.materialGlosses ? options2.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options2.materialDensity ? options2.materialDensity : options2.materialDensities ? options2.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options2.materialRefractiveIndex ? options2.materialRefractiveIndex : options2.materialRefractiveIndices ? options2.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options2.segmentColor ? options2.segmentColor : options2.segmentColors ? [options2.segmentColors[id2 * 4], options2.segmentColors[id2 * 4 + 1], options2.segmentColors[id2 * 4 + 2], options2.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + } + fromValues$3(0.2126, 0.7152, 0.0722); + create$6(); + create$6(); + class PathHelper { + static getFilenameWithoutExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") == -1 ? 0 : path2.lastIndexOf("/") + 1; + return path2.substring(start, dot2); + } + } + static getExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1 || dot2 == path2.length - 1) { + return null; + } else { + return path2.substring(dot2 + 1, path2.length); + } + } + static getFilename(path2) { + if (path2.lastIndexOf("/") == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") + 1; + return path2.substring(start, path2.length); + } + } + static getPath(path2) { + if (path2.lastIndexOf("/") == -1) { + return ""; + } else { + return path2.substring(0, path2.lastIndexOf("/")); + } + } + static combine(first, second2) { + const seperator = first.lastIndexOf("/") == first.length - 1; + if (second2.indexOf("/") == 0) { + if (seperator) { + return first.substring(0, first.length - 1) + second2; + } else { + return first + second2; } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - const controller = this.controllers[i].controller; - controller.update(elapsedTime); - controllerVisual.vMatrices = this.vMatrices; - controllerVisual.inverseVMatrices = this.vMatrices; - controllerVisual.pMatrices = this.pMatrices; - controllerVisual.viewports = this._viewports; - controllerVisual.viewportOffset = this._viewportOffset; - controllerVisual.viewportCount = this._viewportCount; - controllerVisual.update(elapsedTime); - } + } else { + if (seperator) { + return first + second2; + } else { + return first + "/" + second2; } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - const axes = axesVisual.axes; - axes.mMatrix = this.mMatrix; - axes.vMatrix = this.vMatrices[0]; - axes.update(elapsedTime); - axesVisual.vMatrices = this.vMatrices; - axesVisual.pMatrices = this.pMatrices; - axesVisual.isPickingEnabled = this.isPickingEnabled; - axesVisual.pickPMatrix = this.pickPMatrix; - axesVisual.pickVMatrix = this.pickVMatrix; - axesVisual.viewports = this._viewports; - axesVisual.viewportOffset = this._viewportOffset; - axesVisual.viewportCount = this._viewportCount; - axesVisual.update(elapsedTime); - } + } + } + } + class TextureHelper { + static create(gl, width2, height2, format2, type2, filter2, bytes, internalFormat = format2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width2, height2, 0, format2, type2, bytes); + return texture; + } + static fromImage(gl, image2, mipmaps, filter2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image2); + if (mipmaps && MathHelper.isPowerOf2(image2.width) && MathHelper.isPowerOf2(image2.height)) + gl.generateMipmap(gl.TEXTURE_2D); + else { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + } + gl.bindTexture(gl.TEXTURE_2D, null); + return texture; + } + static cubemapFromImages(gl, images) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + const targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (let i = 0; i < 6; i++) { + gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + return texture; + } + } + class Line extends LayoutBase { + layout(buffer, ids, fromIds, toIds, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const positionScalingX = options2.positionScalingX === void 0 ? 1 : options2.positionScalingX; + const positionScalingY = options2.positionScalingY === void 0 ? 1 : options2.positionScalingY; + const positionScalingZ = options2.positionScalingZ === void 0 ? 1 : options2.positionScalingZ; + const sizeScalingX = options2.sizeScaling === void 0 ? options2.sizeScalingX === void 0 ? 1 : options2.sizeScalingX : options2.sizeScaling; + const sizeScalingY = options2.sizeScaling === void 0 ? options2.sizeScalingY === void 0 ? 1 : options2.sizeScalingY : options2.sizeScaling; + const sizeScalingZ = options2.sizeScaling === void 0 ? options2.sizeScalingZ === void 0 ? 1 : options2.sizeScalingZ : options2.sizeScaling; + const minSize = options2.minSize === void 0 ? 0 : options2.minSize; + const offsetScaling = options2.offsetScaling === void 0 ? 1 : options2.offsetScaling; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + this._sizes = new Float32Array(buffer.length * 3); + this._rotations = new Float32Array(buffer.length * 4); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const _vec3 = create$6(); + const _quat = create$4(); + const direction = create$6(); + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let toPositionX = options2.positionsX ? options2.positionsX[toId] * positionScalingX : 0; + let toPositionY = options2.positionsY ? options2.positionsY[toId] * positionScalingY : 0; + let toPositionZ = options2.positionsZ ? options2.positionsZ[toId] * positionScalingZ : 0; + let fromPositionX = options2.positionsX ? options2.positionsX[fromId] * positionScalingX : 0; + let fromPositionY = options2.positionsY ? options2.positionsY[fromId] * positionScalingY : 0; + let fromPositionZ = options2.positionsZ ? options2.positionsZ[fromId] * positionScalingZ : 0; + if (fromId == toId) { + this._sizes[index2 * 3] = 0; + this._sizes[index2 * 3 + 1] = 0; + this._sizes[index2 * 3 + 2] = 0; + this._rotations[index2 * 4] = 0; + this._rotations[index2 * 4 + 1] = 0; + this._rotations[index2 * 4 + 2] = 0; + this._rotations[index2 * 4 + 3] = 1; + } else { + direction[0] = toPositionX - fromPositionX; + direction[1] = toPositionY - fromPositionY; + direction[2] = toPositionZ - fromPositionZ; + let length2 = length$1(direction); + scale$5(direction, direction, 1 / length2); + rotationTo(_quat, this._core.config.identityRotation, direction); + this._rotations[index2 * 4] = _quat[0]; + this._rotations[index2 * 4 + 1] = _quat[1]; + this._rotations[index2 * 4 + 2] = _quat[2]; + this._rotations[index2 * 4 + 3] = _quat[3]; + if (options2.offsets) { + const fromOffset = options2.offsets[fromId] * offsetScaling / 2; + const toOffset = options2.offsets[toId] * offsetScaling / 2; + toPositionX -= direction[0] * toOffset; + toPositionY -= direction[1] * toOffset; + toPositionZ -= direction[2] * toOffset; + fromPositionX += direction[0] * fromOffset; + fromPositionY += direction[1] * fromOffset; + fromPositionZ += direction[2] * fromOffset; + length2 = Math.max(length2 - toOffset - fromOffset, minSize); + } + this._sizes[index2 * 3 + 1] = Math.max(length2 * sizeScalingY, minSize); + if (options2.lineSizes) { + this._sizes[index2 * 3] = Math.max(options2.lineSizes[id2] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options2.lineSizes[id2] * sizeScalingZ, minSize); + } else if (options2.endSizes) { + this._sizes[index2 * 3] = Math.max(options2.endSizes[fromId] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options2.endSizes[toId] * sizeScalingZ, minSize); + } else { + this._sizes[index2 * 3] = sizeScalingX; + this._sizes[index2 * 3 + 2] = sizeScalingZ; + } + } + _vec3[0] = (fromPositionX + toPositionX) / 2; + _vec3[1] = (fromPositionY + toPositionY) / 2; + _vec3[2] = (fromPositionZ + toPositionZ) / 2; + this._positions[index2 * 3] = _vec3[0]; + this._positions[index2 * 3 + 1] = _vec3[1]; + this._positions[index2 * 3 + 2] = _vec3[2]; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, fromIds, toIds, options2) { + const start = window.performance.now(); + const offset2 = options2.offset === void 0 ? 0 : options2.offset; + const count2 = options2.count === void 0 ? ids.length : options2.count; + const dataView = buffer.dataView; + const _vec2 = create$3(); + const _vec3 = create$6(); + const _quat = create$4(); + const endMinColor = options2.endMinColor === void 0 ? 0 : options2.endMinColor; + const endMaxColor = options2.endMaxColor === void 0 ? 1 : options2.endMaxColor; + const lineMinColor = options2.lineMinColor === void 0 ? 0 : options2.lineMinColor; + const lineMaxColor = options2.lineMaxColor === void 0 ? 1 : options2.lineMaxColor; + const minOrder = options2.minOrder === void 0 ? 0 : options2.minOrder; + const maxOrder = options2.maxOrder === void 0 ? 1 : options2.maxOrder; + const orderReverse = options2.orderReverse === void 0 ? false : options2.orderReverse; + const minStaggerOrder = options2.minStaggerOrder === void 0 ? 0 : options2.minStaggerOrder; + const maxStaggerOrder = options2.maxStaggerOrder === void 0 ? 1 : options2.maxStaggerOrder; + const staggerOrderReverse = options2.staggerOrderReverse === void 0 ? false : options2.staggerOrderReverse; + const reverseX = options2.reverseX === void 0 ? false : options2.reverseX; + const reverseY = options2.reverseY === void 0 ? false : options2.reverseY; + const reverseZ = options2.reverseZ === void 0 ? false : options2.reverseZ; + this._updateModelBounds(options2); + const lookup2 = buffer.lookup; + const selection = options2.selected && options2.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options2.facetCoordsX ? options2.facetCoordsX[id2] : 0; + const facetY = options2.facetCoordsY ? options2.facetCoordsY[id2] : 0; + const facetZ = options2.facetCoordsZ ? options2.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = this._sizes[index2 * 3] * this._boundsScaling; + _vec3[1] = this._sizes[index2 * 3 + 1] * this._boundsScaling; + _vec3[2] = this._sizes[index2 * 3 + 2] * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + _quat[0] = this._rotations[index2 * 4]; + _quat[1] = this._rotations[index2 * 4 + 1]; + _quat[2] = this._rotations[index2 * 4 + 2]; + _quat[3] = this._rotations[index2 * 4 + 3]; + if (reverseX) { + _quat[1] = -_quat[1]; + _quat[2] = -_quat[2]; + } + if (reverseY) { + _quat[0] = -_quat[0]; + _quat[2] = -_quat[2]; + } + if (reverseZ) { + _quat[0] = -_quat[0]; + _quat[1] = -_quat[1]; + } + UnitVertex.setRotation(dataView, index2, _quat); + let size; + if (options2.endColors) { + size = 1 / (endMaxColor - endMinColor + 1); + const fromColor = MathHelper.normalize(options2.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + const toColor = MathHelper.normalize(options2.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + set$5(_vec2, fromColor, toColor); + UnitVertex.setColor(dataView, index2, _vec2); + } else if (options2.lineColors) { + size = 1 / (lineMaxColor - lineMinColor + 1); + const color2 = MathHelper.normalize(options2.lineColors[id2], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); + set$5(_vec2, color2, color2); + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants$1.VECTOR2_ONE); } - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - const font = fontVisual.font; - font.update(); - fontVisual.update(); - } - } - getVertexPosition(position, pickedId) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[pickedId]; - if (id > -1) { - const index = transitionBuffer.currentBuffer.lookup[id]; - const dataView = transitionBuffer.currentBuffer.dataView; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, position); - break; - } + UnitVertex.setIdHover(dataView, index2, options2.hover ? options2.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options2.selected.has(id2) ? 1 : -1 : 0); + if (options2.order !== void 0) { + const order = MathHelper.normalize(options2.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); } + if (options2.staggerOrder !== void 0) { + _vec2[1] = options2.staggerOrder; + } else if (options2.staggerOrders) { + const stagger = MathHelper.normalize(options2.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options2.material ? options2.material : options2.materials ? options2.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options2.rounding ? options2.rounding * this._boundsScaling : options2.roundings ? options2.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setSdfBuffer(dataView, index2, options2.sdfBuffer ? options2.sdfBuffer : options2.sdfBuffers ? options2.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options2.sdfBorder ? options2.sdfBorder : options2.sdfBorders ? options2.sdfBorders[id2] : this._core.config.sdfBorder); + UnitVertex.setMatId(dataView, index2, options2.materialType ? options2.materialType : options2.materialTypes ? options2.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options2.materialColor ? options2.materialColor : options2.materialColors ? [options2.materialColors[id2 * 3], options2.materialColors[id2 * 3 + 1], options2.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options2.materialFuzz ? options2.materialFuzz : options2.materialFuzzes ? options2.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options2.materialGloss ? options2.materialGloss : options2.materialGlosses ? options2.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options2.materialDensity ? options2.materialDensity : options2.materialDensities ? options2.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options2.materialRefractiveIndex ? options2.materialRefractiveIndex : options2.materialRefractiveIndices ? options2.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options2.segmentColor ? options2.segmentColor : options2.segmentColors ? [options2.segmentColors[id2 * 4], options2.segmentColors[id2 * 4 + 1], options2.segmentColors[id2 * 4 + 2], options2.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() {}); + } + class AtlasBase { + get imageData() { + return this._imageData; } - prepare(xrFrame) {} - initializeWebXR(session) { - return null; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._changed = true; + } + } + constructor() { + this._imageData = null; + } + copyFrom(atlas) { + if (atlas.imageData) { + this._imageData = atlas.imageData; + this._changed = true; + } else { + this.imageData = null; + } } -} - -},{"gl-matrix":"5x28d","../main.js":"f421K","../components/axes/axes.js":"8Tmim","../buffer.js":"itbJk","../vertex.js":"4J2YE","../components/labels.js":"PwNrz","../components/debug.js":"bBVbT","../components/controller.js":"f5tIG","../components/image.js":"kwtZG","../font.js":"ibkbS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"itbJk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BufferBase", ()=>BufferBase); -parcelHelpers.export(exports, "TransitionBufferBase", ()=>TransitionBufferBase); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _paletteJs = require("./palette.js"); -var _vertexJs = require("./vertex.js"); -var _pickJs = require("./helpers/pick.js"); -var _mainJs = require("./main.js"); -var _atlasJs = require("./atlas.js"); -class BufferBase { + update() { + } + } + let Atlas$2 = class Atlas extends AtlasBase { + }; + class BufferBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get ids() { - return this._ids; + return this._ids; } get dataView() { - return this._dataView; + return this._dataView; } get vertices() { - return this._vertices; + return this._vertices; } get lookup() { - return this._lookup; + return this._lookup; } get length() { - return this._length; + return this._length; } get selected() { - return this._selected; - } - constructor(core, ids){ - this._core = core; - this._ids = ids; - this._length = ids.length; - this._vertices = new ArrayBuffer(this._length * (0, _vertexJs.UnitVertex).SIZE_BYTES); - this._dataView = new DataView(this._vertices); - this._selected = new Set(); - this.from = 0; - this.to = 1; - this.unitType = (0, _mainJs.UnitType).block; - this._lookup = {}; - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - this._lookup[id] = i; - (0, _vertexJs.UnitVertex).setRotation(this._dataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } + return this._selected; + } + constructor(core, ids) { + this._core = core; + this._ids = ids; + this._length = ids.length; + this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); + this._dataView = new DataView(this._vertices); + this._selected = /* @__PURE__ */ new Set(); + this.from = 0; + this.to = 1; + this.unitType = UnitType.block; + this._lookup = {}; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + this._lookup[id2] = i; + UnitVertex.setRotation(this._dataView, i, Constants$1.QUAT_IDENTITY); + } } createShared() { - const buffer = Object.create(this); - buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); - buffer._dataView = new DataView(buffer._vertices); - return buffer; + const buffer = Object.create(this); + buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); + buffer._dataView = new DataView(buffer._vertices); + return buffer; } copyFrom(buffer) { - const start = window.performance.now(); - const fromDataView = buffer.dataView; - const toDataView = this._dataView; - const lookup = buffer.lookup; - for(let i = 0; i < this._length; i++){ - const index = lookup[this._ids[i]]; - if (index != null) { - (0, _vertexJs.UnitVertex).copyIdHover(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTranslation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyScale(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRotation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyColor(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySelected(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyMaterial(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRounding(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyOrder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexCoord(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexture(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBuffer(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBorder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter1(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter2(fromDataView, index, toDataView, i); - } else (0, _vertexJs.UnitVertex).setRotation(toDataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } - this.unitType = buffer.unitType; - this._selected = buffer.selected; - this._core.log.write((0, _mainJs.LogLevel).info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - update() {} - updateSelection(options) { - const start = window.performance.now(); - const ids = options && options.ids ? options.ids : this._ids; - const offset = options && options.offset !== undefined ? options.offset : 0; - const count = options && options.count !== undefined ? options.count : ids.length; - const selection = this._selected.size > 0; - const dataView = this._dataView; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = this._lookup[id]; - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? this._selected.has(id) ? 1 : -1 : 0); - } - this.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer update selection ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TransitionBufferBase { + const start = window.performance.now(); + const fromDataView = buffer.dataView; + const toDataView = this._dataView; + const lookup2 = buffer.lookup; + for (let i = 0; i < this._length; i++) { + const index2 = lookup2[this._ids[i]]; + if (index2 != null) { + UnitVertex.copyIdHover(fromDataView, index2, toDataView, i); + UnitVertex.copyTranslation(fromDataView, index2, toDataView, i); + UnitVertex.copyScale(fromDataView, index2, toDataView, i); + UnitVertex.copyRotation(fromDataView, index2, toDataView, i); + UnitVertex.copyColor(fromDataView, index2, toDataView, i); + UnitVertex.copySelected(fromDataView, index2, toDataView, i); + UnitVertex.copyMaterial(fromDataView, index2, toDataView, i); + UnitVertex.copyRounding(fromDataView, index2, toDataView, i); + UnitVertex.copyOrder(fromDataView, index2, toDataView, i); + UnitVertex.copyTexCoord(fromDataView, index2, toDataView, i); + UnitVertex.copyTexture(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBuffer(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBorder(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter1(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter2(fromDataView, index2, toDataView, i); + UnitVertex.copyMatId(fromDataView, index2, toDataView, i); + UnitVertex.copyMatColor(fromDataView, index2, toDataView, i); + UnitVertex.copyMatFuzz(fromDataView, index2, toDataView, i); + UnitVertex.copyMatRefractiveIndex(fromDataView, index2, toDataView, i); + UnitVertex.copyMatGloss(fromDataView, index2, toDataView, i); + UnitVertex.copyMatDensity(fromDataView, index2, toDataView, i); + UnitVertex.copySegColor(fromDataView, index2, toDataView, i); + } else { + UnitVertex.setRotation(toDataView, i, Constants$1.QUAT_IDENTITY); + } + } + this.unitType = buffer.unitType; + this._selected = buffer.selected; + this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + update() { + } + updateSelection(options2) { + const start = window.performance.now(); + const ids = options2 && options2.ids ? options2.ids : this._ids; + const offset2 = options2 && options2.offset !== void 0 ? options2.offset : 0; + const count2 = options2 && options2.count !== void 0 ? options2.count : ids.length; + const selection = this._selected.size > 0; + const dataView = this._dataView; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = this._lookup[id2]; + UnitVertex.setSelected(dataView, index2, selection ? this._selected.has(id2) ? 1 : -1 : 0); + } + this.update(); + this._core.log.write(LogLevel.info, `buffer update selection ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + } + class TransitionBufferBase { get pickIdLookup() { - return this._pickIdLookup; + return this._pickIdLookup; } get currentBuffer() { - return this._isBuffer1Current ? this._buffer1 : this._buffer2; + return this._isBuffer1Current ? this._buffer1 : this._buffer2; } get previousBuffer() { - return this._isBuffer1Current ? this._buffer2 : this._buffer1; + return this._isBuffer1Current ? this._buffer2 : this._buffer1; } get currentPalette() { - return this._isBuffer1Current ? this._palette1 : this._palette2; + return this._isBuffer1Current ? this._palette1 : this._palette2; } get previousPalette() { - return this._isBuffer1Current ? this._palette2 : this._palette1; + return this._isBuffer1Current ? this._palette2 : this._palette1; } get currentAtlas() { - return this._isBuffer1Current ? this._atlas1 : this._atlas2; + return this._isBuffer1Current ? this._atlas1 : this._atlas2; } get previousAtlas() { - return this._isBuffer1Current ? this._atlas2 : this._atlas1; + return this._isBuffer1Current ? this._atlas2 : this._atlas1; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get length() { - return this._length; - } - constructor(core, ids, bufferType, paletteType, atlasType){ - this.bufferType = bufferType; - this.paletteType = paletteType; - this.atlasType = atlasType; - this._core = core; - this._length = ids.length; - this.id = TransitionBufferBase._id++; - this.isVisible = true; - this.transitionTime = 1; - this.activeId = -1; - const start = window.performance.now(); - this._buffer1 = new bufferType(core, ids); - this._buffer2 = this._buffer1.createShared(); - this._palette1 = new paletteType(); - this._palette2 = new paletteType(); - this._atlas1 = new atlasType(); - this._atlas2 = new atlasType(); - this.isPickingEnabled = true; - this._pickIdLookup = {}; - const dataView1 = this._buffer1.dataView; - const dataView2 = this._buffer2.dataView; - const _vec4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - this._pickIdLookup[pickId] = id; - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).data, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView1, i, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView2, i, _vec4); - } - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); + return this._length; + } + constructor(core, ids, bufferType, paletteType, atlasType) { + this.bufferType = bufferType; + this.paletteType = paletteType; + this.atlasType = atlasType; + this._core = core; + this._length = ids.length; + this.id = TransitionBufferBase._id++; + this.isVisible = true; + this.transitionTime = 1; + this.activeId = -1; + const start = window.performance.now(); + this._buffer1 = new bufferType(core, ids); + this._buffer2 = this._buffer1.createShared(); + this._palette1 = new paletteType(); + this._palette2 = new paletteType(); + this._atlas1 = new atlasType(); + this._atlas2 = new atlasType(); + this.isPickingEnabled = true; + this._pickIdLookup = {}; + const dataView1 = this._buffer1.dataView; + const dataView2 = this._buffer2.dataView; + const _vec4 = create$5(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + const pickId = PickHelper.nextPickId(); + this._pickIdLookup[pickId] = id2; + PickHelper.encodeNumber(pickId, PickType.data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; + UnitVertex.setIdColor(dataView1, i, _vec4); + UnitVertex.setIdColor(dataView2, i, _vec4); + } + this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); } swap() { - this._isBuffer1Current = !this._isBuffer1Current; + this._isBuffer1Current = !this._isBuffer1Current; } copyFrom(transitionBuffer) { - const start = window.performance.now(); - this.key = transitionBuffer.key; - this.isVisible = transitionBuffer.isVisible; - this.transitionTime = transitionBuffer.transitionTime; - this.isPickingEnabled = transitionBuffer.isPickingEnabled; - this.unitType = transitionBuffer.unitType; - this.activeId = transitionBuffer.activeId; - this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); - this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); - this.currentBuffer.update(); - this.previousBuffer.update(); - this.currentPalette.copyFrom(transitionBuffer.currentPalette); - this.previousPalette.copyFrom(transitionBuffer.previousPalette); - this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); - this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } -} -TransitionBufferBase._id = 1; -class Buffer extends BufferBase { - constructor(core, ids){ - super(core, ids); - } -} -class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - } -} - -},{"gl-matrix":"5x28d","./constants.js":"lD0bG","./palette.js":"hZb65","./vertex.js":"4J2YE","./helpers/pick.js":"1t2sb","./main.js":"f421K","./atlas.js":"2peXi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2peXi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AtlasBase", ()=>AtlasBase); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -class AtlasBase { - get imageData() { - return this._imageData; + const start = window.performance.now(); + this.key = transitionBuffer.key; + this.isVisible = transitionBuffer.isVisible; + this.transitionTime = transitionBuffer.transitionTime; + this.isPickingEnabled = transitionBuffer.isPickingEnabled; + this.unitType = transitionBuffer.unitType; + this.activeId = transitionBuffer.activeId; + this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); + this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); + this.currentBuffer.update(); + this.previousBuffer.update(); + this.currentPalette.copyFrom(transitionBuffer.currentPalette); + this.previousPalette.copyFrom(transitionBuffer.previousPalette); + this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); + this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); + this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._changed = true; - } + } + TransitionBufferBase._id = 1; + let Buffer$3 = class Buffer extends BufferBase { + constructor(core, ids) { + super(core, ids); } - constructor(){ - this._imageData = null; + }; + let TransitionBuffer$2 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$3, Palette$3, Atlas$2); } - copyFrom(atlas) { - if (atlas.imageData) { - this._imageData = atlas.imageData; - this._changed = true; - } else this.imageData = null; - } - update() {} -} -class Atlas extends AtlasBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bBVbT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxes", ()=>DebugAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class DebugAxes { + }; + class DebugAxes { get vertices() { - return this._vertices; + return this._vertices; } get indices() { - return this._indices; + return this._indices; } get indexCount() { - return this._indexCount; + return this._indexCount; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } initialize() { - let vertexOffset = 0; - let indexOffset = 0; - const axisVertices = (0, _cubeJs.Cube).POSITIONS; - const axisIndices = (0, _cubeJs.Cube).INDICES; - this._vertices = new ArrayBuffer(3 * (0, _vertexJs.PositionColorVertex).SIZE_BYTES * axisVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const verticesView = new DataView(this._vertices); - this._indices = new Uint16Array(3 * axisIndices.length + 4); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - const transform = (0, _glMatrix.mat4).create(); - const length = 1; - const width = 0.01; - transform[0] = length; - transform[5] = width; - transform[10] = width; - transform[12] = 0.5; - transform[13] = 0; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITX, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = length; - transform[10] = width; - transform[12] = 0; - transform[13] = 0.5; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITY, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = width; - transform[10] = length; - transform[12] = 0; - transform[13] = 0; - transform[14] = 0.5; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITZ, transform, vertexOffset, indexOffset); - this._indexCount = this._indices.length; - this._isInitialized = true; + let vertexOffset = 0; + let indexOffset = 0; + const axisVertices = Cube.POSITIONS; + const axisIndices2 = Cube.INDICES; + this._vertices = new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); + const verticesView = new DataView(this._vertices); + this._indices = new Uint16Array(3 * axisIndices2.length + 4); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + const transform2 = create$7(); + const length2 = 1; + const width2 = 0.01; + transform2[0] = length2; + transform2[5] = width2; + transform2[10] = width2; + transform2[12] = 0.5; + transform2[13] = 0; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITX, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = length2; + transform2[10] = width2; + transform2[12] = 0; + transform2[13] = 0.5; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITY, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = width2; + transform2[10] = length2; + transform2[12] = 0; + transform2[13] = 0; + transform2[14] = 0.5; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants$1.VECTOR3_UNITZ, transform2, vertexOffset, indexOffset); + this._indexCount = this._indices.length; + this._isInitialized = true; } - update(elapsedTime) {} - _createAxis(axisVertices, axisIndices, verticesView, indices, color, transform, vertexOffset, indexOffset) { - const position = (0, _glMatrix.vec3).create(); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - for(let i = 0; i < vertexCount; i++){ - (0, _glMatrix.vec3).set(position, axisVertices[i * (0, _vertexJs.PositionVertex).SIZE], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionColorVertex).setPosition(verticesView, vertexOffset + i, position); - (0, _vertexJs.PositionColorVertex).setColor(verticesView, vertexOffset + i, color); - } - for(let i = 0; i < indexCount; i++)indices[indexOffset + i] = axisIndices[i] + vertexOffset; - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","../meshes/cube.js":"79I5N","../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fYCHg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"eZSaZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eZSaZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _colorJs = require("./shaders/color.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _modelJs = require("./shaders/model.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unithexprismJs = require("./shaders/unithexprism.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _anaglyphJs = require("./shaders/anaglyph.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _pickJs = require("../../helpers/pick.js"); -var _debugJs = require("./components/debug.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _controllerJs = require("./components/controller.js"); -var _imageJs = require("./components/image.js"); -var _vertexJs = require("../../vertex.js"); -var _labelsJs = require("./components/labels.js"); -var _fontJs = require("./font.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + update(elapsedTime) { } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + _createAxis(axisVertices, axisIndices2, verticesView, indices, color2, transform2, vertexOffset, indexOffset) { + const position2 = create$6(); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + for (let i = 0; i < vertexCount; i++) { + set$8(position2, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); + transformMat4$2(position2, position2, transform2); + PositionColorVertex.setPosition(verticesView, vertexOffset + i, position2); + PositionColorVertex.setColor(verticesView, vertexOffset + i, color2); + } + for (let i = 0; i < indexCount; i++) { + indices[indexOffset + i] = axisIndices2[i] + vertexOffset; + } + } + } + var __awaiter$3 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get shaderResources() { - return this._shaderResources; + }; + class RendererConfig { + reset() { } - get colorShader() { - return this._colorShader; + } + class RendererBase { + get isInitialized() { + return this._isInitialized; } - get textureShader() { - return this._textureShader; + get config() { + return this._config; + } + get devicePixelRatio() { + return this._devicePixelRatio; + } + get width() { + return this._canvas.width; + } + set width(value2) { + this._options.width = value2; + } + get height() { + return this._canvas.height; } - get lassoShader() { - return this._lassoShader; + set height(value2) { + this._options.height = value2; } - get modelShader() { - return this._modelShader; + get webXRReferenceSpace() { + return this._webXRReferenceSpace; } - get sdfTextShader() { - return this._sdfTextShader; + get pickedType() { + return this._pickedType; } - get gridShader() { - return this._gridShader; + get pickedId() { + return this._pickedId; } - get blockShader() { - return this._blockShader; + get isCapturingPickImage() { + return this._isCapturingPickImage; } - get sphereShader() { - return this._sphereShader; + capturePickImage() { + this._isCapturingPickImage = true; } - get cyclinderShader() { - return this._cylinderShader; + get backgroundColor() { + return this._backgroundColor; } - get hexPrismShader() { - return this._hexPrismShader; + set backgroundColor(value2) { + if (!exactEquals(value2, this._backgroundColor)) { + this._backgroundColor = value2; + } } - get sdfShader() { - return this._sdfShader; + get ambientColor() { + return this._ambientColor; } - get anaglyphShader() { - return this._anaglyphShader; + set ambientColor(value2) { + if (!exactEquals$1(value2, this._ambientColor)) { + this._ambientColor = value2; + } } get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._directionToCamera = (0, _glMatrix.vec3).create(); - this._directionToLight = (0, _glMatrix.vec3).create(); - this._halfAngle = (0, _glMatrix.vec3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this.depthEnabled = true; + swapAxes() { + this._isAxes1Current = !this._isAxes1Current; } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + createCartesian2dAxesVisual(axes) { + return new AxesVisual(axes); } - get isWebXRSupported() { - return true; + createCartesian3dAxesVisual(axes) { + return new AxesVisual(axes); } - initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._colorShader = new (0, _colorJs.Color)(this._core, this); - this._textureShader = new (0, _textureJs.Texture)(this._core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(this._core, this); - this._modelShader = new (0, _modelJs.Model)(this._core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(this._core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(this._core, this); - this._anaglyphShader = new (0, _anaglyphJs.Anaglyph)(this._core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(this._core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(this._core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(this._core, this); - this._hexPrismShader = new (0, _unithexprismJs.UnitHexPrism)(this._core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(this._core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - this._isInitialized = false; - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); - this._isInitialized = true; + _createDebugAxesVisual(debugAxes) { + return null; } - _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._shaderResources.initializeContext(this._gl); - this._colorShader.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._modelShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._anaglyphShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._hexPrismShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._debugAxesVisual.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - this._anaglyphTextures = [ - null, - null - ]; - this.anaglyphFramebuffers = [ - null, - null - ]; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - for(let i = 0; i < this.controllers.length; i++)this.controllers[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - for(let i = 0; i < 2; i++){ - const texture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width, height); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._anaglyphTextures[i] = texture; - this.anaglyphFramebuffers[i] = framebuffer; - } - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + createLabelSetVisual(labelSet) { + return new LabelSetVisual$2(labelSet); } - _createContext(canvas) { - const antialias = this._options ? this._options.antialias === undefined ? true : this._options.antialias : true; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - return canvas.getContext("webgl", { - stencil: true, - alpha: true, - antialias: antialias, - preserveDrawingBuffer: preserveDrawingBuffer - }); + createControllerVisual(controller) { + return new ControllerVisual$1(controller); } - initializeWebXR(session) { - const promise = new Promise((resolve, reject)=>{ - this._gl.makeXRCompatible().then(()=>{ - session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, this._gl), - depthNear: this._core.config.nearPlane, - depthFar: this._core.config.farPlane - }); - session.requestReferenceSpace('local').then((refSpace)=>{ - this._webXRReferenceSpace = refSpace; - resolve(); - }); - }); - }); - return promise; + createTransitionBuffer(ids) { + return new TransitionBuffer$2(this._core, ids); } - prepare(xrFrame) { - if (xrFrame) { - const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); - if (pose) { - const glLayer = xrFrame.session.renderState.baseLayer; - for(let i = 0; i < pose.views.length; i++){ - const view = pose.views[i]; - this.vMatrices[i] = view.transform.inverse.matrix; - this.inverseVMatrices[i] = view.transform.matrix; - (0, _glMatrix.mat4).multiply(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); - this.mvMatrices[i] = this._mvMatrices[i]; - this.pMatrices[i] = view.projectionMatrix; - const viewport = glLayer.getViewport(view); - this._viewports[i].x = viewport.x; - this._viewports[i].y = viewport.y; - this._viewports[i].width = viewport.width; - this._viewports[i].height = viewport.height; - this._framebuffers[i] = glLayer.framebuffer; - } - } - this._viewportOffset = 0; - this._viewportCount = 2; - } else { - let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - this._framebuffers[1] = null; - break; - case (0, _mainJs.StereoMode).anaglyph: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = this.anaglyphFramebuffers[0]; - this._framebuffers[1] = this.anaglyphFramebuffers[1]; - break; - case (0, _mainJs.StereoMode).split: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = this._canvas.width / 2; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = null; - this._framebuffers[1] = null; - break; - } - } + createImageVisual(image2) { + return new ImageVisual$2(image2); } - createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; + createFontVisual(font2) { + return new FontVisual$2(font2); } - createControllerVisual(controller) { - const visual = new (0, _controllerJs.ControllerVisual)(this._core, this, controller); - visual.initializeContext(this._gl); - return visual; + constructor(options2) { + this._options = options2; + this.fonts = {}; } - createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + get isWebXRSupported() { + return false; } - createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + initialize(core) { + this._core = core; + this._canvas = document.createElement("canvas"); + const contextmenu = this._options && this._options.contextmenu; + if (!contextmenu) { + this._canvas.addEventListener("contextmenu", (e) => { + e.preventDefault(); + }); + } + this._canvas.tabIndex = this._core.container.tabIndex; + this._canvas.style.display = "block"; + this._canvas.style.touchAction = "none"; + this._core.container.appendChild(this._canvas); + this._mvMatrices = [create$7(), create$7()]; + this.pickPMatrix = create$7(); + this.axesVisibility = AxesVisibility.current; + this._debugAxes = new DebugAxes(); + this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); + this.transitionTime = 1; + this.transitionBuffers = []; + this.areLabelsVisible = true; + this.labelSets = []; + this.controllers = []; + this.areImagesVisible = true; + this.images = []; + this._viewports = [new DOMRect(), new DOMRect()]; + this.isPickingEnabled = false; + this._pickedType = PickType.none; + this._pickedId = 0; + this._lassoMMatrix = create$7(); + this._lassoThickness = create$3(); + this._resizeMinimumDelay = -1; + this._previousResizeWidth = -1; + this._previousResizeHeight = -1; } - _createDebugAxesVisual(debugAxes) { - return new (0, _debugJs.DebugAxesVisual)(this._core, this, debugAxes); + remove() { + this._core.container.removeChild(this._canvas); } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); + finalize() { + this._isInitialized = false; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; + setSize(elapsedTime) { + if (this._options && this._options.width && this._options.height) { + this._devicePixelRatio = 1; + this._resizeWidth = this._options.width; + this._resizeHeight = this._options.height; + } else { + this._devicePixelRatio = window.devicePixelRatio || 1; + this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; + this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; + } + if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { + this._previousResizeWidth = this._resizeWidth; + this._previousResizeHeight = this._resizeHeight; + this._isResizing = true; + this._resizeElapsedTime = elapsedTime; + } + if (this._isResizing) { + if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { + this._isResizing = false; + this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; + this._resize(this._resizeWidth, this._resizeHeight); + } else { + this._resizeElapsedTime += elapsedTime; + } + } } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; + _resize(width2, height2) { + this._canvas.style.width = `${Math.floor(width2 / this._devicePixelRatio)}px`; + this._canvas.style.height = `${Math.floor(height2 / this._devicePixelRatio)}px`; + width2 = Math.floor(width2); + height2 = Math.floor(height2); + this._canvas.width = width2; + this._canvas.height = height2; } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; + update(elapsedTime) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousPalette; + const current = transitionBuffer.currentPalette; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousAtlas; + const current = transitionBuffer.currentAtlas; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + if (this._core.config.isDebugVisible) { + if (this._debugAxesVisual) { + this._debugAxesVisual.mMatrix = this.mMatrix; + this._debugAxesVisual.vMatrices = this.vMatrices; + this._debugAxesVisual.pMatrices = this.pMatrices; + this._debugAxesVisual.viewports = this._viewports; + this._debugAxesVisual.viewportOffset = this._viewportOffset; + this._debugAxesVisual.viewportCount = this._viewportCount; + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + this.labelSets[i].label.update(elapsedTime); + labelSetVisual.mMatrix = this.mMatrix; + labelSetVisual.vMatrices = this.vMatrices; + labelSetVisual.pMatrices = this.pMatrices; + labelSetVisual.isPickingEnabled = this.isPickingEnabled; + labelSetVisual.pickPMatrix = this.pickPMatrix; + labelSetVisual.pickVMatrix = this.pickVMatrix; + labelSetVisual.viewports = this._viewports; + labelSetVisual.viewportOffset = this._viewportOffset; + labelSetVisual.viewportCount = this._viewportCount; + labelSetVisual.update(elapsedTime); + } + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual && imageVisual.isVisible) { + const image2 = this.images[i].image; + image2.update(elapsedTime); + imageVisual.mMatrix = this.mMatrix; + imageVisual.vMatrices = this.vMatrices; + imageVisual.pMatrices = this.pMatrices; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.pickPMatrix = this.pickPMatrix; + imageVisual.pickVMatrix = this.pickVMatrix; + imageVisual.viewports = this._viewports; + imageVisual.viewportOffset = this._viewportOffset; + imageVisual.viewportCount = this._viewportCount; + imageVisual.update(elapsedTime); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + const controller = this.controllers[i].controller; + controller.update(elapsedTime); + controllerVisual.vMatrices = this.vMatrices; + controllerVisual.inverseVMatrices = this.vMatrices; + controllerVisual.pMatrices = this.pMatrices; + controllerVisual.viewports = this._viewports; + controllerVisual.viewportOffset = this._viewportOffset; + controllerVisual.viewportCount = this._viewportCount; + controllerVisual.update(elapsedTime); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + const axes = axesVisual.axes; + axes.mMatrix = this.mMatrix; + axes.vMatrix = this.vMatrices[0]; + axes.update(elapsedTime); + axesVisual.vMatrices = this.vMatrices; + axesVisual.pMatrices = this.pMatrices; + axesVisual.isPickingEnabled = this.isPickingEnabled; + axesVisual.pickPMatrix = this.pickPMatrix; + axesVisual.pickVMatrix = this.pickVMatrix; + axesVisual.viewports = this._viewports; + axesVisual.viewportOffset = this._viewportOffset; + axesVisual.viewportCount = this._viewportCount; + axesVisual.update(elapsedTime); + } + } + } + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + const font2 = fontVisual.font; + font2.update(); + fontVisual.update(); + } } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); + getVertexPosition(position2, pickedId) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[pickedId]; + if (id2 > -1) { + const index2 = transitionBuffer.currentBuffer.lookup[id2]; + const dataView = transitionBuffer.currentBuffer.dataView; + UnitVertex.getTranslation(dataView, index2, position2); + break; + } + } } render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - if (this.depthEnabled) this._gl.enable(this._gl.DEPTH_TEST); - else this._gl.disable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); - if (xrFrame) { - const glLayer = xrFrame.session.renderState.baseLayer; - this._shaderResources.bindFramebuffer(glLayer.framebuffer); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph) { - for(let i = 0; i < 2; i++){ - this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else { - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - if (this._core.config.isDebugVisible) { - this._debugAxesVisual.framebuffers = this._framebuffers; - this._debugAxesVisual.render(elapsedTime, xrFrame); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.framebuffers = this._framebuffers; - axesVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(xrFrame, transitionBuffer); - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.framebuffers = this._framebuffers; - labelSetVisual.render(elapsedTime, xrFrame); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.framebuffers = this._framebuffers; - imageVisual.pickFramebuffer = this._pickFrameBuffer; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - controllerVisual.isRayVisible = this.isPickingEnabled; - controllerVisual.framebuffers = this._framebuffers; - controllerVisual.render(elapsedTime, xrFrame); - } - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - if (this._isCapturingPickImage && this.capturePickImageCallback) { - this._isCapturingPickImage = false; - const data = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); - this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data); - for(let i = 0; i < data.length / 4; i++)if (data[i * 4 + 3] == (0, _mainJs.PickType).data) data[i * 4 + 3] = 255; - else { - data[i * 4] = 0; - data[i * 4 + 1] = 0; - data[i * 4 + 2] = 0; - data[i * 4 + 3] = 0; - } - const length = this._core.config.pickWidth * this._core.config.pickHeight * 4; - const row = this._core.config.pickWidth * 4; - const end = (this._core.config.pickHeight - 1) * row; - const flipped = new Uint8ClampedArray(length); - for(let i = 0; i < length; i += row)flipped.set(data.subarray(i, i + row), end - i); - this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); - } - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { - this._shaderResources.bindFramebuffer(null); - this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); - this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; - this._anaglyphShader.indexBuffer = this._quad.indexBuffer; - this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; - this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; - this._anaglyphShader.prepare(); - this._anaglyphShader.viewport = this._viewports[0]; - this._anaglyphShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - }); + return __awaiter$3(this, void 0, void 0, function* () { + }); } - _renderTransitionBuffer(xrFrame, transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf || unitType == (0, _mainJs.UnitType).ringSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = 0; - this._blockShader.rangeMax = transitionBuffer.length - 1; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.selectedColor = this._core.config.selectionColor; - this._blockShader.hoverColor = this._core.config.hoverColor; - this._blockShader.activeColor = this._core.config.activeColor; - this._blockShader.highlightMode = this._core.config.highlightMode; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.ambient = this._config.ambient; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._blockShader.directionToLight = this._directionToLight; - this._blockShader.halfAngle = this._halfAngle; - } else { - this._blockShader.directionToLight = this._config.directionToLight; - this._blockShader.halfAngle = this._config.halfAngle; - } - this._blockShader.vMatrix = vMatrix; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf || unitType == (0, _mainJs.UnitType).disk)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = 0; - this._sphereShader.rangeMax = transitionBuffer.length - 1; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.selectedColor = this._core.config.selectionColor; - this._sphereShader.hoverColor = this._core.config.hoverColor; - this._sphereShader.activeColor = this._core.config.activeColor; - this._sphereShader.highlightMode = this._core.config.highlightMode; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.ambient = this._config.ambient; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sphereShader.directionToLight = this._directionToLight; - this._sphereShader.halfAngle = this._halfAngle; - } else { - this._sphereShader.directionToLight = this._config.directionToLight; - this._sphereShader.halfAngle = this._config.halfAngle; - } - this._sphereShader.vMatrix = vMatrix; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = 0; - this._cylinderShader.rangeMax = transitionBuffer.length - 1; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.selectedColor = this._core.config.selectionColor; - this._cylinderShader.hoverColor = this._core.config.hoverColor; - this._cylinderShader.activeColor = this._core.config.activeColor; - this._cylinderShader.highlightMode = this._core.config.highlightMode; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.ambient = this._config.ambient; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._cylinderShader.directionToLight = this._directionToLight; - this._cylinderShader.halfAngle = this._halfAngle; - } else { - this._cylinderShader.directionToLight = this._config.directionToLight; - this._cylinderShader.halfAngle = this._config.halfAngle; - } - this._cylinderShader.vMatrix = vMatrix; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._hexPrismShader.isInitialized && (unitType == (0, _mainJs.UnitType).hexPrism || unitType == (0, _mainJs.UnitType).hexPrismSdf)) { - this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; - this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._hexPrismShader.prepare(); - this._hexPrismShader.mMatrix = this.mMatrix; - this._hexPrismShader.time = this.transitionTime; - this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._hexPrismShader.rangeMin = 0; - this._hexPrismShader.rangeMax = transitionBuffer.length - 1; - this._hexPrismShader.hover = hoverId; - this._hexPrismShader.active = activeId; - this._hexPrismShader.selectedColor = this._core.config.selectionColor; - this._hexPrismShader.hoverColor = this._core.config.hoverColor; - this._hexPrismShader.activeColor = this._core.config.activeColor; - this._hexPrismShader.highlightMode = this._core.config.highlightMode; - this._hexPrismShader.specularPower = this._config.specularPower; - this._hexPrismShader.specularIntensity = this._config.specularIntensity; - this._hexPrismShader.ambient = this._config.ambient; - this._hexPrismShader.apply(); - this._hexPrismShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._hexPrismShader.directionToLight = this._directionToLight; - this._hexPrismShader.halfAngle = this._halfAngle; - } else { - this._hexPrismShader.directionToLight = this._config.directionToLight; - this._hexPrismShader.halfAngle = this._config.halfAngle; - } - this._hexPrismShader.vMatrix = vMatrix; - this._hexPrismShader.pMatrix = this.pMatrices[viewport]; - this._hexPrismShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._hexPrismShader.isPickShader = true; - this._hexPrismShader.pMatrix = this.pickPMatrix; - this._hexPrismShader.vMatrix = this.pickVMatrix; - this._hexPrismShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = 0; - this._sdfShader.rangeMax = transitionBuffer.length - 1; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.selectedColor = this._core.config.selectionColor; - this._sdfShader.hoverColor = this._core.config.hoverColor; - this._sdfShader.activeColor = this._core.config.activeColor; - this._sdfShader.highlightMode = this._core.config.highlightMode; - this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 0xff; - this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.ambient = this._config.ambient; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sdfShader.directionToLight = this._directionToLight; - this._sdfShader.halfAngle = this._halfAngle; - } else { - this._sdfShader.directionToLight = this._config.directionToLight; - this._sdfShader.halfAngle = this._config.halfAngle; - } - this._sdfShader.vMatrix = vMatrix; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } + prepare(xrFrame) { } -} - -},{"gl-matrix":"5x28d","../../main.js":"f421K","../renderer.js":"8zmPQ","./components/quad.js":"j6pP2","./buffer.js":"l0kgV","./config.js":"lRVKC","./shaders/shader.js":"hWbX1","./shaders/color.js":"jXv4X","./shaders/texture.js":"c5hna","./shaders/lasso.js":"5QPQk","./shaders/model.js":"5cbW3","./shaders/sdftext.js":"8CJWE","./shaders/pickgrid.js":"9bPD8","./shaders/unitblock.js":"jKxeO","./shaders/unitsphere.js":"72WuL","./shaders/unitcylinder.js":"16WiR","./shaders/unithexprism.js":"3fOzC","./shaders/unitsdf.js":"9zSFc","./shaders/anaglyph.js":"8jbJ4","../../helpers/texture.js":"bUoBU","../../helpers/pick.js":"1t2sb","./components/debug.js":"bt0jr","./components/axes/cartesian2d.js":"ktXb3","./components/axes/cartesian3d.js":"6CCj9","./components/controller.js":"hdGVP","./components/image.js":"j2Sdg","../../vertex.js":"4J2YE","./components/labels.js":"5a9e1","./font.js":"4v679","./components/lasso.js":"bi5JS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j6pP2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { + initializeWebXR(session) { + return null; + } + } + let Quad$2 = class Quad { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$7(); + fromScaling(_mat4, _vec3); + const vertices = Quad$3.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"gl-matrix":"5x28d","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l0kgV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - get vertexBuffer() { - return this._vertexBuffer; + }; + let Atlas$1 = class Atlas extends AtlasBase { + get texture() { + return this._texture; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + get defaultTexture() { + return this._defaultTexture; } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } } -} - -},{"../../buffer.js":"itbJk","../../main.js":"f421K","./atlas.js":"4oA1j","./palette.js":"6O8ED","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4oA1j":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + }; + let Palette$2 = class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../atlas.js":"2peXi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6O8ED":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { - get texture() { - return this._texture; + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } } - get defaultTexture() { - return this._defaultTexture; + }; + let Buffer$2 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../palette.js":"hZb65","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lRVKC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); + }; + let TransitionBuffer$1 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$2, Palette$2, Atlas$1); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + }; + let Config$1 = class Config extends RendererConfig { + constructor() { + super(); + this.reset(); } reset() { - this.specularIntensity = 0.15; - this.specularPower = 150; - this.lightPosition = (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0); - this.ambient = 0.01; - const _quat1 = (0, _glMatrix.quat).create(); - const _quat2 = (0, _glMatrix.quat).create(); - let angle = (0, _angleJs.AngleHelper).degreesToRadians(15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat1, _quat2); - angle = (0, _angleJs.AngleHelper).degreesToRadians(-15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat2, _quat1); - this.directionToLight = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(this.directionToLight, (0, _constantsJs.Constants).VECTOR3_UNITZ, _quat2); - this.halfAngle = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(this.halfAngle, (0, _constantsJs.Constants).VECTOR3_UNITZ, this.directionToLight); - (0, _glMatrix.vec3).normalize(this.halfAngle, this.halfAngle); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../helpers/angle.js":"53hwW","../renderer.js":"8zmPQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hWbX1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.specularIntensity = 0.15; + this.specularPower = 150; + this.lightPosition = fromValues$3(-0.5, 0.5, 0); + this.ambient = 0.01; + const _quat1 = create$4(); + const _quat2 = create$4(); + let angle2 = AngleHelper.degreesToRadians(15); + setAxisAngle(_quat1, Constants$1.VECTOR3_UNITX, angle2); + multiply(_quat2, _quat1, _quat2); + angle2 = AngleHelper.degreesToRadians(-15); + setAxisAngle(_quat1, Constants$1.VECTOR3_UNITY, angle2); + multiply(_quat2, _quat2, _quat1); + this.directionToLight = create$6(); + transformQuat(this.directionToLight, Constants$1.VECTOR3_UNITZ, _quat2); + this.halfAngle = create$6(); + add$4(this.halfAngle, Constants$1.VECTOR3_UNITZ, this.directionToLight); + normalize$5(this.halfAngle, this.halfAngle); + this.isFxaaEnabled = false; + } + }; + let Resources$1 = class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); - this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); - this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); - this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "anaglyph.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n", - "color.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); + this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); + this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); + this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + }; + Resources$1.glsl = { + "anaglyph.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n', + "color.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n', "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", - "lasso.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "model.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "model.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n', "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", - "pickgrid.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n", + "pickgrid.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n', "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n", + "sdftext.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n', "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n", - "unitblock.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitcylinder.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unithexprism.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unithexprism.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n", - "unitsdf.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitsphere.vertex.fx": "#version 100\n#include \"common.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n', + "unitblock.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitcylinder.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unithexprism.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unithexprism.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n', + "unitsdf.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitsphere.vertex.fx": '#version 100\n#include "common.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + let ShaderBase$1 = class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); + } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources$1.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"dvdia","../../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jXv4X":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Color extends (0, _shaderJs.ShaderBase) { + }; + let Color$1 = class Color extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._colorAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._colorAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c5hna":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + }; + let Texture$1 = class Texture extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5QPQk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let Lasso$3 = class Lasso extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5cbW3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Model", ()=>Model); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Model extends (0, _shaderJs.ShaderBase) { + }; + class Model extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); } applyView() { - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8CJWE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let SdfText$1 = class SdfText extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9bPD8":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let PickGrid$1 = class PickGrid extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jKxeO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ahgmR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -var _mainJs = require("../../../main.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + }; + let UnitShader$1 = class UnitShader extends ShaderBase$1 { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); - this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); - this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); - this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); + this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); + this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); + this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); } _updateCurrentBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); } _updatePreviousBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform1f(this._ambientUniform, this.ambient); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._activeColorUniform, this.activeColor); - this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == (0, _mainJs.HighlightMode).luminance ? 0.0 : 1.0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform1f(this._ambientUniform, this.ambient); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._activeColorUniform, this.activeColor); + this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0 : 1); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); } updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"hWbX1","../../../meshes/cube.js":"79I5N","../../../vertex.js":"4J2YE","../../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"72WuL":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); + } + }; + let UnitBlock$1 = class UnitBlock extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"16WiR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + let UnitSphere$1 = class UnitSphere extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + }; + let UnitCylinder$1 = class UnitCylinder extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3fOzC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitHexPrism", ()=>UnitHexPrism); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitHexPrism extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + class UnitHexPrism extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9zSFc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + } + let UnitSdf$1 = class UnitSdf extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); - this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); + this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"ahgmR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8jbJ4":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Anaglyph", ()=>Anaglyph); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Anaglyph extends (0, _shaderJs.ShaderBase) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); + } + }; + class Anaglyph extends ShaderBase$1 { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - } -} - -},{"./shader.js":"hWbX1","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bt0jr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxesVisual", ()=>DebugAxesVisual); -class DebugAxesVisual { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + } + } + class DebugAxesVisual { get isInitialized() { - return this._isInitialized && this._main.colorShader.isInitialized; + return this._isInitialized && this._main.colorShader.isInitialized; } - constructor(core, main, debugAxes){ - this._main = main; - this._debugAxes = debugAxes; - this.isVisible = true; + constructor(core, main, debugAxes) { + this._main = main; + this._debugAxes = debugAxes; + this.isVisible = true; } initializeContext(gl) { - if (!this._debugAxes.isInitialized) this._debugAxes.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._debugAxes.isInitialized) { + this._debugAxes.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const colorShader = this._main.colorShader; - const shaderResources = this._main.shaderResources; - colorShader.vertexBuffer = this._vertexBuffer; - colorShader.indexBuffer = this._indexBuffer; - colorShader.prepare(); - colorShader.mMatrix = this.mMatrix; - colorShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - colorShader.vMatrix = this.vMatrices[viewport]; - colorShader.pMatrix = this.pMatrices[viewport]; - colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + if (this.isInitialized) { + const colorShader = this._main.colorShader; + const shaderResources = this._main.shaderResources; + colorShader.vertexBuffer = this._vertexBuffer; + colorShader.indexBuffer = this._indexBuffer; + colorShader.prepare(); + colorShader.mMatrix = this.mMatrix; + colorShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + colorShader.vMatrix = this.vMatrices[viewport]; + colorShader.pMatrix = this.pMatrices[viewport]; + colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); } + } } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ktXb3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { + } + let AxesVisualBase$1 = class AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized; + } + get axes() { + return this._axes; + } + constructor(core) { + this._core = core; + this.isVisible = true; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + this._gl = gl; + } + update(elapsedTime) { + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { + } + _renderText() { + } + }; + let Cartesian2dVisual$1 = class Cartesian2dVisual extends AxesVisualBase$1 { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants$1.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"e0jpG","../../../../main.js":"f421K","../../../../constants.js":"lD0bG","../../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0jpG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { + }; + let Cartesian3dVisual$1 = class Cartesian3dVisual extends AxesVisualBase$1 { get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core){ - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; - } - update(elapsedTime) {} - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6CCj9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants$1.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"e0jpG","../../../../main.js":"f421K","../../../../constants.js":"lD0bG","../../../../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdGVP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -var _constantsJs = require("../../../constants.js"); -class ControllerVisual { + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + } + }; + class ControllerVisual { get isInitialized() { - return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; + return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; } get controller() { - return this._controller; - } - constructor(core, main, controller){ - this._core = core; - this._main = main; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._controller = controller; - this._modelShader = main.modelShader; - this._colorShader = main.colorShader; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.rayMMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._controller; + } + constructor(core, main, controller) { + this._core = core; + this._main = main; + this._mMatrix = create$7(); + this._vec3 = create$6(); + this._controller = controller; + this._modelShader = main.modelShader; + this._colorShader = main.colorShader; + this.mMatrix = create$7(); + this.rayMMatrix = create$7(); + this.isVisible = true; } initializeContext(gl) { - if (!this._controller.isInitialized) this._controller.initialize(); - this._initialize(gl); + if (!this._controller.isInitialized) { + this._controller.initialize(); + } + this._initialize(gl); } _initialize(gl) { - this._gl = gl; - this.modelTexture = (0, _textureJs.TextureHelper).fromImage(gl, this._controller.texture, false, gl.LINEAR); - this._modelVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); - this._modelIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); - this._rayVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); - this._rayIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); - this._isInitialized = true; + this._gl = gl; + this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); + this._modelVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); + this._modelIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); + this._rayVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); + this._rayIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._modelShader.vertexBuffer = this._modelVertexBuffer; - this._modelShader.indexBuffer = this._modelIndexBuffer; - this._modelShader.texture2D = this.modelTexture; - this._modelShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); - this._modelShader.mMatrix = this._mMatrix; - this._modelShader.specularPower = 10; - this._modelShader.specularIntensity = 0.01; - this._modelShader.apply(); - this._modelShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._modelShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.halfAngle = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.vMatrix = this.vMatrices[viewport]; - this._modelShader.pMatrix = this.pMatrices[viewport]; - this._modelShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isRayVisible) { - this._colorShader.vertexBuffer = this._rayVertexBuffer; - this._colorShader.indexBuffer = this._rayIndexBuffer; - this._colorShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); - this._colorShader.mMatrix = this._mMatrix; - this._colorShader.apply(); - this._colorShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._colorShader.vMatrix = this.vMatrices[viewport]; - this._colorShader.pMatrix = this.pMatrices[viewport]; - this._colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); - } - } + if (this.isInitialized) { + this._modelShader.vertexBuffer = this._modelVertexBuffer; + this._modelShader.indexBuffer = this._modelIndexBuffer; + this._modelShader.texture2D = this.modelTexture; + this._modelShader.prepare(); + multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); + this._modelShader.mMatrix = this._mMatrix; + this._modelShader.specularPower = 10; + this._modelShader.specularIntensity = 0.01; + this._modelShader.apply(); + this._modelShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._modelShader.directionToLight = Constants$1.VECTOR3_UNITZ; + this._modelShader.halfAngle = Constants$1.VECTOR3_UNITZ; + this._modelShader.vMatrix = this.vMatrices[viewport]; + this._modelShader.pMatrix = this.pMatrices[viewport]; + this._modelShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isRayVisible) { + this._colorShader.vertexBuffer = this._rayVertexBuffer; + this._colorShader.indexBuffer = this._rayIndexBuffer; + this._colorShader.prepare(); + multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); + this._colorShader.mMatrix = this._mMatrix; + this._colorShader.apply(); + this._colorShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._colorShader.vMatrix = this.vMatrices[viewport]; + this._colorShader.pMatrix = this.pMatrices[viewport]; + this._colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); + } } + } } -} - -},{"gl-matrix":"5x28d","../../../helpers/texture.js":"bUoBU","../../../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2Sdg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { + } + let ImageVisual$1 = class ImageVisual { get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; + return this._isInitialized && this._main.textureShader.isInitialized; } get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._image; + } + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$7(); + this.isVisible = true; } initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - const shaderResources = this._main.shaderResources; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.isPickShader = false; - textureShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - textureShader.isPickShader = true; - textureShader.vMatrix = this.pickVMatrix; - textureShader.pMatrix = this.pickPMatrix; - textureShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + if (this.isInitialized) { + const textureShader = this._main.textureShader; + const shaderResources = this._main.shaderResources; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.isPickShader = false; + textureShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + textureShader.isPickShader = true; + textureShader.vMatrix = this.pickVMatrix; + textureShader.pMatrix = this.pickPMatrix; + textureShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); } + } } -} - -},{"gl-matrix":"5x28d","../../../helpers/texture.js":"bUoBU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5a9e1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { + }; + let LabelVisualBase$1 = class LabelVisualBase { get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; + } + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$7(); + this.mMatrix = create$7(); + this.isVisible = true; } initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - } + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } } + } } -} -class LabelVisual extends LabelVisualBase { + }; + let LabelVisual$1 = class LabelVisual extends LabelVisualBase$1 { get label() { - return this._label; + return this._label; } - set text(value) { - this._label.text = value; + set text(value2) { + this._label.text = value2; } get text() { - return this._label.text; + return this._label.text; } - constructor(core, main, label){ - super(core, main, label); + constructor(core, main, label2) { + super(core, main, label2); } -} -class LabelSetVisual extends LabelVisualBase { + }; + let LabelSetVisual$1 = class LabelSetVisual extends LabelVisualBase$1 { get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4v679":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { + return this._label; + } + constructor(core, main, label2) { + super(core, main, label2); + } + }; + let FontVisual$1 = class FontVisual { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get font() { - return this._font; + return this._font; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } } update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"bUoBU","../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bi5JS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + }; + let Lasso$2 = class Lasso { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const vertices = Quad$3.textured(Constants$1.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"../../../constants.js":"lD0bG","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gKCQy":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"gU7zw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gU7zw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _backgroundJs = require("./shaders/background.js"); -var _ssaoJs = require("./shaders/ssao.js"); -var _boxJs = require("./shaders/box.js"); -var _deferredJs = require("./shaders/deferred.js"); -var _combineJs = require("./shaders/combine.js"); -var _dofblurJs = require("./shaders/dofblur.js"); -var _downsampleJs = require("./shaders/downsample.js"); -var _gaussianJs = require("./shaders/gaussian.js"); -var _dofcombineJs = require("./shaders/dofcombine.js"); -var _fxaaJs = require("./shaders/fxaa.js"); -var _brightJs = require("./shaders/bright.js"); -var _angleJs = require("../../helpers/angle.js"); -var _pickJs = require("../../helpers/pick.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _fontJs = require("./font.js"); -var _mathJs = require("./../../helpers/math.js"); -var _constantsJs = require("../../constants.js"); -var _vertexJs = require("../../vertex.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _labelsJs = require("./components/labels.js"); -var _imageJs = require("./components/image.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + }; + var __awaiter$2 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { + }; + let Main$1 = class Main extends RendererBase { get shaderResources() { - return this._shaderResources; + return this._shaderResources; + } + get colorShader() { + return this._colorShader; } get textureShader() { - return this._textureShader; + return this._textureShader; } get lassoShader() { - return this._lassoShader; + return this._lassoShader; + } + get modelShader() { + return this._modelShader; } get sdfTextShader() { - return this._sdfTextShader; + return this._sdfTextShader; } get gridShader() { - return this._gridShader; + return this._gridShader; } get blockShader() { - return this._blockShader; + return this._blockShader; } get sphereShader() { - return this._sphereShader; + return this._sphereShader; } get cyclinderShader() { - return this._cylinderShader; + return this._cylinderShader; + } + get hexPrismShader() { + return this._hexPrismShader; } get sdfShader() { - return this._sdfShader; + return this._sdfShader; + } + get anaglyphShader() { + return this._anaglyphShader; } get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._position = (0, _glMatrix.vec3).create(); - this._direction = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.mat3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._shadowVMatrix = (0, _glMatrix.mat4).create(); - this._shadowPMatrix = (0, _glMatrix.mat4).create(); + return this._config; + } + constructor(options2) { + super(options2); + this._config = new Config$1(); + this._quad = new Quad$2(); + this._lasso = new Lasso$2(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$5(); + this._mat3 = create$8(); + this._directionToCamera = create$6(); + this._directionToLight = create$6(); + this._halfAngle = create$6(); + this._cameraPosition = create$6(); + this._modelPosition = create$6(); + this.depthEnabled = true; } get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + return this._createContext(document.createElement("canvas")) !== null; + } + get isWebXRSupported() { + return true; } initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._textureShader = new (0, _textureJs.Texture)(core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(core, this); - this._backgroundShader = new (0, _backgroundJs.Background)(core, this); - this._ssaoShader = new (0, _ssaoJs.Ssao)(core, this); - this._boxShader = new (0, _boxJs.Box)(core, this); - this._deferredShader = new (0, _deferredJs.Deferred)(core, this); - this._combineShader = new (0, _combineJs.Combine)(core, this); - this._dofBlurShader = new (0, _dofblurJs.DofBlur)(core, this); - this._downsampleShader = new (0, _downsampleJs.Downsample)(core, this); - this._gaussianShader = new (0, _gaussianJs.Gaussian)(core, this); - this._dofCombineShader = new (0, _dofcombineJs.DofCombine)(core, this); - this._fxaaShader = new (0, _fxaaJs.Fxaa)(core, this); - this._brightPassShader = new (0, _brightJs.Bright)(core, this); + super.initialize(core); + this._shaderResources = new Resources$1(); + this._colorShader = new Color$1(this._core, this); + this._textureShader = new Texture$1(this._core, this); + this._lassoShader = new Lasso$3(this._core, this); + this._modelShader = new Model(this._core, this); + this._sdfTextShader = new SdfText$1(this._core, this); + this._gridShader = new PickGrid$1(this._core, this); + this._anaglyphShader = new Anaglyph(this._core, this); + this._blockShader = new UnitBlock$1(this._core, this); + this._sphereShader = new UnitSphere$1(this._core, this); + this._cylinderShader = new UnitCylinder$1(this._core, this); + this._hexPrismShader = new UnitHexPrism(this._core, this); + this._sdfShader = new UnitSdf$1(this._core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + this._isInitialized = false; + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); this._isInitialized = true; + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; } _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); - const random = new (0, _mathJs.PseudoRandom)(0); - const _vec3 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._config.ssaoKernelSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - _vec3[2] = random.nextFloat(); - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - (0, _glMatrix.vec3).scale(_vec3, _vec3, random.nextFloat()); - let scale = i / this._config.ssaoKernelSize; - scale = (0, _mathJs.MathHelper).lerp(0.1, 1, scale * scale); - (0, _glMatrix.vec3).scale(_vec3, _vec3, scale); - this._ssaoSampleKernel[i * 3] = _vec3[0]; - this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; - this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; - } - const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); - _vec3[2] = 0; - for(let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - noise[i * 4] = _vec3[0]; - noise[i * 4 + 1] = _vec3[1]; - } - this._ssaoNoiseTexture = this._gl.createTexture(); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); - this._ssaoWidth = -1; - this._ssaoHeight = -1; - this._shadowWidth = -1; - this._shadowHeight = -1; - this._shaderResources.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._backgroundShader.initializeContext(this._gl); - this._ssaoShader.initializeContext(this._gl); - this._boxShader.initializeContext(this._gl); - this._deferredShader.initializeContext(this._gl); - this._combineShader.initializeContext(this._gl); - this._dofBlurShader.initializeContext(this._gl); - this._downsampleShader.initializeContext(this._gl); - this._gaussianShader.initializeContext(this._gl); - this._dofCombineShader.initializeContext(this._gl); - this._fxaaShader.initializeContext(this._gl); - this._brightPassShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._shaderResources.initializeContext(this._gl); + this._colorShader.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._modelShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._anaglyphShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._hexPrismShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._debugAxesVisual.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + this._anaglyphTextures = [null, null]; + this.anaglyphFramebuffers = [null, null]; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + for (let i = 0; i < this.controllers.length; i++) { + this.controllers[i].initializeContext(this._gl); + } + } + _resize(width2, height2) { + super._resize(width2, height2); + for (let i = 0; i < 2; i++) { + const texture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); const renderBuffer = this._gl.createRenderbuffer(); this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width2, height2); const framebuffer = this._gl.createFramebuffer(); this._shaderResources.bindFramebuffer(framebuffer); this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - this._positionTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); - this._colorTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._normalTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._geometryFrameBuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width, height); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._gl.drawBuffers([ - this._gl.COLOR_ATTACHMENT0, - this._gl.COLOR_ATTACHMENT1, - this._gl.COLOR_ATTACHMENT2 - ]); - this._postProcessTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); - this._postProcessTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); - this._postProcessDofTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); - this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); - const widthHalf = Math.round(width / 2); - const heightHalf = Math.round(height / 2); - this._postProcessHalfTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); - this._postProcessHalfTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - this._postProcessQuarterTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); - this._postProcessQuarterTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - this._postProcessEighthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); - this._postProcessEighthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); - const widthSixteenth = Math.round(widthEighth / 2); - const hgeightSixteenth = Math.round(heightEighth / 2); - this._postProcessSixteenthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); - this._postProcessSixteenthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + this._anaglyphTextures[i] = texture; + this.anaglyphFramebuffers[i] = framebuffer; + } + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); } _createContext(canvas) { - let supported = false; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - const options = { - stencil: true, - alpha: false, - antialias: false, - preserveDrawingBuffer: preserveDrawingBuffer - }; - const gl = canvas.getContext("webgl2", options); - if (gl) { - const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); - if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { - const texture = (0, _textureJs1.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); - const framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); - if (status == gl.FRAMEBUFFER_COMPLETE) supported = true; - gl.bindTexture(gl.TEXTURE_2D, null); - } - } - return supported ? gl : null; + const antialias = this._options ? this._options.antialias === void 0 ? true : this._options.antialias : true; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + return canvas.getContext("webgl", { + stencil: true, + alpha: true, + antialias, + preserveDrawingBuffer + }); } - prepare() { + initializeWebXR(session) { + const promise = new Promise((resolve2, reject) => { + this._gl.makeXRCompatible().then(() => { + session.updateRenderState({ + baseLayer: new XRWebGLLayer(session, this._gl), + depthNear: this._core.config.nearPlane, + depthFar: this._core.config.farPlane + }); + session.requestReferenceSpace("local").then((refSpace) => { + this._webXRReferenceSpace = refSpace; + resolve2(); + }); + }); + }); + return promise; + } + prepare(xrFrame) { + if (xrFrame) { + const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); + if (pose) { + const glLayer = xrFrame.session.renderState.baseLayer; + for (let i = 0; i < pose.views.length; i++) { + const view = pose.views[i]; + this.vMatrices[i] = view.transform.inverse.matrix; + this.inverseVMatrices[i] = view.transform.matrix; + multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); + this.mvMatrices[i] = this._mvMatrices[i]; + this.pMatrices[i] = view.projectionMatrix; + const viewport = glLayer.getViewport(view); + this._viewports[i].x = viewport.x; + this._viewports[i].y = viewport.y; + this._viewports[i].width = viewport.width; + this._viewports[i].height = viewport.height; + this._framebuffers[i] = glLayer.framebuffer; + } + } + this._viewportOffset = 0; + this._viewportCount = 2; + } else { let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - break; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + this._framebuffers[1] = null; + break; + case StereoMode.anaglyph: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = this.anaglyphFramebuffers[0]; + this._framebuffers[1] = this.anaglyphFramebuffers[1]; + break; + case StereoMode.split: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = this._canvas.width / 2; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = null; + this._framebuffers[1] = null; + break; } + } } createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; + const buffer = new TransitionBuffer$1(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createControllerVisual(controller) { + const visual = new ControllerVisual(this._core, this, controller); + visual.initializeContext(this._gl); + return visual; } createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + const visual = new Cartesian2dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + const visual = new Cartesian3dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); + _createDebugAxesVisual(debugAxes) { + return new DebugAxesVisual(this._core, this, debugAxes); + } + _createLabelVisual(label2) { + return new LabelVisual$1(this._core, this, label2); } createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; + const visual = new LabelSetVisual$1(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; + createImageVisual(image2) { + const visual = new ImageVisual$1(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; + createFontVisual(font2) { + const visual = new FontVisual$1(this._core, font2); + visual.initializeContext(this._gl); + return visual; } getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); + return this._canvas.toDataURL(mimeType); } - update(elapsedTime) { - super.update(elapsedTime); - if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { - this._shadowWidth = this._config.shadowWidth; - this._shadowHeight = this._config.shadowHeight; - this._shadowColorTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - this._shadowDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._shadowFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); - } - if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { - this._ssaoWidth = this._config.ssaoWidth; - this._ssaoHeight = this._config.ssaoHeight; - this._ssaoTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); - this._ssaoTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); - } - if (this._config.isDofEnabled && this._config.dofAutoFocus) { - this._core.getModelManipulationOrigin(this._modelManipulationOrigin); - this._core.getModelPosition(this._modelPosition); - (0, _glMatrix.vec3).add(this._position, this._modelManipulationOrigin, this._modelPosition); - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.vec3).subtract(this._position, this._position, this._cameraPosition); - const distance = -this._position[2]; - const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); - this._config.dofFocusDistance = (0, _mathJs.MathHelper).lerp(this._config.dofFocusDistance, distance, amount); + render(elapsedTime, xrFrame) { + return __awaiter$2(this, void 0, void 0, function* () { + if (this.depthEnabled) { + this._gl.enable(this._gl.DEPTH_TEST); + } else { + this._gl.disable(this._gl.DEPTH_TEST); } - } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - this._gl.enable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.cullFace(this._gl.BACK); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); - if (this.config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.clear(this._gl.DEPTH_BUFFER_BIT); - (0, _glMatrix.mat4).perspective(this._shadowPMatrix, (0, _angleJs.AngleHelper).degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, this.inverseVMatrices[0]); - (0, _glMatrix.vec3).transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); - (0, _glMatrix.vec3).add(this._position, this._position, this._modelPosition); - (0, _glMatrix.mat4).lookAt(this._shadowVMatrix, this._position, this._modelPosition, (0, _constantsJs.Constants).VECTOR3_UNITY); - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(transitionBuffer); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.geometryFramebuffer = this._geometryFrameBuffer; - axesVisual.render(elapsedTime); - } - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; - labelSetVisual.render(elapsedTime); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.geometryFramebuffer = this._geometryFrameBuffer; - imageVisual.render(elapsedTime); - } - } - if (this._backgroundShader.isInitialized) { - this._backgroundShader.prepare(); - this._backgroundShader.color = (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._backgroundShader.apply(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._gl.bindVertexArray(null); - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { - const viewport = this._viewportOffset; - this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - }); - } - _renderTransitionBuffer(transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = currentBuffer.from; - this._blockShader.rangeMax = currentBuffer.to; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._blockShader.vMatrix = this.vMatrices[viewport]; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = true; - this._blockShader.vMatrix = this._shadowVMatrix; - this._blockShader.pMatrix = this._shadowPMatrix; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.isShadowMap = false; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = currentBuffer.from; - this._sphereShader.rangeMax = currentBuffer.to; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sphereShader.vMatrix = this.vMatrices[viewport]; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = true; - this._sphereShader.vMatrix = this._shadowVMatrix; - this._sphereShader.pMatrix = this._shadowPMatrix; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.isShadowMap = false; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = currentBuffer.from; - this._cylinderShader.rangeMax = currentBuffer.to; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._cylinderShader.vMatrix = this.vMatrices[viewport]; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = true; - this._cylinderShader.vMatrix = this._shadowVMatrix; - this._cylinderShader.pMatrix = this._shadowPMatrix; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.isShadowMap = false; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = currentBuffer.from; - this._sdfShader.rangeMax = currentBuffer.to; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sdfShader.vMatrix = this.vMatrices[viewport]; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = true; - this._sdfShader.vMatrix = this._shadowVMatrix; - this._sdfShader.pMatrix = this._shadowPMatrix; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.isShadowMap = false; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } + this._gl.enable(this._gl.CULL_FACE); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); + if (xrFrame) { + const glLayer = xrFrame.session.renderState.baseLayer; + this._shaderResources.bindFramebuffer(glLayer.framebuffer); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else if (this._core.config.stereoMode == StereoMode.anaglyph) { + for (let i = 0; i < 2; i++) { + this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else { + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); } - } - _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { - if (this._deferredShader.isInitialized) { - this._gl.disable(this._gl.DEPTH_TEST); - let ssaoTexture; - if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { - this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); - ssaoTexture = this._ssaoTexture1; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); - this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; - this._ssaoShader.indexBuffer = this._quad.indexBuffer; - this._ssaoShader.texture2D1 = this._positionTexture; - this._ssaoShader.texture2D2 = this._normalTexture; - this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; - this._ssaoShader.prepare(); - this._ssaoShader.pMatrix = pMatrix; - this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; - this._ssaoShader.ssaoRadius = this._config.ssaoRadius; - this._ssaoShader.ssaoPower = this._config.ssaoPower; - this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; - this._ssaoShader.left = 0; - this._ssaoShader.top = 0; - this._ssaoShader.width = this._config.ssaoWidth; - this._ssaoShader.height = this._config.ssaoHeight; - this._ssaoShader.apply(); - this._ssaoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { - ssaoTexture = this._ssaoTexture2; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); - this._boxShader.vertexBuffer = this._quad.vertexBuffer; - this._boxShader.indexBuffer = this._quad.indexBuffer; - this._boxShader.texture2D = this._ssaoTexture1; - this._boxShader.prepare(); - this._boxShader.left = 0; - this._boxShader.top = 0; - this._boxShader.width = this._config.ssaoWidth; - this._boxShader.height = this._config.ssaoHeight; - this._boxShader.apply(); - this._boxShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); - let postProcessFrameBuffer = this._postProcessFrameBuffer1; - this._shaderResources.bindFramebuffer(postProcessFrameBuffer); - this._deferredShader.vertexBuffer = this._quad.vertexBuffer; - this._deferredShader.indexBuffer = this._quad.indexBuffer; - this._deferredShader.texture2D1 = this._positionTexture; - this._deferredShader.texture2D2 = this._colorTexture; - this._deferredShader.texture2D3 = this._normalTexture; - this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; - this._deferredShader.texture2D5 = this._shadowDepthTexture; - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); - this._deferredShader.prepare(); - this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; - this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; - this._deferredShader.inverseVMatrix = inverseVMatrix; - this._deferredShader.shadowVMatrix = this._shadowVMatrix; - this._deferredShader.shadowPMatrix = this._shadowPMatrix; - this._deferredShader.vMatrix = vMatrix; - this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; - this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; - this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, vMatrix); - (0, _glMatrix.vec3).set(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).normalize(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); - (0, _glMatrix.vec3).subtract(this._direction, this._cameraPosition, this._position); - (0, _glMatrix.vec3).normalize(this._direction, this._direction); - (0, _glMatrix.vec3).add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); - (0, _glMatrix.vec3).normalize(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); - this._deferredShader.left = viewport.left; - this._deferredShader.top = viewport.top; - this._deferredShader.width = viewport.width; - this._deferredShader.height = viewport.height; - this._deferredShader.shadowMapWidth = this._config.shadowWidth; - this._deferredShader.shadowMapHeight = this._config.shadowHeight; - this._deferredShader.ambientIntensity = this._config.ambientIntensity; - this._deferredShader.materialIntensity = this._config.materialIntensity; - this._deferredShader.specularPower = this._config.specularPower; - this._deferredShader.specularIntensity = this._config.specularIntensity; - this._deferredShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - const widthHalf = Math.round(viewport.width / 2); - const heightHalf = Math.round(viewport.height / 2); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - const widthSixteenth = Math.round(widthEighth / 2); - const heightSixteenth = Math.round(heightEighth / 2); - if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; - this._dofBlurShader.indexBuffer = this._quad.indexBuffer; - this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofBlurShader.texture2D2 = this._positionTexture; - this._dofBlurShader.prepare(); - this._dofBlurShader.focusDepth = this._config.dofFocusDistance; - this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; - this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; - this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; - this._dofBlurShader.left = viewport.left; - this._dofBlurShader.top = viewport.top; - this._dofBlurShader.width = viewport.width; - this._dofBlurShader.height = viewport.height; - this._dofBlurShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; - this._dofCombineShader.indexBuffer = this._quad.indexBuffer; - this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofCombineShader.texture2D2 = this._postProcessDofTexture; - this._dofCombineShader.prepare(); - this._dofCombineShader.focusDepth = this._config.dofFocusDistance; - this._dofCombineShader.left = viewport.left; - this._dofCombineShader.top = viewport.top; - this._dofCombineShader.width = viewport.width; - this._dofCombineShader.height = viewport.height; - this._dofCombineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthHalf; - this._brightPassShader.height = heightHalf; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessHalfTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthQuarter; - this._brightPassShader.height = heightQuarter; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessQuarterTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthEighth; - this._brightPassShader.height = heightEighth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessEighthTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthSixteenth; - this._brightPassShader.height = heightSixteenth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessHalfTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthHalf; - this._gaussianShader.height = heightHalf; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessHalfTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessQuarterTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthQuarter; - this._gaussianShader.height = heightQuarter; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessQuarterTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessEighthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthEighth; - this._gaussianShader.height = heightEighth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessEighthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthSixteenth; - this._gaussianShader.height = heightSixteenth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._core.config.isDebugVisible) { + this._debugAxesVisual.framebuffers = this._framebuffers; + this._debugAxesVisual.render(elapsedTime, xrFrame); + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.framebuffers = this._framebuffers; + axesVisual.render(elapsedTime, xrFrame); } - if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; - this._fxaaShader.indexBuffer = this._quad.indexBuffer; - this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._fxaaShader.prepare(); - this._fxaaShader.left = viewport.left; - this._fxaaShader.top = viewport.top; - this._fxaaShader.width = viewport.width; - this._fxaaShader.height = viewport.height; - this._fxaaShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(xrFrame, transitionBuffer); + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.framebuffers = this._framebuffers; + labelSetVisual.render(elapsedTime, xrFrame); } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.framebuffers = this._framebuffers; + imageVisual.pickFramebuffer = this._pickFrameBuffer; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.render(elapsedTime, xrFrame); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + controllerVisual.isRayVisible = this.isPickingEnabled; + controllerVisual.framebuffers = this._framebuffers; + controllerVisual.render(elapsedTime, xrFrame); + } + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + if (this._isCapturingPickImage && this.capturePickImageCallback) { + this._isCapturingPickImage = false; + const data2 = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); + this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data2); + for (let i = 0; i < data2.length / 4; i++) { + if (data2[i * 4 + 3] == PickType.data) { + data2[i * 4 + 3] = 255; + } else { + data2[i * 4] = 0; + data2[i * 4 + 1] = 0; + data2[i * 4 + 2] = 0; + data2[i * 4 + 3] = 0; + } + } + const length2 = this._core.config.pickWidth * this._core.config.pickHeight * 4; + const row = this._core.config.pickWidth * 4; + const end = (this._core.config.pickHeight - 1) * row; + const flipped = new Uint8ClampedArray(length2); + for (let i = 0; i < length2; i += row) { + flipped.set(data2.subarray(i, i + row), end - i); + } + this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); + } + } else { + set$7(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._combineShader.vertexBuffer = this._quad.vertexBuffer; - this._combineShader.indexBuffer = this._quad.indexBuffer; - this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - if (this._config.isBloomEnabled) { - this._combineShader.texture2D2 = this._postProcessHalfTexture1; - this._combineShader.texture2D3 = this._postProcessQuarterTexture1; - this._combineShader.texture2D4 = this._postProcessEighthTexture1; - this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; - } else { - this._combineShader.texture2D2 = null; - this._combineShader.texture2D3 = null; - this._combineShader.texture2D4 = null; - this._combineShader.texture2D5 = null; - } - this._combineShader.prepare(); - this._combineShader.viewport = viewport; - this._combineShader.intensity = this._config.bloomIntensity; - this._combineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { + this._shaderResources.bindFramebuffer(null); + this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); + this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; + this._anaglyphShader.indexBuffer = this._quad.indexBuffer; + this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; + this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; + this._anaglyphShader.prepare(); + this._anaglyphShader.viewport = this._viewports[0]; + this._anaglyphShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + }); + } + _renderTransitionBuffer(xrFrame, transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = 0; + this._blockShader.rangeMax = transitionBuffer.length - 1; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.selectedColor = this._core.config.selectionColor; + this._blockShader.hoverColor = this._core.config.hoverColor; + this._blockShader.activeColor = this._core.config.activeColor; + this._blockShader.highlightMode = this._core.config.highlightMode; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.ambient = this._config.ambient; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._blockShader.directionToLight = this._directionToLight; + this._blockShader.halfAngle = this._halfAngle; + } else { + this._blockShader.directionToLight = this._config.directionToLight; + this._blockShader.halfAngle = this._config.halfAngle; + } + this._blockShader.vMatrix = vMatrix; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = 0; + this._sphereShader.rangeMax = transitionBuffer.length - 1; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.selectedColor = this._core.config.selectionColor; + this._sphereShader.hoverColor = this._core.config.hoverColor; + this._sphereShader.activeColor = this._core.config.activeColor; + this._sphereShader.highlightMode = this._core.config.highlightMode; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.ambient = this._config.ambient; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sphereShader.directionToLight = this._directionToLight; + this._sphereShader.halfAngle = this._halfAngle; + } else { + this._sphereShader.directionToLight = this._config.directionToLight; + this._sphereShader.halfAngle = this._config.halfAngle; + } + this._sphereShader.vMatrix = vMatrix; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = 0; + this._cylinderShader.rangeMax = transitionBuffer.length - 1; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.selectedColor = this._core.config.selectionColor; + this._cylinderShader.hoverColor = this._core.config.hoverColor; + this._cylinderShader.activeColor = this._core.config.activeColor; + this._cylinderShader.highlightMode = this._core.config.highlightMode; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.ambient = this._config.ambient; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._cylinderShader.directionToLight = this._directionToLight; + this._cylinderShader.halfAngle = this._halfAngle; + } else { + this._cylinderShader.directionToLight = this._config.directionToLight; + this._cylinderShader.halfAngle = this._config.halfAngle; + } + this._cylinderShader.vMatrix = vMatrix; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { + this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; + this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._hexPrismShader.prepare(); + this._hexPrismShader.mMatrix = this.mMatrix; + this._hexPrismShader.time = this.transitionTime; + this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._hexPrismShader.rangeMin = 0; + this._hexPrismShader.rangeMax = transitionBuffer.length - 1; + this._hexPrismShader.hover = hoverId; + this._hexPrismShader.active = activeId; + this._hexPrismShader.selectedColor = this._core.config.selectionColor; + this._hexPrismShader.hoverColor = this._core.config.hoverColor; + this._hexPrismShader.activeColor = this._core.config.activeColor; + this._hexPrismShader.highlightMode = this._core.config.highlightMode; + this._hexPrismShader.specularPower = this._config.specularPower; + this._hexPrismShader.specularIntensity = this._config.specularIntensity; + this._hexPrismShader.ambient = this._config.ambient; + this._hexPrismShader.apply(); + this._hexPrismShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._hexPrismShader.directionToLight = this._directionToLight; + this._hexPrismShader.halfAngle = this._halfAngle; + } else { + this._hexPrismShader.directionToLight = this._config.directionToLight; + this._hexPrismShader.halfAngle = this._config.halfAngle; + } + this._hexPrismShader.vMatrix = vMatrix; + this._hexPrismShader.pMatrix = this.pMatrices[viewport]; + this._hexPrismShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._hexPrismShader.isPickShader = true; + this._hexPrismShader.pMatrix = this.pickPMatrix; + this._hexPrismShader.vMatrix = this.pickVMatrix; + this._hexPrismShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = 0; + this._sdfShader.rangeMax = transitionBuffer.length - 1; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.selectedColor = this._core.config.selectionColor; + this._sdfShader.hoverColor = this._core.config.hoverColor; + this._sdfShader.activeColor = this._core.config.activeColor; + this._sdfShader.highlightMode = this._core.config.highlightMode; + this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 255; + this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.ambient = this._config.ambient; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$5(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$8(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$5(this._directionToCamera, this._directionToCamera); + add$4(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$5(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sdfShader.directionToLight = this._directionToLight; + this._sdfShader.halfAngle = this._halfAngle; + } else { + this._sdfShader.directionToLight = this._config.directionToLight; + this._sdfShader.halfAngle = this._config.halfAngle; + } + this._sdfShader.vMatrix = vMatrix; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } + } } -} - -},{"gl-matrix":"5x28d","../../main.js":"f421K","../renderer.js":"8zmPQ","./components/quad.js":"dAFCJ","./buffer.js":"i3lUV","./config.js":"btHxw","./shaders/shader.js":"f1nVl","./shaders/texture.js":"kb7uV","./shaders/lasso.js":"3XY2K","./shaders/sdftext.js":"9eKN6","./shaders/pickgrid.js":"dPLtS","./shaders/unitblock.js":"arj7Q","./shaders/unitsphere.js":"idlJV","./shaders/unitcylinder.js":"kG3Ma","./shaders/unitsdf.js":"eIwH3","./shaders/background.js":"j1a66","./shaders/ssao.js":"8V9Nh","./shaders/box.js":"6rVqd","./shaders/deferred.js":"jNY1W","./shaders/combine.js":"7jcRQ","./shaders/dofblur.js":"aFGoZ","./shaders/downsample.js":"emlyC","./shaders/gaussian.js":"5Fqo6","./shaders/dofcombine.js":"kBlwc","./shaders/fxaa.js":"9Vj9y","./shaders/bright.js":"3saQu","../../helpers/angle.js":"53hwW","../../helpers/pick.js":"1t2sb","./components/axes/cartesian2d.js":"ewMaB","./components/axes/cartesian3d.js":"h51do","./font.js":"8IUfH","./../../helpers/math.js":"f65d0","../../constants.js":"lD0bG","../../vertex.js":"4J2YE","../../helpers/texture.js":"bUoBU","./components/labels.js":"lrIn9","./components/image.js":"492tj","./components/lasso.js":"7Nt0P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dAFCJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { + }; + let Quad$1 = class Quad { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$7(); + fromScaling(_mat4, _vec3); + const vertices = Quad$3.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"gl-matrix":"5x28d","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i3lUV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - get vertexBuffer() { - return this._vertexBuffer; + }; + class Atlas extends AtlasBase { + get texture() { + return this._texture; } - constructor(core, ids){ - super(core, ids); + get defaultTexture() { + return this._defaultTexture; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } } -} - -},{"../../buffer.js":"itbJk","../../main.js":"f421K","./atlas.js":"3SMAz","./palette.js":"cjVUn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3SMAz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + } + let Palette$1 = class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../atlas.js":"2peXi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cjVUn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { - get texture() { - return this._texture; + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } } - get defaultTexture() { - return this._defaultTexture; + }; + let Buffer$1 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + constructor(core, ids) { + super(core, ids); + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"bUoBU","../../palette.js":"hZb65","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"btHxw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { + }; + class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$1, Palette$1, Atlas); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + } + class Config extends RendererConfig { get keyLightAltitude() { - return this._keyLightAltitude; + return this._keyLightAltitude; } - set keyLightAltitude(value) { - this._keyLightAltitude = value; - this._updateLights(); + set keyLightAltitude(value2) { + this._keyLightAltitude = value2; + this._updateLights(); } get keyLightAzimuth() { - return this._keyLightAzimuth; + return this._keyLightAzimuth; } - set keyLightAzimuth(value) { - this._keyLightAzimuth = value; - this._updateLights(); + set keyLightAzimuth(value2) { + this._keyLightAzimuth = value2; + this._updateLights(); } get keyLightDistance() { - return this._keyLightDistance; + return this._keyLightDistance; } - set keyLightDistance(value) { - this._keyLightDistance = value; - this._updateLights(); + set keyLightDistance(value2) { + this._keyLightDistance = value2; + this._updateLights(); } get fillLight1Altitude() { - return this._fillLight1Altitude; + return this._fillLight1Altitude; } - set fillLight1Altitude(value) { - this._fillLight1Altitude = value; - this._updateLights(); + set fillLight1Altitude(value2) { + this._fillLight1Altitude = value2; + this._updateLights(); } get fillLight1Azimuth() { - return this._fillLight1Azimuth; + return this._fillLight1Azimuth; } - set fillLight1Azimuth(value) { - this._fillLight1Azimuth = value; - this._updateLights(); + set fillLight1Azimuth(value2) { + this._fillLight1Azimuth = value2; + this._updateLights(); } get fillLight2Altitude() { - return this._fillLight2Altitude; + return this._fillLight2Altitude; } - set fillLight2Altitude(value) { - this._fillLight2Altitude = value; - this._updateLights(); + set fillLight2Altitude(value2) { + this._fillLight2Altitude = value2; + this._updateLights(); } get fillLight2Azimuth() { - return this._fillLight2Azimuth; + return this._fillLight2Azimuth; } - set fillLight2Azimuth(value) { - this._fillLight2Azimuth = value; - this._updateLights(); + set fillLight2Azimuth(value2) { + this._fillLight2Azimuth = value2; + this._updateLights(); } - constructor(){ - super(); - this._rotation = (0, _glMatrix.quat).create(); - this.keyLightPosition = (0, _glMatrix.vec3).create(); - this.fillLight1Position = (0, _glMatrix.vec3).create(); - this.fillLight2Position = (0, _glMatrix.vec3).create(); - this.reset(); + constructor() { + super(); + this._rotation = create$4(); + this.keyLightPosition = create$6(); + this.fillLight1Position = create$6(); + this.fillLight2Position = create$6(); + this.reset(); } _updateLights() { - this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); - this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); - this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); + this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); + this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); + this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); } - _updateLight(altitude, azimuth, distance, position) { - (0, _glMatrix.quat).rotateY(this._rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, (0, _angleJs.AngleHelper).degreesToRadians(azimuth)); - (0, _glMatrix.quat).rotateX(this._rotation, this._rotation, (0, _angleJs.AngleHelper).degreesToRadians(-altitude)); - (0, _glMatrix.vec3).transformQuat(position, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._rotation); - (0, _glMatrix.vec3).scale(position, position, distance); + _updateLight(altitude, azimuth, distance2, position2) { + rotateY(this._rotation, Constants$1.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); + rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); + transformQuat(position2, Constants$1.VECTOR3_UNITZ, this._rotation); + scale$5(position2, position2, distance2); } reset() { - this.isSsaoEnabled = true; - this.ssaoWidth = 1024; - this.ssaoHeight = 1024; - this.ssaoBlurEnabled = true; - this.ssaoKernelSize = 8; - this.ssaoNoiseSize = 4; - this.ssaoRadius = 0.02; - this.ssaoPower = 1; - this.isShadowEnabled = true; - this.shadowWidth = 1024; - this.shadowHeight = 1024; - this.isDofEnabled = false; - this.dofAutoFocus = true; - this.dofFocusDistance = 0.5; - this.dofFocusRange = 0.5; - this.dofMaxBackgroundBlur = 0.75; - this.isBloomEnabled = false; - this.bloomIntensity = 2; - this.specularIntensity = 0.15; - this.specularPower = 150; - this.ambientIntensity = 0.1; - this.materialIntensity = 0.5; - this.keyLightIntensity = 1.5; - this.fillLight1Intensity = 0.25; - this.fillLight2Intensity = 0.25; - this._keyLightAltitude = 30; - this._keyLightAzimuth = -45; - this._keyLightDistance = 1; - this._fillLight1Altitude = 30; - this._fillLight1Azimuth = 45; - this._fillLight2Altitude = 30; - this._fillLight2Azimuth = -135; - this._updateLights(); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../helpers/angle.js":"53hwW","../renderer.js":"8zmPQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f1nVl":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.isSsaoEnabled = true; + this.ssaoWidth = 1024; + this.ssaoHeight = 1024; + this.ssaoBlurEnabled = true; + this.ssaoKernelSize = 8; + this.ssaoNoiseSize = 4; + this.ssaoRadius = 0.02; + this.ssaoPower = 1; + this.isShadowEnabled = true; + this.shadowWidth = 1024; + this.shadowHeight = 1024; + this.isDofEnabled = false; + this.dofAutoFocus = true; + this.dofFocusDistance = 0.5; + this.dofFocusRange = 0.5; + this.dofMaxBackgroundBlur = 0.75; + this.isBloomEnabled = false; + this.bloomIntensity = 2; + this.specularIntensity = 0.15; + this.specularPower = 150; + this.ambientIntensity = 0.1; + this.materialIntensity = 0.5; + this.keyLightIntensity = 1.5; + this.fillLight1Intensity = 0.25; + this.fillLight2Intensity = 0.25; + this._keyLightAltitude = 30; + this._keyLightAzimuth = -45; + this._keyLightDistance = 1; + this._fillLight1Altitude = 30; + this._fillLight1Azimuth = 45; + this._fillLight2Altitude = 30; + this._fillLight2Azimuth = -135; + this._updateLights(); + this.isFxaaEnabled = false; + } + } + class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.OES_texture_float = gl.getExtension("OES_texture_float"); - this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "background.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.OES_texture_float = gl.getExtension("OES_texture_float"); + this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + } + Resources.glsl = { + "background.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n', "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", - "deferred.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n", + "deferred.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n', "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", - "fxaa.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n", + "fxaa.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n', "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", - "lasso.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "pickgrid.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n", + "pickgrid.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n', "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", - "texture.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n", + "texture.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n', "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitblock.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitcylinder.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n", - "unitsdf.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitsphere.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitblock.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitcylinder.vertex.fx": '#version 300 es\n#include "common.include.fx"\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n', + "unitsdf.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitsphere.vertex.fx": '#version 300 es\n#include "common.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.x+rd.x*h)<size.x ) t = h;\n}\n}\n{\nfloat a = dd.z + dd.x;\nfloat b = od.z + od.x;\nfloat c = oo.z + oo.x - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.y+rd.y*h)<size.y ) t = h;\n}\n}\n{\nfloat a = dd.x + dd.y;\nfloat b = od.x + od.y;\nfloat c = oo.x + oo.y - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.z+rd.z*h)<size.z ) t = h;\n}\n}\nif( t>1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); + } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"dvdia","../../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kb7uV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + } + class Texture extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3XY2K":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let Lasso$1 = class Lasso extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9eKN6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + }; + class SdfText extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dPLtS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class PickGrid extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"arj7Q":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dMP7E":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + } + class UnitShader extends ShaderBase { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); } _updateCurrentBuffer() { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); } _updatePreviousBuffer() { - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); } updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._translationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); - this._gl.vertexAttribDivisor(this._scaleAttribute, 0); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); - this._gl.vertexAttribDivisor(this._colorAttribute, 0); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); - this._gl.vertexAttribDivisor(this._selectedAttribute, 0); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); - this._gl.vertexAttribDivisor(this._orderAttribute, 0); - this._gl.vertexAttribDivisor(this._idAttribute, 0); - this._gl.vertexAttribDivisor(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"f1nVl","../../../meshes/cube.js":"79I5N","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"idlJV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._translationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); + this._gl.vertexAttribDivisor(this._scaleAttribute, 0); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); + this._gl.vertexAttribDivisor(this._colorAttribute, 0); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); + this._gl.vertexAttribDivisor(this._selectedAttribute, 0); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); + this._gl.vertexAttribDivisor(this._orderAttribute, 0); + this._gl.vertexAttribDivisor(this._idAttribute, 0); + this._gl.vertexAttribDivisor(this._idColorAttribute, 0); + } + } + class UnitBlock extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kG3Ma":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSphere extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + } + class UnitCylinder extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eIwH3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSdf extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"4J2YE","./unitshader.js":"dMP7E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j1a66":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Background", ()=>Background); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _quadJs = require("../components/quad.js"); -class Background extends (0, _shaderJs.ShaderBase) { - constructor(core, main){ - super(core, main); - this._quad = new (0, _quadJs.Quad)(); + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); + } + } + class Background extends ShaderBase { + constructor(core, main) { + super(core, main); + this._quad = new Quad$1(); } initializeContext(gl) { - super.initializeContext(gl); - this._quad.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + this._quad.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._isInitialized = true; - this._vao = gl.createVertexArray(); - gl.bindVertexArray(this._vao); - gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); - gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - gl.enableVertexAttribArray(this._positionAttribute); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); - gl.bindVertexArray(null); + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._isInitialized = true; + this._vao = gl.createVertexArray(); + gl.bindVertexArray(this._vao); + gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); + gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + gl.enableVertexAttribArray(this._positionAttribute); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); + gl.bindVertexArray(null); } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._colorUniform, this.color); } updateBuffers() { - super.updateBuffers(); - this._gl.bindVertexArray(this._vao); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","../components/quad.js":"dAFCJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8V9Nh":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ssao", ()=>Ssao); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Ssao extends (0, _shaderJs.ShaderBase) { + super.updateBuffers(); + this._gl.bindVertexArray(this._vao); + } + } + class Ssao extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); - this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); - this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); - this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); + this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); + this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); + this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); - this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); - this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); - this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); + this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); + this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); + this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); } applyView() { - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6rVqd":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Box", ()=>Box); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Box extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + class Box extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jNY1W":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Deferred", ()=>Deferred); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _glMatrix = require("gl-matrix"); -class Deferred extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Deferred extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } - constructor(core, main){ - super(core, main); - this.directionToKeyLight = (0, _glMatrix.vec3).create(); - this.directionToFillLight1 = (0, _glMatrix.vec3).create(); - this.directionToFillLight2 = (0, _glMatrix.vec3).create(); - this.keyLightHalfAngle = (0, _glMatrix.vec3).create(); + constructor(core, main) { + super(core, main); + this.directionToKeyLight = create$6(); + this.directionToFillLight1 = create$6(); + this.directionToFillLight2 = create$6(); + this.keyLightHalfAngle = create$6(); } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); - this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); - this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); - this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); - this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); - this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); - this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); - this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); - this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); - this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); - this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); - this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); - this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); + this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); + this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); + this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); + this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); + this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); + this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); + this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); + this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); + this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); + this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); + this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); + this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); - this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); - this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); - this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); - this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); - this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); - this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); - this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); - this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); - this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); - this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); - this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); - this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); + this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); + this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); + this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); + this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); + this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); + this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); + this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); + this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); + this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); + this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); + this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); + this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); + this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7jcRQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Combine", ()=>Combine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Combine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class Combine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1f(this._intensityUniform, this.intensity); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1f(this._intensityUniform, this.intensity); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aFGoZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofBlur", ()=>DofBlur); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofBlur extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class DofBlur extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); - this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); - this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); + this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); + this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); - this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); - this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); + this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); + this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"emlyC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Downsample", ()=>Downsample); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Downsample extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + } + } + class Downsample extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Fqo6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Gaussian", ()=>Gaussian); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Gaussian extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Gaussian extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBlwc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofCombine", ()=>DofCombine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofCombine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class DofCombine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._apertureUniform, this.aperture); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._apertureUniform, this.aperture); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Vj9y":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fxaa", ()=>Fxaa); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Fxaa extends (0, _shaderJs.ShaderBase) { - get texture2D() { - return this._texture2D; - } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } - } - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); } - apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); - } - updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3saQu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bright", ()=>Bright); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Bright extends (0, _shaderJs.ShaderBase) { + } + class Fxaa extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"f1nVl","../../../vertex.js":"4J2YE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewMaB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); + } + class Bright extends ShaderBase { + get texture2D() { + return this._texture2D; } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } } - _renderText() { - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } + _initializeShader(gl, vsSource, fsSource) { + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._isInitialized = true; } - _renderGrid() { - const gridShader = this._main.gridShader; - const axes = this._axes; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); - } - this._gl.enable(this._gl.CULL_FACE); + apply() { + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); } - _renderGridTicks(axisId, edgeId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + updateBuffers() { + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - _renderGridFace(faceId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"fFTxg","../../../../main.js":"f421K","../../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fFTxg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class AxesVisualBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get axes() { - return this._axes; + return this._axes; } - constructor(core){ - this._core = core; - this.isVisible = true; + constructor(core) { + this._core = core; + this.isVisible = true; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h51do":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { + } + _renderText() { + } + } + class Cartesian2dVisual extends AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const gridShader = this._main.gridShader; + const axes = this._axes; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$3.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"fFTxg","../../../../main.js":"f421K","../../../../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8IUfH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { + } + class Cartesian3dVisual extends AxesVisualBase { get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"bUoBU","../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lrIn9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { - get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } - initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); shader.applyModel(); shader.isPickShader = false; - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + } } + } } -} -class LabelVisual extends LabelVisualBase { - get label() { - return this._label; - } - set text(value) { - this._label.text = value; - } - get text() { - return this._label.text; - } - constructor(core, main, label){ - super(core, main, label); - } -} -class LabelSetVisual extends LabelVisualBase { - get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"492tj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { - get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; - } - get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.apply(); - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } -} - -},{"gl-matrix":"5x28d","../../../helpers/texture.js":"bUoBU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Nt0P":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { - get isInitialized() { - return this._isInitialized; + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - get vertexBuffer() { - return this._vertexBuffer; + } + class FontVisual { + get isInitialized() { + return this._isInitialized; } - get indexBuffer() { - return this._indexBuffer; + get font() { + return this._font; } - get indexCount() { - return this._indexCount; + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } -} - -},{"../../../constants.js":"lD0bG","../../../meshes/quad.js":"3PqJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2SNte":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -parcelHelpers.export(exports, "Material", ()=>(0, _materialJs.Material)); -parcelHelpers.export(exports, "MetalMaterial", ()=>(0, _materialJs.MetalMaterial)); -parcelHelpers.export(exports, "GlossyMaterial", ()=>(0, _materialJs.GlossyMaterial)); -parcelHelpers.export(exports, "VarnishMaterial", ()=>(0, _materialJs.VarnishMaterial)); -parcelHelpers.export(exports, "LambertianMaterial", ()=>(0, _materialJs.LambertianMaterial)); -parcelHelpers.export(exports, "DielectricMaterial", ()=>(0, _materialJs.DielectricMaterial)); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>(0, _materialJs.DiffuseLightMaterial)); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>(0, _materialJs.IsotropicMaterial)); -parcelHelpers.export(exports, "Texture", ()=>(0, _textureJs.Texture)); -parcelHelpers.export(exports, "SolidColorTexture", ()=>(0, _textureJs.SolidColorTexture)); -parcelHelpers.export(exports, "ImageTexture", ()=>(0, _textureJs.ImageTexture)); -parcelHelpers.export(exports, "CheckerTexture", ()=>(0, _textureJs.CheckerTexture)); -parcelHelpers.export(exports, "GridTexture", ()=>(0, _textureJs.GridTexture)); -parcelHelpers.export(exports, "Light", ()=>(0, _lightJs.Light)); -parcelHelpers.export(exports, "SphereLight", ()=>(0, _lightJs.SphereLight)); -parcelHelpers.export(exports, "RectLight", ()=>(0, _lightJs.RectLight)); -parcelHelpers.export(exports, "Ground", ()=>(0, _groundJs.Ground)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -var _mainJs = require("./main.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _groundJs = require("./ground.js"); -var _constantsJs = require("./constants.js"); - -},{"./main.js":"dfh4e","./material.js":"jQJhi","./texture.js":"5NgmA","./light.js":"2sMdC","./ground.js":"54e1Z","./constants.js":"6DWH0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfh4e":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _mainJs = require("../../main.js"); -var _configJs = require("./config.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _raytraceJs = require("./shaders/raytrace.js"); -var _fullscreenquadJs = require("./shaders/fullscreenquad.js"); -var _bvhJs = require("./bvh.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _fontJs = require("./font.js"); -var _imageJs = require("./image.js"); -var _labelsJs = require("./labels.js"); -var _bufferJs = require("./buffer.js"); -var _constantsJs1 = require("./constants.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get frameCount() { - return this._frameCount; - } - get duration() { - return this._duration; - } - get config() { - return this._config; - } - set lights(value) { - if (value != this._lights) { - this._lights = value; - this._haveLightsChanged = true; - this._frameCount = 0; - } - } - get lights() { - return this._lights; - } - restart() { - this._frameCount = 0; - this._core.start(); - } - constructor(options){ - super(options); - (0, _glMatrix.glMatrix).setMatrixArrayType(Float32Array); - this._config = new (0, _configJs.Config)(); - this._frameCount = 0; - this._duration = 0; - this._position = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._manipulationOrigin = (0, _glMatrix.vec3).create(); - this._backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } } - initialize(core) { - super.initialize(core); - this._hittables = []; - this._lightBuffer = null; - this._worldCreated = false; - this._initializeAPI().then(()=>{ - this._initializeResources(); - }); + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } } - _initializeAPI() { - return __awaiter(this, void 0, void 0, function*() { - try { - const start = window.performance.now(); - const gpu = navigator.gpu; - this._presentationFormat = gpu.getPreferredCanvasFormat(); - this._adapter = yield gpu.requestAdapter(); - const gpuDeviceDescriptor = { - requiredLimits: { - maxStorageBufferBindingSize: 134217728, - maxComputeWorkgroupsPerDimension: 256 - } - }; - this._device = yield this._adapter.requestDevice(gpuDeviceDescriptor); - this._queue = this._device.queue; - this._context = this._canvas.getContext("webgpu"); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU API initialized ${Math.round(window.performance.now() - start)}ms`); - } catch (e) { - this._core.log.write((0, _mainJs.LogLevel).error, e); - return false; - } - return true; - }); + } + class LabelVisualBase { + get isInitialized() { + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; } - _initializeResources() { - const start = window.performance.now(); - const canvasConfig = { - device: this._device, - format: this._presentationFormat, - alphaMode: "premultiplied" - }; - this._context.configure(canvasConfig); - const computeUniformBufferDescriptor = { - label: "Compute uniform buffer", - size: (0, _raytraceJs.ComputeUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._computeUniformBuffer = this._device.createBuffer(computeUniformBufferDescriptor); - this._computeUniformBufferData = new (0, _raytraceJs.ComputeUniformBufferData)(); - const depthMinMaxBufferDescriptor = { - label: "Depth min max buffer", - size: 8, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - this._depthMinMaxBuffer = this._device.createBuffer(depthMinMaxBufferDescriptor); - const depthMinMaxBufferResultDescriptor = { - label: "Depth min max result buffer", - size: 8, - usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ - }; - this._depthMinMaxResultBuffer = this._device.createBuffer(depthMinMaxBufferResultDescriptor); - const fullscreenQuadUniformBufferDescriptor = { - label: "Full screen quad uniform buffer", - size: (0, _fullscreenquadJs.FullscreenQuadUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._fullscreenQuadUniformBuffer = this._device.createBuffer(fullscreenQuadUniformBufferDescriptor); - this._fullscreenQuadUniformBufferData = new (0, _fullscreenquadJs.FullscreenQuadUniformBufferData)(); - this._sampler = this._device.createSampler({ - label: "Sampler", - magFilter: "linear", - minFilter: "linear" - }); - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(this._device); - fontVisual.update(); - } - for(let i = 0; i < this.images.length; i++){ - const image = this.images[i]; - image.initializeContext(this._device); - image.update(); - } - const textureSize = { - width: 1, - height: 1 - }; - const textureDescriptor = { - label: "Placeholder texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._texture = this._device.createTexture(textureDescriptor); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU resources initialized ${Math.round(window.performance.now() - start)}ms`); - this._isInitialized = true; + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$7(); + this.mMatrix = create$7(); + this.isVisible = true; } - get isSupported() { - return navigator.gpu !== undefined; - } - _createWorld() { - return __awaiter(this, void 0, void 0, function*() { - const start = performance.now(); - this._hittables = this._getHittables(); - if (this._hittables.length == 0) return; - const bvhAccel = new (0, _bvhJs.BVHAccel)(this._core, this._hittables, this._config.maxPrimsInNode, (0, _bvhJs.SplitMethod).sah); - const hittables = bvhAccel.orderedPrimitives; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const atlas = transitionBuffer.currentAtlas; - if (atlas.imageData) { - const imageData = atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - yield createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - label: "Atlas texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._atlasTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this._atlasTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `atlas texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - break; - } - } - } - const materials = []; - const materialIds = []; - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - const material = hittable.material; - let materialId; - let found; - for(let j = 0; j < materials.length; j++)if (materials[j] === material) { - found = true; - materialId = j; - break; - } - if (!found) { - materialId = materials.length; - materials.push(material); - } - materialIds.push(materialId); - } - const textures = []; - const textureIds = []; - for(let i = 0; i < materials.length; i++){ - const material = materials[i]; - const texture = material.texture; - if (texture) { - let textureId; - let found; - for(let j = 0; j < textures.length; j++)if (textures[j] === texture) { - found = true; - textureId = j; - break; - } - if (!found) { - textureId = textures.length; - textures.push(texture); - if (texture instanceof (0, _textureJs.ImageTexture)) { - const imageData = texture.image; - if (imageData) { - let start = performance.now(); - const imageDataLinear = new ImageData(imageData.width, imageData.height); - for(let i = 0; i < imageData.data.length; i++)imageDataLinear.data[i] = Math.pow(imageData.data[i] / 0xff, 2.2) * 0xff; - this._core.log.write((0, _mainJs.LogLevel).info, `image inverse gamma ${Math.round(window.performance.now() - start)}ms`); - start = window.performance.now(); - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageDataLinear).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._backgroundTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap, - flipY: true - }; - const imageCopyTextureTagged = { - texture: this._backgroundTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `background image updated ${Math.round(window.performance.now() - start)}ms`); - }); - } - } - } - textureIds.push(textureId); - } else textureIds.push(0); - } - const textureBufferSizeBytes = textures.length * (0, _textureJs.TextureBufferData).SIZE * 4; - const textureBufferDescriptor = { - label: "Texture buffer", - size: textureBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._textureBuffer = this._device.createBuffer(textureBufferDescriptor); - this._textureBufferData = new (0, _textureJs.TextureBufferData)(textures.length); - for(let i = 0; i < textures.length; i++)textures[i].toBuffer(this._textureBufferData, i); - const materialBufferSizeBytes = materials.length * (0, _materialJs.MaterialBufferData).SIZE * 4; - const materialBufferDescriptor = { - label: "Material buffer", - size: materialBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._materialBuffer = this._device.createBuffer(materialBufferDescriptor); - this._materialBufferData = new (0, _materialJs.MaterialBufferData)(materials.length); - for(let i = 0; i < materials.length; i++)materials[i].toBuffer(this._materialBufferData, i, textureIds[i]); - const hittableBufferSizeBytes = hittables.length * (0, _hittableJs.HittableBufferData).SIZE * 4; - const hittableBufferDescriptor = { - label: "Hittable buffer", - size: hittableBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._hittableBuffer = this._device.createBuffer(hittableBufferDescriptor); - this._hittableBufferData = new (0, _hittableJs.HittableBufferData)(hittables.length); - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - hittable.toBuffer(this._hittableBufferData, i, materialIds[i]); - } - const linearBVHNodes = bvhAccel.nodes; - const linearBVHNodeBufferSizeBytes = linearBVHNodes.length * (0, _bvhJs.LinearBVHNodeBufferData).SIZE * 4; - const linearBVHNodeBufferDescriptor = { - label: "Linear BVH node buffer", - size: linearBVHNodeBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._linearBVHNodeBuffer = this._device.createBuffer(linearBVHNodeBufferDescriptor); - this._linearBVHNodeBufferData = new (0, _bvhJs.LinearBVHNodeBufferData)(linearBVHNodes.length); - for(let i = 0; i < linearBVHNodes.length; i++)linearBVHNodes[i].toBuffer(this._linearBVHNodeBufferData, i); - this._device.queue.writeBuffer(this._hittableBuffer, 0, this._hittableBufferData.buffer, this._hittableBufferData.byteOffset, this._hittableBufferData.byteLength); - this._device.queue.writeBuffer(this._materialBuffer, 0, this._materialBufferData.buffer, this._materialBufferData.byteOffset, this._materialBufferData.byteLength); - this._device.queue.writeBuffer(this._textureBuffer, 0, this._textureBufferData.buffer, this._textureBufferData.byteOffset, this._textureBufferData.byteLength); - this._device.queue.writeBuffer(this._linearBVHNodeBuffer, 0, this._linearBVHNodeBufferData.buffer, this._linearBVHNodeBufferData.byteOffset, this._linearBVHNodeBufferData.byteLength); - this._core.log.write((0, _mainJs.LogLevel).info, `create world ${Math.round(window.performance.now() - start)}ms`); - }); + initializeContext(gl) { + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } - _createLights() { - if (!this._lights || this._lights.length == 0) return; - const modelScale = this._core.getModelScale(); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - if (!this._lightBuffer) { - const lightBufferSizeBytes = this._lights.length * (0, _lightJs.LightBufferData).SIZE * 4; - const lightBufferDescriptor = { - label: "Light buffer", - size: lightBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._lightBuffer = this._device.createBuffer(lightBufferDescriptor); - this._lightBufferData = new (0, _lightJs.LightBufferData)(this._lights.length); - } - for(let i = 0; i < this._lights.length; i++){ - const light = this._lights[i]; - let lightCopy; - if (light instanceof (0, _lightJs.RectLight)) lightCopy = new (0, _lightJs.RectLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - rotation: (0, _glMatrix.quat).clone(light.rotation), - size: (0, _glMatrix.vec2).fromValues(light.size[0] * modelScale, light.size[1] * modelScale) - }); - else if (light instanceof (0, _lightJs.SphereLight)) lightCopy = new (0, _lightJs.SphereLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - radius: light.radius * modelScale - }); - (0, _glMatrix.vec3).scale(lightCopy.center, lightCopy.center, modelScale); - (0, _glMatrix.vec3).add(lightCopy.center, lightCopy.center, this._modelPosition); - lightCopy.toBuffer(this._lightBufferData, i); - } - this._device.queue.writeBuffer(this._lightBuffer, 0, this._lightBufferData.buffer, this._lightBufferData.byteOffset, this._lightBufferData.byteLength); - this._areLightsInitialized = true; - } - standardLighting(lights) { - lights || (lights = this._config.standardLightingOptions()); - const rectLights = []; - for(let i = 0; i < lights.length; i++){ - const light = lights[i]; - const center = (0, _glMatrix.vec3).create(); - const rotation = (0, _glMatrix.quat).create(); - const azimuth = (0, _angleJs.AngleHelper).degreesToRadians(light.azimuth); - const altitude = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, azimuth); - (0, _glMatrix.quat).rotateX(rotation, rotation, altitude); - (0, _glMatrix.vec3).transformQuat(center, (0, _constantsJs.Constants).VECTOR3_UNITZ, rotation); - (0, _glMatrix.vec3).scale(center, center, light.distance); - const yaw = (0, _angleJs.AngleHelper).degreesToRadians(light.yaw); - const pitch = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, yaw); - (0, _glMatrix.quat).rotateX(rotation, rotation, pitch); - rectLights.push(new (0, _lightJs.RectLight)({ - center: center, - rotation: rotation, - size: light.size, - color: light.color - })); - } - return rectLights; + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + } } - _getHittables() { - const hittables = []; - let minY = Number.MAX_VALUE; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible && transitionBuffer.hittables && transitionBuffer.hittables.length > 0) { - minY = Math.min(minY, transitionBuffer.minY); - for(let j = 0; j < transitionBuffer.hittables.length; j++)hittables.push(transitionBuffer.hittables[j]); - } - } - if (this.labelSets && this.labelSets.length > 0) for(let i = 0; i < this.labelSets.length; i++){ - const labelSet = this.labelSets[i]; - if (labelSet.hittables) for(let j = 0; j < labelSet.hittables.length; j++)hittables.push(labelSet.hittables[j]); - } - if (this.images && this.images.length > 0) { - for(let i = 0; i < this.images.length; i++)if (this.images[i].hittable) { - const hittable = this.images[i].hittable; - hittables.push(hittable); - minY = Math.min(hittable.bounds.min[1], minY); - } - } - if (this.ground) { - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - const groundSize = (0, _glMatrix.vec2).create(); - const groundPosition = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec2).scale(groundSize, this.ground.size || this._config.groundSize, modelScale); - if (this.ground.position) (0, _glMatrix.vec3).scale(groundPosition, this.ground.position, modelScale); - else (0, _glMatrix.vec3).set(groundPosition, 0, minY - (0, _constantsJs1.Constants).SHADOW_OFFSET, 0); - const options = { - size0: groundSize, - size1: groundSize, - center0: groundPosition, - center1: groundPosition, - time0: 1, - time1: 1, - texCoord0: (0, _glMatrix.vec2).fromValues(0, 0), - texCoord1: (0, _glMatrix.vec2).fromValues(1, 1), - material: this.ground.material || this.config.defaultMaterial - }; - (0, _glMatrix.vec3).add(options.center0, options.center0, modelPosition); - hittables.push(new (0, _hittableJs.HittableXzRect)(options)); + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } } - return hittables; + } } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + } + class LabelVisual extends LabelVisualBase { + get label() { + return this._label; } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + set text(value2) { + this._label.text = value2; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + get text() { + return this._label.text; } - createTransitionBuffer(ids) { - const transitionBuffer = new (0, _bufferJs.TransitionBuffer)(this._core, this, ids); - transitionBuffer.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return transitionBuffer; - } - _resizeBackings() { - const width = this.width; - const height = this.height; - const colorChannels = 3; - const outputColorBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * colorChannels; - const outputColorBufferDescriptor = { - label: "Output color buffer", - size: outputColorBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputColorBuffer = this._device.createBuffer(outputColorBufferDescriptor); - const outputNormalDepthBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * 4; - const outputDepthBufferDescriptor = { - label: "Output normal depth buffer", - size: outputNormalDepthBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputNormalDepthBuffer = this._device.createBuffer(outputDepthBufferDescriptor); - const computeShaderModuleDescriptor = { - code: (0, _raytraceJs.ComputeShaderWgsl) - }; - const computeModule = this._device.createShaderModule(computeShaderModuleDescriptor); - const computeBindGroupLayoutDescriptor = { - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 1, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "uniform" - } - }, - { - binding: 2, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 3, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 4, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 5, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 6, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 7, - visibility: GPUShaderStage.COMPUTE, - sampler: { - type: "filtering" - } - }, - { - binding: 8, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 9, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 10, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const computeBindGroupLayout = this._device.createBindGroupLayout(computeBindGroupLayoutDescriptor); - const computeBindGroupDescriptor = { - label: "Compute bind group descriptor", - layout: computeBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 1, - resource: { - buffer: this._computeUniformBuffer - } - }, - { - binding: 2, - resource: { - buffer: this._hittableBuffer - } - }, - { - binding: 3, - resource: { - buffer: this._materialBuffer - } - }, - { - binding: 4, - resource: { - buffer: this._textureBuffer - } - }, - { - binding: 5, - resource: { - buffer: this._lightBuffer - } - }, - { - binding: 6, - resource: { - buffer: this._linearBVHNodeBuffer - } - }, - { - binding: 7, - resource: this._sampler - }, - { - binding: 8, - resource: (this.fonts[this._core.font.name].texture || this._texture).createView() - }, - { - binding: 9, - resource: (this._backgroundTexture || this._texture).createView() - }, - { - binding: 10, - resource: (this._atlasTexture || this._texture).createView() - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._computeBindGroup = this._device.createBindGroup(computeBindGroupDescriptor); - const computePipelineLayoutDescriptor = { - label: "Compute pipeline layout descriptor", - bindGroupLayouts: [ - computeBindGroupLayout - ] - }; - const computePipelineLayout = this._device.createPipelineLayout(computePipelineLayoutDescriptor); - const compute = { - module: computeModule, - entryPoint: "main" - }; - const computePipelineDescriptor = { - label: "Compute pipeline descriptor", - layout: computePipelineLayout, - compute: compute - }; - this._computePipeline = this._device.createComputePipeline(computePipelineDescriptor); - const computeDepthNormal = { - module: computeModule, - entryPoint: "depthNormal" - }; - const computeDepthNormalPipelineDescriptor = { - label: "Depth normal pipeline descriptor", - layout: computePipelineLayout, - compute: computeDepthNormal - }; - this._computeDepthNormalPipeline = this._device.createComputePipeline(computeDepthNormalPipelineDescriptor); - const computeSegment = { - module: computeModule, - entryPoint: "segment" - }; - const computeSegmentPipelineDescriptor = { - label: "Segment pipeline descriptor", - layout: computePipelineLayout, - compute: computeSegment - }; - this._computeSegmentPipeline = this._device.createComputePipeline(computeSegmentPipelineDescriptor); - const clearBindGroupLayoutDescriptor = { - label: "Clear bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const clearBindGroupLayout = this._device.createBindGroupLayout(clearBindGroupLayoutDescriptor); - const clearBindGroupDescriptor = { - label: "Clear bind group descriptor", - layout: clearBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._clearBindGroup = this._device.createBindGroup(clearBindGroupDescriptor); - const clearPipelineLayoutDescriptor = { - label: "Clear pipeline layout descriptor", - bindGroupLayouts: [ - clearBindGroupLayout - ] - }; - const clearPipelineLayout = this._device.createPipelineLayout(clearPipelineLayoutDescriptor); - const clear = { - module: computeModule, - entryPoint: "clear" - }; - const clearPipelineDescriptor = { - label: "Clear pipeline descriptor", - layout: clearPipelineLayout, - compute: clear - }; - this._clearPipeline = this._device.createComputePipeline(clearPipelineDescriptor); - const fullscreenQuadShaderDescriptor = { - label: "Fullscreen quad shader descriptor", - code: (0, _fullscreenquadJs.FullscreenQuadWgsl) - }; - const fullscreenQuadModule = this._device.createShaderModule(fullscreenQuadShaderDescriptor); - const fullscreenQuadBindGroupLayoutDescriptor = { - label: "Fullscreen quad bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "uniform" - } - }, - { - binding: 1, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 2, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - } - ] - }; - const fullscreenQuadBindGroupLayout = this._device.createBindGroupLayout(fullscreenQuadBindGroupLayoutDescriptor); - const fullscreenQuadPipelineLayoutDescriptor = { - label: "Fullscreen quad pipeline layout descriptor", - bindGroupLayouts: [ - fullscreenQuadBindGroupLayout - ] - }; - const fullscreenQuadPipelineLayout = this._device.createPipelineLayout(fullscreenQuadPipelineLayoutDescriptor); - const vertex = { - module: fullscreenQuadModule, - entryPoint: "vert_main" - }; - const primitive = { - topology: "triangle-list" - }; - const colorState = { - format: this._presentationFormat - }; - const fragment = { - module: fullscreenQuadModule, - entryPoint: "frag_main", - targets: [ - colorState - ] - }; - const fullscreenQuadPiplelineDescriptor = { - label: "Fullscreen quad pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragment, - primitive: primitive - }; - this._fullscreenQuadPipeline = this._device.createRenderPipeline(fullscreenQuadPiplelineDescriptor); - const fullscreenQuadBindGroupDescriptor = { - label: "Fullscreen quad bind group descriptor", - layout: fullscreenQuadBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: this._fullscreenQuadUniformBuffer - } - }, - { - binding: 1, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 2, - resource: { - buffer: outputNormalDepthBuffer - } - } - ] - }; - this._fullscreenQuadBindGroup = this._device.createBindGroup(fullscreenQuadBindGroupDescriptor); - const fragmentHdr = { - module: fullscreenQuadModule, - entryPoint: "frag_main_hdr", - targets: [ - colorState - ] - }; - const fullscreenQuadHdrPiplelineDescriptor = { - label: "Fullscreen quad HDR pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentHdr, - primitive: primitive - }; - this._fullscreenQuadHdrPipeline = this._device.createRenderPipeline(fullscreenQuadHdrPiplelineDescriptor); - const fragmentDepth = { - module: fullscreenQuadModule, - entryPoint: "frag_depth", - targets: [ - colorState - ] - }; - const fullscreenQuadDepthPiplelineDescriptor = { - label: "Fullscreen quad depth pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentDepth, - primitive: primitive - }; - this._fullscreenQuadDepthPipeline = this._device.createRenderPipeline(fullscreenQuadDepthPiplelineDescriptor); - const fragmentNormal = { - module: fullscreenQuadModule, - entryPoint: "frag_normal", - targets: [ - colorState - ] - }; - const fullscreenQuadNormalPiplelineDescriptor = { - label: "Fullscreen quad normal pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentNormal, - primitive: primitive - }; - this._fullscreenQuadNormalPipeline = this._device.createRenderPipeline(fullscreenQuadNormalPiplelineDescriptor); - const fragmentEdge = { - module: fullscreenQuadModule, - entryPoint: "frag_edge", - targets: [ - colorState - ] - }; - const fullscreenQuadEdgePiplelineDescriptor = { - label: "Fullscreen quad edge pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentEdge, - primitive: primitive - }; - this._fullscreenQuadEdgePipeline = this._device.createRenderPipeline(fullscreenQuadEdgePiplelineDescriptor); - const fragmentSegment = { - module: fullscreenQuadModule, - entryPoint: "frag_segment", - targets: [ - colorState - ] - }; - const fullscreenQuadSegmentPiplelineDescriptor = { - label: "Fullscreen quad segment pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentSegment, - primitive: primitive - }; - this._fullscreenQuadSegmentPipeline = this._device.createRenderPipeline(fullscreenQuadSegmentPiplelineDescriptor); - this._computeUniformBufferData.setWidth(width); - this._computeUniformBufferData.setHeight(height); - this._fullscreenQuadUniformBufferData.setWidth(width); - this._fullscreenQuadUniformBufferData.setHeight(height); - this._computeUniformBufferData.setTime0(0); - this._computeUniformBufferData.setTime1(1); - this._computeDispatchCount = Math.min(Math.ceil(width * height / 256), this._device.limits.maxComputeWorkgroupsPerDimension); - this._frameCount = 0; - this._core.log.write((0, _mainJs.LogLevel).info, "backings resized"); + constructor(core, main, label2) { + super(core, main, label2); + } + } + class LabelSetVisual extends LabelVisualBase { + get label() { + return this._label; + } + constructor(core, main, label2) { + super(core, main, label2); + } + } + class ImageVisual { + get isInitialized() { + return this._isInitialized && this._main.textureShader.isInitialized; + } + get image() { + return this._image; + } + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$7(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - super.update(elapsedTime); - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const time0 = this._core.renderer.transitionTime; - const time1 = Math.min(time0 + this._config.shutterSpeed, 1); - transitionBuffer.time0 = time0; - transitionBuffer.time1 = time1; - transitionBuffer.duration = this._core.config.transitionDuration; - transitionBuffer.stagger = this._core.config.transitionStaggering; - transitionBuffer.update(); - } - } - if (this._haveLightsChanged || !this._lightBuffer) { - this._haveLightsChanged = false; - this._createLights(); - } - if (this._hasWorldChanged) { - this._hasWorldChanged = false; - this._createWorld().then(()=>{ - if (this._hittables.length > 0) { - this._resizeBackings(); - this._worldCreated = true; - } - }); + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.apply(); + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`frm tot ${this._frameCount}`); + } } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - if (!this._worldCreated || !this._areLightsInitialized || this._hittables.length == 0) return; - const epsilon = 0.000001; - if (Math.abs(this._computeUniformBufferData.getFieldOfView() - this._core.config.fov) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setFieldOfView(this._core.config.fov); - } - if (Math.abs(this._computeUniformBufferData.getAperture() - this._config.aperture) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setAperture(this._config.aperture); - } - const m = this.inverseVMatrices[0]; - this._computeUniformBufferData.getPosition(this._position); - this._computeUniformBufferData.getRight(this._right); - this._computeUniformBufferData.getUp(this._up); - this._computeUniformBufferData.getForward(this._forward); - if (Math.abs(this._position[0] - m[12]) > epsilon || Math.abs(this._position[1] - m[13]) > epsilon || Math.abs(this._position[2] - m[14]) > epsilon || Math.abs(this._right[0] - m[0]) > epsilon || Math.abs(this._right[1] - m[1]) > epsilon || Math.abs(this._right[2] - m[2]) > epsilon || Math.abs(this._up[0] - m[4]) > epsilon || Math.abs(this._up[1] - m[5]) > epsilon || Math.abs(this._up[2] - m[6]) > epsilon || Math.abs(this._forward[0] - m[8]) > epsilon || Math.abs(this._forward[1] - m[9]) > epsilon || Math.abs(this._forward[2] - m[10]) > epsilon) { - this._frameCount = 0; - (0, _glMatrix.vec3).set(this._position, m[12], m[13], m[14]); - (0, _glMatrix.vec3).set(this._right, m[0], m[1], m[2]); - (0, _glMatrix.vec3).set(this._up, m[4], m[5], m[6]); - (0, _glMatrix.vec3).set(this._forward, m[8], m[9], m[10]); - this._computeUniformBufferData.setPosition(this._position); - this._computeUniformBufferData.setRight(this._right); - this._computeUniformBufferData.setUp(this._up); - this._computeUniformBufferData.setForward(this._forward); - this._core.getModelPosition(this._modelPosition); - this._core.getModelManipulationOrigin(this._manipulationOrigin); - (0, _glMatrix.vec3).add(this._modelPosition, this._modelPosition, this._manipulationOrigin); - this._computeUniformBufferData.setLookAt(this._modelPosition); - } - this._computeUniformBufferData.getBackgroundColor(this._backgroundColor); - if (!(0, _glMatrix.vec4).equals(this._backgroundColor, this._config.backgroundColor)) { - this._frameCount = 0; - this._computeUniformBufferData.setBackgroundColor(this._config.backgroundColor); - } - this._tilesX = this._computeUniformBufferData.getTilesX(); - this._tilesY = this._computeUniformBufferData.getTilesY(); - this._tileOffsetX = this._computeUniformBufferData.getTileOffsetX(); - this._tileOffsetY = this._computeUniformBufferData.getTileOffsetY(); - if (this._tilesX != this._core.config.tilesX || this._tilesY != this._core.config.tilesY || this._tileOffsetX != this._core.config.tileOffsetX || this._tileOffsetY != this._core.config.tileOffsetY) { - this._frameCount = 0; - this._computeUniformBufferData.setTilesX(this._core.config.tilesX); - this._computeUniformBufferData.setTilesY(this._core.config.tilesY); - this._computeUniformBufferData.setTileOffsetX(this._core.config.tileOffsetX); - this._computeUniformBufferData.setTileOffsetY(this._core.config.tileOffsetY); - } - const clear = this._frameCount == 0; - if (clear) { - this._duration = 0; - this._startTime = performance.now(); - } - if (this._frameCount >= this._config.maxSamplesPerPixel) { - this._core.stop(); - return; - } - const raysPerFrame = this._config.raysPerFrame; - this._computeUniformBufferData.setRaysPerFrame(raysPerFrame); - this._computeUniformBufferData.setSeed(this._core.totalFrames * raysPerFrame); - this._device.queue.writeBuffer(this._computeUniformBuffer, 0, this._computeUniformBufferData.buffer, this._computeUniformBufferData.byteOffset, this._computeUniformBufferData.byteLength); - this._frameCount += raysPerFrame; - this._fullscreenQuadUniformBufferData.setSamplesPerPixel(this._frameCount); - this._fullscreenQuadUniformBufferData.setExposure(this._config.exposure); - this._fullscreenQuadUniformBufferData.setMinDepth(this._config.minDepth); - this._fullscreenQuadUniformBufferData.setMaxDepth(this._config.maxDepth); - this._fullscreenQuadUniformBufferData.setEdgeDepth(this._config.edgeDepth); - this._fullscreenQuadUniformBufferData.setEdgeNormal(this._config.edgeNormal); - this._device.queue.writeBuffer(this._fullscreenQuadUniformBuffer, 0, this._fullscreenQuadUniformBufferData.buffer, this._fullscreenQuadUniformBufferData.byteOffset, this._fullscreenQuadUniformBufferData.byteLength); - yield this._encodeCommands(clear); - this._duration = performance.now() - this._startTime; - }); + } + class Lasso { + get isInitialized() { + return this._isInitialized; } - clear() { - this._frameCount = 0; - } - _encodeCommands(clear) { - return __awaiter(this, void 0, void 0, function*() { - const commandEncoder = this._device.createCommandEncoder(); - const computePassEncoder = commandEncoder.beginComputePass(); - if (clear) { - computePassEncoder.setPipeline(this._clearPipeline); - computePassEncoder.setBindGroup(0, this._clearBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - } - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - case (0, _mainJs.RenderMode).hdr: - computePassEncoder.setPipeline(this._computePipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - case (0, _mainJs.RenderMode).depth: - case (0, _mainJs.RenderMode).normal: - computePassEncoder.setPipeline(this._computeDepthNormalPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - commandEncoder.copyBufferToBuffer(this._depthMinMaxBuffer, 0, this._depthMinMaxResultBuffer, 0, this._depthMinMaxResultBuffer.size); - if (this._config.autoDepth) { - yield this._depthMinMaxResultBuffer.mapAsync(GPUMapMode.READ); - const depthMinMax = new Uint32Array(this._depthMinMaxResultBuffer.getMappedRange()); - const depthMin = depthMinMax[0] / 1000; - const depthMax = depthMinMax[1] / 1000; - if (this._config.minDepth != depthMin || this._config.maxDepth != depthMax) console.log('depthMinMax', depthMin, depthMax); - this._config.minDepth = depthMin; - this._config.maxDepth = depthMax; - this._depthMinMaxResultBuffer.unmap(); - } - break; - case (0, _mainJs.RenderMode).edge: - case (0, _mainJs.RenderMode).segment: - computePassEncoder.setPipeline(this._computeSegmentPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - } - const colorAttachment = { - view: this._context.getCurrentTexture().createView(), - clearValue: { - r: 0.0, - g: 0.0, - b: 0.0, - a: 0.0 - }, - loadOp: "clear", - storeOp: "store" - }; - const fullscreenQuadRenderPassDescriptor = { - colorAttachments: [ - colorAttachment - ] - }; - const renderPassEncoder = commandEncoder.beginRenderPass(fullscreenQuadRenderPassDescriptor); - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - renderPassEncoder.setPipeline(this._fullscreenQuadPipeline); - break; - case (0, _mainJs.RenderMode).hdr: - renderPassEncoder.setPipeline(this._fullscreenQuadHdrPipeline); - break; - case (0, _mainJs.RenderMode).depth: - renderPassEncoder.setPipeline(this._fullscreenQuadDepthPipeline); - break; - case (0, _mainJs.RenderMode).normal: - renderPassEncoder.setPipeline(this._fullscreenQuadNormalPipeline); - break; - case (0, _mainJs.RenderMode).edge: - renderPassEncoder.setPipeline(this._fullscreenQuadEdgePipeline); - break; - case (0, _mainJs.RenderMode).segment: - renderPassEncoder.setPipeline(this._fullscreenQuadSegmentPipeline); - break; - } - renderPassEncoder.setBindGroup(0, this._fullscreenQuadBindGroup); - renderPassEncoder.draw(6, 1, 0, 0); - renderPassEncoder.end(); - this._queue.submit([ - commandEncoder.finish() - ]); - }); + get vertexBuffer() { + return this._vertexBuffer; + } + get indexBuffer() { + return this._indexBuffer; + } + get indexCount() { + return this._indexCount; + } + initializeContext(gl) { + const vertices = Quad$3.textured(Constants$1.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$3.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; + } + } + var __awaiter$1 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - _resize(width, height) { - super._resize(width, height); - if (this._isInitialized && this._hittables.length > 0) { - this._resizeBackings(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); - } - } -} - -},{"gl-matrix":"5x28d","../renderer.js":"8zmPQ","../../main.js":"f421K","./config.js":"2dRLO","./hittable.js":"5cw7N","./material.js":"jQJhi","./shaders/raytrace.js":"cAHlu","./shaders/fullscreenquad.js":"1gtMg","./bvh.js":"8lb3C","./texture.js":"5NgmA","./light.js":"2sMdC","../../constants.js":"lD0bG","../../helpers/angle.js":"53hwW","./font.js":"3rF26","./image.js":"enHlm","./labels.js":"72uDI","./buffer.js":"dRm64","./constants.js":"6DWH0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2dRLO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); - } - standardLightingOptions(options) { - const azimuthOffset = options && options.azimuthOffset ? options.azimuthOffset : this.lightingAzimuthOffset; - const altitude = options && options.altitude ? options.altitude : this.lightingAltitude; - const size = options && options.size ? options.size : this.lightingSize; - const distance = options && options.distance ? options.distance : this.lightingDistance; - return [ - { - azimuth: -45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(10, 10, 10) - }, - { - azimuth: 45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: 45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }, - { - azimuth: -135 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -135 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - } - ]; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Main extends RendererBase { + get shaderResources() { + return this._shaderResources; } - reset() { - this.aperture = 0; - this.exposure = 1; - this.maxSamplesPerPixel = 10000; - this.shutterSpeed = 0; - this.raysPerFrame = 1; - this.maxPrimsInNode = 1; - this.defaultMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5) - }) - }); - this.defaultTextMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }) - }); - this.groundSize = (0, _glMatrix.vec2).fromValues(10, 10); - this.backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); - this.lightingAzimuthOffset = 0; - this.lightingAltitude = 30; - this.lightingSize = 0.5; - this.lightingDistance = 1.5; - this.autoDepth = true; - this.minDepth = 1; - this.maxDepth = 10; - this.edgeDepth = 0.01; - this.edgeNormal = 0.025; - } -} - -},{"gl-matrix":"5x28d","../renderer.js":"8zmPQ","./material.js":"jQJhi","./texture.js":"5NgmA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jQJhi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MaterialType", ()=>MaterialType); -parcelHelpers.export(exports, "MaterialBufferData", ()=>MaterialBufferData); -parcelHelpers.export(exports, "Material", ()=>Material); -parcelHelpers.export(exports, "LambertianMaterial", ()=>LambertianMaterial); -parcelHelpers.export(exports, "MetalMaterial", ()=>MetalMaterial); -parcelHelpers.export(exports, "DielectricMaterial", ()=>DielectricMaterial); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>DiffuseLightMaterial); -parcelHelpers.export(exports, "GlossyMaterial", ()=>GlossyMaterial); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>IsotropicMaterial); -parcelHelpers.export(exports, "VarnishMaterial", ()=>VarnishMaterial); -var _glMatrix = require("gl-matrix"); -const MaterialType = { - lambertian: 0, - metal: 1, - dielectric: 2, - glossy: 3, - diffuseLight: 4, - isotropic: 5, - varnish: 6 -}; -class MaterialBufferData extends Float32Array { - constructor(count){ - super(count * MaterialBufferData.SIZE); - this.TYPE_OFFSET = 0; - this.FUZZ_OFFSET = 1; - this.REFRACTIVE_INDEX_OFFSET = 2; - this.TEXTURE_ID_OFFSET = 3; - this.COLOR_OFFSET = 4; - this.GLOSSINESS_OFFSET = 7; - this.ID_COLOR_OFFSET = 8; - this.DENSITY_OFFSET = 12; - } - getType(index) { - return this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getFuzz(index) { - return this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET]; - } - setFuzz(index, value) { - this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET] = value; - } - getRefractiveIndex(index) { - return this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET]; - } - setRefractiveIndex(index, value) { - this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET] = value; - } - getTextureId(index) { - return this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET]; - } - setTextureId(index, value) { - this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET] = value; - } - getColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getGlossiness(index) { - return this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET]; - } - setGlossiness(index, value) { - this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET] = value; - } - getDensity(index) { - return this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET]; - } - setDensity(index, value) { - this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET] = value; - } - getIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -MaterialBufferData.SIZE = 16; -class Material { - get texture() { - return this._texture; - } - get idColor() { - return this._idColor; - } - constructor(options){ - this._idColor = options.idColor || (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); - } - toBuffer(buffer, index, textureId) {} -} -class LambertianMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.lambertian); - buffer.setIdColor(index, this.idColor); - buffer.setTextureId(index, textureId); - } -} -class MetalMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.metal); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setTextureId(index, textureId); - } -} -class DielectricMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - this.density = options && options.density !== undefined ? options.density : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.dielectric); - buffer.setIdColor(index, this.idColor); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setColor(index, (0, _glMatrix.vec3).fromValues(-Math.log(this.color[0]) * this.density, -Math.log(this.color[1]) * this.density, -Math.log(this.color[2]) * this.density)); - } -} -class DiffuseLightMaterial extends Material { - constructor(options){ - super(options); - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.diffuseLight); - buffer.setIdColor(index, this.idColor); - buffer.setColor(index, this.color); - } -} -class GlossyMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.glossy); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setTextureId(index, textureId); - } -} -class IsotropicMaterial extends Material { - constructor(options){ - super(options); - this.density = options.density; - this.color = options.color; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.isotropic); - buffer.setIdColor(index, this.idColor); - buffer.setDensity(index, this.density); - buffer.setColor(index, this.color); - } -} -class VarnishMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.varnish); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5NgmA":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureType", ()=>TextureType); -parcelHelpers.export(exports, "TextureBufferData", ()=>TextureBufferData); -parcelHelpers.export(exports, "Texture", ()=>Texture); -parcelHelpers.export(exports, "SolidColorTexture", ()=>SolidColorTexture); -parcelHelpers.export(exports, "ImageTexture", ()=>ImageTexture); -parcelHelpers.export(exports, "CheckerTexture", ()=>CheckerTexture); -parcelHelpers.export(exports, "GridTexture", ()=>GridTexture); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -const TextureType = { - none: 0, - solidColor: 1, - image: 2, - sdfText: 3, - checker: 4, - grid: 5 -}; -class TextureBufferData extends Float32Array { - constructor(count){ - super(count * TextureBufferData.SIZE); - this.COLOR0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.COLOR1_OFFSET = 4; - this.SIZE0_OFFSET = 8; - this.SIZE1_OFFSET = 12; - this.CLIP_OFFSET = 16; - this.OFFSET_OFFSET = 20; - } - getType(index) { - return this[TextureBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[TextureBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); - } - setOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - } -} -TextureBufferData.SIZE = 24; -class Texture { -} -class SolidColorTexture extends Texture { - constructor(options){ - super(); - this.color = options.color; - this.borderColor = options.borderColor || (0, _constantsJs.Constants).VECTOR3_ONE; - this._color = (0, _glMatrix.vec3).fromValues(Math.pow(this.color[0], 2.2), Math.pow(this.color[1], 2.2), Math.pow(this.color[2], 2.2)); - this._borderColor = (0, _glMatrix.vec3).fromValues(Math.pow(this.borderColor[0], 2.2), Math.pow(this.borderColor[1], 2.2), Math.pow(this.borderColor[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.solidColor); - buffer.setColor0(index, this._color); - buffer.setColor1(index, this._borderColor); - } -} -class ImageTexture extends Texture { - constructor(options){ - super(); - this.image = options.image; - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.image); - } -} -class CheckerTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.checker); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], 0, 0)); - buffer.setOffset(index, this.offset); - } -} -class GridTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.minorSize = options.minorSize; - this.thickness = options.thickness; - this.minorThickness = options.minorThickness; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this.clip = options.clip || (0, _glMatrix.vec4).fromValues(0, 0, 1, 1); - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.grid); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], this.minorSize[0], this.minorSize[1])); - buffer.setSize1(index, (0, _glMatrix.vec4).fromValues(this.thickness[0], this.thickness[1], this.minorThickness[0], this.minorThickness[1])); - buffer.setOffset(index, this.offset); - buffer.setClip(index, this.clip); - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5cw7N":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HittableType", ()=>HittableType); -parcelHelpers.export(exports, "HittableBufferData", ()=>HittableBufferData); -parcelHelpers.export(exports, "Hittable", ()=>Hittable); -parcelHelpers.export(exports, "HittableSphere", ()=>HittableSphere); -parcelHelpers.export(exports, "HittableXyDisk", ()=>HittableXyDisk); -parcelHelpers.export(exports, "HittableRotatedXyDisk", ()=>HittableRotatedXyDisk); -parcelHelpers.export(exports, "HittableRingSdf", ()=>HittableRingSdf); -parcelHelpers.export(exports, "HittableRotatedRingSdf", ()=>HittableRotatedRingSdf); -parcelHelpers.export(exports, "HittableBox", ()=>HittableBox); -parcelHelpers.export(exports, "HittableBoxSdf", ()=>HittableBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBoxSdf", ()=>HittableRotatedBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBox", ()=>HittableRotatedBox); -parcelHelpers.export(exports, "HittableCylinder", ()=>HittableCylinder); -parcelHelpers.export(exports, "HittableCylinderSdf", ()=>HittableCylinderSdf); -parcelHelpers.export(exports, "HittableHexPrism", ()=>HittableHexPrism); -parcelHelpers.export(exports, "HittableHexPrismSdf", ()=>HittableHexPrismSdf); -parcelHelpers.export(exports, "HittableRect", ()=>HittableRect); -parcelHelpers.export(exports, "HittableXyRect", ()=>HittableXyRect); -parcelHelpers.export(exports, "HittableXzRect", ()=>HittableXzRect); -parcelHelpers.export(exports, "HittableYzRect", ()=>HittableYzRect); -parcelHelpers.export(exports, "HittableFontXyRect", ()=>HittableFontXyRect); -parcelHelpers.export(exports, "HittableSdfXyRect", ()=>HittableSdfXyRect); -parcelHelpers.export(exports, "HittableRotatedXyRect", ()=>HittableRotatedXyRect); -parcelHelpers.export(exports, "HittableRotatedFontXyRect", ()=>HittableRotatedFontXyRect); -parcelHelpers.export(exports, "HittableRotatedSdfXyRect", ()=>HittableRotatedSdfXyRect); -parcelHelpers.export(exports, "HittableConstantMedium", ()=>HittableConstantMedium); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _boundsJs = require("../../helpers/bounds.js"); -var _aabbJs = require("./aabb.js"); -const HittableType = { - sphere: 0, - box: 1, - cylinder: 2, - hexPrism: 3, - rotatedBox: 4, - xyRect: 5, - xzRect: 6, - yzRect: 7, - rotatedXyRect: 8, - fontXyRect: 9, - rotatedFontXyRect: 10, - boxSdf: 11, - cylinderSdf: 12, - hexPrismSdf: 13, - constantMedium: 14, - sdfXyRect: 15, - rotatedSdfXyRect: 16, - rotatedBoxSdf: 17, - xYDisk: 18, - rotatedXyDisk: 19, - ringSdf: 20, - rotatedRingSdf: 21 -}; -class HittableBufferData extends Float32Array { - constructor(count){ - super(count * HittableBufferData.SIZE); - this.CENTER0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.SIZE0_OFFSET = 4; - this.MATERIAL_ID_OFFSET = 7; - this.ROTATION0_OFFSET = 8; - this.ROTATION1_OFFSET = 12; - this.TEXCOORD0_OFFSET = 16; - this.TEXCOORD1_OFFSET = 18; - this.CENTER1_OFFSET = 20; - this.ROUNDING_OFFSET = 23; - this.SIZE1_OFFSET = 24; - this.BOUNDARY_TYPE_OFFSET = 27; - this.TIME0_OFFSET = 28; - this.TIME1_OFFSET = 29; - this.TEX_ID_OFFSET = 30; - this.SDF_BUFFER_OFFSET = 31; - this.SDF_BORDER_OFFSET = 32; - this.PARAMETER_1_OFFSET = 33; - this.PARAMETER_2_OFFSET = 34; - } - getType(index) { - return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[HittableBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getTime0(index) { - return this[HittableBufferData.SIZE * index + this.TIME0_OFFSET]; - } - setTime0(index, value) { - this[HittableBufferData.SIZE * index + this.TIME0_OFFSET] = value; - } - getTime1(index) { - return this[HittableBufferData.SIZE * index + this.TIME1_OFFSET]; - } - setTime1(index, value) { - this[HittableBufferData.SIZE * index + this.TIME1_OFFSET] = value; - } - getSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getMaterialId(index) { - return this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET]; - } - setMaterialId(index, value) { - this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET] = value; - } - getRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + get textureShader() { + return this._textureShader; } - setTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + get lassoShader() { + return this._lassoShader; } - getTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + get sdfTextShader() { + return this._sdfTextShader; } - setTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + get gridShader() { + return this._gridShader; } - getRounding(index) { - return this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET]; + get blockShader() { + return this._blockShader; } - setRounding(index, value) { - this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET] = value; + get sphereShader() { + return this._sphereShader; } - getParameter1(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET]; + get cyclinderShader() { + return this._cylinderShader; } - setParameter1(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET] = value; + get sdfShader() { + return this._sdfShader; } - getParameter2(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET]; + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; } - setParameter2(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET] = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } - getBoundaryType(index) { - return this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET]; + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; } - setBoundaryType(index, value) { - this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET] = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - getTexId(index) { - return this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET]; + get config() { + return this._config; + } + constructor(options2) { + super(options2); + this._config = new Config(); + this._quad = new Quad$1(); + this._lasso = new Lasso(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$5(); + this._position = create$6(); + this._direction = create$6(); + this._cameraRotation = create$8(); + this._cameraPosition = create$6(); + this._modelPosition = create$6(); + this._modelManipulationOrigin = create$6(); + this._shadowVMatrix = create$7(); + this._shadowPMatrix = create$7(); } - setTexId(index, value) { - this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET] = value; + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; } - getSdfBuffer(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET]; + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources(); + this._textureShader = new Texture(core, this); + this._lassoShader = new Lasso$1(core, this); + this._sdfTextShader = new SdfText(core, this); + this._gridShader = new PickGrid(core, this); + this._blockShader = new UnitBlock(core, this); + this._sphereShader = new UnitSphere(core, this); + this._cylinderShader = new UnitCylinder(core, this); + this._sdfShader = new UnitSdf(core, this); + this._backgroundShader = new Background(core, this); + this._ssaoShader = new Ssao(core, this); + this._boxShader = new Box(core, this); + this._deferredShader = new Deferred(core, this); + this._combineShader = new Combine(core, this); + this._dofBlurShader = new DofBlur(core, this); + this._downsampleShader = new Downsample(core, this); + this._gaussianShader = new Gaussian(core, this); + this._dofCombineShader = new DofCombine(core, this); + this._fxaaShader = new Fxaa(core, this); + this._brightPassShader = new Bright(core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; } - setSdfBuffer(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET] = value; + _initializeContext(gl) { + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); + const random2 = new PseudoRandom(0); + const _vec3 = create$6(); + for (let i = 0; i < this._config.ssaoKernelSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + _vec3[2] = random2.nextFloat(); + normalize$5(_vec3, _vec3); + scale$5(_vec3, _vec3, random2.nextFloat()); + let scale2 = i / this._config.ssaoKernelSize; + scale2 = MathHelper.lerp(0.1, 1, scale2 * scale2); + scale$5(_vec3, _vec3, scale2); + this._ssaoSampleKernel[i * 3] = _vec3[0]; + this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; + this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; + } + const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); + _vec3[2] = 0; + for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + normalize$5(_vec3, _vec3); + noise[i * 4] = _vec3[0]; + noise[i * 4 + 1] = _vec3[1]; + } + this._ssaoNoiseTexture = this._gl.createTexture(); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); + this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); + this._ssaoWidth = -1; + this._ssaoHeight = -1; + this._shadowWidth = -1; + this._shadowHeight = -1; + this._shaderResources.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._backgroundShader.initializeContext(this._gl); + this._ssaoShader.initializeContext(this._gl); + this._boxShader.initializeContext(this._gl); + this._deferredShader.initializeContext(this._gl); + this._combineShader.initializeContext(this._gl); + this._dofBlurShader.initializeContext(this._gl); + this._downsampleShader.initializeContext(this._gl); + this._gaussianShader.initializeContext(this._gl); + this._dofCombineShader.initializeContext(this._gl); + this._fxaaShader.initializeContext(this._gl); + this._brightPassShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } } - getSdfBorder(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET]; + _resize(width2, height2) { + super._resize(width2, height2); + this._positionTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); + this._colorTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._normalTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._geometryFrameBuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width2, height2); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._gl.drawBuffers([this._gl.COLOR_ATTACHMENT0, this._gl.COLOR_ATTACHMENT1, this._gl.COLOR_ATTACHMENT2]); + this._postProcessTexture1 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessDepthTexture = TextureHelper.create(this._gl, width2, height2, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); + this._postProcessTexture2 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); + this._postProcessDofTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); + this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); + const widthHalf = Math.round(width2 / 2); + const heightHalf = Math.round(height2 / 2); + this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); + this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); + this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); + this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); + const widthSixteenth = Math.round(widthEighth / 2); + const hgeightSixteenth = Math.round(heightEighth / 2); + this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); + this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); } - setSdfBorder(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; + _createContext(canvas) { + let supported = false; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + const options2 = { + stencil: true, + alpha: false, + antialias: false, + preserveDrawingBuffer + }; + const gl = canvas.getContext("webgl2", options2); + if (gl) { + const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); + if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { + const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); + const framebuffer = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + if (status == gl.FRAMEBUFFER_COMPLETE) { + supported = true; + } + gl.bindTexture(gl.TEXTURE_2D, null); + } + } + return supported ? gl : null; } -} -HittableBufferData.SIZE = 36; -class Hittable { - get center0() { - return this._center0; + prepare() { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + break; + } } - get center1() { - return this._center1; + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; } - get time0() { - return this._time0; + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } - get time1() { - return this._time1; + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } - get material() { - return this._material; - } - set material(material) { - this._material = material; - } - get bounds() { - return this._bounds; - } - get offset0() { - return this._offset0; - } - get offset1() { - return this._offset1; - } - constructor(options){ - this._center0 = options.center0; - this._center1 = options.center1; - this._time0 = options.time0; - this._time1 = options.time1; - this._material = options.material; - this._bounds = new (0, _aabbJs.AABB)(); - this._offset0 = (0, _glMatrix.vec3).create(); - this._offset1 = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index, materialId) { - buffer.setCenter0(index, this._center0); - buffer.setCenter1(index, this._center1); - buffer.setTime0(index, this._time0); - buffer.setTime1(index, this._time1); - buffer.setMaterialId(index, materialId); - } -} -class HittableSphere extends Hittable { - get radius() { - return this._radius; - } - constructor(options){ - super(options); - this._radius = options.radius; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._radius, this._center1[1] - this._radius); - max[1] = Math.max(this._center0[1] + this._radius, this._center1[1] + this._radius); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.sphere); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._radius, this._radius)); - } -} -class HittableXyDisk extends Hittable { - get texCoord0() { - return this._texCoord0; + _createLabelVisual(label2) { + return new LabelVisual(this._core, this, label2); } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._radius0 = options.radius0; - this._radius1 = options.radius1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius0, this._center1[0] - this._radius1); - max[0] = Math.max(this._center0[0] + this._radius0, this._center1[0] + this._radius1); - min[1] = Math.min(this._center0[1] - this._radius0, this._center1[1] - this._radius1); - max[1] = Math.max(this._center0[1] + this._radius0, this._center1[1] + this._radius1); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xYDisk); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius0, this._radius0, this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius1, this._radius1, this._thickness)); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableRotatedXyDisk extends HittableXyDisk { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyDisk); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRingSdf extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - this._angle = options.angle0; - this._innerRadius = options.innerRadius0; - this._rounding = options.rounding; - const outerRadius = this._size0[0]; - const innerRadius = this._size0[1]; - const extrudedThicknesses = this._size0[2]; - const min = this._bounds.min; - const max = this._bounds.max; - max[1] = this._center0[1] + outerRadius; - const sinAngle = Math.sin(this._angle); - const cosAngle = Math.cos(this._angle); - if (this._angle < (0, _constantsJs.Constants).PI_OVER_TWO) { - min[0] = this.center0[0] - sinAngle * outerRadius; - max[0] = this.center0[0] + sinAngle * outerRadius; - min[1] = this.center0[1] + cosAngle * innerRadius; - } else { - min[0] = this._center0[0] - outerRadius; - max[0] = this._center0[0] + outerRadius; - min[1] = this._center0[1] + cosAngle * outerRadius; - } - min[2] = this._center0[2] - extrudedThicknesses; - max[2] = this._center0[2] + extrudedThicknesses; - this.offset0[0] = (min[0] + max[0]) / 2 - this._center0[0]; - this.offset0[1] = (min[1] + max[1]) / 2 - this._center0[1]; - this.offset0[2] = (min[2] + max[2]) / 2 - this._center0[2]; - this.offset1[0] = (min[0] + max[0]) / 2 - this._center1[0]; - this.offset1[1] = (min[1] + max[1]) / 2 - this._center1[1]; - this.offset1[2] = (min[2] + max[2]) / 2 - this._center1[2]; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.ringSdf); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - buffer.setParameter1(index, this._angle); - buffer.setParameter2(index, this._innerRadius); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedRingSdf extends HittableRingSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedRingSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableBox extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._size0[2], this._center1[2] - this._size1[2]); - max[2] = Math.max(this._center0[2] + this._size0[2], this._center1[2] + this._size1[2]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.box); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - } -} -class HittableBoxSdf extends HittableBox { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.boxSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedBoxSdf extends HittableBoxSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBoxSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedBox extends HittableBox { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBox); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinder extends Hittable { - get radius() { - return this._radius; + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - this._rotation0 = options.rotation0 || (0, _constantsJs.Constants).QUAT_IDENTITY; - this._rotation1 = options.rotation1 || (0, _constantsJs.Constants).QUAT_IDENTITY; - if (this._rotation0[3] * this._rotation1[3] == 1) { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._height, this._center1[1] - this._height); - max[1] = Math.max(this._center0[1] + this._height, this._center1[1] + this._height); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } else { - const ca0 = (0, _glMatrix.vec3).create(); - const pa0 = (0, _glMatrix.vec3).create(); - const pb0 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation0); - (0, _glMatrix.vec3).scaleAndAdd(pa0, this._center0, ca0, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb0, this._center0, ca0, this._height); - const ca1 = (0, _glMatrix.vec3).create(); - const pa1 = (0, _glMatrix.vec3).create(); - const pb1 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca1, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation1); - (0, _glMatrix.vec3).scaleAndAdd(pa1, this._center1, ca1, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb1, this._center1, ca1, this._height); - this._bounds.fromCylinder(pa0, pb0, this._radius); - const bounds = new (0, _aabbJs.AABB)(); - bounds.fromCylinder(pa1, pb1, this._radius); - const min0 = this._bounds.min; - const max0 = this._bounds.max; - const min1 = bounds.min; - const max1 = bounds.max; - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - } - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinder); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinderSdf extends HittableCylinder { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinderSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableHexPrism extends Hittable { - get radius() { - return this._radius; + createImageVisual(image2) { + const visual = new ImageVisual(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = this._center0[0] - this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - max[0] = this._center0[0] + this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - min[1] = this._center0[1] - this._height; - max[1] = this._center0[1] + this._height; - min[2] = this._center0[2] - this._radius; - max[2] = this._center0[2] + this._radius; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrism); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO, this._height, this._radius)); - } -} -class HittableHexPrismSdf extends HittableHexPrism { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrismSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRect extends Hittable { - get texCoord0() { - return this._texCoord0; + createFontVisual(font2) { + const visual = new FontVisual(this._core, font2); + visual.initializeContext(this._gl); + return visual; } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._size0 = options.size0; - this._size1 = options.size1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - this._setBounds(); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableXyRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xyRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._size0[1], this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._size1[1], this._thickness)); - } -} -class HittableXzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._thickness, this._center1[1] - this._thickness); - max[1] = Math.max(this._center0[1] + this._thickness, this._center1[1] + this._thickness); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._thickness, this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._thickness, this._size1[1])); - } -} -class HittableYzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._thickness, this._center1[0] - this._thickness); - max[0] = Math.max(this._center0[0] + this._thickness, this._center1[0] + this._thickness); - min[1] = Math.min(this._center0[1] - this._size0[0], this._center1[1] - this._size1[0]); - max[1] = Math.max(this._center0[1] + this._size0[0], this._center1[1] + this._size1[0]); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.yzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size0[0], this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size1[0], this._size1[1])); - } -} -class HittableFontXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.fontXyRect); - } -} -class HittableSdfXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.sdfXyRect); - } -} -class HittableRotatedXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyRect); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedFontXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.rotatedFontXyRect); - } -} -class HittableRotatedSdfXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.rotatedSdfXyRect); - } -} -class HittableConstantMedium extends Hittable { - get boundary() { - return this._boundary; - } - constructor(options){ - super(options); - this._boundary = options.boundary; - this._bounds = this._boundary.bounds; - } - toBuffer(buffer, index, materialId) { - this._boundary.toBuffer(buffer, index, materialId); - buffer.setBoundaryType(index, buffer.getType(index)); - buffer.setType(index, HittableType.constantMedium); - } -} - -},{"gl-matrix":"5x28d","../../constants.js":"lD0bG","../../helpers/bounds.js":"beD2A","./aabb.js":"7wAtJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wAtJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AABB", ()=>AABB); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../../meshes/cube.js"); -class AABB { - get min() { - return this._min; - } - get max() { - return this._max; - } - constructor(){ - this._min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - this._max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - } - centroid(centroid) { - centroid[0] = (this._min[0] + this._max[0]) / 2; - centroid[1] = (this._min[1] + this._max[1]) / 2; - centroid[2] = (this._min[2] + this._max[2]) / 2; - } - size(size) { - size[0] = this._max[0] - this._min[0]; - size[1] = this._max[1] - this._min[1]; - size[2] = this._max[2] - this._min[2]; - } - offset(point, normalized) { - normalized[0] = (point[0] - this._min[0]) / (this._max[0] - this._min[0]); - normalized[1] = (point[1] - this._min[1]) / (this._max[1] - this._min[1]); - normalized[2] = (point[2] - this._min[2]) / (this._max[2] - this._min[2]); - } - unionBounds(bounds) { - (0, _glMatrix.vec3).min(this._min, this._min, bounds.min); - (0, _glMatrix.vec3).max(this._max, this._max, bounds.max); - } - unionPoint(point) { - (0, _glMatrix.vec3).min(this._min, this._min, point); - (0, _glMatrix.vec3).max(this._max, this._max, point); - } - maximumExtent() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - if (dx > dy && dx > dz) return 0; - else if (dy > dz) return 1; - return 2; - } - surfaceArea() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - return 2 * (dx * dy + dx * dz + dy * dz); - } - rotate(rotation) { - const sizeX = this._max[0] - this._min[0]; - const sizeY = this._max[1] - this._min[1]; - const sizeZ = this._max[2] - this._min[2]; - const min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - const max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const position = (0, _glMatrix.vec3).create(); - const vertices = (0, _cubeJs.Cube).POSITIONS; - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).copy(this._min, min); - (0, _glMatrix.vec3).copy(this._max, max); - } - fromCylinder(pa, pb, radius) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - this._min[0] = Math.min(pa[0] - ex, pb[0] - ex); - this._min[1] = Math.min(pa[1] - ey, pb[1] - ey); - this._min[2] = Math.min(pa[2] - ez, pb[2] - ez); - this._max[0] = Math.max(pa[0] + ex, pb[0] + ex); - this._max[1] = Math.max(pa[1] + ey, pb[1] + ey); - this._max[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"5x28d","../../meshes/cube.js":"79I5N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cAHlu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ComputeShaderWgsl", ()=>ComputeShaderWgsl); -parcelHelpers.export(exports, "ComputeUniformBufferData", ()=>ComputeUniformBufferData); -var _glMatrix = require("gl-matrix"); -const ComputeShaderWgsl = ` -const PI = 3.1415926535897932385f; -const TWO_PI = 6.2831853071795864769f; -const ROOT_THREE_OVER_TWO = 0.86602540378443864676f; - -struct ColorBuffer { - values: array<f32>, -} - -// (normal.x, normal.y, normal.z, depth) -struct NormalDepthBuffer { - values: array<f32>, -} - -// Min, max -// TODO: Convert to atomic add with uint -struct DepthMinMaxBuffer { - values: array<atomic<u32>>, -} - -struct Ray { - origin: vec3<f32>, - direction: vec3<f32>, - time: f32, -} - -struct HitRecord { - normal: vec3<f32>, - t: f32, - frontFace: bool, - materialId: u32, - uv: vec2<f32>, - id: u32, - previousId: u32, - position: vec3<f32>, - previousPosition: vec3<f32>, - isAbsorbing: bool, - previousIsAbsorbing: bool, - absorption: vec3<f32>, - previousAbsorption: vec3<f32>, - sdfBorder: bool, -} - -struct Camera { - origin: vec3<f32>, - lowerLeftCorner: vec3<f32>, - horizontal: vec3<f32>, - vertical: vec3<f32>, - lookAt: vec3<f32>, - u: vec3<f32>, - v: vec3<f32>, - w: vec3<f32>, - aspectRatio: f32, - viewportWidth: f32, - viewportHeight: f32, - fov: f32, - aperture: f32, - time0: f32, - time1: f32, -} - - // offest align size -struct Uniforms { // ------------------------------ - position: vec3<f32>, // 0 16 12 - width: f32, // 12 4 4 - right: vec3<f32>, // 16 16 12 - height: f32, // 28 4 4 - up: vec3<f32>, // 32 16 12 - seed: f32, // 44 4 4 - forward: vec3<f32>, // 48 16 12 - fov: f32, // 60 4 4 - lookAt: vec3<f32>, // 64 16 12 - aperture: f32, // 76 4 4 - backgroundColor: vec3<f32>, // 80 16 12 - time0: f32, // 92 4 4 - time1: f32, // 96 4 4 - tilesX : f32, // 100 4 4 - tilesY : f32, // 104 4 4 - tileOffsetX : f32, // 108 4 4 - tileOffsetY : f32, // 112 4 4 - raysPerFrame : f32, // 116 4 4 - // padding 120 4 8 - // ------------------------------ - // 16 128 -} - -// id type -// ---------------- -// 0 none -// 1 solidColor -// 2 image -// 3 sdfText -// 4 checker -// 5 grid - // offest align size stride -struct Texture { // --------------------------------------- - color0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - color1: vec3<f32>, // 16 12 12 - // padding 28 12 12 - size0: vec4<f32>, // 32 16 16 - size1: vec4<f32>, // 48 16 16 - clip: vec4<f32>, // 64 16 16 - offset: vec2<f32>, // 80 8 8 -} // --------------------------------------- - // 16 88 96 - -// id type -// --------------- -// 0 lambertian -// 1 metal -// 2 dielectric -// 3 diffuse light -// 4 glossy -// 5 isotropic -// 6 varnitsh - // offest align size stride -struct Material { // --------------------------------------- - typeId: f32, // 0 4 4 - fuzz: f32, // 4 4 4 - refractiveIndex: f32, // 8 4 4 - textureId: f32, // 12 4 4 - color: vec3<f32>, // 16 16 12 - glossiness: f32, // 28 4 4 - idColor: vec4<f32>, // 32 16 16 - density: f32, // 48 4 4 - // --------------------------------------- -} // 16 52 64 - -// id type -// ---------------- -// 0 distant -// 1 sphere -// 2 rect -// 3 disk -// 4 cylinder -// 5 dome - // offest align size stride -struct Light { // --------------------------------------- - rotation: vec4<f32>, // 0 16 16 - center: vec3<f32>, // 16 16 12 - typeId: f32, // 28 4 4 - size: vec3<f32>, // 32 16 12 - // padding 44 4 4 - color: vec3<f32>, // 48 16 12 -} // --------------------------------------- - // 16 60 64 - -// id type -// ---------------- -// 0 sphere -// 1 box -// 2 cylinder -// 3 hexPrism -// 4 rotatedBox -// 5 xyRect -// 6 xzRect -// 7 yzRect -// 8 rotatedXyRect -// 9 fontXyRect -// 10 rotatedFontXyRect -// 11 boxSdf -// 12 cylinderSdf -// 13 hexPrismSdf -// 14 constantMedium -// 15 sdfXyRect -// 16 rotatedSdfXyRect -// 17 rotatedBoxSdf -// 18 xyDisk -// 19 rotatedXyDisk -// 20 ringSdf -// 21 rotatedRingSdf - // offest align size stride -struct Hittable { // --------------------------------------- - center0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - size0: vec3<f32>, // 16 16 12 - materialId: f32, // 28 4 4 - rotation0: vec4<f32>, // 32 16 16 - rotation1: vec4<f32>, // 48 16 16 - texCoord0: vec2<f32>, // 64 8 8 - texCoord1: vec2<f32>, // 72 8 8 - center1: vec3<f32>, // 80 16 12 - rounding: f32, // 92 4 4 - size1: vec3<f32>, // 96 16 12 - boundaryTypeId: f32, // 108 4 4 - time0: f32, // 112 4 4 - time1: f32, // 116 4 4 - texId: f32, // 120 4 4 - sdfBuffer: f32, // 124 4 4 - sdfBorder: f32, // 128 4 4 - parameter1: f32, // 132 4 4 - parameter2: f32, // 136 4 4 - // padding 140 4 4 -} // --------------------------------------- - // 16 144 144 - - // offest align size stride -struct LinearBVHNode { // --------------------------------------- - center: vec3<f32>, // 0 16 12 - primitivesOffset: f32, // 12 4 4 - size: vec3<f32>, // 16 16 12 - secondChildOffset: f32, // 28 4 4 - nPrimitives: f32, // 32 4 4 - axis: f32, // 36 4 4 -} // --------------------------------------- - // 16 40 48 - -struct HittableBuffer { - hittables: array<Hittable>, -} - -struct MaterialBuffer { - materials: array<Material>, -} - -struct TextureBuffer { - textures: array<Texture>, -} - -struct LightBuffer { - lights: array<Light>, -} - -struct LinearBVHNodeBuffer { - nodes: array<LinearBVHNode>, -} - -// Schlick's approximation for reflectance -fn reflectance(cos: f32, refractiveIndex: f32) -> f32 { - var r = (1f - refractiveIndex) / (1f + refractiveIndex); - r = r * r; - return r + (1f - r) * pow(1f - cos, 5f); -} - -fn refraction(uv: vec3<f32>, n: vec3<f32>, etaiOverEtat: f32) -> vec3<f32> { - let cosTheta = min(dot(-uv, n), 1f); - let rOutPerp = etaiOverEtat * (uv + cosTheta * n); - let rOutParallel = -sqrt(abs(1f - dot(rOutPerp, rOutPerp))) * n; - return rOutPerp + rOutParallel; -} - -fn getCamera(uniforms: Uniforms) -> Camera { - var camera: Camera; - camera.aperture = uniforms.aperture; - camera.aspectRatio = uniforms.width / uniforms.height; - camera.fov = uniforms.fov; - camera.viewportHeight = 2f * tan(camera.fov / 2f); - camera.viewportWidth = camera.aspectRatio * camera.viewportHeight; - camera.origin = uniforms.position; - camera.lookAt = uniforms.lookAt; - camera.u = uniforms.right; - camera.v = uniforms.up; - camera.w = uniforms.forward; - let focusDistance = dot(camera.w, camera.origin - camera.lookAt); - camera.horizontal = camera.u * camera.viewportWidth * focusDistance; - camera.vertical = camera.v * camera.viewportHeight * focusDistance; - camera.lowerLeftCorner = camera.origin - camera.horizontal / 2f + camera.vertical / 2f - camera.w * focusDistance; - camera.time0 = uniforms.time0; - camera.time1 = uniforms.time1; - return camera; -} - -fn getCameraRay(camera: Camera, seed: ptr<function, u32>, texCoord: vec2<f32>) -> Ray { - // Depth of field - let rd = camera.aperture * randomInUnitDisk(seed); - let offset = camera.u * rd.x + camera.v * rd.y; - - var ray: Ray; - ray.origin = camera.origin + offset; - ray.direction = normalize(camera.lowerLeftCorner + texCoord.x * camera.horizontal - texCoord.y * camera.vertical - camera.origin - offset); - ray.time = camera.time0 + random(seed) * (camera.time1 - camera.time0); - return ray; -} - -fn degreesToRadians(degrees: f32) -> f32 { - return degrees * PI / 180f; -} - -// See https://www.reedbeta.com/blog/hash-functions-for-gpu-rendering/ -fn random(seed: ptr<function, u32>) -> f32 { - var random = ((*seed >> ((*seed >> 28u) + 4u)) ^ *seed) * 277803737u; - random = (random >> 22u) ^ random; - *seed = *seed * 747796405u + 2891336453u; - return f32(random) / 4294967295f; // [0,1] -} - -fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { - var p: vec2<f32>; - loop { - p = 2f * vec2<f32>(random(seed), random(seed)) - vec2<f32>(1f, 1f); - if (dot(p, p) <= 1f) { break; } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); } - return p; -} - -// fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { -// let t = TWO_PI * random(seed); -// let r = sqrt(random(seed)); -// return r * vec2<f32>(cos(t), sin(t)); -// } - -fn randomInUnitSphere(seed: ptr<function, u32>) -> vec3<f32> { - var p: vec3<f32>; - loop { - p = 2f * vec3<f32>(random(seed), random(seed), random(seed)) - vec3<f32>(1f, 1f, 1f); - if (dot(p, p) <= 1f) { break; } + update(elapsedTime) { + super.update(elapsedTime); + if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { + this._shadowWidth = this._config.shadowWidth; + this._shadowHeight = this._config.shadowHeight; + this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._shadowFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); + this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); + } + if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { + this._ssaoWidth = this._config.ssaoWidth; + this._ssaoHeight = this._config.ssaoHeight; + this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); + this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); + this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); + } + if (this._config.isDofEnabled && this._config.dofAutoFocus) { + this._core.getModelManipulationOrigin(this._modelManipulationOrigin); + this._core.getModelPosition(this._modelPosition); + add$4(this._position, this._modelManipulationOrigin, this._modelPosition); + this._core.camera.getPosition(this._cameraPosition); + subtract(this._position, this._position, this._cameraPosition); + const distance2 = -this._position[2]; + const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); + this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance2, amount); + } } - return p; -} - -fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { - return normalize(randomInUnitSphere(seed)); -} - -// fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { -// let theta = TWO_PI * random(seed); // [0,2Pi] -// let phi = acos(2f * random(seed) - 1f); // [-1,1] -// return vec3<f32>(sin(phi) * cos(theta), sin(phi) * sin(theta), cos(phi)); -// } - -fn rayAt(ray: Ray, t: f32) -> vec3<f32> { - return ray.origin + ray.direction * t; -} - -fn setFaceNormal(ray: Ray, outwardNormal: vec3<f32>, hitRecord: ptr<function, HitRecord>) { - (*hitRecord).frontFace = dot(ray.direction, outwardNormal) < 0f; - (*hitRecord).normal = select(-outwardNormal, outwardNormal, (*hitRecord).frontFace); -} - -// fn hitWorld(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { -// var hitAnything = false; -// var closestSoFar = tMax; -// let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; -// var tempHitRecord: HitRecord; -// for (var i: u32 = 0u; i < arrayLength(&hittableBuffer.hittables); i = i + 1u) { -// if (hit(i, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { -// hitAnything = true; -// closestSoFar = tempHitRecord.t; -// tempHitRecord.materialId = u32(hittableBuffer.hittables[i].materialId); -// *hitRecord = tempHitRecord; -// } -// } -// return hitAnything; -// } - -fn hitBVH(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - var hitAnything = false; - var closestSoFar = tMax; - let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; - var tempHitRecord: HitRecord; - var toVisitOffset = 0u; - var currentNodeIndex = 0u; - var nodesToVisit: array<u32, 64>; - loop { - let node = &linearBVHNodeBuffer.nodes[currentNodeIndex]; - // Check ray against BVH node - if (intersectBox((*node).center, (*node).size, ray, invDir, tMin, closestSoFar)) { - let nPrimitives = u32((*node).nPrimitives); - if (nPrimitives > 0u) { - let primitiveOffset = u32((*node).primitivesOffset); - for (var i: u32 = 0u; i < nPrimitives; i = i + 1u) { - let id = primitiveOffset + i; - if (hit(id, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { - hitAnything = true; - closestSoFar = tempHitRecord.t; - tempHitRecord.materialId = u32(hittableBuffer.hittables[id].materialId); - tempHitRecord.id = id; - } - } - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; + render(elapsedTime) { + return __awaiter$1(this, void 0, void 0, function* () { + this._gl.enable(this._gl.DEPTH_TEST); + this._gl.enable(this._gl.CULL_FACE); + this._gl.cullFace(this._gl.BACK); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); + if (this.config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.clear(this._gl.DEPTH_BUFFER_BIT); + perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); + set$8(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + fromMat4(this._cameraRotation, this.inverseVMatrices[0]); + transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); + add$4(this._position, this._position, this._modelPosition); + lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants$1.VECTOR3_UNITY); + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(transitionBuffer); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.geometryFramebuffer = this._geometryFrameBuffer; + axesVisual.render(elapsedTime); } - else { - // Put far BVH node on nodesToVisit stack, advance to near node - if (ray.direction[u32((*node).axis)] < 0f) { - nodesToVisit[toVisitOffset] = currentNodeIndex + 1u; - currentNodeIndex = u32((*node).secondChildOffset); - } else { - nodesToVisit[toVisitOffset] = u32((*node).secondChildOffset); - currentNodeIndex = currentNodeIndex + 1u; - } - toVisitOffset = toVisitOffset + 1u; + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; + labelSetVisual.render(elapsedTime); } + } } - else { - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.geometryFramebuffer = this._geometryFrameBuffer; + imageVisual.render(elapsedTime); + } + } + } + if (this._backgroundShader.isInitialized) { + this._backgroundShader.prepare(); + this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._backgroundShader.apply(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._gl.bindVertexArray(null); + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$7(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + } else { + set$7(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { + const viewport = this._viewportOffset; + this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set$5(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } } + }); } - if (hitAnything) { - tempHitRecord.previousId = (*hitRecord).id; - tempHitRecord.previousPosition = (*hitRecord).position; - tempHitRecord.previousIsAbsorbing = (*hitRecord).isAbsorbing; - tempHitRecord.previousAbsorption = (*hitRecord).absorption; - *hitRecord = tempHitRecord; - return true; - }; - return false; -} - -fn hit(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - switch u32(hittableBuffer.hittables[id].typeId) { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 5u: { - return hitXyRect(id, ray, tMin, tMax, hitRecord); - } - case 6u: { - return hitXzRect(id, ray, tMin, tMax, hitRecord); - } - // case 7u: { - // return hitYzRect(hittable, ray, tMin, tMax, hitRecord); - // } - case 8u: { - return hitRotatedXyRect(id, ray, tMin, tMax, hitRecord); - } - case 9u: { - return hitFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 10u: { - return hitRotatedFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); - } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); - } - case 14u: { - return hitConstantMedium(id, ray, invDir, tMin, tMax, hitRecord, seed); - } - case 15u: { - return hitSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); - } - case 16u: { - return hitRotatedSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); - } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 18u: { - return hitXyDisk(id, ray, tMin, tMax, hitRecord); - } - case 19u: { - return hitRotatedXyDisk(id, ray, tMin, tMax, hitRecord); + _renderTransitionBuffer(transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = currentBuffer.from; + this._blockShader.rangeMax = currentBuffer.to; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._blockShader.vMatrix = this.vMatrices[viewport]; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = true; + this._blockShader.vMatrix = this._shadowVMatrix; + this._blockShader.pMatrix = this._shadowPMatrix; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.isShadowMap = false; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = currentBuffer.from; + this._sphereShader.rangeMax = currentBuffer.to; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sphereShader.vMatrix = this.vMatrices[viewport]; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = true; + this._sphereShader.vMatrix = this._shadowVMatrix; + this._sphereShader.pMatrix = this._shadowPMatrix; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.isShadowMap = false; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = currentBuffer.from; + this._cylinderShader.rangeMax = currentBuffer.to; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._cylinderShader.vMatrix = this.vMatrices[viewport]; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = true; + this._cylinderShader.vMatrix = this._shadowVMatrix; + this._cylinderShader.pMatrix = this._shadowPMatrix; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.isShadowMap = false; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = currentBuffer.from; + this._sdfShader.rangeMax = currentBuffer.to; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sdfShader.vMatrix = this.vMatrices[viewport]; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = true; + this._sdfShader.vMatrix = this._shadowVMatrix; + this._sdfShader.pMatrix = this._shadowPMatrix; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.isShadowMap = false; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); + } + } + _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { + if (this._deferredShader.isInitialized) { + this._gl.disable(this._gl.DEPTH_TEST); + let ssaoTexture; + if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { + this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); + ssaoTexture = this._ssaoTexture1; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); + this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; + this._ssaoShader.indexBuffer = this._quad.indexBuffer; + this._ssaoShader.texture2D1 = this._positionTexture; + this._ssaoShader.texture2D2 = this._normalTexture; + this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; + this._ssaoShader.prepare(); + this._ssaoShader.pMatrix = pMatrix; + this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; + this._ssaoShader.ssaoRadius = this._config.ssaoRadius; + this._ssaoShader.ssaoPower = this._config.ssaoPower; + this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; + this._ssaoShader.left = 0; + this._ssaoShader.top = 0; + this._ssaoShader.width = this._config.ssaoWidth; + this._ssaoShader.height = this._config.ssaoHeight; + this._ssaoShader.apply(); + this._ssaoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { + ssaoTexture = this._ssaoTexture2; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); + this._boxShader.vertexBuffer = this._quad.vertexBuffer; + this._boxShader.indexBuffer = this._quad.indexBuffer; + this._boxShader.texture2D = this._ssaoTexture1; + this._boxShader.prepare(); + this._boxShader.left = 0; + this._boxShader.top = 0; + this._boxShader.width = this._config.ssaoWidth; + this._boxShader.height = this._config.ssaoHeight; + this._boxShader.apply(); + this._boxShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); + let postProcessFrameBuffer = this._postProcessFrameBuffer1; + this._shaderResources.bindFramebuffer(postProcessFrameBuffer); + this._deferredShader.vertexBuffer = this._quad.vertexBuffer; + this._deferredShader.indexBuffer = this._quad.indexBuffer; + this._deferredShader.texture2D1 = this._positionTexture; + this._deferredShader.texture2D2 = this._colorTexture; + this._deferredShader.texture2D3 = this._normalTexture; + this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; + this._deferredShader.texture2D5 = this._shadowDepthTexture; + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); + this._deferredShader.prepare(); + this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; + this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; + this._deferredShader.inverseVMatrix = inverseVMatrix; + this._deferredShader.shadowVMatrix = this._shadowVMatrix; + this._deferredShader.shadowPMatrix = this._shadowPMatrix; + this._deferredShader.vMatrix = vMatrix; + this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; + this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; + this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; + this._core.camera.getPosition(this._cameraPosition); + fromMat4(this._cameraRotation, vMatrix); + set$8(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + normalize$5(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); + subtract(this._direction, this._cameraPosition, this._position); + normalize$5(this._direction, this._direction); + add$4(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); + normalize$5(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); + copy$6(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); + copy$6(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); + this._deferredShader.left = viewport.left; + this._deferredShader.top = viewport.top; + this._deferredShader.width = viewport.width; + this._deferredShader.height = viewport.height; + this._deferredShader.shadowMapWidth = this._config.shadowWidth; + this._deferredShader.shadowMapHeight = this._config.shadowHeight; + this._deferredShader.ambientIntensity = this._config.ambientIntensity; + this._deferredShader.materialIntensity = this._config.materialIntensity; + this._deferredShader.specularPower = this._config.specularPower; + this._deferredShader.specularIntensity = this._config.specularIntensity; + this._deferredShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + const widthHalf = Math.round(viewport.width / 2); + const heightHalf = Math.round(viewport.height / 2); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + const widthSixteenth = Math.round(widthEighth / 2); + const heightSixteenth = Math.round(heightEighth / 2); + if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; + this._dofBlurShader.indexBuffer = this._quad.indexBuffer; + this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofBlurShader.texture2D2 = this._positionTexture; + this._dofBlurShader.prepare(); + this._dofBlurShader.focusDepth = this._config.dofFocusDistance; + this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; + this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; + this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; + this._dofBlurShader.left = viewport.left; + this._dofBlurShader.top = viewport.top; + this._dofBlurShader.width = viewport.width; + this._dofBlurShader.height = viewport.height; + this._dofBlurShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; + this._dofCombineShader.indexBuffer = this._quad.indexBuffer; + this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofCombineShader.texture2D2 = this._postProcessDofTexture; + this._dofCombineShader.prepare(); + this._dofCombineShader.focusDepth = this._config.dofFocusDistance; + this._dofCombineShader.left = viewport.left; + this._dofCombineShader.top = viewport.top; + this._dofCombineShader.width = viewport.width; + this._dofCombineShader.height = viewport.height; + this._dofCombineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthHalf; + this._brightPassShader.height = heightHalf; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessHalfTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthQuarter; + this._brightPassShader.height = heightQuarter; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessQuarterTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthEighth; + this._brightPassShader.height = heightEighth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessEighthTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthSixteenth; + this._brightPassShader.height = heightSixteenth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessHalfTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthHalf; + this._gaussianShader.height = heightHalf; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessHalfTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessQuarterTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthQuarter; + this._gaussianShader.height = heightQuarter; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessQuarterTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessEighthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthEighth; + this._gaussianShader.height = heightEighth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessEighthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthSixteenth; + this._gaussianShader.height = heightSixteenth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; + this._fxaaShader.indexBuffer = this._quad.indexBuffer; + this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._fxaaShader.prepare(); + this._fxaaShader.left = viewport.left; + this._fxaaShader.top = viewport.top; + this._fxaaShader.width = viewport.width; + this._fxaaShader.height = viewport.height; + this._fxaaShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._combineShader.vertexBuffer = this._quad.vertexBuffer; + this._combineShader.indexBuffer = this._quad.indexBuffer; + this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + if (this._config.isBloomEnabled) { + this._combineShader.texture2D2 = this._postProcessHalfTexture1; + this._combineShader.texture2D3 = this._postProcessQuarterTexture1; + this._combineShader.texture2D4 = this._postProcessEighthTexture1; + this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; + } else { + this._combineShader.texture2D2 = null; + this._combineShader.texture2D3 = null; + this._combineShader.texture2D4 = null; + this._combineShader.texture2D5 = null; + } + this._combineShader.prepare(); + this._combineShader.viewport = viewport; + this._combineShader.intensity = this._config.bloomIntensity; + this._combineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }); + class MaterialBufferData extends Float32Array { + constructor(count2) { + super(count2 * MaterialBufferData.SIZE); + this.TYPE_OFFSET = 0 / 4; + this.FUZZ_OFFSET = 4 / 4; + this.REFRACTIVE_INDEX_OFFSET = 8 / 4; + this.TEXTURE_ID_OFFSET = 12 / 4; + this.COLOR_OFFSET = 16 / 4; + this.GLOSSINESS_OFFSET = 28 / 4; + this.ID_COLOR_OFFSET = 32 / 4; + this.DENSITY_OFFSET = 48 / 4; } -} - -fn intersectBox(center: vec3<f32>, size: vec3<f32>, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32) -> bool { - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t0 = -n - k; - let t1 = -n + k; - let tNear = max(max(t0.x, t0.y), t0.z); - let tFar = min(min(t1.x, t1.y), t1.z); - if (tNear > tFar) { return false; } - return tNear < tMax && tFar > 0f; // Must return true when inside box, even if closestSoFar is closer than far box intersection -} - -fn hitConstantMedium(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let constantMedium = &hittableBuffer.hittables[id]; - let boundaryTypeId = u32((*constantMedium).boundaryTypeId); - var tempHitRecord1: HitRecord; - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, -100f, 100f, &tempHitRecord1)) { return false; } - var tempHitRecord2: HitRecord; - // When raymarching narrow grazing angles, adding SHADOW_OFFSET is < epsilon from surface, so hit function returns tN not tF, hence distanceInsideBoundary is incorrect - // Add larger distance to t - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, tempHitRecord1.t + 0.001f, 100f, &tempHitRecord2)) { return false; } - if (tempHitRecord1.t < tMin) { tempHitRecord1.t = tMin; } - if (tempHitRecord2.t > tMax) { tempHitRecord2.t = tMax; } - if (tempHitRecord1.t >= tempHitRecord2.t) { - return false; + getType(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET]; } - tempHitRecord1.t = max(tempHitRecord1.t, 0f); - let distanceInsideBoundary = tempHitRecord2.t - tempHitRecord1.t; - let negativeInverseDensity = -1f / materialBuffer.materials[u32((*constantMedium).materialId)].density; - let hitDistance = negativeInverseDensity * log(random(seed)); - if (hitDistance > distanceInsideBoundary) { return false; } - let t = tempHitRecord1.t + hitDistance; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - return true; -} - -fn hitConstantMediumBoundary(id: u32, boundaryTypeId: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - switch boundaryTypeId { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); - } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); - } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); - } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); - } - } -} - -fn hitSphere(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let sphere = &hittableBuffer.hittables[id]; - let radius = (*sphere).size0.x; - let time = min(max((ray.time - (*sphere).time0) / ((*sphere).time1 - (*sphere).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*sphere).center0 + time * ((*sphere).center1 - (*sphere).center0); - let oc = ray.origin - center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - h = sqrt(h); - - // Find the nearest root in range - var root = -b - h; - if (root < tMin || root > tMax) { - root = -b + h; - if (root < tMin || root > tMax) { return false; } - } - - // (*hitRecord).t = root; - // (*hitRecord).position = rayAt(ray, root); - // let outwardNormal = ((*hitRecord).position - center) / radius; - // setFaceNormal(ray, outwardNormal, hitRecord); - - // Reduce precision error in t by ensuring hit position is on sphere surface - let outwardNormal = normalize(ray.origin + ray.direction * root - center); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + outwardNormal * radius; // Use outward normal with internal reflection - (*hitRecord).t = root; // I should also re-calculate t, but this would involve another normalization. t is only used to check closest hit, so only important with overlapping geometry - - // UV - let phi = atan2(outwardNormal.x, outwardNormal.z); // [-pi,pi] - let theta = asin(outwardNormal.y); // [-pi/2, pi/2] - (*hitRecord).uv = vec2<f32>(phi / TWO_PI + 0.5f, theta / PI + 0.5f); // [0,1] - return true; -} - -fn hitBox(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let box = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*box).time0) / ((*box).time1 - (*box).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*box).center0 + time * ((*box).center1 - (*box).center0); - let size = (*box).size0 + time * ((*box).size1 - (*box).size0); - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t1 = -n - k; - let t2 = -n + k; - let tNear = max(max(t1.x, t1.y), t1.z); - let tFar = min(min(t2.x, t2.y), t2.z); - // if (tFar <= tNear) { return false; } - if (tNear > tFar || tFar < 0f) { return false; } - - // Find nearest root in range - var outwardNormal: vec3<f32>; - var root = tNear; - if (root < tMin || root > tMax) { - root = tFar; - if (root < tMin || root > tMax) { return false; } - outwardNormal = sign(ray.direction) * step(t2.xyz, t2.yzx) * step(t2.xyz, t2.zxy); + setType(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; } - else { - outwardNormal = -sign(ray.direction) * step(t1.yzx, t1.xyz) * step(t1.zxy, t1.xyz); + getFuzz(index2) { + return this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET]; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedBox(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBox = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBox).time0) / ((*rotatedBox).time1 - (*rotatedBox).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBox).center0 + time * ((*rotatedBox).center1 - (*rotatedBox).center0); - let rotation = slerpQuat((*rotatedBox).rotation0, (*rotatedBox).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let rotatedInvDir = vec3<f32>(1f, 1f, 1f) / rotatedRay.direction; - let hit = hitBox(id, rotatedRay, rotatedInvDir, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setFuzz(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET] = value2; } - return false; -} - -fn hitXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyDisk = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyDisk).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let radius = (*xyDisk).size0.x; - if (dot(p, p) > radius * radius) { return false; } // dot(p, p) is squared distance from disk center to intersection point - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / radius + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyDisk).texCoord0; - let texCoord1 = (*xyDisk).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyDisk = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyDisk).center0; - let time = min(max((ray.time - (*rotatedXyDisk).time0) / ((*rotatedXyDisk).time1 - (*rotatedXyDisk).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyDisk).center0 + time * ((*rotatedXyDisk).center1 - (*rotatedXyDisk).center0); - let rotation = slerpQuat((*rotatedXyDisk).rotation0, (*rotatedXyDisk).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyDisk(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getRefractiveIndex(index2) { + return this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET]; } - return false; -} - -fn hitXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyRect).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setRefractiveIndex(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET] = value2; } - return false; -} - -fn hitXzRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xzRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xzRect).center0; - - // Distance to plane, t - let t = -oc.y / ray.direction.y; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xzRect).size0; - if (abs(p.x) > size.x || abs(p.z) > size.z) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xz / size.xz + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xzRect).texCoord0; - let texCoord1 = (*xzRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 1f, 0f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -// fn hitYzRect(yzRect: Hittable, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { -// let oc = ray.origin - yzRect.center0; - -// // Distance to plane, t -// let t = -oc.x / ray.direction.x; - -// // If direction == 0, t = +/- infinity, which always returns false -// if (t < tMin || t > tMax) { return false; } - -// // Intersection point in model space -// let p = oc + t * ray.direction; - -// // Bounds -// if (abs(p.y) > yzRect.size0.y || abs(p.z) > yzRect.size0.z) { return false; } - -// // Texture coords -// var uv = vec2<f32>(0.5 * p.yz / yzRect.size0.yz + vec2<f32>(0.5f, 0.5f)); -// uv = yzRect.texCoord0 + uv * (yzRect.texCoord1 - yzRect.texCoord0); - -// (*hitRecord).uv = uv; -// (*hitRecord).t = t; -// (*hitRecord).position = rayAt(ray, t); -// let outwardNormal = vec3<f32>(1f, 0f, 0f); -// setFaceNormal(ray, outwardNormal, hitRecord); -// return true; -// } - -// TODO: Share hit function with XyRect -fn hitFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - let r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - if (r < buffer) { return false; } - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitFontXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getTextureId(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET]; } - return false; -} - -// TODO: Share hit function with FontXyRect, specifying texture -fn hitSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - // let size = (*xyRect).size0; - let size = (*xyRect).size0 + time * ((*xyRect).size1 - (*xyRect).size0); - if (abs(p.x) > (*xyRect).size0.x || abs(p.y) > (*xyRect).size0.y) { return false; } - - // Zero-thickness transparency - // TODO: Pre-multiplied alpha - // if (random(seed) > 0.5f) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - // let r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; - var r: f32; - if ((*xyRect).texId == 0f) { - r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; + setTextureId(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET] = value2; } - else { - r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - } - if (r < buffer) { return false; } - - // sdfBorder - let border = xyRect.sdfBorder / 0xff; - (*hitRecord).sdfBorder = r - buffer < border; - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitSdfXyRect(id, rotatedRay, tMin, tMax, hitRecord, seed); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - return false; -} - -fn rotateQuat(v: vec3<f32>, q: vec4<f32>) -> vec3<f32> { - return v + 2f * cross(q.xyz, cross(q.xyz, v) + q.w * v); -} - -fn slerpQuat(q0: vec4<f32>, q1: vec4<f32>, t: f32) -> vec4<f32> { - var cosom = dot(q0, q1); - var q2 = q1; - if (cosom < 0f) { - cosom = -cosom; - q2 = -q2; - } - var s0: f32; - var s1: f32; - if (1f - cosom > 0.000001f) { - // SLERP - let omega = acos(cosom); - let sinom = sin(omega); - s0 = sin((1f - t) * omega) / sinom; - s1 = sin(t * omega) / sinom; - } - else { - // Quaternions close enough for LERP - s0 = 1f - t; - s1 = t; - } - return s0 * q0 + s1 * q2; -} - -fn conjugate(q: vec4<f32>) -> vec4<f32> { - return vec4<f32>(-q.x, -q.y, -q.z, q.w); -} - -fn hitCylinder(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinder = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinder).time0) / ((*cylinder).time1 - (*cylinder).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinder).center0 + time * ((*cylinder).center1 - (*cylinder).center0); - let size = (*cylinder).size0 + time * ((*cylinder).size1 - (*cylinder).size0); - let rotation = slerpQuat((*cylinder).rotation0, (*cylinder).rotation1, time); - let ra = size.x; // Radius - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let oc = ray.origin - center; - let card = dot(ca, ray.direction); - let caoc = dot(ca, oc); - let a = 1f - card * card; - let b = dot(oc, ray.direction) - caoc * card; - let c = dot(oc, oc) - caoc * caoc - ra * ra; - var h = b * b - a * c; - if (h < 0f) { return false; } - h = sqrt(h); - let br0 = (-b - h) / a; - let br1 = (-b + h) / a; - - // Body - let ch = size.y; // Half-height - let y0 = caoc + br0 * card; - let y1 = caoc + br1 * card; - let bt0 = select(10000000f, br0, abs(y0) < ch); - let bt1 = select(-10000000f, br1, abs(y1) < ch); - - // Caps - let sy0 = sign(y0); - let sy1 = sign(y1); - let cr0 = (sy0 * ch - caoc) / card; - let cr1 = (sy1 * ch - caoc) / card; - let ct0 = select(10000000f, cr0, abs(b + a * cr0) < h); - let ct1 = select(-10000000f, cr1, abs(b + a * cr1) < h); - - // Find the nearest root in range - let tN = min(bt0, ct0); - let tF = max(bt1, ct1); - var root = tN; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - } - - // Normal - var outwardNormal: vec3<f32>; - if (root == bt0 || root == bt1) { - let y = select(y1, y0, root == bt0); - // outwardNormal = (oc + root * ray.direction - ca * y) / ra; - - // Reduce precision error in t by ensuring hit position is on cylinder surface - outwardNormal = normalize(oc + root * ray.direction - ca * y); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + ca * y + outwardNormal * ra; // Use outward normal with internal reflection - (*hitRecord).t = root; + setColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - else { - let sy = select(sy1, sy0, root == ct0); - outwardNormal = ca * sy; - - // TODO: Reduce precision error - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = rayAt(ray, root); - (*hitRecord).t = root; - } - - // setFaceNormal(ray, outwardNormal, hitRecord); - // (*hitRecord).position = rayAt(ray, root); - // (*hitRecord).t = root; - return true; -} - -fn hitHexPrism(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrism = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*hexPrism).time0) / ((*hexPrism).time1 - (*hexPrism).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrism).center0 + time * ((*hexPrism).center1 - (*hexPrism).center0); - let oc = ray.origin - center; - let size = (*hexPrism).size0; - let ra = size.x; // Distance from center to edge - let he = size.y; // Half-height - let rd = ray.direction; - - // Normals - let n1 = vec3<f32>(1f, 0f, 0f); - let n2 = vec3<f32>(0.5f, 0f, ROOT_THREE_OVER_TWO); - let n3 = vec3<f32>(-0.5f, 0f, ROOT_THREE_OVER_TWO); - let n4 = vec3<f32>(0f, 1f, 0f); - - // Slabs intersections - var t1 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n1)) / dot(rd, n1), 1f); - var t2 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n2)) / dot(rd, n2), 1f); - var t3 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n3)) / dot(rd, n3), 1f); - var t4 = vec3<f32>((vec2<f32>(he, -he) - dot(oc, n4)) / dot(rd, n4), 1f); - - // Inetsection selection - if (t1.y < t1.x) { t1 = vec3<f32>(t1.yx, -1f); } - if (t2.y < t2.x) { t2 = vec3<f32>(t2.yx, -1f); } - if (t3.y < t3.x) { t3 = vec3<f32>(t3.yx, -1f); } - if (t4.y < t4.x) { t4 = vec3<f32>(t4.yx, -1f); } - - var tN = vec4<f32>(t1.x, t1.z * n1); - if (t2.x > tN.x) { tN = vec4<f32>(t2.x, t2.z * n2); } - if (t3.x > tN.x) { tN = vec4<f32>(t3.x, t3.z * n3); } - if (t4.x > tN.x) { tN = vec4<f32>(t4.x, t4.z * n4); } - - let tF = min(min(t1.y,t2.y),min(t3.y,t4.y)); - - if (tN.x > tF || tF < 0f) { return false; } - - // Find the nearest root in range - var outwardNormal: vec3<f32>; - var root = tN.x; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - - // Normal - if (root == t1.y) { outwardNormal = -t1.z * n1; } - else if (root == t2.y) { outwardNormal = -t2.z * n2; } - else if (root == t3.y) { outwardNormal = -t3.z * n3; } - else if (root == t4.y) { outwardNormal = -t4.z * n4; } + getGlossiness(index2) { + return this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET]; } - else { - outwardNormal = tN.yzw; + setGlossiness(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET] = value2; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { - let q = abs(p) - b; - return length(max(q, vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y, q.z)), 0f) - r; -} - -// Box frame -// fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { -// let s = abs(p) - b; -// // let e = b.y / 3f; -// let e = 0.0002f; -// let q = abs(s + e) - e; -// return min(min( -// length(max(vec3<f32>(s.x, q.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(s.x, max(q.y,q.z)), 0f), -// length(max(vec3<f32>(q.x, s.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(s.y,q.z)), 0f)), -// length(max(vec3<f32>(q.x, q.y, s.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y,s.z)), 0f)); -// } - -fn hitBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let boxSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*boxSdf).rounding; - // let size = (*boxSdf).size0 - r; - let time = min(max((ray.time - (*boxSdf).time0) / ((*boxSdf).time1 - (*boxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*boxSdf).center0 + time * ((*boxSdf).center1 - (*boxSdf).center0); - // TODO: r0, r1 - let size = (*boxSdf).size0 + time * ((*boxSdf).size1 - (*boxSdf).size0) - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapBoxSdf(oc, size, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapBoxSdf(oc + k.xyy * h, size, r) + - k.yyx * mapBoxSdf(oc + k.yyx * h, size, r) + - k.yxy * mapBoxSdf(oc + k.yxy * h, size, r) + - k.xxx * mapBoxSdf(oc + k.xxx * h, size, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getDensity(index2) { + return this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET]; } - return false; -} - -fn hitRotatedBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBoxSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBoxSdf).time0) / ((*rotatedBoxSdf).time1 - (*rotatedBoxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBoxSdf).center0 + time * ((*rotatedBoxSdf).center1 - (*rotatedBoxSdf).center0); - let rotation = slerpQuat((*rotatedBoxSdf).rotation0, (*rotatedBoxSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitBoxSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setDensity(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET] = value2; } - return false; -} - -fn mapCylinderSdf(p: vec3<f32>, a: vec3<f32>, b: vec3<f32>, r0: f32, r1: f32) -> f32 { - let ba: vec3<f32> = b - a; - let pa: vec3<f32> = p - a; - let baba: f32 = dot(ba, ba); - let paba: f32 = dot(pa, ba); - let x: f32 = length(pa * baba - ba * paba) - r0 * baba; - let y: f32 = abs(paba - baba * 0.5f) - baba * 0.5f; - let x2: f32 = x * x; - let y2: f32 = y * y * baba; - // let d: f32 = (max(x, y) < 0f) ? -min(x2, y2) : (((x > 0f) ? x2 : 0f) + ((y > 0f) ? y2 : 0f)); - let d: f32 = select(select(0f, x2, x > 0f) + select(0f, y2, y > 0f), -min(x2, y2), max(x, y) < 0f); - return sign(d) * sqrt(abs(d)) / baba - r1; -} - -fn hitCylinderSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinderSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinderSdf).time0) / ((*cylinderSdf).time1 - (*cylinderSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinderSdf).center0 + time * ((*cylinderSdf).center1 - (*cylinderSdf).center0); - let size = (*cylinderSdf).size0 + time * ((*cylinderSdf).size1 - (*cylinderSdf).size0); - let rotation = slerpQuat((*cylinderSdf).rotation0, (*cylinderSdf).rotation1, time); - var t = tMin; - let r1 = (*cylinderSdf).rounding; - let r0 = size.x - r1; - let h0 = size.y - r1; - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let pa = ca * h0; - let pb = -pa; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapCylinderSdf(oc, pa, pb, r0, r1)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapCylinderSdf(oc + k.xyy * h, pa, pb, r0, r1) + - k.yyx * mapCylinderSdf(oc + k.yyx * h, pa, pb, r0, r1) + - k.yxy * mapCylinderSdf(oc + k.yxy * h, pa, pb, r0, r1) + - k.xxx * mapCylinderSdf(oc + k.xxx * h, pa, pb, r0, r1)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); } - return false; -} - -fn mapHexPrismSdf(p: vec3<f32>, hx: f32, hy: f32, r: f32) -> f32 { - let k = vec3<f32>(-0.8660254, 0.5, 0.57735); // (-sqrt(3)/2 or sin(60), 0.5, sqrt(3)/3 or tan(30)) - var p0 = abs(p.zxy); - let p1 = p0.xy - 2f * min(dot(k.xy, p0.xy), 0f) * k.xy; - let d = vec2<f32>(length(p1.xy - vec2(clamp(p1.x, -k.z * hx, k.z * hx), hx)) * sign(p1.y - hx), p0.z - hy); - return min(max(d.x, d.y), 0f) + length(max(d, vec2<f32>(0f, 0f))) - r; -} - -fn hitHexPrismSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrismSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*hexPrismSdf).rounding; - let size = (*hexPrismSdf).size0; - let time = min(max((ray.time - (*hexPrismSdf).time0) / ((*hexPrismSdf).time1 - (*hexPrismSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrismSdf).center0 + time * ((*hexPrismSdf).center1 - (*hexPrismSdf).center0); - let hx = size.x - r; - let hy = size.y - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapHexPrismSdf(oc, hx, hy, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // Replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapHexPrismSdf(oc + k.xyy * h, hx, hy, r) + - k.yyx * mapHexPrismSdf(oc + k.yyx * h, hx, hy, r) + - k.yxy * mapHexPrismSdf(oc + k.yxy * h, hx, hy, r) + - k.xxx * mapHexPrismSdf(oc + k.xxx * h, hx, hy, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + setIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; } - return false; -} - -fn mapRingSdf(p: vec3<f32>, n: vec2<f32>, r: f32, th: f32, h: f32, rounding: f32) -> f32 { - let px = abs(p.x); - // expand result of mat2x2(n.x,n.y,-n.y,n.x)*p; - // let p2 = vec2<f32>(n.x * px + n.y * p.y, -n.y * px + n.x * p.y); - // Column-major instead of row-major - let p2 = vec2<f32>(n.x * px - n.y * p.y, n.y * px + n.x * p.y); - let d = max(abs(length(p2) - r) - th * 0.5f, length(vec2<f32>(p2.x, max(0f, abs(r - p2.y) - th * 0.5f))) * sign(p2.x)); - - // Extrude - let w = vec2<f32>(d, abs(p.z) - h); - return min(max(w.x, w.y), 0f) + length(max(w, vec2<f32>(0f, 0f))) - rounding; -} - -fn hitRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let ringSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let size = (*ringSdf).size0; - let center = (*ringSdf).center0; - let rounding = (*ringSdf).rounding; - let outerr = size.x; - let innerr = size.y; - // Reduce angle such that inner radius arc reduces by rounding - var angle = (*ringSdf).parameter1; - angle -= angle * rounding / innerr * PI * 2; - let cs = vec2<f32>(cos(angle), sin(angle)); - let r = (outerr + innerr) * 0.5f; - let th = (outerr - innerr) - rounding; - let e = size.z - rounding; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapRingSdf(oc, cs, r, th, e, rounding)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.00001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapRingSdf(oc + k.xyy * h, cs, r, th, e, rounding) + - k.yyx * mapRingSdf(oc + k.yyx * h, cs, r, th, e, rounding) + - k.yxy * mapRingSdf(oc + k.yxy * h, cs, r, th, e, rounding) + - k.xxx * mapRingSdf(oc + k.xxx * h, cs, r, th, e, rounding)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + } + MaterialBufferData.SIZE = 64 / 4; + class TextureBufferData extends Float32Array { + constructor(count2) { + super(count2 * TextureBufferData.SIZE); + this.COLOR0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.COLOR1_OFFSET = 16 / 4; + this.SIZE0_OFFSET = 32 / 4; + this.SIZE1_OFFSET = 48 / 4; + this.CLIP_OFFSET = 64 / 4; + this.OFFSET_OFFSET = 80 / 4; + } + getType(index2) { + return this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + set$7(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + set$5(value2, this[offset2], this[offset2 + 1]); + } + setOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; } - return false; -} - -fn hitRotatedRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedRingSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedRingSdf).time0) / ((*rotatedRingSdf).time1 - (*rotatedRingSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedRingSdf).center0 + time * ((*rotatedRingSdf).center1 - (*rotatedRingSdf).center0); - let rotation = slerpQuat((*rotatedRingSdf).rotation0, (*rotatedRingSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitRingSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + } + TextureBufferData.SIZE = 96 / 4; + class HittableBufferData extends Float32Array { + constructor(count2) { + super(count2 * HittableBufferData.SIZE); + this.CENTER0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.SIZE0_OFFSET = 16 / 4; + this.MATERIAL_ID_OFFSET = 28 / 4; + this.ROTATION0_OFFSET = 32 / 4; + this.ROTATION1_OFFSET = 48 / 4; + this.TEXCOORD0_OFFSET = 64 / 4; + this.TEXCOORD1_OFFSET = 72 / 4; + this.CENTER1_OFFSET = 80 / 4; + this.ROUNDING_OFFSET = 92 / 4; + this.SIZE1_OFFSET = 96 / 4; + this.BOUNDARY_TYPE_OFFSET = 108 / 4; + this.TIME0_OFFSET = 112 / 4; + this.TIME1_OFFSET = 116 / 4; + this.TEX_ID_OFFSET = 120 / 4; + this.SDF_BUFFER_OFFSET = 124 / 4; + this.SDF_BORDER_OFFSET = 128 / 4; + this.PARAMETER_1_OFFSET = 132 / 4; + this.PARAMETER_2_OFFSET = 136 / 4; + this.MATERIAL_FUZZ_OFFSET = 140 / 4; + this.MATERIAL_GLOSS_OFFSET = 144 / 4; + this.MATERIAL_DENSITY_OFFSET = 148 / 4; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; + this.MATERIAL_COLOR_OFFSET = 160 / 4; + this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; + this.SEGMENT_COLOR_OFFSET = 176 / 4; + this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; + this.TEXTURE_ID_OFFSET = 196 / 4; + } + getType(index2) { + return this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getTime0(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET]; + } + setTime0(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET] = value2; + } + getTime1(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET]; + } + setTime1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET] = value2; + } + getSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + set$5(value2, this[offset2], this[offset2 + 1]); + } + setTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; } - return false; -} - -fn hitLights(ray: Ray) -> vec3<f32> { - var hit: bool; - for (var i: u32 = 0u; i < arrayLength(&lightBuffer.lights); i = i + 1u) { - // let light = lightBuffer.lights[i]; - switch u32(lightBuffer.lights[i].typeId) { - default: { - hit = hitSphereLight(i, ray); - } - case 2u: { - hit = hitRectLight(i, ray); - } - } - if (hit) { - return lightBuffer.lights[i].color; - } - } - - // Background color - // return vec3<f32>(0f, 0f, 0f); - // return vec3<f32>(1f, 1f, 1f); - return uniforms.backgroundColor; - - // TODO: Dome light - // let t = 0.5f * (ray.direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return background; -} - -fn hitSphereLight(id: u32, ray: Ray) -> bool { - let sphere = &lightBuffer.lights[id]; - let radius = (*sphere).size.x; - let oc = ray.origin - (*sphere).center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - return b < 0f; // Ensure ray towards light -} - -fn hitRectLight(id: u32, ray: Ray) -> bool { - let rotatedXyRect = &lightBuffer.lights[id]; - let center = (*rotatedXyRect).center; - let rotation = (*rotatedXyRect).rotation; - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - if (dot(rotatedRay.direction, vec3<f32>(0f, 0f, 1f)) < 0f) { return false; } // Directional light - let oc = rotatedRay.origin - center; - let t = -oc.z / rotatedRay.direction.z; - if (t < 0f) { return false; } - let p = oc + t * rotatedRay.direction; - if (abs(p.x) > (*rotatedXyRect).size.x || abs(p.y) > (*rotatedXyRect).size.y) { return false; } - return true; -} - -fn nearZero(v: vec3<f32>) -> bool { - return max(max(abs(v.x), abs(v.y)), abs(v.z)) < 0.00000001f; // 1e-8 -} - -fn scatterLambertian(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let scatterDirection = hitRecord.normal + randomUnitVector(seed); - - // Catch degenerate scatter direction - (*ray).direction = select(normalize(scatterDirection), hitRecord.normal, nearZero(scatterDirection)); - - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - return true; -} - -fn scatterMetal(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + materialBuffer.materials[hitRecord.materialId].fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; -} - -fn scatterGlossy(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Specular - let material = &materialBuffer.materials[hitRecord.materialId]; - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - if (reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + (*material).fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; + getTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + set$5(value2, this[offset2], this[offset2 + 1]); } - else { - // Lambertian - return scatterLambertian(ray, hitRecord, attenuation, seed); - } -} - -fn scatterDielectric(ray: ptr<function, Ray>, hitRecord: ptr<function, HitRecord>, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let material = &materialBuffer.materials[(*hitRecord).materialId]; - let refractiveIndex = (*material).refractiveIndex; - // TODO: If still inside another material, use its refractive index - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, (*hitRecord).frontFace); - let cosTheta = min(dot(-(*ray).direction, (*hitRecord).normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - // if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - if (cannotRefract || reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = reflect((*ray).direction, (*hitRecord).normal); + setTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; } - else { - (*ray).direction = refraction((*ray).direction, (*hitRecord).normal, refractionRatio); - } - (*ray).origin = (*hitRecord).position; - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); - - // Did the ray enter/stay inside? - (*attenuation) = vec3<f32>(1f, 1f, 1f); - // if (dot((*ray).direction, (*hitRecord).normal) < 0f) { - if (dot((*ray).direction, select(-(*hitRecord).normal, (*hitRecord).normal, (*hitRecord).frontFace)) < 0f) { - (*hitRecord).isAbsorbing = true; - (*hitRecord).absorption = (*material).color; - - // If already inside another absorbing dielectric, add to absorption - if ((*hitRecord).previousIsAbsorbing && (*hitRecord).id != (*hitRecord).previousId) { - (*hitRecord).absorption = (*hitRecord).absorption + (*hitRecord).previousAbsorption; - } + getRounding(index2) { + return this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET]; } - return true; -} - -fn scatterIsotropic(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = randomUnitVector(seed); - (*ray).origin = hitRecord.position; - (*attenuation) = materialBuffer.materials[hitRecord.materialId].color; - return true; -} - -fn scatterVarnish(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Front-face only (no internal reflection or refraction) - let material = &materialBuffer.materials[hitRecord.materialId]; - if (hitRecord.frontFace && (*material).glossiness > random(seed)) { - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - (*ray).direction = reflect((*ray).direction, hitRecord.normal); - } - else { - // Refraction improves definition at edges and deepens color on faces - (*ray).direction = refraction((*ray).direction, hitRecord.normal, refractionRatio); - } - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); + setRounding(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET] = value2; } - // Pass-through - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - return true; -} - -fn textureValue(hitRecord: HitRecord) -> vec3<f32> { - let textureId = materialBuffer.materials[hitRecord.materialId].textureId; - let texture = &textureBuffer.textures[u32(textureId)]; - switch u32((*texture).typeId) { - // No texture - default: { - return vec3<f32>(); - } - // Solid color - case 1u: { - if (hitRecord.sdfBorder) { - return (*texture).color1; - } - else { - return (*texture).color0; - } - - // Debug uv - // return vec3<f32>(hitRecord.uv, 0f); - } - // Image - case 2u: { - // Sample in linear space - return textureSampleLevel(backgroundTexture, linearSampler, hitRecord.uv, 0f).rgb; - // return vec3(hitRecord.uv.x, hitRecord.uv.y, 0f); - } - // Checker - case 4u: { - let q = trunc((hitRecord.uv + (*texture).offset) / (*texture).size0.xy); - return select((*texture).color0, (*texture).color1, (q.x + q.y) % 2f > 0f); - } - // Grid - case 5u: { - let size0 = (*texture).size0; - let size1 = (*texture).size1; - let clip = (*texture).clip; - if (hitRecord.uv.x < clip.x || hitRecord.uv.y < clip.y || hitRecord.uv.x > clip.z || hitRecord.uv.y > clip.w) { - return (*texture).color1; - } - let uv = hitRecord.uv + (*texture).offset; - var d = uv / size0.xy; - d = abs(d - round(d)) * size0.xy; - if (d.x < size1.x || d.y < size1.y) { - return (*texture).color0; - } - else { - d = uv / size0.zw; - d = abs(d - round(d)) * size0.zw; - if (d.x < size1.z || d.y < size1.w) { - return (*texture).color0; - } - return (*texture).color1; - } - } + getParameter1(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET]; } -} - -fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { - let maxDepth = 16u; // TODO: Pass as uniform - var depth = 0u; - // var result: Color; - var color = vec3<f32>(1f, 1f, 1f); - var attenuation = vec3<f32>(1f, 1f, 1f); - var emitted = vec3<f32>(0f, 0f, 0f); - var hitRecord: HitRecord; - hitRecord.id = 4294967295; // -1 as u32 - var scatter: bool; - loop { - // if (hitWorld(*ray, 0.00001f, 100f, &hitRecord, seed)) { - if (hitBVH(*ray, 0.00001f, 100f, &hitRecord, seed)) { - // Debug normal, depth - // First hit - // if (depth == 0u) { - // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - // // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f) - // // result.depth = 1f / hitRecord.t; - // result.depth = -1f / dot(hitRecord.position - (*ray).origin, uniforms.forward); - // } - // return result; - - // Depth - depth = depth + 1u; - if (depth == maxDepth) { - // Exceeded bounce limit, no more light is gathered - // result.color = vec3<f32>(0f, 0f, 0f); - // return result; - return vec3<f32>(0f, 0f, 0f); - } - - // Bounce - // If last hit was travelling INTO a dielectric, use last hit position to calculate distance - // and apply Beer's law to attenuate the light. Modify the dielectric scattering function to - // recrord travelling INTO a dielectric based on hitRecord normal and ray direction. - // Reset this flag each time here. - if (hitRecord.previousIsAbsorbing) { - // Beer's law - let d = distance(hitRecord.previousPosition, hitRecord.position); - color = color * exp(-d * hitRecord.previousAbsorption); - } - // Reset absorption - hitRecord.isAbsorbing = false; - hitRecord.absorption = vec3<f32>(0f, 0f, 0f); - switch u32(materialBuffer.materials[hitRecord.materialId].typeId) { - default: { - scatter = false; - } - case 0u: { - scatter = scatterLambertian(ray, hitRecord, &attenuation, seed); - } - case 1u: { - scatter = scatterMetal(ray, hitRecord, &attenuation, seed); - } - case 2u: { - scatter = scatterDielectric(ray, &hitRecord, &attenuation, seed); - } - case 3u: { - scatter = scatterGlossy(ray, hitRecord, &attenuation, seed); - } - case 4u: { - // Diffuse light - scatter = false; - emitted = materialBuffer.materials[hitRecord.materialId].color; - } - case 5u: { - scatter = scatterIsotropic(ray, hitRecord, &attenuation, seed); - } - case 6u: { - scatter = scatterVarnish(ray, hitRecord, &attenuation, seed); - } - } - - if (scatter) { - // Attenuate - color = color * attenuation; - } - else { - // Emit - // result.color = color * emitted; - // return result; - return color * emitted; - } - } - else { - // return color; - - // No hits - if (depth > 0u) { // Hide lights, background - return hitLights(*ray) * color; - // result.color = hitLights(*ray) * color; - // return result; - } - else { - // return vec3<f32>(0f, 0f, 0f); - return uniforms.backgroundColor; - // result.color = uniforms.backgroundColor; - // return result; - } - - // Background - // let t = 0.5f * ((*ray).direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return color * background; - } - } -} - -// TODO: Try writing color directly using var outputTexture : texture_storage_2d<rgb32f,read_write>; -// textureStore(outputTexture, uv, vec3<f32>(1f, 1f, 1f)); -@group(0) @binding(0) var<storage, read_write> outputColorBuffer: ColorBuffer; -@group(0) @binding(1) var<uniform> uniforms: Uniforms; -@group(0) @binding(2) var<storage, read> hittableBuffer: HittableBuffer; -@group(0) @binding(3) var<storage, read> materialBuffer: MaterialBuffer; -@group(0) @binding(4) var<storage, read> textureBuffer: TextureBuffer; -@group(0) @binding(5) var<storage, read> lightBuffer: LightBuffer; -@group(0) @binding(6) var<storage, read> linearBVHNodeBuffer: LinearBVHNodeBuffer; -@group(0) @binding(7) var linearSampler: sampler; -@group(0) @binding(8) var fontTexture: texture_2d<f32>; -@group(0) @binding(9) var backgroundTexture: texture_2d<f32>; -@group(0) @binding(10) var atlasTexture: texture_2d<f32>; -@group(0) @binding(11) var<storage, read_write> outputNormalDepthBuffer: NormalDepthBuffer; -@group(0) @binding(12) var<storage, read_write> depthMinMaxBuffer: DepthMinMaxBuffer; - -// TODO: Move lighting to seperate bind group so I can update it independently - -@compute @workgroup_size(256, 1, 1) -fn clear(@builtin(global_invocation_id) globalId : vec3<u32>) { - var index = globalId.x * 3u; - outputColorBuffer.values[index] = 0f; - outputColorBuffer.values[index + 1u] = 0f; - outputColorBuffer.values[index + 2u] = 0f; - index = globalId.x * 4u; - outputNormalDepthBuffer.values[index] = 0f; // Normal x - outputNormalDepthBuffer.values[index + 1u] = 0f; // Normal y - outputNormalDepthBuffer.values[index + 2u] = 0f; // Normal z - outputNormalDepthBuffer.values[index + 3u] = 0f; // Depth - atomicStore(&depthMinMaxBuffer.values[0], 4294967295u); - atomicStore(&depthMinMaxBuffer.values[1], 0u); -} - -@compute @workgroup_size(256, 1, 1) -fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var normal = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - depth = -1f / dot(hitRecord.position - ray.origin, uniforms.forward); - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = normal.x; - outputNormalDepthBuffer.values[index + 1u] = normal.y; - outputNormalDepthBuffer.values[index + 2u] = normal.z; - outputNormalDepthBuffer.values[index + 3u] = depth; - - // Min, max depth - // When depth is 0, it means no hit, so ignore - if (depth > 0f) { - atomicMin(&depthMinMaxBuffer.values[0], u32(depth * 1000f)); - } - atomicMax(&depthMinMaxBuffer.values[1], u32(depth * 1000f)); -} - -@compute @workgroup_size(256, 1, 1) -fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var color = vec4<f32>(1f, 1f, 1f, 0f); - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - // color = materialBuffer.materials[hitRecord.materialId].idColor; - let id = f32(hitRecord.id & 255u) / 255f; - color.x = id; - color.y = id; - color.z = id; - // let color3 = textureValue(hitRecord); - // color.x = color3.x; - // color.y = color3.y; - // color.z = color3.z; - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = color.x; - outputNormalDepthBuffer.values[index + 1u] = color.y; - outputNormalDepthBuffer.values[index + 2u] = color.z; - outputNormalDepthBuffer.values[index + 3u] = 1f; -} - -// @builtin(local_invocation_id) localId : vec3<u32>, -// @builtin(num_workgroups) numWorkgroups : vec3<u32>, -// @builtin(workgroup_id) workgroupId : vec3<u32> -// TODO: Use workgroup dimensions xy to get position directly froem globalId -// Then store using textureStore -// Check within bounds due to overdispatching - -@compute @workgroup_size(256, 1, 1) -fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // TODO: Is additional noise when tiling due to sdf iterations (try non-sdf), texel offsets, (size - 1) issues, overdispatching? - - // Tex coords [0,1] - // let id = f32(globalId.x); - // TODO: Divide by (imageSize.x - 1) - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Frame seed - var frameSeed = u32(uniforms.seed); - let raysPerFrame = u32(uniforms.raysPerFrame); - var color = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var normal = vec3<f32>(0f, 0f, 0f); - var seed: u32; - - for (var i = 0u; i < raysPerFrame; i = i + 1u) { - // Random number generator - // See https://nelari.us/post/weekend_raytracing_with_wgpu_1/#implement-a-random-number-generator - // fn initRng(pixel: vec2<u32>, resolution: vec2<u32>, frame: u32) -> u32 { - // // Adapted from https://github.com/boksajak/referencePT - // let seed = dot(pixel, vec2<u32>(1u, resolution.x)) ^ jenkinsHash(frame); - // return jenkinsHash(seed); - // } - // - // fn jenkinsHash(input: u32) -> u32 { - // var x = input; - // x += x << 10u; - // x ^= x >> 6u; - // x += x << 3u; - // x ^= x >> 11u; - // x += x << 15u; - // return x; - // } - // TODO: Consider switching to u32 for uniforms and use vec3<u32> arithmetic - seed = u32(tilePixelY * tileSize.x + tilePixelX) + frameSeed * u32(tileSize.x * tileSize.y); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord) + vec2<f32>(random(&seed), random(&seed)) / imageSize; - - // Ray - var ray = getCameraRay(camera, &seed, samplePos); - - // Color [0,1] - // let color = result.color; - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(1f, 1f, 1f)); - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - color += clamp(rayColor(&ray, &seed), vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - - // Depth - // let depth = 1f / rayColor(&ray, &seed).depth; - // color = vec3<f32>(depth, depth, depth); - // depth += result.depth; - - // Normal - // normal += result.normal; - - // Next frame - frameSeed = frameSeed + 1u; - } - let index = globalId.x * 3u; - outputColorBuffer.values[index + 0u] = outputColorBuffer.values[index + 0u] + color.x; - outputColorBuffer.values[index + 1u] = outputColorBuffer.values[index + 1u] + color.y; - outputColorBuffer.values[index + 2u] = outputColorBuffer.values[index + 2u] + color.z; - // outputDepthBuffer.values[globalId.x] = outputDepthBuffer.values[globalId.x] + depth; - // outputNormalBuffer.values[index + 0u] = outputNormalBuffer.values[index + 0u] + normal.x; - // outputNormalBuffer.values[index + 1u] = outputNormalBuffer.values[index + 1u] + normal.y; - // outputNormalBuffer.values[index + 2u] = outputNormalBuffer.values[index + 2u] + normal.z; -}`; -class ComputeUniformBufferData extends Float32Array { - constructor(){ - super(ComputeUniformBufferData.SIZE); - this.POSITION_OFFSET = 0; - this.WIDTH_OFFSET = 3; - this.RIGHT_OFFSET = 4; - this.HEIGHT_OFFSET = 7; - this.UP_OFFSET = 8; - this.SEED_OFFSET = 11; - this.FORWARD_OFFSET = 12; - this.FOV_OFFSET = 15; - this.LOOKAT_OFFSET = 16; - this.APERTURE_OFFSET = 19; - this.BACKGROUND_COLOR_OFFSET = 20; - this.TIME0_OFFSET = 23; - this.TIME1_OFFSET = 24; - this.TILES_X = 25; - this.TILES_Y = 26; - this.TILE_OFFSET_X = 27; - this.TILE_OFFSET_Y = 28; - this.RAYS_PER_FRAME_OFFSET = 29; + setParameter1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET] = value2; + } + getParameter2(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET]; + } + setParameter2(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET] = value2; + } + getBoundaryType(index2) { + return this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET]; + } + setBoundaryType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET] = value2; + } + getTexId(index2) { + return this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET]; + } + setTexId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET] = value2; + } + getSdfBuffer(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET]; + } + setSdfBuffer(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET] = value2; + } + getSdfBorder(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET]; + } + setSdfBorder(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET] = value2; + } + getMaterialTypeId(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET]; + } + setMaterialTypeId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET] = value2; + } + getMaterialFuzz(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET]; + } + setMaterialFuzz(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET] = value2; + } + getMaterialDensity(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET]; + } + setMaterialDensity(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET] = value2; + } + getMaterialGloss(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET]; + } + setMaterialGloss(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET] = value2; + } + getMaterialRefractiveIndex(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; + } + setMaterialRefractiveIndex(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value2; + } + getMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; + } + setMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; + value2[3] = this[offset2 + 3]; + } + setSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + } + HittableBufferData.SIZE = 208 / 4; + class ComputeUniformBufferData extends Float32Array { + constructor() { + super(ComputeUniformBufferData.SIZE); + this.POSITION_OFFSET = 0 / 4; + this.WIDTH_OFFSET = 12 / 4; + this.RIGHT_OFFSET = 16 / 4; + this.HEIGHT_OFFSET = 28 / 4; + this.UP_OFFSET = 32 / 4; + this.SEED_OFFSET = 44 / 4; + this.FORWARD_OFFSET = 48 / 4; + this.FOV_OFFSET = 60 / 4; + this.BACKGROUND_COLOR_OFFSET = 64 / 4; + this.TIME0_OFFSET = 76 / 4; + this.AMBIENT_COLOR_OFFSET = 80 / 4; + this.TIME1_OFFSET = 92 / 4; + this.TILES_X = 96 / 4; + this.TILES_Y = 100 / 4; + this.TILE_OFFSET_X = 104 / 4; + this.TILE_OFFSET_Y = 108 / 4; + this.LOOKAT_OFFSET = 112 / 4; + this.APERTURE_OFFSET = 124 / 4; + this.FOCUS_DISTANCE_OFFSET = 128 / 4; + this.RAYS_PER_FRAME_OFFSET = 132 / 4; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value2) { + this[this.FOCUS_DISTANCE_OFFSET] = value2; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSeed() { - return this[this.SEED_OFFSET]; + return this[this.SEED_OFFSET]; } - setSeed(value) { - this[this.SEED_OFFSET] = value; + setSeed(value2) { + this[this.SEED_OFFSET] = value2; } getRaysPerFrame() { - return this[this.RAYS_PER_FRAME_OFFSET]; + return this[this.RAYS_PER_FRAME_OFFSET]; } - setRaysPerFrame(value) { - this[this.RAYS_PER_FRAME_OFFSET] = value; + setRaysPerFrame(value2) { + this[this.RAYS_PER_FRAME_OFFSET] = value2; } getFieldOfView() { - return this[this.FOV_OFFSET]; + return this[this.FOV_OFFSET]; } - setFieldOfView(value) { - this[this.FOV_OFFSET] = value; + setFieldOfView(value2) { + this[this.FOV_OFFSET] = value2; } getAperture() { - return this[this.APERTURE_OFFSET]; + return this[this.APERTURE_OFFSET]; } - setAperture(value) { - this[this.APERTURE_OFFSET] = value; + setAperture(value2) { + this[this.APERTURE_OFFSET] = value2; } - getPosition(value) { - (0, _glMatrix.vec3).set(value, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); + getPosition(value2) { + set$8(value2, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); } - setPosition(value) { - this[this.POSITION_OFFSET] = value[0]; - this[this.POSITION_OFFSET + 1] = value[1]; - this[this.POSITION_OFFSET + 2] = value[2]; + setPosition(value2) { + this[this.POSITION_OFFSET] = value2[0]; + this[this.POSITION_OFFSET + 1] = value2[1]; + this[this.POSITION_OFFSET + 2] = value2[2]; } - getRight(value) { - (0, _glMatrix.vec3).set(value, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); + getRight(value2) { + set$8(value2, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); } - setRight(value) { - this[this.RIGHT_OFFSET] = value[0]; - this[this.RIGHT_OFFSET + 1] = value[1]; - this[this.RIGHT_OFFSET + 2] = value[2]; + setRight(value2) { + this[this.RIGHT_OFFSET] = value2[0]; + this[this.RIGHT_OFFSET + 1] = value2[1]; + this[this.RIGHT_OFFSET + 2] = value2[2]; } - getUp(value) { - (0, _glMatrix.vec3).set(value, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); + getUp(value2) { + set$8(value2, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); } - setUp(value) { - this[this.UP_OFFSET] = value[0]; - this[this.UP_OFFSET + 1] = value[1]; - this[this.UP_OFFSET + 2] = value[2]; + setUp(value2) { + this[this.UP_OFFSET] = value2[0]; + this[this.UP_OFFSET + 1] = value2[1]; + this[this.UP_OFFSET + 2] = value2[2]; } - getForward(value) { - (0, _glMatrix.vec3).set(value, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); + getForward(value2) { + set$8(value2, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); } - setForward(value) { - this[this.FORWARD_OFFSET] = value[0]; - this[this.FORWARD_OFFSET + 1] = value[1]; - this[this.FORWARD_OFFSET + 2] = value[2]; + setForward(value2) { + this[this.FORWARD_OFFSET] = value2[0]; + this[this.FORWARD_OFFSET + 1] = value2[1]; + this[this.FORWARD_OFFSET + 2] = value2[2]; } - getLookAt(value) { - (0, _glMatrix.vec3).set(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + getBackgroundColor(value2) { + set$7(value2, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); } - setLookAt(value) { - this[this.LOOKAT_OFFSET] = value[0]; - this[this.LOOKAT_OFFSET + 1] = value[1]; - this[this.LOOKAT_OFFSET + 2] = value[2]; + setBackgroundColor(value2) { + this[this.BACKGROUND_COLOR_OFFSET] = value2[0]; + this[this.BACKGROUND_COLOR_OFFSET + 1] = value2[1]; + this[this.BACKGROUND_COLOR_OFFSET + 2] = value2[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value2[3]; } - getBackgroundColor(value) { - (0, _glMatrix.vec4).set(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], 1); + getAmbientColor(value2) { + set$8(value2, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); } - setBackgroundColor(value) { - this[this.BACKGROUND_COLOR_OFFSET] = value[0]; - this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; - this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + setAmbientColor(value2) { + this[this.AMBIENT_COLOR_OFFSET] = value2[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value2[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value2[2]; } getTime0() { - return this[this.TIME0_OFFSET]; + return this[this.TIME0_OFFSET]; } - setTime0(value) { - this[this.TIME0_OFFSET] = value; + setTime0(value2) { + this[this.TIME0_OFFSET] = value2; } getTime1() { - return this[this.TIME1_OFFSET]; + return this[this.TIME1_OFFSET]; } - setTime1(value) { - this[this.TIME1_OFFSET] = value; + setTime1(value2) { + this[this.TIME1_OFFSET] = value2; } getTilesX() { - return this[this.TILES_X]; + return this[this.TILES_X]; } - setTilesX(value) { - this[this.TILES_X] = value; + setTilesX(value2) { + this[this.TILES_X] = value2; } getTilesY() { - return this[this.TILES_Y]; + return this[this.TILES_Y]; } - setTilesY(value) { - this[this.TILES_Y] = value; + setTilesY(value2) { + this[this.TILES_Y] = value2; } getTileOffsetX() { - return this[this.TILE_OFFSET_X]; + return this[this.TILE_OFFSET_X]; } - setTileOffsetX(value) { - this[this.TILE_OFFSET_X] = value; + setTileOffsetX(value2) { + this[this.TILE_OFFSET_X] = value2; } getTileOffsetY() { - return this[this.TILE_OFFSET_Y]; - } - setTileOffsetY(value) { - this[this.TILE_OFFSET_Y] = value; - } -} -ComputeUniformBufferData.SIZE = 32; - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1gtMg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FullscreenQuadWgsl", ()=>FullscreenQuadWgsl); -parcelHelpers.export(exports, "FullscreenQuadUniformBufferData", ()=>FullscreenQuadUniformBufferData); -const FullscreenQuadWgsl = ` -const GAMMA = vec3<f32>(0.45454545f); // 1 / 2.2 - -struct ColorData { - data : array<f32>, -} - -struct NormalDepthData { - data : array<f32>, -} - - // offest align size -struct Uniforms { // ------------------------------ - width: f32, // 0 4 4 - height: f32, // 4 4 4 - samplesPerPixel: f32, // 8 4 4 - exposure: f32, // 12 4 4 - minDepth: f32, // 16 4 4 - maxDepth: f32, // 20 4 4 - normalEdge: f32, // 24 4 4 - depthEdge: f32, // 28 4 4 -} // ------------------------------ - // 4 32 - -@group(0) @binding(0) var<uniform> uniforms : Uniforms; -@group(0) @binding(1) var<storage, read> colorBuffer : ColorData; -@group(0) @binding(2) var<storage, read> normalDepthBuffer : NormalDepthData; - -struct VertexOutput { - @builtin(position) Position : vec4<f32>, -}; - -@vertex -fn vert_main(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { - var pos = array<vec2<f32>, 6>( - vec2<f32>( 1f, 1f), - vec2<f32>( 1f, -1f), - vec2<f32>(-1f, -1f), - vec2<f32>( 1f, 1f), - vec2<f32>(-1f, -1f), - vec2<f32>(-1f, 1f)); - var output : VertexOutput; - output.Position = vec4<f32>(pos[vertexIndex], 0f, 1f); - return output; -} - -@fragment -fn frag_main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - // [0,1] - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -} - -@fragment -fn frag_depth(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - let depth = normalDepthBuffer.data[index + 3u]; - let minDepth = uniforms.minDepth; - let maxDepth = uniforms.maxDepth; - if (minDepth == maxDepth) { - // Raw, unnormalized depth - return vec4<f32>(vec3<f32>(depth, depth, depth), 1f); + return this[this.TILE_OFFSET_Y]; } - else { - // Normalize depth - var normalizedDepth = (depth - minDepth) / (maxDepth - minDepth); - return vec4<f32>(normalizedDepth, normalizedDepth, normalizedDepth, 1f); - } -} - -@fragment -fn frag_normal(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -// @fragment -// fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { -// let x = floor(coord.x); -// let y = floor(coord.y); -// let index = u32(x + y * uniforms.width) * 4u; - -// // Prevent edge detection at screen edges -// if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } - -// // Normal derivatives -// let p = vec3<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u]); -// let px = vec3<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u]); -// let py = vec3<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u]); -// let dpdx = px - p; -// let dpdy = py - p; -// let fwidth = abs(dpdx) + abs(dpdy); - -// // Depth derivatives -// let d = normalDepthBuffer.data[index + 3u]; -// let dx = normalDepthBuffer.data[index + 7u]; -// let dy = normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]; -// let ddpx = dx - d; -// let ddpy = dy - d; - -// // Normalize depth -// // let minDepth = uniforms.minDepth; -// // let maxDepth = uniforms.maxDepth; -// // let nd = (d - minDepth) / (maxDepth - minDepth); -// // let ndx = (dx - minDepth) / (maxDepth - minDepth); -// // let ndy = (dy - minDepth) / (maxDepth - minDepth); -// // let ddpx = ndx - nd; -// // let ddpy = ndy - nd; - -// let dfwidth = abs(ddpx) + abs(ddpy); - -// // Output white when magnitude of dpdx over a threshold -// let depthEdge = uniforms.depthEdge; -// let normalEdge = uniforms.normalEdge; -// if (dot(fwidth, fwidth) > normalEdge || dfwidth > depthEdge) { -// return vec4<f32>(1f, 1f, 1f, 1f); -// } else { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } -// } - -@fragment -fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - - // Prevent edge detection at screen edges - if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { - return vec4<f32>(0f, 0f, 0f, 1f); - } - - // Segment derivatives - let p = vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], normalDepthBuffer.data[index + 3u]); - let px = vec4<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u], normalDepthBuffer.data[index + 7u]); - let py = vec4<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]); - let dpdx = px - p; - let dpdy = py - p; - let fwidth = abs(dpdx) + abs(dpdy); - - // Output white when magnitude of dpdx over a threshold - if (dot(fwidth, fwidth) > 0f) { - return vec4<f32>(1f, 1f, 1f, 1f); - } else { - return vec4<f32>(0f, 0f, 0f, 1f); - // return p; - } -} - -@fragment -fn frag_segment(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -@fragment -fn frag_main_hdr(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - - // Simple tone-mapping from HDR to LDR - // if (uniforms.exposure > 0f) { - // color = color * uniforms.exposure; - // color = color / (color + vec3<f32>(1f, 1f, 1f)); - // } - - color = color * uniforms.exposure; - // ACES - // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ - let a = 2.51f; - let b = 0.03f; - let c = 2.43f; - let d = 0.59f; - let e = 0.14f; - color = (color * (a * color + b)) / (color * (c * color + d) + e); - - // See https://bruop.github.io/tonemapping/ - // See https://www.shadertoy.com/view/WdjSW3 - - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -}`; -class FullscreenQuadUniformBufferData extends Float32Array { - constructor(){ - super(FullscreenQuadUniformBufferData.SIZE); - this.WIDTH_OFFSET = 0; - this.HEIGHT_OFFSET = 1; - this.SPP_OFFSET = 2; - this.EXPOSURE_OFFSET = 3; - this.MIN_DEPTH_OFFSET = 4; - this.MAX_DEPTH_OFFSET = 5; - this.EDGE_NORMAL_OFFSET = 6; - this.EDGE_DEPTH_OFFSET = 7; + setTileOffsetY(value2) { + this[this.TILE_OFFSET_Y] = value2; + } + getLookAt(value2) { + set$8(value2, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value2) { + this[this.LOOKAT_OFFSET] = value2[0]; + this[this.LOOKAT_OFFSET + 1] = value2[1]; + this[this.LOOKAT_OFFSET + 2] = value2[2]; + } + } + ComputeUniformBufferData.SIZE = 144 / 4; + class FullscreenQuadUniformBufferData extends Float32Array { + constructor() { + super(FullscreenQuadUniformBufferData.SIZE); + this.WIDTH_OFFSET = 0 / 4; + this.HEIGHT_OFFSET = 4 / 4; + this.SPP_OFFSET = 8 / 4; + this.EXPOSURE_OFFSET = 12 / 4; + this.MIN_DEPTH_OFFSET = 16 / 4; + this.MAX_DEPTH_OFFSET = 20 / 4; + this.EDGE_NORMAL_OFFSET = 24 / 4; + this.EDGE_DEPTH_OFFSET = 28 / 4; + this.EDGE_FOREGROUND_OFFSET = 32 / 4; + this.EDGE_BACKGROUND_OFFSET = 48 / 4; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSamplesPerPixel() { - return this[this.SPP_OFFSET]; + return this[this.SPP_OFFSET]; } - setSamplesPerPixel(value) { - this[this.SPP_OFFSET] = value; + setSamplesPerPixel(value2) { + this[this.SPP_OFFSET] = value2; } getExposure() { - return this[this.EXPOSURE_OFFSET]; + return this[this.EXPOSURE_OFFSET]; } - setExposure(value) { - this[this.EXPOSURE_OFFSET] = value; + setExposure(value2) { + this[this.EXPOSURE_OFFSET] = value2; } getMinDepth() { - return this[this.MIN_DEPTH_OFFSET]; + return this[this.MIN_DEPTH_OFFSET]; } - setMinDepth(value) { - this[this.MIN_DEPTH_OFFSET] = value; + setMinDepth(value2) { + this[this.MIN_DEPTH_OFFSET] = value2; } getMaxDepth() { - return this[this.MAX_DEPTH_OFFSET]; + return this[this.MAX_DEPTH_OFFSET]; } - setMaxDepth(value) { - this[this.MAX_DEPTH_OFFSET] = value; + setMaxDepth(value2) { + this[this.MAX_DEPTH_OFFSET] = value2; } getEdgeDepth() { - return this[this.EDGE_DEPTH_OFFSET]; + return this[this.EDGE_DEPTH_OFFSET]; } - setEdgeDepth(value) { - this[this.EDGE_DEPTH_OFFSET] = value; + setEdgeDepth(value2) { + this[this.EDGE_DEPTH_OFFSET] = value2; } getEdgeNormal() { - return this[this.EDGE_NORMAL_OFFSET]; - } - setEdgeNormal(value) { - this[this.EDGE_NORMAL_OFFSET] = value; - } -} -FullscreenQuadUniformBufferData.SIZE = 8; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8lb3C":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SplitMethod", ()=>SplitMethod); -parcelHelpers.export(exports, "LinearBVHNode", ()=>LinearBVHNode); -parcelHelpers.export(exports, "BVHAccel", ()=>BVHAccel); -parcelHelpers.export(exports, "LinearBVHNodeBufferData", ()=>LinearBVHNodeBufferData); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _aabbJs = require("./aabb.js"); -const SplitMethod = { - middle: "middle", - equalCounts: "equalCounts", - sah: "sah" -}; -class BVHPrimitiveInfo { - get primitiveNumber() { - return this._primitiveNumber; - } - get bounds() { - return this._bounds; - } - get centroid() { - return this._centroid; - } - constructor(primitiveNumber, bounds){ - this._primitiveNumber = primitiveNumber; - this._bounds = bounds; - this._centroid = (0, _glMatrix.vec3).create(); - bounds.centroid(this._centroid); - } -} -class BVHBuildNode { - get bounds() { - return this._bounds; - } - get left() { - return this._left; - } - get right() { - return this._right; - } - get splitAxis() { - return this._splitAxis; - } - get firstPrimOffset() { - return this._firstPrimOffset; - } - get nPrimitives() { - return this._nPrimitives; - } - get start() { - return this._start; - } - get end() { - return this._end; - } - constructor(start, end){ - this._start = start; - this._end = end; - } - initLeaf(first, n, bounds) { - this._firstPrimOffset = first; - this._nPrimitives = n; - this._bounds = bounds; - this._left = null; - this._right = null; - } - initInterior(axis, left, right) { - this._left = left; - this._right = right; - this._bounds = new (0, _aabbJs.AABB)(); - this._bounds.unionBounds(this._left.bounds); - this._bounds.unionBounds(this._right.bounds); - this._splitAxis = axis; - this._nPrimitives = 0; - } -} -class LinearBVHNode { - constructor(){ - this.bounds = new (0, _aabbJs.AABB)(); - this.primitivesOffset = 0; - this.secondChildOffset = 0; - this.nPrimitives = 0; - this.axis = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._size = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index) { - this.bounds.centroid(this._centroid); - buffer.setCenter(index, this._centroid); - this.bounds.size(this._size); - (0, _glMatrix.vec3).scale(this._size, this._size, 0.5); - buffer.setSize(index, this._size); - buffer.setPrimitivesOffset(index, this.primitivesOffset); - buffer.setSecondChildOffset(index, this.secondChildOffset); - buffer.setNPrimitives(index, this.nPrimitives); - buffer.setAxis(index, this.axis); - } -} -class BVHAccel { - get orderedPrimitives() { - return this._orderedPrimitives; - } - get nodes() { - return this._nodes; - } - constructor(core, primitives, maxPrimsInNode, splitMethod){ - this._core = core; - if (!primitives || primitives.length == 0) return; - let start = performance.now(); - this._maxPrimsInNode = maxPrimsInNode; - this._splitMethod = splitMethod; - this._primitives = primitives; - this._normalized = (0, _glMatrix.vec3).create(); - this._primitiveInfo = []; - for(let i = 0; i < primitives.length; i++)this._primitiveInfo.push(new BVHPrimitiveInfo(i, primitives[i].bounds)); - this._totalNodes = 0; - this._orderedPrimitives = []; - const root = this._recursiveBuild(0, primitives.length); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh ${this._totalNodes} nodes split ${this._splitMethod} ${Math.round(window.performance.now() - start)}ms`); - start = performance.now(); - this._nodes = []; - for(let i = 0; i < this._totalNodes; i++)this._nodes.push(new LinearBVHNode()); - this._offset = 0; - this._flattenBVHTree(root); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh flattened ${Math.round(window.performance.now() - start)}ms`); - } - _recursiveBuild(start, end) { - const node = new BVHBuildNode(start, end - 1); - this._totalNodes++; - const bounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)bounds.unionBounds(this._primitiveInfo[i].bounds); - const nPrimitives = end - start; - if (nPrimitives == 1) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - const centroidBounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)centroidBounds.unionPoint(this._primitiveInfo[i].centroid); - const dim = centroidBounds.maximumExtent(); - let mid = Math.floor((start + end) / 2); - if (centroidBounds.max[dim] == centroidBounds.min[dim]) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - switch(this._splitMethod){ - case SplitMethod.middle: - break; - case SplitMethod.equalCounts: - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - break; - case SplitMethod.sah: - default: - if (nPrimitives <= 4) { - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - } else { - const nBuckets = 12; - const buckets = []; - for(let i = 0; i < nBuckets; i++)buckets.push({ - count: 0, - bounds: new (0, _aabbJs.AABB)() - }); - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - buckets[b].count++; - buckets[b].bounds.unionBounds(this._primitiveInfo[i].bounds); - } - const cost = []; - for(let i = 0; i < nBuckets - 1; i++){ - const b0 = new (0, _aabbJs.AABB)(); - const b1 = new (0, _aabbJs.AABB)(); - let count0 = 0; - let count1 = 0; - for(let j = 0; j <= i; j++){ - b0.unionBounds(buckets[j].bounds); - count0 += buckets[j].count; - } - for(let j = i + 1; j < nBuckets; j++){ - b1.unionBounds(buckets[j].bounds); - count1 += buckets[j].count; - } - cost.push(0.125 + (count0 * b0.surfaceArea() + count1 * b1.surfaceArea()) / bounds.surfaceArea()); - } - let minCost = cost[0]; - let minCostSplitBucket = 0; - for(let i = 1; i < nBuckets - 1; i++)if (cost[i] < minCost) { - minCost = cost[i]; - minCostSplitBucket = i; - } - const leafCost = nPrimitives; - if (nPrimitives > this._maxPrimsInNode || minCost < leafCost) { - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - if (b > minCostSplitBucket) { - mid = i; - break; - } - } - } else { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } - } - break; - } - node.initInterior(dim, this._recursiveBuild(start, mid), this._recursiveBuild(mid, end)); - } - } - return node; - } - _flattenBVHTree(node) { - const linearNode = this._nodes[this._offset]; - linearNode.bounds = node.bounds; - const myOffset = this._offset++; - if (node.nPrimitives > 0) { - linearNode.primitivesOffset = node.firstPrimOffset; - linearNode.nPrimitives = node.nPrimitives; - } else { - linearNode.axis = node.splitAxis; - linearNode.nPrimitives = 0; - this._flattenBVHTree(node.left); - linearNode.secondChildOffset = this._flattenBVHTree(node.right); - } - return myOffset; - } -} -class LinearBVHNodeBufferData extends Float32Array { - constructor(count){ - super(count * LinearBVHNodeBufferData.SIZE); - this.CENTER_OFFSET = 0; - this.SIZE_OFFSET = 4; - this.PRIMITIVES_OFFSET_OFFSET = 3; - this.SECOND_CHILD_OFFSET_OFFSET = 7; - this.N_PRIMITIVES_OFFSET = 8; - this.AXIS_OFFSET = 9; - } - getCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getPrimitivesOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET]; - } - setPrimitivesOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET] = value; - } - getSecondChildOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET]; - } - setSecondChildOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET] = value; - } - getNPrimitives(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET]; - } - setNPrimitives(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET] = value; - } - getAxis(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET]; - } - setAxis(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET] = value; - } -} -LinearBVHNodeBufferData.SIZE = 12; - -},{"gl-matrix":"5x28d","../../main.js":"f421K","./aabb.js":"7wAtJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2sMdC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LightType", ()=>LightType); -parcelHelpers.export(exports, "LightBufferData", ()=>LightBufferData); -parcelHelpers.export(exports, "Light", ()=>Light); -parcelHelpers.export(exports, "SphereLight", ()=>SphereLight); -parcelHelpers.export(exports, "RectLight", ()=>RectLight); -var _glMatrix = require("gl-matrix"); -const LightType = { - distant: 0, - sphere: 1, - rect: 2, - disc: 3, - cylinder: 4, - dome: 5 -}; -class LightBufferData extends Float32Array { - constructor(count){ - super(count * LightBufferData.SIZE); - this.ROTATION_OFFSET = 0; - this.CENTER_OFFSET = 4; - this.TYPE_OFFSET = 7; - this.SIZE_OFFSET = 8; - this.COLOR_OFFSET = 12; - } - getType(index) { - return this[LightBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[LightBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -LightBufferData.SIZE = 16; -class Light { - constructor(options){ - this.color = options.color; - this.center = options.center; - } - toBuffer(buffer, index) { - buffer.setCenter(index, this.center); - buffer.setColor(index, this.color); - } -} -class SphereLight extends Light { - constructor(options){ - super(options); - this.radius = options.radius / 2; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.sphere); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.radius, this.radius, this.radius)); - } -} -class RectLight extends Light { - constructor(options){ - super(options); - this._thickness = 0.00001; - this.size = options.size; - this.rotation = options.rotation; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.rect); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.size[0], this.size[1], this._thickness)); - buffer.setRotation(index, this.rotation); - } -} - -},{"gl-matrix":"5x28d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rF26":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _mainJs = require("../../main.js"); -class FontVisual { - get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; + return this[this.EDGE_NORMAL_OFFSET]; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeNormal(value2) { + this[this.EDGE_NORMAL_OFFSET] = value2; } - initializeContext(device) { - this._device = device; - this._hasChanged = true; - this._isInitialized = true; + getEdgeForeground(value2) { + set$7(value2, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - const imageData = this._font.atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this.texture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this.texture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - } + setEdgeForeground(value2) { + this[this.EDGE_FOREGROUND_OFFSET] = value2[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value2[3]; } -} - -},{"../../main.js":"f421K","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"enHlm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _imageJs = require("../../components/image.js"); -var _hittableJs = require("./hittable.js"); -class ImageVisual { - get isInitialized() { - return this._isInitialized; + getEdgeBackground(value2) { + set$7(value2, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); } - get image() { - return this._image; - } - render(elapsedTime) {} - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this.isVisible = true; - image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeBackground(value2) { + this[this.EDGE_BACKGROUND_OFFSET] = value2[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value2[3]; } - initializeContext(device) { - if (!this._image.isInitialized) this._image.initialize(); - this._hasChanged = true; - this._isInitialized = true; + } + FullscreenQuadUniformBufferData.SIZE = 64 / 4; + class LinearBVHNodeBufferData extends Float32Array { + constructor(count2) { + super(count2 * LinearBVHNodeBufferData.SIZE); + this.CENTER_OFFSET = 0 / 4; + this.SIZE_OFFSET = 16 / 4; + this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; + this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; + this.N_PRIMITIVES_OFFSET = 32 / 4; + this.AXIS_OFFSET = 36 / 4; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const material = this._image.material == -1 ? this._main.config.defaultMaterial : this._main.materials[this._image.material]; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - const modelSizeX = this._image.maxBoundsX - this._image.minBoundsX; - const modelSizeY = this._image.maxBoundsY - this._image.minBoundsY; - const modelSizeZ = this._image.maxBoundsZ - this._image.minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - if (this._image instanceof (0, _imageJs.ImageQuad)) { - const imageQuad = this._image; - const position = (0, _glMatrix.vec3).fromValues((imageQuad.minBoundsX + imageQuad.maxBoundsX) / 2, (imageQuad.minBoundsY + imageQuad.maxBoundsY) / 2, (imageQuad.minBoundsZ + imageQuad.maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(position, imageQuad.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableRotatedXyRectOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - size1: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - material: material, - texCoord0: imageQuad.texCoord0, - texCoord1: imageQuad.texCoord1, - rotation0: imageQuad.rotation, - rotation1: imageQuad.rotation - }; - this.hittable = new (0, _hittableJs.HittableRotatedXyRect)(hittableRotatedXyRectOptions); - } else if (this._image instanceof (0, _imageJs.ImageSphere)) { - const imageSphere = this._image; - const position = imageSphere.position; - (0, _glMatrix.vec3).subtract(position, imageSphere.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableSphereOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - radius: imageSphere.radius * boundsScaling, - material: material - }; - this.hittable = new (0, _hittableJs.HittableSphere)(hittableSphereOptions); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"5x28d","../../components/image.js":"kwtZG","./hittable.js":"5cw7N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"72uDI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -class LabelSetVisual { - get isInitialized() { - return this._isInitialized; + getCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - get label() { - return this._labelSet; - } - render(elapsedTime) {} - constructor(core, main, labelSet){ - this._core = core; - this._main = main; - this._labelSet = labelSet; - this.isVisible = true; - labelSet.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - if (!this._labelSet.isInitialized) this._labelSet.initialize(); - if (this._labelSet.text && this._labelSet.text.length > 0) this._hasChanged = true; - this._isInitialized = true; + setCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const glpyhRotation = (0, _glMatrix.quat).create(); - const glyphInvRotation = (0, _glMatrix.quat).create(); - const position0 = (0, _glMatrix.vec3).create(); - const position1 = (0, _glMatrix.vec3).create(); - const dataView = this._labelSet.verticesView; - const labelCount = this._labelSet.text.length; - let glyphIndex = 0; - for(let i = 0; i < labelCount; i++){ - const material = this._labelSet.material !== undefined ? this._main.materials[this._labelSet.material] : this._labelSet.materials ? this._main.materials[this._labelSet.materials[i]] : this._main.config.defaultTextMaterial; - const glyphCount = this._labelSet.text[i].length; - for(let j = 0; j < glyphCount; j++){ - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 2, position0); - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 1, position1); - (0, _glMatrix.vec3).scale(position0, position0, modelScale); - (0, _glMatrix.vec3).scale(position1, position1, modelScale); - (0, _glMatrix.vec3).transformQuat(position0, position0, modelRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, modelRotation); - (0, _glMatrix.vec3).add(position0, position0, modelPosition); - (0, _glMatrix.vec3).add(position1, position1, modelPosition); - const centroid = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(centroid, position0, position1); - (0, _glMatrix.vec3).scale(centroid, centroid, 0.5); - if (this._labelSet.rotation) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotation[0], this._labelSet.rotation[1], this._labelSet.rotation[2], this._labelSet.rotation[3]); - else if (this._labelSet.rotations) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotations[i * 4], this._labelSet.rotations[i * 4 + 1], this._labelSet.rotations[i * 4 + 2], this._labelSet.rotations[i * 4 + 3]); - else (0, _glMatrix.quat).identity(glpyhRotation); - const rotation = (0, _glMatrix.quat).clone(glpyhRotation); - (0, _glMatrix.quat).multiply(rotation, modelRotation, rotation); - (0, _glMatrix.quat).conjugate(glyphInvRotation, rotation); - (0, _glMatrix.vec3).subtract(position0, position0, centroid); - (0, _glMatrix.vec3).subtract(position1, position1, centroid); - (0, _glMatrix.vec3).transformQuat(position0, position0, glyphInvRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, glyphInvRotation); - (0, _glMatrix.vec3).add(position0, position0, centroid); - (0, _glMatrix.vec3).add(position1, position1, centroid); - const texCoord0 = (0, _glMatrix.vec2).create(); - const texCoord1 = (0, _glMatrix.vec2).create(); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 2, texCoord0); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 1, texCoord1); - const hittableFontOptions = { - center0: centroid, - center1: centroid, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - size1: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - material: material, - texCoord0: texCoord0, - texCoord1: texCoord1, - rotation0: rotation, - rotation1: rotation, - sdfBuffer: this._core.config.sdfBuffer - }; - const hittable = new (0, _hittableJs.HittableRotatedFontXyRect)(hittableFontOptions); - this.hittables.push(hittable); - glyphIndex++; - } - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"5x28d","../../vertex.js":"4J2YE","./hittable.js":"5cw7N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dRm64":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _atlasJs = require("../../atlas.js"); -var _bufferJs = require("../../buffer.js"); -var _indexJs = require("../../index.js"); -var _mainJs = require("../../main.js"); -var _paletteJs = require("../../palette.js"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _mathJs = require("../../helpers/math.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - constructor(core, ids){ - super(core, ids); - this._isInitialized = true; + getSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - update() { - if (this._isInitialized) { - if (this.hasChangedCallback) this.hasChangedCallback(); - } + setSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - get time0() { - return this._time0; + getPrimitivesOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET]; } - set time0(value) { - if (this._time0 != value) { - this._time0 = value; - this._hasChanged = true; - } + setPrimitivesOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET] = value2; } - get time1() { - return this._time1; + getSecondChildOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET]; } - set time1(value) { - if (this._time1 != value) { - this._time1 = value; - this._hasChanged = true; - } + setSecondChildOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET] = value2; } - get duration() { - return this._duration; + getNPrimitives(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET]; } - set duration(value) { - if (this._duration != value) { - this._duration = value; - this._hasChanged = true; - } + setNPrimitives(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET] = value2; } - get stagger() { - return this.stagger; + getAxis(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET]; } - set stagger(value) { - if (this._stagger != value) { - this._stagger = value; - this._hasChanged = true; - } + setAxis(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET] = value2; } - constructor(core, main, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - this._main = main; - this._time0 = 0; - this._time1 = 1; - this._buffer1.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._buffer2.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._isInitialized = true; + } + LinearBVHNodeBufferData.SIZE = 48 / 4; + class LightBufferData extends Float32Array { + constructor(count2) { + super(count2 * LightBufferData.SIZE); + this.ROTATION_OFFSET = 0 / 4; + this.CENTER_OFFSET = 16 / 4; + this.TYPE_OFFSET = 28 / 4; + this.SIZE_OFFSET = 32 / 4; + this.COLOR_OFFSET = 48 / 4; + } + getType(index2) { + return this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$8(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + set$6(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - this.minY = Number.MAX_VALUE; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const previousBuffer = this.previousBuffer; - const currentBuffer = this.currentBuffer; - const currentUnitTranslation = (0, _glMatrix.vec3).create(); - const previousUnitTranslation = (0, _glMatrix.vec3).create(); - const currentUnitScale = (0, _glMatrix.vec3).create(); - const previousUnitScale = (0, _glMatrix.vec3).create(); - const currentUnitRotation = (0, _glMatrix.quat).create(); - const previousUnitRotation = (0, _glMatrix.quat).create(); - const unitOrder = (0, _glMatrix.vec2).create(); - const transitionDuration = this._duration / (this._duration + this._stagger); - for(let j = 0; j < currentBuffer.ids.length; j++){ - (0, _vertexJs.UnitVertex).getOrder(currentBuffer.dataView, j, unitOrder); - const startTime = unitOrder[1] * (1 - transitionDuration); - const animation0 = (0, _mathJs.MathHelper).clamp((this._time0 - startTime) / transitionDuration, 0, 1); - const animation1 = (0, _mathJs.MathHelper).clamp((this._time1 - startTime) / transitionDuration, 0, 1); - const unitScale0 = (0, _glMatrix.vec3).create(); - const unitScale1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getScale(currentBuffer.dataView, j, currentUnitScale); - (0, _vertexJs.UnitVertex).getScale(previousBuffer.dataView, j, previousUnitScale); - (0, _glMatrix.vec3).lerp(unitScale0, previousUnitScale, currentUnitScale, animation0); - (0, _glMatrix.vec3).lerp(unitScale1, previousUnitScale, currentUnitScale, animation1); - const unitTranslation0 = (0, _glMatrix.vec3).create(); - const unitTranslation1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, j, currentUnitTranslation); - (0, _vertexJs.UnitVertex).getTranslation(previousBuffer.dataView, j, previousUnitTranslation); - (0, _glMatrix.vec3).lerp(unitTranslation0, previousUnitTranslation, currentUnitTranslation, animation0); - (0, _glMatrix.vec3).lerp(unitTranslation1, previousUnitTranslation, currentUnitTranslation, animation1); - const unitRotation0 = (0, _glMatrix.quat).create(); - const unitRotation1 = (0, _glMatrix.quat).create(); - (0, _vertexJs.UnitVertex).getRotation(currentBuffer.dataView, j, currentUnitRotation); - (0, _vertexJs.UnitVertex).getRotation(previousBuffer.dataView, j, previousUnitRotation); - (0, _glMatrix.quat).slerp(unitRotation0, previousUnitRotation, currentUnitRotation, animation0); - (0, _glMatrix.quat).slerp(unitRotation1, previousUnitRotation, currentUnitRotation, animation1); - (0, _glMatrix.quat).multiply(unitRotation0, modelRotation, unitRotation0); - (0, _glMatrix.quat).multiply(unitRotation1, modelRotation, unitRotation1); - (0, _glMatrix.vec3).scale(unitTranslation0, unitTranslation0, modelScale); - (0, _glMatrix.vec3).scale(unitTranslation1, unitTranslation1, modelScale); - (0, _glMatrix.vec3).transformQuat(unitTranslation0, unitTranslation0, modelRotation); - (0, _glMatrix.vec3).transformQuat(unitTranslation1, unitTranslation1, modelRotation); - (0, _glMatrix.vec3).add(unitTranslation0, unitTranslation0, modelPosition); - (0, _glMatrix.vec3).add(unitTranslation1, unitTranslation1, modelPosition); - (0, _glMatrix.vec3).scale(unitScale0, unitScale0, modelScale / 2); - (0, _glMatrix.vec3).scale(unitScale1, unitScale1, modelScale / 2); - unitScale0[0] = Math.max(unitScale0[0], 0.00001); - unitScale0[1] = Math.max(unitScale0[1], 0.00001); - unitScale0[2] = Math.max(unitScale0[2], 0.00001); - unitScale1[0] = Math.max(unitScale1[0], 0.00001); - unitScale1[1] = Math.max(unitScale1[1], 0.00001); - unitScale1[2] = Math.max(unitScale1[2], 0.00001); - const endTime = startTime + transitionDuration; - const time0 = Math.min(Math.max((startTime - this._time0) / (this._time1 - this.time0), 0), 1); - const time1 = Math.min(Math.max((endTime - this._time0) / (this._time1 - this.time0), 0), 1); - const materialId = (0, _vertexJs.UnitVertex).getMaterial(currentBuffer.dataView, j); - const material = this._main.materials && this._main.materials.length > materialId ? this._main.materials[materialId] : this._main.config.defaultMaterial; - let hittable; - let unitTexCoord; - switch(currentBuffer.unitType){ - case (0, _indexJs.UnitType).sphere: - case (0, _indexJs.UnitType).sphereSdf: - hittable = new (0, _hittableJs.HittableSphere)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - material: material - }); - break; - case (0, _indexJs.UnitType).disk: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - else hittable = new (0, _hittableJs.HittableRotatedXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - break; - case (0, _indexJs.UnitType).block: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).sdf: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - const texId = (0, _vertexJs.UnitVertex).getTexture(currentBuffer.dataView, j); - const sdfBuffer = (0, _vertexJs.UnitVertex).getSdfBuffer(currentBuffer.dataView, j); - const sdfBorder = (0, _vertexJs.UnitVertex).getSdfBorder(currentBuffer.dataView, j); - const options = { - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: (0, _glMatrix.vec2).fromValues(unitScale0[0], unitScale0[1]), - size1: (0, _glMatrix.vec2).fromValues(unitScale1[0], unitScale1[1]), - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]), - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texId: texId, - sdfBuffer: sdfBuffer, - sdfBorder: sdfBorder - }; - hittable = unitRotation1[3] == 1 ? new (0, _hittableJs.HittableSdfXyRect)(options) : new (0, _hittableJs.HittableRotatedSdfXyRect)(options); - break; - case (0, _indexJs.UnitType).blockSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).ringSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).cylinder: - hittable = new (0, _hittableJs.HittableCylinder)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).cylinderSdf: - hittable = new (0, _hittableJs.HittableCylinderSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).hexPrism: - hittable = new (0, _hittableJs.HittableHexPrism)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - material: material - }); - break; - case (0, _indexJs.UnitType).hexPrismSdf: - hittable = new (0, _hittableJs.HittableHexPrismSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material - }); - break; - } - if (hittable.material instanceof (0, _materialJs.IsotropicMaterial)) this.hittables.push(new (0, _hittableJs.HittableConstantMedium)({ - boundary: hittable, - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - material: hittable.material - })); - else this.hittables.push(hittable); - this.minY = Math.min(hittable.bounds.min[1], this.minY); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} - -},{"gl-matrix":"5x28d","../../atlas.js":"2peXi","../../buffer.js":"itbJk","../../index.js":"9s7CR","../../main.js":"f421K","../../palette.js":"hZb65","../../vertex.js":"4J2YE","./hittable.js":"5cw7N","./material.js":"jQJhi","../../helpers/math.js":"f65d0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6DWH0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -class Constants { -} -Constants.SHADOW_OFFSET = 0.001; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"54e1Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ground", ()=>Ground); -class Ground { - constructor(options){ - if (options) { - this.position = options.position; - this.size = options.size; - this.material = options.material; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dUaaI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>(0, _tableJs.Table)); -parcelHelpers.export(exports, "ColumnType", ()=>(0, _tableJs.ColumnType)); -parcelHelpers.export(exports, "Filter", ()=>(0, _filterJs.Filter)); -var _tableJs = require("./table.js"); -var _filterJs = require("./filter.js"); - -},{"./table.js":"1Nyfw","./filter.js":"b6FuS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7YGk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraBase", ()=>(0, _cameraJs.CameraBase)); -parcelHelpers.export(exports, "CameraView", ()=>(0, _cameraJs.CameraView)); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>(0, _altazimuthJs.AltAzimuthCamera)); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>(0, _altazimuthJs.AltAzimuthCameraView)); -parcelHelpers.export(exports, "OrbitCamera", ()=>(0, _orbitJs.OrbitCamera)); -var _cameraJs = require("./camera.js"); -var _altazimuthJs = require("./altazimuth.js"); -var _orbitJs = require("./orbit.js"); - -},{"./camera.js":"h35rS","./altazimuth.js":"gRqOf","./orbit.js":"6JwjD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6JwjD":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OrbitCamera", ()=>OrbitCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cameraJs = require("./camera.js"); -class OrbitCamera extends (0, _cameraJs.CameraBase) { - getTwist(value) { - (0, _glMatrix.quat).copy(value, this._cameraRotation); - } - setTwist(value, isSmooth) { - (0, _glMatrix.quat).copy(this._cameraRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, value); - } - twist(angle, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._twist(this._vec3, angle); - } - _twist(axis, angle) { - (0, _glMatrix.quat).setAxisAngle(this._quat, axis, angle); - (0, _glMatrix.quat).multiply(this._cameraRotation, this._quat, this._cameraRotation); + } + LightBufferData.SIZE = 64 / 4; + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - rotate(translationDelta) { - (0, _glMatrix.vec3).set(this._vec3, translationDelta[1], translationDelta[0], 0); - const length = (0, _glMatrix.vec3).length(this._vec3); - const angle = length * (0, _constantsJs.Constants).PI / Math.min(this.width, this.height); - (0, _glMatrix.vec3).scale(this._vec3, this._vec3, 1 / length); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._vec3, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - } -} - -},{"gl-matrix":"5x28d","../constants.js":"lD0bG","./camera.js":"h35rS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iZ1f5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize for documentation -parcelHelpers.export(exports, "addDiv", ()=>(0, _htmlHelpers.addDiv)); -parcelHelpers.export(exports, "addEl", ()=>(0, _htmlHelpers.addEl)); -parcelHelpers.export(exports, "allTruthy", ()=>(0, _array.allTruthy)); -parcelHelpers.export(exports, "clone", ()=>(0, _clone.clone)); -parcelHelpers.export(exports, "colorFromString", ()=>(0, _color.colorFromString)); -parcelHelpers.export(exports, "colorIsEqual", ()=>(0, _color.colorIsEqual)); -parcelHelpers.export(exports, "colorToString", ()=>(0, _color.colorToString)); -parcelHelpers.export(exports, "concat", ()=>(0, _array.concat)); -parcelHelpers.export(exports, "createElement", ()=>(0, _tsxCreateElement.createElement)); -parcelHelpers.export(exports, "deepMerge", ()=>(0, _clone.deepMerge)); -parcelHelpers.export(exports, "desaturate", ()=>(0, _color.desaturate)); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>(0, _tsxCreateElement.getActiveElementInfo)); -parcelHelpers.export(exports, "mount", ()=>(0, _tsxCreateElement.mount)); -parcelHelpers.export(exports, "outerSize", ()=>(0, _htmlHelpers.outerSize)); -parcelHelpers.export(exports, "push", ()=>(0, _array.push)); -parcelHelpers.export(exports, "setActiveElement", ()=>(0, _tsxCreateElement.setActiveElement)); -var _array = require("../array"); -var _htmlHelpers = require("../htmlHelpers"); -var _clone = require("../clone"); -var _color = require("../color"); -var _tsxCreateElement = require("tsx-create-element"); - -},{"../array":"cecnk","../htmlHelpers":"fuoG9","../clone":"4Kzai","../color":"cgTtg","tsx-create-element":"dPDUq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cecnk":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "concat", ()=>concat); -/** - * Returns array with items which are truthy. - * @param args array or arrays to concat into a single array. - */ parcelHelpers.export(exports, "allTruthy", ()=>allTruthy); -/** - * Add an array to an existing array in place. - * @param arr Array to append to. - * @param items Arrof of items to append. - */ parcelHelpers.export(exports, "push", ()=>push); -function concat(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []); -} -function allTruthy(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []).filter(Boolean); -} -function push(arr, items) { + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }); + const types = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + MorphChartsCore: Core + }, Symbol.toStringTag, { value: "Module" })); + function concat(...args) { + return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []); + } + function allTruthy(...args) { + return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []).filter(Boolean); + } + function push$1(arr, items) { arr.push.apply(arr, items); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fuoG9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * Create a new element as a child of another element. - * @param tagName Tag name of the new tag to create. - * @param parentElement Reference of the element to append to. - * @returns new HTMLElement. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addEl", ()=>addEl); -/** - * Create a new div HTMLElement as a child of another element. - * @param parentElement Reference of the element to append to. - * @param className Optional css class name to apply to the div. - */ parcelHelpers.export(exports, "addDiv", ()=>addDiv); -/** - * Measure the outer height and width of an HTMLElement, including margin, padding and border. - * @param el HTML Element to measure. - */ parcelHelpers.export(exports, "outerSize", ()=>outerSize); -function addEl(tagName, parentElement) { + } + function addEl(tagName, parentElement) { const el = document.createElement(tagName); parentElement.appendChild(el); return el; -} -function addDiv(parentElement, className) { - const div = addEl('div', parentElement); - if (className) div.className = className; + } + function addDiv(parentElement, className2) { + const div = addEl("div", parentElement); + if (className2) { + div.className = className2; + } return div; -} -function outerSize(el) { + } + function outerSize$1(el) { const cs = getComputedStyle(el); - const height = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); - const width = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); - return { - height, - width - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Kzai":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "deepMerge", ()=>deepMerge); -var _deepmerge = require("deepmerge"); -var _isPlainObject = require("is-plain-object"); -const deepmerge = _deepmerge.default || _deepmerge; -function clone(objectToClone) { - if (!objectToClone) return objectToClone; - return deepmerge.all([ - objectToClone - ]); -} -const dontMerge = (destination, source)=>source; -function deepMerge(...objectsToMerge) { - const objects = objectsToMerge.filter(Boolean); - return deepmerge.all(objects, { - arrayMerge: dontMerge, - isMergeableObject: (0, _isPlainObject.isPlainObject) - }); -} - -},{"deepmerge":"doQxS","is-plain-object":"83B8P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"doQxS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var isMergeableObject = function isMergeableObject(value) { - return isNonNullObject(value) && !isSpecial(value); -}; -function isNonNullObject(value) { - return !!value && typeof value === 'object'; -} -function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value); -} -// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 -var canUseSymbol = typeof Symbol === 'function' && Symbol.for; -var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; -function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE; -} -function emptyTarget(val) { + const height2 = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); + const width2 = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); + return { height: height2, width: width2 }; + } + var isMergeableObject = function isMergeableObject2(value2) { + return isNonNullObject(value2) && !isSpecial(value2); + }; + function isNonNullObject(value2) { + return !!value2 && typeof value2 === "object"; + } + function isSpecial(value2) { + var stringValue = Object.prototype.toString.call(value2); + return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value2); + } + var canUseSymbol = typeof Symbol === "function" && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103; + function isReactElement(value2) { + return value2.$$typeof === REACT_ELEMENT_TYPE; + } + function emptyTarget(val) { return Array.isArray(val) ? [] : {}; -} -function cloneUnlessOtherwiseSpecified(value, options) { - return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; -} -function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options); + } + function cloneUnlessOtherwiseSpecified(value2, options2) { + return options2.clone !== false && options2.isMergeableObject(value2) ? deepmerge$1(emptyTarget(value2), value2, options2) : value2; + } + function defaultArrayMerge(target2, source2, options2) { + return target2.concat(source2).map(function(element2) { + return cloneUnlessOtherwiseSpecified(element2, options2); }); -} -function mergeObject(target, source, options) { + } + function mergeObject(target2, source2, options2) { var destination = {}; - if (options.isMergeableObject(target)) Object.keys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - Object.keys(source).forEach(function(key) { - if (!options.isMergeableObject(source[key]) || !target[key]) destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); - else destination[key] = deepmerge(target[key], source[key], options); + if (options2.isMergeableObject(target2)) { + Object.keys(target2).forEach(function(key2) { + destination[key2] = cloneUnlessOtherwiseSpecified(target2[key2], options2); + }); + } + Object.keys(source2).forEach(function(key2) { + if (!options2.isMergeableObject(source2[key2]) || !target2[key2]) { + destination[key2] = cloneUnlessOtherwiseSpecified(source2[key2], options2); + } else { + destination[key2] = deepmerge$1(target2[key2], source2[key2], options2); + } }); return destination; -} -function deepmerge(target, source, options) { - options = options || {}; - options.arrayMerge = options.arrayMerge || defaultArrayMerge; - options.isMergeableObject = options.isMergeableObject || isMergeableObject; - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); + } + function deepmerge$1(target2, source2, options2) { + options2 = options2 || {}; + options2.arrayMerge = options2.arrayMerge || defaultArrayMerge; + options2.isMergeableObject = options2.isMergeableObject || isMergeableObject; + var sourceIsArray = Array.isArray(source2); + var targetIsArray = Array.isArray(target2); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - if (!sourceAndTargetTypesMatch) return cloneUnlessOtherwiseSpecified(source, options); - else if (sourceIsArray) return options.arrayMerge(target, source, options); - else return mergeObject(target, source, options); -} -deepmerge.all = function deepmergeAll(array, options) { - if (!Array.isArray(array)) throw new Error('first argument should be an array'); - return array.reduce(function(prev, next) { - return deepmerge(prev, next, options); + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source2, options2); + } else if (sourceIsArray) { + return options2.arrayMerge(target2, source2, options2); + } else { + return mergeObject(target2, source2, options2); + } + } + deepmerge$1.all = function deepmergeAll(array2, options2) { + if (!Array.isArray(array2)) { + throw new Error("first argument should be an array"); + } + return array2.reduce(function(prev, next) { + return deepmerge$1(prev, next, options2); }, {}); -}; -var deepmerge_1 = deepmerge; -exports.default = deepmerge_1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"83B8P":[function(require,module,exports,__globalThis) { -/*! - * is-plain-object <https://github.com/jonschlinkert/is-plain-object> - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isPlainObject", ()=>isPlainObject); -function isObject(o) { - return Object.prototype.toString.call(o) === '[object Object]'; -} -function isPlainObject(o) { + }; + var deepmerge_1 = deepmerge$1; + const _deepmerge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: deepmerge_1 + }, Symbol.toStringTag, { value: "Module" })); + function isObject$1(o) { + return Object.prototype.toString.call(o) === "[object Object]"; + } + function isPlainObject(o) { var ctor, prot; - if (isObject(o) === false) return false; - // If has modified constructor + if (isObject$1(o) === false) return false; ctor = o.constructor; - if (ctor === undefined) return true; - // If has modified prototype + if (ctor === void 0) return true; prot = ctor.prototype; - if (isObject(prot) === false) return false; - // If constructor does not have an Object-specific method - if (prot.hasOwnProperty('isPrototypeOf') === false) return false; - // Most likely a plain Object + if (isObject$1(prot) === false) return false; + if (prot.hasOwnProperty("isPrototypeOf") === false) { + return false; + } return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cgTtg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Compares 2 colors to see if they are equal. - * @param a RGBAColor to compare - * @param b RGBAColor to compare - * @returns True if colors are equal. - */ parcelHelpers.export(exports, "colorIsEqual", ()=>colorIsEqual); -/** - * Convert a CSS color string to a Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.). - * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. - */ parcelHelpers.export(exports, "colorFromString", ()=>colorFromString); -/** - * Convert a Deck.gl color to a CSS rgba() string. - * @param color A Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.) - */ parcelHelpers.export(exports, "colorToString", ()=>colorToString); -parcelHelpers.export(exports, "desaturate", ()=>desaturate); -var _d3Color = require("d3-color"); -function rgbToDeckglColor(c) { - return [ - c.r, - c.g, - c.b, - c.opacity * 255 - ]; -} -function colorIsEqual(a, b) { - if (a.length !== b.length) return false; - for(let i = 0; i < a.length; i++){ - if (a[i] !== b[i]) return false; + } + const deepmerge = deepmerge_1 || _deepmerge; + function clone(objectToClone) { + if (!objectToClone) + return objectToClone; + return deepmerge.all([objectToClone]); + } + const dontMerge = (destination, source2) => source2; + function deepMerge(...objectsToMerge) { + const objects = objectsToMerge.filter(Boolean); + return deepmerge.all(objects, { arrayMerge: dontMerge, isMergeableObject: isPlainObject }); + } + function rgbToDeckglColor(c2) { + return [c2.r, c2.g, c2.b, c2.opacity * 255]; + } + function colorIsEqual(a2, b2) { + if (a2.length !== b2.length) + return false; + for (let i = 0; i < a2.length; i++) { + if (a2[i] !== b2[i]) + return false; } return true; -} -function colorFromString(cssColorSpecifier) { + } + function colorFromString(cssColorSpecifier) { if (cssColorSpecifier) { - const dc = (0, _d3Color.color)(cssColorSpecifier); - if (dc) { - const c = dc.rgb(); - return rgbToDeckglColor(c); - } + const dc = color$2(cssColorSpecifier); + if (dc) { + const c2 = dc.rgb(); + return rgbToDeckglColor(c2); + } } -} -function colorToString(color) { - const c = [ - ...color - ]; - if (c.length > 3) c[3] /= 255; - return `rgba(${c.join(',')})`; -} -function desaturate(color, value) { - const rgb = (0, _d3Color.rgb)(color[0], color[1], color[2], color[3] / 255); - const hslColor = (0, _d3Color.hsl)(rgb); - hslColor.s = value; - const c = hslColor.rgb(); - return rgbToDeckglColor(c); -} - -},{"d3-color":"37LNF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Q1zd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "minHeight", ()=>minHeight); -parcelHelpers.export(exports, "minWidth", ()=>minWidth); -parcelHelpers.export(exports, "defaultPresenterStyle", ()=>defaultPresenterStyle); -parcelHelpers.export(exports, "defaultPresenterConfig", ()=>defaultPresenterConfig); -parcelHelpers.export(exports, "createStage", ()=>createStage); -parcelHelpers.export(exports, "groupStrokeWidth", ()=>groupStrokeWidth); -parcelHelpers.export(exports, "lineZ", ()=>lineZ); -parcelHelpers.export(exports, "defaultView", ()=>defaultView); -parcelHelpers.export(exports, "minZ", ()=>minZ); -parcelHelpers.export(exports, "min3dDepth", ()=>min3dDepth); -parcelHelpers.export(exports, "minPixelSize", ()=>minPixelSize); -parcelHelpers.export(exports, "defaultOnAxisItem", ()=>defaultOnAxisItem); -var _color = require("./color"); -const minHeight = '100px'; -const minWidth = '100px'; -const defaultPresenterStyle = { - cssPrefix: 'vega-morphcharts-', - defaultCubeColor: [ - 128, - 128, - 128, - 255 - ], - highlightColor: [ - 0, - 0, - 0, - 255 - ] -}; -const defaultPresenterConfig = { - onCubeClick: (e, cube)=>{}, - onCubeHover: (e, cube)=>{}, + } + function colorToString(color2) { + const c2 = [...color2]; + if (c2.length > 3) { + c2[3] /= 255; + } + return `rgba(${c2.join(",")})`; + } + function desaturate(color2, value2) { + const rgb2 = rgb$1(color2[0], color2[1], color2[2], color2[3] / 255); + const hslColor = hsl$1(rgb2); + hslColor.s = value2; + const c2 = hslColor.rgb(); + return rgbToDeckglColor(c2); + } + const util$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + addDiv, + addEl, + allTruthy, + clone, + colorFromString, + colorIsEqual, + colorToString, + concat, + createElement, + deepMerge, + desaturate, + getActiveElementInfo, + mount, + outerSize: outerSize$1, + push: push$1, + setActiveElement + }, Symbol.toStringTag, { value: "Module" })); + const minHeight = "100px"; + const minWidth = "100px"; + const defaultPresenterStyle$1 = { + cssPrefix: "vega-morphcharts-", + defaultCubeColor: [128, 128, 128, 255], + highlightColor: [0, 0, 0, 255] + }; + const defaultPresenterConfig = { + onCubeClick: (e, cube) => { + }, + onCubeHover: (e, cube) => { + }, transitionDurations: { - position: 600, - stagger: 600, - view: 600 + position: 600, + stagger: 600, + view: 600 }, renderer: { - advanced: false, - advancedOptions: {}, - basicOptions: { - antialias: true - } + advanced: false, + advancedOptions: {}, + basicOptions: { + antialias: true + } } -}; -function createStage(view) { + }; + function createStage(view) { const stage = { - view, - cubeData: [], - pathData: [], - axes: { - x: [], - y: [], - z: [] - }, - gridLines: [], - textData: [], - legend: { - rows: {} - }, - facets: [] + view, + cubeData: [], + pathData: [], + axes: { + x: [], + y: [], + z: [] + }, + gridLines: [], + textData: [], + legend: { + rows: {} + }, + facets: [] }; return stage; -} -const groupStrokeWidth = 1; -const lineZ = 0; -const defaultView = '2d'; -const minZ = 0.5; -const min3dDepth = 0.05; -const minPixelSize = 0.5; -const zAxisEncodeColor = [ - 7, - 7, - 7, - 255 -]; -const zAxisOutColor = [ - 0, - 0, - 0, - 255 -]; -function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { - if ((0, _color.colorIsEqual)(stageItem.color, zAxisEncodeColor)) { - stageItem.color = zAxisOutColor; - if (currAxis.axisRole !== 'z') { - const previousAxisRole = removeCurrentAxes(stage, currAxis); - if (previousAxisRole) { - currAxis.axisRole = 'z'; - stage.axes.z.push(currAxis); - } + } + const groupStrokeWidth = 1; + const lineZ = 0; + const defaultView$1 = "2d"; + const minZ = 0.5; + const min3dDepth = 0.05; + const minPixelSize = 0.5; + const zAxisEncodeColor = [7, 7, 7, 255]; + const zAxisOutColor = [0, 0, 0, 255]; + function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { + if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { + stageItem.color = zAxisOutColor; + if (currAxis.axisRole !== "z") { + const previousAxisRole = removeCurrentAxes(stage, currAxis); + if (previousAxisRole) { + currAxis.axisRole = "z"; + stage.axes.z.push(currAxis); + } + } + } + } + function removeCurrentAxes(stage, currAxis) { + for (const axisRole in stage.axes) { + const axes = stage.axes[axisRole]; + for (let i = 0; i < axes.length; i++) { + if (axes[i] === currAxis) { + axes.splice(i, 1); + return axisRole; } + } } -} -function removeCurrentAxes(stage, currAxis) { - //find the current axis, remove it from parent - for(const axisRole in stage.axes){ - const axes = stage.axes[axisRole]; - for(let i = 0; i < axes.length; i++)if (axes[i] === currAxis) { - axes.splice(i, 1); - return axisRole; - } - } -} - -},{"./color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hIePf":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param vega Vega library. - */ parcelHelpers.export(exports, "use", ()=>use); -const vega = { + } + const defaults$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + createStage, + defaultOnAxisItem, + defaultPresenterConfig, + defaultPresenterStyle: defaultPresenterStyle$1, + defaultView: defaultView$1, + groupStrokeWidth, + lineZ, + min3dDepth, + minHeight, + minPixelSize, + minWidth, + minZ + }, Symbol.toStringTag, { value: "Module" })); + const vega$1 = { CanvasHandler: null, inferType: null, inferTypes: null, @@ -41571,10999 +22319,7735 @@ const vega = { scheme: null, truncate: null, View: null -}; -const base = { - vega -}; -function use(vega) { - base.vega = vega; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9yYY0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Class which presents a Stage of chart data using MorphCharts to render. - */ parcelHelpers.export(exports, "Presenter", ()=>Presenter); -var _clone = require("./clone"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -var _legend = require("./legend"); -var _panel = require("./panel"); -var _patchedCubeArray = require("./patchedCubeArray"); -var _stagers = require("./stagers"); -var _tsxCreateElement = require("tsx-create-element"); -var _morphcharts = require("./morphcharts"); -class Presenter { - /** - * Get the previously rendered Stage object. - */ get stage() { - return this._last.stage; - } - /** - * Get the current View camera type. - */ get view() { - return this._last.view; - } - /** - * Instantiate a new Presenter. - * @param el Parent HTMLElement to present within. - * @param style Optional PresenterStyle styling options. - */ constructor(el, style){ - this.el = el; - this.style = (0, _clone.deepMerge)((0, _defaults.defaultPresenterStyle), style); - (0, _panel.initializePanel)(this); - this._last = { - view: null, - height: null, - width: null, - cubeCount: null, - stage: null - }; - } - /** - * Cancels any pending animation, calling animationCanceled() on original queue. - */ animationCancel() { - if (this.animationTimer) { - clearTimeout(this.animationTimer); - this.animationTimer = null; - if (this.logger) this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || 'handler'}`); - if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) this.queuedAnimationOptions.animationCanceled.call(null); - } - } - /** - * Stops the current animation and queues a new animation. - * @param handler Function to invoke when timeout is complete. - * @param timeout Length of time to wait before invoking the handler. - * @param options Optional QueuedAnimationOptions object. - */ animationQueue(handler, timeout, options) { - if (this.logger) this.logger(`queueing animation ${options && options.waitingLabel || 'waiting'}...(${timeout})`); - this.animationCancel(); - this.animationTimer = setTimeout(()=>{ - if (this.logger) this.logger(`queueing animation ${options && options.handlerLabel || 'handler'}...`); - handler(); - }, timeout); - } - /** - * Retrieve a sub-element of the rendered output. - * @param type PresenterElement type of the HTMLElement to retrieve. - */ getElement(type) { - const elements = this.el.getElementsByClassName((0, _panel.className)(type, this)); - if (elements && elements.length) return elements[0]; - } - /** - * Present the Vega Scene, or Stage object using Morphcharts. - * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. - * @param height Height of the rendering area. - * @param width Width of the rendering area. - * @param config Optional presentation configuration object. - */ present(sceneOrStage, height, width, config) { - this.animationCancel(); - const scene = sceneOrStage; - let stage; - const options = { - maxOrdinal: 0, - currAxis: null, - defaultCubeColor: this.style.defaultCubeColor, - assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (()=>options.maxOrdinal++), - modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : (0, _defaults.defaultOnAxisItem), - zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex - }; - //determine if this is a vega scene - if (scene.marktype) { - stage = (0, _defaults.createStage)(scene.view); - (0, _stagers.sceneToStage)(options, stage, scene); - } else stage = sceneOrStage; - const c = (0, _clone.deepMerge)((0, _defaults.defaultPresenterConfig), config); - if (!this.morphchartsref) { - this._morphChartsOptions = { - container: this.getElement((0, _enums.PresenterElement).gl), - pickGridCallback: c.axisPickGridCallback, - onCubeHover: (e, ordinal)=>{ - c.onCubeHover(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCubeClick: (e, ordinal)=>{ - c.onCubeClick(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, - onLasso: config === null || config === void 0 ? void 0 : config.onLasso - }; - this.morphchartsref = (0, _morphcharts.init)(this._morphChartsOptions, c.renderer || (0, _defaults.defaultPresenterConfig).renderer); - } - let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); - if (options.maxOrdinal) { - cubeCount = Math.max(cubeCount, options.maxOrdinal); - const empty = { - isEmpty: true - }; - stage.cubeData = (0, _patchedCubeArray.patchCubeArray)(cubeCount, empty, stage.cubeData); - } - config.preLayer && config.preLayer(stage); - this.morphChartsRenderResult = (0, _morphcharts.morphChartsRender)(this.morphchartsref, this._last.stage, stage, height, width, config && config.preStage, config && config.morphChartsColors, c); - delete stage.cubeData; - delete stage.redraw; - this._last = { - cubeCount, - height, - width, - stage, - view: stage.view - }; - const a = (0, _tsxCreateElement.getActiveElementInfo)(); - (0, _tsxCreateElement.mount)((0, _legend.LegendView)({ - legend: stage.legend, - onClick: config && config.onLegendClick - }), this.getElement((0, _enums.PresenterElement).legend)); - (0, _tsxCreateElement.setActiveElement)(a); - if (config && config.onPresent) config.onPresent(); - } - canvasToDataURL() { - return new Promise((resolve, reject)=>{ - this.morphchartsref.core.afterRenderCallback = ()=>{ - this.morphchartsref.core.afterRenderCallback = null; - const canvas = this.getElement((0, _enums.PresenterElement).gl).getElementsByTagName('canvas')[0]; - const png = canvas.toDataURL('image/png'); - resolve(png); - }; - }); - } - configColors(mcColors) { - (0, _morphcharts.colorConfig)(this.morphchartsref, mcColors); - } - /** - * Home the camera to the last initial position. - */ homeCamera() { - var _a; - (_a = this.morphchartsref) === null || _a === void 0 || _a.reset(); - } - /** - * Show guidelines of rendering height/width and center of OrbitView. - */ showGuides() { - this.getElement((0, _enums.PresenterElement).gl).classList.add('show-center'); - //TODO Morphcharts gridlines - } - finalize() { - this.animationCancel(); - if (this.morphchartsref) this.morphchartsref.core.stop(); - if (this.el) this.el.innerHTML = ''; - this._last = null; - this.morphchartsref = null; - this.el = null; - this.logger = null; - this.queuedAnimationOptions = null; - } -} - -},{"./clone":"4Kzai","./defaults":"4Q1zd","./enums":"hnVHt","./legend":"aunMk","./panel":"l2IQQ","./patchedCubeArray":"eWKaN","./stagers":"6p1Cn","tsx-create-element":"dPDUq","./morphcharts":"6vcDa","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hnVHt":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * HTML elements outputted by the presenter. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PresenterElement", ()=>PresenterElement); -var PresenterElement; -(function(PresenterElement) { - PresenterElement[PresenterElement["root"] = 0] = "root"; - PresenterElement[PresenterElement["gl"] = 1] = "gl"; - PresenterElement[PresenterElement["panel"] = 2] = "panel"; - PresenterElement[PresenterElement["legend"] = 3] = "legend"; - PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls"; -})(PresenterElement || (PresenterElement = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aunMk":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LegendView", ()=>LegendView); -var _tsxCreateElement = require("tsx-create-element"); -var _controls = require("./controls"); -const LegendView = (props)=>{ + }; + const base$3 = { + vega: vega$1 + }; + function use$5(vega2) { + base$3.vega = vega2; + } + var PresenterElement$1; + (function(PresenterElement2) { + PresenterElement2[PresenterElement2["root"] = 0] = "root"; + PresenterElement2[PresenterElement2["gl"] = 1] = "gl"; + PresenterElement2[PresenterElement2["panel"] = 2] = "panel"; + PresenterElement2[PresenterElement2["legend"] = 3] = "legend"; + PresenterElement2[PresenterElement2["vegaControls"] = 4] = "vegaControls"; + })(PresenterElement$1 || (PresenterElement$1 = {})); + const LegendView = (props) => { const rows = []; - const addRow = (row, i)=>{ - const fn = symbolMap[row.symbol.shape]; - let jsx; - if (fn) jsx = fn(row.symbol); - else jsx = (0, _tsxCreateElement.createElement)("span", null, "x"); - rows.push({ - cells: [ - { - className: 'symbol', - content: jsx - }, - { - className: 'label', - content: row.label, - title: row.label - } - ] - }); + const addRow = (row, i) => { + const fn2 = symbolMap[row.symbol.shape]; + let jsx; + if (fn2) { + jsx = fn2(row.symbol); + } else { + jsx = createElement("span", null, "x"); + } + rows.push({ + cells: [ + { className: "symbol", content: jsx }, + { className: "label", content: row.label, title: row.label } + ] + }); }; - const sorted = Object.keys(props.legend.rows).sort((a, b)=>+a - +b); - sorted.forEach((i)=>addRow(props.legend.rows[i], +i)); - if (sorted.length) return (0, _tsxCreateElement.createElement)((0, _controls.Table), { - rows: rows, - rowClassName: "legend-row", - onRowClick: (e, i)=>props.onClick(e, props.legend, i) - }, props.legend.title !== void 0 && (0, _tsxCreateElement.createElement)("tr", { - onClick: (e)=>props.onClick(e, props.legend, null) - }, (0, _tsxCreateElement.createElement)("th", { - colSpan: 2 - }, props.legend.title))); -}; -const symbolMap = { - square: function(symbol) { - return (0, _tsxCreateElement.createElement)("div", { - style: { - height: `${symbol.bounds.y2 - symbol.bounds.y1}px`, - width: `${symbol.bounds.x2 - symbol.bounds.x1}px`, - backgroundColor: symbol.fill, - borderColor: symbol.fill - } - }); - } -}; - -},{"tsx-create-element":"dPDUq","./controls":"9lm1L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l2IQQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializePanel", ()=>initializePanel); -parcelHelpers.export(exports, "className", ()=>className); -var _tsxCreateElement = require("tsx-create-element"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -function initializePanel(presenter) { - const rootDiv = (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).root, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).gl, presenter), - style: { - minHeight: (0, _defaults.minHeight), - minWidth: (0, _defaults.minWidth) - } - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).panel, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).vegaControls, presenter) - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).legend, presenter) - }))); - (0, _tsxCreateElement.mount)(rootDiv, presenter.el); -} -function className(type, presenter) { - return `${presenter.style.cssPrefix}${(0, _enums.PresenterElement)[type]}`; -} - -},{"tsx-create-element":"dPDUq","./defaults":"4Q1zd","./enums":"hnVHt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eWKaN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "patchCubeArray", ()=>patchCubeArray); -function patchCubeArray(allocatedSize, empty, cubes) { - const patched = new Array(allocatedSize); - patched.fill(empty); - cubes.forEach((cube)=>patched[cube.ordinal] = cube); - return patched; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6p1Cn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sceneToStage", ()=>sceneToStage); -var _legend = require("./marks/legend"); -var _legendDefault = parcelHelpers.interopDefault(_legend); -var _image = require("./marks/image"); -var _imageDefault = parcelHelpers.interopDefault(_image); -var _rect = require("./marks/rect"); -var _rectDefault = parcelHelpers.interopDefault(_rect); -var _rule = require("./marks/rule"); -var _ruleDefault = parcelHelpers.interopDefault(_rule); -var _line = require("./marks/line"); -var _lineDefault = parcelHelpers.interopDefault(_line); -var _text = require("./marks/text"); -var _textDefault = parcelHelpers.interopDefault(_text); -var _base = require("./base"); -var _color = require("./color"); -var _defaults = require("./defaults"); -var _interfaces = require("./marks/interfaces"); -function getAxisGroupType(item, options) { - const axisItem = item; - const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; - if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== undefined) return (0, _interfaces.GroupType).zAxis; - switch(axisItem.orient){ - case 'bottom': - case 'top': - return (0, _interfaces.GroupType).xAxis; - case 'left': - case 'right': - return (0, _interfaces.GroupType).yAxis; - } -} -function convertGroupRole(item, options) { - if (item.mark.role === 'legend') return (0, _interfaces.GroupType).legend; - if (item.mark.role === 'axis') { - const groupType = getAxisGroupType(item, options); - if (groupType !== undefined) return groupType; - } -} -const group = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(g) { - const gx = g.x || 0, gy = g.y || 0; - if (g.context && g.context.background && !stage.backgroundColor) stage.backgroundColor = (0, _color.colorFromString)(g.context.background); - if (g.stroke) { - const facetRect = { - datum: g.datum, - lines: (0, _rule.box)(gx + x, gy + y, g.height, g.width, g.stroke, (0, _defaults.groupStrokeWidth)) - }; - stage.facets.push(facetRect); - } - groupType = convertGroupRole(g, options) || groupType; - setCurrentAxis(options, stage, groupType); - // draw group contents - (0, _base.base).vega.sceneVisit(g, function(item) { - mainStager(options, stage, item, gx + x, gy + y, groupType); - }); - }); -}; -function setCurrentAxis(options, stage, groupType) { - let axisRole; - switch(groupType){ - case (0, _interfaces.GroupType).xAxis: - axisRole = 'x'; - break; - case (0, _interfaces.GroupType).yAxis: - axisRole = 'y'; - break; - case (0, _interfaces.GroupType).zAxis: - axisRole = 'z'; - break; - default: - return; + const sorted = Object.keys(props.legend.rows).sort((a2, b2) => +a2 - +b2); + sorted.forEach((i) => addRow(props.legend.rows[i])); + if (sorted.length) { + return createElement(Table$1, { rows, rowClassName: "legend-row", onRowClick: (e, i) => props.onClick(e, props.legend, i) }, props.legend.title !== void 0 && createElement( + "tr", + { onClick: (e) => props.onClick(e, props.legend, null) }, + createElement("th", { colSpan: 2 }, props.legend.title) + )); } - options.currAxis = { - axisRole, - domain: null, - tickText: [], - ticks: [] - }; - stage.axes[axisRole].push(options.currAxis); -} -const markStagers = { - group, - legend: (0, _legendDefault.default), - image: (0, _imageDefault.default), - rect: (0, _rectDefault.default), - rule: (0, _ruleDefault.default), - line: (0, _lineDefault.default), - text: (0, _textDefault.default) -}; -const mainStager = (options, stage, scene, x, y, groupType)=>{ - if (scene.marktype !== 'group' && groupType === (0, _interfaces.GroupType).legend) (0, _legendDefault.default)(options, stage, scene, x, y, groupType); - else { - const markStager = markStagers[scene.marktype]; - if (markStager) markStager(options, stage, scene, x, y, groupType); + }; + const symbolMap = { + square: function(symbol2) { + return createElement("div", { style: { + height: `${symbol2.bounds.y2 - symbol2.bounds.y1}px`, + width: `${symbol2.bounds.x2 - symbol2.bounds.x1}px`, + backgroundColor: symbol2.fill, + borderColor: symbol2.fill + } }); } -}; -function sceneToStage(options, stage, scene) { - mainStager(options, stage, scene, 0, 0, null); - sortAxis(stage.axes.x, 0); - sortAxis(stage.axes.y, 1); - sortAxis(stage.axes.z, 1); -} -function sortAxis(axes, dim) { - axes.forEach((axis)=>{ - if (axis.domain) orderDomain(axis.domain, dim); - axis.ticks.sort((a, b)=>a.sourcePosition[dim] - b.sourcePosition[dim]); - axis.tickText.sort((a, b)=>a.position[dim] - b.position[dim]); - }); -} -function orderDomain(domain, dim) { - if (domain.sourcePosition[dim] > domain.targetPosition[dim]) { - const temp = domain.targetPosition; - domain.targetPosition = domain.sourcePosition; - domain.sourcePosition = temp; - } -} - -},{"./marks/legend":"jtBG9","./marks/image":"1Vs56","./marks/rect":"7DefN","./marks/rule":"aqAq7","./marks/line":"axYMN","./marks/text":"geL5J","./base":"hIePf","./color":"cgTtg","./defaults":"4Q1zd","./marks/interfaces":"96Qp6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jtBG9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const legendMap = { - 'legend-title': function(legend, textItem) { - legend.title = textItem.text; + }; + function initializePanel(presenter) { + const rootDiv = createElement( + "div", + { className: className$1(PresenterElement$1.root, presenter) }, + createElement("div", { className: className$1(PresenterElement$1.gl, presenter), style: { minHeight, minWidth } }), + createElement( + "div", + { className: className$1(PresenterElement$1.panel, presenter) }, + createElement("div", { className: className$1(PresenterElement$1.vegaControls, presenter) }), + createElement("div", { className: className$1(PresenterElement$1.legend, presenter) }) + ) + ); + mount(rootDiv, presenter.el); + } + function className$1(type2, presenter) { + return `${presenter.style.cssPrefix}${PresenterElement$1[type2]}`; + } + function patchCubeArray(allocatedSize, empty, cubes) { + const patched = new Array(allocatedSize); + patched.fill(empty); + cubes.forEach((cube) => patched[cube.ordinal] = cube); + return patched; + } + const legendMap = { + "legend-title": function(legend2, textItem) { + legend2.title = textItem.text; }, - 'legend-symbol': function(legend, symbol) { - const { bounds, fill, shape } = symbol; - //this object is safe for serialization - const legendRowSymbol = { - bounds, - fill, - shape - }; - const i = symbol.datum.index; - legend.rows[i] = legend.rows[i] || {}; - legend.rows[i].symbol = legendRowSymbol; + "legend-symbol": function(legend2, symbol2) { + const { bounds: bounds2, fill: fill2, shape: shape2 } = symbol2; + const legendRowSymbol = { bounds: bounds2, fill: fill2, shape: shape2 }; + const i = symbol2.datum.index; + legend2.rows[i] = legend2.rows[i] || {}; + legend2.rows[i].symbol = legendRowSymbol; }, - 'legend-label': function(legend, label) { - const i = label.datum.index; - legend.rows[i] = legend.rows[i] || {}; - const row = legend.rows[i]; - row.label = label.text; - row.value = label.datum.value; - } -}; -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const fn = legendMap[item.mark.role]; - if (fn) fn(stage.legend, item); + "legend-label": function(legend2, label2) { + const i = label2.datum.index; + legend2.rows[i] = legend2.rows[i] || {}; + const row = legend2.rows[i]; + row.label = label2.text; + row.value = label2.datum.value; + } + }; + const markStager$5 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const fn2 = legendMap[item.mark.role]; + if (fn2) { + fn2(stage.legend, item); + } }); -}; -exports.default = markStager; - -},{"../base":"hIePf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Vs56":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const { bounds, height, url, width } = item; - let { x1, x2, y1, y2 } = bounds; - x1 += x; - x2 += x; - y1 += y; - y2 += y; - if (!stage.backgroundImages) stage.backgroundImages = []; - stage.backgroundImages.push({ - bounds: { - x1, - x2, - y1, - y2 - }, - height, - url, - width - }); + }; + const markStager$4 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const { bounds: bounds2, height: height2, url, width: width2 } = item; + let { x1: x12, x2: x22, y1: y12, y2: y22 } = bounds2; + x12 += x2; + x22 += x2; + y12 += y2; + y22 += y2; + if (!stage.backgroundImages) { + stage.backgroundImages = []; + } + stage.backgroundImages.push({ bounds: { x1: x12, x2: x22, y1: y12, y2: y22 }, height: height2, url, width: width2 }); }); -}; -exports.default = markStager; - -},{"../base":"hIePf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7DefN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const noZ = item.z === undefined; - const z = noZ ? 0 : (item.z || 0) + (0, _defaults.minZ); - const depth = (noZ ? 0 : item.depth || 0) + (0, _defaults.min3dDepth); - //change direction of y from SVG to GL - const ty = -1; - const ordinal = options.assignCubeOrdinal(item.datum); - if (ordinal > options.maxOrdinal) options.maxOrdinal = ordinal; - if (ordinal === undefined) ; - else { - const cube = { - ordinal, - size: [ - item.width, - item.height, - depth - ], - position: [ - x + (+item.x || 0), - ty * (y + (+item.y || 0)) - +item.height, - z - ], - color: (0, _color.colorFromString)(item.fill) || options.defaultCubeColor || [ - 128, - 128, - 128, - 128 - ] - }; - cube.color[3] = item.opacity === undefined ? 255 : 255 * item.opacity; - stage.cubeData.push(cube); - } + }; + const markStager$3 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const noZ = item.z === void 0; + const z2 = noZ ? 0 : (item.z || 0) + minZ; + const depth = (noZ ? 0 : item.depth || 0) + min3dDepth; + const ty2 = -1; + const ordinal2 = options2.assignCubeOrdinal(item.datum); + if (ordinal2 > options2.maxOrdinal) { + options2.maxOrdinal = ordinal2; + } + if (ordinal2 === void 0) ; + else { + const cube = { + ordinal: ordinal2, + size: [item.width, item.height, depth], + position: [x2 + (+item.x || 0), ty2 * (y2 + (+item.y || 0)) - +item.height, z2], + color: colorFromString(item.fill) || options2.defaultCubeColor || [128, 128, 128, 128] + }; + cube.color[3] = item.opacity === void 0 ? 255 : 255 * item.opacity; + stage.cubeData.push(cube); + } }); -}; -exports.default = markStager; - -},{"../base":"hIePf","../color":"cgTtg","../defaults":"4Q1zd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aqAq7":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "box", ()=>box); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const x1 = item.x || 0; - const y1 = item.y || 0; - const x2 = item.x2 != null ? item.x2 : x1; - const y2 = item.y2 != null ? item.y2 : y1; - const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth); - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, lineItem, stage, currAxis); - if (item.mark.role === 'axis-tick') currAxis.ticks.push(lineItem); - else if (item.mark.role === 'axis-domain') currAxis.domain = lineItem; - else stage.gridLines.push(lineItem); + }; + const markStager$2 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(item) { + const x12 = item.x || 0; + const y12 = item.y || 0; + const x22 = item.x2 != null ? item.x2 : x12; + const y22 = item.y2 != null ? item.y2 : y12; + const lineItem = styledLine(x12 + x2, y12 + y2, x22 + x2, y22 + y2, item.stroke, item.strokeWidth); + const { currAxis } = options2; + if (options2.modifyAxis) { + options2.modifyAxis(item, lineItem, stage, currAxis); + } + if (item.mark.role === "axis-tick") { + currAxis.ticks.push(lineItem); + } else if (item.mark.role === "axis-domain") { + currAxis.domain = lineItem; + } else { + stage.gridLines.push(lineItem); + } }); -}; -function styledLine(x1, y1, x2, y2, stroke, strokeWidth) { - const line = { - sourcePosition: [ - x1, - -y1, - (0, _defaults.lineZ) - ], - targetPosition: [ - x2, - -y2, - (0, _defaults.lineZ) - ], - color: (0, _color.colorFromString)(stroke), - strokeWidth: strokeWidth - }; - return line; -} -function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) { + }; + function styledLine(x12, y12, x2, y2, stroke2, strokeWidth) { + const line2 = { + sourcePosition: [x12, -y12, lineZ], + //-1 = change direction of y from SVG to GL + targetPosition: [x2, -y2, lineZ], + color: colorFromString(stroke2), + strokeWidth + }; + return line2; + } + function box(gx, gy, height2, width2, stroke2, strokeWidth, diagonals = false) { const lines = [ - styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), - styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), - styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), - styledLine(gx, gy + height, gx, gy, stroke, strokeWidth) + styledLine(gx, gy, gx + width2, gy, stroke2, strokeWidth), + styledLine(gx + width2, gy, gx + width2, gy + height2, stroke2, strokeWidth), + styledLine(gx + width2, gy + height2, gx, gy + height2, stroke2, strokeWidth), + styledLine(gx, gy + height2, gx, gy, stroke2, strokeWidth) ]; if (diagonals) { - lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth)); - lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth)); + lines.push(styledLine(gx, gy, gx + width2, gy + height2, stroke2, strokeWidth)); + lines.push(styledLine(gx, gy + height2, gx + width2, gy, stroke2, strokeWidth)); } return lines; -} -exports.default = markStager; - -},{"../base":"hIePf","../color":"cgTtg","../defaults":"4Q1zd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"axYMN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _color = require("../color"); -//change direction of y from SVG to GL -const ty = -1; -const markStager = (options, stage, scene, x, y, groupType)=>{ - const g = Object.assign({ - opacity: 1, - strokeOpacity: 1, - strokeWidth: 1 - }, scene.items[0]); - const path = { - strokeWidth: g.strokeWidth, - strokeColor: (0, _color.colorFromString)(g.stroke), - positions: scene.items.map((it)=>[ - it.x, - ty * it.y, - it.z || 0 - ]) - }; - path.strokeColor[3] *= g.strokeOpacity; - path.strokeColor[3] *= g.opacity; - stage.pathData.push(path); -}; -exports.default = markStager; - -},{"../color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"geL5J":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ // import { AlignmentBaseline, TextAnchor } from '@deck.gl/layers/text-layer/text-layer'; -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - //change direction of y from SVG to GL - const ty = -1; - (0, _base.base).vega.sceneVisit(scene, function(item) { - if (!item.text) return; - const size = item.fontSize; - //const alignmentBaseline = convertBaseline(item.baseline); - //const yOffset = alignmentBaseline === 'top' ? item.fontSize / 2 : 0; //fixup to get tick text correct - const yOffset = 0; - const textItem = { - color: (0, _color.colorFromString)(item.fill), - text: item.limit === undefined ? item.text : (0, _base.base).vega.truncate(item.text, item.limit, 'right', item.ellipsis || '...'), - position: [ - x + (item.x || 0), - ty * (y + (item.y || 0) + yOffset), - 0 - ], - size, - angle: convertAngle(item.angle), - //textAnchor: convertAlignment(item.align), - //alignmentBaseline, - metaData: item.metaData - }; - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, textItem, stage, currAxis); - if (item.mark.role === 'axis-label') { - const tickText = textItem; - tickText.value = item.datum.value; - currAxis.tickText.push(tickText); - } else if (item.mark.role === 'axis-title') currAxis.title = textItem; - else stage.textData.push(textItem); + } + const ty = -1; + const markStager$1 = (options2, stage, scene, x2, y2, groupType) => { + const g = Object.assign({ opacity: 1, strokeOpacity: 1, strokeWidth: 1 }, scene.items[0]); + const path2 = { + strokeWidth: g.strokeWidth, + strokeColor: colorFromString(g.stroke), + positions: scene.items.map((it) => [ + it.x, + ty * it.y, + it.z || 0 + ]) + }; + path2.strokeColor[3] *= g.strokeOpacity; + path2.strokeColor[3] *= g.opacity; + stage.pathData.push(path2); + }; + const markStager = (options2, stage, scene, x2, y2, groupType) => { + const ty2 = -1; + base$3.vega.sceneVisit(scene, function(item) { + if (!item.text) + return; + const size = item.fontSize; + const yOffset = 0; + const textItem = { + color: colorFromString(item.fill), + text: item.limit === void 0 ? item.text : base$3.vega.truncate(item.text, item.limit, "right", item.ellipsis || "..."), + //use dots instead of unicode ellipsis for + position: [x2 + (item.x || 0), ty2 * (y2 + (item.y || 0) + yOffset), 0], + size, + angle: convertAngle(item.angle), + //textAnchor: convertAlignment(item.align), + //alignmentBaseline, + metaData: item.metaData + }; + const { currAxis } = options2; + if (options2.modifyAxis) { + options2.modifyAxis(item, textItem, stage, currAxis); + } + if (item.mark.role === "axis-label") { + const tickText = textItem; + tickText.value = item.datum.value; + currAxis.tickText.push(tickText); + } else if (item.mark.role === "axis-title") { + currAxis.title = textItem; + } else { + stage.textData.push(textItem); + } }); -}; -function convertAngle(vegaTextAngle) { - if (vegaTextAngle && !isNaN(vegaTextAngle)) return 360 - vegaTextAngle; + }; + function convertAngle(vegaTextAngle) { + if (vegaTextAngle && !isNaN(vegaTextAngle)) { + return 360 - vegaTextAngle; + } return 0; -} -// function convertAlignment(textAlign: SceneTextAlign): TextAnchor { -// switch (textAlign) { -// case 'center': return 'middle'; -// case 'left': return 'start'; -// case 'right': return 'end'; -// } -// return 'start'; -// } -// function convertBaseline(baseline: SceneTextBaseline): AlignmentBaseline { -// switch (baseline) { -// case 'middle': return 'center'; -// } -// return baseline || 'bottom'; -// } -exports.default = markStager; - -},{"../base":"hIePf","../color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"96Qp6":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GroupType", ()=>GroupType); -var GroupType; -(function(GroupType) { - GroupType[GroupType["none"] = 0] = "none"; - GroupType[GroupType["legend"] = 1] = "legend"; - GroupType[GroupType["xAxis"] = 2] = "xAxis"; - GroupType[GroupType["yAxis"] = 3] = "yAxis"; - GroupType[GroupType["zAxis"] = 4] = "zAxis"; -})(GroupType || (GroupType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6vcDa":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _render = require("./render"); -parcelHelpers.exportAll(_render, exports); -var _color = require("./color"); -parcelHelpers.exportAll(_color, exports); -var _init = require("./init"); -parcelHelpers.exportAll(_init, exports); - -},{"./render":"k7EOz","./color":"7T6SC","./init":"dMNNU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k7EOz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "morphChartsRender", ()=>morphChartsRender); -var _axes = require("./axes"); -var _bounds = require("./bounds"); -var _cubes = require("./cubes"); -var _lines = require("./lines"); -var _text = require("./text"); -var _image = require("./image"); -var _defaults = require("../defaults"); -var _color = require("./color"); -var _defaults1 = require("./defaults"); -var _camera = require("./camera"); -function morphChartsRender(ref, prevStage, stage, height, width, preStage, colors, config) { - const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults1.cameraDefaults); - const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref; - let transistion2dOnly = false; - let cameraTo; - let holdCamera; - if (config.camera === 'hold') holdCamera = true; - else cameraTo = config.camera; - if (prevStage && prevStage.view !== stage.view) { - modelTransitioner.shouldTransition = !holdCamera; - if (stage.view === '2d') { - modelTransitioner.qRotation.from = qModelRotation3d; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.from = qModelRotation2d; - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - } else { - modelTransitioner.shouldTransition = false; - if (stage.view === '2d') { - transistion2dOnly = true; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } + } + var GroupType; + (function(GroupType2) { + GroupType2[GroupType2["none"] = 0] = "none"; + GroupType2[GroupType2["legend"] = 1] = "legend"; + GroupType2[GroupType2["xAxis"] = 2] = "xAxis"; + GroupType2[GroupType2["yAxis"] = 3] = "yAxis"; + GroupType2[GroupType2["zAxis"] = 4] = "zAxis"; + })(GroupType || (GroupType = {})); + function getAxisGroupType(item, options2) { + const axisItem = item; + const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; + if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options2.zAxisZindex && options2.zAxisZindex !== void 0) { + return GroupType.zAxis; } - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - if (!prevStage) { - core.setModelRotation(modelTransitioner.qRotation.to, false); - core.camera.setOrbit(cameraTransitioner.qRotation.to, false); - core.camera.setPosition(cameraTransitioner.vPosition.to, false); - } else if (!holdCamera) cameraTransitioner.begin(); - positionTransitioner.begin(); - if (modelTransitioner.shouldTransition) modelTransitioner.begin(); - const props = { - ref, - stage, - height, - width, - config - }; - const cubeLayer = (0, _cubes.createCubeLayer)(props); - const lineLayer = (0, _lines.createLineLayer)(props); - const textLayer = (0, _text.createTextLayer)(props); - const { backgroundImages } = stage; - let contentBounds = (0, _bounds.outerBounds)((0, _bounds.outerBounds)(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), (0, _bounds.outerBounds)(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); - backgroundImages === null || backgroundImages === void 0 || backgroundImages.forEach((backgroundImage)=>{ - contentBounds = (0, _bounds.outerBounds)(contentBounds, convertBounds(backgroundImage.bounds)); - }); - props.bounds = contentBounds; - core.renderer.previousAxes = core.renderer.currentAxes; - const axesLayer = (0, _axes.createAxesLayer)(props); - core.config.transitionStaggering = config.transitionDurations.stagger; - core.config.transitionDuration = config.transitionDurations.position; - let bounds; - if (axesLayer && axesLayer.bounds) bounds = axesLayer.bounds; - else bounds = contentBounds; - ref.setMorphChartsRendererOptions(config.renderer); - if (preStage) preStage(stage, cubeLayer); - //add images - core.renderer.images = []; - if (backgroundImages) { - const addImage = (imageBounds, imageData)=>{ - const imageWidth = imageBounds.maxBoundsX - imageBounds.minBoundsX; - const imageHeight = imageBounds.maxBoundsY - imageBounds.minBoundsY; - const position = [ - imageBounds.minBoundsX + imageWidth / 2, - imageBounds.minBoundsY + imageHeight / 2, - 0 - ]; - const imageQuad = (0, _image.createImageQuad)(core, imageData, contentBounds, position, imageWidth, imageHeight); - const imageVisual = core.renderer.createImageVisual(imageQuad); - core.renderer.images.push(imageVisual); + switch (axisItem.orient) { + case "bottom": + case "top": + return GroupType.xAxis; + case "left": + case "right": + return GroupType.yAxis; + } + } + function convertGroupRole(item, options2) { + if (item.mark.role === "legend") + return GroupType.legend; + if (item.mark.role === "axis") { + const groupType = getAxisGroupType(item, options2); + if (groupType !== void 0) { + return groupType; + } + } + } + const group$1 = (options2, stage, scene, x2, y2, groupType) => { + base$3.vega.sceneVisit(scene, function(g) { + const gx = g.x || 0, gy = g.y || 0; + if (g.context && g.context.background && !stage.backgroundColor) { + stage.backgroundColor = colorFromString(g.context.background); + } + if (g.stroke) { + const facetRect = { + datum: g.datum, + lines: box(gx + x2, gy + y2, g.height, g.width, g.stroke, groupStrokeWidth) }; - const imageDataCache = {}; - backgroundImages.forEach((backgroundImage)=>{ - const imageBounds = convertBounds(backgroundImage.bounds); - const imageData = imageDataCache[backgroundImage.url]; - if (imageData) addImage(imageBounds, imageData); - else (0, _image.getImageData)(backgroundImage.url).then((imageData)=>{ - imageDataCache[backgroundImage.url] = imageData; - addImage(imageBounds, imageData); - }); - }); + stage.facets.push(facetRect); + } + groupType = convertGroupRole(g, options2) || groupType; + setCurrentAxis(options2, stage, groupType); + base$3.vega.sceneVisit(g, function(item) { + mainStager(options2, stage, item, gx + x2, gy + y2, groupType); + }); + }); + }; + function setCurrentAxis(options2, stage, groupType) { + let axisRole; + switch (groupType) { + case GroupType.xAxis: + axisRole = "x"; + break; + case GroupType.yAxis: + axisRole = "y"; + break; + case GroupType.zAxis: + axisRole = "z"; + break; + default: + return; } - //Now call update on each layout - layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds, ref.layerStagger); - (0, _camera.applyCameraCallbacks)(ref, config, stage.view, transistion2dOnly); - core.renderer.transitionTime = 0; // Set renderer transition time for this render pass to prevent rendering target buffer for single frame - (0, _color.colorConfig)(ref, colors); - return { - bounds, - getCubeLayer: ()=>cubeLayer, - update: (layerSelection)=>layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, ref.layerStagger), - activate: (id)=>core.renderer.transitionBuffers[0].activeId = id, - moveCamera: (camera)=>{ - if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - cameraTransitioner.move(camera.position, camera.rotation); - } - }, - setTransitionTimeAxesVisibility: ()=>{ - (0, _camera.setTransitionTimeAxesVisibility)(transistion2dOnly, core); - } + options2.currAxis = { + axisRole, + domain: null, + tickText: [], + ticks: [] }; -} -function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, layerStagger) { - const layerItems = [ - { - layer: cubeLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes - }, - { - layer: lineLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines - }, - { - layer: textLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts - } + stage.axes[axisRole].push(options2.currAxis); + } + const markStagers = { + group: group$1, + legend: markStager$5, + image: markStager$4, + rect: markStager$3, + rule: markStager$2, + line: markStager$1, + text: markStager + }; + const mainStager = (options2, stage, scene, x2, y2, groupType) => { + if (scene.marktype !== "group" && groupType === GroupType.legend) { + markStager$5(options2, stage, scene); + } else { + const markStager2 = markStagers[scene.marktype]; + if (markStager2) { + markStager2(options2, stage, scene, x2, y2, groupType); + } + } + }; + function sceneToStage(options2, stage, scene) { + mainStager(options2, stage, scene, 0, 0, null); + sortAxis(stage.axes.x, 0); + sortAxis(stage.axes.y, 1); + sortAxis(stage.axes.z, 1); + } + function sortAxis(axes, dim) { + axes.forEach((axis) => { + if (axis.domain) + orderDomain(axis.domain, dim); + axis.ticks.sort((a2, b2) => a2.sourcePosition[dim] - b2.sourcePosition[dim]); + axis.tickText.sort((a2, b2) => a2.position[dim] - b2.position[dim]); + }); + } + function orderDomain(domain2, dim) { + if (domain2.sourcePosition[dim] > domain2.targetPosition[dim]) { + const temp2 = domain2.targetPosition; + domain2.targetPosition = domain2.sourcePosition; + domain2.sourcePosition = temp2; + } + } + function outerBounds(b1, b2) { + if (!b1 && !b2) + return; + if (!b1) + return b2; + if (!b2) + return b1; + const minProps = [ + "minBoundsX", + "minBoundsY", + "minBoundsZ" + ]; + const maxProps = [ + "maxBoundsX", + "maxBoundsY", + "maxBoundsZ" ]; - layerItems.forEach((layerItem)=>{ - var _a; - return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds, layerItem.selection, layerItem.stagger); + const result = {}; + minProps.forEach((p) => result[p] = notNull(Math.min, b1[p], b2[p])); + maxProps.forEach((p) => result[p] = notNull(Math.max, b1[p], b2[p])); + return result; + } + function notNull(fn2, v1, v2) { + if (v1 == null && v2 == null) + return null; + if (v1 == null) + return v2; + if (v2 == null) + return v1; + return fn2(v1, v2); + } + function increment$1(b2, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { + return outerBounds(b2, { + minBoundsX, + minBoundsY, + minBoundsZ, + maxBoundsX, + maxBoundsY, + maxBoundsZ }); -} -function convertBounds(bounds) { - if (!bounds) return; - return { - minBoundsX: bounds.x1, - maxBoundsX: bounds.x2, - minBoundsY: -bounds.y2, - maxBoundsY: -bounds.y1, - minBoundsZ: (0, _defaults.minZ), - maxBoundsZ: (0, _defaults.minZ) - }; -} - -},{"./axes":"a0VSy","./bounds":"g9F83","./cubes":"9hPmh","./lines":"cM6w1","./text":"6hAIv","./image":"k12os","../defaults":"4Q1zd","./color":"7T6SC","./defaults":"baEhk","./camera":"cPRXr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a0VSy":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createAxesLayer", ()=>createAxesLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -const createAxesLayer = (props)=>{ - const { config, height, ref, stage } = props; - const { core } = ref; + } + const createAxesLayer = (props) => { + const { config, height: height2, ref: ref2, stage } = props; + const { core } = ref2; const { renderer } = core; - const { x, y, z } = stage.axes; - const xyz = [ - ...x, - ...y, - ...z - ]; + const { x: x2, y: y2, z: z2 } = stage.axes; + const xyz = [...x2, ...y2, ...z2]; renderer.currentAxes = []; if (!xyz.length) { - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - return; + renderer.axesVisibility = AxesVisibility.none; + return; } - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + renderer.axesVisibility = AxesVisibility.current; const correlation = new AxesCorrelation(stage, 3); const { axesSets, labels } = correlation; - const grid = correlation.getGrid(); - if (grid.byColumn[0]) { - grid.byColumn[0].forEach((row)=>{ - row.axesSet.showFacetTitleY = true; - }); - grid.byRow[0].forEach((col)=>{ - col.axesSet.showFacetTitleX = true; - }); + const grid2 = correlation.getGrid(); + if (grid2.byColumn[0]) { + grid2.byColumn[0].forEach((row) => { + row.axesSet.showFacetTitleY = true; + }); + grid2.byRow[0].forEach((col) => { + col.axesSet.showFacetTitleX = true; + }); } - if (grid.rows > 1) { - const { byRow } = grid; - byRow[0].forEach(({ axesSet }, col)=>{ - if (!axesSet.y) { - if (byRow[1][col].axesSet) { - //move x up - byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; - byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; - delete axesSet.x; - } - } - }); + if (grid2.rows > 1) { + const { byRow } = grid2; + byRow[0].forEach(({ axesSet }, col) => { + if (!axesSet.y) { + if (byRow[1][col].axesSet) { + byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; + byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; + delete axesSet.x; + } + } + }); } - let bounds; + let bounds2; const allAxesSetBounds = []; let anyZ = false; - for(let i = 0; i < axesSets.length; i++)if (axesSets[i].z) { + for (let i = 0; i < axesSets.length; i++) { + if (axesSets[i].z) { anyZ = true; break; + } } - const is3d = stage.view === '3d' && anyZ; - axesSets.forEach((axesSet)=>{ - if (!axesSet.x && !axesSet.y) return; - const axesSetBounds = { - axesSet, - maxBoundsX: null, - maxBoundsY: null, - maxBoundsZ: null, - minBoundsX: null, - minBoundsY: null, - minBoundsZ: null - }; - if (is3d) { - const zBounds = getDomainBounds(1, axesSet.z); - axesSetBounds.minBoundsZ = -zBounds.maxBounds; - axesSetBounds.maxBoundsZ = -zBounds.minBounds; - } - const yBounds = getDomainBounds(1, axesSet.y); - axesSetBounds.minBoundsY = yBounds.minBounds; - axesSetBounds.maxBoundsY = yBounds.maxBounds; - axesSetBounds.y = yBounds.minBounds; - axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; - const xBounds = getDomainBounds(0, axesSet.x); - axesSetBounds.minBoundsX = xBounds.minBounds; - axesSetBounds.maxBoundsX = xBounds.maxBounds; - axesSetBounds.x = xBounds.minBounds; - axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; - allAxesSetBounds.push(axesSetBounds); - bounds = (0, _bounds.outerBounds)(bounds, axesSetBounds); + const is3d = stage.view === "3d" && anyZ; + axesSets.forEach((axesSet) => { + if (!axesSet.x && !axesSet.y) + return; + const axesSetBounds = { + axesSet, + maxBoundsX: null, + maxBoundsY: null, + maxBoundsZ: null, + minBoundsX: null, + minBoundsY: null, + minBoundsZ: null + }; + if (is3d) { + const zBounds = getDomainBounds(1, axesSet.z); + axesSetBounds.minBoundsZ = -zBounds.maxBounds; + axesSetBounds.maxBoundsZ = -zBounds.minBounds; + } + const yBounds = getDomainBounds(1, axesSet.y); + axesSetBounds.minBoundsY = yBounds.minBounds; + axesSetBounds.maxBoundsY = yBounds.maxBounds; + axesSetBounds.y = yBounds.minBounds; + axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; + const xBounds = getDomainBounds(0, axesSet.x); + axesSetBounds.minBoundsX = xBounds.minBounds; + axesSetBounds.maxBoundsX = xBounds.maxBounds; + axesSetBounds.x = xBounds.minBounds; + axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; + allAxesSetBounds.push(axesSetBounds); + bounds2 = outerBounds(bounds2, axesSetBounds); }); - const facetLabelX = labels.filter((label)=>label.axisRole === 'x')[0]; - const facetLabelY = labels.filter((label)=>label.axisRole === 'y')[0]; - core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator })=>{ - const axesSet = axesSets[axes]; - let a; - let f; - switch(axis){ - case 0: - a = axesSet.x; - f = facetLabelX; - break; - case 1: - a = axesSet.y; - f = facetLabelY; - break; - case 2: - a = axesSet.z; - break; + const facetLabelX = labels.filter((label2) => label2.axisRole === "x")[0]; + const facetLabelY = labels.filter((label2) => label2.axisRole === "y")[0]; + core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { + const axesSet = axesSets[axes]; + let a2; + let f; + switch (axis) { + case 0: { + a2 = axesSet.x; + f = facetLabelX; + break; + } + case 1: { + a2 = axesSet.y; + f = facetLabelY; + break; + } + case 2: { + a2 = axesSet.z; + break; } - if (a) config.onTextClick(manipulator.event, a.title || f.title); + } + if (a2) { + config.onTextClick(manipulator.event, a2.title || f.title); + } }; - allAxesSetBounds.forEach((axesSetBounds)=>{ - const { axesSet } = axesSetBounds; - if (!axesSet.x && !axesSet.y) return; - const cartesian = new (is3d ? (0, _morphcharts.Axes).Cartesian3dAxes : (0, _morphcharts.Axes).Cartesian2dAxes)(core); - cartesian.isDivisionPickingEnabled = [ - false, - false, - false - ]; - cartesian.arePickDivisionsVisible = [ - false, - false, - false - ]; - cartesian.isLabelPickingEnabled = [ - false, - false, - false - ]; - cartesian.isTitlePickingEnabled = [ - false, - false, - false - ]; - cartesian.isGridPickingEnabled = false; - cartesian.isHeadingPickingEnabled = [ - false, - false, - false - ]; - createAxes(cartesian, 0, 0, axesSet.x, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleX && facetLabelX); - createAxes(cartesian, 1, 1, axesSet.y, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleY && facetLabelY); - if (is3d) createAxes(cartesian, 1, 2, axesSet.z, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props); - configCartesianAxes(is3d, bounds, cartesian); - const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds; - const w = maxBoundsX - minBoundsX; - const h = maxBoundsY - minBoundsY; - cartesian.scalingX = axesSetBounds.w / w; - cartesian.scalingY = axesSetBounds.h / h; - cartesian.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w - 0.5; - cartesian.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h - 0.5; - const aspect = h / w; - if (aspect > 1) cartesian.offsetX /= aspect; - else cartesian.offsetY *= aspect; - const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian) : renderer.createCartesian2dAxesVisual(cartesian); - renderer.currentAxes.push(axes); - props.config.onAxesComplete && props.config.onAxesComplete(cartesian); + allAxesSetBounds.forEach((axesSetBounds) => { + const { axesSet } = axesSetBounds; + if (!axesSet.x && !axesSet.y) + return; + const cartesian2 = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); + cartesian2.isDivisionPickingEnabled = [false, false, false]; + cartesian2.arePickDivisionsVisible = [false, false, false]; + cartesian2.isLabelPickingEnabled = [false, false, false]; + cartesian2.isTitlePickingEnabled = [false, false, false]; + cartesian2.isGridPickingEnabled = false; + cartesian2.isHeadingPickingEnabled = [false, false, false]; + createAxes(cartesian2, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleX && facetLabelX); + createAxes(cartesian2, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleY && facetLabelY); + if (is3d) { + createAxes(cartesian2, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height2, props); + } + configCartesianAxes(is3d, bounds2, cartesian2); + const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds2; + const w2 = maxBoundsX - minBoundsX; + const h2 = maxBoundsY - minBoundsY; + cartesian2.scalingX = axesSetBounds.w / w2; + cartesian2.scalingY = axesSetBounds.h / h2; + cartesian2.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w2 - 0.5; + cartesian2.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h2 - 0.5; + const aspect = h2 / w2; + if (aspect > 1) { + cartesian2.offsetX /= aspect; + } else { + cartesian2.offsetY *= aspect; + } + const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian2) : renderer.createCartesian2dAxesVisual(cartesian2); + renderer.currentAxes.push(axes); + props.config.onAxesComplete && props.config.onAxesComplete(cartesian2); }); - return { - bounds - }; -}; -const nullDomain = { - sourcePosition: [ - 0, - 0, - 0 - ], - targetPosition: [ - 0, - 0, - 0 - ] -}; -class AxesCorrelation { - constructor(stage, dimensions){ - this.dimensions = dimensions; - const { x, y, z } = stage.axes; - this.axesSets = []; - this.labels = []; - [ - x, - y, - z - ].forEach((axes)=>{ - axes.forEach((axis)=>{ - if (this.axesSets.length === 0) this.initialize(axis); - else this.correlate(axis); - }); + return { bounds: bounds2 }; + }; + const nullDomain = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0] + }; + class AxesCorrelation { + constructor(stage, dimensions) { + this.dimensions = dimensions; + const { x: x2, y: y2, z: z2 } = stage.axes; + this.axesSets = []; + this.labels = []; + [x2, y2, z2].forEach((axes) => { + axes.forEach((axis) => { + if (this.axesSets.length === 0) { + this.initialize(axis); + } else { + this.correlate(axis); + } }); + }); } getGrid() { - const mapCols = {}; - const mapRows = {}; - this.axesSets.forEach((axesSet)=>{ - var _a; - const domain = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; - if (!domain) return; - const col = domain.sourcePosition[0].toString(); - const row = domain.sourcePosition[1].toString(); - if (!mapCols[col]) mapCols[col] = {}; - mapCols[col][row] = axesSet; - mapRows[row] = null; - }); - const colKeys = Object.keys(mapCols).sort((a, b)=>+a - +b); - const rowKeys = Object.keys(mapRows).sort((a, b)=>+a - +b); - return { - cols: colKeys.length, - rows: rowKeys.length, - byColumn: colKeys.map((colKey)=>rowKeys.map((rowKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })), - byRow: rowKeys.map((rowKey)=>colKeys.map((colKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })) - }; + const mapCols = {}; + const mapRows = {}; + this.axesSets.forEach((axesSet) => { + var _a2; + const domain2 = (_a2 = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a2 === void 0 ? void 0 : _a2.domain; + if (!domain2) + return; + const col = domain2.sourcePosition[0].toString(); + const row = domain2.sourcePosition[1].toString(); + if (!mapCols[col]) { + mapCols[col] = {}; + } + mapCols[col][row] = axesSet; + mapRows[row] = null; + }); + const colKeys = Object.keys(mapCols).sort((a2, b2) => +a2 - +b2); + const rowKeys = Object.keys(mapRows).sort((a2, b2) => +a2 - +b2); + return { + cols: colKeys.length, + rows: rowKeys.length, + byColumn: colKeys.map((colKey) => rowKeys.map((rowKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })), + byRow: rowKeys.map((rowKey) => colKeys.map((colKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })) + }; } initialize(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - const axesSet = {}; - axesSet[axis.axisRole] = axis; - this.axesSets.push(axesSet); + if (!axis.domain) { + this.labels.push(axis); + return; + } + const axesSet = {}; + axesSet[axis.axisRole] = axis; + this.axesSets.push(axesSet); } correlate(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - for(let i = 0; i < this.axesSets.length; i++){ - const axesSet = this.axesSets[i]; - for(const axisRole in axesSet){ - const test = axesSet[axisRole]; - if (this.matchDomains(axis.domain, test.domain)) { - //prefer the axes with titles - if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) axesSet[axis.axisRole] = axis; - return; - } + if (!axis.domain) { + this.labels.push(axis); + return; + } + for (let i = 0; i < this.axesSets.length; i++) { + const axesSet = this.axesSets[i]; + for (const axisRole in axesSet) { + const test2 = axesSet[axisRole]; + if (this.matchDomains(axis.domain, test2.domain)) { + if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) { + axesSet[axis.axisRole] = axis; } + return; + } } - this.initialize(axis); - } - matchDomains(a, b) { - if (this.matchPoint(a.sourcePosition, b.sourcePosition)) return true; - if (this.matchPoint(a.sourcePosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.sourcePosition)) return true; - return false; + } + this.initialize(axis); } - matchPoint(a, b) { - for(let i = 0; i < this.dimensions; i++){ - if (a[i] !== b[i]) return false; - } + matchDomains(a2, b2) { + if (this.matchPoint(a2.sourcePosition, b2.sourcePosition)) + return true; + if (this.matchPoint(a2.sourcePosition, b2.targetPosition)) return true; + if (this.matchPoint(a2.targetPosition, b2.targetPosition)) + return true; + if (this.matchPoint(a2.targetPosition, b2.sourcePosition)) + return true; + return false; + } + matchPoint(a2, b2) { + for (let i = 0; i < this.dimensions; i++) { + if (a2[i] !== b2[i]) + return false; + } + return true; } -} -function createAxes(cartesian, dim2d, dim3d, axis, orientation, height, props, facetLabel) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain, dim2d, height); - if (axis.axisRole === 'z') { - tickPositions.forEach((t, i)=>tickPositions[i] = 1 - t); - textPos.forEach((t, i)=>textPos[i] = 1 - t); - tickText.reverse(); - tickPositions.reverse(); - textPos.reverse(); - } - cartesian.setTickPositions(dim3d, tickPositions); - cartesian.zero[dim3d] = 0; //TODO get any "zero" gridline position from vega - cartesian.setLabelPositions(dim3d, textPos); - cartesian.setLabels(dim3d, tickText); - cartesian.setLabelSizes(dim3d, textSize); + } + function createAxes(cartesian2, dim2d, dim3d, axis, orientation, height2, props, facetLabel) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain2, dim2d, height2); + if (axis.axisRole === "z") { + tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); + textPos.forEach((t, i) => textPos[i] = 1 - t); + tickText.reverse(); + tickPositions.reverse(); + textPos.reverse(); + } + cartesian2.setTickPositions(dim3d, tickPositions); + cartesian2.zero[dim3d] = 0; + cartesian2.setLabelPositions(dim3d, textPos); + cartesian2.setLabels(dim3d, tickText); + cartesian2.setLabelSizes(dim3d, textSize); const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); if (title === null || title === void 0 ? void 0 : title.text) { - cartesian.setTitle(dim3d, title.text); - cartesian.setTitleSize(dim3d, title.size / height); + cartesian2.setTitle(dim3d, title.text); + cartesian2.setTitleSize(dim3d, title.size / height2); } - cartesian.setLabelOrientation(dim3d, orientation); - props.config.onAxisConfig && props.config.onAxisConfig(cartesian, dim3d, axis); + cartesian2.setLabelOrientation(dim3d, orientation); + props.config.onAxisConfig && props.config.onAxisConfig(cartesian2, dim3d, axis); return { - tickText - }; -} -function configCartesianAxes(is3d, bounds, cartesian) { - if (is3d) cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topBack] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).backRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).bottomRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).frontRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topFront] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topRight] = false; - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - cartesian.minBoundsX = minBoundsX; - cartesian.maxBoundsX = maxBoundsX; - cartesian.minBoundsY = minBoundsY; - cartesian.maxBoundsY = maxBoundsY; + tickText + }; + } + function configCartesianAxes(is3d, bounds2, cartesian2) { + if (is3d) { + cartesian2.isEdgeVisible[Edge3D.topBack] = false; + } + cartesian2.isEdgeVisible[Edge3D.backRight] = false; + cartesian2.isEdgeVisible[Edge3D.bottomRight] = false; + cartesian2.isEdgeVisible[Edge3D.frontRight] = false; + cartesian2.isEdgeVisible[Edge3D.topFront] = false; + cartesian2.isEdgeVisible[Edge3D.topRight] = false; + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; + cartesian2.minBoundsX = minBoundsX; + cartesian2.maxBoundsX = maxBoundsX; + cartesian2.minBoundsY = minBoundsY; + cartesian2.maxBoundsY = maxBoundsY; if (is3d) { - cartesian.minBoundsZ = minBoundsZ; - cartesian.maxBoundsZ = maxBoundsZ; - } -} -function getDomainBounds(dim2d, axis) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const minBounds = domain.sourcePosition[dim2d]; - const maxBounds = domain.targetPosition[dim2d]; + cartesian2.minBoundsZ = minBoundsZ; + cartesian2.maxBoundsZ = maxBoundsZ; + } + } + function getDomainBounds(dim2d, axis) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const minBounds = domain2.sourcePosition[dim2d]; + const maxBounds = domain2.targetPosition[dim2d]; return { - maxBounds, - minBounds - }; -} -function convertAxis(axis, domain, dim, height) { - const start = domain.sourcePosition[dim]; - const span = domain.targetPosition[dim] - start; - const tickPositions = axis ? axis.ticks.map((t)=>(t.sourcePosition[dim] - start) / span) : []; - const tickText = axis ? axis.tickText.map((t)=>t.text) : []; - const textPos = axis ? axis.tickText.map((t)=>(t.position[dim] - start) / span) : []; - const textSize = axis ? axis.tickText.map((t)=>t.size / height) : []; + maxBounds, + minBounds + }; + } + function convertAxis(axis, domain2, dim, height2) { + const start = domain2.sourcePosition[dim]; + const span2 = domain2.targetPosition[dim] - start; + const tickPositions = axis ? axis.ticks.map((t) => (t.sourcePosition[dim] - start) / span2) : []; + const tickText = axis ? axis.tickText.map((t) => t.text) : []; + const textPos = axis ? axis.tickText.map((t) => (t.position[dim] - start) / span2) : []; + const textSize = axis ? axis.tickText.map((t) => t.size / height2) : []; if (tickPositions.length) { - if (tickPositions[0] !== 0) tickPositions[0] = 0; - if (tickPositions[tickPositions.length - 1] !== 1) tickPositions[tickPositions.length - 1] = 1; + if (tickPositions[0] !== 0) { + tickPositions[0] = 0; + } + if (tickPositions[tickPositions.length - 1] !== 1) { + tickPositions[tickPositions.length - 1] = 1; + } } return { - tickPositions, - tickText, - textPos, - textSize - }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g9F83":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "outerBounds", ()=>outerBounds); -parcelHelpers.export(exports, "increment", ()=>increment); -function outerBounds(b1, b2) { - if (!b1 && !b2) return; - if (!b1) return b2; - if (!b2) return b1; - const minProps = [ - 'minBoundsX', - 'minBoundsY', - 'minBoundsZ' - ]; - const maxProps = [ - 'maxBoundsX', - 'maxBoundsY', - 'maxBoundsZ' - ]; - const result = {}; - minProps.forEach((p)=>result[p] = notNull(Math.min, b1[p], b2[p])); - maxProps.forEach((p)=>result[p] = notNull(Math.max, b1[p], b2[p])); - return result; -} -function notNull(fn, v1, v2) { - if (v1 == null && v2 == null) return null; - if (v1 == null) return v2; - if (v2 == null) return v1; - return fn(v1, v2); -} -function increment(b, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { - return outerBounds(b, { - minBoundsX, - minBoundsY, - minBoundsZ, - maxBoundsX, - maxBoundsY, - maxBoundsZ - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9hPmh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createCubeLayer", ()=>createCubeLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'cube'; -const createCubeLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const scatter = new (0, _morphcharts.Layouts).Scatter(core); - const { ids, colors, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds, maxColor, palette } = convert(stage); - if (!ids.length) return; + tickPositions, + tickText, + textPos, + textSize + }; + } + let ColorMap$1 = class ColorMap { + constructor(quant = 5) { + this.quant = quant; + this.colorMap = {}; + this.colorArray = []; + } + getColorKey(rgbaColor) { + const color2 = rgbaColor.slice(0, 3).map((e) => Math.floor(e / this.quant) * this.quant); + color2[3] = rgbaColor[3]; + return JSON.stringify(color2); + } + registerColor(rgbaColor) { + const colorKey = this.getColorKey(rgbaColor); + if (!this.colorMap[colorKey]) { + this.colorMap[colorKey] = { + index: this.colorArray.length, + rgbaColor + }; + this.colorArray.push(rgbaColor); + } + return this.colorMap[colorKey].index; + } + getPalette() { + return { + palette: new Uint8Array(this.colorArray.flat()), + maxColor: this.colorArray.length - 1 + }; + } + }; + function convert$3(newColor) { + const c2 = colorFromString(newColor).slice(0, 3); + return c2.map((v) => v / 255); + } + function colorConfig(ref2, colors2) { + if (!colors2) + return; + const { config } = ref2.core; + config.activeColor = convert$3(colors2.activeItemColor); + config.backgroundColor = new Float32Array(convert$3(colors2.backgroundColor)); + config.textColor = convert$3(colors2.textColor); + config.textBorderColor = convert$3(colors2.textBorderColor); + config.axesTextColor = convert$3(colors2.axesTextLabelColor); + config.axesGridBackgroundColor = convert$3(colors2.axesGridBackgroundColor); + config.axesGridHighlightColor = convert$3(colors2.axesGridHighlightColor); + config.axesGridMinorColor = convert$3(colors2.axesGridMinorColor); + config.axesGridMajorColor = convert$3(colors2.axesGridMajorColor); + config.axesGridZeroColor = convert$3(colors2.axesGridZeroColor); + ref2.core.renderer["_theme"] = null; + } + const key$2 = "cube"; + const createCubeLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const scatter = new Scatter(core); + const { ids, colors: colors2, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds: bounds2, maxColor, palette } = convert$2(stage); + if (!ids.length) + return; const { renderer } = core; - let cubeTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let cubeTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$2); if (!cubeTransitionBuffer) { - cubeTransitionBuffer = renderer.createTransitionBuffer(ids); - cubeTransitionBuffer.key = key; - renderer.transitionBuffers.push(cubeTransitionBuffer); - } else cubeTransitionBuffer.swap(); + cubeTransitionBuffer = renderer.createTransitionBuffer(ids); + cubeTransitionBuffer.key = key$2; + renderer.transitionBuffers.push(cubeTransitionBuffer); + } else { + cubeTransitionBuffer.swap(); + } scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { - positionsX, - positionsY, - positionsZ + positionsX, + positionsY, + positionsZ }); const layer = { - positionsX, - positionsY, - positionsZ, - update: (newBounds, selected, stagger)=>{ - const { colors, maxColor, minColor, palette } = layer.unitColorMap; - // reference off of core.renderer to get the actual buffer - const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - currCubeTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).block; - currCubeTransitionBuffer.currentPalette.colors = palette; - let options = Object.assign({ - selected, - colors, - minColor, - maxColor, - sizesX, - sizesY, - sizesZ - }, newBounds); - if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { - const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; - options = Object.assign(Object.assign({}, options), { - maxStaggerOrder, - minStaggerOrder, - staggerOrders - }); - } - scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); - }, - bounds, - unitColorMap: { - colors, - ids, - minColor: 0, - maxColor, - palette - } + positionsX, + positionsY, + positionsZ, + update: (newBounds, selected, stagger) => { + const { colors: colors3, maxColor: maxColor2, minColor, palette: palette2 } = layer.unitColorMap; + const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$2); + currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; + currCubeTransitionBuffer.currentPalette.colors = palette2; + let options2 = Object.assign({ + selected, + colors: colors3, + minColor, + maxColor: maxColor2, + sizesX, + sizesY, + sizesZ + }, newBounds); + if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { + const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; + options2 = Object.assign(Object.assign({}, options2), { + maxStaggerOrder, + minStaggerOrder, + staggerOrders + }); + } + scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options2); + }, + bounds: bounds2, + unitColorMap: { + colors: colors2, + ids, + minColor: 0, + maxColor, + palette + } }; return layer; -}; -function convert(stage) { + }; + function convert$2(stage) { const { cubeData } = stage; - const { length } = cubeData; + const { length: length2 } = cubeData; const ids = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizesX = new Float64Array(length); - const sizesY = new Float64Array(length); - const sizesZ = new Float64Array(length); - let bounds; - const colorMap = new (0, _color.ColorMap)(); - cubeData.forEach((cube, i)=>{ - ids.push(i); - if (cube.isEmpty) { - positionsX[i] = 0; - positionsY[i] = 0; - positionsZ[i] = 0; - sizesX[i] = 0; - sizesY[i] = 0; - sizesZ[i] = 0; - colors[i] = 0; - } else { - //ids.push(cube.ordinal); - positionsX[i] = cube.position[0] + cube.size[0] * 0.5; - positionsY[i] = cube.position[1] + cube.size[1] * 0.5; - positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; - sizesX[i] = cube.size[0]; - sizesY[i] = cube.size[1]; - sizesZ[i] = cube.size[2]; - bounds = (0, _bounds.increment)(bounds, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); - colors[i] = colorMap.registerColor(cube.color); - } + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizesX = new Float64Array(length2); + const sizesY = new Float64Array(length2); + const sizesZ = new Float64Array(length2); + let bounds2; + const colorMap = new ColorMap$1(); + cubeData.forEach((cube, i) => { + ids.push(i); + if (cube.isEmpty) { + positionsX[i] = 0; + positionsY[i] = 0; + positionsZ[i] = 0; + sizesX[i] = 0; + sizesY[i] = 0; + sizesZ[i] = 0; + colors2[i] = 0; + } else { + positionsX[i] = cube.position[0] + cube.size[0] * 0.5; + positionsY[i] = cube.position[1] + cube.size[1] * 0.5; + positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; + sizesX[i] = cube.size[0]; + sizesY[i] = cube.size[1]; + sizesZ[i] = cube.size[2]; + bounds2 = increment$1(bounds2, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); + colors2[i] = colorMap.registerColor(cube.color); + } }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizesX, - sizesY, - sizesZ, - bounds, - maxColor, - palette + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizesX, + sizesY, + sizesZ, + bounds: bounds2, + maxColor, + palette }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","./color":"7T6SC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7T6SC":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorMap", ()=>ColorMap); -parcelHelpers.export(exports, "colorConfig", ()=>colorConfig); -var _color = require("../color"); -class ColorMap { - constructor(quant = 5){ - this.quant = quant; - this.colorMap = {}; - this.colorArray = []; - } - getColorKey(rgbaColor) { - const color = rgbaColor.slice(0, 3).map((e)=>Math.floor(e / this.quant) * this.quant); - color[3] = rgbaColor[3]; //retain alpha - return JSON.stringify(color); - } - registerColor(rgbaColor) { - const colorKey = this.getColorKey(rgbaColor); - if (!this.colorMap[colorKey]) { - this.colorMap[colorKey] = { - index: this.colorArray.length, - rgbaColor - }; - this.colorArray.push(rgbaColor); - } - return this.colorMap[colorKey].index; - } - getPalette() { - return { - palette: new Uint8Array(this.colorArray.flat()), - maxColor: this.colorArray.length - 1 - }; - } -} -function convert(newColor) { - const c = (0, _color.colorFromString)(newColor).slice(0, 3); - return c.map((v)=>v / 255); -} -function colorConfig(ref, colors) { - if (!colors) return; - const { config } = ref.core; - config.activeColor = convert(colors.activeItemColor); - config.backgroundColor = new Float32Array(convert(colors.backgroundColor)); - config.textColor = convert(colors.textColor); - config.textBorderColor = convert(colors.textBorderColor); - config.axesTextColor = convert(colors.axesTextLabelColor); - config.axesGridBackgroundColor = convert(colors.axesGridBackgroundColor); - config.axesGridHighlightColor = convert(colors.axesGridHighlightColor); - config.axesGridMinorColor = convert(colors.axesGridMinorColor); - config.axesGridMajorColor = convert(colors.axesGridMajorColor); - config.axesGridZeroColor = convert(colors.axesGridZeroColor); - //TODO fix this - hack to reset the background color - ref.core.renderer['_theme'] = null; -} - -},{"../color":"cgTtg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cM6w1":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createLineLayer", ()=>createLineLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'line'; -const createLineLayer = (props)=>{ - const { height, ref, stage, width } = props; - const { core } = ref; - const lines = new (0, _morphcharts.Layouts).Line(core); - const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert(stage, height, width); - if (!ids.length) return; + } + const key$1 = "line"; + const createLineLayer = (props) => { + const { height: height2, ref: ref2, stage } = props; + const { core } = ref2; + const lines = new Line(core); + const { ids, fromIds, toIds, lineColors, lineSizes, bounds: bounds2, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert$1(stage, height2); + if (!ids.length) + return; const { renderer } = core; - let lineTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let lineTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$1); if (!lineTransitionBuffer) { - lineTransitionBuffer = renderer.createTransitionBuffer(ids); - lineTransitionBuffer.key = key; - renderer.transitionBuffers.push(lineTransitionBuffer); - } else lineTransitionBuffer.swap(); + lineTransitionBuffer = renderer.createTransitionBuffer(ids); + lineTransitionBuffer.key = key$1; + renderer.transitionBuffers.push(lineTransitionBuffer); + } else { + lineTransitionBuffer.swap(); + } lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { - positionsX, - positionsY, - positionsZ, - lineSizes, - sizeScaling: 1 + positionsX, + positionsY, + positionsZ, + lineSizes, + sizeScaling: 1 }); - let options = { - lineColors, - lineMinColor: 0, - lineMaxColor + let options2 = { + lineColors, + lineMinColor: 0, + lineMaxColor }; - // Unit type - lineTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).cylinder; + lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; lineTransitionBuffer.currentPalette.colors = palette; return { - update: (newBounds)=>{ - options = Object.assign(Object.assign({}, options), newBounds); - // reference off of core.renderer to get the actual buffer - const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); - }, - bounds, - unitColorMap: { - ids, - colors: lineColors, - minColor: 0, - maxColor: lineMaxColor, - palette - } + update: (newBounds) => { + options2 = Object.assign(Object.assign({}, options2), newBounds); + const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$1); + lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options2); + }, + bounds: bounds2, + unitColorMap: { + ids, + colors: lineColors, + minColor: 0, + maxColor: lineMaxColor, + palette + } }; -}; -function convert(stage, height, width) { + }; + function convert$1(stage, height2, width2) { const { pathData } = stage; - const positions = []; + const positions2 = []; const lines = []; - const colorMap = new (0, _color.ColorMap)(); - pathData.forEach((path)=>{ - const color = colorMap.registerColor(path.strokeColor); - let from = positions.length; - positions.push(path.positions[0]); - for(let i = 1; i < path.positions.length; i++){ - const to = positions.length; - positions.push(path.positions[i]); - lines.push({ - id: lines.length, - from, - to, - color, - size: path.strokeWidth - }); - from = to; - } + const colorMap = new ColorMap$1(); + pathData.forEach((path2) => { + const color2 = colorMap.registerColor(path2.strokeColor); + let from = positions2.length; + positions2.push(path2.positions[0]); + for (let i = 1; i < path2.positions.length; i++) { + const to = positions2.length; + positions2.push(path2.positions[i]); + lines.push({ + id: lines.length, + from, + to, + color: color2, + size: path2.strokeWidth + }); + from = to; + } }); const ids = new Uint32Array(lines.length); const fromIds = new Uint32Array(lines.length); const toIds = new Uint32Array(lines.length); const lineColors = new Float64Array(lines.length); const lineSizes = new Float64Array(lines.length); - lines.forEach((line, i)=>{ - ids[i] = i; - fromIds[i] = line.from; - toIds[i] = line.to; - lineColors[i] = line.color; - lineSizes[i] = line.size; + lines.forEach((line2, i) => { + ids[i] = i; + fromIds[i] = line2.from; + toIds[i] = line2.to; + lineColors[i] = line2.color; + lineSizes[i] = line2.size; }); - const positionsX = new Float64Array(positions.length); - const positionsY = new Float64Array(positions.length); - const positionsZ = new Float64Array(positions.length); - let bounds; - positions.forEach((p, i)=>{ - positionsX[i] = p[0]; - positionsY[i] = p[1] + height; - positionsZ[i] = p[2]; - bounds = (0, _bounds.increment)(bounds, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); + const positionsX = new Float64Array(positions2.length); + const positionsY = new Float64Array(positions2.length); + const positionsZ = new Float64Array(positions2.length); + let bounds2; + positions2.forEach((p, i) => { + positionsX[i] = p[0]; + positionsY[i] = p[1] + height2; + positionsZ[i] = p[2]; + bounds2 = increment$1(bounds2, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); }); const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); return { - ids, - fromIds, - toIds, - lineColors, - lineSizes, - bounds, - positionsX, - positionsY, - positionsZ, - lineMaxColor, - palette - }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","./color":"7T6SC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6hAIv":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createTextLayer", ()=>createTextLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const createTextLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const { positionsX, positionsY, positionsZ, sizes, bounds, maxGlyphs, text } = convert(stage); - if (text.length === 0) { - core.renderer.labelSets = []; - return; - } - const options = { - text, - maxGlyphs, - scales: sizes + ids, + fromIds, + toIds, + lineColors, + lineSizes, + bounds: bounds2, + positionsX, + positionsY, + positionsZ, + lineMaxColor, + palette }; - const labelSet = new (0, _morphcharts.Components).LabelSet(core, options); + } + const createTextLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const { positionsX, positionsY, positionsZ, sizes, bounds: bounds2, maxGlyphs, text: text2 } = convert(stage); + if (text2.length === 0) { + core.renderer.labelSets = []; + return; + } + const options2 = { + text: text2, + maxGlyphs, + scales: sizes + }; + const labelSet = new LabelSet(core, options2); labelSet.positionsX = positionsX; labelSet.positionsY = positionsY; labelSet.positionsZ = positionsZ; - labelSet.horizontalAlignment = (0, _morphcharts.HorizontalAlignment).center; - labelSet.verticalAlignment = (0, _morphcharts.VerticalAlignment).center; + labelSet.horizontalAlignment = HorizontalAlignment.center; + labelSet.verticalAlignment = VerticalAlignment.center; const layer = { - update: (bounds)=>{ - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - }, - bounds + update: (bounds3) => { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds3; + labelSet.minBoundsX = minBoundsX; + labelSet.minBoundsY = minBoundsY; + labelSet.minBoundsZ = minBoundsZ; + labelSet.maxBoundsX = maxBoundsX; + labelSet.maxBoundsY = maxBoundsY; + labelSet.maxBoundsZ = maxBoundsZ; + }, + bounds: bounds2 }; const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); - core.renderer.labelSets = [ - labelSetVisual - ]; + core.renderer.labelSets = [labelSetVisual]; return layer; -}; -function convert(stage) { + }; + function convert(stage) { const { textData } = stage; - const { length } = textData; + const { length: length2 } = textData; const ids = []; - const text = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizes = new Float64Array(length); - let bounds; + const text2 = []; + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizes = new Float64Array(length2); + let bounds2; let maxGlyphs = 0; - const colorMap = new (0, _color.ColorMap)(); - textData.forEach((t, i)=>{ - ids.push(i); - text.push(t.text); - maxGlyphs += t.text.length; - positionsX[i] = t.position[0]; - positionsY[i] = t.position[1]; - positionsZ[i] = t.position[2]; - sizes[i] = 1.5 * t.size; //scale similar to axes - bounds = (0, _bounds.increment)(bounds, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); - colors[i] = colorMap.registerColor(t.color); + const colorMap = new ColorMap$1(); + textData.forEach((t, i) => { + ids.push(i); + text2.push(t.text); + maxGlyphs += t.text.length; + positionsX[i] = t.position[0]; + positionsY[i] = t.position[1]; + positionsZ[i] = t.position[2]; + sizes[i] = 1.5 * t.size; + bounds2 = increment$1(bounds2, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); + colors2[i] = colorMap.registerColor(t.color); }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizes, - bounds, - maxColor, - maxGlyphs, - palette, - text - }; -} - -},{"morphcharts":"9s7CR","./bounds":"g9F83","./color":"7T6SC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k12os":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getImageData", ()=>getImageData); -parcelHelpers.export(exports, "createImageQuad", ()=>createImageQuad); -var _morphcharts = require("morphcharts"); -function getImageData(url) { - return new Promise((resolve, reject)=>{ - const imageElement = document.createElement('img'); - imageElement.onload = ()=>{ - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - const { height, width } = imageElement; - canvas.width = width; - canvas.height = height; - ctx.drawImage(imageElement, 0, 0); - resolve(ctx.getImageData(0, 0, width, height)); - }; - imageElement.src = url; + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizes, + bounds: bounds2, + maxColor, + maxGlyphs, + palette, + text: text2 + }; + } + function getImageData(url) { + return new Promise((resolve2, reject) => { + const imageElement = document.createElement("img"); + imageElement.onload = () => { + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext("2d"); + const { height: height2, width: width2 } = imageElement; + canvas.width = width2; + canvas.height = height2; + ctx.drawImage(imageElement, 0, 0); + resolve2(ctx.getImageData(0, 0, width2, height2)); + }; + imageElement.src = url; }); -} -function createImageQuad(core, imageData, bounds, position, width, height) { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + } + function createImageQuad(core, imageData, bounds2, position2, width2, height2) { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; const imageOptions = { - imageData, - position, - height, - width, - minBoundsX, - maxBoundsX, - minBoundsZ, - maxBoundsZ, - minBoundsY, - maxBoundsY - }; - return new (0, _morphcharts.Components).ImageQuad(core, imageOptions); -} - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"baEhk":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cameraDefaults", ()=>cameraDefaults); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -function createCameraDefaults() { - const qModelRotation2d = (0, _glMatrix.quat).create(); - const qModelRotation3d = (0, _morphcharts.Constants).QUAT_ROTATEX_MINUS_90; - const qCameraRotation2d = (0, _glMatrix.quat).create(); - const qCameraRotation3d = (0, _glMatrix.quat).create(); - const qAngle = (0, _glMatrix.quat).create(); - const vCameraPosition = (0, _glMatrix.vec3).create(); - // Altitude (pitch around local right axis) - (0, _glMatrix.quat).setAxisAngle(qCameraRotation3d, (0, _morphcharts.Constants).VECTOR3_UNITX, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(30)); - // Azimuth (yaw around global up axis) - (0, _glMatrix.quat).setAxisAngle(qAngle, (0, _morphcharts.Constants).VECTOR3_UNITY, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(-25)); - (0, _glMatrix.quat).multiply(qCameraRotation3d, qCameraRotation3d, qAngle); + imageData, + position: position2, + height: height2, + width: width2, + minBoundsX, + maxBoundsX, + minBoundsZ, + maxBoundsZ, + minBoundsY, + maxBoundsY + }; + return new ImageQuad(core, imageOptions); + } + function createCameraDefaults() { + const qModelRotation2d2 = create$4(); + const qModelRotation3d2 = Constants$1.QUAT_ROTATEX_MINUS_90; + const qCameraRotation2d2 = create$4(); + const qCameraRotation3d2 = create$4(); + const qAngle = create$4(); + const vCameraPosition2 = create$6(); + setAxisAngle(qCameraRotation3d2, Constants$1.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); + setAxisAngle(qAngle, Constants$1.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); + multiply(qCameraRotation3d2, qCameraRotation3d2, qAngle); return { - qModelRotation2d, - qModelRotation3d, - qCameraRotation2d, - qCameraRotation3d, - vCameraPosition - }; -} -const cameraDefaults = createCameraDefaults(); - -},{"gl-matrix":"5x28d","morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cPRXr":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applyCameraCallbacks", ()=>applyCameraCallbacks); -parcelHelpers.export(exports, "setTransitionTimeAxesVisibility", ()=>setTransitionTimeAxesVisibility); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -var _defaults = require("./defaults"); -const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults.cameraDefaults); -function applyCameraCallbacks(ref, lastPresenterConfig, lastView, transistion2dOnly) { - const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref; - ref.reset = ()=>{ - core.reset(true); - if (lastView === '3d') { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = qCameraRotation3d; - cameraTransitioner.vPosition.to = vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = qCameraRotation2d; - cameraTransitioner.vPosition.to = vCameraPosition; - } - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); - core.setModelRotation(modelTransitioner.qRotation.current, true); - core.camera.setOrbit(cameraTransitioner.qRotation.to, true); - core.camera.setPosition(cameraTransitioner.vPosition.to, true); - }; - const cam = (t)=>{ - (0, _glMatrix.quat).slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); - (0, _glMatrix.vec3).lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); - core.camera.setOrbit(cameraTransitioner.qRotation.current, false); - core.camera.setPosition(cameraTransitioner.vPosition.current, false); - // disable picking during transitions, as the performance degradation could reduce the framerate - core.inputManager.isPickingEnabled = false; - }; - core.updateCallback = (elapsedTime)=>{ - const { transitionDurations } = lastPresenterConfig; - if (positionTransitioner.isTransitioning) { - const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); - core.renderer.transitionTime = t; - setTransitionTimeAxesVisibility(transistion2dOnly, core); - } else core.inputManager.isPickingEnabled = true; - if (modelTransitioner.isTransitioning) { - const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); - if (modelTransitioner.shouldTransition) { - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); - core.setModelRotation(modelTransitioner.qRotation.current, false); - } - cam(tm); - } - if (cameraTransitioner.isTransitioning) { - const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); - cam(t); + qModelRotation2d: qModelRotation2d2, + qModelRotation3d: qModelRotation3d2, + qCameraRotation2d: qCameraRotation2d2, + qCameraRotation3d: qCameraRotation3d2, + vCameraPosition: vCameraPosition2 + }; + } + const cameraDefaults = createCameraDefaults(); + const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + function applyCameraCallbacks(ref2, lastPresenterConfig, lastView, transistion2dOnly) { + const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref2; + ref2.reset = () => { + core.reset(true); + if (lastView === "3d") { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = qCameraRotation3d; + cameraTransitioner.vPosition.to = vCameraPosition; + } else { + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = qCameraRotation2d; + cameraTransitioner.vPosition.to = vCameraPosition; + } + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); + core.setModelRotation(modelTransitioner.qRotation.current, true); + core.camera.setOrbit(cameraTransitioner.qRotation.to, true); + core.camera.setPosition(cameraTransitioner.vPosition.to, true); + }; + const cam = (t) => { + slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); + lerp$1(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); + core.camera.setOrbit(cameraTransitioner.qRotation.current, false); + core.camera.setPosition(cameraTransitioner.vPosition.current, false); + core.inputManager.isPickingEnabled = false; + }; + core.updateCallback = (elapsedTime) => { + const { transitionDurations } = lastPresenterConfig; + if (positionTransitioner.isTransitioning) { + const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); + core.renderer.transitionTime = t; + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } else { + core.inputManager.isPickingEnabled = true; + } + if (modelTransitioner.isTransitioning) { + const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); + if (modelTransitioner.shouldTransition) { + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); + core.setModelRotation(modelTransitioner.qRotation.current, false); } + cam(tm); + } + if (cameraTransitioner.isTransitioning) { + const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); + cam(t); + } }; -} -function setTransitionTimeAxesVisibility(transistion2dOnly, core) { + } + function setTransitionTimeAxesVisibility(transistion2dOnly, core) { const t = core.renderer.transitionTime; if (transistion2dOnly) { - if (t < 0.5) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + if (t < 0.5) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else { + core.renderer.axesVisibility = AxesVisibility.current; + } } else { - if (t <= 0.01) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else if (t >= 0.99) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - } -} - -},{"gl-matrix":"5x28d","morphcharts":"9s7CR","./defaults":"baEhk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dMNNU":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "init", ()=>init); -var _morphcharts = require("morphcharts"); -var _renderer = require("./renderer"); -var _canvas = require("./canvas"); -var _transition = require("../transition"); -function init(options, mcRendererOptions) { - const { container } = options; - const core = new (0, _morphcharts.Core)({ - container - }); - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - core.config.pickSelectDelay = 50; - const cameraTransitioner = new (0, _transition.CameraTransitioner)(); - const modelTransitioner = new (0, _transition.ModelTransitioner)(); - const positionTransitioner = new (0, _transition.Transitioner)(); - positionTransitioner.ended = ()=>{ - core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - }; - const ref = { - supportedRenders: { - advanced: (0, _renderer.rendererEnabled)(true), - basic: (0, _renderer.rendererEnabled)(false) - }, - reset: null, - cameraTransitioner, - modelTransitioner, - positionTransitioner, - core, - setMorphChartsRendererOptions (mcRendererOptions) { - if ((0, _renderer.shouldChangeRenderer)(ref.lastMorphChartsRendererOptions, mcRendererOptions)) { - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - } else if (mcRendererOptions.advanced) //same renderer, poke the config - (0, _renderer.setRendererOptions)(core.renderer, mcRendererOptions); - ref.lastMorphChartsRendererOptions = mcRendererOptions; - }, - lastMorphChartsRendererOptions: mcRendererOptions, - layerStagger: {} - }; - return ref; -} - -},{"morphcharts":"9s7CR","./renderer":"8SaPq","./canvas":"ckfEx","../transition":"78Jmh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8SaPq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shouldChangeRenderer", ()=>shouldChangeRenderer); -parcelHelpers.export(exports, "getRenderer", ()=>getRenderer); -parcelHelpers.export(exports, "setRendererOptions", ()=>setRendererOptions); -parcelHelpers.export(exports, "rendererEnabled", ()=>rendererEnabled); -var _morphcharts = require("morphcharts"); -function shouldChangeRenderer(prev, next) { - var _a, _b; - if (!prev || !next) return true; - if (prev.advanced !== next.advanced) return true; - if (!prev.advanced) return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); -} -function getRenderer(mcRendererOptions, core) { - const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); - core.renderer = r; - setRendererOptions(r, mcRendererOptions); - return r; -} -function setRendererOptions(renderer, mcRendererOptions) { - const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; - if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) for(const key in o)renderer.config[key] = o[key]; -} -function rendererEnabled(advanced) { - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(); - return r.isSupported; -} - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ckfEx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "listenCanvasEvents", ()=>listenCanvasEvents); -var _morphcharts = require("morphcharts"); -const rightButton = 2; -function listenCanvasEvents(core, options) { - const { container, pickGridCallback } = options; - const { inputManager } = core; - if (options.onLasso) inputManager.pickLassoCallback = (result)=>{ - options.onLasso(result.ids[0], result.manipulator.event); - }; - inputManager.singleTouchAction = (manipulator)=>{ - if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _morphcharts.SingleTouchAction).rotate; - else if (manipulator.altKey) return (0, _morphcharts.SingleTouchAction).lasso; - else return (0, _morphcharts.SingleTouchAction).translate; - }; - inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator })=>{ - clearClickTimeout(); - const { altKey, button, shiftKey } = manipulator; - const me = { - altKey, - shiftKey, - button - }; - const e = me; - pickGridCallback([ - divisionX, - divisionY, - divisionZ - ], e); - }; - const canvas = container.getElementsByTagName('canvas')[0]; - let pickedId; - const hover = (e)=>{ - if (core.renderer.pickedId !== pickedId) { - pickedId = core.renderer.pickedId; - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeHover(e, ordinal); - } - }; - canvas.addEventListener('mousemove', (e)=>{ - clearClickTimeout(); - if (mousedown) options.onCubeHover(e, null); - hover(e); - }); - canvas.addEventListener('mouseout', hover); - canvas.addEventListener('mouseover', hover); - let mousedown; - canvas.addEventListener('mousedown', ()=>{ - mousedown = true; - }); - canvas.addEventListener('mouseup', (e)=>{ - mousedown = false; - }); - let canvasClickTimeout; - const clearClickTimeout = ()=>{ - clearTimeout(canvasClickTimeout); - canvasClickTimeout = null; - }; - canvas.addEventListener('click', (e)=>{ - canvasClickTimeout = setTimeout(()=>{ - options.onCanvasClick(e); - }, 50); - }); - inputManager.pickItemCallback = ({ manipulator })=>{ - clearClickTimeout(); - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeClick(manipulator.event, ordinal); - }; -} - -},{"morphcharts":"9s7CR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"78Jmh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Transitioner", ()=>Transitioner); -parcelHelpers.export(exports, "CameraTransitioner", ()=>CameraTransitioner); -parcelHelpers.export(exports, "ModelTransitioner", ()=>ModelTransitioner); -var _glMatrix = require("gl-matrix"); -var _easing = require("./easing"); -class Transitioner { - constructor(){ - this.isTransitioning = false; - } - begin() { - this.isTransitioning = true; - this.time = 0; - } - elapse(elapsedTime, totalTime, ease = false) { - this.time += elapsedTime; - if (this.time >= totalTime) { - this.isTransitioning = false; - this.time = totalTime; - this.ended && this.ended(); - } - const t = this.time / totalTime; - return ease ? (0, _easing.easing)(t) : t; - } -} -class CameraTransitioner extends Transitioner { - constructor(){ - super(); - this.qRotation = { - from: (0, _glMatrix.quat).create(), - to: null, - current: (0, _glMatrix.quat).create() - }; - this.vPosition = { - from: (0, _glMatrix.vec3).create(), - to: null, - current: (0, _glMatrix.vec3).create() - }; + if (t <= 0.01) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else if (t >= 0.99) { + core.renderer.axesVisibility = AxesVisibility.current; + } else { + core.renderer.axesVisibility = AxesVisibility.none; + } } - move(position, rotation) { - this.begin(); - this.qRotation.to = rotation; - this.vPosition.to = position; - } -} -class ModelTransitioner extends Transitioner { - constructor(){ - super(); - this.shouldTransition = false; - this.qRotation = { - from: null, - to: null, - current: (0, _glMatrix.quat).create() - }; + } + function morphChartsRender(ref2, prevStage, stage, height2, width2, preStage, colors2, config) { + const { qCameraRotation2d: qCameraRotation2d2, qCameraRotation3d: qCameraRotation3d2, qModelRotation2d: qModelRotation2d2, qModelRotation3d: qModelRotation3d2, vCameraPosition: vCameraPosition2 } = cameraDefaults; + const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref2; + let transistion2dOnly = false; + let cameraTo; + let holdCamera; + if (config.camera === "hold") { + holdCamera = true; + } else { + cameraTo = config.camera; } -} - -},{"gl-matrix":"5x28d","./easing":"kLGAR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kLGAR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easing", ()=>easing); -var _d3Ease = require("d3-ease"); -function easing(t) { - if (t === 0 || t === 1) return t; - return (0, _d3Ease.easeCubicInOut)(t); -} - -},{"d3-ease":"ejK9C","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ejK9C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easeLinear", ()=>(0, _linearJs.linear)); -parcelHelpers.export(exports, "easeQuad", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeQuadIn", ()=>(0, _quadJs.quadIn)); -parcelHelpers.export(exports, "easeQuadOut", ()=>(0, _quadJs.quadOut)); -parcelHelpers.export(exports, "easeQuadInOut", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeCubic", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easeCubicIn", ()=>(0, _cubicJs.cubicIn)); -parcelHelpers.export(exports, "easeCubicOut", ()=>(0, _cubicJs.cubicOut)); -parcelHelpers.export(exports, "easeCubicInOut", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easePoly", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easePolyIn", ()=>(0, _polyJs.polyIn)); -parcelHelpers.export(exports, "easePolyOut", ()=>(0, _polyJs.polyOut)); -parcelHelpers.export(exports, "easePolyInOut", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easeSin", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeSinIn", ()=>(0, _sinJs.sinIn)); -parcelHelpers.export(exports, "easeSinOut", ()=>(0, _sinJs.sinOut)); -parcelHelpers.export(exports, "easeSinInOut", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeExp", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeExpIn", ()=>(0, _expJs.expIn)); -parcelHelpers.export(exports, "easeExpOut", ()=>(0, _expJs.expOut)); -parcelHelpers.export(exports, "easeExpInOut", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeCircle", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeCircleIn", ()=>(0, _circleJs.circleIn)); -parcelHelpers.export(exports, "easeCircleOut", ()=>(0, _circleJs.circleOut)); -parcelHelpers.export(exports, "easeCircleInOut", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeBounce", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceIn", ()=>(0, _bounceJs.bounceIn)); -parcelHelpers.export(exports, "easeBounceOut", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceInOut", ()=>(0, _bounceJs.bounceInOut)); -parcelHelpers.export(exports, "easeBack", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeBackIn", ()=>(0, _backJs.backIn)); -parcelHelpers.export(exports, "easeBackOut", ()=>(0, _backJs.backOut)); -parcelHelpers.export(exports, "easeBackInOut", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeElastic", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticIn", ()=>(0, _elasticJs.elasticIn)); -parcelHelpers.export(exports, "easeElasticOut", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticInOut", ()=>(0, _elasticJs.elasticInOut)); -var _linearJs = require("./linear.js"); -var _quadJs = require("./quad.js"); -var _cubicJs = require("./cubic.js"); -var _polyJs = require("./poly.js"); -var _sinJs = require("./sin.js"); -var _expJs = require("./exp.js"); -var _circleJs = require("./circle.js"); -var _bounceJs = require("./bounce.js"); -var _backJs = require("./back.js"); -var _elasticJs = require("./elastic.js"); - -},{"./linear.js":false,"./quad.js":false,"./cubic.js":"9VY6p","./poly.js":false,"./sin.js":false,"./exp.js":false,"./circle.js":false,"./bounce.js":false,"./back.js":false,"./elastic.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VY6p":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubicIn", ()=>cubicIn); -parcelHelpers.export(exports, "cubicOut", ()=>cubicOut); -parcelHelpers.export(exports, "cubicInOut", ()=>cubicInOut); -function cubicIn(t) { - return t * t * t; -} -function cubicOut(t) { - return --t * t * t + 1; -} -function cubicInOut(t) { - return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3abZO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ViewGl", ()=>ViewGl); -var _base = require("../base"); -var _defaults = require("../defaults"); -var _presenter = require("../presenter"); -var _enums = require("../enums"); -var _rendererGl = require("./rendererGl"); -let registered = false; -//dynamic superclass lets us create a subclass at execution phase instead of declaration phase. -//This allows us to retrieve vega.View from either UMD or ES6 consumers of this class. -//pass in the SuperClass, which should be a vega.View -function _ViewGl(runtime, config) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class ViewGlInternal extends (0, _base.base).vega.View { - constructor(runtime, config = {}){ - super(runtime, config); - this.config = config; - this.presenter = config.presenter; - config.presenterConfig = config.presenterConfig || {}; - config.presenterConfig.redraw = ()=>{ - this._redraw = true; //use Vega View private member _redraw - this.run(); - }; - } - renderer(...args) { - if (args && args.length) { - const renderer = args[0]; - if (renderer === 'morphcharts' && !registered) { - (0, _base.base).vega.renderModule('morphcharts', { - handler: (0, _base.base).vega.CanvasHandler, - renderer: (0, _rendererGl.RendererGl) - }); - registered = true; - } - return super.renderer(renderer); - } else return super.renderer(); - } - initialize(el) { - if (!this.presenter) this.presenter = new (0, _presenter.Presenter)(el); - super.initialize(this.presenter.getElement((0, _enums.PresenterElement).vegaControls)); - const renderer = this._renderer; - renderer.presenterConfig = this.config.presenterConfig; - renderer.presenter = this.presenter; - renderer.getView = this.config && this.config.getView || (()=>this.presenter.view || (0, _defaults.defaultView)); - return this; - } - error(e) { - if (this.presenter.logger) this.presenter.logger(e); - } + if (prevStage && prevStage.view !== stage.view) { + modelTransitioner.shouldTransition = !holdCamera; + if (stage.view === "2d") { + modelTransitioner.qRotation.from = qModelRotation3d2; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.from = qModelRotation2d2; + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } + } else { + modelTransitioner.shouldTransition = false; + if (stage.view === "2d") { + transistion2dOnly = true; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } } - const instance = new ViewGlInternal(runtime, config); - return instance; -} -const ViewGl = _ViewGl; - -},{"../base":"hIePf","../defaults":"4Q1zd","../presenter":"9yYY0","../enums":"hnVHt","./rendererGl":"cfqe0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cfqe0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererGl", ()=>RendererGl); -var _base = require("../base"); -//pass in the SuperClass, which should be a vega.View -function _RendererGl(loader) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class RendererGlInternal extends (0, _base.base).vega.Renderer { - initialize(el, width, height, origin) { - this.height = height; - this.width = width; - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin); - } - resize(width, height, origin) { - super.resize(width, height, origin); - this.origin = origin; - this.height = height; - this.width = width; - //rteturn this for vega - return this; - } - _render(scene, items) { - const scene3d = scene; - scene3d.view = this.getView(); - this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); - //return this for vega - return this; - } - } - const instance = new RendererGlInternal(loader); - return instance; -} -const RendererGl = _RendererGl; - -},{"../base":"hIePf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eMVZG":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '1.0.6'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iDNR0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "colorSchemes", ()=>colorSchemes); -parcelHelpers.export(exports, "registerColorSchemes", ()=>registerColorSchemes); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _defaults = require("./defaults"); -const dualPairs = [ - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).gray - ], - [ - (0, _defaults.dualColorSchemeColors).red, - (0, _defaults.dualColorSchemeColors).green - ], - [ - (0, _defaults.dualColorSchemeColors).red, - (0, _defaults.dualColorSchemeColors).blue - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).red - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).orange - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).green - ] -]; -const colorSchemes = [ - { - scheme: (0, _sanddanceSpecs.ColorScaleNone), - colors: [ - (0, _defaults.defaultViewerOptions).colors.defaultCube - ] + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + if (!prevStage) { + core.setModelRotation(modelTransitioner.qRotation.to, false); + core.camera.setOrbit(cameraTransitioner.qRotation.to, false); + core.camera.setPosition(cameraTransitioner.vPosition.to, false); + } else if (!holdCamera) { + cameraTransitioner.begin(); } -]; -createDualColorSchemes(); -function registerColorSchemes(vega) { - colorSchemes.forEach((cs)=>{ - if (cs.colors.length === 1) vega.scheme(cs.scheme, (x)=>cs.colors[0]); - else vega.scheme(cs.scheme, cs.colors); - }); -} -function createPair(names, colors) { - const scheme = `dual_${names[0]}${names[1]}`; - colorSchemes.push({ - scheme, - colors - }); -} -function createDualColorSchemes() { - dualPairs.forEach((colors)=>{ - const names = colors.map((color)=>{ - for(const key in 0, _defaults.dualColorSchemeColors)if (color === (0, _defaults.dualColorSchemeColors)[key]) return key; - }); - createPair(names, colors); - createPair([ - ...names - ].reverse(), [ - ...colors - ].reverse()); - }); -} - -},{"@msrvida/sanddance-specs":"aOvSr","./defaults":"7bMd0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9IMa3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Component to view a SandDance data visualization. - */ parcelHelpers.export(exports, "Viewer", ()=>Viewer); -var _animator = require("./animator"); -var _axisSelection = require("./axisSelection"); -var _colorCubes = require("./colorCubes"); -var _colorSchemes = require("./colorSchemes"); -var _constants = require("./constants"); -var _dataScope = require("./dataScope"); -var _defaults = require("./defaults"); -var _details = require("./details"); -var _headers = require("./headers"); -var _legend = require("./legend"); -var _ordinal = require("./ordinal"); -var _search = require("./search"); -var _signals = require("./signals"); -var _tooltip = require("./tooltip"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _searchExpression = require("@msrvida/search-expression"); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _characterSet = require("./characterSet"); -var _transition = require("./transition"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + positionTransitioner.begin(); + if (modelTransitioner.shouldTransition) { + modelTransitioner.begin(); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + const props = { ref: ref2, stage, height: height2, config }; + const cubeLayer = createCubeLayer(props); + const lineLayer = createLineLayer(props); + const textLayer = createTextLayer(props); + const { backgroundImages } = stage; + let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); + backgroundImages === null || backgroundImages === void 0 ? void 0 : backgroundImages.forEach((backgroundImage) => { + contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); }); -}; -const { defaultView } = _vegaMorphcharts.defaults; -const zAxisZindex = 1010; -let didRegisterColorSchemes = false; -class Viewer { - /** - * Instantiate a new Viewer. - * @param element Parent HTMLElement to present within. - * @param options Optional viewer options object. - */ constructor(element, options){ - this.element = element; - this.options = _vegaMorphcharts.util.deepMerge((0, _defaults.defaultViewerOptions), options); - this.presenter = new _vegaMorphcharts.Presenter(element, (0, _defaults.getPresenterStyle)(this.options)); - //this.presenter.logger = console.log; - this._characterSet = new (0, _characterSet.CharacterSet)(); - this._dataScope = new (0, _dataScope.DataScope)(); - this._animator = new (0, _animator.Animator)(this._dataScope, { - onDataChanged: this.onDataChanged.bind(this), - onAnimateDataChange: this.onAnimateDataChange.bind(this) - }); - this._details = new (0, _details.Details)(this.presenter.getElement(_vegaMorphcharts.PresenterElement.panel), this.options.language, this._animator, this._dataScope, (remap)=>{ - this.currentColorContext = ~~remap; - this.renderSameLayout(); - }, ()=>this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); - this.insight = {}; - } - changeColorContexts(colorContexts) { - this.colorContexts = colorContexts; - this.currentColorContext = 0; - this.options.onColorContextChange && this.options.onColorContextChange(); - } - applyLegendColorContext(colorContext) { - const a = _vegaMorphcharts.util.getActiveElementInfo(); - _vegaMorphcharts.util.mount(colorContext.legendElement, this.presenter.getElement(_vegaMorphcharts.PresenterElement.legend)); - _vegaMorphcharts.util.setActiveElement(a); - this.presenter.stage.legend = colorContext.legend; - } - onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time) { - var _a; - if (time === undefined) { - const transitionDurations = ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) || _vegaMorphcharts.defaults.defaultPresenterConfig.transitionDurations; - time = transitionDurations.position + transitionDurations.stagger; - } - return new Promise((resolve, reject)=>{ - let innerPromise; - if (dataChange === (0, _animator.DataLayoutChange).refine) { - const oldColorContext = this.colorContexts[this.currentColorContext]; - innerPromise = new Promise((innerResolve)=>{ - this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, cubeLayer)=>{ - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - cubeLayer.unitColorMap = oldColorContext.colorMap; - if (this.options.onStage) this.options.onStage(stage); - } - })).then(()=>{ - //apply old legend - this.applyLegendColorContext(oldColorContext); - innerResolve(); - }); - }); - } else innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, colorMapper)=>{ - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - if (this.options.onStage) this.options.onStage(stage); - } - })); - innerPromise.then(()=>{ - this.presenter.animationQueue(resolve, time, { - waitingLabel, - handlerLabel, - animationCanceled: reject - }); - }); - }); - } - onDataChanged(dataLayout, filter) { - return __awaiter(this, void 0, void 0, function*() { - switch(dataLayout){ - case (0, _animator.DataLayoutChange).same: - { - const hasSelectedData = this._dataScope.hasSelectedData(); - const hasActive = !!this._dataScope.active; - if (hasSelectedData || hasActive) this.presenter.morphChartsRenderResult.update({ - cubes: this.convertSearchToSet() - }); - else this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - break; - } - case (0, _animator.DataLayoutChange).refine: - { - //save cube colors - const oldColorContext = this.colorContexts[this.currentColorContext]; - let colorMap; - this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, cubeLayer)=>{ - //save off the spec colors - colorMap = cubeLayer.unitColorMap; - cubeLayer.unitColorMap = oldColorContext.colorMap; - this.preStage(stage, cubeLayer); - }, - onPresent: ()=>{ - //save new legend - const newColorContext = { - colorMap, - legend: _vegaMorphcharts.util.clone(this.presenter.stage.legend), - legendElement: this.presenter.getElement(_vegaMorphcharts.PresenterElement.legend).children[0] - }; - //apply old legend - this.applyLegendColorContext(oldColorContext); - this.changeColorContexts([ - oldColorContext, - newColorContext - ]); - this.onPresent(); - } - })); - //narrow the filter only if it is different - if (!_searchExpression.compare(this.insight.filter, filter)) this.insight.filter = _searchExpression.narrow(this.insight.filter, filter); - if (this.options.onDataFilter) this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); - break; - } - case (0, _animator.DataLayoutChange).reset: - { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - this.changeColorContexts([ - colorContext - ]); - this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - onPresent: ()=>{ - //color needs to change instantly - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.onPresent(); - } - })); - delete this.insight.filter; - if (this.options.onDataFilter) this.options.onDataFilter(null, null); - break; - } - } - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); - } - }); - } - convertSearchToSet() { - if (this._dataScope.selection) { - const s = new Set(); - let found = false; - this._dataScope.selection.included.forEach((o, i)=>{ - s.add(o[0, _constants.GL_ORDINAL]); - found = true; - }); - if (!found) s.add(-1); - return s; - } - } - convertSetToSearch(s) { - const search = { - expressions: [] - }; - s.forEach((value)=>{ - search.expressions.push({ - name: (0, _constants.GL_ORDINAL), - operator: '==', - value, - clause: '||' - }); - }); - return search; - } - getSpecColumnsWithFilteredStats() { - if (!this._dataScope.hasFilteredData()) return this._specColumns; - const roles = [ - 'color', - 'facet', - 'group', - 'size', - 'sort', - 'sum', - 'x', - 'y', - 'z' - ]; - const specColumns = Object.assign({}, this._specColumns); - roles.forEach((r)=>{ - if (specColumns[r]) { - const column = Object.assign({}, specColumns[r]); - column.stats = this.getColumnStats(column); - specColumns[r] = column; - } - }); - return specColumns; - } - renderNewLayout(signalValues, presenterConfig, view) { - return __awaiter(this, void 0, void 0, function*() { - const currData = this._dataScope.currentData(); - const context = { - specColumns: this.getSpecColumnsWithFilteredStats(), - insight: this.insight, - specViewOptions: Object.assign(Object.assign({}, this.options), { - zAxisOptions: { - showZAxis: true, - zIndex: zAxisZindex - }, - collapseFacetAxes: true - }) - }; - const specResult = (0, _sanddanceSpecs.build)(context, currData); - if (!specResult.errors) { - const uiValues = (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec); - (0, _signals.applySignalValues)(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); - (0, _signals.unbindSignalUI)(specResult.vegaSpec); - this.vegaSpec = specResult.vegaSpec; - this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); - this.specCapabilities = specResult.specCapabilities; - const config = this.createConfig(presenterConfig); - this._lastPresenterConfig = config.presenterConfig; - if (view) config.getView = ()=>view; - if (!didRegisterColorSchemes) { - (0, _colorSchemes.registerColorSchemes)(_vegaMorphcharts.base.vega); - didRegisterColorSchemes = true; - } - try { - if (this.vegaViewGl) this.vegaViewGl.finalize(); - const runtime = _vegaMorphcharts.base.vega.parse(this.vegaSpec); - this.vegaViewGl = new _vegaMorphcharts.ViewGl(runtime, config).renderer('morphcharts').initialize(this.element); - yield this.vegaViewGl.runAsync(); - const handler = (n, v)=>{ - this._characterSet.resetCharacterSet(true); - }; - this.vegaSpec.signals.forEach((s)=>{ - this.vegaViewGl.addSignalListener(s.name, handler); - }); - //capture new color color contexts via signals - this.configForSignalCapture(config.presenterConfig); - } catch (e) { - specResult.errors = [ - e.message - ]; - } - if (!specResult.errors) (0, _headers.ensureHeaders)(this.presenter, this.options.language.headers); - } - if (specResult.errors) { - if (this.options.onError) this.options.onError(specResult.errors); - else if (this.presenter.logger) this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join('\n')}`); - } - return specResult; - }); - } - /** - * Render the same layout with new options. - * @param newViewerOptions New options object. - */ renderSameLayout(newViewerOptions) { - const colorContext = this.colorContexts[this.currentColorContext]; - this.applyLegendColorContext(colorContext); - if (newViewerOptions) { - if (newViewerOptions.colors) { - //set theme colors PresenterConfig - const mcColors = this.getMorphChartsColors(); - this.presenter.configColors(mcColors); - this._lastPresenterConfig.morphChartsColors = mcColors; - } - this.options = _vegaMorphcharts.util.deepMerge(this.options, newViewerOptions); - } - this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; - this.presenter.morphChartsRenderResult.update({ - cubes: this.convertSearchToSet() - }); - } - getView(view) { - if (view === undefined) { - if (this.presenter.view === null) return defaultView; - else return this.presenter.view; - } else return view; - } - transformData(values, transform) { - try { - const runtime = _vegaMorphcharts.base.vega.parse({ - $schema: 'https://vega.github.io/schema/vega/v4.json', - data: [ - { - name: 'source', - values, - transform - } - ] - }); - new _vegaMorphcharts.ViewGl(runtime).run(); - } catch (e) { - // continue regardless of error - } - return values; - } - /** - * Render data into a visualization. - * @param insightSetup InsightSetup object to create a visualization rendering. - * @param data Array of data objects. - * @param renderOptions Optional RenderOptions object. - */ render(insightSetup_1, data_1) { - return __awaiter(this, arguments, void 0, function*(insightSetup, data, renderOptions = {}) { - const { insight, setup } = insightSetup; - let result; - //see if refine expression has changed - if (!_searchExpression.compare(insight.filter, this.insight.filter)) { - const transitionDurations = (setup === null || setup === void 0 ? void 0 : setup.transitionDurations) || _vegaMorphcharts.defaults.defaultPresenterConfig.transitionDurations; - const renderTime = transitionDurations.position + transitionDurations.stagger; - const allowAsyncRenderTime = renderTime + this.options.filterRenderingTimerPadding; - if (insight.filter) { - //refining - result = yield this._render(insightSetup, data, renderOptions, true); - this.presenter.animationQueue(()=>{ - this.filter(insight.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); - }, allowAsyncRenderTime, { - waitingLabel: 'layout before refine', - handlerLabel: 'refine after layout' - }); - } else { - //not refining - this._dataScope.setFilteredData(null); - result = yield this._render(insightSetup, data, renderOptions, true); - this.presenter.animationQueue(()=>{ - this.reset(); - }, allowAsyncRenderTime, { - waitingLabel: 'layout before reset', - handlerLabel: 'reset after layout' - }); - } - } else result = yield this._render(insightSetup, data, renderOptions, false); - return result; - }); - } - shouldViewstateTransition(newInsight, oldInsight) { - if (!oldInsight.columns) return false; - if (oldInsight.chart !== newInsight.chart) return true; - if (oldInsight.size.height !== newInsight.size.height) return true; - if (oldInsight.size.width !== newInsight.size.width) return true; - if (oldInsight.columns.facet !== newInsight.columns.facet) return true; - return false; - } - configForSignalCapture(presenterConfig) { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - //now be ready to capture color changing signals - presenterConfig.preStage = (stage, cubeLayer)=>{ - if (this._shouldSaveColorContext()) //save off the colors from Vega layout - colorContext.colorMap = cubeLayer.unitColorMap; - this.preStage(stage, cubeLayer); - }; - presenterConfig.onPresent = ()=>{ - if (this._shouldSaveColorContext()) { - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.changeColorContexts([ - colorContext - ]); - this._dataScope.deselect(); - } - this.onPresent(); - }; - } - onPresent() { - var _a; - if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transition) (0, _transition.assignTransitionStagger)(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); - this.options.onPresent && this.options.onPresent(); - } - _render(insightSetup, data, renderOptions, forceNewCharacterSet) { - return __awaiter(this, void 0, void 0, function*() { - const { insight, setup } = insightSetup; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (this._dataScope.setData(data, renderOptions.columns)) //apply transform to the data - this.transformData(data, insight.transform); - this._specColumns = (0, _sanddanceSpecs.getSpecColumns)(insight, this._dataScope.getColumns(renderOptions.columnTypes)); - const ordinalMap = (0, _ordinal.assignOrdinals)(this._specColumns, data, renderOptions.ordinalMap); - this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight); - this.insight = _vegaMorphcharts.util.clone(insight); - this.setup = setup; - this._shouldSaveColorContext = ()=>!renderOptions.initialColorContext; - const colorContext = renderOptions.initialColorContext || { - colorMap: null, - legend: null, - legendElement: null - }; - const specResult = yield this.renderNewLayout(insight.signalValues, Object.assign(Object.assign({}, setup || {}), { - preStage: (stage, cubeLayer)=>{ - if (this._shouldSaveColorContext()) //save off the colors from Vega layout - colorContext.colorMap = cubeLayer.unitColorMap; - else //apply passed colorContext - cubeLayer.unitColorMap = colorContext.colorMap; - //if items are selected, repaint - const hasSelectedData = !!this._dataScope.hasSelectedData(); - //const hasActive = !!this._dataScope.active; - hasSelectedData || this._dataScope.active; - this.preStage(stage, cubeLayer); - }, - onPresent: ()=>{ - if (this._shouldSaveColorContext()) { - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.changeColorContexts([ - colorContext - ]); - } else //apply passed colorContext - this.applyLegendColorContext(colorContext); - this.onPresent(); - }, - shouldViewstateTransition: ()=>this.shouldViewstateTransition(insight, this.insight) - }), this.getView(insight.view)); - //future signal changes should save the color context - this._shouldSaveColorContext = ()=>!renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); - this._details.render(); - const result = { - ordinalMap, - specResult - }; - return result; - }); - } - overrideAxisLabels(stage) { - // if (this._specColumns.x && this._specColumns.x.type === 'date') { - // stage.axes.x.forEach(axis => makeDateRange( - // axis.tickText, - // this.getColumnStats(this._specColumns.x) - // )); - // } - // if (this._specColumns.y && this._specColumns.y.type === 'date') { - // stage.axes.y.forEach(axis => makeDateRange( - // axis.tickText, - // this.getColumnStats(this._specColumns.y) - // )); - // } - } - preLayer(stage) { - //convert ticks - let axisRole; - for(axisRole in stage.axes){ - const capability = this.specCapabilities.roles.filter((r)=>r.role === axisRole)[0]; - if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === 'exact')) (0, _axisSelection.moveTicksBetween)(stage.axes[axisRole]); - } + props.bounds = contentBounds; + core.renderer.previousAxes = core.renderer.currentAxes; + const axesLayer = createAxesLayer(props); + core.config.transitionStaggering = config.transitionDurations.stagger; + core.config.transitionDuration = config.transitionDurations.position; + let bounds2; + if (axesLayer && axesLayer.bounds) { + bounds2 = axesLayer.bounds; + } else { + bounds2 = contentBounds; } - preStage(stage, cubeLayer) { - this.overrideAxisLabels(stage); - this._axisSelection = new (0, _axisSelection.AxisSelection)(this.specCapabilities, this._specColumns, stage); - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - if (this.options.onStage) this.options.onStage(stage); + ref2.setMorphChartsRendererOptions(config.renderer); + if (preStage) { + preStage(stage, cubeLayer); } - onCubeClick(e, cube) { - this.options.onCubeClick && this.options.onCubeClick(e, cube); - const hasSelectedData = this._dataScope.hasSelectedData(); - if (hasSelectedData && this._dataScope.selection.included.length > 1) { - //if active is within selection, keep the selection and activate the one. - const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); - if (indexWithinSelection.index >= 0) { - this.activate(indexWithinSelection.datum); - this._details.populate(this._dataScope.selection, indexWithinSelection.index); - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); - } - return; - } - } - if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][0, _constants.GL_ORDINAL] === cube.ordinal) { - this.deselect(); - return; + core.renderer.images = []; + if (backgroundImages) { + const addImage = (imageBounds, imageData) => { + const imageWidth2 = imageBounds.maxBoundsX - imageBounds.minBoundsX; + const imageHeight2 = imageBounds.maxBoundsY - imageBounds.minBoundsY; + const position2 = [imageBounds.minBoundsX + imageWidth2 / 2, imageBounds.minBoundsY + imageHeight2 / 2, 0]; + const imageQuad = createImageQuad(core, imageData, contentBounds, position2, imageWidth2, imageHeight2); + const imageVisual = core.renderer.createImageVisual(imageQuad); + core.renderer.images.push(imageVisual); + }; + const imageDataCache = {}; + backgroundImages.forEach((backgroundImage) => { + const imageBounds = convertBounds(backgroundImage.bounds); + const imageData = imageDataCache[backgroundImage.url]; + if (imageData) { + addImage(imageBounds, imageData); + } else { + getImageData(backgroundImage.url).then((imageData2) => { + imageDataCache[backgroundImage.url] = imageData2; + addImage(imageBounds, imageData2); + }); } - const search = { - name: (0, _constants.GL_ORDINAL), - operator: '==', - value: cube.ordinal - }; - this.select(search); + }); } - onCubeHover(event, cube) { - var _a, _b; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (!cube) return; - const currentData = this._dataScope.currentData(); - const index = (0, _ordinal.getDataIndexOfCube)(cube, currentData); - if (index >= 0) { - const dataItem = (0, _tooltip.cleanDataItem)(((_a = this.options.tooltipOptions) === null || _a === void 0 ? void 0 : _a.prepareDataItem(currentData[index])) || currentData[index]); - const tooltipCreateOptions = { - dataItem, - event - }; - if ((_b = this.options.tooltipOptions) === null || _b === void 0 ? void 0 : _b.create) this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); - else this._tooltip = new (0, _tooltip.Tooltip)(Object.assign(Object.assign({}, tooltipCreateOptions), { - cssPrefix: this.presenter.style.cssPrefix - })); + layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds2, ref2.layerStagger); + applyCameraCallbacks(ref2, config, stage.view, transistion2dOnly); + core.renderer.transitionTime = 0; + colorConfig(ref2, colors2); + return { + bounds: bounds2, + getCubeLayer: () => cubeLayer, + update: (layerSelection) => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, ref2.layerStagger), + activate: (id2) => core.renderer.transitionBuffers[0].activeId = id2, + moveCamera: (camera) => { + if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + cameraTransitioner.move(camera.position, camera.rotation); } + }, + setTransitionTimeAxesVisibility: () => { + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } + }; + } + function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, layerStagger) { + const layerItems = [ + { + layer: cubeLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes + }, + { + layer: lineLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines + }, + { + layer: textLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts + } + ]; + layerItems.forEach((layerItem) => { + var _a2; + return (_a2 = layerItem.layer) === null || _a2 === void 0 ? void 0 : _a2.update(bounds2, layerItem.selection, layerItem.stagger); + }); + } + function convertBounds(bounds2) { + if (!bounds2) + return; + return { + minBoundsX: bounds2.x1, + maxBoundsX: bounds2.x2, + minBoundsY: -bounds2.y2, + maxBoundsY: -bounds2.y1, + minBoundsZ: minZ, + maxBoundsZ: minZ + }; + } + function shouldChangeRenderer(prev, next) { + var _a2, _b2; + if (!prev || !next) + return true; + if (prev.advanced !== next.advanced) + return true; + if (!prev.advanced) { + return ((_a2 = prev.basicOptions) === null || _a2 === void 0 ? void 0 : _a2.antialias) != ((_b2 = next.basicOptions) === null || _b2 === void 0 ? void 0 : _b2.antialias); } - onTextHover(e, t) { - //return true if highlight color is different - if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) return false; - return !_vegaMorphcharts.util.colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); + } + function getRenderer(mcRendererOptions, core) { + const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; + const r = advanced ? new Main() : new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); + core.renderer = r; + setRendererOptions(r, mcRendererOptions); + return r; + } + function setRendererOptions(renderer, mcRendererOptions) { + const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; + if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) { + for (const key2 in o) { + renderer.config[key2] = o[key2]; + } } - getMorphChartsColors() { - const { colors } = this.options; - return { - activeItemColor: colors.activeCube, - axesGridBackgroundColor: colors.backgroundColor, - axesGridHighlightColor: colors.axisSelectHighlight, - axesGridMajorColor: colors.gridLine, - axesGridMinorColor: colors.gridLine, - axesGridZeroColor: colors.gridLine, - axesTextHeadingColor: colors.axisText, - axesTextLabelColor: colors.axisText, - axesTextTitleColor: colors.axisText, - backgroundColor: colors.backgroundColor, - textBorderColor: colors.backgroundColor, - textColor: colors.axisText - }; + } + function rendererEnabled(advanced) { + const r = advanced ? new Main() : new Main$1(); + return r.isSupported; + } + const rightButton = 2; + function listenCanvasEvents(core, options2) { + const { container, pickGridCallback } = options2; + const { inputManager } = core; + if (options2.onLasso) { + inputManager.pickLassoCallback = (result) => { + options2.onLasso(result.ids[0], result.manipulator.event); + }; + } + inputManager.singleTouchAction = (manipulator) => { + if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.rotate; + } else if (manipulator.altKey) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.translate; + } + }; + inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { + clearClickTimeout(); + const { altKey, button, shiftKey } = manipulator; + const me = { altKey, shiftKey, button }; + const e = me; + pickGridCallback([divisionX, divisionY, divisionZ], e); + }; + const canvas = container.getElementsByTagName("canvas")[0]; + let pickedId; + const hover2 = (e) => { + if (core.renderer.pickedId !== pickedId) { + pickedId = core.renderer.pickedId; + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options2.onCubeHover(e, ordinal2); + } + }; + canvas.addEventListener("mousemove", (e) => { + clearClickTimeout(); + if (mousedown) { + options2.onCubeHover(e, null); + } + hover2(e); + }); + canvas.addEventListener("mouseout", hover2); + canvas.addEventListener("mouseover", hover2); + let mousedown; + canvas.addEventListener("mousedown", () => { + mousedown = true; + }); + canvas.addEventListener("mouseup", (e) => { + mousedown = false; + }); + let canvasClickTimeout; + const clearClickTimeout = () => { + clearTimeout(canvasClickTimeout); + canvasClickTimeout = null; + }; + canvas.addEventListener("click", (e) => { + canvasClickTimeout = setTimeout(() => { + options2.onCanvasClick(e); + }, 50); + }); + inputManager.pickItemCallback = ({ manipulator }) => { + clearClickTimeout(); + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options2.onCubeClick(manipulator.event, ordinal2); + }; + } + function cubicInOut(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; + } + function easing(t) { + if (t === 0 || t === 1) + return t; + return cubicInOut(t); + } + class Transitioner { + constructor() { + this.isTransitioning = false; } - createConfig(c) { - var _a; - const { getTextColor, getTextHighlightColor, onTextClick } = this.options; - const defaultPresenterConfig = { - morphChartsColors: this.getMorphChartsColors(), - zAxisZindex, - getCharacterSet: (stage)=>this._characterSet.getCharacterSet(stage), - getTextColor, - getTextHighlightColor, - onTextClick: (e, t)=>{ - if (t.metaData && t.metaData.search) { - //used by facets to select the facet - const search = (0, _search.getSearchGroupFromVegaValue)(t.metaData.search); - if (this.options.onAxisClick) this.options.onAxisClick(e, search); - else this.select(search); - } - if (onTextClick) onTextClick(e, t); - }, - onCubeClick: this.onCubeClick.bind(this), - onCubeHover: this.onCubeHover.bind(this), - onTextHover: this.onTextHover.bind(this), - preLayer: this.preLayer.bind(this), - preStage: this.preStage.bind(this), - onPresent: this.onPresent.bind(this), - onAxisConfig: (cartesian, dim3d, axis)=>{ - if (!axis) return; - const role = this.specCapabilities.roles.filter((r)=>r.role === axis.axisRole)[0]; - if (role === null || role === void 0 ? void 0 : role.axisSelection) { - cartesian.isDivisionPickingEnabled[dim3d] = true; - cartesian.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; - cartesian.isLabelPickingEnabled[dim3d] = true; - cartesian.isTitlePickingEnabled[dim3d] = true; - cartesian.isHeadingPickingEnabled[dim3d] = true; - cartesian.isGridPickingEnabled = false; - } - }, - onAxesComplete: (cartesian)=>{}, - axisPickGridCallback: (divisions, e)=>{ - const search = this._axisSelection.convert(divisions); - if (this.options.onAxisClick) this.options.onAxisClick(e, search); //TODO change onAxisClick to accept Search - else this.select(search); - }, - onLayerClick: (e)=>{ - this.options.onCanvasClick && this.options.onCanvasClick(e); - this.deselect(); - }, - onLegendClick: (e, legend, clickedIndex)=>{ - const legendRow = clickedIndex !== null && legend.rows[clickedIndex]; - if (legendRow) { - if (this.options.onLegendRowClick) this.options.onLegendRowClick(e, legendRow); - else this.select(legendRow.search); - } else if (this.options.onLegendHeaderClick) //header clicked - this.options.onLegendHeaderClick(e); - }, - onSceneRectAssignCubeOrdinal: (datum)=>{ - //TODO see if datum is a facet selection rect - return datum[0, _constants.GL_ORDINAL]; - }, - onTargetViewState: (h, w)=>{ - const { height, width } = this.insight.size; - let newViewStateTarget; - if (this.options.onNewViewStateTarget) newViewStateTarget = this.options.onNewViewStateTarget(); - return { - height, - width, - newViewStateTarget - }; - }, - layerSelection: { - cubes: this.convertSearchToSet() - }, - preserveDrawingBuffer: this.options.preserveDrawingBuffer - }; - if (!this.options.disableLasso) defaultPresenterConfig.onLasso = (ids, e)=>{ - this.deselect(); - const search = this.convertSetToSearch(ids); - this.select(search); - }; - if (this.options.onBeforeCreateLayers) defaultPresenterConfig.preLayer = (stage)=>{ - this.preLayer(stage); - this.options.onBeforeCreateLayers(stage, this.specCapabilities); - }; - const config = { - presenter: this.presenter, - presenterConfig: Object.assign(defaultPresenterConfig, c) - }; - if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) config.presenterConfig.transitionDurations = this.setup.transitionDurations; - return config; + begin() { + this.isTransitioning = true; + this.time = 0; } - /** - * Filter the data and animate. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. - */ filter(search, rebase = false) { - const u = this._dataScope.createUserSelection(search, false, rebase); - return new Promise((resolve, reject)=>{ - this._animator.filter(search, u.included, u.excluded, rebase).then(()=>{ - this._details.clear(); - this._details.clearSelection(); - this._details.populate(this._dataScope.selection); - resolve(); - }); - }); + elapse(elapsedTime, totalTime, ease = false) { + this.time += elapsedTime; + if (this.time >= totalTime) { + this.isTransitioning = false; + this.time = totalTime; + this.ended && this.ended(); + } + const t = this.time / totalTime; + return ease ? easing(t) : t; } - /** - * Remove any filtration and animate. - */ reset() { - return new Promise((resolve, reject)=>{ - this._animator.reset().then(()=>{ - this._details.clear(); - this._details.clearSelection(); - resolve(); - }); - }); + } + class CameraTransitioner extends Transitioner { + constructor() { + super(); + this.qRotation = { + from: create$4(), + to: null, + current: create$4() + }; + this.vPosition = { + from: create$6(), + to: null, + current: create$6() + }; + } + move(position2, rotation2) { + this.begin(); + this.qRotation.to = rotation2; + this.vPosition.to = position2; } - /** - * Select cubes by a filter expression. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - */ select(search) { - return new Promise((resolve, reject)=>{ - this._animator.select(search).then(()=>{ - this._details.populate(this._dataScope.selection); - resolve(); - }); - }); + } + class ModelTransitioner extends Transitioner { + constructor() { + super(); + this.shouldTransition = false; + this.qRotation = { + from: null, + to: null, + current: create$4() + }; } + } + function init$1(options2, mcRendererOptions) { + const { container } = options2; + const core = new Core({ container }); + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options2); + core.config.pickSelectDelay = 50; + const cameraTransitioner = new CameraTransitioner(); + const modelTransitioner = new ModelTransitioner(); + const positionTransitioner = new Transitioner(); + positionTransitioner.ended = () => { + core.renderer.axesVisibility = AxesVisibility.current; + }; + const ref2 = { + supportedRenders: { + advanced: rendererEnabled(true), + basic: rendererEnabled(false) + }, + reset: null, + cameraTransitioner, + modelTransitioner, + positionTransitioner, + core, + setMorphChartsRendererOptions(mcRendererOptions2) { + if (shouldChangeRenderer(ref2.lastMorphChartsRendererOptions, mcRendererOptions2)) { + getRenderer(mcRendererOptions2, core); + listenCanvasEvents(core, options2); + } else { + if (mcRendererOptions2.advanced) { + setRendererOptions(core.renderer, mcRendererOptions2); + } + } + ref2.lastMorphChartsRendererOptions = mcRendererOptions2; + }, + lastMorphChartsRendererOptions: mcRendererOptions, + layerStagger: {} + }; + return ref2; + } + class Presenter { /** - * Removes any selection. - */ deselect() { - return new Promise((resolve, reject)=>{ - this._animator.deselect().then(()=>{ - this._details.clearSelection(); - resolve(); - }); - }); + * Get the previously rendered Stage object. + */ + get stage() { + return this._last.stage; } /** - * Gets the current selection. - */ getSelection() { - if (!this._dataScope) return null; - const selectionState = { - search: this._dataScope.selection && this._dataScope.selection.search || null, - selectedData: this._dataScope.selection && this._dataScope.selection.included || null, - active: this._dataScope.active - }; - return selectionState; + * Get the current View camera type. + */ + get view() { + return this._last.view; } /** - * Set one data row to the active state. - */ activate(datum) { - return new Promise((resolve, reject)=>{ - this._animator.activate(datum).then(()=>{ - this.presenter.morphChartsRenderResult.activate(datum[0, _constants.GL_ORDINAL]); - this._details.render(); - resolve(); - }); - }); + * Instantiate a new Presenter. + * @param el Parent HTMLElement to present within. + * @param style Optional PresenterStyle styling options. + */ + constructor(el, style2) { + this.el = el; + this.style = deepMerge(defaultPresenterStyle$1, style2); + initializePanel(this); + this._last = { view: null, height: null, width: null, cubeCount: null, stage: null }; } /** - * Deactivate item. - */ deActivate() { - return new Promise((resolve, reject)=>{ - if (this._dataScope && this._dataScope.active) this._animator.deactivate().then(()=>{ - this.presenter.morphChartsRenderResult.activate(-1); - this._details.render(); - resolve(); - }); - else resolve(); - }); + * Cancels any pending animation, calling animationCanceled() on original queue. + */ + animationCancel() { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + if (this.logger) { + this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || "handler"}`); + } + if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) { + this.queuedAnimationOptions.animationCanceled.call(null); + } + } } /** - * Gets the current camera. - * @param transitionFinal Optional flag to get camera destination when transition completes. - */ getCamera(transitionFinal = false) { - var _a, _b, _c, _d, _e, _f, _g; - let position = [ - 0, - 0, - 0 - ]; - let rotation = [ - 0, - 0, - 0, - 0 - ]; - if (transitionFinal) { - position = Array.from((_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.cameraTransitioner.vPosition.to); - rotation = Array.from((_d = (_c = this.presenter) === null || _c === void 0 ? void 0 : _c.morphchartsref) === null || _d === void 0 ? void 0 : _d.cameraTransitioner.qRotation.to); - } else { - const camera = (_g = (_f = (_e = this.presenter) === null || _e === void 0 ? void 0 : _e.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; - if (camera) { - camera.getPosition(position); - camera.getOrbit(rotation); - } + * Stops the current animation and queues a new animation. + * @param handler Function to invoke when timeout is complete. + * @param timeout Length of time to wait before invoking the handler. + * @param options Optional QueuedAnimationOptions object. + */ + animationQueue(handler, timeout2, options2) { + if (this.logger) { + this.logger(`queueing animation ${options2 && options2.waitingLabel || "waiting"}...(${timeout2})`); + } + this.animationCancel(); + this.animationTimer = setTimeout(() => { + if (this.logger) { + this.logger(`queueing animation ${options2 && options2.handlerLabel || "handler"}...`); } - return { - position, - rotation, - captureSize: this.insight.size - }; + handler(); + }, timeout2); } /** - * Sets the current camera. - * @param camera Camera to set. - */ setCamera(camera) { - var _a, _b; - if (camera) (_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphChartsRenderResult) === null || _b === void 0 || _b.moveCamera(camera); + * Retrieve a sub-element of the rendered output. + * @param type PresenterElement type of the HTMLElement to retrieve. + */ + getElement(type2) { + const elements = this.el.getElementsByClassName(className$1(type2, this)); + if (elements && elements.length) { + return elements[0]; + } } /** - * Gets the current insight with signal values. - */ getInsight() { - const insight = Object.assign({}, this.insight); - insight.signalValues = this.getSignalValues(); - return insight; + * Present the Vega Scene, or Stage object using Morphcharts. + * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. + * @param height Height of the rendering area. + * @param width Width of the rendering area. + * @param config Optional presentation configuration object. + */ + present(sceneOrStage, height2, width2, config) { + this.animationCancel(); + const scene = sceneOrStage; + let stage; + const options2 = { + maxOrdinal: 0, + currAxis: null, + defaultCubeColor: this.style.defaultCubeColor, + assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (() => options2.maxOrdinal++), + modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, + zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex + }; + if (scene.marktype) { + stage = createStage(scene.view); + sceneToStage(options2, stage, scene); + } else { + stage = sceneOrStage; + } + const c2 = deepMerge(defaultPresenterConfig, config); + if (!this.morphchartsref) { + this._morphChartsOptions = { + container: this.getElement(PresenterElement$1.gl), + pickGridCallback: c2.axisPickGridCallback, + onCubeHover: (e, ordinal2) => { + c2.onCubeHover(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCubeClick: (e, ordinal2) => { + c2.onCubeClick(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, + onLasso: config === null || config === void 0 ? void 0 : config.onLasso + }; + this.morphchartsref = init$1(this._morphChartsOptions, c2.renderer || defaultPresenterConfig.renderer); + } + let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); + if (options2.maxOrdinal) { + cubeCount = Math.max(cubeCount, options2.maxOrdinal); + const empty = { + isEmpty: true + }; + stage.cubeData = patchCubeArray(cubeCount, empty, stage.cubeData); + } + config.preLayer && config.preLayer(stage); + this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height2, width2, config && config.preStage, config && config.morphChartsColors, c2); + delete stage.cubeData; + delete stage.redraw; + this._last = { + cubeCount, + height: height2, + width: width2, + stage, + view: stage.view + }; + const a2 = getActiveElementInfo(); + mount(LegendView({ legend: stage.legend, onClick: config && config.onLegendClick }), this.getElement(PresenterElement$1.legend)); + setActiveElement(a2); + if (config && config.onPresent) { + config.onPresent(); + } } - /** - * Gets column stats from current data (filtered or all). - * @param column Column to get stats for. - */ getColumnStats(column) { - return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; + canvasToDataURL() { + return new Promise((resolve2, reject) => { + this.morphchartsref.core.afterRenderCallback = () => { + this.morphchartsref.core.afterRenderCallback = null; + const canvas = this.getElement(PresenterElement$1.gl).getElementsByTagName("canvas")[0]; + const png = canvas.toDataURL("image/png"); + resolve2(png); + }; + }); + } + configColors(mcColors) { + colorConfig(this.morphchartsref, mcColors); } /** - * Gets current signal values. - */ getSignalValues() { - return (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec); + * Home the camera to the last initial position. + */ + homeCamera() { + var _a2; + (_a2 = this.morphchartsref) === null || _a2 === void 0 ? void 0 : _a2.reset(); } - assignTransitionStagger(transition) { - (0, _transition.assignTransitionStagger)(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + /** + * Show guidelines of rendering height/width and center of OrbitView. + */ + showGuides() { + this.getElement(PresenterElement$1.gl).classList.add("show-center"); } finalize() { - if (this._dataScope) this._dataScope.finalize(); - if (this._details) this._details.finalize(); - if (this._tooltip) this._tooltip.destroy(); - if (this.vegaViewGl) this.vegaViewGl.finalize(); - if (this.presenter) this.presenter.finalize(); - if (this.element) this.element.innerHTML = ''; - this.colorContexts = null; - this.element = null; - this.options = null; - this.presenter = null; - this.vegaSpec = null; - this.vegaViewGl = null; - this._animator = null; - this._dataScope = null; - this._details = null; - this._tooltip = null; + this.animationCancel(); + if (this.morphchartsref) + this.morphchartsref.core.stop(); + if (this.el) + this.el.innerHTML = ""; + this._last = null; + this.morphchartsref = null; + this.el = null; + this.logger = null; + this.queuedAnimationOptions = null; } -} -/** - * Default Viewer options. - */ Viewer.defaultViewerOptions = (0, _defaults.defaultViewerOptions); - -},{"./animator":"g3bB0","./axisSelection":"3Bo2C","./colorCubes":"a2zcs","./colorSchemes":"iDNR0","./constants":"ix2qh","./dataScope":"3xxVJ","./defaults":"7bMd0","./details":"5q1eU","./headers":"bOtA3","./legend":"buMaw","./ordinal":"eRzwB","./search":"6kluJ","./signals":"xDtCn","./tooltip":"bKbCn","@msrvida/sanddance-specs":"aOvSr","@msrvida/search-expression":"4F93b","@msrvida/vega-morphcharts":"9Sd5M","./characterSet":"grMul","./transition":"fNWAw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g3bB0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataLayoutChange", ()=>DataLayoutChange); -parcelHelpers.export(exports, "Animator", ()=>Animator); -var DataLayoutChange; -(function(DataLayoutChange) { - DataLayoutChange[DataLayoutChange["same"] = 0] = "same"; - DataLayoutChange[DataLayoutChange["reset"] = 1] = "reset"; - DataLayoutChange[DataLayoutChange["refine"] = 2] = "refine"; -})(DataLayoutChange || (DataLayoutChange = {})); -class Animator { - constructor(dataScope, props){ - this.dataScope = dataScope; - this.props = props; + } + function _RendererGl(loader2) { + class RendererGlInternal extends base$3.vega.Renderer { + initialize(el, width2, height2, origin) { + this.height = height2; + this.width = width2; + return super.initialize(el, width2, height2, origin); + } + resize(width2, height2, origin) { + super.resize(width2, height2, origin); + this.origin = origin; + this.height = height2; + this.width = width2; + return this; + } + _render(scene, items) { + const scene3d = scene; + scene3d.view = this.getView(); + this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); + return this; + } } - select(search) { - return new Promise((resolve, reject)=>{ - this.dataScope.select(search); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + const instance = new RendererGlInternal(loader2); + return instance; + } + const RendererGl = _RendererGl; + let registered = false; + function _ViewGl(runtime2, config) { + class ViewGlInternal extends base$3.vega.View { + constructor(runtime3, config2 = {}) { + super(runtime3, config2); + this.config = config2; + this.presenter = config2.presenter; + config2.presenterConfig = config2.presenterConfig || {}; + config2.presenterConfig.redraw = () => { + this._redraw = true; + this.run(); + }; + } + renderer(...args) { + if (args && args.length) { + const renderer = args[0]; + if (renderer === "morphcharts" && !registered) { + base$3.vega.renderModule("morphcharts", { handler: base$3.vega.CanvasHandler, renderer: RendererGl }); + registered = true; + } + return super.renderer(renderer); + } else { + return super.renderer(); + } + } + initialize(el) { + if (!this.presenter) { + this.presenter = new Presenter(el); + } + super.initialize(this.presenter.getElement(PresenterElement$1.vegaControls)); + const renderer = this._renderer; + renderer.presenterConfig = this.config.presenterConfig; + renderer.presenter = this.presenter; + renderer.getView = this.config && this.config.getView || (() => this.presenter.view || defaultView$1); + return this; + } + error(e) { + if (this.presenter.logger) { + this.presenter.logger(e); + } + } } - deselect() { - return new Promise((resolve, reject)=>{ - this.dataScope.deselect(); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + const instance = new ViewGlInternal(runtime2, config); + return instance; + } + const ViewGl = _ViewGl; + const version$5 = "1.0.6"; + const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Presenter, + get PresenterElement() { + return PresenterElement$1; + }, + ViewGl, + base: base$3, + controls, + defaults: defaults$1, + types, + use: use$5, + util: util$4, + version: version$5 + }, Symbol.toStringTag, { value: "Module" })); + const { defaultPresenterStyle } = defaults$1; + const defaultViewerOptions$1 = { + colors: { + activeCube: "purple", + defaultCube: colorToString(defaultPresenterStyle.defaultCubeColor), + hoveredCube: colorToString(defaultPresenterStyle.highlightColor), + selectedCube: "yellow", + axisSelectHighlight: colorToString([128, 128, 128, 128]), + axisLine: "#000", + axisText: "#000", + gridLine: "#CCC", + backgroundColor: "#FFF" + }, + language: { + headers: { + chart: "Chart", + details: "Details", + legend: "Legend", + selection: "Select & Filter" + }, + bing: "bing", + newColorMap: "remap color to filtered items", + oldColorMap: "keep same colors", + deselect: "deselect", + exclude: "exclude", + isolate: "isolate", + legendOther: "other", + nextDetail: ">", + previousDetail: "<", + reset: "reset", + colorBinCount: "Color bin count", + colorReverse: "Color reverse", + count: "Count", + percent: "Percent", + sum: "Sum", + scatterPointScale: "Point scale", + FacetMaxBins: "Facet max bins", + FacetVMaxBins: "Cross facet max bins", + XMaxBins: "X axis max bins", + YMaxBins: "Y axis max bins", + XGridSize: "X grid size", + YGridSize: "Y grid size", + InnerPaddingSize: "Inner padding size", + OuterPaddingSize: "Outer padding size", + treeMapMethod: "Treemap layout", + facetColumns: "Facet columns", + facetRows: "Facet rows", + markOpacitySignal: "Mark opacity", + textScaleSignal: "Text scale", + xAxisTextAngleSignal: "X axis text angle", + yAxisTextAngleSignal: "Y axis text angle", + zGrounded: "Z grounded", + zScaleProportion: "Z scale proportion to Y", + selectionCount: (count2) => `${count2} items selected` + }, + maxLegends: 19, + //20 would be "other" + onError: (errors) => { + }, + filterRenderingTimerPadding: 200, + selectionPolygonZ: -1, + tickSize: 10 + }; + function getPresenterStyle(options2) { + const style2 = { + cssPrefix, + fontFamily: options2.fontFamily, + defaultCubeColor: colorFromString(options2.colors.defaultCube) + }; + if (options2.colors.hoveredCube) { + style2.highlightColor = colorFromString(options2.colors.hoveredCube); } - filter(search, keepData, collapseData, rebase) { - if (rebase) this.dataScope.collapse(false, keepData); - this.dataScope.collapse(true, collapseData); - return new Promise((resolve, reject)=>{ - this.props.onAnimateDataChange(DataLayoutChange.refine, 'before refine', 'refine').then(()=>{ - this.dataScope.deselect(); - this.dataScope.setFilteredData(keepData); - this.props.onDataChanged(DataLayoutChange.refine, search); - resolve(); - }).catch(reject); - }); + return style2; + } + const cssPrefix = "sanddance-"; + const dualColorSchemeColors = { + black: "#212121", + gray: "#D2D2D2", + blue: "#0060F0", + green: "#00C000", + orange: "#FF9900", + red: "#E00000" + }; + function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { + if (includeVegaMorphChartsFields) { + if (columnName === GL_ORDINAL) + return true; } - reset() { - return new Promise((resolve, reject)=>{ - this.dataScope.deselect(); - let time; - if (!this.dataScope.hasFilteredData()) time = 0; - else this.dataScope.setFilteredData(null); - this.props.onAnimateDataChange(DataLayoutChange.reset, 'before reset', 'reset', time).then(()=>{ - this.dataScope.collapse(false); - this.props.onDataChanged(DataLayoutChange.reset); - resolve(); - }).catch(reject); - }); + for (const f in FieldNames) { + if (columnName === FieldNames[f]) + return true; } - activate(datum) { - return new Promise((resolve, reject)=>{ - this.dataScope.activate(datum); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + return false; + } + const util$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + getColumnsFromData, + getPresenterStyle, + getStats, + inferAll, + isInternalFieldName + }, Symbol.toStringTag, { value: "Module" })); + const dualPairs = [ + [dualColorSchemeColors.black, dualColorSchemeColors.gray], + [dualColorSchemeColors.red, dualColorSchemeColors.green], + [dualColorSchemeColors.red, dualColorSchemeColors.blue], + [dualColorSchemeColors.black, dualColorSchemeColors.red], + [dualColorSchemeColors.black, dualColorSchemeColors.orange], + [dualColorSchemeColors.black, dualColorSchemeColors.green] + ]; + const colorSchemes = [ + { + scheme: ColorScaleNone, + colors: [defaultViewerOptions$1.colors.defaultCube] + } + ]; + createDualColorSchemes(); + function registerColorSchemes(vega2) { + colorSchemes.forEach((cs) => { + if (cs.colors.length === 1) { + vega2.scheme(cs.scheme, (x2) => cs.colors[0]); + } else { + vega2.scheme(cs.scheme, cs.colors); + } + }); + } + function createPair(names, colors2) { + const scheme2 = `dual_${names[0]}${names[1]}`; + colorSchemes.push({ scheme: scheme2, colors: colors2 }); + } + function createDualColorSchemes() { + dualPairs.forEach((colors2) => { + const names = colors2.map((color2) => { + for (const key2 in dualColorSchemeColors) + if (color2 === dualColorSchemeColors[key2]) + return key2; + }); + createPair(names, colors2); + createPair([...names].reverse(), [...colors2].reverse()); + }); + } + var DataLayoutChange; + (function(DataLayoutChange2) { + DataLayoutChange2[DataLayoutChange2["same"] = 0] = "same"; + DataLayoutChange2[DataLayoutChange2["reset"] = 1] = "reset"; + DataLayoutChange2[DataLayoutChange2["refine"] = 2] = "refine"; + })(DataLayoutChange || (DataLayoutChange = {})); + class Animator { + constructor(dataScope, props) { + this.dataScope = dataScope; + this.props = props; } - deactivate() { - return new Promise((resolve, reject)=>{ - this.dataScope.deactivate(); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + select(search) { + return new Promise((resolve2, reject) => { + this.dataScope.select(search); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Bo2C":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisSelection", ()=>AxisSelection); -parcelHelpers.export(exports, "moveTicksBetween", ()=>moveTicksBetween); -var _expression = require("./expression"); -const dimToRole = { - 0: 'x', - 1: 'y', - 2: 'z' -}; -const roleToDim = { - x: 0, - y: 1, - z: 1 -}; -class AxisSelection { - constructor(specCapabilities, columns, stage){ - this.specCapabilities = specCapabilities; - this.columns = columns; - this.stage = stage; + deselect() { + return new Promise((resolve2, reject) => { + this.dataScope.deselect(); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } - convert(divisions) { - const searchRoles = []; - divisions.forEach((division, i)=>{ - const role = dimToRole[i]; - const axes = this.stage.axes[role]; - //all axes in a faceted chart should be the same - const axis = axes.filter((axis)=>axis.tickText.length)[0]; - if (axis) { - const capabilities = this.specCapabilities.roles.filter((r)=>r.role === role)[0]; - const column = this.columns[role]; - if (division >= 0 && (capabilities === null || capabilities === void 0 ? void 0 : capabilities.axisSelection)) searchRoles.push({ - axis, - role, - capabilities, - column, - division - }); - } - }); - switch(searchRoles.length){ - case 0: - return null; - case 1: - return this.getSearchFromSearchRole(searchRoles[0]); - default: - { - const roles = searchRoles.map((searchRole)=>this.getSearchFromSearchRole(searchRole)); - roles.forEach((role, i)=>{ - if (i === 0) return; - role.clause = '&&'; - }); - return roles; - } + filter(search, keepData, collapseData, rebase) { + if (rebase) { + this.dataScope.collapse(false, keepData); + } + this.dataScope.collapse(true, collapseData); + return new Promise((resolve2, reject) => { + this.props.onAnimateDataChange(DataLayoutChange.refine, "before refine", "refine").then(() => { + this.dataScope.deselect(); + this.dataScope.setFilteredData(keepData); + this.props.onDataChanged(DataLayoutChange.refine, search); + resolve2(); + }).catch(reject); + }); + } + reset() { + return new Promise((resolve2, reject) => { + this.dataScope.deselect(); + let time2; + if (!this.dataScope.hasFilteredData()) { + time2 = 0; + } else { + this.dataScope.setFilteredData(null); } + this.props.onAnimateDataChange(DataLayoutChange.reset, "before reset", "reset", time2).then(() => { + this.dataScope.collapse(false); + this.props.onDataChanged(DataLayoutChange.reset); + resolve2(); + }).catch(reject); + }); } - getSearchFromSearchRole(searchRole) { - const getSearch = searchRole.capabilities.axisSelection === 'exact' ? (a, c, i)=>({ - expressions: [ - (0, _expression.selectExactAxis)(a, c, i) - ] - }) : (0, _expression.selectBetweenAxis); - const { axis, column, division } = searchRole; - return getSearch(axis, column, division); - } -} -function moveTicksBetween(axes) { - axes.forEach((axis)=>{ - if (axis.ticks.length === 0) return; - const dim = roleToDim[axis.axisRole]; - const { color } = axis.ticks[0]; - const newLine = (value)=>{ - const line = { - sourcePosition: [ - 0, - 0, - 0 - ], - targetPosition: [ - 0, - 0, - 0 - ], - color - }; - line.sourcePosition[dim] = value; - return line; - }; - const newTicks = []; - newTicks.push(newLine(axis.domain.sourcePosition[dim])); - for(let i = 1; i < axis.ticks.length; i++)newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); - newTicks.push(newLine(axis.domain.targetPosition[dim])); - axis.ticks = newTicks; - }); -} - -},{"./expression":"2foo2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2foo2":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "notNice", ()=>notNice); -parcelHelpers.export(exports, "selectNullOrEmpty", ()=>selectNullOrEmpty); -parcelHelpers.export(exports, "selectExact", ()=>selectExact); -parcelHelpers.export(exports, "selectNone", ()=>selectNone); -parcelHelpers.export(exports, "selectExactAxis", ()=>selectExactAxis); -parcelHelpers.export(exports, "selectBetween", ()=>selectBetween); -parcelHelpers.export(exports, "selectBetweenAxis", ()=>selectBetweenAxis); -function notNice(niceValue) { - //convert "nice" numbers to numeric value - return (niceValue + '').replace(/[\s,]/g, ''); -} -function tickValue(axis, i) { + activate(datum2) { + return new Promise((resolve2, reject) => { + this.dataScope.activate(datum2); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); + } + deactivate() { + return new Promise((resolve2, reject) => { + this.dataScope.deactivate(); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); + } + } + function notNice(niceValue) { + return (niceValue + "").replace(/[\s,]/g, ""); + } + function tickValue(axis, i) { const tick = axis.tickText[i]; - let value; - if (tick) value = axis.tickText[i].value; - return { - tick, - value - }; -} -function selectNullOrEmpty(column) { + let value2; + if (tick) { + value2 = axis.tickText[i].value; + } + return { tick, value: value2 }; + } + function selectNullOrEmpty(column) { const searchExpression = { - name: column.name, - operator: 'isnullorEmpty' + name: column.name, + operator: "isnullorEmpty" }; return searchExpression; -} -function selectExact(column, value) { - if (value == null) return selectNullOrEmpty(column); + } + function selectExact(column, value2) { + if (value2 == null) { + return selectNullOrEmpty(column); + } const searchExpression = { - name: column.name, - operator: '==', - value + name: column.name, + operator: "==", + value: value2 }; return searchExpression; -} -function selectNone(column, values) { - const expressions = values.map((value, i)=>{ - const searchExpression = { - name: column.name, - operator: '!=', - value - }; - if (i) searchExpression.clause = '&&'; - return searchExpression; + } + function selectNone(column, values2) { + const expressions = values2.map((value2, i) => { + const searchExpression = { + name: column.name, + operator: "!=", + value: value2 + }; + if (i) { + searchExpression.clause = "&&"; + } + return searchExpression; }); const searchExpressionGroup = { - expressions + expressions }; return searchExpressionGroup; -} -function selectExactAxis(axis, column, i) { + } + function selectExactAxis(axis, column, i) { const result = tickValue(axis, i); - if (result.tick) return selectExact(column, result.value); -} -function selectBetween(column, lowValue, highValue, lowOperator = '>=', highOperator = '<') { + if (result.tick) { + return selectExact(column, result.value); + } + } + function selectBetween(column, lowValue, highValue, lowOperator = ">=", highOperator = "<") { const expressions = []; - if (lowValue !== undefined) expressions.push({ + if (lowValue !== void 0) { + expressions.push({ name: column.name, operator: lowOperator, value: lowValue - }); - if (highValue !== undefined) expressions.push({ + }); + } + if (highValue !== void 0) { + expressions.push({ name: column.name, operator: highOperator, value: highValue - }); - if (expressions.length > 1) expressions[1].clause = '&&'; + }); + } + if (expressions.length > 1) { + expressions[1].clause = "&&"; + } const searchExpressionGroup = { - expressions + expressions }; return searchExpressionGroup; -} -function selectBetweenAxis(axis, column, i) { + } + function selectBetweenAxis(axis, column, i) { const low = tickValue(axis, i); const high = tickValue(axis, i + 1); return selectBetween(column, low.value, high.value); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a2zcs":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "populateColorContext", ()=>populateColorContext); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -function populateColorContext(colorContext, presenter) { - if (!colorContext.colorMap) colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; - colorContext.legend = _vegaMorphcharts.util.clone(presenter.stage.legend); - colorContext.legendElement = presenter.getElement(_vegaMorphcharts.PresenterElement.legend).children[0]; -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3xxVJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _searchExpression = require("@msrvida/search-expression"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _constants = require("./constants"); -class DataScope { - constructor(){ - this.filteredColumnsStats = {}; + } + const dimToRole = { + 0: "x", + 1: "y", + 2: "z" + }; + const roleToDim = { + x: 0, + y: 1, + z: 1 + }; + class AxisSelection { + constructor(specCapabilities, columns, stage) { + this.specCapabilities = specCapabilities; + this.columns = columns; + this.stage = stage; } - setData(data, columns) { - const differentData = this.data !== data; - if (differentData) { - if (this.data) //clean up things we added to old data - this.deselect(); - this.data = data; - this.columns = columns; - this.filteredData = null; - this.filteredColumnsStats = {}; + convert(divisions) { + const searchRoles = []; + divisions.forEach((division, i) => { + const role = dimToRole[i]; + const axes = this.stage.axes[role]; + const axis = axes.filter((axis2) => axis2.tickText.length)[0]; + if (axis) { + const capabilities2 = this.specCapabilities.roles.filter((r) => r.role === role)[0]; + const column = this.columns[role]; + if (division >= 0 && (capabilities2 === null || capabilities2 === void 0 ? void 0 : capabilities2.axisSelection)) { + searchRoles.push({ + axis, + role, + capabilities: capabilities2, + column, + division + }); + } + } + }); + switch (searchRoles.length) { + case 0: { + return null; + } + case 1: { + return this.getSearchFromSearchRole(searchRoles[0]); + } + default: { + const roles = searchRoles.map((searchRole) => this.getSearchFromSearchRole(searchRole)); + roles.forEach((role, i) => { + if (i === 0) + return; + role.clause = "&&"; + }); + return roles; } - return differentData; + } } - setFilteredData(filteredData) { - this.filteredData = filteredData; + getSearchFromSearchRole(searchRole) { + const getSearch = searchRole.capabilities.axisSelection === "exact" ? (a2, c2, i) => ({ expressions: [selectExactAxis(a2, c2, i)] }) : selectBetweenAxis; + const { axis, column, division } = searchRole; + return getSearch(axis, column, division); + } + } + function moveTicksBetween(axes) { + axes.forEach((axis) => { + if (axis.ticks.length === 0) + return; + const dim = roleToDim[axis.axisRole]; + const { color: color2 } = axis.ticks[0]; + const newLine = (value2) => { + const line2 = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0], + color: color2 + }; + line2.sourcePosition[dim] = value2; + return line2; + }; + const newTicks = []; + newTicks.push(newLine(axis.domain.sourcePosition[dim])); + for (let i = 1; i < axis.ticks.length; i++) { + newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); + } + newTicks.push(newLine(axis.domain.targetPosition[dim])); + axis.ticks = newTicks; + }); + } + function populateColorContext(colorContext, presenter) { + if (!colorContext.colorMap) { + colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; + } + colorContext.legend = clone(presenter.stage.legend); + colorContext.legendElement = presenter.getElement(PresenterElement$1.legend).children[0]; + } + let DataScope$2 = class DataScope { + constructor() { + this.filteredColumnsStats = {}; + } + setData(data2, columns) { + const differentData = this.data !== data2; + if (differentData) { + if (this.data) { + this.deselect(); + } + this.data = data2; + this.columns = columns; + this.filteredData = null; this.filteredColumnsStats = {}; + } + return differentData; + } + setFilteredData(filteredData) { + this.filteredData = filteredData; + this.filteredColumnsStats = {}; } getColumns(columnTypes) { - if (!this.columns) this.columns = (0, _sanddanceSpecs.getColumnsFromData)(_vegaMorphcharts.base.vega.inferTypes, this.data, columnTypes); - return this.columns; + if (!this.columns) { + this.columns = getColumnsFromData(base$3.vega.inferTypes, this.data, columnTypes); + } + return this.columns; } getFilteredColumnStats(columnName) { - if (!this.filteredColumnsStats[columnName]) this.filteredColumnsStats[columnName] = (0, _sanddanceSpecs.getStats)(this.filteredData, this.columns.filter((c)=>c.name === columnName)[0]); - return this.filteredColumnsStats[columnName]; + if (!this.filteredColumnsStats[columnName]) { + this.filteredColumnsStats[columnName] = getStats(this.filteredData, this.columns.filter((c2) => c2.name === columnName)[0]); + } + return this.filteredColumnsStats[columnName]; } currentData() { - return this.filteredData || this.data; + return this.filteredData || this.data; } select(search) { - this.deselect(); - if (search) { - this.selection = this.createUserSelection(search, true, false); - if (this.selection.included.length) this.activate(this.selection.included[0]); + this.deselect(); + if (search) { + this.selection = this.createUserSelection(search, true, false); + if (this.selection.included.length) { + this.activate(this.selection.included[0]); } + } } - createUserSelection(search, assign, rebase) { - const exec = new (0, _searchExpression.Exec)(search, this.getColumns()); - const s = { - search, - included: [], - excluded: [] - }; - const data = rebase ? this.data : this.currentData(); - data.forEach((datum)=>{ - if (exec.run(datum)) { - if (assign) datum[(0, _sanddanceSpecs.FieldNames).Selected] = true; - s.included.push(datum); - } else s.excluded.push(datum); - }); - return s; + createUserSelection(search, assign2, rebase) { + const exec = new Exec(search, this.getColumns()); + const s2 = { + search, + included: [], + excluded: [] + }; + const data2 = rebase ? this.data : this.currentData(); + data2.forEach((datum2) => { + if (exec.run(datum2)) { + if (assign2) { + datum2[FieldNames.Selected] = true; + } + s2.included.push(datum2); + } else { + s2.excluded.push(datum2); + } + }); + return s2; } deselect() { - this.deactivate(); - this.data.forEach((datum)=>{ - delete datum[(0, _sanddanceSpecs.FieldNames).Selected]; - }); - this.selection = null; + this.deactivate(); + this.data.forEach((datum2) => { + delete datum2[FieldNames.Selected]; + }); + this.selection = null; } hasFilteredData() { - return !!this.filteredData; + return !!this.filteredData; } hasSelectedData() { - return !!this.selection; + return !!this.selection; } - collapse(collapsed, data = this.data) { - data.forEach((datum)=>{ - datum[(0, _sanddanceSpecs.FieldNames).Collapsed] = collapsed; - }); - this.isCollapsed = collapsed; + collapse(collapsed, data2 = this.data) { + data2.forEach((datum2) => { + datum2[FieldNames.Collapsed] = collapsed; + }); + this.isCollapsed = collapsed; } - activate(datum) { - this.deactivate(); - datum[(0, _sanddanceSpecs.FieldNames).Active] = true; - this.active = datum; + activate(datum2) { + this.deactivate(); + datum2[FieldNames.Active] = true; + this.active = datum2; } deactivate() { - if (this.active) delete this.active[(0, _sanddanceSpecs.FieldNames).Active]; - this.active = null; - } - ordinalIndexWithinSelection(ordinal) { - if (this.selection) for(let i = 0; i < this.selection.included.length; i++){ - const datum = this.selection.included[i]; - if (datum[0, _constants.GL_ORDINAL] === ordinal) return { - datum, - index: i - }; + if (this.active) { + delete this.active[FieldNames.Active]; + } + this.active = null; + } + ordinalIndexWithinSelection(ordinal2) { + if (this.selection) { + for (let i = 0; i < this.selection.included.length; i++) { + const datum2 = this.selection.included[i]; + if (datum2[GL_ORDINAL] === ordinal2) { + return { datum: datum2, index: i }; + } } - return { - datum: null, - index: -1 - }; + } + return { datum: null, index: -1 }; } finalize() { - this.data = null; - this.filteredData = null; - this.filteredColumnsStats = null; - if (this.selection) { - this.selection.excluded = null; - this.selection.included = null; - this.selection = null; - } - } -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","@msrvida/search-expression":"4F93b","@msrvida/sanddance-specs":"aOvSr","./constants":"ix2qh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5q1eU":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Details", ()=>Details); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _defaults = require("./defaults"); -var _constants = require("./constants"); -var _searchExpression = require("@msrvida/search-expression"); -var _util = require("./util"); -var Action; -(function(Action) { - Action[Action["deselect"] = 0] = "deselect"; - Action[Action["isolate"] = 1] = "isolate"; - Action[Action["exclude"] = 2] = "exclude"; - Action[Action["reset"] = 3] = "reset"; - Action[Action["next"] = 4] = "next"; - Action[Action["previous"] = 5] = "previous"; -})(Action || (Action = {})); -class Details { - constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps){ - this.language = language; - this.animator = animator; - this.dataScope = dataScope; - this.colorMapHandler = colorMapHandler; - this.hasColorMaps = hasColorMaps; - this.element = (0, _vegaMorphcharts.util).addDiv(parentElement, `${(0, _defaults.cssPrefix)}unitControls`); - this.clear(); + this.data = null; + this.filteredData = null; + this.filteredColumnsStats = null; + if (this.selection) { + this.selection.excluded = null; + this.selection.included = null; + this.selection = null; + } + } + }; + var Action; + (function(Action2) { + Action2[Action2["deselect"] = 0] = "deselect"; + Action2[Action2["isolate"] = 1] = "isolate"; + Action2[Action2["exclude"] = 2] = "exclude"; + Action2[Action2["reset"] = 3] = "reset"; + Action2[Action2["next"] = 4] = "next"; + Action2[Action2["previous"] = 5] = "previous"; + })(Action || (Action = {})); + class Details { + constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps) { + this.language = language; + this.animator = animator; + this.dataScope = dataScope; + this.colorMapHandler = colorMapHandler; + this.hasColorMaps = hasColorMaps; + this.element = addDiv(parentElement, `${cssPrefix}unitControls`); + this.clear(); } finalize() { - if (this.element) this.element.innerHTML = ''; - this.dataScope = null; - this.element = null; + if (this.element) + this.element.innerHTML = ""; + this.dataScope = null; + this.element = null; } clear() { - this.state = { - userSelection: null, - index: -1, - remapColor: false - }; - this.render(); + this.state = { + userSelection: null, + index: -1, + remapColor: false + }; + this.render(); } clearSelection() { - this.state.userSelection = null; - this.state.index = -1; - this.render(); - } - populate(userSelection, index = 0) { - this.state.userSelection = userSelection; - this.state.index = index; - this.render(); - } - selectByNameValue(columnName, value) { - const search = { - name: columnName, - operator: '==', - value - }; - this.clearSelection(); - this.animator.select(search); - this.populate(this.dataScope.selection); + this.state.userSelection = null; + this.state.index = -1; + this.render(); + } + populate(userSelection, index2 = 0) { + this.state.userSelection = userSelection; + this.state.index = index2; + this.render(); + } + selectByNameValue(columnName, value2) { + const search = { + name: columnName, + operator: "==", + value: value2 + }; + this.clearSelection(); + this.animator.select(search); + this.populate(this.dataScope.selection); } remapChanged(remap) { - this.state.remapColor = remap; - this.colorMapHandler(remap); - this.render(); + this.state.remapColor = remap; + this.colorMapHandler(remap); + this.render(); } handleAction(action) { - let p; - const u = this.state.userSelection; - switch(action){ - case Action.deselect: - this.clearSelection(); - p = this.animator.deselect(); - break; - case Action.exclude: - this.clearSelection(); - p = this.animator.filter((0, _searchExpression.invert)(u.search), u.excluded, u.included, false); - this.state.remapColor = false; - break; - case Action.isolate: - this.clearSelection(); - p = this.animator.filter(u.search, u.included, u.excluded, false); - this.state.remapColor = false; - break; - case Action.reset: - this.clear(); - p = this.animator.reset(); - break; - default: - switch(action){ - case Action.previous: - this.state.index--; - if (this.state.index < 0) this.state.index = this.state.userSelection.included.length - 1; - break; - case Action.next: - this.state.index++; - if (this.state.index >= this.state.userSelection.included.length) this.state.index = 0; - break; - } - this.render(); - p = this.animator.activate(this.state.userSelection.included[this.state.index]); + let p; + const u2 = this.state.userSelection; + switch (action) { + case Action.deselect: { + this.clearSelection(); + p = this.animator.deselect(); + break; + } + case Action.exclude: { + this.clearSelection(); + p = this.animator.filter(invert$2(u2.search), u2.excluded, u2.included, false); + this.state.remapColor = false; + break; + } + case Action.isolate: { + this.clearSelection(); + p = this.animator.filter(u2.search, u2.included, u2.excluded, false); + this.state.remapColor = false; + break; + } + case Action.reset: { + this.clear(); + p = this.animator.reset(); + break; } - p.then(()=>this.render()); + default: { + switch (action) { + case Action.previous: { + this.state.index--; + if (this.state.index < 0) { + this.state.index = this.state.userSelection.included.length - 1; + } + break; + } + case Action.next: { + this.state.index++; + if (this.state.index >= this.state.userSelection.included.length) { + this.state.index = 0; + } + break; + } + } + this.render(); + p = this.animator.activate(this.state.userSelection.included[this.state.index]); + } + } + p.then(() => this.render()); } render() { - const hasRefinedData = this.dataScope.hasFilteredData(); - const renderProps = { - language: this.language, - actionHandler: (action)=>this.handleAction(action), - selectionHandler: (columnName, value)=>this.selectByNameValue(columnName, value), - count: this.state.userSelection && this.state.userSelection.included.length, - hasRefinedData, - item: this.state.userSelection && this.state.userSelection.included[this.state.index], - remapColorHandler: (remap)=>this.remapChanged(remap), - hasColorMaps: this.hasColorMaps() && hasRefinedData, - remapColor: this.state.remapColor - }; - const a = _vegaMorphcharts.util.getActiveElementInfo(); - _vegaMorphcharts.util.mount(renderDetails(renderProps), this.element); - _vegaMorphcharts.util.setActiveElement(a); + const hasRefinedData = this.dataScope.hasFilteredData(); + const renderProps = { + language: this.language, + actionHandler: (action) => this.handleAction(action), + selectionHandler: (columnName, value2) => this.selectByNameValue(columnName, value2), + count: this.state.userSelection && this.state.userSelection.included.length, + hasRefinedData, + item: this.state.userSelection && this.state.userSelection.included[this.state.index], + remapColorHandler: (remap) => this.remapChanged(remap), + hasColorMaps: this.hasColorMaps() && hasRefinedData, + remapColor: this.state.remapColor + }; + const a2 = getActiveElementInfo(); + mount(renderDetails(renderProps), this.element); + setActiveElement(a2); } -} -const renderDetails = (props)=>{ + } + const renderDetails = (props) => { const controlButtons = [ - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.deselect) - }, props.language.deselect), - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.isolate) - }, props.language.isolate), - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.exclude) - }, props.language.exclude) + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.deselect) }, props.language.deselect), + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.isolate) }, props.language.isolate), + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.exclude) }, props.language.exclude) ]; - const colorMapping = _vegaMorphcharts.util.createElement("div", null, _vegaMorphcharts.util.createElement("button", { - disabled: props.remapColor, - onClick: (e)=>props.remapColorHandler(true) - }, props.language.newColorMap), _vegaMorphcharts.util.createElement("button", { - disabled: !props.remapColor, - onClick: (e)=>props.remapColorHandler(false) - }, props.language.oldColorMap)); + const colorMapping2 = createElement( + "div", + null, + createElement("button", { disabled: props.remapColor, onClick: (e) => props.remapColorHandler(true) }, props.language.newColorMap), + createElement("button", { disabled: !props.remapColor, onClick: (e) => props.remapColorHandler(false) }, props.language.oldColorMap) + ); const singleItem = props.count === 1; const scrollButtons = [ - _vegaMorphcharts.util.createElement("button", { - disabled: singleItem, - onClick: (e)=>props.actionHandler(Action.previous) - }, props.language.previousDetail), - _vegaMorphcharts.util.createElement("button", { - disabled: singleItem, - onClick: (e)=>props.actionHandler(Action.next) - }, props.language.nextDetail), - _vegaMorphcharts.util.createElement("span", null, " ", props.language.selectionCount(props.count)) + createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.previous) }, props.language.previousDetail), + createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.next) }, props.language.nextDetail), + createElement( + "span", + null, + " ", + props.language.selectionCount(props.count) + ) ]; const rows = []; - for(const prop in props.item){ - if (prop === (0, _constants.GL_ORDINAL)) continue; - if ((0, _util.isInternalFieldName)(prop)) continue; - rows.push({ - cells: [ - { - content: prop - }, - { - content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) - } - ] - }); - } - return _vegaMorphcharts.util.createElement("div", null, props.hasColorMaps && colorMapping, _vegaMorphcharts.util.createElement("h4", null, props.language.headers.selection), _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}selection` - }, controlButtons, _vegaMorphcharts.util.createElement("button", { - disabled: !props.hasRefinedData, - onClick: (e)=>props.actionHandler(Action.reset) - }, "reset")), props.item && _vegaMorphcharts.util.createElement("h4", null, props.language.headers.details), _vegaMorphcharts.util.createElement("div", null, _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}details-scroll` - }, props.item && scrollButtons), _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}details` - }, props.item && _vegaMorphcharts.util.createElement((0, _vegaMorphcharts.controls).Table, { - rows: rows - })))); -}; -function linkSelect(language, columnName, value, selectionHandler) { - return _vegaMorphcharts.util.createElement("span", null, _vegaMorphcharts.util.createElement("a", { - href: "#", - onClick: (e)=>selectionHandler(columnName, value) - }, value), isNaN(value) ? [ - ' ', - _vegaMorphcharts.util.createElement("a", { - className: "bing-search", - href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`, - target: "_blank" - }, language.bing) - ] : ''); -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","./defaults":"7bMd0","./constants":"ix2qh","@msrvida/search-expression":"4F93b","./util":"g08sL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOtA3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ensureHeaders", ()=>ensureHeaders); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -function ensureHeaders(presenter, headers) { - const vegaControls = presenter.getElement((0, _vegaMorphcharts.PresenterElement).vegaControls); - conditionalHeader(!!vegaControls.querySelectorAll('.vega-bindings > *').length, vegaControls, headers.chart); - const legend = presenter.getElement((0, _vegaMorphcharts.PresenterElement).legend); - conditionalHeader(!!legend.children.length, legend, headers.legend); -} -function conditionalHeader(condition, element, header) { - const existing = existingHeader(element, header); - if (condition && !existing) addHeader(element, header); - if (!condition && existing) existing.remove(); -} -function addHeader(element, header) { - const h = document.createElement('h4'); - h.innerHTML = header; - element.insertAdjacentElement('beforebegin', h); -} -function existingHeader(element, header) { - const { previousElementSibling } = element; - if (previousElementSibling && previousElementSibling.innerHTML === header) return previousElementSibling; -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"buMaw":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "finalizeLegend", ()=>finalizeLegend); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _expression = require("./expression"); -function legendRange(colorBinType, column, legend, clickedIndex) { - if (column.quantitative) return selectQuantitative(colorBinType, column, legend, clickedIndex); - else return selectCategorical(column, legend, clickedIndex); -} -function selectCategorical(column, legend, clickedIndex) { - const value = legend.rows[clickedIndex].value; - if (value === (0, _sanddanceSpecs.Other)) { - const values = []; - for(const i in legend.rows)if (+i !== clickedIndex) values.push(legend.rows[i].value); - return (0, _expression.selectNone)(column, values); - } else //select equal - return { - expressions: [ - (0, _expression.selectExact)(column, legend.rows[clickedIndex].value) + for (const prop in props.item) { + if (prop === GL_ORDINAL) { + continue; + } + if (isInternalFieldName(prop)) { + continue; + } + rows.push({ + cells: [ + { content: prop }, + { content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) } ] - }; -} -function selectQuantitative(colorBinType, column, legend, clickedIndex) { - const keys = Object.keys(legend.rows).map((key)=>+key).sort((a, b)=>+a - +b); + }); + } + return createElement( + "div", + null, + props.hasColorMaps && colorMapping2, + createElement("h4", null, props.language.headers.selection), + createElement( + "div", + { className: `${cssPrefix}selection` }, + controlButtons, + createElement("button", { disabled: !props.hasRefinedData, onClick: (e) => props.actionHandler(Action.reset) }, "reset") + ), + props.item && createElement("h4", null, props.language.headers.details), + createElement( + "div", + null, + createElement("div", { className: `${cssPrefix}details-scroll` }, props.item && scrollButtons), + createElement("div", { className: `${cssPrefix}details` }, props.item && createElement(Table$1, { rows })) + ) + ); + }; + function linkSelect(language, columnName, value2, selectionHandler) { + return createElement( + "span", + null, + createElement("a", { href: "#", onClick: (e) => selectionHandler(columnName, value2) }, value2), + isNaN(value2) ? [" ", createElement("a", { className: "bing-search", href: `https://www.bing.com/search?q=${encodeURIComponent(value2)}`, target: "_blank" }, language.bing)] : "" + ); + } + function ensureHeaders(presenter, headers) { + const vegaControls = presenter.getElement(PresenterElement$1.vegaControls); + conditionalHeader(!!vegaControls.querySelectorAll(".vega-bindings > *").length, vegaControls, headers.chart); + const legend2 = presenter.getElement(PresenterElement$1.legend); + conditionalHeader(!!legend2.children.length, legend2, headers.legend); + } + function conditionalHeader(condition, element2, header) { + const existing = existingHeader(element2, header); + if (condition && !existing) { + addHeader(element2, header); + } + if (!condition && existing) { + existing.remove(); + } + } + function addHeader(element2, header) { + const h2 = document.createElement("h4"); + h2.innerHTML = header; + element2.insertAdjacentElement("beforebegin", h2); + } + function existingHeader(element2, header) { + const { previousElementSibling } = element2; + if (previousElementSibling && previousElementSibling.innerHTML === header) { + return previousElementSibling; + } + } + function legendRange(colorBinType, column, legend2, clickedIndex) { + if (column.quantitative) { + return selectQuantitative(colorBinType, column, legend2, clickedIndex); + } else { + return selectCategorical(column, legend2, clickedIndex); + } + } + function selectCategorical(column, legend2, clickedIndex) { + const value2 = legend2.rows[clickedIndex].value; + if (value2 === Other) { + const values2 = []; + for (const i in legend2.rows) { + if (+i !== clickedIndex) { + values2.push(legend2.rows[i].value); + } + } + return selectNone(column, values2); + } else { + return { expressions: [selectExact(column, legend2.rows[clickedIndex].value)] }; + } + } + function selectQuantitative(colorBinType, column, legend2, clickedIndex) { + const keys2 = Object.keys(legend2.rows).map((key2) => +key2).sort((a2, b2) => +a2 - +b2); let lowValue; let lowOperator; let highValue; let highOperator; - const rowText = legend.rows[clickedIndex].label; - switch(colorBinType){ - case 'continuous': - lowValue = rowText; - if (clickedIndex < keys.length - 1) highValue = legend.rows[clickedIndex + 1].value; - break; - default: - { - if (rowText.indexOf('null') > 0) { - const ex = { - expressions: [ - (0, _expression.selectNullOrEmpty)(column) - ] - }; - return ex; - } - const dash = rowText.indexOf("\u2013"); //this is not the common dash character! - if (dash > 0) { - //bug in Vega for quantize? - //lowOperator = '>'; - //highOperator = '<='; - lowValue = rowText.substr(0, dash); - highValue = rowText.substr(dash + 1); - } else { - if (rowText.indexOf('<') >= 0) highValue = rowText.substring(2); - else if (rowText.indexOf("\u2265") >= 0) lowValue = rowText.substring(2); - } + const rowText = legend2.rows[clickedIndex].label; + switch (colorBinType) { + case "continuous": { + lowValue = rowText; + if (clickedIndex < keys2.length - 1) { + highValue = legend2.rows[clickedIndex + 1].value; + } + break; + } + default: { + if (rowText.indexOf("null") > 0) { + const ex = { + expressions: [selectNullOrEmpty(column)] + }; + return ex; + } + const dash = rowText.indexOf("–"); + if (dash > 0) { + lowValue = rowText.substr(0, dash); + highValue = rowText.substr(dash + 1); + } else { + if (rowText.indexOf("<") >= 0) { + highValue = rowText.substring(2); + } else { + if (rowText.indexOf("≥") >= 0) { + lowValue = rowText.substring(2); } + } + } + } } - if (lowValue) lowValue = (0, _expression.notNice)(lowValue); - if (highValue) highValue = (0, _expression.notNice)(highValue); - if (lowValue === highValue) return { - expressions: [ - (0, _expression.selectExact)(column, lowValue) - ] - }; - else return (0, _expression.selectBetween)(column, lowValue, highValue, lowOperator, highOperator); -} -function finalizeLegend(colorBinType, colorColumn, legend, language) { + if (lowValue) + lowValue = notNice(lowValue); + if (highValue) + highValue = notNice(highValue); + if (lowValue === highValue) { + return { expressions: [selectExact(column, lowValue)] }; + } else { + return selectBetween(column, lowValue, highValue, lowOperator, highOperator); + } + } + function finalizeLegend(colorBinType, colorColumn, legend2, language) { const rowTexts = []; - for(const i in legend.rows){ - const row = legend.rows[i]; - row.search = legendRange(colorBinType, colorColumn, legend, +i); - if (row.value === (0, _sanddanceSpecs.Other)) row.label = language.legendOther; - else rowTexts.push(row.value); - } -} - -},{"@msrvida/sanddance-specs":"aOvSr","./expression":"2foo2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eRzwB":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assignOrdinals", ()=>assignOrdinals); -parcelHelpers.export(exports, "getDataIndexOfCube", ()=>getDataIndexOfCube); -var _constants = require("./constants"); -function assignOrdinals(columns, data, ordinalMap) { + for (const i in legend2.rows) { + const row = legend2.rows[i]; + row.search = legendRange(colorBinType, colorColumn, legend2, +i); + if (row.value === Other) { + row.label = language.legendOther; + } else { + rowTexts.push(row.value); + } + } + } + function assignOrdinals(columns, data2, ordinalMap) { const uCol = columns.uid && columns.uid.name; - if (ordinalMap) data.forEach((d, i)=>{ - const key = uCol ? d[uCol] : i; - d[0, _constants.GL_ORDINAL] = ordinalMap[key]; - }); - else { - ordinalMap = {}; - data.forEach((d, i)=>{ - d[0, _constants.GL_ORDINAL] = i; - const uColValue = uCol ? d[uCol] : i; - ordinalMap[uColValue] = i; - }); + if (ordinalMap) { + data2.forEach((d2, i) => { + const key2 = uCol ? d2[uCol] : i; + d2[GL_ORDINAL] = ordinalMap[key2]; + }); + } else { + ordinalMap = {}; + data2.forEach((d2, i) => { + d2[GL_ORDINAL] = i; + const uColValue = uCol ? d2[uCol] : i; + ordinalMap[uColValue] = i; + }); } return ordinalMap; -} -function getDataIndexOfCube(cube, data) { - const len = data.length; - for(let i = 0; i < len; i++){ - if (data[i][0, _constants.GL_ORDINAL] === cube.ordinal) return i; - } -} - -},{"./constants":"ix2qh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6kluJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSearchGroupFromVegaValue", ()=>getSearchGroupFromVegaValue); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _array = require("./array"); -function getSearchGroupFromVegaValue(search) { - let group; + } + function getDataIndexOfCube(cube, data2) { + const len2 = data2.length; + for (let i = 0; i < len2; i++) { + if (data2[i][GL_ORDINAL] === cube.ordinal) { + return i; + } + } + } + const { push } = util$4; + function getSearchGroupFromVegaValue(search) { + let group2; const vegaSearch = search; if (Array.isArray(vegaSearch)) { - //flatten into one group - group = { - expressions: [] - }; - vegaSearch.forEach((g)=>{ - const clonedExpressions = _vegaMorphcharts.util.clone(g.expressions).filter(Boolean); - clonedExpressions[0].clause = '&&'; - (0, _array.push)(group.expressions, clonedExpressions); - }); - } else group = vegaSearch ? { - expressions: vegaSearch.expressions.filter(Boolean) - } : null; - return group; -} - -},{"@msrvida/vega-morphcharts":"9Sd5M","./array":"cis83","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cis83":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "allTruthy", ()=>allTruthy); -parcelHelpers.export(exports, "concat", ()=>concat); -parcelHelpers.export(exports, "push", ()=>push); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -const { allTruthy, concat, push } = (0, _vegaMorphcharts.util); - -},{"@msrvida/vega-morphcharts":"9Sd5M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"xDtCn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applySignalValues", ()=>applySignalValues); -parcelHelpers.export(exports, "extractSignalValuesFromView", ()=>extractSignalValuesFromView); -parcelHelpers.export(exports, "unbindSignalUI", ()=>unbindSignalUI); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -function applySignalValues(sv, b) { - if (!sv || !b || !b.signals || !b.signals.length) return; - for(const key in sv){ - const value = sv[key]; - const signalB = b.signals.filter((signal)=>signal.name === key)[0]; - if (signalB && signalB.bind) signalB.value = value; - } -} -function extractSignalValuesFromView(view, spec) { - if (!view || !spec || !spec.signals || !spec.signals.length) return; + group2 = { expressions: [] }; + vegaSearch.forEach((g) => { + const clonedExpressions = clone(g.expressions).filter(Boolean); + clonedExpressions[0].clause = "&&"; + push(group2.expressions, clonedExpressions); + }); + } else { + group2 = vegaSearch ? { expressions: vegaSearch.expressions.filter(Boolean) } : null; + } + return group2; + } + function applySignalValues(sv, b2) { + if (!sv || !b2 || !b2.signals || !b2.signals.length) + return; + for (const key2 in sv) { + const value2 = sv[key2]; + const signalB = b2.signals.filter((signal) => signal.name === key2)[0]; + if (signalB && signalB.bind) { + signalB.value = value2; + } + } + } + function extractSignalValuesFromView(view, spec) { + if (!view || !spec || !spec.signals || !spec.signals.length) + return; const result = {}; - spec.signals.forEach((signalA)=>{ - //bound to a UI control - if (signalA.bind) try { - result[signalA.name] = view.signal(signalA.name); + spec.signals.forEach((signalA) => { + if (signalA.bind) { + try { + result[signalA.name] = view.signal(signalA.name); } catch (e) { - // continue regardless of error } + } }); return result; -} -//signals not capable of handling with MorphCharts -const hideSignalUI = [ - (0, _sanddanceSpecs.SignalNames).MarkOpacity, - (0, _sanddanceSpecs.SignalNames).TextAngleX, - (0, _sanddanceSpecs.SignalNames).TextAngleY -]; -function unbindSignalUI(spec) { - spec.signals.forEach((signal)=>{ - if (hideSignalUI.indexOf(signal.name) >= 0) delete signal.bind; + } + const hideSignalUI = [ + SignalNames.MarkOpacity, + SignalNames.TextAngleX, + SignalNames.TextAngleY + ]; + function unbindSignalUI(spec) { + spec.signals.forEach((signal) => { + if (hideSignalUI.indexOf(signal.name) >= 0) { + delete signal.bind; + } }); -} - -},{"@msrvida/sanddance-specs":"aOvSr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bKbCn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Tooltip", ()=>Tooltip); -parcelHelpers.export(exports, "cleanDataItem", ()=>cleanDataItem); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _constants = require("./constants"); -var _util = require("./util"); -const { outerSize } = _vegaMorphcharts.util; -const { Table } = _vegaMorphcharts.controls; -class Tooltip { - constructor(props){ - this.props = props; - const renderProps = { - cssPrefix: props.cssPrefix, - rows: getRows(props.dataItem) - }; - this.finalizeHandler = ()=>this.destroy(); - this.element = renderTooltip(renderProps); - if (this.element) { - this.element.style.position = 'absolute'; - this.child = this.element.firstChild; - document.body.appendChild(this.element); - //measure and move as necessary - let m = outerSize(this.child); - while(m.height > document.documentElement.clientHeight){ - const tr = this.child.querySelector('tr:last-child'); - if (tr) tr.parentElement.removeChild(tr); - else break; - m = outerSize(this.child); - } - let position; - const te = props.event; - if (te.touches) position = te[0]; - else { - const pme = props.event; - position = pme; - } - if (position.clientX + m.width >= document.documentElement.clientWidth) this.child.style.right = '0'; - let moveTop = true; - if (position.clientY + m.height >= document.documentElement.clientHeight) { - if (position.clientY - m.height > 0) this.child.style.bottom = '0'; - else moveTop = false; - } - if (moveTop) this.element.style.top = `${position.clientY}px`; - this.element.style.left = `${position.clientX}px`; - this.child.addEventListener('mouseenter', this.finalizeHandler); - this.child.addEventListener('mousemove', this.finalizeHandler); - this.child.addEventListener('mouseover', this.finalizeHandler); + } + const { outerSize } = util$4; + const { Table } = controls; + let Tooltip$1 = class Tooltip { + constructor(props) { + this.props = props; + const renderProps = { + cssPrefix: props.cssPrefix, + rows: getRows(props.dataItem) + }; + this.finalizeHandler = () => this.destroy(); + this.element = renderTooltip(renderProps); + if (this.element) { + this.element.style.position = "absolute"; + this.child = this.element.firstChild; + document.body.appendChild(this.element); + let m2 = outerSize(this.child); + while (m2.height > document.documentElement.clientHeight) { + const tr2 = this.child.querySelector("tr:last-child"); + if (tr2) { + tr2.parentElement.removeChild(tr2); + } else { + break; + } + m2 = outerSize(this.child); } + let position2; + const te = props.event; + if (te.touches) { + position2 = te[0]; + } else { + const pme = props.event; + position2 = pme; + } + if (position2.clientX + m2.width >= document.documentElement.clientWidth) { + this.child.style.right = "0"; + } + let moveTop = true; + if (position2.clientY + m2.height >= document.documentElement.clientHeight) { + if (position2.clientY - m2.height > 0) { + this.child.style.bottom = "0"; + } else { + moveTop = false; + } + } + if (moveTop) { + this.element.style.top = `${position2.clientY}px`; + } + this.element.style.left = `${position2.clientX}px`; + this.child.addEventListener("mouseenter", this.finalizeHandler); + this.child.addEventListener("mousemove", this.finalizeHandler); + this.child.addEventListener("mouseover", this.finalizeHandler); + } } destroy() { - this.child.removeEventListener('mouseenter', this.finalizeHandler); - this.child.removeEventListener('mousemove', this.finalizeHandler); - this.child.removeEventListener('mouseover', this.finalizeHandler); - if (this.element) document.body.removeChild(this.element); - this.element = null; - } -} -function cleanDataItem(item) { - const ret = {}; - for(const columnName in item){ - if (columnName === (0, _constants.GL_ORDINAL)) continue; - if ((0, _util.isInternalFieldName)(columnName)) continue; - ret[columnName] = item[columnName]; - } - return ret; -} -function getRows(item) { - const rows = []; - for(const columnName in item){ - const value = item[columnName]; - let content; - switch(value){ - case null: - content = _vegaMorphcharts.util.createElement("i", null, "null"); - break; - case undefined: - content = _vegaMorphcharts.util.createElement("i", null, "undefined"); - break; - default: - content = value.toString(); - } - //} - rows.push({ - cells: [ - { - content: columnName + ':' - }, - { - content - } - ] - }); - } - return rows; -} -const renderTooltip = (props)=>{ - return props.rows.length === 0 ? null : _vegaMorphcharts.util.createElement("div", { - className: `${props.cssPrefix}tooltip` - }, Table({ - rows: props.rows - })); -}; - -},{"@msrvida/vega-morphcharts":"9Sd5M","./constants":"ix2qh","./util":"g08sL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"grMul":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CharacterSet", ()=>CharacterSet); -class CharacterSet { - resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { - if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) this.chars = undefined; - } - getCharacterSet(stage) { - if (!this.chars) { - const map = {}; - const addText = (text)=>{ - Array.from(text).forEach((char)=>{ - map[char] = true; - }); - }; - stage.textData.forEach((t)=>addText(t.text)); - const { x, y } = stage.axes; - [ - x, - y - ].forEach((axes)=>{ - axes.forEach((axis)=>{ - if (axis.tickText) axis.tickText.forEach((t)=>addText(t.text)); - if (axis.title) addText(axis.title.text); - }); - }); - this.chars = Object.keys(map); - } - return this.chars; - } -} -function needsNewCharacterSet(oldInsight, newInsight) { - if (!oldInsight) return true; - if (!newInsight) return true; - if (oldInsight.chart !== newInsight.chart) return true; - if (oldInsight.facetStyle !== newInsight.facetStyle) return true; - if (oldInsight.totalStyle !== newInsight.totalStyle) return true; - if (oldInsight.hideAxes !== newInsight.hideAxes) return true; - if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) return true; - if (differentObjectValues(oldInsight.size, newInsight.size)) return true; - const oldColumns = oldInsight.columns; - const newColumns = newInsight.columns; - if (oldColumns.facet !== newColumns.facet) return true; - if (oldColumns.facetV !== newColumns.facetV) return true; - if (oldColumns.x !== newColumns.x) return true; - if (oldColumns.y !== newColumns.y) return true; - if (oldColumns.z !== newColumns.z) return true; - return false; -} -function differentObjectValues(a, b) { - if (!a && !b) return false; - if (!a || !b) return true; - const keys = Object.keys(b); - for(let i = 0; i < keys.length; i++){ - const key = keys[i]; - const ta = typeof a; - const tb = typeof b; - if (ta !== tb) return true; - if (ta === 'object') return differentObjectValues(a[key], b[key]); - else { - if (a[key] !== b[key]) return true; - } + this.child.removeEventListener("mouseenter", this.finalizeHandler); + this.child.removeEventListener("mousemove", this.finalizeHandler); + this.child.removeEventListener("mouseover", this.finalizeHandler); + if (this.element) { + document.body.removeChild(this.element); + } + this.element = null; } - return false; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fNWAw":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assignTransitionStagger", ()=>assignTransitionStagger); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _d3Scale = require("d3-scale"); -var _constants = require("./constants"); -function assignTransitionStagger(transition, currentData, selection, presenter) { - const { layerStagger } = presenter.morphchartsref; - const { morphChartsRenderResult } = presenter; - const cubelayer = morphChartsRenderResult.getCubeLayer(); - const range = transition.reverse ? [ - 1, - 0 - ] : [ - 0, - 1 - ]; - if (!transition || transition.type === 'ordinal' && !transition.reverse) delete layerStagger.cubes; - else { - const staggerOrders = new Float64Array(cubelayer.positionsX.length); - switch(transition.type){ - case 'ordinal': - { - //reverse ordinal - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - 0, - currentData.length - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(i); - }); - break; - } - case 'column': - if (transition.column.quantitative) { - const values = new Float64Array(currentData.length); - currentData.forEach((datum, i)=>{ - values[i] = datum[transition.column.name]; - }); - const stats = (0, _sanddanceSpecs.getStats)(currentData, transition.column); - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - stats.min, - stats.max - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(values[i]); - }); - } else { - const strings = new Array(currentData.length); - currentData.forEach((datum, i)=>{ - strings[i] = datum[transition.column.name]; - }); - (0, _sanddanceSpecs.getStats)(currentData, transition.column, (distictValues)=>{ - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - const index = distictValues.indexOf(strings[i]); - const staggerOrder = index / distictValues.length; - staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; - }); - }); - } - break; - case 'position': - { - const dimensions = { - x: cubelayer.positionsX, - y: cubelayer.positionsY, - z: cubelayer.positionsZ - }; - const positions = dimensions[transition.dimension]; - const values = new Float64Array(currentData.length); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - values[i] = positions[glOrdinal]; - }); - const stats = (0, _sanddanceSpecs.getStats)(values, null, 'number', true); - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - stats.min, - stats.max - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(values[i]); - }); - break; - } - } - layerStagger.cubes = { - staggerOrders, - maxStaggerOrder: 1, - minStaggerOrder: 0 - }; + }; + function cleanDataItem(item) { + const ret = {}; + for (const columnName in item) { + if (columnName === GL_ORDINAL) { + continue; + } + if (isInternalFieldName(columnName)) { + continue; + } + ret[columnName] = item[columnName]; } - cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); -} - -},{"@msrvida/sanddance-specs":"aOvSr","d3-scale":"1PRVx","./constants":"ix2qh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1PRVx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleBand", ()=>(0, _bandJsDefault.default)); -parcelHelpers.export(exports, "scalePoint", ()=>(0, _bandJs.point)); -parcelHelpers.export(exports, "scaleIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "scaleLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "scaleLog", ()=>(0, _logJsDefault.default)); -parcelHelpers.export(exports, "scaleSymlog", ()=>(0, _symlogJsDefault.default)); -parcelHelpers.export(exports, "scaleOrdinal", ()=>(0, _ordinalJsDefault.default)); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _ordinalJs.implicit)); -parcelHelpers.export(exports, "scalePow", ()=>(0, _powJsDefault.default)); -parcelHelpers.export(exports, "scaleSqrt", ()=>(0, _powJs.sqrt)); -parcelHelpers.export(exports, "scaleRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "scaleThreshold", ()=>(0, _thresholdJsDefault.default)); -parcelHelpers.export(exports, "scaleTime", ()=>(0, _timeJsDefault.default)); -parcelHelpers.export(exports, "scaleUtc", ()=>(0, _utcTimeJsDefault.default)); -parcelHelpers.export(exports, "scaleSequential", ()=>(0, _sequentialJsDefault.default)); -parcelHelpers.export(exports, "scaleSequentialLog", ()=>(0, _sequentialJs.sequentialLog)); -parcelHelpers.export(exports, "scaleSequentialPow", ()=>(0, _sequentialJs.sequentialPow)); -parcelHelpers.export(exports, "scaleSequentialSqrt", ()=>(0, _sequentialJs.sequentialSqrt)); -parcelHelpers.export(exports, "scaleSequentialSymlog", ()=>(0, _sequentialJs.sequentialSymlog)); -parcelHelpers.export(exports, "scaleSequentialQuantile", ()=>(0, _sequentialQuantileJsDefault.default)); -parcelHelpers.export(exports, "scaleDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "scaleDivergingLog", ()=>(0, _divergingJs.divergingLog)); -parcelHelpers.export(exports, "scaleDivergingPow", ()=>(0, _divergingJs.divergingPow)); -parcelHelpers.export(exports, "scaleDivergingSqrt", ()=>(0, _divergingJs.divergingSqrt)); -parcelHelpers.export(exports, "scaleDivergingSymlog", ()=>(0, _divergingJs.divergingSymlog)); -parcelHelpers.export(exports, "tickFormat", ()=>(0, _tickFormatJsDefault.default)); -var _bandJs = require("./band.js"); -var _bandJsDefault = parcelHelpers.interopDefault(_bandJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _linearJs = require("./linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _logJs = require("./log.js"); -var _logJsDefault = parcelHelpers.interopDefault(_logJs); -var _symlogJs = require("./symlog.js"); -var _symlogJsDefault = parcelHelpers.interopDefault(_symlogJs); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -var _powJs = require("./pow.js"); -var _powJsDefault = parcelHelpers.interopDefault(_powJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _thresholdJs = require("./threshold.js"); -var _thresholdJsDefault = parcelHelpers.interopDefault(_thresholdJs); -var _timeJs = require("./time.js"); -var _timeJsDefault = parcelHelpers.interopDefault(_timeJs); -var _utcTimeJs = require("./utcTime.js"); -var _utcTimeJsDefault = parcelHelpers.interopDefault(_utcTimeJs); -var _sequentialJs = require("./sequential.js"); -var _sequentialJsDefault = parcelHelpers.interopDefault(_sequentialJs); -var _sequentialQuantileJs = require("./sequentialQuantile.js"); -var _sequentialQuantileJsDefault = parcelHelpers.interopDefault(_sequentialQuantileJs); -var _divergingJs = require("./diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); - -},{"./band.js":"a1xEx","./identity.js":"e07Nz","./linear.js":"ik2PQ","./log.js":"5BBe1","./symlog.js":"26cMO","./ordinal.js":"cg12q","./pow.js":"ah9R8","./radial.js":"eL6SH","./quantile.js":"ENbdr","./quantize.js":"4Cxz6","./threshold.js":"lQqvO","./time.js":"dtq1F","./utcTime.js":"iLPRP","./sequential.js":"e0eA3","./sequentialQuantile.js":"i0IcB","./diverging.js":"6Pqcc","./tickFormat.js":"fHwUM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a1xEx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>band); -parcelHelpers.export(exports, "point", ()=>point); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -function band() { - var scale = (0, _ordinalJsDefault.default)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1; - step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); - var values = (0, _d3Array.range)(n).map(function(i) { - return start + step * i; + return ret; + } + function getRows(item) { + const rows = []; + for (const columnName in item) { + const value2 = item[columnName]; + let content2; + switch (value2) { + case null: + content2 = createElement("i", null, "null"); + break; + case void 0: + content2 = createElement("i", null, "undefined"); + break; + default: + content2 = value2.toString(); + } + rows.push({ + cells: [ + { content: columnName + ":" }, + { content: content2 } + ] + }); + } + return rows; + } + const renderTooltip = (props) => { + return props.rows.length === 0 ? null : createElement("div", { className: `${props.cssPrefix}tooltip` }, Table({ rows: props.rows })); + }; + class CharacterSet { + resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { + if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) { + this.chars = void 0; + } + } + getCharacterSet(stage) { + if (!this.chars) { + const map2 = {}; + const addText = (text2) => { + Array.from(text2).forEach((char) => { + map2[char] = true; + }); + }; + stage.textData.forEach((t) => addText(t.text)); + const { x: x2, y: y2 } = stage.axes; + [x2, y2].forEach((axes) => { + axes.forEach((axis) => { + if (axis.tickText) + axis.tickText.forEach((t) => addText(t.text)); + if (axis.title) + addText(axis.title.text); + }); }); - return ordinalRange(reverse ? values.reverse() : values); + this.chars = Object.keys(map2); + } + return this.chars; } - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.range = function(_) { - return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [ - r0, - r1 - ]; - }; - scale.rangeRound = function(_) { - return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale(); - }; - scale.bandwidth = function() { - return bandwidth; - }; - scale.step = function() { - return step; - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, rescale()) : round; - }; - scale.padding = function(_) { - return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner; - }; - scale.paddingInner = function(_) { - return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner; - }; - scale.paddingOuter = function(_) { - return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter; - }; - scale.align = function(_) { - return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; - }; - scale.copy = function() { - return band(domain(), [ - r0, - r1 - ]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - return (0, _initJs.initRange).apply(rescale(), arguments); -} -function pointish(scale) { - var copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - delete scale.paddingOuter; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band.apply(null, arguments).paddingInner(1)); -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","./ordinal.js":"cg12q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5lCYW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisect", ()=>(0, _bisectJsDefault.default)); -parcelHelpers.export(exports, "bisectRight", ()=>(0, _bisectJs.bisectRight)); -parcelHelpers.export(exports, "bisectLeft", ()=>(0, _bisectJs.bisectLeft)); -parcelHelpers.export(exports, "bisectCenter", ()=>(0, _bisectJs.bisectCenter)); -parcelHelpers.export(exports, "ascending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "bisector", ()=>(0, _bisectorJsDefault.default)); -parcelHelpers.export(exports, "blur", ()=>(0, _blurJs.blur)); -parcelHelpers.export(exports, "blur2", ()=>(0, _blurJs.blur2)); -parcelHelpers.export(exports, "blurImage", ()=>(0, _blurJs.blurImage)); -parcelHelpers.export(exports, "count", ()=>(0, _countJsDefault.default)); -parcelHelpers.export(exports, "cross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "cumsum", ()=>(0, _cumsumJsDefault.default)); -parcelHelpers.export(exports, "descending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "deviation", ()=>(0, _deviationJsDefault.default)); -parcelHelpers.export(exports, "extent", ()=>(0, _extentJsDefault.default)); -parcelHelpers.export(exports, "Adder", ()=>(0, _fsumJs.Adder)); -parcelHelpers.export(exports, "fsum", ()=>(0, _fsumJs.fsum)); -parcelHelpers.export(exports, "fcumsum", ()=>(0, _fsumJs.fcumsum)); -parcelHelpers.export(exports, "group", ()=>(0, _groupJsDefault.default)); -parcelHelpers.export(exports, "flatGroup", ()=>(0, _groupJs.flatGroup)); -parcelHelpers.export(exports, "flatRollup", ()=>(0, _groupJs.flatRollup)); -parcelHelpers.export(exports, "groups", ()=>(0, _groupJs.groups)); -parcelHelpers.export(exports, "index", ()=>(0, _groupJs.index)); -parcelHelpers.export(exports, "indexes", ()=>(0, _groupJs.indexes)); -parcelHelpers.export(exports, "rollup", ()=>(0, _groupJs.rollup)); -parcelHelpers.export(exports, "rollups", ()=>(0, _groupJs.rollups)); -parcelHelpers.export(exports, "groupSort", ()=>(0, _groupSortJsDefault.default)); -parcelHelpers.export(exports, "bin", ()=>(0, _binJsDefault.default)) // Deprecated; use bin. -; -parcelHelpers.export(exports, "histogram", ()=>(0, _binJsDefault.default)); -parcelHelpers.export(exports, "thresholdFreedmanDiaconis", ()=>(0, _freedmanDiaconisJsDefault.default)); -parcelHelpers.export(exports, "thresholdScott", ()=>(0, _scottJsDefault.default)); -parcelHelpers.export(exports, "thresholdSturges", ()=>(0, _sturgesJsDefault.default)); -parcelHelpers.export(exports, "max", ()=>(0, _maxJsDefault.default)); -parcelHelpers.export(exports, "maxIndex", ()=>(0, _maxIndexJsDefault.default)); -parcelHelpers.export(exports, "mean", ()=>(0, _meanJsDefault.default)); -parcelHelpers.export(exports, "median", ()=>(0, _medianJsDefault.default)); -parcelHelpers.export(exports, "medianIndex", ()=>(0, _medianJs.medianIndex)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "min", ()=>(0, _minJsDefault.default)); -parcelHelpers.export(exports, "minIndex", ()=>(0, _minIndexJsDefault.default)); -parcelHelpers.export(exports, "mode", ()=>(0, _modeJsDefault.default)); -parcelHelpers.export(exports, "nice", ()=>(0, _niceJsDefault.default)); -parcelHelpers.export(exports, "pairs", ()=>(0, _pairsJsDefault.default)); -parcelHelpers.export(exports, "permute", ()=>(0, _permuteJsDefault.default)); -parcelHelpers.export(exports, "quantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "quantileIndex", ()=>(0, _quantileJs.quantileIndex)); -parcelHelpers.export(exports, "quantileSorted", ()=>(0, _quantileJs.quantileSorted)); -parcelHelpers.export(exports, "quickselect", ()=>(0, _quickselectJsDefault.default)); -parcelHelpers.export(exports, "range", ()=>(0, _rangeJsDefault.default)); -parcelHelpers.export(exports, "rank", ()=>(0, _rankJsDefault.default)); -parcelHelpers.export(exports, "least", ()=>(0, _leastJsDefault.default)); -parcelHelpers.export(exports, "leastIndex", ()=>(0, _leastIndexJsDefault.default)); -parcelHelpers.export(exports, "greatest", ()=>(0, _greatestJsDefault.default)); -parcelHelpers.export(exports, "greatestIndex", ()=>(0, _greatestIndexJsDefault.default)); -parcelHelpers.export(exports, "scan", ()=>(0, _scanJsDefault.default)) // Deprecated; use leastIndex. -; -parcelHelpers.export(exports, "shuffle", ()=>(0, _shuffleJsDefault.default)); -parcelHelpers.export(exports, "shuffler", ()=>(0, _shuffleJs.shuffler)); -parcelHelpers.export(exports, "sum", ()=>(0, _sumJsDefault.default)); -parcelHelpers.export(exports, "ticks", ()=>(0, _ticksJsDefault.default)); -parcelHelpers.export(exports, "tickIncrement", ()=>(0, _ticksJs.tickIncrement)); -parcelHelpers.export(exports, "tickStep", ()=>(0, _ticksJs.tickStep)); -parcelHelpers.export(exports, "transpose", ()=>(0, _transposeJsDefault.default)); -parcelHelpers.export(exports, "variance", ()=>(0, _varianceJsDefault.default)); -parcelHelpers.export(exports, "zip", ()=>(0, _zipJsDefault.default)); -parcelHelpers.export(exports, "every", ()=>(0, _everyJsDefault.default)); -parcelHelpers.export(exports, "some", ()=>(0, _someJsDefault.default)); -parcelHelpers.export(exports, "filter", ()=>(0, _filterJsDefault.default)); -parcelHelpers.export(exports, "map", ()=>(0, _mapJsDefault.default)); -parcelHelpers.export(exports, "reduce", ()=>(0, _reduceJsDefault.default)); -parcelHelpers.export(exports, "reverse", ()=>(0, _reverseJsDefault.default)); -parcelHelpers.export(exports, "sort", ()=>(0, _sortJsDefault.default)); -parcelHelpers.export(exports, "difference", ()=>(0, _differenceJsDefault.default)); -parcelHelpers.export(exports, "disjoint", ()=>(0, _disjointJsDefault.default)); -parcelHelpers.export(exports, "intersection", ()=>(0, _intersectionJsDefault.default)); -parcelHelpers.export(exports, "subset", ()=>(0, _subsetJsDefault.default)); -parcelHelpers.export(exports, "superset", ()=>(0, _supersetJsDefault.default)); -parcelHelpers.export(exports, "union", ()=>(0, _unionJsDefault.default)); -parcelHelpers.export(exports, "InternMap", ()=>(0, _internmap.InternMap)); -parcelHelpers.export(exports, "InternSet", ()=>(0, _internmap.InternSet)); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _blurJs = require("./blur.js"); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _crossJs = require("./cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _cumsumJs = require("./cumsum.js"); -var _cumsumJsDefault = parcelHelpers.interopDefault(_cumsumJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _deviationJs = require("./deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _fsumJs = require("./fsum.js"); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _groupSortJs = require("./groupSort.js"); -var _groupSortJsDefault = parcelHelpers.interopDefault(_groupSortJs); -var _binJs = require("./bin.js"); -var _binJsDefault = parcelHelpers.interopDefault(_binJs); -var _freedmanDiaconisJs = require("./threshold/freedmanDiaconis.js"); -var _freedmanDiaconisJsDefault = parcelHelpers.interopDefault(_freedmanDiaconisJs); -var _scottJs = require("./threshold/scott.js"); -var _scottJsDefault = parcelHelpers.interopDefault(_scottJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _meanJs = require("./mean.js"); -var _meanJsDefault = parcelHelpers.interopDefault(_meanJs); -var _medianJs = require("./median.js"); -var _medianJsDefault = parcelHelpers.interopDefault(_medianJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _modeJs = require("./mode.js"); -var _modeJsDefault = parcelHelpers.interopDefault(_modeJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _pairsJs = require("./pairs.js"); -var _pairsJsDefault = parcelHelpers.interopDefault(_pairsJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _rangeJs = require("./range.js"); -var _rangeJsDefault = parcelHelpers.interopDefault(_rangeJs); -var _rankJs = require("./rank.js"); -var _rankJsDefault = parcelHelpers.interopDefault(_rankJs); -var _leastJs = require("./least.js"); -var _leastJsDefault = parcelHelpers.interopDefault(_leastJs); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -var _greatestIndexJs = require("./greatestIndex.js"); -var _greatestIndexJsDefault = parcelHelpers.interopDefault(_greatestIndexJs); -var _scanJs = require("./scan.js"); -var _scanJsDefault = parcelHelpers.interopDefault(_scanJs); -var _shuffleJs = require("./shuffle.js"); -var _shuffleJsDefault = parcelHelpers.interopDefault(_shuffleJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -var _zipJs = require("./zip.js"); -var _zipJsDefault = parcelHelpers.interopDefault(_zipJs); -var _everyJs = require("./every.js"); -var _everyJsDefault = parcelHelpers.interopDefault(_everyJs); -var _someJs = require("./some.js"); -var _someJsDefault = parcelHelpers.interopDefault(_someJs); -var _filterJs = require("./filter.js"); -var _filterJsDefault = parcelHelpers.interopDefault(_filterJs); -var _mapJs = require("./map.js"); -var _mapJsDefault = parcelHelpers.interopDefault(_mapJs); -var _reduceJs = require("./reduce.js"); -var _reduceJsDefault = parcelHelpers.interopDefault(_reduceJs); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _differenceJs = require("./difference.js"); -var _differenceJsDefault = parcelHelpers.interopDefault(_differenceJs); -var _disjointJs = require("./disjoint.js"); -var _disjointJsDefault = parcelHelpers.interopDefault(_disjointJs); -var _intersectionJs = require("./intersection.js"); -var _intersectionJsDefault = parcelHelpers.interopDefault(_intersectionJs); -var _subsetJs = require("./subset.js"); -var _subsetJsDefault = parcelHelpers.interopDefault(_subsetJs); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -var _unionJs = require("./union.js"); -var _unionJsDefault = parcelHelpers.interopDefault(_unionJs); -var _internmap = require("internmap"); - -},{"./bisect.js":"5mqeI","./ascending.js":"zAyXo","./bisector.js":"49VDk","./blur.js":"jfE0Q","./count.js":"6vIaU","./cross.js":"jUp0X","./cumsum.js":"h3OPK","./descending.js":"fbB9Y","./deviation.js":"6718P","./extent.js":"5JWQp","./fsum.js":"3h28A","./group.js":"kABha","./groupSort.js":"kyLtP","./bin.js":"6hfwu","./threshold/freedmanDiaconis.js":"2dRyq","./threshold/scott.js":"lGg25","./threshold/sturges.js":"1lIJb","./max.js":"8YwYZ","./maxIndex.js":"l9rNy","./mean.js":"fVfCV","./median.js":"awkrD","./merge.js":"liJWL","./min.js":"6iq65","./minIndex.js":"8xCGl","./mode.js":"2Kgrp","./nice.js":"e63B5","./pairs.js":"c2ViX","./permute.js":"eud3x","./quantile.js":"29jB7","./quickselect.js":"pm9zy","./range.js":"7i9on","./rank.js":"kd13S","./least.js":"ceK4t","./leastIndex.js":"dW25b","./greatest.js":"jrFax","./greatestIndex.js":"dL9ui","./scan.js":"bmKwW","./shuffle.js":"3ZIpU","./sum.js":"8SwUe","./ticks.js":"fmECo","./transpose.js":"1Ej71","./variance.js":"881VG","./zip.js":"f7Krc","./every.js":"agCBw","./some.js":"3LqiV","./filter.js":"9mlS9","./map.js":"ePJbS","./reduce.js":"h3fvA","./reverse.js":"lg91e","./sort.js":"93lWn","./difference.js":"jJaFT","./disjoint.js":"ewThO","./intersection.js":"3dVn4","./subset.js":"fO88f","./superset.js":"6zbJQ","./union.js":"loYUW","internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5mqeI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisectRight", ()=>bisectRight); -parcelHelpers.export(exports, "bisectLeft", ()=>bisectLeft); -parcelHelpers.export(exports, "bisectCenter", ()=>bisectCenter); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -const ascendingBisect = (0, _bisectorJsDefault.default)((0, _ascendingJsDefault.default)); -const bisectRight = ascendingBisect.right; -const bisectLeft = ascendingBisect.left; -const bisectCenter = (0, _bisectorJsDefault.default)((0, _numberJsDefault.default)).center; -exports.default = bisectRight; - -},{"./ascending.js":"zAyXo","./bisector.js":"49VDk","./number.js":"gSG0m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"zAyXo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ascending); -function ascending(a, b) { - return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49VDk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bisector); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -function bisector(f) { - let compare1, compare2, delta; - // If an accessor is specified, promote it to a comparator. In this case we - // can test whether the search value is (self-) comparable. We can’t do this - // for a comparator (except for specific, known comparators) because we can’t - // tell if the comparator is symmetric, and an asymmetric comparator can’t be - // used to test whether a single value is comparable. + } + function needsNewCharacterSet(oldInsight, newInsight) { + if (!oldInsight) + return true; + if (!newInsight) + return true; + if (oldInsight.chart !== newInsight.chart) + return true; + if (oldInsight.facetStyle !== newInsight.facetStyle) + return true; + if (oldInsight.totalStyle !== newInsight.totalStyle) + return true; + if (oldInsight.hideAxes !== newInsight.hideAxes) + return true; + if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) + return true; + if (differentObjectValues(oldInsight.size, newInsight.size)) + return true; + const oldColumns = oldInsight.columns; + const newColumns = newInsight.columns; + if (oldColumns.facet !== newColumns.facet) + return true; + if (oldColumns.facetV !== newColumns.facetV) + return true; + if (oldColumns.x !== newColumns.x) + return true; + if (oldColumns.y !== newColumns.y) + return true; + if (oldColumns.z !== newColumns.z) + return true; + return false; + } + function differentObjectValues(a2, b2) { + if (!a2 && !b2) + return false; + if (!a2 || !b2) + return true; + const keys2 = Object.keys(b2); + for (let i = 0; i < keys2.length; i++) { + const key2 = keys2[i]; + const ta = typeof a2; + const tb = typeof b2; + if (ta !== tb) + return true; + if (ta === "object") { + return differentObjectValues(a2[key2], b2[key2]); + } else { + if (a2[key2] !== b2[key2]) + return true; + } + } + return false; + } + function ascending$2(a2, b2) { + return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN; + } + function descending$1(a2, b2) { + return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN; + } + function bisector(f) { + let compare12, compare2, delta; if (f.length !== 2) { - compare1 = (0, _ascendingJsDefault.default); - compare2 = (d, x)=>(0, _ascendingJsDefault.default)(f(d), x); - delta = (d, x)=>f(d) - x; + compare12 = ascending$2; + compare2 = (d2, x2) => ascending$2(f(d2), x2); + delta = (d2, x2) => f(d2) - x2; } else { - compare1 = f === (0, _ascendingJsDefault.default) || f === (0, _descendingJsDefault.default) ? f : zero; - compare2 = f; - delta = f; + compare12 = f === ascending$2 || f === descending$1 ? f : zero$3; + compare2 = f; + delta = f; } - function left(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) < 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); - } - return lo; + function left(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) < 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; } - function right(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) <= 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); - } - return lo; + function right(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) <= 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; } - function center(a, x, lo = 0, hi = a.length) { - const i = left(a, x, lo, hi - 1); - return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; + function center(a2, x2, lo = 0, hi = a2.length) { + const i = left(a2, x2, lo, hi - 1); + return i > lo && delta(a2[i - 1], x2) > -delta(a2[i], x2) ? i - 1 : i; } - return { - left, - center, - right - }; -} -function zero() { + return { left, center, right }; + } + function zero$3() { return 0; -} - -},{"./ascending.js":"zAyXo","./descending.js":"fbB9Y","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fbB9Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>descending); -function descending(a, b) { - return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gSG0m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -parcelHelpers.export(exports, "numbers", ()=>numbers); -function number(x) { - return x === null ? NaN : +x; -} -function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) yield value; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jfE0Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "blur", ()=>blur); -parcelHelpers.export(exports, "blur2", ()=>blur2); -parcelHelpers.export(exports, "blurImage", ()=>blurImage); -function blur(values, r) { - if (!((r = +r) >= 0)) throw new RangeError("invalid r"); - let length = values.length; - if (!((length = Math.floor(length)) >= 0)) throw new RangeError("invalid length"); - if (!length || !r) return values; - const blur = blurf(r); - const temp = values.slice(); - blur(values, temp, 0, length, 1); - blur(temp, values, 0, length, 1); - blur(values, temp, 0, length, 1); - return values; -} -const blur2 = Blur2(blurf); -const blurImage = Blur2(blurfImage); -function Blur2(blur) { - return function(data, rx, ry = rx) { - if (!((rx = +rx) >= 0)) throw new RangeError("invalid rx"); - if (!((ry = +ry) >= 0)) throw new RangeError("invalid ry"); - let { data: values, width, height } = data; - if (!((width = Math.floor(width)) >= 0)) throw new RangeError("invalid width"); - if (!((height = Math.floor(height !== undefined ? height : values.length / width)) >= 0)) throw new RangeError("invalid height"); - if (!width || !height || !rx && !ry) return data; - const blurx = rx && blur(rx); - const blury = ry && blur(ry); - const temp = values.slice(); - if (blurx && blury) { - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } else if (blurx) { - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - } else if (blury) { - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } - return data; - }; -} -function blurh(blur, T, S, w, h) { - for(let y = 0, n = w * h; y < n;)blur(T, S, y, y += w, 1); -} -function blurv(blur, T, S, w, h) { - for(let x = 0, n = w * h; x < w; ++x)blur(T, S, x, x + n, w); -} -function blurfImage(radius) { - const blur = blurf(radius); - return (T, S, start, stop, step)=>{ - start <<= 2, stop <<= 2, step <<= 2; - blur(T, S, start + 0, stop + 0, step); - blur(T, S, start + 1, stop + 1, step); - blur(T, S, start + 2, stop + 2, step); - blur(T, S, start + 3, stop + 3, step); - }; -} -// Given a target array T, a source array S, sets each value T[i] to the average -// of {S[i - r], …, S[i], …, S[i + r]}, where r = ⌊radius⌋, start <= i < stop, -// for each i, i + step, i + 2 * step, etc., and where S[j] is clamped between -// S[start] (inclusive) and S[stop] (exclusive). If the given radius is not an -// integer, S[i - r - 1] and S[i + r + 1] are added to the sum, each weighted -// according to r - ⌊radius⌋. -function blurf(radius) { - const radius0 = Math.floor(radius); - if (radius0 === radius) return bluri(radius); - const t = radius - radius0; - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius0 * S[start]; - const s0 = step * radius0; - const s1 = s0 + step; - for(let i = start, j = start + s0; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s0)]; - T[i] = (sum + t * (S[Math.max(start, i - s1)] + S[Math.min(stop, i + s1)])) / w; - sum -= S[Math.max(start, i - s0)]; - } - }; -} -// Like blurf, but optimized for integer radius. -function bluri(radius) { - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius * S[start]; - const s = step * radius; - for(let i = start, j = start + s; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s)]; - T[i] = sum / w; - sum -= S[Math.max(start, i - s)]; - } - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6vIaU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>count); -function count(values, valueof) { - let count = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count; - } - return count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jUp0X":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cross); -function length(array) { - return array.length | 0; -} -function empty(length) { - return !(length > 0); -} -function arrayify(values) { - return typeof values !== "object" || "length" in values ? values : Array.from(values); -} -function reducer(reduce) { - return (values)=>reduce(...values); -} -function cross(...values) { - const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop()); - values = values.map(arrayify); - const lengths = values.map(length); - const j = values.length - 1; - const index = new Array(j + 1).fill(0); - const product = []; - if (j < 0 || lengths.some(empty)) return product; - while(true){ - product.push(index.map((j, i)=>values[i][j])); - let i = j; - while(++index[i] === lengths[i]){ - if (i === 0) return reduce ? product.map(reduce) : product; - index[i--] = 0; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h3OPK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cumsum); -function cumsum(values, valueof) { - var sum = 0, index = 0; - return Float64Array.from(values, valueof === undefined ? (v)=>sum += +v || 0 : (v)=>sum += +valueof(v, index++, values) || 0); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6718P":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>deviation); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -function deviation(values, valueof) { - const v = (0, _varianceJsDefault.default)(values, valueof); - return v ? Math.sqrt(v) : v; -} - -},{"./variance.js":"881VG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"881VG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>variance); -function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); + } + function number$6(x2) { + return x2 === null ? NaN : +x2; + } + function* numbers$2(values2, valueof) { + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + yield value2; } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - if (count > 1) return sum / (count - 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5JWQp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>extent); -function extent(values, valueof) { - let min; - let max; - if (valueof === undefined) { - for (const value of values)if (value != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + yield value2; } + } + } + } + const ascendingBisect = bisector(ascending$2); + const bisectRight$1 = ascendingBisect.right; + const bisectLeft$1 = ascendingBisect.left; + bisector(number$6).center; + function variance(values2, valueof) { + let count2 = 0; + let delta; + let mean2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); + } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); } + } } - return [ - min, - max - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3h28A":[function(require,module,exports,__globalThis) { -// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423 -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Adder", ()=>Adder); -parcelHelpers.export(exports, "fsum", ()=>fsum); -parcelHelpers.export(exports, "fcumsum", ()=>fcumsum); -class Adder { - constructor(){ - this._partials = new Float64Array(32); - this._n = 0; - } - add(x) { - const p = this._partials; - let i = 0; - for(let j = 0; j < this._n && j < 32; j++){ - const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); - if (lo) p[i++] = lo; - x = hi; - } - p[i] = x; - this._n = i + 1; - return this; + if (count2 > 1) return sum2 / (count2 - 1); + } + function deviation(values2, valueof) { + const v = variance(values2, valueof); + return v ? Math.sqrt(v) : v; + } + class Adder { + constructor() { + this._partials = new Float64Array(32); + this._n = 0; + } + add(x2) { + const p = this._partials; + let i = 0; + for (let j = 0; j < this._n && j < 32; j++) { + const y2 = p[j], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2); + if (lo) p[i++] = lo; + x2 = hi; + } + p[i] = x2; + this._n = i + 1; + return this; } valueOf() { - const p = this._partials; - let n = this._n, x, y, lo, hi = 0; - if (n > 0) { - hi = p[--n]; - while(n > 0){ - x = hi; - y = p[--n]; - hi = x + y; - lo = y - (hi - x); - if (lo) break; - } - if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { - y = lo * 2; - x = hi + y; - if (y == x - hi) hi = x; - } + const p = this._partials; + let n = this._n, x2, y2, lo, hi = 0; + if (n > 0) { + hi = p[--n]; + while (n > 0) { + x2 = hi; + y2 = p[--n]; + hi = x2 + y2; + lo = y2 - (hi - x2); + if (lo) break; + } + if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { + y2 = lo * 2; + x2 = hi + y2; + if (y2 == x2 - hi) hi = x2; } - return hi; + } + return hi; } -} -function fsum(values, valueof) { - const adder = new Adder(); - if (valueof === undefined) { - for (let value of values)if (value = +value) adder.add(value); - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) adder.add(value); - } - return +adder; -} -function fcumsum(values, valueof) { - const adder = new Adder(); - let index = -1; - return Float64Array.from(values, valueof === undefined ? (v)=>adder.add(+v || 0) : (v)=>adder.add(+valueof(v, ++index, values) || 0)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kABha":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>group); -parcelHelpers.export(exports, "groups", ()=>groups); -parcelHelpers.export(exports, "flatGroup", ()=>flatGroup); -parcelHelpers.export(exports, "flatRollup", ()=>flatRollup); -parcelHelpers.export(exports, "rollup", ()=>rollup); -parcelHelpers.export(exports, "rollups", ()=>rollups); -parcelHelpers.export(exports, "index", ()=>index); -parcelHelpers.export(exports, "indexes", ()=>indexes); -var _internmap = require("internmap"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -function group(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), (0, _identityJsDefault.default), keys); -} -function groups(values, ...keys) { - return nest(values, Array.from, (0, _identityJsDefault.default), keys); -} -function flatten(groups, keys) { - for(let i = 1, n = keys.length; i < n; ++i)groups = groups.flatMap((g)=>g.pop().map(([key, value])=>[ - ...g, - key, - value - ])); - return groups; -} -function flatGroup(values, ...keys) { - return flatten(groups(values, ...keys), keys); -} -function flatRollup(values, reduce, ...keys) { - return flatten(rollups(values, reduce, ...keys), keys); -} -function rollup(values, reduce, ...keys) { - return nest(values, (0, _identityJsDefault.default), reduce, keys); -} -function rollups(values, reduce, ...keys) { - return nest(values, Array.from, reduce, keys); -} -function index(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), unique, keys); -} -function indexes(values, ...keys) { - return nest(values, Array.from, unique, keys); -} -function unique(values) { - if (values.length !== 1) throw new Error("duplicate key"); - return values[0]; -} -function nest(values, map, reduce, keys) { - return function regroup(values, i) { - if (i >= keys.length) return reduce(values); - const groups = new (0, _internmap.InternMap)(); - const keyof = keys[i++]; - let index = -1; - for (const value of values){ - const key = keyof(value, ++index, values); - const group = groups.get(key); - if (group) group.push(value); - else groups.set(key, [ - value - ]); - } - for (const [key, values] of groups)groups.set(key, regroup(values, i)); - return map(groups); - }(values, 0); -} - -},{"internmap":"cOuqB","./identity.js":"i6NWs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cOuqB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InternMap", ()=>InternMap); -parcelHelpers.export(exports, "InternSet", ()=>InternSet); -class InternMap extends Map { - constructor(entries, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (entries != null) for (const [key, value] of entries)this.set(key, value); + } + class InternMap extends Map { + constructor(entries, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (entries != null) for (const [key3, value2] of entries) this.set(key3, value2); } - get(key) { - return super.get(intern_get(this, key)); + get(key2) { + return super.get(intern_get(this, key2)); } - has(key) { - return super.has(intern_get(this, key)); + has(key2) { + return super.has(intern_get(this, key2)); } - set(key, value) { - return super.set(intern_set(this, key), value); + set(key2, value2) { + return super.set(intern_set(this, key2), value2); } - delete(key) { - return super.delete(intern_delete(this, key)); + delete(key2) { + return super.delete(intern_delete(this, key2)); } -} -class InternSet extends Set { - constructor(values, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (values != null) for (const value of values)this.add(value); - } - has(value) { - return super.has(intern_get(this, value)); - } - add(value) { - return super.add(intern_set(this, value)); - } - delete(value) { - return super.delete(intern_delete(this, value)); - } -} -function intern_get({ _intern, _key }, value) { - const key = _key(value); - return _intern.has(key) ? _intern.get(key) : value; -} -function intern_set({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) return _intern.get(key); - _intern.set(key, value); - return value; -} -function intern_delete({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) { - value = _intern.get(key); - _intern.delete(key); - } - return value; -} -function keyof(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i6NWs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -function identity(x) { - return x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kyLtP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>groupSort); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -function groupSort(values, reduce, key) { - return (reduce.length !== 2 ? (0, _sortJsDefault.default)((0, _groupJs.rollup)(values, reduce, key), ([ak, av], [bk, bv])=>(0, _ascendingJsDefault.default)(av, bv) || (0, _ascendingJsDefault.default)(ak, bk)) : (0, _sortJsDefault.default)((0, _groupJsDefault.default)(values, key), ([ak, av], [bk, bv])=>reduce(av, bv) || (0, _ascendingJsDefault.default)(ak, bk))).map(([key])=>key); -} - -},{"./ascending.js":"zAyXo","./group.js":"kABha","./sort.js":"93lWn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93lWn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sort); -parcelHelpers.export(exports, "compareDefined", ()=>compareDefined); -parcelHelpers.export(exports, "ascendingDefined", ()=>ascendingDefined); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -function sort(values, ...F) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - values = Array.from(values); - let [f] = F; - if (f && f.length !== 2 || F.length > 1) { - const index = Uint32Array.from(values, (d, i)=>i); - if (F.length > 1) { - F = F.map((f)=>values.map(f)); - index.sort((i, j)=>{ - for (const f of F){ - const c = ascendingDefined(f[i], f[j]); - if (c) return c; - } - }); - } else { - f = values.map(f); - index.sort((i, j)=>ascendingDefined(f[i], f[j])); - } - return (0, _permuteJsDefault.default)(values, index); - } - return values.sort(compareDefined(f)); -} -function compareDefined(compare = (0, _ascendingJsDefault.default)) { - if (compare === (0, _ascendingJsDefault.default)) return ascendingDefined; - if (typeof compare !== "function") throw new TypeError("compare is not a function"); - return (a, b)=>{ - const x = compare(a, b); - if (x || x === 0) return x; - return (compare(b, b) === 0) - (compare(a, a) === 0); - }; -} -function ascendingDefined(a, b) { - return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0); -} - -},{"./ascending.js":"zAyXo","./permute.js":"eud3x","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eud3x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>permute); -function permute(source, keys) { - return Array.from(keys, (key)=>source[key]); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6hfwu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bin); -var _arrayJs = require("./array.js"); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -function bin() { - var value = (0, _identityJsDefault.default), domain = (0, _extentJsDefault.default), threshold = (0, _sturgesJsDefault.default); - function histogram(data) { - if (!Array.isArray(data)) data = Array.from(data); - var i, n = data.length, x, step, values = new Array(n); - for(i = 0; i < n; ++i)values[i] = value(data[i], i, data); - var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); - // Convert number of thresholds into uniform thresholds, and nice the - // default domain accordingly. - if (!Array.isArray(tz)) { - const max = x1, tn = +tz; - if (domain === (0, _extentJsDefault.default)) [x0, x1] = (0, _niceJsDefault.default)(x0, x1, tn); - tz = (0, _ticksJsDefault.default)(x0, x1, tn); - // If the domain is aligned with the first tick (which it will by - // default), then we can use quantization rather than bisection to bin - // values, which is substantially faster. - if (tz[0] <= x0) step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - // If the last threshold is coincident with the domain’s upper bound, the - // last bin will be zero-width. If the default domain is used, and this - // last threshold is coincident with the maximum input value, we can - // extend the niced upper bound by one tick to ensure uniform bin widths; - // otherwise, we simply remove the last threshold. Note that we don’t - // coerce values or the domain to numbers, and thus must be careful to - // compare order (>=) rather than strict equality (===)! - if (tz[tz.length - 1] >= x1) { - if (max >= x1 && domain === (0, _extentJsDefault.default)) { - const step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - if (isFinite(step)) { - if (step > 0) x1 = (Math.floor(x1 / step) + 1) * step; - else if (step < 0) x1 = (Math.ceil(x1 * -step) + 1) / -step; - } - } else tz.pop(); - } - } - // Remove any thresholds outside the domain. - // Be careful not to mutate an array owned by the user! - var m = tz.length, a = 0, b = m; - while(tz[a] <= x0)++a; - while(tz[b - 1] > x1)--b; - if (a || b < m) tz = tz.slice(a, b), m = b - a; - var bins = new Array(m + 1), bin; - // Initialize bins. - for(i = 0; i <= m; ++i){ - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - // Assign data to bins by value, ignoring any outside the domain. - if (isFinite(step)) { - if (step > 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]); - } else if (step < 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) { - const j = Math.floor((x0 - x) * step); - bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); // handle off-by-one due to rounding - } - } - } else { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[(0, _bisectJsDefault.default)(tz, x, 0, m)].push(data[i]); - } - return bins; - } - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), histogram) : value; - }; - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - _[0], - _[1] - ]), histogram) : domain; - }; - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(Array.isArray(_) ? (0, _arrayJs.slice).call(_) : _), histogram) : threshold; - }; - return histogram; -} - -},{"./array.js":"j2SMP","./bisect.js":"5mqeI","./constant.js":"7wJOu","./extent.js":"5JWQp","./identity.js":"i6NWs","./nice.js":"e63B5","./ticks.js":"fmECo","./threshold/sturges.js":"1lIJb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2SMP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "map", ()=>map); -var array = Array.prototype; -var slice = array.slice; -var map = array.map; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wJOu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constant); -function constant(x) { - return ()=>x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e63B5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -var _ticksJs = require("./ticks.js"); -function nice(start, stop, count) { - let prestep; - while(true){ - const step = (0, _ticksJs.tickIncrement)(start, stop, count); - if (step === prestep || step === 0 || !isFinite(step)) return [ - start, - stop - ]; - else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } - prestep = step; + } + class InternSet extends Set { + constructor(values2, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (values2 != null) for (const value2 of values2) this.add(value2); + } + has(value2) { + return super.has(intern_get(this, value2)); + } + add(value2) { + return super.add(intern_set(this, value2)); + } + delete(value2) { + return super.delete(intern_delete(this, value2)); + } + } + function intern_get({ _intern, _key }, value2) { + const key2 = _key(value2); + return _intern.has(key2) ? _intern.get(key2) : value2; + } + function intern_set({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) return _intern.get(key2); + _intern.set(key2, value2); + return value2; + } + function intern_delete({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) { + value2 = _intern.get(key2); + _intern.delete(key2); } -} - -},{"./ticks.js":"fmECo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fmECo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ticks); -parcelHelpers.export(exports, "tickIncrement", ()=>tickIncrement); -parcelHelpers.export(exports, "tickStep", ()=>tickStep); -const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); -function tickSpec(start, stop, count) { - const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; + return value2; + } + function keyof(value2) { + return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2; + } + function permute(source2, keys2) { + return Array.from(keys2, (key2) => source2[key2]); + } + function compareDefined(compare2 = ascending$2) { + if (compare2 === ascending$2) return ascendingDefined; + if (typeof compare2 !== "function") throw new TypeError("compare is not a function"); + return (a2, b2) => { + const x2 = compare2(a2, b2); + if (x2 || x2 === 0) return x2; + return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0); + }; + } + function ascendingDefined(a2, b2) { + return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0); + } + const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); + function tickSpec(start, stop2, count2) { + const step = (stop2 - start) / Math.max(0, count2), power = Math.floor(Math.log10(step)), error2 = step / Math.pow(10, power), factor = error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1; let i1, i2, inc; if (power < 0) { - inc = Math.pow(10, -power) / factor; - i1 = Math.round(start * inc); - i2 = Math.round(stop * inc); - if (i1 / inc < start) ++i1; - if (i2 / inc > stop) --i2; - inc = -inc; + inc = Math.pow(10, -power) / factor; + i1 = Math.round(start * inc); + i2 = Math.round(stop2 * inc); + if (i1 / inc < start) ++i1; + if (i2 / inc > stop2) --i2; + inc = -inc; } else { - inc = Math.pow(10, power) * factor; - i1 = Math.round(start / inc); - i2 = Math.round(stop / inc); - if (i1 * inc < start) ++i1; - if (i2 * inc > stop) --i2; - } - if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2); - return [ - i1, - i2, - inc - ]; -} -function ticks(start, stop, count) { - stop = +stop, start = +start, count = +count; - if (!(count > 0)) return []; - if (start === stop) return [ - start - ]; - const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count); + inc = Math.pow(10, power) * factor; + i1 = Math.round(start / inc); + i2 = Math.round(stop2 / inc); + if (i1 * inc < start) ++i1; + if (i2 * inc > stop2) --i2; + } + if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start, stop2, count2 * 2); + return [i1, i2, inc]; + } + function ticks(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + if (!(count2 > 0)) return []; + if (start === stop2) return [start]; + const reverse2 = stop2 < start, [i1, i2, inc] = reverse2 ? tickSpec(stop2, start, count2) : tickSpec(start, stop2, count2); if (!(i2 >= i1)) return []; - const n = i2 - i1 + 1, ticks = new Array(n); - if (reverse) { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) * inc; + const n = i2 - i1 + 1, ticks2 = new Array(n); + if (reverse2) { + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc; } else { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) * inc; - } - return ticks; -} -function tickIncrement(start, stop, count) { - stop = +stop, start = +start, count = +count; - return tickSpec(start, stop, count)[2]; -} -function tickStep(start, stop, count) { - stop = +stop, start = +start, count = +count; - const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count); - return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1lIJb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdSturges); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -function thresholdSturges(values) { - return Math.max(1, Math.ceil(Math.log((0, _countJsDefault.default)(values)) / Math.LN2) + 1); -} - -},{"../count.js":"6vIaU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2dRyq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdFreedmanDiaconis); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _quantileJs = require("../quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function thresholdFreedmanDiaconis(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _quantileJsDefault.default)(values, 0.75) - (0, _quantileJsDefault.default)(values, 0.25); - return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1; -} - -},{"../count.js":"6vIaU","../quantile.js":"29jB7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"29jB7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -parcelHelpers.export(exports, "quantileSorted", ()=>quantileSorted); -parcelHelpers.export(exports, "quantileIndex", ()=>quantileIndex); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _sortJs = require("./sort.js"); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -function quantile(values, p, valueof) { - values = Float64Array.from((0, _numberJs.numbers)(values, valueof)); - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return (0, _minJsDefault.default)(values); - if (p >= 1) return (0, _maxJsDefault.default)(values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = (0, _maxJsDefault.default)((0, _quickselectJsDefault.default)(values, i0).subarray(0, i0 + 1)), value1 = (0, _minJsDefault.default)(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} -function quantileSorted(values, p, valueof = (0, _numberJsDefault.default)) { - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} -function quantileIndex(values, p, valueof = (0, _numberJsDefault.default)) { - if (isNaN(p = +p)) return; - numbers = Float64Array.from(values, (_, i)=>(0, _numberJsDefault.default)(valueof(values[i], i, values))); - if (p <= 0) return (0, _minIndexJsDefault.default)(numbers); - if (p >= 1) return (0, _maxIndexJsDefault.default)(numbers); - var numbers, index = Uint32Array.from(values, (_, i)=>i), j = numbers.length - 1, i = Math.floor(j * p); - (0, _quickselectJsDefault.default)(index, i, 0, j, (i, j)=>(0, _sortJs.ascendingDefined)(numbers[i], numbers[j])); - i = (0, _greatestJsDefault.default)(index.subarray(0, i + 1), (i)=>numbers[i]); - return i >= 0 ? i : -1; -} - -},{"./max.js":"8YwYZ","./maxIndex.js":"l9rNy","./min.js":"6iq65","./minIndex.js":"8xCGl","./quickselect.js":"pm9zy","./number.js":"gSG0m","./sort.js":"93lWn","./greatest.js":"jrFax","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8YwYZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>max); -function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values)if (value != null && (max < value || max === undefined && value >= value)) max = value; + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc; + } + return ticks2; + } + function tickIncrement(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + return tickSpec(start, stop2, count2)[2]; + } + function tickStep(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + const reverse2 = stop2 < start, inc = reverse2 ? tickIncrement(stop2, start, count2) : tickIncrement(start, stop2, count2); + return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + } + function max$2(values2, valueof) { + let max2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; + } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value; - } - return max; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l9rNy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>maxIndex); -function maxIndex(values, valueof) { - let max; - let maxIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; + } + } } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; - } - return maxIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iq65":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>min); -function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values)if (value != null && (min > value || min === undefined && value >= value)) min = value; + return max2; + } + function min$2(values2, valueof) { + let min2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value; - } - return min; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8xCGl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>minIndex); -function minIndex(values, valueof) { - let min; - let minIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; - } - return minIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"pm9zy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quickselect); -var _sortJs = require("./sort.js"); -function quickselect(array, k, left = 0, right = Infinity, compare) { + return min2; + } + function quickselect(array2, k, left = 0, right = Infinity, compare2) { k = Math.floor(k); left = Math.floor(Math.max(0, left)); - right = Math.floor(Math.min(array.length - 1, right)); - if (!(left <= k && k <= right)) return array; - compare = compare === undefined ? (0, _sortJs.ascendingDefined) : (0, _sortJs.compareDefined)(compare); - while(right > left){ - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - const t = array[k]; - let i = left; - let j = right; - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - while(i < j){ - swap(array, i, j), ++i, --j; - while(compare(array[i], t) < 0)++i; - while(compare(array[j], t) > 0)--j; - } - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; -} -function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; -} - -},{"./sort.js":"93lWn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jrFax":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatest); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function greatest(values, compare = (0, _ascendingJsDefault.default)) { - let max; - let defined = false; - if (compare.length === 1) { - let maxValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, maxValue) > 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - max = element; - maxValue = value; - defined = true; - } - } - } else { - for (const value of values)if (defined ? compare(value, max) > 0 : compare(value, value) === 0) { - max = value; - defined = true; - } - } - return max; -} - -},{"./ascending.js":"zAyXo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lGg25":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdScott); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _deviationJs = require("../deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -function thresholdScott(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _deviationJsDefault.default)(values); - return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1; -} - -},{"../count.js":"6vIaU","../deviation.js":"6718P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fVfCV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mean); -function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count, sum += value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count, sum += value; - } - if (count) return sum / count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"awkrD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>median); -parcelHelpers.export(exports, "medianIndex", ()=>medianIndex); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function median(values, valueof) { - return (0, _quantileJsDefault.default)(values, 0.5, valueof); -} -function medianIndex(values, valueof) { - return (0, _quantileJs.quantileIndex)(values, 0.5, valueof); -} - -},{"./quantile.js":"29jB7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"liJWL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>merge); -function* flatten(arrays) { - for (const array of arrays)yield* array; -} -function merge(arrays) { - return Array.from(flatten(arrays)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Kgrp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mode); -var _internmap = require("internmap"); -function mode(values, valueof) { - const counts = new (0, _internmap.InternMap)(); - if (valueof === undefined) { - for (let value of values)if (value != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } - let modeValue; - let modeCount = 0; - for (const [value, count] of counts)if (count > modeCount) { - modeCount = count; - modeValue = value; - } - return modeValue; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c2ViX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>pairs); -parcelHelpers.export(exports, "pair", ()=>pair); -function pairs(values, pairof = pair) { - const pairs1 = []; - let previous; - let first = false; - for (const value of values){ - if (first) pairs1.push(pairof(previous, value)); - previous = value; - first = true; + right = Math.floor(Math.min(array2.length - 1, right)); + if (!(left <= k && k <= right)) return array2; + compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2); + while (right > left) { + if (right - left > 600) { + const n = right - left + 1; + const m2 = k - left + 1; + const z2 = Math.log(n); + const s2 = 0.5 * Math.exp(2 * z2 / 3); + const sd = 0.5 * Math.sqrt(z2 * s2 * (n - s2) / n) * (m2 - n / 2 < 0 ? -1 : 1); + const newLeft = Math.max(left, Math.floor(k - m2 * s2 / n + sd)); + const newRight = Math.min(right, Math.floor(k + (n - m2) * s2 / n + sd)); + quickselect(array2, k, newLeft, newRight, compare2); + } + const t = array2[k]; + let i = left; + let j = right; + swap$1(array2, left, k); + if (compare2(array2[right], t) > 0) swap$1(array2, left, right); + while (i < j) { + swap$1(array2, i, j), ++i, --j; + while (compare2(array2[i], t) < 0) ++i; + while (compare2(array2[j], t) > 0) --j; + } + if (compare2(array2[left], t) === 0) swap$1(array2, left, j); + else ++j, swap$1(array2, j, right); + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; } - return pairs1; -} -function pair(a, b) { - return [ - a, - b - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7i9on":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>range); -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); - while(++i < n)range[i] = start + i * step; - return range; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kd13S":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>rank); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _sortJs = require("./sort.js"); -function rank(values, valueof = (0, _ascendingJsDefault.default)) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - let V = Array.from(values); - const R = new Float64Array(V.length); - if (valueof.length !== 2) V = V.map(valueof), valueof = (0, _ascendingJsDefault.default); - const compareIndex = (i, j)=>valueof(V[i], V[j]); - let k, r; - values = Uint32Array.from(V, (_, i)=>i); - // Risky chaining due to Safari 14 https://github.com/d3/d3-array/issues/123 - values.sort(valueof === (0, _ascendingJsDefault.default) ? (i, j)=>(0, _sortJs.ascendingDefined)(V[i], V[j]) : (0, _sortJs.compareDefined)(compareIndex)); - values.forEach((j, i)=>{ - const c = compareIndex(j, k === undefined ? j : k); - if (c >= 0) { - if (k === undefined || c > 0) k = j, r = i; - R[j] = r; - } else R[j] = NaN; - }); - return R; -} - -},{"./ascending.js":"zAyXo","./sort.js":"93lWn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ceK4t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>least); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function least(values, compare = (0, _ascendingJsDefault.default)) { - let min; - let defined = false; - if (compare.length === 1) { - let minValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, minValue) < 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - min = element; - minValue = value; - defined = true; - } + return array2; + } + function swap$1(array2, i, j) { + const t = array2[i]; + array2[i] = array2[j]; + array2[j] = t; + } + function quantile$1(values2, p, valueof) { + values2 = Float64Array.from(numbers$2(values2, valueof)); + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return min$2(values2); + if (p >= 1) return max$2(values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$2(quickselect(values2, i0).subarray(0, i0 + 1)), value1 = min$2(values2.subarray(i0 + 1)); + return value0 + (value1 - value0) * (i - i0); + } + function quantileSorted(values2, p, valueof = number$6) { + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return +valueof(values2[0], 0, values2); + if (p >= 1) return +valueof(values2[n - 1], n - 1, values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values2[i0], i0, values2), value1 = +valueof(values2[i0 + 1], i0 + 1, values2); + return value0 + (value1 - value0) * (i - i0); + } + function mean(values2, valueof) { + let count2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; } + } } else { - for (const value of values)if (defined ? compare(value, min) < 0 : compare(value, value) === 0) { - min = value; - defined = true; - } - } - return min; -} - -},{"./ascending.js":"zAyXo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dW25b":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>leastIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -function leastIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _minIndexJsDefault.default)(values, compare); - let minValue; - let min = -1; - let index = -1; - for (const value of values){ - ++index; - if (min < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { - minValue = value; - min = index; - } - } - return min; -} - -},{"./ascending.js":"zAyXo","./minIndex.js":"8xCGl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dL9ui":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatestIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -function greatestIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _maxIndexJsDefault.default)(values, compare); - let maxValue; - let max = -1; - let index = -1; - for (const value of values){ - ++index; - if (max < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { - maxValue = value; - max = index; - } - } - return max; -} - -},{"./ascending.js":"zAyXo","./maxIndex.js":"l9rNy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmKwW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>scan); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -function scan(values, compare) { - const index = (0, _leastIndexJsDefault.default)(values, compare); - return index < 0 ? undefined : index; -} - -},{"./leastIndex.js":"dW25b","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ZIpU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shuffler", ()=>shuffler); -exports.default = shuffler(Math.random); -function shuffler(random) { - return function shuffle(array, i0 = 0, i1 = array.length) { - let m = i1 - (i0 = +i0); - while(m){ - const i = random() * m-- | 0, t = array[m + i0]; - array[m + i0] = array[i + i0]; - array[i + i0] = t; - } - return array; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8SwUe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sum); -function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value = +value) sum += value; - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) sum += value; - } - return sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Ej71":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>transpose); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for(var i = -1, m = (0, _minJsDefault.default)(matrix, length), transpose = new Array(m); ++i < m;)for(var j = -1, n, row = transpose[i] = new Array(n); ++j < n;)row[j] = matrix[j][i]; - return transpose; -} -function length(d) { - return d.length; -} - -},{"./min.js":"6iq65","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f7Krc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>zip); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -function zip() { - return (0, _transposeJsDefault.default)(arguments); -} - -},{"./transpose.js":"1Ej71","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"agCBw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>every); -function every(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (!test(value, ++index, values)) return false; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; + } + } } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3LqiV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>some); -function some(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (test(value, ++index, values)) return true; + if (count2) return sum2 / count2; + } + function median(values2, valueof) { + return quantile$1(values2, 0.5, valueof); + } + function* flatten(arrays) { + for (const array2 of arrays) { + yield* array2; } - return false; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9mlS9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>filter); -function filter(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - const array = []; - let index = -1; - for (const value of values)if (test(value, ++index, values)) array.push(value); - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ePJbS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>map); -function map(values, mapper) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - if (typeof mapper !== "function") throw new TypeError("mapper is not a function"); - return Array.from(values, (value, index)=>mapper(value, index, values)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h3fvA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reduce); -function reduce(values, reducer, value) { - if (typeof reducer !== "function") throw new TypeError("reducer is not a function"); - const iterator = values[Symbol.iterator](); - let done, next, index = -1; - if (arguments.length < 3) { - ({ done, value } = iterator.next()); - if (done) return; - ++index; + } + function merge$4(arrays) { + return Array.from(flatten(arrays)); + } + function range$3(start, stop2, step) { + start = +start, stop2 = +stop2, step = (n = arguments.length) < 2 ? (stop2 = start, start = 0, 1) : n < 3 ? 1 : +step; + var i = -1, n = Math.max(0, Math.ceil((stop2 - start) / step)) | 0, range2 = new Array(n); + while (++i < n) { + range2[i] = start + i * step; } - while({ done, value: next } = iterator.next(), !done)value = reducer(value, next, ++index, values); - return value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lg91e":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reverse); -function reverse(values) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - return Array.from(values).reverse(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jJaFT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>difference); -var _internmap = require("internmap"); -function difference(values, ...others) { - values = new (0, _internmap.InternSet)(values); - for (const other of others)for (const value of other)values.delete(value); - return values; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewThO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>disjoint); -var _internmap = require("internmap"); -function disjoint(values, other) { - const iterator = other[Symbol.iterator](), set = new (0, _internmap.InternSet)(); - for (const v of values){ - if (set.has(v)) return false; - let value, done; - while({ value, done } = iterator.next()){ - if (done) break; - if (Object.is(v, value)) return false; - set.add(value); + return range2; + } + function sum$1(values2, valueof) { + let sum2 = 0; + { + for (let value2 of values2) { + if (value2 = +value2) { + sum2 += value2; } + } } - return true; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3dVn4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>intersection); -var _internmap = require("internmap"); -function intersection(values, ...others) { - values = new (0, _internmap.InternSet)(values); - others = others.map(set); - out: for (const value of values){ - for (const other of others)if (!other.has(value)) { - values.delete(value); - continue out; - } - } - return values; -} -function set(values) { - return values instanceof (0, _internmap.InternSet) ? values : new (0, _internmap.InternSet)(values); -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fO88f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>subset); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -function subset(values, other) { - return (0, _supersetJsDefault.default)(other, values); -} - -},{"./superset.js":"6zbJQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6zbJQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>superset); -function superset(values, other) { - const iterator = values[Symbol.iterator](), set = new Set(); - for (const o of other){ - const io = intern(o); - if (set.has(io)) continue; - let value, done; - while({ value, done } = iterator.next()){ - if (done) return false; - const ivalue = intern(value); - set.add(ivalue); - if (Object.is(io, ivalue)) break; + return sum2; + } + function intersection(values2, ...others) { + values2 = new InternSet(values2); + others = others.map(set$4); + out: for (const value2 of values2) { + for (const other of others) { + if (!other.has(value2)) { + values2.delete(value2); + continue out; } + } } - return true; -} -function intern(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"loYUW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>union); -var _internmap = require("internmap"); -function union(...others) { - const set = new (0, _internmap.InternSet)(); - for (const other of others)for (const o of other)set.add(o); - return set; -} - -},{"internmap":"cOuqB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ijd73":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initRange", ()=>initRange); -parcelHelpers.export(exports, "initInterpolator", ()=>initInterpolator); -function initRange(domain, range) { - switch(arguments.length){ - case 0: - break; - case 1: - this.range(domain); - break; - default: - this.range(range).domain(domain); - break; + return values2; + } + function set$4(values2) { + return values2 instanceof InternSet ? values2 : new InternSet(values2); + } + function union(...others) { + const set2 = new InternSet(); + for (const other of others) { + for (const o of other) { + set2.add(o); + } } - return this; -} -function initInterpolator(domain, interpolator) { - switch(arguments.length){ - case 0: - break; - case 1: - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - default: - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; + return set2; + } + function initRange(domain2, range2) { + switch (arguments.length) { + case 0: + break; + case 1: + this.range(domain2); + break; + default: + this.range(range2).domain(domain2); + break; } return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cg12q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "implicit", ()=>implicit); -parcelHelpers.export(exports, "default", ()=>ordinal); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -const implicit = Symbol("implicit"); -function ordinal() { - var index = new (0, _d3Array.InternMap)(), domain = [], range = [], unknown = implicit; - function scale(d) { - let i = index.get(d); - if (i === undefined) { - if (unknown !== implicit) return unknown; - index.set(d, i = domain.push(d) - 1); - } - return range[i % range.length]; - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new (0, _d3Array.InternMap)(); - for (const value of _){ - if (index.has(value)) continue; - index.set(value, domain.push(value) - 1); - } - return scale; - }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e07Nz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function identity(domain) { - var unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : x; + } + function initInterpolator(domain2, interpolator) { + switch (arguments.length) { + case 0: + break; + case 1: { + if (typeof domain2 === "function") this.interpolator(domain2); + else this.range(domain2); + break; + } + default: { + this.domain(domain2); + if (typeof interpolator === "function") this.interpolator(interpolator); + else this.range(interpolator); + break; + } } - scale.invert = scale; - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), scale) : domain.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + return this; + } + const implicit = Symbol("implicit"); + function ordinal() { + var index2 = new InternMap(), domain2 = [], range2 = [], unknown = implicit; + function scale2(d2) { + let i = index2.get(d2); + if (i === void 0) { + if (unknown !== implicit) return unknown; + index2.set(d2, i = domain2.push(d2) - 1); + } + return range2[i % range2.length]; + } + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = [], index2 = new InternMap(); + for (const value2 of _) { + if (index2.has(value2)) continue; + index2.set(value2, domain2.push(value2) - 1); + } + return scale2; }; - scale.copy = function() { - return identity(domain).unknown(unknown); + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), scale2) : range2.slice(); }; - domain = arguments.length ? Array.from(domain, (0, _numberJsDefault.default)) : [ - 0, - 1 - ]; - return (0, _linearJs.linearish)(scale); -} - -},{"./linear.js":"ik2PQ","./number.js":"aUICk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ik2PQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "linearish", ()=>linearish); -parcelHelpers.export(exports, "default", ()=>linear); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); -function linearish(scale) { - var domain = scale.domain; - scale.ticks = function(count) { - var d = domain(); - return (0, _d3Array.ticks)(d[0], d[d.length - 1], count == null ? 10 : count); - }; - scale.tickFormat = function(count, specifier) { - var d = domain(); - return (0, _tickFormatJsDefault.default)(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - scale.nice = function(count) { - if (count == null) count = 10; - var d = domain(); - var i0 = 0; - var i1 = d.length - 1; - var start = d[i0]; - var stop = d[i1]; - var prestep; - var step; - var maxIter = 10; - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - while(maxIter-- > 0){ - step = (0, _d3Array.tickIncrement)(start, stop, count); - if (step === prestep) { - d[i0] = start; - d[i1] = stop; - return domain(d); - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } else break; - prestep = step; - } - return scale; - }; - return scale; -} -function linear() { - var scale = (0, _continuousJsDefault.default)(); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, linear()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return linearish(scale); -} - -},{"d3-array":"5lCYW","./continuous.js":"2SYx4","./init.js":"ijd73","./tickFormat.js":"fHwUM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2SYx4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "transformer", ()=>transformer); -parcelHelpers.export(exports, "default", ()=>continuous); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var unit = [ - 0, - 1 -]; -function identity(x) { - return x; -} -function normalize(a, b) { - return (b -= a = +a) ? function(x) { - return (x - a) / b; - } : (0, _constantJsDefault.default)(isNaN(b) ? NaN : 0.5); -} -function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = t; - return function(x) { - return Math.max(a, Math.min(b, x)); - }; -} -// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. -function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { - return r0(d0(x)); - }; -} -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1; - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - while(++i < j){ - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - return function(x) { - var i = (0, _d3Array.bisect)(domain, x, 1, j) - 1; - return r[i](d[i](x)); - }; -} -function copy(source, target) { - return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); -} -function transformer() { - var domain = unit, range = unit, interpolate = (0, _d3Interpolate.interpolate), transform, untransform, unknown, clamp = identity, piecewise, output, input; - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), (0, _d3Interpolate.interpolateNumber))))(y))); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), rescale()) : domain.slice(); + scale2.copy = function() { + return ordinal(domain2, range2).unknown(unknown); }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); + initRange.apply(scale2, arguments); + return scale2; + } + function basis(t12, v0, v1, v2, v3) { + var t22 = t12 * t12, t32 = t22 * t12; + return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6; + } + function basis$1(values2) { + var n = values2.length - 1; + return function(t) { + var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values2[i], v2 = values2[i + 1], v0 = i > 0 ? values2[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values2[i + 2] : 2 * v2 - v1; + return basis((t - i / n) * n, v0, v1, v2, v3); }; - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = (0, _d3Interpolate.interpolateRound), rescale(); + } + function basisClosed(values2) { + var n = values2.length; + return function(t) { + var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values2[(i + n - 1) % n], v1 = values2[i % n], v2 = values2[(i + 1) % n], v3 = values2[(i + 2) % n]; + return basis((t - i / n) * n, v0, v1, v2, v3); }; - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; + } + const constant$5 = (x2) => () => x2; + function linear$2(a2, d2) { + return function(t) { + return a2 + t * d2; }; - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; + } + function exponential(a2, b2, y2) { + return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t) { + return Math.pow(a2 + t * b2, y2); }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + } + function hue$1(a2, b2) { + var d2 = b2 - a2; + return d2 ? linear$2(a2, d2 > 180 || d2 < -180 ? d2 - 360 * Math.round(d2 / 360) : d2) : constant$5(isNaN(a2) ? b2 : a2); + } + function gamma(y2) { + return (y2 = +y2) === 1 ? nogamma : function(a2, b2) { + return b2 - a2 ? exponential(a2, b2, y2) : constant$5(isNaN(a2) ? b2 : a2); }; - return function(t, u) { - transform = t, untransform = u; - return rescale(); + } + function nogamma(a2, b2) { + var d2 = b2 - a2; + return d2 ? linear$2(a2, d2) : constant$5(isNaN(a2) ? b2 : a2); + } + const rgb = (function rgbGamma(y2) { + var color2 = gamma(y2); + function rgb2(start, end) { + var r = color2((start = rgb$1(start)).r, (end = rgb$1(end)).r), g = color2(start.g, end.g), b2 = color2(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b2(t); + start.opacity = opacity2(t); + return start + ""; + }; + } + rgb2.gamma = rgbGamma; + return rgb2; + })(1); + function rgbSpline(spline) { + return function(colors2) { + var n = colors2.length, r = new Array(n), g = new Array(n), b2 = new Array(n), i, color2; + for (i = 0; i < n; ++i) { + color2 = rgb$1(colors2[i]); + r[i] = color2.r || 0; + g[i] = color2.g || 0; + b2[i] = color2.b || 0; + } + r = spline(r); + g = spline(g); + b2 = spline(b2); + color2.opacity = 1; + return function(t) { + color2.r = r(t); + color2.g = g(t); + color2.b = b2(t); + return color2 + ""; + }; }; -} -function continuous() { - return transformer()(identity, identity); -} - -},{"d3-array":"5lCYW","d3-interpolate":"hWyQt","./constant.js":"3WTV4","./number.js":"aUICk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hWyQt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolate", ()=>(0, _valueJsDefault.default)); -parcelHelpers.export(exports, "interpolateArray", ()=>(0, _arrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "interpolateDate", ()=>(0, _dateJsDefault.default)); -parcelHelpers.export(exports, "interpolateDiscrete", ()=>(0, _discreteJsDefault.default)); -parcelHelpers.export(exports, "interpolateHue", ()=>(0, _hueJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumber", ()=>(0, _numberJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumberArray", ()=>(0, _numberArrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateObject", ()=>(0, _objectJsDefault.default)); -parcelHelpers.export(exports, "interpolateRound", ()=>(0, _roundJsDefault.default)); -parcelHelpers.export(exports, "interpolateString", ()=>(0, _stringJsDefault.default)); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>(0, _indexJs.interpolateTransformCss)); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>(0, _indexJs.interpolateTransformSvg)); -parcelHelpers.export(exports, "interpolateZoom", ()=>(0, _zoomJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgb", ()=>(0, _rgbJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgbBasis", ()=>(0, _rgbJs.rgbBasis)); -parcelHelpers.export(exports, "interpolateRgbBasisClosed", ()=>(0, _rgbJs.rgbBasisClosed)); -parcelHelpers.export(exports, "interpolateHsl", ()=>(0, _hslJsDefault.default)); -parcelHelpers.export(exports, "interpolateHslLong", ()=>(0, _hslJs.hslLong)); -parcelHelpers.export(exports, "interpolateLab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "interpolateHcl", ()=>(0, _hclJsDefault.default)); -parcelHelpers.export(exports, "interpolateHclLong", ()=>(0, _hclJs.hclLong)); -parcelHelpers.export(exports, "interpolateCubehelix", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixLong", ()=>(0, _cubehelixJs.cubehelixLong)); -parcelHelpers.export(exports, "piecewise", ()=>(0, _piecewiseJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _discreteJs = require("./discrete.js"); -var _discreteJsDefault = parcelHelpers.interopDefault(_discreteJs); -var _hueJs = require("./hue.js"); -var _hueJsDefault = parcelHelpers.interopDefault(_hueJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _indexJs = require("./transform/index.js"); -var _zoomJs = require("./zoom.js"); -var _zoomJsDefault = parcelHelpers.interopDefault(_zoomJs); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _hslJs = require("./hsl.js"); -var _hslJsDefault = parcelHelpers.interopDefault(_hslJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _hclJs = require("./hcl.js"); -var _hclJsDefault = parcelHelpers.interopDefault(_hclJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _piecewiseJs = require("./piecewise.js"); -var _piecewiseJsDefault = parcelHelpers.interopDefault(_piecewiseJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); - -},{"./value.js":"gfJPE","./array.js":"aHWTr","./basis.js":"88PXq","./basisClosed.js":"k0GEO","./date.js":"7hJMh","./discrete.js":"856yx","./hue.js":"8zvjW","./number.js":"jdEvy","./numberArray.js":"e2unU","./object.js":"bDQsG","./round.js":"8t96L","./string.js":"i8PKu","./transform/index.js":"kov9u","./zoom.js":"fAkJy","./rgb.js":"eqhhf","./hsl.js":"kviB4","./lab.js":"drgXo","./hcl.js":"e1eQm","./cubehelix.js":"fTm9T","./piecewise.js":"3wh8c","./quantize.js":"6KHTv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfJPE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? (0, _constantJsDefault.default)(b) : (t === "number" ? (0, _numberJsDefault.default) : t === "string" ? (c = (0, _d3Color.color)(b)) ? (b = c, _rgbJsDefault.default) : (0, _stringJsDefault.default) : b instanceof (0, _d3Color.color) ? (0, _rgbJsDefault.default) : b instanceof Date ? (0, _dateJsDefault.default) : (0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : Array.isArray(b) ? (0, _arrayJs.genericArray) : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? (0, _objectJsDefault.default) : (0, _numberJsDefault.default))(a, b); - }); -var _d3Color = require("d3-color"); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _arrayJs = require("./array.js"); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); - -},{"d3-color":"37LNF","./rgb.js":"eqhhf","./array.js":"aHWTr","./date.js":"7hJMh","./number.js":"jdEvy","./object.js":"bDQsG","./string.js":"i8PKu","./constant.js":"iuQcB","./numberArray.js":"e2unU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eqhhf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rgbBasis", ()=>rgbBasis); -parcelHelpers.export(exports, "rgbBasisClosed", ()=>rgbBasisClosed); -var _d3Color = require("d3-color"); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -exports.default = function rgbGamma(y) { - var color = (0, _colorJs.gamma)(y); - function rgb(start, end) { - var r = color((start = (0, _d3Color.rgb)(start)).r, (end = (0, _d3Color.rgb)(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - rgb.gamma = rgbGamma; - return rgb; -}(1); -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; - for(i = 0; i < n; ++i){ - color = (0, _d3Color.rgb)(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; + } + var rgbBasis = rgbSpline(basis$1); + var rgbBasisClosed = rgbSpline(basisClosed); + function numberArray(a2, b2) { + if (!b2) b2 = []; + var n = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i; + return function(t) { + for (i = 0; i < n; ++i) c2[i] = a2[i] * (1 - t) + b2[i] * t; + return c2; }; -} -var rgbBasis = rgbSpline((0, _basisJsDefault.default)); -var rgbBasisClosed = rgbSpline((0, _basisClosedJsDefault.default)); - -},{"d3-color":"37LNF","./basis.js":"88PXq","./basisClosed.js":"k0GEO","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"88PXq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "basis", ()=>basis); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length - 1; - return function(t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - }); -function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = t2 * t1; - return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k0GEO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; - return (0, _basisJs.basis)((t - i / n) * n, v0, v1, v2, v3); - }; - }); -var _basisJs = require("./basis.js"); - -},{"./basis.js":"88PXq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fWpiN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hue", ()=>hue); -parcelHelpers.export(exports, "gamma", ()=>gamma); -parcelHelpers.export(exports, "default", ()=>nogamma); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -function linear(a, d) { + } + function isNumberArray(x2) { + return ArrayBuffer.isView(x2) && !(x2 instanceof DataView); + } + function array$5(a2, b2) { + return (isNumberArray(b2) ? numberArray : genericArray)(a2, b2); + } + function genericArray(a2, b2) { + var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i; + for (i = 0; i < na; ++i) x2[i] = interpolate$1(a2[i], b2[i]); + for (; i < nb; ++i) c2[i] = b2[i]; return function(t) { - return a + t * d; - }; -} -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} -function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} -function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); - }; -} -function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} - -},{"./constant.js":"iuQcB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iuQcB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>()=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aHWTr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return ((0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : genericArray)(a, b); - }); -parcelHelpers.export(exports, "genericArray", ()=>genericArray); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -function genericArray(a, b) { - var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; - for(i = 0; i < na; ++i)x[i] = (0, _valueJsDefault.default)(a[i], b[i]); - for(; i < nb; ++i)c[i] = b[i]; + for (i = 0; i < na; ++i) c2[i] = x2[i](t); + return c2; + }; + } + function date$1(a2, b2) { + var d2 = /* @__PURE__ */ new Date(); + return a2 = +a2, b2 = +b2, function(t) { + return d2.setTime(a2 * (1 - t) + b2 * t), d2; + }; + } + function interpolateNumber(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return a2 * (1 - t) + b2 * t; + }; + } + function object$1(a2, b2) { + var i = {}, c2 = {}, k; + if (a2 === null || typeof a2 !== "object") a2 = {}; + if (b2 === null || typeof b2 !== "object") b2 = {}; + for (k in b2) { + if (k in a2) { + i[k] = interpolate$1(a2[k], b2[k]); + } else { + c2[k] = b2[k]; + } + } return function(t) { - for(i = 0; i < na; ++i)c[i] = x[i](t); - return c; - }; -} - -},{"./value.js":"gfJPE","./numberArray.js":"e2unU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e2unU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; - return function(t) { - for(i = 0; i < n; ++i)c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; - }); -parcelHelpers.export(exports, "isNumberArray", ()=>isNumberArray); -function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7hJMh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jdEvy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bDQsG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = {}, c = {}, k; - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - for(k in b)if (k in a) i[k] = (0, _valueJsDefault.default)(a[k], b[k]); - else c[k] = b[k]; - return function(t) { - for(k in i)c[k] = i[k](t); - return c; - }; - }); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); - -},{"./value.js":"gfJPE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i8PKu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; // number interpolators - // Coerce inputs to strings. - a = a + "", b = b + ""; - // Interpolate pairs of numbers in a & b. - while((am = reA.exec(a)) && (bm = reB.exec(b))){ - if ((bs = bm.index) > bi) { - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { - s[++i] = null; - q.push({ - i: i, - x: (0, _numberJsDefault.default)(am, bm) - }); - } - bi = reB.lastIndex; - } - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - // Special optimization for only a single match. - // Otherwise, interpolate each of the numbers and rejoin the string. - return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) { - for(var i = 0, o; i < b; ++i)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); - }); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); -function zero(b) { + for (k in i) c2[k] = i[k](t); + return c2; + }; + } + var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); + function zero$2(b2) { return function() { - return b; + return b2; }; -} -function one(b) { + } + function one$2(b2) { return function(t) { - return b(t) + ""; - }; -} - -},{"./number.js":"jdEvy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"856yx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8zvjW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = (0, _colorJs.hue)(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; - }); -var _colorJs = require("./color.js"); - -},{"./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8t96L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kov9u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>interpolateTransformCss); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>interpolateTransformSvg); -var _numberJs = require("../number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _parseJs = require("./parse.js"); -function interpolateTransform(parse, pxComma, pxParen, degParen) { - function pop(s) { - return s.length ? s.pop() + " " : ""; - } - function translate(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb || yb) s.push("translate(" + xb + pxComma + yb + pxParen); - } - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; - else if (b - a > 180) a += 360; // shortest path - q.push({ - i: s.push(pop(s) + "rotate(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - } else if (b) s.push(pop(s) + "rotate(" + b + degParen); - } - function skewX(a, b, s, q) { - if (a !== b) q.push({ - i: s.push(pop(s) + "skewX(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - else if (b) s.push(pop(s) + "skewX(" + b + degParen); - } - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb !== 1 || yb !== 1) s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - return function(a, b) { - var s = [], q = []; // number interpolators - a = parse(a), b = parse(b); - translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); - rotate(a.rotate, b.rotate, s, q); - skewX(a.skewX, b.skewX, s, q); - scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); - a = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while(++i < n)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; + return b2(t) + ""; }; -} -var interpolateTransformCss = interpolateTransform((0, _parseJs.parseCss), "px, ", "px)", "deg)"); -var interpolateTransformSvg = interpolateTransform((0, _parseJs.parseSvg), ", ", ")", ")"); - -},{"../number.js":"jdEvy","./parse.js":"1NPFm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NPFm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/* eslint-disable no-undef */ parcelHelpers.export(exports, "parseCss", ()=>parseCss); -parcelHelpers.export(exports, "parseSvg", ()=>parseSvg); -var _decomposeJs = require("./decompose.js"); -var _decomposeJsDefault = parcelHelpers.interopDefault(_decomposeJs); -var svgNode; -function parseCss(value) { - const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + ""); - return m.isIdentity ? (0, _decomposeJs.identity) : (0, _decomposeJsDefault.default)(m.a, m.b, m.c, m.d, m.e, m.f); -} -function parseSvg(value) { - if (value == null) return 0, _decomposeJs.identity; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return 0, _decomposeJs.identity; - value = value.matrix; - return (0, _decomposeJsDefault.default)(value.a, value.b, value.c, value.d, value.e, value.f); -} - -},{"./decompose.js":"cQAQq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cQAQq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "default", ()=>function(a, b, c, d, e, f) { - var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b, a) * degrees, - skewX: Math.atan(skewX) * degrees, - scaleX: scaleX, - scaleY: scaleY - }; + } + function string(a2, b2) { + var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s2 = [], q = []; + a2 = a2 + "", b2 = b2 + ""; + while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) { + if ((bs = bm.index) > bi) { + bs = b2.slice(bi, bs); + if (s2[i]) s2[i] += bs; + else s2[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { + if (s2[i]) s2[i] += bm; + else s2[++i] = bm; + } else { + s2[++i] = null; + q.push({ i, x: interpolateNumber(am, bm) }); + } + bi = reB.lastIndex; + } + if (bi < b2.length) { + bs = b2.slice(bi); + if (s2[i]) s2[i] += bs; + else s2[++i] = bs; + } + return s2.length < 2 ? q[0] ? one$2(q[0].x) : zero$2(b2) : (b2 = q.length, function(t) { + for (var i2 = 0, o; i2 < b2; ++i2) s2[(o = q[i2]).i] = o.x(t); + return s2.join(""); }); -var degrees = 180 / Math.PI; -var identity = { + } + function interpolate$1(a2, b2) { + var t = typeof b2, c2; + return b2 == null || t === "boolean" ? constant$5(b2) : (t === "number" ? interpolateNumber : t === "string" ? (c2 = color$2(b2)) ? (b2 = c2, rgb) : string : b2 instanceof color$2 ? rgb : b2 instanceof Date ? date$1 : isNumberArray(b2) ? numberArray : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object$1 : interpolateNumber)(a2, b2); + } + function discrete$1(range2) { + var n = range2.length; + return function(t) { + return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; + }; + } + function hue(a2, b2) { + var i = hue$1(+a2, +b2); + return function(t) { + var x2 = i(t); + return x2 - 360 * Math.floor(x2 / 360); + }; + } + function interpolateRound(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return Math.round(a2 * (1 - t) + b2 * t); + }; + } + var degrees$1 = 180 / Math.PI; + var identity$7 = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fAkJy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var epsilon2 = 1e-12; -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} -exports.default = function zoomRho(rho, rho2, rho4) { - // p0 = [ux0, uy0, w0] - // p1 = [ux1, uy1, w1] - function zoom(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } else { - var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); - return [ - ux0 + u * dx, - uy0 + u * dy, - w0 * coshr0 / cosh(rho * s + r0) - ]; - }; - } - i.duration = S * 1000 * rho / Math.SQRT2; - return i; + }; + function decompose(a2, b2, c2, d2, e, f) { + var scaleX, scaleY2, skewX; + if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX; + if (skewX = a2 * c2 + b2 * d2) c2 -= a2 * skewX, d2 -= b2 * skewX; + if (scaleY2 = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY2, d2 /= scaleY2, skewX /= scaleY2; + if (a2 * d2 < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e, + translateY: f, + rotate: Math.atan2(b2, a2) * degrees$1, + skewX: Math.atan(skewX) * degrees$1, + scaleX, + scaleY: scaleY2 + }; + } + var svgNode; + function parseCss(value2) { + const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + ""); + return m2.isIdentity ? identity$7 : decompose(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f); + } + function parseSvg(value2) { + if (value2 == null) return identity$7; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value2); + if (!(value2 = svgNode.transform.baseVal.consolidate())) return identity$7; + value2 = value2.matrix; + return decompose(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f); + } + function interpolateTransform(parse2, pxComma, pxParen, degParen) { + function pop(s2) { + return s2.length ? s2.pop() + " " : ""; + } + function translate2(xa, ya, xb, yb, s2, q) { + if (xa !== xb || ya !== yb) { + var i = s2.push("translate(", null, pxComma, null, pxParen); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb || yb) { + s2.push("translate(" + xb + pxComma + yb + pxParen); + } } - zoom.rho = function(_) { - var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; - return zoomRho(_1, _2, _4); - }; - return zoom; -}(Math.SQRT2, 2, 4); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kviB4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hslLong", ()=>hslLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hsl(hue) { - return function(start, end) { - var h = hue((start = (0, _d3Color.hsl)(start)).h, (end = (0, _d3Color.hsl)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; + function rotate2(a2, b2, s2, q) { + if (a2 !== b2) { + if (a2 - b2 > 180) b2 += 360; + else if (b2 - a2 > 180) a2 += 360; + q.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s2.push(pop(s2) + "rotate(" + b2 + degParen); + } + } + function skewX(a2, b2, s2, q) { + if (a2 !== b2) { + q.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s2.push(pop(s2) + "skewX(" + b2 + degParen); + } + } + function scale2(xa, ya, xb, yb, s2, q) { + if (xa !== xb || ya !== yb) { + var i = s2.push(pop(s2) + "scale(", null, ",", null, ")"); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb !== 1 || yb !== 1) { + s2.push(pop(s2) + "scale(" + xb + "," + yb + ")"); + } + } + return function(a2, b2) { + var s2 = [], q = []; + a2 = parse2(a2), b2 = parse2(b2); + translate2(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q); + rotate2(a2.rotate, b2.rotate, s2, q); + skewX(a2.skewX, b2.skewX, s2, q); + scale2(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q); + a2 = b2 = null; + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s2[(o = q[i]).i] = o.x(t); + return s2.join(""); + }; + }; + } + var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); + var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + var epsilon2$1 = 1e-12; + function cosh(x2) { + return ((x2 = Math.exp(x2)) + 1 / x2) / 2; + } + function sinh(x2) { + return ((x2 = Math.exp(x2)) - 1 / x2) / 2; + } + function tanh(x2) { + return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1); + } + const zoom$1 = (function zoomRho(rho, rho2, rho4) { + function zoom2(p02, p1) { + var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < epsilon2$1) { + S = Math.log(w1 / w0) / rho; + i = function(t) { + return [ + ux0 + t * dx, + uy0 + t * dy, + w0 * Math.exp(rho * t * S) + ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / rho; + i = function(t) { + var s2 = t * S, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0)); + return [ + ux0 + u2 * dx, + uy0 + u2 * dy, + w0 * coshr0 / cosh(rho * s2 + r0) + ]; }; + } + i.duration = S * 1e3 * rho / Math.SQRT2; + return i; + } + zoom2.rho = function(_) { + var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; + return zoomRho(_1, _2, _4); }; -} -exports.default = hsl((0, _colorJs.hue)); -var hslLong = hsl((0, _colorJsDefault.default)); - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"drgXo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>lab); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function lab(start, end) { - var l = (0, _colorJsDefault.default)((start = (0, _d3Color.lab)(start)).l, (end = (0, _d3Color.lab)(end)).l), a = (0, _colorJsDefault.default)(start.a, end.a), b = (0, _colorJsDefault.default)(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { + return zoom2; + })(Math.SQRT2, 2, 4); + function hsl(hue2) { + return function(start, end) { + var h2 = hue2((start = hsl$1(start)).h, (end = hsl$1(end)).h), s2 = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.s = s2(t); start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); + start.opacity = opacity2(t); return start + ""; + }; + }; + } + const hsl_default = hsl(hue$1); + var hslLong = hsl(nogamma); + function lab(start, end) { + var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l), a2 = nogamma(start.a, end.a), b2 = nogamma(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.l = l(t); + start.a = a2(t); + start.b = b2(t); + start.opacity = opacity2(t); + return start + ""; }; -} - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e1eQm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hclLong", ()=>hclLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hcl(hue) { + } + function hcl(hue2) { return function(start, end) { - var h = hue((start = (0, _d3Color.hcl)(start)).h, (end = (0, _d3Color.hcl)(end)).h), c = (0, _colorJsDefault.default)(start.c, end.c), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); + var h2 = hue2((start = hcl$1(start)).h, (end = hcl$1(end)).h), c2 = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.c = c2(t); + start.l = l(t); + start.opacity = opacity2(t); + return start + ""; + }; + }; + } + const hcl_default = hcl(hue$1); + var hclLong = hcl(nogamma); + function cubehelix(hue2) { + return (function cubehelixGamma(y2) { + y2 = +y2; + function cubehelix2(start, end) { + var h2 = hue2((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h), s2 = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; + start.h = h2(t); + start.s = s2(t); + start.l = l(Math.pow(t, y2)); + start.opacity = opacity2(t); + return start + ""; }; - }; -} -exports.default = hcl((0, _colorJs.hue)); -var hclLong = hcl((0, _colorJsDefault.default)); - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fTm9T":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubehelixLong", ()=>cubehelixLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function cubehelix(hue) { - return function cubehelixGamma(y) { - y = +y; - function cubehelix(start, end) { - var h = hue((start = (0, _d3Color.cubehelix)(start)).h, (end = (0, _d3Color.cubehelix)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - cubehelix.gamma = cubehelixGamma; - return cubehelix; - }(1); -} -exports.default = cubehelix((0, _colorJs.hue)); -var cubehelixLong = cubehelix((0, _colorJsDefault.default)); - -},{"d3-color":"37LNF","./color.js":"fWpiN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3wh8c":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>piecewise); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -function piecewise(interpolate, values) { - if (values === undefined) values = interpolate, interpolate = (0, _valueJsDefault.default); - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while(i < n)I[i] = interpolate(v, v = values[++i]); + } + cubehelix2.gamma = cubehelixGamma; + return cubehelix2; + })(1); + } + const cubehelix_default = cubehelix(hue$1); + var cubehelixLong = cubehelix(nogamma); + function piecewise(interpolate2, values2) { + if (values2 === void 0) values2 = interpolate2, interpolate2 = interpolate$1; + var i = 0, n = values2.length - 1, v = values2[0], I = new Array(n < 0 ? 0 : n); + while (i < n) I[i] = interpolate2(v, v = values2[++i]); return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; -} - -},{"./value.js":"gfJPE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6KHTv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(interpolator, n) { - var samples = new Array(n); - for(var i = 0; i < n; ++i)samples[i] = interpolator(i / (n - 1)); - return samples; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3WTV4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constants); -function constants(x) { + var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); + return I[i2](t - i2); + }; + } + function quantize$2(interpolator, n) { + var samples = new Array(n); + for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + return samples; + } + const $$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + interpolate: interpolate$1, + interpolateArray: array$5, + interpolateBasis: basis$1, + interpolateBasisClosed: basisClosed, + interpolateCubehelix: cubehelix_default, + interpolateCubehelixLong: cubehelixLong, + interpolateDate: date$1, + interpolateDiscrete: discrete$1, + interpolateHcl: hcl_default, + interpolateHclLong: hclLong, + interpolateHsl: hsl_default, + interpolateHslLong: hslLong, + interpolateHue: hue, + interpolateLab: lab, + interpolateNumber, + interpolateNumberArray: numberArray, + interpolateObject: object$1, + interpolateRgb: rgb, + interpolateRgbBasis: rgbBasis, + interpolateRgbBasisClosed: rgbBasisClosed, + interpolateRound, + interpolateString: string, + interpolateTransformCss, + interpolateTransformSvg, + interpolateZoom: zoom$1, + piecewise, + quantize: quantize$2 + }, Symbol.toStringTag, { value: "Module" })); + function constants(x2) { return function() { - return x; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aUICk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -function number(x) { - return +x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fHwUM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>tickFormat); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -function tickFormat(start, stop, count, specifier) { - var step = (0, _d3Array.tickStep)(start, stop, count), precision; - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ",f" : specifier); - switch(specifier.type){ - case "s": - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return (0, _d3Format.formatPrefix)(specifier, value); - case "": - case "e": - case "g": - case "p": - case "r": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionRound)(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - case "f": - case "%": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; + return x2; + }; + } + function number$5(x2) { + return +x2; + } + var unit = [0, 1]; + function identity$6(x2) { + return x2; + } + function normalize$2(a2, b2) { + return (b2 -= a2 = +a2) ? function(x2) { + return (x2 - a2) / b2; + } : constants(isNaN(b2) ? NaN : 0.5); + } + function clamper(a2, b2) { + var t; + if (a2 > b2) t = a2, a2 = b2, b2 = t; + return function(x2) { + return Math.max(a2, Math.min(b2, x2)); + }; + } + function bimap(domain2, range2, interpolate2) { + var d0 = domain2[0], d1 = domain2[1], r0 = range2[0], r1 = range2[1]; + if (d1 < d0) d0 = normalize$2(d1, d0), r0 = interpolate2(r1, r0); + else d0 = normalize$2(d0, d1), r0 = interpolate2(r0, r1); + return function(x2) { + return r0(d0(x2)); + }; + } + function polymap(domain2, range2, interpolate2) { + var j = Math.min(domain2.length, range2.length) - 1, d2 = new Array(j), r = new Array(j), i = -1; + if (domain2[j] < domain2[0]) { + domain2 = domain2.slice().reverse(); + range2 = range2.slice().reverse(); } - return (0, _d3Format.format)(specifier); -} - -},{"d3-array":"5lCYW","d3-format":"4fjQY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4fjQY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "formatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "format", ()=>(0, _defaultLocaleJs.format)); -parcelHelpers.export(exports, "formatPrefix", ()=>(0, _defaultLocaleJs.formatPrefix)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "formatSpecifier", ()=>(0, _formatSpecifierJsDefault.default)); -parcelHelpers.export(exports, "FormatSpecifier", ()=>(0, _formatSpecifierJs.FormatSpecifier)); -parcelHelpers.export(exports, "precisionFixed", ()=>(0, _precisionFixedJsDefault.default)); -parcelHelpers.export(exports, "precisionPrefix", ()=>(0, _precisionPrefixJsDefault.default)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _precisionRoundJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _precisionFixedJs = require("./precisionFixed.js"); -var _precisionFixedJsDefault = parcelHelpers.interopDefault(_precisionFixedJs); -var _precisionPrefixJs = require("./precisionPrefix.js"); -var _precisionPrefixJsDefault = parcelHelpers.interopDefault(_precisionPrefixJs); -var _precisionRoundJs = require("./precisionRound.js"); -var _precisionRoundJsDefault = parcelHelpers.interopDefault(_precisionRoundJs); - -},{"./defaultLocale.js":"jzS6R","./locale.js":"9NtbG","./formatSpecifier.js":"iBXoR","./precisionFixed.js":"kTPBo","./precisionPrefix.js":"cmgfB","./precisionRound.js":"g5X8k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jzS6R":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formatPrefix", ()=>formatPrefix); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var format; -var formatPrefix; -defaultLocale({ - thousands: ",", - grouping: [ - 3 - ], - currency: [ - "$", - "" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} - -},{"./locale.js":"9NtbG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9NtbG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? (0, _identityJsDefault.default) : (0, _formatGroupJsDefault.default)(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? (0, _identityJsDefault.default) : (0, _formatNumeralsJsDefault.default)(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "\u2212" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - function newFormat(specifier) { - specifier = (0, _formatSpecifierJsDefault.default)(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - else if (!(0, _formatTypesJsDefault.default)[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - // If zero fill is specified, padding goes after sign and before digits. - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = (0, _formatTypesJsDefault.default)[type], maybeSuffix = /[defgprs%]/.test(type); - // Set the default precision if not specified, - // or clamp the specified precision to the supported range. - // For significant precision, it must be in [1, 21]. - // For fixed precision, it must be in [0, 20]. - precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - // Trim insignificant zeros. - if (trim) value = (0, _formatTrimJsDefault.default)(value); - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + (0, _formatPrefixAutoJs.prefixExponent) / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while(++i < n)if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - // Reconstruct the final output based on the desired alignment. - switch(align){ - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format.toString = function() { - return specifier + ""; - }; - return format; - } - function formatPrefix(specifier, value) { - var f = newFormat((specifier = (0, _formatSpecifierJsDefault.default)(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; - } - return { - format: newFormat, - formatPrefix: formatPrefix - }; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); -var _formatGroupJs = require("./formatGroup.js"); -var _formatGroupJsDefault = parcelHelpers.interopDefault(_formatGroupJs); -var _formatNumeralsJs = require("./formatNumerals.js"); -var _formatNumeralsJsDefault = parcelHelpers.interopDefault(_formatNumeralsJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _formatTrimJs = require("./formatTrim.js"); -var _formatTrimJsDefault = parcelHelpers.interopDefault(_formatTrimJs); -var _formatTypesJs = require("./formatTypes.js"); -var _formatTypesJsDefault = parcelHelpers.interopDefault(_formatTypesJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var map = Array.prototype.map, prefixes = [ - "y", - "z", - "a", - "f", - "p", - "n", - "\xb5", - "m", - "", - "k", - "M", - "G", - "T", - "P", - "E", - "Z", - "Y" -]; - -},{"./exponent.js":"aOeaO","./formatGroup.js":"jZnQc","./formatNumerals.js":"3gAed","./formatSpecifier.js":"iBXoR","./formatTrim.js":"gCu3n","./formatTypes.js":"dfzgV","./formatPrefixAuto.js":"iUhuq","./identity.js":"brXEh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aOeaO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x = (0, _formatDecimalJs.formatDecimalParts)(Math.abs(x)), x ? x[1] : NaN; - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"hs37D","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hs37D":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); - }); -// Computes the decimal coefficient and exponent of the specified number x with -// significant digits p, where x is positive and p is in [1, 21] or undefined. -// For example, formatDecimalParts(1.23) returns ["123", 0]. -parcelHelpers.export(exports, "formatDecimalParts", ()=>formatDecimalParts); -function formatDecimalParts(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = x.slice(0, i); - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). + while (++i < j) { + d2[i] = normalize$2(domain2[i], domain2[i + 1]); + r[i] = interpolate2(range2[i], range2[i + 1]); + } + return function(x2) { + var i2 = bisectRight$1(domain2, x2, 1, j) - 1; + return r[i2](d2[i2](x2)); + }; + } + function copy$2(source2, target2) { + return target2.domain(source2.domain()).range(source2.range()).interpolate(source2.interpolate()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function transformer$3() { + var domain2 = unit, range2 = unit, interpolate2 = interpolate$1, transform2, untransform, unknown, clamp2 = identity$6, piecewise2, output2, input; + function rescale() { + var n = Math.min(domain2.length, range2.length); + if (clamp2 !== identity$6) clamp2 = clamper(domain2[0], domain2[n - 1]); + piecewise2 = n > 2 ? polymap : bimap; + output2 = input = null; + return scale2; + } + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : (output2 || (output2 = piecewise2(domain2.map(transform2), range2, interpolate2)))(transform2(clamp2(x2))); + } + scale2.invert = function(y2) { + return clamp2(untransform((input || (input = piecewise2(range2, domain2.map(transform2), interpolateNumber)))(y2))); + }; + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), rescale()) : domain2.slice(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); + }; + scale2.rangeRound = function(_) { + return range2 = Array.from(_), interpolate2 = interpolateRound, rescale(); + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = _ ? true : identity$6, rescale()) : clamp2 !== identity$6; + }; + scale2.interpolate = function(_) { + return arguments.length ? (interpolate2 = _, rescale()) : interpolate2; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + return function(t, u2) { + transform2 = t, untransform = u2; + return rescale(); + }; + } + function continuous$1() { + return transformer$3()(identity$6, identity$6); + } + function formatDecimal$1(x2) { + return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); + } + function formatDecimalParts$1(x2, p) { + if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; + var i, coefficient = x2.slice(0, i); return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x2.slice(i + 1) ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jZnQc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while(i > 0 && g > 0){ - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3gAed":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iBXoR":[function(require,module,exports,__globalThis) { -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatSpecifier); -parcelHelpers.export(exports, "FormatSpecifier", ()=>FormatSpecifier); -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] + } + function exponent$1(x2) { + return x2 = formatDecimalParts$1(Math.abs(x2)), x2 ? x2[1] : NaN; + } + function formatGroup$1(grouping, thousands) { + return function(value2, width2) { + var i = value2.length, t = [], j = 0, g = grouping[0], length2 = 0; + while (i > 0 && g > 0) { + if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); + t.push(value2.substring(i -= g, i + g)); + if ((length2 += g + 1) > width2) break; + g = grouping[j = (j + 1) % grouping.length]; + } + return t.reverse().join(thousands); + }; + } + function formatNumerals$1(numerals) { + return function(value2) { + return value2.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } + var re$1 = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + function formatSpecifier$1(specifier) { + if (!(match2 = re$1.exec(specifier))) throw new Error("invalid format: " + specifier); + var match2; + return new FormatSpecifier$1({ + fill: match2[1], + align: match2[2], + sign: match2[3], + symbol: match2[4], + zero: match2[5], + width: match2[6], + comma: match2[7], + precision: match2[8] && match2[8].slice(1), + trim: match2[9], + type: match2[10] }); -} -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof -function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; + } + formatSpecifier$1.prototype = FormatSpecifier$1.prototype; + function FormatSpecifier$1(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} -FormatSpecifier.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gCu3n":[function(require,module,exports,__globalThis) { -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(s) { - out: for(var n = s.length, i = 1, i0 = -1, i1; i < n; ++i)switch(s[i]){ - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + FormatSpecifier$1.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + function formatTrim$1(s2) { + out: for (var n = s2.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s2[i]) { + case ".": + i0 = i1 = i; + break; + case "0": + if (i0 === 0) i0 = i; + i1 = i; + break; + default: + if (!+s2[i]) break out; + if (i0 > 0) i0 = 0; + break; + } + } + return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2; + } + var prefixExponent$1; + function formatPrefixAuto$1(x2, p) { + var d2 = formatDecimalParts$1(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1], i = exponent2 - (prefixExponent$1 = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; + return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts$1(x2, Math.max(0, p + i - 1))[0]; + } + function formatRounded$1(x2, p) { + var d2 = formatDecimalParts$1(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1]; + return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); + } + const formatTypes$1 = { + "%": (x2, p) => (x2 * 100).toFixed(p), + "b": (x2) => Math.round(x2).toString(2), + "c": (x2) => x2 + "", + "d": formatDecimal$1, + "e": (x2, p) => x2.toExponential(p), + "f": (x2, p) => x2.toFixed(p), + "g": (x2, p) => x2.toPrecision(p), + "o": (x2) => Math.round(x2).toString(8), + "p": (x2, p) => formatRounded$1(x2 * 100, p), + "r": formatRounded$1, + "s": formatPrefixAuto$1, + "X": (x2) => Math.round(x2).toString(16).toUpperCase(), + "x": (x2) => Math.round(x2).toString(16) + }; + function identity$5(x2) { + return x2; + } + var map$3 = Array.prototype.map, prefixes$1 = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; + function formatLocale$2(locale2) { + var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$5 : formatGroup$1(map$3.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$5 : formatNumerals$1(map$3.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "−" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; + function newFormat(specifier) { + specifier = formatSpecifier$1(specifier); + var fill2 = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol2 = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type; + if (type2 === "n") comma = true, type2 = "g"; + else if (!formatTypes$1[type2]) precision === void 0 && (precision = 12), trim = true, type2 = "g"; + if (zero2 || fill2 === "0" && align === "=") zero2 = true, fill2 = "0", align = "="; + var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; + var formatType = formatTypes$1[type2], maybeSuffix = /[defgprs%]/.test(type2); + precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format2(value2) { + var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; + if (type2 === "c") { + valueSuffix = formatType(value2) + valueSuffix; + value2 = ""; + } else { + value2 = +value2; + var valueNegative = value2 < 0 || 1 / value2 < 0; + value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); + if (trim) value2 = formatTrim$1(value2); + if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; + valueSuffix = (type2 === "s" ? prefixes$1[8 + prefixExponent$1 / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); + if (maybeSuffix) { + i = -1, n = value2.length; + while (++i < n) { + if (c2 = value2.charCodeAt(i), 48 > c2 || c2 > 57) { + valueSuffix = (c2 === 46 ? decimal + value2.slice(i + 1) : value2.slice(i)) + valueSuffix; + value2 = value2.slice(0, i); break; + } + } + } } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfzgV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _formatDecimalJs = require("./formatDecimal.js"); -var _formatDecimalJsDefault = parcelHelpers.interopDefault(_formatDecimalJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _formatPrefixAutoJsDefault = parcelHelpers.interopDefault(_formatPrefixAutoJs); -var _formatRoundedJs = require("./formatRounded.js"); -var _formatRoundedJsDefault = parcelHelpers.interopDefault(_formatRoundedJs); -exports.default = { - "%": (x, p)=>(x * 100).toFixed(p), - "b": (x)=>Math.round(x).toString(2), - "c": (x)=>x + "", - "d": (0, _formatDecimalJsDefault.default), - "e": (x, p)=>x.toExponential(p), - "f": (x, p)=>x.toFixed(p), - "g": (x, p)=>x.toPrecision(p), - "o": (x)=>Math.round(x).toString(8), - "p": (x, p)=>(0, _formatRoundedJsDefault.default)(x * 100, p), - "r": (0, _formatRoundedJsDefault.default), - "s": (0, _formatPrefixAutoJsDefault.default), - "X": (x)=>Math.round(x).toString(16).toUpperCase(), - "x": (x)=>Math.round(x).toString(16) -}; - -},{"./formatDecimal.js":"hs37D","./formatPrefixAuto.js":"iUhuq","./formatRounded.js":"l08jr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUhuq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixExponent", ()=>prefixExponent); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + (0, _formatDecimalJs.formatDecimalParts)(x, Math.max(0, p + i - 1))[0]; // less than 1y! - }); -var _formatDecimalJs = require("./formatDecimal.js"); -var prefixExponent; - -},{"./formatDecimal.js":"hs37D","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l08jr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"hs37D","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"brXEh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kTPBo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step) { - return Math.max(0, -(0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"aOeaO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cmgfB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3 - (0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"aOeaO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g5X8k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, (0, _exponentJsDefault.default)(max) - (0, _exponentJsDefault.default)(step)) + 1; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"aOeaO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5BBe1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loggish", ()=>loggish); -parcelHelpers.export(exports, "default", ()=>log); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformLog(x) { - return Math.log(x); -} -function transformExp(x) { - return Math.exp(x); -} -function transformLogn(x) { - return -Math.log(-x); -} -function transformExpn(x) { - return -Math.exp(-x); -} -function pow10(x) { - return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; -} -function powp(base) { - return base === 10 ? pow10 : base === Math.E ? Math.exp : (x)=>Math.pow(base, x); -} -function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x)=>Math.log(x) / base); -} -function reflect(f) { - return (x, k)=>-f(-x, k); -} -function loggish(transform) { - const scale = transform(transformLog, transformExp); - const domain = scale.domain; - let base = 10; + if (comma && !zero2) value2 = group2(value2, Infinity); + var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) : ""; + if (comma && zero2) value2 = group2(padding2 + value2, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; + switch (align) { + case "<": + value2 = valuePrefix + value2 + valueSuffix + padding2; + break; + case "=": + value2 = valuePrefix + padding2 + value2 + valueSuffix; + break; + case "^": + value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); + break; + default: + value2 = padding2 + valuePrefix + value2 + valueSuffix; + break; + } + return numerals(value2); + } + format2.toString = function() { + return specifier + ""; + }; + return format2; + } + function formatPrefix2(specifier, value2) { + var f = newFormat((specifier = formatSpecifier$1(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent$1(value2) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes$1[8 + e / 3]; + return function(value3) { + return f(k * value3) + prefix; + }; + } + return { + format: newFormat, + formatPrefix: formatPrefix2 + }; + } + var locale$3; + var format$4; + var formatPrefix; + defaultLocale$3({ + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); + function defaultLocale$3(definition2) { + locale$3 = formatLocale$2(definition2); + format$4 = locale$3.format; + formatPrefix = locale$3.formatPrefix; + return locale$3; + } + function precisionFixed(step) { + return Math.max(0, -exponent$1(Math.abs(step))); + } + function precisionPrefix(step, value2) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value2) / 3))) * 3 - exponent$1(Math.abs(step))); + } + function precisionRound(step, max2) { + step = Math.abs(step), max2 = Math.abs(max2) - step; + return Math.max(0, exponent$1(max2) - exponent$1(step)) + 1; + } + function tickFormat$1(start, stop2, count2, specifier) { + var step = tickStep(start, stop2, count2), precision; + specifier = formatSpecifier$1(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value2 = Math.max(Math.abs(start), Math.abs(stop2)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value2))) specifier.precision = precision; + return formatPrefix(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop2))))) specifier.precision = precision - (specifier.type === "e"); + break; + } + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; + break; + } + } + return format$4(specifier); + } + function linearish(scale2) { + var domain2 = scale2.domain; + scale2.ticks = function(count2) { + var d2 = domain2(); + return ticks(d2[0], d2[d2.length - 1], count2 == null ? 10 : count2); + }; + scale2.tickFormat = function(count2, specifier) { + var d2 = domain2(); + return tickFormat$1(d2[0], d2[d2.length - 1], count2 == null ? 10 : count2, specifier); + }; + scale2.nice = function(count2) { + if (count2 == null) count2 = 10; + var d2 = domain2(); + var i0 = 0; + var i1 = d2.length - 1; + var start = d2[i0]; + var stop2 = d2[i1]; + var prestep; + var step; + var maxIter = 10; + if (stop2 < start) { + step = start, start = stop2, stop2 = step; + step = i0, i0 = i1, i1 = step; + } + while (maxIter-- > 0) { + step = tickIncrement(start, stop2, count2); + if (step === prestep) { + d2[i0] = start; + d2[i1] = stop2; + return domain2(d2); + } else if (step > 0) { + start = Math.floor(start / step) * step; + stop2 = Math.ceil(stop2 / step) * step; + } else if (step < 0) { + start = Math.ceil(start * step) / step; + stop2 = Math.floor(stop2 * step) / step; + } else { + break; + } + prestep = step; + } + return scale2; + }; + return scale2; + } + function linear$1() { + var scale2 = continuous$1(); + scale2.copy = function() { + return copy$2(scale2, linear$1()); + }; + initRange.apply(scale2, arguments); + return linearish(scale2); + } + function identity$4(domain2) { + var unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : x2; + } + scale2.invert = scale2; + scale2.domain = scale2.range = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), scale2) : domain2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return identity$4(domain2).unknown(unknown); + }; + domain2 = arguments.length ? Array.from(domain2, number$5) : [0, 1]; + return linearish(scale2); + } + function nice(domain2, interval2) { + domain2 = domain2.slice(); + var i0 = 0, i1 = domain2.length - 1, x02 = domain2[i0], x12 = domain2[i1], t; + if (x12 < x02) { + t = i0, i0 = i1, i1 = t; + t = x02, x02 = x12, x12 = t; + } + domain2[i0] = interval2.floor(x02); + domain2[i1] = interval2.ceil(x12); + return domain2; + } + function transformLog(x2) { + return Math.log(x2); + } + function transformExp(x2) { + return Math.exp(x2); + } + function transformLogn(x2) { + return -Math.log(-x2); + } + function transformExpn(x2) { + return -Math.exp(-x2); + } + function pow10(x2) { + return isFinite(x2) ? +("1e" + x2) : x2 < 0 ? 0 : x2; + } + function powp(base2) { + return base2 === 10 ? pow10 : base2 === Math.E ? Math.exp : (x2) => Math.pow(base2, x2); + } + function logp(base2) { + return base2 === Math.E ? Math.log : base2 === 10 && Math.log10 || base2 === 2 && Math.log2 || (base2 = Math.log(base2), (x2) => Math.log(x2) / base2); + } + function reflect(f) { + return (x2, k) => -f(-x2, k); + } + function loggish(transform2) { + const scale2 = transform2(transformLog, transformExp); + const domain2 = scale2.domain; + let base2 = 10; let logs; let pows; function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else transform(transformLog, transformExp); - return scale; - } - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.ticks = (count)=>{ - const d = domain(); - let u = d[0]; - let v = d[d.length - 1]; - const r = v < u; - if (r) [u, v] = [ - v, - u - ]; - let i = logs(u); - let j = logs(v); - let k; - let t; - const n = count == null ? 10 : +count; - let z = []; - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for(; i <= j; ++i)for(k = 1; k < base; ++k){ - t = i < 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - else for(; i <= j; ++i)for(k = base - 1; k >= 1; --k){ - t = i > 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - if (z.length * 2 < n) z = (0, _d3Array.ticks)(u, v, n); - } else z = (0, _d3Array.ticks)(i, j, Math.min(j - i, n)).map(pows); - return r ? z.reverse() : z; - }; - scale.tickFormat = (count, specifier)=>{ - if (count == null) count = 10; - if (specifier == null) specifier = base === 10 ? "s" : ","; - if (typeof specifier !== "function") { - if (!(base % 1) && (specifier = (0, _d3Format.formatSpecifier)(specifier)).precision == null) specifier.trim = true; - specifier = (0, _d3Format.format)(specifier); - } - if (count === Infinity) return specifier; - const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return (d)=>{ - let i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; + logs = logp(base2), pows = powp(base2); + if (domain2()[0] < 0) { + logs = reflect(logs), pows = reflect(pows); + transform2(transformLogn, transformExpn); + } else { + transform2(transformLog, transformExp); + } + return scale2; + } + scale2.base = function(_) { + return arguments.length ? (base2 = +_, rescale()) : base2; + }; + scale2.domain = function(_) { + return arguments.length ? (domain2(_), rescale()) : domain2(); + }; + scale2.ticks = (count2) => { + const d2 = domain2(); + let u2 = d2[0]; + let v = d2[d2.length - 1]; + const r = v < u2; + if (r) [u2, v] = [v, u2]; + let i = logs(u2); + let j = logs(v); + let k; + let t; + const n = count2 == null ? 10 : +count2; + let z2 = []; + if (!(base2 % 1) && j - i < n) { + i = Math.floor(i), j = Math.ceil(j); + if (u2 > 0) for (; i <= j; ++i) { + for (k = 1; k < base2; ++k) { + t = i < 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z2.push(t); + } + } + else for (; i <= j; ++i) { + for (k = base2 - 1; k >= 1; --k) { + t = i > 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z2.push(t); + } + } + if (z2.length * 2 < n) z2 = ticks(u2, v, n); + } else { + z2 = ticks(i, j, Math.min(j - i, n)).map(pows); + } + return r ? z2.reverse() : z2; + }; + scale2.tickFormat = (count2, specifier) => { + if (count2 == null) count2 = 10; + if (specifier == null) specifier = base2 === 10 ? "s" : ","; + if (typeof specifier !== "function") { + if (!(base2 % 1) && (specifier = formatSpecifier$1(specifier)).precision == null) specifier.trim = true; + specifier = format$4(specifier); + } + if (count2 === Infinity) return specifier; + const k = Math.max(1, base2 * count2 / scale2.ticks().length); + return (d2) => { + let i = d2 / pows(Math.round(logs(d2))); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k ? specifier(d2) : ""; + }; + }; + scale2.nice = () => { + return domain2(nice(domain2(), { + floor: (x2) => pows(Math.floor(logs(x2))), + ceil: (x2) => pows(Math.ceil(logs(x2))) + })); + }; + return scale2; + } + function log$4() { + const scale2 = loggish(transformer$3()).domain([1, 10]); + scale2.copy = () => copy$2(scale2, log$4()).base(scale2.base()); + initRange.apply(scale2, arguments); + return scale2; + } + function transformSymlog(c2) { + return function(x2) { + return Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); }; - scale.nice = ()=>{ - return domain((0, _niceJsDefault.default)(domain(), { - floor: (x)=>pows(Math.floor(logs(x))), - ceil: (x)=>pows(Math.ceil(logs(x))) - })); + } + function transformSymexp(c2) { + return function(x2) { + return Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + }; + } + function symlogish(transform2) { + var c2 = 1, scale2 = transform2(transformSymlog(c2), transformSymexp(c2)); + scale2.constant = function(_) { + return arguments.length ? transform2(transformSymlog(c2 = +_), transformSymexp(c2)) : c2; + }; + return linearish(scale2); + } + function symlog$1() { + var scale2 = symlogish(transformer$3()); + scale2.copy = function() { + return copy$2(scale2, symlog$1()).constant(scale2.constant()); + }; + return initRange.apply(scale2, arguments); + } + function transformPow(exponent2) { + return function(x2) { + return x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); }; - return scale; -} -function log() { - const scale = loggish((0, _continuousJs.transformer)()).domain([ - 1, - 10 - ]); - scale.copy = ()=>(0, _continuousJs.copy)(scale, log()).base(scale.base()); - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"5lCYW","d3-format":"4fjQY","./nice.js":"ig9Ha","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ig9Ha":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - domain[i0] = interval.floor(x0); - domain[i1] = interval.ceil(x1); - return domain; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"26cMO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symlogish", ()=>symlogish); -parcelHelpers.export(exports, "default", ()=>symlog); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformSymlog(c) { - return function(x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; -} -function transformSymexp(c) { - return function(x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; -} -function symlogish(transform) { - var c = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - return (0, _linearJs.linearish)(scale); -} -function symlog() { - var scale = symlogish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, symlog()).constant(scale.constant()); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"./linear.js":"ik2PQ","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ah9R8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "powish", ()=>powish); -parcelHelpers.export(exports, "default", ()=>pow); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformPow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; -} -function transformSqrt(x) { - return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x); -} -function transformSquare(x) { - return x < 0 ? -x * x : x * x; -} -function powish(transform) { - var scale = transform((0, _continuousJs.identity), (0, _continuousJs.identity)), exponent = 1; + } + function transformSqrt(x2) { + return x2 < 0 ? -Math.sqrt(-x2) : Math.sqrt(x2); + } + function transformSquare(x2) { + return x2 < 0 ? -x2 * x2 : x2 * x2; + } + function powish(transform2) { + var scale2 = transform2(identity$6, identity$6), exponent2 = 1; function rescale() { - return exponent === 1 ? transform((0, _continuousJs.identity), (0, _continuousJs.identity)) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - return (0, _linearJs.linearish)(scale); -} -function pow() { - var scale = powish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, pow()).exponent(scale.exponent()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} -function sqrt() { - return pow.apply(null, arguments).exponent(0.5); -} - -},{"./linear.js":"ik2PQ","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eL6SH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>radial); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function square(x) { - return Math.sign(x) * x * x; -} -function unsquare(x) { - return Math.sign(x) * Math.sqrt(Math.abs(x)); -} -function radial() { - var squared = (0, _continuousJsDefault.default)(), range = [ - 0, - 1 - ], round = false, unknown; - function scale(x) { - var y = unsquare(squared(x)); - return isNaN(y) ? unknown : round ? Math.round(y) : y; - } - scale.invert = function(y) { - return squared.invert(square(y)); - }; - scale.domain = function(_) { - return arguments.length ? (squared.domain(_), scale) : squared.domain(); - }; - scale.range = function(_) { - return arguments.length ? (squared.range((range = Array.from(_, (0, _numberJsDefault.default))).map(square)), scale) : range.slice(); - }; - scale.rangeRound = function(_) { - return scale.range(_).round(true); - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, scale) : round; - }; - scale.clamp = function(_) { - return arguments.length ? (squared.clamp(_), scale) : squared.clamp(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return radial(squared.domain(), range).round(round).clamp(squared.clamp()).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return (0, _linearJs.linearish)(scale); -} - -},{"./continuous.js":"2SYx4","./init.js":"ijd73","./linear.js":"ik2PQ","./number.js":"aUICk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ENbdr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function quantile() { - var domain = [], range = [], thresholds = [], unknown; + return exponent2 === 1 ? transform2(identity$6, identity$6) : exponent2 === 0.5 ? transform2(transformSqrt, transformSquare) : transform2(transformPow(exponent2), transformPow(1 / exponent2)); + } + scale2.exponent = function(_) { + return arguments.length ? (exponent2 = +_, rescale()) : exponent2; + }; + return linearish(scale2); + } + function pow$4() { + var scale2 = powish(transformer$3()); + scale2.copy = function() { + return copy$2(scale2, pow$4()).exponent(scale2.exponent()); + }; + initRange.apply(scale2, arguments); + return scale2; + } + function sqrt$3() { + return pow$4.apply(null, arguments).exponent(0.5); + } + function quantile() { + var domain2 = [], range2 = [], thresholds = [], unknown; function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while(++i < n)thresholds[i - 1] = (0, _d3Array.quantileSorted)(domain, i / n); - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : range[(0, _d3Array.bisect)(thresholds, x)]; - } - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : [ - i > 0 ? thresholds[i - 1] : domain[0], - i < thresholds.length ? thresholds[i] : domain[domain.length - 1] - ]; + var i = 0, n = Math.max(1, range2.length); + thresholds = new Array(n - 1); + while (++i < n) thresholds[i - 1] = quantileSorted(domain2, i / n); + return scale2; + } + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : range2[bisectRight$1(thresholds, x2)]; + } + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : [ + i > 0 ? thresholds[i - 1] : domain2[0], + i < thresholds.length ? thresholds[i] : domain2[domain2.length - 1] + ]; }; - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return rescale(); + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = []; + for (let d2 of _) if (d2 != null && !isNaN(d2 = +d2)) domain2.push(d2); + domain2.sort(ascending$2); + return rescale(); }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.quantiles = function() { - return thresholds.slice(); - }; - scale.copy = function() { - return quantile().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Cxz6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantize); -var _d3Array = require("d3-array"); -var _linearJs = require("./linear.js"); -var _initJs = require("./init.js"); -function quantize() { - var x0 = 0, x1 = 1, n = 1, domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.quantiles = function() { + return thresholds.slice(); + }; + scale2.copy = function() { + return quantile().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + function quantize$1() { + var x02 = 0, x12 = 1, n = 1, domain2 = [0.5], range2 = [0, 1], unknown; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; } function rescale() { - var i = -1; - domain = new Array(n); - while(++i < n)domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [ - x0, - x1 - ]; + var i = -1; + domain2 = new Array(n); + while (++i < n) domain2[i] = ((i + 1) * x12 - (i - n) * x02) / (n + 1); + return scale2; + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, x02 = +x02, x12 = +x12, rescale()) : [x02, x12]; }; - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : i < 1 ? [ - x0, - domain[0] - ] : i >= n ? [ - domain[n - 1], - x1 - ] : [ - domain[i - 1], - domain[i] - ]; + scale2.range = function(_) { + return arguments.length ? (n = (range2 = Array.from(_)).length - 1, rescale()) : range2.slice(); }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - scale.thresholds = function() { - return domain.slice(); - }; - scale.copy = function() { - return quantize().domain([ - x0, - x1 - ]).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply((0, _linearJs.linearish)(scale), arguments); -} - -},{"d3-array":"5lCYW","./linear.js":"ik2PQ","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lQqvO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>threshold); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function threshold() { - var domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown, n = 1; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; - } - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : i < 1 ? [x02, domain2[0]] : i >= n ? [domain2[n - 1], x12] : [domain2[i - 1], domain2[i]]; }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : scale2; }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [ - domain[i - 1], - domain[i] - ]; + scale2.thresholds = function() { + return domain2.slice(); }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return threshold().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"5lCYW","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dtq1F":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "calendar", ()=>calendar); -parcelHelpers.export(exports, "default", ()=>time); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -function date(t) { - return new Date(t); -} -function number(t) { - return t instanceof Date ? +t : +new Date(+t); -} -function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) { - var scale = (0, _continuousJsDefault.default)(), invert = scale.invert, domain = scale.domain; - var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y"); - function tickFormat(date) { - return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); - } - scale.invert = function(y) { - return new Date(invert(y)); - }; - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number)) : domain().map(date); - }; - scale.ticks = function(interval) { - var d = domain(); - return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval); - }; - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - scale.nice = function(interval) { - var d = domain(); - if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); - return interval ? domain((0, _niceJsDefault.default)(d, interval)) : scale; - }; - scale.copy = function() { - return (0, _continuousJs.copy)(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format)); - }; - return scale; -} -function time() { - return (0, _initJs.initRange).apply(calendar((0, _d3Time.timeTicks), (0, _d3Time.timeTickInterval), (0, _d3Time.timeYear), (0, _d3Time.timeMonth), (0, _d3Time.timeWeek), (0, _d3Time.timeDay), (0, _d3Time.timeHour), (0, _d3Time.timeMinute), (0, _d3Time.timeSecond), (0, _d3TimeFormat.timeFormat)).domain([ - new Date(2000, 0, 1), - new Date(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"6KMda","d3-time-format":"eC6Bi","./continuous.js":"2SYx4","./init.js":"ijd73","./nice.js":"ig9Ha","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6KMda":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>(0, _intervalJs.timeInterval)); -parcelHelpers.export(exports, "utcMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "utcMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "timeMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "timeMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "utcSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "utcSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "timeSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeMinute", ()=>(0, _minuteJs.timeMinute)); -parcelHelpers.export(exports, "timeMinutes", ()=>(0, _minuteJs.timeMinutes)); -parcelHelpers.export(exports, "utcMinute", ()=>(0, _minuteJs.utcMinute)); -parcelHelpers.export(exports, "utcMinutes", ()=>(0, _minuteJs.utcMinutes)); -parcelHelpers.export(exports, "timeHour", ()=>(0, _hourJs.timeHour)); -parcelHelpers.export(exports, "timeHours", ()=>(0, _hourJs.timeHours)); -parcelHelpers.export(exports, "utcHour", ()=>(0, _hourJs.utcHour)); -parcelHelpers.export(exports, "utcHours", ()=>(0, _hourJs.utcHours)); -parcelHelpers.export(exports, "timeDay", ()=>(0, _dayJs.timeDay)); -parcelHelpers.export(exports, "timeDays", ()=>(0, _dayJs.timeDays)); -parcelHelpers.export(exports, "utcDay", ()=>(0, _dayJs.utcDay)); -parcelHelpers.export(exports, "utcDays", ()=>(0, _dayJs.utcDays)); -parcelHelpers.export(exports, "unixDay", ()=>(0, _dayJs.unixDay)); -parcelHelpers.export(exports, "unixDays", ()=>(0, _dayJs.unixDays)); -parcelHelpers.export(exports, "timeWeek", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeWeeks", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeSunday", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeSundays", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeMonday", ()=>(0, _weekJs.timeMonday)); -parcelHelpers.export(exports, "timeMondays", ()=>(0, _weekJs.timeMondays)); -parcelHelpers.export(exports, "timeTuesday", ()=>(0, _weekJs.timeTuesday)); -parcelHelpers.export(exports, "timeTuesdays", ()=>(0, _weekJs.timeTuesdays)); -parcelHelpers.export(exports, "timeWednesday", ()=>(0, _weekJs.timeWednesday)); -parcelHelpers.export(exports, "timeWednesdays", ()=>(0, _weekJs.timeWednesdays)); -parcelHelpers.export(exports, "timeThursday", ()=>(0, _weekJs.timeThursday)); -parcelHelpers.export(exports, "timeThursdays", ()=>(0, _weekJs.timeThursdays)); -parcelHelpers.export(exports, "timeFriday", ()=>(0, _weekJs.timeFriday)); -parcelHelpers.export(exports, "timeFridays", ()=>(0, _weekJs.timeFridays)); -parcelHelpers.export(exports, "timeSaturday", ()=>(0, _weekJs.timeSaturday)); -parcelHelpers.export(exports, "timeSaturdays", ()=>(0, _weekJs.timeSaturdays)); -parcelHelpers.export(exports, "utcWeek", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcWeeks", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcSunday", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcSundays", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcMonday", ()=>(0, _weekJs.utcMonday)); -parcelHelpers.export(exports, "utcMondays", ()=>(0, _weekJs.utcMondays)); -parcelHelpers.export(exports, "utcTuesday", ()=>(0, _weekJs.utcTuesday)); -parcelHelpers.export(exports, "utcTuesdays", ()=>(0, _weekJs.utcTuesdays)); -parcelHelpers.export(exports, "utcWednesday", ()=>(0, _weekJs.utcWednesday)); -parcelHelpers.export(exports, "utcWednesdays", ()=>(0, _weekJs.utcWednesdays)); -parcelHelpers.export(exports, "utcThursday", ()=>(0, _weekJs.utcThursday)); -parcelHelpers.export(exports, "utcThursdays", ()=>(0, _weekJs.utcThursdays)); -parcelHelpers.export(exports, "utcFriday", ()=>(0, _weekJs.utcFriday)); -parcelHelpers.export(exports, "utcFridays", ()=>(0, _weekJs.utcFridays)); -parcelHelpers.export(exports, "utcSaturday", ()=>(0, _weekJs.utcSaturday)); -parcelHelpers.export(exports, "utcSaturdays", ()=>(0, _weekJs.utcSaturdays)); -parcelHelpers.export(exports, "timeMonth", ()=>(0, _monthJs.timeMonth)); -parcelHelpers.export(exports, "timeMonths", ()=>(0, _monthJs.timeMonths)); -parcelHelpers.export(exports, "utcMonth", ()=>(0, _monthJs.utcMonth)); -parcelHelpers.export(exports, "utcMonths", ()=>(0, _monthJs.utcMonths)); -parcelHelpers.export(exports, "timeYear", ()=>(0, _yearJs.timeYear)); -parcelHelpers.export(exports, "timeYears", ()=>(0, _yearJs.timeYears)); -parcelHelpers.export(exports, "utcYear", ()=>(0, _yearJs.utcYear)); -parcelHelpers.export(exports, "utcYears", ()=>(0, _yearJs.utcYears)); -parcelHelpers.export(exports, "utcTicks", ()=>(0, _ticksJs.utcTicks)); -parcelHelpers.export(exports, "utcTickInterval", ()=>(0, _ticksJs.utcTickInterval)); -parcelHelpers.export(exports, "timeTicks", ()=>(0, _ticksJs.timeTicks)); -parcelHelpers.export(exports, "timeTickInterval", ()=>(0, _ticksJs.timeTickInterval)); -var _intervalJs = require("./interval.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -var _ticksJs = require("./ticks.js"); - -},{"./interval.js":false,"./millisecond.js":"2UJoZ","./second.js":"bm0xM","./minute.js":"ifdFS","./hour.js":"xWpVx","./day.js":"aXPXh","./week.js":"1cvLV","./month.js":"764Za","./year.js":"4SlFD","./ticks.js":"9x0uu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9JWhy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -const t0 = new Date, t1 = new Date; -function timeInterval(floori, offseti, count, field) { - function interval(date) { - return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date; - } - interval.floor = (date)=>{ - return floori(date = new Date(+date)), date; - }; - interval.ceil = (date)=>{ - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - interval.round = (date)=>{ - const d0 = interval(date), d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - interval.offset = (date, step)=>{ - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - interval.range = (start, stop, step)=>{ - const range = []; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - let previous; - do range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - interval.filter = (test)=>{ - return timeInterval((date)=>{ - if (date >= date) while(floori(date), !test(date))date.setTime(date - 1); - }, (date, step)=>{ - if (date >= date) { - if (step < 0) while(++step <= 0){ - while(offseti(date, -1), !test(date)); // eslint-disable-line no-empty - } - else while(--step >= 0){ - while(offseti(date, 1), !test(date)); // eslint-disable-line no-empty - } - } - }); + scale2.copy = function() { + return quantize$1().domain([x02, x12]).range(range2).unknown(unknown); }; - if (count) { - interval.count = (start, end)=>{ - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - interval.every = (step)=>{ - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d)=>field(d) % step === 0 : (d)=>interval.count(0, d) % step === 0); - }; + return initRange.apply(linearish(scale2), arguments); + } + function threshold() { + var domain2 = [0.5], range2 = [0, 1], unknown, n = 1; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; } - return interval; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2UJoZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "millisecond", ()=>millisecond); -parcelHelpers.export(exports, "milliseconds", ()=>milliseconds); -var _intervalJs = require("./interval.js"); -const millisecond = (0, _intervalJs.timeInterval)(()=>{ -// noop -}, (date, step)=>{ - date.setTime(+date + step); -}, (start, end)=>{ + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : domain2.slice(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : range2.slice(); + }; + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return [domain2[i - 1], domain2[i]]; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return threshold().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + const t0$1 = /* @__PURE__ */ new Date(), t1 = /* @__PURE__ */ new Date(); + function timeInterval$1(floori, offseti, count2, field2) { + function interval2(date2) { + return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2; + } + interval2.floor = (date2) => { + return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2; + }; + interval2.ceil = (date2) => { + return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2; + }; + interval2.round = (date2) => { + const d0 = interval2(date2), d1 = interval2.ceil(date2); + return date2 - d0 < d1 - date2 ? d0 : d1; + }; + interval2.offset = (date2, step) => { + return offseti(date2 = /* @__PURE__ */ new Date(+date2), step == null ? 1 : Math.floor(step)), date2; + }; + interval2.range = (start, stop2, step) => { + const range2 = []; + start = interval2.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop2) || !(step > 0)) return range2; + let previous; + do + range2.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start); + while (previous < start && start < stop2); + return range2; + }; + interval2.filter = (test2) => { + return timeInterval$1((date2) => { + if (date2 >= date2) while (floori(date2), !test2(date2)) date2.setTime(date2 - 1); + }, (date2, step) => { + if (date2 >= date2) { + if (step < 0) while (++step <= 0) { + while (offseti(date2, -1), !test2(date2)) { + } + } + else while (--step >= 0) { + while (offseti(date2, 1), !test2(date2)) { + } + } + } + }); + }; + if (count2) { + interval2.count = (start, end) => { + t0$1.setTime(+start), t1.setTime(+end); + floori(t0$1), floori(t1); + return Math.floor(count2(t0$1, t1)); + }; + interval2.every = (step) => { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field2 ? (d2) => field2(d2) % step === 0 : (d2) => interval2.count(0, d2) % step === 0); + }; + } + return interval2; + } + const millisecond = timeInterval$1(() => { + }, (date2, step) => { + date2.setTime(+date2 + step); + }, (start, end) => { return end - start; -}); -// An optimized implementation for this simple case. -millisecond.every = (k)=>{ + }); + millisecond.every = (k) => { k = Math.floor(k); if (!isFinite(k) || !(k > 0)) return null; if (!(k > 1)) return millisecond; - return (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(Math.floor(date / k) * k); - }, (date, step)=>{ - date.setTime(+date + step * k); - }, (start, end)=>{ - return (end - start) / k; + return timeInterval$1((date2) => { + date2.setTime(Math.floor(date2 / k) * k); + }, (date2, step) => { + date2.setTime(+date2 + step * k); + }, (start, end) => { + return (end - start) / k; }); -}; -const milliseconds = millisecond.range; - -},{"./interval.js":"9JWhy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bm0xM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "second", ()=>second); -parcelHelpers.export(exports, "seconds", ()=>seconds); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const second = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds()); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationSecond)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationSecond); -}, (date)=>{ - return date.getUTCSeconds(); -}); -const seconds = second.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eRqDr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "durationSecond", ()=>durationSecond); -parcelHelpers.export(exports, "durationMinute", ()=>durationMinute); -parcelHelpers.export(exports, "durationHour", ()=>durationHour); -parcelHelpers.export(exports, "durationDay", ()=>durationDay); -parcelHelpers.export(exports, "durationWeek", ()=>durationWeek); -parcelHelpers.export(exports, "durationMonth", ()=>durationMonth); -parcelHelpers.export(exports, "durationYear", ()=>durationYear); -const durationSecond = 1000; -const durationMinute = durationSecond * 60; -const durationHour = durationMinute * 60; -const durationDay = durationHour * 24; -const durationWeek = durationDay * 7; -const durationMonth = durationDay * 30; -const durationYear = durationDay * 365; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ifdFS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMinute", ()=>timeMinute); -parcelHelpers.export(exports, "timeMinutes", ()=>timeMinutes); -parcelHelpers.export(exports, "utcMinute", ()=>utcMinute); -parcelHelpers.export(exports, "utcMinutes", ()=>utcMinutes); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getMinutes(); -}); -const timeMinutes = timeMinute.range; -const utcMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCSeconds(0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getUTCMinutes(); -}); -const utcMinutes = utcMinute.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"xWpVx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeHour", ()=>timeHour); -parcelHelpers.export(exports, "timeHours", ()=>timeHours); -parcelHelpers.export(exports, "utcHour", ()=>utcHour); -parcelHelpers.export(exports, "utcHours", ()=>utcHours); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond) - date.getMinutes() * (0, _durationJs.durationMinute)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getHours(); -}); -const timeHours = timeHour.range; -const utcHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMinutes(0, 0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getUTCHours(); -}); -const utcHours = utcHour.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aXPXh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeDay", ()=>timeDay); -parcelHelpers.export(exports, "timeDays", ()=>timeDays); -parcelHelpers.export(exports, "utcDay", ()=>utcDay); -parcelHelpers.export(exports, "utcDays", ()=>utcDays); -parcelHelpers.export(exports, "unixDay", ()=>unixDay); -parcelHelpers.export(exports, "unixDays", ()=>unixDays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeDay = (0, _intervalJs.timeInterval)((date)=>date.setHours(0, 0, 0, 0), (date, step)=>date.setDate(date.getDate() + step), (start, end)=>(end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationDay), (date)=>date.getDate() - 1); -const timeDays = timeDay.range; -const utcDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return date.getUTCDate() - 1; -}); -const utcDays = utcDay.range; -const unixDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return Math.floor(date / (0, _durationJs.durationDay)); -}); -const unixDays = unixDay.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1cvLV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeSunday", ()=>timeSunday); -parcelHelpers.export(exports, "timeMonday", ()=>timeMonday); -parcelHelpers.export(exports, "timeTuesday", ()=>timeTuesday); -parcelHelpers.export(exports, "timeWednesday", ()=>timeWednesday); -parcelHelpers.export(exports, "timeThursday", ()=>timeThursday); -parcelHelpers.export(exports, "timeFriday", ()=>timeFriday); -parcelHelpers.export(exports, "timeSaturday", ()=>timeSaturday); -parcelHelpers.export(exports, "timeSundays", ()=>timeSundays); -parcelHelpers.export(exports, "timeMondays", ()=>timeMondays); -parcelHelpers.export(exports, "timeTuesdays", ()=>timeTuesdays); -parcelHelpers.export(exports, "timeWednesdays", ()=>timeWednesdays); -parcelHelpers.export(exports, "timeThursdays", ()=>timeThursdays); -parcelHelpers.export(exports, "timeFridays", ()=>timeFridays); -parcelHelpers.export(exports, "timeSaturdays", ()=>timeSaturdays); -parcelHelpers.export(exports, "utcSunday", ()=>utcSunday); -parcelHelpers.export(exports, "utcMonday", ()=>utcMonday); -parcelHelpers.export(exports, "utcTuesday", ()=>utcTuesday); -parcelHelpers.export(exports, "utcWednesday", ()=>utcWednesday); -parcelHelpers.export(exports, "utcThursday", ()=>utcThursday); -parcelHelpers.export(exports, "utcFriday", ()=>utcFriday); -parcelHelpers.export(exports, "utcSaturday", ()=>utcSaturday); -parcelHelpers.export(exports, "utcSundays", ()=>utcSundays); -parcelHelpers.export(exports, "utcMondays", ()=>utcMondays); -parcelHelpers.export(exports, "utcTuesdays", ()=>utcTuesdays); -parcelHelpers.export(exports, "utcWednesdays", ()=>utcWednesdays); -parcelHelpers.export(exports, "utcThursdays", ()=>utcThursdays); -parcelHelpers.export(exports, "utcFridays", ()=>utcFridays); -parcelHelpers.export(exports, "utcSaturdays", ()=>utcSaturdays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -function timeWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setDate(date.getDate() + step * 7); - }, (start, end)=>{ - return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationWeek); + }; + millisecond.range; + const durationSecond$1 = 1e3; + const durationMinute$1 = durationSecond$1 * 60; + const durationHour$1 = durationMinute$1 * 60; + const durationDay$1 = durationHour$1 * 24; + const durationWeek$1 = durationDay$1 * 7; + const durationMonth$1 = durationDay$1 * 30; + const durationYear$1 = durationDay$1 * 365; + const second = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds()); + }, (date2, step) => { + date2.setTime(+date2 + step * durationSecond$1); + }, (start, end) => { + return (end - start) / durationSecond$1; + }, (date2) => { + return date2.getUTCSeconds(); + }); + second.range; + const timeMinute = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getMinutes(); + }); + timeMinute.range; + const utcMinute = timeInterval$1((date2) => { + date2.setUTCSeconds(0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getUTCMinutes(); + }); + utcMinute.range; + const timeHour = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1 - date2.getMinutes() * durationMinute$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getHours(); + }); + timeHour.range; + const utcHour = timeInterval$1((date2) => { + date2.setUTCMinutes(0, 0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getUTCHours(); + }); + utcHour.range; + const timeDay = timeInterval$1( + (date2) => date2.setHours(0, 0, 0, 0), + (date2, step) => date2.setDate(date2.getDate() + step), + (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, + (date2) => date2.getDate() - 1 + ); + timeDay.range; + const utcDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return date2.getUTCDate() - 1; + }); + utcDay.range; + const unixDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return Math.floor(date2 / durationDay$1); + }); + unixDay.range; + function timeWeekday(i) { + return timeInterval$1((date2) => { + date2.setDate(date2.getDate() - (date2.getDay() + 7 - i) % 7); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setDate(date2.getDate() + step * 7); + }, (start, end) => { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1; }); -} -const timeSunday = timeWeekday(0); -const timeMonday = timeWeekday(1); -const timeTuesday = timeWeekday(2); -const timeWednesday = timeWeekday(3); -const timeThursday = timeWeekday(4); -const timeFriday = timeWeekday(5); -const timeSaturday = timeWeekday(6); -const timeSundays = timeSunday.range; -const timeMondays = timeMonday.range; -const timeTuesdays = timeTuesday.range; -const timeWednesdays = timeWednesday.range; -const timeThursdays = timeThursday.range; -const timeFridays = timeFriday.range; -const timeSaturdays = timeSaturday.range; -function utcWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step * 7); - }, (start, end)=>{ - return (end - start) / (0, _durationJs.durationWeek); + } + const timeSunday = timeWeekday(0); + const timeMonday = timeWeekday(1); + const timeTuesday = timeWeekday(2); + const timeWednesday = timeWeekday(3); + const timeThursday = timeWeekday(4); + const timeFriday = timeWeekday(5); + const timeSaturday = timeWeekday(6); + timeSunday.range; + timeMonday.range; + timeTuesday.range; + timeWednesday.range; + timeThursday.range; + timeFriday.range; + timeSaturday.range; + function utcWeekday(i) { + return timeInterval$1((date2) => { + date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i) % 7); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step * 7); + }, (start, end) => { + return (end - start) / durationWeek$1; }); -} -const utcSunday = utcWeekday(0); -const utcMonday = utcWeekday(1); -const utcTuesday = utcWeekday(2); -const utcWednesday = utcWeekday(3); -const utcThursday = utcWeekday(4); -const utcFriday = utcWeekday(5); -const utcSaturday = utcWeekday(6); -const utcSundays = utcSunday.range; -const utcMondays = utcMonday.range; -const utcTuesdays = utcTuesday.range; -const utcWednesdays = utcWednesday.range; -const utcThursdays = utcThursday.range; -const utcFridays = utcFriday.range; -const utcSaturdays = utcSaturday.range; - -},{"./interval.js":"9JWhy","./duration.js":"eRqDr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"764Za":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMonth", ()=>timeMonth); -parcelHelpers.export(exports, "timeMonths", ()=>timeMonths); -parcelHelpers.export(exports, "utcMonth", ()=>utcMonth); -parcelHelpers.export(exports, "utcMonths", ()=>utcMonths); -var _intervalJs = require("./interval.js"); -const timeMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setMonth(date.getMonth() + step); -}, (start, end)=>{ + } + const utcSunday = utcWeekday(0); + const utcMonday = utcWeekday(1); + const utcTuesday = utcWeekday(2); + const utcWednesday = utcWeekday(3); + const utcThursday = utcWeekday(4); + const utcFriday = utcWeekday(5); + const utcSaturday = utcWeekday(6); + utcSunday.range; + utcMonday.range; + utcTuesday.range; + utcWednesday.range; + utcThursday.range; + utcFriday.range; + utcSaturday.range; + const timeMonth = timeInterval$1((date2) => { + date2.setDate(1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setMonth(date2.getMonth() + step); + }, (start, end) => { return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; -}, (date)=>{ - return date.getMonth(); -}); -const timeMonths = timeMonth.range; -const utcMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCMonth(date.getUTCMonth() + step); -}, (start, end)=>{ + }, (date2) => { + return date2.getMonth(); + }); + timeMonth.range; + const utcMonth = timeInterval$1((date2) => { + date2.setUTCDate(1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCMonth(date2.getUTCMonth() + step); + }, (start, end) => { return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; -}, (date)=>{ - return date.getUTCMonth(); -}); -const utcMonths = utcMonth.range; - -},{"./interval.js":"9JWhy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4SlFD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeYear", ()=>timeYear); -parcelHelpers.export(exports, "timeYears", ()=>timeYears); -parcelHelpers.export(exports, "utcYear", ()=>utcYear); -parcelHelpers.export(exports, "utcYears", ()=>utcYears); -var _intervalJs = require("./interval.js"); -const timeYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setFullYear(date.getFullYear() + step); -}, (start, end)=>{ + }, (date2) => { + return date2.getUTCMonth(); + }); + utcMonth.range; + const timeYear = timeInterval$1((date2) => { + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step); + }, (start, end) => { return end.getFullYear() - start.getFullYear(); -}, (date)=>{ - return date.getFullYear(); -}); -// An optimized implementation for this simple case. -timeYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setFullYear(Math.floor(date.getFullYear() / k) * k); - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setFullYear(date.getFullYear() + step * k); + }, (date2) => { + return date2.getFullYear(); + }); + timeYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setFullYear(Math.floor(date2.getFullYear() / k) * k); + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step * k); }); -}; -const timeYears = timeYear.range; -const utcYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step); -}, (start, end)=>{ + }; + timeYear.range; + const utcYear = timeInterval$1((date2) => { + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step); + }, (start, end) => { return end.getUTCFullYear() - start.getUTCFullYear(); -}, (date)=>{ - return date.getUTCFullYear(); -}); -// An optimized implementation for this simple case. -utcYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step * k); + }, (date2) => { + return date2.getUTCFullYear(); + }); + utcYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k) * k); + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step * k); }); -}; -const utcYears = utcYear.range; - -},{"./interval.js":"9JWhy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9x0uu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "utcTicks", ()=>utcTicks); -parcelHelpers.export(exports, "utcTickInterval", ()=>utcTickInterval); -parcelHelpers.export(exports, "timeTicks", ()=>timeTicks); -parcelHelpers.export(exports, "timeTickInterval", ()=>timeTickInterval); -var _d3Array = require("d3-array"); -var _durationJs = require("./duration.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -function ticker(year, month, week, day, hour, minute) { + }; + utcYear.range; + function ticker(year, month, week2, day, hour, minute) { const tickIntervals = [ - [ - (0, _secondJs.second), - 1, - (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 5, - 5 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 15, - 15 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 30, - 30 * (0, _durationJs.durationSecond) - ], - [ - minute, - 1, - (0, _durationJs.durationMinute) - ], - [ - minute, - 5, - 5 * (0, _durationJs.durationMinute) - ], - [ - minute, - 15, - 15 * (0, _durationJs.durationMinute) - ], - [ - minute, - 30, - 30 * (0, _durationJs.durationMinute) - ], - [ - hour, - 1, - (0, _durationJs.durationHour) - ], - [ - hour, - 3, - 3 * (0, _durationJs.durationHour) - ], - [ - hour, - 6, - 6 * (0, _durationJs.durationHour) - ], - [ - hour, - 12, - 12 * (0, _durationJs.durationHour) - ], - [ - day, - 1, - (0, _durationJs.durationDay) - ], - [ - day, - 2, - 2 * (0, _durationJs.durationDay) - ], - [ - week, - 1, - (0, _durationJs.durationWeek) - ], - [ - month, - 1, - (0, _durationJs.durationMonth) - ], - [ - month, - 3, - 3 * (0, _durationJs.durationMonth) - ], - [ - year, - 1, - (0, _durationJs.durationYear) - ] + [second, 1, durationSecond$1], + [second, 5, 5 * durationSecond$1], + [second, 15, 15 * durationSecond$1], + [second, 30, 30 * durationSecond$1], + [minute, 1, durationMinute$1], + [minute, 5, 5 * durationMinute$1], + [minute, 15, 15 * durationMinute$1], + [minute, 30, 30 * durationMinute$1], + [hour, 1, durationHour$1], + [hour, 3, 3 * durationHour$1], + [hour, 6, 6 * durationHour$1], + [hour, 12, 12 * durationHour$1], + [day, 1, durationDay$1], + [day, 2, 2 * durationDay$1], + [week2, 1, durationWeek$1], + [month, 1, durationMonth$1], + [month, 3, 3 * durationMonth$1], + [year, 1, durationYear$1] ]; - function ticks(start, stop, count) { - const reverse = stop < start; - if (reverse) [start, stop] = [ - stop, - start - ]; - const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count); - const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop - return reverse ? ticks.reverse() : ticks; - } - function tickInterval(start, stop, count) { - const target = Math.abs(stop - start) / count; - const i = (0, _d3Array.bisector)(([, , step])=>step).right(tickIntervals, target); - if (i === tickIntervals.length) return year.every((0, _d3Array.tickStep)(start / (0, _durationJs.durationYear), stop / (0, _durationJs.durationYear), count)); - if (i === 0) return (0, _millisecondJs.millisecond).every(Math.max((0, _d3Array.tickStep)(start, stop, count), 1)); - const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - return t.every(step); + function ticks2(start, stop2, count2) { + const reverse2 = stop2 < start; + if (reverse2) [start, stop2] = [stop2, start]; + const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval(start, stop2, count2); + const ticks3 = interval2 ? interval2.range(start, +stop2 + 1) : []; + return reverse2 ? ticks3.reverse() : ticks3; + } + function tickInterval(start, stop2, count2) { + const target2 = Math.abs(stop2 - start) / count2; + const i = bisector(([, , step2]) => step2).right(tickIntervals, target2); + if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop2 / durationYear$1, count2)); + if (i === 0) return millisecond.every(Math.max(tickStep(start, stop2, count2), 1)); + const [t, step] = tickIntervals[target2 / tickIntervals[i - 1][2] < tickIntervals[i][2] / target2 ? i - 1 : i]; + return t.every(step); + } + return [ticks2, tickInterval]; + } + const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute); + const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute); + function localDate$1(d2) { + if (0 <= d2.y && d2.y < 100) { + var date2 = new Date(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L); + date2.setFullYear(d2.y); + return date2; + } + return new Date(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L); + } + function utcDate$1(d2) { + if (0 <= d2.y && d2.y < 100) { + var date2 = new Date(Date.UTC(-1, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L)); + date2.setUTCFullYear(d2.y); + return date2; } - return [ - ticks, - tickInterval - ]; -} -const [utcTicks, utcTickInterval] = ticker((0, _yearJs.utcYear), (0, _monthJs.utcMonth), (0, _weekJs.utcSunday), (0, _dayJs.unixDay), (0, _hourJs.utcHour), (0, _minuteJs.utcMinute)); -const [timeTicks, timeTickInterval] = ticker((0, _yearJs.timeYear), (0, _monthJs.timeMonth), (0, _weekJs.timeSunday), (0, _dayJs.timeDay), (0, _hourJs.timeHour), (0, _minuteJs.timeMinute)); - -},{"d3-array":"5lCYW","./duration.js":"eRqDr","./millisecond.js":"2UJoZ","./second.js":"bm0xM","./minute.js":"ifdFS","./hour.js":"xWpVx","./day.js":"aXPXh","./week.js":"1cvLV","./month.js":"764Za","./year.js":"4SlFD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eC6Bi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "timeFormat", ()=>(0, _defaultLocaleJs.timeFormat)); -parcelHelpers.export(exports, "timeParse", ()=>(0, _defaultLocaleJs.timeParse)); -parcelHelpers.export(exports, "utcFormat", ()=>(0, _defaultLocaleJs.utcFormat)); -parcelHelpers.export(exports, "utcParse", ()=>(0, _defaultLocaleJs.utcParse)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "isoFormat", ()=>(0, _isoFormatJsDefault.default)); -parcelHelpers.export(exports, "isoParse", ()=>(0, _isoParseJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _isoFormatJs = require("./isoFormat.js"); -var _isoFormatJsDefault = parcelHelpers.interopDefault(_isoFormatJs); -var _isoParseJs = require("./isoParse.js"); -var _isoParseJsDefault = parcelHelpers.interopDefault(_isoParseJs); - -},{"./defaultLocale.js":"dYsS4","./locale.js":"hOUzu","./isoFormat.js":false,"./isoParse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dYsS4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var timeFormat; -var timeParse; -var utcFormat; -var utcParse; -defaultLocale({ + return new Date(Date.UTC(d2.y, d2.m, d2.d, d2.H, d2.M, d2.S, d2.L)); + } + function newDate(y2, m2, d2) { + return { y: y2, m: m2, d: d2, H: 0, M: 0, S: 0, L: 0 }; + } + function formatLocale$1(locale2) { + var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths; + var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); + var formats2 = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "f": formatMicroseconds, + "g": formatYearISO, + "G": formatFullYearISO, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "q": formatQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatSeconds, + "u": formatWeekdayNumberMonday, + "U": formatWeekNumberSunday, + "V": formatWeekNumberISO, + "w": formatWeekdayNumberSunday, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear$1, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "f": formatUTCMicroseconds, + "g": formatUTCYearISO, + "G": formatUTCFullYearISO, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "q": formatUTCQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatUTCSeconds, + "u": formatUTCWeekdayNumberMonday, + "U": formatUTCWeekNumberSunday, + "V": formatUTCWeekNumberISO, + "w": formatUTCWeekdayNumberSunday, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "f": parseMicroseconds, + "g": parseYear, + "G": parseFullYear, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "q": parseQuarter, + "Q": parseUnixTimestamp, + "s": parseUnixTimestampSeconds, + "S": parseSeconds, + "u": parseWeekdayNumberMonday, + "U": parseWeekNumberSunday, + "V": parseWeekNumberISO, + "w": parseWeekdayNumberSunday, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + formats2.x = newFormat(locale_date, formats2); + formats2.X = newFormat(locale_time, formats2); + formats2.c = newFormat(locale_dateTime, formats2); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + function newFormat(specifier, formats3) { + return function(date2) { + var string2 = [], i = -1, j = 0, n = specifier.length, c2, pad2, format2; + if (!(date2 instanceof Date)) date2 = /* @__PURE__ */ new Date(+date2); + while (++i < n) { + if (specifier.charCodeAt(i) === 37) { + string2.push(specifier.slice(j, i)); + if ((pad2 = pads[c2 = specifier.charAt(++i)]) != null) c2 = specifier.charAt(++i); + else pad2 = c2 === "e" ? " " : "0"; + if (format2 = formats3[c2]) c2 = format2(date2, pad2); + string2.push(c2); + j = i + 1; + } + } + string2.push(specifier.slice(j, i)); + return string2.join(""); + }; + } + function newParse(specifier, Z3) { + return function(string2) { + var d2 = newDate(1900, void 0, 1), i = parseSpecifier(d2, specifier, string2 += "", 0), week2, day; + if (i != string2.length) return null; + if ("Q" in d2) return new Date(d2.Q); + if ("s" in d2) return new Date(d2.s * 1e3 + ("L" in d2 ? d2.L : 0)); + if (Z3 && !("Z" in d2)) d2.Z = 0; + if ("p" in d2) d2.H = d2.H % 12 + d2.p * 12; + if (d2.m === void 0) d2.m = "q" in d2 ? d2.q : 0; + if ("V" in d2) { + if (d2.V < 1 || d2.V > 53) return null; + if (!("w" in d2)) d2.w = 1; + if ("Z" in d2) { + week2 = utcDate$1(newDate(d2.y, 0, 1)), day = week2.getUTCDay(); + week2 = day > 4 || day === 0 ? utcMonday.ceil(week2) : utcMonday(week2); + week2 = utcDay.offset(week2, (d2.V - 1) * 7); + d2.y = week2.getUTCFullYear(); + d2.m = week2.getUTCMonth(); + d2.d = week2.getUTCDate() + (d2.w + 6) % 7; + } else { + week2 = localDate$1(newDate(d2.y, 0, 1)), day = week2.getDay(); + week2 = day > 4 || day === 0 ? timeMonday.ceil(week2) : timeMonday(week2); + week2 = timeDay.offset(week2, (d2.V - 1) * 7); + d2.y = week2.getFullYear(); + d2.m = week2.getMonth(); + d2.d = week2.getDate() + (d2.w + 6) % 7; + } + } else if ("W" in d2 || "U" in d2) { + if (!("w" in d2)) d2.w = "u" in d2 ? d2.u % 7 : "W" in d2 ? 1 : 0; + day = "Z" in d2 ? utcDate$1(newDate(d2.y, 0, 1)).getUTCDay() : localDate$1(newDate(d2.y, 0, 1)).getDay(); + d2.m = 0; + d2.d = "W" in d2 ? (d2.w + 6) % 7 + d2.W * 7 - (day + 5) % 7 : d2.w + d2.U * 7 - (day + 6) % 7; + } + if ("Z" in d2) { + d2.H += d2.Z / 100 | 0; + d2.M += d2.Z % 100; + return utcDate$1(d2); + } + return localDate$1(d2); + }; + } + function parseSpecifier(d2, specifier, string2, j) { + var i = 0, n = specifier.length, m2 = string2.length, c2, parse2; + while (i < n) { + if (j >= m2) return -1; + c2 = specifier.charCodeAt(i++); + if (c2 === 37) { + c2 = specifier.charAt(i++); + parse2 = parses[c2 in pads ? specifier.charAt(i++) : c2]; + if (!parse2 || (j = parse2(d2, string2, j)) < 0) return -1; + } else if (c2 != string2.charCodeAt(j++)) { + return -1; + } + } + return j; + } + function parsePeriod(d2, string2, i) { + var n = periodRe.exec(string2.slice(i)); + return n ? (d2.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseShortWeekday(d2, string2, i) { + var n = shortWeekdayRe.exec(string2.slice(i)); + return n ? (d2.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseWeekday(d2, string2, i) { + var n = weekdayRe.exec(string2.slice(i)); + return n ? (d2.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseShortMonth(d2, string2, i) { + var n = shortMonthRe.exec(string2.slice(i)); + return n ? (d2.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseMonth(d2, string2, i) { + var n = monthRe.exec(string2.slice(i)); + return n ? (d2.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + } + function parseLocaleDateTime(d2, string2, i) { + return parseSpecifier(d2, locale_dateTime, string2, i); + } + function parseLocaleDate(d2, string2, i) { + return parseSpecifier(d2, locale_date, string2, i); + } + function parseLocaleTime(d2, string2, i) { + return parseSpecifier(d2, locale_time, string2, i); + } + function formatShortWeekday(d2) { + return locale_shortWeekdays[d2.getDay()]; + } + function formatWeekday(d2) { + return locale_weekdays[d2.getDay()]; + } + function formatShortMonth(d2) { + return locale_shortMonths[d2.getMonth()]; + } + function formatMonth(d2) { + return locale_months[d2.getMonth()]; + } + function formatPeriod(d2) { + return locale_periods[+(d2.getHours() >= 12)]; + } + function formatQuarter(d2) { + return 1 + ~~(d2.getMonth() / 3); + } + function formatUTCShortWeekday(d2) { + return locale_shortWeekdays[d2.getUTCDay()]; + } + function formatUTCWeekday(d2) { + return locale_weekdays[d2.getUTCDay()]; + } + function formatUTCShortMonth(d2) { + return locale_shortMonths[d2.getUTCMonth()]; + } + function formatUTCMonth(d2) { + return locale_months[d2.getUTCMonth()]; + } + function formatUTCPeriod(d2) { + return locale_periods[+(d2.getUTCHours() >= 12)]; + } + function formatUTCQuarter(d2) { + return 1 + ~~(d2.getUTCMonth() / 3); + } + return { + format: function(specifier) { + var f = newFormat(specifier += "", formats2); + f.toString = function() { + return specifier; + }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", false); + p.toString = function() { + return specifier; + }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { + return specifier; + }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier += "", true); + p.toString = function() { + return specifier; + }; + return p; + } + }; + } + var pads = { "-": "", "_": " ", "0": "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; + function pad$2(value2, fill2, width2) { + var sign2 = value2 < 0 ? "-" : "", string2 = (sign2 ? -value2 : value2) + "", length2 = string2.length; + return sign2 + (length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) + string2 : string2); + } + function requote(s2) { + return s2.replace(requoteRe, "\\$&"); + } + function formatRe(names) { + return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); + } + function formatLookup(names) { + return new Map(names.map((name, i) => [name.toLowerCase(), i])); + } + function parseWeekdayNumberSunday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); + return n ? (d2.w = +n[0], i + n[0].length) : -1; + } + function parseWeekdayNumberMonday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); + return n ? (d2.u = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberSunday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.U = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberISO(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.V = +n[0], i + n[0].length) : -1; + } + function parseWeekNumberMonday(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.W = +n[0], i + n[0].length) : -1; + } + function parseFullYear(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 4)); + return n ? (d2.y = +n[0], i + n[0].length) : -1; + } + function parseYear(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; + } + function parseZone(d2, string2, i) { + var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string2.slice(i, i + 6)); + return n ? (d2.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; + } + function parseQuarter(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); + return n ? (d2.q = n[0] * 3 - 3, i + n[0].length) : -1; + } + function parseMonthNumber(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.m = n[0] - 1, i + n[0].length) : -1; + } + function parseDayOfMonth(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.d = +n[0], i + n[0].length) : -1; + } + function parseDayOfYear(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); + return n ? (d2.m = 0, d2.d = +n[0], i + n[0].length) : -1; + } + function parseHour24(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.H = +n[0], i + n[0].length) : -1; + } + function parseMinutes(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.M = +n[0], i + n[0].length) : -1; + } + function parseSeconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d2.S = +n[0], i + n[0].length) : -1; + } + function parseMilliseconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); + return n ? (d2.L = +n[0], i + n[0].length) : -1; + } + function parseMicroseconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 6)); + return n ? (d2.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; + } + function parseLiteralPercent(d2, string2, i) { + var n = percentRe.exec(string2.slice(i, i + 1)); + return n ? i + n[0].length : -1; + } + function parseUnixTimestamp(d2, string2, i) { + var n = numberRe.exec(string2.slice(i)); + return n ? (d2.Q = +n[0], i + n[0].length) : -1; + } + function parseUnixTimestampSeconds(d2, string2, i) { + var n = numberRe.exec(string2.slice(i)); + return n ? (d2.s = +n[0], i + n[0].length) : -1; + } + function formatDayOfMonth(d2, p) { + return pad$2(d2.getDate(), p, 2); + } + function formatHour24(d2, p) { + return pad$2(d2.getHours(), p, 2); + } + function formatHour12(d2, p) { + return pad$2(d2.getHours() % 12 || 12, p, 2); + } + function formatDayOfYear(d2, p) { + return pad$2(1 + timeDay.count(timeYear(d2), d2), p, 3); + } + function formatMilliseconds(d2, p) { + return pad$2(d2.getMilliseconds(), p, 3); + } + function formatMicroseconds(d2, p) { + return formatMilliseconds(d2, p) + "000"; + } + function formatMonthNumber(d2, p) { + return pad$2(d2.getMonth() + 1, p, 2); + } + function formatMinutes(d2, p) { + return pad$2(d2.getMinutes(), p, 2); + } + function formatSeconds(d2, p) { + return pad$2(d2.getSeconds(), p, 2); + } + function formatWeekdayNumberMonday(d2) { + var day = d2.getDay(); + return day === 0 ? 7 : day; + } + function formatWeekNumberSunday(d2, p) { + return pad$2(timeSunday.count(timeYear(d2) - 1, d2), p, 2); + } + function dISO(d2) { + var day = d2.getDay(); + return day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2); + } + function formatWeekNumberISO(d2, p) { + d2 = dISO(d2); + return pad$2(timeThursday.count(timeYear(d2), d2) + (timeYear(d2).getDay() === 4), p, 2); + } + function formatWeekdayNumberSunday(d2) { + return d2.getDay(); + } + function formatWeekNumberMonday(d2, p) { + return pad$2(timeMonday.count(timeYear(d2) - 1, d2), p, 2); + } + function formatYear$1(d2, p) { + return pad$2(d2.getFullYear() % 100, p, 2); + } + function formatYearISO(d2, p) { + d2 = dISO(d2); + return pad$2(d2.getFullYear() % 100, p, 2); + } + function formatFullYear(d2, p) { + return pad$2(d2.getFullYear() % 1e4, p, 4); + } + function formatFullYearISO(d2, p) { + var day = d2.getDay(); + d2 = day >= 4 || day === 0 ? timeThursday(d2) : timeThursday.ceil(d2); + return pad$2(d2.getFullYear() % 1e4, p, 4); + } + function formatZone(d2) { + var z2 = d2.getTimezoneOffset(); + return (z2 > 0 ? "-" : (z2 *= -1, "+")) + pad$2(z2 / 60 | 0, "0", 2) + pad$2(z2 % 60, "0", 2); + } + function formatUTCDayOfMonth(d2, p) { + return pad$2(d2.getUTCDate(), p, 2); + } + function formatUTCHour24(d2, p) { + return pad$2(d2.getUTCHours(), p, 2); + } + function formatUTCHour12(d2, p) { + return pad$2(d2.getUTCHours() % 12 || 12, p, 2); + } + function formatUTCDayOfYear(d2, p) { + return pad$2(1 + utcDay.count(utcYear(d2), d2), p, 3); + } + function formatUTCMilliseconds(d2, p) { + return pad$2(d2.getUTCMilliseconds(), p, 3); + } + function formatUTCMicroseconds(d2, p) { + return formatUTCMilliseconds(d2, p) + "000"; + } + function formatUTCMonthNumber(d2, p) { + return pad$2(d2.getUTCMonth() + 1, p, 2); + } + function formatUTCMinutes(d2, p) { + return pad$2(d2.getUTCMinutes(), p, 2); + } + function formatUTCSeconds(d2, p) { + return pad$2(d2.getUTCSeconds(), p, 2); + } + function formatUTCWeekdayNumberMonday(d2) { + var dow = d2.getUTCDay(); + return dow === 0 ? 7 : dow; + } + function formatUTCWeekNumberSunday(d2, p) { + return pad$2(utcSunday.count(utcYear(d2) - 1, d2), p, 2); + } + function UTCdISO(d2) { + var day = d2.getUTCDay(); + return day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2); + } + function formatUTCWeekNumberISO(d2, p) { + d2 = UTCdISO(d2); + return pad$2(utcThursday.count(utcYear(d2), d2) + (utcYear(d2).getUTCDay() === 4), p, 2); + } + function formatUTCWeekdayNumberSunday(d2) { + return d2.getUTCDay(); + } + function formatUTCWeekNumberMonday(d2, p) { + return pad$2(utcMonday.count(utcYear(d2) - 1, d2), p, 2); + } + function formatUTCYear(d2, p) { + return pad$2(d2.getUTCFullYear() % 100, p, 2); + } + function formatUTCYearISO(d2, p) { + d2 = UTCdISO(d2); + return pad$2(d2.getUTCFullYear() % 100, p, 2); + } + function formatUTCFullYear(d2, p) { + return pad$2(d2.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCFullYearISO(d2, p) { + var day = d2.getUTCDay(); + d2 = day >= 4 || day === 0 ? utcThursday(d2) : utcThursday.ceil(d2); + return pad$2(d2.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCZone() { + return "+0000"; + } + function formatLiteralPercent() { + return "%"; + } + function formatUnixTimestamp(d2) { + return +d2; + } + function formatUnixTimestampSeconds(d2) { + return Math.floor(+d2 / 1e3); + } + var locale$2; + var timeFormat$1; + var timeParse$1; + var utcFormat$1; + var utcParse$1; + defaultLocale$2({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", - periods: [ - "AM", - "PM" - ], - days: [ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday" - ], - shortDays: [ - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat" - ], - months: [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" - ], - shortMonths: [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - timeFormat = locale.format; - timeParse = locale.parse; - utcFormat = locale.utcFormat; - utcParse = locale.utcParse; - return locale; -} - -},{"./locale.js":"hOUzu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hOUzu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatLocale); -var _d3Time = require("d3-time"); -function localDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); - date.setFullYear(d.y); - return date; - } - return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); -} -function utcDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); -} -function newDate(y, m, d) { - return { - y: y, - m: m, - d: d, - H: 0, - M: 0, - S: 0, - L: 0 - }; -} -function formatLocale(locale) { - var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; - var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); - var formats = { - "a": formatShortWeekday, - "A": formatWeekday, - "b": formatShortMonth, - "B": formatMonth, - "c": null, - "d": formatDayOfMonth, - "e": formatDayOfMonth, - "f": formatMicroseconds, - "g": formatYearISO, - "G": formatFullYearISO, - "H": formatHour24, - "I": formatHour12, - "j": formatDayOfYear, - "L": formatMilliseconds, - "m": formatMonthNumber, - "M": formatMinutes, - "p": formatPeriod, - "q": formatQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatSeconds, - "u": formatWeekdayNumberMonday, - "U": formatWeekNumberSunday, - "V": formatWeekNumberISO, - "w": formatWeekdayNumberSunday, - "W": formatWeekNumberMonday, - "x": null, - "X": null, - "y": formatYear, - "Y": formatFullYear, - "Z": formatZone, - "%": formatLiteralPercent + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + }); + function defaultLocale$2(definition2) { + locale$2 = formatLocale$1(definition2); + timeFormat$1 = locale$2.format; + timeParse$1 = locale$2.parse; + utcFormat$1 = locale$2.utcFormat; + utcParse$1 = locale$2.utcParse; + return locale$2; + } + function date(t) { + return new Date(t); + } + function number$4(t) { + return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t); + } + function calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2) { + var scale2 = continuous$1(), invert2 = scale2.invert, domain2 = scale2.domain; + var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear2 = format2("%Y"); + function tickFormat2(date2) { + return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week2(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2); + } + scale2.invert = function(y2) { + return new Date(invert2(y2)); + }; + scale2.domain = function(_) { + return arguments.length ? domain2(Array.from(_, number$4)) : domain2().map(date); + }; + scale2.ticks = function(interval2) { + var d2 = domain2(); + return ticks2(d2[0], d2[d2.length - 1], interval2 == null ? 10 : interval2); + }; + scale2.tickFormat = function(count2, specifier) { + return specifier == null ? tickFormat2 : format2(specifier); + }; + scale2.nice = function(interval2) { + var d2 = domain2(); + if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval(d2[0], d2[d2.length - 1], interval2 == null ? 10 : interval2); + return interval2 ? domain2(nice(d2, interval2)) : scale2; + }; + scale2.copy = function() { + return copy$2(scale2, calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2)); + }; + return scale2; + } + function time$1() { + return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat$1).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); + } + function utcTime() { + return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat$1).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); + } + function transformer$2() { + var x02 = 0, x12 = 1, t02, t12, k10, transform2, interpolator = identity$6, clamp2 = false, unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : interpolator(k10 === 0 ? 0.5 : (x2 = (transform2(x2) - t02) * k10, clamp2 ? Math.max(0, Math.min(1, x2)) : x2)); + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02), scale2) : [x02, x12]; + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1; + return arguments.length ? ([r0, r1] = _, interpolator = interpolate2(r0, r1), scale2) : [interpolator(0), interpolator(1)]; + }; + } + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + return function(t) { + transform2 = t, t02 = t(x02), t12 = t(x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02); + return scale2; + }; + } + function copy$1(source2, target2) { + return target2.domain(source2.domain()).interpolator(source2.interpolator()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function sequential() { + var scale2 = linearish(transformer$2()(identity$6)); + scale2.copy = function() { + return copy$1(scale2, sequential()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialLog() { + var scale2 = loggish(transformer$2()).domain([1, 10]); + scale2.copy = function() { + return copy$1(scale2, sequentialLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSymlog() { + var scale2 = symlogish(transformer$2()); + scale2.copy = function() { + return copy$1(scale2, sequentialSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialPow() { + var scale2 = powish(transformer$2()); + scale2.copy = function() { + return copy$1(scale2, sequentialPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSqrt() { + return sequentialPow.apply(null, arguments).exponent(0.5); + } + function transformer$1() { + var x02 = 0, x12 = 0.5, x2 = 1, s2 = 1, t02, t12, t22, k10, k21, interpolator = identity$6, transform2, clamp2 = false, unknown; + function scale2(x3) { + return isNaN(x3 = +x3) ? unknown : (x3 = 0.5 + ((x3 = +transform2(x3)) - t12) * (s2 * x3 < s2 * t12 ? k10 : k21), interpolator(clamp2 ? Math.max(0, Math.min(1, x3)) : x3)); + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12, x2] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), t22 = transform2(x2 = +x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1, scale2) : [x02, x12, x2]; + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1, r2; + return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate2, [r0, r1, r2]), scale2) : [interpolator(0), interpolator(0.5), interpolator(1)]; + }; + } + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; - var utcFormats = { - "a": formatUTCShortWeekday, - "A": formatUTCWeekday, - "b": formatUTCShortMonth, - "B": formatUTCMonth, - "c": null, - "d": formatUTCDayOfMonth, - "e": formatUTCDayOfMonth, - "f": formatUTCMicroseconds, - "g": formatUTCYearISO, - "G": formatUTCFullYearISO, - "H": formatUTCHour24, - "I": formatUTCHour12, - "j": formatUTCDayOfYear, - "L": formatUTCMilliseconds, - "m": formatUTCMonthNumber, - "M": formatUTCMinutes, - "p": formatUTCPeriod, - "q": formatUTCQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatUTCSeconds, - "u": formatUTCWeekdayNumberMonday, - "U": formatUTCWeekNumberSunday, - "V": formatUTCWeekNumberISO, - "w": formatUTCWeekdayNumberSunday, - "W": formatUTCWeekNumberMonday, - "x": null, - "X": null, - "y": formatUTCYear, - "Y": formatUTCFullYear, - "Z": formatUTCZone, - "%": formatLiteralPercent + return function(t) { + transform2 = t, t02 = t(x02), t12 = t(x12), t22 = t(x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1; + return scale2; }; - var parses = { - "a": parseShortWeekday, - "A": parseWeekday, - "b": parseShortMonth, - "B": parseMonth, - "c": parseLocaleDateTime, - "d": parseDayOfMonth, - "e": parseDayOfMonth, - "f": parseMicroseconds, - "g": parseYear, - "G": parseFullYear, - "H": parseHour24, - "I": parseHour24, - "j": parseDayOfYear, - "L": parseMilliseconds, - "m": parseMonthNumber, - "M": parseMinutes, - "p": parsePeriod, - "q": parseQuarter, - "Q": parseUnixTimestamp, - "s": parseUnixTimestampSeconds, - "S": parseSeconds, - "u": parseWeekdayNumberMonday, - "U": parseWeekNumberSunday, - "V": parseWeekNumberISO, - "w": parseWeekdayNumberSunday, - "W": parseWeekNumberMonday, - "x": parseLocaleDate, - "X": parseLocaleTime, - "y": parseYear, - "Y": parseFullYear, - "Z": parseZone, - "%": parseLiteralPercent - }; - // These recursive directive definitions must be deferred. - formats.x = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - function newFormat(specifier, formats) { - return function(date) { - var string = [], i = -1, j = 0, n = specifier.length, c, pad, format; - if (!(date instanceof Date)) date = new Date(+date); - while(++i < n)if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); - else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - string.push(specifier.slice(j, i)); - return string.join(""); - }; + } + function diverging$1() { + var scale2 = linearish(transformer$1()(identity$6)); + scale2.copy = function() { + return copy$1(scale2, diverging$1()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingLog() { + var scale2 = loggish(transformer$1()).domain([0.1, 1, 10]); + scale2.copy = function() { + return copy$1(scale2, divergingLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSymlog() { + var scale2 = symlogish(transformer$1()); + scale2.copy = function() { + return copy$1(scale2, divergingSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingPow() { + var scale2 = powish(transformer$1()); + scale2.copy = function() { + return copy$1(scale2, divergingPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSqrt() { + return divergingPow.apply(null, arguments).exponent(0.5); + } + function assignTransitionStagger(transition, currentData, selection, presenter) { + const { layerStagger } = presenter.morphchartsref; + const { morphChartsRenderResult } = presenter; + const cubelayer = morphChartsRenderResult.getCubeLayer(); + const range2 = transition.reverse ? [1, 0] : [0, 1]; + if (!transition || transition.type === "ordinal" && !transition.reverse) { + delete layerStagger.cubes; + } else { + const staggerOrders = new Float64Array(cubelayer.positionsX.length); + switch (transition.type) { + case "ordinal": { + const scale2 = linear$1(range2).domain([0, currentData.length]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(i); + }); + break; + } + case "column": { + if (transition.column.quantitative) { + const values2 = new Float64Array(currentData.length); + currentData.forEach((datum2, i) => { + values2[i] = datum2[transition.column.name]; + }); + const stats = getStats(currentData, transition.column); + const scale2 = linear$1(range2).domain([stats.min, stats.max]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(values2[i]); + }); + } else { + const strings2 = new Array(currentData.length); + currentData.forEach((datum2, i) => { + strings2[i] = datum2[transition.column.name]; + }); + getStats(currentData, transition.column, (distictValues) => { + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + const index2 = distictValues.indexOf(strings2[i]); + const staggerOrder = index2 / distictValues.length; + staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; + }); + }); + } + break; + } + case "position": { + const dimensions = { + x: cubelayer.positionsX, + y: cubelayer.positionsY, + z: cubelayer.positionsZ + }; + const positions2 = dimensions[transition.dimension]; + const values2 = new Float64Array(currentData.length); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + values2[i] = positions2[glOrdinal]; + }); + const stats = getStats(values2, null, "number", true); + const scale2 = linear$1(range2).domain([stats.min, stats.max]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(values2[i]); + }); + break; + } + } + layerStagger.cubes = { staggerOrders, maxStaggerOrder: 1, minStaggerOrder: 0 }; } - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, undefined, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day; - if (i != string.length) return null; - // If a UNIX timestamp is specified, return it. - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); - // If this is utcParse, never use the local timezone. - if (Z && !("Z" in d)) d.Z = 0; - // The am-pm flag is 0 for AM, and 1 for PM. - if ("p" in d) d.H = d.H % 12 + d.p * 12; - // If the month was not specified, inherit from the quarter. - if (d.m === undefined) d.m = "q" in d ? d.q : 0; - // Convert day-of-week and week-of-year to day-of-year. - if ("V" in d) { - if (d.V < 1 || d.V > 53) return null; - if (!("w" in d)) d.w = 1; - if ("Z" in d) { - week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); - week = day > 4 || day === 0 ? (0, _d3Time.utcMonday).ceil(week) : (0, _d3Time.utcMonday)(week); - week = (0, _d3Time.utcDay).offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); - week = day > 4 || day === 0 ? (0, _d3Time.timeMonday).ceil(week) : (0, _d3Time.timeMonday)(week); - week = (0, _d3Time.timeDay).offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; - } - // If a time zone is specified, all fields are interpreted as UTC and then - // offset according to the specified time zone. - if ("Z" in d) { - d.H += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate(d); - } - // Otherwise, all fields are in local time. - return localDate(d); - }; + cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); + } + var __awaiter = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - function parseSpecifier(d, specifier, string, j) { - var i = 0, n = specifier.length, m = string.length, c, parse; - while(i < n){ - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || (j = parse(d, string, j)) < 0) return -1; - } else if (c != string.charCodeAt(j++)) return -1; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - return j; + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + const { defaultView } = defaults$1; + const zAxisZindex = 1010; + let didRegisterColorSchemes = false; + let Viewer$1 = class Viewer { + /** + * Instantiate a new Viewer. + * @param element Parent HTMLElement to present within. + * @param options Optional viewer options object. + */ + constructor(element2, options2) { + this.element = element2; + this.options = deepMerge(defaultViewerOptions$1, options2); + this.presenter = new Presenter(element2, getPresenterStyle(this.options)); + this._characterSet = new CharacterSet(); + this._dataScope = new DataScope$2(); + this._animator = new Animator(this._dataScope, { + onDataChanged: this.onDataChanged.bind(this), + onAnimateDataChange: this.onAnimateDataChange.bind(this) + }); + this._details = new Details(this.presenter.getElement(PresenterElement$1.panel), this.options.language, this._animator, this._dataScope, (remap) => { + this.currentColorContext = ~~remap; + this.renderSameLayout(); + }, () => this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); + this.insight = {}; } - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + changeColorContexts(colorContexts) { + this.colorContexts = colorContexts; + this.currentColorContext = 0; + this.options.onColorContextChange && this.options.onColorContextChange(); } - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + applyLegendColorContext(colorContext) { + const a2 = getActiveElementInfo(); + mount(colorContext.legendElement, this.presenter.getElement(PresenterElement$1.legend)); + setActiveElement(a2); + this.presenter.stage.legend = colorContext.legend; + } + onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time2) { + var _a2; + if (time2 === void 0) { + const transitionDurations = ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transitionDurations) || defaultPresenterConfig.transitionDurations; + time2 = transitionDurations.position + transitionDurations.stagger; + } + return new Promise((resolve2, reject) => { + let innerPromise; + if (dataChange === DataLayoutChange.refine) { + const oldColorContext = this.colorContexts[this.currentColorContext]; + innerPromise = new Promise((innerResolve) => { + this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + cubeLayer.unitColorMap = oldColorContext.colorMap; + if (this.options.onStage) { + this.options.onStage(stage); + } + } })).then(() => { + this.applyLegendColorContext(oldColorContext); + innerResolve(); + }); + }); + } else { + innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, colorMapper) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + if (this.options.onStage) { + this.options.onStage(stage); + } + } })); + } + innerPromise.then(() => { + this.presenter.animationQueue(resolve2, time2, { waitingLabel, handlerLabel, animationCanceled: reject }); + }); + }); } - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + onDataChanged(dataLayout, filter2) { + return __awaiter(this, void 0, void 0, function* () { + switch (dataLayout) { + case DataLayoutChange.same: { + const hasSelectedData = this._dataScope.hasSelectedData(); + const hasActive = !!this._dataScope.active; + if (hasSelectedData || hasActive) { + this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); + } else { + this.presenter.morphChartsRenderResult.update({ cubes: null }); + } + break; + } + case DataLayoutChange.refine: { + const oldColorContext = this.colorContexts[this.currentColorContext]; + let colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { + colorMap = cubeLayer.unitColorMap; + cubeLayer.unitColorMap = oldColorContext.colorMap; + this.preStage(stage, cubeLayer); + }, onPresent: () => { + const newColorContext = { + colorMap, + legend: clone(this.presenter.stage.legend), + legendElement: this.presenter.getElement(PresenterElement$1.legend).children[0] + }; + this.applyLegendColorContext(oldColorContext); + this.changeColorContexts([oldColorContext, newColorContext]); + this.onPresent(); + } })); + if (!compare$4(this.insight.filter, filter2)) { + this.insight.filter = narrow(this.insight.filter, filter2); + } + if (this.options.onDataFilter) { + this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); + } + break; + } + case DataLayoutChange.reset: { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null + }; + this.changeColorContexts([colorContext]); + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { onPresent: () => { + populateColorContext(colorContext, this.presenter); + this.onPresent(); + } })); + delete this.insight.filter; + if (this.options.onDataFilter) { + this.options.onDataFilter(null, null); + } + break; + } + } + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); + } + }); } - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + convertSearchToSet() { + if (this._dataScope.selection) { + const s2 = /* @__PURE__ */ new Set(); + let found = false; + this._dataScope.selection.included.forEach((o, i) => { + s2.add(o[GL_ORDINAL]); + found = true; + }); + if (!found) { + s2.add(-1); + } + return s2; + } } - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + convertSetToSearch(s2) { + const search = { + expressions: [] + }; + s2.forEach((value2) => { + search.expressions.push({ + name: GL_ORDINAL, + operator: "==", + value: value2, + clause: "||" + }); + }); + return search; } - function parseLocaleDateTime(d, string, i) { - return parseSpecifier(d, locale_dateTime, string, i); + getSpecColumnsWithFilteredStats() { + if (!this._dataScope.hasFilteredData()) { + return this._specColumns; + } + const roles = ["color", "facet", "group", "size", "sort", "sum", "x", "y", "z"]; + const specColumns = Object.assign({}, this._specColumns); + roles.forEach((r) => { + if (specColumns[r]) { + const column = Object.assign({}, specColumns[r]); + column.stats = this.getColumnStats(column); + specColumns[r] = column; + } + }); + return specColumns; } - function parseLocaleDate(d, string, i) { - return parseSpecifier(d, locale_date, string, i); + renderNewLayout(signalValues, presenterConfig, view) { + return __awaiter(this, void 0, void 0, function* () { + const currData = this._dataScope.currentData(); + const context2 = { + specColumns: this.getSpecColumnsWithFilteredStats(), + insight: this.insight, + specViewOptions: Object.assign(Object.assign({}, this.options), { zAxisOptions: { + showZAxis: true, + zIndex: zAxisZindex + }, collapseFacetAxes: true }) + }; + const specResult = build(context2, currData); + if (!specResult.errors) { + const uiValues = extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); + applySignalValues(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); + unbindSignalUI(specResult.vegaSpec); + this.vegaSpec = specResult.vegaSpec; + this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); + this.specCapabilities = specResult.specCapabilities; + const config = this.createConfig(presenterConfig); + this._lastPresenterConfig = config.presenterConfig; + if (view) { + config.getView = () => view; + } + if (!didRegisterColorSchemes) { + registerColorSchemes(base$3.vega); + didRegisterColorSchemes = true; + } + try { + if (this.vegaViewGl) { + this.vegaViewGl.finalize(); + } + const runtime2 = base$3.vega.parse(this.vegaSpec); + this.vegaViewGl = new ViewGl(runtime2, config).renderer("morphcharts").initialize(this.element); + yield this.vegaViewGl.runAsync(); + const handler = (n, v) => { + this._characterSet.resetCharacterSet(true); + }; + this.vegaSpec.signals.forEach((s2) => { + this.vegaViewGl.addSignalListener(s2.name, handler); + }); + this.configForSignalCapture(config.presenterConfig); + } catch (e) { + specResult.errors = [e.message]; + } + if (!specResult.errors) { + ensureHeaders(this.presenter, this.options.language.headers); + } + } + if (specResult.errors) { + if (this.options.onError) { + this.options.onError(specResult.errors); + } else if (this.presenter.logger) { + this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join("\n")}`); + } + } + return specResult; + }); } - function parseLocaleTime(d, string, i) { - return parseSpecifier(d, locale_time, string, i); + /** + * Render the same layout with new options. + * @param newViewerOptions New options object. + */ + renderSameLayout(newViewerOptions) { + const colorContext = this.colorContexts[this.currentColorContext]; + this.applyLegendColorContext(colorContext); + if (newViewerOptions) { + if (newViewerOptions.colors) { + const mcColors = this.getMorphChartsColors(); + this.presenter.configColors(mcColors); + this._lastPresenterConfig.morphChartsColors = mcColors; + } + this.options = deepMerge(this.options, newViewerOptions); + } + this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); } - function formatShortWeekday(d) { - return locale_shortWeekdays[d.getDay()]; + getView(view) { + if (view === void 0) { + if (this.presenter.view === null) { + return defaultView; + } else { + return this.presenter.view; + } + } else { + return view; + } } - function formatWeekday(d) { - return locale_weekdays[d.getDay()]; + transformData(values2, transform2) { + try { + const runtime2 = base$3.vega.parse({ + $schema: "https://vega.github.io/schema/vega/v4.json", + data: [{ + name: "source", + values: values2, + transform: transform2 + }] + }); + new ViewGl(runtime2).run(); + } catch (e) { + } + return values2; } - function formatShortMonth(d) { - return locale_shortMonths[d.getMonth()]; + /** + * Render data into a visualization. + * @param insightSetup InsightSetup object to create a visualization rendering. + * @param data Array of data objects. + * @param renderOptions Optional RenderOptions object. + */ + render(insightSetup_1, data_1) { + return __awaiter(this, arguments, void 0, function* (insightSetup, data2, renderOptions = {}) { + const { insight, setup: setup2 } = insightSetup; + let result; + if (!compare$4(insight.filter, this.insight.filter)) { + const transitionDurations = (setup2 === null || setup2 === void 0 ? void 0 : setup2.transitionDurations) || defaultPresenterConfig.transitionDurations; + const renderTime = transitionDurations.position + transitionDurations.stagger; + const allowAsyncRenderTime = renderTime + this.options.filterRenderingTimerPadding; + if (insight.filter) { + result = yield this._render(insightSetup, data2, renderOptions, true); + this.presenter.animationQueue(() => { + this.filter(insight.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); + }, allowAsyncRenderTime, { waitingLabel: "layout before refine", handlerLabel: "refine after layout" }); + } else { + this._dataScope.setFilteredData(null); + result = yield this._render(insightSetup, data2, renderOptions, true); + this.presenter.animationQueue(() => { + this.reset(); + }, allowAsyncRenderTime, { waitingLabel: "layout before reset", handlerLabel: "reset after layout" }); + } + } else { + result = yield this._render(insightSetup, data2, renderOptions, false); + } + return result; + }); } - function formatMonth(d) { - return locale_months[d.getMonth()]; + shouldViewstateTransition(newInsight, oldInsight) { + if (!oldInsight.columns) + return false; + if (oldInsight.chart !== newInsight.chart) + return true; + if (oldInsight.size.height !== newInsight.size.height) + return true; + if (oldInsight.size.width !== newInsight.size.width) + return true; + if (oldInsight.columns.facet !== newInsight.columns.facet) + return true; + return false; } - function formatPeriod(d) { - return locale_periods[+(d.getHours() >= 12)]; + configForSignalCapture(presenterConfig) { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null + }; + presenterConfig.preStage = (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) { + colorContext.colorMap = cubeLayer.unitColorMap; + } + this.preStage(stage, cubeLayer); + }; + presenterConfig.onPresent = () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + this._dataScope.deselect(); + } + this.onPresent(); + }; } - function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); + onPresent() { + var _a2; + if ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transition) { + assignTransitionStagger(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + } + this.options.onPresent && this.options.onPresent(); } - function formatUTCShortWeekday(d) { - return locale_shortWeekdays[d.getUTCDay()]; + _render(insightSetup, data2, renderOptions, forceNewCharacterSet) { + return __awaiter(this, void 0, void 0, function* () { + const { insight, setup: setup2 } = insightSetup; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (this._dataScope.setData(data2, renderOptions.columns)) { + this.transformData(data2, insight.transform); + } + this._specColumns = getSpecColumns(insight, this._dataScope.getColumns(renderOptions.columnTypes)); + const ordinalMap = assignOrdinals(this._specColumns, data2, renderOptions.ordinalMap); + this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight); + this.insight = clone(insight); + this.setup = setup2; + this._shouldSaveColorContext = () => !renderOptions.initialColorContext; + const colorContext = renderOptions.initialColorContext || { + colorMap: null, + legend: null, + legendElement: null + }; + const specResult = yield this.renderNewLayout(insight.signalValues, Object.assign(Object.assign({}, setup2 || {}), { preStage: (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) { + colorContext.colorMap = cubeLayer.unitColorMap; + } else { + cubeLayer.unitColorMap = colorContext.colorMap; + } + const hasSelectedData = !!this._dataScope.hasSelectedData(); + if (hasSelectedData || this._dataScope.active) ; + this.preStage(stage, cubeLayer); + }, onPresent: () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + } else { + this.applyLegendColorContext(colorContext); + } + this.onPresent(); + }, shouldViewstateTransition: () => this.shouldViewstateTransition(insight, this.insight) }), this.getView(insight.view)); + this._shouldSaveColorContext = () => !renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); + this._details.render(); + const result = { ordinalMap, specResult }; + return result; + }); } - function formatUTCWeekday(d) { - return locale_weekdays[d.getUTCDay()]; + overrideAxisLabels(stage) { } - function formatUTCShortMonth(d) { - return locale_shortMonths[d.getUTCMonth()]; + preLayer(stage) { + let axisRole; + for (axisRole in stage.axes) { + const capability = this.specCapabilities.roles.filter((r) => r.role === axisRole)[0]; + if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === "exact")) { + moveTicksBetween(stage.axes[axisRole]); + } + } } - function formatUTCMonth(d) { - return locale_months[d.getUTCMonth()]; + preStage(stage, cubeLayer) { + this.overrideAxisLabels(stage); + this._axisSelection = new AxisSelection(this.specCapabilities, this._specColumns, stage); + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + if (this.options.onStage) { + this.options.onStage(stage); + } } - function formatUTCPeriod(d) { - return locale_periods[+(d.getUTCHours() >= 12)]; + onCubeClick(e, cube) { + this.options.onCubeClick && this.options.onCubeClick(e, cube); + const hasSelectedData = this._dataScope.hasSelectedData(); + if (hasSelectedData && this._dataScope.selection.included.length > 1) { + const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); + if (indexWithinSelection.index >= 0) { + this.activate(indexWithinSelection.datum); + this._details.populate(this._dataScope.selection, indexWithinSelection.index); + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); + } + return; + } + } + if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][GL_ORDINAL] === cube.ordinal) { + this.deselect(); + return; + } + const search = { + name: GL_ORDINAL, + operator: "==", + value: cube.ordinal + }; + this.select(search); + } + onCubeHover(event2, cube) { + var _a2, _b2; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (!cube) { + return; + } + const currentData = this._dataScope.currentData(); + const index2 = getDataIndexOfCube(cube, currentData); + if (index2 >= 0) { + const dataItem = cleanDataItem(((_a2 = this.options.tooltipOptions) === null || _a2 === void 0 ? void 0 : _a2.prepareDataItem(currentData[index2])) || currentData[index2]); + const tooltipCreateOptions = { + dataItem, + event: event2 + }; + if ((_b2 = this.options.tooltipOptions) === null || _b2 === void 0 ? void 0 : _b2.create) { + this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); + } else { + this._tooltip = new Tooltip$1(Object.assign(Object.assign({}, tooltipCreateOptions), { cssPrefix: this.presenter.style.cssPrefix })); + } + } } - function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); + onTextHover(e, t) { + if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) + return false; + return !colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); } - return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { - return specifier; - }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { - return specifier; - }; - return p; + getMorphChartsColors() { + const { colors: colors2 } = this.options; + return { + activeItemColor: colors2.activeCube, + axesGridBackgroundColor: colors2.backgroundColor, + axesGridHighlightColor: colors2.axisSelectHighlight, + axesGridMajorColor: colors2.gridLine, + axesGridMinorColor: colors2.gridLine, + axesGridZeroColor: colors2.gridLine, + axesTextHeadingColor: colors2.axisText, + axesTextLabelColor: colors2.axisText, + axesTextTitleColor: colors2.axisText, + backgroundColor: colors2.backgroundColor, + textBorderColor: colors2.backgroundColor, + textColor: colors2.axisText + }; + } + createConfig(c2) { + var _a2; + const { getTextColor, getTextHighlightColor, onTextClick } = this.options; + const defaultPresenterConfig2 = { + morphChartsColors: this.getMorphChartsColors(), + zAxisZindex, + getCharacterSet: (stage) => this._characterSet.getCharacterSet(stage), + getTextColor, + getTextHighlightColor, + onTextClick: (e, t) => { + if (t.metaData && t.metaData.search) { + const search = getSearchGroupFromVegaValue(t.metaData.search); + if (this.options.onAxisClick) { + this.options.onAxisClick(e, search); + } else { + this.select(search); + } + } + if (onTextClick) { + onTextClick(e, t); + } + }, + onCubeClick: this.onCubeClick.bind(this), + onCubeHover: this.onCubeHover.bind(this), + onTextHover: this.onTextHover.bind(this), + preLayer: this.preLayer.bind(this), + preStage: this.preStage.bind(this), + onPresent: this.onPresent.bind(this), + onAxisConfig: (cartesian2, dim3d, axis) => { + if (!axis) + return; + const role = this.specCapabilities.roles.filter((r) => r.role === axis.axisRole)[0]; + if (role === null || role === void 0 ? void 0 : role.axisSelection) { + cartesian2.isDivisionPickingEnabled[dim3d] = true; + cartesian2.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; + cartesian2.isLabelPickingEnabled[dim3d] = true; + cartesian2.isTitlePickingEnabled[dim3d] = true; + cartesian2.isHeadingPickingEnabled[dim3d] = true; + cartesian2.isGridPickingEnabled = false; + } + }, + onAxesComplete: (cartesian2) => { + }, + axisPickGridCallback: (divisions, e) => { + const search = this._axisSelection.convert(divisions); + if (this.options.onAxisClick) { + this.options.onAxisClick(e, search); + } else { + this.select(search); + } }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { - return specifier; - }; - return f; + onLayerClick: (e) => { + this.options.onCanvasClick && this.options.onCanvasClick(e); + this.deselect(); }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { - return specifier; - }; - return p; - } - }; -} -var pads = { - "-": "", - "_": " ", - "0": "0" -}, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; -function pad(value, fill, width) { - var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); -} -function requote(s) { - return s.replace(requoteRe, "\\$&"); -} -function formatRe(names) { - return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); -} -function formatLookup(names) { - return new Map(names.map((name, i)=>[ - name.toLowerCase(), - i - ])); -} -function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.w = +n[0], i + n[0].length) : -1; -} -function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.u = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.U = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.V = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.W = +n[0], i + n[0].length) : -1; -} -function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); - return n ? (d.y = +n[0], i + n[0].length) : -1; -} -function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; -} -function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); - return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; -} -function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); - return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; -} -function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.m = n[0] - 1, i + n[0].length) : -1; -} -function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.d = +n[0], i + n[0].length) : -1; -} -function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; -} -function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.H = +n[0], i + n[0].length) : -1; -} -function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.M = +n[0], i + n[0].length) : -1; -} -function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.S = +n[0], i + n[0].length) : -1; -} -function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); - return n ? (d.L = +n[0], i + n[0].length) : -1; -} -function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; -} -function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); - return n ? i + n[0].length : -1; -} -function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.Q = +n[0], i + n[0].length) : -1; -} -function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); - return n ? (d.s = +n[0], i + n[0].length) : -1; -} -function formatDayOfMonth(d, p) { - return pad(d.getDate(), p, 2); -} -function formatHour24(d, p) { - return pad(d.getHours(), p, 2); -} -function formatHour12(d, p) { - return pad(d.getHours() % 12 || 12, p, 2); -} -function formatDayOfYear(d, p) { - return pad(1 + (0, _d3Time.timeDay).count((0, _d3Time.timeYear)(d), d), p, 3); -} -function formatMilliseconds(d, p) { - return pad(d.getMilliseconds(), p, 3); -} -function formatMicroseconds(d, p) { - return formatMilliseconds(d, p) + "000"; -} -function formatMonthNumber(d, p) { - return pad(d.getMonth() + 1, p, 2); -} -function formatMinutes(d, p) { - return pad(d.getMinutes(), p, 2); -} -function formatSeconds(d, p) { - return pad(d.getSeconds(), p, 2); -} -function formatWeekdayNumberMonday(d) { - var day = d.getDay(); - return day === 0 ? 7 : day; -} -function formatWeekNumberSunday(d, p) { - return pad((0, _d3Time.timeSunday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function dISO(d) { - var day = d.getDay(); - return day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); -} -function formatWeekNumberISO(d, p) { - d = dISO(d); - return pad((0, _d3Time.timeThursday).count((0, _d3Time.timeYear)(d), d) + ((0, _d3Time.timeYear)(d).getDay() === 4), p, 2); -} -function formatWeekdayNumberSunday(d) { - return d.getDay(); -} -function formatWeekNumberMonday(d, p) { - return pad((0, _d3Time.timeMonday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function formatYear(d, p) { - return pad(d.getFullYear() % 100, p, 2); -} -function formatYearISO(d, p) { - d = dISO(d); - return pad(d.getFullYear() % 100, p, 2); -} -function formatFullYear(d, p) { - return pad(d.getFullYear() % 10000, p, 4); -} -function formatFullYearISO(d, p) { - var day = d.getDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); - return pad(d.getFullYear() % 10000, p, 4); -} -function formatZone(d) { - var z = d.getTimezoneOffset(); - return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); -} -function formatUTCDayOfMonth(d, p) { - return pad(d.getUTCDate(), p, 2); -} -function formatUTCHour24(d, p) { - return pad(d.getUTCHours(), p, 2); -} -function formatUTCHour12(d, p) { - return pad(d.getUTCHours() % 12 || 12, p, 2); -} -function formatUTCDayOfYear(d, p) { - return pad(1 + (0, _d3Time.utcDay).count((0, _d3Time.utcYear)(d), d), p, 3); -} -function formatUTCMilliseconds(d, p) { - return pad(d.getUTCMilliseconds(), p, 3); -} -function formatUTCMicroseconds(d, p) { - return formatUTCMilliseconds(d, p) + "000"; -} -function formatUTCMonthNumber(d, p) { - return pad(d.getUTCMonth() + 1, p, 2); -} -function formatUTCMinutes(d, p) { - return pad(d.getUTCMinutes(), p, 2); -} -function formatUTCSeconds(d, p) { - return pad(d.getUTCSeconds(), p, 2); -} -function formatUTCWeekdayNumberMonday(d) { - var dow = d.getUTCDay(); - return dow === 0 ? 7 : dow; -} -function formatUTCWeekNumberSunday(d, p) { - return pad((0, _d3Time.utcSunday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function UTCdISO(d) { - var day = d.getUTCDay(); - return day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); -} -function formatUTCWeekNumberISO(d, p) { - d = UTCdISO(d); - return pad((0, _d3Time.utcThursday).count((0, _d3Time.utcYear)(d), d) + ((0, _d3Time.utcYear)(d).getUTCDay() === 4), p, 2); -} -function formatUTCWeekdayNumberSunday(d) { - return d.getUTCDay(); -} -function formatUTCWeekNumberMonday(d, p) { - return pad((0, _d3Time.utcMonday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function formatUTCYear(d, p) { - return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCYearISO(d, p) { - d = UTCdISO(d); - return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCFullYear(d, p) { - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCFullYearISO(d, p) { - var day = d.getUTCDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCZone() { - return "+0000"; -} -function formatLiteralPercent() { - return "%"; -} -function formatUnixTimestamp(d) { - return +d; -} -function formatUnixTimestampSeconds(d) { - return Math.floor(+d / 1000); -} - -},{"d3-time":"6KMda","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iLPRP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>utcTime); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _timeJs = require("./time.js"); -var _initJs = require("./init.js"); -function utcTime() { - return (0, _initJs.initRange).apply((0, _timeJs.calendar)((0, _d3Time.utcTicks), (0, _d3Time.utcTickInterval), (0, _d3Time.utcYear), (0, _d3Time.utcMonth), (0, _d3Time.utcWeek), (0, _d3Time.utcDay), (0, _d3Time.utcHour), (0, _d3Time.utcMinute), (0, _d3Time.utcSecond), (0, _d3TimeFormat.utcFormat)).domain([ - Date.UTC(2000, 0, 1), - Date.UTC(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"6KMda","d3-time-format":"eC6Bi","./time.js":"dtq1F","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0eA3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "default", ()=>sequential); -parcelHelpers.export(exports, "sequentialLog", ()=>sequentialLog); -parcelHelpers.export(exports, "sequentialSymlog", ()=>sequentialSymlog); -parcelHelpers.export(exports, "sequentialPow", ()=>sequentialPow); -parcelHelpers.export(exports, "sequentialSqrt", ()=>sequentialSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 1, t0, t1, k10, transform, interpolator = (0, _continuousJs.identity), clamp = false, unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [ - x0, - x1 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [ - interpolator(0), - interpolator(1) - ]; + onLegendClick: (e, legend2, clickedIndex) => { + const legendRow = clickedIndex !== null && legend2.rows[clickedIndex]; + if (legendRow) { + if (this.options.onLegendRowClick) { + this.options.onLegendRowClick(e, legendRow); + } else { + this.select(legendRow.search); + } + } else if (this.options.onLegendHeaderClick) { + this.options.onLegendHeaderClick(e); + } + }, + onSceneRectAssignCubeOrdinal: (datum2) => { + return datum2[GL_ORDINAL]; + }, + onTargetViewState: (h2, w2) => { + const { height: height2, width: width2 } = this.insight.size; + let newViewStateTarget; + if (this.options.onNewViewStateTarget) { + newViewStateTarget = this.options.onNewViewStateTarget(); + } + return { height: height2, width: width2, newViewStateTarget }; + }, + layerSelection: { + cubes: this.convertSearchToSet() + }, + preserveDrawingBuffer: this.options.preserveDrawingBuffer + }; + if (!this.options.disableLasso) { + defaultPresenterConfig2.onLasso = (ids, e) => { + this.deselect(); + const search = this.convertSetToSearch(ids); + this.select(search); }; - } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); - return scale; - }; -} -function copy(source, target) { - return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown()); -} -function sequential() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return copy(scale, sequential()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 1, - 10 - ]); - scale.copy = function() { - return copy(scale, sequentialLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSqrt() { - return sequentialPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"hWyQt","./continuous.js":"2SYx4","./init.js":"ijd73","./linear.js":"ik2PQ","./log.js":"5BBe1","./symlog.js":"26cMO","./pow.js":"ah9R8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i0IcB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sequentialQuantile); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function sequentialQuantile() { - var domain = [], interpolator = (0, _continuousJs.identity); - function scale(x) { - if (x != null && !isNaN(x = +x)) return interpolator(((0, _d3Array.bisect)(domain, x, 1) - 1) / (domain.length - 1)); - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return scale; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - scale.range = function() { - return domain.map((d, i)=>interpolator(i / (domain.length - 1))); - }; - scale.quantiles = function(n) { - return Array.from({ - length: n + 1 - }, (_, i)=>(0, _d3Array.quantile)(domain, i / n)); - }; - scale.copy = function() { - return sequentialQuantile(interpolator).domain(domain); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} - -},{"d3-array":"5lCYW","./continuous.js":"2SYx4","./init.js":"ijd73","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6Pqcc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>diverging); -parcelHelpers.export(exports, "divergingLog", ()=>divergingLog); -parcelHelpers.export(exports, "divergingSymlog", ()=>divergingSymlog); -parcelHelpers.export(exports, "divergingPow", ()=>divergingPow); -parcelHelpers.export(exports, "divergingSqrt", ()=>divergingSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _sequentialJs = require("./sequential.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 0.5, x2 = 1, s = 1, t0, t1, t2, k10, k21, interpolator = (0, _continuousJs.identity), transform, clamp = false, unknown; - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [ - x0, - x1, - x2 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = (0, _d3Interpolate.piecewise)(interpolate, [ - r0, - r1, - r2 - ]), scale) : [ - interpolator(0), - interpolator(0.5), - interpolator(1) - ]; + } + if (this.options.onBeforeCreateLayers) { + defaultPresenterConfig2.preLayer = (stage) => { + this.preLayer(stage); + this.options.onBeforeCreateLayers(stage, this.specCapabilities); }; + } + const config = { + presenter: this.presenter, + presenterConfig: Object.assign(defaultPresenterConfig2, c2) + }; + if ((_a2 = this.setup) === null || _a2 === void 0 ? void 0 : _a2.transitionDurations) { + config.presenterConfig.transitionDurations = this.setup.transitionDurations; + } + return config; } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} -function diverging() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, diverging()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 0.1, - 1, - 10 - ]); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSqrt() { - return divergingPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"hWyQt","./continuous.js":"2SYx4","./init.js":"ijd73","./linear.js":"ik2PQ","./log.js":"5BBe1","./sequential.js":"e0eA3","./symlog.js":"26cMO","./pow.js":"ah9R8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7m9yM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '4.0.6'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"71zHd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "classList", ()=>classList); -parcelHelpers.export(exports, "deepCompare", ()=>deepCompare); -parcelHelpers.export(exports, "compareInsight", ()=>compareInsight); -var _justCompare = require("just-compare"); -const classList = (...args)=>{ - return args.filter(Boolean).join(' '); -}; -const deepCompare = _justCompare.default || _justCompare; -function addNullable(insight, signalValues) { - const withNulls = Object.assign(Object.assign({ - view: null, - filter: null - }, insight), { - signalValues - }); - return withNulls; -} -function compareInsight(viewer, insight) { - const currentInsight = viewer.getInsight(); - const a = addNullable(currentInsight, Object.assign(Object.assign({}, viewer.insight.signalValues), currentInsight.signalValues)); - const b = addNullable(insight, Object.assign(Object.assign({}, a.signalValues), insight.signalValues)); - const compare = deepCompare(a, b); - return { - a, - b, - compare - }; -} - -},{"just-compare":"hL7vS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hL7vS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>collectionCompare); -var collectionCompare = compare; -/* - primitives: value1 === value2 - functions: value1.toString == value2.toString - arrays: if length, sequence and values of properties are identical - objects: if length, names and values of properties are identical - compare([[1, [2, 3]], [[1, [2, 3]]); // true - compare([[1, [2, 3], 4], [[1, [2, 3]]); // false - compare({a: 2, b: 3}, {a: 2, b: 3}); // true - compare({a: 2, b: 3}, {b: 3, a: 2}); // true - compare({a: 2, b: 3, c: 4}, {a: 2, b: 3}); // false - compare({a: 2, b: 3}, {a: 2, b: 3, c: 4}); // false - compare([[1, [2, {a: 4}], 4], [[1, [2, {a: 4}]]); // true -*/ function compare(value1, value2) { - if (value1 === value2) return true; - /* eslint-disable no-self-compare */ // if both values are NaNs return true - if (value1 !== value1 && value2 !== value2) return true; - if (({}).toString.call(value1) != ({}).toString.call(value2)) return false; - if (value1 !== Object(value1)) // non equal primitives - return false; - if (!value1) return false; - if (Array.isArray(value1)) return compareArrays(value1, value2); - if (({}).toString.call(value1) == '[object Set]') return compareArrays(Array.from(value1), Array.from(value2)); - if (({}).toString.call(value1) == '[object Object]') return compareObjects(value1, value2); - else return compareNativeSubtypes(value1, value2); -} -function compareNativeSubtypes(value1, value2) { - // e.g. Function, RegExp, Date + /** + * Filter the data and animate. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. + */ + filter(search, rebase = false) { + const u2 = this._dataScope.createUserSelection(search, false, rebase); + return new Promise((resolve2, reject) => { + this._animator.filter(search, u2.included, u2.excluded, rebase).then(() => { + this._details.clear(); + this._details.clearSelection(); + this._details.populate(this._dataScope.selection); + resolve2(); + }); + }); + } + /** + * Remove any filtration and animate. + */ + reset() { + return new Promise((resolve2, reject) => { + this._animator.reset().then(() => { + this._details.clear(); + this._details.clearSelection(); + resolve2(); + }); + }); + } + /** + * Select cubes by a filter expression. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + */ + select(search) { + return new Promise((resolve2, reject) => { + this._animator.select(search).then(() => { + this._details.populate(this._dataScope.selection); + resolve2(); + }); + }); + } + /** + * Removes any selection. + */ + deselect() { + return new Promise((resolve2, reject) => { + this._animator.deselect().then(() => { + this._details.clearSelection(); + resolve2(); + }); + }); + } + /** + * Gets the current selection. + */ + getSelection() { + if (!this._dataScope) + return null; + const selectionState = { + search: this._dataScope.selection && this._dataScope.selection.search || null, + selectedData: this._dataScope.selection && this._dataScope.selection.included || null, + active: this._dataScope.active + }; + return selectionState; + } + /** + * Set one data row to the active state. + */ + activate(datum2) { + return new Promise((resolve2, reject) => { + this._animator.activate(datum2).then(() => { + this.presenter.morphChartsRenderResult.activate(datum2[GL_ORDINAL]); + this._details.render(); + resolve2(); + }); + }); + } + /** + * Deactivate item. + */ + deActivate() { + return new Promise((resolve2, reject) => { + if (this._dataScope && this._dataScope.active) { + this._animator.deactivate().then(() => { + this.presenter.morphChartsRenderResult.activate(-1); + this._details.render(); + resolve2(); + }); + } else { + resolve2(); + } + }); + } + /** + * Gets the current camera. + * @param transitionFinal Optional flag to get camera destination when transition completes. + */ + getCamera(transitionFinal = false) { + var _a2, _b2, _c2, _d2, _e2, _f, _g; + let position2 = [0, 0, 0]; + let rotation2 = [0, 0, 0, 0]; + if (transitionFinal) { + position2 = Array.from((_b2 = (_a2 = this.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphchartsref) === null || _b2 === void 0 ? void 0 : _b2.cameraTransitioner.vPosition.to); + rotation2 = Array.from((_d2 = (_c2 = this.presenter) === null || _c2 === void 0 ? void 0 : _c2.morphchartsref) === null || _d2 === void 0 ? void 0 : _d2.cameraTransitioner.qRotation.to); + } else { + const camera = (_g = (_f = (_e2 = this.presenter) === null || _e2 === void 0 ? void 0 : _e2.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; + if (camera) { + camera.getPosition(position2); + camera.getOrbit(rotation2); + } + } + return { position: position2, rotation: rotation2, captureSize: this.insight.size }; + } + /** + * Sets the current camera. + * @param camera Camera to set. + */ + setCamera(camera) { + var _a2, _b2; + if (camera) { + (_b2 = (_a2 = this.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphChartsRenderResult) === null || _b2 === void 0 ? void 0 : _b2.moveCamera(camera); + } + } + /** + * Gets the current insight with signal values. + */ + getInsight() { + const insight = Object.assign({}, this.insight); + insight.signalValues = this.getSignalValues(); + return insight; + } + /** + * Gets column stats from current data (filtered or all). + * @param column Column to get stats for. + */ + getColumnStats(column) { + return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; + } + /** + * Gets current signal values. + */ + getSignalValues() { + return extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); + } + assignTransitionStagger(transition) { + assignTransitionStagger(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + } + finalize() { + if (this._dataScope) + this._dataScope.finalize(); + if (this._details) + this._details.finalize(); + if (this._tooltip) + this._tooltip.destroy(); + if (this.vegaViewGl) + this.vegaViewGl.finalize(); + if (this.presenter) + this.presenter.finalize(); + if (this.element) + this.element.innerHTML = ""; + this.colorContexts = null; + this.element = null; + this.options = null; + this.presenter = null; + this.vegaSpec = null; + this.vegaViewGl = null; + this._animator = null; + this._dataScope = null; + this._details = null; + this._tooltip = null; + } + }; + Viewer$1.defaultViewerOptions = defaultViewerOptions$1; + const version$4 = "4.0.6"; + const use$4 = use$5; + const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + VegaMorphCharts: index$5, + Viewer: Viewer$1, + colorSchemes, + constants: constants$1, + searchExpression: index$6, + specs: index$7, + types: types$1, + use: use$4, + util: util$3, + version: version$4 + }, Symbol.toStringTag, { value: "Module" })); + var collectionCompare = compare$2; + function compare$2(value1, value2) { + if (value1 === value2) { + return true; + } + if (value1 !== value1 && value2 !== value2) { + return true; + } + if ({}.toString.call(value1) != {}.toString.call(value2)) { + return false; + } + if (value1 !== Object(value1)) { + return false; + } + if (!value1) { + return false; + } + if (Array.isArray(value1)) { + return compareArrays(value1, value2); + } + if ({}.toString.call(value1) == "[object Set]") { + return compareArrays(Array.from(value1), Array.from(value2)); + } + if ({}.toString.call(value1) == "[object Object]") { + return compareObjects(value1, value2); + } else { + return compareNativeSubtypes(value1, value2); + } + } + function compareNativeSubtypes(value1, value2) { return value1.toString() === value2.toString(); -} -function compareArrays(value1, value2) { - var len = value1.length; - if (len != value2.length) return false; + } + function compareArrays(value1, value2) { + var len2 = value1.length; + if (len2 != value2.length) { + return false; + } var alike = true; - for(var i = 0; i < len; i++)if (!compare(value1[i], value2[i])) { + for (var i = 0; i < len2; i++) { + if (!compare$2(value1[i], value2[i])) { alike = false; break; + } } return alike; -} -function compareObjects(value1, value2) { + } + function compareObjects(value1, value2) { var keys1 = Object.keys(value1).sort(); var keys2 = Object.keys(value2).sort(); - var len = keys1.length; - if (len != keys2.length) return false; - for(var i = 0; i < len; i++){ - var key1 = keys1[i]; - var key2 = keys2[i]; - if (!(key1 == key2 && compare(value1[key1], value2[key2]))) return false; + var len2 = keys1.length; + if (len2 != keys2.length) { + return false; + } + for (var i = 0; i < len2; i++) { + var key1 = keys1[i]; + var key2 = keys2[i]; + if (!(key1 == key2 && compare$2(value1[key1], value2[key2]))) { + return false; + } } return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2yfj3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Viewer", ()=>Viewer); -var _base = require("./base"); -var _util = require("./util"); -var _sanddance = require("@msrvida/sanddance"); -function _Viewer(_props) { - class __Viewer extends (0, _base.base).react.Component { - layout() { - const { props } = this; - this.lastData = props.data; - this.viewer.render({ - insight: props.insight, - setup: props.setup - }, props.data, props.renderOptions).then((renderResult)=>{ - //TODO: show errors if any - //console.log('viewer render'); - props.onView && props.onView(renderResult); - }).catch((e)=>{ - //console.log('viewer error'); - props.onError && props.onError(e); - }); - } - view() { - var _a, _b, _c, _d, _e; - const { props } = this; - let didLayout = false; - if (props.insight && props.data) { - const c = (0, _util.compareInsight)(this.viewer, props.insight); - const sameDataRef = props.data === this.lastData; - if (!c.compare || !sameDataRef) { - this.layout(); - didLayout = true; - } - } - if (!didLayout && props.setup) { - const { camera } = props.setup; - //compare setup, move camera - if (camera !== 'hold') { - if (!(0, _util.deepCompare)(this.viewer.setup.camera, camera)) { - //camera is different - if (!camera) (_b = (_a = this.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 || _b.homeCamera(); - else this.viewer.setCamera(camera); - //save this for next comparison - const setup = (0, _sanddance.VegaMorphCharts).util.clone(this.viewer.setup); - setup.camera = camera; - this.viewer.setup = setup; - } - } - if (props.setup.renderer) (_e = (_d = (_c = this.viewer) === null || _c === void 0 ? void 0 : _c.presenter) === null || _d === void 0 ? void 0 : _d.morphchartsref) === null || _e === void 0 || _e.setMorphChartsRendererOptions(props.setup.renderer); - } + } + const compare$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: collectionCompare + }, Symbol.toStringTag, { value: "Module" })); + const classList = (...args) => { + return args.filter(Boolean).join(" "); + }; + const deepCompare = collectionCompare || compare$3; + function addNullable(insight, signalValues) { + const withNulls = Object.assign(Object.assign({ view: null, filter: null }, insight), { signalValues }); + return withNulls; + } + function compareInsight(viewer, insight) { + const currentInsight = viewer.getInsight(); + const a2 = addNullable(currentInsight, Object.assign(Object.assign({}, viewer.insight.signalValues), currentInsight.signalValues)); + const b2 = addNullable(insight, Object.assign(Object.assign({}, a2.signalValues), insight.signalValues)); + const compare2 = deepCompare(a2, b2); + return { a: a2, b: b2, compare: compare2 }; + } + const util$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + classList, + compareInsight, + deepCompare + }, Symbol.toStringTag, { value: "Module" })); + const base$2 = { + react: null, + reactDOM: null + }; + function use$3(react, reactDOM, vega2) { + use$5(vega2); + base$2.react = react; + base$2.reactDOM = reactDOM; + Viewer.prototype = react.Component.prototype; + } + function _Viewer(_props) { + class __Viewer extends base$2.react.Component { + layout() { + const { props } = this; + this.lastData = props.data; + this.viewer.render({ + insight: props.insight, + setup: props.setup + }, props.data, props.renderOptions).then((renderResult) => { + props.onView && props.onView(renderResult); + }).catch((e) => { + props.onError && props.onError(e); + }); + } + view() { + var _a2, _b2, _c2, _d2, _e2; + const { props } = this; + let didLayout = false; + if (props.insight && props.data) { + const c2 = compareInsight(this.viewer, props.insight); + const sameDataRef = props.data === this.lastData; + if (!c2.compare || !sameDataRef) { + this.layout(); + didLayout = true; + } + } + if (!didLayout && props.setup) { + const { camera } = props.setup; + if (camera !== "hold") { + if (!deepCompare(this.viewer.setup.camera, camera)) { + if (!camera) { + (_b2 = (_a2 = this.viewer) === null || _a2 === void 0 ? void 0 : _a2.presenter) === null || _b2 === void 0 ? void 0 : _b2.homeCamera(); + } else { + this.viewer.setCamera(camera); + } + const setup2 = clone(this.viewer.setup); + setup2.camera = camera; + this.viewer.setup = setup2; + } + } + if (props.setup.renderer) { + (_e2 = (_d2 = (_c2 = this.viewer) === null || _c2 === void 0 ? void 0 : _c2.presenter) === null || _d2 === void 0 ? void 0 : _d2.morphchartsref) === null || _e2 === void 0 ? void 0 : _e2.setMorphChartsRendererOptions(props.setup.renderer); + } } - componentDidMount() { - const { props } = this; - const element = (0, _base.base).reactDOM.findDOMNode(this.viewerDiv); - this.viewer = new (0, _sanddance.Viewer)(element, props.viewerOptions); - if (props.onMount) { - if (props.onMount(this.viewer.presenter.getElement((0, _sanddance.VegaMorphCharts).PresenterElement.gl))) this.view(); - } else this.view(); - } - componentDidUpdate() { - const { props } = this; - this.viewer.options = (0, _sanddance.VegaMorphCharts).util.deepMerge(this.viewer.options, props.viewerOptions); + } + componentDidMount() { + const { props } = this; + const element2 = base$2.reactDOM.findDOMNode(this.viewerDiv); + this.viewer = new Viewer$1(element2, props.viewerOptions); + if (props.onMount) { + if (props.onMount(this.viewer.presenter.getElement(PresenterElement$1.gl))) { this.view(); + } + } else { + this.view(); } - componentWillUnmount() { - this.viewer.finalize(); - } - render() { - return (0, _base.base).react.createElement("div", { - className: "sanddance-ReactViewer", - ref: (div)=>this.viewerDiv = div - }); - } + } + componentDidUpdate() { + const { props } = this; + this.viewer.options = deepMerge(this.viewer.options, props.viewerOptions); + this.view(); + } + componentWillUnmount() { + this.viewer.finalize(); + } + render() { + return base$2.react.createElement("div", { className: "sanddance-ReactViewer", ref: (div) => this.viewerDiv = div }); + } } return new __Viewer(_props); -} -const Viewer = _Viewer; - -},{"./base":"e2btd","./util":"71zHd","@msrvida/sanddance":"ganM8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e2btd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param react React library. - * @param vega Vega library. - * @param deck @deck.gl/core library. - * @param layers @deck.gl/layers library. - * @param luma @luma.gl/core library. - */ parcelHelpers.export(exports, "use", ()=>use); -var _viewer = require("./viewer"); -var _sanddance = require("@msrvida/sanddance"); -const base = { - react: null, - reactDOM: null -}; -function use(react, reactDOM, vega) { - _sanddance.VegaMorphCharts.use(vega); - base.react = react; - base.reactDOM = reactDOM; - //inform React that we are using a dynamic base class - (0, _viewer.Viewer).prototype = react.Component.prototype; -} - -},{"./viewer":"2yfj3","@msrvida/sanddance":"ganM8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g42QN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '4.0.2'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"67xOI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "strings", ()=>strings); -const strings = { - appName: 'SandDance', - bingsearch: 'Bing', - bingsearchDescription: (term)=>`Search Bing for "${term}"`, - buttonClose: 'Close', - buttonSelect: 'Search & Select', - buttonColorSchemeMap: 'Map color scheme to filtered data', - buttonColorSchemeRemap: 'Remap color to filtered data', - buttonColorSchemeKeep: 'Keep same color scheme', - buttonCopyToClipboard: 'Copy to clipboard', - buttonExclude: 'Exclude', - buttonExport: 'Export', - buttonExportCount: (total)=>total == 1 ? 'Export 1 row...' : `Export ${total} rows...`, - buttonIsolate: 'Isolate', - buttonReset: 'Stop filtering', - buttonDeselect: 'Clear selection', - buttonToolbarFloat: 'Float toolbar', - buttonToolbarDock: 'Dock toolbar', - buttonToolbarHide: 'Hide toolbar', - buttonToolbarShow: 'Show toolbar', - buttonNextDataItem: 'Next data item', - buttonPrevDataItem: 'Previous data item', - buttonCreateSnapshot: 'Create snapshot', - buttonNextSnapshot: 'Next snapshot', - buttonPrevSnapshot: 'Previous snapshot', - buttonUpdateSnapshot: 'Update snapshot', - buttonAddExpression: 'Add expression', - buttonAddExpressionGroup: 'Add group', - buttonDeleteExpression: 'Delete', - buttonDeleteExpressionGroup: 'Delete group', - buttonClearSnapshots: 'Clear snapshots', - buttonDeleteSnapshot: 'Delete snapshot', - buttonEditSnapshot: 'Edit snapshot', - buttonMoveUp: 'Move up', - buttonMoveDown: 'Move down', - buttonShowVegaSpec: 'Show Vega spec', - buttonLaunchVegaEditor: 'Open Vega Editor', - buttonCameraHome: 'Center chart in window', - buttonTooltipMapping: 'Tooltip columns...', - buttonBackgroundImage: 'Background image...', - buttonTransitionReverse: 'Play Reverse', - buttonTransitionPause: 'Pause', - buttonTransitionPlay: 'Play', - buttonUndo: 'Undo', - buttonRedo: 'Redo', - buttonColumnTypes: 'Column types...', - buttonApply: 'Apply', - buttonRemove: 'Remove', - buttonResetToDefault: 'Reset to default', - chartTypeBarChartH: 'Bar', - chartTypeBarChartV: 'Column', - chartTypeDensity: 'Density', - chartTypeGrid: 'Grid', - chartTypeScatterPlot: 'Scatter', - chartTypeStacks: 'Stacks', - chartTypeStrips: 'Strips', - chartTypeTreeMap: 'Treemap', - defaultFileName: 'sanddance-data', - errorExportFilenameEmpty: 'Filename cannot be blank', - errorExportFilenameCharacters: (characters)=>`A filename cannot contain any of the following characters: ${characters}`, - errorColumnMustBeNumeric: 'Numeric column required for this chart type.', - errorNumericValue: 'Value must be numeric', - errorImageFormat: 'File is not an image', - labelBackgroundImageDialogTitle: 'Background image', - labelBackgroundImageSubtext: 'Background image can only be shown on Scatterplot, Density, and Stacks charts. Columns must be numeric type.', - labelBackgroundLeft: 'Left extent', - labelBackgroundRight: 'Right extent', - labelBackgroundBottom: 'Bottom extent', - labelBackgroundTop: 'Top extent', - labelBlank: 'blank', - labelNull: 'null', - labelTrue: 'true', - labelFalse: 'false', - labelSystemInfo: 'System info', - labelChangeColumnType: 'Change column type', - labelChartSettings: 'Chart settings', - labelEditColumn: 'Edit', - labelColumnName: 'Column name', - labelColumnType: 'Column type', - labelColumnDistinct: 'Distinct values', - labelColumnHasColorData: 'Has color data', - labelColumnIsColorData: 'Is color data', - labelColumnQuantitativeMin: 'Min', - labelColumnQuantitativeMax: 'Max', - labelColumnQuantitativeMean: 'Mean', - labelDataBrowser: 'Data browser', - labelDataScope: 'Scope', - labelExport: 'Export Data', - labelExportFormat: 'File format', - labelExportCSV: '.CSV - Comma separated values', - labelExportHTML: '.HTML - A SandDance html page embedding this data', - labelExportJSON: '.JSON - JavaScript object notation', - labelExportTSV: '.TSV - Tab separated values', - labelHistory: 'History', - labelHistoryWarning: 'This will erase your current history.', - labelTools: 'Tools', - labelHoldCamera: 'Keep previous camera position', - labelVegaSpec: 'Vega specification', - labelColor: 'Chart color', - labelError: 'Error', - labelExportFileName: 'File name', - labelSnapshots: 'Snapshots', - labelSnapshotSettingThumbnailWidth: 'Thumbnail image width', - labelSearch: 'Select by search', - labelSearchClause: 'Clause', - labelSearchColumn: 'Field', - labelSearchOperator: 'Operator', - labelSearchValue: 'Value', - labelSearchValuePlaceholder: 'Value to search for', - labelChart: 'Chart', - labelChartCanvas: 'Chart canvas', - labelColumnMapping: 'Column Mapping', - labelChartTypeOptions: 'Chart options', - labelColorBin: 'Color binning', - labelColorOptions: 'Color options', - labelColorBinExplanation: 'For numeric columns', - labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount)=>`Field <span className="fieldname">${colorColumnName}</span> is of type <span className="fieldtype">${colorColumnType}</span>${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ''}.`, - labelColorFieldIsColorData: (colorColumnName)=>`Field <span className="fieldname">${colorColumnName}</span> contains direct color data.`, - labelColorBinNone: 'None (continuous)', - labelColorBinQuantize: 'Quantize', - labelColorBinQuantile: 'Quantile', - labelColorFilter: 'Note: Colors will be re-mapped to the filter when viewing this snapshot.', - labelColorScheme: 'Scheme', - labelTotal: 'Total by', - labelTotalByCountSquare: 'Count (Grid layout)', - labelTotalByCountStrip: 'Count (Strip layout)', - labelTotalBySumStrip: 'Sum (Strip layout)', - labelTotalBySumTreemap: 'Sum (Treemap layout)', - labelTotalBySumStripPercent: 'Sum as percentage (Strip layout)', - labelColumnColor: 'Color by', - labelColumnFacet: 'Facet by', - labelFacetLayout: 'Facet layout', - labelFacetLayoutWrap: 'Wrap', + } + const Viewer = _Viewer; + const version$3 = "4.0.2"; + const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + SandDance: index$4, + Viewer, + use: use$3, + util: util$2, + version: version$3 + }, Symbol.toStringTag, { value: "Module" })); + const strings$1 = { + appName: "SandDance", + bingsearch: "Bing", + bingsearchDescription: (term) => `Search Bing for "${term}"`, + buttonClose: "Close", + buttonSelect: "Search & Select", + buttonColorSchemeMap: "Map color scheme to filtered data", + buttonColorSchemeRemap: "Remap color to filtered data", + buttonColorSchemeKeep: "Keep same color scheme", + buttonCopyToClipboard: "Copy to clipboard", + buttonExclude: "Exclude", + buttonExport: "Export", + buttonExportCount: (total) => total == 1 ? "Export 1 row..." : `Export ${total} rows...`, + buttonIsolate: "Isolate", + buttonReset: "Stop filtering", + buttonDeselect: "Clear selection", + buttonToolbarFloat: "Float toolbar", + buttonToolbarDock: "Dock toolbar", + buttonToolbarHide: "Hide toolbar", + buttonToolbarShow: "Show toolbar", + buttonNextDataItem: "Next data item", + buttonPrevDataItem: "Previous data item", + buttonCreateSnapshot: "Create snapshot", + buttonNextSnapshot: "Next snapshot", + buttonPrevSnapshot: "Previous snapshot", + buttonUpdateSnapshot: "Update snapshot", + buttonAddExpression: "Add expression", + buttonAddExpressionGroup: "Add group", + buttonDeleteExpression: "Delete", + buttonDeleteExpressionGroup: "Delete group", + buttonClearSnapshots: "Clear snapshots", + buttonDeleteSnapshot: "Delete snapshot", + buttonEditSnapshot: "Edit snapshot", + buttonMoveUp: "Move up", + buttonMoveDown: "Move down", + buttonShowVegaSpec: "Show Vega spec", + buttonLaunchVegaEditor: "Open Vega Editor", + buttonCameraHome: "Center chart in window", + buttonTooltipMapping: "Tooltip columns...", + buttonBackgroundImage: "Background image...", + buttonTransitionReverse: "Play Reverse", + buttonTransitionPause: "Pause", + buttonTransitionPlay: "Play", + buttonUndo: "Undo", + buttonRedo: "Redo", + buttonColumnTypes: "Column types...", + buttonApply: "Apply", + buttonRemove: "Remove", + buttonResetToDefault: "Reset to default", + chartTypeBarChartH: "Bar", + chartTypeBarChartV: "Column", + chartTypeDensity: "Density", + chartTypeGrid: "Grid", + chartTypeScatterPlot: "Scatter", + chartTypeStacks: "Stacks", + chartTypeStrips: "Strips", + chartTypeTreeMap: "Treemap", + defaultFileName: "sanddance-data", + errorExportFilenameEmpty: "Filename cannot be blank", + errorExportFilenameCharacters: (characters) => `A filename cannot contain any of the following characters: ${characters}`, + errorColumnMustBeNumeric: "Numeric column required for this chart type.", + errorNumericValue: "Value must be numeric", + errorImageFormat: "File is not an image", + labelBackgroundImageDialogTitle: "Background image", + labelBackgroundImageSubtext: "Background image can only be shown on Scatterplot, Density, and Stacks charts. Columns must be numeric type.", + labelBackgroundLeft: "Left extent", + labelBackgroundRight: "Right extent", + labelBackgroundBottom: "Bottom extent", + labelBackgroundTop: "Top extent", + labelBlank: "blank", + labelNull: "null", + labelTrue: "true", + labelFalse: "false", + labelSystemInfo: "System info", + labelChangeColumnType: "Change column type", + labelChartSettings: "Chart settings", + labelEditColumn: "Edit", + labelColumnName: "Column name", + labelColumnType: "Column type", + labelColumnDistinct: "Distinct values", + labelColumnHasColorData: "Has color data", + labelColumnIsColorData: "Is color data", + labelColumnQuantitativeMin: "Min", + labelColumnQuantitativeMax: "Max", + labelColumnQuantitativeMean: "Mean", + labelDataBrowser: "Data browser", + labelDataScope: "Scope", + labelExport: "Export Data", + labelExportFormat: "File format", + labelExportCSV: ".CSV - Comma separated values", + labelExportHTML: ".HTML - A SandDance html page embedding this data", + labelExportJSON: ".JSON - JavaScript object notation", + labelExportTSV: ".TSV - Tab separated values", + labelHistory: "History", + labelHistoryWarning: "This will erase your current history.", + labelTools: "Tools", + labelHoldCamera: "Keep previous camera position", + labelVegaSpec: "Vega specification", + labelColor: "Chart color", + labelError: "Error", + labelExportFileName: "File name", + labelSnapshots: "Snapshots", + labelSnapshotSettingThumbnailWidth: "Thumbnail image width", + labelSearch: "Select by search", + labelSearchClause: "Clause", + labelSearchColumn: "Field", + labelSearchOperator: "Operator", + labelSearchValue: "Value", + labelSearchValuePlaceholder: "Value to search for", + labelChart: "Chart", + labelChartCanvas: "Chart canvas", + labelColumnMapping: "Column Mapping", + labelChartTypeOptions: "Chart options", + labelColorBin: "Color binning", + labelColorOptions: "Color options", + labelColorBinExplanation: "For numeric columns", + labelColorFieldInfo: (colorColumnName, colorColumnType, categoricalNumeric, distinctValueCount) => `Field <span className="fieldname">${colorColumnName}</span> is of type <span className="fieldtype">${colorColumnType}</span>${categoricalNumeric ? ` and has ${distinctValueCount} distinct values` : ""}.`, + labelColorFieldIsColorData: (colorColumnName) => `Field <span className="fieldname">${colorColumnName}</span> contains direct color data.`, + labelColorBinNone: "None (continuous)", + labelColorBinQuantize: "Quantize", + labelColorBinQuantile: "Quantile", + labelColorFilter: "Note: Colors will be re-mapped to the filter when viewing this snapshot.", + labelColorScheme: "Scheme", + labelTotal: "Total by", + labelTotalByCountSquare: "Count (Grid layout)", + labelTotalByCountStrip: "Count (Strip layout)", + labelTotalBySumStrip: "Sum (Strip layout)", + labelTotalBySumTreemap: "Sum (Treemap layout)", + labelTotalBySumStripPercent: "Sum as percentage (Strip layout)", + labelColumnColor: "Color by", + labelColumnFacet: "Facet by", + labelFacetLayout: "Facet layout", + labelFacetLayoutWrap: "Wrap", // labelFacetLayoutHorizontal: 'Horizontal', // labelFacetLayoutVertical: 'Vertical', - labelFacetLayoutCross: "\u229E", - labelColumnFacetV: 'Cross facet by', - labelColumnSort: 'Sort by', - labelColumnX: 'X Axis', - labelColumnY: 'Y Axis', - labelColumnZ: 'Z Axis', - labelColumnSize: 'Size by', - labelColumnGroup: 'Group by', - labelAliasColor: 'Color', - labelAliasFacet: 'Facet', - labelAliasFacetV: 'Vertical facet', - labelAliasSort: 'Sort', - labelAliasX: 'X Axis', - labelAliasY: 'Y Axis', - labelAliasZ: 'Z Axis', - labelAliasSize: 'Size', - labelAliasGroup: 'Group', - labelDataItemIsFiltered: 'Item is filtered from view', - labelHistoryInit: 'Initial view', - labelHistoryFilterClear: 'Clear filter', - labelHistoryFilterIExclude: 'Exclude filter', - labelHistoryFilterIsolate: 'Isolate filter', - labelHistoryChangeChartType: (chart)=>`Change chart type to ${chart}`, - labelHistoryMapColumn: (column)=>`Map ${column} role`, - labelHistoryUnMapColumn: (column)=>`Unmap ${column} role`, - labelHistoryReviveSnapshot: 'Revive snapshot', - labelHistoryColorBin: 'Change color binning', - labelHistoryDirectColor: 'Change direct color', - labelRenderer: 'Renderer quality', - labelRendererAdvancedDisabled: 'Renderer quality (Enhanced 3D mode not supported on this device)', - labelRendererBasic: 'Standard mode', - labelRendererAdvanced: 'Enhanced 3D mode', - labelRendererOptions: 'Renderer options ...', - labelRendererOptionsDialogTitle: 'Renderer options', - labelRendererOptionsAntialias: 'Antialias', - labelRendererOptionsBloom: 'Bloom highlighting (for selections)', - labelRendererOptionsBloomIntensity: 'Intensity', - labelRendererOptionsDof: 'Depth of Field', - labelRendererOptionsDofRange: 'Focus Range', - labelRendererOptionsFxaa: 'Antialias', - labelRendererOptionsShadow: 'Shadows', - labelRendererOptionsSsao: 'Screen Space Ambient Occlusion', - labelShowLegend: 'Show legend', - labelShowAxes: 'Show axes', - labelSnapshotTitle: 'Title', - labelSnapshotDescription: 'Note (optional)', - labelTooltipMapping: 'Tooltip columns', - labelTransition: 'Transition', - labelTransitionOptions: 'Transition options', - labelTransitionScrubber: 'Scrub transition', - labelTransitionStaggerBy: 'Stagger by', - labelTransitionStaggerByOrdinal: 'Data order', - labelTransitionStaggerByColumn: 'Column', - labelTransitionStaggerByPosition: 'Axis position', - labelTransitionStaggerOptions: 'Stagger options', - labelTransitionStaggerReverse: 'Reverse', - labelTransitionDurations: 'Transition durations', - labelTransitionCamera: '2D / 3D view', - labelTransitionDuration: 'Duration', - labelTransitionStagger: 'Stagger', - labelVegaSpecData: 'Data reference', - labelVegaSpecNotes: 'Note: You may need to change the color scheme to make this visible in Vega.', - labelYes: 'Yes', - labelNo: 'No', - labelConfirmation: 'Are you sure?', - labelColumnTypes: 'Column types', - loading: 'Loading...', - schemeCategorical: 'Categorical', - schemeCyclical: 'Cyclical', - schemeDiverging: 'Diverging', - schemeDual: 'Dual', - schemeSequentialMultiHue: 'Sequential Multi Hue', - schemeSequentialMultiHueDark: 'For dark backgrounds', - schemeSequentialMultiHueLight: 'For light backgrounds', - schemeSequentialSingleHue: 'Sequential Single Hue', - selectDataSpanAll: 'All rows', - selectDataSpanFilter: 'Filtered', - selectDataSpanSelection: 'Selected', - selectVegaSpecDataNone: 'None', - selectVegaSpecDataInline: 'Inline - WARNING this may use substantial browser/clipboard memory for large data sets.', - selectVegaSpecDataUrl: 'URL', - record: (current, total)=>`${current} of ${total}`, - searchEQ: '=', - searchNEQ: '<>', - searchGT: '>', - searchGTE: '>=', - searchLT: '<', - searchLTE: '<=', - searchNULL: 'is null or empty', - searchIN: 'contains', - searchSW: 'starts with', - searchWHERE: 'Where', - searchAND: 'and', - searchOR: 'or', - selectAny: '-- any --', - selectNone: '-- none --', - selectNumeric: 'Numeric', - selectNonNumeric: 'Categorical', - selectDirectColor: 'Direct color', - selectReference: 'Column mappings', - tooltipSearch: (column, value)=>`Click to search in '${column}' for "${value}"`, - labelRequired: 'required', - labelSystem: 'System', - labelViewType2d: 'View in 2D', - labelViewType3d: 'View in 3D', - labelDataColors: 'Enabled if this data column contains any CSS color values.', - labelDataNullAll: 'Loading data...', - labelDataNullFiltered: 'You can filter by first making a selection, then choosing <b>Isolate</b> or <b>Exclude</b> in the top bar.', - labelDataNullSelection: 'You can select by: <ul><li>clicking the chart axes</li><li>clicking in the legend</li><li>searching</li</ul>', - labelZeroAll: 'Dataset contains zero rows.', - labelZeroSearchResults: 'No rows matched your search.', + labelFacetLayoutCross: "⊞", + labelColumnFacetV: "Cross facet by", + labelColumnSort: "Sort by", + labelColumnX: "X Axis", + labelColumnY: "Y Axis", + labelColumnZ: "Z Axis", + labelColumnSize: "Size by", + labelColumnGroup: "Group by", + labelAliasColor: "Color", + labelAliasFacet: "Facet", + labelAliasFacetV: "Vertical facet", + labelAliasSort: "Sort", + labelAliasX: "X Axis", + labelAliasY: "Y Axis", + labelAliasZ: "Z Axis", + labelAliasSize: "Size", + labelAliasGroup: "Group", + labelDataItemIsFiltered: "Item is filtered from view", + labelHistoryInit: "Initial view", + labelHistoryFilterClear: "Clear filter", + labelHistoryFilterIExclude: "Exclude filter", + labelHistoryFilterIsolate: "Isolate filter", + labelHistoryChangeChartType: (chart) => `Change chart type to ${chart}`, + labelHistoryMapColumn: (column) => `Map ${column} role`, + labelHistoryUnMapColumn: (column) => `Unmap ${column} role`, + labelHistoryReviveSnapshot: "Revive snapshot", + labelHistoryColorBin: "Change color binning", + labelHistoryDirectColor: "Change direct color", + labelRenderer: "Renderer quality", + labelRendererAdvancedDisabled: "Renderer quality (Enhanced 3D mode not supported on this device)", + labelRendererBasic: "Standard mode", + labelRendererAdvanced: "Enhanced 3D mode", + labelRendererOptions: "Renderer options ...", + labelRendererOptionsDialogTitle: "Renderer options", + labelRendererOptionsAntialias: "Antialias", + labelRendererOptionsBloom: "Bloom highlighting (for selections)", + labelRendererOptionsBloomIntensity: "Intensity", + labelRendererOptionsDof: "Depth of Field", + labelRendererOptionsDofRange: "Focus Range", + labelRendererOptionsFxaa: "Antialias", + labelRendererOptionsShadow: "Shadows", + labelRendererOptionsSsao: "Screen Space Ambient Occlusion", + labelShowLegend: "Show legend", + labelShowAxes: "Show axes", + labelSnapshotTitle: "Title", + labelSnapshotDescription: "Note (optional)", + labelTooltipMapping: "Tooltip columns", + labelTransition: "Transition", + labelTransitionOptions: "Transition options", + labelTransitionScrubber: "Scrub transition", + labelTransitionStaggerBy: "Stagger by", + labelTransitionStaggerByOrdinal: "Data order", + labelTransitionStaggerByColumn: "Column", + labelTransitionStaggerByPosition: "Axis position", + labelTransitionStaggerOptions: "Stagger options", + labelTransitionStaggerReverse: "Reverse", + labelTransitionDurations: "Transition durations", + labelTransitionCamera: "2D / 3D view", + labelTransitionDuration: "Duration", + labelTransitionStagger: "Stagger", + labelVegaSpecData: "Data reference", + labelVegaSpecNotes: "Note: You may need to change the color scheme to make this visible in Vega.", + labelYes: "Yes", + labelNo: "No", + labelConfirmation: "Are you sure?", + labelColumnTypes: "Column types", + loading: "Loading...", + schemeCategorical: "Categorical", + schemeCyclical: "Cyclical", + schemeDiverging: "Diverging", + schemeDual: "Dual", + schemeSequentialMultiHue: "Sequential Multi Hue", + schemeSequentialMultiHueDark: "For dark backgrounds", + schemeSequentialMultiHueLight: "For light backgrounds", + schemeSequentialSingleHue: "Sequential Single Hue", + selectDataSpanAll: "All rows", + selectDataSpanFilter: "Filtered", + selectDataSpanSelection: "Selected", + selectVegaSpecDataNone: "None", + selectVegaSpecDataInline: "Inline - WARNING this may use substantial browser/clipboard memory for large data sets.", + selectVegaSpecDataUrl: "URL", + record: (current, total) => `${current} of ${total}`, + searchEQ: "=", + searchNEQ: "<>", + searchGT: ">", + searchGTE: ">=", + searchLT: "<", + searchLTE: "<=", + searchNULL: "is null or empty", + searchIN: "contains", + searchSW: "starts with", + searchWHERE: "Where", + searchAND: "and", + searchOR: "or", + selectAny: "-- any --", + selectNone: "-- none --", + selectNumeric: "Numeric", + selectNonNumeric: "Categorical", + selectDirectColor: "Direct color", + selectReference: "Column mappings", + tooltipSearch: (column, value2) => `Click to search in '${column}' for "${value2}"`, + labelRequired: "required", + labelSystem: "System", + labelViewType2d: "View in 2D", + labelViewType3d: "View in 3D", + labelDataColors: "Enabled if this data column contains any CSS color values.", + labelDataNullAll: "Loading data...", + labelDataNullFiltered: "You can filter by first making a selection, then choosing <b>Isolate</b> or <b>Exclude</b> in the top bar.", + labelDataNullSelection: "You can select by: <ul><li>clicking the chart axes</li><li>clicking in the legend</li><li>searching</li</ul>", + labelZeroAll: "Dataset contains zero rows.", + labelZeroSearchResults: "No rows matched your search.", signalGroups: [ - { - prefix: 'Chart', - label: 'Chart options' - }, - { - prefix: 'Mark', - label: 'Mark options' - }, - { - prefix: 'RoleColor', - label: 'Color options' - }, - { - prefix: 'RoleFacet', - label: 'Facet options' - }, - { - prefix: 'RoleSort', - label: 'Sort options' - }, - { - prefix: 'RoleX', - label: 'X axis options' - }, - { - prefix: 'RoleY', - label: 'Y axis options' - }, - { - prefix: 'RoleZ', - label: 'Z axis options' - }, - { - prefix: 'Text', - label: 'Text options' - }, - { - prefix: '*', - label: 'Options' - } + { prefix: "Chart", label: "Chart options" }, + { prefix: "Mark", label: "Mark options" }, + { prefix: "RoleColor", label: "Color options" }, + { prefix: "RoleFacet", label: "Facet options" }, + { prefix: "RoleSort", label: "Sort options" }, + { prefix: "RoleX", label: "X axis options" }, + { prefix: "RoleY", label: "Y axis options" }, + { prefix: "RoleZ", label: "Z axis options" }, + { prefix: "Text", label: "Text options" }, + { prefix: "*", label: "Options" } ], - percentValueFormat: (value)=>`${value}%` -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6pZiK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconButton", ()=>IconButton); -var _base = require("../base"); -function IconButton(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.IconButton, Object.assign({}, props, { - styles: props.styles || { - root: { - color: props.themePalette.black - }, - rootHovered: { - background: 'transparent', - color: props.themePalette.themePrimary - }, - rootPressed: { - background: 'transparent' - }, - menuIcon: { - display: 'none' - } - }, - iconProps: { - iconName: props.iconName + percentValueFormat: (value2) => `${value2}%` + }; + function IconButton$1(props) { + return base$1.react.createElement(base$1.fluentUI.IconButton, Object.assign({}, props, { styles: props.styles || { + root: { + color: props.themePalette.black + }, + rootHovered: { + background: "transparent", + color: props.themePalette.themePrimary + }, + rootPressed: { + background: "transparent" + }, + menuIcon: { + display: "none" + } + }, iconProps: { iconName: props.iconName }, menuProps: props.menuProps })); + } + const maxCategoricalColors = 20; + function defaultColorScheme$1(c2) { + if (c2.quantitative) { + return "redyellowgreen"; + } else if (c2.stats.distinctValueCount === 2) { + return "dual_redgreen"; + } else if (c2.stats.distinctValueCount <= 10) { + return "category10"; + } + return "category20"; + } + const maxDistinctVal = 20; + const minDistinctVal = 2; + class BarChartRecommenderSummary { + constructor(columns, data2) { + let score2 = -1; + for (let i = 0; i < columns.length; i++) { + const recommendation = new BarChartRecommender(columns[i], data2).recommend(); + if (recommendation.score > score2) { + this.best = recommendation; + score2 = recommendation.score; + } + if (score2 === 1) + break; + } + for (let k = 0; k < columns.length; k++) { + const column = columns[k]; + if (column.name === this.best.columns.x || column.stats.isSequential) + continue; + if (column.quantitative || column.stats.distinctValueCount < maxCategoricalColors && column.stats.distinctValueCount > 1) { + this.best.columns.color = this.best.columns.sort = column.name; + this.best.scheme = defaultColorScheme$1(column); + if (column.quantitative) { + this.best.colorBin = "quantile"; + } + break; + } + } + } + recommend() { + return this.best; + } + } + class BarChartRecommender { + constructor(column, data2) { + this.score = 0; + this.column = column; + this.rules = [ + (column2) => { + if (column2.stats.isSequential) + return false; + else if (column2.quantitative) { + return true; + } else if (!column2.quantitative && column2.stats.distinctValueCount <= maxDistinctVal && column2.stats.distinctValueCount >= minDistinctVal) { + return true; + } else { + return false; + } + } + ]; + for (let i = 0; i < this.rules.length; i++) { + if (this.rules[i](column)) + this.score++; + } + } + recommend() { + const rec = { + chart: "barchart", + columns: { + x: this.column.name }, - menuProps: props.menuProps - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7ZE4v":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ensureColumnsExist", ()=>ensureColumnsExist); -parcelHelpers.export(exports, "ensureColumnsPopulated", ()=>ensureColumnsPopulated); -parcelHelpers.export(exports, "getTreemapColumn", ()=>getTreemapColumn); -parcelHelpers.export(exports, "colorMapping", ()=>colorMapping); -parcelHelpers.export(exports, "getBackgroundImageColumnBounds", ()=>getBackgroundImageColumnBounds); -var _chartRecommender = require("@msrvida/chart-recommender"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("./language"); -function ensureColumnsExist(insightColumns, actualColumns, transform) { - //ensure columns exist - for(const role in insightColumns){ - const columnName = insightColumns[role]; - const column = actualColumns.filter((c)=>c.name === columnName)[0]; - const transformColumn = transform ? transform.filter((t)=>{ - switch(t.type){ - case 'formula': - return t.as === columnName; + score: this.score, + scheme: void 0, + view: "2d" + }; + return rec; + } + } + const longitudeNames = ["lon", "long", "longitude"]; + const latitudeNames = ["lat", "latitude"]; + function isSpec(names, limits, column, data2) { + let is = false; + const cname = column.name.toLowerCase(); + for (let i = 0; i < names.length; i++) { + if (names[i] === cname) { + is = true; + break; + } + } + return is; + } + function isLongitude(column, data2) { + return isSpec(longitudeNames, [-180, 180], column); + } + function isLatitude(column, data2) { + return isSpec(latitudeNames, [-90, 90], column); + } + function isGeo(column, data2) { + return isLatitude(column) || isLongitude(column); + } + class ScatterPlotRecommenderSummary { + constructor(columns, data2) { + const rec = { + chart: "scatterplot", + score: void 0, + columns: {}, + scheme: void 0, + view: "2d" + }; + columns.forEach((column) => { + if (!rec.columns.x) { + if (column.name.toLowerCase() === "x") { + return rec.columns.x = column.name; + } else if (isLongitude(column)) { + return rec.columns.x = column.name; + } + } + if (!rec.columns.y) { + if (column.name.toLowerCase() === "y") { + return rec.columns.y = column.name; + } else if (isLatitude(column)) { + return rec.columns.y = column.name; + } + } + if (!rec.columns.color && !column.stats.isSequential) { + if (column.quantitative || column.stats.distinctValueCount < maxCategoricalColors) { + rec.columns.color = rec.columns.sort = column.name; + rec.scheme = defaultColorScheme$1(column); + if (column.quantitative) { + rec.colorBin = "quantile"; } - })[0] : null; - if (!(column || transformColumn)) delete insightColumns[role]; + return; + } + } + }); + if (rec.columns.x && rec.columns.y) { + this.best = rec; + } + } + recommend() { + return this.best; + } + } + function preferredColumnForTreemapSize(columns, strict) { + for (let i = 0; i < columns.length; i++) { + const c2 = columns[i]; + if (c2.quantitative) { + if (strict && c2.stats.hasNegative) + continue; + if (strict && c2.stats.isSequential) + continue; + if (strict && isGeo(c2)) + continue; + return c2; + } + } + } + class RecommenderSummary { + constructor(columns, data2) { + const quickRec = new ScatterPlotRecommenderSummary(columns, data2).recommend(); + if (quickRec) { + this.rec = quickRec; + } else { + const barChartrec = new BarChartRecommenderSummary(columns, data2).recommend(); + if (barChartrec && barChartrec.score >= 1) { + this.rec = barChartrec; + } else { + this.rec = { + chart: "grid", + columns: {}, + score: 1 + }; + } + } + } + recommend() { + return this.rec; + } + } + function ensureColumnsExist(insightColumns, actualColumns, transform2) { + for (const role in insightColumns) { + const columnName = insightColumns[role]; + const column = actualColumns.filter((c2) => c2.name === columnName)[0]; + const transformColumn = transform2 ? transform2.filter((t) => { + switch (t.type) { + case "formula": { + return t.as === columnName; + } + } + })[0] : null; + if (!(column || transformColumn)) { + delete insightColumns[role]; + } } -} -function ensureColumnsPopulated(chart, totalStyle, insightColumns, actualColumns) { - //ensure columns are populated - const nonInternal = actualColumns.filter((c)=>!(0, _sanddanceReact.SandDance).util.isInternalFieldName(c.name)); + } + function ensureColumnsPopulated(chart, totalStyle, insightColumns, actualColumns) { + const nonInternal = actualColumns.filter((c2) => !isInternalFieldName(c2.name)); const firstColumn = nonInternal[0]; const firstColumnName = firstColumn && firstColumn.name; - const firstQuantitative = nonInternal.filter((c)=>c.quantitative)[0]; + const firstQuantitative = nonInternal.filter((c2) => c2.quantitative)[0]; const firstQuantitativeColumnName = firstQuantitative && firstQuantitative.name; - const ensureColumn = (role, quantitative, treemap)=>{ - if (!insightColumns[role]) { - if (treemap) insightColumns[role] = getTreemapColumn(actualColumns).name; - else insightColumns[role] = quantitative ? firstQuantitativeColumnName : firstColumnName; + const ensureColumn = (role, quantitative, treemap2) => { + if (!insightColumns[role]) { + if (treemap2) { + insightColumns[role] = getTreemapColumn(actualColumns).name; + } else { + insightColumns[role] = quantitative ? firstQuantitativeColumnName : firstColumnName; } + } }; function checkRequiresSize() { - switch(totalStyle){ - case 'sum-strip': - case 'sum-strip-percent': - ensureColumn('size', true); - break; - case 'sum-treemap': - ensureColumn('size', true, true); - break; - } - } - switch(chart){ - case 'barchart': - case 'barchartV': - ensureColumn('x'); - checkRequiresSize(); - break; - case 'barchartH': - ensureColumn('y'); - checkRequiresSize(); - break; - case 'density': - ensureColumn('x'); - ensureColumn('y'); - checkRequiresSize(); - break; - case 'scatterplot': - case 'stacks': - ensureColumn('x'); - ensureColumn('y'); - break; - case 'treemap': - if (!insightColumns.size) insightColumns.size = getTreemapColumn(actualColumns).name; - if (!insightColumns.size) //error - no numeric column - return [ - (0, _language.strings).errorColumnMustBeNumeric - ]; - break; + switch (totalStyle) { + case "sum-strip": + case "sum-strip-percent": + ensureColumn("size", true); + break; + case "sum-treemap": + ensureColumn("size", true, true); + break; + } } -} -function getTreemapColumn(columns) { - let column = (0, _chartRecommender.preferredColumnForTreemapSize)(columns, true); - if (!column) column = (0, _chartRecommender.preferredColumnForTreemapSize)(columns, false); - return column; -} -function colorMapping(insight, columns) { - if (columns && insight.columns && insight.columns.color) return columns.filter((c)=>c.name === insight.columns.color)[0]; -} -function getBackgroundImageColumnBounds(columns) { - const bounds = []; - const getBound = (dimension, dataExtent, column)=>{ - const { stats } = column; - const numericValue = dataExtent === 'max' ? stats.max : stats.min; - return { - columnName: column.name, - dimension, - valid: true, - dataExtent, - numericValue, - stringValue: numericValue.toString() - }; - }; - const dataExtents = [ - 'max', - 'min' - ]; - const dimensions = [ - 'x', - 'y' - ]; - columns.forEach((c)=>{ - if (c.quantitative) dimensions.forEach((dimension)=>dataExtents.forEach((dataExtent)=>bounds.push(getBound(dimension, dataExtent, c)))); - }); - return bounds; -} - -},{"@msrvida/chart-recommender":"isTvp","@msrvida/sanddance-react":"lPyTZ","./language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"isTvp":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = { - enumerable: true, - get: function() { - return m[k]; - } - }; - Object.defineProperty(o, k2, desc); -} : function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); -var __exportStar = this && this.__exportStar || function(m, exports1) { - for(var p in m)if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports1, p)) __createBinding(exports1, m, p); -}; -Object.defineProperty(exports, "__esModule", { - value: true -}); -__exportStar(require("43b13d552e7a85bc"), exports); -__exportStar(require("3bedc68f1cc8f2e4"), exports); -__exportStar(require("ff78bff758b84686"), exports); -__exportStar(require("c80f1af882b7a9bb"), exports); -__exportStar(require("d8855069a6fbb589"), exports); - -},{"43b13d552e7a85bc":"dW3JE","3bedc68f1cc8f2e4":"h5UzG","ff78bff758b84686":"f7ySk","c80f1af882b7a9bb":"elfOE","d8855069a6fbb589":"fBxhA"}],"dW3JE":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.BarChartRecommender = exports.BarChartRecommenderSummary = void 0; -var recommender_1 = require("ab394df5de988f3a"); -var maxDistinctVal = 20; -var minDistinctVal = 2; -var BarChartRecommenderSummary = /** @class */ function() { - function BarChartRecommenderSummary(columns, data) { - var score = -1; - for(var i = 0; i < columns.length; i++){ - var recommendation = new BarChartRecommender(columns[i], data).recommend(); - if (recommendation.score > score) { - this.best = recommendation; - score = recommendation.score; - } - if (score === 1) break; - } - for(var k = 0; k < columns.length; k++){ - var column = columns[k]; - if (column.name === this.best.columns.x || column.stats.isSequential) continue; - if (column.quantitative || column.stats.distinctValueCount < recommender_1.maxCategoricalColors && column.stats.distinctValueCount > 1) { - this.best.columns.color = this.best.columns.sort = column.name; - this.best.scheme = (0, recommender_1.defaultColorScheme)(column); - if (column.quantitative) this.best.colorBin = 'quantile'; - break; - } + switch (chart) { + case "barchart": + case "barchartV": + ensureColumn("x"); + checkRequiresSize(); + break; + case "barchartH": + ensureColumn("y"); + checkRequiresSize(); + break; + case "density": + ensureColumn("x"); + ensureColumn("y"); + checkRequiresSize(); + break; + case "scatterplot": + case "stacks": + ensureColumn("x"); + ensureColumn("y"); + break; + case "treemap": + if (!insightColumns.size) { + insightColumns.size = getTreemapColumn(actualColumns).name; } + if (!insightColumns.size) { + return [strings$1.errorColumnMustBeNumeric]; + } + break; } - BarChartRecommenderSummary.prototype.recommend = function() { - return this.best; - }; - return BarChartRecommenderSummary; -}(); -exports.BarChartRecommenderSummary = BarChartRecommenderSummary; -var BarChartRecommender = /** @class */ function() { - function BarChartRecommender(column, data) { - this.score = 0; - this.column = column; - //the total score for bar chart is 1 - this.rules = [ - function(column) { - if (column.stats.isSequential) return false; - else if (column.quantitative) return true; - else if (!column.quantitative && column.stats.distinctValueCount <= maxDistinctVal && column.stats.distinctValueCount >= minDistinctVal) return true; - else return false; - } - ]; - for(var i = 0; i < this.rules.length; i++)if (this.rules[i](column)) this.score++; + } + function getTreemapColumn(columns) { + let column = preferredColumnForTreemapSize(columns, true); + if (!column) { + column = preferredColumnForTreemapSize(columns, false); } - BarChartRecommender.prototype.recommend = function() { - var rec = { - chart: 'barchart', - columns: { - x: this.column.name - }, - score: this.score, - scheme: undefined, - view: '2d' - }; - return rec; - }; - return BarChartRecommender; -}(); -exports.BarChartRecommender = BarChartRecommender; - -},{"ab394df5de988f3a":"fhBxd"}],"fhBxd":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.Recommender = exports.maxCategoricalColors = void 0; -exports.defaultColorScheme = defaultColorScheme; -exports.maxCategoricalColors = 20; -var Recommender = /** @class */ function() { - function Recommender(columns, data) {} - return Recommender; -}(); -exports.Recommender = Recommender; -function defaultColorScheme(c) { - if (c.quantitative) return 'redyellowgreen'; - else if (c.stats.distinctValueCount === 2) return 'dual_redgreen'; - else if (c.stats.distinctValueCount <= 10) return 'category10'; - return 'category20'; -} - -},{}],"h5UzG":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isLongitude = isLongitude; -exports.isLatitude = isLatitude; -exports.isGeo = isGeo; -//TODO: languages other than english -var longitudeNames = [ - 'lon', - 'long', - 'longitude' -]; -var latitudeNames = [ - 'lat', - 'latitude' -]; -function isSpec(names, limits, column, data) { - var is = false; - var cname = column.name.toLowerCase(); - for(var i = 0; i < names.length; i++)if (names[i] === cname) { - is = true; - break; + return column; + } + function colorMapping(insight, columns) { + if (columns && insight.columns && insight.columns.color) { + return columns.filter((c2) => c2.name === insight.columns.color)[0]; } - data; - return is; -} -function isLongitude(column, data) { - return isSpec(longitudeNames, [ - -180, - 180 - ], column, data); -} -function isLatitude(column, data) { - return isSpec(latitudeNames, [ - -90, - 90 - ], column, data); -} -function isGeo(column, data) { - return isLatitude(column, data) || isLongitude(column, data); -} - -},{}],"f7ySk":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.ScatterPlotRecommenderSummary = void 0; -var recommender_1 = require("cdb513d2718963f"); -var geo_1 = require("fccf598d2708866c"); -var ScatterPlotRecommenderSummary = /** @class */ function() { - function ScatterPlotRecommenderSummary(columns, data) { - var rec = { - chart: 'scatterplot', - score: undefined, - columns: {}, - scheme: undefined, - view: '2d' + } + function getBackgroundImageColumnBounds(columns) { + const bounds2 = []; + const getBound = (dimension, dataExtent2, column) => { + const { stats } = column; + const numericValue = dataExtent2 === "max" ? stats.max : stats.min; + return { + columnName: column.name, + dimension, + valid: true, + dataExtent: dataExtent2, + numericValue, + stringValue: numericValue.toString() + }; + }; + const dataExtents = ["max", "min"]; + const dimensions = ["x", "y"]; + columns.forEach((c2) => { + if (c2.quantitative) { + dimensions.forEach((dimension) => dataExtents.forEach((dataExtent2) => bounds2.push(getBound(dimension, dataExtent2, c2)))); + } + }); + return bounds2; + } + function _BackgroundImageEditor(_props) { + class __BackgroundImageEditor extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + backgroundImageColumnBounds: [], + readyToApply: false, + hidden: true }; - columns.forEach(function(column) { - if (!rec.columns.x) { - if (column.name.toLowerCase() === 'x') return rec.columns.x = column.name; - else if ((0, geo_1.isLongitude)(column)) return rec.columns.x = column.name; - } - if (!rec.columns.y) { - if (column.name.toLowerCase() === 'y') return rec.columns.y = column.name; - else if ((0, geo_1.isLatitude)(column)) return rec.columns.y = column.name; - } - if (!rec.columns.color && !column.stats.isSequential) { - if (column.quantitative || column.stats.distinctValueCount < recommender_1.maxCategoricalColors) { - rec.columns.color = rec.columns.sort = column.name; - rec.scheme = (0, recommender_1.defaultColorScheme)(column); - if (column.quantitative) rec.colorBin = 'quantile'; - return; - } - } - }); - if (rec.columns.x && rec.columns.y) this.best = rec; - } - ScatterPlotRecommenderSummary.prototype.recommend = function() { - return this.best; - }; - return ScatterPlotRecommenderSummary; -}(); -exports.ScatterPlotRecommenderSummary = ScatterPlotRecommenderSummary; - -},{"cdb513d2718963f":"fhBxd","fccf598d2708866c":"h5UzG"}],"elfOE":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.preferredColumnForTreemapSize = preferredColumnForTreemapSize; -var geo_1 = require("fcabcca7cde34752"); -function preferredColumnForTreemapSize(columns, strict) { - for(var i = 0; i < columns.length; i++){ - var c = columns[i]; - if (c.quantitative) { - if (strict && c.stats.hasNegative) continue; - if (strict && c.stats.isSequential) continue; - if (strict && (0, geo_1.isGeo)(c)) continue; - return c; - } - } -} - -},{"fcabcca7cde34752":"h5UzG"}],"fBxhA":[function(require,module,exports,__globalThis) { -"use strict"; -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.RecommenderSummary = void 0; -var barChart_1 = require("6385848df3350969"); -var scatterPlot_1 = require("800b6a0446d1d219"); -var RecommenderSummary = /** @class */ function() { - function RecommenderSummary(columns, data) { - var quickRec = new scatterPlot_1.ScatterPlotRecommenderSummary(columns, data).recommend(); - if (quickRec) this.rec = quickRec; - else { - var barChartrec = new barChart_1.BarChartRecommenderSummary(columns, data).recommend(); - if (barChartrec && barChartrec.score >= 1) this.rec = barChartrec; - else this.rec = { - chart: 'grid', - columns: {}, - score: 1 - }; + } + show(insightColumns) { + const { explorer: explorer2, quantitativeColumns } = this.props; + if (!quantitativeColumns.length) { + return; + } + const xCol = quantitativeColumns.filter((c2) => c2.name === insightColumns.x)[0]; + const yCol = quantitativeColumns.filter((c2) => c2.name === insightColumns.y)[0]; + let backgroundImageColumnBounds; + if (explorer2.imageHolder.backgroundImageColumnBounds.length < quantitativeColumns.length * 4) { + backgroundImageColumnBounds = getBackgroundImageColumnBounds(explorer2.state.dataContent.columns); + } else { + backgroundImageColumnBounds = clone(explorer2.imageHolder.backgroundImageColumnBounds); } - } - RecommenderSummary.prototype.recommend = function() { - return this.rec; - }; - return RecommenderSummary; -}(); -exports.RecommenderSummary = RecommenderSummary; - -},{"6385848df3350969":"dW3JE","800b6a0446d1d219":"f7ySk"}],"2iqEH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "attachSpecRoleToAxisTitle", ()=>attachSpecRoleToAxisTitle); -parcelHelpers.export(exports, "PositionedColumnMap", ()=>PositionedColumnMap); -var _base = require("./base"); -var _columnMap = require("./controls/columnMap"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function attachSpecRoleToAxisTitle(stage, specCapabilities) { - for(const axisName in stage.axes)specCapabilities.roles.forEach((specRole)=>{ - if (specRole.role === axisName) { - const axes = stage.axes[axisName]; - axes.forEach((axis)=>{ - if (axis.title) { - const textItem = axis.title; - textItem.specRole = specRole; + const newState = { hidden: false, xCol, yCol, backgroundImageColumnBounds }; + this.setState(newState); + this.checkReady(); + } + render() { + const { props, state } = this; + const { explorer: explorer2 } = props; + return base$1.react.createElement( + Dialog$1, + { hidden: state.hidden, onDismiss: () => this.setState({ hidden: true, backgroundImageFileFormatError: null }), modalProps: { + containerClassName: "sanddance-background-image-dialog" + }, dialogContentProps: { + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelBackgroundImageDialogTitle, + subText: strings$1.labelBackgroundImageSubtext + }, buttons: [ + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: "apply", iconProps: { iconName: "Photo2Add" }, text: strings$1.buttonApply, onClick: () => this.applyImage(true), disabled: !state.readyToApply }) + ] }, + explorer2.imageHolder.img ? base$1.react.createElement( + "div", + { className: "thumbnail" }, + base$1.react.createElement("img", { src: explorer2.imageHolder.img.src }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "remove", iconProps: { iconName: "Photo2Remove" }, text: strings$1.buttonRemove, onClick: () => { + explorer2.imageHolder.img = null; + this.applyImage(false); + this.setState({ readyToApply: false }); + } }) + ) : base$1.react.createElement( + "div", + { className: "thumbnail" }, + base$1.react.createElement("input", { type: "file", onChange: (e) => this.readBackgroundImage(e) }), + state.backgroundImageFileFormatError && base$1.react.createElement("div", { className: "error" }, state.backgroundImageFileFormatError) + ), + this.inputForColumn(state.xCol, "X axis", "x", strings$1.labelBackgroundLeft, strings$1.labelBackgroundRight), + this.inputForColumn(state.yCol, "Y axis", "y", strings$1.labelBackgroundBottom, strings$1.labelBackgroundTop) + ); + } + inputForColumn(column, label2, dimension, minLabel, maxLabel) { + const { props, state } = this; + const fieldInput = (label3, dataExtent2, getDefault) => { + const bounds2 = state.backgroundImageColumnBounds.filter((b2) => b2.columnName === (column === null || column === void 0 ? void 0 : column.name) && b2.dimension === dimension && b2.dataExtent === dataExtent2)[0]; + if (!bounds2) { + return null; + } + return base$1.react.createElement( + "div", + { className: "axis-bound-field" }, + base$1.react.createElement(base$1.fluentUI.TextField, { label: label3, onChange: (e, value2) => { + const numericValue = +value2; + bounds2.stringValue = value2; + bounds2.valid = !(!value2 || isNaN(numericValue)); + if (bounds2.valid) { + bounds2.numericValue = numericValue; + } + this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); + this.checkReady(); + }, value: bounds2.stringValue, errorMessage: bounds2.valid ? null : strings$1.errorNumericValue, onRenderSuffix: (a2) => { + return base$1.react.createElement(IconButton$1, { + iconName: "ScaleVolume", + themePalette: props.themePalette, + title: "Use data extent", + onClick: () => { + bounds2.numericValue = getDefault(); + bounds2.stringValue = bounds2.numericValue.toString(); + bounds2.valid = true; + this.setState({ backgroundImageColumnBounds: [...state.backgroundImageColumnBounds] }); + this.checkReady(); } - }); - } - }); -} -function px(n) { - return n + 'px'; -} -function _PositionedColumnMap(_props) { - class __PositionedColumnMap extends (0, _base.base).react.Component { - constructor(props){ - super(props); - const { left, top } = props; - this.state = { - left, - top + }); + } }) + ); + }; + return base$1.react.createElement( + "div", + { className: "axis-bounds" }, + base$1.react.createElement(base$1.fluentUI.Dropdown, { label: label2, options: props.quantitativeColumns.map((c2) => { + const option = { + key: c2.name, + text: c2.name }; - this.dropdownRef = (0, _base.base).react.createRef(); - } - focus() { - if (!this.focused) { - this.focused = true; - this.dropdownRef.current.focus(true); + return option; + }), onChange: (e, o) => { + const newState = { readyToApply: false }; + const newColumn = props.quantitativeColumns.filter((c2) => c2.name === o.key)[0]; + switch (dimension) { + case "x": { + newState.xCol = newColumn; + break; + } + case "y": { + newState.yCol = newColumn; + break; + } } - } - componentDidMount() { - const size = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.outerSize(this.div); - const over = { - left: Math.max(0, this.state.left + size.width - this.props.container.offsetWidth), - top: Math.max(0, this.state.top + size.height - this.props.container.offsetHeight) + this.setState(newState); + this.checkReady(); + }, selectedKey: column === null || column === void 0 ? void 0 : column.name }), + base$1.react.createElement( + "div", + { className: "axis-bound-fields" }, + fieldInput(minLabel, "min", () => column.stats.min), + fieldInput(maxLabel, "max", () => column.stats.max) + ) + ); + } + readBackgroundImage(e) { + if (e.target.files) { + const file = e.target.files[0]; + const reader = new FileReader(); + reader.onload = () => { + const img = new Image(); + img.onerror = () => { + this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); }; - if (over.left || over.top) { - let { left, top } = this.state; - left -= over.left; - top -= over.top; - this.setState({ - left, - top - }); - } else this.focus(); + img.onload = () => { + const { src, height: height2, width: width2 } = img; + this.props.explorer.imageHolder.img = { src, height: height2, width: width2 }; + this.checkReady(); + }; + try { + img.src = reader.result; + } catch (e3) { + this.setState({ backgroundImageFileFormatError: strings$1.errorImageFormat }); + } + }; + reader.readAsDataURL(file); } - componentDidUpdate() { - this.focus(); + } + checkReady() { + setTimeout(() => { + const { state, props } = this; + const { explorer: explorer2 } = props; + const { backgroundImageColumnBounds } = state; + let valid = true; + const dimensions = ["x", "y"]; + const dataExtents = ["max", "min"]; + [state.xCol, state.yCol].forEach((c2) => dimensions.forEach((dimension) => dataExtents.forEach((dataExtent2) => { + const bounds2 = backgroundImageColumnBounds.filter((b2) => b2.columnName === c2.name && b2.dataExtent === dataExtent2 && b2.dimension === dimension)[0]; + if (!bounds2.valid) { + valid = false; + } + }))); + const readyToApply = explorer2.imageHolder.img && valid; + this.setState({ readyToApply }); + }, 0); + } + applyImage(showBackgroundImage) { + const { props, state } = this; + const { explorer: explorer2 } = props; + explorer2.imageHolder.showBackgroundImage = showBackgroundImage; + explorer2.imageHolder.backgroundImageColumnBounds = clone(state.backgroundImageColumnBounds); + if (showBackgroundImage) { + switch (props.chart) { + case "density": + case "scatterplot": + case "stacks": { + break; + } + default: { + explorer2.changeChartType("scatterplot"); + return; + } + } } - render() { - return (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div) this.div = div; - }, - className: "sanddance-columnMap-absolute", - style: { - position: 'absolute', - left: px(this.state.left), - top: px(this.state.top) - } - }, (0, _base.base).react.createElement((0, _columnMap.ColumnMap), Object.assign({}, this.props, { - componentRef: this.dropdownRef, - hideSignals: true - }))); + explorer2.forceUpdate(); + } + } + return new __BackgroundImageEditor(_props); + } + const BackgroundImageEditor = _BackgroundImageEditor; + function setInsightBackgroundImage(insight, imageHolder, columns) { + if (!imageHolder.showBackgroundImage || !columns.x || !columns.y) { + return; + } + const { backgroundImageColumnBounds } = imageHolder; + const xBounds = backgroundImageColumnBounds.filter((b2) => b2.columnName === columns.x && b2.dimension === "x"); + const yBounds = backgroundImageColumnBounds.filter((b2) => b2.columnName === columns.y && b2.dimension === "y"); + if (!xBounds.length || !yBounds.length) { + return; + } + const allBounds = [...xBounds, ...yBounds]; + for (let i = 0; i < allBounds.length; i++) { + if (!allBounds[i].valid) { + return; + } + } + const bottom = yBounds.filter((b2) => b2.dataExtent === "min")[0]; + const left = xBounds.filter((b2) => b2.dataExtent === "min")[0]; + const right = xBounds.filter((b2) => b2.dataExtent === "max")[0]; + const top = yBounds.filter((b2) => b2.dataExtent === "max")[0]; + const all = [bottom, left, right, top]; + for (let i = 0; i < all.length; i++) { + if (!all[i]) { + return; + } + } + const { src, height: height2, width: width2 } = imageHolder.img; + insight.backgroundImage = { + url: src, + size: { height: height2, width: width2 }, + extents: { + bottom: bottom.numericValue, + left: left.numericValue, + right: right.numericValue, + top: top.numericValue + } + }; + insight.size = insight.backgroundImage.size; + } + const dropdownWidth = 200; + function Dropdown$1(props) { + const newProps = Object.assign({}, props); + let selectedKey = null; + if (newProps.options && newProps.options.length > 1) { + const selectedOptions = newProps.options.filter((option) => option.selected); + if (selectedOptions && selectedOptions.length > 0) { + selectedKey = selectedOptions[0].key; + } + } + if (newProps.collapseLabel) { + newProps.onRenderTitle = ((a2, b2) => { + return base$1.react.createElement( + "span", + null, + newProps.label, + ": ", + a2[0].text + ); + }); + } + return base$1.react.createElement(base$1.fluentUI.Dropdown, Object.assign({ dropdownWidth }, newProps, { label: newProps.collapseLabel ? null : newProps.label, selectedKey })); + } + function getInitialSignalValue(explorer2, signal) { + let initialValue; + try { + initialValue = explorer2.viewer.vegaViewGl.signal(signal.name); + } catch (error2) { + } + return initialValue; + } + function Signal(props) { + if (!props.explorer.viewer || !props.signal) { + return null; + } + if (props.signal.bind) { + const input = props.signal.bind.input; + if (input) { + const fn2 = map$2[input]; + if (fn2) { + const prefix = props.prefix ? `${props.prefix} ` : ""; + const control = fn2(prefix, props.signal.bind, props.initialValue, (value2) => { + props.onChange && props.onChange(value2); + props.explorer.signal(props.signal.name, value2, props.newViewStateTarget); + }, props.disabled, props.collapseLabel, props.componentRef); + return base$1.react.createElement("div", { className: "sanddance-signal" }, control); } + } } - return new __PositionedColumnMap(_props); -} -const PositionedColumnMap = _PositionedColumnMap; - -},{"./base":"3TPz5","./controls/columnMap":"8sojP","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8sojP":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnMapOptions", ()=>getColumnMapOptions); -parcelHelpers.export(exports, "ColumnMap", ()=>ColumnMap); -var _base = require("../base"); -var _dropdown = require("./dropdown"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _signal = require("./signal"); -var _language = require("../language"); -const maxFacets = 50; -const roleLabels = { - color: (0, _language.strings).labelColumnColor, - facet: (0, _language.strings).labelColumnFacet, - facetV: (0, _language.strings).labelColumnFacetV, - group: (0, _language.strings).labelColumnGroup, - size: (0, _language.strings).labelColumnSize, - sort: (0, _language.strings).labelColumnSort, + return null; + } + const map$2 = {}; + map$2["range"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { + let debouncer; + return base$1.react.createElement(base$1.fluentUI.Slider, { componentRef: ref2, label: prefix + bind2.name, max: bind2.max, min: bind2.min, step: bind2.step, defaultValue: initialValue, onChange: (value2) => { + if (debouncer) { + clearTimeout(debouncer); + } + debouncer = setTimeout(() => onChange(value2), bind2.debounce || 0); + }, disabled }); + }; + map$2["select"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { + const options2 = bind2.options.map((o, i) => { + const option = { + key: o, + text: o + }; + return option; + }); + const label2 = prefix + bind2.name; + return base$1.react.createElement(base$1.fluentUI.Dropdown, { componentRef: ref2, onRenderTitle: collapseLabel ? ((a2, b2) => base$1.react.createElement( + "span", + null, + label2, + ": ", + a2[0].text + )) : void 0, defaultSelectedKey: initialValue, label: collapseLabel ? void 0 : label2, options: options2, onChange: (e, o) => onChange(o.text), disabled }); + }; + map$2["checkbox"] = (prefix, bind2, initialValue, onChange, disabled, collapseLabel, ref2) => { + return base$1.react.createElement(base$1.fluentUI.Toggle, { componentRef: ref2, defaultChecked: initialValue, label: prefix + bind2.name, onChange: (e, checked) => onChange(checked), disabled }); + }; + const maxFacets = 50; + const roleLabels = { + color: strings$1.labelColumnColor, + facet: strings$1.labelColumnFacet, + facetV: strings$1.labelColumnFacetV, + group: strings$1.labelColumnGroup, + size: strings$1.labelColumnSize, + sort: strings$1.labelColumnSort, uid: null, - x: (0, _language.strings).labelColumnX, - y: (0, _language.strings).labelColumnY, - z: (0, _language.strings).labelColumnZ -}; -const aliasLabels = { - color: (0, _language.strings).labelAliasColor, - facet: (0, _language.strings).labelAliasFacet, - facetV: (0, _language.strings).labelAliasFacetV, - group: (0, _language.strings).labelAliasGroup, - size: (0, _language.strings).labelAliasSize, - sort: (0, _language.strings).labelAliasSort, + x: strings$1.labelColumnX, + y: strings$1.labelColumnY, + z: strings$1.labelColumnZ + }; + const aliasLabels = { + color: strings$1.labelAliasColor, + facet: strings$1.labelAliasFacet, + facetV: strings$1.labelAliasFacetV, + group: strings$1.labelAliasGroup, + size: strings$1.labelAliasSize, + sort: strings$1.labelAliasSort, uid: null, - x: (0, _language.strings).labelAliasX, - y: (0, _language.strings).labelAliasY, - z: (0, _language.strings).labelAliasZ -}; -function filterColumnList(context, columns) { - switch(context){ - case 'facet': - case 'facetV': - return columns.filter((column)=>column.quantitative || column.stats.distinctValueCount && column.stats.distinctValueCount < maxFacets); - default: - return columns.slice(); + x: strings$1.labelAliasX, + y: strings$1.labelAliasY, + z: strings$1.labelAliasZ + }; + function filterColumnList(context2, columns) { + switch (context2) { + case "facet": + case "facetV": + return columns.filter((column) => column.quantitative || column.stats.distinctValueCount && column.stats.distinctValueCount < maxFacets); + default: + return columns.slice(); } -} -function optionsForSpecColumn(sectionName, columns, role, disabledColumnName, selectedColumnName) { + } + function optionsForSpecColumn(sectionName, columns, role, disabledColumnName, selectedColumnName) { const filtered = filterColumnList(role, columns); - const options = filtered.map((column)=>{ - const option = { - key: `column:${column.name}`, - text: column.name, - data: column, - selected: selectedColumnName === column.name, - disabled: disabledColumnName === column.name - }; - return option; + const options2 = filtered.map((column) => { + const option = { + key: `column:${column.name}`, + text: column.name, + data: column, + selected: selectedColumnName === column.name, + disabled: disabledColumnName === column.name + }; + return option; }); - if (options.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; - options.unshift(option); - } - return options; -} -function optionsForReference(sectionName, specRoles) { - const options = specRoles.map((specRole)=>{ - const option = { - key: `role:${specRole.role}`, - text: aliasLabels[specRole.role], - data: specRole.role - }; - return option; - }).sort((a, b)=>a.text.localeCompare(b.text)); - if (options.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; - options.unshift(option); - } - return options; -} -function selectFirst(options) { - for(let i = 0; i < options.length; i++){ - if (options[i].itemType === (0, _base.base).fluentUI.DropdownMenuItemType.Header) continue; - options[i].selected = true; - return; + if (options2.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options2.unshift(option); + } + return options2; + } + function optionsForReference(sectionName, specRoles) { + const options2 = specRoles.map((specRole) => { + const option = { + key: `role:${specRole.role}`, + text: aliasLabels[specRole.role], + data: specRole.role + }; + return option; + }).sort((a2, b2) => a2.text.localeCompare(b2.text)); + if (options2.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options2.unshift(option); + } + return options2; + } + function selectFirst(options2) { + for (let i = 0; i < options2.length; i++) { + if (options2[i].itemType === base$1.fluentUI.DropdownMenuItemType.Header) + continue; + options2[i].selected = true; + return; } -} -function getColumnMapOptions(props) { - if (!props.specRole) return null; + } + function getColumnMapOptions(props) { + if (!props.specRole) + return null; let categoricalColumns; let directColorColumns; let directColorGroup; let referenceGroup = []; - if (props.specRole.role === 'color') { - categoricalColumns = props.categoricalColumns.filter((c)=>!c.isColorData); - directColorColumns = props.categoricalColumns.filter((c)=>c.isColorData); - directColorGroup = optionsForSpecColumn((0, _language.strings).selectDirectColor, directColorColumns, 'color', props.disabledColumnName, props.selectedColumnName); - } else categoricalColumns = props.categoricalColumns; - if (props.specRole.role === 'sort') { - const others = props.specCapabilities.roles.filter((specRole)=>specRole.role !== props.specRole.role); - referenceGroup = optionsForReference((0, _language.strings).selectReference, others); - } - const quantitativeGroup = optionsForSpecColumn((0, _language.strings).selectNumeric, props.quantitativeColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); - const categoricGroup = props.specRole.excludeCategoric ? null : optionsForSpecColumn((0, _language.strings).selectNonNumeric, categoricalColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); - const options = referenceGroup.concat(quantitativeGroup).concat(categoricGroup).concat(directColorGroup).filter(Boolean); - return options; -} -function ColumnMap(props) { - const options = getColumnMapOptions(props); - if (props.specRole.allowNone) options.unshift({ + if (props.specRole.role === "color") { + categoricalColumns = props.categoricalColumns.filter((c2) => !c2.isColorData); + directColorColumns = props.categoricalColumns.filter((c2) => c2.isColorData); + directColorGroup = optionsForSpecColumn(strings$1.selectDirectColor, directColorColumns, "color", props.disabledColumnName, props.selectedColumnName); + } else { + categoricalColumns = props.categoricalColumns; + } + if (props.specRole.role === "sort") { + const others = props.specCapabilities.roles.filter((specRole) => specRole.role !== props.specRole.role); + referenceGroup = optionsForReference(strings$1.selectReference, others); + } + const quantitativeGroup = optionsForSpecColumn(strings$1.selectNumeric, props.quantitativeColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); + const categoricGroup = props.specRole.excludeCategoric ? null : optionsForSpecColumn(strings$1.selectNonNumeric, categoricalColumns, props.specRole.role, props.disabledColumnName, props.selectedColumnName); + const options2 = referenceGroup.concat(quantitativeGroup).concat(categoricGroup).concat(directColorGroup).filter(Boolean); + return options2; + } + function ColumnMap(props) { + const options2 = getColumnMapOptions(props); + if (props.specRole.allowNone) { + options2.unshift({ key: -1, - text: (0, _language.strings).selectNone - }); - const hasSelection = options.reduce((p, c)=>{ - return p || c.selected; + text: strings$1.selectNone + }); + } + const hasSelection = options2.reduce((p, c2) => { + return p || c2.selected; }, false); - if (!hasSelection) selectFirst(options); + if (!hasSelection) { + selectFirst(options2); + } let signals; if (props.explorer.viewer && props.explorer.viewer.vegaSpec) { - if (props.specRole.signals) signals = props.explorer.viewer.vegaSpec.signals.filter((s)=>props.specRole.signals.indexOf(s.name) >= 0); + if (props.specRole.signals) { + signals = props.explorer.viewer.vegaSpec.signals.filter((s2) => props.specRole.signals.indexOf(s2.name) >= 0); + } } - const label = roleLabels[props.specRole.role]; - const signalElements = !props.hideSignals && signals && signals.map((signal, i)=>{ - let initialValue; - try { - initialValue = props.explorer.viewer.vegaViewGl.signal(signal.name); - } catch (error) { - // continue regardless of error - } - return (0, _base.base).react.createElement((0, _signal.Signal), { - key: signal.name + i + initialValue, - explorer: props.explorer, - signal: signal, - initialValue: initialValue, - onChange: (value)=>props.onChangeSignal && props.onChangeSignal(signal.name, value), - collapseLabel: props.collapseLabel - }); + const label2 = roleLabels[props.specRole.role]; + const signalElements = !props.hideSignals && signals && signals.map((signal, i) => { + let initialValue; + try { + initialValue = props.explorer.viewer.vegaViewGl.signal(signal.name); + } catch (error2) { + } + return base$1.react.createElement(Signal, { key: signal.name + i + initialValue, explorer: props.explorer, signal, initialValue, onChange: (value2) => props.onChangeSignal && props.onChangeSignal(signal.name, value2), collapseLabel: props.collapseLabel }); }); - return (0, _base.base).react.createElement("div", { - className: "sanddance-columnMap" - }, props.prefix, !props.hideDropdown && (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - componentRef: props.componentRef, - collapseLabel: props.collapseLabel, - disabled: props.disabled, - label: label, - options: options, - onChange: (e, o)=>props.changeColumnMapping(props.specRole.role, typeof o.data === 'string' ? o.data : (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(o.data)), - onDismiss: props.onDismiss - }), signalElements, props.suffix); -} - -},{"../base":"3TPz5","./dropdown":"7pP8h","@msrvida/sanddance-react":"lPyTZ","./signal":"buTZe","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7pP8h":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dropdownWidth", ()=>dropdownWidth); -parcelHelpers.export(exports, "Dropdown", ()=>Dropdown); -var _base = require("../base"); -const dropdownWidth = 200; -function Dropdown(props) { - const newProps = Object.assign({}, props); - let selectedKey = null; - if (newProps.options && newProps.options.length > 1) { - const selectedOptions = newProps.options.filter((option)=>option.selected); - if (selectedOptions && selectedOptions.length > 0) selectedKey = selectedOptions[0].key; - } - if (newProps.collapseLabel) newProps.onRenderTitle = (a, b)=>{ - return (0, _base.base).react.createElement("span", null, newProps.label, ": ", a[0].text); - }; - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Dropdown, Object.assign({ - dropdownWidth: dropdownWidth - }, newProps, { - label: newProps.collapseLabel ? null : newProps.label, - selectedKey: selectedKey - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"buTZe":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getInitialSignalValue", ()=>getInitialSignalValue); -parcelHelpers.export(exports, "Signal", ()=>Signal); -var _base = require("../base"); -function getInitialSignalValue(explorer, signal) { - let initialValue; - try { - initialValue = explorer.viewer.vegaViewGl.signal(signal.name); - } catch (error) { - // continue regardless of error - } - return initialValue; -} -function Signal(props) { - if (!props.explorer.viewer || !props.signal) return null; - if (props.signal.bind) { - const input = props.signal.bind.input; - if (input) { - const fn = map[input]; - if (fn) { - const prefix = props.prefix ? `${props.prefix} ` : ''; - const control = fn(prefix, props.signal.bind, props.initialValue, (value)=>{ - props.onChange && props.onChange(value); - props.explorer.signal(props.signal.name, value, props.newViewStateTarget); - }, props.disabled, props.collapseLabel, props.componentRef); - return (0, _base.base).react.createElement("div", { - className: "sanddance-signal" - }, control); + return base$1.react.createElement( + "div", + { className: "sanddance-columnMap" }, + props.prefix, + !props.hideDropdown && base$1.react.createElement(Dropdown$1, { componentRef: props.componentRef, collapseLabel: props.collapseLabel, disabled: props.disabled, label: label2, options: options2, onChange: (e, o) => props.changeColumnMapping(props.specRole.role, typeof o.data === "string" ? o.data : clone(o.data)), onDismiss: props.onDismiss }), + signalElements, + props.suffix + ); + } + function attachSpecRoleToAxisTitle(stage, specCapabilities) { + for (const axisName in stage.axes) { + specCapabilities.roles.forEach((specRole) => { + if (specRole.role === axisName) { + const axes = stage.axes[axisName]; + axes.forEach((axis) => { + if (axis.title) { + const textItem = axis.title; + textItem.specRole = specRole; } + }); } + }); } - return null; -} -const map = {}; -map['range'] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref)=>{ - let debouncer; - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - componentRef: ref, - label: prefix + bind.name, - max: bind.max, - min: bind.min, - step: bind.step, - defaultValue: initialValue, - onChange: (value)=>{ - if (debouncer) clearTimeout(debouncer); - debouncer = setTimeout(()=>onChange(value), bind.debounce || 0); - }, - disabled: disabled - }); -}; -map['select'] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref)=>{ - const options = bind.options.map((o, i)=>{ - const option = { - key: o, - text: o - }; - return option; - }); - const label = prefix + bind.name; - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Dropdown, { - componentRef: ref, - onRenderTitle: collapseLabel ? (a, b)=>(0, _base.base).react.createElement("span", null, label, ": ", a[0].text) : undefined, - defaultSelectedKey: initialValue, - label: collapseLabel ? undefined : label, - options: options, - onChange: (e, o)=>onChange(o.text), - disabled: disabled - }); -}; -map['checkbox'] = (prefix, bind, initialValue, onChange, disabled, collapseLabel, ref)=>{ - return (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - componentRef: ref, - defaultChecked: initialValue, - label: prefix + bind.name, - onChange: (e, checked)=>onChange(checked), - disabled: disabled - }); -}; //TODO other signal types - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7dBYz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColumnTypeChanger", ()=>ColumnTypeChanger); -var _base = require("../base"); -var _dialog = require("./dialog"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -var _iconButton = require("./iconButton"); -function _ColumnTypeChanger(_props) { - class __ColumnTypeChanger extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = this.getInitialState(); - } - getInitialState() { - const { props } = this; - return { - dialogHidden: true, - confirmationHidden: true, - quantitativeColumns: props.initialQuantitativeColumns.map((c)=>(0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(c)), - categoricalColumns: props.initialCategoricalColumns.map((c)=>(0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(c)), - columnTypes: null - }; - } - closeDialog() { - this.setState(this.getInitialState()); + } + function px$1(n) { + return n + "px"; + } + function _PositionedColumnMap(_props) { + class __PositionedColumnMap extends base$1.react.Component { + constructor(props) { + super(props); + const { left, top } = props; + this.state = { left, top }; + this.dropdownRef = base$1.react.createRef(); + } + focus() { + if (!this.focused) { + this.focused = true; + this.dropdownRef.current.focus(true); } - openConfirmation(columnTypes) { - this.setState({ - columnTypes, - confirmationHidden: false - }); + } + componentDidMount() { + const size = outerSize$1(this.div); + const over = { + left: Math.max(0, this.state.left + size.width - this.props.container.offsetWidth), + top: Math.max(0, this.state.top + size.height - this.props.container.offsetHeight) + }; + if (over.left || over.top) { + let { left, top } = this.state; + left -= over.left; + top -= over.top; + this.setState({ left, top }); + } else { + this.focus(); } - render() { - const { props, state } = this; - const hasChanges = props.initialQuantitativeColumns.some((c, i)=>{ - return c.quantitative !== state.quantitativeColumns[i].quantitative; - }); - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - text: (0, _language.strings).buttonColumnTypes, - onClick: ()=>this.setState({ - dialogHidden: false - }) - }), (0, _base.base).react.createElement((0, _dialog.Dialog), { - minWidth: "80%", - hidden: state.dialogHidden, - onDismiss: ()=>this.closeDialog(), - dialogContentProps: { - className: `sanddance-dialog ${props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelColumnTypes - }, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: "revert", - text: (0, _language.strings).buttonResetToDefault, - onClick: ()=>this.openConfirmation(null), - iconProps: { - iconName: 'Undo' - } - }), - (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: "apply", - text: (0, _language.strings).buttonApply, - onClick: ()=>{ - const columnTypes = {}; - state.quantitativeColumns.forEach((c)=>{ - columnTypes[c.name] = c.quantitative ? c.type : 'string'; - }); - state.categoricalColumns.forEach((c)=>{ - columnTypes[c.name] = 'string'; - }); - this.openConfirmation(columnTypes); - }, - iconProps: { - iconName: 'Accept' - }, - disabled: !hasChanges - }) - ] - }, (0, _base.base).react.createElement("div", { - className: 'sanddance-columnTypes' - }, state.quantitativeColumns.length > 0 && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("h3", null, (0, _language.strings).selectNumeric), (0, _base.base).react.createElement("table", null, (0, _base.base).react.createElement("thead", null, (0, _base.base).react.createElement("tr", null, (0, _base.base).react.createElement("th", null, (0, _language.strings).labelEditColumn), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnName), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnQuantitativeMin), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnQuantitativeMax), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnQuantitativeMean), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnDistinct))), (0, _base.base).react.createElement("tbody", null, state.quantitativeColumns.map((c, i)=>(0, _base.base).react.createElement("tr", { - key: i, - className: c.quantitative ? '' : 'changed' - }, (0, _base.base).react.createElement("td", null, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - iconName: 'Edit', - onClick: undefined, - menuProps: { - items: [ - (0, _language.strings).selectNumeric, - (0, _language.strings).selectNonNumeric - ].map((t)=>{ - return { - key: t, - text: t, - onClick: ()=>{ - c.quantitative = t === (0, _language.strings).selectNumeric; - this.setState({ - quantitativeColumns: [ - ...state.quantitativeColumns - ] - }); - } - }; + } + componentDidUpdate() { + this.focus(); + } + render() { + return base$1.react.createElement( + "div", + { ref: (div) => { + if (div) + this.div = div; + }, className: "sanddance-columnMap-absolute", style: { position: "absolute", left: px$1(this.state.left), top: px$1(this.state.top) } }, + base$1.react.createElement(ColumnMap, Object.assign({}, this.props, { componentRef: this.dropdownRef, hideSignals: true })) + ); + } + } + return new __PositionedColumnMap(_props); + } + const PositionedColumnMap = _PositionedColumnMap; + function _ColumnTypeChanger(_props) { + class __ColumnTypeChanger extends base$1.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(); + } + getInitialState() { + const { props } = this; + return { + dialogHidden: true, + confirmationHidden: true, + quantitativeColumns: props.initialQuantitativeColumns.map((c2) => clone(c2)), + categoricalColumns: props.initialCategoricalColumns.map((c2) => clone(c2)), + columnTypes: null + }; + } + closeDialog() { + this.setState(this.getInitialState()); + } + openConfirmation(columnTypes) { + this.setState({ columnTypes, confirmationHidden: false }); + } + render() { + const { props, state } = this; + const hasChanges = props.initialQuantitativeColumns.some((c2, i) => { + return c2.quantitative !== state.quantitativeColumns[i].quantitative; + }); + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { text: strings$1.buttonColumnTypes, onClick: () => this.setState({ dialogHidden: false }) }), + base$1.react.createElement( + Dialog$1, + { minWidth: "80%", hidden: state.dialogHidden, onDismiss: () => this.closeDialog(), dialogContentProps: { + className: `sanddance-dialog ${props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelColumnTypes + }, buttons: [ + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "revert", text: strings$1.buttonResetToDefault, onClick: () => this.openConfirmation(null), iconProps: { iconName: "Undo" } }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "apply", text: strings$1.buttonApply, onClick: () => { + const columnTypes = {}; + state.quantitativeColumns.forEach((c2) => { + columnTypes[c2.name] = c2.quantitative ? c2.type : "string"; + }); + state.categoricalColumns.forEach((c2) => { + columnTypes[c2.name] = "string"; + }); + this.openConfirmation(columnTypes); + }, iconProps: { iconName: "Accept" }, disabled: !hasChanges }) + ] }, + base$1.react.createElement( + "div", + { className: "sanddance-columnTypes" }, + state.quantitativeColumns.length > 0 && base$1.react.createElement( + "div", + null, + base$1.react.createElement("h3", null, strings$1.selectNumeric), + base$1.react.createElement( + "table", + null, + base$1.react.createElement( + "thead", + null, + base$1.react.createElement( + "tr", + null, + base$1.react.createElement("th", null, strings$1.labelEditColumn), + base$1.react.createElement("th", null, strings$1.labelColumnName), + base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMin), + base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMax), + base$1.react.createElement("th", null, strings$1.labelColumnQuantitativeMean), + base$1.react.createElement("th", null, strings$1.labelColumnDistinct) + ) + ), + base$1.react.createElement("tbody", null, state.quantitativeColumns.map((c2, i) => base$1.react.createElement( + "tr", + { key: i, className: c2.quantitative ? "" : "changed" }, + base$1.react.createElement( + "td", + null, + base$1.react.createElement(IconButton$1, { iconName: "Edit", onClick: void 0, menuProps: { + items: [strings$1.selectNumeric, strings$1.selectNonNumeric].map((t) => { + return { + key: t, + text: t, + onClick: () => { + c2.quantitative = t === strings$1.selectNumeric; + this.setState({ quantitativeColumns: [...state.quantitativeColumns] }); + } + }; }) - }, - themePalette: props.themePalette, - title: (0, _language.strings).labelChangeColumnType - })), (0, _base.base).react.createElement("td", null, c.name), (0, _base.base).react.createElement("td", null, c.stats.min), (0, _base.base).react.createElement("td", null, c.stats.max), (0, _base.base).react.createElement("td", null, c.stats.mean), (0, _base.base).react.createElement("td", null, c.stats.distinctValueCount)))))), state.categoricalColumns.length > 0 && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("h3", null, (0, _language.strings).selectNonNumeric), (0, _base.base).react.createElement("table", null, (0, _base.base).react.createElement("thead", null, (0, _base.base).react.createElement("tr", null, (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnName), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnType), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnDistinct), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnHasColorData), (0, _base.base).react.createElement("th", null, (0, _language.strings).labelColumnIsColorData))), (0, _base.base).react.createElement("tbody", null, state.categoricalColumns.map((c, i)=>(0, _base.base).react.createElement("tr", { - key: i - }, (0, _base.base).react.createElement("td", null, c.name), (0, _base.base).react.createElement("td", null, c.type), (0, _base.base).react.createElement("td", null, c.stats.distinctValueCount), (0, _base.base).react.createElement("td", null, (!!c.stats.hasColorData).toString()), (0, _base.base).react.createElement("td", null, (!!c.isColorData).toString())))))))), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: state.confirmationHidden, - onDismiss: ()=>this.setState({ - confirmationHidden: true - }), - dialogContentProps: { - className: `sanddance-dialog ${props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelConfirmation, - subText: (0, _language.strings).labelHistoryWarning - }, - buttons: (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - text: (0, _language.strings).buttonApply, - onClick: ()=>{ - this.closeDialog(); - this.props.onConfirmUpdate(this.state.columnTypes); - }, - iconProps: { - iconName: 'Accept' - } - }) - })); - } + }, themePalette: props.themePalette, title: strings$1.labelChangeColumnType }) + ), + base$1.react.createElement("td", null, c2.name), + base$1.react.createElement("td", null, c2.stats.min), + base$1.react.createElement("td", null, c2.stats.max), + base$1.react.createElement("td", null, c2.stats.mean), + base$1.react.createElement("td", null, c2.stats.distinctValueCount) + ))) + ) + ), + state.categoricalColumns.length > 0 && base$1.react.createElement( + "div", + null, + base$1.react.createElement("h3", null, strings$1.selectNonNumeric), + base$1.react.createElement( + "table", + null, + base$1.react.createElement( + "thead", + null, + base$1.react.createElement( + "tr", + null, + base$1.react.createElement("th", null, strings$1.labelColumnName), + base$1.react.createElement("th", null, strings$1.labelColumnType), + base$1.react.createElement("th", null, strings$1.labelColumnDistinct), + base$1.react.createElement("th", null, strings$1.labelColumnHasColorData), + base$1.react.createElement("th", null, strings$1.labelColumnIsColorData) + ) + ), + base$1.react.createElement("tbody", null, state.categoricalColumns.map((c2, i) => base$1.react.createElement( + "tr", + { key: i }, + base$1.react.createElement("td", null, c2.name), + base$1.react.createElement("td", null, c2.type), + base$1.react.createElement("td", null, c2.stats.distinctValueCount), + base$1.react.createElement("td", null, (!!c2.stats.hasColorData).toString()), + base$1.react.createElement("td", null, (!!c2.isColorData).toString()) + ))) + ) + ) + ) + ), + base$1.react.createElement(Dialog$1, { hidden: state.confirmationHidden, onDismiss: () => this.setState({ confirmationHidden: true }), dialogContentProps: { + className: `sanddance-dialog ${props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelConfirmation, + subText: strings$1.labelHistoryWarning + }, buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { text: strings$1.buttonApply, onClick: () => { + this.closeDialog(); + this.props.onConfirmUpdate(this.state.columnTypes); + }, iconProps: { iconName: "Accept" } }) }) + ); + } } return new __ColumnTypeChanger(_props); -} -const ColumnTypeChanger = _ColumnTypeChanger; - -},{"../base":"3TPz5","./dialog":"OQi9w","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","./iconButton":"6pZiK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7XSio":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataExportPicker", ()=>DataExportPicker); -parcelHelpers.export(exports, "removeExtensions", ()=>removeExtensions); -parcelHelpers.export(exports, "getEmbedHTML", ()=>getEmbedHTML); -var _dataExporterHtml = require("./dataExporterHtml"); -var _dialog = require("./dialog"); -var _base = require("../base"); -var _exportDelimited = require("../exportDelimited"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -const exportTypes = [ - [ - 'json', - (0, _language.strings).labelExportJSON - ], - [ - 'csv', - (0, _language.strings).labelExportCSV - ], - [ - 'tsv', - (0, _language.strings).labelExportTSV - ], - [ - 'html', - (0, _language.strings).labelExportHTML - ] -]; -function _DataExportPicker(_props) { - class __DataExportPicker extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = this.getInitialState(this.props); - } - getInitialState(props) { - const initialState = { - initializer: props.initializer, - dialogHidden: true, - exportType: exportTypes[0][0], - fileName: props.initializer.fileName, - fileNameError: '', - working: false - }; - return initialState; - } - componentDidUpdate() { - if (!(0, _sanddanceReact.util).deepCompare(this.props.initializer, this.state.initializer)) this.setState(this.getInitialState(this.props)); - } - // Converts to dataExport type and calls dataExportHandler to deal with data - createExport(exportType, displayName) { - const final = (data)=>{ - this.props.dataExportHandler(data, exportType, displayName); - this.close(); - }; - const json = JSON.stringify(this.props.data, columnReplacer); - switch(exportType){ - case 'json': - final(json); - break; - case 'csv': - final((0, _exportDelimited.convertToDelimited)(JSON.parse(json), ',')); - break; - case 'tsv': - final((0, _exportDelimited.convertToDelimited)(JSON.parse(json), '\t')); - break; - case 'html': - { - const csv = (0, _exportDelimited.convertToDelimited)(JSON.parse(json), ','); - const html = (0, _dataExporterHtml.embedHtml)(`${(0, _language.strings).appName} - ${escape(displayName)}`, embedScript(csv, displayName)); - final(html); - } - } - } - close() { - this.setState({ - dialogHidden: true, - working: false - }); - } - render() { - const closeDialog = ()=>this.close(); - if (this.state.delayAction) requestAnimationFrame(()=>{ - //allow render to complete - if (this.state.delayAction) { - this.state.delayAction(); - this.setState({ - delayAction: null - }); - } - }); - const disabled = this.state.working || this.state.dialogHidden; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: "search-action search-bottom-action", - text: (0, _language.strings).buttonExportCount(this.props.data.length), - onClick: ()=>this.setState({ - dialogHidden: false - }), - disabled: this.props.disabled - }), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: this.state.dialogHidden, - onDismiss: closeDialog, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).labelExport - }, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 0, - disabled: disabled || !!this.state.fileNameError, - onClick: (e)=>this.setState({ - delayAction: ()=>this.createExport(this.state.exportType, this.state.fileName), - working: true - }), - text: (0, _language.strings).buttonExport, - iconProps: { - iconName: 'Download' - } - }) - ] - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelExportFileName, - onChange: (e, displayName)=>{ - const displayNameError = getFileNameError(displayName); - this.setState({ - fileName: displayName, - fileNameError: displayNameError - }); - }, - errorMessage: this.state.fileNameError, - value: this.state.fileName - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - className: "sanddance-form-separate", - disabled: disabled, - selectedKey: this.state.exportType, - options: exportTypes.map(([exportType, text])=>{ - return { - key: exportType, - text, - disabled: false - }; - }), - onChange: (ev, option)=>this.setState({ - exportType: option.key - }), - label: (0, _language.strings).labelExportFormat - }))); - } - } - return new __DataExportPicker(_props); -} -const DataExportPicker = _DataExportPicker; -const illegalChars = '\\/:*?"<>|'; -function getFileNameError(displayName) { - if (!displayName) return (0, _language.strings).errorExportFilenameEmpty; - for(let i = 0; i < illegalChars.length; i++){ - if (displayName.indexOf(illegalChars[i]) >= 0) return (0, _language.strings).errorExportFilenameCharacters(illegalChars); - } -} -function removeExtensions(fileName) { - exportTypes.forEach(([exportType])=>{ - const re = new RegExp(`\\.${exportType}`, 'ig'); - fileName = fileName.replace(re, ''); - }); - return fileName; -} -function columnReplacer(name, value) { - if ((0, _sanddanceReact.SandDance).util.isInternalFieldName(name, true)) return undefined; - return value === null ? '' : value; -} -function embedScript(csv, displayName, snapshots) { - const dataFile = { - type: 'csv', - displayName, - snapshots - }; - return `<pre id='csv-data' style='display:none'>${csv}</pre> - <script>SandDanceEmbed.load(Object.assign({rawText: document.getElementById('csv-data').innerText}, ${JSON.stringify(dataFile)}))</script>`; -} -function getEmbedHTML(data, displayName, snapshots) { - const json = JSON.stringify(data, columnReplacer); - const csv = (0, _exportDelimited.convertToDelimited)(JSON.parse(json), ','); - const html = (0, _dataExporterHtml.embedHtml)(`${(0, _language.strings).appName} - ${escape(displayName)}`, embedScript(csv, displayName, snapshots)); - return html; -} - -},{"./dataExporterHtml":"3Md58","./dialog":"OQi9w","../base":"3TPz5","../exportDelimited":"f4JI7","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Md58":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "embedHtml", ()=>embedHtml); -const embedHtml = (title, embed)=>`<!DOCTYPE html> + } + const ColumnTypeChanger = _ColumnTypeChanger; + const embedHtml = (title, embed) => `<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> @@ -52573,141 +30057,292 @@ const embedHtml = (title, embed)=>`<!DOCTYPE html> <link rel="stylesheet" type="text/css" href="https://unpkg.com/@msrvida/sanddance-embed@4/dist/css/sanddance-embed.css" /> </head> <body> - <script src="https://unpkg.com/react@17/umd/react.production.min.js"></script> - <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> - <script src="https://unpkg.com/vega@5.32/build/vega.min.js"></script> - <script src="https://unpkg.com/@fluentui/react@8/dist/fluentui-react.js"></script> - <script src="https://unpkg.com/@msrvida/fluentui-icons@1/dist/umd/fluentui-icons.js"></script> - <script src="https://unpkg.com/@msrvida/sanddance-explorer@4/dist/umd/sanddance-explorer.js"></script> - <script src="https://unpkg.com/@msrvida/sanddance-embed@4/dist/umd/sanddance-embed.js"></script> + <script src="https://unpkg.com/react@17/umd/react.production.min.js"><\/script> + <script src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"><\/script> + <script src="https://unpkg.com/vega@6.2/build/vega.min.js"><\/script> + <script src="https://unpkg.com/@fluentui/react@8/dist/fluentui-react.js"><\/script> + <script src="https://unpkg.com/@msrvida/fluentui-icons@1/dist/umd/fluentui-icons.js"><\/script> + <script src="https://unpkg.com/@msrvida/sanddance-explorer@4/dist/umd/sanddance-explorer.js"><\/script> + <script src="https://unpkg.com/@msrvida/sanddance-embed@4/dist/umd/sanddance-embed.js"><\/script> ${embed} </body> </html>`; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f4JI7":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "convertToDelimited", ()=>convertToDelimited); -function convertToDelimited(data, delimiter) { - const fields = Object.keys(data[0]); - const file = data.map((row)=>{ - return fields.map((fieldName)=>{ - const value = row[fieldName]; - if (typeof value === 'number') return value; - if (typeof value === 'string') { - if (value.indexOf(delimiter) >= 0) return `"${value.replace(/"/g, '""')}"`; - else return value; - } - return ''; - }).join(delimiter); + function convertToDelimited(data2, delimiter) { + const fields = Object.keys(data2[0]); + const file = data2.map((row) => { + return fields.map((fieldName) => { + const value2 = row[fieldName]; + if (typeof value2 === "number") { + return value2; + } + if (typeof value2 === "string") { + if (value2.indexOf(delimiter) >= 0) { + return `"${value2.replace(/"/g, '""')}"`; + } else { + return value2; + } + } + return ""; + }).join(delimiter); }); file.unshift(fields.join(delimiter)); - return file.join('\n'); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dwBpS":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "chartLabelMap", ()=>chartLabelMap); -parcelHelpers.export(exports, "chartLabel", ()=>chartLabel); -parcelHelpers.export(exports, "Chart", ()=>Chart); -var _base = require("../base"); -var _columnMap = require("../controls/columnMap"); -var _dialog = require("../controls/dialog"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _signal = require("../controls/signal"); -var _language = require("../language"); -var _toggleColumns = require("../controls/toggleColumns"); -var _columns = require("../columns"); -var _backgroundImageEditor = require("./backgroundImageEditor"); -const singleFacetLayouts = [ - { - facetStyle: 'wrap', - text: (0, _language.strings).labelFacetLayoutWrap + return file.join("\n"); + } + const exportTypes = [ + ["json", strings$1.labelExportJSON], + ["csv", strings$1.labelExportCSV], + ["tsv", strings$1.labelExportTSV], + ["html", strings$1.labelExportHTML] + ]; + function _DataExportPicker(_props) { + class __DataExportPicker extends base$1.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(this.props); + } + getInitialState(props) { + const initialState = { + initializer: props.initializer, + dialogHidden: true, + exportType: exportTypes[0][0], + fileName: props.initializer.fileName, + fileNameError: "", + working: false + }; + return initialState; + } + componentDidUpdate() { + if (!deepCompare(this.props.initializer, this.state.initializer)) { + this.setState(this.getInitialState(this.props)); + } + } + // Converts to dataExport type and calls dataExportHandler to deal with data + createExport(exportType, displayName) { + const final = (data2) => { + this.props.dataExportHandler(data2, exportType, displayName); + this.close(); + }; + const json2 = JSON.stringify(this.props.data, columnReplacer); + switch (exportType) { + case "json": { + final(json2); + break; + } + case "csv": { + final(convertToDelimited(JSON.parse(json2), ",")); + break; + } + case "tsv": { + final(convertToDelimited(JSON.parse(json2), " ")); + break; + } + case "html": { + const csv = convertToDelimited(JSON.parse(json2), ","); + const html = embedHtml(`${strings$1.appName} - ${escape(displayName)}`, embedScript(csv, displayName)); + final(html); + } + } + } + close() { + this.setState({ dialogHidden: true, working: false }); + } + render() { + const closeDialog = () => this.close(); + if (this.state.delayAction) { + requestAnimationFrame(() => { + if (this.state.delayAction) { + this.state.delayAction(); + this.setState({ delayAction: null }); + } + }); + } + const disabled = this.state.working || this.state.dialogHidden; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "search-action search-bottom-action", text: strings$1.buttonExportCount(this.props.data.length), onClick: () => this.setState({ dialogHidden: false }), disabled: this.props.disabled }), + base$1.react.createElement( + Dialog$1, + { hidden: this.state.dialogHidden, onDismiss: closeDialog, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base$1.fluentUI.DialogType.normal, + title: strings$1.labelExport + }, buttons: [ + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: 0, disabled: disabled || !!this.state.fileNameError, onClick: (e) => this.setState({ + delayAction: () => this.createExport(this.state.exportType, this.state.fileName), + working: true + }), text: strings$1.buttonExport, iconProps: { + iconName: "Download" + } }) + ] }, + base$1.react.createElement(base$1.fluentUI.TextField, { label: strings$1.labelExportFileName, onChange: (e, displayName) => { + const displayNameError = getFileNameError(displayName); + this.setState({ fileName: displayName, fileNameError: displayNameError }); + }, errorMessage: this.state.fileNameError, value: this.state.fileName }), + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { className: "sanddance-form-separate", disabled, selectedKey: this.state.exportType, options: exportTypes.map(([exportType, text2]) => { + return { + key: exportType, + text: text2, + disabled: false + }; + }), onChange: (ev, option) => this.setState({ exportType: option.key }), label: strings$1.labelExportFormat }) + ) + ); + } + } + return new __DataExportPicker(_props); + } + const DataExportPicker = _DataExportPicker; + const illegalChars = '\\/:*?"<>|'; + function getFileNameError(displayName) { + if (!displayName) { + return strings$1.errorExportFilenameEmpty; + } + for (let i = 0; i < illegalChars.length; i++) { + if (displayName.indexOf(illegalChars[i]) >= 0) { + return strings$1.errorExportFilenameCharacters(illegalChars); + } + } + } + function removeExtensions(fileName) { + exportTypes.forEach(([exportType]) => { + const re2 = new RegExp(`\\.${exportType}`, "ig"); + fileName = fileName.replace(re2, ""); + }); + return fileName; + } + function columnReplacer(name, value2) { + if (isInternalFieldName(name, true)) { + return void 0; } -]; -const chartLabelMap = [ + return value2 === null ? "" : value2; + } + function embedScript(csv, displayName, snapshots) { + const dataFile = { type: "csv", displayName, snapshots }; + return `<pre id='csv-data' style='display:none'>${csv}</pre> + <script>SandDanceEmbed.load(Object.assign({rawText: document.getElementById('csv-data').innerText}, ${JSON.stringify(dataFile)}))<\/script>`; + } + function getEmbedHTML(data2, displayName, snapshots) { + const json2 = JSON.stringify(data2, columnReplacer); + const csv = convertToDelimited(JSON.parse(json2), ","); + const html = embedHtml(`${strings$1.appName} - ${escape(displayName)}`, embedScript(csv, displayName, snapshots)); + return html; + } + function Group$1(props) { + return base$1.react.createElement( + "div", + { className: classList("sanddance-group", props.className) }, + base$1.react.createElement( + "div", + { className: "group-head" }, + base$1.react.createElement("label", null, props.label), + props.labelCount && base$1.react.createElement( + "span", + { className: "count" }, + "(", + props.labelCount, + ")" + ) + ), + props.children && base$1.react.createElement("div", { className: "group-body" }, props.children) + ); + } + function ToggleColumns(props) { + return base$1.react.createElement("div", null, props.allColumns.map((c2, i) => base$1.react.createElement( + "div", + { key: c2.name }, + base$1.react.createElement( + "label", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: props.exclusions.indexOf(c2.name) < 0, inlineLabel: true, label: c2.name, onChange: () => props.toggleExclusion(c2.name) }) + ) + ))); + } + const singleFacetLayouts = [ + { facetStyle: "wrap", text: strings$1.labelFacetLayoutWrap } + //{ facetStyle: 'horizontal', text: strings.labelFacetLayoutHorizontal }, + //{ facetStyle: 'vertical', text: strings.labelFacetLayoutVertical } + ]; + const chartLabelMap = [ { - key: 'grid', - text: (0, _language.strings).chartTypeGrid + key: "grid", + text: strings$1.chartTypeGrid }, { - key: 'scatterplot', - text: (0, _language.strings).chartTypeScatterPlot + key: "scatterplot", + text: strings$1.chartTypeScatterPlot }, { - key: 'density', - text: (0, _language.strings).chartTypeDensity + key: "density", + text: strings$1.chartTypeDensity }, { - key: 'barchartV', - text: (0, _language.strings).chartTypeBarChartV + key: "barchartV", + text: strings$1.chartTypeBarChartV }, { - key: 'barchartH', - text: (0, _language.strings).chartTypeBarChartH + key: "barchartH", + text: strings$1.chartTypeBarChartH }, { - key: 'treemap', - text: (0, _language.strings).chartTypeTreeMap + key: "treemap", + text: strings$1.chartTypeTreeMap }, { - key: 'strips', - text: (0, _language.strings).chartTypeStrips + key: "strips", + text: strings$1.chartTypeStrips }, { - key: 'stacks', - text: (0, _language.strings).chartTypeStacks - } -]; -function chartLabel(key) { - for(let i = 0; i < chartLabelMap.length; i++){ - if (key === chartLabelMap[i].key) return chartLabelMap[i].text; - } -} -function _Chart(_props) { - class __Chart extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - showTooltipDialog: false - }; - this.choiceRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = this.choiceRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - } - render() { - const { props } = this; - const { explorer, specCapabilities } = props; - const signals = explorer.viewer && explorer.viewer.vegaSpec && specCapabilities && specCapabilities.signals && explorer.viewer.vegaSpec.signals.filter((s)=>specCapabilities.signals.indexOf(s.name) >= 0); - const hasOptions = !!signals || (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage); - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelChart - }, (0, _base.base).react.createElement("div", { - className: "calculator" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - componentRef: this.choiceRef, - selectedKey: props.chart, - className: "sanddance-chart-type", - options: chartLabelMap.map((o)=>{ - return Object.assign(Object.assign({}, o), { - disabled: props.disabled || o.key === 'treemap' && props.quantitativeColumns.length === 0 - }); - }), - onChange: (e, o)=>props.explorer.changeChartType(o.key) - }))), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColumnMapping - }, (0, _base.base).react.createElement("div", null, specCapabilities && specCapabilities.roles.map((specRole, i)=>{ + key: "stacks", + text: strings$1.chartTypeStacks + } + ]; + function chartLabel(key2) { + for (let i = 0; i < chartLabelMap.length; i++) { + if (key2 === chartLabelMap[i].key) { + return chartLabelMap[i].text; + } + } + } + function _Chart(_props) { + class __Chart extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + showTooltipDialog: false + }; + this.choiceRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = this.choiceRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + } + render() { + const { props } = this; + const { explorer: explorer2, specCapabilities } = props; + const signals = explorer2.viewer && explorer2.viewer.vegaSpec && specCapabilities && specCapabilities.signals && explorer2.viewer.vegaSpec.signals.filter((s2) => specCapabilities.signals.indexOf(s2.name) >= 0); + const hasOptions = !!signals || (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage); + return base$1.react.createElement( + "div", + null, + base$1.react.createElement( + Group$1, + { label: strings$1.labelChart }, + base$1.react.createElement( + "div", + { className: "calculator" }, + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { componentRef: this.choiceRef, selectedKey: props.chart, className: "sanddance-chart-type", options: chartLabelMap.map((o) => { + return Object.assign(Object.assign({}, o), { disabled: props.disabled || o.key === "treemap" && props.quantitativeColumns.length === 0 }); + }), onChange: (e, o) => props.explorer.changeChartType(o.key) }) + ) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelColumnMapping }, + base$1.react.createElement( + "div", + null, + specCapabilities && specCapabilities.roles.map((specRole, i) => { const specColumnInRole = props.insightColumns[specRole.role]; const selectedColumnName = specColumnInRole; let disabledColumnName; @@ -52715,10715 +30350,5682 @@ function _Chart(_props) { let suffix; let hideDropdown = false; let { totalStyle } = props; - if (!totalStyle) totalStyle = 'count-square'; + if (!totalStyle) { + totalStyle = "count-square"; + } let { facetStyle } = props; - if (!facetStyle) facetStyle = 'wrap'; - switch(specRole.role){ - case 'facet': - suffix = (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - disabled: !props.insightColumns.facet, - collapseLabel: props.collapseLabels, - label: (0, _language.strings).labelFacetLayout, - calloutProps: { - style: { - minWidth: '18em' - } - }, - options: [ - { - key: 'header1', - text: `${(0, _language.strings).labelFacetLayout}:`, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }, - ...singleFacetLayouts.map((f)=>{ - const o = { - key: f.facetStyle, - text: f.text, - data: f, - selected: facetStyle === f.facetStyle - }; - return o; - }), - { - key: 'divider', - text: '-', - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Divider - }, - { - key: 'header2', - text: `${(0, _language.strings).labelColumnFacetV}:`, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }, - ...(0, _columnMap.getColumnMapOptions)(Object.assign(Object.assign({}, props), { - specRole, - selectedColumnName: props.insightColumns.facetV - })).map((o)=>{ - if (o.itemType !== (0, _base.base).fluentUI.DropdownMenuItemType.Header) { - const facetData = { - facetStyle: 'cross', - column: o.data - }; - o.data = facetData; - o.text = `${(0, _language.strings).labelFacetLayoutCross} ${o.text}`; - } - return o; - }) - ], - onChange: (e, o)=>{ - const facetData = o.data; - props.changeColumnMapping('facet', 'facet', null, { - facetStyle: facetData.facetStyle - }); - if (facetData.facetStyle === 'cross') props.changeColumnMapping('facetV', (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(facetData.column)); - } - }); - break; - case 'facetV': - hideDropdown = true; - break; - case 'size': - { - const options = [ - { - key: 'count-square', - text: (0, _language.strings).labelTotalByCountSquare, - data: 'count-square', - selected: !totalStyle || totalStyle === 'count-square' - }, - { - key: 'count-strip', - text: (0, _language.strings).labelTotalByCountStrip, - data: 'count-strip', - selected: totalStyle === 'count-strip' - }, - { - key: 'sum-strip', - text: (0, _language.strings).labelTotalBySumStrip, - data: 'sum-strip', - selected: totalStyle === 'sum-strip' - }, - { - key: 'sum-treemap', - text: (0, _language.strings).labelTotalBySumTreemap, - data: 'sum-treemap', - selected: totalStyle === 'sum-treemap', - disabled: props.quantitativeColumns.length === 0 - } - ]; - if (specCapabilities.percentage) options.push({ - key: 'sum-strip-percent', - text: (0, _language.strings).labelTotalBySumStripPercent, - data: 'sum-strip-percent', - selected: totalStyle === 'sum-strip-percent', - disabled: props.quantitativeColumns.length === 0 - }); - prefix = !specCapabilities.countsAndSums ? null : (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabels, - label: (0, _language.strings).labelTotal, - calloutProps: { - style: { - minWidth: '18em' - } - }, - options: options, - onChange: (e, o)=>{ - const totalStyle = o.data; - let defaultColumn; - if (totalStyle.indexOf('sum-') === 0) { - if (totalStyle === 'sum-treemap') defaultColumn = (0, _columns.getTreemapColumn)(props.allColumns); - defaultColumn = defaultColumn || props.quantitativeColumns[0]; - } - props.changeColumnMapping('size', 'size', defaultColumn, { - totalStyle - }); - } - }); - break; - } + if (!facetStyle) { + facetStyle = "wrap"; } - const disabled = props.disabled || specRole.disabled || specRole.role === 'size' && !(!specCapabilities.countsAndSums || totalStyle.indexOf('sum-') === 0) || specRole.role === 'sort' && specCapabilities.countsAndSums && totalStyle === 'sum-treemap'; - return (0, _base.base).react.createElement((0, _columnMap.ColumnMap), Object.assign({}, props, { - prefix: prefix, - suffix: suffix, - collapseLabel: props.collapseLabels, - disabled: disabled, - disabledColumnName: disabledColumnName, - selectedColumnName: selectedColumnName, - specRole: specRole, - key: i, - onChangeSignal: (name, value)=>props.onChangeSignal(specRole.role, selectedColumnName, name, value), - hideDropdown: hideDropdown - })); - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: 'sanddance-chart-button', - text: (0, _language.strings).buttonTooltipMapping, - onClick: ()=>this.setState({ - showTooltipDialog: true - }) - }))), hasOptions && (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelChartTypeOptions - }, signals && signals.map((signal, i)=>(0, _base.base).react.createElement((0, _signal.Signal), { - key: i, - signal: signal, - explorer: explorer, - initialValue: (0, _signal.getInitialSignalValue)(explorer, signal), - disabled: props.disabled || this.disableSignal(signal), - collapseLabel: props.collapseLabels, - newViewStateTarget: false - })), (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage) && (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: 'sanddance-chart-button', - text: (0, _language.strings).buttonBackgroundImage, - onClick: ()=>{ - let insightColumns; - switch(props.chart){ - case 'scatterplot': - case 'stacks': - insightColumns = props.insightColumns; - break; + switch (specRole.role) { + case "facet": { + suffix = base$1.react.createElement(Dropdown$1, { disabled: !props.insightColumns.facet, collapseLabel: props.collapseLabels, label: strings$1.labelFacetLayout, calloutProps: { style: { minWidth: "18em" } }, options: [ + { + key: "header1", + text: `${strings$1.labelFacetLayout}:`, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }, + ...singleFacetLayouts.map((f) => { + const o = { + key: f.facetStyle, + text: f.text, + data: f, + selected: facetStyle === f.facetStyle + }; + return o; + }), + { + key: "divider", + text: "-", + itemType: base$1.fluentUI.DropdownMenuItemType.Divider + }, + { + key: "header2", + text: `${strings$1.labelColumnFacetV}:`, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }, + ...getColumnMapOptions(Object.assign(Object.assign({}, props), { specRole, selectedColumnName: props.insightColumns.facetV })).map((o) => { + if (o.itemType !== base$1.fluentUI.DropdownMenuItemType.Header) { + const facetData = { + facetStyle: "cross", + column: o.data + }; + o.data = facetData; + o.text = `${strings$1.labelFacetLayoutCross} ${o.text}`; + } + return o; + }) + ], onChange: (e, o) => { + const facetData = o.data; + props.changeColumnMapping("facet", "facet", null, { facetStyle: facetData.facetStyle }); + if (facetData.facetStyle === "cross") { + props.changeColumnMapping("facetV", clone(facetData.column)); + } + } }); + break; + } + case "facetV": { + hideDropdown = true; + break; + } + case "size": { + const options2 = [ + { + key: "count-square", + text: strings$1.labelTotalByCountSquare, + data: "count-square", + selected: !totalStyle || totalStyle === "count-square" + }, + { + key: "count-strip", + text: strings$1.labelTotalByCountStrip, + data: "count-strip", + selected: totalStyle === "count-strip" + }, + { + key: "sum-strip", + text: strings$1.labelTotalBySumStrip, + data: "sum-strip", + selected: totalStyle === "sum-strip" + }, + { + key: "sum-treemap", + text: strings$1.labelTotalBySumTreemap, + data: "sum-treemap", + selected: totalStyle === "sum-treemap", + disabled: props.quantitativeColumns.length === 0 + } + ]; + if (specCapabilities.percentage) { + options2.push({ + key: "sum-strip-percent", + text: strings$1.labelTotalBySumStripPercent, + data: "sum-strip-percent", + selected: totalStyle === "sum-strip-percent", + disabled: props.quantitativeColumns.length === 0 + }); } - if (!insightColumns) insightColumns = props.explorer.changeChartType('scatterplot'); - this.backgroundImageEditor.show(insightColumns); + prefix = !specCapabilities.countsAndSums ? null : base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabels, label: strings$1.labelTotal, calloutProps: { style: { minWidth: "18em" } }, options: options2, onChange: (e, o) => { + const totalStyle2 = o.data; + let defaultColumn; + if (totalStyle2.indexOf("sum-") === 0) { + if (totalStyle2 === "sum-treemap") { + defaultColumn = getTreemapColumn(props.allColumns); + } + defaultColumn = defaultColumn || props.quantitativeColumns[0]; + } + props.changeColumnMapping("size", "size", defaultColumn, { totalStyle: totalStyle2 }); + } }); + break; + } } - })), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !this.state.showTooltipDialog, - onDismiss: ()=>this.setState({ - showTooltipDialog: false - }), - title: (0, _language.strings).labelTooltipMapping - }, (0, _base.base).react.createElement((0, _toggleColumns.ToggleColumns), { - allColumns: props.allColumns, - exclusions: props.tooltipExclusions, - toggleExclusion: props.toggleTooltipExclusion - })), (0, _base.base).react.createElement((0, _backgroundImageEditor.BackgroundImageEditor), Object.assign({}, props, { - ref: (e)=>this.backgroundImageEditor = e - }))); - } - disableSignal(signal) { - if (this.props.view === '2d' && signal.name === (0, _sanddanceReact.SandDance).constants.SignalNames.ZGrounded) return true; - return false; + const disabled = props.disabled || specRole.disabled || specRole.role === "size" && !(!specCapabilities.countsAndSums || totalStyle.indexOf("sum-") === 0) || specRole.role === "sort" && specCapabilities.countsAndSums && totalStyle === "sum-treemap"; + return base$1.react.createElement(ColumnMap, Object.assign({}, props, { prefix, suffix, collapseLabel: props.collapseLabels, disabled, disabledColumnName, selectedColumnName, specRole, key: i, onChangeSignal: (name, value2) => props.onChangeSignal(specRole.role, selectedColumnName, name, value2), hideDropdown })); + }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "sanddance-chart-button", text: strings$1.buttonTooltipMapping, onClick: () => this.setState({ showTooltipDialog: true }) }) + ) + ), + hasOptions && base$1.react.createElement( + Group$1, + { label: strings$1.labelChartTypeOptions }, + signals && signals.map((signal, i) => base$1.react.createElement(Signal, { key: i, signal, explorer: explorer2, initialValue: getInitialSignalValue(explorer2, signal), disabled: props.disabled || this.disableSignal(signal), collapseLabel: props.collapseLabels, newViewStateTarget: false })), + (specCapabilities === null || specCapabilities === void 0 ? void 0 : specCapabilities.backgroundImage) && base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "sanddance-chart-button", text: strings$1.buttonBackgroundImage, onClick: () => { + let insightColumns; + switch (props.chart) { + case "scatterplot": + case "stacks": { + insightColumns = props.insightColumns; + break; + } + } + if (!insightColumns) { + insightColumns = props.explorer.changeChartType("scatterplot"); + } + this.backgroundImageEditor.show(insightColumns); + } }) + ), + base$1.react.createElement( + Dialog$1, + { hidden: !this.state.showTooltipDialog, onDismiss: () => this.setState({ showTooltipDialog: false }), title: strings$1.labelTooltipMapping }, + base$1.react.createElement(ToggleColumns, { allColumns: props.allColumns, exclusions: props.tooltipExclusions, toggleExclusion: props.toggleTooltipExclusion }) + ), + base$1.react.createElement(BackgroundImageEditor, Object.assign({}, props, { ref: (e) => this.backgroundImageEditor = e })) + ); + } + disableSignal(signal) { + if (this.props.view === "2d" && signal.name === SignalNames.ZGrounded) { + return true; } + return false; + } } return new __Chart(_props); -} -const Chart = _Chart; - -},{"../base":"3TPz5","../controls/columnMap":"8sojP","../controls/dialog":"OQi9w","../controls/dropdown":"7pP8h","../controls/group":"afKlW","@msrvida/sanddance-react":"lPyTZ","../controls/signal":"buTZe","../language":"67xOI","../controls/toggleColumns":"kBkXL","../columns":"7ZE4v","./backgroundImageEditor":"hTdbK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"afKlW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Group", ()=>Group); -var _base = require("../base"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Group(props) { - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-group', props.className) - }, (0, _base.base).react.createElement("div", { - className: "group-head" - }, (0, _base.base).react.createElement("label", null, props.label), props.labelCount && (0, _base.base).react.createElement("span", { - className: "count" - }, "(", props.labelCount, ")")), props.children && (0, _base.base).react.createElement("div", { - className: "group-body" - }, props.children)); -} - -},{"../base":"3TPz5","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBkXL":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ToggleColumns", ()=>ToggleColumns); -var _base = require("../base"); -function ToggleColumns(props) { - return (0, _base.base).react.createElement("div", null, props.allColumns.map((c, i)=>(0, _base.base).react.createElement("div", { - key: c.name - }, (0, _base.base).react.createElement("label", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: props.exclusions.indexOf(c.name) < 0, - inlineLabel: true, - label: c.name, - onChange: ()=>props.toggleExclusion(c.name) - }))))); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eXzPo":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Search", ()=>Search); -var _searchTerm = require("../controls/searchTerm"); -var _base = require("../base"); -var _button = require("../controls/button"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -const maxClauses = 5; -function getColumnWithName(columnName, columns) { - for(let i = 0; i < columns.length; i++){ - if (columns[i].name === columnName) return columns[i]; - } -} -function validateExpression(ex) { - if (ex.operator === 'isnullorEmpty') { - ex.errorMessage = null; - return; - } - const s = (0, _searchTerm.getText)(ex); - if (s.length === 0) ex.errorMessage = (0, _language.strings).labelRequired; - else ex.errorMessage = null; -} -function clearExpressionValidation(ex) { - if (ex.operator === 'isnullorEmpty') { - ex.errorMessage = null; - return; - } - const s = (0, _searchTerm.getText)(ex); - if (s.length !== 0) ex.errorMessage = null; -} -function getGroupClauses(currClause, index, disableGroupOR) { - let keys; - if (index === 0) keys = [ - [ - null, - (0, _language.strings).searchWHERE - ] - ]; - else { - keys = [ - [ - '&&', - (0, _language.strings).searchAND - ] + } + const Chart = _Chart; + function TextField$1(props) { + return base$1.react.createElement(base$1.fluentUI.TextField, Object.assign({ onKeyUp: (e) => { + e.nativeEvent.stopImmediatePropagation(); + } }, props)); + } + const maxAutocomplete = 100; + function getValidOperators(column) { + const type2 = column && column.type; + switch (type2) { + case "boolean": + return [ + ["==", strings$1.searchEQ], + ["!=", strings$1.searchNEQ], + ["isnullorEmpty", strings$1.searchNULL] + ]; + case "date": + case "integer": + case "number": + return [ + ["==", strings$1.searchEQ], + ["!=", strings$1.searchNEQ], + [">", strings$1.searchGT], + [">=", strings$1.searchGTE], + ["<", strings$1.searchLT], + ["<=", strings$1.searchLTE], + ["isnullorEmpty", strings$1.searchNULL] + ]; + case "string": + default: + return [ + ["==", strings$1.searchEQ], + ["!=", strings$1.searchNEQ], + [">", strings$1.searchGT], + [">=", strings$1.searchGTE], + ["<", strings$1.searchLT], + ["<=", strings$1.searchLTE], + ["contains", strings$1.searchIN], + ["starts", strings$1.searchSW], + ["isnullorEmpty", strings$1.searchNULL] ]; - if (!disableGroupOR) keys.push([ - '||', - (0, _language.strings).searchOR - ]); - } - return keys.map((key, i)=>{ - const [clause, text] = key; - const selected = currClause == clause; //deliberate double equal - const option = { - key: i, - text, - data: clause, - selected - }; - return option; - }); -} -function _Search(_props) { - class __Search extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = this.getInitialState(this.props); - this.dropdownRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = this.dropdownRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - } - getInitialState(props) { - const initialState = { - groups: props.initializer.search || [ - this.newGroup(0, null) - ], - sortedColumns: [ - ...props.initializer.columns - ].sort((a, b)=>a.name.localeCompare(b.name)), - initializer: props.initializer - }; - initialState.groups.forEach((group)=>{ - group.expressions.forEach((ex)=>ex.unlocked = group.expressions.length <= 2); - }); - return initialState; - } - componentDidUpdate() { - if (!(0, _sanddanceReact.util).deepCompare(this.props.initializer, this.state.initializer)) this.setState(this.getInitialState(this.props)); - } - validateAndSearch() { - const groups = [ - ...this.state.groups - ]; - groups.forEach((group)=>{ - group.expressions.forEach(validateExpression); - const errors = group.expressions.reduce((p, c)=>p || c.errorMessage, ''); - if (errors) this.setState({ - groups - }); - else this.props.onSelect(this.state.groups); - }); - } - newGroup(key, clause) { - const group = { - key, - clause, - expressions: [ - this.newExpression(0, null) - ] - }; - return group; - } - updateGroup(partialGroup, groupIndex) { - const groups = [ - ...this.state.groups - ]; - const group = Object.assign(Object.assign({}, groups[groupIndex]), partialGroup); - groups[groupIndex] = group; - this.setState({ - groups - }); - } - addGroup() { - const groups = [ - ...this.state.groups - ]; - const maxKey = groups.reduce((max, p)=>p.key > max ? p.key : max, groups[0].key); - const newGroup = this.newGroup(maxKey + 1, '&&'); - groups.push(newGroup); - this.setState({ - groups - }); - } - deleteGroup(groupIndex) { - const groups = [ - ...this.state.groups - ]; - groups.splice(groupIndex, 1); - this.setState({ - groups - }); - } - newExpression(key, clause) { - const ex = { - key, - clause, - name: null, - operator: 'contains', - value: '' - }; - return ex; - } - addExpression(groupIndex) { - const groups = [ - ...this.state.groups - ]; - const group = groups[groupIndex]; - const maxKey = group.expressions.reduce((max, p)=>p.key > max ? p.key : max, group.expressions[0].key); - const newEx = this.newExpression(maxKey + 1, '&&'); - group.expressions.push(newEx); - if (group.expressions.length === 2) newEx.unlocked = true; - else { - group.expressions.forEach((ex)=>ex.unlocked = false); - newEx.clause = group.expressions[1].clause; - } - this.setState({ - groups - }); - } - updateExpression(partialEx, groupIndex, index) { - const groups = [ - ...this.state.groups - ]; - const group = groups[groupIndex]; - const ex = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(group.expressions[index]); - if (ex.name !== partialEx.name) { - //choose an appropriate operator when switching data type - const oldColumn = getColumnWithName(ex.name, this.state.sortedColumns); - const newColumn = getColumnWithName(partialEx.name, this.state.sortedColumns); - const oldType = oldColumn && oldColumn.type; - const newType = newColumn && newColumn.type; - if (oldType !== newType) { - const newOperators = (0, _searchTerm.getValidOperators)(newColumn).map((validOperator)=>validOperator[0]); - //see if old operator is compatible - if (newOperators.indexOf(ex.operator) < 0) //not compatible, so choose "equal" - partialEx.operator = '=='; - } - } - Object.assign(ex, partialEx); - clearExpressionValidation(ex); - group.expressions[index] = ex; - this.setState({ - groups - }); - } - deleteExpression(groupIndex, index) { - const groups = [ - ...this.state.groups - ]; - const group = groups[groupIndex]; - const expressions = [ - ...group.expressions - ]; - expressions.splice(index, 1); - if (expressions.length === 2) expressions[1].unlocked = true; - group.expressions = expressions; - this.setState({ - groups - }); - } - render() { - return (0, _base.base).react.createElement((0, _group.Group), { - className: "sanddance-search", - label: (0, _language.strings).labelSearch - }, (0, _base.base).react.createElement("div", null, this.state.groups.map((group, groupIndex)=>(0, _base.base).react.createElement("div", { - className: "sanddance-search-group", - key: group.key - }, (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: this.props.collapseLabels, - className: "search-group-clause", - label: (0, _language.strings).labelSearchClause, - disabled: groupIndex === 0 || this.props.disableGroupOR, - dropdownWidth: 120, - options: getGroupClauses(group.clause, groupIndex, this.props.disableGroupOR), - onChange: (e, o)=>this.updateGroup({ - clause: o.data - }, groupIndex) - }), (0, _base.base).react.createElement("div", null, group.expressions.map((ex, i)=>(0, _base.base).react.createElement("div", { - className: "sanddance-search-expression", - key: ex.key - }, (0, _base.base).react.createElement((0, _searchTerm.SearchTerm), { - dropdownRef: groupIndex === 0 && i === 0 ? this.dropdownRef : undefined, - collapseLabels: this.props.collapseLabels, - onUpdateExpression: (ex, i)=>this.updateExpression(ex, groupIndex, i), - autoCompleteDistinctValues: this.props.autoCompleteDistinctValues, - index: i, - columns: this.state.sortedColumns, - data: this.props.data, - searchExpression: ex, - disableOR: this.props.disableExpressionOR, - column: getColumnWithName(ex.name, this.state.sortedColumns) - }), group.expressions.length > 1 && (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Cancel", - onClick: ()=>this.deleteExpression(groupIndex, i), - text: (0, _language.strings).buttonDeleteExpression - })))), group.expressions.length < maxClauses && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Add", - onClick: ()=>this.addExpression(groupIndex), - text: (0, _language.strings).buttonAddExpression - })), this.state.groups.length > 1 && (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action", - iconName: "Cancel", - onClick: ()=>this.deleteGroup(groupIndex), - text: (0, _language.strings).buttonDeleteExpressionGroup - }))), this.state.groups.length < maxClauses && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - themePalette: this.props.themePalette, - className: "search-action search-bottom-action", - iconName: "Add", - onClick: ()=>this.addGroup(), - text: (0, _language.strings).buttonAddExpressionGroup - }))), (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - className: "search-action search-bottom-action", - text: (0, _language.strings).buttonSelect, - onClick: ()=>this.validateAndSearch() - })); - } - } - return new __Search(_props); -} -const Search = _Search; - -},{"../controls/searchTerm":"6ZfbH","../base":"3TPz5","../controls/button":"f8wtc","../controls/dropdown":"7pP8h","../controls/group":"afKlW","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6ZfbH":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "maxAutocomplete", ()=>maxAutocomplete); -parcelHelpers.export(exports, "getValidOperators", ()=>getValidOperators); -parcelHelpers.export(exports, "getText", ()=>getText); -parcelHelpers.export(exports, "SearchTerm", ()=>SearchTerm); -var _dropdown = require("./dropdown"); -var _textfield = require("./textfield"); -var _base = require("../base"); -var _language = require("../language"); -const maxAutocomplete = 100; -function getValidOperators(column) { - const type = column && column.type; - switch(type){ - case 'boolean': - return [ - [ - '==', - (0, _language.strings).searchEQ - ], - [ - '!=', - (0, _language.strings).searchNEQ - ], - [ - 'isnullorEmpty', - (0, _language.strings).searchNULL - ] - ]; - case 'date': - case 'integer': - case 'number': - return [ - [ - '==', - (0, _language.strings).searchEQ - ], - [ - '!=', - (0, _language.strings).searchNEQ - ], - [ - '>', - (0, _language.strings).searchGT - ], - [ - '>=', - (0, _language.strings).searchGTE - ], - [ - '<', - (0, _language.strings).searchLT - ], - [ - '<=', - (0, _language.strings).searchLTE - ], - [ - 'isnullorEmpty', - (0, _language.strings).searchNULL - ] - ]; - case 'string': - default: - return [ - [ - '==', - (0, _language.strings).searchEQ - ], - [ - '!=', - (0, _language.strings).searchNEQ - ], - [ - '>', - (0, _language.strings).searchGT - ], - [ - '>=', - (0, _language.strings).searchGTE - ], - [ - '<', - (0, _language.strings).searchLT - ], - [ - '<=', - (0, _language.strings).searchLTE - ], - [ - 'contains', - (0, _language.strings).searchIN - ], - [ - 'starts', - (0, _language.strings).searchSW - ], - [ - 'isnullorEmpty', - (0, _language.strings).searchNULL - ] - ]; } -} -function getExpressionClauses(currClause, disableOR) { - const keys = [ - [ - '&&', - (0, _language.strings).searchAND - ] + } + function getExpressionClauses(currClause, disableOR) { + const keys2 = [ + ["&&", strings$1.searchAND] ]; - if (!disableOR) keys.push([ - '||', - (0, _language.strings).searchOR - ]); - return keys.map((key, i)=>{ - const [clause, text] = key; - const selected = currClause == clause; //deliberate double equal - const option = { - key: i, - text, - data: clause, - selected - }; - return option; + if (!disableOR) { + keys2.push(["||", strings$1.searchOR]); + } + return keys2.map((key2, i) => { + const [clause, text2] = key2; + const selected = currClause == clause; + const option = { + key: i, + text: text2, + data: clause, + selected + }; + return option; }); -} -function getOperators(ex, column) { + } + function getOperators(ex, column) { let anySelected = false; const validOperators = getValidOperators(column); - const options = validOperators.map((validoperator)=>{ - const [op, text] = validoperator; - const selected = ex.operator === op; - anySelected = anySelected || selected; - const option = { - key: op, - text, - data: op, - selected - }; - return option; + const options2 = validOperators.map((validoperator) => { + const [op, text2] = validoperator; + const selected = ex.operator === op; + anySelected = anySelected || selected; + const option = { + key: op, + text: text2, + data: op, + selected + }; + return option; }); - if (!anySelected) options[0].selected = true; - return options; -} -function getDistinctValues(data, columnName) { + if (!anySelected) { + options2[0].selected = true; + } + return options2; + } + function getDistinctValues(data2, columnName) { const distinctMap = {}; - for(let i = 0; i < data.length; i++){ - const row = data[i]; - const value = row[columnName]; - distinctMap[value] = true; + for (let i = 0; i < data2.length; i++) { + const row = data2[i]; + const value2 = row[columnName]; + distinctMap[value2] = true; } return Object.keys(distinctMap).sort(); -} -function getValues(ex, column, data, autoCompleteDistinctValues) { + } + function getValues(ex, column, data2, autoCompleteDistinctValues) { const stats = column && column.stats; if (stats && stats.distinctValueCount < maxAutocomplete) { - if (!autoCompleteDistinctValues[column.name]) autoCompleteDistinctValues[column.name] = getDistinctValues(data, column.name); - return autoCompleteDistinctValues[column.name].map((v, i)=>({ - key: i, - text: v - })); + if (!autoCompleteDistinctValues[column.name]) { + autoCompleteDistinctValues[column.name] = getDistinctValues(data2, column.name); + } + return autoCompleteDistinctValues[column.name].map((v, i) => ({ + key: i, + text: v + })); } return []; -} -function getText(ex) { - if (ex.operator === 'isnullorEmpty') return ''; - return typeof ex.value === 'string' ? ex.value : ex.value == null ? '' : ex.value.toString(); -} -function SearchTerm(props) { + } + function getText(ex) { + if (ex.operator === "isnullorEmpty") + return ""; + return typeof ex.value === "string" ? ex.value : ex.value == null ? "" : ex.value.toString(); + } + function SearchTerm(props) { const ex = props.searchExpression; const possibleValues = getValues(ex, props.column, props.data, props.autoCompleteDistinctValues); - //TODO better date handling with calendar picker - return (0, _base.base).react.createElement("div", null, props.index > 0 && (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, _language.strings).labelSearchClause, - dropdownWidth: 120, - disabled: !ex.unlocked || props.disableOR, - options: getExpressionClauses(ex.clause, props.disableOR), - onChange: (e, o)=>props.onUpdateExpression({ - clause: o.data - }, props.index) - }), (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - componentRef: props.dropdownRef, - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, _language.strings).labelSearchColumn, - options: [ - { - key: '', - text: (0, _language.strings).selectAny, - data: null, - selected: ex.name === null - } - ].concat(props.columns.map((c, i)=>({ - key: c.name, - text: c.name, - data: c, - selected: c.name === ex.name - }))), - onChange: (e, o)=>props.onUpdateExpression({ - name: o.data && o.data.name || null - }, props.index) - }), (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabels, - className: "search-field", - label: (0, _language.strings).labelSearchOperator, - dropdownWidth: 120, - options: getOperators(ex, props.column), - onChange: (e, o)=>props.onUpdateExpression({ - operator: o.data - }, props.index) - }), possibleValues.length > 0 && (0, _base.base).react.createElement((0, _base.base).fluentUI.ComboBox, { - className: "search-field", - label: props.collapseLabels ? null : (0, _language.strings).labelSearchValue, - placeholder: (0, _language.strings).labelSearchValuePlaceholder, - disabled: ex.operator === 'isnullorEmpty', - dropdownWidth: (0, _dropdown.dropdownWidth), - allowFreeform: true, - autoComplete: "on", - errorMessage: ex.errorMessage, - text: getText(ex), - options: getValues(ex, props.column, props.data, props.autoCompleteDistinctValues), - onChange: (e, o, i, value)=>{ - if (o) value = o.text; - props.onUpdateExpression({ - value - }, props.index); - } - }), possibleValues.length === 0 && (0, _base.base).react.createElement((0, _textfield.TextField), { - className: "search-field", - label: props.collapseLabels ? null : (0, _language.strings).labelSearchValue, - placeholder: (0, _language.strings).labelSearchValuePlaceholder, - disabled: ex.operator === 'isnullorEmpty', - errorMessage: ex.errorMessage, - value: getText(ex), - onChange: (e, v)=>props.onUpdateExpression({ - value: v - }, props.index) - })); -} - -},{"./dropdown":"7pP8h","./textfield":"1HIvT","../base":"3TPz5","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1HIvT":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextField", ()=>TextField); -var _base = require("../base"); -function TextField(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, Object.assign({ - onKeyUp: (e)=>{ - e.nativeEvent.stopImmediatePropagation(); - } - }, props)); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8wtc":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Button", ()=>Button); -var _base = require("../base"); -function Button(props) { - return (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, Object.assign({}, props, { - styles: { - root: Object.assign({ - backgroundColor: 'transparent', - height: '30px', - width: props.width, - padding: 0 - }, props.rootStyle), - rootDisabled: { - backgroundColor: 'transparent' - }, - icon: { - color: props.themePalette.themePrimary - }, - label: { - fontWeight: '400', - textAlign: props.textAlign || 'left' - } - }, - iconProps: { - iconName: props.iconName + return base$1.react.createElement( + "div", + null, + props.index > 0 && base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabels, className: "search-field", label: strings$1.labelSearchClause, dropdownWidth: 120, disabled: !ex.unlocked || props.disableOR, options: getExpressionClauses(ex.clause, props.disableOR), onChange: (e, o) => props.onUpdateExpression({ clause: o.data }, props.index) }), + base$1.react.createElement(Dropdown$1, { componentRef: props.dropdownRef, collapseLabel: props.collapseLabels, className: "search-field", label: strings$1.labelSearchColumn, options: [ + { + key: "", + text: strings$1.selectAny, + data: null, + selected: ex.name === null + } + ].concat(props.columns.map((c2, i) => ({ + key: c2.name, + text: c2.name, + data: c2, + selected: c2.name === ex.name + }))), onChange: (e, o) => props.onUpdateExpression({ name: o.data && o.data.name || null }, props.index) }), + base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabels, className: "search-field", label: strings$1.labelSearchOperator, dropdownWidth: 120, options: getOperators(ex, props.column), onChange: (e, o) => props.onUpdateExpression({ operator: o.data }, props.index) }), + possibleValues.length > 0 && base$1.react.createElement(base$1.fluentUI.ComboBox, { className: "search-field", label: props.collapseLabels ? null : strings$1.labelSearchValue, placeholder: strings$1.labelSearchValuePlaceholder, disabled: ex.operator === "isnullorEmpty", dropdownWidth, allowFreeform: true, autoComplete: "on", errorMessage: ex.errorMessage, text: getText(ex), options: getValues(ex, props.column, props.data, props.autoCompleteDistinctValues), onChange: (e, o, i, value2) => { + if (o) { + value2 = o.text; + } + props.onUpdateExpression({ value: value2 }, props.index); + } }), + possibleValues.length === 0 && base$1.react.createElement(TextField$1, { className: "search-field", label: props.collapseLabels ? null : strings$1.labelSearchValue, placeholder: strings$1.labelSearchValuePlaceholder, disabled: ex.operator === "isnullorEmpty", errorMessage: ex.errorMessage, value: getText(ex), onChange: (e, v) => props.onUpdateExpression({ value: v }, props.index) }) + ); + } + function Button(props) { + return base$1.react.createElement(base$1.fluentUI.DefaultButton, Object.assign({}, props, { styles: { + root: Object.assign({ backgroundColor: "transparent", height: "30px", width: props.width, padding: 0 }, props.rootStyle), + rootDisabled: { + backgroundColor: "transparent" + }, + icon: { + color: props.themePalette.themePrimary + }, + label: { + fontWeight: "400", + textAlign: props.textAlign || "left" + } + }, iconProps: { iconName: props.iconName } })); + } + const maxClauses = 5; + function getColumnWithName(columnName, columns) { + for (let i = 0; i < columns.length; i++) { + if (columns[i].name === columnName) + return columns[i]; + } + } + function validateExpression(ex) { + if (ex.operator === "isnullorEmpty") { + ex.errorMessage = null; + return; + } + const s2 = getText(ex); + if (s2.length === 0) { + ex.errorMessage = strings$1.labelRequired; + } else { + ex.errorMessage = null; + } + } + function clearExpressionValidation(ex) { + if (ex.operator === "isnullorEmpty") { + ex.errorMessage = null; + return; + } + const s2 = getText(ex); + if (s2.length !== 0) { + ex.errorMessage = null; + } + } + function getGroupClauses(currClause, index2, disableGroupOR) { + let keys2; + if (index2 === 0) { + keys2 = [ + [null, strings$1.searchWHERE] + ]; + } else { + keys2 = [ + ["&&", strings$1.searchAND] + ]; + if (!disableGroupOR) { + keys2.push(["||", strings$1.searchOR]); + } + } + return keys2.map((key2, i) => { + const [clause, text2] = key2; + const selected = currClause == clause; + const option = { + key: i, + text: text2, + data: clause, + selected + }; + return option; + }); + } + function _Search(_props) { + class __Search extends base$1.react.Component { + constructor(props) { + super(props); + this.state = this.getInitialState(this.props); + this.dropdownRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = this.dropdownRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + } + getInitialState(props) { + const initialState = { + groups: props.initializer.search || [this.newGroup(0, null)], + sortedColumns: [...props.initializer.columns].sort((a2, b2) => a2.name.localeCompare(b2.name)), + initializer: props.initializer + }; + initialState.groups.forEach((group2) => { + group2.expressions.forEach((ex) => ex.unlocked = group2.expressions.length <= 2); + }); + return initialState; + } + componentDidUpdate() { + if (!deepCompare(this.props.initializer, this.state.initializer)) { + this.setState(this.getInitialState(this.props)); } - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2xbhO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Settings", ()=>Settings); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _base = require("../base"); -var _canvas = require("../canvas"); -var _dialog = require("../controls/dialog"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _signal = require("../controls/signal"); -var _language = require("../language"); -var _version = require("../version"); -var SandDance = _sanddanceReact.SandDance; -var DataRefType; -(function(DataRefType) { - DataRefType[DataRefType["none"] = 0] = "none"; - DataRefType[DataRefType["inline"] = 1] = "inline"; - DataRefType[DataRefType["url"] = 2] = "url"; -})(DataRefType || (DataRefType = {})); -function filterSignals(signal) { - switch(signal.name){ - case SandDance.constants.SignalNames.XBins: - case SandDance.constants.SignalNames.YBins: - case SandDance.constants.SignalNames.FacetBins: - case SandDance.constants.SignalNames.FacetVBins: - case SandDance.constants.SignalNames.ColorBinCount: - case SandDance.constants.SignalNames.ColorReverse: - case SandDance.constants.SignalNames.PointScale: - case SandDance.constants.SignalNames.TreeMapMethod: - case SandDance.constants.SignalNames.ZGrounded: - return false; - default: - return !!signal.bind; + } + validateAndSearch() { + const groups = [...this.state.groups]; + groups.forEach((group2) => { + group2.expressions.forEach(validateExpression); + const errors = group2.expressions.reduce((p, c2) => p || c2.errorMessage, ""); + if (errors) { + this.setState({ groups }); + } else { + this.props.onSelect(this.state.groups); + } + }); + } + newGroup(key2, clause) { + const group2 = { + key: key2, + clause, + expressions: [this.newExpression(0, null)] + }; + return group2; + } + updateGroup(partialGroup, groupIndex) { + const groups = [...this.state.groups]; + const group2 = Object.assign(Object.assign({}, groups[groupIndex]), partialGroup); + groups[groupIndex] = group2; + this.setState({ groups }); + } + addGroup() { + const groups = [...this.state.groups]; + const maxKey = groups.reduce((max2, p) => p.key > max2 ? p.key : max2, groups[0].key); + const newGroup = this.newGroup(maxKey + 1, "&&"); + groups.push(newGroup); + this.setState({ groups }); + } + deleteGroup(groupIndex) { + const groups = [...this.state.groups]; + groups.splice(groupIndex, 1); + this.setState({ groups }); + } + newExpression(key2, clause) { + const ex = { key: key2, clause, name: null, operator: "contains", value: "" }; + return ex; + } + addExpression(groupIndex) { + const groups = [...this.state.groups]; + const group2 = Object.assign({}, groups[groupIndex]); + const expressions = [...group2.expressions]; + const maxKey = expressions.reduce((max2, p) => p.key > max2 ? p.key : max2, expressions[0].key); + const newEx = this.newExpression(maxKey + 1, "&&"); + expressions.push(newEx); + if (expressions.length === 2) { + newEx.unlocked = true; + } else { + expressions.forEach((ex) => ex.unlocked = false); + newEx.clause = expressions[1].clause; + } + group2.expressions = expressions; + groups[groupIndex] = group2; + this.setState({ groups }); + } + updateExpression(partialEx, groupIndex, index2) { + const groups = [...this.state.groups]; + const group2 = Object.assign({}, groups[groupIndex]); + const expressions = [...group2.expressions]; + const currentEx = expressions[index2]; + if (currentEx.name !== partialEx.name) { + const oldColumn = getColumnWithName(currentEx.name, this.state.sortedColumns); + const newColumn = getColumnWithName(partialEx.name, this.state.sortedColumns); + const oldType = oldColumn && oldColumn.type; + const newType = newColumn && newColumn.type; + if (oldType !== newType) { + const newOperators = getValidOperators(newColumn).map((validOperator) => validOperator[0]); + if (newOperators.indexOf(currentEx.operator) < 0) { + partialEx.operator = "=="; + } + } + } + const ex = Object.assign(Object.assign({}, currentEx), partialEx); + clearExpressionValidation(ex); + expressions[index2] = ex; + group2.expressions = expressions; + groups[groupIndex] = group2; + this.setState({ groups }); + } + deleteExpression(groupIndex, index2) { + const groups = [...this.state.groups]; + const group2 = Object.assign({}, groups[groupIndex]); + const expressions = [...group2.expressions]; + expressions.splice(index2, 1); + if (expressions.length === 2) { + expressions[1].unlocked = true; + } + group2.expressions = expressions; + groups[groupIndex] = group2; + this.setState({ groups }); + } + render() { + return base$1.react.createElement( + Group$1, + { className: "sanddance-search", label: strings$1.labelSearch }, + base$1.react.createElement( + "div", + null, + this.state.groups.map((group2, groupIndex) => base$1.react.createElement( + "div", + { className: "sanddance-search-group", key: group2.key }, + base$1.react.createElement(Dropdown$1, { collapseLabel: this.props.collapseLabels, className: "search-group-clause", label: strings$1.labelSearchClause, disabled: groupIndex === 0 || this.props.disableGroupOR, dropdownWidth: 120, options: getGroupClauses(group2.clause, groupIndex, this.props.disableGroupOR), onChange: (e, o) => this.updateGroup({ clause: o.data }, groupIndex) }), + base$1.react.createElement("div", null, group2.expressions.map((ex, i) => base$1.react.createElement( + "div", + { className: "sanddance-search-expression", key: ex.key }, + base$1.react.createElement(SearchTerm, { dropdownRef: groupIndex === 0 && i === 0 ? this.dropdownRef : void 0, collapseLabels: this.props.collapseLabels, onUpdateExpression: (ex2, i2) => this.updateExpression(ex2, groupIndex, i2), autoCompleteDistinctValues: this.props.autoCompleteDistinctValues, index: i, columns: this.state.sortedColumns, data: this.props.data, searchExpression: ex, disableOR: this.props.disableExpressionOR, column: getColumnWithName(ex.name, this.state.sortedColumns) }), + group2.expressions.length > 1 && base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action", iconName: "Cancel", onClick: () => this.deleteExpression(groupIndex, i), text: strings$1.buttonDeleteExpression }) + ))), + group2.expressions.length < maxClauses && base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action", iconName: "Add", onClick: () => this.addExpression(groupIndex), text: strings$1.buttonAddExpression }) + ), + this.state.groups.length > 1 && base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action", iconName: "Cancel", onClick: () => this.deleteGroup(groupIndex), text: strings$1.buttonDeleteExpressionGroup }) + )), + this.state.groups.length < maxClauses && base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { themePalette: this.props.themePalette, className: "search-action search-bottom-action", iconName: "Add", onClick: () => this.addGroup(), text: strings$1.buttonAddExpressionGroup }) + ) + ), + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { className: "search-action search-bottom-action", text: strings$1.buttonSelect, onClick: () => this.validateAndSearch() }) + ); + } + } + return new __Search(_props); + } + const Search = _Search; + var PresenterElement = PresenterElement$1; + function getCanvas(viewer) { + const tags = viewer.presenter.getElement(PresenterElement.gl).getElementsByTagName("canvas"); + if (tags) { + return tags[0]; + } + } + function removeTabIndex(viewer) { + const canvas = getCanvas(viewer); + if (canvas) { + canvas.tabIndex = -1; + } + } + const capabilities = { + webgl: !!document.createElement("canvas").getContext("webgl"), + webgl2: !!document.createElement("canvas").getContext("webgl2") + }; + const version$2 = "4.1.8"; + var SandDance = index$4; + var DataRefType; + (function(DataRefType2) { + DataRefType2[DataRefType2["none"] = 0] = "none"; + DataRefType2[DataRefType2["inline"] = 1] = "inline"; + DataRefType2[DataRefType2["url"] = 2] = "url"; + })(DataRefType || (DataRefType = {})); + function filterSignals(signal) { + switch (signal.name) { + case SandDance.constants.SignalNames.XBins: + case SandDance.constants.SignalNames.YBins: + case SandDance.constants.SignalNames.FacetBins: + case SandDance.constants.SignalNames.FacetVBins: + case SandDance.constants.SignalNames.ColorBinCount: + case SandDance.constants.SignalNames.ColorReverse: + case SandDance.constants.SignalNames.PointScale: + case SandDance.constants.SignalNames.TreeMapMethod: + case SandDance.constants.SignalNames.ZGrounded: + return false; + default: + return !!signal.bind; } -} -function cloneData(vegaSpec) { + } + function cloneData(vegaSpec) { const data0 = vegaSpec.data[0]; const valuesData = data0; - const values = valuesData.values; + const values2 = valuesData.values; delete valuesData.values; - const data = SandDance.VegaMorphCharts.util.clone(vegaSpec.data); - valuesData.values = values; - return { - data, - values - }; -} -function cloneScales(vegaSpec) { + const data2 = SandDance.VegaMorphCharts.util.clone(vegaSpec.data); + valuesData.values = values2; + return { data: data2, values: values2 }; + } + function cloneScales(vegaSpec) { return SandDance.VegaMorphCharts.util.clone(vegaSpec.scales); -} -function serializeSpec(vegaSpec, datafile, dataRefType, transform, scheme) { - const scales = cloneScales(vegaSpec); - const colorScale = scales.filter((scale)=>scale.name === SandDance.constants.ScaleNames.Color)[0]; - if (scheme.indexOf('dual_') >= 0) colorScale.range = SandDance.colorSchemes.filter((cs)=>cs.scheme === scheme)[0].colors; - const clone = cloneData(vegaSpec); - const data0 = clone.data[0]; + } + function serializeSpec(vegaSpec, datafile, dataRefType, transform2, scheme2) { + const scales2 = cloneScales(vegaSpec); + const colorScale = scales2.filter((scale2) => scale2.name === SandDance.constants.ScaleNames.Color)[0]; + if (scheme2.indexOf("dual_") >= 0) { + colorScale.range = SandDance.colorSchemes.filter((cs) => cs.scheme === scheme2)[0].colors; + } + const clone2 = cloneData(vegaSpec); + const data0 = clone2.data[0]; if (dataRefType === DataRefType.inline) { - const valuesData = data0; - valuesData.format = { - parse: 'auto', - type: 'json' - }; - valuesData.values = clone.values; + const valuesData = data0; + valuesData.format = { parse: "auto", type: "json" }; + valuesData.values = clone2.values; } else if (dataRefType === DataRefType.none) { - const valuesData = data0; - valuesData.values = []; - if (transform) { - if (valuesData.transform) valuesData.transform.push.apply(valuesData.transform, transform); - else valuesData.transform = transform; + const valuesData = data0; + valuesData.values = []; + if (transform2) { + if (valuesData.transform) { + valuesData.transform.push.apply(valuesData.transform, transform2); + } else { + valuesData.transform = transform2; } + } } else if (dataRefType === DataRefType.url) { - const urlData = data0; - urlData.url = datafile.dataUrl; - urlData.format = { - parse: 'auto', - type: datafile.type - }; - if (transform) { - if (urlData.transform) urlData.transform.push.apply(urlData.transform, transform); - else urlData.transform = transform; + const urlData = data0; + urlData.url = datafile.dataUrl; + urlData.format = { parse: "auto", type: datafile.type }; + if (transform2) { + if (urlData.transform) { + urlData.transform.push.apply(urlData.transform, transform2); + } else { + urlData.transform = transform2; } + } + } + return Object.assign(Object.assign({}, vegaSpec), { data: clone2.data, scales: scales2 }); + } + function defaultDataRefType(datafile) { + if (datafile.dataUrl) { + return DataRefType.url; } - return Object.assign(Object.assign({}, vegaSpec), { - data: clone.data, - scales - }); -} -function defaultDataRefType(datafile) { - if (datafile.dataUrl) return DataRefType.url; return DataRefType.none; -} -function initState(props) { + } + function initState(props) { return { - showSystemDialog: false, - showVegaDialog: false, - dataRefType: defaultDataRefType(props.dataFile), - spec: null - }; -} -function signalGroupKey(key) { - for(let i = 0; i < (0, _language.strings).signalGroups.length; i++){ - if ((0, _language.strings).signalGroups[i].prefix === key) return key; - } - return '*'; -} -function vegaSignalGroups(vegaSignals) { + showSystemDialog: false, + showVegaDialog: false, + dataRefType: defaultDataRefType(props.dataFile), + spec: null + }; + } + function signalGroupKey(key2) { + for (let i = 0; i < strings$1.signalGroups.length; i++) { + if (strings$1.signalGroups[i].prefix === key2) { + return key2; + } + } + return "*"; + } + function vegaSignalGroups(vegaSignals) { const signalGroupMap = {}; - vegaSignals.forEach((vs)=>{ - const split = vs.name.split('_'); - const key = signalGroupKey(split[0]); - signalGroupMap[key] = signalGroupMap[key] || []; - signalGroupMap[key].push(vs); + vegaSignals.forEach((vs) => { + const split = vs.name.split("_"); + const key2 = signalGroupKey(split[0]); + signalGroupMap[key2] = signalGroupMap[key2] || []; + signalGroupMap[key2].push(vs); }); return signalGroupMap; -} -function _Settings(_props) { - class __Settings extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = initState(props); - } - render() { - const { props, state } = this; - if (!props.explorer.viewer || !props.explorer.viewer.vegaSpec) return null; - const options = [ - { - key: DataRefType.none, - text: (0, _language.strings).selectVegaSpecDataNone, - selected: this.state.dataRefType === DataRefType.none, - data: DataRefType.none - }, - !props.dataFile.rawText && { - key: DataRefType.url, - text: (0, _language.strings).selectVegaSpecDataUrl, - selected: this.state.dataRefType === DataRefType.url, - data: DataRefType.url - }, - { - key: DataRefType.inline, - text: (0, _language.strings).selectVegaSpecDataInline, - selected: this.state.dataRefType === DataRefType.inline, - data: DataRefType.inline - } - ].filter(Boolean); - const signalGroupMap = vegaSignalGroups(props.explorer.viewer.vegaSpec.signals); - let first = true; - return (0, _base.base).react.createElement("div", null, (0, _language.strings).signalGroups.map((sg, gi)=>{ - const vegaSignals = signalGroupMap[sg.prefix]; - if (vegaSignals) { - const filteredVegaSignals = vegaSignals.filter(filterSignals); - if (filteredVegaSignals.length > 0) return (0, _base.base).react.createElement((0, _group.Group), { - key: sg.prefix, - label: sg.label - }, filteredVegaSignals.map((signal, i)=>{ - const ref = (0, _base.base).react.createRef(); - if (first) { - first = false; - props.explorer.dialogFocusHandler.focus = ()=>{ - const f = ref.current; - if (f === null || f === void 0 ? void 0 : f.focus) f.focus(); - }; - } - return (0, _base.base).react.createElement((0, _signal.Signal), { - componentRef: ref, - key: i, - signal: signal, - explorer: props.explorer, - initialValue: (0, _signal.getInitialSignalValue)(props.explorer, signal), - newViewStateTarget: false - }); - })); - } - }), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelChartCanvas - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelShowAxes, - defaultChecked: !props.hideAxes, - onChange: (e, checked)=>props.onToggleAxes(!checked) - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelShowLegend, - defaultChecked: !props.hideLegend, - onChange: (e, checked)=>props.onToggleLegend(!checked) - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTools - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - text: (0, _language.strings).buttonShowVegaSpec, - onClick: ()=>this.setState({ - showVegaDialog: true, - spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, this.state.dataRefType, props.explorer.viewer.getInsight().transform, this.props.scheme) - }) - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelSnapshots - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelSnapshotSettingThumbnailWidth, - onChange: (value)=>{ - this.props.explorer.snapshotThumbWidth = value; - }, - min: 100, - max: 800, - defaultValue: this.props.explorer.snapshotThumbWidth - })), props.additionalSettings && props.additionalSettings.map((g, i)=>(0, _base.base).react.createElement((0, _group.Group), { - key: i, - label: g.groupLabel - }, g.children)), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelSystem - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - text: (0, _language.strings).labelSystemInfo, - onClick: ()=>this.setState({ - showSystemDialog: true - }) - })), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !state.showVegaDialog, - onDismiss: ()=>this.setState(initState(this.props)), - minWidth: "80%", - title: (0, _language.strings).labelVegaSpec, - buttons: [ - (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: "copy", - iconProps: { - iconName: 'Copy' - }, - text: (0, _language.strings).buttonCopyToClipboard, - onClick: ()=>{ - const pre = document.getElementById('sanddance-vega-spec'); - const range = document.createRange(); - range.selectNode(pre); - const selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - document.execCommand('copy'); - } - }), - (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - key: "edit", - iconProps: { - iconName: 'OpenInNewWindow' - }, - text: (0, _language.strings).buttonLaunchVegaEditor, - onClick: ()=>{ - window.open('https://vega.github.io/editor/', '_blank'); - } - }) - ] - }, (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - label: (0, _language.strings).labelVegaSpecData, - options: options, - onChange: (e, o)=>this.setState({ - dataRefType: o.data, - spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, o.data, props.explorer.viewer.getInsight().transform, this.props.scheme) - }) - }), (0, _base.base).react.createElement("pre", { - id: "sanddance-vega-spec" - }, JSON.stringify(this.state.spec, null, 2)), (0, _base.base).react.createElement("div", null, (0, _language.strings).labelVegaSpecNotes)), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !state.showSystemDialog, - onDismiss: ()=>this.setState(initState(this.props)), - title: (0, _language.strings).labelSystemInfo - }, (0, _base.base).react.createElement("ul", null, this.props.children, (0, _base.base).react.createElement("li", null, "SandDanceExplorer version: ", (0, _version.version)), (0, _base.base).react.createElement("li", null, "SandDanceReact version: ", _sanddanceReact.version), (0, _base.base).react.createElement("li", null, "SandDance version: ", SandDance.version), (0, _base.base).react.createElement("li", null, "Vega-MorphCharts version: ", SandDance.VegaMorphCharts.version), (0, _base.base).react.createElement("li", null, "WebGL enabled: ", (0, _canvas.capabilities).webgl ? (0, _language.strings).labelYes : (0, _language.strings).labelNo), (0, _base.base).react.createElement("li", null, "WebGL2 enabled: ", (0, _canvas.capabilities).webgl2 ? (0, _language.strings).labelYes : (0, _language.strings).labelNo)))); - } + } + function _Settings(_props) { + class __Settings extends base$1.react.Component { + constructor(props) { + super(props); + this.state = initState(props); + } + render() { + const { props, state } = this; + if (!props.explorer.viewer || !props.explorer.viewer.vegaSpec) + return null; + const options2 = [ + { + key: DataRefType.none, + text: strings$1.selectVegaSpecDataNone, + selected: this.state.dataRefType === DataRefType.none, + data: DataRefType.none + }, + !props.dataFile.rawText && { + key: DataRefType.url, + text: strings$1.selectVegaSpecDataUrl, + selected: this.state.dataRefType === DataRefType.url, + data: DataRefType.url + }, + { + key: DataRefType.inline, + text: strings$1.selectVegaSpecDataInline, + selected: this.state.dataRefType === DataRefType.inline, + data: DataRefType.inline + } + ].filter(Boolean); + const signalGroupMap = vegaSignalGroups(props.explorer.viewer.vegaSpec.signals); + let first = true; + return base$1.react.createElement( + "div", + null, + strings$1.signalGroups.map((sg, gi) => { + const vegaSignals = signalGroupMap[sg.prefix]; + if (vegaSignals) { + const filteredVegaSignals = vegaSignals.filter(filterSignals); + if (filteredVegaSignals.length > 0) { + return base$1.react.createElement(Group$1, { key: sg.prefix, label: sg.label }, filteredVegaSignals.map((signal, i) => { + const ref2 = base$1.react.createRef(); + if (first) { + first = false; + props.explorer.dialogFocusHandler.focus = () => { + const f = ref2.current; + if (f === null || f === void 0 ? void 0 : f.focus) { + f.focus(); + } + }; + } + return base$1.react.createElement(Signal, { componentRef: ref2, key: i, signal, explorer: props.explorer, initialValue: getInitialSignalValue(props.explorer, signal), newViewStateTarget: false }); + })); + } + } + }), + base$1.react.createElement( + Group$1, + { label: strings$1.labelChartCanvas }, + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelShowAxes, defaultChecked: !props.hideAxes, onChange: (e, checked) => props.onToggleAxes(!checked) }), + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelShowLegend, defaultChecked: !props.hideLegend, onChange: (e, checked) => props.onToggleLegend(!checked) }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTools }, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { text: strings$1.buttonShowVegaSpec, onClick: () => this.setState({ + showVegaDialog: true, + spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, this.state.dataRefType, props.explorer.viewer.getInsight().transform, this.props.scheme) + }) }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelSnapshots }, + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelSnapshotSettingThumbnailWidth, onChange: (value2) => { + this.props.explorer.snapshotThumbWidth = value2; + }, min: 100, max: 800, defaultValue: this.props.explorer.snapshotThumbWidth }) + ), + props.additionalSettings && props.additionalSettings.map((g, i) => base$1.react.createElement(Group$1, { key: i, label: g.groupLabel }, g.children)), + base$1.react.createElement( + Group$1, + { label: strings$1.labelSystem }, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { text: strings$1.labelSystemInfo, onClick: () => this.setState({ showSystemDialog: true }) }) + ), + base$1.react.createElement( + Dialog$1, + { hidden: !state.showVegaDialog, onDismiss: () => this.setState(initState(this.props)), minWidth: "80%", title: strings$1.labelVegaSpec, buttons: [ + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: "copy", iconProps: { iconName: "Copy" }, text: strings$1.buttonCopyToClipboard, onClick: () => { + const pre = document.getElementById("sanddance-vega-spec"); + const range2 = document.createRange(); + range2.selectNode(pre); + const selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range2); + document.execCommand("copy"); + } }), + base$1.react.createElement(base$1.fluentUI.DefaultButton, { key: "edit", iconProps: { iconName: "OpenInNewWindow" }, text: strings$1.buttonLaunchVegaEditor, onClick: () => { + window.open("https://vega.github.io/editor/", "_blank"); + } }) + ] }, + base$1.react.createElement(Dropdown$1, { label: strings$1.labelVegaSpecData, options: options2, onChange: (e, o) => this.setState({ + dataRefType: o.data, + spec: serializeSpec(props.explorer.viewer.vegaSpec, props.dataFile, o.data, props.explorer.viewer.getInsight().transform, this.props.scheme) + }) }), + base$1.react.createElement("pre", { id: "sanddance-vega-spec" }, JSON.stringify(this.state.spec, null, 2)), + base$1.react.createElement("div", null, strings$1.labelVegaSpecNotes) + ), + base$1.react.createElement( + Dialog$1, + { hidden: !state.showSystemDialog, onDismiss: () => this.setState(initState(this.props)), title: strings$1.labelSystemInfo }, + base$1.react.createElement( + "ul", + null, + this.props.children, + base$1.react.createElement( + "li", + null, + "SandDanceExplorer version: ", + version$2 + ), + base$1.react.createElement( + "li", + null, + "SandDanceReact version: ", + version$3 + ), + base$1.react.createElement( + "li", + null, + "SandDance version: ", + SandDance.version + ), + base$1.react.createElement( + "li", + null, + "Vega-MorphCharts version: ", + SandDance.VegaMorphCharts.version + ), + base$1.react.createElement( + "li", + null, + "WebGL enabled: ", + capabilities.webgl ? strings$1.labelYes : strings$1.labelNo + ), + base$1.react.createElement( + "li", + null, + "WebGL2 enabled: ", + capabilities.webgl2 ? strings$1.labelYes : strings$1.labelNo + ) + ) + ) + ); + } } return new __Settings(_props); -} -const Settings = _Settings; - -},{"@msrvida/sanddance-react":"lPyTZ","../base":"3TPz5","../canvas":"55nq5","../controls/dialog":"OQi9w","../controls/dropdown":"7pP8h","../controls/group":"afKlW","../controls/signal":"buTZe","../language":"67xOI","../version":"CFT5Q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55nq5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getCanvas", ()=>getCanvas); -parcelHelpers.export(exports, "removeTabIndex", ()=>removeTabIndex); -parcelHelpers.export(exports, "capabilities", ()=>capabilities); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var PresenterElement = (0, _sanddanceReact.SandDance).VegaMorphCharts.PresenterElement; -function getCanvas(viewer) { - const tags = viewer.presenter.getElement(PresenterElement.gl).getElementsByTagName('canvas'); - if (tags) return tags[0]; -} -function removeTabIndex(viewer) { - const canvas = getCanvas(viewer); - if (canvas) canvas.tabIndex = -1; -} -const capabilities = { - webgl: !!document.createElement('canvas').getContext('webgl'), - webgl2: !!document.createElement('canvas').getContext('webgl2') -}; - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"CFT5Q":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '4.1.8'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g29jp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SnapshotEditor", ()=>SnapshotEditor); -var _base = require("../base"); -var _dialog = require("../controls/dialog"); -var _canvas = require("../canvas"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -function _SnapshotEditor(_props) { - class __SnapshotEditor extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - showEditFormDialog: false, - title: '', - description: '', - image: null, - bgColor: null, - insight: null, - editIndex: -1 - }; + } + const Settings = _Settings; + function _SnapshotEditor(_props) { + class __SnapshotEditor extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + showEditFormDialog: false, + title: "", + description: "", + image: null, + bgColor: null, + insight: null, + editIndex: -1 + }; + } + resize(src, thumbWidth) { + if (!src) + return; + const img = new Image(); + img.onload = () => { + const canvas = document.createElement("canvas"), ctx = canvas.getContext("2d"); + const ratio = img.width / thumbWidth; + canvas.height = img.height / ratio; + canvas.width = thumbWidth; + ctx.drawImage(img, 0, 0, canvas.width, canvas.height); + const image2 = canvas.toDataURL(); + this.setState({ image: image2 }); + }; + img.src = src; + } + editSnapshot(snapshot, editIndex = -1) { + if (snapshot) { + this.setState(Object.assign(Object.assign({ showEditFormDialog: true }, snapshot), { editIndex })); + } else { + const { explorer: explorer2 } = this.props; + const signalValues = explorer2.viewer.getSignalValues(); + explorer2.viewer.deselect().then(() => { + const canvas = getCanvas(explorer2.viewer); + const bgColor = canvas && window.getComputedStyle(canvas).backgroundColor; + const insight = clone(explorer2.viewer.getInsight()); + delete insight.size; + insight.signalValues = signalValues; + const title = this.props.getTitle && this.props.getTitle(insight) || ""; + const description = this.props.getDescription && this.props.getDescription(insight) || ""; + this.setState({ showEditFormDialog: true, bgColor, title, description, insight, image: null, editIndex }); + setTimeout(() => { + explorer2.viewer.presenter.canvasToDataURL().then((dataUrl) => { + this.resize(dataUrl, explorer2.snapshotThumbWidth); + }); + }, 500); + }); } - resize(src, thumbWidth) { - if (!src) return; - const img = new Image(); - img.onload = ()=>{ - const canvas = document.createElement('canvas'), ctx = canvas.getContext('2d'); - const ratio = img.width / thumbWidth; - canvas.height = img.height / ratio; - canvas.width = thumbWidth; - ctx.drawImage(img, 0, 0, canvas.width, canvas.height); - const image = canvas.toDataURL(); - this.setState({ - image - }); + } + render() { + var _a2, _b2; + const { explorer: explorer2 } = this.props; + return base$1.react.createElement( + Dialog$1, + { modalProps: { className: classList("sanddance-snapshot-dialog", this.props.theme) }, minWidth: `${explorer2.snapshotThumbWidth + 64}px`, hidden: !this.state.showEditFormDialog, onDismiss: () => this.setState({ showEditFormDialog: false }), title: this.state.editIndex >= 0 ? strings$1.buttonEditSnapshot : strings$1.buttonCreateSnapshot, buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { disabled: !this.state.image || !this.state.title, key: 0, onClick: (e) => { + const setup2 = clone(explorer2.getSetup()); + if (setup2.camera !== "hold") { + setup2.camera = explorer2.viewer.getCamera(); + } + const snapshot = { + title: this.state.title, + description: this.state.description, + insight: this.state.insight, + image: this.state.image, + bgColor: this.state.bgColor, + setup: setup2 }; - img.src = src; - } - editSnapshot(snapshot, editIndex = -1) { - if (snapshot) this.setState(Object.assign(Object.assign({ - showEditFormDialog: true - }, snapshot), { - editIndex - })); - else { - const { explorer } = this.props; - const signalValues = explorer.viewer.getSignalValues(); - explorer.viewer.deselect().then(()=>{ - const canvas = (0, _canvas.getCanvas)(explorer.viewer); - const bgColor = canvas && window.getComputedStyle(canvas).backgroundColor; - const insight = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(explorer.viewer.getInsight()); - delete insight.size; - insight.signalValues = signalValues; - const title = this.props.getTitle && this.props.getTitle(insight) || ''; - const description = this.props.getDescription && this.props.getDescription(insight) || ''; - this.setState({ - showEditFormDialog: true, - bgColor, - title, - description, - insight, - image: null, - editIndex - }); - //allow deselection to render - setTimeout(()=>{ - explorer.viewer.presenter.canvasToDataURL().then((dataUrl)=>{ - this.resize(dataUrl, explorer.snapshotThumbWidth); - }); - }, 500); - }); - } - } - render() { - var _a, _b; - const { explorer } = this.props; - return (0, _base.base).react.createElement((0, _dialog.Dialog), { - modalProps: { - className: (0, _sanddanceReact.util).classList('sanddance-snapshot-dialog', this.props.theme) - }, - minWidth: `${explorer.snapshotThumbWidth + 64}px`, - hidden: !this.state.showEditFormDialog, - onDismiss: ()=>this.setState({ - showEditFormDialog: false - }), - title: this.state.editIndex >= 0 ? (0, _language.strings).buttonEditSnapshot : (0, _language.strings).buttonCreateSnapshot, - buttons: (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - disabled: !this.state.image || !this.state.title, - key: 0, - onClick: (e)=>{ - const setup = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone(explorer.getSetup()); - if (setup.camera !== 'hold') //get the latest camera movement, instead of what's in state - setup.camera = explorer.viewer.getCamera(); - const snapshot = { - title: this.state.title, - description: this.state.description, - insight: this.state.insight, - image: this.state.image, - bgColor: this.state.bgColor, - setup - }; - this.props.modifySnapShot && this.props.modifySnapShot(snapshot); - this.props.onWriteSnapshot(snapshot, this.state.editIndex); - this.setState({ - showEditFormDialog: false, - title: '', - description: '', - image: null - }); - }, - iconProps: { - iconName: 'Camera' - }, - text: this.state.editIndex >= 0 ? (0, _language.strings).buttonUpdateSnapshot : (0, _language.strings).buttonCreateSnapshot - }) - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelSnapshotTitle, - onChange: (e, title)=>this.setState({ - title - }), - value: this.state.title - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelSnapshotDescription, - onChange: (e, description)=>this.setState({ - description - }), - value: this.state.description, - multiline: true - }), (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, !this.state.image && (0, _base.base).react.createElement((0, _base.base).fluentUI.Spinner, null), this.state.image && (0, _base.base).react.createElement("img", { - src: this.state.image, - style: { - backgroundColor: this.state.bgColor - } - })), ((_b = (_a = explorer.viewer) === null || _a === void 0 ? void 0 : _a.colorContexts) === null || _b === void 0 ? void 0 : _b.length) > 1 && (0, _base.base).react.createElement("div", null, (0, _language.strings).labelColorFilter)); - } + this.props.modifySnapShot && this.props.modifySnapShot(snapshot); + this.props.onWriteSnapshot(snapshot, this.state.editIndex); + this.setState({ showEditFormDialog: false, title: "", description: "", image: null }); + }, iconProps: { iconName: "Camera" }, text: this.state.editIndex >= 0 ? strings$1.buttonUpdateSnapshot : strings$1.buttonCreateSnapshot }) }, + base$1.react.createElement(base$1.fluentUI.TextField, { label: strings$1.labelSnapshotTitle, onChange: (e, title) => this.setState({ title }), value: this.state.title }), + base$1.react.createElement(base$1.fluentUI.TextField, { label: strings$1.labelSnapshotDescription, onChange: (e, description) => this.setState({ description }), value: this.state.description, multiline: true }), + base$1.react.createElement( + "div", + { className: "thumbnail" }, + !this.state.image && base$1.react.createElement(base$1.fluentUI.Spinner, null), + this.state.image && base$1.react.createElement("img", { src: this.state.image, style: { backgroundColor: this.state.bgColor } }) + ), + ((_b2 = (_a2 = explorer2.viewer) === null || _a2 === void 0 ? void 0 : _a2.colorContexts) === null || _b2 === void 0 ? void 0 : _b2.length) > 1 && base$1.react.createElement("div", null, strings$1.labelColorFilter) + ); + } } return new __SnapshotEditor(_props); -} -const SnapshotEditor = _SnapshotEditor; - -},{"../base":"3TPz5","../controls/dialog":"OQi9w","../canvas":"55nq5","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"sTI5I":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Snapshots", ()=>Snapshots); -var _base = require("../base"); -var _dialog = require("../controls/dialog"); -var _group = require("../controls/group"); -var _iconButton = require("../controls/iconButton"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("../language"); -function _Snapshots(_props) { - class __Snapshots extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = { - confirmation: null, - title: '', - description: '', - image: null, - bgColor: null, - insight: null - }; - } - render() { - const items = [ - { - key: 'clear', - text: (0, _language.strings).buttonClearSnapshots, - onClick: ()=>this.setState({ - confirmation: { - buttonText: (0, _language.strings).buttonClearSnapshots, - handler: ()=>this.props.onClearSnapshots() - } - }), - disabled: this.props.snapshots.length === 0 - } - ]; - if (this.props.getTopActions) items.push.apply(items, this.props.getTopActions(this.props.snapshots)); - const ref = (0, _base.base).react.createRef(); - this.props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - (_a = ref.current) === null || _a === void 0 || _a.focus(); - }; - return (0, _base.base).react.createElement((0, _group.Group), { - className: "sanddance-snapshots", - label: (0, _language.strings).labelSnapshots - }, (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - componentRef: ref, - text: (0, _language.strings).buttonCreateSnapshot, - onClick: (e)=>this.props.editor.editSnapshot(), - split: true, - menuProps: { - items + } + const SnapshotEditor = _SnapshotEditor; + function _Snapshots(_props) { + class __Snapshots extends base$1.react.Component { + constructor(props) { + super(props); + this.state = { + confirmation: null, + title: "", + description: "", + image: null, + bgColor: null, + insight: null + }; + } + render() { + const items = [ + { + key: "clear", + text: strings$1.buttonClearSnapshots, + onClick: () => this.setState({ + confirmation: { + buttonText: strings$1.buttonClearSnapshots, + handler: () => this.props.onClearSnapshots() + } + }), + disabled: this.props.snapshots.length === 0 + } + ]; + if (this.props.getTopActions) { + items.push.apply(items, this.props.getTopActions(this.props.snapshots)); + } + const ref2 = base$1.react.createRef(); + this.props.explorer.dialogFocusHandler.focus = () => { + var _a2; + (_a2 = ref2.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + Group$1, + { className: "sanddance-snapshots", label: strings$1.labelSnapshots }, + base$1.react.createElement( + "div", + null, + base$1.react.createElement(base$1.fluentUI.PrimaryButton, { componentRef: ref2, text: strings$1.buttonCreateSnapshot, onClick: (e) => this.props.editor.editSnapshot(), split: true, menuProps: { + items + } }), + this.props.getChildren && this.props.getChildren(this.props.snapshots), + this.state.confirmation && base$1.react.createElement(Dialog$1, { hidden: false, buttons: base$1.react.createElement(base$1.fluentUI.PrimaryButton, { key: 0, onClick: (e) => { + this.setState({ confirmation: null }); + this.state.confirmation.handler(); + }, iconProps: { iconName: "Delete" }, text: this.state.confirmation.buttonText }), onDismiss: () => this.setState({ confirmation: null }) }, strings$1.labelConfirmation), + base$1.react.createElement("div", null, this.props.snapshots.map((snapshot, i) => { + const actions = this.props.getActions && this.props.getActions(snapshot, i) || []; + actions.push({ + iconButtonProps: { + themePalette: this.props.themePalette, + title: strings$1.buttonEditSnapshot, + onClick: (e) => this.props.editor.editSnapshot(snapshot, i), + iconName: "Edit" } - }), this.props.getChildren && this.props.getChildren(this.props.snapshots), this.state.confirmation && (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: false, - buttons: (0, _base.base).react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 0, - onClick: (e)=>{ - this.setState({ - confirmation: null - }); - this.state.confirmation.handler(); - }, - iconProps: { - iconName: 'Delete' - }, - text: this.state.confirmation.buttonText - }), - onDismiss: ()=>this.setState({ - confirmation: null - }) - }, (0, _language.strings).labelConfirmation), (0, _base.base).react.createElement("div", null, this.props.snapshots.map((snapshot, i)=>{ - const actions = this.props.getActions && this.props.getActions(snapshot, i) || []; + }); + if (this.props.snapshots.length > 1) { actions.push({ - iconButtonProps: { - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonEditSnapshot, - onClick: (e)=>this.props.editor.editSnapshot(snapshot, i), - iconName: 'Edit' - } - }); - if (this.props.snapshots.length > 1) actions.push({ - iconButtonProps: { - disabled: i === 0, - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonMoveUp, - onClick: (e)=>this.props.onMoveUp(i), - iconName: 'SortUp' - } + iconButtonProps: { + disabled: i === 0, + themePalette: this.props.themePalette, + title: strings$1.buttonMoveUp, + onClick: (e) => this.props.onMoveUp(i), + iconName: "SortUp" + } }, { - iconButtonProps: { - disabled: i > this.props.snapshots.length - 2, - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonMoveDown, - onClick: (e)=>this.props.onMoveDown(i), - iconName: 'SortDown' - } - }); - actions.push({ - iconButtonProps: { - themePalette: this.props.themePalette, - title: (0, _language.strings).buttonDeleteSnapshot, - onClick: ()=>this.setState({ - confirmation: { - buttonText: (0, _language.strings).buttonDeleteSnapshot, - handler: ()=>this.props.onRemoveSnapshot(i) - } - }), - iconName: 'Delete' - } + iconButtonProps: { + disabled: i > this.props.snapshots.length - 2, + themePalette: this.props.themePalette, + title: strings$1.buttonMoveDown, + onClick: (e) => this.props.onMoveDown(i), + iconName: "SortDown" + } }); - return (0, _base.base).react.createElement("div", { - key: i, - className: (0, _sanddanceReact.util).classList('snapshot', i === this.props.selectedSnapshotIndex && 'selected') - }, (0, _base.base).react.createElement("div", { - onClick: (e)=>this.props.onSnapshotClick(snapshot, i) - }, (0, _base.base).react.createElement("div", { - className: 'title' - }, snapshot.title), (0, _base.base).react.createElement("div", { - className: 'thumbnail' - }, (0, _base.base).react.createElement("img", { - title: snapshot.description, - src: snapshot.image, - style: { - backgroundColor: snapshot.bgColor + } + actions.push({ + iconButtonProps: { + themePalette: this.props.themePalette, + title: strings$1.buttonDeleteSnapshot, + onClick: () => this.setState({ + confirmation: { + buttonText: strings$1.buttonDeleteSnapshot, + handler: () => this.props.onRemoveSnapshot(i) } - }))), (0, _base.base).react.createElement(Actions, { - actions: actions, - snapshot: snapshot - })); - })))); - } + }), + iconName: "Delete" + } + }); + return base$1.react.createElement( + "div", + { key: i, className: classList("snapshot", i === this.props.selectedSnapshotIndex && "selected") }, + base$1.react.createElement( + "div", + { onClick: (e) => this.props.onSnapshotClick(snapshot, i) }, + base$1.react.createElement("div", { className: "title" }, snapshot.title), + base$1.react.createElement( + "div", + { className: "thumbnail" }, + base$1.react.createElement("img", { title: snapshot.description, src: snapshot.image, style: { backgroundColor: snapshot.bgColor } }) + ) + ), + base$1.react.createElement(Actions, { actions, snapshot }) + ); + })) + ) + ); + } } return new __Snapshots(_props); -} -const Snapshots = _Snapshots; -function Actions(props) { - return (0, _base.base).react.createElement("div", { - className: "actions" - }, props.actions.map((action, i)=>{ - if (action.iconButtonProps) return (0, _base.base).react.createElement((0, _iconButton.IconButton), Object.assign({ - key: i - }, action.iconButtonProps)); - if (action.element) return action.element; + } + const Snapshots = _Snapshots; + function Actions(props) { + return base$1.react.createElement("div", { className: "actions" }, props.actions.map((action, i) => { + if (action.iconButtonProps) { + return base$1.react.createElement(IconButton$1, Object.assign({ key: i }, action.iconButtonProps)); + } + if (action.element) { + return action.element; + } })); -} - -},{"../base":"3TPz5","../controls/dialog":"OQi9w","../controls/group":"afKlW","../controls/iconButton":"6pZiK","@msrvida/sanddance-react":"lPyTZ","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3tDGl":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TransitionEditor", ()=>TransitionEditor); -parcelHelpers.export(exports, "getTransition", ()=>getTransition); -parcelHelpers.export(exports, "syncTansitionDurations", ()=>syncTansitionDurations); -var _base = require("../base"); -var _group = require("../controls/group"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _dropdown = require("../controls/dropdown"); -var _iconButton = require("../controls/iconButton"); -var _button = require("../controls/button"); -const positions = [ - [ - 'x', - (0, _language.strings).labelAliasX - ], - [ - 'y', - (0, _language.strings).labelAliasY - ], - [ - 'z', - (0, _language.strings).labelAliasZ - ] -]; -const autoScrubInterval = 50; //tune to get the smoothest animation while able to do an update pass through React -function _TransitionEditor(_props) { - class __TransitionEditor extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.state = Object.assign({ - scrub: 100, - pauseDisabled: true - }, this.initialCalc(props.transitionDurations)); - this.autoScrubber = new AutoScrubber(autoScrubInterval, (direction, interval)=>{ - const totalMs = this.state.totalTransition * 1000; - const currentMs = this.state.scrub / 100 * totalMs; - const scrubMs = currentMs + direction * interval; - let scrub = scrubMs / totalMs * 100; - if (direction < 0 && scrub <= 0) { - scrub = 0; - this.autoScrubber.stop(); - } - if (direction > 0 && scrub >= 100) { - scrub = 100; - this.autoScrubber.stop(); - } - this.setScrubState(scrub); - }); - } - initialCalc(transitionDurations) { - const totalTransition = (transitionDurations.position + transitionDurations.stagger) / 1000; - const staggerPercent = transitionDurations.stagger === 0 ? 1 : transitionDurations.stagger / (totalTransition * 1000) * 100; - const viewTransition = transitionDurations.view / 1000; - return { - totalTransition, - staggerPercent, - viewTransition - }; - } - setScrubState(scrub) { - const { morphChartsRenderResult, morphchartsref } = this.props.explorer.viewer.presenter; - morphchartsref.core.renderer.transitionTime = scrub / 100; - morphChartsRenderResult.setTransitionTimeAxesVisibility(); - scrub = Math.round(scrub); - this.setState({ - scrub, - pauseDisabled: this.autoScrubber.isStopped() - }); - } - setDurations() { - setTimeout(()=>{ - const { props, state } = this; - const { totalTransition, staggerPercent, viewTransition } = state; - const stagger = totalTransition * staggerPercent / 100; - const { transitionDurations } = props; - transitionDurations.position = (totalTransition - stagger) * 1000; - transitionDurations.stagger = stagger * 1000; - transitionDurations.view = viewTransition * 1000; - syncTansitionDurations(props.explorer.viewer, transitionDurations); - props.changeSetup(null, false); - }); - } - render() { - const { props, state } = this; - const { explorer, transitionDurations, changeSetup } = props; - const sliderRef = (0, _base.base).react.createRef(); - explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = sliderRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransition - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - componentRef: sliderRef, - label: (0, _language.strings).labelTransitionScrubber, - min: 0, - max: 100, - valueFormat: (0, _language.strings).percentValueFormat, - value: state.scrub, - onChange: (scrub)=>{ - this.autoScrubber.stop(); - this.setScrubState(scrub); - } - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - title: (0, _language.strings).buttonTransitionReverse, - iconName: 'PlayReverseResume', - onClick: ()=>{ - this.autoScrubber.toggleScrubbing(-1); - if (state.scrub === 0) this.setState({ - scrub: 100 - }); - } - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - title: (0, _language.strings).buttonTransitionPause, - iconName: 'Pause', - onClick: ()=>{ - this.autoScrubber.togglePause(); - }, - disabled: state.pauseDisabled - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - title: (0, _language.strings).buttonTransitionPlay, - iconName: 'PlayResume', - onClick: ()=>{ - this.autoScrubber.toggleScrubbing(1); - if (state.scrub === 100) this.setState({ - scrub: 0 - }); - } - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransitionOptions - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelHoldCamera, - checked: explorer.state.holdCamera, - onChange: (e, holdCamera)=>{ - changeSetup({ - holdCamera - }, false); - } - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - label: (0, _language.strings).labelTransitionStaggerBy, - selectedKey: props.transitionType, - options: [ - { - key: 'ordinal', - text: (0, _language.strings).labelTransitionStaggerByOrdinal - }, - { - key: 'column', - text: (0, _language.strings).labelTransitionStaggerByColumn - }, - { - key: 'position', - text: (0, _language.strings).labelTransitionStaggerByPosition - } - ], - onChange: (e, o)=>{ - const transitionType = o.key; - changeSetup({ - transitionType - }, true); + } + const positions = [ + ["x", strings$1.labelAliasX], + ["y", strings$1.labelAliasY], + ["z", strings$1.labelAliasZ] + ]; + const autoScrubInterval = 50; + function _TransitionEditor(_props) { + class __TransitionEditor extends base$1.react.Component { + constructor(props) { + super(props); + this.state = Object.assign({ scrub: 100, pauseDisabled: true }, this.initialCalc(props.transitionDurations)); + this.autoScrubber = new AutoScrubber(autoScrubInterval, (direction, interval2) => { + const totalMs = this.state.totalTransition * 1e3; + const currentMs = this.state.scrub / 100 * totalMs; + const scrubMs = currentMs + direction * interval2; + let scrub = scrubMs / totalMs * 100; + if (direction < 0 && scrub <= 0) { + scrub = 0; + this.autoScrubber.stop(); + } + if (direction > 0 && scrub >= 100) { + scrub = 100; + this.autoScrubber.stop(); + } + this.setScrubState(scrub); + }); + } + initialCalc(transitionDurations) { + const totalTransition = (transitionDurations.position + transitionDurations.stagger) / 1e3; + const staggerPercent = transitionDurations.stagger === 0 ? 1 : transitionDurations.stagger / (totalTransition * 1e3) * 100; + const viewTransition = transitionDurations.view / 1e3; + return { totalTransition, staggerPercent, viewTransition }; + } + setScrubState(scrub) { + const { morphChartsRenderResult, morphchartsref } = this.props.explorer.viewer.presenter; + morphchartsref.core.renderer.transitionTime = scrub / 100; + morphChartsRenderResult.setTransitionTimeAxesVisibility(); + scrub = Math.round(scrub); + this.setState({ scrub, pauseDisabled: this.autoScrubber.isStopped() }); + } + setDurations() { + setTimeout(() => { + const { props, state } = this; + const { totalTransition, staggerPercent, viewTransition } = state; + const stagger = totalTransition * staggerPercent / 100; + const { transitionDurations } = props; + transitionDurations.position = (totalTransition - stagger) * 1e3; + transitionDurations.stagger = stagger * 1e3; + transitionDurations.view = viewTransition * 1e3; + syncTansitionDurations(props.explorer.viewer, transitionDurations); + props.changeSetup(null, false); + }); + } + render() { + const { props, state } = this; + const { explorer: explorer2, transitionDurations, changeSetup } = props; + const sliderRef = base$1.react.createRef(); + explorer2.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = sliderRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransition }, + base$1.react.createElement(base$1.fluentUI.Slider, { componentRef: sliderRef, label: strings$1.labelTransitionScrubber, min: 0, max: 100, valueFormat: strings$1.percentValueFormat, value: state.scrub, onChange: (scrub) => { + this.autoScrubber.stop(); + this.setScrubState(scrub); + } }), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, title: strings$1.buttonTransitionReverse, iconName: "PlayReverseResume", onClick: () => { + this.autoScrubber.toggleScrubbing(-1); + if (state.scrub === 0) { + this.setState({ scrub: 100 }); + } + } }), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, title: strings$1.buttonTransitionPause, iconName: "Pause", onClick: () => { + this.autoScrubber.togglePause(); + }, disabled: state.pauseDisabled }), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, title: strings$1.buttonTransitionPlay, iconName: "PlayResume", onClick: () => { + this.autoScrubber.toggleScrubbing(1); + if (state.scrub === 100) { + this.setState({ scrub: 0 }); + } + } }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransitionOptions }, + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelHoldCamera, checked: explorer2.state.holdCamera, onChange: (e, holdCamera) => { + changeSetup({ holdCamera }, false); + } }), + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { label: strings$1.labelTransitionStaggerBy, selectedKey: props.transitionType, options: [ + { + key: "ordinal", + text: strings$1.labelTransitionStaggerByOrdinal + }, + { + key: "column", + text: strings$1.labelTransitionStaggerByColumn + }, + { + key: "position", + text: strings$1.labelTransitionStaggerByPosition + } + ], onChange: (e, o) => { + const transitionType = o.key; + changeSetup({ transitionType }, true); + } }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransitionStaggerOptions }, + (() => { + switch (props.transitionType) { + case "column": { + return base$1.react.createElement(Dropdown$1, { collapseLabel: props.compactUI, label: strings$1.labelTransitionStaggerByColumn, options: getColumnOptions(props, props.transitionColumn.name), onChange: (e, o) => { + changeSetup({ transitionColumn: o.data }, true); + } }); } - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransitionStaggerOptions - }, (()=>{ - switch(props.transitionType){ - case 'column': - return (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.compactUI, - label: (0, _language.strings).labelTransitionStaggerByColumn, - options: getColumnOptions(props, props.transitionColumn.name), - onChange: (e, o)=>{ - changeSetup({ - transitionColumn: o.data - }, true); - } - }); - case 'position': - return (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.compactUI, - label: (0, _language.strings).labelTransitionStaggerByPosition, - options: positions.map(([key, text])=>{ - return { - key, - text, - selected: props.transitionDimension === key - }; - }), - onChange: (e, o)=>{ - changeSetup({ - transitionDimension: o.key - }, true); - } - }); + case "position": { + return base$1.react.createElement(Dropdown$1, { collapseLabel: props.compactUI, label: strings$1.labelTransitionStaggerByPosition, options: positions.map(([key2, text2]) => { + return { key: key2, text: text2, selected: props.transitionDimension === key2 }; + }), onChange: (e, o) => { + changeSetup({ transitionDimension: o.key }, true); + } }); } - })(), (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelTransitionStaggerReverse, - checked: props.transitionReverse, - onChange: (e, transitionReverse)=>changeSetup({ - transitionReverse - }, true) - })), (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelTransitionDurations - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelTransitionDuration, - onChange: (totalTransition)=>{ - this.setState({ - totalTransition - }); - this.setDurations(); - }, - min: 0, - max: 5, - step: 0.1, - value: state.totalTransition - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelTransitionStagger, - onChange: (staggerPercent)=>{ - this.setState({ - staggerPercent - }); - this.setDurations(); - }, - min: 0, - max: 100, - valueFormat: (0, _language.strings).percentValueFormat, - value: state.staggerPercent - }), (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - label: (0, _language.strings).labelTransitionCamera, - onChange: (viewTransition)=>{ - this.setState({ - viewTransition - }); - this.setDurations(); - }, - min: 0, - max: 5, - step: 0.1, - value: state.viewTransition - }), (0, _base.base).react.createElement((0, _button.Button), { - themePalette: props.themePalette, - onClick: ()=>{ - const defaults = (0, _sanddanceReact.SandDance).VegaMorphCharts.defaults.defaultPresenterConfig.transitionDurations; - const { position, stagger, view } = defaults; - transitionDurations.position = position; - transitionDurations.stagger = stagger; - transitionDurations.view = view; - this.setState(Object.assign({}, this.initialCalc(transitionDurations))); - this.setDurations(); - }, - text: (0, _language.strings).buttonResetToDefault - }))); - } + } + })(), + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.labelTransitionStaggerReverse, checked: props.transitionReverse, onChange: (e, transitionReverse) => changeSetup({ transitionReverse }, true) }) + ), + base$1.react.createElement( + Group$1, + { label: strings$1.labelTransitionDurations }, + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelTransitionDuration, onChange: (totalTransition) => { + this.setState({ totalTransition }); + this.setDurations(); + }, min: 0, max: 5, step: 0.1, value: state.totalTransition }), + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelTransitionStagger, onChange: (staggerPercent) => { + this.setState({ staggerPercent }); + this.setDurations(); + }, min: 0, max: 100, valueFormat: strings$1.percentValueFormat, value: state.staggerPercent }), + base$1.react.createElement(base$1.fluentUI.Slider, { label: strings$1.labelTransitionCamera, onChange: (viewTransition) => { + this.setState({ viewTransition }); + this.setDurations(); + }, min: 0, max: 5, step: 0.1, value: state.viewTransition }), + base$1.react.createElement(Button, { themePalette: props.themePalette, onClick: () => { + const defaults2 = defaultPresenterConfig.transitionDurations; + const { position: position2, stagger, view } = defaults2; + transitionDurations.position = position2; + transitionDurations.stagger = stagger; + transitionDurations.view = view; + this.setState(Object.assign({}, this.initialCalc(transitionDurations))); + this.setDurations(); + }, text: strings$1.buttonResetToDefault }) + ) + ); + } } return new __TransitionEditor(_props); -} -const TransitionEditor = _TransitionEditor; -function groupOptions(sectionName, columns, selectedKey) { - const options = columns.map((column)=>{ - const option = { - key: `column:${column.name}`, - text: column.name, - data: column, - selected: column.name === selectedKey - }; - return option; + } + const TransitionEditor = _TransitionEditor; + function groupOptions(sectionName, columns, selectedKey) { + const options2 = columns.map((column) => { + const option = { + key: `column:${column.name}`, + text: column.name, + data: column, + selected: column.name === selectedKey + }; + return option; }); - if (options.length) { - const option = { - key: sectionName, - text: sectionName, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; - options.unshift(option); - } - return options; -} -function getColumnOptions(props, selectedKey) { - const quantitativeGroup = groupOptions((0, _language.strings).selectNumeric, props.quantitativeColumns, selectedKey); - const categoricGroup = groupOptions((0, _language.strings).selectNonNumeric, props.categoricalColumns, selectedKey); + if (options2.length) { + const option = { + key: sectionName, + text: sectionName, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + options2.unshift(option); + } + return options2; + } + function getColumnOptions(props, selectedKey) { + const quantitativeGroup = groupOptions(strings$1.selectNumeric, props.quantitativeColumns, selectedKey); + const categoricGroup = groupOptions(strings$1.selectNonNumeric, props.categoricalColumns, selectedKey); return quantitativeGroup.concat(categoricGroup); -} -function getTransition(state) { - const reverse = state.transitionReverse; - switch(state.transitionType){ - case 'ordinal': - return { - type: 'ordinal', - reverse - }; - case 'column': - return { - type: 'column', - column: state.transitionColumn, - reverse - }; - case 'position': - return { - type: 'position', - dimension: state.transitionDimension, - reverse - }; + } + function getTransition(state) { + const reverse2 = state.transitionReverse; + switch (state.transitionType) { + case "ordinal": { + return { + type: "ordinal", + reverse: reverse2 + }; + } + case "column": { + return { + type: "column", + column: state.transitionColumn, + reverse: reverse2 + }; + } + case "position": { + return { + type: "position", + dimension: state.transitionDimension, + reverse: reverse2 + }; + } } -} -function syncTansitionDurations(viewer, transitionDurations) { - var _a, _b; - const config = (_b = (_a = viewer === null || viewer === void 0 ? void 0 : viewer.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.core.config; + } + function syncTansitionDurations(viewer, transitionDurations) { + var _a2, _b2; + const config = (_b2 = (_a2 = viewer === null || viewer === void 0 ? void 0 : viewer.presenter) === null || _a2 === void 0 ? void 0 : _a2.morphchartsref) === null || _b2 === void 0 ? void 0 : _b2.core.config; if (config) { - const { position, stagger } = transitionDurations; - config.transitionDuration = position; - config.transitionStaggering = stagger; + const { position: position2, stagger } = transitionDurations; + config.transitionDuration = position2; + config.transitionStaggering = stagger; } -} -class AutoScrubber { - constructor(interval, onInterval){ - this.interval = interval; - this.onInterval = onInterval; + } + class AutoScrubber { + constructor(interval2, onInterval) { + this.interval = interval2; + this.onInterval = onInterval; } getSignedInterval() { - return this.interval * this.direction; + return this.interval * this.direction; } toggleScrubbing(direction) { - if (this.isScrubbing() && direction === this.direction) this.pause(); - else this.start(direction); + if (this.isScrubbing() && direction === this.direction) { + this.pause(); + } else { + this.start(direction); + } } isPaused() { - return !this.isScrubbing() && this.direction !== undefined; + return !this.isScrubbing() && this.direction !== void 0; } isStopped() { - return !this.isScrubbing() && this.direction === undefined; + return !this.isScrubbing() && this.direction === void 0; } isScrubbing() { - return this.autoScrubTimer !== undefined; + return this.autoScrubTimer !== void 0; } togglePause() { - if (this.isScrubbing()) this.pause(); - else if (this.direction) this.start(this.direction); + if (this.isScrubbing()) { + this.pause(); + } else if (this.direction) { + this.start(this.direction); + } } start(direction) { - this.direction = direction; - if (!this.isScrubbing()) this.autoScrubTimer = setInterval(()=>this.onInterval(this.direction, this.interval), this.interval); + this.direction = direction; + if (!this.isScrubbing()) { + this.autoScrubTimer = setInterval(() => this.onInterval(this.direction, this.interval), this.interval); + } } pause() { - clearInterval(this.autoScrubTimer); - this.autoScrubTimer = undefined; + clearInterval(this.autoScrubTimer); + this.autoScrubTimer = void 0; } stop() { - this.pause(); - this.direction = undefined; - } -} - -},{"../base":"3TPz5","../controls/group":"afKlW","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","../controls/dropdown":"7pP8h","../controls/iconButton":"6pZiK","../controls/button":"f8wtc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cQRoj":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Explorer", ()=>Explorer); -var _base = require("./base"); -var _canvas = require("./canvas"); -var _clickableTextLayer = require("./clickableTextLayer"); -var _colorMap = require("./colorMap"); -var _colorScheme = require("./colorScheme"); -var _columns = require("./columns"); -var _dataScope = require("./controls/dataScope"); -var _dialog = require("./controls/dialog"); -var _iconButton = require("./controls/iconButton"); -var _sidebar = require("./controls/sidebar"); -var _topbar = require("./controls/topbar"); -var _dataLoader = require("./dataLoader"); -var _defaults = require("./defaults"); -var _chart = require("./dialogs/chart"); -var _color = require("./dialogs/color"); -var _dataBrowser = require("./dialogs/dataBrowser"); -var _history = require("./dialogs/history"); -var _search = require("./dialogs/search"); -var _settings = require("./dialogs/settings"); -var _snapshotEditor = require("./dialogs/snapshotEditor"); -var _snapshots = require("./dialogs/snapshots"); -var _transition = require("./dialogs/transition"); -var _interfaces = require("./interfaces"); -var _language = require("./language"); -var _mouseEvent = require("./mouseEvent"); -var _partialInsight = require("./partialInsight"); -var _themes = require("./themes"); -var _searchGroups = require("./searchGroups"); -var _chartRecommender = require("@msrvida/chart-recommender"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _renderer = require("./controls/renderer"); -var _backgroundImageEditor = require("./dialogs/backgroundImageEditor"); -function _Explorer(_props) { - class __Explorer extends (0, _base.base).react.Component { - constructor(props){ - super(props); - this.dialogFocusHandler = {}; - this.state = (0, _defaults.initialExplorerState)(props); - this.imageHolder = { - img: null, - backgroundImageColumnBounds: [], - showBackgroundImage: false - }; - this.snapshotThumbWidth = (0, _defaults.snapshotThumbWidth); - this.discardColorContextUpdates = true; - this.updateViewerOptions(Object.assign(Object.assign({}, (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone((0, _sanddanceReact.SandDance).Viewer.defaultViewerOptions)), props.viewerOptions)); - } - finalize() { - if (this.viewer) this.viewer.finalize(); - } - updateViewerOptions(viewerOptions) { - this.viewerOptions = Object.assign(Object.assign({}, (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge((0, _defaults.defaultViewerOptions), { - tooltipOptions: { - prepareDataItem: (item)=>{ - const ret = {}; - for(const columnName in item)if (this.state.tooltipExclusions.indexOf(columnName) < 0) ret[columnName] = item[columnName]; - return ret; - } - } - }, this.viewerOptions, viewerOptions)), { - onColorContextChange: ()=>this.manageColorToolbar(), - onDataFilter: (filter, filteredData)=>{ - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - selectedItemIndex[(0, _dataScope.DataScopeId).FilteredData] = 0; - this.changeInsight({ - filter - }, { - label: this.historicFilterChange, - omit: !this.historicFilterChange - }); - this.historicFilterChange = null; - this.setState({ - filteredData, - selectedItemIndex - }); - if (this.state.sideTabId === (0, _interfaces.SideTabId).Data && this.state.dataScopeId === (0, _dataScope.DataScopeId).FilteredData) //make sure item is active - requestAnimationFrame(()=>filteredData && this.silentActivation(filteredData[0])); - viewerOptions && viewerOptions.onDataFilter && viewerOptions.onDataFilter(filter, filteredData); - }, - onSelectionChanged: (newSearch, index, selectedData)=>{ - if (this.ignoreSelectionChange) return; - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - selectedItemIndex[(0, _dataScope.DataScopeId).SelectedData] = index || 0; - let { search } = this.state; - const { sideTabId } = this.state; - if (newSearch) search = (0, _searchGroups.createInputSearch)(newSearch); - this.setState({ - search, - selectedItemIndex, - sideTabId - }); - viewerOptions && viewerOptions.onSelectionChanged && viewerOptions.onSelectionChanged(newSearch, index, selectedData); - }, - onAxisClick: (e, search)=>{ - this.toggleableSearch(e, search); - viewerOptions && viewerOptions.onAxisClick && viewerOptions.onAxisClick(e, search); - }, - onLegendHeaderClick: (e)=>{ - const pos = (0, _mouseEvent.getPosition)(e); - const specRole = this.state.specCapabilities && this.state.specCapabilities.roles.filter((r)=>r.role === 'color')[0]; - const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { - collapseLabel: true, - container: this.div, - selectedColumnName: this.state.columns['color'], - onDismiss: ()=>{ - this.setState({ - positionedColumnMapProps: null - }); - }, - specRole, - left: pos.left - this.div.clientLeft, - top: pos.top - this.div.clientTop - }); - this.setState({ - positionedColumnMapProps - }); - }, - onLegendRowClick: (e, legendRow)=>{ - this.toggleableSearch(e, legendRow.search); - viewerOptions && viewerOptions.onLegendRowClick && viewerOptions.onLegendRowClick(e, legendRow); - }, - onError: (errors)=>{ - this.setState({ - errors - }); - viewerOptions && viewerOptions.onError && viewerOptions.onError(errors); - }, - onBeforeCreateLayers: (stage, specCapabilities)=>{ - (0, _clickableTextLayer.attachSpecRoleToAxisTitle)(stage, specCapabilities); - }, - getTextColor: (o)=>{ - if (o.specRole) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.clickableText); - else if (o.metaData && o.metaData.search) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.searchText); - else return o.color; - }, - getTextHighlightColor: (o)=>{ - if (o.specRole) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.clickableTextHighlight); - else if (o.metaData && o.metaData.search) return (0, _sanddanceReact.SandDance).VegaMorphCharts.util.colorFromString(this.viewerOptions.colors.searchTextHighlight); - else return [ - 0, - 0, - 0, - 0 - ]; - }, - onTextClick: (e, text)=>{ - if (e && text) { - const pos = (0, _mouseEvent.getPosition)(e); - const rect = this.viewer.element.getBoundingClientRect(); - pos.left += rect.left; - pos.top += rect.top; - const { specRole } = text; - if (pos && specRole) { - const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { - collapseLabel: true, - container: this.div, - selectedColumnName: this.state.columns[specRole.role], - onDismiss: ()=>{ - this.setState({ - positionedColumnMapProps: null - }); - }, - specRole, - left: pos.left, - top: pos.top - }); - this.setState({ - positionedColumnMapProps - }); - } else this.setState({ - positionedColumnMapProps: null - }); - } - }, - onNewViewStateTarget: ()=>this.newViewStateTarget - }); - if (this.viewer && this.viewer.presenter) { - const newPresenterStyle = (0, _sanddanceReact.SandDance).util.getPresenterStyle(this.viewerOptions); - const mergePrenterStyle = Object.assign(Object.assign({}, this.viewer.presenter.style), newPresenterStyle); - this.viewer.presenter.style = mergePrenterStyle; - this.viewer.options = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge(this.viewer.options, this.props.viewerOptions, this.viewerOptions); - } - } - signal(signalName, signalValue, newViewStateTarget) { - switch(signalName){ - case (0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount: - case (0, _sanddanceReact.SandDance).constants.SignalNames.ColorReverse: - case (0, _sanddanceReact.SandDance).constants.SignalNames.MarkOpacity: - this.discardColorContextUpdates = false; - break; - } - this.newViewStateTarget = newViewStateTarget; - this.viewer.vegaViewGl.signal(signalName, signalValue); - this.viewer.vegaViewGl.runAsync().then(()=>{ - //deeply set the state without a state change. This prevents a redraw if re-rendered - if (this.state.signalValues) this.state.signalValues[signalName] = signalValue; - this.discardColorContextUpdates = true; - this.newViewStateTarget = undefined; - this.props.onSignalChanged && this.props.onSignalChanged(signalName, signalValue); - }); - } - manageColorToolbar() { - const canRemap = this.viewer.colorContexts && this.viewer.colorContexts.length > 1; - (0, _colorMap.applyColorButtons)(this.viewer.presenter, !!this.state.columns.color, { - themePalette: (0, _themes.themePalettes)[this.props.theme || ''], - canRemap, - isRemap: canRemap && this.viewer.currentColorContext > 0, - colorMapHandler: (remap)=>{ - this.viewer.currentColorContext = ~~remap; - this.viewer.renderSameLayout(); - this.manageColorToolbar(); - } - }); - } - getInsight() { - return this.viewer.getInsight(); - } - getSetup() { - return { - camera: this.state.holdCamera ? 'hold' : this.state.camera, - renderer: this.state.renderer, - transition: (0, _transition.getTransition)(this.state), - transitionDurations: this.state.transitionDurations - }; - } - setSetup(setup, newState) { - newState.camera = undefined; - if (setup) { - this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(setup); - const { camera, renderer, transition, transitionDurations } = setup; - newState.renderer = renderer; - newState.transitionType = transition.type; - if (camera === 'hold') newState.holdCamera = true; - else { - newState.holdCamera = false; - newState.camera = camera; - } - if (transition.type === 'column') newState.transitionColumn = transition.column; - else if (transition.type === 'position') newState.transitionDimension = transition.dimension; - if (transitionDurations) { - newState.transitionDurations = transitionDurations; - (0, _transition.syncTansitionDurations)(this.viewer, transitionDurations); - } - } - } - setInsight(historyAction, newState = {}, partialInsight = this.viewer.getInsight(), rebaseFilter, setup) { - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - (0, _dataScope.resetSelectedItemIndex)(selectedItemIndex); - const historicInsight = Object.assign({ - chart: null, - scheme: null, - columns: null, - filter: null, - rebaseFilter - }, partialInsight); - const state = Object.assign({ - filteredData: null, - selectedItemIndex, - search: (0, _searchGroups.createInputSearch)(historicInsight.filter) - }, newState); - const changeInsight = ()=>{ - this.getColorContext = null; - this.setSetup(setup, historicInsight); - this.changeInsight(historicInsight, historyAction, state, setup); - }; - const currentFilter = this.viewer.getInsight().filter; - if (rebaseFilter && currentFilter && historicInsight.filter) { - if ((0, _sanddanceReact.SandDance).searchExpression.startsWith(historicInsight.filter, currentFilter)) changeInsight(); - else { - const { transitionDurations } = this.state; - const renderTime = transitionDurations.position + transitionDurations.stagger; - const allowAsyncRenderTime = renderTime + this.viewerOptions.filterRenderingTimerPadding; - this.viewer.reset().then(()=>new Promise((resolve, reject)=>{ - setTimeout(resolve, allowAsyncRenderTime); - })).then(changeInsight); - } - } else changeInsight(); - } - handleReviveSnapshot(snapshot, selectedSnapshotIndex) { - let handled = false; - if (this.props.onSnapshotClick) { - this.setState({ - selectedSnapshotIndex - }); - handled = this.props.onSnapshotClick(snapshot, selectedSnapshotIndex); - } - if (!handled) this.reviveSnapshot(selectedSnapshotIndex); - } - reviveSnapshot(snapshotOrIndex) { - if (typeof snapshotOrIndex === 'number') { - const selectedSnapshotIndex = snapshotOrIndex; - const snapshot = this.state.snapshots[selectedSnapshotIndex]; - const newState = { - note: snapshot.description, - selectedSnapshotIndex - }; - if (!this.state.sidebarClosed) { - newState.sideTabId = (0, _interfaces.SideTabId).Snapshots; - this.scrollSnapshotIntoView(selectedSnapshotIndex); - } - if (snapshot.insight) { - const { backgroundImage } = snapshot.insight; - this.imageHolder.showBackgroundImage = !!backgroundImage; - if (backgroundImage) this.imageHolder.img = { - src: backgroundImage.url, - height: backgroundImage.size.height, - width: backgroundImage.size.width - }; - } - this.setInsight({ - label: (0, _language.strings).labelHistoryReviveSnapshot - }, newState, snapshot.insight, true, snapshot.setup); - } else { - const snapshot = snapshotOrIndex; - if (snapshot.insight) this.setInsight({ - label: (0, _language.strings).labelHistoryReviveSnapshot - }, { - note: snapshot.description, - selectedSnapshotIndex: -1 - }, snapshot.insight, true, snapshot.setup); //don't navigate to sideTab - else this.setState({ - note: snapshot.description, - selectedSnapshotIndex: -1 - }); - } - } - load(data, getPartialInsight, optionsOrPrefs) { - this.setState({ - historyIndex: -1, - historyItems: [] - }); - this.changeInsight({ - columns: null - }, { - label: null, - omit: true - }, { - note: null - }); - return new Promise((resolve, reject)=>{ - const loadFinal = (dataContent)=>{ - let partialInsight; - this.prefs = optionsOrPrefs && optionsOrPrefs.chartPrefs || optionsOrPrefs || {}; - this.imageHolder.backgroundImageColumnBounds = (0, _columns.getBackgroundImageColumnBounds)(dataContent.columns); - if (getPartialInsight) { - partialInsight = getPartialInsight(dataContent.columns); - (0, _partialInsight.initPrefs)(this.prefs, partialInsight); - } - if (!partialInsight) { - //load recommendation - const r = new (0, _chartRecommender.RecommenderSummary)(dataContent.columns, dataContent.data); - partialInsight = r.recommend(); - } - partialInsight = Object.assign({ - facetStyle: 'wrap', - filter: null, - totalStyle: null, - transform: null - }, partialInsight); - if (partialInsight.chart === 'barchart') partialInsight.chart = 'barchartV'; - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - const sideTabId = (0, _interfaces.SideTabId).ChartType; - (0, _dataScope.resetSelectedItemIndex)(selectedItemIndex); - const newState = Object.assign({ - camera: undefined, - columns: {}, - dataFile, - dataContent, - snapshots: dataContent.snapshots || this.state.snapshots, - autoCompleteDistinctValues: {}, - filteredData: null, - tooltipExclusions: optionsOrPrefs && optionsOrPrefs.tooltipExclusions || [], - selectedItemIndex, - sideTabId - }, partialInsight); - this.getColorContext = null; - (0, _columns.ensureColumnsExist)(newState.columns, dataContent.columns, newState.transform); - const errors = (0, _columns.ensureColumnsPopulated)(partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.chart, partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.totalStyle, newState.columns, dataContent.columns); - newState.errors = errors; - newState.transitionColumn = dataContent.columns[0]; - const setup = optionsOrPrefs && optionsOrPrefs.setup; - this.setSetup(setup, newState); - //change insight - this.changeInsight(partialInsight, { - label: (0, _language.strings).labelHistoryInit, - insert: true - }, newState, optionsOrPrefs && optionsOrPrefs.setup); - //make sure item is active - this.activateDataBrowserItem(sideTabId, this.state.dataScopeId); - resolve(); - }; - let dataFile; - if (Array.isArray(data)) return (0, _dataLoader.loadDataArray)(data, 'json', optionsOrPrefs && optionsOrPrefs.columnTypes).then((result)=>{ - dataFile = { - type: 'json' - }; - loadFinal(result); - }).catch(reject); - else { - dataFile = data; - return (0, _dataLoader.loadDataFile)(dataFile, optionsOrPrefs && optionsOrPrefs.columnTypes).then(loadFinal).catch(reject); - } - }); - } - changeChartType(chart) { - const partialInsight = Object.assign({}, (0, _partialInsight.copyPrefToNewState)(this.prefs, chart, '*', '*')); - const insight = Object.assign({ - chart - }, partialInsight); - const columns = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, partialInsight.columns, this.state.columns); - const { signalValues } = this.viewer.getInsight(); - insight.signalValues = Object.assign(Object.assign({}, this.state.signalValues), signalValues); - insight.columns = Object.assign({}, columns); - insight.totalStyle = this.state.totalStyle; - let errors; - //special case mappings when switching chart type - if (this.state.chart === 'scatterplot' && (chart === 'barchart' || chart === 'barchartV')) insight.columns = Object.assign(Object.assign({}, columns), { - sort: columns.y - }); - else if (this.state.chart === 'scatterplot' && chart === 'barchartH') insight.columns = Object.assign(Object.assign({}, columns), { - sort: columns.x - }); - else if (chart === 'treemap') { - insight.view = '2d'; - if (!columns.size) { - //make sure size exists and is numeric - let sizeColumn; - //first check prefs - if (partialInsight && partialInsight.columns && partialInsight.columns.size) { - const prefSizeColumn = this.state.dataContent.columns.filter((c)=>c.name === partialInsight.columns.size)[0]; - if (prefSizeColumn && prefSizeColumn.quantitative) sizeColumn = prefSizeColumn; - } - if (!sizeColumn) sizeColumn = (0, _columns.getTreemapColumn)(this.state.dataContent.columns); - if (!sizeColumn) //error - no numeric columns - errors = [ - (0, _language.strings).errorColumnMustBeNumeric - ]; - else insight.columns = Object.assign(Object.assign({}, columns), { - size: sizeColumn.name - }); - } - } else if (chart === 'stacks') insight.view = '3d'; - (0, _columns.ensureColumnsExist)(insight.columns, this.state.dataContent.columns, this.state.transform); - errors = (0, _columns.ensureColumnsPopulated)(chart, insight.totalStyle, insight.columns, this.state.dataContent.columns); - this.calculate(()=>{ - this.changeInsight(insight, { - label: (0, _language.strings).labelHistoryChangeChartType((0, _chart.chartLabel)(chart)) - }, errors ? { - errors, - camera: undefined - } : { - camera: undefined - }); - }); - return insight.columns; - } - calculate(calculating) { - this.setState({ - calculating - }); - } - changeView(view) { - this.changeInsight({ - view - }, { - label: view === '2d' ? (0, _language.strings).labelViewType2d : (0, _language.strings).labelViewType3d - }); - } - //state members which change the insight - changeInsight(partialInsight, historyAction, additionalUIState, historicSetup) { - if (!partialInsight.signalValues) partialInsight.signalValues = null; - if (partialInsight.chart === 'barchart') partialInsight.chart = 'barchartV'; - this.addHistory(Object.assign(Object.assign({}, partialInsight), { - historicSetup - }), historyAction, additionalUIState); - } - addHistory(historicInsight, historyAction, additionalUIState) { - const setCleanState = (newState)=>{ - const cleanState = Object.assign(Object.assign({}, newState), additionalUIState); - if (!cleanState.note) cleanState.note = null; - delete cleanState.rebaseFilter; - if (this.viewer) { - const { signalValues } = this.viewer.getInsight(); - cleanState.signalValues = Object.assign(Object.assign(Object.assign({}, this.state.signalValues), signalValues), cleanState.signalValues); - } - this.setState(cleanState); - }; - if (historyAction.omit) { - setCleanState(historicInsight); - return; - } - const historyItems = this.state.historyItems.slice(0, this.state.historyIndex + 1); - const historyIndex = historyItems.length; - historyItems.push({ - label: historyAction.label, - historicInsight - }); - if (historyAction.insert) setCleanState({ - historyIndex, - historyItems - }); - else setCleanState(Object.assign(Object.assign({}, historicInsight), { - historyIndex, - historyItems - })); - } - replay(index) { - return (0, _history.replay)(this.state.historyItems, index); - } - undo() { - const historyIndex = this.state.historyIndex - 1; - if (historyIndex < 0) return; - this.doReplay(historyIndex); - } - redo(historyIndex = this.state.historyIndex + 1) { - if (historyIndex >= this.state.historyItems.length) return; - this.doReplay(historyIndex); - } - doReplay(historyIndex) { - const newState = this.replay(historyIndex); - this.rebaseFilter = true; - this.setSetup(newState.historicSetup, newState); - this.setState(Object.assign(Object.assign({}, newState), { - historyIndex - })); - } - changespecCapabilities(specCapabilities) { - this.setState({ - specCapabilities - }); - } - changeColumnMapping(role, column, options) { - const columns = Object.assign({}, this.state.columns); - const label = column ? (0, _language.strings).labelHistoryMapColumn(role) : (0, _language.strings).labelHistoryUnMapColumn(role); - const final = ()=>{ - const partialInsight = { - columns, - totalStyle: options ? options.totalStyle : this.state.totalStyle - }; - const errors = (0, _columns.ensureColumnsPopulated)(this.state.chart, partialInsight.totalStyle, partialInsight.columns, this.state.dataContent.columns); - columns[role] = column && column.name; - this.changeInsight(partialInsight, { - label - }, errors ? { - errors, - camera: this.viewer.getCamera() - } : { - camera: this.viewer.getCamera() - }); - }; - const _changeInsight = (newInsight, columnUpdate, historyAction)=>{ - newInsight.columns = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, columns, columnUpdate); - (0, _partialInsight.savePref)(this.prefs, this.state.chart, '*', '*', { - columns: columnUpdate - }); - this.changeInsight(newInsight, historyAction, { - camera: this.viewer.getCamera() - }); - }; - if (column) { - let columnUpdate; - switch(role){ - case 'facet': - { - (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'facet', column.name); - const historicInsight = { - columns, - facetStyle: options ? options.facetStyle : this.state.facetStyle - }; - columnUpdate = { - facet: column.name - }; - _changeInsight(historicInsight, columnUpdate, { - label - }); - break; - } - case 'color': - { - let calculating = null; - const historicInsight = { - scheme: options && options.scheme, - columns, - colorBin: this.state.colorBin - }; - if (!historicInsight.scheme) (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'color', column.name); - if (!historicInsight.scheme) historicInsight.scheme = (0, _colorScheme.bestColorScheme)(column, null, this.state.scheme); - if (!column.stats.hasColorData) { - historicInsight.directColor = false; - if (this.state.directColor !== historicInsight.directColor) calculating = ()=>this._resize(); - } - if (this.state.columns && this.state.columns.color && this.state.columns.color !== column.name) { - const currColorColumn = this.state.dataContent.columns.filter((c)=>c.name === this.state.columns.color)[0]; - if (column.isColorData != currColorColumn.isColorData) calculating = ()=>this._resize(); - } - this.ignoreSelectionChange = true; - this.viewer.deselect().then(()=>{ - this.ignoreSelectionChange = false; - //allow deselection to render - requestAnimationFrame(()=>{ - columnUpdate = { - color: column.name - }; - this.getColorContext = null; - this.setState({ - calculating - }); - _changeInsight(historicInsight, columnUpdate, { - label - }); - }); - }); - break; - } - case 'x': - { - (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'x', column.name); - const historicInsight = { - columns - }; - columnUpdate = { - x: column.name - }; - _changeInsight(historicInsight, columnUpdate, { - label - }); - break; - } - case 'size': - { - (0, _partialInsight.copyPrefToNewState)(this.prefs, this.state.chart, 'size', column.name); - const historicInsight = { - totalStyle: options ? options.totalStyle : this.state.totalStyle - }; - columnUpdate = { - size: column.name - }; - _changeInsight(historicInsight, columnUpdate, { - label - }); - break; - } - default: - final(); - break; - } - } else switch(role){ - case 'facet': - columns.facet = null; - columns.facetV = null; - this.changeInsight({ - columns, - facetStyle: 'wrap' - }, { - label - }); - break; - default: - final(); - break; - } - } - setSideTabId(sideTabId, dataScopeId) { - if (sideTabId === (0, _interfaces.SideTabId).Data && dataScopeId == null) //choose most relevant DataScopeId - dataScopeId = this.getBestDataScopeId(); - if (dataScopeId == null) dataScopeId = this.state.dataScopeId; - const calculating = ()=>{ - this.dialogFocusHandler.focus && this.dialogFocusHandler.focus(); - }; - this.setState({ - sideTabId, - dataScopeId, - sidebarClosed: false, - calculating - }); - this.activateDataBrowserItem(sideTabId, dataScopeId); - } - getBestDataScopeId() { - let dataScopeId; - const selectionState = this.viewer && this.viewer.getSelection(); - if (selectionState && selectionState.selectedData && selectionState.selectedData.length) dataScopeId = (0, _dataScope.DataScopeId).SelectedData; - else if (this.state.filteredData) dataScopeId = (0, _dataScope.DataScopeId).FilteredData; - else dataScopeId = (0, _dataScope.DataScopeId).AllData; - return dataScopeId; - } - activateDataBrowserItem(sideTabId, dataScopeId) { - if (!this.viewer) return; - let itemToActivate; - if (sideTabId === (0, _interfaces.SideTabId).Data) switch(dataScopeId){ - case (0, _dataScope.DataScopeId).AllData: - itemToActivate = this.state.dataContent && this.state.dataContent.data[this.state.selectedItemIndex[(0, _dataScope.DataScopeId).AllData]]; - break; - case (0, _dataScope.DataScopeId).FilteredData: - itemToActivate = this.state.filteredData && this.state.filteredData[this.state.selectedItemIndex[(0, _dataScope.DataScopeId).FilteredData]]; - break; - case (0, _dataScope.DataScopeId).SelectedData: - { - const selection = this.viewer.getSelection() || {}; - itemToActivate = selection.selectedData && selection.selectedData[this.state.selectedItemIndex[(0, _dataScope.DataScopeId).SelectedData]]; - break; - } - } - this.silentActivation(itemToActivate); - } - silentActivation(itemToActivate) { - this.ignoreSelectionChange = true; - const done = ()=>{ - this.ignoreSelectionChange = false; - }; - if (itemToActivate) return this.viewer.activate(itemToActivate).then(done); - else return this.viewer.deActivate().then(done); - } - sidebar(sidebarClosed, sidebarPinned) { - this.setState({ - sidebarClosed, - sidebarPinned - }); - } - resize() { - this.setState({ - calculating: ()=>this._resize() - }); - } - _resize() { - this.changeInsight({ - size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed) - }, { - label: 'resize', - omit: true - }); - } - viewerMounted(glDiv) { - this.setState({ - size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed), - signalValues: this.state.signalValues - }); - } - getLayoutDivSize(pinned, closed) { - const div = pinned && !closed ? this.layoutDivPinned : this.layoutDivUnpinned; - return { - height: div.offsetHeight, - width: div.offsetWidth - }; - } - toggleableSearch(e, search) { - if (e.ctrlKey) { - this.setState({ - search: (0, _searchGroups.createInputSearch)(search) - }); - this.setSideTabId((0, _interfaces.SideTabId).Search); - } else { - const oldSelection = this.viewer.getSelection(); - if (oldSelection.search) { - //look for matching groups and toggle them - const result = (0, _searchGroups.compareGroups)((0, _sanddanceReact.SandDance).searchExpression.ensureSearchExpressionGroupArray(oldSelection.search), search); - if (result.found) { - //removing a group - if (result.groups.length === 0) this.doDeselect(); - else //select with new search removed - this.doSelect(result.groups); - } else //adding a new group - if (e.altKey || e.shiftKey) { - let group = true; - if (e.altKey) search.clause = '&&'; - else if (e.shiftKey) { - if (this.props.searchORDisabled) group = false; - else search.clause = '||'; - } - if (group) { - result.groups.push(search); - this.doSelect(result.groups); - } else this.doSelect(search); - } else //replace - this.doSelect(search); - } else this.doSelect(search); - } - } - doFilter(search, historicFilterChange) { - this.historicFilterChange = historicFilterChange; - this.viewer.filter(search); - } - doUnfilter(historicFilterChange) { - this.historicFilterChange = historicFilterChange; - this.viewer.reset(); - } - doSelect(search) { - return this.viewer.select(search); - } - doDeselect() { - return this.viewer.deselect(); - } - writeSnapshot(snapshot, editIndex) { - let { selectedSnapshotIndex } = this.state; - let snapshots; - if (editIndex >= 0) { - snapshots = [ - ...this.state.snapshots - ]; - snapshots[editIndex] = snapshot; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - } else { - const note = snapshot.description; - snapshots = this.state.snapshots.concat(snapshot); - selectedSnapshotIndex = snapshots.length - 1; - this.scrollSnapshotIntoView(selectedSnapshotIndex); - this.setState({ - sideTabId: (0, _interfaces.SideTabId).Snapshots, - snapshots, - selectedSnapshotIndex, - note - }); - } - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - } - scrollSnapshotIntoView(selectedSnapshotIndex) { - clearTimeout(this.scrollSnapshotTimer); - if (this.state.sidebarClosed) return; - this.scrollSnapshotTimer = setTimeout(()=>{ - const selectedSnapshotElement = this.div.querySelector(`.snapshot:nth-child(${selectedSnapshotIndex + 1})`); - if (selectedSnapshotElement) selectedSnapshotElement.scrollIntoView({ - behavior: 'smooth', - block: 'nearest' - }); - }, 500); - } - componentDidMount() { - if (this.props.mounted) this.props.mounted(this); - } - render() { - var _a, _b, _c; - const insight = (0, _history.getPureInsight)(this.state); - const loaded = !!(insight.columns && this.state.dataContent); - if (loaded) (0, _backgroundImageEditor.setInsightBackgroundImage)(insight, this.imageHolder, this.state.columns); - const selectionState = this.viewer && this.viewer.getSelection() || {}; - const selectionSearch = selectionState && selectionState.search; - const columnMapProps = this.getColumnMapBaseProps(); - const datas = {}; - datas[(0, _dataScope.DataScopeId).AllData] = this.state.dataContent && this.state.dataContent.data; - datas[(0, _dataScope.DataScopeId).FilteredData] = this.state.filteredData; - datas[(0, _dataScope.DataScopeId).SelectedData] = selectionState && selectionState.selectedData; - if (this.state.calculating) requestAnimationFrame(()=>{ - //allow render to complete - if (this.state.calculating) { - this.state.calculating(); - this.setState({ - calculating: null - }); - } - }); - const theme = this.props.theme || ''; - const themePalette = (0, _themes.themePalettes)[theme]; - let renderOptions; - if (loaded) renderOptions = Object.assign(Object.assign({}, this.props.renderOptions), { - rebaseFilter: ()=>this.rebaseFilter, - initialColorContext: this.getColorContext && this.getColorContext(this.viewer.insight, insight), - discardColorContextUpdates: ()=>this.discardColorContextUpdates, - columns: (_a = this.state.dataContent) === null || _a === void 0 ? void 0 : _a.columns - }); - return (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div) this.div = div; - }, - className: (0, _sanddanceReact.util).classList('sanddance-explorer', this.props.theme) - }, (0, _base.base).react.createElement((0, _topbar.Topbar), { - collapseLabels: this.props.compactUI, - historyIndex: this.state.historyIndex, - historyItems: this.state.historyItems, - undo: ()=>this.undo(), - redo: ()=>this.redo(), - logoClickUrl: this.props.logoClickUrl, - logoClickTarget: this.props.logoClickTarget, - themePalette: themePalette, - loaded: loaded, - doDeselect: this.doDeselect.bind(this), - doFilter: this.doFilter.bind(this), - doUnfilter: this.doUnfilter.bind(this), - filter: this.state.filter, - selectionSearch: selectionSearch, - selectionState: selectionState, - buttons: this.props.topBarButtonProps, - iconButtons: this.props.topBarIconButtonProps, - view: this.state.view, - snapshotsHidden: (_b = this.props.snapshotProps) === null || _b === void 0 ? void 0 : _b.hidden, - snapshots: this.state.snapshots, - onSnapshotPreviousClick: ()=>{ - let selectedSnapshotIndex; - if (this.state.selectedSnapshotIndex === -1) selectedSnapshotIndex = this.state.snapshots.length - 1; - else { - selectedSnapshotIndex = this.state.selectedSnapshotIndex; - selectedSnapshotIndex--; - if (selectedSnapshotIndex < 0) selectedSnapshotIndex = this.state.snapshots.length - 1; - } - this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); - }, - onSnapshotClick: ()=>this.snapshotEditor.editSnapshot(), - onSnapshotNextClick: ()=>{ - let selectedSnapshotIndex; - if (this.state.selectedSnapshotIndex === -1) selectedSnapshotIndex = 0; - else { - selectedSnapshotIndex = this.state.selectedSnapshotIndex; - selectedSnapshotIndex++; - if (selectedSnapshotIndex > this.state.snapshots.length - 1) selectedSnapshotIndex = 0; - } - this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); - }, - onViewClick: ()=>{ - const view = this.state.view === '2d' ? '3d' : '2d'; - this.changeInsight({ - view - }, { - label: view === '2d' ? (0, _language.strings).labelViewType2d : (0, _language.strings).labelViewType3d - }); - } - }), (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-main', this.state.sidebarPinned && 'pinned', this.state.sidebarClosed && 'closed', (insight.hideLegend || insight.directColor || !(0, _columns.colorMapping)(insight, this.state.dataContent && this.state.dataContent.columns)) && 'hide-legend') - }, (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div && !this.layoutDivUnpinned) this.layoutDivUnpinned = div; - }, - className: "sanddance-layout-unpinned" - }), (0, _base.base).react.createElement("div", { - ref: (div)=>{ - if (div && !this.layoutDivPinned) this.layoutDivPinned = div; - }, - className: "sanddance-layout-pinned" - }), !loaded && (0, _base.base).react.createElement("div", { - className: "loading" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Spinner, { - size: (0, _base.base).fluentUI.SpinnerSize.large, - label: (0, _language.strings).loading - })), (0, _base.base).react.createElement((0, _sidebar.Sidebar), { - themePalette: themePalette, - calculating: !!this.state.calculating, - closed: this.state.sidebarClosed, - hideSidebarControls: this.props.hideSidebarControls, - snapshotsHidden: (_c = this.props.snapshotProps) === null || _c === void 0 ? void 0 : _c.hidden, - pinned: this.state.sidebarPinned, - disabled: !loaded, - dataScopeProps: { - themePalette, - compact: this.state.sidebarClosed, - onCompactClick: ()=>{ - this.changeInsight({ - size: this.getLayoutDivSize(this.state.sidebarPinned, false) - }, { - label: null, - omit: true - }, { - sidebarClosed: false - }); - }, - dataSet: this.props.datasetElement, - dataCount: loaded && { - all: this.state.dataContent && this.state.dataContent.data.length, - filtered: this.state.filteredData && this.state.filteredData.length, - selected: selectionState && selectionState.selectedData && selectionState.selectedData.length - }, - active: this.state.sideTabId === (0, _interfaces.SideTabId).Data, - onDataScopeClick: (dataScopeId)=>this.setSideTabId((0, _interfaces.SideTabId).Data, dataScopeId), - selectedDataScope: this.state.dataScopeId, - disabled: !loaded - }, - onSideTabClick: (sideTabId)=>{ - //collapse or toggle - if (sideTabId === (0, _interfaces.SideTabId).Collapse || this.state.sideTabId === sideTabId) { - let { dataScopeId, sidebarClosed } = this.state; - if (sidebarClosed && sideTabId === (0, _interfaces.SideTabId).Data) dataScopeId = this.getBestDataScopeId(); - sidebarClosed = !this.state.sidebarClosed; - this.changeInsight({ - size: this.getLayoutDivSize(this.state.sidebarPinned, sidebarClosed) - }, { - label: null, - omit: true - }, { - dataScopeId, - sidebarClosed - }); - } else if (sideTabId === (0, _interfaces.SideTabId).Pin) this.changeInsight({ - size: this.getLayoutDivSize(!this.state.sidebarPinned, this.state.sidebarClosed) - }, { - label: null, - omit: true - }, { - sidebarPinned: !this.state.sidebarPinned - }); - else this.setSideTabId(sideTabId); - }, - selectedSideTab: this.state.sideTabId - }, loaded && (()=>{ - switch(this.state.sideTabId){ - case (0, _interfaces.SideTabId).ChartType: - return (0, _base.base).react.createElement((0, _chart.Chart), Object.assign({ - themePalette: themePalette, - collapseLabels: this.props.compactUI, - tooltipExclusions: this.state.tooltipExclusions, - toggleTooltipExclusion: (columnName)=>{ - const tooltipExclusions = [ - ...this.state.tooltipExclusions - ]; - const i = tooltipExclusions.indexOf(columnName); - if (i < 0) tooltipExclusions.push(columnName); - else tooltipExclusions.splice(i, 1); - this.setState({ - tooltipExclusions - }); - this.props.onTooltipExclusionsChanged && this.props.onTooltipExclusionsChanged(tooltipExclusions); - }, - disabled: !loaded || this.state.sidebarClosed - }, columnMapProps, { - chart: this.state.chart, - view: this.state.view, - insightColumns: this.state.columns, - onChangeSignal: (role, column, name, value)=>(0, _partialInsight.saveSignalValuePref)(this.prefs, this.state.chart, role, column, name, value) - })); - case (0, _interfaces.SideTabId).Color: - return (0, _base.base).react.createElement((0, _color.Color), Object.assign({ - compactUI: this.props.compactUI, - specCapabilities: this.state.specCapabilities, - disabled: !loaded || this.state.sidebarClosed - }, columnMapProps, { - dataContent: this.state.dataContent, - scheme: this.state.scheme, - colorBin: this.state.colorBin, - colorBinSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s)=>s.name === (0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount)[0], - colorReverseSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s)=>s.name === (0, _sanddanceReact.SandDance).constants.SignalNames.ColorReverse)[0], - colorColumn: this.state.columns.color, - onColorBinChange: (colorBin)=>{ - this.ignoreSelectionChange = true; - this.viewer.deselect().then(()=>{ - this.ignoreSelectionChange = false; - //allow deselection to render - requestAnimationFrame(()=>{ - this.getColorContext = null; - this.changeInsight({ - colorBin - }, { - label: (0, _language.strings).labelHistoryColorBin - }); - (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, { - colorBin - }); - }); - }); - }, - onColorSchemeChange: (scheme)=>{ - this.changeColumnMapping('color', this.state.dataContent.columns.filter((c)=>c.name === this.state.columns.color)[0], { - scheme - }); - (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, { - scheme - }); - }, - onColorBinCountChange: (value)=>{ - const signalValues = {}; - signalValues[(0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount] = value; - (0, _partialInsight.savePref)(this.prefs, this.state.chart, 'color', this.state.columns.color, { - signalValues - }); - }, - onColorReverseChange: (value)=>{ - this.getColorContext = null; - }, - directColor: this.state.directColor, - onDirectColorChange: (directColor)=>{ - this.changeInsight({ - directColor - }, { - label: (0, _language.strings).labelHistoryDirectColor - }, { - calculating: ()=>this._resize() - }); - } - })); - case (0, _interfaces.SideTabId).Data: - { - const data = datas[this.state.dataScopeId]; - let itemVisible = true; - switch(this.state.dataScopeId){ - case (0, _dataScope.DataScopeId).AllData: - { - const item = this.state.selectedItemIndex[this.state.dataScopeId]; - itemVisible = this.state.dataContent && !this.state.filteredData || this.state.filteredData.indexOf(data[item]) >= 0; - } - } - return (0, _base.base).react.createElement((0, _dataBrowser.DataBrowser), { - explorer: this, - theme: this.props.theme, - themePalette: themePalette, - disabled: !loaded || this.state.sidebarClosed, - columns: this.state.dataContent && this.state.dataContent.columns, - categoricalColumns: columnMapProps.categoricalColumns, - quantitativeColumns: columnMapProps.quantitativeColumns, - data: data, - displayName: this.state.dataFile && this.state.dataFile.displayName || (0, _language.strings).defaultFileName, - nullMessage: (0, _dataBrowser.dataBrowserNullMessages)[this.state.dataScopeId], - zeroMessage: (0, _dataBrowser.dataBrowserZeroMessages)[this.state.dataScopeId], - index: this.state.selectedItemIndex[this.state.dataScopeId], - itemVisible: itemVisible, - dataExportHandler: this.props.dataExportHandler, - selectedDataScope: this.state.dataScopeId, - onDataScopeClick: (dataScopeId)=>this.setSideTabId((0, _interfaces.SideTabId).Data, dataScopeId), - onActivate: (row, index)=>{ - const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); - selectedItemIndex[this.state.dataScopeId] = index; - this.setState({ - selectedItemIndex - }); - this.silentActivation(row); - }, - onSearch: (e, search)=>{ - if (e.ctrlKey) this.setState({ - sideTabId: (0, _interfaces.SideTabId).Search, - search - }); - else this.doSelect(search); - }, - bingSearchDisabled: this.props.bingSearchDisabled, - onUpdateColumnTypes: (columnTypes)=>{ - this.load(this.state.dataFile, null, { - prefs: this.prefs, - columnTypes - }); - } - }); - } - case (0, _interfaces.SideTabId).Search: - return (0, _base.base).react.createElement((0, _search.Search), { - explorer: this, - collapseLabels: this.props.compactUI, - themePalette: themePalette, - disabled: !loaded || this.state.sidebarClosed, - disableGroupOR: this.props.searchORDisabled, - disableExpressionOR: this.props.searchORDisabled, - initializer: { - columns: columnMapProps.allColumns, - search: this.state.search - }, - autoCompleteDistinctValues: this.state.autoCompleteDistinctValues, - onSelect: (expr)=>this.doSelect(expr), - data: this.state.dataContent.data - }); - case (0, _interfaces.SideTabId).Snapshots: - return (0, _base.base).react.createElement((0, _snapshots.Snapshots), Object.assign({}, this.props.snapshotProps, { - editor: this.snapshotEditor, - themePalette: themePalette, - explorer: this, - snapshots: this.state.snapshots, - selectedSnapshotIndex: this.state.selectedSnapshotIndex, - onClearSnapshots: ()=>{ - const snapshots = []; - this.setState({ - snapshots, - selectedSnapshotIndex: -1 - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - }, - onWriteSnapshot: (s, i)=>this.writeSnapshot(s, i), - onRemoveSnapshot: (i)=>{ - const snapshots = [ - ...this.state.snapshots - ]; - snapshots.splice(i, 1); - let { selectedSnapshotIndex } = this.state; - if (i === selectedSnapshotIndex) selectedSnapshotIndex = -1; - else if (selectedSnapshotIndex > i) selectedSnapshotIndex--; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - }, - onSnapshotClick: (snapshot, selectedSnapshotIndex)=>{ - this.setState({ - selectedSnapshotIndex - }); - this.calculate(()=>{ - this.handleReviveSnapshot(snapshot, selectedSnapshotIndex); - }); - }, - onMoveUp: (i)=>{ - if (i > 0) { - const snapshots = [ - ...this.state.snapshots - ]; - const temp = snapshots[i - 1]; - snapshots[i - 1] = snapshots[i]; - snapshots[i] = temp; - let { selectedSnapshotIndex } = this.state; - if (i === selectedSnapshotIndex) selectedSnapshotIndex = i - 1; - else if (i - 1 === selectedSnapshotIndex) selectedSnapshotIndex = i; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - } - }, - onMoveDown: (i)=>{ - if (i < this.state.snapshots.length - 1) { - const snapshots = [ - ...this.state.snapshots - ]; - const temp = snapshots[i + 1]; - snapshots[i + 1] = snapshots[i]; - snapshots[i] = temp; - let { selectedSnapshotIndex } = this.state; - if (i === selectedSnapshotIndex) selectedSnapshotIndex = i + 1; - else if (i + 1 === selectedSnapshotIndex) selectedSnapshotIndex = i; - this.setState({ - snapshots, - selectedSnapshotIndex - }); - this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); - } - } - })); - case (0, _interfaces.SideTabId).History: - return (0, _base.base).react.createElement((0, _history.History), { - explorer: this, - themePalette: themePalette, - historyIndex: this.state.historyIndex, - historyItems: this.state.historyItems, - redo: (i)=>this.redo(i) - }); - case (0, _interfaces.SideTabId).Transition: - return (0, _base.base).react.createElement((0, _transition.TransitionEditor), Object.assign({}, columnMapProps, this.state, { - compactUI: this.props.compactUI, - explorer: this, - themePalette: themePalette, - changeSetup: (newState, affectsStagger)=>{ - const calculating = ()=>{ - if (affectsStagger) this.viewer.assignTransitionStagger((0, _transition.getTransition)(this.state)); - this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(this.getSetup()); - }; - if (newState) this.setState(Object.assign(Object.assign({}, newState), { - calculating - })); - else calculating(); - } - })); - case (0, _interfaces.SideTabId).Settings: - return (0, _base.base).react.createElement((0, _settings.Settings), { - explorer: this, - dataFile: this.state.dataFile, - scheme: this.state.scheme, - hideLegend: this.state.hideLegend, - onToggleLegend: (hideLegend)=>this.setState({ - hideLegend, - calculating: ()=>this._resize() - }), - hideAxes: this.state.hideAxes, - onToggleAxes: (hideAxes)=>this.setState({ - calculating: ()=>this.setState({ - hideAxes - }) - }), - additionalSettings: this.props.additionalSettings - }, this.props.systemInfoChildren); - } - })()), loaded && (0, _base.base).react.createElement("div", { - className: "sanddance-view" - }, (0, _base.base).react.createElement((0, _sanddanceReact.Viewer), { - renderOptions: renderOptions, - viewerOptions: this.viewerOptions, - ref: (reactViewer)=>{ - if (reactViewer) this.viewer = reactViewer.viewer; - }, - onView: (renderResult)=>{ - this.rebaseFilter = false; - this.changespecCapabilities(renderResult.specResult.errors ? renderResult.specResult.specCapabilities : this.viewer.specCapabilities); - this.getColorContext = (oldInsight, newInsight)=>{ - if (!oldInsight && !newInsight) return null; - if (!oldInsight || !newInsight) return null; - if (oldInsight.scheme !== newInsight.scheme) return null; - if (oldInsight.columns.color !== newInsight.columns.color) return null; - if (oldInsight.directColor != newInsight.directColor) return null; - return this.viewer.colorContexts && this.viewer.colorContexts[this.viewer.currentColorContext]; - }; - //don't allow tabbing to the canvas - (0, _canvas.removeTabIndex)(this.viewer); - this.props.onView && this.props.onView(); - }, - onError: (e)=>{ - this.props.onError && this.props.onError(e); - }, - data: this.state.dataContent.data, - insight: insight, - setup: this.getSetup(), - onMount: (el)=>this.viewerMounted(el) - }), this.state.note && (0, _base.base).react.createElement("div", { - className: 'sanddance-note' - }, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - className: 'cancel', - themePalette: themePalette, - title: (0, _language.strings).buttonClose, - iconName: 'Cancel', - onClick: ()=>this.setState({ - note: null - }) - }), (0, _base.base).react.createElement("div", null, this.state.note)), (0, _base.base).react.createElement((0, _renderer.Renderer), { - explorer: this, - advanced: this.state.renderer.advanced, - advancedOptions: this.state.renderer.advancedOptions, - basicOptions: this.state.renderer.basicOptions, - themePalette: themePalette, - onHomeClick: ()=>{ - this.setState({ - camera: undefined - }); - this.viewer.presenter.homeCamera(); - } - })), (0, _base.base).react.createElement((0, _dialog.Dialog), { - title: (0, _language.strings).labelError, - hidden: !this.state.errors, - onDismiss: ()=>{ - this.setState({ - errors: null - }); - } - }, this.state.errors && this.state.errors.map((error, i)=>(0, _base.base).react.createElement("div", { - key: i - }, error))), (0, _base.base).react.createElement((0, _snapshotEditor.SnapshotEditor), Object.assign({ - ref: (se)=>this.snapshotEditor = se - }, this.props.snapshotProps, { - explorer: this, - onWriteSnapshot: (s, i)=>this.writeSnapshot(s, i), - theme: this.props.theme, - themePalette: themePalette - }))), this.state.positionedColumnMapProps && (0, _base.base).react.createElement((0, _clickableTextLayer.PositionedColumnMap), Object.assign({}, this.state.positionedColumnMapProps))); - } - getColumnMapBaseProps() { - const allColumns = this.state.dataContent && this.state.dataContent.columns.filter((c)=>!(0, _sanddanceReact.SandDance).util.isInternalFieldName(c.name, true)); - const quantitativeColumns = allColumns && allColumns.filter((c)=>c.quantitative); - const categoricalColumns = allColumns && allColumns.filter((c)=>!c.quantitative); - const props = { - changeColumnMapping: (role, columnOrRole, defaultColumn, options)=>{ - let column; - if (typeof columnOrRole === 'string') { - //look up current insight - const columnName = this.state.columns[columnOrRole]; - column = allColumns.filter((c)=>c.name === columnName)[0] || defaultColumn; - } else column = columnOrRole; - this.changeColumnMapping(role, column, options); - }, - facetStyle: this.state.facetStyle, - totalStyle: this.state.totalStyle, - allColumns, - quantitativeColumns, - categoricalColumns, - specCapabilities: this.state.specCapabilities, - explorer: this - }; - return props; - } + this.pause(); + this.direction = void 0; } - return new __Explorer(_props); -} -const Explorer = _Explorer; - -},{"./base":"3TPz5","./canvas":"55nq5","./clickableTextLayer":"2iqEH","./colorMap":"hxIPY","./colorScheme":"1pr3j","./columns":"7ZE4v","./controls/dataScope":"0ukjY","./controls/dialog":"OQi9w","./controls/iconButton":"6pZiK","./controls/sidebar":"8tdcg","./controls/topbar":"frGei","./dataLoader":"cz9uW","./defaults":"5K5JN","./dialogs/chart":"dwBpS","./dialogs/color":"jLMxI","./dialogs/dataBrowser":"dT4UW","./dialogs/history":"4nAWT","./dialogs/search":"eXzPo","./dialogs/settings":"2xbhO","./dialogs/snapshotEditor":"g29jp","./dialogs/snapshots":"sTI5I","./dialogs/transition":"3tDGl","./interfaces":"k3BwW","./language":"67xOI","./mouseEvent":"ioN9k","./partialInsight":"1nehK","./themes":"g7FJh","./searchGroups":"3oCWU","@msrvida/chart-recommender":"isTvp","@msrvida/sanddance-react":"lPyTZ","./controls/renderer":"4tj9B","./dialogs/backgroundImageEditor":"hTdbK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hxIPY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applyColorButtons", ()=>applyColorButtons); -var _base = require("./base"); -var _iconButton = require("./controls/iconButton"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _language = require("./language"); -const className = 'sanddance-panel-tools'; -function ensureToolbar(panel) { + } + const className = "sanddance-panel-tools"; + function ensureToolbar(panel) { const existing = panel.getElementsByClassName(className); - if (existing.length > 0) return existing[0]; - else { - const div = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.addDiv(panel, className); - panel.insertAdjacentElement('afterbegin', div); - return div; + if (existing.length > 0) { + return existing[0]; + } else { + const div = addDiv(panel, className); + panel.insertAdjacentElement("afterbegin", div); + return div; } -} -function applyColorButtons(presenter, showLegend, props) { - const panel = presenter.getElement((0, _sanddanceReact.SandDance).VegaMorphCharts.PresenterElement.panel); + } + function applyColorButtons(presenter, showLegend, props) { + const panel = presenter.getElement(PresenterElement$1.panel); const div = ensureToolbar(panel); - (0, _base.base).reactDOM.render(ColorMap(props), div); - panel.style.display = showLegend ? '' : 'none'; -} -function ColorMap(props) { + base$1.reactDOM.render(ColorMap(props), div); + panel.style.display = showLegend ? "" : "none"; + } + function ColorMap(props) { const menuProps = { - items: [ - { - key: 'new', - text: (0, _language.strings).buttonColorSchemeRemap, - disabled: !props.canRemap || props.isRemap, - onClick: ()=>props.colorMapHandler(true) - }, - { - key: 'old', - text: (0, _language.strings).buttonColorSchemeKeep, - disabled: !props.canRemap || !props.isRemap, - onClick: ()=>props.colorMapHandler(false) - } - ] - }; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - styles: { - menuIcon: { - display: 'none' - } - }, - themePalette: props.themePalette, - title: (0, _language.strings).buttonColorSchemeMap, - onClick: null, - iconName: props.canRemap ? 'FiltersSolid' : 'Filters', - menuProps: menuProps - })); -} - -},{"./base":"3TPz5","./controls/iconButton":"6pZiK","@msrvida/sanddance-react":"lPyTZ","./language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1pr3j":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bestColorScheme", ()=>bestColorScheme); -function bestColorScheme(newColumn, oldColumn, oldScheme) { - if (oldColumn && oldColumn.quantitative === newColumn.quantitative && defaultColorScheme(oldColumn) === defaultColorScheme(newColumn)) return oldScheme; - return defaultColorScheme(newColumn); -} -function defaultColorScheme(c) { - if (c.quantitative) return 'redyellowgreen'; - else if (c.stats.distinctValueCount === 2) return 'dual_redgreen'; - else if (c.stats.distinctValueCount <= 10) return 'category10'; - return 'category20'; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0ukjY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataScopeId", ()=>DataScopeId); -parcelHelpers.export(exports, "resetSelectedItemIndex", ()=>resetSelectedItemIndex); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -var _button = require("./button"); -var _base = require("../base"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _d3Format = require("d3-format"); -var DataScopeId; -(function(DataScopeId) { - DataScopeId[DataScopeId["AllData"] = 0] = "AllData"; - DataScopeId[DataScopeId["SelectedData"] = 1] = "SelectedData"; - DataScopeId[DataScopeId["FilteredData"] = 2] = "FilteredData"; -})(DataScopeId || (DataScopeId = {})); -function resetSelectedItemIndex(selectedItemIndex) { - selectedItemIndex[DataScopeId.AllData] = 0; - selectedItemIndex[DataScopeId.FilteredData] = 0; - selectedItemIndex[DataScopeId.SelectedData] = 0; -} -const shortFormat = (0, _d3Format.format)('.2~s'); -function short(n) { - return n === -1 ? '--' : n ? n < 1000 ? n.toString() : shortFormat(n) : '0'; -} -function DataScope(props) { - const dataCount = Object.assign({ - all: -1, - filtered: -1, - selected: -1 - }, props.dataCount); - return props.compact ? (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-datascope', 'compact'), - onClick: props.onCompactClick - }, (0, _base.base).react.createElement(Compact, Object.assign({}, props, { - dataScopeId: DataScopeId.AllData, - text: (0, _language.strings).selectDataSpanAll, - count: dataCount.all - })), (0, _base.base).react.createElement(Compact, Object.assign({}, props, { - dataScopeId: DataScopeId.FilteredData, - text: (0, _language.strings).selectDataSpanFilter, - count: dataCount.filtered - })), (0, _base.base).react.createElement(Compact, Object.assign({}, props, { - dataScopeId: DataScopeId.SelectedData, - text: (0, _language.strings).selectDataSpanSelection, - count: dataCount.selected - }))) : (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-datascope', 'extended', props.active && 'active') - }, (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("div", null, props.dataSet), (0, _base.base).react.createElement("div", { - className: "datascope-buttons" - }, (0, _base.base).react.createElement(DataScopeButton, Object.assign({}, props, { - dataScopeId: DataScopeId.AllData, - text: (0, _language.strings).selectDataSpanAll, - count: dataCount.all - })), (0, _base.base).react.createElement(DataScopeButton, Object.assign({}, props, { - dataScopeId: DataScopeId.FilteredData, - text: (0, _language.strings).selectDataSpanFilter, - count: dataCount.filtered - })), (0, _base.base).react.createElement(DataScopeButton, Object.assign({}, props, { - dataScopeId: DataScopeId.SelectedData, - text: (0, _language.strings).selectDataSpanSelection, - count: dataCount.selected - }))))); -} -function Compact(props) { - return (0, _base.base).react.createElement("div", { - title: props.text, - onClick: ()=>{ - props.onDataScopeClick(props.dataScopeId); - } - }, short(props.count)); -} -function DataScopeButton(props) { - return (0, _base.base).react.createElement((0, _button.Button), { - themePalette: props.themePalette, - className: (0, _sanddanceReact.util).classList('datascope-button', props.selectedDataScope === props.dataScopeId && 'selected'), - disabled: props.disabled, - text: props.text, - onClick: ()=>{ - props.onDataScopeClick(props.dataScopeId); - }, - onRenderText: ()=>{ - return (0, _base.base).react.createElement("div", { - title: props.count > 0 ? props.count.toString() : '' - }, (0, _base.base).react.createElement("label", null, props.text), (0, _base.base).react.createElement("div", null, short(props.count))); + items: [ + { + key: "new", + text: strings$1.buttonColorSchemeRemap, + disabled: !props.canRemap || props.isRemap, + onClick: () => props.colorMapHandler(true) }, - onRenderIcon: ()=>null - }); -} - -},{"./button":"f8wtc","../base":"3TPz5","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","d3-format":"itHmU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"itHmU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "formatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "format", ()=>(0, _defaultLocaleJs.format)); -parcelHelpers.export(exports, "formatPrefix", ()=>(0, _defaultLocaleJs.formatPrefix)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "formatSpecifier", ()=>(0, _formatSpecifierJsDefault.default)); -parcelHelpers.export(exports, "FormatSpecifier", ()=>(0, _formatSpecifierJs.FormatSpecifier)); -parcelHelpers.export(exports, "precisionFixed", ()=>(0, _precisionFixedJsDefault.default)); -parcelHelpers.export(exports, "precisionPrefix", ()=>(0, _precisionPrefixJsDefault.default)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _precisionRoundJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _precisionFixedJs = require("./precisionFixed.js"); -var _precisionFixedJsDefault = parcelHelpers.interopDefault(_precisionFixedJs); -var _precisionPrefixJs = require("./precisionPrefix.js"); -var _precisionPrefixJsDefault = parcelHelpers.interopDefault(_precisionPrefixJs); -var _precisionRoundJs = require("./precisionRound.js"); -var _precisionRoundJsDefault = parcelHelpers.interopDefault(_precisionRoundJs); - -},{"./defaultLocale.js":"93IfM","./locale.js":false,"./formatSpecifier.js":false,"./precisionFixed.js":false,"./precisionPrefix.js":false,"./precisionRound.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93IfM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formatPrefix", ()=>formatPrefix); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var format; -var formatPrefix; -defaultLocale({ - decimal: ".", - thousands: ",", - grouping: [ - 3 - ], - currency: [ - "$", - "" - ], - minus: "-" -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} - -},{"./locale.js":"MDG5s","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"MDG5s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? (0, _identityJsDefault.default) : (0, _formatGroupJsDefault.default)(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? (0, _identityJsDefault.default) : (0, _formatNumeralsJsDefault.default)(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "-" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - function newFormat(specifier) { - specifier = (0, _formatSpecifierJsDefault.default)(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - else if (!(0, _formatTypesJsDefault.default)[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - // If zero fill is specified, padding goes after sign and before digits. - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = (0, _formatTypesJsDefault.default)[type], maybeSuffix = /[defgprs%]/.test(type); - // Set the default precision if not specified, - // or clamp the specified precision to the supported range. - // For significant precision, it must be in [1, 21]. - // For fixed precision, it must be in [0, 20]. - precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - // Trim insignificant zeros. - if (trim) value = (0, _formatTrimJsDefault.default)(value); - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + (0, _formatPrefixAutoJs.prefixExponent) / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while(++i < n)if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - // Reconstruct the final output based on the desired alignment. - switch(align){ - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format.toString = function() { - return specifier + ""; - }; - return format; + { + key: "old", + text: strings$1.buttonColorSchemeKeep, + disabled: !props.canRemap || !props.isRemap, + onClick: () => props.colorMapHandler(false) } - function formatPrefix(specifier, value) { - var f = newFormat((specifier = (0, _formatSpecifierJsDefault.default)(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; + ] + }; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(IconButton$1, { styles: { + menuIcon: { + display: "none" } - return { - format: newFormat, - formatPrefix: formatPrefix - }; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); -var _formatGroupJs = require("./formatGroup.js"); -var _formatGroupJsDefault = parcelHelpers.interopDefault(_formatGroupJs); -var _formatNumeralsJs = require("./formatNumerals.js"); -var _formatNumeralsJsDefault = parcelHelpers.interopDefault(_formatNumeralsJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _formatTrimJs = require("./formatTrim.js"); -var _formatTrimJsDefault = parcelHelpers.interopDefault(_formatTrimJs); -var _formatTypesJs = require("./formatTypes.js"); -var _formatTypesJsDefault = parcelHelpers.interopDefault(_formatTypesJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var map = Array.prototype.map, prefixes = [ - "y", - "z", - "a", - "f", - "p", - "n", - "\xb5", - "m", - "", - "k", - "M", - "G", - "T", - "P", - "E", - "Z", - "Y" -]; - -},{"./exponent.js":"hGAq4","./formatGroup.js":"jxvv9","./formatNumerals.js":"f3HGM","./formatSpecifier.js":"8Wjeu","./formatTrim.js":"SfY1D","./formatTypes.js":"hmsB1","./formatPrefixAuto.js":"kxrNA","./identity.js":"Nub0n","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hGAq4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x = (0, _formatDecimalJs.formatDecimalParts)(Math.abs(x)), x ? x[1] : NaN; - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"9qcOn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9qcOn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); - }); -// Computes the decimal coefficient and exponent of the specified number x with -// significant digits p, where x is positive and p is in [1, 21] or undefined. -// For example, formatDecimalParts(1.23) returns ["123", 0]. -parcelHelpers.export(exports, "formatDecimalParts", ()=>formatDecimalParts); -function formatDecimalParts(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = x.slice(0, i); - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). + }, themePalette: props.themePalette, title: strings$1.buttonColorSchemeMap, onClick: null, iconName: props.canRemap ? "FiltersSolid" : "Filters", menuProps }) + ); + } + function bestColorScheme(newColumn, oldColumn, oldScheme) { + return defaultColorScheme(newColumn); + } + function defaultColorScheme(c2) { + if (c2.quantitative) { + return "redyellowgreen"; + } else if (c2.stats.distinctValueCount === 2) { + return "dual_redgreen"; + } else if (c2.stats.distinctValueCount <= 10) { + return "category10"; + } + return "category20"; + } + function formatDecimal(x2) { + return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); + } + function formatDecimalParts(x2, p) { + if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; + var i, coefficient = x2.slice(0, i); return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x2.slice(i + 1) ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jxvv9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while(i > 0 && g > 0){ - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f3HGM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Wjeu":[function(require,module,exports,__globalThis) { -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatSpecifier); -parcelHelpers.export(exports, "FormatSpecifier", ()=>FormatSpecifier); -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; + } + function exponent(x2) { + return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN; + } + function formatGroup(grouping, thousands) { + return function(value2, width2) { + var i = value2.length, t = [], j = 0, g = grouping[0], length2 = 0; + while (i > 0 && g > 0) { + if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); + t.push(value2.substring(i -= g, i + g)); + if ((length2 += g + 1) > width2) break; + g = grouping[j = (j + 1) % grouping.length]; + } + return t.reverse().join(thousands); + }; + } + function formatNumerals(numerals) { + return function(value2) { + return value2.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } + var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + function formatSpecifier(specifier) { + if (!(match2 = re.exec(specifier))) throw new Error("invalid format: " + specifier); + var match2; return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] + fill: match2[1], + align: match2[2], + sign: match2[3], + symbol: match2[4], + zero: match2[5], + width: match2[6], + comma: match2[7], + precision: match2[8] && match2[8].slice(1), + trim: match2[9], + type: match2[10] }); -} -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof -function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; + } + formatSpecifier.prototype = FormatSpecifier.prototype; + function FormatSpecifier(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} -FormatSpecifier.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"SfY1D":[function(require,module,exports,__globalThis) { -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(s) { - out: for(var n = s.length, i = 1, i0 = -1, i1; i < n; ++i)switch(s[i]){ - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; - break; - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hmsB1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _formatDecimalJs = require("./formatDecimal.js"); -var _formatDecimalJsDefault = parcelHelpers.interopDefault(_formatDecimalJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _formatPrefixAutoJsDefault = parcelHelpers.interopDefault(_formatPrefixAutoJs); -var _formatRoundedJs = require("./formatRounded.js"); -var _formatRoundedJsDefault = parcelHelpers.interopDefault(_formatRoundedJs); -exports.default = { - "%": function(x, p) { - return (x * 100).toFixed(p); - }, - "b": function(x) { - return Math.round(x).toString(2); + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + FormatSpecifier.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + function formatTrim(s2) { + out: for (var n = s2.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s2[i]) { + case ".": + i0 = i1 = i; + break; + case "0": + if (i0 === 0) i0 = i; + i1 = i; + break; + default: + if (!+s2[i]) break out; + if (i0 > 0) i0 = 0; + break; + } + } + return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2; + } + var prefixExponent; + function formatPrefixAuto(x2, p) { + var d2 = formatDecimalParts(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; + return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x2, Math.max(0, p + i - 1))[0]; + } + function formatRounded(x2, p) { + var d2 = formatDecimalParts(x2, p); + if (!d2) return x2 + ""; + var coefficient = d2[0], exponent2 = d2[1]; + return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); + } + const formatTypes = { + "%": function(x2, p) { + return (x2 * 100).toFixed(p); }, - "c": function(x) { - return x + ""; + "b": function(x2) { + return Math.round(x2).toString(2); }, - "d": (0, _formatDecimalJsDefault.default), - "e": function(x, p) { - return x.toExponential(p); + "c": function(x2) { + return x2 + ""; }, - "f": function(x, p) { - return x.toFixed(p); + "d": formatDecimal, + "e": function(x2, p) { + return x2.toExponential(p); }, - "g": function(x, p) { - return x.toPrecision(p); + "f": function(x2, p) { + return x2.toFixed(p); }, - "o": function(x) { - return Math.round(x).toString(8); + "g": function(x2, p) { + return x2.toPrecision(p); }, - "p": function(x, p) { - return (0, _formatRoundedJsDefault.default)(x * 100, p); + "o": function(x2) { + return Math.round(x2).toString(8); }, - "r": (0, _formatRoundedJsDefault.default), - "s": (0, _formatPrefixAutoJsDefault.default), - "X": function(x) { - return Math.round(x).toString(16).toUpperCase(); + "p": function(x2, p) { + return formatRounded(x2 * 100, p); }, - "x": function(x) { - return Math.round(x).toString(16); - } -}; - -},{"./formatDecimal.js":"9qcOn","./formatPrefixAuto.js":"kxrNA","./formatRounded.js":"bk9ei","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kxrNA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixExponent", ()=>prefixExponent); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + (0, _formatDecimalJs.formatDecimalParts)(x, Math.max(0, p + i - 1))[0]; // less than 1y! - }); -var _formatDecimalJs = require("./formatDecimal.js"); -var prefixExponent; - -},{"./formatDecimal.js":"9qcOn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bk9ei":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"9qcOn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Nub0n":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8tdcg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sidebar", ()=>Sidebar); -var _base = require("../base"); -var _dataScope = require("./dataScope"); -var _scrollable = require("./scrollable"); -var _interfaces = require("../interfaces"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _sideButton = require("./sideButton"); -function Sidebar(props) { - const sidebuttons = [ - { - sideTabId: (0, _interfaces.SideTabId).ChartType, - iconName: 'BIDashboard', - title: (0, _language.strings).labelChart - }, - { - sideTabId: (0, _interfaces.SideTabId).Color, - iconName: 'Color', - title: (0, _language.strings).labelColor - }, - { - sideTabId: (0, _interfaces.SideTabId).Data, - iconName: 'Table', - title: (0, _language.strings).labelDataBrowser - }, - { - sideTabId: (0, _interfaces.SideTabId).Search, - iconName: 'Search', - title: (0, _language.strings).labelSearch - }, - !props.snapshotsHidden && { - sideTabId: (0, _interfaces.SideTabId).Snapshots, - iconName: 'Camera', - title: (0, _language.strings).labelSnapshots - }, - { - sideTabId: (0, _interfaces.SideTabId).History, - iconName: 'History', - title: (0, _language.strings).labelHistory - }, - { - sideTabId: (0, _interfaces.SideTabId).Transition, - iconName: 'Flow', - title: (0, _language.strings).labelTransition - }, - { - sideTabId: (0, _interfaces.SideTabId).Settings, - iconName: 'Settings', - title: (0, _language.strings).labelChartSettings - } - ].filter(Boolean); - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-sidebar', 'calculator', props.pinned && 'pinned', props.closed && 'closed') - }, (0, _base.base).react.createElement("div", { - className: "sidebar-content" - }, (0, _base.base).react.createElement((0, _dataScope.DataScope), Object.assign({}, props.dataScopeProps)), (0, _base.base).react.createElement("div", { - className: "vbuttons" - }, (0, _base.base).react.createElement("div", { - className: "sidebar-dialogs", - role: 'tablist' - }, sidebuttons.map((sidebutton, i)=>(0, _base.base).react.createElement((0, _sideButton.Sidebutton), Object.assign({ - key: i - }, props, sidebutton, { - themePalette: props.themePalette - })))), !props.hideSidebarControls && (0, _base.base).react.createElement("div", { - className: "sidebar-controls" - }, (0, _base.base).react.createElement((0, _sideButton.Sidebutton), Object.assign({}, props, { - omitAriaSelected: true, - role: 'button', - sideTabId: (0, _interfaces.SideTabId).Pin, - iconName: props.pinned ? 'Pinned' : 'Pin', - title: props.pinned ? (0, _language.strings).buttonToolbarFloat : (0, _language.strings).buttonToolbarDock - })), (0, _base.base).react.createElement((0, _sideButton.Sidebutton), Object.assign({}, props, { - omitAriaSelected: true, - role: 'button', - sideTabId: (0, _interfaces.SideTabId).Collapse, - iconName: props.closed ? 'DoubleChevronRight12' : 'DoubleChevronLeft12', - title: props.closed ? (0, _language.strings).buttonToolbarShow : (0, _language.strings).buttonToolbarHide - })))), (0, _base.base).react.createElement((0, _scrollable.Scrollable), { - role: 'tabpanel' - }, (0, _base.base).react.createElement("div", { - className: "sidetab" - }, props.children)), props.calculating && (0, _base.base).react.createElement("div", { - className: "calculating" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Spinner, { - size: (0, _base.base).fluentUI.SpinnerSize.large - })))); -} - -},{"../base":"3TPz5","./dataScope":"0ukjY","./scrollable":"kjmdO","../interfaces":"k3BwW","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","./sideButton":"lIUiX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kjmdO":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scrollable", ()=>Scrollable); -var _base = require("../base"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Scrollable(props) { - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('scrollable-container', props.className), - role: props.role - }, (0, _base.base).react.createElement("div", { - className: "scrollable" - }, props.children)); -} - -},{"../base":"3TPz5","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k3BwW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SideTabId", ()=>SideTabId); -var SideTabId; -(function(SideTabId) { - SideTabId[SideTabId["ChartType"] = 0] = "ChartType"; - SideTabId[SideTabId["Data"] = 1] = "Data"; - SideTabId[SideTabId["Search"] = 2] = "Search"; - SideTabId[SideTabId["Color"] = 3] = "Color"; - SideTabId[SideTabId["Snapshots"] = 4] = "Snapshots"; - SideTabId[SideTabId["History"] = 5] = "History"; - SideTabId[SideTabId["Transition"] = 6] = "Transition"; - SideTabId[SideTabId["Settings"] = 7] = "Settings"; - SideTabId[SideTabId["Pin"] = 8] = "Pin"; - SideTabId[SideTabId["Collapse"] = 9] = "Collapse"; -})(SideTabId || (SideTabId = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lIUiX":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sidebutton", ()=>Sidebutton); -var _base = require("../base"); -var _iconButton = require("./iconButton"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Sidebutton(props) { - const selected = !props.closed && props.selectedSideTab === props.sideTabId; - const buttonProps = props.omitAriaSelected ? {} : { - 'aria-selected': selected - }; - return (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('vbutton', selected && 'selected') - }, props.badgeText && (0, _base.base).react.createElement("div", { - className: "count" - }, props.badgeText), (0, _base.base).react.createElement((0, _iconButton.IconButton), Object.assign({}, buttonProps, { - role: props.role || 'tab', - themePalette: props.themePalette, - className: "vbutton", - iconName: props.iconName, - title: props.title, - onClick: ()=>{ - props.onSideTabClick(props.sideTabId); - } - }))); -} - -},{"../base":"3TPz5","./iconButton":"6pZiK","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"frGei":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Topbar", ()=>Topbar); -var _commandBarButtonStyles = require("./CommandBarButton.styles"); -var _logo = require("./logo"); -var _base = require("../base"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function Topbar(props) { - var _a; - const zeroResults = props.selectionState.selectedData && props.selectionState.selectedData.length === 0; - const disabled = !props.loaded; - const items = [ - { - key: 'undo', - name: (0, _language.strings).buttonUndo, - iconProps: { - iconName: 'Undo' - }, - disabled: disabled || props.historyItems.length === 0 || props.historyIndex === 0, - onClick: props.undo - }, - { - key: 'redo', - name: (0, _language.strings).buttonRedo, - iconProps: { - iconName: 'Redo' - }, - disabled: disabled || props.historyItems.length <= 1 || props.historyIndex >= props.historyItems.length - 1, - onClick: props.redo - }, - { - key: 'deselect', - name: (0, _language.strings).buttonDeselect, - iconProps: { - iconName: 'Cancel' - }, - disabled: disabled || !props.selectionSearch, - onClick: props.doDeselect - }, - { - key: 'isolate', - name: (0, _language.strings).buttonIsolate, - iconProps: { - iconName: 'Filter' - }, - disabled: disabled || !props.selectionSearch || zeroResults, - onClick: ()=>props.doFilter(props.selectionSearch, (0, _language.strings).labelHistoryFilterIsolate) - }, - { - key: 'exclude', - name: (0, _language.strings).buttonExclude, - iconProps: { - iconName: 'ClearFilter' - }, - disabled: disabled || !props.selectionSearch || zeroResults, - onClick: ()=>props.doFilter((0, _sanddanceReact.SandDance).searchExpression.invert(props.selectionSearch), (0, _language.strings).labelHistoryFilterIExclude) - }, - { - key: 'reset', - name: (0, _language.strings).buttonReset, - iconProps: { - iconName: 'RemoveFilter' - }, - disabled: disabled || !props.filter, - onClick: ()=>props.doUnfilter((0, _language.strings).labelHistoryFilterClear) - } - ]; - if (props.buttons) items.push.apply(items, props.buttons); - if (props.collapseLabels) items.forEach((item)=>item.iconOnly = true); - const farItems = []; - if (!props.snapshotsHidden) farItems.push({ - key: 'previous-snapshot', - iconProps: { - iconName: 'Previous' - }, - title: (0, _language.strings).buttonPrevSnapshot, - onClick: props.onSnapshotPreviousClick, - disabled: !props.snapshots || props.snapshots.length < 2 - }, { - key: 'snapshot', - iconProps: { - iconName: 'Camera' - }, - title: (0, _language.strings).buttonCreateSnapshot, - onClick: props.onSnapshotClick, - disabled: !props.loaded - }, { - key: 'next-snapshot', - iconProps: { - iconName: 'Next' - }, - title: (0, _language.strings).buttonNextSnapshot, - onClick: props.onSnapshotNextClick, - disabled: !props.snapshots || props.snapshots.length < 2 - }); - farItems.push({ - key: 'view', - iconProps: { - iconName: props.view === '2d' ? 'CubeShape' : 'Page' - }, - title: props.view === '2d' ? (0, _language.strings).labelViewType3d : (0, _language.strings).labelViewType2d, - onClick: props.onViewClick, - disabled: !props.loaded - }); - if ((_a = props.iconButtons) === null || _a === void 0 ? void 0 : _a.length) farItems.push(...props.iconButtons); - return (0, _base.base).react.createElement("div", { - className: "sanddance-explorer-topbar" - }, (0, _base.base).react.createElement("div", { - className: "logo" - }, (0, _base.base).react.createElement((0, _logo.Logo), null), (0, _base.base).react.createElement("a", { - href: props.logoClickUrl || '/', - target: props.logoClickTarget || '_blank' - }, (0, _language.strings).appName)), (0, _base.base).react.createElement("div", { - className: "sanddance-explorer-commandbar" - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Customizer, { - scopedSettings: { - CommandBarButton: { - styles: (buttonProps)=>{ - buttonProps.theme.palette = props.themePalette; - return (0, _commandBarButtonStyles.CommandBarButtonStyles)(buttonProps); - } - } - } - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.CommandBar, { - items: items, - farItems: farItems, - styles: { - root: { - backgroundColor: 'transparent', - height: 'unset', - paddingLeft: 0, - paddingRight: 0 - } - } - })))); -} - -},{"./CommandBarButton.styles":"lVFm9","./logo":"6QmCn","../base":"3TPz5","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lVFm9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ //adapted from https://github.com/OfficeDev/office-ui-fabric-react/blob/master/packages/fluent-theme/src/fluent/styles/CommandBarButton.styles.ts -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBarButtonStyles", ()=>CommandBarButtonStyles); -var _base = require("../base"); -const CommandBarButtonStyles = (props)=>{ - const { theme } = props; - if (!theme) throw new Error('Theme is undefined or null.'); - const { palette, semanticColors } = theme; - const BUTTON_ICON_CLASSNAME = '.ms-Button-icon'; - return { - root: [ - Object.assign({}, (0, _base.base).fluentUI.getFocusStyle(theme, { - inset: 2 - })), - { - backgroundColor: palette.white - } - ], - rootHovered: { - backgroundColor: palette.neutralLighter, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDarkAlt - } - } - }, - rootPressed: { - backgroundColor: palette.neutralLight, - color: palette.neutralDark, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootChecked: { - backgroundColor: palette.neutralLight, - color: palette.neutralDark, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootCheckedHovered: { - backgroundColor: palette.neutralQuaternaryAlt, - color: palette.neutralDark - }, - rootExpanded: { - color: palette.neutralDark, - backgroundColor: palette.neutralLight, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.themeDark - } - } - }, - rootExpandedHovered: { - background: palette.neutralQuaternaryAlt - }, - rootDisabled: { - backgroundColor: palette.white, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: semanticColors.disabledBodySubtext - } - } - }, - splitButtonMenuButton: { - backgroundColor: palette.white, - color: palette.neutralSecondary, - selectors: { - ':hover': { - backgroundColor: palette.neutralLighter, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.neutralPrimary - } - } - }, - ':active': { - backgroundColor: palette.neutralLight, - selectors: { - [BUTTON_ICON_CLASSNAME]: { - color: palette.neutralPrimary - } - } - } - } - }, - splitButtonMenuButtonDisabled: { - backgroundColor: palette.white - }, - icon: { - color: palette.themePrimary - } - }; -}; - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6QmCn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Logo", ()=>Logo); -var _base = require("../base"); -const s = ` - ...... -....... -... -...... - ...... - ... -....... -...... -`; -const d = s.split('\n').map((row, irow)=>row.length ? row.split('').map((char, icol)=>char.trim() ? `M${2 * icol + 1} ${2 * (irow - 1) + 1} v1 h1 v-1 Z` : '').join(' ') : '').join('\n'); -function Logo() { - return (0, _base.base).react.createElement("svg", { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 16 16" - }, (0, _base.base).react.createElement("path", { - d: d - })); -} - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cz9uW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loadDataFile", ()=>loadDataFile); -parcelHelpers.export(exports, "loadDataArray", ()=>loadDataArray); -var _sanddanceReact = require("@msrvida/sanddance-react"); -const loadDataFile = (dataFile, columnTypes)=>new Promise((resolve, reject)=>{ - const vega = (0, _sanddanceReact.SandDance).VegaMorphCharts.base.vega; - const loader = vega.loader(); - function handleRawText(text) { - let data; - try { - data = vega.read(text, { - type: dataFile.type, - parse: {} - }); - } catch (e) { - reject(e); - } - if (data) loadDataArray(data, dataFile.type, columnTypes).then((dc)=>{ - if (dataFile.snapshotsUrl) fetch(dataFile.snapshotsUrl).then((response)=>response.json()).then((snapshots)=>{ - dc.snapshots = snapshots; - resolve(dc); - }).catch(reject); - else if (dataFile.snapshots) { - dc.snapshots = dataFile.snapshots; - resolve(dc); - } else resolve(dc); - }).catch(reject); - } - if (dataFile.dataUrl) loader.load(dataFile.dataUrl).then(handleRawText).catch(reject); - else if (dataFile.rawText) handleRawText(dataFile.rawText); - else reject('dataFile object must have either dataUrl or rawText property set.'); - }); -const loadDataArray = (data, type, columnTypes)=>new Promise((resolve, reject)=>{ - const parse = type === 'csv' || type === 'tsv'; - if (parse) //convert empty strings to null so that vega.inferType will get dates - data.forEach((row)=>{ - for(const column in row)if (row[column] === '') row[column] = null; - }); - const columns = (0, _sanddanceReact.SandDance).util.getColumnsFromData((0, _sanddanceReact.SandDance).VegaMorphCharts.base.vega.inferTypes, data, columnTypes).filter((c)=>c.name && c.name.trim()).sort((a, b)=>a.name.localeCompare(b.name)); - if (parse) { - const booleanColumns = columns.filter((c)=>c.type === 'boolean'); - const dateColumns = columns.filter((c)=>c.type === 'date'); - const numericColumns = columns.filter((c)=>c.type === 'integer' || c.type === 'number'); - data.forEach((obj)=>{ - booleanColumns.forEach((c)=>{ - obj[c.name] = ('' + obj[c.name]).toLowerCase() === 'true'; - }); - dateColumns.forEach((c)=>{ - const input = obj[c.name]; - if (input !== null) { - const d = new Date(input); - d.input = input; - obj[c.name] = d; - } - }); - numericColumns.forEach((c)=>{ - const n = parseFloat(obj[c.name]); - obj[c.name] = isNaN(n) ? null : n; - }); - }); - } - resolve({ - data, - columns - }); - }); - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5K5JN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fontFamily", ()=>fontFamily); -parcelHelpers.export(exports, "defaultViewerOptions", ()=>defaultViewerOptions); -parcelHelpers.export(exports, "snapshotThumbWidth", ()=>snapshotThumbWidth); -parcelHelpers.export(exports, "defaultRenderer", ()=>defaultRenderer); -parcelHelpers.export(exports, "initialExplorerState", ()=>initialExplorerState); -var _themes = require("./themes"); -var _interfaces = require("./interfaces"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _dataScope = require("./controls/dataScope"); -const fontFamily = 'Segoe UI, sans-serif'; -const defaultViewerOptions = { - colors: (0, _themes.getColorSettingsFromThemePalette)((0, _themes.themePalettes)['']), - fontFamily -}; -const snapshotThumbWidth = 300; -const defaultRenderer = { - advanced: false, - advancedOptions: { - bloomIntensity: 2, - isBloomEnabled: false, - isDofEnabled: false, - dofFocusRange: 0.25, - isFxaaEnabled: false, - isShadowEnabled: true, - isSsaoEnabled: true + "r": formatRounded, + "s": formatPrefixAuto, + "X": function(x2) { + return Math.round(x2).toString(16).toUpperCase(); }, - basicOptions: { - antialias: true + "x": function(x2) { + return Math.round(x2).toString(16); } -}; -function initialExplorerState(props) { - const renderer = props.initialRenderer || defaultRenderer; - if (!renderer.advancedOptions) renderer.advancedOptions = defaultRenderer.advancedOptions; - if (!renderer.basicOptions) renderer.basicOptions = defaultRenderer.basicOptions; - const state = { - calculating: null, - errors: null, - autoCompleteDistinctValues: {}, - colorBin: null, - dataContent: null, - dataFile: null, - search: null, - totalStyle: null, - facetStyle: 'wrap', - filter: null, - filteredData: null, - specCapabilities: null, - size: { - height: null, - width: null - }, - scheme: null, - transform: null, - columns: null, - chart: 'grid', - signalValues: null, - hideAxes: false, - hideLegend: false, - sideTabId: (0, _interfaces.SideTabId).ChartType, - dataScopeId: (0, _dataScope.DataScopeId).AllData, - selectedItemIndex: {}, - sidebarClosed: props.initialSidebarClosed === undefined ? false : props.initialSidebarClosed, - sidebarPinned: props.initialSidebarPinned === undefined ? true : props.initialSidebarPinned, - view: props.initialView || '2d', - snapshots: [], - selectedSnapshotIndex: -1, - tooltipExclusions: [], - positionedColumnMapProps: null, - note: null, - historyIndex: -1, - historyItems: [], - renderer, - transitionType: 'ordinal', - transitionDimension: 'x', - transitionDurations: (0, _sanddanceReact.SandDance).VegaMorphCharts.util.clone((0, _sanddanceReact.SandDance).VegaMorphCharts.defaults.defaultPresenterConfig.transitionDurations) - }; - (0, _dataScope.resetSelectedItemIndex)(state.selectedItemIndex); - return state; -} - -},{"./themes":"g7FJh","./interfaces":"k3BwW","@msrvida/sanddance-react":"lPyTZ","./controls/dataScope":"0ukjY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g7FJh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "themePalettes", ()=>themePalettes); -parcelHelpers.export(exports, "getColorSettingsFromThemePalette", ()=>getColorSettingsFromThemePalette); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var util = (0, _sanddanceReact.SandDance).VegaMorphCharts.util; -const themePalettes = {}; -themePalettes[''] = { - themePrimary: '#0078d4', - themeLighterAlt: '#eff6fc', - themeLighter: '#deecf9', - themeLight: '#c7e0f4', - themeTertiary: '#71afe5', - themeSecondary: '#2b88d8', - themeDarkAlt: '#106ebe', - themeDark: '#005a9e', - themeDarker: '#004578', - neutralLighterAlt: '#faf9f8', - neutralLighter: '#f3f2f1', - neutralLight: '#edebe9', - neutralQuaternaryAlt: '#e1dfdd', - neutralQuaternary: '#d0d0d0', - neutralTertiaryAlt: '#c8c6c4', - neutralTertiary: '#595959', - neutralSecondary: '#373737', - neutralSecondaryAlt: '#373737', - neutralPrimaryAlt: '#2f2f2f', - neutralPrimary: '#000000', - neutralDark: '#151515', - black: '#0b0b0b', - white: '#ffffff' -}; -themePalettes['dark-theme'] = { - themePrimary: '#0078d4', - themeLighterAlt: '#eff6fc', - themeLighter: '#deecf9', - themeLight: '#c7e0f4', - themeTertiary: '#71afe5', - themeSecondary: '#2b88d8', - themeDarkAlt: '#106ebe', - themeDark: '#005a9e', - themeDarker: '#004578', - neutralLighterAlt: '#0b0b0b', - neutralLighter: '#151515', - neutralLight: '#252525', - neutralQuaternaryAlt: '#2f2f2f', - neutralQuaternary: '#373737', - neutralTertiaryAlt: '#595959', - neutralTertiary: '#c8c8c8', - neutralSecondary: '#d0d0d0', - neutralSecondaryAlt: '#d0d0d0', - neutralPrimaryAlt: '#dadada', - neutralPrimary: '#ffffff', - neutralDark: '#f4f4f4', - black: '#f8f8f8', - white: '#000000' -}; -function getColorSettingsFromThemePalette(themePalette) { - const c = util.colorFromString(themePalette.themeSecondary); - c[3] = 256 / 3; // one-third opacity background - return { - axisLine: themePalette.black, - axisText: themePalette.black, - gridLine: themePalette.neutralLight, - backgroundColor: themePalette.white, - hoveredCube: themePalette.black, - clickableText: themePalette.themeDark, - clickableTextHighlight: util.colorToString(c), - searchText: themePalette.neutralPrimary, - searchTextHighlight: themePalette.neutralPrimaryAlt - }; -} - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jLMxI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -var _base = require("../base"); -var _columnMap = require("../controls/columnMap"); -var _palettes = require("../palettes"); -var _signal = require("../controls/signal"); -var _language = require("../language"); -var _group = require("../controls/group"); -function Color(props) { - const colorColumn = props.dataContent.columns.filter((c)=>c.name === props.colorColumn)[0]; - const disabledColorBin = !colorColumn || !colorColumn.quantitative || props.directColor; - const colorBin = props.colorBin || 'quantize'; - const dropdownRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - return (0, _base.base).react.createElement("div", { - className: "sanddance-color-dialog" - }, (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColor - }, (0, _base.base).react.createElement((0, _columnMap.ColumnMap), Object.assign({}, props, { - componentRef: dropdownRef, - collapseLabel: props.compactUI, - selectedColumnName: props.colorColumn, - specRole: props.specCapabilities && props.specCapabilities.roles.filter((r)=>r.role === 'color')[0], - key: 0 - })), colorColumn && colorColumn.isColorData && (0, _base.base).react.createElement("div", { - className: "sanddance-explanation", - dangerouslySetInnerHTML: { - __html: (0, _language.strings).labelColorFieldIsColorData(colorColumn.name) - } - }), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _palettes.Palette), { - collapseLabel: props.compactUI, - scheme: props.scheme, - colorColumn: colorColumn, - changeColorScheme: (scheme)=>{ - props.onColorSchemeChange(scheme); - }, - disabled: props.disabled || props.directColor || colorColumn && colorColumn.isColorData - }), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _signal.Signal), { - disabled: props.disabled || !colorColumn || props.directColor || colorColumn && colorColumn.isColorData, - signal: props.colorReverseSignal, - explorer: props.explorer, - initialValue: (0, _signal.getInitialSignalValue)(props.explorer, props.colorReverseSignal), - onChange: props.onColorReverseChange, - collapseLabel: props.compactUI - })), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColorBin - }, (0, _base.base).react.createElement("div", { - className: "sanddance-explanation" - }, (0, _language.strings).labelColorBinExplanation), (0, _base.base).react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - selectedKey: colorBin, - options: [ - { - key: 'continuous', - text: (0, _language.strings).labelColorBinNone, - disabled: disabledColorBin - }, - { - key: 'quantize', - text: (0, _language.strings).labelColorBinQuantize, - disabled: disabledColorBin - }, - { - key: 'quantile', - text: (0, _language.strings).labelColorBinQuantile, - disabled: disabledColorBin + }; + function identity$3(x2) { + return x2; + } + var map$1 = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; + function formatLocale(locale2) { + var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$3 : formatGroup(map$1.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$3 : formatNumerals(map$1.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; + function newFormat(specifier) { + specifier = formatSpecifier(specifier); + var fill2 = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol2 = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type; + if (type2 === "n") comma = true, type2 = "g"; + else if (!formatTypes[type2]) precision === void 0 && (precision = 12), trim = true, type2 = "g"; + if (zero2 || fill2 === "0" && align === "=") zero2 = true, fill2 = "0", align = "="; + var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; + var formatType = formatTypes[type2], maybeSuffix = /[defgprs%]/.test(type2); + precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format2(value2) { + var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; + if (type2 === "c") { + valueSuffix = formatType(value2) + valueSuffix; + value2 = ""; + } else { + value2 = +value2; + var valueNegative = value2 < 0 || 1 / value2 < 0; + value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); + if (trim) value2 = formatTrim(value2); + if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; + valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); + if (maybeSuffix) { + i = -1, n = value2.length; + while (++i < n) { + if (c2 = value2.charCodeAt(i), 48 > c2 || c2 > 57) { + valueSuffix = (c2 === 46 ? decimal + value2.slice(i + 1) : value2.slice(i)) + valueSuffix; + value2 = value2.slice(0, i); + break; + } } - ], - onChange: (e, o)=>{ - props.onColorBinChange(o.key); - } - }), (0, _base.base).react.createElement((0, _signal.Signal), { - disabled: props.disabled || disabledColorBin || props.colorBin === 'continuous', - signal: props.colorBinSignal, - explorer: props.explorer, - initialValue: (0, _signal.getInitialSignalValue)(props.explorer, props.colorBinSignal), - onChange: props.onColorBinCountChange, - collapseLabel: props.compactUI - })), colorColumn && !colorColumn.isColorData && (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelColorOptions - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).selectDirectColor, - disabled: !colorColumn.stats.hasColorData, - checked: !!(colorColumn.stats.hasColorData && props.directColor), - onChange: (e, checked)=>props.onDirectColorChange(checked) - }), (0, _base.base).react.createElement("div", { - className: "sanddance-explanation", - dangerouslySetInnerHTML: { - __html: (0, _language.strings).labelDataColors + } } - }))); -} - -},{"../base":"3TPz5","../controls/columnMap":"8sojP","../palettes":"2BdAl","../controls/signal":"buTZe","../language":"67xOI","../controls/group":"afKlW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2BdAl":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _base = require("../base"); -var _categorical = require("./categorical"); -var _cyclical = require("./cyclical"); -var _diverging = require("./diverging"); -var _dropdown = require("../controls/dropdown"); -var _dual = require("./dual"); -var _scheme = require("./scheme"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _sequentialMultiHue = require("./sequentialMultiHue"); -var _sequentialSingleHue = require("./sequentialSingleHue"); -var _language = require("../language"); -const maxDistinctColors = 20; -function Palette(props) { - const { distinctValueCount } = props.colorColumn.stats; - const isDual = distinctValueCount === 2; - const categoricalNumeric = distinctValueCount > 0 && distinctValueCount < maxDistinctColors; - let isQualitative = false; - let isQuantitative = false; - switch(props.colorColumn.type){ - case 'boolean': - case 'string': - isQualitative = true; + if (comma && !zero2) value2 = group2(value2, Infinity); + var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) : ""; + if (comma && zero2) value2 = group2(padding2 + value2, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; + switch (align) { + case "<": + value2 = valuePrefix + value2 + valueSuffix + padding2; break; - case 'number': - isQuantitative = true; + case "=": + value2 = valuePrefix + padding2 + value2 + valueSuffix; + break; + case "^": + value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); + break; + default: + value2 = padding2 + valuePrefix + value2 + valueSuffix; break; - case 'date': - case 'integer': - isQuantitative = true; - isQualitative = categoricalNumeric; - } - const selected = props.scheme; - const options = []; - function menu(name, opts) { - if (options.length) options.push({ - key: 'divider' + options.length, - text: null, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Divider - }); - options.push({ - key: name, - text: name, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }); - options.push.apply(options, opts); - } - isQualitative && menu((0, _language.strings).schemeCategorical, (0, _categorical.categorical)(selected)); - isQuantitative && menu((0, _language.strings).schemeSequentialSingleHue, (0, _sequentialSingleHue.sequentialSingleHue)(selected)); - isQuantitative && menu((0, _language.strings).schemeSequentialMultiHue, (0, _sequentialMultiHue.sequentialMultiHue)(selected)); - isQuantitative && menu((0, _language.strings).schemeDiverging, (0, _diverging.diverging)(selected)); - isQuantitative && menu((0, _language.strings).schemeCyclical, (0, _cyclical.cyclical)(selected)); - isDual && menu((0, _language.strings).schemeDual, (0, _dual.dual)(selected)); - return (0, _base.base).react.createElement("div", { - className: "sanddance-palette" - }, (0, _base.base).react.createElement("div", { - className: "sanddance-explanation", - dangerouslySetInnerHTML: { - __html: (0, _language.strings).labelColorFieldInfo(props.colorColumn.name, props.colorColumn.type, categoricalNumeric, distinctValueCount) - } - }), (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - collapseLabel: props.collapseLabel, - disabled: props.disabled, - dropdownWidth: 400, - label: (0, _language.strings).labelColorScheme, - onRenderOption: (option)=>{ - if (option.itemType === (0, _base.base).fluentUI.DropdownMenuItemType.Header) return (0, _base.base).react.createElement("span", null, option.text); - else return (0, _base.base).react.createElement("div", { - className: "sanddance-scheme option" - }, (0, _base.base).react.createElement("span", { - className: "name" - }, option.scheme), option.children); - }, - options: options, - onChange: (e, o)=>{ - props.changeColorScheme(o.scheme); - } - }), (0, _base.base).react.createElement("div", { - className: (0, _sanddanceReact.util).classList('sanddance-scheme', props.disabled && 'disabled') - }, props.scheme && (0, _scheme.schemesJSX)[props.scheme])); -} - -},{"../base":"3TPz5","./categorical":"iU6ln","./cyclical":"l6Ur3","./diverging":"89PRK","../controls/dropdown":"7pP8h","./dual":"gLg9j","./scheme":"efDez","@msrvida/sanddance-react":"lPyTZ","./sequentialMultiHue":"1y9LK","./sequentialSingleHue":"2GC64","../language":"67xOI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iU6ln":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "categorical", ()=>categorical); -var _base = require("../base"); -var _scheme = require("./scheme"); -const p8 = `${12.5}%`; -const p9 = `${100 / 9}%`; -const p10 = `${10}%`; -const p12 = `${100 / 12}%`; -const p20 = `${5}%`; -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['accent'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#7fc97f", - style: { - width: p8, - background: 'rgb(127, 201, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#beaed4", - style: { - width: p8, - background: 'rgb(190, 174, 212)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdc086", - style: { - width: p8, - background: 'rgb(253, 192, 134)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffff99", - style: { - width: p8, - background: 'rgb(255, 255, 153)' - } - }), (0, _base.base).react.createElement("div", { - title: "#386cb0", - style: { - width: p8, - background: 'rgb(56, 108, 176)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f0027f", - style: { - width: p8, - background: 'rgb(240, 2, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bf5b17", - style: { - width: p8, - background: 'rgb(191, 91, 23)' - } - }), (0, _base.base).react.createElement("div", { - title: "#666666", - style: { - width: p8, - background: 'rgb(102, 102, 102)' - } - })); - (0, _scheme.schemesJSX)['category10'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#1f77b4", - style: { - width: p10, - background: 'rgb(31, 119, 180)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f0e", - style: { - width: p10, - background: 'rgb(255, 127, 14)' - } - }), (0, _base.base).react.createElement("div", { - title: "#2ca02c", - style: { - width: p10, - background: 'rgb(44, 160, 44)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d62728", - style: { - width: p10, - background: 'rgb(214, 39, 40)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9467bd", - style: { - width: p10, - background: 'rgb(148, 103, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8c564b", - style: { - width: p10, - background: 'rgb(140, 86, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e377c2", - style: { - width: p10, - background: 'rgb(227, 119, 194)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7f7f7f", - style: { - width: p10, - background: 'rgb(127, 127, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bcbd22", - style: { - width: p10, - background: 'rgb(188, 189, 34)' - } - }), (0, _base.base).react.createElement("div", { - title: "#17becf", - style: { - width: p10, - background: 'rgb(23, 190, 207)' - } - })); - (0, _scheme.schemesJSX)['category20'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#1f77b4", - style: { - width: p20, - background: 'rgb(31, 119, 180)' - } - }), (0, _base.base).react.createElement("div", { - title: "#aec7e8", - style: { - width: p20, - background: 'rgb(174, 199, 232)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f0e", - style: { - width: p20, - background: 'rgb(255, 127, 14)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffbb78", - style: { - width: p20, - background: 'rgb(255, 187, 120)' - } - }), (0, _base.base).react.createElement("div", { - title: "#2ca02c", - style: { - width: p20, - background: 'rgb(44, 160, 44)' - } - }), (0, _base.base).react.createElement("div", { - title: "#98df8a", - style: { - width: p20, - background: 'rgb(152, 223, 138)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d62728", - style: { - width: p20, - background: 'rgb(214, 39, 40)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff9896", - style: { - width: p20, - background: 'rgb(255, 152, 150)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9467bd", - style: { - width: p20, - background: 'rgb(148, 103, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c5b0d5", - style: { - width: p20, - background: 'rgb(197, 176, 213)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8c564b", - style: { - width: p20, - background: 'rgb(140, 86, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c49c94", - style: { - width: p20, - background: 'rgb(196, 156, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e377c2", - style: { - width: p20, - background: 'rgb(227, 119, 194)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f7b6d2", - style: { - width: p20, - background: 'rgb(247, 182, 210)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7f7f7f", - style: { - width: p20, - background: 'rgb(127, 127, 127)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c7c7c7", - style: { - width: p20, - background: 'rgb(199, 199, 199)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bcbd22", - style: { - width: p20, - background: 'rgb(188, 189, 34)' - } - }), (0, _base.base).react.createElement("div", { - title: "#dbdb8d", - style: { - width: p20, - background: 'rgb(219, 219, 141)' - } - }), (0, _base.base).react.createElement("div", { - title: "#17becf", - style: { - width: p20, - background: 'rgb(23, 190, 207)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9edae5", - style: { - width: p20, - background: 'rgb(158, 218, 229)' - } - })); - (0, _scheme.schemesJSX)['category20b'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#393b79", - style: { - width: p20, - background: 'rgb(57, 59, 121)' - } - }), (0, _base.base).react.createElement("div", { - title: "#5254a3", - style: { - width: p20, - background: 'rgb(82, 84, 163)' - } - }), (0, _base.base).react.createElement("div", { - title: "#6b6ecf", - style: { - width: p20, - background: 'rgb(107, 110, 207)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9c9ede", - style: { - width: p20, - background: 'rgb(156, 158, 222)' - } - }), (0, _base.base).react.createElement("div", { - title: "#637939", - style: { - width: p20, - background: 'rgb(99, 121, 57)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8ca252", - style: { - width: p20, - background: 'rgb(140, 162, 82)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b5cf6b", - style: { - width: p20, - background: 'rgb(181, 207, 107)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cedb9c", - style: { - width: p20, - background: 'rgb(206, 219, 156)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8c6d31", - style: { - width: p20, - background: 'rgb(140, 109, 49)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bd9e39", - style: { - width: p20, - background: 'rgb(189, 158, 57)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7ba52", - style: { - width: p20, - background: 'rgb(231, 186, 82)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7cb94", - style: { - width: p20, - background: 'rgb(231, 203, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#843c39", - style: { - width: p20, - background: 'rgb(132, 60, 57)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ad494a", - style: { - width: p20, - background: 'rgb(173, 73, 74)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d6616b", - style: { - width: p20, - background: 'rgb(214, 97, 107)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7969c", - style: { - width: p20, - background: 'rgb(231, 150, 156)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7b4173", - style: { - width: p20, - background: 'rgb(123, 65, 115)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a55194", - style: { - width: p20, - background: 'rgb(165, 81, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ce6dbd", - style: { - width: p20, - background: 'rgb(206, 109, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#de9ed6", - style: { - width: p20, - background: 'rgb(222, 158, 214)' - } - })); - (0, _scheme.schemesJSX)['category20c'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#3182bd", - style: { - width: p20, - background: 'rgb(49, 130, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#6baed6", - style: { - width: p20, - background: 'rgb(107, 174, 214)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9ecae1", - style: { - width: p20, - background: 'rgb(158, 202, 225)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c6dbef", - style: { - width: p20, - background: 'rgb(198, 219, 239)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e6550d", - style: { - width: p20, - background: 'rgb(230, 85, 13)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fd8d3c", - style: { - width: p20, - background: 'rgb(253, 141, 60)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdae6b", - style: { - width: p20, - background: 'rgb(253, 174, 107)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdd0a2", - style: { - width: p20, - background: 'rgb(253, 208, 162)' - } - }), (0, _base.base).react.createElement("div", { - title: "#31a354", - style: { - width: p20, - background: 'rgb(49, 163, 84)' - } - }), (0, _base.base).react.createElement("div", { - title: "#74c476", - style: { - width: p20, - background: 'rgb(116, 196, 118)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a1d99b", - style: { - width: p20, - background: 'rgb(161, 217, 155)' - } - }), (0, _base.base).react.createElement("div", { - title: "#c7e9c0", - style: { - width: p20, - background: 'rgb(199, 233, 192)' - } - }), (0, _base.base).react.createElement("div", { - title: "#756bb1", - style: { - width: p20, - background: 'rgb(117, 107, 177)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9e9ac8", - style: { - width: p20, - background: 'rgb(158, 154, 200)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bcbddc", - style: { - width: p20, - background: 'rgb(188, 189, 220)' - } - }), (0, _base.base).react.createElement("div", { - title: "#dadaeb", - style: { - width: p20, - background: 'rgb(218, 218, 235)' - } - }), (0, _base.base).react.createElement("div", { - title: "#636363", - style: { - width: p20, - background: 'rgb(99, 99, 99)' - } - }), (0, _base.base).react.createElement("div", { - title: "#969696", - style: { - width: p20, - background: 'rgb(150, 150, 150)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bdbdbd", - style: { - width: p20, - background: 'rgb(189, 189, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d9d9d9", - style: { - width: p20, - background: 'rgb(217, 217, 217)' - } - })); - (0, _scheme.schemesJSX)['dark2'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#1b9e77", - style: { - width: p8, - background: 'rgb(27, 158, 119)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d95f02", - style: { - width: p8, - background: 'rgb(217, 95, 2)' - } - }), (0, _base.base).react.createElement("div", { - title: "#7570b3", - style: { - width: p8, - background: 'rgb(117, 112, 179)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e7298a", - style: { - width: p8, - background: 'rgb(231, 41, 138)' - } - }), (0, _base.base).react.createElement("div", { - title: "#66a61e", - style: { - width: p8, - background: 'rgb(102, 166, 30)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e6ab02", - style: { - width: p8, - background: 'rgb(230, 171, 2)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a6761d", - style: { - width: p8, - background: 'rgb(166, 118, 29)' - } - }), (0, _base.base).react.createElement("div", { - title: "#666666", - style: { - width: p8, - background: 'rgb(102, 102, 102)' - } - })); - (0, _scheme.schemesJSX)['paired'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#a6cee3", - style: { - width: p12, - background: 'rgb(166, 206, 227)' - } - }), (0, _base.base).react.createElement("div", { - title: "#1f78b4", - style: { - width: p12, - background: 'rgb(31, 120, 180)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b2df8a", - style: { - width: p12, - background: 'rgb(178, 223, 138)' - } - }), (0, _base.base).react.createElement("div", { - title: "#33a02c", - style: { - width: p12, - background: 'rgb(51, 160, 44)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fb9a99", - style: { - width: p12, - background: 'rgb(251, 154, 153)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e31a1c", - style: { - width: p12, - background: 'rgb(227, 26, 28)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdbf6f", - style: { - width: p12, - background: 'rgb(253, 191, 111)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f00", - style: { - width: p12, - background: 'rgb(255, 127, 0)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cab2d6", - style: { - width: p12, - background: 'rgb(202, 178, 214)' - } - }), (0, _base.base).react.createElement("div", { - title: "#6a3d9a", - style: { - width: p12, - background: 'rgb(106, 61, 154)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffff99", - style: { - width: p12, - background: 'rgb(255, 255, 153)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b15928", - style: { - width: p12, - background: 'rgb(177, 89, 40)' } - })); - (0, _scheme.schemesJSX)['pastel1'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#fbb4ae", - style: { - width: p9, - background: 'rgb(251, 180, 174)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b3cde3", - style: { - width: p9, - background: 'rgb(179, 205, 227)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ccebc5", - style: { - width: p9, - background: 'rgb(204, 235, 197)' - } - }), (0, _base.base).react.createElement("div", { - title: "#decbe4", - style: { - width: p9, - background: 'rgb(222, 203, 228)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fed9a6", - style: { - width: p9, - background: 'rgb(254, 217, 166)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffffcc", - style: { - width: p9, - background: 'rgb(255, 255, 204)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e5d8bd", - style: { - width: p9, - background: 'rgb(229, 216, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fddaec", - style: { - width: p9, - background: 'rgb(253, 218, 236)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f2f2f2", - style: { - width: p9, - background: 'rgb(242, 242, 242)' + return numerals(value2); + } + format2.toString = function() { + return specifier + ""; + }; + return format2; + } + function formatPrefix2(specifier, value2) { + var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value2) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; + return function(value3) { + return f(k * value3) + prefix; + }; + } + return { + format: newFormat, + formatPrefix: formatPrefix2 + }; + } + var locale$1; + var format$3; + defaultLocale$1({ + decimal: ".", + thousands: ",", + grouping: [3], + currency: ["$", ""], + minus: "-" + }); + function defaultLocale$1(definition2) { + locale$1 = formatLocale(definition2); + format$3 = locale$1.format; + locale$1.formatPrefix; + return locale$1; + } + var DataScopeId; + (function(DataScopeId2) { + DataScopeId2[DataScopeId2["AllData"] = 0] = "AllData"; + DataScopeId2[DataScopeId2["SelectedData"] = 1] = "SelectedData"; + DataScopeId2[DataScopeId2["FilteredData"] = 2] = "FilteredData"; + })(DataScopeId || (DataScopeId = {})); + function resetSelectedItemIndex(selectedItemIndex) { + selectedItemIndex[DataScopeId.AllData] = 0; + selectedItemIndex[DataScopeId.FilteredData] = 0; + selectedItemIndex[DataScopeId.SelectedData] = 0; + } + const shortFormat = format$3(".2~s"); + function short(n) { + return n === -1 ? "--" : n ? n < 1e3 ? n.toString() : shortFormat(n) : "0"; + } + function DataScope$1(props) { + const dataCount = Object.assign({ all: -1, filtered: -1, selected: -1 }, props.dataCount); + return props.compact ? base$1.react.createElement( + "div", + { className: classList("sanddance-datascope", "compact"), onClick: props.onCompactClick }, + base$1.react.createElement(Compact, Object.assign({}, props, { dataScopeId: DataScopeId.AllData, text: strings$1.selectDataSpanAll, count: dataCount.all })), + base$1.react.createElement(Compact, Object.assign({}, props, { dataScopeId: DataScopeId.FilteredData, text: strings$1.selectDataSpanFilter, count: dataCount.filtered })), + base$1.react.createElement(Compact, Object.assign({}, props, { dataScopeId: DataScopeId.SelectedData, text: strings$1.selectDataSpanSelection, count: dataCount.selected })) + ) : base$1.react.createElement( + "div", + { className: classList("sanddance-datascope", "extended", props.active && "active") }, + base$1.react.createElement( + "div", + null, + base$1.react.createElement("div", null, props.dataSet), + base$1.react.createElement( + "div", + { className: "datascope-buttons" }, + base$1.react.createElement(DataScopeButton, Object.assign({}, props, { dataScopeId: DataScopeId.AllData, text: strings$1.selectDataSpanAll, count: dataCount.all })), + base$1.react.createElement(DataScopeButton, Object.assign({}, props, { dataScopeId: DataScopeId.FilteredData, text: strings$1.selectDataSpanFilter, count: dataCount.filtered })), + base$1.react.createElement(DataScopeButton, Object.assign({}, props, { dataScopeId: DataScopeId.SelectedData, text: strings$1.selectDataSpanSelection, count: dataCount.selected })) + ) + ) + ); + } + function Compact(props) { + return base$1.react.createElement("div", { title: props.text, onClick: () => { + props.onDataScopeClick(props.dataScopeId); + } }, short(props.count)); + } + function DataScopeButton(props) { + return base$1.react.createElement(Button, { themePalette: props.themePalette, className: classList("datascope-button", props.selectedDataScope === props.dataScopeId && "selected"), disabled: props.disabled, text: props.text, onClick: () => { + props.onDataScopeClick(props.dataScopeId); + }, onRenderText: () => { + return base$1.react.createElement( + "div", + { title: props.count > 0 ? props.count.toString() : "" }, + base$1.react.createElement("label", null, props.text), + base$1.react.createElement("div", null, short(props.count)) + ); + }, onRenderIcon: () => null }); + } + function Scrollable(props) { + return base$1.react.createElement( + "div", + { className: classList("scrollable-container", props.className), role: props.role }, + base$1.react.createElement("div", { className: "scrollable" }, props.children) + ); + } + var SideTabId; + (function(SideTabId2) { + SideTabId2[SideTabId2["ChartType"] = 0] = "ChartType"; + SideTabId2[SideTabId2["Data"] = 1] = "Data"; + SideTabId2[SideTabId2["Search"] = 2] = "Search"; + SideTabId2[SideTabId2["Color"] = 3] = "Color"; + SideTabId2[SideTabId2["Snapshots"] = 4] = "Snapshots"; + SideTabId2[SideTabId2["History"] = 5] = "History"; + SideTabId2[SideTabId2["Transition"] = 6] = "Transition"; + SideTabId2[SideTabId2["Settings"] = 7] = "Settings"; + SideTabId2[SideTabId2["Pin"] = 8] = "Pin"; + SideTabId2[SideTabId2["Collapse"] = 9] = "Collapse"; + })(SideTabId || (SideTabId = {})); + function Sidebutton(props) { + const selected = !props.closed && props.selectedSideTab === props.sideTabId; + const buttonProps = props.omitAriaSelected ? {} : { + "aria-selected": selected + }; + return base$1.react.createElement( + "div", + { className: classList("vbutton", selected && "selected") }, + props.badgeText && base$1.react.createElement("div", { className: "count" }, props.badgeText), + base$1.react.createElement(IconButton$1, Object.assign({}, buttonProps, { role: props.role || "tab", themePalette: props.themePalette, className: "vbutton", iconName: props.iconName, title: props.title, onClick: () => { + props.onSideTabClick(props.sideTabId); + } })) + ); + } + function Sidebar(props) { + const sidebuttons = [ + { + sideTabId: SideTabId.ChartType, + iconName: "BIDashboard", + title: strings$1.labelChart + }, + { + sideTabId: SideTabId.Color, + iconName: "Color", + title: strings$1.labelColor + }, + { + sideTabId: SideTabId.Data, + iconName: "Table", + title: strings$1.labelDataBrowser + }, + { + sideTabId: SideTabId.Search, + iconName: "Search", + title: strings$1.labelSearch + }, + !props.snapshotsHidden && { + sideTabId: SideTabId.Snapshots, + iconName: "Camera", + title: strings$1.labelSnapshots + }, + { + sideTabId: SideTabId.History, + iconName: "History", + title: strings$1.labelHistory + }, + { + sideTabId: SideTabId.Transition, + iconName: "Flow", + title: strings$1.labelTransition + }, + { + sideTabId: SideTabId.Settings, + iconName: "Settings", + title: strings$1.labelChartSettings + } + ].filter(Boolean); + return base$1.react.createElement( + "div", + { className: classList("sanddance-sidebar", "calculator", props.pinned && "pinned", props.closed && "closed") }, + base$1.react.createElement( + "div", + { className: "sidebar-content" }, + base$1.react.createElement(DataScope$1, Object.assign({}, props.dataScopeProps)), + base$1.react.createElement( + "div", + { className: "vbuttons" }, + base$1.react.createElement("div", { className: "sidebar-dialogs", role: "tablist" }, sidebuttons.map((sidebutton, i) => base$1.react.createElement(Sidebutton, Object.assign({ key: i }, props, sidebutton, { themePalette: props.themePalette })))), + !props.hideSidebarControls && base$1.react.createElement( + "div", + { className: "sidebar-controls" }, + base$1.react.createElement(Sidebutton, Object.assign({}, props, { omitAriaSelected: true, role: "button", sideTabId: SideTabId.Pin, iconName: props.pinned ? "Pinned" : "Pin", title: props.pinned ? strings$1.buttonToolbarFloat : strings$1.buttonToolbarDock })), + base$1.react.createElement(Sidebutton, Object.assign({}, props, { omitAriaSelected: true, role: "button", sideTabId: SideTabId.Collapse, iconName: props.closed ? "DoubleChevronRight12" : "DoubleChevronLeft12", title: props.closed ? strings$1.buttonToolbarShow : strings$1.buttonToolbarHide })) + ) + ), + base$1.react.createElement( + Scrollable, + { role: "tabpanel" }, + base$1.react.createElement("div", { className: "sidetab" }, props.children) + ), + props.calculating && base$1.react.createElement( + "div", + { className: "calculating" }, + base$1.react.createElement(base$1.fluentUI.Spinner, { size: base$1.fluentUI.SpinnerSize.large }) + ) + ) + ); + } + const CommandBarButtonStyles = (props) => { + const { theme } = props; + if (!theme) { + throw new Error("Theme is undefined or null."); + } + const { palette, semanticColors } = theme; + const BUTTON_ICON_CLASSNAME = ".ms-Button-icon"; + return { + root: [ + Object.assign({}, base$1.fluentUI.getFocusStyle(theme, { inset: 2 })), + { + backgroundColor: palette.white } - })); - (0, _scheme.schemesJSX)['pastel2'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#b3e2cd", - style: { - width: p8, - background: 'rgb(179, 226, 205)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdcdac", - style: { - width: p8, - background: 'rgb(253, 205, 172)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cbd5e8", - style: { - width: p8, - background: 'rgb(203, 213, 232)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f4cae4", - style: { - width: p8, - background: 'rgb(244, 202, 228)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e6f5c9", - style: { - width: p8, - background: 'rgb(230, 245, 201)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fff2ae", - style: { - width: p8, - background: 'rgb(255, 242, 174)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f1e2cc", - style: { - width: p8, - background: 'rgb(241, 226, 204)' - } - }), (0, _base.base).react.createElement("div", { - title: "#cccccc", - style: { - width: p8, - background: 'rgb(204, 204, 204)' + ], + rootHovered: { + backgroundColor: palette.neutralLighter, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDarkAlt + } } - })); - (0, _scheme.schemesJSX)['set1'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#e41a1c", - style: { - width: p9, - background: 'rgb(228, 26, 28)' - } - }), (0, _base.base).react.createElement("div", { - title: "#377eb8", - style: { - width: p9, - background: 'rgb(55, 126, 184)' - } - }), (0, _base.base).react.createElement("div", { - title: "#4daf4a", - style: { - width: p9, - background: 'rgb(77, 175, 74)' - } - }), (0, _base.base).react.createElement("div", { - title: "#984ea3", - style: { - width: p9, - background: 'rgb(152, 78, 163)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff7f00", - style: { - width: p9, - background: 'rgb(255, 127, 0)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffff33", - style: { - width: p9, - background: 'rgb(255, 255, 51)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a65628", - style: { - width: p9, - background: 'rgb(166, 86, 40)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f781bf", - style: { - width: p9, - background: 'rgb(247, 129, 191)' - } - }), (0, _base.base).react.createElement("div", { - title: "#999999", - style: { - width: p9, - background: 'rgb(153, 153, 153)' + }, + rootPressed: { + backgroundColor: palette.neutralLight, + color: palette.neutralDark, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDark + } } - })); - (0, _scheme.schemesJSX)['set2'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#66c2a5", - style: { - width: p8, - background: 'rgb(102, 194, 165)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fc8d62", - style: { - width: p8, - background: 'rgb(252, 141, 98)' - } - }), (0, _base.base).react.createElement("div", { - title: "#8da0cb", - style: { - width: p8, - background: 'rgb(141, 160, 203)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e78ac3", - style: { - width: p8, - background: 'rgb(231, 138, 195)' - } - }), (0, _base.base).react.createElement("div", { - title: "#a6d854", - style: { - width: p8, - background: 'rgb(166, 216, 84)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffd92f", - style: { - width: p8, - background: 'rgb(255, 217, 47)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e5c494", - style: { - width: p8, - background: 'rgb(229, 196, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b3b3b3", - style: { - width: p8, - background: 'rgb(179, 179, 179)' + }, + rootChecked: { + backgroundColor: palette.neutralLight, + color: palette.neutralDark, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDark + } } - })); - (0, _scheme.schemesJSX)['set3'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#8dd3c7", - style: { - width: p12, - background: 'rgb(141, 211, 199)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffffb3", - style: { - width: p12, - background: 'rgb(255, 255, 179)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bebada", - style: { - width: p12, - background: 'rgb(190, 186, 218)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fb8072", - style: { - width: p12, - background: 'rgb(251, 128, 114)' - } - }), (0, _base.base).react.createElement("div", { - title: "#80b1d3", - style: { - width: p12, - background: 'rgb(128, 177, 211)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fdb462", - style: { - width: p12, - background: 'rgb(253, 180, 98)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b3de69", - style: { - width: p12, - background: 'rgb(179, 222, 105)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fccde5", - style: { - width: p12, - background: 'rgb(252, 205, 229)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d9d9d9", - style: { - width: p12, - background: 'rgb(217, 217, 217)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bc80bd", - style: { - width: p12, - background: 'rgb(188, 128, 189)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ccebc5", - style: { - width: p12, - background: 'rgb(204, 235, 197)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffed6f", - style: { - width: p12, - background: 'rgb(255, 237, 111)' + }, + rootCheckedHovered: { + backgroundColor: palette.neutralQuaternaryAlt, + color: palette.neutralDark + }, + rootExpanded: { + color: palette.neutralDark, + backgroundColor: palette.neutralLight, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.themeDark + } } - })); - (0, _scheme.schemesJSX)['tableau10'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#4c78a8", - style: { - width: p10, - background: 'rgb(76, 120, 168)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f58518", - style: { - width: p10, - background: 'rgb(245, 133, 24)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e45756", - style: { - width: p10, - background: 'rgb(228, 87, 86)' - } - }), (0, _base.base).react.createElement("div", { - title: "#72b7b2", - style: { - width: p10, - background: 'rgb(114, 183, 178)' - } - }), (0, _base.base).react.createElement("div", { - title: "#54a24b", - style: { - width: p10, - background: 'rgb(84, 162, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#eeca3b", - style: { - width: p10, - background: 'rgb(238, 202, 59)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b279a2", - style: { - width: p10, - background: 'rgb(178, 121, 162)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff9da6", - style: { - width: p10, - background: 'rgb(255, 157, 166)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9d755d", - style: { - width: p10, - background: 'rgb(157, 117, 93)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bab0ac", - style: { - width: p10, - background: 'rgb(186, 176, 172)' + }, + rootExpandedHovered: { + background: palette.neutralQuaternaryAlt + }, + rootDisabled: { + backgroundColor: palette.white, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: semanticColors.disabledBodySubtext + } } - })); - (0, _scheme.schemesJSX)['tableau20'] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, (0, _base.base).react.createElement("div", { - title: "#4c78a8", - style: { - width: p20, - background: 'rgb(76, 120, 168)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9ecae9", - style: { - width: p20, - background: 'rgb(158, 202, 233)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f58518", - style: { - width: p20, - background: 'rgb(245, 133, 24)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ffbf79", - style: { - width: p20, - background: 'rgb(255, 191, 121)' - } - }), (0, _base.base).react.createElement("div", { - title: "#54a24b", - style: { - width: p20, - background: 'rgb(84, 162, 75)' - } - }), (0, _base.base).react.createElement("div", { - title: "#88d27a", - style: { - width: p20, - background: 'rgb(136, 210, 122)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b79a20", - style: { - width: p20, - background: 'rgb(183, 154, 32)' - } - }), (0, _base.base).react.createElement("div", { - title: "#f2cf5b", - style: { - width: p20, - background: 'rgb(242, 207, 91)' - } - }), (0, _base.base).react.createElement("div", { - title: "#439894", - style: { - width: p20, - background: 'rgb(67, 152, 148)' - } - }), (0, _base.base).react.createElement("div", { - title: "#83bcb6", - style: { - width: p20, - background: 'rgb(131, 188, 182)' - } - }), (0, _base.base).react.createElement("div", { - title: "#e45756", - style: { - width: p20, - background: 'rgb(228, 87, 86)' - } - }), (0, _base.base).react.createElement("div", { - title: "#ff9d98", - style: { - width: p20, - background: 'rgb(255, 157, 152)' - } - }), (0, _base.base).react.createElement("div", { - title: "#79706e", - style: { - width: p20, - background: 'rgb(121, 112, 110)' - } - }), (0, _base.base).react.createElement("div", { - title: "#bab0ac", - style: { - width: p20, - background: 'rgb(186, 176, 172)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d67195", - style: { - width: p20, - background: 'rgb(214, 113, 149)' - } - }), (0, _base.base).react.createElement("div", { - title: "#fcbfd2", - style: { - width: p20, - background: 'rgb(252, 191, 210)' - } - }), (0, _base.base).react.createElement("div", { - title: "#b279a2", - style: { - width: p20, - background: 'rgb(178, 121, 162)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d6a5c9", - style: { - width: p20, - background: 'rgb(214, 165, 201)' - } - }), (0, _base.base).react.createElement("div", { - title: "#9e765f", - style: { - width: p20, - background: 'rgb(158, 118, 95)' - } - }), (0, _base.base).react.createElement("div", { - title: "#d8b5a5", - style: { - width: p20, - background: 'rgb(216, 181, 165)' + }, + splitButtonMenuButton: { + backgroundColor: palette.white, + color: palette.neutralSecondary, + selectors: { + ":hover": { + backgroundColor: palette.neutralLighter, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.neutralPrimary + } + } + }, + ":active": { + backgroundColor: palette.neutralLight, + selectors: { + [BUTTON_ICON_CLASSNAME]: { + color: palette.neutralPrimary + } + } + } } - })); - loaded = true; -} -function categorical(selected) { - if (!loaded) load(); - return [ - (0, _scheme.schemeOption)(selected, 'accent'), - (0, _scheme.schemeOption)(selected, 'category10'), - (0, _scheme.schemeOption)(selected, 'category20'), - (0, _scheme.schemeOption)(selected, 'category20b'), - (0, _scheme.schemeOption)(selected, 'category20c'), - (0, _scheme.schemeOption)(selected, 'dark2'), - (0, _scheme.schemeOption)(selected, 'paired'), - (0, _scheme.schemeOption)(selected, 'pastel1'), - (0, _scheme.schemeOption)(selected, 'pastel2'), - (0, _scheme.schemeOption)(selected, 'set1'), - (0, _scheme.schemeOption)(selected, 'set2'), - (0, _scheme.schemeOption)(selected, 'set3'), - (0, _scheme.schemeOption)(selected, 'tableau10'), - (0, _scheme.schemeOption)(selected, 'tableau20') - ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"efDez":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "schemeOption", ()=>schemeOption); -parcelHelpers.export(exports, "schemeHeader", ()=>schemeHeader); -parcelHelpers.export(exports, "schemesJSX", ()=>schemesJSX); -var _base = require("../base"); -function schemeOption(selected, scheme) { - return { - key: scheme, - text: scheme, - selected: selected === scheme, - scheme: scheme, - children: schemesJSX[scheme] - }; -} -function schemeHeader(key, text) { - return { - key, - text, - itemType: (0, _base.base).fluentUI.DropdownMenuItemType.Header - }; -} -const schemesJSX = {}; - -},{"../base":"3TPz5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l6Ur3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cyclical", ()=>cyclical); -var _base = require("../base"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['rainbow'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-rainbow" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#6e40aa" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#bf3caf" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#fe4b83" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#ff7847" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#e2b72f" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#aff05b" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#52f667" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#1ddfa3" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#23abd8" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#4c6edb" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#6e40aa" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-rainbow)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['sinebow'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-sinebow" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#ff4040" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#e78d0b" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#a7d503" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#58fc2a" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#18f472" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#00bfbf" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#1872f4" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#582afc" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#a703d5" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#e70b8d" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ff4040" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-sinebow)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function cyclical(selected) { - if (!loaded) load(); - return [ - (0, _scheme.schemeOption)(selected, 'rainbow'), - (0, _scheme.schemeOption)(selected, 'sinebow') - ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"89PRK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "diverging", ()=>diverging); -var _base = require("../base"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['blueorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-blueorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(5, 48, 97)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(34, 101, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(75, 148, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(143, 194, 221)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(205, 227, 238)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(242, 240, 235)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(253, 221, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(248, 182, 100)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(221, 132, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(178, 90, 9)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 59, 8)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-blueorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['brownbluegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-brownbluegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(84, 48, 5)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(139, 84, 15)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(188, 132, 53)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(222, 190, 123)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(242, 228, 192)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(238, 241, 234)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(195, 231, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(127, 201, 191)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(57, 152, 143)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(10, 103, 95)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 60, 48)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-brownbluegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purplegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purplegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(64, 0, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(115, 47, 128)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(154, 109, 170)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(193, 164, 205)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(228, 210, 230)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(239, 240, 239)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(214, 238, 209)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(162, 215, 158)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(92, 173, 101)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(33, 120, 57)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 68, 27)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purplegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['pinkyellowgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-pinkyellowgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(142, 1, 82)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(192, 38, 126)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(221, 114, 173)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(240, 179, 214)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(250, 221, 237)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(245, 243, 239)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(225, 242, 202)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(182, 222, 135)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(128, 187, 71)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(79, 145, 37)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(39, 100, 25)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-pinkyellowgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purpleorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purpleorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(45, 0, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(85, 45, 132)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(129, 112, 172)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(176, 170, 208)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(215, 215, 233)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(243, 238, 234)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(253, 221, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(248, 182, 100)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(221, 132, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(178, 90, 9)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 59, 8)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purpleorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(103, 0, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(172, 32, 47)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 96, 80)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(241, 163, 133)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(251, 215, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(242, 239, 238)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(205, 227, 238)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(143, 194, 221)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(75, 148, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(34, 101, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(5, 48, 97)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redgrey'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redgrey" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(103, 0, 31)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(172, 32, 47)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 96, 80)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(241, 163, 133)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(252, 216, 197)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(250, 244, 241)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(223, 223, 223)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(184, 184, 184)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(134, 134, 134)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(78, 78, 78)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(26, 26, 26)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redgrey)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redyellowblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redyellowblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(165, 0, 38)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(212, 50, 44)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(241, 110, 67)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 172, 100)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 221, 144)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(250, 248, 193)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(220, 241, 236)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(171, 214, 232)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(117, 171, 208)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(74, 116, 180)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(49, 54, 149)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redyellowblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redyellowgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redyellowgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(165, 0, 38)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(212, 50, 44)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(241, 110, 67)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 172, 99)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 221, 141)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(249, 247, 174)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(215, 238, 142)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(164, 216, 110)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(100, 188, 97)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(34, 150, 79)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 104, 55)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redyellowgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['spectral'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-spectral" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(158, 1, 66)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(209, 60, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(240, 112, 74)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 172, 99)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 221, 141)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(251, 248, 176)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(224, 243, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(169, 221, 162)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(105, 189, 169)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(66, 136, 181)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(94, 79, 162)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-spectral)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function diverging(selected) { - if (!loaded) load(); - return [ - (0, _scheme.schemeOption)(selected, 'blueorange'), - (0, _scheme.schemeOption)(selected, 'brownbluegreen'), - (0, _scheme.schemeOption)(selected, 'purplegreen'), - (0, _scheme.schemeOption)(selected, 'pinkyellowgreen'), - (0, _scheme.schemeOption)(selected, 'purpleorange'), - (0, _scheme.schemeOption)(selected, 'redblue'), - (0, _scheme.schemeOption)(selected, 'redgrey'), - (0, _scheme.schemeOption)(selected, 'redyellowblue'), - (0, _scheme.schemeOption)(selected, 'redyellowgreen'), - (0, _scheme.schemeOption)(selected, 'spectral') - ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gLg9j":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dual", ()=>dual); -var _base = require("../base"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _sanddanceReact.SandDance).colorSchemes.filter((cs)=>cs.colors.length === 2).map((binaryScheme, i)=>{ - (0, _scheme.schemesJSX)[binaryScheme.scheme] = (0, _base.base).react.createElement("div", { - className: "swatch" - }, binaryScheme.colors.map((color, j)=>(0, _base.base).react.createElement("div", { - key: j, - title: color, - style: { - width: '50%', - backgroundColor: color - } - }))); - }); - loaded = true; -} -function dual(selected) { - if (!loaded) load(); - return (0, _sanddanceReact.SandDance).colorSchemes.filter((cs)=>cs.colors.length === 2).map((binaryScheme, i)=>(0, _scheme.schemeOption)(selected, binaryScheme.scheme)); -} - -},{"../base":"3TPz5","@msrvida/sanddance-react":"lPyTZ","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1y9LK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sequentialMultiHue", ()=>sequentialMultiHue); -var _base = require("../base"); -var _language = require("../language"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['viridis'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-viridis" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#440154" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#482475" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#414487" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#355f8d" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#2a788e" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#21918c" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#22a884" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#44bf70" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#7ad151" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#bddf26" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fde725" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-viridis)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['inferno'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-inferno" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#000004" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#160b39" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#420a68" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#6a176e" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#932667" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#bc3754" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#dd513a" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f37819" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fca50a" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#f6d746" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fcffa4" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-inferno)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['magma'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-magma" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#000004" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#140e36" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#3b0f70" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#641a80" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#8c2981" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#b73779" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#de4968" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f7705c" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fe9f6d" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fecf92" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fcfdbf" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-magma)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['plasma'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-plasma" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#0d0887" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#41049d" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#6a00a8" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#8f0da4" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#b12a90" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#cc4778" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#e16462" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f2844b" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fca636" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fcce25" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#f0f921" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-plasma)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['cividis'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-cividis" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#002051" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#0a326a" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#2b446e" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#4d566d" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#696970" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#7f7c75" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#948f78" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ada476" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#caba6a" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ead156" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#fdea45" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-cividis)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['turbo'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-turbo" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#23171b" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#4a58dd" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#2f9df5" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#27d7c4" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#4df884" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#95fb51" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#dedd32" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ffa423" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#f65f18" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ba2208" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#900c00" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-turbo)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['bluegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-bluegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 253)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(232, 246, 249)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 239, 237)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(183, 228, 218)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(143, 211, 193)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(104, 194, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(73, 177, 127)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 153, 89)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(21, 127, 60)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(3, 100, 41)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 68, 27)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-bluegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['bluepurple'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-bluepurple" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 253)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(228, 238, 245)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(204, 221, 236)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(178, 202, 225)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(156, 179, 213)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(143, 149, 198)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(140, 116, 181)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(137, 82, 165)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(133, 45, 143)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(115, 15, 113)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(77, 0, 75)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-bluepurple)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['goldgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-goldgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f4d166" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#d5ca60" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#b6c35c" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#98bb59" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#7cb257" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#60a656" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#4b9c53" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#3f8f4f" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#33834a" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#257740" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#146c36" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-goldgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['goldorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-goldorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f4d166" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#f8be5c" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#f8aa4c" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#f5983b" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#f3852a" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#ef701b" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#e2621f" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#d65322" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#c54923" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#b14223" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#9e3a26" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-goldorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['goldred'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-goldred" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f4d166" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#f6be59" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#f9aa51" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#fc964e" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#f6834b" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#ee734a" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#e56249" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#db5247" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#cf4244" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#c43141" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#b71d3e" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-goldred)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['greenblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-greenblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 240)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(229, 245, 223)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(211, 238, 206)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(189, 229, 191)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(158, 217, 187)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(123, 203, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(88, 183, 205)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(57, 156, 198)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(29, 126, 183)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(11, 96, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(8, 64, 129)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-greenblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['orangered'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-orangered" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 236)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(254, 235, 207)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(253, 220, 175)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(253, 202, 148)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(253, 176, 122)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(250, 142, 93)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(241, 108, 73)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(224, 69, 48)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(200, 29, 19)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(167, 4, 3)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 0, 0)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-orangered)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purplebluegreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purplebluegreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 251)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(239, 231, 242)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(219, 216, 234)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(190, 201, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(152, 185, 217)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(105, 168, 207)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(64, 150, 192)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(25, 135, 159)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(3, 120, 119)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(1, 99, 83)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(1, 70, 54)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purplebluegreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purpleblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purpleblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 251)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(239, 234, 244)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(219, 218, 235)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(191, 201, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(155, 185, 217)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(114, 168, 207)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(67, 148, 195)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(26, 125, 182)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(6, 103, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(4, 82, 129)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(2, 56, 88)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purpleblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purplered'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purplered" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 244, 249)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(234, 227, 240)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(220, 201, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(208, 170, 210)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(208, 138, 194)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(221, 99, 174)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(227, 56, 144)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(215, 28, 108)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(183, 11, 79)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(143, 2, 58)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(103, 0, 31)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purplered)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['redpurple'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-redpurple" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 247, 243)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(253, 228, 225)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(252, 207, 204)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(251, 181, 188)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(249, 147, 176)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(243, 105, 163)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(224, 62, 152)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(192, 23, 136)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(153, 3, 124)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(112, 1, 116)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(73, 0, 106)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-redpurple)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yellowgreenblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yellowgreenblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 217)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(239, 249, 189)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(213, 238, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(169, 221, 183)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(115, 201, 189)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(69, 180, 194)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(40, 151, 191)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(32, 115, 178)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(35, 78, 160)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(28, 49, 133)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(8, 29, 88)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yellowgreenblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yellowgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yellowgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 229)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(247, 252, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(228, 244, 172)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(199, 232, 155)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(162, 216, 138)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(120, 197, 120)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(78, 175, 99)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 148, 78)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(21, 121, 63)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(3, 96, 52)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 69, 41)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yellowgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yelloworangebrown'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yelloworangebrown" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 229)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(255, 248, 196)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(254, 234, 161)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(254, 214, 118)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 186, 74)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(251, 153, 44)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(238, 121, 24)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(216, 91, 10)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(183, 67, 4)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(143, 50, 4)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(102, 37, 6)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yelloworangebrown)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['yelloworangered'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-yelloworangered" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 204)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(255, 240, 169)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(254, 224, 135)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(254, 201, 101)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(254, 171, 75)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(253, 137, 60)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(250, 92, 46)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(236, 48, 35)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(211, 17, 33)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(175, 2, 37)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(128, 0, 38)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-yelloworangered)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#323232" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#2e4463" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#1e588a" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#086da7" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#0082b9" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#039ac7" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#12b1d4" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#2bc8e2" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#3ddff0" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#61f4fb" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffff" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkgold'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkgold" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#3c3c3c" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#554a38" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#6d5a35" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#846f32" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#a0832d" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#bf9828" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#dbb022" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f0cb23" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#fae241" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fff290" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffff" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkgold)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkgreen'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkgreen" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#3a3a3a" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#245447" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#076a4c" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#038145" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#2d9642" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#5fa941" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#89bb3f" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#b3cb3b" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#dbdc34" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ffed39" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffaa" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkgreen)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkmulti'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkmulti" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#373737" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#294767" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#1e5b88" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#1a748b" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#1f8e7e" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#29a869" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#6abf50" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#aad332" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#eae30d" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#fff166" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffffff" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkmulti)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['darkred'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-darkred" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#343434" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#643633" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#8c3a36" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#b03e38" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#d14632" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#e75d1e" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#eb7e20" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ed9c25" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#efb92d" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#f3d431" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ffeb2c" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-darkred)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightgreyred'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightgreyred" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#efe9e6" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#e2dcd9" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#d7cecb" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#ccc1be" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#c0b4af" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#c4a293" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#d38b66" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#de7336" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#e15917" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#df3a10" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#dc000b" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightgreyred)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightgreyteal'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightgreyteal" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#e4eaea" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#d7ddde" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#cbd1d4" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#bcc6ca" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#adbac0" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#85b2be" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#4aacc1" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#22a1c2" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#2192c0" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#1e84be" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#1876bc" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightgreyteal)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightmulti'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightmulti" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#e0f1f2" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#caebd7" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#b8e2b3" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#bddf93" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#d8e17e" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#f6e072" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#f6c659" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#f4a946" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#f58a3f" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#f56c3f" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#ef4a3c" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightmulti)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lightorange'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lightorange" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#f2e7da" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#f7d7bd" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#f9c7a0" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#fab78a" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#faa47a" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#f8936d" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#f38264" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#ed725f" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#e6605b" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#dd4f5b" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#d43d5b" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lightorange)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['lighttealblue'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-lighttealblue" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#e3e9e0" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#c4ddd1" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#a2d1cb" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#84c4c9" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#66b5c3" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#49a7bd" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#3698b4" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#3188a9" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#2d799e" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#276994" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#255988" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-lighttealblue)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function sequentialMultiHue(selected) { - if (!loaded) load(); + }, + splitButtonMenuButtonDisabled: { + backgroundColor: palette.white + }, + icon: { + color: palette.themePrimary + } + }; + }; + const s = ` + ...... +....... +... +...... + ...... + ... +....... +...... +`; + const d = s.split("\n").map((row, irow) => row.length ? row.split("").map((char, icol) => char.trim() ? `M${2 * icol + 1} ${2 * (irow - 1) + 1} v1 h1 v-1 Z` : "").join(" ") : "").join("\n"); + function Logo() { + return base$1.react.createElement( + "svg", + { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16" }, + base$1.react.createElement("path", { d }) + ); + } + function Topbar(props) { + var _a2; + const zeroResults = props.selectionState.selectedData && props.selectionState.selectedData.length === 0; + const disabled = !props.loaded; + const items = [ + { + key: "undo", + name: strings$1.buttonUndo, + iconProps: { + iconName: "Undo" + }, + disabled: disabled || props.historyItems.length === 0 || props.historyIndex === 0, + onClick: props.undo + }, + { + key: "redo", + name: strings$1.buttonRedo, + iconProps: { + iconName: "Redo" + }, + disabled: disabled || props.historyItems.length <= 1 || props.historyIndex >= props.historyItems.length - 1, + onClick: props.redo + }, + { + key: "deselect", + name: strings$1.buttonDeselect, + iconProps: { + iconName: "Cancel" + }, + disabled: disabled || !props.selectionSearch, + onClick: props.doDeselect + }, + { + key: "isolate", + name: strings$1.buttonIsolate, + iconProps: { + iconName: "Filter" + }, + disabled: disabled || !props.selectionSearch || zeroResults, + onClick: () => props.doFilter(props.selectionSearch, strings$1.labelHistoryFilterIsolate) + }, + { + key: "exclude", + name: strings$1.buttonExclude, + iconProps: { + iconName: "ClearFilter" + }, + disabled: disabled || !props.selectionSearch || zeroResults, + onClick: () => props.doFilter(invert$2(props.selectionSearch), strings$1.labelHistoryFilterIExclude) + }, + { + key: "reset", + name: strings$1.buttonReset, + iconProps: { + iconName: "RemoveFilter" + }, + disabled: disabled || !props.filter, + onClick: () => props.doUnfilter(strings$1.labelHistoryFilterClear) + } + ]; + if (props.buttons) { + items.push.apply(items, props.buttons); + } + if (props.collapseLabels) { + items.forEach((item) => item.iconOnly = true); + } + const farItems = []; + if (!props.snapshotsHidden) { + farItems.push({ + key: "previous-snapshot", + iconProps: { + iconName: "Previous" + }, + title: strings$1.buttonPrevSnapshot, + onClick: props.onSnapshotPreviousClick, + disabled: !props.snapshots || props.snapshots.length < 2 + }, { + key: "snapshot", + iconProps: { + iconName: "Camera" + }, + title: strings$1.buttonCreateSnapshot, + onClick: props.onSnapshotClick, + disabled: !props.loaded + }, { + key: "next-snapshot", + iconProps: { + iconName: "Next" + }, + title: strings$1.buttonNextSnapshot, + onClick: props.onSnapshotNextClick, + disabled: !props.snapshots || props.snapshots.length < 2 + }); + } + farItems.push({ + key: "view", + iconProps: { + iconName: props.view === "2d" ? "CubeShape" : "Page" + }, + title: props.view === "2d" ? strings$1.labelViewType3d : strings$1.labelViewType2d, + onClick: props.onViewClick, + disabled: !props.loaded + }); + if ((_a2 = props.iconButtons) === null || _a2 === void 0 ? void 0 : _a2.length) { + farItems.push(...props.iconButtons); + } + return base$1.react.createElement( + "div", + { className: "sanddance-explorer-topbar" }, + base$1.react.createElement( + "div", + { className: "logo" }, + base$1.react.createElement(Logo, null), + base$1.react.createElement("a", { href: props.logoClickUrl || "/", target: props.logoClickTarget || "_blank" }, strings$1.appName) + ), + base$1.react.createElement( + "div", + { className: "sanddance-explorer-commandbar" }, + base$1.react.createElement( + base$1.fluentUI.Customizer, + { scopedSettings: { + CommandBarButton: { + styles: (buttonProps) => { + buttonProps.theme.palette = props.themePalette; + return CommandBarButtonStyles(buttonProps); + } + } + } }, + base$1.react.createElement(base$1.fluentUI.CommandBar, { items, farItems, styles: { + root: { + backgroundColor: "transparent", + height: "unset", + paddingLeft: 0, + paddingRight: 0 + } + } }) + ) + ) + ); + } + const loadDataFile = (dataFile, columnTypes) => new Promise((resolve2, reject) => { + const vega2 = base$3.vega; + const loader2 = vega2.loader(); + function handleRawText(text2) { + let data2; + try { + data2 = vega2.read(text2, { type: dataFile.type, parse: {} }); + } catch (e) { + reject(e); + } + if (data2) { + loadDataArray(data2, dataFile.type, columnTypes).then((dc) => { + if (dataFile.snapshotsUrl) { + fetch(dataFile.snapshotsUrl).then((response) => response.json()).then((snapshots) => { + dc.snapshots = snapshots; + resolve2(dc); + }).catch(reject); + } else if (dataFile.snapshots) { + dc.snapshots = dataFile.snapshots; + resolve2(dc); + } else { + resolve2(dc); + } + }).catch(reject); + } + } + if (dataFile.dataUrl) { + loader2.load(dataFile.dataUrl).then(handleRawText).catch(reject); + } else if (dataFile.rawText) { + handleRawText(dataFile.rawText); + } else { + reject("dataFile object must have either dataUrl or rawText property set."); + } + }); + const loadDataArray = (data2, type2, columnTypes) => new Promise((resolve2, reject) => { + const parse2 = type2 === "csv" || type2 === "tsv"; + if (parse2) { + data2.forEach((row) => { + for (const column in row) { + if (row[column] === "") { + row[column] = null; + } + } + }); + } + const columns = getColumnsFromData(base$3.vega.inferTypes, data2, columnTypes).filter((c2) => c2.name && c2.name.trim()).sort((a2, b2) => a2.name.localeCompare(b2.name)); + if (parse2) { + const booleanColumns = columns.filter((c2) => c2.type === "boolean"); + const dateColumns = columns.filter((c2) => c2.type === "date"); + const numericColumns = columns.filter((c2) => c2.type === "integer" || c2.type === "number"); + data2.forEach((obj2) => { + booleanColumns.forEach((c2) => { + obj2[c2.name] = ("" + obj2[c2.name]).toLowerCase() === "true"; + }); + dateColumns.forEach((c2) => { + const input = obj2[c2.name]; + if (input !== null) { + const d2 = new Date(input); + d2.input = input; + obj2[c2.name] = d2; + } + }); + numericColumns.forEach((c2) => { + const n = parseFloat(obj2[c2.name]); + obj2[c2.name] = isNaN(n) ? null : n; + }); + }); + } + resolve2({ data: data2, columns }); + }); + var util$1 = util$4; + const themePalettes = {}; + themePalettes[""] = { + themePrimary: "#0078d4", + themeLighterAlt: "#eff6fc", + themeLighter: "#deecf9", + themeLight: "#c7e0f4", + themeTertiary: "#71afe5", + themeSecondary: "#2b88d8", + themeDarkAlt: "#106ebe", + themeDark: "#005a9e", + themeDarker: "#004578", + neutralLighterAlt: "#faf9f8", + neutralLighter: "#f3f2f1", + neutralLight: "#edebe9", + neutralQuaternaryAlt: "#e1dfdd", + neutralQuaternary: "#d0d0d0", + neutralTertiaryAlt: "#c8c6c4", + neutralTertiary: "#595959", + neutralSecondary: "#373737", + neutralSecondaryAlt: "#373737", + neutralPrimaryAlt: "#2f2f2f", + neutralPrimary: "#000000", + neutralDark: "#151515", + black: "#0b0b0b", + white: "#ffffff" + }; + themePalettes["dark-theme"] = { + themePrimary: "#0078d4", + themeLighterAlt: "#eff6fc", + themeLighter: "#deecf9", + themeLight: "#c7e0f4", + themeTertiary: "#71afe5", + themeSecondary: "#2b88d8", + themeDarkAlt: "#106ebe", + themeDark: "#005a9e", + themeDarker: "#004578", + neutralLighterAlt: "#0b0b0b", + neutralLighter: "#151515", + neutralLight: "#252525", + neutralQuaternaryAlt: "#2f2f2f", + neutralQuaternary: "#373737", + neutralTertiaryAlt: "#595959", + neutralTertiary: "#c8c8c8", + neutralSecondary: "#d0d0d0", + neutralSecondaryAlt: "#d0d0d0", + neutralPrimaryAlt: "#dadada", + neutralPrimary: "#ffffff", + neutralDark: "#f4f4f4", + black: "#f8f8f8", + white: "#000000" + }; + function getColorSettingsFromThemePalette(themePalette) { + const c2 = util$1.colorFromString(themePalette.themeSecondary); + c2[3] = 256 / 3; + return { + axisLine: themePalette.black, + axisText: themePalette.black, + gridLine: themePalette.neutralLight, + backgroundColor: themePalette.white, + hoveredCube: themePalette.black, + clickableText: themePalette.themeDark, + clickableTextHighlight: util$1.colorToString(c2), + searchText: themePalette.neutralPrimary, + searchTextHighlight: themePalette.neutralPrimaryAlt + }; + } + const fontFamily$1 = "Segoe UI, sans-serif"; + const defaultViewerOptions = { + colors: getColorSettingsFromThemePalette(themePalettes[""]), + fontFamily: fontFamily$1 + }; + const snapshotThumbWidth = 300; + const defaultRenderer = { + advanced: false, + advancedOptions: { + bloomIntensity: 2, + isBloomEnabled: false, + isDofEnabled: false, + dofFocusRange: 0.25, + isFxaaEnabled: false, + isShadowEnabled: true, + isSsaoEnabled: true + }, + basicOptions: { + antialias: true + } + }; + function initialExplorerState(props) { + const renderer = props.initialRenderer || defaultRenderer; + if (!renderer.advancedOptions) { + renderer.advancedOptions = defaultRenderer.advancedOptions; + } + if (!renderer.basicOptions) { + renderer.basicOptions = defaultRenderer.basicOptions; + } + const state = { + calculating: null, + errors: null, + autoCompleteDistinctValues: {}, + colorBin: null, + dataContent: null, + dataFile: null, + search: null, + totalStyle: null, + facetStyle: "wrap", + filter: null, + filteredData: null, + specCapabilities: null, + size: { + height: null, + width: null + }, + scheme: null, + transform: null, + columns: null, + chart: "grid", + signalValues: null, + hideAxes: false, + hideLegend: false, + sideTabId: SideTabId.ChartType, + dataScopeId: DataScopeId.AllData, + selectedItemIndex: {}, + sidebarClosed: props.initialSidebarClosed === void 0 ? false : props.initialSidebarClosed, + sidebarPinned: props.initialSidebarPinned === void 0 ? true : props.initialSidebarPinned, + view: props.initialView || "2d", + snapshots: [], + selectedSnapshotIndex: -1, + tooltipExclusions: [], + positionedColumnMapProps: null, + note: null, + historyIndex: -1, + historyItems: [], + renderer, + transitionType: "ordinal", + transitionDimension: "x", + transitionDurations: clone(defaultPresenterConfig.transitionDurations) + }; + resetSelectedItemIndex(state.selectedItemIndex); + return state; + } + function schemeOption(selected, scheme2) { + return { + key: scheme2, + text: scheme2, + selected: selected === scheme2, + scheme: scheme2, + children: schemesJSX[scheme2] + }; + } + function schemeHeader(key2, text2) { + return { + key: key2, + text: text2, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }; + } + const schemesJSX = {}; + const p8 = `${100 / 8}%`; + const p9 = `${100 / 9}%`; + const p10 = `${100 / 10}%`; + const p12 = `${100 / 12}%`; + const p20 = `${100 / 20}%`; + let loaded$5 = false; + function load$7() { + schemesJSX["accent"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#7fc97f", style: { width: p8, background: "rgb(127, 201, 127)" } }), + base$1.react.createElement("div", { title: "#beaed4", style: { width: p8, background: "rgb(190, 174, 212)" } }), + base$1.react.createElement("div", { title: "#fdc086", style: { width: p8, background: "rgb(253, 192, 134)" } }), + base$1.react.createElement("div", { title: "#ffff99", style: { width: p8, background: "rgb(255, 255, 153)" } }), + base$1.react.createElement("div", { title: "#386cb0", style: { width: p8, background: "rgb(56, 108, 176)" } }), + base$1.react.createElement("div", { title: "#f0027f", style: { width: p8, background: "rgb(240, 2, 127)" } }), + base$1.react.createElement("div", { title: "#bf5b17", style: { width: p8, background: "rgb(191, 91, 23)" } }), + base$1.react.createElement("div", { title: "#666666", style: { width: p8, background: "rgb(102, 102, 102)" } }) + ); + schemesJSX["category10"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#1f77b4", style: { width: p10, background: "rgb(31, 119, 180)" } }), + base$1.react.createElement("div", { title: "#ff7f0e", style: { width: p10, background: "rgb(255, 127, 14)" } }), + base$1.react.createElement("div", { title: "#2ca02c", style: { width: p10, background: "rgb(44, 160, 44)" } }), + base$1.react.createElement("div", { title: "#d62728", style: { width: p10, background: "rgb(214, 39, 40)" } }), + base$1.react.createElement("div", { title: "#9467bd", style: { width: p10, background: "rgb(148, 103, 189)" } }), + base$1.react.createElement("div", { title: "#8c564b", style: { width: p10, background: "rgb(140, 86, 75)" } }), + base$1.react.createElement("div", { title: "#e377c2", style: { width: p10, background: "rgb(227, 119, 194)" } }), + base$1.react.createElement("div", { title: "#7f7f7f", style: { width: p10, background: "rgb(127, 127, 127)" } }), + base$1.react.createElement("div", { title: "#bcbd22", style: { width: p10, background: "rgb(188, 189, 34)" } }), + base$1.react.createElement("div", { title: "#17becf", style: { width: p10, background: "rgb(23, 190, 207)" } }) + ); + schemesJSX["category20"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#1f77b4", style: { width: p20, background: "rgb(31, 119, 180)" } }), + base$1.react.createElement("div", { title: "#aec7e8", style: { width: p20, background: "rgb(174, 199, 232)" } }), + base$1.react.createElement("div", { title: "#ff7f0e", style: { width: p20, background: "rgb(255, 127, 14)" } }), + base$1.react.createElement("div", { title: "#ffbb78", style: { width: p20, background: "rgb(255, 187, 120)" } }), + base$1.react.createElement("div", { title: "#2ca02c", style: { width: p20, background: "rgb(44, 160, 44)" } }), + base$1.react.createElement("div", { title: "#98df8a", style: { width: p20, background: "rgb(152, 223, 138)" } }), + base$1.react.createElement("div", { title: "#d62728", style: { width: p20, background: "rgb(214, 39, 40)" } }), + base$1.react.createElement("div", { title: "#ff9896", style: { width: p20, background: "rgb(255, 152, 150)" } }), + base$1.react.createElement("div", { title: "#9467bd", style: { width: p20, background: "rgb(148, 103, 189)" } }), + base$1.react.createElement("div", { title: "#c5b0d5", style: { width: p20, background: "rgb(197, 176, 213)" } }), + base$1.react.createElement("div", { title: "#8c564b", style: { width: p20, background: "rgb(140, 86, 75)" } }), + base$1.react.createElement("div", { title: "#c49c94", style: { width: p20, background: "rgb(196, 156, 148)" } }), + base$1.react.createElement("div", { title: "#e377c2", style: { width: p20, background: "rgb(227, 119, 194)" } }), + base$1.react.createElement("div", { title: "#f7b6d2", style: { width: p20, background: "rgb(247, 182, 210)" } }), + base$1.react.createElement("div", { title: "#7f7f7f", style: { width: p20, background: "rgb(127, 127, 127)" } }), + base$1.react.createElement("div", { title: "#c7c7c7", style: { width: p20, background: "rgb(199, 199, 199)" } }), + base$1.react.createElement("div", { title: "#bcbd22", style: { width: p20, background: "rgb(188, 189, 34)" } }), + base$1.react.createElement("div", { title: "#dbdb8d", style: { width: p20, background: "rgb(219, 219, 141)" } }), + base$1.react.createElement("div", { title: "#17becf", style: { width: p20, background: "rgb(23, 190, 207)" } }), + base$1.react.createElement("div", { title: "#9edae5", style: { width: p20, background: "rgb(158, 218, 229)" } }) + ); + schemesJSX["category20b"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#393b79", style: { width: p20, background: "rgb(57, 59, 121)" } }), + base$1.react.createElement("div", { title: "#5254a3", style: { width: p20, background: "rgb(82, 84, 163)" } }), + base$1.react.createElement("div", { title: "#6b6ecf", style: { width: p20, background: "rgb(107, 110, 207)" } }), + base$1.react.createElement("div", { title: "#9c9ede", style: { width: p20, background: "rgb(156, 158, 222)" } }), + base$1.react.createElement("div", { title: "#637939", style: { width: p20, background: "rgb(99, 121, 57)" } }), + base$1.react.createElement("div", { title: "#8ca252", style: { width: p20, background: "rgb(140, 162, 82)" } }), + base$1.react.createElement("div", { title: "#b5cf6b", style: { width: p20, background: "rgb(181, 207, 107)" } }), + base$1.react.createElement("div", { title: "#cedb9c", style: { width: p20, background: "rgb(206, 219, 156)" } }), + base$1.react.createElement("div", { title: "#8c6d31", style: { width: p20, background: "rgb(140, 109, 49)" } }), + base$1.react.createElement("div", { title: "#bd9e39", style: { width: p20, background: "rgb(189, 158, 57)" } }), + base$1.react.createElement("div", { title: "#e7ba52", style: { width: p20, background: "rgb(231, 186, 82)" } }), + base$1.react.createElement("div", { title: "#e7cb94", style: { width: p20, background: "rgb(231, 203, 148)" } }), + base$1.react.createElement("div", { title: "#843c39", style: { width: p20, background: "rgb(132, 60, 57)" } }), + base$1.react.createElement("div", { title: "#ad494a", style: { width: p20, background: "rgb(173, 73, 74)" } }), + base$1.react.createElement("div", { title: "#d6616b", style: { width: p20, background: "rgb(214, 97, 107)" } }), + base$1.react.createElement("div", { title: "#e7969c", style: { width: p20, background: "rgb(231, 150, 156)" } }), + base$1.react.createElement("div", { title: "#7b4173", style: { width: p20, background: "rgb(123, 65, 115)" } }), + base$1.react.createElement("div", { title: "#a55194", style: { width: p20, background: "rgb(165, 81, 148)" } }), + base$1.react.createElement("div", { title: "#ce6dbd", style: { width: p20, background: "rgb(206, 109, 189)" } }), + base$1.react.createElement("div", { title: "#de9ed6", style: { width: p20, background: "rgb(222, 158, 214)" } }) + ); + schemesJSX["category20c"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#3182bd", style: { width: p20, background: "rgb(49, 130, 189)" } }), + base$1.react.createElement("div", { title: "#6baed6", style: { width: p20, background: "rgb(107, 174, 214)" } }), + base$1.react.createElement("div", { title: "#9ecae1", style: { width: p20, background: "rgb(158, 202, 225)" } }), + base$1.react.createElement("div", { title: "#c6dbef", style: { width: p20, background: "rgb(198, 219, 239)" } }), + base$1.react.createElement("div", { title: "#e6550d", style: { width: p20, background: "rgb(230, 85, 13)" } }), + base$1.react.createElement("div", { title: "#fd8d3c", style: { width: p20, background: "rgb(253, 141, 60)" } }), + base$1.react.createElement("div", { title: "#fdae6b", style: { width: p20, background: "rgb(253, 174, 107)" } }), + base$1.react.createElement("div", { title: "#fdd0a2", style: { width: p20, background: "rgb(253, 208, 162)" } }), + base$1.react.createElement("div", { title: "#31a354", style: { width: p20, background: "rgb(49, 163, 84)" } }), + base$1.react.createElement("div", { title: "#74c476", style: { width: p20, background: "rgb(116, 196, 118)" } }), + base$1.react.createElement("div", { title: "#a1d99b", style: { width: p20, background: "rgb(161, 217, 155)" } }), + base$1.react.createElement("div", { title: "#c7e9c0", style: { width: p20, background: "rgb(199, 233, 192)" } }), + base$1.react.createElement("div", { title: "#756bb1", style: { width: p20, background: "rgb(117, 107, 177)" } }), + base$1.react.createElement("div", { title: "#9e9ac8", style: { width: p20, background: "rgb(158, 154, 200)" } }), + base$1.react.createElement("div", { title: "#bcbddc", style: { width: p20, background: "rgb(188, 189, 220)" } }), + base$1.react.createElement("div", { title: "#dadaeb", style: { width: p20, background: "rgb(218, 218, 235)" } }), + base$1.react.createElement("div", { title: "#636363", style: { width: p20, background: "rgb(99, 99, 99)" } }), + base$1.react.createElement("div", { title: "#969696", style: { width: p20, background: "rgb(150, 150, 150)" } }), + base$1.react.createElement("div", { title: "#bdbdbd", style: { width: p20, background: "rgb(189, 189, 189)" } }), + base$1.react.createElement("div", { title: "#d9d9d9", style: { width: p20, background: "rgb(217, 217, 217)" } }) + ); + schemesJSX["dark2"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#1b9e77", style: { width: p8, background: "rgb(27, 158, 119)" } }), + base$1.react.createElement("div", { title: "#d95f02", style: { width: p8, background: "rgb(217, 95, 2)" } }), + base$1.react.createElement("div", { title: "#7570b3", style: { width: p8, background: "rgb(117, 112, 179)" } }), + base$1.react.createElement("div", { title: "#e7298a", style: { width: p8, background: "rgb(231, 41, 138)" } }), + base$1.react.createElement("div", { title: "#66a61e", style: { width: p8, background: "rgb(102, 166, 30)" } }), + base$1.react.createElement("div", { title: "#e6ab02", style: { width: p8, background: "rgb(230, 171, 2)" } }), + base$1.react.createElement("div", { title: "#a6761d", style: { width: p8, background: "rgb(166, 118, 29)" } }), + base$1.react.createElement("div", { title: "#666666", style: { width: p8, background: "rgb(102, 102, 102)" } }) + ); + schemesJSX["paired"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#a6cee3", style: { width: p12, background: "rgb(166, 206, 227)" } }), + base$1.react.createElement("div", { title: "#1f78b4", style: { width: p12, background: "rgb(31, 120, 180)" } }), + base$1.react.createElement("div", { title: "#b2df8a", style: { width: p12, background: "rgb(178, 223, 138)" } }), + base$1.react.createElement("div", { title: "#33a02c", style: { width: p12, background: "rgb(51, 160, 44)" } }), + base$1.react.createElement("div", { title: "#fb9a99", style: { width: p12, background: "rgb(251, 154, 153)" } }), + base$1.react.createElement("div", { title: "#e31a1c", style: { width: p12, background: "rgb(227, 26, 28)" } }), + base$1.react.createElement("div", { title: "#fdbf6f", style: { width: p12, background: "rgb(253, 191, 111)" } }), + base$1.react.createElement("div", { title: "#ff7f00", style: { width: p12, background: "rgb(255, 127, 0)" } }), + base$1.react.createElement("div", { title: "#cab2d6", style: { width: p12, background: "rgb(202, 178, 214)" } }), + base$1.react.createElement("div", { title: "#6a3d9a", style: { width: p12, background: "rgb(106, 61, 154)" } }), + base$1.react.createElement("div", { title: "#ffff99", style: { width: p12, background: "rgb(255, 255, 153)" } }), + base$1.react.createElement("div", { title: "#b15928", style: { width: p12, background: "rgb(177, 89, 40)" } }) + ); + schemesJSX["pastel1"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#fbb4ae", style: { width: p9, background: "rgb(251, 180, 174)" } }), + base$1.react.createElement("div", { title: "#b3cde3", style: { width: p9, background: "rgb(179, 205, 227)" } }), + base$1.react.createElement("div", { title: "#ccebc5", style: { width: p9, background: "rgb(204, 235, 197)" } }), + base$1.react.createElement("div", { title: "#decbe4", style: { width: p9, background: "rgb(222, 203, 228)" } }), + base$1.react.createElement("div", { title: "#fed9a6", style: { width: p9, background: "rgb(254, 217, 166)" } }), + base$1.react.createElement("div", { title: "#ffffcc", style: { width: p9, background: "rgb(255, 255, 204)" } }), + base$1.react.createElement("div", { title: "#e5d8bd", style: { width: p9, background: "rgb(229, 216, 189)" } }), + base$1.react.createElement("div", { title: "#fddaec", style: { width: p9, background: "rgb(253, 218, 236)" } }), + base$1.react.createElement("div", { title: "#f2f2f2", style: { width: p9, background: "rgb(242, 242, 242)" } }) + ); + schemesJSX["pastel2"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#b3e2cd", style: { width: p8, background: "rgb(179, 226, 205)" } }), + base$1.react.createElement("div", { title: "#fdcdac", style: { width: p8, background: "rgb(253, 205, 172)" } }), + base$1.react.createElement("div", { title: "#cbd5e8", style: { width: p8, background: "rgb(203, 213, 232)" } }), + base$1.react.createElement("div", { title: "#f4cae4", style: { width: p8, background: "rgb(244, 202, 228)" } }), + base$1.react.createElement("div", { title: "#e6f5c9", style: { width: p8, background: "rgb(230, 245, 201)" } }), + base$1.react.createElement("div", { title: "#fff2ae", style: { width: p8, background: "rgb(255, 242, 174)" } }), + base$1.react.createElement("div", { title: "#f1e2cc", style: { width: p8, background: "rgb(241, 226, 204)" } }), + base$1.react.createElement("div", { title: "#cccccc", style: { width: p8, background: "rgb(204, 204, 204)" } }) + ); + schemesJSX["set1"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#e41a1c", style: { width: p9, background: "rgb(228, 26, 28)" } }), + base$1.react.createElement("div", { title: "#377eb8", style: { width: p9, background: "rgb(55, 126, 184)" } }), + base$1.react.createElement("div", { title: "#4daf4a", style: { width: p9, background: "rgb(77, 175, 74)" } }), + base$1.react.createElement("div", { title: "#984ea3", style: { width: p9, background: "rgb(152, 78, 163)" } }), + base$1.react.createElement("div", { title: "#ff7f00", style: { width: p9, background: "rgb(255, 127, 0)" } }), + base$1.react.createElement("div", { title: "#ffff33", style: { width: p9, background: "rgb(255, 255, 51)" } }), + base$1.react.createElement("div", { title: "#a65628", style: { width: p9, background: "rgb(166, 86, 40)" } }), + base$1.react.createElement("div", { title: "#f781bf", style: { width: p9, background: "rgb(247, 129, 191)" } }), + base$1.react.createElement("div", { title: "#999999", style: { width: p9, background: "rgb(153, 153, 153)" } }) + ); + schemesJSX["set2"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#66c2a5", style: { width: p8, background: "rgb(102, 194, 165)" } }), + base$1.react.createElement("div", { title: "#fc8d62", style: { width: p8, background: "rgb(252, 141, 98)" } }), + base$1.react.createElement("div", { title: "#8da0cb", style: { width: p8, background: "rgb(141, 160, 203)" } }), + base$1.react.createElement("div", { title: "#e78ac3", style: { width: p8, background: "rgb(231, 138, 195)" } }), + base$1.react.createElement("div", { title: "#a6d854", style: { width: p8, background: "rgb(166, 216, 84)" } }), + base$1.react.createElement("div", { title: "#ffd92f", style: { width: p8, background: "rgb(255, 217, 47)" } }), + base$1.react.createElement("div", { title: "#e5c494", style: { width: p8, background: "rgb(229, 196, 148)" } }), + base$1.react.createElement("div", { title: "#b3b3b3", style: { width: p8, background: "rgb(179, 179, 179)" } }) + ); + schemesJSX["set3"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#8dd3c7", style: { width: p12, background: "rgb(141, 211, 199)" } }), + base$1.react.createElement("div", { title: "#ffffb3", style: { width: p12, background: "rgb(255, 255, 179)" } }), + base$1.react.createElement("div", { title: "#bebada", style: { width: p12, background: "rgb(190, 186, 218)" } }), + base$1.react.createElement("div", { title: "#fb8072", style: { width: p12, background: "rgb(251, 128, 114)" } }), + base$1.react.createElement("div", { title: "#80b1d3", style: { width: p12, background: "rgb(128, 177, 211)" } }), + base$1.react.createElement("div", { title: "#fdb462", style: { width: p12, background: "rgb(253, 180, 98)" } }), + base$1.react.createElement("div", { title: "#b3de69", style: { width: p12, background: "rgb(179, 222, 105)" } }), + base$1.react.createElement("div", { title: "#fccde5", style: { width: p12, background: "rgb(252, 205, 229)" } }), + base$1.react.createElement("div", { title: "#d9d9d9", style: { width: p12, background: "rgb(217, 217, 217)" } }), + base$1.react.createElement("div", { title: "#bc80bd", style: { width: p12, background: "rgb(188, 128, 189)" } }), + base$1.react.createElement("div", { title: "#ccebc5", style: { width: p12, background: "rgb(204, 235, 197)" } }), + base$1.react.createElement("div", { title: "#ffed6f", style: { width: p12, background: "rgb(255, 237, 111)" } }) + ); + schemesJSX["tableau10"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#4c78a8", style: { width: p10, background: "rgb(76, 120, 168)" } }), + base$1.react.createElement("div", { title: "#f58518", style: { width: p10, background: "rgb(245, 133, 24)" } }), + base$1.react.createElement("div", { title: "#e45756", style: { width: p10, background: "rgb(228, 87, 86)" } }), + base$1.react.createElement("div", { title: "#72b7b2", style: { width: p10, background: "rgb(114, 183, 178)" } }), + base$1.react.createElement("div", { title: "#54a24b", style: { width: p10, background: "rgb(84, 162, 75)" } }), + base$1.react.createElement("div", { title: "#eeca3b", style: { width: p10, background: "rgb(238, 202, 59)" } }), + base$1.react.createElement("div", { title: "#b279a2", style: { width: p10, background: "rgb(178, 121, 162)" } }), + base$1.react.createElement("div", { title: "#ff9da6", style: { width: p10, background: "rgb(255, 157, 166)" } }), + base$1.react.createElement("div", { title: "#9d755d", style: { width: p10, background: "rgb(157, 117, 93)" } }), + base$1.react.createElement("div", { title: "#bab0ac", style: { width: p10, background: "rgb(186, 176, 172)" } }) + ); + schemesJSX["tableau20"] = base$1.react.createElement( + "div", + { className: "swatch" }, + base$1.react.createElement("div", { title: "#4c78a8", style: { width: p20, background: "rgb(76, 120, 168)" } }), + base$1.react.createElement("div", { title: "#9ecae9", style: { width: p20, background: "rgb(158, 202, 233)" } }), + base$1.react.createElement("div", { title: "#f58518", style: { width: p20, background: "rgb(245, 133, 24)" } }), + base$1.react.createElement("div", { title: "#ffbf79", style: { width: p20, background: "rgb(255, 191, 121)" } }), + base$1.react.createElement("div", { title: "#54a24b", style: { width: p20, background: "rgb(84, 162, 75)" } }), + base$1.react.createElement("div", { title: "#88d27a", style: { width: p20, background: "rgb(136, 210, 122)" } }), + base$1.react.createElement("div", { title: "#b79a20", style: { width: p20, background: "rgb(183, 154, 32)" } }), + base$1.react.createElement("div", { title: "#f2cf5b", style: { width: p20, background: "rgb(242, 207, 91)" } }), + base$1.react.createElement("div", { title: "#439894", style: { width: p20, background: "rgb(67, 152, 148)" } }), + base$1.react.createElement("div", { title: "#83bcb6", style: { width: p20, background: "rgb(131, 188, 182)" } }), + base$1.react.createElement("div", { title: "#e45756", style: { width: p20, background: "rgb(228, 87, 86)" } }), + base$1.react.createElement("div", { title: "#ff9d98", style: { width: p20, background: "rgb(255, 157, 152)" } }), + base$1.react.createElement("div", { title: "#79706e", style: { width: p20, background: "rgb(121, 112, 110)" } }), + base$1.react.createElement("div", { title: "#bab0ac", style: { width: p20, background: "rgb(186, 176, 172)" } }), + base$1.react.createElement("div", { title: "#d67195", style: { width: p20, background: "rgb(214, 113, 149)" } }), + base$1.react.createElement("div", { title: "#fcbfd2", style: { width: p20, background: "rgb(252, 191, 210)" } }), + base$1.react.createElement("div", { title: "#b279a2", style: { width: p20, background: "rgb(178, 121, 162)" } }), + base$1.react.createElement("div", { title: "#d6a5c9", style: { width: p20, background: "rgb(214, 165, 201)" } }), + base$1.react.createElement("div", { title: "#9e765f", style: { width: p20, background: "rgb(158, 118, 95)" } }), + base$1.react.createElement("div", { title: "#d8b5a5", style: { width: p20, background: "rgb(216, 181, 165)" } }) + ); + loaded$5 = true; + } + function categorical(selected) { + if (!loaded$5) + load$7(); return [ - (0, _scheme.schemeOption)(selected, 'viridis'), - (0, _scheme.schemeOption)(selected, 'magma'), - (0, _scheme.schemeOption)(selected, 'inferno'), - (0, _scheme.schemeOption)(selected, 'plasma'), - (0, _scheme.schemeOption)(selected, 'cividis'), - (0, _scheme.schemeOption)(selected, 'turbo'), - (0, _scheme.schemeOption)(selected, 'bluegreen'), - (0, _scheme.schemeOption)(selected, 'bluepurple'), - (0, _scheme.schemeOption)(selected, 'goldgreen'), - (0, _scheme.schemeOption)(selected, 'goldorange'), - (0, _scheme.schemeOption)(selected, 'goldred'), - (0, _scheme.schemeOption)(selected, 'greenblue'), - (0, _scheme.schemeOption)(selected, 'orangered'), - (0, _scheme.schemeOption)(selected, 'purplebluegreen'), - (0, _scheme.schemeOption)(selected, 'purpleblue'), - (0, _scheme.schemeOption)(selected, 'purplered'), - (0, _scheme.schemeOption)(selected, 'redpurple'), - (0, _scheme.schemeOption)(selected, 'yellowgreenblue'), - (0, _scheme.schemeOption)(selected, 'yellowgreen'), - (0, _scheme.schemeOption)(selected, 'yelloworangebrown'), - (0, _scheme.schemeOption)(selected, 'yelloworangered'), - (0, _scheme.schemeHeader)('schemeSequentialMultiHueDark', (0, _language.strings).schemeSequentialMultiHueDark), - (0, _scheme.schemeOption)(selected, 'darkblue'), - (0, _scheme.schemeOption)(selected, 'darkgold'), - (0, _scheme.schemeOption)(selected, 'darkgreen'), - (0, _scheme.schemeOption)(selected, 'darkmulti'), - (0, _scheme.schemeOption)(selected, 'darkred'), - (0, _scheme.schemeHeader)('schemeSequentialMultiHueLight', (0, _language.strings).schemeSequentialMultiHueLight), - (0, _scheme.schemeOption)(selected, 'lightgreyred'), - (0, _scheme.schemeOption)(selected, 'lightgreyteal'), - (0, _scheme.schemeOption)(selected, 'lightmulti'), - (0, _scheme.schemeOption)(selected, 'lightorange'), - (0, _scheme.schemeOption)(selected, 'lighttealblue') + schemeOption(selected, "accent"), + schemeOption(selected, "category10"), + schemeOption(selected, "category20"), + schemeOption(selected, "category20b"), + schemeOption(selected, "category20c"), + schemeOption(selected, "dark2"), + schemeOption(selected, "paired"), + schemeOption(selected, "pastel1"), + schemeOption(selected, "pastel2"), + schemeOption(selected, "set1"), + schemeOption(selected, "set2"), + schemeOption(selected, "set3"), + schemeOption(selected, "tableau10"), + schemeOption(selected, "tableau20") ]; -} - -},{"../base":"3TPz5","../language":"67xOI","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2GC64":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sequentialSingleHue", ()=>sequentialSingleHue); -var _base = require("../base"); -var _scheme = require("./scheme"); -let loaded = false; -function load() { - (0, _scheme.schemesJSX)['blues'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-blues" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 251, 255)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(227, 238, 249)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(207, 225, 242)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(181, 212, 233)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(147, 195, 223)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(109, 174, 213)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(75, 151, 201)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 126, 188)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(24, 100, 170)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(10, 74, 144)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(8, 48, 107)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-blues)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['tealblues'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-tealblues" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#bce4d8" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#a3d6d2" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#8cc9cd" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#76bdc7" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#5fb0c0" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#45a2b9" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#3993b0" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#3584a6" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#32759b" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#2f6790" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#2c5985" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-tealblues)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['teals'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-teals" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#bbdfdf" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#a2d4d5" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#8ac9c9" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#75bcbb" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#61b0af" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#4da5a4" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#379998" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#2b8b8c" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#1e7f7f" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#127273" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#006667" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-teals)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['greens'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-greens" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(247, 252, 245)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(232, 246, 227)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(211, 238, 205)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(183, 226, 177)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(151, 212, 148)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(115, 195, 120)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(77, 175, 98)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(47, 152, 79)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(21, 127, 59)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(3, 100, 41)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 68, 27)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-greens)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['greys'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-greys" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 255, 255)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(242, 242, 242)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(226, 226, 226)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(206, 206, 206)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(180, 180, 180)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(151, 151, 151)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(122, 122, 122)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(95, 95, 95)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(64, 64, 64)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(30, 30, 30)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(0, 0, 0)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-greys)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['purples'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-purples" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(252, 251, 253)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(241, 239, 246)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(226, 225, 239)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(206, 206, 229)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(182, 181, 216)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(158, 155, 201)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(135, 130, 188)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(115, 99, 172)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(97, 64, 155)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(80, 31, 140)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(63, 0, 125)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-purples)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['browns'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-browns" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#eedbbd" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#ecca96" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#e9b97a" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#e4a865" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#dc9856" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#d18954" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#c7784c" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#c0673f" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#b85536" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#ad4433" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#9f3632" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-browns)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['reds'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-reds" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 245, 240)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(254, 227, 214)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(253, 201, 180)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(252, 170, 142)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(252, 138, 107)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(249, 105, 76)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(239, 69, 51)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(217, 39, 35)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(187, 21, 26)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(151, 11, 19)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(103, 0, 13)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-reds)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['oranges'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-oranges" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "rgb(255, 245, 235)" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "rgb(254, 232, 211)" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "rgb(253, 216, 179)" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "rgb(253, 194, 140)" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "rgb(253, 167, 98)" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "rgb(251, 141, 61)" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "rgb(242, 112, 29)" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "rgb(226, 86, 9)" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "rgb(196, 65, 3)" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "rgb(159, 51, 3)" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "rgb(127, 39, 4)" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-oranges)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - (0, _scheme.schemesJSX)['warmgreys'] = (0, _base.base).react.createElement("svg", { - viewBox: "0,0,1,1", - preserveAspectRatio: "none" - }, (0, _base.base).react.createElement("defs", null, (0, _base.base).react.createElement("linearGradient", { - id: "gradient-warmgreys" - }, (0, _base.base).react.createElement("stop", { - offset: "0%", - stopColor: "#dcd4d0" - }), (0, _base.base).react.createElement("stop", { - offset: "10%", - stopColor: "#cec5c1" - }), (0, _base.base).react.createElement("stop", { - offset: "20%", - stopColor: "#c0b8b4" - }), (0, _base.base).react.createElement("stop", { - offset: "30%", - stopColor: "#b3aaa7" - }), (0, _base.base).react.createElement("stop", { - offset: "40%", - stopColor: "#a59c99" - }), (0, _base.base).react.createElement("stop", { - offset: "50%", - stopColor: "#98908c" - }), (0, _base.base).react.createElement("stop", { - offset: "60%", - stopColor: "#8b827f" - }), (0, _base.base).react.createElement("stop", { - offset: "70%", - stopColor: "#7e7673" - }), (0, _base.base).react.createElement("stop", { - offset: "80%", - stopColor: "#726866" - }), (0, _base.base).react.createElement("stop", { - offset: "90%", - stopColor: "#665c5a" - }), (0, _base.base).react.createElement("stop", { - offset: "100%", - stopColor: "#59504e" - }))), (0, _base.base).react.createElement("rect", { - fill: "url(#gradient-warmgreys)", - x: "0", - y: "0", - width: "1", - height: "1" - })); - loaded = true; -} -function sequentialSingleHue(selected) { - if (!loaded) load(); + } + let loaded$4 = false; + function load$6() { + schemesJSX["rainbow"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-rainbow" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#6e40aa" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#bf3caf" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#fe4b83" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#ff7847" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#e2b72f" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#aff05b" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#52f667" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#1ddfa3" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#23abd8" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#4c6edb" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#6e40aa" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-rainbow)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["sinebow"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-sinebow" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#ff4040" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#e78d0b" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#a7d503" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#58fc2a" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#18f472" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#00bfbf" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#1872f4" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#582afc" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#a703d5" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#e70b8d" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ff4040" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-sinebow)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded$4 = true; + } + function cyclical(selected) { + if (!loaded$4) + load$6(); return [ - (0, _scheme.schemeOption)(selected, 'blues'), - (0, _scheme.schemeOption)(selected, 'tealblues'), - (0, _scheme.schemeOption)(selected, 'teals'), - (0, _scheme.schemeOption)(selected, 'greens'), - (0, _scheme.schemeOption)(selected, 'browns'), - (0, _scheme.schemeOption)(selected, 'oranges'), - (0, _scheme.schemeOption)(selected, 'reds'), - (0, _scheme.schemeOption)(selected, 'purples'), - (0, _scheme.schemeOption)(selected, 'warmgreys'), - (0, _scheme.schemeOption)(selected, 'greys') + schemeOption(selected, "rainbow"), + schemeOption(selected, "sinebow") ]; -} - -},{"../base":"3TPz5","./scheme":"efDez","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dT4UW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dataBrowserZeroMessages", ()=>dataBrowserZeroMessages); -parcelHelpers.export(exports, "dataBrowserNullMessages", ()=>dataBrowserNullMessages); -parcelHelpers.export(exports, "DataBrowser", ()=>DataBrowser); -var _base = require("../base"); -var _dataExporter = require("../controls/dataExporter"); -var _dataItem = require("../controls/dataItem"); -var _dataScope = require("../controls/dataScope"); -var _dropdown = require("../controls/dropdown"); -var _group = require("../controls/group"); -var _iconButton = require("../controls/iconButton"); -var _language = require("../language"); -var _columnTypeChanger = require("../controls/columnTypeChanger"); -const dataBrowserZeroMessages = {}; -dataBrowserZeroMessages[(0, _dataScope.DataScopeId).AllData] = (0, _language.strings).labelZeroAll; -dataBrowserZeroMessages[(0, _dataScope.DataScopeId).FilteredData] = null; //empty array is not used -dataBrowserZeroMessages[(0, _dataScope.DataScopeId).SelectedData] = (0, _language.strings).labelZeroSearchResults; -const dataBrowserNullMessages = {}; -dataBrowserNullMessages[(0, _dataScope.DataScopeId).AllData] = (0, _language.strings).labelDataNullAll; -dataBrowserNullMessages[(0, _dataScope.DataScopeId).FilteredData] = (0, _language.strings).labelDataNullFiltered; -dataBrowserNullMessages[(0, _dataScope.DataScopeId).SelectedData] = (0, _language.strings).labelDataNullSelection; -function DataBrowser(props) { - function activateRecord(newIndex) { - props.onActivate(props.data[newIndex], newIndex); - } - const { index } = props; - const length = props.data && props.data.length || 0; - const dropdownRef = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - return (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.focus(); - }; - return (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelDataBrowser, - className: "sanddance-dataIndex" - }, (0, _base.base).react.createElement((0, _dropdown.Dropdown), { - componentRef: dropdownRef, - label: (0, _language.strings).labelDataScope, - collapseLabel: true, - options: [ - { - key: (0, _dataScope.DataScopeId).AllData, - text: (0, _language.strings).selectDataSpanAll, - isSelected: props.selectedDataScope === (0, _dataScope.DataScopeId).AllData - }, - { - key: (0, _dataScope.DataScopeId).FilteredData, - text: (0, _language.strings).selectDataSpanFilter, - isSelected: props.selectedDataScope === (0, _dataScope.DataScopeId).FilteredData - }, - { - key: (0, _dataScope.DataScopeId).SelectedData, - text: (0, _language.strings).selectDataSpanSelection, - isSelected: props.selectedDataScope === (0, _dataScope.DataScopeId).SelectedData - } - ], - onChange: (e, o)=>{ - props.onDataScopeClick(o.key); - } - }), !props.data && (0, _base.base).react.createElement("div", { - dangerouslySetInnerHTML: { - __html: props.nullMessage - } - }), props.data && !props.data.length && (0, _base.base).react.createElement("div", null, props.zeroMessage), !!length && (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement("div", { - className: "index" - }, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - iconName: "ChevronLeftMed", - onClick: (e)=>activateRecord(index <= 0 ? length - 1 : index - 1), - disabled: props.disabled || length === 1, - title: (0, _language.strings).buttonPrevDataItem - }), (0, _base.base).react.createElement("span", null, (0, _language.strings).record(index + 1, length)), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - themePalette: props.themePalette, - iconName: "ChevronRightMed", - onClick: (e)=>activateRecord(index >= length - 1 ? 0 : index + 1), - disabled: props.disabled || length === 1, - title: (0, _language.strings).buttonNextDataItem - })), !props.itemVisible && (0, _base.base).react.createElement("div", { - className: "item-filtered" - }, (0, _language.strings).labelDataItemIsFiltered), (0, _base.base).react.createElement((0, _dataItem.DataItem), { - columns: props.columns, - item: props.data[index], - disabled: props.disabled, - onSearch: props.onSearch, - bingSearchDisabled: props.bingSearchDisabled - })), (0, _base.base).react.createElement((0, _columnTypeChanger.ColumnTypeChanger), { - theme: props.theme, - themePalette: props.themePalette, - initialCategoricalColumns: props.categoricalColumns, - initialQuantitativeColumns: props.quantitativeColumns, - onConfirmUpdate: props.onUpdateColumnTypes - }), props.dataExportHandler && props.data && (0, _base.base).react.createElement((0, _dataExporter.DataExportPicker), { - theme: props.theme, - initializer: { - fileName: `${(0, _dataExporter.removeExtensions)(props.displayName)} (${props.data.length})` - }, - data: props.data, - dataExportHandler: props.dataExportHandler, - disabled: props.disabled - })); -} - -},{"../base":"3TPz5","../controls/dataExporter":"7XSio","../controls/dataItem":"900yp","../controls/dataScope":"0ukjY","../controls/dropdown":"7pP8h","../controls/group":"afKlW","../controls/iconButton":"6pZiK","../language":"67xOI","../controls/columnTypeChanger":"7dBYz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"900yp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataItem", ()=>DataItem); -var _base = require("../base"); -var _keycodes = require("../keycodes"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function isNumber(value) { - if (typeof value === 'number') return true; - if (!isNaN(value)) return true; + } + let loaded$3 = false; + function load$5() { + schemesJSX["blueorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-blueorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(5, 48, 97)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(34, 101, 163)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(75, 148, 196)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(143, 194, 221)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(205, 227, 238)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(242, 240, 235)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(253, 221, 179)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(248, 182, 100)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(221, 132, 31)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(178, 90, 9)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 59, 8)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-blueorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["brownbluegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-brownbluegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(84, 48, 5)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(139, 84, 15)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(188, 132, 53)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(222, 190, 123)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(242, 228, 192)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(238, 241, 234)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(195, 231, 226)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(127, 201, 191)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(57, 152, 143)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(10, 103, 95)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 60, 48)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-brownbluegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purplegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purplegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(64, 0, 75)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(115, 47, 128)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(154, 109, 170)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(193, 164, 205)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(228, 210, 230)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(239, 240, 239)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(214, 238, 209)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(162, 215, 158)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(92, 173, 101)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(33, 120, 57)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 68, 27)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purplegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["pinkyellowgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-pinkyellowgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(142, 1, 82)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(192, 38, 126)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(221, 114, 173)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(240, 179, 214)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(250, 221, 237)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(245, 243, 239)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(225, 242, 202)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(182, 222, 135)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(128, 187, 71)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(79, 145, 37)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(39, 100, 25)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-pinkyellowgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purpleorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purpleorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(45, 0, 75)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(85, 45, 132)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(129, 112, 172)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(176, 170, 208)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(215, 215, 233)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(243, 238, 234)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(253, 221, 179)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(248, 182, 100)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(221, 132, 31)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(178, 90, 9)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 59, 8)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purpleorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(103, 0, 31)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(172, 32, 47)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 96, 80)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(241, 163, 133)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(251, 215, 196)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(242, 239, 238)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(205, 227, 238)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(143, 194, 221)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(75, 148, 196)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(34, 101, 163)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(5, 48, 97)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redgrey"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redgrey" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(103, 0, 31)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(172, 32, 47)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 96, 80)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(241, 163, 133)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(252, 216, 197)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(250, 244, 241)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(223, 223, 223)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(184, 184, 184)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(134, 134, 134)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(78, 78, 78)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(26, 26, 26)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redgrey)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redyellowblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redyellowblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(165, 0, 38)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(212, 50, 44)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(241, 110, 67)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 172, 100)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 221, 144)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(250, 248, 193)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(220, 241, 236)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(171, 214, 232)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(117, 171, 208)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(74, 116, 180)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(49, 54, 149)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redyellowblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redyellowgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redyellowgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(165, 0, 38)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(212, 50, 44)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(241, 110, 67)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 172, 99)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 221, 141)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(249, 247, 174)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(215, 238, 142)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(164, 216, 110)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(100, 188, 97)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(34, 150, 79)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 104, 55)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redyellowgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["spectral"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-spectral" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(158, 1, 66)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(209, 60, 75)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(240, 112, 74)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 172, 99)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 221, 141)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(251, 248, 176)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(224, 243, 161)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(169, 221, 162)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(105, 189, 169)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(66, 136, 181)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(94, 79, 162)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-spectral)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded$3 = true; + } + function diverging(selected) { + if (!loaded$3) + load$5(); + return [ + schemeOption(selected, "blueorange"), + schemeOption(selected, "brownbluegreen"), + schemeOption(selected, "purplegreen"), + schemeOption(selected, "pinkyellowgreen"), + schemeOption(selected, "purpleorange"), + schemeOption(selected, "redblue"), + schemeOption(selected, "redgrey"), + schemeOption(selected, "redyellowblue"), + schemeOption(selected, "redyellowgreen"), + schemeOption(selected, "spectral") + ]; + } + let loaded$2 = false; + function load$4() { + colorSchemes.filter((cs) => cs.colors.length === 2).map((binaryScheme, i) => { + schemesJSX[binaryScheme.scheme] = base$1.react.createElement("div", { className: "swatch" }, binaryScheme.colors.map((color2, j) => base$1.react.createElement("div", { key: j, title: color2, style: { width: "50%", backgroundColor: color2 } }))); + }); + loaded$2 = true; + } + function dual(selected) { + if (!loaded$2) + load$4(); + return colorSchemes.filter((cs) => cs.colors.length === 2).map((binaryScheme, i) => schemeOption(selected, binaryScheme.scheme)); + } + let loaded$1 = false; + function load$3() { + schemesJSX["viridis"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-viridis" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#440154" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#482475" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#414487" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#355f8d" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#2a788e" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#21918c" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#22a884" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#44bf70" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#7ad151" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#bddf26" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fde725" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-viridis)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["inferno"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-inferno" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#000004" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#160b39" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#420a68" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#6a176e" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#932667" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#bc3754" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#dd513a" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f37819" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fca50a" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#f6d746" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fcffa4" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-inferno)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["magma"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-magma" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#000004" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#140e36" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#3b0f70" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#641a80" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#8c2981" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#b73779" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#de4968" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f7705c" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fe9f6d" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fecf92" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fcfdbf" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-magma)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["plasma"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-plasma" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#0d0887" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#41049d" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#6a00a8" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#8f0da4" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#b12a90" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#cc4778" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#e16462" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f2844b" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fca636" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fcce25" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#f0f921" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-plasma)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["cividis"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-cividis" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#002051" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#0a326a" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#2b446e" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#4d566d" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#696970" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#7f7c75" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#948f78" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ada476" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#caba6a" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ead156" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#fdea45" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-cividis)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["turbo"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-turbo" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#23171b" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#4a58dd" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#2f9df5" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#27d7c4" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#4df884" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#95fb51" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#dedd32" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ffa423" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#f65f18" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ba2208" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#900c00" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-turbo)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["bluegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-bluegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 253)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(232, 246, 249)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 239, 237)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(183, 228, 218)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(143, 211, 193)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(104, 194, 163)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(73, 177, 127)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 153, 89)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(21, 127, 60)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(3, 100, 41)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 68, 27)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-bluegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["bluepurple"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-bluepurple" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 253)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(228, 238, 245)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(204, 221, 236)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(178, 202, 225)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(156, 179, 213)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(143, 149, 198)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(140, 116, 181)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(137, 82, 165)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(133, 45, 143)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(115, 15, 113)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(77, 0, 75)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-bluepurple)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["goldgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-goldgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f4d166" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#d5ca60" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#b6c35c" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#98bb59" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#7cb257" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#60a656" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#4b9c53" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#3f8f4f" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#33834a" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#257740" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#146c36" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-goldgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["goldorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-goldorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f4d166" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#f8be5c" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#f8aa4c" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#f5983b" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#f3852a" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#ef701b" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#e2621f" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#d65322" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#c54923" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#b14223" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#9e3a26" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-goldorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["goldred"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-goldred" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f4d166" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#f6be59" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#f9aa51" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#fc964e" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#f6834b" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#ee734a" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#e56249" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#db5247" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#cf4244" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#c43141" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#b71d3e" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-goldred)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["greenblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-greenblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 240)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(229, 245, 223)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(211, 238, 206)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(189, 229, 191)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(158, 217, 187)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(123, 203, 196)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(88, 183, 205)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(57, 156, 198)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(29, 126, 183)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(11, 96, 161)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(8, 64, 129)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-greenblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["orangered"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-orangered" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 236)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(254, 235, 207)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(253, 220, 175)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(253, 202, 148)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(253, 176, 122)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(250, 142, 93)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(241, 108, 73)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(224, 69, 48)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(200, 29, 19)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(167, 4, 3)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 0, 0)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-orangered)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purplebluegreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purplebluegreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 251)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(239, 231, 242)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(219, 216, 234)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(190, 201, 226)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(152, 185, 217)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(105, 168, 207)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(64, 150, 192)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(25, 135, 159)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(3, 120, 119)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(1, 99, 83)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(1, 70, 54)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purplebluegreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purpleblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purpleblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 251)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(239, 234, 244)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(219, 218, 235)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(191, 201, 226)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(155, 185, 217)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(114, 168, 207)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(67, 148, 195)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(26, 125, 182)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(6, 103, 161)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(4, 82, 129)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(2, 56, 88)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purpleblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purplered"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purplered" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 244, 249)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(234, 227, 240)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(220, 201, 226)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(208, 170, 210)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(208, 138, 194)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(221, 99, 174)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(227, 56, 144)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(215, 28, 108)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(183, 11, 79)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(143, 2, 58)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(103, 0, 31)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purplered)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["redpurple"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-redpurple" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 247, 243)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(253, 228, 225)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(252, 207, 204)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(251, 181, 188)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(249, 147, 176)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(243, 105, 163)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(224, 62, 152)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(192, 23, 136)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(153, 3, 124)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(112, 1, 116)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(73, 0, 106)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-redpurple)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yellowgreenblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yellowgreenblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 217)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(239, 249, 189)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(213, 238, 179)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(169, 221, 183)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(115, 201, 189)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(69, 180, 194)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(40, 151, 191)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(32, 115, 178)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(35, 78, 160)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(28, 49, 133)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(8, 29, 88)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yellowgreenblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yellowgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yellowgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 229)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(247, 252, 196)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(228, 244, 172)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(199, 232, 155)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(162, 216, 138)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(120, 197, 120)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(78, 175, 99)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 148, 78)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(21, 121, 63)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(3, 96, 52)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 69, 41)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yellowgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yelloworangebrown"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yelloworangebrown" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 229)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(255, 248, 196)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(254, 234, 161)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(254, 214, 118)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 186, 74)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(251, 153, 44)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(238, 121, 24)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(216, 91, 10)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(183, 67, 4)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(143, 50, 4)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(102, 37, 6)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yelloworangebrown)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["yelloworangered"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-yelloworangered" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 204)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(255, 240, 169)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(254, 224, 135)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(254, 201, 101)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(254, 171, 75)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(253, 137, 60)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(250, 92, 46)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(236, 48, 35)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(211, 17, 33)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(175, 2, 37)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(128, 0, 38)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-yelloworangered)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#323232" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#2e4463" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#1e588a" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#086da7" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#0082b9" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#039ac7" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#12b1d4" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#2bc8e2" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#3ddff0" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#61f4fb" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffff" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkgold"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkgold" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#3c3c3c" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#554a38" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#6d5a35" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#846f32" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#a0832d" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#bf9828" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#dbb022" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f0cb23" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#fae241" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fff290" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffff" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkgold)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkgreen"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkgreen" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#3a3a3a" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#245447" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#076a4c" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#038145" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#2d9642" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#5fa941" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#89bb3f" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#b3cb3b" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#dbdc34" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ffed39" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffaa" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkgreen)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkmulti"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkmulti" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#373737" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#294767" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#1e5b88" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#1a748b" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#1f8e7e" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#29a869" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#6abf50" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#aad332" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#eae30d" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#fff166" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffffff" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkmulti)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["darkred"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-darkred" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#343434" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#643633" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#8c3a36" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#b03e38" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#d14632" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#e75d1e" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#eb7e20" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ed9c25" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#efb92d" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#f3d431" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ffeb2c" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-darkred)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightgreyred"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightgreyred" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#efe9e6" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#e2dcd9" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#d7cecb" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#ccc1be" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#c0b4af" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#c4a293" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#d38b66" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#de7336" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#e15917" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#df3a10" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#dc000b" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightgreyred)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightgreyteal"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightgreyteal" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#e4eaea" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#d7ddde" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#cbd1d4" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#bcc6ca" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#adbac0" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#85b2be" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#4aacc1" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#22a1c2" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#2192c0" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#1e84be" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#1876bc" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightgreyteal)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightmulti"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightmulti" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#e0f1f2" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#caebd7" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#b8e2b3" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#bddf93" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#d8e17e" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#f6e072" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#f6c659" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#f4a946" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#f58a3f" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#f56c3f" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#ef4a3c" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightmulti)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lightorange"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lightorange" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#f2e7da" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#f7d7bd" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#f9c7a0" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#fab78a" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#faa47a" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#f8936d" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#f38264" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#ed725f" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#e6605b" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#dd4f5b" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#d43d5b" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lightorange)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["lighttealblue"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-lighttealblue" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#e3e9e0" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#c4ddd1" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#a2d1cb" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#84c4c9" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#66b5c3" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#49a7bd" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#3698b4" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#3188a9" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#2d799e" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#276994" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#255988" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-lighttealblue)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded$1 = true; + } + function sequentialMultiHue(selected) { + if (!loaded$1) + load$3(); + return [ + schemeOption(selected, "viridis"), + schemeOption(selected, "magma"), + schemeOption(selected, "inferno"), + schemeOption(selected, "plasma"), + schemeOption(selected, "cividis"), + schemeOption(selected, "turbo"), + schemeOption(selected, "bluegreen"), + schemeOption(selected, "bluepurple"), + schemeOption(selected, "goldgreen"), + schemeOption(selected, "goldorange"), + schemeOption(selected, "goldred"), + schemeOption(selected, "greenblue"), + schemeOption(selected, "orangered"), + schemeOption(selected, "purplebluegreen"), + schemeOption(selected, "purpleblue"), + schemeOption(selected, "purplered"), + schemeOption(selected, "redpurple"), + schemeOption(selected, "yellowgreenblue"), + schemeOption(selected, "yellowgreen"), + schemeOption(selected, "yelloworangebrown"), + schemeOption(selected, "yelloworangered"), + schemeHeader("schemeSequentialMultiHueDark", strings$1.schemeSequentialMultiHueDark), + schemeOption(selected, "darkblue"), + schemeOption(selected, "darkgold"), + schemeOption(selected, "darkgreen"), + schemeOption(selected, "darkmulti"), + schemeOption(selected, "darkred"), + schemeHeader("schemeSequentialMultiHueLight", strings$1.schemeSequentialMultiHueLight), + schemeOption(selected, "lightgreyred"), + schemeOption(selected, "lightgreyteal"), + schemeOption(selected, "lightmulti"), + schemeOption(selected, "lightorange"), + schemeOption(selected, "lighttealblue") + ]; + } + let loaded = false; + function load$2() { + schemesJSX["blues"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-blues" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 251, 255)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(227, 238, 249)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(207, 225, 242)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(181, 212, 233)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(147, 195, 223)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(109, 174, 213)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(75, 151, 201)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 126, 188)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(24, 100, 170)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(10, 74, 144)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(8, 48, 107)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-blues)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["tealblues"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-tealblues" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#bce4d8" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#a3d6d2" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#8cc9cd" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#76bdc7" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#5fb0c0" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#45a2b9" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#3993b0" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#3584a6" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#32759b" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#2f6790" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#2c5985" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-tealblues)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["teals"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-teals" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#bbdfdf" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#a2d4d5" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#8ac9c9" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#75bcbb" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#61b0af" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#4da5a4" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#379998" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#2b8b8c" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#1e7f7f" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#127273" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#006667" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-teals)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["greens"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-greens" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(247, 252, 245)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(232, 246, 227)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(211, 238, 205)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(183, 226, 177)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(151, 212, 148)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(115, 195, 120)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(77, 175, 98)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(47, 152, 79)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(21, 127, 59)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(3, 100, 41)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 68, 27)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-greens)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["greys"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-greys" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 255, 255)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(242, 242, 242)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(226, 226, 226)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(206, 206, 206)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(180, 180, 180)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(151, 151, 151)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(122, 122, 122)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(95, 95, 95)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(64, 64, 64)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(30, 30, 30)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(0, 0, 0)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-greys)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["purples"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-purples" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(252, 251, 253)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(241, 239, 246)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(226, 225, 239)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(206, 206, 229)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(182, 181, 216)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(158, 155, 201)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(135, 130, 188)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(115, 99, 172)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(97, 64, 155)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(80, 31, 140)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(63, 0, 125)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-purples)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["browns"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-browns" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#eedbbd" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#ecca96" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#e9b97a" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#e4a865" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#dc9856" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#d18954" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#c7784c" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#c0673f" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#b85536" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#ad4433" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#9f3632" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-browns)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["reds"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-reds" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 245, 240)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(254, 227, 214)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(253, 201, 180)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(252, 170, 142)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(252, 138, 107)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(249, 105, 76)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(239, 69, 51)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(217, 39, 35)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(187, 21, 26)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(151, 11, 19)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(103, 0, 13)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-reds)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["oranges"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-oranges" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "rgb(255, 245, 235)" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "rgb(254, 232, 211)" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "rgb(253, 216, 179)" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "rgb(253, 194, 140)" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "rgb(253, 167, 98)" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "rgb(251, 141, 61)" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "rgb(242, 112, 29)" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "rgb(226, 86, 9)" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "rgb(196, 65, 3)" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "rgb(159, 51, 3)" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "rgb(127, 39, 4)" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-oranges)", x: "0", y: "0", width: "1", height: "1" }) + ); + schemesJSX["warmgreys"] = base$1.react.createElement( + "svg", + { viewBox: "0,0,1,1", preserveAspectRatio: "none" }, + base$1.react.createElement( + "defs", + null, + base$1.react.createElement( + "linearGradient", + { id: "gradient-warmgreys" }, + base$1.react.createElement("stop", { offset: "0%", stopColor: "#dcd4d0" }), + base$1.react.createElement("stop", { offset: "10%", stopColor: "#cec5c1" }), + base$1.react.createElement("stop", { offset: "20%", stopColor: "#c0b8b4" }), + base$1.react.createElement("stop", { offset: "30%", stopColor: "#b3aaa7" }), + base$1.react.createElement("stop", { offset: "40%", stopColor: "#a59c99" }), + base$1.react.createElement("stop", { offset: "50%", stopColor: "#98908c" }), + base$1.react.createElement("stop", { offset: "60%", stopColor: "#8b827f" }), + base$1.react.createElement("stop", { offset: "70%", stopColor: "#7e7673" }), + base$1.react.createElement("stop", { offset: "80%", stopColor: "#726866" }), + base$1.react.createElement("stop", { offset: "90%", stopColor: "#665c5a" }), + base$1.react.createElement("stop", { offset: "100%", stopColor: "#59504e" }) + ) + ), + base$1.react.createElement("rect", { fill: "url(#gradient-warmgreys)", x: "0", y: "0", width: "1", height: "1" }) + ); + loaded = true; + } + function sequentialSingleHue(selected) { + if (!loaded) + load$2(); + return [ + schemeOption(selected, "blues"), + schemeOption(selected, "tealblues"), + schemeOption(selected, "teals"), + schemeOption(selected, "greens"), + schemeOption(selected, "browns"), + schemeOption(selected, "oranges"), + schemeOption(selected, "reds"), + schemeOption(selected, "purples"), + schemeOption(selected, "warmgreys"), + schemeOption(selected, "greys") + ]; + } + const maxDistinctColors = 20; + function Palette(props) { + const { distinctValueCount } = props.colorColumn.stats; + const isDual = distinctValueCount === 2; + const categoricalNumeric = distinctValueCount > 0 && distinctValueCount < maxDistinctColors; + let isQualitative = false; + let isQuantitative2 = false; + switch (props.colorColumn.type) { + case "boolean": + case "string": + isQualitative = true; + break; + case "number": + isQuantitative2 = true; + break; + case "date": + case "integer": + isQuantitative2 = true; + isQualitative = categoricalNumeric; + } + const selected = props.scheme; + const options2 = []; + function menu(name, opts) { + if (options2.length) { + options2.push({ + key: "divider" + options2.length, + text: null, + itemType: base$1.fluentUI.DropdownMenuItemType.Divider + }); + } + options2.push({ + key: name, + text: name, + itemType: base$1.fluentUI.DropdownMenuItemType.Header + }); + options2.push.apply(options2, opts); + } + isQualitative && menu(strings$1.schemeCategorical, categorical(selected)); + isQuantitative2 && menu(strings$1.schemeSequentialSingleHue, sequentialSingleHue(selected)); + isQuantitative2 && menu(strings$1.schemeSequentialMultiHue, sequentialMultiHue(selected)); + isQuantitative2 && menu(strings$1.schemeDiverging, diverging(selected)); + isQuantitative2 && menu(strings$1.schemeCyclical, cyclical(selected)); + isDual && menu(strings$1.schemeDual, dual(selected)); + return base$1.react.createElement( + "div", + { className: "sanddance-palette" }, + base$1.react.createElement("div", { className: "sanddance-explanation", dangerouslySetInnerHTML: { + __html: strings$1.labelColorFieldInfo(props.colorColumn.name, props.colorColumn.type, categoricalNumeric, distinctValueCount) + } }), + base$1.react.createElement(Dropdown$1, { collapseLabel: props.collapseLabel, disabled: props.disabled, dropdownWidth: 400, label: strings$1.labelColorScheme, onRenderOption: (option) => { + if (option.itemType === base$1.fluentUI.DropdownMenuItemType.Header) { + return base$1.react.createElement("span", null, option.text); + } else { + return base$1.react.createElement( + "div", + { className: "sanddance-scheme option" }, + base$1.react.createElement("span", { className: "name" }, option.scheme), + option.children + ); + } + }, options: options2, onChange: (e, o) => { + props.changeColorScheme(o.scheme); + } }), + base$1.react.createElement("div", { className: classList("sanddance-scheme", props.disabled && "disabled") }, props.scheme && schemesJSX[props.scheme]) + ); + } + function Color(props) { + const colorColumn = props.dataContent.columns.filter((c2) => c2.name === props.colorColumn)[0]; + const disabledColorBin = !colorColumn || !colorColumn.quantitative || props.directColor; + const colorBin = props.colorBin || "quantize"; + const dropdownRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = dropdownRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + "div", + { className: "sanddance-color-dialog" }, + base$1.react.createElement( + Group$1, + { label: strings$1.labelColor }, + base$1.react.createElement(ColumnMap, Object.assign({}, props, { componentRef: dropdownRef, collapseLabel: props.compactUI, selectedColumnName: props.colorColumn, specRole: props.specCapabilities && props.specCapabilities.roles.filter((r) => r.role === "color")[0], key: 0 })), + colorColumn && colorColumn.isColorData && base$1.react.createElement("div", { className: "sanddance-explanation", dangerouslySetInnerHTML: { __html: strings$1.labelColorFieldIsColorData(colorColumn.name) } }), + colorColumn && !colorColumn.isColorData && base$1.react.createElement(Palette, { collapseLabel: props.compactUI, scheme: props.scheme, colorColumn, changeColorScheme: (scheme2) => { + props.onColorSchemeChange(scheme2); + }, disabled: props.disabled || props.directColor || colorColumn && colorColumn.isColorData }), + colorColumn && !colorColumn.isColorData && base$1.react.createElement(Signal, { disabled: props.disabled || !colorColumn || props.directColor || colorColumn && colorColumn.isColorData, signal: props.colorReverseSignal, explorer: props.explorer, initialValue: getInitialSignalValue(props.explorer, props.colorReverseSignal), onChange: props.onColorReverseChange, collapseLabel: props.compactUI }) + ), + colorColumn && !colorColumn.isColorData && base$1.react.createElement( + Group$1, + { label: strings$1.labelColorBin }, + base$1.react.createElement("div", { className: "sanddance-explanation" }, strings$1.labelColorBinExplanation), + base$1.react.createElement(base$1.fluentUI.ChoiceGroup, { selectedKey: colorBin, options: [ + { + key: "continuous", + text: strings$1.labelColorBinNone, + disabled: disabledColorBin + }, + { + key: "quantize", + text: strings$1.labelColorBinQuantize, + disabled: disabledColorBin + }, + { + key: "quantile", + text: strings$1.labelColorBinQuantile, + disabled: disabledColorBin + } + ], onChange: (e, o) => { + props.onColorBinChange(o.key); + } }), + base$1.react.createElement(Signal, { disabled: props.disabled || disabledColorBin || props.colorBin === "continuous", signal: props.colorBinSignal, explorer: props.explorer, initialValue: getInitialSignalValue(props.explorer, props.colorBinSignal), onChange: props.onColorBinCountChange, collapseLabel: props.compactUI }) + ), + colorColumn && !colorColumn.isColorData && base$1.react.createElement( + Group$1, + { label: strings$1.labelColorOptions }, + base$1.react.createElement(base$1.fluentUI.Toggle, { label: strings$1.selectDirectColor, disabled: !colorColumn.stats.hasColorData, checked: !!(colorColumn.stats.hasColorData && props.directColor), onChange: (e, checked) => props.onDirectColorChange(checked) }), + base$1.react.createElement("div", { className: "sanddance-explanation", dangerouslySetInnerHTML: { __html: strings$1.labelDataColors } }) + ) + ); + } + const KeyCodes$1 = { + ENTER: 13 + }; + function isNumber$2(value2) { + if (typeof value2 === "number") + return true; + if (!isNaN(value2)) + return true; return false; -} -function isBoolean(value) { - if (typeof value === 'boolean') return true; - if (typeof value === 'string') switch(value.toLowerCase()){ + } + function isBoolean$2(value2) { + if (typeof value2 === "boolean") + return true; + if (typeof value2 === "string") { + switch (value2.toLowerCase()) { case "true": case "false": - return true; + return true; + } } return false; -} -function bingSearchLink(column, value) { - if (isNumber(value)) return null; - if (isBoolean(value)) return null; - if (column && column.stats.distinctValueCount === 2) return null; - return (0, _base.base).react.createElement("div", { - className: 'bing-search' - }, (0, _base.base).react.createElement("a", { - href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`, - target: '_blank', - title: (0, _language.strings).bingsearchDescription(value), - "aria-label": (0, _language.strings).bingsearchDescription(value) - }, (0, _language.strings).bingsearch)); -} -function displayValue(value) { - switch(value){ - case '': - return { - special: true, - display: (0, _language.strings).labelBlank - }; - case null: - return { - special: true, - display: (0, _language.strings).labelNull - }; - case true: - return { - special: true, - display: (0, _language.strings).labelTrue - }; - case false: - return { - special: true, - display: (0, _language.strings).labelFalse - }; - default: - if (typeof value === 'object') { - if (value instanceof Date) { - const d = value; - return displayValue(d.input); - } - return { - special: false, - display: value.toLocaleString() - }; - } - return { - special: false, - display: value - }; + } + function bingSearchLink(column, value2) { + if (isNumber$2(value2)) + return null; + if (isBoolean$2(value2)) + return null; + if (column && column.stats.distinctValueCount === 2) + return null; + return base$1.react.createElement( + "div", + { className: "bing-search" }, + base$1.react.createElement("a", { href: `https://www.bing.com/search?q=${encodeURIComponent(value2)}`, target: "_blank", title: strings$1.bingsearchDescription(value2), "aria-label": strings$1.bingsearchDescription(value2) }, strings$1.bingsearch) + ); + } + function displayValue(value2) { + switch (value2) { + case "": { + return { special: true, display: strings$1.labelBlank }; + } + case null: { + return { special: true, display: strings$1.labelNull }; + } + case true: { + return { special: true, display: strings$1.labelTrue }; + } + case false: { + return { special: true, display: strings$1.labelFalse }; + } + default: { + if (typeof value2 === "object") { + if (value2 instanceof Date) { + const d2 = value2; + return displayValue(d2.input); + } + return { special: false, display: value2.toLocaleString() }; + } + return { special: false, display: value2 }; + } + } + } + function displayValueElement(nvp) { + const d2 = displayValue(nvp.value); + if (d2.special) { + return base$1.react.createElement("i", null, d2.display); + } + return d2.display; + } + function DataItem(props) { + if (!props.item) { + return null; } -} -function displayValueElement(nvp) { - const d = displayValue(nvp.value); - if (d.special) return (0, _base.base).react.createElement("i", null, d.display); - return d.display; -} -function DataItem(props) { - if (!props.item) return null; const nameValuePairs = []; - for(const columnName in props.item){ - if (columnName === (0, _sanddanceReact.SandDance).constants.GL_ORDINAL && !props.showSystemFields) continue; - if ((0, _sanddanceReact.SandDance).util.isInternalFieldName(columnName)) continue; - const nameValuePair = { - columnName, - value: props.item[columnName] - }; - if (!props.bingSearchDisabled) nameValuePair.bingSearch = bingSearchLink(props.columns.filter((c)=>c.name === columnName)[0], props.item[columnName]); - nameValuePairs.push(nameValuePair); - } - return (0, _base.base).react.createElement("div", { - className: "sanddance-dataItem" - }, nameValuePairs.map((nameValuePair, i)=>{ - const ex = { - key: 0, - name: nameValuePair.columnName, - operator: '==', - value: nameValuePair.value - }; - if (nameValuePair.value === null || nameValuePair.value === '') { - ex.operator = 'isnullorEmpty'; - delete ex.value; - } - const searchClick = (e)=>{ - const search = { - key: 0, - expressions: [ - ex - ] - }; - props.onSearch(e, [ - search - ]); - }; - const title = (0, _language.strings).tooltipSearch(nameValuePair.columnName, displayValue(nameValuePair.value).display); - return (0, _base.base).react.createElement("div", { - key: i, - onClick: !props.disabled ? searchClick : null, - title: title, - onKeyUp: (e)=>{ - if (e.keyCode === (0, _keycodes.KeyCodes).ENTER) searchClick(e); - }, - tabIndex: 0, - className: "name-value" - }, (0, _base.base).react.createElement("div", { - className: "column-name" - }, nameValuePair.columnName), (0, _base.base).react.createElement("div", { - className: "column-value" - }, displayValueElement(nameValuePair)), nameValuePair.bingSearch); + for (const columnName in props.item) { + if (columnName === GL_ORDINAL && !props.showSystemFields) { + continue; + } + if (isInternalFieldName(columnName)) { + continue; + } + const nameValuePair = { + columnName, + value: props.item[columnName] + }; + if (!props.bingSearchDisabled) { + nameValuePair.bingSearch = bingSearchLink(props.columns.filter((c2) => c2.name === columnName)[0], props.item[columnName]); + } + nameValuePairs.push(nameValuePair); + } + return base$1.react.createElement("div", { className: "sanddance-dataItem" }, nameValuePairs.map((nameValuePair, i) => { + const ex = { + key: 0, + name: nameValuePair.columnName, + operator: "==", + value: nameValuePair.value + }; + if (nameValuePair.value === null || nameValuePair.value === "") { + ex.operator = "isnullorEmpty"; + delete ex.value; + } + const searchClick = (e) => { + const search = { + key: 0, + expressions: [ex] + }; + props.onSearch(e, [search]); + }; + const title = strings$1.tooltipSearch(nameValuePair.columnName, displayValue(nameValuePair.value).display); + return base$1.react.createElement( + "div", + { key: i, onClick: !props.disabled ? searchClick : null, title, onKeyUp: (e) => { + if (e.keyCode === KeyCodes$1.ENTER) { + searchClick(e); + } + }, tabIndex: 0, className: "name-value" }, + base$1.react.createElement("div", { className: "column-name" }, nameValuePair.columnName), + base$1.react.createElement("div", { className: "column-value" }, displayValueElement(nameValuePair)), + nameValuePair.bingSearch + ); })); -} - -},{"../base":"3TPz5","../keycodes":"8gTMx","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8gTMx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyCodes", ()=>KeyCodes); -const KeyCodes = { - ENTER: 13 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4nAWT":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "History", ()=>History); -parcelHelpers.export(exports, "getPureInsight", ()=>getPureInsight); -parcelHelpers.export(exports, "replay", ()=>replay); -var _base = require("../base"); -var _group = require("../controls/group"); -var _keycodes = require("../keycodes"); -var _language = require("../language"); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function History(props) { - return (0, _base.base).react.createElement((0, _group.Group), { - label: (0, _language.strings).labelHistory, - className: "sanddance-history" - }, (0, _base.base).react.createElement("ol", null, props.historyItems.map((hi, i)=>{ - let ref; + } + const dataBrowserZeroMessages = {}; + dataBrowserZeroMessages[DataScopeId.AllData] = strings$1.labelZeroAll; + dataBrowserZeroMessages[DataScopeId.FilteredData] = null; + dataBrowserZeroMessages[DataScopeId.SelectedData] = strings$1.labelZeroSearchResults; + const dataBrowserNullMessages = {}; + dataBrowserNullMessages[DataScopeId.AllData] = strings$1.labelDataNullAll; + dataBrowserNullMessages[DataScopeId.FilteredData] = strings$1.labelDataNullFiltered; + dataBrowserNullMessages[DataScopeId.SelectedData] = strings$1.labelDataNullSelection; + function DataBrowser(props) { + function activateRecord(newIndex) { + props.onActivate(props.data[newIndex], newIndex); + } + const { index: index2 } = props; + const length2 = props.data && props.data.length || 0; + const dropdownRef = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + return (_a2 = dropdownRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + return base$1.react.createElement( + Group$1, + { label: strings$1.labelDataBrowser, className: "sanddance-dataIndex" }, + base$1.react.createElement(Dropdown$1, { componentRef: dropdownRef, label: strings$1.labelDataScope, collapseLabel: true, options: [ + { + key: DataScopeId.AllData, + text: strings$1.selectDataSpanAll, + isSelected: props.selectedDataScope === DataScopeId.AllData + }, + { + key: DataScopeId.FilteredData, + text: strings$1.selectDataSpanFilter, + isSelected: props.selectedDataScope === DataScopeId.FilteredData + }, + { + key: DataScopeId.SelectedData, + text: strings$1.selectDataSpanSelection, + isSelected: props.selectedDataScope === DataScopeId.SelectedData + } + ], onChange: (e, o) => { + props.onDataScopeClick(o.key); + } }), + !props.data && base$1.react.createElement("div", { dangerouslySetInnerHTML: { __html: props.nullMessage } }), + props.data && !props.data.length && base$1.react.createElement("div", null, props.zeroMessage), + !!length2 && base$1.react.createElement( + "div", + null, + base$1.react.createElement( + "div", + { className: "index" }, + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, iconName: "ChevronLeftMed", onClick: (e) => activateRecord(index2 <= 0 ? length2 - 1 : index2 - 1), disabled: props.disabled || length2 === 1, title: strings$1.buttonPrevDataItem }), + base$1.react.createElement("span", null, strings$1.record(index2 + 1, length2)), + base$1.react.createElement(IconButton$1, { themePalette: props.themePalette, iconName: "ChevronRightMed", onClick: (e) => activateRecord(index2 >= length2 - 1 ? 0 : index2 + 1), disabled: props.disabled || length2 === 1, title: strings$1.buttonNextDataItem }) + ), + !props.itemVisible && base$1.react.createElement("div", { className: "item-filtered" }, strings$1.labelDataItemIsFiltered), + base$1.react.createElement(DataItem, { columns: props.columns, item: props.data[index2], disabled: props.disabled, onSearch: props.onSearch, bingSearchDisabled: props.bingSearchDisabled }) + ), + base$1.react.createElement(ColumnTypeChanger, { theme: props.theme, themePalette: props.themePalette, initialCategoricalColumns: props.categoricalColumns, initialQuantitativeColumns: props.quantitativeColumns, onConfirmUpdate: props.onUpdateColumnTypes }), + props.dataExportHandler && props.data && base$1.react.createElement(DataExportPicker, { theme: props.theme, initializer: { + fileName: `${removeExtensions(props.displayName)} (${props.data.length})` + }, data: props.data, dataExportHandler: props.dataExportHandler, disabled: props.disabled }) + ); + } + function History(props) { + return base$1.react.createElement( + Group$1, + { label: strings$1.labelHistory, className: "sanddance-history" }, + base$1.react.createElement("ol", null, props.historyItems.map((hi, i) => { + let ref2; if (i === props.historyIndex) { - ref = (0, _base.base).react.createRef(); - props.explorer.dialogFocusHandler.focus = ()=>{ - var _a; - (_a = ref.current) === null || _a === void 0 || _a.focus(); - }; - } - return (0, _base.base).react.createElement("li", { - key: i, - className: (0, _sanddanceReact.util).classList(i === props.historyIndex && 'selected'), - onKeyUp: (e)=>{ - if (e.keyCode === (0, _keycodes.KeyCodes).ENTER) props.redo(i); - } - }, (0, _base.base).react.createElement((0, _base.base).fluentUI.DefaultButton, { - className: 'sanddance-history-button', - componentRef: ref, - text: hi.label, - onClick: ()=>props.redo(i) - })); - }))); -} -function getPureInsight(historicInsight) { - const { colorBin, columns, directColor, facetStyle, filter, hideAxes, hideLegend, scheme, signalValues, size, totalStyle, transform, chart, view } = historicInsight; + ref2 = base$1.react.createRef(); + props.explorer.dialogFocusHandler.focus = () => { + var _a2; + (_a2 = ref2.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + }; + } + return base$1.react.createElement( + "li", + { key: i, className: classList(i === props.historyIndex && "selected"), onKeyUp: (e) => { + if (e.keyCode === KeyCodes$1.ENTER) { + props.redo(i); + } + } }, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { className: "sanddance-history-button", componentRef: ref2, text: hi.label, onClick: () => props.redo(i) }) + ); + })) + ); + } + function getPureInsight(historicInsight) { + const { colorBin, columns, directColor, facetStyle, filter: filter2, hideAxes, hideLegend, scheme: scheme2, signalValues, size, totalStyle, transform: transform2, chart, view } = historicInsight; const insight = { - colorBin, - columns, - directColor, - facetStyle, - filter, - hideAxes, - hideLegend, - scheme, - signalValues, - size, - totalStyle, - transform, - chart, - view + colorBin, + columns, + directColor, + facetStyle, + filter: filter2, + hideAxes, + hideLegend, + scheme: scheme2, + signalValues, + size, + totalStyle, + transform: transform2, + chart, + view }; return insight; -} -function replay(historyItems, index) { - let filter = null; + } + function replay(historyItems, index2) { + let filter2 = null; let historicInsight = {}; - for(let i = 0; i < index + 1; i++){ - const historyItem = historyItems[i]; - if (historyItem) { - if (historyItem.historicInsight.filter === null) filter = null; - else if (historyItem.historicInsight.rebaseFilter) filter = historyItem.historicInsight.filter; - else if (historyItem.historicInsight.filter) filter = (0, _sanddanceReact.SandDance).searchExpression.narrow(filter, historyItem.historicInsight.filter); - historicInsight = Object.assign(Object.assign({}, historicInsight), historyItem.historicInsight); - } + for (let i = 0; i < index2 + 1; i++) { + const historyItem = historyItems[i]; + if (historyItem) { + if (historyItem.historicInsight.filter === null) { + filter2 = null; + } else if (historyItem.historicInsight.rebaseFilter) { + filter2 = historyItem.historicInsight.filter; + } else if (historyItem.historicInsight.filter) { + filter2 = narrow(filter2, historyItem.historicInsight.filter); + } + historicInsight = Object.assign(Object.assign({}, historicInsight), historyItem.historicInsight); + } } - return Object.assign(Object.assign({}, historicInsight), { - filter - }); -} - -},{"../base":"3TPz5","../controls/group":"afKlW","../keycodes":"8gTMx","../language":"67xOI","@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ioN9k":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getPosition", ()=>getPosition); -function hasClientXY(e) { - if (e && e.clientX !== undefined && e.clientX !== undefined) return { - top: e.clientY, - left: e.clientX - }; -} -function getPosition(e) { + return Object.assign(Object.assign({}, historicInsight), { filter: filter2 }); + } + function hasClientXY(e) { + if (e && e.clientX !== void 0 && e.clientX !== void 0) { + return { top: e.clientY, left: e.clientX }; + } + } + function getPosition(e) { const xy = hasClientXY(e); - if (xy) return xy; + if (xy) { + return xy; + } const te = e; - if (te === null || te === void 0 ? void 0 : te.touches) for(let i = 0; i < te.touches.length; i++){ - const xy = hasClientXY(te.touches[i]); - if (xy) return xy; + if (te === null || te === void 0 ? void 0 : te.touches) { + for (let i = 0; i < te.touches.length; i++) { + const xy2 = hasClientXY(te.touches[i]); + if (xy2) { + return xy2; + } + } } const el = e.target; - if (el && el.getClientRects) return el.getClientRects()[0]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1nehK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initPrefs", ()=>initPrefs); -parcelHelpers.export(exports, "saveSignalValuePref", ()=>saveSignalValuePref); -parcelHelpers.export(exports, "copyPrefToNewState", ()=>copyPrefToNewState); -parcelHelpers.export(exports, "savePref", ()=>savePref); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function initPrefs(prefs, partialInsight) { + if (el && el.getClientRects) { + return el.getClientRects()[0]; + } + } + function initPrefs(prefs, partialInsight) { if (partialInsight) { - const specTypePrefs = prefs[partialInsight.chart] || {}; - prefs[partialInsight.chart] = specTypePrefs; - for(const _role in partialInsight.columns){ - const role = _role; - if (role === 'color' || role === 'x') { - const rolePrefs = specTypePrefs[role] || {}; - specTypePrefs[role] = rolePrefs; - const column = partialInsight.columns[role]; - const copySignalValue = (signalName)=>{ - if (partialInsight.signalValues && partialInsight.signalValues[signalName] && rolePrefs[column]) { - const signalValues = rolePrefs[column].signalValues || {}; - signalValues[signalName] = partialInsight.signalValues[signalName]; - rolePrefs[column].signalValues = signalValues; - } - }; - switch(role){ - case 'color': - rolePrefs[column] = { - scheme: partialInsight.scheme, - colorBin: partialInsight.colorBin - }; - copySignalValue((0, _sanddanceReact.SandDance).constants.SignalNames.ColorBinCount); - break; - case 'x': - copySignalValue((0, _sanddanceReact.SandDance).constants.SignalNames.XBins); - break; - } - } + const specTypePrefs = prefs[partialInsight.chart] || {}; + prefs[partialInsight.chart] = specTypePrefs; + for (const _role in partialInsight.columns) { + const role = _role; + if (role === "color" || role === "x") { + const rolePrefs = specTypePrefs[role] || {}; + specTypePrefs[role] = rolePrefs; + const column = partialInsight.columns[role]; + const copySignalValue = (signalName) => { + if (partialInsight.signalValues && partialInsight.signalValues[signalName] && rolePrefs[column]) { + const signalValues = rolePrefs[column].signalValues || {}; + signalValues[signalName] = partialInsight.signalValues[signalName]; + rolePrefs[column].signalValues = signalValues; + } + }; + switch (role) { + case "color": + rolePrefs[column] = { + scheme: partialInsight.scheme, + colorBin: partialInsight.colorBin + }; + copySignalValue(SignalNames.ColorBinCount); + break; + case "x": + copySignalValue(SignalNames.XBins); + break; + } } + } } -} -function saveSignalValuePref(prefs, chart, role, column, signalName, signalValue) { - const partialInsight = savePref(prefs, chart, role, column, { - signalValues: {} - }); + } + function saveSignalValuePref(prefs, chart, role, column, signalName, signalValue) { + const partialInsight = savePref(prefs, chart, role, column, { signalValues: {} }); partialInsight.signalValues[signalName] = signalValue; -} -function copyPrefToNewState(prefs, chart, role, columnName) { - const specTypePrefs = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, prefs['*'], prefs[chart]); - const rolePrefs = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, specTypePrefs['*'], specTypePrefs[role]); - const partialInsight = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, rolePrefs['*'], rolePrefs[columnName]); + } + function copyPrefToNewState(prefs, chart, role, columnName) { + const specTypePrefs = deepMerge({}, prefs["*"], prefs[chart]); + const rolePrefs = deepMerge({}, specTypePrefs["*"], specTypePrefs[role]); + const partialInsight = deepMerge({}, rolePrefs["*"], rolePrefs[columnName]); return partialInsight; -} -function savePref(prefs, chart, role, column, partialInsight) { + } + function savePref(prefs, chart, role, column, partialInsight) { const SpecTypePrefs = prefs[chart] || {}; prefs[chart] = SpecTypePrefs; const rolePrefs = SpecTypePrefs[role] || {}; SpecTypePrefs[role] = rolePrefs; - rolePrefs[column] = (0, _sanddanceReact.SandDance).VegaMorphCharts.util.deepMerge({}, rolePrefs[column], partialInsight); + rolePrefs[column] = deepMerge({}, rolePrefs[column], partialInsight); return rolePrefs[column]; -} - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3oCWU":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "compareGroups", ()=>compareGroups); -parcelHelpers.export(exports, "createInputSearch", ()=>createInputSearch); -var _sanddanceReact = require("@msrvida/sanddance-react"); -function comparableGroup(group) { - return Object.assign(Object.assign({}, group), { - clause: null - }); -} -function compareGroup(a, b) { - return (0, _sanddanceReact.SandDance).searchExpression.compareGroup(comparableGroup(a), comparableGroup(b)); -} -function compareGroups(haystack, needle) { + } + function comparableGroup(group2) { + return Object.assign(Object.assign({}, group2), { clause: null }); + } + function compareGroup(a2, b2) { + return compareGroup$1(comparableGroup(a2), comparableGroup(b2)); + } + function compareGroups(haystack, needle) { const groups = []; let found = false; - //look for item in all - haystack.forEach((group)=>{ - if (compareGroup(group, needle)) //if it exists, don't add it + haystack.forEach((group2) => { + if (compareGroup(group2, needle)) { found = true; - else groups.push(group); + } else { + groups.push(group2); + } }); - return { - groups, - found - }; -} -function createInputSearch(search) { - const groups = (0, _sanddanceReact.SandDance).searchExpression.ensureSearchExpressionGroupArray(search); - const dialogSearch = groups.map((group, groupIndex)=>{ - return Object.assign(Object.assign({ - key: groupIndex - }, group), { - expressions: group.expressions.map((ex, i)=>{ - const ex2 = Object.assign({ - key: i - }, ex); - return ex2; - }) - }); + return { groups, found }; + } + function createInputSearch(search) { + const groups = ensureSearchExpressionGroupArray(search); + const dialogSearch = groups.map((group2, groupIndex) => { + return Object.assign(Object.assign({ key: groupIndex }, group2), { expressions: group2.expressions.map((ex, i) => { + const ex2 = Object.assign({ key: i }, ex); + return ex2; + }) }); }); return dialogSearch; -} - -},{"@msrvida/sanddance-react":"lPyTZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4tj9B":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Renderer", ()=>Renderer); -var _base = require("../base"); -var _language = require("../language"); -var _iconButton = require("./iconButton"); -var _dialog = require("./dialog"); -var _button = require("./button"); -function _Renderer(_props) { - class __Renderer extends (0, _base.base).react.Component { - constructor(props){ - var _a, _b; - super(props); - this.state = this.getInitialState(props); - if (!((_b = (_a = this.state.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 ? void 0 : _b.morphchartsref)) { - const t = setInterval(()=>{ - var _a, _b; - const newState = this.getInitialState(props); - if (this.mounted && ((_b = (_a = newState.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 ? void 0 : _b.morphchartsref)) { - clearInterval(t); - this.setState(newState); - } - }, 10); - } - } - componentDidMount() { - this.mounted = true; - } - componentWillUnmount() { - this.mounted = false; - } - getInitialState(props) { - const { viewer } = props.explorer; - return { - showOptions: false, - viewer - }; - } - setOptions(newOptions) { - const { explorer } = this.props; - const renderer = Object.assign(Object.assign({}, explorer.state.renderer), newOptions); - const { onSetupOptionsChanged } = explorer.props; - if (onSetupOptionsChanged) { - const setup = explorer.getSetup(); - setup.renderer = renderer; - onSetupOptionsChanged(setup); - } - explorer.setState({ - renderer - }); - } - setBasicOptions(newOptions) { - this.setOptions({ - advanced: false, - basicOptions: Object.assign(Object.assign({}, this.props.basicOptions), newOptions) - }); - } - setAdvancedOptions(newOptions) { - this.setOptions({ - advanced: true, - advancedOptions: Object.assign(Object.assign({}, this.props.advancedOptions), newOptions) - }); - } - render() { - var _a, _b; - const { props, state } = this; - const iconButtonStyles = { - menuIcon: { - display: 'none' - } - }; - if (!((_b = (_a = state.viewer) === null || _a === void 0 ? void 0 : _a.presenter) === null || _b === void 0 ? void 0 : _b.morphchartsref)) return (0, _base.base).react.createElement((0, _iconButton.IconButton), { - styles: iconButtonStyles, - className: 'sanddance-advanced-renderer', - disabled: true, - iconName: 'HourGlass', - onClick: undefined, - themePalette: props.themePalette, - title: (0, _language.strings).labelRenderer - }); - else { - const { morphchartsref } = state.viewer.presenter; - const choiceButtonStyle = { - border: 'none' - }; - const { advanced, advancedOptions, basicOptions } = props; - return (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _iconButton.IconButton), { - iconName: 'PicturePosition', - title: (0, _language.strings).buttonCameraHome, - onClick: props.onHomeClick, - styles: iconButtonStyles, - themePalette: props.themePalette - }), (0, _base.base).react.createElement((0, _iconButton.IconButton), { - styles: iconButtonStyles, - className: 'sanddance-advanced-renderer', - iconName: advanced ? 'DiamondSolid' : 'Diamond', - disabled: !morphchartsref.supportedRenders.advanced, - onClick: undefined, - themePalette: props.themePalette, - title: morphchartsref.supportedRenders.advanced ? (0, _language.strings).labelRenderer : (0, _language.strings).labelRendererAdvancedDisabled, - menuProps: { - items: [ - { - key: 'basic', - text: (0, _language.strings).labelRendererBasic, - iconProps: { - iconName: advanced ? null : 'RadioBullet' - }, - onClick: ()=>advanced && this.setOptions({ - advanced: false - }) - }, - { - key: 'advanced', - text: (0, _language.strings).labelRendererAdvanced, - iconProps: { - iconName: advanced ? 'RadioBullet' : null - }, - onClick: ()=>!advanced && this.setOptions({ - advanced: true - }) - }, - { - key: 'options', - text: (0, _language.strings).labelRendererOptions, - onClick: (e)=>this.setState({ - showOptions: true - }) - } - ] - } - }), (0, _base.base).react.createElement((0, _dialog.Dialog), { - hidden: !state.showOptions, - dialogContentProps: { - className: 'sanddance-renderer-dialog', - title: (0, _language.strings).labelRendererOptionsDialogTitle - }, - onDismiss: ()=>this.setState({ - showOptions: false - }) - }, (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - iconName: advanced ? 'RadioBtnOff' : 'RadioBtnOn', - onClick: ()=>this.setOptions({ - advanced: false - }), - text: (0, _language.strings).labelRendererBasic, - themePalette: props.themePalette, - rootStyle: choiceButtonStyle - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: basicOptions.antialias, - label: (0, _language.strings).labelRendererOptionsAntialias, - onChange: (e, antialias)=>this.setBasicOptions({ - antialias - }) - })))), (0, _base.base).react.createElement("div", null, (0, _base.base).react.createElement((0, _button.Button), { - iconName: advanced ? 'RadioBtnOn' : 'RadioBtnOff', - onClick: ()=>this.setOptions({ - advanced: true - }), - text: (0, _language.strings).labelRendererAdvanced, - themePalette: props.themePalette, - rootStyle: choiceButtonStyle - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isShadowEnabled, - label: (0, _language.strings).labelRendererOptionsShadow, - onChange: (e, isShadowEnabled)=>this.setAdvancedOptions({ - isShadowEnabled - }) - })), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isSsaoEnabled, - label: (0, _language.strings).labelRendererOptionsSsao, - onChange: (e, isSsaoEnabled)=>this.setAdvancedOptions({ - isSsaoEnabled - }) - })), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isBloomEnabled, - label: (0, _language.strings).labelRendererOptionsBloom, - onChange: (e, isBloomEnabled)=>this.setAdvancedOptions({ - isBloomEnabled - }) - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - value: advancedOptions.bloomIntensity, - min: 0.1, - max: 5, - step: 0.01, - label: (0, _language.strings).labelRendererOptionsBloomIntensity, - onChange: (bloomIntensity)=>this.setAdvancedOptions({ - bloomIntensity, - isBloomEnabled: true - }) - })))), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isDofEnabled, - label: (0, _language.strings).labelRendererOptionsDof, - onChange: (e, isDofEnabled)=>this.setAdvancedOptions({ - isDofEnabled - }) - }), (0, _base.base).react.createElement("ul", null, (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Slider, { - value: advancedOptions.dofFocusRange, - min: 0, - max: 2, - step: 0.01, - label: (0, _language.strings).labelRendererOptionsDofRange, - onChange: (dofFocusRange)=>this.setAdvancedOptions({ - dofFocusRange, - isDofEnabled: true - }) - })))), (0, _base.base).react.createElement("li", null, (0, _base.base).react.createElement((0, _base.base).fluentUI.Toggle, { - checked: advancedOptions.isFxaaEnabled, - label: (0, _language.strings).labelRendererOptionsFxaa, - onChange: (e, isFxaaEnabled)=>this.setAdvancedOptions({ - isFxaaEnabled - }) - })))))); + } + function _Renderer(_props) { + class __Renderer extends base$1.react.Component { + constructor(props) { + var _a2, _b2; + super(props); + this.state = this.getInitialState(props); + if (!((_b2 = (_a2 = this.state.viewer) === null || _a2 === void 0 ? void 0 : _a2.presenter) === null || _b2 === void 0 ? void 0 : _b2.morphchartsref)) { + const t = setInterval(() => { + var _a3, _b3; + const newState = this.getInitialState(props); + if (this.mounted && ((_b3 = (_a3 = newState.viewer) === null || _a3 === void 0 ? void 0 : _a3.presenter) === null || _b3 === void 0 ? void 0 : _b3.morphchartsref)) { + clearInterval(t); + this.setState(newState); } + }, 10); } - } - return new __Renderer(_props); -} -const Renderer = _Renderer; - -},{"../base":"3TPz5","../language":"67xOI","./iconButton":"6pZiK","./dialog":"OQi9w","./button":"f8wtc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jGrId":[function(require,module,exports,__globalThis) { -module.exports = React; - -},{}],"1a3X3":[function(require,module,exports,__globalThis) { -module.exports = ReactDOM; - -},{}],"dtgCh":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fluentUI", ()=>fluentUI); -var _button = require("@fluentui/react/lib/Button"); -var _choiceGroup = require("@fluentui/react/lib/ChoiceGroup"); -var _comboBox = require("@fluentui/react/lib/ComboBox"); -var _commandBar = require("@fluentui/react/lib/CommandBar"); -var _contextualMenu = require("@fluentui/react/lib/ContextualMenu"); -var _utilities = require("@fluentui/react/lib/Utilities"); -var _dialog = require("@fluentui/react/lib/Dialog"); -var _dropdown = require("@fluentui/react/lib/Dropdown"); -var _styling = require("@fluentui/react/lib/Styling"); -var _icon = require("@fluentui/react/lib/Icon"); -var _fluentuiIcons = require("@msrvida/fluentui-icons"); -var _label = require("@fluentui/react/lib/Label"); -var _modal = require("@fluentui/react/lib/Modal"); -var _slider = require("@fluentui/react/lib/Slider"); -var _spinner = require("@fluentui/react/lib/Spinner"); -var _textField = require("@fluentui/react/lib/TextField"); -var _toggle = require("@fluentui/react/lib/Toggle"); -(0, _fluentuiIcons.use)((0, _styling.registerIcons)); -(0, _fluentuiIcons.initializeIcons)(); -const fluentUI = { - ActionButton: (0, _button.ActionButton), - ChoiceGroup: (0, _choiceGroup.ChoiceGroup), - ComboBox: (0, _comboBox.ComboBox), - CommandBar: (0, _commandBar.CommandBar), - ContextualMenuItemType: (0, _contextualMenu.ContextualMenuItemType), - Customizer: (0, _utilities.Customizer), - DefaultButton: (0, _button.DefaultButton), - Dialog: (0, _dialog.Dialog), - DialogFooter: (0, _dialog.DialogFooter), - DialogType: (0, _dialog.DialogType), - Dropdown: (0, _dropdown.Dropdown), - DropdownMenuItemType: (0, _dropdown.DropdownMenuItemType), - Icon: (0, _icon.Icon), - IconButton: (0, _button.IconButton), - getFocusStyle: (0, _styling.getFocusStyle), - getTheme: (0, _styling.getTheme), - Label: (0, _label.Label), - loadTheme: (0, _styling.loadTheme), - Modal: (0, _modal.Modal), - PrimaryButton: (0, _button.PrimaryButton), - Slider: (0, _slider.Slider), - Spinner: (0, _spinner.Spinner), - SpinnerSize: (0, _spinner.SpinnerSize), - TextField: (0, _textField.TextField), - Toggle: (0, _toggle.Toggle), - registerIcons: (0, _styling.registerIcons), - unregisterIcons: (0, _styling.unregisterIcons) -}; - -},{"@fluentui/react/lib/Button":"1457j","@fluentui/react/lib/ChoiceGroup":"8qKBO","@fluentui/react/lib/ComboBox":"7XnNF","@fluentui/react/lib/CommandBar":"9ad8u","@fluentui/react/lib/ContextualMenu":"iuj1y","@fluentui/react/lib/Utilities":"1NZCy","@fluentui/react/lib/Dialog":"bXa7Q","@fluentui/react/lib/Dropdown":"8LUqt","@fluentui/react/lib/Styling":"hTimn","@fluentui/react/lib/Icon":"hiMUP","@msrvida/fluentui-icons":"1pQ7X","@fluentui/react/lib/Label":"8FZUu","@fluentui/react/lib/Modal":"7RBgT","@fluentui/react/lib/Slider":"e6BwJ","@fluentui/react/lib/Spinner":"4BGE1","@fluentui/react/lib/TextField":"4CWIf","@fluentui/react/lib/Toggle":"cpdGU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1457j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Button/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Button/index":"5ue98","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ue98":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ButtonGlobalClassNames", ()=>(0, _baseButtonClassNames.ButtonGlobalClassNames)); -var _baseButton = require("./BaseButton"); -parcelHelpers.exportAll(_baseButton, exports); -var _buttonTypes = require("./Button.types"); -parcelHelpers.exportAll(_buttonTypes, exports); -var _button = require("./Button"); -parcelHelpers.exportAll(_button, exports); -var _actionButton = require("./ActionButton/ActionButton"); -parcelHelpers.exportAll(_actionButton, exports); -var _commandBarButton = require("./CommandBarButton/CommandBarButton"); -parcelHelpers.exportAll(_commandBarButton, exports); -var _commandButton = require("./CommandButton/CommandButton"); -parcelHelpers.exportAll(_commandButton, exports); -var _compoundButton = require("./CompoundButton/CompoundButton"); -parcelHelpers.exportAll(_compoundButton, exports); -var _defaultButton = require("./DefaultButton/DefaultButton"); -parcelHelpers.exportAll(_defaultButton, exports); -var _messageBarButton = require("./MessageBarButton/MessageBarButton"); -parcelHelpers.exportAll(_messageBarButton, exports); -var _primaryButton = require("./PrimaryButton/PrimaryButton"); -parcelHelpers.exportAll(_primaryButton, exports); -var _iconButton = require("./IconButton/IconButton"); -parcelHelpers.exportAll(_iconButton, exports); -var _splitButtonClassNames = require("./SplitButton/SplitButton.classNames"); -parcelHelpers.exportAll(_splitButtonClassNames, exports); -var _baseButtonClassNames = require("./BaseButton.classNames"); - -},{"./BaseButton":false,"./Button.types":false,"./Button":false,"./ActionButton/ActionButton":"i8Fdq","./CommandBarButton/CommandBarButton":"fxfe4","./CommandButton/CommandButton":"5I0qn","./CompoundButton/CompoundButton":false,"./DefaultButton/DefaultButton":"3H4TE","./MessageBarButton/MessageBarButton":false,"./PrimaryButton/PrimaryButton":"g0nWk","./IconButton/IconButton":"bbHBP","./SplitButton/SplitButton.classNames":false,"./BaseButton.classNames":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"RtUZ1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BaseButton", ()=>BaseButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _icon = require("../../Icon"); -var _directionalHint = require("../../common/DirectionalHint"); -var _contextualMenu = require("../../ContextualMenu"); -var _baseButtonClassNames = require("./BaseButton.classNames"); -var _splitButtonClassNames = require("./SplitButton/SplitButton.classNames"); -var _keytipData = require("../../KeytipData"); -var TouchIdleDelay = 500; /* ms */ -var COMPONENT_NAME = 'BaseButton'; -/** - * {@docCategory Button} - */ var BaseButton = /** @class */ function(_super) { - (0, _tslib.__extends)(BaseButton, _super); - function BaseButton(props) { - var _this = _super.call(this, props) || this; - _this._buttonElement = _react.createRef(); - _this._splitButtonContainer = _react.createRef(); - _this._mergedRef = (0, _utilities.createMergedRef)(); - _this._renderedVisibleMenu = false; - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); - }); - _this._onRenderIcon = function(buttonProps, defaultRender) { - var iconProps = _this.props.iconProps; - if (iconProps && (iconProps.iconName !== undefined || iconProps.imageProps)) { - var className = iconProps.className, imageProps = iconProps.imageProps, rest = (0, _tslib.__rest)(iconProps, [ - "className", - "imageProps" - ]); - // If the styles prop is specified as part of iconProps, fall back to regular Icon as FontIcon and ImageIcon - // do not have this prop. - if (iconProps.styles) return _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - className: (0, _utilities.css)(_this._classNames.icon, className), - imageProps: imageProps - }, rest)); - if (iconProps.iconName) return _react.createElement((0, _icon.FontIcon), (0, _tslib.__assign)({ - className: (0, _utilities.css)(_this._classNames.icon, className) - }, rest)); - if (imageProps) return _react.createElement((0, _icon.ImageIcon), (0, _tslib.__assign)({ - className: (0, _utilities.css)(_this._classNames.icon, className), - imageProps: imageProps - }, rest)); - } - return null; - }; - _this._onRenderTextContents = function() { - var _a = _this.props, text = _a.text, children = _a.children, // eslint-disable-next-line deprecation/deprecation - _b = _a.secondaryText, // eslint-disable-next-line deprecation/deprecation - secondaryText = _b === void 0 ? _this.props.description : _b, _c = _a.onRenderText, onRenderText = _c === void 0 ? _this._onRenderText : _c, _d = _a.onRenderDescription, onRenderDescription = _d === void 0 ? _this._onRenderDescription : _d; - if (text || typeof children === 'string' || secondaryText) return _react.createElement("span", { - className: _this._classNames.textContainer - }, onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription)); - return [ - onRenderText(_this.props, _this._onRenderText), - onRenderDescription(_this.props, _this._onRenderDescription) - ]; - }; - _this._onRenderText = function() { - var text = _this.props.text; - var children = _this.props.children; - // For backwards compat, we should continue to take in the text content from children. - if (text === undefined && typeof children === 'string') text = children; - if (_this._hasText()) return _react.createElement("span", { - key: _this._labelId, - className: _this._classNames.label, - id: _this._labelId - }, text); - return null; - }; - _this._onRenderChildren = function() { - var children = _this.props.children; - // If children is just a string, either it or the text will be rendered via onRenderLabel - // If children is another component, it will be rendered after text - if (typeof children === 'string') return null; - return children; - }; - _this._onRenderDescription = function(props) { - // eslint-disable-next-line deprecation/deprecation - var _a = props.secondaryText, secondaryText = _a === void 0 ? _this.props.description : _a; - // ms-Button-description is only shown when the button type is compound. - // In other cases it will not be displayed. - return secondaryText ? _react.createElement("span", { - key: _this._descriptionId, - className: _this._classNames.description, - id: _this._descriptionId - }, secondaryText) : null; - }; - _this._onRenderAriaDescription = function() { - var ariaDescription = _this.props.ariaDescription; - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan, - // otherwise it will be assigned to descriptionSpan. - return ariaDescription ? _react.createElement("span", { - className: _this._classNames.screenReaderText, - id: _this._ariaDescriptionId - }, ariaDescription) : null; - }; - _this._onRenderMenuIcon = function(props) { - var menuIconProps = _this.props.menuIconProps; - return _react.createElement((0, _icon.FontIcon), (0, _tslib.__assign)({ - iconName: "ChevronDown" - }, menuIconProps, { - className: _this._classNames.menuIcon - })); - }; - _this._onRenderMenu = function(menuProps) { - var MenuType = _this.props.menuAs ? (0, _utilities.composeComponentAs)(_this.props.menuAs, (0, _contextualMenu.ContextualMenu)) : (0, _contextualMenu.ContextualMenu); - return _react.createElement(MenuType, (0, _tslib.__assign)({}, menuProps)); - }; - _this._onDismissMenu = function(ev) { - var menuProps = _this.props.menuProps; - if (menuProps && menuProps.onDismiss) menuProps.onDismiss(ev); - if (!ev || !ev.defaultPrevented) _this._dismissMenu(); - }; - _this._dismissMenu = function() { - _this._menuShouldFocusOnMount = undefined; - _this._menuShouldFocusOnContainer = undefined; - _this.setState({ - menuHidden: true - }); - }; - _this._openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { - if (shouldFocusOnMount === void 0) shouldFocusOnMount = true; - if (_this.props.menuProps) { - _this._menuShouldFocusOnContainer = shouldFocusOnContainer; - _this._menuShouldFocusOnMount = shouldFocusOnMount; - _this._renderedVisibleMenu = true; - _this.setState({ - menuHidden: false - }); - } - }; - _this._onToggleMenu = function(shouldFocusOnContainer) { - var shouldFocusOnMount = true; - if (_this.props.menuProps && _this.props.menuProps.shouldFocusOnMount === false) shouldFocusOnMount = false; - _this.state.menuHidden ? _this._openMenu(shouldFocusOnContainer, shouldFocusOnMount) : _this._dismissMenu(); - }; - _this._onSplitContainerFocusCapture = function(ev) { - var container = _this._splitButtonContainer.current; - // If the target is coming from the portal we do not need to set focus on the container. - if (!container || ev.target && (0, _utilities.portalContainsElement)(ev.target, container)) return; - // We should never be able to focus the individual buttons in a split button. Focus - // should always remain on the container. - container.focus(); - }; - _this._onSplitButtonPrimaryClick = function(ev) { - if (!_this.state.menuHidden) _this._dismissMenu(); - // toggle split buttons need two separate targets, even for touch - var singleTouchTarget = _this._processingTouch && !_this.props.toggle; - if (!singleTouchTarget && _this.props.onClick) _this.props.onClick(ev); - else if (singleTouchTarget) _this._onMenuClick(ev); - }; - _this._onKeyDown = function(ev) { - // explicity cancelling event so click won't fire after this - // eslint-disable-next-line deprecation/deprecation - if (_this.props.disabled && (ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).space)) { - ev.preventDefault(); - ev.stopPropagation(); - } else if (!_this.props.disabled) { - if (_this.props.menuProps) _this._onMenuKeyDown(ev); - else if (_this.props.onKeyDown !== undefined) _this.props.onKeyDown(ev); // not cancelling event because it's not disabled - } - }; - _this._onKeyUp = function(ev) { - if (!_this.props.disabled && _this.props.onKeyUp !== undefined) _this.props.onKeyUp(ev); // not cancelling event because it's not disabled - }; - _this._onKeyPress = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if (!_this.props.disabled && _this.props.onKeyPress !== undefined) // eslint-disable-next-line deprecation/deprecation - _this.props.onKeyPress(ev); // not cancelling event because it's not disabled - }; - _this._onMouseUp = function(ev) { - if (!_this.props.disabled && _this.props.onMouseUp !== undefined) _this.props.onMouseUp(ev); // not cancelling event because it's not disabled - }; - _this._onMouseDown = function(ev) { - if (!_this.props.disabled && _this.props.onMouseDown !== undefined) _this.props.onMouseDown(ev); // not cancelling event because it's not disabled - }; - _this._onClick = function(ev) { - if (!_this.props.disabled) { - if (_this.props.menuProps) _this._onMenuClick(ev); - else if (_this.props.onClick !== undefined) _this.props.onClick(ev); // not cancelling event because it's not disabled - } - }; - _this._onSplitButtonContainerKeyDown = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).space) { - if (_this._buttonElement.current) { - _this._buttonElement.current.click(); - ev.preventDefault(); - ev.stopPropagation(); - } - } else _this._onMenuKeyDown(ev); - }; - _this._onMenuKeyDown = function(ev) { - var _a; - if (_this.props.disabled) return; - if (_this.props.onKeyDown) _this.props.onKeyDown(ev); - // eslint-disable-next-line deprecation/deprecation - var isUp = ev.which === (0, _utilities.KeyCodes).up; - // eslint-disable-next-line deprecation/deprecation - var isDown = ev.which === (0, _utilities.KeyCodes).down; - if (!ev.defaultPrevented && _this._isValidMenuOpenKey(ev)) { - var onMenuClick = _this.props.onMenuClick; - if (onMenuClick) onMenuClick(ev, _this.props); - _this._onToggleMenu(false); - ev.preventDefault(); - ev.stopPropagation(); - } - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).space) // We manually set the focus visibility to true if opening via Enter or Space to account for the scenario where - // a user clicks on the button, closes the menu and then opens it via keyboard. In this scenario our default logic - // for setting focus visibility is not triggered since there is no keyboard navigation present beforehand. - (0, _utilities.setFocusVisibility)(true, ev.target, (_a = _this.context) === null || _a === void 0 ? void 0 : _a.registeredProviders); - if (!(ev.altKey || ev.metaKey) && (isUp || isDown)) // Suppose a menu, with shouldFocusOnMount: false, is open, and user wants to keyboard to the menu items - // We need to re-render the menu with shouldFocusOnMount as true. - { - if (!_this.state.menuHidden && _this.props.menuProps) { - var currentShouldFocusOnMount = _this._menuShouldFocusOnMount !== undefined ? _this._menuShouldFocusOnMount : _this.props.menuProps.shouldFocusOnMount; - if (!currentShouldFocusOnMount) { - ev.preventDefault(); - ev.stopPropagation(); - _this._menuShouldFocusOnMount = true; - _this.forceUpdate(); - } - } - } - }; - _this._onTouchStart = function() { - if (_this._isSplitButton && _this._splitButtonContainer.current && !('onpointerdown' in _this._splitButtonContainer.current)) _this._handleTouchAndPointerEvent(); - }; - _this._onMenuClick = function(ev) { - var _a = _this.props, onMenuClick = _a.onMenuClick, menuProps = _a.menuProps; - if (onMenuClick) onMenuClick(ev, _this.props); - // focus on the container by default when the menu is opened with a click event - // this differentiates from a keyboard interaction triggering the click event - var shouldFocusOnContainer = typeof (menuProps === null || menuProps === void 0 ? void 0 : menuProps.shouldFocusOnContainer) === 'boolean' ? menuProps.shouldFocusOnContainer : ev.nativeEvent.pointerType === 'mouse'; - if (!ev.defaultPrevented) { - _this._onToggleMenu(shouldFocusOnContainer); - ev.preventDefault(); - ev.stopPropagation(); - } + } + componentDidMount() { + this.mounted = true; + } + componentWillUnmount() { + this.mounted = false; + } + getInitialState(props) { + const { viewer } = props.explorer; + return { + showOptions: false, + viewer }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); - _this._events = new (0, _utilities.EventGroup)(_this); - (0, _utilities.warnConditionallyRequiredProps)(COMPONENT_NAME, props, [ - 'menuProps', - 'onClick' - ], 'split', _this.props.split); - (0, _utilities.warnDeprecations)(COMPONENT_NAME, props, { - rootProps: undefined, - description: 'secondaryText', - toggled: 'checked' + } + setOptions(newOptions) { + const { explorer: explorer2 } = this.props; + const renderer = Object.assign(Object.assign({}, explorer2.state.renderer), newOptions); + const { onSetupOptionsChanged } = explorer2.props; + if (onSetupOptionsChanged) { + const setup2 = explorer2.getSetup(); + setup2.renderer = renderer; + onSetupOptionsChanged(setup2); + } + explorer2.setState({ renderer }); + } + setBasicOptions(newOptions) { + this.setOptions({ + advanced: false, + basicOptions: Object.assign(Object.assign({}, this.props.basicOptions), newOptions) }); - _this._labelId = (0, _utilities.getId)(); - _this._descriptionId = (0, _utilities.getId)(); - _this._ariaDescriptionId = (0, _utilities.getId)(); - _this.state = { - menuHidden: true - }; - return _this; - } - Object.defineProperty(BaseButton.prototype, "_isSplitButton", { - get: function() { - return !!this.props.menuProps && !!this.props.onClick && this.props.split === true; - }, - enumerable: false, - configurable: true - }); - BaseButton.prototype.render = function() { - var _a; - var _b = this.props, ariaDescription = _b.ariaDescription, ariaLabel = _b.ariaLabel, ariaHidden = _b.ariaHidden, className = _b.className, disabled = _b.disabled, allowDisabledFocus = _b.allowDisabledFocus, primaryDisabled = _b.primaryDisabled, // eslint-disable-next-line deprecation/deprecation - _c = _b.secondaryText, // eslint-disable-next-line deprecation/deprecation - secondaryText = _c === void 0 ? this.props.description : _c, href = _b.href, iconProps = _b.iconProps, menuIconProps = _b.menuIconProps, styles = _b.styles, checked = _b.checked, variantClassName = _b.variantClassName, theme = _b.theme, toggle = _b.toggle, getClassNames = _b.getClassNames, role = _b.role; - var menuHidden = this.state.menuHidden; - // Button is disabled if the whole button (in case of splitButton is disabled) or if the primary action is disabled - var isPrimaryButtonDisabled = disabled || primaryDisabled; - this._classNames = getClassNames ? getClassNames(theme, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, checked, !menuHidden, !!this.props.menuProps, this.props.split, !!allowDisabledFocus) : (0, _baseButtonClassNames.getBaseButtonClassNames)(theme, styles, className, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, !!this.props.menuProps, checked, !menuHidden, this.props.split); - var _d = this, _ariaDescriptionId = _d._ariaDescriptionId, _labelId = _d._labelId, _descriptionId = _d._descriptionId; - // Anchor tag cannot be disabled hence in disabled state rendering - // anchor button as normal button - var renderAsAnchor = !isPrimaryButtonDisabled && !!href; - var tag = renderAsAnchor ? 'a' : 'button'; - var nativeProps = (0, _utilities.getNativeProps)(// eslint-disable-next-line deprecation/deprecation - (0, _utilities.assign)(renderAsAnchor ? {} : { - type: 'button' - }, this.props.rootProps, this.props), renderAsAnchor ? (0, _utilities.anchorProperties) : (0, _utilities.buttonProperties), [ - 'disabled' - ]); - // Check for ariaLabel passed in via Button props, and fall back to aria-label passed in via native props - var resolvedAriaLabel = ariaLabel || nativeProps['aria-label']; - // Check for ariaDescription, secondaryText or aria-describedby in the native props to determine source of - // aria-describedby. Otherwise default to undefined so property does not appear in output. - var ariaDescribedBy = undefined; - if (ariaDescription) ariaDescribedBy = _ariaDescriptionId; - else if (secondaryText && this.props.onRenderDescription !== (0, _utilities.nullRender)) // for buttons like CompoundButton with a valid onRenderDescription, we need to set an ariaDescribedBy - // for buttons that do not render anything (via nullRender), we should not set an ariaDescribedBy - ariaDescribedBy = _descriptionId; - else if (nativeProps['aria-describedby']) ariaDescribedBy = nativeProps['aria-describedby']; - // If an explicit aria-labelledby is given, use that and we're done. - // If any kind of description is given (which will end up as an aria-describedby attribute) - // and no ariaLabel is specified, set the labelledby element. - // Otherwise, the button is labeled implicitly by the descendent text on the button (if it exists). - var ariaLabelledBy = undefined; - if (nativeProps['aria-labelledby']) ariaLabelledBy = nativeProps['aria-labelledby']; - else if (ariaDescribedBy && !resolvedAriaLabel) ariaLabelledBy = this._hasText() ? _labelId : undefined; - var dataIsFocusable = this.props['data-is-focusable'] === false || disabled && !allowDisabledFocus || this._isSplitButton ? false : true; - var isCheckboxTypeRole = role === 'menuitemcheckbox' || role === 'checkbox'; - // if isCheckboxTypeRole, always return a checked value. - // Otherwise only return checked value if toggle is set to true. - // This is because role="checkbox" always needs to have an aria-checked value - // but our checked prop only sets aria-pressed if we mark the button as a toggle="true" - var checkedOrPressedValue = isCheckboxTypeRole ? !!checked : toggle === true ? !!checked : undefined; - var buttonProps = (0, _utilities.assign)(nativeProps, (_a = { - className: this._classNames.root, - // eslint-disable-next-line deprecation/deprecation - ref: this._mergedRef(this.props.elementRef, this._buttonElement), - disabled: isPrimaryButtonDisabled && !allowDisabledFocus, - onKeyDown: this._onKeyDown, - onKeyPress: this._onKeyPress, - onKeyUp: this._onKeyUp, - onMouseDown: this._onMouseDown, - onMouseUp: this._onMouseUp, - onClick: this._onClick, - 'aria-label': resolvedAriaLabel, - 'aria-labelledby': ariaLabelledBy, - 'aria-describedby': ariaDescribedBy, - 'aria-disabled': isPrimaryButtonDisabled, - 'data-is-focusable': dataIsFocusable - }, // aria-pressed attribute should only be present for toggle buttons - // aria-checked attribute should only be present for toggle buttons with checkbox type role - _a[isCheckboxTypeRole ? 'aria-checked' : 'aria-pressed'] = checkedOrPressedValue, _a)); - if (ariaHidden) buttonProps['aria-hidden'] = true; - if (this._isSplitButton) return this._onRenderSplitButtonContent(tag, buttonProps); - else if (this.props.menuProps) { - var _e = this.props.menuProps.id, id = _e === void 0 ? "".concat(this._labelId, "-menu") : _e; - (0, _utilities.assign)(buttonProps, { - 'aria-expanded': !menuHidden, - 'aria-controls': !menuHidden ? id : null, - 'aria-haspopup': true - }); + } + setAdvancedOptions(newOptions) { + this.setOptions({ + advanced: true, + advancedOptions: Object.assign(Object.assign({}, this.props.advancedOptions), newOptions) + }); + } + render() { + var _a2, _b2; + const { props, state } = this; + const iconButtonStyles = { + menuIcon: { + display: "none" + } + }; + if (!((_b2 = (_a2 = state.viewer) === null || _a2 === void 0 ? void 0 : _a2.presenter) === null || _b2 === void 0 ? void 0 : _b2.morphchartsref)) { + return base$1.react.createElement(IconButton$1, { styles: iconButtonStyles, className: "sanddance-advanced-renderer", disabled: true, iconName: "HourGlass", onClick: void 0, themePalette: props.themePalette, title: strings$1.labelRenderer }); + } else { + const { morphchartsref } = state.viewer.presenter; + const choiceButtonStyle = { + border: "none" + }; + const { advanced, advancedOptions, basicOptions } = props; + return base$1.react.createElement( + "div", + null, + base$1.react.createElement(IconButton$1, { iconName: "PicturePosition", title: strings$1.buttonCameraHome, onClick: props.onHomeClick, styles: iconButtonStyles, themePalette: props.themePalette }), + base$1.react.createElement(IconButton$1, { styles: iconButtonStyles, className: "sanddance-advanced-renderer", iconName: advanced ? "DiamondSolid" : "Diamond", disabled: !morphchartsref.supportedRenders.advanced, onClick: void 0, themePalette: props.themePalette, title: morphchartsref.supportedRenders.advanced ? strings$1.labelRenderer : strings$1.labelRendererAdvancedDisabled, menuProps: { + items: [ + { + key: "basic", + text: strings$1.labelRendererBasic, + iconProps: { + iconName: advanced ? null : "RadioBullet" + }, + onClick: () => advanced && this.setOptions({ advanced: false }) + //disabled: !advanced, + }, + { + key: "advanced", + text: strings$1.labelRendererAdvanced, + iconProps: { + iconName: advanced ? "RadioBullet" : null + }, + onClick: () => !advanced && this.setOptions({ advanced: true }) + //disabled: advanced, + }, + { + key: "options", + text: strings$1.labelRendererOptions, + onClick: (e) => this.setState({ showOptions: true }) + } + ] + } }), + base$1.react.createElement( + Dialog$1, + { hidden: !state.showOptions, dialogContentProps: { + className: "sanddance-renderer-dialog", + title: strings$1.labelRendererOptionsDialogTitle + }, onDismiss: () => this.setState({ showOptions: false }) }, + base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { iconName: advanced ? "RadioBtnOff" : "RadioBtnOn", onClick: () => this.setOptions({ advanced: false }), text: strings$1.labelRendererBasic, themePalette: props.themePalette, rootStyle: choiceButtonStyle }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: basicOptions.antialias, label: strings$1.labelRendererOptionsAntialias, onChange: (e, antialias) => this.setBasicOptions({ antialias }) }) + ) + ) + ), + base$1.react.createElement( + "div", + null, + base$1.react.createElement(Button, { iconName: advanced ? "RadioBtnOn" : "RadioBtnOff", onClick: () => this.setOptions({ advanced: true }), text: strings$1.labelRendererAdvanced, themePalette: props.themePalette, rootStyle: choiceButtonStyle }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isShadowEnabled, label: strings$1.labelRendererOptionsShadow, onChange: (e, isShadowEnabled) => this.setAdvancedOptions({ isShadowEnabled }) }) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isSsaoEnabled, label: strings$1.labelRendererOptionsSsao, onChange: (e, isSsaoEnabled) => this.setAdvancedOptions({ isSsaoEnabled }) }) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isBloomEnabled, label: strings$1.labelRendererOptionsBloom, onChange: (e, isBloomEnabled) => this.setAdvancedOptions({ isBloomEnabled }) }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Slider, { value: advancedOptions.bloomIntensity, min: 0.1, max: 5, step: 0.01, label: strings$1.labelRendererOptionsBloomIntensity, onChange: (bloomIntensity) => this.setAdvancedOptions({ bloomIntensity, isBloomEnabled: true }) }) + ) + ) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isDofEnabled, label: strings$1.labelRendererOptionsDof, onChange: (e, isDofEnabled) => this.setAdvancedOptions({ isDofEnabled }) }), + base$1.react.createElement( + "ul", + null, + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Slider, { value: advancedOptions.dofFocusRange, min: 0, max: 2, step: 0.01, label: strings$1.labelRendererOptionsDofRange, onChange: (dofFocusRange) => this.setAdvancedOptions({ dofFocusRange, isDofEnabled: true }) }) + ) + ) + ), + base$1.react.createElement( + "li", + null, + base$1.react.createElement(base$1.fluentUI.Toggle, { checked: advancedOptions.isFxaaEnabled, label: strings$1.labelRendererOptionsFxaa, onChange: (e, isFxaaEnabled) => this.setAdvancedOptions({ isFxaaEnabled }) }) + ) + ) + ) + ) + ); } - return this._onRenderContent(tag, buttonProps); - }; - BaseButton.prototype.componentDidMount = function() { - // For split buttons, touching anywhere in the button should drop the dropdown, which should contain the - // primary action. This gives more hit target space for touch environments. We're setting the onpointerdown here, - // because React does not support Pointer events yet. - if (this._isSplitButton && this._splitButtonContainer.current) { - if ('onpointerdown' in this._splitButtonContainer.current) this._events.on(this._splitButtonContainer.current, 'pointerdown', this._onPointerDown, true); - if ('onpointerup' in this._splitButtonContainer.current && this.props.onPointerUp) this._events.on(this._splitButtonContainer.current, 'pointerup', this.props.onPointerUp, true); + } + } + return new __Renderer(_props); + } + const Renderer$1 = _Renderer; + function _Explorer(_props) { + class __Explorer extends base$1.react.Component { + constructor(props) { + super(props); + this.dialogFocusHandler = {}; + this.state = initialExplorerState(props); + this.imageHolder = { img: null, backgroundImageColumnBounds: [], showBackgroundImage: false }; + this.snapshotThumbWidth = snapshotThumbWidth; + this.discardColorContextUpdates = true; + this.updateViewerOptions(Object.assign(Object.assign({}, clone(Viewer$1.defaultViewerOptions)), props.viewerOptions)); + } + finalize() { + if (this.viewer) + this.viewer.finalize(); + } + updateViewerOptions(viewerOptions) { + this.viewerOptions = Object.assign(Object.assign({}, deepMerge(defaultViewerOptions, { + tooltipOptions: { + prepareDataItem: ((item) => { + const ret = {}; + for (const columnName in item) { + if (this.state.tooltipExclusions.indexOf(columnName) < 0) { + ret[columnName] = item[columnName]; + } + } + return ret; + }) + } + }, this.viewerOptions, viewerOptions)), { onColorContextChange: () => this.manageColorToolbar(), onDataFilter: (filter2, filteredData) => { + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + selectedItemIndex[DataScopeId.FilteredData] = 0; + this.changeInsight({ filter: filter2 }, { label: this.historicFilterChange, omit: !this.historicFilterChange }); + this.historicFilterChange = null; + this.setState({ filteredData, selectedItemIndex }); + if (this.state.sideTabId === SideTabId.Data && this.state.dataScopeId === DataScopeId.FilteredData) { + requestAnimationFrame(() => filteredData && this.silentActivation(filteredData[0])); + } + viewerOptions && viewerOptions.onDataFilter && viewerOptions.onDataFilter(filter2, filteredData); + }, onSelectionChanged: (newSearch, index2, selectedData) => { + if (this.ignoreSelectionChange) + return; + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + selectedItemIndex[DataScopeId.SelectedData] = index2 || 0; + let { search } = this.state; + const { sideTabId } = this.state; + if (newSearch) { + search = createInputSearch(newSearch); + } + this.setState({ search, selectedItemIndex, sideTabId }); + viewerOptions && viewerOptions.onSelectionChanged && viewerOptions.onSelectionChanged(newSearch, index2, selectedData); + }, onAxisClick: (e, search) => { + this.toggleableSearch(e, search); + viewerOptions && viewerOptions.onAxisClick && viewerOptions.onAxisClick(e, search); + }, onLegendHeaderClick: (e) => { + const pos = getPosition(e); + const specRole = this.state.specCapabilities && this.state.specCapabilities.roles.filter((r) => r.role === "color")[0]; + const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { collapseLabel: true, container: this.div, selectedColumnName: this.state.columns["color"], onDismiss: () => { + this.setState({ positionedColumnMapProps: null }); + }, specRole, left: pos.left - this.div.clientLeft, top: pos.top - this.div.clientTop }); + this.setState({ positionedColumnMapProps }); + }, onLegendRowClick: (e, legendRow) => { + this.toggleableSearch(e, legendRow.search); + viewerOptions && viewerOptions.onLegendRowClick && viewerOptions.onLegendRowClick(e, legendRow); + }, onError: (errors) => { + this.setState({ errors }); + viewerOptions && viewerOptions.onError && viewerOptions.onError(errors); + }, onBeforeCreateLayers: (stage, specCapabilities) => { + attachSpecRoleToAxisTitle(stage, specCapabilities); + }, getTextColor: (o) => { + if (o.specRole) { + return colorFromString(this.viewerOptions.colors.clickableText); + } else if (o.metaData && o.metaData.search) { + return colorFromString(this.viewerOptions.colors.searchText); + } else { + return o.color; + } + }, getTextHighlightColor: (o) => { + if (o.specRole) { + return colorFromString(this.viewerOptions.colors.clickableTextHighlight); + } else if (o.metaData && o.metaData.search) { + return colorFromString(this.viewerOptions.colors.searchTextHighlight); + } else { + return [0, 0, 0, 0]; + } + }, onTextClick: (e, text2) => { + if (e && text2) { + const pos = getPosition(e); + const rect2 = this.viewer.element.getBoundingClientRect(); + pos.left += rect2.left; + pos.top += rect2.top; + const { specRole } = text2; + if (pos && specRole) { + const positionedColumnMapProps = Object.assign(Object.assign({}, this.getColumnMapBaseProps()), { collapseLabel: true, container: this.div, selectedColumnName: this.state.columns[specRole.role], onDismiss: () => { + this.setState({ positionedColumnMapProps: null }); + }, specRole, left: pos.left, top: pos.top }); + this.setState({ positionedColumnMapProps }); + } else { + this.setState({ positionedColumnMapProps: null }); + } + } + }, onNewViewStateTarget: () => this.newViewStateTarget }); + if (this.viewer && this.viewer.presenter) { + const newPresenterStyle = getPresenterStyle(this.viewerOptions); + const mergePrenterStyle = Object.assign(Object.assign({}, this.viewer.presenter.style), newPresenterStyle); + this.viewer.presenter.style = mergePrenterStyle; + this.viewer.options = deepMerge(this.viewer.options, this.props.viewerOptions, this.viewerOptions); } - }; - BaseButton.prototype.componentDidUpdate = function(prevProps, prevState) { - // If Button's menu was closed, run onAfterMenuDismiss. - if (this.props.onAfterMenuDismiss && !prevState.menuHidden && this.state.menuHidden) this.props.onAfterMenuDismiss(); - }; - BaseButton.prototype.componentWillUnmount = function() { - this._async.dispose(); - this._events.dispose(); - }; - BaseButton.prototype.focus = function() { - var _a, _b; - if (this._isSplitButton && this._splitButtonContainer.current) { - (0, _utilities.setFocusVisibility)(true, undefined, (_a = this.context) === null || _a === void 0 ? void 0 : _a.registeredProviders); - this._splitButtonContainer.current.focus(); - } else if (this._buttonElement.current) { - (0, _utilities.setFocusVisibility)(true, undefined, (_b = this.context) === null || _b === void 0 ? void 0 : _b.registeredProviders); - this._buttonElement.current.focus(); + } + signal(signalName, signalValue, newViewStateTarget) { + switch (signalName) { + case SignalNames.ColorBinCount: + case SignalNames.ColorReverse: + case SignalNames.MarkOpacity: + this.discardColorContextUpdates = false; + break; } - }; - BaseButton.prototype.dismissMenu = function() { - this._dismissMenu(); - }; - BaseButton.prototype.openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { - this._openMenu(shouldFocusOnContainer, shouldFocusOnMount); - }; - BaseButton.prototype._onRenderContent = function(tag, buttonProps) { - var _this = this; - var props = this.props; - var Tag = tag; - var menuIconProps = props.menuIconProps, menuProps = props.menuProps, _a = props.onRenderIcon, onRenderIcon = _a === void 0 ? this._onRenderIcon : _a, _b = props.onRenderAriaDescription, onRenderAriaDescription = _b === void 0 ? this._onRenderAriaDescription : _b, _c = props.onRenderChildren, onRenderChildren = _c === void 0 ? this._onRenderChildren : _c, // eslint-disable-next-line deprecation/deprecation - _d = props.onRenderMenu, // eslint-disable-next-line deprecation/deprecation - onRenderMenu = _d === void 0 ? this._onRenderMenu : _d, _e = props.onRenderMenuIcon, onRenderMenuIcon = _e === void 0 ? this._onRenderMenuIcon : _e, disabled = props.disabled; - var keytipProps = props.keytipProps; - if (keytipProps && menuProps) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - var Button = function(keytipAttributes) { - return _react.createElement(Tag, (0, _tslib.__assign)({}, buttonProps, keytipAttributes), _react.createElement("span", { - className: _this._classNames.flexContainer, - "data-automationid": "splitbuttonprimary" - }, onRenderIcon(props, _this._onRenderIcon), _this._onRenderTextContents(), onRenderAriaDescription(props, _this._onRenderAriaDescription), onRenderChildren(props, _this._onRenderChildren), !_this._isSplitButton && (menuProps || menuIconProps || _this.props.onRenderMenuIcon) && onRenderMenuIcon(_this.props, _this._onRenderMenuIcon), menuProps && !menuProps.doNotLayer && _this._shouldRenderMenu() && onRenderMenu(_this._getMenuProps(menuProps), _this._onRenderMenu))); - }; - var Content = keytipProps ? // If we're making a split button, we won't put the keytip here - _react.createElement((0, _keytipData.KeytipData), { - keytipProps: !this._isSplitButton ? keytipProps : undefined, - ariaDescribedBy: buttonProps['aria-describedby'], - disabled: disabled - }, function(keytipAttributes) { - return Button(keytipAttributes); - }) : Button(); - if (menuProps && menuProps.doNotLayer) return _react.createElement(_react.Fragment, null, Content, this._shouldRenderMenu() && onRenderMenu(this._getMenuProps(menuProps), this._onRenderMenu)); - return _react.createElement(_react.Fragment, null, Content, _react.createElement((0, _utilities.FocusRects), null)); - }; - /** - * Method to help determine if the menu's component tree should - * be rendered. It takes into account whether the menu is expanded, - * whether it is a persisted menu and whether it has been shown to the user. - */ BaseButton.prototype._shouldRenderMenu = function() { - var menuHidden = this.state.menuHidden; - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, persistMenu = _a.persistMenu, renderPersistedMenuHiddenOnMount = _a.renderPersistedMenuHiddenOnMount; - if (!menuHidden) // Always should render a menu when it is expanded - return true; - else if (persistMenu && (this._renderedVisibleMenu || renderPersistedMenuHiddenOnMount)) // _renderedVisibleMenu ensures that the first rendering of - // the menu happens on-screen, as edge's scrollbar calculations are off if done while hidden. - return true; - return false; - }; - BaseButton.prototype._hasText = function() { - // _onRenderTextContents and _onRenderText do not perform the same checks. Below is parity with what _onRenderText - // used to have before the refactor that introduced this function. _onRenderTextContents does not require props. - // text to be undefined in order for props.children to be used as a fallback. - // Purely a code maintainability/reuse issue, but logged as Issue #4979. - return this.props.text !== null && (this.props.text !== undefined || typeof this.props.children === 'string'); - }; - BaseButton.prototype._getMenuProps = function(menuProps) { - var persistMenu = this.props.persistMenu; - var menuHidden = this.state.menuHidden; - // the accessible menu label (accessible name) has a relationship to the button. - // If the menu props do not specify an explicit value for aria-label or aria-labelledBy, - // AND the button has text, we'll set the menu aria-labelledBy to the text element id. - if (!menuProps.ariaLabel && !menuProps.labelElementId && this._hasText()) menuProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, menuProps), { - labelElementId: this._labelId - }); - return (0, _tslib.__assign)((0, _tslib.__assign)({ - id: this._labelId + '-menu', - directionalHint: (0, _directionalHint.DirectionalHint).bottomLeftEdge - }, menuProps), { - shouldFocusOnContainer: this._menuShouldFocusOnContainer, - shouldFocusOnMount: this._menuShouldFocusOnMount, - hidden: persistMenu ? menuHidden : undefined, - className: (0, _utilities.css)('ms-BaseButton-menuhost', menuProps.className), - target: this._isSplitButton ? this._splitButtonContainer.current : this._buttonElement.current, - onDismiss: this._onDismissMenu + this.newViewStateTarget = newViewStateTarget; + this.viewer.vegaViewGl.signal(signalName, signalValue); + this.viewer.vegaViewGl.runAsync().then(() => { + if (this.state.signalValues) { + this.state.signalValues[signalName] = signalValue; + } + this.discardColorContextUpdates = true; + this.newViewStateTarget = void 0; + this.props.onSignalChanged && this.props.onSignalChanged(signalName, signalValue); }); - }; - BaseButton.prototype._onRenderSplitButtonContent = function(tag, buttonProps) { - var _this = this; - var _a = this.props, _b = _a.styles, styles = _b === void 0 ? {} : _b, disabled = _a.disabled, allowDisabledFocus = _a.allowDisabledFocus, checked = _a.checked, getSplitButtonClassNames = _a.getSplitButtonClassNames, primaryDisabled = _a.primaryDisabled, menuProps = _a.menuProps, toggle = _a.toggle, role = _a.role, primaryActionButtonProps = _a.primaryActionButtonProps; - var keytipProps = this.props.keytipProps; - var menuHidden = this.state.menuHidden; - var classNames = getSplitButtonClassNames ? getSplitButtonClassNames(!!disabled, !menuHidden, !!checked, !!allowDisabledFocus) : styles && (0, _splitButtonClassNames.getSplitButtonClassNames)(styles, !!disabled, !menuHidden, !!checked, !!primaryDisabled); - (0, _utilities.assign)(buttonProps, { - onClick: undefined, - onPointerDown: undefined, - onPointerUp: undefined, - tabIndex: -1, - 'data-is-focusable': false + } + manageColorToolbar() { + const canRemap = this.viewer.colorContexts && this.viewer.colorContexts.length > 1; + applyColorButtons(this.viewer.presenter, !!this.state.columns.color, { + themePalette: themePalettes[this.props.theme || ""], + canRemap, + isRemap: canRemap && this.viewer.currentColorContext > 0, + colorMapHandler: (remap) => { + this.viewer.currentColorContext = ~~remap; + this.viewer.renderSameLayout(); + this.manageColorToolbar(); + } }); - if (keytipProps && menuProps) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - var containerProps = (0, _utilities.getNativeProps)(buttonProps, [], [ - 'disabled' - ]); - // Add additional props to apply on primary action button - if (primaryActionButtonProps) (0, _utilities.assign)(buttonProps, primaryActionButtonProps); - var SplitButton = function(keytipAttributes) { - return _react.createElement("div", (0, _tslib.__assign)({}, containerProps, { - "data-ktp-target": keytipAttributes ? keytipAttributes['data-ktp-target'] : undefined, - role: role ? role : 'button', - "aria-disabled": disabled, - "aria-haspopup": true, - "aria-expanded": !menuHidden, - "aria-pressed": toggle ? !!checked : undefined, - "aria-describedby": (0, _utilities.mergeAriaAttributeValues)(buttonProps['aria-describedby'], keytipAttributes ? keytipAttributes['aria-describedby'] : undefined), - className: classNames && classNames.splitButtonContainer, - onKeyDown: _this._onSplitButtonContainerKeyDown, - onTouchStart: _this._onTouchStart, - ref: _this._splitButtonContainer, - "data-is-focusable": true, - onClick: !disabled && !primaryDisabled ? _this._onSplitButtonPrimaryClick : undefined, - tabIndex: !disabled && !primaryDisabled || allowDisabledFocus ? 0 : undefined, - "aria-roledescription": buttonProps['aria-roledescription'], - onFocusCapture: _this._onSplitContainerFocusCapture - }), _react.createElement("span", { - style: { - display: 'flex', - width: '100%' - } - }, _this._onRenderContent(tag, buttonProps), _this._onRenderSplitButtonMenuButton(classNames, keytipAttributes), _this._onRenderSplitButtonDivider(classNames))); + } + getInsight() { + return this.viewer.getInsight(); + } + getSetup() { + return { + camera: this.state.holdCamera ? "hold" : this.state.camera, + renderer: this.state.renderer, + transition: getTransition(this.state), + transitionDurations: this.state.transitionDurations }; - return keytipProps ? _react.createElement((0, _keytipData.KeytipData), { - keytipProps: keytipProps, - disabled: disabled - }, function(keytipAttributes) { - return SplitButton(keytipAttributes); - }) : SplitButton(); - }; - BaseButton.prototype._onRenderSplitButtonDivider = function(classNames) { - if (classNames && classNames.divider) { - var onClick = function(ev) { - ev.stopPropagation(); - }; - return _react.createElement("span", { - className: classNames.divider, - "aria-hidden": true, - onClick: onClick - }); + } + setSetup(setup2, newState) { + newState.camera = void 0; + if (setup2) { + this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(setup2); + const { camera, renderer, transition, transitionDurations } = setup2; + newState.renderer = renderer; + newState.transitionType = transition.type; + if (camera === "hold") { + newState.holdCamera = true; + } else { + newState.holdCamera = false; + newState.camera = camera; + } + if (transition.type === "column") { + newState.transitionColumn = transition.column; + } else if (transition.type === "position") { + newState.transitionDimension = transition.dimension; + } + if (transitionDurations) { + newState.transitionDurations = transitionDurations; + syncTansitionDurations(this.viewer, transitionDurations); + } } - return null; - }; - BaseButton.prototype._onRenderSplitButtonMenuButton = function(classNames, keytipAttributes) { - var _a = this.props, allowDisabledFocus = _a.allowDisabledFocus, checked = _a.checked, disabled = _a.disabled, splitButtonMenuProps = _a.splitButtonMenuProps, splitButtonAriaLabel = _a.splitButtonAriaLabel, primaryDisabled = _a.primaryDisabled; - var menuHidden = this.state.menuHidden; - var menuIconProps = this.props.menuIconProps; - if (menuIconProps === undefined) menuIconProps = { - iconName: 'ChevronDown' - }; - var splitButtonProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonMenuProps), { - styles: classNames, - checked: checked, - disabled: disabled, - allowDisabledFocus: allowDisabledFocus, - onClick: this._onMenuClick, - menuProps: undefined, - iconProps: (0, _tslib.__assign)((0, _tslib.__assign)({}, menuIconProps), { - className: this._classNames.menuIcon - }), - ariaLabel: splitButtonAriaLabel, - 'aria-haspopup': true, - 'aria-expanded': !menuHidden, - 'data-is-focusable': false - }); - // Add data-ktp-execute-target to the split button if the keytip is defined - return _react.createElement(BaseButton, (0, _tslib.__assign)({}, splitButtonProps, { - "data-ktp-execute-target": keytipAttributes ? keytipAttributes['data-ktp-execute-target'] : keytipAttributes, - onMouseDown: this._onMouseDown, - tabIndex: primaryDisabled && !allowDisabledFocus ? 0 : -1 - })); - }; - BaseButton.prototype._onPointerDown = function(ev) { - var onPointerDown = this.props.onPointerDown; - if (onPointerDown) onPointerDown(ev); - if (ev.pointerType === 'touch') { - this._handleTouchAndPointerEvent(); - ev.preventDefault(); - ev.stopImmediatePropagation(); + } + setInsight(historyAction, newState = {}, partialInsight = this.viewer.getInsight(), rebaseFilter, setup2) { + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + resetSelectedItemIndex(selectedItemIndex); + const historicInsight = Object.assign({ chart: null, scheme: null, columns: null, filter: null, rebaseFilter }, partialInsight); + const state = Object.assign({ filteredData: null, selectedItemIndex, search: createInputSearch(historicInsight.filter) }, newState); + const changeInsight = () => { + this.getColorContext = null; + this.setSetup(setup2, historicInsight); + this.changeInsight(historicInsight, historyAction, state, setup2); + }; + const currentFilter = this.viewer.getInsight().filter; + if (rebaseFilter && currentFilter && historicInsight.filter) { + if (startsWith(historicInsight.filter, currentFilter)) { + changeInsight(); + } else { + const { transitionDurations } = this.state; + const renderTime = transitionDurations.position + transitionDurations.stagger; + const allowAsyncRenderTime = renderTime + this.viewerOptions.filterRenderingTimerPadding; + this.viewer.reset().then(() => new Promise((resolve2, reject) => { + setTimeout(resolve2, allowAsyncRenderTime); + })).then(changeInsight); + } + } else { + changeInsight(); } - }; - BaseButton.prototype._handleTouchAndPointerEvent = function() { - var _this = this; - // If we already have an existing timeout from a previous touch and pointer event - // cancel that timeout so we can set a new one. - if (this._lastTouchTimeoutId !== undefined) { - this._async.clearTimeout(this._lastTouchTimeoutId); - this._lastTouchTimeoutId = undefined; + } + handleReviveSnapshot(snapshot, selectedSnapshotIndex) { + let handled = false; + if (this.props.onSnapshotClick) { + this.setState({ selectedSnapshotIndex }); + handled = this.props.onSnapshotClick(snapshot, selectedSnapshotIndex); } - this._processingTouch = true; - this._lastTouchTimeoutId = this._async.setTimeout(function() { - _this._processingTouch = false; - _this._lastTouchTimeoutId = undefined; - // Touch and pointer events don't focus the button naturally, - // so adding an imperative focus call to guarantee this behavior. - // Only focus the button if a splitbutton menu is not open - if (_this.state.menuHidden) _this.focus(); - }, TouchIdleDelay); - }; - /** - * Returns if the user hits a valid keyboard key to open the menu - * @param ev - the keyboard event - * @returns True if user clicks on custom trigger key if enabled or alt + down arrow if not. False otherwise. - */ BaseButton.prototype._isValidMenuOpenKey = function(ev) { - if (this.props.menuTriggerKeyCode) // eslint-disable-next-line deprecation/deprecation - return ev.which === this.props.menuTriggerKeyCode; - else if (this.props.menuProps) // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).down && (ev.altKey || ev.metaKey); - // Note: When enter is pressed, we will let the event continue to propagate - // to trigger the onClick event on the button - return false; - }; - BaseButton.defaultProps = { - baseClassName: 'ms-Button', - styles: {}, - split: false - }; - // needed to access registeredProviders when manually setting focus visibility - BaseButton.contextType = (0, _utilities.FocusRectsContext); - return BaseButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Icon":"hiMUP","../../common/DirectionalHint":"avdAc","../../ContextualMenu":"iuj1y","./BaseButton.classNames":"2b9yc","./SplitButton/SplitButton.classNames":"8sJhS","../../KeytipData":"9cfzj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9gizs":[function(require,module,exports,__globalThis) { -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "__extends", ()=>__extends); -parcelHelpers.export(exports, "__assign", ()=>__assign); -parcelHelpers.export(exports, "__rest", ()=>__rest); -parcelHelpers.export(exports, "__decorate", ()=>__decorate); -parcelHelpers.export(exports, "__param", ()=>__param); -parcelHelpers.export(exports, "__esDecorate", ()=>__esDecorate); -parcelHelpers.export(exports, "__runInitializers", ()=>__runInitializers); -parcelHelpers.export(exports, "__propKey", ()=>__propKey); -parcelHelpers.export(exports, "__setFunctionName", ()=>__setFunctionName); -parcelHelpers.export(exports, "__metadata", ()=>__metadata); -parcelHelpers.export(exports, "__awaiter", ()=>__awaiter); -parcelHelpers.export(exports, "__generator", ()=>__generator); -parcelHelpers.export(exports, "__createBinding", ()=>__createBinding); -parcelHelpers.export(exports, "__exportStar", ()=>__exportStar); -parcelHelpers.export(exports, "__values", ()=>__values); -parcelHelpers.export(exports, "__read", ()=>__read); -/** @deprecated */ parcelHelpers.export(exports, "__spread", ()=>__spread); -/** @deprecated */ parcelHelpers.export(exports, "__spreadArrays", ()=>__spreadArrays); -parcelHelpers.export(exports, "__spreadArray", ()=>__spreadArray); -parcelHelpers.export(exports, "__await", ()=>__await); -parcelHelpers.export(exports, "__asyncGenerator", ()=>__asyncGenerator); -parcelHelpers.export(exports, "__asyncDelegator", ()=>__asyncDelegator); -parcelHelpers.export(exports, "__asyncValues", ()=>__asyncValues); -parcelHelpers.export(exports, "__makeTemplateObject", ()=>__makeTemplateObject); -parcelHelpers.export(exports, "__importStar", ()=>__importStar); -parcelHelpers.export(exports, "__importDefault", ()=>__importDefault); -parcelHelpers.export(exports, "__classPrivateFieldGet", ()=>__classPrivateFieldGet); -parcelHelpers.export(exports, "__classPrivateFieldSet", ()=>__classPrivateFieldSet); -parcelHelpers.export(exports, "__classPrivateFieldIn", ()=>__classPrivateFieldIn); -parcelHelpers.export(exports, "__addDisposableResource", ()=>__addDisposableResource); -parcelHelpers.export(exports, "__disposeResources", ()=>__disposeResources); -parcelHelpers.export(exports, "__rewriteRelativeImportExtension", ()=>__rewriteRelativeImportExtension); -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || ({ - __proto__: [] - }) instanceof Array && function(d, b) { - d.__proto__ = b; - } || function(d, b) { - for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; - }; - return extendStatics(d, b); -}; -function __extends(d, b) { - if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for(var s, i = 1, n = arguments.length; i < n; i++){ - s = arguments[i]; - for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + if (!handled) { + this.reviveSnapshot(selectedSnapshotIndex); } - return t; - }; - return __assign.apply(this, arguments); -}; -function __rest(s, e) { - var t = {}; - for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") { - for(var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; -} -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} -function __param(paramIndex, decorator) { - return function(target, key) { - decorator(target, key, paramIndex); - }; -} -function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f) { - if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); - return f; - } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _, done = false; - for(var i = decorators.length - 1; i >= 0; i--){ - var context = {}; - for(var p in contextIn)context[p] = p === "access" ? {} : contextIn[p]; - for(var p in contextIn.access)context.access[p] = contextIn.access[p]; - context.addInitializer = function(f) { - if (done) throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f || null)); - }; - var result = (0, decorators[i])(kind === "accessor" ? { - get: descriptor.get, - set: descriptor.set - } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_ = accept(result.get)) descriptor.get = _; - if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.unshift(_); - } else if (_ = accept(result)) { - if (kind === "field") initializers.unshift(_); - else descriptor[key] = _; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -} -function __runInitializers(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for(var i = 0; i < initializers.length; i++)value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); - return useValue ? value : void 0; -} -function __propKey(x) { - return typeof x === "symbol" ? x : "".concat(x); -} -function __setFunctionName(f, name, prefix) { - if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; - return Object.defineProperty(f, "name", { - configurable: true, - value: prefix ? "".concat(prefix, " ", name) : name - }); -} -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} -function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); + } + reviveSnapshot(snapshotOrIndex) { + if (typeof snapshotOrIndex === "number") { + const selectedSnapshotIndex = snapshotOrIndex; + const snapshot = this.state.snapshots[selectedSnapshotIndex]; + const newState = { note: snapshot.description, selectedSnapshotIndex }; + if (!this.state.sidebarClosed) { + newState.sideTabId = SideTabId.Snapshots; + this.scrollSnapshotIntoView(selectedSnapshotIndex); + } + if (snapshot.insight) { + const { backgroundImage } = snapshot.insight; + this.imageHolder.showBackgroundImage = !!backgroundImage; + if (backgroundImage) { + this.imageHolder.img = { + src: backgroundImage.url, + height: backgroundImage.size.height, + width: backgroundImage.size.width + }; + } + } + this.setInsight({ label: strings$1.labelHistoryReviveSnapshot }, newState, snapshot.insight, true, snapshot.setup); + } else { + const snapshot = snapshotOrIndex; + if (snapshot.insight) { + this.setInsight({ label: strings$1.labelHistoryReviveSnapshot }, { note: snapshot.description, selectedSnapshotIndex: -1 }, snapshot.insight, true, snapshot.setup); + } else { + this.setState({ note: snapshot.description, selectedSnapshotIndex: -1 }); + } + } + } + load(data2, getPartialInsight, optionsOrPrefs) { + this.setState({ historyIndex: -1, historyItems: [] }); + this.changeInsight({ columns: null }, { label: null, omit: true }, { note: null }); + return new Promise((resolve2, reject) => { + const loadFinal = (dataContent) => { + let partialInsight; + this.prefs = optionsOrPrefs && optionsOrPrefs.chartPrefs || optionsOrPrefs || {}; + this.imageHolder.backgroundImageColumnBounds = getBackgroundImageColumnBounds(dataContent.columns); + if (getPartialInsight) { + partialInsight = getPartialInsight(dataContent.columns); + initPrefs(this.prefs, partialInsight); + } + if (!partialInsight) { + const r = new RecommenderSummary(dataContent.columns, dataContent.data); + partialInsight = r.recommend(); + } + partialInsight = Object.assign({ facetStyle: "wrap", filter: null, totalStyle: null, transform: null }, partialInsight); + if (partialInsight.chart === "barchart") { + partialInsight.chart = "barchartV"; + } + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + const sideTabId = SideTabId.ChartType; + resetSelectedItemIndex(selectedItemIndex); + const newState = Object.assign({ + camera: void 0, + columns: {}, + dataFile, + dataContent, + snapshots: dataContent.snapshots || this.state.snapshots, + autoCompleteDistinctValues: {}, + filteredData: null, + tooltipExclusions: optionsOrPrefs && optionsOrPrefs.tooltipExclusions || [], + selectedItemIndex, + sideTabId + }, partialInsight); + this.getColorContext = null; + ensureColumnsExist(newState.columns, dataContent.columns, newState.transform); + const errors = ensureColumnsPopulated(partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.chart, partialInsight === null || partialInsight === void 0 ? void 0 : partialInsight.totalStyle, newState.columns, dataContent.columns); + newState.errors = errors; + newState.transitionColumn = dataContent.columns[0]; + const setup2 = optionsOrPrefs && optionsOrPrefs.setup; + this.setSetup(setup2, newState); + this.changeInsight(partialInsight, { label: strings$1.labelHistoryInit, insert: true }, newState, optionsOrPrefs && optionsOrPrefs.setup); + this.activateDataBrowserItem(sideTabId, this.state.dataScopeId); + resolve2(); + }; + let dataFile; + if (Array.isArray(data2)) { + return loadDataArray(data2, "json", optionsOrPrefs && optionsOrPrefs.columnTypes).then((result) => { + dataFile = { + type: "json" + }; + loadFinal(result); + }).catch(reject); + } else { + dataFile = data2; + return loadDataFile(dataFile, optionsOrPrefs && optionsOrPrefs.columnTypes).then(loadFinal).catch(reject); + } }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); + } + changeChartType(chart) { + const partialInsight = Object.assign({}, copyPrefToNewState(this.prefs, chart, "*", "*")); + const insight = Object.assign({ chart }, partialInsight); + const columns = deepMerge({}, partialInsight.columns, this.state.columns); + const { signalValues } = this.viewer.getInsight(); + insight.signalValues = Object.assign(Object.assign({}, this.state.signalValues), signalValues); + insight.columns = Object.assign({}, columns); + insight.totalStyle = this.state.totalStyle; + let errors; + if (this.state.chart === "scatterplot" && (chart === "barchart" || chart === "barchartV")) { + insight.columns = Object.assign(Object.assign({}, columns), { sort: columns.y }); + } else if (this.state.chart === "scatterplot" && chart === "barchartH") { + insight.columns = Object.assign(Object.assign({}, columns), { sort: columns.x }); + } else if (chart === "treemap") { + insight.view = "2d"; + if (!columns.size) { + let sizeColumn; + if (partialInsight && partialInsight.columns && partialInsight.columns.size) { + const prefSizeColumn = this.state.dataContent.columns.filter((c2) => c2.name === partialInsight.columns.size)[0]; + if (prefSizeColumn && prefSizeColumn.quantitative) { + sizeColumn = prefSizeColumn; + } + } + if (!sizeColumn) { + sizeColumn = getTreemapColumn(this.state.dataContent.columns); + } + if (!sizeColumn) { + errors = [strings$1.errorColumnMustBeNumeric]; + } else { + insight.columns = Object.assign(Object.assign({}, columns), { size: sizeColumn.name }); } + } + } else if (chart === "stacks") { + insight.view = "3d"; } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + ensureColumnsExist(insight.columns, this.state.dataContent.columns, this.state.transform); + errors = ensureColumnsPopulated(chart, insight.totalStyle, insight.columns, this.state.dataContent.columns); + this.calculate(() => { + this.changeInsight(insight, { label: strings$1.labelHistoryChangeChartType(chartLabel(chart)) }, errors ? { errors, camera: void 0 } : { camera: void 0 }); + }); + return insight.columns; + } + calculate(calculating) { + this.setState({ calculating }); + } + changeView(view) { + this.changeInsight({ view }, { label: view === "2d" ? strings$1.labelViewType2d : strings$1.labelViewType3d }); + } + //state members which change the insight + changeInsight(partialInsight, historyAction, additionalUIState, historicSetup) { + if (!partialInsight.signalValues) { + partialInsight.signalValues = null; } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + if (partialInsight.chart === "barchart") { + partialInsight.chart = "barchartV"; } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} -function __generator(thisArg, body) { - var _ = { - label: 0, - sent: function() { - if (t[0] & 1) throw t[1]; - return t[1]; - }, - trys: [], - ops: [] - }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); - return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { - return this; - }), g; - function verb(n) { - return function(v) { - return step([ - n, - v - ]); + this.addHistory(Object.assign(Object.assign({}, partialInsight), { historicSetup }), historyAction, additionalUIState); + } + addHistory(historicInsight, historyAction, additionalUIState) { + const setCleanState = (newState) => { + const cleanState = Object.assign(Object.assign({}, newState), additionalUIState); + if (!cleanState.note) { + cleanState.note = null; + } + delete cleanState.rebaseFilter; + if (this.viewer) { + const { signalValues } = this.viewer.getInsight(); + cleanState.signalValues = Object.assign(Object.assign(Object.assign({}, this.state.signalValues), signalValues), cleanState.signalValues); + } + this.setState(cleanState); + }; + if (historyAction.omit) { + setCleanState(historicInsight); + return; + } + const historyItems = this.state.historyItems.slice(0, this.state.historyIndex + 1); + const historyIndex = historyItems.length; + historyItems.push({ label: historyAction.label, historicInsight }); + if (historyAction.insert) { + setCleanState({ historyIndex, historyItems }); + } else { + setCleanState(Object.assign(Object.assign({}, historicInsight), { historyIndex, historyItems })); + } + } + replay(index2) { + return replay(this.state.historyItems, index2); + } + undo() { + const historyIndex = this.state.historyIndex - 1; + if (historyIndex < 0) + return; + this.doReplay(historyIndex); + } + redo(historyIndex = this.state.historyIndex + 1) { + if (historyIndex >= this.state.historyItems.length) + return; + this.doReplay(historyIndex); + } + doReplay(historyIndex) { + const newState = this.replay(historyIndex); + this.rebaseFilter = true; + this.setSetup(newState.historicSetup, newState); + this.setState(Object.assign(Object.assign({}, newState), { historyIndex })); + } + changespecCapabilities(specCapabilities) { + this.setState({ specCapabilities }); + } + changeColumnMapping(role, column, options2) { + const columns = Object.assign({}, this.state.columns); + const label2 = column ? strings$1.labelHistoryMapColumn(role) : strings$1.labelHistoryUnMapColumn(role); + const final = () => { + const partialInsight = { columns, totalStyle: options2 ? options2.totalStyle : this.state.totalStyle }; + const errors = ensureColumnsPopulated(this.state.chart, partialInsight.totalStyle, partialInsight.columns, this.state.dataContent.columns); + columns[role] = column && column.name; + this.changeInsight(partialInsight, { label: label2 }, errors ? { errors, camera: this.viewer.getCamera() } : { camera: this.viewer.getCamera() }); + }; + const _changeInsight = (newInsight, columnUpdate, historyAction) => { + newInsight.columns = deepMerge({}, columns, columnUpdate); + savePref(this.prefs, this.state.chart, "*", "*", { columns: columnUpdate }); + this.changeInsight(newInsight, historyAction, { camera: this.viewer.getCamera() }); }; - } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while(g && (g = 0, op[0] && (_ = 0)), _)try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [ - op[0] & 2, - t.value - ]; - switch(op[0]){ - case 0: - case 1: - t = op; - break; - case 4: - _.label++; - return { - value: op[1], - done: false - }; - case 5: - _.label++; - y = op[1]; - op = [ - 0 - ]; - continue; - case 7: - op = _.ops.pop(); - _.trys.pop(); - continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { - _ = 0; - continue; - } - if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { - _.label = op[1]; - break; - } - if (op[0] === 6 && _.label < t[1]) { - _.label = t[1]; - t = op; - break; - } - if (t && _.label < t[2]) { - _.label = t[2]; - _.ops.push(op); - break; - } - if (t[2]) _.ops.pop(); - _.trys.pop(); - continue; + if (column) { + let columnUpdate; + switch (role) { + case "facet": { + copyPrefToNewState(this.prefs, this.state.chart, "facet", column.name); + const historicInsight = { columns, facetStyle: options2 ? options2.facetStyle : this.state.facetStyle }; + columnUpdate = { facet: column.name }; + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + break; + } + case "color": { + let calculating = null; + const historicInsight = { scheme: options2 && options2.scheme, columns, colorBin: this.state.colorBin }; + if (!historicInsight.scheme) { + copyPrefToNewState(this.prefs, this.state.chart, "color", column.name); + } + if (!historicInsight.scheme) { + historicInsight.scheme = bestColorScheme(column, null, this.state.scheme); + } + if (!column.stats.hasColorData) { + historicInsight.directColor = false; + if (this.state.directColor !== historicInsight.directColor) { + calculating = () => this._resize(); + } + } + if (this.state.columns && this.state.columns.color && this.state.columns.color !== column.name) { + const currColorColumn = this.state.dataContent.columns.filter((c2) => c2.name === this.state.columns.color)[0]; + if (column.isColorData != currColorColumn.isColorData) { + calculating = () => this._resize(); + } + } + this.ignoreSelectionChange = true; + this.viewer.deselect().then(() => { + this.ignoreSelectionChange = false; + requestAnimationFrame(() => { + columnUpdate = { color: column.name }; + this.getColorContext = null; + this.setState({ calculating }); + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + }); + }); + break; + } + case "x": { + copyPrefToNewState(this.prefs, this.state.chart, "x", column.name); + const historicInsight = { columns }; + columnUpdate = { x: column.name }; + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + break; + } + case "size": { + copyPrefToNewState(this.prefs, this.state.chart, "size", column.name); + const historicInsight = { totalStyle: options2 ? options2.totalStyle : this.state.totalStyle }; + columnUpdate = { size: column.name }; + _changeInsight(historicInsight, columnUpdate, { label: label2 }); + break; } - op = body.call(thisArg, _); - } catch (e) { - op = [ - 6, - e - ]; - y = 0; - } finally{ - f = t = 0; + default: { + final(); + break; + } + } + } else { + switch (role) { + case "facet": { + columns.facet = null; + columns.facetV = null; + this.changeInsight({ columns, facetStyle: "wrap" }, { label: label2 }); + break; + } + default: { + final(); + break; + } + } } - if (op[0] & 5) throw op[1]; - return { - value: op[0] ? op[1] : void 0, - done: true - }; - } -} -var __createBinding = Object.create ? function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = { - enumerable: true, - get: function() { - return m[k]; - } - }; - Object.defineProperty(o, k2, desc); -} : function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}; -function __exportStar(m, o) { - for(var p in m)if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} -function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function() { - if (o && i >= o.length) o = void 0; - return { - value: o && o[i++], - done: !o - }; + } + setSideTabId(sideTabId, dataScopeId) { + if (sideTabId === SideTabId.Data && dataScopeId == null) { + dataScopeId = this.getBestDataScopeId(); } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while((n === void 0 || n-- > 0) && !(r = i.next()).done)ar.push(r.value); - } catch (error) { - e = { - error: error + if (dataScopeId == null) { + dataScopeId = this.state.dataScopeId; + } + const calculating = () => { + this.dialogFocusHandler.focus && this.dialogFocusHandler.focus(); }; - } finally{ - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } finally{ - if (e) throw e.error; - } - } - return ar; -} -function __spread() { - for(var ar = [], i = 0; i < arguments.length; i++)ar = ar.concat(__read(arguments[i])); - return ar; -} -function __spreadArrays() { - for(var s = 0, i = 0, il = arguments.length; i < il; i++)s += arguments[i].length; - for(var r = Array(s), k = 0, i = 0; i < il; i++)for(var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)r[k] = a[j]; - return r; -} -function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) { - for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; + this.setState({ sideTabId, dataScopeId, sidebarClosed: false, calculating }); + this.activateDataBrowserItem(sideTabId, dataScopeId); + } + getBestDataScopeId() { + let dataScopeId; + const selectionState = this.viewer && this.viewer.getSelection(); + if (selectionState && selectionState.selectedData && selectionState.selectedData.length) { + dataScopeId = DataScopeId.SelectedData; + } else if (this.state.filteredData) { + dataScopeId = DataScopeId.FilteredData; + } else { + dataScopeId = DataScopeId.AllData; } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function awaitReturn(f) { - return function(v) { - return Promise.resolve(v).then(f, reject); + return dataScopeId; + } + activateDataBrowserItem(sideTabId, dataScopeId) { + if (!this.viewer) + return; + let itemToActivate; + if (sideTabId === SideTabId.Data) { + switch (dataScopeId) { + case DataScopeId.AllData: { + itemToActivate = this.state.dataContent && this.state.dataContent.data[this.state.selectedItemIndex[DataScopeId.AllData]]; + break; + } + case DataScopeId.FilteredData: { + itemToActivate = this.state.filteredData && this.state.filteredData[this.state.selectedItemIndex[DataScopeId.FilteredData]]; + break; + } + case DataScopeId.SelectedData: { + const selection = this.viewer.getSelection() || {}; + itemToActivate = selection.selectedData && selection.selectedData[this.state.selectedItemIndex[DataScopeId.SelectedData]]; + break; + } + } + } + this.silentActivation(itemToActivate); + } + silentActivation(itemToActivate) { + this.ignoreSelectionChange = true; + const done = () => { + this.ignoreSelectionChange = false; }; - } - function verb(n, f) { - if (g[n]) { - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([ - n, - v, - a, - b - ]) > 1 || resume(n, v); - }); - }; - if (f) i[n] = f(i[n]); + if (itemToActivate) { + return this.viewer.activate(itemToActivate).then(done); + } else { + return this.viewer.deActivate().then(done); } - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); + } + sidebar(sidebarClosed, sidebarPinned) { + this.setState({ sidebarClosed, sidebarPinned }); + } + resize() { + this.setState({ calculating: () => this._resize() }); + } + _resize() { + this.changeInsight({ size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed) }, { label: "resize", omit: true }); + } + viewerMounted(glDiv) { + this.setState({ + size: this.getLayoutDivSize(this.state.sidebarPinned, this.state.sidebarClosed), + signalValues: this.state.signalValues + //keep initialized signalValues + }); + } + getLayoutDivSize(pinned, closed) { + const div = pinned && !closed ? this.layoutDivPinned : this.layoutDivUnpinned; + return { height: div.offsetHeight, width: div.offsetWidth }; + } + toggleableSearch(e, search) { + if (e.ctrlKey) { + this.setState({ search: createInputSearch(search) }); + this.setSideTabId(SideTabId.Search); + } else { + const oldSelection = this.viewer.getSelection(); + if (oldSelection.search) { + const result = compareGroups(ensureSearchExpressionGroupArray(oldSelection.search), search); + if (result.found) { + if (result.groups.length === 0) { + this.doDeselect(); + } else { + this.doSelect(result.groups); + } + } else { + if (e.altKey || e.shiftKey) { + let group2 = true; + if (e.altKey) { + search.clause = "&&"; + } else if (e.shiftKey) { + if (this.props.searchORDisabled) { + group2 = false; + } else { + search.clause = "||"; + } + } + if (group2) { + result.groups.push(search); + this.doSelect(result.groups); + } else { + this.doSelect(search); + } + } else { + this.doSelect(search); + } + } + } else { + this.doSelect(search); + } } - } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); - } -} -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function(e) { - throw e; - }), verb("return"), i[Symbol.iterator] = function() { - return this; - }, i; - function verb(n, f) { - i[n] = o[n] ? function(v) { - return (p = !p) ? { - value: __await(o[n](v)), - done: false - } : f ? f(v) : v; - } : f; - } -} -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); + } + doFilter(search, historicFilterChange) { + this.historicFilterChange = historicFilterChange; + this.viewer.filter(search); + } + doUnfilter(historicFilterChange) { + this.historicFilterChange = historicFilterChange; + this.viewer.reset(); + } + doSelect(search) { + return this.viewer.select(search); + } + doDeselect() { + return this.viewer.deselect(); + } + writeSnapshot(snapshot, editIndex) { + let { selectedSnapshotIndex } = this.state; + let snapshots; + if (editIndex >= 0) { + snapshots = [...this.state.snapshots]; + snapshots[editIndex] = snapshot; + this.setState({ snapshots, selectedSnapshotIndex }); + } else { + const note = snapshot.description; + snapshots = this.state.snapshots.concat(snapshot); + selectedSnapshotIndex = snapshots.length - 1; + this.scrollSnapshotIntoView(selectedSnapshotIndex); + this.setState({ sideTabId: SideTabId.Snapshots, snapshots, selectedSnapshotIndex, note }); + } + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + } + scrollSnapshotIntoView(selectedSnapshotIndex) { + clearTimeout(this.scrollSnapshotTimer); + if (this.state.sidebarClosed) + return; + this.scrollSnapshotTimer = setTimeout(() => { + const selectedSnapshotElement = this.div.querySelector(`.snapshot:nth-child(${selectedSnapshotIndex + 1})`); + if (selectedSnapshotElement) { + selectedSnapshotElement.scrollIntoView({ behavior: "smooth", block: "nearest" }); + } + }, 500); + } + componentDidMount() { + if (this.props.mounted) { + this.props.mounted(this); + } + } + render() { + var _a2, _b2, _c2; + const insight = getPureInsight(this.state); + const loaded2 = !!(insight.columns && this.state.dataContent); + if (loaded2) { + setInsightBackgroundImage(insight, this.imageHolder, this.state.columns); + } + const selectionState = this.viewer && this.viewer.getSelection() || {}; + const selectionSearch = selectionState && selectionState.search; + const columnMapProps = this.getColumnMapBaseProps(); + const datas = {}; + datas[DataScopeId.AllData] = this.state.dataContent && this.state.dataContent.data; + datas[DataScopeId.FilteredData] = this.state.filteredData; + datas[DataScopeId.SelectedData] = selectionState && selectionState.selectedData; + if (this.state.calculating) { + requestAnimationFrame(() => { + if (this.state.calculating) { + this.state.calculating(); + this.setState({ calculating: null }); + } + }); + } + const theme = this.props.theme || ""; + const themePalette = themePalettes[theme]; + let renderOptions; + if (loaded2) { + renderOptions = Object.assign(Object.assign({}, this.props.renderOptions), { rebaseFilter: () => this.rebaseFilter, initialColorContext: this.getColorContext && this.getColorContext(this.viewer.insight, insight), discardColorContextUpdates: () => this.discardColorContextUpdates, columns: (_a2 = this.state.dataContent) === null || _a2 === void 0 ? void 0 : _a2.columns }); + } + return base$1.react.createElement( + "div", + { ref: (div) => { + if (div) + this.div = div; + }, className: classList("sanddance-explorer", this.props.theme) }, + base$1.react.createElement(Topbar, { collapseLabels: this.props.compactUI, historyIndex: this.state.historyIndex, historyItems: this.state.historyItems, undo: () => this.undo(), redo: () => this.redo(), logoClickUrl: this.props.logoClickUrl, logoClickTarget: this.props.logoClickTarget, themePalette, loaded: loaded2, doDeselect: this.doDeselect.bind(this), doFilter: this.doFilter.bind(this), doUnfilter: this.doUnfilter.bind(this), filter: this.state.filter, selectionSearch, selectionState, buttons: this.props.topBarButtonProps, iconButtons: this.props.topBarIconButtonProps, view: this.state.view, snapshotsHidden: (_b2 = this.props.snapshotProps) === null || _b2 === void 0 ? void 0 : _b2.hidden, snapshots: this.state.snapshots, onSnapshotPreviousClick: () => { + let selectedSnapshotIndex; + if (this.state.selectedSnapshotIndex === -1) { + selectedSnapshotIndex = this.state.snapshots.length - 1; + } else { + selectedSnapshotIndex = this.state.selectedSnapshotIndex; + selectedSnapshotIndex--; + if (selectedSnapshotIndex < 0) { + selectedSnapshotIndex = this.state.snapshots.length - 1; + } + } + this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); + }, onSnapshotClick: () => this.snapshotEditor.editSnapshot(), onSnapshotNextClick: () => { + let selectedSnapshotIndex; + if (this.state.selectedSnapshotIndex === -1) { + selectedSnapshotIndex = 0; + } else { + selectedSnapshotIndex = this.state.selectedSnapshotIndex; + selectedSnapshotIndex++; + if (selectedSnapshotIndex > this.state.snapshots.length - 1) { + selectedSnapshotIndex = 0; + } + } + this.handleReviveSnapshot(this.state.snapshots[selectedSnapshotIndex], selectedSnapshotIndex); + }, onViewClick: () => { + const view = this.state.view === "2d" ? "3d" : "2d"; + this.changeInsight({ view }, { label: view === "2d" ? strings$1.labelViewType2d : strings$1.labelViewType3d }); + } }), + base$1.react.createElement( + "div", + { className: classList("sanddance-main", this.state.sidebarPinned && "pinned", this.state.sidebarClosed && "closed", (insight.hideLegend || insight.directColor || !colorMapping(insight, this.state.dataContent && this.state.dataContent.columns)) && "hide-legend") }, + base$1.react.createElement("div", { ref: (div) => { + if (div && !this.layoutDivUnpinned) + this.layoutDivUnpinned = div; + }, className: "sanddance-layout-unpinned" }), + base$1.react.createElement("div", { ref: (div) => { + if (div && !this.layoutDivPinned) + this.layoutDivPinned = div; + }, className: "sanddance-layout-pinned" }), + !loaded2 && base$1.react.createElement( + "div", + { className: "loading" }, + base$1.react.createElement(base$1.fluentUI.Spinner, { size: base$1.fluentUI.SpinnerSize.large, label: strings$1.loading }) + ), + base$1.react.createElement(Sidebar, { themePalette, calculating: !!this.state.calculating, closed: this.state.sidebarClosed, hideSidebarControls: this.props.hideSidebarControls, snapshotsHidden: (_c2 = this.props.snapshotProps) === null || _c2 === void 0 ? void 0 : _c2.hidden, pinned: this.state.sidebarPinned, disabled: !loaded2, dataScopeProps: { + themePalette, + compact: this.state.sidebarClosed, + onCompactClick: () => { + this.changeInsight({ + size: this.getLayoutDivSize(this.state.sidebarPinned, false) + }, { + label: null, + omit: true + }, { + sidebarClosed: false + }); + }, + dataSet: this.props.datasetElement, + dataCount: loaded2 && { + all: this.state.dataContent && this.state.dataContent.data.length, + filtered: this.state.filteredData && this.state.filteredData.length, + selected: selectionState && selectionState.selectedData && selectionState.selectedData.length + }, + active: this.state.sideTabId === SideTabId.Data, + onDataScopeClick: (dataScopeId) => this.setSideTabId(SideTabId.Data, dataScopeId), + selectedDataScope: this.state.dataScopeId, + disabled: !loaded2 + }, onSideTabClick: (sideTabId) => { + if (sideTabId === SideTabId.Collapse || this.state.sideTabId === sideTabId) { + let { dataScopeId, sidebarClosed } = this.state; + if (sidebarClosed && sideTabId === SideTabId.Data) { + dataScopeId = this.getBestDataScopeId(); + } + sidebarClosed = !this.state.sidebarClosed; + this.changeInsight({ + size: this.getLayoutDivSize(this.state.sidebarPinned, sidebarClosed) + }, { + label: null, + omit: true + }, { + dataScopeId, + sidebarClosed + }); + } else if (sideTabId === SideTabId.Pin) { + this.changeInsight({ + size: this.getLayoutDivSize(!this.state.sidebarPinned, this.state.sidebarClosed) + }, { + label: null, + omit: true + }, { + sidebarPinned: !this.state.sidebarPinned + }); + } else { + this.setSideTabId(sideTabId); + } + }, selectedSideTab: this.state.sideTabId }, loaded2 && (() => { + switch (this.state.sideTabId) { + case SideTabId.ChartType: { + return base$1.react.createElement(Chart, Object.assign({ themePalette, collapseLabels: this.props.compactUI, tooltipExclusions: this.state.tooltipExclusions, toggleTooltipExclusion: (columnName) => { + const tooltipExclusions = [...this.state.tooltipExclusions]; + const i = tooltipExclusions.indexOf(columnName); + if (i < 0) { + tooltipExclusions.push(columnName); + } else { + tooltipExclusions.splice(i, 1); + } + this.setState({ tooltipExclusions }); + this.props.onTooltipExclusionsChanged && this.props.onTooltipExclusionsChanged(tooltipExclusions); + }, disabled: !loaded2 || this.state.sidebarClosed }, columnMapProps, { chart: this.state.chart, view: this.state.view, insightColumns: this.state.columns, onChangeSignal: (role, column, name, value2) => saveSignalValuePref(this.prefs, this.state.chart, role, column, name, value2) })); + } + case SideTabId.Color: { + return base$1.react.createElement(Color, Object.assign({ compactUI: this.props.compactUI, specCapabilities: this.state.specCapabilities, disabled: !loaded2 || this.state.sidebarClosed }, columnMapProps, { dataContent: this.state.dataContent, scheme: this.state.scheme, colorBin: this.state.colorBin, colorBinSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s2) => s2.name === SignalNames.ColorBinCount)[0], colorReverseSignal: this.viewer && this.viewer.vegaSpec && this.viewer.vegaSpec.signals.filter((s2) => s2.name === SignalNames.ColorReverse)[0], colorColumn: this.state.columns.color, onColorBinChange: (colorBin) => { + this.ignoreSelectionChange = true; + this.viewer.deselect().then(() => { + this.ignoreSelectionChange = false; + requestAnimationFrame(() => { + this.getColorContext = null; + this.changeInsight({ colorBin }, { label: strings$1.labelHistoryColorBin }); + savePref(this.prefs, this.state.chart, "color", this.state.columns.color, { colorBin }); + }); + }); + }, onColorSchemeChange: (scheme2) => { + this.changeColumnMapping("color", this.state.dataContent.columns.filter((c2) => c2.name === this.state.columns.color)[0], { scheme: scheme2 }); + savePref(this.prefs, this.state.chart, "color", this.state.columns.color, { scheme: scheme2 }); + }, onColorBinCountChange: (value2) => { + const signalValues = {}; + signalValues[SignalNames.ColorBinCount] = value2; + savePref(this.prefs, this.state.chart, "color", this.state.columns.color, { signalValues }); + }, onColorReverseChange: (value2) => { + this.getColorContext = null; + }, directColor: this.state.directColor, onDirectColorChange: (directColor) => { + this.changeInsight({ directColor }, { label: strings$1.labelHistoryDirectColor }, { calculating: () => this._resize() }); + } })); + } + case SideTabId.Data: { + const data2 = datas[this.state.dataScopeId]; + let itemVisible = true; + switch (this.state.dataScopeId) { + case DataScopeId.AllData: { + const item = this.state.selectedItemIndex[this.state.dataScopeId]; + itemVisible = this.state.dataContent && !this.state.filteredData || this.state.filteredData.indexOf(data2[item]) >= 0; + } + } + return base$1.react.createElement(DataBrowser, { explorer: this, theme: this.props.theme, themePalette, disabled: !loaded2 || this.state.sidebarClosed, columns: this.state.dataContent && this.state.dataContent.columns, categoricalColumns: columnMapProps.categoricalColumns, quantitativeColumns: columnMapProps.quantitativeColumns, data: data2, displayName: this.state.dataFile && this.state.dataFile.displayName || strings$1.defaultFileName, nullMessage: dataBrowserNullMessages[this.state.dataScopeId], zeroMessage: dataBrowserZeroMessages[this.state.dataScopeId], index: this.state.selectedItemIndex[this.state.dataScopeId], itemVisible, dataExportHandler: this.props.dataExportHandler, selectedDataScope: this.state.dataScopeId, onDataScopeClick: (dataScopeId) => this.setSideTabId(SideTabId.Data, dataScopeId), onActivate: (row, index2) => { + const selectedItemIndex = Object.assign({}, this.state.selectedItemIndex); + selectedItemIndex[this.state.dataScopeId] = index2; + this.setState({ selectedItemIndex }); + this.silentActivation(row); + }, onSearch: (e, search) => { + if (e.ctrlKey) { + this.setState({ sideTabId: SideTabId.Search, search }); + } else { + this.doSelect(search); + } + }, bingSearchDisabled: this.props.bingSearchDisabled, onUpdateColumnTypes: (columnTypes) => { + this.load(this.state.dataFile, null, { prefs: this.prefs, columnTypes }); + } }); + } + case SideTabId.Search: { + return base$1.react.createElement(Search, { explorer: this, collapseLabels: this.props.compactUI, themePalette, disabled: !loaded2 || this.state.sidebarClosed, disableGroupOR: this.props.searchORDisabled, disableExpressionOR: this.props.searchORDisabled, initializer: { + columns: columnMapProps.allColumns, + search: this.state.search + }, autoCompleteDistinctValues: this.state.autoCompleteDistinctValues, onSelect: (expr2) => this.doSelect(expr2), data: this.state.dataContent.data }); + } + case SideTabId.Snapshots: { + return base$1.react.createElement(Snapshots, Object.assign({}, this.props.snapshotProps, { editor: this.snapshotEditor, themePalette, explorer: this, snapshots: this.state.snapshots, selectedSnapshotIndex: this.state.selectedSnapshotIndex, onClearSnapshots: () => { + const snapshots = []; + this.setState({ snapshots, selectedSnapshotIndex: -1 }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + }, onWriteSnapshot: (s2, i) => this.writeSnapshot(s2, i), onRemoveSnapshot: (i) => { + const snapshots = [...this.state.snapshots]; + snapshots.splice(i, 1); + let { selectedSnapshotIndex } = this.state; + if (i === selectedSnapshotIndex) { + selectedSnapshotIndex = -1; + } else if (selectedSnapshotIndex > i) { + selectedSnapshotIndex--; + } + this.setState({ snapshots, selectedSnapshotIndex }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + }, onSnapshotClick: (snapshot, selectedSnapshotIndex) => { + this.setState({ selectedSnapshotIndex }); + this.calculate(() => { + this.handleReviveSnapshot(snapshot, selectedSnapshotIndex); + }); + }, onMoveUp: (i) => { + if (i > 0) { + const snapshots = [...this.state.snapshots]; + const temp2 = snapshots[i - 1]; + snapshots[i - 1] = snapshots[i]; + snapshots[i] = temp2; + let { selectedSnapshotIndex } = this.state; + if (i === selectedSnapshotIndex) { + selectedSnapshotIndex = i - 1; + } else if (i - 1 === selectedSnapshotIndex) { + selectedSnapshotIndex = i; + } + this.setState({ snapshots, selectedSnapshotIndex }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + } + }, onMoveDown: (i) => { + if (i < this.state.snapshots.length - 1) { + const snapshots = [...this.state.snapshots]; + const temp2 = snapshots[i + 1]; + snapshots[i + 1] = snapshots[i]; + snapshots[i] = temp2; + let { selectedSnapshotIndex } = this.state; + if (i === selectedSnapshotIndex) { + selectedSnapshotIndex = i + 1; + } else if (i + 1 === selectedSnapshotIndex) { + selectedSnapshotIndex = i; + } + this.setState({ snapshots, selectedSnapshotIndex }); + this.props.onSnapshotsChanged && this.props.onSnapshotsChanged(snapshots); + } + } })); + } + case SideTabId.History: { + return base$1.react.createElement(History, { explorer: this, themePalette, historyIndex: this.state.historyIndex, historyItems: this.state.historyItems, redo: (i) => this.redo(i) }); + } + case SideTabId.Transition: { + return base$1.react.createElement(TransitionEditor, Object.assign({}, columnMapProps, this.state, { compactUI: this.props.compactUI, explorer: this, themePalette, changeSetup: (newState, affectsStagger) => { + const calculating = () => { + if (affectsStagger) { + this.viewer.assignTransitionStagger(getTransition(this.state)); + } + this.props.onSetupOptionsChanged && this.props.onSetupOptionsChanged(this.getSetup()); + }; + if (newState) { + this.setState(Object.assign(Object.assign({}, newState), { calculating })); + } else { + calculating(); + } + } })); + } + case SideTabId.Settings: { + return base$1.react.createElement(Settings, { explorer: this, dataFile: this.state.dataFile, scheme: this.state.scheme, hideLegend: this.state.hideLegend, onToggleLegend: (hideLegend) => this.setState({ hideLegend, calculating: () => this._resize() }), hideAxes: this.state.hideAxes, onToggleAxes: (hideAxes) => this.setState({ calculating: () => this.setState({ hideAxes }) }), additionalSettings: this.props.additionalSettings }, this.props.systemInfoChildren); + } + } + })()), + loaded2 && base$1.react.createElement( + "div", + { className: "sanddance-view" }, + base$1.react.createElement(Viewer, { renderOptions, viewerOptions: this.viewerOptions, ref: (reactViewer) => { + if (reactViewer) { + this.viewer = reactViewer.viewer; + } + }, onView: (renderResult) => { + this.rebaseFilter = false; + this.changespecCapabilities(renderResult.specResult.errors ? renderResult.specResult.specCapabilities : this.viewer.specCapabilities); + this.getColorContext = (oldInsight, newInsight) => { + if (!oldInsight && !newInsight) { + return null; + } + if (!oldInsight || !newInsight) { + return null; + } + if (oldInsight.scheme !== newInsight.scheme) { + return null; + } + if (oldInsight.columns.color !== newInsight.columns.color) { + return null; + } + if (oldInsight.directColor != newInsight.directColor) { + return null; + } + return this.viewer.colorContexts && this.viewer.colorContexts[this.viewer.currentColorContext]; + }; + removeTabIndex(this.viewer); + this.props.onView && this.props.onView(); + }, onError: (e) => { + this.props.onError && this.props.onError(e); + }, data: this.state.dataContent.data, insight, setup: this.getSetup(), onMount: (el) => this.viewerMounted(el) }), + this.state.note && base$1.react.createElement( + "div", + { className: "sanddance-note" }, + base$1.react.createElement(IconButton$1, { className: "cancel", themePalette, title: strings$1.buttonClose, iconName: "Cancel", onClick: () => this.setState({ note: null }) }), + base$1.react.createElement("div", null, this.state.note) + ), + base$1.react.createElement(Renderer$1, { explorer: this, advanced: this.state.renderer.advanced, advancedOptions: this.state.renderer.advancedOptions, basicOptions: this.state.renderer.basicOptions, themePalette, onHomeClick: () => { + this.setState({ camera: void 0 }); + this.viewer.presenter.homeCamera(); + } }) + ), + base$1.react.createElement(Dialog$1, { title: strings$1.labelError, hidden: !this.state.errors, onDismiss: () => { + this.setState({ errors: null }); + } }, this.state.errors && this.state.errors.map((error2, i) => base$1.react.createElement("div", { key: i }, error2))), + base$1.react.createElement(SnapshotEditor, Object.assign({ ref: (se) => this.snapshotEditor = se }, this.props.snapshotProps, { explorer: this, onWriteSnapshot: (s2, i) => this.writeSnapshot(s2, i), theme: this.props.theme, themePalette })) + ), + this.state.positionedColumnMapProps && base$1.react.createElement(PositionedColumnMap, Object.assign({}, this.state.positionedColumnMapProps)) + ); + } + getColumnMapBaseProps() { + const allColumns = this.state.dataContent && this.state.dataContent.columns.filter((c2) => !isInternalFieldName(c2.name, true)); + const quantitativeColumns = allColumns && allColumns.filter((c2) => c2.quantitative); + const categoricalColumns = allColumns && allColumns.filter((c2) => !c2.quantitative); + const props = { + changeColumnMapping: (role, columnOrRole, defaultColumn, options2) => { + let column; + if (typeof columnOrRole === "string") { + const columnName = this.state.columns[columnOrRole]; + column = allColumns.filter((c2) => c2.name === columnName)[0] || defaultColumn; + } else { + column = columnOrRole; + } + this.changeColumnMapping(role, column, options2); + }, + facetStyle: this.state.facetStyle, + totalStyle: this.state.totalStyle, + allColumns, + quantitativeColumns, + categoricalColumns, + specCapabilities: this.state.specCapabilities, + explorer: this }; + return props; + } } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v) { - resolve({ - value: v, - done: d - }); - }, reject); + return new __Explorer(_props); + } + const Explorer = _Explorer; + const base$1 = { + fluentUI: null, + react: null, + reactDOM: null + }; + function use$2(fluentUI2, react, reactDOM, vega2) { + use$3(react, reactDOM, vega2); + base$1.fluentUI = fluentUI2; + base$1.react = react; + base$1.reactDOM = reactDOM; + BackgroundImageEditor.prototype = react.Component.prototype; + Chart.prototype = react.Component.prototype; + ColumnTypeChanger.prototype = react.Component.prototype; + DataExportPicker.prototype = react.Component.prototype; + Explorer.prototype = react.Component.prototype; + PositionedColumnMap.prototype = react.Component.prototype; + Renderer$1.prototype = react.Component.prototype; + Search.prototype = react.Component.prototype; + SnapshotEditor.prototype = react.Component.prototype; + Snapshots.prototype = react.Component.prototype; + Settings.prototype = react.Component.prototype; + TransitionEditor.prototype = react.Component.prototype; + } + function Dialog$1(props) { + return base$1.react.createElement( + base$1.fluentUI.Dialog, + Object.assign({}, props, { dialogContentProps: Object.assign({ + type: base$1.fluentUI.DialogType.normal, + title: props.title + }, props.dialogContentProps) }), + base$1.react.createElement("div", { onKeyUp: (e) => { + e.nativeEvent.stopImmediatePropagation(); + } }, props.children), + base$1.react.createElement( + base$1.fluentUI.DialogFooter, + null, + props.buttons, + base$1.react.createElement(base$1.fluentUI.DefaultButton, { iconProps: { iconName: "Cancel" }, onClick: props.onDismiss, text: strings$1.buttonClose }) + ) + ); + } + const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Dialog: Dialog$1 + }, Symbol.toStringTag, { value: "Module" })); + const SandDanceExplorer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Explorer, + SandDance: index$4, + SandDanceReact: index$3, + get SideTabId() { + return SideTabId; + }, + capabilities, + controls: index$2, + getColorSettingsFromThemePalette, + getEmbedHTML, + themePalettes, + use: use$2, + util: util$2, + version: version$2 + }, Symbol.toStringTag, { value: "Module" })); + const base = { + fluentUI: null + }; + function use$1(fluentUI2, vega2) { + use$2(fluentUI2, React__namespace, ReactDOM__namespace, vega2); + base.fluentUI = fluentUI2; + } + var extendStatics = function(d2, b2) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { + d3.__proto__ = b3; + } || function(d3, b3) { + for (var p in b3) if (Object.prototype.hasOwnProperty.call(b3, p)) d3[p] = b3[p]; + }; + return extendStatics(d2, b2); + }; + function __extends(d2, b2) { + if (typeof b2 !== "function" && b2 !== null) + throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null"); + extendStatics(d2, b2); + function __() { + this.constructor = d2; } -} -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) Object.defineProperty(cooked, "raw", { - value: raw - }); - else cooked.raw = raw; - return cooked; -} -var __setModuleDefault = Object.create ? function(o, v) { - Object.defineProperty(o, "default", { - enumerable: true, - value: v - }); -} : function(o, v) { - o["default"] = v; -}; -var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o) { - var ar = []; - for(var k in o)if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); -}; -function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for(var k = ownKeys(mod), i = 0; i < k.length; i++)if (k[i] !== "default") __createBinding(result, mod, k[i]); + d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); + } + var __assign$1 = function() { + __assign$1 = Object.assign || function __assign2(t) { + for (var s2, i = 1, n = arguments.length; i < n; i++) { + s2 = arguments[i]; + for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) t[p] = s2[p]; + } + return t; + }; + return __assign$1.apply(this, arguments); + }; + function __rest(s2, e) { + var t = {}; + for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p) && e.indexOf(p) < 0) + t[p] = s2[p]; + if (s2 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s2); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p[i])) + t[p[i]] = s2[p[i]]; + } + return t; + } + function __decorate(decorators, target2, key2, desc) { + var c2 = arguments.length, r = c2 < 3 ? target2 : desc === null ? desc = Object.getOwnPropertyDescriptor(target2, key2) : desc, d2; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target2, key2, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d2 = decorators[i]) r = (c2 < 3 ? d2(r) : c2 > 3 ? d2(target2, key2, r) : d2(target2, key2)) || r; + return c2 > 3 && r && Object.defineProperty(target2, key2, r), r; + } + function __spreadArray(to, from, pack2) { + if (pack2 || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } } - __setModuleDefault(result, mod); - return result; -} -function __importDefault(mod) { - return mod && mod.__esModule ? mod : { - default: mod - }; -} -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value; -} -function __classPrivateFieldIn(state, receiver) { - if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} -function __addDisposableResource(env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { - try { - inner.call(this); - } catch (e) { - return Promise.reject(e); - } - }; - env.stack.push({ - value: value, - dispose: dispose, - async: async - }); - } else if (async) env.stack.push({ - async: true - }); - return value; -} -var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) { + return to.concat(ar || Array.prototype.slice.call(from)); + } + typeof SuppressedError === "function" ? SuppressedError : function(error2, suppressed, message) { var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; -function __disposeResources(env) { - function fail(e) { - env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while(r = env.stack.pop())try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { - fail(e); - return next(); - }); - } else s |= 1; - } catch (e) { - fail(e); - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); -} -function __rewriteRelativeImportExtension(path, preserveJsx) { - if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) { - return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js"; - }); - return path; -} -exports.default = { - __extends: __extends, - __assign: __assign, - __rest: __rest, - __decorate: __decorate, - __param: __param, - __esDecorate: __esDecorate, - __runInitializers: __runInitializers, - __propKey: __propKey, - __setFunctionName: __setFunctionName, - __metadata: __metadata, - __awaiter: __awaiter, - __generator: __generator, - __createBinding: __createBinding, - __exportStar: __exportStar, - __values: __values, - __read: __read, - __spread: __spread, - __spreadArrays: __spreadArrays, - __spreadArray: __spreadArray, - __await: __await, - __asyncGenerator: __asyncGenerator, - __asyncDelegator: __asyncDelegator, - __asyncValues: __asyncValues, - __makeTemplateObject: __makeTemplateObject, - __importStar: __importStar, - __importDefault: __importDefault, - __classPrivateFieldGet: __classPrivateFieldGet, - __classPrivateFieldSet: __classPrivateFieldSet, - __classPrivateFieldIn: __classPrivateFieldIn, - __addDisposableResource: __addDisposableResource, - __disposeResources: __disposeResources, - __rewriteRelativeImportExtension: __rewriteRelativeImportExtension -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NZCy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Async", ()=>(0, _utilities.Async)); -parcelHelpers.export(exports, "AutoScroll", ()=>(0, _utilities.AutoScroll)); -parcelHelpers.export(exports, "BaseComponent", ()=>(0, _utilities.BaseComponent)); -parcelHelpers.export(exports, "Customizations", ()=>(0, _utilities.Customizations)); -parcelHelpers.export(exports, "Customizer", ()=>(0, _utilities.Customizer)); -parcelHelpers.export(exports, "CustomizerContext", ()=>(0, _utilities.CustomizerContext)); -parcelHelpers.export(exports, "DATA_IS_SCROLLABLE_ATTRIBUTE", ()=>(0, _utilities.DATA_IS_SCROLLABLE_ATTRIBUTE)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _utilities.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "DelayedRender", ()=>(0, _utilities.DelayedRender)); -parcelHelpers.export(exports, "EventGroup", ()=>(0, _utilities.EventGroup)); -parcelHelpers.export(exports, "FabricPerformance", ()=>(0, _utilities.FabricPerformance)); -parcelHelpers.export(exports, "FocusRects", ()=>(0, _utilities.FocusRects)); -parcelHelpers.export(exports, "FocusRectsContext", ()=>(0, _utilities.FocusRectsContext)); -parcelHelpers.export(exports, "FocusRectsProvider", ()=>(0, _utilities.FocusRectsProvider)); -parcelHelpers.export(exports, "GlobalSettings", ()=>(0, _utilities.GlobalSettings)); -parcelHelpers.export(exports, "IsFocusVisibleClassName", ()=>(0, _utilities.IsFocusVisibleClassName)); -parcelHelpers.export(exports, "KeyCodes", ()=>(0, _utilities.KeyCodes)); -parcelHelpers.export(exports, "Rectangle", ()=>(0, _utilities.Rectangle)); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>(0, _utilities.SELECTION_CHANGE)); -parcelHelpers.export(exports, "Selection", ()=>(0, _utilities.Selection)); -parcelHelpers.export(exports, "SelectionDirection", ()=>(0, _utilities.SelectionDirection)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _utilities.SelectionMode)); -parcelHelpers.export(exports, "addDirectionalKeyCode", ()=>(0, _utilities.addDirectionalKeyCode)); -parcelHelpers.export(exports, "addElementAtIndex", ()=>(0, _utilities.addElementAtIndex)); -parcelHelpers.export(exports, "allowOverscrollOnElement", ()=>(0, _utilities.allowOverscrollOnElement)); -parcelHelpers.export(exports, "allowScrollOnElement", ()=>(0, _utilities.allowScrollOnElement)); -parcelHelpers.export(exports, "anchorProperties", ()=>(0, _utilities.anchorProperties)); -parcelHelpers.export(exports, "appendFunction", ()=>(0, _utilities.appendFunction)); -parcelHelpers.export(exports, "arraysEqual", ()=>(0, _utilities.arraysEqual)); -parcelHelpers.export(exports, "asAsync", ()=>(0, _utilities.asAsync)); -parcelHelpers.export(exports, "assertNever", ()=>(0, _utilities.assertNever)); -parcelHelpers.export(exports, "assign", ()=>(0, _utilities.assign)); -parcelHelpers.export(exports, "audioProperties", ()=>(0, _utilities.audioProperties)); -parcelHelpers.export(exports, "baseElementEvents", ()=>(0, _utilities.baseElementEvents)); -parcelHelpers.export(exports, "baseElementProperties", ()=>(0, _utilities.baseElementProperties)); -parcelHelpers.export(exports, "buttonProperties", ()=>(0, _utilities.buttonProperties)); -parcelHelpers.export(exports, "calculatePrecision", ()=>(0, _utilities.calculatePrecision)); -parcelHelpers.export(exports, "canUseDOM", ()=>(0, _utilities.canUseDOM)); -parcelHelpers.export(exports, "classNamesFunction", ()=>(0, _utilities.classNamesFunction)); -parcelHelpers.export(exports, "colGroupProperties", ()=>(0, _utilities.colGroupProperties)); -parcelHelpers.export(exports, "colProperties", ()=>(0, _utilities.colProperties)); -parcelHelpers.export(exports, "composeComponentAs", ()=>(0, _utilities.composeComponentAs)); -parcelHelpers.export(exports, "composeRenderFunction", ()=>(0, _utilities.composeRenderFunction)); -parcelHelpers.export(exports, "createArray", ()=>(0, _utilities.createArray)); -parcelHelpers.export(exports, "createMemoizer", ()=>(0, _utilities.createMemoizer)); -parcelHelpers.export(exports, "createMergedRef", ()=>(0, _utilities.createMergedRef)); -parcelHelpers.export(exports, "css", ()=>(0, _utilities.css)); -parcelHelpers.export(exports, "customizable", ()=>(0, _utilities.customizable)); -parcelHelpers.export(exports, "disableBodyScroll", ()=>(0, _utilities.disableBodyScroll)); -parcelHelpers.export(exports, "divProperties", ()=>(0, _utilities.divProperties)); -parcelHelpers.export(exports, "doesElementContainFocus", ()=>(0, _utilities.doesElementContainFocus)); -parcelHelpers.export(exports, "elementContains", ()=>(0, _utilities.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _utilities.elementContainsAttribute)); -parcelHelpers.export(exports, "enableBodyScroll", ()=>(0, _utilities.enableBodyScroll)); -parcelHelpers.export(exports, "extendComponent", ()=>(0, _utilities.extendComponent)); -parcelHelpers.export(exports, "filteredAssign", ()=>(0, _utilities.filteredAssign)); -parcelHelpers.export(exports, "find", ()=>(0, _utilities.find)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _utilities.findElementRecursive)); -parcelHelpers.export(exports, "findIndex", ()=>(0, _utilities.findIndex)); -parcelHelpers.export(exports, "findScrollableParent", ()=>(0, _utilities.findScrollableParent)); -parcelHelpers.export(exports, "fitContentToBounds", ()=>(0, _utilities.fitContentToBounds)); -parcelHelpers.export(exports, "flatten", ()=>(0, _utilities.flatten)); -parcelHelpers.export(exports, "focusAsync", ()=>(0, _utilities.focusAsync)); -parcelHelpers.export(exports, "focusFirstChild", ()=>(0, _utilities.focusFirstChild)); -parcelHelpers.export(exports, "formProperties", ()=>(0, _utilities.formProperties)); -parcelHelpers.export(exports, "format", ()=>(0, _utilities.format)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _utilities.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _utilities.getChildren)); -parcelHelpers.export(exports, "getDistanceBetweenPoints", ()=>(0, _utilities.getDistanceBetweenPoints)); -parcelHelpers.export(exports, "getDocument", ()=>(0, _utilities.getDocument)); -parcelHelpers.export(exports, "getElementIndexPath", ()=>(0, _utilities.getElementIndexPath)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _utilities.getEventTarget)); -parcelHelpers.export(exports, "getFirstFocusable", ()=>(0, _utilities.getFirstFocusable)); -parcelHelpers.export(exports, "getFirstTabbable", ()=>(0, _utilities.getFirstTabbable)); -parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>(0, _utilities.getFirstVisibleElementFromSelector)); -parcelHelpers.export(exports, "getFocusableByIndexPath", ()=>(0, _utilities.getFocusableByIndexPath)); -parcelHelpers.export(exports, "getId", ()=>(0, _utilities.getId)); -parcelHelpers.export(exports, "getInitials", ()=>(0, _utilities.getInitials)); -parcelHelpers.export(exports, "getLanguage", ()=>(0, _utilities.getLanguage)); -parcelHelpers.export(exports, "getLastFocusable", ()=>(0, _utilities.getLastFocusable)); -parcelHelpers.export(exports, "getLastTabbable", ()=>(0, _utilities.getLastTabbable)); -parcelHelpers.export(exports, "getNativeElementProps", ()=>(0, _utilities.getNativeElementProps)); -parcelHelpers.export(exports, "getNativeProps", ()=>(0, _utilities.getNativeProps)); -parcelHelpers.export(exports, "getNextElement", ()=>(0, _utilities.getNextElement)); -parcelHelpers.export(exports, "getParent", ()=>(0, _utilities.getParent)); -parcelHelpers.export(exports, "getPreviousElement", ()=>(0, _utilities.getPreviousElement)); -parcelHelpers.export(exports, "getPropsWithDefaults", ()=>(0, _utilities.getPropsWithDefaults)); -parcelHelpers.export(exports, "getRTL", ()=>(0, _utilities.getRTL)); -parcelHelpers.export(exports, "getRTLSafeKeyCode", ()=>(0, _utilities.getRTLSafeKeyCode)); -parcelHelpers.export(exports, "getRect", ()=>(0, _utilities.getRect)); -parcelHelpers.export(exports, "getResourceUrl", ()=>(0, _utilities.getResourceUrl)); -parcelHelpers.export(exports, "getScrollbarWidth", ()=>(0, _utilities.getScrollbarWidth)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _utilities.getVirtualParent)); -parcelHelpers.export(exports, "getWindow", ()=>(0, _utilities.getWindow)); -parcelHelpers.export(exports, "hasHorizontalOverflow", ()=>(0, _utilities.hasHorizontalOverflow)); -parcelHelpers.export(exports, "hasOverflow", ()=>(0, _utilities.hasOverflow)); -parcelHelpers.export(exports, "hasVerticalOverflow", ()=>(0, _utilities.hasVerticalOverflow)); -parcelHelpers.export(exports, "hoistMethods", ()=>(0, _utilities.hoistMethods)); -parcelHelpers.export(exports, "hoistStatics", ()=>(0, _utilities.hoistStatics)); -parcelHelpers.export(exports, "htmlElementProperties", ()=>(0, _utilities.htmlElementProperties)); -parcelHelpers.export(exports, "iframeProperties", ()=>(0, _utilities.iframeProperties)); -parcelHelpers.export(exports, "imageProperties", ()=>(0, _utilities.imageProperties)); -parcelHelpers.export(exports, "imgProperties", ()=>(0, _utilities.imgProperties)); -parcelHelpers.export(exports, "initializeComponentRef", ()=>(0, _utilities.initializeComponentRef)); -parcelHelpers.export(exports, "initializeFocusRects", ()=>(0, _utilities.initializeFocusRects)); -parcelHelpers.export(exports, "inputProperties", ()=>(0, _utilities.inputProperties)); -parcelHelpers.export(exports, "isControlled", ()=>(0, _utilities.isControlled)); -parcelHelpers.export(exports, "isDirectionalKeyCode", ()=>(0, _utilities.isDirectionalKeyCode)); -parcelHelpers.export(exports, "isElementFocusSubZone", ()=>(0, _utilities.isElementFocusSubZone)); -parcelHelpers.export(exports, "isElementFocusZone", ()=>(0, _utilities.isElementFocusZone)); -parcelHelpers.export(exports, "isElementTabbable", ()=>(0, _utilities.isElementTabbable)); -parcelHelpers.export(exports, "isElementVisible", ()=>(0, _utilities.isElementVisible)); -parcelHelpers.export(exports, "isElementVisibleAndNotHidden", ()=>(0, _utilities.isElementVisibleAndNotHidden)); -parcelHelpers.export(exports, "isIE11", ()=>(0, _utilities.isIE11)); -parcelHelpers.export(exports, "isIOS", ()=>(0, _utilities.isIOS)); -parcelHelpers.export(exports, "isMac", ()=>(0, _utilities.isMac)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _utilities.isVirtualElement)); -parcelHelpers.export(exports, "labelProperties", ()=>(0, _utilities.labelProperties)); -parcelHelpers.export(exports, "liProperties", ()=>(0, _utilities.liProperties)); -parcelHelpers.export(exports, "mapEnumByName", ()=>(0, _utilities.mapEnumByName)); -parcelHelpers.export(exports, "memoize", ()=>(0, _utilities.memoize)); -parcelHelpers.export(exports, "memoizeFunction", ()=>(0, _utilities.memoizeFunction)); -parcelHelpers.export(exports, "merge", ()=>(0, _utilities.merge)); -parcelHelpers.export(exports, "mergeAriaAttributeValues", ()=>(0, _utilities.mergeAriaAttributeValues)); -parcelHelpers.export(exports, "mergeCustomizations", ()=>(0, _utilities.mergeCustomizations)); -parcelHelpers.export(exports, "mergeScopedSettings", ()=>(0, _utilities.mergeScopedSettings)); -parcelHelpers.export(exports, "mergeSettings", ()=>(0, _utilities.mergeSettings)); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>(0, _utilities.MergeStylesShadowRootProvider)); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>(0, _utilities.MergeStylesRootProvider)); -parcelHelpers.export(exports, "modalize", ()=>(0, _utilities.modalize)); -parcelHelpers.export(exports, "nullRender", ()=>(0, _utilities.nullRender)); -parcelHelpers.export(exports, "olProperties", ()=>(0, _utilities.olProperties)); -parcelHelpers.export(exports, "omit", ()=>(0, _utilities.omit)); -parcelHelpers.export(exports, "on", ()=>(0, _utilities.on)); -parcelHelpers.export(exports, "optionProperties", ()=>(0, _utilities.optionProperties)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _utilities.portalContainsElement)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _utilities.precisionRound)); -parcelHelpers.export(exports, "raiseClick", ()=>(0, _utilities.raiseClick)); -parcelHelpers.export(exports, "removeDirectionalKeyCode", ()=>(0, _utilities.removeDirectionalKeyCode)); -parcelHelpers.export(exports, "removeIndex", ()=>(0, _utilities.removeIndex)); -parcelHelpers.export(exports, "replaceElement", ()=>(0, _utilities.replaceElement)); -parcelHelpers.export(exports, "resetControlledWarnings", ()=>(0, _utilities.resetControlledWarnings)); -parcelHelpers.export(exports, "resetIds", ()=>(0, _utilities.resetIds)); -parcelHelpers.export(exports, "resetMemoizations", ()=>(0, _utilities.resetMemoizations)); -parcelHelpers.export(exports, "safeRequestAnimationFrame", ()=>(0, _utilities.safeRequestAnimationFrame)); -parcelHelpers.export(exports, "safeSetTimeout", ()=>(0, _utilities.safeSetTimeout)); -parcelHelpers.export(exports, "selectProperties", ()=>(0, _utilities.selectProperties)); -parcelHelpers.export(exports, "setBaseUrl", ()=>(0, _utilities.setBaseUrl)); -parcelHelpers.export(exports, "setFocusVisibility", ()=>(0, _utilities.setFocusVisibility)); -parcelHelpers.export(exports, "setLanguage", ()=>(0, _utilities.setLanguage)); -parcelHelpers.export(exports, "setMemoizeWeakMap", ()=>(0, _utilities.setMemoizeWeakMap)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _utilities.setPortalAttribute)); -parcelHelpers.export(exports, "setRTL", ()=>(0, _utilities.setRTL)); -parcelHelpers.export(exports, "setSSR", ()=>(0, _utilities.setSSR)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _utilities.setVirtualParent)); -parcelHelpers.export(exports, "setWarningCallback", ()=>(0, _utilities.setWarningCallback)); -parcelHelpers.export(exports, "shallowCompare", ()=>(0, _utilities.shallowCompare)); -parcelHelpers.export(exports, "shouldWrapFocus", ()=>(0, _utilities.shouldWrapFocus)); -parcelHelpers.export(exports, "styled", ()=>(0, _utilities.styled)); -parcelHelpers.export(exports, "tableProperties", ()=>(0, _utilities.tableProperties)); -parcelHelpers.export(exports, "tdProperties", ()=>(0, _utilities.tdProperties)); -parcelHelpers.export(exports, "textAreaProperties", ()=>(0, _utilities.textAreaProperties)); -parcelHelpers.export(exports, "thProperties", ()=>(0, _utilities.thProperties)); -parcelHelpers.export(exports, "toMatrix", ()=>(0, _utilities.toMatrix)); -parcelHelpers.export(exports, "trProperties", ()=>(0, _utilities.trProperties)); -parcelHelpers.export(exports, "unhoistMethods", ()=>(0, _utilities.unhoistMethods)); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>(0, _utilities.useAdoptedStylesheet)); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>(0, _utilities.useAdoptedStylesheetEx)); -parcelHelpers.export(exports, "useCustomizationSettings", ()=>(0, _utilities.useCustomizationSettings)); -parcelHelpers.export(exports, "useFocusRects", ()=>(0, _utilities.useFocusRects)); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>(0, _utilities.useHasMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>(0, _utilities.useMergeStylesHooks)); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>(0, _utilities.useMergeStylesRootStylesheets)); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>(0, _utilities.useMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useShadowConfig", ()=>(0, _utilities.useShadowConfig)); -parcelHelpers.export(exports, "useStyled", ()=>(0, _utilities.useStyled)); -parcelHelpers.export(exports, "values", ()=>(0, _utilities.values)); -parcelHelpers.export(exports, "videoProperties", ()=>(0, _utilities.videoProperties)); -parcelHelpers.export(exports, "warn", ()=>(0, _utilities.warn)); -parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>(0, _utilities.warnConditionallyRequiredProps)); -parcelHelpers.export(exports, "warnControlledUsage", ()=>(0, _utilities.warnControlledUsage)); -parcelHelpers.export(exports, "warnDeprecations", ()=>(0, _utilities.warnDeprecations)); -parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>(0, _utilities.warnMutuallyExclusive)); -var _version = require("./version"); -var _utilities = require("@fluentui/utilities"); - -},{"./version":"6kzFC","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6kzFC":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react', '8.122.1'); - -},{"@fluentui/set-version":"iqYXf"}],"iqYXf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVersion", ()=>(0, _setVersion.setVersion)); -var _setVersion = require("./setVersion"); -(0, _setVersion.setVersion)('@fluentui/set-version', '6.0.0'); - -},{"./setVersion":"TiCtO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"TiCtO":[function(require,module,exports,__globalThis) { -// A packages cache that makes sure that we don't inject the same packageName twice in the same bundle - -// this cache is local to the module closure inside this bundle -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVersion", ()=>setVersion); -var packagesCache = {}; -// Cache access to window to avoid IE11 memory leak. -var _win = undefined; -try { + return e.name = "SuppressedError", e.error = error2, e.suppressed = suppressed, e; + }; + var packagesCache = {}; + var _win = void 0; + try { _win = window; -} catch (e) { -/* no-op */ } -function setVersion(packageName, packageVersion) { - if (typeof _win !== 'undefined') { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var packages = _win.__packages__ = _win.__packages__ || {}; - // We allow either the global packages or local packages caches to invalidate so testing can - // just clear the global to set this state - if (!packages[packageName] || !packagesCache[packageName]) { - packagesCache[packageName] = packageVersion; - var versions = packages[packageName] = packages[packageName] || []; - versions.push(packageVersion); - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55bj3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Async", ()=>(0, _async.Async)); -parcelHelpers.export(exports, "AutoScroll", ()=>(0, _autoScroll.AutoScroll)); -parcelHelpers.export(exports, "BaseComponent", ()=>(0, _baseComponent.BaseComponent)); -parcelHelpers.export(exports, "nullRender", ()=>(0, _baseComponent.nullRender)); -parcelHelpers.export(exports, "DelayedRender", ()=>(0, _delayedRender.DelayedRender)); -parcelHelpers.export(exports, "EventGroup", ()=>(0, _eventGroup.EventGroup)); -parcelHelpers.export(exports, "FabricPerformance", ()=>(0, _fabricPerformance.FabricPerformance)); -parcelHelpers.export(exports, "GlobalSettings", ()=>(0, _globalSettings.GlobalSettings)); -parcelHelpers.export(exports, "KeyCodes", ()=>(0, _keyCodes.KeyCodes)); -parcelHelpers.export(exports, "Rectangle", ()=>(0, _rectangle.Rectangle)); -parcelHelpers.export(exports, "appendFunction", ()=>(0, _appendFunction.appendFunction)); -parcelHelpers.export(exports, "mergeAriaAttributeValues", ()=>(0, _aria.mergeAriaAttributeValues)); -parcelHelpers.export(exports, "addElementAtIndex", ()=>(0, _array.addElementAtIndex)); -parcelHelpers.export(exports, "arraysEqual", ()=>(0, _array.arraysEqual)); -parcelHelpers.export(exports, "createArray", ()=>(0, _array.createArray)); -parcelHelpers.export(exports, "find", ()=>(0, _array.find)); -parcelHelpers.export(exports, "findIndex", ()=>(0, _array.findIndex)); -parcelHelpers.export(exports, "flatten", ()=>(0, _array.flatten)); -parcelHelpers.export(exports, "removeIndex", ()=>(0, _array.removeIndex)); -parcelHelpers.export(exports, "replaceElement", ()=>(0, _array.replaceElement)); -parcelHelpers.export(exports, "toMatrix", ()=>(0, _array.toMatrix)); -parcelHelpers.export(exports, "asAsync", ()=>(0, _asAsync.asAsync)); -parcelHelpers.export(exports, "assertNever", ()=>(0, _assertNever.assertNever)); -parcelHelpers.export(exports, "classNamesFunction", ()=>(0, _classNamesFunction.classNamesFunction)); -parcelHelpers.export(exports, "composeComponentAs", ()=>(0, _composeComponentAs.composeComponentAs)); -parcelHelpers.export(exports, "isControlled", ()=>(0, _controlled.isControlled)); -parcelHelpers.export(exports, "css", ()=>(0, _css.css)); -parcelHelpers.export(exports, "Customizations", ()=>(0, _customizations.Customizations)); -parcelHelpers.export(exports, "Customizer", ()=>(0, _customizer.Customizer)); -parcelHelpers.export(exports, "CustomizerContext", ()=>(0, _customizerContext.CustomizerContext)); -parcelHelpers.export(exports, "customizable", ()=>(0, _customizable.customizable)); -parcelHelpers.export(exports, "useCustomizationSettings", ()=>(0, _useCustomizationSettings.useCustomizationSettings)); -parcelHelpers.export(exports, "mergeCustomizations", ()=>(0, _mergeCustomizations.mergeCustomizations)); -parcelHelpers.export(exports, "mergeScopedSettings", ()=>(0, _mergeSettings.mergeScopedSettings)); -parcelHelpers.export(exports, "mergeSettings", ()=>(0, _mergeSettings.mergeSettings)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _dom.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "elementContains", ()=>(0, _dom.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _dom.elementContainsAttribute)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _dom.findElementRecursive)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _dom.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _dom.getChildren)); -parcelHelpers.export(exports, "getDocument", ()=>(0, _dom.getDocument)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _dom.getEventTarget)); -parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>(0, _dom.getFirstVisibleElementFromSelector)); -parcelHelpers.export(exports, "getParent", ()=>(0, _dom.getParent)); -parcelHelpers.export(exports, "getRect", ()=>(0, _dom.getRect)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _dom.getVirtualParent)); -parcelHelpers.export(exports, "getWindow", ()=>(0, _dom.getWindow)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _dom.isVirtualElement)); -parcelHelpers.export(exports, "on", ()=>(0, _dom.on)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _dom.portalContainsElement)); -parcelHelpers.export(exports, "raiseClick", ()=>(0, _dom.raiseClick)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _dom.setPortalAttribute)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _dom.setVirtualParent)); -parcelHelpers.export(exports, "extendComponent", ()=>(0, _extendComponent.extendComponent)); -parcelHelpers.export(exports, "doesElementContainFocus", ()=>(0, _focus.doesElementContainFocus)); -parcelHelpers.export(exports, "focusAsync", ()=>(0, _focus.focusAsync)); -parcelHelpers.export(exports, "focusFirstChild", ()=>(0, _focus.focusFirstChild)); -parcelHelpers.export(exports, "getElementIndexPath", ()=>(0, _focus.getElementIndexPath)); -parcelHelpers.export(exports, "getFirstFocusable", ()=>(0, _focus.getFirstFocusable)); -parcelHelpers.export(exports, "getFirstTabbable", ()=>(0, _focus.getFirstTabbable)); -parcelHelpers.export(exports, "getFocusableByIndexPath", ()=>(0, _focus.getFocusableByIndexPath)); -parcelHelpers.export(exports, "getLastFocusable", ()=>(0, _focus.getLastFocusable)); -parcelHelpers.export(exports, "getLastTabbable", ()=>(0, _focus.getLastTabbable)); -parcelHelpers.export(exports, "getNextElement", ()=>(0, _focus.getNextElement)); -parcelHelpers.export(exports, "getPreviousElement", ()=>(0, _focus.getPreviousElement)); -parcelHelpers.export(exports, "isElementFocusSubZone", ()=>(0, _focus.isElementFocusSubZone)); -parcelHelpers.export(exports, "isElementFocusZone", ()=>(0, _focus.isElementFocusZone)); -parcelHelpers.export(exports, "isElementTabbable", ()=>(0, _focus.isElementTabbable)); -parcelHelpers.export(exports, "isElementVisible", ()=>(0, _focus.isElementVisible)); -parcelHelpers.export(exports, "isElementVisibleAndNotHidden", ()=>(0, _focus.isElementVisibleAndNotHidden)); -parcelHelpers.export(exports, "shouldWrapFocus", ()=>(0, _focus.shouldWrapFocus)); -parcelHelpers.export(exports, "getId", ()=>(0, _getId.getId)); -parcelHelpers.export(exports, "resetIds", ()=>(0, _getId.resetIds)); -parcelHelpers.export(exports, "getNativeElementProps", ()=>(0, _getNativeElementProps.getNativeElementProps)); -parcelHelpers.export(exports, "hoistMethods", ()=>(0, _hoist.hoistMethods)); -parcelHelpers.export(exports, "unhoistMethods", ()=>(0, _hoist.unhoistMethods)); -parcelHelpers.export(exports, "hoistStatics", ()=>(0, _hoistStatics.hoistStatics)); -parcelHelpers.export(exports, "initializeComponentRef", ()=>(0, _initializeComponentRef.initializeComponentRef)); -parcelHelpers.export(exports, "initializeFocusRects", ()=>(0, _initializeFocusRects.initializeFocusRects)); -parcelHelpers.export(exports, "FocusRectsProvider", ()=>(0, _focusRectsProvider.FocusRectsProvider)); -parcelHelpers.export(exports, "FocusRects", ()=>(0, _useFocusRects.FocusRects)); -parcelHelpers.export(exports, "FocusRectsContext", ()=>(0, _useFocusRects.FocusRectsContext)); -parcelHelpers.export(exports, "useFocusRects", ()=>(0, _useFocusRects.useFocusRects)); -parcelHelpers.export(exports, "getInitials", ()=>(0, _initials.getInitials)); -parcelHelpers.export(exports, "addDirectionalKeyCode", ()=>(0, _keyboard.addDirectionalKeyCode)); -parcelHelpers.export(exports, "isDirectionalKeyCode", ()=>(0, _keyboard.isDirectionalKeyCode)); -parcelHelpers.export(exports, "removeDirectionalKeyCode", ()=>(0, _keyboard.removeDirectionalKeyCode)); -parcelHelpers.export(exports, "getLanguage", ()=>(0, _language.getLanguage)); -parcelHelpers.export(exports, "setLanguage", ()=>(0, _language.setLanguage)); -parcelHelpers.export(exports, "calculatePrecision", ()=>(0, _math.calculatePrecision)); -parcelHelpers.export(exports, "fitContentToBounds", ()=>(0, _math.fitContentToBounds)); -parcelHelpers.export(exports, "getDistanceBetweenPoints", ()=>(0, _math.getDistanceBetweenPoints)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _math.precisionRound)); -parcelHelpers.export(exports, "createMemoizer", ()=>(0, _memoize.createMemoizer)); -parcelHelpers.export(exports, "memoize", ()=>(0, _memoize.memoize)); -parcelHelpers.export(exports, "memoizeFunction", ()=>(0, _memoize.memoizeFunction)); -parcelHelpers.export(exports, "resetMemoizations", ()=>(0, _memoize.resetMemoizations)); -parcelHelpers.export(exports, "setMemoizeWeakMap", ()=>(0, _memoize.setMemoizeWeakMap)); -parcelHelpers.export(exports, "merge", ()=>(0, _merge.merge)); -parcelHelpers.export(exports, "isIOS", ()=>(0, _mobileDetector.isIOS)); -parcelHelpers.export(exports, "modalize", ()=>(0, _modalize.modalize)); -parcelHelpers.export(exports, "assign", ()=>(0, _object.assign)); -parcelHelpers.export(exports, "filteredAssign", ()=>(0, _object.filteredAssign)); -parcelHelpers.export(exports, "mapEnumByName", ()=>(0, _object.mapEnumByName)); -parcelHelpers.export(exports, "shallowCompare", ()=>(0, _object.shallowCompare)); -parcelHelpers.export(exports, "values", ()=>(0, _object.values)); -parcelHelpers.export(exports, "omit", ()=>(0, _object.omit)); -parcelHelpers.export(exports, "isMac", ()=>(0, _osDetector.isMac)); -parcelHelpers.export(exports, "hasHorizontalOverflow", ()=>(0, _overflow.hasHorizontalOverflow)); -parcelHelpers.export(exports, "hasOverflow", ()=>(0, _overflow.hasOverflow)); -parcelHelpers.export(exports, "hasVerticalOverflow", ()=>(0, _overflow.hasVerticalOverflow)); -parcelHelpers.export(exports, "anchorProperties", ()=>(0, _properties.anchorProperties)); -parcelHelpers.export(exports, "audioProperties", ()=>(0, _properties.audioProperties)); -parcelHelpers.export(exports, "baseElementEvents", ()=>(0, _properties.baseElementEvents)); -parcelHelpers.export(exports, "baseElementProperties", ()=>(0, _properties.baseElementProperties)); -parcelHelpers.export(exports, "buttonProperties", ()=>(0, _properties.buttonProperties)); -parcelHelpers.export(exports, "colGroupProperties", ()=>(0, _properties.colGroupProperties)); -parcelHelpers.export(exports, "colProperties", ()=>(0, _properties.colProperties)); -parcelHelpers.export(exports, "divProperties", ()=>(0, _properties.divProperties)); -parcelHelpers.export(exports, "formProperties", ()=>(0, _properties.formProperties)); -parcelHelpers.export(exports, "getNativeProps", ()=>(0, _properties.getNativeProps)); -parcelHelpers.export(exports, "htmlElementProperties", ()=>(0, _properties.htmlElementProperties)); -parcelHelpers.export(exports, "iframeProperties", ()=>(0, _properties.iframeProperties)); -parcelHelpers.export(exports, "imageProperties", ()=>(0, _properties.imageProperties)); -parcelHelpers.export(exports, "imgProperties", ()=>(0, _properties.imgProperties)); -parcelHelpers.export(exports, "inputProperties", ()=>(0, _properties.inputProperties)); -parcelHelpers.export(exports, "labelProperties", ()=>(0, _properties.labelProperties)); -parcelHelpers.export(exports, "liProperties", ()=>(0, _properties.liProperties)); -parcelHelpers.export(exports, "olProperties", ()=>(0, _properties.olProperties)); -parcelHelpers.export(exports, "optionProperties", ()=>(0, _properties.optionProperties)); -parcelHelpers.export(exports, "selectProperties", ()=>(0, _properties.selectProperties)); -parcelHelpers.export(exports, "tableProperties", ()=>(0, _properties.tableProperties)); -parcelHelpers.export(exports, "tdProperties", ()=>(0, _properties.tdProperties)); -parcelHelpers.export(exports, "textAreaProperties", ()=>(0, _properties.textAreaProperties)); -parcelHelpers.export(exports, "thProperties", ()=>(0, _properties.thProperties)); -parcelHelpers.export(exports, "trProperties", ()=>(0, _properties.trProperties)); -parcelHelpers.export(exports, "videoProperties", ()=>(0, _properties.videoProperties)); -parcelHelpers.export(exports, "composeRenderFunction", ()=>(0, _composeRenderFunction.composeRenderFunction)); -parcelHelpers.export(exports, "getResourceUrl", ()=>(0, _resources.getResourceUrl)); -parcelHelpers.export(exports, "setBaseUrl", ()=>(0, _resources.setBaseUrl)); -parcelHelpers.export(exports, "getRTL", ()=>(0, _rtl.getRTL)); -parcelHelpers.export(exports, "getRTLSafeKeyCode", ()=>(0, _rtl.getRTLSafeKeyCode)); -parcelHelpers.export(exports, "setRTL", ()=>(0, _rtl.setRTL)); -parcelHelpers.export(exports, "safeRequestAnimationFrame", ()=>(0, _safeRequestAnimationFrame.safeRequestAnimationFrame)); -parcelHelpers.export(exports, "safeSetTimeout", ()=>(0, _safeSetTimeout.safeSetTimeout)); -parcelHelpers.export(exports, "DATA_IS_SCROLLABLE_ATTRIBUTE", ()=>(0, _scroll.DATA_IS_SCROLLABLE_ATTRIBUTE)); -parcelHelpers.export(exports, "allowOverscrollOnElement", ()=>(0, _scroll.allowOverscrollOnElement)); -parcelHelpers.export(exports, "allowScrollOnElement", ()=>(0, _scroll.allowScrollOnElement)); -parcelHelpers.export(exports, "disableBodyScroll", ()=>(0, _scroll.disableBodyScroll)); -parcelHelpers.export(exports, "enableBodyScroll", ()=>(0, _scroll.enableBodyScroll)); -parcelHelpers.export(exports, "findScrollableParent", ()=>(0, _scroll.findScrollableParent)); -parcelHelpers.export(exports, "getScrollbarWidth", ()=>(0, _scroll.getScrollbarWidth)); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>(0, _index.SELECTION_CHANGE)); -parcelHelpers.export(exports, "SELECTION_ITEMS_CHANGE", ()=>(0, _index.SELECTION_ITEMS_CHANGE)); -parcelHelpers.export(exports, "Selection", ()=>(0, _index.Selection)); -parcelHelpers.export(exports, "SelectionDirection", ()=>(0, _index.SelectionDirection)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _index.SelectionMode)); -parcelHelpers.export(exports, "format", ()=>(0, _string.format)); -parcelHelpers.export(exports, "styled", ()=>(0, _styled.styled)); -parcelHelpers.export(exports, "resetControlledWarnings", ()=>(0, _warn.resetControlledWarnings)); -parcelHelpers.export(exports, "setWarningCallback", ()=>(0, _warn.setWarningCallback)); -parcelHelpers.export(exports, "warn", ()=>(0, _warn.warn)); -parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>(0, _warn.warnConditionallyRequiredProps)); -parcelHelpers.export(exports, "warnControlledUsage", ()=>(0, _warn.warnControlledUsage)); -parcelHelpers.export(exports, "warnDeprecations", ()=>(0, _warn.warnDeprecations)); -parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>(0, _warn.warnMutuallyExclusive)); -parcelHelpers.export(exports, "isIE11", ()=>(0, _ie11Detector.isIE11)); -parcelHelpers.export(exports, "getPropsWithDefaults", ()=>(0, _getPropsWithDefaults.getPropsWithDefaults)); -parcelHelpers.export(exports, "setFocusVisibility", ()=>(0, _setFocusVisibility.setFocusVisibility)); -parcelHelpers.export(exports, "IsFocusVisibleClassName", ()=>(0, _setFocusVisibility.IsFocusVisibleClassName)); -parcelHelpers.export(exports, "canUseDOM", ()=>(0, _canUseDOM.canUseDOM)); -// eslint-disable-next-line deprecation/deprecation -parcelHelpers.export(exports, "setSSR", ()=>(0, _setSSR.setSSR)); -parcelHelpers.export(exports, "createMergedRef", ()=>(0, _createMergedRef.createMergedRef)); -parcelHelpers.export(exports, "useIsomorphicLayoutEffect", ()=>(0, _useIsomorphicLayoutEffect.useIsomorphicLayoutEffect)); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>(0, _shadowDom.MergeStylesRootProvider)); -parcelHelpers.export(exports, "MergeStylesShadowRootContext", ()=>(0, _shadowDom.MergeStylesShadowRootContext)); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>(0, _shadowDom.MergeStylesShadowRootProvider)); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>(0, _shadowDom.useAdoptedStylesheet)); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>(0, _shadowDom.useAdoptedStylesheetEx)); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>(0, _shadowDom.useHasMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>(0, _shadowDom.useMergeStylesHooks)); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>(0, _shadowDom.useMergeStylesRootStylesheets)); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>(0, _shadowDom.useMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useShadowConfig", ()=>(0, _shadowDom.useShadowConfig)); -parcelHelpers.export(exports, "useStyled", ()=>(0, _shadowDom.useStyled)); -var _async = require("./Async"); -var _autoScroll = require("./AutoScroll"); -var _baseComponent = require("./BaseComponent"); -var _delayedRender = require("./DelayedRender"); -var _eventGroup = require("./EventGroup"); -var _fabricPerformance = require("./FabricPerformance"); -var _globalSettings = require("./GlobalSettings"); -var _keyCodes = require("./KeyCodes"); -var _rectangle = require("./Rectangle"); -var _appendFunction = require("./appendFunction"); -var _aria = require("./aria"); -var _array = require("./array"); -var _asAsync = require("./asAsync"); -var _assertNever = require("./assertNever"); -var _classNamesFunction = require("./classNamesFunction"); -var _composeComponentAs = require("./componentAs/composeComponentAs"); -var _controlled = require("./controlled"); -var _css = require("./css"); -var _customizations = require("./customizations/Customizations"); -var _customizer = require("./customizations/Customizer"); -var _customizerContext = require("./customizations/CustomizerContext"); -var _customizable = require("./customizations/customizable"); -var _useCustomizationSettings = require("./customizations/useCustomizationSettings"); -var _mergeCustomizations = require("./customizations/mergeCustomizations"); -var _mergeSettings = require("./customizations/mergeSettings"); -var _dom = require("./dom"); -var _extendComponent = require("./extendComponent"); -var _focus = require("./focus"); -var _getId = require("./getId"); -var _getNativeElementProps = require("./getNativeElementProps"); -var _hoist = require("./hoist"); -var _hoistStatics = require("./hoistStatics"); -var _initializeComponentRef = require("./initializeComponentRef"); -var _initializeFocusRects = require("./initializeFocusRects"); -var _focusRectsProvider = require("./FocusRectsProvider"); -var _useFocusRects = require("./useFocusRects"); -var _initials = require("./initials"); -var _keyboard = require("./keyboard"); -var _language = require("./language"); -var _math = require("./math"); -var _memoize = require("./memoize"); -var _merge = require("./merge"); -var _mobileDetector = require("./mobileDetector"); -var _modalize = require("./modalize"); -var _object = require("./object"); -var _osDetector = require("./osDetector"); -var _overflow = require("./overflow"); -var _properties = require("./properties"); -var _composeRenderFunction = require("./renderFunction/composeRenderFunction"); -var _resources = require("./resources"); -var _rtl = require("./rtl"); -var _safeRequestAnimationFrame = require("./safeRequestAnimationFrame"); -var _safeSetTimeout = require("./safeSetTimeout"); -var _scroll = require("./scroll"); -var _index = require("./selection/index"); -var _string = require("./string"); -var _styled = require("./styled"); -var _warn = require("./warn"); -var _ie11Detector = require("./ie11Detector"); -var _getPropsWithDefaults = require("./getPropsWithDefaults"); -var _setFocusVisibility = require("./setFocusVisibility"); -var _canUseDOM = require("./dom/canUseDOM"); -var _setSSR = require("./dom/setSSR"); -var _createMergedRef = require("./createMergedRef"); -var _useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect"); -var _version = require("./version"); -var _shadowDom = require("./shadowDom"); - -},{"./Async":"bcsew","./AutoScroll":"etMgU","./BaseComponent":"iLCoe","./DelayedRender":"jKQeJ","./EventGroup":"0TvPH","./FabricPerformance":"hiYVs","./GlobalSettings":"6x3RK","./KeyCodes":"eQoHk","./Rectangle":"hkyht","./appendFunction":"8Ic5h","./aria":"2p7Pt","./array":"1Pspi","./asAsync":"jPOCb","./assertNever":"l66AW","./classNamesFunction":"lKbNl","./componentAs/composeComponentAs":"7HNhY","./controlled":"5Lj2y","./css":"dmVvk","./customizations/Customizations":"eQS4T","./customizations/Customizer":"5lXfh","./customizations/CustomizerContext":"aB8eN","./customizations/customizable":"7RolT","./customizations/useCustomizationSettings":"hUUmS","./customizations/mergeCustomizations":"yo2of","./customizations/mergeSettings":"c4Gl8","./dom":"QMA5I","./extendComponent":"iAatf","./focus":"vgfwi","./getId":"kDauC","./getNativeElementProps":"iMQBc","./hoist":"49HjY","./hoistStatics":"4OPmM","./initializeComponentRef":"8tu37","./initializeFocusRects":"lLcL3","./FocusRectsProvider":"7Mxbq","./useFocusRects":"hYOqE","./initials":"6G2ZZ","./keyboard":"1QqA5","./language":"7welB","./math":"9UcDS","./memoize":"cqPyR","./merge":"43b5Z","./mobileDetector":"9ucFx","./modalize":"8iyQK","./object":"celWf","./osDetector":"fxaey","./overflow":"gxEfk","./properties":"hUmZ9","./renderFunction/composeRenderFunction":"hnUBo","./resources":"bTWnR","./rtl":"gRlx4","./safeRequestAnimationFrame":"ghqZY","./safeSetTimeout":"2wmgr","./scroll":"c99qU","./selection/index":"hAgvp","./string":"996Ia","./styled":"bwELv","./warn":"dpie2","./ie11Detector":"c5nmJ","./getPropsWithDefaults":"lBZmc","./setFocusVisibility":"2d3GF","./dom/canUseDOM":"iFHeV","./dom/setSSR":"6DBuh","./createMergedRef":"e5kFM","./useIsomorphicLayoutEffect":"88Q1R","./version":"e49Gp","./shadowDom":"dU66z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bcsew":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Async", ()=>Async); -var _getWindow = require("./dom/getWindow"); -/** - * Bugs often appear in async code when stuff gets disposed, but async operations don't get canceled. - * This Async helper class solves these issues by tying async code to the lifetime of a disposable object. - * - * Usage: Anything class extending from BaseModel can access this helper via this.async. Otherwise create a - * new instance of the class and remember to call dispose() during your code's dispose handler. - * - * @public - */ var Async = /** @class */ function() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - function Async(parent, onError) { + } catch (e) { + } + function setVersion(packageName, packageVersion) { + if (typeof _win !== "undefined") { + var packages = _win.__packages__ = _win.__packages__ || {}; + if (!packages[packageName] || !packagesCache[packageName]) { + packagesCache[packageName] = packageVersion; + var versions = packages[packageName] = packages[packageName] || []; + versions.push(packageVersion); + } + } + } + setVersion("@fluentui/set-version", "6.0.0"); + function canUseDOM() { + return ( + // eslint-disable-next-line no-restricted-globals + typeof window !== "undefined" && !!// eslint-disable-next-line no-restricted-globals, @typescript-eslint/no-deprecated + (window.document && window.document.createElement) + ); + } + var _window$1 = void 0; + try { + _window$1 = window; + } catch (e) { + } + function getWindow(rootElement) { + if (!canUseDOM() || typeof _window$1 === "undefined") { + return void 0; + } else { + var el = rootElement; + return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window$1; + } + } + var Async = ( + /** @class */ + (function() { + function Async2(parent, onError) { this._timeoutIds = null; this._immediateIds = null; this._intervalIds = null; @@ -63432,216 +36034,185 @@ var _getWindow = require("./dom/getWindow"); this._parent = parent || null; this._onErrorHandler = onError; this._noop = function() { - /* do nothing */ }; - } - /** - * Dispose function, clears all async operations. - */ Async.prototype.dispose = function() { - var id; + }; + } + Async2.prototype.dispose = function() { + var id2; this._isDisposed = true; this._parent = null; - // Clear timeouts. if (this._timeoutIds) { - for(id in this._timeoutIds)if (this._timeoutIds.hasOwnProperty(id)) this.clearTimeout(parseInt(id, 10)); - this._timeoutIds = null; + for (id2 in this._timeoutIds) { + if (this._timeoutIds.hasOwnProperty(id2)) { + this.clearTimeout(parseInt(id2, 10)); + } + } + this._timeoutIds = null; } - // Clear immediates. if (this._immediateIds) { - for(id in this._immediateIds)if (this._immediateIds.hasOwnProperty(id)) this.clearImmediate(parseInt(id, 10)); - this._immediateIds = null; + for (id2 in this._immediateIds) { + if (this._immediateIds.hasOwnProperty(id2)) { + this.clearImmediate(parseInt(id2, 10)); + } + } + this._immediateIds = null; } - // Clear intervals. if (this._intervalIds) { - for(id in this._intervalIds)if (this._intervalIds.hasOwnProperty(id)) this.clearInterval(parseInt(id, 10)); - this._intervalIds = null; + for (id2 in this._intervalIds) { + if (this._intervalIds.hasOwnProperty(id2)) { + this.clearInterval(parseInt(id2, 10)); + } + } + this._intervalIds = null; } - // Clear animation frames. if (this._animationFrameIds) { - for(id in this._animationFrameIds)if (this._animationFrameIds.hasOwnProperty(id)) this.cancelAnimationFrame(parseInt(id, 10)); - this._animationFrameIds = null; + for (id2 in this._animationFrameIds) { + if (this._animationFrameIds.hasOwnProperty(id2)) { + this.cancelAnimationFrame(parseInt(id2, 10)); + } + } + this._animationFrameIds = null; } - }; - /** - * SetTimeout override, which will auto cancel the timeout during dispose. - * @param callback - Callback to execute. - * @param duration - Duration in milliseconds. - * @returns The setTimeout id. - */ Async.prototype.setTimeout = function(callback, duration) { + }; + Async2.prototype.setTimeout = function(callback, duration) { var _this = this; var timeoutId = 0; if (!this._isDisposed) { - if (!this._timeoutIds) this._timeoutIds = {}; - timeoutId = setTimeout(function() { - // Time to execute the timeout, enqueue it as a foreground task to be executed. - try { - // Now delete the record and call the callback. - if (_this._timeoutIds) delete _this._timeoutIds[timeoutId]; - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }, duration); - this._timeoutIds[timeoutId] = true; + if (!this._timeoutIds) { + this._timeoutIds = {}; + } + timeoutId = setTimeout(function() { + try { + if (_this._timeoutIds) { + delete _this._timeoutIds[timeoutId]; + } + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }, duration); + this._timeoutIds[timeoutId] = true; } return timeoutId; - }; - /** - * Clears the timeout. - * @param id - Id to cancel. - */ Async.prototype.clearTimeout = function(id) { - if (this._timeoutIds && this._timeoutIds[id]) { - clearTimeout(id); - delete this._timeoutIds[id]; - } - }; - /** - * SetImmediate override, which will auto cancel the immediate during dispose. - * @param callback - Callback to execute. - * @param targetElement - Optional target element to use for identifying the correct window. - * @returns The setTimeout id. - */ Async.prototype.setImmediate = function(callback, targetElement) { + }; + Async2.prototype.clearTimeout = function(id2) { + if (this._timeoutIds && this._timeoutIds[id2]) { + clearTimeout(id2); + delete this._timeoutIds[id2]; + } + }; + Async2.prototype.setImmediate = function(callback, targetElement) { var _this = this; var immediateId = 0; - var win = (0, _getWindow.getWindow)(targetElement); + var win = getWindow(targetElement); if (!this._isDisposed) { - if (!this._immediateIds) this._immediateIds = {}; - var setImmediateCallback = function() { - // Time to execute the timeout, enqueue it as a foreground task to be executed. - try { - // Now delete the record and call the callback. - if (_this._immediateIds) delete _this._immediateIds[immediateId]; - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }; - immediateId = win.setTimeout(setImmediateCallback, 0); - this._immediateIds[immediateId] = true; + if (!this._immediateIds) { + this._immediateIds = {}; + } + var setImmediateCallback = function() { + try { + if (_this._immediateIds) { + delete _this._immediateIds[immediateId]; + } + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }; + immediateId = win.setTimeout(setImmediateCallback, 0); + this._immediateIds[immediateId] = true; } return immediateId; - }; - /** - * Clears the immediate. - * @param id - Id to cancel. - * @param targetElement - Optional target element to use for identifying the correct window. - */ Async.prototype.clearImmediate = function(id, targetElement) { - var win = (0, _getWindow.getWindow)(targetElement); - if (this._immediateIds && this._immediateIds[id]) { - win.clearTimeout(id); - delete this._immediateIds[id]; - } - }; - /** - * SetInterval override, which will auto cancel the timeout during dispose. - * @param callback - Callback to execute. - * @param duration - Duration in milliseconds. - * @returns The setTimeout id. - */ Async.prototype.setInterval = function(callback, duration) { + }; + Async2.prototype.clearImmediate = function(id2, targetElement) { + var win = getWindow(targetElement); + if (this._immediateIds && this._immediateIds[id2]) { + win.clearTimeout(id2); + delete this._immediateIds[id2]; + } + }; + Async2.prototype.setInterval = function(callback, duration) { var _this = this; var intervalId = 0; if (!this._isDisposed) { - if (!this._intervalIds) this._intervalIds = {}; - intervalId = setInterval(function() { - // Time to execute the interval callback, enqueue it as a foreground task to be executed. - try { - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }, duration); - this._intervalIds[intervalId] = true; + if (!this._intervalIds) { + this._intervalIds = {}; + } + intervalId = setInterval(function() { + try { + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }, duration); + this._intervalIds[intervalId] = true; } return intervalId; - }; - /** - * Clears the interval. - * @param id - Id to cancel. - */ Async.prototype.clearInterval = function(id) { - if (this._intervalIds && this._intervalIds[id]) { - clearInterval(id); - delete this._intervalIds[id]; - } - }; - /** - * Creates a function that, when executed, will only call the func function at most once per - * every wait milliseconds. Provide an options object to indicate that func should be invoked - * on the leading and/or trailing edge of the wait timeout. Subsequent calls to the throttled - * function will return the result of the last func call. - * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the throttled function is invoked more than once during the wait timeout. - * - * @param func - The function to throttle. - * @param wait - The number of milliseconds to throttle executions to. Defaults to 0. - * @param options - The options object. - * @returns The new throttled function. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - Async.prototype.throttle = function(func, wait, options) { + }; + Async2.prototype.clearInterval = function(id2) { + if (this._intervalIds && this._intervalIds[id2]) { + clearInterval(id2); + delete this._intervalIds[id2]; + } + }; + Async2.prototype.throttle = function(func, wait, options2) { var _this = this; - if (this._isDisposed) return this._noop; + if (this._isDisposed) { + return this._noop; + } var waitMS = wait || 0; var leading = true; var trailing = true; var lastExecuteTime = 0; var lastResult; - // eslint-disable-next-line @typescript-eslint/no-explicit-any var lastArgs; var timeoutId = null; - if (options && typeof options.leading === 'boolean') leading = options.leading; - if (options && typeof options.trailing === 'boolean') trailing = options.trailing; + if (options2 && typeof options2.leading === "boolean") { + leading = options2.leading; + } + if (options2 && typeof options2.trailing === "boolean") { + trailing = options2.trailing; + } var callback = function(userCall) { - var now = Date.now(); - var delta = now - lastExecuteTime; - var waitLength = leading ? waitMS - delta : waitMS; - if (delta >= waitMS && (!userCall || leading)) { - lastExecuteTime = now; - if (timeoutId) { - _this.clearTimeout(timeoutId); - timeoutId = null; - } - lastResult = func.apply(_this._parent, lastArgs); - } else if (timeoutId === null && trailing) timeoutId = _this.setTimeout(callback, waitLength); - return lastResult; - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var resultFunction = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - lastArgs = args; - return callback(true); - }; + var now2 = Date.now(); + var delta = now2 - lastExecuteTime; + var waitLength = leading ? waitMS - delta : waitMS; + if (delta >= waitMS && (!userCall || leading)) { + lastExecuteTime = now2; + if (timeoutId) { + _this.clearTimeout(timeoutId); + timeoutId = null; + } + lastResult = func.apply(_this._parent, lastArgs); + } else if (timeoutId === null && trailing) { + timeoutId = _this.setTimeout(callback, waitLength); + } + return lastResult; + }; + var resultFunction = (function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + lastArgs = args; + return callback(true); + }); return resultFunction; - }; - /** - * Creates a function that will delay the execution of func until after wait milliseconds have - * elapsed since the last time it was invoked. Provide an options object to indicate that func - * should be invoked on the leading and/or trailing edge of the wait timeout. Subsequent calls - * to the debounced function will return the result of the last func call. - * - * Note: If leading and trailing options are true func will be called on the trailing edge of - * the timeout only if the debounced function is invoked more than once during the wait - * timeout. - * - * @param func - The function to debounce. - * @param wait - The number of milliseconds to delay. - * @param options - The options object. - * @returns The new debounced function. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - Async.prototype.debounce = function(func, wait, options) { + }; + Async2.prototype.debounce = function(func, wait, options2) { var _this = this; if (this._isDisposed) { - var noOpFunction = function() { - /** Do nothing */ }; - noOpFunction.cancel = function() { - return; - }; - noOpFunction.flush = function() { - return null; - }; - noOpFunction.pending = function() { - return false; - }; - return noOpFunction; + var noOpFunction = (function() { + }); + noOpFunction.cancel = function() { + return; + }; + noOpFunction.flush = (function() { + return null; + }); + noOpFunction.pending = function() { + return false; + }; + return noOpFunction; } var waitMS = wait || 0; var leading = false; @@ -63650,1668 +36221,806 @@ var _getWindow = require("./dom/getWindow"); var lastCallTime = 0; var lastExecuteTime = Date.now(); var lastResult; - // eslint-disable-next-line @typescript-eslint/no-explicit-any var lastArgs; var timeoutId = null; - if (options && typeof options.leading === 'boolean') leading = options.leading; - if (options && typeof options.trailing === 'boolean') trailing = options.trailing; - if (options && typeof options.maxWait === 'number' && !isNaN(options.maxWait)) maxWait = options.maxWait; - var markExecuted = function(time) { - if (timeoutId) { - _this.clearTimeout(timeoutId); - timeoutId = null; - } - lastExecuteTime = time; + if (options2 && typeof options2.leading === "boolean") { + leading = options2.leading; + } + if (options2 && typeof options2.trailing === "boolean") { + trailing = options2.trailing; + } + if (options2 && typeof options2.maxWait === "number" && !isNaN(options2.maxWait)) { + maxWait = options2.maxWait; + } + var markExecuted = function(time2) { + if (timeoutId) { + _this.clearTimeout(timeoutId); + timeoutId = null; + } + lastExecuteTime = time2; }; - var invokeFunction = function(time) { - markExecuted(time); - lastResult = func.apply(_this._parent, lastArgs); + var invokeFunction = function(time2) { + markExecuted(time2); + lastResult = func.apply(_this._parent, lastArgs); }; var callback = function(userCall) { - var now = Date.now(); - var executeImmediately = false; - if (userCall) { - if (leading && now - lastCallTime >= waitMS) executeImmediately = true; - lastCallTime = now; - } - var delta = now - lastCallTime; - var waitLength = waitMS - delta; - var maxWaitDelta = now - lastExecuteTime; - var maxWaitExpired = false; - if (maxWait !== null) { - // maxWait only matters when there is a pending callback - if (maxWaitDelta >= maxWait && timeoutId) maxWaitExpired = true; - else waitLength = Math.min(waitLength, maxWait - maxWaitDelta); + var now2 = Date.now(); + var executeImmediately = false; + if (userCall) { + if (leading && now2 - lastCallTime >= waitMS) { + executeImmediately = true; + } + lastCallTime = now2; + } + var delta = now2 - lastCallTime; + var waitLength = waitMS - delta; + var maxWaitDelta = now2 - lastExecuteTime; + var maxWaitExpired = false; + if (maxWait !== null) { + if (maxWaitDelta >= maxWait && timeoutId) { + maxWaitExpired = true; + } else { + waitLength = Math.min(waitLength, maxWait - maxWaitDelta); } - if (delta >= waitMS || maxWaitExpired || executeImmediately) invokeFunction(now); - else if ((timeoutId === null || !userCall) && trailing) timeoutId = _this.setTimeout(callback, waitLength); - return lastResult; + } + if (delta >= waitMS || maxWaitExpired || executeImmediately) { + invokeFunction(now2); + } else if ((timeoutId === null || !userCall) && trailing) { + timeoutId = _this.setTimeout(callback, waitLength); + } + return lastResult; }; var pending = function() { - return !!timeoutId; + return !!timeoutId; }; var cancel = function() { - if (pending()) // Mark the debounced function as having executed + if (pending()) { markExecuted(Date.now()); - }; - var flush = function() { - if (pending()) invokeFunction(Date.now()); - return lastResult; - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var resultFunction = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - lastArgs = args; - return callback(true); - }; + } + }; + var flush2 = function() { + if (pending()) { + invokeFunction(Date.now()); + } + return lastResult; + }; + var resultFunction = (function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + lastArgs = args; + return callback(true); + }); resultFunction.cancel = cancel; - resultFunction.flush = flush; + resultFunction.flush = flush2; resultFunction.pending = pending; return resultFunction; - }; - Async.prototype.requestAnimationFrame = function(callback, targetElement) { + }; + Async2.prototype.requestAnimationFrame = function(callback, targetElement) { var _this = this; var animationFrameId = 0; - var win = (0, _getWindow.getWindow)(targetElement); + var win = getWindow(targetElement); if (!this._isDisposed) { - if (!this._animationFrameIds) this._animationFrameIds = {}; - var animationFrameCallback = function() { - try { - // Now delete the record and call the callback. - if (_this._animationFrameIds) delete _this._animationFrameIds[animationFrameId]; - callback.apply(_this._parent); - } catch (e) { - _this._logError(e); - } - }; - animationFrameId = win.requestAnimationFrame ? win.requestAnimationFrame(animationFrameCallback) : win.setTimeout(animationFrameCallback, 0); - this._animationFrameIds[animationFrameId] = true; + if (!this._animationFrameIds) { + this._animationFrameIds = {}; + } + var animationFrameCallback = function() { + try { + if (_this._animationFrameIds) { + delete _this._animationFrameIds[animationFrameId]; + } + callback.apply(_this._parent); + } catch (e) { + _this._logError(e); + } + }; + animationFrameId = win.requestAnimationFrame ? win.requestAnimationFrame(animationFrameCallback) : win.setTimeout(animationFrameCallback, 0); + this._animationFrameIds[animationFrameId] = true; } return animationFrameId; - }; - Async.prototype.cancelAnimationFrame = function(id, targetElement) { - var win = (0, _getWindow.getWindow)(targetElement); - if (this._animationFrameIds && this._animationFrameIds[id]) { - win.cancelAnimationFrame ? win.cancelAnimationFrame(id) : win.clearTimeout(id); - delete this._animationFrameIds[id]; - } - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Async.prototype._logError = function(e) { - if (this._onErrorHandler) this._onErrorHandler(e); - }; - return Async; -}(); - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aI1a8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to get the window object. The helper will make sure to use a cached variable - * of "window", to avoid overhead and memory leaks in IE11. Note that in popup scenarios the - * window object won't match the "global" window object, and for these scenarios, you should - * pass in an element hosted within the popup. - * - * @public - */ parcelHelpers.export(exports, "getWindow", ()=>getWindow); -var _canUseDOM = require("./canUseDOM"); -var _window = undefined; -// Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window" -// hits a memory leak, whereas aliasing it and calling "typeof _window" does not. -// Caching the window value at the file scope lets us minimize the impact. -try { - // eslint-disable-next-line no-restricted-globals - _window = window; -} catch (e) { -/* no-op */ } -function getWindow(rootElement) { - if (!(0, _canUseDOM.canUseDOM)() || typeof _window === 'undefined') return undefined; - else { - var el = rootElement; - return el && el.ownerDocument && el.ownerDocument.defaultView ? el.ownerDocument.defaultView : _window; - } -} - -},{"./canUseDOM":"iFHeV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iFHeV":[function(require,module,exports,__globalThis) { -/** - * Verifies if an application can use DOM. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "canUseDOM", ()=>canUseDOM); -function canUseDOM() { - return(// eslint-disable-next-line no-restricted-globals - typeof window !== 'undefined' && !!// eslint-disable-next-line no-restricted-globals, deprecation/deprecation - (window.document && window.document.createElement)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"etMgU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AutoScroll", ()=>AutoScroll); -var _eventGroup = require("./EventGroup"); -var _scroll = require("./scroll"); -var _getRect = require("./dom/getRect"); -var _dom = require("./dom"); -var SCROLL_ITERATION_DELAY = 16; -var SCROLL_GUTTER = 100; -var MAX_SCROLL_VELOCITY = 15; -/** - * AutoScroll simply hooks up mouse events given a parent element, and scrolls the container - * up/down depending on how close the mouse is to the top/bottom of the container. - * - * Once you don't want autoscroll any more, just dispose the helper and it will unhook events. - * - * @public - * {@docCategory AutoScroll} - */ var AutoScroll = /** @class */ function() { - function AutoScroll(element, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _dom.getWindow)(element); - this._events = new (0, _eventGroup.EventGroup)(this); - this._scrollableParent = (0, _scroll.findScrollableParent)(element); - this._incrementScroll = this._incrementScroll.bind(this); - this._scrollRect = (0, _getRect.getRect)(this._scrollableParent, theWin); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - if (this._scrollableParent === theWin) this._scrollableParent = theWin.document.body; - if (this._scrollableParent) { - this._events.on(theWin, 'mousemove', this._onMouseMove, true); - this._events.on(theWin, 'touchmove', this._onTouchMove, true); - } - } - AutoScroll.prototype.dispose = function() { - this._events.dispose(); - this._stopScroll(); - }; - AutoScroll.prototype._onMouseMove = function(ev) { - this._computeScrollVelocity(ev); - }; - AutoScroll.prototype._onTouchMove = function(ev) { - if (ev.touches.length > 0) this._computeScrollVelocity(ev); - }; - AutoScroll.prototype._computeScrollVelocity = function(ev) { - if (!this._scrollRect) return; - var clientX; - var clientY; - if ('clientX' in ev) { - clientX = ev.clientX; - clientY = ev.clientY; - } else { - clientX = ev.touches[0].clientX; - clientY = ev.touches[0].clientY; - } - var scrollRectTop = this._scrollRect.top; - var scrollRectLeft = this._scrollRect.left; - var scrollClientBottom = scrollRectTop + this._scrollRect.height - SCROLL_GUTTER; - var scrollClientRight = scrollRectLeft + this._scrollRect.width - SCROLL_GUTTER; - // variables to use for alternating scroll direction - var scrollRect; - var clientDirection; - var scrollClient; - // if either of these conditions are met we are scrolling vertically else horizontally - if (clientY < scrollRectTop + SCROLL_GUTTER || clientY > scrollClientBottom) { - clientDirection = clientY; - scrollRect = scrollRectTop; - scrollClient = scrollClientBottom; - this._isVerticalScroll = true; - } else { - clientDirection = clientX; - scrollRect = scrollRectLeft; - scrollClient = scrollClientRight; - this._isVerticalScroll = false; - } - // calculate scroll velocity and direction - if (clientDirection < scrollRect + SCROLL_GUTTER) this._scrollVelocity = Math.max(-MAX_SCROLL_VELOCITY, -MAX_SCROLL_VELOCITY * ((SCROLL_GUTTER - (clientDirection - scrollRect)) / SCROLL_GUTTER)); - else if (clientDirection > scrollClient) this._scrollVelocity = Math.min(MAX_SCROLL_VELOCITY, MAX_SCROLL_VELOCITY * ((clientDirection - scrollClient) / SCROLL_GUTTER)); - else this._scrollVelocity = 0; - if (this._scrollVelocity) this._startScroll(); - else this._stopScroll(); - }; - AutoScroll.prototype._startScroll = function() { - if (!this._timeoutId) this._incrementScroll(); - }; - AutoScroll.prototype._incrementScroll = function() { - if (this._scrollableParent) { - if (this._isVerticalScroll) this._scrollableParent.scrollTop += Math.round(this._scrollVelocity); - else this._scrollableParent.scrollLeft += Math.round(this._scrollVelocity); - } - this._timeoutId = setTimeout(this._incrementScroll, SCROLL_ITERATION_DELAY); - }; - AutoScroll.prototype._stopScroll = function() { - if (this._timeoutId) { - clearTimeout(this._timeoutId); - delete this._timeoutId; - } - }; - return AutoScroll; -}(); - -},{"./EventGroup":"0TvPH","./scroll":"c99qU","./dom/getRect":"cPL7s","./dom":"QMA5I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0TvPH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "EventGroup", ()=>EventGroup); -var _dom = require("./dom"); -var _object = require("./object"); -var EventGroup = /** @class */ function() { - /** parent: the context in which events attached to non-HTMLElements are called */ function EventGroup(parent) { - this._id = EventGroup._uniqueId++; - this._parent = parent; - this._eventRecords = []; + }; + Async2.prototype.cancelAnimationFrame = function(id2, targetElement) { + var win = getWindow(targetElement); + if (this._animationFrameIds && this._animationFrameIds[id2]) { + win.cancelAnimationFrame ? win.cancelAnimationFrame(id2) : win.clearTimeout(id2); + delete this._animationFrameIds[id2]; + } + }; + Async2.prototype._logError = function(e) { + if (this._onErrorHandler) { + this._onErrorHandler(e); + } + }; + return Async2; + })() + ); + function isVirtualElement(element2) { + return element2 && !!element2._virtual; + } + function getVirtualParent(child) { + var parent; + if (child && isVirtualElement(child)) { + parent = child._virtual.parent; + } + return parent; + } + function getParent(child, allowVirtualParents) { + var _a2, _b2; + if (allowVirtualParents === void 0) { + allowVirtualParents = true; + } + if (!child) { + return null; + } + var parent = allowVirtualParents && getVirtualParent(child); + if (parent) { + return parent; + } + if (typeof child.assignedElements !== "function" && ((_a2 = child.assignedSlot) === null || _a2 === void 0 ? void 0 : _a2.parentNode)) { + return child.assignedSlot; + } else if (((_b2 = child.parentNode) === null || _b2 === void 0 ? void 0 : _b2.nodeType) === 11) { + return child.parentNode.host; + } else { + return child.parentNode; + } + } + function elementContains(parent, child, allowVirtualParents) { + if (allowVirtualParents === void 0) { + allowVirtualParents = true; } - /** For IE8, bubbleEvent is ignored here and must be dealt with by the handler. - * Events raised here by default have bubbling set to false and cancelable set to true. - * This applies also to built-in events being raised manually here on HTMLElements, - * which may lead to unexpected behavior if it differs from the defaults. - * - */ EventGroup.raise = function(target, eventName, eventArgs, bubbleEvent, doc) { - var retVal; - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _dom.getDocument)(); - if (EventGroup._isElement(target)) { - if (typeof theDoc !== 'undefined' && theDoc.createEvent) { - var ev = theDoc.createEvent('HTMLEvents'); - // eslint-disable-next-line deprecation/deprecation - ev.initEvent(eventName, bubbleEvent || false, true); - (0, _object.assign)(ev, eventArgs); - retVal = target.dispatchEvent(ev); - } else if (typeof theDoc !== 'undefined' && theDoc.createEventObject) { - // IE8 - var evObj = theDoc.createEventObject(eventArgs); - // cannot set cancelBubble on evObj, fireEvent will overwrite it - target.fireEvent('on' + eventName, evObj); - } - } else // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore -- FIXME: strictBindCallApply error - https://github.com/microsoft/fluentui/issues/17331 - while(target && retVal !== false){ - var events = target.__events__; - var eventRecords = events ? events[eventName] : null; - if (eventRecords) { - for(var id in eventRecords)if (eventRecords.hasOwnProperty(id)) { - var eventRecordList = eventRecords[id]; - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore -- FIXME: strictBindCallApply error - https://github.com/microsoft/fluentui/issues/17331 - for(var listIndex = 0; retVal !== false && listIndex < eventRecordList.length; listIndex++){ - var record = eventRecordList[listIndex]; - if (record.objectCallback) retVal = record.objectCallback.call(record.parent, eventArgs); - } - } - } - // If the target has a parent, bubble the event up. - target = bubbleEvent ? target.parent : null; - } - return retVal; - }; - EventGroup.isObserved = function(target, eventName) { - var events = target && target.__events__; - return !!events && !!events[eventName]; - }; - /** Check to see if the target has declared support of the given event. */ EventGroup.isDeclared = function(target, eventName) { - var declaredEvents = target && target.__declaredEvents; - return !!declaredEvents && !!declaredEvents[eventName]; - }; - EventGroup.stopPropagation = function(event) { - if (event.stopPropagation) event.stopPropagation(); - else // IE8 - event.cancelBubble = true; - }; - EventGroup._isElement = function(target) { - return !!target && (!!target.addEventListener || typeof HTMLElement !== 'undefined' && target instanceof HTMLElement); - }; - EventGroup.prototype.dispose = function() { - if (!this._isDisposed) { - this._isDisposed = true; - this.off(); - this._parent = null; - } - }; - /** On the target, attach a set of events, where the events object is a name to function mapping. */ EventGroup.prototype.onAll = function(target, events, useCapture) { - for(var eventName in events)if (events.hasOwnProperty(eventName)) this.on(target, eventName, events[eventName], useCapture); - }; - /** - * On the target, attach an event whose handler will be called in the context of the parent - * of this instance of EventGroup. - */ EventGroup.prototype.on = function(target, eventName, callback, options) { - var _this = this; - if (eventName.indexOf(',') > -1) { - var events = eventName.split(/[ ,]+/); - for(var i = 0; i < events.length; i++)this.on(target, events[i], callback, options); - } else { - var parent_1 = this._parent; - var eventRecord = { - target: target, - eventName: eventName, - parent: parent_1, - callback: callback, - options: options - }; - // Initialize and wire up the record on the target, so that it can call the callback if the event fires. - var events = target.__events__ = target.__events__ || {}; - events[eventName] = events[eventName] || { - count: 0 - }; - events[eventName][this._id] = events[eventName][this._id] || []; - events[eventName][this._id].push(eventRecord); - events[eventName].count++; - if (EventGroup._isElement(target)) { - var processElementEvent = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - if (_this._isDisposed) return; - var result; - try { - result = callback.apply(parent_1, args); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore -- FIXME: strictBindCallApply error - https://github.com/microsoft/fluentui/issues/17331 - if (result === false && args[0]) { - var e = args[0]; - if (e.preventDefault) e.preventDefault(); - if (e.stopPropagation) e.stopPropagation(); - e.cancelBubble = true; - } - } catch (e) { - // ignore - } - return result; - }; - eventRecord.elementCallback = processElementEvent; - if (target.addEventListener) target.addEventListener(eventName, processElementEvent, options); - else if (target.attachEvent) // IE8 - target.attachEvent('on' + eventName, processElementEvent); - } else { - var processObjectEvent = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - if (_this._isDisposed) return; - return callback.apply(parent_1, args); - }; - eventRecord.objectCallback = processObjectEvent; - } - // Remember the record locally, so that it can be removed. - this._eventRecords.push(eventRecord); - } - }; - EventGroup.prototype.off = function(target, eventName, callback, options) { - for(var i = 0; i < this._eventRecords.length; i++){ - var eventRecord = this._eventRecords[i]; - if ((!target || target === eventRecord.target) && (!eventName || eventName === eventRecord.eventName) && (!callback || callback === eventRecord.callback) && (typeof options !== 'boolean' || options === eventRecord.options)) { - var events = eventRecord.target.__events__; - var targetArrayLookup = events[eventRecord.eventName]; - var targetArray = targetArrayLookup ? targetArrayLookup[this._id] : null; - // We may have already target's entries, so check for null. - if (targetArray) { - if (targetArray.length === 1 || !callback) { - targetArrayLookup.count -= targetArray.length; - delete events[eventRecord.eventName][this._id]; - } else { - targetArrayLookup.count--; - targetArray.splice(targetArray.indexOf(eventRecord), 1); - } - if (!targetArrayLookup.count) delete events[eventRecord.eventName]; - } - if (eventRecord.elementCallback) { - if (eventRecord.target.removeEventListener) eventRecord.target.removeEventListener(eventRecord.eventName, eventRecord.elementCallback, eventRecord.options); - else if (eventRecord.target.detachEvent) // IE8 - eventRecord.target.detachEvent('on' + eventRecord.eventName, eventRecord.elementCallback); - } - this._eventRecords.splice(i--, 1); - } - } - }; - /** Trigger the given event in the context of this instance of EventGroup. */ EventGroup.prototype.raise = function(eventName, eventArgs, bubbleEvent) { - return EventGroup.raise(this._parent, eventName, eventArgs, bubbleEvent); - }; - /** Declare an event as being supported by this instance of EventGroup. */ EventGroup.prototype.declare = function(event) { - var declaredEvents = this._parent.__declaredEvents = this._parent.__declaredEvents || {}; - if (typeof event === 'string') declaredEvents[event] = true; - else for(var i = 0; i < event.length; i++)declaredEvents[event[i]] = true; - }; - EventGroup._uniqueId = 0; - return EventGroup; -}(); - -},{"./dom":"QMA5I","./object":"celWf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"QMA5I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContains", ()=>(0, _elementContains.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _elementContainsAttribute.elementContainsAttribute)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _findElementRecursive.findElementRecursive)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _getActiveElement.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _getChildren.getChildren)); -parcelHelpers.export(exports, "getDocument", ()=>(0, _getDocument.getDocument)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _getEventTarget.getEventTarget)); -parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>(0, _getFirstVisibleElementFromSelector.getFirstVisibleElementFromSelector)); -parcelHelpers.export(exports, "getParent", ()=>(0, _getParent.getParent)); -parcelHelpers.export(exports, "getRect", ()=>(0, _getRect.getRect)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _getVirtualParent.getVirtualParent)); -parcelHelpers.export(exports, "getWindow", ()=>(0, _getWindow.getWindow)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _isVirtualElement.isVirtualElement)); -parcelHelpers.export(exports, "on", ()=>(0, _on.on)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _portalContainsElement.portalContainsElement)); -parcelHelpers.export(exports, "raiseClick", ()=>(0, _raiseClick.raiseClick)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _setPortalAttribute.setPortalAttribute)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _setVirtualParent.setVirtualParent)); -var _elementContains = require("./dom/elementContains"); -var _elementContainsAttribute = require("./dom/elementContainsAttribute"); -var _findElementRecursive = require("./dom/findElementRecursive"); -var _getActiveElement = require("./dom/getActiveElement"); -var _getChildren = require("./dom/getChildren"); -var _getDocument = require("./dom/getDocument"); -var _getEventTarget = require("./dom/getEventTarget"); -var _getFirstVisibleElementFromSelector = require("./dom/getFirstVisibleElementFromSelector"); -var _getParent = require("./dom/getParent"); -var _getRect = require("./dom/getRect"); -var _getVirtualParent = require("./dom/getVirtualParent"); -var _getWindow = require("./dom/getWindow"); -var _isVirtualElement = require("./dom/isVirtualElement"); -var _on = require("./dom/on"); -var _portalContainsElement = require("./dom/portalContainsElement"); -var _raiseClick = require("./dom/raiseClick"); -var _setPortalAttribute = require("./dom/setPortalAttribute"); -var _setVirtualParent = require("./dom/setVirtualParent"); - -},{"./dom/elementContains":"2CwUJ","./dom/elementContainsAttribute":"5nhe5","./dom/findElementRecursive":"bXARJ","./dom/getActiveElement":"ej3Mo","./dom/getChildren":"2mLgW","./dom/getDocument":"7EOu7","./dom/getEventTarget":"7SPqE","./dom/getFirstVisibleElementFromSelector":"8D3L7","./dom/getParent":"jcio6","./dom/getRect":"cPL7s","./dom/getVirtualParent":"95Nzl","./dom/getWindow":"aI1a8","./dom/isVirtualElement":"g1lgp","./dom/on":"bmVGg","./dom/portalContainsElement":"gxxCf","./dom/raiseClick":"7xL7G","./dom/setPortalAttribute":"iieJm","./dom/setVirtualParent":"04xNE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2CwUJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContains", ()=>(0, _domUtilities.elementContains)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9rkUy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContains", ()=>(0, _elementContains.elementContains)); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _elementContainsAttribute.elementContainsAttribute)); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _findElementRecursive.findElementRecursive)); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _getActiveElement.getActiveElement)); -parcelHelpers.export(exports, "getChildren", ()=>(0, _getChildren.getChildren)); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _getEventTarget.getEventTarget)); -parcelHelpers.export(exports, "getParent", ()=>(0, _getParent.getParent)); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _getVirtualParent.getVirtualParent)); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _isVirtualElement.isVirtualElement)); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _portalContainsElement.portalContainsElement)); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _setPortalAttribute.setPortalAttribute)); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _setVirtualParent.setVirtualParent)); -var _elementContains = require("./elementContains"); -var _elementContainsAttribute = require("./elementContainsAttribute"); -var _findElementRecursive = require("./findElementRecursive"); -var _getActiveElement = require("./getActiveElement"); -var _getChildren = require("./getChildren"); -var _getEventTarget = require("./getEventTarget"); -var _getParent = require("./getParent"); -var _getVirtualParent = require("./getVirtualParent"); -var _isVirtualElement = require("./isVirtualElement"); -var _portalContainsElement = require("./portalContainsElement"); -var _setPortalAttribute = require("./setPortalAttribute"); -var _setVirtualParent = require("./setVirtualParent"); -var _version = require("./version"); - -},{"./elementContains":"fEbuU","./elementContainsAttribute":"3JNJ4","./findElementRecursive":"9jL42","./getActiveElement":"eFvN1","./getChildren":"dzzLx","./getEventTarget":"bigj6","./getParent":"e1jhK","./getVirtualParent":"h5OcT","./isVirtualElement":"8A405","./portalContainsElement":"bpjTZ","./setPortalAttribute":"3IIlp","./setVirtualParent":"9VlRR","./version":"3KF3P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fEbuU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Determines whether or not a parent element contains a given child element. - * If `allowVirtualParents` is true, this method may return `true` if the child - * has the parent in its virtual element hierarchy. - * - * @public - */ parcelHelpers.export(exports, "elementContains", ()=>elementContains); -var _getParent = require("./getParent"); -function elementContains(parent, child, allowVirtualParents) { - if (allowVirtualParents === void 0) allowVirtualParents = true; var isContained = false; if (parent && child) { - if (allowVirtualParents) { - if (parent === child) isContained = true; - else { - isContained = false; - while(child){ - var nextParent = (0, _getParent.getParent)(child); - if (nextParent === parent) { - isContained = true; - break; - } - child = nextParent; - } - } - } else if (parent.contains) isContained = parent.contains(child); + if (allowVirtualParents) { + if (parent === child) { + isContained = true; + } else { + isContained = false; + while (child) { + var nextParent = getParent(child); + if (nextParent === parent) { + isContained = true; + break; + } + child = nextParent; + } + } + } else if (parent.contains) { + isContained = parent.contains(child); + } } return isContained; -} - -},{"./getParent":"e1jhK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e1jhK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the element which is the parent of a given element. - * If `allowVirtuaParents` is `true`, this method prefers the virtual parent over - * real DOM parent when present. - * - * @public - */ parcelHelpers.export(exports, "getParent", ()=>getParent); -var _getVirtualParent = require("./getVirtualParent"); -function getParent(child, allowVirtualParents) { - var _a, _b; - if (allowVirtualParents === void 0) allowVirtualParents = true; - if (!child) return null; - var parent = allowVirtualParents && (0, _getVirtualParent.getVirtualParent)(child); - if (parent) return parent; - // Support looking for parents in shadow DOM - if (typeof child.assignedElements !== 'function' && ((_a = child.assignedSlot) === null || _a === void 0 ? void 0 : _a.parentNode)) // Element is slotted - return child.assignedSlot; - else if (((_b = child.parentNode) === null || _b === void 0 ? void 0 : _b.nodeType) === 11) // nodeType 11 is DOCUMENT_FRAGMENT - // Element is in shadow root - return child.parentNode.host; - else return child.parentNode; -} - -},{"./getVirtualParent":"h5OcT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h5OcT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the virtual parent given the child element, if it exists. - * - * @public - */ parcelHelpers.export(exports, "getVirtualParent", ()=>getVirtualParent); -var _isVirtualElement = require("./isVirtualElement"); -function getVirtualParent(child) { - var parent; - if (child && (0, _isVirtualElement.isVirtualElement)(child)) parent = child._virtual.parent; - return parent; -} - -},{"./isVirtualElement":"8A405","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8A405":[function(require,module,exports,__globalThis) { -/** - * Determines whether or not an element has the virtual hierarchy extension. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isVirtualElement", ()=>isVirtualElement); -function isVirtualElement(element) { - return element && !!element._virtual; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3JNJ4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Determines if an element, or any of its ancestors, contain the given attribute - * @param element - element to start searching at - * @param attribute - the attribute to search for - * @returns the value of the first instance found - */ parcelHelpers.export(exports, "elementContainsAttribute", ()=>elementContainsAttribute); -var _findElementRecursive = require("./findElementRecursive"); -function elementContainsAttribute(element, attribute, doc) { - var elementMatch = (0, _findElementRecursive.findElementRecursive)(element, function(testElement) { - return testElement.hasAttribute(attribute); + } + function findElementRecursive(element2, matchFunction, doc) { + doc !== null && doc !== void 0 ? doc : doc = document; + if (!element2 || element2 === doc.body || element2 instanceof Document) { + return null; + } + return matchFunction(element2) ? element2 : findElementRecursive(getParent(element2), matchFunction); + } + function elementContainsAttribute(element2, attribute, doc) { + var elementMatch = findElementRecursive(element2, function(testElement) { + return testElement.hasAttribute(attribute); }, doc); return elementMatch && elementMatch.getAttribute(attribute); -} - -},{"./findElementRecursive":"9jL42","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9jL42":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Finds the first parent element where the matchFunction returns true - * @param element - element to start searching at - * @param matchFunction - the function that determines if the element is a match - * @returns the matched element or null no match was found - */ parcelHelpers.export(exports, "findElementRecursive", ()=>findElementRecursive); -var _getParent = require("./getParent"); -function findElementRecursive(element, matchFunction, doc) { - // eslint-disable-next-line no-restricted-globals - doc !== null && doc !== void 0 ? doc : doc = document; - if (!element || element === doc.body || element instanceof Document) return null; - return matchFunction(element) ? element : findElementRecursive((0, _getParent.getParent)(element), matchFunction); -} - -},{"./getParent":"e1jhK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eFvN1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getActiveElement", ()=>getActiveElement); -var getActiveElement = function(doc) { + } + var getActiveElement = function(doc) { var ae = doc.activeElement; - while(ae === null || ae === void 0 ? void 0 : ae.shadowRoot)ae = ae.shadowRoot.activeElement; + while (ae === null || ae === void 0 ? void 0 : ae.shadowRoot) { + ae = ae.shadowRoot.activeElement; + } return ae; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dzzLx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the elements which are child elements of the given element. - * If `allowVirtualChildren` is `true`, this method enumerates virtual child elements - * after the original children. - * @param parent - The element to get the children of. - * @param allowVirtualChildren - true if the method should enumerate virtual child elements. - */ parcelHelpers.export(exports, "getChildren", ()=>getChildren); -var _isVirtualElement = require("./isVirtualElement"); -function getChildren(parent, allowVirtualChildren) { - if (allowVirtualChildren === void 0) allowVirtualChildren = true; - var children = []; + }; + function getChildren(parent, allowVirtualChildren) { + if (allowVirtualChildren === void 0) { + allowVirtualChildren = true; + } + var children2 = []; if (parent) { - for(var i = 0; i < parent.children.length; i++)children.push(parent.children.item(i)); - if (allowVirtualChildren && (0, _isVirtualElement.isVirtualElement)(parent)) children.push.apply(children, parent._virtual.children); - } - return children; -} - -},{"./isVirtualElement":"8A405","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bigj6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getEventTarget", ()=>getEventTarget); -var getEventTarget = function(event) { - var target = event.target; - if (target && target.shadowRoot) target = event.composedPath()[0]; - return target; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bpjTZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Determine whether a target is within a portal from perspective of root or optional parent. - * This function only works against portal components that use the setPortalAttribute function. - * If both parent and child are within the same portal this function will return false. - * @param target - Element to query portal containment status of. - * @param parent - Optional parent perspective. Search for containing portal stops at parent - * (or root if parent is undefined or invalid.) - */ parcelHelpers.export(exports, "portalContainsElement", ()=>portalContainsElement); -var _findElementRecursive = require("./findElementRecursive"); -var _setPortalAttribute = require("./setPortalAttribute"); -function portalContainsElement(target, parent, doc) { - var _a; - var elementMatch = (0, _findElementRecursive.findElementRecursive)(target, function(testElement) { - var _a; - return parent === testElement || !!((_a = testElement.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(testElement, (0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE))); + for (var i = 0; i < parent.children.length; i++) { + children2.push(parent.children.item(i)); + } + if (allowVirtualChildren && isVirtualElement(parent)) { + children2.push.apply(children2, parent._virtual.children); + } + } + return children2; + } + var getEventTarget = function(event2) { + var target2 = event2.target; + if (target2 && target2.shadowRoot) { + target2 = event2.composedPath()[0]; + } + return target2; + }; + var DATA_PORTAL_ATTRIBUTE = "data-portal-element"; + function setPortalAttribute(element2) { + element2.setAttribute(DATA_PORTAL_ATTRIBUTE, "true"); + } + function portalContainsElement(target2, parent, doc) { + var _a2; + var elementMatch = findElementRecursive(target2, function(testElement) { + var _a3; + return parent === testElement || !!((_a3 = testElement.hasAttribute) === null || _a3 === void 0 ? void 0 : _a3.call(testElement, DATA_PORTAL_ATTRIBUTE)); }, doc); - return elementMatch !== null && !!((_a = elementMatch.hasAttribute) === null || _a === void 0 ? void 0 : _a.call(elementMatch, (0, _setPortalAttribute.DATA_PORTAL_ATTRIBUTE))); -} - -},{"./findElementRecursive":"9jL42","./setPortalAttribute":"3IIlp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3IIlp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>DATA_PORTAL_ATTRIBUTE); -/** - * Identify element as a portal by setting an attribute. - * @param element - Element to mark as a portal. - */ parcelHelpers.export(exports, "setPortalAttribute", ()=>setPortalAttribute); -var DATA_PORTAL_ATTRIBUTE = 'data-portal-element'; -function setPortalAttribute(element) { - element.setAttribute(DATA_PORTAL_ATTRIBUTE, 'true'); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VlRR":[function(require,module,exports,__globalThis) { -/** - * Sets the virtual parent of an element. - * Pass `undefined` as the `parent` to clear the virtual parent. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVirtualParent", ()=>setVirtualParent); -function setVirtualParent(child, parent) { + return elementMatch !== null && !!((_a2 = elementMatch.hasAttribute) === null || _a2 === void 0 ? void 0 : _a2.call(elementMatch, DATA_PORTAL_ATTRIBUTE)); + } + function setVirtualParent(child, parent) { var virtualChild = child; var virtualParent = parent; - if (!virtualChild._virtual) virtualChild._virtual = { + if (!virtualChild._virtual) { + virtualChild._virtual = { children: [] - }; + }; + } var oldParent = virtualChild._virtual.parent; if (oldParent && oldParent !== parent) { - // Remove the child from its old parent. - var index = oldParent._virtual.children.indexOf(virtualChild); - if (index > -1) oldParent._virtual.children.splice(index, 1); + var index2 = oldParent._virtual.children.indexOf(virtualChild); + if (index2 > -1) { + oldParent._virtual.children.splice(index2, 1); + } } - virtualChild._virtual.parent = virtualParent || undefined; + virtualChild._virtual.parent = virtualParent || void 0; if (virtualParent) { - if (!virtualParent._virtual) virtualParent._virtual = { - children: [] + if (!virtualParent._virtual) { + virtualParent._virtual = { + children: [] }; - virtualParent._virtual.children.push(virtualChild); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3KF3P":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/dom-utilities', '2.3.9'); - -},{"@fluentui/set-version":"iqYXf"}],"5nhe5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "elementContainsAttribute", ()=>(0, _domUtilities.elementContainsAttribute)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bXARJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "findElementRecursive", ()=>(0, _domUtilities.findElementRecursive)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ej3Mo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getActiveElement", ()=>(0, _domUtilities.getActiveElement)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2mLgW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getChildren", ()=>(0, _domUtilities.getChildren)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7EOu7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to get the document object. Note that in popup window cases, document - * might be the wrong document, which is why we look at ownerDocument for the - * truth. - * - * @public - */ parcelHelpers.export(exports, "getDocument", ()=>getDocument); -var _canUseDOM = require("./canUseDOM"); -function getDocument(rootElement) { - // eslint-disable-next-line no-restricted-globals - if (!(0, _canUseDOM.canUseDOM)() || typeof document === 'undefined') return undefined; - else { - var el = rootElement; - // eslint-disable-next-line no-restricted-globals - return el && el.ownerDocument ? el.ownerDocument : document; - } -} - -},{"./canUseDOM":"iFHeV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7SPqE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getEventTarget", ()=>(0, _domUtilities.getEventTarget)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8D3L7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the first visible element that matches the given selector - * @param selector - The selector to use to find potential visible elements - * @returns The first visible element that matches the selector, otherwise undefined - * - * @public - */ parcelHelpers.export(exports, "getFirstVisibleElementFromSelector", ()=>getFirstVisibleElementFromSelector); -var _focus = require("../focus"); -var _getDocument = require("./getDocument"); -function getFirstVisibleElementFromSelector(selector) { - var doc = (0, _getDocument.getDocument)(); - var elements = doc.querySelectorAll(selector); - // Iterate across the elements that match the selector and return the first visible/non-hidden element - return Array.from(elements).find(function(element) { - var _a; - return (0, _focus.isElementVisibleAndNotHidden)(element, (_a = doc.defaultView) !== null && _a !== void 0 ? _a : undefined); - }); -} - -},{"../focus":"vgfwi","./getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"vgfwi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the first focusable element. - * - * @public - */ parcelHelpers.export(exports, "getFirstFocusable", ()=>getFirstFocusable); -/** - * Gets the last focusable element. - * - * @public - */ parcelHelpers.export(exports, "getLastFocusable", ()=>getLastFocusable); -/** - * Gets the first tabbable element. (The difference between focusable and tabbable is that tabbable elements are - * focusable elements that also have tabIndex != -1.) - * @param rootElement - The parent element to search beneath. - * @param currentElement - The descendant of rootElement to start the search at. This element is the first one checked, - * and iteration continues forward. Typical use passes rootElement.firstChild. - * @param includeElementsInFocusZones - true if traversal should go into FocusZone descendants. - * @param checkNode - Include currentElement in search when true. Defaults to true. - * @public - */ parcelHelpers.export(exports, "getFirstTabbable", ()=>getFirstTabbable); -/** - * Gets the last tabbable element. (The difference between focusable and tabbable is that tabbable elements are - * focusable elements that also have tabIndex != -1.) - * @param rootElement - The parent element to search beneath. - * @param currentElement - The descendant of rootElement to start the search at. This element is the first one checked, - * and iteration continues in reverse. Typical use passes rootElement.lastChild. - * @param includeElementsInFocusZones - true if traversal should go into FocusZone descendants. - * @param checkNode - Include currentElement in search when true. Defaults to true. - * @public - */ parcelHelpers.export(exports, "getLastTabbable", ()=>getLastTabbable); -/** - * Attempts to focus the first focusable element that is a child or child's child of the rootElement. - * - * @public - * @param rootElement - Element to start the search for a focusable child. - * @param bypassHiddenElements - If true, focus will be not be set on hidden elements. - * @returns True if focus was set, false if it was not. - */ parcelHelpers.export(exports, "focusFirstChild", ()=>focusFirstChild); -/** - * Traverse to find the previous element. - * If tabbable is true, the element must have tabIndex != -1. - * - * @public - */ parcelHelpers.export(exports, "getPreviousElement", ()=>getPreviousElement); -/** - * Traverse to find the next focusable element. - * If tabbable is true, the element must have tabIndex != -1. - * - * @public - * @param checkNode - Include currentElement in search when true. - */ parcelHelpers.export(exports, "getNextElement", ()=>getNextElement); -/** - * Determines if an element is visible. - * - * @public - */ parcelHelpers.export(exports, "isElementVisible", ()=>isElementVisible); -/** - * Determines if an element is visible and not hidden - * @param element - Element to check - * @returns Returns true if the given element is visible and not hidden - * - * @public - */ parcelHelpers.export(exports, "isElementVisibleAndNotHidden", ()=>isElementVisibleAndNotHidden); -/** - * Determines if an element can receive focus programmatically or via a mouse click. - * If checkTabIndex is true, additionally checks to ensure the element can be focused with the tab key, - * meaning tabIndex != -1. - * - * @public - */ parcelHelpers.export(exports, "isElementTabbable", ()=>isElementTabbable); -/** - * Determines if a given element is a focus zone. - * - * @public - */ parcelHelpers.export(exports, "isElementFocusZone", ()=>isElementFocusZone); -/** - * Determines if a given element is a focus sub zone. - * - * @public - */ parcelHelpers.export(exports, "isElementFocusSubZone", ()=>isElementFocusSubZone); -/** - * Determines if an element, or any of its children, contain focus. - * - * @public - */ parcelHelpers.export(exports, "doesElementContainFocus", ()=>doesElementContainFocus); -/** - * Determines if an, or any of its ancestors, sepcificies that it doesn't want focus to wrap - * @param element - element to start searching from - * @param noWrapDataAttribute - the no wrap data attribute to match (either) - * @returns true if focus should wrap, false otherwise - */ parcelHelpers.export(exports, "shouldWrapFocus", ()=>shouldWrapFocus); -/** - * Sets focus to an element asynchronously. The focus will be set at the next browser repaint, - * meaning it won't cause any extra recalculations. If more than one focusAsync is called during one frame, - * only the latest called focusAsync element will actually be focused - * @param element - The element to focus - */ parcelHelpers.export(exports, "focusAsync", ()=>focusAsync); -/** - * Finds the closest focusable element via an index path from a parent. See - * `getElementIndexPath` for getting an index path from an element to a child. - */ parcelHelpers.export(exports, "getFocusableByIndexPath", ()=>getFocusableByIndexPath); -/** - * Finds the element index path from a parent element to a child element. - * - * If you had this node structure: "A has children [B, C] and C has child D", - * the index path from A to D would be [1, 0], or `parent.chidren[1].children[0]`. - */ parcelHelpers.export(exports, "getElementIndexPath", ()=>getElementIndexPath); -var _elementContainsAttribute = require("./dom/elementContainsAttribute"); -var _elementContains = require("./dom/elementContains"); -var _getParent = require("./dom/getParent"); -var _getWindow = require("./dom/getWindow"); -var _getDocument = require("./dom/getDocument"); -var IS_FOCUSABLE_ATTRIBUTE = 'data-is-focusable'; -var IS_VISIBLE_ATTRIBUTE = 'data-is-visible'; -var FOCUSZONE_ID_ATTRIBUTE = 'data-focuszone-id'; -var FOCUSZONE_SUB_ATTRIBUTE = 'data-is-sub-focuszone'; -function getFirstFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { - return getNextElement(rootElement, currentElement, true, false, false, includeElementsInFocusZones, undefined, undefined, undefined, includeShadowRoots); -} -function getLastFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { - return getPreviousElement(rootElement, currentElement, true, false, true, includeElementsInFocusZones, undefined, undefined, includeShadowRoots); -} -function getFirstTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { - if (checkNode === void 0) checkNode = true; - return getNextElement(rootElement, currentElement, checkNode, false, false, includeElementsInFocusZones, false, true, undefined, includeShadowRoots); -} -function getLastTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { - if (checkNode === void 0) checkNode = true; + } + virtualParent._virtual.children.push(virtualChild); + } + } + function getDocument(rootElement) { + if (!canUseDOM() || typeof document === "undefined") { + return void 0; + } else { + var el = rootElement; + return el && el.ownerDocument ? el.ownerDocument : document; + } + } + var IS_FOCUSABLE_ATTRIBUTE$1 = "data-is-focusable"; + var IS_VISIBLE_ATTRIBUTE = "data-is-visible"; + var FOCUSZONE_ID_ATTRIBUTE$1 = "data-focuszone-id"; + var FOCUSZONE_SUB_ATTRIBUTE = "data-is-sub-focuszone"; + function getFirstFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { + return getNextElement(rootElement, currentElement, true, false, false, includeElementsInFocusZones, void 0, void 0, void 0, includeShadowRoots); + } + function getLastFocusable(rootElement, currentElement, includeElementsInFocusZones, includeShadowRoots) { + return getPreviousElement(rootElement, currentElement, true, false, true, includeElementsInFocusZones, void 0, void 0, includeShadowRoots); + } + function getFirstTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { + return getNextElement(rootElement, currentElement, checkNode, false, false, includeElementsInFocusZones, false, true, void 0, includeShadowRoots); + } + function getLastTabbable(rootElement, currentElement, includeElementsInFocusZones, checkNode, includeShadowRoots) { return getPreviousElement(rootElement, currentElement, checkNode, false, true, includeElementsInFocusZones, false, true, includeShadowRoots); -} -function focusFirstChild(rootElement, bypassHiddenElements, includeShadowRoots) { - var element = getNextElement(rootElement, rootElement, true, false, false, true, undefined, undefined, bypassHiddenElements, includeShadowRoots); - if (element) { - focusAsync(element); - return true; + } + function focusFirstChild(rootElement, bypassHiddenElements, includeShadowRoots) { + var element2 = getNextElement(rootElement, rootElement, true, false, false, true, void 0, void 0, bypassHiddenElements, includeShadowRoots); + if (element2) { + focusAsync(element2); + return true; + } + return false; + } + function getPreviousElement(rootElement, currentElement, checkNode, suppressParentTraversal, traverseChildren, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots) { + var _a2; + if (!currentElement || !allowFocusRoot && currentElement === rootElement) { + return null; } - return false; -} -function getPreviousElement(rootElement, currentElement, checkNode, suppressParentTraversal, traverseChildren, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots) { - var _a; - if (!currentElement || !allowFocusRoot && currentElement === rootElement) return null; var isCurrentElementVisible = isElementVisible(currentElement); - // Check its children. if (traverseChildren && isCurrentElementVisible && (includeElementsInFocusZones || !(isElementFocusZone(currentElement) || isElementFocusSubZone(currentElement)))) { - var lastElementChild = currentElement.lastElementChild || includeShadowRoots && ((_a = currentElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.lastElementChild); - var childMatch = getPreviousElement(rootElement, lastElementChild, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (childMatch) { - if (tabbable && isElementTabbable(childMatch, true, includeShadowRoots) || !tabbable) return childMatch; - var childMatchSiblingMatch = getPreviousElement(rootElement, childMatch.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (childMatchSiblingMatch) return childMatchSiblingMatch; - var childMatchParent = childMatch.parentElement; - // At this point if we have not found any potential matches - // start looking at the rest of the subtree under the currentParent. - // NOTE: We do not want to recurse here because doing so could - // cause elements to get skipped. - while(childMatchParent && childMatchParent !== currentElement){ - var childMatchParentMatch = getPreviousElement(rootElement, childMatchParent.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (childMatchParentMatch) return childMatchParentMatch; - childMatchParent = childMatchParent.parentElement; - } + var lastElementChild = currentElement.lastElementChild || includeShadowRoots && ((_a2 = currentElement.shadowRoot) === null || _a2 === void 0 ? void 0 : _a2.lastElementChild); + var childMatch = getPreviousElement(rootElement, lastElementChild, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (childMatch) { + if (tabbable && isElementTabbable(childMatch, true, includeShadowRoots) || !tabbable) { + return childMatch; + } + var childMatchSiblingMatch = getPreviousElement(rootElement, childMatch.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (childMatchSiblingMatch) { + return childMatchSiblingMatch; + } + var childMatchParent = childMatch.parentElement; + while (childMatchParent && childMatchParent !== currentElement) { + var childMatchParentMatch = getPreviousElement(rootElement, childMatchParent.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (childMatchParentMatch) { + return childMatchParentMatch; + } + childMatchParent = childMatchParent.parentElement; } + } + } + if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) { + return currentElement; } - // Check the current node, if it's not the first traversal. - if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) return currentElement; - // Check its previous sibling. var siblingMatch = getPreviousElement(rootElement, currentElement.previousElementSibling, true, true, true, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); - if (siblingMatch) return siblingMatch; - // Check its parent. - if (!suppressParentTraversal) return getPreviousElement(rootElement, currentElement.parentElement, true, false, false, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + if (siblingMatch) { + return siblingMatch; + } + if (!suppressParentTraversal) { + return getPreviousElement(rootElement, currentElement.parentElement, true, false, false, includeElementsInFocusZones, allowFocusRoot, tabbable, includeShadowRoots); + } return null; -} -function getNextElement(rootElement, currentElement, checkNode, suppressParentTraversal, suppressChildTraversal, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots) { - var _a; - if (!currentElement || currentElement === rootElement && suppressChildTraversal && !allowFocusRoot) return null; + } + function getNextElement(rootElement, currentElement, checkNode, suppressParentTraversal, suppressChildTraversal, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots) { + var _a2; + if (!currentElement || currentElement === rootElement && suppressChildTraversal && !allowFocusRoot) { + return null; + } var checkElementVisibility = bypassHiddenElements ? isElementVisibleAndNotHidden : isElementVisible; var isCurrentElementVisible = checkElementVisibility(currentElement); - // Check the current node, if it's not the first traversal. - if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) return currentElement; - // Check its children. + if (checkNode && isCurrentElementVisible && isElementTabbable(currentElement, tabbable, includeShadowRoots)) { + return currentElement; + } if (!suppressChildTraversal && isCurrentElementVisible && (includeElementsInFocusZones || !(isElementFocusZone(currentElement) || isElementFocusSubZone(currentElement)))) { - var firstElementchild = currentElement.firstElementChild || includeShadowRoots && ((_a = currentElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.firstElementChild); - var childMatch = getNextElement(rootElement, firstElementchild, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); - if (childMatch) return childMatch; + var firstElementchild = currentElement.firstElementChild || includeShadowRoots && ((_a2 = currentElement.shadowRoot) === null || _a2 === void 0 ? void 0 : _a2.firstElementChild); + var childMatch = getNextElement(rootElement, firstElementchild, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); + if (childMatch) { + return childMatch; + } + } + if (currentElement === rootElement) { + return null; } - if (currentElement === rootElement) return null; - // Check its sibling. var siblingMatch = getNextElement(rootElement, currentElement.nextElementSibling, true, true, false, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); - if (siblingMatch) return siblingMatch; - if (!suppressParentTraversal) return getNextElement(rootElement, currentElement.parentElement, false, false, true, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); + if (siblingMatch) { + return siblingMatch; + } + if (!suppressParentTraversal) { + return getNextElement(rootElement, currentElement.parentElement, false, false, true, includeElementsInFocusZones, allowFocusRoot, tabbable, bypassHiddenElements, includeShadowRoots); + } return null; -} -function isElementVisible(element) { - // If the element is not valid, return false. - if (!element || !element.getAttribute) return false; - var visibilityAttribute = element.getAttribute(IS_VISIBLE_ATTRIBUTE); - // If the element is explicitly marked with the visibility attribute, return that value as boolean. - if (visibilityAttribute !== null && visibilityAttribute !== undefined) return visibilityAttribute === 'true'; - // Fallback to other methods of determining actual visibility. - return element.offsetHeight !== 0 || element.offsetParent !== null || // eslint-disable-next-line @typescript-eslint/no-explicit-any - element.isVisible === true; // used as a workaround for testing. -} -function isElementVisibleAndNotHidden(element, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _getWindow.getWindow)(); - return !!element && isElementVisible(element) && !element.hidden && theWin.getComputedStyle(element).visibility !== 'hidden'; -} -function isElementTabbable(element, checkTabIndex, checkShadowRoot) { - if (checkShadowRoot === void 0) checkShadowRoot = true; - // If this element is null or is disabled, it is not considered tabbable. - if (!element || element.disabled) return false; + } + function isElementVisible(element2) { + if (!element2 || !element2.getAttribute) { + return false; + } + var visibilityAttribute = element2.getAttribute(IS_VISIBLE_ATTRIBUTE); + if (visibilityAttribute !== null && visibilityAttribute !== void 0) { + return visibilityAttribute === "true"; + } + return element2.offsetHeight !== 0 || element2.offsetParent !== null || // eslint-disable-next-line @typescript-eslint/no-explicit-any + element2.isVisible === true; + } + function isElementVisibleAndNotHidden(element2, win) { + var theWin = win !== null && win !== void 0 ? win : getWindow(); + return !!element2 && isElementVisible(element2) && !element2.hidden && theWin.getComputedStyle(element2).visibility !== "hidden"; + } + function isElementTabbable(element2, checkTabIndex, checkShadowRoot) { + if (checkShadowRoot === void 0) { + checkShadowRoot = true; + } + if (!element2 || element2.disabled) { + return false; + } var tabIndex = 0; var tabIndexAttributeValue = null; - if (element && element.getAttribute) { - tabIndexAttributeValue = element.getAttribute('tabIndex'); - if (tabIndexAttributeValue) tabIndex = parseInt(tabIndexAttributeValue, 10); + if (element2 && element2.getAttribute) { + tabIndexAttributeValue = element2.getAttribute("tabIndex"); + if (tabIndexAttributeValue) { + tabIndex = parseInt(tabIndexAttributeValue, 10); + } } - var isFocusableAttribute = element.getAttribute ? element.getAttribute(IS_FOCUSABLE_ATTRIBUTE) : null; + var isFocusableAttribute = element2.getAttribute ? element2.getAttribute(IS_FOCUSABLE_ATTRIBUTE$1) : null; var isTabIndexSet = tabIndexAttributeValue !== null && tabIndex >= 0; - var delegatesFocus = checkShadowRoot && element.shadowRoot ? !!element.shadowRoot.delegatesFocus : false; - var result = !!element && isFocusableAttribute !== 'false' && (element.tagName === 'A' || element.tagName === 'BUTTON' || element.tagName === 'INPUT' || element.tagName === 'TEXTAREA' || element.tagName === 'SELECT' || isFocusableAttribute === 'true' || isTabIndexSet || delegatesFocus); + var delegatesFocus = checkShadowRoot && element2.shadowRoot ? !!element2.shadowRoot.delegatesFocus : false; + var result = !!element2 && isFocusableAttribute !== "false" && (element2.tagName === "A" || element2.tagName === "BUTTON" || element2.tagName === "INPUT" || element2.tagName === "TEXTAREA" || element2.tagName === "SELECT" || isFocusableAttribute === "true" || isTabIndexSet || delegatesFocus); return checkTabIndex ? tabIndex !== -1 && result : result; -} -function isElementFocusZone(element) { - return !!(element && element.getAttribute && !!element.getAttribute(FOCUSZONE_ID_ATTRIBUTE)); -} -function isElementFocusSubZone(element) { - return !!(element && element.getAttribute && element.getAttribute(FOCUSZONE_SUB_ATTRIBUTE) === 'true'); -} -function doesElementContainFocus(element) { - var doc = (0, _getDocument.getDocument)(element); + } + function isElementFocusZone(element2) { + return !!(element2 && element2.getAttribute && !!element2.getAttribute(FOCUSZONE_ID_ATTRIBUTE$1)); + } + function isElementFocusSubZone(element2) { + return !!(element2 && element2.getAttribute && element2.getAttribute(FOCUSZONE_SUB_ATTRIBUTE) === "true"); + } + function doesElementContainFocus(element2) { + var doc = getDocument(element2); var currentActiveElement = doc && doc.activeElement; - if (currentActiveElement && (0, _elementContains.elementContains)(element, currentActiveElement)) return true; + if (currentActiveElement && elementContains(element2, currentActiveElement)) { + return true; + } return false; -} -function shouldWrapFocus(element, noWrapDataAttribute, doc) { - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _getDocument.getDocument)(); - return (0, _elementContainsAttribute.elementContainsAttribute)(element, noWrapDataAttribute, theDoc) === 'true' ? false : true; -} -var animationId = undefined; -function focusAsync(element) { - if (element) { - var win = (0, _getWindow.getWindow)(element); - if (win) { - // cancel any previous focus queues - if (animationId !== undefined) win.cancelAnimationFrame(animationId); - // element.focus() is a no-op if the element is no longer in the DOM, meaning this is always safe - animationId = win.requestAnimationFrame(function() { - element && element.focus(); - // We are done focusing for this frame, so reset the queued focus element - animationId = undefined; - }); - } + } + function shouldWrapFocus(element2, noWrapDataAttribute, doc) { + var theDoc = getDocument(); + return elementContainsAttribute(element2, noWrapDataAttribute, theDoc) === "true" ? false : true; + } + var animationId = void 0; + function focusAsync(element2) { + if (element2) { + var win = getWindow(element2); + if (win) { + if (animationId !== void 0) { + win.cancelAnimationFrame(animationId); + } + animationId = win.requestAnimationFrame(function() { + element2 && element2.focus(); + animationId = void 0; + }); + } } -} -function getFocusableByIndexPath(parent, path) { - var element = parent; - for(var _i = 0, path_1 = path; _i < path_1.length; _i++){ - var index = path_1[_i]; - var nextChild = element.children[Math.min(index, element.children.length - 1)]; - if (!nextChild) break; - element = nextChild; - } - element = isElementTabbable(element) && isElementVisible(element) ? element : getNextElement(parent, element, true) || getPreviousElement(parent, element); - return element; -} -function getElementIndexPath(fromElement, toElement) { - var path = []; - while(toElement && fromElement && toElement !== fromElement){ - var parent_1 = (0, _getParent.getParent)(toElement, true); - if (parent_1 === null) return []; - path.unshift(Array.prototype.indexOf.call(parent_1.children, toElement)); - toElement = parent_1; - } - return path; -} - -},{"./dom/elementContainsAttribute":"5nhe5","./dom/elementContains":"2CwUJ","./dom/getParent":"jcio6","./dom/getWindow":"aI1a8","./dom/getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jcio6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getParent", ()=>(0, _domUtilities.getParent)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cPL7s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to get bounding client rect. Passing in window will get the window size. - * - * @public - */ parcelHelpers.export(exports, "getRect", ()=>getRect); -var _getWindow = require("./getWindow"); -function getRect(element, win) { - var theWin = (win !== null && win !== void 0 ? win : !element || element && element.hasOwnProperty('devicePixelRatio')) ? (0, _getWindow.getWindow)() : (0, _getWindow.getWindow)(element); - var rect; - if (element) { - if (element === theWin) rect = { - left: 0, - top: 0, - width: theWin.innerWidth, - height: theWin.innerHeight, - right: theWin.innerWidth, - bottom: theWin.innerHeight - }; - else if (element.getBoundingClientRect) rect = element.getBoundingClientRect(); - } - return rect; -} - -},{"./getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"95Nzl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getVirtualParent", ()=>(0, _domUtilities.getVirtualParent)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g1lgp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isVirtualElement", ()=>(0, _domUtilities.isVirtualElement)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmVGg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "on", ()=>on); -function on(element, eventName, callback, options) { - element.addEventListener(eventName, callback, options); + } + function getFocusableByIndexPath(parent, path2) { + var element2 = parent; + for (var _i = 0, path_1 = path2; _i < path_1.length; _i++) { + var index2 = path_1[_i]; + var nextChild = element2.children[Math.min(index2, element2.children.length - 1)]; + if (!nextChild) { + break; + } + element2 = nextChild; + } + element2 = isElementTabbable(element2) && isElementVisible(element2) ? element2 : getNextElement(parent, element2, true) || getPreviousElement(parent, element2); + return element2; + } + function getElementIndexPath(fromElement, toElement) { + var path2 = []; + while (toElement && fromElement && toElement !== fromElement) { + var parent_1 = getParent(toElement, true); + if (parent_1 === null) { + return []; + } + path2.unshift(Array.prototype.indexOf.call(parent_1.children, toElement)); + toElement = parent_1; + } + return path2; + } + function on$1(element2, eventName, callback, options2) { + element2.addEventListener(eventName, callback, options2); return function() { - return element.removeEventListener(eventName, callback, options); - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gxxCf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "portalContainsElement", ()=>(0, _domUtilities.portalContainsElement)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7xL7G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** Raises a click event. - * @deprecated Moved to `FocusZone` component since it was the only place internally using this function. - */ parcelHelpers.export(exports, "raiseClick", ()=>raiseClick); -var _getDocument = require("./getDocument"); -function raiseClick(target, doc) { - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _getDocument.getDocument)(); - var event = createNewEvent('MouseEvents', theDoc); - // eslint-disable-next-line deprecation/deprecation - event.initEvent('click', true, true); - target.dispatchEvent(event); -} -function createNewEvent(eventName, doc) { - var event; - if (typeof Event === 'function') // Chrome, Opera, Firefox - event = new Event(eventName); - else { - // IE - event = doc.createEvent('Event'); - // eslint-disable-next-line deprecation/deprecation - event.initEvent(eventName, true, true); - } - return event; -} - -},{"./getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iieJm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATA_PORTAL_ATTRIBUTE", ()=>(0, _domUtilities.DATA_PORTAL_ATTRIBUTE)); -parcelHelpers.export(exports, "setPortalAttribute", ()=>(0, _domUtilities.setPortalAttribute)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"04xNE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setVirtualParent", ()=>(0, _domUtilities.setVirtualParent)); -var _domUtilities = require("@fluentui/dom-utilities"); - -},{"@fluentui/dom-utilities":"9rkUy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"celWf":[function(require,module,exports,__globalThis) { -/** - * Compares a to b and b to a. - * - * @public - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shallowCompare", ()=>shallowCompare); -/** - * Makes a resulting merge of a bunch of objects. Pass in the target object followed by 1 or more - * objects as arguments and they will be merged sequentially into the target. Note that this will - * shallow merge; it will not create new cloned values for target members. - * - * @public - * @param target - Target object to merge following object arguments into. - * @param args - One or more objects that will be mixed into the target in the order they are provided. - * @returns Resulting merged target. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "assign", ()=>assign); -/** - * Makes a resulting merge of a bunch of objects, but allows a filter function to be passed in to filter - * the resulting merges. This allows for scenarios where you want to merge "everything except that one thing" - * or "properties that start with data-". Note that this will shallow merge; it will not create new cloned - * values for target members. - * - * @public - * @param isAllowed - Callback to determine if the given propName is allowed in the result. - * @param target - Target object to merge following object arguments into. - * @param args - One or more objects that will be mixed into the target in the order they are provided. - * @returns Resulting merged target. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "filteredAssign", ()=>filteredAssign); -/** - * Takes an enum and iterates over each value of the enum (as a string), running the callback on each, - * returning a mapped array. - * @param theEnum - Enum to iterate over - * @param callback - The first parameter the name of the entry, and the second parameter is the value - * of that entry, which is the value you'd normally use when using the enum (usually a number). - */ parcelHelpers.export(exports, "mapEnumByName", ()=>mapEnumByName); -/** - * Get all values in an object dictionary - * - * @param obj - The dictionary to get values for - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "values", ()=>values); -/** - * Tiny helper to do the minimal amount of work in duplicating an object but omitting some - * props. This ends up faster than using object ...rest or reduce to filter. - * - * This behaves very much like filteredAssign, but does not merge many objects together, - * uses an exclusion object map, and avoids spreads all for optimal performance. - * - * See perf test for background: - * https://jsperf.com/omit-vs-rest-vs-reduce/1 - * - * @param obj - The object to clone - * @param exclusions - The array of keys to exclude - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "omit", ()=>omit); -function shallowCompare(a, b) { - if (!a || !b) // only return true if both a and b are falsy - return !a && !b; - for(var propName in a)if (a.hasOwnProperty(propName)) { - if (!b.hasOwnProperty(propName) || b[propName] !== a[propName]) return false; - } - for(var propName in b)if (b.hasOwnProperty(propName)) { - if (!a.hasOwnProperty(propName)) return false; + return element2.removeEventListener(eventName, callback, options2); + }; + } + function shallowCompare(a2, b2) { + if (!a2 || !b2) { + return !a2 && !b2; + } + for (var propName in a2) { + if (a2.hasOwnProperty(propName)) { + if (!b2.hasOwnProperty(propName) || b2[propName] !== a2[propName]) { + return false; + } + } + } + for (var propName in b2) { + if (b2.hasOwnProperty(propName)) { + if (!a2.hasOwnProperty(propName)) { + return false; + } + } } return true; -} -function assign(target) { - var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - return filteredAssign.apply(this, [ - null, - target - ].concat(args)); -} -function filteredAssign(isAllowed, target) { + } + function assign(target2) { var args = []; - for(var _i = 2; _i < arguments.length; _i++)args[_i - 2] = arguments[_i]; - target = target || {}; - for(var _a = 0, args_1 = args; _a < args_1.length; _a++){ - var sourceObject = args_1[_a]; - if (sourceObject) { - for(var propName in sourceObject)if (sourceObject.hasOwnProperty(propName) && (!isAllowed || isAllowed(propName))) target[propName] = sourceObject[propName]; - } - } - return target; -} -function mapEnumByName(// eslint-disable-next-line @typescript-eslint/no-explicit-any -theEnum, callback) { - // map<any> to satisfy compiler since it doesn't realize we strip out undefineds in the .filter() call - return Object.keys(theEnum).map(function(p) { - // map on each property name as a string - if (String(Number(p)) !== p) // if the property is not just a number (because enums in TypeScript will map both ways) - return callback(p, theEnum[p]); - return undefined; - }).filter(function(v) { - return !!v; - }); // only return elements with values -} -function values(obj) { - return Object.keys(obj).reduce(function(arr, key) { - arr.push(obj[key]); - return arr; - }, []); -} -function omit(obj, exclusions) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var result = {}; - for(var key in obj)if (exclusions.indexOf(key) === -1 && obj.hasOwnProperty(key)) result[key] = obj[key]; - return result; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c99qU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATA_IS_SCROLLABLE_ATTRIBUTE", ()=>DATA_IS_SCROLLABLE_ATTRIBUTE); -parcelHelpers.export(exports, "allowScrollOnElement", ()=>allowScrollOnElement); -parcelHelpers.export(exports, "allowOverscrollOnElement", ()=>allowOverscrollOnElement); -/** - * Disables the body scrolling. - * - * @public - */ parcelHelpers.export(exports, "disableBodyScroll", ()=>disableBodyScroll); -/** - * Enables the body scrolling. - * - * @public - */ parcelHelpers.export(exports, "enableBodyScroll", ()=>enableBodyScroll); -/** - * Calculates the width of a scrollbar for the browser/os. - * - * @public - */ parcelHelpers.export(exports, "getScrollbarWidth", ()=>getScrollbarWidth); -/** - * Traverses up the DOM for the element with the data-is-scrollable=true attribute, or returns - * document.body. - * - * @public - */ parcelHelpers.export(exports, "findScrollableParent", ()=>findScrollableParent); -var _getDocument = require("./dom/getDocument"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _getWindow = require("./dom/getWindow"); -var _scrollbarWidth; -var _bodyScrollDisabledCount = 0; -var DisabledScrollClassName = (0, _mergeStyles.mergeStyles)({ - overflow: 'hidden !important' -}); -var DATA_IS_SCROLLABLE_ATTRIBUTE = 'data-is-scrollable'; -var allowScrollOnElement = function(element, events) { - var window = (0, _getWindow.getWindow)(element); - if (!element || !window) return; - var _previousClientY = 0; - var _element = null; - var computedStyles = window.getComputedStyle(element); - // remember the clientY for future calls of _preventOverscrolling - var _saveClientY = function(event) { - if (event.targetTouches.length === 1) _previousClientY = event.targetTouches[0].clientY; - }; - // prevent the body from scrolling when the user attempts - // to scroll past the top or bottom of the element - var _preventOverscrolling = function(event) { - // only respond to a single-finger touch - if (event.targetTouches.length !== 1) return; - // prevent the body touchmove handler from firing - // so that scrolling is allowed within the element - event.stopPropagation(); - if (!_element) return; - var clientY = event.targetTouches[0].clientY - _previousClientY; - var scrollableParent = findScrollableParent(event.target); - if (scrollableParent && _element !== scrollableParent) { - _element = scrollableParent; - computedStyles = window.getComputedStyle(_element); - } - var scrollTop = _element.scrollTop; - var isColumnReverse = (computedStyles === null || computedStyles === void 0 ? void 0 : computedStyles.flexDirection) === 'column-reverse'; - // if the element is scrolled to the top, - // prevent the user from scrolling up - if (scrollTop === 0 && (isColumnReverse ? clientY < 0 : clientY > 0)) event.preventDefault(); - // if the element is scrolled to the bottom, - // prevent the user from scrolling down - if (_element.scrollHeight - Math.abs(Math.ceil(scrollTop)) <= _element.clientHeight && (isColumnReverse ? clientY > 0 : clientY < 0)) event.preventDefault(); - }; - events.on(element, 'touchstart', _saveClientY, { - passive: false - }); - events.on(element, 'touchmove', _preventOverscrolling, { - passive: false - }); - _element = element; -}; -var allowOverscrollOnElement = function(element, events) { - if (!element) return; - var _allowElementScroll = function(event) { - event.stopPropagation(); - }; - events.on(element, 'touchmove', _allowElementScroll, { - passive: false - }); -}; -var _disableIosBodyScroll = function(event) { - event.preventDefault(); -}; -function disableBodyScroll() { - var doc = (0, _getDocument.getDocument)(); - if (doc && doc.body && !_bodyScrollDisabledCount) { - doc.body.classList.add(DisabledScrollClassName); - doc.body.addEventListener('touchmove', _disableIosBodyScroll, { - passive: false, - capture: false - }); - } - _bodyScrollDisabledCount++; -} -function enableBodyScroll() { - if (_bodyScrollDisabledCount > 0) { - var doc = (0, _getDocument.getDocument)(); - if (doc && doc.body && _bodyScrollDisabledCount === 1) { - doc.body.classList.remove(DisabledScrollClassName); - doc.body.removeEventListener('touchmove', _disableIosBodyScroll); - } - _bodyScrollDisabledCount--; - } -} -function getScrollbarWidth(doc) { - if (_scrollbarWidth === undefined) { - var theDoc = doc !== null && doc !== void 0 ? doc : (0, _getDocument.getDocument)(); - var scrollDiv = theDoc.createElement('div'); - scrollDiv.style.setProperty('width', '100px'); - scrollDiv.style.setProperty('height', '100px'); - scrollDiv.style.setProperty('overflow', 'scroll'); - scrollDiv.style.setProperty('position', 'absolute'); - scrollDiv.style.setProperty('top', '-9999px'); - theDoc.body.appendChild(scrollDiv); - // Get the scrollbar width - _scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - // Delete the DIV - theDoc.body.removeChild(scrollDiv); + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; } - return _scrollbarWidth; -} -function findScrollableParent(startingElement) { - var el = startingElement; - var doc = (0, _getDocument.getDocument)(startingElement); - // First do a quick scan for the scrollable attribute. - while(el && el !== doc.body){ - if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) === 'true') return el; - el = el.parentElement; + return filteredAssign.apply(this, [null, target2].concat(args)); + } + function filteredAssign(isAllowed, target2) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + target2 = target2 || {}; + for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) { + var sourceObject = args_1[_a2]; + if (sourceObject) { + for (var propName in sourceObject) { + if (sourceObject.hasOwnProperty(propName) && (!isAllowed || isAllowed(propName))) { + target2[propName] = sourceObject[propName]; + } + } + } } - // If we haven't found it, the use the slower method: compute styles to evaluate if overflow is set. - el = startingElement; - while(el && el !== doc.body){ - if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) !== 'false') { - var computedStyles = getComputedStyle(el); - var overflowY = computedStyles ? computedStyles.getPropertyValue('overflow-y') : ''; - if (overflowY && (overflowY === 'scroll' || overflowY === 'auto')) return el; + return target2; + } + var EventGroup = ( + /** @class */ + (function() { + function EventGroup2(parent) { + this._id = EventGroup2._uniqueId++; + this._parent = parent; + this._eventRecords = []; + } + EventGroup2.raise = function(target2, eventName, eventArgs, bubbleEvent, doc) { + var retVal2; + var theDoc = doc !== null && doc !== void 0 ? doc : getDocument(); + if (EventGroup2._isElement(target2)) { + if (typeof theDoc !== "undefined" && theDoc.createEvent) { + var ev = theDoc.createEvent("HTMLEvents"); + ev.initEvent(eventName, bubbleEvent || false, true); + assign(ev, eventArgs); + retVal2 = target2.dispatchEvent(ev); + } else if (typeof theDoc !== "undefined" && theDoc.createEventObject) { + var evObj = theDoc.createEventObject(eventArgs); + target2.fireEvent("on" + eventName, evObj); + } + } else { + while (target2 && retVal2 !== false) { + var events2 = target2.__events__; + var eventRecords = events2 ? events2[eventName] : null; + if (eventRecords) { + for (var id2 in eventRecords) { + if (eventRecords.hasOwnProperty(id2)) { + var eventRecordList = eventRecords[id2]; + for (var listIndex = 0; retVal2 !== false && listIndex < eventRecordList.length; listIndex++) { + var record = eventRecordList[listIndex]; + if (record.objectCallback) { + retVal2 = record.objectCallback.call(record.parent, eventArgs); + } + } + } + } + } + target2 = bubbleEvent ? target2.parent : null; + } + } + return retVal2; + }; + EventGroup2.isObserved = function(target2, eventName) { + var events2 = target2 && target2.__events__; + return !!events2 && !!events2[eventName]; + }; + EventGroup2.isDeclared = function(target2, eventName) { + var declaredEvents = target2 && target2.__declaredEvents; + return !!declaredEvents && !!declaredEvents[eventName]; + }; + EventGroup2.stopPropagation = function(event2) { + if (event2.stopPropagation) { + event2.stopPropagation(); + } else { + event2.cancelBubble = true; } - el = el.parentElement; + }; + EventGroup2._isElement = function(target2) { + return !!target2 && (!!target2.addEventListener || typeof HTMLElement !== "undefined" && target2 instanceof HTMLElement); + }; + EventGroup2.prototype.dispose = function() { + if (!this._isDisposed) { + this._isDisposed = true; + this.off(); + this._parent = null; + } + }; + EventGroup2.prototype.onAll = function(target2, events2, useCapture) { + for (var eventName in events2) { + if (events2.hasOwnProperty(eventName)) { + this.on(target2, eventName, events2[eventName], useCapture); + } + } + }; + EventGroup2.prototype.on = function(target2, eventName, callback, options2) { + var _this = this; + if (eventName.indexOf(",") > -1) { + var events2 = eventName.split(/[ ,]+/); + for (var i = 0; i < events2.length; i++) { + this.on(target2, events2[i], callback, options2); + } + } else { + var parent_1 = this._parent; + var eventRecord = { + target: target2, + eventName, + parent: parent_1, + callback, + options: options2 + }; + var events2 = target2.__events__ = target2.__events__ || {}; + events2[eventName] = events2[eventName] || { + count: 0 + }; + events2[eventName][this._id] = events2[eventName][this._id] || []; + events2[eventName][this._id].push(eventRecord); + events2[eventName].count++; + if (EventGroup2._isElement(target2)) { + var processElementEvent = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (_this._isDisposed) { + return; + } + var result; + try { + result = callback.apply(parent_1, args); + if (result === false && args[0]) { + var e = args[0]; + if (e.preventDefault) { + e.preventDefault(); + } + if (e.stopPropagation) { + e.stopPropagation(); + } + e.cancelBubble = true; + } + } catch (e3) { + } + return result; + }; + eventRecord.elementCallback = processElementEvent; + if (target2.addEventListener) { + target2.addEventListener(eventName, processElementEvent, options2); + } else if (target2.attachEvent) { + target2.attachEvent("on" + eventName, processElementEvent); + } + } else { + var processObjectEvent = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (_this._isDisposed) { + return; + } + return callback.apply(parent_1, args); + }; + eventRecord.objectCallback = processObjectEvent; + } + this._eventRecords.push(eventRecord); + } + }; + EventGroup2.prototype.off = function(target2, eventName, callback, options2) { + for (var i = 0; i < this._eventRecords.length; i++) { + var eventRecord = this._eventRecords[i]; + if ((!target2 || target2 === eventRecord.target) && (!eventName || eventName === eventRecord.eventName) && (!callback || callback === eventRecord.callback) && (typeof options2 !== "boolean" || options2 === eventRecord.options)) { + var events2 = eventRecord.target.__events__; + var targetArrayLookup = events2[eventRecord.eventName]; + var targetArray = targetArrayLookup ? targetArrayLookup[this._id] : null; + if (targetArray) { + if (targetArray.length === 1 || !callback) { + targetArrayLookup.count -= targetArray.length; + delete events2[eventRecord.eventName][this._id]; + } else { + targetArrayLookup.count--; + targetArray.splice(targetArray.indexOf(eventRecord), 1); + } + if (!targetArrayLookup.count) { + delete events2[eventRecord.eventName]; + } + } + if (eventRecord.elementCallback) { + if (eventRecord.target.removeEventListener) { + eventRecord.target.removeEventListener(eventRecord.eventName, eventRecord.elementCallback, eventRecord.options); + } else if (eventRecord.target.detachEvent) { + eventRecord.target.detachEvent("on" + eventRecord.eventName, eventRecord.elementCallback); + } + } + this._eventRecords.splice(i--, 1); + } + } + }; + EventGroup2.prototype.raise = function(eventName, eventArgs, bubbleEvent) { + return EventGroup2.raise(this._parent, eventName, eventArgs, bubbleEvent); + }; + EventGroup2.prototype.declare = function(event2) { + var declaredEvents = this._parent.__declaredEvents = this._parent.__declaredEvents || {}; + if (typeof event2 === "string") { + declaredEvents[event2] = true; + } else { + for (var i = 0; i < event2.length; i++) { + declaredEvents[event2[i]] = true; + } + } + }; + EventGroup2._uniqueId = 0; + return EventGroup2; + })() + ); + var GLOBAL_STYLESHEET_KEY = "__global__"; + var SHADOW_DOM_STYLESHEET_SETTING = "__shadow_dom_stylesheet__"; + var DEFAULT_SHADOW_CONFIG = { + stylesheetKey: GLOBAL_STYLESHEET_KEY, + inShadow: false, + window: void 0, + __isShadowConfig__: true + }; + var makeShadowConfig = function(stylesheetKey, inShadow, window2) { + return { + stylesheetKey, + inShadow, + window: window2, + __isShadowConfig__: true + }; + }; + var isShadowConfig = function(value2) { + if (!(value2 && isRecord(value2))) { + return false; } - // Fall back to window scroll. - if (!el || el === doc.body) el = (0, _getWindow.getWindow)(startingElement); - return el; -} - -},{"./dom/getDocument":"7EOu7","@fluentui/merge-styles":"bDG2L","./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bDG2L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _mergeStyles.mergeStyles)); -parcelHelpers.export(exports, "mergeCss", ()=>(0, _mergeStyles.mergeCss)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _mergeStyleSets.mergeStyleSets)); -parcelHelpers.export(exports, "mergeCssSets", ()=>(0, _mergeStyleSets.mergeCssSets)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _concatStyleSets.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _concatStyleSetsWithProps.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _fontFace.fontFace)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _keyframes.keyframes)); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _stylesheet.InjectionMode)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _stylesheet.Stylesheet)); -parcelHelpers.export(exports, "ShadowDomStylesheet", ()=>(0, _shadowDomStylesheet.ShadowDomStylesheet)); -parcelHelpers.export(exports, "SUPPORTS_CONSTRUCTABLE_STYLESHEETS", ()=>(0, _shadowDomStylesheet.SUPPORTS_CONSTRUCTABLE_STYLESHEETS)); -parcelHelpers.export(exports, "SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS", ()=>(0, _shadowDomStylesheet.SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS)); -parcelHelpers.export(exports, "setRTL", ()=>(0, _styleOptionsState.setRTL)); -parcelHelpers.export(exports, "DEFAULT_SHADOW_CONFIG", ()=>(0, _shadowConfig.DEFAULT_SHADOW_CONFIG)); -parcelHelpers.export(exports, "GLOBAL_STYLESHEET_KEY", ()=>(0, _shadowConfig.GLOBAL_STYLESHEET_KEY)); -parcelHelpers.export(exports, "makeShadowConfig", ()=>(0, _shadowConfig.makeShadowConfig)); -parcelHelpers.export(exports, "cloneCSSStyleSheet", ()=>(0, _cloneCSSStyleSheet.cloneCSSStyleSheet)); -var _mergeStyles = require("./mergeStyles"); -var _mergeStyleSets = require("./mergeStyleSets"); -var _concatStyleSets = require("./concatStyleSets"); -var _concatStyleSetsWithProps = require("./concatStyleSetsWithProps"); -var _fontFace = require("./fontFace"); -var _keyframes = require("./keyframes"); -var _stylesheet = require("./Stylesheet"); -var _shadowDomStylesheet = require("./ShadowDomStylesheet"); -var _styleOptionsState = require("./StyleOptionsState"); -var _shadowConfig = require("./shadowConfig"); -var _cloneCSSStyleSheet = require("./cloneCSSStyleSheet"); -var _version = require("./version"); - -},{"./mergeStyles":"2LkLK","./mergeStyleSets":"kqzRE","./concatStyleSets":"5Msd3","./concatStyleSetsWithProps":"9Tcvm","./fontFace":"5xypM","./keyframes":"h7yKx","./Stylesheet":"5wD4L","./ShadowDomStylesheet":"4ADZe","./StyleOptionsState":"4aGJx","./shadowConfig":"7TWty","./cloneCSSStyleSheet":"5w3No","./version":"1UJId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2LkLK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Concatenation helper, which can merge class names together. Skips over falsey values. - * - * @public - */ parcelHelpers.export(exports, "mergeStyles", ()=>mergeStyles); -/** - * Concatenation helper, which can merge class names together. Skips over falsey values. - * Accepts a set of options that will be used when calculating styles. - * - * @public - */ parcelHelpers.export(exports, "mergeCss", ()=>mergeCss); -var _extractStyleParts = require("./extractStyleParts"); -var _shadowConfig = require("./shadowConfig"); -var _styleOptionsState = require("./StyleOptionsState"); -var _stylesheet = require("./Stylesheet"); -var _styleToClassName = require("./styleToClassName"); -function mergeStyles() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - return mergeCss(args, (0, _styleOptionsState.getStyleOptions)()); -} -function mergeCss(args, options) { - var styleArgs = args instanceof Array ? args : [ - args - ]; - var opts = options || {}; - var hasShadowConfig = (0, _shadowConfig.isShadowConfig)(styleArgs[0]); - if (hasShadowConfig) opts.shadowConfig = styleArgs[0]; - opts.stylesheet = (0, _stylesheet.Stylesheet).getInstance(opts.shadowConfig); - var _a = (0, _extractStyleParts.extractStyleParts)(opts.stylesheet, styleArgs), classes = _a.classes, objects = _a.objects; - if (objects.length) classes.push((0, _styleToClassName.styleToClassName)(opts, objects)); - return classes.join(' '); -} - -},{"./extractStyleParts":"gPZki","./shadowConfig":"7TWty","./StyleOptionsState":"4aGJx","./Stylesheet":"5wD4L","./styleToClassName":"7B171","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gPZki":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Separates the classes and style objects. Any classes that are pre-registered - * args are auto expanded into objects. - */ parcelHelpers.export(exports, "extractStyleParts", ()=>extractStyleParts); -var _shadowConfig = require("./shadowConfig"); -function extractStyleParts(sheet) { + return value2.__isShadowConfig__ === true; + }; + function isRecord(value2) { + return value2 !== null && typeof value2 === "object" && !Array.isArray(value2); + } + function extractStyleParts(sheet) { var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } var classes = []; var objects = []; - var stylesheet = sheet; + var stylesheet2 = sheet; function _processArgs(argsList) { - for(var _i = 0, argsList_1 = argsList; _i < argsList_1.length; _i++){ - var arg = argsList_1[_i]; - if (arg && !(0, _shadowConfig.isShadowConfig)(arg)) { - if (typeof arg === 'string') { - if (arg.indexOf(' ') >= 0) _processArgs(arg.split(' ')); - else { - var translatedArgs = stylesheet.argsFromClassName(arg); - if (translatedArgs) _processArgs(translatedArgs); - else // Avoid adding the same class twice. - if (classes.indexOf(arg) === -1) classes.push(arg); - } - } else if (Array.isArray(arg)) _processArgs(arg); - else if (typeof arg === 'object') objects.push(arg); + for (var _i2 = 0, argsList_1 = argsList; _i2 < argsList_1.length; _i2++) { + var arg = argsList_1[_i2]; + if (arg && !isShadowConfig(arg)) { + if (typeof arg === "string") { + if (arg.indexOf(" ") >= 0) { + _processArgs(arg.split(" ")); + } else { + var translatedArgs = stylesheet2.argsFromClassName(arg); + if (translatedArgs) { + _processArgs(translatedArgs); + } else { + if (classes.indexOf(arg) === -1) { + classes.push(arg); + } + } } + } else if (Array.isArray(arg)) { + _processArgs(arg); + } else if (typeof arg === "object") { + objects.push(arg); + } } + } } _processArgs(args); return { - classes: classes, - objects: objects - }; -} - -},{"./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7TWty":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GLOBAL_STYLESHEET_KEY", ()=>GLOBAL_STYLESHEET_KEY); -parcelHelpers.export(exports, "SHADOW_DOM_STYLESHEET_SETTING", ()=>SHADOW_DOM_STYLESHEET_SETTING); -parcelHelpers.export(exports, "DEFAULT_SHADOW_CONFIG", ()=>DEFAULT_SHADOW_CONFIG); -parcelHelpers.export(exports, "makeShadowConfig", ()=>makeShadowConfig); -parcelHelpers.export(exports, "isShadowConfig", ()=>isShadowConfig); -var GLOBAL_STYLESHEET_KEY = '__global__'; -var SHADOW_DOM_STYLESHEET_SETTING = '__shadow_dom_stylesheet__'; -var DEFAULT_SHADOW_CONFIG = { - stylesheetKey: GLOBAL_STYLESHEET_KEY, - inShadow: false, - window: undefined, - __isShadowConfig__: true -}; -var makeShadowConfig = function(stylesheetKey, inShadow, window) { - return { - stylesheetKey: stylesheetKey, - inShadow: inShadow, - window: window, - __isShadowConfig__: true - }; -}; -var isShadowConfig = function(value) { - if (!(value && isRecord(value))) return false; - return value.__isShadowConfig__ === true; -}; -function isRecord(value) { - return value !== null && typeof value === 'object' && !Array.isArray(value); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4aGJx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Sets the current RTL value. - */ parcelHelpers.export(exports, "setRTL", ()=>setRTL); -/** - * Gets the current RTL value. - */ parcelHelpers.export(exports, "getRTL", ()=>getRTL); -parcelHelpers.export(exports, "getStyleOptions", ()=>getStyleOptions); -var _shadowConfig = require("./shadowConfig"); -function setRTL(isRTL) { - if (_rtl !== isRTL) _rtl = isRTL; -} -function getRTL() { - if (_rtl === undefined) _rtl = // eslint-disable-next-line no-restricted-globals - typeof document !== 'undefined' && // eslint-disable-next-line no-restricted-globals - !!document.documentElement && // eslint-disable-next-line no-restricted-globals - document.documentElement.getAttribute('dir') === 'rtl'; + classes, + objects + }; + } + function setRTL$1(isRTL) { + if (_rtl !== isRTL) { + _rtl = isRTL; + } + } + function getRTL$1() { + if (_rtl === void 0) { + _rtl = // eslint-disable-next-line no-restricted-globals + typeof document !== "undefined" && // eslint-disable-next-line no-restricted-globals + !!document.documentElement && // eslint-disable-next-line no-restricted-globals + document.documentElement.getAttribute("dir") === "rtl"; + } return _rtl; -} -// This has been split into 2 lines because it was working in Fabric due to the code being transpiled to es5, so this -// was converted to var while not working in Fluent that uses babel to transpile the code to be es6-like. Splitting the -// logic into two lines, however, allows it to work in both scenarios. -var _rtl; -_rtl = getRTL(); -function getStyleOptions() { + } + var _rtl; + _rtl = getRTL$1(); + function getStyleOptions() { return { - rtl: getRTL(), - shadowConfig: (0, _shadowConfig.DEFAULT_SHADOW_CONFIG) - }; -} - -},{"./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5wD4L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InjectionMode", ()=>InjectionMode); -parcelHelpers.export(exports, "STYLESHEET_SETTING", ()=>STYLESHEET_SETTING); -parcelHelpers.export(exports, "Stylesheet", ()=>Stylesheet); -var _tslib = require("tslib"); -var _shadowConfig = require("./shadowConfig"); -var InjectionMode = { + rtl: getRTL$1(), + shadowConfig: DEFAULT_SHADOW_CONFIG + }; + } + var InjectionMode = { /** * Avoids style injection, use getRules() to read the styles. - */ none: 0, + */ + none: 0, /** * Inserts rules using the insertRule api. - */ insertNode: 1, + */ + insertNode: 1, /** * Appends rules using appendChild. - */ appendChild: 2 -}; -var STYLESHEET_SETTING = '__stylesheet__'; -/** - * MSIE 11 doesn't cascade styles based on DOM ordering, but rather on the order that each style node - * is created. As such, to maintain consistent priority, IE11 should reuse a single style node. - */ var REUSE_STYLE_NODE = typeof navigator !== 'undefined' && /rv:11.0/.test(navigator.userAgent); -var _global = {}; -// Grab window. -try { - // Why the cast? - // if compiled/type checked in same program with `@fluentui/font-icons-mdl2` which extends `Window` on global - // ( check packages/font-icons-mdl2/src/index.ts ) the definitions don't match! Thus the need of this extra assertion - _global = window || {}; -} catch (_a) { -/* leave as blank object */ } -var _stylesheet; -/** - * Represents the state of styles registered in the page. Abstracts - * the surface for adding styles to the stylesheet, exposes helpers - * for reading the styles registered in server rendered scenarios. - * - * @public - */ var Stylesheet = /** @class */ function() { - function Stylesheet(config, serializedStylesheet) { - var _a, _b, _c, _d, _e, _f; + */ + appendChild: 2 + }; + var STYLESHEET_SETTING = "__stylesheet__"; + var REUSE_STYLE_NODE = typeof navigator !== "undefined" && /rv:11.0/.test(navigator.userAgent); + var _global$1 = {}; + try { + _global$1 = window || {}; + } catch (_a2) { + } + var _stylesheet; + var Stylesheet = ( + /** @class */ + (function() { + function Stylesheet2(config, serializedStylesheet) { + var _a2, _b2, _c2, _d2, _e2, _f; this._rules = []; this._preservedRules = []; this._counter = 0; @@ -65319,1526 +37028,1175 @@ var _stylesheet; this._onInsertRuleCallbacks = []; this._onResetCallbacks = []; this._classNameToArgs = {}; - // If there is no document we won't have an element to inject into. - this._config = (0, _tslib.__assign)({ - injectionMode: typeof document === 'undefined' ? InjectionMode.none : InjectionMode.insertNode, - defaultPrefix: 'css', - namespace: undefined, - cspSettings: undefined - }, config); - this._classNameToArgs = (_a = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.classNameToArgs) !== null && _a !== void 0 ? _a : this._classNameToArgs; - this._counter = (_b = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.counter) !== null && _b !== void 0 ? _b : this._counter; - this._keyToClassName = (_d = (_c = this._config.classNameCache) !== null && _c !== void 0 ? _c : serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.keyToClassName) !== null && _d !== void 0 ? _d : this._keyToClassName; - this._preservedRules = (_e = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.preservedRules) !== null && _e !== void 0 ? _e : this._preservedRules; + this._config = __assign$1({ injectionMode: typeof document === "undefined" ? InjectionMode.none : InjectionMode.insertNode, defaultPrefix: "css", namespace: void 0, cspSettings: void 0 }, config); + this._classNameToArgs = (_a2 = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.classNameToArgs) !== null && _a2 !== void 0 ? _a2 : this._classNameToArgs; + this._counter = (_b2 = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.counter) !== null && _b2 !== void 0 ? _b2 : this._counter; + this._keyToClassName = (_d2 = (_c2 = this._config.classNameCache) !== null && _c2 !== void 0 ? _c2 : serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.keyToClassName) !== null && _d2 !== void 0 ? _d2 : this._keyToClassName; + this._preservedRules = (_e2 = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.preservedRules) !== null && _e2 !== void 0 ? _e2 : this._preservedRules; this._rules = (_f = serializedStylesheet === null || serializedStylesheet === void 0 ? void 0 : serializedStylesheet.rules) !== null && _f !== void 0 ? _f : this._rules; - } - /** - * Gets the singleton instance. - */ Stylesheet.getInstance = function(shadowConfig) { - _stylesheet = _global[STYLESHEET_SETTING]; - if (_global[0, _shadowConfig.SHADOW_DOM_STYLESHEET_SETTING]) return _global[0, _shadowConfig.SHADOW_DOM_STYLESHEET_SETTING].getInstance(shadowConfig); + } + Stylesheet2.getInstance = function(shadowConfig) { + _stylesheet = _global$1[STYLESHEET_SETTING]; + if (_global$1[SHADOW_DOM_STYLESHEET_SETTING]) { + return _global$1[SHADOW_DOM_STYLESHEET_SETTING].getInstance(shadowConfig); + } if (!_stylesheet || _stylesheet._lastStyleElement && _stylesheet._lastStyleElement.ownerDocument !== document) { - var fabricConfig = (_global === null || _global === void 0 ? void 0 : _global.FabricConfig) || {}; - var stylesheet = new Stylesheet(fabricConfig.mergeStyles, fabricConfig.serializedStylesheet); - _stylesheet = stylesheet; - _global[STYLESHEET_SETTING] = stylesheet; + var fabricConfig = (_global$1 === null || _global$1 === void 0 ? void 0 : _global$1.FabricConfig) || {}; + var stylesheet2 = new Stylesheet2(fabricConfig.mergeStyles, fabricConfig.serializedStylesheet); + _stylesheet = stylesheet2; + _global$1[STYLESHEET_SETTING] = stylesheet2; } return _stylesheet; - }; - /** - * Serializes the Stylesheet instance into a format which allows rehydration on creation. - * @returns string representation of `ISerializedStylesheet` interface. - */ Stylesheet.prototype.serialize = function() { + }; + Stylesheet2.prototype.serialize = function() { return JSON.stringify({ - classNameToArgs: this._classNameToArgs, - counter: this._counter, - keyToClassName: this._keyToClassName, - preservedRules: this._preservedRules, - rules: this._rules + classNameToArgs: this._classNameToArgs, + counter: this._counter, + keyToClassName: this._keyToClassName, + preservedRules: this._preservedRules, + rules: this._rules }); - }; - /** - * Configures the stylesheet. - */ Stylesheet.prototype.setConfig = function(config) { - this._config = (0, _tslib.__assign)((0, _tslib.__assign)({}, this._config), config); - }; - /** - * Configures a reset callback. - * - * @param callback - A callback which will be called when the Stylesheet is reset. - * @returns function which when called un-registers provided callback. - */ Stylesheet.prototype.onReset = function(callback) { + }; + Stylesheet2.prototype.setConfig = function(config) { + this._config = __assign$1(__assign$1({}, this._config), config); + }; + Stylesheet2.prototype.onReset = function(callback) { var _this = this; this._onResetCallbacks.push(callback); return function() { - _this._onResetCallbacks = _this._onResetCallbacks.filter(function(cb) { - return cb !== callback; - }); + _this._onResetCallbacks = _this._onResetCallbacks.filter(function(cb) { + return cb !== callback; + }); }; - }; - /** - * Configures an insert rule callback. - * - * @param callback - A callback which will be called when a rule is inserted. - * @returns function which when called un-registers provided callback. - */ Stylesheet.prototype.onInsertRule = function(callback) { + }; + Stylesheet2.prototype.onInsertRule = function(callback) { var _this = this; this._onInsertRuleCallbacks.push(callback); return function() { - _this._onInsertRuleCallbacks = _this._onInsertRuleCallbacks.filter(function(cb) { - return cb !== callback; - }); + _this._onInsertRuleCallbacks = _this._onInsertRuleCallbacks.filter(function(cb) { + return cb !== callback; + }); }; - }; - /** - * Generates a unique classname. - * - * @param displayName - Optional value to use as a prefix. - */ Stylesheet.prototype.getClassName = function(displayName) { + }; + Stylesheet2.prototype.getClassName = function(displayName) { var namespace = this._config.namespace; var prefix = displayName || this._config.defaultPrefix; - return "".concat(namespace ? namespace + '-' : '').concat(prefix, "-").concat(this._counter++); - }; - /** - * Used internally to cache information about a class which was - * registered with the stylesheet. - */ Stylesheet.prototype.cacheClassName = function(className, key, args, rules) { - this._keyToClassName[this._getCacheKey(key)] = className; - this._classNameToArgs[className] = { - args: args, - rules: rules - }; - }; - /** - * Gets the appropriate classname given a key which was previously - * registered using cacheClassName. - */ Stylesheet.prototype.classNameFromKey = function(key) { - return this._keyToClassName[this._getCacheKey(key)]; - }; - /** - * Gets all classnames cache with the stylesheet. - */ Stylesheet.prototype.getClassNameCache = function() { + return "".concat(namespace ? namespace + "-" : "").concat(prefix, "-").concat(this._counter++); + }; + Stylesheet2.prototype.cacheClassName = function(className2, key2, args, rules2) { + this._keyToClassName[this._getCacheKey(key2)] = className2; + this._classNameToArgs[className2] = { + args, + rules: rules2 + }; + }; + Stylesheet2.prototype.classNameFromKey = function(key2) { + return this._keyToClassName[this._getCacheKey(key2)]; + }; + Stylesheet2.prototype.getClassNameCache = function() { return this._keyToClassName; - }; - /** - * Gets the arguments associated with a given classname which was - * previously registered using cacheClassName. - */ Stylesheet.prototype.argsFromClassName = function(className) { - var entry = this._classNameToArgs[className]; - return entry && entry.args; - }; - /** - * Gets the rules associated with a given classname which was - * previously registered using cacheClassName. - */ Stylesheet.prototype.insertedRulesFromClassName = function(className) { - var entry = this._classNameToArgs[className]; - return entry && entry.rules; - }; - /** - * Inserts a css rule into the stylesheet. - * @param preserve - Preserves the rule beyond a reset boundary. - */ Stylesheet.prototype.insertRule = function(rule, preserve, stylesheetKey) { - if (stylesheetKey === void 0) stylesheetKey = (0, _shadowConfig.GLOBAL_STYLESHEET_KEY); + }; + Stylesheet2.prototype.argsFromClassName = function(className2) { + var entry2 = this._classNameToArgs[className2]; + return entry2 && entry2.args; + }; + Stylesheet2.prototype.insertedRulesFromClassName = function(className2) { + var entry2 = this._classNameToArgs[className2]; + return entry2 && entry2.rules; + }; + Stylesheet2.prototype.insertRule = function(rule2, preserve, stylesheetKey) { + if (stylesheetKey === void 0) { + stylesheetKey = GLOBAL_STYLESHEET_KEY; + } var injectionMode = this._config.injectionMode; - var element = injectionMode !== InjectionMode.none ? this._getStyleElement() : undefined; - if (preserve) this._preservedRules.push(rule); - if (element) switch(injectionMode){ + var element2 = injectionMode !== InjectionMode.none ? this._getStyleElement() : void 0; + if (preserve) { + this._preservedRules.push(rule2); + } + if (element2) { + switch (injectionMode) { case InjectionMode.insertNode: - this._insertRuleIntoSheet(element.sheet, rule); - break; + this._insertRuleIntoSheet(element2.sheet, rule2); + break; case InjectionMode.appendChild: - element.appendChild(document.createTextNode(rule)); - break; + element2.appendChild(document.createTextNode(rule2)); + break; + } + } else { + this._rules.push(rule2); + } + if (this._config.onInsertRule) { + this._config.onInsertRule(rule2); } - else this._rules.push(rule); - // eslint-disable-next-line deprecation/deprecation - if (this._config.onInsertRule) // eslint-disable-next-line deprecation/deprecation - this._config.onInsertRule(rule); this._onInsertRuleCallbacks.forEach(function(callback) { - return callback({ - key: stylesheetKey, - sheet: element ? element.sheet : undefined, - rule: rule - }); + return callback({ key: stylesheetKey, sheet: element2 ? element2.sheet : void 0, rule: rule2 }); }); - }; - /** - * Gets all rules registered with the stylesheet; only valid when - * using InsertionMode.none. - */ Stylesheet.prototype.getRules = function(includePreservedRules) { - return (includePreservedRules ? this._preservedRules.join('') : '') + this._rules.join(''); - }; - /** - * Resets the internal state of the stylesheet. Only used in server - * rendered scenarios where we're using InsertionMode.none. - */ Stylesheet.prototype.reset = function() { + }; + Stylesheet2.prototype.getRules = function(includePreservedRules) { + return (includePreservedRules ? this._preservedRules.join("") : "") + this._rules.join(""); + }; + Stylesheet2.prototype.reset = function() { this._rules = []; this._counter = 0; this._classNameToArgs = {}; this._keyToClassName = {}; this._onResetCallbacks.forEach(function(callback) { - return callback(); + return callback(); }); - }; - // Forces the regeneration of incoming styles without totally resetting the stylesheet. - Stylesheet.prototype.resetKeys = function() { + }; + Stylesheet2.prototype.resetKeys = function() { this._keyToClassName = {}; - }; - Stylesheet.prototype._createStyleElement = function() { - var _a; - var doc = ((_a = this._config.window) === null || _a === void 0 ? void 0 : _a.document) || document; + }; + Stylesheet2.prototype._createStyleElement = function() { + var _a2; + var doc = ((_a2 = this._config.window) === null || _a2 === void 0 ? void 0 : _a2.document) || document; var head = doc.head; - var styleElement = doc.createElement('style'); + var styleElement = doc.createElement("style"); var nodeToInsertBefore = null; - styleElement.setAttribute('data-merge-styles', 'true'); + styleElement.setAttribute("data-merge-styles", "true"); var cspSettings = this._config.cspSettings; if (cspSettings) { - if (cspSettings.nonce) styleElement.setAttribute('nonce', cspSettings.nonce); + if (cspSettings.nonce) { + styleElement.setAttribute("nonce", cspSettings.nonce); + } } - if (this._lastStyleElement) // If the `nextElementSibling` is null, then the insertBefore will act as a regular append. - // https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore#Syntax - nodeToInsertBefore = this._lastStyleElement.nextElementSibling; - else { - var placeholderStyleTag = this._findPlaceholderStyleTag(); - if (placeholderStyleTag) nodeToInsertBefore = placeholderStyleTag.nextElementSibling; - else nodeToInsertBefore = head.childNodes[0]; + if (this._lastStyleElement) { + nodeToInsertBefore = this._lastStyleElement.nextElementSibling; + } else { + var placeholderStyleTag = this._findPlaceholderStyleTag(); + if (placeholderStyleTag) { + nodeToInsertBefore = placeholderStyleTag.nextElementSibling; + } else { + nodeToInsertBefore = head.childNodes[0]; + } } head.insertBefore(styleElement, head.contains(nodeToInsertBefore) ? nodeToInsertBefore : null); this._lastStyleElement = styleElement; return styleElement; - }; - Stylesheet.prototype._insertRuleIntoSheet = function(sheet, rule) { - if (!sheet) return false; + }; + Stylesheet2.prototype._insertRuleIntoSheet = function(sheet, rule2) { + if (!sheet) { + return false; + } try { - sheet.insertRule(rule, sheet.cssRules.length); - return true; + sheet.insertRule(rule2, sheet.cssRules.length); + return true; } catch (e) { - // The browser will throw exceptions on unsupported rules (such as a moz prefix in webkit.) - // We need to swallow the exceptions for this scenario, otherwise we'd need to filter - // which could be slower and bulkier. } return false; - }; - Stylesheet.prototype._getCacheKey = function(key) { - return key; - }; - Stylesheet.prototype._getStyleElement = function() { + }; + Stylesheet2.prototype._getCacheKey = function(key2) { + return key2; + }; + Stylesheet2.prototype._getStyleElement = function() { var _this = this; if (!this._styleElement) { - this._styleElement = this._createStyleElement(); - if (!REUSE_STYLE_NODE) { - // Reset the style element on the next frame. - var win = this._config.window || window; - win.requestAnimationFrame(function() { - _this._styleElement = undefined; - }); - } + this._styleElement = this._createStyleElement(); + if (!REUSE_STYLE_NODE) { + var win = this._config.window || window; + win.requestAnimationFrame(function() { + _this._styleElement = void 0; + }); + } } return this._styleElement; - }; - Stylesheet.prototype._findPlaceholderStyleTag = function() { + }; + Stylesheet2.prototype._findPlaceholderStyleTag = function() { var head = document.head; - if (head) return head.querySelector('style[data-merge-styles]'); + if (head) { + return head.querySelector("style[data-merge-styles]"); + } return null; - }; - return Stylesheet; -}(); - -},{"tslib":"9gizs","./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7B171":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "serializeRuleEntries", ()=>serializeRuleEntries); -parcelHelpers.export(exports, "styleToRegistration", ()=>styleToRegistration); -/** - * Insert style to stylesheet. - * @param registration Style registration. - * @param specificityMultiplier Number of times classname selector is repeated in the css rule. - * This is to increase css specificity in case it's needed. Default to 1. - */ parcelHelpers.export(exports, "applyRegistration", ()=>applyRegistration); -parcelHelpers.export(exports, "styleToClassName", ()=>styleToClassName); -var _tslib = require("tslib"); -var _stylesheet = require("./Stylesheet"); -var _kebabRules = require("./transforms/kebabRules"); -var _prefixRules = require("./transforms/prefixRules"); -var _provideUnits = require("./transforms/provideUnits"); -var _rtlifyRules = require("./transforms/rtlifyRules"); -var _tokenizeWithParentheses = require("./tokenizeWithParentheses"); -var DISPLAY_NAME = 'displayName'; -function getDisplayName(rules) { - var rootStyle = rules && rules['&']; - return rootStyle ? rootStyle.displayName : undefined; -} -var globalSelectorRegExp = /\:global\((.+?)\)/g; -/** - * Finds comma separated selectors in a :global() e.g. ":global(.class1, .class2, .class3)" - * and wraps them each in their own global ":global(.class1), :global(.class2), :global(.class3)" - * - * @param selectorWithGlobals The selector to process - * @returns The updated selector - */ function expandCommaSeparatedGlobals(selectorWithGlobals) { - // We the selector does not have a :global() we can shortcut - if (!globalSelectorRegExp.test(selectorWithGlobals)) return selectorWithGlobals; + }; + return Stylesheet2; + })() + ); + var rules = {}; + function kebabRules(rulePairs, index2) { + var rule2 = rulePairs[index2]; + if (rule2.charAt(0) !== "-") { + rulePairs[index2] = rules[rule2] = rules[rule2] || rule2.replace(/([A-Z])/g, "-$1").toLowerCase(); + } + } + var _vendorSettings; + function getVendorSettings() { + var _a2; + if (!_vendorSettings) { + var doc = typeof document !== "undefined" ? document : void 0; + var nav = typeof navigator !== "undefined" ? navigator : void 0; + var userAgent = (_a2 = nav === null || nav === void 0 ? void 0 : nav.userAgent) === null || _a2 === void 0 ? void 0 : _a2.toLowerCase(); + if (!doc) { + _vendorSettings = { + isWebkit: true, + isMoz: true, + isOpera: true, + isMs: true + }; + } else { + _vendorSettings = { + isWebkit: !!(doc && "WebkitAppearance" in doc.documentElement.style), + isMoz: !!(userAgent && userAgent.indexOf("firefox") > -1), + isOpera: !!(userAgent && userAgent.indexOf("opera") > -1), + isMs: !!(nav && (/rv:11.0/i.test(nav.userAgent) || /Edge\/\d./i.test(navigator.userAgent))) + }; + } + } + return _vendorSettings; + } + var autoPrefixNames = { + "user-select": 1 + }; + function prefixRules(rulePairs, index2) { + var vendorSettings = getVendorSettings(); + var name = rulePairs[index2]; + if (autoPrefixNames[name]) { + var value2 = rulePairs[index2 + 1]; + if (autoPrefixNames[name]) { + if (vendorSettings.isWebkit) { + rulePairs.push("-webkit-" + name, value2); + } + if (vendorSettings.isMoz) { + rulePairs.push("-moz-" + name, value2); + } + if (vendorSettings.isMs) { + rulePairs.push("-ms-" + name, value2); + } + if (vendorSettings.isOpera) { + rulePairs.push("-o-" + name, value2); + } + } + } + } + var NON_PIXEL_NUMBER_PROPS = [ + "column-count", + "font-weight", + "flex", + "flex-grow", + "flex-shrink", + "fill-opacity", + "opacity", + "order", + "z-index", + "zoom" + ]; + function provideUnits(rulePairs, index2) { + var name = rulePairs[index2]; + var value2 = rulePairs[index2 + 1]; + if (typeof value2 === "number") { + var isNonPixelProp = NON_PIXEL_NUMBER_PROPS.indexOf(name) > -1; + var isVariableOrPrefixed = name.indexOf("--") > -1; + var unit2 = isNonPixelProp || isVariableOrPrefixed ? "" : "px"; + rulePairs[index2 + 1] = "".concat(value2).concat(unit2); + } + } + var _a$6; + var LEFT$1 = "left"; + var RIGHT$1 = "right"; + var NO_FLIP = "@noflip"; + var NAME_REPLACEMENTS = (_a$6 = {}, _a$6[LEFT$1] = RIGHT$1, _a$6[RIGHT$1] = LEFT$1, _a$6); + var VALUE_REPLACEMENTS = { + "w-resize": "e-resize", + "sw-resize": "se-resize", + "nw-resize": "ne-resize" + }; + function rtlifyRules(options2, rulePairs, index2) { + if (options2.rtl) { + var name_1 = rulePairs[index2]; + if (!name_1) { + return; + } + var value2 = rulePairs[index2 + 1]; + if (typeof value2 === "string" && value2.indexOf(NO_FLIP) >= 0) { + rulePairs[index2 + 1] = value2.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g, ""); + } else if (name_1.indexOf(LEFT$1) >= 0) { + rulePairs[index2] = name_1.replace(LEFT$1, RIGHT$1); + } else if (name_1.indexOf(RIGHT$1) >= 0) { + rulePairs[index2] = name_1.replace(RIGHT$1, LEFT$1); + } else if (String(value2).indexOf(LEFT$1) >= 0) { + rulePairs[index2 + 1] = value2.replace(LEFT$1, RIGHT$1); + } else if (String(value2).indexOf(RIGHT$1) >= 0) { + rulePairs[index2 + 1] = value2.replace(RIGHT$1, LEFT$1); + } else if (NAME_REPLACEMENTS[name_1]) { + rulePairs[index2] = NAME_REPLACEMENTS[name_1]; + } else if (VALUE_REPLACEMENTS[value2]) { + rulePairs[index2 + 1] = VALUE_REPLACEMENTS[value2]; + } else { + switch (name_1) { + case "margin": + case "padding": + rulePairs[index2 + 1] = flipQuad(value2); + break; + case "box-shadow": + rulePairs[index2 + 1] = negateNum(value2, 0); + break; + } + } + } + } + function negateNum(value2, partIndex) { + var parts = value2.split(" "); + var numberVal = parseInt(parts[partIndex], 10); + parts[0] = parts[0].replace(String(numberVal), String(numberVal * -1)); + return parts.join(" "); + } + function flipQuad(value2) { + if (typeof value2 === "string") { + var parts = value2.split(" "); + if (parts.length === 4) { + return "".concat(parts[0], " ").concat(parts[3], " ").concat(parts[2], " ").concat(parts[1]); + } + } + return value2; + } + function tokenizeWithParentheses(value2) { + var parts = []; + var partStart = 0; + var parens = 0; + for (var i = 0; i < value2.length; i++) { + switch (value2[i]) { + case "(": + parens++; + break; + case ")": + if (parens) { + parens--; + } + break; + case " ": + case " ": + if (!parens) { + if (i > partStart) { + parts.push(value2.substring(partStart, i)); + } + partStart = i + 1; + } + break; + } + } + if (partStart < value2.length) { + parts.push(value2.substring(partStart)); + } + return parts; + } + var DISPLAY_NAME = "displayName"; + function getDisplayName(rules2) { + var rootStyle = rules2 && rules2["&"]; + return rootStyle ? rootStyle.displayName : void 0; + } + var globalSelectorRegExp = /\:global\((.+?)\)/g; + function expandCommaSeparatedGlobals(selectorWithGlobals) { + if (!globalSelectorRegExp.test(selectorWithGlobals)) { + return selectorWithGlobals; + } var replacementInfo = []; var findGlobal = /\:global\((.+?)\)/g; - var match = null; - // Create a result list for global selectors so we can replace them. - while(match = findGlobal.exec(selectorWithGlobals))// Only if the found selector is a comma separated list we'll process it. - if (match[1].indexOf(',') > -1) replacementInfo.push([ - match.index, - match.index + match[0].length, - // Wrap each of the found selectors in :global() - match[1].split(',').map(function(v) { + var match2 = null; + while (match2 = findGlobal.exec(selectorWithGlobals)) { + if (match2[1].indexOf(",") > -1) { + replacementInfo.push([ + match2.index, + match2.index + match2[0].length, + // Wrap each of the found selectors in :global() + match2[1].split(",").map(function(v) { return ":global(".concat(v.trim(), ")"); - }).join(', ') - ]); - // Replace the found selectors with their wrapped variants in reverse order - return replacementInfo.reverse().reduce(function(selector, _a) { - var matchIndex = _a[0], matchEndIndex = _a[1], replacement = _a[2]; - var prefix = selector.slice(0, matchIndex); - var suffix = selector.slice(matchEndIndex); - return prefix + replacement + suffix; + }).join(", ") + ]); + } + } + return replacementInfo.reverse().reduce(function(selector, _a2) { + var matchIndex = _a2[0], matchEndIndex = _a2[1], replacement = _a2[2]; + var prefix = selector.slice(0, matchIndex); + var suffix = selector.slice(matchEndIndex); + return prefix + replacement + suffix; }, selectorWithGlobals); -} -function isSelector(potentialSelector) { - return potentialSelector.indexOf(':global(') >= 0 || potentialSelector.indexOf(':') === 0; -} -function expandSelector(newSelector, currentSelector) { - if (newSelector.indexOf(':global(') >= 0) return newSelector.replace(globalSelectorRegExp, '$1'); - else if (newSelector.indexOf(':host(') === 0) return newSelector; - else if (newSelector.indexOf(':') === 0) return currentSelector + newSelector; - else if (newSelector.indexOf('&') < 0) return currentSelector + ' ' + newSelector; + } + function isSelector(potentialSelector) { + return potentialSelector.indexOf(":global(") >= 0 || potentialSelector.indexOf(":") === 0; + } + function expandSelector(newSelector, currentSelector) { + if (newSelector.indexOf(":global(") >= 0) { + return newSelector.replace(globalSelectorRegExp, "$1"); + } else if (newSelector.indexOf(":host(") === 0) { + return newSelector; + } else if (newSelector.indexOf(":") === 0) { + return currentSelector + newSelector; + } else if (newSelector.indexOf("&") < 0) { + return currentSelector + " " + newSelector; + } return newSelector; -} -function extractSelector(currentSelector, rules, selector, value, stylesheet) { - if (rules === void 0) rules = { - __order: [] - }; - if (selector.indexOf('@') === 0) { - selector = selector + '{' + currentSelector; - extractRules([ - value - ], rules, selector, stylesheet); - } else if (selector.indexOf(',') > -1) expandCommaSeparatedGlobals(selector).split(',').map(function(s) { - return s.trim(); - }).forEach(function(separatedSelector) { - return extractRules([ - value - ], rules, expandSelector(separatedSelector, currentSelector), stylesheet); - }); - else extractRules([ - value - ], rules, expandSelector(selector, currentSelector), stylesheet); -} -function extractRules(args, rules, currentSelector, stylesheet) { - if (rules === void 0) rules = { - __order: [] - }; - if (currentSelector === void 0) currentSelector = '&'; - var currentRules = rules[currentSelector]; + } + function extractSelector(currentSelector, rules2, selector, value2, stylesheet2) { + if (rules2 === void 0) { + rules2 = { __order: [] }; + } + if (selector.indexOf("@") === 0) { + selector = selector + "{" + currentSelector; + extractRules([value2], rules2, selector, stylesheet2); + } else if (selector.indexOf(",") > -1) { + expandCommaSeparatedGlobals(selector).split(",").map(function(s2) { + return s2.trim(); + }).forEach(function(separatedSelector) { + return extractRules([value2], rules2, expandSelector(separatedSelector, currentSelector), stylesheet2); + }); + } else { + extractRules([value2], rules2, expandSelector(selector, currentSelector), stylesheet2); + } + } + function extractRules(args, rules2, currentSelector, stylesheet2) { + if (rules2 === void 0) { + rules2 = { __order: [] }; + } + if (currentSelector === void 0) { + currentSelector = "&"; + } + var currentRules = rules2[currentSelector]; if (!currentRules) { - currentRules = {}; - rules[currentSelector] = currentRules; - rules.__order.push(currentSelector); - } - for(var _i = 0, args_1 = args; _i < args_1.length; _i++){ - var arg = args_1[_i]; - // If the arg is a string, we need to look up the class map and merge. - if (typeof arg === 'string') { - var expandedRules = stylesheet.argsFromClassName(arg); - if (expandedRules) extractRules(expandedRules, rules, currentSelector, stylesheet); - // Else if the arg is an array, we need to recurse in. - } else if (Array.isArray(arg)) extractRules(arg, rules, currentSelector, stylesheet); - else { - for(var prop in arg)if (arg.hasOwnProperty(prop)) { - var propValue = arg[prop]; - if (prop === 'selectors') { - // every child is a selector. - var selectors = arg.selectors; - for(var newSelector in selectors)if (selectors.hasOwnProperty(newSelector)) extractSelector(currentSelector, rules, newSelector, selectors[newSelector], stylesheet); - } else if (typeof propValue === 'object' || isSelector(prop)) // prop is a selector. - { - if (propValue !== null && propValue !== undefined) extractSelector(currentSelector, rules, prop, propValue, stylesheet); - } else if (propValue !== undefined) { - // Else, add the rule to the currentSelector. - if (prop === 'margin' || prop === 'padding') expandQuads(currentRules, prop, propValue); - else currentRules[prop] = propValue; + currentRules = {}; + rules2[currentSelector] = currentRules; + rules2.__order.push(currentSelector); + } + for (var _i = 0, args_1 = args; _i < args_1.length; _i++) { + var arg = args_1[_i]; + if (typeof arg === "string") { + var expandedRules = stylesheet2.argsFromClassName(arg); + if (expandedRules) { + extractRules(expandedRules, rules2, currentSelector, stylesheet2); + } + } else if (Array.isArray(arg)) { + extractRules(arg, rules2, currentSelector, stylesheet2); + } else { + for (var prop in arg) { + if (arg.hasOwnProperty(prop)) { + var propValue = arg[prop]; + if (prop === "selectors") { + var selectors = arg.selectors; + for (var newSelector in selectors) { + if (selectors.hasOwnProperty(newSelector)) { + extractSelector(currentSelector, rules2, newSelector, selectors[newSelector], stylesheet2); + } + } + } else if (typeof propValue === "object" || isSelector(prop)) { + if (propValue !== null && propValue !== void 0) { + extractSelector(currentSelector, rules2, prop, propValue, stylesheet2); + } + } else { + if (propValue !== void 0) { + if (prop === "margin" || prop === "padding") { + expandQuads(currentRules, prop, propValue); + } else { + currentRules[prop] = propValue; } + } } + } } + } } - return rules; -} -function expandQuads(currentRules, name, value) { - var parts = typeof value === 'string' ? (0, _tokenizeWithParentheses.tokenizeWithParentheses)(value) : [ - value - ]; - if (parts.length === 0) parts.push(value); - if (parts[parts.length - 1] === '!important') // Remove !important from parts, and append it to each part individually - parts = parts.slice(0, -1).map(function(p) { - return p + ' !important'; - }); - currentRules[name + 'Top'] = parts[0]; - currentRules[name + 'Right'] = parts[1] || parts[0]; - currentRules[name + 'Bottom'] = parts[2] || parts[0]; - currentRules[name + 'Left'] = parts[3] || parts[1] || parts[0]; -} -function getKeyForRules(options, rules) { - var serialized = [ - options.rtl ? 'rtl' : 'ltr' - ]; + return rules2; + } + function expandQuads(currentRules, name, value2) { + var parts = typeof value2 === "string" ? tokenizeWithParentheses(value2) : [value2]; + if (parts.length === 0) { + parts.push(value2); + } + if (parts[parts.length - 1] === "!important") { + parts = parts.slice(0, -1).map(function(p) { + return p + " !important"; + }); + } + currentRules[name + "Top"] = parts[0]; + currentRules[name + "Right"] = parts[1] || parts[0]; + currentRules[name + "Bottom"] = parts[2] || parts[0]; + currentRules[name + "Left"] = parts[3] || parts[1] || parts[0]; + } + function getKeyForRules(options2, rules2) { + var serialized = [options2.rtl ? "rtl" : "ltr"]; var hasProps = false; - for(var _i = 0, _a = rules.__order; _i < _a.length; _i++){ - var selector = _a[_i]; - serialized.push(selector); - var rulesForSelector = rules[selector]; - for(var propName in rulesForSelector)if (rulesForSelector.hasOwnProperty(propName) && rulesForSelector[propName] !== undefined) { - hasProps = true; - serialized.push(propName, rulesForSelector[propName]); - } - } - return hasProps ? serialized.join('') : undefined; -} -function repeatString(target, count) { - if (count <= 0) return ''; - if (count === 1) return target; - return target + repeatString(target, count - 1); -} -function serializeRuleEntries(options, ruleEntries) { - if (!ruleEntries) return ''; + for (var _i = 0, _a2 = rules2.__order; _i < _a2.length; _i++) { + var selector = _a2[_i]; + serialized.push(selector); + var rulesForSelector = rules2[selector]; + for (var propName in rulesForSelector) { + if (rulesForSelector.hasOwnProperty(propName) && rulesForSelector[propName] !== void 0) { + hasProps = true; + serialized.push(propName, rulesForSelector[propName]); + } + } + } + return hasProps ? serialized.join("") : void 0; + } + function repeatString(target2, count2) { + if (count2 <= 0) { + return ""; + } + if (count2 === 1) { + return target2; + } + return target2 + repeatString(target2, count2 - 1); + } + function serializeRuleEntries(options2, ruleEntries) { + if (!ruleEntries) { + return ""; + } var allEntries = []; - for(var entry in ruleEntries)if (ruleEntries.hasOwnProperty(entry) && entry !== DISPLAY_NAME && ruleEntries[entry] !== undefined) allEntries.push(entry, ruleEntries[entry]); - // Apply transforms. - for(var i = 0; i < allEntries.length; i += 2){ - (0, _kebabRules.kebabRules)(allEntries, i); - (0, _provideUnits.provideUnits)(allEntries, i); - (0, _rtlifyRules.rtlifyRules)(options, allEntries, i); - (0, _prefixRules.prefixRules)(allEntries, i); - } - // Apply punctuation. - for(var i = 1; i < allEntries.length; i += 4)allEntries.splice(i, 1, ':', allEntries[i], ';'); - return allEntries.join(''); -} -function styleToRegistration(options) { - var _a; + for (var entry2 in ruleEntries) { + if (ruleEntries.hasOwnProperty(entry2) && entry2 !== DISPLAY_NAME && ruleEntries[entry2] !== void 0) { + allEntries.push(entry2, ruleEntries[entry2]); + } + } + for (var i = 0; i < allEntries.length; i += 2) { + kebabRules(allEntries, i); + provideUnits(allEntries, i); + rtlifyRules(options2, allEntries, i); + prefixRules(allEntries, i); + } + for (var i = 1; i < allEntries.length; i += 4) { + allEntries.splice(i, 1, ":", allEntries[i], ";"); + } + return allEntries.join(""); + } + function styleToRegistration(options2) { + var _a2; var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - var stylesheet = (_a = options.stylesheet) !== null && _a !== void 0 ? _a : (0, _stylesheet.Stylesheet).getInstance(options.shadowConfig); - var rules = extractRules(args, undefined, undefined, stylesheet); - var key = getKeyForRules(options, rules); - if (key) { - var registration = { - className: stylesheet.classNameFromKey(key), - key: key, - args: args - }; - if (!registration.className) { - registration.className = stylesheet.getClassName(getDisplayName(rules)); - var rulesToInsert = []; - for(var _b = 0, _c = rules.__order; _b < _c.length; _b++){ - var selector = _c[_b]; - rulesToInsert.push(selector, serializeRuleEntries(options, rules[selector])); - } - registration.rulesToInsert = rulesToInsert; - } - return registration; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var stylesheet2 = (_a2 = options2.stylesheet) !== null && _a2 !== void 0 ? _a2 : Stylesheet.getInstance(options2.shadowConfig); + var rules2 = extractRules(args, void 0, void 0, stylesheet2); + var key2 = getKeyForRules(options2, rules2); + if (key2) { + var registration = { + className: stylesheet2.classNameFromKey(key2), + key: key2, + args + }; + if (!registration.className) { + registration.className = stylesheet2.getClassName(getDisplayName(rules2)); + var rulesToInsert = []; + for (var _b2 = 0, _c2 = rules2.__order; _b2 < _c2.length; _b2++) { + var selector = _c2[_b2]; + rulesToInsert.push(selector, serializeRuleEntries(options2, rules2[selector])); + } + registration.rulesToInsert = rulesToInsert; + } + return registration; + } + return void 0; + } + function applyRegistration(registration, specificityMultiplier, shadowConfig, sheet) { + if (specificityMultiplier === void 0) { + specificityMultiplier = 1; } - return undefined; -} -function applyRegistration(registration, specificityMultiplier, shadowConfig, sheet) { - if (specificityMultiplier === void 0) specificityMultiplier = 1; - var stylesheet = sheet !== null && sheet !== void 0 ? sheet : (0, _stylesheet.Stylesheet).getInstance(shadowConfig); - var className = registration.className, key = registration.key, args = registration.args, rulesToInsert = registration.rulesToInsert; + var stylesheet2 = sheet !== null && sheet !== void 0 ? sheet : Stylesheet.getInstance(shadowConfig); + var className2 = registration.className, key2 = registration.key, args = registration.args, rulesToInsert = registration.rulesToInsert; if (rulesToInsert) { - // rulesToInsert is an ordered array of selector/rule pairs. - for(var i = 0; i < rulesToInsert.length; i += 2){ - var rules = rulesToInsert[i + 1]; - if (rules) { - var selector = rulesToInsert[i]; - selector = selector.replace(/&/g, repeatString(".".concat(registration.className), specificityMultiplier)); - // Insert. Note if a media query, we must close the query with a final bracket. - var processedRule = "".concat(selector, "{").concat(rules, "}").concat(selector.indexOf('@') === 0 ? '}' : ''); - stylesheet.insertRule(processedRule); - } + for (var i = 0; i < rulesToInsert.length; i += 2) { + var rules2 = rulesToInsert[i + 1]; + if (rules2) { + var selector = rulesToInsert[i]; + selector = selector.replace(/&/g, repeatString(".".concat(registration.className), specificityMultiplier)); + var processedRule = "".concat(selector, "{").concat(rules2, "}").concat(selector.indexOf("@") === 0 ? "}" : ""); + stylesheet2.insertRule(processedRule); } - stylesheet.cacheClassName(className, key, args, rulesToInsert); + } + stylesheet2.cacheClassName(className2, key2, args, rulesToInsert); } -} -function styleToClassName(options) { + } + function styleToClassName(options2) { var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - var registration = styleToRegistration.apply(void 0, (0, _tslib.__spreadArray)([ - options - ], args, false)); - if (registration) { - applyRegistration(registration, options.specificityMultiplier, options.shadowConfig, options.stylesheet); - return registration.className; - } - return ''; -} - -},{"tslib":"9gizs","./Stylesheet":"5wD4L","./transforms/kebabRules":"e0Xsp","./transforms/prefixRules":"gYDpi","./transforms/provideUnits":"8SfBA","./transforms/rtlifyRules":"896Tj","./tokenizeWithParentheses":"2ckEI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0Xsp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "kebabRules", ()=>kebabRules); -var rules = {}; -function kebabRules(rulePairs, index) { - var rule = rulePairs[index]; - if (rule.charAt(0) !== '-') rulePairs[index] = rules[rule] = rules[rule] || rule.replace(/([A-Z])/g, '-$1').toLowerCase(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gYDpi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixRules", ()=>prefixRules); -var _getVendorSettings = require("../getVendorSettings"); -var autoPrefixNames = { - 'user-select': 1 -}; -function prefixRules(rulePairs, index) { - var vendorSettings = (0, _getVendorSettings.getVendorSettings)(); - var name = rulePairs[index]; - if (autoPrefixNames[name]) { - var value = rulePairs[index + 1]; - if (autoPrefixNames[name]) { - if (vendorSettings.isWebkit) rulePairs.push('-webkit-' + name, value); - if (vendorSettings.isMoz) rulePairs.push('-moz-' + name, value); - if (vendorSettings.isMs) rulePairs.push('-ms-' + name, value); - if (vendorSettings.isOpera) rulePairs.push('-o-' + name, value); - } - } -} - -},{"../getVendorSettings":"ctDJu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ctDJu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getVendorSettings", ()=>getVendorSettings); -/** - * Sets the vendor settings for prefixing and vendor specific operations. - */ parcelHelpers.export(exports, "setVendorSettings", ()=>setVendorSettings); -var _vendorSettings; -function getVendorSettings() { - var _a; - if (!_vendorSettings) { - // eslint-disable-next-line no-restricted-globals - var doc = typeof document !== 'undefined' ? document : undefined; - var nav = typeof navigator !== 'undefined' ? navigator : undefined; - var userAgent = (_a = nav === null || nav === void 0 ? void 0 : nav.userAgent) === null || _a === void 0 ? void 0 : _a.toLowerCase(); - if (!doc) _vendorSettings = { - isWebkit: true, - isMoz: true, - isOpera: true, - isMs: true - }; - else _vendorSettings = { - isWebkit: !!(doc && 'WebkitAppearance' in doc.documentElement.style), - isMoz: !!(userAgent && userAgent.indexOf('firefox') > -1), - isOpera: !!(userAgent && userAgent.indexOf('opera') > -1), - isMs: !!(nav && (/rv:11.0/i.test(nav.userAgent) || /Edge\/\d./i.test(navigator.userAgent))) - }; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; } - return _vendorSettings; -} -function setVendorSettings(vendorSettings) { - _vendorSettings = vendorSettings; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8SfBA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "provideUnits", ()=>provideUnits); -var NON_PIXEL_NUMBER_PROPS = [ - 'column-count', - 'font-weight', - 'flex', - 'flex-grow', - 'flex-shrink', - 'fill-opacity', - 'opacity', - 'order', - 'z-index', - 'zoom' -]; -function provideUnits(rulePairs, index) { - var name = rulePairs[index]; - var value = rulePairs[index + 1]; - if (typeof value === 'number') { - var isNonPixelProp = NON_PIXEL_NUMBER_PROPS.indexOf(name) > -1; - var isVariableOrPrefixed = name.indexOf('--') > -1; - var unit = isNonPixelProp || isVariableOrPrefixed ? '' : 'px'; - rulePairs[index + 1] = "".concat(value).concat(unit); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"896Tj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * RTLifies the rulePair in the array at the current index. This mutates the array for performance - * reasons. - */ parcelHelpers.export(exports, "rtlifyRules", ()=>rtlifyRules); -var _a; -var LEFT = 'left'; -var RIGHT = 'right'; -var NO_FLIP = '@noflip'; -var NAME_REPLACEMENTS = (_a = {}, _a[LEFT] = RIGHT, _a[RIGHT] = LEFT, _a); -var VALUE_REPLACEMENTS = { - 'w-resize': 'e-resize', - 'sw-resize': 'se-resize', - 'nw-resize': 'ne-resize' -}; -function rtlifyRules(options, rulePairs, index) { - if (options.rtl) { - var name_1 = rulePairs[index]; - if (!name_1) return; - var value = rulePairs[index + 1]; - if (typeof value === 'string' && value.indexOf(NO_FLIP) >= 0) rulePairs[index + 1] = value.replace(/\s*(?:\/\*\s*)?\@noflip\b(?:\s*\*\/)?\s*?/g, ''); - else if (name_1.indexOf(LEFT) >= 0) rulePairs[index] = name_1.replace(LEFT, RIGHT); - else if (name_1.indexOf(RIGHT) >= 0) rulePairs[index] = name_1.replace(RIGHT, LEFT); - else if (String(value).indexOf(LEFT) >= 0) rulePairs[index + 1] = value.replace(LEFT, RIGHT); - else if (String(value).indexOf(RIGHT) >= 0) rulePairs[index + 1] = value.replace(RIGHT, LEFT); - else if (NAME_REPLACEMENTS[name_1]) rulePairs[index] = NAME_REPLACEMENTS[name_1]; - else if (VALUE_REPLACEMENTS[value]) rulePairs[index + 1] = VALUE_REPLACEMENTS[value]; - else switch(name_1){ - case 'margin': - case 'padding': - rulePairs[index + 1] = flipQuad(value); - break; - case 'box-shadow': - rulePairs[index + 1] = negateNum(value, 0); - break; - } + var registration = styleToRegistration.apply(void 0, __spreadArray([options2], args, false)); + if (registration) { + applyRegistration(registration, options2.specificityMultiplier, options2.shadowConfig, options2.stylesheet); + return registration.className; } -} -/** - * Given a string value in a space delimited format (e.g. "1 2 3 4"), negates a particular value. - */ function negateNum(value, partIndex) { - var parts = value.split(' '); - var numberVal = parseInt(parts[partIndex], 10); - parts[0] = parts[0].replace(String(numberVal), String(numberVal * -1)); - return parts.join(' '); -} -/** - * Given a string quad, flips the left and right values. - */ function flipQuad(value) { - if (typeof value === 'string') { - var parts = value.split(' '); - if (parts.length === 4) return "".concat(parts[0], " ").concat(parts[3], " ").concat(parts[2], " ").concat(parts[1]); - } - return value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2ckEI":[function(require,module,exports,__globalThis) { -/** - * Split a string into tokens separated by whitespace, except all text within parentheses - * is treated as a single token (whitespace is ignored within parentheses). - * - * Unlike String.split(' '), multiple consecutive space characters are collapsed and - * removed from the returned array (including leading and trailing spaces). - * - * For example: - * `tokenizeWithParentheses("3px calc(var(--x) / 2) 9px 0 ")` - * => `["3px", "calc(var(--x) / 2)", "9px", "0"]` - * - * @returns The array of tokens. Returns an empty array if the string was empty or contained only whitespace. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "tokenizeWithParentheses", ()=>tokenizeWithParentheses); -function tokenizeWithParentheses(value) { - var parts = []; - var partStart = 0; - var parens = 0; - for(var i = 0; i < value.length; i++)switch(value[i]){ - case '(': - parens++; - break; - case ')': - if (parens) parens--; - break; - case '\t': - case ' ': - if (!parens) { - // Add the new part if it's not an empty string - if (i > partStart) parts.push(value.substring(partStart, i)); - partStart = i + 1; - } - break; + return ""; + } + function mergeStyles() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; } - // Add the last part - if (partStart < value.length) parts.push(value.substring(partStart)); - return parts; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kqzRE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Takes in one or more style set objects, each consisting of a set of areas, - * each which will produce a class name. Using this is analogous to calling - * `mergeStyles` for each property in the object, but ensures we maintain the - * set ordering when multiple style sets are merged. - * - * @param styleSets - One or more style sets to be merged. - */ parcelHelpers.export(exports, "mergeStyleSets", ()=>mergeStyleSets); -/** - * Takes in one or more style set objects, each1consisting of a set of areas, - * each which will produce a class name. Using this is analogous to calling - * `mergeCss` for each property in the object, but ensures the - * set ordering when multiple style sets are merged. - * - * @param styleSets - One or more style sets to be merged. - * @param options - (optional) Options to use when creating rules. - */ parcelHelpers.export(exports, "mergeCssSets", ()=>mergeCssSets); -var _tslib = require("tslib"); -var _concatStyleSets = require("./concatStyleSets"); -var _extractStyleParts = require("./extractStyleParts"); -var _styleOptionsState = require("./StyleOptionsState"); -var _styleToClassName = require("./styleToClassName"); -var _shadowConfig = require("./shadowConfig"); -var _stylesheet = require("./Stylesheet"); -function mergeStyleSets() { + return mergeCss(args, getStyleOptions()); + } + function mergeCss(args, options2) { + var styleArgs = args instanceof Array ? args : [args]; + var opts = options2 || {}; + var hasShadowConfig = isShadowConfig(styleArgs[0]); + if (hasShadowConfig) { + opts.shadowConfig = styleArgs[0]; + } + opts.stylesheet = Stylesheet.getInstance(opts.shadowConfig); + var _a2 = extractStyleParts(opts.stylesheet, styleArgs), classes = _a2.classes, objects = _a2.objects; + if (objects.length) { + classes.push(styleToClassName(opts, objects)); + } + return classes.join(" "); + } + function concatStyleSets() { var styleSets = []; - for(var _i = 0; _i < arguments.length; _i++)styleSets[_i] = arguments[_i]; - return mergeCssSets(styleSets, (0, _styleOptionsState.getStyleOptions)()); -} -function mergeCssSets(styleSets, options) { - var classNameSet = { - subComponentStyles: {} - }; - var shadowConfig = undefined; - var styleSet; - if ((0, _shadowConfig.isShadowConfig)(styleSets[0])) { - shadowConfig = styleSets[0]; - styleSet = styleSets[1]; - } else styleSet = styleSets[0]; - shadowConfig !== null && shadowConfig !== void 0 ? shadowConfig : shadowConfig = options === null || options === void 0 ? void 0 : options.shadowConfig; - var opts = (0, _tslib.__assign)((0, _tslib.__assign)({}, options), { - shadowConfig: shadowConfig - }); - if (!styleSet && styleSets.length <= 1) return { - subComponentStyles: {} - }; - var sheet = (0, _stylesheet.Stylesheet).getInstance(shadowConfig); - opts.stylesheet = sheet; - var concatenatedStyleSet = (0, _concatStyleSets.concatStyleSets).apply(void 0, styleSets); - var registrations = []; - for(var styleSetArea in concatenatedStyleSet)if (concatenatedStyleSet.hasOwnProperty(styleSetArea)) { - if (styleSetArea === 'subComponentStyles') { - classNameSet.subComponentStyles = concatenatedStyleSet.subComponentStyles || {}; - continue; - } else if (styleSetArea === '__shadowConfig__') continue; - var styles = concatenatedStyleSet[styleSetArea]; - var _a = (0, _extractStyleParts.extractStyleParts)(sheet, styles), classes = _a.classes, objects = _a.objects; - if (objects === null || objects === void 0 ? void 0 : objects.length) { - var registration = (0, _styleToClassName.styleToRegistration)(opts || {}, { - displayName: styleSetArea - }, objects); - if (registration) { - registrations.push(registration); - classNameSet[styleSetArea] = classes.concat([ - registration.className - ]).join(' '); - } - } else classNameSet[styleSetArea] = classes.join(' '); + for (var _i = 0; _i < arguments.length; _i++) { + styleSets[_i] = arguments[_i]; } - for(var _i = 0, registrations_1 = registrations; _i < registrations_1.length; _i++){ - var registration = registrations_1[_i]; - if (registration) (0, _styleToClassName.applyRegistration)(registration, options === null || options === void 0 ? void 0 : options.specificityMultiplier, shadowConfig); + if (styleSets && styleSets.length === 1 && styleSets[0] && !styleSets[0].subComponentStyles && !isShadowConfig(styleSets[0])) { + return styleSets[0]; } - return classNameSet; -} - -},{"tslib":"9gizs","./concatStyleSets":"5Msd3","./extractStyleParts":"gPZki","./StyleOptionsState":"4aGJx","./styleToClassName":"7B171","./shadowConfig":"7TWty","./Stylesheet":"5wD4L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Msd3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Combine a set of styles together (but does not register css classes). - * @param styleSets - One or more stylesets to be merged (each param can also be falsy). - */ parcelHelpers.export(exports, "concatStyleSets", ()=>concatStyleSets); -var _tslib = require("tslib"); -var _shadowConfig = require("./shadowConfig"); -function concatStyleSets() { - var styleSets = []; - for(var _i = 0; _i < arguments.length; _i++)styleSets[_i] = arguments[_i]; - if (styleSets && styleSets.length === 1 && styleSets[0] && !styleSets[0].subComponentStyles && !(0, _shadowConfig.isShadowConfig)(styleSets[0])) return styleSets[0]; var mergedSet = {}; - // We process sub component styles in two phases. First we collect them, then we combine them into 1 style function. var workingSubcomponentStyles = {}; - for(var _a = 0, styleSets_1 = styleSets; _a < styleSets_1.length; _a++){ - var currentSet = styleSets_1[_a]; - if (currentSet && !(0, _shadowConfig.isShadowConfig)(currentSet)) { - for(var prop in currentSet)if (currentSet.hasOwnProperty(prop)) { - if (prop === 'subComponentStyles' && currentSet.subComponentStyles !== undefined) { - // subcomponent styles - style functions or objects - var currentComponentStyles = currentSet.subComponentStyles; - for(var subCompProp in currentComponentStyles)if (currentComponentStyles.hasOwnProperty(subCompProp)) { - if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) workingSubcomponentStyles[subCompProp].push(currentComponentStyles[subCompProp]); - else workingSubcomponentStyles[subCompProp] = [ - currentComponentStyles[subCompProp] - ]; - } - continue; + for (var _a2 = 0, styleSets_1 = styleSets; _a2 < styleSets_1.length; _a2++) { + var currentSet = styleSets_1[_a2]; + if (currentSet && !isShadowConfig(currentSet)) { + for (var prop in currentSet) { + if (currentSet.hasOwnProperty(prop)) { + if (prop === "subComponentStyles" && currentSet.subComponentStyles !== void 0) { + var currentComponentStyles = currentSet.subComponentStyles; + for (var subCompProp in currentComponentStyles) { + if (currentComponentStyles.hasOwnProperty(subCompProp)) { + if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) { + workingSubcomponentStyles[subCompProp].push(currentComponentStyles[subCompProp]); + } else { + workingSubcomponentStyles[subCompProp] = [currentComponentStyles[subCompProp]]; + } } - // the as any casts below is a workaround for ts 2.8. - // todo: remove cast to any in ts 2.9. - var mergedValue = mergedSet[prop]; - var currentValue = currentSet[prop]; - if (mergedValue === undefined) mergedSet[prop] = currentValue; - else mergedSet[prop] = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], Array.isArray(mergedValue) ? mergedValue : [ - mergedValue - ], true), Array.isArray(currentValue) ? currentValue : [ - currentValue - ], true); + } + continue; } + var mergedValue = mergedSet[prop]; + var currentValue = currentSet[prop]; + if (mergedValue === void 0) { + mergedSet[prop] = currentValue; + } else { + mergedSet[prop] = __spreadArray(__spreadArray([], Array.isArray(mergedValue) ? mergedValue : [mergedValue], true), Array.isArray(currentValue) ? currentValue : [currentValue], true); + } + } } + } } if (Object.keys(workingSubcomponentStyles).length > 0) { - mergedSet.subComponentStyles = {}; - var mergedSubStyles = mergedSet.subComponentStyles; - var _loop_1 = function(subCompProp) { - if (workingSubcomponentStyles.hasOwnProperty(subCompProp)) { - var workingSet_1 = workingSubcomponentStyles[subCompProp]; - mergedSubStyles[subCompProp] = function(styleProps) { - return concatStyleSets.apply(void 0, workingSet_1.map(function(styleFunctionOrObject) { - return typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject; - })); - }; - } - }; - // now we process the subcomponent styles if there are any - for(var subCompProp in workingSubcomponentStyles)_loop_1(subCompProp); + mergedSet.subComponentStyles = {}; + var mergedSubStyles = mergedSet.subComponentStyles; + var _loop_1 = function(subCompProp2) { + if (workingSubcomponentStyles.hasOwnProperty(subCompProp2)) { + var workingSet_1 = workingSubcomponentStyles[subCompProp2]; + mergedSubStyles[subCompProp2] = function(styleProps) { + return concatStyleSets.apply(void 0, workingSet_1.map(function(styleFunctionOrObject) { + return typeof styleFunctionOrObject === "function" ? styleFunctionOrObject(styleProps) : styleFunctionOrObject; + })); + }; + } + }; + for (var subCompProp in workingSubcomponentStyles) { + _loop_1(subCompProp); + } } return mergedSet; -} - -},{"tslib":"9gizs","./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Tcvm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Concatenates style sets into one, but resolves functional sets using the given props. - * @param styleProps - Props used to resolve functional sets. - * @param allStyles - Style sets, which can be functions or objects. - */ parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>concatStyleSetsWithProps); -var _concatStyleSets = require("./concatStyleSets"); -function concatStyleSetsWithProps(styleProps) { + } + function mergeStyleSets() { + var styleSets = []; + for (var _i = 0; _i < arguments.length; _i++) { + styleSets[_i] = arguments[_i]; + } + return mergeCssSets(styleSets, getStyleOptions()); + } + function mergeCssSets(styleSets, options2) { + var classNameSet = { subComponentStyles: {} }; + var shadowConfig = void 0; + var styleSet; + if (isShadowConfig(styleSets[0])) { + shadowConfig = styleSets[0]; + styleSet = styleSets[1]; + } else { + styleSet = styleSets[0]; + } + shadowConfig !== null && shadowConfig !== void 0 ? shadowConfig : shadowConfig = options2 === null || options2 === void 0 ? void 0 : options2.shadowConfig; + var opts = __assign$1(__assign$1({}, options2), { shadowConfig }); + if (!styleSet && styleSets.length <= 1) { + return { subComponentStyles: {} }; + } + var sheet = Stylesheet.getInstance(shadowConfig); + opts.stylesheet = sheet; + var concatenatedStyleSet = concatStyleSets.apply(void 0, styleSets); + var registrations = []; + for (var styleSetArea in concatenatedStyleSet) { + if (concatenatedStyleSet.hasOwnProperty(styleSetArea)) { + if (styleSetArea === "subComponentStyles") { + classNameSet.subComponentStyles = concatenatedStyleSet.subComponentStyles || {}; + continue; + } else if (styleSetArea === "__shadowConfig__") { + continue; + } + var styles = concatenatedStyleSet[styleSetArea]; + var _a2 = extractStyleParts(sheet, styles), classes = _a2.classes, objects = _a2.objects; + if (objects === null || objects === void 0 ? void 0 : objects.length) { + var registration = styleToRegistration(opts || {}, { displayName: styleSetArea }, objects); + if (registration) { + registrations.push(registration); + classNameSet[styleSetArea] = classes.concat([registration.className]).join(" "); + } + } else { + classNameSet[styleSetArea] = classes.join(" "); + } + } + } + for (var _i = 0, registrations_1 = registrations; _i < registrations_1.length; _i++) { + var registration = registrations_1[_i]; + if (registration) { + applyRegistration(registration, options2 === null || options2 === void 0 ? void 0 : options2.specificityMultiplier, shadowConfig); + } + } + return classNameSet; + } + function concatStyleSetsWithProps(styleProps) { var allStyles = []; - for(var _i = 1; _i < arguments.length; _i++)allStyles[_i - 1] = arguments[_i]; + for (var _i = 1; _i < arguments.length; _i++) { + allStyles[_i - 1] = arguments[_i]; + } var result = []; - for(var _a = 0, allStyles_1 = allStyles; _a < allStyles_1.length; _a++){ - var styles = allStyles_1[_a]; - if (styles) result.push(typeof styles === 'function' ? styles(styleProps) : styles); - } - if (result.length === 1) return result[0]; - else if (result.length) // cliffkoh: I cannot figure out how to avoid the cast to any here. - // It is something to do with the use of Omit in IStyleSet. - // It might not be necessary once Omit becomes part of lib.d.ts (when we remove our own Omit and rely on - // the official version). - return (0, _concatStyleSets.concatStyleSets).apply(void 0, result); + for (var _a2 = 0, allStyles_1 = allStyles; _a2 < allStyles_1.length; _a2++) { + var styles = allStyles_1[_a2]; + if (styles) { + result.push(typeof styles === "function" ? styles(styleProps) : styles); + } + } + if (result.length === 1) { + return result[0]; + } else if (result.length) { + return concatStyleSets.apply(void 0, result); + } return {}; -} - -},{"./concatStyleSets":"5Msd3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5xypM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Registers a font face. - * @public - */ parcelHelpers.export(exports, "fontFace", ()=>fontFace); -var _styleOptionsState = require("./StyleOptionsState"); -var _stylesheet = require("./Stylesheet"); -var _styleToClassName = require("./styleToClassName"); -function fontFace(font) { - var stylesheet = (0, _stylesheet.Stylesheet).getInstance(); - var rule = (0, _styleToClassName.serializeRuleEntries)((0, _styleOptionsState.getStyleOptions)(), font); - var className = stylesheet.classNameFromKey(rule); - if (className) return; - var name = stylesheet.getClassName(); - stylesheet.insertRule("@font-face{".concat(rule, "}"), true); - stylesheet.cacheClassName(name, rule, [], [ - 'font-face', - rule - ]); -} - -},{"./StyleOptionsState":"4aGJx","./Stylesheet":"5wD4L","./styleToClassName":"7B171","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7yKx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Registers keyframe definitions. - * - * @public - */ parcelHelpers.export(exports, "keyframes", ()=>keyframes); -var _styleOptionsState = require("./StyleOptionsState"); -var _stylesheet = require("./Stylesheet"); -var _styleToClassName = require("./styleToClassName"); -function keyframes(timeline) { - var stylesheet = (0, _stylesheet.Stylesheet).getInstance(); + } + function fontFace(font2) { + var stylesheet2 = Stylesheet.getInstance(); + var rule2 = serializeRuleEntries(getStyleOptions(), font2); + var className2 = stylesheet2.classNameFromKey(rule2); + if (className2) { + return; + } + var name = stylesheet2.getClassName(); + stylesheet2.insertRule("@font-face{".concat(rule2, "}"), true); + stylesheet2.cacheClassName(name, rule2, [], ["font-face", rule2]); + } + function keyframes(timeline) { + var stylesheet2 = Stylesheet.getInstance(); var rulesArray = []; - for(var prop in timeline)if (timeline.hasOwnProperty(prop)) rulesArray.push(prop, '{', (0, _styleToClassName.serializeRuleEntries)((0, _styleOptionsState.getStyleOptions)(), timeline[prop]), '}'); - var rules = rulesArray.join(''); - var className = stylesheet.classNameFromKey(rules); - if (className) return className; - var name = stylesheet.getClassName(); - stylesheet.insertRule("@keyframes ".concat(name, "{").concat(rules, "}"), true); - stylesheet.cacheClassName(name, rules, [], [ - 'keyframes', - rules - ]); - return name; -} - -},{"./StyleOptionsState":"4aGJx","./Stylesheet":"5wD4L","./styleToClassName":"7B171","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4ADZe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SUPPORTS_CONSTRUCTABLE_STYLESHEETS", ()=>SUPPORTS_CONSTRUCTABLE_STYLESHEETS); -parcelHelpers.export(exports, "SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS", ()=>SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS); -parcelHelpers.export(exports, "ShadowDomStylesheet", ()=>ShadowDomStylesheet); -var _tslib = require("tslib"); -/* eslint no-restricted-globals: 0 */ var _stylesheet = require("./Stylesheet"); -var _shadowConfig = require("./shadowConfig"); -var SUPPORTS_CONSTRUCTABLE_STYLESHEETS = typeof document !== 'undefined' && Array.isArray(document.adoptedStyleSheets) && 'replace' in CSSStyleSheet.prototype; -var supportsModifyingAdoptedStyleSheets = false; -if (SUPPORTS_CONSTRUCTABLE_STYLESHEETS) try { - document.adoptedStyleSheets.push(); - supportsModifyingAdoptedStyleSheets = true; -} catch (e) { - supportsModifyingAdoptedStyleSheets = false; -} -var SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS = supportsModifyingAdoptedStyleSheets; -var _stylesheet1; -var _global = {}; -// Grab window. -try { - // Why the cast? - // if compiled/type checked in same program with `@fluentui/font-icons-mdl2` which extends `Window` on global - // ( check packages/font-icons-mdl2/src/index.ts ) the definitions don't match! Thus the need of this extra assertion - _global = window || {}; -} catch (_a) { -/* leave as blank object */ } -var copyOldGlobalRules = function(stylesheet, inShadow, win, doc) { - var _a; - if (inShadow === void 0) inShadow = false; - if (!doc) // SSR - return; - var oldGlobalRules = doc.querySelectorAll('[data-merge-styles]'); - if (oldGlobalRules) { - stylesheet.setConfig({ - window: win, - inShadow: inShadow, - stylesheetKey: (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) - }); - for(var i = 0; i < oldGlobalRules.length; i++){ - var styleElem = oldGlobalRules[i]; - styleElem.setAttribute('data-merge-styles-global', 'true'); - var cssRules = ((_a = styleElem.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) || []; - for(var j = 0; j < cssRules.length; j++){ - var rule = cssRules[j]; - stylesheet.insertRule(rule.cssText); - } - } + for (var prop in timeline) { + if (timeline.hasOwnProperty(prop)) { + rulesArray.push(prop, "{", serializeRuleEntries(getStyleOptions(), timeline[prop]), "}"); + } } -}; -var ShadowDomStylesheet = /** @class */ function(_super) { - (0, _tslib.__extends)(ShadowDomStylesheet, _super); - function ShadowDomStylesheet(config, serializedStylesheet) { - var _this = _super.call(this, config, serializedStylesheet) || this; - _this._onAddSheetCallbacks = []; - _this._sheetCounter = 0; - _this._adoptableSheets = new Map(); - _global[0, _shadowConfig.SHADOW_DOM_STYLESHEET_SETTING] = ShadowDomStylesheet; - return _this; + var rules2 = rulesArray.join(""); + var className2 = stylesheet2.classNameFromKey(rules2); + if (className2) { + return className2; } - ShadowDomStylesheet.getInstance = function(shadowConfig) { - var sConfig = shadowConfig || (0, _shadowConfig.DEFAULT_SHADOW_CONFIG); - var stylesheetKey = sConfig.stylesheetKey || (0, _shadowConfig.GLOBAL_STYLESHEET_KEY); - var inShadow = sConfig.inShadow; - var win = sConfig.window || (typeof window !== 'undefined' ? window : undefined); - var global = win || _global; - var doc = win ? win.document : typeof document !== 'undefined' ? document : undefined; - _stylesheet1 = global[0, _stylesheet.STYLESHEET_SETTING]; - // When an app has multiple versions of Fluent v8 it is possible - // that an older version of Stylesheet is initialized before - // the version that supports shadow DOM. We check for this case - // and re-initialize the stylesheet in that case. - var oldStylesheetInitializedFirst = _stylesheet1 && !_stylesheet1.getAdoptedSheets; - if (!_stylesheet1 || oldStylesheetInitializedFirst || _stylesheet1._lastStyleElement && _stylesheet1._lastStyleElement.ownerDocument !== doc) { - var fabricConfig = (global === null || global === void 0 ? void 0 : global.FabricConfig) || {}; - var defaultMergeStyles = { - window: win, - inShadow: inShadow, - stylesheetKey: stylesheetKey - }; - fabricConfig.mergeStyles = fabricConfig.mergeStyles || {}; - fabricConfig.mergeStyles = (0, _tslib.__assign)((0, _tslib.__assign)({}, defaultMergeStyles), fabricConfig.mergeStyles); - var stylesheet = void 0; - if (oldStylesheetInitializedFirst) { - stylesheet = new ShadowDomStylesheet(fabricConfig.mergeStyles, JSON.parse(_stylesheet1.serialize())); - copyOldGlobalRules(stylesheet, inShadow, win, doc); - } else stylesheet = new ShadowDomStylesheet(fabricConfig.mergeStyles, fabricConfig.serializedStylesheet); - _stylesheet1 = stylesheet; - global[0, _stylesheet.STYLESHEET_SETTING] = _stylesheet1; - } else _stylesheet1.setConfig({ - window: win, - inShadow: inShadow, - stylesheetKey: stylesheetKey - }); - if (win) _stylesheet1._getAdoptableStyleSheet(stylesheetKey); - return _stylesheet1; - }; - ShadowDomStylesheet.prototype.getAdoptedSheets = function() { - return this._adoptableSheets; - }; - ShadowDomStylesheet.prototype.onAddSheet = function(callback) { - var _this = this; - this._onAddSheetCallbacks.push(callback); - return function() { - _this._onAddSheetCallbacks = _this._onAddSheetCallbacks.filter(function(cb) { - return cb !== callback; - }); - }; + var name = stylesheet2.getClassName(); + stylesheet2.insertRule("@keyframes ".concat(name, "{").concat(rules2, "}"), true); + stylesheet2.cacheClassName(name, rules2, [], ["keyframes", rules2]); + return name; + } + var _scrollbarWidth; + var _bodyScrollDisabledCount = 0; + var DisabledScrollClassName = mergeStyles({ + overflow: "hidden !important" + }); + var DATA_IS_SCROLLABLE_ATTRIBUTE = "data-is-scrollable"; + var allowScrollOnElement = function(element2, events2) { + var window2 = getWindow(element2); + if (!element2 || !window2) { + return; + } + var _previousClientY = 0; + var _element = null; + var computedStyles = window2.getComputedStyle(element2); + var _saveClientY = function(event2) { + if (event2.targetTouches.length === 1) { + _previousClientY = event2.targetTouches[0].clientY; + } }; - ShadowDomStylesheet.prototype.insertRule = function(rule, preserve) { - var _a = this._config, injectionMode = _a.injectionMode, _b = _a.stylesheetKey, stylesheetKey = _b === void 0 ? (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) : _b; - var injectStyles = injectionMode !== (0, _stylesheet.InjectionMode).none; - var addToConstructableStylesheet = stylesheetKey === (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) || !!this._adoptableSheets.has(stylesheetKey); - var constructableSheet = undefined; - if (injectStyles && addToConstructableStylesheet) constructableSheet = this._getAdoptableStyleSheet(stylesheetKey); - if (constructableSheet) this._insertRuleIntoSheet(constructableSheet, rule); - _super.prototype.insertRule.call(this, rule, preserve, stylesheetKey); - }; - ShadowDomStylesheet.prototype._getCacheKey = function(key) { - var _a = this._config, _b = _a.inShadow, inShadow = _b === void 0 ? false : _b, _c = _a.stylesheetKey, currentStylesheetKey = _c === void 0 ? (0, _shadowConfig.GLOBAL_STYLESHEET_KEY) : _c; - if (inShadow) return "__".concat(currentStylesheetKey, "__").concat(key); - return _super.prototype._getCacheKey.call(this, key); - }; - ShadowDomStylesheet.prototype._createStyleElement = function() { - var styleElement = _super.prototype._createStyleElement.call(this); - if (this._config.stylesheetKey === (0, _shadowConfig.GLOBAL_STYLESHEET_KEY)) styleElement.setAttribute('data-merge-styles-global', 'true'); - return styleElement; + var _preventOverscrolling = function(event2) { + if (event2.targetTouches.length !== 1) { + return; + } + event2.stopPropagation(); + if (!_element) { + return; + } + var clientY = event2.targetTouches[0].clientY - _previousClientY; + var scrollableParent = findScrollableParent(event2.target); + if (scrollableParent && _element !== scrollableParent) { + _element = scrollableParent; + computedStyles = window2.getComputedStyle(_element); + } + var scrollTop = _element.scrollTop; + var isColumnReverse = (computedStyles === null || computedStyles === void 0 ? void 0 : computedStyles.flexDirection) === "column-reverse"; + if (scrollTop === 0 && (isColumnReverse ? clientY < 0 : clientY > 0)) { + event2.preventDefault(); + } + if (_element.scrollHeight - Math.abs(Math.ceil(scrollTop)) <= _element.clientHeight && (isColumnReverse ? clientY > 0 : clientY < 0)) { + event2.preventDefault(); + } }; - ShadowDomStylesheet.prototype._makeCSSStyleSheet = function() { - var win = this._config.window || window; - var sheet = undefined; - if (!SUPPORTS_CONSTRUCTABLE_STYLESHEETS) { - var style = this._createStyleElement(); - sheet = style.sheet; - } else sheet = new win.CSSStyleSheet(); - if (sheet) { - sheet.bucketName = 'merge-styles'; - sheet.metadata = { - stylesheetKey: this._config.stylesheetKey || (0, _shadowConfig.GLOBAL_STYLESHEET_KEY), - sortOrder: this._sheetCounter++ - }; - } - return sheet; + events2.on(element2, "touchstart", _saveClientY, { passive: false }); + events2.on(element2, "touchmove", _preventOverscrolling, { passive: false }); + _element = element2; + }; + var allowOverscrollOnElement = function(element2, events2) { + if (!element2) { + return; + } + var _allowElementScroll = function(event2) { + event2.stopPropagation(); }; - ShadowDomStylesheet.prototype._addAdoptableStyleSheet = function(key, sheet, queue) { - var _this = this; - if (queue === void 0) queue = true; - if (!this._adoptableSheets.has(key)) { - this._adoptableSheets.set(key, sheet); - var win = this._config.window; - if (queue && win) win.queueMicrotask(function() { - _this._onAddSheetCallbacks.forEach(function(callback) { - return callback({ - key: key, - sheet: sheet - }); - }); - }); + events2.on(element2, "touchmove", _allowElementScroll, { passive: false }); + }; + var _disableIosBodyScroll = function(event2) { + event2.preventDefault(); + }; + function disableBodyScroll() { + var doc = getDocument(); + if (doc && doc.body && !_bodyScrollDisabledCount) { + doc.body.classList.add(DisabledScrollClassName); + doc.body.addEventListener("touchmove", _disableIosBodyScroll, { passive: false, capture: false }); + } + _bodyScrollDisabledCount++; + } + function enableBodyScroll() { + if (_bodyScrollDisabledCount > 0) { + var doc = getDocument(); + if (doc && doc.body && _bodyScrollDisabledCount === 1) { + doc.body.classList.remove(DisabledScrollClassName); + doc.body.removeEventListener("touchmove", _disableIosBodyScroll); + } + _bodyScrollDisabledCount--; + } + } + function getScrollbarWidth(doc) { + if (_scrollbarWidth === void 0) { + var theDoc = getDocument(); + var scrollDiv = theDoc.createElement("div"); + scrollDiv.style.setProperty("width", "100px"); + scrollDiv.style.setProperty("height", "100px"); + scrollDiv.style.setProperty("overflow", "scroll"); + scrollDiv.style.setProperty("position", "absolute"); + scrollDiv.style.setProperty("top", "-9999px"); + theDoc.body.appendChild(scrollDiv); + _scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; + theDoc.body.removeChild(scrollDiv); + } + return _scrollbarWidth; + } + function findScrollableParent(startingElement) { + var el = startingElement; + var doc = getDocument(startingElement); + while (el && el !== doc.body) { + if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) === "true") { + return el; + } + el = el.parentElement; + } + el = startingElement; + while (el && el !== doc.body) { + if (el.getAttribute(DATA_IS_SCROLLABLE_ATTRIBUTE) !== "false") { + var computedStyles = getComputedStyle(el); + var overflowY = computedStyles ? computedStyles.getPropertyValue("overflow-y") : ""; + if (overflowY && (overflowY === "scroll" || overflowY === "auto")) { + return el; } - }; - ShadowDomStylesheet.prototype._getAdoptableStyleSheet = function(key) { - var sheet = this._adoptableSheets.get(key); - if (!sheet) { - sheet = this._makeCSSStyleSheet(); - this._addAdoptableStyleSheet(key, sheet); - } - return sheet; - }; - return ShadowDomStylesheet; -}((0, _stylesheet.Stylesheet)); - -},{"tslib":"9gizs","./Stylesheet":"5wD4L","./shadowConfig":"7TWty","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5w3No":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cloneCSSStyleSheet", ()=>cloneCSSStyleSheet); -parcelHelpers.export(exports, "cloneExtendedCSSStyleSheet", ()=>cloneExtendedCSSStyleSheet); -var cloneCSSStyleSheet = function(srcSheet, targetSheet) { - for(var i = 0; i < srcSheet.cssRules.length; i++)targetSheet.insertRule(srcSheet.cssRules[i].cssText, i); - return targetSheet; -}; -var cloneExtendedCSSStyleSheet = function(srcSheet, targetSheet) { - var clone = cloneCSSStyleSheet(srcSheet, targetSheet); - clone.bucketName = srcSheet.bucketName; - for(var _i = 0, _a = Object.keys(srcSheet.metadata); _i < _a.length; _i++){ - var key = _a[_i]; - clone.metadata[key] = srcSheet.metadata[key]; - } - return clone; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1UJId":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/merge-styles', '8.6.13'); - -},{"@fluentui/set-version":"iqYXf"}],"iLCoe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BaseComponent", ()=>BaseComponent); -/** - * Simple constant function for returning null, used to render empty templates in JSX. - * - * @public - */ parcelHelpers.export(exports, "nullRender", ()=>nullRender); -var _tslib = require("tslib"); -var _react = require("react"); -var _async = require("./Async"); -var _eventGroup = require("./EventGroup"); -var _warnConditionallyRequiredProps = require("./warn/warnConditionallyRequiredProps"); -var _warnMutuallyExclusive = require("./warn/warnMutuallyExclusive"); -var _warnDeprecations = require("./warn/warnDeprecations"); -/** - * BaseComponent class, which provides basic helpers for all components. - * - * @public - * {@docCategory BaseComponent} - * - * @deprecated Do not use. We are moving away from class component. - */ var BaseComponent = /** @class */ function(_super) { - (0, _tslib.__extends)(BaseComponent, _super); - /** - * BaseComponent constructor - * @param props - The props for the component. - * @param context - The context for the component. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any - function BaseComponent(props, context) { - var _this = _super.call(this, props, context) || this; - // eslint-disable-next-line deprecation/deprecation - _makeAllSafe(_this, BaseComponent.prototype, [ - 'componentDidMount', - 'shouldComponentUpdate', - 'getSnapshotBeforeUpdate', - 'render', - 'componentDidUpdate', - 'componentWillUnmount' - ]); - return _this; + } + el = el.parentElement; } - /** - * When the component receives props, make sure the componentRef is updated. - */ BaseComponent.prototype.componentDidUpdate = function(prevProps, prevState) { - this._updateComponentRef(prevProps, this.props); - }; - /** - * When the component has mounted, update the componentRef. - */ BaseComponent.prototype.componentDidMount = function() { - this._setComponentRef(this.props.componentRef, this); - }; - /** - * If we have disposables, dispose them automatically on unmount. - */ BaseComponent.prototype.componentWillUnmount = function() { - this._setComponentRef(this.props.componentRef, null); - if (this.__disposables) { - for(var i = 0, len = this._disposables.length; i < len; i++){ - var disposable = this.__disposables[i]; - if (disposable.dispose) disposable.dispose(); - } - this.__disposables = null; + if (!el || el === doc.body) { + el = getWindow(startingElement); + } + return el; + } + function warn$1(message) { + if (console && console.warn) { + console.warn(message); + } + } + var define_process_env_default = { NODE_ENV: "production" }; + function warnConditionallyRequiredProps(componentName, props, requiredProps, conditionalPropName, condition) { + if (condition === true && define_process_env_default.NODE_ENV !== "production") { + for (var _i = 0, requiredProps_1 = requiredProps; _i < requiredProps_1.length; _i++) { + var requiredPropName = requiredProps_1[_i]; + if (!(requiredPropName in props)) { + warn$1("".concat(componentName, " property '").concat(requiredPropName, "' is required when '").concat(conditionalPropName, "' is used.'")); } + } + } + } + function warnMutuallyExclusive(componentName, props, exclusiveMap) { + } + function warnDeprecations(componentName, props, deprecationMap) { + } + (function(_super) { + __extends(BaseComponent, _super); + function BaseComponent(props, context2) { + var _this = _super.call(this, props, context2) || this; + _makeAllSafe(_this, BaseComponent.prototype, [ + "componentDidMount", + "shouldComponentUpdate", + "getSnapshotBeforeUpdate", + "render", + "componentDidUpdate", + "componentWillUnmount" + ]); + return _this; + } + BaseComponent.prototype.componentDidUpdate = function(prevProps, prevState) { + this._updateComponentRef(prevProps, this.props); + }; + BaseComponent.prototype.componentDidMount = function() { + this._setComponentRef(this.props.componentRef, this); + }; + BaseComponent.prototype.componentWillUnmount = function() { + this._setComponentRef(this.props.componentRef, null); + if (this.__disposables) { + for (var i = 0, len2 = this._disposables.length; i < len2; i++) { + var disposable = this.__disposables[i]; + if (disposable.dispose) { + disposable.dispose(); + } + } + this.__disposables = null; + } }; Object.defineProperty(BaseComponent.prototype, "className", { - /** - * Gets the object's class name. - */ get: function() { - if (!this.__className) { - var funcNameRegex = /function (.{1,})\(/; - var results = funcNameRegex.exec(this.constructor.toString()); - this.__className = results && results.length > 1 ? results[1] : ''; - } - return this.__className; - }, - enumerable: false, - configurable: true + /** + * Gets the object's class name. + */ + get: function() { + if (!this.__className) { + var funcNameRegex = /function (.{1,})\(/; + var results = funcNameRegex.exec(this.constructor.toString()); + this.__className = results && results.length > 1 ? results[1] : ""; + } + return this.__className; + }, + enumerable: false, + configurable: true }); Object.defineProperty(BaseComponent.prototype, "_disposables", { - /** - * Allows subclasses to push things to this._disposables to be auto disposed. - */ get: function() { - if (!this.__disposables) this.__disposables = []; - return this.__disposables; - }, - enumerable: false, - configurable: true + /** + * Allows subclasses to push things to this._disposables to be auto disposed. + */ + get: function() { + if (!this.__disposables) { + this.__disposables = []; + } + return this.__disposables; + }, + enumerable: false, + configurable: true }); Object.defineProperty(BaseComponent.prototype, "_async", { - /** - * Gets the async instance associated with the component, created on demand. The async instance gives - * subclasses a way to execute setTimeout/setInterval async calls safely, where the callbacks - * will be cleared/ignored automatically after unmounting. The helpers within the async object also - * preserve the this pointer so that you don't need to "bind" the callbacks. - */ get: function() { - if (!this.__async) { - this.__async = new (0, _async.Async)(this); - this._disposables.push(this.__async); - } - return this.__async; - }, - enumerable: false, - configurable: true + /** + * Gets the async instance associated with the component, created on demand. The async instance gives + * subclasses a way to execute setTimeout/setInterval async calls safely, where the callbacks + * will be cleared/ignored automatically after unmounting. The helpers within the async object also + * preserve the this pointer so that you don't need to "bind" the callbacks. + */ + get: function() { + if (!this.__async) { + this.__async = new Async(this); + this._disposables.push(this.__async); + } + return this.__async; + }, + enumerable: false, + configurable: true }); Object.defineProperty(BaseComponent.prototype, "_events", { - /** - * Gets the event group instance assocaited with the component, created on demand. The event instance - * provides on/off methods for listening to DOM (or regular javascript object) events. The event callbacks - * will be automatically disconnected after unmounting. The helpers within the events object also - * preserve the this reference so that you don't need to "bind" the callbacks. - */ get: function() { - if (!this.__events) { - this.__events = new (0, _eventGroup.EventGroup)(this); - this._disposables.push(this.__events); - } - return this.__events; - }, - enumerable: false, - configurable: true + /** + * Gets the event group instance assocaited with the component, created on demand. The event instance + * provides on/off methods for listening to DOM (or regular javascript object) events. The event callbacks + * will be automatically disconnected after unmounting. The helpers within the events object also + * preserve the this reference so that you don't need to "bind" the callbacks. + */ + get: function() { + if (!this.__events) { + this.__events = new EventGroup(this); + this._disposables.push(this.__events); + } + return this.__events; + }, + enumerable: false, + configurable: true }); - /** - * Helper to return a memoized ref resolver function. - * @param refName - Name of the member to assign the ref to. - * @returns A function instance keyed from the given refname. - * @deprecated Use `createRef` from React.createRef. - */ BaseComponent.prototype._resolveRef = function(refName) { - var _this = this; - if (!this.__resolves) this.__resolves = {}; - if (!this.__resolves[refName]) this.__resolves[refName] = function(ref) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return _this[refName] = ref; + BaseComponent.prototype._resolveRef = function(refName) { + var _this = this; + if (!this.__resolves) { + this.__resolves = {}; + } + if (!this.__resolves[refName]) { + this.__resolves[refName] = function(ref2) { + return _this[refName] = ref2; }; - return this.__resolves[refName]; + } + return this.__resolves[refName]; }; - /** - * Updates the componentRef (by calling it with "this" when necessary.) - */ BaseComponent.prototype._updateComponentRef = function(currentProps, newProps) { - if (newProps === void 0) newProps = {}; - // currentProps *should* always be defined, but verify that just in case a subclass is manually - // calling a lifecycle method with no parameters (which has happened) or other odd usage. - if (currentProps && newProps && currentProps.componentRef !== newProps.componentRef) { - this._setComponentRef(currentProps.componentRef, null); - this._setComponentRef(newProps.componentRef, this); - } + BaseComponent.prototype._updateComponentRef = function(currentProps, newProps) { + if (newProps === void 0) { + newProps = {}; + } + if (currentProps && newProps && currentProps.componentRef !== newProps.componentRef) { + this._setComponentRef(currentProps.componentRef, null); + this._setComponentRef(newProps.componentRef, this); + } }; - /** - * Warns when a deprecated props are being used. - * - * @param deprecationMap - The map of deprecations, where key is the prop name and the value is - * either null or a replacement prop name. - */ BaseComponent.prototype._warnDeprecations = function(deprecationMap) { - (0, _warnDeprecations.warnDeprecations)(this.className, this.props, deprecationMap); + BaseComponent.prototype._warnDeprecations = function(deprecationMap) { + warnDeprecations(this.className, this.props); }; - /** - * Warns when props which are mutually exclusive with each other are both used. - * - * @param mutuallyExclusiveMap - The map of mutually exclusive props. - */ BaseComponent.prototype._warnMutuallyExclusive = function(mutuallyExclusiveMap) { - (0, _warnMutuallyExclusive.warnMutuallyExclusive)(this.className, this.props, mutuallyExclusiveMap); + BaseComponent.prototype._warnMutuallyExclusive = function(mutuallyExclusiveMap) { + warnMutuallyExclusive(this.className, this.props); }; - /** - * Warns when props are required if a condition is met. - * - * @param requiredProps - The name of the props that are required when the condition is met. - * @param conditionalPropName - The name of the prop that the condition is based on. - * @param condition - Whether the condition is met. - */ BaseComponent.prototype._warnConditionallyRequiredProps = function(requiredProps, conditionalPropName, condition) { - (0, _warnConditionallyRequiredProps.warnConditionallyRequiredProps)(this.className, this.props, requiredProps, conditionalPropName, condition); + BaseComponent.prototype._warnConditionallyRequiredProps = function(requiredProps, conditionalPropName, condition) { + warnConditionallyRequiredProps(this.className, this.props, requiredProps, conditionalPropName, condition); }; - BaseComponent.prototype._setComponentRef = function(ref, value) { - if (!this._skipComponentRefResolution && ref) { - if (typeof ref === 'function') ref(value); - if (typeof ref === 'object') // eslint-disable-next-line @typescript-eslint/no-explicit-any - ref.current = value; + BaseComponent.prototype._setComponentRef = function(ref2, value2) { + if (!this._skipComponentRefResolution && ref2) { + if (typeof ref2 === "function") { + ref2(value2); } + if (typeof ref2 === "object") { + ref2.current = value2; + } + } }; return BaseComponent; -}(_react.Component); -/** - * Helper to override a given method with a wrapper method that can try/catch the original, but also - * ensures that the BaseComponent's methods are called before the subclass's. This ensures that - * componentWillUnmount in the base is called and that things in the _disposables array are disposed. - */ // eslint-disable-next-line deprecation/deprecation -function _makeAllSafe(obj, prototype, methodNames) { - for(var i = 0, len = methodNames.length; i < len; i++)_makeSafe(obj, prototype, methodNames[i]); -} -// eslint-disable-next-line deprecation/deprecation -function _makeSafe(obj, prototype, methodName) { - /* eslint-disable @typescript-eslint/no-explicit-any */ var classMethod = obj[methodName]; - var prototypeMethod = prototype[methodName]; - if (classMethod || prototypeMethod) obj[methodName] = function() { + })(React__namespace.Component); + function _makeAllSafe(obj2, prototype2, methodNames) { + for (var i = 0, len2 = methodNames.length; i < len2; i++) { + _makeSafe(obj2, prototype2, methodNames[i]); + } + } + function _makeSafe(obj2, prototype2, methodName) { + var classMethod = obj2[methodName]; + var prototypeMethod = prototype2[methodName]; + if (classMethod || prototypeMethod) { + obj2[methodName] = function() { var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - /* eslint-enable @typescript-eslint/no-explicit-any */ var retVal; - if (prototypeMethod) retVal = prototypeMethod.apply(this, args); - if (classMethod !== prototypeMethod) retVal = classMethod.apply(this, args); - return retVal; - }; -} -function nullRender() { + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var retVal2; + if (prototypeMethod) { + retVal2 = prototypeMethod.apply(this, args); + } + if (classMethod !== prototypeMethod) { + retVal2 = classMethod.apply(this, args); + } + return retVal2; + }; + } + } + function nullRender() { return null; -} - -},{"tslib":"9gizs","react":"jGrId","./Async":"bcsew","./EventGroup":"0TvPH","./warn/warnConditionallyRequiredProps":"77JnC","./warn/warnMutuallyExclusive":"1HY1B","./warn/warnDeprecations":"e2341","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"77JnC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Warns when props are required if a condition is met. - * - * @public - * @param componentName - The name of the component being used. - * @param props - The props passed into the component. - * @param requiredProps - The name of the props that are required when the condition is met. - * @param conditionalPropName - The name of the prop that the condition is based on. - * @param condition - Whether the condition is met. - */ parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>warnConditionallyRequiredProps); -var _warn = require("./warn"); -function warnConditionallyRequiredProps(componentName, props, requiredProps, conditionalPropName, condition) { - condition; - var _i, requiredProps_1, requiredPropName; -} - -},{"./warn":"itqD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"itqD3":[function(require,module,exports,__globalThis) { -/* eslint-disable no-console */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Sends a warning to console, if the api is present. - * - * @public - * @param message - Warning message. - */ parcelHelpers.export(exports, "warn", ()=>warn); -/** - * Configures the warning callback. Passing in undefined will reset it to use the default - * console.warn function. - * - * @public - * @param warningCallback - Callback to override the generated warnings. - */ parcelHelpers.export(exports, "setWarningCallback", ()=>setWarningCallback); -var _warningCallback = undefined; -function warn(message) { - if (console && console.warn) console.warn(message); -} -function setWarningCallback(warningCallback) { - _warningCallback = warningCallback; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1HY1B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Warns when two props which are mutually exclusive are both being used. - * - * @public - * @param componentName - The name of the component being used. - * @param props - The props passed into the component. - * @param exclusiveMap - A map where the key is a parameter, and the value is the other parameter. - */ parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>warnMutuallyExclusive); -var _warn = require("./warn"); -function warnMutuallyExclusive(componentName, props, exclusiveMap) { - var propName, propInExclusiveMapValue; -} - -},{"./warn":"itqD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e2341":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Warns when a deprecated props are being used. - * - * @public - * @param componentName - The name of the component being used. - * @param props - The props passed into the component. - * @param deprecationMap - The map of deprecations, where key is the prop name and the value is - * either null or a replacement prop name. - */ parcelHelpers.export(exports, "warnDeprecations", ()=>warnDeprecations); -var _warn = require("./warn"); -function warnDeprecations(componentName, props, deprecationMap) { - var propName, deprecationMessage, replacementPropName; -} - -},{"./warn":"itqD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jKQeJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DelayedRender", ()=>DelayedRender); -var _tslib = require("tslib"); -var _react = require("react"); -var _getWindow = require("./dom/getWindow"); -var DelayedRender = /** @class */ function(_super) { - (0, _tslib.__extends)(DelayedRender, _super); - function DelayedRender(props) { + } + var DelayedRender = ( + /** @class */ + (function(_super) { + __extends(DelayedRender2, _super); + function DelayedRender2(props) { var _this = _super.call(this, props) || this; _this.state = { - isRendered: (0, _getWindow.getWindow)() === undefined + isRendered: getWindow() === void 0 }; return _this; - } - DelayedRender.prototype.componentDidMount = function() { + } + DelayedRender2.prototype.componentDidMount = function() { var _this = this; var delay = this.props.delay; - // eslint-disable-next-line no-restricted-globals this._timeoutId = window.setTimeout(function() { - _this.setState({ - isRendered: true - }); + _this.setState({ + isRendered: true + }); }, delay); - }; - DelayedRender.prototype.componentWillUnmount = function() { - if (this._timeoutId) clearTimeout(this._timeoutId); - }; - DelayedRender.prototype.render = function() { - return this.state.isRendered ? _react.Children.only(this.props.children) : null; - }; - DelayedRender.defaultProps = { + }; + DelayedRender2.prototype.componentWillUnmount = function() { + if (this._timeoutId) { + clearTimeout(this._timeoutId); + } + }; + DelayedRender2.prototype.render = function() { + return this.state.isRendered ? React__namespace.Children.only(this.props.children) : null; + }; + DelayedRender2.defaultProps = { delay: 0 - }; - return DelayedRender; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hiYVs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FabricPerformance", ()=>FabricPerformance); -var now = function() { - return typeof performance !== 'undefined' && !!performance.now ? performance.now() : Date.now(); -}; -var RESET_INTERVAL = 180000; // auto reset every 3 minutes -var FabricPerformance = /** @class */ function() { - function FabricPerformance() {} - /** - * Measures execution time of the given syncronous function. If the same logic is executed multiple times, - * each individual measurement will be collected as well the overall numbers. - * @param name - The name of this measurement - * @param func - The logic to be measured for execution time - */ FabricPerformance.measure = function(name, func) { - if (FabricPerformance._timeoutId) FabricPerformance.setPeriodicReset(); - var start = now(); - func(); - var end = now(); - var measurement = FabricPerformance.summary[name] || { - totalDuration: 0, - count: 0, - all: [] - }; - var duration = end - start; - measurement.totalDuration += duration; - measurement.count++; - measurement.all.push({ - duration: duration, - timeStamp: end - }); - FabricPerformance.summary[name] = measurement; - }; - FabricPerformance.reset = function() { - FabricPerformance.summary = {}; - clearTimeout(FabricPerformance._timeoutId); - FabricPerformance._timeoutId = NaN; - }; - FabricPerformance.setPeriodicReset = function() { - FabricPerformance._timeoutId = setTimeout(function() { - return FabricPerformance.reset(); - }, RESET_INTERVAL); - }; - FabricPerformance.summary = {}; - return FabricPerformance; -}(); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6x3RK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GlobalSettings", ()=>GlobalSettings); -var _getWindow = require("./dom/getWindow"); -/** - * Storing global state in local module variables has issues when more than one copy - * if the module gets loaded on the page (due to a bundling error or simply by consuming - * a prebundled script.) - * - * This file contains helpers to deal with the getting and setting local state, and allows - * callers to get called back when it mutates. - */ var GLOBAL_SETTINGS_PROP_NAME = '__globalSettings__'; -var CALLBACK_STATE_PROP_NAME = '__callbacks__'; -var _counter = 0; -/** - * Global settings helper, which stores settings in the global (window) namespace. - * If window is not provided, it will store settings in module scope. Provides a - * way to observe changes as well when their values change. - * - * @public - * {@docCategory GlobalSettings} - */ var GlobalSettings = /** @class */ function() { - function GlobalSettings() {} - GlobalSettings.getValue = function(key, defaultValue) { + }; + return DelayedRender2; + })(React__namespace.Component) + ); + var GLOBAL_SETTINGS_PROP_NAME = "__globalSettings__"; + var CALLBACK_STATE_PROP_NAME = "__callbacks__"; + var _counter = 0; + var GlobalSettings = ( + /** @class */ + (function() { + function GlobalSettings2() { + } + GlobalSettings2.getValue = function(key2, defaultValue) { var globalSettings = _getGlobalSettings(); - if (globalSettings[key] === undefined) globalSettings[key] = typeof defaultValue === 'function' ? defaultValue() : defaultValue; - return globalSettings[key]; - }; - GlobalSettings.setValue = function(key, value) { + if (globalSettings[key2] === void 0) { + globalSettings[key2] = typeof defaultValue === "function" ? defaultValue() : defaultValue; + } + return globalSettings[key2]; + }; + GlobalSettings2.setValue = function(key2, value2) { var globalSettings = _getGlobalSettings(); var callbacks = globalSettings[CALLBACK_STATE_PROP_NAME]; - var oldValue = globalSettings[key]; - if (value !== oldValue) { - globalSettings[key] = value; - var changeDescription = { - oldValue: oldValue, - value: value, - key: key - }; - for(var id in callbacks)if (callbacks.hasOwnProperty(id)) callbacks[id](changeDescription); - } - return value; - }; - GlobalSettings.addChangeListener = function(cb) { - // Note: we use generated ids on the callbacks to create a map of the callbacks, which optimizes removal. - // (It's faster to delete a key than it is to look up the index of an object and splice an array.) - var id = cb.__id__; + var oldValue = globalSettings[key2]; + if (value2 !== oldValue) { + globalSettings[key2] = value2; + var changeDescription = { + oldValue, + value: value2, + key: key2 + }; + for (var id2 in callbacks) { + if (callbacks.hasOwnProperty(id2)) { + callbacks[id2](changeDescription); + } + } + } + return value2; + }; + GlobalSettings2.addChangeListener = function(cb) { + var id2 = cb.__id__; var callbacks = _getCallbacks(); - if (!id) id = cb.__id__ = String(_counter++); - callbacks[id] = cb; - }; - GlobalSettings.removeChangeListener = function(cb) { + if (!id2) { + id2 = cb.__id__ = String(_counter++); + } + callbacks[id2] = cb; + }; + GlobalSettings2.removeChangeListener = function(cb) { var callbacks = _getCallbacks(); delete callbacks[cb.__id__]; - }; - return GlobalSettings; -}(); -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _getGlobalSettings() { - var _a; - var win = (0, _getWindow.getWindow)(); - // eslint-disable-next-line @typescript-eslint/no-explicit-any + }; + return GlobalSettings2; + })() + ); + function _getGlobalSettings() { + var _a2; + var win = getWindow(); var globalObj = win || {}; - if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) globalObj[GLOBAL_SETTINGS_PROP_NAME] = (_a = {}, _a[CALLBACK_STATE_PROP_NAME] = {}, _a); + if (!globalObj[GLOBAL_SETTINGS_PROP_NAME]) { + globalObj[GLOBAL_SETTINGS_PROP_NAME] = (_a2 = {}, _a2[CALLBACK_STATE_PROP_NAME] = {}, _a2); + } return globalObj[GLOBAL_SETTINGS_PROP_NAME]; -} -function _getCallbacks() { + } + function _getCallbacks() { var globalSettings = _getGlobalSettings(); return globalSettings[CALLBACK_STATE_PROP_NAME]; -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQoHk":[function(require,module,exports,__globalThis) { -/** - * Simulated enum for keycodes. These will get inlined by uglify when used much like an enum - * - * @public - * {@docCategory KeyCodes} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyCodes", ()=>KeyCodes); -var KeyCodes = { + } + var KeyCodes = { backspace: 8, tab: 9, enter: 13, - shift: 16, - ctrl: 17, alt: 18, - pauseBreak: 19, - capslock: 20, escape: 27, space: 32, pageUp: 33, @@ -66848,8617 +38206,5135 @@ var KeyCodes = { left: 37, up: 38, right: 39, - down: 40, - insert: 45, - del: 46, - zero: 48, - one: 49, - two: 50, - three: 51, - four: 52, - five: 53, - six: 54, - seven: 55, - eight: 56, - nine: 57, - colon: 58, - a: 65, - b: 66, - c: 67, - d: 68, - e: 69, - f: 70, - g: 71, - h: 72, - i: 73, - j: 74, - k: 75, - l: 76, - m: 77, - n: 78, - o: 79, - p: 80, - q: 81, - r: 82, - s: 83, - t: 84, - u: 85, - v: 86, - w: 87, - x: 88, - y: 89, - z: 90, - leftWindow: 91, - rightWindow: 92, - select: 93, - /* eslint-disable @typescript-eslint/naming-convention */ zero_numpad: 96, - one_numpad: 97, - two_numpad: 98, - three_numpad: 99, - four_numpad: 100, - five_numpad: 101, - six_numpad: 102, - seven_numpad: 103, - eight_numpad: 104, - nine_numpad: 105, - /* eslint-enable @typescript-eslint/naming-convention */ multiply: 106, - add: 107, - subtract: 109, - decimalPoint: 110, - divide: 111, - f1: 112, - f2: 113, - f3: 114, - f4: 115, - f5: 116, - f6: 117, - f7: 118, - f8: 119, - f9: 120, - f10: 121, - f11: 122, - f12: 123, - numlock: 144, - scrollLock: 145, - semicolon: 186, - equalSign: 187, - comma: 188, - dash: 189, - period: 190, - forwardSlash: 191, - graveAccent: 192, - openBracket: 219, - backSlash: 220, - closeBracket: 221, - singleQuote: 222 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hkyht":[function(require,module,exports,__globalThis) { -/** - * Rectangle helper class. - * - * @public - * {@docCategory Rectangle} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Rectangle", ()=>Rectangle); -var Rectangle = /** @class */ function() { - function Rectangle(left, right, top, bottom) { - if (left === void 0) left = 0; - if (right === void 0) right = 0; - if (top === void 0) top = 0; - if (bottom === void 0) bottom = 0; + down: 40 + }; + var Rectangle = ( + /** @class */ + (function() { + function Rectangle2(left, right, top, bottom) { + if (left === void 0) { + left = 0; + } + if (right === void 0) { + right = 0; + } + if (top === void 0) { + top = 0; + } + if (bottom === void 0) { + bottom = 0; + } this.top = top; this.bottom = bottom; this.left = left; this.right = right; - } - Object.defineProperty(Rectangle.prototype, "width", { + } + Object.defineProperty(Rectangle2.prototype, "width", { /** * Calculated automatically by subtracting the right from left - */ get: function() { - return this.right - this.left; + */ + get: function() { + return this.right - this.left; }, enumerable: false, configurable: true - }); - Object.defineProperty(Rectangle.prototype, "height", { + }); + Object.defineProperty(Rectangle2.prototype, "height", { /** * Calculated automatically by subtracting the bottom from top. - */ get: function() { - return this.bottom - this.top; + */ + get: function() { + return this.bottom - this.top; }, enumerable: false, configurable: true - }); - /** - * Tests if another rect is approximately equal to this rect (within 4 decimal places.) - */ Rectangle.prototype.equals = function(rect) { - // Fixing to 4 decimal places because it allows enough precision and will handle cases when something - // should be rounded, like .999999 should round to 1. - return parseFloat(this.top.toFixed(4)) === parseFloat(rect.top.toFixed(4)) && parseFloat(this.bottom.toFixed(4)) === parseFloat(rect.bottom.toFixed(4)) && parseFloat(this.left.toFixed(4)) === parseFloat(rect.left.toFixed(4)) && parseFloat(this.right.toFixed(4)) === parseFloat(rect.right.toFixed(4)); - }; - return Rectangle; -}(); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Ic5h":[function(require,module,exports,__globalThis) { -/* eslint-disable @typescript-eslint/no-explicit-any */ /** - * Returns a single function which will call each of the given functions in the context of the - * parent. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "appendFunction", ()=>appendFunction); -function appendFunction(parent) { + }); + Rectangle2.prototype.equals = function(rect2) { + return parseFloat(this.top.toFixed(4)) === parseFloat(rect2.top.toFixed(4)) && parseFloat(this.bottom.toFixed(4)) === parseFloat(rect2.bottom.toFixed(4)) && parseFloat(this.left.toFixed(4)) === parseFloat(rect2.left.toFixed(4)) && parseFloat(this.right.toFixed(4)) === parseFloat(rect2.right.toFixed(4)); + }; + return Rectangle2; + })() + ); + function appendFunction(parent) { var functions = []; - for(var _i = 1; _i < arguments.length; _i++)functions[_i - 1] = arguments[_i]; - if (functions.length < 2) return functions[0]; + for (var _i = 1; _i < arguments.length; _i++) { + functions[_i - 1] = arguments[_i]; + } + if (functions.length < 2) { + return functions[0]; + } return function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - functions.forEach(function(f) { - return f && f.apply(parent, args); - }); + var args = []; + for (var _i2 = 0; _i2 < arguments.length; _i2++) { + args[_i2] = arguments[_i2]; + } + functions.forEach(function(f) { + return f && f.apply(parent, args); + }); }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2p7Pt":[function(require,module,exports,__globalThis) { -/** - * ARIA helper to concatenate attributes, returning undefined if all attributes - * are undefined. (Empty strings are not a valid ARIA attribute value.) - * - * @param ariaAttributes - ARIA attributes to merge - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mergeAriaAttributeValues", ()=>mergeAriaAttributeValues); -function mergeAriaAttributeValues() { + } + function mergeAriaAttributeValues() { var ariaAttributes = []; - for(var _i = 0; _i < arguments.length; _i++)ariaAttributes[_i] = arguments[_i]; + for (var _i = 0; _i < arguments.length; _i++) { + ariaAttributes[_i] = arguments[_i]; + } var mergedAttribute = ariaAttributes.filter(function(arg) { - return arg; - }).join(' ').trim(); - return mergedAttribute === '' ? undefined : mergedAttribute; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Pspi":[function(require,module,exports,__globalThis) { -/** - * Helper to find the index of an item within an array, using a callback to - * determine the match. - * - * @public - * @param array - Array to search. - * @param cb - Callback which returns true on matches. - * @param fromIndex - Optional index to start from (defaults to 0) - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "findIndex", ()=>findIndex); -/** - * Helper to find the first item within an array that satisfies the callback. - * @param array - Array to search - * @param cb - Callback which returns true on matches - */ parcelHelpers.export(exports, "find", ()=>find); -/** - * Creates an array of a given size and helper method to populate. - * - * @public - * @param size - Size of array. - * @param getItem - Callback to populate given cell index. - */ parcelHelpers.export(exports, "createArray", ()=>createArray); -/** - * Convert the given array to a matrix with columnCount number - * of columns. - * - * @public - * @param items - The array to convert - * @param columnCount - The number of columns for the resulting matrix - * @returns A matrix of items - */ parcelHelpers.export(exports, "toMatrix", ()=>toMatrix); -/** - * Given an array, it returns a new array that does not contain the item at the given index. - * @param array - The array to operate on - * @param index - The index of the element to remove - */ parcelHelpers.export(exports, "removeIndex", ()=>removeIndex); -/** - * Given an array, this function returns a new array where the element at a given index has been replaced. - * @param array - The array to operate on - * @param newElement - The element that will be placed in the new array - * @param index - The index of the element that should be replaced - */ parcelHelpers.export(exports, "replaceElement", ()=>replaceElement); -/** - * Given an array, this function returns a new array where an element has been inserted at the given index. - * @param array - The array to operate on - * @param index - The index where an element should be inserted - * @param itemToAdd - The element to insert - */ parcelHelpers.export(exports, "addElementAtIndex", ()=>addElementAtIndex); -/** - * Given an array where each element is of type T or T[], flatten it into an array of T - * @param array - The array where each element can optionally also be an array - */ parcelHelpers.export(exports, "flatten", ()=>flatten); -/** - * Returns a boolean indicating if the two given arrays are equal in length and values. - * - * @param array1 - First array to compare - * @param array2 - Second array to compare - * @returns True if the arrays are the same length and have the same values in the same positions, false otherwise. - */ parcelHelpers.export(exports, "arraysEqual", ()=>arraysEqual); -function findIndex(array, cb, fromIndex) { - if (fromIndex === void 0) fromIndex = 0; - var index = -1; - for(var i = fromIndex; array && i < array.length; i++)if (cb(array[i], i)) { - index = i; + return arg; + }).join(" ").trim(); + return mergedAttribute === "" ? void 0 : mergedAttribute; + } + function findIndex(array2, cb, fromIndex) { + if (fromIndex === void 0) { + fromIndex = 0; + } + var index2 = -1; + for (var i = fromIndex; array2 && i < array2.length; i++) { + if (cb(array2[i], i)) { + index2 = i; break; + } } - return index; -} -function find(array, cb) { - var index = findIndex(array, cb); - if (index < 0) return undefined; - return array[index]; -} -function createArray(size, getItem) { - var array = []; - for(var i = 0; i < size; i++)array.push(getItem(i)); - return array; -} -function toMatrix(items, columnCount) { - return items.reduce(function(rows, currentValue, index) { - if (index % columnCount === 0) rows.push([ - currentValue - ]); - else rows[rows.length - 1].push(currentValue); - return rows; - }, []); -} -function removeIndex(array, index) { - return array.filter(function(_, i) { - return index !== i; - }); -} -function replaceElement(array, newElement, index) { - var copy = array.slice(); - copy[index] = newElement; - return copy; -} -function addElementAtIndex(array, index, itemToAdd) { - var copy = array.slice(); - copy.splice(index, 0, itemToAdd); - return copy; -} -function flatten(array) { - var result = []; - array.forEach(function(item) { - return result = result.concat(item); - }); - return result; -} -function arraysEqual(array1, array2) { - if (array1.length !== array2.length) return false; - for(var i = 0; i < array1.length; i++){ - if (array1[i] !== array2[i]) return false; + return index2; + } + function find$3(array2, cb) { + var index2 = findIndex(array2, cb); + if (index2 < 0) { + return void 0; } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jPOCb":[function(require,module,exports,__globalThis) { -/** - * asAsync - a HOC for async loading components. - * - * Usage: - * - * const AsyncDialog = asAsync({ - * load: () => import('Dialog').then(result => result.default), - * }); - * - * React.render(domElement, <AsyncDialog asyncPlaceholder={ () => <Spinner/> } { ...dialogProps } />); - * - * Note the `asyncPlaceholder` prop will be respected when rendering the async component and it hasn't - * been loaded yet. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Produces a component which internally loads the target component before first mount. - * The component passes all props through to the loaded component. - * - * This overload accepts a module with a default export for the component. - */ parcelHelpers.export(exports, "asAsync", ()=>asAsync); -var _tslib = require("tslib"); -var _react = require("react"); -/** - * If possible, use a WeakMap to maintain a cache of loaded components. - * This can be used to synchronously render components that have already been loaded, - * rather than having to wait for at least one async tick. - */ var _syncModuleCache = typeof WeakMap !== 'undefined' ? new WeakMap() : undefined; -function asAsync(options) { - var Async = /** @class */ function(_super) { - (0, _tslib.__extends)(Async, _super); - function Async() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.state = { - Component: _syncModuleCache ? _syncModuleCache.get(options.load) : undefined - }; - return _this; - } - Async.prototype.render = function() { - // Typescript issue: the rest can't be pulled without the any cast, as TypeScript fails with rest on generics. - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var _a = this.props, forwardedRef = _a.forwardedRef, Placeholder = _a.asyncPlaceholder, rest = (0, _tslib.__rest)(_a, [ - "forwardedRef", - "asyncPlaceholder" - ]); - var Component = this.state.Component; - return Component ? _react.createElement(Component, (0, _tslib.__assign)((0, _tslib.__assign)({}, rest), { - ref: forwardedRef - })) : Placeholder ? _react.createElement(Placeholder, null) : null; - }; - Async.prototype.componentDidMount = function() { - var _this = this; - var Component = this.state.Component; - if (!Component) options.load().then(function(LoadedComponent) { - if (LoadedComponent) { - // Cache component for future reference. - _syncModuleCache && _syncModuleCache.set(options.load, LoadedComponent); - // Set state. - _this.setState({ - Component: LoadedComponent - }, options.onLoad); - } - }).catch(options.onError); - }; - return Async; - }(_react.Component); - return _react.forwardRef(function(props, ref) { - return _react.createElement(Async, (0, _tslib.__assign)({}, props, { - forwardedRef: ref - })); - }); -} - -},{"tslib":"9gizs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l66AW":[function(require,module,exports,__globalThis) { -/** - * AssertNever is a utility function that can be used for exhaustiveness checks in switch statements. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assertNever", ()=>assertNever); -function assertNever(x) { - throw new Error('Unexpected object: ' + x); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lKbNl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Creates a getClassNames function which calls getStyles given the props, and injects them - * into mergeStyleSets. - * - * Note that the props you pass in on every render should be in the same order and - * immutable (numbers, strings, and booleans). This will allow the results to be memoized. Violating - * these will cause extra recalcs to occur. - */ parcelHelpers.export(exports, "classNamesFunction", ()=>classNamesFunction); -var _mergeStyles = require("@fluentui/merge-styles"); -var _rtl = require("./rtl"); -var _dom = require("./dom"); -var MAX_CACHE_COUNT = 50; -var DEFAULT_SPECIFICITY_MULTIPLIER = 5; -var _memoizedClassNames = 0; -var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); -if (stylesheet && stylesheet.onReset) stylesheet.onReset(function() { - return _memoizedClassNames++; -}); -// Note that because of the caching nature within the classNames memoization, -// I've disabled this rule to simply be able to work with any types. -/* eslint-disable @typescript-eslint/no-explicit-any */ // This represents a prop we attach to each Map to indicate the cached return value -// associated with the graph node. -var retVal = '__retval__'; -function classNamesFunction(options) { - // We build a trie where each node is a Map. The map entry key represents an argument - // value, and the entry value is another node (Map). Each node has a `__retval__` - // property which is used to hold the cached response. - if (options === void 0) options = {}; - // To derive the response, we can simply ensure the arguments are added or already - // exist in the trie. At the last node, if there is a `__retval__` we return that. Otherwise - // we call the `getStyles` api to evaluate, cache on the property, and return that. - // let map: IRecursiveMemoNode = new Map(); - var windowMap = new Map(); - var styleCalcCount = 0; - var getClassNamesCount = 0; - var currentMemoizedClassNames = _memoizedClassNames; - var getClassNames = function(styleFunctionOrObject, styleProps) { - var _a; - if (styleProps === void 0) styleProps = {}; - // If useStaticStyles is true, styleFunctionOrObject returns slot to classname mappings. - // If there is also no style overrides, we can skip merge styles completely and - // simply return the result from the style funcion. - if (options.useStaticStyles && typeof styleFunctionOrObject === 'function' && styleFunctionOrObject.__noStyleOverride__) return styleFunctionOrObject(styleProps); - getClassNamesCount++; - var shadowConfig = styleFunctionOrObject ? styleFunctionOrObject.__shadowConfig__ : undefined; - var key = shadowConfig && shadowConfig.window ? shadowConfig.window : '__default__'; - if (!windowMap.has(key)) windowMap.set(key, new Map()); - var current = windowMap.get(key); - // let current: Map<any, any> = map; - var theme = styleProps.theme; - var rtl = theme && theme.rtl !== undefined ? theme.rtl : (0, _rtl.getRTL)(); - var disableCaching = options.disableCaching; - // On reset of our stylesheet, reset memoized cache. - if (currentMemoizedClassNames !== _memoizedClassNames) { - currentMemoizedClassNames = _memoizedClassNames; - // map = new Map(); - windowMap.set(key, new Map()); - current = windowMap.get(key); - styleCalcCount = 0; - } - if (!options.disableCaching) { - current = _traverseMap(windowMap.get(key), styleFunctionOrObject); - current = _traverseMap(current, styleProps); - } - if (disableCaching || !current[retVal]) { - if (styleFunctionOrObject === undefined) current[retVal] = {}; - else current[retVal] = (0, _mergeStyles.mergeCssSets)([ - typeof styleFunctionOrObject === 'function' ? styleFunctionOrObject(styleProps) : styleFunctionOrObject - ], { - shadowConfig: styleFunctionOrObject.__shadowConfig__, - rtl: !!rtl, - specificityMultiplier: options.useStaticStyles ? DEFAULT_SPECIFICITY_MULTIPLIER : undefined - }); - if (!disableCaching) styleCalcCount++; - } - if (styleCalcCount > (options.cacheSize || MAX_CACHE_COUNT)) { - var win = (0, _dom.getWindow)(); - if ((_a = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _a === void 0 ? void 0 : _a.enableClassNameCacheFullWarning) { - // eslint-disable-next-line no-console - console.warn("Styles are being recalculated too frequently. Cache miss rate is ".concat(styleCalcCount, "/").concat(getClassNamesCount, ".")); - // eslint-disable-next-line no-console - console.trace(); - } - windowMap.get(key).clear(); - styleCalcCount = 0; - // Mutate the options passed in, that's all we can do. - options.disableCaching = true; - } - // Note: the retVal is an attached property on the Map; not a key in the Map. We use this attached property to - // cache the return value for this branch of the graph. - return current[retVal]; - }; - return getClassNames; -} -function _traverseEdge(current, value) { - value = _normalizeValue(value); - if (!current.has(value)) current.set(value, new Map()); - return current.get(value); -} -function _traverseMap(current, inputs) { - if (typeof inputs === 'function') { - var cachedInputsFromStyled = inputs.__cachedInputs__; - if (cachedInputsFromStyled) // The styled helper will generate the styles function and will attach the cached - // inputs (consisting of the default styles, customzied styles, and user provided styles.) - // These should be used as cache keys for deriving the memoized value. - for(var _i = 0, _a = inputs.__cachedInputs__; _i < _a.length; _i++){ - var input = _a[_i]; - current = _traverseEdge(current, input); - } - else current = _traverseEdge(current, inputs); - } else if (typeof inputs === 'object') { - for(var propName in inputs)if (inputs.hasOwnProperty(propName)) current = _traverseEdge(current, inputs[propName]); + return array2[index2]; + } + function addElementAtIndex(array2, index2, itemToAdd) { + var copy2 = array2.slice(); + copy2.splice(index2, 0, itemToAdd); + return copy2; + } + function arraysEqual(array1, array2) { + if (array1.length !== array2.length) { + return false; } - return current; -} -function _normalizeValue(value) { - switch(value){ - case undefined: - return '__undefined__'; - case null: - return '__null__'; - default: - return value; - } -} - -},{"@fluentui/merge-styles":"bDG2L","./rtl":"gRlx4","./dom":"QMA5I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gRlx4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the rtl state of the page (returns true if in rtl.) - */ parcelHelpers.export(exports, "getRTL", ()=>getRTL); -/** - * Sets the rtl state of the page (by adjusting the dir attribute of the html element.) - */ parcelHelpers.export(exports, "setRTL", ()=>setRTL); -/** - * Returns the given key, but flips right/left arrows if necessary. - */ parcelHelpers.export(exports, "getRTLSafeKeyCode", ()=>getRTLSafeKeyCode); -var _keyCodes = require("./KeyCodes"); -var _getDocument = require("./dom/getDocument"); -var _sessionStorage = require("./sessionStorage"); -var _mergeStyles = require("@fluentui/merge-styles"); -var RTL_LOCAL_STORAGE_KEY = 'isRTL'; -// Default to undefined so that we initialize on first read. -var _isRTL; -function getRTL(theme) { - if (theme === void 0) theme = {}; - if (theme.rtl !== undefined) return theme.rtl; - if (_isRTL === undefined) { - // Fabric supports persisting the RTL setting between page refreshes via session storage - var savedRTL = (0, _sessionStorage.getItem)(RTL_LOCAL_STORAGE_KEY); - if (savedRTL !== null) { - _isRTL = savedRTL === '1'; - setRTL(_isRTL); - } - var doc = (0, _getDocument.getDocument)(); - if (_isRTL === undefined && doc) { - _isRTL = (doc.body && doc.body.getAttribute('dir') || doc.documentElement.getAttribute('dir')) === 'rtl'; - (0, _mergeStyles.setRTL)(_isRTL); - } + for (var i = 0; i < array1.length; i++) { + if (array1[i] !== array2[i]) { + return false; + } } - return !!_isRTL; -} -function setRTL(isRTL, persistSetting) { - if (persistSetting === void 0) persistSetting = false; - var doc = (0, _getDocument.getDocument)(); - if (doc) doc.documentElement.setAttribute('dir', isRTL ? 'rtl' : 'ltr'); - if (persistSetting) (0, _sessionStorage.setItem)(RTL_LOCAL_STORAGE_KEY, isRTL ? '1' : '0'); - _isRTL = isRTL; - (0, _mergeStyles.setRTL)(_isRTL); -} -function getRTLSafeKeyCode(key, theme) { - if (theme === void 0) theme = {}; - if (getRTL(theme)) { - if (key === (0, _keyCodes.KeyCodes).left) key = (0, _keyCodes.KeyCodes).right; - else if (key === (0, _keyCodes.KeyCodes).right) key = (0, _keyCodes.KeyCodes).left; - } - return key; -} - -},{"./KeyCodes":"eQoHk","./dom/getDocument":"7EOu7","./sessionStorage":"fAeWE","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fAeWE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Fetches an item from session storage without throwing an exception - * @param key The key of the item to fetch from session storage - */ parcelHelpers.export(exports, "getItem", ()=>getItem); -/** - * Inserts an item into session storage without throwing an exception - * @param key The key of the item to add to session storage - * @param data The data to put into session storage - */ parcelHelpers.export(exports, "setItem", ()=>setItem); -var _getWindow = require("./dom/getWindow"); -function getItem(key) { + return true; + } + function getItem$1(key2) { var result = null; try { - var win = (0, _getWindow.getWindow)(); - result = win ? win.sessionStorage.getItem(key) : null; + var win = getWindow(); + result = win ? win.sessionStorage.getItem(key2) : null; } catch (e) { - /* Eat the exception */ } + } return result; -} -function setItem(key, data) { - var _a; + } + function setItem(key2, data2) { + var _a2; try { - (_a = (0, _getWindow.getWindow)()) === null || _a === void 0 || _a.sessionStorage.setItem(key, data); + (_a2 = getWindow()) === null || _a2 === void 0 ? void 0 : _a2.sessionStorage.setItem(key2, data2); } catch (e) { - /* Eat the exception */ } -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7HNhY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Composes two components which conform to the `IComponentAs` specification; that is, two - * components which accept a `defaultRender` prop, which is a 'default' implementation of - * a component which accepts the same overall props. - * - * @public - */ parcelHelpers.export(exports, "composeComponentAs", ()=>composeComponentAs); -var _tslib = require("tslib"); -var _react = require("react"); -var _memoize = require("../memoize"); -function createComposedComponent(outer) { - var Outer = outer; - var outerMemoizer = (0, _memoize.createMemoizer)(function(inner) { - if (outer === inner) throw new Error('Attempted to compose a component with itself.'); - var Inner = inner; - var innerMemoizer = (0, _memoize.createMemoizer)(function(defaultRender) { - var InnerWithDefaultRender = function(innerProps) { - return _react.createElement(Inner, (0, _tslib.__assign)({}, innerProps, { - defaultRender: defaultRender - })); - }; - return InnerWithDefaultRender; - }); - var OuterWithDefaultRender = function(outerProps) { - var defaultRender = outerProps.defaultRender; - return _react.createElement(Outer, (0, _tslib.__assign)({}, outerProps, { - defaultRender: defaultRender ? innerMemoizer(defaultRender) : Inner - })); - }; - return OuterWithDefaultRender; - }); - return outerMemoizer; -} -var componentAsMemoizer = (0, _memoize.createMemoizer)(createComposedComponent); -function composeComponentAs(outer, inner) { - return componentAsMemoizer(outer)(inner); -} - -},{"tslib":"9gizs","react":"jGrId","../memoize":"cqPyR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cqPyR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Test utility for providing a custom weakmap. - * - * @internal - * */ parcelHelpers.export(exports, "setMemoizeWeakMap", ()=>setMemoizeWeakMap); -/** - * Reset memoizations. - */ parcelHelpers.export(exports, "resetMemoizations", ()=>resetMemoizations); -/** - * Memoize decorator to be used on class methods. WARNING: the `this` reference - * will be inaccessible within a memoized method, given that a cached method's `this` - * would not be instance-specific. - * - * @public - */ parcelHelpers.export(exports, "memoize", ()=>memoize); -/** - * Memoizes a function; when you pass in the same parameters multiple times, it returns a cached result. - * Be careful when passing in objects, you need to pass in the same INSTANCE for caching to work. Otherwise - * it will grow the cache unnecessarily. Also avoid using default values that evaluate functions; passing in - * undefined for a value and relying on a default function will execute it the first time, but will not - * re-evaluate subsequent times which may have been unexpected. - * - * By default, the cache will reset after 100 permutations, to avoid abuse cases where the function is - * unintendedly called with unique objects. Without a reset, the cache could grow infinitely, so we safeguard - * by resetting. To override this behavior, pass a value of 0 to the maxCacheSize parameter. - * - * @public - * @param cb - The function to memoize. - * @param maxCacheSize - Max results to cache. If the cache exceeds this value, it will reset on the next call. - * @param ignoreNullOrUndefinedResult - Flag to decide whether to cache callback result if it is undefined/null. - * If the flag is set to true, the callback result is recomputed every time till the callback result is - * not undefined/null for the first time, and then the non-undefined/null version gets cached. - * @returns A memoized version of the function. - */ parcelHelpers.export(exports, "memoizeFunction", ()=>memoizeFunction); -/** - * Creates a memoizer for a single-value function, backed by a WeakMap. - * With a WeakMap, the memoized values are only kept as long as the source objects, - * ensuring that there is no memory leak. - * - * This function assumes that the input values passed to the wrapped function will be - * `function` or `object` types. To memoize functions which accept other inputs, use - * `memoizeFunction`, which memoizes against arbitrary inputs using a lookup cache. - * - * @public - */ parcelHelpers.export(exports, "createMemoizer", ()=>createMemoizer); -var _mergeStyles = require("@fluentui/merge-styles"); -var _initializedStylesheetResets = false; -var _resetCounter = 0; -var _emptyObject = { - empty: true -}; -var _dictionary = {}; -var _weakMap = typeof WeakMap === 'undefined' ? null : WeakMap; -function setMemoizeWeakMap(weakMap) { - _weakMap = weakMap; -} -function resetMemoizations() { - _resetCounter++; -} -function memoize(_target, _key, descriptor) { - // We bind to "null" to prevent people from inadvertently pulling values from "this", - // rather than passing them in as input values which can be memoized. - var fn = memoizeFunction(descriptor.value && descriptor.value.bind(null)); - return { - configurable: true, - get: function() { - return fn; - } - }; -} -function memoizeFunction(cb, maxCacheSize, ignoreNullOrUndefinedResult) { - if (maxCacheSize === void 0) maxCacheSize = 100; - if (ignoreNullOrUndefinedResult === void 0) ignoreNullOrUndefinedResult = false; - // Avoid breaking scenarios which don't have weak map. - if (!_weakMap) return cb; - if (!_initializedStylesheetResets) { - var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); - if (stylesheet && stylesheet.onReset) (0, _mergeStyles.Stylesheet).getInstance().onReset(resetMemoizations); - _initializedStylesheetResets = true; } - var rootNode; - var cacheSize = 0; - var localResetCounter = _resetCounter; - return function memoizedFunction() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - var currentNode = rootNode; - if (rootNode === undefined || localResetCounter !== _resetCounter || maxCacheSize > 0 && cacheSize > maxCacheSize) { - rootNode = _createNode(); - cacheSize = 0; - localResetCounter = _resetCounter; - } - currentNode = rootNode; - // Traverse the tree until we find the match. - for(var i = 0; i < args.length; i++){ - var arg = _normalizeArg(args[i]); - if (!currentNode.map.has(arg)) currentNode.map.set(arg, _createNode()); - currentNode = currentNode.map.get(arg); - } - if (!currentNode.hasOwnProperty('value')) { - currentNode.value = cb.apply(void 0, args); - cacheSize++; - } - if (ignoreNullOrUndefinedResult && (currentNode.value === null || currentNode.value === undefined)) currentNode.value = cb.apply(void 0, args); - return currentNode.value; - }; -} -function createMemoizer(getValue) { - if (!_weakMap) // Without a `WeakMap` implementation, memoization is not possible. - return getValue; - var cache = new _weakMap(); - function memoizedGetValue(input) { - if (!input || typeof input !== 'function' && typeof input !== 'object') // A WeakMap can only be used to test against reference values, i.e. 'function' and 'object'. - // All other inputs cannot be memoized against in this manner. - return getValue(input); - if (cache.has(input)) return cache.get(input); - var value = getValue(input); - cache.set(input, value); - return value; - } - return memoizedGetValue; -} -function _normalizeArg(val) { - if (!val) return _emptyObject; - else if (typeof val === 'object' || typeof val === 'function') return val; - else if (!_dictionary[val]) _dictionary[val] = { - val: val - }; - return _dictionary[val]; -} -function _createNode() { - return { - map: _weakMap ? new _weakMap() : null - }; -} - -},{"@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Lj2y":[function(require,module,exports,__globalThis) { -/** - * Determines whether a component is controlled. - * @param props - Component props - * @param valueProp - Prop containing the controlled value - * @returns true if controlled, false if uncontrolled - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isControlled", ()=>isControlled); -function isControlled(props, valueProp) { - // React's built-in <input> considers a prop to be provided if its value is non-null/undefined. - // Mirror that behavior here (rather than checking for just undefined). - return props[valueProp] !== undefined && props[valueProp] !== null; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dmVvk":[function(require,module,exports,__globalThis) { -/** - * Concatination helper, which can merge class names together. Skips over falsey values. - * - * @public - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "css", ()=>css); -function css() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - var classes = []; - for(var _a = 0, args_1 = args; _a < args_1.length; _a++){ - var arg = args_1[_a]; - if (arg) { - if (typeof arg === 'string') classes.push(arg); - else if (arg.hasOwnProperty('toString') && typeof arg.toString === 'function') classes.push(arg.toString()); - else { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - for(var key in arg)// eslint-disable-next-line @typescript-eslint/no-explicit-any - if (arg[key]) classes.push(key); - } - } - } - return classes.join(' '); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQS4T":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Customizations", ()=>Customizations); -var _tslib = require("tslib"); -var _globalSettings = require("../GlobalSettings"); -var CustomizationsGlobalKey = 'customizations'; -var NO_CUSTOMIZATIONS = { - settings: {}, - scopedSettings: {}, - inCustomizerContext: false -}; -var _allSettings = (0, _globalSettings.GlobalSettings).getValue(CustomizationsGlobalKey, { - settings: {}, - scopedSettings: {}, - inCustomizerContext: false -}); -var _events = []; -var Customizations = /** @class */ function() { - function Customizations() {} - Customizations.reset = function() { - _allSettings.settings = {}; - _allSettings.scopedSettings = {}; - }; - /** Apply global Customization settings. - * @example Customizations.applySettings(\{ theme: \{...\} \}); - */ Customizations.applySettings = function(settings) { - _allSettings.settings = (0, _tslib.__assign)((0, _tslib.__assign)({}, _allSettings.settings), settings); - Customizations._raiseChange(); - }; - /** Apply Customizations to a particular named scope, like a component. - * @example Customizations.applyScopedSettings('Nav', \{ styles: () =\> \{\} \}); - */ Customizations.applyScopedSettings = function(scopeName, settings) { - _allSettings.scopedSettings[scopeName] = (0, _tslib.__assign)((0, _tslib.__assign)({}, _allSettings.scopedSettings[scopeName]), settings); - Customizations._raiseChange(); - }; - Customizations.getSettings = function(properties, scopeName, localSettings) { - if (localSettings === void 0) localSettings = NO_CUSTOMIZATIONS; - var settings = {}; - var localScopedSettings = scopeName && localSettings.scopedSettings[scopeName] || {}; - var globalScopedSettings = scopeName && _allSettings.scopedSettings[scopeName] || {}; - for(var _i = 0, properties_1 = properties; _i < properties_1.length; _i++){ - var property = properties_1[_i]; - settings[property] = localScopedSettings[property] || localSettings.settings[property] || globalScopedSettings[property] || _allSettings.settings[property]; - } - return settings; - }; - /** Used to run some code that sets Customizations without triggering an update until the end. - * Useful for applying Customizations that don't affect anything currently rendered, or for - * applying many customizations at once. - * @param suppressUpdate - Do not raise the change event at the end, preventing all updates - */ Customizations.applyBatchedUpdates = function(code, suppressUpdate) { - Customizations._suppressUpdates = true; - try { - code(); - } catch (_a) { - /* do nothing */ } - Customizations._suppressUpdates = false; - if (!suppressUpdate) Customizations._raiseChange(); - }; - Customizations.observe = function(onChange) { - _events.push(onChange); - }; - Customizations.unobserve = function(onChange) { - _events = _events.filter(function(cb) { - return cb !== onChange; - }); - }; - Customizations._raiseChange = function() { - if (!Customizations._suppressUpdates) _events.forEach(function(cb) { - return cb(); - }); - }; - return Customizations; -}(); - -},{"tslib":"9gizs","../GlobalSettings":"6x3RK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5lXfh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Customizer", ()=>Customizer); -var _tslib = require("tslib"); -var _react = require("react"); -var _customizations = require("./Customizations"); -var _customizerContext = require("./CustomizerContext"); -var _mergeCustomizations = require("./mergeCustomizations"); -/** - * The Customizer component allows for default props to be mixed into components which - * are decorated with the customizable() decorator, or use the styled HOC. This enables - * injection scenarios like: - * - * 1. render svg icons instead of the icon font within all buttons - * 2. inject a custom theme object into a component - * - * Props are provided via the settings prop which should be one of the following: - * - A json map which contains 1 or more name/value pairs representing injectable props. - * - A function that receives the current settings and returns the new ones that apply to the scope - * - * @public - * - * @deprecated This component is deprecated for purpose of applying theme to components - * as of `@fluentui/react` version 8. Use `ThemeProvider` for applying theme instead. - */ var Customizer = /** @class */ function(_super) { - (0, _tslib.__extends)(Customizer, _super); - function Customizer() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._onCustomizationChange = function() { - return _this.forceUpdate(); - }; - return _this; - } - Customizer.prototype.componentDidMount = function() { - (0, _customizations.Customizations).observe(this._onCustomizationChange); - }; - Customizer.prototype.componentWillUnmount = function() { - (0, _customizations.Customizations).unobserve(this._onCustomizationChange); - }; - Customizer.prototype.render = function() { - var _this = this; - var contextTransform = this.props.contextTransform; - return _react.createElement((0, _customizerContext.CustomizerContext).Consumer, null, function(parentContext) { - var newContext = (0, _mergeCustomizations.mergeCustomizations)(_this.props, parentContext); - if (contextTransform) newContext = contextTransform(newContext); - return _react.createElement((0, _customizerContext.CustomizerContext).Provider, { - value: newContext - }, _this.props.children); - }); - }; - return Customizer; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./Customizations":"eQS4T","./CustomizerContext":"aB8eN","./mergeCustomizations":"yo2of","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aB8eN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CustomizerContext", ()=>CustomizerContext); -var _react = require("react"); -var CustomizerContext = _react.createContext({ - customizations: { - inCustomizerContext: false, - settings: {}, - scopedSettings: {} - } -}); - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"yo2of":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Merge props and customizations giving priority to props over context. - * NOTE: This function will always perform multiple merge operations. Use with caution. - * @param props - New settings to merge in. - * @param parentContext - Context containing current settings. - * @returns Merged customizations. - */ parcelHelpers.export(exports, "mergeCustomizations", ()=>mergeCustomizations); -var _mergeSettings = require("./mergeSettings"); -function mergeCustomizations(props, parentContext) { - var _a = (parentContext || {}).customizations, customizations = _a === void 0 ? { - settings: {}, - scopedSettings: {} - } : _a; - return { - customizations: { - settings: (0, _mergeSettings.mergeSettings)(customizations.settings, props.settings), - scopedSettings: (0, _mergeSettings.mergeScopedSettings)(customizations.scopedSettings, props.scopedSettings), - inCustomizerContext: true - } - }; -} - -},{"./mergeSettings":"c4Gl8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c4Gl8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Merge new and old settings, giving priority to new settings. - * New settings is optional in which case oldSettings is returned as-is. - * @param oldSettings - Old settings to fall back to. - * @param newSettings - New settings that will be merged over oldSettings. - * @returns Merged settings. - */ parcelHelpers.export(exports, "mergeSettings", ()=>mergeSettings); -parcelHelpers.export(exports, "mergeScopedSettings", ()=>mergeScopedSettings); -var _tslib = require("tslib"); -function mergeSettings(oldSettings, newSettings) { - if (oldSettings === void 0) oldSettings = {}; - var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _settingsMergeWith(newSettings); - return mergeSettingsWith(oldSettings); -} -function mergeScopedSettings(oldSettings, newSettings) { - if (oldSettings === void 0) oldSettings = {}; - var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _scopedSettingsMergeWith(newSettings); - return mergeSettingsWith(oldSettings); -} -function _isSettingsFunction(settings) { - return typeof settings === 'function'; -} -function _settingsMergeWith(newSettings) { - return function(settings) { - return newSettings ? (0, _tslib.__assign)((0, _tslib.__assign)({}, settings), newSettings) : settings; - }; -} -function _scopedSettingsMergeWith(scopedSettingsFromProps) { - if (scopedSettingsFromProps === void 0) scopedSettingsFromProps = {}; - return function(oldScopedSettings) { - var newScopedSettings = (0, _tslib.__assign)({}, oldScopedSettings); - for(var scopeName in scopedSettingsFromProps)if (scopedSettingsFromProps.hasOwnProperty(scopeName)) newScopedSettings[scopeName] = (0, _tslib.__assign)((0, _tslib.__assign)({}, oldScopedSettings[scopeName]), scopedSettingsFromProps[scopeName]); - return newScopedSettings; - }; -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7RolT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "customizable", ()=>customizable); -var _tslib = require("tslib"); -var _react = require("react"); -var _customizations = require("./Customizations"); -var _hoistStatics = require("../hoistStatics"); -var _customizerContext = require("./CustomizerContext"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _mergeStylesShadowRootConsumer = require("../shadowDom/contexts/MergeStylesShadowRootConsumer"); -var _getWindow = require("../dom/getWindow"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _memoize = require("../memoize"); -var memoizedMakeShadowConfig = (0, _memoize.memoizeFunction)((0, _mergeStyles.makeShadowConfig)); -var mergeComponentStyles = (0, _memoize.memoizeFunction)(// eslint-disable-next-line @typescript-eslint/no-explicit-any -function(defaultStyles, componentStyles, shadowConfig) { - var _a; - var styles = (_a = componentStyles !== null && componentStyles !== void 0 ? componentStyles : defaultStyles) !== null && _a !== void 0 ? _a : {}; - styles.__shadowConfig__ = shadowConfig; - return styles; -}); -function customizable(scope, fields, concatStyles) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return function customizableFactory(ComposedComponent) { - var _a; - var resultClass = (_a = /** @class */ function(_super) { - (0, _tslib.__extends)(ComponentWithInjectedProps, _super); - function ComponentWithInjectedProps(props) { - var _this = _super.call(this, props) || this; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _this._styleCache = {}; - _this._onSettingChanged = _this._onSettingChanged.bind(_this); - return _this; - } - ComponentWithInjectedProps.prototype.componentDidMount = function() { - (0, _customizations.Customizations).observe(this._onSettingChanged); - }; - ComponentWithInjectedProps.prototype.componentWillUnmount = function() { - (0, _customizations.Customizations).unobserve(this._onSettingChanged); - }; - ComponentWithInjectedProps.prototype.render = function() { - var _this = this; - return _react.createElement((0, _mergeStylesShadowRootConsumer.MergeStylesShadowRootConsumer), { - stylesheetKey: scope - }, function(inShadow) { - return _react.createElement((0, _customizerContext.CustomizerContext).Consumer, null, function(context) { - var _a; - var defaultProps = (0, _customizations.Customizations).getSettings(fields, scope, context.customizations); - var win = (_a = _this.context.window) !== null && _a !== void 0 ? _a : (0, _getWindow.getWindow)(); - var shadowConfig = memoizedMakeShadowConfig(scope, inShadow, win); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var componentProps = _this.props; - // If defaultProps.styles is a function, evaluate it before calling concatStyleSets - if (defaultProps.styles && typeof defaultProps.styles === 'function') defaultProps.styles = defaultProps.styles((0, _tslib.__assign)((0, _tslib.__assign)({}, defaultProps), componentProps)); - // If concatStyles is true and custom styles have been defined compute those styles - if (concatStyles && defaultProps.styles) { - if (_this._styleCache.default !== defaultProps.styles || _this._styleCache.component !== componentProps.styles) { - var mergedStyles = (0, _mergeStyles.concatStyleSets)(defaultProps.styles, componentProps.styles); - mergedStyles.__shadowConfig__ = shadowConfig; - _this._styleCache.default = defaultProps.styles; - _this._styleCache.component = componentProps.styles; - _this._styleCache.merged = mergedStyles; - } - return _react.createElement(ComposedComponent, (0, _tslib.__assign)({}, defaultProps, componentProps, { - styles: _this._styleCache.merged - })); - } - var styles = mergeComponentStyles(defaultProps.styles, componentProps.styles, shadowConfig); - return _react.createElement(ComposedComponent, (0, _tslib.__assign)({}, defaultProps, componentProps, { - styles: styles - })); - }); - }); - }; - ComponentWithInjectedProps.prototype._onSettingChanged = function() { - this.forceUpdate(); - }; - return ComponentWithInjectedProps; - }(_react.Component), _a.displayName = 'Customized' + scope, _a.contextType = (0, _reactWindowProvider.WindowContext), _a); - return (0, _hoistStatics.hoistStatics)(ComposedComponent, resultClass); - }; -} - -},{"tslib":"9gizs","react":"jGrId","./Customizations":"eQS4T","../hoistStatics":"4OPmM","./CustomizerContext":"aB8eN","@fluentui/merge-styles":"bDG2L","../shadowDom/contexts/MergeStylesShadowRootConsumer":"8fmsO","../dom/getWindow":"aI1a8","@fluentui/react-window-provider":"iP8C0","../memoize":"cqPyR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4OPmM":[function(require,module,exports,__globalThis) { -/** - * Allows you to hoist static functions in components. - * Created for the purpose of fixing broken static functions in classes - * that utilize decorators. - * - * @public - * @param source - The object where the methods are hoisted from. - * @param dest - The object to hoist the methods onto. - * @returns The dest object with methods added - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hoistStatics", ()=>hoistStatics); -function hoistStatics(source, dest) { - for(var name_1 in source)if (source.hasOwnProperty(name_1)) // eslint-disable-next-line @typescript-eslint/no-explicit-any - dest[name_1] = source[name_1]; - return dest; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8fmsO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesShadowRootConsumer", ()=>MergeStylesShadowRootConsumer); -var _mergeStyles = require("@fluentui/merge-styles"); -var _useMergeStylesHooks = require("../hooks/useMergeStylesHooks"); -var _useMergeStylesShadowRoot = require("../hooks/useMergeStylesShadowRoot"); -var MergeStylesShadowRootConsumer = function(_a) { - var stylesheetKey = _a.stylesheetKey, children = _a.children; - var _b = (0, _useMergeStylesHooks.useMergeStylesHooks)(), useAdoptedStylesheetEx = _b.useAdoptedStylesheetEx, useMergeStylesRootStylesheets = _b.useMergeStylesRootStylesheets, useWindow = _b.useWindow; - var shadowCtx = (0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext)(); - var rootMergeStyles = useMergeStylesRootStylesheets(); - var win = useWindow(); - useAdoptedStylesheetEx((0, _mergeStyles.GLOBAL_STYLESHEET_KEY), shadowCtx, rootMergeStyles, win); - useAdoptedStylesheetEx(stylesheetKey, shadowCtx, rootMergeStyles, win); - return children(!!shadowCtx); -}; - -},{"@fluentui/merge-styles":"bDG2L","../hooks/useMergeStylesHooks":"90VFe","../hooks/useMergeStylesShadowRoot":"gp0eP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"90VFe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>useMergeStylesHooks); -var _react = require("react"); -var _mergeStylesDefaultContext = require("../contexts/MergeStylesDefaultContext"); -var useMergeStylesHooks = function() { - var ctx = _react.useContext((0, _mergeStylesDefaultContext.MergeStylesDefaultContext)); - return { - useAdoptedStylesheet: ctx.useAdoptedStylesheet, - useAdoptedStylesheetEx: ctx.useAdoptedStylesheetEx, - useShadowConfig: ctx.useShadowConfig, - useMergeStylesShadowRootContext: ctx.useMergeStylesShadowRootContext, - useHasMergeStylesShadowRootContext: ctx.useHasMergeStylesShadowRootContext, - useMergeStylesRootStylesheets: ctx.useMergeStylesRootStylesheets, - useWindow: ctx.useWindow, - useStyled: ctx.useStyled - }; -}; - -},{"react":"jGrId","../contexts/MergeStylesDefaultContext":"jiC2S","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jiC2S":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "noop", ()=>noop); -parcelHelpers.export(exports, "noopShadow", ()=>noopShadow); -parcelHelpers.export(exports, "noopRootStylesheets", ()=>noopRootStylesheets); -parcelHelpers.export(exports, "noopUndefined", ()=>noopUndefined); -parcelHelpers.export(exports, "getNewContext", ()=>getNewContext); -parcelHelpers.export(exports, "MergeStylesDefaultContext", ()=>MergeStylesDefaultContext); -var _mergeStyles = require("@fluentui/merge-styles"); -var _react = require("react"); -var noop = function() { - return false; -}; -var noopShadow = function() { - return 0, _mergeStyles.DEFAULT_SHADOW_CONFIG; -}; -var noopRootStylesheets = function() { - return new Map(); -}; -var noopUndefined = function() { - return undefined; -}; -var getNewContext = function() { - return { - stylesheets: new Map(), - useAdoptedStylesheetEx: noop, - useAdoptedStylesheet: noop, - useShadowConfig: noopShadow, - useMergeStylesShadowRootContext: noopUndefined, - useHasMergeStylesShadowRootContext: noop, - useMergeStylesRootStylesheets: noopRootStylesheets, - useWindow: noopUndefined, - useStyled: noopUndefined - }; -}; -var MergeStylesDefaultContext = _react.createContext(getNewContext()); - -},{"@fluentui/merge-styles":"bDG2L","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gp0eP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>useHasMergeStylesShadowRootContext); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>useMergeStylesShadowRootContext); -var _react = require("react"); -var _mergeStylesShadowRootContext = require("../contexts/MergeStylesShadowRootContext"); -var useHasMergeStylesShadowRootContext = function() { - return !!useMergeStylesShadowRootContext(); -}; -var useMergeStylesShadowRootContext = function() { - return _react.useContext((0, _mergeStylesShadowRootContext.MergeStylesShadowRootContext)); -}; - -},{"react":"jGrId","../contexts/MergeStylesShadowRootContext":"eqTfx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eqTfx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesShadowRootContext", ()=>MergeStylesShadowRootContext); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>MergeStylesShadowRootProvider); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _useMergeStylesHooks = require("../hooks/useMergeStylesHooks"); -var MergeStylesShadowRootContext = _react.createContext(undefined); -var MergeStylesShadowRootProvider = function(_a) { - var shadowRoot = _a.shadowRoot, props = (0, _tslib.__rest)(_a, [ - "shadowRoot" - ]); - var value = _react.useMemo(function() { - return { - stylesheets: new Map(), - shadowRoot: shadowRoot - }; - }, [ - shadowRoot - ]); - return _react.createElement(MergeStylesShadowRootContext.Provider, (0, _tslib.__assign)({ - value: value - }, props), _react.createElement(GlobalStyles, null), props.children); -}; -var GlobalStyles = function(props) { - var useAdoptedStylesheet = (0, _useMergeStylesHooks.useMergeStylesHooks)().useAdoptedStylesheet; - useAdoptedStylesheet((0, _mergeStyles.GLOBAL_STYLESHEET_KEY)); - return null; -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","../hooks/useMergeStylesHooks":"90VFe","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iP8C0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "WindowContext", ()=>(0, _windowProvider.WindowContext)); -parcelHelpers.export(exports, "useWindow", ()=>(0, _windowProvider.useWindow)); -parcelHelpers.export(exports, "useDocument", ()=>(0, _windowProvider.useDocument)); -parcelHelpers.export(exports, "WindowProvider", ()=>(0, _windowProvider.WindowProvider)); -var _windowProvider = require("./WindowProvider"); -var _version = require("./version"); - -},{"./WindowProvider":"gvsaA","./version":"6NRh1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gvsaA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "WindowContext", ()=>WindowContext); -parcelHelpers.export(exports, "useWindow", ()=>useWindow); -parcelHelpers.export(exports, "useDocument", ()=>useDocument); -parcelHelpers.export(exports, "WindowProvider", ()=>WindowProvider); -var _react = require("react"); -var WindowContext = _react.createContext({ - // eslint-disable-next-line no-restricted-globals - window: typeof window === 'object' ? window : undefined -}); -var useWindow = function() { - return _react.useContext(WindowContext).window; -}; -var useDocument = function() { - var _a; - return (_a = _react.useContext(WindowContext).window) === null || _a === void 0 ? void 0 : _a.document; -}; -var WindowProvider = function(props) { - return _react.createElement(WindowContext.Provider, { - value: props - }, props.children); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6NRh1":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react-window-provider', '2.2.28'); - -},{"@fluentui/set-version":"iqYXf"}],"hUUmS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to get Customizations settings from Customizations singleton or CustomizerContext. - * It will trigger component state update on settings change observed. - */ parcelHelpers.export(exports, "useCustomizationSettings", ()=>useCustomizationSettings); -var _react = require("react"); -var _customizations = require("./Customizations"); -var _customizerContext = require("./CustomizerContext"); -function useCustomizationSettings(properties, scopeName) { - var forceUpdate = useForceUpdate(); - var customizations = _react.useContext((0, _customizerContext.CustomizerContext)).customizations; - var inCustomizerContext = customizations.inCustomizerContext; - _react.useEffect(function() { - if (!inCustomizerContext) (0, _customizations.Customizations).observe(forceUpdate); - return function() { - if (!inCustomizerContext) (0, _customizations.Customizations).unobserve(forceUpdate); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- exclude forceUpdate - }, [ - inCustomizerContext - ]); - return (0, _customizations.Customizations).getSettings(properties, scopeName, customizations); -} -function useForceUpdate() { - var _a = _react.useState(0), setValue = _a[1]; - return function() { - return setValue(function(value) { - return ++value; - }); - }; -} - -},{"react":"jGrId","./Customizations":"eQS4T","./CustomizerContext":"aB8eN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iAatf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Extends a component's lifetime methods by appending new functions to the existing lifetime functions. - */ parcelHelpers.export(exports, "extendComponent", ()=>extendComponent); -var _appendFunction = require("./appendFunction"); -function extendComponent(parent, methods) { - for(var name_1 in methods)if (methods.hasOwnProperty(name_1)) // eslint-disable-next-line @typescript-eslint/no-explicit-any - parent[name_1] = (0, _appendFunction.appendFunction)(parent, parent[name_1], methods[name_1]); -} - -},{"./appendFunction":"8Ic5h","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kDauC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Generates a unique id in the global scope (this spans across duplicate copies of the same library.) - * - * @public - */ parcelHelpers.export(exports, "getId", ()=>getId); -/** - * Resets id counter to an (optional) number. - * - * @public - */ parcelHelpers.export(exports, "resetIds", ()=>resetIds); -var _getWindow = require("./dom/getWindow"); -var _mergeStyles = require("@fluentui/merge-styles"); -// Initialize global window id. -var CURRENT_ID_PROPERTY = '__currentId__'; -var DEFAULT_ID_STRING = 'id__'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -var _global = (0, _getWindow.getWindow)() || {}; -if (_global[CURRENT_ID_PROPERTY] === undefined) _global[CURRENT_ID_PROPERTY] = 0; -var _initializedStylesheetResets = false; -function getId(prefix) { - if (!_initializedStylesheetResets) { - // Configure ids to reset on stylesheet resets. - var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); - if (stylesheet && stylesheet.onReset) stylesheet.onReset(resetIds); - _initializedStylesheetResets = true; - } - var index = _global[CURRENT_ID_PROPERTY]++; - return (prefix === undefined ? DEFAULT_ID_STRING : prefix) + index; -} -function resetIds(counter) { - if (counter === void 0) counter = 0; - _global[CURRENT_ID_PROPERTY] = counter; -} - -},{"./dom/getWindow":"aI1a8","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iMQBc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Given an element tagname and user props, filters the props to only allowed props for the given - * element type. - * @param tagName - Tag name (e.g. "div") - * @param props - Props object - * @param excludedPropNames - List of props to disallow - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "getNativeElementProps", ()=>getNativeElementProps); -var _properties = require("./properties"); -var nativeElementMap = { - label: (0, _properties.labelProperties), - audio: (0, _properties.audioProperties), - video: (0, _properties.videoProperties), - ol: (0, _properties.olProperties), - li: (0, _properties.liProperties), - a: (0, _properties.anchorProperties), - button: (0, _properties.buttonProperties), - input: (0, _properties.inputProperties), - textarea: (0, _properties.textAreaProperties), - select: (0, _properties.selectProperties), - option: (0, _properties.optionProperties), - table: (0, _properties.tableProperties), - tr: (0, _properties.trProperties), - th: (0, _properties.thProperties), - td: (0, _properties.tdProperties), - colGroup: (0, _properties.colGroupProperties), - col: (0, _properties.colProperties), - form: (0, _properties.formProperties), - iframe: (0, _properties.iframeProperties), - img: (0, _properties.imgProperties) -}; -function getNativeElementProps(tagName, props, excludedPropNames) { - var allowedPropNames = tagName && nativeElementMap[tagName] || (0, _properties.htmlElementProperties); - return (0, _properties.getNativeProps)(props, allowedPropNames, excludedPropNames); -} - -},{"./properties":"hUmZ9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hUmZ9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "baseElementEvents", ()=>baseElementEvents); -parcelHelpers.export(exports, "baseElementProperties", ()=>baseElementProperties); -parcelHelpers.export(exports, "htmlElementProperties", ()=>htmlElementProperties); -parcelHelpers.export(exports, "labelProperties", ()=>labelProperties); -parcelHelpers.export(exports, "audioProperties", ()=>audioProperties); -parcelHelpers.export(exports, "videoProperties", ()=>videoProperties); -parcelHelpers.export(exports, "olProperties", ()=>olProperties); -parcelHelpers.export(exports, "liProperties", ()=>liProperties); -parcelHelpers.export(exports, "anchorProperties", ()=>anchorProperties); -parcelHelpers.export(exports, "buttonProperties", ()=>buttonProperties); -parcelHelpers.export(exports, "inputProperties", ()=>inputProperties); -parcelHelpers.export(exports, "textAreaProperties", ()=>textAreaProperties); -parcelHelpers.export(exports, "selectProperties", ()=>selectProperties); -parcelHelpers.export(exports, "optionProperties", ()=>optionProperties); -parcelHelpers.export(exports, "tableProperties", ()=>tableProperties); -parcelHelpers.export(exports, "trProperties", ()=>trProperties); -parcelHelpers.export(exports, "thProperties", ()=>thProperties); -parcelHelpers.export(exports, "tdProperties", ()=>tdProperties); -parcelHelpers.export(exports, "colGroupProperties", ()=>colGroupProperties); -parcelHelpers.export(exports, "colProperties", ()=>colProperties); -parcelHelpers.export(exports, "formProperties", ()=>formProperties); -parcelHelpers.export(exports, "iframeProperties", ()=>iframeProperties); -parcelHelpers.export(exports, "imgProperties", ()=>imgProperties); -parcelHelpers.export(exports, "imageProperties", ()=>imageProperties); -parcelHelpers.export(exports, "divProperties", ()=>divProperties); -/** - * Gets native supported props for an html element provided the allowance set. Use one of the property - * sets defined (divProperties, buttonPropertes, etc) to filter out supported properties from a given - * props set. Note that all data- and aria- prefixed attributes will be allowed. - * NOTE: getNativeProps should always be applied first when adding props to a react component. The - * non-native props should be applied second. This will prevent getNativeProps from overriding your custom props. - * For example, if props passed to getNativeProps has an onClick function and getNativeProps is added to - * the component after an onClick function is added, then the getNativeProps onClick will override it. - * - * @public - * @param props - The unfiltered input props - * @param allowedPropsNames - The array or record of allowed prop names. - * @returns The filtered props - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "getNativeProps", ()=>getNativeProps); -var toObjectMap = function() { - var items = []; - for(var _i = 0; _i < arguments.length; _i++)items[_i] = arguments[_i]; - var result = {}; - for(var _a = 0, items_1 = items; _a < items_1.length; _a++){ - var item = items_1[_a]; - var keys = Array.isArray(item) ? item : Object.keys(item); - for(var _b = 0, keys_1 = keys; _b < keys_1.length; _b++){ - var key = keys_1[_b]; - result[key] = 1; - } + } + var RTL_LOCAL_STORAGE_KEY = "isRTL"; + var _isRTL; + function getRTL(theme) { + if (theme === void 0) { + theme = {}; + } + if (theme.rtl !== void 0) { + return theme.rtl; + } + if (_isRTL === void 0) { + var savedRTL = getItem$1(RTL_LOCAL_STORAGE_KEY); + if (savedRTL !== null) { + _isRTL = savedRTL === "1"; + setRTL(_isRTL); + } + var doc = getDocument(); + if (_isRTL === void 0 && doc) { + _isRTL = (doc.body && doc.body.getAttribute("dir") || doc.documentElement.getAttribute("dir")) === "rtl"; + setRTL$1(_isRTL); + } } - return result; -}; -var baseElementEvents = toObjectMap([ - 'onCopy', - 'onCut', - 'onPaste', - 'onCompositionEnd', - 'onCompositionStart', - 'onCompositionUpdate', - 'onFocus', - 'onFocusCapture', - 'onBlur', - 'onBlurCapture', - 'onChange', - 'onInput', - 'onSubmit', - 'onLoad', - 'onError', - 'onKeyDown', - 'onKeyDownCapture', - 'onKeyPress', - 'onKeyUp', - 'onAbort', - 'onCanPlay', - 'onCanPlayThrough', - 'onDurationChange', - 'onEmptied', - 'onEncrypted', - 'onEnded', - 'onLoadedData', - 'onLoadedMetadata', - 'onLoadStart', - 'onPause', - 'onPlay', - 'onPlaying', - 'onProgress', - 'onRateChange', - 'onSeeked', - 'onSeeking', - 'onStalled', - 'onSuspend', - 'onTimeUpdate', - 'onVolumeChange', - 'onWaiting', - 'onClick', - 'onClickCapture', - 'onContextMenu', - 'onDoubleClick', - 'onDrag', - 'onDragEnd', - 'onDragEnter', - 'onDragExit', - 'onDragLeave', - 'onDragOver', - 'onDragStart', - 'onDrop', - 'onMouseDown', - 'onMouseDownCapture', - 'onMouseEnter', - 'onMouseLeave', - 'onMouseMove', - 'onMouseOut', - 'onMouseOver', - 'onMouseUp', - 'onMouseUpCapture', - 'onSelect', - 'onTouchCancel', - 'onTouchEnd', - 'onTouchMove', - 'onTouchStart', - 'onScroll', - 'onWheel', - 'onPointerCancel', - 'onPointerDown', - 'onPointerEnter', - 'onPointerLeave', - 'onPointerMove', - 'onPointerOut', - 'onPointerOver', - 'onPointerUp', - 'onGotPointerCapture', - 'onLostPointerCapture' -]); -var baseElementProperties = toObjectMap([ - 'accessKey', - 'children', - 'className', - 'contentEditable', - 'dir', - 'draggable', - 'hidden', - 'htmlFor', - 'id', - 'lang', - 'ref', - 'role', - 'style', - 'tabIndex', - 'title', - 'translate', - 'spellCheck', - 'name' -]); -var htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents); -var labelProperties = toObjectMap(htmlElementProperties, [ - 'form' -]); -var audioProperties = toObjectMap(htmlElementProperties, [ - 'height', - 'loop', - 'muted', - 'preload', - 'src', - 'width' -]); -var videoProperties = toObjectMap(audioProperties, [ - 'poster' -]); -var olProperties = toObjectMap(htmlElementProperties, [ - 'start' -]); -var liProperties = toObjectMap(htmlElementProperties, [ - 'value' -]); -var anchorProperties = toObjectMap(htmlElementProperties, [ - 'download', - 'href', - 'hrefLang', - 'media', - 'rel', - 'target', - 'type' -]); -var buttonProperties = toObjectMap(htmlElementProperties, [ - 'autoFocus', - 'disabled', - 'form', - 'formAction', - 'formEncType', - 'formMethod', - 'formNoValidate', - 'formTarget', - 'type', - 'value' -]); -var inputProperties = toObjectMap(buttonProperties, [ - 'accept', - 'alt', - 'autoCapitalize', - 'autoComplete', - 'checked', - 'dirname', - 'form', - 'height', - 'inputMode', - 'list', - 'max', - 'maxLength', - 'min', - 'minLength', - 'multiple', - 'pattern', - 'placeholder', - 'readOnly', - 'required', - 'src', - 'step', - 'size', - 'type', - 'value', - 'width' -]); -var textAreaProperties = toObjectMap(buttonProperties, [ - 'autoCapitalize', - 'cols', - 'dirname', - 'form', - 'maxLength', - 'minLength', - 'placeholder', - 'readOnly', - 'required', - 'rows', - 'wrap' -]); -var selectProperties = toObjectMap(buttonProperties, [ - 'form', - 'multiple', - 'required' -]); -var optionProperties = toObjectMap(htmlElementProperties, [ - 'selected', - 'value' -]); -var tableProperties = toObjectMap(htmlElementProperties, [ - 'cellPadding', - 'cellSpacing' -]); -var trProperties = htmlElementProperties; -var thProperties = toObjectMap(htmlElementProperties, [ - 'rowSpan', - 'scope' -]); -var tdProperties = toObjectMap(htmlElementProperties, [ - 'colSpan', - 'headers', - 'rowSpan', - 'scope' -]); -var colGroupProperties = toObjectMap(htmlElementProperties, [ - 'span' -]); -var colProperties = toObjectMap(htmlElementProperties, [ - 'span' -]); -var formProperties = toObjectMap(htmlElementProperties, [ - 'acceptCharset', - 'action', - 'encType', - 'encType', - 'method', - 'noValidate', - 'target' -]); -var iframeProperties = toObjectMap(htmlElementProperties, [ - 'allow', - 'allowFullScreen', - 'allowPaymentRequest', - 'allowTransparency', - 'csp', - 'height', - 'importance', - 'referrerPolicy', - 'sandbox', - 'src', - 'srcDoc', - 'width' -]); -var imgProperties = toObjectMap(htmlElementProperties, [ - 'alt', - 'crossOrigin', - 'height', - 'src', - 'srcSet', - 'useMap', - 'width' -]); -var imageProperties = imgProperties; -var divProperties = htmlElementProperties; -function getNativeProps(// eslint-disable-next-line @typescript-eslint/no-explicit-any -props, allowedPropNames, excludedPropNames) { - // It'd be great to properly type this while allowing 'aria-` and 'data-' attributes like TypeScript does for - // JSX attributes, but that ability is hardcoded into the TS compiler with no analog in TypeScript typings. - // Then we'd be able to enforce props extends native props (including aria- and data- attributes), and then - // return native props. - // We should be able to do this once this PR is merged: https://github.com/microsoft/TypeScript/pull/26797 - var isArray = Array.isArray(allowedPropNames); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var result = {}; - var keys = Object.keys(props); - for(var _i = 0, keys_2 = keys; _i < keys_2.length; _i++){ - var key = keys_2[_i]; - var isNativeProp = !isArray && allowedPropNames[key] || isArray && allowedPropNames.indexOf(key) >= 0 || key.indexOf('data-') === 0 || key.indexOf('aria-') === 0; - if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key)) === -1)) // eslint-disable-next-line @typescript-eslint/no-explicit-any - result[key] = props[key]; + return !!_isRTL; + } + function setRTL(isRTL, persistSetting) { + if (persistSetting === void 0) { + persistSetting = false; } - return result; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49HjY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Allows you to hoist methods, except those in an exclusion set from a source object into a destination object. - * - * @public - * @param destination - The instance of the object to hoist the methods onto. - * @param source - The instance of the object where the methods are hoisted from. - * @param exclusions - (Optional) What methods to exclude from being hoisted. - * @returns An array of names of methods that were hoisted. - */ parcelHelpers.export(exports, "hoistMethods", ()=>hoistMethods); -/** - * Provides a method for convenience to unhoist hoisted methods. - * - * @public - * @param source - The source object upon which methods were hoisted. - * @param methodNames - An array of method names to unhoist. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "unhoistMethods", ()=>unhoistMethods); -var REACT_LIFECYCLE_EXCLUSIONS = [ - 'setState', - 'render', - 'componentWillMount', - 'UNSAFE_componentWillMount', - 'componentDidMount', - 'componentWillReceiveProps', - 'UNSAFE_componentWillReceiveProps', - 'shouldComponentUpdate', - 'componentWillUpdate', - 'getSnapshotBeforeUpdate', - 'UNSAFE_componentWillUpdate', - 'componentDidUpdate', - 'componentWillUnmount' -]; -function hoistMethods(// eslint-disable-next-line @typescript-eslint/no-explicit-any -destination, // eslint-disable-next-line @typescript-eslint/no-explicit-any -source, exclusions) { - if (exclusions === void 0) exclusions = REACT_LIFECYCLE_EXCLUSIONS; - var hoisted = []; - var _loop_1 = function(methodName) { - if (typeof source[methodName] === 'function' && destination[methodName] === undefined && (!exclusions || exclusions.indexOf(methodName) === -1)) { - hoisted.push(methodName); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - destination[methodName] = function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - source[methodName].apply(source, args); - }; - } - }; - for(var methodName in source)_loop_1(methodName); - return hoisted; -} -function unhoistMethods(source, methodNames) { - methodNames.forEach(function(methodName) { - return delete source[methodName]; - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8tu37":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Helper to manage componentRef resolution. Internally appends logic to - * lifetime methods to resolve componentRef to the passed in object. - * - * Usage: call initializeComponentRef(this) in the constructor, - */ parcelHelpers.export(exports, "initializeComponentRef", ()=>initializeComponentRef); -var _extendComponent = require("./extendComponent"); -function initializeComponentRef(obj) { - (0, _extendComponent.extendComponent)(obj, { - componentDidMount: _onMount, - componentDidUpdate: _onUpdate, - componentWillUnmount: _onUnmount - }); -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _onMount() { - _setComponentRef(this.props.componentRef, this); -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _onUpdate(prevProps) { - if (prevProps.componentRef !== this.props.componentRef) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - _setComponentRef(prevProps.componentRef, null); - _setComponentRef(this.props.componentRef, this); + var doc = getDocument(); + if (doc) { + doc.documentElement.setAttribute("dir", isRTL ? "rtl" : "ltr"); } -} -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function _onUnmount() { - _setComponentRef(this.props.componentRef, null); -} -function _setComponentRef(componentRef, value) { - if (componentRef) { - if (typeof componentRef === 'object') componentRef.current = value; - else if (typeof componentRef === 'function') componentRef(value); - } -} - -},{"./extendComponent":"iAatf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lLcL3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Initializes the logic which: - * - * 1. Subscribes keydown and mousedown events. (It will only do it once per window, - * so it's safe to call this method multiple times.) - * 2. When the user presses directional keyboard keys, adds the 'ms-Fabric--isFocusVisible' classname - * to the document body, removes the 'ms-Fabric-isFocusHidden' classname. - * 3. When the user clicks a mouse button, adds the 'ms-Fabric-isFocusHidden' classname to the - * document body, removes the 'ms-Fabric--isFocusVisible' classname. - * - * This logic allows components on the page to conditionally render focus treatments based on - * the existence of global classnames, which simplifies logic overall. - * - * @param window - the window used to add the event listeners - * @deprecated Use useFocusRects hook or FocusRects component instead. - */ parcelHelpers.export(exports, "initializeFocusRects", ()=>initializeFocusRects); -var _getWindow = require("./dom/getWindow"); -var _keyboard = require("./keyboard"); -var _setFocusVisibility = require("./setFocusVisibility"); -function initializeFocusRects(window) { - var _a; - var win = window || (0, _getWindow.getWindow)(); - if (!win || ((_a = win.FabricConfig) === null || _a === void 0 ? void 0 : _a.disableFocusRects) === true) return; - if (!win.__hasInitializeFocusRects__) { - win.__hasInitializeFocusRects__ = true; - win.addEventListener('mousedown', _onMouseDown, true); - win.addEventListener('pointerdown', _onPointerDown, true); - win.addEventListener('keydown', _onKeyDown, true); - } -} -function _onMouseDown(ev) { - (0, _setFocusVisibility.setFocusVisibility)(false, ev.target); -} -function _onPointerDown(ev) { - if (ev.pointerType !== 'mouse') (0, _setFocusVisibility.setFocusVisibility)(false, ev.target); -} -function _onKeyDown(ev) { - // eslint-disable-next-line deprecation/deprecation - (0, _keyboard.isDirectionalKeyCode)(ev.which) && (0, _setFocusVisibility.setFocusVisibility)(true, ev.target); -} - -},{"./dom/getWindow":"aI1a8","./keyboard":"1QqA5","./setFocusVisibility":"2d3GF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1QqA5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Returns true if the keycode is a directional keyboard key. - */ parcelHelpers.export(exports, "isDirectionalKeyCode", ()=>isDirectionalKeyCode); -/** - * Adds a keycode to the list of keys that, when pressed, should cause the focus outlines to be visible. - * This can be used to add global shortcut keys that directionally move from section to section within - * an app or between focus trap zones. - */ parcelHelpers.export(exports, "addDirectionalKeyCode", ()=>addDirectionalKeyCode); -/** - * Removes a keycode to the list of keys that, when pressed, should cause the focus outlines to be visible. - * This can be used to remove global shortcut keys that directionally move from section to section within - * an app or between focus trap zones. - */ parcelHelpers.export(exports, "removeDirectionalKeyCode", ()=>removeDirectionalKeyCode); -var _keyCodes = require("./KeyCodes"); -var _a; -var DirectionalKeyCodes = (_a = {}, _a[(0, _keyCodes.KeyCodes).up] = 1, _a[(0, _keyCodes.KeyCodes).down] = 1, _a[(0, _keyCodes.KeyCodes).left] = 1, _a[(0, _keyCodes.KeyCodes).right] = 1, _a[(0, _keyCodes.KeyCodes).home] = 1, _a[(0, _keyCodes.KeyCodes).end] = 1, _a[(0, _keyCodes.KeyCodes).tab] = 1, _a[(0, _keyCodes.KeyCodes).pageUp] = 1, _a[(0, _keyCodes.KeyCodes).pageDown] = 1, _a); -function isDirectionalKeyCode(which) { - return !!DirectionalKeyCodes[which]; -} -function addDirectionalKeyCode(which) { - DirectionalKeyCodes[which] = 1; -} -function removeDirectionalKeyCode(which) { - delete DirectionalKeyCodes[which]; -} - -},{"./KeyCodes":"eQoHk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2d3GF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IsFocusVisibleClassName", ()=>IsFocusVisibleClassName); -parcelHelpers.export(exports, "IsFocusHiddenClassName", ()=>IsFocusHiddenClassName); -/** - * Sets the visibility of focus styling. - * - * By default, focus styles (the box surrounding a focused Button, for example) only show up when navigational - * keypresses occur (through Tab, arrows, PgUp/PgDn, Home and End), and are hidden when mouse interactions occur. - * This API provides an imperative way to turn them on/off. - * - * A use case might be when you have a keypress like ctrl-f6 navigate to a particular region on the page, - * and want focus to show up. - * - * @param enabled - Whether to turn focus visibility on or off. - * @param target - Optional target from which to get window in case no `providerElem` has been specified. - * @param registeredProviders - Array of provider refs that are associated with a FocusRectsProvider. If no array - * is passed in, the classnames are attached to the document body that contains `target`. - */ parcelHelpers.export(exports, "setFocusVisibility", ()=>setFocusVisibility); -var _getWindow = require("./dom/getWindow"); -var IsFocusVisibleClassName = 'ms-Fabric--isFocusVisible'; -var IsFocusHiddenClassName = 'ms-Fabric--isFocusHidden'; -function updateClassList(el, enabled) { - if (el) { - el.classList.add(enabled ? IsFocusVisibleClassName : IsFocusHiddenClassName); - el.classList.remove(enabled ? IsFocusHiddenClassName : IsFocusVisibleClassName); - } -} -function setFocusVisibility(enabled, target, registeredProviders) { - var _a; - if (registeredProviders) registeredProviders.forEach(function(ref) { - return updateClassList(ref.current, enabled); - }); - else updateClassList((_a = (0, _getWindow.getWindow)(target)) === null || _a === void 0 ? void 0 : _a.document.body, enabled); -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Mxbq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusRectsProvider", ()=>FocusRectsProvider); -var _react = require("react"); -var _useFocusRects = require("./useFocusRects"); -var FocusRectsProvider = function(props) { - var providerRef = props.providerRef, layerRoot = props.layerRoot; - var registeredProviders = _react.useState([])[0]; - var parentContext = _react.useContext((0, _useFocusRects.FocusRectsContext)); - // Inherit the parent context if it exists, unless this is a layer root. - // This allows the topmost provider element in the DOM tree to handle the focus events. - // Since layers are in a separate HTML tree from their parent, they shouldn't use the parent's providerRef. - var inheritParentContext = parentContext !== undefined && !layerRoot; - var context = _react.useMemo(function() { - return inheritParentContext ? undefined : { - providerRef: providerRef, - registeredProviders: registeredProviders, - registerProvider: function(ref) { - // Register this child provider with the current context, and any parent contexts - registeredProviders.push(ref); - parentContext === null || parentContext === void 0 || parentContext.registerProvider(ref); - }, - unregisterProvider: function(ref) { - parentContext === null || parentContext === void 0 || parentContext.unregisterProvider(ref); - var i = registeredProviders.indexOf(ref); - if (i >= 0) registeredProviders.splice(i, 1); - } - }; - }, [ - providerRef, - registeredProviders, - parentContext, - inheritParentContext - ]); - _react.useEffect(function() { - if (context) { - context.registerProvider(context.providerRef); - return function() { - return context.unregisterProvider(context.providerRef); - }; - } - }, [ - context - ]); - // Create a new context provider if this is not inheriting from the parent. - if (context) return _react.createElement((0, _useFocusRects.FocusRectsContext).Provider, { - value: context - }, props.children); - else return _react.createElement(_react.Fragment, null, props.children); -}; - -},{"react":"jGrId","./useFocusRects":"hYOqE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hYOqE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusRectsContext", ()=>FocusRectsContext); -/** - * Initializes the logic which: - * - * 1. Subscribes keydown, keyup, mousedown and pointerdown events. (It will only do it once for the current element of - * the FocusRectsContext providerRef or once per window if no such element is provided via context, so it's safe to - * call this method multiple times.) - * 2. When the user presses triggers a keydown or keyup event via directional keyboard keys, adds the - * 'ms-Fabric--isFocusVisible' classname to the current element of the FocusRectsContext providerRef or the document - * body if no such element is provided via context, and removes the 'ms-Fabric-isFocusHidden' classname. - * 3. When the user triggers a mousedown or pointerdown event, adds the 'ms-Fabric-isFocusHidden' classname to the - * current element of the FocusRectsContext providerRef or the document body if no such element is provided via - * context, and removes the 'ms-Fabric--isFocusVisible' classname. - * - * This logic allows components on the page to conditionally render focus treatments based on - * the existence of global classnames, which simplifies logic overall. - * - * @param rootRef - A Ref object. Focus rectangle can be applied on itself and all its children. - */ parcelHelpers.export(exports, "useFocusRects", ()=>useFocusRects); -parcelHelpers.export(exports, "FocusRects", ()=>FocusRects); -var _react = require("react"); -var _getWindow = require("./dom/getWindow"); -var _keyboard = require("./keyboard"); -var _setFocusVisibility = require("./setFocusVisibility"); -var mountCounters = new WeakMap(); -var callbackMap = new WeakMap(); -function setMountCounters(key, delta) { - var newValue; - var currValue = mountCounters.get(key); - if (currValue) newValue = currValue + delta; - else newValue = 1; - mountCounters.set(key, newValue); - return newValue; -} -function setCallbackMap(context) { - var callbacks = callbackMap.get(context); - if (callbacks) return callbacks; - var onMouseDown = function(ev) { - return _onMouseDown(ev, context.registeredProviders); - }; - var onPointerDown = function(ev) { - return _onPointerDown(ev, context.registeredProviders); - }; - var onKeyDown = function(ev) { - return _onKeyDown(ev, context.registeredProviders); - }; - var onKeyUp = function(ev) { - return _onKeyUp(ev, context.registeredProviders); - }; - callbacks = { - onMouseDown: onMouseDown, - onPointerDown: onPointerDown, - onKeyDown: onKeyDown, - onKeyUp: onKeyUp - }; - callbackMap.set(context, callbacks); - return callbacks; -} -var FocusRectsContext = _react.createContext(undefined); -function useFocusRects(rootRef) { - var context = _react.useContext(FocusRectsContext); - _react.useEffect(function() { - var _a, _b, _c, _d; - var win = (0, _getWindow.getWindow)(rootRef === null || rootRef === void 0 ? void 0 : rootRef.current); - if (!win || ((_a = win.FabricConfig) === null || _a === void 0 ? void 0 : _a.disableFocusRects) === true) return undefined; - var el = win; - var onMouseDown; - var onPointerDown; - var onKeyDown; - var onKeyUp; - if (((_b = context === null || context === void 0 ? void 0 : context.providerRef) === null || _b === void 0 ? void 0 : _b.current) && ((_d = (_c = context === null || context === void 0 ? void 0 : context.providerRef) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.addEventListener)) { - el = context.providerRef.current; - // The NOINLINE directive tells terser not to move the setCallbackMap implementation into the call site during - // minification. - // This prevents the function from capturing additional variables in the closure, which can cause memory leaks. - var callbacks = /*@__NOINLINE__*/ setCallbackMap(context); - onMouseDown = callbacks.onMouseDown; - onPointerDown = callbacks.onPointerDown; - onKeyDown = callbacks.onKeyDown; - onKeyUp = callbacks.onKeyUp; - } else { - onMouseDown = _onMouseDown; - onPointerDown = _onPointerDown; - onKeyDown = _onKeyDown; - onKeyUp = _onKeyUp; - } - var count = setMountCounters(el, 1); - if (count <= 1) { - el.addEventListener('mousedown', onMouseDown, true); - el.addEventListener('pointerdown', onPointerDown, true); - el.addEventListener('keydown', onKeyDown, true); - el.addEventListener('keyup', onKeyUp, true); - } - return function() { - var _a; - if (!win || ((_a = win.FabricConfig) === null || _a === void 0 ? void 0 : _a.disableFocusRects) === true) return; - count = setMountCounters(el, -1); - if (count === 0) { - el.removeEventListener('mousedown', onMouseDown, true); - el.removeEventListener('pointerdown', onPointerDown, true); - el.removeEventListener('keydown', onKeyDown, true); - el.removeEventListener('keyup', onKeyUp, true); - } - }; - }, [ - context, - rootRef - ]); -} -var FocusRects = function(props) { - useFocusRects(props.rootRef); - return null; -}; -function _onMouseDown(ev, registeredProviders) { - (0, _setFocusVisibility.setFocusVisibility)(false, ev.target, registeredProviders); -} -function _onPointerDown(ev, registeredProviders) { - if (ev.pointerType !== 'mouse') (0, _setFocusVisibility.setFocusVisibility)(false, ev.target, registeredProviders); -} -// You need both a keydown and a keyup listener that sets focus visibility to true to handle two distinct scenarios when -// attaching the listeners and classnames to the provider instead of the document body. -// If you only have a keydown listener, then the focus rectangles will not show when moving from outside of the provider -// to inside it. That is why a keyup listener is needed, since it will always trigger after the focus event is fired. -// If you only have a keyup listener, then the focus rectangles will not show moving between different tabbable elements -// if the tab key is pressed without being released. That's is why we need a keydown listener, since it will trigger for -// every element that is being tabbed into. -// This works because `classList.add` is smart and will not duplicate a classname that already exists on the classList -// when focus visibility is turned on. -function _onKeyDown(ev, registeredProviders) { - // eslint-disable-next-line deprecation/deprecation - if ((0, _keyboard.isDirectionalKeyCode)(ev.which)) (0, _setFocusVisibility.setFocusVisibility)(true, ev.target, registeredProviders); -} -function _onKeyUp(ev, registeredProviders) { - // eslint-disable-next-line deprecation/deprecation - if ((0, _keyboard.isDirectionalKeyCode)(ev.which)) (0, _setFocusVisibility.setFocusVisibility)(true, ev.target, registeredProviders); -} - -},{"react":"jGrId","./dom/getWindow":"aI1a8","./keyboard":"1QqA5","./setFocusVisibility":"2d3GF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6G2ZZ":[function(require,module,exports,__globalThis) { -/** - * Regular expressions matching characters to ignore when calculating the initials. - */ /** - * Regular expression matching characters within various types of enclosures, including the enclosures themselves - * so for example, (xyz) [xyz] {xyz} <xyz> all would be ignored - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Get (up to 2 characters) initials based on display name of the persona. - * - * @public - */ parcelHelpers.export(exports, "getInitials", ()=>getInitials); -var UNWANTED_ENCLOSURES_REGEX = /[\(\[\{\<][^\)\]\}\>]*[\)\]\}\>]/g; -/** - * Regular expression matching special ASCII characters except space, plus some unicode special characters. - * Applies after unwanted enclosures have been removed - */ var UNWANTED_CHARS_REGEX = /[\0-\u001F\!-/:-@\[-`\{-\u00BF\u0250-\u036F\uD800-\uFFFF]/g; -/** - * Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed - * and number has been trimmed for whitespaces - */ var PHONENUMBER_REGEX = /^\d+[\d\s]*(:?ext|x|)\s*\d+$/i; -/** Regular expression matching one or more spaces. */ var MULTIPLE_WHITESPACES_REGEX = /\s+/g; -/** - * Regular expression matching languages for which we currently don't support initials. - * Arabic: Arabic, Arabic Supplement, Arabic Extended-A. - * Korean: Hangul Jamo, Hangul Compatibility Jamo, Hangul Jamo Extended-A, Hangul Syllables, Hangul Jamo Extended-B. - * Japanese: Hiragana, Katakana. - * CJK: CJK Unified Ideographs Extension A, CJK Unified Ideographs, CJK Compatibility Ideographs, - * CJK Unified Ideographs Extension B - */ var UNSUPPORTED_TEXT_REGEX = // eslint-disable-next-line @fluentui/max-len -/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uAC00-\uD7AF\uD7B0-\uD7FF\u3040-\u309F\u30A0-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]|[\uD840-\uD869][\uDC00-\uDED6]/; -function getInitialsLatin(displayName, isRtl) { - var initials = ''; - var splits = displayName.split(' '); - if (splits.length === 2) { - initials += splits[0].charAt(0).toUpperCase(); - initials += splits[1].charAt(0).toUpperCase(); - } else if (splits.length === 3) { - initials += splits[0].charAt(0).toUpperCase(); - initials += splits[2].charAt(0).toUpperCase(); - } else if (splits.length !== 0) initials += splits[0].charAt(0).toUpperCase(); - if (isRtl && initials.length > 1) return initials.charAt(1) + initials.charAt(0); - return initials; -} -function cleanupDisplayName(displayName) { - displayName = displayName.replace(UNWANTED_ENCLOSURES_REGEX, ''); - displayName = displayName.replace(UNWANTED_CHARS_REGEX, ''); - displayName = displayName.replace(MULTIPLE_WHITESPACES_REGEX, ' '); - displayName = displayName.trim(); - return displayName; -} -function getInitials(displayName, isRtl, allowPhoneInitials) { - if (!displayName) return ''; - displayName = cleanupDisplayName(displayName); - // For names containing CJK characters, and phone numbers, we don't display initials - if (UNSUPPORTED_TEXT_REGEX.test(displayName) || !allowPhoneInitials && PHONENUMBER_REGEX.test(displayName)) return ''; - return getInitialsLatin(displayName, isRtl); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7welB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Gets the language set for the page. - * @param persistenceType - Where to persist the value. Default is `sessionStorage` if available. - */ parcelHelpers.export(exports, "getLanguage", ()=>getLanguage); -parcelHelpers.export(exports, "setLanguage", ()=>setLanguage); -var _getDocument = require("./dom/getDocument"); -var _localStorage = require("./localStorage"); -var _sessionStorage = require("./sessionStorage"); -// Default to undefined so that we initialize on first read. -var _language; -var STORAGE_KEY = 'language'; -function getLanguage(persistenceType) { - if (persistenceType === void 0) persistenceType = 'sessionStorage'; - if (_language === undefined) { - var doc = (0, _getDocument.getDocument)(); - var savedLanguage = persistenceType === 'localStorage' ? _localStorage.getItem(STORAGE_KEY) : persistenceType === 'sessionStorage' ? _sessionStorage.getItem(STORAGE_KEY) : undefined; - if (savedLanguage) _language = savedLanguage; - if (_language === undefined && doc) _language = doc.documentElement.getAttribute('lang'); - if (_language === undefined) _language = 'en'; + if (persistSetting) { + setItem(RTL_LOCAL_STORAGE_KEY, isRTL ? "1" : "0"); } - return _language; -} -function setLanguage(language, persistenceParam) { - var doc = (0, _getDocument.getDocument)(); - if (doc) doc.documentElement.setAttribute('lang', language); - var persistenceType = persistenceParam === true ? 'none' : !persistenceParam ? 'sessionStorage' : persistenceParam; - if (persistenceType === 'localStorage') _localStorage.setItem(STORAGE_KEY, language); - else if (persistenceType === 'sessionStorage') _sessionStorage.setItem(STORAGE_KEY, language); - _language = language; -} - -},{"./dom/getDocument":"7EOu7","./localStorage":"3NE8f","./sessionStorage":"fAeWE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3NE8f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Fetches an item from local storage without throwing an exception - * @param key The key of the item to fetch from local storage - */ parcelHelpers.export(exports, "getItem", ()=>getItem); -/** - * Inserts an item into local storage without throwing an exception - * @param key The key of the item to add to local storage - * @param data The data to put into local storage - */ parcelHelpers.export(exports, "setItem", ()=>setItem); -var _getWindow = require("./dom/getWindow"); -function getItem(key) { - var result = null; - try { - var win = (0, _getWindow.getWindow)(); - result = win ? win.localStorage.getItem(key) : null; - } catch (e) { - /* Eat the exception */ } - return result; -} -function setItem(key, data) { - try { - var win = (0, _getWindow.getWindow)(); - win && win.localStorage.setItem(key, data); - } catch (e) { - /* Eat the exception */ } -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9UcDS":[function(require,module,exports,__globalThis) { -/** - * Determines the distance between two points. - * - * @public - */ /* eslint-disable deprecation/deprecation */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getDistanceBetweenPoints", ()=>getDistanceBetweenPoints); -/** - * Produces a proportionally-scaled version of an input content size when fit to a bounding size. - * Given a `contentSize` and a `boundsSize`, this function scales `contentSize` proportionally - * using either `contain` or `cover` fit behaviors. - * Use this function to pre-calculate the layout for the CSS `object-fit` and `background-fit` behaviors. - * With `contain`, the output size must be the largest it can be while completely within the `boundsSize`. - * With `cover`, the output size must be the smallest it can be while completely around the `boundsSize`. - * By default, there is a `maxScale` value of 1, which prevents the `contentSize` from being scaled larger. - * - * @param options - the options for the bounds fit operation - */ parcelHelpers.export(exports, "fitContentToBounds", ()=>fitContentToBounds); -/** - * Calculates a number's precision based on the number of trailing - * zeros if the number does not have a decimal indicated by a negative - * precision. Otherwise, it calculates the number of digits after - * the decimal point indicated by a positive precision. - * @param value - the value to determine the precision of - */ parcelHelpers.export(exports, "calculatePrecision", ()=>calculatePrecision); -/** - * Rounds a number to a certain level of precision. Accepts negative precision. - * @param value - The value that is being rounded. - * @param precision - The number of decimal places to round the number to - */ parcelHelpers.export(exports, "precisionRound", ()=>precisionRound); -function getDistanceBetweenPoints(point1, point2) { - var left1 = point1.left || point1.x || 0; - var top1 = point1.top || point1.y || 0; - var left2 = point2.left || point2.x || 0; - var top2 = point2.top || point2.y || 0; - /* eslint-enable deprecation/deprecation */ var distance = Math.sqrt(Math.pow(left1 - left2, 2) + Math.pow(top1 - top2, 2)); - return distance; -} -function fitContentToBounds(options) { - var contentSize = options.contentSize, boundsSize = options.boundsSize, _a = options.mode, mode = _a === void 0 ? 'contain' : _a, _b = options.maxScale, maxScale = _b === void 0 ? 1 : _b; - var contentAspectRatio = contentSize.width / contentSize.height; - var boundsAspectRatio = boundsSize.width / boundsSize.height; - var scale; - if (mode === 'contain' ? contentAspectRatio > boundsAspectRatio : contentAspectRatio < boundsAspectRatio) scale = boundsSize.width / contentSize.width; - else scale = boundsSize.height / contentSize.height; - var finalScale = Math.min(maxScale, scale); - return { - width: contentSize.width * finalScale, - height: contentSize.height * finalScale - }; -} -function calculatePrecision(value) { - /** - * Group 1: - * [1-9]([0]+$) matches trailing zeros - * Group 2: - * \.([0-9]*) matches all digits after a decimal point. - */ var groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value)); - if (!groups) return 0; - if (groups[1]) return -groups[1].length; - if (groups[2]) return groups[2].length; - return 0; -} -function precisionRound(value, precision, base) { - if (base === void 0) base = 10; - var exp = Math.pow(base, precision); - return Math.round(value * exp) / exp; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"43b5Z":[function(require,module,exports,__globalThis) { -/** - * Simple deep merge function. Takes all arguments and returns a deep copy of the objects merged - * together in the order provided. If an object creates a circular reference, it will assign the - * original reference. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "merge", ()=>merge); -function merge(target) { - var args = []; - for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; - for(var _a = 0, args_1 = args; _a < args_1.length; _a++){ - var arg = args_1[_a]; - _merge(target || {}, arg); - } - return target; -} -/** - * The _merge helper iterates through all props on source and assigns them to target. - * When the value is an object, we will create a deep clone of the object. However if - * there is a circular reference, the value will not be deep cloned and will persist - * the reference. - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -function _merge(target, source, circularReferences) { - if (circularReferences === void 0) circularReferences = []; - circularReferences.push(source); - for(var name_1 in source){ - if (source.hasOwnProperty(name_1)) { - if (name_1 !== '__proto__' && name_1 !== 'constructor' && name_1 !== 'prototype') { - var value = source[name_1]; - if (typeof value === 'object' && value !== null && !Array.isArray(value)) { - var isCircularReference = circularReferences.indexOf(value) > -1; - target[name_1] = isCircularReference ? value : _merge(target[name_1] || {}, value, circularReferences); - } else target[name_1] = value; - } - } + _isRTL = isRTL; + setRTL$1(_isRTL); + } + function getRTLSafeKeyCode(key2, theme) { + if (theme === void 0) { + theme = {}; } - circularReferences.pop(); - return target; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ucFx":[function(require,module,exports,__globalThis) { -/** - * Returns true if and only if the user is on a iOS device. - * Used to determine whether iOS-specific behavior should be applied. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isIOS", ()=>isIOS); -var isIOS = function() { - // eslint-disable-next-line no-restricted-globals - if (!window || !window.navigator || !window.navigator.userAgent) return false; - // eslint-disable-next-line no-restricted-globals - return /iPad|iPhone|iPod/i.test(window.navigator.userAgent); -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8iyQK":[function(require,module,exports,__globalThis) { -/** - * The helper functions here will make the target element as modal to screen readers, by placing aria-hidden on elements - * that are siblings to the target element and the target element's ancestors (because aria-hidden gets inherited). - * That way, all other elements on the page are hidden to the screen reader. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Call this on a target element to make it modal to screen readers. - * Returns a function that undoes the changes it made. - */ parcelHelpers.export(exports, "modalize", ()=>modalize); -var _getDocument = require("./dom/getDocument"); -/** Tag names to ignore when modalizing */ var tagsToIgnore = [ - 'TEMPLATE', - 'STYLE', - 'SCRIPT' -]; -function modalize(target) { - var targetDocument = (0, _getDocument.getDocument)(target); - if (!targetDocument) // can't do this in SSR - return function() { - return undefined; - }; - var affectedNodes = []; - // start at target, then recurse and do the same for parent, until we reach <body> - while(target !== targetDocument.body && target.parentElement){ - // grab all siblings of current element - for(var _i = 0, _a = target.parentElement.children; _i < _a.length; _i++){ - var sibling = _a[_i]; - // but ignore elements that are already aria-hidden - var ariaHidden = sibling.getAttribute('aria-hidden'); - if (sibling !== target && (ariaHidden === null || ariaHidden === void 0 ? void 0 : ariaHidden.toLowerCase()) !== 'true' && tagsToIgnore.indexOf(sibling.tagName) === -1) affectedNodes.push([ - sibling, - ariaHidden - ]); - } - target = target.parentElement; - } - // take all those elements and set aria-hidden=true on them - affectedNodes.forEach(function(_a) { - var node = _a[0]; - node.setAttribute('aria-hidden', 'true'); - }); - return function() { - unmodalize(affectedNodes); - affectedNodes = []; // dispose - }; -} -/** - * Undoes the changes that modalize() did. - */ function unmodalize(affectedNodes) { - affectedNodes.forEach(function(_a) { - var node = _a[0], originalValue = _a[1]; - // Restore the original value (false or unset) - if (originalValue) node.setAttribute('aria-hidden', originalValue); - else node.removeAttribute('aria-hidden'); - }); -} - -},{"./dom/getDocument":"7EOu7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fxaey":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Returns true if the user is on a Mac. Caches the result value. - * @param reset - Reset the cached result value (mainly for testing). - */ parcelHelpers.export(exports, "isMac", ()=>isMac); -var _getWindow = require("./dom/getWindow"); -var isMacResult; -function isMac(reset) { - var _a; - if (typeof isMacResult === 'undefined' || reset) { - var win = (0, _getWindow.getWindow)(); - // In certain SSR frameworks, `window` will be defined even on the server but `navigator` will be undefined - var userAgent = (_a = win === null || win === void 0 ? void 0 : win.navigator) === null || _a === void 0 ? void 0 : _a.userAgent; - isMacResult = !!userAgent && userAgent.indexOf('Macintosh') !== -1; + if (getRTL(theme)) { + if (key2 === KeyCodes.left) { + key2 = KeyCodes.right; + } else if (key2 === KeyCodes.right) { + key2 = KeyCodes.left; + } } - return !!isMacResult; -} - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gxEfk":[function(require,module,exports,__globalThis) { -/** - * Detects whether an element's content has horizontal overflow - * - * @public - * @param element - Element to check for overflow - * @returns True if element's content overflows - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hasHorizontalOverflow", ()=>hasHorizontalOverflow); -/** - * Detects whether an element's content has vertical overflow - * - * @public - * @param element - Element to check for overflow - * @returns True if element's content overflows - */ parcelHelpers.export(exports, "hasVerticalOverflow", ()=>hasVerticalOverflow); -/** - * Detects whether an element's content has overflow in any direction - * - * @public - * @param element - Element to check for overflow - * @returns True if element's content overflows - */ parcelHelpers.export(exports, "hasOverflow", ()=>hasOverflow); -function hasHorizontalOverflow(element) { - return element.clientWidth < element.scrollWidth; -} -function hasVerticalOverflow(element) { - return element.clientHeight < element.scrollHeight; -} -function hasOverflow(element) { - return hasHorizontalOverflow(element) || hasVerticalOverflow(element); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hnUBo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Composes two 'render functions' to produce a final render function that renders - * the outer function, passing the inner function as 'default render'. The inner function - * is then passed the original 'default render' prop. - * @public - */ parcelHelpers.export(exports, "composeRenderFunction", ()=>composeRenderFunction); -var _memoize = require("../memoize"); -function createComposedRenderFunction(outer) { - var outerMemoizer = (0, _memoize.createMemoizer)(function(inner) { - var innerMemoizer = (0, _memoize.createMemoizer)(function(defaultRender) { - return function(innerProps) { - return inner(innerProps, defaultRender); - }; - }); - return function(outerProps, defaultRender) { - return outer(outerProps, defaultRender ? innerMemoizer(defaultRender) : inner); - }; + return key2; + } + var MAX_CACHE_COUNT = 50; + var DEFAULT_SPECIFICITY_MULTIPLIER = 5; + var _memoizedClassNames = 0; + var stylesheet$1 = Stylesheet.getInstance(); + if (stylesheet$1 && stylesheet$1.onReset) { + stylesheet$1.onReset(function() { + return _memoizedClassNames++; }); - return outerMemoizer; -} -var memoizer = (0, _memoize.createMemoizer)(createComposedRenderFunction); -function composeRenderFunction(outer, inner) { - return memoizer(outer)(inner); -} - -},{"../memoize":"cqPyR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bTWnR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * @deprecated Unused as of version 8 - */ parcelHelpers.export(exports, "getResourceUrl", ()=>getResourceUrl); -/** - * @deprecated Unused as of version 8 - */ parcelHelpers.export(exports, "setBaseUrl", ()=>setBaseUrl); -var _baseUrl = ''; -function getResourceUrl(url) { - return _baseUrl + url; -} -function setBaseUrl(baseUrl) { - _baseUrl = baseUrl; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ghqZY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "safeRequestAnimationFrame", ()=>safeRequestAnimationFrame); -var _extendComponent = require("./extendComponent"); -var safeRequestAnimationFrame = function(component) { - var activeTimeouts; - return function(cb) { - if (!activeTimeouts) { - activeTimeouts = new Set(); - (0, _extendComponent.extendComponent)(component, { - componentWillUnmount: function() { - activeTimeouts.forEach(function(id) { - return cancelAnimationFrame(id); - }); - } - }); - } - var timeoutId = requestAnimationFrame(function() { - activeTimeouts.delete(timeoutId); - cb(); - }); - activeTimeouts.add(timeoutId); - }; -}; - -},{"./extendComponent":"iAatf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2wmgr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "safeSetTimeout", ()=>safeSetTimeout); -var _extendComponent = require("./extendComponent"); -var safeSetTimeout = function(component) { - var activeTimeouts; - return function(cb, duration) { - if (!activeTimeouts) { - activeTimeouts = new Set(); - (0, _extendComponent.extendComponent)(component, { - componentWillUnmount: function() { - activeTimeouts.forEach(function(id) { - return clearTimeout(id); - }); - } - }); - } - var timeoutId = setTimeout(function() { - activeTimeouts.delete(timeoutId); - cb(); - }, duration); - activeTimeouts.add(timeoutId); - }; -}; - -},{"./extendComponent":"iAatf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hAgvp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>(0, _selectionTypes.SELECTION_CHANGE)); -parcelHelpers.export(exports, "SELECTION_ITEMS_CHANGE", ()=>(0, _selectionTypes.SELECTION_ITEMS_CHANGE)); -parcelHelpers.export(exports, "SelectionDirection", ()=>(0, _selectionTypes.SelectionDirection)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _selectionTypes.SelectionMode)); -parcelHelpers.export(exports, "Selection", ()=>(0, _selection.Selection)); -var _selectionTypes = require("./Selection.types"); -var _selection = require("./Selection"); - -},{"./Selection.types":"hrSBP","./Selection":"95bhY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hrSBP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SELECTION_CHANGE", ()=>SELECTION_CHANGE); -parcelHelpers.export(exports, "SELECTION_ITEMS_CHANGE", ()=>SELECTION_ITEMS_CHANGE); -parcelHelpers.export(exports, "SelectionMode", ()=>SelectionMode); -parcelHelpers.export(exports, "SelectionDirection", ()=>SelectionDirection); -var SELECTION_CHANGE = 'change'; -var SELECTION_ITEMS_CHANGE = 'items-change'; -var SelectionMode; -(function(SelectionMode) { - SelectionMode[SelectionMode["none"] = 0] = "none"; - SelectionMode[SelectionMode["single"] = 1] = "single"; - SelectionMode[SelectionMode["multiple"] = 2] = "multiple"; -})(SelectionMode || (SelectionMode = {})); -var SelectionDirection; -(function(SelectionDirection) { - SelectionDirection[SelectionDirection["horizontal"] = 0] = "horizontal"; - SelectionDirection[SelectionDirection["vertical"] = 1] = "vertical"; -})(SelectionDirection || (SelectionDirection = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"95bhY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Selection", ()=>Selection); -var _selectionTypes = require("./Selection.types"); -var _eventGroup = require("../EventGroup"); -/** - * {@docCategory Selection} - */ var Selection = /** @class */ function() { - /** - * Create a new Selection. If `TItem` does not have a `key` property, you must provide an options - * object with a `getKey` implementation. Providing options is optional otherwise. - * (At most one `options` object is accepted.) - */ function Selection() { - var options = []; // Otherwise, arguments require options with `getKey`. - for(var _i = 0 // Otherwise, arguments require options with `getKey`. - ; _i < arguments.length // Otherwise, arguments require options with `getKey`. - ; _i++ // Otherwise, arguments require options with `getKey`. - )options[_i] = arguments[_i]; // Otherwise, arguments require options with `getKey`. - var _a = options[0] || {}, onSelectionChanged = _a.onSelectionChanged, onItemsChanged = _a.onItemsChanged, getKey = _a.getKey, _b = _a.canSelectItem, canSelectItem = _b === void 0 ? function() { - return true; - } : _b, items = _a.items, _c = _a.selectionMode, selectionMode = _c === void 0 ? (0, _selectionTypes.SelectionMode).multiple : _c; - this.mode = selectionMode; - this._getKey = getKey || defaultGetKey; - this._changeEventSuppressionCount = 0; - this._exemptedCount = 0; - this._anchoredIndex = 0; - this._unselectableCount = 0; - this._onSelectionChanged = onSelectionChanged; - this._onItemsChanged = onItemsChanged; - this._canSelectItem = canSelectItem; - this._keyToIndexMap = {}; - this._isModal = false; - this.setItems(items || [], true); - this.count = this.getSelectedCount(); - } - Selection.prototype.canSelectItem = function(item, index) { - if (typeof index === 'number' && index < 0) return false; - return this._canSelectItem(item, index); - }; - Selection.prototype.getKey = function(item, index) { - var key = this._getKey(item, index); - return typeof key === 'number' || key ? "".concat(key) : ''; - }; - Selection.prototype.setChangeEvents = function(isEnabled, suppressChange) { - this._changeEventSuppressionCount += isEnabled ? -1 : 1; - if (this._changeEventSuppressionCount === 0 && this._hasChanged) { - this._hasChanged = false; - if (!suppressChange) this._change(); - } - }; - Selection.prototype.isModal = function() { - return this._isModal; - }; - Selection.prototype.setModal = function(isModal) { - if (this._isModal !== isModal) { - this.setChangeEvents(false); - this._isModal = isModal; - if (!isModal) this.setAllSelected(false); - this._change(); - this.setChangeEvents(true); - } - }; - /** - * Selection needs the items, call this method to set them. If the set - * of items is the same, this will re-evaluate selection and index maps. - * Otherwise, shouldClear should be set to true, so that selection is - * cleared. - */ Selection.prototype.setItems = function(items, shouldClear) { - if (shouldClear === void 0) shouldClear = true; - var newKeyToIndexMap = {}; - var newUnselectableIndices = {}; - var hasSelectionChanged = false; - this.setChangeEvents(false); - // Reset the unselectable count. - this._unselectableCount = 0; - var haveItemsChanged = false; - // Build lookup table for quick selection evaluation. - for(var i = 0; i < items.length; i++){ - var item = items[i]; - if (item) { - var key = this.getKey(item, i); - if (key) { - if (!haveItemsChanged && (!(key in this._keyToIndexMap) || this._keyToIndexMap[key] !== i)) haveItemsChanged = true; - newKeyToIndexMap[key] = i; - } - } - newUnselectableIndices[i] = item && !this.canSelectItem(item); - if (newUnselectableIndices[i]) this._unselectableCount++; - } - if (shouldClear || items.length === 0) this._setAllSelected(false, true); - // Check the exemption list for discrepencies. - var newExemptedIndicies = {}; - var newExemptedCount = 0; - for(var indexProperty in this._exemptedIndices)if (this._exemptedIndices.hasOwnProperty(indexProperty)) { - var index = Number(indexProperty); - var item = this._items[index]; - var exemptKey = item ? this.getKey(item, Number(index)) : undefined; - var newIndex = exemptKey ? newKeyToIndexMap[exemptKey] : index; - if (newIndex === undefined) // The item has likely been replaced or removed. - hasSelectionChanged = true; - else { - // We know the new index of the item. update the existing exemption table. - newExemptedIndicies[newIndex] = true; - newExemptedCount++; - hasSelectionChanged = hasSelectionChanged || newIndex !== index; - } - } - if (this._items && this._exemptedCount === 0 && items.length !== this._items.length && this._isAllSelected) // If everything was selected but the number of items has changed, selection has changed. - hasSelectionChanged = true; - if (!haveItemsChanged) for(var _i = 0, _a = Object.keys(this._keyToIndexMap); _i < _a.length; _i++){ - var key = _a[_i]; - if (!(key in newKeyToIndexMap)) { - haveItemsChanged = true; - break; - } - } - this._exemptedIndices = newExemptedIndicies; - this._exemptedCount = newExemptedCount; - this._keyToIndexMap = newKeyToIndexMap; - this._unselectableIndices = newUnselectableIndices; - this._items = items; - this._selectedItems = null; - if (hasSelectionChanged) this._updateCount(); - if (haveItemsChanged) { - (0, _eventGroup.EventGroup).raise(this, (0, _selectionTypes.SELECTION_ITEMS_CHANGE)); - if (this._onItemsChanged) this._onItemsChanged(); - } - if (hasSelectionChanged) this._change(); - this.setChangeEvents(true); - }; - Selection.prototype.getItems = function() { - return this._items; - }; - Selection.prototype.getSelection = function() { - if (!this._selectedItems) { - this._selectedItems = []; - var items = this._items; - if (items) { - for(var i = 0; i < items.length; i++)if (this.isIndexSelected(i)) this._selectedItems.push(items[i]); - } - } - return this._selectedItems; - }; - Selection.prototype.getSelectedCount = function() { - return this._isAllSelected ? this._items.length - this._exemptedCount - this._unselectableCount : this._exemptedCount; - }; - Selection.prototype.getSelectedIndices = function() { - if (!this._selectedIndices) { - this._selectedIndices = []; - var items = this._items; - if (items) { - for(var i = 0; i < items.length; i++)if (this.isIndexSelected(i)) this._selectedIndices.push(i); - } + } + var retVal = "__retval__"; + function classNamesFunction(options2) { + if (options2 === void 0) { + options2 = {}; + } + var windowMap = /* @__PURE__ */ new Map(); + var styleCalcCount = 0; + var getClassNamesCount = 0; + var currentMemoizedClassNames = _memoizedClassNames; + var getClassNames2 = function(styleFunctionOrObject, styleProps) { + var _a2; + if (styleProps === void 0) { + styleProps = {}; + } + if (options2.useStaticStyles && typeof styleFunctionOrObject === "function" && styleFunctionOrObject.__noStyleOverride__) { + return styleFunctionOrObject(styleProps); + } + getClassNamesCount++; + var shadowConfig = styleFunctionOrObject ? styleFunctionOrObject.__shadowConfig__ : void 0; + var key2 = shadowConfig && shadowConfig.window ? shadowConfig.window : "__default__"; + if (!windowMap.has(key2)) { + windowMap.set(key2, /* @__PURE__ */ new Map()); + } + var current = windowMap.get(key2); + var theme = styleProps.theme; + var rtl = theme && theme.rtl !== void 0 ? theme.rtl : getRTL(); + var disableCaching = options2.disableCaching; + if (currentMemoizedClassNames !== _memoizedClassNames) { + currentMemoizedClassNames = _memoizedClassNames; + windowMap.set(key2, /* @__PURE__ */ new Map()); + current = windowMap.get(key2); + styleCalcCount = 0; + } + if (!options2.disableCaching) { + current = _traverseMap(windowMap.get(key2), styleFunctionOrObject); + current = _traverseMap(current, styleProps); + } + if (disableCaching || !current[retVal]) { + if (styleFunctionOrObject === void 0) { + current[retVal] = {}; + } else { + current[retVal] = mergeCssSets([ + typeof styleFunctionOrObject === "function" ? styleFunctionOrObject(styleProps) : styleFunctionOrObject + ], { + shadowConfig: styleFunctionOrObject.__shadowConfig__, + rtl: !!rtl, + specificityMultiplier: options2.useStaticStyles ? DEFAULT_SPECIFICITY_MULTIPLIER : void 0 + }); } - return this._selectedIndices; - }; - Selection.prototype.getItemIndex = function(key) { - var index = this._keyToIndexMap[key]; - return index !== null && index !== void 0 ? index : -1; - }; - Selection.prototype.isRangeSelected = function(fromIndex, count) { - if (count === 0) return false; - var endIndex = fromIndex + count; - for(var i = fromIndex; i < endIndex; i++){ - if (!this.isIndexSelected(i)) return false; + if (!disableCaching) { + styleCalcCount++; } - return true; + } + if (styleCalcCount > (options2.cacheSize || MAX_CACHE_COUNT)) { + var win = getWindow(); + if ((_a2 = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _a2 === void 0 ? void 0 : _a2.enableClassNameCacheFullWarning) { + console.warn("Styles are being recalculated too frequently. Cache miss rate is ".concat(styleCalcCount, "/").concat(getClassNamesCount, ".")); + console.trace(); + } + windowMap.get(key2).clear(); + styleCalcCount = 0; + options2.disableCaching = true; + } + return current[retVal]; }; - Selection.prototype.isAllSelected = function() { - var selectableCount = this._items.length - this._unselectableCount; - // In single mode, we can only have a max of 1 item. - if (this.mode === (0, _selectionTypes.SelectionMode).single) selectableCount = Math.min(selectableCount, 1); - return this.count > 0 && this._isAllSelected && this._exemptedCount === 0 || !this._isAllSelected && this._exemptedCount === selectableCount && selectableCount > 0; - }; - Selection.prototype.isKeySelected = function(key) { - var index = this._keyToIndexMap[key]; - return this.isIndexSelected(index); - }; - Selection.prototype.isIndexSelected = function(index) { - return !!(this.count > 0 && this._isAllSelected && !this._exemptedIndices[index] && !this._unselectableIndices[index] || !this._isAllSelected && this._exemptedIndices[index]); - }; - Selection.prototype.setAllSelected = function(isAllSelected) { - if (isAllSelected && this.mode !== (0, _selectionTypes.SelectionMode).multiple) return; - var selectableCount = this._items ? this._items.length - this._unselectableCount : 0; - this.setChangeEvents(false); - if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) { - this._exemptedIndices = {}; - if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) { - this._exemptedCount = 0; - this._isAllSelected = isAllSelected; - this._change(); - } - this._updateCount(); - } - this.setChangeEvents(true); - }; - Selection.prototype.setKeySelected = function(key, isSelected, shouldAnchor) { - var index = this._keyToIndexMap[key]; - if (index >= 0) this.setIndexSelected(index, isSelected, shouldAnchor); - }; - Selection.prototype.setIndexSelected = function(index, isSelected, shouldAnchor) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - // Clamp the index. - index = Math.min(Math.max(0, index), this._items.length - 1); - // No-op on out of bounds selections. - if (index < 0 || index >= this._items.length) return; - this.setChangeEvents(false); - var isExempt = this._exemptedIndices[index]; - var canSelect = !this._unselectableIndices[index]; - if (canSelect) { - if (isSelected && this.mode === (0, _selectionTypes.SelectionMode).single) // If this is single-select, the previous selection should be removed. - this._setAllSelected(false, true); - // Determine if we need to remove the exemption. - if (isExempt && (isSelected && this._isAllSelected || !isSelected && !this._isAllSelected)) { - delete this._exemptedIndices[index]; - this._exemptedCount--; - } - // Determine if we need to add the exemption. - if (!isExempt && (isSelected && !this._isAllSelected || !isSelected && this._isAllSelected)) { - this._exemptedIndices[index] = true; - this._exemptedCount++; - } - if (shouldAnchor) this._anchoredIndex = index; - } - this._updateCount(); - this.setChangeEvents(true); - }; - Selection.prototype.setRangeSelected = function(fromIndex, count, isSelected, shouldAnchor) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - // Clamp the index. - fromIndex = Math.min(Math.max(0, fromIndex), this._items.length - 1); - // Clamp the range. - count = Math.min(Math.max(0, count), this._items.length - fromIndex); - // No-op on out of bounds selections. - if (fromIndex < 0 || fromIndex >= this._items.length || count === 0) return; - this.setChangeEvents(false); - var anchorIndex = this._anchoredIndex || 0; - var startIndex = fromIndex; - var endIndex = fromIndex + count - 1; - var newAnchorIndex = anchorIndex >= endIndex ? startIndex : endIndex; - for(; startIndex <= endIndex; startIndex++)this.setIndexSelected(startIndex, isSelected, shouldAnchor ? startIndex === newAnchorIndex : false); - this.setChangeEvents(true); - }; - Selection.prototype.selectToKey = function(key, clearSelection) { - this.selectToIndex(this._keyToIndexMap[key], clearSelection); - }; - Selection.prototype.selectToRange = function(fromIndex, count, clearSelection) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - if (this.mode === (0, _selectionTypes.SelectionMode).single) { - if (count === 1) this.setIndexSelected(fromIndex, true, true); - return; - } - var anchorIndex = this._anchoredIndex || 0; - var startIndex = Math.min(fromIndex, anchorIndex); - var endIndex = Math.max(fromIndex + count - 1, anchorIndex); - this.setChangeEvents(false); - if (clearSelection) this._setAllSelected(false, true); - for(; startIndex <= endIndex; startIndex++)this.setIndexSelected(startIndex, true, false); - this.setChangeEvents(true); - }; - Selection.prototype.selectToIndex = function(index, clearSelection) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - if (this.mode === (0, _selectionTypes.SelectionMode).single) { - this.setIndexSelected(index, true, true); - return; - } - var anchorIndex = this._anchoredIndex || 0; - var startIndex = Math.min(index, anchorIndex); - var endIndex = Math.max(index, anchorIndex); - this.setChangeEvents(false); - if (clearSelection) this._setAllSelected(false, true); - for(; startIndex <= endIndex; startIndex++)this.setIndexSelected(startIndex, true, false); - this.setChangeEvents(true); - }; - Selection.prototype.toggleAllSelected = function() { - this.setAllSelected(!this.isAllSelected()); - }; - Selection.prototype.toggleKeySelected = function(key) { - this.setKeySelected(key, !this.isKeySelected(key), true); - }; - Selection.prototype.toggleIndexSelected = function(index) { - this.setIndexSelected(index, !this.isIndexSelected(index), true); - }; - Selection.prototype.toggleRangeSelected = function(fromIndex, count) { - if (this.mode === (0, _selectionTypes.SelectionMode).none) return; - var isRangeSelected = this.isRangeSelected(fromIndex, count); - var endIndex = fromIndex + count; - if (this.mode === (0, _selectionTypes.SelectionMode).single && count > 1) return; - this.setChangeEvents(false); - for(var i = fromIndex; i < endIndex; i++)this.setIndexSelected(i, !isRangeSelected, false); - this.setChangeEvents(true); - }; - Selection.prototype._updateCount = function(preserveModalState) { - if (preserveModalState === void 0) preserveModalState = false; - var count = this.getSelectedCount(); - if (count !== this.count) { - this.count = count; - this._change(); - } - if (!this.count && !preserveModalState) this.setModal(false); - }; - Selection.prototype._setAllSelected = function(isAllSelected, preserveModalState) { - if (preserveModalState === void 0) preserveModalState = false; - if (isAllSelected && this.mode !== (0, _selectionTypes.SelectionMode).multiple) return; - var selectableCount = this._items ? this._items.length - this._unselectableCount : 0; - this.setChangeEvents(false); - if (selectableCount > 0 && (this._exemptedCount > 0 || isAllSelected !== this._isAllSelected)) { - this._exemptedIndices = {}; - if (isAllSelected !== this._isAllSelected || this._exemptedCount > 0) { - this._exemptedCount = 0; - this._isAllSelected = isAllSelected; - this._change(); - } - this._updateCount(preserveModalState); - } - this.setChangeEvents(true); - }; - Selection.prototype._change = function() { - if (this._changeEventSuppressionCount === 0) { - this._selectedItems = null; - this._selectedIndices = undefined; - (0, _eventGroup.EventGroup).raise(this, (0, _selectionTypes.SELECTION_CHANGE)); - if (this._onSelectionChanged) this._onSelectionChanged(); - } else this._hasChanged = true; - }; - return Selection; -}(); -function defaultGetKey(item, index) { - // 0 may be used as a key - var _a = (item || {}).key, key = _a === void 0 ? "".concat(index) : _a; - return key; -} - -},{"./Selection.types":"hrSBP","../EventGroup":"0TvPH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"996Ia":[function(require,module,exports,__globalThis) { -// Regex that finds { and } so they can be removed on a lookup for string format -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * String format method, used for scenarios where at runtime you - * need to evaluate a formatted string given a tokenized string. This - * usually only is needed in localization scenarios. - - * @example - * ```tsx - * "I love {0} every {1}".format("CXP") - * ``` - * will result in a Debug Exception. - * - * @public - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "format", ()=>format); -var FORMAT_ARGS_REGEX = /[\{\}]/g; -// Regex that finds {#} so it can be replaced by the arguments in string format -var FORMAT_REGEX = /\{\d+\}/g; -function format(s) { - var values = []; - for(var _i = 1; _i < arguments.length; _i++)values[_i - 1] = arguments[_i]; - var args = values; - // Callback match function - function replaceFunc(match) { - // looks up in the args - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var replacement = args[match.replace(FORMAT_ARGS_REGEX, '')]; - // catches undefined in nondebug and null in debug and nondebug - if (replacement === null || replacement === undefined) replacement = ''; - return replacement; - } - return s.replace(FORMAT_REGEX, replaceFunc); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bwELv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "styled", ()=>styled); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _index = require("./shadowDom/index"); -var _useCustomizationSettings = require("./customizations/useCustomizationSettings"); -var DefaultFields = [ - 'theme', - 'styles' -]; -function styled(Component, baseStyles, getProps, customizable, pure) { - customizable = customizable || { - scope: '', - fields: undefined - }; - var scope = customizable.scope, _a = customizable.fields, fields = _a === void 0 ? DefaultFields : _a; - var Wrapped = _react.forwardRef(function(props, forwardedRef) { - var styles = _react.useRef(); - var settings = (0, _useCustomizationSettings.useCustomizationSettings)(fields, scope); - var customizedStyles = settings.styles, dir = settings.dir, rest = (0, _tslib.__rest)(settings, [ - "styles", - "dir" - ]); - var additionalProps = getProps ? getProps(props) : undefined; - var useStyled = (0, _index.useMergeStylesHooks)().useStyled; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var cache = styles.current && styles.current.__cachedInputs__ || []; - var propStyles = props.styles; - if (!styles.current || customizedStyles !== cache[1] || propStyles !== cache[2]) { - // Using styled components as the Component arg will result in nested styling arrays. - // The function can be cached and in order to prevent the props from being retained within it's closure - // we pass in just the styles and not the entire props - var concatenatedStyles = function(styleProps) { - return (0, _mergeStyles.concatStyleSetsWithProps)(styleProps, baseStyles, customizedStyles, propStyles); - }; - // The __cachedInputs__ array is attached to the function and consumed by the - // classNamesFunction as a list of keys to include for memoizing classnames. - concatenatedStyles.__cachedInputs__ = [ - baseStyles, - customizedStyles, - propStyles - ]; - concatenatedStyles.__noStyleOverride__ = !customizedStyles && !propStyles; - styles.current = concatenatedStyles; - } - styles.current.__shadowConfig__ = useStyled(scope); - return _react.createElement(Component, (0, _tslib.__assign)({ - ref: forwardedRef - }, rest, additionalProps, props, { - styles: styles.current - })); - }); - // Function.prototype.name is an ES6 feature, so the cast to any is required until we're - // able to drop IE 11 support and compile with ES6 libs - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Wrapped.displayName = "Styled".concat(Component.displayName || Component.name); - // This preserves backwards compatibility. - var pureComponent = pure ? _react.memo(Wrapped) : Wrapped; - // Check if the wrapper has a displayName after it has been memoized. Then assign it to the pure component. - if (Wrapped.displayName) pureComponent.displayName = Wrapped.displayName; - return pureComponent; -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","./shadowDom/index":"dU66z","./customizations/useCustomizationSettings":"hUUmS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dU66z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>(0, _mergeStylesRootContext.MergeStylesRootProvider)); -parcelHelpers.export(exports, "MergeStylesShadowRootConsumer", ()=>(0, _mergeStylesShadowRootConsumer.MergeStylesShadowRootConsumer)); -parcelHelpers.export(exports, "MergeStylesShadowRootContext", ()=>(0, _mergeStylesShadowRootContext.MergeStylesShadowRootContext)); -parcelHelpers.export(exports, "MergeStylesShadowRootProvider", ()=>(0, _mergeStylesShadowRootContext.MergeStylesShadowRootProvider)); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>(0, _useAdoptedStylesheet.useAdoptedStylesheet)); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>(0, _useAdoptedStylesheet.useAdoptedStylesheetEx)); -parcelHelpers.export(exports, "useMergeStylesHooks", ()=>(0, _useMergeStylesHooks.useMergeStylesHooks)); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>(0, _useMergeStylesRootStylesheets.useMergeStylesRootStylesheets)); -parcelHelpers.export(exports, "useHasMergeStylesShadowRootContext", ()=>(0, _useMergeStylesShadowRoot.useHasMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useMergeStylesShadowRootContext", ()=>(0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext)); -parcelHelpers.export(exports, "useShadowConfig", ()=>(0, _useShadowConfig.useShadowConfig)); -parcelHelpers.export(exports, "useStyled", ()=>(0, _useStyled.useStyled)); -var _mergeStylesRootContext = require("./contexts/MergeStylesRootContext"); -var _mergeStylesShadowRootConsumer = require("./contexts/MergeStylesShadowRootConsumer"); -var _mergeStylesShadowRootContext = require("./contexts/MergeStylesShadowRootContext"); -var _useAdoptedStylesheet = require("./hooks/useAdoptedStylesheet"); -var _useMergeStylesHooks = require("./hooks/useMergeStylesHooks"); -var _useMergeStylesRootStylesheets = require("./hooks/useMergeStylesRootStylesheets"); -var _useMergeStylesShadowRoot = require("./hooks/useMergeStylesShadowRoot"); -var _useShadowConfig = require("./hooks/useShadowConfig"); -var _useStyled = require("./hooks/useStyled"); - -},{"./contexts/MergeStylesRootContext":"imHPx","./contexts/MergeStylesShadowRootConsumer":false,"./contexts/MergeStylesShadowRootContext":"eqTfx","./hooks/useAdoptedStylesheet":"cwY76","./hooks/useMergeStylesHooks":"90VFe","./hooks/useMergeStylesRootStylesheets":"daPdP","./hooks/useMergeStylesShadowRoot":"gp0eP","./hooks/useShadowConfig":"ddtud","./hooks/useStyled":"eIB12","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"imHPx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MergeStylesRootContext", ()=>MergeStylesRootContext); -parcelHelpers.export(exports, "MergeStylesRootProvider", ()=>MergeStylesRootProvider); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _dom = require("../../dom"); -var _mergeStylesDefaultContext = require("./MergeStylesDefaultContext"); -var _useAdoptedStylesheet = require("../hooks/useAdoptedStylesheet"); -var _useShadowConfig = require("../hooks/useShadowConfig"); -var _useMergeStylesShadowRoot = require("../hooks/useMergeStylesShadowRoot"); -var _useMergeStylesRootStylesheets = require("../hooks/useMergeStylesRootStylesheets"); -var _useStyled = require("../hooks/useStyled"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var MergeStylesRootContext = _react.createContext((0, _mergeStylesDefaultContext.getNewContext)()); -var MergeStylesRootProvider = function(_a) { - var userSheets = _a.stylesheets, userWindow = _a.window, useAdoptedStylesheet = _a.useAdoptedStylesheet, useAdoptedStylesheetEx = _a.useAdoptedStylesheetEx, useShadowConfig = _a.useShadowConfig, useMergeStylesShadowRootContext = _a.useMergeStylesShadowRootContext, useHasMergeStylesShadowRootContext = _a.useHasMergeStylesShadowRootContext, useMergeStylesRootStylesheets = _a.useMergeStylesRootStylesheets, useWindow = _a.useWindow, useStyled = _a.useStyled, props = (0, _tslib.__rest)(_a, [ - "stylesheets", - "window", - "useAdoptedStylesheet", - "useAdoptedStylesheetEx", - "useShadowConfig", - "useMergeStylesShadowRootContext", - "useHasMergeStylesShadowRootContext", - "useMergeStylesRootStylesheets", - "useWindow", - "useStyled" - ]); - var win = userWindow !== null && userWindow !== void 0 ? userWindow : (0, _dom.getWindow)(); - var _b = _react.useState(function() { - return userSheets || new Map(); - }), stylesheets = _b[0], setStylesheets = _b[1]; - var sheetHandler = _react.useCallback(function(_a) { - var key = _a.key, sheet = _a.sheet; - setStylesheets(function(prev) { - var next = new Map(prev); - next.set(key, sheet); - return next; - }); - }, []); - // Udapte stylesheets based on user style sheet changes - _react.useEffect(function() { - setStylesheets(userSheets || new Map()); - }, [ - userSheets - ]); - // Wire up listener for adopted stylesheets - _react.useEffect(function() { - if (!win) return; - var sheet = (0, _mergeStyles.ShadowDomStylesheet).getInstance((0, _mergeStyles.makeShadowConfig)((0, _mergeStyles.GLOBAL_STYLESHEET_KEY), false, win)); - var off = sheet.onAddSheet(sheetHandler); - return function() { - off(); - }; - }, [ - win, - sheetHandler - ]); - // Read stylesheets from window on mount - _react.useEffect(function() { - if (!win) return; - var changed = false; - var next = new Map(stylesheets); - var sheet = (0, _mergeStyles.ShadowDomStylesheet).getInstance((0, _mergeStyles.makeShadowConfig)((0, _mergeStyles.GLOBAL_STYLESHEET_KEY), false, win)); - var adoptedSheets = sheet.getAdoptedSheets(); - adoptedSheets.forEach(function(adoptedSheet, key) { - next.set(key, adoptedSheet); - changed = true; - }); - if (changed) setStylesheets(next); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - var defaultValues = _react.useMemo(function() { - return { - stylesheets: stylesheets, - useAdoptedStylesheet: useAdoptedStylesheet || (0, _useAdoptedStylesheet.useAdoptedStylesheet), - useAdoptedStylesheetEx: useAdoptedStylesheetEx || (0, _useAdoptedStylesheet.useAdoptedStylesheetEx), - useShadowConfig: useShadowConfig || (0, _useShadowConfig.useShadowConfig), - useMergeStylesShadowRootContext: useMergeStylesShadowRootContext || (0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext), - useHasMergeStylesShadowRootContext: useHasMergeStylesShadowRootContext || (0, _useMergeStylesShadowRoot.useHasMergeStylesShadowRootContext), - useMergeStylesRootStylesheets: useMergeStylesRootStylesheets || (0, _useMergeStylesRootStylesheets.useMergeStylesRootStylesheets), - useWindow: useWindow || (0, _reactWindowProvider.useWindow), - useStyled: useStyled || (0, _useStyled.useStyled) - }; - }, [ - stylesheets, - useAdoptedStylesheet, - useAdoptedStylesheetEx, - useShadowConfig, - useMergeStylesShadowRootContext, - useHasMergeStylesShadowRootContext, - useMergeStylesRootStylesheets, - useWindow, - useStyled - ]); - return _react.createElement((0, _mergeStylesDefaultContext.MergeStylesDefaultContext).Provider, { - value: defaultValues - }, _react.createElement(MergeStylesRootContext.Provider, (0, _tslib.__assign)({ - value: defaultValues - }, props))); -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","../../dom":"QMA5I","./MergeStylesDefaultContext":"jiC2S","../hooks/useAdoptedStylesheet":"cwY76","../hooks/useShadowConfig":"ddtud","../hooks/useMergeStylesShadowRoot":"gp0eP","../hooks/useMergeStylesRootStylesheets":"daPdP","../hooks/useStyled":"eIB12","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cwY76":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useAdoptedStylesheet", ()=>useAdoptedStylesheet); -parcelHelpers.export(exports, "useAdoptedStylesheetEx", ()=>useAdoptedStylesheetEx); -var _tslib = require("tslib"); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _useMergeStylesRootStylesheets = require("./useMergeStylesRootStylesheets"); -var _useMergeStylesShadowRoot = require("./useMergeStylesShadowRoot"); -var useAdoptedStylesheet = function(stylesheetKey) { - var shadowCtx = (0, _useMergeStylesShadowRoot.useMergeStylesShadowRootContext)(); - var rootMergeStyles = (0, _useMergeStylesRootStylesheets.useMergeStylesRootStylesheets)(); - var win = (0, _reactWindowProvider.useWindow)(); - return useAdoptedStylesheetEx(stylesheetKey, shadowCtx, rootMergeStyles, win); -}; -var useAdoptedStylesheetEx = function(stylesheetKey, shadowCtx, rootMergeStyles, win) { - var polyfillInsertListners = _react.useRef({}); - _react.useEffect(function() { - if (!shadowCtx) return; - var polyfillListeners = polyfillInsertListners.current; - polyfillInsertListners.current = {}; - return function() { - Object.keys(polyfillListeners).forEach(function(key) { - polyfillListeners[key](); - }); - }; - }, [ - win, - stylesheetKey, - shadowCtx - ]); - if (!shadowCtx) return false; - if (shadowCtx.shadowRoot && !shadowCtx.stylesheets.has(stylesheetKey)) { - var adoptableStyleSheet = rootMergeStyles.get(stylesheetKey); - if (adoptableStyleSheet && (win === null || win === void 0 ? void 0 : win.document)) adoptSheet(shadowCtx, win.document, stylesheetKey, adoptableStyleSheet, polyfillInsertListners.current); + return getClassNames2; + } + function _traverseEdge(current, value2) { + value2 = _normalizeValue(value2); + if (!current.has(value2)) { + current.set(value2, /* @__PURE__ */ new Map()); } - return true; -}; -var updatePolyfillSheet = function(shadowCtx, stylesheetKey, rule) { - var shadowRoot = shadowCtx.shadowRoot; - var style = shadowRoot.querySelector("[data-merge-styles-stylesheet-key=\"".concat(stylesheetKey, "\"]")); - if (style === null || style === void 0 ? void 0 : style.sheet) style.sheet.insertRule(rule); -}; -var adoptSheet = function(shadowCtx, doc, stylesheetKey, stylesheet, listenerRef) { - var _a, _b, _c, _d, _e; - var shadowRoot = shadowCtx.shadowRoot; - shadowCtx.stylesheets.set(stylesheetKey, stylesheet); - if (0, _mergeStyles.SUPPORTS_CONSTRUCTABLE_STYLESHEETS) { - // Maintain the sort order of Fluent style sheets - var prevSheets = shadowRoot.adoptedStyleSheets; - var i = prevSheets.length; - var found = i === 0; - while(i >= 0 && !found){ - i--; - var prevSheet = prevSheets[i]; - var prevSortOrder = (_b = (_a = prevSheet.metadata) === null || _a === void 0 ? void 0 : _a.sortOrder) !== null && _b !== void 0 ? _b : 0; - var sheetSortOrder = (_d = (_c = stylesheet.metadata) === null || _c === void 0 ? void 0 : _c.sortOrder) !== null && _d !== void 0 ? _d : 0; - if (prevSheet.bucketName === 'merge-styles' && prevSortOrder < sheetSortOrder) found = true; - } - if (0, _mergeStyles.SUPPORTS_MODIFYING_ADOPTED_STYLESHEETS) // The current spec allows the `adoptedStyleSheets` array to be modified. - // Previous versions of the spec required a new array to be created. - // For more details see: https://github.com/microsoft/fast/pull/6703 - shadowRoot.adoptedStyleSheets.splice(i + 1, 0, stylesheet); - else shadowRoot.adoptedStyleSheets = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], shadowRoot.adoptedStyleSheets.slice(0, i + 1), true), [ - stylesheet - ], false), shadowRoot.adoptedStyleSheets.slice(i + 1), true); - } else { - var style = doc.createElement('style'); - style.setAttribute('data-merge-styles-stylesheet-key', stylesheetKey); - var otherStyles = shadowRoot.querySelectorAll('[data-merge-styles-stylesheet-key]'); - if (otherStyles.length > 0) shadowRoot.insertBefore(style, otherStyles[otherStyles.length - 1].nextSibling); - else shadowRoot.insertBefore(style, shadowRoot.firstChild); - if (style.sheet) { - (0, _mergeStyles.cloneCSSStyleSheet)(stylesheet, style.sheet); - if (!listenerRef[stylesheetKey]) { - var onInsert = function(_a) { - var key = _a.key, rule = _a.rule; - if (key === stylesheetKey) { - if (shadowCtx && rule) updatePolyfillSheet(shadowCtx, key, rule); - } - }; - var polyfillSheet = (0, _mergeStyles.Stylesheet).getInstance((0, _mergeStyles.makeShadowConfig)(stylesheetKey, true, (_e = doc.defaultView) !== null && _e !== void 0 ? _e : undefined)); - listenerRef[stylesheetKey] = polyfillSheet.onInsertRule(onInsert); - } + return current.get(value2); + } + function _traverseMap(current, inputs) { + if (typeof inputs === "function") { + var cachedInputsFromStyled = inputs.__cachedInputs__; + if (cachedInputsFromStyled) { + for (var _i = 0, _a2 = inputs.__cachedInputs__; _i < _a2.length; _i++) { + var input = _a2[_i]; + current = _traverseEdge(current, input); + } + } else { + current = _traverseEdge(current, inputs); + } + } else if (typeof inputs === "object") { + for (var propName in inputs) { + if (inputs.hasOwnProperty(propName)) { + current = _traverseEdge(current, inputs[propName]); } + } } -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/merge-styles":"bDG2L","@fluentui/react-window-provider":"iP8C0","./useMergeStylesRootStylesheets":"daPdP","./useMergeStylesShadowRoot":"gp0eP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"daPdP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMergeStylesRootStylesheets", ()=>useMergeStylesRootStylesheets); -var _react = require("react"); -var _mergeStylesDefaultContext = require("../contexts/MergeStylesDefaultContext"); -var useMergeStylesRootStylesheets = function() { - return _react.useContext((0, _mergeStylesDefaultContext.MergeStylesDefaultContext)).stylesheets; -}; - -},{"react":"jGrId","../contexts/MergeStylesDefaultContext":"jiC2S","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ddtud":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useShadowConfig", ()=>useShadowConfig); -var _react = require("react"); -var _mergeStyles = require("@fluentui/merge-styles"); -var useShadowConfig = function(stylesheetKey, inShadow, win) { - if (inShadow === void 0) inShadow = false; - return _react.useMemo(function() { - return (0, _mergeStyles.makeShadowConfig)(stylesheetKey, inShadow, win); - }, [ - stylesheetKey, - inShadow, - win - ]); -}; - -},{"react":"jGrId","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eIB12":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useStyled", ()=>useStyled); -var _dom = require("../../dom"); -var _useMergeStylesHooks = require("./useMergeStylesHooks"); -var useStyled = function(scope) { - if (scope === void 0) scope = '__global__'; - var _a = (0, _useMergeStylesHooks.useMergeStylesHooks)(), useAdoptedStylesheetEx = _a.useAdoptedStylesheetEx, useShadowConfig = _a.useShadowConfig, useMergeStylesShadowRootContext = _a.useMergeStylesShadowRootContext, useMergeStylesRootStylesheets = _a.useMergeStylesRootStylesheets, useWindow = _a.useWindow; - var win = useWindow() || (0, _dom.getWindow)(); - var shadowCtx = useMergeStylesShadowRootContext(); - var inShadow = !!shadowCtx; - var rootMergeStyles = useMergeStylesRootStylesheets(); - var shadowConfig = useShadowConfig(scope, inShadow, win); - useAdoptedStylesheetEx(scope, shadowCtx, rootMergeStyles, win); - return shadowConfig; -}; - -},{"../../dom":"QMA5I","./useMergeStylesHooks":"90VFe","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dpie2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "setWarningCallback", ()=>(0, _warn.setWarningCallback)); -parcelHelpers.export(exports, "warn", ()=>(0, _warn.warn)); -parcelHelpers.export(exports, "warnConditionallyRequiredProps", ()=>(0, _warnConditionallyRequiredProps.warnConditionallyRequiredProps)); -parcelHelpers.export(exports, "resetControlledWarnings", ()=>(0, _warnControlledUsage.resetControlledWarnings)); -parcelHelpers.export(exports, "warnControlledUsage", ()=>(0, _warnControlledUsage.warnControlledUsage)); -parcelHelpers.export(exports, "warnDeprecations", ()=>(0, _warnDeprecations.warnDeprecations)); -parcelHelpers.export(exports, "warnMutuallyExclusive", ()=>(0, _warnMutuallyExclusive.warnMutuallyExclusive)); -var _warn = require("./warn/warn"); -var _warnConditionallyRequiredProps = require("./warn/warnConditionallyRequiredProps"); -var _warnControlledUsage = require("./warn/warnControlledUsage"); -var _warnDeprecations = require("./warn/warnDeprecations"); -var _warnMutuallyExclusive = require("./warn/warnMutuallyExclusive"); - -},{"./warn/warn":"itqD3","./warn/warnConditionallyRequiredProps":"77JnC","./warn/warnControlledUsage":"31R0G","./warn/warnDeprecations":"e2341","./warn/warnMutuallyExclusive":"1HY1B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"31R0G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** Reset controlled usage warnings for testing purposes. */ parcelHelpers.export(exports, "resetControlledWarnings", ()=>resetControlledWarnings); -/** - * Check for and warn on the following error conditions with a form component: - * - A value prop is provided (indicated it's being used as controlled) without a change handler, - * and the component is not read-only - * - Both the value and defaultValue props are provided - * - The component is attempting to switch between controlled and uncontrolled - * - * The messages mimic the warnings React gives for these error conditions on input elements. - * The warning will only be displayed once per component ID. - */ parcelHelpers.export(exports, "warnControlledUsage", ()=>warnControlledUsage); -var _warn = require("./warn"); -var _controlled = require("../controlled"); -var warningsMap; -function resetControlledWarnings() {} -function warnControlledUsage(params) { - var componentId, componentName, defaultValueProp, props, oldProps, onChangeProp, readOnlyProp, valueProp, oldIsControlled, newIsControlled, hasOnChange, isReadOnly, defaultValue, oldType, newType, warnMap; -} - -},{"./warn":"itqD3","../controlled":"5Lj2y","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c5nmJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isIE11", ()=>isIE11); -var _getWindow = require("./dom/getWindow"); -var isIE11 = function() { - var _a; - var win = (0, _getWindow.getWindow)(); - if (!((_a = win === null || win === void 0 ? void 0 : win.navigator) === null || _a === void 0 ? void 0 : _a.userAgent)) return false; - return win.navigator.userAgent.indexOf('rv:11.0') > -1; -}; - -},{"./dom/getWindow":"aI1a8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lBZmc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Function to apply default values to a component props object. This function is intended for function components, - * to maintain parity with the `defaultProps` feature of class components. It accounts for properties that are - * specified, but undefined. - * @param defaultProps- An object with default values for various properties - * @param propsWithoutDefaults- The props object passed into the component - */ parcelHelpers.export(exports, "getPropsWithDefaults", ()=>getPropsWithDefaults); -var _tslib = require("tslib"); -function getPropsWithDefaults(defaultProps, propsWithoutDefaults) { - var props = (0, _tslib.__assign)({}, propsWithoutDefaults); - for(var _i = 0, _a = Object.keys(defaultProps); _i < _a.length; _i++){ - var key = _a[_i]; - if (props[key] === undefined) props[key] = defaultProps[key]; + return current; + } + function _normalizeValue(value2) { + switch (value2) { + case void 0: + return "__undefined__"; + case null: + return "__null__"; + default: + return value2; } - return props; -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6DBuh":[function(require,module,exports,__globalThis) { -/** - * @deprecated Use `canUseDOM` from `@fluentui/utilities` instead. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "_isSSR", ()=>_isSSR); -/** - * Helper to set ssr mode to simulate no window object returned from getWindow helper. - * - * @deprecated Use `canUseDOM` from `@fluentui/utilities` instead. - */ parcelHelpers.export(exports, "setSSR", ()=>setSSR); -var _isSSR = false; -function setSSR(isEnabled) { - throw new Error("setSSR has been deprecated and is not used in any utilities anymore. Use canUseDOM from @fluentui/utilities instead."); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e5kFM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createMergedRef", ()=>createMergedRef); -var _array = require("./array"); -/** - * Set up a ref resolver function given internal state managed for the ref. - * @param local Set - */ var createResolver = function(local) { - return function(newValue) { - for(var _i = 0, _a = local.refs; _i < _a.length; _i++){ - var ref = _a[_i]; - if (typeof ref === 'function') ref(newValue); - else if (ref) // work around the immutability of the React.Ref type - ref.current = newValue; + } + var _initializedStylesheetResets$1 = false; + var _resetCounter = 0; + var _emptyObject = { empty: true }; + var _dictionary = {}; + var _weakMap = typeof WeakMap === "undefined" ? null : WeakMap; + function resetMemoizations() { + _resetCounter++; + } + function memoizeFunction(cb, maxCacheSize, ignoreNullOrUndefinedResult) { + if (maxCacheSize === void 0) { + maxCacheSize = 100; + } + if (ignoreNullOrUndefinedResult === void 0) { + ignoreNullOrUndefinedResult = false; + } + if (!_weakMap) { + return cb; + } + if (!_initializedStylesheetResets$1) { + var stylesheet2 = Stylesheet.getInstance(); + if (stylesheet2 && stylesheet2.onReset) { + Stylesheet.getInstance().onReset(resetMemoizations); + } + _initializedStylesheetResets$1 = true; + } + var rootNode; + var cacheSize = 0; + var localResetCounter = _resetCounter; + return function memoizedFunction() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var currentNode = rootNode; + if (rootNode === void 0 || localResetCounter !== _resetCounter || maxCacheSize > 0 && cacheSize > maxCacheSize) { + rootNode = _createNode(); + cacheSize = 0; + localResetCounter = _resetCounter; + } + currentNode = rootNode; + for (var i = 0; i < args.length; i++) { + var arg = _normalizeArg(args[i]); + if (!currentNode.map.has(arg)) { + currentNode.map.set(arg, _createNode()); } + currentNode = currentNode.map.get(arg); + } + if (!currentNode.hasOwnProperty("value")) { + currentNode.value = cb.apply(void 0, args); + cacheSize++; + } + if (ignoreNullOrUndefinedResult && (currentNode.value === null || currentNode.value === void 0)) { + currentNode.value = cb.apply(void 0, args); + } + return currentNode.value; }; -}; -var createMergedRef = function(value) { - var local = { - refs: [] - }; - return function() { - var newRefs = []; - for(var _i = 0; _i < arguments.length; _i++)newRefs[_i] = arguments[_i]; - if (!local.resolver || !(0, _array.arraysEqual)(local.refs, newRefs)) local.resolver = createResolver(local); - local.refs = newRefs; - return local.resolver; - }; -}; - -},{"./array":"1Pspi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"88Q1R":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useIsomorphicLayoutEffect", ()=>useIsomorphicLayoutEffect); -var _react = require("react"); -var _canUseDOM = require("./dom/canUseDOM"); -var useIsomorphicLayoutEffect = (0, _canUseDOM.canUseDOM)() ? _react.useLayoutEffect : _react.useEffect; - -},{"react":"jGrId","./dom/canUseDOM":"iFHeV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e49Gp":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/utilities', '8.15.19'); - -},{"@fluentui/set-version":"iqYXf"}],"hiMUP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Icon/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Icon/index":"35V5u","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"35V5u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _icon = require("./Icon"); -parcelHelpers.exportAll(_icon, exports); -var _iconBase = require("./Icon.base"); -parcelHelpers.exportAll(_iconBase, exports); -var _iconTypes = require("./Icon.types"); -parcelHelpers.exportAll(_iconTypes, exports); -var _fontIcon = require("./FontIcon"); -parcelHelpers.exportAll(_fontIcon, exports); -var _imageIcon = require("./ImageIcon"); -parcelHelpers.exportAll(_imageIcon, exports); - -},{"./Icon":"gfQnz","./Icon.base":false,"./Icon.types":false,"./FontIcon":"gQUPC","./ImageIcon":"64ZOw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfQnz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Icon", ()=>Icon); -var _utilities = require("../../Utilities"); -var _iconBase = require("./Icon.base"); -var _iconStyles = require("./Icon.styles"); -var Icon = (0, _utilities.styled)((0, _iconBase.IconBase), (0, _iconStyles.getStyles), undefined, { - scope: 'Icon' -}, true); -Icon.displayName = 'Icon'; - -},{"../../Utilities":"1NZCy","./Icon.base":"a20eb","./Icon.styles":"lyw66","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a20eb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconBase", ()=>IconBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _iconTypes = require("./Icon.types"); -var _image = require("../Image/Image"); -var _imageTypes = require("../Image/Image.types"); -var _utilities = require("../../Utilities"); -var _fontIcon = require("./FontIcon"); -var getClassNames = (0, _utilities.classNamesFunction)({ - // Icon is used a lot by other components. - // It's likely to see expected cases which pass different className to the Icon. - // Therefore setting a larger cache size. - cacheSize: 100 -}); -var IconBase = /** @class */ function(_super) { - (0, _tslib.__extends)(IconBase, _super); - function IconBase(props) { - var _this = _super.call(this, props) || this; - _this._onImageLoadingStateChange = function(state) { - if (_this.props.imageProps && _this.props.imageProps.onLoadingStateChange) _this.props.imageProps.onLoadingStateChange(state); - if (state === (0, _imageTypes.ImageLoadState).error) _this.setState({ - imageLoadError: true - }); - }; - _this.state = { - imageLoadError: false - }; - return _this; + } + function createMemoizer(getValue2) { + if (!_weakMap) { + return getValue2; } - IconBase.prototype.render = function() { - var _a = this.props, children = _a.children, className = _a.className, styles = _a.styles, iconName = _a.iconName, imageErrorAs = _a.imageErrorAs, theme = _a.theme; - var isPlaceholder = typeof iconName === 'string' && iconName.length === 0; - var isImage = // eslint-disable-next-line deprecation/deprecation - !!this.props.imageProps || this.props.iconType === (0, _iconTypes.IconType).image || this.props.iconType === (0, _iconTypes.IconType).Image; - var iconContent = (0, _fontIcon.getIconContent)(iconName) || {}; - var iconClassName = iconContent.iconClassName, iconContentChildren = iconContent.children, mergeImageProps = iconContent.mergeImageProps; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - iconClassName: iconClassName, - isImage: isImage, - isPlaceholder: isPlaceholder - }); - var RootType = isImage ? 'span' : 'i'; - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.htmlElementProperties), [ - 'aria-label' - ]); - var imageLoadError = this.state.imageLoadError; - var imageProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.props.imageProps), { - onLoadingStateChange: this._onImageLoadingStateChange - }); - var ImageType = imageLoadError && imageErrorAs || (0, _image.Image); - // eslint-disable-next-line deprecation/deprecation - var ariaLabel = this.props['aria-label'] || this.props.ariaLabel; - var accessibleName = imageProps.alt || ariaLabel || this.props.title; - var hasName = !!(accessibleName || this.props['aria-labelledby'] || imageProps['aria-label'] || imageProps['aria-labelledby']); - var containerProps = hasName ? { - role: isImage || mergeImageProps ? undefined : 'img', - 'aria-label': isImage || mergeImageProps ? undefined : accessibleName - } : { - 'aria-hidden': true - }; - var finalIconContentChildren = iconContentChildren; - if (mergeImageProps && iconContentChildren && typeof iconContentChildren === 'object' && accessibleName) finalIconContentChildren = _react.cloneElement(iconContentChildren, { - alt: accessibleName - }); - return _react.createElement(RootType, (0, _tslib.__assign)({ - "data-icon-name": iconName - }, containerProps, nativeProps, mergeImageProps ? { - title: undefined, - 'aria-label': undefined - } : {}, { - className: classNames.root - }), isImage ? _react.createElement(ImageType, (0, _tslib.__assign)({}, imageProps)) : children || finalIconContentChildren); - }; - return IconBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./Icon.types":"aUXAd","../Image/Image":"5keBP","../Image/Image.types":"fYQRq","../../Utilities":"1NZCy","./FontIcon":"gQUPC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aUXAd":[function(require,module,exports,__globalThis) { -/** - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - * {@docCategory Icon} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconType", ()=>IconType); -var IconType; -(function(IconType) { - /** - * Render using the fabric icon font. - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["default"] = 0] = "default"; - /** - * Render using an image, where imageProps would be used. - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["image"] = 1] = "image"; - /** - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["Default"] = 100000] = "Default"; - /** - * @deprecated Icon type is inferred based on presence of `IIconProps.imageProps` - */ IconType[IconType["Image"] = 100001] = "Image"; -})(IconType || (IconType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5keBP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Image", ()=>Image); -var _utilities = require("../../Utilities"); -var _imageBase = require("./Image.base"); -var _imageStyles = require("./Image.styles"); -var Image = (0, _utilities.styled)((0, _imageBase.ImageBase), (0, _imageStyles.getStyles), undefined, { - scope: 'Image' -}, true); -Image.displayName = 'Image'; - -},{"../../Utilities":"1NZCy","./Image.base":"jzeV5","./Image.styles":"fI8tg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jzeV5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageBase", ()=>ImageBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _imageTypes = require("./Image.types"); -var _reactHooks = require("@fluentui/react-hooks"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var SVG_REGEX = /\.svg$/i; -var KEY_PREFIX = 'fabricImage'; -function useLoadState(props, imageElement) { - var onLoadingStateChange = props.onLoadingStateChange, onLoad = props.onLoad, onError = props.onError, src = props.src; - var _a = _react.useState((0, _imageTypes.ImageLoadState).notLoaded), loadState = _a[0], setLoadState = _a[1]; - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - // If the src property changes, reset the load state - // (does nothing if the load state is already notLoaded) - setLoadState((0, _imageTypes.ImageLoadState).notLoaded); - }, [ - src - ]); - // eslint-disable-next-line react-hooks/exhaustive-deps -- intended to run every render - _react.useEffect(function() { - if (loadState === (0, _imageTypes.ImageLoadState).notLoaded) { - // testing if naturalWidth and naturalHeight are greater than zero is better than checking - // .complete, because .complete will also be set to true if the image breaks. However, - // for some browsers, SVG images do not have a naturalWidth or naturalHeight, so fall back - // to checking .complete for these images. - var isLoaded = imageElement.current ? src && imageElement.current.naturalWidth > 0 && imageElement.current.naturalHeight > 0 || imageElement.current.complete && SVG_REGEX.test(src) : false; - if (isLoaded) setLoadState((0, _imageTypes.ImageLoadState).loaded); - } - }); - _react.useEffect(function() { - onLoadingStateChange === null || onLoadingStateChange === void 0 || onLoadingStateChange(loadState); - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run when loadState changes - }, [ - loadState - ]); - var onImageLoaded = _react.useCallback(function(ev) { - onLoad === null || onLoad === void 0 || onLoad(ev); - if (src) setLoadState((0, _imageTypes.ImageLoadState).loaded); - }, [ - src, - onLoad - ]); - var onImageError = _react.useCallback(function(ev) { - onError === null || onError === void 0 || onError(ev); - setLoadState((0, _imageTypes.ImageLoadState).error); - }, [ - onError - ]); - return [ - loadState, - onImageLoaded, - onImageError - ]; -} -var ImageBase = _react.forwardRef(function(props, forwardedRef) { - var frameElement = _react.useRef(); - var imageElement = _react.useRef(); - var _a = useLoadState(props, imageElement), loadState = _a[0], onImageLoaded = _a[1], onImageError = _a[2]; - var imageProps = (0, _utilities.getNativeProps)(props, (0, _utilities.imgProperties), [ - 'width', - 'height' - ]); - var src = props.src, alt = props.alt, width = props.width, height = props.height, _b = props.shouldFadeIn, shouldFadeIn = _b === void 0 ? true : _b, shouldStartVisible = props.shouldStartVisible, className = props.className, imageFit = props.imageFit, role = props.role, maximizeFrame = props.maximizeFrame, styles = props.styles, theme = props.theme, loading = props.loading; - var coverStyle = useCoverStyle(props, loadState, imageElement, frameElement); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - width: width, - height: height, - maximizeFrame: maximizeFrame, - shouldFadeIn: shouldFadeIn, - shouldStartVisible: shouldStartVisible, - isLoaded: loadState === (0, _imageTypes.ImageLoadState).loaded || loadState === (0, _imageTypes.ImageLoadState).notLoaded && props.shouldStartVisible, - isLandscape: coverStyle === (0, _imageTypes.ImageCoverStyle).landscape, - isCenter: imageFit === (0, _imageTypes.ImageFit).center, - isCenterContain: imageFit === (0, _imageTypes.ImageFit).centerContain, - isCenterCover: imageFit === (0, _imageTypes.ImageFit).centerCover, - isContain: imageFit === (0, _imageTypes.ImageFit).contain, - isCover: imageFit === (0, _imageTypes.ImageFit).cover, - isNone: imageFit === (0, _imageTypes.ImageFit).none, - isError: loadState === (0, _imageTypes.ImageLoadState).error, - isNotImageFit: imageFit === undefined - }); - // If image dimensions aren't specified, the natural size of the image is used. - return _react.createElement("div", { - className: classNames.root, - style: { - width: width, - height: height - }, - ref: frameElement - }, _react.createElement("img", (0, _tslib.__assign)({}, imageProps, { - onLoad: onImageLoaded, - onError: onImageError, - key: KEY_PREFIX + props.src || '', - className: classNames.image, - ref: (0, _reactHooks.useMergedRefs)(imageElement, forwardedRef), - src: src, - alt: alt, - role: role, - loading: loading - }))); -}); -ImageBase.displayName = 'ImageBase'; -function useCoverStyle(props, loadState, imageElement, frameElement) { - var previousLoadState = _react.useRef(loadState); - var coverStyle = _react.useRef(); - if (coverStyle === undefined || previousLoadState.current === (0, _imageTypes.ImageLoadState).notLoaded && loadState === (0, _imageTypes.ImageLoadState).loaded) coverStyle.current = computeCoverStyle(props, loadState, imageElement, frameElement); - previousLoadState.current = loadState; - return coverStyle.current; -} -function computeCoverStyle(props, loadState, imageElement, frameElement) { - var imageFit = props.imageFit, width = props.width, height = props.height; - // Do not compute cover style if it was already specified in props - if (props.coverStyle !== undefined) return props.coverStyle; - else if (loadState === (0, _imageTypes.ImageLoadState).loaded && (imageFit === (0, _imageTypes.ImageFit).cover || imageFit === (0, _imageTypes.ImageFit).contain || imageFit === (0, _imageTypes.ImageFit).centerContain || imageFit === (0, _imageTypes.ImageFit).centerCover) && imageElement.current && frameElement.current) { - // Determine the desired ratio using the width and height props. - // If those props aren't available, measure measure the frame. - var desiredRatio = void 0; - if (typeof width === 'number' && typeof height === 'number' && imageFit !== (0, _imageTypes.ImageFit).centerContain && imageFit !== (0, _imageTypes.ImageFit).centerCover) desiredRatio = width / height; - else desiredRatio = frameElement.current.clientWidth / frameElement.current.clientHeight; - // Examine the source image to determine its original ratio. - var naturalRatio = imageElement.current.naturalWidth / imageElement.current.naturalHeight; - // Should we crop from the top or the sides? - if (naturalRatio > desiredRatio) return (0, _imageTypes.ImageCoverStyle).landscape; - } - return (0, _imageTypes.ImageCoverStyle).portrait; -} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./Image.types":"fYQRq","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fYQRq":[function(require,module,exports,__globalThis) { -/** - * The possible methods that can be used to fit the image. - * {@docCategory Image} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageFit", ()=>ImageFit); -parcelHelpers.export(exports, "ImageCoverStyle", ()=>ImageCoverStyle); -parcelHelpers.export(exports, "ImageLoadState", ()=>ImageLoadState); -var ImageFit; -(function(ImageFit) { - /** - * The image is not scaled. The image is centered and cropped within the content box. - */ ImageFit[ImageFit["center"] = 0] = "center"; - /** - * The image is scaled to maintain its aspect ratio while being fully contained within the frame. The image will - * be centered horizontally and vertically within the frame. The space in the top and bottom or in the sides of - * the frame will be empty depending on the difference in aspect ratio between the image and the frame. - */ ImageFit[ImageFit["contain"] = 1] = "contain"; - /** - * The image is scaled to maintain its aspect ratio while filling the frame. Portions of the image will be cropped - * from the top and bottom, or the sides, depending on the difference in aspect ratio between the image and the frame. - */ ImageFit[ImageFit["cover"] = 2] = "cover"; - /** - * Neither the image nor the frame are scaled. If their sizes do not match, the image will either be cropped or the - * frame will have empty space. - */ ImageFit[ImageFit["none"] = 3] = "none"; - /** - * The image will be centered horizontally and vertically within the frame and maintains its aspect ratio. It will - * behave as ImageFit.center if the image's natural height or width is less than the Image frame's height or width, - * but if both natural height and width are larger than the frame it will behave as ImageFit.cover. - */ ImageFit[ImageFit["centerCover"] = 4] = "centerCover"; - /** - * The image will be centered horizontally and vertically within the frame and maintains its aspect ratio. It will - * behave as ImageFit.center if the image's natural height and width is less than the Image frame's height and width, - * but if either natural height or width are larger than the frame it will behave as ImageFit.contain. - */ ImageFit[ImageFit["centerContain"] = 5] = "centerContain"; -})(ImageFit || (ImageFit = {})); -var ImageCoverStyle; -(function(ImageCoverStyle) { - /** - * The image will be shown at 100% height of container and the width will be scaled accordingly - */ ImageCoverStyle[ImageCoverStyle["landscape"] = 0] = "landscape"; - /** - * The image will be shown at 100% width of container and the height will be scaled accordingly - */ ImageCoverStyle[ImageCoverStyle["portrait"] = 1] = "portrait"; -})(ImageCoverStyle || (ImageCoverStyle = {})); -var ImageLoadState; -(function(ImageLoadState) { - /** - * The image has not yet been loaded, and there is no error yet. - */ ImageLoadState[ImageLoadState["notLoaded"] = 0] = "notLoaded"; - /** - * The image has been loaded successfully. - */ ImageLoadState[ImageLoadState["loaded"] = 1] = "loaded"; - /** - * An error has been encountered while loading the image. - */ ImageLoadState[ImageLoadState["error"] = 2] = "error"; - /** - * @deprecated Not used. Use `onLoadingStateChange` and re-render the Image with a different src. - */ ImageLoadState[ImageLoadState["errorLoaded"] = 3] = "errorLoaded"; -})(ImageLoadState || (ImageLoadState = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2LHjM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// re-export since this is a hook, which people would reasonably expect to import from react-hooks -parcelHelpers.export(exports, "useIsomorphicLayoutEffect", ()=>(0, _utilities.useIsomorphicLayoutEffect)); -var _version = require("./version"); -var _useAsync = require("./useAsync"); -parcelHelpers.exportAll(_useAsync, exports); -var _useBoolean = require("./useBoolean"); -parcelHelpers.exportAll(_useBoolean, exports); -var _useConst = require("./useConst"); -parcelHelpers.exportAll(_useConst, exports); -var _useConstCallback = require("./useConstCallback"); -parcelHelpers.exportAll(_useConstCallback, exports); -var _useControllableValue = require("./useControllableValue"); -parcelHelpers.exportAll(_useControllableValue, exports); -var _useEventCallback = require("./useEventCallback"); -parcelHelpers.exportAll(_useEventCallback, exports); -var _useForceUpdate = require("./useForceUpdate"); -parcelHelpers.exportAll(_useForceUpdate, exports); -var _useId = require("./useId"); -parcelHelpers.exportAll(_useId, exports); -var _useMergedRefs = require("./useMergedRefs"); -parcelHelpers.exportAll(_useMergedRefs, exports); -var _useMount = require("./useMount"); -parcelHelpers.exportAll(_useMount, exports); -var _useMountSync = require("./useMountSync"); -parcelHelpers.exportAll(_useMountSync, exports); -var _useOnEvent = require("./useOnEvent"); -parcelHelpers.exportAll(_useOnEvent, exports); -var _usePrevious = require("./usePrevious"); -parcelHelpers.exportAll(_usePrevious, exports); -var _useRefEffect = require("./useRefEffect"); -parcelHelpers.exportAll(_useRefEffect, exports); -var _useSetInterval = require("./useSetInterval"); -parcelHelpers.exportAll(_useSetInterval, exports); -var _useSetTimeout = require("./useSetTimeout"); -parcelHelpers.exportAll(_useSetTimeout, exports); -var _useTarget = require("./useTarget"); -parcelHelpers.exportAll(_useTarget, exports); -var _useUnmount = require("./useUnmount"); -parcelHelpers.exportAll(_useUnmount, exports); -var _useWarnings = require("./useWarnings"); -parcelHelpers.exportAll(_useWarnings, exports); -var _utilities = require("@fluentui/utilities"); - -},{"./version":"dfLIU","./useAsync":"59zc5","./useBoolean":"z2bLn","./useConst":"flUwA","./useConstCallback":"dYnED","./useControllableValue":"jzIvg","./useEventCallback":"eQrXT","./useForceUpdate":"68Qoo","./useId":"hSNPu","./useMergedRefs":"h89Si","./useMount":"cIQtY","./useMountSync":"2Zqci","./useOnEvent":"hr82L","./usePrevious":"5S4Wu","./useRefEffect":"4xx4j","./useSetInterval":"icdCd","./useSetTimeout":"fsPaE","./useTarget":"7N9lH","./useUnmount":"jioLf","./useWarnings":"6VfEj","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dfLIU":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react-hooks', '8.8.16'); - -},{"@fluentui/set-version":"iqYXf"}],"59zc5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to provide an Async instance that is automatically cleaned up on dismount. - */ parcelHelpers.export(exports, "useAsync", ()=>useAsync); -var _utilities = require("@fluentui/utilities"); -var _react = require("react"); -function useAsync() { - var asyncRef = _react.useRef(); - if (!asyncRef.current) asyncRef.current = new (0, _utilities.Async)(); - _react.useEffect(function() { - return function() { - var _a; - (_a = asyncRef.current) === null || _a === void 0 || _a.dispose(); - asyncRef.current = undefined; - }; - }, []); - return asyncRef.current; -} - -},{"@fluentui/utilities":"55bj3","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"z2bLn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to store a value and generate callbacks for setting the value to true or false. - * The identity of the callbacks will always stay the same. - * - * @param initialState - Initial value - * @returns Array with the current value and an object containing the updater callbacks. - */ parcelHelpers.export(exports, "useBoolean", ()=>useBoolean); -var _react = require("react"); -var _useConst = require("./useConst"); -function useBoolean(initialState) { - var _a = _react.useState(initialState), value = _a[0], setValue = _a[1]; - var setTrue = (0, _useConst.useConst)(function() { - return function() { - setValue(true); - }; - }); - var setFalse = (0, _useConst.useConst)(function() { - return function() { - setValue(false); - }; - }); - var toggle = (0, _useConst.useConst)(function() { - return function() { - setValue(function(currentValue) { - return !currentValue; - }); - }; - }); - return [ - value, - { - setTrue: setTrue, - setFalse: setFalse, - toggle: toggle - } - ]; -} - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flUwA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to initialize and return a constant value. Unlike `React.useMemo`, this is guaranteed to - * always return the same value (and if the initializer is a function, only call it once). - * This is similar to setting a private member in a class constructor. - * - * If the value should ever change based on dependencies, use `React.useMemo` instead. - * - * @param initialValue - Initial value, or function to get the initial value. Similar to `useState`, - * only the value/function passed in the first time this is called is respected. - * @returns The value. The identity of this value will always be the same. - */ parcelHelpers.export(exports, "useConst", ()=>useConst); -var _react = require("react"); -function useConst(initialValue) { - // Use useRef to store the value because it's the least expensive built-in hook that works here - // (we could also use `const [value] = React.useState(initialValue)` but that's more expensive - // internally due to reducer handling which we don't need) - var ref = _react.useRef(); - if (ref.current === undefined) // Box the value in an object so we can tell if it's initialized even if the initializer - // returns/is undefined - ref.current = { - value: typeof initialValue === 'function' ? initialValue() : initialValue - }; - return ref.current.value; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dYnED":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * @deprecated Deprecated due to potential for misuse. Generally, use `React.useCallback` instead. - * If you need a callback reference that never changes, consider `useEventCallback`. - * - * This hook was intended for creating callbacks which have no dependencies, and therefore never - * need to change. It works fine if everyone using it is extremely mindful of how closures work, - * but that's not a safe assumption--so in practice, usage of this hook tends to result in bugs - * like unintentionally capturing the first value of a prop and not respecting updates (when - * updates should be respected). - */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -parcelHelpers.export(exports, "useConstCallback", ()=>useConstCallback); -var _react = require("react"); -function useConstCallback(callback) { - var ref = _react.useRef(); - if (!ref.current) ref.current = callback; - return ref.current; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jzIvg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useControllableValue", ()=>useControllableValue); -var _react = require("react"); -var _useConst = require("./useConst"); -function useControllableValue(controlledValue, defaultUncontrolledValue, onChange) { - var _a = _react.useState(defaultUncontrolledValue), value = _a[0], setValue = _a[1]; - var isControlled = (0, _useConst.useConst)(controlledValue !== undefined); - var currentValue = isControlled ? controlledValue : value; - // Duplicate the current value and onChange in refs so they're accessible from - // setValueOrCallOnChange without creating a new callback every time - var valueRef = _react.useRef(currentValue); - var onChangeRef = _react.useRef(onChange); - _react.useEffect(function() { - valueRef.current = currentValue; - onChangeRef.current = onChange; - }); - // To match the behavior of the setter returned by React.useState, this callback's identity - // should never change. This means it MUST NOT directly reference variables that can change. - var setValueOrCallOnChange = (0, _useConst.useConst)(function() { - return function(update, ev) { - // Assuming here that TValue is not a function, because a controllable value will typically - // be something a user can enter as input - var newValue = typeof update === 'function' ? update(valueRef.current) : update; - if (onChangeRef.current) onChangeRef.current(ev, newValue); - if (!isControlled) setValue(newValue); - }; - }); - return [ - currentValue, - setValueOrCallOnChange - ]; -} - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQrXT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Modified `useCallback` that returns the same function reference every time, but internally calls - * the most-recently passed callback implementation. Can be useful in situations such as: - * - Event handler dependencies change too frequently, such as user props which might change on - * every render, or volatile values such as useState/useDispatch - * - Callback must be referenced in a captured context (such as a window event handler or unmount - * handler that's registered once) but needs access to the latest props - * - * In general, prefer `useCallback` unless you've encountered one of the problems above. - * - * https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback - * - * @param fn - The callback function that will be used - * @returns A function which is referentially stable but internally calls the most recently passed callback - */ parcelHelpers.export(exports, "useEventCallback", ()=>useEventCallback); -var _react = require("react"); -var _useConst = require("./useConst"); -var _utilities = require("@fluentui/utilities"); -function useEventCallback(fn) { - var callbackRef = _react.useRef(function() { - throw new Error('Cannot call an event handler while rendering'); - }); - (0, _utilities.useIsomorphicLayoutEffect)(function() { - callbackRef.current = fn; - }, [ - fn - ]); - // useConst rather than useCallback to ensure the reference is always stable - // (useCallback's deps list is an optimization, not a guarantee) - return (0, _useConst.useConst)(function() { - return function() { - var args = []; - for(var _i = 0; _i < arguments.length; _i++)args[_i] = arguments[_i]; - var callback = callbackRef.current; - return callback.apply(void 0, args); - }; - }); -} - -},{"react":"jGrId","./useConst":"flUwA","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"68Qoo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to force update a function component by updating a dummy state. - */ parcelHelpers.export(exports, "useForceUpdate", ()=>useForceUpdate); -var _react = require("react"); -var _useConst = require("./useConst"); -function useForceUpdate() { - var _a = _react.useState(0), setValue = _a[1]; - var forceUpdate = (0, _useConst.useConst)(function() { - return function() { - return setValue(function(value) { - return ++value; - }); - }; - }); - return forceUpdate; -} - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hSNPu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to generate a unique ID in the global scope (spanning across duplicate copies of the same library). - * - * @param prefix - Optional prefix for the ID - * @param providedId - Optional id provided by a parent component. Defaults to the provided value if present, - * without conditioning the hook call - * @returns The ID - */ parcelHelpers.export(exports, "useId", ()=>useId); -var _react = require("react"); -var _utilities = require("@fluentui/utilities"); -function useId(prefix, providedId) { - // getId should only be called once since it updates the global constant for the next ID value. - // (While an extra update isn't likely to cause problems in practice, it's better to avoid it.) - var ref = _react.useRef(providedId); - if (!ref.current) ref.current = (0, _utilities.getId)(prefix); - return ref.current; -} - -},{"react":"jGrId","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h89Si":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * React hook to merge multiple React refs (either MutableRefObjects or ref callbacks) into a single ref callback that - * updates all provided refs - * @param refs - Refs to collectively update with one ref value. - * @returns A function with an attached "current" prop, so that it can be treated like a RefObject. - */ parcelHelpers.export(exports, "useMergedRefs", ()=>useMergedRefs); -var _tslib = require("tslib"); -var _react = require("react"); -function useMergedRefs() { - var refs = []; - for(var _i = 0; _i < arguments.length; _i++)refs[_i] = arguments[_i]; - var mergedCallback = _react.useCallback(function(value) { - // Update the "current" prop hanging on the function. - mergedCallback.current = value; - for(var _i = 0, refs_1 = refs; _i < refs_1.length; _i++){ - var ref = refs_1[_i]; - if (typeof ref === 'function') ref(value); - else if (ref) // work around the immutability of the React.Ref type - ref.current = value; - } - }, (0, _tslib.__spreadArray)([], refs, true)); - return mergedCallback; -} - -},{"tslib":"9gizs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cIQtY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMount", ()=>useMount); -var _react = require("react"); -var useMount = function(callback) { - var mountRef = _react.useRef(callback); - mountRef.current = callback; - _react.useEffect(function() { - var _a; - (_a = mountRef.current) === null || _a === void 0 || _a.call(mountRef); - }, []); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Zqci":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useMountSync", ()=>useMountSync); -var _react = require("react"); -var useMountSync = function(callback) { - var mountRef = _react.useRef(callback); - mountRef.current = callback; - // eslint-disable-next-line no-restricted-properties - _react.useLayoutEffect(function() { - var _a; - (_a = mountRef.current) === null || _a === void 0 || _a.call(mountRef); - }, []); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hr82L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to attach an event handler on mount and handle cleanup. - * @param element - Element (or ref to an element) to attach the event handler to - * @param eventName - The event to attach a handler for - * @param callback - The handler for the event - * @param useCapture - Whether or not to attach the handler for the capture phase - */ parcelHelpers.export(exports, "useOnEvent", ()=>useOnEvent); -var _utilities = require("@fluentui/utilities"); -var _react = require("react"); -function useOnEvent(element, eventName, callback, useCapture) { - // Use a ref for the callback to prevent repeatedly attaching/unattaching callbacks that are unstable across renders - var callbackRef = _react.useRef(callback); - callbackRef.current = callback; - _react.useEffect(function() { - var actualElement = element && 'current' in element ? element.current : element; - if (!actualElement || !actualElement.addEventListener) return; - var dispose = (0, _utilities.on)(actualElement, eventName, function(ev) { - return callbackRef.current(ev); - }, useCapture); - return dispose; - }, [ - element, - eventName, - useCapture - ]); -} - -},{"@fluentui/utilities":"55bj3","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5S4Wu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook keeping track of a given value from a previous execution of the component the Hook is used in. - * - * See [React Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state) - */ parcelHelpers.export(exports, "usePrevious", ()=>usePrevious); -var _react = require("react"); -function usePrevious(value) { - var ref = (0, _react.useRef)(); - (0, _react.useEffect)(function() { - ref.current = value; - }); - return ref.current; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4xx4j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Creates a ref, and calls a callback whenever the ref changes to a non-null value. The callback can optionally return - * a cleanup function that'll be called before the value changes, and when the ref is unmounted. - * - * This can be used to work around a limitation that useEffect cannot depend on `ref.current` (see - * https://github.com/facebook/react/issues/14387#issuecomment-503616820). - * - * Usage example: - * ```ts - * const myRef = useRefEffect<HTMLElement>(element => { - * ... - * return () => { ... cleanup ... }; - * }); - * ``` - * ```jsx - * <div ref={myRef} /> - * ``` - * - * @param callback - Called whenever the ref's value changes to non-null. Can optionally return a cleanup function. - * @param initial - (Optional) The initial value for the ref. - * - * @returns A function that should be called to set the ref's value. The object also has a `.current` member that can be - * used to access the ref's value (like a normal RefObject). It can be hooked up to an element's `ref` property. - */ parcelHelpers.export(exports, "useRefEffect", ()=>useRefEffect); -var _react = require("react"); -function useRefEffect(callback, initial) { - if (initial === void 0) initial = null; - var createRefCallback = function() { - var refCallback = function(value) { - if (data.ref.current !== value) { - if (data.cleanup) { - data.cleanup(); - data.cleanup = undefined; - } - data.ref.current = value; - if (value !== null) data.cleanup = data.callback(value); - } - }; - refCallback.current = initial; - return refCallback; - }; - var data = _react.useRef({ - ref: createRefCallback(), - callback: callback - }).current; - data.callback = callback; - return data.ref; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"icdCd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useSetInterval", ()=>useSetInterval); -var _react = require("react"); -var _useConst = require("./useConst"); -var useSetInterval = function() { - var intervalIds = (0, _useConst.useConst)({}); - _react.useEffect(function() { - return function() { - for(var _i = 0, _a = Object.keys(intervalIds); _i < _a.length; _i++){ - var id = _a[_i]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - clearInterval(id); - } + var cache2 = new _weakMap(); + function memoizedGetValue(input) { + if (!input || typeof input !== "function" && typeof input !== "object") { + return getValue2(input); + } + if (cache2.has(input)) { + return cache2.get(input); + } + var value2 = getValue2(input); + cache2.set(input, value2); + return value2; + } + return memoizedGetValue; + } + function _normalizeArg(val) { + if (!val) { + return _emptyObject; + } else if (typeof val === "object" || typeof val === "function") { + return val; + } else if (!_dictionary[val]) { + _dictionary[val] = { val }; + } + return _dictionary[val]; + } + function _createNode() { + return { + map: _weakMap ? new _weakMap() : null + }; + } + function createComposedComponent(outer) { + var Outer = outer; + var outerMemoizer = createMemoizer(function(inner) { + if (outer === inner) { + throw new Error("Attempted to compose a component with itself."); + } + var Inner = inner; + var innerMemoizer = createMemoizer(function(defaultRender) { + var InnerWithDefaultRender = function(innerProps) { + return React__namespace.createElement(Inner, __assign$1({}, innerProps, { defaultRender })); }; - }, // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that - [ - intervalIds - ]); - return (0, _useConst.useConst)({ - setInterval: function(func, duration) { - var id = setInterval(func, duration); - intervalIds[id] = 1; - return id; - }, - clearInterval: function(id) { - delete intervalIds[id]; - clearInterval(id); - } + return InnerWithDefaultRender; + }); + var OuterWithDefaultRender = function(outerProps) { + var defaultRender = outerProps.defaultRender; + return React__namespace.createElement(Outer, __assign$1({}, outerProps, { defaultRender: defaultRender ? innerMemoizer(defaultRender) : Inner })); + }; + return OuterWithDefaultRender; }); -}; - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fsPaE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useSetTimeout", ()=>useSetTimeout); -var _react = require("react"); -var _useConst = require("./useConst"); -var useSetTimeout = function() { - var timeoutIds = (0, _useConst.useConst)({}); - // Cleanup function. - _react.useEffect(function() { - return function() { - for(var _i = 0, _a = Object.keys(timeoutIds); _i < _a.length; _i++){ - var id = _a[_i]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - clearTimeout(id); + return outerMemoizer; + } + var componentAsMemoizer = createMemoizer(createComposedComponent); + function composeComponentAs(outer, inner) { + return componentAsMemoizer(outer)(inner); + } + function isControlled(props, valueProp) { + return props[valueProp] !== void 0 && props[valueProp] !== null; + } + function css() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var classes = []; + for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) { + var arg = args_1[_a2]; + if (arg) { + if (typeof arg === "string") { + classes.push(arg); + } else if (arg.hasOwnProperty("toString") && typeof arg.toString === "function") { + classes.push(arg.toString()); + } else { + for (var key2 in arg) { + if (arg[key2]) { + classes.push(key2); } - }; - }, // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that - [ - timeoutIds - ]); - // Return wrapper which will auto cleanup. - return (0, _useConst.useConst)({ - setTimeout: function(func, duration) { - var id = setTimeout(func, duration); - timeoutIds[id] = 1; - return id; - }, - clearTimeout: function(id) { - delete timeoutIds[id]; - clearTimeout(id); + } } - }); -}; - -},{"react":"jGrId","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7N9lH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook to calculate and cache the target element specified by the given target attribute, - * as well as the target element's (or host element's) parent window - * @param target- Target selector passed to the component as a property, describing the element that - * the callout should target - * @param hostElement- The callout's host element, used for determining the parent window. - */ parcelHelpers.export(exports, "useTarget", ()=>useTarget); -var _utilities = require("@fluentui/utilities"); -var _react = require("react"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -function useTarget(target, hostElement) { - var _a, _b, _c; - var previousTargetProp = _react.useRef(); - var targetRef = _react.useRef(null); - /** - * Stores an instance of Window, used to check - * for server side rendering and if focus was lost. - */ var targetWindow = (0, _reactWindowProvider.useWindow)(); - // If the target element changed, find the new one. If we are tracking - // target with class name, always find element because we do not know if - // fabric has rendered a new element and disposed the old element. - if (!target || target !== previousTargetProp.current || typeof target === 'string') { - var currentElement = hostElement === null || hostElement === void 0 ? void 0 : hostElement.current; - if (target) { - if (typeof target === 'string') { - // If element is part of shadow dom, then querySelector on shadow root, else query on document - if ((_a = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _a === void 0 ? void 0 : _a.host) targetRef.current = (_c = (_b = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _b === void 0 ? void 0 : _b.querySelector(target)) !== null && _c !== void 0 ? _c : null; - else { - var currentDoc = (0, _utilities.getDocument)(currentElement); - targetRef.current = currentDoc ? currentDoc.querySelector(target) : null; - } - } else if ('stopPropagation' in target) targetRef.current = target; - else if ('getBoundingClientRect' in target) targetRef.current = target; - else if ('current' in target) targetRef.current = target.current; - else targetRef.current = target; + } + } + return classes.join(" "); + } + var CustomizationsGlobalKey = "customizations"; + var NO_CUSTOMIZATIONS = { settings: {}, scopedSettings: {}, inCustomizerContext: false }; + var _allSettings = GlobalSettings.getValue(CustomizationsGlobalKey, { + settings: {}, + scopedSettings: {}, + inCustomizerContext: false + }); + var _events = []; + var Customizations = ( + /** @class */ + (function() { + function Customizations2() { + } + Customizations2.reset = function() { + _allSettings.settings = {}; + _allSettings.scopedSettings = {}; + }; + Customizations2.applySettings = function(settings) { + _allSettings.settings = __assign$1(__assign$1({}, _allSettings.settings), settings); + Customizations2._raiseChange(); + }; + Customizations2.applyScopedSettings = function(scopeName, settings) { + _allSettings.scopedSettings[scopeName] = __assign$1(__assign$1({}, _allSettings.scopedSettings[scopeName]), settings); + Customizations2._raiseChange(); + }; + Customizations2.getSettings = function(properties, scopeName, localSettings) { + if (localSettings === void 0) { + localSettings = NO_CUSTOMIZATIONS; } - previousTargetProp.current = target; + var settings = {}; + var localScopedSettings = scopeName && localSettings.scopedSettings[scopeName] || {}; + var globalScopedSettings = scopeName && _allSettings.scopedSettings[scopeName] || {}; + for (var _i = 0, properties_1 = properties; _i < properties_1.length; _i++) { + var property2 = properties_1[_i]; + settings[property2] = localScopedSettings[property2] || localSettings.settings[property2] || globalScopedSettings[property2] || _allSettings.settings[property2]; + } + return settings; + }; + Customizations2.applyBatchedUpdates = function(code, suppressUpdate) { + Customizations2._suppressUpdates = true; + try { + code(); + } catch (_a2) { + } + Customizations2._suppressUpdates = false; + if (!suppressUpdate) { + Customizations2._raiseChange(); + } + }; + Customizations2.observe = function(onChange) { + _events.push(onChange); + }; + Customizations2.unobserve = function(onChange) { + _events = _events.filter(function(cb) { + return cb !== onChange; + }); + }; + Customizations2._raiseChange = function() { + if (!Customizations2._suppressUpdates) { + _events.forEach(function(cb) { + return cb(); + }); + } + }; + return Customizations2; + })() + ); + var CustomizerContext = React__namespace.createContext({ + customizations: { + inCustomizerContext: false, + settings: {}, + scopedSettings: {} } - return [ - targetRef, - targetWindow - ]; -} - -},{"@fluentui/utilities":"55bj3","react":"jGrId","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jioLf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useUnmount", ()=>useUnmount); -var _react = require("react"); -var useUnmount = function(callback) { - var unmountRef = _react.useRef(callback); - unmountRef.current = callback; - _react.useEffect(function() { - return function() { - var _a; - (_a = unmountRef.current) === null || _a === void 0 || _a.call(unmountRef); + }); + function mergeSettings(oldSettings, newSettings) { + if (oldSettings === void 0) { + oldSettings = {}; + } + var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _settingsMergeWith(newSettings); + return mergeSettingsWith(oldSettings); + } + function mergeScopedSettings(oldSettings, newSettings) { + if (oldSettings === void 0) { + oldSettings = {}; + } + var mergeSettingsWith = _isSettingsFunction(newSettings) ? newSettings : _scopedSettingsMergeWith(newSettings); + return mergeSettingsWith(oldSettings); + } + function _isSettingsFunction(settings) { + return typeof settings === "function"; + } + function _settingsMergeWith(newSettings) { + return function(settings) { + return newSettings ? __assign$1(__assign$1({}, settings), newSettings) : settings; + }; + } + function _scopedSettingsMergeWith(scopedSettingsFromProps) { + if (scopedSettingsFromProps === void 0) { + scopedSettingsFromProps = {}; + } + return function(oldScopedSettings) { + var newScopedSettings = __assign$1({}, oldScopedSettings); + for (var scopeName in scopedSettingsFromProps) { + if (scopedSettingsFromProps.hasOwnProperty(scopeName)) { + newScopedSettings[scopeName] = __assign$1(__assign$1({}, oldScopedSettings[scopeName]), scopedSettingsFromProps[scopeName]); + } + } + return newScopedSettings; + }; + } + function mergeCustomizations(props, parentContext) { + var _a2 = (parentContext || {}).customizations, customizations = _a2 === void 0 ? { settings: {}, scopedSettings: {} } : _a2; + return { + customizations: { + settings: mergeSettings(customizations.settings, props.settings), + scopedSettings: mergeScopedSettings(customizations.scopedSettings, props.scopedSettings), + inCustomizerContext: true + } + }; + } + var Customizer = ( + /** @class */ + (function(_super) { + __extends(Customizer2, _super); + function Customizer2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._onCustomizationChange = function() { + return _this.forceUpdate(); }; - }, []); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6VfEj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Only in development mode, display console warnings when certain conditions are met. - * Note that all warnings except `controlledUsage` will only be shown on first render - * (new `controlledUsage` warnings may be shown later due to prop changes). - */ parcelHelpers.export(exports, "useWarnings", ()=>useWarnings); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("@fluentui/utilities"); -var _usePrevious = require("./usePrevious"); -var _useConst = require("./useConst"); -var warningId = 0; -function useWarnings(options) { - var name_1, props, _a, other, conditionallyRequired, deprecations, mutuallyExclusive, controlledUsage, hasWarnedRef, componentId, oldProps, _i, other_1, warning, _b, conditionallyRequired_1, req; -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/utilities":"55bj3","./usePrevious":"5S4Wu","./useConst":"flUwA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fI8tg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var GlobalClassNames = { - root: 'ms-Image', - rootMaximizeFrame: 'ms-Image--maximizeFrame', - image: 'ms-Image-image', - imageCenter: 'ms-Image-image--center', - imageContain: 'ms-Image-image--contain', - imageCover: 'ms-Image-image--cover', - imageCenterContain: 'ms-Image-image--centerContain', - imageCenterCover: 'ms-Image-image--centerCover', - imageNone: 'ms-Image-image--none', - imageLandscape: 'ms-Image-image--landscape', - imagePortrait: 'ms-Image-image--portrait' -}; -var getStyles = function(props) { - var className = props.className, width = props.width, height = props.height, maximizeFrame = props.maximizeFrame, isLoaded = props.isLoaded, shouldFadeIn = props.shouldFadeIn, shouldStartVisible = props.shouldStartVisible, isLandscape = props.isLandscape, isCenter = props.isCenter, isContain = props.isContain, isCover = props.isCover, isCenterContain = props.isCenterContain, isCenterCover = props.isCenterCover, isNone = props.isNone, isError = props.isError, isNotImageFit = props.isNotImageFit, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var ImageFitStyles = { - position: 'absolute', - left: '50% /* @noflip */', - top: '50%', - transform: 'translate(-50%,-50%)' - }; - // Cut the mustard using msMaxTouchPoints to detect IE11 which does not support CSS object-fit - var window = (0, _utilities.getWindow)(); - var supportsObjectFit = window !== undefined && // eslint-disable-next-line @fluentui/max-len - // cast needed as vendor prefixed `msMaxTouchPoints` api is no longer part of TS lib declaration - introduced with TS 4.4 - window.navigator.msMaxTouchPoints === undefined; - var fallbackObjectFitStyles = isContain && isLandscape || isCover && !isLandscape ? { - width: '100%', - height: 'auto' - } : { - width: 'auto', - height: '100%' + return _this; + } + Customizer2.prototype.componentDidMount = function() { + Customizations.observe(this._onCustomizationChange); + }; + Customizer2.prototype.componentWillUnmount = function() { + Customizations.unobserve(this._onCustomizationChange); + }; + Customizer2.prototype.render = function() { + var _this = this; + var contextTransform = this.props.contextTransform; + return React__namespace.createElement(CustomizerContext.Consumer, null, function(parentContext) { + var newContext = mergeCustomizations(_this.props, parentContext); + if (contextTransform) { + newContext = contextTransform(newContext); + } + return React__namespace.createElement(CustomizerContext.Provider, { value: newContext }, _this.props.children); + }); + }; + return Customizer2; + })(React__namespace.Component) + ); + function hoistStatics(source2, dest) { + for (var name_1 in source2) { + if (source2.hasOwnProperty(name_1)) { + dest[name_1] = source2[name_1]; + } + } + return dest; + } + var noop$5 = function() { + return false; + }; + var noopShadow = function() { + return DEFAULT_SHADOW_CONFIG; + }; + var noopRootStylesheets = function() { + return /* @__PURE__ */ new Map(); + }; + var noopUndefined = function() { + return void 0; + }; + var getNewContext = function() { + return { + stylesheets: /* @__PURE__ */ new Map(), + useAdoptedStylesheetEx: noop$5, + useAdoptedStylesheet: noop$5, + useShadowConfig: noopShadow, + useMergeStylesShadowRootContext: noopUndefined, + useHasMergeStylesShadowRootContext: noop$5, + useMergeStylesRootStylesheets: noopRootStylesheets, + useWindow: noopUndefined, + useStyled: noopUndefined }; + }; + var MergeStylesDefaultContext = React__namespace.createContext(getNewContext()); + var useMergeStylesHooks = function() { + var ctx = React__namespace.useContext(MergeStylesDefaultContext); return { - root: [ - classNames.root, - theme.fonts.medium, - { - overflow: 'hidden' - }, - maximizeFrame && [ - classNames.rootMaximizeFrame, - { - height: '100%', - width: '100%' - } - ], - isLoaded && shouldFadeIn && !shouldStartVisible && (0, _styling.AnimationClassNames).fadeIn400, - (isCenter || isContain || isCover || isCenterContain || isCenterCover) && { - position: 'relative' - }, - className - ], - image: [ - classNames.image, - { - display: 'block', - opacity: 0 - }, - isLoaded && [ - 'is-loaded', - { - opacity: 1 - } - ], - isCenter && [ - classNames.imageCenter, - ImageFitStyles - ], - isContain && [ - classNames.imageContain, - supportsObjectFit && { - width: '100%', - height: '100%', - objectFit: 'contain' - }, - !supportsObjectFit && fallbackObjectFitStyles, - !supportsObjectFit && ImageFitStyles - ], - isCover && [ - classNames.imageCover, - supportsObjectFit && { - width: '100%', - height: '100%', - objectFit: 'cover' - }, - !supportsObjectFit && fallbackObjectFitStyles, - !supportsObjectFit && ImageFitStyles - ], - isCenterContain && [ - classNames.imageCenterContain, - isLandscape && { - maxWidth: '100%' - }, - !isLandscape && { - maxHeight: '100%' - }, - ImageFitStyles - ], - isCenterCover && [ - classNames.imageCenterCover, - isLandscape && { - maxHeight: '100%' - }, - !isLandscape && { - maxWidth: '100%' - }, - ImageFitStyles - ], - isNone && [ - classNames.imageNone, - { - width: 'auto', - height: 'auto' - } - ], - isNotImageFit && [ - !!width && !height && { - height: 'auto', - width: '100%' - }, - !width && !!height && { - height: '100%', - width: 'auto' - }, - !!width && !!height && { - height: '100%', - width: '100%' - } - ], - isLandscape && classNames.imageLandscape, - !isLandscape && classNames.imagePortrait, - !isLoaded && 'is-notLoaded', - shouldFadeIn && 'is-fadeIn', - isError && 'is-error' - ] + useAdoptedStylesheet: ctx.useAdoptedStylesheet, + useAdoptedStylesheetEx: ctx.useAdoptedStylesheetEx, + useShadowConfig: ctx.useShadowConfig, + useMergeStylesShadowRootContext: ctx.useMergeStylesShadowRootContext, + useHasMergeStylesShadowRootContext: ctx.useHasMergeStylesShadowRootContext, + useMergeStylesRootStylesheets: ctx.useMergeStylesRootStylesheets, + useWindow: ctx.useWindow, + useStyled: ctx.useStyled }; -}; - -},{"../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hTimn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>(0, _styleUtilities.AnimationClassNames)); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _styleUtilities.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _styleUtilities.AnimationVariables)); -parcelHelpers.export(exports, "ColorClassNames", ()=>(0, _styleUtilities.ColorClassNames)); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _styleUtilities.DefaultEffects)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _styleUtilities.DefaultFontStyles)); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _styleUtilities.DefaultPalette)); -parcelHelpers.export(exports, "EdgeChromiumHighContrastSelector", ()=>(0, _styleUtilities.EdgeChromiumHighContrastSelector)); -parcelHelpers.export(exports, "FontClassNames", ()=>(0, _styleUtilities.FontClassNames)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _styleUtilities.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _styleUtilities.FontWeights)); -parcelHelpers.export(exports, "HighContrastSelector", ()=>(0, _styleUtilities.HighContrastSelector)); -parcelHelpers.export(exports, "HighContrastSelectorBlack", ()=>(0, _styleUtilities.HighContrastSelectorBlack)); -parcelHelpers.export(exports, "HighContrastSelectorWhite", ()=>(0, _styleUtilities.HighContrastSelectorWhite)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _styleUtilities.IconFontSizes)); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _styleUtilities.InjectionMode)); -parcelHelpers.export(exports, "PulsingBeaconAnimationStyles", ()=>(0, _styleUtilities.PulsingBeaconAnimationStyles)); -parcelHelpers.export(exports, "ScreenWidthMaxLarge", ()=>(0, _styleUtilities.ScreenWidthMaxLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxMedium", ()=>(0, _styleUtilities.ScreenWidthMaxMedium)); -parcelHelpers.export(exports, "ScreenWidthMaxSmall", ()=>(0, _styleUtilities.ScreenWidthMaxSmall)); -parcelHelpers.export(exports, "ScreenWidthMaxXLarge", ()=>(0, _styleUtilities.ScreenWidthMaxXLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxXXLarge", ()=>(0, _styleUtilities.ScreenWidthMaxXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinLarge", ()=>(0, _styleUtilities.ScreenWidthMinLarge)); -parcelHelpers.export(exports, "ScreenWidthMinMedium", ()=>(0, _styleUtilities.ScreenWidthMinMedium)); -parcelHelpers.export(exports, "ScreenWidthMinSmall", ()=>(0, _styleUtilities.ScreenWidthMinSmall)); -parcelHelpers.export(exports, "ScreenWidthMinUhfMobile", ()=>(0, _styleUtilities.ScreenWidthMinUhfMobile)); -parcelHelpers.export(exports, "ScreenWidthMinXLarge", ()=>(0, _styleUtilities.ScreenWidthMinXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXLarge", ()=>(0, _styleUtilities.ScreenWidthMinXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXXLarge", ()=>(0, _styleUtilities.ScreenWidthMinXXXLarge)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _styleUtilities.Stylesheet)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>(0, _styleUtilities.ThemeSettingName)); -parcelHelpers.export(exports, "ZIndexes", ()=>(0, _styleUtilities.ZIndexes)); -parcelHelpers.export(exports, "buildClassMap", ()=>(0, _styleUtilities.buildClassMap)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _styleUtilities.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _styleUtilities.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _styleUtilities.createFontStyles)); -parcelHelpers.export(exports, "focusClear", ()=>(0, _styleUtilities.focusClear)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _styleUtilities.fontFace)); -parcelHelpers.export(exports, "getEdgeChromiumNoHighContrastAdjustSelector", ()=>(0, _styleUtilities.getEdgeChromiumNoHighContrastAdjustSelector)); -parcelHelpers.export(exports, "getFadedOverflowStyle", ()=>(0, _styleUtilities.getFadedOverflowStyle)); -parcelHelpers.export(exports, "getFocusOutlineStyle", ()=>(0, _styleUtilities.getFocusOutlineStyle)); -parcelHelpers.export(exports, "getFocusStyle", ()=>(0, _styleUtilities.getFocusStyle)); -parcelHelpers.export(exports, "getGlobalClassNames", ()=>(0, _styleUtilities.getGlobalClassNames)); -parcelHelpers.export(exports, "getHighContrastNoAdjustStyle", ()=>(0, _styleUtilities.getHighContrastNoAdjustStyle)); -parcelHelpers.export(exports, "getIcon", ()=>(0, _styleUtilities.getIcon)); -parcelHelpers.export(exports, "getIconClassName", ()=>(0, _styleUtilities.getIconClassName)); -parcelHelpers.export(exports, "getInputFocusStyle", ()=>(0, _styleUtilities.getInputFocusStyle)); -parcelHelpers.export(exports, "getPlaceholderStyles", ()=>(0, _styleUtilities.getPlaceholderStyles)); -parcelHelpers.export(exports, "getScreenSelector", ()=>(0, _styleUtilities.getScreenSelector)); -parcelHelpers.export(exports, "getTheme", ()=>(0, _styleUtilities.getTheme)); -parcelHelpers.export(exports, "getThemedContext", ()=>(0, _styleUtilities.getThemedContext)); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>(0, _styleUtilities.hiddenContentStyle)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _styleUtilities.keyframes)); -parcelHelpers.export(exports, "loadTheme", ()=>(0, _styleUtilities.loadTheme)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _styleUtilities.mergeStyleSets)); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _styleUtilities.mergeStyles)); -parcelHelpers.export(exports, "noWrap", ()=>(0, _styleUtilities.noWrap)); -parcelHelpers.export(exports, "normalize", ()=>(0, _styleUtilities.normalize)); -parcelHelpers.export(exports, "registerIconAlias", ()=>(0, _styleUtilities.registerIconAlias)); -parcelHelpers.export(exports, "registerIcons", ()=>(0, _styleUtilities.registerIcons)); -parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>(0, _styleUtilities.registerOnThemeChangeCallback)); -parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>(0, _styleUtilities.removeOnThemeChangeCallback)); -parcelHelpers.export(exports, "setIconOptions", ()=>(0, _styleUtilities.setIconOptions)); -parcelHelpers.export(exports, "unregisterIcons", ()=>(0, _styleUtilities.unregisterIcons)); -parcelHelpers.export(exports, "createTheme", ()=>(0, _theme.createTheme)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _theme.registerDefaultFontFaces)); -var _version = require("./version"); -var _styleUtilities = require("@fluentui/style-utilities"); -var _theme = require("@fluentui/theme"); - -},{"./version":"6kzFC","@fluentui/style-utilities":"bJvmh","@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bJvmh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>(0, _index.AnimationClassNames)); -parcelHelpers.export(exports, "FontClassNames", ()=>(0, _index.FontClassNames)); -parcelHelpers.export(exports, "ColorClassNames", ()=>(0, _index.ColorClassNames)); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _index1.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _index1.AnimationVariables)); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _index1.DefaultPalette)); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _index1.DefaultEffects)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _index1.DefaultFontStyles)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _index1.registerDefaultFontFaces)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _index1.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _index1.FontWeights)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _index1.IconFontSizes)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _index1.createFontStyles)); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>(0, _index1.hiddenContentStyle)); -parcelHelpers.export(exports, "PulsingBeaconAnimationStyles", ()=>(0, _index1.PulsingBeaconAnimationStyles)); -parcelHelpers.export(exports, "getGlobalClassNames", ()=>(0, _index1.getGlobalClassNames)); -parcelHelpers.export(exports, "getFocusStyle", ()=>(0, _index1.getFocusStyle)); -parcelHelpers.export(exports, "getFocusOutlineStyle", ()=>(0, _index1.getFocusOutlineStyle)); -parcelHelpers.export(exports, "getInputFocusStyle", ()=>(0, _index1.getInputFocusStyle)); -parcelHelpers.export(exports, "getThemedContext", ()=>(0, _index1.getThemedContext)); -parcelHelpers.export(exports, "focusClear", ()=>(0, _index1.focusClear)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>(0, _index1.ThemeSettingName)); -parcelHelpers.export(exports, "getTheme", ()=>(0, _index1.getTheme)); -parcelHelpers.export(exports, "loadTheme", ()=>(0, _index1.loadTheme)); -parcelHelpers.export(exports, "createTheme", ()=>(0, _index1.createTheme)); -parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>(0, _index1.registerOnThemeChangeCallback)); -parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>(0, _index1.removeOnThemeChangeCallback)); -parcelHelpers.export(exports, "HighContrastSelector", ()=>(0, _index1.HighContrastSelector)); -parcelHelpers.export(exports, "HighContrastSelectorWhite", ()=>(0, _index1.HighContrastSelectorWhite)); -parcelHelpers.export(exports, "HighContrastSelectorBlack", ()=>(0, _index1.HighContrastSelectorBlack)); -parcelHelpers.export(exports, "EdgeChromiumHighContrastSelector", ()=>(0, _index1.EdgeChromiumHighContrastSelector)); -parcelHelpers.export(exports, "ScreenWidthMinSmall", ()=>(0, _index1.ScreenWidthMinSmall)); -parcelHelpers.export(exports, "ScreenWidthMinMedium", ()=>(0, _index1.ScreenWidthMinMedium)); -parcelHelpers.export(exports, "ScreenWidthMinLarge", ()=>(0, _index1.ScreenWidthMinLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXLarge", ()=>(0, _index1.ScreenWidthMinXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXLarge", ()=>(0, _index1.ScreenWidthMinXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinXXXLarge", ()=>(0, _index1.ScreenWidthMinXXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxSmall", ()=>(0, _index1.ScreenWidthMaxSmall)); -parcelHelpers.export(exports, "ScreenWidthMaxMedium", ()=>(0, _index1.ScreenWidthMaxMedium)); -parcelHelpers.export(exports, "ScreenWidthMaxLarge", ()=>(0, _index1.ScreenWidthMaxLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxXLarge", ()=>(0, _index1.ScreenWidthMaxXLarge)); -parcelHelpers.export(exports, "ScreenWidthMaxXXLarge", ()=>(0, _index1.ScreenWidthMaxXXLarge)); -parcelHelpers.export(exports, "ScreenWidthMinUhfMobile", ()=>(0, _index1.ScreenWidthMinUhfMobile)); -parcelHelpers.export(exports, "getScreenSelector", ()=>(0, _index1.getScreenSelector)); -parcelHelpers.export(exports, "getHighContrastNoAdjustStyle", ()=>(0, _index1.getHighContrastNoAdjustStyle)); -parcelHelpers.export(exports, "getEdgeChromiumNoHighContrastAdjustSelector", ()=>(0, _index1.getEdgeChromiumNoHighContrastAdjustSelector)); -parcelHelpers.export(exports, "normalize", ()=>(0, _index1.normalize)); -parcelHelpers.export(exports, "noWrap", ()=>(0, _index1.noWrap)); -parcelHelpers.export(exports, "getFadedOverflowStyle", ()=>(0, _index1.getFadedOverflowStyle)); -parcelHelpers.export(exports, "getPlaceholderStyles", ()=>(0, _index1.getPlaceholderStyles)); -parcelHelpers.export(exports, "ZIndexes", ()=>(0, _index1.ZIndexes)); -parcelHelpers.export(exports, "buildClassMap", ()=>(0, _index2.buildClassMap)); -parcelHelpers.export(exports, "getIcon", ()=>(0, _index2.getIcon)); -parcelHelpers.export(exports, "registerIcons", ()=>(0, _index2.registerIcons)); -parcelHelpers.export(exports, "registerIconAlias", ()=>(0, _index2.registerIconAlias)); -parcelHelpers.export(exports, "unregisterIcons", ()=>(0, _index2.unregisterIcons)); -parcelHelpers.export(exports, "setIconOptions", ()=>(0, _index2.setIconOptions)); -parcelHelpers.export(exports, "getIconClassName", ()=>(0, _index2.getIconClassName)); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _mergeStyles.InjectionMode)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _mergeStyles.Stylesheet)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _mergeStyles.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _mergeStyles.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _mergeStyles.fontFace)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _mergeStyles.keyframes)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _mergeStyles.mergeStyleSets)); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _mergeStyles.mergeStyles)); -parcelHelpers.export(exports, "FLUENT_CDN_BASE_URL", ()=>(0, _cdn.FLUENT_CDN_BASE_URL)); -var _index = require("./classNames/index"); -var _index1 = require("./styles/index"); -var _index2 = require("./utilities/index"); -var _mergeStyles = require("./MergeStyles"); -var _cdn = require("./cdn"); -var _version = require("./version"); -// Ensure theme is initialized when this package is referenced. -var _theme = require("./styles/theme"); -(0, _theme.initializeThemeInCustomizations)(); - -},{"./classNames/index":"4KgaX","./styles/index":"7vNgo","./utilities/index":"6wcJ3","./MergeStyles":"gDRLE","./cdn":false,"./version":"9IVjH","./styles/theme":"uuyP7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4KgaX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>(0, _animationClassNames.AnimationClassNames)); -parcelHelpers.export(exports, "FontClassNames", ()=>(0, _fontClassNames.FontClassNames)); -parcelHelpers.export(exports, "ColorClassNames", ()=>(0, _colorClassNames.ColorClassNames)); -var _animationClassNames = require("./AnimationClassNames"); -var _fontClassNames = require("./FontClassNames"); -var _colorClassNames = require("./ColorClassNames"); - -},{"./AnimationClassNames":"ijw6Y","./FontClassNames":false,"./ColorClassNames":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ijw6Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationClassNames", ()=>AnimationClassNames); -var _index = require("../utilities/index"); -var _index1 = require("../styles/index"); -var AnimationClassNames = (0, _index.buildClassMap)((0, _index1.AnimationStyles)); - -},{"../utilities/index":"6wcJ3","../styles/index":"7vNgo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6wcJ3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "buildClassMap", ()=>(0, _buildClassMap.buildClassMap)); -parcelHelpers.export(exports, "getIcon", ()=>(0, _icons.getIcon)); -parcelHelpers.export(exports, "registerIcons", ()=>(0, _icons.registerIcons)); -parcelHelpers.export(exports, "registerIconAlias", ()=>(0, _icons.registerIconAlias)); -parcelHelpers.export(exports, "unregisterIcons", ()=>(0, _icons.unregisterIcons)); -parcelHelpers.export(exports, "setIconOptions", ()=>(0, _icons.setIconOptions)); -parcelHelpers.export(exports, "getIconClassName", ()=>(0, _getIconClassName.getIconClassName)); -var _buildClassMap = require("./buildClassMap"); -var _icons = require("./icons"); -var _getIconClassName = require("./getIconClassName"); - -},{"./buildClassMap":"i1LYf","./icons":"hfyHB","./getIconClassName":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i1LYf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Builds a class names object from a given map. - * - * @param styles - Map of unprocessed styles. - * @returns Map of property name to class name. - */ parcelHelpers.export(exports, "buildClassMap", ()=>buildClassMap); -var _mergeStyles = require("../MergeStyles"); -function buildClassMap(styles) { - var classes = {}; - var _loop_1 = function(styleName) { - if (styles.hasOwnProperty(styleName)) { - var className_1; - Object.defineProperty(classes, styleName, { - get: function() { - if (className_1 === undefined) // eslint-disable-next-line @typescript-eslint/no-explicit-any - className_1 = (0, _mergeStyles.mergeStyles)(styles[styleName]).toString(); - return className_1; - }, - enumerable: true, - configurable: true + }; + var MergeStylesShadowRootContext = React__namespace.createContext(void 0); + var useHasMergeStylesShadowRootContext = function() { + return !!useMergeStylesShadowRootContext(); + }; + var useMergeStylesShadowRootContext = function() { + return React__namespace.useContext(MergeStylesShadowRootContext); + }; + var MergeStylesShadowRootConsumer = function(_a2) { + var stylesheetKey = _a2.stylesheetKey, children2 = _a2.children; + var _b2 = useMergeStylesHooks(), useAdoptedStylesheetEx = _b2.useAdoptedStylesheetEx, useMergeStylesRootStylesheets = _b2.useMergeStylesRootStylesheets, useWindow2 = _b2.useWindow; + var shadowCtx = useMergeStylesShadowRootContext(); + var rootMergeStyles = useMergeStylesRootStylesheets(); + var win = useWindow2(); + useAdoptedStylesheetEx(GLOBAL_STYLESHEET_KEY, shadowCtx, rootMergeStyles, win); + useAdoptedStylesheetEx(stylesheetKey, shadowCtx, rootMergeStyles, win); + return children2(!!shadowCtx); + }; + var WindowContext = React__namespace.createContext({ + // eslint-disable-next-line no-restricted-globals + window: typeof window === "object" ? window : void 0 + }); + var useWindow = function() { + return React__namespace.useContext(WindowContext).window; + }; + var useDocument = function() { + var _a2; + return (_a2 = React__namespace.useContext(WindowContext).window) === null || _a2 === void 0 ? void 0 : _a2.document; + }; + var memoizedMakeShadowConfig = memoizeFunction(makeShadowConfig); + var mergeComponentStyles = memoizeFunction( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function(defaultStyles, componentStyles, shadowConfig) { + var _a2; + var styles = (_a2 = componentStyles !== null && componentStyles !== void 0 ? componentStyles : defaultStyles) !== null && _a2 !== void 0 ? _a2 : {}; + styles.__shadowConfig__ = shadowConfig; + return styles; + } + ); + function customizable(scope, fields, concatStyles) { + return function customizableFactory(ComposedComponent) { + var _a2; + var resultClass = (_a2 = /** @class */ + (function(_super) { + __extends(ComponentWithInjectedProps, _super); + function ComponentWithInjectedProps(props) { + var _this = _super.call(this, props) || this; + _this._styleCache = {}; + _this._onSettingChanged = _this._onSettingChanged.bind(_this); + return _this; + } + ComponentWithInjectedProps.prototype.componentDidMount = function() { + Customizations.observe(this._onSettingChanged); + }; + ComponentWithInjectedProps.prototype.componentWillUnmount = function() { + Customizations.unobserve(this._onSettingChanged); + }; + ComponentWithInjectedProps.prototype.render = function() { + var _this = this; + return React__namespace.createElement(MergeStylesShadowRootConsumer, { stylesheetKey: scope }, function(inShadow) { + return React__namespace.createElement(CustomizerContext.Consumer, null, function(context2) { + var _b2; + var defaultProps = Customizations.getSettings(fields, scope, context2.customizations); + var win = (_b2 = _this.context.window) !== null && _b2 !== void 0 ? _b2 : getWindow(); + var shadowConfig = memoizedMakeShadowConfig(scope, inShadow, win); + var componentProps = _this.props; + if (defaultProps.styles && typeof defaultProps.styles === "function") { + defaultProps.styles = defaultProps.styles(__assign$1(__assign$1({}, defaultProps), componentProps)); + } + if (defaultProps.styles) { + if (_this._styleCache.default !== defaultProps.styles || _this._styleCache.component !== componentProps.styles) { + var mergedStyles = concatStyleSets(defaultProps.styles, componentProps.styles); + mergedStyles.__shadowConfig__ = shadowConfig; + _this._styleCache.default = defaultProps.styles; + _this._styleCache.component = componentProps.styles; + _this._styleCache.merged = mergedStyles; + } + return React__namespace.createElement(ComposedComponent, __assign$1({}, defaultProps, componentProps, { styles: _this._styleCache.merged })); + } + var styles = mergeComponentStyles(defaultProps.styles, componentProps.styles, shadowConfig); + return React__namespace.createElement(ComposedComponent, __assign$1({}, defaultProps, componentProps, { styles })); }); + }); + }; + ComponentWithInjectedProps.prototype._onSettingChanged = function() { + this.forceUpdate(); + }; + return ComponentWithInjectedProps; + })(React__namespace.Component), _a2.displayName = "Customized" + scope, _a2.contextType = WindowContext, _a2); + return hoistStatics(ComposedComponent, resultClass); + }; + } + function useCustomizationSettings(properties, scopeName) { + var forceUpdate = useForceUpdate(); + var customizations = React__namespace.useContext(CustomizerContext).customizations; + var inCustomizerContext = customizations.inCustomizerContext; + React__namespace.useEffect(function() { + if (!inCustomizerContext) { + Customizations.observe(forceUpdate); + } + return function() { + if (!inCustomizerContext) { + Customizations.unobserve(forceUpdate); } + }; + }, [inCustomizerContext]); + return Customizations.getSettings(properties, scopeName, customizations); + } + function useForceUpdate() { + var _a2 = React__namespace.useState(0), setValue = _a2[1]; + return function() { + return setValue(function(value2) { + return ++value2; + }); }; - for(var styleName in styles)_loop_1(styleName); - return classes; -} - -},{"../MergeStyles":"gDRLE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gDRLE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InjectionMode", ()=>(0, _mergeStyles.InjectionMode)); -parcelHelpers.export(exports, "Stylesheet", ()=>(0, _mergeStyles.Stylesheet)); -parcelHelpers.export(exports, "concatStyleSets", ()=>(0, _mergeStyles.concatStyleSets)); -parcelHelpers.export(exports, "concatStyleSetsWithProps", ()=>(0, _mergeStyles.concatStyleSetsWithProps)); -parcelHelpers.export(exports, "fontFace", ()=>(0, _mergeStyles.fontFace)); -parcelHelpers.export(exports, "keyframes", ()=>(0, _mergeStyles.keyframes)); -parcelHelpers.export(exports, "mergeStyleSets", ()=>(0, _mergeStyles.mergeStyleSets)); -parcelHelpers.export(exports, "mergeStyles", ()=>(0, _mergeStyles.mergeStyles)); -var _mergeStyles = require("@fluentui/merge-styles"); - -},{"@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hfyHB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Registers a given subset of icons. - * - * @param iconSubset - the icon subset definition. - */ parcelHelpers.export(exports, "registerIcons", ()=>registerIcons); -/** - * Unregisters icons by name. - * - * @param iconNames - List of icons to unregister. - */ parcelHelpers.export(exports, "unregisterIcons", ()=>unregisterIcons); -/** - * Remaps one icon name to another. - */ parcelHelpers.export(exports, "registerIconAlias", ()=>registerIconAlias); -/** - * Gets an icon definition. If an icon is requested but the subset has yet to be registered, - * it will get registered immediately. - * - * @public - * @param name - Name of icon. - */ parcelHelpers.export(exports, "getIcon", ()=>getIcon); -/** - * Sets the icon options. - * - * @public - */ parcelHelpers.export(exports, "setIconOptions", ()=>setIconOptions); -var _tslib = require("tslib"); -var _utilities = require("@fluentui/utilities"); -var _mergeStyles = require("@fluentui/merge-styles"); -var ICON_SETTING_NAME = 'icons'; -var _iconSettings = (0, _utilities.GlobalSettings).getValue(ICON_SETTING_NAME, { - __options: { - disableWarnings: false, - warnOnMissingIcons: true - }, - __remapped: {} -}); -// Reset icon registration on stylesheet resets. -var stylesheet = (0, _mergeStyles.Stylesheet).getInstance(); -if (stylesheet && stylesheet.onReset) stylesheet.onReset(function() { - for(var name_1 in _iconSettings)if (_iconSettings.hasOwnProperty(name_1) && !!_iconSettings[name_1].subset) _iconSettings[name_1].subset.className = undefined; -}); -/** - * Normalizes an icon name for consistent mapping. - * Current implementation is to convert the icon name to lower case. - * - * @param name - Icon name to normalize. - * @returns {string} Normalized icon name to use for indexing and mapping. - */ var normalizeIconName = function(name) { - return name.toLowerCase(); -}; -function registerIcons(iconSubset, options) { - var subset = (0, _tslib.__assign)((0, _tslib.__assign)({}, iconSubset), { - isRegistered: false, - className: undefined - }); - var icons = iconSubset.icons; - // Grab options, optionally mix user provided ones on top. - options = options ? (0, _tslib.__assign)((0, _tslib.__assign)({}, _iconSettings.__options), options) : _iconSettings.__options; - for(var iconName in icons)if (icons.hasOwnProperty(iconName)) { - var code = icons[iconName]; - var normalizedIconName = normalizeIconName(iconName); - if (_iconSettings[normalizedIconName]) _warnDuplicateIcon(iconName); - else _iconSettings[normalizedIconName] = { - code: code, - subset: subset - }; + } + function extendComponent(parent, methods2) { + for (var name_1 in methods2) { + if (methods2.hasOwnProperty(name_1)) { + parent[name_1] = appendFunction(parent, parent[name_1], methods2[name_1]); + } } -} -function unregisterIcons(iconNames) { - var options = _iconSettings.__options; - var _loop_1 = function(iconName) { - var normalizedIconName = normalizeIconName(iconName); - if (_iconSettings[normalizedIconName]) delete _iconSettings[normalizedIconName]; - else // Warn that we are trying to delete an icon that doesn't exist - if (!options.disableWarnings) (0, _utilities.warn)("The icon \"".concat(iconName, "\" tried to unregister but was not registered.")); - // Delete any aliases for this iconName - if (_iconSettings.__remapped[normalizedIconName]) delete _iconSettings.__remapped[normalizedIconName]; - // Delete any items that were an alias for this iconName - Object.keys(_iconSettings.__remapped).forEach(function(key) { - if (_iconSettings.__remapped[key] === normalizedIconName) delete _iconSettings.__remapped[key]; - }); - }; - for(var _i = 0, iconNames_1 = iconNames; _i < iconNames_1.length; _i++){ - var iconName = iconNames_1[_i]; - _loop_1(iconName); - } -} -function registerIconAlias(iconName, mappedToName) { - _iconSettings.__remapped[normalizeIconName(iconName)] = normalizeIconName(mappedToName); -} -function getIcon(name) { - var icon = undefined; - var options = _iconSettings.__options; - name = name ? normalizeIconName(name) : ''; - name = _iconSettings.__remapped[name] || name; - if (name) { - icon = _iconSettings[name]; - if (icon) { - var subset = icon.subset; - if (subset && subset.fontFace) { - if (!subset.isRegistered) { - (0, _mergeStyles.fontFace)(subset.fontFace); - subset.isRegistered = true; - } - if (!subset.className) subset.className = (0, _mergeStyles.mergeStyles)(subset.style, { - fontFamily: subset.fontFace.fontFamily, - fontWeight: subset.fontFace.fontWeight || 'normal', - fontStyle: subset.fontFace.fontStyle || 'normal' - }); - } - } else // eslint-disable-next-line deprecation/deprecation - if (!options.disableWarnings && options.warnOnMissingIcons) (0, _utilities.warn)("The icon \"".concat(name, "\" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.")); + } + var CURRENT_ID_PROPERTY = "__currentId__"; + var DEFAULT_ID_STRING = "id__"; + var _global = getWindow() || {}; + if (_global[CURRENT_ID_PROPERTY] === void 0) { + _global[CURRENT_ID_PROPERTY] = 0; + } + var _initializedStylesheetResets = false; + function getId(prefix) { + if (!_initializedStylesheetResets) { + var stylesheet2 = Stylesheet.getInstance(); + if (stylesheet2 && stylesheet2.onReset) { + stylesheet2.onReset(resetIds); + } + _initializedStylesheetResets = true; } - return icon; -} -function setIconOptions(options) { - _iconSettings.__options = (0, _tslib.__assign)((0, _tslib.__assign)({}, _iconSettings.__options), options); -} -var _missingIcons = []; -var _missingIconsTimer = undefined; -function _warnDuplicateIcon(iconName) { - var options = _iconSettings.__options; - var warningDelay = 2000; - var maxIconsInMessage = 10; - if (!options.disableWarnings) { - _missingIcons.push(iconName); - if (_missingIconsTimer === undefined) _missingIconsTimer = setTimeout(function() { - (0, _utilities.warn)("Some icons were re-registered. Applications should only call registerIcons for any given icon once. Redefining what an icon is may have unintended consequences. Duplicates include: \n" + _missingIcons.slice(0, maxIconsInMessage).join(', ') + (_missingIcons.length > maxIconsInMessage ? " (+ ".concat(_missingIcons.length - maxIconsInMessage, " more)") : '')); - _missingIconsTimer = undefined; - _missingIcons = []; - }, warningDelay); + var index2 = _global[CURRENT_ID_PROPERTY]++; + return (prefix === void 0 ? DEFAULT_ID_STRING : prefix) + index2; + } + function resetIds(counter) { + if (counter === void 0) { + counter = 0; } -} - -},{"tslib":"9gizs","@fluentui/utilities":"55bj3","@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7vNgo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _animationStyles.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _animationStyles.AnimationVariables)); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _defaultPalette.DefaultPalette)); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _defaultEffects.DefaultEffects)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _defaultFontStyles.DefaultFontStyles)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _defaultFontStyles.registerDefaultFontFaces)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _fonts.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _fonts.FontWeights)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _fonts.IconFontSizes)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _fonts.createFontStyles)); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>(0, _hiddenContentStyle.hiddenContentStyle)); -parcelHelpers.export(exports, "PulsingBeaconAnimationStyles", ()=>(0, _pulsingBeaconAnimationStyles.PulsingBeaconAnimationStyles)); -parcelHelpers.export(exports, "getGlobalClassNames", ()=>(0, _getGlobalClassNames.getGlobalClassNames)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>(0, _theme.ThemeSettingName)); -parcelHelpers.export(exports, "getTheme", ()=>(0, _theme.getTheme)); -parcelHelpers.export(exports, "loadTheme", ()=>(0, _theme.loadTheme)); -parcelHelpers.export(exports, "createTheme", ()=>(0, _theme.createTheme)); -parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>(0, _theme.registerOnThemeChangeCallback)); -parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>(0, _theme.removeOnThemeChangeCallback)); -var _animationStyles = require("./AnimationStyles"); -var _defaultPalette = require("./DefaultPalette"); -var _defaultEffects = require("./DefaultEffects"); -var _defaultFontStyles = require("./DefaultFontStyles"); -var _fonts = require("./fonts"); -var _getFocusStyle = require("./getFocusStyle"); -parcelHelpers.exportAll(_getFocusStyle, exports); -var _hiddenContentStyle = require("./hiddenContentStyle"); -var _pulsingBeaconAnimationStyles = require("./PulsingBeaconAnimationStyles"); -var _getGlobalClassNames = require("./getGlobalClassNames"); -var _scheme = require("./scheme"); -parcelHelpers.exportAll(_scheme, exports); -var _theme = require("./theme"); -var _commonStyles = require("./CommonStyles"); -parcelHelpers.exportAll(_commonStyles, exports); -var _generalStyles = require("./GeneralStyles"); -parcelHelpers.exportAll(_generalStyles, exports); -var _getFadedOverflowStyle = require("./getFadedOverflowStyle"); -parcelHelpers.exportAll(_getFadedOverflowStyle, exports); -var _getPlaceholderStyles = require("./getPlaceholderStyles"); -parcelHelpers.exportAll(_getPlaceholderStyles, exports); -var _zIndexes = require("./zIndexes"); -parcelHelpers.exportAll(_zIndexes, exports); - -},{"./AnimationStyles":"43k8I","./DefaultPalette":false,"./DefaultEffects":false,"./DefaultFontStyles":false,"./fonts":"Tr1M8","./getFocusStyle":"byDYo","./hiddenContentStyle":"furJc","./PulsingBeaconAnimationStyles":false,"./getGlobalClassNames":"g6mIZ","./scheme":false,"./theme":"uuyP7","./CommonStyles":"rgkn6","./GeneralStyles":"frMaf","./getFadedOverflowStyle":false,"./getPlaceholderStyles":"1VkGl","./zIndexes":"hDsdg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"43k8I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationStyles", ()=>(0, _theme.AnimationStyles)); -parcelHelpers.export(exports, "AnimationVariables", ()=>(0, _theme.AnimationVariables)); -var _theme = require("@fluentui/theme"); - -},{"@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6MuB2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FluentTheme", ()=>(0, _fluentTheme.FluentTheme)); -var _mergeThemes = require("./mergeThemes"); -parcelHelpers.exportAll(_mergeThemes, exports); -var _index = require("./types/index"); -parcelHelpers.exportAll(_index, exports); -var _index1 = require("./colors/index"); -parcelHelpers.exportAll(_index1, exports); -var _index2 = require("./effects/index"); -parcelHelpers.exportAll(_index2, exports); -var _index3 = require("./spacing/index"); -parcelHelpers.exportAll(_index3, exports); -var _index4 = require("./motion/index"); -parcelHelpers.exportAll(_index4, exports); -var _index5 = require("./fonts/index"); -parcelHelpers.exportAll(_index5, exports); -var _createTheme = require("./createTheme"); -parcelHelpers.exportAll(_createTheme, exports); -var _fluentTheme = require("./FluentTheme"); -var _version = require("./version"); - -},{"./mergeThemes":false,"./types/index":false,"./colors/index":false,"./effects/index":false,"./spacing/index":false,"./motion/index":"5Q3cL","./fonts/index":"cXCfS","./createTheme":"91iV5","./FluentTheme":false,"./version":"dCgRo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j9270":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Merge a partial/full theme into a full theme and returns a merged full theme. - */ parcelHelpers.export(exports, "mergeThemes", ()=>mergeThemes); -var _utilities = require("@fluentui/utilities"); -var _makeSemanticColors = require("./utilities/makeSemanticColors"); -function mergeThemes(theme, partialTheme) { - var _a, _b, _c; - if (partialTheme === void 0) partialTheme = {}; - var mergedTheme = (0, _utilities.merge)({}, theme, partialTheme, { - semanticColors: (0, _makeSemanticColors.getSemanticColors)(partialTheme.palette, partialTheme.effects, partialTheme.semanticColors, partialTheme.isInverted === undefined ? theme.isInverted : partialTheme.isInverted) - }); - if (((_a = partialTheme.palette) === null || _a === void 0 ? void 0 : _a.themePrimary) && !((_b = partialTheme.palette) === null || _b === void 0 ? void 0 : _b.accent)) mergedTheme.palette.accent = partialTheme.palette.themePrimary; - if (partialTheme.defaultFontStyle) for(var _i = 0, _d = Object.keys(mergedTheme.fonts); _i < _d.length; _i++){ - var fontStyle = _d[_i]; - mergedTheme.fonts[fontStyle] = (0, _utilities.merge)(mergedTheme.fonts[fontStyle], partialTheme.defaultFontStyle, (_c = partialTheme === null || partialTheme === void 0 ? void 0 : partialTheme.fonts) === null || _c === void 0 ? void 0 : _c[fontStyle]); + _global[CURRENT_ID_PROPERTY] = counter; + } + var toObjectMap = function() { + var items = []; + for (var _i = 0; _i < arguments.length; _i++) { + items[_i] = arguments[_i]; } - return mergedTheme; -} - -},{"@fluentui/utilities":"55bj3","./utilities/makeSemanticColors":"dsk6N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dsk6N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** Generates all the semantic slot colors based on the theme so far - * We'll use these as fallbacks for semantic slots that the passed in theme did not define. - * The caller must still mix in the customized semantic slots at the end. - */ parcelHelpers.export(exports, "makeSemanticColors", ()=>makeSemanticColors); -/** - * Map partial platte and effects to partial semantic colors. - */ parcelHelpers.export(exports, "getSemanticColors", ()=>getSemanticColors); -var _tslib = require("tslib"); -function makeSemanticColors(p, e, s, isInverted, depComments) { - if (depComments === void 0) depComments = false; - var semanticColors = (0, _tslib.__assign)({ - primaryButtonBorder: 'transparent', - errorText: !isInverted ? '#a4262c' : '#F1707B', - messageText: !isInverted ? '#323130' : '#F3F2F1', - messageLink: !isInverted ? '#005A9E' : '#6CB8F6', - messageLinkHovered: !isInverted ? '#004578' : '#82C7FF', - infoIcon: !isInverted ? '#605e5c' : '#C8C6C4', - errorIcon: !isInverted ? '#A80000' : '#F1707B', - blockingIcon: !isInverted ? '#FDE7E9' : '#442726', - warningIcon: !isInverted ? '#797775' : '#C8C6C4', - severeWarningIcon: !isInverted ? '#D83B01' : '#FCE100', - successIcon: !isInverted ? '#107C10' : '#92C353', - infoBackground: !isInverted ? '#f3f2f1' : '#323130', - errorBackground: !isInverted ? '#FDE7E9' : '#442726', - blockingBackground: !isInverted ? '#FDE7E9' : '#442726', - warningBackground: !isInverted ? '#FFF4CE' : '#433519', - severeWarningBackground: !isInverted ? '#FED9CC' : '#4F2A0F', - successBackground: !isInverted ? '#DFF6DD' : '#393D1B', - // deprecated - warningHighlight: !isInverted ? '#ffb900' : '#fff100', - successText: !isInverted ? '#107C10' : '#92c353' - }, s); - var fullSemanticColors = getSemanticColors(p, e, semanticColors, isInverted); - return _fixDeprecatedSlots(fullSemanticColors, depComments); -} -function getSemanticColors(p, e, s, isInverted, depComments) { - if (depComments === void 0) depComments = false; var result = {}; - // map palette - var _a = p || {}, white = _a.white, black = _a.black, themePrimary = _a.themePrimary, themeDark = _a.themeDark, themeDarker = _a.themeDarker, themeDarkAlt = _a.themeDarkAlt, themeLighter = _a.themeLighter, neutralLight = _a.neutralLight, neutralLighter = _a.neutralLighter, neutralDark = _a.neutralDark, neutralQuaternary = _a.neutralQuaternary, neutralQuaternaryAlt = _a.neutralQuaternaryAlt, neutralPrimary = _a.neutralPrimary, neutralSecondary = _a.neutralSecondary, neutralSecondaryAlt = _a.neutralSecondaryAlt, neutralTertiary = _a.neutralTertiary, neutralTertiaryAlt = _a.neutralTertiaryAlt, neutralLighterAlt = _a.neutralLighterAlt, accent = _a.accent; - if (white) { - result.bodyBackground = white; - result.bodyFrameBackground = white; - result.accentButtonText = white; - result.buttonBackground = white; - result.primaryButtonText = white; - result.primaryButtonTextHovered = white; - result.primaryButtonTextPressed = white; - result.inputBackground = white; - result.inputForegroundChecked = white; - result.listBackground = white; - result.menuBackground = white; - result.cardStandoutBackground = white; + for (var _a2 = 0, items_1 = items; _a2 < items_1.length; _a2++) { + var item = items_1[_a2]; + var keys2 = Array.isArray(item) ? item : Object.keys(item); + for (var _b2 = 0, keys_1 = keys2; _b2 < keys_1.length; _b2++) { + var key2 = keys_1[_b2]; + result[key2] = 1; + } } - if (black) { - result.bodyTextChecked = black; - result.buttonTextCheckedHovered = black; + return result; + }; + var baseElementEvents = toObjectMap([ + "onCopy", + "onCut", + "onPaste", + "onCompositionEnd", + "onCompositionStart", + "onCompositionUpdate", + "onFocus", + "onFocusCapture", + "onBlur", + "onBlurCapture", + "onChange", + "onInput", + "onSubmit", + "onLoad", + "onError", + "onKeyDown", + "onKeyDownCapture", + "onKeyPress", + "onKeyUp", + "onAbort", + "onCanPlay", + "onCanPlayThrough", + "onDurationChange", + "onEmptied", + "onEncrypted", + "onEnded", + "onLoadedData", + "onLoadedMetadata", + "onLoadStart", + "onPause", + "onPlay", + "onPlaying", + "onProgress", + "onRateChange", + "onSeeked", + "onSeeking", + "onStalled", + "onSuspend", + "onTimeUpdate", + "onVolumeChange", + "onWaiting", + "onClick", + "onClickCapture", + "onContextMenu", + "onDoubleClick", + "onDrag", + "onDragEnd", + "onDragEnter", + "onDragExit", + "onDragLeave", + "onDragOver", + "onDragStart", + "onDrop", + "onMouseDown", + "onMouseDownCapture", + "onMouseEnter", + "onMouseLeave", + "onMouseMove", + "onMouseOut", + "onMouseOver", + "onMouseUp", + "onMouseUpCapture", + "onSelect", + "onTouchCancel", + "onTouchEnd", + "onTouchMove", + "onTouchStart", + "onScroll", + "onWheel", + "onPointerCancel", + "onPointerDown", + "onPointerEnter", + "onPointerLeave", + "onPointerMove", + "onPointerOut", + "onPointerOver", + "onPointerUp", + "onGotPointerCapture", + "onLostPointerCapture" + ]); + var baseElementProperties = toObjectMap([ + "accessKey", + // global + "children", + // global + "className", + // global + "contentEditable", + // global + "dir", + // global + "draggable", + // global + "hidden", + // global + "htmlFor", + // global + "id", + // global + "lang", + // global + "ref", + // global + "role", + // global + "style", + // global + "tabIndex", + // global + "title", + // global + "translate", + // global + "spellCheck", + // global + "name" + // global + ]); + var htmlElementProperties = toObjectMap(baseElementProperties, baseElementEvents); + toObjectMap(htmlElementProperties, [ + "form" + // button, fieldset, input, label, meter, object, output, select, textarea + ]); + var audioProperties = toObjectMap(htmlElementProperties, [ + "height", + // canvas, embed, iframe, img, input, object, video + "loop", + // audio, video + "muted", + // audio, video + "preload", + // audio, video + "src", + // audio, embed, iframe, img, input, script, source, track, video + "width" + // canvas, embed, iframe, img, input, object, video + ]); + toObjectMap(audioProperties, [ + "poster" + // video + ]); + toObjectMap(htmlElementProperties, [ + "start" + // ol + ]); + toObjectMap(htmlElementProperties, [ + "value" + // button, input, li, option, meter, progress, param + ]); + var anchorProperties = toObjectMap(htmlElementProperties, [ + "download", + // a, area + "href", + // a, area, base, link + "hrefLang", + // a, area, link + "media", + // a, area, link, source, style + "rel", + // a, area, link + "target", + // a, area, base, form + "type" + // a, button, input, link, menu, object, script, source, style + ]); + var buttonProperties = toObjectMap(htmlElementProperties, [ + "autoFocus", + // button, input, select, textarea + "disabled", + // button, fieldset, input, optgroup, option, select, textarea + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "formAction", + // input, button + "formEncType", + // input, button + "formMethod", + // input, button + "formNoValidate", + // input, button + "formTarget", + // input, button + "type", + // a, button, input, link, menu, object, script, source, style + "value" + // button, input, li, option, meter, progress, param, + ]); + var inputProperties = toObjectMap(buttonProperties, [ + "accept", + // input + "alt", + // area, img, input + "autoCapitalize", + // input, textarea + "autoComplete", + // form, input + "checked", + // input + "dirname", + // input, textarea + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "height", + // canvas, embed, iframe, img, input, object, video + "inputMode", + // input + "list", + // input + "max", + // input, meter + "maxLength", + // input, textarea + "min", + // input, meter + "minLength", + // input, textarea + "multiple", + // input, select + "pattern", + // input + "placeholder", + // input, textarea + "readOnly", + // input, textarea + "required", + // input, select, textarea + "src", + // audio, embed, iframe, img, input, script, source, track, video + "step", + // input + "size", + // input + "type", + // a, button, input, link, menu, object, script, source, style + "value", + // button, input, li, option, meter, progress, param + "width" + // canvas, embed, iframe, img, input, object, video + ]); + var textAreaProperties = toObjectMap(buttonProperties, [ + "autoCapitalize", + // input, textarea + "cols", + // textarea + "dirname", + // input, textarea + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "maxLength", + // input, textarea + "minLength", + // input, textarea + "placeholder", + // input, textarea + "readOnly", + // input, textarea + "required", + // input, select, textarea + "rows", + // textarea + "wrap" + // textarea + ]); + toObjectMap(buttonProperties, [ + "form", + // button, fieldset, input, label, meter, object, output, select, textarea + "multiple", + // input, select + "required" + // input, select, textarea + ]); + toObjectMap(htmlElementProperties, [ + "selected", + // option + "value" + // button, input, li, option, meter, progress, param + ]); + toObjectMap(htmlElementProperties, [ + "cellPadding", + // table + "cellSpacing" + // table + ]); + toObjectMap(htmlElementProperties, [ + "rowSpan", + // td, th + "scope" + // th + ]); + toObjectMap(htmlElementProperties, [ + "colSpan", + // td + "headers", + // td + "rowSpan", + // td, th + "scope" + // th + ]); + toObjectMap(htmlElementProperties, [ + "span" + // col, colgroup + ]); + toObjectMap(htmlElementProperties, [ + "span" + // col, colgroup + ]); + toObjectMap(htmlElementProperties, [ + "acceptCharset", + // form + "action", + // form + "encType", + // form + "encType", + // form + "method", + // form + "noValidate", + // form + "target" + // form + ]); + toObjectMap(htmlElementProperties, [ + "allow", + // iframe + "allowFullScreen", + // iframe + "allowPaymentRequest", + // iframe + "allowTransparency", + // iframe + "csp", + // iframe + "height", + // canvas, embed, iframe, img, input, object, video + "importance", + // iframe + "referrerPolicy", + // iframe + "sandbox", + // iframe + "src", + // audio, embed, iframe, img, input, script, source, track, video + "srcDoc", + // iframe + "width" + // canvas, embed, iframe, img, input, object, video, + ]); + var imgProperties = toObjectMap(htmlElementProperties, [ + "alt", + // area, img, input + "crossOrigin", + // img + "height", + // canvas, embed, iframe, img, input, object, video + "src", + // audio, embed, iframe, img, input, script, source, track, video + "srcSet", + // img, source + "useMap", + // img, object, + "width" + // canvas, embed, iframe, img, input, object, video + ]); + var divProperties = htmlElementProperties; + function getNativeProps(props, allowedPropNames, excludedPropNames) { + var isArray2 = Array.isArray(allowedPropNames); + var result = {}; + var keys2 = Object.keys(props); + for (var _i = 0, keys_2 = keys2; _i < keys_2.length; _i++) { + var key2 = keys_2[_i]; + var isNativeProp = !isArray2 && allowedPropNames[key2] || isArray2 && allowedPropNames.indexOf(key2) >= 0 || key2.indexOf("data-") === 0 || key2.indexOf("aria-") === 0; + if (isNativeProp && (!excludedPropNames || (excludedPropNames === null || excludedPropNames === void 0 ? void 0 : excludedPropNames.indexOf(key2)) === -1)) { + result[key2] = props[key2]; + } } - if (themePrimary) { - result.link = themePrimary; - result.primaryButtonBackground = themePrimary; - result.inputBackgroundChecked = themePrimary; - result.inputIcon = themePrimary; - result.inputFocusBorderAlt = themePrimary; - result.menuIcon = themePrimary; - result.menuHeader = themePrimary; - result.accentButtonBackground = themePrimary; + return result; + } + var REACT_LIFECYCLE_EXCLUSIONS = [ + "setState", + "render", + "componentWillMount", + "UNSAFE_componentWillMount", + "componentDidMount", + "componentWillReceiveProps", + "UNSAFE_componentWillReceiveProps", + "shouldComponentUpdate", + "componentWillUpdate", + "getSnapshotBeforeUpdate", + "UNSAFE_componentWillUpdate", + "componentDidUpdate", + "componentWillUnmount" + ]; + function hoistMethods(destination, source2, exclusions) { + if (exclusions === void 0) { + exclusions = REACT_LIFECYCLE_EXCLUSIONS; } - if (themeDark) { - result.primaryButtonBackgroundPressed = themeDark; - result.inputBackgroundCheckedHovered = themeDark; - result.inputIconHovered = themeDark; + var hoisted = []; + var _loop_1 = function(methodName2) { + if (typeof source2[methodName2] === "function" && destination[methodName2] === void 0 && (!exclusions || exclusions.indexOf(methodName2) === -1)) { + hoisted.push(methodName2); + destination[methodName2] = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + source2[methodName2].apply(source2, args); + }; + } + }; + for (var methodName in source2) { + _loop_1(methodName); } - if (themeDarker) result.linkHovered = themeDarker; - if (themeDarkAlt) result.primaryButtonBackgroundHovered = themeDarkAlt; - if (themeLighter) result.inputPlaceholderBackgroundChecked = themeLighter; - if (neutralLight) { - result.bodyBackgroundChecked = neutralLight; - result.bodyFrameDivider = neutralLight; - result.bodyDivider = neutralLight; - result.variantBorder = neutralLight; - result.buttonBackgroundCheckedHovered = neutralLight; - result.buttonBackgroundPressed = neutralLight; - result.listItemBackgroundChecked = neutralLight; - result.listHeaderBackgroundPressed = neutralLight; - result.menuItemBackgroundPressed = neutralLight; - // eslint-disable-next-line deprecation/deprecation - result.menuItemBackgroundChecked = neutralLight; + return hoisted; + } + function unhoistMethods(source2, methodNames) { + methodNames.forEach(function(methodName) { + return delete source2[methodName]; + }); + } + function initializeComponentRef(obj2) { + extendComponent(obj2, { + componentDidMount: _onMount, + componentDidUpdate: _onUpdate, + componentWillUnmount: _onUnmount + }); + } + function _onMount() { + _setComponentRef(this.props.componentRef, this); + } + function _onUpdate(prevProps) { + if (prevProps.componentRef !== this.props.componentRef) { + _setComponentRef(prevProps.componentRef, null); + _setComponentRef(this.props.componentRef, this); } - if (neutralLighter) { - result.bodyBackgroundHovered = neutralLighter; - result.buttonBackgroundHovered = neutralLighter; - result.buttonBackgroundDisabled = neutralLighter; - result.buttonBorderDisabled = neutralLighter; - result.primaryButtonBackgroundDisabled = neutralLighter; - result.disabledBackground = neutralLighter; - result.listItemBackgroundHovered = neutralLighter; - result.listHeaderBackgroundHovered = neutralLighter; - result.menuItemBackgroundHovered = neutralLighter; + } + function _onUnmount() { + _setComponentRef(this.props.componentRef, null); + } + function _setComponentRef(componentRef, value2) { + if (componentRef) { + if (typeof componentRef === "object") { + componentRef.current = value2; + } else if (typeof componentRef === "function") { + componentRef(value2); + } } - if (neutralQuaternary) { - result.primaryButtonTextDisabled = neutralQuaternary; - result.disabledSubtext = neutralQuaternary; + } + var _a$5; + var DirectionalKeyCodes = (_a$5 = {}, _a$5[KeyCodes.up] = 1, _a$5[KeyCodes.down] = 1, _a$5[KeyCodes.left] = 1, _a$5[KeyCodes.right] = 1, _a$5[KeyCodes.home] = 1, _a$5[KeyCodes.end] = 1, _a$5[KeyCodes.tab] = 1, _a$5[KeyCodes.pageUp] = 1, _a$5[KeyCodes.pageDown] = 1, _a$5); + function isDirectionalKeyCode(which) { + return !!DirectionalKeyCodes[which]; + } + var IsFocusVisibleClassName = "ms-Fabric--isFocusVisible"; + var IsFocusHiddenClassName = "ms-Fabric--isFocusHidden"; + function updateClassList(el, enabled) { + if (el) { + el.classList.add(enabled ? IsFocusVisibleClassName : IsFocusHiddenClassName); + el.classList.remove(enabled ? IsFocusHiddenClassName : IsFocusVisibleClassName); } - if (neutralQuaternaryAlt) result.listItemBackgroundCheckedHovered = neutralQuaternaryAlt; - if (neutralTertiary) { - result.disabledBodyText = neutralTertiary; - result.variantBorderHovered = (s === null || s === void 0 ? void 0 : s.variantBorderHovered) || neutralTertiary; - result.buttonTextDisabled = neutralTertiary; - result.inputIconDisabled = neutralTertiary; - result.disabledText = neutralTertiary; + } + function setFocusVisibility(enabled, target2, registeredProviders) { + var _a2; + if (registeredProviders) { + registeredProviders.forEach(function(ref2) { + return updateClassList(ref2.current, enabled); + }); + } else { + updateClassList((_a2 = getWindow(target2)) === null || _a2 === void 0 ? void 0 : _a2.document.body, enabled); } - if (neutralPrimary) { - result.bodyText = neutralPrimary; - result.actionLink = neutralPrimary; - result.buttonText = neutralPrimary; - result.inputBorderHovered = neutralPrimary; - result.inputText = neutralPrimary; - result.listText = neutralPrimary; - result.menuItemText = neutralPrimary; + } + var mountCounters = /* @__PURE__ */ new WeakMap(); + var callbackMap = /* @__PURE__ */ new WeakMap(); + function setMountCounters(key2, delta) { + var newValue; + var currValue = mountCounters.get(key2); + if (currValue) { + newValue = currValue + delta; + } else { + newValue = 1; } - if (neutralLighterAlt) { - result.bodyStandoutBackground = neutralLighterAlt; - result.defaultStateBackground = neutralLighterAlt; + mountCounters.set(key2, newValue); + return newValue; + } + function setCallbackMap(context2) { + var callbacks = callbackMap.get(context2); + if (callbacks) { + return callbacks; } - if (neutralDark) { - result.actionLinkHovered = neutralDark; - result.buttonTextHovered = neutralDark; - result.buttonTextChecked = neutralDark; - result.buttonTextPressed = neutralDark; - result.inputTextHovered = neutralDark; - result.menuItemTextHovered = neutralDark; + var onMouseDown = function(ev) { + return _onMouseDown(ev, context2.registeredProviders); + }; + var onPointerDown = function(ev) { + return _onPointerDown(ev, context2.registeredProviders); + }; + var onKeyDown = function(ev) { + return _onKeyDown(ev, context2.registeredProviders); + }; + var onKeyUp = function(ev) { + return _onKeyUp(ev, context2.registeredProviders); + }; + callbacks = { onMouseDown, onPointerDown, onKeyDown, onKeyUp }; + callbackMap.set(context2, callbacks); + return callbacks; + } + var FocusRectsContext = React__namespace.createContext(void 0); + function useFocusRects(rootRef) { + var context2 = React__namespace.useContext(FocusRectsContext); + React__namespace.useEffect(function() { + var _a2, _b2, _c2, _d2; + var win = getWindow(rootRef === null || rootRef === void 0 ? void 0 : rootRef.current); + if (!win || ((_a2 = win.FabricConfig) === null || _a2 === void 0 ? void 0 : _a2.disableFocusRects) === true) { + return void 0; + } + var el = win; + var onMouseDown; + var onPointerDown; + var onKeyDown; + var onKeyUp; + if (((_b2 = context2 === null || context2 === void 0 ? void 0 : context2.providerRef) === null || _b2 === void 0 ? void 0 : _b2.current) && ((_d2 = (_c2 = context2 === null || context2 === void 0 ? void 0 : context2.providerRef) === null || _c2 === void 0 ? void 0 : _c2.current) === null || _d2 === void 0 ? void 0 : _d2.addEventListener)) { + el = context2.providerRef.current; + var callbacks = ( + /*@__NOINLINE__*/ + setCallbackMap(context2) + ); + onMouseDown = callbacks.onMouseDown; + onPointerDown = callbacks.onPointerDown; + onKeyDown = callbacks.onKeyDown; + onKeyUp = callbacks.onKeyUp; + } else { + onMouseDown = _onMouseDown; + onPointerDown = _onPointerDown; + onKeyDown = _onKeyDown; + onKeyUp = _onKeyUp; + } + var count2 = setMountCounters(el, 1); + if (count2 <= 1) { + el.addEventListener("mousedown", onMouseDown, true); + el.addEventListener("pointerdown", onPointerDown, true); + el.addEventListener("keydown", onKeyDown, true); + el.addEventListener("keyup", onKeyUp, true); + } + return function() { + var _a3; + if (!win || ((_a3 = win.FabricConfig) === null || _a3 === void 0 ? void 0 : _a3.disableFocusRects) === true) { + return; + } + count2 = setMountCounters(el, -1); + if (count2 === 0) { + el.removeEventListener("mousedown", onMouseDown, true); + el.removeEventListener("pointerdown", onPointerDown, true); + el.removeEventListener("keydown", onKeyDown, true); + el.removeEventListener("keyup", onKeyUp, true); + } + }; + }, [context2, rootRef]); + } + var FocusRects = function(props) { + useFocusRects(props.rootRef); + return null; + }; + function _onMouseDown(ev, registeredProviders) { + setFocusVisibility(false, ev.target, registeredProviders); + } + function _onPointerDown(ev, registeredProviders) { + if (ev.pointerType !== "mouse") { + setFocusVisibility(false, ev.target, registeredProviders); } - if (neutralSecondary) { - result.bodySubtext = neutralSecondary; - result.focusBorder = neutralSecondary; - result.inputBorder = neutralSecondary; - result.smallInputBorder = neutralSecondary; - result.inputPlaceholderText = neutralSecondary; + } + function _onKeyDown(ev, registeredProviders) { + if (isDirectionalKeyCode(ev.which)) { + setFocusVisibility(true, ev.target, registeredProviders); } - if (neutralSecondaryAlt) result.buttonBorder = neutralSecondaryAlt; - if (neutralTertiaryAlt) { - result.disabledBodySubtext = neutralTertiaryAlt; - result.disabledBorder = neutralTertiaryAlt; - result.buttonBackgroundChecked = neutralTertiaryAlt; - result.menuDivider = neutralTertiaryAlt; - } - if (accent) result.accentButtonBackground = accent; - // map effects - if (e === null || e === void 0 ? void 0 : e.elevation4) result.cardShadow = e.elevation4; - if (!isInverted && (e === null || e === void 0 ? void 0 : e.elevation8)) result.cardShadowHovered = e.elevation8; - else if (result.variantBorderHovered) result.cardShadowHovered = '0 0 1px ' + result.variantBorderHovered; - result = (0, _tslib.__assign)((0, _tslib.__assign)({}, result), s); - return result; -} -function _fixDeprecatedSlots(s, depComments) { - // Add @deprecated tag as comment if enabled - var dep = ''; - if (depComments === true) dep = ' /* @deprecated */'; - /* eslint-disable deprecation/deprecation */ s.listTextColor = s.listText + dep; - s.menuItemBackgroundChecked += dep; - s.warningHighlight += dep; - s.warningText = s.messageText + dep; - s.successText += dep; - /* eslint-enable deprecation/deprecation */ return s; -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7yAiX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultPalette", ()=>(0, _defaultPalette.DefaultPalette)); -var _fluentColors = require("./FluentColors"); -parcelHelpers.exportAll(_fluentColors, exports); -var _defaultPalette = require("./DefaultPalette"); - -},{"./FluentColors":false,"./DefaultPalette":"ltCeA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ltCeA":[function(require,module,exports,__globalThis) { -// When adding or removing a color, make sure you keep this consistent with IColorClassNames -// by adding the color variants. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultPalette", ()=>DefaultPalette); -var DefaultPalette = { - themeDarker: '#004578', - themeDark: '#005a9e', - themeDarkAlt: '#106ebe', - themePrimary: '#0078d4', - themeSecondary: '#2b88d8', - themeTertiary: '#71afe5', - themeLight: '#c7e0f4', - themeLighter: '#deecf9', - themeLighterAlt: '#eff6fc', - black: '#000000', - blackTranslucent40: 'rgba(0,0,0,.4)', - neutralDark: '#201f1e', - neutralPrimary: '#323130', - neutralPrimaryAlt: '#3b3a39', - neutralSecondary: '#605e5c', - neutralSecondaryAlt: '#8a8886', - neutralTertiary: '#a19f9d', - neutralTertiaryAlt: '#c8c6c4', - neutralQuaternary: '#d2d0ce', - neutralQuaternaryAlt: '#e1dfdd', - neutralLight: '#edebe9', - neutralLighter: '#f3f2f1', - neutralLighterAlt: '#faf9f8', - accent: '#0078d4', - white: '#ffffff', - whiteTranslucent40: 'rgba(255,255,255,.4)', - yellowDark: '#d29200', - yellow: '#ffb900', - yellowLight: '#fff100', - orange: '#d83b01', - orangeLight: '#ea4300', - orangeLighter: '#ff8c00', - redDark: '#a4262c', - red: '#e81123', - magentaDark: '#5c005c', - magenta: '#b4009e', - magentaLight: '#e3008c', - purpleDark: '#32145a', - purple: '#5c2d91', - purpleLight: '#b4a0ff', - blueDark: '#002050', - blueMid: '#00188f', - blue: '#0078d4', - blueLight: '#00bcf2', - tealDark: '#004b50', - teal: '#008272', - tealLight: '#00b294', - greenDark: '#004b1c', - green: '#107c10', - greenLight: '#bad80a' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2nXfK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultEffects", ()=>(0, _defaultEffects.DefaultEffects)); -parcelHelpers.export(exports, "Depths", ()=>(0, _fluentDepths.Depths)); -var _defaultEffects = require("./DefaultEffects"); -var _fluentDepths = require("./FluentDepths"); - -},{"./DefaultEffects":"jcrQE","./FluentDepths":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jcrQE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultEffects", ()=>DefaultEffects); -var _fluentDepths = require("./FluentDepths"); -var DefaultEffects = { - elevation4: (0, _fluentDepths.Depths).depth4, - elevation8: (0, _fluentDepths.Depths).depth8, - elevation16: (0, _fluentDepths.Depths).depth16, - elevation64: (0, _fluentDepths.Depths).depth64, - roundedCorner2: '2px', - roundedCorner4: '4px', - roundedCorner6: '6px' -}; - -},{"./FluentDepths":"k9iEB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k9iEB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Depths", ()=>Depths); -var Depths; -(function(Depths) { - Depths.depth0 = '0 0 0 0 transparent'; - Depths.depth4 = '0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)'; - Depths.depth8 = '0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)'; - Depths.depth16 = '0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108)'; - Depths.depth64 = '0 25.6px 57.6px 0 rgba(0, 0, 0, 0.22), 0 4.8px 14.4px 0 rgba(0, 0, 0, 0.18)'; -})(Depths || (Depths = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"82zHh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultSpacing", ()=>(0, _defaultSpacing.DefaultSpacing)); -var _defaultSpacing = require("./DefaultSpacing"); - -},{"./DefaultSpacing":"c1Apy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c1Apy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultSpacing", ()=>DefaultSpacing); -var DefaultSpacing = { - s2: '4px', - s1: '8px', - m: '16px', - l1: '20px', - l2: '32px' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Q3cL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _fluentMotion = require("./FluentMotion"); -parcelHelpers.exportAll(_fluentMotion, exports); -var _animationStyles = require("./AnimationStyles"); -parcelHelpers.exportAll(_animationStyles, exports); - -},{"./FluentMotion":false,"./AnimationStyles":"3XlEl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3XlEl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationVariables", ()=>AnimationVariables); -parcelHelpers.export(exports, "AnimationStyles", ()=>AnimationStyles); -var _mergeStyles = require("@fluentui/merge-styles"); -/* Register the keyframes */ var EASING_FUNCTION_1 = 'cubic-bezier(.1,.9,.2,1)'; -var EASING_FUNCTION_2 = 'cubic-bezier(.1,.25,.75,.9)'; -var DURATION_1 = '0.167s'; -var DURATION_2 = '0.267s'; -var DURATION_3 = '0.367s'; -var DURATION_4 = '0.467s'; -var FADE_IN = (0, _mergeStyles.keyframes)({ - from: { - opacity: 0 - }, - to: { - opacity: 1 + } + function _onKeyUp(ev, registeredProviders) { + if (isDirectionalKeyCode(ev.which)) { + setFocusVisibility(true, ev.target, registeredProviders); } -}); -var FADE_OUT = (0, _mergeStyles.keyframes)({ - from: { - opacity: 1 - }, - to: { - opacity: 0, - visibility: 'hidden' - } -}); -var SLIDE_RIGHT_IN10 = _createSlideInX(-10); -var SLIDE_RIGHT_IN20 = _createSlideInX(-20); -var SLIDE_RIGHT_IN40 = _createSlideInX(-40); -var SLIDE_RIGHT_IN400 = _createSlideInX(-400); -var SLIDE_LEFT_IN10 = _createSlideInX(10); -var SLIDE_LEFT_IN20 = _createSlideInX(20); -var SLIDE_LEFT_IN40 = _createSlideInX(40); -var SLIDE_LEFT_IN400 = _createSlideInX(400); -var SLIDE_UP_IN10 = _createSlideInY(10); -var SLIDE_UP_IN20 = _createSlideInY(20); -var SLIDE_DOWN_IN10 = _createSlideInY(-10); -var SLIDE_DOWN_IN20 = _createSlideInY(-20); -var SLIDE_RIGHT_OUT10 = _createSlideOutX(10); -var SLIDE_RIGHT_OUT20 = _createSlideOutX(20); -var SLIDE_RIGHT_OUT40 = _createSlideOutX(40); -var SLIDE_RIGHT_OUT400 = _createSlideOutX(400); -var SLIDE_LEFT_OUT10 = _createSlideOutX(-10); -var SLIDE_LEFT_OUT20 = _createSlideOutX(-20); -var SLIDE_LEFT_OUT40 = _createSlideOutX(-40); -var SLIDE_LEFT_OUT400 = _createSlideOutX(-400); -var SLIDE_UP_OUT10 = _createSlideOutY(-10); -var SLIDE_UP_OUT20 = _createSlideOutY(-20); -var SLIDE_DOWN_OUT10 = _createSlideOutY(10); -var SLIDE_DOWN_OUT20 = _createSlideOutY(20); -var SCALE_UP100 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(.98,.98,1)' - }, - to: { - transform: 'scale3d(1,1,1)' + } + var FocusRectsProvider = function(props) { + var providerRef = props.providerRef, layerRoot = props.layerRoot; + var registeredProviders = React__namespace.useState([])[0]; + var parentContext = React__namespace.useContext(FocusRectsContext); + var inheritParentContext = parentContext !== void 0 && !layerRoot; + var context2 = React__namespace.useMemo(function() { + return inheritParentContext ? void 0 : { + providerRef, + registeredProviders, + registerProvider: function(ref2) { + registeredProviders.push(ref2); + parentContext === null || parentContext === void 0 ? void 0 : parentContext.registerProvider(ref2); + }, + unregisterProvider: function(ref2) { + parentContext === null || parentContext === void 0 ? void 0 : parentContext.unregisterProvider(ref2); + var i = registeredProviders.indexOf(ref2); + if (i >= 0) { + registeredProviders.splice(i, 1); + } + } + }; + }, [providerRef, registeredProviders, parentContext, inheritParentContext]); + React__namespace.useEffect(function() { + if (context2) { + context2.registerProvider(context2.providerRef); + return function() { + return context2.unregisterProvider(context2.providerRef); + }; + } + }, [context2]); + if (context2) { + return React__namespace.createElement(FocusRectsContext.Provider, { value: context2 }, props.children); + } else { + return React__namespace.createElement(React__namespace.Fragment, null, props.children); + } + }; + function getItem(key2) { + var result = null; + try { + var win = getWindow(); + result = win ? win.localStorage.getItem(key2) : null; + } catch (e) { + } + return result; + } + var _language; + var STORAGE_KEY = "language"; + function getLanguage(persistenceType) { + if (persistenceType === void 0) { + persistenceType = "sessionStorage"; + } + if (_language === void 0) { + var doc = getDocument(); + var savedLanguage = persistenceType === "localStorage" ? getItem(STORAGE_KEY) : persistenceType === "sessionStorage" ? getItem$1(STORAGE_KEY) : void 0; + if (savedLanguage) { + _language = savedLanguage; + } + if (_language === void 0 && doc) { + _language = doc.documentElement.getAttribute("lang"); + } + if (_language === void 0) { + _language = "en"; + } } -}); -var SCALE_DOWN98 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(1,1,1)' - }, - to: { - transform: 'scale3d(.98,.98,1)' + return _language; + } + function merge$3(target2) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; } -}); -var SCALE_DOWN100 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(1.03,1.03,1)' - }, - to: { - transform: 'scale3d(1,1,1)' + for (var _a2 = 0, args_1 = args; _a2 < args_1.length; _a2++) { + var arg = args_1[_a2]; + _merge(target2 || {}, arg); } -}); -var SCALE_UP103 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'scale3d(1,1,1)' - }, - to: { - transform: 'scale3d(1.03,1.03,1)' + return target2; + } + function _merge(target2, source2, circularReferences) { + if (circularReferences === void 0) { + circularReferences = []; + } + circularReferences.push(source2); + for (var name_1 in source2) { + if (source2.hasOwnProperty(name_1)) { + if (name_1 !== "__proto__" && name_1 !== "constructor" && name_1 !== "prototype") { + var value2 = source2[name_1]; + if (typeof value2 === "object" && value2 !== null && !Array.isArray(value2)) { + var isCircularReference = circularReferences.indexOf(value2) > -1; + target2[name_1] = isCircularReference ? value2 : _merge(target2[name_1] || {}, value2, circularReferences); + } else { + target2[name_1] = value2; + } + } + } } -}); -var ROTATE90 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'rotateZ(0deg)' - }, - to: { - transform: 'rotateZ(90deg)' + circularReferences.pop(); + return target2; + } + var isIOS = function() { + if (!window || !window.navigator || !window.navigator.userAgent) { + return false; } -}); -var ROTATE_N90 = (0, _mergeStyles.keyframes)({ - from: { - transform: 'rotateZ(0deg)' - }, - to: { - transform: 'rotateZ(-90deg)' + return /iPad|iPhone|iPod/i.test(window.navigator.userAgent); + }; + var tagsToIgnore = ["TEMPLATE", "STYLE", "SCRIPT"]; + function modalize(target2) { + var targetDocument = getDocument(target2); + if (!targetDocument) { + return function() { + return void 0; + }; } -}); -var AnimationVariables = { - easeFunction1: EASING_FUNCTION_1, - easeFunction2: EASING_FUNCTION_2, - durationValue1: DURATION_1, - durationValue2: DURATION_2, - durationValue3: DURATION_3, - durationValue4: DURATION_4 -}; -var AnimationStyles = { - slideRightIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN10), DURATION_3, EASING_FUNCTION_1), - slideRightIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN20), DURATION_3, EASING_FUNCTION_1), - slideRightIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN40), DURATION_3, EASING_FUNCTION_1), - slideRightIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN400), DURATION_3, EASING_FUNCTION_1), - slideLeftIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN10), DURATION_3, EASING_FUNCTION_1), - slideLeftIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN20), DURATION_3, EASING_FUNCTION_1), - slideLeftIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN40), DURATION_3, EASING_FUNCTION_1), - slideLeftIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN400), DURATION_3, EASING_FUNCTION_1), - slideUpIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN10), DURATION_3, EASING_FUNCTION_1), - slideUpIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN20), DURATION_3, EASING_FUNCTION_1), - slideDownIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN10), DURATION_3, EASING_FUNCTION_1), - slideDownIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN20), DURATION_3, EASING_FUNCTION_1), - slideRightOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT10), DURATION_3, EASING_FUNCTION_1), - slideRightOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT20), DURATION_3, EASING_FUNCTION_1), - slideRightOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT40), DURATION_3, EASING_FUNCTION_1), - slideRightOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT400), DURATION_3, EASING_FUNCTION_1), - slideLeftOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT10), DURATION_3, EASING_FUNCTION_1), - slideLeftOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT20), DURATION_3, EASING_FUNCTION_1), - slideLeftOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT40), DURATION_3, EASING_FUNCTION_1), - slideLeftOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT400), DURATION_3, EASING_FUNCTION_1), - slideUpOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT10), DURATION_3, EASING_FUNCTION_1), - slideUpOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT20), DURATION_3, EASING_FUNCTION_1), - slideDownOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT10), DURATION_3, EASING_FUNCTION_1), - slideDownOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT20), DURATION_3, EASING_FUNCTION_1), - scaleUpIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_UP100), DURATION_3, EASING_FUNCTION_1), - scaleDownIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_DOWN100), DURATION_3, EASING_FUNCTION_1), - scaleUpOut103: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_UP103), DURATION_1, EASING_FUNCTION_2), - scaleDownOut98: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_DOWN98), DURATION_1, EASING_FUNCTION_2), - fadeIn100: _createAnimation(FADE_IN, DURATION_1, EASING_FUNCTION_2), - fadeIn200: _createAnimation(FADE_IN, DURATION_2, EASING_FUNCTION_2), - fadeIn400: _createAnimation(FADE_IN, DURATION_3, EASING_FUNCTION_2), - fadeIn500: _createAnimation(FADE_IN, DURATION_4, EASING_FUNCTION_2), - fadeOut100: _createAnimation(FADE_OUT, DURATION_1, EASING_FUNCTION_2), - fadeOut200: _createAnimation(FADE_OUT, DURATION_2, EASING_FUNCTION_2), - fadeOut400: _createAnimation(FADE_OUT, DURATION_3, EASING_FUNCTION_2), - fadeOut500: _createAnimation(FADE_OUT, DURATION_4, EASING_FUNCTION_2), - rotate90deg: _createAnimation(ROTATE90, '0.1s', EASING_FUNCTION_2), - rotateN90deg: _createAnimation(ROTATE_N90, '0.1s', EASING_FUNCTION_2) -}; -function _createAnimation(animationName, animationDuration, animationTimingFunction) { - return { - animationName: animationName, - animationDuration: animationDuration, - animationTimingFunction: animationTimingFunction, - animationFillMode: 'both' - }; -} -function _createSlideInX(fromX) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(".concat(fromX, "px,0,0)"), - pointerEvents: 'none' - }, - to: { - transform: "translate3d(0,0,0)", - pointerEvents: 'auto' - } - }); -} -function _createSlideInY(fromY) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(0,".concat(fromY, "px,0)"), - pointerEvents: 'none' - }, - to: { - transform: "translate3d(0,0,0)", - pointerEvents: 'auto' - } - }); -} -function _createSlideOutX(toX) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(0,0,0)" - }, - to: { - transform: "translate3d(".concat(toX, "px,0,0)") - } - }); -} -function _createSlideOutY(toY) { - return (0, _mergeStyles.keyframes)({ - from: { - transform: "translate3d(0,0,0)" - }, - to: { - transform: "translate3d(0,".concat(toY, "px,0)") + var affectedNodes = []; + while (target2 !== targetDocument.body && target2.parentElement) { + for (var _i = 0, _a2 = target2.parentElement.children; _i < _a2.length; _i++) { + var sibling = _a2[_i]; + var ariaHidden = sibling.getAttribute("aria-hidden"); + if (sibling !== target2 && (ariaHidden === null || ariaHidden === void 0 ? void 0 : ariaHidden.toLowerCase()) !== "true" && tagsToIgnore.indexOf(sibling.tagName) === -1) { + affectedNodes.push([sibling, ariaHidden]); } - }); -} - -},{"@fluentui/merge-styles":"bDG2L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cXCfS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _createFontStyles.createFontStyles)); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>(0, _defaultFontStyles.DefaultFontStyles)); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>(0, _defaultFontStyles.registerDefaultFontFaces)); -var _fluentFonts = require("./FluentFonts"); -parcelHelpers.exportAll(_fluentFonts, exports); -var _createFontStyles = require("./createFontStyles"); -var _defaultFontStyles = require("./DefaultFontStyles"); - -},{"./FluentFonts":"2xotE","./createFontStyles":false,"./DefaultFontStyles":"9DzCb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2xotE":[function(require,module,exports,__globalThis) { -// Font face names to be registered. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalizedFontNames", ()=>LocalizedFontNames); -parcelHelpers.export(exports, "LocalizedFontFamilies", ()=>LocalizedFontFamilies); -parcelHelpers.export(exports, "FontSizes", ()=>FontSizes); -parcelHelpers.export(exports, "FontWeights", ()=>FontWeights); -parcelHelpers.export(exports, "IconFontSizes", ()=>IconFontSizes); -var LocalizedFontNames; -(function(LocalizedFontNames) { - LocalizedFontNames.Arabic = 'Segoe UI Web (Arabic)'; - LocalizedFontNames.Cyrillic = 'Segoe UI Web (Cyrillic)'; - LocalizedFontNames.EastEuropean = 'Segoe UI Web (East European)'; - LocalizedFontNames.Greek = 'Segoe UI Web (Greek)'; - LocalizedFontNames.Hebrew = 'Segoe UI Web (Hebrew)'; - LocalizedFontNames.Thai = 'Leelawadee UI Web'; - LocalizedFontNames.Vietnamese = 'Segoe UI Web (Vietnamese)'; - LocalizedFontNames.WestEuropean = 'Segoe UI Web (West European)'; - LocalizedFontNames.Selawik = 'Selawik Web'; - LocalizedFontNames.Armenian = 'Segoe UI Web (Armenian)'; - LocalizedFontNames.Georgian = 'Segoe UI Web (Georgian)'; -})(LocalizedFontNames || (LocalizedFontNames = {})); -var LocalizedFontFamilies; -(function(LocalizedFontFamilies) { - LocalizedFontFamilies.Arabic = "'".concat(LocalizedFontNames.Arabic, "'"); - LocalizedFontFamilies.ChineseSimplified = "'Microsoft Yahei UI', Verdana, Simsun"; - LocalizedFontFamilies.ChineseTraditional = "'Microsoft Jhenghei UI', Pmingliu"; - LocalizedFontFamilies.Cyrillic = "'".concat(LocalizedFontNames.Cyrillic, "'"); - LocalizedFontFamilies.EastEuropean = "'".concat(LocalizedFontNames.EastEuropean, "'"); - LocalizedFontFamilies.Greek = "'".concat(LocalizedFontNames.Greek, "'"); - LocalizedFontFamilies.Hebrew = "'".concat(LocalizedFontNames.Hebrew, "'"); - LocalizedFontFamilies.Hindi = "'Nirmala UI'"; - LocalizedFontFamilies.Japanese = "'Yu Gothic UI', 'Meiryo UI', Meiryo, 'MS Pgothic', Osaka"; - LocalizedFontFamilies.Korean = "'Malgun Gothic', Gulim"; - LocalizedFontFamilies.Selawik = "'".concat(LocalizedFontNames.Selawik, "'"); - LocalizedFontFamilies.Thai = "'Leelawadee UI Web', 'Kmer UI'"; - LocalizedFontFamilies.Vietnamese = "'".concat(LocalizedFontNames.Vietnamese, "'"); - LocalizedFontFamilies.WestEuropean = "'".concat(LocalizedFontNames.WestEuropean, "'"); - LocalizedFontFamilies.Armenian = "'".concat(LocalizedFontNames.Armenian, "'"); - LocalizedFontFamilies.Georgian = "'".concat(LocalizedFontNames.Georgian, "'"); -})(LocalizedFontFamilies || (LocalizedFontFamilies = {})); -var FontSizes; -(function(FontSizes) { - FontSizes.size10 = '10px'; - FontSizes.size12 = '12px'; - FontSizes.size14 = '14px'; - FontSizes.size16 = '16px'; - FontSizes.size18 = '18px'; - FontSizes.size20 = '20px'; - FontSizes.size24 = '24px'; - FontSizes.size28 = '28px'; - FontSizes.size32 = '32px'; - FontSizes.size42 = '42px'; - FontSizes.size68 = '68px'; - FontSizes.mini = '10px'; - FontSizes.xSmall = '10px'; - FontSizes.small = '12px'; - FontSizes.smallPlus = '12px'; - FontSizes.medium = '14px'; - FontSizes.mediumPlus = '16px'; - FontSizes.icon = '16px'; - FontSizes.large = '18px'; - FontSizes.xLarge = '20px'; - FontSizes.xLargePlus = '24px'; - FontSizes.xxLarge = '28px'; - FontSizes.xxLargePlus = '32px'; - FontSizes.superLarge = '42px'; - FontSizes.mega = '68px'; -})(FontSizes || (FontSizes = {})); -var FontWeights; -(function(FontWeights) { - FontWeights.light = 100; - FontWeights.semilight = 300; - FontWeights.regular = 400; - FontWeights.semibold = 600; - FontWeights.bold = 700; -})(FontWeights || (FontWeights = {})); -var IconFontSizes; -(function(IconFontSizes) { - IconFontSizes.xSmall = '10px'; - IconFontSizes.small = '12px'; - IconFontSizes.medium = '16px'; - IconFontSizes.large = '20px'; -})(IconFontSizes || (IconFontSizes = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gXPWQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createFontStyles", ()=>createFontStyles); -var _fluentFonts = require("./FluentFonts"); -// Fallback fonts, if specified system or web fonts are unavailable. -var FontFamilyFallbacks = "'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif"; -// By default, we favor system fonts for the default. -// All localized fonts use a web font and never use the system font. -var defaultFontFamily = "'Segoe UI', '".concat((0, _fluentFonts.LocalizedFontNames).WestEuropean, "'"); -// Mapping of language prefix to to font family. -var LanguageToFontMap = { - ar: (0, _fluentFonts.LocalizedFontFamilies).Arabic, - bg: (0, _fluentFonts.LocalizedFontFamilies).Cyrillic, - cs: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - el: (0, _fluentFonts.LocalizedFontFamilies).Greek, - et: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - he: (0, _fluentFonts.LocalizedFontFamilies).Hebrew, - hi: (0, _fluentFonts.LocalizedFontFamilies).Hindi, - hr: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - hu: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - ja: (0, _fluentFonts.LocalizedFontFamilies).Japanese, - kk: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - ko: (0, _fluentFonts.LocalizedFontFamilies).Korean, - lt: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - lv: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - pl: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - ru: (0, _fluentFonts.LocalizedFontFamilies).Cyrillic, - sk: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - 'sr-latn': (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - th: (0, _fluentFonts.LocalizedFontFamilies).Thai, - tr: (0, _fluentFonts.LocalizedFontFamilies).EastEuropean, - uk: (0, _fluentFonts.LocalizedFontFamilies).Cyrillic, - vi: (0, _fluentFonts.LocalizedFontFamilies).Vietnamese, - 'zh-hans': (0, _fluentFonts.LocalizedFontFamilies).ChineseSimplified, - 'zh-hant': (0, _fluentFonts.LocalizedFontFamilies).ChineseTraditional, - hy: (0, _fluentFonts.LocalizedFontFamilies).Armenian, - ka: (0, _fluentFonts.LocalizedFontFamilies).Georgian -}; -function _fontFamilyWithFallbacks(fontFamily) { - return "".concat(fontFamily, ", ").concat(FontFamilyFallbacks); -} -/** - * If there is a localized font for this language, return that. - * Returns undefined if there is no localized font for that language. - */ function _getLocalizedFontFamily(language) { - for(var lang in LanguageToFontMap){ - if (LanguageToFontMap.hasOwnProperty(lang) && language && lang.indexOf(language) === 0) // eslint-disable-next-line @typescript-eslint/no-explicit-any - return LanguageToFontMap[lang]; + } + target2 = target2.parentElement; } - return defaultFontFamily; -} -function _createFont(size, weight, fontFamily) { - return { - fontFamily: fontFamily, - MozOsxFontSmoothing: 'grayscale', - WebkitFontSmoothing: 'antialiased', - fontSize: size, - fontWeight: weight - }; -} -function createFontStyles(localeCode) { - var localizedFont = _getLocalizedFontFamily(localeCode); - var fontFamilyWithFallback = _fontFamilyWithFallbacks(localizedFont); - var fontStyles = { - tiny: _createFont((0, _fluentFonts.FontSizes).mini, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - xSmall: _createFont((0, _fluentFonts.FontSizes).xSmall, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - small: _createFont((0, _fluentFonts.FontSizes).small, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - smallPlus: _createFont((0, _fluentFonts.FontSizes).smallPlus, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - medium: _createFont((0, _fluentFonts.FontSizes).medium, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - mediumPlus: _createFont((0, _fluentFonts.FontSizes).mediumPlus, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - large: _createFont((0, _fluentFonts.FontSizes).large, (0, _fluentFonts.FontWeights).regular, fontFamilyWithFallback), - xLarge: _createFont((0, _fluentFonts.FontSizes).xLarge, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - xLargePlus: _createFont((0, _fluentFonts.FontSizes).xLargePlus, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - xxLarge: _createFont((0, _fluentFonts.FontSizes).xxLarge, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - xxLargePlus: _createFont((0, _fluentFonts.FontSizes).xxLargePlus, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - superLarge: _createFont((0, _fluentFonts.FontSizes).superLarge, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback), - mega: _createFont((0, _fluentFonts.FontSizes).mega, (0, _fluentFonts.FontWeights).semibold, fontFamilyWithFallback) - }; - return fontStyles; -} - -},{"./FluentFonts":"2xotE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9DzCb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultFontStyles", ()=>DefaultFontStyles); -parcelHelpers.export(exports, "registerDefaultFontFaces", ()=>registerDefaultFontFaces); -var _mergeStyles = require("@fluentui/merge-styles"); -var _fluentFonts = require("./FluentFonts"); -var _createFontStyles = require("./createFontStyles"); -var _utilities = require("@fluentui/utilities"); -// Default urls. -var DefaultBaseUrl = 'https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets'; -var DefaultFontStyles = (0, _createFontStyles.createFontStyles)((0, _utilities.getLanguage)()); -function _registerFontFace(fontFamily, url, fontWeight, localFontName) { - fontFamily = "'".concat(fontFamily, "'"); - var localFontSrc = localFontName !== undefined ? "local('".concat(localFontName, "'),") : ''; - (0, _mergeStyles.fontFace)({ - fontFamily: fontFamily, - src: localFontSrc + "url('".concat(url, ".woff2') format('woff2'),") + "url('".concat(url, ".woff') format('woff')"), - fontWeight: fontWeight, - fontStyle: 'normal', - fontDisplay: 'swap' - }); -} -function _registerFontFaceSet(baseUrl, fontFamily, cdnFolder, cdnFontName, localFontName) { - if (cdnFontName === void 0) cdnFontName = 'segoeui'; - var urlBase = "".concat(baseUrl, "/").concat(cdnFolder, "/").concat(cdnFontName); - _registerFontFace(fontFamily, urlBase + '-light', (0, _fluentFonts.FontWeights).light, localFontName && localFontName + ' Light'); - _registerFontFace(fontFamily, urlBase + '-semilight', (0, _fluentFonts.FontWeights).semilight, localFontName && localFontName + ' SemiLight'); - _registerFontFace(fontFamily, urlBase + '-regular', (0, _fluentFonts.FontWeights).regular, localFontName); - _registerFontFace(fontFamily, urlBase + '-semibold', (0, _fluentFonts.FontWeights).semibold, localFontName && localFontName + ' SemiBold'); - _registerFontFace(fontFamily, urlBase + '-bold', (0, _fluentFonts.FontWeights).bold, localFontName && localFontName + ' Bold'); -} -function registerDefaultFontFaces(baseUrl) { - if (baseUrl) { - var fontUrl = "".concat(baseUrl, "/fonts"); - // Produce @font-face definitions for all supported web fonts. - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Thai, 'leelawadeeui-thai', 'leelawadeeui'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Arabic, 'segoeui-arabic'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Cyrillic, 'segoeui-cyrillic'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).EastEuropean, 'segoeui-easteuropean'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Greek, 'segoeui-greek'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Hebrew, 'segoeui-hebrew'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Vietnamese, 'segoeui-vietnamese'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).WestEuropean, 'segoeui-westeuropean', 'segoeui', 'Segoe UI'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontFamilies).Selawik, 'selawik', 'selawik'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Armenian, 'segoeui-armenian'); - _registerFontFaceSet(fontUrl, (0, _fluentFonts.LocalizedFontNames).Georgian, 'segoeui-georgian'); - // Leelawadee UI (Thai) does not have a 'light' weight, so we override - // the font-face generated above to use the 'semilight' weight instead. - _registerFontFace('Leelawadee UI Web', "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-semilight"), (0, _fluentFonts.FontWeights).light); - // Leelawadee UI (Thai) does not have a 'semibold' weight, so we override - // the font-face generated above to use the 'bold' weight instead. - _registerFontFace('Leelawadee UI Web', "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-bold"), (0, _fluentFonts.FontWeights).semibold); - } -} -/** - * Reads the fontBaseUrl from window.FabricConfig.fontBaseUrl or falls back to a default. - */ function _getFontBaseUrl() { - var _a, _b; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var fabricConfig = (_a = (0, _utilities.getWindow)()) === null || _a === void 0 ? void 0 : _a.FabricConfig; - return (_b = fabricConfig === null || fabricConfig === void 0 ? void 0 : fabricConfig.fontBaseUrl) !== null && _b !== void 0 ? _b : DefaultBaseUrl; -} -/** - * Register the font faces. - */ registerDefaultFontFaces(_getFontBaseUrl()); - -},{"@fluentui/merge-styles":"bDG2L","./FluentFonts":"2xotE","./createFontStyles":"gXPWQ","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"91iV5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Creates a custom theme definition. - * @param theme - Partial theme object. - * @param depComments - Whether to include deprecated tags as comments for deprecated slots. - */ parcelHelpers.export(exports, "createTheme", ()=>createTheme); -var _index = require("./colors/index"); -var _index1 = require("./effects/index"); -var _index2 = require("./fonts/index"); -var _mergeThemes = require("./mergeThemes"); -var _index3 = require("./spacing/index"); -var _makeSemanticColors = require("./utilities/makeSemanticColors"); -function createTheme(theme, depComments) { - if (theme === void 0) theme = {}; - if (depComments === void 0) depComments = false; - var isInverted = !!theme.isInverted; - var baseTheme = { - palette: (0, _index.DefaultPalette), - effects: (0, _index1.DefaultEffects), - fonts: (0, _index2.DefaultFontStyles), - spacing: (0, _index3.DefaultSpacing), - isInverted: isInverted, - disableGlobalClassNames: false, - semanticColors: (0, _makeSemanticColors.makeSemanticColors)((0, _index.DefaultPalette), (0, _index1.DefaultEffects), undefined, isInverted, depComments), - rtl: undefined - }; - return (0, _mergeThemes.mergeThemes)(baseTheme, theme); -} - -},{"./colors/index":"7yAiX","./effects/index":"2nXfK","./fonts/index":"cXCfS","./mergeThemes":"j9270","./spacing/index":"82zHh","./utilities/makeSemanticColors":"dsk6N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dCgRo":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/theme', '2.6.63'); - -},{"@fluentui/set-version":"iqYXf"}],"Tr1M8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalizedFontNames", ()=>(0, _theme.LocalizedFontNames)); -parcelHelpers.export(exports, "LocalizedFontFamilies", ()=>(0, _theme.LocalizedFontFamilies)); -parcelHelpers.export(exports, "FontSizes", ()=>(0, _theme.FontSizes)); -parcelHelpers.export(exports, "FontWeights", ()=>(0, _theme.FontWeights)); -parcelHelpers.export(exports, "IconFontSizes", ()=>(0, _theme.IconFontSizes)); -parcelHelpers.export(exports, "createFontStyles", ()=>(0, _theme.createFontStyles)); -var _theme = require("@fluentui/theme"); - -},{"@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"byDYo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getFocusStyle", ()=>getFocusStyle); -/** - * Generates style to clear browser specific focus styles. - */ parcelHelpers.export(exports, "focusClear", ()=>focusClear); -/** - * Generates a style which can be used to set a border on focus. - * - * @param theme - The theme object to use. - * @param inset - The number of pixels to inset the border (default 0) - * @param width - The border width in pixels (default 1) - * @param color - Color of the outline (default `theme.palette.neutralSecondary`) - * @returns The style object. - */ parcelHelpers.export(exports, "getFocusOutlineStyle", ()=>getFocusOutlineStyle); -parcelHelpers.export(exports, "getInputFocusStyle", ()=>getInputFocusStyle); -var _commonStyles = require("./CommonStyles"); -var _utilities = require("@fluentui/utilities"); -var _zIndexes = require("./zIndexes"); -function getFocusStyle(theme, insetOrOptions, position, highContrastStyle, borderColor, outlineColor, isFocusedOnly, borderRadius) { - if (typeof insetOrOptions === 'number' || !insetOrOptions) return _getFocusStyleInternal(theme, { - inset: insetOrOptions, - position: position, - highContrastStyle: highContrastStyle, - borderColor: borderColor, - outlineColor: outlineColor, - isFocusedOnly: isFocusedOnly, - borderRadius: borderRadius + affectedNodes.forEach(function(_a3) { + var node = _a3[0]; + node.setAttribute("aria-hidden", "true"); }); - else return _getFocusStyleInternal(theme, insetOrOptions); -} -function _getFocusStyleInternal(theme, options) { - var _a, _b; - if (options === void 0) options = {}; - var borderRadius = options.borderRadius, _c = options.inset, inset = _c === void 0 ? 0 : _c, _d = options.width, width = _d === void 0 ? 1 : _d, _e = options.position, position = _e === void 0 ? 'relative' : _e, highContrastStyle = options.highContrastStyle, _f = options.borderColor, borderColor = _f === void 0 ? theme.palette.white : _f, _g = options.outlineColor, outlineColor = _g === void 0 ? theme.palette.neutralSecondary : _g, _h = options.isFocusedOnly, isFocusedOnly = _h === void 0 ? true : _h, pointerEvents = options.pointerEvents; - return { - // Clear browser-specific focus styles and use 'transparent' as placeholder for focus style. - outline: 'transparent', - // Requirement because pseudo-element is absolutely positioned. - position: position, - selectors: (_a = { - // Clear the focus border in Firefox. - // Reference: http://stackoverflow.com/a/199319/1436671 - '::-moz-focus-inner': { - border: '0' - } - }, // When the element that uses this mixin is in a :focus state, add a pseudo-element to - // create a border. - _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &").concat(isFocusedOnly ? ':focus' : '', ":after, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &").concat(isFocusedOnly ? ':focus' : '', ":after")] = { - content: '""', - position: 'absolute', - pointerEvents: pointerEvents, - left: inset + 1, - top: inset + 1, - bottom: inset + 1, - right: inset + 1, - border: "".concat(width, "px solid ").concat(borderColor), - outline: "".concat(width, "px solid ").concat(outlineColor), - zIndex: (0, _zIndexes.ZIndexes).FocusStyle, - borderRadius: borderRadius, - selectors: (_b = {}, _b[0, _commonStyles.HighContrastSelector] = highContrastStyle, _b) - }, _a) - }; -} -function focusClear() { - return { - selectors: { - '&::-moz-focus-inner': { - // Clear the focus border in Firefox. Reference: http://stackoverflow.com/a/199319/1436671 - border: 0 - }, - '&': { - // Clear browser specific focus styles and use transparent as placeholder for focus style - outline: 'transparent' - } - } + return function() { + unmodalize(affectedNodes); + affectedNodes = []; }; -} -function getFocusOutlineStyle(theme, inset, width, color) { - var _a; - if (inset === void 0) inset = 0; - if (width === void 0) width = 1; - return { - selectors: (_a = {}, _a[":global(".concat((0, _utilities.IsFocusVisibleClassName), ") &:focus")] = { - outline: "".concat(width, " solid ").concat(color || theme.palette.neutralSecondary), - outlineOffset: "".concat(-inset, "px") - }, _a) - }; -} -var getInputFocusStyle = function(borderColor, borderRadius, borderType, borderPosition) { - var _a, _b, _c; - if (borderType === void 0) borderType = 'border'; - if (borderPosition === void 0) borderPosition = -1; - var isBorderBottom = borderType === 'borderBottom'; - return { - borderColor: borderColor, - selectors: { - ':after': (_a = { - pointerEvents: 'none', - content: "''", - position: 'absolute', - left: isBorderBottom ? 0 : borderPosition, - top: borderPosition, - bottom: borderPosition, - right: isBorderBottom ? 0 : borderPosition - }, _a[borderType] = "2px solid ".concat(borderColor), _a.borderRadius = borderRadius, _a.width = borderType === 'borderBottom' ? '100%' : undefined, _a.selectors = (_b = {}, _b[0, _commonStyles.HighContrastSelector] = (_c = {}, _c[borderType === 'border' ? 'borderColor' : 'borderBottomColor'] = 'Highlight', _c), _b), _a) - } - }; -}; - -},{"./CommonStyles":"rgkn6","@fluentui/utilities":"55bj3","./zIndexes":"hDsdg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"rgkn6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HighContrastSelector", ()=>HighContrastSelector); -parcelHelpers.export(exports, "HighContrastSelectorWhite", ()=>HighContrastSelectorWhite); -parcelHelpers.export(exports, "HighContrastSelectorBlack", ()=>HighContrastSelectorBlack); -parcelHelpers.export(exports, "EdgeChromiumHighContrastSelector", ()=>EdgeChromiumHighContrastSelector); -parcelHelpers.export(exports, "ScreenWidthMinSmall", ()=>ScreenWidthMinSmall); -parcelHelpers.export(exports, "ScreenWidthMinMedium", ()=>ScreenWidthMinMedium); -parcelHelpers.export(exports, "ScreenWidthMinLarge", ()=>ScreenWidthMinLarge); -parcelHelpers.export(exports, "ScreenWidthMinXLarge", ()=>ScreenWidthMinXLarge); -parcelHelpers.export(exports, "ScreenWidthMinXXLarge", ()=>ScreenWidthMinXXLarge); -parcelHelpers.export(exports, "ScreenWidthMinXXXLarge", ()=>ScreenWidthMinXXXLarge); -parcelHelpers.export(exports, "ScreenWidthMaxSmall", ()=>ScreenWidthMaxSmall); -parcelHelpers.export(exports, "ScreenWidthMaxMedium", ()=>ScreenWidthMaxMedium); -parcelHelpers.export(exports, "ScreenWidthMaxLarge", ()=>ScreenWidthMaxLarge); -parcelHelpers.export(exports, "ScreenWidthMaxXLarge", ()=>ScreenWidthMaxXLarge); -parcelHelpers.export(exports, "ScreenWidthMaxXXLarge", ()=>ScreenWidthMaxXXLarge); -parcelHelpers.export(exports, "ScreenWidthMinUhfMobile", ()=>ScreenWidthMinUhfMobile); -parcelHelpers.export(exports, "getScreenSelector", ()=>getScreenSelector); -/** - * The style which turns off high contrast adjustment in browsers. - */ parcelHelpers.export(exports, "getHighContrastNoAdjustStyle", ()=>getHighContrastNoAdjustStyle); -/** - * The style which turns off high contrast adjustment in (only) Edge Chromium browser. - * @deprecated Use `getHighContrastNoAdjustStyle` - */ // eslint-disable-next-line deprecation/deprecation -parcelHelpers.export(exports, "getEdgeChromiumNoHighContrastAdjustSelector", ()=>getEdgeChromiumNoHighContrastAdjustSelector); -var HighContrastSelector = '@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)'; -var HighContrastSelectorWhite = // eslint-disable-next-line @fluentui/max-len -'@media screen and (-ms-high-contrast: black-on-white), screen and (forced-colors: active) and (prefers-color-scheme: light)'; -var HighContrastSelectorBlack = // eslint-disable-next-line @fluentui/max-len -'@media screen and (-ms-high-contrast: white-on-black), screen and (forced-colors: active) and (prefers-color-scheme: dark)'; -var EdgeChromiumHighContrastSelector = '@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)'; -var ScreenWidthMinSmall = 320; -var ScreenWidthMinMedium = 480; -var ScreenWidthMinLarge = 640; -var ScreenWidthMinXLarge = 1024; -var ScreenWidthMinXXLarge = 1366; -var ScreenWidthMinXXXLarge = 1920; -var ScreenWidthMaxSmall = ScreenWidthMinMedium - 1; -var ScreenWidthMaxMedium = ScreenWidthMinLarge - 1; -var ScreenWidthMaxLarge = ScreenWidthMinXLarge - 1; -var ScreenWidthMaxXLarge = ScreenWidthMinXXLarge - 1; -var ScreenWidthMaxXXLarge = ScreenWidthMinXXXLarge - 1; -var ScreenWidthMinUhfMobile = 768; -function getScreenSelector(min, max) { - var minSelector = typeof min === 'number' ? " and (min-width: ".concat(min, "px)") : ''; - var maxSelector = typeof max === 'number' ? " and (max-width: ".concat(max, "px)") : ''; - return "@media only screen".concat(minSelector).concat(maxSelector); -} -function getHighContrastNoAdjustStyle() { - return { - forcedColorAdjust: 'none', - MsHighContrastAdjust: 'none' - }; -} -function getEdgeChromiumNoHighContrastAdjustSelector() { - var _a; - return _a = {}, // eslint-disable-next-line deprecation/deprecation - _a[EdgeChromiumHighContrastSelector] = { - forcedColorAdjust: 'none', - MsHighContrastAdjust: 'none' - }, _a; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hDsdg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ZIndexes", ()=>ZIndexes); -var ZIndexes; -(function(ZIndexes) { - ZIndexes.Nav = 1; - /** - * @deprecated Do not use - */ ZIndexes.ScrollablePane = 1; - ZIndexes.FocusStyle = 1; - ZIndexes.Coachmark = 1000; - ZIndexes.Layer = 1000000; - ZIndexes.KeytipLayer = 1000001; -})(ZIndexes || (ZIndexes = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"furJc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hiddenContentStyle", ()=>hiddenContentStyle); -var hiddenContentStyle = { - position: 'absolute', - width: 1, - height: 1, - margin: -1, - padding: 0, - border: 0, - overflow: 'hidden', - whiteSpace: 'nowrap' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g6mIZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Checks for the `disableGlobalClassNames` property on the `theme` to determine if it should return `classNames` - * Note that calls to this function are memoized. - * - * @param classNames - The collection of global class names that apply when the flag is false. Make sure to pass in - * the same instance on each call to benefit from memoization. - * @param theme - The theme to check the flag on - * @param disableGlobalClassNames - Optional. Explicitly opt in/out of disabling global classnames. Defaults to false. - */ parcelHelpers.export(exports, "getGlobalClassNames", ()=>getGlobalClassNames); -var _mergeStyles = require("@fluentui/merge-styles"); -var _utilities = require("@fluentui/utilities"); -/** - * Internal memoized function which simply takes in the class map and the - * disable boolean. These immutable values can be memoized. - */ var _getGlobalClassNames = (0, _utilities.memoizeFunction)(function(classNames, disableGlobalClassNames) { - var styleSheet = (0, _mergeStyles.Stylesheet).getInstance(); - if (disableGlobalClassNames) // disable global classnames - return Object.keys(classNames).reduce(function(acc, className) { - acc[className] = styleSheet.getClassName(classNames[className]); - return acc; - }, {}); - // use global classnames - return classNames; -}); -function getGlobalClassNames(classNames, theme, disableGlobalClassNames) { - return _getGlobalClassNames(classNames, disableGlobalClassNames !== undefined ? disableGlobalClassNames : theme.disableGlobalClassNames); -} - -},{"@fluentui/merge-styles":"bDG2L","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"uuyP7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createTheme", ()=>(0, _theme.createTheme)); -parcelHelpers.export(exports, "ThemeSettingName", ()=>ThemeSettingName); -parcelHelpers.export(exports, "initializeThemeInCustomizations", ()=>initializeThemeInCustomizations); -/** - * Gets the theme object - * @param depComments - Whether to include deprecated tags as comments for deprecated slots. - */ parcelHelpers.export(exports, "getTheme", ()=>getTheme); -/** - * Registers a callback that gets called whenever the theme changes. - * This should only be used when the component cannot automatically get theme changes through its state. - * This will not register duplicate callbacks. - */ parcelHelpers.export(exports, "registerOnThemeChangeCallback", ()=>registerOnThemeChangeCallback); -/** - * See registerOnThemeChangeCallback(). - * Removes previously registered callbacks. - */ parcelHelpers.export(exports, "removeOnThemeChangeCallback", ()=>removeOnThemeChangeCallback); -/** - * Applies the theme, while filling in missing slots. - * @param theme - Partial theme object. - * @param depComments - Whether to include deprecated tags as comments for deprecated slots. - */ parcelHelpers.export(exports, "loadTheme", ()=>loadTheme); -var _tslib = require("tslib"); -var _utilities = require("@fluentui/utilities"); -var _loadThemedStyles = require("@microsoft/load-themed-styles"); -var _theme = require("@fluentui/theme"); -var _theme1 = (0, _theme.createTheme)({}); -var _onThemeChangeCallbacks = []; -var ThemeSettingName = 'theme'; -function initializeThemeInCustomizations() { - var _a; - var _b, _c; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - var win = (0, _utilities.getWindow)(); - if ((_b = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _b === void 0 ? void 0 : _b.legacyTheme) // does everything the `else` clause does and more, such as invoke legacy theming - loadTheme(win.FabricConfig.legacyTheme); - else if (!(0, _utilities.Customizations).getSettings([ - ThemeSettingName - ]).theme) { - if ((_c = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _c === void 0 ? void 0 : _c.theme) _theme1 = (0, _theme.createTheme)(win.FabricConfig.theme); - // Set the default theme. - (0, _utilities.Customizations).applySettings((_a = {}, _a[ThemeSettingName] = _theme1, _a)); - } -} -initializeThemeInCustomizations(); -function getTheme(depComments) { - if (depComments === void 0) depComments = false; - if (depComments === true) _theme1 = (0, _theme.createTheme)({}, depComments); - return _theme1; -} -function registerOnThemeChangeCallback(callback) { - if (_onThemeChangeCallbacks.indexOf(callback) === -1) _onThemeChangeCallbacks.push(callback); -} -function removeOnThemeChangeCallback(callback) { - var i = _onThemeChangeCallbacks.indexOf(callback); - if (i === -1) return; - _onThemeChangeCallbacks.splice(i, 1); -} -function loadTheme(theme, depComments) { - var _a; - if (depComments === void 0) depComments = false; - _theme1 = (0, _theme.createTheme)(theme, depComments); - // Invoke the legacy method of theming the page as well. - (0, _loadThemedStyles.loadTheme)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, _theme1.palette), _theme1.semanticColors), _theme1.effects), _loadFonts(_theme1))); - (0, _utilities.Customizations).applySettings((_a = {}, _a[ThemeSettingName] = _theme1, _a)); - _onThemeChangeCallbacks.forEach(function(callback) { - try { - callback(_theme1); - } catch (e) { - // don't let a bad callback break everything else - } + } + function unmodalize(affectedNodes) { + affectedNodes.forEach(function(_a2) { + var node = _a2[0], originalValue = _a2[1]; + if (originalValue) { + node.setAttribute("aria-hidden", originalValue); + } else { + node.removeAttribute("aria-hidden"); + } }); - return _theme1; -} -/** - * Loads font variables into a JSON object. - * @param theme - The theme object - */ function _loadFonts(theme) { - var lines = {}; - for(var _i = 0, _a = Object.keys(theme.fonts); _i < _a.length; _i++){ - var fontName = _a[_i]; - var font = theme.fonts[fontName]; - for(var _b = 0, _c = Object.keys(font); _b < _c.length; _b++){ - var propName = _c[_b]; - var name_1 = fontName + propName.charAt(0).toUpperCase() + propName.slice(1); - var value = font[propName]; - if (propName === 'fontSize' && typeof value === 'number') // if it's a number, convert it to px by default like our theming system does - value = value + 'px'; - lines[name_1] = value; - } + } + var isMacResult; + function isMac(reset2) { + var _a2; + if (typeof isMacResult === "undefined" || reset2) { + var win = getWindow(); + var userAgent = (_a2 = win === null || win === void 0 ? void 0 : win.navigator) === null || _a2 === void 0 ? void 0 : _a2.userAgent; + isMacResult = !!userAgent && userAgent.indexOf("Macintosh") !== -1; } - return lines; -} - -},{"tslib":"9gizs","@fluentui/utilities":"55bj3","@microsoft/load-themed-styles":"eP2p8","@fluentui/theme":"6MuB2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eP2p8":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -// See LICENSE in the project root for license information. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Loads a set of style text. If it is registered too early, we will register it when the window.load - * event is fired. - * @param {string | ThemableArray} styles Themable style text to register. - * @param {boolean} loadAsync When true, always load styles in async mode, irrespective of current sync mode. - */ parcelHelpers.export(exports, "loadStyles", ()=>loadStyles); -/** - * Allows for customizable loadStyles logic. e.g. for server side rendering application - * @param {(processedStyles: string, rawStyles?: string | ThemableArray) => void} - * a loadStyles callback that gets called when styles are loaded or reloaded - */ parcelHelpers.export(exports, "configureLoadStyles", ()=>configureLoadStyles); -/** - * Configure run mode of load-themable-styles - * @param mode load-themable-styles run mode, async or sync - */ parcelHelpers.export(exports, "configureRunMode", ()=>configureRunMode); -/** - * external code can call flush to synchronously force processing of currently buffered styles - */ parcelHelpers.export(exports, "flush", ()=>flush); -/** - * Registers a set theme tokens to find and replace. If styles were already registered, they will be - * replaced. - * @param {theme} theme JSON object of theme tokens to values. - */ parcelHelpers.export(exports, "loadTheme", ()=>loadTheme); -/** - * Clear already registered style elements and style records in theme_State object - * @param option - specify which group of registered styles should be cleared. - * Default to be both themable and non-themable styles will be cleared - */ parcelHelpers.export(exports, "clearStyles", ()=>clearStyles); -/** - * Find theme tokens and replaces them with provided theme values. - * @param {string} styles Tokenized styles to fix. - */ parcelHelpers.export(exports, "detokenize", ()=>detokenize); -/** - * Split tokenized CSS into an array of strings and theme specification objects - * @param {string} styles Tokenized styles to split. - */ parcelHelpers.export(exports, "splitStyles", ()=>splitStyles); -var global = arguments[3]; -var __assign = undefined && undefined.__assign || function() { - __assign = Object.assign || function(t) { - for(var s, i = 1, n = arguments.length; i < n; i++){ - s = arguments[i]; - for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -// Store the theming state in __themeState__ global scope for reuse in the case of duplicate -// load-themed-styles hosted on the page. -var _root = typeof window === 'undefined' ? global : window; // eslint-disable-line @typescript-eslint/no-explicit-any -// Nonce string to inject into script tag if one provided. This is used in CSP (Content Security Policy). -var _styleNonce = _root && _root.CSPSettings && _root.CSPSettings.nonce; -var _themeState = initializeThemeState(); -/** - * Matches theming tokens. For example, "[theme: themeSlotName, default: #FFF]" (including the quotes). - */ var _themeTokenRegex = /[\'\"]\[theme:\s*(\w+)\s*(?:\,\s*default:\s*([\\"\']?[\.\,\(\)\#\-\s\w]*[\.\,\(\)\#\-\w][\"\']?))?\s*\][\'\"]/g; -var now = function() { - return typeof performance !== 'undefined' && !!performance.now ? performance.now() : Date.now(); -}; -function measure(func) { - var start = now(); - func(); - var end = now(); - _themeState.perf.duration += end - start; -} -/** - * initialize global state object - */ function initializeThemeState() { - var state = _root.__themeState__ || { - theme: undefined, - lastStyleElement: undefined, - registeredStyles: [] - }; - if (!state.runState) state = __assign(__assign({}, state), { - perf: { - count: 0, - duration: 0 - }, - runState: { - flushTimer: 0, - mode: 0 /* Mode.sync */ , - buffer: [] - } - }); - if (!state.registeredThemableStyles) state = __assign(__assign({}, state), { - registeredThemableStyles: [] - }); - _root.__themeState__ = state; - return state; -} -function loadStyles(styles, loadAsync) { - if (loadAsync === void 0) loadAsync = false; - measure(function() { - var styleParts = Array.isArray(styles) ? styles : splitStyles(styles); - var _a = _themeState.runState, mode = _a.mode, buffer = _a.buffer, flushTimer = _a.flushTimer; - if (loadAsync || mode === 1 /* Mode.async */ ) { - buffer.push(styleParts); - if (!flushTimer) _themeState.runState.flushTimer = asyncLoadStyles(); - } else applyThemableStyles(styleParts); - }); -} -function configureLoadStyles(loadStylesFn) { - _themeState.loadStyles = loadStylesFn; -} -function configureRunMode(mode) { - _themeState.runState.mode = mode; -} -function flush() { - measure(function() { - var styleArrays = _themeState.runState.buffer.slice(); - _themeState.runState.buffer = []; - var mergedStyleArray = [].concat.apply([], styleArrays); - if (mergedStyleArray.length > 0) applyThemableStyles(mergedStyleArray); - }); -} -/** - * register async loadStyles - */ function asyncLoadStyles() { - return setTimeout(function() { - _themeState.runState.flushTimer = 0; - flush(); - }, 0); -} -/** - * Loads a set of style text. If it is registered too early, we will register it when the window.load event - * is fired. - * @param {string} styleText Style to register. - * @param {IStyleRecord} styleRecord Existing style record to re-apply. - */ function applyThemableStyles(stylesArray, styleRecord) { - if (_themeState.loadStyles) _themeState.loadStyles(resolveThemableArray(stylesArray).styleString, stylesArray); - else registerStyles(stylesArray); -} -function loadTheme(theme) { - _themeState.theme = theme; - // reload styles. - reloadStyles(); -} -function clearStyles(option) { - if (option === void 0) option = 3 /* ClearStyleOptions.all */ ; - if (option === 3 /* ClearStyleOptions.all */ || option === 2 /* ClearStyleOptions.onlyNonThemable */ ) { - clearStylesInternal(_themeState.registeredStyles); - _themeState.registeredStyles = []; - } - if (option === 3 /* ClearStyleOptions.all */ || option === 1 /* ClearStyleOptions.onlyThemable */ ) { - clearStylesInternal(_themeState.registeredThemableStyles); - _themeState.registeredThemableStyles = []; - } -} -function clearStylesInternal(records) { - records.forEach(function(styleRecord) { - var styleElement = styleRecord && styleRecord.styleElement; - if (styleElement && styleElement.parentElement) styleElement.parentElement.removeChild(styleElement); - }); -} -/** - * Reloads styles. - */ function reloadStyles() { - if (_themeState.theme) { - var themableStyles = []; - for(var _i = 0, _a = _themeState.registeredThemableStyles; _i < _a.length; _i++){ - var styleRecord = _a[_i]; - themableStyles.push(styleRecord.themableStyle); - } - if (themableStyles.length > 0) { - clearStyles(1 /* ClearStyleOptions.onlyThemable */ ); - applyThemableStyles([].concat.apply([], themableStyles)); - } - } -} -function detokenize(styles) { - if (styles) styles = resolveThemableArray(splitStyles(styles)).styleString; - return styles; -} -/** - * Resolves ThemingInstruction objects in an array and joins the result into a string. - * @param {ThemableArray} splitStyleArray ThemableArray to resolve and join. - */ function resolveThemableArray(splitStyleArray) { - var theme = _themeState.theme; - var themable = false; - // Resolve the array of theming instructions to an array of strings. - // Then join the array to produce the final CSS string. - var resolvedArray = (splitStyleArray || []).map(function(currentValue) { - var themeSlot = currentValue.theme; - if (themeSlot) { - themable = true; - // A theming annotation. Resolve it. - var themedValue = theme ? theme[themeSlot] : undefined; - var defaultValue = currentValue.defaultValue || 'inherit'; - // Warn to console if we hit an unthemed value even when themes are provided, but only if "DEBUG" is true. - // Allow the themedValue to be undefined to explicitly request the default value. - if (theme && !themedValue && console && !(themeSlot in theme) && typeof DEBUG !== 'undefined' && DEBUG) console.warn("Theming value not provided for \"".concat(themeSlot, "\". Falling back to \"").concat(defaultValue, "\".")); - return themedValue || defaultValue; - } else // A non-themable string. Preserve it. - return currentValue.rawString; + return !!isMacResult; + } + function hasHorizontalOverflow(element2) { + return element2.clientWidth < element2.scrollWidth; + } + function hasVerticalOverflow(element2) { + return element2.clientHeight < element2.scrollHeight; + } + function hasOverflow(element2) { + return hasHorizontalOverflow(element2) || hasVerticalOverflow(element2); + } + function createComposedRenderFunction(outer) { + var outerMemoizer = createMemoizer(function(inner) { + var innerMemoizer = createMemoizer(function(defaultRender) { + return function(innerProps) { + return inner(innerProps, defaultRender); + }; + }); + return function(outerProps, defaultRender) { + return outer(outerProps, defaultRender ? innerMemoizer(defaultRender) : inner); + }; }); - return { - styleString: resolvedArray.join(''), - themable: themable - }; -} -function splitStyles(styles) { - var result = []; - if (styles) { - var pos = 0; // Current position in styles. - var tokenMatch = void 0; - while(tokenMatch = _themeTokenRegex.exec(styles)){ - var matchIndex = tokenMatch.index; - if (matchIndex > pos) result.push({ - rawString: styles.substring(pos, matchIndex) - }); - result.push({ - theme: tokenMatch[1], - defaultValue: tokenMatch[2] // May be undefined + return outerMemoizer; + } + var memoizer = createMemoizer(createComposedRenderFunction); + function composeRenderFunction(outer, inner) { + return memoizer(outer)(inner); + } + var safeRequestAnimationFrame = function(component) { + var activeTimeouts; + return function(cb) { + if (!activeTimeouts) { + activeTimeouts = /* @__PURE__ */ new Set(); + extendComponent(component, { + componentWillUnmount: function() { + activeTimeouts.forEach(function(id2) { + return cancelAnimationFrame(id2); }); - // index of the first character after the current match - pos = _themeTokenRegex.lastIndex; - } - // Push the rest of the string after the last match. - result.push({ - rawString: styles.substring(pos) - }); - } - return result; -} -/** - * Registers a set of style text. If it is registered too early, we will register it when the - * window.load event is fired. - * @param {ThemableArray} styleArray Array of IThemingInstruction objects to register. - * @param {IStyleRecord} styleRecord May specify a style Element to update. - */ function registerStyles(styleArray) { - if (typeof document === 'undefined') return; - var head = document.getElementsByTagName('head')[0]; - var styleElement = document.createElement('style'); - var _a = resolveThemableArray(styleArray), styleString = _a.styleString, themable = _a.themable; - styleElement.setAttribute('data-load-themed-styles', 'true'); - if (_styleNonce) styleElement.setAttribute('nonce', _styleNonce); - styleElement.appendChild(document.createTextNode(styleString)); - _themeState.perf.count++; - head.appendChild(styleElement); - var ev = document.createEvent('HTMLEvents'); - ev.initEvent('styleinsert', true, false); - ev.args = { - newStyle: styleElement - }; - document.dispatchEvent(ev); - var record = { - styleElement: styleElement, - themableStyle: styleArray - }; - if (themable) _themeState.registeredThemableStyles.push(record); - else _themeState.registeredStyles.push(record); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"frMaf":[function(require,module,exports,__globalThis) { -// This file mimics styles and mixins from _General.Mixins.scss -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "normalize", ()=>normalize); -parcelHelpers.export(exports, "noWrap", ()=>noWrap); -var normalize = { - boxShadow: 'none', - margin: 0, - padding: 0, - boxSizing: 'border-box' -}; -var noWrap = { - overflow: 'hidden', - textOverflow: 'ellipsis', - whiteSpace: 'nowrap' -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1VkGl":[function(require,module,exports,__globalThis) { -/** - * Generates placeholder style for each of the browsers supported by `@fluentui/react`. - * @param styles - The style to use. - * @returns The placeholder style object for each browser depending on the placeholder directive it uses. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getPlaceholderStyles", ()=>getPlaceholderStyles); -function getPlaceholderStyles(styles) { - return { - selectors: { - '::placeholder': styles, - ':-ms-input-placeholder': styles, - '::-ms-input-placeholder': styles - } - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9IVjH":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/style-utilities', '8.11.5'); - -},{"@fluentui/set-version":"iqYXf"}],"gQUPC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getIconContent", ()=>getIconContent); -parcelHelpers.export(exports, "FontIcon", ()=>FontIcon); -parcelHelpers.export(exports, "getFontIcon", ()=>getFontIcon); -var _tslib = require("tslib"); -var _react = require("react"); -var _iconStyles = require("./Icon.styles"); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getIconContent = (0, _utilities.memoizeFunction)(function(iconName) { - var _a = (0, _styling.getIcon)(iconName) || { - subset: {}, - code: undefined - }, code = _a.code, subset = _a.subset; - if (!code) return null; - return { - children: code, - iconClassName: subset.className, - fontFamily: subset.fontFace && subset.fontFace.fontFamily, - mergeImageProps: subset.mergeImageProps - }; -}, undefined, true); -var FontIcon = function(props) { - var iconName = props.iconName, className = props.className, _a = props.style, style = _a === void 0 ? {} : _a; - var iconContent = getIconContent(iconName) || {}; - var iconClassName = iconContent.iconClassName, children = iconContent.children, fontFamily = iconContent.fontFamily, mergeImageProps = iconContent.mergeImageProps; - var nativeProps = (0, _utilities.getNativeProps)(props, (0, _utilities.htmlElementProperties)); - var accessibleName = props['aria-label'] || props.title; - var containerProps = props['aria-label'] || props['aria-labelledby'] || props.title ? { - role: mergeImageProps ? undefined : 'img' - } : { - 'aria-hidden': true - }; - var finalChildren = children; - if (mergeImageProps) { - if (typeof children === 'object' && typeof children.props === 'object' && accessibleName) finalChildren = _react.cloneElement(children, { - alt: accessibleName + } }); - } - return _react.createElement("i", (0, _tslib.__assign)({ - "data-icon-name": iconName - }, containerProps, nativeProps, mergeImageProps ? { - title: undefined, - 'aria-label': undefined - } : {}, { - className: (0, _utilities.css)((0, _iconStyles.MS_ICON), (0, _iconStyles.classNames).root, iconClassName, !iconName && (0, _iconStyles.classNames).placeholder, className), - // Apply the font family this way to ensure it doesn't get overridden by Fabric Core ms-Icon styles - // https://github.com/microsoft/fluentui/issues/10449 - style: (0, _tslib.__assign)({ - fontFamily: fontFamily - }, style) - }), finalChildren); -}; -var getFontIcon = (0, _utilities.memoizeFunction)(function(iconName, className, ariaLabel) { - return FontIcon({ - iconName: iconName, - className: className, - 'aria-label': ariaLabel - }); -}); - -},{"tslib":"9gizs","react":"jGrId","./Icon.styles":"lyw66","../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lyw66":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "classNames", ()=>classNames); -parcelHelpers.export(exports, "MS_ICON", ()=>MS_ICON); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var classNames = (0, _styling.mergeStyleSets)({ - root: { - display: 'inline-block', - textDecoration: 'inherit' - }, - placeholder: [ - 'ms-Icon-placeHolder', - { - width: '1em' - } - ], - image: [ - 'ms-Icon-imageContainer', - { - overflow: 'hidden' - } - ] -}); -var MS_ICON = 'ms-Icon'; -var getStyles = function(props) { - var className = props.className, iconClassName = props.iconClassName, isPlaceholder = props.isPlaceholder, isImage = props.isImage, styles = props.styles; - return { - root: [ - isPlaceholder && classNames.placeholder, - classNames.root, - isImage && classNames.image, - iconClassName, - className, - styles && styles.root, - // eslint-disable-next-line deprecation/deprecation - styles && styles.imageContainer - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"64ZOw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageIcon", ()=>ImageIcon); -var _tslib = require("tslib"); -var _react = require("react"); -var _image = require("../Image/Image"); -var _utilities = require("../../Utilities"); -var _iconStyles = require("./Icon.styles"); -var ImageIcon = function(props) { - var className = props.className, imageProps = props.imageProps; - var nativeProps = (0, _utilities.getNativeProps)(props, (0, _utilities.htmlElementProperties), [ - 'aria-label', - 'aria-labelledby', - 'title', - 'aria-describedby' - ]); - var altText = imageProps.alt || props['aria-label']; - var hasName = altText || props['aria-labelledby'] || props.title || imageProps['aria-label'] || imageProps['aria-labelledby'] || imageProps.title; - // move naming or describing attributes from the container (where they are invalid) to the image - var imageNameProps = { - 'aria-labelledby': props['aria-labelledby'], - 'aria-describedby': props['aria-describedby'], - title: props.title - }; - var containerProps = hasName ? {} : { - 'aria-hidden': true + } + var timeoutId = requestAnimationFrame(function() { + activeTimeouts.delete(timeoutId); + cb(); + }); + activeTimeouts.add(timeoutId); }; - return _react.createElement("div", (0, _tslib.__assign)({}, containerProps, nativeProps, { - className: (0, _utilities.css)((0, _iconStyles.MS_ICON), (0, _iconStyles.classNames).root, (0, _iconStyles.classNames).image, className) - }), _react.createElement((0, _image.Image), (0, _tslib.__assign)({}, imageNameProps, imageProps, { - alt: hasName ? altText : '' - }))); -}; - -},{"tslib":"9gizs","react":"jGrId","../Image/Image":"5keBP","../../Utilities":"1NZCy","./Icon.styles":"lyw66","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"avdAc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DirectionalHint", ()=>DirectionalHint); -var DirectionalHint = { - /** - * Appear above the target element, with the left edges of the callout and target aligning. - */ topLeftEdge: 0, - /** - * Appear above the target element, with the centers of the callout and target aligning. - */ topCenter: 1, - /** - * Appear above the target element, with the right edges of the callout and target aligning. - */ topRightEdge: 2, - /** - * Appear above the target element, aligning with the target element such that the callout tends toward - * the center of the screen. - */ topAutoEdge: 3, - /** - * Appear below the target element, with the left edges of the callout and target aligning. - */ bottomLeftEdge: 4, - /** - * Appear below the target element, with the centers of the callout and target aligning. - */ bottomCenter: 5, - /** - * Appear below the target element, with the right edges of the callout and target aligning. - */ bottomRightEdge: 6, - /** - * Appear below the target element, aligning with the target element such that the callout tends toward - * the center of the screen. - */ bottomAutoEdge: 7, - /** - * Appear to the left of the target element, with the top edges of the callout and target aligning. - */ leftTopEdge: 8, - /** - * Appear to the left of the target element, with the centers of the callout and target aligning. - */ leftCenter: 9, - /** - * Appear to the left of the target element, with the bottom edges of the callout and target aligning. - */ leftBottomEdge: 10, - /** - * Appear to the right of the target element, with the top edges of the callout and target aligning. - */ rightTopEdge: 11, - /** - * Appear to the right of the target element, with the centers of the callout and target aligning. - */ rightCenter: 12, - /** - * Appear to the right of the target element, with the bottom edges of the callout and target aligning. - */ rightBottomEdge: 13 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iuj1y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ContextualMenu/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ContextualMenu/index":"9oh5j","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9oh5j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getMenuItemStyles", ()=>(0, _contextualMenuCnstyles.getMenuItemStyles)); -parcelHelpers.export(exports, "getContextualMenuItemClassNames", ()=>(0, _contextualMenuClassNames.getItemClassNames)); -parcelHelpers.export(exports, "getContextualMenuItemStyles", ()=>(0, _contextualMenuClassNames.getItemStyles)); -var _contextualMenu = require("./ContextualMenu"); -parcelHelpers.exportAll(_contextualMenu, exports); -var _contextualMenuBase = require("./ContextualMenu.base"); -parcelHelpers.exportAll(_contextualMenuBase, exports); -var _contextualMenuTypes = require("./ContextualMenu.types"); -parcelHelpers.exportAll(_contextualMenuTypes, exports); -var _contextualMenuItem = require("./ContextualMenuItem"); -parcelHelpers.exportAll(_contextualMenuItem, exports); -var _contextualMenuItemBase = require("./ContextualMenuItem.base"); -parcelHelpers.exportAll(_contextualMenuItemBase, exports); -var _contextualMenuItemTypes = require("./ContextualMenuItem.types"); -parcelHelpers.exportAll(_contextualMenuItemTypes, exports); -var _contextualMenuCnstyles = require("./ContextualMenu.cnstyles"); -var _contextualMenuClassNames = require("./ContextualMenu.classNames"); - -},{"./ContextualMenu":"eivnv","./ContextualMenu.base":false,"./ContextualMenu.types":"akDeV","./ContextualMenuItem":false,"./ContextualMenuItem.base":false,"./ContextualMenuItem.types":false,"./ContextualMenu.cnstyles":false,"./ContextualMenu.classNames":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eivnv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenu", ()=>ContextualMenu); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _contextualMenuBase = require("./ContextualMenu.base"); -var _contextualMenuStyles = require("./ContextualMenu.styles"); -function onRenderSubMenu(subMenuProps) { - return _react.createElement(LocalContextualMenu, (0, _tslib.__assign)({}, subMenuProps)); -} -// This is to prevent cyclic import with ContextualMenu.base.tsx. -var LocalContextualMenu = (0, _utilities.styled)((0, _contextualMenuBase.ContextualMenuBase), (0, _contextualMenuStyles.getStyles), function(props) { - return { - onRenderSubMenu: props.onRenderSubMenu ? (0, _utilities.composeRenderFunction)(props.onRenderSubMenu, onRenderSubMenu) : onRenderSubMenu - }; -}, { - scope: 'ContextualMenu' -}); -var ContextualMenu = LocalContextualMenu; -ContextualMenu.displayName = 'ContextualMenu'; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./ContextualMenu.base":"luJCP","./ContextualMenu.styles":"9ouID","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"luJCP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSubmenuItems", ()=>getSubmenuItems); -/** - * Returns true if a list of menu items can contain a checkbox - */ parcelHelpers.export(exports, "canAnyMenuItemsCheck", ()=>canAnyMenuItemsCheck); -parcelHelpers.export(exports, "ContextualMenuBase", ()=>ContextualMenuBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _contextualMenuTypes = require("./ContextualMenu.types"); -var _directionalHint = require("../../common/DirectionalHint"); -var _focusZone = require("../../FocusZone"); -var _utilities = require("../../Utilities"); -var _index = require("../../utilities/contextualMenu/index"); -var _callout = require("../../Callout"); -var _contextualMenuItem = require("./ContextualMenuItem"); -var _index1 = require("./ContextualMenuItemWrapper/index"); -var _styling = require("../../Styling"); -var _contextualMenuClassNames = require("./ContextualMenu.classNames"); -var _reactHooks = require("@fluentui/react-hooks"); -var _responsiveMode = require("../../ResponsiveMode"); -var _index2 = require("../../utilities/MenuContext/index"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getContextualMenuItemClassNames = (0, _utilities.classNamesFunction)(); -// The default ContextualMenu properties have no items and beak, the default submenu direction is right and top. -var DEFAULT_PROPS = { - items: [], - shouldFocusOnMount: true, - gapSpace: 0, - directionalHint: (0, _directionalHint.DirectionalHint).bottomAutoEdge, - beakWidth: 16 -}; -/* return number of menu items, excluding headers and dividers */ function getItemCount(items) { - var totalItemCount = 0; - for(var _i = 0, items_1 = items; _i < items_1.length; _i++){ - var item = items_1[_i]; - if (item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Divider && item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Header) { - var itemCount = item.customOnRenderListLength ? item.customOnRenderListLength : 1; - totalItemCount += itemCount; - } + }; + var DefaultFields = ["theme", "styles"]; + function styled(Component, baseStyles, getProps, customizable2, pure) { + customizable2 = customizable2 || { scope: "", fields: void 0 }; + var scope = customizable2.scope, _a2 = customizable2.fields, fields = _a2 === void 0 ? DefaultFields : _a2; + var Wrapped = React__namespace.forwardRef(function(props, forwardedRef) { + var styles = React__namespace.useRef(void 0); + var settings = useCustomizationSettings(fields, scope); + var customizedStyles = settings.styles; + settings.dir; + var rest = __rest(settings, ["styles", "dir"]); + var additionalProps = getProps ? getProps(props) : void 0; + var useStyled = useMergeStylesHooks().useStyled; + var cache2 = styles.current && styles.current.__cachedInputs__ || []; + var propStyles = props.styles; + if (!styles.current || customizedStyles !== cache2[1] || propStyles !== cache2[2]) { + var concatenatedStyles = function(styleProps) { + return concatStyleSetsWithProps(styleProps, baseStyles, customizedStyles, propStyles); + }; + concatenatedStyles.__cachedInputs__ = [ + baseStyles, + customizedStyles, + propStyles + ]; + concatenatedStyles.__noStyleOverride__ = !customizedStyles && !propStyles; + styles.current = concatenatedStyles; + } + styles.current.__shadowConfig__ = useStyled(scope); + return React__namespace.createElement(Component, __assign$1({ ref: forwardedRef }, rest, additionalProps, props, { styles: styles.current })); + }); + Wrapped.displayName = "Styled".concat(Component.displayName || Component.name); + var pureComponent = pure ? React__namespace.memo(Wrapped) : Wrapped; + if (Wrapped.displayName) { + pureComponent.displayName = Wrapped.displayName; } - return totalItemCount; -} -function getSubmenuItems(item, options) { - var target = options === null || options === void 0 ? void 0 : options.target; - // eslint-disable-next-line deprecation/deprecation - var items = item.subMenuProps ? item.subMenuProps.items : item.items; - if (items) { - var overrideItems = []; - for(var _i = 0, items_2 = items; _i < items_2.length; _i++){ - var subItem = items_2[_i]; - if (subItem.preferMenuTargetAsEventTarget) { - // For sub-items which need an overridden target, intercept `onClick` - var onClick = subItem.onClick, contextItem = (0, _tslib.__rest)(subItem, [ - "onClick" - ]); - overrideItems.push((0, _tslib.__assign)((0, _tslib.__assign)({}, contextItem), { - onClick: getOnClickWithOverrideTarget(onClick, target) - })); - } else overrideItems.push(subItem); + return pureComponent; + } + function warnControlledUsage(params2) { + } + var isIE11 = function() { + var _a2; + var win = getWindow(); + if (!((_a2 = win === null || win === void 0 ? void 0 : win.navigator) === null || _a2 === void 0 ? void 0 : _a2.userAgent)) { + return false; + } + return win.navigator.userAgent.indexOf("rv:11.0") > -1; + }; + function getPropsWithDefaults(defaultProps, propsWithoutDefaults) { + var props = __assign$1({}, propsWithoutDefaults); + for (var _i = 0, _a2 = Object.keys(defaultProps); _i < _a2.length; _i++) { + var key2 = _a2[_i]; + if (props[key2] === void 0) { + props[key2] = defaultProps[key2]; + } + } + return props; + } + var createResolver = function(local) { + return function(newValue) { + for (var _i = 0, _a2 = local.refs; _i < _a2.length; _i++) { + var ref2 = _a2[_i]; + if (typeof ref2 === "function") { + ref2(newValue); + } else if (ref2) { + ref2.current = newValue; + } + } + }; + }; + var createMergedRef = function(value2) { + var local = { + refs: [] + }; + return function() { + var newRefs = []; + for (var _i = 0; _i < arguments.length; _i++) { + newRefs[_i] = arguments[_i]; + } + if (!local.resolver || !arraysEqual(local.refs, newRefs)) { + local.resolver = createResolver(local); + } + local.refs = newRefs; + return local.resolver; + }; + }; + var useIsomorphicLayoutEffect = canUseDOM() ? React__namespace.useLayoutEffect : React__namespace.useEffect; + var IconType; + (function(IconType2) { + IconType2[IconType2["default"] = 0] = "default"; + IconType2[IconType2["image"] = 1] = "image"; + IconType2[IconType2["Default"] = 1e5] = "Default"; + IconType2[IconType2["Image"] = 100001] = "Image"; + })(IconType || (IconType = {})); + var ImageFit; + (function(ImageFit2) { + ImageFit2[ImageFit2["center"] = 0] = "center"; + ImageFit2[ImageFit2["contain"] = 1] = "contain"; + ImageFit2[ImageFit2["cover"] = 2] = "cover"; + ImageFit2[ImageFit2["none"] = 3] = "none"; + ImageFit2[ImageFit2["centerCover"] = 4] = "centerCover"; + ImageFit2[ImageFit2["centerContain"] = 5] = "centerContain"; + })(ImageFit || (ImageFit = {})); + var ImageCoverStyle; + (function(ImageCoverStyle2) { + ImageCoverStyle2[ImageCoverStyle2["landscape"] = 0] = "landscape"; + ImageCoverStyle2[ImageCoverStyle2["portrait"] = 1] = "portrait"; + })(ImageCoverStyle || (ImageCoverStyle = {})); + var ImageLoadState; + (function(ImageLoadState2) { + ImageLoadState2[ImageLoadState2["notLoaded"] = 0] = "notLoaded"; + ImageLoadState2[ImageLoadState2["loaded"] = 1] = "loaded"; + ImageLoadState2[ImageLoadState2["error"] = 2] = "error"; + ImageLoadState2[ImageLoadState2["errorLoaded"] = 3] = "errorLoaded"; + })(ImageLoadState || (ImageLoadState = {})); + function useAsync() { + var asyncRef = React__namespace.useRef(void 0); + if (!asyncRef.current) { + asyncRef.current = new Async(); + } + React__namespace.useEffect(function() { + return function() { + var _a2; + (_a2 = asyncRef.current) === null || _a2 === void 0 ? void 0 : _a2.dispose(); + asyncRef.current = void 0; + }; + }, []); + return asyncRef.current; + } + function useConst(initialValue) { + var ref2 = React__namespace.useRef(void 0); + if (ref2.current === void 0) { + ref2.current = { + value: typeof initialValue === "function" ? initialValue() : initialValue + }; + } + return ref2.current.value; + } + function useBoolean(initialState) { + var _a2 = React__namespace.useState(initialState), value2 = _a2[0], setValue = _a2[1]; + var setTrue = useConst(function() { + return function() { + setValue(true); + }; + }); + var setFalse = useConst(function() { + return function() { + setValue(false); + }; + }); + var toggle = useConst(function() { + return function() { + setValue(function(currentValue) { + return !currentValue; + }); + }; + }); + return [value2, { setTrue, setFalse, toggle }]; + } + function useControllableValue(controlledValue, defaultUncontrolledValue, onChange) { + var _a2 = React__namespace.useState(defaultUncontrolledValue), value2 = _a2[0], setValue = _a2[1]; + var isControlled2 = useConst(controlledValue !== void 0); + var currentValue = isControlled2 ? controlledValue : value2; + var valueRef = React__namespace.useRef(currentValue); + var onChangeRef = React__namespace.useRef(onChange); + React__namespace.useEffect(function() { + valueRef.current = currentValue; + onChangeRef.current = onChange; + }); + var setValueOrCallOnChange = useConst(function() { + return function(update2, ev) { + var newValue = typeof update2 === "function" ? update2(valueRef.current) : update2; + if (onChangeRef.current) { + onChangeRef.current(ev, newValue); + } + if (!isControlled2) { + setValue(newValue); + } + }; + }); + return [currentValue, setValueOrCallOnChange]; + } + function useEventCallback(fn2) { + var callbackRef = React__namespace.useRef(function() { + throw new Error("Cannot call an event handler while rendering"); + }); + useIsomorphicLayoutEffect(function() { + callbackRef.current = fn2; + }, [fn2]); + return useConst(function() { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; } - return overrideItems; + var callback = callbackRef.current; + return callback.apply(void 0, args); + }; + }); + } + function useId(prefix, providedId) { + var ref2 = React__namespace.useRef(providedId); + if (!ref2.current) { + ref2.current = getId(prefix); } -} -function canAnyMenuItemsCheck(items) { - return items.some(function(item) { - if (item.canCheck) return true; - // If the item is a section, check if any of the items in the section can check. - if (item.sectionProps && item.sectionProps.items.some(function(submenuItem) { - return submenuItem.canCheck === true; - })) return true; - return false; + return ref2.current; + } + function useMergedRefs() { + var refs = []; + for (var _i = 0; _i < arguments.length; _i++) { + refs[_i] = arguments[_i]; + } + var mergedCallback = React__namespace.useCallback(function(value2) { + mergedCallback.current = value2; + for (var _i2 = 0, refs_1 = refs; _i2 < refs_1.length; _i2++) { + var ref2 = refs_1[_i2]; + if (typeof ref2 === "function") { + ref2(value2); + } else if (ref2) { + ref2.current = value2; + } + } + }, __spreadArray([], refs, true)); + return mergedCallback; + } + function useOnEvent(element2, eventName, callback, useCapture) { + var callbackRef = React__namespace.useRef(callback); + callbackRef.current = callback; + React__namespace.useEffect(function() { + var actualElement = element2 && "current" in element2 ? element2.current : element2; + if (!actualElement || !actualElement.addEventListener) { + return; + } + var dispose = on$1(actualElement, eventName, function(ev) { + return callbackRef.current(ev); + }, useCapture); + return dispose; + }, [element2, eventName, useCapture]); + } + function usePrevious(value2) { + var ref2 = React__namespace.useRef(void 0); + React__namespace.useEffect(function() { + ref2.current = value2; }); -} -var NavigationIdleDelay = 250; /* ms */ -var COMPONENT_NAME = 'ContextualMenu'; -var _getMenuItemStylesFunction = (0, _utilities.memoizeFunction)(function() { - var styles = []; - for(var _i = 0; _i < arguments.length; _i++)styles[_i] = arguments[_i]; - return function(styleProps) { - return (0, _styling.concatStyleSetsWithProps).apply(void 0, (0, _tslib.__spreadArray)([ - styleProps, - (0, _contextualMenuClassNames.getItemStyles) - ], styles, false)); - }; -}); -//#region Custom hooks -function useVisibility(props, targetWindow) { - var _a = props.hidden, hidden = _a === void 0 ? false : _a, onMenuDismissed = props.onMenuDismissed, onMenuOpened = props.onMenuOpened; - var previousHidden = (0, _reactHooks.usePrevious)(hidden); - var onMenuOpenedRef = _react.useRef(onMenuOpened); - var onMenuClosedRef = _react.useRef(onMenuDismissed); - var propsRef = _react.useRef(props); - onMenuOpenedRef.current = onMenuOpened; - onMenuClosedRef.current = onMenuDismissed; - propsRef.current = props; - _react.useEffect(function() { - var _a, _b; - // Don't issue dismissed callbacks on initial mount - if (hidden && previousHidden === false) (_a = onMenuClosedRef.current) === null || _a === void 0 || _a.call(onMenuClosedRef, propsRef.current); - else if (!hidden && previousHidden !== false) (_b = onMenuOpenedRef.current) === null || _b === void 0 || _b.call(onMenuOpenedRef, propsRef.current); - }, [ - hidden, - previousHidden - ]); - // Issue onDismissedCallback on unmount - _react.useEffect(function() { + return ref2.current; + } + var useSetTimeout = function() { + var timeoutIds = useConst({}); + React__namespace.useEffect( + function() { return function() { - var _a; - return (_a = onMenuClosedRef.current) === null || _a === void 0 ? void 0 : _a.call(onMenuClosedRef, propsRef.current); + for (var _i = 0, _a2 = Object.keys(timeoutIds); _i < _a2.length; _i++) { + var id2 = _a2[_i]; + clearTimeout(id2); + } }; + }, + // useConst ensures this will never change, but react-hooks/exhaustive-deps doesn't know that + [timeoutIds] + ); + return useConst({ + setTimeout: function(func, duration) { + var id2 = setTimeout(func, duration); + timeoutIds[id2] = 1; + return id2; + }, + clearTimeout: function(id2) { + delete timeoutIds[id2]; + clearTimeout(id2); + } + }); + }; + function useTarget(target2, hostElement) { + var _a2, _b2, _c2; + var previousTargetProp = React__namespace.useRef(void 0); + var targetRef = React__namespace.useRef(null); + var targetWindow = useWindow(); + if (!target2 || target2 !== previousTargetProp.current || typeof target2 === "string") { + var currentElement = hostElement === null || hostElement === void 0 ? void 0 : hostElement.current; + if (target2) { + if (typeof target2 === "string") { + if ((_a2 = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _a2 === void 0 ? void 0 : _a2.host) { + targetRef.current = (_c2 = (_b2 = currentElement === null || currentElement === void 0 ? void 0 : currentElement.getRootNode()) === null || _b2 === void 0 ? void 0 : _b2.querySelector(target2)) !== null && _c2 !== void 0 ? _c2 : null; + } else { + var currentDoc = getDocument(currentElement); + targetRef.current = currentDoc ? currentDoc.querySelector(target2) : null; + } + } else if ("stopPropagation" in target2) { + targetRef.current = target2; + } else if ("getBoundingClientRect" in target2) { + targetRef.current = target2; + } else if ("current" in target2) { + targetRef.current = target2.current; + } else { + targetRef.current = target2; + } + } + previousTargetProp.current = target2; + } + return [targetRef, targetWindow]; + } + var useUnmount = function(callback) { + var unmountRef = React__namespace.useRef(callback); + unmountRef.current = callback; + React__namespace.useEffect(function() { + return function() { + var _a2; + (_a2 = unmountRef.current) === null || _a2 === void 0 ? void 0 : _a2.call(unmountRef); + }; }, []); -} -function useSubMenuState(_a, dismiss) { - var hidden = _a.hidden, items = _a.items, theme = _a.theme, className = _a.className, id = _a.id, menuTarget = _a.target; - var _b = _react.useState(), expandedMenuItemKey = _b[0], setExpandedMenuItemKey = _b[1]; - var _c = _react.useState(), submenuTarget = _c[0], setSubmenuTarget = _c[1]; - /** True if the menu was expanded by mouse click OR hover (as opposed to by keyboard) */ var _d = _react.useState(), shouldFocusOnContainer = _d[0], setShouldFocusOnContainer = _d[1]; - var subMenuId = (0, _reactHooks.useId)(COMPONENT_NAME, id); - var closeSubMenu = _react.useCallback(function() { - setShouldFocusOnContainer(undefined); - setExpandedMenuItemKey(undefined); - setSubmenuTarget(undefined); - }, []); - var openSubMenu = _react.useCallback(function(_a, target, focusContainer) { - var submenuItemKey = _a.key; - if (expandedMenuItemKey === submenuItemKey) return; - target.focus(); - setShouldFocusOnContainer(focusContainer); - setExpandedMenuItemKey(submenuItemKey); - setSubmenuTarget(target); - }, [ - expandedMenuItemKey - ]); - _react.useEffect(function() { - if (hidden) closeSubMenu(); - }, [ - hidden, - closeSubMenu + }; + var getClassNames$r = classNamesFunction(); + var SVG_REGEX = /\.svg$/i; + var KEY_PREFIX = "fabricImage"; + function useLoadState(props, imageElement) { + var onLoadingStateChange = props.onLoadingStateChange, onLoad = props.onLoad, onError = props.onError, src = props.src; + var _a2 = React__namespace.useState(ImageLoadState.notLoaded), loadState = _a2[0], setLoadState = _a2[1]; + useIsomorphicLayoutEffect(function() { + setLoadState(ImageLoadState.notLoaded); + }, [src]); + React__namespace.useEffect(function() { + if (loadState === ImageLoadState.notLoaded) { + var isLoaded = imageElement.current ? src && imageElement.current.naturalWidth > 0 && imageElement.current.naturalHeight > 0 || imageElement.current.complete && SVG_REGEX.test(src) : false; + if (isLoaded) { + setLoadState(ImageLoadState.loaded); + } + } + }); + React__namespace.useEffect(function() { + onLoadingStateChange === null || onLoadingStateChange === void 0 ? void 0 : onLoadingStateChange(loadState); + }, [loadState]); + var onImageLoaded = React__namespace.useCallback(function(ev) { + onLoad === null || onLoad === void 0 ? void 0 : onLoad(ev); + if (src) { + setLoadState(ImageLoadState.loaded); + } + }, [src, onLoad]); + var onImageError = React__namespace.useCallback(function(ev) { + onError === null || onError === void 0 ? void 0 : onError(ev); + setLoadState(ImageLoadState.error); + }, [onError]); + return [loadState, onImageLoaded, onImageError]; + } + var ImageBase = React__namespace.forwardRef(function(props, forwardedRef) { + var frameElement = React__namespace.useRef(void 0); + var imageElement = React__namespace.useRef(void 0); + var _a2 = useLoadState(props, imageElement), loadState = _a2[0], onImageLoaded = _a2[1], onImageError = _a2[2]; + var imageProps = getNativeProps(props, imgProperties, [ + "width", + "height" ]); - var onSubMenuDismiss = useOnSubmenuDismiss(dismiss, closeSubMenu); - var getSubmenuProps = function() { - var item = findItemByKeyFromItems(expandedMenuItemKey, items); - var submenuProps = null; - if (item) { - submenuProps = { - items: getSubmenuItems(item, { - target: menuTarget - }), - target: submenuTarget, - onDismiss: onSubMenuDismiss, - isSubMenu: true, - id: subMenuId, - shouldFocusOnMount: true, - shouldFocusOnContainer: shouldFocusOnContainer, - directionalHint: (0, _utilities.getRTL)(theme) ? (0, _directionalHint.DirectionalHint).leftTopEdge : (0, _directionalHint.DirectionalHint).rightTopEdge, - className: className, - gapSpace: 0, - isBeakVisible: false - }; - if (item.subMenuProps) (0, _utilities.assign)(submenuProps, item.subMenuProps); - if (item.preferMenuTargetAsEventTarget) { - var onItemClick = item.onItemClick; - submenuProps.onItemClick = getOnClickWithOverrideTarget(onItemClick, menuTarget); - } + var src = props.src, alt = props.alt, width2 = props.width, height2 = props.height, _b2 = props.shouldFadeIn, shouldFadeIn = _b2 === void 0 ? true : _b2, shouldStartVisible = props.shouldStartVisible, className2 = props.className, imageFit = props.imageFit, role = props.role, maximizeFrame = props.maximizeFrame, styles = props.styles, theme = props.theme, loading = props.loading; + var coverStyle = useCoverStyle(props, loadState, imageElement, frameElement); + var classNames2 = getClassNames$r(styles, { + theme, + className: className2, + width: width2, + height: height2, + maximizeFrame, + shouldFadeIn, + shouldStartVisible, + isLoaded: loadState === ImageLoadState.loaded || loadState === ImageLoadState.notLoaded && props.shouldStartVisible, + isLandscape: coverStyle === ImageCoverStyle.landscape, + isCenter: imageFit === ImageFit.center, + isCenterContain: imageFit === ImageFit.centerContain, + isCenterCover: imageFit === ImageFit.centerCover, + isContain: imageFit === ImageFit.contain, + isCover: imageFit === ImageFit.cover, + isNone: imageFit === ImageFit.none, + isError: loadState === ImageLoadState.error, + isNotImageFit: imageFit === void 0 + }); + return React__namespace.createElement( + "div", + { className: classNames2.root, style: { width: width2, height: height2 }, ref: frameElement }, + React__namespace.createElement("img", __assign$1({}, imageProps, { onLoad: onImageLoaded, onError: onImageError, key: KEY_PREFIX + props.src || "", className: classNames2.image, ref: useMergedRefs(imageElement, forwardedRef), src, alt, role, loading })) + ); + }); + ImageBase.displayName = "ImageBase"; + function useCoverStyle(props, loadState, imageElement, frameElement) { + var previousLoadState = React__namespace.useRef(loadState); + var coverStyle = React__namespace.useRef(void 0); + if (coverStyle === void 0 || previousLoadState.current === ImageLoadState.notLoaded && loadState === ImageLoadState.loaded) { + coverStyle.current = computeCoverStyle(props, loadState, imageElement, frameElement); + } + previousLoadState.current = loadState; + return coverStyle.current; + } + function computeCoverStyle(props, loadState, imageElement, frameElement) { + var imageFit = props.imageFit, width2 = props.width, height2 = props.height; + if (props.coverStyle !== void 0) { + return props.coverStyle; + } else if (loadState === ImageLoadState.loaded && (imageFit === ImageFit.cover || imageFit === ImageFit.contain || imageFit === ImageFit.centerContain || imageFit === ImageFit.centerCover) && imageElement.current && frameElement.current) { + var desiredRatio = void 0; + if (typeof width2 === "number" && typeof height2 === "number" && imageFit !== ImageFit.centerContain && imageFit !== ImageFit.centerCover) { + desiredRatio = width2 / height2; + } else { + desiredRatio = frameElement.current.clientWidth / frameElement.current.clientHeight; + } + var naturalRatio = imageElement.current.naturalWidth / imageElement.current.naturalHeight; + if (naturalRatio > desiredRatio) { + return ImageCoverStyle.landscape; + } + } + return ImageCoverStyle.portrait; + } + function buildClassMap(styles) { + var classes = {}; + var _loop_1 = function(styleName2) { + if (styles.hasOwnProperty(styleName2)) { + var className_1; + Object.defineProperty(classes, styleName2, { + get: function() { + if (className_1 === void 0) { + className_1 = mergeStyles(styles[styleName2]).toString(); + } + return className_1; + }, + enumerable: true, + configurable: true + }); + } + }; + for (var styleName in styles) { + _loop_1(styleName); + } + return classes; + } + var ICON_SETTING_NAME = "icons"; + var _iconSettings = GlobalSettings.getValue(ICON_SETTING_NAME, { + __options: { + disableWarnings: false, + warnOnMissingIcons: true + }, + __remapped: {} + }); + var stylesheet = Stylesheet.getInstance(); + if (stylesheet && stylesheet.onReset) { + stylesheet.onReset(function() { + for (var name_1 in _iconSettings) { + if (_iconSettings.hasOwnProperty(name_1) && !!_iconSettings[name_1].subset) { + _iconSettings[name_1].subset.className = void 0; + } + } + }); + } + var normalizeIconName = function(name) { + return name.toLowerCase(); + }; + function registerIcons$1(iconSubset, options2) { + var subset = __assign$1(__assign$1({}, iconSubset), { isRegistered: false, className: void 0 }); + var icons = iconSubset.icons; + options2 = options2 ? __assign$1(__assign$1({}, _iconSettings.__options), options2) : _iconSettings.__options; + for (var iconName in icons) { + if (icons.hasOwnProperty(iconName)) { + var code = icons[iconName]; + var normalizedIconName = normalizeIconName(iconName); + if (_iconSettings[normalizedIconName]) { + _warnDuplicateIcon(iconName); + } else { + _iconSettings[normalizedIconName] = { + code, + subset + }; + } + } + } + } + function unregisterIcons$1(iconNames) { + var options2 = _iconSettings.__options; + var _loop_1 = function(iconName2) { + var normalizedIconName = normalizeIconName(iconName2); + if (_iconSettings[normalizedIconName]) { + delete _iconSettings[normalizedIconName]; + } else { + if (!options2.disableWarnings) { + warn$1('The icon "'.concat(iconName2, '" tried to unregister but was not registered.')); + } + } + if (_iconSettings.__remapped[normalizedIconName]) { + delete _iconSettings.__remapped[normalizedIconName]; + } + Object.keys(_iconSettings.__remapped).forEach(function(key2) { + if (_iconSettings.__remapped[key2] === normalizedIconName) { + delete _iconSettings.__remapped[key2]; } - return submenuProps; + }); }; - return [ - expandedMenuItemKey, - openSubMenu, - getSubmenuProps, - onSubMenuDismiss - ]; -} -function useShouldUpdateFocusOnMouseMove(_a) { - var delayUpdateFocusOnHover = _a.delayUpdateFocusOnHover, hidden = _a.hidden; - var shouldUpdateFocusOnMouseEvent = _react.useRef(!delayUpdateFocusOnHover); - var gotMouseMove = _react.useRef(false); - _react.useEffect(function() { - shouldUpdateFocusOnMouseEvent.current = !delayUpdateFocusOnHover; - gotMouseMove.current = hidden ? false : !delayUpdateFocusOnHover && gotMouseMove.current; - }, [ - delayUpdateFocusOnHover, - hidden - ]); - var onMenuFocusCapture = _react.useCallback(function() { - if (delayUpdateFocusOnHover) shouldUpdateFocusOnMouseEvent.current = false; - }, [ - delayUpdateFocusOnHover - ]); - return [ - shouldUpdateFocusOnMouseEvent, - gotMouseMove, - onMenuFocusCapture - ]; -} -function usePreviousActiveElement(_a, targetWindow, hostElement) { - var hidden = _a.hidden, onRestoreFocus = _a.onRestoreFocus; - var previousActiveElement = _react.useRef(); - var tryFocusPreviousActiveElement = _react.useCallback(function(options) { - var _a, _b; - if (onRestoreFocus) onRestoreFocus(options); - else if (options === null || options === void 0 ? void 0 : options.documentContainsFocus) // Make sure that the focus method actually exists - // In some cases the object might exist but not be a real element. - // This is primarily for IE 11 and should be removed once IE 11 is no longer in use. - (_b = (_a = previousActiveElement.current) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 || _b.call(_a); - }, [ - onRestoreFocus - ]); - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - var _a, _b; - if (!hidden) { - var newElement = targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement; - if (!((_a = hostElement.current) === null || _a === void 0 ? void 0 : _a.contains(newElement)) && newElement.tagName !== 'BODY') previousActiveElement.current = newElement; - } else if (previousActiveElement.current) { - tryFocusPreviousActiveElement({ - originalElement: previousActiveElement.current, - containsFocus: true, - documentContainsFocus: ((_b = (0, _utilities.getDocument)()) === null || _b === void 0 ? void 0 : _b.hasFocus()) || false + for (var _i = 0, iconNames_1 = iconNames; _i < iconNames_1.length; _i++) { + var iconName = iconNames_1[_i]; + _loop_1(iconName); + } + } + function getIcon(name) { + var icon = void 0; + var options2 = _iconSettings.__options; + name = name ? normalizeIconName(name) : ""; + name = _iconSettings.__remapped[name] || name; + if (name) { + icon = _iconSettings[name]; + if (icon) { + var subset = icon.subset; + if (subset && subset.fontFace) { + if (!subset.isRegistered) { + fontFace(subset.fontFace); + subset.isRegistered = true; + } + if (!subset.className) { + subset.className = mergeStyles(subset.style, { + fontFamily: subset.fontFace.fontFamily, + fontWeight: subset.fontFace.fontWeight || "normal", + fontStyle: subset.fontFace.fontStyle || "normal" }); - previousActiveElement.current = undefined; + } } - }, [ - hidden, - targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement, - tryFocusPreviousActiveElement, - hostElement - ]); - return [ - tryFocusPreviousActiveElement - ]; -} -function useKeyHandlers(_a, dismiss, hostElement, openSubMenu) { - var theme = _a.theme, isSubMenu = _a.isSubMenu, _b = _a.focusZoneProps, _c = _b === void 0 ? {} : _b, checkForNoWrap = _c.checkForNoWrap, _d = _c.direction, focusZoneDirection = _d === void 0 ? (0, _focusZone.FocusZoneDirection).vertical : _d; - /** True if the most recent keydown event was for alt (option) or meta (command). */ var lastKeyDownWasAltOrMeta = _react.useRef(); - /** - * Calls `shouldHandleKey` to determine whether the keyboard event should be handled; - * if so, stops event propagation and dismisses menu(s). - * @param ev - The keyboard event. - * @param shouldHandleKey - Returns whether we should handle this keyboard event. - * @param dismissAllMenus - If true, dismiss all menus. Otherwise, dismiss only the current menu. - * Only does anything if `shouldHandleKey` returns true. - * @returns Whether the event was handled. - */ var keyHandler = function(ev, shouldHandleKey, dismissAllMenus) { - var handled = false; - if (shouldHandleKey(ev)) { - dismiss(ev, dismissAllMenus); - ev.preventDefault(); - ev.stopPropagation(); - handled = true; + } else { + if (!options2.disableWarnings && options2.warnOnMissingIcons) { + warn$1('The icon "'.concat(name, '" was used but not registered. See https://github.com/microsoft/fluentui/wiki/Using-icons for more information.')); } - return handled; - }; - /** - * Checks if the submenu should be closed - */ var shouldCloseSubMenu = function(ev) { - var submenuCloseKey = (0, _utilities.getRTL)(theme) ? (0, _utilities.KeyCodes).right : (0, _utilities.KeyCodes).left; - // eslint-disable-next-line deprecation/deprecation - if (ev.which !== submenuCloseKey || !isSubMenu) return false; - return !!(focusZoneDirection === (0, _focusZone.FocusZoneDirection).vertical || checkForNoWrap && !(0, _utilities.shouldWrapFocus)(ev.target, 'data-no-horizontal-wrap')); - }; - var shouldHandleKeyDown = function(ev) { - return(// eslint-disable-next-line deprecation/deprecation - ev.which === (0, _utilities.KeyCodes).escape || shouldCloseSubMenu(ev) || // eslint-disable-next-line deprecation/deprecation - ev.which === (0, _utilities.KeyCodes).up && (ev.altKey || ev.metaKey)); - }; - var onKeyDown = function(ev) { - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in shouldHandleKeyUp for reasoning. - lastKeyDownWasAltOrMeta.current = isAltOrMeta(ev); - // On Mac, pressing escape dismisses all levels of native context menus - // eslint-disable-next-line deprecation/deprecation - var dismissAllMenus = ev.which === (0, _utilities.KeyCodes).escape && ((0, _utilities.isMac)() || (0, _utilities.isIOS)()); - return keyHandler(ev, shouldHandleKeyDown, dismissAllMenus); - }; - /** - * We close the menu on key up only if ALL of the following are true: - * - Most recent key down was alt or meta (command) - * - The alt/meta key down was NOT followed by some other key (such as down/up arrow to - * expand/collapse the menu) - * - We're not on a Mac (or iOS) - * - * This is because on Windows, pressing alt moves focus to the application menu bar or similar, - * closing any open context menus. There is not a similar behavior on Macs. - */ var shouldHandleKeyUp = function(ev) { - var keyPressIsAltOrMetaAlone = lastKeyDownWasAltOrMeta.current && isAltOrMeta(ev); - lastKeyDownWasAltOrMeta.current = false; - return !!keyPressIsAltOrMetaAlone && !((0, _utilities.isIOS)() || (0, _utilities.isMac)()); - }; - var onKeyUp = function(ev) { - return keyHandler(ev, shouldHandleKeyUp, true); + } + } + return icon; + } + var _missingIcons = []; + var _missingIconsTimer = void 0; + function _warnDuplicateIcon(iconName) { + var options2 = _iconSettings.__options; + var warningDelay = 2e3; + var maxIconsInMessage = 10; + if (!options2.disableWarnings) { + _missingIcons.push(iconName); + if (_missingIconsTimer === void 0) { + _missingIconsTimer = setTimeout(function() { + warn$1("Some icons were re-registered. Applications should only call registerIcons for any given icon once. Redefining what an icon is may have unintended consequences. Duplicates include: \n" + _missingIcons.slice(0, maxIconsInMessage).join(", ") + (_missingIcons.length > maxIconsInMessage ? " (+ ".concat(_missingIcons.length - maxIconsInMessage, " more)") : "")); + _missingIconsTimer = void 0; + _missingIcons = []; + }, warningDelay); + } + } + } + function makeSemanticColors(p, e, s2, isInverted, depComments) { + if (depComments === void 0) { + depComments = false; + } + var semanticColors = __assign$1({ + primaryButtonBorder: "transparent", + errorText: !isInverted ? "#a4262c" : "#F1707B", + messageText: !isInverted ? "#323130" : "#F3F2F1", + messageLink: !isInverted ? "#005A9E" : "#6CB8F6", + messageLinkHovered: !isInverted ? "#004578" : "#82C7FF", + infoIcon: !isInverted ? "#605e5c" : "#C8C6C4", + errorIcon: !isInverted ? "#A80000" : "#F1707B", + blockingIcon: !isInverted ? "#FDE7E9" : "#442726", + warningIcon: !isInverted ? "#797775" : "#C8C6C4", + severeWarningIcon: !isInverted ? "#D83B01" : "#FCE100", + successIcon: !isInverted ? "#107C10" : "#92C353", + infoBackground: !isInverted ? "#f3f2f1" : "#323130", + errorBackground: !isInverted ? "#FDE7E9" : "#442726", + blockingBackground: !isInverted ? "#FDE7E9" : "#442726", + warningBackground: !isInverted ? "#FFF4CE" : "#433519", + severeWarningBackground: !isInverted ? "#FED9CC" : "#4F2A0F", + successBackground: !isInverted ? "#DFF6DD" : "#393D1B", + // deprecated + warningHighlight: !isInverted ? "#ffb900" : "#fff100", + successText: !isInverted ? "#107C10" : "#92c353" + }, s2); + var fullSemanticColors = getSemanticColors(p, e, semanticColors, isInverted); + return _fixDeprecatedSlots(fullSemanticColors, depComments); + } + function getSemanticColors(p, e, s2, isInverted, depComments) { + var result = {}; + var _a2 = p || {}, white = _a2.white, black = _a2.black, themePrimary = _a2.themePrimary, themeDark = _a2.themeDark, themeDarker = _a2.themeDarker, themeDarkAlt = _a2.themeDarkAlt, themeLighter = _a2.themeLighter, neutralLight = _a2.neutralLight, neutralLighter = _a2.neutralLighter, neutralDark = _a2.neutralDark, neutralQuaternary = _a2.neutralQuaternary, neutralQuaternaryAlt = _a2.neutralQuaternaryAlt, neutralPrimary = _a2.neutralPrimary, neutralSecondary = _a2.neutralSecondary, neutralSecondaryAlt = _a2.neutralSecondaryAlt, neutralTertiary = _a2.neutralTertiary, neutralTertiaryAlt = _a2.neutralTertiaryAlt, neutralLighterAlt = _a2.neutralLighterAlt, accent = _a2.accent; + if (white) { + result.bodyBackground = white; + result.bodyFrameBackground = white; + result.accentButtonText = white; + result.buttonBackground = white; + result.primaryButtonText = white; + result.primaryButtonTextHovered = white; + result.primaryButtonTextPressed = white; + result.inputBackground = white; + result.inputForegroundChecked = white; + result.listBackground = white; + result.menuBackground = white; + result.cardStandoutBackground = white; + } + if (black) { + result.bodyTextChecked = black; + result.buttonTextCheckedHovered = black; + } + if (themePrimary) { + result.link = themePrimary; + result.primaryButtonBackground = themePrimary; + result.inputBackgroundChecked = themePrimary; + result.inputIcon = themePrimary; + result.inputFocusBorderAlt = themePrimary; + result.menuIcon = themePrimary; + result.menuHeader = themePrimary; + result.accentButtonBackground = themePrimary; + } + if (themeDark) { + result.primaryButtonBackgroundPressed = themeDark; + result.inputBackgroundCheckedHovered = themeDark; + result.inputIconHovered = themeDark; + } + if (themeDarker) { + result.linkHovered = themeDarker; + } + if (themeDarkAlt) { + result.primaryButtonBackgroundHovered = themeDarkAlt; + } + if (themeLighter) { + result.inputPlaceholderBackgroundChecked = themeLighter; + } + if (neutralLight) { + result.bodyBackgroundChecked = neutralLight; + result.bodyFrameDivider = neutralLight; + result.bodyDivider = neutralLight; + result.variantBorder = neutralLight; + result.buttonBackgroundCheckedHovered = neutralLight; + result.buttonBackgroundPressed = neutralLight; + result.listItemBackgroundChecked = neutralLight; + result.listHeaderBackgroundPressed = neutralLight; + result.menuItemBackgroundPressed = neutralLight; + result.menuItemBackgroundChecked = neutralLight; + } + if (neutralLighter) { + result.bodyBackgroundHovered = neutralLighter; + result.buttonBackgroundHovered = neutralLighter; + result.buttonBackgroundDisabled = neutralLighter; + result.buttonBorderDisabled = neutralLighter; + result.primaryButtonBackgroundDisabled = neutralLighter; + result.disabledBackground = neutralLighter; + result.listItemBackgroundHovered = neutralLighter; + result.listHeaderBackgroundHovered = neutralLighter; + result.menuItemBackgroundHovered = neutralLighter; + } + if (neutralQuaternary) { + result.primaryButtonTextDisabled = neutralQuaternary; + result.disabledSubtext = neutralQuaternary; + } + if (neutralQuaternaryAlt) { + result.listItemBackgroundCheckedHovered = neutralQuaternaryAlt; + } + if (neutralTertiary) { + result.disabledBodyText = neutralTertiary; + result.variantBorderHovered = (s2 === null || s2 === void 0 ? void 0 : s2.variantBorderHovered) || neutralTertiary; + result.buttonTextDisabled = neutralTertiary; + result.inputIconDisabled = neutralTertiary; + result.disabledText = neutralTertiary; + } + if (neutralPrimary) { + result.bodyText = neutralPrimary; + result.actionLink = neutralPrimary; + result.buttonText = neutralPrimary; + result.inputBorderHovered = neutralPrimary; + result.inputText = neutralPrimary; + result.listText = neutralPrimary; + result.menuItemText = neutralPrimary; + } + if (neutralLighterAlt) { + result.bodyStandoutBackground = neutralLighterAlt; + result.defaultStateBackground = neutralLighterAlt; + } + if (neutralDark) { + result.actionLinkHovered = neutralDark; + result.buttonTextHovered = neutralDark; + result.buttonTextChecked = neutralDark; + result.buttonTextPressed = neutralDark; + result.inputTextHovered = neutralDark; + result.menuItemTextHovered = neutralDark; + } + if (neutralSecondary) { + result.bodySubtext = neutralSecondary; + result.focusBorder = neutralSecondary; + result.inputBorder = neutralSecondary; + result.smallInputBorder = neutralSecondary; + result.inputPlaceholderText = neutralSecondary; + } + if (neutralSecondaryAlt) { + result.buttonBorder = neutralSecondaryAlt; + } + if (neutralTertiaryAlt) { + result.disabledBodySubtext = neutralTertiaryAlt; + result.disabledBorder = neutralTertiaryAlt; + result.buttonBackgroundChecked = neutralTertiaryAlt; + result.menuDivider = neutralTertiaryAlt; + } + if (accent) { + result.accentButtonBackground = accent; + } + if (e === null || e === void 0 ? void 0 : e.elevation4) { + result.cardShadow = e.elevation4; + } + if (!isInverted && (e === null || e === void 0 ? void 0 : e.elevation8)) { + result.cardShadowHovered = e.elevation8; + } else if (result.variantBorderHovered) { + result.cardShadowHovered = "0 0 1px " + result.variantBorderHovered; + } + result = __assign$1(__assign$1({}, result), s2); + return result; + } + function _fixDeprecatedSlots(s2, depComments) { + var dep = ""; + if (depComments === true) { + dep = " /* @deprecated */"; + } + s2.listTextColor = s2.listText + dep; + s2.menuItemBackgroundChecked += dep; + s2.warningHighlight += dep; + s2.warningText = s2.messageText + dep; + s2.successText += dep; + return s2; + } + function mergeThemes(theme, partialTheme) { + var _a2, _b2, _c2; + if (partialTheme === void 0) { + partialTheme = {}; + } + var mergedTheme = merge$3({}, theme, partialTheme, { + semanticColors: getSemanticColors(partialTheme.palette, partialTheme.effects, partialTheme.semanticColors, partialTheme.isInverted === void 0 ? theme.isInverted : partialTheme.isInverted) + }); + if (((_a2 = partialTheme.palette) === null || _a2 === void 0 ? void 0 : _a2.themePrimary) && !((_b2 = partialTheme.palette) === null || _b2 === void 0 ? void 0 : _b2.accent)) { + mergedTheme.palette.accent = partialTheme.palette.themePrimary; + } + if (partialTheme.defaultFontStyle) { + for (var _i = 0, _d2 = Object.keys(mergedTheme.fonts); _i < _d2.length; _i++) { + var fontStyle = _d2[_i]; + mergedTheme.fonts[fontStyle] = merge$3(mergedTheme.fonts[fontStyle], partialTheme.defaultFontStyle, (_c2 = partialTheme === null || partialTheme === void 0 ? void 0 : partialTheme.fonts) === null || _c2 === void 0 ? void 0 : _c2[fontStyle]); + } + } + return mergedTheme; + } + var DefaultPalette = { + themeDarker: "#004578", + themeDark: "#005a9e", + themeDarkAlt: "#106ebe", + themePrimary: "#0078d4", + themeSecondary: "#2b88d8", + themeTertiary: "#71afe5", + themeLight: "#c7e0f4", + themeLighter: "#deecf9", + themeLighterAlt: "#eff6fc", + black: "#000000", + blackTranslucent40: "rgba(0,0,0,.4)", + neutralDark: "#201f1e", + neutralPrimary: "#323130", + neutralPrimaryAlt: "#3b3a39", + neutralSecondary: "#605e5c", + neutralSecondaryAlt: "#8a8886", + neutralTertiary: "#a19f9d", + neutralTertiaryAlt: "#c8c6c4", + neutralQuaternary: "#d2d0ce", + neutralQuaternaryAlt: "#e1dfdd", + neutralLight: "#edebe9", + neutralLighter: "#f3f2f1", + neutralLighterAlt: "#faf9f8", + accent: "#0078d4", + white: "#ffffff", + whiteTranslucent40: "rgba(255,255,255,.4)", + yellowDark: "#d29200", + yellow: "#ffb900", + yellowLight: "#fff100", + orange: "#d83b01", + orangeLight: "#ea4300", + orangeLighter: "#ff8c00", + redDark: "#a4262c", + red: "#e81123", + magentaDark: "#5c005c", + magenta: "#b4009e", + magentaLight: "#e3008c", + purpleDark: "#32145a", + purple: "#5c2d91", + purpleLight: "#b4a0ff", + blueDark: "#002050", + blueMid: "#00188f", + blue: "#0078d4", + blueLight: "#00bcf2", + tealDark: "#004b50", + teal: "#008272", + tealLight: "#00b294", + greenDark: "#004b1c", + green: "#107c10", + greenLight: "#bad80a" + }; + var Depths; + (function(Depths2) { + Depths2.depth0 = "0 0 0 0 transparent"; + Depths2.depth4 = "0 1.6px 3.6px 0 rgba(0, 0, 0, 0.132), 0 0.3px 0.9px 0 rgba(0, 0, 0, 0.108)"; + Depths2.depth8 = "0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132), 0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108)"; + Depths2.depth16 = "0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108)"; + Depths2.depth64 = "0 25.6px 57.6px 0 rgba(0, 0, 0, 0.22), 0 4.8px 14.4px 0 rgba(0, 0, 0, 0.18)"; + })(Depths || (Depths = {})); + var DefaultEffects = { + elevation4: Depths.depth4, + elevation8: Depths.depth8, + elevation16: Depths.depth16, + elevation64: Depths.depth64, + roundedCorner2: "2px", + roundedCorner4: "4px", + roundedCorner6: "6px" + }; + var DefaultSpacing = { + s2: "4px", + s1: "8px", + m: "16px", + l1: "20px", + l2: "32px" + }; + var EASING_FUNCTION_1 = "cubic-bezier(.1,.9,.2,1)"; + var EASING_FUNCTION_2 = "cubic-bezier(.1,.25,.75,.9)"; + var DURATION_1 = "0.167s"; + var DURATION_2 = "0.267s"; + var DURATION_3 = "0.367s"; + var DURATION_4 = "0.467s"; + var FADE_IN = keyframes({ + from: { opacity: 0 }, + to: { opacity: 1 } + }); + var FADE_OUT = keyframes({ + from: { opacity: 1 }, + to: { opacity: 0, visibility: "hidden" } + }); + var SLIDE_RIGHT_IN10 = _createSlideInX(-10); + var SLIDE_RIGHT_IN20 = _createSlideInX(-20); + var SLIDE_RIGHT_IN40 = _createSlideInX(-40); + var SLIDE_RIGHT_IN400 = _createSlideInX(-400); + var SLIDE_LEFT_IN10 = _createSlideInX(10); + var SLIDE_LEFT_IN20 = _createSlideInX(20); + var SLIDE_LEFT_IN40 = _createSlideInX(40); + var SLIDE_LEFT_IN400 = _createSlideInX(400); + var SLIDE_UP_IN10 = _createSlideInY(10); + var SLIDE_UP_IN20 = _createSlideInY(20); + var SLIDE_DOWN_IN10 = _createSlideInY(-10); + var SLIDE_DOWN_IN20 = _createSlideInY(-20); + var SLIDE_RIGHT_OUT10 = _createSlideOutX(10); + var SLIDE_RIGHT_OUT20 = _createSlideOutX(20); + var SLIDE_RIGHT_OUT40 = _createSlideOutX(40); + var SLIDE_RIGHT_OUT400 = _createSlideOutX(400); + var SLIDE_LEFT_OUT10 = _createSlideOutX(-10); + var SLIDE_LEFT_OUT20 = _createSlideOutX(-20); + var SLIDE_LEFT_OUT40 = _createSlideOutX(-40); + var SLIDE_LEFT_OUT400 = _createSlideOutX(-400); + var SLIDE_UP_OUT10 = _createSlideOutY(-10); + var SLIDE_UP_OUT20 = _createSlideOutY(-20); + var SLIDE_DOWN_OUT10 = _createSlideOutY(10); + var SLIDE_DOWN_OUT20 = _createSlideOutY(20); + var SCALE_UP100 = keyframes({ + from: { transform: "scale3d(.98,.98,1)" }, + to: { transform: "scale3d(1,1,1)" } + }); + var SCALE_DOWN98 = keyframes({ + from: { transform: "scale3d(1,1,1)" }, + to: { transform: "scale3d(.98,.98,1)" } + }); + var SCALE_DOWN100 = keyframes({ + from: { transform: "scale3d(1.03,1.03,1)" }, + to: { transform: "scale3d(1,1,1)" } + }); + var SCALE_UP103 = keyframes({ + from: { transform: "scale3d(1,1,1)" }, + to: { transform: "scale3d(1.03,1.03,1)" } + }); + var ROTATE90 = keyframes({ + from: { transform: "rotateZ(0deg)" }, + to: { transform: "rotateZ(90deg)" } + }); + var ROTATE_N90 = keyframes({ + from: { transform: "rotateZ(0deg)" }, + to: { transform: "rotateZ(-90deg)" } + }); + var AnimationVariables = { + easeFunction1: EASING_FUNCTION_1, + easeFunction2: EASING_FUNCTION_2, + durationValue2: DURATION_2, + durationValue3: DURATION_3 + }; + var AnimationStyles = { + slideRightIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN10), DURATION_3, EASING_FUNCTION_1), + slideRightIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN20), DURATION_3, EASING_FUNCTION_1), + slideRightIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN40), DURATION_3, EASING_FUNCTION_1), + slideRightIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_RIGHT_IN400), DURATION_3, EASING_FUNCTION_1), + slideLeftIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN10), DURATION_3, EASING_FUNCTION_1), + slideLeftIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN20), DURATION_3, EASING_FUNCTION_1), + slideLeftIn40: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN40), DURATION_3, EASING_FUNCTION_1), + slideLeftIn400: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_LEFT_IN400), DURATION_3, EASING_FUNCTION_1), + slideUpIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN10), DURATION_3, EASING_FUNCTION_1), + slideUpIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_UP_IN20), DURATION_3, EASING_FUNCTION_1), + slideDownIn10: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN10), DURATION_3, EASING_FUNCTION_1), + slideDownIn20: _createAnimation("".concat(FADE_IN, ",").concat(SLIDE_DOWN_IN20), DURATION_3, EASING_FUNCTION_1), + slideRightOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT10), DURATION_3, EASING_FUNCTION_1), + slideRightOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT20), DURATION_3, EASING_FUNCTION_1), + slideRightOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT40), DURATION_3, EASING_FUNCTION_1), + slideRightOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_RIGHT_OUT400), DURATION_3, EASING_FUNCTION_1), + slideLeftOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT10), DURATION_3, EASING_FUNCTION_1), + slideLeftOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT20), DURATION_3, EASING_FUNCTION_1), + slideLeftOut40: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT40), DURATION_3, EASING_FUNCTION_1), + slideLeftOut400: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_LEFT_OUT400), DURATION_3, EASING_FUNCTION_1), + slideUpOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT10), DURATION_3, EASING_FUNCTION_1), + slideUpOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_UP_OUT20), DURATION_3, EASING_FUNCTION_1), + slideDownOut10: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT10), DURATION_3, EASING_FUNCTION_1), + slideDownOut20: _createAnimation("".concat(FADE_OUT, ",").concat(SLIDE_DOWN_OUT20), DURATION_3, EASING_FUNCTION_1), + scaleUpIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_UP100), DURATION_3, EASING_FUNCTION_1), + scaleDownIn100: _createAnimation("".concat(FADE_IN, ",").concat(SCALE_DOWN100), DURATION_3, EASING_FUNCTION_1), + scaleUpOut103: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_UP103), DURATION_1, EASING_FUNCTION_2), + scaleDownOut98: _createAnimation("".concat(FADE_OUT, ",").concat(SCALE_DOWN98), DURATION_1, EASING_FUNCTION_2), + fadeIn100: _createAnimation(FADE_IN, DURATION_1, EASING_FUNCTION_2), + fadeIn200: _createAnimation(FADE_IN, DURATION_2, EASING_FUNCTION_2), + fadeIn400: _createAnimation(FADE_IN, DURATION_3, EASING_FUNCTION_2), + fadeIn500: _createAnimation(FADE_IN, DURATION_4, EASING_FUNCTION_2), + fadeOut100: _createAnimation(FADE_OUT, DURATION_1, EASING_FUNCTION_2), + fadeOut200: _createAnimation(FADE_OUT, DURATION_2, EASING_FUNCTION_2), + fadeOut400: _createAnimation(FADE_OUT, DURATION_3, EASING_FUNCTION_2), + fadeOut500: _createAnimation(FADE_OUT, DURATION_4, EASING_FUNCTION_2), + rotate90deg: _createAnimation(ROTATE90, "0.1s", EASING_FUNCTION_2), + rotateN90deg: _createAnimation(ROTATE_N90, "0.1s", EASING_FUNCTION_2) + // expandCollapse 100/200/400, delay 100/200 + }; + function _createAnimation(animationName, animationDuration2, animationTimingFunction) { + return { + animationName, + animationDuration: animationDuration2, + animationTimingFunction, + animationFillMode: "both" }; - var onMenuKeyDown = function(ev) { - // Mark as handled if onKeyDown returns true (for handling collapse cases) - // or if we are attempting to expand a submenu - var handled = onKeyDown(ev); - if (handled || !hostElement.current) return; - // If we have a modifier key being pressed, we do not want to move focus. - // Otherwise, handle up and down keys. - var hasModifier = !!(ev.altKey || ev.metaKey); - // eslint-disable-next-line deprecation/deprecation - var isUp = ev.which === (0, _utilities.KeyCodes).up; - // eslint-disable-next-line deprecation/deprecation - var isDown = ev.which === (0, _utilities.KeyCodes).down; - if (!hasModifier && (isUp || isDown)) { - var elementToFocus = isUp ? (0, _utilities.getLastFocusable)(hostElement.current, hostElement.current.lastChild, true) : (0, _utilities.getFirstFocusable)(hostElement.current, hostElement.current.firstChild, true); - if (elementToFocus) { - elementToFocus.focus(); - ev.preventDefault(); - ev.stopPropagation(); - } - } + } + function _createSlideInX(fromX) { + return keyframes({ + from: { transform: "translate3d(".concat(fromX, "px,0,0)"), pointerEvents: "none" }, + to: { transform: "translate3d(0,0,0)", pointerEvents: "auto" } + }); + } + function _createSlideInY(fromY) { + return keyframes({ + from: { transform: "translate3d(0,".concat(fromY, "px,0)"), pointerEvents: "none" }, + to: { transform: "translate3d(0,0,0)", pointerEvents: "auto" } + }); + } + function _createSlideOutX(toX) { + return keyframes({ + from: { transform: "translate3d(0,0,0)" }, + to: { transform: "translate3d(".concat(toX, "px,0,0)") } + }); + } + function _createSlideOutY(toY) { + return keyframes({ + from: { transform: "translate3d(0,0,0)" }, + to: { transform: "translate3d(0,".concat(toY, "px,0)") } + }); + } + var LocalizedFontNames; + (function(LocalizedFontNames2) { + LocalizedFontNames2.Arabic = "Segoe UI Web (Arabic)"; + LocalizedFontNames2.Cyrillic = "Segoe UI Web (Cyrillic)"; + LocalizedFontNames2.EastEuropean = "Segoe UI Web (East European)"; + LocalizedFontNames2.Greek = "Segoe UI Web (Greek)"; + LocalizedFontNames2.Hebrew = "Segoe UI Web (Hebrew)"; + LocalizedFontNames2.Thai = "Leelawadee UI Web"; + LocalizedFontNames2.Vietnamese = "Segoe UI Web (Vietnamese)"; + LocalizedFontNames2.WestEuropean = "Segoe UI Web (West European)"; + LocalizedFontNames2.Selawik = "Selawik Web"; + LocalizedFontNames2.Armenian = "Segoe UI Web (Armenian)"; + LocalizedFontNames2.Georgian = "Segoe UI Web (Georgian)"; + })(LocalizedFontNames || (LocalizedFontNames = {})); + var LocalizedFontFamilies; + (function(LocalizedFontFamilies2) { + LocalizedFontFamilies2.Arabic = "'".concat(LocalizedFontNames.Arabic, "'"); + LocalizedFontFamilies2.ChineseSimplified = "'Microsoft Yahei UI', Verdana, Simsun"; + LocalizedFontFamilies2.ChineseTraditional = "'Microsoft Jhenghei UI', Pmingliu"; + LocalizedFontFamilies2.Cyrillic = "'".concat(LocalizedFontNames.Cyrillic, "'"); + LocalizedFontFamilies2.EastEuropean = "'".concat(LocalizedFontNames.EastEuropean, "'"); + LocalizedFontFamilies2.Greek = "'".concat(LocalizedFontNames.Greek, "'"); + LocalizedFontFamilies2.Hebrew = "'".concat(LocalizedFontNames.Hebrew, "'"); + LocalizedFontFamilies2.Hindi = "'Nirmala UI'"; + LocalizedFontFamilies2.Japanese = "'Yu Gothic UI', 'Meiryo UI', Meiryo, 'MS Pgothic', Osaka"; + LocalizedFontFamilies2.Korean = "'Malgun Gothic', Gulim"; + LocalizedFontFamilies2.Selawik = "'".concat(LocalizedFontNames.Selawik, "'"); + LocalizedFontFamilies2.Thai = "'Leelawadee UI Web', 'Kmer UI'"; + LocalizedFontFamilies2.Vietnamese = "'".concat(LocalizedFontNames.Vietnamese, "'"); + LocalizedFontFamilies2.WestEuropean = "'".concat(LocalizedFontNames.WestEuropean, "'"); + LocalizedFontFamilies2.Armenian = "'".concat(LocalizedFontNames.Armenian, "'"); + LocalizedFontFamilies2.Georgian = "'".concat(LocalizedFontNames.Georgian, "'"); + })(LocalizedFontFamilies || (LocalizedFontFamilies = {})); + var FontSizes; + (function(FontSizes2) { + FontSizes2.size10 = "10px"; + FontSizes2.size12 = "12px"; + FontSizes2.size14 = "14px"; + FontSizes2.size16 = "16px"; + FontSizes2.size18 = "18px"; + FontSizes2.size20 = "20px"; + FontSizes2.size24 = "24px"; + FontSizes2.size28 = "28px"; + FontSizes2.size32 = "32px"; + FontSizes2.size42 = "42px"; + FontSizes2.size68 = "68px"; + FontSizes2.mini = "10px"; + FontSizes2.xSmall = "10px"; + FontSizes2.small = "12px"; + FontSizes2.smallPlus = "12px"; + FontSizes2.medium = "14px"; + FontSizes2.mediumPlus = "16px"; + FontSizes2.icon = "16px"; + FontSizes2.large = "18px"; + FontSizes2.xLarge = "20px"; + FontSizes2.xLargePlus = "24px"; + FontSizes2.xxLarge = "28px"; + FontSizes2.xxLargePlus = "32px"; + FontSizes2.superLarge = "42px"; + FontSizes2.mega = "68px"; + })(FontSizes || (FontSizes = {})); + var FontWeights; + (function(FontWeights2) { + FontWeights2.light = 100; + FontWeights2.semilight = 300; + FontWeights2.regular = 400; + FontWeights2.semibold = 600; + FontWeights2.bold = 700; + })(FontWeights || (FontWeights = {})); + var IconFontSizes; + (function(IconFontSizes2) { + IconFontSizes2.xSmall = "10px"; + IconFontSizes2.small = "12px"; + IconFontSizes2.medium = "16px"; + IconFontSizes2.large = "20px"; + })(IconFontSizes || (IconFontSizes = {})); + var FontFamilyFallbacks = "'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif"; + var defaultFontFamily = "'Segoe UI', '".concat(LocalizedFontNames.WestEuropean, "'"); + var LanguageToFontMap = { + ar: LocalizedFontFamilies.Arabic, + bg: LocalizedFontFamilies.Cyrillic, + cs: LocalizedFontFamilies.EastEuropean, + el: LocalizedFontFamilies.Greek, + et: LocalizedFontFamilies.EastEuropean, + he: LocalizedFontFamilies.Hebrew, + hi: LocalizedFontFamilies.Hindi, + hr: LocalizedFontFamilies.EastEuropean, + hu: LocalizedFontFamilies.EastEuropean, + ja: LocalizedFontFamilies.Japanese, + kk: LocalizedFontFamilies.EastEuropean, + ko: LocalizedFontFamilies.Korean, + lt: LocalizedFontFamilies.EastEuropean, + lv: LocalizedFontFamilies.EastEuropean, + pl: LocalizedFontFamilies.EastEuropean, + ru: LocalizedFontFamilies.Cyrillic, + sk: LocalizedFontFamilies.EastEuropean, + "sr-latn": LocalizedFontFamilies.EastEuropean, + th: LocalizedFontFamilies.Thai, + tr: LocalizedFontFamilies.EastEuropean, + uk: LocalizedFontFamilies.Cyrillic, + vi: LocalizedFontFamilies.Vietnamese, + "zh-hans": LocalizedFontFamilies.ChineseSimplified, + "zh-hant": LocalizedFontFamilies.ChineseTraditional, + hy: LocalizedFontFamilies.Armenian, + ka: LocalizedFontFamilies.Georgian + }; + function _fontFamilyWithFallbacks(fontFamily2) { + return "".concat(fontFamily2, ", ").concat(FontFamilyFallbacks); + } + function _getLocalizedFontFamily(language) { + for (var lang in LanguageToFontMap) { + if (LanguageToFontMap.hasOwnProperty(lang) && language && lang.indexOf(language) === 0) { + return LanguageToFontMap[lang]; + } + } + return defaultFontFamily; + } + function _createFont(size, weight, fontFamily2) { + return { + fontFamily: fontFamily2, + MozOsxFontSmoothing: "grayscale", + WebkitFontSmoothing: "antialiased", + fontSize: size, + fontWeight: weight }; - var onItemKeyDown = function(item, ev) { - var openKey = (0, _utilities.getRTL)(theme) ? (0, _utilities.KeyCodes).left : (0, _utilities.KeyCodes).right; - if (!item.disabled && // eslint-disable-next-line deprecation/deprecation - (ev.which === openKey || ev.which === (0, _utilities.KeyCodes).enter || ev.which === (0, _utilities.KeyCodes).down && (ev.altKey || ev.metaKey))) { - openSubMenu(item, ev.currentTarget); - ev.preventDefault(); - } + } + function createFontStyles(localeCode) { + var localizedFont = _getLocalizedFontFamily(localeCode); + var fontFamilyWithFallback = _fontFamilyWithFallbacks(localizedFont); + var fontStyles = { + tiny: _createFont(FontSizes.mini, FontWeights.regular, fontFamilyWithFallback), + xSmall: _createFont(FontSizes.xSmall, FontWeights.regular, fontFamilyWithFallback), + small: _createFont(FontSizes.small, FontWeights.regular, fontFamilyWithFallback), + smallPlus: _createFont(FontSizes.smallPlus, FontWeights.regular, fontFamilyWithFallback), + medium: _createFont(FontSizes.medium, FontWeights.regular, fontFamilyWithFallback), + mediumPlus: _createFont(FontSizes.mediumPlus, FontWeights.regular, fontFamilyWithFallback), + large: _createFont(FontSizes.large, FontWeights.regular, fontFamilyWithFallback), + xLarge: _createFont(FontSizes.xLarge, FontWeights.semibold, fontFamilyWithFallback), + xLargePlus: _createFont(FontSizes.xLargePlus, FontWeights.semibold, fontFamilyWithFallback), + xxLarge: _createFont(FontSizes.xxLarge, FontWeights.semibold, fontFamilyWithFallback), + xxLargePlus: _createFont(FontSizes.xxLargePlus, FontWeights.semibold, fontFamilyWithFallback), + superLarge: _createFont(FontSizes.superLarge, FontWeights.semibold, fontFamilyWithFallback), + mega: _createFont(FontSizes.mega, FontWeights.semibold, fontFamilyWithFallback) }; - return [ - onKeyDown, - onKeyUp, - onMenuKeyDown, - onItemKeyDown - ]; -} -function useScrollHandler(asyncTracker) { - var isScrollIdle = _react.useRef(true); - var scrollIdleTimeoutId = _react.useRef(); - /** - * Scroll handler for the callout to make sure the mouse events - * for updating focus are not interacting during scroll - */ var onScroll = function() { - if (!isScrollIdle.current && scrollIdleTimeoutId.current !== undefined) { - asyncTracker.clearTimeout(scrollIdleTimeoutId.current); - scrollIdleTimeoutId.current = undefined; - } else isScrollIdle.current = false; - scrollIdleTimeoutId.current = asyncTracker.setTimeout(function() { - isScrollIdle.current = true; - }, NavigationIdleDelay); + return fontStyles; + } + var DefaultBaseUrl = "https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets"; + var DefaultFontStyles = createFontStyles(getLanguage()); + function _registerFontFace(fontFamily2, url, fontWeight, localFontName) { + fontFamily2 = "'".concat(fontFamily2, "'"); + var localFontSrc = localFontName !== void 0 ? "local('".concat(localFontName, "'),") : ""; + fontFace({ + fontFamily: fontFamily2, + src: localFontSrc + "url('".concat(url, ".woff2') format('woff2'),") + "url('".concat(url, ".woff') format('woff')"), + fontWeight, + fontStyle: "normal", + fontDisplay: "swap" + }); + } + function _registerFontFaceSet(baseUrl, fontFamily2, cdnFolder, cdnFontName, localFontName) { + if (cdnFontName === void 0) { + cdnFontName = "segoeui"; + } + var urlBase = "".concat(baseUrl, "/").concat(cdnFolder, "/").concat(cdnFontName); + _registerFontFace(fontFamily2, urlBase + "-light", FontWeights.light, localFontName && localFontName + " Light"); + _registerFontFace(fontFamily2, urlBase + "-semilight", FontWeights.semilight, localFontName && localFontName + " SemiLight"); + _registerFontFace(fontFamily2, urlBase + "-regular", FontWeights.regular, localFontName); + _registerFontFace(fontFamily2, urlBase + "-semibold", FontWeights.semibold, localFontName && localFontName + " SemiBold"); + _registerFontFace(fontFamily2, urlBase + "-bold", FontWeights.bold, localFontName && localFontName + " Bold"); + } + function registerDefaultFontFaces(baseUrl) { + if (baseUrl) { + var fontUrl = "".concat(baseUrl, "/fonts"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Thai, "leelawadeeui-thai", "leelawadeeui"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Arabic, "segoeui-arabic"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Cyrillic, "segoeui-cyrillic"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.EastEuropean, "segoeui-easteuropean"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Greek, "segoeui-greek"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Hebrew, "segoeui-hebrew"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Vietnamese, "segoeui-vietnamese"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.WestEuropean, "segoeui-westeuropean", "segoeui", "Segoe UI"); + _registerFontFaceSet(fontUrl, LocalizedFontFamilies.Selawik, "selawik", "selawik"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Armenian, "segoeui-armenian"); + _registerFontFaceSet(fontUrl, LocalizedFontNames.Georgian, "segoeui-georgian"); + _registerFontFace("Leelawadee UI Web", "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-semilight"), FontWeights.light); + _registerFontFace("Leelawadee UI Web", "".concat(fontUrl, "/leelawadeeui-thai/leelawadeeui-bold"), FontWeights.semibold); + } + } + function _getFontBaseUrl() { + var _a2, _b2; + var fabricConfig = (_a2 = getWindow()) === null || _a2 === void 0 ? void 0 : _a2.FabricConfig; + return (_b2 = fabricConfig === null || fabricConfig === void 0 ? void 0 : fabricConfig.fontBaseUrl) !== null && _b2 !== void 0 ? _b2 : DefaultBaseUrl; + } + registerDefaultFontFaces(_getFontBaseUrl()); + function createTheme(theme, depComments) { + if (theme === void 0) { + theme = {}; + } + if (depComments === void 0) { + depComments = false; + } + var isInverted = !!theme.isInverted; + var baseTheme = { + palette: DefaultPalette, + effects: DefaultEffects, + fonts: DefaultFontStyles, + spacing: DefaultSpacing, + isInverted, + disableGlobalClassNames: false, + semanticColors: makeSemanticColors(DefaultPalette, DefaultEffects, void 0, isInverted, depComments), + rtl: void 0 + }; + return mergeThemes(baseTheme, theme); + } + var HighContrastSelector = "@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)"; + var HighContrastSelectorWhite = ( + // eslint-disable-next-line @fluentui/max-len + "@media screen and (-ms-high-contrast: black-on-white), screen and (forced-colors: active) and (prefers-color-scheme: light)" + ); + var ScreenWidthMinSmall = 320; + var ScreenWidthMinMedium = 480; + var ScreenWidthMinLarge = 640; + var ScreenWidthMinXLarge = 1024; + var ScreenWidthMinXXLarge = 1366; + var ScreenWidthMaxSmall = ScreenWidthMinMedium - 1; + var ScreenWidthMaxMedium = ScreenWidthMinLarge - 1; + var ScreenWidthMinUhfMobile = 768; + function getScreenSelector(min2, max2) { + var minSelector = " and (min-width: ".concat(min2, "px)"); + var maxSelector = typeof max2 === "number" ? " and (max-width: ".concat(max2, "px)") : ""; + return "@media only screen".concat(minSelector).concat(maxSelector); + } + function getHighContrastNoAdjustStyle() { + return { + forcedColorAdjust: "none", + MsHighContrastAdjust: "none" }; - return [ - onScroll, - isScrollIdle - ]; -} -function useOnSubmenuDismiss(dismiss, closeSubMenu) { - var isMountedRef = _react.useRef(false); - _react.useEffect(function() { - isMountedRef.current = true; - return function() { - isMountedRef.current = false; - }; - }, []); - /** - * This function is called ASYNCHRONOUSLY, and so there is a chance it is called - * after the component is unmounted. The isMountedRef is added to prevent - * from calling setState() after unmount. Do NOT copy this pattern in synchronous - * code. - */ var onSubMenuDismiss = function(ev, dismissAll) { - if (dismissAll) dismiss(ev, dismissAll); - else if (isMountedRef.current) closeSubMenu(); + } + var ZIndexes; + (function(ZIndexes2) { + ZIndexes2.Nav = 1; + ZIndexes2.ScrollablePane = 1; + ZIndexes2.FocusStyle = 1; + ZIndexes2.Coachmark = 1e3; + ZIndexes2.Layer = 1e6; + ZIndexes2.KeytipLayer = 1000001; + })(ZIndexes || (ZIndexes = {})); + function getFocusStyle(theme, insetOrOptions, position2, highContrastStyle, borderColor, outlineColor, isFocusedOnly, borderRadius) { + if (typeof insetOrOptions === "number" || !insetOrOptions) { + return _getFocusStyleInternal(theme, { + inset: insetOrOptions, + position: position2, + highContrastStyle, + borderColor, + outlineColor, + isFocusedOnly, + borderRadius + }); + } else { + return _getFocusStyleInternal(theme, insetOrOptions); + } + } + function _getFocusStyleInternal(theme, options2) { + var _a2, _b2; + if (options2 === void 0) { + options2 = {}; + } + var borderRadius = options2.borderRadius, _c2 = options2.inset, inset = _c2 === void 0 ? 0 : _c2, _d2 = options2.width, width2 = _d2 === void 0 ? 1 : _d2, _e2 = options2.position, position2 = _e2 === void 0 ? "relative" : _e2, highContrastStyle = options2.highContrastStyle, _f = options2.borderColor, borderColor = _f === void 0 ? theme.palette.white : _f, _g = options2.outlineColor, outlineColor = _g === void 0 ? theme.palette.neutralSecondary : _g, _h = options2.isFocusedOnly, isFocusedOnly = _h === void 0 ? true : _h, pointerEvents = options2.pointerEvents; + return { + // Clear browser-specific focus styles and use 'transparent' as placeholder for focus style. + outline: "transparent", + // Requirement because pseudo-element is absolutely positioned. + position: position2, + selectors: (_a2 = { + // Clear the focus border in Firefox. + // Reference: http://stackoverflow.com/a/199319/1436671 + "::-moz-focus-inner": { + border: "0" + } + }, // When the element that uses this mixin is in a :focus state, add a pseudo-element to + // create a border. + _a2[".".concat(IsFocusVisibleClassName, " &").concat(isFocusedOnly ? ":focus" : "", ":after, :host(.").concat(IsFocusVisibleClassName, ") &").concat(isFocusedOnly ? ":focus" : "", ":after")] = { + content: '""', + position: "absolute", + pointerEvents, + left: inset + 1, + top: inset + 1, + bottom: inset + 1, + right: inset + 1, + border: "".concat(width2, "px solid ").concat(borderColor), + outline: "".concat(width2, "px solid ").concat(outlineColor), + zIndex: ZIndexes.FocusStyle, + borderRadius, + selectors: (_b2 = {}, _b2[HighContrastSelector] = highContrastStyle, _b2) + }, _a2) }; - return onSubMenuDismiss; -} -function useSubmenuEnterTimer(_a, asyncTracker) { - var _b = _a.subMenuHoverDelay, subMenuHoverDelay = _b === void 0 ? NavigationIdleDelay : _b; - var enterTimerRef = _react.useRef(undefined); - var cancelSubMenuTimer = function() { - if (enterTimerRef.current !== undefined) { - asyncTracker.clearTimeout(enterTimerRef.current); - enterTimerRef.current = undefined; + } + function focusClear() { + return { + selectors: { + "&::-moz-focus-inner": { + // Clear the focus border in Firefox. Reference: http://stackoverflow.com/a/199319/1436671 + border: 0 + }, + "&": { + // Clear browser specific focus styles and use transparent as placeholder for focus style + outline: "transparent" } + } }; - var startSubmenuTimer = function(onTimerExpired) { - enterTimerRef.current = asyncTracker.setTimeout(function() { - onTimerExpired(); - cancelSubMenuTimer(); - }, subMenuHoverDelay); - }; - return [ - cancelSubMenuTimer, - startSubmenuTimer, - enterTimerRef - ]; -} -function useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss) { - var menuTarget = props.target; - var onItemMouseEnterBase = function(item, ev, target) { - if (shouldUpdateFocusOnMouseEvent.current) gotMouseMove.current = true; - if (shouldIgnoreMouseEvent()) return; - updateFocusOnMouseEvent(item, ev, target); - }; - var onItemMouseMoveBase = function(item, ev, target) { - var targetElement = ev.currentTarget; - // Always do this check to make sure we record a mouseMove if needed (even if we are timed out) - if (shouldUpdateFocusOnMouseEvent.current) gotMouseMove.current = true; - else return; - if (!isScrollIdle.current || subMenuEntryTimer.current !== undefined || targetElement === (targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement)) return; - updateFocusOnMouseEvent(item, ev, target); - }; - var shouldIgnoreMouseEvent = function() { - return !isScrollIdle.current || !gotMouseMove.current; - }; - var onMouseItemLeave = function(item, ev) { - var _a; - if (shouldIgnoreMouseEvent()) return; - cancelSubMenuTimer(); - if (expandedMenuItemKey !== undefined) return; - /** - * IE11 focus() method forces parents to scroll to top of element. - * Edge and IE expose a setActive() function for focusable divs that - * sets the page focus but does not scroll the parent element. - */ if (hostElement.current.setActive) try { - hostElement.current.setActive(); - } catch (e) { - /* no-op */ } - else (_a = hostElement.current) === null || _a === void 0 || _a.focus(); - }; - /** - * Handles updating focus when mouseEnter or mouseMove fire. - * As part of updating focus, This function will also update - * the expand/collapse state accordingly. - */ var updateFocusOnMouseEvent = function(item, ev, target) { - var targetElement = target ? target : ev.currentTarget; - if (item.key === expandedMenuItemKey) return; - cancelSubMenuTimer(); - // If the menu is not expanded we can update focus without any delay - if (expandedMenuItemKey === undefined) targetElement.focus(); - // Delay updating expanding/dismissing the submenu - // and only set focus if we have not already done so - if ((0, _index.hasSubmenu)(item)) { - ev.stopPropagation(); - startSubmenuTimer(function() { - targetElement.focus(); - openSubMenu(item, targetElement, true); - }); - } else startSubmenuTimer(function() { - onSubMenuDismiss(ev); - targetElement.focus(); - }); + } + var getInputFocusStyle = function(borderColor, borderRadius, borderType, borderPosition) { + var _a2, _b2, _c2; + if (borderType === void 0) { + borderType = "border"; + } + if (borderPosition === void 0) { + borderPosition = -1; + } + var isBorderBottom = borderType === "borderBottom"; + return { + borderColor, + selectors: { + ":after": (_a2 = { + pointerEvents: "none", + content: "''", + position: "absolute", + left: isBorderBottom ? 0 : borderPosition, + top: borderPosition, + bottom: borderPosition, + right: isBorderBottom ? 0 : borderPosition + }, _a2[borderType] = "2px solid ".concat(borderColor), _a2.borderRadius = borderRadius, _a2.width = borderType === "borderBottom" ? "100%" : void 0, _a2.selectors = (_b2 = {}, _b2[HighContrastSelector] = (_c2 = {}, _c2[borderType === "border" ? "borderColor" : "borderBottomColor"] = "Highlight", _c2), _b2), _a2) + } }; - var onItemClick = function(item, ev) { - onItemClickBase(item, ev, ev.currentTarget); + }; + var hiddenContentStyle = { + position: "absolute", + width: 1, + height: 1, + margin: -1, + padding: 0, + border: 0, + overflow: "hidden", + whiteSpace: "nowrap" + }; + var _getGlobalClassNames = memoizeFunction(function(classNames2, disableGlobalClassNames) { + var styleSheet = Stylesheet.getInstance(); + if (disableGlobalClassNames) { + return Object.keys(classNames2).reduce(function(acc, className2) { + acc[className2] = styleSheet.getClassName(classNames2[className2]); + return acc; + }, {}); + } + return classNames2; + }); + function getGlobalClassNames(classNames2, theme, disableGlobalClassNames) { + return _getGlobalClassNames(classNames2, theme.disableGlobalClassNames); + } + var __assign = function() { + __assign = Object.assign || function(t) { + for (var s2, i = 1, n = arguments.length; i < n; i++) { + s2 = arguments[i]; + for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) + t[p] = s2[p]; + } + return t; }; - var onItemClickBase = function(item, ev, target) { - var items = getSubmenuItems(item, { - target: menuTarget - }); - // Cancel an async menu item hover timeout action from being taken and instead - // just trigger the click event instead. - cancelSubMenuTimer(); - if (!(0, _index.hasSubmenu)(item) && (!items || !items.length)) // This is an item without a menu. Click it. - executeItemClick(item, ev); - else if (item.key !== expandedMenuItemKey) { - // This has a collapsed sub menu. Expand it. - // focus on the container by default when the menu is opened with a click event - // this differentiates from a keyboard interaction triggering the click event - var shouldFocusOnContainer = typeof props.shouldFocusOnContainer === 'boolean' ? props.shouldFocusOnContainer : ev.nativeEvent.pointerType === 'mouse'; - openSubMenu(item, target, shouldFocusOnContainer); - } - ev.stopPropagation(); - ev.preventDefault(); + return __assign.apply(this, arguments); + }; + var _root = typeof window === "undefined" ? global : window; + var _styleNonce = _root && _root.CSPSettings && _root.CSPSettings.nonce; + var _themeState = initializeThemeState(); + function initializeThemeState() { + var state = _root.__themeState__ || { + theme: void 0, + lastStyleElement: void 0, + registeredStyles: [] + }; + if (!state.runState) { + state = __assign(__assign({}, state), { perf: { + count: 0, + duration: 0 + }, runState: { + flushTimer: 0, + mode: 0, + buffer: [] + } }); + } + if (!state.registeredThemableStyles) { + state = __assign(__assign({}, state), { registeredThemableStyles: [] }); + } + _root.__themeState__ = state; + return state; + } + function applyThemableStyles(stylesArray, styleRecord) { + if (_themeState.loadStyles) { + _themeState.loadStyles(resolveThemableArray(stylesArray).styleString, stylesArray); + } else { + registerStyles(stylesArray); + } + } + function loadTheme$1(theme) { + _themeState.theme = theme; + reloadStyles(); + } + function clearStyles(option) { + { + clearStylesInternal(_themeState.registeredThemableStyles); + _themeState.registeredThemableStyles = []; + } + } + function clearStylesInternal(records) { + records.forEach(function(styleRecord) { + var styleElement = styleRecord && styleRecord.styleElement; + if (styleElement && styleElement.parentElement) { + styleElement.parentElement.removeChild(styleElement); + } + }); + } + function reloadStyles() { + if (_themeState.theme) { + var themableStyles = []; + for (var _i = 0, _a2 = _themeState.registeredThemableStyles; _i < _a2.length; _i++) { + var styleRecord = _a2[_i]; + themableStyles.push(styleRecord.themableStyle); + } + if (themableStyles.length > 0) { + clearStyles(); + applyThemableStyles([].concat.apply([], themableStyles)); + } + } + } + function resolveThemableArray(splitStyleArray) { + var theme = _themeState.theme; + var themable = false; + var resolvedArray = (splitStyleArray || []).map(function(currentValue) { + var themeSlot = currentValue.theme; + if (themeSlot) { + themable = true; + var themedValue = theme ? theme[themeSlot] : void 0; + var defaultValue = currentValue.defaultValue || "inherit"; + if (theme && !themedValue && console && !(themeSlot in theme) && typeof DEBUG !== "undefined" && DEBUG) { + console.warn('Theming value not provided for "'.concat(themeSlot, '". Falling back to "').concat(defaultValue, '".')); + } + return themedValue || defaultValue; + } else { + return currentValue.rawString; + } + }); + return { + styleString: resolvedArray.join(""), + themable }; - var onAnchorClick = function(item, ev) { - executeItemClick(item, ev); - ev.stopPropagation(); + } + function registerStyles(styleArray) { + if (typeof document === "undefined") { + return; + } + var head = document.getElementsByTagName("head")[0]; + var styleElement = document.createElement("style"); + var _a2 = resolveThemableArray(styleArray), styleString = _a2.styleString, themable = _a2.themable; + styleElement.setAttribute("data-load-themed-styles", "true"); + if (_styleNonce) { + styleElement.setAttribute("nonce", _styleNonce); + } + styleElement.appendChild(document.createTextNode(styleString)); + _themeState.perf.count++; + head.appendChild(styleElement); + var ev = document.createEvent("HTMLEvents"); + ev.initEvent( + "styleinsert", + true, + false + /* cancelable */ + ); + ev.args = { + newStyle: styleElement }; - var executeItemClick = function(item, ev) { - if (item.disabled || item.isDisabled) return; - if (item.preferMenuTargetAsEventTarget) overrideTarget(ev, menuTarget); - var shouldDismiss = false; - if (item.onClick) shouldDismiss = !!item.onClick(ev, item); - else if (props.onItemClick) shouldDismiss = !!props.onItemClick(ev, item); - if (shouldDismiss || !ev.defaultPrevented) dismiss(ev, true); + document.dispatchEvent(ev); + var record = { + styleElement, + themableStyle: styleArray }; - return [ - onItemMouseEnterBase, - onItemMouseMoveBase, - onMouseItemLeave, - onItemClick, - onAnchorClick, - executeItemClick, - onItemClickBase - ]; -} -var ContextualMenuBase = _react.memo(_react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var _a; - var _b = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults), ref = _b.ref, props = (0, _tslib.__rest)(_b, [ - "ref" - ]); - var hostElement = _react.useRef(null); - var asyncTracker = (0, _reactHooks.useAsync)(); - var menuId = (0, _reactHooks.useId)(COMPONENT_NAME, props.id); - (0, _reactHooks.useWarnings)({ - name: COMPONENT_NAME, - props: props, - deprecations: { - getMenuClassNames: 'styles' - } + if (themable) { + _themeState.registeredThemableStyles.push(record); + } else { + _themeState.registeredStyles.push(record); + } + } + var _theme = createTheme({}); + var _onThemeChangeCallbacks = []; + var ThemeSettingName = "theme"; + function initializeThemeInCustomizations() { + var _a2; + var _b2, _c2; + var win = getWindow(); + if ((_b2 = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _b2 === void 0 ? void 0 : _b2.legacyTheme) { + loadTheme(win.FabricConfig.legacyTheme); + } else if (!Customizations.getSettings([ThemeSettingName]).theme) { + if ((_c2 = win === null || win === void 0 ? void 0 : win.FabricConfig) === null || _c2 === void 0 ? void 0 : _c2.theme) { + _theme = createTheme(win.FabricConfig.theme); + } + Customizations.applySettings((_a2 = {}, _a2[ThemeSettingName] = _theme, _a2)); + } + } + initializeThemeInCustomizations(); + function getTheme(depComments) { + if (depComments === void 0) { + depComments = false; + } + if (depComments === true) { + _theme = createTheme({}, depComments); + } + return _theme; + } + function loadTheme(theme, depComments) { + var _a2; + if (depComments === void 0) { + depComments = false; + } + _theme = createTheme(theme, depComments); + loadTheme$1(__assign$1(__assign$1(__assign$1(__assign$1({}, _theme.palette), _theme.semanticColors), _theme.effects), _loadFonts(_theme))); + Customizations.applySettings((_a2 = {}, _a2[ThemeSettingName] = _theme, _a2)); + _onThemeChangeCallbacks.forEach(function(callback) { + try { + callback(_theme); + } catch (e) { + } }); - var dismiss = function(ev, dismissAll) { - var _a; - return (_a = props.onDismiss) === null || _a === void 0 ? void 0 : _a.call(props, ev, dismissAll); - }; - var _c = (0, _reactHooks.useTarget)(props.target, hostElement), targetRef = _c[0], targetWindow = _c[1]; - var tryFocusPreviousActiveElement = usePreviousActiveElement(props, targetWindow, hostElement)[0]; - var _d = useSubMenuState(props, dismiss), expandedMenuItemKey = _d[0], openSubMenu = _d[1], getSubmenuProps = _d[2], onSubMenuDismiss = _d[3]; - var _e = useShouldUpdateFocusOnMouseMove(props), shouldUpdateFocusOnMouseEvent = _e[0], gotMouseMove = _e[1], onMenuFocusCapture = _e[2]; - var _f = useScrollHandler(asyncTracker), onScroll = _f[0], isScrollIdle = _f[1]; - var _g = useSubmenuEnterTimer(props, asyncTracker), cancelSubMenuTimer = _g[0], startSubmenuTimer = _g[1], subMenuEntryTimer = _g[2]; - var responsiveMode = (0, _responsiveMode.useResponsiveMode)(hostElement, props.responsiveMode); - useVisibility(props, targetWindow); - var _h = useKeyHandlers(props, dismiss, hostElement, openSubMenu), onKeyDown = _h[0], onKeyUp = _h[1], onMenuKeyDown = _h[2], onItemKeyDown = _h[3]; - var _j = useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss), onItemMouseEnterBase = _j[0], onItemMouseMoveBase = _j[1], onMouseItemLeave = _j[2], onItemClick = _j[3], onAnchorClick = _j[4], executeItemClick = _j[5], onItemClickBase = _j[6]; - //#region Render helpers - var onDefaultRenderMenuList = function(menuListProps, // eslint-disable-next-line deprecation/deprecation - menuClassNames, defaultRender) { - var indexCorrection = 0; - var items = menuListProps.items, totalItemCount = menuListProps.totalItemCount, hasCheckmarks = menuListProps.hasCheckmarks, hasIcons = menuListProps.hasIcons; - return _react.createElement("ul", { - className: menuClassNames.list, - onKeyDown: onKeyDown, - onKeyUp: onKeyUp, - role: 'presentation' - }, items.map(function(item, index) { - var menuItem = renderMenuItem(item, index, indexCorrection, totalItemCount, hasCheckmarks, hasIcons, menuClassNames); - if (item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Divider && item.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Header) { - var indexIncrease = item.customOnRenderListLength ? item.customOnRenderListLength : 1; - indexCorrection += indexIncrease; - } - return menuItem; - })); + return _theme; + } + function _loadFonts(theme) { + var lines = {}; + for (var _i = 0, _a2 = Object.keys(theme.fonts); _i < _a2.length; _i++) { + var fontName = _a2[_i]; + var font2 = theme.fonts[fontName]; + for (var _b2 = 0, _c2 = Object.keys(font2); _b2 < _c2.length; _b2++) { + var propName = _c2[_b2]; + var name_1 = fontName + propName.charAt(0).toUpperCase() + propName.slice(1); + var value2 = font2[propName]; + if (propName === "fontSize" && typeof value2 === "number") { + value2 = value2 + "px"; + } + lines[name_1] = value2; + } + } + return lines; + } + var normalize$1 = { + boxShadow: "none", + margin: 0, + padding: 0, + boxSizing: "border-box" + }; + function getPlaceholderStyles(styles) { + return { + selectors: { + "::placeholder": styles, + // Chrome, Safari, Opera, Firefox + ":-ms-input-placeholder": styles, + // IE 10+ + "::-ms-input-placeholder": styles + // Edge + } }; - var renderFocusZone = function(children, adjustedFocusZoneProps) { - var _a = props.focusZoneAs, ChildrenRenderer = _a === void 0 ? (0, _focusZone.FocusZone) : _a; - return _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({}, adjustedFocusZoneProps), children); + } + var AnimationClassNames = buildClassMap(AnimationStyles); + setVersion("@fluentui/style-utilities", "8.13.5"); + initializeThemeInCustomizations(); + var GlobalClassNames$h = { + root: "ms-Image", + rootMaximizeFrame: "ms-Image--maximizeFrame", + image: "ms-Image-image", + imageCenter: "ms-Image-image--center", + imageContain: "ms-Image-image--contain", + imageCover: "ms-Image-image--cover", + imageCenterContain: "ms-Image-image--centerContain", + imageCenterCover: "ms-Image-image--centerCover", + imageNone: "ms-Image-image--none", + imageLandscape: "ms-Image-image--landscape", + imagePortrait: "ms-Image-image--portrait" + }; + var getStyles$w = function(props) { + var className2 = props.className, width2 = props.width, height2 = props.height, maximizeFrame = props.maximizeFrame, isLoaded = props.isLoaded, shouldFadeIn = props.shouldFadeIn, shouldStartVisible = props.shouldStartVisible, isLandscape = props.isLandscape, isCenter = props.isCenter, isContain = props.isContain, isCover = props.isCover, isCenterContain = props.isCenterContain, isCenterCover = props.isCenterCover, isNone = props.isNone, isError = props.isError, isNotImageFit = props.isNotImageFit, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$h, theme); + var ImageFitStyles = { + position: "absolute", + left: "50% /* @noflip */", + top: "50%", + transform: "translate(-50%,-50%)" + // @todo test RTL renders transform: translate(50%,-50%); + }; + var window2 = getWindow(); + var supportsObjectFit = window2 !== void 0 && // eslint-disable-next-line @fluentui/max-len + // cast needed as vendor prefixed `msMaxTouchPoints` api is no longer part of TS lib declaration - introduced with TS 4.4 + window2.navigator.msMaxTouchPoints === void 0; + var fallbackObjectFitStyles = isContain && isLandscape || isCover && !isLandscape ? { width: "100%", height: "auto" } : { width: "auto", height: "100%" }; + return { + root: [ + classNames2.root, + theme.fonts.medium, + { + overflow: "hidden" + }, + maximizeFrame && [ + classNames2.rootMaximizeFrame, + { + height: "100%", + width: "100%" + } + ], + isLoaded && shouldFadeIn && !shouldStartVisible && AnimationClassNames.fadeIn400, + (isCenter || isContain || isCover || isCenterContain || isCenterCover) && { + position: "relative" + }, + className2 + ], + image: [ + classNames2.image, + { + display: "block", + opacity: 0 + }, + isLoaded && [ + "is-loaded", + { + opacity: 1 + } + ], + isCenter && [classNames2.imageCenter, ImageFitStyles], + isContain && [ + classNames2.imageContain, + supportsObjectFit && { + width: "100%", + height: "100%", + objectFit: "contain" + }, + !supportsObjectFit && fallbackObjectFitStyles, + !supportsObjectFit && ImageFitStyles + ], + isCover && [ + classNames2.imageCover, + supportsObjectFit && { + width: "100%", + height: "100%", + objectFit: "cover" + }, + !supportsObjectFit && fallbackObjectFitStyles, + !supportsObjectFit && ImageFitStyles + ], + isCenterContain && [ + classNames2.imageCenterContain, + isLandscape && { + maxWidth: "100%" + }, + !isLandscape && { + maxHeight: "100%" + }, + ImageFitStyles + ], + isCenterCover && [ + classNames2.imageCenterCover, + isLandscape && { + maxHeight: "100%" + }, + !isLandscape && { + maxWidth: "100%" + }, + ImageFitStyles + ], + isNone && [ + classNames2.imageNone, + { + width: "auto", + height: "auto" + } + ], + isNotImageFit && [ + !!width2 && !height2 && { + height: "auto", + width: "100%" + }, + !width2 && !!height2 && { + height: "100%", + width: "auto" + }, + !!width2 && !!height2 && { + height: "100%", + width: "100%" + } + ], + isLandscape && classNames2.imageLandscape, + !isLandscape && classNames2.imagePortrait, + !isLoaded && "is-notLoaded", + shouldFadeIn && "is-fadeIn", + isError && "is-error" + ] }; - /** - * !!!IMPORTANT!!! Avoid mutating `item: IContextualMenuItem` argument. It will - * cause the menu items to always re-render because the component update is based on shallow comparison. - */ var renderMenuItem = function(item, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons, // eslint-disable-next-line deprecation/deprecation - menuClassNames) { - var _a; - var renderedItems = []; - var iconProps = item.iconProps || { - iconName: 'None' - }; - var getItemClassNames = item.getItemClassNames, itemProps = item.itemProps; - var styles = itemProps ? itemProps.styles : undefined; - // We only send a dividerClassName when the item to be rendered is a divider. - // For all other cases, the default divider style is used. - var dividerClassName = item.itemType === (0, _contextualMenuTypes.ContextualMenuItemType).Divider ? item.className : undefined; - var subMenuIconClassName = item.submenuIconProps ? item.submenuIconProps.className : ''; - // eslint-disable-next-line deprecation/deprecation - var itemClassNames; - // IContextualMenuItem#getItemClassNames for backwards compatibility - // otherwise uses mergeStyles for class names. - if (getItemClassNames) itemClassNames = getItemClassNames(props.theme, (0, _index.isItemDisabled)(item), expandedMenuItemKey === item.key, !!(0, _index.getIsChecked)(item), !!item.href, iconProps.iconName !== 'None', item.className, dividerClassName, iconProps.className, subMenuIconClassName, item.primaryDisabled); - else { - var itemStyleProps = { - theme: props.theme, - disabled: (0, _index.isItemDisabled)(item), - expanded: expandedMenuItemKey === item.key, - checked: !!(0, _index.getIsChecked)(item), - isAnchorLink: !!item.href, - knownIcon: iconProps.iconName !== 'None', - itemClassName: item.className, - dividerClassName: dividerClassName, - iconClassName: iconProps.className, - subMenuClassName: subMenuIconClassName, - primaryDisabled: item.primaryDisabled - }; - // We need to generate default styles then override if styles are provided - // since the ContextualMenu currently handles item classNames. - itemClassNames = getContextualMenuItemClassNames(_getMenuItemStylesFunction((_a = menuClassNames.subComponentStyles) === null || _a === void 0 ? void 0 : _a.menuItem, styles), itemStyleProps); - } - // eslint-disable-next-line deprecation/deprecation - if (item.text === '-' || item.name === '-') item.itemType = (0, _contextualMenuTypes.ContextualMenuItemType).Divider; - switch(item.itemType){ - case (0, _contextualMenuTypes.ContextualMenuItemType).Divider: - renderedItems.push(renderSeparator(index, itemClassNames)); - break; - case (0, _contextualMenuTypes.ContextualMenuItemType).Header: - renderedItems.push(renderSeparator(index, itemClassNames)); - var headerItem = renderHeaderMenuItem(item, itemClassNames, menuClassNames, index, hasCheckmarks, hasIcons); - renderedItems.push(renderListItem(headerItem, item.key || index, itemClassNames, item.title)); - break; - case (0, _contextualMenuTypes.ContextualMenuItemType).Section: - renderedItems.push(renderSectionItem(item, itemClassNames, menuClassNames, index, hasCheckmarks, hasIcons)); - break; - default: - var defaultRenderNormalItem = function() { - return renderNormalItem(item, itemClassNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons); - }; - var menuItem = props.onRenderContextualMenuItem ? props.onRenderContextualMenuItem(item, defaultRenderNormalItem) : defaultRenderNormalItem(); - renderedItems.push(renderListItem(menuItem, item.key || index, itemClassNames, item.title)); - break; - } - // Since multiple nodes *could* be rendered, wrap them all in a fragment with this item's key. - // This ensures the reconciler handles multi-item output per-node correctly and does not re-mount content. - return _react.createElement(_react.Fragment, { - key: item.key - }, renderedItems); - }; - var defaultMenuItemRenderer = function(item, // eslint-disable-next-line deprecation/deprecation - menuClassNames) { - var index = item.index, focusableElementIndex = item.focusableElementIndex, totalItemCount = item.totalItemCount, hasCheckmarks = item.hasCheckmarks, hasIcons = item.hasIcons; - return renderMenuItem(item, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons, menuClassNames); - }; - var renderSectionItem = function(sectionItem, // eslint-disable-next-line deprecation/deprecation - itemClassNames, // eslint-disable-next-line deprecation/deprecation - menuClassNames, index, hasCheckmarks, hasIcons) { - var sectionProps = sectionItem.sectionProps; - if (!sectionProps) return; - var headerItem; - var groupProps; - if (sectionProps.title) { - var headerContextualMenuItem = undefined; - var ariaLabelledby = ''; - if (typeof sectionProps.title === 'string') { - // Since title is a user-facing string, it needs to be stripped - // of whitespace in order to build a valid element ID - var id_1 = menuId + sectionProps.title.replace(/\s/g, ''); - headerContextualMenuItem = { - key: "section-".concat(sectionProps.title, "-title"), - itemType: (0, _contextualMenuTypes.ContextualMenuItemType).Header, - text: sectionProps.title, - id: id_1 - }; - ariaLabelledby = id_1; - } else { - var id_2 = sectionProps.title.id || menuId + sectionProps.title.key.replace(/\s/g, ''); - headerContextualMenuItem = (0, _tslib.__assign)((0, _tslib.__assign)({}, sectionProps.title), { - id: id_2 - }); - ariaLabelledby = id_2; - } - if (headerContextualMenuItem) { - groupProps = { - role: 'group', - 'aria-labelledby': ariaLabelledby - }; - headerItem = renderHeaderMenuItem(headerContextualMenuItem, itemClassNames, menuClassNames, index, hasCheckmarks, hasIcons); - } - } - if (sectionProps.items && sectionProps.items.length > 0) { - var correctedIndex_1 = 0; - return _react.createElement("li", { - role: "presentation", - key: sectionProps.key || sectionItem.key || "section-".concat(index) - }, _react.createElement("div", (0, _tslib.__assign)({}, groupProps), _react.createElement("ul", { - className: menuClassNames.list, - role: "presentation" - }, sectionProps.topDivider && renderSeparator(index, itemClassNames, true, true), headerItem && renderListItem(headerItem, sectionItem.key || index, itemClassNames, sectionItem.title), sectionProps.items.map(function(contextualMenuItem, itemsIndex) { - var menuItem = renderMenuItem(contextualMenuItem, itemsIndex, correctedIndex_1, getItemCount(sectionProps.items), hasCheckmarks, hasIcons, menuClassNames); - if (contextualMenuItem.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Divider && contextualMenuItem.itemType !== (0, _contextualMenuTypes.ContextualMenuItemType).Header) { - var indexIncrease = contextualMenuItem.customOnRenderListLength ? contextualMenuItem.customOnRenderListLength : 1; - correctedIndex_1 += indexIncrease; - } - return menuItem; - }), sectionProps.bottomDivider && renderSeparator(index, itemClassNames, false, true)))); - } - }; - var renderListItem = function(content, key, classNames, title) { - return _react.createElement("li", { - role: "presentation", - title: title, - key: key, - className: classNames.item - }, content); - }; - var renderSeparator = function(index, classNames, top, fromSection) { - if (fromSection || index > 0) return _react.createElement("li", { - role: "separator", - key: 'separator-' + index + (top === undefined ? '' : top ? '-top' : '-bottom'), - className: classNames.divider, - "aria-hidden": "true" - }); - return null; + }; + var Image$1 = styled(ImageBase, getStyles$w, void 0, { + scope: "Image" + }, true); + Image$1.displayName = "Image"; + var classNames = mergeStyleSets({ + root: { + display: "inline-block", + textDecoration: "inherit" + }, + placeholder: [ + "ms-Icon-placeHolder", + { + width: "1em" + } + ], + image: [ + "ms-Icon-imageContainer", + { + overflow: "hidden" + } + ] + }); + var MS_ICON = "ms-Icon"; + var getStyles$v = function(props) { + var className2 = props.className, iconClassName = props.iconClassName, isPlaceholder = props.isPlaceholder, isImage = props.isImage, styles = props.styles; + return { + root: [ + isPlaceholder && classNames.placeholder, + classNames.root, + isImage && classNames.image, + iconClassName, + className2, + styles && styles.root, + // eslint-disable-next-line @typescript-eslint/no-deprecated + styles && styles.imageContainer + ] }; - var renderNormalItem = function(item, classNames, index, focusableElementIndex, totalItemCount, hasCheckmarks, hasIcons) { - if (item.onRender) return item.onRender((0, _tslib.__assign)({ - 'aria-posinset': focusableElementIndex + 1, - 'aria-setsize': totalItemCount - }, item), dismiss); - var contextualMenuItemAs = props.contextualMenuItemAs; - var commonProps = { - item: item, - classNames: classNames, - index: index, - focusableElementIndex: focusableElementIndex, - totalItemCount: totalItemCount, - hasCheckmarks: hasCheckmarks, - hasIcons: hasIcons, - contextualMenuItemAs: contextualMenuItemAs, - onItemMouseEnter: onItemMouseEnterBase, - onItemMouseLeave: onMouseItemLeave, - onItemMouseMove: onItemMouseMoveBase, - onItemMouseDown: onItemMouseDown, - executeItemClick: executeItemClick, - onItemKeyDown: onItemKeyDown, - expandedMenuItemKey: expandedMenuItemKey, - openSubMenu: openSubMenu, - dismissSubMenu: onSubMenuDismiss, - dismissMenu: dismiss - }; - if (item.href) { - var ContextualMenuAnchorAs = (0, _index1.ContextualMenuAnchor); - if (item.contextualMenuItemWrapperAs) ContextualMenuAnchorAs = (0, _utilities.composeComponentAs)(item.contextualMenuItemWrapperAs, ContextualMenuAnchorAs); - return _react.createElement(ContextualMenuAnchorAs, (0, _tslib.__assign)({}, commonProps, { - onItemClick: onAnchorClick - })); - } - if (item.split && (0, _index.hasSubmenu)(item)) { - var ContextualMenuSplitButtonAs = (0, _index1.ContextualMenuSplitButton); - if (item.contextualMenuItemWrapperAs) ContextualMenuSplitButtonAs = (0, _utilities.composeComponentAs)(item.contextualMenuItemWrapperAs, ContextualMenuSplitButtonAs); - return _react.createElement(ContextualMenuSplitButtonAs, (0, _tslib.__assign)({}, commonProps, { - onItemClick: onItemClick, - onItemClickBase: onItemClickBase, - onTap: cancelSubMenuTimer - })); - } - var ContextualMenuButtonAs = (0, _index1.ContextualMenuButton); - if (item.contextualMenuItemWrapperAs) ContextualMenuButtonAs = (0, _utilities.composeComponentAs)(item.contextualMenuItemWrapperAs, ContextualMenuButtonAs); - return _react.createElement(ContextualMenuButtonAs, (0, _tslib.__assign)({}, commonProps, { - onItemClick: onItemClick, - onItemClickBase: onItemClickBase - })); + }; + var getIconContent = memoizeFunction( + function(iconName) { + var _a2 = getIcon(iconName) || { + subset: {}, + code: void 0 + }, code = _a2.code, subset = _a2.subset; + if (!code) { + return null; + } + return { + children: code, + iconClassName: subset.className, + fontFamily: subset.fontFace && subset.fontFace.fontFamily, + mergeImageProps: subset.mergeImageProps + }; + }, + void 0, + true + /*ignoreNullOrUndefinedResult */ + ); + var FontIcon = function(props) { + var iconName = props.iconName, className2 = props.className, _a2 = props.style, style2 = _a2 === void 0 ? {} : _a2; + var iconContent = getIconContent(iconName) || {}; + var iconClassName = iconContent.iconClassName, children2 = iconContent.children, fontFamily2 = iconContent.fontFamily, mergeImageProps = iconContent.mergeImageProps; + var nativeProps = getNativeProps(props, htmlElementProperties); + var accessibleName = props["aria-label"] || props.title; + var containerProps = props["aria-label"] || props["aria-labelledby"] || props.title ? { + role: mergeImageProps ? void 0 : "img" + } : { + "aria-hidden": true }; - var renderHeaderMenuItem = function(item, // eslint-disable-next-line deprecation/deprecation - itemClassNames, // eslint-disable-next-line deprecation/deprecation - menuClassNames, index, hasCheckmarks, hasIcons) { - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(item.contextualMenuItemAs, ChildrenRenderer); - if (props.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(props.contextualMenuItemAs, ChildrenRenderer); - var itemProps = item.itemProps, id = item.id; - var divHtmlProperties = itemProps && (0, _utilities.getNativeProps)(itemProps, (0, _utilities.divProperties)); - return(// eslint-disable-next-line deprecation/deprecation - _react.createElement("div", (0, _tslib.__assign)({ - id: id, - className: menuClassNames.header - }, divHtmlProperties, { - style: item.style - }), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - item: item, - classNames: itemClassNames, - index: index, - onCheckmarkClick: hasCheckmarks ? onItemClick : undefined, - hasIcons: hasIcons - }, itemProps)))); - }; - //#endregion - //#region Main render - var isBeakVisible = props.isBeakVisible; - var items = props.items, labelElementId = props.labelElementId, id = props.id, className = props.className, beakWidth = props.beakWidth, directionalHint = props.directionalHint, directionalHintForRTL = props.directionalHintForRTL, alignTargetEdge = props.alignTargetEdge, gapSpace = props.gapSpace, coverTarget = props.coverTarget, ariaLabel = props.ariaLabel, doNotLayer = props.doNotLayer, target = props.target, bounds = props.bounds, useTargetWidth = props.useTargetWidth, useTargetAsMinWidth = props.useTargetAsMinWidth, directionalHintFixed = props.directionalHintFixed, shouldFocusOnMount = props.shouldFocusOnMount, shouldFocusOnContainer = props.shouldFocusOnContainer, title = props.title, styles = props.styles, theme = props.theme, calloutProps = props.calloutProps, _k = props.onRenderSubMenu, onRenderSubMenu = _k === void 0 ? onDefaultRenderSubMenu : _k, _l = props.onRenderMenuList, onRenderMenuList = _l === void 0 ? function(menuListProps, defaultRender) { - return onDefaultRenderMenuList(menuListProps, classNames, defaultRender); - } : _l, focusZoneProps = props.focusZoneProps, // eslint-disable-next-line deprecation/deprecation - getMenuClassNames = props.getMenuClassNames; - var classNames = getMenuClassNames ? getMenuClassNames(theme, className) : getClassNames(styles, { - theme: theme, - className: className - }); - var hasIcons = itemsHaveIcons(items); - function itemsHaveIcons(contextualMenuItems) { - for(var _i = 0, contextualMenuItems_1 = contextualMenuItems; _i < contextualMenuItems_1.length; _i++){ - var item = contextualMenuItems_1[_i]; - if (item.iconProps) return true; - if (item.itemType === (0, _contextualMenuTypes.ContextualMenuItemType).Section && item.sectionProps && itemsHaveIcons(item.sectionProps.items)) return true; - } - return false; + var finalChildren = children2; + if (mergeImageProps) { + if (typeof children2 === "object" && typeof children2.props === "object" && accessibleName) { + finalChildren = React__namespace.cloneElement(children2, { alt: accessibleName }); + } } - var adjustedFocusZoneProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - direction: (0, _focusZone.FocusZoneDirection).vertical, - handleTabKey: (0, _focusZone.FocusZoneTabbableElements).all, - isCircularNavigation: true, - 'data-tabster': '{"uncontrolled": {}, "focusable": { "excludeFromMover": true }}' - }, focusZoneProps), { - className: (0, _utilities.css)(classNames.root, (_a = props.focusZoneProps) === null || _a === void 0 ? void 0 : _a.className) - }); - var hasCheckmarks = canAnyMenuItemsCheck(items); - var submenuProps = expandedMenuItemKey && props.hidden !== true ? getSubmenuProps() : null; - isBeakVisible = isBeakVisible === undefined ? responsiveMode <= (0, _responsiveMode.ResponsiveMode).medium : isBeakVisible; - /** - * When useTargetWidth is true, get the width of the target element and apply it for the context menu container - */ var contextMenuStyle; - var targetAsHtmlElement = targetRef.current; - if ((useTargetWidth || useTargetAsMinWidth) && targetAsHtmlElement && targetAsHtmlElement.offsetWidth) { - var targetBoundingRect = targetAsHtmlElement.getBoundingClientRect(); - var targetWidth = targetBoundingRect.width - 2; /* Accounts for 1px border */ - if (useTargetWidth) contextMenuStyle = { - width: targetWidth + return React__namespace.createElement("i", __assign$1({ "data-icon-name": iconName }, containerProps, nativeProps, mergeImageProps ? { + title: void 0, + "aria-label": void 0 + } : {}, { + className: css(MS_ICON, classNames.root, iconClassName, !iconName && classNames.placeholder, className2), + // Apply the font family this way to ensure it doesn't get overridden by Fabric Core ms-Icon styles + // https://github.com/microsoft/fluentui/issues/10449 + style: __assign$1({ fontFamily: fontFamily2 }, style2) + }), finalChildren); + }; + memoizeFunction(function(iconName, className2, ariaLabel2) { + return FontIcon({ iconName, className: className2, "aria-label": ariaLabel2 }); + }); + var getClassNames$q = classNamesFunction({ + // Icon is used a lot by other components. + // It's likely to see expected cases which pass different className to the Icon. + // Therefore setting a larger cache size. + cacheSize: 100 + }); + var IconBase = ( + /** @class */ + (function(_super) { + __extends(IconBase2, _super); + function IconBase2(props) { + var _this = _super.call(this, props) || this; + _this._onImageLoadingStateChange = function(state) { + if (_this.props.imageProps && _this.props.imageProps.onLoadingStateChange) { + _this.props.imageProps.onLoadingStateChange(state); + } + if (state === ImageLoadState.error) { + _this.setState({ imageLoadError: true }); + } }; - else if (useTargetAsMinWidth) contextMenuStyle = { - minWidth: targetWidth + _this.state = { + imageLoadError: false }; - } - // The menu should only return if items were provided, if no items were provided then it should not appear. - if (items && items.length > 0) { - var totalItemCount_1 = getItemCount(items); - var calloutStyles_1 = classNames.subComponentStyles ? classNames.subComponentStyles.callout : undefined; - return _react.createElement((0, _index2.MenuContext).Consumer, null, function(menuContext) { - return _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - styles: calloutStyles_1, - onRestoreFocus: tryFocusPreviousActiveElement - }, calloutProps, { - target: target || menuContext.target, - isBeakVisible: isBeakVisible, - beakWidth: beakWidth, - directionalHint: directionalHint, - directionalHintForRTL: directionalHintForRTL, - gapSpace: gapSpace, - coverTarget: coverTarget, - doNotLayer: doNotLayer, - className: (0, _utilities.css)('ms-ContextualMenu-Callout', calloutProps && calloutProps.className), - setInitialFocus: shouldFocusOnMount, - onDismiss: props.onDismiss || menuContext.onDismiss, - onScroll: onScroll, - bounds: bounds, - directionalHintFixed: directionalHintFixed, - alignTargetEdge: alignTargetEdge, - hidden: props.hidden || menuContext.hidden, - ref: forwardedRef - }), _react.createElement("div", { - style: contextMenuStyle, - ref: hostElement, - id: id, - className: classNames.container, - tabIndex: shouldFocusOnContainer ? 0 : -1, - onKeyDown: onMenuKeyDown, - onKeyUp: onKeyUp, - onFocusCapture: onMenuFocusCapture, - "aria-label": ariaLabel, - "aria-labelledby": labelElementId, - role: 'menu' - }, title && _react.createElement("div", { - className: classNames.title - }, " ", title, " "), items && items.length ? renderFocusZone(onRenderMenuList({ - ariaLabel: ariaLabel, - items: items, - totalItemCount: totalItemCount_1, - hasCheckmarks: hasCheckmarks, - hasIcons: hasIcons, - defaultMenuItemRenderer: function(item) { - return defaultMenuItemRenderer(item, classNames); - }, - labelElementId: labelElementId - }, function(menuListProps, defaultRender) { - return onDefaultRenderMenuList(menuListProps, classNames, defaultRender); - }), adjustedFocusZoneProps) : null, submenuProps && onRenderSubMenu(submenuProps, onDefaultRenderSubMenu)), _react.createElement((0, _utilities.FocusRects), null)); + return _this; + } + IconBase2.prototype.render = function() { + var _a2 = this.props, children2 = _a2.children, className2 = _a2.className, styles = _a2.styles, iconName = _a2.iconName, imageErrorAs = _a2.imageErrorAs, theme = _a2.theme; + var isPlaceholder = typeof iconName === "string" && iconName.length === 0; + var isImage = ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + !!this.props.imageProps || this.props.iconType === IconType.image || this.props.iconType === IconType.Image + ); + var iconContent = getIconContent(iconName) || {}; + var iconClassName = iconContent.iconClassName, iconContentChildren = iconContent.children, mergeImageProps = iconContent.mergeImageProps; + var classNames2 = getClassNames$q(styles, { + theme, + className: className2, + iconClassName, + isImage, + isPlaceholder }); - } else return null; -//#endregion -}), function(prevProps, newProps) { - if (!newProps.shouldUpdateWhenHidden && prevProps.hidden && newProps.hidden) // Do not update when hidden. - return true; - return (0, _utilities.shallowCompare)(prevProps, newProps); -}); -ContextualMenuBase.displayName = 'ContextualMenuBase'; -/** - * Returns true if the key for the event is alt (Mac option) or meta (Mac command). - */ function isAltOrMeta(ev) { - // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).alt || ev.key === 'Meta'; -} -function onItemMouseDown(item, ev) { - var _a; - (_a = item.onMouseDown) === null || _a === void 0 || _a.call(item, item, ev); -} -function onDefaultRenderSubMenu(subMenuProps, defaultRender) { - throw Error("ContextualMenuBase: onRenderSubMenu callback is null or undefined. Please ensure to set `onRenderSubMenu` property either manually or with `styled` helper."); -} -/** - * Returns the item that matches a given key if any. - * @param key - The key of the item to match - * @param items - The items to look for the key - */ function findItemByKeyFromItems(key, items) { - for(var _i = 0, items_3 = items; _i < items_3.length; _i++){ - var item = items_3[_i]; - if (item.itemType === (0, _contextualMenuTypes.ContextualMenuItemType).Section && item.sectionProps) { - var match = findItemByKeyFromItems(key, item.sectionProps.items); - if (match) return match; - } else if (item.key && item.key === key) return item; - } -} -function getOnClickWithOverrideTarget(onClick, target) { - return onClick ? function(ev, item) { - overrideTarget(ev, target); - return onClick(ev, item); - } : onClick; -} -function overrideTarget(ev, target) { - if (ev && target) { - ev.persist(); - if (target instanceof Event) ev.target = target.target; - else if (target instanceof Element) ev.target = target; - } -} - -},{"tslib":"9gizs","react":"jGrId","./ContextualMenu.types":"akDeV","../../common/DirectionalHint":"avdAc","../../FocusZone":"k9nPH","../../Utilities":"1NZCy","../../utilities/contextualMenu/index":"lGesq","../../Callout":"g2jXk","./ContextualMenuItem":"cJR9f","./ContextualMenuItemWrapper/index":"lIK0C","../../Styling":"hTimn","./ContextualMenu.classNames":"bg3cO","@fluentui/react-hooks":"2LHjM","../../ResponsiveMode":"cFpqz","../../utilities/MenuContext/index":"l3bQw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"akDeV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DirectionalHint", ()=>(0, _directionalHint.DirectionalHint)); -parcelHelpers.export(exports, "ContextualMenuItemType", ()=>ContextualMenuItemType); -var _directionalHint = require("../../common/DirectionalHint"); -var ContextualMenuItemType; -(function(ContextualMenuItemType) { - ContextualMenuItemType[ContextualMenuItemType["Normal"] = 0] = "Normal"; - ContextualMenuItemType[ContextualMenuItemType["Divider"] = 1] = "Divider"; - ContextualMenuItemType[ContextualMenuItemType["Header"] = 2] = "Header"; - ContextualMenuItemType[ContextualMenuItemType["Section"] = 3] = "Section"; -})(ContextualMenuItemType || (ContextualMenuItemType = {})); - -},{"../../common/DirectionalHint":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k9nPH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusZone", ()=>(0, _reactFocus.FocusZone)); -parcelHelpers.export(exports, "FocusZoneDirection", ()=>(0, _reactFocus.FocusZoneDirection)); -parcelHelpers.export(exports, "FocusZoneTabbableElements", ()=>(0, _reactFocus.FocusZoneTabbableElements)); -var _reactFocus = require("@fluentui/react-focus"); - -},{"@fluentui/react-focus":"5Zqef","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Zqef":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _version = require("./version"); -var _index = require("./components/FocusZone/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./version":"8AjcD","./components/FocusZone/index":"6Mjnc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8AjcD":[function(require,module,exports,__globalThis) { -// Do not modify this file; it is generated as part of publish. -// The checked in version is a placeholder only and will not be updated. -var _setVersion = require("@fluentui/set-version"); -(0, _setVersion.setVersion)('@fluentui/react-focus', '8.9.19'); - -},{"@fluentui/set-version":"iqYXf"}],"6Mjnc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _focusZone = require("./FocusZone"); -parcelHelpers.exportAll(_focusZone, exports); -var _focusZoneTypes = require("./FocusZone.types"); -parcelHelpers.exportAll(_focusZoneTypes, exports); - -},{"./FocusZone":"38RzR","./FocusZone.types":"hsbYN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"38RzR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusZone", ()=>FocusZone); -var _tslib = require("tslib"); -var _react = require("react"); -var _focusZoneTypes = require("./FocusZone.types"); -var _utilities = require("@fluentui/utilities"); -var _mergeStyles = require("@fluentui/merge-styles"); -var _styleUtilities = require("@fluentui/style-utilities"); -var IS_FOCUSABLE_ATTRIBUTE = 'data-is-focusable'; -var IS_ENTER_DISABLED_ATTRIBUTE = 'data-disable-click-on-enter'; -var FOCUSZONE_ID_ATTRIBUTE = 'data-focuszone-id'; -var TABINDEX = 'tabindex'; -var NO_VERTICAL_WRAP = 'data-no-vertical-wrap'; -var NO_HORIZONTAL_WRAP = 'data-no-horizontal-wrap'; -var LARGE_DISTANCE_FROM_CENTER = 999999999; -var LARGE_NEGATIVE_DISTANCE_FROM_CENTER = -999999999; -var focusZoneStyles; -var focusZoneClass = 'ms-FocusZone'; -/** - * Raises a click on a target element based on a keyboard event. - */ function raiseClickFromKeyboardEvent(target, ev) { - var event; - if (typeof MouseEvent === 'function') event = new MouseEvent('click', { + var RootType = isImage ? "span" : "i"; + var nativeProps = getNativeProps(this.props, htmlElementProperties, [ + "aria-label" + ]); + var imageLoadError = this.state.imageLoadError; + var imageProps = __assign$1(__assign$1({}, this.props.imageProps), { onLoadingStateChange: this._onImageLoadingStateChange }); + var ImageType = imageLoadError && imageErrorAs || Image$1; + var ariaLabel2 = this.props["aria-label"] || this.props.ariaLabel; + var accessibleName = imageProps.alt || ariaLabel2 || this.props.title; + var hasName = !!(accessibleName || this.props["aria-labelledby"] || imageProps["aria-label"] || imageProps["aria-labelledby"]); + var containerProps = hasName ? { + role: isImage || mergeImageProps ? void 0 : "img", + "aria-label": isImage || mergeImageProps ? void 0 : accessibleName + } : { + "aria-hidden": true + }; + var finalIconContentChildren = iconContentChildren; + if (mergeImageProps && iconContentChildren && typeof iconContentChildren === "object" && accessibleName) { + finalIconContentChildren = React__namespace.cloneElement(iconContentChildren, { + alt: accessibleName + }); + } + return React__namespace.createElement(RootType, __assign$1({ "data-icon-name": iconName }, containerProps, nativeProps, mergeImageProps ? { + title: void 0, + "aria-label": void 0 + } : {}, { className: classNames2.root }), isImage ? React__namespace.createElement(ImageType, __assign$1({}, imageProps)) : children2 || finalIconContentChildren); + }; + return IconBase2; + })(React__namespace.Component) + ); + var Icon = styled(IconBase, getStyles$v, void 0, { + scope: "Icon" + }, true); + Icon.displayName = "Icon"; + var ImageIcon = function(props) { + var className2 = props.className, imageProps = props.imageProps; + var nativeProps = getNativeProps(props, htmlElementProperties, [ + "aria-label", + "aria-labelledby", + "title", + "aria-describedby" + ]); + var altText = imageProps.alt || props["aria-label"]; + var hasName = altText || props["aria-labelledby"] || props.title || imageProps["aria-label"] || imageProps["aria-labelledby"] || imageProps.title; + var imageNameProps = { + "aria-labelledby": props["aria-labelledby"], + "aria-describedby": props["aria-describedby"], + title: props.title + }; + var containerProps = hasName ? {} : { + "aria-hidden": true + }; + return React__namespace.createElement( + "div", + __assign$1({}, containerProps, nativeProps, { className: css(MS_ICON, classNames.root, classNames.image, className2) }), + React__namespace.createElement(Image$1, __assign$1({}, imageNameProps, imageProps, { alt: hasName ? altText : "" })) + ); + }; + var DirectionalHint = { + /** + * Appear above the target element, with the left edges of the callout and target aligning. + */ + topLeftEdge: 0, + /** + * Appear above the target element, with the centers of the callout and target aligning. + */ + topCenter: 1, + /** + * Appear above the target element, with the right edges of the callout and target aligning. + */ + topRightEdge: 2, + /** + * Appear above the target element, aligning with the target element such that the callout tends toward + * the center of the screen. + */ + topAutoEdge: 3, + /** + * Appear below the target element, with the left edges of the callout and target aligning. + */ + bottomLeftEdge: 4, + /** + * Appear below the target element, with the centers of the callout and target aligning. + */ + bottomCenter: 5, + /** + * Appear below the target element, with the right edges of the callout and target aligning. + */ + bottomRightEdge: 6, + /** + * Appear below the target element, aligning with the target element such that the callout tends toward + * the center of the screen. + */ + bottomAutoEdge: 7, + /** + * Appear to the left of the target element, with the top edges of the callout and target aligning. + */ + leftTopEdge: 8, + /** + * Appear to the left of the target element, with the centers of the callout and target aligning. + */ + leftCenter: 9, + /** + * Appear to the left of the target element, with the bottom edges of the callout and target aligning. + */ + leftBottomEdge: 10, + /** + * Appear to the right of the target element, with the top edges of the callout and target aligning. + */ + rightTopEdge: 11, + /** + * Appear to the right of the target element, with the centers of the callout and target aligning. + */ + rightCenter: 12, + /** + * Appear to the right of the target element, with the bottom edges of the callout and target aligning. + */ + rightBottomEdge: 13 + }; + var ContextualMenuItemType; + (function(ContextualMenuItemType2) { + ContextualMenuItemType2[ContextualMenuItemType2["Normal"] = 0] = "Normal"; + ContextualMenuItemType2[ContextualMenuItemType2["Divider"] = 1] = "Divider"; + ContextualMenuItemType2[ContextualMenuItemType2["Header"] = 2] = "Header"; + ContextualMenuItemType2[ContextualMenuItemType2["Section"] = 3] = "Section"; + })(ContextualMenuItemType || (ContextualMenuItemType = {})); + var FocusZoneTabbableElements = { + /** All tabbing action is allowed */ + all: 1, + /** Tabbing is allowed only on input elements */ + inputOnly: 2 + }; + var FocusZoneDirection; + (function(FocusZoneDirection2) { + FocusZoneDirection2[FocusZoneDirection2["vertical"] = 0] = "vertical"; + FocusZoneDirection2[FocusZoneDirection2["horizontal"] = 1] = "horizontal"; + FocusZoneDirection2[FocusZoneDirection2["bidirectional"] = 2] = "bidirectional"; + FocusZoneDirection2[FocusZoneDirection2["domOrder"] = 3] = "domOrder"; + })(FocusZoneDirection || (FocusZoneDirection = {})); + var IS_FOCUSABLE_ATTRIBUTE = "data-is-focusable"; + var IS_ENTER_DISABLED_ATTRIBUTE = "data-disable-click-on-enter"; + var FOCUSZONE_ID_ATTRIBUTE = "data-focuszone-id"; + var TABINDEX = "tabindex"; + var NO_VERTICAL_WRAP = "data-no-vertical-wrap"; + var NO_HORIZONTAL_WRAP = "data-no-horizontal-wrap"; + var LARGE_DISTANCE_FROM_CENTER = 999999999; + var LARGE_NEGATIVE_DISTANCE_FROM_CENTER = -999999999; + var focusZoneStyles; + var focusZoneClass = "ms-FocusZone"; + function raiseClickFromKeyboardEvent(target2, ev) { + var event2; + if (typeof MouseEvent === "function") { + event2 = new MouseEvent("click", { ctrlKey: ev === null || ev === void 0 ? void 0 : ev.ctrlKey, metaKey: ev === null || ev === void 0 ? void 0 : ev.metaKey, shiftKey: ev === null || ev === void 0 ? void 0 : ev.shiftKey, altKey: ev === null || ev === void 0 ? void 0 : ev.altKey, bubbles: ev === null || ev === void 0 ? void 0 : ev.bubbles, cancelable: ev === null || ev === void 0 ? void 0 : ev.cancelable - }); - else { + }); + } else { + event2 = document.createEvent("MouseEvents"); + event2.initMouseEvent( + "click", + ev ? ev.bubbles : false, + ev ? ev.cancelable : false, // eslint-disable-next-line no-restricted-globals - event = document.createEvent('MouseEvents'); - // eslint-disable-next-line deprecation/deprecation - event.initMouseEvent('click', ev ? ev.bubbles : false, ev ? ev.cancelable : false, // eslint-disable-next-line no-restricted-globals - window, 0, 0, 0, 0, 0, ev ? ev.ctrlKey : false, ev ? ev.altKey : false, ev ? ev.shiftKey : false, ev ? ev.metaKey : false, 0, null); - } - target.dispatchEvent(event); -} -// Helper function that will return a class for when the root is focused -function getRootClass() { - if (!focusZoneStyles) focusZoneStyles = (0, _mergeStyles.mergeStyles)({ + window, + // not using getWindow() since this can only be run client side + 0, + // detail + 0, + // screen x + 0, + // screen y + 0, + // client x + 0, + // client y + ev ? ev.ctrlKey : false, + ev ? ev.altKey : false, + ev ? ev.shiftKey : false, + ev ? ev.metaKey : false, + 0, + // button + null + ); + } + target2.dispatchEvent(event2); + } + function getRootClass() { + if (!focusZoneStyles) { + focusZoneStyles = mergeStyles({ selectors: { - ':focus': { - outline: 'none' - } + ":focus": { + outline: "none" + } } - }, focusZoneClass); + }, focusZoneClass); + } return focusZoneStyles; -} -var _allInstances = {}; -var _outerZones = new Set(); -var ALLOWED_INPUT_TYPES = [ - 'text', - 'number', - 'password', - 'email', - 'tel', - 'url', - 'search', - 'textarea' -]; -var ALLOW_VIRTUAL_ELEMENTS = false; -var FocusZone = /** @class */ function(_super) { - (0, _tslib.__extends)(FocusZone, _super); - function FocusZone(props) { - var _a, _b, _c, _d; + } + var _allInstances = {}; + var _outerZones = /* @__PURE__ */ new Set(); + var ALLOWED_INPUT_TYPES = ["text", "number", "password", "email", "tel", "url", "search", "textarea"]; + var ALLOW_VIRTUAL_ELEMENTS = false; + var FocusZone = ( + /** @class */ + (function(_super) { + __extends(FocusZone2, _super); + function FocusZone2(props) { + var _a2, _b2, _c2, _d2; var _this = _super.call(this, props) || this; - _this._root = _react.createRef(); - _this._mergedRef = (0, _utilities.createMergedRef)(); + _this._root = React__namespace.createRef(); + _this._mergedRef = createMergedRef(); _this._onFocus = function(ev) { - if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. + if (_this._portalContainsElement(ev.target)) { return; - var _a = _this.props, onActiveElementChanged = _a.onActiveElementChanged, // eslint-disable-next-line deprecation/deprecation - doNotAllowFocusEventToPropagate = _a.doNotAllowFocusEventToPropagate, stopFocusPropagation = _a.stopFocusPropagation, // eslint-disable-next-line deprecation/deprecation - onFocusNotification = _a.onFocusNotification, onFocus = _a.onFocus, shouldFocusInnerElementWhenReceivedFocus = _a.shouldFocusInnerElementWhenReceivedFocus, defaultTabbableElement = _a.defaultTabbableElement; - var isImmediateDescendant = _this._isImmediateDescendantOfZone(ev.target); - var newActiveElement; - if (isImmediateDescendant) newActiveElement = ev.target; - else { - var parentElement = ev.target; - while(parentElement && parentElement !== _this._root.current){ - if ((0, _utilities.isElementTabbable)(parentElement, undefined, _this._inShadowRoot) && _this._isImmediateDescendantOfZone(parentElement)) { - newActiveElement = parentElement; - break; - } - parentElement = (0, _utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS); - } - } - // If an inner focusable element should be focused when FocusZone container receives focus - if (shouldFocusInnerElementWhenReceivedFocus && ev.target === _this._root.current) { - var maybeElementToFocus = defaultTabbableElement && typeof defaultTabbableElement === 'function' && _this._root.current && defaultTabbableElement(_this._root.current); - // try to focus defaultTabbable element - if (maybeElementToFocus && (0, _utilities.isElementTabbable)(maybeElementToFocus, undefined, _this._inShadowRoot)) { - newActiveElement = maybeElementToFocus; - maybeElementToFocus.focus(); - } else { - // force focus on first focusable element - _this.focus(true); - if (_this._activeElement) // set to null as new active element was handled in method above - newActiveElement = null; - } - } - var initialElementFocused = !_this._activeElement; - // If the new active element is a child of this zone and received focus, - // update alignment an immediate descendant - if (newActiveElement && newActiveElement !== _this._activeElement) { - if (isImmediateDescendant || initialElementFocused) _this._setFocusAlignment(newActiveElement, true, true); - _this._activeElement = newActiveElement; - if (initialElementFocused) _this._updateTabIndexes(); - } - if (onActiveElementChanged) onActiveElementChanged(_this._activeElement, ev); - if (stopFocusPropagation || doNotAllowFocusEventToPropagate) ev.stopPropagation(); - if (onFocus) onFocus(ev); - else if (onFocusNotification) onFocusNotification(); + } + var _a22 = _this.props, onActiveElementChanged = _a22.onActiveElementChanged, doNotAllowFocusEventToPropagate = _a22.doNotAllowFocusEventToPropagate, stopFocusPropagation = _a22.stopFocusPropagation, onFocusNotification = _a22.onFocusNotification, onFocus = _a22.onFocus, shouldFocusInnerElementWhenReceivedFocus = _a22.shouldFocusInnerElementWhenReceivedFocus, defaultTabbableElement = _a22.defaultTabbableElement; + var isImmediateDescendant = _this._isImmediateDescendantOfZone(ev.target); + var newActiveElement; + if (isImmediateDescendant) { + newActiveElement = ev.target; + } else { + var parentElement = ev.target; + while (parentElement && parentElement !== _this._root.current) { + if (isElementTabbable(parentElement, void 0, _this._inShadowRoot) && _this._isImmediateDescendantOfZone(parentElement)) { + newActiveElement = parentElement; + break; + } + parentElement = getParent(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + } + if (shouldFocusInnerElementWhenReceivedFocus && ev.target === _this._root.current) { + var maybeElementToFocus = defaultTabbableElement && typeof defaultTabbableElement === "function" && _this._root.current && defaultTabbableElement(_this._root.current); + if (maybeElementToFocus && isElementTabbable(maybeElementToFocus, void 0, _this._inShadowRoot)) { + newActiveElement = maybeElementToFocus; + maybeElementToFocus.focus(); + } else { + _this.focus(true); + if (_this._activeElement) { + newActiveElement = null; + } + } + } + var initialElementFocused = !_this._activeElement; + if (newActiveElement && newActiveElement !== _this._activeElement) { + if (isImmediateDescendant || initialElementFocused) { + _this._setFocusAlignment(newActiveElement, true, true); + } + _this._activeElement = newActiveElement; + if (initialElementFocused) { + _this._updateTabIndexes(); + } + } + if (onActiveElementChanged) { + onActiveElementChanged(_this._activeElement, ev); + } + if (stopFocusPropagation || doNotAllowFocusEventToPropagate) { + ev.stopPropagation(); + } + if (onFocus) { + onFocus(ev); + } else if (onFocusNotification) { + onFocusNotification(); + } }; _this._onBlur = function() { - _this._setParkedFocus(false); + _this._setParkedFocus(false); }; _this._onMouseDown = function(ev) { - if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. + if (_this._portalContainsElement(ev.target)) { return; - var disabled = _this.props.disabled; - if (disabled) return; - var target = ev.target; - var path = []; - while(target && target !== _this._root.current){ - path.push(target); - target = (0, _utilities.getParent)(target, ALLOW_VIRTUAL_ELEMENTS); - } - while(path.length){ - target = path.pop(); - if (target && (0, _utilities.isElementTabbable)(target, undefined, _this._inShadowRoot)) _this._setActiveElement(target, true); - if ((0, _utilities.isElementFocusZone)(target)) break; - } - }; - /** - * Handle the keystrokes. - */ _this._onKeyDown = function(ev, theme) { - if (_this._portalContainsElement(ev.target)) // If the event target is inside a portal do not process the event. + } + var disabled = _this.props.disabled; + if (disabled) { return; - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, direction = _a.direction, disabled = _a.disabled, isInnerZoneKeystroke = _a.isInnerZoneKeystroke, pagingSupportDisabled = _a.pagingSupportDisabled, shouldEnterInnerZone = _a.shouldEnterInnerZone; - if (disabled) return; - if (_this.props.onKeyDown) _this.props.onKeyDown(ev); - // If the default has been prevented, do not process keyboard events. - if (ev.isDefaultPrevented()) return; - if (_this._getDocument().activeElement === _this._root.current && _this._isInnerZone) // If this element has focus, it is being controlled by a parent. - // Ignore the keystroke. + } + var target2 = ev.target; + var path2 = []; + while (target2 && target2 !== _this._root.current) { + path2.push(target2); + target2 = getParent(target2, ALLOW_VIRTUAL_ELEMENTS); + } + while (path2.length) { + target2 = path2.pop(); + if (target2 && isElementTabbable(target2, void 0, _this._inShadowRoot)) { + _this._setActiveElement(target2, true); + } + if (isElementFocusZone(target2)) { + break; + } + } + }; + _this._onKeyDown = function(ev, theme) { + if (_this._portalContainsElement(ev.target)) { return; - if ((shouldEnterInnerZone && shouldEnterInnerZone(ev) || isInnerZoneKeystroke && isInnerZoneKeystroke(ev)) && _this._isImmediateDescendantOfZone(ev.target)) { - // Try to focus - var innerZone = _this._getFirstInnerZone(); - if (innerZone) { - if (!innerZone.focus(true)) return; - } else if ((0, _utilities.isElementFocusSubZone)(ev.target)) { - if (!_this.focusElement((0, _utilities.getNextElement)(ev.target, ev.target.firstChild, true))) return; - } else return; - } else if (ev.altKey) return; - else // eslint-disable-next-line @fluentui/deprecated-keyboard-event-props, deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).space: - if (_this._shouldRaiseClicksOnSpace && _this._tryInvokeClickForFocusable(ev.target, ev)) break; - return; - case (0, _utilities.KeyCodes).left: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusLeft(theme)) break; - } - return; - case (0, _utilities.KeyCodes).right: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusRight(theme)) break; - } - return; - case (0, _utilities.KeyCodes).up: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).horizontal) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusUp()) break; - } - return; - case (0, _utilities.KeyCodes).down: - if (direction !== (0, _focusZoneTypes.FocusZoneDirection).horizontal) { - _this._preventDefaultWhenHandled(ev); - if (_this._moveFocusDown()) break; - } - return; - case (0, _utilities.KeyCodes).pageDown: - if (!pagingSupportDisabled && _this._moveFocusPaging(true)) break; - return; - case (0, _utilities.KeyCodes).pageUp: - if (!pagingSupportDisabled && _this._moveFocusPaging(false)) break; - return; - case (0, _utilities.KeyCodes).tab: - if (// eslint-disable-next-line deprecation/deprecation - _this.props.allowTabKey || _this.props.handleTabKey === (0, _focusZoneTypes.FocusZoneTabbableElements).all || _this.props.handleTabKey === (0, _focusZoneTypes.FocusZoneTabbableElements).inputOnly && _this._isElementInput(ev.target)) { - var focusChanged = false; - _this._processingTabKey = true; - if (direction === (0, _focusZoneTypes.FocusZoneDirection).vertical || !_this._shouldWrapFocus(_this._activeElement, NO_HORIZONTAL_WRAP)) focusChanged = ev.shiftKey ? _this._moveFocusUp() : _this._moveFocusDown(); - else { - var tabWithDirection = (0, _utilities.getRTL)(theme) ? !ev.shiftKey : ev.shiftKey; - focusChanged = tabWithDirection ? _this._moveFocusLeft(theme) : _this._moveFocusRight(theme); - } - _this._processingTabKey = false; - if (focusChanged) break; - else if (_this.props.shouldResetActiveElementWhenTabFromZone) _this._activeElement = null; - } - return; - case (0, _utilities.KeyCodes).home: - if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, false)) return false; - var firstChild = _this._root.current && _this._root.current.firstChild; - if (_this._root.current && firstChild && _this.focusElement((0, _utilities.getNextElement)(_this._root.current, firstChild, true))) break; - return; - case (0, _utilities.KeyCodes).end: - if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, true)) return false; - var lastChild = _this._root.current && _this._root.current.lastChild; - if (_this._root.current && _this.focusElement((0, _utilities.getPreviousElement)(_this._root.current, lastChild, true, true, true))) break; - return; - case (0, _utilities.KeyCodes).enter: - if (_this._shouldRaiseClicksOnEnter && _this._tryInvokeClickForFocusable(ev.target, ev)) break; - return; - default: - return; + } + var _a22 = _this.props, direction = _a22.direction, disabled = _a22.disabled, isInnerZoneKeystroke = _a22.isInnerZoneKeystroke, pagingSupportDisabled = _a22.pagingSupportDisabled, shouldEnterInnerZone = _a22.shouldEnterInnerZone; + if (disabled) { + return; + } + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + } + if (ev.isDefaultPrevented()) { + return; + } + if (_this._getDocument().activeElement === _this._root.current && _this._isInnerZone) { + return; + } + if ((shouldEnterInnerZone && shouldEnterInnerZone(ev) || isInnerZoneKeystroke && isInnerZoneKeystroke(ev)) && _this._isImmediateDescendantOfZone(ev.target)) { + var innerZone = _this._getFirstInnerZone(); + if (innerZone) { + if (!innerZone.focus(true)) { + return; + } + } else if (isElementFocusSubZone(ev.target)) { + if (!_this.focusElement(getNextElement(ev.target, ev.target.firstChild, true))) { + return; + } + } else { + return; } - ev.preventDefault(); - ev.stopPropagation(); - }; - _this._getHorizontalDistanceFromCenter = function(isForward, // eslint-disable-next-line deprecation/deprecation - activeRect, // eslint-disable-next-line deprecation/deprecation - targetRect) { - // eslint-disable-next-line deprecation/deprecation - var leftAlignment = _this._focusAlignment.left || _this._focusAlignment.x || 0; - // ClientRect values can be floats that differ by very small fractions of a decimal. - // If the difference between top and bottom are within a pixel then we should treat - // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent, - // but without Math.Floor they will be handled incorrectly. - var targetRectTop = Math.floor(targetRect.top); - var activeRectBottom = Math.floor(activeRect.bottom); - var targetRectBottom = Math.floor(targetRect.bottom); - var activeRectTop = Math.floor(activeRect.top); - var isValidCandidateOnpagingDown = isForward && targetRectTop > activeRectBottom; - var isValidCandidateOnpagingUp = !isForward && targetRectBottom < activeRectTop; - if (isValidCandidateOnpagingDown || isValidCandidateOnpagingUp) { - if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) return 0; - return Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } else if (ev.altKey) { + return; + } else { + switch (ev.which) { + case KeyCodes.space: + if (_this._shouldRaiseClicksOnSpace && _this._tryInvokeClickForFocusable(ev.target, ev)) { + break; + } + return; + case KeyCodes.left: + if (direction !== FocusZoneDirection.vertical) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusLeft(theme)) { + break; + } + } + return; + case KeyCodes.right: + if (direction !== FocusZoneDirection.vertical) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusRight(theme)) { + break; + } + } + return; + case KeyCodes.up: + if (direction !== FocusZoneDirection.horizontal) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusUp()) { + break; + } + } + return; + case KeyCodes.down: + if (direction !== FocusZoneDirection.horizontal) { + _this._preventDefaultWhenHandled(ev); + if (_this._moveFocusDown()) { + break; + } + } + return; + case KeyCodes.pageDown: + if (!pagingSupportDisabled && _this._moveFocusPaging(true)) { + break; + } + return; + case KeyCodes.pageUp: + if (!pagingSupportDisabled && _this._moveFocusPaging(false)) { + break; + } + return; + case KeyCodes.tab: + if ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + _this.props.allowTabKey || _this.props.handleTabKey === FocusZoneTabbableElements.all || _this.props.handleTabKey === FocusZoneTabbableElements.inputOnly && _this._isElementInput(ev.target) + ) { + var focusChanged = false; + _this._processingTabKey = true; + if (direction === FocusZoneDirection.vertical || !_this._shouldWrapFocus(_this._activeElement, NO_HORIZONTAL_WRAP)) { + focusChanged = ev.shiftKey ? _this._moveFocusUp() : _this._moveFocusDown(); + } else { + var tabWithDirection = getRTL(theme) ? !ev.shiftKey : ev.shiftKey; + focusChanged = tabWithDirection ? _this._moveFocusLeft(theme) : _this._moveFocusRight(theme); + } + _this._processingTabKey = false; + if (focusChanged) { + break; + } else if (_this.props.shouldResetActiveElementWhenTabFromZone) { + _this._activeElement = null; + } + } + return; + case KeyCodes.home: + if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, false)) { + return false; + } + var firstChild = _this._root.current && _this._root.current.firstChild; + if (_this._root.current && firstChild && _this.focusElement(getNextElement(_this._root.current, firstChild, true))) { + break; + } + return; + case KeyCodes.end: + if (_this._isContentEditableElement(ev.target) || _this._isElementInput(ev.target) && !_this._shouldInputLoseFocus(ev.target, true)) { + return false; + } + var lastChild = _this._root.current && _this._root.current.lastChild; + if (_this._root.current && _this.focusElement(getPreviousElement(_this._root.current, lastChild, true, true, true))) { + break; + } + return; + case KeyCodes.enter: + if (_this._shouldRaiseClicksOnEnter && _this._tryInvokeClickForFocusable(ev.target, ev)) { + break; + } + return; + default: + return; } - if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return LARGE_DISTANCE_FROM_CENTER; - }; - // Manage componentRef resolution. - (0, _utilities.initializeComponentRef)(_this); - _this._id = (0, _utilities.getId)('FocusZone'); + } + ev.preventDefault(); + ev.stopPropagation(); + }; + _this._getHorizontalDistanceFromCenter = function(isForward, activeRect, targetRect) { + var leftAlignment = _this._focusAlignment.left || _this._focusAlignment.x || 0; + var targetRectTop = Math.floor(targetRect.top); + var activeRectBottom = Math.floor(activeRect.bottom); + var targetRectBottom = Math.floor(targetRect.bottom); + var activeRectTop = Math.floor(activeRect.top); + var isValidCandidateOnpagingDown = isForward && targetRectTop > activeRectBottom; + var isValidCandidateOnpagingUp = !isForward && targetRectBottom < activeRectTop; + if (isValidCandidateOnpagingDown || isValidCandidateOnpagingUp) { + if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) { + return 0; + } + return Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } + if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) { + return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return LARGE_DISTANCE_FROM_CENTER; + }; + initializeComponentRef(_this); + _this._id = getId("FocusZone"); _this._focusAlignment = { - left: 0, - top: 0 + left: 0, + top: 0 }; _this._processingTabKey = false; - var shouldRaiseClicksFallback = (_b = (_a = props.shouldRaiseClicks) !== null && _a !== void 0 ? _a : FocusZone.defaultProps.shouldRaiseClicks) !== null && _b !== void 0 ? _b : true; - _this._shouldRaiseClicksOnEnter = (_c = props.shouldRaiseClicksOnEnter) !== null && _c !== void 0 ? _c : shouldRaiseClicksFallback; - _this._shouldRaiseClicksOnSpace = (_d = props.shouldRaiseClicksOnSpace) !== null && _d !== void 0 ? _d : shouldRaiseClicksFallback; + var shouldRaiseClicksFallback = (_b2 = (_a2 = props.shouldRaiseClicks) !== null && _a2 !== void 0 ? _a2 : FocusZone2.defaultProps.shouldRaiseClicks) !== null && _b2 !== void 0 ? _b2 : true; + _this._shouldRaiseClicksOnEnter = (_c2 = props.shouldRaiseClicksOnEnter) !== null && _c2 !== void 0 ? _c2 : shouldRaiseClicksFallback; + _this._shouldRaiseClicksOnSpace = (_d2 = props.shouldRaiseClicksOnSpace) !== null && _d2 !== void 0 ? _d2 : shouldRaiseClicksFallback; return _this; - } - /** Used for testing purposes only. */ FocusZone.getOuterZones = function() { + } + FocusZone2.getOuterZones = function() { return _outerZones.size; - }; - /** - * Handle global tab presses so that we can patch tabindexes on the fly. - * HEADS UP: This must not be an arrow function in order to be referentially equal among instances - * for ref counting to work correctly! - */ FocusZone._onKeyDownCapture = function(ev) { - // eslint-disable-next-line deprecation/deprecation, @fluentui/deprecated-keyboard-event-props - if (ev.which === (0, _utilities.KeyCodes).tab) _outerZones.forEach(function(zone) { + }; + FocusZone2._onKeyDownCapture = function(ev) { + if (ev.which === KeyCodes.tab) { + _outerZones.forEach(function(zone) { return zone._updateTabIndexes(); - }); - }; - FocusZone.prototype.componentDidMount = function() { - var _a; + }); + } + }; + FocusZone2.prototype.componentDidMount = function() { + var _a2; var root = this._root.current; - this._inShadowRoot = !!((_a = this.context) === null || _a === void 0 ? void 0 : _a.shadowRoot); + this._inShadowRoot = !!((_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.shadowRoot); _allInstances[this._id] = this; if (root) { - var parentElement = (0, _utilities.getParent)(root, ALLOW_VIRTUAL_ELEMENTS); - while(parentElement && parentElement !== this._getDocument().body && parentElement.nodeType === 1){ - if ((0, _utilities.isElementFocusZone)(parentElement)) { - this._isInnerZone = true; - break; - } - parentElement = (0, _utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS); - } - if (!this._isInnerZone) { - _outerZones.add(this); - this._root.current && this._root.current.addEventListener('keydown', FocusZone._onKeyDownCapture, true); - } - this._root.current && this._root.current.addEventListener('blur', this._onBlur, true); - // Assign initial tab indexes so that we can set initial focus as appropriate. - this._updateTabIndexes(); - if (this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === 'string') this._activeElement = this._getDocument().querySelector(this.props.defaultTabbableElement); - else if (this.props.defaultActiveElement) // eslint-disable-next-line deprecation/deprecation + var parentElement = getParent(root, ALLOW_VIRTUAL_ELEMENTS); + while (parentElement && parentElement !== this._getDocument().body && parentElement.nodeType === 1) { + if (isElementFocusZone(parentElement)) { + this._isInnerZone = true; + break; + } + parentElement = getParent(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + if (!this._isInnerZone) { + _outerZones.add(this); + this._root.current && this._root.current.addEventListener("keydown", FocusZone2._onKeyDownCapture, true); + } + this._root.current && this._root.current.addEventListener("blur", this._onBlur, true); + this._updateTabIndexes(); + if (this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === "string") { + this._activeElement = this._getDocument().querySelector(this.props.defaultTabbableElement); + } else if (this.props.defaultActiveElement) { this._activeElement = this._getDocument().querySelector(this.props.defaultActiveElement); - if (this.props.shouldFocusOnMount) this.focus(); + } + if (this.props.shouldFocusOnMount) { + this.focus(); + } } - }; - FocusZone.prototype.componentDidUpdate = function() { - var _a; + }; + FocusZone2.prototype.componentDidUpdate = function() { + var _a2; var root = this._root.current; var doc = this._getDocument(); - this._inShadowRoot = !!((_a = this.context) === null || _a === void 0 ? void 0 : _a.shadowRoot); - // If either _activeElement or _defaultFocusElement are no longer contained by _root, - // reset those variables (and update tab indexes) to avoid memory leaks - if (this._activeElement && !(0, _utilities.elementContains)(this._root.current, this._activeElement, ALLOW_VIRTUAL_ELEMENTS) || this._defaultFocusElement && !(0, _utilities.elementContains)(this._root.current, this._defaultFocusElement, ALLOW_VIRTUAL_ELEMENTS)) { - this._activeElement = null; - this._defaultFocusElement = null; - this._updateTabIndexes(); + this._inShadowRoot = !!((_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.shadowRoot); + if (this._activeElement && !elementContains(this._root.current, this._activeElement, ALLOW_VIRTUAL_ELEMENTS) || this._defaultFocusElement && !elementContains(this._root.current, this._defaultFocusElement, ALLOW_VIRTUAL_ELEMENTS)) { + this._activeElement = null; + this._defaultFocusElement = null; + this._updateTabIndexes(); } if (!this.props.preventFocusRestoration && doc && this._lastIndexPath && (doc.activeElement === doc.body || doc.activeElement === null || doc.activeElement === root)) { - // The element has been removed after the render, attempt to restore focus. - var elementToFocus = (0, _utilities.getFocusableByIndexPath)(root, this._lastIndexPath); - if (elementToFocus) { - this._setActiveElement(elementToFocus, true); - elementToFocus.focus(); - this._setParkedFocus(false); - } else // We had a focus path to restore, but now that path is unresolvable. Park focus - // on the container until we can try again. + var elementToFocus = getFocusableByIndexPath(root, this._lastIndexPath); + if (elementToFocus) { + this._setActiveElement(elementToFocus, true); + elementToFocus.focus(); + this._setParkedFocus(false); + } else { this._setParkedFocus(true); + } } - }; - FocusZone.prototype.componentWillUnmount = function() { + }; + FocusZone2.prototype.componentWillUnmount = function() { delete _allInstances[this._id]; if (!this._isInnerZone) { - _outerZones.delete(this); - this._root.current && this._root.current.removeEventListener('keydown', FocusZone._onKeyDownCapture, true); + _outerZones.delete(this); + this._root.current && this._root.current.removeEventListener("keydown", FocusZone2._onKeyDownCapture, true); + } + if (this._root.current) { + this._root.current.removeEventListener("blur", this._onBlur, true); } - if (this._root.current) this._root.current.removeEventListener('blur', this._onBlur, true); this._activeElement = null; this._defaultFocusElement = null; - }; - FocusZone.prototype.render = function() { + }; + FocusZone2.prototype.render = function() { var _this = this; - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, tag = _a.as, elementType = _a.elementType, rootProps = _a.rootProps, ariaDescribedBy = _a.ariaDescribedBy, ariaLabelledBy = _a.ariaLabelledBy, className = _a.className; - var divProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.htmlElementProperties)); - var Tag = tag || elementType || 'div'; - // Note, right before rendering/reconciling proceeds, we need to record if focus - // was in the zone before the update. This helper will track this and, if focus - // was actually in the zone, what the index path to the element is at this time. - // Then, later in componentDidUpdate, we can evaluate if we need to restore it in - // the case the element was removed. + var _a2 = this.props, tag = _a2.as, elementType = _a2.elementType, rootProps = _a2.rootProps, ariaDescribedBy = _a2.ariaDescribedBy, ariaLabelledBy = _a2.ariaLabelledBy, className2 = _a2.className; + var divProps = getNativeProps(this.props, htmlElementProperties); + var Tag = tag || elementType || "div"; this._evaluateFocusBeforeRender(); - // Only support RTL defined in global theme, not contextual theme/RTL. - var theme = (0, _styleUtilities.getTheme)(); - return _react.createElement(Tag, (0, _tslib.__assign)({ - "aria-labelledby": ariaLabelledBy, - "aria-describedby": ariaDescribedBy - }, divProps, rootProps, { - // Once the getClassName correctly memoizes inputs this should - // be replaced so that className is passed to getRootClass and is included there so - // the class names will always be in the same order. - className: (0, _utilities.css)(getRootClass(), className), - // eslint-disable-next-line deprecation/deprecation - ref: this._mergedRef(this.props.elementRef, this._root), - "data-focuszone-id": this._id, - // eslint-disable-next-line react/jsx-no-bind - onKeyDown: function(ev) { - return _this._onKeyDown(ev, theme); - }, - onFocus: this._onFocus, - onMouseDownCapture: this._onMouseDown + var theme = getTheme(); + return React__namespace.createElement(Tag, __assign$1({ "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy }, divProps, rootProps, { + // Once the getClassName correctly memoizes inputs this should + // be replaced so that className is passed to getRootClass and is included there so + // the class names will always be in the same order. + className: css(getRootClass(), className2), + // eslint-disable-next-line @typescript-eslint/no-deprecated + ref: this._mergedRef(this.props.elementRef, this._root), + "data-focuszone-id": this._id, + // eslint-disable-next-line react/jsx-no-bind + onKeyDown: function(ev) { + return _this._onKeyDown(ev, theme); + }, + onFocus: this._onFocus, + onMouseDownCapture: this._onMouseDown }), this.props.children); - }; - /** - * Sets focus to the first tabbable item in the zone. - * @param forceIntoFirstElement - If true, focus will be forced into the first element, even - * if focus is already in the focus zone. - * @param bypassHiddenElements - If true, focus will be not be set on hidden elements. - * @returns True if focus could be set to an active element, false if no operation was taken. - */ FocusZone.prototype.focus = function(forceIntoFirstElement, bypassHiddenElements) { - if (forceIntoFirstElement === void 0) forceIntoFirstElement = false; - if (bypassHiddenElements === void 0) bypassHiddenElements = false; + }; + FocusZone2.prototype.focus = function(forceIntoFirstElement, bypassHiddenElements) { + if (forceIntoFirstElement === void 0) { + forceIntoFirstElement = false; + } + if (bypassHiddenElements === void 0) { + bypassHiddenElements = false; + } if (this._root.current) { - if (!forceIntoFirstElement && this._root.current.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true' && this._isInnerZone) { - var ownerZoneElement = this._getOwnerZone(this._root.current); - if (ownerZoneElement !== this._root.current) { - var ownerZone = _allInstances[ownerZoneElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; - return !!ownerZone && ownerZone.focusElement(this._root.current); - } - return false; - } else if (!forceIntoFirstElement && this._activeElement && (0, _utilities.elementContains)(this._root.current, this._activeElement) && (0, _utilities.isElementTabbable)(this._activeElement, undefined, this._inShadowRoot) && (!bypassHiddenElements || (0, _utilities.isElementVisibleAndNotHidden)(this._activeElement))) { - this._activeElement.focus(); - return true; - } else { - var firstChild = this._root.current.firstChild; - return this.focusElement((0, _utilities.getNextElement)(this._root.current, firstChild, true, undefined, undefined, undefined, undefined, undefined, bypassHiddenElements)); + if (!forceIntoFirstElement && this._root.current.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "true" && this._isInnerZone) { + var ownerZoneElement = this._getOwnerZone(this._root.current); + if (ownerZoneElement !== this._root.current) { + var ownerZone = _allInstances[ownerZoneElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + return !!ownerZone && ownerZone.focusElement(this._root.current); } + return false; + } else if (!forceIntoFirstElement && this._activeElement && elementContains(this._root.current, this._activeElement) && isElementTabbable(this._activeElement, void 0, this._inShadowRoot) && (!bypassHiddenElements || isElementVisibleAndNotHidden(this._activeElement))) { + this._activeElement.focus(); + return true; + } else { + var firstChild = this._root.current.firstChild; + return this.focusElement(getNextElement(this._root.current, firstChild, true, void 0, void 0, void 0, void 0, void 0, bypassHiddenElements)); + } } return false; - }; - /** - * Sets focus to the last tabbable item in the zone. - * @returns True if focus could be set to an active element, false if no operation was taken. - */ FocusZone.prototype.focusLast = function() { + }; + FocusZone2.prototype.focusLast = function() { if (this._root.current) { - var lastChild = this._root.current && this._root.current.lastChild; - return this.focusElement((0, _utilities.getPreviousElement)(this._root.current, lastChild, true, true, true)); + var lastChild = this._root.current && this._root.current.lastChild; + return this.focusElement(getPreviousElement(this._root.current, lastChild, true, true, true)); } return false; - }; - /** - * Sets focus to a specific child element within the zone. This can be used in conjunction with - * shouldReceiveFocus to create delayed focus scenarios (like animate the scroll position to the correct - * location and then focus.) - * @param element - The child element within the zone to focus. - * @param forceAlignment - If true, focus alignment will be set according to the element provided. - * @returns True if focus could be set to an active element, false if no operation was taken. - */ FocusZone.prototype.focusElement = function(element, forceAlignment) { - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, onBeforeFocus = _a.onBeforeFocus, shouldReceiveFocus = _a.shouldReceiveFocus; - if (shouldReceiveFocus && !shouldReceiveFocus(element) || onBeforeFocus && !onBeforeFocus(element)) return false; - if (element) { - // when we set focus to a specific child, we should recalculate the alignment depending on its position. - this._setActiveElement(element, forceAlignment); - if (this._activeElement) this._activeElement.focus(); - return true; + }; + FocusZone2.prototype.focusElement = function(element2, forceAlignment) { + var _a2 = this.props, onBeforeFocus = _a2.onBeforeFocus, shouldReceiveFocus = _a2.shouldReceiveFocus; + if (shouldReceiveFocus && !shouldReceiveFocus(element2) || onBeforeFocus && !onBeforeFocus(element2)) { + return false; + } + if (element2) { + this._setActiveElement(element2, forceAlignment); + if (this._activeElement) { + this._activeElement.focus(); + } + return true; } return false; - }; - /** - * Forces horizontal alignment in the context of vertical arrowing to use specific point as the reference, - * rather than a center based on the last horizontal motion. - * @param point - the new reference point. - */ FocusZone.prototype.setFocusAlignment = function(point) { - this._focusAlignment = point; - }; - Object.defineProperty(FocusZone.prototype, "defaultFocusElement", { + }; + FocusZone2.prototype.setFocusAlignment = function(point2) { + this._focusAlignment = point2; + }; + Object.defineProperty(FocusZone2.prototype, "defaultFocusElement", { get: function() { - return this._defaultFocusElement; + return this._defaultFocusElement; }, enumerable: false, configurable: true - }); - Object.defineProperty(FocusZone.prototype, "activeElement", { + }); + Object.defineProperty(FocusZone2.prototype, "activeElement", { get: function() { - return this._activeElement; + return this._activeElement; }, enumerable: false, configurable: true - }); - FocusZone.prototype._evaluateFocusBeforeRender = function() { + }); + FocusZone2.prototype._evaluateFocusBeforeRender = function() { var root = this._root.current; var doc = this._getDocument(); if (doc) { - var focusedElement = doc.activeElement; - // Only update the index path if we are not parked on the root. - if (focusedElement !== root) { - var shouldRestoreFocus = (0, _utilities.elementContains)(root, focusedElement, false); - this._lastIndexPath = shouldRestoreFocus ? (0, _utilities.getElementIndexPath)(root, focusedElement) : undefined; - } - } - }; - /** - * When focus is in the zone at render time but then all focusable elements are removed, - * we "park" focus temporarily on the root. Once we update with focusable children, we restore - * focus to the closest path from previous. If the user tabs away from the parked container, - * we restore focusability to the pre-parked state. - */ FocusZone.prototype._setParkedFocus = function(isParked) { + var focusedElement = doc.activeElement; + if (focusedElement !== root) { + var shouldRestoreFocus = elementContains(root, focusedElement, false); + this._lastIndexPath = shouldRestoreFocus ? getElementIndexPath(root, focusedElement) : void 0; + } + } + }; + FocusZone2.prototype._setParkedFocus = function(isParked) { var root = this._root.current; if (root && this._isParked !== isParked) { - this._isParked = isParked; - if (isParked) { - if (!this.props.allowFocusRoot) { - this._parkedTabIndex = root.getAttribute('tabindex'); - root.setAttribute('tabindex', '-1'); - } - root.focus(); - } else if (!this.props.allowFocusRoot) { - if (this._parkedTabIndex) { - root.setAttribute('tabindex', this._parkedTabIndex); - this._parkedTabIndex = undefined; - } else root.removeAttribute('tabindex'); + this._isParked = isParked; + if (isParked) { + if (!this.props.allowFocusRoot) { + this._parkedTabIndex = root.getAttribute("tabindex"); + root.setAttribute("tabindex", "-1"); + } + root.focus(); + } else if (!this.props.allowFocusRoot) { + if (this._parkedTabIndex) { + root.setAttribute("tabindex", this._parkedTabIndex); + this._parkedTabIndex = void 0; + } else { + root.removeAttribute("tabindex"); } + } } - }; - FocusZone.prototype._setActiveElement = function(element, forceAlignment) { + }; + FocusZone2.prototype._setActiveElement = function(element2, forceAlignment) { var previousActiveElement = this._activeElement; - this._activeElement = element; + this._activeElement = element2; if (previousActiveElement) { - if ((0, _utilities.isElementFocusZone)(previousActiveElement)) this._updateTabIndexes(previousActiveElement); - previousActiveElement.tabIndex = -1; + if (isElementFocusZone(previousActiveElement)) { + this._updateTabIndexes(previousActiveElement); + } + previousActiveElement.tabIndex = -1; } if (this._activeElement) { - if (!this._focusAlignment || forceAlignment) this._setFocusAlignment(element, true, true); - this._activeElement.tabIndex = 0; + if (!this._focusAlignment || forceAlignment) { + this._setFocusAlignment(element2, true, true); + } + this._activeElement.tabIndex = 0; } - }; - FocusZone.prototype._preventDefaultWhenHandled = function(ev) { + }; + FocusZone2.prototype._preventDefaultWhenHandled = function(ev) { this.props.preventDefaultWhenHandled && ev.preventDefault(); - }; - /** - * Walk up the dom try to find a focusable element. - */ FocusZone.prototype._tryInvokeClickForFocusable = function(targetElement, ev) { - var target = targetElement; - if (target === this._root.current) return false; + }; + FocusZone2.prototype._tryInvokeClickForFocusable = function(targetElement, ev) { + var target2 = targetElement; + if (target2 === this._root.current) { + return false; + } do { - if (target.tagName === 'BUTTON' || target.tagName === 'A' || target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.tagName === 'SUMMARY') return false; - if (this._isImmediateDescendantOfZone(target) && target.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true' && target.getAttribute(IS_ENTER_DISABLED_ATTRIBUTE) !== 'true') { - raiseClickFromKeyboardEvent(target, ev); - return true; - } - target = (0, _utilities.getParent)(target, ALLOW_VIRTUAL_ELEMENTS); - }while (target !== this._root.current); + if (target2.tagName === "BUTTON" || target2.tagName === "A" || target2.tagName === "INPUT" || target2.tagName === "TEXTAREA" || target2.tagName === "SUMMARY") { + return false; + } + if (this._isImmediateDescendantOfZone(target2) && target2.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "true" && target2.getAttribute(IS_ENTER_DISABLED_ATTRIBUTE) !== "true") { + raiseClickFromKeyboardEvent(target2, ev); + return true; + } + target2 = getParent(target2, ALLOW_VIRTUAL_ELEMENTS); + } while (target2 !== this._root.current); return false; - }; - /** - * Traverse to find first child zone. - */ FocusZone.prototype._getFirstInnerZone = function(rootElement) { + }; + FocusZone2.prototype._getFirstInnerZone = function(rootElement) { rootElement = rootElement || this._activeElement || this._root.current; - if (!rootElement) return null; - if ((0, _utilities.isElementFocusZone)(rootElement)) return _allInstances[rootElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + if (!rootElement) { + return null; + } + if (isElementFocusZone(rootElement)) { + return _allInstances[rootElement.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + } var child = rootElement.firstElementChild; - while(child){ - if ((0, _utilities.isElementFocusZone)(child)) return _allInstances[child.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; - var match = this._getFirstInnerZone(child); - if (match) return match; - child = child.nextElementSibling; + while (child) { + if (isElementFocusZone(child)) { + return _allInstances[child.getAttribute(FOCUSZONE_ID_ATTRIBUTE)]; + } + var match2 = this._getFirstInnerZone(child); + if (match2) { + return match2; + } + child = child.nextElementSibling; } return null; - }; - FocusZone.prototype._moveFocus = function(isForward, // eslint-disable-next-line deprecation/deprecation - getDistanceFromCenter, ev, useDefaultWrap) { - if (useDefaultWrap === void 0) useDefaultWrap = true; - var element = this._activeElement; + }; + FocusZone2.prototype._moveFocus = function(isForward, getDistanceFromCenter, ev, useDefaultWrap) { + if (useDefaultWrap === void 0) { + useDefaultWrap = true; + } + var element2 = this._activeElement; var candidateDistance = -1; - var candidateElement = undefined; + var candidateElement = void 0; var changedFocus = false; - var isBidirectional = this.props.direction === (0, _focusZoneTypes.FocusZoneDirection).bidirectional; - if (!element || !this._root.current) return false; - if (this._isElementInput(element)) { - if (!this._shouldInputLoseFocus(element, isForward)) return false; + var isBidirectional = this.props.direction === FocusZoneDirection.bidirectional; + if (!element2 || !this._root.current) { + return false; + } + if (this._isElementInput(element2)) { + if (!this._shouldInputLoseFocus(element2, isForward)) { + return false; + } } - var activeRect = isBidirectional ? element.getBoundingClientRect() : null; + var activeRect = isBidirectional ? element2.getBoundingClientRect() : null; do { - element = isForward ? (0, _utilities.getNextElement)(this._root.current, element) : (0, _utilities.getPreviousElement)(this._root.current, element); - if (isBidirectional) { - if (element) { - var targetRect = element.getBoundingClientRect(); - // eslint-disable-next-line deprecation/deprecation - var elementDistance = getDistanceFromCenter(activeRect, targetRect); - if (elementDistance === -1 && candidateDistance === -1) { - candidateElement = element; - break; - } - if (elementDistance > -1 && (candidateDistance === -1 || elementDistance < candidateDistance)) { - candidateDistance = elementDistance; - candidateElement = element; - } - if (candidateDistance >= 0 && elementDistance < 0) break; - } - } else { - candidateElement = element; + element2 = isForward ? getNextElement(this._root.current, element2) : getPreviousElement(this._root.current, element2); + if (isBidirectional) { + if (element2) { + var targetRect = element2.getBoundingClientRect(); + var elementDistance = getDistanceFromCenter(activeRect, targetRect); + if (elementDistance === -1 && candidateDistance === -1) { + candidateElement = element2; break; + } + if (elementDistance > -1 && (candidateDistance === -1 || elementDistance < candidateDistance)) { + candidateDistance = elementDistance; + candidateElement = element2; + } + if (candidateDistance >= 0 && elementDistance < 0) { + break; + } } - }while (element); - // Focus the closest candidate + } else { + candidateElement = element2; + break; + } + } while (element2); if (candidateElement && candidateElement !== this._activeElement) { - changedFocus = true; - this.focusElement(candidateElement); + changedFocus = true; + this.focusElement(candidateElement); } else if (this.props.isCircularNavigation && useDefaultWrap) { - if (isForward) return this.focusElement((0, _utilities.getNextElement)(this._root.current, this._root.current.firstElementChild, true)); - else return this.focusElement((0, _utilities.getPreviousElement)(this._root.current, this._root.current.lastElementChild, true, true, true)); + if (isForward) { + return this.focusElement(getNextElement(this._root.current, this._root.current.firstElementChild, true)); + } else { + return this.focusElement(getPreviousElement(this._root.current, this._root.current.lastElementChild, true, true, true)); + } } return changedFocus; - }; - FocusZone.prototype._moveFocusDown = function() { + }; + FocusZone2.prototype._moveFocusDown = function() { var _this = this; var targetTop = -1; - // eslint-disable-next-line deprecation/deprecation var leftAlignment = this._focusAlignment.left || this._focusAlignment.x || 0; - if (// eslint-disable-next-line deprecation/deprecation - this._moveFocus(true, function(activeRect, targetRect) { - var distance = -1; - // ClientRect values can be floats that differ by very small fractions of a decimal. - // If the difference between top and bottom are within a pixel then we should treat - // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent, - // but without Math.Floor they will be handled incorrectly. + if ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + this._moveFocus(true, function(activeRect, targetRect) { + var distance2 = -1; var targetRectTop = Math.floor(targetRect.top); var activeRectBottom = Math.floor(activeRect.bottom); if (targetRectTop < activeRectBottom) { - if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return LARGE_DISTANCE_FROM_CENTER; + if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) { + return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return LARGE_DISTANCE_FROM_CENTER; } if (targetTop === -1 && targetRectTop >= activeRectBottom || targetRectTop === targetTop) { - targetTop = targetRectTop; - if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) distance = 0; - else distance = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); - } - return distance; - })) { - this._setFocusAlignment(this._activeElement, false, true); - return true; + targetTop = targetRectTop; + if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) { + distance2 = 0; + } else { + distance2 = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } + } + return distance2; + }) + ) { + this._setFocusAlignment(this._activeElement, false, true); + return true; } return false; - }; - FocusZone.prototype._moveFocusUp = function() { + }; + FocusZone2.prototype._moveFocusUp = function() { var _this = this; var targetTop = -1; - // eslint-disable-next-line deprecation/deprecation var leftAlignment = this._focusAlignment.left || this._focusAlignment.x || 0; - if (// eslint-disable-next-line deprecation/deprecation - this._moveFocus(false, function(activeRect, targetRect) { - var distance = -1; - // ClientRect values can be floats that differ by very small fractions of a decimal. - // If the difference between top and bottom are within a pixel then we should treat - // them as equivalent by using Math.floor. For instance 5.2222 and 5.222221 should be equivalent, - // but without Math.Floor they will be handled incorrectly. + if ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + this._moveFocus(false, function(activeRect, targetRect) { + var distance2 = -1; var targetRectBottom = Math.floor(targetRect.bottom); var targetRectTop = Math.floor(targetRect.top); var activeRectTop = Math.floor(activeRect.top); if (targetRectBottom > activeRectTop) { - if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return LARGE_DISTANCE_FROM_CENTER; + if (!_this._shouldWrapFocus(_this._activeElement, NO_VERTICAL_WRAP)) { + return LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return LARGE_DISTANCE_FROM_CENTER; } if (targetTop === -1 && targetRectBottom <= activeRectTop || targetRectTop === targetTop) { - targetTop = targetRectTop; - if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) distance = 0; - else distance = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); - } - return distance; - })) { - this._setFocusAlignment(this._activeElement, false, true); - return true; + targetTop = targetRectTop; + if (leftAlignment >= targetRect.left && leftAlignment <= targetRect.left + targetRect.width) { + distance2 = 0; + } else { + distance2 = Math.abs(targetRect.left + targetRect.width / 2 - leftAlignment); + } + } + return distance2; + }) + ) { + this._setFocusAlignment(this._activeElement, false, true); + return true; } return false; - }; - FocusZone.prototype._moveFocusLeft = function(theme) { + }; + FocusZone2.prototype._moveFocusLeft = function(theme) { var _this = this; var shouldWrap = this._shouldWrapFocus(this._activeElement, NO_HORIZONTAL_WRAP); - if (this._moveFocus((0, _utilities.getRTL)(theme), // eslint-disable-next-line deprecation/deprecation - function(activeRect, targetRect) { - var distance = -1; + if (this._moveFocus( + getRTL(theme), + // eslint-disable-next-line @typescript-eslint/no-deprecated + function(activeRect, targetRect) { + var distance2 = -1; var topBottomComparison; - if ((0, _utilities.getRTL)(theme)) // When in RTL, this comparison should be the same as the one in _moveFocusRight for LTR. - // Going left at a leftmost rectangle will go down a line instead of up a line like in LTR. - // This is important, because we want to be comparing the top of the target rect - // with the bottom of the active rect. - topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); - else topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); - if (topBottomComparison && targetRect.right <= activeRect.right && _this.props.direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) distance = activeRect.right - targetRect.right; - else if (!shouldWrap) distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return distance; - }, undefined /*ev*/ , shouldWrap)) { - this._setFocusAlignment(this._activeElement, true, false); - return true; + if (getRTL(theme)) { + topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); + } else { + topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); + } + if (topBottomComparison && targetRect.right <= activeRect.right && _this.props.direction !== FocusZoneDirection.vertical) { + distance2 = activeRect.right - targetRect.right; + } else if (!shouldWrap) { + distance2 = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return distance2; + }, + void 0, + shouldWrap + )) { + this._setFocusAlignment(this._activeElement, true, false); + return true; } return false; - }; - FocusZone.prototype._moveFocusRight = function(theme) { + }; + FocusZone2.prototype._moveFocusRight = function(theme) { var _this = this; var shouldWrap = this._shouldWrapFocus(this._activeElement, NO_HORIZONTAL_WRAP); - if (this._moveFocus(!(0, _utilities.getRTL)(theme), // eslint-disable-next-line deprecation/deprecation - function(activeRect, targetRect) { - var distance = -1; + if (this._moveFocus( + !getRTL(theme), + // eslint-disable-next-line @typescript-eslint/no-deprecated + function(activeRect, targetRect) { + var distance2 = -1; var topBottomComparison; - if ((0, _utilities.getRTL)(theme)) // When in RTL, this comparison should be the same as the one in _moveFocusLeft for LTR. - // Going right at a rightmost rectangle will go up a line instead of down a line like in LTR. - // This is important, because we want to be comparing the bottom of the target rect - // with the top of the active rect. - topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); - else topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); - if (topBottomComparison && targetRect.left >= activeRect.left && _this.props.direction !== (0, _focusZoneTypes.FocusZoneDirection).vertical) distance = targetRect.left - activeRect.left; - else if (!shouldWrap) distance = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; - return distance; - }, undefined /*ev*/ , shouldWrap)) { - this._setFocusAlignment(this._activeElement, true, false); - return true; + if (getRTL(theme)) { + topBottomComparison = parseFloat(targetRect.bottom.toFixed(3)) > parseFloat(activeRect.top.toFixed(3)); + } else { + topBottomComparison = parseFloat(targetRect.top.toFixed(3)) < parseFloat(activeRect.bottom.toFixed(3)); + } + if (topBottomComparison && targetRect.left >= activeRect.left && _this.props.direction !== FocusZoneDirection.vertical) { + distance2 = targetRect.left - activeRect.left; + } else if (!shouldWrap) { + distance2 = LARGE_NEGATIVE_DISTANCE_FROM_CENTER; + } + return distance2; + }, + void 0, + shouldWrap + )) { + this._setFocusAlignment(this._activeElement, true, false); + return true; } return false; - }; - FocusZone.prototype._moveFocusPaging = function(isForward, useDefaultWrap) { - if (useDefaultWrap === void 0) useDefaultWrap = true; - var element = this._activeElement; - if (!element || !this._root.current) return false; - if (this._isElementInput(element)) { - if (!this._shouldInputLoseFocus(element, isForward)) return false; + }; + FocusZone2.prototype._moveFocusPaging = function(isForward, useDefaultWrap) { + if (useDefaultWrap === void 0) { + useDefaultWrap = true; + } + var element2 = this._activeElement; + if (!element2 || !this._root.current) { + return false; + } + if (this._isElementInput(element2)) { + if (!this._shouldInputLoseFocus(element2, isForward)) { + return false; + } + } + var scrollableParent = findScrollableParent(element2); + if (!scrollableParent) { + return false; } - var scrollableParent = (0, _utilities.findScrollableParent)(element); - if (!scrollableParent) return false; var candidateDistance = -1; - var candidateElement = undefined; + var candidateElement = void 0; var targetTop = -1; var targetBottom = -1; var pagesize = scrollableParent.clientHeight; - var activeRect = element.getBoundingClientRect(); + var activeRect = element2.getBoundingClientRect(); do { - element = isForward ? (0, _utilities.getNextElement)(this._root.current, element) : (0, _utilities.getPreviousElement)(this._root.current, element); - if (element) { - var targetRect = element.getBoundingClientRect(); - var targetRectTop = Math.floor(targetRect.top); - var activeRectBottom = Math.floor(activeRect.bottom); - var targetRectBottom = Math.floor(targetRect.bottom); - var activeRectTop = Math.floor(activeRect.top); - var elementDistance = this._getHorizontalDistanceFromCenter(isForward, activeRect, targetRect); - var isElementPassedPageSizeOnPagingDown = isForward && targetRectTop > activeRectBottom + pagesize; - var isElementPassedPageSizeOnPagingUp = !isForward && targetRectBottom < activeRectTop - pagesize; - if (isElementPassedPageSizeOnPagingDown || isElementPassedPageSizeOnPagingUp) break; - if (elementDistance > -1) { - // for paging down - if (isForward && targetRectTop > targetTop) { - targetTop = targetRectTop; - candidateDistance = elementDistance; - candidateElement = element; - } else if (!isForward && targetRectBottom < targetBottom) { - // for paging up - targetBottom = targetRectBottom; - candidateDistance = elementDistance; - candidateElement = element; - } else if (candidateDistance === -1 || elementDistance <= candidateDistance) { - candidateDistance = elementDistance; - candidateElement = element; - } - } - } - }while (element); + element2 = isForward ? getNextElement(this._root.current, element2) : getPreviousElement(this._root.current, element2); + if (element2) { + var targetRect = element2.getBoundingClientRect(); + var targetRectTop = Math.floor(targetRect.top); + var activeRectBottom = Math.floor(activeRect.bottom); + var targetRectBottom = Math.floor(targetRect.bottom); + var activeRectTop = Math.floor(activeRect.top); + var elementDistance = this._getHorizontalDistanceFromCenter(isForward, activeRect, targetRect); + var isElementPassedPageSizeOnPagingDown = isForward && targetRectTop > activeRectBottom + pagesize; + var isElementPassedPageSizeOnPagingUp = !isForward && targetRectBottom < activeRectTop - pagesize; + if (isElementPassedPageSizeOnPagingDown || isElementPassedPageSizeOnPagingUp) { + break; + } + if (elementDistance > -1) { + if (isForward && targetRectTop > targetTop) { + targetTop = targetRectTop; + candidateDistance = elementDistance; + candidateElement = element2; + } else if (!isForward && targetRectBottom < targetBottom) { + targetBottom = targetRectBottom; + candidateDistance = elementDistance; + candidateElement = element2; + } else if (candidateDistance === -1 || elementDistance <= candidateDistance) { + candidateDistance = elementDistance; + candidateElement = element2; + } + } + } + } while (element2); var changedFocus = false; - // Focus the closest candidate if (candidateElement && candidateElement !== this._activeElement) { - changedFocus = true; - this.focusElement(candidateElement); - this._setFocusAlignment(candidateElement, false, true); + changedFocus = true; + this.focusElement(candidateElement); + this._setFocusAlignment(candidateElement, false, true); } else if (this.props.isCircularNavigation && useDefaultWrap) { - if (isForward) return this.focusElement((0, _utilities.getNextElement)(this._root.current, this._root.current.firstElementChild, true)); - return this.focusElement((0, _utilities.getPreviousElement)(this._root.current, this._root.current.lastElementChild, true, true, true)); + if (isForward) { + return this.focusElement(getNextElement(this._root.current, this._root.current.firstElementChild, true)); + } + return this.focusElement(getPreviousElement(this._root.current, this._root.current.lastElementChild, true, true, true)); } return changedFocus; + }; + FocusZone2.prototype._setFocusAlignment = function(element2, isHorizontal, isVertical) { + if (this.props.direction === FocusZoneDirection.bidirectional && (!this._focusAlignment || isHorizontal || isVertical)) { + var rect2 = element2.getBoundingClientRect(); + var left = rect2.left + rect2.width / 2; + var top_1 = rect2.top + rect2.height / 2; + if (!this._focusAlignment) { + this._focusAlignment = { left, top: top_1 }; + } + if (isHorizontal) { + this._focusAlignment.left = left; + } + if (isVertical) { + this._focusAlignment.top = top_1; + } + } + }; + FocusZone2.prototype._isImmediateDescendantOfZone = function(element2) { + return this._getOwnerZone(element2) === this._root.current; + }; + FocusZone2.prototype._getOwnerZone = function(element2) { + var parentElement = getParent(element2, ALLOW_VIRTUAL_ELEMENTS); + while (parentElement && parentElement !== this._root.current && parentElement !== this._getDocument().body) { + if (isElementFocusZone(parentElement)) { + return parentElement; + } + parentElement = getParent(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + return parentElement; + }; + FocusZone2.prototype._updateTabIndexes = function(element2) { + if (!this._activeElement && this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === "function") { + this._activeElement = this.props.defaultTabbableElement(this._root.current); + } + if (!element2 && this._root.current) { + this._defaultFocusElement = null; + element2 = this._root.current; + if (this._activeElement && !elementContains(element2, this._activeElement)) { + this._activeElement = null; + } + } + if (this._activeElement && !isElementTabbable(this._activeElement, void 0, this._inShadowRoot)) { + this._activeElement = null; + } + var childNodes = element2 && element2.children; + for (var childIndex = 0; childNodes && childIndex < childNodes.length; childIndex++) { + var child = childNodes[childIndex]; + if (!isElementFocusZone(child)) { + if (child.getAttribute && child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "false") { + child.setAttribute(TABINDEX, "-1"); + } + if (isElementTabbable(child, void 0, this._inShadowRoot)) { + if (this.props.disabled) { + child.setAttribute(TABINDEX, "-1"); + } else if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { + this._defaultFocusElement = child; + if (child.getAttribute(TABINDEX) !== "0") { + child.setAttribute(TABINDEX, "0"); + } + } else if (child.getAttribute(TABINDEX) !== "-1") { + child.setAttribute(TABINDEX, "-1"); + } + } else if (child.tagName === "svg" && child.getAttribute("focusable") !== "false") { + child.setAttribute("focusable", "false"); + } + } else if (child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === "true") { + if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { + this._defaultFocusElement = child; + if (child.getAttribute(TABINDEX) !== "0") { + child.setAttribute(TABINDEX, "0"); + } + } else if (child.getAttribute(TABINDEX) !== "-1") { + child.setAttribute(TABINDEX, "-1"); + } + } + this._updateTabIndexes(child); + } + }; + FocusZone2.prototype._isContentEditableElement = function(element2) { + return element2 && element2.getAttribute("contenteditable") === "true"; + }; + FocusZone2.prototype._isElementInput = function(element2) { + if (element2 && element2.tagName && (element2.tagName.toLowerCase() === "input" || element2.tagName.toLowerCase() === "textarea")) { + return true; + } + return false; + }; + FocusZone2.prototype._shouldInputLoseFocus = function(element2, isForward) { + if (!this._processingTabKey && element2 && element2.type && ALLOWED_INPUT_TYPES.indexOf(element2.type.toLowerCase()) > -1) { + var selectionStart = element2.selectionStart; + var selectionEnd = element2.selectionEnd; + var isRangeSelected = selectionStart !== selectionEnd; + var inputValue = element2.value; + var isReadonly = element2.readOnly; + if (isRangeSelected || selectionStart > 0 && !isForward && !isReadonly || selectionStart !== inputValue.length && isForward && !isReadonly || !!this.props.handleTabKey && !(this.props.shouldInputLoseFocusOnArrowKey && this.props.shouldInputLoseFocusOnArrowKey(element2))) { + return false; + } + } + return true; + }; + FocusZone2.prototype._shouldWrapFocus = function(element2, noWrapDataAttribute) { + return this.props.checkForNoWrap ? shouldWrapFocus(element2, noWrapDataAttribute) : true; + }; + FocusZone2.prototype._portalContainsElement = function(element2) { + return element2 && !!this._root.current && portalContainsElement(element2, this._root.current); + }; + FocusZone2.prototype._getDocument = function() { + return getDocument(this._root.current); + }; + FocusZone2.defaultProps = { + isCircularNavigation: false, + direction: FocusZoneDirection.bidirectional, + shouldRaiseClicks: true, + // Hardcoding uncontrolled flag for proper interop with FluentUI V9. + "data-tabster": '{"uncontrolled": {}}' + }; + FocusZone2.contextType = MergeStylesShadowRootContext; + return FocusZone2; + })(React__namespace.Component) + ); + function getIsChecked(item) { + if (item.canCheck) { + return !!(item.isChecked || item.checked); + } + if (typeof item.isChecked === "boolean") { + return item.isChecked; + } + if (typeof item.checked === "boolean") { + return item.checked; + } + return null; + } + function hasSubmenu(item) { + return !!(item.subMenuProps || item.items); + } + function isItemDisabled(item) { + return !!(item.isDisabled || item.disabled); + } + function getMenuItemAriaRole(item) { + var isChecked = getIsChecked(item); + var canCheck = isChecked !== null; + return canCheck ? "menuitemcheckbox" : "menuitem"; + } + var RectangleEdge; + (function(RectangleEdge2) { + RectangleEdge2[RectangleEdge2["top"] = 1] = "top"; + RectangleEdge2[RectangleEdge2["bottom"] = -1] = "bottom"; + RectangleEdge2[RectangleEdge2["left"] = 2] = "left"; + RectangleEdge2[RectangleEdge2["right"] = -2] = "right"; + })(RectangleEdge || (RectangleEdge = {})); + var Position; + (function(Position2) { + Position2[Position2["top"] = 0] = "top"; + Position2[Position2["bottom"] = 1] = "bottom"; + Position2[Position2["start"] = 2] = "start"; + Position2[Position2["end"] = 3] = "end"; + })(Position || (Position = {})); + var _a$4; + function _createPositionData(targetEdge, alignmentEdge, isAuto) { + return { + targetEdge, + alignmentEdge, + isAuto }; - FocusZone.prototype._setFocusAlignment = function(element, isHorizontal, isVertical) { - if (this.props.direction === (0, _focusZoneTypes.FocusZoneDirection).bidirectional && (!this._focusAlignment || isHorizontal || isVertical)) { - var rect = element.getBoundingClientRect(); - var left = rect.left + rect.width / 2; - var top_1 = rect.top + rect.height / 2; - if (!this._focusAlignment) this._focusAlignment = { - left: left, - top: top_1 - }; - if (isHorizontal) this._focusAlignment.left = left; - if (isVertical) this._focusAlignment.top = top_1; + } + var DirectionalDictionary = (_a$4 = {}, _a$4[DirectionalHint.topLeftEdge] = _createPositionData(RectangleEdge.top, RectangleEdge.left), _a$4[DirectionalHint.topCenter] = _createPositionData(RectangleEdge.top), _a$4[DirectionalHint.topRightEdge] = _createPositionData(RectangleEdge.top, RectangleEdge.right), _a$4[DirectionalHint.topAutoEdge] = _createPositionData(RectangleEdge.top, void 0, true), _a$4[DirectionalHint.bottomLeftEdge] = _createPositionData(RectangleEdge.bottom, RectangleEdge.left), _a$4[DirectionalHint.bottomCenter] = _createPositionData(RectangleEdge.bottom), _a$4[DirectionalHint.bottomRightEdge] = _createPositionData(RectangleEdge.bottom, RectangleEdge.right), _a$4[DirectionalHint.bottomAutoEdge] = _createPositionData(RectangleEdge.bottom, void 0, true), _a$4[DirectionalHint.leftTopEdge] = _createPositionData(RectangleEdge.left, RectangleEdge.top), _a$4[DirectionalHint.leftCenter] = _createPositionData(RectangleEdge.left), _a$4[DirectionalHint.leftBottomEdge] = _createPositionData(RectangleEdge.left, RectangleEdge.bottom), _a$4[DirectionalHint.rightTopEdge] = _createPositionData(RectangleEdge.right, RectangleEdge.top), _a$4[DirectionalHint.rightCenter] = _createPositionData(RectangleEdge.right), _a$4[DirectionalHint.rightBottomEdge] = _createPositionData(RectangleEdge.right, RectangleEdge.bottom), _a$4); + function _isRectangleWithinBounds(rect2, boundingRect) { + if (rect2.top < boundingRect.top) { + return false; + } + if (rect2.bottom > boundingRect.bottom) { + return false; + } + if (rect2.left < boundingRect.left) { + return false; + } + if (rect2.right > boundingRect.right) { + return false; + } + return true; + } + function _getOutOfBoundsEdges(rect2, boundingRect) { + var outOfBounds2 = []; + if (rect2.top < boundingRect.top) { + outOfBounds2.push(RectangleEdge.top); + } + if (rect2.bottom > boundingRect.bottom) { + outOfBounds2.push(RectangleEdge.bottom); + } + if (rect2.left < boundingRect.left) { + outOfBounds2.push(RectangleEdge.left); + } + if (rect2.right > boundingRect.right) { + outOfBounds2.push(RectangleEdge.right); + } + return outOfBounds2; + } + function _getEdgeValue(rect2, edge) { + return rect2[RectangleEdge[edge]]; + } + function _setEdgeValue(rect2, edge, value2) { + rect2[RectangleEdge[edge]] = value2; + return rect2; + } + function _getCenterValue(rect2, edge) { + var edges = _getFlankingEdges(edge); + return (_getEdgeValue(rect2, edges.positiveEdge) + _getEdgeValue(rect2, edges.negativeEdge)) / 2; + } + function _getRelativeEdgeValue(edge, value2) { + if (edge > 0) { + return value2; + } else { + return value2 * -1; + } + } + function _getRelativeRectEdgeValue(edge, rect2) { + return _getRelativeEdgeValue(edge, _getEdgeValue(rect2, edge)); + } + function _getRelativeEdgeDifference(rect2, hostRect, edge) { + var edgeDifference = _getEdgeValue(rect2, edge) - _getEdgeValue(hostRect, edge); + return _getRelativeEdgeValue(edge, edgeDifference); + } + function _moveEdge(rect2, edge, newValue, maintainSize) { + if (maintainSize === void 0) { + maintainSize = true; + } + var difference = _getEdgeValue(rect2, edge) - newValue; + var returnRect = _setEdgeValue(rect2, edge, newValue); + if (maintainSize) { + returnRect = _setEdgeValue(rect2, edge * -1, _getEdgeValue(rect2, edge * -1) - difference); + } + return returnRect; + } + function _alignEdges(rect2, target2, edge, gap) { + if (gap === void 0) { + gap = 0; + } + return _moveEdge(rect2, edge, _getEdgeValue(target2, edge) + _getRelativeEdgeValue(edge, gap)); + } + function _alignOppositeEdges(rect2, target2, targetEdge, gap) { + if (gap === void 0) { + gap = 0; + } + var oppositeEdge = targetEdge * -1; + var adjustedGap = _getRelativeEdgeValue(oppositeEdge, gap); + return _moveEdge(rect2, targetEdge * -1, _getEdgeValue(target2, targetEdge) + adjustedGap); + } + function _isEdgeInBounds(rect2, bounds2, edge) { + var adjustedRectValue = _getRelativeRectEdgeValue(edge, rect2); + return adjustedRectValue > _getRelativeRectEdgeValue(edge, bounds2); + } + function _getOutOfBoundsDegree(rect2, bounds2) { + var breakingEdges = _getOutOfBoundsEdges(rect2, bounds2); + var total = 0; + for (var _i = 0, breakingEdges_1 = breakingEdges; _i < breakingEdges_1.length; _i++) { + var edge = breakingEdges_1[_i]; + total += Math.pow(_getRelativeEdgeDifference(rect2, bounds2, edge), 2); + } + return total; + } + function _canScrollResizeToFitEdge(target2, bounding, targetEdge, minimumScrollResizeHeight) { + if (minimumScrollResizeHeight === void 0) { + minimumScrollResizeHeight = 200; + } + if (targetEdge !== RectangleEdge.bottom && targetEdge !== RectangleEdge.top) { + return false; + } + return _getRelativeEdgeDifference(target2, bounding, targetEdge) >= minimumScrollResizeHeight; + } + function _flipToFit(rect2, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + if (gap === void 0) { + gap = 0; + } + var directions = [ + RectangleEdge.left, + RectangleEdge.right, + RectangleEdge.bottom, + RectangleEdge.top + ]; + if (getRTL()) { + directions[0] *= -1; + directions[1] *= -1; + } + var currentEstimate = rect2; + var currentEdge = positionData.targetEdge; + var currentAlignment = positionData.alignmentEdge; + var oobDegree; + var bestEdge = currentEdge; + var bestAlignment = currentAlignment; + for (var i = 0; i < 4; i++) { + if (_isEdgeInBounds(currentEstimate, bounding, currentEdge)) { + return { + elementRectangle: currentEstimate, + targetEdge: currentEdge, + alignmentEdge: currentAlignment + }; + } else if (shouldScroll && _canScrollResizeToFitEdge(target2, bounding, currentEdge, minimumScrollResizeHeight)) { + switch (currentEdge) { + case RectangleEdge.bottom: + currentEstimate.bottom = bounding.bottom; + break; + case RectangleEdge.top: + currentEstimate.top = bounding.top; + break; + } + return { + elementRectangle: currentEstimate, + targetEdge: currentEdge, + alignmentEdge: currentAlignment, + forcedInBounds: true + }; + } else { + var currentOOBDegree = _getOutOfBoundsDegree(currentEstimate, bounding); + if (!oobDegree || currentOOBDegree < oobDegree) { + oobDegree = currentOOBDegree; + bestEdge = currentEdge; + bestAlignment = currentAlignment; + } + directions.splice(directions.indexOf(currentEdge), 1); + if (directions.length > 0) { + if (directions.indexOf(currentEdge * -1) > -1) { + currentEdge = currentEdge * -1; + } else { + currentAlignment = currentEdge; + currentEdge = directions.slice(-1)[0]; + } + currentEstimate = _estimatePosition(rect2, target2, { targetEdge: currentEdge, alignmentEdge: currentAlignment }, gap); } + } + } + currentEstimate = _estimatePosition(rect2, target2, { targetEdge: bestEdge, alignmentEdge: bestAlignment }, gap); + return { + elementRectangle: currentEstimate, + targetEdge: bestEdge, + alignmentEdge: bestAlignment }; - FocusZone.prototype._isImmediateDescendantOfZone = function(element) { - return this._getOwnerZone(element) === this._root.current; + } + function _flipAlignmentEdge(elementEstimate, target2, gap, coverTarget) { + var alignmentEdge = elementEstimate.alignmentEdge, targetEdge = elementEstimate.targetEdge, elementRectangle = elementEstimate.elementRectangle; + var oppositeEdge = alignmentEdge * -1; + var newEstimate = _estimatePosition(elementRectangle, target2, { targetEdge, alignmentEdge: oppositeEdge }, gap, coverTarget); + return { + elementRectangle: newEstimate, + targetEdge, + alignmentEdge: oppositeEdge }; - FocusZone.prototype._getOwnerZone = function(element) { - var parentElement = (0, _utilities.getParent)(element, ALLOW_VIRTUAL_ELEMENTS); - while(parentElement && parentElement !== this._root.current && parentElement !== this._getDocument().body){ - if ((0, _utilities.isElementFocusZone)(parentElement)) return parentElement; - parentElement = (0, _utilities.getParent)(parentElement, ALLOW_VIRTUAL_ELEMENTS); + } + function _adjustFitWithinBounds(element2, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + if (gap === void 0) { + gap = 0; + } + var alignmentEdge = positionData.alignmentEdge, alignTargetEdge = positionData.alignTargetEdge; + var elementEstimate = { + elementRectangle: element2, + targetEdge: positionData.targetEdge, + alignmentEdge + }; + if (!directionalHintFixed && !coverTarget) { + elementEstimate = _flipToFit(element2, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap); + } + var outOfBounds2 = _getOutOfBoundsEdges(elementEstimate.elementRectangle, bounding); + var fixedEdge = directionalHintFixed ? -elementEstimate.targetEdge : void 0; + if (outOfBounds2.length > 0) { + if (alignTargetEdge) { + if (elementEstimate.alignmentEdge && outOfBounds2.indexOf(elementEstimate.alignmentEdge * -1) > -1) { + var flippedElementEstimate = _flipAlignmentEdge(elementEstimate, target2, gap, coverTarget); + if (_isRectangleWithinBounds(flippedElementEstimate.elementRectangle, bounding)) { + return flippedElementEstimate; + } else { + elementEstimate = _alignOutOfBoundsEdges(_getOutOfBoundsEdges(flippedElementEstimate.elementRectangle, bounding), elementEstimate, bounding, fixedEdge); + } + } else { + elementEstimate = _alignOutOfBoundsEdges(outOfBounds2, elementEstimate, bounding, fixedEdge); } - return parentElement; - }; - FocusZone.prototype._updateTabIndexes = function(element) { - if (!this._activeElement && this.props.defaultTabbableElement && typeof this.props.defaultTabbableElement === 'function') this._activeElement = this.props.defaultTabbableElement(this._root.current); - if (!element && this._root.current) { - this._defaultFocusElement = null; - element = this._root.current; - if (this._activeElement && !(0, _utilities.elementContains)(element, this._activeElement)) this._activeElement = null; - } - // If active element changes state to disabled, set it to null. - // Otherwise, we lose keyboard accessibility to other elements in focus zone. - if (this._activeElement && !(0, _utilities.isElementTabbable)(this._activeElement, undefined, this._inShadowRoot)) this._activeElement = null; - var childNodes = element && element.children; - for(var childIndex = 0; childNodes && childIndex < childNodes.length; childIndex++){ - var child = childNodes[childIndex]; - if (!(0, _utilities.isElementFocusZone)(child)) { - // If the item is explicitly set to not be focusable then TABINDEX needs to be set to -1. - if (child.getAttribute && child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'false') child.setAttribute(TABINDEX, '-1'); - if ((0, _utilities.isElementTabbable)(child, undefined, this._inShadowRoot)) { - if (this.props.disabled) child.setAttribute(TABINDEX, '-1'); - else if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { - this._defaultFocusElement = child; - if (child.getAttribute(TABINDEX) !== '0') child.setAttribute(TABINDEX, '0'); - } else if (child.getAttribute(TABINDEX) !== '-1') child.setAttribute(TABINDEX, '-1'); - } else if (child.tagName === 'svg' && child.getAttribute('focusable') !== 'false') // Disgusting IE hack. Sad face. - child.setAttribute('focusable', 'false'); - } else if (child.getAttribute(IS_FOCUSABLE_ATTRIBUTE) === 'true') { - if (!this._isInnerZone && (!this._activeElement && !this._defaultFocusElement || this._activeElement === child)) { - this._defaultFocusElement = child; - if (child.getAttribute(TABINDEX) !== '0') child.setAttribute(TABINDEX, '0'); - } else if (child.getAttribute(TABINDEX) !== '-1') child.setAttribute(TABINDEX, '-1'); - } - this._updateTabIndexes(child); + } else { + elementEstimate = _alignOutOfBoundsEdges(outOfBounds2, elementEstimate, bounding, fixedEdge); + } + } + return elementEstimate; + } + function _alignOutOfBoundsEdges(outOfBoundsEdges, elementEstimate, bounding, preserveEdge) { + for (var _i = 0, outOfBoundsEdges_1 = outOfBoundsEdges; _i < outOfBoundsEdges_1.length; _i++) { + var direction = outOfBoundsEdges_1[_i]; + var edgeAttempt = void 0; + if (preserveEdge && preserveEdge === direction * -1) { + edgeAttempt = _moveEdge(elementEstimate.elementRectangle, direction, _getEdgeValue(bounding, direction), false); + elementEstimate.forcedInBounds = true; + } else { + edgeAttempt = _alignEdges(elementEstimate.elementRectangle, bounding, direction); + var inBounds = _isEdgeInBounds(edgeAttempt, bounding, direction * -1); + if (!inBounds) { + edgeAttempt = _moveEdge(edgeAttempt, direction * -1, _getEdgeValue(bounding, direction * -1), false); + elementEstimate.forcedInBounds = true; } + } + elementEstimate.elementRectangle = edgeAttempt; + } + return elementEstimate; + } + function _centerEdgeToPoint(rect2, edge, point2) { + var positiveEdge = _getFlankingEdges(edge).positiveEdge; + var elementMiddle = _getCenterValue(rect2, edge); + var distanceToMiddle = elementMiddle - _getEdgeValue(rect2, positiveEdge); + return _moveEdge(rect2, positiveEdge, point2 - distanceToMiddle); + } + function _estimatePosition(elementToPosition, target2, positionData, gap, coverTarget) { + if (gap === void 0) { + gap = 0; + } + var estimatedElementPosition = new Rectangle(elementToPosition.left, elementToPosition.right, elementToPosition.top, elementToPosition.bottom); + var alignmentEdge = positionData.alignmentEdge, targetEdge = positionData.targetEdge; + var elementEdge = coverTarget ? targetEdge : targetEdge * -1; + estimatedElementPosition = coverTarget ? _alignEdges(estimatedElementPosition, target2, targetEdge, gap) : _alignOppositeEdges(estimatedElementPosition, target2, targetEdge, gap); + if (!alignmentEdge) { + var targetMiddlePoint = _getCenterValue(target2, targetEdge); + estimatedElementPosition = _centerEdgeToPoint(estimatedElementPosition, elementEdge, targetMiddlePoint); + } else { + estimatedElementPosition = _alignEdges(estimatedElementPosition, target2, alignmentEdge); + } + return estimatedElementPosition; + } + function _getFlankingEdges(edge) { + if (edge === RectangleEdge.top || edge === RectangleEdge.bottom) { + return { + positiveEdge: RectangleEdge.left, + negativeEdge: RectangleEdge.right + }; + } else { + return { + positiveEdge: RectangleEdge.top, + negativeEdge: RectangleEdge.bottom + }; + } + } + function _finalizeReturnEdge(elementRectangle, returnEdge, bounds2) { + if (bounds2 && Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds2, returnEdge)) > Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds2, returnEdge * -1))) { + return returnEdge * -1; + } + return returnEdge; + } + function _isEdgeOnBounds(elementRectangle, edge, bounds2) { + return bounds2 !== void 0 && _getEdgeValue(elementRectangle, edge) === _getEdgeValue(bounds2, edge); + } + function _finalizeElementPosition(elementRectangle, hostElement, targetEdge, bounds2, alignmentEdge, coverTarget, doNotFinalizeReturnEdge, forceWithinBounds) { + var returnValue = {}; + var hostRect = _getRectangleFromElement(hostElement); + var elementEdge = coverTarget ? targetEdge : targetEdge * -1; + var returnEdge = alignmentEdge ? alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge; + if (!doNotFinalizeReturnEdge || _isEdgeOnBounds(elementRectangle, getOppositeEdge(returnEdge), bounds2)) { + returnEdge = _finalizeReturnEdge(elementRectangle, returnEdge, bounds2); + } + returnValue[RectangleEdge[elementEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge); + returnValue[RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge); + if (forceWithinBounds) { + returnValue[RectangleEdge[elementEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge * -1); + returnValue[RectangleEdge[returnEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge * -1); + } + return returnValue; + } + function _calculateActualBeakWidthInPixels(beakWidth) { + return Math.sqrt(beakWidth * beakWidth * 2); + } + function _getPositionData(directionalHint, directionalHintForRTL, previousPositions) { + if (directionalHint === void 0) { + directionalHint = DirectionalHint.bottomAutoEdge; + } + if (previousPositions) { + return { + alignmentEdge: previousPositions.alignmentEdge, + isAuto: previousPositions.isAuto, + targetEdge: previousPositions.targetEdge + }; + } + var positionInformation = __assign$1({}, DirectionalDictionary[directionalHint]); + if (getRTL()) { + if (positionInformation.alignmentEdge && positionInformation.alignmentEdge % 2 === 0) { + positionInformation.alignmentEdge = positionInformation.alignmentEdge * -1; + } + return directionalHintForRTL !== void 0 ? DirectionalDictionary[directionalHintForRTL] : positionInformation; + } + return positionInformation; + } + function _getAlignmentData(positionData, target2, boundingRect, coverTarget, alignTargetEdge) { + if (positionData.isAuto) { + positionData.alignmentEdge = getClosestEdge(positionData.targetEdge, target2, boundingRect); + } + positionData.alignTargetEdge = alignTargetEdge; + return positionData; + } + function getClosestEdge(targetEdge, target2, boundingRect) { + var targetCenter = _getCenterValue(target2, targetEdge); + var boundingCenter = _getCenterValue(boundingRect, targetEdge); + var _a2 = _getFlankingEdges(targetEdge), positiveEdge = _a2.positiveEdge, negativeEdge = _a2.negativeEdge; + if (targetCenter <= boundingCenter) { + return positiveEdge; + } else { + return negativeEdge; + } + } + function _positionElementWithinBounds(elementToPosition, target2, bounding, positionData, gap, shouldScroll, minimumScrollResizeHeight, directionalHintFixed, coverTarget) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + var estimatedElementPosition = _estimatePosition(elementToPosition, target2, positionData, gap, coverTarget); + if (_isRectangleWithinBounds(estimatedElementPosition, bounding)) { + return { + elementRectangle: estimatedElementPosition, + targetEdge: positionData.targetEdge, + alignmentEdge: positionData.alignmentEdge + }; + } else { + return _adjustFitWithinBounds(estimatedElementPosition, target2, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget); + } + } + function _finalizeBeakPosition(elementPosition, positionedBeak, bounds2) { + var targetEdge = elementPosition.targetEdge * -1; + var actualElement = new Rectangle(0, elementPosition.elementRectangle.width, 0, elementPosition.elementRectangle.height); + var returnValue = {}; + var returnEdge = _finalizeReturnEdge(elementPosition.elementRectangle, elementPosition.alignmentEdge ? elementPosition.alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge, bounds2); + var beakEdgeDifference = _getRelativeEdgeDifference(elementPosition.elementRectangle, elementPosition.targetRectangle, targetEdge); + var showBeak = beakEdgeDifference > Math.abs(_getEdgeValue(positionedBeak, targetEdge)); + returnValue[RectangleEdge[targetEdge]] = _getEdgeValue(positionedBeak, targetEdge); + returnValue[RectangleEdge[returnEdge]] = _getRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); + return { + elementPosition: __assign$1({}, returnValue), + closestEdge: getClosestEdge(elementPosition.targetEdge, positionedBeak, actualElement), + targetEdge, + hideBeak: !showBeak }; - FocusZone.prototype._isContentEditableElement = function(element) { - return element && element.getAttribute('contenteditable') === 'true'; - }; - FocusZone.prototype._isElementInput = function(element) { - if (element && element.tagName && (element.tagName.toLowerCase() === 'input' || element.tagName.toLowerCase() === 'textarea')) return true; - return false; + } + function _positionBeak(beakWidth, elementPosition) { + var target2 = elementPosition.targetRectangle; + var _a2 = _getFlankingEdges(elementPosition.targetEdge), positiveEdge = _a2.positiveEdge, negativeEdge = _a2.negativeEdge; + var beakTargetPoint = _getCenterValue(target2, elementPosition.targetEdge); + var elementBounds = new Rectangle(beakWidth / 2, elementPosition.elementRectangle.width - beakWidth / 2, beakWidth / 2, elementPosition.elementRectangle.height - beakWidth / 2); + var beakPosition = new Rectangle(0, beakWidth, 0, beakWidth); + beakPosition = _moveEdge(beakPosition, elementPosition.targetEdge * -1, -beakWidth / 2); + beakPosition = _centerEdgeToPoint(beakPosition, elementPosition.targetEdge * -1, beakTargetPoint - _getRelativeRectEdgeValue(positiveEdge, elementPosition.elementRectangle)); + if (!_isEdgeInBounds(beakPosition, elementBounds, positiveEdge)) { + beakPosition = _alignEdges(beakPosition, elementBounds, positiveEdge); + } else if (!_isEdgeInBounds(beakPosition, elementBounds, negativeEdge)) { + beakPosition = _alignEdges(beakPosition, elementBounds, negativeEdge); + } + return beakPosition; + } + function _getRectangleFromElement(element2) { + var clientRect = element2.getBoundingClientRect(); + return new Rectangle(clientRect.left, clientRect.right, clientRect.top, clientRect.bottom); + } + function _getRectangleFromIRect(rect2) { + return new Rectangle(rect2.left, rect2.right, rect2.top, rect2.bottom); + } + function _getTargetRect(bounds2, target2) { + var targetRectangle; + if (target2) { + if (!!target2.preventDefault) { + var ev = target2; + targetRectangle = new Rectangle(ev.clientX, ev.clientX, ev.clientY, ev.clientY); + } else if (!!target2.getBoundingClientRect) { + targetRectangle = _getRectangleFromElement(target2); + } else { + var rectOrPoint = target2; + var left = rectOrPoint.left || rectOrPoint.x; + var top_1 = rectOrPoint.top || rectOrPoint.y; + var right = rectOrPoint.right || left; + var bottom = rectOrPoint.bottom || top_1; + targetRectangle = new Rectangle(left, right, top_1, bottom); + } + if (!_isRectangleWithinBounds(targetRectangle, bounds2)) { + var outOfBounds2 = _getOutOfBoundsEdges(targetRectangle, bounds2); + for (var _i = 0, outOfBounds_1 = outOfBounds2; _i < outOfBounds_1.length; _i++) { + var direction = outOfBounds_1[_i]; + targetRectangle[RectangleEdge[direction]] = bounds2[RectangleEdge[direction]]; + } + } + } else { + targetRectangle = new Rectangle(0, 0, 0, 0); + } + return targetRectangle; + } + function _positionElementRelative(props, elementToPosition, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + var gap = props.gapSpace ? props.gapSpace : 0; + var targetRect = _getTargetRect(boundingRect, props.target); + var positionData = _getAlignmentData(_getPositionData(props.directionalHint, props.directionalHintForRTL, previousPositions), targetRect, boundingRect, props.coverTarget, props.alignTargetEdge); + var positionedElement = _positionElementWithinBounds(_getRectangleFromElement(elementToPosition), targetRect, boundingRect, positionData, gap, shouldScroll, minimumScrollResizeHeight, props.directionalHintFixed, props.coverTarget); + return __assign$1(__assign$1({}, positionedElement), { targetRectangle: targetRect }); + } + function _finalizePositionData(positionedElement, hostElement, bounds2, coverTarget, doNotFinalizeReturnEdge) { + var finalizedElement = _finalizeElementPosition(positionedElement.elementRectangle, hostElement, positionedElement.targetEdge, bounds2, positionedElement.alignmentEdge, coverTarget, doNotFinalizeReturnEdge, positionedElement.forcedInBounds); + return { + elementPosition: finalizedElement, + targetEdge: positionedElement.targetEdge, + alignmentEdge: positionedElement.alignmentEdge }; - FocusZone.prototype._shouldInputLoseFocus = function(element, isForward) { - // If a tab was used, we want to focus on the next element. - if (!this._processingTabKey && element && element.type && ALLOWED_INPUT_TYPES.indexOf(element.type.toLowerCase()) > -1) { - var selectionStart = element.selectionStart; - var selectionEnd = element.selectionEnd; - var isRangeSelected = selectionStart !== selectionEnd; - var inputValue = element.value; - var isReadonly = element.readOnly; - // We shouldn't lose focus in the following cases: - // 1. There is range selected. - // 2. When selection start is larger than 0 and it is backward and not readOnly. - // 3. when selection start is not the end of length, it is forward and not readOnly. - // 4. We press any of the arrow keys when our handleTabKey isn't none or undefined (only losing focus if we hit - // tab) and if shouldInputLoseFocusOnArrowKey is defined, if scenario prefers to not loose the focus which is - // determined by calling the callback shouldInputLoseFocusOnArrowKey - if (isRangeSelected || selectionStart > 0 && !isForward && !isReadonly || selectionStart !== inputValue.length && isForward && !isReadonly || !!this.props.handleTabKey && !(this.props.shouldInputLoseFocusOnArrowKey && this.props.shouldInputLoseFocusOnArrowKey(element))) return false; + } + function _calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { + if (beakWidth === void 0) { + beakWidth = 0; + } + if (gapSpace === void 0) { + gapSpace = 0; + } + return _calculateActualBeakWidthInPixels(isBeakVisible ? beakWidth : 0) / 2 + gapSpace; + } + function _positionCallout(props, hostElement, callout, previousPositions, shouldScroll, minimumScrollResizeHeight, doNotFinalizeReturnEdge, win) { + if (shouldScroll === void 0) { + shouldScroll = false; + } + var theWin = win !== null && win !== void 0 ? win : getWindow(); + var beakWidth = props.isBeakVisible ? props.beakWidth || 0 : 0; + var gap = _calculateGapSpace(props.isBeakVisible, props.beakWidth, props.gapSpace); + var positionProps = props; + positionProps.gapSpace = gap; + var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new Rectangle(0, theWin.innerWidth - getScrollbarWidth(), 0, theWin.innerHeight); + var positionedElement = _positionElementRelative(positionProps, callout, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight); + var beakPositioned = _positionBeak(beakWidth, positionedElement); + var finalizedBeakPosition = _finalizeBeakPosition(positionedElement, beakPositioned, boundingRect); + return __assign$1(__assign$1({}, _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget, doNotFinalizeReturnEdge)), { beakPosition: finalizedBeakPosition }); + } + function _positionCard(props, hostElement, callout, previousPositions, win) { + var theWin = win !== null && win !== void 0 ? win : getWindow(); + return _positionCallout(props, hostElement, callout, previousPositions, false, void 0, true, theWin); + } + function _getRectangleFromTarget(target2) { + var _a2, _b2, _c2, _d2; + var mouseTarget = target2; + var elementTarget = target2; + var rectOrPointTarget = target2; + var targetRect; + var left = (_a2 = rectOrPointTarget.left) !== null && _a2 !== void 0 ? _a2 : rectOrPointTarget.x; + var top = (_b2 = rectOrPointTarget.top) !== null && _b2 !== void 0 ? _b2 : rectOrPointTarget.y; + var right = (_c2 = rectOrPointTarget.right) !== null && _c2 !== void 0 ? _c2 : left; + var bottom = (_d2 = rectOrPointTarget.bottom) !== null && _d2 !== void 0 ? _d2 : top; + if (!!mouseTarget.stopPropagation) { + targetRect = new Rectangle(mouseTarget.clientX, mouseTarget.clientX, mouseTarget.clientY, mouseTarget.clientY); + } else if (left !== void 0 && top !== void 0) { + targetRect = new Rectangle(left, right, top, bottom); + } else { + targetRect = _getRectangleFromElement(elementTarget); + } + return targetRect; + } + function positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, win) { + return _positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, void 0, win); + } + function positionCard(props, hostElement, elementToPosition, previousPositions, win) { + return _positionCard(props, hostElement, elementToPosition, previousPositions, win); + } + function getOppositeEdge(edge) { + return edge * -1; + } + function _getBoundsFromTargetWindow(target2, targetWindow) { + var segments2 = void 0; + if (targetWindow.getWindowSegments) { + segments2 = targetWindow.getWindowSegments(); + } + if (segments2 === void 0 || segments2.length <= 1) { + return { + top: 0, + left: 0, + right: targetWindow.innerWidth, + bottom: targetWindow.innerHeight, + width: targetWindow.innerWidth, + height: targetWindow.innerHeight + }; + } + var x2 = 0; + var y2 = 0; + if (target2 !== null && !!target2.getBoundingClientRect) { + var clientRect = target2.getBoundingClientRect(); + x2 = (clientRect.left + clientRect.right) / 2; + y2 = (clientRect.top + clientRect.bottom) / 2; + } else if (target2 !== null) { + x2 = target2.left || target2.x; + y2 = target2.top || target2.y; + } + var bounds2 = { top: 0, left: 0, right: 0, bottom: 0, width: 0, height: 0 }; + for (var _i = 0, segments_1 = segments2; _i < segments_1.length; _i++) { + var segment = segments_1[_i]; + if (x2 && segment.left <= x2 && segment.right >= x2 && y2 && segment.top <= y2 && segment.bottom >= y2) { + bounds2 = { + top: segment.top, + left: segment.left, + right: segment.right, + bottom: segment.bottom, + width: segment.width, + height: segment.height + }; + } + } + return bounds2; + } + function getBoundsFromTargetWindow(target2, targetWindow) { + return _getBoundsFromTargetWindow(target2, targetWindow); + } + function calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { + return _calculateGapSpace(isBeakVisible, beakWidth, gapSpace); + } + function getRectangleFromTarget(target2) { + return _getRectangleFromTarget(target2); + } + function useScrollbarAsync(props, root) { + var async = useAsync(); + var _a2 = React__namespace.useState(false), needsVerticalScrollBarState = _a2[0], setNeedsVerticalScrollBar = _a2[1]; + React__namespace.useEffect(function() { + async.requestAnimationFrame(function() { + var _a3; + if (props.style && props.style.overflowY) { + return; + } + var needsVerticalScrollBar = false; + if (root && root.current && ((_a3 = root.current) === null || _a3 === void 0 ? void 0 : _a3.firstElementChild)) { + var rootHeight = root.current.clientHeight; + var firstChildHeight = root.current.firstElementChild.clientHeight; + if (rootHeight > 0 && firstChildHeight > rootHeight) { + needsVerticalScrollBar = firstChildHeight - rootHeight > 1; + } + } + if (needsVerticalScrollBarState !== needsVerticalScrollBar) { + setNeedsVerticalScrollBar(needsVerticalScrollBar); } - return true; - }; - FocusZone.prototype._shouldWrapFocus = function(element, noWrapDataAttribute) { - return this.props.checkForNoWrap ? (0, _utilities.shouldWrapFocus)(element, noWrapDataAttribute) : true; - }; - /** - * Returns true if the element is a descendant of the FocusZone through a React portal. - */ FocusZone.prototype._portalContainsElement = function(element) { - return element && !!this._root.current && (0, _utilities.portalContainsElement)(element, this._root.current); - }; - FocusZone.prototype._getDocument = function() { - return (0, _utilities.getDocument)(this._root.current); - }; - FocusZone.contextType = (0, _utilities.MergeStylesShadowRootContext); - FocusZone.defaultProps = { - isCircularNavigation: false, - direction: (0, _focusZoneTypes.FocusZoneDirection).bidirectional, - shouldRaiseClicks: true, - // Hardcoding uncontrolled flag for proper interop with FluentUI V9. - 'data-tabster': '{"uncontrolled": {}}' - }; - return FocusZone; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./FocusZone.types":"hsbYN","@fluentui/utilities":"55bj3","@fluentui/merge-styles":"bDG2L","@fluentui/style-utilities":"bJvmh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hsbYN":[function(require,module,exports,__globalThis) { -/** - * {@docCategory FocusZone} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusZoneTabbableElements", ()=>FocusZoneTabbableElements); -parcelHelpers.export(exports, "FocusZoneDirection", ()=>FocusZoneDirection); -var FocusZoneTabbableElements = { - /** Tabbing is not allowed */ none: 0, - /** All tabbing action is allowed */ all: 1, - /** Tabbing is allowed only on input elements */ inputOnly: 2 -}; -var FocusZoneDirection; -(function(FocusZoneDirection) { - /** Only react to up/down arrows. */ FocusZoneDirection[FocusZoneDirection["vertical"] = 0] = "vertical"; - /** Only react to left/right arrows. */ FocusZoneDirection[FocusZoneDirection["horizontal"] = 1] = "horizontal"; - /** React to all arrows. */ FocusZoneDirection[FocusZoneDirection["bidirectional"] = 2] = "bidirectional"; - /** - * React to all arrows. Navigate next item in DOM on right/down arrow keys and previous - left/up arrow keys. - * Right and Left arrow keys are swapped in RTL mode. - */ FocusZoneDirection[FocusZoneDirection["domOrder"] = 3] = "domOrder"; -})(FocusZoneDirection || (FocusZoneDirection = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lGesq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _contextualMenuUtility = require("./contextualMenuUtility"); -parcelHelpers.exportAll(_contextualMenuUtility, exports); - -},{"./contextualMenuUtility":"jCBxW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jCBxW":[function(require,module,exports,__globalThis) { -/** - * Determines the effective checked state of a menu item. - * - * @param item {IContextualMenuItem} to get the check state of. - * @returns {true} if the item is checked. - * @returns {false} if the item is unchecked. - * @returns {null} if the item is not checkable. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getIsChecked", ()=>getIsChecked); -parcelHelpers.export(exports, "hasSubmenu", ()=>hasSubmenu); -parcelHelpers.export(exports, "isItemDisabled", ()=>isItemDisabled); -parcelHelpers.export(exports, "getMenuItemAriaRole", ()=>getMenuItemAriaRole); -function getIsChecked(item) { - if (item.canCheck) return !!(item.isChecked || item.checked); - if (typeof item.isChecked === 'boolean') return item.isChecked; - if (typeof item.checked === 'boolean') return item.checked; - // Item is not checkable. - return null; -} -function hasSubmenu(item) { - // eslint-disable-next-line deprecation/deprecation - return !!(item.subMenuProps || item.items); -} -function isItemDisabled(item) { - return !!(item.isDisabled || item.disabled); -} -function getMenuItemAriaRole(item) { - var isChecked = getIsChecked(item); - var canCheck = isChecked !== null; - return canCheck ? 'menuitemcheckbox' : 'menuitem'; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g2jXk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Callout/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Callout/index":"4sb4j","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4sb4j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _callout = require("./Callout"); -parcelHelpers.exportAll(_callout, exports); -var _calloutTypes = require("./Callout.types"); -parcelHelpers.exportAll(_calloutTypes, exports); -var _calloutContent = require("./CalloutContent"); -parcelHelpers.exportAll(_calloutContent, exports); -var _calloutContentBase = require("./CalloutContent.base"); -parcelHelpers.exportAll(_calloutContentBase, exports); -var _focusTrapCallout = require("./FocusTrapCallout"); -parcelHelpers.exportAll(_focusTrapCallout, exports); -var _focusTrapCalloutTypes = require("./FocusTrapCallout.types"); -parcelHelpers.exportAll(_focusTrapCalloutTypes, exports); -var _directionalHint = require("../../common/DirectionalHint"); -parcelHelpers.exportAll(_directionalHint, exports); - -},{"./Callout":"9IC7W","./Callout.types":false,"./CalloutContent":false,"./CalloutContent.base":false,"./FocusTrapCallout":false,"./FocusTrapCallout.types":false,"../../common/DirectionalHint":"avdAc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9IC7W":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Callout", ()=>Callout); -var _tslib = require("tslib"); -var _react = require("react"); -var _calloutContent = require("./CalloutContent"); -var _layer = require("../../Layer"); -var Callout = _react.forwardRef(function(_a, forwardedRef) { - var layerProps = _a.layerProps, doNotLayer = _a.doNotLayer, rest = (0, _tslib.__rest)(_a, [ - "layerProps", - "doNotLayer" - ]); - var content = _react.createElement((0, _calloutContent.CalloutContent), (0, _tslib.__assign)({}, rest, { - doNotLayer: doNotLayer, - ref: forwardedRef - })); - return doNotLayer ? content : _react.createElement((0, _layer.Layer), (0, _tslib.__assign)({}, layerProps), content); -}); -Callout.displayName = 'Callout'; - -},{"tslib":"9gizs","react":"jGrId","./CalloutContent":"8K8Ao","../../Layer":"hQjxQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8K8Ao":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CalloutContent", ()=>CalloutContent); -var _utilities = require("../../Utilities"); -var _calloutContentBase = require("./CalloutContent.base"); -var _calloutContentStyles = require("./CalloutContent.styles"); -var CalloutContent = (0, _utilities.styled)((0, _calloutContentBase.CalloutContentBase), (0, _calloutContentStyles.getStyles), undefined, { - scope: 'CalloutContent' -}); - -},{"../../Utilities":"1NZCy","./CalloutContent.base":"fq2Rc","./CalloutContent.styles":"bduHE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fq2Rc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CalloutContentBase", ()=>CalloutContentBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _directionalHint = require("../../common/DirectionalHint"); -var _utilities = require("../../Utilities"); -var _positioning = require("../../utilities/positioning/positioning"); -var _positioning1 = require("../../Positioning"); -var _popup = require("../../Popup"); -var _styling = require("../../Styling"); -var _reactHooks = require("@fluentui/react-hooks"); -var _dom = require("../../utilities/dom"); -var _a; -var COMPONENT_NAME = 'CalloutContentBase'; -var ANIMATIONS = (_a = {}, _a[(0, _positioning1.RectangleEdge).top] = (0, _styling.AnimationClassNames).slideUpIn10, _a[(0, _positioning1.RectangleEdge).bottom] = (0, _styling.AnimationClassNames).slideDownIn10, _a[(0, _positioning1.RectangleEdge).left] = (0, _styling.AnimationClassNames).slideLeftIn10, _a[(0, _positioning1.RectangleEdge).right] = (0, _styling.AnimationClassNames).slideRightIn10, _a); -var BEAK_ORIGIN_POSITION = { - top: 0, - left: 0 -}; -// Microsoft Edge will overwrite inline styles if there is an animation pertaining to that style. -// To help ensure that edge will respect the offscreen style opacity -// filter needs to be added as an additional way to set opacity. -// Also set pointer-events: none so that the callout will not occlude the element it is -// going to be positioned against -var OFF_SCREEN_STYLE = { + }); + return function() { + return async.dispose(); + }; + }); + return needsVerticalScrollBarState; + } + function defaultFocusRestorer(options2) { + var originalElement = options2.originalElement, containsFocus = options2.containsFocus; + if (originalElement && containsFocus && originalElement !== getWindow()) { + setTimeout(function() { + var _a2; + (_a2 = originalElement.focus) === null || _a2 === void 0 ? void 0 : _a2.call(originalElement); + }, 0); + } + } + function useRestoreFocus(props, root) { + var _a2 = props.onRestoreFocus, onRestoreFocus = _a2 === void 0 ? defaultFocusRestorer : _a2; + var originalFocusedElement = React__namespace.useRef(void 0); + var containsFocus = React__namespace.useRef(false); + React__namespace.useEffect(function() { + originalFocusedElement.current = getDocument().activeElement; + if (doesElementContainFocus(root.current)) { + containsFocus.current = true; + } + return function() { + var _a3; + onRestoreFocus === null || onRestoreFocus === void 0 ? void 0 : onRestoreFocus({ + originalElement: originalFocusedElement.current, + containsFocus: containsFocus.current, + documentContainsFocus: ((_a3 = getDocument()) === null || _a3 === void 0 ? void 0 : _a3.hasFocus()) || false + }); + originalFocusedElement.current = void 0; + }; + }, []); + useOnEvent(root, "focus", React__namespace.useCallback(function() { + containsFocus.current = true; + }, []), true); + useOnEvent(root, "blur", React__namespace.useCallback(function(ev) { + if (root.current && ev.relatedTarget && !root.current.contains(ev.relatedTarget)) { + containsFocus.current = false; + } + }, []), true); + } + function useHideSiblingNodes(props, root) { + var shouldHideSiblings = String(props["aria-modal"]).toLowerCase() === "true" && props.enableAriaHiddenSiblings; + React__namespace.useEffect(function() { + if (!(shouldHideSiblings && root.current)) { + return; + } + var unmodalize2 = modalize(root.current); + return unmodalize2; + }, [root, shouldHideSiblings]); + } + var Popup = React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var props = getPropsWithDefaults({ shouldRestoreFocus: true, enableAriaHiddenSiblings: true }, propsWithoutDefaults); + var root = React__namespace.useRef(void 0); + var mergedRootRef = useMergedRefs(root, forwardedRef); + useHideSiblingNodes(props, root); + useRestoreFocus(props, root); + var role = props.role, className2 = props.className, ariaLabel2 = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, style2 = props.style, children2 = props.children, onDismiss = props.onDismiss; + var needsVerticalScrollBar = useScrollbarAsync(props, root); + var onKeyDown = React__namespace.useCallback(function(ev) { + switch (ev.which) { + case KeyCodes.escape: + if (onDismiss) { + onDismiss(ev); + ev.preventDefault(); + ev.stopPropagation(); + } + break; + } + }, [onDismiss]); + var win = useWindow(); + useOnEvent(win, "keydown", onKeyDown); + return React__namespace.createElement("div", __assign$1({ ref: mergedRootRef }, getNativeProps(props, divProperties), { className: className2, role, "aria-label": ariaLabel2, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onKeyDown, style: __assign$1({ overflowY: needsVerticalScrollBar ? "scroll" : void 0, outline: "none" }, style2) }), children2); + }); + Popup.displayName = "Popup"; + var useDocumentEx = function() { + var _a2; + return (_a2 = useDocument()) !== null && _a2 !== void 0 ? _a2 : typeof document !== "undefined" ? document : void 0; + }; + var useWindowEx = function() { + var _a2; + return (_a2 = useWindow()) !== null && _a2 !== void 0 ? _a2 : typeof window !== "undefined" ? window : void 0; + }; + var getDocumentEx = function(ctx) { + var _a2, _b2; + return (_b2 = (_a2 = ctx === null || ctx === void 0 ? void 0 : ctx.window) === null || _a2 === void 0 ? void 0 : _a2.document) !== null && _b2 !== void 0 ? _b2 : typeof document !== "undefined" ? document : void 0; + }; + var getWindowEx = function(ctx) { + var _a2; + return (_a2 = ctx === null || ctx === void 0 ? void 0 : ctx.window) !== null && _a2 !== void 0 ? _a2 : typeof window !== "undefined" ? window : void 0; + }; + var _a$3; + var COMPONENT_NAME$9 = "CalloutContentBase"; + var ANIMATIONS = (_a$3 = {}, _a$3[RectangleEdge.top] = AnimationClassNames.slideUpIn10, _a$3[RectangleEdge.bottom] = AnimationClassNames.slideDownIn10, _a$3[RectangleEdge.left] = AnimationClassNames.slideLeftIn10, _a$3[RectangleEdge.right] = AnimationClassNames.slideRightIn10, _a$3); + var BEAK_ORIGIN_POSITION = { top: 0, left: 0 }; + var OFF_SCREEN_STYLE = { opacity: 0, - filter: 'opacity(0)', - pointerEvents: 'none' -}; -// role and role description go hand-in-hand. Both would be included by spreading getNativeProps for a basic element -// This constant array can be used to filter these out of native props spread on callout root and apply them together on -// calloutMain (the Popup component within the callout) -var ARIA_ROLE_ATTRIBUTES = [ - 'role', - 'aria-roledescription' -]; -var DEFAULT_PROPS = { + filter: "opacity(0)", + pointerEvents: "none" + }; + var ARIA_ROLE_ATTRIBUTES = ["role", "aria-roledescription"]; + var DEFAULT_PROPS$6 = { preventDismissOnLostFocus: false, preventDismissOnScroll: false, preventDismissOnResize: false, @@ -75466,57103 +43342,43810 @@ var DEFAULT_PROPS = { beakWidth: 16, gapSpace: 0, minPagePadding: 8, - directionalHint: (0, _directionalHint.DirectionalHint).bottomAutoEdge -}; -var getClassNames = (0, _utilities.classNamesFunction)({ + directionalHint: DirectionalHint.bottomAutoEdge + }; + var getClassNames$p = classNamesFunction({ disableCaching: true -}); -/** - * (Hook) to return a function to lazily fetch the bounds of the target element for the callout. - */ function useBounds(_a, targetRef, targetWindow) { - var bounds = _a.bounds, _b = _a.minPagePadding, minPagePadding = _b === void 0 ? DEFAULT_PROPS.minPagePadding : _b, target = _a.target; - var _c = _react.useState(false), targetWindowResized = _c[0], setTargetWindowResized = _c[1]; - var cachedBounds = _react.useRef(); - var getBounds = _react.useCallback(function() { - if (!cachedBounds.current || targetWindowResized) { - var currentBounds = typeof bounds === 'function' ? targetWindow ? bounds(target, targetWindow) : undefined : bounds; - if (!currentBounds && targetWindow) { - currentBounds = (0, _positioning1.getBoundsFromTargetWindow)(targetRef.current, targetWindow); - currentBounds = { - top: currentBounds.top + minPagePadding, - left: currentBounds.left + minPagePadding, - right: currentBounds.right - minPagePadding, - bottom: currentBounds.bottom - minPagePadding, - width: currentBounds.width - minPagePadding * 2, - height: currentBounds.height - minPagePadding * 2 - }; - } - cachedBounds.current = currentBounds; - targetWindowResized && setTargetWindowResized(false); - } - return cachedBounds.current; - }, [ - bounds, - minPagePadding, - target, - targetRef, - targetWindow, - targetWindowResized - ]); - var async = (0, _reactHooks.useAsync)(); - (0, _reactHooks.useOnEvent)(targetWindow, 'resize', async.debounce(function() { - setTargetWindowResized(true); - }, 500, { - leading: true - })); + // disabling caching because stylesProp.position mutates often + }); + function useBounds(_a2, targetRef, targetWindow) { + var bounds2 = _a2.bounds, _b2 = _a2.minPagePadding, minPagePadding = _b2 === void 0 ? DEFAULT_PROPS$6.minPagePadding : _b2, target2 = _a2.target; + var _c2 = React__namespace.useState(false), targetWindowResized = _c2[0], setTargetWindowResized = _c2[1]; + var cachedBounds = React__namespace.useRef(void 0); + var getBounds = React__namespace.useCallback(function() { + if (!cachedBounds.current || targetWindowResized) { + var currentBounds = typeof bounds2 === "function" ? targetWindow ? bounds2(target2, targetWindow) : void 0 : bounds2; + if (!currentBounds && targetWindow) { + currentBounds = getBoundsFromTargetWindow(targetRef.current, targetWindow); + currentBounds = { + top: currentBounds.top + minPagePadding, + left: currentBounds.left + minPagePadding, + right: currentBounds.right - minPagePadding, + bottom: currentBounds.bottom - minPagePadding, + width: currentBounds.width - minPagePadding * 2, + height: currentBounds.height - minPagePadding * 2 + }; + } + cachedBounds.current = currentBounds; + targetWindowResized && setTargetWindowResized(false); + } + return cachedBounds.current; + }, [bounds2, minPagePadding, target2, targetRef, targetWindow, targetWindowResized]); + var async = useAsync(); + useOnEvent(targetWindow, "resize", async.debounce(function() { + setTargetWindowResized(true); + }, 500, { leading: true })); return getBounds; -} -/** - * (Hook) to return the maximum available height for the Callout to render into. - */ function useMaxHeight(_a, getBounds, targetRef, positions) { - var _b; - var calloutMaxHeight = _a.calloutMaxHeight, finalHeight = _a.finalHeight, directionalHint = _a.directionalHint, directionalHintFixed = _a.directionalHintFixed, hidden = _a.hidden, gapSpace = _a.gapSpace, beakWidth = _a.beakWidth, isBeakVisible = _a.isBeakVisible, coverTarget = _a.coverTarget; - var _c = _react.useState(), maxHeight = _c[0], setMaxHeight = _c[1]; - var _d = (_b = positions === null || positions === void 0 ? void 0 : positions.elementPosition) !== null && _b !== void 0 ? _b : {}, top = _d.top, bottom = _d.bottom; - var targetRect = (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) ? (0, _positioning.getRectangleFromTarget)(targetRef.current) : undefined; - _react.useEffect(function() { - var _a; - var bounds = (_a = getBounds()) !== null && _a !== void 0 ? _a : {}; - var topBounds = bounds.top; - var bottomBounds = bounds.bottom; - var calculatedHeight; - // If aligned to top edge of target and not covering target, update bottom bounds to the - // top of the target (accounting for gap space and beak) - if ((positions === null || positions === void 0 ? void 0 : positions.targetEdge) === (0, _positioning1.RectangleEdge).top && (targetRect === null || targetRect === void 0 ? void 0 : targetRect.top) && !coverTarget) bottomBounds = targetRect.top - (0, _positioning.calculateGapSpace)(isBeakVisible, beakWidth, gapSpace); - if (typeof top === 'number' && bottomBounds) calculatedHeight = bottomBounds - top; - else if (typeof bottom === 'number' && typeof topBounds === 'number' && bottomBounds) calculatedHeight = bottomBounds - topBounds - bottom; - if (!calloutMaxHeight && !hidden || calloutMaxHeight && calculatedHeight && calloutMaxHeight > calculatedHeight) setMaxHeight(calculatedHeight); - else if (calloutMaxHeight) setMaxHeight(calloutMaxHeight); - else setMaxHeight(undefined); + } + function useMaxHeight(_a2, getBounds, targetRef, positions2) { + var _b2; + var calloutMaxHeight = _a2.calloutMaxHeight, finalHeight = _a2.finalHeight, directionalHint = _a2.directionalHint, directionalHintFixed = _a2.directionalHintFixed, hidden = _a2.hidden, gapSpace = _a2.gapSpace, beakWidth = _a2.beakWidth, isBeakVisible = _a2.isBeakVisible, coverTarget = _a2.coverTarget; + var _c2 = React__namespace.useState(), maxHeight = _c2[0], setMaxHeight = _c2[1]; + var _d2 = (_b2 = positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition) !== null && _b2 !== void 0 ? _b2 : {}, top = _d2.top, bottom = _d2.bottom; + var targetRect = (targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) ? getRectangleFromTarget(targetRef.current) : void 0; + React__namespace.useEffect(function() { + var _a3; + var bounds2 = (_a3 = getBounds()) !== null && _a3 !== void 0 ? _a3 : {}; + var topBounds = bounds2.top; + var bottomBounds = bounds2.bottom; + var calculatedHeight; + if ((positions2 === null || positions2 === void 0 ? void 0 : positions2.targetEdge) === RectangleEdge.top && (targetRect === null || targetRect === void 0 ? void 0 : targetRect.top) && !coverTarget) { + bottomBounds = targetRect.top - calculateGapSpace(isBeakVisible, beakWidth, gapSpace); + } + if (typeof top === "number" && bottomBounds) { + calculatedHeight = bottomBounds - top; + } else if (typeof bottom === "number" && typeof topBounds === "number" && bottomBounds) { + calculatedHeight = bottomBounds - topBounds - bottom; + } + if (!calloutMaxHeight && !hidden || calloutMaxHeight && calculatedHeight && calloutMaxHeight > calculatedHeight) { + setMaxHeight(calculatedHeight); + } else if (calloutMaxHeight) { + setMaxHeight(calloutMaxHeight); + } else { + setMaxHeight(void 0); + } }, [ - bottom, - calloutMaxHeight, - finalHeight, - directionalHint, - directionalHintFixed, - getBounds, - hidden, - positions, - top, - gapSpace, - beakWidth, - isBeakVisible, - targetRect, - coverTarget + bottom, + calloutMaxHeight, + finalHeight, + directionalHint, + directionalHintFixed, + getBounds, + hidden, + positions2, + top, + gapSpace, + beakWidth, + isBeakVisible, + targetRect, + coverTarget ]); return maxHeight; -} -/** - * (Hook) to find the current position of Callout. If Callout is resized then a new position is calculated. - */ function usePositions(props, hostElement, calloutElement, targetRef, getBounds, popupRef) { - var _a = _react.useState(), positions = _a[0], setPositions = _a[1]; - var positionAttempts = _react.useRef(0); - var previousTarget = _react.useRef(); - var async = (0, _reactHooks.useAsync)(); - var hidden = props.hidden, target = props.target, finalHeight = props.finalHeight, calloutMaxHeight = props.calloutMaxHeight, onPositioned = props.onPositioned, directionalHint = props.directionalHint, hideOverflow = props.hideOverflow, preferScrollResizePositioning = props.preferScrollResizePositioning; - var win = (0, _dom.useWindowEx)(); - var localRef = _react.useRef(); + } + function usePositions(props, hostElement, calloutElement, targetRef, getBounds, popupRef) { + var _a2 = React__namespace.useState(), positions2 = _a2[0], setPositions = _a2[1]; + var positionAttempts = React__namespace.useRef(0); + var previousTarget = React__namespace.useRef(void 0); + var async = useAsync(); + var hidden = props.hidden, target2 = props.target, finalHeight = props.finalHeight, calloutMaxHeight = props.calloutMaxHeight, onPositioned = props.onPositioned, directionalHint = props.directionalHint, hideOverflow = props.hideOverflow, preferScrollResizePositioning = props.preferScrollResizePositioning; + var win = useWindowEx(); + var localRef = React__namespace.useRef(void 0); var popupStyles; if (localRef.current !== popupRef.current) { - localRef.current = popupRef.current; - popupStyles = popupRef.current ? win === null || win === void 0 ? void 0 : win.getComputedStyle(popupRef.current) : undefined; + localRef.current = popupRef.current; + popupStyles = popupRef.current ? win === null || win === void 0 ? void 0 : win.getComputedStyle(popupRef.current) : void 0; } var popupOverflowY = popupStyles === null || popupStyles === void 0 ? void 0 : popupStyles.overflowY; - _react.useEffect(function() { - if (!hidden) { - var timerId_1 = async.requestAnimationFrame(function() { - var _a, _b; - if (hostElement.current && calloutElement) { - var currentProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - target: targetRef.current, - bounds: getBounds() - }); - // duplicate calloutElement & remove useMaxHeight's maxHeight for position calc - var dupeCalloutElement = calloutElement.cloneNode(true); - dupeCalloutElement.style.maxHeight = calloutMaxHeight ? "".concat(calloutMaxHeight) : ''; - dupeCalloutElement.style.visibility = 'hidden'; - (_a = calloutElement.parentElement) === null || _a === void 0 || _a.appendChild(dupeCalloutElement); - var previousPositions = previousTarget.current === target ? positions : undefined; - // only account for scroll resizing if styles allow callout to scroll - // (popup styles determine if callout will scroll) - var isOverflowYHidden = hideOverflow || popupOverflowY === 'clip' || popupOverflowY === 'hidden'; - var shouldScroll = preferScrollResizePositioning && !isOverflowYHidden; - // If there is a finalHeight given then we assume that the user knows and will handle - // additional positioning adjustments so we should call positionCard - var newPositions = finalHeight ? (0, _positioning1.positionCard)(currentProps, hostElement.current, dupeCalloutElement, previousPositions, win) : (0, _positioning1.positionCallout)(currentProps, hostElement.current, dupeCalloutElement, previousPositions, shouldScroll, undefined, win); - // clean up duplicate calloutElement - (_b = calloutElement.parentElement) === null || _b === void 0 || _b.removeChild(dupeCalloutElement); - // Set the new position only when the positions do not exist or one of the new callout positions - // is different. The position should not change if the position is within 2 decimal places. - if (!positions && newPositions || positions && newPositions && !arePositionsEqual(positions, newPositions) && positionAttempts.current < 5) { - // We should not reposition the callout more than a few times, if it is then the content is likely resizing - // and we should stop trying to reposition to prevent a stack overflow. - positionAttempts.current++; - setPositions(newPositions); - } else if (positionAttempts.current > 0) { - // Only call the onPositioned callback if the callout has been re-positioned at least once. - positionAttempts.current = 0; - onPositioned === null || onPositioned === void 0 || onPositioned(positions); - } - } - }, calloutElement); - previousTarget.current = target; - return function() { - async.cancelAnimationFrame(timerId_1); - previousTarget.current = undefined; - }; - } else { - // When the callout is hidden, clear position state so that it is not accidentally used next render. - setPositions(undefined); - positionAttempts.current = 0; - } - }, [ - hidden, - directionalHint, - async, - calloutElement, - calloutMaxHeight, - hostElement, - targetRef, - finalHeight, - getBounds, - onPositioned, - positions, - props, - target, - hideOverflow, - preferScrollResizePositioning, - popupOverflowY, - win - ]); - return positions; -} -/** - * (Hook) to set up behavior to automatically focus the callout when it appears, if indicated by props. - */ function useAutoFocus(_a, positions, calloutElement) { - var hidden = _a.hidden, setInitialFocus = _a.setInitialFocus; - var async = (0, _reactHooks.useAsync)(); - var hasPositions = !!positions; - _react.useEffect(function() { - if (!hidden && setInitialFocus && hasPositions && calloutElement) { - var timerId_2 = async.requestAnimationFrame(function() { - return (0, _utilities.focusFirstChild)(calloutElement); - }, calloutElement); - return function() { - return async.cancelAnimationFrame(timerId_2); - }; - } + React__namespace.useEffect(function() { + if (!hidden) { + var timerId_1 = async.requestAnimationFrame(function() { + var _a3, _b2; + if (hostElement.current && calloutElement) { + var currentProps = __assign$1(__assign$1({}, props), { target: targetRef.current, bounds: getBounds() }); + var dupeCalloutElement = calloutElement.cloneNode(true); + dupeCalloutElement.style.maxHeight = calloutMaxHeight ? "".concat(calloutMaxHeight) : ""; + dupeCalloutElement.style.visibility = "hidden"; + (_a3 = calloutElement.parentElement) === null || _a3 === void 0 ? void 0 : _a3.appendChild(dupeCalloutElement); + var previousPositions = previousTarget.current === target2 ? positions2 : void 0; + var isOverflowYHidden = hideOverflow || popupOverflowY === "clip" || popupOverflowY === "hidden"; + var shouldScroll = preferScrollResizePositioning && !isOverflowYHidden; + var newPositions = finalHeight ? positionCard(currentProps, hostElement.current, dupeCalloutElement, previousPositions, win) : positionCallout(currentProps, hostElement.current, dupeCalloutElement, previousPositions, shouldScroll, void 0, win); + (_b2 = calloutElement.parentElement) === null || _b2 === void 0 ? void 0 : _b2.removeChild(dupeCalloutElement); + if (!positions2 && newPositions || positions2 && newPositions && !arePositionsEqual(positions2, newPositions) && positionAttempts.current < 5) { + positionAttempts.current++; + setPositions(newPositions); + } else if (positionAttempts.current > 0) { + positionAttempts.current = 0; + onPositioned === null || onPositioned === void 0 ? void 0 : onPositioned(positions2); + } + } + }, calloutElement); + previousTarget.current = target2; + return function() { + async.cancelAnimationFrame(timerId_1); + previousTarget.current = void 0; + }; + } else { + setPositions(void 0); + positionAttempts.current = 0; + } }, [ - hidden, - hasPositions, - async, - calloutElement, - setInitialFocus + hidden, + directionalHint, + async, + calloutElement, + calloutMaxHeight, + hostElement, + targetRef, + finalHeight, + getBounds, + onPositioned, + positions2, + props, + target2, + hideOverflow, + preferScrollResizePositioning, + popupOverflowY, + win ]); -} -/** - * (Hook) to set up various handlers to dismiss the popup when it loses focus or the window scrolls or similar cases. - */ function useDismissHandlers(_a, positions, hostElement, targetRef, targetWindow) { - var hidden = _a.hidden, onDismiss = _a.onDismiss, // eslint-disable-next-line deprecation/deprecation - preventDismissOnScroll = _a.preventDismissOnScroll, // eslint-disable-next-line deprecation/deprecation - preventDismissOnResize = _a.preventDismissOnResize, // eslint-disable-next-line deprecation/deprecation - preventDismissOnLostFocus = _a.preventDismissOnLostFocus, dismissOnTargetClick = _a.dismissOnTargetClick, shouldDismissOnWindowFocus = _a.shouldDismissOnWindowFocus, preventDismissOnEvent = _a.preventDismissOnEvent; - var isMouseDownOnPopup = _react.useRef(false); - var async = (0, _reactHooks.useAsync)(); - var mouseDownHandlers = (0, _reactHooks.useConst)([ - function() { - isMouseDownOnPopup.current = true; - }, - function() { - isMouseDownOnPopup.current = false; - } - ]); - var positionsExists = !!positions; - _react.useEffect(function() { - var dismissOnScroll = function(ev) { - if (positionsExists && !preventDismissOnScroll) dismissOnClickOrScroll(ev); - }; - var dismissOnResize = function(ev) { - if (!preventDismissOnResize && !(preventDismissOnEvent && preventDismissOnEvent(ev))) onDismiss === null || onDismiss === void 0 || onDismiss(ev); - }; - var dismissOnLostFocus = function(ev) { - if (!preventDismissOnLostFocus) dismissOnClickOrScroll(ev); - }; - var dismissOnClickOrScroll = function(ev) { - var eventPaths = ev.composedPath ? ev.composedPath() : []; - var target = eventPaths.length > 0 ? eventPaths[0] : ev.target; - var isEventTargetOutsideCallout = hostElement.current && !(0, _utilities.elementContains)(hostElement.current, target); - // If mouse is pressed down on callout but moved outside then released, don't dismiss the callout. - if (isEventTargetOutsideCallout && isMouseDownOnPopup.current) { - isMouseDownOnPopup.current = false; - return; - } - if (!targetRef.current && isEventTargetOutsideCallout || ev.target !== targetWindow && isEventTargetOutsideCallout && (!targetRef.current || 'stopPropagation' in targetRef.current || dismissOnTargetClick || target !== targetRef.current && !(0, _utilities.elementContains)(targetRef.current, target))) { - if (preventDismissOnEvent && preventDismissOnEvent(ev)) return; - onDismiss === null || onDismiss === void 0 || onDismiss(ev); - } - }; - var dismissOnTargetWindowBlur = function(ev) { - // Do nothing - if (!shouldDismissOnWindowFocus) return; - if ((preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnLostFocus) && !(targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.hasFocus()) && ev.relatedTarget === null) onDismiss === null || onDismiss === void 0 || onDismiss(ev); - }; - // This is added so the callout will dismiss when the window is scrolled - // but not when something inside the callout is scrolled. The delay seems - // to be required to avoid React firing an async focus event in IE from - // the target changing focus quickly prior to rendering the callout. - var disposablesPromise = new Promise(function(resolve) { - async.setTimeout(function() { - if (!hidden && targetWindow) { - var disposables_1 = [ - (0, _utilities.on)(targetWindow, 'scroll', dismissOnScroll, true), - (0, _utilities.on)(targetWindow, 'resize', dismissOnResize, true), - (0, _utilities.on)(targetWindow.document.documentElement, 'focus', dismissOnLostFocus, true), - (0, _utilities.on)(targetWindow.document.documentElement, 'click', dismissOnLostFocus, true), - (0, _utilities.on)(targetWindow, 'blur', dismissOnTargetWindowBlur, true) - ]; - resolve(function() { - disposables_1.forEach(function(dispose) { - return dispose(); - }); - }); - } - }, 0); - }); + return positions2; + } + function useAutoFocus(_a2, positions2, calloutElement) { + var hidden = _a2.hidden, setInitialFocus = _a2.setInitialFocus; + var async = useAsync(); + var hasPositions = !!positions2; + React__namespace.useEffect(function() { + if (!hidden && setInitialFocus && hasPositions && calloutElement) { + var timerId_2 = async.requestAnimationFrame(function() { + return focusFirstChild(calloutElement); + }, calloutElement); return function() { - disposablesPromise.then(function(dispose) { + return async.cancelAnimationFrame(timerId_2); + }; + } + }, [hidden, hasPositions, async, calloutElement, setInitialFocus]); + } + function useDismissHandlers(_a2, positions2, hostElement, targetRef, targetWindow) { + var hidden = _a2.hidden, onDismiss = _a2.onDismiss, preventDismissOnScroll = _a2.preventDismissOnScroll, preventDismissOnResize = _a2.preventDismissOnResize, preventDismissOnLostFocus = _a2.preventDismissOnLostFocus, dismissOnTargetClick = _a2.dismissOnTargetClick, shouldDismissOnWindowFocus = _a2.shouldDismissOnWindowFocus, preventDismissOnEvent = _a2.preventDismissOnEvent; + var isMouseDownOnPopup = React__namespace.useRef(false); + var async = useAsync(); + var mouseDownHandlers = useConst([ + function() { + isMouseDownOnPopup.current = true; + }, + function() { + isMouseDownOnPopup.current = false; + } + ]); + var positionsExists = !!positions2; + React__namespace.useEffect(function() { + var dismissOnScroll = function(ev) { + if (positionsExists && !preventDismissOnScroll) { + dismissOnClickOrScroll(ev); + } + }; + var dismissOnResize = function(ev) { + if (!preventDismissOnResize && !(preventDismissOnEvent && preventDismissOnEvent(ev))) { + onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(ev); + } + }; + var dismissOnLostFocus = function(ev) { + if (!preventDismissOnLostFocus) { + dismissOnClickOrScroll(ev); + } + }; + var dismissOnClickOrScroll = function(ev) { + var eventPaths = ev.composedPath ? ev.composedPath() : []; + var target2 = eventPaths.length > 0 ? eventPaths[0] : ev.target; + var isEventTargetOutsideCallout = hostElement.current && !elementContains(hostElement.current, target2); + if (isEventTargetOutsideCallout && isMouseDownOnPopup.current) { + isMouseDownOnPopup.current = false; + return; + } + if (!targetRef.current && isEventTargetOutsideCallout || ev.target !== targetWindow && isEventTargetOutsideCallout && (!targetRef.current || "stopPropagation" in targetRef.current || dismissOnTargetClick || target2 !== targetRef.current && !elementContains(targetRef.current, target2))) { + if (preventDismissOnEvent && preventDismissOnEvent(ev)) { + return; + } + onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(ev); + } + }; + var dismissOnTargetWindowBlur = function(ev) { + if (!shouldDismissOnWindowFocus) { + return; + } + if ((preventDismissOnEvent && !preventDismissOnEvent(ev) || !preventDismissOnEvent && !preventDismissOnLostFocus) && !(targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.hasFocus()) && ev.relatedTarget === null) { + onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss(ev); + } + }; + var disposablesPromise = new Promise(function(resolve2) { + async.setTimeout(function() { + if (!hidden && targetWindow) { + var disposables_1 = [ + on$1(targetWindow, "scroll", dismissOnScroll, true), + on$1(targetWindow, "resize", dismissOnResize, true), + on$1(targetWindow.document.documentElement, "focus", dismissOnLostFocus, true), + on$1(targetWindow.document.documentElement, "click", dismissOnLostFocus, true), + on$1(targetWindow, "blur", dismissOnTargetWindowBlur, true) + ]; + resolve2(function() { + disposables_1.forEach(function(dispose) { return dispose(); + }); }); - }; + } + }, 0); + }); + return function() { + disposablesPromise.then(function(dispose) { + return dispose(); + }); + }; }, [ - hidden, - async, - hostElement, - targetRef, - targetWindow, - onDismiss, - shouldDismissOnWindowFocus, - dismissOnTargetClick, - preventDismissOnLostFocus, - preventDismissOnResize, - preventDismissOnScroll, - positionsExists, - preventDismissOnEvent + hidden, + async, + hostElement, + targetRef, + targetWindow, + onDismiss, + shouldDismissOnWindowFocus, + dismissOnTargetClick, + preventDismissOnLostFocus, + preventDismissOnResize, + preventDismissOnScroll, + positionsExists, + preventDismissOnEvent ]); return mouseDownHandlers; -} -var CalloutContentBase = _react.memo(_react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var props = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var styles = props.styles, style = props.style, ariaLabel = props.ariaLabel, ariaDescribedBy = props.ariaDescribedBy, ariaLabelledBy = props.ariaLabelledBy, className = props.className, isBeakVisible = props.isBeakVisible, children = props.children, beakWidth = props.beakWidth, calloutWidth = props.calloutWidth, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer, finalHeight = props.finalHeight, _a = props.hideOverflow, hideOverflow = _a === void 0 ? !!finalHeight : _a, backgroundColor = props.backgroundColor, calloutMaxHeight = props.calloutMaxHeight, onScroll = props.onScroll, // eslint-disable-next-line deprecation/deprecation - _b = props.shouldRestoreFocus, // eslint-disable-next-line deprecation/deprecation - shouldRestoreFocus = _b === void 0 ? true : _b, target = props.target, hidden = props.hidden, onLayerMounted = props.onLayerMounted, popupProps = props.popupProps; - var hostElement = _react.useRef(null); - var popupRef = _react.useRef(null); - var mergedPopupRefs = (0, _reactHooks.useMergedRefs)(popupRef, popupProps === null || popupProps === void 0 ? void 0 : popupProps.ref); - var _c = _react.useState(null), calloutElement = _c[0], setCalloutElement = _c[1]; - var calloutCallback = _react.useCallback(function(calloutEl) { - setCalloutElement(calloutEl); + } + var CalloutContentBase = React__namespace.memo(React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var props = getPropsWithDefaults(DEFAULT_PROPS$6, propsWithoutDefaults); + var styles = props.styles, style2 = props.style, ariaLabel2 = props.ariaLabel, ariaDescribedBy = props.ariaDescribedBy, ariaLabelledBy = props.ariaLabelledBy, className2 = props.className, isBeakVisible = props.isBeakVisible, children2 = props.children, beakWidth = props.beakWidth, calloutWidth = props.calloutWidth, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer, finalHeight = props.finalHeight, _a2 = props.hideOverflow, hideOverflow = _a2 === void 0 ? !!finalHeight : _a2, backgroundColor = props.backgroundColor, calloutMaxHeight = props.calloutMaxHeight, onScroll = props.onScroll, _b2 = props.shouldRestoreFocus, shouldRestoreFocus = _b2 === void 0 ? true : _b2, target2 = props.target, hidden = props.hidden, onLayerMounted = props.onLayerMounted, popupProps = props.popupProps; + var hostElement = React__namespace.useRef(null); + var popupRef = React__namespace.useRef(null); + var mergedPopupRefs = useMergedRefs(popupRef, popupProps === null || popupProps === void 0 ? void 0 : popupProps.ref); + var _c2 = React__namespace.useState(null), calloutElement = _c2[0], setCalloutElement = _c2[1]; + var calloutCallback = React__namespace.useCallback(function(calloutEl) { + setCalloutElement(calloutEl); + }, []); + var rootRef = useMergedRefs(hostElement, forwardedRef); + var _d2 = useTarget(props.target, { + current: calloutElement + }), targetRef = _d2[0], targetWindow = _d2[1]; + var getBounds = useBounds(props, targetRef, targetWindow); + var positions2 = usePositions(props, hostElement, calloutElement, targetRef, getBounds, mergedPopupRefs); + var maxHeight = useMaxHeight(props, getBounds, targetRef, positions2); + var _e2 = useDismissHandlers(props, positions2, hostElement, targetRef, targetWindow), mouseDownOnPopup = _e2[0], mouseUpOnPopup = _e2[1]; + var isForcedInBounds = (positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition.top) && (positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition.bottom); + var cssPositions = __assign$1(__assign$1({}, positions2 === null || positions2 === void 0 ? void 0 : positions2.elementPosition), { maxHeight }); + if (isForcedInBounds) { + cssPositions.bottom = void 0; + } + useAutoFocus(props, positions2, calloutElement); + React__namespace.useEffect(function() { + if (!hidden) { + onLayerMounted === null || onLayerMounted === void 0 ? void 0 : onLayerMounted(); + } + }, [hidden]); + if (!targetWindow) { + return null; + } + var overflowYHidden = hideOverflow; + var beakVisible = isBeakVisible && !!target2; + var classNames2 = getClassNames$p(styles, { + theme: props.theme, + className: className2, + overflowYHidden, + calloutWidth, + positions: positions2, + beakWidth, + backgroundColor, + calloutMaxWidth, + calloutMinWidth, + doNotLayer + }); + var overflowStyle = __assign$1(__assign$1({ maxHeight: calloutMaxHeight ? calloutMaxHeight : "100%" }, style2), overflowYHidden && { overflowY: "hidden" }); + var visibilityStyle = props.hidden ? { visibility: "hidden" } : void 0; + return React__namespace.createElement( + "div", + { ref: rootRef, className: classNames2.container, style: visibilityStyle }, + React__namespace.createElement( + "div", + __assign$1({}, getNativeProps(props, divProperties, ARIA_ROLE_ATTRIBUTES), { + className: css(classNames2.root, positions2 && positions2.targetEdge && ANIMATIONS[positions2.targetEdge]), + style: positions2 ? __assign$1({}, cssPositions) : OFF_SCREEN_STYLE, + // Safari and Firefox on Mac OS requires this to back-stop click events so focus remains in the Callout. + // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus + tabIndex: -1, + ref: calloutCallback + }), + beakVisible && React__namespace.createElement("div", { className: classNames2.beak, style: getBeakPosition(positions2) }), + beakVisible && React__namespace.createElement("div", { className: classNames2.beakCurtain }), + React__namespace.createElement( + Popup, + __assign$1({ + // don't use getNativeElementProps for role and roledescription because it will also + // pass through data-* props (resulting in them being used in two places) + role: props.role, + "aria-roledescription": props["aria-roledescription"], + ariaDescribedBy, + ariaLabel: ariaLabel2, + ariaLabelledBy, + className: classNames2.calloutMain, + onDismiss: props.onDismiss, + onMouseDown: mouseDownOnPopup, + onMouseUp: mouseUpOnPopup, + onRestoreFocus: props.onRestoreFocus, + onScroll, + // eslint-disable-next-line @typescript-eslint/no-deprecated + shouldRestoreFocus, + style: overflowStyle + }, popupProps, { ref: mergedPopupRefs }), + children2 + ) + ) + ); + }), function(previousProps, nextProps) { + if (!nextProps.shouldUpdateWhenHidden && previousProps.hidden && nextProps.hidden) { + return true; + } + return shallowCompare(previousProps, nextProps); + }); + function getBeakPosition(positions2) { + var _a2, _b2; + var beakPositionStyle = __assign$1(__assign$1({}, (_a2 = positions2 === null || positions2 === void 0 ? void 0 : positions2.beakPosition) === null || _a2 === void 0 ? void 0 : _a2.elementPosition), { display: ((_b2 = positions2 === null || positions2 === void 0 ? void 0 : positions2.beakPosition) === null || _b2 === void 0 ? void 0 : _b2.hideBeak) ? "none" : void 0 }); + if (!beakPositionStyle.top && !beakPositionStyle.bottom && !beakPositionStyle.left && !beakPositionStyle.right) { + beakPositionStyle.left = BEAK_ORIGIN_POSITION.left; + beakPositionStyle.top = BEAK_ORIGIN_POSITION.top; + } + return beakPositionStyle; + } + function arePositionsEqual(prevElementPositions, newElementPosition) { + return comparePositions(prevElementPositions.elementPosition, newElementPosition.elementPosition) && comparePositions(prevElementPositions.beakPosition.elementPosition, newElementPosition.beakPosition.elementPosition); + } + function comparePositions(prevElementPositions, newElementPositions) { + for (var key2 in newElementPositions) { + if (newElementPositions.hasOwnProperty(key2)) { + var oldPositionEdge = prevElementPositions[key2]; + var newPositionEdge = newElementPositions[key2]; + if (oldPositionEdge !== void 0 && newPositionEdge !== void 0) { + if (oldPositionEdge.toFixed(2) !== newPositionEdge.toFixed(2)) { + return false; + } + } else { + return false; + } + } + } + return true; + } + CalloutContentBase.displayName = COMPONENT_NAME$9; + function getBeakStyle(beakWidth) { + return { + height: beakWidth, + width: beakWidth + }; + } + var GlobalClassNames$g = { + container: "ms-Callout-container", + root: "ms-Callout", + beak: "ms-Callout-beak", + beakCurtain: "ms-Callout-beakCurtain", + calloutMain: "ms-Callout-main" + }; + var getStyles$u = function(props) { + var _a2; + var theme = props.theme, className2 = props.className, overflowYHidden = props.overflowYHidden, calloutWidth = props.calloutWidth, beakWidth = props.beakWidth, backgroundColor = props.backgroundColor, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer; + var classNames2 = getGlobalClassNames(GlobalClassNames$g, theme); + var semanticColors = theme.semanticColors, effects = theme.effects; + return { + container: [ + classNames2.container, + { + position: "relative" + } + ], + root: [ + classNames2.root, + theme.fonts.medium, + { + position: "absolute", + display: "flex", + zIndex: doNotLayer ? ZIndexes.Layer : void 0, + boxSizing: "border-box", + borderRadius: effects.roundedCorner2, + boxShadow: effects.elevation16, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + borderWidth: 1, + borderStyle: "solid", + borderColor: "WindowText" + }, _a2) + }, + focusClear(), + className2, + !!calloutWidth && { width: calloutWidth }, + !!calloutMaxWidth && { maxWidth: calloutMaxWidth }, + !!calloutMinWidth && { minWidth: calloutMinWidth } + ], + beak: [ + classNames2.beak, + { + position: "absolute", + backgroundColor: semanticColors.menuBackground, + boxShadow: "inherit", + border: "inherit", + boxSizing: "border-box", + transform: "rotate(45deg)" + }, + getBeakStyle(beakWidth), + backgroundColor && { + backgroundColor + } + ], + beakCurtain: [ + classNames2.beakCurtain, + { + position: "absolute", + top: 0, + right: 0, + bottom: 0, + left: 0, + backgroundColor: semanticColors.menuBackground, + borderRadius: effects.roundedCorner2 + } + ], + calloutMain: [ + classNames2.calloutMain, + { + backgroundColor: semanticColors.menuBackground, + overflowX: "hidden", + overflowY: "auto", + position: "relative", + width: "100%", + borderRadius: effects.roundedCorner2 + }, + overflowYHidden && { + overflowY: "hidden" + }, + backgroundColor && { + backgroundColor + } + ] + }; + }; + var CalloutContent = styled(CalloutContentBase, getStyles$u, void 0, { + scope: "CalloutContent" + }); + var PortalCompatContext = React__namespace.createContext(void 0); + var portalCompatContextDefaultValue = function() { + return function() { + return void 0; + }; + }; + PortalCompatContext.Provider; + function usePortalCompat() { + var _React_useContext; + return (_React_useContext = React__namespace.useContext(PortalCompatContext)) !== null && _React_useContext !== void 0 ? _React_useContext : portalCompatContextDefaultValue; + } + var getClassNames$o = classNamesFunction(); + var getFabricTheme = memoizeFunction(function(theme, isRTL) { + return createTheme(__assign$1(__assign$1({}, theme), { rtl: isRTL })); + }); + var getDir = function(_a2) { + var theme = _a2.theme, dir = _a2.dir; + var contextDir = getRTL(theme) ? "rtl" : "ltr"; + var pageDir = getRTL() ? "rtl" : "ltr"; + var componentDir = dir ? dir : contextDir; + return { + // If Fabric dir !== contextDir + // Or If contextDir !== pageDir + // Then we need to set dir of the Fabric root + rootDir: componentDir !== contextDir || componentDir !== pageDir ? componentDir : dir, + // If dir !== contextDir || pageDir + // then set contextual theme around content + needsTheme: componentDir !== contextDir + }; + }; + var FabricBase = React__namespace.forwardRef(function(props, ref2) { + var className2 = props.className, theme = props.theme, applyTheme = props.applyTheme, applyThemeToBody = props.applyThemeToBody, styles = props.styles; + var classNames2 = getClassNames$o(styles, { + theme, + applyTheme, + className: className2 + }); + var rootElement = React__namespace.useRef(null); + useApplyThemeToBody(applyThemeToBody, classNames2, rootElement); + return React__namespace.createElement(React__namespace.Fragment, null, useRenderedContent(props, classNames2, rootElement, ref2)); + }); + FabricBase.displayName = "FabricBase"; + function useRenderedContent(props, _a2, rootElement, ref2) { + var root = _a2.root; + var _b2 = props.as, Root = _b2 === void 0 ? "div" : _b2, dir = props.dir, theme = props.theme; + var divProps = getNativeProps(props, divProperties, ["dir"]); + var _c2 = getDir(props), rootDir = _c2.rootDir, needsTheme = _c2.needsTheme; + var renderedContent = React__namespace.createElement( + FocusRectsProvider, + { providerRef: rootElement }, + React__namespace.createElement(Root, __assign$1({ dir: rootDir }, divProps, { className: root, ref: useMergedRefs(rootElement, ref2) })) + ); + if (needsTheme) { + renderedContent = // eslint-disable-next-line @typescript-eslint/no-deprecated + React__namespace.createElement(Customizer, { settings: { theme: getFabricTheme(theme, dir === "rtl") } }, renderedContent); + } + return renderedContent; + } + function useApplyThemeToBody(applyThemeToBody, _a2, rootElement) { + var bodyThemed = _a2.bodyThemed; + React__namespace.useEffect(function() { + if (applyThemeToBody) { + var currentDoc_1 = getDocument(rootElement.current); + if (currentDoc_1) { + currentDoc_1.body.classList.add(bodyThemed); + return function() { + currentDoc_1.body.classList.remove(bodyThemed); + }; + } + } + }, [bodyThemed, applyThemeToBody, rootElement]); + return rootElement; + } + var inheritFont = { fontFamily: "inherit" }; + var GlobalClassNames$f = { + root: "ms-Fabric", + bodyThemed: "ms-Fabric-bodyThemed" + }; + var getStyles$t = function(props) { + var applyTheme = props.applyTheme, className2 = props.className, preventBlanketFontInheritance = props.preventBlanketFontInheritance, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$f, theme); + return { + root: [ + classNames2.root, + theme.fonts.medium, + { + color: theme.palette.neutralPrimary + }, + !preventBlanketFontInheritance && { + "& button": inheritFont, + "& input": inheritFont, + "& textarea": inheritFont + }, + // apply theme to only if applyTheme is true + applyTheme && { + color: theme.semanticColors.bodyText, + backgroundColor: theme.semanticColors.bodyBackground + }, + className2 + ], + bodyThemed: [ + { + backgroundColor: theme.semanticColors.bodyBackground + } + ] + }; + }; + var Fabric = styled(FabricBase, getStyles$t, void 0, { + scope: "Fabric" + }); + var _layersByHostId = {}; + var _layerHostsById = {}; + var defaultHostId = "fluent-default-layer-host"; + var _defaultHostSelector = "#".concat(defaultHostId); + function registerLayer(hostId, callback) { + if (!_layersByHostId[hostId]) { + _layersByHostId[hostId] = []; + } + _layersByHostId[hostId].push(callback); + var layerHosts = _layerHostsById[hostId]; + if (layerHosts) { + for (var _i = 0, layerHosts_1 = layerHosts; _i < layerHosts_1.length; _i++) { + var layerHost = layerHosts_1[_i]; + layerHost.notifyLayersChanged(); + } + } + } + function unregisterLayer(hostId, callback) { + var layers = _layersByHostId[hostId]; + if (layers) { + var idx = layers.indexOf(callback); + if (idx >= 0) { + layers.splice(idx, 1); + if (layers.length === 0) { + delete _layersByHostId[hostId]; + } + } + } + var layerHosts = _layerHostsById[hostId]; + if (layerHosts) { + for (var _i = 0, layerHosts_2 = layerHosts; _i < layerHosts_2.length; _i++) { + var layerHost = layerHosts_2[_i]; + layerHost.notifyLayersChanged(); + } + } + } + function getLayerHost(hostId) { + var layerHosts = _layerHostsById[hostId]; + return layerHosts && layerHosts[0] || void 0; + } + function createDefaultLayerHost(doc, shadowRoot) { + if (shadowRoot === void 0) { + shadowRoot = null; + } + var host = doc.createElement("div"); + host.setAttribute("id", defaultHostId); + host.style.cssText = "position:fixed;z-index:1000000"; + if (shadowRoot) { + shadowRoot.appendChild(host); + } else { + doc === null || doc === void 0 ? void 0 : doc.body.appendChild(host); + } + return host; + } + function getDefaultTarget() { + return _defaultHostSelector; + } + var getClassNames$n = classNamesFunction(); + var getFocusVisibility = function(providerRef) { + if (providerRef === null || providerRef === void 0 ? void 0 : providerRef.current) { + return providerRef.current.classList.contains(IsFocusVisibleClassName); + } + return false; + }; + var LayerBase = React__namespace.forwardRef(function(props, ref2) { + var registerPortalEl = usePortalCompat(); + var rootRef = React__namespace.useRef(null); + var mergedRef = useMergedRefs(rootRef, ref2); + var layerRef = React__namespace.useRef(void 0); + var fabricElementRef = React__namespace.useRef(null); + var focusContext = React__namespace.useContext(FocusRectsContext); + var _a2 = React__namespace.useState(false), needRaiseLayerMount = _a2[0], setNeedRaiseLayerMount = _a2[1]; + var focusRectsRef = React__namespace.useCallback(function(el) { + var isFocusVisible = getFocusVisibility(focusContext === null || focusContext === void 0 ? void 0 : focusContext.providerRef); + if (el && isFocusVisible) { + el.classList.add(IsFocusVisibleClassName); + } + }, [focusContext]); + var children2 = props.children, className2 = props.className, eventBubblingEnabled = props.eventBubblingEnabled, fabricProps = props.fabricProps, hostId = props.hostId, insertFirst = props.insertFirst, _b2 = props.onLayerDidMount, onLayerDidMount = _b2 === void 0 ? function() { + return void 0; + } : _b2, _c2 = props.onLayerMounted, onLayerMounted = _c2 === void 0 ? function() { + return void 0; + } : _c2, onLayerWillUnmount = props.onLayerWillUnmount, styles = props.styles, theme = props.theme; + var fabricRef = useMergedRefs(fabricElementRef, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.ref, focusRectsRef); + var classNames2 = getClassNames$n(styles, { + theme, + className: className2, + isNotHost: !hostId + }); + var getHost = function(doc, shadowRoot) { + var _a22, _b22; + if (shadowRoot === void 0) { + shadowRoot = null; + } + var root = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : doc; + if (hostId) { + var layerHost = getLayerHost(hostId); + if (layerHost) { + return (_a22 = layerHost.rootRef.current) !== null && _a22 !== void 0 ? _a22 : null; + } + return (_b22 = root.getElementById(hostId)) !== null && _b22 !== void 0 ? _b22 : null; + } else { + var defaultHostSelector = getDefaultTarget(); + var host = defaultHostSelector ? root.querySelector(defaultHostSelector) : null; + if (!host) { + host = createDefaultLayerHost(doc, shadowRoot); + } + return host; + } + }; + var removeLayerElement = function() { + onLayerWillUnmount === null || onLayerWillUnmount === void 0 ? void 0 : onLayerWillUnmount(); + var elem = layerRef.current; + layerRef.current = void 0; + if (elem && elem.parentNode) { + elem.parentNode.removeChild(elem); + } + }; + var createLayerElement = function() { + var _a22, _b22, _c22, _d2; + var doc = getDocument(rootRef.current); + var shadowRoot = ((_b22 = (_a22 = rootRef.current) === null || _a22 === void 0 ? void 0 : _a22.getRootNode()) === null || _b22 === void 0 ? void 0 : _b22.host) ? (_c22 = rootRef === null || rootRef === void 0 ? void 0 : rootRef.current) === null || _c22 === void 0 ? void 0 : _c22.getRootNode() : void 0; + if (!doc || !doc && !shadowRoot) { + return; + } + var host = getHost(doc, shadowRoot); + if (!host) { + return; + } + if (!host.__tabsterElementFlags) { + host.__tabsterElementFlags = {}; + } + host.__tabsterElementFlags.noDirectAriaHidden = true; + removeLayerElement(); + var el = ((_d2 = host.ownerDocument) !== null && _d2 !== void 0 ? _d2 : doc).createElement("div"); + el.className = classNames2.root; + setPortalAttribute(el); + setVirtualParent(el, rootRef.current); + insertFirst ? host.insertBefore(el, host.firstChild) : host.appendChild(el); + layerRef.current = el; + setNeedRaiseLayerMount(true); + }; + useIsomorphicLayoutEffect(function() { + createLayerElement(); + if (hostId) { + registerLayer(hostId, createLayerElement); + } + var unregisterPortalEl = layerRef.current ? registerPortalEl(layerRef.current) : void 0; + return function() { + if (unregisterPortalEl) { + unregisterPortalEl(); + } + removeLayerElement(); + if (hostId) { + unregisterLayer(hostId, createLayerElement); + } + }; + }, [hostId]); + React__namespace.useEffect(function() { + if (layerRef.current && needRaiseLayerMount) { + onLayerMounted === null || onLayerMounted === void 0 ? void 0 : onLayerMounted(); + onLayerDidMount === null || onLayerDidMount === void 0 ? void 0 : onLayerDidMount(); + setNeedRaiseLayerMount(false); + } + }, [needRaiseLayerMount, onLayerMounted, onLayerDidMount]); + return React__namespace.createElement("span", { className: "ms-layer", ref: mergedRef }, layerRef.current && ReactDOM__namespace.createPortal(React__namespace.createElement( + FocusRectsProvider, + { layerRoot: true, providerRef: fabricRef }, + React__namespace.createElement(Fabric, __assign$1({}, !eventBubblingEnabled && getFilteredEvents(), fabricProps, { className: css(classNames2.content, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.className), ref: fabricRef }), children2) + ), layerRef.current)); + }); + LayerBase.displayName = "LayerBase"; + var filteredEventProps; + var onFilterEvent = function(ev) { + if (ev.eventPhase === Event.BUBBLING_PHASE && ev.type !== "mouseenter" && ev.type !== "mouseleave" && ev.type !== "touchstart" && ev.type !== "touchend") { + ev.stopPropagation(); + } + }; + function getFilteredEvents() { + if (!filteredEventProps) { + filteredEventProps = {}; + [ + "onClick", + "onContextMenu", + "onDoubleClick", + "onDrag", + "onDragEnd", + "onDragEnter", + "onDragExit", + "onDragLeave", + "onDragOver", + "onDragStart", + "onDrop", + "onMouseDown", + "onMouseEnter", + "onMouseLeave", + "onMouseMove", + "onMouseOver", + "onMouseOut", + "onMouseUp", + "onTouchMove", + "onTouchStart", + "onTouchCancel", + "onTouchEnd", + "onKeyDown", + "onKeyPress", + "onKeyUp", + "onFocus", + "onBlur", + "onChange", + "onInput", + "onInvalid", + "onSubmit" + ].forEach(function(name) { + return filteredEventProps[name] = onFilterEvent; + }); + } + return filteredEventProps; + } + var GlobalClassNames$e = { + root: "ms-Layer", + rootNoHost: "ms-Layer--fixed", + content: "ms-Layer-content" + }; + var getStyles$s = function(props) { + var className2 = props.className, isNotHost = props.isNotHost, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$e, theme); + return { + root: [ + classNames2.root, + theme.fonts.medium, + isNotHost && [ + classNames2.rootNoHost, + { + position: "fixed", + zIndex: ZIndexes.Layer, + top: 0, + left: 0, + bottom: 0, + right: 0, + visibility: "hidden" + } + ], + className2 + ], + content: [ + classNames2.content, + { + visibility: "visible" + } + ] + }; + }; + var Layer = styled(LayerBase, getStyles$s, void 0, { + scope: "Layer", + fields: ["hostId", "theme", "styles"] + }); + var Callout = React__namespace.forwardRef(function(_a2, forwardedRef) { + var layerProps = _a2.layerProps, doNotLayer = _a2.doNotLayer, rest = __rest(_a2, ["layerProps", "doNotLayer"]); + var content2 = React__namespace.createElement(CalloutContent, __assign$1({}, rest, { doNotLayer, ref: forwardedRef })); + return doNotLayer ? content2 : React__namespace.createElement(Layer, __assign$1({}, layerProps), content2); + }); + Callout.displayName = "Callout"; + var COMPONENT_NAME$8 = "FocusTrapZone"; + var DEFAULT_PROPS$5 = { + disabled: false, + disableFirstFocus: false, + forceFocusInsideTrap: true, + isClickableOutsideFocusTrap: false, + // Hardcoding completely uncontrolled flag for proper interop with FluentUI V9. + "data-tabster": '{"uncontrolled": {"completely": true}}' + }; + var useComponentRef$6 = function(componentRef, previouslyFocusedElement, focusFTZ) { + React__namespace.useImperativeHandle(componentRef, function() { + return { + get previouslyFocusedElement() { + return previouslyFocusedElement; + }, + focus: focusFTZ + }; + }, [focusFTZ, previouslyFocusedElement]); + }; + var FocusTrapZone = React__namespace.forwardRef(function(propsWithoutDefaults, ref2) { + var _a2; + var root = React__namespace.useRef(null); + var firstBumper = React__namespace.useRef(null); + var lastBumper = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(root, ref2); + var doc = useDocument(); + var win = useWindowEx(); + var inShadow = useHasMergeStylesShadowRootContext(); + var isFirstRender = (_a2 = usePrevious(false)) !== null && _a2 !== void 0 ? _a2 : true; + var props = getPropsWithDefaults(DEFAULT_PROPS$5, propsWithoutDefaults); + var internalState = useConst({ + hasFocus: false, + focusStackId: useId("ftz-", props.id) + }); + var children2 = props.children, componentRef = props.componentRef, disabled = props.disabled, disableFirstFocus = props.disableFirstFocus, forceFocusInsideTrap = props.forceFocusInsideTrap, focusPreviouslyFocusedInnerElement = props.focusPreviouslyFocusedInnerElement, firstFocusableSelector = props.firstFocusableSelector, firstFocusableTarget = props.firstFocusableTarget, _b2 = props.disableRestoreFocus, disableRestoreFocus = _b2 === void 0 ? props.ignoreExternalFocusing : _b2, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, enableAriaHiddenSiblings = props.enableAriaHiddenSiblings; + var bumperProps = { + "aria-hidden": true, + style: { + pointerEvents: "none", + position: "fixed" + // 'fixed' prevents browsers from scrolling to bumpers when viewport does not contain them + }, + tabIndex: disabled ? -1 : 0, + // make bumpers tabbable only when enabled + "data-is-visible": true, + "data-is-focus-trap-zone-bumper": true + }; + var focusElementAsync = React__namespace.useCallback(function(element2) { + if (element2 !== firstBumper.current && element2 !== lastBumper.current) { + focusAsync(element2); + } }, []); - var rootRef = (0, _reactHooks.useMergedRefs)(hostElement, forwardedRef); - var _d = (0, _reactHooks.useTarget)(props.target, { - current: calloutElement - }), targetRef = _d[0], targetWindow = _d[1]; - var getBounds = useBounds(props, targetRef, targetWindow); - var positions = usePositions(props, hostElement, calloutElement, targetRef, getBounds, mergedPopupRefs); - var maxHeight = useMaxHeight(props, getBounds, targetRef, positions); - var _e = useDismissHandlers(props, positions, hostElement, targetRef, targetWindow), mouseDownOnPopup = _e[0], mouseUpOnPopup = _e[1]; - // do not set both top and bottom css props from positions - // instead, use maxHeight - var isForcedInBounds = (positions === null || positions === void 0 ? void 0 : positions.elementPosition.top) && (positions === null || positions === void 0 ? void 0 : positions.elementPosition.bottom); - var cssPositions = (0, _tslib.__assign)((0, _tslib.__assign)({}, positions === null || positions === void 0 ? void 0 : positions.elementPosition), { - maxHeight: maxHeight + var focusFTZ = useEventCallback(function() { + if (!root.current) { + return; + } + var previouslyFocusedElementInTrapZone = internalState.previouslyFocusedElementInTrapZone; + if (focusPreviouslyFocusedInnerElement && previouslyFocusedElementInTrapZone && elementContains(root.current, previouslyFocusedElementInTrapZone)) { + focusElementAsync(previouslyFocusedElementInTrapZone); + return; + } + var firstFocusableChild = null; + if (typeof firstFocusableTarget === "string") { + firstFocusableChild = root.current.querySelector(firstFocusableTarget); + } else if (firstFocusableTarget) { + firstFocusableChild = firstFocusableTarget(root.current); + } else if (firstFocusableSelector) { + var focusSelector = typeof firstFocusableSelector === "string" ? firstFocusableSelector : firstFocusableSelector(); + firstFocusableChild = root.current.querySelector("." + focusSelector); + } + if (!firstFocusableChild) { + firstFocusableChild = getNextElement(root.current, root.current.firstChild, false, false, false, true, void 0, void 0, void 0, inShadow); + } + if (firstFocusableChild) { + focusElementAsync(firstFocusableChild); + } }); - if (isForcedInBounds) cssPositions.bottom = undefined; - useAutoFocus(props, positions, calloutElement); - _react.useEffect(function() { - if (!hidden) onLayerMounted === null || onLayerMounted === void 0 || onLayerMounted(); - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run if hidden changes - }, [ - hidden - ]); - // If there is no target window then we are likely in server side rendering and we should not render anything. - if (!targetWindow) return null; - var overflowYHidden = hideOverflow; - var beakVisible = isBeakVisible && !!target; - var classNames = getClassNames(styles, { - theme: props.theme, - className: className, - overflowYHidden: overflowYHidden, - calloutWidth: calloutWidth, - positions: positions, - beakWidth: beakWidth, - backgroundColor: backgroundColor, - calloutMaxWidth: calloutMaxWidth, - calloutMinWidth: calloutMinWidth, - doNotLayer: doNotLayer + var focusBumper = function(isFirstBumper) { + if (disabled || !root.current) { + return; + } + var nextFocusable = isFirstBumper === internalState.hasFocus ? getLastTabbable(root.current, lastBumper.current, true, false, inShadow) : getFirstTabbable(root.current, firstBumper.current, true, false, inShadow); + if (nextFocusable) { + if (nextFocusable === firstBumper.current || nextFocusable === lastBumper.current) { + focusFTZ(); + } else { + nextFocusable.focus(); + } + } + }; + var onRootBlurCapture = function(ev) { + var _a3; + (_a3 = props.onBlurCapture) === null || _a3 === void 0 ? void 0 : _a3.call(props, ev); + var relatedTarget = ev.relatedTarget; + if (ev.relatedTarget === null) { + relatedTarget = getActiveElement(doc); + } + if (!elementContains(root.current, relatedTarget)) { + internalState.hasFocus = false; + } + }; + var onRootFocusCapture = function(ev) { + var _a3; + (_a3 = props.onFocusCapture) === null || _a3 === void 0 ? void 0 : _a3.call(props, ev); + if (ev.target === firstBumper.current) { + focusBumper(true); + } else if (ev.target === lastBumper.current) { + focusBumper(false); + } + internalState.hasFocus = true; + if (ev.target !== ev.currentTarget && !(ev.target === firstBumper.current || ev.target === lastBumper.current)) { + internalState.previouslyFocusedElementInTrapZone = getEventTarget(ev.nativeEvent); + } + }; + var returnFocusToInitiator = useEventCallback(function(elementToFocusOnDismiss) { + FocusTrapZone.focusStack = FocusTrapZone.focusStack.filter(function(value2) { + return internalState.focusStackId !== value2; + }); + if (!doc) { + return; + } + var activeElement = doc.activeElement; + if (!disableRestoreFocus && typeof (elementToFocusOnDismiss === null || elementToFocusOnDismiss === void 0 ? void 0 : elementToFocusOnDismiss.focus) === "function" && // only restore focus if the current focused element is within the FTZ, or if nothing is focused + (elementContains(root.current, activeElement) || activeElement === doc.body || activeElement.shadowRoot)) { + focusElementAsync(elementToFocusOnDismiss); + } }); - var overflowStyle = (0, _tslib.__assign)((0, _tslib.__assign)({ - maxHeight: calloutMaxHeight ? calloutMaxHeight : '100%' - }, style), overflowYHidden && { - overflowY: 'hidden' + var forceFocusOrClickInTrap = useEventCallback(function(ev) { + if (disabled) { + return; + } + if (internalState.focusStackId === FocusTrapZone.focusStack.slice(-1)[0]) { + var targetElement = getEventTarget(ev); + if (targetElement && !elementContains(root.current, targetElement)) { + if (doc && getActiveElement(doc) === doc.body) { + setTimeout(function() { + if (doc && getActiveElement(doc) === doc.body) { + focusFTZ(); + internalState.hasFocus = true; + } + }, 0); + } else { + focusFTZ(); + internalState.hasFocus = true; + } + ev.preventDefault(); + ev.stopPropagation(); + } + } }); - var visibilityStyle = props.hidden ? { - visibility: 'hidden' - } : undefined; - // React.CSSProperties does not understand IRawStyle, so the inline animations will need to be cast as any for now. - return _react.createElement("div", { - ref: rootRef, - className: classNames.container, - style: visibilityStyle - }, _react.createElement("div", (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), ARIA_ROLE_ATTRIBUTES), { - className: (0, _utilities.css)(classNames.root, positions && positions.targetEdge && ANIMATIONS[positions.targetEdge]), - style: positions ? (0, _tslib.__assign)({}, cssPositions) : OFF_SCREEN_STYLE, - // Safari and Firefox on Mac OS requires this to back-stop click events so focus remains in the Callout. - // See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus - tabIndex: -1, - ref: calloutCallback - }), beakVisible && _react.createElement("div", { - className: classNames.beak, - style: getBeakPosition(positions) - }), beakVisible && _react.createElement("div", { - className: classNames.beakCurtain - }), _react.createElement((0, _popup.Popup), (0, _tslib.__assign)({ - // don't use getNativeElementProps for role and roledescription because it will also - // pass through data-* props (resulting in them being used in two places) - role: props.role, - "aria-roledescription": props['aria-roledescription'], - ariaDescribedBy: ariaDescribedBy, - ariaLabel: ariaLabel, - ariaLabelledBy: ariaLabelledBy, - className: classNames.calloutMain, - onDismiss: props.onDismiss, - onMouseDown: mouseDownOnPopup, - onMouseUp: mouseUpOnPopup, - onRestoreFocus: props.onRestoreFocus, - onScroll: onScroll, - shouldRestoreFocus: shouldRestoreFocus, - style: overflowStyle - }, popupProps, { - ref: mergedPopupRefs - }), children))); -}), function(previousProps, nextProps) { - if (!nextProps.shouldUpdateWhenHidden && previousProps.hidden && nextProps.hidden) // Do not update when hidden. - return true; - return (0, _utilities.shallowCompare)(previousProps, nextProps); -}); -/** - * (Utility) to find and return the current `Callout` Beak position. - * - * @param positions - */ function getBeakPosition(positions) { - var _a, _b; - var beakPositionStyle = (0, _tslib.__assign)((0, _tslib.__assign)({}, (_a = positions === null || positions === void 0 ? void 0 : positions.beakPosition) === null || _a === void 0 ? void 0 : _a.elementPosition), { - display: ((_b = positions === null || positions === void 0 ? void 0 : positions.beakPosition) === null || _b === void 0 ? void 0 : _b.hideBeak) ? 'none' : undefined + React__namespace.useEffect(function() { + var disposables = []; + if (forceFocusInsideTrap) { + disposables.push(on$1(win, "focus", forceFocusOrClickInTrap, true)); + } + if (!isClickableOutsideFocusTrap) { + disposables.push(on$1(win, "click", forceFocusOrClickInTrap, true)); + } + return function() { + disposables.forEach(function(dispose) { + return dispose(); + }); + }; + }, [forceFocusInsideTrap, isClickableOutsideFocusTrap, win]); + React__namespace.useEffect(function() { + if (disabled || !isFirstRender && !forceFocusInsideTrap || !root.current) { + return; + } + FocusTrapZone.focusStack.push(internalState.focusStackId); + var elementToFocusOnDismiss = props.elementToFocusOnDismiss || getActiveElement(doc); + if (!disableFirstFocus && !elementContains(root.current, elementToFocusOnDismiss)) { + focusFTZ(); + } + return function() { + return returnFocusToInitiator(elementToFocusOnDismiss); + }; + }, [forceFocusInsideTrap, disabled]); + React__namespace.useEffect(function() { + if (!disabled && enableAriaHiddenSiblings) { + var unmodalize2 = modalize(root.current); + return unmodalize2; + } + }, [disabled, enableAriaHiddenSiblings, root]); + useUnmount(function() { + delete internalState.previouslyFocusedElementInTrapZone; }); - if (!beakPositionStyle.top && !beakPositionStyle.bottom && !beakPositionStyle.left && !beakPositionStyle.right) { - beakPositionStyle.left = BEAK_ORIGIN_POSITION.left; - beakPositionStyle.top = BEAK_ORIGIN_POSITION.top; + useComponentRef$6(componentRef, internalState.previouslyFocusedElementInTrapZone, focusFTZ); + return React__namespace.createElement( + "div", + __assign$1({ "aria-labelledby": props.ariaLabelledBy }, getNativeProps(props, divProperties), { ref: mergedRootRef, onFocusCapture: onRootFocusCapture, onBlurCapture: onRootBlurCapture }), + React__namespace.createElement("div", __assign$1({}, bumperProps, { ref: firstBumper })), + children2, + React__namespace.createElement("div", __assign$1({}, bumperProps, { ref: lastBumper })) + ); + }); + FocusTrapZone.displayName = COMPONENT_NAME$8; + FocusTrapZone.focusStack = []; + var defaultIconRenderer = function(props) { + var item = props.item, classNames2 = props.classNames; + var iconProps = item.iconProps; + return React__namespace.createElement(Icon, __assign$1({}, iconProps, { className: classNames2.icon })); + }; + var renderItemIcon = function(props) { + var item = props.item, hasIcons = props.hasIcons; + if (!hasIcons) { + return null; } - return beakPositionStyle; -} -/** - * (Utility) used to compare two different elementPositions to determine whether they are equal. - * - * @param prevElementPositions - * @param newElementPosition - */ function arePositionsEqual(prevElementPositions, newElementPosition) { - return comparePositions(prevElementPositions.elementPosition, newElementPosition.elementPosition) && comparePositions(prevElementPositions.beakPosition.elementPosition, newElementPosition.beakPosition.elementPosition); -} -/** - * (Utility) used in **arePositionsEqual** to compare two different elementPositions. - * - * @param prevElementPositions - * @param newElementPositions - */ function comparePositions(prevElementPositions, newElementPositions) { - for(var key in newElementPositions)if (newElementPositions.hasOwnProperty(key)) { - var oldPositionEdge = prevElementPositions[key]; - var newPositionEdge = newElementPositions[key]; - if (oldPositionEdge !== undefined && newPositionEdge !== undefined) { - if (oldPositionEdge.toFixed(2) !== newPositionEdge.toFixed(2)) return false; - } else return false; + if (item.onRenderIcon) { + return item.onRenderIcon(props, defaultIconRenderer); } - return true; -} -CalloutContentBase.displayName = COMPONENT_NAME; - -},{"tslib":"9gizs","react":"jGrId","../../common/DirectionalHint":"avdAc","../../Utilities":"1NZCy","../../utilities/positioning/positioning":"8HbU4","../../Positioning":"bWPOk","../../Popup":"bOJlv","../../Styling":"hTimn","@fluentui/react-hooks":"2LHjM","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8HbU4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "__positioningTestPackage", ()=>__positioningTestPackage); -/** - * Used to position an element relative to the given positioning props. - * If positioning has been completed before, previousPositions can be passed to ensure that the positioning element - * repositions based on its previous targets rather than starting with directionalhint. - */ parcelHelpers.export(exports, "positionElement", ()=>positionElement); -parcelHelpers.export(exports, "positionCallout", ()=>positionCallout); -parcelHelpers.export(exports, "positionCard", ()=>positionCard); -/** - * Gets the maximum height that a rectangle can have in order to fit below or above a target. - * If the directional hint specifies a left or right edge (i.e. leftCenter) it will limit the height to the topBorder - * of the target given. - * If no bounds are provided then the window is treated as the bounds. - */ parcelHelpers.export(exports, "getMaxHeight", ()=>getMaxHeight); -/** - * Returns the opposite edge of the given RectangleEdge. - */ parcelHelpers.export(exports, "getOppositeEdge", ()=>getOppositeEdge); -parcelHelpers.export(exports, "getBoundsFromTargetWindow", ()=>getBoundsFromTargetWindow); -parcelHelpers.export(exports, "calculateGapSpace", ()=>calculateGapSpace); -parcelHelpers.export(exports, "getRectangleFromTarget", ()=>getRectangleFromTarget); -var _tslib = require("tslib"); -var _directionalHint = require("../../common/DirectionalHint"); -var _utilities = require("../../Utilities"); -var _positioningTypes = require("./positioning.types"); -var _a; -function _createPositionData(targetEdge, alignmentEdge, isAuto) { - return { - targetEdge: targetEdge, - alignmentEdge: alignmentEdge, - isAuto: isAuto - }; -} -// Currently the beakPercent is set to 50 for all positions meaning that it should tend to the center of the target -var DirectionalDictionary = (_a = {}, _a[(0, _directionalHint.DirectionalHint).topLeftEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).top, (0, _positioningTypes.RectangleEdge).left), _a[(0, _directionalHint.DirectionalHint).topCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).top), _a[(0, _directionalHint.DirectionalHint).topRightEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).top, (0, _positioningTypes.RectangleEdge).right), _a[(0, _directionalHint.DirectionalHint).topAutoEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).top, undefined, true), _a[(0, _directionalHint.DirectionalHint).bottomLeftEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom, (0, _positioningTypes.RectangleEdge).left), _a[(0, _directionalHint.DirectionalHint).bottomCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom), _a[(0, _directionalHint.DirectionalHint).bottomRightEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom, (0, _positioningTypes.RectangleEdge).right), _a[(0, _directionalHint.DirectionalHint).bottomAutoEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).bottom, undefined, true), _a[(0, _directionalHint.DirectionalHint).leftTopEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).left, (0, _positioningTypes.RectangleEdge).top), _a[(0, _directionalHint.DirectionalHint).leftCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).left), _a[(0, _directionalHint.DirectionalHint).leftBottomEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).left, (0, _positioningTypes.RectangleEdge).bottom), _a[(0, _directionalHint.DirectionalHint).rightTopEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).right, (0, _positioningTypes.RectangleEdge).top), _a[(0, _directionalHint.DirectionalHint).rightCenter] = _createPositionData((0, _positioningTypes.RectangleEdge).right), _a[(0, _directionalHint.DirectionalHint).rightBottomEdge] = _createPositionData((0, _positioningTypes.RectangleEdge).right, (0, _positioningTypes.RectangleEdge).bottom), _a); -function _isRectangleWithinBounds(rect, boundingRect) { - if (rect.top < boundingRect.top) return false; - if (rect.bottom > boundingRect.bottom) return false; - if (rect.left < boundingRect.left) return false; - if (rect.right > boundingRect.right) return false; - return true; -} -/** - * Gets all of the edges of a rectangle that are outside of the given bounds. - * If there are no out of bounds edges it returns an empty array. - */ function _getOutOfBoundsEdges(rect, boundingRect) { - var outOfBounds = []; - if (rect.top < boundingRect.top) outOfBounds.push((0, _positioningTypes.RectangleEdge).top); - if (rect.bottom > boundingRect.bottom) outOfBounds.push((0, _positioningTypes.RectangleEdge).bottom); - if (rect.left < boundingRect.left) outOfBounds.push((0, _positioningTypes.RectangleEdge).left); - if (rect.right > boundingRect.right) outOfBounds.push((0, _positioningTypes.RectangleEdge).right); - return outOfBounds; -} -function _getEdgeValue(rect, edge) { - return rect[(0, _positioningTypes.RectangleEdge)[edge]]; -} -function _setEdgeValue(rect, edge, value) { - rect[(0, _positioningTypes.RectangleEdge)[edge]] = value; - return rect; -} -/** - * Returns the middle value of an edge. Only returns 1 value rather than xy coordinates as - * the itself already contains the other coordinate. - * For instance, a bottom edge's current value is it's y coordinate, so the number returned is the x. - */ function _getCenterValue(rect, edge) { - var edges = _getFlankingEdges(edge); - return (_getEdgeValue(rect, edges.positiveEdge) + _getEdgeValue(rect, edges.negativeEdge)) / 2; -} -/** - * Flips the value depending on the edge. - * If the edge is a "positive" edge, Top or Left, then the value should stay as it is. - * If the edge is a "negative" edge, Bottom or Right, then the value should be flipped. - * This is to account for the fact that the coordinates are effectively reserved in certain cases for the - * "negative" edges. - * - * For example, when testing to see if a bottom edge 1 is within the bounds of another bottom edge 2: - * If edge 1 is greater than edge 2 then it is out of bounds. This is reversed for top edge 1 and top edge 2. - * If top edge 1 is less than edge 2 then it is out of bounds. - */ function _getRelativeEdgeValue(edge, value) { - if (edge > 0) return value; - else return value * -1; -} -function _getRelativeRectEdgeValue(edge, rect) { - return _getRelativeEdgeValue(edge, _getEdgeValue(rect, edge)); -} -function _getRelativeEdgeDifference(rect, hostRect, edge) { - var edgeDifference = _getEdgeValue(rect, edge) - _getEdgeValue(hostRect, edge); - return _getRelativeEdgeValue(edge, edgeDifference); -} -/** - * Moves the edge of a rectangle to the value given. It only moves the edge in a linear direction based on that edge. - * For example, if it's a bottom edge it will only change y coordinates. - * if maintainSize is set to false, it will only adjust the specified edge value - */ function _moveEdge(rect, edge, newValue, maintainSize) { - if (maintainSize === void 0) maintainSize = true; - var difference = _getEdgeValue(rect, edge) - newValue; - var returnRect = _setEdgeValue(rect, edge, newValue); - if (maintainSize) returnRect = _setEdgeValue(rect, edge * -1, _getEdgeValue(rect, edge * -1) - difference); - return returnRect; -} -/** - * Aligns the edge on the passed in rect to the target. If there is a gap then it will have that space between the two. - */ function _alignEdges(rect, target, edge, gap) { - if (gap === void 0) gap = 0; - return _moveEdge(rect, edge, _getEdgeValue(target, edge) + _getRelativeEdgeValue(edge, gap)); -} -/** - * Aligns the targetEdge on the passed in target to the rects corresponding opposite edge. - * For instance if targetEdge is bottom, then the rects top will be moved to match it. - */ function _alignOppositeEdges(rect, target, targetEdge, gap) { - if (gap === void 0) gap = 0; - var oppositeEdge = targetEdge * -1; - var adjustedGap = _getRelativeEdgeValue(oppositeEdge, gap); - return _moveEdge(rect, targetEdge * -1, _getEdgeValue(target, targetEdge) + adjustedGap); -} -/** - * Tests to see if the given edge is within the bounds of the given rectangle. - */ function _isEdgeInBounds(rect, bounds, edge) { - var adjustedRectValue = _getRelativeRectEdgeValue(edge, rect); - return adjustedRectValue > _getRelativeRectEdgeValue(edge, bounds); -} -/** - * Returns a measure of how much a rectangle is out of bounds for a given alignment; - * this can be used to compare which rectangle is more or less out of bounds. - * A value of 0 means the rectangle is entirely in bounds - */ function _getOutOfBoundsDegree(rect, bounds) { - var breakingEdges = _getOutOfBoundsEdges(rect, bounds); - var total = 0; - for(var _i = 0, breakingEdges_1 = breakingEdges; _i < breakingEdges_1.length; _i++){ - var edge = breakingEdges_1[_i]; - total += Math.pow(_getRelativeEdgeDifference(rect, bounds, edge), 2); + return defaultIconRenderer(props); + }; + var renderCheckMarkIcon = function(_a2) { + var onCheckmarkClick = _a2.onCheckmarkClick, item = _a2.item, classNames2 = _a2.classNames; + var isItemChecked = getIsChecked(item); + if (onCheckmarkClick) { + var onClick = function(e) { + return onCheckmarkClick(item, e); + }; + return React__namespace.createElement(Icon, { + iconName: item.canCheck !== false && isItemChecked ? "CheckMark" : "", + className: classNames2.checkmarkIcon, + // eslint-disable-next-line react/jsx-no-bind + onClick + }); } - return total; -} -/** - * Returns true if scroll-resizing will move the target edge within the bounding rectangle, - * and there is room between the target edge and the bounding edge for scrolled content. - * Returns false otherwise. - */ function _canScrollResizeToFitEdge(target, bounding, targetEdge, minimumScrollResizeHeight) { - if (minimumScrollResizeHeight === void 0) minimumScrollResizeHeight = 200; - // Only scroll vertically to fit - cannot scroll to fit right or left edges - if (targetEdge !== (0, _positioningTypes.RectangleEdge).bottom && targetEdge !== (0, _positioningTypes.RectangleEdge).top) return false; - return _getRelativeEdgeDifference(target, bounding, targetEdge) >= minimumScrollResizeHeight; -} -/** - * Attempts to move the rectangle through various sides of the target to find a place to fit. - * If no fit is found, the least bad option should be returned. - */ function _flipToFit(rect, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap) { - if (shouldScroll === void 0) shouldScroll = false; - if (gap === void 0) gap = 0; - var directions = [ - (0, _positioningTypes.RectangleEdge).left, - (0, _positioningTypes.RectangleEdge).right, - (0, _positioningTypes.RectangleEdge).bottom, - (0, _positioningTypes.RectangleEdge).top - ]; - // In RTL page, RectangleEdge.right has a higher priority than RectangleEdge.left, so the order should be updated. - if ((0, _utilities.getRTL)()) { - directions[0] *= -1; - directions[1] *= -1; + return null; + }; + var renderItemName = function(_a2) { + var item = _a2.item, classNames2 = _a2.classNames; + if (item.text || item.name) { + return React__namespace.createElement("span", { className: classNames2.label }, item.text || item.name); } - var currentEstimate = rect; - var currentEdge = positionData.targetEdge; - var currentAlignment = positionData.alignmentEdge; - // keep track of least bad option, in case no sides fit - var oobDegree; - var bestEdge = currentEdge; - var bestAlignment = currentAlignment; - // Keep switching sides until one is found with enough space. - // If all sides don't fit then return the unmodified element. - for(var i = 0; i < 4; i++){ - if (_isEdgeInBounds(currentEstimate, bounding, currentEdge)) // Edge is in bounds, return current estimate - return { - elementRectangle: currentEstimate, - targetEdge: currentEdge, - alignmentEdge: currentAlignment - }; - else if (shouldScroll && _canScrollResizeToFitEdge(target, bounding, currentEdge, minimumScrollResizeHeight)) { - // Scrolling will allow edge to fit, move the estimate currentEdge inside the bounds and return - switch(currentEdge){ - case (0, _positioningTypes.RectangleEdge).bottom: - currentEstimate.bottom = bounding.bottom; - break; - case (0, _positioningTypes.RectangleEdge).top: - currentEstimate.top = bounding.top; - break; - } - return { - elementRectangle: currentEstimate, - targetEdge: currentEdge, - alignmentEdge: currentAlignment, - forcedInBounds: true - }; - } else { - // update least-bad edges - var currentOOBDegree = _getOutOfBoundsDegree(currentEstimate, bounding); - if (!oobDegree || currentOOBDegree < oobDegree) { - oobDegree = currentOOBDegree; - bestEdge = currentEdge; - bestAlignment = currentAlignment; - } - directions.splice(directions.indexOf(currentEdge), 1); - if (directions.length > 0) { - if (directions.indexOf(currentEdge * -1) > -1) currentEdge = currentEdge * -1; - else { - currentAlignment = currentEdge; - currentEdge = directions.slice(-1)[0]; - } - currentEstimate = _estimatePosition(rect, target, { - targetEdge: currentEdge, - alignmentEdge: currentAlignment - }, gap); - } - } + return null; + }; + var renderSecondaryText = function(_a2) { + var item = _a2.item, classNames2 = _a2.classNames; + if (item.secondaryText) { + return React__namespace.createElement("span", { className: classNames2.secondaryText }, item.secondaryText); } - // nothing fits, use least-bad option - currentEstimate = _estimatePosition(rect, target, { - targetEdge: bestEdge, - alignmentEdge: bestAlignment - }, gap); - return { - elementRectangle: currentEstimate, - targetEdge: bestEdge, - alignmentEdge: bestAlignment - }; -} -/** - * Flips only the alignment edge of an element rectangle. This is used instead of nudging the alignment edges - * into position, when `alignTargetEdge` is specified. - */ function _flipAlignmentEdge(elementEstimate, target, gap, coverTarget) { - var alignmentEdge = elementEstimate.alignmentEdge, targetEdge = elementEstimate.targetEdge, elementRectangle = elementEstimate.elementRectangle; - var oppositeEdge = alignmentEdge * -1; - var newEstimate = _estimatePosition(elementRectangle, target, { - targetEdge: targetEdge, - alignmentEdge: oppositeEdge - }, gap, coverTarget); - return { - elementRectangle: newEstimate, - targetEdge: targetEdge, - alignmentEdge: oppositeEdge - }; -} -/** - * Adjusts a element rectangle to fit within the bounds given. If directionalHintFixed or covertarget is passed in - * then the element will not flip sides on the target. They will, however, be nudged to fit within the bounds given. - */ function _adjustFitWithinBounds(element, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget) { - if (shouldScroll === void 0) shouldScroll = false; - if (gap === void 0) gap = 0; - var alignmentEdge = positionData.alignmentEdge, alignTargetEdge = positionData.alignTargetEdge; - var elementEstimate = { - elementRectangle: element, - targetEdge: positionData.targetEdge, - alignmentEdge: alignmentEdge - }; - if (!directionalHintFixed && !coverTarget) elementEstimate = _flipToFit(element, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap); - var outOfBounds = _getOutOfBoundsEdges(elementEstimate.elementRectangle, bounding); - // if directionalHintFixed is specified, we need to force the target edge to not change - // we need *-1 because targetEdge refers to the target's edge; the callout edge is the opposite - var fixedEdge = directionalHintFixed ? -elementEstimate.targetEdge : undefined; - if (outOfBounds.length > 0) { - if (alignTargetEdge) { - // The edge opposite to the alignment edge might be out of bounds. - // Flip alignment to see if we can get it within bounds. - if (elementEstimate.alignmentEdge && outOfBounds.indexOf(elementEstimate.alignmentEdge * -1) > -1) { - var flippedElementEstimate = _flipAlignmentEdge(elementEstimate, target, gap, coverTarget); - if (_isRectangleWithinBounds(flippedElementEstimate.elementRectangle, bounding)) return flippedElementEstimate; - else // If the flipped elements edges are still out of bounds, try nudging it. - elementEstimate = _alignOutOfBoundsEdges(_getOutOfBoundsEdges(flippedElementEstimate.elementRectangle, bounding), elementEstimate, bounding, fixedEdge); - } else elementEstimate = _alignOutOfBoundsEdges(outOfBounds, elementEstimate, bounding, fixedEdge); - } else elementEstimate = _alignOutOfBoundsEdges(outOfBounds, elementEstimate, bounding, fixedEdge); + return null; + }; + var renderSubMenuIcon = function(_a2) { + var item = _a2.item, classNames2 = _a2.classNames, theme = _a2.theme; + if (hasSubmenu(item)) { + return React__namespace.createElement(Icon, __assign$1({ iconName: getRTL(theme) ? "ChevronLeft" : "ChevronRight" }, item.submenuIconProps, { className: classNames2.subMenuIcon })); } - return elementEstimate; -} -/** - * Iterates through a list of out of bounds edges and tries to nudge and align them. - * @param outOfBoundsEdges - Array of edges that are out of bounds - * @param elementEstimate - The current element positioning estimate - * @param bounding - The current bounds - * @param preserveEdge - Specify an edge that should not be modified - */ function _alignOutOfBoundsEdges(outOfBoundsEdges, elementEstimate, bounding, preserveEdge) { - for(var _i = 0, outOfBoundsEdges_1 = outOfBoundsEdges; _i < outOfBoundsEdges_1.length; _i++){ - var direction = outOfBoundsEdges_1[_i]; - var edgeAttempt = void 0; - // if preserveEdge is specified, do not call _alignEdges, skip directly to _moveEdge - // this is because _alignEdges will move the opposite edge - if (preserveEdge && preserveEdge === direction * -1) { - edgeAttempt = _moveEdge(elementEstimate.elementRectangle, direction, _getEdgeValue(bounding, direction), false); - elementEstimate.forcedInBounds = true; - } else { - edgeAttempt = _alignEdges(elementEstimate.elementRectangle, bounding, direction); - var inBounds = _isEdgeInBounds(edgeAttempt, bounding, direction * -1); - // only update estimate if the attempt didn't break out of the opposite bounding edge - if (!inBounds) { - edgeAttempt = _moveEdge(edgeAttempt, direction * -1, _getEdgeValue(bounding, direction * -1), false); - elementEstimate.forcedInBounds = true; + return null; + }; + var ContextualMenuItemBase = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuItemBase2, _super); + function ContextualMenuItemBase2(props) { + var _this = _super.call(this, props) || this; + _this.openSubMenu = function() { + var _a2 = _this.props, item = _a2.item, openSubMenu = _a2.openSubMenu, getSubmenuTarget = _a2.getSubmenuTarget; + if (getSubmenuTarget) { + var submenuTarget = getSubmenuTarget(); + if (hasSubmenu(item) && openSubMenu && submenuTarget) { + openSubMenu(item, submenuTarget); } + } + }; + _this.dismissSubMenu = function() { + var _a2 = _this.props, item = _a2.item, dismissSubMenu = _a2.dismissSubMenu; + if (hasSubmenu(item) && dismissSubMenu) { + dismissSubMenu(); + } + }; + _this.dismissMenu = function(dismissAll) { + var dismissMenu = _this.props.dismissMenu; + if (dismissMenu) { + dismissMenu(void 0, dismissAll); + } + }; + initializeComponentRef(_this); + return _this; + } + ContextualMenuItemBase2.prototype.render = function() { + var _a2 = this.props, item = _a2.item, classNames2 = _a2.classNames; + var renderContent = item.onRenderContent || this._renderLayout; + return React__namespace.createElement("div", { className: item.split ? classNames2.linkContentMenu : classNames2.linkContent }, renderContent(this.props, { + renderCheckMarkIcon, + renderItemIcon, + renderItemName, + renderSecondaryText, + renderSubMenuIcon + })); + }; + ContextualMenuItemBase2.prototype._renderLayout = function(props, defaultRenders) { + return React__namespace.createElement( + React__namespace.Fragment, + null, + defaultRenders.renderCheckMarkIcon(props), + defaultRenders.renderItemIcon(props), + defaultRenders.renderItemName(props), + defaultRenders.renderSecondaryText(props), + defaultRenders.renderSubMenuIcon(props) + ); + }; + return ContextualMenuItemBase2; + })(React__namespace.Component) + ); + var getDividerClassNames = memoizeFunction( + // eslint-disable-next-line @typescript-eslint/no-deprecated + function(theme) { + return mergeStyleSets({ + wrapper: { + display: "inline-flex", + height: "100%", + alignItems: "center" + }, + divider: { + width: 1, + height: "100%", + backgroundColor: theme.palette.neutralTertiaryAlt } - elementEstimate.elementRectangle = edgeAttempt; - } - return elementEstimate; -} -/** - * Moves the middle point on an edge to the point given. - * Only moves in one direction. For instance if a bottom edge is passed in, then - * the bottom edge will be moved in the x axis to match the point. - */ function _centerEdgeToPoint(rect, edge, point) { - var positiveEdge = _getFlankingEdges(edge).positiveEdge; - var elementMiddle = _getCenterValue(rect, edge); - var distanceToMiddle = elementMiddle - _getEdgeValue(rect, positiveEdge); - return _moveEdge(rect, positiveEdge, point - distanceToMiddle); -} -/** - * Moves the element rectangle to be appropriately positioned relative to a given target. - * Does not flip or adjust the element. - */ function _estimatePosition(elementToPosition, target, positionData, gap, coverTarget) { - if (gap === void 0) gap = 0; - var estimatedElementPosition = new (0, _utilities.Rectangle)(elementToPosition.left, elementToPosition.right, elementToPosition.top, elementToPosition.bottom); - var alignmentEdge = positionData.alignmentEdge, targetEdge = positionData.targetEdge; - var elementEdge = coverTarget ? targetEdge : targetEdge * -1; - estimatedElementPosition = coverTarget ? _alignEdges(estimatedElementPosition, target, targetEdge, gap) : _alignOppositeEdges(estimatedElementPosition, target, targetEdge, gap); - // if no alignment edge is provided it's supposed to be centered. - if (!alignmentEdge) { - var targetMiddlePoint = _getCenterValue(target, targetEdge); - estimatedElementPosition = _centerEdgeToPoint(estimatedElementPosition, elementEdge, targetMiddlePoint); - } else estimatedElementPosition = _alignEdges(estimatedElementPosition, target, alignmentEdge); - return estimatedElementPosition; -} -/** - * Returns the non-opposite edges of the target edge. - * For instance if bottom is passed in then left and right will be returned. - */ function _getFlankingEdges(edge) { - if (edge === (0, _positioningTypes.RectangleEdge).top || edge === (0, _positioningTypes.RectangleEdge).bottom) return { - positiveEdge: (0, _positioningTypes.RectangleEdge).left, - negativeEdge: (0, _positioningTypes.RectangleEdge).right - }; - else return { - positiveEdge: (0, _positioningTypes.RectangleEdge).top, - negativeEdge: (0, _positioningTypes.RectangleEdge).bottom - }; -} -/** - * Retrieve the final value for the return edge of `elementRectangle`. If the `elementRectangle` is closer to one side - * of the bounds versus the other, the return edge is flipped to grow inward. - */ function _finalizeReturnEdge(elementRectangle, returnEdge, bounds) { - if (bounds && Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge)) > Math.abs(_getRelativeEdgeDifference(elementRectangle, bounds, returnEdge * -1))) return returnEdge * -1; - return returnEdge; -} -/** - * Whether or not the considered edge of the elementRectangle is lying on the edge of the bounds - * @param elementRectangle The rectangle whose edge we are considering - * @param bounds The rectangle marking the bounds - * @param edge The target edge we're considering - * @returns If the target edge of the elementRectangle is in the same location as that edge of the bounds - */ function _isEdgeOnBounds(elementRectangle, edge, bounds) { - return bounds !== undefined && _getEdgeValue(elementRectangle, edge) === _getEdgeValue(bounds, edge); -} -/** - * Finalizes the element position based on the hostElement. Only returns the - * rectangle values to position such that they are anchored to the target. - * This helps prevent resizing from looking very strange. - * For instance, if the target edge is top and aligned with the left side then - * the bottom and left values are returned so as the Callout shrinks it shrinks towards that corner. - */ function _finalizeElementPosition(elementRectangle, hostElement, targetEdge, bounds, alignmentEdge, coverTarget, doNotFinalizeReturnEdge, forceWithinBounds) { - var returnValue = {}; - var hostRect = _getRectangleFromElement(hostElement); - var elementEdge = coverTarget ? targetEdge : targetEdge * -1; - var returnEdge = alignmentEdge ? alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge; - // If we are finalizing the return edge, choose the edge such that we grow away from the bounds - // If we are not finalizing the return edge but the opposite edge is flush against the bounds, - // choose that as the anchor edge so the element rect can grow away from the bounds' edge - // In this case there will not be a visual difference because there is no more room for the elementRectangle to grow - // in the usual direction - if (!doNotFinalizeReturnEdge || _isEdgeOnBounds(elementRectangle, getOppositeEdge(returnEdge), bounds)) returnEdge = _finalizeReturnEdge(elementRectangle, returnEdge, bounds); - returnValue[(0, _positioningTypes.RectangleEdge)[elementEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge); - returnValue[(0, _positioningTypes.RectangleEdge)[returnEdge]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge); - // if the positioned element will still overflow, return all four edges with in-bounds values - if (forceWithinBounds) { - returnValue[(0, _positioningTypes.RectangleEdge)[elementEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, elementEdge * -1); - returnValue[(0, _positioningTypes.RectangleEdge)[returnEdge * -1]] = _getRelativeEdgeDifference(elementRectangle, hostRect, returnEdge * -1); + }); } - return returnValue; -} -// Since the beak is rotated 45 degrees the actual height/width is the length of the diagonal. -// We still want to position the beak based on it's midpoint which does not change. It will -// be at (beakwidth / 2, beakwidth / 2) -function _calculateActualBeakWidthInPixels(beakWidth) { - return Math.sqrt(beakWidth * beakWidth * 2); -} -/** - * Returns the appropriate IPositionData based on the props altered for RTL. - * If directionalHintForRTL is passed in that is used if the page is RTL. - * If directionalHint is specified, no directionalHintForRTL is available, and the page is RTL, the hint will be - * flipped (e.g. bottomLeftEdge would become bottomRightEdge). - * - * If there is no directionalHint passed in, bottomAutoEdge is chosen automatically. - */ function _getPositionData(directionalHint, directionalHintForRTL, previousPositions) { - if (directionalHint === void 0) directionalHint = (0, _directionalHint.DirectionalHint).bottomAutoEdge; - if (previousPositions) return { - alignmentEdge: previousPositions.alignmentEdge, - isAuto: previousPositions.isAuto, - targetEdge: previousPositions.targetEdge + ); + var CONTEXTUAL_MENU_ITEM_HEIGHT = 36; + var MediumScreenSelector$1 = getScreenSelector(0, ScreenWidthMaxMedium); + var getMenuItemStyles = memoizeFunction(function(theme) { + var _a2, _b2, _c2, _d2, _e2; + var semanticColors = theme.semanticColors, fonts = theme.fonts, palette = theme.palette; + var ContextualMenuItemBackgroundHoverColor = semanticColors.menuItemBackgroundHovered; + var ContextualMenuItemTextHoverColor = semanticColors.menuItemTextHovered; + var ContextualMenuItemBackgroundSelectedColor = semanticColors.menuItemBackgroundPressed; + var ContextualMenuItemDividerColor = semanticColors.bodyDivider; + var menuItemStyles = { + item: [ + fonts.medium, + { + color: semanticColors.bodyText, + position: "relative", + boxSizing: "border-box" + } + ], + divider: { + display: "block", + height: "1px", + backgroundColor: ContextualMenuItemDividerColor, + position: "relative" + }, + root: [ + getFocusStyle(theme), + fonts.medium, + { + color: semanticColors.bodyText, + backgroundColor: "transparent", + border: "none", + width: "100%", + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + display: "block", + cursor: "pointer", + padding: "0px 8px 0 4px", + // inner elements have a margin of 4px (4 + 4 = 8px as on right side) + textAlign: "left" + } + ], + rootDisabled: { + color: semanticColors.disabledBodyText, + cursor: "default", + pointerEvents: "none", + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + // ensure disabled text looks different than enabled + color: "GrayText", + opacity: 1 + }, _a2) + }, + rootHovered: { + backgroundColor: ContextualMenuItemBackgroundHoverColor, + color: ContextualMenuItemTextHoverColor, + selectors: { + ".ms-ContextualMenu-icon": { + color: palette.themeDarkAlt + }, + ".ms-ContextualMenu-submenuIcon": { + color: palette.neutralPrimary + } + } + }, + rootFocused: { + backgroundColor: palette.white + }, + rootChecked: { + selectors: { + ".ms-ContextualMenu-checkmarkIcon": { + color: palette.neutralPrimary + } + } + }, + rootPressed: { + backgroundColor: ContextualMenuItemBackgroundSelectedColor, + selectors: { + ".ms-ContextualMenu-icon": { + color: palette.themeDark + }, + ".ms-ContextualMenu-submenuIcon": { + color: palette.neutralPrimary + } + } + }, + rootExpanded: { + backgroundColor: ContextualMenuItemBackgroundSelectedColor, + color: semanticColors.bodyTextChecked, + selectors: (_b2 = { + ".ms-ContextualMenu-submenuIcon": (_c2 = {}, _c2[HighContrastSelector] = { + // icons inside of anchor tags are not properly inheriting color in high contrast + color: "inherit" + }, _c2) + }, _b2[HighContrastSelector] = __assign$1({}, getHighContrastNoAdjustStyle()), _b2) + }, + linkContent: { + whiteSpace: "nowrap", + height: "inherit", + display: "flex", + alignItems: "center", + maxWidth: "100%" + }, + anchorLink: { + padding: "0px 8px 0 4px", + // inner elements have a margin of 4px (4 + 4 = 8px as on right side) + textRendering: "auto", + color: "inherit", + letterSpacing: "normal", + wordSpacing: "normal", + textTransform: "none", + textIndent: "0px", + textShadow: "none", + textDecoration: "none", + boxSizing: "border-box" + }, + label: { + margin: "0 4px", + verticalAlign: "middle", + display: "inline-block", + flexGrow: "1", + textOverflow: "ellipsis", + whiteSpace: "nowrap", + overflow: "hidden" + }, + secondaryText: { + color: theme.palette.neutralSecondary, + paddingLeft: "20px", + textAlign: "right" + }, + icon: { + display: "inline-block", + minHeight: "1px", + maxHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + fontSize: IconFontSizes.medium, + width: IconFontSizes.medium, + margin: "0 4px", + verticalAlign: "middle", + flexShrink: "0", + selectors: (_d2 = {}, _d2[MediumScreenSelector$1] = { + fontSize: IconFontSizes.large, + width: IconFontSizes.large + }, _d2) + }, + iconColor: { + color: semanticColors.menuIcon + }, + iconDisabled: { + color: semanticColors.disabledBodyText + }, + checkmarkIcon: { + color: semanticColors.bodySubtext + }, + subMenuIcon: { + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + color: palette.neutralSecondary, + textAlign: "center", + display: "inline-block", + verticalAlign: "middle", + flexShrink: "0", + fontSize: IconFontSizes.small, + // 12px + selectors: (_e2 = { + ":hover": { + color: palette.neutralPrimary + }, + ":active": { + color: palette.neutralPrimary + } + }, _e2[MediumScreenSelector$1] = { + fontSize: IconFontSizes.medium + // 16px + }, _e2) + }, + splitButtonFlexContainer: [ + getFocusStyle(theme), + { + display: "flex", + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + flexWrap: "nowrap", + justifyContent: "center", + alignItems: "flex-start" + } + ] }; - var positionInformation = (0, _tslib.__assign)({}, DirectionalDictionary[directionalHint]); - if ((0, _utilities.getRTL)()) { - // If alignment edge exists and that alignment edge is -2 or 2, right or left, then flip it. - if (positionInformation.alignmentEdge && positionInformation.alignmentEdge % 2 === 0) positionInformation.alignmentEdge = positionInformation.alignmentEdge * -1; - return directionalHintForRTL !== undefined ? DirectionalDictionary[directionalHintForRTL] : positionInformation; + return concatStyleSets(menuItemStyles); + }); + var CONTEXTUAL_SPLIT_MENU_MINWIDTH = "28px"; + var MediumScreenSelector = getScreenSelector(0, ScreenWidthMaxMedium); + var getSplitButtonVerticalDividerClassNames = memoizeFunction( + /* eslint-disable @typescript-eslint/no-deprecated */ + function(theme) { + var _a2; + return mergeStyleSets(getDividerClassNames(theme), { + /* eslint-enable @typescript-eslint/no-deprecated */ + wrapper: { + position: "absolute", + right: 28, + // width of the splitMenu based on the padding plus icon fontSize + selectors: (_a2 = {}, _a2[MediumScreenSelector] = { + right: 32 + // fontSize of the icon increased from 12px to 16px + }, _a2) + }, + divider: { + height: 16, + width: 1 + } + }); } - return positionInformation; -} -/** - * Gets the alignment data for the given information. This only really matters if the positioning is Auto. - * If it is auto then the alignmentEdge should be chosen based on the target edge's position relative to - * the center of the page. - */ function _getAlignmentData(positionData, target, boundingRect, coverTarget, alignTargetEdge) { - if (positionData.isAuto) positionData.alignmentEdge = getClosestEdge(positionData.targetEdge, target, boundingRect); - positionData.alignTargetEdge = alignTargetEdge; - return positionData; -} -function getClosestEdge(targetEdge, target, boundingRect) { - var targetCenter = _getCenterValue(target, targetEdge); - var boundingCenter = _getCenterValue(boundingRect, targetEdge); - var _a = _getFlankingEdges(targetEdge), positiveEdge = _a.positiveEdge, negativeEdge = _a.negativeEdge; - if (targetCenter <= boundingCenter) return positiveEdge; - else return negativeEdge; -} -function _positionElementWithinBounds(elementToPosition, target, bounding, positionData, gap, shouldScroll, minimumScrollResizeHeight, directionalHintFixed, coverTarget) { - if (shouldScroll === void 0) shouldScroll = false; - var estimatedElementPosition = _estimatePosition(elementToPosition, target, positionData, gap, coverTarget); - if (_isRectangleWithinBounds(estimatedElementPosition, bounding)) return { - elementRectangle: estimatedElementPosition, - targetEdge: positionData.targetEdge, - alignmentEdge: positionData.alignmentEdge - }; - else return _adjustFitWithinBounds(estimatedElementPosition, target, bounding, positionData, shouldScroll, minimumScrollResizeHeight, gap, directionalHintFixed, coverTarget); -} -function _finalizeBeakPosition(elementPosition, positionedBeak, bounds) { - var targetEdge = elementPosition.targetEdge * -1; - // The "host" element that we will use to help position the beak. - var actualElement = new (0, _utilities.Rectangle)(0, elementPosition.elementRectangle.width, 0, elementPosition.elementRectangle.height); - var returnValue = {}; - var returnEdge = _finalizeReturnEdge(elementPosition.elementRectangle, elementPosition.alignmentEdge ? elementPosition.alignmentEdge : _getFlankingEdges(targetEdge).positiveEdge, bounds); - // only show the beak if the callout is not fully covering the target - var beakEdgeDifference = _getRelativeEdgeDifference(elementPosition.elementRectangle, elementPosition.targetRectangle, targetEdge); - var showBeak = beakEdgeDifference > Math.abs(_getEdgeValue(positionedBeak, targetEdge)); - returnValue[(0, _positioningTypes.RectangleEdge)[targetEdge]] = _getEdgeValue(positionedBeak, targetEdge); - returnValue[(0, _positioningTypes.RectangleEdge)[returnEdge]] = _getRelativeEdgeDifference(positionedBeak, actualElement, returnEdge); - return { - elementPosition: (0, _tslib.__assign)({}, returnValue), - closestEdge: getClosestEdge(elementPosition.targetEdge, positionedBeak, actualElement), - targetEdge: targetEdge, - hideBeak: !showBeak - }; -} -function _positionBeak(beakWidth, elementPosition) { - var target = elementPosition.targetRectangle; - /** - * Note about beak positioning: The actual beak width only matters for getting the gap between the callout and - * target, it does not impact the beak placement within the callout. For example example, if the beakWidth is 8, - * then the actual beakWidth is sqrroot(8^2 + 8^2) = 11.31x11.31. So the callout will need to be an extra 3 pixels - * away from its target. While the beak is being positioned in the callout it still acts as though it were 8x8. - */ var _a = _getFlankingEdges(elementPosition.targetEdge), positiveEdge = _a.positiveEdge, negativeEdge = _a.negativeEdge; - var beakTargetPoint = _getCenterValue(target, elementPosition.targetEdge); - var elementBounds = new (0, _utilities.Rectangle)(beakWidth / 2, elementPosition.elementRectangle.width - beakWidth / 2, beakWidth / 2, elementPosition.elementRectangle.height - beakWidth / 2); - var beakPosition = new (0, _utilities.Rectangle)(0, beakWidth, 0, beakWidth); - beakPosition = _moveEdge(beakPosition, elementPosition.targetEdge * -1, -beakWidth / 2); - beakPosition = _centerEdgeToPoint(beakPosition, elementPosition.targetEdge * -1, beakTargetPoint - _getRelativeRectEdgeValue(positiveEdge, elementPosition.elementRectangle)); - if (!_isEdgeInBounds(beakPosition, elementBounds, positiveEdge)) beakPosition = _alignEdges(beakPosition, elementBounds, positiveEdge); - else if (!_isEdgeInBounds(beakPosition, elementBounds, negativeEdge)) beakPosition = _alignEdges(beakPosition, elementBounds, negativeEdge); - return beakPosition; -} -function _getRectangleFromElement(element) { - // eslint-disable-next-line deprecation/deprecation - var clientRect = element.getBoundingClientRect(); - return new (0, _utilities.Rectangle)(clientRect.left, clientRect.right, clientRect.top, clientRect.bottom); -} -function _getRectangleFromIRect(rect) { - return new (0, _utilities.Rectangle)(rect.left, rect.right, rect.top, rect.bottom); -} -function _getTargetRect(bounds, target) { - var targetRectangle; - if (target) { - // eslint-disable-next-line no-extra-boolean-cast - if (!!target.preventDefault) { - var ev = target; - targetRectangle = new (0, _utilities.Rectangle)(ev.clientX, ev.clientX, ev.clientY, ev.clientY); - // eslint-disable-next-line no-extra-boolean-cast - } else if (!!target.getBoundingClientRect) targetRectangle = _getRectangleFromElement(target); - else { - var rectOrPoint = target; - // eslint-disable-next-line deprecation/deprecation - var left = rectOrPoint.left || rectOrPoint.x; - // eslint-disable-next-line deprecation/deprecation - var top_1 = rectOrPoint.top || rectOrPoint.y; - var right = rectOrPoint.right || left; - var bottom = rectOrPoint.bottom || top_1; - targetRectangle = new (0, _utilities.Rectangle)(left, right, top_1, bottom); - } - if (!_isRectangleWithinBounds(targetRectangle, bounds)) { - var outOfBounds = _getOutOfBoundsEdges(targetRectangle, bounds); - for(var _i = 0, outOfBounds_1 = outOfBounds; _i < outOfBounds_1.length; _i++){ - var direction = outOfBounds_1[_i]; - targetRectangle[(0, _positioningTypes.RectangleEdge)[direction]] = bounds[(0, _positioningTypes.RectangleEdge)[direction]]; - } + ); + var GlobalClassNames$d = { + item: "ms-ContextualMenu-item", + divider: "ms-ContextualMenu-divider", + root: "ms-ContextualMenu-link", + isChecked: "is-checked", + isExpanded: "is-expanded", + isDisabled: "is-disabled", + linkContent: "ms-ContextualMenu-linkContent", + linkContentMenu: "ms-ContextualMenu-linkContent", + icon: "ms-ContextualMenu-icon", + iconColor: "ms-ContextualMenu-iconColor", + checkmarkIcon: "ms-ContextualMenu-checkmarkIcon", + subMenuIcon: "ms-ContextualMenu-submenuIcon", + label: "ms-ContextualMenu-itemText", + secondaryText: "ms-ContextualMenu-secondaryText", + splitMenu: "ms-ContextualMenu-splitMenu", + screenReaderText: "ms-ContextualMenu-screenReaderText" + }; + var getItemClassNames = memoizeFunction(function(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className2) { + var _a2, _b2, _c2, _d2; + var styles = getMenuItemStyles(theme); + var classNames2 = getGlobalClassNames(GlobalClassNames$d, theme); + return mergeStyleSets({ + item: [classNames2.item, styles.item, itemClassName], + divider: [classNames2.divider, styles.divider, dividerClassName], + root: [ + classNames2.root, + styles.root, + checked && [classNames2.isChecked, styles.rootChecked], + isAnchorLink && styles.anchorLink, + expanded && [classNames2.isExpanded, styles.rootExpanded], + disabled && [classNames2.isDisabled, styles.rootDisabled], + !disabled && !expanded && [ + { + selectors: (_a2 = { + ":hover": styles.rootHovered, + ":active": styles.rootPressed + }, // eslint-disable-next-line @fluentui/max-len + _a2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _a2[".".concat(IsFocusVisibleClassName, " &:hover, :host(.").concat(IsFocusVisibleClassName, ") &:hover")] = { + background: "inherit;" + }, _a2) + } + ], + className2 + ], + splitPrimary: [ + styles.root, + { + width: "calc(100% - ".concat(CONTEXTUAL_SPLIT_MENU_MINWIDTH, ")") + }, + checked && ["is-checked", styles.rootChecked], + (disabled || primaryDisabled) && ["is-disabled", styles.rootDisabled], + !(disabled || primaryDisabled) && !checked && [ + { + selectors: (_b2 = { + ":hover": styles.rootHovered + }, // when hovering over the splitPrimary also affect the splitMenu + _b2[":hover ~ .".concat(classNames2.splitMenu)] = styles.rootHovered, _b2[":active"] = styles.rootPressed, // eslint-disable-next-line @fluentui/max-len + _b2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _b2[".".concat(IsFocusVisibleClassName, " &:hover, :host(.").concat(IsFocusVisibleClassName, ") &:hover")] = { + background: "inherit;" + }, _b2) + } + ] + ], + splitMenu: [ + classNames2.splitMenu, + styles.root, + { + flexBasis: "0", + padding: "0 8px", + minWidth: CONTEXTUAL_SPLIT_MENU_MINWIDTH + }, + expanded && ["is-expanded", styles.rootExpanded], + disabled && ["is-disabled", styles.rootDisabled], + !disabled && !expanded && [ + { + selectors: (_c2 = { + ":hover": styles.rootHovered, + ":active": styles.rootPressed + }, // eslint-disable-next-line @fluentui/max-len + _c2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _c2[".".concat(IsFocusVisibleClassName, " &:hover, :host(.").concat(IsFocusVisibleClassName, ") &:hover")] = { + background: "inherit;" + }, _c2) + } + ] + ], + anchorLink: styles.anchorLink, + linkContent: [classNames2.linkContent, styles.linkContent], + linkContentMenu: [ + classNames2.linkContentMenu, + styles.linkContent, + { + justifyContent: "center" + } + ], + icon: [ + classNames2.icon, + knownIcon && styles.iconColor, + styles.icon, + iconClassName, + disabled && [classNames2.isDisabled, styles.iconDisabled] + ], + iconColor: styles.iconColor, + checkmarkIcon: [classNames2.checkmarkIcon, knownIcon && styles.checkmarkIcon, styles.icon, iconClassName], + subMenuIcon: [ + classNames2.subMenuIcon, + styles.subMenuIcon, + subMenuClassName, + expanded && { color: theme.palette.neutralPrimary }, + disabled && [styles.iconDisabled] + ], + label: [classNames2.label, styles.label], + secondaryText: [classNames2.secondaryText, styles.secondaryText], + splitContainer: [ + styles.splitButtonFlexContainer, + !disabled && !checked && [ + { + selectors: (_d2 = {}, // eslint-disable-next-line @fluentui/max-len + _d2[".".concat(IsFocusVisibleClassName, " &:focus, .").concat(IsFocusVisibleClassName, " &:focus:hover, :host(.").concat(IsFocusVisibleClassName, ") &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus:hover")] = styles.rootFocused, _d2) + } + ] + ], + screenReaderText: [ + classNames2.screenReaderText, + styles.screenReaderText, + hiddenContentStyle, + { visibility: "hidden" } + ] + }); + }); + var getItemStyles = function(props) { + var theme = props.theme, disabled = props.disabled, expanded = props.expanded, checked = props.checked, isAnchorLink = props.isAnchorLink, knownIcon = props.knownIcon, itemClassName = props.itemClassName, dividerClassName = props.dividerClassName, iconClassName = props.iconClassName, subMenuClassName = props.subMenuClassName, primaryDisabled = props.primaryDisabled, className2 = props.className; + return getItemClassNames(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className2); + }; + var ContextualMenuItem = styled(ContextualMenuItemBase, getItemStyles, void 0, { scope: "ContextualMenuItem" }); + var ContextualMenuItemWrapper = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuItemWrapper2, _super); + function ContextualMenuItemWrapper2(props) { + var _this = _super.call(this, props) || this; + _this._onItemMouseEnter = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseEnter = _a2.onItemMouseEnter; + if (onItemMouseEnter) { + onItemMouseEnter(item, ev, ev.currentTarget); + } + }; + _this._onItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemClickBase = _a2.onItemClickBase; + if (onItemClickBase) { + onItemClickBase(item, ev, ev.currentTarget); + } + }; + _this._onItemMouseLeave = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseLeave = _a2.onItemMouseLeave; + if (onItemMouseLeave) { + onItemMouseLeave(item, ev); + } + }; + _this._onItemKeyDown = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemKeyDown = _a2.onItemKeyDown; + if (onItemKeyDown) { + onItemKeyDown(item, ev); + } + }; + _this._onItemMouseMove = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseMove = _a2.onItemMouseMove; + if (onItemMouseMove) { + onItemMouseMove(item, ev, ev.currentTarget); + } + }; + _this._getSubmenuTarget = function() { + return void 0; + }; + initializeComponentRef(_this); + return _this; + } + ContextualMenuItemWrapper2.prototype.shouldComponentUpdate = function(newProps) { + return !shallowCompare(newProps, this.props); + }; + return ContextualMenuItemWrapper2; + })(React__namespace.Component) + ); + var KTP_PREFIX = "ktp"; + var KTP_SEPARATOR = "-"; + var DATAKTP_TARGET = "data-ktp-target"; + var DATAKTP_EXECUTE_TARGET = "data-ktp-execute-target"; + var KTP_LAYER_ID = "ktp-layer-id"; + var KeytipEvents; + (function(KeytipEvents2) { + KeytipEvents2.KEYTIP_ADDED = "keytipAdded"; + KeytipEvents2.KEYTIP_REMOVED = "keytipRemoved"; + KeytipEvents2.KEYTIP_UPDATED = "keytipUpdated"; + KeytipEvents2.PERSISTED_KEYTIP_ADDED = "persistedKeytipAdded"; + KeytipEvents2.PERSISTED_KEYTIP_REMOVED = "persistedKeytipRemoved"; + KeytipEvents2.PERSISTED_KEYTIP_EXECUTE = "persistedKeytipExecute"; + KeytipEvents2.ENTER_KEYTIP_MODE = "enterKeytipMode"; + KeytipEvents2.EXIT_KEYTIP_MODE = "exitKeytipMode"; + })(KeytipEvents || (KeytipEvents = {})); + var KeytipManager = ( + /** @class */ + (function() { + function KeytipManager2() { + this.keytips = {}; + this.persistedKeytips = {}; + this.sequenceMapping = {}; + this.inKeytipMode = false; + this.shouldEnterKeytipMode = true; + this.delayUpdatingKeytipChange = false; + } + KeytipManager2.getInstance = function() { + return this._instance; + }; + KeytipManager2.prototype.init = function(delayUpdatingKeytipChange) { + this.delayUpdatingKeytipChange = delayUpdatingKeytipChange; + }; + KeytipManager2.prototype.register = function(keytipProps, persisted) { + if (persisted === void 0) { + persisted = false; + } + var props = keytipProps; + if (!persisted) { + props = this.addParentOverflow(keytipProps); + this.sequenceMapping[props.keySequences.toString()] = props; + } + var uniqueKeytip = this._getUniqueKtp(props); + persisted ? this.persistedKeytips[uniqueKeytip.uniqueID] = uniqueKeytip : this.keytips[uniqueKeytip.uniqueID] = uniqueKeytip; + if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { + var event_1 = persisted ? KeytipEvents.PERSISTED_KEYTIP_ADDED : KeytipEvents.KEYTIP_ADDED; + EventGroup.raise(this, event_1, { + keytip: props, + uniqueID: uniqueKeytip.uniqueID + }); + } + return uniqueKeytip.uniqueID; + }; + KeytipManager2.prototype.update = function(keytipProps, uniqueID) { + var newKeytipProps = this.addParentOverflow(keytipProps); + var uniqueKeytip = this._getUniqueKtp(newKeytipProps, uniqueID); + var oldKeyTip = this.keytips[uniqueID]; + if (oldKeyTip) { + uniqueKeytip.keytip.visible = oldKeyTip.keytip.visible; + this.keytips[uniqueID] = uniqueKeytip; + delete this.sequenceMapping[oldKeyTip.keytip.keySequences.toString()]; + this.sequenceMapping[uniqueKeytip.keytip.keySequences.toString()] = uniqueKeytip.keytip; + if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { + EventGroup.raise(this, KeytipEvents.KEYTIP_UPDATED, { + keytip: uniqueKeytip.keytip, + uniqueID: uniqueKeytip.uniqueID + }); + } + } + }; + KeytipManager2.prototype.unregister = function(keytipToRemove, uniqueID, persisted) { + if (persisted === void 0) { + persisted = false; + } + persisted ? delete this.persistedKeytips[uniqueID] : delete this.keytips[uniqueID]; + !persisted && delete this.sequenceMapping[keytipToRemove.keySequences.toString()]; + var event2 = persisted ? KeytipEvents.PERSISTED_KEYTIP_REMOVED : KeytipEvents.KEYTIP_REMOVED; + if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { + EventGroup.raise(this, event2, { + keytip: keytipToRemove, + uniqueID + }); + } + }; + KeytipManager2.prototype.enterKeytipMode = function() { + EventGroup.raise(this, KeytipEvents.ENTER_KEYTIP_MODE); + }; + KeytipManager2.prototype.exitKeytipMode = function() { + EventGroup.raise(this, KeytipEvents.EXIT_KEYTIP_MODE); + }; + KeytipManager2.prototype.getKeytips = function() { + var _this = this; + return Object.keys(this.keytips).map(function(key2) { + return _this.keytips[key2].keytip; + }); + }; + KeytipManager2.prototype.addParentOverflow = function(keytipProps) { + var fullSequence = __spreadArray([], keytipProps.keySequences, true); + fullSequence.pop(); + if (fullSequence.length !== 0) { + var parentKeytip = this.sequenceMapping[fullSequence.toString()]; + if (parentKeytip && parentKeytip.overflowSetSequence) { + return __assign$1(__assign$1({}, keytipProps), { overflowSetSequence: parentKeytip.overflowSetSequence }); + } } - } else targetRectangle = new (0, _utilities.Rectangle)(0, 0, 0, 0); - return targetRectangle; -} -/** - * If max height is less than zero it returns the bounds height instead. - */ function _getMaxHeightFromTargetRectangle(targetRectangle, targetEdge, gapSpace, bounds, coverTarget) { - var maxHeight = 0; - var directionalHint = DirectionalDictionary[targetEdge]; - // If cover target is set, then the max height should be calculated using the opposite of the target edge since - // that's the direction that the callout will expand in. - // For instance, if the directionalhint is bottomLeftEdge then the callout will position so it's bottom edge - // is aligned with the bottom of the target and expand up towards the top of the screen and the calculated max height - // is (bottom of target) - (top of screen) - gapSpace. - var target = coverTarget ? directionalHint.targetEdge * -1 : directionalHint.targetEdge; - if (target === (0, _positioningTypes.RectangleEdge).top) maxHeight = _getEdgeValue(targetRectangle, directionalHint.targetEdge) - bounds.top - gapSpace; - else if (target === (0, _positioningTypes.RectangleEdge).bottom) maxHeight = bounds.bottom - _getEdgeValue(targetRectangle, directionalHint.targetEdge) - gapSpace; - else maxHeight = bounds.bottom - targetRectangle.top - gapSpace; - return maxHeight > 0 ? maxHeight : bounds.height; -} -function _positionElementRelative(props, elementToPosition, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight) { - if (shouldScroll === void 0) shouldScroll = false; - var gap = props.gapSpace ? props.gapSpace : 0; - var targetRect = _getTargetRect(boundingRect, props.target); - var positionData = _getAlignmentData(_getPositionData(props.directionalHint, props.directionalHintForRTL, previousPositions), targetRect, boundingRect, props.coverTarget, props.alignTargetEdge); - var positionedElement = _positionElementWithinBounds(_getRectangleFromElement(elementToPosition), targetRect, boundingRect, positionData, gap, shouldScroll, minimumScrollResizeHeight, props.directionalHintFixed, props.coverTarget); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, positionedElement), { - targetRectangle: targetRect - }); -} -function _finalizePositionData(positionedElement, hostElement, bounds, coverTarget, doNotFinalizeReturnEdge) { - var finalizedElement = _finalizeElementPosition(positionedElement.elementRectangle, hostElement, positionedElement.targetEdge, bounds, positionedElement.alignmentEdge, coverTarget, doNotFinalizeReturnEdge, positionedElement.forcedInBounds); - return { - elementPosition: finalizedElement, - targetEdge: positionedElement.targetEdge, - alignmentEdge: positionedElement.alignmentEdge - }; -} -function _positionElement(props, hostElement, elementToPosition, previousPositions, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new (0, _utilities.Rectangle)(0, theWin.innerWidth - (0, _utilities.getScrollbarWidth)(), 0, theWin.innerHeight); - var positionedElement = _positionElementRelative(props, elementToPosition, boundingRect, previousPositions); - return _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget); -} -function _calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { - if (beakWidth === void 0) beakWidth = 0; - if (gapSpace === void 0) gapSpace = 0; - return _calculateActualBeakWidthInPixels(isBeakVisible ? beakWidth : 0) / 2 + gapSpace; -} -function _positionCallout(props, hostElement, callout, previousPositions, shouldScroll, minimumScrollResizeHeight, doNotFinalizeReturnEdge, win) { - if (shouldScroll === void 0) shouldScroll = false; - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - var beakWidth = props.isBeakVisible ? props.beakWidth || 0 : 0; - var gap = _calculateGapSpace(props.isBeakVisible, props.beakWidth, props.gapSpace); - var positionProps = props; - positionProps.gapSpace = gap; - var boundingRect = props.bounds ? _getRectangleFromIRect(props.bounds) : new (0, _utilities.Rectangle)(0, theWin.innerWidth - (0, _utilities.getScrollbarWidth)(), 0, theWin.innerHeight); - var positionedElement = _positionElementRelative(positionProps, callout, boundingRect, previousPositions, shouldScroll, minimumScrollResizeHeight); - var beakPositioned = _positionBeak(beakWidth, positionedElement); - var finalizedBeakPosition = _finalizeBeakPosition(positionedElement, beakPositioned, boundingRect); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, _finalizePositionData(positionedElement, hostElement, boundingRect, props.coverTarget, doNotFinalizeReturnEdge)), { - beakPosition: finalizedBeakPosition + return keytipProps; + }; + KeytipManager2.prototype.menuExecute = function(overflowButtonSequences, keytipSequences) { + EventGroup.raise(this, KeytipEvents.PERSISTED_KEYTIP_EXECUTE, { + overflowButtonSequences, + keytipSequences + }); + }; + KeytipManager2.prototype._getUniqueKtp = function(keytipProps, uniqueID) { + if (uniqueID === void 0) { + uniqueID = getId(); + } + return { keytip: __assign$1({}, keytipProps), uniqueID }; + }; + KeytipManager2._instance = new KeytipManager2(); + return KeytipManager2; + })() + ); + function sequencesToID(keySequences) { + return keySequences.reduce(function(prevValue, keySequence) { + return prevValue + KTP_SEPARATOR + keySequence.split("").join(KTP_SEPARATOR); + }, KTP_PREFIX); + } + function mergeOverflows(keySequences, overflowKeySequences) { + var overflowSequenceLen = overflowKeySequences.length; + var overflowSequence = __spreadArray([], overflowKeySequences, true).pop(); + var newKeySequences = __spreadArray([], keySequences, true); + return addElementAtIndex(newKeySequences, overflowSequenceLen - 1, overflowSequence); + } + function getAriaDescribedBy(keySequences) { + var describedby = " " + KTP_LAYER_ID; + if (!keySequences.length) { + return describedby; + } + return describedby + " " + sequencesToID(keySequences); + } + function useKeytipData(options2) { + var uniqueId = React__namespace.useRef(void 0); + var keytipProps = options2.keytipProps ? __assign$1({ disabled: options2.disabled }, options2.keytipProps) : void 0; + var keytipManager = useConst(KeytipManager.getInstance()); + var prevOptions = usePrevious(options2); + useIsomorphicLayoutEffect(function() { + if (uniqueId.current && keytipProps && ((prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.keytipProps) !== options2.keytipProps || (prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.disabled) !== options2.disabled)) { + keytipManager.update(keytipProps, uniqueId.current); + } }); -} -function _positionCard(props, hostElement, callout, previousPositions, win) { - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - return _positionCallout(props, hostElement, callout, previousPositions, false, undefined, true, theWin); -} -function _getRectangleFromTarget(target) { - var _a, _b, _c, _d; - var mouseTarget = target; - var elementTarget = target; - var rectOrPointTarget = target; - var targetRect; - // eslint-disable-next-line deprecation/deprecation - var left = (_a = rectOrPointTarget.left) !== null && _a !== void 0 ? _a : rectOrPointTarget.x; - // eslint-disable-next-line deprecation/deprecation - var top = (_b = rectOrPointTarget.top) !== null && _b !== void 0 ? _b : rectOrPointTarget.y; - var right = (_c = rectOrPointTarget.right) !== null && _c !== void 0 ? _c : left; - var bottom = (_d = rectOrPointTarget.bottom) !== null && _d !== void 0 ? _d : top; - // eslint-disable-next-line no-extra-boolean-cast -- may not actually be a MouseEvent - if (!!mouseTarget.stopPropagation) targetRect = new (0, _utilities.Rectangle)(mouseTarget.clientX, mouseTarget.clientX, mouseTarget.clientY, mouseTarget.clientY); - else if (left !== undefined && top !== undefined) targetRect = new (0, _utilities.Rectangle)(left, right, top, bottom); - else targetRect = _getRectangleFromElement(elementTarget); - return targetRect; -} -var __positioningTestPackage = { - _finalizePositionData: _finalizePositionData, - _finalizeBeakPosition: _finalizeBeakPosition, - _calculateActualBeakWidthInPixels: _calculateActualBeakWidthInPixels, - _positionElementWithinBounds: _positionElementWithinBounds, - _positionBeak: _positionBeak, - _getPositionData: _getPositionData, - _getMaxHeightFromTargetRectangle: _getMaxHeightFromTargetRectangle -}; -function positionElement(props, hostElement, elementToPosition, previousPositions, win) { - return _positionElement(props, hostElement, elementToPosition, previousPositions, win); -} -function positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, win) { - return _positionCallout(props, hostElement, elementToPosition, previousPositions, shouldScroll, minimumScrollResizeHeight, undefined, win); -} -function positionCard(props, hostElement, elementToPosition, previousPositions, win) { - return _positionCard(props, hostElement, elementToPosition, previousPositions, win); -} -function getMaxHeight(target, targetEdge, gapSpace, bounds, coverTarget, win) { - if (gapSpace === void 0) gapSpace = 0; - var theWin = win !== null && win !== void 0 ? win : (0, _utilities.getWindow)(); - var targetRect = _getRectangleFromTarget(target); - var boundingRectangle = bounds ? _getRectangleFromIRect(bounds) : new (0, _utilities.Rectangle)(0, theWin.innerWidth - (0, _utilities.getScrollbarWidth)(), 0, theWin.innerHeight); - return _getMaxHeightFromTargetRectangle(targetRect, targetEdge, gapSpace, boundingRectangle, coverTarget); -} -function getOppositeEdge(edge) { - return edge * -1; -} -function _getBoundsFromTargetWindow(target, targetWindow) { - var segments = undefined; - if (targetWindow.getWindowSegments) segments = targetWindow.getWindowSegments(); - // Identify if we're dealing with single screen scenarios. - if (segments === undefined || segments.length <= 1) return { - top: 0, - left: 0, - right: targetWindow.innerWidth, - bottom: targetWindow.innerHeight, - width: targetWindow.innerWidth, - height: targetWindow.innerHeight - }; - // Logic for determining dual screen scenarios. - var x = 0; - var y = 0; - // If the target is an Element get coordinates for its center. - if (target !== null && !!target.getBoundingClientRect) { - var clientRect = target.getBoundingClientRect(); - x = (clientRect.left + clientRect.right) / 2; - y = (clientRect.top + clientRect.bottom) / 2; - } else if (target !== null) { - // eslint-disable-next-line deprecation/deprecation - x = target.left || target.x; - // eslint-disable-next-line deprecation/deprecation - y = target.top || target.y; - } - var bounds = { - top: 0, - left: 0, - right: 0, - bottom: 0, - width: 0, - height: 0 + useIsomorphicLayoutEffect(function() { + if (keytipProps) { + uniqueId.current = keytipManager.register(keytipProps); + } + return function() { + keytipProps && keytipManager.unregister(keytipProps, uniqueId.current); + }; + }, []); + var nativeKeytipProps = { + ariaDescribedBy: options2.ariaDescribedBy, + keytipId: void 0 }; - // Define which window segment are the coordinates in and calculate bounds based on that. - for(var _i = 0, segments_1 = segments; _i < segments_1.length; _i++){ - var segment = segments_1[_i]; - if (x && segment.left <= x && segment.right >= x && y && segment.top <= y && segment.bottom >= y) bounds = { - top: segment.top, - left: segment.left, - right: segment.right, - bottom: segment.bottom, - width: segment.width, - height: segment.height - }; + if (keytipProps) { + nativeKeytipProps = getKeytipData(keytipManager, keytipProps, options2.ariaDescribedBy); } - return bounds; -} -function getBoundsFromTargetWindow(target, targetWindow) { - return _getBoundsFromTargetWindow(target, targetWindow); -} -function calculateGapSpace(isBeakVisible, beakWidth, gapSpace) { - return _calculateGapSpace(isBeakVisible, beakWidth, gapSpace); -} -function getRectangleFromTarget(target) { - return _getRectangleFromTarget(target); -} - -},{"tslib":"9gizs","../../common/DirectionalHint":"avdAc","../../Utilities":"1NZCy","./positioning.types":"g1lRH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g1lRH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RectangleEdge", ()=>RectangleEdge); -parcelHelpers.export(exports, "Position", ()=>Position); -var RectangleEdge; -(function(RectangleEdge) { - RectangleEdge[RectangleEdge["top"] = 1] = "top"; - RectangleEdge[RectangleEdge["bottom"] = -1] = "bottom"; - RectangleEdge[RectangleEdge["left"] = 2] = "left"; - RectangleEdge[RectangleEdge["right"] = -2] = "right"; -})(RectangleEdge || (RectangleEdge = {})); -var Position; -(function(Position) { - Position[Position["top"] = 0] = "top"; - Position[Position["bottom"] = 1] = "bottom"; - Position[Position["start"] = 2] = "start"; - Position[Position["end"] = 3] = "end"; -})(Position || (Position = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bWPOk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./utilities/positioning/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./utilities/positioning/index":"bNxI6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bNxI6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getBoundsFromTargetWindow", ()=>(0, _positioning.getBoundsFromTargetWindow)); -parcelHelpers.export(exports, "getMaxHeight", ()=>(0, _positioning.getMaxHeight)); -parcelHelpers.export(exports, "getOppositeEdge", ()=>(0, _positioning.getOppositeEdge)); -parcelHelpers.export(exports, "positionCallout", ()=>(0, _positioning.positionCallout)); -parcelHelpers.export(exports, "positionCard", ()=>(0, _positioning.positionCard)); -parcelHelpers.export(exports, "positionElement", ()=>(0, _positioning.positionElement)); -var _positioning = require("./positioning"); -var _positioningTypes = require("./positioning.types"); -parcelHelpers.exportAll(_positioningTypes, exports); - -},{"./positioning":"8HbU4","./positioning.types":"g1lRH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOJlv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Popup/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Popup/index":"b83nM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b83nM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _popup = require("./Popup"); -parcelHelpers.exportAll(_popup, exports); -var _popupTypes = require("./Popup.types"); -parcelHelpers.exportAll(_popupTypes, exports); - -},{"./Popup":"3vnAQ","./Popup.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3vnAQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Popup", ()=>Popup); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -function useScrollbarAsync(props, root) { - var async = (0, _reactHooks.useAsync)(); - var _a = _react.useState(false), needsVerticalScrollBarState = _a[0], setNeedsVerticalScrollBar = _a[1]; - _react.useEffect(function() { - async.requestAnimationFrame(function() { - var _a; - // If overflowY is overridden, don't waste time calculating whether the scrollbar is necessary. - if (props.style && props.style.overflowY) return; - var needsVerticalScrollBar = false; - if (root && root.current && ((_a = root.current) === null || _a === void 0 ? void 0 : _a.firstElementChild)) { - // ClientHeight returns the client height of an element rounded to an - // integer. On some browsers at different zoom levels this rounding - // can generate different results for the root container and child even - // though they are the same height. This causes us to show a scroll bar - // when not needed. Ideally we would use BoundingClientRect().height - // instead however seems that the API is 90% slower than using ClientHeight. - // Therefore instead we will calculate the difference between heights and - // allow for a 1px difference to still be considered ok and not show the - // scroll bar. - var rootHeight = root.current.clientHeight; - var firstChildHeight = root.current.firstElementChild.clientHeight; - if (rootHeight > 0 && firstChildHeight > rootHeight) needsVerticalScrollBar = firstChildHeight - rootHeight > 1; - } - if (needsVerticalScrollBarState !== needsVerticalScrollBar) setNeedsVerticalScrollBar(needsVerticalScrollBar); + return nativeKeytipProps; + } + function getKeytipData(keytipManager, keytipProps, describedByPrepend) { + var newKeytipProps = keytipManager.addParentOverflow(keytipProps); + var ariaDescribedBy = mergeAriaAttributeValues(describedByPrepend, getAriaDescribedBy(newKeytipProps.keySequences)); + var keySequences = __spreadArray([], newKeytipProps.keySequences, true); + if (newKeytipProps.overflowSetSequence) { + keySequences = mergeOverflows(keySequences, newKeytipProps.overflowSetSequence); + } + var keytipId = sequencesToID(keySequences); + return { + ariaDescribedBy, + keytipId + }; + } + var KeytipData = function(props) { + var _a2; + var children2 = props.children, keytipDataProps = __rest(props, ["children"]); + var _b2 = useKeytipData(keytipDataProps), keytipId = _b2.keytipId, ariaDescribedBy = _b2.ariaDescribedBy; + return children2((_a2 = {}, _a2[DATAKTP_TARGET] = keytipId, _a2[DATAKTP_EXECUTE_TARGET] = keytipId, _a2["aria-describedby"] = ariaDescribedBy, _a2)); + }; + var ContextualMenuAnchor = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuAnchor2, _super); + function ContextualMenuAnchor2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._anchor = React__namespace.createRef(); + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); }); - return function() { - return async.dispose(); + _this._getSubmenuTarget = function() { + return _this._anchor.current ? _this._anchor.current : void 0; }; - }); - return needsVerticalScrollBarState; -} -function defaultFocusRestorer(options) { - var originalElement = options.originalElement, containsFocus = options.containsFocus; - if (originalElement && containsFocus && originalElement !== (0, _utilities.getWindow)()) // Make sure that the focus method actually exists - // In some cases the object might exist but not be a real element. - // This is primarily for IE 11 and should be removed once IE 11 is no longer in use. - // This is wrapped in a setTimeout because of a React 16 bug that is resolved in 17. - // Once we move to 17, the setTimeout should be removed (ref: https://github.com/facebook/react/issues/17894#issuecomment-656094405) - setTimeout(function() { - var _a; - (_a = originalElement.focus) === null || _a === void 0 || _a.call(originalElement); - }, 0); -} -function useRestoreFocus(props, root) { - var _a = props.onRestoreFocus, onRestoreFocus = _a === void 0 ? defaultFocusRestorer : _a; - var originalFocusedElement = _react.useRef(); - var containsFocus = _react.useRef(false); - _react.useEffect(function() { - originalFocusedElement.current = (0, _utilities.getDocument)().activeElement; - if ((0, _utilities.doesElementContainFocus)(root.current)) containsFocus.current = true; - return function() { - var _a; - onRestoreFocus === null || onRestoreFocus === void 0 || onRestoreFocus({ - originalElement: originalFocusedElement.current, - containsFocus: containsFocus.current, - documentContainsFocus: ((_a = (0, _utilities.getDocument)()) === null || _a === void 0 ? void 0 : _a.hasFocus()) || false - }); - // De-reference DOM Node to avoid retainment via transpiled closure of _onKeyDown - originalFocusedElement.current = undefined; + _this._onItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemClick = _a2.onItemClick; + if (onItemClick) { + onItemClick(item, ev); + } }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run on first render - }, []); - (0, _reactHooks.useOnEvent)(root, 'focus', _react.useCallback(function() { - containsFocus.current = true; - }, []), true); - (0, _reactHooks.useOnEvent)(root, 'blur', _react.useCallback(function(ev) { - /** The popup should update this._containsFocus when: - * relatedTarget exists AND - * the relatedTarget is not contained within the popup. - * If the relatedTarget is within the popup, that means the popup still has focus - * and focused moved from one element to another within the popup. - * If relatedTarget is undefined or null that usually means that a - * keyboard event occurred and focus didn't change - */ if (root.current && ev.relatedTarget && !root.current.contains(ev.relatedTarget)) containsFocus.current = false; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run on first render - }, []), true); -} -function useHideSiblingNodes(props, root) { - // eslint-disable-next-line deprecation/deprecation - var shouldHideSiblings = String(props['aria-modal']).toLowerCase() === 'true' && props.enableAriaHiddenSiblings; - _react.useEffect(function() { - if (!(shouldHideSiblings && root.current)) return; - var unmodalize = (0, _utilities.modalize)(root.current); - return unmodalize; - }, [ - root, - shouldHideSiblings - ]); -} -var Popup = _react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var props = (0, _utilities.getPropsWithDefaults)({ - shouldRestoreFocus: true, - enableAriaHiddenSiblings: true - }, propsWithoutDefaults); - var root = _react.useRef(); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(root, forwardedRef); - useHideSiblingNodes(props, root); - useRestoreFocus(props, root); - var role = props.role, className = props.className, ariaLabel = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, style = props.style, children = props.children, onDismiss = props.onDismiss; - var needsVerticalScrollBar = useScrollbarAsync(props, root); - var onKeyDown = _react.useCallback(function(ev) { - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).escape: - if (onDismiss) { - onDismiss(ev); - ev.preventDefault(); - ev.stopPropagation(); - } - break; + _this._renderAriaDescription = function(ariaDescription, className2) { + return ariaDescription ? React__namespace.createElement("span", { id: _this._ariaDescriptionId, className: className2 }, ariaDescription) : null; + }; + return _this; + } + ContextualMenuAnchor2.prototype.render = function() { + var _this = this; + var _a2 = this.props, item = _a2.item, classNames2 = _a2.classNames, index2 = _a2.index, focusableElementIndex = _a2.focusableElementIndex, totalItemCount = _a2.totalItemCount, hasCheckmarks = _a2.hasCheckmarks, hasIcons = _a2.hasIcons, expandedMenuItemKey = _a2.expandedMenuItemKey, onItemClick = _a2.onItemClick, openSubMenu = _a2.openSubMenu, dismissSubMenu = _a2.dismissSubMenu, dismissMenu = _a2.dismissMenu; + var ChildrenRenderer = ContextualMenuItem; + if (this.props.item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.item.contextualMenuItemAs, ChildrenRenderer); } - }, [ - onDismiss - ]); - var win = (0, _reactWindowProvider.useWindow)(); - (0, _reactHooks.useOnEvent)(win, 'keydown', onKeyDown); - return _react.createElement("div", (0, _tslib.__assign)({ - ref: mergedRootRef - }, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)), { - className: className, - role: role, - "aria-label": ariaLabel, - "aria-labelledby": ariaLabelledBy, - "aria-describedby": ariaDescribedBy, - onKeyDown: onKeyDown, - style: (0, _tslib.__assign)({ - overflowY: needsVerticalScrollBar ? 'scroll' : undefined, - outline: 'none' - }, style) - }), children); -}); -Popup.displayName = 'Popup'; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@fluentui/react-hooks":"2LHjM","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55K1t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useDocumentEx", ()=>useDocumentEx); -parcelHelpers.export(exports, "useWindowEx", ()=>useWindowEx); -parcelHelpers.export(exports, "getDocumentEx", ()=>getDocumentEx); -parcelHelpers.export(exports, "getWindowEx", ()=>getWindowEx); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var useDocumentEx = function() { - var _a; - // eslint-disable-next-line no-restricted-globals - return (_a = (0, _reactWindowProvider.useDocument)()) !== null && _a !== void 0 ? _a : typeof document !== 'undefined' ? document : undefined; -}; -var useWindowEx = function() { - var _a; - // eslint-disable-next-line no-restricted-globals - return (_a = (0, _reactWindowProvider.useWindow)()) !== null && _a !== void 0 ? _a : typeof window !== 'undefined' ? window : undefined; -}; -var getDocumentEx = function(ctx) { - var _a, _b; - // eslint-disable-next-line no-restricted-globals - return (_b = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.window) === null || _a === void 0 ? void 0 : _a.document) !== null && _b !== void 0 ? _b : typeof document !== 'undefined' ? document : undefined; -}; -var getWindowEx = function(ctx) { - var _a; - // eslint-disable-next-line no-restricted-globals - return (_a = ctx === null || ctx === void 0 ? void 0 : ctx.window) !== null && _a !== void 0 ? _a : typeof window !== 'undefined' ? window : undefined; -}; - -},{"@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bduHE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -function getBeakStyle(beakWidth) { - return { - height: beakWidth, - width: beakWidth - }; -} -var GlobalClassNames = { - container: 'ms-Callout-container', - root: 'ms-Callout', - beak: 'ms-Callout-beak', - beakCurtain: 'ms-Callout-beakCurtain', - calloutMain: 'ms-Callout-main' -}; -var getStyles = function(props) { - var _a; - var theme = props.theme, className = props.className, overflowYHidden = props.overflowYHidden, calloutWidth = props.calloutWidth, beakWidth = props.beakWidth, backgroundColor = props.backgroundColor, calloutMaxWidth = props.calloutMaxWidth, calloutMinWidth = props.calloutMinWidth, doNotLayer = props.doNotLayer; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var semanticColors = theme.semanticColors, effects = theme.effects; - return { - container: [ - classNames.container, - { - position: 'relative' - } - ], - root: [ - classNames.root, - theme.fonts.medium, - { - position: 'absolute', - display: 'flex', - zIndex: doNotLayer ? (0, _styling.ZIndexes).Layer : undefined, - boxSizing: 'border-box', - borderRadius: effects.roundedCorner2, - boxShadow: effects.elevation16, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - borderWidth: 1, - borderStyle: 'solid', - borderColor: 'WindowText' - }, _a) - }, - (0, _styling.focusClear)(), - className, - !!calloutWidth && { - width: calloutWidth - }, - !!calloutMaxWidth && { - maxWidth: calloutMaxWidth - }, - !!calloutMinWidth && { - minWidth: calloutMinWidth - } - ], - beak: [ - classNames.beak, - { - position: 'absolute', - backgroundColor: semanticColors.menuBackground, - boxShadow: 'inherit', - border: 'inherit', - boxSizing: 'border-box', - transform: 'rotate(45deg)' - }, - getBeakStyle(beakWidth), - backgroundColor && { - backgroundColor: backgroundColor - } - ], - beakCurtain: [ - classNames.beakCurtain, - { - position: 'absolute', - top: 0, - right: 0, - bottom: 0, - left: 0, - backgroundColor: semanticColors.menuBackground, - borderRadius: effects.roundedCorner2 - } - ], - calloutMain: [ - classNames.calloutMain, - { - backgroundColor: semanticColors.menuBackground, - overflowX: 'hidden', - overflowY: 'auto', - position: 'relative', - width: '100%', - borderRadius: effects.roundedCorner2 - }, - overflowYHidden && { - overflowY: 'hidden' - }, - backgroundColor && { - backgroundColor: backgroundColor - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hQjxQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _version = require("./version"); -var _index = require("./components/Layer/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./version":"6kzFC","./components/Layer/index":"60lMd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60lMd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createDefaultLayerHost", ()=>(0, _layerNotification.createDefaultLayerHost)); -parcelHelpers.export(exports, "cleanupDefaultLayerHost", ()=>(0, _layerNotification.cleanupDefaultLayerHost)); -parcelHelpers.export(exports, "getLayerHostSelector", ()=>(0, _layerNotification.getDefaultTarget)); -parcelHelpers.export(exports, "getLayerCount", ()=>(0, _layerNotification.getLayerCount)); -parcelHelpers.export(exports, "getLayerHost", ()=>(0, _layerNotification.getLayerHost)); -parcelHelpers.export(exports, "notifyHostChanged", ()=>(0, _layerNotification.notifyHostChanged)); -parcelHelpers.export(exports, "registerLayer", ()=>(0, _layerNotification.registerLayer)); -parcelHelpers.export(exports, "registerLayerHost", ()=>(0, _layerNotification.registerLayerHost)); -parcelHelpers.export(exports, "setLayerHostSelector", ()=>(0, _layerNotification.setDefaultTarget)); -parcelHelpers.export(exports, "unregisterLayer", ()=>(0, _layerNotification.unregisterLayer)); -parcelHelpers.export(exports, "unregisterLayerHost", ()=>(0, _layerNotification.unregisterLayerHost)); -parcelHelpers.export(exports, "getLayerStyles", ()=>(0, _layerStyles.getStyles)); -var _layer = require("./Layer"); -parcelHelpers.exportAll(_layer, exports); -var _layerBase = require("./Layer.base"); -parcelHelpers.exportAll(_layerBase, exports); -var _layerTypes = require("./Layer.types"); -parcelHelpers.exportAll(_layerTypes, exports); -var _layerHost = require("./LayerHost"); -parcelHelpers.exportAll(_layerHost, exports); -var _layerHostTypes = require("./LayerHost.types"); -parcelHelpers.exportAll(_layerHostTypes, exports); -var _layerNotification = require("./Layer.notification"); -var _layerStyles = require("./Layer.styles"); - -},{"./Layer":"bAxi9","./Layer.base":false,"./Layer.types":false,"./LayerHost":false,"./LayerHost.types":false,"./Layer.notification":false,"./Layer.styles":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bAxi9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Layer", ()=>Layer); -var _utilities = require("../../Utilities"); -var _layerBase = require("./Layer.base"); -var _layerStyles = require("./Layer.styles"); -var Layer = (0, _utilities.styled)((0, _layerBase.LayerBase), (0, _layerStyles.getStyles), undefined, { - scope: 'Layer', - fields: [ - 'hostId', - 'theme', - 'styles' - ] -}); - -},{"../../Utilities":"1NZCy","./Layer.base":"kgbHL","./Layer.styles":"doFKM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kgbHL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LayerBase", ()=>LayerBase); -var _tslib = require("tslib"); -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-ignore "react-portal-compat-context" uses v9 configs via path aliases -var _reactPortalCompatContext = require("@fluentui/react-portal-compat-context"); -var _react = require("react"); -var _reactDom = require("react-dom"); -var _fabric = require("../../Fabric"); -var _utilities = require("../../Utilities"); -var _layerNotification = require("./Layer.notification"); -var _reactHooks = require("@fluentui/react-hooks"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getFocusVisibility = function(providerRef) { - if (providerRef === null || providerRef === void 0 ? void 0 : providerRef.current) return providerRef.current.classList.contains((0, _utilities.IsFocusVisibleClassName)); - return false; -}; -var LayerBase = _react.forwardRef(function(props, ref) { - var registerPortalEl = (0, _reactPortalCompatContext.usePortalCompat)(); - var rootRef = _react.useRef(null); - var mergedRef = (0, _reactHooks.useMergedRefs)(rootRef, ref); - var layerRef = _react.useRef(); - var fabricElementRef = _react.useRef(null); - var focusContext = _react.useContext((0, _utilities.FocusRectsContext)); - // Tracks if the layer mount events need to be raised. - // Required to allow the DOM to render after the layer element is added. - var _a = _react.useState(false), needRaiseLayerMount = _a[0], setNeedRaiseLayerMount = _a[1]; - // Sets the focus visible className when the FocusRectsProvider for the layer is rendered - // This allows the current focus visibility style to be carried over to the layer content - var focusRectsRef = _react.useCallback(function(el) { - var isFocusVisible = getFocusVisibility(focusContext === null || focusContext === void 0 ? void 0 : focusContext.providerRef); - if (el && isFocusVisible) el.classList.add((0, _utilities.IsFocusVisibleClassName)); - }, [ - focusContext - ]); - var children = props.children, className = props.className, eventBubblingEnabled = props.eventBubblingEnabled, fabricProps = props.fabricProps, hostId = props.hostId, insertFirst = props.insertFirst, _b = props.onLayerDidMount, onLayerDidMount = _b === void 0 ? function() { - return undefined; - } : _b, // eslint-disable-next-line deprecation/deprecation - _c = props.onLayerMounted, // eslint-disable-next-line deprecation/deprecation - onLayerMounted = _c === void 0 ? function() { - return undefined; - } : _c, onLayerWillUnmount = props.onLayerWillUnmount, styles = props.styles, theme = props.theme; - var fabricRef = (0, _reactHooks.useMergedRefs)(fabricElementRef, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.ref, focusRectsRef); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - isNotHost: !hostId - }); - // Returns the user provided hostId props element, the default target selector, - // or undefined if document doesn't exist. - var getHost = function(doc, shadowRoot) { - var _a, _b; - if (shadowRoot === void 0) shadowRoot = null; - var root = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : doc; - if (hostId) { - var layerHost = (0, _layerNotification.getLayerHost)(hostId); - if (layerHost) return (_a = layerHost.rootRef.current) !== null && _a !== void 0 ? _a : null; - return (_b = root.getElementById(hostId)) !== null && _b !== void 0 ? _b : null; - } else { - var defaultHostSelector = (0, _layerNotification.getDefaultTarget)(); - // Find the host. - var host = defaultHostSelector ? root.querySelector(defaultHostSelector) : null; - // If no host is available, create a container for injecting layers in. - // Having a container scopes layout computation. - if (!host) host = (0, _layerNotification.createDefaultLayerHost)(doc, shadowRoot); - return host; + if (this.props.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.contextualMenuItemAs, ChildrenRenderer); } - }; - // Removes the current layer element's parentNode and runs onLayerWillUnmount prop if provided. - var removeLayerElement = function() { - onLayerWillUnmount === null || onLayerWillUnmount === void 0 || onLayerWillUnmount(); - var elem = layerRef.current; - // Clear ref before removing from the DOM - layerRef.current = undefined; - if (elem && elem.parentNode) elem.parentNode.removeChild(elem); - }; - // If a doc or host exists, it will remove and update layer parentNodes. - var createLayerElement = function() { - var _a, _b, _c, _d; - var doc = (0, _utilities.getDocument)(rootRef.current); - var shadowRoot = ((_b = (_a = rootRef.current) === null || _a === void 0 ? void 0 : _a.getRootNode()) === null || _b === void 0 ? void 0 : _b.host) ? (_c = rootRef === null || rootRef === void 0 ? void 0 : rootRef.current) === null || _c === void 0 ? void 0 : _c.getRootNode() : undefined; - if (!doc || !doc && !shadowRoot) return; - var host = getHost(doc, shadowRoot); - if (!host) return; - // Tabster in V9 sets aria-hidden on the elements outside of the modal dialog. And it doesn't set aria-hidden - // on the virtual children of the dialog. But the host element itself is not a virtual child of a dialog, it - // might contain virtual children. noDirectAriaHidden flag makes Tabster to poke inside the element and set - // aria-hidden on the children (if they are not virtual children of the active V9 dialog) not on the host element. - // To avoid importing Tabster as a dependency here, we just set a flag on the host element which is checked by - // Tabster. - if (!host.__tabsterElementFlags) host.__tabsterElementFlags = {}; - host.__tabsterElementFlags.noDirectAriaHidden = true; - // Remove and re-create any previous existing layer elements. - removeLayerElement(); - var el = ((_d = host.ownerDocument) !== null && _d !== void 0 ? _d : doc).createElement('div'); - el.className = classNames.root; - (0, _utilities.setPortalAttribute)(el); - (0, _utilities.setVirtualParent)(el, rootRef.current); - insertFirst ? host.insertBefore(el, host.firstChild) : host.appendChild(el); - layerRef.current = el; - setNeedRaiseLayerMount(true); - }; - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - createLayerElement(); - // Check if the user provided a hostId prop and register the layer with the ID. - if (hostId) (0, _layerNotification.registerLayer)(hostId, createLayerElement); - var unregisterPortalEl = layerRef.current ? registerPortalEl(layerRef.current) : undefined; - return function() { - if (unregisterPortalEl) unregisterPortalEl(); - removeLayerElement(); - if (hostId) (0, _layerNotification.unregisterLayer)(hostId, createLayerElement); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should run if the hostId updates. - }, [ - hostId - ]); - _react.useEffect(function() { - if (layerRef.current && needRaiseLayerMount) { - onLayerMounted === null || onLayerMounted === void 0 || onLayerMounted(); - onLayerDidMount === null || onLayerDidMount === void 0 || onLayerDidMount(); - setNeedRaiseLayerMount(false); + var anchorRel = item.rel; + if (item.target && item.target.toLowerCase() === "_blank") { + anchorRel = anchorRel ? anchorRel : "nofollow noopener noreferrer"; } - }, [ - needRaiseLayerMount, - onLayerMounted, - onLayerDidMount - ]); - useDebugWarnings(props); - return _react.createElement("span", { - className: "ms-layer", - ref: mergedRef - }, layerRef.current && _reactDom.createPortal(_react.createElement((0, _utilities.FocusRectsProvider), { - layerRoot: true, - providerRef: fabricRef - }, _react.createElement((0, _fabric.Fabric), (0, _tslib.__assign)({}, !eventBubblingEnabled && getFilteredEvents(), fabricProps, { - className: (0, _utilities.css)(classNames.content, fabricProps === null || fabricProps === void 0 ? void 0 : fabricProps.className), - ref: fabricRef - }), children)), layerRef.current)); -}); -LayerBase.displayName = 'LayerBase'; -var filteredEventProps; -var onFilterEvent = function(ev) { - // We should just be able to check ev.bubble here and only stop events that are bubbling up. However, even though - // mouseenter and mouseleave do NOT bubble up, they are showing up as bubbling. Therefore we stop events based on - // event name rather than ev.bubble. - if (ev.eventPhase === Event.BUBBLING_PHASE && ev.type !== 'mouseenter' && ev.type !== 'mouseleave' && ev.type !== 'touchstart' && ev.type !== 'touchend') ev.stopPropagation(); -}; -function getFilteredEvents() { - if (!filteredEventProps) { - filteredEventProps = {}; - [ - 'onClick', - 'onContextMenu', - 'onDoubleClick', - 'onDrag', - 'onDragEnd', - 'onDragEnter', - 'onDragExit', - 'onDragLeave', - 'onDragOver', - 'onDragStart', - 'onDrop', - 'onMouseDown', - 'onMouseEnter', - 'onMouseLeave', - 'onMouseMove', - 'onMouseOver', - 'onMouseOut', - 'onMouseUp', - 'onTouchMove', - 'onTouchStart', - 'onTouchCancel', - 'onTouchEnd', - 'onKeyDown', - 'onKeyPress', - 'onKeyUp', - 'onFocus', - 'onBlur', - 'onChange', - 'onInput', - 'onInvalid', - 'onSubmit' - ].forEach(function(name) { - return filteredEventProps[name] = onFilterEvent; + var itemHasSubmenu = hasSubmenu(item); + var nativeProps = getNativeProps(item, anchorProperties); + var disabled = isItemDisabled(item); + var itemProps = item.itemProps, ariaDescription = item.ariaDescription; + var keytipProps = item.keytipProps; + if (keytipProps && itemHasSubmenu) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + if (ariaDescription) { + this._ariaDescriptionId = getId(); + } + var ariaDescribedByIds = mergeAriaAttributeValues(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : void 0, nativeProps["aria-describedby"]); + var additionalItemProperties = { + "aria-describedby": ariaDescribedByIds + }; + return React__namespace.createElement( + "div", + null, + React__namespace.createElement(KeytipData, { keytipProps: item.keytipProps, ariaDescribedBy: ariaDescribedByIds, disabled }, function(keytipAttributes) { + return React__namespace.createElement( + "a", + __assign$1({}, additionalItemProperties, nativeProps, keytipAttributes, { + ref: _this._anchor, + href: item.href, + target: item.target, + rel: anchorRel, + className: classNames2.root, + role: "menuitem", + "aria-haspopup": itemHasSubmenu || void 0, + "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : void 0, + "aria-posinset": focusableElementIndex + 1, + "aria-setsize": totalItemCount, + "aria-disabled": isItemDisabled(item), + // eslint-disable-next-line @typescript-eslint/no-deprecated + style: item.style, + onClick: _this._onItemClick, + onMouseEnter: _this._onItemMouseEnter, + onMouseLeave: _this._onItemMouseLeave, + onMouseMove: _this._onItemMouseMove, + onKeyDown: itemHasSubmenu ? _this._onItemKeyDown : void 0 + }), + React__namespace.createElement(ChildrenRenderer, __assign$1({ componentRef: item.componentRef, item, classNames: classNames2, index: index2, onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : void 0, hasIcons, openSubMenu, dismissSubMenu, dismissMenu, getSubmenuTarget: _this._getSubmenuTarget }, itemProps)), + _this._renderAriaDescription(ariaDescription, classNames2.screenReaderText) + ); + }) + ); + }; + return ContextualMenuAnchor2; + })(ContextualMenuItemWrapper) + ); + var ContextualMenuButton = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuButton2, _super); + function ContextualMenuButton2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._btn = React__namespace.createRef(); + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); }); - } - return filteredEventProps; -} -function useDebugWarnings(props) {} - -},{"tslib":"9gizs","@fluentui/react-portal-compat-context":"e83z8","react":"jGrId","react-dom":"1a3X3","../../Fabric":"gZZ0s","../../Utilities":"1NZCy","./Layer.notification":"gngXH","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e83z8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PortalCompatContextProvider", ()=>(0, _portalCompatContext.PortalCompatContextProvider)); -parcelHelpers.export(exports, "usePortalCompat", ()=>(0, _portalCompatContext.usePortalCompat)); -var _portalCompatContext = require("./PortalCompatContext"); - -},{"./PortalCompatContext":"envTF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"envTF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PortalCompatContextProvider", ()=>PortalCompatContextProvider); -parcelHelpers.export(exports, "usePortalCompat", ()=>usePortalCompat); -var _react = require("react"); -var PortalCompatContext = _react.createContext(undefined); -var portalCompatContextDefaultValue = function() { - return function() { - return undefined; - }; -}; -var PortalCompatContextProvider = PortalCompatContext.Provider; -function usePortalCompat() { - var _React_useContext; - return (_React_useContext = _react.useContext(PortalCompatContext)) !== null && _React_useContext !== void 0 ? _React_useContext : portalCompatContextDefaultValue; -} - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gZZ0s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Fabric/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Fabric/index":"ikc5I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ikc5I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _fabric = require("./Fabric"); -parcelHelpers.exportAll(_fabric, exports); -var _fabricBase = require("./Fabric.base"); -parcelHelpers.exportAll(_fabricBase, exports); -var _fabricTypes = require("./Fabric.types"); -parcelHelpers.exportAll(_fabricTypes, exports); - -},{"./Fabric":"ghXvG","./Fabric.base":false,"./Fabric.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ghXvG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fabric", ()=>Fabric); -var _utilities = require("../../Utilities"); -var _fabricBase = require("./Fabric.base"); -var _fabricStyles = require("./Fabric.styles"); -var Fabric = (0, _utilities.styled)((0, _fabricBase.FabricBase), (0, _fabricStyles.getStyles), undefined, { - scope: 'Fabric' -}); - -},{"../../Utilities":"1NZCy","./Fabric.base":"6xJxq","./Fabric.styles":"3SPki","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6xJxq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FabricBase", ()=>FabricBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var _reactHooks = require("@fluentui/react-hooks"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getFabricTheme = (0, _utilities.memoizeFunction)(function(theme, isRTL) { - return (0, _styling.createTheme)((0, _tslib.__assign)((0, _tslib.__assign)({}, theme), { - rtl: isRTL - })); -}); -var getDir = function(_a) { - var theme = _a.theme, dir = _a.dir; - var contextDir = (0, _utilities.getRTL)(theme) ? 'rtl' : 'ltr'; - var pageDir = (0, _utilities.getRTL)() ? 'rtl' : 'ltr'; - var componentDir = dir ? dir : contextDir; - return { - // If Fabric dir !== contextDir - // Or If contextDir !== pageDir - // Then we need to set dir of the Fabric root - rootDir: componentDir !== contextDir || componentDir !== pageDir ? componentDir : dir, - // If dir !== contextDir || pageDir - // then set contextual theme around content - needsTheme: componentDir !== contextDir - }; -}; -var FabricBase = _react.forwardRef(function(props, ref) { - var className = props.className, theme = props.theme, applyTheme = props.applyTheme, applyThemeToBody = props.applyThemeToBody, styles = props.styles; - var classNames = getClassNames(styles, { - theme: theme, - applyTheme: applyTheme, - className: className - }); - var rootElement = _react.useRef(null); - useApplyThemeToBody(applyThemeToBody, classNames, rootElement); - return _react.createElement(_react.Fragment, null, useRenderedContent(props, classNames, rootElement, ref)); -}); -FabricBase.displayName = 'FabricBase'; -function useRenderedContent(props, _a, rootElement, ref) { - var root = _a.root; - var _b = props.as, Root = _b === void 0 ? 'div' : _b, dir = props.dir, theme = props.theme; - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), [ - 'dir' - ]); - var _c = getDir(props), rootDir = _c.rootDir, needsTheme = _c.needsTheme; - var renderedContent = _react.createElement((0, _utilities.FocusRectsProvider), { - providerRef: rootElement - }, _react.createElement(Root, (0, _tslib.__assign)({ - dir: rootDir - }, divProps, { - className: root, - ref: (0, _reactHooks.useMergedRefs)(rootElement, ref) - }))); - // Create the contextual theme if component direction does not match parent direction. - if (needsTheme) // Disabling ThemeProvider here because theme doesn't need to be re-provided by ThemeProvider if dir has changed. - renderedContent = // eslint-disable-next-line deprecation/deprecation - _react.createElement((0, _utilities.Customizer), { - settings: { - theme: getFabricTheme(theme, dir === 'rtl') - } - }, renderedContent); - return renderedContent; -} -function useApplyThemeToBody(applyThemeToBody, _a, rootElement) { - var bodyThemed = _a.bodyThemed; - _react.useEffect(function() { - if (applyThemeToBody) { - var currentDoc_1 = (0, _utilities.getDocument)(rootElement.current); - if (currentDoc_1) { - currentDoc_1.body.classList.add(bodyThemed); - return function() { - currentDoc_1.body.classList.remove(bodyThemed); - }; - } + _this._renderAriaDescription = function(ariaDescription, className2) { + return ariaDescription ? React__namespace.createElement("span", { id: _this._ariaDescriptionId, className: className2 }, ariaDescription) : null; + }; + _this._getSubmenuTarget = function() { + return _this._btn.current ? _this._btn.current : void 0; + }; + return _this; + } + ContextualMenuButton2.prototype.render = function() { + var _this = this; + var _a2 = this.props, item = _a2.item, classNames2 = _a2.classNames, index2 = _a2.index, focusableElementIndex = _a2.focusableElementIndex, totalItemCount = _a2.totalItemCount, hasCheckmarks = _a2.hasCheckmarks, hasIcons = _a2.hasIcons, contextualMenuItemAs = _a2.contextualMenuItemAs, expandedMenuItemKey = _a2.expandedMenuItemKey, onItemMouseDown2 = _a2.onItemMouseDown, onItemClick = _a2.onItemClick, openSubMenu = _a2.openSubMenu, dismissSubMenu = _a2.dismissSubMenu, dismissMenu = _a2.dismissMenu; + var ChildrenRenderer = ContextualMenuItem; + if (item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(item.contextualMenuItemAs, ChildrenRenderer); } - }, [ - bodyThemed, - applyThemeToBody, - rootElement - ]); - return rootElement; -} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Styling":"hTimn","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3SPki":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var inheritFont = { - fontFamily: 'inherit' -}; -var GlobalClassNames = { - root: 'ms-Fabric', - bodyThemed: 'ms-Fabric-bodyThemed' -}; -var getStyles = function(props) { - var applyTheme = props.applyTheme, className = props.className, preventBlanketFontInheritance = props.preventBlanketFontInheritance, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - root: [ - classNames.root, - theme.fonts.medium, - { - color: theme.palette.neutralPrimary - }, - !preventBlanketFontInheritance && { - '& button': inheritFont, - '& input': inheritFont, - '& textarea': inheritFont - }, - // apply theme to only if applyTheme is true - applyTheme && { - color: theme.semanticColors.bodyText, - backgroundColor: theme.semanticColors.bodyBackground - }, - className - ], - bodyThemed: [ - { - backgroundColor: theme.semanticColors.bodyBackground - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gngXH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Register a layer for a given host id - * @param hostId - Id of the layer host - * @param layer - Layer instance - */ parcelHelpers.export(exports, "registerLayer", ()=>registerLayer); -/** - * Unregister a layer for a given host id - * @param hostId - Id of the layer host - * @param layer - Layer instance - */ parcelHelpers.export(exports, "unregisterLayer", ()=>unregisterLayer); -/** - * Gets the number of layers currently registered with a host id. - * @param hostId - Id of the layer host. - * @returns The number of layers currently registered with the host. - */ parcelHelpers.export(exports, "getLayerCount", ()=>getLayerCount); -/** - * Gets the Layer Host instance associated with a hostId, if applicable. - * @param hostId - Id of the layer host - * @returns A component ref for the associated layer host. - */ parcelHelpers.export(exports, "getLayerHost", ()=>getLayerHost); -/** - * Registers a Layer Host with an associated hostId. - * @param hostId - Id of the layer host - * @param layerHost - layer host instance - */ parcelHelpers.export(exports, "registerLayerHost", ()=>registerLayerHost); -/** - * Unregisters a Layer Host from the associated hostId. - * @param hostId - Id of the layer host - * @param layerHost - layer host instance - */ parcelHelpers.export(exports, "unregisterLayerHost", ()=>unregisterLayerHost); -/** - * When no default layer host is provided, this function is executed to create the default host. - */ parcelHelpers.export(exports, "createDefaultLayerHost", ()=>createDefaultLayerHost); -/** - * This function can be optionally called to clean up the default layer host as needed. - */ parcelHelpers.export(exports, "cleanupDefaultLayerHost", ()=>cleanupDefaultLayerHost); -/** - * Used for notifying applicable Layers that a host is available/unavailable and to re-evaluate Layers that - * care about the specific host. - */ parcelHelpers.export(exports, "notifyHostChanged", ()=>notifyHostChanged); -/** - * Sets the default target selector to use when determining the host in which - * Layered content will be injected into. If not provided, an element will be - * created at the end of the document body. - * - * Passing in a falsy value will clear the default target and reset back to - * using a created element at the end of document body. - */ parcelHelpers.export(exports, "setDefaultTarget", ()=>setDefaultTarget); -/** - * Get the default target selector when determining a host - */ parcelHelpers.export(exports, "getDefaultTarget", ()=>getDefaultTarget); -var _layersByHostId = {}; -var _layerHostsById = {}; -var defaultHostId = 'fluent-default-layer-host'; -var _defaultHostSelector = "#".concat(defaultHostId); -function registerLayer(hostId, callback) { - if (!_layersByHostId[hostId]) _layersByHostId[hostId] = []; - _layersByHostId[hostId].push(callback); - var layerHosts = _layerHostsById[hostId]; - if (layerHosts) for(var _i = 0, layerHosts_1 = layerHosts; _i < layerHosts_1.length; _i++){ - var layerHost = layerHosts_1[_i]; - layerHost.notifyLayersChanged(); - } -} -function unregisterLayer(hostId, callback) { - var layers = _layersByHostId[hostId]; - if (layers) { - var idx = layers.indexOf(callback); - if (idx >= 0) { - layers.splice(idx, 1); - if (layers.length === 0) delete _layersByHostId[hostId]; + if (contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(contextualMenuItemAs, ChildrenRenderer); } + var isChecked = getIsChecked(item); + var canCheck = isChecked !== null; + var defaultRole = getMenuItemAriaRole(item); + var itemHasSubmenu = hasSubmenu(item); + var itemProps = item.itemProps, ariaLabel2 = item.ariaLabel, ariaDescription = item.ariaDescription; + var buttonNativeProperties = getNativeProps(item, buttonProperties); + delete buttonNativeProperties.disabled; + var itemRole = item.role || defaultRole; + if (ariaDescription) { + this._ariaDescriptionId = getId(); + } + var ariaDescribedByIds = mergeAriaAttributeValues(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : void 0, buttonNativeProperties["aria-describedby"]); + var itemButtonProperties = { + className: classNames2.root, + onClick: this._onItemClick, + onKeyDown: itemHasSubmenu ? this._onItemKeyDown : void 0, + onMouseEnter: this._onItemMouseEnter, + onMouseLeave: this._onItemMouseLeave, + onMouseDown: function(ev) { + return onItemMouseDown2 ? onItemMouseDown2(item, ev) : void 0; + }, + onMouseMove: this._onItemMouseMove, + href: item.href, + title: item.title, + "aria-label": ariaLabel2, + "aria-describedby": ariaDescribedByIds, + "aria-haspopup": itemHasSubmenu || void 0, + "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : void 0, + "aria-posinset": focusableElementIndex + 1, + "aria-setsize": totalItemCount, + "aria-disabled": isItemDisabled(item), + "aria-checked": (itemRole === "menuitemcheckbox" || itemRole === "menuitemradio") && canCheck ? !!isChecked : void 0, + "aria-selected": itemRole === "menuitem" && canCheck ? !!isChecked : void 0, + role: itemRole, + // eslint-disable-next-line @typescript-eslint/no-deprecated + style: item.style + }; + var keytipProps = item.keytipProps; + if (keytipProps && itemHasSubmenu) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + return React__namespace.createElement(KeytipData, { keytipProps, ariaDescribedBy: ariaDescribedByIds, disabled: isItemDisabled(item) }, function(keytipAttributes) { + return React__namespace.createElement( + "button", + __assign$1({ ref: _this._btn }, buttonNativeProperties, itemButtonProperties, keytipAttributes), + React__namespace.createElement(ChildrenRenderer, __assign$1({ componentRef: item.componentRef, item, classNames: classNames2, index: index2, onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : void 0, hasIcons, openSubMenu, dismissSubMenu, dismissMenu, getSubmenuTarget: _this._getSubmenuTarget }, itemProps)), + _this._renderAriaDescription(ariaDescription, classNames2.screenReaderText) + ); + }); + }; + return ContextualMenuButton2; + })(ContextualMenuItemWrapper) + ); + var getStyles$r = function(props) { + var theme = props.theme, getClassNames2 = props.getClassNames, className2 = props.className; + if (!theme) { + throw new Error("Theme is undefined or null."); + } + if (getClassNames2) { + var names = getClassNames2(theme); + return { + wrapper: [names.wrapper], + divider: [names.divider] + }; } - var layerHosts = _layerHostsById[hostId]; - if (layerHosts) for(var _i = 0, layerHosts_2 = layerHosts; _i < layerHosts_2.length; _i++){ - var layerHost = layerHosts_2[_i]; - layerHost.notifyLayersChanged(); - } -} -function getLayerCount(hostId) { - var layers = _layerHostsById[hostId]; - return layers ? layers.length : 0; -} -function getLayerHost(hostId) { - var layerHosts = _layerHostsById[hostId]; - return layerHosts && layerHosts[0] || undefined; -} -function registerLayerHost(hostId, layerHost) { - var layerHosts = _layerHostsById[hostId] || (_layerHostsById[hostId] = []); - // Insert this at the start of an array to avoid race conditions between mount and unmount. - // If a LayerHost is re-mounted, and mount of the new instance may occur before the unmount of the old one. - // Putting the new instance at the start of this array ensures that calls to `getLayerHost` will immediately - // get the new one even if the old one is around briefly. - layerHosts.unshift(layerHost); -} -function unregisterLayerHost(hostId, layerHost) { - var layerHosts = _layerHostsById[hostId]; - if (layerHosts) { - var idx = layerHosts.indexOf(layerHost); - if (idx >= 0) layerHosts.splice(idx, 1); - if (layerHosts.length === 0) delete _layerHostsById[hostId]; - } -} -function createDefaultLayerHost(doc, shadowRoot) { - if (shadowRoot === void 0) shadowRoot = null; - var host = doc.createElement('div'); - host.setAttribute('id', defaultHostId); - host.style.cssText = 'position:fixed;z-index:1000000'; - if (shadowRoot) shadowRoot.appendChild(host); - else doc === null || doc === void 0 || doc.body.appendChild(host); - // doc?.body.appendChild(host); - return host; -} -function cleanupDefaultLayerHost(doc, shadowRoot) { - if (shadowRoot === void 0) shadowRoot = null; - var root = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : doc; - var host = root.querySelector("#".concat(defaultHostId)); - if (host) root.removeChild(host); -} -function notifyHostChanged(id) { - if (_layersByHostId[id]) _layersByHostId[id].forEach(function(callback) { - return callback(); - }); -} -function setDefaultTarget(selector) { - _defaultHostSelector = selector; -} -function getDefaultTarget() { - return _defaultHostSelector; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"doFKM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-Layer', - rootNoHost: 'ms-Layer--fixed', - content: 'ms-Layer-content' -}; -var getStyles = function(props) { - var className = props.className, isNotHost = props.isNotHost, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); return { - root: [ - classNames.root, - theme.fonts.medium, - isNotHost && [ - classNames.rootNoHost, - { - position: 'fixed', - zIndex: (0, _styling.ZIndexes).Layer, - top: 0, - left: 0, - bottom: 0, - right: 0, - visibility: 'hidden' - } - ], - className - ], - content: [ - classNames.content, - { - visibility: 'visible' - } - ] + wrapper: [ + { + display: "inline-flex", + height: "100%", + alignItems: "center" + }, + className2 + ], + divider: [ + { + width: 1, + height: "100%", + backgroundColor: theme.palette.neutralTertiaryAlt + } + ] }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cJR9f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuItem", ()=>ContextualMenuItem); -var _utilities = require("../../Utilities"); -var _contextualMenuItemBase = require("./ContextualMenuItem.base"); -var _contextualMenuClassNames = require("./ContextualMenu.classNames"); -var ContextualMenuItem = (0, _utilities.styled)((0, _contextualMenuItemBase.ContextualMenuItemBase), (0, _contextualMenuClassNames.getItemStyles), undefined, { - scope: 'ContextualMenuItem' -}); - -},{"../../Utilities":"1NZCy","./ContextualMenuItem.base":"eTkTx","./ContextualMenu.classNames":"bg3cO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eTkTx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuItemBase", ()=>ContextualMenuItemBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _index = require("../../utilities/contextualMenu/index"); -var _utilities = require("../../Utilities"); -var _icon = require("../../Icon"); -var defaultIconRenderer = function(props) { - var item = props.item, classNames = props.classNames; - var iconProps = item.iconProps; - return _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({}, iconProps, { - className: classNames.icon - })); -}; -var renderItemIcon = function(props) { - var item = props.item, hasIcons = props.hasIcons; - if (!hasIcons) return null; - if (item.onRenderIcon) return item.onRenderIcon(props, defaultIconRenderer); - return defaultIconRenderer(props); -}; -var renderCheckMarkIcon = function(_a) { - var onCheckmarkClick = _a.onCheckmarkClick, item = _a.item, classNames = _a.classNames; - var isItemChecked = (0, _index.getIsChecked)(item); - if (onCheckmarkClick) { - // Ensures that the item is passed as the first argument to the checkmark click callback. - var onClick = function(e) { - return onCheckmarkClick(item, e); + }; + var getClassNames$m = classNamesFunction(); + var VerticalDividerBase = React__namespace.forwardRef(function(props, ref2) { + var styles = props.styles, theme = props.theme, deprecatedGetClassNames = props.getClassNames, className2 = props.className; + var classNames2 = getClassNames$m(styles, { theme, getClassNames: deprecatedGetClassNames, className: className2 }); + return React__namespace.createElement( + "span", + { className: classNames2.wrapper, ref: ref2 }, + React__namespace.createElement("span", { className: classNames2.divider }) + ); + }); + VerticalDividerBase.displayName = "VerticalDividerBase"; + var VerticalDivider = styled(VerticalDividerBase, getStyles$r, void 0, { + scope: "VerticalDivider" + }); + var TouchIdleDelay$2 = 500; + var ContextualMenuSplitButton = ( + /** @class */ + (function(_super) { + __extends(ContextualMenuSplitButton2, _super); + function ContextualMenuSplitButton2(props) { + var _this = _super.call(this, props) || this; + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); + }); + _this._onItemKeyDown = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemKeyDown = _a2.onItemKeyDown; + if (ev.which === KeyCodes.enter) { + _this._executeItemClick(ev); + ev.preventDefault(); + ev.stopPropagation(); + } else if (onItemKeyDown) { + onItemKeyDown(item, ev); + } + }; + _this._getSubmenuTarget = function() { + return _this._splitButton; + }; + _this._renderAriaDescription = function(ariaDescription, className2) { + return ariaDescription ? React__namespace.createElement("span", { id: _this._ariaDescriptionId, className: className2 }, ariaDescription) : null; + }; + _this._onItemMouseEnterPrimary = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseEnter = _a2.onItemMouseEnter; + if (onItemMouseEnter) { + onItemMouseEnter(__assign$1(__assign$1({}, item), { subMenuProps: void 0, items: void 0 }), ev, _this._splitButton); + } + }; + _this._onItemMouseEnterIcon = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseEnter = _a2.onItemMouseEnter; + if (onItemMouseEnter) { + onItemMouseEnter(item, ev, _this._splitButton); + } + }; + _this._onItemMouseMovePrimary = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseMove = _a2.onItemMouseMove; + if (onItemMouseMove) { + onItemMouseMove(__assign$1(__assign$1({}, item), { subMenuProps: void 0, items: void 0 }), ev, _this._splitButton); + } + }; + _this._onItemMouseMoveIcon = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemMouseMove = _a2.onItemMouseMove; + if (onItemMouseMove) { + onItemMouseMove(item, ev, _this._splitButton); + } + }; + _this._onIconItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, onItemClickBase = _a2.onItemClickBase; + if (onItemClickBase) { + onItemClickBase(item, ev, _this._splitButton ? _this._splitButton : ev.currentTarget); + } + }; + _this._executeItemClick = function(ev) { + var _a2 = _this.props, item = _a2.item, executeItemClick = _a2.executeItemClick, onItemClick = _a2.onItemClick; + if (item.disabled || item.isDisabled) { + return; + } + if (_this._processingTouch && !item.canCheck && onItemClick) { + return onItemClick(item, ev); + } + if (executeItemClick) { + executeItemClick(item, ev); + } + }; + _this._onTouchStart = function(ev) { + if (_this._splitButton && !("onpointerdown" in _this._splitButton)) { + _this._handleTouchAndPointerEvent(ev); + } + }; + _this._onPointerDown = function(ev) { + if (ev.pointerType === "touch") { + _this._handleTouchAndPointerEvent(ev); + ev.preventDefault(); + ev.stopImmediatePropagation(); + } }; - return _react.createElement((0, _icon.Icon), { - iconName: item.canCheck !== false && isItemChecked ? 'CheckMark' : '', - className: classNames.checkmarkIcon, - // eslint-disable-next-line react/jsx-no-bind - onClick: onClick + _this._async = new Async(_this); + _this._events = new EventGroup(_this); + _this._dismissLabelId = getId(); + return _this; + } + ContextualMenuSplitButton2.prototype.componentDidMount = function() { + if (this._splitButton && "onpointerdown" in this._splitButton) { + this._events.on(this._splitButton, "pointerdown", this._onPointerDown, true); + } + }; + ContextualMenuSplitButton2.prototype.componentWillUnmount = function() { + this._async.dispose(); + this._events.dispose(); + }; + ContextualMenuSplitButton2.prototype.render = function() { + var _this = this; + var _a2; + var _b2 = this.props, item = _b2.item, classNames2 = _b2.classNames, index2 = _b2.index, focusableElementIndex = _b2.focusableElementIndex, totalItemCount = _b2.totalItemCount, hasCheckmarks = _b2.hasCheckmarks, hasIcons = _b2.hasIcons, onItemMouseLeave = _b2.onItemMouseLeave, expandedMenuItemKey = _b2.expandedMenuItemKey; + var itemHasSubmenu = hasSubmenu(item); + var keytipProps = item.keytipProps; + if (keytipProps) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + var ariaDescription = item.ariaDescription; + if (ariaDescription) { + this._ariaDescriptionId = getId(); + } + var ariaChecked = (_a2 = getIsChecked(item)) !== null && _a2 !== void 0 ? _a2 : void 0; + return React__namespace.createElement(KeytipData, { keytipProps, disabled: isItemDisabled(item) }, function(keytipAttributes) { + return React__namespace.createElement( + "div", + { "data-ktp-target": keytipAttributes["data-ktp-target"], ref: function(splitButton) { + _this._splitButton = splitButton; + }, role: getMenuItemAriaRole(item), "aria-label": item.ariaLabel, className: classNames2.splitContainer, "aria-disabled": isItemDisabled(item), "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : void 0, "aria-haspopup": true, "aria-describedby": mergeAriaAttributeValues(item.ariaDescribedBy, ariaDescription ? _this._ariaDescriptionId : void 0, keytipAttributes["aria-describedby"]), "aria-checked": ariaChecked, "aria-posinset": focusableElementIndex + 1, "aria-setsize": totalItemCount, onMouseEnter: _this._onItemMouseEnterPrimary, onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(_this, __assign$1(__assign$1({}, item), { subMenuProps: null, items: null })) : void 0, onMouseMove: _this._onItemMouseMovePrimary, onKeyDown: _this._onItemKeyDown, onClick: _this._executeItemClick, onTouchStart: _this._onTouchStart, tabIndex: 0, "data-is-focusable": true, "aria-roledescription": item["aria-roledescription"] }, + _this._renderSplitPrimaryButton(item, classNames2, index2, hasCheckmarks, hasIcons), + _this._renderSplitDivider(item), + _this._renderSplitIconButton(item, classNames2, index2, keytipAttributes), + _this._renderAriaDescription(ariaDescription, classNames2.screenReaderText) + ); }); - } - return null; -}; -var renderItemName = function(_a) { - var item = _a.item, classNames = _a.classNames; - /* eslint-disable deprecation/deprecation */ if (item.text || item.name) return _react.createElement("span", { - className: classNames.label - }, item.text || item.name); - /* eslint-enable deprecation/deprecation */ return null; -}; -var renderSecondaryText = function(_a) { - var item = _a.item, classNames = _a.classNames; - if (item.secondaryText) return _react.createElement("span", { - className: classNames.secondaryText - }, item.secondaryText); - return null; -}; -var renderSubMenuIcon = function(_a) { - var item = _a.item, classNames = _a.classNames, theme = _a.theme; - if ((0, _index.hasSubmenu)(item)) return _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - iconName: (0, _utilities.getRTL)(theme) ? 'ChevronLeft' : 'ChevronRight' - }, item.submenuIconProps, { - className: classNames.subMenuIcon - })); - return null; -}; -var ContextualMenuItemBase = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuItemBase, _super); - function ContextualMenuItemBase(props) { - var _this = _super.call(this, props) || this; - _this.openSubMenu = function() { - var _a = _this.props, item = _a.item, openSubMenu = _a.openSubMenu, getSubmenuTarget = _a.getSubmenuTarget; - if (getSubmenuTarget) { - var submenuTarget = getSubmenuTarget(); - if ((0, _index.hasSubmenu)(item) && openSubMenu && submenuTarget) openSubMenu(item, submenuTarget); - } + }; + ContextualMenuSplitButton2.prototype._renderSplitPrimaryButton = function(item, classNames2, index2, hasCheckmarks, hasIcons) { + var _a2 = this.props, _b2 = _a2.contextualMenuItemAs, ChildrenRenderer = _b2 === void 0 ? ContextualMenuItem : _b2, onItemClick = _a2.onItemClick; + var itemProps = { + key: item.key, + disabled: isItemDisabled(item) || item.primaryDisabled, + /* eslint-disable @typescript-eslint/no-deprecated */ + name: item.name, + text: item.text || item.name, + secondaryText: item.secondaryText, + /* eslint-enable @typescript-eslint/no-deprecated */ + className: classNames2.splitPrimary, + canCheck: item.canCheck, + isChecked: item.isChecked, + checked: item.checked, + iconProps: item.iconProps, + id: this._dismissLabelId, + onRenderIcon: item.onRenderIcon, + data: item.data, + "data-is-focusable": false }; - _this.dismissSubMenu = function() { - var _a = _this.props, item = _a.item, dismissSubMenu = _a.dismissSubMenu; - if ((0, _index.hasSubmenu)(item) && dismissSubMenu) dismissSubMenu(); + var itemComponentProps = item.itemProps; + return React__namespace.createElement( + "button", + __assign$1({}, getNativeProps(itemProps, buttonProperties)), + React__namespace.createElement(ChildrenRenderer, __assign$1({ "data-is-focusable": false, item: __assign$1(__assign$1({}, itemProps), { onClick: item.onClick }), classNames: classNames2, index: index2, onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : void 0, hasIcons }, itemComponentProps)) + ); + }; + ContextualMenuSplitButton2.prototype._renderSplitDivider = function(item) { + var getDividerClassNames2 = item.getSplitButtonVerticalDividerClassNames || getSplitButtonVerticalDividerClassNames; + return React__namespace.createElement( + VerticalDivider, + { + // eslint-disable-next-line @typescript-eslint/no-deprecated + getClassNames: getDividerClassNames2 + } + ); + }; + ContextualMenuSplitButton2.prototype._renderSplitIconButton = function(item, classNames2, index2, keytipAttributes) { + var _a2 = this.props, onItemMouseLeave = _a2.onItemMouseLeave, onItemMouseDown2 = _a2.onItemMouseDown, openSubMenu = _a2.openSubMenu, dismissSubMenu = _a2.dismissSubMenu, dismissMenu = _a2.dismissMenu; + var ChildrenRenderer = ContextualMenuItem; + if (this.props.item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.item.contextualMenuItemAs, ChildrenRenderer); + } + if (this.props.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(this.props.contextualMenuItemAs, ChildrenRenderer); + } + var itemProps = { + onClick: this._onIconItemClick, + disabled: isItemDisabled(item), + className: classNames2.splitMenu, + subMenuProps: item.subMenuProps, + submenuIconProps: item.submenuIconProps, + split: true, + key: item.key, + "aria-labelledby": this._dismissLabelId + }; + var buttonProps = __assign$1(__assign$1({}, getNativeProps(itemProps, buttonProperties)), { + onMouseEnter: this._onItemMouseEnterIcon, + onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(this, item) : void 0, + onMouseDown: function(ev) { + return onItemMouseDown2 ? onItemMouseDown2(item, ev) : void 0; + }, + onMouseMove: this._onItemMouseMoveIcon, + "data-is-focusable": false, + "data-ktp-execute-target": keytipAttributes["data-ktp-execute-target"], + "aria-haspopup": true + }); + var itemComponentProps = item.itemProps; + return React__namespace.createElement( + "button", + __assign$1({}, buttonProps), + React__namespace.createElement(ChildrenRenderer, __assign$1({ componentRef: item.componentRef, item: itemProps, classNames: classNames2, index: index2, hasIcons: false, openSubMenu, dismissSubMenu, dismissMenu, getSubmenuTarget: this._getSubmenuTarget }, itemComponentProps)) + ); + }; + ContextualMenuSplitButton2.prototype._handleTouchAndPointerEvent = function(ev) { + var _this = this; + var onTap = this.props.onTap; + if (onTap) { + onTap(ev); + } + if (this._lastTouchTimeoutId) { + this._async.clearTimeout(this._lastTouchTimeoutId); + this._lastTouchTimeoutId = void 0; + } + this._processingTouch = true; + this._lastTouchTimeoutId = this._async.setTimeout(function() { + _this._processingTouch = false; + _this._lastTouchTimeoutId = void 0; + }, TouchIdleDelay$2); + }; + return ContextualMenuSplitButton2; + })(ContextualMenuItemWrapper) + ); + var BaseDecorator = ( + /** @class */ + (function(_super) { + __extends(BaseDecorator2, _super); + function BaseDecorator2(props) { + var _this = _super.call(this, props) || this; + _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); + return _this; + } + BaseDecorator2.prototype._updateComposedComponentRef = function(composedComponentInstance) { + this._composedComponentInstance = composedComponentInstance; + if (composedComponentInstance) { + this._hoisted = hoistMethods(this, composedComponentInstance); + } else if (this._hoisted) { + unhoistMethods(this, this._hoisted); + } + }; + return BaseDecorator2; + })(React__namespace.Component) + ); + var ResponsiveMode; + (function(ResponsiveMode2) { + ResponsiveMode2[ResponsiveMode2["small"] = 0] = "small"; + ResponsiveMode2[ResponsiveMode2["medium"] = 1] = "medium"; + ResponsiveMode2[ResponsiveMode2["large"] = 2] = "large"; + ResponsiveMode2[ResponsiveMode2["xLarge"] = 3] = "xLarge"; + ResponsiveMode2[ResponsiveMode2["xxLarge"] = 4] = "xxLarge"; + ResponsiveMode2[ResponsiveMode2["xxxLarge"] = 5] = "xxxLarge"; + ResponsiveMode2[ResponsiveMode2["unknown"] = 999] = "unknown"; + })(ResponsiveMode || (ResponsiveMode = {})); + var RESPONSIVE_MAX_CONSTRAINT = [479, 639, 1023, 1365, 1919, 99999999]; + var _lastMode; + function getInitialResponsiveMode() { + var _a2; + return (_a2 = _lastMode) !== null && _a2 !== void 0 ? _a2 : ResponsiveMode.large; + } + function withResponsiveMode(ComposedComponent) { + var _a2; + var resultClass = (_a2 = /** @class */ + (function(_super) { + __extends(WithResponsiveMode, _super); + function WithResponsiveMode(props) { + var _this = _super.call(this, props) || this; + _this._onResize = function() { + var responsiveMode = getResponsiveMode(_this.context.window); + if (responsiveMode !== _this.state.responsiveMode) { + _this.setState({ + responsiveMode + }); + } }; - _this.dismissMenu = function(dismissAll) { - var dismissMenu = _this.props.dismissMenu; - if (dismissMenu) dismissMenu(undefined /* ev */ , dismissAll); + _this._events = new EventGroup(_this); + _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); + _this.state = { + responsiveMode: getInitialResponsiveMode() }; - (0, _utilities.initializeComponentRef)(_this); return _this; + } + WithResponsiveMode.prototype.componentDidMount = function() { + this._events.on(this.context.window, "resize", this._onResize); + this._onResize(); + }; + WithResponsiveMode.prototype.componentWillUnmount = function() { + this._events.dispose(); + }; + WithResponsiveMode.prototype.render = function() { + var responsiveMode = this.state.responsiveMode; + return responsiveMode === ResponsiveMode.unknown ? null : React__namespace.createElement(ComposedComponent, __assign$1({ ref: this._updateComposedComponentRef, responsiveMode }, this.props)); + }; + return WithResponsiveMode; + })(BaseDecorator), _a2.contextType = WindowContext, _a2); + return hoistStatics(ComposedComponent, resultClass); + } + function getWidthOfCurrentWindow(currentWindow) { + try { + return currentWindow.document.documentElement.clientWidth; + } catch (e) { + return currentWindow.innerWidth; } - ContextualMenuItemBase.prototype.render = function() { - var _a = this.props, item = _a.item, classNames = _a.classNames; - var renderContent = item.onRenderContent || this._renderLayout; - return _react.createElement("div", { - className: item.split ? classNames.linkContentMenu : classNames.linkContent - }, renderContent(this.props, { - renderCheckMarkIcon: renderCheckMarkIcon, - renderItemIcon: renderItemIcon, - renderItemName: renderItemName, - renderSecondaryText: renderSecondaryText, - renderSubMenuIcon: renderSubMenuIcon - })); - }; - ContextualMenuItemBase.prototype._renderLayout = function(props, defaultRenders) { - return _react.createElement(_react.Fragment, null, defaultRenders.renderCheckMarkIcon(props), defaultRenders.renderItemIcon(props), defaultRenders.renderItemName(props), defaultRenders.renderSecondaryText(props), defaultRenders.renderSubMenuIcon(props)); - }; - return ContextualMenuItemBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../utilities/contextualMenu/index":"lGesq","../../Utilities":"1NZCy","../../Icon":"hiMUP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bg3cO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSplitButtonVerticalDividerClassNames", ()=>getSplitButtonVerticalDividerClassNames); -parcelHelpers.export(exports, "getItemClassNames", ()=>getItemClassNames); -parcelHelpers.export(exports, "getItemStyles", ()=>getItemStyles); -var _verticalDividerClassNames = require("../Divider/VerticalDivider.classNames"); -var _contextualMenuCnstyles = require("./ContextualMenu.cnstyles"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var CONTEXTUAL_SPLIT_MENU_MINWIDTH = '28px'; -var MediumScreenSelector = (0, _styling.getScreenSelector)(0, (0, _styling.ScreenWidthMaxMedium)); -var getSplitButtonVerticalDividerClassNames = (0, _utilities.memoizeFunction)(/* eslint-disable deprecation/deprecation */ function(theme) { - var _a; - return (0, _styling.mergeStyleSets)((0, _verticalDividerClassNames.getDividerClassNames)(theme), { - /* eslint-enable deprecation/deprecation */ wrapper: { - position: 'absolute', - right: 28, - selectors: (_a = {}, _a[MediumScreenSelector] = { - right: 32 - }, _a) - }, - divider: { - height: 16, - width: 1 + } + function getResponsiveMode(currentWindow) { + var responsiveMode = ResponsiveMode.small; + if (currentWindow) { + try { + while (getWidthOfCurrentWindow(currentWindow) > RESPONSIVE_MAX_CONSTRAINT[responsiveMode]) { + responsiveMode++; } - }); -}); -var GlobalClassNames = { - item: 'ms-ContextualMenu-item', - divider: 'ms-ContextualMenu-divider', - root: 'ms-ContextualMenu-link', - isChecked: 'is-checked', - isExpanded: 'is-expanded', - isDisabled: 'is-disabled', - linkContent: 'ms-ContextualMenu-linkContent', - linkContentMenu: 'ms-ContextualMenu-linkContent', - icon: 'ms-ContextualMenu-icon', - iconColor: 'ms-ContextualMenu-iconColor', - checkmarkIcon: 'ms-ContextualMenu-checkmarkIcon', - subMenuIcon: 'ms-ContextualMenu-submenuIcon', - label: 'ms-ContextualMenu-itemText', - secondaryText: 'ms-ContextualMenu-secondaryText', - splitMenu: 'ms-ContextualMenu-splitMenu', - screenReaderText: 'ms-ContextualMenu-screenReaderText' -}; -var getItemClassNames = (0, _utilities.memoizeFunction)(function(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className) { - var _a, _b, _c, _d; - var styles = (0, _contextualMenuCnstyles.getMenuItemStyles)(theme); - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return (0, _styling.mergeStyleSets)({ - item: [ - classNames.item, - styles.item, - itemClassName - ], - divider: [ - classNames.divider, - styles.divider, - dividerClassName - ], - root: [ - classNames.root, - styles.root, - checked && [ - classNames.isChecked, - styles.rootChecked - ], - isAnchorLink && styles.anchorLink, - expanded && [ - classNames.isExpanded, - styles.rootExpanded - ], - disabled && [ - classNames.isDisabled, - styles.rootDisabled - ], - !disabled && !expanded && [ - { - selectors: (_a = { - ':hover': styles.rootHovered, - ':active': styles.rootPressed - }, // eslint-disable-next-line @fluentui/max-len - _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:hover")] = { - background: 'inherit;' - }, _a) - } - ], - className - ], - splitPrimary: [ - styles.root, - { - width: "calc(100% - ".concat(CONTEXTUAL_SPLIT_MENU_MINWIDTH, ")") - }, - checked && [ - 'is-checked', - styles.rootChecked - ], - (disabled || primaryDisabled) && [ - 'is-disabled', - styles.rootDisabled - ], - !(disabled || primaryDisabled) && !checked && [ - { - selectors: (_b = { - ':hover': styles.rootHovered - }, // when hovering over the splitPrimary also affect the splitMenu - _b[":hover ~ .".concat(classNames.splitMenu)] = styles.rootHovered, _b[':active'] = styles.rootPressed, // eslint-disable-next-line @fluentui/max-len - _b[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _b[".".concat((0, _utilities.IsFocusVisibleClassName), " &:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:hover")] = { - background: 'inherit;' - }, _b) - } - ] - ], - splitMenu: [ - classNames.splitMenu, - styles.root, - { - flexBasis: '0', - padding: '0 8px', - minWidth: CONTEXTUAL_SPLIT_MENU_MINWIDTH - }, - expanded && [ - 'is-expanded', - styles.rootExpanded - ], - disabled && [ - 'is-disabled', - styles.rootDisabled - ], - !disabled && !expanded && [ - { - selectors: (_c = { - ':hover': styles.rootHovered, - ':active': styles.rootPressed - }, // eslint-disable-next-line @fluentui/max-len - _c[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _c[".".concat((0, _utilities.IsFocusVisibleClassName), " &:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:hover")] = { - background: 'inherit;' - }, _c) - } - ] - ], - anchorLink: styles.anchorLink, - linkContent: [ - classNames.linkContent, - styles.linkContent - ], - linkContentMenu: [ - classNames.linkContentMenu, - styles.linkContent, - { - justifyContent: 'center' - } - ], - icon: [ - classNames.icon, - knownIcon && styles.iconColor, - styles.icon, - iconClassName, - disabled && [ - classNames.isDisabled, - styles.iconDisabled - ] - ], - iconColor: styles.iconColor, - checkmarkIcon: [ - classNames.checkmarkIcon, - knownIcon && styles.checkmarkIcon, - styles.icon, - iconClassName - ], - subMenuIcon: [ - classNames.subMenuIcon, - styles.subMenuIcon, - subMenuClassName, - expanded && { - color: theme.palette.neutralPrimary - }, - disabled && [ - styles.iconDisabled - ] - ], - label: [ - classNames.label, - styles.label - ], - secondaryText: [ - classNames.secondaryText, - styles.secondaryText - ], - splitContainer: [ - styles.splitButtonFlexContainer, - !disabled && !checked && [ - { - selectors: (_d = {}, // eslint-disable-next-line @fluentui/max-len - _d[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, .").concat((0, _utilities.IsFocusVisibleClassName), " &:focus:hover, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:hover")] = styles.rootFocused, _d) - } - ] - ], - screenReaderText: [ - classNames.screenReaderText, - styles.screenReaderText, - (0, _styling.hiddenContentStyle), - { - visibility: 'hidden' - } - ] - }); -}); -var getItemStyles = function(props) { - var theme = props.theme, disabled = props.disabled, expanded = props.expanded, checked = props.checked, isAnchorLink = props.isAnchorLink, knownIcon = props.knownIcon, itemClassName = props.itemClassName, dividerClassName = props.dividerClassName, iconClassName = props.iconClassName, subMenuClassName = props.subMenuClassName, primaryDisabled = props.primaryDisabled, className = props.className; - // eslint-disable-next-line deprecation/deprecation - return getItemClassNames(theme, disabled, expanded, checked, isAnchorLink, knownIcon, itemClassName, dividerClassName, iconClassName, subMenuClassName, primaryDisabled, className); -}; - -},{"../Divider/VerticalDivider.classNames":"cuEOn","./ContextualMenu.cnstyles":"ktzsg","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cuEOn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getDividerClassNames", ()=>getDividerClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getDividerClassNames = (0, _utilities.memoizeFunction)(// eslint-disable-next-line deprecation/deprecation -function(theme) { - return (0, _styling.mergeStyleSets)({ - wrapper: { - display: 'inline-flex', - height: '100%', - alignItems: 'center' - }, - divider: { - width: 1, - height: '100%', - backgroundColor: theme.palette.neutralTertiaryAlt + } catch (e) { + responsiveMode = getInitialResponsiveMode(); + } + _lastMode = responsiveMode; + } else { + { + throw new Error("Content was rendered in a server environment without providing a default responsive mode. Call setResponsiveMode to define what the responsive mode is."); + } + } + return responsiveMode; + } + var useResponsiveMode = function(elementRef, overrideResponsiveMode) { + var _a2 = React__namespace.useState(getInitialResponsiveMode()), lastResponsiveMode = _a2[0], setLastResponsiveMode = _a2[1]; + var onResize = React__namespace.useCallback(function() { + var newResponsiveMode = getResponsiveMode(getWindow(elementRef.current)); + if (lastResponsiveMode !== newResponsiveMode) { + setLastResponsiveMode(newResponsiveMode); + } + }, [elementRef, lastResponsiveMode]); + var win = useWindow(); + useOnEvent(win, "resize", onResize); + React__namespace.useEffect(function() { + if (overrideResponsiveMode === void 0) { + onResize(); + } + }, [overrideResponsiveMode]); + return overrideResponsiveMode !== null && overrideResponsiveMode !== void 0 ? overrideResponsiveMode : lastResponsiveMode; + }; + var MenuContext = React__namespace.createContext({}); + var getClassNames$l = classNamesFunction(); + var getContextualMenuItemClassNames = classNamesFunction(); + var DEFAULT_PROPS$4 = { + items: [], + shouldFocusOnMount: true, + gapSpace: 0, + directionalHint: DirectionalHint.bottomAutoEdge, + beakWidth: 16 + }; + function getItemCount(items) { + var totalItemCount = 0; + for (var _i = 0, items_1 = items; _i < items_1.length; _i++) { + var item = items_1[_i]; + if (item.itemType !== ContextualMenuItemType.Divider && item.itemType !== ContextualMenuItemType.Header) { + var itemCount = item.customOnRenderListLength ? item.customOnRenderListLength : 1; + totalItemCount += itemCount; + } + } + return totalItemCount; + } + function getSubmenuItems(item, options2) { + var target2 = options2 === null || options2 === void 0 ? void 0 : options2.target; + var items = item.subMenuProps ? item.subMenuProps.items : item.items; + if (items) { + var overrideItems = []; + for (var _i = 0, items_2 = items; _i < items_2.length; _i++) { + var subItem = items_2[_i]; + if (subItem.preferMenuTargetAsEventTarget) { + var onClick = subItem.onClick, contextItem = __rest(subItem, ["onClick"]); + overrideItems.push(__assign$1(__assign$1({}, contextItem), { onClick: getOnClickWithOverrideTarget(onClick, target2) })); + } else { + overrideItems.push(subItem); } + } + return overrideItems; + } + } + function canAnyMenuItemsCheck(items) { + return items.some(function(item) { + if (item.canCheck) { + return true; + } + if (item.sectionProps && item.sectionProps.items.some(function(submenuItem) { + return submenuItem.canCheck === true; + })) { + return true; + } + return false; }); -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ktzsg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CONTEXTUAL_MENU_ITEM_HEIGHT", ()=>CONTEXTUAL_MENU_ITEM_HEIGHT); -parcelHelpers.export(exports, "getMenuItemStyles", ()=>getMenuItemStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var CONTEXTUAL_MENU_ITEM_HEIGHT = 36; -var MediumScreenSelector = (0, _styling.getScreenSelector)(0, (0, _styling.ScreenWidthMaxMedium)); -var getMenuItemStyles = (0, _utilities.memoizeFunction)(function(theme) { - var _a, _b, _c, _d, _e; - var semanticColors = theme.semanticColors, fonts = theme.fonts, palette = theme.palette; - var ContextualMenuItemBackgroundHoverColor = semanticColors.menuItemBackgroundHovered; - var ContextualMenuItemTextHoverColor = semanticColors.menuItemTextHovered; - var ContextualMenuItemBackgroundSelectedColor = semanticColors.menuItemBackgroundPressed; - var ContextualMenuItemDividerColor = semanticColors.bodyDivider; - var menuItemStyles = { - item: [ - fonts.medium, - { - color: semanticColors.bodyText, - position: 'relative', - boxSizing: 'border-box' - } - ], - divider: { - display: 'block', - height: '1px', - backgroundColor: ContextualMenuItemDividerColor, - position: 'relative' - }, - root: [ - (0, _styling.getFocusStyle)(theme), - fonts.medium, - { - color: semanticColors.bodyText, - backgroundColor: 'transparent', - border: 'none', - width: '100%', - height: CONTEXTUAL_MENU_ITEM_HEIGHT, - lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, - display: 'block', - cursor: 'pointer', - padding: '0px 8px 0 4px', - textAlign: 'left' - } - ], - rootDisabled: { - color: semanticColors.disabledBodyText, - cursor: 'default', - pointerEvents: 'none', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - // ensure disabled text looks different than enabled - color: 'GrayText', - opacity: 1 - }, _a) - }, - rootHovered: { - backgroundColor: ContextualMenuItemBackgroundHoverColor, - color: ContextualMenuItemTextHoverColor, - selectors: { - '.ms-ContextualMenu-icon': { - color: palette.themeDarkAlt - }, - '.ms-ContextualMenu-submenuIcon': { - color: palette.neutralPrimary - } - } - }, - rootFocused: { - backgroundColor: palette.white - }, - rootChecked: { - selectors: { - '.ms-ContextualMenu-checkmarkIcon': { - color: palette.neutralPrimary - } - } - }, - rootPressed: { - backgroundColor: ContextualMenuItemBackgroundSelectedColor, - selectors: { - '.ms-ContextualMenu-icon': { - color: palette.themeDark - }, - '.ms-ContextualMenu-submenuIcon': { - color: palette.neutralPrimary - } - } - }, - rootExpanded: { - backgroundColor: ContextualMenuItemBackgroundSelectedColor, - color: semanticColors.bodyTextChecked, - selectors: (_b = { - '.ms-ContextualMenu-submenuIcon': (_c = {}, _c[0, _styling.HighContrastSelector] = { - // icons inside of anchor tags are not properly inheriting color in high contrast - color: 'inherit' - }, _c) - }, _b[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({}, (0, _styling.getHighContrastNoAdjustStyle)()), _b) - }, - linkContent: { - whiteSpace: 'nowrap', - height: 'inherit', - display: 'flex', - alignItems: 'center', - maxWidth: '100%' - }, - anchorLink: { - padding: '0px 8px 0 4px', - textRendering: 'auto', - color: 'inherit', - letterSpacing: 'normal', - wordSpacing: 'normal', - textTransform: 'none', - textIndent: '0px', - textShadow: 'none', - textDecoration: 'none', - boxSizing: 'border-box' - }, - label: { - margin: '0 4px', - verticalAlign: 'middle', - display: 'inline-block', - flexGrow: '1', - textOverflow: 'ellipsis', - whiteSpace: 'nowrap', - overflow: 'hidden' - }, - secondaryText: { - color: theme.palette.neutralSecondary, - paddingLeft: '20px', - textAlign: 'right' - }, - icon: { - display: 'inline-block', - minHeight: '1px', - maxHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, - fontSize: (0, _styling.IconFontSizes).medium, - width: (0, _styling.IconFontSizes).medium, - margin: '0 4px', - verticalAlign: 'middle', - flexShrink: '0', - selectors: (_d = {}, _d[MediumScreenSelector] = { - fontSize: (0, _styling.IconFontSizes).large, - width: (0, _styling.IconFontSizes).large - }, _d) - }, - iconColor: { - color: semanticColors.menuIcon - }, - iconDisabled: { - color: semanticColors.disabledBodyText - }, - checkmarkIcon: { - color: semanticColors.bodySubtext - }, - subMenuIcon: { - height: CONTEXTUAL_MENU_ITEM_HEIGHT, - lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, - color: palette.neutralSecondary, - textAlign: 'center', - display: 'inline-block', - verticalAlign: 'middle', - flexShrink: '0', - fontSize: (0, _styling.IconFontSizes).small, - selectors: (_e = { - ':hover': { - color: palette.neutralPrimary - }, - ':active': { - color: palette.neutralPrimary - } - }, _e[MediumScreenSelector] = { - fontSize: (0, _styling.IconFontSizes).medium - }, _e) - }, - splitButtonFlexContainer: [ - (0, _styling.getFocusStyle)(theme), - { - display: 'flex', - height: CONTEXTUAL_MENU_ITEM_HEIGHT, - flexWrap: 'nowrap', - justifyContent: 'center', - alignItems: 'flex-start' - } - ] + } + var NavigationIdleDelay = 250; + var COMPONENT_NAME$7 = "ContextualMenu"; + var _getMenuItemStylesFunction = memoizeFunction(function() { + var styles = []; + for (var _i = 0; _i < arguments.length; _i++) { + styles[_i] = arguments[_i]; + } + return function(styleProps) { + return concatStyleSetsWithProps.apply(void 0, __spreadArray([styleProps, getItemStyles], styles, false)); + }; + }); + function useVisibility(props, targetWindow) { + var _a2 = props.hidden, hidden = _a2 === void 0 ? false : _a2, onMenuDismissed = props.onMenuDismissed, onMenuOpened = props.onMenuOpened; + var previousHidden = usePrevious(hidden); + var onMenuOpenedRef = React__namespace.useRef(onMenuOpened); + var onMenuClosedRef = React__namespace.useRef(onMenuDismissed); + var propsRef = React__namespace.useRef(props); + onMenuOpenedRef.current = onMenuOpened; + onMenuClosedRef.current = onMenuDismissed; + propsRef.current = props; + React__namespace.useEffect(function() { + var _a3, _b2; + if (hidden && previousHidden === false) { + (_a3 = onMenuClosedRef.current) === null || _a3 === void 0 ? void 0 : _a3.call(onMenuClosedRef, propsRef.current); + } else if (!hidden && previousHidden !== false) { + (_b2 = onMenuOpenedRef.current) === null || _b2 === void 0 ? void 0 : _b2.call(onMenuOpenedRef, propsRef.current); + } + }, [hidden, previousHidden]); + React__namespace.useEffect(function() { + return function() { + var _a3; + return (_a3 = onMenuClosedRef.current) === null || _a3 === void 0 ? void 0 : _a3.call(onMenuClosedRef, propsRef.current); + }; + }, []); + } + function useSubMenuState(_a2, dismiss) { + var hidden = _a2.hidden, items = _a2.items, theme = _a2.theme, className2 = _a2.className, id2 = _a2.id, menuTarget = _a2.target; + var _b2 = React__namespace.useState(), expandedMenuItemKey = _b2[0], setExpandedMenuItemKey = _b2[1]; + var _c2 = React__namespace.useState(), submenuTarget = _c2[0], setSubmenuTarget = _c2[1]; + var _d2 = React__namespace.useState(), shouldFocusOnContainer = _d2[0], setShouldFocusOnContainer = _d2[1]; + var subMenuId = useId(COMPONENT_NAME$7, id2); + var closeSubMenu = React__namespace.useCallback(function() { + setShouldFocusOnContainer(void 0); + setExpandedMenuItemKey(void 0); + setSubmenuTarget(void 0); + }, []); + var openSubMenu = React__namespace.useCallback(function(_a3, target2, focusContainer) { + var submenuItemKey = _a3.key; + if (expandedMenuItemKey === submenuItemKey) { + return; + } + target2.focus(); + setShouldFocusOnContainer(focusContainer); + setExpandedMenuItemKey(submenuItemKey); + setSubmenuTarget(target2); + }, [expandedMenuItemKey]); + React__namespace.useEffect(function() { + if (hidden) { + closeSubMenu(); + } + }, [hidden, closeSubMenu]); + var onSubMenuDismiss = useOnSubmenuDismiss(dismiss, closeSubMenu); + var getSubmenuProps = function() { + var item = findItemByKeyFromItems(expandedMenuItemKey, items); + var submenuProps = null; + if (item) { + submenuProps = { + items: getSubmenuItems(item, { target: menuTarget }), + target: submenuTarget, + onDismiss: onSubMenuDismiss, + isSubMenu: true, + id: subMenuId, + shouldFocusOnMount: true, + shouldFocusOnContainer, + directionalHint: getRTL(theme) ? DirectionalHint.leftTopEdge : DirectionalHint.rightTopEdge, + className: className2, + gapSpace: 0, + isBeakVisible: false + }; + if (item.subMenuProps) { + assign(submenuProps, item.subMenuProps); + } + if (item.preferMenuTargetAsEventTarget) { + var onItemClick = item.onItemClick; + submenuProps.onItemClick = getOnClickWithOverrideTarget(onItemClick, menuTarget); + } + } + return submenuProps; + }; + return [expandedMenuItemKey, openSubMenu, getSubmenuProps, onSubMenuDismiss]; + } + function useShouldUpdateFocusOnMouseMove(_a2) { + var delayUpdateFocusOnHover = _a2.delayUpdateFocusOnHover, hidden = _a2.hidden; + var shouldUpdateFocusOnMouseEvent = React__namespace.useRef(!delayUpdateFocusOnHover); + var gotMouseMove = React__namespace.useRef(false); + React__namespace.useEffect(function() { + shouldUpdateFocusOnMouseEvent.current = !delayUpdateFocusOnHover; + gotMouseMove.current = hidden ? false : !delayUpdateFocusOnHover && gotMouseMove.current; + }, [delayUpdateFocusOnHover, hidden]); + var onMenuFocusCapture = React__namespace.useCallback(function() { + if (delayUpdateFocusOnHover) { + shouldUpdateFocusOnMouseEvent.current = false; + } + }, [delayUpdateFocusOnHover]); + return [shouldUpdateFocusOnMouseEvent, gotMouseMove, onMenuFocusCapture]; + } + function usePreviousActiveElement(_a2, targetWindow, hostElement) { + var hidden = _a2.hidden, onRestoreFocus = _a2.onRestoreFocus; + var previousActiveElement = React__namespace.useRef(void 0); + var tryFocusPreviousActiveElement = React__namespace.useCallback(function(options2) { + var _a3, _b2; + if (onRestoreFocus) { + onRestoreFocus(options2); + } else if (options2 === null || options2 === void 0 ? void 0 : options2.documentContainsFocus) { + (_b2 = (_a3 = previousActiveElement.current) === null || _a3 === void 0 ? void 0 : _a3.focus) === null || _b2 === void 0 ? void 0 : _b2.call(_a3); + } + }, [onRestoreFocus]); + useIsomorphicLayoutEffect(function() { + var _a3, _b2; + if (!hidden) { + var newElement = targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement; + if (!((_a3 = hostElement.current) === null || _a3 === void 0 ? void 0 : _a3.contains(newElement)) && newElement.tagName !== "BODY") { + previousActiveElement.current = newElement; + } + } else if (previousActiveElement.current) { + tryFocusPreviousActiveElement({ + originalElement: previousActiveElement.current, + containsFocus: true, + documentContainsFocus: ((_b2 = getDocument()) === null || _b2 === void 0 ? void 0 : _b2.hasFocus()) || false + }); + previousActiveElement.current = void 0; + } + }, [hidden, targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement, tryFocusPreviousActiveElement, hostElement]); + return [tryFocusPreviousActiveElement]; + } + function useKeyHandlers(_a2, dismiss, hostElement, openSubMenu) { + var theme = _a2.theme, isSubMenu = _a2.isSubMenu, _b2 = _a2.focusZoneProps, _c2 = _b2 === void 0 ? {} : _b2, checkForNoWrap = _c2.checkForNoWrap, _d2 = _c2.direction, focusZoneDirection = _d2 === void 0 ? FocusZoneDirection.vertical : _d2; + var lastKeyDownWasAltOrMeta = React__namespace.useRef(void 0); + var keyHandler = function(ev, shouldHandleKey, dismissAllMenus) { + var handled = false; + if (shouldHandleKey(ev)) { + dismiss(ev, dismissAllMenus); + ev.preventDefault(); + ev.stopPropagation(); + handled = true; + } + return handled; + }; + var shouldCloseSubMenu = function(ev) { + var submenuCloseKey = getRTL(theme) ? KeyCodes.right : KeyCodes.left; + if (ev.which !== submenuCloseKey || !isSubMenu) { + return false; + } + return !!(focusZoneDirection === FocusZoneDirection.vertical || checkForNoWrap && !shouldWrapFocus(ev.target, "data-no-horizontal-wrap")); + }; + var shouldHandleKeyDown = function(ev) { + return ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + ev.which === KeyCodes.escape || shouldCloseSubMenu(ev) || ev.which === KeyCodes.up && (ev.altKey || ev.metaKey) + ); + }; + var onKeyDown = function(ev) { + lastKeyDownWasAltOrMeta.current = isAltOrMeta$1(ev); + var dismissAllMenus = ev.which === KeyCodes.escape && (isMac() || isIOS()); + return keyHandler(ev, shouldHandleKeyDown, dismissAllMenus); + }; + var shouldHandleKeyUp = function(ev) { + var keyPressIsAltOrMetaAlone = lastKeyDownWasAltOrMeta.current && isAltOrMeta$1(ev); + lastKeyDownWasAltOrMeta.current = false; + return !!keyPressIsAltOrMetaAlone && !(isIOS() || isMac()); + }; + var onKeyUp = function(ev) { + return keyHandler( + ev, + shouldHandleKeyUp, + true + /* dismissAllMenus */ + ); + }; + var onMenuKeyDown = function(ev) { + var handled = onKeyDown(ev); + if (handled || !hostElement.current) { + return; + } + var hasModifier = !!(ev.altKey || ev.metaKey); + var isUp = ev.which === KeyCodes.up; + var isDown = ev.which === KeyCodes.down; + if (!hasModifier && (isUp || isDown)) { + var elementToFocus = isUp ? getLastFocusable(hostElement.current, hostElement.current.lastChild, true) : getFirstFocusable(hostElement.current, hostElement.current.firstChild, true); + if (elementToFocus) { + elementToFocus.focus(); + ev.preventDefault(); + ev.stopPropagation(); + } + } + }; + var onItemKeyDown = function(item, ev) { + var openKey = getRTL(theme) ? KeyCodes.left : KeyCodes.right; + if (!item.disabled && // eslint-disable-next-line @typescript-eslint/no-deprecated + (ev.which === openKey || ev.which === KeyCodes.enter || ev.which === KeyCodes.down && (ev.altKey || ev.metaKey))) { + openSubMenu(item, ev.currentTarget); + ev.preventDefault(); + } + }; + return [onKeyDown, onKeyUp, onMenuKeyDown, onItemKeyDown]; + } + function useScrollHandler(asyncTracker) { + var isScrollIdle = React__namespace.useRef(true); + var scrollIdleTimeoutId = React__namespace.useRef(void 0); + var onScroll = function() { + if (!isScrollIdle.current && scrollIdleTimeoutId.current !== void 0) { + asyncTracker.clearTimeout(scrollIdleTimeoutId.current); + scrollIdleTimeoutId.current = void 0; + } else { + isScrollIdle.current = false; + } + scrollIdleTimeoutId.current = asyncTracker.setTimeout(function() { + isScrollIdle.current = true; + }, NavigationIdleDelay); + }; + return [onScroll, isScrollIdle]; + } + function useOnSubmenuDismiss(dismiss, closeSubMenu) { + var isMountedRef = React__namespace.useRef(false); + React__namespace.useEffect(function() { + isMountedRef.current = true; + return function() { + isMountedRef.current = false; + }; + }, []); + var onSubMenuDismiss = function(ev, dismissAll) { + if (dismissAll) { + dismiss(ev, dismissAll); + } else if (isMountedRef.current) { + closeSubMenu(); + } + }; + return onSubMenuDismiss; + } + function useSubmenuEnterTimer(_a2, asyncTracker) { + var _b2 = _a2.subMenuHoverDelay, subMenuHoverDelay = _b2 === void 0 ? NavigationIdleDelay : _b2; + var enterTimerRef = React__namespace.useRef(void 0); + var cancelSubMenuTimer = function() { + if (enterTimerRef.current !== void 0) { + asyncTracker.clearTimeout(enterTimerRef.current); + enterTimerRef.current = void 0; + } + }; + var startSubmenuTimer = function(onTimerExpired) { + enterTimerRef.current = asyncTracker.setTimeout(function() { + onTimerExpired(); + cancelSubMenuTimer(); + }, subMenuHoverDelay); + }; + return [cancelSubMenuTimer, startSubmenuTimer, enterTimerRef]; + } + function useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss) { + var menuTarget = props.target; + var onItemMouseEnterBase = function(item, ev, target2) { + if (shouldUpdateFocusOnMouseEvent.current) { + gotMouseMove.current = true; + } + if (shouldIgnoreMouseEvent()) { + return; + } + updateFocusOnMouseEvent(item, ev, target2); + }; + var onItemMouseMoveBase = function(item, ev, target2) { + var targetElement = ev.currentTarget; + if (shouldUpdateFocusOnMouseEvent.current) { + gotMouseMove.current = true; + } else { + return; + } + if (!isScrollIdle.current || subMenuEntryTimer.current !== void 0 || targetElement === (targetWindow === null || targetWindow === void 0 ? void 0 : targetWindow.document.activeElement)) { + return; + } + updateFocusOnMouseEvent(item, ev, target2); }; - return (0, _styling.concatStyleSets)(menuItemStyles); -}); - -},{"tslib":"9gizs","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lIK0C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _contextualMenuAnchor = require("./ContextualMenuAnchor"); -parcelHelpers.exportAll(_contextualMenuAnchor, exports); -var _contextualMenuButton = require("./ContextualMenuButton"); -parcelHelpers.exportAll(_contextualMenuButton, exports); -var _contextualMenuSplitButton = require("./ContextualMenuSplitButton"); -parcelHelpers.exportAll(_contextualMenuSplitButton, exports); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -parcelHelpers.exportAll(_contextualMenuItemWrapper, exports); -var _contextualMenuItemWrapperTypes = require("./ContextualMenuItemWrapper.types"); -parcelHelpers.exportAll(_contextualMenuItemWrapperTypes, exports); - -},{"./ContextualMenuAnchor":"gJtGo","./ContextualMenuButton":"i5hAV","./ContextualMenuSplitButton":"151ms","./ContextualMenuItemWrapper":false,"./ContextualMenuItemWrapper.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gJtGo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuAnchor", ()=>ContextualMenuAnchor); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -var _keytipData = require("../../../KeytipData"); -var _index = require("../../../utilities/contextualMenu/index"); -var _contextualMenuItem = require("../ContextualMenuItem"); -var ContextualMenuAnchor = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuAnchor, _super); - function ContextualMenuAnchor() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._anchor = _react.createRef(); - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); - }); - _this._getSubmenuTarget = function() { - return _this._anchor.current ? _this._anchor.current : undefined; - }; - _this._onItemClick = function(ev) { - var _a = _this.props, item = _a.item, onItemClick = _a.onItemClick; - if (onItemClick) onItemClick(item, ev); - }; - _this._renderAriaDescription = function(ariaDescription, className) { - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan - return ariaDescription ? _react.createElement("span", { - id: _this._ariaDescriptionId, - className: className - }, ariaDescription) : null; - }; - return _this; - } - ContextualMenuAnchor.prototype.render = function() { - var _this = this; - var _a = this.props, item = _a.item, classNames = _a.classNames, index = _a.index, focusableElementIndex = _a.focusableElementIndex, totalItemCount = _a.totalItemCount, hasCheckmarks = _a.hasCheckmarks, hasIcons = _a.hasIcons, expandedMenuItemKey = _a.expandedMenuItemKey, onItemClick = _a.onItemClick, openSubMenu = _a.openSubMenu, dismissSubMenu = _a.dismissSubMenu, dismissMenu = _a.dismissMenu; - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (this.props.item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.item.contextualMenuItemAs, ChildrenRenderer); - if (this.props.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.contextualMenuItemAs, ChildrenRenderer); - var anchorRel = item.rel; - if (item.target && item.target.toLowerCase() === '_blank') anchorRel = anchorRel ? anchorRel : 'nofollow noopener noreferrer'; // Safe default to prevent tabjacking - var itemHasSubmenu = (0, _index.hasSubmenu)(item); - var nativeProps = (0, _utilities.getNativeProps)(item, (0, _utilities.anchorProperties)); - var disabled = (0, _index.isItemDisabled)(item); - var itemProps = item.itemProps, ariaDescription = item.ariaDescription; - var keytipProps = item.keytipProps; - if (keytipProps && itemHasSubmenu) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - // Check for ariaDescription to set the _ariaDescriptionId and render a hidden span with - // the description in it to be added to ariaDescribedBy - if (ariaDescription) this._ariaDescriptionId = (0, _utilities.getId)(); - var ariaDescribedByIds = (0, _utilities.mergeAriaAttributeValues)(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : undefined, nativeProps['aria-describedby']); - var additionalItemProperties = { - 'aria-describedby': ariaDescribedByIds - }; - return _react.createElement("div", null, _react.createElement((0, _keytipData.KeytipData), { - keytipProps: item.keytipProps, - ariaDescribedBy: ariaDescribedByIds, - disabled: disabled - }, function(keytipAttributes) { - return _react.createElement("a", (0, _tslib.__assign)({}, additionalItemProperties, nativeProps, keytipAttributes, { - ref: _this._anchor, - href: item.href, - target: item.target, - rel: anchorRel, - className: classNames.root, - role: "menuitem", - "aria-haspopup": itemHasSubmenu || undefined, - "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : undefined, - "aria-posinset": focusableElementIndex + 1, - "aria-setsize": totalItemCount, - "aria-disabled": (0, _index.isItemDisabled)(item), - // eslint-disable-next-line deprecation/deprecation - style: item.style, - onClick: _this._onItemClick, - onMouseEnter: _this._onItemMouseEnter, - onMouseLeave: _this._onItemMouseLeave, - onMouseMove: _this._onItemMouseMove, - onKeyDown: itemHasSubmenu ? _this._onItemKeyDown : undefined - }), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - componentRef: item.componentRef, - item: item, - classNames: classNames, - index: index, - onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined, - hasIcons: hasIcons, - openSubMenu: openSubMenu, - dismissSubMenu: dismissSubMenu, - dismissMenu: dismissMenu, - getSubmenuTarget: _this._getSubmenuTarget - }, itemProps)), _this._renderAriaDescription(ariaDescription, classNames.screenReaderText)); - })); + var shouldIgnoreMouseEvent = function() { + return !isScrollIdle.current || !gotMouseMove.current; }; - return ContextualMenuAnchor; -}((0, _contextualMenuItemWrapper.ContextualMenuItemWrapper)); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","./ContextualMenuItemWrapper":"1NVzL","../../../KeytipData":"9cfzj","../../../utilities/contextualMenu/index":"lGesq","../ContextualMenuItem":"cJR9f","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1NVzL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuItemWrapper", ()=>ContextualMenuItemWrapper); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var ContextualMenuItemWrapper = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuItemWrapper, _super); - function ContextualMenuItemWrapper(props) { - var _this = _super.call(this, props) || this; - _this._onItemMouseEnter = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseEnter = _a.onItemMouseEnter; - if (onItemMouseEnter) onItemMouseEnter(item, ev, ev.currentTarget); - }; - _this._onItemClick = function(ev) { - var _a = _this.props, item = _a.item, onItemClickBase = _a.onItemClickBase; - if (onItemClickBase) onItemClickBase(item, ev, ev.currentTarget); - }; - _this._onItemMouseLeave = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseLeave = _a.onItemMouseLeave; - if (onItemMouseLeave) onItemMouseLeave(item, ev); - }; - _this._onItemKeyDown = function(ev) { - var _a = _this.props, item = _a.item, onItemKeyDown = _a.onItemKeyDown; - if (onItemKeyDown) onItemKeyDown(item, ev); - }; - _this._onItemMouseMove = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseMove = _a.onItemMouseMove; - if (onItemMouseMove) onItemMouseMove(item, ev, ev.currentTarget); - }; - _this._getSubmenuTarget = function() { - return undefined; - }; - (0, _utilities.initializeComponentRef)(_this); - return _this; - } - ContextualMenuItemWrapper.prototype.shouldComponentUpdate = function(newProps) { - return !(0, _utilities.shallowCompare)(newProps, this.props); - }; - return ContextualMenuItemWrapper; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9cfzj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/KeytipData/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/KeytipData/index":"aomaw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aomaw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useKeytipRef", ()=>(0, _useKeytipRef.useKeytipRef)); -var _keytipData = require("./KeytipData"); -parcelHelpers.exportAll(_keytipData, exports); -var _keytipDataTypes = require("./KeytipData.types"); -parcelHelpers.exportAll(_keytipDataTypes, exports); -var _useKeytipRef = require("./useKeytipRef"); - -},{"./KeytipData":"ifQ8O","./KeytipData.types":false,"./useKeytipRef":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ifQ8O":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeytipData", ()=>KeytipData); -var _tslib = require("tslib"); -var _index = require("../../utilities/keytips/index"); -var _useKeytipData = require("./useKeytipData"); -var KeytipData = function(props) { - var _a; - var children = props.children, keytipDataProps = (0, _tslib.__rest)(props, [ - "children" - ]); - var _b = (0, _useKeytipData.useKeytipData)(keytipDataProps), keytipId = _b.keytipId, ariaDescribedBy = _b.ariaDescribedBy; - return children((_a = {}, _a[0, _index.DATAKTP_TARGET] = keytipId, _a[0, _index.DATAKTP_EXECUTE_TARGET] = keytipId, _a['aria-describedby'] = ariaDescribedBy, _a)); -}; - -},{"tslib":"9gizs","../../utilities/keytips/index":"8l91i","./useKeytipData":"ty9OD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8l91i":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _ikeytipTransitionKey = require("./IKeytipTransitionKey"); -parcelHelpers.exportAll(_ikeytipTransitionKey, exports); -var _keytipConfig = require("./KeytipConfig"); -parcelHelpers.exportAll(_keytipConfig, exports); -var _keytipConstants = require("./KeytipConstants"); -parcelHelpers.exportAll(_keytipConstants, exports); -var _keytipManager = require("./KeytipManager"); -parcelHelpers.exportAll(_keytipManager, exports); -var _keytipUtils = require("./KeytipUtils"); -parcelHelpers.exportAll(_keytipUtils, exports); - -},{"./IKeytipTransitionKey":"eJfOe","./KeytipConfig":"koR4Q","./KeytipConstants":"VnNjn","./KeytipManager":"04Pqp","./KeytipUtils":"adsC1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eJfOe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Tests for equality between two IKeytipTransitionKeys. - * - * @param key1 - First IKeytipTransitionKey. - * @param key2 - Second IKeytipTransitionKey. - * @returns T/F if the transition keys are equal. - */ parcelHelpers.export(exports, "transitionKeysAreEqual", ()=>transitionKeysAreEqual); -/** - * Tests if 'key' is present in 'keys'. - * - * @param keys - Array of IKeytipTransitionKey. - * @param key - IKeytipTransitionKey to find in 'keys'. - * @returns T/F if 'keys' contains 'key'. - */ parcelHelpers.export(exports, "transitionKeysContain", ()=>transitionKeysContain); -var _utilities = require("../../Utilities"); -function transitionKeysAreEqual(key1, key2) { - if (key1.key !== key2.key) return false; - var mod1 = key1.modifierKeys; - var mod2 = key2.modifierKeys; - if (!mod1 && mod2 || mod1 && !mod2) // Not equal if one modifier is defined and the other isn't - return false; - if (mod1 && mod2) { - if (mod1.length !== mod2.length) return false; - // Sort both arrays - mod1 = mod1.sort(); - mod2 = mod2.sort(); - for(var i = 0; i < mod1.length; i++){ - if (mod1[i] !== mod2[i]) return false; + var onMouseItemLeave = function(item, ev) { + var _a2; + if (shouldIgnoreMouseEvent()) { + return; + } + cancelSubMenuTimer(); + if (expandedMenuItemKey !== void 0) { + return; + } + if (hostElement.current.setActive) { + try { + hostElement.current.setActive(); + } catch (e) { } - } - return true; -} -function transitionKeysContain(keys, key) { - return !!(0, _utilities.find)(keys, function(transitionKey) { - return transitionKeysAreEqual(transitionKey, key); - }); -} - -},{"../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"koR4Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Builds a map of ID to IKeytipProps - * - * @param config - IKeytipConfig object - * @returns Config map - */ parcelHelpers.export(exports, "buildKeytipConfigMap", ()=>buildKeytipConfigMap); -/** - * Constructs a keytip from an IKeytipConfigItem and puts it in the configMap - * - * @param configMap - IKeytipConfigMap to store the keytip in - * @param parentSequence - string of the parent keytip - * @param keytip - IKeytipConfigItem data - */ parcelHelpers.export(exports, "constructKeytip", ()=>constructKeytip); -var _tslib = require("tslib"); -function buildKeytipConfigMap(config) { - var configMap = {}; - for(var _i = 0, _a = config.keytips; _i < _a.length; _i++){ - var keytip = _a[_i]; - constructKeytip(configMap, [], keytip); - } - return configMap; -} -function constructKeytip(configMap, parentSequence, keytip) { - // Compute full key sequence - var sequence = keytip.sequence ? keytip.sequence : keytip.content.toLocaleLowerCase(); - var keytipSequence = parentSequence.concat(sequence); - // Save props in configMap - var keytipProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, keytip.optionalProps), { - keySequences: keytipSequence, - content: keytip.content - }); - configMap[keytip.id] = keytipProps; - if (keytip.children) for(var _i = 0, _a = keytip.children; _i < _a.length; _i++){ - var child = _a[_i]; - // Create keytips for all children - constructKeytip(configMap, keytipSequence, child); - } -} - -},{"tslib":"9gizs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"VnNjn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KTP_PREFIX", ()=>KTP_PREFIX); -parcelHelpers.export(exports, "KTP_SEPARATOR", ()=>KTP_SEPARATOR); -parcelHelpers.export(exports, "KTP_FULL_PREFIX", ()=>KTP_FULL_PREFIX); -parcelHelpers.export(exports, "DATAKTP_TARGET", ()=>DATAKTP_TARGET); -parcelHelpers.export(exports, "DATAKTP_EXECUTE_TARGET", ()=>DATAKTP_EXECUTE_TARGET); -parcelHelpers.export(exports, "DATAKTP_ARIA_TARGET", ()=>DATAKTP_ARIA_TARGET); -parcelHelpers.export(exports, "KTP_LAYER_ID", ()=>KTP_LAYER_ID); -parcelHelpers.export(exports, "KTP_ARIA_SEPARATOR", ()=>KTP_ARIA_SEPARATOR); -parcelHelpers.export(exports, "KeytipEvents", ()=>KeytipEvents); -var KTP_PREFIX = 'ktp'; -var KTP_SEPARATOR = '-'; -var KTP_FULL_PREFIX = KTP_PREFIX + KTP_SEPARATOR; -var DATAKTP_TARGET = 'data-ktp-target'; -var DATAKTP_EXECUTE_TARGET = 'data-ktp-execute-target'; -var DATAKTP_ARIA_TARGET = 'data-ktp-aria-target'; -var KTP_LAYER_ID = 'ktp-layer-id'; -var KTP_ARIA_SEPARATOR = ', '; -var KeytipEvents; -(function(KeytipEvents) { - KeytipEvents.KEYTIP_ADDED = 'keytipAdded'; - KeytipEvents.KEYTIP_REMOVED = 'keytipRemoved'; - KeytipEvents.KEYTIP_UPDATED = 'keytipUpdated'; - KeytipEvents.PERSISTED_KEYTIP_ADDED = 'persistedKeytipAdded'; - KeytipEvents.PERSISTED_KEYTIP_REMOVED = 'persistedKeytipRemoved'; - KeytipEvents.PERSISTED_KEYTIP_EXECUTE = 'persistedKeytipExecute'; - KeytipEvents.ENTER_KEYTIP_MODE = 'enterKeytipMode'; - KeytipEvents.EXIT_KEYTIP_MODE = 'exitKeytipMode'; -})(KeytipEvents || (KeytipEvents = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"04Pqp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeytipManager", ()=>KeytipManager); -var _tslib = require("tslib"); -var _utilities = require("../../Utilities"); -var _keytipConstants = require("../../utilities/keytips/KeytipConstants"); -/** - * This class is responsible for handling registering, updating, and unregistering of keytips - */ var KeytipManager = /** @class */ function() { - function KeytipManager() { - this.keytips = {}; - this.persistedKeytips = {}; - this.sequenceMapping = {}; - // This is (and should be) updated and kept in sync - // with the inKeytipMode in KeytipLayer. - this.inKeytipMode = false; - // Boolean that gets checked before entering keytip mode by the KeytipLayer - // Used for an override in special cases (e.g. Disable entering keytip mode when a modal is shown) - this.shouldEnterKeytipMode = true; - // Boolean to indicate whether to delay firing an event to update subscribers of - // keytip data changed. - this.delayUpdatingKeytipChange = false; - } - /** - * Static function to get singleton KeytipManager instance - * - * @returns Singleton KeytipManager instance - */ KeytipManager.getInstance = function() { - return this._instance; + } else { + (_a2 = hostElement.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + } }; - /** - * Initialization code to set set parameters to define - * how the KeytipManager handles keytip data. - * - * @param delayUpdatingKeytipChange - T/F if we should delay notifiying keytip subscribers - * of keytip changes - */ KeytipManager.prototype.init = function(delayUpdatingKeytipChange) { - this.delayUpdatingKeytipChange = delayUpdatingKeytipChange; + var updateFocusOnMouseEvent = function(item, ev, target2) { + var targetElement = target2 ? target2 : ev.currentTarget; + if (item.key === expandedMenuItemKey) { + return; + } + cancelSubMenuTimer(); + if (expandedMenuItemKey === void 0) { + targetElement.focus(); + } + if (hasSubmenu(item)) { + ev.stopPropagation(); + startSubmenuTimer(function() { + targetElement.focus(); + openSubMenu(item, targetElement, true); + }); + } else { + startSubmenuTimer(function() { + onSubMenuDismiss(ev); + targetElement.focus(); + }); + } }; - /** - * Registers a keytip - * - * @param keytipProps - Keytip to register - * @param persisted - T/F if this keytip should be persisted, default is false - * @returns Unique ID for this keytip - */ KeytipManager.prototype.register = function(keytipProps, persisted) { - if (persisted === void 0) persisted = false; - var props = keytipProps; - if (!persisted) { - // Add the overflowSetSequence if necessary - props = this.addParentOverflow(keytipProps); - this.sequenceMapping[props.keySequences.toString()] = props; - } - // Create a unique keytip - var uniqueKeytip = this._getUniqueKtp(props); - // Add to dictionary - persisted ? this.persistedKeytips[uniqueKeytip.uniqueID] = uniqueKeytip : this.keytips[uniqueKeytip.uniqueID] = uniqueKeytip; - // We only want to add something new if we are currently showing keytip mode - if (this.inKeytipMode || !this.delayUpdatingKeytipChange) { - var event_1 = persisted ? (0, _keytipConstants.KeytipEvents).PERSISTED_KEYTIP_ADDED : (0, _keytipConstants.KeytipEvents).KEYTIP_ADDED; - (0, _utilities.EventGroup).raise(this, event_1, { - keytip: props, - uniqueID: uniqueKeytip.uniqueID - }); - } - return uniqueKeytip.uniqueID; + var onItemClick = function(item, ev) { + onItemClickBase(item, ev, ev.currentTarget); }; - /** - * Update a keytip - * - * @param keytipProps - Keytip to update - * @param uniqueID - Unique ID of this keytip - */ KeytipManager.prototype.update = function(keytipProps, uniqueID) { - var newKeytipProps = this.addParentOverflow(keytipProps); - var uniqueKeytip = this._getUniqueKtp(newKeytipProps, uniqueID); - var oldKeyTip = this.keytips[uniqueID]; - if (oldKeyTip) { - // Update everything except 'visible' - uniqueKeytip.keytip.visible = oldKeyTip.keytip.visible; - // Update keytip in this.keytips - this.keytips[uniqueID] = uniqueKeytip; - // Update the sequence to be up to date - delete this.sequenceMapping[oldKeyTip.keytip.keySequences.toString()]; - this.sequenceMapping[uniqueKeytip.keytip.keySequences.toString()] = uniqueKeytip.keytip; - // Raise event only if we are currently in keytip mode - if (this.inKeytipMode || !this.delayUpdatingKeytipChange) (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).KEYTIP_UPDATED, { - keytip: uniqueKeytip.keytip, - uniqueID: uniqueKeytip.uniqueID - }); + var onItemClickBase = function(item, ev, target2) { + var items = getSubmenuItems(item, { target: menuTarget }); + cancelSubMenuTimer(); + if (!hasSubmenu(item) && (!items || !items.length)) { + executeItemClick(item, ev); + } else { + if (item.key !== expandedMenuItemKey) { + var shouldFocusOnContainer = typeof props.shouldFocusOnContainer === "boolean" ? props.shouldFocusOnContainer : ev.nativeEvent.pointerType === "mouse"; + openSubMenu(item, target2, shouldFocusOnContainer); } + } + ev.stopPropagation(); + ev.preventDefault(); }; - /** - * Unregisters a keytip - * - * @param keytipToRemove - IKeytipProps of the keytip to remove - * @param uniqueID - Unique ID of this keytip - * @param persisted - T/F if this keytip should be persisted, default is false - */ KeytipManager.prototype.unregister = function(keytipToRemove, uniqueID, persisted) { - if (persisted === void 0) persisted = false; - persisted ? delete this.persistedKeytips[uniqueID] : delete this.keytips[uniqueID]; - !persisted && delete this.sequenceMapping[keytipToRemove.keySequences.toString()]; - var event = persisted ? (0, _keytipConstants.KeytipEvents).PERSISTED_KEYTIP_REMOVED : (0, _keytipConstants.KeytipEvents).KEYTIP_REMOVED; - // Update keytips only if we're in keytip mode - if (this.inKeytipMode || !this.delayUpdatingKeytipChange) (0, _utilities.EventGroup).raise(this, event, { - keytip: keytipToRemove, - uniqueID: uniqueID - }); + var onAnchorClick = function(item, ev) { + executeItemClick(item, ev); + ev.stopPropagation(); }; - /** - * Manual call to enter keytip mode - */ KeytipManager.prototype.enterKeytipMode = function() { - (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).ENTER_KEYTIP_MODE); + var executeItemClick = function(item, ev) { + if (item.disabled || item.isDisabled) { + return; + } + if (item.preferMenuTargetAsEventTarget) { + overrideTarget(ev, menuTarget); + } + var shouldDismiss = false; + if (item.onClick) { + shouldDismiss = !!item.onClick(ev, item); + } else if (props.onItemClick) { + shouldDismiss = !!props.onItemClick(ev, item); + } + if (shouldDismiss || !ev.defaultPrevented) { + dismiss(ev, true); + } }; - /** - * Manual call to exit keytip mode - */ KeytipManager.prototype.exitKeytipMode = function() { - (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).EXIT_KEYTIP_MODE); + return [ + onItemMouseEnterBase, + onItemMouseMoveBase, + onMouseItemLeave, + onItemClick, + onAnchorClick, + executeItemClick, + onItemClickBase + ]; + } + var ContextualMenuBase = React__namespace.memo(React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var _a2; + var _b2 = getPropsWithDefaults(DEFAULT_PROPS$4, propsWithoutDefaults); + _b2.ref; + var props = __rest(_b2, ["ref"]); + var hostElement = React__namespace.useRef(null); + var asyncTracker = useAsync(); + var menuId = useId(COMPONENT_NAME$7, props.id); + var dismiss = function(ev, dismissAll) { + var _a3; + return (_a3 = props.onDismiss) === null || _a3 === void 0 ? void 0 : _a3.call(props, ev, dismissAll); }; - /** - * Gets all IKeytipProps from this.keytips - * - * @returns All keytips stored in the manager - */ KeytipManager.prototype.getKeytips = function() { - var _this = this; - return Object.keys(this.keytips).map(function(key) { - return _this.keytips[key].keytip; - }); + var _c2 = useTarget(props.target, hostElement), targetRef = _c2[0], targetWindow = _c2[1]; + var tryFocusPreviousActiveElement = usePreviousActiveElement(props, targetWindow, hostElement)[0]; + var _d2 = useSubMenuState(props, dismiss), expandedMenuItemKey = _d2[0], openSubMenu = _d2[1], getSubmenuProps = _d2[2], onSubMenuDismiss = _d2[3]; + var _e2 = useShouldUpdateFocusOnMouseMove(props), shouldUpdateFocusOnMouseEvent = _e2[0], gotMouseMove = _e2[1], onMenuFocusCapture = _e2[2]; + var _f = useScrollHandler(asyncTracker), onScroll = _f[0], isScrollIdle = _f[1]; + var _g = useSubmenuEnterTimer(props, asyncTracker), cancelSubMenuTimer = _g[0], startSubmenuTimer = _g[1], subMenuEntryTimer = _g[2]; + var responsiveMode = useResponsiveMode(hostElement, props.responsiveMode); + useVisibility(props); + var _h = useKeyHandlers(props, dismiss, hostElement, openSubMenu), onKeyDown = _h[0], onKeyUp = _h[1], onMenuKeyDown = _h[2], onItemKeyDown = _h[3]; + var _j = useMouseHandlers(props, isScrollIdle, subMenuEntryTimer, targetWindow, shouldUpdateFocusOnMouseEvent, gotMouseMove, expandedMenuItemKey, hostElement, startSubmenuTimer, cancelSubMenuTimer, openSubMenu, onSubMenuDismiss, dismiss), onItemMouseEnterBase = _j[0], onItemMouseMoveBase = _j[1], onMouseItemLeave = _j[2], onItemClick = _j[3], onAnchorClick = _j[4], executeItemClick = _j[5], onItemClickBase = _j[6]; + var onDefaultRenderMenuList = function(menuListProps, menuClassNames, defaultRender) { + var indexCorrection = 0; + var items2 = menuListProps.items, totalItemCount = menuListProps.totalItemCount, hasCheckmarks2 = menuListProps.hasCheckmarks, hasIcons2 = menuListProps.hasIcons; + return React__namespace.createElement("ul", { className: menuClassNames.list, onKeyDown, onKeyUp, role: "presentation" }, items2.map(function(item, index2) { + var menuItem = renderMenuItem(item, index2, indexCorrection, totalItemCount, hasCheckmarks2, hasIcons2, menuClassNames); + if (item.itemType !== ContextualMenuItemType.Divider && item.itemType !== ContextualMenuItemType.Header) { + var indexIncrease = item.customOnRenderListLength ? item.customOnRenderListLength : 1; + indexCorrection += indexIncrease; + } + return menuItem; + })); + }; + var renderFocusZone = function(children2, adjustedFocusZoneProps2) { + var _a3 = props.focusZoneAs, ChildrenRenderer = _a3 === void 0 ? FocusZone : _a3; + return React__namespace.createElement(ChildrenRenderer, __assign$1({}, adjustedFocusZoneProps2), children2); + }; + var renderMenuItem = function(item, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2, menuClassNames) { + var _a3; + var renderedItems = []; + var iconProps = item.iconProps || { iconName: "None" }; + var getItemClassNames2 = item.getItemClassNames, itemProps = item.itemProps; + var styles2 = itemProps ? itemProps.styles : void 0; + var dividerClassName = item.itemType === ContextualMenuItemType.Divider ? item.className : void 0; + var subMenuIconClassName = item.submenuIconProps ? item.submenuIconProps.className : ""; + var itemClassNames; + if (getItemClassNames2) { + itemClassNames = getItemClassNames2(props.theme, isItemDisabled(item), expandedMenuItemKey === item.key, !!getIsChecked(item), !!item.href, iconProps.iconName !== "None", item.className, dividerClassName, iconProps.className, subMenuIconClassName, item.primaryDisabled); + } else { + var itemStyleProps = { + theme: props.theme, + disabled: isItemDisabled(item), + expanded: expandedMenuItemKey === item.key, + checked: !!getIsChecked(item), + isAnchorLink: !!item.href, + knownIcon: iconProps.iconName !== "None", + itemClassName: item.className, + dividerClassName, + iconClassName: iconProps.className, + subMenuClassName: subMenuIconClassName, + primaryDisabled: item.primaryDisabled + }; + itemClassNames = getContextualMenuItemClassNames(_getMenuItemStylesFunction((_a3 = menuClassNames.subComponentStyles) === null || _a3 === void 0 ? void 0 : _a3.menuItem, styles2), itemStyleProps); + } + if (item.text === "-" || item.name === "-") { + item.itemType = ContextualMenuItemType.Divider; + } + switch (item.itemType) { + case ContextualMenuItemType.Divider: + renderedItems.push(renderSeparator(index2, itemClassNames)); + break; + case ContextualMenuItemType.Header: + renderedItems.push(renderSeparator(index2, itemClassNames)); + var headerItem = renderHeaderMenuItem(item, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2); + renderedItems.push(renderListItem(headerItem, item.key || index2, itemClassNames, item.title)); + break; + case ContextualMenuItemType.Section: + renderedItems.push(renderSectionItem(item, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2)); + break; + default: + var defaultRenderNormalItem = function() { + return renderNormalItem(item, itemClassNames, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2); + }; + var menuItem = props.onRenderContextualMenuItem ? props.onRenderContextualMenuItem(item, defaultRenderNormalItem) : defaultRenderNormalItem(); + renderedItems.push(renderListItem(menuItem, item.key || index2, itemClassNames, item.title)); + break; + } + return React__namespace.createElement(React__namespace.Fragment, { key: item.key }, renderedItems); }; - /** - * Adds the overflowSetSequence to the keytipProps if its parent keytip also has it - * - * @param keytipProps - Keytip props to add overflowSetSequence to if necessary - * @returns - Modified keytip props, if needed to be modified - */ KeytipManager.prototype.addParentOverflow = function(keytipProps) { - var fullSequence = (0, _tslib.__spreadArray)([], keytipProps.keySequences, true); - fullSequence.pop(); - if (fullSequence.length !== 0) { - var parentKeytip = this.sequenceMapping[fullSequence.toString()]; - if (parentKeytip && parentKeytip.overflowSetSequence) return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - overflowSetSequence: parentKeytip.overflowSetSequence - }); + var defaultMenuItemRenderer = function(item, menuClassNames) { + var index2 = item.index, focusableElementIndex = item.focusableElementIndex, totalItemCount = item.totalItemCount, hasCheckmarks2 = item.hasCheckmarks, hasIcons2 = item.hasIcons; + return renderMenuItem(item, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2, menuClassNames); + }; + var renderSectionItem = function(sectionItem, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2) { + var sectionProps = sectionItem.sectionProps; + if (!sectionProps) { + return; + } + var headerItem; + var groupProps; + if (sectionProps.title) { + var headerContextualMenuItem = void 0; + var ariaLabelledby = ""; + if (typeof sectionProps.title === "string") { + var id_1 = menuId + sectionProps.title.replace(/\s/g, ""); + headerContextualMenuItem = { + key: "section-".concat(sectionProps.title, "-title"), + itemType: ContextualMenuItemType.Header, + text: sectionProps.title, + id: id_1 + }; + ariaLabelledby = id_1; + } else { + var id_2 = sectionProps.title.id || menuId + sectionProps.title.key.replace(/\s/g, ""); + headerContextualMenuItem = __assign$1(__assign$1({}, sectionProps.title), { id: id_2 }); + ariaLabelledby = id_2; } - return keytipProps; + if (headerContextualMenuItem) { + groupProps = { + role: "group", + "aria-labelledby": ariaLabelledby + }; + headerItem = renderHeaderMenuItem(headerContextualMenuItem, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2); + } + } + if (sectionProps.items && sectionProps.items.length > 0) { + var correctedIndex_1 = 0; + return React__namespace.createElement( + "li", + { role: "presentation", key: sectionProps.key || sectionItem.key || "section-".concat(index2) }, + React__namespace.createElement( + "div", + __assign$1({}, groupProps), + React__namespace.createElement( + "ul", + { className: menuClassNames.list, role: "presentation" }, + sectionProps.topDivider && renderSeparator(index2, itemClassNames, true, true), + headerItem && renderListItem(headerItem, sectionItem.key || index2, itemClassNames, sectionItem.title), + sectionProps.items.map(function(contextualMenuItem, itemsIndex) { + var menuItem = renderMenuItem(contextualMenuItem, itemsIndex, correctedIndex_1, getItemCount(sectionProps.items), hasCheckmarks2, hasIcons2, menuClassNames); + if (contextualMenuItem.itemType !== ContextualMenuItemType.Divider && contextualMenuItem.itemType !== ContextualMenuItemType.Header) { + var indexIncrease = contextualMenuItem.customOnRenderListLength ? contextualMenuItem.customOnRenderListLength : 1; + correctedIndex_1 += indexIncrease; + } + return menuItem; + }), + sectionProps.bottomDivider && renderSeparator(index2, itemClassNames, false, true) + ) + ) + ); + } }; - /** - * Public function to bind for overflow items that have a submenu - */ KeytipManager.prototype.menuExecute = function(overflowButtonSequences, keytipSequences) { - (0, _utilities.EventGroup).raise(this, (0, _keytipConstants.KeytipEvents).PERSISTED_KEYTIP_EXECUTE, { - overflowButtonSequences: overflowButtonSequences, - keytipSequences: keytipSequences - }); + var renderListItem = function(content2, key2, classNames3, title2) { + return React__namespace.createElement("li", { role: "presentation", title: title2, key: key2, className: classNames3.item }, content2); }; - /** - * Creates an IUniqueKeytip object - * - * @param keytipProps - IKeytipProps - * @param uniqueID - Unique ID, will default to the next unique ID if not passed - * @returns IUniqueKeytip object - */ KeytipManager.prototype._getUniqueKtp = function(keytipProps, uniqueID) { - if (uniqueID === void 0) uniqueID = (0, _utilities.getId)(); - return { - keytip: (0, _tslib.__assign)({}, keytipProps), - uniqueID: uniqueID - }; + var renderSeparator = function(index2, classNames3, top, fromSection) { + if (fromSection || index2 > 0) { + return React__namespace.createElement("li", { role: "separator", key: "separator-" + index2 + (top === void 0 ? "" : top ? "-top" : "-bottom"), className: classNames3.divider, "aria-hidden": "true" }); + } + return null; }; - KeytipManager._instance = new KeytipManager(); - return KeytipManager; -}(); - -},{"tslib":"9gizs","../../Utilities":"1NZCy","../../utilities/keytips/KeytipConstants":"VnNjn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"adsC1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Converts a whole set of KeySequences into one keytip ID, which will be the ID for the last keytip sequence specified - * keySequences should not include the initial keytip 'start' sequence. - * - * @param keySequences - Full path of IKeySequences for one keytip. - * @returns String to use for the keytip ID. - */ parcelHelpers.export(exports, "sequencesToID", ()=>sequencesToID); -/** - * Merges an overflow sequence with a key sequence. - * - * @param keySequences - Full sequence for one keytip. - * @param overflowKeySequences - Full overflow keytip sequence. - * @returns Sequence that will be used by the keytip when in the overflow. - */ parcelHelpers.export(exports, "mergeOverflows", ()=>mergeOverflows); -/** - * Constructs the data-ktp-target attribute selector from a full key sequence. - * - * @param keySequences - Full string[] for a Keytip. - * @returns String selector to use to query for the keytip target. - */ parcelHelpers.export(exports, "ktpTargetFromSequences", ()=>ktpTargetFromSequences); -/** - * Constructs the data-ktp-execute-target attribute selector from a keytip ID. - * - * @param keytipId - ID of the Keytip. - * @returns String selector to use to query for the keytip execute target. - */ parcelHelpers.export(exports, "ktpTargetFromId", ()=>ktpTargetFromId); -/** - * Gets the aria-describedby value to put on the component with this keytip. - * - * @param keySequences - KeySequences of the keytip. - * @returns The aria-describedby value to set on the component with this keytip. - */ parcelHelpers.export(exports, "getAriaDescribedBy", ()=>getAriaDescribedBy); -var _tslib = require("tslib"); -var _keytipConstants = require("./KeytipConstants"); -var _utilities = require("../../Utilities"); -function sequencesToID(keySequences) { - return keySequences.reduce(function(prevValue, keySequence) { - return prevValue + (0, _keytipConstants.KTP_SEPARATOR) + keySequence.split('').join((0, _keytipConstants.KTP_SEPARATOR)); - }, (0, _keytipConstants.KTP_PREFIX)); -} -function mergeOverflows(keySequences, overflowKeySequences) { - var overflowSequenceLen = overflowKeySequences.length; - var overflowSequence = (0, _tslib.__spreadArray)([], overflowKeySequences, true).pop(); - var newKeySequences = (0, _tslib.__spreadArray)([], keySequences, true); - return (0, _utilities.addElementAtIndex)(newKeySequences, overflowSequenceLen - 1, overflowSequence); -} -function ktpTargetFromSequences(keySequences) { - return '[' + (0, _keytipConstants.DATAKTP_TARGET) + '="' + sequencesToID(keySequences) + '"]'; -} -function ktpTargetFromId(keytipId) { - return '[' + (0, _keytipConstants.DATAKTP_EXECUTE_TARGET) + '="' + keytipId + '"]'; -} -function getAriaDescribedBy(keySequences) { - var describedby = ' ' + (0, _keytipConstants.KTP_LAYER_ID); - if (!keySequences.length) // Return just the layer ID - return describedby; - return describedby + ' ' + sequencesToID(keySequences); -} - -},{"tslib":"9gizs","./KeytipConstants":"VnNjn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ty9OD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Hook that creates attributes for components which are enabled with Keytip. - */ parcelHelpers.export(exports, "useKeytipData", ()=>useKeytipData); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("../../Utilities"); -var _index = require("../../utilities/keytips/index"); -function useKeytipData(options) { - var uniqueId = _react.useRef(); - var keytipProps = options.keytipProps ? (0, _tslib.__assign)({ - disabled: options.disabled - }, options.keytipProps) : undefined; - var keytipManager = (0, _reactHooks.useConst)((0, _index.KeytipManager).getInstance()); - var prevOptions = (0, _reactHooks.usePrevious)(options); - // useLayoutEffect used to strictly emulate didUpdate/didMount behavior - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - if (uniqueId.current && keytipProps && ((prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.keytipProps) !== options.keytipProps || (prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.disabled) !== options.disabled)) keytipManager.update(keytipProps, uniqueId.current); + var renderNormalItem = function(item, classNames3, index2, focusableElementIndex, totalItemCount, hasCheckmarks2, hasIcons2) { + if (item.onRender) { + return item.onRender(__assign$1({ "aria-posinset": focusableElementIndex + 1, "aria-setsize": totalItemCount }, item), dismiss); + } + var contextualMenuItemAs = props.contextualMenuItemAs; + var commonProps = { + item, + classNames: classNames3, + index: index2, + focusableElementIndex, + totalItemCount, + hasCheckmarks: hasCheckmarks2, + hasIcons: hasIcons2, + contextualMenuItemAs, + onItemMouseEnter: onItemMouseEnterBase, + onItemMouseLeave: onMouseItemLeave, + onItemMouseMove: onItemMouseMoveBase, + onItemMouseDown, + executeItemClick, + onItemKeyDown, + expandedMenuItemKey, + openSubMenu, + dismissSubMenu: onSubMenuDismiss, + dismissMenu: dismiss + }; + if (item.href) { + var ContextualMenuAnchorAs = ContextualMenuAnchor; + if (item.contextualMenuItemWrapperAs) { + ContextualMenuAnchorAs = composeComponentAs(item.contextualMenuItemWrapperAs, ContextualMenuAnchorAs); + } + return React__namespace.createElement(ContextualMenuAnchorAs, __assign$1({}, commonProps, { onItemClick: onAnchorClick })); + } + if (item.split && hasSubmenu(item)) { + var ContextualMenuSplitButtonAs = ContextualMenuSplitButton; + if (item.contextualMenuItemWrapperAs) { + ContextualMenuSplitButtonAs = composeComponentAs(item.contextualMenuItemWrapperAs, ContextualMenuSplitButtonAs); + } + return React__namespace.createElement(ContextualMenuSplitButtonAs, __assign$1({}, commonProps, { onItemClick, onItemClickBase, onTap: cancelSubMenuTimer })); + } + var ContextualMenuButtonAs = ContextualMenuButton; + if (item.contextualMenuItemWrapperAs) { + ContextualMenuButtonAs = composeComponentAs(item.contextualMenuItemWrapperAs, ContextualMenuButtonAs); + } + return React__namespace.createElement(ContextualMenuButtonAs, __assign$1({}, commonProps, { onItemClick, onItemClickBase })); + }; + var renderHeaderMenuItem = function(item, itemClassNames, menuClassNames, index2, hasCheckmarks2, hasIcons2) { + var ChildrenRenderer = ContextualMenuItem; + if (item.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(item.contextualMenuItemAs, ChildrenRenderer); + } + if (props.contextualMenuItemAs) { + ChildrenRenderer = composeComponentAs(props.contextualMenuItemAs, ChildrenRenderer); + } + var itemProps = item.itemProps, id3 = item.id; + var divHtmlProperties = itemProps && getNativeProps(itemProps, divProperties); + return ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + React__namespace.createElement( + "div", + __assign$1({ id: id3, className: menuClassNames.header }, divHtmlProperties, { style: item.style }), + React__namespace.createElement(ChildrenRenderer, __assign$1({ item, classNames: itemClassNames, index: index2, onCheckmarkClick: hasCheckmarks2 ? onItemClick : void 0, hasIcons: hasIcons2 }, itemProps)) + ) + ); + }; + var isBeakVisible = props.isBeakVisible; + var items = props.items, labelElementId = props.labelElementId, id2 = props.id, className2 = props.className, beakWidth = props.beakWidth, directionalHint = props.directionalHint, directionalHintForRTL = props.directionalHintForRTL, alignTargetEdge = props.alignTargetEdge, gapSpace = props.gapSpace, coverTarget = props.coverTarget, ariaLabel2 = props.ariaLabel, doNotLayer = props.doNotLayer, target2 = props.target, bounds2 = props.bounds, useTargetWidth = props.useTargetWidth, useTargetAsMinWidth = props.useTargetAsMinWidth, directionalHintFixed = props.directionalHintFixed, shouldFocusOnMount = props.shouldFocusOnMount, shouldFocusOnContainer = props.shouldFocusOnContainer, title = props.title, styles = props.styles, theme = props.theme, calloutProps = props.calloutProps, _k = props.onRenderSubMenu, onRenderSubMenu2 = _k === void 0 ? onDefaultRenderSubMenu : _k, _l = props.onRenderMenuList, onRenderMenuList = _l === void 0 ? function(menuListProps, defaultRender) { + return onDefaultRenderMenuList(menuListProps, classNames2); + } : _l, focusZoneProps = props.focusZoneProps, getMenuClassNames = props.getMenuClassNames; + var classNames2 = getMenuClassNames ? getMenuClassNames(theme, className2) : getClassNames$l(styles, { + theme, + className: className2 }); - (0, _reactHooks.useIsomorphicLayoutEffect)(function() { - // Register Keytip in KeytipManager - if (keytipProps) uniqueId.current = keytipManager.register(keytipProps); - return function() { - // Unregister Keytip in KeytipManager - keytipProps && keytipManager.unregister(keytipProps, uniqueId.current); + var hasIcons = itemsHaveIcons(items); + function itemsHaveIcons(contextualMenuItems) { + for (var _i = 0, contextualMenuItems_1 = contextualMenuItems; _i < contextualMenuItems_1.length; _i++) { + var item = contextualMenuItems_1[_i]; + if (item.iconProps) { + return true; + } + if (item.itemType === ContextualMenuItemType.Section && item.sectionProps && itemsHaveIcons(item.sectionProps.items)) { + return true; + } + } + return false; + } + var adjustedFocusZoneProps = __assign$1(__assign$1({ direction: FocusZoneDirection.vertical, handleTabKey: FocusZoneTabbableElements.all, isCircularNavigation: true, "data-tabster": '{"uncontrolled": {}, "focusable": { "excludeFromMover": true }}' }, focusZoneProps), { className: css(classNames2.root, (_a2 = props.focusZoneProps) === null || _a2 === void 0 ? void 0 : _a2.className) }); + var hasCheckmarks = canAnyMenuItemsCheck(items); + var submenuProps = expandedMenuItemKey && props.hidden !== true ? getSubmenuProps() : null; + isBeakVisible = isBeakVisible === void 0 ? responsiveMode <= ResponsiveMode.medium : isBeakVisible; + var contextMenuStyle; + var targetAsHtmlElement = targetRef.current; + if ((useTargetWidth || useTargetAsMinWidth) && targetAsHtmlElement && targetAsHtmlElement.offsetWidth) { + var targetBoundingRect = targetAsHtmlElement.getBoundingClientRect(); + var targetWidth = targetBoundingRect.width - 2; + if (useTargetWidth) { + contextMenuStyle = { + width: targetWidth }; - // this is meant to run only at mount, and updates are handled separately - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - var nativeKeytipProps = { - ariaDescribedBy: options.ariaDescribedBy, - keytipId: undefined + } else if (useTargetAsMinWidth) { + contextMenuStyle = { + minWidth: targetWidth + }; + } + } + if (items && items.length > 0) { + var totalItemCount_1 = getItemCount(items); + var calloutStyles_1 = classNames2.subComponentStyles ? classNames2.subComponentStyles.callout : void 0; + return React__namespace.createElement(MenuContext.Consumer, null, function(menuContext) { + return React__namespace.createElement( + Callout, + __assign$1({ styles: calloutStyles_1, onRestoreFocus: tryFocusPreviousActiveElement }, calloutProps, { target: target2 || menuContext.target, isBeakVisible, beakWidth, directionalHint, directionalHintForRTL, gapSpace, coverTarget, doNotLayer, className: css("ms-ContextualMenu-Callout", calloutProps && calloutProps.className), setInitialFocus: shouldFocusOnMount, onDismiss: props.onDismiss || menuContext.onDismiss, onScroll, bounds: bounds2, directionalHintFixed, alignTargetEdge, hidden: props.hidden || menuContext.hidden, ref: forwardedRef }), + React__namespace.createElement( + "div", + { style: contextMenuStyle, ref: hostElement, id: id2, className: classNames2.container, tabIndex: shouldFocusOnContainer ? 0 : -1, onKeyDown: onMenuKeyDown, onKeyUp, onFocusCapture: onMenuFocusCapture, "aria-label": ariaLabel2, "aria-labelledby": labelElementId, role: "menu" }, + title && React__namespace.createElement( + "div", + { className: classNames2.title }, + " ", + title, + " " + ), + items && items.length ? renderFocusZone(onRenderMenuList({ + ariaLabel: ariaLabel2, + items, + totalItemCount: totalItemCount_1, + hasCheckmarks, + hasIcons, + defaultMenuItemRenderer: function(item) { + return defaultMenuItemRenderer(item, classNames2); + }, + labelElementId + }, function(menuListProps, defaultRender) { + return onDefaultRenderMenuList(menuListProps, classNames2); + }), adjustedFocusZoneProps) : null, + submenuProps && onRenderSubMenu2(submenuProps, onDefaultRenderSubMenu) + ), + React__namespace.createElement(FocusRects, null) + ); + }); + } else { + return null; + } + }), function(prevProps, newProps) { + if (!newProps.shouldUpdateWhenHidden && prevProps.hidden && newProps.hidden) { + return true; + } + return shallowCompare(prevProps, newProps); + }); + ContextualMenuBase.displayName = "ContextualMenuBase"; + function isAltOrMeta$1(ev) { + return ev.which === KeyCodes.alt || ev.key === "Meta"; + } + function onItemMouseDown(item, ev) { + var _a2; + (_a2 = item.onMouseDown) === null || _a2 === void 0 ? void 0 : _a2.call(item, item, ev); + } + function onDefaultRenderSubMenu(subMenuProps, defaultRender) { + throw Error("ContextualMenuBase: onRenderSubMenu callback is null or undefined. Please ensure to set `onRenderSubMenu` property either manually or with `styled` helper."); + } + function findItemByKeyFromItems(key2, items) { + for (var _i = 0, items_3 = items; _i < items_3.length; _i++) { + var item = items_3[_i]; + if (item.itemType === ContextualMenuItemType.Section && item.sectionProps) { + var match2 = findItemByKeyFromItems(key2, item.sectionProps.items); + if (match2) { + return match2; + } + } else if (item.key && item.key === key2) { + return item; + } + } + } + function getOnClickWithOverrideTarget(onClick, target2) { + return onClick ? function(ev, item) { + overrideTarget(ev, target2); + return onClick(ev, item); + } : onClick; + } + function overrideTarget(ev, target2) { + if (ev && target2) { + ev.persist(); + if (target2 instanceof Event) { + ev.target = target2.target; + } else if (target2 instanceof Element) { + ev.target = target2; + } + } + } + var GlobalClassNames$c = { + root: "ms-ContextualMenu", + container: "ms-ContextualMenu-container", + list: "ms-ContextualMenu-list", + header: "ms-ContextualMenu-header", + title: "ms-ContextualMenu-title", + isopen: "is-open" + }; + var getStyles$q = function(props) { + var className2 = props.className, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$c, theme); + var fonts = theme.fonts, semanticColors = theme.semanticColors, effects = theme.effects; + return { + root: [ + theme.fonts.medium, + classNames2.root, + classNames2.isopen, + { + backgroundColor: semanticColors.menuBackground, + minWidth: "180px" + }, + className2 + ], + container: [ + classNames2.container, + { + selectors: { + ":focus": { outline: 0 } + } + } + ], + list: [ + classNames2.list, + classNames2.isopen, + { + listStyleType: "none", + margin: "0", + padding: "0" + } + ], + header: [ + classNames2.header, + fonts.small, + { + fontWeight: FontWeights.semibold, + color: semanticColors.menuHeader, + background: "none", + backgroundColor: "transparent", + border: "none", + height: CONTEXTUAL_MENU_ITEM_HEIGHT, + lineHeight: CONTEXTUAL_MENU_ITEM_HEIGHT, + cursor: "default", + padding: "0px 6px", + userSelect: "none", + textAlign: "left" + } + ], + title: [ + classNames2.title, + { + fontSize: fonts.mediumPlus.fontSize, + paddingRight: "14px", + paddingLeft: "14px", + paddingBottom: "5px", + paddingTop: "5px", + backgroundColor: semanticColors.menuItemBackgroundPressed + } + ], + subComponentStyles: { + callout: { + root: { + boxShadow: effects.elevation8 + } + }, + menuItem: {} + } }; - if (keytipProps) nativeKeytipProps = getKeytipData(keytipManager, keytipProps, options.ariaDescribedBy); - return nativeKeytipProps; -} -/** - * Gets the aria- and data- attributes to attach to the component - * @param keytipProps - options for Keytip - * @param describedByPrepend - ariaDescribedBy value to prepend - */ function getKeytipData(keytipManager, keytipProps, describedByPrepend) { - // Add the parent overflow sequence if necessary - var newKeytipProps = keytipManager.addParentOverflow(keytipProps); - // Construct aria-describedby and data-ktp-id attributes - var ariaDescribedBy = (0, _utilities.mergeAriaAttributeValues)(describedByPrepend, (0, _index.getAriaDescribedBy)(newKeytipProps.keySequences)); - var keySequences = (0, _tslib.__spreadArray)([], newKeytipProps.keySequences, true); - if (newKeytipProps.overflowSetSequence) keySequences = (0, _index.mergeOverflows)(keySequences, newKeytipProps.overflowSetSequence); - var keytipId = (0, _index.sequencesToID)(keySequences); + }; + function onRenderSubMenu(subMenuProps) { + return React__namespace.createElement(LocalContextualMenu, __assign$1({}, subMenuProps)); + } + var LocalContextualMenu = styled(ContextualMenuBase, getStyles$q, function(props) { return { - ariaDescribedBy: ariaDescribedBy, - keytipId: keytipId - }; -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","../../Utilities":"1NZCy","../../utilities/keytips/index":"8l91i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i5hAV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuButton", ()=>ContextualMenuButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -var _keytipData = require("../../../KeytipData"); -var _index = require("../../../utilities/contextualMenu/index"); -var _contextualMenuItem = require("../ContextualMenuItem"); -var ContextualMenuButton = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuButton, _super); - function ContextualMenuButton() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._btn = _react.createRef(); - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); + onRenderSubMenu: props.onRenderSubMenu ? composeRenderFunction(props.onRenderSubMenu, onRenderSubMenu) : onRenderSubMenu + }; + }, { scope: "ContextualMenu" }); + var ContextualMenu = LocalContextualMenu; + ContextualMenu.displayName = "ContextualMenu"; + var ButtonGlobalClassNames = { + msButton: "ms-Button", + msButtonHasMenu: "ms-Button--hasMenu", + msButtonIcon: "ms-Button-icon", + msButtonMenuIcon: "ms-Button-menuIcon", + msButtonLabel: "ms-Button-label", + msButtonDescription: "ms-Button-description", + msButtonScreenReaderText: "ms-Button-screenReaderText", + msButtonFlexContainer: "ms-Button-flexContainer", + msButtonTextContainer: "ms-Button-textContainer" + }; + var getBaseButtonClassNames = memoizeFunction(function(theme, styles, className2, variantClassName, iconClassName, menuIconClassName, disabled, hasMenu, checked, expanded, isSplit) { + var _a2, _b2; + var classNames2 = getGlobalClassNames(ButtonGlobalClassNames, theme || {}); + var isExpanded = expanded && !isSplit; + return mergeStyleSets(styles.__shadowConfig__, { + root: [ + classNames2.msButton, + styles.root, + variantClassName, + checked && ["is-checked", styles.rootChecked], + isExpanded && [ + "is-expanded", + styles.rootExpanded, + (_a2 = {}, _a2[":hover .".concat(classNames2.msButtonIcon)] = styles.iconExpandedHovered, // menuIcon falls back to rootExpandedHovered to support original behavior + _a2[":hover .".concat(classNames2.msButtonMenuIcon)] = styles.menuIconExpandedHovered || styles.rootExpandedHovered, _a2[":hover"] = styles.rootExpandedHovered, _a2) + ], + hasMenu && [ButtonGlobalClassNames.msButtonHasMenu, styles.rootHasMenu], + disabled && ["is-disabled", styles.rootDisabled], + !disabled && !isExpanded && !checked && (_b2 = { + ":hover": styles.rootHovered + }, _b2[":hover .".concat(classNames2.msButtonLabel)] = styles.labelHovered, _b2[":hover .".concat(classNames2.msButtonIcon)] = styles.iconHovered, _b2[":hover .".concat(classNames2.msButtonDescription)] = styles.descriptionHovered, _b2[":hover .".concat(classNames2.msButtonMenuIcon)] = styles.menuIconHovered, _b2[":focus"] = styles.rootFocused, _b2[":active"] = styles.rootPressed, _b2[":active .".concat(classNames2.msButtonIcon)] = styles.iconPressed, _b2[":active .".concat(classNames2.msButtonDescription)] = styles.descriptionPressed, _b2[":active .".concat(classNames2.msButtonMenuIcon)] = styles.menuIconPressed, _b2), + disabled && checked && [styles.rootCheckedDisabled], + !disabled && checked && { + ":hover": styles.rootCheckedHovered, + ":active": styles.rootCheckedPressed + }, + className2 + ], + flexContainer: [classNames2.msButtonFlexContainer, styles.flexContainer], + textContainer: [classNames2.msButtonTextContainer, styles.textContainer], + icon: [ + classNames2.msButtonIcon, + iconClassName, + styles.icon, + isExpanded && styles.iconExpanded, + checked && styles.iconChecked, + disabled && styles.iconDisabled + ], + label: [classNames2.msButtonLabel, styles.label, checked && styles.labelChecked, disabled && styles.labelDisabled], + menuIcon: [ + classNames2.msButtonMenuIcon, + menuIconClassName, + styles.menuIcon, + checked && styles.menuIconChecked, + disabled && !isSplit && styles.menuIconDisabled, + !disabled && !isExpanded && !checked && { + ":hover": styles.menuIconHovered, + ":active": styles.menuIconPressed + }, + isExpanded && ["is-expanded", styles.menuIconExpanded] + ], + description: [ + classNames2.msButtonDescription, + styles.description, + checked && styles.descriptionChecked, + disabled && styles.descriptionDisabled + ], + screenReaderText: [classNames2.msButtonScreenReaderText, styles.screenReaderText] + }); + }); + var SplitButtonGlobalClassNames = { + msSplitButtonDivider: "ms-SplitButton-divider" + }; + var getSplitButtonClassNames = memoizeFunction(function(styles, disabled, expanded, checked, primaryDisabled) { + return { + root: mergeStyles(styles.splitButtonMenuButton, expanded && [styles.splitButtonMenuButtonExpanded], disabled && [styles.splitButtonMenuButtonDisabled], checked && !disabled && [styles.splitButtonMenuButtonChecked], primaryDisabled && !disabled && [ + { + ":focus": styles.splitButtonMenuFocused + } + ]), + splitButtonContainer: mergeStyles(styles.splitButtonContainer, !disabled && checked && [ + styles.splitButtonContainerChecked, + { + ":hover": styles.splitButtonContainerCheckedHovered + } + ], !disabled && !checked && [ + { + ":hover": styles.splitButtonContainerHovered, + ":focus": styles.splitButtonContainerFocused + } + ], disabled && styles.splitButtonContainerDisabled), + icon: mergeStyles(styles.splitButtonMenuIcon, disabled && styles.splitButtonMenuIconDisabled, !disabled && primaryDisabled && styles.splitButtonMenuIcon), + flexContainer: mergeStyles(styles.splitButtonFlexContainer), + divider: mergeStyles(SplitButtonGlobalClassNames.msSplitButtonDivider, styles.splitButtonDivider, (primaryDisabled || disabled) && styles.splitButtonDividerDisabled) + }; + }); + var TouchIdleDelay$1 = 500; + var COMPONENT_NAME$6 = "BaseButton"; + var BaseButton = ( + /** @class */ + (function(_super) { + __extends(BaseButton2, _super); + function BaseButton2(props) { + var _this = _super.call(this, props) || this; + _this._buttonElement = React__namespace.createRef(); + _this._splitButtonContainer = React__namespace.createRef(); + _this._mergedRef = createMergedRef(); + _this._renderedVisibleMenu = false; + _this._getMemoizedMenuButtonKeytipProps = memoizeFunction(function(keytipProps) { + return __assign$1(__assign$1({}, keytipProps), { hasMenu: true }); }); - _this._renderAriaDescription = function(ariaDescription, className) { - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan - return ariaDescription ? _react.createElement("span", { - id: _this._ariaDescriptionId, - className: className - }, ariaDescription) : null; + _this._onRenderIcon = function(buttonProps, defaultRender) { + var iconProps = _this.props.iconProps; + if (iconProps && (iconProps.iconName !== void 0 || iconProps.imageProps)) { + var className2 = iconProps.className, imageProps = iconProps.imageProps, rest = __rest(iconProps, ["className", "imageProps"]); + if (iconProps.styles) { + return React__namespace.createElement(Icon, __assign$1({ className: css(_this._classNames.icon, className2), imageProps }, rest)); + } + if (iconProps.iconName) { + return React__namespace.createElement(FontIcon, __assign$1({ className: css(_this._classNames.icon, className2) }, rest)); + } + if (imageProps) { + return React__namespace.createElement(ImageIcon, __assign$1({ className: css(_this._classNames.icon, className2), imageProps }, rest)); + } + } + return null; + }; + _this._onRenderTextContents = function() { + var _a2 = _this.props, text2 = _a2.text, children2 = _a2.children, _b2 = _a2.secondaryText, secondaryText = _b2 === void 0 ? _this.props.description : _b2, _c2 = _a2.onRenderText, onRenderText = _c2 === void 0 ? _this._onRenderText : _c2, _d2 = _a2.onRenderDescription, onRenderDescription = _d2 === void 0 ? _this._onRenderDescription : _d2; + if (text2 || typeof children2 === "string" || secondaryText) { + return React__namespace.createElement( + "span", + { className: _this._classNames.textContainer }, + onRenderText(_this.props, _this._onRenderText), + onRenderDescription(_this.props, _this._onRenderDescription) + ); + } + return [onRenderText(_this.props, _this._onRenderText), onRenderDescription(_this.props, _this._onRenderDescription)]; + }; + _this._onRenderText = function() { + var text2 = _this.props.text; + var children2 = _this.props.children; + if (text2 === void 0 && typeof children2 === "string") { + text2 = children2; + } + if (_this._hasText()) { + return React__namespace.createElement("span", { key: _this._labelId, className: _this._classNames.label, id: _this._labelId }, text2); + } + return null; + }; + _this._onRenderChildren = function() { + var children2 = _this.props.children; + if (typeof children2 === "string") { + return null; + } + return children2; + }; + _this._onRenderDescription = function(props2) { + var _a2 = props2.secondaryText, secondaryText = _a2 === void 0 ? _this.props.description : _a2; + return secondaryText ? React__namespace.createElement("span", { key: _this._descriptionId, className: _this._classNames.description, id: _this._descriptionId }, secondaryText) : null; + }; + _this._onRenderAriaDescription = function() { + var ariaDescription = _this.props.ariaDescription; + return ariaDescription ? React__namespace.createElement("span", { className: _this._classNames.screenReaderText, id: _this._ariaDescriptionId }, ariaDescription) : null; + }; + _this._onRenderMenuIcon = function(props2) { + var menuIconProps = _this.props.menuIconProps; + return React__namespace.createElement(FontIcon, __assign$1({ iconName: "ChevronDown" }, menuIconProps, { className: _this._classNames.menuIcon })); + }; + _this._onRenderMenu = function(menuProps) { + var MenuType = _this.props.menuAs ? composeComponentAs(_this.props.menuAs, ContextualMenu) : ContextualMenu; + return React__namespace.createElement(MenuType, __assign$1({}, menuProps)); + }; + _this._onDismissMenu = function(ev) { + var menuProps = _this.props.menuProps; + if (menuProps && menuProps.onDismiss) { + menuProps.onDismiss(ev); + } + if (!ev || !ev.defaultPrevented) { + _this._dismissMenu(); + } }; - _this._getSubmenuTarget = function() { - return _this._btn.current ? _this._btn.current : undefined; + _this._dismissMenu = function() { + _this._menuShouldFocusOnMount = void 0; + _this._menuShouldFocusOnContainer = void 0; + _this.setState({ menuHidden: true }); }; - return _this; - } - ContextualMenuButton.prototype.render = function() { - var _this = this; - var _a = this.props, item = _a.item, classNames = _a.classNames, index = _a.index, focusableElementIndex = _a.focusableElementIndex, totalItemCount = _a.totalItemCount, hasCheckmarks = _a.hasCheckmarks, hasIcons = _a.hasIcons, contextualMenuItemAs = _a.contextualMenuItemAs, expandedMenuItemKey = _a.expandedMenuItemKey, onItemMouseDown = _a.onItemMouseDown, onItemClick = _a.onItemClick, openSubMenu = _a.openSubMenu, dismissSubMenu = _a.dismissSubMenu, dismissMenu = _a.dismissMenu; - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(item.contextualMenuItemAs, ChildrenRenderer); - if (contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(contextualMenuItemAs, ChildrenRenderer); - var isChecked = (0, _index.getIsChecked)(item); - var canCheck = isChecked !== null; - var defaultRole = (0, _index.getMenuItemAriaRole)(item); - var itemHasSubmenu = (0, _index.hasSubmenu)(item); - var itemProps = item.itemProps, ariaLabel = item.ariaLabel, ariaDescription = item.ariaDescription; - var buttonNativeProperties = (0, _utilities.getNativeProps)(item, (0, _utilities.buttonProperties)); - // Do not add the disabled attribute to the button so that it is focusable - delete buttonNativeProperties.disabled; - var itemRole = item.role || defaultRole; - // Check for ariaDescription to set the _ariaDescriptionId and render a hidden span with - // the description in it to be added to ariaDescribedBy - if (ariaDescription) this._ariaDescriptionId = (0, _utilities.getId)(); - var ariaDescribedByIds = (0, _utilities.mergeAriaAttributeValues)(item.ariaDescribedBy, ariaDescription ? this._ariaDescriptionId : undefined, buttonNativeProperties['aria-describedby']); - var itemButtonProperties = { - className: classNames.root, - onClick: this._onItemClick, - onKeyDown: itemHasSubmenu ? this._onItemKeyDown : undefined, - onMouseEnter: this._onItemMouseEnter, - onMouseLeave: this._onItemMouseLeave, - onMouseDown: function(ev) { - return onItemMouseDown ? onItemMouseDown(item, ev) : undefined; - }, - onMouseMove: this._onItemMouseMove, - href: item.href, - title: item.title, - 'aria-label': ariaLabel, - 'aria-describedby': ariaDescribedByIds, - 'aria-haspopup': itemHasSubmenu || undefined, - 'aria-expanded': itemHasSubmenu ? item.key === expandedMenuItemKey : undefined, - 'aria-posinset': focusableElementIndex + 1, - 'aria-setsize': totalItemCount, - 'aria-disabled': (0, _index.isItemDisabled)(item), - 'aria-checked': (itemRole === 'menuitemcheckbox' || itemRole === 'menuitemradio') && canCheck ? !!isChecked : undefined, - 'aria-selected': itemRole === 'menuitem' && canCheck ? !!isChecked : undefined, - role: itemRole, - // eslint-disable-next-line deprecation/deprecation - style: item.style + _this._openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { + if (shouldFocusOnMount === void 0) { + shouldFocusOnMount = true; + } + if (_this.props.menuProps) { + _this._menuShouldFocusOnContainer = shouldFocusOnContainer; + _this._menuShouldFocusOnMount = shouldFocusOnMount; + _this._renderedVisibleMenu = true; + _this.setState({ menuHidden: false }); + } }; - var keytipProps = item.keytipProps; - if (keytipProps && itemHasSubmenu) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - return _react.createElement((0, _keytipData.KeytipData), { - keytipProps: keytipProps, - ariaDescribedBy: ariaDescribedByIds, - disabled: (0, _index.isItemDisabled)(item) - }, function(keytipAttributes) { - return _react.createElement("button", (0, _tslib.__assign)({ - ref: _this._btn - }, buttonNativeProperties, itemButtonProperties, keytipAttributes), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - componentRef: item.componentRef, - item: item, - classNames: classNames, - index: index, - onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined, - hasIcons: hasIcons, - openSubMenu: openSubMenu, - dismissSubMenu: dismissSubMenu, - dismissMenu: dismissMenu, - getSubmenuTarget: _this._getSubmenuTarget - }, itemProps)), _this._renderAriaDescription(ariaDescription, classNames.screenReaderText)); - }); - }; - return ContextualMenuButton; -}((0, _contextualMenuItemWrapper.ContextualMenuItemWrapper)); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","./ContextualMenuItemWrapper":"1NVzL","../../../KeytipData":"9cfzj","../../../utilities/contextualMenu/index":"lGesq","../ContextualMenuItem":"cJR9f","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"151ms":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ContextualMenuSplitButton", ()=>ContextualMenuSplitButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _contextualMenuItem = require("../ContextualMenuItem"); -var _contextualMenuClassNames = require("../ContextualMenu.classNames"); -var _keytipData = require("../../../KeytipData"); -var _index = require("../../../utilities/contextualMenu/index"); -var _divider = require("../../../Divider"); -var _contextualMenuItemWrapper = require("./ContextualMenuItemWrapper"); -var TouchIdleDelay = 500; /* ms */ -var ContextualMenuSplitButton = /** @class */ function(_super) { - (0, _tslib.__extends)(ContextualMenuSplitButton, _super); - function ContextualMenuSplitButton(props) { - var _this = _super.call(this, props) || this; - _this._getMemoizedMenuButtonKeytipProps = (0, _utilities.memoizeFunction)(function(keytipProps) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, keytipProps), { - hasMenu: true - }); - }); - _this._onItemKeyDown = function(ev) { - var _a = _this.props, item = _a.item, onItemKeyDown = _a.onItemKeyDown; - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).enter) { - _this._executeItemClick(ev); - ev.preventDefault(); - ev.stopPropagation(); - } else if (onItemKeyDown) onItemKeyDown(item, ev); + _this._onToggleMenu = function(shouldFocusOnContainer) { + var shouldFocusOnMount = true; + if (_this.props.menuProps && _this.props.menuProps.shouldFocusOnMount === false) { + shouldFocusOnMount = false; + } + _this.state.menuHidden ? _this._openMenu(shouldFocusOnContainer, shouldFocusOnMount) : _this._dismissMenu(); }; - _this._getSubmenuTarget = function() { - return _this._splitButton; + _this._onSplitContainerFocusCapture = function(ev) { + var container = _this._splitButtonContainer.current; + if (!container || ev.target && portalContainsElement(ev.target, container)) { + return; + } + container.focus(); }; - _this._renderAriaDescription = function(ariaDescription, className) { - // If ariaDescription is given, descriptionId will be assigned to ariaDescriptionSpan - return ariaDescription ? _react.createElement("span", { - id: _this._ariaDescriptionId, - className: className - }, ariaDescription) : null; + _this._onSplitButtonPrimaryClick = function(ev) { + if (!_this.state.menuHidden) { + _this._dismissMenu(); + } + var singleTouchTarget = _this._processingTouch && !_this.props.toggle; + if (!singleTouchTarget && _this.props.onClick) { + _this.props.onClick(ev); + } else if (singleTouchTarget) { + _this._onMenuClick(ev); + } }; - _this._onItemMouseEnterPrimary = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseEnter = _a.onItemMouseEnter; - if (onItemMouseEnter) onItemMouseEnter((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - subMenuProps: undefined, - items: undefined - }), ev, _this._splitButton); + _this._onKeyDown = function(ev) { + if (_this.props.disabled && (ev.which === KeyCodes.enter || ev.which === KeyCodes.space)) { + ev.preventDefault(); + ev.stopPropagation(); + } else if (!_this.props.disabled) { + if (_this.props.menuProps) { + _this._onMenuKeyDown(ev); + } else if (_this.props.onKeyDown !== void 0) { + _this.props.onKeyDown(ev); + } + } }; - _this._onItemMouseEnterIcon = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseEnter = _a.onItemMouseEnter; - if (onItemMouseEnter) onItemMouseEnter(item, ev, _this._splitButton); + _this._onKeyUp = function(ev) { + if (!_this.props.disabled && _this.props.onKeyUp !== void 0) { + _this.props.onKeyUp(ev); + } }; - _this._onItemMouseMovePrimary = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseMove = _a.onItemMouseMove; - if (onItemMouseMove) onItemMouseMove((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - subMenuProps: undefined, - items: undefined - }), ev, _this._splitButton); + _this._onKeyPress = function(ev) { + if (!_this.props.disabled && _this.props.onKeyPress !== void 0) { + _this.props.onKeyPress(ev); + } }; - _this._onItemMouseMoveIcon = function(ev) { - var _a = _this.props, item = _a.item, onItemMouseMove = _a.onItemMouseMove; - if (onItemMouseMove) onItemMouseMove(item, ev, _this._splitButton); + _this._onMouseUp = function(ev) { + if (!_this.props.disabled && _this.props.onMouseUp !== void 0) { + _this.props.onMouseUp(ev); + } }; - _this._onIconItemClick = function(ev) { - var _a = _this.props, item = _a.item, onItemClickBase = _a.onItemClickBase; - if (onItemClickBase) onItemClickBase(item, ev, _this._splitButton ? _this._splitButton : ev.currentTarget); + _this._onMouseDown = function(ev) { + if (!_this.props.disabled && _this.props.onMouseDown !== void 0) { + _this.props.onMouseDown(ev); + } }; - _this._executeItemClick = function(ev) { - var _a = _this.props, item = _a.item, executeItemClick = _a.executeItemClick, onItemClick = _a.onItemClick; - if (item.disabled || item.isDisabled) return; - if (_this._processingTouch && !item.canCheck && onItemClick) return onItemClick(item, ev); - if (executeItemClick) executeItemClick(item, ev); + _this._onClick = function(ev) { + if (!_this.props.disabled) { + if (_this.props.menuProps) { + _this._onMenuClick(ev); + } else if (_this.props.onClick !== void 0) { + _this.props.onClick(ev); + } + } }; - _this._onTouchStart = function(ev) { - if (_this._splitButton && !('onpointerdown' in _this._splitButton)) _this._handleTouchAndPointerEvent(ev); + _this._onSplitButtonContainerKeyDown = function(ev) { + if (ev.which === KeyCodes.enter || ev.which === KeyCodes.space) { + if (_this._buttonElement.current) { + _this._buttonElement.current.click(); + ev.preventDefault(); + ev.stopPropagation(); + } + } else { + _this._onMenuKeyDown(ev); + } }; - _this._onPointerDown = function(ev) { - if (ev.pointerType === 'touch') { - _this._handleTouchAndPointerEvent(ev); + _this._onMenuKeyDown = function(ev) { + var _a2; + if (_this.props.disabled) { + return; + } + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + } + var isUp = ev.which === KeyCodes.up; + var isDown = ev.which === KeyCodes.down; + if (!ev.defaultPrevented && _this._isValidMenuOpenKey(ev)) { + var onMenuClick = _this.props.onMenuClick; + if (onMenuClick) { + onMenuClick(ev, _this.props); + } + _this._onToggleMenu(false); + ev.preventDefault(); + ev.stopPropagation(); + } + if (ev.which === KeyCodes.enter || ev.which === KeyCodes.space) { + setFocusVisibility(true, ev.target, (_a2 = _this.context) === null || _a2 === void 0 ? void 0 : _a2.registeredProviders); + } + if (!(ev.altKey || ev.metaKey) && (isUp || isDown)) { + if (!_this.state.menuHidden && _this.props.menuProps) { + var currentShouldFocusOnMount = _this._menuShouldFocusOnMount !== void 0 ? _this._menuShouldFocusOnMount : _this.props.menuProps.shouldFocusOnMount; + if (!currentShouldFocusOnMount) { ev.preventDefault(); - ev.stopImmediatePropagation(); + ev.stopPropagation(); + _this._menuShouldFocusOnMount = true; + _this.forceUpdate(); + } } + } + }; + _this._onTouchStart = function() { + if (_this._isSplitButton && _this._splitButtonContainer.current && !("onpointerdown" in _this._splitButtonContainer.current)) { + _this._handleTouchAndPointerEvent(); + } + }; + _this._onMenuClick = function(ev) { + var _a2 = _this.props, onMenuClick = _a2.onMenuClick, menuProps = _a2.menuProps; + if (onMenuClick) { + onMenuClick(ev, _this.props); + } + var shouldFocusOnContainer = typeof (menuProps === null || menuProps === void 0 ? void 0 : menuProps.shouldFocusOnContainer) === "boolean" ? menuProps.shouldFocusOnContainer : ev.nativeEvent.pointerType === "mouse"; + if (!ev.defaultPrevented) { + _this._onToggleMenu(shouldFocusOnContainer); + ev.preventDefault(); + ev.stopPropagation(); + } + }; + initializeComponentRef(_this); + _this._async = new Async(_this); + _this._events = new EventGroup(_this); + warnConditionallyRequiredProps(COMPONENT_NAME$6, props, ["menuProps", "onClick"], "split", _this.props.split); + _this._labelId = getId(); + _this._descriptionId = getId(); + _this._ariaDescriptionId = getId(); + _this.state = { + menuHidden: true }; - _this._async = new (0, _utilities.Async)(_this); - _this._events = new (0, _utilities.EventGroup)(_this); - _this._dismissLabelId = (0, _utilities.getId)(); return _this; - } - ContextualMenuSplitButton.prototype.componentDidMount = function() { - if (this._splitButton && 'onpointerdown' in this._splitButton) this._events.on(this._splitButton, 'pointerdown', this._onPointerDown, true); - }; - ContextualMenuSplitButton.prototype.componentWillUnmount = function() { + } + Object.defineProperty(BaseButton2.prototype, "_isSplitButton", { + get: function() { + return !!this.props.menuProps && !!this.props.onClick && this.props.split === true; + }, + enumerable: false, + configurable: true + }); + BaseButton2.prototype.render = function() { + var _a2; + var _b2 = this.props, ariaDescription = _b2.ariaDescription, ariaLabel2 = _b2.ariaLabel, ariaHidden = _b2.ariaHidden, className2 = _b2.className, disabled = _b2.disabled, allowDisabledFocus = _b2.allowDisabledFocus, primaryDisabled = _b2.primaryDisabled, _c2 = _b2.secondaryText, secondaryText = _c2 === void 0 ? this.props.description : _c2, href2 = _b2.href, iconProps = _b2.iconProps, menuIconProps = _b2.menuIconProps, styles = _b2.styles, checked = _b2.checked, variantClassName = _b2.variantClassName, theme = _b2.theme, toggle = _b2.toggle, getClassNames2 = _b2.getClassNames, role = _b2.role; + var menuHidden = this.state.menuHidden; + var isPrimaryButtonDisabled = disabled || primaryDisabled; + this._classNames = getClassNames2 ? getClassNames2(theme, className2, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, checked, !menuHidden, !!this.props.menuProps, this.props.split, !!allowDisabledFocus) : getBaseButtonClassNames(theme, styles, className2, variantClassName, iconProps && iconProps.className, menuIconProps && menuIconProps.className, isPrimaryButtonDisabled, !!this.props.menuProps, checked, !menuHidden, this.props.split); + var _d2 = this, _ariaDescriptionId = _d2._ariaDescriptionId, _labelId = _d2._labelId, _descriptionId = _d2._descriptionId; + var renderAsAnchor = !isPrimaryButtonDisabled && !!href2; + var tag = renderAsAnchor ? "a" : "button"; + var nativeProps = getNativeProps( + // eslint-disable-next-line @typescript-eslint/no-deprecated + assign(renderAsAnchor ? {} : { type: "button" }, this.props.rootProps, this.props), + renderAsAnchor ? anchorProperties : buttonProperties, + [ + "disabled" + // let disabled buttons be focused and styled as disabled. + ] + ); + var resolvedAriaLabel = ariaLabel2 || nativeProps["aria-label"]; + var ariaDescribedBy = void 0; + if (ariaDescription) { + ariaDescribedBy = _ariaDescriptionId; + } else if (secondaryText && this.props.onRenderDescription !== nullRender) { + ariaDescribedBy = _descriptionId; + } else if (nativeProps["aria-describedby"]) { + ariaDescribedBy = nativeProps["aria-describedby"]; + } + var ariaLabelledBy = void 0; + if (nativeProps["aria-labelledby"]) { + ariaLabelledBy = nativeProps["aria-labelledby"]; + } else if (ariaDescribedBy && !resolvedAriaLabel) { + ariaLabelledBy = this._hasText() ? _labelId : void 0; + } + var dataIsFocusable = this.props["data-is-focusable"] === false || disabled && !allowDisabledFocus || this._isSplitButton ? false : true; + var isCheckboxTypeRole = role === "menuitemcheckbox" || role === "checkbox"; + var checkedOrPressedValue = isCheckboxTypeRole ? !!checked : toggle === true ? !!checked : void 0; + var buttonProps = assign(nativeProps, (_a2 = { + className: this._classNames.root, + // eslint-disable-next-line @typescript-eslint/no-deprecated + ref: this._mergedRef(this.props.elementRef, this._buttonElement), + disabled: isPrimaryButtonDisabled && !allowDisabledFocus, + onKeyDown: this._onKeyDown, + onKeyPress: this._onKeyPress, + onKeyUp: this._onKeyUp, + onMouseDown: this._onMouseDown, + onMouseUp: this._onMouseUp, + onClick: this._onClick, + "aria-label": resolvedAriaLabel, + "aria-labelledby": ariaLabelledBy, + "aria-describedby": ariaDescribedBy, + "aria-disabled": isPrimaryButtonDisabled, + "data-is-focusable": dataIsFocusable + }, // aria-pressed attribute should only be present for toggle buttons + // aria-checked attribute should only be present for toggle buttons with checkbox type role + _a2[isCheckboxTypeRole ? "aria-checked" : "aria-pressed"] = checkedOrPressedValue, _a2)); + if (ariaHidden) { + buttonProps["aria-hidden"] = true; + } + if (this._isSplitButton) { + return this._onRenderSplitButtonContent(tag, buttonProps); + } else if (this.props.menuProps) { + var _e2 = this.props.menuProps.id, id2 = _e2 === void 0 ? "".concat(this._labelId, "-menu") : _e2; + assign(buttonProps, { + "aria-expanded": !menuHidden, + "aria-controls": !menuHidden ? id2 : null, + "aria-haspopup": true + }); + } + return this._onRenderContent(tag, buttonProps); + }; + BaseButton2.prototype.componentDidMount = function() { + if (this._isSplitButton && this._splitButtonContainer.current) { + if ("onpointerdown" in this._splitButtonContainer.current) { + this._events.on(this._splitButtonContainer.current, "pointerdown", this._onPointerDown, true); + } + if ("onpointerup" in this._splitButtonContainer.current && this.props.onPointerUp) { + this._events.on(this._splitButtonContainer.current, "pointerup", this.props.onPointerUp, true); + } + } + }; + BaseButton2.prototype.componentDidUpdate = function(prevProps, prevState) { + if (this.props.onAfterMenuDismiss && !prevState.menuHidden && this.state.menuHidden) { + this.props.onAfterMenuDismiss(); + } + }; + BaseButton2.prototype.componentWillUnmount = function() { this._async.dispose(); this._events.dispose(); - }; - ContextualMenuSplitButton.prototype.render = function() { + }; + BaseButton2.prototype.focus = function() { + var _a2, _b2; + if (this._isSplitButton && this._splitButtonContainer.current) { + setFocusVisibility(true, void 0, (_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.registeredProviders); + this._splitButtonContainer.current.focus(); + } else if (this._buttonElement.current) { + setFocusVisibility(true, void 0, (_b2 = this.context) === null || _b2 === void 0 ? void 0 : _b2.registeredProviders); + this._buttonElement.current.focus(); + } + }; + BaseButton2.prototype.dismissMenu = function() { + this._dismissMenu(); + }; + BaseButton2.prototype.openMenu = function(shouldFocusOnContainer, shouldFocusOnMount) { + this._openMenu(shouldFocusOnContainer, shouldFocusOnMount); + }; + BaseButton2.prototype._onRenderContent = function(tag, buttonProps) { var _this = this; - var _a; - var _b = this.props, item = _b.item, classNames = _b.classNames, index = _b.index, focusableElementIndex = _b.focusableElementIndex, totalItemCount = _b.totalItemCount, hasCheckmarks = _b.hasCheckmarks, hasIcons = _b.hasIcons, onItemMouseLeave = _b.onItemMouseLeave, expandedMenuItemKey = _b.expandedMenuItemKey; - var itemHasSubmenu = (0, _index.hasSubmenu)(item); - var keytipProps = item.keytipProps; - if (keytipProps) keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); - // Check for ariaDescription to set the _ariaDescriptionId and render a hidden span with - // the description in it to be added to ariaDescribedBy - var ariaDescription = item.ariaDescription; - if (ariaDescription) this._ariaDescriptionId = (0, _utilities.getId)(); - var ariaChecked = (_a = (0, _index.getIsChecked)(item)) !== null && _a !== void 0 ? _a : undefined; - return _react.createElement((0, _keytipData.KeytipData), { - keytipProps: keytipProps, - disabled: (0, _index.isItemDisabled)(item) - }, function(keytipAttributes) { - return _react.createElement("div", { - "data-ktp-target": keytipAttributes['data-ktp-target'], - ref: function(splitButton) { - return _this._splitButton = splitButton; - }, - role: (0, _index.getMenuItemAriaRole)(item), - "aria-label": item.ariaLabel, - className: classNames.splitContainer, - "aria-disabled": (0, _index.isItemDisabled)(item), - "aria-expanded": itemHasSubmenu ? item.key === expandedMenuItemKey : undefined, - "aria-haspopup": true, - "aria-describedby": (0, _utilities.mergeAriaAttributeValues)(item.ariaDescribedBy, ariaDescription ? _this._ariaDescriptionId : undefined, keytipAttributes['aria-describedby']), - "aria-checked": ariaChecked, - "aria-posinset": focusableElementIndex + 1, - "aria-setsize": totalItemCount, - onMouseEnter: _this._onItemMouseEnterPrimary, - onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(_this, (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - subMenuProps: null, - items: null - })) : undefined, - onMouseMove: _this._onItemMouseMovePrimary, - onKeyDown: _this._onItemKeyDown, - onClick: _this._executeItemClick, - onTouchStart: _this._onTouchStart, - tabIndex: 0, - "data-is-focusable": true, - "aria-roledescription": item['aria-roledescription'] - }, _this._renderSplitPrimaryButton(item, classNames, index, hasCheckmarks, hasIcons), _this._renderSplitDivider(item), _this._renderSplitIconButton(item, classNames, index, keytipAttributes), _this._renderAriaDescription(ariaDescription, classNames.screenReaderText)); - }); - }; - ContextualMenuSplitButton.prototype._renderSplitPrimaryButton = function(item, // eslint-disable-next-line deprecation/deprecation - classNames, index, hasCheckmarks, hasIcons) { - var _a = this.props, _b = _a.contextualMenuItemAs, ChildrenRenderer = _b === void 0 ? (0, _contextualMenuItem.ContextualMenuItem) : _b, onItemClick = _a.onItemClick; - var itemProps = { - key: item.key, - disabled: (0, _index.isItemDisabled)(item) || item.primaryDisabled, - /* eslint-disable deprecation/deprecation */ name: item.name, - text: item.text || item.name, - secondaryText: item.secondaryText, - /* eslint-enable deprecation/deprecation */ className: classNames.splitPrimary, - canCheck: item.canCheck, - isChecked: item.isChecked, - checked: item.checked, - iconProps: item.iconProps, - id: this._dismissLabelId, - onClick: item.onClick, - onRenderIcon: item.onRenderIcon, - data: item.data, - 'data-is-focusable': false - }; - var itemComponentProps = item.itemProps; - return _react.createElement("button", (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(itemProps, (0, _utilities.buttonProperties))), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - "data-is-focusable": false, - item: itemProps, - classNames: classNames, - index: index, - onCheckmarkClick: hasCheckmarks && onItemClick ? onItemClick : undefined, - hasIcons: hasIcons - }, itemComponentProps))); - }; - ContextualMenuSplitButton.prototype._renderSplitDivider = function(item) { - var getDividerClassNames = item.getSplitButtonVerticalDividerClassNames || (0, _contextualMenuClassNames.getSplitButtonVerticalDividerClassNames); - return _react.createElement((0, _divider.VerticalDivider), { - getClassNames: getDividerClassNames - }); - }; - ContextualMenuSplitButton.prototype._renderSplitIconButton = function(item, classNames, index, keytipAttributes) { - var _a = this.props, onItemMouseLeave = _a.onItemMouseLeave, onItemMouseDown = _a.onItemMouseDown, openSubMenu = _a.openSubMenu, dismissSubMenu = _a.dismissSubMenu, dismissMenu = _a.dismissMenu; - var ChildrenRenderer = (0, _contextualMenuItem.ContextualMenuItem); - if (this.props.item.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.item.contextualMenuItemAs, ChildrenRenderer); - if (this.props.contextualMenuItemAs) ChildrenRenderer = (0, _utilities.composeComponentAs)(this.props.contextualMenuItemAs, ChildrenRenderer); - var itemProps = { - onClick: this._onIconItemClick, - disabled: (0, _index.isItemDisabled)(item), - className: classNames.splitMenu, - subMenuProps: item.subMenuProps, - submenuIconProps: item.submenuIconProps, - split: true, - key: item.key, - 'aria-labelledby': this._dismissLabelId - }; - var buttonProps = (0, _tslib.__assign)((0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(itemProps, (0, _utilities.buttonProperties))), { - onMouseEnter: this._onItemMouseEnterIcon, - onMouseLeave: onItemMouseLeave ? onItemMouseLeave.bind(this, item) : undefined, - onMouseDown: function(ev) { - return onItemMouseDown ? onItemMouseDown(item, ev) : undefined; - }, - onMouseMove: this._onItemMouseMoveIcon, - 'data-is-focusable': false, - 'data-ktp-execute-target': keytipAttributes['data-ktp-execute-target'], - 'aria-haspopup': true + var props = this.props; + var Tag = tag; + var menuIconProps = props.menuIconProps, menuProps = props.menuProps, _a2 = props.onRenderIcon, onRenderIcon = _a2 === void 0 ? this._onRenderIcon : _a2, _b2 = props.onRenderAriaDescription, onRenderAriaDescription = _b2 === void 0 ? this._onRenderAriaDescription : _b2, _c2 = props.onRenderChildren, onRenderChildren = _c2 === void 0 ? this._onRenderChildren : _c2, _d2 = props.onRenderMenu, onRenderMenu = _d2 === void 0 ? this._onRenderMenu : _d2, _e2 = props.onRenderMenuIcon, onRenderMenuIcon = _e2 === void 0 ? this._onRenderMenuIcon : _e2, disabled = props.disabled; + var keytipProps = props.keytipProps; + if (keytipProps && menuProps) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + var Button2 = function(keytipAttributes) { + return React__namespace.createElement( + Tag, + __assign$1({}, buttonProps, keytipAttributes), + React__namespace.createElement( + "span", + { className: _this._classNames.flexContainer, "data-automationid": "splitbuttonprimary" }, + onRenderIcon(props, _this._onRenderIcon), + _this._onRenderTextContents(), + onRenderAriaDescription(props, _this._onRenderAriaDescription), + onRenderChildren(props, _this._onRenderChildren), + !_this._isSplitButton && (menuProps || menuIconProps || _this.props.onRenderMenuIcon) && onRenderMenuIcon(_this.props, _this._onRenderMenuIcon), + menuProps && !menuProps.doNotLayer && _this._shouldRenderMenu() && onRenderMenu(_this._getMenuProps(menuProps), _this._onRenderMenu) + ) + ); + }; + var Content = keytipProps ? ( + // If we're making a split button, we won't put the keytip here + React__namespace.createElement(KeytipData, { keytipProps: !this._isSplitButton ? keytipProps : void 0, ariaDescribedBy: buttonProps["aria-describedby"], disabled }, function(keytipAttributes) { + return Button2(keytipAttributes); + }) + ) : Button2(); + if (menuProps && menuProps.doNotLayer) { + return React__namespace.createElement( + React__namespace.Fragment, + null, + Content, + this._shouldRenderMenu() && onRenderMenu(this._getMenuProps(menuProps), this._onRenderMenu) + ); + } + return React__namespace.createElement( + React__namespace.Fragment, + null, + Content, + React__namespace.createElement(FocusRects, null) + ); + }; + BaseButton2.prototype._shouldRenderMenu = function() { + var menuHidden = this.state.menuHidden; + var _a2 = this.props, persistMenu = _a2.persistMenu, renderPersistedMenuHiddenOnMount = _a2.renderPersistedMenuHiddenOnMount; + if (!menuHidden) { + return true; + } else if (persistMenu && (this._renderedVisibleMenu || renderPersistedMenuHiddenOnMount)) { + return true; + } + return false; + }; + BaseButton2.prototype._hasText = function() { + return this.props.text !== null && (this.props.text !== void 0 || typeof this.props.children === "string"); + }; + BaseButton2.prototype._getMenuProps = function(menuProps) { + var persistMenu = this.props.persistMenu; + var menuHidden = this.state.menuHidden; + if (!menuProps.ariaLabel && !menuProps.labelElementId && this._hasText()) { + menuProps = __assign$1(__assign$1({}, menuProps), { labelElementId: this._labelId }); + } + return __assign$1(__assign$1({ id: this._labelId + "-menu", directionalHint: DirectionalHint.bottomLeftEdge }, menuProps), { shouldFocusOnContainer: this._menuShouldFocusOnContainer, shouldFocusOnMount: this._menuShouldFocusOnMount, hidden: persistMenu ? menuHidden : void 0, className: css("ms-BaseButton-menuhost", menuProps.className), target: this._isSplitButton ? this._splitButtonContainer.current : this._buttonElement.current, onDismiss: this._onDismissMenu }); + }; + BaseButton2.prototype._onRenderSplitButtonContent = function(tag, buttonProps) { + var _this = this; + var _a2 = this.props, _b2 = _a2.styles, styles = _b2 === void 0 ? {} : _b2, disabled = _a2.disabled, allowDisabledFocus = _a2.allowDisabledFocus, checked = _a2.checked, getSplitButtonClassNames$1 = _a2.getSplitButtonClassNames, primaryDisabled = _a2.primaryDisabled, menuProps = _a2.menuProps, toggle = _a2.toggle, role = _a2.role, primaryActionButtonProps = _a2.primaryActionButtonProps; + var keytipProps = this.props.keytipProps; + var menuHidden = this.state.menuHidden; + var classNames2 = getSplitButtonClassNames$1 ? getSplitButtonClassNames$1(!!disabled, !menuHidden, !!checked, !!allowDisabledFocus) : styles && getSplitButtonClassNames(styles, !!disabled, !menuHidden, !!checked, !!primaryDisabled); + assign(buttonProps, { + onClick: void 0, + onPointerDown: void 0, + onPointerUp: void 0, + tabIndex: -1, + "data-is-focusable": false }); - var itemComponentProps = item.itemProps; - return _react.createElement("button", (0, _tslib.__assign)({}, buttonProps), _react.createElement(ChildrenRenderer, (0, _tslib.__assign)({ - componentRef: item.componentRef, - item: itemProps, - classNames: classNames, - index: index, - hasIcons: false, - openSubMenu: openSubMenu, - dismissSubMenu: dismissSubMenu, - dismissMenu: dismissMenu, - getSubmenuTarget: this._getSubmenuTarget - }, itemComponentProps))); - }; - ContextualMenuSplitButton.prototype._handleTouchAndPointerEvent = function(ev) { + if (keytipProps && menuProps) { + keytipProps = this._getMemoizedMenuButtonKeytipProps(keytipProps); + } + var containerProps = getNativeProps(buttonProps, [], ["disabled"]); + if (primaryActionButtonProps) { + assign(buttonProps, primaryActionButtonProps); + } + var SplitButton = function(keytipAttributes) { + return React__namespace.createElement( + "div", + __assign$1({}, containerProps, { "data-ktp-target": keytipAttributes ? keytipAttributes["data-ktp-target"] : void 0, role: role ? role : "button", "aria-disabled": disabled, "aria-haspopup": true, "aria-expanded": !menuHidden, "aria-pressed": toggle ? !!checked : void 0, "aria-describedby": mergeAriaAttributeValues(buttonProps["aria-describedby"], keytipAttributes ? keytipAttributes["aria-describedby"] : void 0), className: classNames2 && classNames2.splitButtonContainer, onKeyDown: _this._onSplitButtonContainerKeyDown, onTouchStart: _this._onTouchStart, ref: _this._splitButtonContainer, "data-is-focusable": true, onClick: !disabled && !primaryDisabled ? _this._onSplitButtonPrimaryClick : void 0, tabIndex: !disabled && !primaryDisabled || allowDisabledFocus ? 0 : void 0, "aria-roledescription": buttonProps["aria-roledescription"], onFocusCapture: _this._onSplitContainerFocusCapture }), + React__namespace.createElement( + "span", + { style: { display: "flex", width: "100%" } }, + _this._onRenderContent(tag, buttonProps), + _this._onRenderSplitButtonMenuButton(classNames2, keytipAttributes), + _this._onRenderSplitButtonDivider(classNames2) + ) + ); + }; + return keytipProps ? React__namespace.createElement(KeytipData, { keytipProps, disabled }, function(keytipAttributes) { + return SplitButton(keytipAttributes); + }) : SplitButton(); + }; + BaseButton2.prototype._onRenderSplitButtonDivider = function(classNames2) { + if (classNames2 && classNames2.divider) { + var onClick = function(ev) { + ev.stopPropagation(); + }; + return React__namespace.createElement("span", { className: classNames2.divider, "aria-hidden": true, onClick }); + } + return null; + }; + BaseButton2.prototype._onRenderSplitButtonMenuButton = function(classNames2, keytipAttributes) { + var _a2 = this.props, allowDisabledFocus = _a2.allowDisabledFocus, checked = _a2.checked, disabled = _a2.disabled, splitButtonMenuProps = _a2.splitButtonMenuProps, splitButtonAriaLabel = _a2.splitButtonAriaLabel, primaryDisabled = _a2.primaryDisabled; + var menuHidden = this.state.menuHidden; + var menuIconProps = this.props.menuIconProps; + if (menuIconProps === void 0) { + menuIconProps = { + iconName: "ChevronDown" + }; + } + var splitButtonProps = __assign$1(__assign$1({}, splitButtonMenuProps), { styles: classNames2, checked, disabled, allowDisabledFocus, onClick: this._onMenuClick, menuProps: void 0, iconProps: __assign$1(__assign$1({}, menuIconProps), { className: this._classNames.menuIcon }), ariaLabel: splitButtonAriaLabel, "aria-haspopup": true, "aria-expanded": !menuHidden, "data-is-focusable": false }); + return React__namespace.createElement(BaseButton2, __assign$1({}, splitButtonProps, { "data-ktp-execute-target": keytipAttributes ? keytipAttributes["data-ktp-execute-target"] : keytipAttributes, onMouseDown: this._onMouseDown, tabIndex: primaryDisabled && !allowDisabledFocus ? 0 : -1 })); + }; + BaseButton2.prototype._onPointerDown = function(ev) { + var onPointerDown = this.props.onPointerDown; + if (onPointerDown) { + onPointerDown(ev); + } + if (ev.pointerType === "touch") { + this._handleTouchAndPointerEvent(); + ev.preventDefault(); + ev.stopImmediatePropagation(); + } + }; + BaseButton2.prototype._handleTouchAndPointerEvent = function() { var _this = this; - var onTap = this.props.onTap; - if (onTap) onTap(ev); - // If we already have an existing timeout from a previous touch/pointer event - // cancel that timeout so we can set a new one. - if (this._lastTouchTimeoutId) { - this._async.clearTimeout(this._lastTouchTimeoutId); - this._lastTouchTimeoutId = undefined; + if (this._lastTouchTimeoutId !== void 0) { + this._async.clearTimeout(this._lastTouchTimeoutId); + this._lastTouchTimeoutId = void 0; } this._processingTouch = true; this._lastTouchTimeoutId = this._async.setTimeout(function() { - _this._processingTouch = false; - _this._lastTouchTimeoutId = undefined; - }, TouchIdleDelay); - }; - return ContextualMenuSplitButton; -}((0, _contextualMenuItemWrapper.ContextualMenuItemWrapper)); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","../ContextualMenuItem":"cJR9f","../ContextualMenu.classNames":"bg3cO","../../../KeytipData":"9cfzj","../../../utilities/contextualMenu/index":"lGesq","../../../Divider":"dWBx3","./ContextualMenuItemWrapper":"1NVzL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dWBx3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Divider/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Divider/index":"8vweJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8vweJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _verticalDivider = require("./VerticalDivider"); -parcelHelpers.exportAll(_verticalDivider, exports); -var _verticalDividerTypes = require("./VerticalDivider.types"); -parcelHelpers.exportAll(_verticalDividerTypes, exports); - -},{"./VerticalDivider":"aZ5tF","./VerticalDivider.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aZ5tF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VerticalDivider", ()=>VerticalDivider); -var _verticalDividerStyles = require("./VerticalDivider.styles"); -var _verticalDividerBase = require("./VerticalDivider.base"); -var _utilities = require("../../Utilities"); -var VerticalDivider = (0, _utilities.styled)((0, _verticalDividerBase.VerticalDividerBase), (0, _verticalDividerStyles.getStyles), undefined, { - scope: 'VerticalDivider' -}); - -},{"./VerticalDivider.styles":"fK5e0","./VerticalDivider.base":"dEzWL","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fK5e0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var getStyles = function(props) { - // eslint-disable-next-line deprecation/deprecation - var theme = props.theme, getClassNames = props.getClassNames, className = props.className; - if (!theme) throw new Error('Theme is undefined or null.'); - if (getClassNames) { - var names = getClassNames(theme); - return { - wrapper: [ - names.wrapper - ], - divider: [ - names.divider - ] - }; - } - return { - wrapper: [ - { - display: 'inline-flex', - height: '100%', - alignItems: 'center' - }, - className - ], - divider: [ - { - width: 1, - height: '100%', - backgroundColor: theme.palette.neutralTertiaryAlt - } - ] - }; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dEzWL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VerticalDividerBase", ()=>VerticalDividerBase); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var VerticalDividerBase = _react.forwardRef(function(props, ref) { - // eslint-disable-next-line deprecation/deprecation - var styles = props.styles, theme = props.theme, deprecatedGetClassNames = props.getClassNames, className = props.className; - var classNames = getClassNames(styles, { - theme: theme, - getClassNames: deprecatedGetClassNames, - className: className - }); - return _react.createElement("span", { - className: classNames.wrapper, - ref: ref - }, _react.createElement("span", { - className: classNames.divider - })); -}); -VerticalDividerBase.displayName = 'VerticalDividerBase'; - -},{"react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cFpqz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _useResponsiveMode = require("./utilities/hooks/useResponsiveMode"); -parcelHelpers.exportAll(_useResponsiveMode, exports); -var _withResponsiveMode = require("./utilities/decorators/withResponsiveMode"); -parcelHelpers.exportAll(_withResponsiveMode, exports); - -},{"./utilities/hooks/useResponsiveMode":"3CcPR","./utilities/decorators/withResponsiveMode":"3hIIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3CcPR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "useResponsiveMode", ()=>useResponsiveMode); -var _react = require("react"); -var _utilities = require("@fluentui/utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _withResponsiveMode = require("../decorators/withResponsiveMode"); -var _windowProvider = require("../../WindowProvider"); -var useResponsiveMode = function(elementRef, overrideResponsiveMode) { - var _a = _react.useState((0, _withResponsiveMode.getInitialResponsiveMode)()), lastResponsiveMode = _a[0], setLastResponsiveMode = _a[1]; - var onResize = _react.useCallback(function() { - var newResponsiveMode = (0, _withResponsiveMode.getResponsiveMode)((0, _utilities.getWindow)(elementRef.current)); - // Setting the same value should not cause a re-render. - if (lastResponsiveMode !== newResponsiveMode) setLastResponsiveMode(newResponsiveMode); - }, [ - elementRef, - lastResponsiveMode - ]); - var win = (0, _windowProvider.useWindow)(); - (0, _reactHooks.useOnEvent)(win, 'resize', onResize); - // Call resize function initially on mount, or if the override changes from defined to undefined - // (the effect will run on all override changes, but onResize will only be called if it changed to undefined) - _react.useEffect(function() { - if (overrideResponsiveMode === undefined) onResize(); - // eslint-disable-next-line react-hooks/exhaustive-deps -- only meant to run on mount or when override changes - }, [ - overrideResponsiveMode - ]); - return overrideResponsiveMode !== null && overrideResponsiveMode !== void 0 ? overrideResponsiveMode : lastResponsiveMode; -}; - -},{"react":"jGrId","@fluentui/utilities":"55bj3","@fluentui/react-hooks":"2LHjM","../decorators/withResponsiveMode":"3hIIg","../../WindowProvider":"diLL7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3hIIg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ResponsiveMode", ()=>ResponsiveMode); -/** - * Allows a server rendered scenario to provide a **default** responsive mode. - * This WILL NOT trigger any updates to components that have already consumed the responsive mode! - */ parcelHelpers.export(exports, "setResponsiveMode", ()=>setResponsiveMode); -/** - * Initializes the responsive mode to the current window size. This can be used to avoid - * a re-render during first component mount since the window would otherwise not be measured - * until after mounting. - * - * This WILL NOT trigger any updates to components that have already consumed the responsive mode! - */ parcelHelpers.export(exports, "initializeResponsiveMode", ()=>initializeResponsiveMode); -parcelHelpers.export(exports, "getInitialResponsiveMode", ()=>getInitialResponsiveMode); -/** - * @deprecated Decorator usage is deprecated. Either call `getResponsiveMode` manually, or - * use the `useResponsiveMode` hook within a function component. - */ parcelHelpers.export(exports, "withResponsiveMode", ()=>withResponsiveMode); -/** - * Hook to get the current responsive mode (window size category). - * @param currentWindow - Use this window when determining the responsive mode. - */ parcelHelpers.export(exports, "getResponsiveMode", ()=>getResponsiveMode); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseDecorator = require("./BaseDecorator"); -var _utilities = require("../../Utilities"); -var _windowProvider = require("../../WindowProvider"); -var ResponsiveMode; -(function(ResponsiveMode) { - /** Width \<= 479px */ ResponsiveMode[ResponsiveMode["small"] = 0] = "small"; - /** Width \> 479px and \<= 639px */ ResponsiveMode[ResponsiveMode["medium"] = 1] = "medium"; - /** Width \> 639px and \<= 1023px */ ResponsiveMode[ResponsiveMode["large"] = 2] = "large"; - /** Width \> 1023px and \<= 1365px */ ResponsiveMode[ResponsiveMode["xLarge"] = 3] = "xLarge"; - /** Width \> 1365px and \<= 1919px */ ResponsiveMode[ResponsiveMode["xxLarge"] = 4] = "xxLarge"; - /** Width \> 1919px */ ResponsiveMode[ResponsiveMode["xxxLarge"] = 5] = "xxxLarge"; - ResponsiveMode[ResponsiveMode["unknown"] = 999] = "unknown"; -})(ResponsiveMode || (ResponsiveMode = {})); -var RESPONSIVE_MAX_CONSTRAINT = [ - 479, - 639, - 1023, - 1365, - 1919, - 99999999 -]; -/** - * User specified mode to default to, useful for server side rendering scenarios. - */ var _defaultMode; -/** - * Tracking the last mode we successfully rendered, which allows us to - * paint initial renders with the correct size. - */ var _lastMode; -function setResponsiveMode(responsiveMode) { - _defaultMode = responsiveMode; -} -function initializeResponsiveMode(element) { - var currentWindow = (0, _utilities.getWindow)(element); - if (currentWindow) getResponsiveMode(currentWindow); -} -function getInitialResponsiveMode() { - var _a; - return (_a = _defaultMode !== null && _defaultMode !== void 0 ? _defaultMode : _lastMode) !== null && _a !== void 0 ? _a : ResponsiveMode.large; -} -function withResponsiveMode(ComposedComponent) { - var _a; - // eslint-disable-next-line deprecation/deprecation - var resultClass = (_a = /** @class */ function(_super) { - (0, _tslib.__extends)(WithResponsiveMode, _super); - function WithResponsiveMode(props) { - var _this = _super.call(this, props) || this; - _this._onResize = function() { - var responsiveMode = getResponsiveMode(_this.context.window); - if (responsiveMode !== _this.state.responsiveMode) _this.setState({ - responsiveMode: responsiveMode - }); - }; - _this._events = new (0, _utilities.EventGroup)(_this); - _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); - _this.state = { - responsiveMode: getInitialResponsiveMode() - }; - return _this; - } - WithResponsiveMode.prototype.componentDidMount = function() { - this._events.on(this.context.window, 'resize', this._onResize); - this._onResize(); - }; - WithResponsiveMode.prototype.componentWillUnmount = function() { - this._events.dispose(); - }; - WithResponsiveMode.prototype.render = function() { - var responsiveMode = this.state.responsiveMode; - return responsiveMode === ResponsiveMode.unknown ? null : _react.createElement(ComposedComponent, (0, _tslib.__assign)({ - ref: this._updateComposedComponentRef, - responsiveMode: responsiveMode - }, this.props)); - }; - return WithResponsiveMode; - }((0, _baseDecorator.BaseDecorator)), _a.contextType = (0, _windowProvider.WindowContext), _a); - return (0, _utilities.hoistStatics)(ComposedComponent, resultClass); -} -function getWidthOfCurrentWindow(currentWindow) { - try { - return currentWindow.document.documentElement.clientWidth; - } catch (e) { - return currentWindow.innerWidth; - } -} -function getResponsiveMode(currentWindow) { - var responsiveMode = ResponsiveMode.small; - if (currentWindow) { - try { - while(getWidthOfCurrentWindow(currentWindow) > RESPONSIVE_MAX_CONSTRAINT[responsiveMode])responsiveMode++; - } catch (e) { - // Return a best effort result in cases where we're in the browser but it throws on getting innerWidth. - responsiveMode = getInitialResponsiveMode(); + _this._processingTouch = false; + _this._lastTouchTimeoutId = void 0; + if (_this.state.menuHidden) { + _this.focus(); + } + }, TouchIdleDelay$1); + }; + BaseButton2.prototype._isValidMenuOpenKey = function(ev) { + if (this.props.menuTriggerKeyCode) { + return ev.which === this.props.menuTriggerKeyCode; + } else if (this.props.menuProps) { + return ev.which === KeyCodes.down && (ev.altKey || ev.metaKey); } - // Tracking last mode just gives us a better default in future renders, - // which avoids starting with the wrong value if we've measured once. - _lastMode = responsiveMode; - } else { - if (_defaultMode !== undefined) responsiveMode = _defaultMode; - else throw new Error("Content was rendered in a server environment without providing a default responsive mode. Call setResponsiveMode to define what the responsive mode is."); - } - return responsiveMode; -} - -},{"tslib":"9gizs","react":"jGrId","./BaseDecorator":"eoH6o","../../Utilities":"1NZCy","../../WindowProvider":"diLL7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eoH6o":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BaseDecorator", ()=>BaseDecorator); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var BaseDecorator = /** @class */ function(_super) { - (0, _tslib.__extends)(BaseDecorator, _super); - function BaseDecorator(props) { - var _this = _super.call(this, props) || this; - _this._updateComposedComponentRef = _this._updateComposedComponentRef.bind(_this); - return _this; - } - /** - * Updates the ref to the component composed by the decorator, which will also take care of hoisting - * (and unhoisting as appropriate) methods from said component. - * - * Pass this method as the argument to the 'ref' property of the composed component. - */ BaseDecorator.prototype._updateComposedComponentRef = function(composedComponentInstance) { - this._composedComponentInstance = composedComponentInstance; - if (composedComponentInstance) this._hoisted = (0, _utilities.hoistMethods)(this, composedComponentInstance); - else if (this._hoisted) (0, _utilities.unhoistMethods)(this, this._hoisted); - }; - return BaseDecorator; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"diLL7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "WindowContext", ()=>(0, _reactWindowProvider.WindowContext)); -parcelHelpers.export(exports, "WindowProvider", ()=>(0, _reactWindowProvider.WindowProvider)); -parcelHelpers.export(exports, "useDocument", ()=>(0, _reactWindowProvider.useDocument)); -parcelHelpers.export(exports, "useWindow", ()=>(0, _reactWindowProvider.useWindow)); -var _version = require("./version"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); - -},{"./version":"6kzFC","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l3bQw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _menuContext = require("./MenuContext"); -parcelHelpers.exportAll(_menuContext, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./MenuContext":"gFd9B","./types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gFd9B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MenuContext", ()=>MenuContext); -parcelHelpers.export(exports, "useMenuContext", ()=>useMenuContext); -var _react = require("react"); -var MenuContext = _react.createContext({}); -var useMenuContext = function() { - return _react.useContext(MenuContext); -}; - -},{"react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ouID":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var _contextualMenuCnstyles = require("./ContextualMenu.cnstyles"); -var GlobalClassNames = { - root: 'ms-ContextualMenu', - container: 'ms-ContextualMenu-container', - list: 'ms-ContextualMenu-list', - header: 'ms-ContextualMenu-header', - title: 'ms-ContextualMenu-title', - isopen: 'is-open' -}; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var fonts = theme.fonts, semanticColors = theme.semanticColors, effects = theme.effects; - return { - root: [ - theme.fonts.medium, - classNames.root, - classNames.isopen, - { - backgroundColor: semanticColors.menuBackground, - minWidth: '180px' - }, - className - ], - container: [ - classNames.container, - { - selectors: { - ':focus': { - outline: 0 - } - } - } - ], - list: [ - classNames.list, - classNames.isopen, - { - listStyleType: 'none', - margin: '0', - padding: '0' - } - ], - header: [ - classNames.header, - fonts.small, - { - fontWeight: (0, _styling.FontWeights).semibold, - color: semanticColors.menuHeader, - background: 'none', - backgroundColor: 'transparent', - border: 'none', - height: (0, _contextualMenuCnstyles.CONTEXTUAL_MENU_ITEM_HEIGHT), - lineHeight: (0, _contextualMenuCnstyles.CONTEXTUAL_MENU_ITEM_HEIGHT), - cursor: 'default', - padding: '0px 6px', - userSelect: 'none', - textAlign: 'left' - } - ], - title: [ - classNames.title, - { - fontSize: fonts.mediumPlus.fontSize, - paddingRight: '14px', - paddingLeft: '14px', - paddingBottom: '5px', - paddingTop: '5px', - backgroundColor: semanticColors.menuItemBackgroundPressed - } - ], - subComponentStyles: { - callout: { - root: { - boxShadow: effects.elevation8 - } - }, - menuItem: {} - } - }; -}; - -},{"../../Styling":"hTimn","./ContextualMenu.cnstyles":"ktzsg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2b9yc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ButtonGlobalClassNames", ()=>ButtonGlobalClassNames); -parcelHelpers.export(exports, "getBaseButtonClassNames", ()=>getBaseButtonClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var ButtonGlobalClassNames = { - msButton: 'ms-Button', - msButtonHasMenu: 'ms-Button--hasMenu', - msButtonIcon: 'ms-Button-icon', - msButtonMenuIcon: 'ms-Button-menuIcon', - msButtonLabel: 'ms-Button-label', - msButtonDescription: 'ms-Button-description', - msButtonScreenReaderText: 'ms-Button-screenReaderText', - msButtonFlexContainer: 'ms-Button-flexContainer', - msButtonTextContainer: 'ms-Button-textContainer' -}; -var getBaseButtonClassNames = (0, _utilities.memoizeFunction)(function(theme, styles, className, variantClassName, iconClassName, menuIconClassName, disabled, hasMenu, checked, expanded, isSplit) { - var _a, _b; - var classNames = (0, _styling.getGlobalClassNames)(ButtonGlobalClassNames, theme || {}); - var isExpanded = expanded && !isSplit; - return (0, _styling.mergeStyleSets)(styles.__shadowConfig__, { - root: [ - classNames.msButton, - styles.root, - variantClassName, - checked && [ - 'is-checked', - styles.rootChecked - ], - isExpanded && [ - 'is-expanded', - styles.rootExpanded, - (_a = {}, _a[":hover .".concat(classNames.msButtonIcon)] = styles.iconExpandedHovered, // menuIcon falls back to rootExpandedHovered to support original behavior - _a[":hover .".concat(classNames.msButtonMenuIcon)] = styles.menuIconExpandedHovered || styles.rootExpandedHovered, _a[':hover'] = styles.rootExpandedHovered, _a) - ], - hasMenu && [ - ButtonGlobalClassNames.msButtonHasMenu, - styles.rootHasMenu - ], - disabled && [ - 'is-disabled', - styles.rootDisabled - ], - !disabled && !isExpanded && !checked && (_b = { - ':hover': styles.rootHovered - }, _b[":hover .".concat(classNames.msButtonLabel)] = styles.labelHovered, _b[":hover .".concat(classNames.msButtonIcon)] = styles.iconHovered, _b[":hover .".concat(classNames.msButtonDescription)] = styles.descriptionHovered, _b[":hover .".concat(classNames.msButtonMenuIcon)] = styles.menuIconHovered, _b[':focus'] = styles.rootFocused, _b[':active'] = styles.rootPressed, _b[":active .".concat(classNames.msButtonIcon)] = styles.iconPressed, _b[":active .".concat(classNames.msButtonDescription)] = styles.descriptionPressed, _b[":active .".concat(classNames.msButtonMenuIcon)] = styles.menuIconPressed, _b), - disabled && checked && [ - styles.rootCheckedDisabled - ], - !disabled && checked && { - ':hover': styles.rootCheckedHovered, - ':active': styles.rootCheckedPressed - }, - className - ], - flexContainer: [ - classNames.msButtonFlexContainer, - styles.flexContainer - ], - textContainer: [ - classNames.msButtonTextContainer, - styles.textContainer - ], - icon: [ - classNames.msButtonIcon, - iconClassName, - styles.icon, - isExpanded && styles.iconExpanded, - checked && styles.iconChecked, - disabled && styles.iconDisabled - ], - label: [ - classNames.msButtonLabel, - styles.label, - checked && styles.labelChecked, - disabled && styles.labelDisabled - ], - menuIcon: [ - classNames.msButtonMenuIcon, - menuIconClassName, - styles.menuIcon, - checked && styles.menuIconChecked, - disabled && !isSplit && styles.menuIconDisabled, - !disabled && !isExpanded && !checked && { - ':hover': styles.menuIconHovered, - ':active': styles.menuIconPressed - }, - isExpanded && [ - 'is-expanded', - styles.menuIconExpanded - ] - ], - description: [ - classNames.msButtonDescription, - styles.description, - checked && styles.descriptionChecked, - disabled && styles.descriptionDisabled - ], - screenReaderText: [ - classNames.msButtonScreenReaderText, - styles.screenReaderText - ] - }); -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8sJhS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SplitButtonGlobalClassNames", ()=>SplitButtonGlobalClassNames); -parcelHelpers.export(exports, "getSplitButtonClassNames", ()=>getSplitButtonClassNames); -var _utilities = require("../../../Utilities"); -var _styling = require("../../../Styling"); -var SplitButtonGlobalClassNames = { - msSplitButtonDivider: 'ms-SplitButton-divider' -}; -var getSplitButtonClassNames = (0, _utilities.memoizeFunction)(function(styles, disabled, expanded, checked, primaryDisabled) { - return { - root: (0, _styling.mergeStyles)(styles.splitButtonMenuButton, expanded && [ - styles.splitButtonMenuButtonExpanded - ], disabled && [ - styles.splitButtonMenuButtonDisabled - ], checked && !disabled && [ - styles.splitButtonMenuButtonChecked - ], primaryDisabled && !disabled && [ - { - ':focus': styles.splitButtonMenuFocused - } - ]), - splitButtonContainer: (0, _styling.mergeStyles)(styles.splitButtonContainer, !disabled && checked && [ - styles.splitButtonContainerChecked, - { - ':hover': styles.splitButtonContainerCheckedHovered - } - ], !disabled && !checked && [ - { - ':hover': styles.splitButtonContainerHovered, - ':focus': styles.splitButtonContainerFocused - } - ], disabled && styles.splitButtonContainerDisabled), - icon: (0, _styling.mergeStyles)(styles.splitButtonMenuIcon, disabled && styles.splitButtonMenuIconDisabled, !disabled && primaryDisabled && styles.splitButtonMenuIcon), - flexContainer: (0, _styling.mergeStyles)(styles.splitButtonFlexContainer), - divider: (0, _styling.mergeStyles)(SplitButtonGlobalClassNames.msSplitButtonDivider, styles.splitButtonDivider, (primaryDisabled || disabled) && styles.splitButtonDividerDisabled) - }; -}); - -},{"../../../Utilities":"1NZCy","../../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i8Fdq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ActionButton", ()=>ActionButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _actionButtonStyles = require("./ActionButton.styles"); -/** - * {@docCategory Button} - */ var ActionButton = /** @class */ function(_super) { - (0, _tslib.__extends)(ActionButton, _super); - function ActionButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - ActionButton.prototype.render = function() { - var _a = this.props, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: "ms-Button--action ms-Button--command", - styles: (0, _actionButtonStyles.getStyles)(theme, styles), - onRenderDescription: (0, _utilities.nullRender) - })); - }; - ActionButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('ActionButton', [ - 'theme', - 'styles' - ], true) - ], ActionButton); - return ActionButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./ActionButton.styles":"03QOE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"03QOE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var DEFAULT_BUTTON_HEIGHT = '40px'; -var DEFAULT_PADDING = '0 4px'; -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a, _b, _c; - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var actionButtonStyles = { - root: (_a = { - padding: DEFAULT_PADDING, - height: DEFAULT_BUTTON_HEIGHT, - color: theme.palette.neutralPrimary, - backgroundColor: 'transparent', - border: '1px solid transparent' - }, _a[0, _styling.HighContrastSelector] = { - borderColor: 'Window' - }, _a), - rootHovered: (_b = { - color: theme.palette.themePrimary - }, _b[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _b), - iconHovered: { - color: theme.palette.themePrimary - }, - rootPressed: { - color: theme.palette.black - }, - rootExpanded: { - color: theme.palette.themePrimary - }, - iconPressed: { - color: theme.palette.themeDarker - }, - rootDisabled: (_c = { - color: theme.palette.neutralTertiary, - backgroundColor: 'transparent', - borderColor: 'transparent' - }, _c[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _c), - rootChecked: { - color: theme.palette.black - }, - iconChecked: { - color: theme.palette.themeDarker - }, - flexContainer: { - justifyContent: 'flex-start' - }, - icon: { - color: theme.palette.themeDarkAlt - }, - iconDisabled: { - color: 'inherit' - }, - menuIcon: { - color: theme.palette.neutralSecondary - }, - textContainer: { - flexGrow: 0 - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, actionButtonStyles, customStyles); -}); - -},{"../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"40Y3k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var noOutline = { + return false; + }; + BaseButton2.defaultProps = { + baseClassName: "ms-Button", + styles: {}, + split: false + }; + BaseButton2.contextType = FocusRectsContext; + return BaseButton2; + })(React__namespace.Component) + ); + var noOutline = { outline: 0 -}; -var iconStyle = function(fontSize) { - return { - fontSize: fontSize, - margin: '0 4px', - height: '16px', - lineHeight: '16px', - textAlign: 'center', - flexShrink: 0 - }; -}; -var getStyles = (0, _utilities.memoizeFunction)(function(theme) { - var _a, _b; - var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; - var border = semanticColors.buttonBorder; - var disabledBackground = semanticColors.disabledBackground; - var disabledText = semanticColors.disabledText; - var buttonHighContrastFocus = { - left: -2, - top: -2, - bottom: -2, - right: -2, - outlineColor: 'ButtonText' - }; - return { - root: [ - (0, _styling.getFocusStyle)(theme, { - inset: 1, - highContrastStyle: buttonHighContrastFocus, - borderColor: 'transparent' - }), - theme.fonts.medium, - { - border: '1px solid ' + border, - borderRadius: effects.roundedCorner2, - boxSizing: 'border-box', - cursor: 'pointer', - display: 'inline-flex', - alignItems: 'center', - justifyContent: 'center', - padding: '0 16px', - textDecoration: 'none', - textAlign: 'center', - userSelect: 'none', - // IE11 workaround for preventing shift of child elements of a button when active. - ':active > span': { - position: 'relative', - left: 0, - top: 0 - } - } - ], - rootDisabled: [ - (0, _styling.getFocusStyle)(theme, { - inset: 1, - highContrastStyle: buttonHighContrastFocus, - borderColor: 'transparent' - }), - { - backgroundColor: disabledBackground, - borderColor: disabledBackground, - color: disabledText, - cursor: 'default', - ':hover': noOutline, - ':focus': noOutline - } - ], - iconDisabled: (_a = { - color: disabledText - }, _a[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _a), - menuIconDisabled: (_b = { - color: disabledText - }, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _b), - flexContainer: { - display: 'flex', - height: '100%', - flexWrap: 'nowrap', - justifyContent: 'center', - alignItems: 'center' - }, - description: { - display: 'block' - }, - textContainer: { - flexGrow: 1, - display: 'block' - }, - icon: iconStyle(fonts.mediumPlus.fontSize), - menuIcon: iconStyle(fonts.small.fontSize), - label: { - margin: '0 4px', - lineHeight: '100%', - display: 'block' - }, - screenReaderText: (0, _styling.hiddenContentStyle) - }; -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fxfe4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBarButton", ()=>CommandBarButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _commandBarButtonStyles = require("./CommandBarButton.styles"); -/** - * {@docCategory Button} - */ var CommandBarButton = /** @class */ function(_super) { - (0, _tslib.__extends)(CommandBarButton, _super); - function CommandBarButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - CommandBarButton.prototype.render = function() { - var _a = this.props, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: "ms-Button--commandBar", - styles: (0, _commandBarButtonStyles.getStyles)(theme, styles), - onRenderDescription: (0, _utilities.nullRender) - })); + }; + var iconStyle = function(fontSize2) { + return { + fontSize: fontSize2, + margin: "0 4px", + height: "16px", + lineHeight: "16px", + textAlign: "center", + flexShrink: 0 }; - CommandBarButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('CommandBarButton', [ - 'theme', - 'styles' - ], true) - ], CommandBarButton); - return CommandBarButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./CommandBarButton.styles":"1bkHA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1bkHA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var _splitButtonStyles = require("../SplitButton/SplitButton.styles"); -var _baseButtonClassNames = require("../BaseButton.classNames"); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles, focusInset, focusColor) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var baseSplitButtonStyles = (0, _splitButtonStyles.getStyles)(theme); - var p = theme.palette, semanticColors = theme.semanticColors; - var commandButtonHighContrastFocus = { - left: 4, - top: 4, - bottom: 4, - right: 4, - border: 'none' + }; + var getStyles$p = memoizeFunction(function(theme) { + var _a2, _b2; + var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; + var border = semanticColors.buttonBorder; + var disabledBackground = semanticColors.disabledBackground; + var disabledText = semanticColors.disabledText; + var buttonHighContrastFocus = { + left: -2, + top: -2, + bottom: -2, + right: -2, + outlineColor: "ButtonText" }; - var commandButtonStyles = { - root: [ - (0, _styling.getFocusStyle)(theme, { - inset: 2, - highContrastStyle: commandButtonHighContrastFocus, - borderColor: 'transparent' - }), - theme.fonts.medium, - (_a = { - minWidth: '40px', - backgroundColor: p.white, - color: p.neutralPrimary, - padding: '0 4px', - border: 'none', - borderRadius: 0 - }, _a[0, _styling.HighContrastSelector] = { - border: 'none' - }, _a) - ], - rootHovered: (_b = { - backgroundColor: p.neutralLighter, - color: p.neutralDark - }, _b[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _b[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDarkAlt - }, _b[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _b), - rootPressed: (_c = { - backgroundColor: p.neutralLight, - color: p.neutralDark - }, _c[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _c[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _c), - rootChecked: (_d = { - backgroundColor: p.neutralLight, - color: p.neutralDark - }, _d[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _d[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _d), - rootCheckedHovered: (_e = { - backgroundColor: p.neutralQuaternaryAlt - }, _e[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _e[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _e), - rootExpanded: (_f = { - backgroundColor: p.neutralLight, - color: p.neutralDark - }, _f[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.themeDark - }, _f[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonMenuIcon)] = { - color: p.neutralPrimary - }, _f), - rootExpandedHovered: { - backgroundColor: p.neutralQuaternaryAlt - }, - rootDisabled: (_g = { - backgroundColor: p.white - }, _g[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = (_h = { - color: semanticColors.disabledBodySubtext - }, _h[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _h), _g[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _g), - // Split button styles - splitButtonContainer: (_j = { - height: '100%' - }, _j[0, _styling.HighContrastSelector] = { - border: 'none' - }, _j), - splitButtonDividerDisabled: (_k = {}, _k[0, _styling.HighContrastSelector] = { - backgroundColor: 'Window' - }, _k), - splitButtonDivider: { - backgroundColor: p.neutralTertiaryAlt - }, - splitButtonMenuButton: { - backgroundColor: p.white, - border: 'none', - borderTopRightRadius: '0', - borderBottomRightRadius: '0', - color: p.neutralSecondary, - ':hover': (_l = { - backgroundColor: p.neutralLighter, - color: p.neutralDark - }, _l[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _l[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.neutralPrimary - }, _l), - ':active': (_m = { - backgroundColor: p.neutralLight - }, _m[".".concat((0, _baseButtonClassNames.ButtonGlobalClassNames).msButtonIcon)] = { - color: p.neutralPrimary - }, _m) - }, - splitButtonMenuButtonDisabled: (_o = { - backgroundColor: p.white - }, _o[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText', - border: 'none', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _o), - splitButtonMenuButtonChecked: { - backgroundColor: p.neutralLight, - color: p.neutralDark, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuButtonExpanded: { - backgroundColor: p.neutralLight, - color: p.black, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuIcon: { - color: p.neutralPrimary - }, - splitButtonMenuIconDisabled: { - color: p.neutralTertiary - }, - label: { - fontWeight: 'normal' - }, - icon: { - color: p.themePrimary - }, - menuIcon: { - color: p.neutralSecondary - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, baseSplitButtonStyles, commandButtonStyles, customStyles); -}); - -},{"tslib":"9gizs","../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","../SplitButton/SplitButton.styles":"2TsW5","../BaseButton.classNames":"2b9yc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2TsW5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; + return { + root: [ + getFocusStyle(theme, { inset: 1, highContrastStyle: buttonHighContrastFocus, borderColor: "transparent" }), + theme.fonts.medium, + { + border: "1px solid " + border, + borderRadius: effects.roundedCorner2, + boxSizing: "border-box", + cursor: "pointer", + display: "inline-flex", + alignItems: "center", + justifyContent: "center", + padding: "0 16px", + textDecoration: "none", + textAlign: "center", + userSelect: "none", + // IE11 workaround for preventing shift of child elements of a button when active. + ":active > span": { + position: "relative", + left: 0, + top: 0 + } + } + ], + rootDisabled: [ + getFocusStyle(theme, { inset: 1, highContrastStyle: buttonHighContrastFocus, borderColor: "transparent" }), + { + backgroundColor: disabledBackground, + borderColor: disabledBackground, + color: disabledText, + cursor: "default", + ":hover": noOutline, + ":focus": noOutline + } + ], + iconDisabled: (_a2 = { + color: disabledText + }, _a2[HighContrastSelector] = { + color: "GrayText" + }, _a2), + menuIconDisabled: (_b2 = { + color: disabledText + }, _b2[HighContrastSelector] = { + color: "GrayText" + }, _b2), + flexContainer: { + display: "flex", + height: "100%", + flexWrap: "nowrap", + justifyContent: "center", + alignItems: "center" + }, + description: { + display: "block" + }, + textContainer: { + flexGrow: 1, + display: "block" + }, + icon: iconStyle(fonts.mediumPlus.fontSize), + menuIcon: iconStyle(fonts.small.fontSize), + label: { + margin: "0 4px", + lineHeight: "100%", + display: "block" + }, + screenReaderText: hiddenContentStyle + }; + }); + var getStyles$o = memoizeFunction(function(theme, customStyles) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s; var effects = theme.effects, palette = theme.palette, semanticColors = theme.semanticColors; var buttonHighContrastFocus = { - left: -2, - top: -2, - bottom: -2, - right: -2, - border: 'none' - }; - var splitButtonDividerBaseStyles = { - position: 'absolute', - width: 1, - right: 31, - top: 8, - bottom: 8 + left: -2, + top: -2, + bottom: -2, + right: -2, + border: "none" + }; + var splitButtonDividerBaseStyles2 = { + position: "absolute", + width: 1, + right: 31, + top: 8, + bottom: 8 }; var splitButtonStyles = { - splitButtonContainer: [ - (0, _styling.getFocusStyle)(theme, { - highContrastStyle: buttonHighContrastFocus, - inset: 2, - pointerEvents: 'none' - }), - { - display: 'inline-flex', - '.ms-Button--default': { - borderTopRightRadius: '0', - borderBottomRightRadius: '0', - borderRight: 'none', - flexGrow: '1' - }, - '.ms-Button--primary': (_a = { - borderTopRightRadius: '0', - borderBottomRightRadius: '0', - border: 'none', - flexGrow: '1', - ':hover': { - border: 'none' - }, - ':active': { - border: 'none' - } - }, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)((0, _tslib.__assign)({ - color: 'WindowText', - backgroundColor: 'Window', - border: '1px solid WindowText', - borderRightWidth: '0' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - ':hover': { - backgroundColor: 'Highlight', - border: '1px solid Highlight', - borderRightWidth: '0', - color: 'HighlightText' - }, - ':active': { - border: '1px solid Highlight' - } - }), _a), - '.ms-Button--default + .ms-Button': (_b = {}, _b[0, _styling.HighContrastSelector] = { - border: '1px solid WindowText', - borderLeftWidth: '0', - ':hover': { - backgroundColor: 'HighlightText', - borderColor: 'Highlight', - color: 'Highlight', - '.ms-Button-menuIcon': (0, _tslib.__assign)({ - backgroundColor: 'HighlightText', - color: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()) - } - }, _b), - '.ms-Button--default + .ms-Button[aria-expanded="true"]': (_c = {}, _c[0, _styling.HighContrastSelector] = { - backgroundColor: 'HighlightText', - borderColor: 'Highlight', - color: 'Highlight', - '.ms-Button-menuIcon': (0, _tslib.__assign)({ - backgroundColor: 'HighlightText', - color: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()) - }, _c), - '.ms-Button--primary + .ms-Button': (_d = { - border: 'none' - }, _d[0, _styling.HighContrastSelector] = { - border: '1px solid WindowText', - borderLeftWidth: '0', - ':hover': { - borderLeftWidth: '0', - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText', - '.ms-Button-menuIcon': (0, _tslib.__assign)((0, _tslib.__assign)({}, (0, _styling.getHighContrastNoAdjustStyle)()), { - color: 'HighlightText' - }) - } - }, _d), - '.ms-Button--primary + .ms-Button[aria-expanded="true"]': (_e = {}, _e[0, _styling.HighContrastSelector] = (0, _tslib.__assign)((0, _tslib.__assign)({ - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - '.ms-Button-menuIcon': { - color: 'HighlightText' - } - }), _e), - '.ms-Button.is-disabled': (_f = {}, _f[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _f) - } - ], - splitButtonContainerHovered: { - '.ms-Button--default.is-disabled': (_g = { - backgroundColor: semanticColors.buttonBackgroundDisabled, - color: semanticColors.buttonTextDisabled - }, _g[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _g), - '.ms-Button--primary.is-disabled': (_h = { - backgroundColor: semanticColors.primaryButtonBackgroundDisabled, - color: semanticColors.primaryButtonTextDisabled - }, _h[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _h) - }, - splitButtonContainerChecked: { - '.ms-Button--primary': (_j = {}, _j[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _j) - }, - splitButtonContainerCheckedHovered: { - '.ms-Button--primary': (_k = {}, _k[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _k) - }, - splitButtonContainerFocused: { - outline: 'none!important' - }, - splitButtonMenuButton: (_l = { - padding: 6, - height: 'auto', - boxSizing: 'border-box', - borderRadius: 0, - borderTopRightRadius: effects.roundedCorner2, - borderBottomRightRadius: effects.roundedCorner2, - border: "1px solid ".concat(palette.neutralSecondaryAlt), - borderLeft: 'none', - outline: 'transparent', - userSelect: 'none', - display: 'inline-block', - textDecoration: 'none', - textAlign: 'center', - cursor: 'pointer', - verticalAlign: 'top', - width: 32, - marginLeft: -1, - marginTop: 0, - marginRight: 0, - marginBottom: 0 - }, _l[0, _styling.HighContrastSelector] = { - '.ms-Button-menuIcon': { - color: 'WindowText' - } - }, _l), - splitButtonDivider: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles), (_m = {}, _m[0, _styling.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _m)), - splitButtonDividerDisabled: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles), (_o = {}, _o[0, _styling.HighContrastSelector] = { - backgroundColor: 'GrayText' - }, _o)), - splitButtonMenuButtonDisabled: (_p = { - pointerEvents: 'none', - border: 'none', - ':hover': { - cursor: 'default' + splitButtonContainer: [ + getFocusStyle(theme, { highContrastStyle: buttonHighContrastFocus, inset: 2, pointerEvents: "none" }), + { + display: "inline-flex", + ".ms-Button--default": { + borderTopRightRadius: "0", + borderBottomRightRadius: "0", + borderRight: "none", + flexGrow: "1" + }, + ".ms-Button--primary": (_a2 = { + borderTopRightRadius: "0", + borderBottomRightRadius: "0", + border: "none", + flexGrow: "1", + ":hover": { + border: "none" }, - '.ms-Button--primary': (_q = {}, _q[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _q), - '.ms-Button-menuIcon': (_r = {}, _r[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _r) - }, _p[0, _styling.HighContrastSelector] = { - color: 'GrayText', - border: '1px solid GrayText', - backgroundColor: 'Window' - }, _p), - splitButtonFlexContainer: { - display: 'flex', - height: '100%', - flexWrap: 'nowrap', - justifyContent: 'center', - alignItems: 'center' - }, - splitButtonContainerDisabled: (_s = { - outline: 'none', - border: 'none' - }, _s[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _s), - splitButtonMenuFocused: (0, _tslib.__assign)({}, (0, _styling.getFocusStyle)(theme, { - highContrastStyle: buttonHighContrastFocus, - inset: 2 - })) - }; - return (0, _styling.concatStyleSets)(splitButtonStyles, customStyles); -}); - -},{"tslib":"9gizs","../../../Styling":"hTimn","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5I0qn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandButton", ()=>CommandButton); -var _actionButton = require("../ActionButton/ActionButton"); -var CommandButton = (0, _actionButton.ActionButton); - -},{"../ActionButton/ActionButton":"i8Fdq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3H4TE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DefaultButton", ()=>DefaultButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _defaultButtonStyles = require("./DefaultButton.styles"); -/** - * {@docCategory Button} - */ var DefaultButton = /** @class */ function(_super) { - (0, _tslib.__extends)(DefaultButton, _super); - function DefaultButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - DefaultButton.prototype.render = function() { - var _a = this.props, _b = _a.primary, primary = _b === void 0 ? false : _b, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: primary ? 'ms-Button--primary' : 'ms-Button--default', - styles: (0, _defaultButtonStyles.getStyles)(theme, styles, primary), - onRenderDescription: (0, _utilities.nullRender) - })); + ":active": { + border: "none" + } + }, _a2[HighContrastSelector] = __assign$1(__assign$1({ color: "WindowText", backgroundColor: "Window", border: "1px solid WindowText", borderRightWidth: "0" }, getHighContrastNoAdjustStyle()), { ":hover": { + backgroundColor: "Highlight", + border: "1px solid Highlight", + borderRightWidth: "0", + color: "HighlightText" + }, ":active": { + border: "1px solid Highlight" + } }), _a2), + ".ms-Button--default + .ms-Button": (_b2 = {}, _b2[HighContrastSelector] = { + border: "1px solid WindowText", + borderLeftWidth: "0", + ":hover": { + backgroundColor: "HighlightText", + borderColor: "Highlight", + color: "Highlight", + ".ms-Button-menuIcon": __assign$1({ backgroundColor: "HighlightText", color: "Highlight" }, getHighContrastNoAdjustStyle()) + } + }, _b2), + '.ms-Button--default + .ms-Button[aria-expanded="true"]': (_c2 = {}, _c2[HighContrastSelector] = { + backgroundColor: "HighlightText", + borderColor: "Highlight", + color: "Highlight", + ".ms-Button-menuIcon": __assign$1({ backgroundColor: "HighlightText", color: "Highlight" }, getHighContrastNoAdjustStyle()) + }, _c2), + ".ms-Button--primary + .ms-Button": (_d2 = { + border: "none" + }, _d2[HighContrastSelector] = { + border: "1px solid WindowText", + borderLeftWidth: "0", + ":hover": { + borderLeftWidth: "0", + backgroundColor: "Highlight", + borderColor: "Highlight", + color: "HighlightText", + ".ms-Button-menuIcon": __assign$1(__assign$1({}, getHighContrastNoAdjustStyle()), { color: "HighlightText" }) + } + }, _d2), + '.ms-Button--primary + .ms-Button[aria-expanded="true"]': (_e2 = {}, _e2[HighContrastSelector] = __assign$1(__assign$1({ backgroundColor: "Highlight", borderColor: "Highlight", color: "HighlightText" }, getHighContrastNoAdjustStyle()), { ".ms-Button-menuIcon": { + color: "HighlightText" + } }), _e2), + ".ms-Button.is-disabled": (_f = {}, _f[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _f) + } + ], + splitButtonContainerHovered: { + ".ms-Button--default.is-disabled": (_g = { + backgroundColor: semanticColors.buttonBackgroundDisabled, + color: semanticColors.buttonTextDisabled + }, _g[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _g), + ".ms-Button--primary.is-disabled": (_h = { + backgroundColor: semanticColors.primaryButtonBackgroundDisabled, + color: semanticColors.primaryButtonTextDisabled + }, _h[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _h) + }, + splitButtonContainerChecked: { + ".ms-Button--primary": (_j = {}, _j[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText" }, getHighContrastNoAdjustStyle()), _j) + }, + splitButtonContainerCheckedHovered: { + ".ms-Button--primary": (_k = {}, _k[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText" }, getHighContrastNoAdjustStyle()), _k) + }, + splitButtonContainerFocused: { + outline: "none!important" + }, + splitButtonMenuButton: (_l = { + padding: 6, + height: "auto", + boxSizing: "border-box", + borderRadius: 0, + borderTopRightRadius: effects.roundedCorner2, + borderBottomRightRadius: effects.roundedCorner2, + border: "1px solid ".concat(palette.neutralSecondaryAlt), + borderLeft: "none", + outline: "transparent", + userSelect: "none", + display: "inline-block", + textDecoration: "none", + textAlign: "center", + cursor: "pointer", + verticalAlign: "top", + width: 32, + marginLeft: -1, + marginTop: 0, + marginRight: 0, + marginBottom: 0 + }, _l[HighContrastSelector] = { + ".ms-Button-menuIcon": { + color: "WindowText" + } + }, _l), + splitButtonDivider: __assign$1(__assign$1({}, splitButtonDividerBaseStyles2), (_m = {}, _m[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _m)), + splitButtonDividerDisabled: __assign$1(__assign$1({}, splitButtonDividerBaseStyles2), (_o = {}, _o[HighContrastSelector] = { + backgroundColor: "GrayText" + }, _o)), + splitButtonMenuButtonDisabled: (_p = { + pointerEvents: "none", + border: "none", + ":hover": { + cursor: "default" + }, + ".ms-Button--primary": (_q = {}, _q[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _q), + ".ms-Button-menuIcon": (_r = {}, _r[HighContrastSelector] = { + color: "GrayText" + }, _r) + }, _p[HighContrastSelector] = { + color: "GrayText", + border: "1px solid GrayText", + backgroundColor: "Window" + }, _p), + splitButtonFlexContainer: { + display: "flex", + height: "100%", + flexWrap: "nowrap", + justifyContent: "center", + alignItems: "center" + }, + splitButtonContainerDisabled: (_s = { + outline: "none", + border: "none" + }, _s[HighContrastSelector] = __assign$1({ color: "GrayText", borderColor: "GrayText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _s), + splitButtonMenuFocused: __assign$1({}, getFocusStyle(theme, { highContrastStyle: buttonHighContrastFocus, inset: 2 })) }; - DefaultButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('DefaultButton', [ - 'theme', - 'styles' - ], true) - ], DefaultButton); - return DefaultButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./DefaultButton.styles":"iURfs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iURfs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var _splitButtonStyles = require("../SplitButton/SplitButton.styles"); -var _buttonThemes = require("../ButtonThemes"); -var DEFAULT_BUTTON_MIN_HEIGHT = '32px'; -var DEFAULT_BUTTON_MIN_WIDTH = '80px'; -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles, primary) { - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var splitButtonStyles = (0, _splitButtonStyles.getStyles)(theme); - var defaultButtonStyles = { - root: { - minWidth: DEFAULT_BUTTON_MIN_WIDTH, - minHeight: DEFAULT_BUTTON_MIN_HEIGHT - }, - label: { - fontWeight: (0, _styling.FontWeights).semibold - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, defaultButtonStyles, primary ? (0, _buttonThemes.primaryStyles)(theme) : (0, _buttonThemes.standardStyles)(theme), splitButtonStyles, customStyles); -}); - -},{"../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","../SplitButton/SplitButton.styles":"2TsW5","../ButtonThemes":"f0GMb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f0GMb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "standardStyles", ()=>standardStyles); -parcelHelpers.export(exports, "primaryStyles", ()=>primaryStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var splitButtonDividerBaseStyles = function() { + return concatStyleSets(splitButtonStyles, customStyles); + }); + var splitButtonDividerBaseStyles = function() { return { - position: 'absolute', - width: 1, - right: 31, - top: 8, - bottom: 8 - }; -}; -function standardStyles(theme) { - var _a, _b, _c, _d, _e; - var s = theme.semanticColors, p = theme.palette; - var buttonBackground = s.buttonBackground; - var buttonBackgroundPressed = s.buttonBackgroundPressed; - var buttonBackgroundHovered = s.buttonBackgroundHovered; - var buttonBackgroundDisabled = s.buttonBackgroundDisabled; - var buttonText = s.buttonText; - var buttonTextHovered = s.buttonTextHovered; - var buttonTextDisabled = s.buttonTextDisabled; - var buttonTextChecked = s.buttonTextChecked; - var buttonTextCheckedHovered = s.buttonTextCheckedHovered; + position: "absolute", + width: 1, + right: 31, + top: 8, + bottom: 8 + }; + }; + function standardStyles(theme) { + var _a2, _b2, _c2, _d2, _e2; + var s2 = theme.semanticColors, p = theme.palette; + var buttonBackground = s2.buttonBackground; + var buttonBackgroundPressed = s2.buttonBackgroundPressed; + var buttonBackgroundHovered = s2.buttonBackgroundHovered; + var buttonBackgroundDisabled = s2.buttonBackgroundDisabled; + var buttonText = s2.buttonText; + var buttonTextHovered = s2.buttonTextHovered; + var buttonTextDisabled = s2.buttonTextDisabled; + var buttonTextChecked = s2.buttonTextChecked; + var buttonTextCheckedHovered = s2.buttonTextCheckedHovered; return { - root: { - backgroundColor: buttonBackground, - color: buttonText - }, - rootHovered: (_a = { - backgroundColor: buttonBackgroundHovered, - color: buttonTextHovered - }, _a[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - color: 'Highlight' - }, _a), - rootPressed: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextChecked - }, - rootExpanded: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextChecked - }, - rootChecked: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextChecked - }, - rootCheckedHovered: { - backgroundColor: buttonBackgroundPressed, - color: buttonTextCheckedHovered - }, - rootDisabled: (_b = { - color: buttonTextDisabled, - backgroundColor: buttonBackgroundDisabled - }, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _b), - // Split button styles - splitButtonContainer: (_c = {}, _c[0, _styling.HighContrastSelector] = { - border: 'none' - }, _c), - splitButtonMenuButton: { - color: p.white, - backgroundColor: 'transparent', - ':hover': (_d = { - backgroundColor: p.neutralLight - }, _d[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _d) - }, - splitButtonMenuButtonDisabled: { - backgroundColor: s.buttonBackgroundDisabled, - ':hover': { - backgroundColor: s.buttonBackgroundDisabled - } - }, - splitButtonDivider: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles()), (_e = { - backgroundColor: p.neutralTertiaryAlt - }, _e[0, _styling.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _e)), - splitButtonDividerDisabled: { - backgroundColor: theme.palette.neutralTertiaryAlt - }, - splitButtonMenuButtonChecked: { - backgroundColor: p.neutralQuaternaryAlt, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuButtonExpanded: { - backgroundColor: p.neutralQuaternaryAlt, - ':hover': { - backgroundColor: p.neutralQuaternaryAlt - } - }, - splitButtonMenuIcon: { - color: s.buttonText - }, - splitButtonMenuIconDisabled: { - color: s.buttonTextDisabled + root: { + backgroundColor: buttonBackground, + color: buttonText + }, + rootHovered: (_a2 = { + backgroundColor: buttonBackgroundHovered, + color: buttonTextHovered + }, _a2[HighContrastSelector] = { + borderColor: "Highlight", + color: "Highlight" + }, _a2), + rootPressed: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextChecked + }, + rootExpanded: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextChecked + }, + rootChecked: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextChecked + }, + rootCheckedHovered: { + backgroundColor: buttonBackgroundPressed, + color: buttonTextCheckedHovered + }, + rootDisabled: (_b2 = { + color: buttonTextDisabled, + backgroundColor: buttonBackgroundDisabled + }, _b2[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _b2), + // Split button styles + splitButtonContainer: (_c2 = {}, _c2[HighContrastSelector] = { + border: "none" + }, _c2), + splitButtonMenuButton: { + color: p.white, + backgroundColor: "transparent", + ":hover": (_d2 = { + backgroundColor: p.neutralLight + }, _d2[HighContrastSelector] = { + color: "Highlight" + }, _d2) + }, + splitButtonMenuButtonDisabled: { + backgroundColor: s2.buttonBackgroundDisabled, + ":hover": { + backgroundColor: s2.buttonBackgroundDisabled + } + }, + splitButtonDivider: __assign$1(__assign$1({}, splitButtonDividerBaseStyles()), (_e2 = { backgroundColor: p.neutralTertiaryAlt }, _e2[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _e2)), + splitButtonDividerDisabled: { + backgroundColor: theme.palette.neutralTertiaryAlt + }, + splitButtonMenuButtonChecked: { + backgroundColor: p.neutralQuaternaryAlt, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt + } + }, + splitButtonMenuButtonExpanded: { + backgroundColor: p.neutralQuaternaryAlt, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt } + }, + splitButtonMenuIcon: { + color: s2.buttonText + }, + splitButtonMenuIconDisabled: { + color: s2.buttonTextDisabled + } }; -} -function primaryStyles(theme) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - var p = theme.palette, s = theme.semanticColors; + } + function primaryStyles(theme) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j; + var p = theme.palette, s2 = theme.semanticColors; return { - root: (_a = { - backgroundColor: s.primaryButtonBackground, - border: "1px solid ".concat(s.primaryButtonBackground), - color: s.primaryButtonText - }, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText', - borderColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus")] = { - ':after': { - border: "none", - outlineColor: p.white - } - }, _a), - rootHovered: (_b = { - backgroundColor: s.primaryButtonBackgroundHovered, - border: "1px solid ".concat(s.primaryButtonBackgroundHovered), - color: s.primaryButtonTextHovered - }, _b[0, _styling.HighContrastSelector] = { - color: 'Window', - backgroundColor: 'Highlight', - borderColor: 'Highlight' - }, _b), - rootPressed: (_c = { - backgroundColor: s.primaryButtonBackgroundPressed, - border: "1px solid ".concat(s.primaryButtonBackgroundPressed), - color: s.primaryButtonTextPressed - }, _c[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'Window', - backgroundColor: 'WindowText', - borderColor: 'WindowText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _c), - rootExpanded: { - backgroundColor: s.primaryButtonBackgroundPressed, - color: s.primaryButtonTextPressed - }, - rootChecked: { - backgroundColor: s.primaryButtonBackgroundPressed, - color: s.primaryButtonTextPressed - }, - rootCheckedHovered: { - backgroundColor: s.primaryButtonBackgroundPressed, - color: s.primaryButtonTextPressed - }, - rootDisabled: (_d = { - color: s.primaryButtonTextDisabled, - backgroundColor: s.primaryButtonBackgroundDisabled - }, _d[0, _styling.HighContrastSelector] = { - color: 'GrayText', - borderColor: 'GrayText', - backgroundColor: 'Window' - }, _d), - // Split button styles - splitButtonContainer: (_e = {}, _e[0, _styling.HighContrastSelector] = { - border: 'none' - }, _e), - splitButtonDivider: (0, _tslib.__assign)((0, _tslib.__assign)({}, splitButtonDividerBaseStyles()), (_f = { - backgroundColor: p.white - }, _f[0, _styling.HighContrastSelector] = { - backgroundColor: 'Window' - }, _f)), - splitButtonMenuButton: (_g = { - backgroundColor: s.primaryButtonBackground, - color: s.primaryButtonText - }, _g[0, _styling.HighContrastSelector] = { - backgroundColor: 'Canvas' - }, _g[':hover'] = (_h = { - backgroundColor: s.primaryButtonBackgroundHovered - }, _h[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _h), _g), - splitButtonMenuButtonDisabled: { - backgroundColor: s.primaryButtonBackgroundDisabled, - ':hover': { - backgroundColor: s.primaryButtonBackgroundDisabled - } - }, - splitButtonMenuButtonChecked: { - backgroundColor: s.primaryButtonBackgroundPressed, - ':hover': { - backgroundColor: s.primaryButtonBackgroundPressed - } - }, - splitButtonMenuButtonExpanded: { - backgroundColor: s.primaryButtonBackgroundPressed, - ':hover': { - backgroundColor: s.primaryButtonBackgroundPressed - } - }, - splitButtonMenuIcon: { - color: s.primaryButtonText - }, - splitButtonMenuIconDisabled: (_j = { - color: p.neutralTertiary - }, _j[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _j) - }; -} - -},{"tslib":"9gizs","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g0nWk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PrimaryButton", ()=>PrimaryButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../../Utilities"); -var _defaultButton = require("../DefaultButton/DefaultButton"); -/** - * {@docCategory Button} - */ var PrimaryButton = /** @class */ function(_super) { - (0, _tslib.__extends)(PrimaryButton, _super); - function PrimaryButton() { - return _super !== null && _super.apply(this, arguments) || this; - } - PrimaryButton.prototype.render = function() { - return _react.createElement((0, _defaultButton.DefaultButton), (0, _tslib.__assign)({}, this.props, { - primary: true, - onRenderDescription: (0, _utilities.nullRender) - })); + root: (_a2 = { + backgroundColor: s2.primaryButtonBackground, + border: "1px solid ".concat(s2.primaryButtonBackground), + color: s2.primaryButtonText + }, _a2[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText", borderColor: "WindowText" }, getHighContrastNoAdjustStyle()), _a2[".".concat(IsFocusVisibleClassName, " &:focus, :host(.").concat(IsFocusVisibleClassName, ") &:focus")] = { + ":after": { + border: "none", + outlineColor: p.white + } + }, _a2), + rootHovered: (_b2 = { + backgroundColor: s2.primaryButtonBackgroundHovered, + border: "1px solid ".concat(s2.primaryButtonBackgroundHovered), + color: s2.primaryButtonTextHovered + }, _b2[HighContrastSelector] = { + color: "Window", + backgroundColor: "Highlight", + borderColor: "Highlight" + }, _b2), + rootPressed: (_c2 = { + backgroundColor: s2.primaryButtonBackgroundPressed, + border: "1px solid ".concat(s2.primaryButtonBackgroundPressed), + color: s2.primaryButtonTextPressed + }, _c2[HighContrastSelector] = __assign$1({ color: "Window", backgroundColor: "WindowText", borderColor: "WindowText" }, getHighContrastNoAdjustStyle()), _c2), + rootExpanded: { + backgroundColor: s2.primaryButtonBackgroundPressed, + color: s2.primaryButtonTextPressed + }, + rootChecked: { + backgroundColor: s2.primaryButtonBackgroundPressed, + color: s2.primaryButtonTextPressed + }, + rootCheckedHovered: { + backgroundColor: s2.primaryButtonBackgroundPressed, + color: s2.primaryButtonTextPressed + }, + rootDisabled: (_d2 = { + color: s2.primaryButtonTextDisabled, + backgroundColor: s2.primaryButtonBackgroundDisabled + }, _d2[HighContrastSelector] = { + color: "GrayText", + borderColor: "GrayText", + backgroundColor: "Window" + }, _d2), + // Split button styles + splitButtonContainer: (_e2 = {}, _e2[HighContrastSelector] = { + border: "none" + }, _e2), + splitButtonDivider: __assign$1(__assign$1({}, splitButtonDividerBaseStyles()), (_f = { backgroundColor: p.white }, _f[HighContrastSelector] = { + backgroundColor: "Window" + }, _f)), + splitButtonMenuButton: (_g = { + backgroundColor: s2.primaryButtonBackground, + color: s2.primaryButtonText + }, _g[HighContrastSelector] = { + backgroundColor: "Canvas" + }, _g[":hover"] = (_h = { + backgroundColor: s2.primaryButtonBackgroundHovered + }, _h[HighContrastSelector] = { + color: "Highlight" + }, _h), _g), + splitButtonMenuButtonDisabled: { + backgroundColor: s2.primaryButtonBackgroundDisabled, + ":hover": { + backgroundColor: s2.primaryButtonBackgroundDisabled + } + }, + splitButtonMenuButtonChecked: { + backgroundColor: s2.primaryButtonBackgroundPressed, + ":hover": { + backgroundColor: s2.primaryButtonBackgroundPressed + } + }, + splitButtonMenuButtonExpanded: { + backgroundColor: s2.primaryButtonBackgroundPressed, + ":hover": { + backgroundColor: s2.primaryButtonBackgroundPressed + } + }, + splitButtonMenuIcon: { + color: s2.primaryButtonText + }, + splitButtonMenuIconDisabled: (_j = { + color: p.neutralTertiary + }, _j[HighContrastSelector] = { + color: "GrayText" + }, _j) + }; + } + var DEFAULT_BUTTON_MIN_HEIGHT = "32px"; + var DEFAULT_BUTTON_MIN_WIDTH = "80px"; + var getStyles$n = memoizeFunction(function(theme, customStyles, primary) { + var baseButtonStyles = getStyles$p(theme); + var splitButtonStyles = getStyles$o(theme); + var defaultButtonStyles = { + root: { + minWidth: DEFAULT_BUTTON_MIN_WIDTH, + minHeight: DEFAULT_BUTTON_MIN_HEIGHT + }, + label: { + fontWeight: FontWeights.semibold + } }; - PrimaryButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('PrimaryButton', [ - 'theme', - 'styles' - ], true) - ], PrimaryButton); - return PrimaryButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../../Utilities":"1NZCy","../DefaultButton/DefaultButton":"3H4TE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bbHBP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "IconButton", ()=>IconButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _baseButton = require("../BaseButton"); -var _utilities = require("../../../Utilities"); -var _iconButtonStyles = require("./IconButton.styles"); -/** - * {@docCategory Button} - */ var IconButton = /** @class */ function(_super) { - (0, _tslib.__extends)(IconButton, _super); - function IconButton() { + return concatStyleSets(baseButtonStyles, defaultButtonStyles, primary ? primaryStyles(theme) : standardStyles(theme), splitButtonStyles, customStyles); + }); + var DefaultButton = ( + /** @class */ + (function(_super) { + __extends(DefaultButton2, _super); + function DefaultButton2() { return _super !== null && _super.apply(this, arguments) || this; - } - IconButton.prototype.render = function() { - var _a = this.props, styles = _a.styles, theme = _a.theme; - return _react.createElement((0, _baseButton.BaseButton), (0, _tslib.__assign)({}, this.props, { - variantClassName: "ms-Button--icon", - styles: (0, _iconButtonStyles.getStyles)(theme, styles), - onRenderText: (0, _utilities.nullRender), - onRenderDescription: (0, _utilities.nullRender) - })); + } + DefaultButton2.prototype.render = function() { + var _a2 = this.props, _b2 = _a2.primary, primary = _b2 === void 0 ? false : _b2, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: primary ? "ms-Button--primary" : "ms-Button--default", styles: getStyles$n(theme, styles, primary), onRenderDescription: nullRender })); + }; + DefaultButton2 = __decorate([ + customizable("DefaultButton", ["theme", "styles"]) + ], DefaultButton2); + return DefaultButton2; + })(React__namespace.Component) + ); + var DEFAULT_BUTTON_HEIGHT = "40px"; + var DEFAULT_PADDING = "0 4px"; + var getStyles$m = memoizeFunction(function(theme, customStyles) { + var _a2, _b2, _c2; + var baseButtonStyles = getStyles$p(theme); + var actionButtonStyles = { + root: (_a2 = { + padding: DEFAULT_PADDING, + height: DEFAULT_BUTTON_HEIGHT, + color: theme.palette.neutralPrimary, + backgroundColor: "transparent", + border: "1px solid transparent" + }, _a2[HighContrastSelector] = { + borderColor: "Window" + }, _a2), + rootHovered: (_b2 = { + color: theme.palette.themePrimary + }, _b2[HighContrastSelector] = { + color: "Highlight" + }, _b2), + iconHovered: { + color: theme.palette.themePrimary + }, + rootPressed: { + color: theme.palette.black + }, + rootExpanded: { + color: theme.palette.themePrimary + }, + iconPressed: { + color: theme.palette.themeDarker + }, + rootDisabled: (_c2 = { + color: theme.palette.neutralTertiary, + backgroundColor: "transparent", + borderColor: "transparent" + }, _c2[HighContrastSelector] = { + color: "GrayText" + }, _c2), + rootChecked: { + color: theme.palette.black + }, + iconChecked: { + color: theme.palette.themeDarker + }, + flexContainer: { + justifyContent: "flex-start" + }, + icon: { + color: theme.palette.themeDarkAlt + }, + iconDisabled: { + color: "inherit" + }, + menuIcon: { + color: theme.palette.neutralSecondary + }, + textContainer: { + flexGrow: 0 + } }; - IconButton = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('IconButton', [ - 'theme', - 'styles' - ], true) - ], IconButton); - return IconButton; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../BaseButton":"RtUZ1","../../../Utilities":"1NZCy","./IconButton.styles":"l1BeF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l1BeF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var _baseButtonStyles = require("../BaseButton.styles"); -var _splitButtonStyles = require("../SplitButton/SplitButton.styles"); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a; - var baseButtonStyles = (0, _baseButtonStyles.getStyles)(theme); - var splitButtonStyles = (0, _splitButtonStyles.getStyles)(theme); + return concatStyleSets(baseButtonStyles, actionButtonStyles, customStyles); + }); + var ActionButton = ( + /** @class */ + (function(_super) { + __extends(ActionButton2, _super); + function ActionButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ActionButton2.prototype.render = function() { + var _a2 = this.props, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: "ms-Button--action ms-Button--command", styles: getStyles$m(theme, styles), onRenderDescription: nullRender })); + }; + ActionButton2 = __decorate([ + customizable("ActionButton", ["theme", "styles"]) + ], ActionButton2); + return ActionButton2; + })(React__namespace.Component) + ); + var getStyles$l = memoizeFunction(function(theme, customStyles) { + var _a2; + var baseButtonStyles = getStyles$p(theme); + var splitButtonStyles = getStyles$o(theme); var palette = theme.palette, semanticColors = theme.semanticColors; var iconButtonStyles = { - root: { - padding: '0 4px', - width: '32px', - height: '32px', - backgroundColor: 'transparent', - border: 'none', - color: semanticColors.link - }, - rootHovered: (_a = { - color: palette.themeDarkAlt, - backgroundColor: palette.neutralLighter - }, _a[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - color: 'Highlight' - }, _a), - rootHasMenu: { - width: 'auto' - }, - rootPressed: { - color: palette.themeDark, - backgroundColor: palette.neutralLight - }, - rootExpanded: { - color: palette.themeDark, - backgroundColor: palette.neutralLight - }, - rootChecked: { - color: palette.themeDark, - backgroundColor: palette.neutralLight - }, - rootCheckedHovered: { - color: palette.themeDark, - backgroundColor: palette.neutralQuaternaryAlt - }, - rootDisabled: { - color: palette.neutralTertiaryAlt - } - }; - return (0, _styling.concatStyleSets)(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles); -}); - -},{"../../../Styling":"hTimn","../../../Utilities":"1NZCy","../BaseButton.styles":"40Y3k","../SplitButton/SplitButton.styles":"2TsW5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8qKBO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ChoiceGroup/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ChoiceGroup/index":"3SnD3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3SnD3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _choiceGroup = require("./ChoiceGroup"); -parcelHelpers.exportAll(_choiceGroup, exports); -var _choiceGroupBase = require("./ChoiceGroup.base"); -parcelHelpers.exportAll(_choiceGroupBase, exports); -var _choiceGroupTypes = require("./ChoiceGroup.types"); -parcelHelpers.exportAll(_choiceGroupTypes, exports); -var _index = require("./ChoiceGroupOption/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./ChoiceGroup":"efrlU","./ChoiceGroup.base":false,"./ChoiceGroup.types":false,"./ChoiceGroupOption/index":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"efrlU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroup", ()=>ChoiceGroup); -var _utilities = require("../../Utilities"); -var _choiceGroupBase = require("./ChoiceGroup.base"); -var _choiceGroupStyles = require("./ChoiceGroup.styles"); -var ChoiceGroup = (0, _utilities.styled)((0, _choiceGroupBase.ChoiceGroupBase), (0, _choiceGroupStyles.getStyles), undefined, { - scope: 'ChoiceGroup' -}); - -},{"../../Utilities":"1NZCy","./ChoiceGroup.base":"7MQAQ","./ChoiceGroup.styles":"imoN3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7MQAQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroupBase", ()=>ChoiceGroupBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _label = require("../../Label"); -var _utilities = require("../../Utilities"); -var _index = require("./ChoiceGroupOption/index"); -var _reactHooks = require("@fluentui/react-hooks"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var getOptionId = function(option, id) { - return "".concat(id, "-").concat(option.key); -}; -var findOption = function(options, key) { - return key === undefined ? undefined : (0, _utilities.find)(options, function(value) { - return value.key === key; - }); -}; -var focusSelectedOption = function(options, keyChecked, id, focusProviders, doc) { - var optionToFocus = findOption(options, keyChecked) || options.filter(function(option) { - return !option.disabled; - })[0]; - var elementToFocus = optionToFocus && (doc === null || doc === void 0 ? void 0 : doc.getElementById(getOptionId(optionToFocus, id))); - if (elementToFocus) { - elementToFocus.focus(); - (0, _utilities.setFocusVisibility)(true, elementToFocus, focusProviders); - } -}; -var focusFromFocusTrapZone = function(evt) { - return evt.relatedTarget instanceof HTMLElement && evt.relatedTarget.dataset.isFocusTrapZoneBumper === 'true'; -}; -var useComponentRef = function(options, keyChecked, id, componentRef, focusProviders) { - var doc = (0, _dom.useDocumentEx)(); - _react.useImperativeHandle(componentRef, function() { - return { - get checkedOption () { - return findOption(options, keyChecked); - }, - focus: function() { - focusSelectedOption(options, keyChecked, id, focusProviders, doc); - } - }; - }, [ - options, - keyChecked, - id, - focusProviders, - doc - ]); -}; -var COMPONENT_NAME = 'ChoiceGroup'; -var ChoiceGroupBase = _react.forwardRef(function(props, forwardedRef) { - var className = props.className, theme = props.theme, styles = props.styles, _a = props.options, options = _a === void 0 ? [] : _a, label = props.label, required = props.required, disabled = props.disabled, name = props.name, defaultSelectedKey = props.defaultSelectedKey, componentRef = props.componentRef, onChange = props.onChange; - var id = (0, _reactHooks.useId)('ChoiceGroup'); - var labelId = (0, _reactHooks.useId)('ChoiceGroupLabel'); - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), [ - 'onChange', - 'className', - 'required' - ]); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - optionsContainIconOrImage: options.some(function(option) { - return !!(option.iconProps || option.imageSrc); - }) - }); - var ariaLabelledBy = props.ariaLabelledBy || (label ? labelId : props['aria-labelledby']); - var _b = (0, _reactHooks.useControllableValue)(props.selectedKey, defaultSelectedKey), keyChecked = _b[0], setKeyChecked = _b[1]; - var _c = _react.useState(), keyFocused = _c[0], setKeyFocused = _c[1]; - var rootRef = _react.useRef(null); - var mergedRootRefs = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var focusContext = _react.useContext((0, _utilities.FocusRectsContext)); - useDebugWarnings(props); - useComponentRef(options, keyChecked, id, componentRef, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); - (0, _utilities.useFocusRects)(rootRef); - var onFocus = _react.useCallback(function(ev, option) { - var _a; - if (option) { - setKeyFocused(option.itemKey); - (_a = option.onFocus) === null || _a === void 0 || _a.call(option, ev); + root: { + padding: "0 4px", + width: "32px", + height: "32px", + backgroundColor: "transparent", + border: "none", + color: semanticColors.link + }, + rootHovered: (_a2 = { + color: palette.themeDarkAlt, + backgroundColor: palette.neutralLighter + }, _a2[HighContrastSelector] = { + borderColor: "Highlight", + color: "Highlight" + }, _a2), + rootHasMenu: { + width: "auto" + }, + rootPressed: { + color: palette.themeDark, + backgroundColor: palette.neutralLight + }, + rootExpanded: { + color: palette.themeDark, + backgroundColor: palette.neutralLight + }, + rootChecked: { + color: palette.themeDark, + backgroundColor: palette.neutralLight + }, + rootCheckedHovered: { + color: palette.themeDark, + backgroundColor: palette.neutralQuaternaryAlt + }, + rootDisabled: { + color: palette.neutralTertiaryAlt + } + }; + return concatStyleSets(baseButtonStyles, iconButtonStyles, splitButtonStyles, customStyles); + }); + var IconButton = ( + /** @class */ + (function(_super) { + __extends(IconButton2, _super); + function IconButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + IconButton2.prototype.render = function() { + var _a2 = this.props, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: "ms-Button--icon", styles: getStyles$l(theme, styles), onRenderText: nullRender, onRenderDescription: nullRender })); + }; + IconButton2 = __decorate([ + customizable("IconButton", ["theme", "styles"]) + ], IconButton2); + return IconButton2; + })(React__namespace.Component) + ); + var PrimaryButton = ( + /** @class */ + (function(_super) { + __extends(PrimaryButton2, _super); + function PrimaryButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + PrimaryButton2.prototype.render = function() { + return React__namespace.createElement(DefaultButton, __assign$1({}, this.props, { primary: true, onRenderDescription: nullRender })); + }; + PrimaryButton2 = __decorate([ + customizable("PrimaryButton", ["theme", "styles"]) + ], PrimaryButton2); + return PrimaryButton2; + })(React__namespace.Component) + ); + var getStyles$k = memoizeFunction(function(theme, customStyles, focusInset, focusColor) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o; + var baseButtonStyles = getStyles$p(theme); + var baseSplitButtonStyles = getStyles$o(theme); + var p = theme.palette, semanticColors = theme.semanticColors; + var commandButtonHighContrastFocus = { + left: 4, + top: 4, + bottom: 4, + right: 4, + border: "none" + }; + var commandButtonStyles = { + root: [ + getFocusStyle(theme, { + inset: 2, + highContrastStyle: commandButtonHighContrastFocus, + borderColor: "transparent" + }), + theme.fonts.medium, + (_a2 = { + minWidth: "40px", + backgroundColor: p.white, + color: p.neutralPrimary, + padding: "0 4px", + border: "none", + borderRadius: 0 + }, _a2[HighContrastSelector] = { + border: "none" + }, _a2) + ], + rootHovered: (_b2 = { + backgroundColor: p.neutralLighter, + color: p.neutralDark + }, _b2[HighContrastSelector] = { + color: "Highlight" + }, _b2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDarkAlt + }, _b2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _b2), + rootPressed: (_c2 = { + backgroundColor: p.neutralLight, + color: p.neutralDark + }, _c2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _c2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _c2), + rootChecked: (_d2 = { + backgroundColor: p.neutralLight, + color: p.neutralDark + }, _d2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _d2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _d2), + rootCheckedHovered: (_e2 = { + backgroundColor: p.neutralQuaternaryAlt + }, _e2[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _e2[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _e2), + rootExpanded: (_f = { + backgroundColor: p.neutralLight, + color: p.neutralDark + }, _f[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.themeDark + }, _f[".".concat(ButtonGlobalClassNames.msButtonMenuIcon)] = { + color: p.neutralPrimary + }, _f), + rootExpandedHovered: { + backgroundColor: p.neutralQuaternaryAlt + }, + rootDisabled: (_g = { + backgroundColor: p.white + }, _g[".".concat(ButtonGlobalClassNames.msButtonIcon)] = (_h = { + color: semanticColors.disabledBodySubtext + }, _h[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _h), _g[HighContrastSelector] = __assign$1({ color: "GrayText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _g), + // Split button styles + splitButtonContainer: (_j = { + height: "100%" + }, _j[HighContrastSelector] = { + border: "none" + }, _j), + splitButtonDividerDisabled: (_k = {}, _k[HighContrastSelector] = { + backgroundColor: "Window" + }, _k), + splitButtonDivider: { + backgroundColor: p.neutralTertiaryAlt + }, + splitButtonMenuButton: { + backgroundColor: p.white, + border: "none", + borderTopRightRadius: "0", + borderBottomRightRadius: "0", + color: p.neutralSecondary, + ":hover": (_l = { + backgroundColor: p.neutralLighter, + color: p.neutralDark + }, _l[HighContrastSelector] = { + color: "Highlight" + }, _l[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.neutralPrimary + }, _l), + ":active": (_m = { + backgroundColor: p.neutralLight + }, _m[".".concat(ButtonGlobalClassNames.msButtonIcon)] = { + color: p.neutralPrimary + }, _m) + }, + splitButtonMenuButtonDisabled: (_o = { + backgroundColor: p.white + }, _o[HighContrastSelector] = __assign$1({ color: "GrayText", border: "none", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _o), + splitButtonMenuButtonChecked: { + backgroundColor: p.neutralLight, + color: p.neutralDark, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt } - }, []); - var onBlur = _react.useCallback(function(ev, option) { - var _a; - setKeyFocused(undefined); - (_a = option === null || option === void 0 ? void 0 : option.onBlur) === null || _a === void 0 || _a.call(option, ev); - }, []); - var onOptionChange = _react.useCallback(function(evt, option) { - var _a; - if (!option) return; - setKeyChecked(option.itemKey); - (_a = option.onChange) === null || _a === void 0 || _a.call(option, evt); - onChange === null || onChange === void 0 || onChange(evt, findOption(options, option.itemKey)); - }, [ - onChange, - options, - setKeyChecked - ]); - var onRadioFocus = _react.useCallback(function(evt) { - // Handles scenarios like this bug: https://github.com/microsoft/fluentui/issues/20173 - if (focusFromFocusTrapZone(evt)) focusSelectedOption(options, keyChecked, id, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); - }, [ - options, - keyChecked, - id, - focusContext - ]); - return _react.createElement("div", (0, _tslib.__assign)({ - className: classNames.root - }, divProps, { - ref: mergedRootRefs - }), _react.createElement("div", (0, _tslib.__assign)({ - role: "radiogroup" - }, ariaLabelledBy && { - 'aria-labelledby': ariaLabelledBy - }, { - onFocus: onRadioFocus - }), label && _react.createElement((0, _label.Label), { - className: classNames.label, - required: required, - id: labelId, - disabled: disabled - }, label), _react.createElement("div", { - className: classNames.flexContainer - }, options.map(function(option) { - return _react.createElement((0, _index.ChoiceGroupOption), (0, _tslib.__assign)({ - itemKey: option.key - }, option, { - key: option.key, - onBlur: onBlur, - onFocus: onFocus, - onChange: onOptionChange, - focused: option.key === keyFocused, - checked: option.key === keyChecked, - disabled: option.disabled || disabled, - id: getOptionId(option, id), - labelId: option.labelId || "".concat(labelId, "-").concat(option.key), - name: name || id, - required: required - })); - })))); -}); -ChoiceGroupBase.displayName = COMPONENT_NAME; -function useDebugWarnings(props) {} - -},{"tslib":"9gizs","react":"jGrId","../../Label":"8FZUu","../../Utilities":"1NZCy","./ChoiceGroupOption/index":"fGZfZ","@fluentui/react-hooks":"2LHjM","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8FZUu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Label/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Label/index":"jklZV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jklZV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _labelBase = require("./Label.base"); -parcelHelpers.exportAll(_labelBase, exports); -var _labelTypes = require("./Label.types"); -parcelHelpers.exportAll(_labelTypes, exports); -var _label = require("./Label"); -parcelHelpers.exportAll(_label, exports); - -},{"./Label.base":false,"./Label.types":false,"./Label":"4UD9B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lN99G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelBase", ()=>LabelBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)({ + }, + splitButtonMenuButtonExpanded: { + backgroundColor: p.neutralLight, + color: p.black, + ":hover": { + backgroundColor: p.neutralQuaternaryAlt + } + }, + splitButtonMenuIcon: { + color: p.neutralPrimary + }, + splitButtonMenuIconDisabled: { + color: p.neutralTertiary + }, + label: { + fontWeight: "normal" + // theme.fontWeights.semibold, + }, + icon: { + color: p.themePrimary + }, + menuIcon: { + color: p.neutralSecondary + } + }; + return concatStyleSets(baseButtonStyles, baseSplitButtonStyles, commandButtonStyles, customStyles); + }); + var CommandBarButton = ( + /** @class */ + (function(_super) { + __extends(CommandBarButton2, _super); + function CommandBarButton2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CommandBarButton2.prototype.render = function() { + var _a2 = this.props, styles = _a2.styles, theme = _a2.theme; + return React__namespace.createElement(BaseButton, __assign$1({}, this.props, { variantClassName: "ms-Button--commandBar", styles: getStyles$k(theme, styles), onRenderDescription: nullRender })); + }; + CommandBarButton2 = __decorate([ + customizable("CommandBarButton", ["theme", "styles"]) + ], CommandBarButton2); + return CommandBarButton2; + })(React__namespace.Component) + ); + var CommandButton = ActionButton; + var getClassNames$k = classNamesFunction({ // Label is used a lot by other components. // It's likely to see expected cases which pass different className to the Label. // Therefore setting a larger cache size. cacheSize: 100 -}); -var LabelBase = /** @class */ function(_super) { - (0, _tslib.__extends)(LabelBase, _super); - function LabelBase() { + }); + var LabelBase = ( + /** @class */ + (function(_super) { + __extends(LabelBase2, _super); + function LabelBase2() { return _super !== null && _super.apply(this, arguments) || this; - } - LabelBase.prototype.render = function() { - var _a = this.props, _b = _a.as, RootType = _b === void 0 ? 'label' : _b, children = _a.children, className = _a.className, disabled = _a.disabled, styles = _a.styles, required = _a.required, theme = _a.theme; - var classNames = getClassNames(styles, { - className: className, - disabled: disabled, - required: required, - theme: theme + } + LabelBase2.prototype.render = function() { + var _a2 = this.props, _b2 = _a2.as, RootType = _b2 === void 0 ? "label" : _b2, children2 = _a2.children, className2 = _a2.className, disabled = _a2.disabled, styles = _a2.styles, required2 = _a2.required, theme = _a2.theme; + var classNames2 = getClassNames$k(styles, { + className: className2, + disabled, + required: required2, + theme }); - return _react.createElement(RootType, (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)), { - className: classNames.root - }), children); - }; - return LabelBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4UD9B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Label", ()=>Label); -var _utilities = require("../../Utilities"); -var _labelBase = require("./Label.base"); -var _labelStyles = require("./Label.styles"); -var Label = (0, _utilities.styled)((0, _labelBase.LabelBase), (0, _labelStyles.getStyles), undefined, { - scope: 'Label' -}); - -},{"../../Utilities":"1NZCy","./Label.base":"lN99G","./Label.styles":"bde6m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bde6m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var getStyles = function(props) { - var _a; - var theme = props.theme, className = props.className, disabled = props.disabled, required = props.required; + return React__namespace.createElement(RootType, __assign$1({}, getNativeProps(this.props, divProperties), { className: classNames2.root }), children2); + }; + return LabelBase2; + })(React__namespace.Component) + ); + var getStyles$j = function(props) { + var _a2; + var theme = props.theme, className2 = props.className, disabled = props.disabled, required2 = props.required; var semanticColors = theme.semanticColors; - // Tokens - var labelFontWeight = (0, _styling.FontWeights).semibold; + var labelFontWeight = FontWeights.semibold; var labelColor = semanticColors.bodyText; var labelDisabledColor = semanticColors.disabledBodyText; var labelRequiredStarColor = semanticColors.errorText; return { - root: [ - 'ms-Label', - theme.fonts.medium, - { - fontWeight: labelFontWeight, - color: labelColor, - boxSizing: 'border-box', - boxShadow: 'none', - margin: 0, - display: 'block', - padding: '5px 0', - wordWrap: 'break-word', - overflowWrap: 'break-word' - }, - disabled && { - color: labelDisabledColor, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) - }, - required && { - selectors: { - '::after': { - content: "' *'", - color: labelRequiredStarColor, - paddingRight: 12 - } - } - }, - className - ] + root: [ + "ms-Label", + theme.fonts.medium, + { + fontWeight: labelFontWeight, + color: labelColor, + boxSizing: "border-box", + boxShadow: "none", + margin: 0, + display: "block", + padding: "5px 0", + wordWrap: "break-word", + overflowWrap: "break-word" + }, + disabled && { + color: labelDisabledColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _a2) + }, + required2 && { + selectors: { + "::after": { + content: "' *'", + color: labelRequiredStarColor, + paddingRight: 12 + } + } + }, + className2 + ] }; -}; - -},{"tslib":"9gizs","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fGZfZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _choiceGroupOption = require("./ChoiceGroupOption"); -parcelHelpers.exportAll(_choiceGroupOption, exports); -var _choiceGroupOptionTypes = require("./ChoiceGroupOption.types"); -parcelHelpers.exportAll(_choiceGroupOptionTypes, exports); - -},{"./ChoiceGroupOption":"l21UM","./ChoiceGroupOption.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l21UM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroupOption", ()=>ChoiceGroupOption); -var _utilities = require("../../../Utilities"); -var _choiceGroupOptionBase = require("./ChoiceGroupOption.base"); -var _choiceGroupOptionStyles = require("./ChoiceGroupOption.styles"); -var ChoiceGroupOption = (0, _utilities.styled)((0, _choiceGroupOptionBase.ChoiceGroupOptionBase), (0, _choiceGroupOptionStyles.getStyles), undefined, { - scope: 'ChoiceGroupOption' -}); - -},{"../../../Utilities":"1NZCy","./ChoiceGroupOption.base":"bmRsn","./ChoiceGroupOption.styles":"fUMBU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bmRsn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ChoiceGroupOptionBase", ()=>ChoiceGroupOptionBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _image = require("../../../Image"); -var _icon = require("../../../Icon"); -var _utilities = require("../../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var LARGE_IMAGE_SIZE = 71; -var DEFAULT_PROPS = { + }; + var Label$2 = styled(LabelBase, getStyles$j, void 0, { + scope: "Label" + }); + var getClassNames$j = classNamesFunction(); + var LARGE_IMAGE_SIZE = 71; + var DEFAULT_PROPS$3 = { // This ensures default imageSize value doesn't mutate. Mutation can cause style re-calcuation. - imageSize: { - width: 32, - height: 32 - } -}; -var ChoiceGroupOptionBase = function(propsWithoutDefaults) { - // Mix the `key` prop back in since custom render functions may be expecting it - // (React uses `key` internally rather than passing it through to the component) - var props = (0, _utilities.getPropsWithDefaults)((0, _tslib.__assign)((0, _tslib.__assign)({}, DEFAULT_PROPS), { - key: propsWithoutDefaults.itemKey - }), propsWithoutDefaults); - var ariaLabel = props.ariaLabel, focused = props.focused, required = props.required, theme = props.theme, iconProps = props.iconProps, imageSrc = props.imageSrc, imageSize = props.imageSize, disabled = props.disabled, checked = props.checked, id = props.id, styles = props.styles, name = props.name, rest = (0, _tslib.__rest)(props, [ - "ariaLabel", - "focused", - "required", - "theme", - "iconProps", - "imageSrc", - "imageSize", - "disabled", - "checked", - "id", - "styles", - "name" - ]); - var classNames = getClassNames(styles, { - theme: theme, - hasIcon: !!iconProps, - hasImage: !!imageSrc, - checked: checked, - disabled: disabled, - imageIsLarge: !!imageSrc && (imageSize.width > LARGE_IMAGE_SIZE || imageSize.height > LARGE_IMAGE_SIZE), - imageSize: imageSize, - focused: focused + imageSize: { width: 32, height: 32 } + }; + var ChoiceGroupOptionBase = function(propsWithoutDefaults) { + var props = getPropsWithDefaults(__assign$1(__assign$1({}, DEFAULT_PROPS$3), { key: propsWithoutDefaults.itemKey }), propsWithoutDefaults); + var ariaLabel2 = props.ariaLabel, focused = props.focused, required2 = props.required, theme = props.theme, iconProps = props.iconProps, imageSrc = props.imageSrc, imageSize = props.imageSize, disabled = props.disabled, checked = props.checked, id2 = props.id, styles = props.styles, name = props.name, rest = __rest(props, ["ariaLabel", "focused", "required", "theme", "iconProps", "imageSrc", "imageSize", "disabled", "checked", "id", "styles", "name"]); + var classNames2 = getClassNames$j(styles, { + theme, + hasIcon: !!iconProps, + hasImage: !!imageSrc, + checked, + disabled, + imageIsLarge: !!imageSrc && (imageSize.width > LARGE_IMAGE_SIZE || imageSize.height > LARGE_IMAGE_SIZE), + imageSize, + focused }); - var _a = (0, _utilities.getNativeProps)(rest, (0, _utilities.inputProperties)), className = _a.className, nativeProps = (0, _tslib.__rest)(_a, [ - "className" - ]); + var _a2 = getNativeProps(rest, inputProperties), className2 = _a2.className, nativeProps = __rest(_a2, ["className"]); var defaultOnRenderLabel = function() { - return _react.createElement("span", { - id: props.labelId, - className: "ms-ChoiceFieldLabel" - }, props.text); + return React__namespace.createElement("span", { id: props.labelId, className: "ms-ChoiceFieldLabel" }, props.text); }; var defaultOnRenderField = function() { - var _a = props.imageAlt, imageAlt = _a === void 0 ? '' : _a, selectedImageSrc = props.selectedImageSrc; - var onRenderLabel = props.onRenderLabel ? (0, _utilities.composeRenderFunction)(props.onRenderLabel, defaultOnRenderLabel) : defaultOnRenderLabel; - var label = onRenderLabel((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - })); - return _react.createElement("label", { - htmlFor: id, - className: classNames.field - }, imageSrc && _react.createElement("div", { - className: classNames.innerField - }, _react.createElement("div", { - className: classNames.imageWrapper - }, _react.createElement((0, _image.Image), (0, _tslib.__assign)({ - src: imageSrc, - alt: imageAlt - }, imageSize))), _react.createElement("div", { - className: classNames.selectedImageWrapper - }, _react.createElement((0, _image.Image), (0, _tslib.__assign)({ - src: selectedImageSrc, - alt: imageAlt - }, imageSize)))), iconProps && _react.createElement("div", { - className: classNames.innerField - }, _react.createElement("div", { - className: classNames.iconWrapper - }, _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({}, iconProps)))), imageSrc || iconProps ? _react.createElement("div", { - className: classNames.labelWrapper - }, label) : label); - }; - var _b = props.onRenderField, onRenderField = _b === void 0 ? defaultOnRenderField : _b; + var _a3 = props.imageAlt, imageAlt = _a3 === void 0 ? "" : _a3, selectedImageSrc = props.selectedImageSrc; + var onRenderLabel = props.onRenderLabel ? composeRenderFunction(props.onRenderLabel, defaultOnRenderLabel) : defaultOnRenderLabel; + var label2 = onRenderLabel(__assign$1(__assign$1({}, props), { key: props.itemKey })); + return React__namespace.createElement( + "label", + { htmlFor: id2, className: classNames2.field }, + imageSrc && React__namespace.createElement( + "div", + { className: classNames2.innerField }, + React__namespace.createElement( + "div", + { className: classNames2.imageWrapper }, + React__namespace.createElement(Image$1, __assign$1({ src: imageSrc, alt: imageAlt }, imageSize)) + ), + React__namespace.createElement( + "div", + { className: classNames2.selectedImageWrapper }, + React__namespace.createElement(Image$1, __assign$1({ src: selectedImageSrc, alt: imageAlt }, imageSize)) + ) + ), + iconProps && React__namespace.createElement( + "div", + { className: classNames2.innerField }, + React__namespace.createElement( + "div", + { className: classNames2.iconWrapper }, + React__namespace.createElement(Icon, __assign$1({}, iconProps)) + ) + ), + imageSrc || iconProps ? React__namespace.createElement("div", { className: classNames2.labelWrapper }, label2) : label2 + ); + }; + var _b2 = props.onRenderField, onRenderField = _b2 === void 0 ? defaultOnRenderField : _b2; var onChange = function(evt) { - var _a; - (_a = props.onChange) === null || _a === void 0 || _a.call(props, evt, (0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - })); + var _a3; + (_a3 = props.onChange) === null || _a3 === void 0 ? void 0 : _a3.call(props, evt, __assign$1(__assign$1({}, props), { key: props.itemKey })); }; var onBlur = function(evt) { - var _a; - (_a = props.onBlur) === null || _a === void 0 || _a.call(props, evt); + var _a3; + (_a3 = props.onBlur) === null || _a3 === void 0 ? void 0 : _a3.call(props, evt); }; var onFocus = function(evt) { - var _a; - (_a = props.onFocus) === null || _a === void 0 || _a.call(props, evt, (0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - })); - }; - return _react.createElement("div", { - className: classNames.root - }, _react.createElement("div", { - className: classNames.choiceFieldWrapper - }, _react.createElement("input", (0, _tslib.__assign)({ - "aria-label": ariaLabel, - id: id, - className: (0, _utilities.css)(classNames.input, className), - type: "radio", - name: name, - disabled: disabled, - checked: checked, - required: required - }, nativeProps, { - onChange: onChange, - onFocus: onFocus, - onBlur: onBlur - })), onRenderField((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - key: props.itemKey - }), defaultOnRenderField))); -}; -ChoiceGroupOptionBase.displayName = 'ChoiceGroupOption'; - -},{"tslib":"9gizs","react":"jGrId","../../../Image":"73jnt","../../../Icon":"hiMUP","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73jnt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Image/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Image/index":"9Jyaq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Jyaq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _image = require("./Image"); -parcelHelpers.exportAll(_image, exports); -var _imageBase = require("./Image.base"); -parcelHelpers.exportAll(_imageBase, exports); -var _imageTypes = require("./Image.types"); -parcelHelpers.exportAll(_imageTypes, exports); - -},{"./Image":"5keBP","./Image.base":false,"./Image.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fUMBU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../../Styling"); -var _utilities = require("../../../Utilities"); -var GlobalClassNames = { - root: 'ms-ChoiceField', - choiceFieldWrapper: 'ms-ChoiceField-wrapper', - input: 'ms-ChoiceField-input', - field: 'ms-ChoiceField-field', - innerField: 'ms-ChoiceField-innerField', - imageWrapper: 'ms-ChoiceField-imageWrapper', - iconWrapper: 'ms-ChoiceField-iconWrapper', - labelWrapper: 'ms-ChoiceField-labelWrapper', - checked: 'is-checked' -}; -var labelWrapperLineHeight = 15; -var labelWrapperHeight = labelWrapperLineHeight * 2 + 2; // adding 2px height to ensure text doesn't get cutoff -var iconSize = 32; -var choiceFieldSize = 20; -var choiceFieldTransitionDuration = '200ms'; -var choiceFieldTransitionTiming = 'cubic-bezier(.4, 0, .23, 1)'; -var radioButtonSpacing = 3; -var radioButtonInnerSize = 5; -function getChoiceGroupFocusStyle(focusBorderColor, hasIconOrImage) { - var _a, _b; + var _a3; + (_a3 = props.onFocus) === null || _a3 === void 0 ? void 0 : _a3.call(props, evt, __assign$1(__assign$1({}, props), { key: props.itemKey })); + }; + return React__namespace.createElement( + "div", + { className: classNames2.root }, + React__namespace.createElement( + "div", + { className: classNames2.choiceFieldWrapper }, + React__namespace.createElement("input", __assign$1({ "aria-label": ariaLabel2, id: id2, className: css(classNames2.input, className2), type: "radio", name, disabled, checked, required: required2 }, nativeProps, { onChange, onFocus, onBlur })), + onRenderField(__assign$1(__assign$1({}, props), { key: props.itemKey }), defaultOnRenderField) + ) + ); + }; + ChoiceGroupOptionBase.displayName = "ChoiceGroupOption"; + var GlobalClassNames$b = { + root: "ms-ChoiceField", + choiceFieldWrapper: "ms-ChoiceField-wrapper", + input: "ms-ChoiceField-input", + field: "ms-ChoiceField-field", + innerField: "ms-ChoiceField-innerField", + imageWrapper: "ms-ChoiceField-imageWrapper", + iconWrapper: "ms-ChoiceField-iconWrapper", + labelWrapper: "ms-ChoiceField-labelWrapper", + checked: "is-checked" + }; + var labelWrapperLineHeight = 15; + var labelWrapperHeight = labelWrapperLineHeight * 2 + 2; + var iconSize = 32; + var choiceFieldSize = 20; + var choiceFieldTransitionDuration = "200ms"; + var choiceFieldTransitionTiming = "cubic-bezier(.4, 0, .23, 1)"; + var radioButtonSpacing = 3; + var radioButtonInnerSize = 5; + function getChoiceGroupFocusStyle(focusBorderColor, hasIconOrImage) { + var _a2, _b2; return [ - 'is-inFocus', - { - selectors: (_a = {}, _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &")] = { - position: 'relative', - outline: 'transparent', - selectors: { - '::-moz-focus-inner': { - border: 0 - }, - ':after': { - content: '""', - top: -2, - right: -2, - bottom: -2, - left: -2, - pointerEvents: 'none', - border: "1px solid ".concat(focusBorderColor), - position: 'absolute', - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - borderColor: 'WindowText', - borderWidth: hasIconOrImage ? 1 : 2 - }, _b) - } - } - }, _a) - } + "is-inFocus", + { + selectors: (_a2 = {}, _a2[".".concat(IsFocusVisibleClassName, " &, :host(.").concat(IsFocusVisibleClassName, ") &")] = { + position: "relative", + outline: "transparent", + selectors: { + "::-moz-focus-inner": { + border: 0 + }, + ":after": { + content: '""', + top: -2, + right: -2, + bottom: -2, + left: -2, + pointerEvents: "none", + border: "1px solid ".concat(focusBorderColor), + position: "absolute", + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "WindowText", + borderWidth: hasIconOrImage ? 1 : 2 + }, _b2) + } + } + }, _a2) + } ]; -} -function getImageWrapperStyle(isSelectedImageWrapper, className, checked) { + } + function getImageWrapperStyle(isSelectedImageWrapper, className2, checked) { return [ - className, + className2, + { + paddingBottom: 2, + transitionProperty: "opacity", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: "ease", + selectors: { + ".ms-Image": { + display: "inline-block", + borderStyle: "none" + } + } + }, + (checked ? !isSelectedImageWrapper : isSelectedImageWrapper) && [ + "is-hidden", { - paddingBottom: 2, - transitionProperty: 'opacity', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: 'ease', - selectors: { - '.ms-Image': { - display: 'inline-block', - borderStyle: 'none' - } - } - }, - (checked ? !isSelectedImageWrapper : isSelectedImageWrapper) && [ - 'is-hidden', - { - position: 'absolute', - left: 0, - top: 0, - width: '100%', - height: '100%', - overflow: 'hidden', - opacity: 0 - } - ] + position: "absolute", + left: 0, + top: 0, + width: "100%", + height: "100%", + overflow: "hidden", + opacity: 0 + } + ] ]; -} -var getStyles = function(props) { - var _a, _b, _c, _d, _e; + } + var getStyles$i = function(props) { + var _a2, _b2, _c2, _d2, _e2; var theme = props.theme, hasIcon = props.hasIcon, hasImage = props.hasImage, checked = props.checked, disabled = props.disabled, imageIsLarge = props.imageIsLarge, focused = props.focused, imageSize = props.imageSize; var palette = theme.palette, semanticColors = theme.semanticColors, fonts = theme.fonts; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - // Tokens - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.smallInputBorder + var classNames2 = getGlobalClassNames(GlobalClassNames$b, theme); var circleBorderColor = palette.neutralPrimary; var circleHoveredBorderColor = semanticColors.inputBorderHovered; var circleCheckedBorderColor = semanticColors.inputBackgroundChecked; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered var circleCheckedHoveredBorderColor = palette.themeDark; var circleDisabledBorderColor = semanticColors.disabledBodySubtext; var circleBackgroundColor = semanticColors.bodyBackground; var dotUncheckedHoveredColor = palette.neutralSecondary; var dotCheckedColor = semanticColors.inputBackgroundChecked; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered var dotCheckedHoveredColor = palette.themeDark; var dotDisabledColor = semanticColors.disabledBodySubtext; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.bodyTextChecked var labelHoverFocusColor = palette.neutralDark; var focusBorderColor = semanticColors.focusBorder; var iconOrImageChoiceBorderUncheckedHoveredColor = semanticColors.inputBorderHovered; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBackgroundCheckedHovered var iconOrImageChoiceBorderCheckedColor = semanticColors.inputBackgroundChecked; var iconOrImageChoiceBorderCheckedHoveredColor = palette.themeDark; var iconOrImageChoiceBackgroundColor = palette.neutralLighter; var fieldHoverOrFocusProperties = { - selectors: { - '.ms-ChoiceFieldLabel': { - color: labelHoverFocusColor - }, - ':before': { - borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor - }, - ':after': [ - !hasIcon && !hasImage && !checked && { - content: '""', - transitionProperty: 'background-color', - left: 5, - top: 5, - width: 10, - height: 10, - backgroundColor: dotUncheckedHoveredColor - }, - checked && { - borderColor: dotCheckedHoveredColor, - background: dotCheckedHoveredColor + selectors: { + ".ms-ChoiceFieldLabel": { + color: labelHoverFocusColor + }, + ":before": { + borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor + }, + ":after": [ + !hasIcon && !hasImage && !checked && { + content: '""', + transitionProperty: "background-color", + left: 5, + top: 5, + width: 10, + height: 10, + backgroundColor: dotUncheckedHoveredColor + }, + checked && { + borderColor: dotCheckedHoveredColor, + background: dotCheckedHoveredColor + } + ] + } + }; + var enabledFieldWithImageHoverOrFocusProperties = { + borderColor: checked ? iconOrImageChoiceBorderCheckedHoveredColor : iconOrImageChoiceBorderUncheckedHoveredColor, + selectors: { + ":before": { + opacity: 1, + borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor + } + } + }; + var circleAreaProperties = [ + { + content: '""', + display: "inline-block", + backgroundColor: circleBackgroundColor, + borderWidth: 1, + borderStyle: "solid", + borderColor: circleBorderColor, + width: choiceFieldSize, + height: choiceFieldSize, + fontWeight: "normal", + position: "absolute", + top: 0, + left: 0, + boxSizing: "border-box", + transitionProperty: "border-color", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: choiceFieldTransitionTiming, + borderRadius: "50%" + }, + disabled && { + borderColor: circleDisabledBorderColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ borderColor: "GrayText", background: "Window" }, getHighContrastNoAdjustStyle()), _a2) + }, + checked && { + borderColor: disabled ? circleDisabledBorderColor : circleCheckedBorderColor, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "Highlight", + background: "Window", + forcedColorAdjust: "none" + }, _b2) + }, + (hasIcon || hasImage) && { + top: radioButtonSpacing, + right: radioButtonSpacing, + left: "auto", + // To reset the value of 'left' to its default value, so that 'right' works + opacity: checked ? 1 : 0 + } + ]; + var dotAreaProperties = [ + { + content: '""', + width: 0, + height: 0, + borderRadius: "50%", + position: "absolute", + left: choiceFieldSize / 2, + right: 0, + transitionProperty: "border-width", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: choiceFieldTransitionTiming, + boxSizing: "border-box" + }, + checked && { + borderWidth: 5, + borderStyle: "solid", + borderColor: disabled ? dotDisabledColor : dotCheckedColor, + background: dotCheckedColor, + left: 5, + top: 5, + width: 10, + height: 10, + selectors: (_c2 = {}, _c2[HighContrastSelector] = { + borderColor: "Highlight", + forcedColorAdjust: "none" + }, _c2) + }, + checked && (hasIcon || hasImage) && { + top: radioButtonSpacing + radioButtonInnerSize, + right: radioButtonSpacing + radioButtonInnerSize, + left: "auto" + // To reset the value of 'left' to its default value, so that 'right' works + } + ]; + return { + root: [ + classNames2.root, + theme.fonts.medium, + { + display: "flex", + alignItems: "center", + boxSizing: "border-box", + color: semanticColors.bodyText, + minHeight: 26, + border: "none", + position: "relative", + marginTop: 8, + selectors: { + ".ms-ChoiceFieldLabel": { + display: "inline-block" + } + } + }, + !hasIcon && !hasImage && { + selectors: { + ".ms-ChoiceFieldLabel": { + paddingLeft: "26px" + } + } + }, + hasImage && "ms-ChoiceField--image", + hasIcon && "ms-ChoiceField--icon", + (hasIcon || hasImage) && { + display: "inline-flex", + fontSize: 0, + margin: "0 4px 4px 0", + paddingLeft: 0, + backgroundColor: iconOrImageChoiceBackgroundColor, + height: "100%" + } + ], + choiceFieldWrapper: [ + classNames2.choiceFieldWrapper, + focused && getChoiceGroupFocusStyle(focusBorderColor, hasIcon || hasImage) + ], + // The hidden input + input: [ + classNames2.input, + { + position: "absolute", + opacity: 0, + top: 0, + right: 0, + width: "100%", + height: "100%", + margin: 0 + }, + disabled && "is-disabled" + ], + field: [ + classNames2.field, + checked && classNames2.checked, + { + display: "inline-block", + cursor: "pointer", + marginTop: 0, + position: "relative", + verticalAlign: "top", + userSelect: "none", + minHeight: 20, + selectors: { + ":hover": !disabled && fieldHoverOrFocusProperties, + ":focus": !disabled && fieldHoverOrFocusProperties, + // The circle + ":before": circleAreaProperties, + // The dot + ":after": dotAreaProperties + } + }, + hasIcon && "ms-ChoiceField--icon", + hasImage && "ms-ChoiceField-field--image", + (hasIcon || hasImage) && { + boxSizing: "content-box", + cursor: "pointer", + paddingTop: 22, + margin: 0, + textAlign: "center", + transitionProperty: "all", + transitionDuration: choiceFieldTransitionDuration, + transitionTimingFunction: "ease", + border: "1px solid transparent", + justifyContent: "center", + alignItems: "center", + display: "flex", + flexDirection: "column" + }, + checked && { + borderColor: iconOrImageChoiceBorderCheckedColor + }, + (hasIcon || hasImage) && !disabled && { + selectors: { + ":hover": enabledFieldWithImageHoverOrFocusProperties, + ":focus": enabledFieldWithImageHoverOrFocusProperties + } + }, + disabled && { + cursor: "default", + selectors: { + ".ms-ChoiceFieldLabel": { + color: semanticColors.disabledBodyText, + selectors: (_d2 = {}, _d2[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _d2) + } + } + }, + checked && disabled && { + borderColor: iconOrImageChoiceBackgroundColor + } + ], + innerField: [ + classNames2.innerField, + hasImage && { + // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. + height: imageSize.height, + width: imageSize.width + }, + (hasIcon || hasImage) && { + position: "relative", + display: "inline-block", + paddingLeft: 30, + paddingRight: 30 + }, + (hasIcon || hasImage) && imageIsLarge && { + paddingLeft: 24, + paddingRight: 24 + }, + (hasIcon || hasImage) && disabled && { + opacity: 0.25, + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + color: "GrayText", + opacity: 1 + }, _e2) + } + ], + imageWrapper: getImageWrapperStyle(false, classNames2.imageWrapper, checked), + selectedImageWrapper: getImageWrapperStyle(true, classNames2.imageWrapper, checked), + iconWrapper: [ + classNames2.iconWrapper, + { + fontSize: iconSize, + lineHeight: iconSize, + height: iconSize + } + ], + labelWrapper: [ + classNames2.labelWrapper, + fonts.medium, + (hasIcon || hasImage) && { + display: "block", + position: "relative", + margin: "4px 8px 2px 8px", + height: labelWrapperHeight, + lineHeight: labelWrapperLineHeight, + // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. + maxWidth: imageSize.width * 2, + overflow: "hidden", + whiteSpace: "pre-wrap" + } + ] + }; + }; + var ChoiceGroupOption = styled(ChoiceGroupOptionBase, getStyles$i, void 0, { scope: "ChoiceGroupOption" }); + var getClassNames$i = classNamesFunction(); + var getOptionId = function(option, id2) { + return "".concat(id2, "-").concat(option.key); + }; + var findOption = function(options2, key2) { + return key2 === void 0 ? void 0 : find$3(options2, function(value2) { + return value2.key === key2; + }); + }; + var focusSelectedOption = function(options2, keyChecked, id2, focusProviders, doc) { + var optionToFocus = findOption(options2, keyChecked) || options2.filter(function(option) { + return !option.disabled; + })[0]; + var elementToFocus = optionToFocus && (doc === null || doc === void 0 ? void 0 : doc.getElementById(getOptionId(optionToFocus, id2))); + if (elementToFocus) { + elementToFocus.focus(); + setFocusVisibility(true, elementToFocus, focusProviders); + } + }; + var focusFromFocusTrapZone = function(evt) { + return evt.relatedTarget instanceof HTMLElement && evt.relatedTarget.dataset.isFocusTrapZoneBumper === "true"; + }; + var useComponentRef$5 = function(options2, keyChecked, id2, componentRef, focusProviders) { + var doc = useDocumentEx(); + React__namespace.useImperativeHandle(componentRef, function() { + return { + get checkedOption() { + return findOption(options2, keyChecked); + }, + focus: function() { + focusSelectedOption(options2, keyChecked, id2, focusProviders, doc); + } + }; + }, [options2, keyChecked, id2, focusProviders, doc]); + }; + var COMPONENT_NAME$5 = "ChoiceGroup"; + var ChoiceGroupBase = React__namespace.forwardRef(function(props, forwardedRef) { + var className2 = props.className, theme = props.theme, styles = props.styles, _a2 = props.options, options2 = _a2 === void 0 ? [] : _a2, label2 = props.label, required2 = props.required, disabled = props.disabled, name = props.name, defaultSelectedKey = props.defaultSelectedKey, componentRef = props.componentRef, onChange = props.onChange; + var id2 = useId("ChoiceGroup"); + var labelId = useId("ChoiceGroupLabel"); + var divProps = getNativeProps(props, divProperties, [ + "onChange", + "className", + "required" + ]); + var classNames2 = getClassNames$i(styles, { + theme, + className: className2, + optionsContainIconOrImage: options2.some(function(option) { + return !!(option.iconProps || option.imageSrc); + }) + }); + var ariaLabelledBy = props.ariaLabelledBy || (label2 ? labelId : props["aria-labelledby"]); + var _b2 = useControllableValue(props.selectedKey, defaultSelectedKey), keyChecked = _b2[0], setKeyChecked = _b2[1]; + var _c2 = React__namespace.useState(), keyFocused = _c2[0], setKeyFocused = _c2[1]; + var rootRef = React__namespace.useRef(null); + var mergedRootRefs = useMergedRefs(rootRef, forwardedRef); + var focusContext = React__namespace.useContext(FocusRectsContext); + useComponentRef$5(options2, keyChecked, id2, componentRef, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); + useFocusRects(rootRef); + var onFocus = React__namespace.useCallback(function(ev, option) { + var _a22; + if (option) { + setKeyFocused(option.itemKey); + (_a22 = option.onFocus) === null || _a22 === void 0 ? void 0 : _a22.call(option, ev); + } + }, []); + var onBlur = React__namespace.useCallback(function(ev, option) { + var _a22; + setKeyFocused(void 0); + (_a22 = option === null || option === void 0 ? void 0 : option.onBlur) === null || _a22 === void 0 ? void 0 : _a22.call(option, ev); + }, []); + var onOptionChange = React__namespace.useCallback(function(evt, option) { + var _a22; + if (!option) { + return; + } + setKeyChecked(option.itemKey); + (_a22 = option.onChange) === null || _a22 === void 0 ? void 0 : _a22.call(option, evt); + onChange === null || onChange === void 0 ? void 0 : onChange(evt, findOption(options2, option.itemKey)); + }, [onChange, options2, setKeyChecked]); + var onRadioFocus = React__namespace.useCallback(function(evt) { + if (focusFromFocusTrapZone(evt)) { + focusSelectedOption(options2, keyChecked, id2, focusContext === null || focusContext === void 0 ? void 0 : focusContext.registeredProviders); + } + }, [options2, keyChecked, id2, focusContext]); + return React__namespace.createElement( + "div", + __assign$1({ className: classNames2.root }, divProps, { ref: mergedRootRefs }), + React__namespace.createElement( + "div", + __assign$1({ role: "radiogroup" }, ariaLabelledBy && { "aria-labelledby": ariaLabelledBy }, { onFocus: onRadioFocus }), + label2 && React__namespace.createElement(Label$2, { className: classNames2.label, required: required2, id: labelId, disabled }, label2), + React__namespace.createElement("div", { className: classNames2.flexContainer }, options2.map(function(option) { + return React__namespace.createElement(ChoiceGroupOption, __assign$1({ itemKey: option.key }, option, { key: option.key, onBlur, onFocus, onChange: onOptionChange, focused: option.key === keyFocused, checked: option.key === keyChecked, disabled: option.disabled || disabled, id: getOptionId(option, id2), labelId: option.labelId || "".concat(labelId, "-").concat(option.key), name: name || id2, required: required2 })); + })) + ) + ); + }); + ChoiceGroupBase.displayName = COMPONENT_NAME$5; + var GlobalClassNames$a = { + root: "ms-ChoiceFieldGroup", + flexContainer: "ms-ChoiceFieldGroup-flexContainer" + }; + var getStyles$h = function(props) { + var className2 = props.className, optionsContainIconOrImage = props.optionsContainIconOrImage, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$a, theme); + return { + root: [ + className2, + classNames2.root, + theme.fonts.medium, + { + display: "block" + } + ], + flexContainer: [ + classNames2.flexContainer, + optionsContainIconOrImage && { + display: "flex", + flexDirection: "row", + flexWrap: "wrap" + } + ] + }; + }; + var ChoiceGroup = styled(ChoiceGroupBase, getStyles$h, void 0, { scope: "ChoiceGroup" }); + var SELECTION_FORWARD = "forward"; + var SELECTION_BACKWARD = "backward"; + var Autofill = ( + /** @class */ + (function(_super) { + __extends(Autofill2, _super); + function Autofill2(props) { + var _this = _super.call(this, props) || this; + _this._inputElement = React__namespace.createRef(); + _this._autoFillEnabled = true; + _this._onCompositionStart = function(ev) { + _this.setState({ isComposing: true }); + _this._autoFillEnabled = false; + }; + _this._onCompositionUpdate = function() { + if (isIE11()) { + _this._updateValue(_this._getCurrentInputValue(), true); + } + }; + _this._onCompositionEnd = function(ev) { + var inputValue = _this._getCurrentInputValue(); + _this._tryEnableAutofill(inputValue, _this.value, false, true); + _this.setState({ isComposing: false }); + _this._async.setTimeout(function() { + _this._updateValue(_this._getCurrentInputValue(), false); + }, 0); + }; + _this._onClick = function() { + if (_this.value && _this.value !== "" && _this._autoFillEnabled) { + _this._autoFillEnabled = false; + } + }; + _this._onKeyDown = function(ev) { + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + } + if (!ev.nativeEvent.isComposing) { + switch (ev.which) { + case KeyCodes.backspace: + _this._autoFillEnabled = false; + break; + case KeyCodes.left: + case KeyCodes.right: + if (_this._autoFillEnabled) { + _this.setState(function(prev) { + return { + inputValue: _this.props.suggestedDisplayValue || prev.inputValue + }; + }); + _this._autoFillEnabled = false; } - ] + break; + default: + if (!_this._autoFillEnabled) { + if (_this.props.enableAutofillOnKeyPress.indexOf(ev.which) !== -1) { + _this._autoFillEnabled = true; + } + } + break; + } + } + }; + _this._onInputChanged = function(ev) { + var value2 = _this._getCurrentInputValue(ev); + if (!_this.state.isComposing) { + _this._tryEnableAutofill(value2, _this.value, ev.nativeEvent.isComposing); + } + if (!(isIE11() && _this.state.isComposing)) { + var nativeEventComposing = ev.nativeEvent.isComposing; + var isComposing = nativeEventComposing === void 0 ? _this.state.isComposing : nativeEventComposing; + _this._updateValue(value2, isComposing); + } + }; + _this._onChanged = function() { + return; + }; + _this._updateValue = function(newValue, composing) { + if (!newValue && newValue === _this.value) { + return; + } + var _a2 = _this.props, onInputChange = _a2.onInputChange, onInputValueChange = _a2.onInputValueChange; + if (onInputChange) { + newValue = (onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(newValue, composing)) || ""; + } + _this.setState({ inputValue: newValue }, function() { + return onInputValueChange === null || onInputValueChange === void 0 ? void 0 : onInputValueChange(newValue, composing); + }); + }; + initializeComponentRef(_this); + _this._async = new Async(_this); + _this.state = { + inputValue: props.defaultVisibleValue || "", + isComposing: false + }; + return _this; + } + Autofill2.getDerivedStateFromProps = function(props, state) { + if (props.updateValueInWillReceiveProps) { + var updatedInputValue = props.updateValueInWillReceiveProps(); + if (updatedInputValue !== null && updatedInputValue !== state.inputValue && !state.isComposing) { + return __assign$1(__assign$1({}, state), { inputValue: updatedInputValue }); + } + } + return null; + }; + Object.defineProperty(Autofill2.prototype, "cursorLocation", { + get: function() { + if (this._inputElement.current) { + var inputElement = this._inputElement.current; + if (inputElement.selectionDirection !== SELECTION_FORWARD) { + return inputElement.selectionEnd; + } else { + return inputElement.selectionStart; + } + } else { + return -1; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "isValueSelected", { + get: function() { + return Boolean(this.inputElement && this.inputElement.selectionStart !== this.inputElement.selectionEnd); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "value", { + get: function() { + return this._getControlledValue() || this.state.inputValue || ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "selectionStart", { + get: function() { + return this._inputElement.current ? this._inputElement.current.selectionStart : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "selectionEnd", { + get: function() { + return this._inputElement.current ? this._inputElement.current.selectionEnd : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Autofill2.prototype, "inputElement", { + get: function() { + return this._inputElement.current; + }, + enumerable: false, + configurable: true + }); + Autofill2.prototype.componentDidUpdate = function(_, _1, cursor2) { + var _a2; + var _b2 = this.props, suggestedDisplayValue = _b2.suggestedDisplayValue, shouldSelectFullInputValueInComponentDidUpdate = _b2.shouldSelectFullInputValueInComponentDidUpdate, preventValueSelection = _b2.preventValueSelection; + var differenceIndex = 0; + if (preventValueSelection) { + return; + } + var document2 = ((_a2 = this.context) === null || _a2 === void 0 ? void 0 : _a2.window.document) || getDocument(this._inputElement.current); + var isFocused = this._inputElement.current && this._inputElement.current === (document2 === null || document2 === void 0 ? void 0 : document2.activeElement); + if (isFocused && this._autoFillEnabled && this.value && suggestedDisplayValue && _doesTextStartWith(suggestedDisplayValue, this.value)) { + var shouldSelectFullRange = false; + if (shouldSelectFullInputValueInComponentDidUpdate) { + shouldSelectFullRange = shouldSelectFullInputValueInComponentDidUpdate(); + } + if (shouldSelectFullRange) { + this._inputElement.current.setSelectionRange(0, suggestedDisplayValue.length, SELECTION_BACKWARD); + } else { + while (differenceIndex < this.value.length && this.value[differenceIndex].toLocaleLowerCase() === suggestedDisplayValue[differenceIndex].toLocaleLowerCase()) { + differenceIndex++; + } + if (differenceIndex > 0) { + this._inputElement.current.setSelectionRange(differenceIndex, suggestedDisplayValue.length, SELECTION_BACKWARD); + } + } + } else if (this._inputElement.current) { + if (cursor2 !== null && !this._autoFillEnabled && !this.state.isComposing) { + this._inputElement.current.setSelectionRange(cursor2.start, cursor2.end, cursor2.dir); + } + } + }; + Autofill2.prototype.componentWillUnmount = function() { + this._async.dispose(); + }; + Autofill2.prototype.render = function() { + var nativeProps = getNativeProps(this.props, inputProperties); + var style2 = __assign$1(__assign$1({}, this.props.style), { fontFamily: "inherit" }); + return React__namespace.createElement("input", __assign$1({ autoCapitalize: "off", autoComplete: "off", "aria-autocomplete": "both" }, nativeProps, { + style: style2, + ref: this._inputElement, + value: this._getDisplayValue(), + onCompositionStart: this._onCompositionStart, + onCompositionUpdate: this._onCompositionUpdate, + onCompositionEnd: this._onCompositionEnd, + // TODO (Fabric 8?) - switch to calling only onChange. See notes in TextField._onInputChange. + onChange: this._onChanged, + onInput: this._onInputChanged, + onKeyDown: this._onKeyDown, + onClick: this.props.onClick ? this.props.onClick : this._onClick, + "data-lpignore": true + })); + }; + Autofill2.prototype.focus = function() { + this._inputElement.current && this._inputElement.current.focus(); + }; + Autofill2.prototype.clear = function() { + this._autoFillEnabled = true; + this._updateValue("", false); + this._inputElement.current && this._inputElement.current.setSelectionRange(0, 0); + }; + Autofill2.prototype.getSnapshotBeforeUpdate = function() { + var _a2, _b2; + var inel = this._inputElement.current; + if (inel && inel.selectionStart !== this.value.length) { + return { + start: (_a2 = inel.selectionStart) !== null && _a2 !== void 0 ? _a2 : inel.value.length, + end: (_b2 = inel.selectionEnd) !== null && _b2 !== void 0 ? _b2 : inel.value.length, + dir: inel.selectionDirection || "backward" + }; + } + return null; + }; + Autofill2.prototype._getCurrentInputValue = function(ev) { + if (ev && ev.target && ev.target.value) { + return ev.target.value; + } else if (this.inputElement && this.inputElement.value) { + return this.inputElement.value; + } else { + return ""; + } + }; + Autofill2.prototype._tryEnableAutofill = function(newValue, oldValue, isComposing, isComposed) { + if (!isComposing && newValue && this._inputElement.current && this._inputElement.current.selectionStart === newValue.length && !this._autoFillEnabled && (newValue.length > oldValue.length || isComposed)) { + this._autoFillEnabled = true; + } + }; + Autofill2.prototype._getDisplayValue = function() { + if (this._autoFillEnabled) { + return _getDisplayValue(this.value, this.props.suggestedDisplayValue); + } + return this.value; + }; + Autofill2.prototype._getControlledValue = function() { + var value2 = this.props.value; + if (value2 === void 0 || typeof value2 === "string") { + return value2; + } + console.warn("props.value of Autofill should be a string, but it is ".concat(value2, " with type of ").concat(typeof value2)); + return value2.toString(); + }; + Autofill2.defaultProps = { + enableAutofillOnKeyPress: [KeyCodes.down, KeyCodes.up] + }; + Autofill2.contextType = WindowContext; + return Autofill2; + })(React__namespace.Component) + ); + function _getDisplayValue(inputValue, suggestedDisplayValue) { + var displayValue2 = inputValue; + if (suggestedDisplayValue && inputValue && _doesTextStartWith(suggestedDisplayValue, displayValue2)) { + displayValue2 = suggestedDisplayValue; + } + return displayValue2; + } + function _doesTextStartWith(text2, startWith) { + if (!text2 || !startWith) { + return false; + } + return text2.toLocaleLowerCase().indexOf(startWith.toLocaleLowerCase()) === 0; + } + var getClassNames$h = classNamesFunction(); + var CheckboxBase = React__namespace.forwardRef(function(props, forwardedRef) { + var disabled = props.disabled, required2 = props.required, inputProps = props.inputProps, name = props.name, ariaLabel2 = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, ariaPositionInSet = props.ariaPositionInSet, ariaSetSize = props.ariaSetSize, title = props.title, checkmarkIconProps = props.checkmarkIconProps, styles = props.styles, theme = props.theme, className2 = props.className, _a2 = props.boxSide, boxSide = _a2 === void 0 ? "start" : _a2; + var id2 = useId("checkbox-", props.id); + var rootRef = React__namespace.useRef(null); + var mergedRootRefs = useMergedRefs(rootRef, forwardedRef); + var inputRef = React__namespace.useRef(null); + var _b2 = useControllableValue(props.checked, props.defaultChecked, props.onChange), isChecked = _b2[0], setIsChecked = _b2[1]; + var _c2 = useControllableValue(props.indeterminate, props.defaultIndeterminate), isIndeterminate = _c2[0], setIsIndeterminate = _c2[1]; + useFocusRects(rootRef); + var classNames2 = getClassNames$h(styles, { + theme, + className: className2, + disabled, + indeterminate: isIndeterminate, + checked: isChecked, + reversed: boxSide !== "start", + isUsingCustomLabelRender: !!props.onRenderLabel + }); + var onChange = React__namespace.useCallback(function(event2) { + if (isIndeterminate) { + setIsChecked(!!isChecked, event2); + setIsIndeterminate(false); + } else { + setIsChecked(!isChecked, event2); + } + }, [setIsChecked, setIsIndeterminate, isIndeterminate, isChecked]); + var defaultLabelRenderer = React__namespace.useCallback(function(checkboxProps) { + if (!checkboxProps) { + return null; + } + return checkboxProps.label ? React__namespace.createElement("span", { className: classNames2.text, title: checkboxProps.title }, checkboxProps.label) : null; + }, [classNames2.text]); + var setNativeIndeterminate = React__namespace.useCallback(function(indeterminate) { + if (!inputRef.current) { + return; + } + var value2 = !!indeterminate; + inputRef.current.indeterminate = value2; + setIsIndeterminate(value2); + }, [setIsIndeterminate]); + useComponentRef$4(props, isChecked, isIndeterminate, setNativeIndeterminate, inputRef); + React__namespace.useEffect(function() { + return setNativeIndeterminate(isIndeterminate); + }, [setNativeIndeterminate, isIndeterminate]); + var onRenderLabel = props.onRenderLabel || defaultLabelRenderer; + var ariaChecked = isIndeterminate ? "mixed" : void 0; + var mergedInputProps = __assign$1(__assign$1({ className: classNames2.input, type: "checkbox" }, inputProps), { checked: !!isChecked, disabled, required: required2, name, id: id2, title, onChange, "aria-disabled": disabled, "aria-label": ariaLabel2, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-posinset": ariaPositionInSet, "aria-setsize": ariaSetSize, "aria-checked": ariaChecked }); + return React__namespace.createElement( + "div", + { className: classNames2.root, title, ref: mergedRootRefs }, + React__namespace.createElement("input", __assign$1({}, mergedInputProps, { ref: inputRef, title, "data-ktp-execute-target": true })), + React__namespace.createElement( + "label", + { className: classNames2.label, htmlFor: id2 }, + React__namespace.createElement( + "div", + { className: classNames2.checkbox, "data-ktp-target": true }, + React__namespace.createElement(Icon, __assign$1({ iconName: "CheckMark" }, checkmarkIconProps, { className: classNames2.checkmark })) + ), + onRenderLabel(props, defaultLabelRenderer) + ) + ); + }); + CheckboxBase.displayName = "CheckboxBase"; + function useComponentRef$4(props, isChecked, isIndeterminate, setIndeterminate, checkBoxRef) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + get checked() { + return !!isChecked; + }, + get indeterminate() { + return !!isIndeterminate; + }, + set indeterminate(indeterminate) { + setIndeterminate(indeterminate); + }, + focus: function() { + if (checkBoxRef.current) { + checkBoxRef.current.focus(); + } + } + }; + }, [checkBoxRef, isChecked, isIndeterminate, setIndeterminate]); + } + var GlobalClassNames$9 = { + root: "ms-Checkbox", + label: "ms-Checkbox-label", + checkbox: "ms-Checkbox-checkbox", + checkmark: "ms-Checkbox-checkmark", + text: "ms-Checkbox-text" + }; + var MS_CHECKBOX_LABEL_SIZE = "20px"; + var MS_CHECKBOX_TRANSITION_DURATION = "200ms"; + var MS_CHECKBOX_TRANSITION_TIMING = "cubic-bezier(.4, 0, .23, 1)"; + var getStyles$g = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; + var className2 = props.className, theme = props.theme, reversed = props.reversed, checked = props.checked, disabled = props.disabled, isUsingCustomLabelRender = props.isUsingCustomLabelRender, indeterminate = props.indeterminate; + var semanticColors = theme.semanticColors, effects = theme.effects, palette = theme.palette, fonts = theme.fonts; + var classNames2 = getGlobalClassNames(GlobalClassNames$9, theme); + var checkmarkFontColor = semanticColors.inputForegroundChecked; + var checkmarkFontColorHovered = palette.neutralSecondary; + var checkboxBorderColor = palette.neutralPrimary; + var checkboxBorderIndeterminateColor = semanticColors.inputBackgroundChecked; + var checkboxBorderColorChecked = semanticColors.inputBackgroundChecked; + var checkboxBorderColorDisabled = semanticColors.disabledBodySubtext; + var checkboxBorderHoveredColor = semanticColors.inputBorderHovered; + var checkboxBorderIndeterminateHoveredColor = semanticColors.inputBackgroundCheckedHovered; + var checkboxBackgroundChecked = semanticColors.inputBackgroundChecked; + var checkboxBackgroundCheckedHovered = semanticColors.inputBackgroundCheckedHovered; + var checkboxBorderColorCheckedHovered = semanticColors.inputBackgroundCheckedHovered; + var checkboxHoveredTextColor = semanticColors.inputTextHovered; + var checkboxBackgroundDisabledChecked = semanticColors.disabledBodySubtext; + var checkboxTextColor = semanticColors.bodyText; + var checkboxTextColorDisabled = semanticColors.disabledText; + var indeterminateDotStyles = [ + (_a2 = { + content: '""', + borderRadius: effects.roundedCorner2, + position: "absolute", + width: 10, + height: 10, + top: 4, + left: 4, + boxSizing: "border-box", + borderWidth: 5, + borderStyle: "solid", + borderColor: disabled ? checkboxBorderColorDisabled : checkboxBorderIndeterminateColor, + transitionProperty: "border-width, border, border-color", + transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, + transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING + }, _a2[HighContrastSelector] = { + borderColor: "WindowText" + }, _a2) + ]; + return { + root: [ + classNames2.root, + { + position: "relative", + display: "flex" + }, + reversed && "reversed", + checked && "is-checked", + !disabled && "is-enabled", + disabled && "is-disabled", + !disabled && [ + !checked && (_b2 = {}, _b2[":hover .".concat(classNames2.checkbox)] = (_c2 = { + borderColor: checkboxBorderHoveredColor + }, _c2[HighContrastSelector] = { + borderColor: "Highlight" + }, _c2), _b2[":focus .".concat(classNames2.checkbox)] = { borderColor: checkboxBorderHoveredColor }, _b2[":hover .".concat(classNames2.checkmark)] = (_d2 = { + color: checkmarkFontColorHovered, + opacity: "1" + }, _d2[HighContrastSelector] = { + color: "Highlight" + }, _d2), _b2), + checked && !indeterminate && (_e2 = {}, _e2[":hover .".concat(classNames2.checkbox)] = { + background: checkboxBackgroundCheckedHovered, + borderColor: checkboxBorderColorCheckedHovered + }, _e2[":focus .".concat(classNames2.checkbox)] = { + background: checkboxBackgroundCheckedHovered, + borderColor: checkboxBorderColorCheckedHovered + }, _e2[HighContrastSelector] = (_f = {}, _f[":hover .".concat(classNames2.checkbox)] = { + background: "Highlight", + borderColor: "Highlight" + }, _f[":focus .".concat(classNames2.checkbox)] = { + background: "Highlight" + }, _f[":focus:hover .".concat(classNames2.checkbox)] = { + background: "Highlight" + }, _f[":focus:hover .".concat(classNames2.checkmark)] = { + color: "Window" + }, _f[":hover .".concat(classNames2.checkmark)] = { + color: "Window" + }, _f), _e2), + indeterminate && (_g = {}, _g[":hover .".concat(classNames2.checkbox, ", :hover .").concat(classNames2.checkbox, ":after")] = (_h = { + borderColor: checkboxBorderIndeterminateHoveredColor + }, _h[HighContrastSelector] = { + borderColor: "WindowText" + }, _h), _g[":focus .".concat(classNames2.checkbox)] = { + borderColor: checkboxBorderIndeterminateHoveredColor + }, _g[":hover .".concat(classNames2.checkmark)] = { + opacity: "0" + }, _g), + (_j = {}, _j[":hover .".concat(classNames2.text, ", :focus .").concat(classNames2.text)] = (_k = { + color: checkboxHoveredTextColor + }, _k[HighContrastSelector] = { + color: disabled ? "GrayText" : "WindowText" + }, _k), _j) + ], + className2 + ], + input: (_l = { + position: "absolute", + background: "none", + opacity: 0 + }, // eslint-disable-next-line @fluentui/max-len + _l[".".concat(IsFocusVisibleClassName, " &:focus + label::before, :host(.").concat(IsFocusVisibleClassName, ") &:focus + label::before")] = (_m = { + outline: "1px solid " + theme.palette.neutralSecondary, + outlineOffset: "2px" + }, _m[HighContrastSelector] = { + outline: "1px solid WindowText" + }, _m), _l), + label: [ + classNames2.label, + theme.fonts.medium, + { + display: "flex", + alignItems: isUsingCustomLabelRender ? "center" : "flex-start", + cursor: disabled ? "default" : "pointer", + position: "relative", + userSelect: "none" + }, + reversed && { + flexDirection: "row-reverse", + justifyContent: "flex-end" + }, + { + "&::before": { + position: "absolute", + left: 0, + right: 0, + top: 0, + bottom: 0, + content: '""', + pointerEvents: "none" + } + } + ], + checkbox: [ + classNames2.checkbox, + (_o = { + position: "relative", + display: "flex", + flexShrink: 0, + alignItems: "center", + justifyContent: "center", + height: MS_CHECKBOX_LABEL_SIZE, + width: MS_CHECKBOX_LABEL_SIZE, + border: "1px solid ".concat(checkboxBorderColor), + borderRadius: effects.roundedCorner2, + boxSizing: "border-box", + transitionProperty: "background, border, border-color", + transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, + transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING, + /* in case the icon is bigger than the box */ + overflow: "hidden", + ":after": indeterminate ? indeterminateDotStyles : null + }, _o[HighContrastSelector] = __assign$1({ borderColor: "WindowText" }, getHighContrastNoAdjustStyle()), _o), + indeterminate && { + borderColor: checkboxBorderIndeterminateColor + }, + !reversed ? ( + // This margin on the checkbox is for backwards compat. Notably it has the effect where a customRender + // is used, there will be only a 4px margin from checkbox to label. The label by default would have + // another 4px margin for a total of 8px margin between checkbox and label. We don't combine the two + // (and move it into the text) to not incur a breaking change for everyone using custom render atm. + { + marginRight: 4 + } + ) : { + marginLeft: 4 + }, + !disabled && !indeterminate && checked && (_p = { + background: checkboxBackgroundChecked, + borderColor: checkboxBorderColorChecked + }, _p[HighContrastSelector] = { + background: "Highlight", + borderColor: "Highlight" + }, _p), + disabled && (_q = { + borderColor: checkboxBorderColorDisabled + }, _q[HighContrastSelector] = { + borderColor: "GrayText" + }, _q), + checked && disabled && (_r = { + background: checkboxBackgroundDisabledChecked, + borderColor: checkboxBorderColorDisabled + }, _r[HighContrastSelector] = { + background: "Window" + }, _r) + ], + checkmark: [ + classNames2.checkmark, + (_s = { + opacity: checked && !indeterminate ? "1" : "0", + color: checkmarkFontColor + }, _s[HighContrastSelector] = __assign$1({ color: disabled ? "GrayText" : "Window" }, getHighContrastNoAdjustStyle()), _s) + ], + text: [ + classNames2.text, + (_t = { + color: disabled ? checkboxTextColorDisabled : checkboxTextColor, + fontSize: fonts.medium.fontSize, + lineHeight: "20px" + }, _t[HighContrastSelector] = __assign$1({ color: disabled ? "GrayText" : "WindowText" }, getHighContrastNoAdjustStyle()), _t), + !reversed ? { + marginLeft: 4 + } : { + marginRight: 4 } + ] }; - var enabledFieldWithImageHoverOrFocusProperties = { - borderColor: checked ? iconOrImageChoiceBorderCheckedHoveredColor : iconOrImageChoiceBorderUncheckedHoveredColor, + }; + var Checkbox = styled(CheckboxBase, getStyles$g, void 0, { scope: "Checkbox" }); + var _a$2, _b$2; + var ComboBoxHeight = 32; + var ComboBoxLineHeight = 30; + var ComboBoxCaretDownWidth = 32; + var ComboBoxOptionHeight = 36; + var getDisabledStyles = memoizeFunction(function(theme) { + var _a2; + var semanticColors = theme.semanticColors; + return { + backgroundColor: semanticColors.disabledBackground, + color: semanticColors.disabledText, + cursor: "default", + selectors: (_a2 = { + ":after": { + borderColor: semanticColors.disabledBackground + } + }, _a2[HighContrastSelector] = { + color: "GrayText", selectors: { - ':before': { - opacity: 1, - borderColor: checked ? circleCheckedHoveredBorderColor : circleHoveredBorderColor - } + ":after": { + borderColor: "GrayText" + } } + }, _a2) }; - var circleAreaProperties = [ + }); + var listOptionHighContrastStyles = { + selectors: (_a$2 = {}, _a$2[HighContrastSelector] = __assign$1({ backgroundColor: "Highlight", borderColor: "Highlight", color: "HighlightText" }, getHighContrastNoAdjustStyle()), _a$2) + }; + var inputHighContrastStyles = { + selectors: (_b$2 = {}, _b$2[HighContrastSelector] = __assign$1({ color: "WindowText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _b$2) + }; + var getOptionStyles = memoizeFunction(function(theme, customStylesForAllOptions, customOptionStylesForCurrentOption, isPending, isHidden, isSelected) { + var _a2; + var palette = theme.palette, semanticColors = theme.semanticColors; + var option = { + textHoveredColor: semanticColors.menuItemTextHovered, + textSelectedColor: palette.neutralDark, + textDisabledColor: semanticColors.disabledText, + backgroundHoveredColor: semanticColors.menuItemBackgroundHovered, + backgroundPressedColor: semanticColors.menuItemBackgroundPressed + }; + var optionStyles = { + root: [ + theme.fonts.medium, + { + backgroundColor: isPending ? option.backgroundHoveredColor : "transparent", + boxSizing: "border-box", + cursor: "pointer", + display: isHidden ? "none" : "block", + width: "100%", + height: "auto", + minHeight: ComboBoxOptionHeight, + lineHeight: "20px", + padding: "0 8px", + position: "relative", + borderWidth: "1px", + borderStyle: "solid", + borderColor: "transparent", + borderRadius: 0, + wordWrap: "break-word", + overflowWrap: "break-word", + textAlign: "left", + selectors: __assign$1(__assign$1((_a2 = {}, _a2[HighContrastSelector] = { + border: "none", + borderColor: "Background" + }, _a2), !isHidden && { + "&.ms-Checkbox": { + display: "flex", + alignItems: "center" + } + }), { "&.ms-Button--command:hover:active": { + backgroundColor: option.backgroundPressedColor + }, ".ms-Checkbox-label": { + width: "100%" + } }) + }, + isSelected ? [ + { + backgroundColor: "transparent", + color: option.textSelectedColor, + selectors: { + ":hover": [ + { + backgroundColor: option.backgroundHoveredColor + }, + listOptionHighContrastStyles + ] + } + }, + getFocusStyle(theme, { inset: -1, isFocusedOnly: false }), + listOptionHighContrastStyles + ] : [] + ], + rootHovered: { + backgroundColor: option.backgroundHoveredColor, + color: option.textHoveredColor + }, + rootFocused: { + backgroundColor: option.backgroundHoveredColor + }, + rootDisabled: { + color: option.textDisabledColor, + cursor: "default" + }, + optionText: { + overflow: "hidden", + whiteSpace: "nowrap", + textOverflow: "ellipsis", + minWidth: "0px", + maxWidth: "100%", + wordWrap: "break-word", + overflowWrap: "break-word", + display: "inline-block" + }, + optionTextWrapper: { + maxWidth: "100%", + display: "flex", + alignItems: "center" + } + }; + return concatStyleSets(optionStyles, customStylesForAllOptions, customOptionStylesForCurrentOption); + }); + var getCaretDownButtonStyles = memoizeFunction(function(theme, customStyles) { + var _a2, _b2; + var semanticColors = theme.semanticColors, fonts = theme.fonts; + var caret = { + buttonTextColor: semanticColors.bodySubtext, + buttonTextHoveredCheckedColor: semanticColors.buttonTextChecked, + buttonBackgroundHoveredColor: semanticColors.listItemBackgroundHovered, + buttonBackgroundCheckedColor: semanticColors.listItemBackgroundChecked, + buttonBackgroundCheckedHoveredColor: semanticColors.listItemBackgroundCheckedHovered + }; + var buttonHighContrastStyles = { + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ backgroundColor: "Highlight", borderColor: "Highlight", color: "HighlightText" }, getHighContrastNoAdjustStyle()), _a2) + }; + var styles = { + root: { + color: caret.buttonTextColor, + fontSize: fonts.small.fontSize, + position: "absolute", + top: 0, + height: "100%", + lineHeight: ComboBoxLineHeight, + width: ComboBoxCaretDownWidth, + textAlign: "center", + cursor: "default", + selectors: (_b2 = {}, _b2[HighContrastSelector] = __assign$1({ backgroundColor: "ButtonFace", borderColor: "ButtonText", color: "ButtonText" }, getHighContrastNoAdjustStyle()), _b2) + }, + icon: { + fontSize: fonts.small.fontSize + }, + rootHovered: [ { - content: '""', - display: 'inline-block', - backgroundColor: circleBackgroundColor, - borderWidth: 1, - borderStyle: 'solid', - borderColor: circleBorderColor, - width: choiceFieldSize, - height: choiceFieldSize, - fontWeight: 'normal', - position: 'absolute', - top: 0, - left: 0, - boxSizing: 'border-box', - transitionProperty: 'border-color', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: choiceFieldTransitionTiming, - borderRadius: '50%' - }, - disabled && { - borderColor: circleDisabledBorderColor, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'GrayText', - background: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) + backgroundColor: caret.buttonBackgroundHoveredColor, + color: caret.buttonTextHoveredCheckedColor, + cursor: "pointer" }, - checked && { - borderColor: disabled ? circleDisabledBorderColor : circleCheckedBorderColor, - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - background: 'Window', - forcedColorAdjust: 'none' - }, _b) + buttonHighContrastStyles + ], + rootPressed: [ + { + backgroundColor: caret.buttonBackgroundCheckedColor, + color: caret.buttonTextHoveredCheckedColor }, - (hasIcon || hasImage) && { - top: radioButtonSpacing, - right: radioButtonSpacing, - left: 'auto', - opacity: checked ? 1 : 0 - } - ]; - var dotAreaProperties = [ + buttonHighContrastStyles + ], + rootChecked: [ { - content: '""', - width: 0, - height: 0, - borderRadius: '50%', - position: 'absolute', - left: choiceFieldSize / 2, - right: 0, - transitionProperty: 'border-width', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: choiceFieldTransitionTiming, - boxSizing: 'border-box' + backgroundColor: caret.buttonBackgroundCheckedColor, + color: caret.buttonTextHoveredCheckedColor }, - checked && { - borderWidth: 5, - borderStyle: 'solid', - borderColor: disabled ? dotDisabledColor : dotCheckedColor, - background: dotCheckedColor, - left: 5, - top: 5, - width: 10, - height: 10, - selectors: (_c = {}, _c[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - forcedColorAdjust: 'none' - }, _c) + buttonHighContrastStyles + ], + rootCheckedHovered: [ + { + backgroundColor: caret.buttonBackgroundCheckedHoveredColor, + color: caret.buttonTextHoveredCheckedColor }, - checked && (hasIcon || hasImage) && { - top: radioButtonSpacing + radioButtonInnerSize, - right: radioButtonSpacing + radioButtonInnerSize, - left: 'auto' + buttonHighContrastStyles + ], + rootDisabled: [ + getDisabledStyles(theme), + { + position: "absolute" } + ] + }; + return concatStyleSets(styles, customStyles); + }); + var getStyles$f = memoizeFunction(function(theme, customStyles, comboBoxOptionWidth) { + var _a2, _b2, _c2, _d2, _e2, _f; + var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; + var root = { + textColor: semanticColors.inputText, + borderColor: semanticColors.inputBorder, + borderHoveredColor: semanticColors.inputBorderHovered, + borderPressedColor: semanticColors.inputFocusBorderAlt, + borderFocusedColor: semanticColors.inputFocusBorderAlt, + backgroundColor: semanticColors.inputBackground, + erroredColor: semanticColors.errorText + }; + var option = { + headerTextColor: semanticColors.menuHeader, + dividerBorderColor: semanticColors.bodyDivider + }; + var placeholderHighContrastStyles = { + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + color: "GrayText" + }, _a2) + }; + var placeholderStyles = [ + { + color: semanticColors.inputPlaceholderText + }, + placeholderHighContrastStyles ]; - return { - root: [ - classNames.root, - theme.fonts.medium, - { - display: 'flex', - alignItems: 'center', - boxSizing: 'border-box', - color: semanticColors.bodyText, - minHeight: 26, - border: 'none', - position: 'relative', - marginTop: 8, - selectors: { - '.ms-ChoiceFieldLabel': { - display: 'inline-block' - } - } - }, - !hasIcon && !hasImage && { - selectors: { - '.ms-ChoiceFieldLabel': { - paddingLeft: '26px' - } - } + var placeholderStylesHovered = [ + { + color: semanticColors.inputTextHovered + }, + placeholderHighContrastStyles + ]; + var disabledPlaceholderStyles = [ + { + color: semanticColors.disabledText + }, + placeholderHighContrastStyles + ]; + var ComboBoxRootHighContrastFocused = __assign$1(__assign$1({ color: "HighlightText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), { selectors: { + ":after": { + borderColor: "Highlight" + } + } }); + var focusBorderStyles = getInputFocusStyle(root.borderPressedColor, effects.roundedCorner2, "border", 0); + var styles = { + container: {}, + label: {}, + labelDisabled: {}, + root: [ + theme.fonts.medium, + { + boxShadow: "none", + marginLeft: "0", + paddingRight: ComboBoxCaretDownWidth, + paddingLeft: 9, + color: root.textColor, + position: "relative", + outline: "0", + userSelect: "none", + backgroundColor: root.backgroundColor, + cursor: "text", + display: "block", + height: ComboBoxHeight, + whiteSpace: "nowrap", + textOverflow: "ellipsis", + boxSizing: "border-box", + // Border-box matches Dropdown and TextField + selectors: { + ".ms-Label": { + display: "inline-block", + marginBottom: "8px" }, - hasImage && 'ms-ChoiceField--image', - hasIcon && 'ms-ChoiceField--icon', - (hasIcon || hasImage) && { - display: 'inline-flex', - fontSize: 0, - margin: '0 4px 4px 0', - paddingLeft: 0, - backgroundColor: iconOrImageChoiceBackgroundColor, - height: '100%' - } - ], - choiceFieldWrapper: [ - classNames.choiceFieldWrapper, - focused && getChoiceGroupFocusStyle(focusBorderColor, hasIcon || hasImage) - ], - // The hidden input - input: [ - classNames.input, - { - position: 'absolute', - opacity: 0, - top: 0, - right: 0, - width: '100%', - height: '100%', - margin: 0 + "&.is-open": { + selectors: (_b2 = {}, _b2[HighContrastSelector] = ComboBoxRootHighContrastFocused, _b2) }, - disabled && 'is-disabled' - ], - field: [ - classNames.field, - checked && classNames.checked, + // setting border using pseudo-element here in order to + // prevent chevron button to overlap ComboBox border under certain resolutions + ":after": { + pointerEvents: "none", + content: "''", + position: "absolute", + left: 0, + top: 0, + bottom: 0, + right: 0, + borderWidth: "1px", + borderStyle: "solid", + borderColor: root.borderColor, + borderRadius: effects.roundedCorner2 + } + } + } + ], + rootHovered: { + selectors: (_c2 = { + ":after": { + borderColor: root.borderHoveredColor + }, + ".ms-ComboBox-Input": [ { - display: 'inline-block', - cursor: 'pointer', - marginTop: 0, - position: 'relative', - verticalAlign: 'top', - userSelect: 'none', - minHeight: 20, - selectors: { - ':hover': !disabled && fieldHoverOrFocusProperties, - ':focus': !disabled && fieldHoverOrFocusProperties, - // The circle - ':before': circleAreaProperties, - // The dot - ':after': dotAreaProperties - } - }, - hasIcon && 'ms-ChoiceField--icon', - hasImage && 'ms-ChoiceField-field--image', - (hasIcon || hasImage) && { - boxSizing: 'content-box', - cursor: 'pointer', - paddingTop: 22, - margin: 0, - textAlign: 'center', - transitionProperty: 'all', - transitionDuration: choiceFieldTransitionDuration, - transitionTimingFunction: 'ease', - border: '1px solid transparent', - justifyContent: 'center', - alignItems: 'center', - display: 'flex', - flexDirection: 'column' - }, - checked && { - borderColor: iconOrImageChoiceBorderCheckedColor - }, - (hasIcon || hasImage) && !disabled && { - selectors: { - ':hover': enabledFieldWithImageHoverOrFocusProperties, - ':focus': enabledFieldWithImageHoverOrFocusProperties - } - }, - disabled && { - cursor: 'default', - selectors: { - '.ms-ChoiceFieldLabel': { - color: semanticColors.disabledBodyText, - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _d) - } - } - }, - checked && disabled && { - borderColor: iconOrImageChoiceBackgroundColor - } - ], - innerField: [ - classNames.innerField, - hasImage && { - // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. - height: imageSize.height, - width: imageSize.width + color: semanticColors.inputTextHovered }, - (hasIcon || hasImage) && { - position: 'relative', - display: 'inline-block', - paddingLeft: 30, - paddingRight: 30 - }, - (hasIcon || hasImage) && imageIsLarge && { - paddingLeft: 24, - paddingRight: 24 - }, - (hasIcon || hasImage) && disabled && { - opacity: 0.25, - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = { - color: 'GrayText', - opacity: 1 - }, _e) - } - ], - imageWrapper: getImageWrapperStyle(false, classNames.imageWrapper, checked), - selectedImageWrapper: getImageWrapperStyle(true, classNames.imageWrapper, checked), - iconWrapper: [ - classNames.iconWrapper, - { - fontSize: iconSize, - lineHeight: iconSize, - height: iconSize - } - ], - labelWrapper: [ - classNames.labelWrapper, - fonts.medium, - (hasIcon || hasImage) && { - display: 'block', - position: 'relative', - margin: '4px 8px 2px 8px', - height: labelWrapperHeight, - lineHeight: labelWrapperLineHeight, - // using non-null assertion because we have a default in `ChoiceGroupOptionBase` class. - maxWidth: imageSize.width * 2, - overflow: 'hidden', - whiteSpace: 'pre-wrap' - } - ] + getPlaceholderStyles(placeholderStylesHovered), + inputHighContrastStyles + ] + }, _c2[HighContrastSelector] = __assign$1(__assign$1({ color: "HighlightText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), { selectors: { + ":after": { + borderColor: "Highlight" + } + } }), _c2) + }, + rootPressed: [ + { + position: "relative", + selectors: (_d2 = {}, _d2[HighContrastSelector] = ComboBoxRootHighContrastFocused, _d2) + } + ], + rootFocused: [ + { + selectors: (_e2 = { + ".ms-ComboBox-Input": [ + { + color: semanticColors.inputTextHovered + }, + inputHighContrastStyles + ] + }, _e2[HighContrastSelector] = ComboBoxRootHighContrastFocused, _e2) + }, + focusBorderStyles + ], + rootDisabled: getDisabledStyles(theme), + rootError: { + selectors: { + ":after": { + borderColor: root.erroredColor + }, + ":hover:after": { + borderColor: semanticColors.inputBorderHovered + } + } + }, + rootDisallowFreeForm: {}, + input: [ + getPlaceholderStyles(placeholderStyles), + { + backgroundColor: root.backgroundColor, + color: root.textColor, + boxSizing: "border-box", + width: "100%", + height: "100%", + borderStyle: "none", + outline: "none", + font: "inherit", + textOverflow: "ellipsis", + padding: "0", + selectors: { + "::-ms-clear": { + display: "none" + } + } + }, + inputHighContrastStyles + ], + inputDisabled: [getDisabledStyles(theme), getPlaceholderStyles(disabledPlaceholderStyles)], + errorMessage: [ + theme.fonts.small, + { + color: root.erroredColor, + marginTop: "5px" + } + ], + callout: { + boxShadow: effects.elevation8 + }, + optionsContainerWrapper: { + width: comboBoxOptionWidth + }, + optionsContainer: { + display: "block" + }, + screenReaderText: hiddenContentStyle, + header: [ + fonts.medium, + { + fontWeight: FontWeights.semibold, + color: option.headerTextColor, + backgroundColor: "none", + borderStyle: "none", + height: ComboBoxOptionHeight, + lineHeight: ComboBoxOptionHeight, + cursor: "default", + padding: "0 8px", + userSelect: "none", + textAlign: "left", + selectors: (_f = {}, _f[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _f) + } + ], + divider: { + height: 1, + backgroundColor: option.dividerBorderColor + } + }; + return concatStyleSets(styles, customStyles); + }); + var getClassNames$g = memoizeFunction(function(styles, className2, isOpen, disabled, required2, focused, allowFreeForm, hasErrorMessage) { + return { + container: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-container", className2, styles.container), + label: mergeStyles(styles.__shadowConfig__, styles.label, disabled && styles.labelDisabled), + root: mergeStyles(styles.__shadowConfig__, "ms-ComboBox", hasErrorMessage ? styles.rootError : isOpen && "is-open", required2 && "is-required", styles.root, !allowFreeForm && styles.rootDisallowFreeForm, hasErrorMessage && !focused ? styles.rootError : !disabled && focused && styles.rootFocused, !disabled && { + selectors: { + ":hover": hasErrorMessage ? styles.rootError : !isOpen && !focused && styles.rootHovered, + ":active": hasErrorMessage ? styles.rootError : styles.rootPressed, + ":focus": hasErrorMessage ? styles.rootError : styles.rootFocused + } + }, disabled && ["is-disabled", styles.rootDisabled]), + input: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-Input", styles.input, disabled && styles.inputDisabled), + errorMessage: mergeStyles(styles.__shadowConfig__, styles.errorMessage), + callout: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-callout", styles.callout), + optionsContainerWrapper: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-optionsContainerWrapper", styles.optionsContainerWrapper), + optionsContainer: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-optionsContainer", styles.optionsContainer), + header: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-header", styles.header), + divider: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-divider", styles.divider), + screenReaderText: mergeStyles(styles.__shadowConfig__, styles.screenReaderText) }; -}; - -},{"tslib":"9gizs","../../../Styling":"hTimn","../../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"imoN3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-ChoiceFieldGroup', - flexContainer: 'ms-ChoiceFieldGroup-flexContainer' -}; -var getStyles = function(props) { - var className = props.className, optionsContainIconOrImage = props.optionsContainIconOrImage, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + }); + var getComboBoxOptionClassNames = memoizeFunction(function(styles) { return { - root: [ - className, - classNames.root, - theme.fonts.medium, - { - display: 'block' - } - ], - flexContainer: [ - classNames.flexContainer, - optionsContainIconOrImage && { - display: 'flex', - flexDirection: 'row', - flexWrap: 'wrap' - } - ] + optionText: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-optionText", styles.optionText), + root: mergeStyles(styles.__shadowConfig__, "ms-ComboBox-option", styles.root, { + selectors: { + ":hover": styles.rootHovered, + ":focus": styles.rootFocused, + ":active": styles.rootPressed + } + }), + optionTextWrapper: mergeStyles(styles.__shadowConfig__, styles.optionTextWrapper) }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7XnNF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ComboBox/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ComboBox/index":"4nZqV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4nZqV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _comboBox = require("./ComboBox"); -parcelHelpers.exportAll(_comboBox, exports); -var _comboBoxTypes = require("./ComboBox.types"); -parcelHelpers.exportAll(_comboBoxTypes, exports); -var _virtualizedComboBox = require("./VirtualizedComboBox"); -parcelHelpers.exportAll(_virtualizedComboBox, exports); - -},{"./ComboBox":"1FUTw","./ComboBox.types":false,"./VirtualizedComboBox":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1FUTw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ComboBox", ()=>ComboBox); -var _tslib = require("tslib"); -var _react = require("react"); -var _autofill = require("../../Autofill"); -var _utilities = require("../../Utilities"); -var _callout = require("../../Callout"); -var _checkbox = require("../../Checkbox"); -var _comboBoxStyles = require("./ComboBox.styles"); -var _comboBoxClassNames = require("./ComboBox.classNames"); -var _label = require("../../Label"); -var _selectableOption = require("../../SelectableOption"); -var _button = require("../../Button"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities1 = require("@fluentui/utilities"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var SearchDirection; -(function(SearchDirection) { - SearchDirection[SearchDirection["backward"] = -1] = "backward"; - SearchDirection[SearchDirection["none"] = 0] = "none"; - SearchDirection[SearchDirection["forward"] = 1] = "forward"; -})(SearchDirection || (SearchDirection = {})); -var HoverStatus; -(function(HoverStatus) { - /** Used when the user was hovering and has since moused out of the menu items */ HoverStatus[HoverStatus["clearAll"] = -2] = "clearAll"; - /** Default "normal" state, when no hover has happened or a hover is in progress */ HoverStatus[HoverStatus["default"] = -1] = "default"; -})(HoverStatus || (HoverStatus = {})); -var ScrollIdleDelay = 250; /* ms */ -var TouchIdleDelay = 500; /* ms */ -/** - * This is used to clear any pending autocomplete text (used when autocomplete is true and - * allowFreeform is false) - */ var ReadOnlyPendingAutoCompleteTimeout = 1000; /* ms */ -/** - * Internal component that is used to wrap all ComboBox options. - * This is used to customize when we want to re-render components, - * so we don't re-render every option every time render is executed. - */ var ComboBoxOptionWrapper = _react.memo(function(_a) { - var render = _a.render; + }); + function getAllSelectedOptions(options2, selectedIndices) { + var selectedOptions = []; + for (var _i = 0, selectedIndices_1 = selectedIndices; _i < selectedIndices_1.length; _i++) { + var index2 = selectedIndices_1[_i]; + var option = options2[index2]; + if (option) { + selectedOptions.push(option); + } + } + return selectedOptions; + } + var SelectableOptionMenuItemType; + (function(SelectableOptionMenuItemType2) { + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["Normal"] = 0] = "Normal"; + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["Divider"] = 1] = "Divider"; + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["Header"] = 2] = "Header"; + SelectableOptionMenuItemType2[SelectableOptionMenuItemType2["SelectAll"] = 3] = "SelectAll"; + })(SelectableOptionMenuItemType || (SelectableOptionMenuItemType = {})); + var SearchDirection; + (function(SearchDirection2) { + SearchDirection2[SearchDirection2["backward"] = -1] = "backward"; + SearchDirection2[SearchDirection2["none"] = 0] = "none"; + SearchDirection2[SearchDirection2["forward"] = 1] = "forward"; + })(SearchDirection || (SearchDirection = {})); + var HoverStatus; + (function(HoverStatus2) { + HoverStatus2[HoverStatus2["clearAll"] = -2] = "clearAll"; + HoverStatus2[HoverStatus2["default"] = -1] = "default"; + })(HoverStatus || (HoverStatus = {})); + var ScrollIdleDelay = 250; + var TouchIdleDelay = 500; + var ReadOnlyPendingAutoCompleteTimeout = 1e3; + var ComboBoxOptionWrapper = React__namespace.memo(function(_a2) { + var render = _a2.render; return render(); -}, function(_a, _b) { - var oldRender = _a.render, oldProps = (0, _tslib.__rest)(_a, [ - "render" - ]); - var newRender = _b.render, newProps = (0, _tslib.__rest)(_b, [ - "render" - ]); - // The render function will always be different, so we ignore that prop - return (0, _utilities.shallowCompare)(oldProps, newProps); -}); -var COMPONENT_NAME = 'ComboBox'; -var DEFAULT_PROPS = { + }, function(_a2, _b2) { + _a2.render; + var oldProps = __rest(_a2, ["render"]); + _b2.render; + var newProps = __rest(_b2, ["render"]); + return shallowCompare(oldProps, newProps); + }); + var COMPONENT_NAME$4 = "ComboBox"; + var DEFAULT_PROPS$2 = { options: [], allowFreeform: false, allowParentArrowNavigation: false, - autoComplete: 'on', - buttonIconProps: { - iconName: 'ChevronDown' - } -}; -function useOptionsState(_a) { - var options = _a.options, defaultSelectedKey = _a.defaultSelectedKey, selectedKey = _a.selectedKey; - /** The currently selected indices */ var _b = _react.useState(function() { - return getSelectedIndices(options, buildDefaultSelectedKeys(defaultSelectedKey, selectedKey)); - }), selectedIndices = _b[0], setSelectedIndices = _b[1]; - /** The options currently available for the callout */ var _c = _react.useState(options), currentOptions = _c[0], setCurrentOptions = _c[1]; - /** This value is used for the autocomplete hint value */ var _d = _react.useState(), suggestedDisplayValue = _d[0], setSuggestedDisplayValue = _d[1]; - _react.useEffect(function() { - if (selectedKey !== undefined) { - var selectedKeys = buildSelectedKeys(selectedKey); - var indices = getSelectedIndices(options, selectedKeys); - setSelectedIndices(indices); - } - setCurrentOptions(options); - }, [ - options, - selectedKey - ]); - _react.useEffect(function() { - if (selectedKey === null) setSuggestedDisplayValue(undefined); - }, [ - selectedKey - ]); + autoComplete: "on", + buttonIconProps: { iconName: "ChevronDown" } + }; + function useOptionsState(_a2) { + var options2 = _a2.options, defaultSelectedKey = _a2.defaultSelectedKey, selectedKey = _a2.selectedKey; + var _b2 = React__namespace.useState(function() { + return getSelectedIndices(options2, buildDefaultSelectedKeys(defaultSelectedKey, selectedKey)); + }), selectedIndices = _b2[0], setSelectedIndices = _b2[1]; + var _c2 = React__namespace.useState(options2), currentOptions = _c2[0], setCurrentOptions = _c2[1]; + var _d2 = React__namespace.useState(), suggestedDisplayValue = _d2[0], setSuggestedDisplayValue = _d2[1]; + React__namespace.useEffect(function() { + if (selectedKey !== void 0) { + var selectedKeys = buildSelectedKeys(selectedKey); + var indices = getSelectedIndices(options2, selectedKeys); + setSelectedIndices(indices); + } + setCurrentOptions(options2); + }, [options2, selectedKey]); + React__namespace.useEffect(function() { + if (selectedKey === null) { + setSuggestedDisplayValue(void 0); + } + }, [selectedKey]); return [ - selectedIndices, - setSelectedIndices, - currentOptions, - setCurrentOptions, - suggestedDisplayValue, - setSuggestedDisplayValue + selectedIndices, + setSelectedIndices, + currentOptions, + setCurrentOptions, + suggestedDisplayValue, + setSuggestedDisplayValue ]; -} -var ComboBox = _react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var _a = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults), ref = _a.ref, props = (0, _tslib.__rest)(_a, [ - "ref" - ]); - var rootRef = _react.useRef(null); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var _b = useOptionsState(props), selectedIndices = _b[0], setSelectedIndices = _b[1], currentOptions = _b[2], setCurrentOptions = _b[3], suggestedDisplayValue = _b[4], setSuggestedDisplayValue = _b[5]; - return _react.createElement(ComboBoxInternal, (0, _tslib.__assign)({}, props, { - hoisted: { - mergedRootRef: mergedRootRef, - rootRef: rootRef, - selectedIndices: selectedIndices, - setSelectedIndices: setSelectedIndices, - currentOptions: currentOptions, - setCurrentOptions: setCurrentOptions, - suggestedDisplayValue: suggestedDisplayValue, - setSuggestedDisplayValue: setSuggestedDisplayValue - } - })); -}); -ComboBox.displayName = COMPONENT_NAME; -/** - * Depth-first search to find the first descendant element where the match function returns true. - * @param element - element to start searching at - * @param match - the function that determines if the element is a match - * @returns the matched element or null no match was found - */ function findFirstDescendant(element, match) { - var children = (0, _utilities1.getChildren)(element); - // For loop is used because forEach cannot be stopped. - for(var index = 0; index < children.length; index++){ - var child = children[index]; - if (match(child)) return child; - var candidate = findFirstDescendant(child, match); - if (candidate) return candidate; + } + var ComboBox = React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var _a2 = getPropsWithDefaults(DEFAULT_PROPS$2, propsWithoutDefaults); + _a2.ref; + var props = __rest(_a2, ["ref"]); + var rootRef = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(rootRef, forwardedRef); + var _b2 = useOptionsState(props), selectedIndices = _b2[0], setSelectedIndices = _b2[1], currentOptions = _b2[2], setCurrentOptions = _b2[3], suggestedDisplayValue = _b2[4], setSuggestedDisplayValue = _b2[5]; + return React__namespace.createElement(ComboBoxInternal, __assign$1({}, props, { hoisted: { + mergedRootRef, + rootRef, + selectedIndices, + setSelectedIndices, + currentOptions, + setCurrentOptions, + suggestedDisplayValue, + setSuggestedDisplayValue + } })); + }); + ComboBox.displayName = COMPONENT_NAME$4; + function findFirstDescendant(element2, match2) { + var children2 = getChildren(element2); + for (var index2 = 0; index2 < children2.length; index2++) { + var child = children2[index2]; + if (match2(child)) { + return child; + } + var candidate = findFirstDescendant(child, match2); + if (candidate) { + return candidate; + } } return null; -} -var ComboBoxInternal = /** @class */ function(_super) { - (0, _tslib.__extends)(ComboBoxInternal, _super); - function ComboBoxInternal(props) { + } + var ComboBoxInternal = ( + /** @class */ + (function(_super) { + __extends(ComboBoxInternal2, _super); + function ComboBoxInternal2(props) { var _this = _super.call(this, props) || this; - /** The input aspect of the combo box */ _this._autofill = _react.createRef(); - /** The wrapping div of the input and button */ _this._comboBoxWrapper = _react.createRef(); - /** The callout element */ _this._comboBoxMenu = _react.createRef(); - /** The menu item element that is currently selected */ _this._selectedElement = _react.createRef(); - // props to prevent dismiss on scroll/resize immediately after opening + _this._autofill = React__namespace.createRef(); + _this._comboBoxWrapper = React__namespace.createRef(); + _this._comboBoxMenu = React__namespace.createRef(); + _this._selectedElement = React__namespace.createRef(); _this._overrideScrollDismiss = false; - /** - * {@inheritdoc} - */ _this.focus = function(shouldOpenOnFocus, useFocusAsync) { - if (_this.props.disabled) return; - if (_this._autofill.current) { - if (useFocusAsync) (0, _utilities.focusAsync)(_this._autofill.current); - else _this._autofill.current.focus(); - if (shouldOpenOnFocus) _this.setState({ - isOpen: true - }); + _this.focus = function(shouldOpenOnFocus, useFocusAsync) { + if (_this.props.disabled) { + return; + } + if (_this._autofill.current) { + if (useFocusAsync) { + focusAsync(_this._autofill.current); + } else { + _this._autofill.current.focus(); } - // Programmatically setting focus means that there is nothing else that needs to be done - // Focus is now contained - if (!_this._hasFocus()) _this.setState({ - focusState: 'focused' - }); + if (shouldOpenOnFocus) { + _this.setState({ + isOpen: true + }); + } + } + if (!_this._hasFocus()) { + _this.setState({ focusState: "focused" }); + } }; - /** - * Close menu callout if it is open - */ _this.dismissMenu = function() { - var isOpen = _this.state.isOpen; - isOpen && _this.setState({ - isOpen: false - }); + _this.dismissMenu = function() { + var isOpen = _this.state.isOpen; + isOpen && _this.setState({ isOpen: false }); }; - /** - * componentWillReceiveProps handler for the auto fill component - * Checks/updates the input value to set, if needed - * @param defaultVisibleValue - the defaultVisibleValue that got passed - * in to the auto fill's componentWillReceiveProps - * @returns - the updated value to set, if needed - */ _this._onUpdateValueInAutofillWillReceiveProps = function() { - var comboBox = _this._autofill.current; - if (!comboBox) return null; - if (comboBox.value === null || comboBox.value === undefined) return null; - return normalizeToString(_this._currentVisibleValue); + _this._onUpdateValueInAutofillWillReceiveProps = function() { + var comboBox = _this._autofill.current; + if (!comboBox) { + return null; + } + if (comboBox.value === null || comboBox.value === void 0) { + return null; + } + return normalizeToString(_this._currentVisibleValue); }; _this._renderComboBoxWrapper = function(multiselectAccessibleText, errorMessageId) { - var _a = _this.props, label = _a.label, disabled = _a.disabled, ariaLabel = _a.ariaLabel, _b = _a.ariaDescribedBy, ariaDescribedBy = _b === void 0 ? _this.props['aria-describedby'] : _b, required = _a.required, errorMessage = _a.errorMessage, buttonIconProps = _a.buttonIconProps, isButtonAriaHidden = _a.isButtonAriaHidden, title = _a.title, placeholderProp = _a.placeholder, tabIndex = _a.tabIndex, autofill = _a.autofill, iconButtonProps = _a.iconButtonProps, suggestedDisplayValue = _a.hoisted.suggestedDisplayValue; - var _c = _this.state, ariaActiveDescendantValue = _c.ariaActiveDescendantValue, isOpen = _c.isOpen; - // If the combo box has focus, is multiselect, and has a display string, then use that placeholder - // so that the selected items don't appear to vanish. This is not ideal but it's the only reasonable way - // to correct the behavior where the input is cleared so the user can type. If a full refactor is done, then this - // should be removed and the multiselect combo box should behave like a picker. - var placeholder = _this._hasFocus() && _this.props.multiSelect && multiselectAccessibleText ? multiselectAccessibleText : placeholderProp; - var labelledBy = [ - _this.props['aria-labelledby'], - label && _this._id + '-label' - ].join(' ').trim(); - var labelProps = { - 'aria-labelledby': labelledBy ? labelledBy : undefined, - 'aria-label': ariaLabel && !label ? ariaLabel : undefined - }; - return _react.createElement("div", { - "data-ktp-target": true, - ref: _this._comboBoxWrapper, - id: _this._id + 'wrapper', - className: _this._classNames.root, - "aria-owns": isOpen ? _this._id + '-list' : undefined - }, _react.createElement((0, _autofill.Autofill), (0, _tslib.__assign)({ - "data-ktp-execute-target": true, - "data-is-interactable": !disabled, - componentRef: _this._autofill, - id: _this._id + '-input', - className: _this._classNames.input, - type: "text", - onFocus: _this._onFocus, - onBlur: _this._onBlur, - onKeyDown: _this._onInputKeyDown, - onKeyUp: _this._onInputKeyUp, - onClick: _this._onAutofillClick, - onTouchStart: _this._onTouchStart, - onInputValueChange: _this._onInputChange, - "aria-expanded": isOpen, - "aria-autocomplete": _this._getAriaAutoCompleteValue(), - role: "combobox", - readOnly: disabled - }, labelProps, { - "aria-describedby": errorMessage !== undefined ? (0, _utilities.mergeAriaAttributeValues)(ariaDescribedBy, errorMessageId) : ariaDescribedBy, - "aria-activedescendant": ariaActiveDescendantValue, - "aria-required": required, - "aria-disabled": disabled, - "aria-controls": isOpen ? _this._id + '-list' : undefined, - spellCheck: false, - defaultVisibleValue: _this._currentVisibleValue, - suggestedDisplayValue: suggestedDisplayValue, - updateValueInWillReceiveProps: _this._onUpdateValueInAutofillWillReceiveProps, - shouldSelectFullInputValueInComponentDidUpdate: _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate, - title: title, - preventValueSelection: !_this._hasFocus(), - placeholder: placeholder, - tabIndex: disabled ? -1 : tabIndex - }, autofill)), _react.createElement((0, _button.IconButton), (0, _tslib.__assign)({ - className: 'ms-ComboBox-CaretDown-button', - styles: _this._getCaretButtonStyles(), - role: isButtonAriaHidden ? 'presentation' : undefined, - "aria-hidden": isButtonAriaHidden - }, !isButtonAriaHidden ? labelProps : undefined, { - "data-is-focusable": false, - tabIndex: -1, - onClick: _this._onComboBoxClick, - onBlur: _this._onBlur, - iconProps: buttonIconProps, - disabled: disabled, - checked: isOpen - }, iconButtonProps))); - }; - /** - * componentDidUpdate handler for the auto fill component - * - * @param defaultVisibleValue - the current defaultVisibleValue in the auto fill's componentDidUpdate - * @param suggestedDisplayValue - the current suggestedDisplayValue in the auto fill's componentDidUpdate - * @returns - should the full value of the input be selected? - * True if the defaultVisibleValue equals the suggestedDisplayValue, false otherwise - */ _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate = function() { - return _this._currentVisibleValue === _this.props.hoisted.suggestedDisplayValue; - }; - /** - * Get the correct value to pass to the input - * to show to the user based off of the current props and state - * @returns the value to pass to the input - */ _this._getVisibleValue = function() { - var _a = _this.props, text = _a.text, allowFreeform = _a.allowFreeform, allowFreeInput = _a.allowFreeInput, autoComplete = _a.autoComplete, _b = _a.hoisted, suggestedDisplayValue = _b.suggestedDisplayValue, selectedIndices = _b.selectedIndices, currentOptions = _b.currentOptions; - var _c = _this.state, currentPendingValueValidIndex = _c.currentPendingValueValidIndex, currentPendingValue = _c.currentPendingValue, isOpen = _c.isOpen; - var currentPendingIndexValid = indexWithinBounds(currentOptions, currentPendingValueValidIndex); - // If the user passed is a value prop, use that - // unless we are open and have a valid current pending index - if (!(isOpen && currentPendingIndexValid) && (text || text === '') && (currentPendingValue === null || currentPendingValue === undefined)) return text; - if (_this.props.multiSelect) { - // Multi-select - if (_this._hasFocus()) { - var index = -1; - if (autoComplete === 'on' && currentPendingIndexValid) index = currentPendingValueValidIndex; - return _this._getPendingString(currentPendingValue, currentOptions, index); - } else return _this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue); + var _a2 = _this.props, label2 = _a2.label, disabled = _a2.disabled, ariaLabel2 = _a2.ariaLabel, _b2 = _a2.ariaDescribedBy, ariaDescribedBy = _b2 === void 0 ? _this.props["aria-describedby"] : _b2, required2 = _a2.required, errorMessage = _a2.errorMessage, buttonIconProps = _a2.buttonIconProps, isButtonAriaHidden = _a2.isButtonAriaHidden, title = _a2.title, placeholderProp = _a2.placeholder, tabIndex = _a2.tabIndex, autofill = _a2.autofill, iconButtonProps = _a2.iconButtonProps, suggestedDisplayValue = _a2.hoisted.suggestedDisplayValue; + var _c2 = _this.state, ariaActiveDescendantValue = _c2.ariaActiveDescendantValue, isOpen = _c2.isOpen; + var placeholder = _this._hasFocus() && _this.props.multiSelect && multiselectAccessibleText ? multiselectAccessibleText : placeholderProp; + var labelledBy = [_this.props["aria-labelledby"], label2 && _this._id + "-label"].join(" ").trim(); + var labelProps = { + "aria-labelledby": labelledBy ? labelledBy : void 0, + "aria-label": ariaLabel2 && !label2 ? ariaLabel2 : void 0 + }; + var hasErrorMessage = errorMessage && errorMessage.length > 0 ? true : false; + return React__namespace.createElement( + "div", + { "data-ktp-target": true, ref: _this._comboBoxWrapper, id: _this._id + "wrapper", className: _this._classNames.root, "aria-owns": isOpen ? _this._id + "-list" : void 0 }, + React__namespace.createElement(Autofill, __assign$1({ "data-ktp-execute-target": true, "data-is-interactable": !disabled, componentRef: _this._autofill, id: _this._id + "-input", className: _this._classNames.input, type: "text", onFocus: _this._onFocus, onBlur: _this._onBlur, onKeyDown: _this._onInputKeyDown, onKeyUp: _this._onInputKeyUp, onClick: _this._onAutofillClick, onTouchStart: _this._onTouchStart, onInputValueChange: _this._onInputChange, "aria-expanded": isOpen, "aria-autocomplete": _this._getAriaAutoCompleteValue(), role: "combobox", readOnly: disabled }, labelProps, { + "aria-describedby": errorMessage !== void 0 ? mergeAriaAttributeValues(ariaDescribedBy, errorMessageId) : ariaDescribedBy, + "aria-activedescendant": ariaActiveDescendantValue, + "aria-required": required2, + "aria-disabled": disabled, + "aria-invalid": hasErrorMessage, + "aria-controls": isOpen ? _this._id + "-list" : void 0, + spellCheck: false, + defaultVisibleValue: _this._currentVisibleValue, + suggestedDisplayValue, + // eslint-disable-next-line @typescript-eslint/no-deprecated + updateValueInWillReceiveProps: _this._onUpdateValueInAutofillWillReceiveProps, + shouldSelectFullInputValueInComponentDidUpdate: _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate, + title, + preventValueSelection: !_this._hasFocus(), + placeholder, + tabIndex: disabled ? -1 : tabIndex + }, autofill)), + React__namespace.createElement(IconButton, __assign$1({ className: "ms-ComboBox-CaretDown-button", styles: _this._getCaretButtonStyles(), role: isButtonAriaHidden ? "presentation" : void 0, "aria-hidden": isButtonAriaHidden }, !isButtonAriaHidden ? labelProps : void 0, { "data-is-focusable": false, tabIndex: -1, onClick: _this._onComboBoxClick, onBlur: _this._onBlur, iconProps: buttonIconProps, disabled, checked: isOpen }, iconButtonProps)) + ); + }; + _this._onShouldSelectFullInputValueInAutofillComponentDidUpdate = function() { + return _this._currentVisibleValue === _this.props.hoisted.suggestedDisplayValue; + }; + _this._getVisibleValue = function() { + var _a2 = _this.props, text2 = _a2.text, allowFreeform = _a2.allowFreeform, allowFreeInput = _a2.allowFreeInput, autoComplete = _a2.autoComplete, _b2 = _a2.hoisted, suggestedDisplayValue = _b2.suggestedDisplayValue, selectedIndices = _b2.selectedIndices, currentOptions = _b2.currentOptions; + var _c2 = _this.state, currentPendingValueValidIndex = _c2.currentPendingValueValidIndex, currentPendingValue = _c2.currentPendingValue, isOpen = _c2.isOpen; + var currentPendingIndexValid = indexWithinBounds(currentOptions, currentPendingValueValidIndex); + if (!(isOpen && currentPendingIndexValid) && (text2 || text2 === "") && (currentPendingValue === null || currentPendingValue === void 0)) { + return text2; + } + if (_this.props.multiSelect) { + if (_this._hasFocus()) { + var index2 = -1; + if (autoComplete === "on" && currentPendingIndexValid) { + index2 = currentPendingValueValidIndex; + } + return _this._getPendingString(currentPendingValue, currentOptions, index2); } else { - // Single-select - var index = _this._getFirstSelectedIndex(); - if (allowFreeform || allowFreeInput) { - // If we are allowing freeform/free input and autocomplete is also true - // and we've got a pending value that matches an option, remember - // the matched option's index - if (autoComplete === 'on' && currentPendingIndexValid) index = currentPendingValueValidIndex; - // Since we are allowing freeform, if there is currently a pending value, use that - // otherwise use the index determined above (falling back to '' if we did not get a valid index) - return _this._getPendingString(currentPendingValue, currentOptions, index); - } else { - // If we are not allowing freeform and have a valid index that matches the pending value, - // we know we will need some version of the pending value - if (currentPendingIndexValid && autoComplete === 'on') { - // If autoComplete is on, return the raw pending value, otherwise remember - // the matched option's index - index = currentPendingValueValidIndex; - return normalizeToString(currentPendingValue); - } else if (!_this.state.isOpen && currentPendingValue) return indexWithinBounds(currentOptions, index) ? currentPendingValue : normalizeToString(suggestedDisplayValue); - else return indexWithinBounds(currentOptions, index) ? getPreviewText(currentOptions[index]) : normalizeToString(suggestedDisplayValue); - } - } - }; - /** - * Handler for typing changes on the input - * @param updatedValue - the newly changed value - */ _this._onInputChange = function(updatedValue) { - if (_this.props.disabled) { - _this._handleInputWhenDisabled(null); - return; - } - if (_this.props.onInputValueChange) _this.props.onInputValueChange(updatedValue); - _this.props.allowFreeform || _this.props.allowFreeInput ? _this._processInputChangeWithFreeform(updatedValue) : _this._processInputChangeWithoutFreeform(updatedValue); - }; - /** - * Focus (and select) the content of the input - * and set the focused state - */ _this._onFocus = function() { - var _a, _b; - (_b = (_a = _this._autofill.current) === null || _a === void 0 ? void 0 : _a.inputElement) === null || _b === void 0 || _b.select(); - if (!_this._hasFocus()) _this.setState({ - focusState: 'focusing' - }); - }; - /** - * Callback issued when the options should be resolved, if they have been updated or - * if they need to be passed in the first time. This only does work if an onResolveOptions - * callback was passed in - */ _this._onResolveOptions = function() { - if (_this.props.onResolveOptions) { - // get the options - var newOptions_1 = _this.props.onResolveOptions((0, _tslib.__spreadArray)([], _this.props.hoisted.currentOptions, true)); - // Check to see if the returned value is an array, if it is update the state - // If the returned value is not an array then check to see if it's a promise or PromiseLike. - // If it is then resolve it asynchronously. - if (Array.isArray(newOptions_1)) _this.props.hoisted.setCurrentOptions(newOptions_1); - else if (newOptions_1 && newOptions_1.then) { - // Ensure that the promise will only use the callback if it was the most recent one - // and update the state when the promise returns - _this._currentPromise = newOptions_1; - newOptions_1.then(function(newOptionsFromPromise) { - if (newOptions_1 === _this._currentPromise) _this.props.hoisted.setCurrentOptions(newOptionsFromPromise); - }); + return _this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue); + } + } else { + var index2 = _this._getFirstSelectedIndex(); + if (allowFreeform || allowFreeInput) { + if (autoComplete === "on" && currentPendingIndexValid) { + index2 = currentPendingValueValidIndex; + } + return _this._getPendingString(currentPendingValue, currentOptions, index2); + } else { + if (currentPendingIndexValid && autoComplete === "on") { + index2 = currentPendingValueValidIndex; + return normalizeToString(currentPendingValue); + } else if (!_this.state.isOpen && currentPendingValue) { + return indexWithinBounds(currentOptions, index2) ? currentPendingValue : normalizeToString(suggestedDisplayValue); + } else { + return indexWithinBounds(currentOptions, index2) ? getPreviewText(currentOptions[index2]) : normalizeToString(suggestedDisplayValue); + } + } + } + }; + _this._onInputChange = function(updatedValue) { + if (_this.props.disabled) { + _this._handleInputWhenDisabled( + null + /* event */ + ); + return; + } + if (_this.props.onInputValueChange) { + _this.props.onInputValueChange(updatedValue); + } + _this.props.allowFreeform || _this.props.allowFreeInput ? _this._processInputChangeWithFreeform(updatedValue) : _this._processInputChangeWithoutFreeform(updatedValue); + }; + _this._onFocus = function() { + var _a2, _b2; + (_b2 = (_a2 = _this._autofill.current) === null || _a2 === void 0 ? void 0 : _a2.inputElement) === null || _b2 === void 0 ? void 0 : _b2.select(); + if (!_this._hasFocus()) { + _this.setState({ focusState: "focusing" }); + } + }; + _this._onResolveOptions = function() { + if (_this.props.onResolveOptions) { + var newOptions_1 = _this.props.onResolveOptions(__spreadArray([], _this.props.hoisted.currentOptions, true)); + if (Array.isArray(newOptions_1)) { + _this.props.hoisted.setCurrentOptions(newOptions_1); + } else if (newOptions_1 && newOptions_1.then) { + _this._currentPromise = newOptions_1; + newOptions_1.then(function(newOptionsFromPromise) { + if (newOptions_1 === _this._currentPromise) { + _this.props.hoisted.setCurrentOptions(newOptionsFromPromise); } + }); } + } }; - /** - * OnBlur handler. Set the focused state to false - * and submit any pending value - */ // eslint-disable-next-line deprecation/deprecation - _this._onBlur = function(event) { - var _a, _b; - var doc = (0, _dom.getDocumentEx)(_this.context); - // Do nothing if the blur is coming from something - // inside the comboBox root or the comboBox menu since - // it we are not really blurring from the whole comboBox - var relatedTarget = event.relatedTarget; - if (event.relatedTarget === null) // In IE11, due to lack of support, event.relatedTarget is always - // null making every onBlur call to be "outside" of the ComboBox - // even when it's not. Using document.activeElement is another way - // for us to be able to get what the relatedTarget without relying - // on the event + _this._onBlur = function(event2) { + var _a2, _b2; + var doc = getDocumentEx(_this.context); + var relatedTarget = event2.relatedTarget; + if (event2.relatedTarget === null) { relatedTarget = doc === null || doc === void 0 ? void 0 : doc.activeElement; - if (relatedTarget) { - var isBlurFromComboBoxTitle = (_a = _this.props.hoisted.rootRef.current) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget); - var isBlurFromComboBoxMenu = (_b = _this._comboBoxMenu.current) === null || _b === void 0 ? void 0 : _b.contains(relatedTarget); - var isBlurFromComboBoxMenuAncestor = _this._comboBoxMenu.current && (0, _utilities.findElementRecursive)(_this._comboBoxMenu.current, function(element) { - return element === relatedTarget; - }, doc); - if (isBlurFromComboBoxTitle || isBlurFromComboBoxMenu || isBlurFromComboBoxMenuAncestor) { - if (isBlurFromComboBoxMenuAncestor && _this._hasFocus() && (!_this.props.multiSelect || _this.props.allowFreeform)) _this._submitPendingValue(event); - event.preventDefault(); - event.stopPropagation(); - return; - } - } - if (_this._hasFocus()) { - _this.setState({ - focusState: 'none' - }); - if (!_this.props.multiSelect || _this.props.allowFreeform) _this._submitPendingValue(event); - } - }; - // Render Callout container and pass in list - _this._onRenderContainer = function(props, defaultRender) { - var onRenderList = props.onRenderList, calloutProps = props.calloutProps, dropdownWidth = props.dropdownWidth, dropdownMaxWidth = props.dropdownMaxWidth, _a = props.onRenderUpperContent, onRenderUpperContent = _a === void 0 ? _this._onRenderUpperContent : _a, _b = props.onRenderLowerContent, onRenderLowerContent = _b === void 0 ? _this._onRenderLowerContent : _b, useComboBoxAsMenuWidth = props.useComboBoxAsMenuWidth, persistMenu = props.persistMenu, _c = props.shouldRestoreFocus, shouldRestoreFocus = _c === void 0 ? true : _c; - var isOpen = _this.state.isOpen; - var id = _this._id; - var comboBoxMenuWidth = useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? _this._comboBoxWrapper.current.clientWidth + 2 : undefined; - return _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - isBeakVisible: false, - gapSpace: 0, - doNotLayer: false, - directionalHint: (0, _callout.DirectionalHint).bottomLeftEdge, - directionalHintFixed: false - }, calloutProps, { - onLayerMounted: _this._onLayerMounted, - className: (0, _utilities.css)(_this._classNames.callout, calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.className), - target: _this._comboBoxWrapper.current, - onDismiss: _this._onDismiss, - onMouseDown: _this._onCalloutMouseDown, - onScroll: _this._onScroll, - setInitialFocus: false, - calloutWidth: useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? comboBoxMenuWidth && comboBoxMenuWidth : dropdownWidth, - calloutMaxWidth: dropdownMaxWidth ? dropdownMaxWidth : comboBoxMenuWidth, - hidden: persistMenu ? !isOpen : undefined, - shouldRestoreFocus: shouldRestoreFocus, - // eslint-disable-next-line react/jsx-no-bind - preventDismissOnEvent: function(ev) { - return _this._preventDismissOnScrollOrResize(ev); - } - }), onRenderUpperContent(_this.props, _this._onRenderUpperContent), _react.createElement("div", { - className: _this._classNames.optionsContainerWrapper, - ref: _this._comboBoxMenu - }, onRenderList === null || onRenderList === void 0 ? void 0 : onRenderList((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - id: id - }), _this._onRenderList)), onRenderLowerContent(_this.props, _this._onRenderLowerContent)); + } + if (relatedTarget) { + var isBlurFromComboBoxTitle = (_a2 = _this.props.hoisted.rootRef.current) === null || _a2 === void 0 ? void 0 : _a2.contains(relatedTarget); + var isBlurFromComboBoxMenu = (_b2 = _this._comboBoxMenu.current) === null || _b2 === void 0 ? void 0 : _b2.contains(relatedTarget); + var isBlurFromComboBoxMenuAncestor = _this._comboBoxMenu.current && findElementRecursive(_this._comboBoxMenu.current, function(element2) { + return element2 === relatedTarget; + }, doc); + if (isBlurFromComboBoxTitle || isBlurFromComboBoxMenu || isBlurFromComboBoxMenuAncestor) { + if (isBlurFromComboBoxMenuAncestor && _this._hasFocus() && (!_this.props.multiSelect || _this.props.allowFreeform)) { + _this._submitPendingValue(event2); + } + event2.preventDefault(); + event2.stopPropagation(); + return; + } + } + if (_this._hasFocus()) { + _this.setState({ focusState: "none" }); + if (!_this.props.multiSelect || _this.props.allowFreeform) { + _this._submitPendingValue(event2); + } + } + }; + _this._onRenderContainer = function(props2, defaultRender) { + var onRenderList = props2.onRenderList, calloutProps = props2.calloutProps, dropdownWidth2 = props2.dropdownWidth, dropdownMaxWidth = props2.dropdownMaxWidth, _a2 = props2.onRenderUpperContent, onRenderUpperContent = _a2 === void 0 ? _this._onRenderUpperContent : _a2, _b2 = props2.onRenderLowerContent, onRenderLowerContent = _b2 === void 0 ? _this._onRenderLowerContent : _b2, useComboBoxAsMenuWidth = props2.useComboBoxAsMenuWidth, persistMenu = props2.persistMenu, _c2 = props2.shouldRestoreFocus, shouldRestoreFocus = _c2 === void 0 ? true : _c2; + var isOpen = _this.state.isOpen; + var id2 = _this._id; + var comboBoxMenuWidth = useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? _this._comboBoxWrapper.current.clientWidth + 2 : void 0; + return React__namespace.createElement( + Callout, + __assign$1({ isBeakVisible: false, gapSpace: 0, doNotLayer: false, directionalHint: DirectionalHint.bottomLeftEdge, directionalHintFixed: false }, calloutProps, { + onLayerMounted: _this._onLayerMounted, + className: css(_this._classNames.callout, calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.className), + target: _this._comboBoxWrapper.current, + onDismiss: _this._onDismiss, + onMouseDown: _this._onCalloutMouseDown, + onScroll: _this._onScroll, + setInitialFocus: false, + calloutWidth: useComboBoxAsMenuWidth && _this._comboBoxWrapper.current ? comboBoxMenuWidth && comboBoxMenuWidth : dropdownWidth2, + calloutMaxWidth: dropdownMaxWidth ? dropdownMaxWidth : comboBoxMenuWidth, + hidden: persistMenu ? !isOpen : void 0, + // eslint-disable-next-line @typescript-eslint/no-deprecated + shouldRestoreFocus, + // eslint-disable-next-line react/jsx-no-bind + preventDismissOnEvent: function(ev) { + return _this._preventDismissOnScrollOrResize(ev); + } + }), + onRenderUpperContent(_this.props, _this._onRenderUpperContent), + React__namespace.createElement("div", { className: _this._classNames.optionsContainerWrapper, ref: _this._comboBoxMenu }, onRenderList === null || onRenderList === void 0 ? void 0 : onRenderList(__assign$1(__assign$1({}, props2), { id: id2 }), _this._onRenderList)), + onRenderLowerContent(_this.props, _this._onRenderLowerContent) + ); }; _this._onLayerMounted = function() { - _this._onCalloutLayerMounted(); - // need to call this again here to get the correct scroll parent dimensions - // when the callout is first opened - _this._async.setTimeout(function() { - _this._scrollIntoView(); - }, 0); - if (_this.props.calloutProps && _this.props.calloutProps.onLayerMounted) _this.props.calloutProps.onLayerMounted(); + _this._onCalloutLayerMounted(); + _this._async.setTimeout(function() { + _this._scrollIntoView(); + }, 0); + if (_this.props.calloutProps && _this.props.calloutProps.onLayerMounted) { + _this.props.calloutProps.onLayerMounted(); + } }; _this._onRenderLabel = function(onRenderLabelProps) { - var _a = onRenderLabelProps.props, label = _a.label, disabled = _a.disabled, required = _a.required; - if (label) return _react.createElement((0, _label.Label), { - id: _this._id + '-label', - disabled: disabled, - required: required, - className: _this._classNames.label - }, label, onRenderLabelProps.multiselectAccessibleText && _react.createElement("span", { - className: _this._classNames.screenReaderText - }, onRenderLabelProps.multiselectAccessibleText)); - return null; - }; - // Render List of items - _this._onRenderList = function(props) { - var _a = props.onRenderItem, onRenderItem = _a === void 0 ? _this._onRenderItem : _a, label = props.label, ariaLabel = props.ariaLabel, multiSelect = props.multiSelect; - var queue = { - items: [] - }; - var renderedList = []; - var emptyQueue = function() { - var newGroup = queue.id ? [ - _react.createElement("div", { - role: "group", - key: queue.id, - "aria-labelledby": queue.id - }, queue.items) - ] : queue.items; - renderedList = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], renderedList, true), newGroup, true); - // Flush items and id - queue = { - items: [] - }; - }; - var placeRenderedOptionIntoQueue = function(item, index) { - /* - Case Header - empty queue if it's not already empty - ensure unique ID for header and set queue ID - push header into queue - Case Divider - push divider into queue if not first item - empty queue if not already empty - Default - push item into queue - */ switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - queue.items.length > 0 && emptyQueue(); - var id_1 = _this._id + item.key; - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({ - id: id_1 - }, item), { - index: index - }), _this._onRenderItem)); - queue.id = id_1; - break; - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - index > 0 && queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); - queue.items.length > 0 && emptyQueue(); - break; - default: - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); - } - }; - // Place options into the queue. Queue will be emptied anytime a Header or Divider is encountered - props.options.forEach(function(item, index) { - placeRenderedOptionIntoQueue(item, index); - }); - // Push remaining items into all renderedList - queue.items.length > 0 && emptyQueue(); - var id = _this._id; - return _react.createElement("div", { - id: id + '-list', - className: _this._classNames.optionsContainer, - "aria-labelledby": label && id + '-label', - "aria-label": ariaLabel && !label ? ariaLabel : undefined, - "aria-multiselectable": multiSelect ? 'true' : undefined, - role: "listbox" - }, renderedList); + var _a2 = onRenderLabelProps.props, label2 = _a2.label, disabled = _a2.disabled, required2 = _a2.required; + if (label2) { + return React__namespace.createElement( + Label$2, + { id: _this._id + "-label", disabled, required: required2, className: _this._classNames.label }, + label2, + onRenderLabelProps.multiselectAccessibleText && React__namespace.createElement("span", { className: _this._classNames.screenReaderText }, onRenderLabelProps.multiselectAccessibleText) + ); + } + return null; + }; + _this._onRenderList = function(props2) { + var _a2 = props2.onRenderItem, onRenderItem = _a2 === void 0 ? _this._onRenderItem : _a2, label2 = props2.label, ariaLabel2 = props2.ariaLabel, multiSelect = props2.multiSelect; + var queue = { items: [] }; + var renderedList = []; + var emptyQueue = function() { + var newGroup = queue.id ? [ + React__namespace.createElement("div", { role: "group", key: queue.id, "aria-labelledby": queue.id }, queue.items) + ] : queue.items; + renderedList = __spreadArray(__spreadArray([], renderedList, true), newGroup, true); + queue = { items: [] }; + }; + var placeRenderedOptionIntoQueue = function(item, index2) { + switch (item.itemType) { + case SelectableOptionMenuItemType.Header: + queue.items.length > 0 && emptyQueue(); + var id_1 = _this._id + item.key; + queue.items.push(onRenderItem(__assign$1(__assign$1({ id: id_1 }, item), { index: index2 }), _this._onRenderItem)); + queue.id = id_1; + break; + case SelectableOptionMenuItemType.Divider: + index2 > 0 && queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); + queue.items.length > 0 && emptyQueue(); + break; + default: + queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); + } + }; + props2.options.forEach(function(item, index2) { + placeRenderedOptionIntoQueue(item, index2); + }); + queue.items.length > 0 && emptyQueue(); + var id2 = _this._id; + return React__namespace.createElement("div", { id: id2 + "-list", className: _this._classNames.optionsContainer, "aria-labelledby": label2 && id2 + "-label", "aria-label": ariaLabel2 && !label2 ? ariaLabel2 : void 0, "aria-multiselectable": multiSelect ? "true" : void 0, role: "listbox" }, renderedList); }; - // Render items _this._onRenderItem = function(item) { - switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - return _this._renderSeparator(item); - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - return _this._renderHeader(item); - default: - return _this._renderOption(item); - } + switch (item.itemType) { + case SelectableOptionMenuItemType.Divider: + return _this._renderSeparator(item); + case SelectableOptionMenuItemType.Header: + return _this._renderHeader(item); + default: + return _this._renderOption(item); + } }; - // Default _onRenderLowerContent function returns nothing _this._onRenderLowerContent = function() { - return null; + return null; }; - // Default _onRenderUpperContent function returns nothing _this._onRenderUpperContent = function() { - return null; + return null; }; _this._renderOption = function(item) { - var _a; - var _b = _this.props.onRenderOption, onRenderOption = _b === void 0 ? _this._onRenderOptionContent : _b; - var id = (_a = item.id) !== null && _a !== void 0 ? _a : _this._id + '-list' + item.index; - var isSelected = _this._isOptionSelected(item.index); - var isChecked = _this._isOptionChecked(item.index); - var isIndeterminate = _this._isOptionIndeterminate(item.index); - var optionStyles = _this._getCurrentOptionStyles(item); - var optionClassNames = (0, _comboBoxClassNames.getComboBoxOptionClassNames)(optionStyles); - var title = item.title; - var getOptionComponent = function() { - return !_this.props.multiSelect ? _react.createElement((0, _button.CommandButton), { - id: id, - key: item.key, - "data-index": item.index, - styles: optionStyles, - checked: isSelected, - className: 'ms-ComboBox-option', - onClick: _this._onItemClick(item), - // eslint-disable-next-line react/jsx-no-bind - onMouseEnter: _this._onOptionMouseEnter.bind(_this, item.index), - // eslint-disable-next-line react/jsx-no-bind - onMouseMove: _this._onOptionMouseMove.bind(_this, item.index), - onMouseLeave: _this._onOptionMouseLeave, - role: "option", - "aria-selected": isSelected ? 'true' : 'false', - ariaLabel: item.ariaLabel, - disabled: item.disabled, - title: title - }, _react.createElement("span", { - className: optionClassNames.optionTextWrapper, - ref: isSelected ? _this._selectedElement : undefined - }, onRenderOption(item, _this._onRenderOptionContent))) : _react.createElement((0, _checkbox.Checkbox), { - id: id, - ariaLabel: item.ariaLabel, - ariaLabelledBy: item.ariaLabel ? undefined : id + '-label', - key: item.key, - styles: optionStyles, - className: 'ms-ComboBox-option', - onChange: _this._onItemClick(item), - label: item.text, - checked: isChecked, - indeterminate: isIndeterminate, - title: title, - disabled: item.disabled, - // eslint-disable-next-line react/jsx-no-bind - onRenderLabel: _this._renderCheckboxLabel.bind(_this, (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - id: id + '-label' - })), - inputProps: (0, _tslib.__assign)({ - // aria-selected should only be applied to checked items, not hovered items - 'aria-selected': isChecked ? 'true' : 'false', - role: 'option' - }, { - 'data-index': item.index, - 'data-is-focusable': true - }) - }); - }; - return _react.createElement(ComboBoxOptionWrapper, { - key: item.key, - index: item.index, - disabled: item.disabled, - isSelected: isSelected, - isChecked: isChecked, - isIndeterminate: isIndeterminate, - text: item.text, - // eslint-disable-next-line react/jsx-no-bind - render: getOptionComponent, - data: item.data + var _a2; + var _b2 = _this.props.onRenderOption, onRenderOption = _b2 === void 0 ? _this._onRenderOptionContent : _b2; + var id2 = (_a2 = item.id) !== null && _a2 !== void 0 ? _a2 : _this._id + "-list" + item.index; + var isSelected = _this._isOptionSelected(item.index); + var isChecked = _this._isOptionChecked(item.index); + var isIndeterminate = _this._isOptionIndeterminate(item.index); + var optionStyles = _this._getCurrentOptionStyles(item); + var optionClassNames = getComboBoxOptionClassNames(optionStyles); + var title = item.title; + var getOptionComponent = function() { + return !_this.props.multiSelect ? React__namespace.createElement(CommandButton, { + id: id2, + key: item.key, + "data-index": item.index, + styles: optionStyles, + checked: isSelected, + className: "ms-ComboBox-option", + onClick: _this._onItemClick(item), + // eslint-disable-next-line react/jsx-no-bind + onMouseEnter: _this._onOptionMouseEnter.bind(_this, item.index), + // eslint-disable-next-line react/jsx-no-bind + onMouseMove: _this._onOptionMouseMove.bind(_this, item.index), + onMouseLeave: _this._onOptionMouseLeave, + role: "option", + "aria-selected": isSelected ? "true" : "false", + ariaLabel: item.ariaLabel, + disabled: item.disabled, + title + }, React__namespace.createElement("span", { className: optionClassNames.optionTextWrapper, ref: isSelected ? _this._selectedElement : void 0 }, onRenderOption(item, _this._onRenderOptionContent))) : React__namespace.createElement(Checkbox, { + id: id2, + ariaLabel: item.ariaLabel, + ariaLabelledBy: item.ariaLabel ? void 0 : id2 + "-label", + key: item.key, + styles: optionStyles, + className: "ms-ComboBox-option", + onChange: _this._onItemClick(item), + label: item.text, + checked: isChecked, + indeterminate: isIndeterminate, + title, + disabled: item.disabled, + // eslint-disable-next-line react/jsx-no-bind + onRenderLabel: _this._renderCheckboxLabel.bind(_this, __assign$1(__assign$1({}, item), { id: id2 + "-label" })), + inputProps: __assign$1({ + // aria-selected should only be applied to checked items, not hovered items + "aria-selected": isChecked ? "true" : "false", + role: "option" + }, { + "data-index": item.index, + "data-is-focusable": true + }) }); - }; - /** - * Mouse clicks to headers, dividers and scrollbar should not make input lose focus - */ _this._onCalloutMouseDown = function(ev) { - ev.preventDefault(); - }; - /** - * Scroll handler for the callout to make sure the mouse events - * for updating focus are not interacting during scroll - */ _this._onScroll = function() { - var _a; - if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) { - _this._async.clearTimeout(_this._scrollIdleTimeoutId); - _this._scrollIdleTimeoutId = undefined; - } else _this._isScrollIdle = false; - if ((_a = _this.props.calloutProps) === null || _a === void 0 ? void 0 : _a.onScroll) _this.props.calloutProps.onScroll(); - _this._scrollIdleTimeoutId = _this._async.setTimeout(function() { - _this._isScrollIdle = true; - }, ScrollIdleDelay); + }; + return React__namespace.createElement(ComboBoxOptionWrapper, { + key: item.key, + index: item.index, + disabled: item.disabled, + isSelected, + isChecked, + isIndeterminate, + text: item.text, + // eslint-disable-next-line react/jsx-no-bind + render: getOptionComponent, + data: item.data + }); + }; + _this._onCalloutMouseDown = function(ev) { + ev.preventDefault(); + }; + _this._onScroll = function() { + var _a2; + if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== void 0) { + _this._async.clearTimeout(_this._scrollIdleTimeoutId); + _this._scrollIdleTimeoutId = void 0; + } else { + _this._isScrollIdle = false; + } + if ((_a2 = _this.props.calloutProps) === null || _a2 === void 0 ? void 0 : _a2.onScroll) { + _this.props.calloutProps.onScroll(); + } + _this._scrollIdleTimeoutId = _this._async.setTimeout(function() { + _this._isScrollIdle = true; + }, ScrollIdleDelay); }; _this._onRenderOptionContent = function(item) { - var optionClassNames = (0, _comboBoxClassNames.getComboBoxOptionClassNames)(_this._getCurrentOptionStyles(item)); - return _react.createElement("span", { - className: optionClassNames.optionText - }, item.text); + var optionClassNames = getComboBoxOptionClassNames(_this._getCurrentOptionStyles(item)); + return React__namespace.createElement("span", { className: optionClassNames.optionText }, item.text); }; - /* - * Render content of a multiselect item label. - * Text within the label is aria-hidden, to prevent duplicate input/label exposure - */ _this._onRenderMultiselectOptionContent = function(item) { - var optionClassNames = (0, _comboBoxClassNames.getComboBoxOptionClassNames)(_this._getCurrentOptionStyles(item)); - return _react.createElement("span", { - id: item.id, - "aria-hidden": "true", - className: optionClassNames.optionText - }, item.text); + _this._onRenderMultiselectOptionContent = function(item) { + var optionClassNames = getComboBoxOptionClassNames(_this._getCurrentOptionStyles(item)); + return React__namespace.createElement("span", { id: item.id, "aria-hidden": "true", className: optionClassNames.optionText }, item.text); }; - /** - * Handles dismissing (cancelling) the menu - */ _this._onDismiss = function() { - var onMenuDismiss = _this.props.onMenuDismiss; - if (onMenuDismiss) onMenuDismiss(); - // In persistMode we need to simulate callout layer mount - // since that only happens once. We do it on dismiss since - // it works either way. - if (_this.props.persistMenu) _this._onCalloutLayerMounted(); - // close the menu - _this._setOpenStateAndFocusOnClose(false, false); - // reset the selected index - // to the last value state - _this._resetSelectedIndex(); + _this._onDismiss = function() { + var onMenuDismiss = _this.props.onMenuDismiss; + if (onMenuDismiss) { + onMenuDismiss(); + } + if (_this.props.persistMenu) { + _this._onCalloutLayerMounted(); + } + _this._setOpenStateAndFocusOnClose( + false, + false + /* focusInputAfterClose */ + ); + _this._resetSelectedIndex(); }; _this._onAfterClearPendingInfo = function() { - _this._processingClearPendingInfo = false; - }; - /** - * Handle keydown on the input - * @param ev - The keyboard event that was fired - */ _this._onInputKeyDown = function(ev) { - var _a = _this.props, disabled = _a.disabled, allowFreeform = _a.allowFreeform, allowFreeInput = _a.allowFreeInput, allowParentArrowNavigation = _a.allowParentArrowNavigation, autoComplete = _a.autoComplete, currentOptions = _a.hoisted.currentOptions; - var _b = _this.state, isOpen = _b.isOpen, currentPendingValueValidIndexOnHover = _b.currentPendingValueValidIndexOnHover; - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in _onInputKeyUp for reasoning. - _this._lastKeyDownWasAltOrMeta = isAltOrMeta(ev); - if (disabled) { - _this._handleInputWhenDisabled(ev); + _this._processingClearPendingInfo = false; + }; + _this._onInputKeyDown = function(ev) { + var _a2 = _this.props, disabled = _a2.disabled, allowFreeform = _a2.allowFreeform, allowFreeInput = _a2.allowFreeInput, allowParentArrowNavigation = _a2.allowParentArrowNavigation, autoComplete = _a2.autoComplete, currentOptions = _a2.hoisted.currentOptions; + var _b2 = _this.state, isOpen = _b2.isOpen, currentPendingValueValidIndexOnHover = _b2.currentPendingValueValidIndexOnHover; + _this._lastKeyDownWasAltOrMeta = isAltOrMeta(ev); + if (disabled) { + _this._handleInputWhenDisabled(ev); + return; + } + var index2 = _this._getPendingSelectedIndex( + false + /* includeCurrentPendingValue */ + ); + switch (ev.which) { + case KeyCodes.enter: + if (_this._autofill.current && _this._autofill.current.inputElement) { + _this._autofill.current.inputElement.select(); + } + _this._submitPendingValue(ev); + if (_this.props.multiSelect && isOpen) { + _this.setState({ + currentPendingValueValidIndex: index2 + }); + } else { + if (isOpen || (!allowFreeform || _this.state.currentPendingValue === void 0 || _this.state.currentPendingValue === null || _this.state.currentPendingValue.length <= 0) && _this.state.currentPendingValueValidIndex < 0) { + _this.setState({ + isOpen: !isOpen + }); + } + } + break; + case KeyCodes.tab: + if (!_this.props.multiSelect) { + _this._submitPendingValue(ev); + } + if (isOpen) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + false + /* focusInputAfterClose */ + ); + } + return; + case KeyCodes.escape: + _this._resetSelectedIndex(); + if (isOpen) { + _this.setState({ + isOpen: false + }); + } else { return; - } - var index = _this._getPendingSelectedIndex(false); - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).enter: - if (_this._autofill.current && _this._autofill.current.inputElement) _this._autofill.current.inputElement.select(); - _this._submitPendingValue(ev); - if (_this.props.multiSelect && isOpen) _this.setState({ - currentPendingValueValidIndex: index - }); - else // On enter submit the pending value - if (isOpen || (!allowFreeform || _this.state.currentPendingValue === undefined || _this.state.currentPendingValue === null || _this.state.currentPendingValue.length <= 0) && _this.state.currentPendingValueValidIndex < 0) // if we are open or - // if we are not allowing freeform or - // our we have no pending value - // and no valid pending index - // flip the open state - _this.setState({ - isOpen: !isOpen - }); - break; - case (0, _utilities.KeyCodes).tab: - // On enter submit the pending value - if (!_this.props.multiSelect) _this._submitPendingValue(ev); - // If we are not allowing freeform - // or the combo box is open, flip the open state - if (isOpen) _this._setOpenStateAndFocusOnClose(!isOpen, false); - // Allow TAB to propagate - return; - case (0, _utilities.KeyCodes).escape: - // reset the selected index - _this._resetSelectedIndex(); - // Close the menu if opened - if (isOpen) _this.setState({ - isOpen: false - }); - else return; - break; - case (0, _utilities.KeyCodes).up: - // if we are in clearAll state (e.g. the user as hovering - // and has since mousedOut of the menu items), - // go to the last index - if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) index = _this.props.hoisted.currentOptions.length; - if (ev.altKey || ev.metaKey) { - // Close the menu if it is open and break so - // that the event get stopPropagation and prevent default. - // Otherwise, we need to let the event continue to propagate - if (isOpen) { - _this._setOpenStateAndFocusOnClose(!isOpen, true); - break; - } - return; - } - // do not scroll page - ev.preventDefault(); - // Go to the previous option - _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.backward); - break; - case (0, _utilities.KeyCodes).down: - // Expand the combo box on ALT + DownArrow - if (ev.altKey || ev.metaKey) _this._setOpenStateAndFocusOnClose(true, true); - else { - // if we are in clearAll state (e.g. the user as hovering - // and has since mousedOut of the menu items), - // go to the first index - if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) index = -1; - // do not scroll page - ev.preventDefault(); - // Got to the next option - _this._setPendingInfoFromIndexAndDirection(index, SearchDirection.forward); - } - break; - case (0, _utilities.KeyCodes).home: - case (0, _utilities.KeyCodes).end: - if (allowFreeform || allowFreeInput) return; - // Set the initial values to respond to HOME - // which goes to the first selectable option - index = -1; - var directionToSearch = SearchDirection.forward; - // If end, update the values to respond to END - // which goes to the last selectable option - // eslint-disable-next-line deprecation/deprecation - if (ev.which === (0, _utilities.KeyCodes).end) { - index = currentOptions.length; - directionToSearch = SearchDirection.backward; - } - _this._setPendingInfoFromIndexAndDirection(index, directionToSearch); - break; - /* eslint-disable no-fallthrough */ case (0, _utilities.KeyCodes).space: - // event handled in _onComboBoxKeyUp - if (!allowFreeform && !allowFreeInput && autoComplete === 'off') break; - default: - /* eslint-enable no-fallthrough */ // are we processing a function key? if so bail out - // eslint-disable-next-line deprecation/deprecation - if (ev.which >= 112 /* F1 */ && ev.which <= 123 /* F12 */ ) return; - // If we get here and we got either and ALT key - // or meta key, let the event propagate - // eslint-disable-next-line deprecation/deprecation - if (ev.keyCode === (0, _utilities.KeyCodes).alt || ev.key === 'Meta' /* && isOpen */ ) return; - // eslint-disable-next-line deprecation/deprecation - if (allowParentArrowNavigation && (ev.keyCode === (0, _utilities.KeyCodes).left || ev.keyCode === (0, _utilities.KeyCodes).right)) return; - // If we are not allowing freeform or free input and - // allowing autoComplete, handle the input here - if (!allowFreeform && !allowFreeInput && autoComplete === 'on') { - _this._onInputChange(ev.key); - break; - } - // allow the key to propagate by default - return; - } - ev.stopPropagation(); - ev.preventDefault(); - }; - /** - * Handle keyup on the input - * @param ev - the keyboard event that was fired - */ _this._onInputKeyUp = function(ev) { - var _a = _this.props, disabled = _a.disabled, allowFreeform = _a.allowFreeform, allowFreeInput = _a.allowFreeInput, autoComplete = _a.autoComplete; - var isOpen = _this.state.isOpen; - // We close the menu on key up only if ALL of the following are true: - // - Most recent key down was alt or meta (command) - // - The alt/meta key down was NOT followed by some other key (such as down/up arrow to - // expand/collapse the menu) - // - We're not on a Mac (or iOS) - // This is because on Windows, pressing alt moves focus to the application menu bar or similar, - // closing any open context menus. There is not a similar behavior on Macs. - var keyPressIsAltOrMetaAlone = _this._lastKeyDownWasAltOrMeta && isAltOrMeta(ev); - _this._lastKeyDownWasAltOrMeta = false; - var shouldHandleKey = keyPressIsAltOrMetaAlone && !((0, _utilities.isMac)() || (0, _utilities.isIOS)()); - if (disabled) { - _this._handleInputWhenDisabled(ev); + } + break; + case KeyCodes.up: + if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) { + index2 = _this.props.hoisted.currentOptions.length; + } + if (ev.altKey || ev.metaKey) { + if (isOpen) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + true + /* focusInputAfterClose */ + ); + break; + } return; - } - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).space: - // If we are not allowing freeform or free input, and autoComplete is off - // make space expand/collapse the combo box - // and allow the event to propagate - if (!allowFreeform && !allowFreeInput && autoComplete === 'off') _this._setOpenStateAndFocusOnClose(!isOpen, !!isOpen); - return; - default: - if (shouldHandleKey && isOpen) _this._setOpenStateAndFocusOnClose(!isOpen, true); - else { - if (_this.state.focusState === 'focusing' && _this.props.openOnKeyboardFocus) _this.setState({ - isOpen: true - }); - if (_this.state.focusState !== 'focused') _this.setState({ - focusState: 'focused' - }); - } - return; - } + } + ev.preventDefault(); + _this._setPendingInfoFromIndexAndDirection(index2, SearchDirection.backward); + break; + case KeyCodes.down: + if (ev.altKey || ev.metaKey) { + _this._setOpenStateAndFocusOnClose( + true, + true + /* focusInputAfterClose */ + ); + } else { + if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) { + index2 = -1; + } + ev.preventDefault(); + _this._setPendingInfoFromIndexAndDirection(index2, SearchDirection.forward); + } + break; + case KeyCodes.home: + case KeyCodes.end: + if (allowFreeform || allowFreeInput) { + return; + } + index2 = -1; + var directionToSearch = SearchDirection.forward; + if (ev.which === KeyCodes.end) { + index2 = currentOptions.length; + directionToSearch = SearchDirection.backward; + } + _this._setPendingInfoFromIndexAndDirection(index2, directionToSearch); + break; + /* eslint-disable no-fallthrough */ + case KeyCodes.space: + if (!allowFreeform && !allowFreeInput && autoComplete === "off") { + break; + } + default: + if (ev.which >= 112 && ev.which <= 123) { + return; + } + if (ev.keyCode === KeyCodes.alt || ev.key === "Meta") { + return; + } + if (allowParentArrowNavigation && (ev.keyCode === KeyCodes.left || ev.keyCode === KeyCodes.right)) { + return; + } + if (!allowFreeform && !allowFreeInput && autoComplete === "on") { + _this._onInputChange(ev.key); + break; + } + return; + } + ev.stopPropagation(); + ev.preventDefault(); + }; + _this._onInputKeyUp = function(ev) { + var _a2 = _this.props, disabled = _a2.disabled, allowFreeform = _a2.allowFreeform, allowFreeInput = _a2.allowFreeInput, autoComplete = _a2.autoComplete; + var isOpen = _this.state.isOpen; + var keyPressIsAltOrMetaAlone = _this._lastKeyDownWasAltOrMeta && isAltOrMeta(ev); + _this._lastKeyDownWasAltOrMeta = false; + var shouldHandleKey = keyPressIsAltOrMetaAlone && !(isMac() || isIOS()); + if (disabled) { + _this._handleInputWhenDisabled(ev); + return; + } + switch (ev.which) { + case KeyCodes.space: + if (!allowFreeform && !allowFreeInput && autoComplete === "off") { + _this._setOpenStateAndFocusOnClose(!isOpen, !!isOpen); + } + return; + default: + if (shouldHandleKey && isOpen) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + true + /* focusInputAfterClose */ + ); + } else { + if (_this.state.focusState === "focusing" && _this.props.openOnKeyboardFocus) { + _this.setState({ isOpen: true }); + } + if (_this.state.focusState !== "focused") { + _this.setState({ focusState: "focused" }); + } + } + return; + } }; _this._onOptionMouseLeave = function() { - if (_this._shouldIgnoreMouseEvent()) return; - // Ignore the event in persistMenu mode if the callout has - // closed. This is to avoid clearing the visuals on item click. - if (_this.props.persistMenu && !_this.state.isOpen) return; - _this.setState({ - currentPendingValueValidIndexOnHover: HoverStatus.clearAll - }); - }; - /** - * Click handler for the button of the combo box and the input when not allowing freeform. - * This toggles the expand/collapse state of the combo box (if enabled). - */ _this._onComboBoxClick = function() { - var disabled = _this.props.disabled; - var isOpen = _this.state.isOpen; - if (!disabled) { - _this._setOpenStateAndFocusOnClose(!isOpen, false); - _this.setState({ - focusState: 'focused' - }); - } - }; - /** - * Click handler for the autofill. - */ _this._onAutofillClick = function() { - var _a = _this.props, disabled = _a.disabled, allowFreeform = _a.allowFreeform; - if (allowFreeform && !disabled) _this.focus(_this.state.isOpen || _this._processingTouch); - else _this._onComboBoxClick(); + if (_this._shouldIgnoreMouseEvent()) { + return; + } + if (_this.props.persistMenu && !_this.state.isOpen) { + return; + } + _this.setState({ + currentPendingValueValidIndexOnHover: HoverStatus.clearAll + }); + }; + _this._onComboBoxClick = function() { + var disabled = _this.props.disabled; + var isOpen = _this.state.isOpen; + if (!disabled) { + _this._setOpenStateAndFocusOnClose( + !isOpen, + false + /* focusInputAfterClose */ + ); + _this.setState({ focusState: "focused" }); + } + }; + _this._onAutofillClick = function() { + var _a2 = _this.props, disabled = _a2.disabled, allowFreeform = _a2.allowFreeform; + if (allowFreeform && !disabled) { + _this.focus(_this.state.isOpen || _this._processingTouch); + } else { + _this._onComboBoxClick(); + } }; _this._onTouchStart = function() { - if (_this._comboBoxWrapper.current && !('onpointerdown' in _this._comboBoxWrapper)) _this._handleTouchAndPointerEvent(); + if (_this._comboBoxWrapper.current && !("onpointerdown" in _this._comboBoxWrapper)) { + _this._handleTouchAndPointerEvent(); + } }; _this._onPointerDown = function(ev) { - if (ev.pointerType === 'touch') { - _this._handleTouchAndPointerEvent(); - ev.preventDefault(); - ev.stopImmediatePropagation(); - } + if (ev.pointerType === "touch") { + _this._handleTouchAndPointerEvent(); + ev.preventDefault(); + ev.stopImmediatePropagation(); + } }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); - _this._events = new (0, _utilities.EventGroup)(_this); - (0, _utilities.warnMutuallyExclusive)(COMPONENT_NAME, props, { - defaultSelectedKey: 'selectedKey', - text: 'defaultSelectedKey', - selectedKey: 'value', - dropdownWidth: 'useComboBoxAsMenuWidth', - ariaLabel: 'label' - }); - _this._id = props.id || (0, _utilities.getId)('ComboBox'); + initializeComponentRef(_this); + _this._async = new Async(_this); + _this._events = new EventGroup(_this); + _this._id = props.id || getId("ComboBox"); _this._isScrollIdle = true; _this._processingTouch = false; _this._gotMouseMove = false; _this._processingClearPendingInfo = false; _this.state = { - isOpen: false, - focusState: 'none', - currentPendingValueValidIndex: -1, - currentPendingValue: undefined, - currentPendingValueValidIndexOnHover: HoverStatus.default + isOpen: false, + focusState: "none", + currentPendingValueValidIndex: -1, + currentPendingValue: void 0, + currentPendingValueValidIndexOnHover: HoverStatus.default }; return _this; - } - Object.defineProperty(ComboBoxInternal.prototype, "selectedOptions", { + } + Object.defineProperty(ComboBoxInternal2.prototype, "selectedOptions", { /** * All selected options - */ get: function() { - var _a = this.props.hoisted, currentOptions = _a.currentOptions, selectedIndices = _a.selectedIndices; - return (0, _selectableOption.getAllSelectedOptions)(currentOptions, selectedIndices); + */ + get: function() { + var _a2 = this.props.hoisted, currentOptions = _a2.currentOptions, selectedIndices = _a2.selectedIndices; + return getAllSelectedOptions(currentOptions, selectedIndices); }, enumerable: false, configurable: true - }); - ComboBoxInternal.prototype.componentDidMount = function() { + }); + ComboBoxInternal2.prototype.componentDidMount = function() { if (this._comboBoxWrapper.current && !this.props.disabled) { - // hook up resolving the options if needed on focus - this._events.on(this._comboBoxWrapper.current, 'focus', this._onResolveOptions, true); - if ('onpointerdown' in this._comboBoxWrapper.current) // For ComboBoxes, touching anywhere in the combo box should drop the dropdown, including the input element. - // This gives more hit target space for touch environments. We're setting the onpointerdown here, because React - // does not support Pointer events yet. - this._events.on(this._comboBoxWrapper.current, 'pointerdown', this._onPointerDown, true); + this._events.on(this._comboBoxWrapper.current, "focus", this._onResolveOptions, true); + if ("onpointerdown" in this._comboBoxWrapper.current) { + this._events.on(this._comboBoxWrapper.current, "pointerdown", this._onPointerDown, true); + } } - }; - ComboBoxInternal.prototype.componentDidUpdate = function(prevProps, prevState) { + }; + ComboBoxInternal2.prototype.componentDidUpdate = function(prevProps, prevState) { var _this = this; - var _a, _b, _c; - var _d = this.props, allowFreeform = _d.allowFreeform, allowFreeInput = _d.allowFreeInput, text = _d.text, onMenuOpen = _d.onMenuOpen, onMenuDismissed = _d.onMenuDismissed, _e = _d.hoisted, currentOptions = _e.currentOptions, selectedIndices = _e.selectedIndices; + var _a2, _b2, _c2; + var _d2 = this.props, allowFreeform = _d2.allowFreeform, allowFreeInput = _d2.allowFreeInput, text2 = _d2.text, onMenuOpen = _d2.onMenuOpen, onMenuDismissed = _d2.onMenuDismissed, _e2 = _d2.hoisted, currentOptions = _e2.currentOptions, selectedIndices = _e2.selectedIndices; var _f = this.state, currentPendingValue = _f.currentPendingValue, currentPendingValueValidIndex = _f.currentPendingValueValidIndex, isOpen = _f.isOpen; - // If we are newly open or are open and the pending valid index changed, - // make sure the currently selected/pending option is scrolled into view - if (isOpen && (!prevState.isOpen || prevState.currentPendingValueValidIndex !== currentPendingValueValidIndex)) // Need this timeout so that the selectedElement ref is correctly updated - this._async.setTimeout(function() { + if (isOpen && (!prevState.isOpen || prevState.currentPendingValueValidIndex !== currentPendingValueValidIndex)) { + this._async.setTimeout(function() { return _this._scrollIntoView(); - }, 0); - var doc = (0, _dom.getDocumentEx)(this.context); - // if an action is taken that put focus in the ComboBox - // and If we are open or we are just closed, shouldFocusAfterClose is set, - // but we are not the activeElement set focus on the input - if (this._hasFocus() && (isOpen || prevState.isOpen && !isOpen && this._focusInputAfterClose && this._autofill.current && (doc === null || doc === void 0 ? void 0 : doc.activeElement) !== this._autofill.current.inputElement)) this.focus(undefined /*shouldOpenOnFocus*/ , true); - // If we should focusAfterClose AND - // just opened/closed the menu OR - // are focused AND - // updated the selectedIndex with the menu closed OR - // are not allowing freeform or free input OR - // the value changed - // we need to set selection - if (this._focusInputAfterClose && (prevState.isOpen && !isOpen || this._hasFocus() && (!isOpen && !this.props.multiSelect && prevProps.hoisted.selectedIndices && selectedIndices && prevProps.hoisted.selectedIndices[0] !== selectedIndices[0] || !allowFreeform && !allowFreeInput || text !== prevProps.text))) this._onFocus(); + }, 0); + } + var doc = getDocumentEx(this.context); + if (this._hasFocus() && (isOpen || prevState.isOpen && !isOpen && this._focusInputAfterClose && this._autofill.current && (doc === null || doc === void 0 ? void 0 : doc.activeElement) !== this._autofill.current.inputElement)) { + this.focus( + void 0, + true + /*useFocusAsync*/ + ); + } + if (this._focusInputAfterClose && (prevState.isOpen && !isOpen || this._hasFocus() && (!isOpen && !this.props.multiSelect && prevProps.hoisted.selectedIndices && selectedIndices && prevProps.hoisted.selectedIndices[0] !== selectedIndices[0] || !allowFreeform && !allowFreeInput || text2 !== prevProps.text))) { + this._onFocus(); + } this._notifyPendingValueChanged(prevState); if (isOpen && !prevState.isOpen) { - // handle dismiss buffer after suggestions are opened - this._overrideScrollDismiss = true; - this._async.clearTimeout(this._overrideScrollDimissTimeout); - this._overrideScrollDimissTimeout = this._async.setTimeout(function() { - _this._overrideScrollDismiss = false; - }, 100); - onMenuOpen === null || onMenuOpen === void 0 || onMenuOpen(); - } - if (!isOpen && prevState.isOpen && onMenuDismissed) onMenuDismissed(); + this._overrideScrollDismiss = true; + this._async.clearTimeout(this._overrideScrollDimissTimeout); + this._overrideScrollDimissTimeout = this._async.setTimeout(function() { + _this._overrideScrollDismiss = false; + }, 100); + onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen(); + } + if (!isOpen && prevState.isOpen && onMenuDismissed) { + onMenuDismissed(); + } var newCurrentPendingValueValidIndex = currentPendingValueValidIndex; - var options = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); + var options2 = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); }); - // If currentOptions differs from the previous currentOptions we need to update the currentPendingValueValidIndex - // otherwise, it will be out of sync with the currentOptions. This can happen when the options are filtered. - if (!(0, _utilities.shallowCompare)(prevProps.hoisted.currentOptions, currentOptions) && currentPendingValue) newCurrentPendingValueValidIndex = this.props.allowFreeform || this.props.allowFreeInput ? this._processInputChangeWithFreeform(currentPendingValue) : this._updateAutocompleteIndexWithoutFreeform(currentPendingValue); - var descendantText = undefined; - if (isOpen && this._hasFocus() && newCurrentPendingValueValidIndex !== -1) descendantText = (_a = options[newCurrentPendingValueValidIndex].id) !== null && _a !== void 0 ? _a : this._id + '-list' + newCurrentPendingValueValidIndex; - else if (isOpen && selectedIndices.length) descendantText = (_c = (_b = options[selectedIndices[0]]) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : this._id + '-list' + selectedIndices[0]; - if (descendantText !== this.state.ariaActiveDescendantValue) this.setState({ + if (!shallowCompare(prevProps.hoisted.currentOptions, currentOptions) && currentPendingValue) { + newCurrentPendingValueValidIndex = this.props.allowFreeform || this.props.allowFreeInput ? this._processInputChangeWithFreeform(currentPendingValue) : this._updateAutocompleteIndexWithoutFreeform(currentPendingValue); + } + var descendantText = void 0; + if (isOpen && this._hasFocus() && newCurrentPendingValueValidIndex !== -1) { + descendantText = (_a2 = options2[newCurrentPendingValueValidIndex].id) !== null && _a2 !== void 0 ? _a2 : this._id + "-list" + newCurrentPendingValueValidIndex; + } else if (isOpen && selectedIndices.length) { + descendantText = (_c2 = (_b2 = options2[selectedIndices[0]]) === null || _b2 === void 0 ? void 0 : _b2.id) !== null && _c2 !== void 0 ? _c2 : this._id + "-list" + selectedIndices[0]; + } + if (descendantText !== this.state.ariaActiveDescendantValue) { + this.setState({ ariaActiveDescendantValue: descendantText - }); - }; - ComboBoxInternal.prototype.componentWillUnmount = function() { + }); + } + }; + ComboBoxInternal2.prototype.componentWillUnmount = function() { this._async.dispose(); this._events.dispose(); - }; - // Primary Render - ComboBoxInternal.prototype.render = function() { - var id = this._id; - var errorMessageId = id + '-error'; - var _a = this.props, className = _a.className, disabled = _a.disabled, required = _a.required, errorMessage = _a.errorMessage, _b = _a.onRenderContainer, onRenderContainer = _b === void 0 ? this._onRenderContainer : _b, _c = _a.onRenderLabel, onRenderLabel = _c === void 0 ? this._onRenderLabel : _c, _d = _a.onRenderList, onRenderList = _d === void 0 ? this._onRenderList : _d, _e = _a.onRenderItem, onRenderItem = _e === void 0 ? this._onRenderItem : _e, _f = _a.onRenderOption, onRenderOption = _f === void 0 ? this._onRenderOptionContent : _f, allowFreeform = _a.allowFreeform, customStyles = _a.styles, theme = _a.theme, persistMenu = _a.persistMenu, multiSelect = _a.multiSelect, _g = _a.hoisted, suggestedDisplayValue = _g.suggestedDisplayValue, selectedIndices = _g.selectedIndices, currentOptions = _g.currentOptions; + }; + ComboBoxInternal2.prototype.render = function() { + var id2 = this._id; + var errorMessageId = id2 + "-error"; + var _a2 = this.props, className2 = _a2.className, disabled = _a2.disabled, required2 = _a2.required, errorMessage = _a2.errorMessage, _b2 = _a2.onRenderContainer, onRenderContainer = _b2 === void 0 ? this._onRenderContainer : _b2, _c2 = _a2.onRenderLabel, onRenderLabel = _c2 === void 0 ? this._onRenderLabel : _c2, _d2 = _a2.onRenderList, onRenderList = _d2 === void 0 ? this._onRenderList : _d2, _e2 = _a2.onRenderItem, onRenderItem = _e2 === void 0 ? this._onRenderItem : _e2, _f = _a2.onRenderOption, onRenderOption = _f === void 0 ? this._onRenderOptionContent : _f, allowFreeform = _a2.allowFreeform, customStyles = _a2.styles, theme = _a2.theme, persistMenu = _a2.persistMenu, multiSelect = _a2.multiSelect, _g = _a2.hoisted, suggestedDisplayValue = _g.suggestedDisplayValue, selectedIndices = _g.selectedIndices, currentOptions = _g.currentOptions; var isOpen = this.state.isOpen; this._currentVisibleValue = this._getVisibleValue(); - // Single select is already accessible since the whole text is selected - // when focus enters the input. Since multiselect appears to clear the input - // it needs special accessible text - var multiselectAccessibleText = multiSelect ? this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue) : undefined; - var divProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'onChange', - 'value', - 'aria-describedby', - 'aria-labelledby' + var multiselectAccessibleText = multiSelect ? this._getMultiselectDisplayString(selectedIndices, currentOptions, suggestedDisplayValue) : void 0; + var divProps = getNativeProps(this.props, divProperties, [ + "onChange", + "value", + "aria-describedby", + "aria-labelledby" ]); var hasErrorMessage = errorMessage && errorMessage.length > 0 ? true : false; - this._classNames = this.props.getClassNames ? this.props.getClassNames(theme, !!isOpen, !!disabled, !!required, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage, className) : (0, _comboBoxClassNames.getClassNames)((0, _comboBoxStyles.getStyles)(theme, customStyles), className, !!isOpen, !!disabled, !!required, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage); + this._classNames = this.props.getClassNames ? this.props.getClassNames(theme, !!isOpen, !!disabled, !!required2, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage, className2) : getClassNames$g(getStyles$f(theme, customStyles), className2, !!isOpen, !!disabled, !!required2, !!this._hasFocus(), !!allowFreeform, !!hasErrorMessage); var comboBoxWrapper = this._renderComboBoxWrapper(multiselectAccessibleText, errorMessageId); - return _react.createElement("div", (0, _tslib.__assign)({}, divProps, { - ref: this.props.hoisted.mergedRootRef, - className: this._classNames.container - }), onRenderLabel({ - props: this.props, - multiselectAccessibleText: multiselectAccessibleText - }, this._onRenderLabel), comboBoxWrapper, (persistMenu || isOpen) && onRenderContainer((0, _tslib.__assign)((0, _tslib.__assign)({}, this.props), { - onRenderList: onRenderList, - onRenderItem: onRenderItem, - onRenderOption: onRenderOption, - options: currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }), - onDismiss: this._onDismiss - }), this._onRenderContainer), hasErrorMessage && _react.createElement("div", { - role: "alert", - id: errorMessageId, - className: this._classNames.errorMessage - }, errorMessage)); - }; - ComboBoxInternal.prototype._getPendingString = function(currentPendingValue, currentOptions, index) { - return currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValue : indexWithinBounds(currentOptions, index) ? getPreviewText(currentOptions[index]) : ''; - }; - /** - * Returns a string that concatenates all of the selected values - * for multiselect combo box. - */ ComboBoxInternal.prototype._getMultiselectDisplayString = function(selectedIndices, currentOptions, suggestedDisplayValue) { + return React__namespace.createElement( + "div", + __assign$1({}, divProps, { ref: this.props.hoisted.mergedRootRef, className: this._classNames.container }), + onRenderLabel({ props: this.props, multiselectAccessibleText }, this._onRenderLabel), + comboBoxWrapper, + (persistMenu || isOpen) && onRenderContainer(__assign$1(__assign$1({}, this.props), { onRenderList, onRenderItem, onRenderOption, options: currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }), onDismiss: this._onDismiss }), this._onRenderContainer), + hasErrorMessage && React__namespace.createElement("div", { role: "alert", id: errorMessageId, className: this._classNames.errorMessage }, errorMessage) + ); + }; + ComboBoxInternal2.prototype._getPendingString = function(currentPendingValue, currentOptions, index2) { + return currentPendingValue !== null && currentPendingValue !== void 0 ? currentPendingValue : indexWithinBounds(currentOptions, index2) ? getPreviewText(currentOptions[index2]) : ""; + }; + ComboBoxInternal2.prototype._getMultiselectDisplayString = function(selectedIndices, currentOptions, suggestedDisplayValue) { var displayValues = []; - for(var idx = 0; selectedIndices && idx < selectedIndices.length; idx++){ - var index = selectedIndices[idx]; - if (currentOptions[index].itemType !== (0, _selectableOption.SelectableOptionMenuItemType).SelectAll) displayValues.push(indexWithinBounds(currentOptions, index) ? currentOptions[index].text : normalizeToString(suggestedDisplayValue)); + for (var idx = 0; selectedIndices && idx < selectedIndices.length; idx++) { + var index2 = selectedIndices[idx]; + if (currentOptions[index2].itemType !== SelectableOptionMenuItemType.SelectAll) { + displayValues.push(indexWithinBounds(currentOptions, index2) ? currentOptions[index2].text : normalizeToString(suggestedDisplayValue)); + } } - var _a = this.props.multiSelectDelimiter, multiSelectDelimiter = _a === void 0 ? ', ' : _a; + var _a2 = this.props.multiSelectDelimiter, multiSelectDelimiter = _a2 === void 0 ? ", " : _a2; return displayValues.join(multiSelectDelimiter); - }; - /** - * Do not dismiss if the window resizes or scrolls within 100ms of opening - * This prevents the Android issue where pickers immediately dismiss on open, because the keyboard appears - * @param ev - the event triggering the dismiss check - * @returns a boolean indicating whether the callout dismissal should be prevented - */ ComboBoxInternal.prototype._preventDismissOnScrollOrResize = function(ev) { - // default to passed-in preventDismiss + }; + ComboBoxInternal2.prototype._preventDismissOnScrollOrResize = function(ev) { var calloutProps = this.props.calloutProps; - if (calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.preventDismissOnEvent) return calloutProps.preventDismissOnEvent(ev); - if (this._overrideScrollDismiss && (ev.type === 'scroll' || ev.type === 'resize')) return true; + if (calloutProps === null || calloutProps === void 0 ? void 0 : calloutProps.preventDismissOnEvent) { + return calloutProps.preventDismissOnEvent(ev); + } + if (this._overrideScrollDismiss && (ev.type === "scroll" || ev.type === "resize")) { + return true; + } return false; - }; - /** - * Process the new input's new value when the combo box allows freeform entry - * @param updatedValue - the input's newly changed value - * @returns the index of the matched option, -1 if no match was found - */ ComboBoxInternal.prototype._processInputChangeWithFreeform = function(updatedValue) { + }; + ComboBoxInternal2.prototype._processInputChangeWithFreeform = function(updatedValue) { var _this = this; var currentOptions = this.props.hoisted.currentOptions; var newCurrentPendingValueValidIndex = -1; - // if the new value is empty, see if we have an exact match and then set the pending info - if (updatedValue === '') { - var items = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }).filter(function(option) { - return isNormalOption(option) && !option.disabled && getPreviewText(option) === updatedValue; - }); - // if we found a match remember the index - if (items.length === 1) newCurrentPendingValueValidIndex = items[0].index; - this._setPendingInfo(updatedValue, newCurrentPendingValueValidIndex, updatedValue); - return newCurrentPendingValueValidIndex; + if (updatedValue === "") { + var items = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }).filter(function(option) { + return isNormalOption(option) && !option.disabled && getPreviewText(option) === updatedValue; + }); + if (items.length === 1) { + newCurrentPendingValueValidIndex = items[0].index; + } + this._setPendingInfo(updatedValue, newCurrentPendingValueValidIndex, updatedValue); + return newCurrentPendingValueValidIndex; } - // Remember the original value and then make the value lowercase for comparison var originalUpdatedValue = updatedValue; - // Make the value lowercase for comparison if caseSensitive is false updatedValue = this._adjustForCaseSensitivity(updatedValue); - var newSuggestedDisplayValue = ''; - // If autoComplete is on, attempt to find a match from the available options - if (this.props.autoComplete === 'on') { - // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value - var items = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }).filter(function(option) { - return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)).indexOf(updatedValue) === 0; - }); - if (items.length > 0) { - // use ariaLabel as the value when the option is set - var text = getPreviewText(items[0]); - // If the user typed out the complete option text, we don't need any suggested display text anymore - newSuggestedDisplayValue = this._adjustForCaseSensitivity(text) !== updatedValue ? text : ''; - // remember the index of the match we found - newCurrentPendingValueValidIndex = items[0].index; - } + var newSuggestedDisplayValue = ""; + if (this.props.autoComplete === "on") { + var items = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }).filter(function(option) { + return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)).indexOf(updatedValue) === 0; + }); + if (items.length > 0) { + var text2 = getPreviewText(items[0]); + newSuggestedDisplayValue = this._adjustForCaseSensitivity(text2) !== updatedValue ? text2 : ""; + newCurrentPendingValueValidIndex = items[0].index; + } } else { - // If autoComplete is off, attempt to find a match only when the value is exactly equal to the text of an option - var items = currentOptions.map(function(item, index) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }); - }).filter(function(option) { - return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)) === updatedValue; - }); - // if we found a match remember the index - if (items.length === 1) newCurrentPendingValueValidIndex = items[0].index; + var items = currentOptions.map(function(item, index2) { + return __assign$1(__assign$1({}, item), { index: index2 }); + }).filter(function(option) { + return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(getPreviewText(option)) === updatedValue; + }); + if (items.length === 1) { + newCurrentPendingValueValidIndex = items[0].index; + } } - // Set the updated state this._setPendingInfo(originalUpdatedValue, newCurrentPendingValueValidIndex, newSuggestedDisplayValue); return newCurrentPendingValueValidIndex; - }; - /** - * Process the new input's new value when the combo box does not allow freeform entry - * @param updatedValue - the input's newly changed value - * @returns the index of the matched option - */ ComboBoxInternal.prototype._processInputChangeWithoutFreeform = function(updatedValue) { + }; + ComboBoxInternal2.prototype._processInputChangeWithoutFreeform = function(updatedValue) { var _this = this; - var _a = this.state, currentPendingValue = _a.currentPendingValue, currentPendingValueValidIndex = _a.currentPendingValueValidIndex; - if (this.props.autoComplete === 'on') // If autoComplete is on while allow freeform is off, - // we will remember the key press and build up a string to attempt to match - // as long as characters are typed within a the timeout span of each other, - // otherwise we will clear the string and start building a new one on the next keypress. - // Also, only do this processing if we have a non-empty value - { - if (updatedValue !== '') { - // If we have a pending autocomplete clearing task, - // we know that the user is typing with key press happening - // within the timeout of each other so remove the clearing task - // and continue building the pending value with the updated value - if (this._autoCompleteTimeout) { - this._async.clearTimeout(this._autoCompleteTimeout); - this._autoCompleteTimeout = undefined; - updatedValue = normalizeToString(currentPendingValue) + updatedValue; - } - var matchingIndex = this._updateAutocompleteIndexWithoutFreeform(updatedValue); - // Schedule a timeout to clear the pending value after the timeout span - this._autoCompleteTimeout = this._async.setTimeout(function() { - _this._autoCompleteTimeout = undefined; - }, ReadOnlyPendingAutoCompleteTimeout); - return matchingIndex; - } - } - // If we get here, autoComplete is off. - // Remember we are not allowing freeform, so at this point, if we have a pending valid value index - // use that; otherwise use the selectedIndex - var index = currentPendingValueValidIndex >= 0 ? currentPendingValueValidIndex : this._getFirstSelectedIndex(); - // Since we are not allowing freeform, we need to - // set both the pending and suggested values/index - // to allow us to select all content in the input to - // give the illusion that we are readonly (e.g. freeform off) - this._setPendingInfoFromIndex(index); - return index; - }; - ComboBoxInternal.prototype._updateAutocompleteIndexWithoutFreeform = function(updatedValue) { + var _a2 = this.state, currentPendingValue = _a2.currentPendingValue, currentPendingValueValidIndex = _a2.currentPendingValueValidIndex; + if (this.props.autoComplete === "on") { + if (updatedValue !== "") { + if (this._autoCompleteTimeout) { + this._async.clearTimeout(this._autoCompleteTimeout); + this._autoCompleteTimeout = void 0; + updatedValue = normalizeToString(currentPendingValue) + updatedValue; + } + var matchingIndex = this._updateAutocompleteIndexWithoutFreeform(updatedValue); + this._autoCompleteTimeout = this._async.setTimeout(function() { + _this._autoCompleteTimeout = void 0; + }, ReadOnlyPendingAutoCompleteTimeout); + return matchingIndex; + } + } + var index2 = currentPendingValueValidIndex >= 0 ? currentPendingValueValidIndex : this._getFirstSelectedIndex(); + this._setPendingInfoFromIndex(index2); + return index2; + }; + ComboBoxInternal2.prototype._updateAutocompleteIndexWithoutFreeform = function(updatedValue) { var _this = this; var currentOptions = this.props.hoisted.currentOptions; var originalUpdatedValue = updatedValue; updatedValue = this._adjustForCaseSensitivity(updatedValue); - // If autoComplete is on, attempt to find a match where the text of an option starts with the updated value var items = currentOptions.map(function(item, i) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: i - }); + return __assign$1(__assign$1({}, item), { index: i }); }).filter(function(option) { - return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(option.text).indexOf(updatedValue) === 0; + return isNormalOption(option) && !option.disabled && _this._adjustForCaseSensitivity(option.text).indexOf(updatedValue) === 0; }); - // If we found a match, update the state if (items.length > 0) { - this._setPendingInfo(originalUpdatedValue, items[0].index, getPreviewText(items[0])); - return items[0].index; + this._setPendingInfo(originalUpdatedValue, items[0].index, getPreviewText(items[0])); + return items[0].index; } return -1; - }; - ComboBoxInternal.prototype._getFirstSelectedIndex = function() { + }; + ComboBoxInternal2.prototype._getFirstSelectedIndex = function() { var selectedIndices = this.props.hoisted.selectedIndices; return (selectedIndices === null || selectedIndices === void 0 ? void 0 : selectedIndices.length) ? selectedIndices[0] : -1; - }; - /** - * Walk along the options starting at the index, stepping by the delta (positive or negative) - * looking for the next valid selectable index (e.g. skipping headings and dividers) - * @param index - the index to get the next selectable index from - * @param delta - optional delta to step by when finding the next index, defaults to 0 - * @returns - the next valid selectable index. If the new index is outside of the bounds, - * it will snap to the edge of the options array. If delta == 0 and the given index is not selectable - */ ComboBoxInternal.prototype._getNextSelectableIndex = function(index, searchDirection) { + }; + ComboBoxInternal2.prototype._getNextSelectableIndex = function(index2, searchDirection) { var currentOptions = this.props.hoisted.currentOptions; - var newIndex = index + searchDirection; + var newIndex = index2 + searchDirection; newIndex = Math.max(0, Math.min(currentOptions.length - 1, newIndex)); - if (!indexWithinBounds(currentOptions, newIndex)) return -1; + if (!indexWithinBounds(currentOptions, newIndex)) { + return -1; + } var option = currentOptions[newIndex]; if (!isSelectableOption(option) || option.hidden === true) { - // Should we continue looking for an index to select? - if (searchDirection !== SearchDirection.none && (newIndex > 0 && searchDirection < SearchDirection.none || newIndex >= 0 && newIndex < currentOptions.length && searchDirection > SearchDirection.none)) newIndex = this._getNextSelectableIndex(newIndex, searchDirection); - else // If we cannot perform a useful search just return the index we were given - return index; + if (searchDirection !== SearchDirection.none && (newIndex > 0 && searchDirection < SearchDirection.none || newIndex >= 0 && newIndex < currentOptions.length && searchDirection > SearchDirection.none)) { + newIndex = this._getNextSelectableIndex(newIndex, searchDirection); + } else { + return index2; + } } - // We have the next valid selectable index, return it return newIndex; - }; - /** - * Set the selected index. Note, this is - * the "real" selected index, not the pending selected index - * @param index - the index to set (or the index to set from if a search direction is provided) - * @param searchDirection - the direction to search along the options from the given index - */ ComboBoxInternal.prototype._setSelectedIndex = function(index, submitPendingValueEvent, searchDirection) { - if (searchDirection === void 0) searchDirection = SearchDirection.none; - var _a = this.props, onChange = _a.onChange, onPendingValueChanged = _a.onPendingValueChanged, _b = _a.hoisted, initialIndices = _b.selectedIndices, currentOptions = _b.currentOptions; - // Clone currentOptions and selectedIndices so we don't mutate state + }; + ComboBoxInternal2.prototype._setSelectedIndex = function(index2, submitPendingValueEvent, searchDirection) { + if (searchDirection === void 0) { + searchDirection = SearchDirection.none; + } + var _a2 = this.props, onChange = _a2.onChange, onPendingValueChanged = _a2.onPendingValueChanged, _b2 = _a2.hoisted, initialIndices = _b2.selectedIndices, currentOptions = _b2.currentOptions; var selectedIndices = initialIndices ? initialIndices.slice() : []; var changedOptions = currentOptions.slice(); - // Find the next selectable index, if searchDirection is none - // we will get our starting index back - index = this._getNextSelectableIndex(index, searchDirection); - if (!indexWithinBounds(currentOptions, index)) return; - // Are we at a new index? If so, update the state, otherwise - // there is nothing to do - if (this.props.multiSelect || selectedIndices.length < 1 || selectedIndices.length === 1 && selectedIndices[0] !== index) { - var option = (0, _tslib.__assign)({}, currentOptions[index]); - // if option doesn't existing, or option is disabled, we noop - if (!option || option.disabled) return; - if (this.props.multiSelect) { - // Setting the initial state of option.selected in Multi-select combo box by checking the - // selectedIndices array and overriding the undefined issue - option.selected = option.selected !== undefined ? !option.selected : selectedIndices.indexOf(index) < 0; - // handle changing all options if SelectAll is changed - if (option.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll) { - selectedIndices = []; - // if select all is set to checked, push all selectable option indices - if (option.selected) currentOptions.forEach(function(currentOption, i) { - if (!currentOption.disabled && isSelectableOption(currentOption)) { - selectedIndices.push(i); - changedOptions[i] = (0, _tslib.__assign)((0, _tslib.__assign)({}, currentOption), { - selected: true - }); - } - }); - else changedOptions = currentOptions.map(function(currentOption) { - return (0, _tslib.__assign)((0, _tslib.__assign)({}, currentOption), { - selected: false - }); - }); - } else { - if (option.selected && selectedIndices.indexOf(index) < 0) selectedIndices.push(index); - else if (!option.selected && selectedIndices.indexOf(index) >= 0) selectedIndices = selectedIndices.filter(function(value) { - return value !== index; - }); - changedOptions[index] = option; - // If SelectAll exists and another option was toggled, update the SelectAll option's state - var selectAllOption = changedOptions.filter(function(o) { - return o.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll; - })[0]; - if (selectAllOption) { - var selectAllState = this._isSelectAllChecked(selectedIndices); - var selectAllIndex_1 = changedOptions.indexOf(selectAllOption); - if (selectAllState) { - selectedIndices.push(selectAllIndex_1); - changedOptions[selectAllIndex_1] = (0, _tslib.__assign)((0, _tslib.__assign)({}, selectAllOption), { - selected: true - }); - } else { - selectedIndices = selectedIndices.filter(function(value) { - return value !== selectAllIndex_1; - }); - changedOptions[selectAllIndex_1] = (0, _tslib.__assign)((0, _tslib.__assign)({}, selectAllOption), { - selected: false - }); - } - } - } - } else selectedIndices[0] = index; - submitPendingValueEvent.persist(); - // Only setState if combo box is uncontrolled. - if (this.props.selectedKey || this.props.selectedKey === null) // If combo box value is changed, revert preview first - { - if (this._hasPendingValue && onPendingValueChanged) { - onPendingValueChanged(); - this._hasPendingValue = false; - } + index2 = this._getNextSelectableIndex(index2, searchDirection); + if (!indexWithinBounds(currentOptions, index2)) { + return; + } + if (this.props.multiSelect || selectedIndices.length < 1 || selectedIndices.length === 1 && selectedIndices[0] !== index2) { + var option = __assign$1({}, currentOptions[index2]); + if (!option || option.disabled) { + return; + } + if (this.props.multiSelect) { + option.selected = option.selected !== void 0 ? !option.selected : selectedIndices.indexOf(index2) < 0; + if (option.itemType === SelectableOptionMenuItemType.SelectAll) { + selectedIndices = []; + if (option.selected) { + currentOptions.forEach(function(currentOption, i) { + if (!currentOption.disabled && isSelectableOption(currentOption)) { + selectedIndices.push(i); + changedOptions[i] = __assign$1(__assign$1({}, currentOption), { selected: true }); + } + }); + } else { + changedOptions = currentOptions.map(function(currentOption) { + return __assign$1(__assign$1({}, currentOption), { selected: false }); + }); + } } else { - this.props.hoisted.setSelectedIndices(selectedIndices); - this.props.hoisted.setCurrentOptions(changedOptions); - // If ComboBox value is changed, revert preview first - if (this._hasPendingValue && onPendingValueChanged) { - onPendingValueChanged(); - this._hasPendingValue = false; + if (option.selected && selectedIndices.indexOf(index2) < 0) { + selectedIndices.push(index2); + } else if (!option.selected && selectedIndices.indexOf(index2) >= 0) { + selectedIndices = selectedIndices.filter(function(value2) { + return value2 !== index2; + }); + } + changedOptions[index2] = option; + var selectAllOption = changedOptions.filter(function(o) { + return o.itemType === SelectableOptionMenuItemType.SelectAll; + })[0]; + if (selectAllOption) { + var selectAllState = this._isSelectAllChecked(selectedIndices); + var selectAllIndex_1 = changedOptions.indexOf(selectAllOption); + if (selectAllState) { + selectedIndices.push(selectAllIndex_1); + changedOptions[selectAllIndex_1] = __assign$1(__assign$1({}, selectAllOption), { selected: true }); + } else { + selectedIndices = selectedIndices.filter(function(value2) { + return value2 !== selectAllIndex_1; + }); + changedOptions[selectAllIndex_1] = __assign$1(__assign$1({}, selectAllOption), { selected: false }); } - } - // Call onChange after state is updated - if (onChange) onChange(submitPendingValueEvent, option, index, getPreviewText(option)); + } + } + } else { + selectedIndices[0] = index2; + } + submitPendingValueEvent.persist(); + if (this.props.selectedKey || this.props.selectedKey === null) { + if (this._hasPendingValue && onPendingValueChanged) { + onPendingValueChanged(); + this._hasPendingValue = false; + } + } else { + this.props.hoisted.setSelectedIndices(selectedIndices); + this.props.hoisted.setCurrentOptions(changedOptions); + if (this._hasPendingValue && onPendingValueChanged) { + onPendingValueChanged(); + this._hasPendingValue = false; + } + } + if (onChange) { + onChange(submitPendingValueEvent, option, index2, getPreviewText(option)); + } + } + if (this.props.multiSelect && this.state.isOpen) { + return; } - if (this.props.multiSelect && this.state.isOpen) return; - // clear all of the pending info this._clearPendingInfo(); - }; - /** - * Submit a pending value if there is one - */ ComboBoxInternal.prototype._submitPendingValue = function(submitPendingValueEvent) { - var _a; - var _b = this.props, onChange = _b.onChange, allowFreeform = _b.allowFreeform, autoComplete = _b.autoComplete, multiSelect = _b.multiSelect, hoisted = _b.hoisted; + }; + ComboBoxInternal2.prototype._submitPendingValue = function(submitPendingValueEvent) { + var _a2; + var _b2 = this.props, onChange = _b2.onChange, allowFreeform = _b2.allowFreeform, autoComplete = _b2.autoComplete, multiSelect = _b2.multiSelect, hoisted = _b2.hoisted; var currentOptions = hoisted.currentOptions; - var _c = this.state, currentPendingValue = _c.currentPendingValue, currentPendingValueValidIndex = _c.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _c.currentPendingValueValidIndexOnHover; + var _c2 = this.state, currentPendingValue = _c2.currentPendingValue, currentPendingValueValidIndex = _c2.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _c2.currentPendingValueValidIndexOnHover; var selectedIndices = this.props.hoisted.selectedIndices; - // Do not submit any pending value if we - // have already initiated clearing the pending info - if (this._processingClearPendingInfo) return; - // If we allow freeform we need to handle that + if (this._processingClearPendingInfo) { + return; + } if (allowFreeform) { - // if currentPendingValue is null or undefined the user did not submit anything - // (not even empty because we would have stored that as the pending value) - if (currentPendingValue === null || currentPendingValue === undefined) { - // if a user did not type anything they may just hovered over an item - if (currentPendingValueValidIndexOnHover >= 0) { - this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); - this._clearPendingInfo(); - } - return; + if (currentPendingValue === null || currentPendingValue === void 0) { + if (currentPendingValueValidIndexOnHover >= 0) { + this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); + this._clearPendingInfo(); } - // Check to see if the user typed an exact match - if (indexWithinBounds(currentOptions, currentPendingValueValidIndex)) { - var pendingOptionText = this._adjustForCaseSensitivity(getPreviewText(currentOptions[currentPendingValueValidIndex])); - var autofill = this._autofill.current; - // By exact match, that means: our pending value is the same as the pending option text OR - // the pending option starts with the pending value and we have an "autoComplete" selection - // where the total length is equal to pending option length OR - // the live value in the underlying input matches the pending option; update the state - var adjustedCurrentPendingValue = this._adjustForCaseSensitivity(currentPendingValue); - if (adjustedCurrentPendingValue === pendingOptionText || autoComplete && pendingOptionText.indexOf(adjustedCurrentPendingValue) === 0 && (autofill === null || autofill === void 0 ? void 0 : autofill.isValueSelected) && currentPendingValue.length + (autofill.selectionEnd - autofill.selectionStart) === pendingOptionText.length || ((_a = autofill === null || autofill === void 0 ? void 0 : autofill.inputElement) === null || _a === void 0 ? void 0 : _a.value) !== undefined && this._adjustForCaseSensitivity(autofill.inputElement.value) === pendingOptionText) { - this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); - if (multiSelect && this.state.isOpen) return; - this._clearPendingInfo(); - return; - } + return; + } + if (indexWithinBounds(currentOptions, currentPendingValueValidIndex)) { + var pendingOptionText = this._adjustForCaseSensitivity(getPreviewText(currentOptions[currentPendingValueValidIndex])); + var autofill = this._autofill.current; + var adjustedCurrentPendingValue = this._adjustForCaseSensitivity(currentPendingValue); + if (adjustedCurrentPendingValue === pendingOptionText || autoComplete && pendingOptionText.indexOf(adjustedCurrentPendingValue) === 0 && (autofill === null || autofill === void 0 ? void 0 : autofill.isValueSelected) && currentPendingValue.length + (autofill.selectionEnd - autofill.selectionStart) === pendingOptionText.length || ((_a2 = autofill === null || autofill === void 0 ? void 0 : autofill.inputElement) === null || _a2 === void 0 ? void 0 : _a2.value) !== void 0 && this._adjustForCaseSensitivity(autofill.inputElement.value) === pendingOptionText) { + this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); + if (multiSelect && this.state.isOpen) { + return; + } + this._clearPendingInfo(); + return; } + } + if (onChange) { if (onChange) { - if (onChange) // trigger onChange to clear value - onChange(submitPendingValueEvent, undefined, undefined, currentPendingValue); - } else { - // If we are not controlled, create a new selected option - var newOption = { - key: currentPendingValue || (0, _utilities.getId)(), - text: normalizeToString(currentPendingValue) - }; - // If it's multiselect, set selected state to true - if (multiSelect) newOption.selected = true; - var newOptions = currentOptions.concat([ - newOption - ]); - if (selectedIndices) { - if (!multiSelect) selectedIndices = []; - selectedIndices.push(newOptions.length - 1); - } - hoisted.setCurrentOptions(newOptions); - hoisted.setSelectedIndices(selectedIndices); + onChange(submitPendingValueEvent, void 0, void 0, currentPendingValue); } - } else if (currentPendingValueValidIndex >= 0) // Since we are not allowing freeform, we must have a matching - // to be able to update state - this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); - else if (currentPendingValueValidIndexOnHover >= 0) // If all else failed and we were hovering over an item, select it - this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); - // Finally, clear the pending info + } else { + var newOption = { + key: currentPendingValue || getId(), + text: normalizeToString(currentPendingValue) + }; + if (multiSelect) { + newOption.selected = true; + } + var newOptions = currentOptions.concat([newOption]); + if (selectedIndices) { + if (!multiSelect) { + selectedIndices = []; + } + selectedIndices.push(newOptions.length - 1); + } + hoisted.setCurrentOptions(newOptions); + hoisted.setSelectedIndices(selectedIndices); + } + } else if (currentPendingValueValidIndex >= 0) { + this._setSelectedIndex(currentPendingValueValidIndex, submitPendingValueEvent); + } else if (currentPendingValueValidIndexOnHover >= 0) { + this._setSelectedIndex(currentPendingValueValidIndexOnHover, submitPendingValueEvent); + } this._clearPendingInfo(); - }; - ComboBoxInternal.prototype._onCalloutLayerMounted = function() { - // In persistMenu mode _onLayerMounted is only called once for the lifetime - // of the component. Any functionality required for callout "on mount" can - // go here so that we can also call it again during callout dismissal to reset - // object state. + }; + ComboBoxInternal2.prototype._onCalloutLayerMounted = function() { this._gotMouseMove = false; - }; - // Render separator - ComboBoxInternal.prototype._renderSeparator = function(item) { - var index = item.index, key = item.key; - if (index && index > 0) return _react.createElement("div", { - role: "presentation", - key: key, - className: this._classNames.divider - }); + }; + ComboBoxInternal2.prototype._renderSeparator = function(item) { + var index2 = item.index, key2 = item.key; + if (index2 && index2 > 0) { + return React__namespace.createElement("div", { role: "presentation", key: key2, className: this._classNames.divider }); + } return null; - }; - ComboBoxInternal.prototype._renderHeader = function(item) { - var _a = this.props.onRenderOption, onRenderOption = _a === void 0 ? this._onRenderOptionContent : _a; - return _react.createElement("div", { - id: item.id, - key: item.key, - className: this._classNames.header - }, onRenderOption(item, this._onRenderOptionContent)); - }; - ComboBoxInternal.prototype._renderCheckboxLabel = function(item) { - var _a = this.props.onRenderOption, onRenderOption = _a === void 0 ? this._onRenderMultiselectOptionContent : _a; + }; + ComboBoxInternal2.prototype._renderHeader = function(item) { + var _a2 = this.props.onRenderOption, onRenderOption = _a2 === void 0 ? this._onRenderOptionContent : _a2; + return React__namespace.createElement("div", { id: item.id, key: item.key, className: this._classNames.header }, onRenderOption(item, this._onRenderOptionContent)); + }; + ComboBoxInternal2.prototype._renderCheckboxLabel = function(item) { + var _a2 = this.props.onRenderOption, onRenderOption = _a2 === void 0 ? this._onRenderMultiselectOptionContent : _a2; return onRenderOption(item, this._onRenderMultiselectOptionContent); - }; - /** - * If we are coming from a mouseOut: - * there is no visible selected option. - * - * Else if We are hovering over an item: - * that gets the selected look. - * - * Else: - * Use the current valid pending index if it exists OR - * we do not have a valid index and we currently have a pending input value, - * otherwise use the selected index - * */ ComboBoxInternal.prototype._isOptionHighlighted = function(index) { + }; + ComboBoxInternal2.prototype._isOptionHighlighted = function(index2) { var currentPendingValueValidIndexOnHover = this.state.currentPendingValueValidIndexOnHover; - // If the hover state is set to clearAll, don't show a selected index. - // Note, this happens when the user moused out of the menu items - if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) return false; - return currentPendingValueValidIndexOnHover >= 0 ? currentPendingValueValidIndexOnHover === index : this._isOptionSelected(index); - }; - ComboBoxInternal.prototype._isOptionSelected = function(index) { - return this._getPendingSelectedIndex(true) === index; - }; - ComboBoxInternal.prototype._isOptionChecked = function(index) { - if (this.props.multiSelect && index !== undefined && this.props.hoisted.selectedIndices) { - var idxOfSelectedIndex = -1; - idxOfSelectedIndex = this.props.hoisted.selectedIndices.indexOf(index); - return idxOfSelectedIndex >= 0; + if (currentPendingValueValidIndexOnHover === HoverStatus.clearAll) { + return false; + } + return currentPendingValueValidIndexOnHover >= 0 ? currentPendingValueValidIndexOnHover === index2 : this._isOptionSelected(index2); + }; + ComboBoxInternal2.prototype._isOptionSelected = function(index2) { + return this._getPendingSelectedIndex( + true + /* includePendingValue */ + ) === index2; + }; + ComboBoxInternal2.prototype._isOptionChecked = function(index2) { + if (this.props.multiSelect && index2 !== void 0 && this.props.hoisted.selectedIndices) { + var idxOfSelectedIndex = -1; + idxOfSelectedIndex = this.props.hoisted.selectedIndices.indexOf(index2); + return idxOfSelectedIndex >= 0; } return false; - }; - ComboBoxInternal.prototype._isOptionIndeterminate = function(index) { - var _a = this.props, multiSelect = _a.multiSelect, hoisted = _a.hoisted; - if (multiSelect && index !== undefined && hoisted.selectedIndices && hoisted.currentOptions) { - var option = hoisted.currentOptions[index]; - if (option && option.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll) return hoisted.selectedIndices.length > 0 && !this._isSelectAllChecked(); + }; + ComboBoxInternal2.prototype._isOptionIndeterminate = function(index2) { + var _a2 = this.props, multiSelect = _a2.multiSelect, hoisted = _a2.hoisted; + if (multiSelect && index2 !== void 0 && hoisted.selectedIndices && hoisted.currentOptions) { + var option = hoisted.currentOptions[index2]; + if (option && option.itemType === SelectableOptionMenuItemType.SelectAll) { + return hoisted.selectedIndices.length > 0 && !this._isSelectAllChecked(); + } } return false; - }; - ComboBoxInternal.prototype._isSelectAllChecked = function(testIndices) { - var _a = this.props, multiSelect = _a.multiSelect, hoisted = _a.hoisted; + }; + ComboBoxInternal2.prototype._isSelectAllChecked = function(testIndices) { + var _a2 = this.props, multiSelect = _a2.multiSelect, hoisted = _a2.hoisted; var selectAllOption = hoisted.currentOptions.find(function(option) { - return option.itemType === (0, _selectableOption.SelectableOptionMenuItemType).SelectAll; + return option.itemType === SelectableOptionMenuItemType.SelectAll; }); var selectedIndices = testIndices || hoisted.selectedIndices; - if (!multiSelect || !selectedIndices || !selectAllOption) return false; - // start by not including the select all option itself + if (!multiSelect || !selectedIndices || !selectAllOption) { + return false; + } var selectAllIndex = hoisted.currentOptions.indexOf(selectAllOption); - var compareSelectedIndices = selectedIndices.filter(function(value) { - return value !== selectAllIndex; + var compareSelectedIndices = selectedIndices.filter(function(value2) { + return value2 !== selectAllIndex; }); - // get array of selectable options, excluding disabled options, headers, and dividers var selectableOptions = hoisted.currentOptions.filter(function(option) { - return !option.disabled && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).SelectAll && isSelectableOption(option); + return !option.disabled && option.itemType !== SelectableOptionMenuItemType.SelectAll && isSelectableOption(option); }); return compareSelectedIndices.length === selectableOptions.length; - }; - /** - * Gets the pending selected index taking into account valueValidIndex and selectedIndex - * @param includeCurrentPendingValue - Should we include the currentPendingValue when - * finding the index - */ ComboBoxInternal.prototype._getPendingSelectedIndex = function(includeCurrentPendingValue) { - var _a = this.state, currentPendingValueValidIndex = _a.currentPendingValueValidIndex, currentPendingValue = _a.currentPendingValue; - return currentPendingValueValidIndex >= 0 || includeCurrentPendingValue && currentPendingValue !== null && currentPendingValue !== undefined ? currentPendingValueValidIndex : this.props.multiSelect ? -1 : this._getFirstSelectedIndex(); - }; - /** - * Scroll the selected element into view - */ ComboBoxInternal.prototype._scrollIntoView = function() { - var _a = this.props, onScrollToItem = _a.onScrollToItem, scrollSelectedToTop = _a.scrollSelectedToTop; + }; + ComboBoxInternal2.prototype._getPendingSelectedIndex = function(includeCurrentPendingValue) { + var _a2 = this.state, currentPendingValueValidIndex = _a2.currentPendingValueValidIndex, currentPendingValue = _a2.currentPendingValue; + return currentPendingValueValidIndex >= 0 || includeCurrentPendingValue && currentPendingValue !== null && currentPendingValue !== void 0 ? currentPendingValueValidIndex : this.props.multiSelect ? -1 : this._getFirstSelectedIndex(); + }; + ComboBoxInternal2.prototype._scrollIntoView = function() { + var _a2 = this.props, onScrollToItem = _a2.onScrollToItem, scrollSelectedToTop = _a2.scrollSelectedToTop; var currentPendingSelectedIndex = this._getPendingSelectedIndex(true); if (onScrollToItem) { - // Use the custom scroll handler - onScrollToItem(currentPendingSelectedIndex >= 0 ? currentPendingSelectedIndex : this._getFirstSelectedIndex()); - return; + onScrollToItem(currentPendingSelectedIndex >= 0 ? currentPendingSelectedIndex : this._getFirstSelectedIndex()); + return; } var scrollToElement = this._selectedElement.current; - // in multi-select there are multiple selected elements, so we use the pending select index - // to locate the option to scroll to. - if (this.props.multiSelect && this._comboBoxMenu.current) scrollToElement = findFirstDescendant(this._comboBoxMenu.current, function(element) { - var _a; - return ((_a = element.dataset) === null || _a === void 0 ? void 0 : _a.index) === currentPendingSelectedIndex.toString(); - }); - if (scrollToElement && scrollToElement.offsetParent) { - var alignToTop = true; - // We are using refs, scroll the ref into view - if (this._comboBoxMenu.current && this._comboBoxMenu.current.offsetParent) { - var scrollableParent = this._comboBoxMenu.current.offsetParent; - var selectedElement = scrollToElement.offsetParent; - var _b = selectedElement, offsetHeight = _b.offsetHeight, offsetTop = _b.offsetTop; - var _c = scrollableParent, parentOffsetHeight = _c.offsetHeight, scrollTop = _c.scrollTop; - var isAbove = offsetTop < scrollTop; - var isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; - if (isAbove || scrollSelectedToTop) { - alignToTop = false; - scrollableParent.scrollTo(0, offsetTop); - } else if (isBelow) scrollableParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); - } else scrollToElement.offsetParent.scrollIntoView(alignToTop); + if (this.props.multiSelect && this._comboBoxMenu.current) { + scrollToElement = findFirstDescendant(this._comboBoxMenu.current, function(element2) { + var _a3; + return ((_a3 = element2.dataset) === null || _a3 === void 0 ? void 0 : _a3.index) === currentPendingSelectedIndex.toString(); + }); } - }; - /** - * Click handler for the menu items - * to select the item and also close the menu - * @param index - the index of the item that was clicked - */ ComboBoxInternal.prototype._onItemClick = function(item) { + if (scrollToElement && scrollToElement.offsetParent) { + var alignToTop = true; + if (this._comboBoxMenu.current && this._comboBoxMenu.current.offsetParent) { + var scrollableParent = this._comboBoxMenu.current.offsetParent; + var selectedElement = scrollToElement.offsetParent; + var _b2 = selectedElement, offsetHeight = _b2.offsetHeight, offsetTop = _b2.offsetTop; + var _c2 = scrollableParent, parentOffsetHeight = _c2.offsetHeight, scrollTop = _c2.scrollTop; + var isAbove = offsetTop < scrollTop; + var isBelow = offsetTop + offsetHeight > scrollTop + parentOffsetHeight; + if (isAbove || scrollSelectedToTop) { + alignToTop = false; + scrollableParent.scrollTo(0, offsetTop); + } else if (isBelow) { + scrollableParent.scrollTo(0, offsetTop - parentOffsetHeight + offsetHeight); + } + } else { + scrollToElement.offsetParent.scrollIntoView(alignToTop); + } + } + }; + ComboBoxInternal2.prototype._onItemClick = function(item) { var _this = this; var onItemClick = this.props.onItemClick; - var index = item.index; + var index2 = item.index; return function(ev) { - // only close the callout when it's in single-select mode - if (!_this.props.multiSelect) { - // ensure that focus returns to the input, not the button - _this._autofill.current && _this._autofill.current.focus(); - _this.setState({ - isOpen: false - }); - } - // Continue processing the click only after - // performing menu close / control focus(inner working) - onItemClick && onItemClick(ev, item, index); - _this._setSelectedIndex(index, ev); + if (!_this.props.multiSelect) { + _this._autofill.current && _this._autofill.current.focus(); + _this.setState({ + isOpen: false + }); + } + onItemClick && onItemClick(ev, item, index2); + _this._setSelectedIndex(index2, ev); }; - }; - /** - * Reset the selected index by clearing the - * input (of any pending text), clearing the pending state, - * and setting the suggested display value to the last - * selected state text - */ ComboBoxInternal.prototype._resetSelectedIndex = function() { + }; + ComboBoxInternal2.prototype._resetSelectedIndex = function() { var currentOptions = this.props.hoisted.currentOptions; this._clearPendingInfo(); var selectedIndex = this._getFirstSelectedIndex(); - if (selectedIndex > 0 && selectedIndex < currentOptions.length) this.props.hoisted.setSuggestedDisplayValue(currentOptions[selectedIndex].text); - else if (this.props.text) // If we had a value initially, restore it - this.props.hoisted.setSuggestedDisplayValue(this.props.text); - }; - /** - * Clears the pending info state - */ ComboBoxInternal.prototype._clearPendingInfo = function() { + if (selectedIndex > 0 && selectedIndex < currentOptions.length) { + this.props.hoisted.setSuggestedDisplayValue(currentOptions[selectedIndex].text); + } else if (this.props.text) { + this.props.hoisted.setSuggestedDisplayValue(this.props.text); + } + }; + ComboBoxInternal2.prototype._clearPendingInfo = function() { this._processingClearPendingInfo = true; - this.props.hoisted.setSuggestedDisplayValue(undefined); + this.props.hoisted.setSuggestedDisplayValue(void 0); this.setState({ - currentPendingValue: undefined, - currentPendingValueValidIndex: -1, - currentPendingValueValidIndexOnHover: HoverStatus.default + currentPendingValue: void 0, + currentPendingValueValidIndex: -1, + currentPendingValueValidIndexOnHover: HoverStatus.default }, this._onAfterClearPendingInfo); - }; - /** - * Set the pending info - * @param currentPendingValue - new pending value to set - * @param currentPendingValueValidIndex - new pending value index to set - * @param suggestedDisplayValue - new suggest display value to set - */ ComboBoxInternal.prototype._setPendingInfo = function(currentPendingValue, currentPendingValueValidIndex, suggestedDisplayValue) { - if (currentPendingValueValidIndex === void 0) currentPendingValueValidIndex = -1; - if (this._processingClearPendingInfo) return; + }; + ComboBoxInternal2.prototype._setPendingInfo = function(currentPendingValue, currentPendingValueValidIndex, suggestedDisplayValue) { + if (currentPendingValueValidIndex === void 0) { + currentPendingValueValidIndex = -1; + } + if (this._processingClearPendingInfo) { + return; + } this.props.hoisted.setSuggestedDisplayValue(suggestedDisplayValue); this.setState({ - currentPendingValue: normalizeToString(currentPendingValue), - currentPendingValueValidIndex: currentPendingValueValidIndex, - currentPendingValueValidIndexOnHover: HoverStatus.default + currentPendingValue: normalizeToString(currentPendingValue), + currentPendingValueValidIndex, + currentPendingValueValidIndexOnHover: HoverStatus.default }); - }; - /** - * Set the pending info from the given index - * @param index - the index to set the pending info from - */ ComboBoxInternal.prototype._setPendingInfoFromIndex = function(index) { + }; + ComboBoxInternal2.prototype._setPendingInfoFromIndex = function(index2) { var currentOptions = this.props.hoisted.currentOptions; - if (index >= 0 && index < currentOptions.length) { - var option = currentOptions[index]; - this._setPendingInfo(getPreviewText(option), index, getPreviewText(option)); - } else this._clearPendingInfo(); - }; - /** - * Sets the pending info for the combo box - * @param index - the index to search from - * @param searchDirection - the direction to search - */ ComboBoxInternal.prototype._setPendingInfoFromIndexAndDirection = function(index, searchDirection) { + if (index2 >= 0 && index2 < currentOptions.length) { + var option = currentOptions[index2]; + this._setPendingInfo(getPreviewText(option), index2, getPreviewText(option)); + } else { + this._clearPendingInfo(); + } + }; + ComboBoxInternal2.prototype._setPendingInfoFromIndexAndDirection = function(index2, searchDirection) { var currentOptions = this.props.hoisted.currentOptions; - // update index to allow content to wrap - if (searchDirection === SearchDirection.forward && index >= currentOptions.length - 1) index = -1; - else if (searchDirection === SearchDirection.backward && index <= 0) index = currentOptions.length; - // get the next "valid" index - var indexUpdate = this._getNextSelectableIndex(index, searchDirection); - // if the two indices are equal we didn't move and - // we should attempt to get get the first/last "valid" index to use - // (Note, this takes care of the potential cases where the first/last - // item is not focusable), otherwise use the updated index - if (index === indexUpdate) { - if (searchDirection === SearchDirection.forward) index = this._getNextSelectableIndex(-1, searchDirection); - else if (searchDirection === SearchDirection.backward) index = this._getNextSelectableIndex(currentOptions.length, searchDirection); - } else index = indexUpdate; - if (indexWithinBounds(currentOptions, index)) this._setPendingInfoFromIndex(index); - }; - ComboBoxInternal.prototype._notifyPendingValueChanged = function(prevState) { + if (searchDirection === SearchDirection.forward && index2 >= currentOptions.length - 1) { + index2 = -1; + } else if (searchDirection === SearchDirection.backward && index2 <= 0) { + index2 = currentOptions.length; + } + var indexUpdate = this._getNextSelectableIndex(index2, searchDirection); + if (index2 === indexUpdate) { + if (searchDirection === SearchDirection.forward) { + index2 = this._getNextSelectableIndex(-1, searchDirection); + } else if (searchDirection === SearchDirection.backward) { + index2 = this._getNextSelectableIndex(currentOptions.length, searchDirection); + } + } else { + index2 = indexUpdate; + } + if (indexWithinBounds(currentOptions, index2)) { + this._setPendingInfoFromIndex(index2); + } + }; + ComboBoxInternal2.prototype._notifyPendingValueChanged = function(prevState) { var onPendingValueChanged = this.props.onPendingValueChanged; - if (!onPendingValueChanged) return; - var currentOptions = this.props.hoisted.currentOptions; - var _a = this.state, currentPendingValue = _a.currentPendingValue, currentPendingValueValidIndex = _a.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _a.currentPendingValueValidIndexOnHover; - var newPendingIndex = undefined; - var newPendingValue = undefined; - if (currentPendingValueValidIndexOnHover !== prevState.currentPendingValueValidIndexOnHover && indexWithinBounds(currentOptions, currentPendingValueValidIndexOnHover)) // Set new pending index if hover index was changed - newPendingIndex = currentPendingValueValidIndexOnHover; - else if (currentPendingValueValidIndex !== prevState.currentPendingValueValidIndex && indexWithinBounds(currentOptions, currentPendingValueValidIndex)) // Set new pending index if currentPendingValueValidIndex was changed - newPendingIndex = currentPendingValueValidIndex; - else if (currentPendingValue !== prevState.currentPendingValue) // Set pendingValue in the case it was changed and no index was changed - newPendingValue = currentPendingValue; - // Notify when there is a new pending index/value. Also, if there is a pending value, it needs to send undefined. - if (newPendingIndex !== undefined || newPendingValue !== undefined || this._hasPendingValue) { - onPendingValueChanged(newPendingIndex !== undefined ? currentOptions[newPendingIndex] : undefined, newPendingIndex, newPendingValue); - this._hasPendingValue = newPendingIndex !== undefined || newPendingValue !== undefined; + if (!onPendingValueChanged) { + return; } - }; - /** - * Sets the isOpen state and updates focusInputAfterClose - */ ComboBoxInternal.prototype._setOpenStateAndFocusOnClose = function(isOpen, focusInputAfterClose) { + var currentOptions = this.props.hoisted.currentOptions; + var _a2 = this.state, currentPendingValue = _a2.currentPendingValue, currentPendingValueValidIndex = _a2.currentPendingValueValidIndex, currentPendingValueValidIndexOnHover = _a2.currentPendingValueValidIndexOnHover; + var newPendingIndex = void 0; + var newPendingValue = void 0; + if (currentPendingValueValidIndexOnHover !== prevState.currentPendingValueValidIndexOnHover && indexWithinBounds(currentOptions, currentPendingValueValidIndexOnHover)) { + newPendingIndex = currentPendingValueValidIndexOnHover; + } else if (currentPendingValueValidIndex !== prevState.currentPendingValueValidIndex && indexWithinBounds(currentOptions, currentPendingValueValidIndex)) { + newPendingIndex = currentPendingValueValidIndex; + } else if (currentPendingValue !== prevState.currentPendingValue) { + newPendingValue = currentPendingValue; + } + if (newPendingIndex !== void 0 || newPendingValue !== void 0 || this._hasPendingValue) { + onPendingValueChanged(newPendingIndex !== void 0 ? currentOptions[newPendingIndex] : void 0, newPendingIndex, newPendingValue); + this._hasPendingValue = newPendingIndex !== void 0 || newPendingValue !== void 0; + } + }; + ComboBoxInternal2.prototype._setOpenStateAndFocusOnClose = function(isOpen, focusInputAfterClose) { this._focusInputAfterClose = focusInputAfterClose; + this.setState({ isOpen }); + }; + ComboBoxInternal2.prototype._onOptionMouseEnter = function(index2) { + if (this._shouldIgnoreMouseEvent()) { + return; + } this.setState({ - isOpen: isOpen - }); - }; - ComboBoxInternal.prototype._onOptionMouseEnter = function(index) { - if (this._shouldIgnoreMouseEvent()) return; - this.setState({ - currentPendingValueValidIndexOnHover: index + currentPendingValueValidIndexOnHover: index2 }); - }; - ComboBoxInternal.prototype._onOptionMouseMove = function(index) { + }; + ComboBoxInternal2.prototype._onOptionMouseMove = function(index2) { this._gotMouseMove = true; - if (!this._isScrollIdle || this.state.currentPendingValueValidIndexOnHover === index) return; + if (!this._isScrollIdle || this.state.currentPendingValueValidIndexOnHover === index2) { + return; + } this.setState({ - currentPendingValueValidIndexOnHover: index + currentPendingValueValidIndexOnHover: index2 }); - }; - ComboBoxInternal.prototype._shouldIgnoreMouseEvent = function() { + }; + ComboBoxInternal2.prototype._shouldIgnoreMouseEvent = function() { return !this._isScrollIdle || !this._gotMouseMove; - }; - /** - * Handle dismissing the menu and eating the required key event when disabled - * @param ev - the keyboard event that was fired - */ ComboBoxInternal.prototype._handleInputWhenDisabled = function(ev) { - // If we are disabled, close the menu (if needed) - // and eat all keystrokes other than TAB or ESC + }; + ComboBoxInternal2.prototype._handleInputWhenDisabled = function(ev) { if (this.props.disabled) { - if (this.state.isOpen) this.setState({ - isOpen: false - }); - // When disabled stop propagation and prevent default - // of the event unless we have a tab, escape, or function key - if (ev !== null && // eslint-disable-next-line deprecation/deprecation - ev.which !== (0, _utilities.KeyCodes).tab && // eslint-disable-next-line deprecation/deprecation - ev.which !== (0, _utilities.KeyCodes).escape && // eslint-disable-next-line deprecation/deprecation - (ev.which < 112 /* F1 */ || ev.which > 123)) { - ev.stopPropagation(); - ev.preventDefault(); - } + if (this.state.isOpen) { + this.setState({ isOpen: false }); + } + if (ev !== null && // eslint-disable-next-line @typescript-eslint/no-deprecated + ev.which !== KeyCodes.tab && // eslint-disable-next-line @typescript-eslint/no-deprecated + ev.which !== KeyCodes.escape && // eslint-disable-next-line @typescript-eslint/no-deprecated + (ev.which < 112 || ev.which > 123)) { + ev.stopPropagation(); + ev.preventDefault(); + } } - }; - ComboBoxInternal.prototype._handleTouchAndPointerEvent = function() { + }; + ComboBoxInternal2.prototype._handleTouchAndPointerEvent = function() { var _this = this; - // If we already have an existing timeout from a previous touch and pointer event - // cancel that timeout so we can set a nwe one. - if (this._lastTouchTimeoutId !== undefined) { - this._async.clearTimeout(this._lastTouchTimeoutId); - this._lastTouchTimeoutId = undefined; + if (this._lastTouchTimeoutId !== void 0) { + this._async.clearTimeout(this._lastTouchTimeoutId); + this._lastTouchTimeoutId = void 0; } this._processingTouch = true; this._lastTouchTimeoutId = this._async.setTimeout(function() { - _this._processingTouch = false; - _this._lastTouchTimeoutId = undefined; + _this._processingTouch = false; + _this._lastTouchTimeoutId = void 0; }, TouchIdleDelay); - }; - /** - * Get the styles for the current option. - * @param item - Item props for the current option - */ ComboBoxInternal.prototype._getCaretButtonStyles = function() { + }; + ComboBoxInternal2.prototype._getCaretButtonStyles = function() { var customCaretDownButtonStyles = this.props.caretDownButtonStyles; - return (0, _comboBoxStyles.getCaretDownButtonStyles)(this.props.theme, customCaretDownButtonStyles); - }; - /** - * Get the styles for the current option. - * @param item - Item props for the current option - */ ComboBoxInternal.prototype._getCurrentOptionStyles = function(item) { - var _a; + return getCaretDownButtonStyles(this.props.theme, customCaretDownButtonStyles); + }; + ComboBoxInternal2.prototype._getCurrentOptionStyles = function(item) { + var _a2; var customStylesForAllOptions = this.props.comboBoxOptionStyles; var customStylesForCurrentOption = item.styles; - var optionStyles = (0, _comboBoxStyles.getOptionStyles)(this.props.theme, customStylesForAllOptions, customStylesForCurrentOption, this._isPendingOption(item), item.hidden, this._isOptionHighlighted(item.index)); - // TODO: fix this for multi-window scenarios - optionStyles.__shadowConfig__ = (_a = this.props.styles) === null || _a === void 0 ? void 0 : _a.__shadowConfig__; + var optionStyles = getOptionStyles(this.props.theme, customStylesForAllOptions, customStylesForCurrentOption, this._isPendingOption(item), item.hidden, this._isOptionHighlighted(item.index)); + optionStyles.__shadowConfig__ = (_a2 = this.props.styles) === null || _a2 === void 0 ? void 0 : _a2.__shadowConfig__; return optionStyles; - }; - /** - * Get the aria autocomplete value for the combo box - * @returns 'inline' if auto-complete automatically dynamic, 'both' if we have a list of possible values to pick from - * and can dynamically populate input, and 'list' if auto-complete is not enabled as selection is the only option. - * Ideally, this should be 'none' if auto-complete is not enabled, but there is a known bug in Edge - * where the callout may appear over the combo box if this attribute is set to 'none' - */ ComboBoxInternal.prototype._getAriaAutoCompleteValue = function() { - var autoComplete = !this.props.disabled && this.props.autoComplete === 'on'; - return autoComplete ? this.props.allowFreeform ? 'inline' : 'both' : 'list'; - }; - ComboBoxInternal.prototype._isPendingOption = function(item) { + }; + ComboBoxInternal2.prototype._getAriaAutoCompleteValue = function() { + var autoComplete = !this.props.disabled && this.props.autoComplete === "on"; + return autoComplete ? this.props.allowFreeform ? "inline" : "both" : "list"; + }; + ComboBoxInternal2.prototype._isPendingOption = function(item) { return item && item.index === this.state.currentPendingValueValidIndex; + }; + ComboBoxInternal2.prototype._hasFocus = function() { + return this.state.focusState !== "none"; + }; + ComboBoxInternal2.prototype._adjustForCaseSensitivity = function(text2) { + return this.props.caseSensitive ? text2 : text2.toLowerCase(); + }; + ComboBoxInternal2.contextType = WindowContext; + ComboBoxInternal2 = __decorate([ + customizable("ComboBox", ["theme", "styles"]) + ], ComboBoxInternal2); + return ComboBoxInternal2; + })(React__namespace.Component) + ); + function getSelectedIndices(options2, selectedKeys) { + if (!options2 || !selectedKeys) { + return []; + } + var selectedIndices = {}; + options2.forEach(function(option, index2) { + if (option.selected) { + selectedIndices[index2] = true; + } + }); + var _loop_1 = function(selectedKey2) { + var index2 = findIndex(options2, function(option) { + return option.key === selectedKey2; + }); + if (index2 > -1) { + selectedIndices[index2] = true; + } + }; + for (var _i = 0, selectedKeys_1 = selectedKeys; _i < selectedKeys_1.length; _i++) { + var selectedKey = selectedKeys_1[_i]; + _loop_1(selectedKey); + } + return Object.keys(selectedIndices).map(Number).sort(); + } + function buildDefaultSelectedKeys(defaultSelectedKey, selectedKey) { + var selectedKeys = buildSelectedKeys(defaultSelectedKey); + if (selectedKeys.length) { + return selectedKeys; + } + return buildSelectedKeys(selectedKey); + } + function buildSelectedKeys(selectedKey) { + if (selectedKey === void 0) { + return []; + } + return selectedKey instanceof Array ? selectedKey : [selectedKey]; + } + function normalizeToString(value2) { + return value2 || ""; + } + function indexWithinBounds(options2, index2) { + return !!options2 && index2 >= 0 && index2 < options2.length; + } + function isNormalOption(option) { + return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider && option.itemType !== SelectableOptionMenuItemType.SelectAll; + } + function isSelectableOption(option) { + return option.itemType !== SelectableOptionMenuItemType.Header && option.itemType !== SelectableOptionMenuItemType.Divider; + } + function getPreviewText(item) { + return item.useAriaLabelAsText && item.ariaLabel ? item.ariaLabel : item.text; + } + function isAltOrMeta(ev) { + return ev.which === KeyCodes.alt || ev.key === "Meta"; + } + var COMMAND_BAR_HEIGHT = 44; + var getStyles$e = function(props) { + var className2 = props.className, theme = props.theme; + var semanticColors = theme.semanticColors; + return { + root: [ + theme.fonts.medium, + "ms-CommandBar", + { + display: "flex", + backgroundColor: semanticColors.bodyBackground, + padding: "0 14px 0 24px", + height: COMMAND_BAR_HEIGHT + }, + className2 + ], + primarySet: [ + "ms-CommandBar-primaryCommand", + { + flexGrow: "1", + display: "flex", + alignItems: "stretch" + } + ], + secondarySet: [ + "ms-CommandBar-secondaryCommand", + { + flexShrink: "0", + display: "flex", + alignItems: "stretch" + } + ] + }; + }; + var getCommandButtonStyles = memoizeFunction(function(customStyles) { + var rootStyles = { + height: "100%" + }; + var labelStyles = { + whiteSpace: "nowrap" + }; + var _a2 = customStyles || {}, root = _a2.root, label2 = _a2.label, restCustomStyles = __rest(_a2, ["root", "label"]); + return __assign$1(__assign$1({}, restCustomStyles), { root: root ? [rootStyles, root] : rootStyles, label: label2 ? [labelStyles, label2] : labelStyles }); + }); + var registerPersistedKeytips = function(keytipsToRegister, keytipManager, registeredPersistedKeytips) { + for (var _i = 0, keytipsToRegister_1 = keytipsToRegister; _i < keytipsToRegister_1.length; _i++) { + var keytip = keytipsToRegister_1[_i]; + var uniqueID = keytipManager.register(keytip, true); + registeredPersistedKeytips[uniqueID] = keytip; + } + }; + var unregisterPersistedKeytips = function(keytipManager, registeredPersistedKeytips) { + for (var _i = 0, _a2 = Object.keys(registeredPersistedKeytips); _i < _a2.length; _i++) { + var uniqueID = _a2[_i]; + keytipManager.unregister(registeredPersistedKeytips[uniqueID], uniqueID, true); + delete registeredPersistedKeytips[uniqueID]; + } + }; + var useKeytipRegistrations = function(registeredPersistedKeytips, keytipsToRegister, keytipManager) { + var prevPersistedKeytips = usePrevious(registeredPersistedKeytips); + React__namespace.useEffect(function() { + if (prevPersistedKeytips) { + unregisterPersistedKeytips(keytipManager, prevPersistedKeytips); + registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); + } + }); + React__namespace.useEffect(function() { + registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); + return function() { + unregisterPersistedKeytips(keytipManager, registeredPersistedKeytips); + }; + }, []); + }; + var OverflowButton = function(props) { + var keytipManager = KeytipManager.getInstance(); + var className2 = props.className, overflowItems = props.overflowItems, keytipSequences = props.keytipSequences, itemSubMenuProvider = props.itemSubMenuProvider, onRenderOverflowButton = props.onRenderOverflowButton; + var persistedKeytips = useConst({}); + var getSubMenuForItem = React__namespace.useCallback(function(item) { + if (itemSubMenuProvider) { + return itemSubMenuProvider(item); + } + if (item.subMenuProps) { + return item.subMenuProps.items; + } + return void 0; + }, [itemSubMenuProvider]); + var _a2 = React__namespace.useMemo(function() { + var newKeytipsToRegister = []; + var newOverflowItems = []; + if (keytipSequences) { + overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.forEach(function(overflowItem) { + var _a3; + var keytip = overflowItem.keytipProps; + if (keytip) { + var persistedKeytip = { + content: keytip.content, + keySequences: keytip.keySequences, + disabled: keytip.disabled || !!(overflowItem.disabled || overflowItem.isDisabled), + hasDynamicChildren: keytip.hasDynamicChildren, + hasMenu: keytip.hasMenu + }; + if (keytip.hasDynamicChildren || getSubMenuForItem(overflowItem)) { + persistedKeytip.onExecute = keytipManager.menuExecute.bind(keytipManager, keytipSequences, (_a3 = overflowItem === null || overflowItem === void 0 ? void 0 : overflowItem.keytipProps) === null || _a3 === void 0 ? void 0 : _a3.keySequences); + persistedKeytip.hasOverflowSubMenu = true; + } else { + persistedKeytip.onExecute = keytip.onExecute; + } + newKeytipsToRegister.push(persistedKeytip); + var newOverflowItem = __assign$1(__assign$1({}, overflowItem), { keytipProps: __assign$1(__assign$1({}, keytip), { overflowSetSequence: keytipSequences }) }); + newOverflowItems === null || newOverflowItems === void 0 ? void 0 : newOverflowItems.push(newOverflowItem); + } else { + newOverflowItems === null || newOverflowItems === void 0 ? void 0 : newOverflowItems.push(overflowItem); + } + }); + } else { + newOverflowItems = overflowItems; + } + return { modifiedOverflowItems: newOverflowItems, keytipsToRegister: newKeytipsToRegister }; + }, [overflowItems, getSubMenuForItem, keytipManager, keytipSequences]), modifiedOverflowItems = _a2.modifiedOverflowItems, keytipsToRegister = _a2.keytipsToRegister; + useKeytipRegistrations(persistedKeytips, keytipsToRegister, keytipManager); + return React__namespace.createElement("div", { className: className2 }, onRenderOverflowButton(modifiedOverflowItems)); + }; + var getClassNames$f = classNamesFunction(); + var COMPONENT_NAME$3 = "OverflowSet"; + var useComponentRef$3 = function(props, divContainer) { + var doc = useDocumentEx(); + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + focus: function(_forceIntoFirstElement, bypassHiddenElements) { + var focusSucceeded = false; + if (divContainer.current) { + focusSucceeded = focusFirstChild(divContainer.current, bypassHiddenElements); + } + return focusSucceeded; + }, + focusElement: function(childElement) { + var focusSucceeded = false; + if (!childElement) { + return false; + } + if (divContainer.current && elementContains(divContainer.current, childElement)) { + childElement.focus(); + focusSucceeded = (doc === null || doc === void 0 ? void 0 : doc.activeElement) === childElement; + } + return focusSucceeded; + } + }; + }, [divContainer, doc]); + }; + var OverflowSetBase = React__namespace.forwardRef(function(props, forwardedRef) { + var divContainer = React__namespace.useRef(null); + var mergedRef = useMergedRefs(divContainer, forwardedRef); + useComponentRef$3(props, divContainer); + var items = props.items, overflowItems = props.overflowItems, className2 = props.className, styles = props.styles, vertical = props.vertical, role = props.role, _a2 = props.overflowSide, overflowSide = _a2 === void 0 ? "end" : _a2, onRenderItem = props.onRenderItem; + var classNames2 = getClassNames$f(styles, { className: className2, vertical }); + var showOverflow = !!overflowItems && overflowItems.length > 0; + return React__namespace.createElement( + "div", + __assign$1({}, getNativeProps(props, divProperties), { role: role || "group", "aria-orientation": role === "menubar" ? vertical === true ? "vertical" : "horizontal" : void 0, className: classNames2.root, ref: mergedRef }), + overflowSide === "start" && showOverflow && React__namespace.createElement(OverflowButton, __assign$1({}, props, { className: classNames2.overflowButton })), + items && items.map(function(item, i) { + return React__namespace.createElement("div", { className: classNames2.item, key: item.key, role: "none" }, onRenderItem(item)); + }), + overflowSide === "end" && showOverflow && React__namespace.createElement(OverflowButton, __assign$1({}, props, { className: classNames2.overflowButton })) + ); + }); + OverflowSetBase.displayName = COMPONENT_NAME$3; + var overflowItemStyle = { + flexShrink: 0, + display: "inherit" + }; + var getStyles$d = function(props) { + var className2 = props.className, vertical = props.vertical; + return { + root: [ + "ms-OverflowSet", + { + position: "relative", + display: "flex", + flexWrap: "nowrap" + }, + vertical && { flexDirection: "column" }, + className2 + ], + item: ["ms-OverflowSet-item", overflowItemStyle], + overflowButton: ["ms-OverflowSet-overflowButton", overflowItemStyle] + }; + }; + var OverflowSet = styled(OverflowSetBase, getStyles$d, void 0, { + scope: "OverflowSet" + }); + var ResizeGroupDirection; + (function(ResizeGroupDirection2) { + ResizeGroupDirection2[ResizeGroupDirection2["horizontal"] = 0] = "horizontal"; + ResizeGroupDirection2[ResizeGroupDirection2["vertical"] = 1] = "vertical"; + })(ResizeGroupDirection || (ResizeGroupDirection = {})); + var RESIZE_DELAY = 16; + var getMeasurementCache = function() { + var measurementsCache = {}; + return { + /** + * Checks if the provided data has a cacheKey. If it has a cacheKey and there is a + * corresponding entry in the measurementsCache, then it will return that value. + * Returns undefined otherwise. + */ + getCachedMeasurement: function(data2) { + if (data2 && data2.cacheKey && measurementsCache.hasOwnProperty(data2.cacheKey)) { + return measurementsCache[data2.cacheKey]; + } + return void 0; + }, + /** + * Should be called whenever there is a new measurement associated with a given data object. + * If the data has a cacheKey, store that measurement in the measurementsCache. + */ + addMeasurementToCache: function(data2, measurement) { + if (data2.cacheKey) { + measurementsCache[data2.cacheKey] = measurement; + } + } + }; + }; + var getNextResizeGroupStateProvider = function(measurementCache) { + if (measurementCache === void 0) { + measurementCache = getMeasurementCache(); + } + var _measurementCache = measurementCache; + var _containerDimension; + function _getMeasuredDimension(measuredData, getElementToMeasureDimension) { + var cachedDimension = _measurementCache.getCachedMeasurement(measuredData); + if (cachedDimension !== void 0) { + return cachedDimension; + } + var measuredDimension = getElementToMeasureDimension(); + _measurementCache.addMeasurementToCache(measuredData, measuredDimension); + return measuredDimension; + } + function _shrinkContentsUntilTheyFit(data2, onReduceData, getElementToMeasureDimension) { + var dataToMeasure = data2; + var measuredDimension = _getMeasuredDimension(data2, getElementToMeasureDimension); + while (measuredDimension > _containerDimension) { + var nextMeasuredData = onReduceData(dataToMeasure); + if (nextMeasuredData === void 0) { + return { + renderedData: dataToMeasure, + resizeDirection: void 0, + dataToMeasure: void 0 + }; + } + measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); + if (measuredDimension === void 0) { + return { + dataToMeasure: nextMeasuredData, + resizeDirection: "shrink" + }; + } + dataToMeasure = nextMeasuredData; + } + return { + renderedData: dataToMeasure, + resizeDirection: void 0, + dataToMeasure: void 0 + }; + } + function _growDataUntilItDoesNotFit(data2, onGrowData, getElementToMeasureDimension, onReduceData) { + var dataToMeasure = data2; + var measuredDimension = _getMeasuredDimension(data2, getElementToMeasureDimension); + while (measuredDimension < _containerDimension) { + var nextMeasuredData = onGrowData(dataToMeasure); + if (nextMeasuredData === void 0) { + return { + renderedData: dataToMeasure, + resizeDirection: void 0, + dataToMeasure: void 0 + }; + } + measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); + if (measuredDimension === void 0) { + return { + dataToMeasure: nextMeasuredData + }; + } + dataToMeasure = nextMeasuredData; + } + return __assign$1({ resizeDirection: "shrink" }, _shrinkContentsUntilTheyFit(dataToMeasure, onReduceData, getElementToMeasureDimension)); + } + function _updateContainerDimension(newDimension, fullDimensionData, renderedData, onGrowData) { + var nextState; + if (newDimension > _containerDimension) { + if (onGrowData) { + nextState = { + resizeDirection: "grow", + dataToMeasure: onGrowData(renderedData) + }; + } else { + nextState = { + resizeDirection: "shrink", + dataToMeasure: fullDimensionData + }; + } + } else { + nextState = { + resizeDirection: "shrink", + dataToMeasure: renderedData + }; + } + _containerDimension = newDimension; + return __assign$1(__assign$1({}, nextState), { measureContainer: false }); + } + function getNextState(props, currentState, getElementToMeasureDimension, newContainerDimension) { + if (newContainerDimension === void 0 && currentState.dataToMeasure === void 0) { + return void 0; + } + if (newContainerDimension) { + if (_containerDimension && currentState.renderedData && !currentState.dataToMeasure) { + return __assign$1(__assign$1({}, currentState), _updateContainerDimension(newContainerDimension, props.data, currentState.renderedData, props.onGrowData)); + } + _containerDimension = newContainerDimension; + } + var nextState = __assign$1(__assign$1({}, currentState), { measureContainer: false }); + if (currentState.dataToMeasure) { + if (currentState.resizeDirection === "grow" && props.onGrowData) { + nextState = __assign$1(__assign$1({}, nextState), _growDataUntilItDoesNotFit(currentState.dataToMeasure, props.onGrowData, getElementToMeasureDimension, props.onReduceData)); + } else { + nextState = __assign$1(__assign$1({}, nextState), _shrinkContentsUntilTheyFit(currentState.dataToMeasure, props.onReduceData, getElementToMeasureDimension)); + } + } + return nextState; + } + function shouldRenderDataForMeasurement(dataToMeasure) { + if (!dataToMeasure || _measurementCache.getCachedMeasurement(dataToMeasure) !== void 0) { + return false; + } + return true; + } + function getInitialResizeGroupState(data2) { + return { + dataToMeasure: __assign$1({}, data2), + resizeDirection: "grow", + measureContainer: true + }; + } + return { + getNextState, + shouldRenderDataForMeasurement, + getInitialResizeGroupState }; - /** - * Returns true if the component has some kind of focus. If it's either focusing or if it's focused - */ ComboBoxInternal.prototype._hasFocus = function() { - return this.state.focusState !== 'none'; - }; - ComboBoxInternal.prototype._adjustForCaseSensitivity = function(text) { - return this.props.caseSensitive ? text : text.toLowerCase(); - }; - ComboBoxInternal.contextType = (0, _reactWindowProvider.WindowContext); - ComboBoxInternal = (0, _tslib.__decorate)([ - (0, _utilities.customizable)('ComboBox', [ - 'theme', - 'styles' - ], true) - ], ComboBoxInternal); - return ComboBoxInternal; -}(_react.Component); -/** - * Get the indices of the options that are marked as selected - * @param options - the combo box options - * @param selectedKeys - the known selected keys to find - * @returns - an array of the indices of the selected options, empty array if nothing is selected - */ function getSelectedIndices(options, selectedKeys) { - if (!options || !selectedKeys) return []; - var selectedIndices = {}; - options.forEach(function(option, index) { - if (option.selected) selectedIndices[index] = true; + }; + var MeasuredContext = React__namespace.createContext({ isMeasured: false }); + var hiddenDivStyles = { position: "fixed", visibility: "hidden" }; + var hiddenParentStyles = { position: "relative" }; + function resizeDataReducer(state, action) { + var _a2; + switch (action.type) { + case "resizeData": + return __assign$1({}, action.value); + case "dataToMeasure": + return __assign$1(__assign$1({}, state), { dataToMeasure: action.value, resizeDirection: "grow", measureContainer: true }); + default: + return __assign$1(__assign$1({}, state), (_a2 = {}, _a2[action.type] = action.value, _a2)); + } + } + function useResizeState(props, nextResizeGroupStateProvider, rootRef) { + var initialStateData = useConst(function() { + return nextResizeGroupStateProvider.getInitialResizeGroupState(props.data); }); - var _loop_1 = function(selectedKey) { - var index = (0, _utilities.findIndex)(options, function(option) { - return option.key === selectedKey; + var _a2 = React__namespace.useReducer(resizeDataReducer, initialStateData), resizeData = _a2[0], dispatchResizeDataAction = _a2[1]; + React__namespace.useEffect(function() { + dispatchResizeDataAction({ + type: "dataToMeasure", + value: props.data + }); + }, [props.data]); + var stateRef = React__namespace.useRef(initialStateData); + stateRef.current = __assign$1({}, resizeData); + var updateResizeState = React__namespace.useCallback(function(nextState) { + if (nextState) { + dispatchResizeDataAction({ + type: "resizeData", + value: nextState }); - if (index > -1) selectedIndices[index] = true; - }; - for(var _i = 0, selectedKeys_1 = selectedKeys; _i < selectedKeys_1.length; _i++){ - var selectedKey = selectedKeys_1[_i]; - _loop_1(selectedKey); - } - return Object.keys(selectedIndices).map(Number).sort(); -} -/** - * Given default selected key(s) and selected key(s), return the selected keys(s). - * When default selected key(s) are available, they take precedence and return them instead of selected key(s). - * - * @returns No matter what specific types the input parameters are, always return an array of - * either strings or numbers instead of primitive type. This normalization makes caller's logic easier. - */ function buildDefaultSelectedKeys(defaultSelectedKey, selectedKey) { - var selectedKeys = buildSelectedKeys(defaultSelectedKey); - if (selectedKeys.length) return selectedKeys; - return buildSelectedKeys(selectedKey); -} -function buildSelectedKeys(selectedKey) { - if (selectedKey === undefined) return []; - // need to cast here so typescript does not complain - return selectedKey instanceof Array ? selectedKey : [ - selectedKey + } + }, []); + var remeasure = React__namespace.useCallback(function() { + if (rootRef.current) { + dispatchResizeDataAction({ + type: "measureContainer", + value: true + }); + } + }, [rootRef]); + return [stateRef, updateResizeState, remeasure]; + } + function useResizingBehavior(props, rootRef) { + var nextResizeGroupStateProvider = useConst(getNextResizeGroupStateProvider); + var initialHiddenDiv = React__namespace.useRef(null); + var updateHiddenDiv = React__namespace.useRef(null); + var hasRenderedContent = React__namespace.useRef(false); + var async = useAsync(); + var _a2 = useResizeState(props, nextResizeGroupStateProvider, rootRef), stateRef = _a2[0], updateResizeState = _a2[1], remeasure = _a2[2]; + React__namespace.useEffect(function() { + var _a22; + if (stateRef.current.renderedData) { + hasRenderedContent.current = true; + (_a22 = props.dataDidRender) === null || _a22 === void 0 ? void 0 : _a22.call(props, stateRef.current.renderedData); + } + }); + React__namespace.useEffect(function() { + async.requestAnimationFrame(function() { + var containerDimension = void 0; + if (stateRef.current.measureContainer && rootRef.current) { + var boundingRect = rootRef.current.getBoundingClientRect(); + containerDimension = props.direction === ResizeGroupDirection.vertical ? boundingRect.height : boundingRect.width; + } + var nextState = nextResizeGroupStateProvider.getNextState(props, stateRef.current, function() { + var refToMeasure = !hasRenderedContent.current ? initialHiddenDiv : updateHiddenDiv; + if (!refToMeasure.current) { + return 0; + } + var measuredBoundingRect = refToMeasure.current.getBoundingClientRect(); + return props.direction === ResizeGroupDirection.vertical ? measuredBoundingRect.height : measuredBoundingRect.width; + }, containerDimension); + updateResizeState(nextState); + }, rootRef.current); + }); + var win = useWindow(); + useOnEvent(win, "resize", async.debounce(remeasure, RESIZE_DELAY, { leading: true })); + var dataNeedsMeasuring = nextResizeGroupStateProvider.shouldRenderDataForMeasurement(stateRef.current.dataToMeasure); + var isInitialMeasure = !hasRenderedContent.current && dataNeedsMeasuring; + return [ + stateRef.current.dataToMeasure, + stateRef.current.renderedData, + remeasure, + initialHiddenDiv, + updateHiddenDiv, + dataNeedsMeasuring, + isInitialMeasure ]; -} -function normalizeToString(value) { - return value || ''; -} -/** - * Is the index within the bounds of the array? - * @param options - options to check if the index is valid for - * @param index - the index to check - * @returns - true if the index is valid for the given options, false otherwise - */ function indexWithinBounds(options, index) { - return !!options && index >= 0 && index < options.length; -} -/** Whether this is a normal option, not a header or divider or select all. */ function isNormalOption(option) { - return option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Header && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Divider && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).SelectAll; -} -/** Whether this is a selectable option, not a header or divider. */ function isSelectableOption(option) { - return option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Header && option.itemType !== (0, _selectableOption.SelectableOptionMenuItemType).Divider; -} -/** - * For scenarios where the option's `text` prop contains embedded styles, we use the option's - * `ariaLabel` value as the text in the input and for autocomplete matching. We know to use this - * when the `useAriaLabelAsText` prop is set to true. - */ function getPreviewText(item) { - return item.useAriaLabelAsText && item.ariaLabel ? item.ariaLabel : item.text; -} -/** - * Returns true if the key for the event is alt (Mac option) or meta (Mac command). - */ function isAltOrMeta(ev) { - // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).alt || ev.key === 'Meta'; -} - -},{"tslib":"9gizs","react":"jGrId","../../Autofill":"3uh8V","../../Utilities":"1NZCy","../../Callout":"g2jXk","../../Checkbox":"dwb0b","./ComboBox.styles":"5808M","./ComboBox.classNames":"lioZM","../../Label":"8FZUu","../../SelectableOption":"jqbZ7","../../Button":"1457j","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3uh8V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Autofill/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Autofill/index":"7vfRr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7vfRr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _autofill = require("./Autofill"); -parcelHelpers.exportAll(_autofill, exports); -var _autofillTypes = require("./Autofill.types"); -parcelHelpers.exportAll(_autofillTypes, exports); - -},{"./Autofill":"9iX1O","./Autofill.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9iX1O":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Autofill", ()=>Autofill); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var SELECTION_FORWARD = 'forward'; -var SELECTION_BACKWARD = 'backward'; -/** - * {@docCategory Autofill} - */ var Autofill = /** @class */ function(_super) { - (0, _tslib.__extends)(Autofill, _super); - function Autofill(props) { + } + var measuredContextValue = { isMeasured: true }; + var ResizeGroupBase = React__namespace.forwardRef(function(props, forwardedRef) { + var rootRef = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(rootRef, forwardedRef); + var _a2 = useResizingBehavior(props, rootRef), dataToMeasure = _a2[0], renderedData = _a2[1], remeasure = _a2[2], initialHiddenDiv = _a2[3], updateHiddenDiv = _a2[4], dataNeedsMeasuring = _a2[5], isInitialMeasure = _a2[6]; + React__namespace.useImperativeHandle(props.componentRef, function() { + return { remeasure }; + }, [remeasure]); + var className2 = props.className, onRenderData = props.onRenderData; + var divProps = getNativeProps(props, divProperties, ["data"]); + return React__namespace.createElement( + "div", + __assign$1({}, divProps, { className: className2, ref: mergedRootRef }), + React__namespace.createElement( + "div", + { style: hiddenParentStyles }, + dataNeedsMeasuring && !isInitialMeasure && React__namespace.createElement( + "div", + { style: hiddenDivStyles, ref: updateHiddenDiv }, + React__namespace.createElement(MeasuredContext.Provider, { value: measuredContextValue }, onRenderData(dataToMeasure)) + ), + React__namespace.createElement("div", { ref: initialHiddenDiv, style: isInitialMeasure ? hiddenDivStyles : void 0, "data-automation-id": "visibleContent" }, isInitialMeasure ? onRenderData(dataToMeasure) : renderedData && onRenderData(renderedData)) + ) + ); + }); + ResizeGroupBase.displayName = "ResizeGroupBase"; + var ResizeGroup = ResizeGroupBase; + var getClassNames$e = classNamesFunction(); + var TooltipBase = ( + /** @class */ + (function(_super) { + __extends(TooltipBase2, _super); + function TooltipBase2() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this._onRenderContent = function(props) { + if (typeof props.content === "string") { + return React__namespace.createElement("p", { className: _this._classNames.subText }, props.content); + } else { + return React__namespace.createElement("div", { className: _this._classNames.subText }, props.content); + } + }; + return _this; + } + TooltipBase2.prototype.render = function() { + var _a2 = this.props, className2 = _a2.className, calloutProps = _a2.calloutProps, directionalHint = _a2.directionalHint, directionalHintForRTL = _a2.directionalHintForRTL, styles = _a2.styles, id2 = _a2.id, maxWidth = _a2.maxWidth, _b2 = _a2.onRenderContent, onRenderContent = _b2 === void 0 ? this._onRenderContent : _b2, targetElement = _a2.targetElement, theme = _a2.theme; + this._classNames = getClassNames$e(styles, { + theme, + className: className2 || calloutProps && calloutProps.className, + beakWidth: calloutProps && calloutProps.isBeakVisible ? calloutProps.beakWidth : 0, + gapSpace: calloutProps && calloutProps.gapSpace, + maxWidth + }); + return React__namespace.createElement( + Callout, + __assign$1({ target: targetElement, directionalHint, directionalHintForRTL }, calloutProps, getNativeProps(this.props, divProperties, ["id"]), { className: this._classNames.root }), + React__namespace.createElement("div", { className: this._classNames.content, id: id2, onFocus: this.props.onFocus, onMouseEnter: this.props.onMouseEnter, onMouseLeave: this.props.onMouseLeave }, onRenderContent(this.props, this._onRenderContent)) + ); + }; + TooltipBase2.defaultProps = { + directionalHint: DirectionalHint.topCenter, + maxWidth: "364px", + calloutProps: { + isBeakVisible: true, + beakWidth: 16, + gapSpace: 0, + setInitialFocus: true, + doNotLayer: false + } + }; + return TooltipBase2; + })(React__namespace.Component) + ); + var getStyles$c = function(props) { + var className2 = props.className, _a2 = props.beakWidth, beakWidth = _a2 === void 0 ? 16 : _a2, _b2 = props.gapSpace, gapSpace = _b2 === void 0 ? 0 : _b2, maxWidth = props.maxWidth, theme = props.theme; + var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; + var tooltipGapSpace = -(Math.sqrt(beakWidth * beakWidth / 2) + gapSpace) + 1 / // There isn't really a great way to pass in a `window` reference here so disabling the line rule + // eslint-disable-next-line no-restricted-globals + window.devicePixelRatio; + return { + root: [ + "ms-Tooltip", + theme.fonts.medium, + AnimationClassNames.fadeIn200, + { + background: semanticColors.menuBackground, + boxShadow: effects.elevation8, + padding: "8px", + maxWidth, + selectors: { + ":after": { + content: "''", + position: "absolute", + bottom: tooltipGapSpace, + left: tooltipGapSpace, + right: tooltipGapSpace, + top: tooltipGapSpace, + zIndex: 0 + } + } + }, + className2 + ], + content: [ + "ms-Tooltip-content", + fonts.small, + { + position: "relative", + zIndex: 1, + color: semanticColors.menuItemText, + wordWrap: "break-word", + overflowWrap: "break-word", + overflow: "hidden" + } + ], + subText: [ + "ms-Tooltip-subtext", + { + // Using inherit here to avoid unintentional global overrides of the <p> tag. + fontSize: "inherit", + fontWeight: "inherit", + color: "inherit", + margin: 0 + } + ] + }; + }; + var Tooltip = styled(TooltipBase, getStyles$c, void 0, { + scope: "Tooltip" + }); + var TooltipDelay; + (function(TooltipDelay2) { + TooltipDelay2[TooltipDelay2["zero"] = 0] = "zero"; + TooltipDelay2[TooltipDelay2["medium"] = 1] = "medium"; + TooltipDelay2[TooltipDelay2["long"] = 2] = "long"; + })(TooltipDelay || (TooltipDelay = {})); + var TooltipOverflowMode; + (function(TooltipOverflowMode2) { + TooltipOverflowMode2[TooltipOverflowMode2["Parent"] = 0] = "Parent"; + TooltipOverflowMode2[TooltipOverflowMode2["Self"] = 1] = "Self"; + })(TooltipOverflowMode || (TooltipOverflowMode = {})); + var getClassNames$d = classNamesFunction(); + var TooltipHostBase = ( + /** @class */ + (function(_super) { + __extends(TooltipHostBase2, _super); + function TooltipHostBase2(props) { var _this = _super.call(this, props) || this; - _this._inputElement = _react.createRef(); - _this._autoFillEnabled = true; - // Composition events are used when the character/text requires several keystrokes to be completed. - // Some examples of this are mobile text input and languages like Japanese or Arabic. - // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart - _this._onCompositionStart = function(ev) { - _this.setState({ - isComposing: true - }); - _this._autoFillEnabled = false; + _this._tooltipHost = React__namespace.createRef(); + _this._defaultTooltipId = getId("tooltip"); + _this.show = function() { + _this._toggleTooltip(true); }; - // Composition events are used when the character/text requires several keystrokes to be completed. - // Some examples of this are mobile text input and languages like Japanese or Arabic. - // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart - _this._onCompositionUpdate = function() { - if ((0, _utilities.isIE11)()) _this._updateValue(_this._getCurrentInputValue(), true); + _this.dismiss = function() { + _this._hideTooltip(); }; - // Composition events are used when the character/text requires several keystrokes to be completed. - // Some examples of this are mobile text input and languages like Japanese or Arabic. - // Find out more at https://developer.mozilla.org/en-US/docs/Web/Events/compositionstart - _this._onCompositionEnd = function(ev) { - var inputValue = _this._getCurrentInputValue(); - _this._tryEnableAutofill(inputValue, _this.value, false, true); - _this.setState({ - isComposing: false - }); - // Due to timing, this needs to be async, otherwise no text will be selected. - _this._async.setTimeout(function() { - // it's technically possible that the value of isComposing is reset during this timeout, - // so explicitly trigger this with composing=true here, since it is supposed to be the - // update for composition end - _this._updateValue(_this._getCurrentInputValue(), false); - }, 0); + _this._getTargetElement = function() { + if (!_this._tooltipHost.current) { + return void 0; + } + var overflowMode = _this.props.overflowMode; + if (overflowMode !== void 0) { + switch (overflowMode) { + case TooltipOverflowMode.Parent: + return _this._tooltipHost.current.parentElement; + case TooltipOverflowMode.Self: + return _this._tooltipHost.current; + } + } + return _this._tooltipHost.current; }; - _this._onClick = function() { - if (_this.value && _this.value !== '' && _this._autoFillEnabled) _this._autoFillEnabled = false; + _this._onTooltipFocus = function(ev) { + if (_this._ignoreNextFocusEvent) { + _this._ignoreNextFocusEvent = false; + return; + } + _this._onTooltipMouseEnter(ev); }; - _this._onKeyDown = function(ev) { - if (_this.props.onKeyDown) _this.props.onKeyDown(ev); - // If the event is actively being composed, then don't alert autofill. - // Right now typing does not have isComposing, once that has been fixed any should be removed. - if (!ev.nativeEvent.isComposing) // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).backspace: - _this._autoFillEnabled = false; - break; - case (0, _utilities.KeyCodes).left: - case (0, _utilities.KeyCodes).right: - if (_this._autoFillEnabled) { - _this.setState(function(prev) { - return { - inputValue: _this.props.suggestedDisplayValue || prev.inputValue - }; - }); - _this._autoFillEnabled = false; - } - break; - default: - if (!_this._autoFillEnabled) // eslint-disable-next-line deprecation/deprecation - { - if (_this.props.enableAutofillOnKeyPress.indexOf(ev.which) !== -1) _this._autoFillEnabled = true; - } - break; - } + _this._onTooltipContentFocus = function(ev) { + if (TooltipHostBase2._currentVisibleTooltip && TooltipHostBase2._currentVisibleTooltip !== _this) { + TooltipHostBase2._currentVisibleTooltip.dismiss(); + } + TooltipHostBase2._currentVisibleTooltip = _this; + _this._clearDismissTimer(); + _this._clearOpenTimer(); }; - _this._onInputChanged = function(ev) { - var value = _this._getCurrentInputValue(ev); - if (!_this.state.isComposing) _this._tryEnableAutofill(value, _this.value, ev.nativeEvent.isComposing); - // If it is not IE11 and currently composing, update the value - if (!((0, _utilities.isIE11)() && _this.state.isComposing)) { - var nativeEventComposing = ev.nativeEvent.isComposing; - var isComposing = nativeEventComposing === undefined ? _this.state.isComposing : nativeEventComposing; - _this._updateValue(value, isComposing); - } + _this._onTooltipBlur = function(ev) { + var _a2; + _this._ignoreNextFocusEvent = ((_a2 = getDocumentEx(_this.context)) === null || _a2 === void 0 ? void 0 : _a2.activeElement) === ev.target; + _this._dismissTimerId = _this._async.setTimeout(function() { + _this._hideTooltip(); + }, 0); }; - _this._onChanged = function() { - // Swallow this event, we don't care about it - // We must provide it because React PropTypes marks it as required, but onInput serves the correct purpose + _this._onTooltipMouseEnter = function(ev) { + var _a2 = _this.props, overflowMode = _a2.overflowMode, delay = _a2.delay; + var doc = getDocumentEx(_this.context); + if (TooltipHostBase2._currentVisibleTooltip && TooltipHostBase2._currentVisibleTooltip !== _this) { + TooltipHostBase2._currentVisibleTooltip.dismiss(); + } + TooltipHostBase2._currentVisibleTooltip = _this; + if (overflowMode !== void 0) { + var overflowElement = _this._getTargetElement(); + if (overflowElement && !hasOverflow(overflowElement)) { + return; + } + } + if (ev.target && portalContainsElement(ev.target, _this._getTargetElement(), doc)) { return; + } + _this._clearDismissTimer(); + _this._clearOpenTimer(); + if (delay !== TooltipDelay.zero) { + var delayTime = _this._getDelayTime(delay); + _this._openTimerId = _this._async.setTimeout(function() { + _this._toggleTooltip(true); + }, delayTime); + } else { + _this._toggleTooltip(true); + } }; - /** - * Updates the current input value as well as getting a new display value. - * @param newValue - The new value from the input - */ _this._updateValue = function(newValue, composing) { - // Only proceed if the value is nonempty and is different from the old value - // This is to work around the fact that, in IE 11, inputs with a placeholder fire an onInput event on focus - if (!newValue && newValue === _this.value) return; - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, onInputChange = _a.onInputChange, onInputValueChange = _a.onInputValueChange; - if (onInputChange) newValue = (onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(newValue, composing)) || ''; - _this.setState({ - inputValue: newValue - }, function() { - return onInputValueChange === null || onInputValueChange === void 0 ? void 0 : onInputValueChange(newValue, composing); + _this._onTooltipMouseLeave = function(ev) { + var closeDelay = _this.props.closeDelay; + _this._clearDismissTimer(); + _this._clearOpenTimer(); + if (closeDelay) { + _this._dismissTimerId = _this._async.setTimeout(function() { + _this._toggleTooltip(false); + }, closeDelay); + } else { + _this._toggleTooltip(false); + } + if (TooltipHostBase2._currentVisibleTooltip === _this) { + TooltipHostBase2._currentVisibleTooltip = void 0; + } + }; + _this._onTooltipKeyDown = function(ev) { + if ((ev.which === KeyCodes.escape || ev.ctrlKey) && _this.state.isTooltipVisible) { + _this._hideTooltip(); + ev.stopPropagation(); + } + }; + _this._clearDismissTimer = function() { + _this._async.clearTimeout(_this._dismissTimerId); + }; + _this._clearOpenTimer = function() { + _this._async.clearTimeout(_this._openTimerId); + }; + _this._hideTooltip = function() { + _this._clearOpenTimer(); + _this._clearDismissTimer(); + _this._toggleTooltip(false); + }; + _this._toggleTooltip = function(isTooltipVisible) { + if (_this.state.isTooltipVisible !== isTooltipVisible) { + _this.setState({ isTooltipVisible }, function() { + return _this.props.onTooltipToggle && _this.props.onTooltipToggle(isTooltipVisible); }); + } }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); + _this._getDelayTime = function(delay) { + switch (delay) { + case TooltipDelay.medium: + return 300; + case TooltipDelay.long: + return 500; + default: + return 0; + } + }; + initializeComponentRef(_this); _this.state = { - inputValue: props.defaultVisibleValue || '', - isComposing: false + isAriaPlaceholderRendered: false, + isTooltipVisible: false }; return _this; - } - Autofill.getDerivedStateFromProps = function(props, state) { - // eslint-disable-next-line deprecation/deprecation - if (props.updateValueInWillReceiveProps) { - // eslint-disable-next-line deprecation/deprecation - var updatedInputValue = props.updateValueInWillReceiveProps(); - // Don't update if we have a null value or the value isn't changing - // the value should still update if an empty string is passed in - if (updatedInputValue !== null && updatedInputValue !== state.inputValue && !state.isComposing) return (0, _tslib.__assign)((0, _tslib.__assign)({}, state), { - inputValue: updatedInputValue - }); - } - return null; - }; - Object.defineProperty(Autofill.prototype, "cursorLocation", { - get: function() { - if (this._inputElement.current) { - var inputElement = this._inputElement.current; - if (inputElement.selectionDirection !== SELECTION_FORWARD) return inputElement.selectionEnd; - else return inputElement.selectionStart; - } else return -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "isValueSelected", { - get: function() { - return Boolean(this.inputElement && this.inputElement.selectionStart !== this.inputElement.selectionEnd); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "value", { - get: function() { - return this._getControlledValue() || this.state.inputValue || ''; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "selectionStart", { - get: function() { - return this._inputElement.current ? this._inputElement.current.selectionStart : -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "selectionEnd", { - get: function() { - return this._inputElement.current ? this._inputElement.current.selectionEnd : -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Autofill.prototype, "inputElement", { - get: function() { - return this._inputElement.current; - }, - enumerable: false, - configurable: true - }); - Autofill.prototype.componentDidUpdate = function(_, _1, cursor) { - var _a; - var _b = this.props, suggestedDisplayValue = _b.suggestedDisplayValue, shouldSelectFullInputValueInComponentDidUpdate = _b.shouldSelectFullInputValueInComponentDidUpdate, preventValueSelection = _b.preventValueSelection; - var differenceIndex = 0; - if (preventValueSelection) return; - var document = ((_a = this.context) === null || _a === void 0 ? void 0 : _a.window.document) || (0, _utilities.getDocument)(this._inputElement.current); - var isFocused = this._inputElement.current && this._inputElement.current === (document === null || document === void 0 ? void 0 : document.activeElement); - if (isFocused && this._autoFillEnabled && this.value && suggestedDisplayValue && _doesTextStartWith(suggestedDisplayValue, this.value)) { - var shouldSelectFullRange = false; - if (shouldSelectFullInputValueInComponentDidUpdate) shouldSelectFullRange = shouldSelectFullInputValueInComponentDidUpdate(); - if (shouldSelectFullRange) this._inputElement.current.setSelectionRange(0, suggestedDisplayValue.length, SELECTION_BACKWARD); - else { - while(differenceIndex < this.value.length && this.value[differenceIndex].toLocaleLowerCase() === suggestedDisplayValue[differenceIndex].toLocaleLowerCase())differenceIndex++; - if (differenceIndex > 0) this._inputElement.current.setSelectionRange(differenceIndex, suggestedDisplayValue.length, SELECTION_BACKWARD); - } - } else if (this._inputElement.current) { - if (cursor !== null && !this._autoFillEnabled && !this.state.isComposing) this._inputElement.current.setSelectionRange(cursor.start, cursor.end, cursor.dir); + } + TooltipHostBase2.prototype.render = function() { + var _a2 = this.props, calloutProps = _a2.calloutProps, children2 = _a2.children, content2 = _a2.content, directionalHint = _a2.directionalHint, directionalHintForRTL = _a2.directionalHintForRTL, className2 = _a2.hostClassName, id2 = _a2.id, _b2 = _a2.setAriaDescribedBy, setAriaDescribedBy = _b2 === void 0 ? true : _b2, tooltipProps = _a2.tooltipProps, styles = _a2.styles, theme = _a2.theme; + this._classNames = getClassNames$d(styles, { + theme, + className: className2 + }); + var isTooltipVisible = this.state.isTooltipVisible; + var tooltipId = id2 || this._defaultTooltipId; + var tooltipRenderProps = __assign$1(__assign$1({ id: "".concat(tooltipId, "--tooltip"), content: content2, targetElement: this._getTargetElement(), directionalHint, directionalHintForRTL, calloutProps: assign({}, calloutProps, { + onDismiss: this._hideTooltip, + onFocus: this._onTooltipContentFocus, + onMouseEnter: this._onTooltipMouseEnter, + onMouseLeave: this._onTooltipMouseLeave + }), onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave }, getNativeProps(this.props, divProperties, ["id"])), tooltipProps); + var tooltipContent = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.onRenderContent) ? tooltipProps.onRenderContent(tooltipRenderProps, function(props) { + return (props === null || props === void 0 ? void 0 : props.content) ? React__namespace.createElement(React__namespace.Fragment, null, props.content) : null; + }) : content2; + var showTooltip = isTooltipVisible && !!tooltipContent; + var ariaDescribedBy = setAriaDescribedBy && isTooltipVisible && !!tooltipContent ? tooltipId : void 0; + return React__namespace.createElement( + "div", + { className: this._classNames.root, ref: this._tooltipHost, onFocusCapture: this._onTooltipFocus, onBlurCapture: this._onTooltipBlur, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave, onKeyDown: this._onTooltipKeyDown, role: "none", "aria-describedby": ariaDescribedBy }, + children2, + showTooltip && React__namespace.createElement(Tooltip, __assign$1({}, tooltipRenderProps)), + React__namespace.createElement("div", { hidden: true, id: tooltipId, style: hiddenContentStyle }, tooltipContent) + ); + }; + TooltipHostBase2.prototype.componentDidMount = function() { + this._async = new Async(this); + }; + TooltipHostBase2.prototype.componentWillUnmount = function() { + if (TooltipHostBase2._currentVisibleTooltip && TooltipHostBase2._currentVisibleTooltip === this) { + TooltipHostBase2._currentVisibleTooltip = void 0; } - }; - Autofill.prototype.componentWillUnmount = function() { this._async.dispose(); + }; + TooltipHostBase2.defaultProps = { + delay: TooltipDelay.medium + }; + TooltipHostBase2.contextType = WindowContext; + return TooltipHostBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$8 = { + root: "ms-TooltipHost", + ariaPlaceholder: "ms-TooltipHost-aria-placeholder" + }; + var getStyles$b = function(props) { + var className2 = props.className, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$8, theme); + return { + root: [ + classNames2.root, + { + display: "inline" + }, + className2 + ] }; - Autofill.prototype.render = function() { - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.inputProperties)); - var style = (0, _tslib.__assign)((0, _tslib.__assign)({}, this.props.style), { - fontFamily: 'inherit' - }); - return _react.createElement("input", (0, _tslib.__assign)({ - autoCapitalize: "off", - autoComplete: "off", - "aria-autocomplete": 'both' - }, nativeProps, { - style: style, - ref: this._inputElement, - value: this._getDisplayValue(), - onCompositionStart: this._onCompositionStart, - onCompositionUpdate: this._onCompositionUpdate, - onCompositionEnd: this._onCompositionEnd, - // TODO (Fabric 8?) - switch to calling only onChange. See notes in TextField._onInputChange. - onChange: this._onChanged, - onInput: this._onInputChanged, - onKeyDown: this._onKeyDown, - onClick: this.props.onClick ? this.props.onClick : this._onClick, - "data-lpignore": true - })); - }; - Autofill.prototype.focus = function() { - this._inputElement.current && this._inputElement.current.focus(); - }; - Autofill.prototype.clear = function() { - this._autoFillEnabled = true; - this._updateValue('', false); - this._inputElement.current && this._inputElement.current.setSelectionRange(0, 0); - }; - Autofill.prototype.getSnapshotBeforeUpdate = function() { - var _a, _b; - var inel = this._inputElement.current; - if (inel && inel.selectionStart !== this.value.length) return { - start: (_a = inel.selectionStart) !== null && _a !== void 0 ? _a : inel.value.length, - end: (_b = inel.selectionEnd) !== null && _b !== void 0 ? _b : inel.value.length, - dir: inel.selectionDirection || 'backward' + }; + var TooltipHost = styled(TooltipHostBase, getStyles$b, void 0, { + scope: "TooltipHost" + }); + var getClassNames$c = classNamesFunction(); + var CommandBarBase = ( + /** @class */ + (function(_super) { + __extends(CommandBarBase2, _super); + function CommandBarBase2(props) { + var _this = _super.call(this, props) || this; + _this._overflowSet = React__namespace.createRef(); + _this._resizeGroup = React__namespace.createRef(); + _this._onRenderData = function(data2) { + var _a2 = _this.props, ariaLabel2 = _a2.ariaLabel, primaryGroupAriaLabel = _a2.primaryGroupAriaLabel, farItemsGroupAriaLabel = _a2.farItemsGroupAriaLabel; + var hasSecondSet = data2.farItems && data2.farItems.length > 0; + return React__namespace.createElement( + FocusZone, + { className: css(_this._classNames.root), direction: FocusZoneDirection.horizontal, role: "menubar", "aria-label": ariaLabel2 }, + React__namespace.createElement(OverflowSet, { role: hasSecondSet ? "group" : "none", "aria-label": hasSecondSet ? primaryGroupAriaLabel : void 0, componentRef: _this._overflowSet, className: css(_this._classNames.primarySet), items: data2.primaryItems, overflowItems: data2.overflowItems.length ? data2.overflowItems : void 0, onRenderItem: _this._onRenderItem, onRenderOverflowButton: _this._onRenderOverflowButton }), + hasSecondSet && React__namespace.createElement(OverflowSet, { role: "group", "aria-label": farItemsGroupAriaLabel, className: css(_this._classNames.secondarySet), items: data2.farItems, onRenderItem: _this._onRenderItem, onRenderOverflowButton: nullRender }) + ); }; - return null; - }; - Autofill.prototype._getCurrentInputValue = function(ev) { - if (ev && ev.target && ev.target.value) return ev.target.value; - else if (this.inputElement && this.inputElement.value) return this.inputElement.value; - else return ''; - }; - /** - * Attempts to enable autofill. Whether or not autofill is enabled depends on the input value, - * whether or not any text is selected, and only if the new input value is longer than the old input value. - * Autofill should never be set to true if the value is composing. Once compositionEnd is called, then - * it should be completed. - * See https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent for more information on composition. - * @param newValue - new input value - * @param oldValue - old input value - * @param isComposing - if true then the text is actively being composed and it has not completed. - * @param isComposed - if the text is a composed text value. - */ Autofill.prototype._tryEnableAutofill = function(newValue, oldValue, isComposing, isComposed) { - if (!isComposing && newValue && this._inputElement.current && this._inputElement.current.selectionStart === newValue.length && !this._autoFillEnabled && (newValue.length > oldValue.length || isComposed)) this._autoFillEnabled = true; - }; - Autofill.prototype._getDisplayValue = function() { - if (this._autoFillEnabled) return _getDisplayValue(this.value, this.props.suggestedDisplayValue); - return this.value; - }; - Autofill.prototype._getControlledValue = function() { - var value = this.props.value; - if (value === undefined || typeof value === 'string') return value; - // eslint-disable-next-line no-console - console.warn("props.value of Autofill should be a string, but it is ".concat(value, " with type of ").concat(typeof value)); - return value.toString(); - }; - Autofill.defaultProps = { - enableAutofillOnKeyPress: [ - (0, _utilities.KeyCodes).down, - (0, _utilities.KeyCodes).up - ] - }; - // need to check WindowContext to get the provided document - Autofill.contextType = (0, _reactWindowProvider.WindowContext); - return Autofill; -}(_react.Component); -/** - * Returns a string that should be used as the display value. - * It evaluates this based on whether or not the suggested value starts with the input value - * and whether or not autofill is enabled. - * @param inputValue - the value that the input currently has. - * @param suggestedDisplayValue - the possible full value - */ function _getDisplayValue(inputValue, suggestedDisplayValue) { - var displayValue = inputValue; - if (suggestedDisplayValue && inputValue && _doesTextStartWith(suggestedDisplayValue, displayValue)) displayValue = suggestedDisplayValue; - return displayValue; -} -function _doesTextStartWith(text, startWith) { - if (!text || !startWith) return false; - var _i, _a, val; - return text.toLocaleLowerCase().indexOf(startWith.toLocaleLowerCase()) === 0; -} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@fluentui/react-window-provider":"iP8C0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dwb0b":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Checkbox/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Checkbox/index":"kodpt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kodpt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _checkbox = require("./Checkbox"); -parcelHelpers.exportAll(_checkbox, exports); -var _checkboxBase = require("./Checkbox.base"); -parcelHelpers.exportAll(_checkboxBase, exports); -var _checkboxTypes = require("./Checkbox.types"); -parcelHelpers.exportAll(_checkboxTypes, exports); - -},{"./Checkbox":"MX8EY","./Checkbox.base":false,"./Checkbox.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"MX8EY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Checkbox", ()=>Checkbox); -var _utilities = require("@fluentui/utilities"); -var _checkboxBase = require("./Checkbox.base"); -var _checkboxStyles = require("./Checkbox.styles"); -var Checkbox = (0, _utilities.styled)((0, _checkboxBase.CheckboxBase), (0, _checkboxStyles.getStyles), undefined, { - scope: 'Checkbox' -}); - -},{"@fluentui/utilities":"55bj3","./Checkbox.base":"fwXOI","./Checkbox.styles":"jorBQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fwXOI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CheckboxBase", ()=>CheckboxBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _icon = require("../Icon/Icon"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var CheckboxBase = _react.forwardRef(function(props, forwardedRef) { - var disabled = props.disabled, required = props.required, inputProps = props.inputProps, name = props.name, ariaLabel = props.ariaLabel, ariaLabelledBy = props.ariaLabelledBy, ariaDescribedBy = props.ariaDescribedBy, ariaPositionInSet = props.ariaPositionInSet, ariaSetSize = props.ariaSetSize, title = props.title, checkmarkIconProps = props.checkmarkIconProps, styles = props.styles, theme = props.theme, className = props.className, _a = props.boxSide, boxSide = _a === void 0 ? 'start' : _a; - var id = (0, _reactHooks.useId)('checkbox-', props.id); - var rootRef = _react.useRef(null); - var mergedRootRefs = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var inputRef = _react.useRef(null); - var _b = (0, _reactHooks.useControllableValue)(props.checked, props.defaultChecked, props.onChange), isChecked = _b[0], setIsChecked = _b[1]; - var _c = (0, _reactHooks.useControllableValue)(props.indeterminate, props.defaultIndeterminate), isIndeterminate = _c[0], setIsIndeterminate = _c[1]; - (0, _utilities.useFocusRects)(rootRef); - useDebugWarning(props); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - disabled: disabled, - indeterminate: isIndeterminate, - checked: isChecked, - reversed: boxSide !== 'start', - isUsingCustomLabelRender: !!props.onRenderLabel - }); - var onChange = _react.useCallback(function(event) { - if (isIndeterminate) { - // If indeterminate, clicking the checkbox *only* removes the indeterminate state (or if - // controlled, lets the consumer know to change it by calling onChange). It doesn't - // change the checked state. - setIsChecked(!!isChecked, event); - setIsIndeterminate(false); - } else setIsChecked(!isChecked, event); - }, [ - setIsChecked, - setIsIndeterminate, - isIndeterminate, - isChecked - ]); - var defaultLabelRenderer = _react.useCallback(function(checkboxProps) { - if (!checkboxProps) return null; - return checkboxProps.label ? _react.createElement("span", { - className: classNames.text, - title: checkboxProps.title - }, checkboxProps.label) : null; - }, [ - classNames.text - ]); - var setNativeIndeterminate = _react.useCallback(function(indeterminate1) { - if (!inputRef.current) return; - var value = !!indeterminate1; - inputRef.current.indeterminate = value; - setIsIndeterminate(value); - }, [ - setIsIndeterminate - ]); - useComponentRef(props, isChecked, isIndeterminate, setNativeIndeterminate, inputRef); - _react.useEffect(function() { - return setNativeIndeterminate(isIndeterminate); - }, [ - setNativeIndeterminate, - isIndeterminate - ]); - var onRenderLabel = props.onRenderLabel || defaultLabelRenderer; - var ariaChecked = isIndeterminate ? 'mixed' : undefined; - var mergedInputProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - className: classNames.input, - type: 'checkbox' - }, inputProps), { - checked: !!isChecked, - disabled: disabled, - required: required, - name: name, - id: id, - title: title, - onChange: onChange, - 'aria-disabled': disabled, - 'aria-label': ariaLabel, - 'aria-labelledby': ariaLabelledBy, - 'aria-describedby': ariaDescribedBy, - 'aria-posinset': ariaPositionInSet, - 'aria-setsize': ariaSetSize, - 'aria-checked': ariaChecked - }); - return _react.createElement("div", { - className: classNames.root, - title: title, - ref: mergedRootRefs - }, _react.createElement("input", (0, _tslib.__assign)({}, mergedInputProps, { - ref: inputRef, - title: title, - "data-ktp-execute-target": true - })), _react.createElement("label", { - className: classNames.label, - htmlFor: id - }, _react.createElement("div", { - className: classNames.checkbox, - "data-ktp-target": true - }, _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - iconName: "CheckMark" - }, checkmarkIconProps, { - className: classNames.checkmark - }))), onRenderLabel(props, defaultLabelRenderer))); -}); -CheckboxBase.displayName = 'CheckboxBase'; -function useDebugWarning(props) {} -function useComponentRef(props, isChecked, isIndeterminate, setIndeterminate, checkBoxRef) { - _react.useImperativeHandle(props.componentRef, function() { - return { - get checked () { - return !!isChecked; - }, - get indeterminate () { - return !!isIndeterminate; - }, - set indeterminate (indeterminate){ - setIndeterminate(indeterminate); - }, - focus: function() { - if (checkBoxRef.current) checkBoxRef.current.focus(); - } + _this._onRenderItem = function(item) { + if (item.onRender) { + return item.onRender(item, function() { + return void 0; + }); + } + var itemText = item.text || item.name; + var commandButtonProps = __assign$1(__assign$1({ allowDisabledFocus: true, role: "menuitem" }, item), { styles: getCommandButtonStyles(item.buttonStyles), className: css("ms-CommandBarItem-link", item.className), text: !item.iconOnly ? itemText : void 0, menuProps: item.subMenuProps, onClick: _this._onButtonClick(item) }); + if (item.iconOnly && (itemText !== void 0 || item.tooltipHostProps)) { + return React__namespace.createElement(TooltipHost, __assign$1({ + role: "none", + content: itemText, + // eslint-disable-next-line @typescript-eslint/no-deprecated + setAriaDescribedBy: false + }, item.tooltipHostProps), _this._commandButton(item, commandButtonProps)); + } + return _this._commandButton(item, commandButtonProps); + }; + _this._commandButton = function(item, props2) { + var ButtonAs = _this.props.buttonAs; + var CommandBarButtonAs = item.commandBarButtonAs; + var DefaultButtonAs = CommandBarButton; + var Type = DefaultButtonAs; + if (CommandBarButtonAs) { + Type = composeComponentAs(CommandBarButtonAs, Type); + } + if (ButtonAs) { + Type = composeComponentAs(ButtonAs, Type); + } + return React__namespace.createElement(Type, __assign$1({}, props2)); }; - }, [ - checkBoxRef, - isChecked, - isIndeterminate, - setIndeterminate - ]); -} - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../Icon/Icon":"gfQnz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jorBQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styleUtilities = require("@fluentui/style-utilities"); -var _utilities = require("@fluentui/utilities"); -var GlobalClassNames = { - root: 'ms-Checkbox', - label: 'ms-Checkbox-label', - checkbox: 'ms-Checkbox-checkbox', - checkmark: 'ms-Checkbox-checkmark', - text: 'ms-Checkbox-text' -}; -var MS_CHECKBOX_LABEL_SIZE = '20px'; -var MS_CHECKBOX_TRANSITION_DURATION = '200ms'; -var MS_CHECKBOX_TRANSITION_TIMING = 'cubic-bezier(.4, 0, .23, 1)'; -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t; - var className = props.className, theme = props.theme, reversed = props.reversed, checked = props.checked, disabled = props.disabled, isUsingCustomLabelRender = props.isUsingCustomLabelRender, indeterminate = props.indeterminate; - var semanticColors = theme.semanticColors, effects = theme.effects, palette = theme.palette, fonts = theme.fonts; - var classNames = (0, _styleUtilities.getGlobalClassNames)(GlobalClassNames, theme); - var checkmarkFontColor = semanticColors.inputForegroundChecked; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.inputBorder - var checkmarkFontColorHovered = palette.neutralSecondary; - // TODO: after updating the semanticColors slots mapping this needs to be semanticColors.smallInputBorder - var checkboxBorderColor = palette.neutralPrimary; - var checkboxBorderIndeterminateColor = semanticColors.inputBackgroundChecked; - var checkboxBorderColorChecked = semanticColors.inputBackgroundChecked; - var checkboxBorderColorDisabled = semanticColors.disabledBodySubtext; - var checkboxBorderHoveredColor = semanticColors.inputBorderHovered; - var checkboxBorderIndeterminateHoveredColor = semanticColors.inputBackgroundCheckedHovered; - var checkboxBackgroundChecked = semanticColors.inputBackgroundChecked; - // TODO: after updating the semanticColors slots mapping the following 2 tokens need to be - // semanticColors.inputBackgroundCheckedHovered - var checkboxBackgroundCheckedHovered = semanticColors.inputBackgroundCheckedHovered; - var checkboxBorderColorCheckedHovered = semanticColors.inputBackgroundCheckedHovered; - var checkboxHoveredTextColor = semanticColors.inputTextHovered; - var checkboxBackgroundDisabledChecked = semanticColors.disabledBodySubtext; - var checkboxTextColor = semanticColors.bodyText; - var checkboxTextColorDisabled = semanticColors.disabledText; - var indeterminateDotStyles = [ - (_a = { - content: '""', - borderRadius: effects.roundedCorner2, - position: 'absolute', - width: 10, - height: 10, - top: 4, - left: 4, - boxSizing: 'border-box', - borderWidth: 5, - borderStyle: 'solid', - borderColor: disabled ? checkboxBorderColorDisabled : checkboxBorderIndeterminateColor, - transitionProperty: 'border-width, border, border-color', - transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, - transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING - }, _a[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'WindowText' - }, _a) - ]; + _this._onRenderOverflowButton = function(overflowItems) { + var _a2 = _this.props.overflowButtonProps, overflowButtonProps = _a2 === void 0 ? {} : _a2; + var combinedOverflowItems = __spreadArray(__spreadArray([], overflowButtonProps.menuProps ? overflowButtonProps.menuProps.items : [], true), overflowItems, true); + var overflowProps = __assign$1(__assign$1({ role: "menuitem" }, overflowButtonProps), { styles: __assign$1({ menuIcon: { fontSize: "17px" } }, overflowButtonProps.styles), className: css("ms-CommandBar-overflowButton", overflowButtonProps.className), menuProps: __assign$1(__assign$1({}, overflowButtonProps.menuProps), { items: combinedOverflowItems }), menuIconProps: __assign$1({ iconName: "More" }, overflowButtonProps.menuIconProps) }); + var OverflowButtonType = _this.props.overflowButtonAs ? composeComponentAs(_this.props.overflowButtonAs, CommandBarButton) : CommandBarButton; + return React__namespace.createElement(OverflowButtonType, __assign$1({}, overflowProps)); + }; + _this._onReduceData = function(data2) { + var _a2 = _this.props, shiftOnReduce = _a2.shiftOnReduce, onDataReduced = _a2.onDataReduced; + var primaryItems = data2.primaryItems, overflowItems = data2.overflowItems, cacheKey = data2.cacheKey; + var farItems = data2.farItems; + var movedItem = primaryItems[shiftOnReduce ? 0 : primaryItems.length - 1]; + if (movedItem !== void 0) { + movedItem.renderedInOverflow = true; + overflowItems = __spreadArray([movedItem], overflowItems, true); + primaryItems = shiftOnReduce ? primaryItems.slice(1) : primaryItems.slice(0, -1); + var newData = __assign$1(__assign$1({}, data2), { primaryItems, overflowItems }); + cacheKey = _this._computeCacheKey({ primaryItems, overflow: overflowItems.length > 0, farItems }); + if (onDataReduced) { + onDataReduced(movedItem); + } + newData.cacheKey = cacheKey; + return newData; + } + return void 0; + }; + _this._onGrowData = function(data2) { + var _a2 = _this.props, shiftOnReduce = _a2.shiftOnReduce, onDataGrown = _a2.onDataGrown; + var minimumOverflowItems = data2.minimumOverflowItems; + var primaryItems = data2.primaryItems, overflowItems = data2.overflowItems, cacheKey = data2.cacheKey; + var farItems = data2.farItems; + var movedItem = overflowItems[0]; + if (movedItem !== void 0 && overflowItems.length > minimumOverflowItems) { + movedItem.renderedInOverflow = false; + overflowItems = overflowItems.slice(1); + primaryItems = shiftOnReduce ? __spreadArray([movedItem], primaryItems, true) : __spreadArray(__spreadArray([], primaryItems, true), [movedItem], false); + var newData = __assign$1(__assign$1({}, data2), { primaryItems, overflowItems }); + cacheKey = _this._computeCacheKey({ primaryItems, overflow: overflowItems.length > 0, farItems }); + if (onDataGrown) { + onDataGrown(movedItem); + } + newData.cacheKey = cacheKey; + return newData; + } + return void 0; + }; + initializeComponentRef(_this); + return _this; + } + CommandBarBase2.prototype.render = function() { + var _a2 = this.props, items = _a2.items, overflowItems = _a2.overflowItems, farItems = _a2.farItems, styles = _a2.styles, theme = _a2.theme, dataDidRender = _a2.dataDidRender, _b2 = _a2.onReduceData, onReduceData = _b2 === void 0 ? this._onReduceData : _b2, _c2 = _a2.onGrowData, onGrowData = _c2 === void 0 ? this._onGrowData : _c2, _d2 = _a2.resizeGroupAs, ResizeGroupAs = _d2 === void 0 ? ResizeGroup : _d2; + var commandBarData = { + primaryItems: __spreadArray([], items, true), + overflowItems: __spreadArray([], overflowItems, true), + minimumOverflowItems: __spreadArray([], overflowItems, true).length, + // for tracking + farItems, + cacheKey: this._computeCacheKey({ + primaryItems: __spreadArray([], items, true), + overflow: overflowItems && overflowItems.length > 0, + farItems + }) + }; + this._classNames = getClassNames$c(styles, { theme }); + var nativeProps = getNativeProps(this.props, divProperties); + return React__namespace.createElement(ResizeGroupAs, __assign$1({}, nativeProps, { componentRef: this._resizeGroup, data: commandBarData, onReduceData, onGrowData, onRenderData: this._onRenderData, dataDidRender })); + }; + CommandBarBase2.prototype.focus = function() { + var overflowSet = this._overflowSet.current; + overflowSet && overflowSet.focus(); + }; + CommandBarBase2.prototype.remeasure = function() { + this._resizeGroup.current && this._resizeGroup.current.remeasure(); + }; + CommandBarBase2.prototype._onButtonClick = function(item) { + return function(ev) { + if (item.inactive) { + return; + } + if (item.onClick) { + item.onClick(ev, item); + } + }; + }; + CommandBarBase2.prototype._computeCacheKey = function(data2) { + var primaryItems = data2.primaryItems, overflow = data2.overflow, farItems = data2.farItems; + var returnKey = function(acc, current) { + var _a2 = current.cacheKey, cacheKey = _a2 === void 0 ? current.key : _a2; + return acc + cacheKey; + }; + var primaryKey = primaryItems && primaryItems.reduce(returnKey, ""); + var overflowKey = overflow ? "overflow" : ""; + var farKey = farItems && farItems.reduce(returnKey, ""); + return [primaryKey, overflowKey, farKey].join(""); + }; + CommandBarBase2.defaultProps = { + items: [], + overflowItems: [] + }; + return CommandBarBase2; + })(React__namespace.Component) + ); + var CommandBar = styled(CommandBarBase, getStyles$e, void 0, { + scope: "CommandBar" + }); + var DialogType; + (function(DialogType2) { + DialogType2[DialogType2["normal"] = 0] = "normal"; + DialogType2[DialogType2["largeHeader"] = 1] = "largeHeader"; + DialogType2[DialogType2["close"] = 2] = "close"; + })(DialogType || (DialogType = {})); + var animationDuration = AnimationVariables.durationValue2; + var globalClassNames$1 = { + root: "ms-Modal", + main: "ms-Dialog-main", + scrollableContent: "ms-Modal-scrollableContent", + isOpen: "is-open", + layer: "ms-Modal-Layer" + }; + var getStyles$a = function(props) { + var _a2; + var className2 = props.className, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, isOpen = props.isOpen, isVisible = props.isVisible, hasBeenOpened = props.hasBeenOpened, modalRectangleTop = props.modalRectangleTop, theme = props.theme, topOffsetFixed = props.topOffsetFixed, isModeless = props.isModeless, layerClassName = props.layerClassName, isDefaultDragHandle = props.isDefaultDragHandle, windowInnerHeight = props.windowInnerHeight; + var palette = theme.palette, effects = theme.effects, fonts = theme.fonts; + var classNames2 = getGlobalClassNames(globalClassNames$1, theme); + return { + root: [ + classNames2.root, + fonts.medium, + { + backgroundColor: "transparent", + position: "fixed", + height: "100%", + width: "100%", + display: "flex", + alignItems: "center", + justifyContent: "center", + opacity: 0, + pointerEvents: "none", + transition: "opacity ".concat(animationDuration) + }, + topOffsetFixed && typeof modalRectangleTop === "number" && hasBeenOpened && { + alignItems: "flex-start" + }, + isOpen && classNames2.isOpen, + isVisible && { + opacity: 1 + }, + isVisible && !isModeless && { + pointerEvents: "auto" + }, + className2 + ], + main: [ + classNames2.main, + { + boxShadow: effects.elevation64, + borderRadius: effects.roundedCorner2, + backgroundColor: palette.white, + boxSizing: "border-box", + position: "relative", + textAlign: "left", + outline: "3px solid transparent", + maxHeight: "calc(100% - 32px)", + maxWidth: "calc(100% - 32px)", + minHeight: "176px", + minWidth: "288px", + overflowY: "auto", + zIndex: isModeless ? ZIndexes.Layer : void 0 + }, + isModeless && { + pointerEvents: "auto" + }, + topOffsetFixed && typeof modalRectangleTop === "number" && hasBeenOpened && { + top: modalRectangleTop + }, + isDefaultDragHandle && { + cursor: "move" + }, + containerClassName + ], + scrollableContent: [ + classNames2.scrollableContent, + { + overflowY: "auto", + flexGrow: 1, + maxHeight: "100vh", + selectors: (_a2 = {}, _a2["@supports (-webkit-overflow-scrolling: touch)"] = { + maxHeight: windowInnerHeight + }, _a2) + }, + scrollableContentClassName + ], + layer: isModeless && [layerClassName, classNames2.layer, { pointerEvents: "none" }], + keyboardMoveIconContainer: { + position: "absolute", + display: "flex", + justifyContent: "center", + width: "100%", + padding: "3px 0px" + }, + keyboardMoveIcon: { + // eslint-disable-next-line @typescript-eslint/no-deprecated + fontSize: fonts.xLargePlus.fontSize, + width: "24px" + } + }; + }; + var getClassNames$b = classNamesFunction(); + var OverlayBase = ( + /** @class */ + (function(_super) { + __extends(OverlayBase2, _super); + function OverlayBase2(props) { + var _this = _super.call(this, props) || this; + initializeComponentRef(_this); + var _a2 = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a2 === void 0 ? false : _a2; + _this._allowTouchBodyScroll = allowTouchBodyScroll; + return _this; + } + OverlayBase2.prototype.componentDidMount = function() { + !this._allowTouchBodyScroll && disableBodyScroll(); + }; + OverlayBase2.prototype.componentWillUnmount = function() { + !this._allowTouchBodyScroll && enableBodyScroll(); + }; + OverlayBase2.prototype.render = function() { + var _a2 = this.props, isDark = _a2.isDarkThemed, className2 = _a2.className, theme = _a2.theme, styles = _a2.styles; + var divProps = getNativeProps(this.props, divProperties); + var classNames2 = getClassNames$b(styles, { + theme, + className: className2, + isDark + }); + return React__namespace.createElement("div", __assign$1({}, divProps, { className: classNames2.root })); + }; + return OverlayBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$7 = { + root: "ms-Overlay", + rootDark: "ms-Overlay--dark" + }; + var getStyles$9 = function(props) { + var _a2; + var className2 = props.className, theme = props.theme, isNone = props.isNone, isDark = props.isDark; + var palette = theme.palette; + var classNames2 = getGlobalClassNames(GlobalClassNames$7, theme); return { - root: [ - classNames.root, - { - position: 'relative', - display: 'flex' - }, - reversed && 'reversed', - checked && 'is-checked', - !disabled && 'is-enabled', - disabled && 'is-disabled', - !disabled && [ - !checked && (_b = {}, _b[":hover .".concat(classNames.checkbox)] = (_c = { - borderColor: checkboxBorderHoveredColor - }, _c[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _c), _b[":focus .".concat(classNames.checkbox)] = { - borderColor: checkboxBorderHoveredColor - }, _b[":hover .".concat(classNames.checkmark)] = (_d = { - color: checkmarkFontColorHovered, - opacity: '1' - }, _d[0, _styleUtilities.HighContrastSelector] = { - color: 'Highlight' - }, _d), _b), - checked && !indeterminate && (_e = {}, _e[":hover .".concat(classNames.checkbox)] = { - background: checkboxBackgroundCheckedHovered, - borderColor: checkboxBorderColorCheckedHovered - }, _e[":focus .".concat(classNames.checkbox)] = { - background: checkboxBackgroundCheckedHovered, - borderColor: checkboxBorderColorCheckedHovered - }, _e[0, _styleUtilities.HighContrastSelector] = (_f = {}, _f[":hover .".concat(classNames.checkbox)] = { - background: 'Highlight', - borderColor: 'Highlight' - }, _f[":focus .".concat(classNames.checkbox)] = { - background: 'Highlight' - }, _f[":focus:hover .".concat(classNames.checkbox)] = { - background: 'Highlight' - }, _f[":focus:hover .".concat(classNames.checkmark)] = { - color: 'Window' - }, _f[":hover .".concat(classNames.checkmark)] = { - color: 'Window' - }, _f), _e), - indeterminate && (_g = {}, _g[":hover .".concat(classNames.checkbox, ", :hover .").concat(classNames.checkbox, ":after")] = (_h = { - borderColor: checkboxBorderIndeterminateHoveredColor - }, _h[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'WindowText' - }, _h), _g[":focus .".concat(classNames.checkbox)] = { - borderColor: checkboxBorderIndeterminateHoveredColor - }, _g[":hover .".concat(classNames.checkmark)] = { - opacity: '0' - }, _g), - (_j = {}, _j[":hover .".concat(classNames.text, ", :focus .").concat(classNames.text)] = (_k = { - color: checkboxHoveredTextColor - }, _k[0, _styleUtilities.HighContrastSelector] = { - color: disabled ? 'GrayText' : 'WindowText' - }, _k), _j) - ], - className - ], - input: (_l = { - position: 'absolute', - background: 'none', + root: [ + classNames2.root, + theme.fonts.medium, + { + backgroundColor: palette.whiteTranslucent40, + top: 0, + right: 0, + bottom: 0, + left: 0, + position: "absolute", + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + border: "1px solid WindowText", opacity: 0 - }, // eslint-disable-next-line @fluentui/max-len - _l[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus + label::before, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus + label::before")] = (_m = { - outline: '1px solid ' + theme.palette.neutralSecondary, - outlineOffset: '2px' - }, _m[0, _styleUtilities.HighContrastSelector] = { - outline: '1px solid WindowText' - }, _m), _l), - label: [ - classNames.label, - theme.fonts.medium, - { - display: 'flex', - alignItems: isUsingCustomLabelRender ? 'center' : 'flex-start', - cursor: disabled ? 'default' : 'pointer', - position: 'relative', - userSelect: 'none' - }, - reversed && { - flexDirection: 'row-reverse', - justifyContent: 'flex-end' - }, - { - '&::before': { - position: 'absolute', - left: 0, - right: 0, - top: 0, - bottom: 0, - content: '""', - pointerEvents: 'none' - } - } - ], - checkbox: [ - classNames.checkbox, - (_o = { - position: 'relative', - display: 'flex', - flexShrink: 0, - alignItems: 'center', - justifyContent: 'center', - height: MS_CHECKBOX_LABEL_SIZE, - width: MS_CHECKBOX_LABEL_SIZE, - border: "1px solid ".concat(checkboxBorderColor), - borderRadius: effects.roundedCorner2, - boxSizing: 'border-box', - transitionProperty: 'background, border, border-color', - transitionDuration: MS_CHECKBOX_TRANSITION_DURATION, - transitionTimingFunction: MS_CHECKBOX_TRANSITION_TIMING, - /* in case the icon is bigger than the box */ overflow: 'hidden', - ':after': indeterminate ? indeterminateDotStyles : null - }, _o[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'WindowText' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _o), - indeterminate && { - borderColor: checkboxBorderIndeterminateColor - }, - !reversed ? // is used, there will be only a 4px margin from checkbox to label. The label by default would have - // another 4px margin for a total of 8px margin between checkbox and label. We don't combine the two - // (and move it into the text) to not incur a breaking change for everyone using custom render atm. - { - marginRight: 4 - } : { - marginLeft: 4 - }, - !disabled && !indeterminate && checked && (_p = { - background: checkboxBackgroundChecked, - borderColor: checkboxBorderColorChecked - }, _p[0, _styleUtilities.HighContrastSelector] = { - background: 'Highlight', - borderColor: 'Highlight' - }, _p), - disabled && (_q = { - borderColor: checkboxBorderColorDisabled - }, _q[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'GrayText' - }, _q), - checked && disabled && (_r = { - background: checkboxBackgroundDisabledChecked, - borderColor: checkboxBorderColorDisabled - }, _r[0, _styleUtilities.HighContrastSelector] = { - background: 'Window' - }, _r) - ], - checkmark: [ - classNames.checkmark, - (_s = { - opacity: checked && !indeterminate ? '1' : '0', - color: checkmarkFontColor - }, _s[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - color: disabled ? 'GrayText' : 'Window' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _s) + }, _a2) + }, + isNone && { + visibility: "hidden" + }, + isDark && [ + classNames2.rootDark, + { + backgroundColor: palette.blackTranslucent40 + } ], - text: [ - classNames.text, - (_t = { - color: disabled ? checkboxTextColorDisabled : checkboxTextColor, - fontSize: fonts.medium.fontSize, - lineHeight: '20px' - }, _t[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - color: disabled ? 'GrayText' : 'WindowText' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _t), - !reversed ? { - marginLeft: 4 - } : { - marginRight: 4 - } - ] + className2 + ] }; -}; - -},{"tslib":"9gizs","@fluentui/style-utilities":"bJvmh","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5808M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getOptionStyles", ()=>getOptionStyles); -parcelHelpers.export(exports, "getCaretDownButtonStyles", ()=>getCaretDownButtonStyles); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var _a, _b; -var ComboBoxHeight = 32; -var ComboBoxLineHeight = 30; -var ComboBoxCaretDownWidth = 32; -var ComboBoxOptionHeight = 36; -var getDisabledStyles = (0, _utilities.memoizeFunction)(function(theme) { - var _a; - var semanticColors = theme.semanticColors; + }; + var Overlay = styled(OverlayBase, getStyles$9, void 0, { + scope: "Overlay" + }); + var getClassNames$a = memoizeFunction(function(className2, isDragging) { return { - backgroundColor: semanticColors.disabledBackground, - color: semanticColors.disabledText, - cursor: 'default', - selectors: (_a = { - ':after': { - borderColor: semanticColors.disabledBackground - } - }, _a[0, _styling.HighContrastSelector] = { - color: 'GrayText', - selectors: { - ':after': { - borderColor: 'GrayText' - } - } - }, _a) - }; -}); -var listOptionHighContrastStyles = { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) -}; -var inputHighContrastStyles = { - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'WindowText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _b) -}; -var getOptionStyles = (0, _utilities.memoizeFunction)(function(theme, customStylesForAllOptions, customOptionStylesForCurrentOption, isPending, isHidden, isSelected) { - var _a; - var palette = theme.palette, semanticColors = theme.semanticColors; - var option = { - textHoveredColor: semanticColors.menuItemTextHovered, - textSelectedColor: palette.neutralDark, - textDisabledColor: semanticColors.disabledText, - backgroundHoveredColor: semanticColors.menuItemBackgroundHovered, - backgroundPressedColor: semanticColors.menuItemBackgroundPressed - }; - var optionStyles = { - root: [ - theme.fonts.medium, - { - backgroundColor: isPending ? option.backgroundHoveredColor : 'transparent', - boxSizing: 'border-box', - cursor: 'pointer', - display: isHidden ? 'none' : 'block', - width: '100%', - height: 'auto', - minHeight: ComboBoxOptionHeight, - lineHeight: '20px', - padding: '0 8px', - position: 'relative', - borderWidth: '1px', - borderStyle: 'solid', - borderColor: 'transparent', - borderRadius: 0, - wordWrap: 'break-word', - overflowWrap: 'break-word', - textAlign: 'left', - selectors: (0, _tslib.__assign)((0, _tslib.__assign)((_a = {}, _a[0, _styling.HighContrastSelector] = { - border: 'none', - borderColor: 'Background' - }, _a), !isHidden && { - '&.ms-Checkbox': { - display: 'flex', - alignItems: 'center' - } - }), { - '&.ms-Button--command:hover:active': { - backgroundColor: option.backgroundPressedColor - }, - '.ms-Checkbox-label': { - width: '100%' - } - }) - }, - isSelected ? [ - { - backgroundColor: 'transparent', - color: option.textSelectedColor, - selectors: { - ':hover': [ - { - backgroundColor: option.backgroundHoveredColor - }, - listOptionHighContrastStyles - ] - } - }, - (0, _styling.getFocusStyle)(theme, { - inset: -1, - isFocusedOnly: false - }), - listOptionHighContrastStyles - ] : [] - ], - rootHovered: { - backgroundColor: option.backgroundHoveredColor, - color: option.textHoveredColor - }, - rootFocused: { - backgroundColor: option.backgroundHoveredColor - }, - rootDisabled: { - color: option.textDisabledColor, - cursor: 'default' - }, - optionText: { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - minWidth: '0px', - maxWidth: '100%', - wordWrap: 'break-word', - overflowWrap: 'break-word', - display: 'inline-block' - }, - optionTextWrapper: { - maxWidth: '100%', - display: 'flex', - alignItems: 'center' + root: mergeStyles(className2, isDragging && { + touchAction: "none", + selectors: { + "& *": { + userSelect: "none" + } } + }) }; - return (0, _styling.concatStyleSets)(optionStyles, customStylesForAllOptions, customOptionStylesForCurrentOption); -}); -var getCaretDownButtonStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles) { - var _a, _b; - var semanticColors = theme.semanticColors, fonts = theme.fonts; - var caret = { - buttonTextColor: semanticColors.bodySubtext, - buttonTextHoveredCheckedColor: semanticColors.buttonTextChecked, - buttonBackgroundHoveredColor: semanticColors.listItemBackgroundHovered, - buttonBackgroundCheckedColor: semanticColors.listItemBackgroundChecked, - buttonBackgroundCheckedHoveredColor: semanticColors.listItemBackgroundCheckedHovered - }; - var buttonHighContrastStyles = { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) + }); + var eventMapping = { + touch: { + start: "touchstart", + move: "touchmove", + stop: "touchend" + }, + mouse: { + start: "mousedown", + move: "mousemove", + stop: "mouseup" + } + }; + var DraggableZone = ( + /** @class */ + (function(_super) { + __extends(DraggableZone2, _super); + function DraggableZone2(props) { + var _this = _super.call(this, props) || this; + _this._currentEventType = eventMapping.mouse; + _this._events = []; + _this._onMouseDown = function(event2) { + var onMouseDown = React__namespace.Children.only(_this.props.children).props.onMouseDown; + if (onMouseDown) { + onMouseDown(event2); + } + _this._currentEventType = eventMapping.mouse; + return _this._onDragStart(event2); + }; + _this._onMouseUp = function(event2) { + var onMouseUp = React__namespace.Children.only(_this.props.children).props.onMouseUp; + if (onMouseUp) { + onMouseUp(event2); + } + _this._currentEventType = eventMapping.mouse; + return _this._onDragStop(event2); + }; + _this._onTouchStart = function(event2) { + var onTouchStart = React__namespace.Children.only(_this.props.children).props.onTouchStart; + if (onTouchStart) { + onTouchStart(event2); + } + _this._currentEventType = eventMapping.touch; + return _this._onDragStart(event2); + }; + _this._onTouchEnd = function(event2) { + var onTouchEnd = React__namespace.Children.only(_this.props.children).props.onTouchEnd; + if (onTouchEnd) { + onTouchEnd(event2); + } + _this._currentEventType = eventMapping.touch; + _this._onDragStop(event2); + }; + _this._onDragStart = function(event2) { + if (typeof event2.button === "number" && event2.button !== 0) { + return false; + } + if (_this.props.handleSelector && !_this._matchesSelector(event2.target, _this.props.handleSelector) || _this.props.preventDragSelector && _this._matchesSelector(event2.target, _this.props.preventDragSelector)) { + return; + } + _this._touchId = _this._getTouchId(event2); + var position2 = _this._getControlPosition(event2); + if (position2 === void 0) { + return; + } + var dragData = _this._createDragDataFromPosition(position2); + _this.props.onStart && _this.props.onStart(event2, dragData); + _this.setState({ + isDragging: true, + lastPosition: position2 + }); + var doc = getDocumentEx(_this.context); + _this._events = [ + on$1( + doc.body, + _this._currentEventType.move, + _this._onDrag, + true + /* use capture phase */ + ), + on$1( + doc.body, + _this._currentEventType.stop, + _this._onDragStop, + true + /* use capture phase */ + ) + ]; + }; + _this._onDrag = function(event2) { + if (event2.type === "touchmove") { + event2.preventDefault(); + } + var position2 = _this._getControlPosition(event2); + if (!position2) { + return; + } + var updatedData = _this._createUpdatedDragData(_this._createDragDataFromPosition(position2)); + var updatedPosition = updatedData.position; + _this.props.onDragChange && _this.props.onDragChange(event2, updatedData); + _this.setState({ + position: updatedPosition, + lastPosition: position2 + }); + }; + _this._onDragStop = function(event2) { + if (!_this.state.isDragging) { + return; + } + var position2 = _this._getControlPosition(event2); + if (!position2) { + return; + } + var baseDragData = _this._createDragDataFromPosition(position2); + _this.setState({ + isDragging: false, + lastPosition: void 0 + }); + _this.props.onStop && _this.props.onStop(event2, baseDragData); + if (_this.props.position) { + _this.setState({ + position: _this.props.position + }); + } + _this._events.forEach(function(dispose) { + return dispose(); + }); + }; + _this.state = { + isDragging: false, + position: _this.props.position || { x: 0, y: 0 }, + lastPosition: void 0 + }; + return _this; + } + DraggableZone2.prototype.componentDidUpdate = function(prevProps) { + if (this.props.position && (!prevProps.position || this.props.position !== prevProps.position)) { + this.setState({ position: this.props.position }); + } + }; + DraggableZone2.prototype.componentWillUnmount = function() { + this._events.forEach(function(dispose) { + return dispose(); + }); + }; + DraggableZone2.prototype.render = function() { + var child = React__namespace.Children.only(this.props.children); + var props = child.props; + var position2 = this.props.position; + var _a2 = this.state, statePosition = _a2.position, isDragging = _a2.isDragging; + var x2 = statePosition.x; + var y2 = statePosition.y; + if (position2 && !isDragging) { + x2 = position2.x; + y2 = position2.y; + } + return React__namespace.cloneElement(child, { + style: __assign$1(__assign$1({}, props.style), { transform: "translate(".concat(x2, "px, ").concat(y2, "px)") }), + className: getClassNames$a(props.className, this.state.isDragging).root, + onMouseDown: this._onMouseDown, + onMouseUp: this._onMouseUp, + onTouchStart: this._onTouchStart, + onTouchEnd: this._onTouchEnd + }); + }; + DraggableZone2.prototype._getControlPosition = function(event2) { + var touchObj = this._getActiveTouch(event2); + if (this._touchId !== void 0 && !touchObj) { + return void 0; + } + var eventToGetOffset = touchObj || event2; + return { + x: eventToGetOffset.clientX, + y: eventToGetOffset.clientY + }; + }; + DraggableZone2.prototype._getActiveTouch = function(event2) { + return event2.targetTouches && this._findTouchInTouchList(event2.targetTouches) || event2.changedTouches && this._findTouchInTouchList(event2.changedTouches); + }; + DraggableZone2.prototype._getTouchId = function(event2) { + var touch2 = event2.targetTouches && event2.targetTouches[0] || event2.changedTouches && event2.changedTouches[0]; + if (touch2) { + return touch2.identifier; + } + }; + DraggableZone2.prototype._matchesSelector = function(element2, selector) { + var _a2; + if (!element2 || element2 === ((_a2 = getDocumentEx(this.context)) === null || _a2 === void 0 ? void 0 : _a2.body)) { + return false; + } + var matchesSelectorFn = ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + element2.matches || element2.webkitMatchesSelector || element2.msMatchesSelector + ); + if (!matchesSelectorFn) { + return false; + } + return matchesSelectorFn.call(element2, selector) || this._matchesSelector(element2.parentElement, selector); + }; + DraggableZone2.prototype._findTouchInTouchList = function(touchList) { + if (this._touchId === void 0) { + return; + } + for (var i = 0; i < touchList.length; i++) { + if (touchList[i].identifier === this._touchId) { + return touchList[i]; + } + } + return void 0; + }; + DraggableZone2.prototype._createDragDataFromPosition = function(position2) { + var lastPosition = this.state.lastPosition; + if (lastPosition === void 0) { + return { + delta: { x: 0, y: 0 }, + lastPosition: position2, + position: position2 + }; + } + return { + delta: { + x: position2.x - lastPosition.x, + y: position2.y - lastPosition.y + }, + lastPosition, + position: position2 + }; + }; + DraggableZone2.prototype._createUpdatedDragData = function(baseDragData) { + var position2 = this.state.position; + return { + position: { + x: position2.x + baseDragData.delta.x, + y: position2.y + baseDragData.delta.y + }, + delta: baseDragData.delta, + lastPosition: position2 + }; + }; + DraggableZone2.contextType = WindowContext; + return DraggableZone2; + })(React__namespace.Component) + ); + var ZERO = { x: 0, y: 0 }; + var DEFAULT_PROPS$1 = { + isOpen: false, + isDarkOverlay: true, + className: "", + containerClassName: "", + enableAriaHiddenSiblings: true + }; + var getClassNames$9 = classNamesFunction(); + var getMoveDelta = function(ev) { + var delta = 10; + if (ev.shiftKey) { + if (!ev.ctrlKey) { + delta = 50; + } + } else if (ev.ctrlKey) { + delta = 1; + } + return delta; + }; + var useComponentRef$2 = function(props, focusTrapZone) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + focus: function() { + if (focusTrapZone.current) { + focusTrapZone.current.focus(); + } + } + }; + }, [focusTrapZone]); + }; + var ModalBase = React__namespace.forwardRef(function(propsWithoutDefaults, ref2) { + var _a2, _b2, _c2, _d2, _e2; + var props = getPropsWithDefaults(DEFAULT_PROPS$1, propsWithoutDefaults); + var allowTouchBodyScroll = props.allowTouchBodyScroll, className2 = props.className, children2 = props.children, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, focusTrapZoneProps = props.focusTrapZoneProps, forceFocusInsideTrap = props.forceFocusInsideTrap, _f = props.disableRestoreFocus, disableRestoreFocus = _f === void 0 ? props.ignoreExternalFocusing : _f, isBlocking = props.isBlocking, isAlert = props.isAlert, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, onDismiss = props.onDismiss, layerProps = props.layerProps, overlay = props.overlay, isOpen = props.isOpen, titleAriaId = props.titleAriaId, styles = props.styles, subtitleAriaId = props.subtitleAriaId, theme = props.theme, topOffsetFixed = props.topOffsetFixed, responsiveMode = props.responsiveMode, onLayerDidMount = props.onLayerDidMount, isModeless = props.isModeless, dragOptions = props.dragOptions, onDismissed = props.onDismissed, enableAriaHiddenSiblings = props.enableAriaHiddenSiblings, popupProps = props.popupProps; + var rootRef = React__namespace.useRef(null); + var focusTrapZone = React__namespace.useRef(null); + var focusTrapZoneRef = useMergedRefs(focusTrapZone, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.componentRef); + var focusTrapZoneElm = React__namespace.useRef(null); + var mergedRef = useMergedRefs(rootRef, ref2); + var modalResponsiveMode = useResponsiveMode(mergedRef); + var focusTrapZoneId = useId("ModalFocusTrapZone", focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.id); + var win = useWindow(); + var _g = useSetTimeout(), setTimeout2 = _g.setTimeout, clearTimeout2 = _g.clearTimeout; + var _h = React__namespace.useState(isOpen), isModalOpen = _h[0], setIsModalOpen = _h[1]; + var _j = React__namespace.useState(isOpen), isVisible = _j[0], setIsVisible = _j[1]; + var _k = React__namespace.useState(ZERO), coordinates = _k[0], setCoordinates = _k[1]; + var _l = React__namespace.useState(), modalRectangleTop = _l[0], setModalRectangleTop = _l[1]; + var _m = useBoolean(false), isModalMenuOpen = _m[0], _o = _m[1], toggleModalMenuOpen = _o.toggle, setModalMenuClose = _o.setFalse; + var internalState = useConst(function() { + return { + onModalCloseTimer: 0, + allowTouchBodyScroll, + scrollableContent: null, + lastSetCoordinates: ZERO, + events: new EventGroup({}) + }; + }); + var keepInBounds = (dragOptions || {}).keepInBounds; + var isAlertRole = isAlert !== null && isAlert !== void 0 ? isAlert : isBlocking && !isModeless; + var layerClassName = layerProps === void 0 ? "" : layerProps.className; + var classNames2 = getClassNames$9(styles, { + theme, + className: className2, + containerClassName, + scrollableContentClassName, + isOpen, + isVisible, + hasBeenOpened: internalState.hasBeenOpened, + modalRectangleTop, + topOffsetFixed, + isModeless, + layerClassName, + windowInnerHeight: win === null || win === void 0 ? void 0 : win.innerHeight, + isDefaultDragHandle: dragOptions && !dragOptions.dragHandleSelector + }); + var mergedLayerProps = __assign$1(__assign$1({ eventBubblingEnabled: false }, layerProps), { onLayerDidMount: layerProps && layerProps.onLayerDidMount ? layerProps.onLayerDidMount : onLayerDidMount, insertFirst: (layerProps === null || layerProps === void 0 ? void 0 : layerProps.insertFirst) || isModeless, className: classNames2.layer }); + var allowScrollOnModal = React__namespace.useCallback(function(elt) { + if (elt) { + if (internalState.allowTouchBodyScroll) { + allowOverscrollOnElement(elt, internalState.events); + } else { + allowScrollOnElement(elt, internalState.events); + } + } else { + internalState.events.off(internalState.scrollableContent); + } + internalState.scrollableContent = elt; + }, [internalState]); + var registerInitialModalPosition = function() { + var dialogMain = focusTrapZoneElm.current; + var modalRectangle = dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect(); + if (modalRectangle) { + if (topOffsetFixed) { + setModalRectangleTop(modalRectangle.top); + } + if (keepInBounds) { + internalState.minPosition = { x: -modalRectangle.left, y: -modalRectangle.top }; + internalState.maxPosition = { x: modalRectangle.left, y: modalRectangle.top }; + } + } }; - var styles = { - root: { - color: caret.buttonTextColor, - fontSize: fonts.small.fontSize, - position: 'absolute', - top: 0, - height: '100%', - lineHeight: ComboBoxLineHeight, - width: ComboBoxCaretDownWidth, - textAlign: 'center', - cursor: 'default', - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'ButtonFace', - borderColor: 'ButtonText', - color: 'ButtonText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _b) - }, - icon: { - fontSize: fonts.small.fontSize - }, - rootHovered: [ - { - backgroundColor: caret.buttonBackgroundHoveredColor, - color: caret.buttonTextHoveredCheckedColor, - cursor: 'pointer' - }, - buttonHighContrastStyles - ], - rootPressed: [ - { - backgroundColor: caret.buttonBackgroundCheckedColor, - color: caret.buttonTextHoveredCheckedColor - }, - buttonHighContrastStyles - ], - rootChecked: [ - { - backgroundColor: caret.buttonBackgroundCheckedColor, - color: caret.buttonTextHoveredCheckedColor - }, - buttonHighContrastStyles - ], - rootCheckedHovered: [ - { - backgroundColor: caret.buttonBackgroundCheckedHoveredColor, - color: caret.buttonTextHoveredCheckedColor - }, - buttonHighContrastStyles - ], - rootDisabled: [ - getDisabledStyles(theme), - { - position: 'absolute' + var getClampedAxis = React__namespace.useCallback(function(axis, position2) { + var minPosition = internalState.minPosition, maxPosition = internalState.maxPosition; + if (keepInBounds && minPosition && maxPosition) { + position2 = Math.max(minPosition[axis], position2); + position2 = Math.min(maxPosition[axis], position2); + } + return position2; + }, [keepInBounds, internalState]); + var handleModalClose = function() { + var _a22; + internalState.lastSetCoordinates = ZERO; + setModalMenuClose(); + internalState.isInKeyboardMoveMode = false; + setIsModalOpen(false); + setCoordinates(ZERO); + (_a22 = internalState.disposeOnKeyUp) === null || _a22 === void 0 ? void 0 : _a22.call(internalState); + onDismissed === null || onDismissed === void 0 ? void 0 : onDismissed(); + }; + var handleDragStart = React__namespace.useCallback(function() { + setModalMenuClose(); + internalState.isInKeyboardMoveMode = false; + }, [internalState, setModalMenuClose]); + var handleDrag = React__namespace.useCallback(function(ev, dragData) { + setCoordinates(function(prevValue) { + return { + x: getClampedAxis("x", prevValue.x + dragData.delta.x), + y: getClampedAxis("y", prevValue.y + dragData.delta.y) + }; + }); + }, [getClampedAxis]); + var handleDragStop = React__namespace.useCallback(function() { + if (focusTrapZone.current) { + focusTrapZone.current.focus(); + } + }, []); + var handleEnterKeyboardMoveMode = function() { + var handleKeyDown = function(ev) { + if (ev.altKey && ev.ctrlKey && ev.keyCode === KeyCodes.space) { + ev.preventDefault(); + ev.stopPropagation(); + return; + } + var newLocal = ev.altKey || ev.keyCode === KeyCodes.escape; + if (isModalMenuOpen && newLocal) { + setModalMenuClose(); + } + if (internalState.isInKeyboardMoveMode && (ev.keyCode === KeyCodes.escape || ev.keyCode === KeyCodes.enter)) { + internalState.isInKeyboardMoveMode = false; + ev.preventDefault(); + ev.stopPropagation(); + } + if (internalState.isInKeyboardMoveMode) { + var handledEvent = true; + var delta_1 = getMoveDelta(ev); + switch (ev.keyCode) { + /* eslint-disable no-fallthrough */ + case KeyCodes.escape: + setCoordinates(internalState.lastSetCoordinates); + case KeyCodes.enter: { + internalState.lastSetCoordinates = ZERO; + break; + } + case KeyCodes.up: { + setCoordinates(function(prevValue) { + return { x: prevValue.x, y: getClampedAxis("y", prevValue.y - delta_1) }; + }); + break; + } + case KeyCodes.down: { + setCoordinates(function(prevValue) { + return { x: prevValue.x, y: getClampedAxis("y", prevValue.y + delta_1) }; + }); + break; + } + case KeyCodes.left: { + setCoordinates(function(prevValue) { + return { x: getClampedAxis("x", prevValue.x - delta_1), y: prevValue.y }; + }); + break; + } + case KeyCodes.right: { + setCoordinates(function(prevValue) { + return { x: getClampedAxis("x", prevValue.x + delta_1), y: prevValue.y }; + }); + break; } - ] - }; - return (0, _styling.concatStyleSets)(styles, customStyles); -}); -var getStyles = (0, _utilities.memoizeFunction)(function(theme, customStyles, comboBoxOptionWidth) { - var _a, _b, _c, _d, _e, _f; - var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; - var root = { - textColor: semanticColors.inputText, - borderColor: semanticColors.inputBorder, - borderHoveredColor: semanticColors.inputBorderHovered, - borderPressedColor: semanticColors.inputFocusBorderAlt, - borderFocusedColor: semanticColors.inputFocusBorderAlt, - backgroundColor: semanticColors.inputBackground, - erroredColor: semanticColors.errorText + default: { + handledEvent = false; + } + } + if (handledEvent) { + ev.preventDefault(); + ev.stopPropagation(); + } + } + }; + internalState.lastSetCoordinates = coordinates; + setModalMenuClose(); + internalState.isInKeyboardMoveMode = true; + internalState.events.on( + win, + "keydown", + handleKeyDown, + true + /* useCapture */ + ); + internalState.disposeOnKeyDown = function() { + internalState.events.off( + win, + "keydown", + handleKeyDown, + true + /* useCapture */ + ); + internalState.disposeOnKeyDown = void 0; + }; }; - var option = { - headerTextColor: semanticColors.menuHeader, - dividerBorderColor: semanticColors.bodyDivider + var handleExitKeyboardMoveMode = function(ev) { + var _a22, _b22; + (_a22 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.onBlur) === null || _a22 === void 0 ? void 0 : _a22.call(focusTrapZoneProps, ev); + internalState.lastSetCoordinates = ZERO; + internalState.isInKeyboardMoveMode = false; + (_b22 = internalState.disposeOnKeyDown) === null || _b22 === void 0 ? void 0 : _b22.call(internalState); }; - // placeholder style variables - var placeholderHighContrastStyles = { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _a) + var registerForKeyUp = function() { + var handleKeyUp = function(ev) { + if (ev.altKey && ev.ctrlKey && ev.keyCode === KeyCodes.space) { + if (elementContains(internalState.scrollableContent, ev.target)) { + toggleModalMenuOpen(); + ev.preventDefault(); + ev.stopPropagation(); + } + } + }; + if (!internalState.disposeOnKeyUp) { + internalState.events.on( + win, + "keyup", + handleKeyUp, + true + /* useCapture */ + ); + internalState.disposeOnKeyUp = function() { + internalState.events.off( + win, + "keyup", + handleKeyUp, + true + /* useCapture */ + ); + internalState.disposeOnKeyUp = void 0; + }; + } }; - var placeholderStyles = [ + React__namespace.useEffect(function() { + clearTimeout2(internalState.onModalCloseTimer); + if (isOpen) { + requestAnimationFrame(function() { + return setTimeout2(registerInitialModalPosition, 0); + }); + setIsModalOpen(true); + if (dragOptions) { + registerForKeyUp(); + } + internalState.hasBeenOpened = true; + setIsVisible(true); + } + if (!isOpen && isModalOpen) { + internalState.onModalCloseTimer = setTimeout2(handleModalClose, parseFloat(animationDuration) * 1e3); + setIsVisible(false); + } + }, [isModalOpen, isOpen]); + useUnmount(function() { + internalState.events.dispose(); + if (internalState.onModalCloseTimer) { + clearTimeout2(internalState.onModalCloseTimer); + internalState.onModalCloseTimer = 0; + } + }); + useComponentRef$2(props, focusTrapZone); + var modalContent = React__namespace.createElement( + FocusTrapZone, + __assign$1({}, focusTrapZoneProps, { + id: focusTrapZoneId, + ref: focusTrapZoneElm, + componentRef: focusTrapZoneRef, + className: css(classNames2.main, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.className), + elementToFocusOnDismiss: (_a2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.elementToFocusOnDismiss) !== null && _a2 !== void 0 ? _a2 : elementToFocusOnDismiss, + isClickableOutsideFocusTrap: (_b2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.isClickableOutsideFocusTrap) !== null && _b2 !== void 0 ? _b2 : isModeless || isClickableOutsideFocusTrap || !isBlocking, + disableRestoreFocus: (_c2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.disableRestoreFocus) !== null && _c2 !== void 0 ? _c2 : disableRestoreFocus, + forceFocusInsideTrap: ((_d2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.forceFocusInsideTrap) !== null && _d2 !== void 0 ? _d2 : forceFocusInsideTrap) && !isModeless, + // eslint-disable-next-line @typescript-eslint/no-deprecated + firstFocusableSelector: (focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.firstFocusableSelector) || firstFocusableSelector, + focusPreviouslyFocusedInnerElement: (_e2 = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.focusPreviouslyFocusedInnerElement) !== null && _e2 !== void 0 ? _e2 : true, + onBlur: internalState.isInKeyboardMoveMode ? handleExitKeyboardMoveMode : void 0 + }), + dragOptions && internalState.isInKeyboardMoveMode && React__namespace.createElement("div", { className: classNames2.keyboardMoveIconContainer }, dragOptions.keyboardMoveIconProps ? React__namespace.createElement(Icon, __assign$1({}, dragOptions.keyboardMoveIconProps)) : React__namespace.createElement(Icon, { iconName: "move", className: classNames2.keyboardMoveIcon })), + React__namespace.createElement( + "div", + { ref: allowScrollOnModal, className: classNames2.scrollableContent, "data-is-scrollable": true }, + dragOptions && isModalMenuOpen && React__namespace.createElement(dragOptions.menu, { items: [ + { key: "move", text: dragOptions.moveMenuItemText, onClick: handleEnterKeyboardMoveMode }, + { key: "close", text: dragOptions.closeMenuItemText, onClick: handleModalClose } + ], onDismiss: setModalMenuClose, alignTargetEdge: true, coverTarget: true, directionalHint: DirectionalHint.topLeftEdge, directionalHintFixed: true, shouldFocusOnMount: true, target: internalState.scrollableContent }), + children2 + ) + ); + return isModalOpen && modalResponsiveMode >= (responsiveMode || ResponsiveMode.small) && React__namespace.createElement( + Layer, + __assign$1({ ref: mergedRef }, mergedLayerProps), + React__namespace.createElement( + Popup, + __assign$1({ + role: isAlertRole ? "alertdialog" : "dialog", + ariaLabelledBy: titleAriaId, + ariaDescribedBy: subtitleAriaId, + onDismiss, + // eslint-disable-next-line @typescript-eslint/no-deprecated + shouldRestoreFocus: !disableRestoreFocus, + // Modeless modals shouldn't hide siblings. + // Popup will automatically handle this based on the aria-modal setting. + // eslint-disable-next-line @typescript-eslint/no-deprecated + enableAriaHiddenSiblings, + "aria-modal": !isModeless + }, popupProps), + React__namespace.createElement( + "div", + { className: classNames2.root, role: !isModeless ? "document" : void 0 }, + !isModeless && React__namespace.createElement(Overlay, __assign$1({ "aria-hidden": true, isDarkThemed: isDarkOverlay, onClick: isBlocking ? void 0 : onDismiss, allowTouchBodyScroll }, overlay)), + dragOptions ? React__namespace.createElement(DraggableZone, { handleSelector: dragOptions.dragHandleSelector || "#".concat(focusTrapZoneId), preventDragSelector: "button", onStart: handleDragStart, onDragChange: handleDrag, onStop: handleDragStop, position: coordinates }, modalContent) : modalContent + ) + ) + ) || null; + }); + ModalBase.displayName = "Modal"; + var Modal = styled(ModalBase, getStyles$a, void 0, { + scope: "Modal", + fields: ["theme", "styles", "enableAriaHiddenSiblings"] + }); + Modal.displayName = "Modal"; + var getClassNames$8 = classNamesFunction(); + var DialogFooterBase = ( + /** @class */ + (function(_super) { + __extends(DialogFooterBase2, _super); + function DialogFooterBase2(props) { + var _this = _super.call(this, props) || this; + initializeComponentRef(_this); + return _this; + } + DialogFooterBase2.prototype.render = function() { + var _a2 = this.props, className2 = _a2.className, styles = _a2.styles, theme = _a2.theme; + this._classNames = getClassNames$8(styles, { + theme, + className: className2 + }); + return React__namespace.createElement( + "div", + { className: this._classNames.actions }, + React__namespace.createElement("div", { className: this._classNames.actionsRight }, this._renderChildrenAsActions()) + ); + }; + DialogFooterBase2.prototype._renderChildrenAsActions = function() { + var _this = this; + return React__namespace.Children.map(this.props.children, function(child) { + return child ? React__namespace.createElement("span", { className: _this._classNames.action }, child) : null; + }); + }; + return DialogFooterBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$6 = { + actions: "ms-Dialog-actions", + action: "ms-Dialog-action", + actionsRight: "ms-Dialog-actionsRight" + }; + var getStyles$8 = function(props) { + var className2 = props.className, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$6, theme); + return { + actions: [ + classNames2.actions, { - color: semanticColors.inputPlaceholderText - }, - placeholderHighContrastStyles - ]; - var placeholderStylesHovered = [ + position: "relative", + width: "100%", + minHeight: "24px", + lineHeight: "24px", + margin: "16px 0 0", + fontSize: "0", + selectors: { + ".ms-Button": { + lineHeight: "normal", + verticalAlign: "middle" + } + } + }, + className2 + ], + action: [ + classNames2.action, { - color: semanticColors.inputTextHovered - }, - placeholderHighContrastStyles - ]; - var disabledPlaceholderStyles = [ + margin: "0 4px" + } + ], + actionsRight: [ + classNames2.actionsRight, { - color: semanticColors.disabledText - }, - placeholderHighContrastStyles - ]; - var ComboBoxRootHighContrastFocused = (0, _tslib.__assign)((0, _tslib.__assign)({ - color: 'HighlightText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - selectors: { - ':after': { - borderColor: 'Highlight' - } + alignItems: "center", + display: "flex", + fontSize: "0", + justifyContent: "flex-end", + marginRight: "-4px" } - }); - var focusBorderStyles = (0, _styling.getInputFocusStyle)(root.borderPressedColor, effects.roundedCorner2, 'border', 0); - var styles = { - container: {}, - label: {}, - labelDisabled: {}, - root: [ - theme.fonts.medium, - { - boxShadow: 'none', - marginLeft: '0', - paddingRight: ComboBoxCaretDownWidth, - paddingLeft: 9, - color: root.textColor, - position: 'relative', - outline: '0', - userSelect: 'none', - backgroundColor: root.backgroundColor, - cursor: 'text', - display: 'block', - height: ComboBoxHeight, - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - boxSizing: 'border-box', - selectors: { - '.ms-Label': { - display: 'inline-block', - marginBottom: '8px' - }, - '&.is-open': { - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _b) - }, - // setting border using pseudo-element here in order to - // prevent chevron button to overlap ComboBox border under certain resolutions - ':after': { - pointerEvents: 'none', - content: "''", - position: 'absolute', - left: 0, - top: 0, - bottom: 0, - right: 0, - borderWidth: '1px', - borderStyle: 'solid', - borderColor: root.borderColor, - borderRadius: effects.roundedCorner2 - } - } - } - ], - rootHovered: { - selectors: (_c = { - ':after': { - borderColor: root.borderHoveredColor - }, - '.ms-ComboBox-Input': [ - { - color: semanticColors.inputTextHovered - }, - (0, _styling.getPlaceholderStyles)(placeholderStylesHovered), - inputHighContrastStyles - ] - }, _c[0, _styling.HighContrastSelector] = (0, _tslib.__assign)((0, _tslib.__assign)({ - color: 'HighlightText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), { - selectors: { - ':after': { - borderColor: 'Highlight' - } - } - }), _c) - }, - rootPressed: [ - { - position: 'relative', - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _d) - } - ], - rootFocused: [ - { - selectors: (_e = { - '.ms-ComboBox-Input': [ - { - color: semanticColors.inputTextHovered - }, - inputHighContrastStyles - ] - }, _e[0, _styling.HighContrastSelector] = ComboBoxRootHighContrastFocused, _e) - }, - focusBorderStyles - ], - rootDisabled: getDisabledStyles(theme), - rootError: { - selectors: { - ':after': { - borderColor: root.erroredColor - }, - ':hover:after': { - borderColor: semanticColors.inputBorderHovered - } - } - }, - rootDisallowFreeForm: {}, - input: [ - (0, _styling.getPlaceholderStyles)(placeholderStyles), - { - backgroundColor: root.backgroundColor, - color: root.textColor, - boxSizing: 'border-box', - width: '100%', - height: '100%', - borderStyle: 'none', - outline: 'none', - font: 'inherit', - textOverflow: 'ellipsis', - padding: '0', - selectors: { - '::-ms-clear': { - display: 'none' - } - } - }, - inputHighContrastStyles - ], - inputDisabled: [ - getDisabledStyles(theme), - (0, _styling.getPlaceholderStyles)(disabledPlaceholderStyles) - ], - errorMessage: [ - theme.fonts.small, - { - color: root.erroredColor, - marginTop: '5px' - } - ], - callout: { - boxShadow: effects.elevation8 - }, - optionsContainerWrapper: { - width: comboBoxOptionWidth - }, - optionsContainer: { - display: 'block' - }, - screenReaderText: (0, _styling.hiddenContentStyle), - header: [ - fonts.medium, - { - fontWeight: (0, _styling.FontWeights).semibold, - color: option.headerTextColor, - backgroundColor: 'none', - borderStyle: 'none', - height: ComboBoxOptionHeight, - lineHeight: ComboBoxOptionHeight, - cursor: 'default', - padding: '0 8px', - userSelect: 'none', - textAlign: 'left', - selectors: (_f = {}, _f[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _f) - } - ], - divider: { - height: 1, - backgroundColor: option.dividerBorderColor - } - }; - return (0, _styling.concatStyleSets)(styles, customStyles); -}); - -},{"tslib":"9gizs","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lioZM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getClassNames", ()=>getClassNames); -parcelHelpers.export(exports, "getComboBoxOptionClassNames", ()=>getComboBoxOptionClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getClassNames = (0, _utilities.memoizeFunction)(function(styles, className, isOpen, disabled, required, focused, allowFreeForm, hasErrorMessage) { - // const mergeStyles = mergeStylesShadow(styles.__shadowConfig__); - return { - container: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-container', className, styles.container), - label: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.label, disabled && styles.labelDisabled), - root: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox', hasErrorMessage ? styles.rootError : isOpen && 'is-open', required && 'is-required', styles.root, !allowFreeForm && styles.rootDisallowFreeForm, hasErrorMessage && !focused ? styles.rootError : !disabled && focused && styles.rootFocused, !disabled && { - selectors: { - ':hover': hasErrorMessage ? styles.rootError : !isOpen && !focused && styles.rootHovered, - ':active': hasErrorMessage ? styles.rootError : styles.rootPressed, - ':focus': hasErrorMessage ? styles.rootError : styles.rootFocused - } - }, disabled && [ - 'is-disabled', - styles.rootDisabled - ]), - input: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-Input', styles.input, disabled && styles.inputDisabled), - errorMessage: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.errorMessage), - callout: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-callout', styles.callout), - optionsContainerWrapper: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-optionsContainerWrapper', styles.optionsContainerWrapper), - optionsContainer: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-optionsContainer', styles.optionsContainer), - header: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-header', styles.header), - divider: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-divider', styles.divider), - screenReaderText: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.screenReaderText) - }; -}); -var getComboBoxOptionClassNames = (0, _utilities.memoizeFunction)(function(styles) { - return { - optionText: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-optionText', styles.optionText), - root: (0, _styling.mergeStyles)(styles.__shadowConfig__, 'ms-ComboBox-option', styles.root, { - selectors: { - ':hover': styles.rootHovered, - ':focus': styles.rootFocused, - ':active': styles.rootPressed - } - }), - optionTextWrapper: (0, _styling.mergeStyles)(styles.__shadowConfig__, styles.optionTextWrapper) - }; -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jqbZ7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./utilities/selectableOption/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./utilities/selectableOption/index":"koCae","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"koCae":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _selectableOption = require("./SelectableOption"); -parcelHelpers.exportAll(_selectableOption, exports); -var _selectableOptionTypes = require("./SelectableOption.types"); -parcelHelpers.exportAll(_selectableOptionTypes, exports); -var _selectableDroppableTextTypes = require("./SelectableDroppableText.types"); -parcelHelpers.exportAll(_selectableDroppableTextTypes, exports); - -},{"./SelectableOption":"1X6d3","./SelectableOption.types":"2jOel","./SelectableDroppableText.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1X6d3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getAllSelectedOptions", ()=>getAllSelectedOptions); -function getAllSelectedOptions(options, selectedIndices) { - var selectedOptions = []; - for(var _i = 0, selectedIndices_1 = selectedIndices; _i < selectedIndices_1.length; _i++){ - var index = selectedIndices_1[_i]; - var option = options[index]; - if (option) selectedOptions.push(option); - } - return selectedOptions; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2jOel":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SelectableOptionMenuItemType", ()=>SelectableOptionMenuItemType); -var SelectableOptionMenuItemType; -(function(SelectableOptionMenuItemType) { - SelectableOptionMenuItemType[SelectableOptionMenuItemType["Normal"] = 0] = "Normal"; - SelectableOptionMenuItemType[SelectableOptionMenuItemType["Divider"] = 1] = "Divider"; - SelectableOptionMenuItemType[SelectableOptionMenuItemType["Header"] = 2] = "Header"; - SelectableOptionMenuItemType[SelectableOptionMenuItemType["SelectAll"] = 3] = "SelectAll"; -})(SelectableOptionMenuItemType || (SelectableOptionMenuItemType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ad8u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/CommandBar/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/CommandBar/index":"8qt81","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8qt81":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getCommandBarStyles", ()=>(0, _commandBarStyles.getStyles)); -parcelHelpers.export(exports, "getCommandButtonStyles", ()=>(0, _commandBarStyles.getCommandButtonStyles)); -var _commandBarStyles = require("./CommandBar.styles"); -var _commandBar = require("./CommandBar"); -parcelHelpers.exportAll(_commandBar, exports); -var _commandBarBase = require("./CommandBar.base"); -parcelHelpers.exportAll(_commandBarBase, exports); -var _commandBarTypes = require("./CommandBar.types"); -parcelHelpers.exportAll(_commandBarTypes, exports); - -},{"./CommandBar.styles":false,"./CommandBar":"6N02t","./CommandBar.base":false,"./CommandBar.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hGu9m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -parcelHelpers.export(exports, "getCommandButtonStyles", ()=>getCommandButtonStyles); -var _tslib = require("tslib"); -var _utilities = require("../../Utilities"); -var COMMAND_BAR_HEIGHT = 44; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var semanticColors = theme.semanticColors; + ] + }; + }; + var DialogFooter = styled(DialogFooterBase, getStyles$8, void 0, { scope: "DialogFooter" }); + DialogFooter.displayName = "DialogFooter"; + var getClassNames$7 = classNamesFunction(); + var DialogFooterType = React__namespace.createElement(DialogFooter, null).type; + var DialogContentBase = ( + /** @class */ + (function(_super) { + __extends(DialogContentBase2, _super); + function DialogContentBase2(props) { + var _this = _super.call(this, props) || this; + initializeComponentRef(_this); + return _this; + } + DialogContentBase2.prototype.render = function() { + var _a2 = this.props, showCloseButton = _a2.showCloseButton, className2 = _a2.className, closeButtonAriaLabel = _a2.closeButtonAriaLabel, onDismiss = _a2.onDismiss, subTextId = _a2.subTextId, subText = _a2.subText, _b2 = _a2.titleProps, titleProps = _b2 === void 0 ? {} : _b2, titleId = _a2.titleId, title = _a2.title, type2 = _a2.type, styles = _a2.styles, theme = _a2.theme, draggableHeaderClassName = _a2.draggableHeaderClassName; + var classNames2 = getClassNames$7(styles, { + theme, + className: className2, + isLargeHeader: type2 === DialogType.largeHeader, + isClose: type2 === DialogType.close, + draggableHeaderClassName + }); + var groupings = this._groupChildren(); + var subTextContent; + if (subText) { + subTextContent = React__namespace.createElement("p", { className: classNames2.subText, id: subTextId }, subText); + } + return React__namespace.createElement( + "div", + { className: classNames2.content }, + React__namespace.createElement( + "div", + { className: classNames2.header }, + React__namespace.createElement("div", __assign$1({ id: titleId, role: "heading", "aria-level": 1 }, titleProps, { className: css(classNames2.title, titleProps.className) }), title), + React__namespace.createElement( + "div", + { className: classNames2.topButton }, + this.props.topButtonsProps.map(function(props, index2) { + return React__namespace.createElement(IconButton, __assign$1({ key: props.uniqueId || index2 }, props)); + }), + (type2 === DialogType.close || showCloseButton && type2 !== DialogType.largeHeader) && React__namespace.createElement(IconButton, { className: classNames2.button, iconProps: { iconName: "Cancel" }, ariaLabel: closeButtonAriaLabel, onClick: onDismiss }) + ) + ), + React__namespace.createElement( + "div", + { className: classNames2.inner }, + React__namespace.createElement( + "div", + { className: classNames2.innerContent }, + subTextContent, + groupings.contents + ), + groupings.footers + ) + ); + }; + DialogContentBase2.prototype._groupChildren = function() { + var groupings = { + footers: [], + contents: [] + }; + React__namespace.Children.map(this.props.children, function(child) { + if (typeof child === "object" && child !== null && child.type === DialogFooterType) { + groupings.footers.push(child); + } else { + groupings.contents.push(child); + } + }); + return groupings; + }; + DialogContentBase2.defaultProps = { + showCloseButton: false, + className: "", + topButtonsProps: [], + closeButtonAriaLabel: "Close" + }; + DialogContentBase2 = __decorate([ + withResponsiveMode + ], DialogContentBase2); + return DialogContentBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$5 = { + contentLgHeader: "ms-Dialog-lgHeader", + close: "ms-Dialog--close", + subText: "ms-Dialog-subText", + header: "ms-Dialog-header", + headerLg: "ms-Dialog--lgHeader", + button: "ms-Dialog-button ms-Dialog-button--close", + inner: "ms-Dialog-inner", + content: "ms-Dialog-content", + title: "ms-Dialog-title" + }; + var getStyles$7 = function(props) { + var _a2, _b2, _c2; + var className2 = props.className, theme = props.theme, isLargeHeader = props.isLargeHeader, isClose = props.isClose, hidden = props.hidden, isMultiline = props.isMultiline, draggableHeaderClassName = props.draggableHeaderClassName; + var palette = theme.palette, fonts = theme.fonts, effects = theme.effects, semanticColors = theme.semanticColors; + var classNames2 = getGlobalClassNames(GlobalClassNames$5, theme); return { - root: [ - theme.fonts.medium, - 'ms-CommandBar', - { - display: 'flex', - backgroundColor: semanticColors.bodyBackground, - padding: '0 14px 0 24px', - height: COMMAND_BAR_HEIGHT - }, - className - ], - primarySet: [ - 'ms-CommandBar-primaryCommand', - { - flexGrow: '1', - display: 'flex', - alignItems: 'stretch' - } + content: [ + isLargeHeader && [ + classNames2.contentLgHeader, + { + borderTop: "4px solid ".concat(palette.themePrimary) + } ], - secondarySet: [ - 'ms-CommandBar-secondaryCommand', - { - flexShrink: '0', - display: 'flex', - alignItems: 'stretch' - } + isClose && classNames2.close, + { + flexGrow: 1, + overflowY: "hidden" + // required for allowScrollOnElement + }, + className2 + ], + subText: [ + classNames2.subText, + fonts.medium, + { + margin: "0 0 24px 0", + color: semanticColors.bodySubtext, + lineHeight: "1.5", + wordWrap: "break-word", + fontWeight: FontWeights.regular + } + ], + header: [ + classNames2.header, + { + position: "relative", + width: "100%", + boxSizing: "border-box" + }, + isClose && classNames2.close, + draggableHeaderClassName && [ + draggableHeaderClassName, + { + cursor: "move" + } ] + ], + button: [ + classNames2.button, + hidden && { + selectors: { + ".ms-Icon.ms-Icon--Cancel": { + color: semanticColors.buttonText, + fontSize: IconFontSizes.medium + } + } + } + ], + inner: [ + classNames2.inner, + { + padding: "0 24px 24px", + selectors: (_a2 = {}, _a2["@media (min-width: ".concat(ScreenWidthMinSmall, "px) and (max-width: ").concat(ScreenWidthMaxSmall, "px)")] = { + padding: "0 16px 16px" + }, _a2) + } + ], + innerContent: [ + classNames2.content, + { + position: "relative", + width: "100%" + } + ], + title: [ + classNames2.title, + fonts.xLarge, + { + color: semanticColors.bodyText, + margin: "0", + minHeight: fonts.xLarge.fontSize, + padding: "16px 46px 20px 24px", + lineHeight: "normal", + selectors: (_b2 = {}, _b2["@media (min-width: ".concat(ScreenWidthMinSmall, "px) and (max-width: ").concat(ScreenWidthMaxSmall, "px)")] = { + padding: "16px 46px 16px 16px" + }, _b2) + }, + isLargeHeader && { + color: semanticColors.menuHeader + }, + isMultiline && { fontSize: fonts.xxLarge.fontSize } + ], + topButton: [ + { + display: "flex", + flexDirection: "row", + flexWrap: "nowrap", + position: "absolute", + top: "0", + right: "0", + padding: "15px 15px 0 0", + selectors: (_c2 = { + "> *": { + flex: "0 0 auto" + }, + ".ms-Dialog-button": { + color: semanticColors.buttonText + }, + ".ms-Dialog-button:hover": { + color: semanticColors.buttonTextHovered, + borderRadius: effects.roundedCorner2 + } + }, _c2["@media (min-width: ".concat(ScreenWidthMinSmall, "px) and (max-width: ").concat(ScreenWidthMaxSmall, "px)")] = { + padding: "15px 8px 0 0" + }, _c2) + } + ] }; -}; -var getCommandButtonStyles = (0, _utilities.memoizeFunction)(function(customStyles) { - var rootStyles = { - height: '100%' - }; - var labelStyles = { - whiteSpace: 'nowrap' - }; - var _a = customStyles || {}, root = _a.root, label = _a.label, restCustomStyles = (0, _tslib.__rest)(_a, [ - "root", - "label" - ]); - return (0, _tslib.__assign)((0, _tslib.__assign)({}, restCustomStyles), { - root: root ? [ - rootStyles, - root - ] : rootStyles, - label: label ? [ - labelStyles, - label - ] : labelStyles - }); -}); - -},{"tslib":"9gizs","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6N02t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBar", ()=>CommandBar); -var _utilities = require("../../Utilities"); -var _commandBarBase = require("./CommandBar.base"); -var _commandBarStyles = require("./CommandBar.styles"); -var CommandBar = (0, _utilities.styled)((0, _commandBarBase.CommandBarBase), (0, _commandBarStyles.getStyles), undefined, { - scope: 'CommandBar' -}); - -},{"../../Utilities":"1NZCy","./CommandBar.base":"kVqqU","./CommandBar.styles":"hGu9m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kVqqU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CommandBarBase", ()=>CommandBarBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _overflowSet = require("../../OverflowSet"); -var _resizeGroup = require("../../ResizeGroup"); -var _focusZone = require("../../FocusZone"); -var _button = require("../../Button"); -var _tooltip = require("../../Tooltip"); -var _commandBarStyles = require("./CommandBar.styles"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var CommandBarBase = /** @class */ function(_super) { - (0, _tslib.__extends)(CommandBarBase, _super); - function CommandBarBase(props) { + }; + var DialogContent = styled(DialogContentBase, getStyles$7, void 0, { scope: "DialogContent" }); + DialogContent.displayName = "DialogContent"; + var getClassNames$6 = classNamesFunction(); + var DefaultModalProps = { + isDarkOverlay: false, + isBlocking: false, + className: "", + containerClassName: "", + topOffsetFixed: false, + enableAriaHiddenSiblings: true + }; + var DefaultDialogContentProps = { + type: DialogType.normal, + className: "", + topButtonsProps: [] + }; + var DialogBase = ( + /** @class */ + (function(_super) { + __extends(DialogBase2, _super); + function DialogBase2(props) { var _this = _super.call(this, props) || this; - _this._overflowSet = _react.createRef(); - _this._resizeGroup = _react.createRef(); - _this._onRenderData = function(data) { - var _a = _this.props, ariaLabel = _a.ariaLabel, primaryGroupAriaLabel = _a.primaryGroupAriaLabel, farItemsGroupAriaLabel = _a.farItemsGroupAriaLabel; - var hasSecondSet = data.farItems && data.farItems.length > 0; - return _react.createElement((0, _focusZone.FocusZone), { - className: (0, _utilities.css)(_this._classNames.root), - direction: (0, _focusZone.FocusZoneDirection).horizontal, - role: 'menubar', - "aria-label": ariaLabel - }, _react.createElement((0, _overflowSet.OverflowSet), { - role: hasSecondSet ? 'group' : 'none', - "aria-label": hasSecondSet ? primaryGroupAriaLabel : undefined, - componentRef: _this._overflowSet, - className: (0, _utilities.css)(_this._classNames.primarySet), - items: data.primaryItems, - overflowItems: data.overflowItems.length ? data.overflowItems : undefined, - onRenderItem: _this._onRenderItem, - onRenderOverflowButton: _this._onRenderOverflowButton - }), hasSecondSet && _react.createElement((0, _overflowSet.OverflowSet), { - role: "group", - "aria-label": farItemsGroupAriaLabel, - className: (0, _utilities.css)(_this._classNames.secondarySet), - items: data.farItems, - onRenderItem: _this._onRenderItem, - onRenderOverflowButton: (0, _utilities.nullRender) - })); - }; - _this._onRenderItem = function(item) { - if (item.onRender) // These are the top level items, there is no relevant menu dismissing function to - // provide for the IContextualMenuItem onRender function. Pass in a no op function instead. - return item.onRender(item, function() { - return undefined; - }); - // eslint-disable-next-line deprecation/deprecation - var itemText = item.text || item.name; - var commandButtonProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - allowDisabledFocus: true, - role: 'menuitem' - }, item), { - styles: (0, _commandBarStyles.getCommandButtonStyles)(item.buttonStyles), - className: (0, _utilities.css)('ms-CommandBarItem-link', item.className), - text: !item.iconOnly ? itemText : undefined, - menuProps: item.subMenuProps, - onClick: _this._onButtonClick(item) - }); - if (item.iconOnly && (itemText !== undefined || item.tooltipHostProps)) return _react.createElement((0, _tooltip.TooltipHost), (0, _tslib.__assign)({ - role: "none", - content: itemText, - setAriaDescribedBy: false - }, item.tooltipHostProps), _this._commandButton(item, commandButtonProps)); - return _this._commandButton(item, commandButtonProps); - }; - _this._commandButton = function(item, props) { - var ButtonAs = _this.props.buttonAs; - var CommandBarButtonAs = item.commandBarButtonAs; - var DefaultButtonAs = (0, _button.CommandBarButton); - // The prop types between these three possible implementations overlap enough that a force-cast is safe. - var Type = DefaultButtonAs; - if (CommandBarButtonAs) Type = (0, _utilities.composeComponentAs)(CommandBarButtonAs, Type); - if (ButtonAs) Type = (0, _utilities.composeComponentAs)(ButtonAs, Type); - // Always pass the default implementation to the override so it may be composed. - return _react.createElement(Type, (0, _tslib.__assign)({}, props)); + _this._getSubTextId = function() { + var _a2 = _this.props, ariaDescribedById = _a2.ariaDescribedById, modalProps = _a2.modalProps, dialogContentProps = _a2.dialogContentProps, subText = _a2.subText; + var id2 = modalProps && modalProps.subtitleAriaId || ariaDescribedById; + if (!id2) { + id2 = (dialogContentProps && dialogContentProps.subText || subText) && _this._defaultSubTextId; + } + return id2; }; - _this._onRenderOverflowButton = function(overflowItems) { - var _a = _this.props.overflowButtonProps, overflowButtonProps = _a === void 0 ? {} : _a; - var combinedOverflowItems = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], overflowButtonProps.menuProps ? overflowButtonProps.menuProps.items : [], true), overflowItems, true); - var overflowProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - role: 'menuitem' - }, overflowButtonProps), { - styles: (0, _tslib.__assign)({ - menuIcon: { - fontSize: '17px' - } - }, overflowButtonProps.styles), - className: (0, _utilities.css)('ms-CommandBar-overflowButton', overflowButtonProps.className), - menuProps: (0, _tslib.__assign)((0, _tslib.__assign)({}, overflowButtonProps.menuProps), { - items: combinedOverflowItems - }), - menuIconProps: (0, _tslib.__assign)({ - iconName: 'More' - }, overflowButtonProps.menuIconProps) - }); - var OverflowButtonType = _this.props.overflowButtonAs ? (0, _utilities.composeComponentAs)(_this.props.overflowButtonAs, (0, _button.CommandBarButton)) : (0, _button.CommandBarButton); - return _react.createElement(OverflowButtonType, (0, _tslib.__assign)({}, overflowProps)); + _this._getTitleTextId = function() { + var _a2 = _this.props, ariaLabelledById = _a2.ariaLabelledById, modalProps = _a2.modalProps, dialogContentProps = _a2.dialogContentProps, title = _a2.title; + var id2 = modalProps && modalProps.titleAriaId || ariaLabelledById; + if (!id2) { + id2 = (dialogContentProps && dialogContentProps.title || title) && _this._defaultTitleTextId; + } + return id2; + }; + _this._id = getId("Dialog"); + _this._defaultTitleTextId = _this._id + "-title"; + _this._defaultSubTextId = _this._id + "-subText"; + return _this; + } + DialogBase2.prototype.render = function() { + var _a2, _b2, _c2; + var props = this.props; + var className2 = props.className, containerClassName = props.containerClassName, contentClassName = props.contentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, forceFocusInsideTrap = props.forceFocusInsideTrap, styles = props.styles, hidden = props.hidden, _d2 = props.disableRestoreFocus, disableRestoreFocus = _d2 === void 0 ? props.ignoreExternalFocusing : _d2, isBlocking = props.isBlocking, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, _e2 = props.isOpen, isOpen = _e2 === void 0 ? !hidden : _e2, onDismiss = props.onDismiss, onDismissed = props.onDismissed, onLayerDidMount = props.onLayerDidMount, responsiveMode = props.responsiveMode, subText = props.subText, theme = props.theme, title = props.title, topButtonsProps = props.topButtonsProps, type2 = props.type, minWidth2 = props.minWidth, maxWidth = props.maxWidth, modalProps = props.modalProps; + var mergedLayerProps = __assign$1({ onLayerDidMount }, modalProps === null || modalProps === void 0 ? void 0 : modalProps.layerProps); + var dialogDraggableClassName; + var dragOptions; + if ((modalProps === null || modalProps === void 0 ? void 0 : modalProps.dragOptions) && !((_a2 = modalProps.dragOptions) === null || _a2 === void 0 ? void 0 : _a2.dragHandleSelector)) { + dragOptions = __assign$1({}, modalProps.dragOptions); + dialogDraggableClassName = "ms-Dialog-draggable-header"; + dragOptions.dragHandleSelector = ".".concat(dialogDraggableClassName); + } + var mergedModalProps = __assign$1(__assign$1(__assign$1(__assign$1({}, DefaultModalProps), { elementToFocusOnDismiss, firstFocusableSelector, forceFocusInsideTrap, disableRestoreFocus, isClickableOutsideFocusTrap, responsiveMode, className: className2, containerClassName, isBlocking, isDarkOverlay, onDismissed }), modalProps), { dragOptions, layerProps: mergedLayerProps, isOpen }); + var dialogContentProps = __assign$1(__assign$1(__assign$1({ className: contentClassName, subText, title, topButtonsProps, type: type2 }, DefaultDialogContentProps), props.dialogContentProps), { draggableHeaderClassName: dialogDraggableClassName, titleProps: __assign$1({ + // eslint-disable-next-line @typescript-eslint/no-deprecated + id: ((_b2 = props.dialogContentProps) === null || _b2 === void 0 ? void 0 : _b2.titleId) || this._defaultTitleTextId + }, (_c2 = props.dialogContentProps) === null || _c2 === void 0 ? void 0 : _c2.titleProps) }); + var classNames2 = getClassNames$6(styles, { + theme, + className: mergedModalProps.className, + containerClassName: mergedModalProps.containerClassName, + hidden, + dialogDefaultMinWidth: minWidth2, + dialogDefaultMaxWidth: maxWidth + }); + return React__namespace.createElement( + Modal, + __assign$1({}, mergedModalProps, { className: classNames2.root, containerClassName: classNames2.main, onDismiss: onDismiss || mergedModalProps.onDismiss, subtitleAriaId: this._getSubTextId(), titleAriaId: this._getTitleTextId() }), + React__namespace.createElement(DialogContent, __assign$1({ subTextId: this._defaultSubTextId, showCloseButton: mergedModalProps.isBlocking, onDismiss }, dialogContentProps), props.children) + ); + }; + DialogBase2.defaultProps = { + hidden: true + }; + DialogBase2 = __decorate([ + withResponsiveMode + ], DialogBase2); + return DialogBase2; + })(React__namespace.Component) + ); + var GlobalClassNames$4 = { + root: "ms-Dialog" + }; + var getStyles$6 = function(props) { + var _a2; + var className2 = props.className, containerClassName = props.containerClassName, _b2 = props.dialogDefaultMinWidth, dialogDefaultMinWidth = _b2 === void 0 ? "288px" : _b2, _c2 = props.dialogDefaultMaxWidth, dialogDefaultMaxWidth = _c2 === void 0 ? "340px" : _c2, hidden = props.hidden, theme = props.theme; + var classNames2 = getGlobalClassNames(GlobalClassNames$4, theme); + return { + root: [classNames2.root, theme.fonts.medium, className2], + main: [ + { + width: dialogDefaultMinWidth, + outline: "3px solid transparent", + selectors: (_a2 = {}, _a2["@media (min-width: ".concat(ScreenWidthMinMedium, "px)")] = { + width: "auto", + maxWidth: dialogDefaultMaxWidth, + minWidth: dialogDefaultMinWidth + }, _a2) + }, + !hidden && { display: "flex" }, + containerClassName + ] + }; + }; + var Dialog = styled(DialogBase, getStyles$6, void 0, { scope: "Dialog" }); + Dialog.displayName = "Dialog"; + var DropdownSizePosCache = ( + /** @class */ + (function() { + function DropdownSizePosCache2() { + this._size = 0; + } + DropdownSizePosCache2.prototype.updateOptions = function(options2) { + var displayOnlyOptionsCache = []; + var notSelectableOptionsCache = []; + var size = 0; + for (var i = 0; i < options2.length; i++) { + var _a2 = options2[i], itemType = _a2.itemType, hidden = _a2.hidden; + if (itemType === SelectableOptionMenuItemType.Divider || itemType === SelectableOptionMenuItemType.Header) { + displayOnlyOptionsCache.push(i); + notSelectableOptionsCache.push(i); + } else if (hidden) { + notSelectableOptionsCache.push(i); + } else { + size++; + } + } + this._size = size; + this._displayOnlyOptionsCache = displayOnlyOptionsCache; + this._notSelectableOptionsCache = notSelectableOptionsCache; + this._cachedOptions = __spreadArray([], options2, true); + }; + Object.defineProperty(DropdownSizePosCache2.prototype, "optionSetSize", { + /** + * The size of all the selectable options. + */ + get: function() { + return this._size; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(DropdownSizePosCache2.prototype, "cachedOptions", { + /** + * The chached options array. + */ + get: function() { + return this._cachedOptions; + }, + enumerable: false, + configurable: true + }); + DropdownSizePosCache2.prototype.positionInSet = function(index2) { + if (index2 === void 0) { + return void 0; + } + var offset2 = 0; + while (index2 > this._notSelectableOptionsCache[offset2]) { + offset2++; + } + if (this._displayOnlyOptionsCache[offset2] === index2) { + throw new Error("Unexpected: Option at index ".concat(index2, " is not a selectable element.")); + } + if (this._notSelectableOptionsCache[offset2] === index2) { + return void 0; + } + return index2 - offset2 + 1; + }; + return DropdownSizePosCache2; + })() + ); + var PanelType; + (function(PanelType2) { + PanelType2[PanelType2["smallFluid"] = 0] = "smallFluid"; + PanelType2[PanelType2["smallFixedFar"] = 1] = "smallFixedFar"; + PanelType2[PanelType2["smallFixedNear"] = 2] = "smallFixedNear"; + PanelType2[PanelType2["medium"] = 3] = "medium"; + PanelType2[PanelType2["large"] = 4] = "large"; + PanelType2[PanelType2["largeFixed"] = 5] = "largeFixed"; + PanelType2[PanelType2["extraLarge"] = 6] = "extraLarge"; + PanelType2[PanelType2["custom"] = 7] = "custom"; + PanelType2[PanelType2["customNear"] = 8] = "customNear"; + })(PanelType || (PanelType = {})); + var getClassNames$5 = classNamesFunction(); + var PanelVisibilityState; + (function(PanelVisibilityState2) { + PanelVisibilityState2[PanelVisibilityState2["closed"] = 0] = "closed"; + PanelVisibilityState2[PanelVisibilityState2["animatingOpen"] = 1] = "animatingOpen"; + PanelVisibilityState2[PanelVisibilityState2["open"] = 2] = "open"; + PanelVisibilityState2[PanelVisibilityState2["animatingClosed"] = 3] = "animatingClosed"; + })(PanelVisibilityState || (PanelVisibilityState = {})); + var PanelBase = ( + /** @class */ + (function(_super) { + __extends(PanelBase2, _super); + function PanelBase2(props) { + var _this = _super.call(this, props) || this; + _this._panel = React__namespace.createRef(); + _this._animationCallback = null; + _this._hasCustomNavigation = !!(_this.props.onRenderNavigation || _this.props.onRenderNavigationContent); + _this.dismiss = function(ev) { + if (_this.props.onDismiss && _this.isActive) { + _this.props.onDismiss(ev); + } + if (!ev || ev && !ev.defaultPrevented) { + _this.close(); + } }; - _this._onReduceData = function(data) { - var _a = _this.props, shiftOnReduce = _a.shiftOnReduce, onDataReduced = _a.onDataReduced; - var primaryItems = data.primaryItems, overflowItems = data.overflowItems, cacheKey = data.cacheKey; - var farItems = data.farItems; - // Use first item if shiftOnReduce, otherwise use last item - var movedItem = primaryItems[shiftOnReduce ? 0 : primaryItems.length - 1]; - if (movedItem !== undefined) { - movedItem.renderedInOverflow = true; - overflowItems = (0, _tslib.__spreadArray)([ - movedItem - ], overflowItems, true); - primaryItems = shiftOnReduce ? primaryItems.slice(1) : primaryItems.slice(0, -1); - var newData = (0, _tslib.__assign)((0, _tslib.__assign)({}, data), { - primaryItems: primaryItems, - overflowItems: overflowItems - }); - cacheKey = _this._computeCacheKey({ - primaryItems: primaryItems, - overflow: overflowItems.length > 0, - farItems: farItems - }); - if (onDataReduced) onDataReduced(movedItem); - newData.cacheKey = cacheKey; - return newData; + _this._allowScrollOnPanel = function(elt) { + var _a3; + _this._resizeObserver = _this._createResizeObserver(function(entries) { + if (entries.length > 0 && entries[0].target === elt) { + _this._updateFooterPosition(); + } + }); + if (elt) { + (_a3 = _this._resizeObserver) === null || _a3 === void 0 ? void 0 : _a3.observe(elt); + if (_this._allowTouchBodyScroll) { + allowOverscrollOnElement(elt, _this._events); + } else { + allowScrollOnElement(elt, _this._events); } - return undefined; + } else { + _this._events.off(_this._scrollableContent); + } + _this._scrollableContent = elt; }; - _this._onGrowData = function(data) { - var _a = _this.props, shiftOnReduce = _a.shiftOnReduce, onDataGrown = _a.onDataGrown; - var minimumOverflowItems = data.minimumOverflowItems; - var primaryItems = data.primaryItems, overflowItems = data.overflowItems, cacheKey = data.cacheKey; - var farItems = data.farItems; - var movedItem = overflowItems[0]; - // Make sure that moved item exists and is not one of the original overflow items - if (movedItem !== undefined && overflowItems.length > minimumOverflowItems) { - movedItem.renderedInOverflow = false; - overflowItems = overflowItems.slice(1); - // if shiftOnReduce, movedItem goes first, otherwise, last. - primaryItems = shiftOnReduce ? (0, _tslib.__spreadArray)([ - movedItem - ], primaryItems, true) : (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], primaryItems, true), [ - movedItem - ], false); - var newData = (0, _tslib.__assign)((0, _tslib.__assign)({}, data), { - primaryItems: primaryItems, - overflowItems: overflowItems - }); - cacheKey = _this._computeCacheKey({ - primaryItems: primaryItems, - overflow: overflowItems.length > 0, - farItems: farItems - }); - if (onDataGrown) onDataGrown(movedItem); - newData.cacheKey = cacheKey; - return newData; - } - return undefined; + _this._onRenderNavigation = function(props2) { + if (!_this.props.onRenderNavigationContent && !_this.props.onRenderNavigation && !_this.props.hasCloseButton) { + return null; + } + var _a3 = _this.props.onRenderNavigationContent, onRenderNavigationContent = _a3 === void 0 ? _this._onRenderNavigationContent : _a3; + return React__namespace.createElement("div", { className: _this._classNames.navigation }, onRenderNavigationContent(props2, _this._onRenderNavigationContent)); + }; + _this._onRenderNavigationContent = function(props2) { + var _a3; + var closeButtonAriaLabel = props2.closeButtonAriaLabel, hasCloseButton = props2.hasCloseButton, _b2 = props2.onRenderHeader, onRenderHeader = _b2 === void 0 ? _this._onRenderHeader : _b2; + if (hasCloseButton) { + var iconButtonStyles = (_a3 = _this._classNames.subComponentStyles) === null || _a3 === void 0 ? void 0 : _a3.closeButton(); + return React__namespace.createElement( + React__namespace.Fragment, + null, + !_this._hasCustomNavigation && onRenderHeader(_this.props, _this._onRenderHeader, _this._headerTextId), + React__namespace.createElement(IconButton, { styles: iconButtonStyles, className: _this._classNames.closeButton, onClick: _this._onPanelClick, ariaLabel: closeButtonAriaLabel, title: closeButtonAriaLabel, "data-is-visible": true, iconProps: { iconName: "Cancel" } }) + ); + } + return null; + }; + _this._onRenderHeader = function(props2, defaultRender, headerTextId) { + var headerText = props2.headerText, _a3 = props2.headerTextProps, headerTextProps = _a3 === void 0 ? {} : _a3; + if (headerText) { + return React__namespace.createElement( + "div", + { className: _this._classNames.header }, + React__namespace.createElement("div", __assign$1({ id: headerTextId, role: "heading", "aria-level": 1 }, headerTextProps, { className: css(_this._classNames.headerText, headerTextProps.className) }), headerText) + ); + } + return null; + }; + _this._onRenderBody = function(props2) { + return React__namespace.createElement("div", { className: _this._classNames.content }, props2.children); + }; + _this._onRenderFooter = function(props2) { + var _a3 = _this.props.onRenderFooterContent, onRenderFooterContent = _a3 === void 0 ? null : _a3; + if (onRenderFooterContent) { + return React__namespace.createElement( + "div", + { className: _this._classNames.footer }, + React__namespace.createElement("div", { className: _this._classNames.footerInner }, onRenderFooterContent()) + ); + } + return null; }; - (0, _utilities.initializeComponentRef)(_this); - return _this; - } - CommandBarBase.prototype.render = function() { - var _a = this.props, items = _a.items, overflowItems = _a.overflowItems, farItems = _a.farItems, styles = _a.styles, theme = _a.theme, dataDidRender = _a.dataDidRender, _b = _a.onReduceData, onReduceData = _b === void 0 ? this._onReduceData : _b, _c = _a.onGrowData, onGrowData = _c === void 0 ? this._onGrowData : _c, _d = _a.resizeGroupAs, ResizeGroupAs = _d === void 0 ? (0, _resizeGroup.ResizeGroup) : _d; - var commandBarData = { - primaryItems: (0, _tslib.__spreadArray)([], items, true), - overflowItems: (0, _tslib.__spreadArray)([], overflowItems, true), - minimumOverflowItems: (0, _tslib.__spreadArray)([], overflowItems, true).length, - farItems: farItems, - cacheKey: this._computeCacheKey({ - primaryItems: (0, _tslib.__spreadArray)([], items, true), - overflow: overflowItems && overflowItems.length > 0, - farItems: farItems - }) + _this._animateTo = function(newVisibilityState) { + if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpen) { + _this.props.onOpen(); + } + _this._animationCallback = _this._async.setTimeout(function() { + _this.setState({ visibility: newVisibilityState }); + _this._onTransitionComplete(newVisibilityState); + }, 200); }; - this._classNames = getClassNames(styles, { - theme: theme - }); - // ResizeGroup will render these attributes to the root <div>. - // TODO We may need to elevate classNames from <FocusZone> into <ResizeGroup> ? - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)); - return _react.createElement(ResizeGroupAs, (0, _tslib.__assign)({}, nativeProps, { - componentRef: this._resizeGroup, - data: commandBarData, - onReduceData: onReduceData, - onGrowData: onGrowData, - onRenderData: this._onRenderData, - dataDidRender: dataDidRender - })); - }; - CommandBarBase.prototype.focus = function() { - var overflowSet = this._overflowSet.current; - overflowSet && overflowSet.focus(); - }; - CommandBarBase.prototype.remeasure = function() { - this._resizeGroup.current && this._resizeGroup.current.remeasure(); - }; - CommandBarBase.prototype._onButtonClick = function(item) { - return function(ev) { - // inactive is deprecated. remove check in 7.0 - // eslint-disable-next-line deprecation/deprecation - if (item.inactive) return; - if (item.onClick) item.onClick(ev, item); + _this._clearExistingAnimationTimer = function() { + if (_this._animationCallback !== null) { + _this._async.clearTimeout(_this._animationCallback); + } }; - }; - CommandBarBase.prototype._computeCacheKey = function(data) { - var primaryItems = data.primaryItems, overflow = data.overflow, farItems = data.farItems; - var returnKey = function(acc, current) { - var _a = current.cacheKey, cacheKey = _a === void 0 ? current.key : _a; - return acc + cacheKey; + _this._onPanelClick = function(ev) { + _this.dismiss(ev); }; - var primaryKey = primaryItems && primaryItems.reduce(returnKey, ''); - var overflowKey = overflow ? 'overflow' : ''; - var farKey = farItems && farItems.reduce(returnKey, ''); - return [ - primaryKey, - overflowKey, - farKey - ].join(''); - }; - CommandBarBase.defaultProps = { - items: [], - overflowItems: [] - }; - return CommandBarBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../OverflowSet":"cUjom","../../ResizeGroup":"lgldX","../../FocusZone":"k9nPH","../../Button":"1457j","../../Tooltip":"dAQ01","./CommandBar.styles":"hGu9m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cUjom":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/OverflowSet/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/OverflowSet/index":"gSTyE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gSTyE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _overflowSet = require("./OverflowSet"); -parcelHelpers.exportAll(_overflowSet, exports); -var _overflowSetBase = require("./OverflowSet.base"); -parcelHelpers.exportAll(_overflowSetBase, exports); -var _overflowSetTypes = require("./OverflowSet.types"); -parcelHelpers.exportAll(_overflowSetTypes, exports); - -},{"./OverflowSet":"cwhns","./OverflowSet.base":false,"./OverflowSet.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cwhns":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverflowSet", ()=>OverflowSet); -var _utilities = require("../../Utilities"); -var _overflowSetBase = require("./OverflowSet.base"); -var _overflowSetStyles = require("./OverflowSet.styles"); -var OverflowSet = (0, _utilities.styled)((0, _overflowSetBase.OverflowSetBase), (0, _overflowSetStyles.getStyles), undefined, { - scope: 'OverflowSet' -}); - -},{"../../Utilities":"1NZCy","./OverflowSet.base":"dTJHN","./OverflowSet.styles":"159Ht","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dTJHN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverflowSetBase", ()=>OverflowSetBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("../../Utilities"); -var _overflowButton = require("./OverflowButton"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var COMPONENT_NAME = 'OverflowSet'; -var useComponentRef = function(props, divContainer) { - var doc = (0, _dom.useDocumentEx)(); - _react.useImperativeHandle(props.componentRef, function() { - return { - focus: function(_forceIntoFirstElement, bypassHiddenElements) { - var focusSucceeded = false; - if (divContainer.current) focusSucceeded = (0, _utilities.focusFirstChild)(divContainer.current, bypassHiddenElements); - return focusSucceeded; - }, - focusElement: function(childElement) { - var focusSucceeded = false; - if (!childElement) return false; - if (divContainer.current && (0, _utilities.elementContains)(divContainer.current, childElement)) { - childElement.focus(); - focusSucceeded = (doc === null || doc === void 0 ? void 0 : doc.activeElement) === childElement; - } - return focusSucceeded; - } + _this._onTransitionComplete = function(newVisibilityState) { + _this._updateFooterPosition(); + if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpened) { + _this.props.onOpened(); + } + if (newVisibilityState === PanelVisibilityState.closed && _this.props.onDismissed) { + _this.props.onDismissed(); + } + }; + var _a2 = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a2 === void 0 ? false : _a2; + _this._allowTouchBodyScroll = allowTouchBodyScroll; + initializeComponentRef(_this); + _this.state = { + isFooterSticky: false, + // intentionally ignore props so animation takes place during componentDidMount + visibility: PanelVisibilityState.closed, + id: getId("Panel") }; - }, [ - divContainer, - doc - ]); -}; -var OverflowSetBase = _react.forwardRef(function(props, forwardedRef) { - var divContainer = _react.useRef(null); - var mergedRef = (0, _reactHooks.useMergedRefs)(divContainer, forwardedRef); - useComponentRef(props, divContainer); - var items = props.items, overflowItems = props.overflowItems, className = props.className, styles = props.styles, vertical = props.vertical, role = props.role, _a = props.overflowSide, overflowSide = _a === void 0 ? 'end' : _a, onRenderItem = props.onRenderItem; - var classNames = getClassNames(styles, { - className: className, - vertical: vertical - }); - var showOverflow = !!overflowItems && overflowItems.length > 0; - return _react.createElement("div", (0, _tslib.__assign)({}, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)), { - role: role || 'group', - "aria-orientation": role === 'menubar' ? vertical === true ? 'vertical' : 'horizontal' : undefined, - className: classNames.root, - ref: mergedRef - }), overflowSide === 'start' && showOverflow && _react.createElement((0, _overflowButton.OverflowButton), (0, _tslib.__assign)({}, props, { - className: classNames.overflowButton - })), items && items.map(function(item, i) { - return _react.createElement("div", { - className: classNames.item, - key: item.key, - role: "none" - }, onRenderItem(item)); - }), overflowSide === 'end' && showOverflow && _react.createElement((0, _overflowButton.OverflowButton), (0, _tslib.__assign)({}, props, { - className: classNames.overflowButton - }))); -}); -OverflowSetBase.displayName = COMPONENT_NAME; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","../../Utilities":"1NZCy","./OverflowButton":"1yEzy","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1yEzy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverflowButton", ()=>OverflowButton); -var _tslib = require("tslib"); -var _react = require("react"); -var _keytipManager = require("../../utilities/keytips/KeytipManager"); -var _reactHooks = require("@fluentui/react-hooks"); -var registerPersistedKeytips = function(keytipsToRegister, keytipManager, registeredPersistedKeytips) { - for(var _i = 0, keytipsToRegister_1 = keytipsToRegister; _i < keytipsToRegister_1.length; _i++){ - var keytip = keytipsToRegister_1[_i]; - var uniqueID = keytipManager.register(keytip, true); - // Update map - registeredPersistedKeytips[uniqueID] = keytip; - } -}; -var unregisterPersistedKeytips = function(keytipManager, registeredPersistedKeytips) { - for(var _i = 0, _a = Object.keys(registeredPersistedKeytips); _i < _a.length; _i++){ - var uniqueID = _a[_i]; - keytipManager.unregister(registeredPersistedKeytips[uniqueID], uniqueID, true); - delete registeredPersistedKeytips[uniqueID]; - } -}; -var useKeytipRegistrations = function(registeredPersistedKeytips, keytipsToRegister, keytipManager) { - var prevPersistedKeytips = (0, _reactHooks.usePrevious)(registeredPersistedKeytips); - // Update - _react.useEffect(function() { - if (prevPersistedKeytips) { - // Unregister old keytips - unregisterPersistedKeytips(keytipManager, prevPersistedKeytips); - // Register new keytips - registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); + return _this; + } + PanelBase2.getDerivedStateFromProps = function(nextProps, prevState) { + if (nextProps.isOpen === void 0) { + return null; } - }); - // Mount/Unmount - _react.useEffect(function() { - // Register on mount - registerPersistedKeytips(keytipsToRegister, keytipManager, registeredPersistedKeytips); - return function() { - // Unregister on unmount - unregisterPersistedKeytips(keytipManager, registeredPersistedKeytips); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); -}; -var OverflowButton = function(props) { - var keytipManager = (0, _keytipManager.KeytipManager).getInstance(); - var className = props.className, overflowItems = props.overflowItems, keytipSequences = props.keytipSequences, itemSubMenuProvider = props.itemSubMenuProvider, onRenderOverflowButton = props.onRenderOverflowButton; - var persistedKeytips = (0, _reactHooks.useConst)({}); - // Gets the subMenu for an overflow item - var getSubMenuForItem = _react.useCallback(function(item) { - // Checks if itemSubMenuProvider has been defined, if not defaults to subMenuProps - if (itemSubMenuProvider) return itemSubMenuProvider(item); - if (item.subMenuProps) return item.subMenuProps.items; - return undefined; - }, [ - itemSubMenuProvider - ]); - var _a = _react.useMemo(function() { - var newKeytipsToRegister = []; - var newOverflowItems = []; - if (keytipSequences) overflowItems === null || overflowItems === void 0 || overflowItems.forEach(function(overflowItem) { - var _a; - var keytip = overflowItem.keytipProps; - if (keytip) { - // Create persisted keytip - var persistedKeytip = { - content: keytip.content, - keySequences: keytip.keySequences, - disabled: keytip.disabled || !!(overflowItem.disabled || overflowItem.isDisabled), - hasDynamicChildren: keytip.hasDynamicChildren, - hasMenu: keytip.hasMenu - }; - if (keytip.hasDynamicChildren || getSubMenuForItem(overflowItem)) { - // If the keytip has a submenu or children nodes, change onExecute to persistedKeytipExecute - persistedKeytip.onExecute = keytipManager.menuExecute.bind(keytipManager, keytipSequences, (_a = overflowItem === null || overflowItem === void 0 ? void 0 : overflowItem.keytipProps) === null || _a === void 0 ? void 0 : _a.keySequences); - persistedKeytip.hasOverflowSubMenu = true; - } else // If the keytip doesn't have a submenu, just execute the original function - persistedKeytip.onExecute = keytip.onExecute; - newKeytipsToRegister.push(persistedKeytip); - // Add the overflow sequence to this item - var newOverflowItem = (0, _tslib.__assign)((0, _tslib.__assign)({}, overflowItem), { - keytipProps: (0, _tslib.__assign)((0, _tslib.__assign)({}, keytip), { - overflowSetSequence: keytipSequences - }) - }); - newOverflowItems === null || newOverflowItems === void 0 || newOverflowItems.push(newOverflowItem); - } else // Nothing to change, add overflowItem to list - newOverflowItems === null || newOverflowItems === void 0 || newOverflowItems.push(overflowItem); + if (nextProps.isOpen && (prevState.visibility === PanelVisibilityState.closed || prevState.visibility === PanelVisibilityState.animatingClosed)) { + return { visibility: PanelVisibilityState.animatingOpen }; + } + if (!nextProps.isOpen && (prevState.visibility === PanelVisibilityState.open || prevState.visibility === PanelVisibilityState.animatingOpen)) { + return { visibility: PanelVisibilityState.animatingClosed }; + } + return null; + }; + PanelBase2.prototype.componentDidMount = function() { + this._async = new Async(this); + this._events = new EventGroup(this); + var win = getWindowEx(this.context); + var doc = getDocumentEx(this.context); + this._events.on(win, "resize", this._updateFooterPosition); + if (this._shouldListenForOuterClick(this.props)) { + this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, "mousedown", this._dismissOnOuterClick, true); + } + if (this.props.isOpen) { + this.setState({ visibility: PanelVisibilityState.animatingOpen }); + } + }; + PanelBase2.prototype.componentDidUpdate = function(previousProps, previousState) { + var shouldListenOnOuterClick = this._shouldListenForOuterClick(this.props); + var previousShouldListenOnOuterClick = this._shouldListenForOuterClick(previousProps); + if (this.state.visibility !== previousState.visibility) { + this._clearExistingAnimationTimer(); + if (this.state.visibility === PanelVisibilityState.animatingOpen) { + this._animateTo(PanelVisibilityState.open); + } else if (this.state.visibility === PanelVisibilityState.animatingClosed) { + this._animateTo(PanelVisibilityState.closed); + } + } + var doc = getDocumentEx(this.context); + if (shouldListenOnOuterClick && !previousShouldListenOnOuterClick) { + this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, "mousedown", this._dismissOnOuterClick, true); + } else if (!shouldListenOnOuterClick && previousShouldListenOnOuterClick) { + this._events.off(doc === null || doc === void 0 ? void 0 : doc.body, "mousedown", this._dismissOnOuterClick, true); + } + }; + PanelBase2.prototype.componentWillUnmount = function() { + var _a2; + this._async.dispose(); + this._events.dispose(); + (_a2 = this._resizeObserver) === null || _a2 === void 0 ? void 0 : _a2.disconnect(); + }; + PanelBase2.prototype.render = function() { + var _a2 = this.props, _b2 = _a2.className, className2 = _b2 === void 0 ? "" : _b2, elementToFocusOnDismiss = _a2.elementToFocusOnDismiss, firstFocusableSelector = _a2.firstFocusableSelector, focusTrapZoneProps = _a2.focusTrapZoneProps, forceFocusInsideTrap = _a2.forceFocusInsideTrap, hasCloseButton = _a2.hasCloseButton, headerText = _a2.headerText, _c2 = _a2.headerClassName, headerClassName = _c2 === void 0 ? "" : _c2, ignoreExternalFocusing = _a2.ignoreExternalFocusing, isBlocking = _a2.isBlocking, isFooterAtBottom = _a2.isFooterAtBottom, isLightDismiss = _a2.isLightDismiss, isHiddenOnDismiss = _a2.isHiddenOnDismiss, layerProps = _a2.layerProps, overlayProps = _a2.overlayProps, popupProps = _a2.popupProps, type2 = _a2.type, styles = _a2.styles, theme = _a2.theme, customWidth = _a2.customWidth, _d2 = _a2.onLightDismissClick, onLightDismissClick = _d2 === void 0 ? this._onPanelClick : _d2, _e2 = _a2.onRenderNavigation, onRenderNavigation = _e2 === void 0 ? this._onRenderNavigation : _e2, _f = _a2.onRenderHeader, onRenderHeader = _f === void 0 ? this._onRenderHeader : _f, _g = _a2.onRenderBody, onRenderBody = _g === void 0 ? this._onRenderBody : _g, _h = _a2.onRenderFooter, onRenderFooter = _h === void 0 ? this._onRenderFooter : _h; + var _j = this.state, isFooterSticky = _j.isFooterSticky, visibility = _j.visibility, id2 = _j.id; + var isLeft = type2 === PanelType.smallFixedNear || type2 === PanelType.customNear ? true : false; + var isRTL = getRTL(theme); + var isOnRightSide = isRTL ? isLeft : !isLeft; + var customWidthStyles = type2 === PanelType.custom || type2 === PanelType.customNear ? { width: customWidth } : {}; + var nativeProps = getNativeProps(this.props, divProperties); + var isOpen = this.isActive; + var isAnimating = visibility === PanelVisibilityState.animatingClosed || visibility === PanelVisibilityState.animatingOpen; + this._headerTextId = headerText && id2 + "-headerText"; + if (!isOpen && !isAnimating && !isHiddenOnDismiss) { + return null; + } + this._classNames = getClassNames$5(styles, { + theme, + className: className2, + focusTrapZoneClassName: focusTrapZoneProps ? focusTrapZoneProps.className : void 0, + hasCloseButton, + headerClassName, + isAnimating, + isFooterSticky, + isFooterAtBottom, + isOnRightSide, + isOpen, + isHiddenOnDismiss, + type: type2, + hasCustomNavigation: this._hasCustomNavigation }); - else newOverflowItems = overflowItems; - return { - modifiedOverflowItems: newOverflowItems, - keytipsToRegister: newKeytipsToRegister - }; - }, [ - overflowItems, - getSubMenuForItem, - keytipManager, - keytipSequences - ]), modifiedOverflowItems = _a.modifiedOverflowItems, keytipsToRegister = _a.keytipsToRegister; - useKeytipRegistrations(persistedKeytips, keytipsToRegister, keytipManager); - return _react.createElement("div", { - className: className - }, onRenderOverflowButton(modifiedOverflowItems)); -}; - -},{"tslib":"9gizs","react":"jGrId","../../utilities/keytips/KeytipManager":"04Pqp","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"159Ht":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var overflowItemStyle = { - flexShrink: 0, - display: 'inherit' -}; -var getStyles = function(props) { - var className = props.className, vertical = props.vertical; - return { - root: [ - 'ms-OverflowSet', - { - position: 'relative', - display: 'flex', - flexWrap: 'nowrap' - }, - vertical && { - flexDirection: 'column' - }, - className - ], - item: [ - 'ms-OverflowSet-item', - overflowItemStyle - ], - overflowButton: [ - 'ms-OverflowSet-overflowButton', - overflowItemStyle - ] - }; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lgldX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/ResizeGroup/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/ResizeGroup/index":"9cG4J","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9cG4J":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _resizeGroup = require("./ResizeGroup"); -parcelHelpers.exportAll(_resizeGroup, exports); -var _resizeGroupBase = require("./ResizeGroup.base"); -parcelHelpers.exportAll(_resizeGroupBase, exports); -var _resizeGroupTypes = require("./ResizeGroup.types"); -parcelHelpers.exportAll(_resizeGroupTypes, exports); - -},{"./ResizeGroup":"5ttP5","./ResizeGroup.base":false,"./ResizeGroup.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ttP5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ResizeGroup", ()=>ResizeGroup); -var _resizeGroupBase = require("./ResizeGroup.base"); -var ResizeGroup = (0, _resizeGroupBase.ResizeGroupBase); - -},{"./ResizeGroup.base":"7Gid8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Gid8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getMeasurementCache", ()=>getMeasurementCache); -parcelHelpers.export(exports, "getNextResizeGroupStateProvider", ()=>getNextResizeGroupStateProvider); -parcelHelpers.export(exports, "MeasuredContext", ()=>MeasuredContext); -parcelHelpers.export(exports, "ResizeGroupBase", ()=>ResizeGroupBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _resizeGroupTypes = require("./ResizeGroup.types"); -var _reactHooks = require("@fluentui/react-hooks"); -var _windowProvider = require("../../WindowProvider"); -var RESIZE_DELAY = 16; -var getMeasurementCache = function() { - var measurementsCache = {}; - return { - /** - * Checks if the provided data has a cacheKey. If it has a cacheKey and there is a - * corresponding entry in the measurementsCache, then it will return that value. - * Returns undefined otherwise. - */ getCachedMeasurement: function(data) { - if (data && data.cacheKey && measurementsCache.hasOwnProperty(data.cacheKey)) return measurementsCache[data.cacheKey]; - return undefined; + var _k = this, _classNames = _k._classNames, _allowTouchBodyScroll = _k._allowTouchBodyScroll; + var overlay; + if (isBlocking && isOpen) { + overlay = React__namespace.createElement(Overlay, __assign$1({ className: _classNames.overlay, isDarkThemed: false, onClick: isLightDismiss ? onLightDismissClick : void 0, allowTouchBodyScroll: _allowTouchBodyScroll }, overlayProps)); + } + return React__namespace.createElement( + Layer, + __assign$1({}, layerProps), + React__namespace.createElement( + Popup, + __assign$1({ role: "dialog", "aria-modal": isBlocking ? "true" : void 0, ariaLabelledBy: this._headerTextId ? this._headerTextId : void 0, onDismiss: this.dismiss, className: _classNames.hiddenPanel, enableAriaHiddenSiblings: isOpen ? true : false }, popupProps), + React__namespace.createElement( + "div", + __assign$1({ "aria-hidden": !isOpen && isAnimating }, nativeProps, { ref: this._panel, className: _classNames.root }), + overlay, + React__namespace.createElement( + FocusTrapZone, + __assign$1({ ignoreExternalFocusing, forceFocusInsideTrap: !isBlocking || isHiddenOnDismiss && !isOpen ? false : forceFocusInsideTrap, firstFocusableSelector, isClickableOutsideFocusTrap: true }, focusTrapZoneProps, { className: _classNames.main, style: customWidthStyles, elementToFocusOnDismiss }), + React__namespace.createElement( + "div", + { className: _classNames.contentInner }, + React__namespace.createElement( + "div", + { ref: this._allowScrollOnPanel, className: _classNames.scrollableContent, "data-is-scrollable": true }, + React__namespace.createElement("div", { className: _classNames.commands, "data-is-visible": true }, onRenderNavigation(this.props, this._onRenderNavigation)), + (this._hasCustomNavigation || !hasCloseButton) && onRenderHeader(this.props, this._onRenderHeader, this._headerTextId), + onRenderBody(this.props, this._onRenderBody), + onRenderFooter(this.props, this._onRenderFooter) + ) + ) + ) + ) + ) + ); + }; + PanelBase2.prototype.open = function() { + if (this.props.isOpen !== void 0) { + return; + } + if (this.isActive) { + return; + } + this.setState({ visibility: PanelVisibilityState.animatingOpen }); + }; + PanelBase2.prototype.close = function() { + if (this.props.isOpen !== void 0) { + return; + } + if (!this.isActive) { + return; + } + this.setState({ visibility: PanelVisibilityState.animatingClosed }); + }; + Object.defineProperty(PanelBase2.prototype, "isActive", { + /** isActive is true when panel is open or opening. */ + get: function() { + return this.state.visibility === PanelVisibilityState.open || this.state.visibility === PanelVisibilityState.animatingOpen; }, - /** - * Should be called whenever there is a new measurement associated with a given data object. - * If the data has a cacheKey, store that measurement in the measurementsCache. - */ addMeasurementToCache: function(data, measurement) { - if (data.cacheKey) measurementsCache[data.cacheKey] = measurement; + enumerable: false, + configurable: true + }); + PanelBase2.prototype._createResizeObserver = function(callback) { + var _a2; + var doc = getDocumentEx(this.context); + var resizeObserver = null; + if ((_a2 = doc === null || doc === void 0 ? void 0 : doc.defaultView) === null || _a2 === void 0 ? void 0 : _a2.ResizeObserver) { + resizeObserver = new doc.defaultView.ResizeObserver(callback); + } + return resizeObserver; + }; + PanelBase2.prototype._shouldListenForOuterClick = function(props) { + return !!props.isBlocking && !!props.isOpen; + }; + PanelBase2.prototype._updateFooterPosition = function() { + var scrollableContent = this._scrollableContent; + if (scrollableContent) { + var height2 = scrollableContent.clientHeight; + var innerHeight_1 = scrollableContent.scrollHeight; + this.setState({ + isFooterSticky: height2 < innerHeight_1 ? true : false + }); + } + }; + PanelBase2.prototype._dismissOnOuterClick = function(ev) { + var panel = this._panel.current; + if (this.isActive && panel && !ev.defaultPrevented) { + if (!elementContains(panel, ev.target)) { + if (this.props.onOuterClick) { + this.props.onOuterClick(ev); + } else { + this.dismiss(ev); + } + } } - }; -}; -var getNextResizeGroupStateProvider = function(measurementCache) { - if (measurementCache === void 0) measurementCache = getMeasurementCache(); - var _measurementCache = measurementCache; - var _containerDimension; - /** - * Gets the width/height of the data rendered in a hidden div. - * @param measuredData - The data corresponding to the measurement we wish to take. - * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. - * Only called when the measurement is not in the cache. - */ function _getMeasuredDimension(measuredData, getElementToMeasureDimension) { - var cachedDimension = _measurementCache.getCachedMeasurement(measuredData); - if (cachedDimension !== undefined) return cachedDimension; - var measuredDimension = getElementToMeasureDimension(); - _measurementCache.addMeasurementToCache(measuredData, measuredDimension); - return measuredDimension; + }; + PanelBase2.defaultProps = { + isHiddenOnDismiss: false, + isOpen: void 0, + isBlocking: true, + hasCloseButton: true, + type: PanelType.smallFixedFar + }; + PanelBase2.contextType = WindowContext; + return PanelBase2; + })(React__namespace.Component) + ); + var _a$1, _b$1, _c$1, _d$1, _e$1; + var GlobalClassNames$3 = { + root: "ms-Panel", + main: "ms-Panel-main", + commands: "ms-Panel-commands", + contentInner: "ms-Panel-contentInner", + scrollableContent: "ms-Panel-scrollableContent", + navigation: "ms-Panel-navigation", + closeButton: "ms-Panel-closeButton ms-PanelAction-close", + header: "ms-Panel-header", + headerText: "ms-Panel-headerText", + content: "ms-Panel-content", + footer: "ms-Panel-footer", + footerInner: "ms-Panel-footerInner", + isOpen: "is-open", + hasCloseButton: "ms-Panel--hasCloseButton", + smallFluid: "ms-Panel--smFluid", + smallFixedNear: "ms-Panel--smLeft", + smallFixedFar: "ms-Panel--sm", + medium: "ms-Panel--md", + large: "ms-Panel--lg", + largeFixed: "ms-Panel--fixed", + extraLarge: "ms-Panel--xl", + custom: "ms-Panel--custom", + customNear: "ms-Panel--customLeft" + }; + var panelWidth = { + full: "100%", + auto: "auto", + xs: 272, + sm: 340, + md1: 592, + md2: 644, + lg: 940 + }; + var panelMargin = { + auto: "auto", + none: 0, + md: 48, + lg: 428, + xl: 176 + }; + var smallPanelSelectors = (_a$1 = {}, _a$1["@media (min-width: ".concat(ScreenWidthMinMedium, "px)")] = { + width: panelWidth.sm + }, _a$1); + var mediumPanelSelectors = (_b$1 = {}, _b$1["@media (min-width: ".concat(ScreenWidthMinLarge, "px)")] = { + width: panelWidth.md1 + }, _b$1["@media (min-width: ".concat(ScreenWidthMinXLarge, "px)")] = { + width: panelWidth.md2 + }, _b$1); + var largePanelSelectors = (_c$1 = {}, _c$1["@media (min-width: ".concat(ScreenWidthMinUhfMobile, "px)")] = { + left: panelMargin.md, + width: panelWidth.auto + }, _c$1["@media (min-width: ".concat(ScreenWidthMinXXLarge, "px)")] = { + left: panelMargin.lg + }, _c$1); + var largeFixedPanelSelectors = (_d$1 = {}, _d$1["@media (min-width: ".concat(ScreenWidthMinXXLarge, "px)")] = { + left: panelMargin.auto, + width: panelWidth.lg + }, _d$1); + var extraLargePanelSelectors = (_e$1 = {}, _e$1["@media (min-width: ".concat(ScreenWidthMinXXLarge, "px)")] = { + left: panelMargin.xl + }, _e$1); + var getPanelBreakpoints = function(type2) { + var selectors; + switch (type2) { + case PanelType.smallFixedFar: + selectors = __assign$1({}, smallPanelSelectors); + break; + case PanelType.medium: + selectors = __assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors); + break; + case PanelType.large: + selectors = __assign$1(__assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors); + break; + case PanelType.largeFixed: + selectors = __assign$1(__assign$1(__assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), largeFixedPanelSelectors); + break; + case PanelType.extraLarge: + selectors = __assign$1(__assign$1(__assign$1(__assign$1({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), extraLargePanelSelectors); + break; } - /** - * Will get the next IResizeGroupState based on the current data while trying to shrink contents - * to fit in the container. - * @param data - The initial data point to start measuring. - * @param onReduceData - Function that transforms the data into something that should render with less width/height. - * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. - * Only called when the measurement is not in the cache. - */ function _shrinkContentsUntilTheyFit(data, onReduceData, getElementToMeasureDimension) { - var dataToMeasure = data; - var measuredDimension = _getMeasuredDimension(data, getElementToMeasureDimension); - while(measuredDimension > _containerDimension){ - var nextMeasuredData = onReduceData(dataToMeasure); - // We don't want to get stuck in an infinite render loop when there are no more - // scaling steps, so implementations of onReduceData should return undefined when - // there are no more scaling states to apply. - if (nextMeasuredData === undefined) return { - renderedData: dataToMeasure, - resizeDirection: undefined, - dataToMeasure: undefined - }; - measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); - // If the measurement isn't in the cache, we need to re-render with some data in a hidden div - if (measuredDimension === undefined) return { - dataToMeasure: nextMeasuredData, - resizeDirection: 'shrink' - }; - dataToMeasure = nextMeasuredData; + return selectors; + }; + var commandBarHeight = "44px"; + var sharedPaddingStyles = { + paddingLeft: "24px", + paddingRight: "24px" + }; + var getStyles$5 = function(props) { + var _a2, _b2, _c2, _d2; + var className2 = props.className, focusTrapZoneClassName = props.focusTrapZoneClassName, hasCloseButton = props.hasCloseButton, headerClassName = props.headerClassName, isAnimating = props.isAnimating, isFooterSticky = props.isFooterSticky, isFooterAtBottom = props.isFooterAtBottom, isOnRightSide = props.isOnRightSide, isOpen = props.isOpen, isHiddenOnDismiss = props.isHiddenOnDismiss, hasCustomNavigation = props.hasCustomNavigation, theme = props.theme, _e2 = props.type, type2 = _e2 === void 0 ? PanelType.smallFixedFar : _e2; + var effects = theme.effects, fonts = theme.fonts, semanticColors = theme.semanticColors; + var classNames2 = getGlobalClassNames(GlobalClassNames$3, theme); + var isCustomPanel = type2 === PanelType.custom || type2 === PanelType.customNear; + return { + root: [ + classNames2.root, + theme.fonts.medium, + isOpen && classNames2.isOpen, + hasCloseButton && classNames2.hasCloseButton, + { + pointerEvents: "none", + position: "absolute", + top: 0, + left: 0, + right: 0, + bottom: 0 + }, + isCustomPanel && isOnRightSide && classNames2.custom, + isCustomPanel && !isOnRightSide && classNames2.customNear, + className2 + ], + overlay: [ + { + pointerEvents: "auto", + cursor: "pointer" + }, + isOpen && isAnimating && AnimationClassNames.fadeIn100, + !isOpen && isAnimating && AnimationClassNames.fadeOut100 + ], + hiddenPanel: [ + !isOpen && !isAnimating && isHiddenOnDismiss && { + visibility: "hidden" + } + ], + main: [ + classNames2.main, + { + backgroundColor: semanticColors.bodyBackground, + boxShadow: effects.elevation64, + pointerEvents: "auto", + position: "absolute", + display: "flex", + flexDirection: "column", + overflowX: "hidden", + overflowY: "auto", + WebkitOverflowScrolling: "touch", + bottom: 0, + top: 0, + // left, right, width are overridden depending on the type of the Panel and the screen breakpoint. + left: panelMargin.auto, + right: panelMargin.none, + width: panelWidth.full, + selectors: __assign$1((_a2 = {}, _a2[HighContrastSelector] = { + borderLeft: "3px solid ".concat(semanticColors.variantBorder), + borderRight: "3px solid ".concat(semanticColors.variantBorder) + }, _a2), getPanelBreakpoints(type2)) + }, + type2 === PanelType.smallFluid && { + left: panelMargin.none + }, + type2 === PanelType.smallFixedNear && { + left: panelMargin.none, + right: panelMargin.auto, + width: panelWidth.xs + }, + type2 === PanelType.customNear && { + right: "auto", + left: 0 + }, + isCustomPanel && { + maxWidth: "100vw" + }, + isOpen && isAnimating && !isOnRightSide && AnimationClassNames.slideRightIn40, + isOpen && isAnimating && isOnRightSide && AnimationClassNames.slideLeftIn40, + !isOpen && isAnimating && !isOnRightSide && AnimationClassNames.slideLeftOut40, + !isOpen && isAnimating && isOnRightSide && AnimationClassNames.slideRightOut40, + focusTrapZoneClassName + ], + commands: [ + classNames2.commands, + { + // Ensures that the sticky header always has a background to prevent overlaps on scroll. + backgroundColor: semanticColors.bodyBackground, + paddingTop: 18, + selectors: (_b2 = {}, _b2["@media (min-height: ".concat(ScreenWidthMinMedium, "px)")] = { + position: "sticky", + top: 0, + zIndex: 1 + }, _b2) + }, + hasCustomNavigation && { + paddingTop: "inherit" } - return { - renderedData: dataToMeasure, - resizeDirection: undefined, - dataToMeasure: undefined - }; - } - /** - * This function should be called when the state changes in a manner that might allow for more content to fit - * on the screen, such as the window width/height growing. - * @param data - The initial data point to start measuring. - * @param onGrowData - Function that transforms the data into something that may take up more space when rendering. - * @param getElementToMeasureDimension - A function that returns the measurement of the rendered data. - * Only called when the measurement is not in the cache. - */ function _growDataUntilItDoesNotFit(data, onGrowData, getElementToMeasureDimension, onReduceData) { - var dataToMeasure = data; - var measuredDimension = _getMeasuredDimension(data, getElementToMeasureDimension); - while(measuredDimension < _containerDimension){ - var nextMeasuredData = onGrowData(dataToMeasure); - // We don't want to get stuck in an infinite render loop when there are no more - // scaling steps, so implementations of onGrowData should return undefined when - // there are no more scaling states to apply. - if (nextMeasuredData === undefined) return { - renderedData: dataToMeasure, - resizeDirection: undefined, - dataToMeasure: undefined - }; - measuredDimension = _measurementCache.getCachedMeasurement(nextMeasuredData); - // If the measurement isn't in the cache, we need to re-render with some data in a hidden div - if (measuredDimension === undefined) return { - dataToMeasure: nextMeasuredData - }; - dataToMeasure = nextMeasuredData; + ], + navigation: [ + classNames2.navigation, + { + display: "flex", + justifyContent: "flex-end" + }, + hasCustomNavigation && { + height: commandBarHeight + } + ], + contentInner: [ + classNames2.contentInner, + { + display: "flex", + flexDirection: "column", + flexGrow: 1, + overflowY: "hidden" + } + ], + header: [ + classNames2.header, + sharedPaddingStyles, + { + alignSelf: "flex-start" + }, + hasCloseButton && !hasCustomNavigation && { + flexGrow: 1 + }, + hasCustomNavigation && { + // Ensure that title doesn't shrink if screen is too small + flexShrink: 0 + } + ], + headerText: [ + classNames2.headerText, + fonts.xLarge, + { + color: semanticColors.bodyText, + lineHeight: "27px", + overflowWrap: "break-word", + wordWrap: "break-word", + wordBreak: "break-word", + hyphens: "auto" + }, + headerClassName + ], + scrollableContent: [ + classNames2.scrollableContent, + { + overflowY: "auto" + }, + isFooterAtBottom && { + flexGrow: 1, + display: "inherit", + flexDirection: "inherit" } - // Once the loop is done, we should now shrink until the contents fit. - return (0, _tslib.__assign)({ - resizeDirection: 'shrink' - }, _shrinkContentsUntilTheyFit(dataToMeasure, onReduceData, getElementToMeasureDimension)); - } - /** - * Handles an update to the container width/height. - * Should only be called when we knew the previous container width/height. - * @param newDimension - The new width/height of the container. - * @param fullDimensionData - The initial data passed in as a prop to resizeGroup. - * @param renderedData - The data that was rendered prior to the container size changing. - * @param onGrowData - Set to true if the Resize group has an onGrowData function. - */ function _updateContainerDimension(newDimension, fullDimensionData, renderedData, onGrowData) { - var nextState; - if (newDimension > _containerDimension) { - if (onGrowData) nextState = { - resizeDirection: 'grow', - dataToMeasure: onGrowData(renderedData) - }; - else nextState = { - resizeDirection: 'shrink', - dataToMeasure: fullDimensionData - }; - } else nextState = { - resizeDirection: 'shrink', - dataToMeasure: renderedData - }; - _containerDimension = newDimension; - return (0, _tslib.__assign)((0, _tslib.__assign)({}, nextState), { - measureContainer: false - }); - } - function getNextState(props, currentState, getElementToMeasureDimension, newContainerDimension) { - // If there is no new container width/height or data to measure, there is no need for a new state update - if (newContainerDimension === undefined && currentState.dataToMeasure === undefined) return undefined; - if (newContainerDimension) { - // If we know the last container size and we rendered data at that width/height, we can do an optimized render - if (_containerDimension && currentState.renderedData && !currentState.dataToMeasure) return (0, _tslib.__assign)((0, _tslib.__assign)({}, currentState), _updateContainerDimension(newContainerDimension, props.data, currentState.renderedData, props.onGrowData)); - // If we are just setting the container width/height for the first time, we can't do any optimizations - _containerDimension = newContainerDimension; - } - var nextState = (0, _tslib.__assign)((0, _tslib.__assign)({}, currentState), { - measureContainer: false - }); - if (currentState.dataToMeasure) { - if (currentState.resizeDirection === 'grow' && props.onGrowData) nextState = (0, _tslib.__assign)((0, _tslib.__assign)({}, nextState), _growDataUntilItDoesNotFit(currentState.dataToMeasure, props.onGrowData, getElementToMeasureDimension, props.onReduceData)); - else nextState = (0, _tslib.__assign)((0, _tslib.__assign)({}, nextState), _shrinkContentsUntilTheyFit(currentState.dataToMeasure, props.onReduceData, getElementToMeasureDimension)); + ], + content: [ + classNames2.content, + sharedPaddingStyles, + { + paddingBottom: 20 + }, + isFooterAtBottom && { + selectors: (_c2 = {}, _c2["@media (min-height: ".concat(ScreenWidthMinMedium, "px)")] = { + flexGrow: 1 + }, _c2) } - return nextState; - } - /** Function that determines if we need to render content for measurement based on the measurement cache contents. */ function shouldRenderDataForMeasurement(dataToMeasure) { - if (!dataToMeasure || _measurementCache.getCachedMeasurement(dataToMeasure) !== undefined) return false; - return true; - } - function getInitialResizeGroupState(data) { - return { - dataToMeasure: (0, _tslib.__assign)({}, data), - resizeDirection: 'grow', - measureContainer: true - }; - } - return { - getNextState: getNextState, - shouldRenderDataForMeasurement: shouldRenderDataForMeasurement, - getInitialResizeGroupState: getInitialResizeGroupState - }; -}; -var MeasuredContext = _react.createContext({ - isMeasured: false -}); -// Styles for the hidden div used for measurement -var hiddenDivStyles = { - position: 'fixed', - visibility: 'hidden' -}; -var hiddenParentStyles = { - position: 'relative' -}; -var COMPONENT_NAME = 'ResizeGroup'; -/** - * Use useReducer instead of userState because React is not batching the state updates - * when state is set in callbacks of setTimeout or requestAnimationFrame. - * See issue: https://github.com/facebook/react/issues/14259 - */ function resizeDataReducer(state, action) { - var _a; - switch(action.type){ - case 'resizeData': - return (0, _tslib.__assign)({}, action.value); - case 'dataToMeasure': - return (0, _tslib.__assign)((0, _tslib.__assign)({}, state), { - dataToMeasure: action.value, - resizeDirection: 'grow', - measureContainer: true - }); - default: - return (0, _tslib.__assign)((0, _tslib.__assign)({}, state), (_a = {}, _a[action.type] = action.value, _a)); + ], + footer: [ + classNames2.footer, + { + // Ensure that footer doesn't shrink if screen is too small + flexShrink: 0, + borderTop: "1px solid transparent", + transition: "opacity ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction2), + selectors: (_d2 = {}, _d2["@media (min-height: ".concat(ScreenWidthMinMedium, "px)")] = { + position: "sticky", + bottom: 0 + }, _d2) + }, + isFooterSticky && { + backgroundColor: semanticColors.bodyBackground, + borderTopColor: semanticColors.variantBorder + } + ], + footerInner: [ + classNames2.footerInner, + sharedPaddingStyles, + { + paddingBottom: 16, + paddingTop: 16 + } + ], + subComponentStyles: { + closeButton: { + root: [ + classNames2.closeButton, + { + marginRight: 14, + color: theme.palette.neutralSecondary, + fontSize: IconFontSizes.large + }, + hasCustomNavigation && { + marginRight: 0, + height: "auto", + width: "44px" + } + ], + rootHovered: { + color: theme.palette.neutralPrimary + } + } + } + }; + }; + var Panel = styled(PanelBase, getStyles$5, void 0, { + scope: "Panel" + }); + var getClassNames$4 = classNamesFunction(); + var DEFAULT_PROPS = { + options: [] + }; + function useSelectedItemsState(_a2) { + var defaultSelectedKeys = _a2.defaultSelectedKeys, selectedKeys = _a2.selectedKeys, defaultSelectedKey = _a2.defaultSelectedKey, selectedKey = _a2.selectedKey, options2 = _a2.options, multiSelect = _a2.multiSelect; + var oldOptions = usePrevious(options2); + var _b2 = React__namespace.useState([]), selectedIndices = _b2[0], setSelectedIndices = _b2[1]; + var selectedKeyPropToUse; + var didOptionsChange = options2 !== oldOptions; + if (multiSelect) { + if (didOptionsChange && defaultSelectedKeys !== void 0) { + selectedKeyPropToUse = defaultSelectedKeys; + } else { + selectedKeyPropToUse = selectedKeys; + } + } else { + if (didOptionsChange && defaultSelectedKey !== void 0) { + selectedKeyPropToUse = defaultSelectedKey; + } else { + selectedKeyPropToUse = selectedKey; + } } -} -function useResizeState(props, nextResizeGroupStateProvider, rootRef) { - var initialStateData = (0, _reactHooks.useConst)(function() { - return nextResizeGroupStateProvider.getInitialResizeGroupState(props.data); - }); - var _a = _react.useReducer(resizeDataReducer, initialStateData), resizeData = _a[0], dispatchResizeDataAction = _a[1]; - // Reset state when new data is provided - _react.useEffect(function() { - dispatchResizeDataAction({ - type: 'dataToMeasure', - value: props.data - }); - }, [ - props.data - ]); - // Because it's possible that we may force more than one re-render per animation frame, we - // want to make sure that the RAF request is using the most recent data. - var stateRef = _react.useRef(initialStateData); - stateRef.current = (0, _tslib.__assign)({}, resizeData); - var updateResizeState = _react.useCallback(function(nextState) { - if (nextState) dispatchResizeDataAction({ - type: 'resizeData', - value: nextState + var oldSelectedKeyProp = usePrevious(selectedKeyPropToUse); + React__namespace.useEffect(function() { + var getSelectedIndexes = function() { + if (selectedKeyPropToUse === void 0) { + if (multiSelect) { + return getAllSelectedIndices(); + } + var selectedIndex = getSelectedIndex(null); + return selectedIndex !== -1 ? [selectedIndex] : []; + } else if (!Array.isArray(selectedKeyPropToUse)) { + var selectedIndex = getSelectedIndex(selectedKeyPropToUse); + return selectedIndex !== -1 ? [selectedIndex] : []; + } + var returnValue = []; + for (var _i = 0, selectedKeyPropToUse_1 = selectedKeyPropToUse; _i < selectedKeyPropToUse_1.length; _i++) { + var key2 = selectedKeyPropToUse_1[_i]; + var selectedIndex = getSelectedIndex(key2); + selectedIndex !== -1 && returnValue.push(selectedIndex); + } + return returnValue; + }; + var getAllSelectedIndices = function() { + return options2.map(function(option, index2) { + return option.selected ? index2 : -1; + }).filter(function(index2) { + return index2 !== -1; }); - }, []); - var remeasure = _react.useCallback(function() { - if (rootRef.current) dispatchResizeDataAction({ - type: 'measureContainer', - value: true + }; + var getSelectedIndex = function(searchKey) { + return findIndex(options2, function(option) { + if (searchKey != null) { + return option.key === searchKey; + } else { + return !!option.selected || !!option.isSelected; + } }); - }, [ - rootRef - ]); - return [ - stateRef, - updateResizeState, - remeasure - ]; -} -function useResizingBehavior(props, rootRef) { - var nextResizeGroupStateProvider = (0, _reactHooks.useConst)(getNextResizeGroupStateProvider); - // A div that can be used for the initial measurement so that we can avoid mounting a second instance - // of the component being measured for the initial render. - var initialHiddenDiv = _react.useRef(null); - // A hidden div that is used for mounting a new instance of the component for measurement in a hidden - // div without unmounting the currently visible content. - var updateHiddenDiv = _react.useRef(null); - // Tracks if any content has been rendered to the user. This enables us to do some performance optimizations - // for the initial render. - var hasRenderedContent = _react.useRef(false); - var async = (0, _reactHooks.useAsync)(); - var _a = useResizeState(props, nextResizeGroupStateProvider, rootRef), stateRef = _a[0], updateResizeState = _a[1], remeasure = _a[2]; - _react.useEffect(function() { - var _a; - if (stateRef.current.renderedData) { - hasRenderedContent.current = true; - (_a = props.dataDidRender) === null || _a === void 0 || _a.call(props, stateRef.current.renderedData); - } - }); - _react.useEffect(function() { - async.requestAnimationFrame(function() { - var containerDimension = undefined; - if (stateRef.current.measureContainer && rootRef.current) { - var boundingRect = rootRef.current.getBoundingClientRect(); - containerDimension = props.direction === (0, _resizeGroupTypes.ResizeGroupDirection).vertical ? boundingRect.height : boundingRect.width; + }; + if ((selectedKeyPropToUse !== void 0 || !oldOptions) && (selectedKeyPropToUse !== oldSelectedKeyProp || didOptionsChange)) { + setSelectedIndices(getSelectedIndexes()); + } + }, [didOptionsChange, multiSelect, oldOptions, oldSelectedKeyProp, options2, selectedKeyPropToUse]); + return [selectedIndices, setSelectedIndices]; + } + var DropdownBase = React__namespace.forwardRef(function(propsWithoutDefaults, forwardedRef) { + var props = getPropsWithDefaults(DEFAULT_PROPS, propsWithoutDefaults); + var rootRef = React__namespace.useRef(null); + var mergedRootRef = useMergedRefs(forwardedRef, rootRef); + var responsiveMode = useResponsiveMode(rootRef, props.responsiveMode); + var _a2 = useSelectedItemsState(props), selectedIndices = _a2[0], setSelectedIndices = _a2[1]; + return React__namespace.createElement(DropdownInternal, __assign$1({}, props, { responsiveMode, hoisted: { rootRef: mergedRootRef, selectedIndices, setSelectedIndices } })); + }); + DropdownBase.displayName = "DropdownBase"; + var DropdownInternal = ( + /** @class */ + (function(_super) { + __extends(DropdownInternal2, _super); + function DropdownInternal2(props) { + var _this = _super.call(this, props) || this; + _this._host = React__namespace.createRef(); + _this._focusZone = React__namespace.createRef(); + _this._dropDown = React__namespace.createRef(); + _this._scrollIdleDelay = 250; + _this._sizePosCache = new DropdownSizePosCache(); + _this._requestAnimationFrame = safeRequestAnimationFrame(_this); + _this.dismissMenu = function() { + var isOpen = _this.state.isOpen; + isOpen && _this.setState({ isOpen: false }); + }; + _this._onChange = function(event2, options22, index2, checked, multiSelect2) { + var _a2 = _this.props, onChange = _a2.onChange, onChanged = _a2.onChanged; + if (onChange || onChanged) { + var changedOpt = multiSelect2 ? __assign$1(__assign$1({}, options22[index2]), { selected: !checked }) : options22[index2]; + onChange && onChange(__assign$1(__assign$1({}, event2), { target: _this._dropDown.current }), changedOpt, index2); + onChanged && onChanged(changedOpt, index2); + } + }; + _this._getPlaceholder = function() { + return _this.props.placeholder || _this.props.placeHolder; + }; + _this._getTitle = function(items, _unused) { + var _a2 = _this.props.multiSelectDelimiter, multiSelectDelimiter = _a2 === void 0 ? ", " : _a2; + return items.map(function(i) { + return i.text; + }).join(multiSelectDelimiter); + }; + _this._onRenderTitle = function(items) { + return React__namespace.createElement(React__namespace.Fragment, null, _this._getTitle(items)); + }; + _this._onRenderPlaceholder = function(props2) { + if (!_this._getPlaceholder()) { + return null; + } + return React__namespace.createElement(React__namespace.Fragment, null, _this._getPlaceholder()); + }; + _this._onRenderContainer = function(props2) { + var calloutProps = props2.calloutProps, panelProps = props2.panelProps; + var _a2 = _this.props, responsiveMode = _a2.responsiveMode, dropdownWidth2 = _a2.dropdownWidth; + var isSmall = responsiveMode <= ResponsiveMode.medium; + var focusTrapZoneProps = { firstFocusableTarget: "#".concat(_this._listId, "1") }; + var panelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.panel : void 0; + var calloutWidth = void 0; + var calloutMinWidth = void 0; + if (dropdownWidth2 === "auto") { + calloutMinWidth = _this._dropDown.current ? _this._dropDown.current.clientWidth : 0; + } else { + calloutWidth = dropdownWidth2 || (_this._dropDown.current ? _this._dropDown.current.clientWidth : 0); + } + return isSmall ? React__namespace.createElement(Panel, __assign$1({ closeButtonAriaLabel: "Close", focusTrapZoneProps, hasCloseButton: true, isOpen: true, isLightDismiss: true, onDismiss: _this._onDismiss, styles: panelStyles }, panelProps), _this._renderFocusableList(props2)) : React__namespace.createElement(Callout, __assign$1({ isBeakVisible: false, gapSpace: 0, doNotLayer: false, directionalHintFixed: false, directionalHint: DirectionalHint.bottomLeftEdge, calloutWidth, calloutMinWidth }, calloutProps, { className: _this._classNames.callout, target: _this._dropDown.current, onDismiss: _this._onDismiss, onScroll: _this._onScroll, onPositioned: _this._onPositioned }), _this._renderFocusableList(props2)); + }; + _this._onRenderCaretDown = function(props2) { + return React__namespace.createElement(Icon, { className: _this._classNames.caretDown, iconName: "ChevronDown", "aria-hidden": true }); + }; + _this._onRenderList = function(props2) { + var _a2 = props2.onRenderItem, onRenderItem = _a2 === void 0 ? _this._onRenderItem : _a2; + var queue = { items: [] }; + var renderedList = []; + var emptyQueue = function() { + var newGroup = queue.id ? [ + React__namespace.createElement("div", { role: "group", key: queue.id, "aria-labelledby": queue.id }, queue.items) + ] : queue.items; + renderedList = __spreadArray(__spreadArray([], renderedList, true), newGroup, true); + queue = { items: [] }; + }; + var placeRenderedOptionIntoQueue = function(item, index2) { + switch (item.itemType) { + case SelectableOptionMenuItemType.Header: + queue.items.length > 0 && emptyQueue(); + var id2 = _this._id + item.key; + queue.items.push(onRenderItem(__assign$1(__assign$1({ id: id2 }, item), { index: index2 }), _this._onRenderItem)); + queue.id = id2; + break; + case SelectableOptionMenuItemType.Divider: + index2 > 0 && queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); + queue.items.length > 0 && emptyQueue(); + break; + default: + queue.items.push(onRenderItem(__assign$1(__assign$1({}, item), { index: index2 }), _this._onRenderItem)); } - var nextState = nextResizeGroupStateProvider.getNextState(props, stateRef.current, function() { - var refToMeasure = !hasRenderedContent.current ? initialHiddenDiv : updateHiddenDiv; - if (!refToMeasure.current) return 0; - var measuredBoundingRect = refToMeasure.current.getBoundingClientRect(); - return props.direction === (0, _resizeGroupTypes.ResizeGroupDirection).vertical ? measuredBoundingRect.height : measuredBoundingRect.width; - }, containerDimension); - updateResizeState(nextState); - }, rootRef.current); - }); - var win = (0, _windowProvider.useWindow)(); - (0, _reactHooks.useOnEvent)(win, 'resize', async.debounce(remeasure, RESIZE_DELAY, { - leading: true - })); - var dataNeedsMeasuring = nextResizeGroupStateProvider.shouldRenderDataForMeasurement(stateRef.current.dataToMeasure); - var isInitialMeasure = !hasRenderedContent.current && dataNeedsMeasuring; - return [ - stateRef.current.dataToMeasure, - stateRef.current.renderedData, - remeasure, - initialHiddenDiv, - updateHiddenDiv, - dataNeedsMeasuring, - isInitialMeasure - ]; -} -function useDebugWarnings(props) {} -var measuredContextValue = { - isMeasured: true -}; -var ResizeGroupBase = _react.forwardRef(function(props, forwardedRef) { - var rootRef = _react.useRef(null); - // The root div which is the container inside of which we are trying to fit content. - var mergedRootRef = (0, _reactHooks.useMergedRefs)(rootRef, forwardedRef); - var _a = useResizingBehavior(props, rootRef), dataToMeasure = _a[0], renderedData = _a[1], remeasure = _a[2], initialHiddenDiv = _a[3], updateHiddenDiv = _a[4], dataNeedsMeasuring = _a[5], isInitialMeasure = _a[6]; - _react.useImperativeHandle(props.componentRef, function() { - return { - remeasure: remeasure + }; + props2.options.forEach(function(item, index2) { + placeRenderedOptionIntoQueue(item, index2); + }); + queue.items.length > 0 && emptyQueue(); + return React__namespace.createElement(React__namespace.Fragment, null, renderedList); }; - }, [ - remeasure - ]); - useDebugWarnings(props); - var className = props.className, onRenderData = props.onRenderData; - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties), [ - 'data' - ]); - // We only ever render the final content to the user. All measurements are done in a hidden div. - // For the initial render, we want this to be as fast as possible, so we need to make sure that we only mount one - // version of the component for measurement and the final render. For renders that update what is on screen, we - // want to make sure that there are no jarring effects such as the screen flashing as we apply scaling steps for - // measurement. In the update case, we mount a second version of the component just for measurement purposes and - // leave the rendered content untouched until we know the next state to show to the user. - return _react.createElement("div", (0, _tslib.__assign)({}, divProps, { - className: className, - ref: mergedRootRef - }), _react.createElement("div", { - style: hiddenParentStyles - }, dataNeedsMeasuring && !isInitialMeasure && _react.createElement("div", { - style: hiddenDivStyles, - ref: updateHiddenDiv - }, _react.createElement(MeasuredContext.Provider, { - value: measuredContextValue - }, onRenderData(dataToMeasure))), _react.createElement("div", { - ref: initialHiddenDiv, - style: isInitialMeasure ? hiddenDivStyles : undefined, - "data-automation-id": "visibleContent" - }, isInitialMeasure ? onRenderData(dataToMeasure) : renderedData && onRenderData(renderedData)))); -}); -ResizeGroupBase.displayName = 'ResizeGroupBase'; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./ResizeGroup.types":"d6k9Y","@fluentui/react-hooks":"2LHjM","../../WindowProvider":"diLL7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d6k9Y":[function(require,module,exports,__globalThis) { -/** - * {@docCategory ResizeGroup} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ResizeGroupDirection", ()=>ResizeGroupDirection); -var ResizeGroupDirection; -(function(ResizeGroupDirection) { - ResizeGroupDirection[ResizeGroupDirection["horizontal"] = 0] = "horizontal"; - ResizeGroupDirection[ResizeGroupDirection["vertical"] = 1] = "vertical"; -})(ResizeGroupDirection || (ResizeGroupDirection = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dAQ01":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Tooltip/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Tooltip/index":"j3rRm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j3rRm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _tooltip = require("./Tooltip"); -parcelHelpers.exportAll(_tooltip, exports); -var _tooltipBase = require("./Tooltip.base"); -parcelHelpers.exportAll(_tooltipBase, exports); -var _tooltipTypes = require("./Tooltip.types"); -parcelHelpers.exportAll(_tooltipTypes, exports); -var _tooltipHost = require("./TooltipHost"); -parcelHelpers.exportAll(_tooltipHost, exports); -var _tooltipHostBase = require("./TooltipHost.base"); -parcelHelpers.exportAll(_tooltipHostBase, exports); -var _tooltipHostTypes = require("./TooltipHost.types"); -parcelHelpers.exportAll(_tooltipHostTypes, exports); - -},{"./Tooltip":false,"./Tooltip.base":false,"./Tooltip.types":false,"./TooltipHost":"dBgGB","./TooltipHost.base":false,"./TooltipHost.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1tZCB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Tooltip", ()=>Tooltip); -var _utilities = require("../../Utilities"); -var _tooltipBase = require("./Tooltip.base"); -var _tooltipStyles = require("./Tooltip.styles"); -var Tooltip = (0, _utilities.styled)((0, _tooltipBase.TooltipBase), (0, _tooltipStyles.getStyles), undefined, { - scope: 'Tooltip' -}); - -},{"../../Utilities":"1NZCy","./Tooltip.base":"1Jq1Y","./Tooltip.styles":"3dBwO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Jq1Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipBase", ()=>TooltipBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _callout = require("../../Callout"); -var _directionalHint = require("../../common/DirectionalHint"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var TooltipBase = /** @class */ function(_super) { - (0, _tslib.__extends)(TooltipBase, _super); - function TooltipBase() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this._onRenderContent = function(props) { - if (typeof props.content === 'string') return _react.createElement("p", { - className: _this._classNames.subText - }, props.content); - else return _react.createElement("div", { - className: _this._classNames.subText - }, props.content); + _this._onRenderItem = function(item) { + switch (item.itemType) { + case SelectableOptionMenuItemType.Divider: + return _this._renderSeparator(item); + case SelectableOptionMenuItemType.Header: + return _this._renderHeader(item); + default: + return _this._renderOption(item); + } }; - return _this; - } - TooltipBase.prototype.render = function() { - var _a = this.props, className = _a.className, calloutProps = _a.calloutProps, directionalHint = _a.directionalHint, directionalHintForRTL = _a.directionalHintForRTL, styles = _a.styles, id = _a.id, maxWidth = _a.maxWidth, _b = _a.onRenderContent, onRenderContent = _b === void 0 ? this._onRenderContent : _b, targetElement = _a.targetElement, theme = _a.theme; - this._classNames = getClassNames(styles, { - theme: theme, - className: className || calloutProps && calloutProps.className, - beakWidth: calloutProps && calloutProps.isBeakVisible ? calloutProps.beakWidth : 0, - gapSpace: calloutProps && calloutProps.gapSpace, - maxWidth: maxWidth - }); - return _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - target: targetElement, - directionalHint: directionalHint, - directionalHintForRTL: directionalHintForRTL - }, calloutProps, (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'id' - ]), { - className: this._classNames.root - }), _react.createElement("div", { - className: this._classNames.content, - id: id, - onFocus: this.props.onFocus, - onMouseEnter: this.props.onMouseEnter, - onMouseLeave: this.props.onMouseLeave - }, onRenderContent(this.props, this._onRenderContent))); - }; - // Specify default props values - TooltipBase.defaultProps = { - directionalHint: (0, _directionalHint.DirectionalHint).topCenter, - maxWidth: '364px', - calloutProps: { - isBeakVisible: true, - beakWidth: 16, - gapSpace: 0, - setInitialFocus: true, - doNotLayer: false - } - }; - return TooltipBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Callout":"g2jXk","../../common/DirectionalHint":"avdAc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3dBwO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var getStyles = function(props) { - var className = props.className, _a = props.beakWidth, beakWidth = _a === void 0 ? 16 : _a, _b = props.gapSpace, gapSpace = _b === void 0 ? 0 : _b, maxWidth = props.maxWidth, theme = props.theme; - var semanticColors = theme.semanticColors, fonts = theme.fonts, effects = theme.effects; - // The math here is done to account for the 45 degree rotation of the beak - // and sub-pixel rounding that differs across browsers, which is more noticeable when - // the device pixel ratio is larger - var tooltipGapSpace = -(Math.sqrt(beakWidth * beakWidth / 2) + gapSpace) + 1 / // There isn't really a great way to pass in a `window` reference here so disabling the line rule - // eslint-disable-next-line no-restricted-globals - window.devicePixelRatio; - return { - root: [ - 'ms-Tooltip', - theme.fonts.medium, - (0, _styling.AnimationClassNames).fadeIn200, - { - background: semanticColors.menuBackground, - boxShadow: effects.elevation8, - padding: '8px', - maxWidth: maxWidth, - selectors: { - ':after': { - content: "''", - position: 'absolute', - bottom: tooltipGapSpace, - left: tooltipGapSpace, - right: tooltipGapSpace, - top: tooltipGapSpace, - zIndex: 0 - } + _this._renderOption = function(item) { + var _a2; + var _b2 = _this.props, _c2 = _b2.onRenderOption, onRenderOption = _c2 === void 0 ? _this._onRenderOption : _c2, _d2 = _b2.hoisted.selectedIndices, selectedIndices = _d2 === void 0 ? [] : _d2; + var isItemSelected = item.index !== void 0 && selectedIndices ? selectedIndices.indexOf(item.index) > -1 : false; + var itemClassName = item.hidden ? _this._classNames.dropdownItemHidden : isItemSelected && item.disabled === true ? _this._classNames.dropdownItemSelectedAndDisabled : isItemSelected ? _this._classNames.dropdownItemSelected : item.disabled === true ? _this._classNames.dropdownItemDisabled : _this._classNames.dropdownItem; + var title = item.title; + var id2 = _this._listId + item.index; + var labelId = (_a2 = item.id) !== null && _a2 !== void 0 ? _a2 : id2 + "-label"; + var multiSelectItemStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.multiSelectItem : void 0; + return !_this.props.multiSelect ? React__namespace.createElement(CommandButton, { + id: id2, + key: item.key, + "data-index": item.index, + "data-is-focusable": !item.disabled, + disabled: item.disabled, + className: itemClassName, + onClick: _this._onItemClick(item), + // eslint-disable-next-line react/jsx-no-bind + onMouseEnter: _this._onItemMouseEnter.bind(_this, item), + // eslint-disable-next-line react/jsx-no-bind + onMouseLeave: _this._onMouseItemLeave.bind(_this, item), + // eslint-disable-next-line react/jsx-no-bind + onMouseMove: _this._onItemMouseMove.bind(_this, item), + role: "option", + "aria-selected": isItemSelected ? "true" : "false", + ariaLabel: item.ariaLabel, + title, + "aria-posinset": _this._sizePosCache.positionInSet(item.index), + "aria-setsize": _this._sizePosCache.optionSetSize + }, onRenderOption(item, _this._onRenderOption)) : React__namespace.createElement(Checkbox, { + id: id2, + key: item.key, + disabled: item.disabled, + onChange: _this._onItemClick(item), + inputProps: __assign$1({ "aria-selected": isItemSelected, onMouseEnter: _this._onItemMouseEnter.bind(_this, item), onMouseLeave: _this._onMouseItemLeave.bind(_this, item), onMouseMove: _this._onItemMouseMove.bind(_this, item), role: "option" }, { + "data-index": item.index, + "data-is-focusable": !(item.disabled || item.hidden) + }), + label: item.text, + title, + // eslint-disable-next-line react/jsx-no-bind + onRenderLabel: _this._onRenderItemLabel.bind(_this, __assign$1(__assign$1({}, item), { id: labelId })), + className: css(itemClassName, "is-multi-select"), + checked: isItemSelected, + styles: multiSelectItemStyles, + ariaPositionInSet: !item.hidden ? _this._sizePosCache.positionInSet(item.index) : void 0, + ariaSetSize: !item.hidden ? _this._sizePosCache.optionSetSize : void 0, + ariaLabel: item.ariaLabel, + ariaLabelledBy: item.ariaLabel ? void 0 : labelId + }); + }; + _this._onRenderOption = function(item) { + return React__namespace.createElement("span", { className: _this._classNames.dropdownOptionText }, item.text); + }; + _this._onRenderMultiselectOption = function(item) { + return React__namespace.createElement("span", { id: item.id, "aria-hidden": "true", className: _this._classNames.dropdownOptionText }, item.text); + }; + _this._onRenderItemLabel = function(item) { + var _a2 = _this.props.onRenderOption, onRenderOption = _a2 === void 0 ? _this._onRenderMultiselectOption : _a2; + return onRenderOption(item, _this._onRenderMultiselectOption); + }; + _this._onPositioned = function(positions2) { + if (_this._focusZone.current) { + _this._requestAnimationFrame(function() { + var selectedIndices = _this.props.hoisted.selectedIndices; + if (_this._focusZone.current) { + if (!_this._hasBeenPositioned && selectedIndices && selectedIndices[0] && !_this.props.options[selectedIndices[0]].disabled) { + var element2 = getDocument().getElementById("".concat(_this._id, "-list").concat(selectedIndices[0])); + if (element2) { + _this._focusZone.current.focusElement(element2); + } + _this._hasBeenPositioned = true; + } else { + _this._focusZone.current.focus(); } - }, - className - ], - content: [ - 'ms-Tooltip-content', - fonts.small, - { - position: 'relative', - zIndex: 1, - color: semanticColors.menuItemText, - wordWrap: 'break-word', - overflowWrap: 'break-word', - overflow: 'hidden' - } - ], - subText: [ - 'ms-Tooltip-subtext', - { - // Using inherit here to avoid unintentional global overrides of the <p> tag. - fontSize: 'inherit', - fontWeight: 'inherit', - color: 'inherit', - margin: 0 - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cki5b":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Tooltip} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipDelay", ()=>TooltipDelay); -var TooltipDelay; -(function(TooltipDelay) { - TooltipDelay[TooltipDelay["zero"] = 0] = "zero"; - /** 300 ms delay before showing the tooltip */ TooltipDelay[TooltipDelay["medium"] = 1] = "medium"; - /** 500 ms delay before showing the tooltip */ TooltipDelay[TooltipDelay["long"] = 2] = "long"; -})(TooltipDelay || (TooltipDelay = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dBgGB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipHost", ()=>TooltipHost); -var _utilities = require("../../Utilities"); -var _tooltipHostBase = require("./TooltipHost.base"); -var _tooltipHostStyles = require("./TooltipHost.styles"); -var TooltipHost = (0, _utilities.styled)((0, _tooltipHostBase.TooltipHostBase), (0, _tooltipHostStyles.getStyles), undefined, { - scope: 'TooltipHost' -}); - -},{"../../Utilities":"1NZCy","./TooltipHost.base":"9YH1k","./TooltipHost.styles":"et1eN","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9YH1k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipHostBase", ()=>TooltipHostBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var _tooltipHostTypes = require("./TooltipHost.types"); -var _tooltip = require("./Tooltip"); -var _tooltipTypes = require("./Tooltip.types"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var TooltipHostBase = /** @class */ function(_super) { - (0, _tslib.__extends)(TooltipHostBase, _super); - // Constructor - function TooltipHostBase(props) { - var _this = _super.call(this, props) || this; - // The wrapping div that gets the hover events - _this._tooltipHost = _react.createRef(); - _this._defaultTooltipId = (0, _utilities.getId)('tooltip'); - _this.show = function() { - _this._toggleTooltip(true); - }; - _this.dismiss = function() { - _this._hideTooltip(); + } + }); + } + if (!_this.state.calloutRenderEdge || _this.state.calloutRenderEdge !== positions2.targetEdge) { + _this.setState({ + calloutRenderEdge: positions2.targetEdge + }); + } }; - _this._getTargetElement = function() { - if (!_this._tooltipHost.current) return undefined; - var overflowMode = _this.props.overflowMode; - // Select target element based on overflow mode. For parent mode, you want to position the tooltip relative - // to the parent element, otherwise it might look off. - if (overflowMode !== undefined) switch(overflowMode){ - case (0, _tooltipHostTypes.TooltipOverflowMode).Parent: - return _this._tooltipHost.current.parentElement; - case (0, _tooltipHostTypes.TooltipOverflowMode).Self: - return _this._tooltipHost.current; - } - return _this._tooltipHost.current; + _this._onItemClick = function(item) { + return function(event2) { + if (!item.disabled) { + _this.setSelectedIndex(event2, item.index); + if (!_this.props.multiSelect) { + _this.setState({ + isOpen: false + }); + } + } + }; + }; + _this._onScroll = function() { + var win = getWindowEx(_this.context); + if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== void 0) { + win.clearTimeout(_this._scrollIdleTimeoutId); + _this._scrollIdleTimeoutId = void 0; + } else { + _this._isScrollIdle = false; + } + _this._scrollIdleTimeoutId = win.setTimeout(function() { + _this._isScrollIdle = true; + }, _this._scrollIdleDelay); }; - _this._onTooltipFocus = function(ev) { - if (_this._ignoreNextFocusEvent) { - _this._ignoreNextFocusEvent = false; - return; + _this._onMouseItemLeave = function(item, ev) { + if (_this._shouldIgnoreMouseEvent()) { + return; + } + if (_this._host.current) { + if (_this._host.current.setActive) { + try { + _this._host.current.setActive(); + } catch (e) { + } + } else { + _this._host.current.focus(); } - _this._onTooltipMouseEnter(ev); + } }; - _this._onTooltipContentFocus = function(ev) { - if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip !== _this) TooltipHostBase._currentVisibleTooltip.dismiss(); - TooltipHostBase._currentVisibleTooltip = _this; - _this._clearDismissTimer(); - _this._clearOpenTimer(); - }; - _this._onTooltipBlur = function(ev) { - var _a; - // The focused element gets a blur event when the document loses focus - // (e.g. switching tabs in the browser), but we don't want to show the - // tooltip again when the document gets focus back. Handle this case by - // checking if the blurred element is still the document's activeElement, - // and ignoring when it next gets focus back. - // See https://github.com/microsoft/fluentui/issues/13541 - _this._ignoreNextFocusEvent = ((_a = (0, _dom.getDocumentEx)(_this.context)) === null || _a === void 0 ? void 0 : _a.activeElement) === ev.target; - _this._dismissTimerId = _this._async.setTimeout(function() { - _this._hideTooltip(); - }, 0); + _this._onDismiss = function() { + _this.setState({ isOpen: false }); }; - // Show Tooltip - _this._onTooltipMouseEnter = function(ev) { - var _a = _this.props, overflowMode = _a.overflowMode, delay = _a.delay; - var doc = (0, _dom.getDocumentEx)(_this.context); - if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip !== _this) TooltipHostBase._currentVisibleTooltip.dismiss(); - TooltipHostBase._currentVisibleTooltip = _this; - if (overflowMode !== undefined) { - var overflowElement = _this._getTargetElement(); - if (overflowElement && !(0, _utilities.hasOverflow)(overflowElement)) return; - } - if (ev.target && (0, _utilities.portalContainsElement)(ev.target, _this._getTargetElement(), doc)) // Do not show tooltip when target is inside a portal relative to TooltipHost. + _this._onDropdownBlur = function(ev) { + var disabled = _this._isDisabled(); + if (disabled) { return; - _this._clearDismissTimer(); - _this._clearOpenTimer(); - if (delay !== (0, _tooltipTypes.TooltipDelay).zero) { - var delayTime = _this._getDelayTime(delay); // non-null assertion because we set it in `defaultProps` - _this._openTimerId = _this._async.setTimeout(function() { - _this._toggleTooltip(true); - }, delayTime); - } else _this._toggleTooltip(true); - }; - // Hide Tooltip - _this._onTooltipMouseLeave = function(ev) { - var closeDelay = _this.props.closeDelay; - _this._clearDismissTimer(); - _this._clearOpenTimer(); - if (closeDelay) _this._dismissTimerId = _this._async.setTimeout(function() { - _this._toggleTooltip(false); - }, closeDelay); - else _this._toggleTooltip(false); - if (TooltipHostBase._currentVisibleTooltip === _this) TooltipHostBase._currentVisibleTooltip = undefined; + } + if (_this.state.isOpen) { + return; + } + _this.setState({ hasFocus: false }); + if (_this.props.onBlur) { + _this.props.onBlur(ev); + } }; - _this._onTooltipKeyDown = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if ((ev.which === (0, _utilities.KeyCodes).escape || ev.ctrlKey) && _this.state.isTooltipVisible) { - _this._hideTooltip(); + _this._onDropdownKeyDown = function(ev) { + var disabled = _this._isDisabled(); + if (disabled) { + return; + } + _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); + if (_this.props.onKeyDown) { + _this.props.onKeyDown(ev); + if (ev.defaultPrevented) { + return; + } + } + var newIndex; + var selectedIndex = _this.props.hoisted.selectedIndices.length ? _this.props.hoisted.selectedIndices[0] : -1; + var containsExpandCollapseModifier = ev.altKey || ev.metaKey; + var isOpen = _this.state.isOpen; + switch (ev.which) { + case KeyCodes.enter: + _this.setState({ + isOpen: !isOpen + }); + break; + case KeyCodes.escape: + if (!isOpen) { + return; + } + _this.setState({ + isOpen: false + }); + break; + case KeyCodes.up: + if (containsExpandCollapseModifier) { + if (isOpen) { + _this.setState({ isOpen: false }); + break; + } + return; + } + if (_this.props.multiSelect) { + _this.setState({ isOpen: true }); + } else if (!_this._isDisabled()) { + newIndex = _this._moveIndex(ev, -1, selectedIndex - 1, selectedIndex); + } + break; + case KeyCodes.down: + if (containsExpandCollapseModifier) { ev.stopPropagation(); - } + ev.preventDefault(); + } + if (containsExpandCollapseModifier && !isOpen || _this.props.multiSelect) { + _this.setState({ isOpen: true }); + } else if (!_this._isDisabled()) { + newIndex = _this._moveIndex(ev, 1, selectedIndex + 1, selectedIndex); + } + break; + case KeyCodes.home: + if (!_this.props.multiSelect) { + newIndex = _this._moveIndex(ev, 1, 0, selectedIndex); + } + break; + case KeyCodes.end: + if (!_this.props.multiSelect) { + newIndex = _this._moveIndex(ev, -1, _this.props.options.length - 1, selectedIndex); + } + break; + case KeyCodes.space: + break; + default: + return; + } + if (newIndex !== selectedIndex) { + ev.stopPropagation(); + ev.preventDefault(); + } }; - _this._clearDismissTimer = function() { - _this._async.clearTimeout(_this._dismissTimerId); + _this._onDropdownKeyUp = function(ev) { + var disabled = _this._isDisabled(); + if (disabled) { + return; + } + var shouldHandleKey = _this._shouldHandleKeyUp(ev); + var isOpen = _this.state.isOpen; + if (_this.props.onKeyUp) { + _this.props.onKeyUp(ev); + if (ev.defaultPrevented) { + return; + } + } + switch (ev.which) { + case KeyCodes.space: + _this.setState({ + isOpen: !isOpen + }); + break; + default: + if (shouldHandleKey && isOpen) { + _this.setState({ isOpen: false }); + } + return; + } + ev.stopPropagation(); + ev.preventDefault(); }; - _this._clearOpenTimer = function() { - _this._async.clearTimeout(_this._openTimerId); + _this._onZoneKeyDown = function(ev) { + var _a2, _b2; + var elementToFocus; + _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); + var containsExpandCollapseModifier = ev.altKey || ev.metaKey; + switch (ev.which) { + case KeyCodes.up: + if (containsExpandCollapseModifier) { + _this.setState({ isOpen: false }); + } else { + if (_this._host.current) { + elementToFocus = getLastFocusable(_this._host.current, _this._host.current.lastChild, true); + } + } + break; + // All directional keystrokes should be canceled when the zone is rendered. + // This avoids the body scroll from reacting and thus dismissing the dropdown. + case KeyCodes.home: + case KeyCodes.end: + case KeyCodes.pageUp: + case KeyCodes.pageDown: + break; + case KeyCodes.down: + if (!containsExpandCollapseModifier && _this._host.current) { + elementToFocus = getFirstFocusable(_this._host.current, _this._host.current.firstChild, true); + } + break; + case KeyCodes.escape: + _this.setState({ isOpen: false }); + break; + case KeyCodes.tab: + _this.setState({ isOpen: false }); + var document_1 = getDocument(); + if (document_1) { + if (ev.shiftKey) { + (_a2 = getPreviousElement(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _a2 === void 0 ? void 0 : _a2.focus(); + } else { + (_b2 = getNextElement(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _b2 === void 0 ? void 0 : _b2.focus(); + } + } + break; + default: + return; + } + if (elementToFocus) { + elementToFocus.focus(); + } + ev.stopPropagation(); + ev.preventDefault(); }; - // Hide Tooltip - _this._hideTooltip = function() { - _this._clearOpenTimer(); - _this._clearDismissTimer(); - _this._toggleTooltip(false); + _this._onZoneKeyUp = function(ev) { + var shouldHandleKey = _this._shouldHandleKeyUp(ev); + if (shouldHandleKey && _this.state.isOpen) { + _this.setState({ isOpen: false }); + ev.preventDefault(); + } }; - _this._toggleTooltip = function(isTooltipVisible) { - if (_this.state.isTooltipVisible !== isTooltipVisible) _this.setState({ - isTooltipVisible: isTooltipVisible - }, function() { - return _this.props.onTooltipToggle && _this.props.onTooltipToggle(isTooltipVisible); + _this._onDropdownClick = function(ev) { + if (_this.props.onClick) { + _this.props.onClick(ev); + if (ev.defaultPrevented) { + return; + } + } + var isOpen = _this.state.isOpen; + var disabled = _this._isDisabled(); + if (!disabled && !_this._shouldOpenOnFocus()) { + _this.setState({ + isOpen: !isOpen }); + } + _this._isFocusedByClick = false; }; - _this._getDelayTime = function(delay) { - switch(delay){ - case (0, _tooltipTypes.TooltipDelay).medium: - return 300; - case (0, _tooltipTypes.TooltipDelay).long: - return 500; - default: - return 0; - } + _this._onDropdownMouseDown = function() { + _this._isFocusedByClick = true; }; - (0, _utilities.initializeComponentRef)(_this); + _this._onFocus = function(ev) { + var disabled = _this._isDisabled(); + if (!disabled) { + if (_this.props.onFocus) { + _this.props.onFocus(ev); + } + var state = { hasFocus: true }; + if (_this._shouldOpenOnFocus()) { + state.isOpen = true; + } + _this.setState(state); + } + }; + _this._isDisabled = function() { + var disabled = _this.props.disabled; + var isDisabled = _this.props.isDisabled; + if (disabled === void 0) { + disabled = isDisabled; + } + return disabled; + }; + _this._onRenderLabel = function(props2) { + var label2 = props2.label, required2 = props2.required, disabled = props2.disabled; + var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : void 0; + return label2 ? React__namespace.createElement(Label$2, { className: _this._classNames.label, id: _this._labelId, required: required2, styles: labelStyles, disabled }, label2) : null; + }; + initializeComponentRef(_this); + props.multiSelect; + props.selectedKey; + props.selectedKeys; + props.defaultSelectedKey; + props.defaultSelectedKeys; + var options2 = props.options; + _this._id = props.id || getId("Dropdown"); + _this._labelId = _this._id + "-label"; + _this._listId = _this._id + "-list"; + _this._optionId = _this._id + "-option"; + _this._isScrollIdle = true; + _this._hasBeenPositioned = false; + _this._sizePosCache.updateOptions(options2); _this.state = { - isAriaPlaceholderRendered: false, - isTooltipVisible: false + isOpen: false, + hasFocus: false, + calloutRenderEdge: void 0 }; return _this; - } - // Render - TooltipHostBase.prototype.render = function() { - var _a = this.props, calloutProps = _a.calloutProps, children = _a.children, content = _a.content, directionalHint = _a.directionalHint, directionalHintForRTL = _a.directionalHintForRTL, className = _a.hostClassName, id = _a.id, // eslint-disable-next-line deprecation/deprecation - _b = _a.setAriaDescribedBy, // eslint-disable-next-line deprecation/deprecation - setAriaDescribedBy = _b === void 0 ? true : _b, tooltipProps = _a.tooltipProps, styles = _a.styles, theme = _a.theme; - this._classNames = getClassNames(styles, { - theme: theme, - className: className + } + Object.defineProperty(DropdownInternal2.prototype, "selectedOptions", { + /** + * All selected options + */ + get: function() { + var _a2 = this.props, options2 = _a2.options, selectedIndices = _a2.hoisted.selectedIndices; + return getAllSelectedOptions(options2, selectedIndices); + }, + enumerable: false, + configurable: true + }); + DropdownInternal2.prototype.componentWillUnmount = function() { + clearTimeout(this._scrollIdleTimeoutId); + }; + DropdownInternal2.prototype.componentDidUpdate = function(prevProps, prevState) { + if (prevState.isOpen === true && this.state.isOpen === false) { + this._gotMouseMove = false; + this._hasBeenPositioned = false; + if (this.props.onDismiss) { + this.props.onDismiss(); + } + } + }; + DropdownInternal2.prototype.render = function() { + var id2 = this._id; + var props = this.props; + var className2 = props.className, label2 = props.label, options2 = props.options, ariaLabel2 = props.ariaLabel, required2 = props.required, errorMessage = props.errorMessage, propStyles = props.styles, theme = props.theme, panelProps = props.panelProps, calloutProps = props.calloutProps, _a2 = props.onRenderTitle, onRenderTitle = _a2 === void 0 ? this._getTitle : _a2, _b2 = props.onRenderContainer, onRenderContainer = _b2 === void 0 ? this._onRenderContainer : _b2, _c2 = props.onRenderCaretDown, onRenderCaretDown = _c2 === void 0 ? this._onRenderCaretDown : _c2, _d2 = props.onRenderLabel, onRenderLabel = _d2 === void 0 ? this._onRenderLabel : _d2, _e2 = props.onRenderItem, onRenderItem = _e2 === void 0 ? this._onRenderItem : _e2, selectedIndices = props.hoisted.selectedIndices, responsiveMode = props.responsiveMode; + var _f = this.state, isOpen = _f.isOpen, calloutRenderEdge = _f.calloutRenderEdge, hasFocus = _f.hasFocus; + var onRenderPlaceholder = props.onRenderPlaceholder || props.onRenderPlaceHolder || this._getPlaceholder; + if (options2 !== this._sizePosCache.cachedOptions) { + this._sizePosCache.updateOptions(options2); + } + var selectedOptions = getAllSelectedOptions(options2, selectedIndices); + var divProps = getNativeProps(props, divProperties); + var disabled = this._isDisabled(); + var isSmall = responsiveMode <= ResponsiveMode.medium; + var errorMessageId = id2 + "-errorMessage"; + this._classNames = getClassNames$4(propStyles, { + theme, + className: className2, + hasError: !!(errorMessage && errorMessage.length > 0), + hasLabel: !!label2, + isOpen, + required: required2, + disabled, + isRenderingPlaceholder: !selectedOptions.length, + panelClassName: panelProps ? panelProps.className : void 0, + calloutClassName: calloutProps ? calloutProps.className : void 0, + calloutRenderEdge }); - var isTooltipVisible = this.state.isTooltipVisible; - var tooltipId = id || this._defaultTooltipId; - var tooltipRenderProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - id: "".concat(tooltipId, "--tooltip"), - content: content, - targetElement: this._getTargetElement(), - directionalHint: directionalHint, - directionalHintForRTL: directionalHintForRTL, - calloutProps: (0, _utilities.assign)({}, calloutProps, { - onDismiss: this._hideTooltip, - onFocus: this._onTooltipContentFocus, - onMouseEnter: this._onTooltipMouseEnter, - onMouseLeave: this._onTooltipMouseLeave - }), - onMouseEnter: this._onTooltipMouseEnter, - onMouseLeave: this._onTooltipMouseLeave - }, (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'id' - ])), tooltipProps); - // Get the content of the tooltip for use in the hidden div used for screen readers - var tooltipContent = (tooltipProps === null || tooltipProps === void 0 ? void 0 : tooltipProps.onRenderContent) ? tooltipProps.onRenderContent(tooltipRenderProps, function(props) { - return (props === null || props === void 0 ? void 0 : props.content) ? _react.createElement(_react.Fragment, null, props.content) : null; - }) : content; - var showTooltip = isTooltipVisible && !!tooltipContent; - var ariaDescribedBy = setAriaDescribedBy && isTooltipVisible && !!tooltipContent ? tooltipId : undefined; - return _react.createElement("div", { - className: this._classNames.root, - ref: this._tooltipHost, - onFocusCapture: this._onTooltipFocus, - onBlurCapture: this._onTooltipBlur, - onMouseEnter: this._onTooltipMouseEnter, - onMouseLeave: this._onTooltipMouseLeave, - onKeyDown: this._onTooltipKeyDown, - role: "none", - "aria-describedby": ariaDescribedBy - }, children, showTooltip && _react.createElement((0, _tooltip.Tooltip), (0, _tslib.__assign)({}, tooltipRenderProps)), _react.createElement("div", { - hidden: true, - id: tooltipId, - style: (0, _styling.hiddenContentStyle) - }, tooltipContent)); - }; - TooltipHostBase.prototype.componentDidMount = function() { - this._async = new (0, _utilities.Async)(this); - }; - TooltipHostBase.prototype.componentWillUnmount = function() { - if (TooltipHostBase._currentVisibleTooltip && TooltipHostBase._currentVisibleTooltip === this) TooltipHostBase._currentVisibleTooltip = undefined; - this._async.dispose(); + var hasErrorMessage = !!errorMessage && errorMessage.length > 0; + return React__namespace.createElement( + "div", + { className: this._classNames.root, ref: this.props.hoisted.rootRef, "aria-owns": isOpen && !isSmall ? this._listId : void 0 }, + onRenderLabel(this.props, this._onRenderLabel), + React__namespace.createElement( + "div", + __assign$1({ "data-is-focusable": !disabled, "data-ktp-target": true, ref: this._dropDown, id: id2, tabIndex: disabled ? -1 : 0, role: "combobox", "aria-haspopup": "listbox", "aria-expanded": isOpen ? "true" : "false", "aria-label": ariaLabel2, "aria-labelledby": label2 && !ariaLabel2 ? mergeAriaAttributeValues(this._labelId, this._optionId) : void 0, "aria-describedby": hasErrorMessage ? this._id + "-errorMessage" : void 0, "aria-required": required2, "aria-disabled": disabled, "aria-invalid": hasErrorMessage, "aria-controls": isOpen && !isSmall ? this._listId : void 0 }, divProps, { className: this._classNames.dropdown, onBlur: this._onDropdownBlur, onKeyDown: this._onDropdownKeyDown, onKeyUp: this._onDropdownKeyUp, onClick: this._onDropdownClick, onMouseDown: this._onDropdownMouseDown, onFocus: this._onFocus }), + React__namespace.createElement( + "span", + { id: this._optionId, className: this._classNames.title, "aria-live": hasFocus ? "polite" : void 0, "aria-atomic": hasFocus ? true : void 0 }, + // If option is selected render title, otherwise render the placeholder text + selectedOptions.length ? onRenderTitle(selectedOptions, this._onRenderTitle) : onRenderPlaceholder(props, this._onRenderPlaceholder) + ), + React__namespace.createElement("span", { className: this._classNames.caretDownWrapper }, onRenderCaretDown(props, this._onRenderCaretDown)) + ), + isOpen && onRenderContainer(__assign$1(__assign$1({}, props), { onDismiss: this._onDismiss, onRenderItem }), this._onRenderContainer), + hasErrorMessage && React__namespace.createElement("div", { role: "alert", id: errorMessageId, className: this._classNames.errorMessage }, errorMessage) + ); + }; + DropdownInternal2.prototype.focus = function(shouldOpenOnFocus) { + if (this._dropDown.current) { + this._dropDown.current.focus(); + if (shouldOpenOnFocus) { + this.setState({ + isOpen: true + }); + } + } + }; + DropdownInternal2.prototype.setSelectedIndex = function(event2, index2) { + var _a2 = this.props, options2 = _a2.options, selectedKey = _a2.selectedKey, selectedKeys = _a2.selectedKeys, multiSelect = _a2.multiSelect, notifyOnReselect = _a2.notifyOnReselect, _b2 = _a2.hoisted.selectedIndices, selectedIndices = _b2 === void 0 ? [] : _b2; + var checked = selectedIndices ? selectedIndices.indexOf(index2) > -1 : false; + var newIndexes = []; + index2 = Math.max(0, Math.min(options2.length - 1, index2)); + if (selectedKey !== void 0 || selectedKeys !== void 0) { + this._onChange(event2, options2, index2, checked, multiSelect); + return; + } + if (!multiSelect && !notifyOnReselect && index2 === selectedIndices[0]) { + return; + } else if (multiSelect) { + newIndexes = selectedIndices ? this._copyArray(selectedIndices) : []; + if (checked) { + var position2 = newIndexes.indexOf(index2); + if (position2 > -1) { + newIndexes.splice(position2, 1); + } + } else { + newIndexes.push(index2); + } + } else { + newIndexes = [index2]; + } + event2.persist(); + this.props.hoisted.setSelectedIndices(newIndexes); + this._onChange(event2, options2, index2, checked, multiSelect); + }; + DropdownInternal2.prototype._copyArray = function(array2) { + var newArray = []; + for (var _i = 0, array_1 = array2; _i < array_1.length; _i++) { + var element2 = array_1[_i]; + newArray.push(element2); + } + return newArray; + }; + DropdownInternal2.prototype._moveIndex = function(event2, stepValue, index2, selectedIndex) { + var options2 = this.props.options; + if (selectedIndex === index2 || options2.length === 0) { + return selectedIndex; + } + if (index2 >= options2.length) { + index2 = 0; + } else if (index2 < 0) { + index2 = options2.length - 1; + } + var stepCounter = 0; + while (options2[index2].itemType === SelectableOptionMenuItemType.Header || options2[index2].itemType === SelectableOptionMenuItemType.Divider || options2[index2].disabled) { + if (stepCounter >= options2.length) { + return selectedIndex; + } + if (index2 + stepValue < 0) { + index2 = options2.length; + } else if (index2 + stepValue >= options2.length) { + index2 = -1; + } + index2 = index2 + stepValue; + stepCounter++; + } + this.setSelectedIndex(event2, index2); + return index2; + }; + DropdownInternal2.prototype._renderFocusableList = function(props) { + var _a2 = props.onRenderList, onRenderList = _a2 === void 0 ? this._onRenderList : _a2, label2 = props.label, ariaLabel2 = props.ariaLabel, multiSelect = props.multiSelect; + return React__namespace.createElement( + "div", + { className: this._classNames.dropdownItemsWrapper, onKeyDown: this._onZoneKeyDown, onKeyUp: this._onZoneKeyUp, ref: this._host, tabIndex: 0 }, + React__namespace.createElement(FocusZone, { ref: this._focusZone, direction: FocusZoneDirection.vertical, id: this._listId, className: this._classNames.dropdownItems, role: "listbox", "aria-label": ariaLabel2, "aria-labelledby": label2 && !ariaLabel2 ? this._labelId : void 0, "aria-multiselectable": multiSelect }, onRenderList(props, this._onRenderList)) + ); + }; + DropdownInternal2.prototype._renderSeparator = function(item) { + var index2 = item.index, key2 = item.key; + var separatorClassName = item.hidden ? this._classNames.dropdownDividerHidden : this._classNames.dropdownDivider; + if (index2 > 0) { + return React__namespace.createElement("div", { role: "presentation", key: key2, className: separatorClassName }); + } + return null; + }; + DropdownInternal2.prototype._renderHeader = function(item) { + var _a2 = this.props.onRenderOption, onRenderOption = _a2 === void 0 ? this._onRenderOption : _a2; + var key2 = item.key, id2 = item.id; + var headerClassName = item.hidden ? this._classNames.dropdownItemHeaderHidden : this._classNames.dropdownItemHeader; + return React__namespace.createElement("div", { id: id2, key: key2, className: headerClassName }, onRenderOption(item, this._onRenderOption)); + }; + DropdownInternal2.prototype._onItemMouseEnter = function(item, ev) { + if (this._shouldIgnoreMouseEvent()) { + return; + } + var targetElement = ev.currentTarget; + targetElement.focus(); + }; + DropdownInternal2.prototype._onItemMouseMove = function(item, ev) { + var doc = getDocumentEx(this.context); + var targetElement = ev.currentTarget; + this._gotMouseMove = true; + if (!this._isScrollIdle || doc.activeElement === targetElement) { + return; + } + targetElement.focus(); + }; + DropdownInternal2.prototype._shouldIgnoreMouseEvent = function() { + return !this._isScrollIdle || !this._gotMouseMove; + }; + DropdownInternal2.prototype._isAltOrMeta = function(ev) { + return ev.which === KeyCodes.alt || ev.key === "Meta"; + }; + DropdownInternal2.prototype._shouldHandleKeyUp = function(ev) { + var keyPressIsAltOrMetaAlone = this._lastKeyDownWasAltOrMeta && this._isAltOrMeta(ev); + this._lastKeyDownWasAltOrMeta = false; + return !!keyPressIsAltOrMetaAlone && !(isMac() || isIOS()); + }; + DropdownInternal2.prototype._shouldOpenOnFocus = function() { + var hasFocus = this.state.hasFocus; + var openOnKeyboardFocus = this.props.openOnKeyboardFocus; + return !this._isFocusedByClick && openOnKeyboardFocus === true && !hasFocus; + }; + DropdownInternal2.defaultProps = { + options: [] + }; + DropdownInternal2.contextType = WindowContext; + return DropdownInternal2; + })(React__namespace.Component) + ); + var _a, _b, _c, _d, _e; + var GlobalClassNames$2 = { + root: "ms-Dropdown-container", + label: "ms-Dropdown-label", + dropdown: "ms-Dropdown", + title: "ms-Dropdown-title", + caretDownWrapper: "ms-Dropdown-caretDownWrapper", + caretDown: "ms-Dropdown-caretDown", + callout: "ms-Dropdown-callout", + panel: "ms-Dropdown-panel", + dropdownItems: "ms-Dropdown-items", + dropdownItem: "ms-Dropdown-item", + dropdownDivider: "ms-Dropdown-divider", + dropdownOptionText: "ms-Dropdown-optionText", + dropdownItemHeader: "ms-Dropdown-header", + titleIsPlaceHolder: "ms-Dropdown-titleIsPlaceHolder", + titleHasError: "ms-Dropdown-title--hasError" + }; + var DROPDOWN_HEIGHT = 32; + var DROPDOWN_ITEM_HEIGHT = 36; + var highContrastAdjustMixin = (_a = {}, _a["".concat(HighContrastSelector, ", ").concat(HighContrastSelectorWhite.replace("@media ", ""))] = __assign$1({}, getHighContrastNoAdjustStyle()), _a); + var highContrastItemAndTitleStateMixin = { + selectors: __assign$1((_b = {}, _b[HighContrastSelector] = (_c = { + backgroundColor: "Highlight", + borderColor: "Highlight", + color: "HighlightText" + }, _c[".".concat(IsFocusVisibleClassName, " &:focus:after")] = { + borderColor: "HighlightText" + }, _c), _b[".ms-Checkbox-checkbox"] = (_d = {}, _d[HighContrastSelector] = { + borderColor: "HighlightText" + }, _d), _b), highContrastAdjustMixin) + }; + var highContrastBorderState = { + selectors: (_e = {}, _e[HighContrastSelector] = { + borderColor: "Highlight" + }, _e) + }; + var MinimumScreenSelector = getScreenSelector(0, ScreenWidthMinMedium); + var getStyles$4 = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m; + var theme = props.theme, hasError = props.hasError, hasLabel = props.hasLabel, className2 = props.className, isOpen = props.isOpen, disabled = props.disabled, required2 = props.required, isRenderingPlaceholder = props.isRenderingPlaceholder, panelClassName = props.panelClassName, calloutClassName = props.calloutClassName, calloutRenderEdge = props.calloutRenderEdge; + if (!theme) { + throw new Error("theme is undefined or null in base Dropdown getStyles function."); + } + var globalClassnames = getGlobalClassNames(GlobalClassNames$2, theme); + var palette = theme.palette, semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; + var rootHoverFocusActiveSelectorNeutralDarkMixin = { + color: semanticColors.menuItemTextHovered }; - TooltipHostBase.defaultProps = { - delay: (0, _tooltipTypes.TooltipDelay).medium - }; - TooltipHostBase.contextType = (0, _reactWindowProvider.WindowContext); - return TooltipHostBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Styling":"hTimn","../../Utilities":"1NZCy","./TooltipHost.types":"2LOQ1","./Tooltip":"1tZCB","./Tooltip.types":"cki5b","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2LOQ1":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Tooltip} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TooltipOverflowMode", ()=>TooltipOverflowMode); -var TooltipOverflowMode; -(function(TooltipOverflowMode) { - /** Only show tooltip if parent DOM element is overflowing */ TooltipOverflowMode[TooltipOverflowMode["Parent"] = 0] = "Parent"; - /** - * Only show tooltip if tooltip host's content is overflowing. - * Note that this does not check the children for overflow, only the TooltipHost root. - */ TooltipOverflowMode[TooltipOverflowMode["Self"] = 1] = "Self"; -})(TooltipOverflowMode || (TooltipOverflowMode = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"et1eN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-TooltipHost', - ariaPlaceholder: 'ms-TooltipHost-aria-placeholder' -}; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + var rootHoverFocusActiveSelectorNeutralPrimaryMixin = { + color: semanticColors.menuItemText + }; + var borderColorError = { + borderColor: semanticColors.errorText + }; + var dropdownItemStyle = [ + globalClassnames.dropdownItem, + { + backgroundColor: "transparent", + boxSizing: "border-box", + cursor: "pointer", + display: "flex", + alignItems: "center", + padding: "0 8px", + width: "100%", + minHeight: DROPDOWN_ITEM_HEIGHT, + lineHeight: 20, + height: 0, + position: "relative", + border: "1px solid transparent", + borderRadius: 0, + wordWrap: "break-word", + overflowWrap: "break-word", + textAlign: "left", + ".ms-Button-flexContainer": { + width: "100%" + } + } + ]; + var dropdownHeaderStyle = [ + globalClassnames.dropdownItemHeader, + __assign$1(__assign$1({}, fonts.medium), { fontWeight: FontWeights.semibold, color: semanticColors.menuHeader, background: "none", backgroundColor: "transparent", border: "none", height: DROPDOWN_ITEM_HEIGHT, lineHeight: DROPDOWN_ITEM_HEIGHT, cursor: "default", padding: "0 8px", userSelect: "none", textAlign: "left", selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _a2) }) + ]; + var selectedItemBackgroundColor = semanticColors.menuItemBackgroundPressed; + var itemSelectors = function(isSelected) { + var _a3, _b3; + if (isSelected === void 0) { + isSelected = false; + } + return { + selectors: (_a3 = { + "&:hover": [ + { + color: semanticColors.menuItemTextHovered, + backgroundColor: !isSelected ? semanticColors.menuItemBackgroundHovered : selectedItemBackgroundColor + }, + highContrastItemAndTitleStateMixin + ], + "&.is-multi-select:hover": [ + { backgroundColor: !isSelected ? "transparent" : selectedItemBackgroundColor }, + highContrastItemAndTitleStateMixin + ], + "&:active:hover": [ + { + color: semanticColors.menuItemTextHovered, + backgroundColor: !isSelected ? semanticColors.menuItemBackgroundPressed : semanticColors.menuItemBackgroundHovered + }, + highContrastItemAndTitleStateMixin + ] + }, _a3[".".concat(IsFocusVisibleClassName, " &:focus:after, :host(.").concat(IsFocusVisibleClassName, ") &:focus:after")] = (_b3 = { + left: 0, + top: 0, + bottom: 0, + right: 0 + }, _b3[HighContrastSelector] = { + inset: "2px" + }, _b3), _a3[HighContrastSelector] = { + border: "none" + }, _a3) + }; + }; + var dropdownItemSelected = __spreadArray(__spreadArray([], dropdownItemStyle, true), [ + { + backgroundColor: selectedItemBackgroundColor, + color: semanticColors.menuItemTextHovered + }, + itemSelectors(true), + highContrastItemAndTitleStateMixin + ], false); + var dropdownItemDisabled = __spreadArray(__spreadArray([], dropdownItemStyle, true), [ + { + color: semanticColors.disabledText, + cursor: "default", + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + color: "GrayText", + border: "none" + }, _b2) + } + ], false); + var titleOpenBorderRadius = calloutRenderEdge === RectangleEdge.bottom ? "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0") : "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2); + var calloutOpenBorderRadius = calloutRenderEdge === RectangleEdge.bottom ? "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2) : "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0"); return { - root: [ - classNames.root, + root: [globalClassnames.root, className2], + label: globalClassnames.label, + dropdown: [ + globalClassnames.dropdown, + normalize$1, + fonts.medium, + { + color: semanticColors.menuItemText, + borderColor: semanticColors.focusBorder, + position: "relative", + outline: 0, + userSelect: "none", + selectors: (_c2 = {}, _c2["&:hover ." + globalClassnames.title] = [ + !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, + { borderColor: isOpen ? palette.neutralSecondary : palette.neutralPrimary }, + highContrastBorderState + ], _c2["&:focus ." + globalClassnames.title] = [ + !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, + { selectors: (_d2 = {}, _d2[HighContrastSelector] = { color: "Highlight" }, _d2) } + ], _c2["&:focus:after"] = [ { - display: 'inline' - }, - className - ] + pointerEvents: "none", + content: "''", + position: "absolute", + boxSizing: "border-box", + top: "0px", + left: "0px", + width: "100%", + height: "100%", + // see https://github.com/microsoft/fluentui/pull/9182 for semantic color disc + border: !disabled ? "2px solid ".concat(palette.themePrimary) : "none", + borderRadius: "2px", + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + color: "Highlight" + }, _e2) + } + ], _c2["&:active ." + globalClassnames.title] = [ + !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, + { borderColor: palette.themePrimary }, + highContrastBorderState + ], _c2["&:hover ." + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:focus ." + globalClassnames.caretDown] = [ + !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, + { selectors: (_f = {}, _f[HighContrastSelector] = { color: "Highlight" }, _f) } + ], _c2["&:active ." + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:hover ." + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:focus ." + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:active ." + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c2["&:hover ." + globalClassnames.titleHasError] = borderColorError, _c2["&:active ." + globalClassnames.titleHasError] = borderColorError, _c2) + }, + isOpen && "is-open", + disabled && "is-disabled", + required2 && "is-required", + required2 && !hasLabel && { + selectors: (_g = { + ":before": { + content: "'*'", + color: semanticColors.errorText, + position: "absolute", + top: -5, + right: -10 + } + }, _g[HighContrastSelector] = { + selectors: { + ":after": { + right: -14 + // moving the * 4 pixel to right to alleviate border clipping in HC mode. + } + } + }, _g) + } + ], + title: [ + globalClassnames.title, + normalize$1, + { + backgroundColor: semanticColors.inputBackground, + borderWidth: 1, + borderStyle: "solid", + borderColor: semanticColors.inputBorder, + borderRadius: isOpen ? titleOpenBorderRadius : effects.roundedCorner2, + cursor: "pointer", + display: "block", + height: DROPDOWN_HEIGHT, + lineHeight: DROPDOWN_HEIGHT - 2, + padding: "0 28px 0 8px", + position: "relative", + overflow: "hidden", + whiteSpace: "nowrap", + textOverflow: "ellipsis" + }, + isRenderingPlaceholder && [globalClassnames.titleIsPlaceHolder, { color: semanticColors.inputPlaceholderText }], + hasError && [globalClassnames.titleHasError, borderColorError], + disabled && { + backgroundColor: semanticColors.disabledBackground, + border: "none", + color: semanticColors.disabledText, + cursor: "default", + selectors: (_h = {}, _h[HighContrastSelector] = __assign$1({ border: "1px solid GrayText", color: "GrayText", backgroundColor: "Window" }, getHighContrastNoAdjustStyle()), _h) + } + ], + caretDownWrapper: [ + globalClassnames.caretDownWrapper, + { + height: DROPDOWN_HEIGHT, + lineHeight: DROPDOWN_HEIGHT - 2, + // height minus the border + paddingTop: 1, + position: "absolute", + right: 8, + top: 0 + }, + !disabled && { + cursor: "pointer" + } + ], + caretDown: [ + globalClassnames.caretDown, + { color: palette.neutralSecondary, fontSize: fonts.small.fontSize, pointerEvents: "none" }, + disabled && { + color: semanticColors.disabledText, + selectors: (_j = {}, _j[HighContrastSelector] = __assign$1({ color: "GrayText" }, getHighContrastNoAdjustStyle()), _j) + } + ], + errorMessage: __assign$1(__assign$1({ color: semanticColors.errorText }, theme.fonts.small), { paddingTop: 5 }), + callout: [ + globalClassnames.callout, + { + boxShadow: effects.elevation8, + borderRadius: calloutOpenBorderRadius, + selectors: (_k = {}, _k[".ms-Callout-main"] = { borderRadius: calloutOpenBorderRadius }, _k) + }, + calloutClassName + ], + dropdownItemsWrapper: { selectors: { "&:focus": { outline: 0 } } }, + dropdownItems: [globalClassnames.dropdownItems, { display: "block" }], + dropdownItem: __spreadArray(__spreadArray([], dropdownItemStyle, true), [itemSelectors()], false), + dropdownItemSelected, + dropdownItemDisabled, + dropdownItemSelectedAndDisabled: [dropdownItemSelected, dropdownItemDisabled, { backgroundColor: "transparent" }], + dropdownItemHidden: __spreadArray(__spreadArray([], dropdownItemStyle, true), [{ display: "none" }], false), + dropdownDivider: [globalClassnames.dropdownDivider, { height: 1, backgroundColor: semanticColors.bodyDivider }], + dropdownDividerHidden: [globalClassnames.dropdownDivider, { display: "none" }], + dropdownOptionText: [ + globalClassnames.dropdownOptionText, + { + overflow: "hidden", + whiteSpace: "nowrap", + textOverflow: "ellipsis", + minWidth: 0, + maxWidth: "100%", + wordWrap: "break-word", + overflowWrap: "break-word", + margin: "1px" + } + ], + dropdownItemHeader: dropdownHeaderStyle, + dropdownItemHeaderHidden: __spreadArray(__spreadArray([], dropdownHeaderStyle, true), [{ display: "none" }], false), + subComponentStyles: { + label: { root: { display: "inline-block" } }, + multiSelectItem: { + root: { + padding: 0 + }, + label: { + alignSelf: "stretch", + padding: "0 8px", + width: "100%" + }, + input: { + selectors: (_l = {}, // eslint-disable-next-line @fluentui/max-len + _l[".".concat(IsFocusVisibleClassName, " &:focus + label::before, :host(.").concat(IsFocusVisibleClassName, ") &:focus + label::before")] = { + outlineOffset: "0px" + }, _l) + } + }, + panel: { + root: [panelClassName], + main: { + selectors: (_m = {}, // In case of extra small screen sizes + _m[MinimumScreenSelector] = { + // panelWidth xs + width: 272 + }, _m) + }, + contentInner: { padding: "0 0 20px" } + } + } }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bXa7Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>(0, _index.Dialog)); -var _index = require("./components/Dialog/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Dialog/index":"7FXbB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7FXbB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _dialog = require("./Dialog"); -parcelHelpers.exportAll(_dialog, exports); -var _dialogBase = require("./Dialog.base"); -parcelHelpers.exportAll(_dialogBase, exports); -var _dialogContent = require("./DialogContent"); -parcelHelpers.exportAll(_dialogContent, exports); -var _dialogContentBase = require("./DialogContent.base"); -parcelHelpers.exportAll(_dialogContentBase, exports); -var _dialogFooter = require("./DialogFooter"); -parcelHelpers.exportAll(_dialogFooter, exports); -var _dialogFooterBase = require("./DialogFooter.base"); -parcelHelpers.exportAll(_dialogFooterBase, exports); -var _dialogTypes = require("./Dialog.types"); -parcelHelpers.exportAll(_dialogTypes, exports); -var _dialogContentTypes = require("./DialogContent.types"); -parcelHelpers.exportAll(_dialogContentTypes, exports); -var _dialogFooterTypes = require("./DialogFooter.types"); -parcelHelpers.exportAll(_dialogFooterTypes, exports); - -},{"./Dialog":"efw5L","./Dialog.base":false,"./DialogContent":false,"./DialogContent.base":false,"./DialogFooter":"8shIu","./DialogFooter.base":false,"./Dialog.types":false,"./DialogContent.types":"lz1qp","./DialogFooter.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"efw5L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dialog", ()=>Dialog); -var _utilities = require("../../Utilities"); -var _dialogBase = require("./Dialog.base"); -var _dialogStyles = require("./Dialog.styles"); -var Dialog = (0, _utilities.styled)((0, _dialogBase.DialogBase), (0, _dialogStyles.getStyles), undefined, { - scope: 'Dialog' -}); -Dialog.displayName = 'Dialog'; - -},{"../../Utilities":"1NZCy","./Dialog.base":"fsCtu","./Dialog.styles":"73MTE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fsCtu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogBase", ()=>DialogBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _dialogContentTypes = require("./DialogContent.types"); -var _modal = require("../../Modal"); -var _responsiveMode = require("../../ResponsiveMode"); -var _dialogContent = require("./DialogContent"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DefaultModalProps = { - isDarkOverlay: false, - isBlocking: false, - className: '', - containerClassName: '', - topOffsetFixed: false, - enableAriaHiddenSiblings: true -}; -var DefaultDialogContentProps = { - type: (0, _dialogContentTypes.DialogType).normal, - className: '', - topButtonsProps: [] -}; -// eslint-disable-next-line deprecation/deprecation -var DialogBase = /** @class */ function(_super) { - (0, _tslib.__extends)(DialogBase, _super); - function DialogBase(props) { - var _this = _super.call(this, props) || this; - _this._getSubTextId = function() { - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, ariaDescribedById = _a.ariaDescribedById, modalProps = _a.modalProps, dialogContentProps = _a.dialogContentProps, subText = _a.subText; - var id = modalProps && modalProps.subtitleAriaId || ariaDescribedById; - if (!id) id = (dialogContentProps && dialogContentProps.subText || subText) && _this._defaultSubTextId; - return id; - }; - _this._getTitleTextId = function() { - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, ariaLabelledById = _a.ariaLabelledById, modalProps = _a.modalProps, dialogContentProps = _a.dialogContentProps, title = _a.title; - var id = modalProps && modalProps.titleAriaId || ariaLabelledById; - if (!id) id = (dialogContentProps && dialogContentProps.title || title) && _this._defaultTitleTextId; - return id; - }; - _this._id = (0, _utilities.getId)('Dialog'); - _this._defaultTitleTextId = _this._id + '-title'; - _this._defaultSubTextId = _this._id + '-subText'; - return _this; - } - DialogBase.prototype.render = function() { - var _a, _b, _c; - var props = this.props; - var /* eslint-disable deprecation/deprecation */ className = props.className, containerClassName = props.containerClassName, contentClassName = props.contentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, forceFocusInsideTrap = props.forceFocusInsideTrap, styles = props.styles, hidden = props.hidden, _d = props.disableRestoreFocus, disableRestoreFocus = _d === void 0 ? props.ignoreExternalFocusing : _d, isBlocking = props.isBlocking, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, _e = props.isOpen, isOpen = _e === void 0 ? !hidden : _e, onDismiss = props.onDismiss, onDismissed = props.onDismissed, onLayerDidMount = props.onLayerDidMount, responsiveMode = props.responsiveMode, subText = props.subText, theme = props.theme, title = props.title, topButtonsProps = props.topButtonsProps, type = props.type, /* eslint-enable deprecation/deprecation */ minWidth = props.minWidth, maxWidth = props.maxWidth, modalProps = props.modalProps; - var mergedLayerProps = (0, _tslib.__assign)({ - onLayerDidMount: onLayerDidMount - }, modalProps === null || modalProps === void 0 ? void 0 : modalProps.layerProps); - var dialogDraggableClassName; - var dragOptions; - // If dragOptions are provided, but no drag handle is specified, we supply a drag handle, - // and inform dialog contents to add class to draggable class to the header - if ((modalProps === null || modalProps === void 0 ? void 0 : modalProps.dragOptions) && !((_a = modalProps.dragOptions) === null || _a === void 0 ? void 0 : _a.dragHandleSelector)) { - // spread options to avoid mutating props - dragOptions = (0, _tslib.__assign)({}, modalProps.dragOptions); - dialogDraggableClassName = 'ms-Dialog-draggable-header'; - dragOptions.dragHandleSelector = ".".concat(dialogDraggableClassName); - } - var mergedModalProps = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, DefaultModalProps), { - elementToFocusOnDismiss: elementToFocusOnDismiss, - firstFocusableSelector: firstFocusableSelector, - forceFocusInsideTrap: forceFocusInsideTrap, - disableRestoreFocus: disableRestoreFocus, - isClickableOutsideFocusTrap: isClickableOutsideFocusTrap, - responsiveMode: responsiveMode, - className: className, - containerClassName: containerClassName, - isBlocking: isBlocking, - isDarkOverlay: isDarkOverlay, - onDismissed: onDismissed - }), modalProps), { - dragOptions: dragOptions, - layerProps: mergedLayerProps, - isOpen: isOpen - }); - var dialogContentProps = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({ - className: contentClassName, - subText: subText, - title: title, - topButtonsProps: topButtonsProps, - type: type - }, DefaultDialogContentProps), props.dialogContentProps), { - draggableHeaderClassName: dialogDraggableClassName, - titleProps: (0, _tslib.__assign)({ - // eslint-disable-next-line deprecation/deprecation - id: ((_b = props.dialogContentProps) === null || _b === void 0 ? void 0 : _b.titleId) || this._defaultTitleTextId - }, (_c = props.dialogContentProps) === null || _c === void 0 ? void 0 : _c.titleProps) - }); - var classNames = getClassNames(styles, { - theme: theme, - className: mergedModalProps.className, - containerClassName: mergedModalProps.containerClassName, - hidden: hidden, - dialogDefaultMinWidth: minWidth, - dialogDefaultMaxWidth: maxWidth - }); - return _react.createElement((0, _modal.Modal), (0, _tslib.__assign)({}, mergedModalProps, { - className: classNames.root, - containerClassName: classNames.main, - onDismiss: onDismiss || mergedModalProps.onDismiss, - subtitleAriaId: this._getSubTextId(), - titleAriaId: this._getTitleTextId() - }), _react.createElement((0, _dialogContent.DialogContent), (0, _tslib.__assign)({ - subTextId: this._defaultSubTextId, - showCloseButton: mergedModalProps.isBlocking, - onDismiss: onDismiss - }, dialogContentProps), props.children)); - }; - DialogBase.defaultProps = { - hidden: true + }; + var Dropdown = styled(DropdownBase, getStyles$4, void 0, { + scope: "Dropdown" + }); + Dropdown.displayName = "Dropdown"; + const fabricIconsWoff = "data:font/woff;base64,d09GRgABAAAAABuQAA4AAAAAMIgABKj2AAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABRAAAAEgAAABgMVN8b2NtYXAAAAGMAAABEAAAArIn/BeDY3Z0IAAAApwAAAAgAAAAKgnZCa9mcGdtAAACvAAAAPAAAAFZ/J7mjmdhc3AAAAOsAAAADAAAAAwACAAbZ2x5ZgAAA7gAABITAAAepM100RhoZWFkAAAVzAAAADIAAAA2BVACQGhoZWEAABYAAAAAFQAAACQQAQgDaG10eAAAFhgAAABQAAAAchoOED5sb2NhAAAWaAAAAHAAAABw0ZDZvG1heHAAABbYAAAAHQAAACAAWQIibmFtZQAAFvgAAAP3AAAJ+pKX8lVwb3N0AAAa8AAAABQAAAAg/1EArnByZXAAABsEAAAAiQAAANN4vfIOeJxjYGH/xDiBgZWBgXUWqzEDA6M0hGa+yJDGJMTBysrFyMQIBgxAIMCAAL7BCgoMDs95vzpzgPkQkgGsjgXCU2BgAAD3EghqeJxjYGBgZoBgGQZGIMnAuAbIYwTzWRgnAOkEBgcGVgaF57zP+Z8LPhd6Lvxc4rnMc6Xnvs8zn094PvX5sufLnx9+IfPC4cWUF9NeLH9x4sXvl6IvS17ufXnoFfNrjteX36x+s+bNqTen3zK9bXuX+W7m+/73Ez72fFz16dhnn8/Bn598Vfnq/P8/AwPYBgG4DYpYbJiEZEMxDhsy3s3AboPEF4nfEp8kvkp8lHgr8QoID0jMl6iTqJLIkciU8BN/K35ZvEm8UbxQPFBcXpxNbKVYolismJyohIi/cKVwuXCMcJSwqtAiwYOCkwXmC8zlW8zXxpvN85znPk8AtyDXZ0jo0RYwstHejsEOAFLcpEl4nGPQYghlKGBoYFjFyMDYwOzAeIDBAYsIEAAAqhwHlXicXY+/TsNADMZzJLSEJ0A6IZ11KkOViJ3phksk1CUlDOelgNRKpO+AlIXFA8/ibhnzYgjMEf4utr/P+ny/c6f5yXx2nKVHKilWnDfhoNQLDurtmf35IU/vNmVhTNV5VvdlwWoJomtOF/VNsGjI0PWWTG0eH7acLWKXxY7w0nDShk7qbQB2qL/HHeJVPJLFI4QS30/xfYxL+rUsVobTiyasA/des/OoAUzFYxN49BoQf8ikP3VnE+NsOWXbwE5zgkSfygL3RJqE+0uPf/Wgkv+G+23Iv6tB9U3c9Bb0h2HBgrChl2fbUAkaYPkOhPxkxgABAAIACAAK//8AD3icnVh7cFRVmj/ffaYREm46SedFwk2nuwkhCelOp8E86EQSeSwkBgapboMwCktQMrqKGEDngKPgBHFMZtx1YLWUCZY7o7vrc2uYXdupLXGmZsQdtsbaSu38oQKzs+Jzq5TOvSf7nXNvd5rglu509+3zuOfxnfO9ft9HJHKKEOV76j1EJjohMcM0AqZhnpL/YL0qvWqvIeo96e//UFlP8APECxf0S1oDUbHh80AM9PGE5bW8CXlca8CafClh7cZx+MnDL7kGxxWbht8wo6YRMfKIFadWXE5RxS3llBXH8Z+Tz/V5+jw+3gO6B0K4tgd8SlJ6MWGvs9clpBft9QnpJemlhEKuaNrrcQhupxCNaHpaT5MYuYscJsdx56KS4iKtWJUDmu5V5RrNXxP0ywFvMIRdLcFoS2s04FVbY9gVbo2ESyI4qMQX8EInRFuCoVhIbYSQN6Q3gr9G00O6Nx/0gO7Lh+KiEp/uC1SBT/bFqiASbo35YnInxNQYhKuk4qJ8yV/TKEVbOiVvuBPLRmznY3+VpH0BAPJT7N3S8pXs4NOeQg/+nmYHV5aXsnefAhmA2U9BHb6F72bewnfxLdQ9xY5IiiJ9uIl9Wt0VXPHOD31LfaVNpePvrAjGF7JPN33ovIWCq99CwSZrbP3DO9radjy8PlPGtq6qq1u1NeaWSu3/jxg79yDsP3Ev3DG73YdXkpr79ipSpV25ZPHSpjmEiZJIBH95RKOkkoSRtwYyM2Tmy/VgmKEYChdevM/shIieL+tmCDlndMIKMKtkXx6Jrz/UxAorNw6NdMVtSqlE410jQxsr4aOmQ+vjpTUVvrn2XQWV9w8M3F9ZID0y11dRU6oRi17X0XZzd61E4nGJ1Hbf3NZx3Whe6YLaovq+YcM6Zgz31RfVLijN4+KO9BGaR3SKWlTApR7pMiCqmk4lj9iE4aPTy6howJWNTtrEmpQDMpmkAZvYAWlSJviCylSnCiVeEiJtuNIsiTK/pg2kotFfVORvrHBLueLrOhSa0/hGJZ5XokBUqhPHbkDE8CNPDAlvF4+gkzTqI38yd+PYA5X0cN6BDoaKyqlr/OuvCQXxiyyLVUlKJNypoMYoXGN0s5ibDdSs1lhrbSTsK/GVKAR2J9huZWl///pjx15LnX3hmScfODTY1FOyf9GzH0DJ4/vPn/nJnnh8z0/OnN9/6H/OPReDOkaosahky/3fg8aTZ1OvHTumEXuSjSVgTEremTorutb3L49t3/5wz+M31Dz22Qtb+fwPDjhrrX7on++mEmEfLexYcF9yy7f5xkTYnMy58kkRqSD13OZoOqjchHCBBDQRHinQKIegU86YAT2PhJemJ+3DT6qBpQe6e/Ylo5d7dz3hV5azyamlsHpOQ3ygUWVljbXF5vK19cHlzUvKtH/sPoBznpRGcE44mtw3dY//iV3KtRBIXzPQOBBvmCO/V7akeXmwfu1ys7i2sSznzv1oEbkUKSglCtca4IYw2hKDRrRzncpsE6XGt7184uBN4fBNB0+8vO2+81utj73l5UGvPL9vo9O393cnkskTv9vrlnge0e1M29hnfeINlpd7ZWPr+fucvimSM1yUwoOQrL5wGq/jkoGuJ2b6VDNk6lj9OmsKYW7hxWla88iXRApQ6VUKEyxA7VcpC+iow7tOj/b3j57elSn7ju7s6Nh5tM8t7UfLg0htMOiILOWfKaLQ3Cm8tGjOJFHKVMzDh181TiV4FLzvajxNA2kmUbIcT+Q3OP0mP4Dhj5r8FBGusgugToqaYBpFJdhGT+Q3IuA+OqFVLb2LLLKot6UKBY9rHVCudxKxCFCGKjaFuyukPGgjyeA+Gk3H+RQ+WU1RmtFYSqdJOs5pTSm4gPMQTm5GRprJLWQvGSVPkZfIGS4tSpVUWFwk5UuKe/eKe+9uu7BTqvXOaKrCucE1N+JwTHG4M8syzW67pTsHuXvle3lWWyGPgPbB6QdXr37w9Acs/Uh0sKfOW1lT6a3r2dISbIu2tK9Zyvv4a1CP5doBp87vAsdF2taE+4/ubBdzsY/NNnFwfFaHNHvE9lnt87PaecSl8RGW5hTX9QxGm1e3t0Tbgi1bslQPRt0DfUlzyXTqfCUxrn3n0f7mtW0RnMv7VDLbGMNVPewqgz79DcYQGTIyXE/ayVrH9ywAoW2OGBsZdhiORHPuQZRbaYf/2AUtrTFETKaYZGpCIGsMs8Lg20yjSA9Go4O9i6aFm+ItmXKZzh6GtoXzSudZcd5QkBYuzHFlXlmJlRJkEz6bz3P0Qqa8PYVaa2flXaJyPLaldI6HN2xKAAGpV7PwXMGMJUQrHRI4z7XJrqNRlfjWF0/Qm8JD26zTCXll36bkiXf23D5x9OD1MIHIAT3E0N5R3QrfRE+8uPXh6W3WLxJyT9/ZO/a8cyLZdduRVQgtWHLZ0OC6WLXw5e59KljMc+2b1/SI0tDJZaokAxBgk6jTaKrUyXQgD2ECBC4nVbTglznmBoV4xRqcdrNRdmxfiQ99qGO/UX0UHxJvKmj5rj94dOJ2TsymPnllwjq9bcghdePo3qHtty7DS9LIqiO3dfFj3XG2Txxy2/TDzqGrY+sGh5bxg7o+W39Tf5PUkm7cOR83DqE/4wqJAF1HeB7jTs4HQa6bCHxjoAm6OIl4vc7l8in6m+aK6/rCNdXswXlzy5t7l7D77beONEjL2f0Nva/cMrAW9mvFwZgJx2LNzCifl8eKypYsaapYfluj9PTCGn1e4Rz47/JmtciMBYs19mCwf1HXri3fWgKH7DMNR6RlcKihd00Z7K+uae5bucK028rh4+ZYZXM5K55TOFc3F9o3N962rKKpYUkZfJiHbJABfY9OBHbRiIfzJWIgU0IGSgqFOAYndhUIACPjN02+UArtL75qHqIek88EDQUwjVGNFZfeczyJTSTP1EeSx4mbkIeX9EtXxzfyGAZM1u6EPGYNYxAlj2N8c0XTGsYhHEPBBnQyDXl877mEBFDpvDwAQ8oBEC422OP2eALOUTiHnkA+Zx+T/irBFqvPpW+E3zsYDBBX6tzgF3JJQm+EKuA3eMQnnK2GAyhbloS3JuhlqhJUS47vGJ0QnSj9NvpFalGUZi7XiHZxrWuIQXyuZKPDjngjoQB3a+LBhdGZMiIncenAxIRFpcA0sZOcYIayqBBlcioA6LgYficmgaRRgQBvUsSaAYw1L3EM6dwWSBSPKHlVbyI9DgFpOGF/pBYm0mMiNpVwpopfvOurMLNC+o4OtbcPHe3rH+XlqEpzGv38pVgDDpMy9aJ+ke8Z8PAIV1eHrTL54og1Jg+PYEVUrbER3K+MlGkj7liHn9LYiDyML+WLVlkZVnGKVWaVkTk8NhD3xTF9PWkiEcQ7bWQFYp7rr6Z2NsrxIiSQOb4uNjGeiJpe3EvSwRvCK/FBSE4NntzX27vv5GCm7L77xkjkxru7u/fcGA7fuOeQADUKcnIKbxnofvZpAubLTVCQYJ8kkzA/MfWXSfZJQiO5i/DSJji9O3c5mXMHV1IEUoLFOJl9av0bzoYCuSmJS1qVSVwf5U3lMqJ/iXgI8ac3XNspFUZbpFCVmsEVtYj4qwAcFCGFSpx+vUSh6BbfP/3Q6pVd9E9vPXNX5+qHTr+PvvT7LH0xtbK6Q64+cP7MyT3x/sfeRgNy6J/eY5cfo9AjET4OtEceBHLX/MTR1979/CC6X77QqsNv3KsoDL3syTPnDxyZ/o+/ixx/Zox9/PnZv91u0COc99xWc/2gIp5BGfKi9AZ46ObqKsoCKhDaZERZPASBMTacgHEYT7BhGMOIhId2lNsM8F7Rz/hYvA++Pse7UcRaIk7AQNXJJWCMioY1guyNoPPslGNOAgLDBrTwCBqLuU/FIAhjCBPlAQfz8XwFwEWKTX57eJeNaIU62qtXrtvUHKivDzRvWreyur0DdRl7F65cuylcu2SmV0Nt3rRqQWv5tckV5hQ1VySvLW9dsGpTtk+Z6dPJrl9tbljT0eIz2hYvbjN8LR1rGjb/ahel2N+0uj1carRf2W+TgXv9+RXeRUMjh3t7D48MLfJW5PvvHfjKXuFrdojYfhW5Ae+mSubqUA/RSFYTNN3xfHowoxVtUOzPAkhfpyzirRhPSqEz1AY3P3Fn1/UjJwfjcVcLugv9xpz19/zNxt5DuzeWrd2QUX48xM9Hb7hh9Oe7GpsW7TpwdHXyuUdvZ13IvnPsXGKcKtPampEnNw+eHLmeCm3A5RRl46ND7Yv/4rZuf8aOUL4CX8nT8e2ewLLtxywNmX8OGhJj0oQbKz6g2zrPifmEDSDI1UgmgAGfHtJDsVDMF/OpukAHIfzjih7SIWKCbqjZeAN+/H7i/czPfrkr/QOdxONpkpLQbMJ1yT+egq4fsVfsipSacqMbqzxnyvtxlVrzu7rkO1jydYQbhP1L8r9OsZR04Q170qWV5zIcWuswmrmS1pyMnoc3RJPTWuxHLTHMGUoljDzwh17V+jHsmMIlaYbMVJIdt0lKnpihMeEMBYJFnB1PIpUY6WRo7ErCDiCcQjkbt1SgbdkwO16pbZS+OkLBUDcTBTcqHDrNjihctP5/BhBOUmDwp4/v27x06eZ9j/90MKc+G/O7q1wB8TMZhdxFtYVXLeXWr8ydVDhx/Dc76Z91sj/3BDmxJNq3ElJOqoiJuDHkZER0nnAIgUg5IGQ0wwgSS8CUEQebXo/Ci5AJ/jxSYMULq6sLrXiBB2helaFQoyoPqMf6Efv9b6RfWg+w38Ktv7H/KO1mf4AP4Rb7WqkB668A3Mp+ayspX+EU9fkUWugrLJBovmHk27RAamR4ifyxqV0i/cm6U36Ul1TcLEo4zWI6HVsFaPt9eNc8ihf0cz/A0U3UFXMMasok08h8IfOgPqBRvSzwC6PC0WKc7j7gPhxSpUV2TCYzsk5cJbGzTfHQ3H8q8Mk5QtTn9bTAnjrIfi/3TurzCfYCjmM/S8AluKTNS8ANX1q6LtqMwyH4d6Kpf6/bYp7I28sRL6gbk8zLCpMwgJNhg7QuwbxwCdfSpS9tDjclEiZlOsdDqkCuHPirAr8qY9Zj8ndGODSS3xbYiFf1YYGNZlASrwkZRqykvz2zDhIdECCYD7AQKn3Hesyudaq4hn6Rw6YZACVqwkc7OSPicokIjOkHv+BEBCIZZqjIBZvey1acsbF2L7xxxsLL51hWF5ds4XVz0yQjInLYxP+FXZnJ4VZw3jvZW462xbo+PWunyVUp3UDywoXk+fPiPye72xpws7uTmZf472RGhV7nIYIuz0gbmDw36jfqJPxDfG4iwnNiU/FETYgF3EOiUE/CQII9j5KscHzBnk/AAJucOsfFIcA43KA8mGQvJKwNMh5cQlrdQRJx38CG9PPOGrganwQbEnww3g/XGYH1S1E/diLvPBjDGhzr84in2KOIEsNYK2Wl5Lj9qHSndGf6LL96lT9npj5jN8PTSj48/QP2FnsLllk72etyM3RZZ+Vm9rp1lvOUC7gevzKmwnUxuEGhp2pqKkWl9+wqR2dsHpR9IXlEWIUxUSa+Lhf+1Cz+qiRFbhLDdDIW1EmizM5GKKlssmJKvMLDf1XOQaHZpISdkkQCAumqJK36By5+nEPySTH2oAQhPzEschjpkUxuAbHBjWANfAbPavAzuxPIL1mH9K/syR54Fj6zdrNfTxOmw260gVot01H/v4WWUKFTZwzl13i/xNr7D8ryqVf1NcjUbfkGl3IjH3dOYdRKc+NaP+eR7OHxaTol4tqZ+JRHtqrH/oKHtiQvK4+yyFWUoQUMoEQ2O1qG0blehnYjYsgi2+qAAa7CesgrQBeganhkrhqSyDBiqMeOp1JSRSDj39nBJA+gkxMTyWm0ackJO3nqVHJaxNTYxLrG58GON6QkOn37AreRWSQRSIIYlZ4vpiRPyZ/gQiBM5bRYlGdY3Lh0ti2/i3yXjJK/Jifd06CMqbPKTH+gJBuLtUMslA/cd5XkxmfZpIdIXFbiwXMSIZFsMBeCcCvCeMSuiPFB/EdEzxX9OXVJpHZ5WEXdylSmomYq7JKXyx6XU/hFeW9gcd00yfbwcnEdkNlDYPaQ9AaXJZp7u8GpC25FyvSgtFE0jAjBULhQnZECGX0XRu7jdYszS2lztS3lld5pMtPFSy+Qq8bA7DH27gxvZzLpLFub4Tz5X7oQ0KMAeJxjYGRgYGBZ8W1igahBPL/NVwZuDgYQ2P/3YAOIvmfgdQZEczCAxTkZmEAUAE1pCdgAAHicY2BkYOBgAAE4yciACpgAAsoAHQAAAHicY9ViWMbBwCDMwMDwmYGNAQQamBoYYADIYmxgBNKMLEAWEDIIMwaDxYWZGhjbmSSBbFYgD6EDrIvxMuMVBiMGSTgfCBlkGA6AOACflgxrAAAAFgAqAEIAZAFUAaQByAIcAjICngLsAzwDpAP+BQYFcgWuBdAGDAZ6BpYGsgbUBvQHGgdMB2QHhgecB7IILAiECLQJQgm0CgoKWgrQCyQLgAvWC/IMDgwyDFYMhgy8DRANQA1eDaQN5g4EDmYPUnicY2BkYGAwZzjBwMsAAoxgkguEGSNBTAAdRwF9AAAAeJy1VD+LHDcUf3u79l1wfARDwKWKEM7HMmtfzJnY1WHHla85mwM3Ae2MdkZ4diQkjYcxLlK6yMdIY8inCAmkTJ1PkDpVyrz3pNnb827MJZAdRvPT0/v7e08LALdHX8II4u8rfCMewS3cRbwDu/BNwmOUP0t4gvjbhK/Bp2ATvg6fwduEd+Fr+D7hPfgcfkn4BhzC7wnfHP08miS8D4c7v2KU0eQT3BU7fyY8gi/G5wnvwP74TcJjlL9LeIL4x4Svwe3xbwlfBzH+I+FdcJO9hPfgcDL4uQEvJj8kfHP8bvJXwvvwYu+7n96Lo7v3HohTnTvjzSKIx8ZZ42TQpsnESV2LM11WwYsz5ZV7rYrsqZw7nYvTJ8+OxIn3KvgzVba1dJsHm5Jz5Tx6Fvez4+N4Sofx7LkqjRLaCymCk4VaSvdKmIUIlVrLr3SmtSTOzdLKRiufbU2+CsE+nM26rsuWw3mGNrPQW1M6aat+tjBN8LMLc99aW2tVCDrIxEvTiqXsResVJoGJkVgEI3KnZFBTUWhva9lPhWwKYZ3G0xxVFH6lF1a5pQ4B3c17LqLWuWrIFx54YdwAFhRhulmqdaZo8zAVxDzaTslmCKAb0VU6r9Yy6zCobvK6LbBNq+xNU/fiQN8RajnHXC7U0cPHsmX1QjelcMoH7BSxehGAzFe+HjEDBxqjBLWkFjiNUQvTNbWRxWX2ZKRKOSrHYChc22DbIApFZZJOpWp7mVEcxqZP6tQQdIj8VHquMefs6t2G9yDgCO7CPXiA6BQ05ODAgMd3AQFljxE5vPO0SpRoRA1keHICNT4CzlBWQoVnnncKvwq1X+NaoOZTtJvjnnxTjCf4z3LE9p41yY6sSmjRn0TNq1hcReec8/ApZwH3MZtjfNZtB8t1u+ecjcFVoA5VJfENzECB0iVn+QplxBKdVKy7jb+S9y0yOGjn+F3iXmJOmtnK/gXzxHNA6UOY4dPxk6G/D+2zFGeGuGcvJfux6KFH6YK9UbWzrdE952yxI5r7KFYW1PuXXJNgJnr8tsxdZCIyNmiTzHDVDjWoDgVT3BesZ7njPUuID4pjuTPRNk9eVNpL9m25r1Rz4DOymnMeQydqroishryihecuuA3JYlXD9Epdtbwv0CbH/ZT5ijMf405XcT6sQPMkdsxTjut2zrpUKWnnWE3Lc1ds5Z5sakYHqH8HvzSh88TLNu8xh//K7YX3gj2VKHM8xyHdqWFWt1UwRN/M69HaDFAlsZbA8YZbQP5jrQVKOq7c8K382OzJS1OluC8mrbGqiFu+WS1bUrZDNwc/pFnzTf7nGY3/jE3qzIX34YboxDLND+U7Z6Zjb/+Hu/03hsc4mgB4nGNgZgCD/34M5QyYwBwAKWEB/3ic28CgzbCJkZNJm3ETF4jcztWaG2qrysChvZ07NdhBTwbE4onwsNCQBLF4nc215YVBLD4dFRkRHhCLX05CmI8DxBLg4+FkZwGxBMEAxBLaMKEgwADIYtjOCDeaCW40M9xoFrjRrHCj2eQkoUazw43mgBvNCTd6kzAju/YGBgXX2kwJFwDEASgaAAAA"; + function initializeIcons$1() { + const subset = { + style: { + MozOsxFontSmoothing: "grayscale", + WebkitFontSmoothing: "antialiased", + fontStyle: "normal", + fontWeight: "normal", + speak: "none" + }, + fontFace: { + fontFamily: '"FabricMDL2Icons"', + src: `url("${fabricIconsWoff}") format("woff")` + }, + icons: { + Accept: "", + Add: "", + BIDashboard: "", + Camera: "", + Cancel: "", + ChevronDown: "", + ChevronLeftMed: "", + ChevronRightMed: "", + Clear: "", + ClearFilter: "", + ClearNight: "", + CloudDownload: "", + Color: "", + Copy: "", + CubeShape: "", + Delete: "", + Diamond: "", + DiamondSolid: "", + DoubleChevronLeft12: "", + DoubleChevronRight12: "", + Download: "", + Edit: "", + Filter: "", + Filters: "", + FiltersSolid: "", + Flow: "", + History: "", + HourGlass: "", + More: "", + Next: "", + OpenInNewWindow: "", + Page: "", + Pause: "", + Photo2Add: "", + Photo2Remove: "", + PicturePosition: "", + Pin: "", + Pinned: "", + PlayResume: "", + PlayReverseResume: "", + Previous: "", + RadioBtnOff: "", + RadioBtnOn: "", + RadioBullet: "", + Redo: "", + RemoveFilter: "", + ScaleVolume: "", + Search: "", + Settings: "", + SortDown: "", + SortUp: "", + Sunny: "", + Table: "", + Undo: "" + } }; - DialogBase = (0, _tslib.__decorate)([ - (0, _responsiveMode.withResponsiveMode) - ], DialogBase); - return DialogBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./DialogContent.types":"lz1qp","../../Modal":"7RBgT","../../ResponsiveMode":"cFpqz","./DialogContent":"7qNNV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lz1qp":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Dialog} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogType", ()=>DialogType); -var DialogType; -(function(DialogType) { - /** Standard dialog */ DialogType[DialogType["normal"] = 0] = "normal"; - /** Dialog with large header banner */ DialogType[DialogType["largeHeader"] = 1] = "largeHeader"; - /** Dialog with an 'x' close button in the upper-right corner */ DialogType[DialogType["close"] = 2] = "close"; -})(DialogType || (DialogType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7RBgT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>(0, _index.Modal)); -var _index = require("./components/Modal/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Modal/index":"bgO9e","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bgO9e":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _modal = require("./Modal"); -parcelHelpers.exportAll(_modal, exports); -var _modalBase = require("./Modal.base"); -parcelHelpers.exportAll(_modalBase, exports); -var _modalTypes = require("./Modal.types"); -parcelHelpers.exportAll(_modalTypes, exports); - -},{"./Modal":"ePfbY","./Modal.base":false,"./Modal.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ePfbY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Modal", ()=>Modal); -var _utilities = require("../../Utilities"); -var _modalBase = require("./Modal.base"); -var _modalStyles = require("./Modal.styles"); -var Modal = (0, _utilities.styled)((0, _modalBase.ModalBase), (0, _modalStyles.getStyles), undefined, { - scope: 'Modal', - fields: [ - 'theme', - 'styles', - 'enableAriaHiddenSiblings' - ] -}); -Modal.displayName = 'Modal'; - -},{"../../Utilities":"1NZCy","./Modal.base":"9JqAn","./Modal.styles":"kcVY7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9JqAn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ModalBase", ()=>ModalBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _focusTrapZone = require("../../FocusTrapZone"); -var _modalStyles = require("./Modal.styles"); -var _overlay = require("../../Overlay"); -var _layer = require("../../Layer"); -var _popup = require("../../Popup"); -var _responsiveMode = require("../../ResponsiveMode"); -var _directionalHint = require("../../common/DirectionalHint"); -var _icon = require("../../Icon"); -var _index = require("../../utilities/DraggableZone/index"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _reactHooks = require("@fluentui/react-hooks"); -var ZERO = { - x: 0, - y: 0 -}; -var DEFAULT_PROPS = { - isOpen: false, - isDarkOverlay: true, - className: '', - containerClassName: '', - enableAriaHiddenSiblings: true -}; -var getClassNames = (0, _utilities.classNamesFunction)(); -var getMoveDelta = function(ev) { - var delta = 10; - if (ev.shiftKey) { - if (!ev.ctrlKey) delta = 50; - } else if (ev.ctrlKey) delta = 1; - return delta; -}; -var useComponentRef = function(props, focusTrapZone) { - _react.useImperativeHandle(props.componentRef, function() { - return { - focus: function() { - if (focusTrapZone.current) focusTrapZone.current.focus(); - } - }; - }, [ - focusTrapZone - ]); -}; -var ModalBase = _react.forwardRef(function(propsWithoutDefaults, ref) { - var _a, _b, _c, _d, _e; - var props = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var allowTouchBodyScroll = props.allowTouchBodyScroll, className = props.className, children = props.children, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, elementToFocusOnDismiss = props.elementToFocusOnDismiss, firstFocusableSelector = props.firstFocusableSelector, focusTrapZoneProps = props.focusTrapZoneProps, forceFocusInsideTrap = props.forceFocusInsideTrap, // eslint-disable-next-line deprecation/deprecation - _f = props.disableRestoreFocus, // eslint-disable-next-line deprecation/deprecation - disableRestoreFocus = _f === void 0 ? props.ignoreExternalFocusing : _f, isBlocking = props.isBlocking, isAlert = props.isAlert, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, isDarkOverlay = props.isDarkOverlay, onDismiss = props.onDismiss, layerProps = props.layerProps, overlay = props.overlay, isOpen = props.isOpen, titleAriaId = props.titleAriaId, styles = props.styles, subtitleAriaId = props.subtitleAriaId, theme = props.theme, topOffsetFixed = props.topOffsetFixed, responsiveMode = props.responsiveMode, // eslint-disable-next-line deprecation/deprecation - onLayerDidMount = props.onLayerDidMount, isModeless = props.isModeless, dragOptions = props.dragOptions, onDismissed = props.onDismissed, // eslint-disable-next-line deprecation/deprecation - enableAriaHiddenSiblings = props.enableAriaHiddenSiblings, popupProps = props.popupProps; - var rootRef = _react.useRef(null); - var focusTrapZone = _react.useRef(null); - var focusTrapZoneRef = (0, _reactHooks.useMergedRefs)(focusTrapZone, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.componentRef); - var focusTrapZoneElm = _react.useRef(null); - var mergedRef = (0, _reactHooks.useMergedRefs)(rootRef, ref); - var modalResponsiveMode = (0, _responsiveMode.useResponsiveMode)(mergedRef); - var focusTrapZoneId = (0, _reactHooks.useId)('ModalFocusTrapZone', focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.id); - var win = (0, _reactWindowProvider.useWindow)(); - var _g = (0, _reactHooks.useSetTimeout)(), setTimeout = _g.setTimeout, clearTimeout = _g.clearTimeout; - var _h = _react.useState(isOpen), isModalOpen = _h[0], setIsModalOpen = _h[1]; - var _j = _react.useState(isOpen), isVisible = _j[0], setIsVisible = _j[1]; - var _k = _react.useState(ZERO), coordinates = _k[0], setCoordinates = _k[1]; - var _l = _react.useState(), modalRectangleTop = _l[0], setModalRectangleTop = _l[1]; - var _m = (0, _reactHooks.useBoolean)(false), isModalMenuOpen = _m[0], _o = _m[1], toggleModalMenuOpen = _o.toggle, setModalMenuClose = _o.setFalse; - var internalState = (0, _reactHooks.useConst)(function() { - return { - onModalCloseTimer: 0, - allowTouchBodyScroll: allowTouchBodyScroll, - scrollableContent: null, - lastSetCoordinates: ZERO, - events: new (0, _utilities.EventGroup)({}) - }; + return subset; + } + let registerIcons; + let unregisterIcons; + function initializeIcons() { + [initializeIcons$1].forEach((initialize2) => { + const subset = initialize2(); + unregisterIcons && unregisterIcons(Object.keys(subset.icons)); + registerIcons(subset, { + disableWarnings: true + }); }); - var keepInBounds = (dragOptions || {}).keepInBounds; - var isAlertRole = isAlert !== null && isAlert !== void 0 ? isAlert : isBlocking && !isModeless; - var layerClassName = layerProps === undefined ? '' : layerProps.className; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - containerClassName: containerClassName, - scrollableContentClassName: scrollableContentClassName, - isOpen: isOpen, - isVisible: isVisible, - hasBeenOpened: internalState.hasBeenOpened, - modalRectangleTop: modalRectangleTop, - topOffsetFixed: topOffsetFixed, - isModeless: isModeless, - layerClassName: layerClassName, - windowInnerHeight: win === null || win === void 0 ? void 0 : win.innerHeight, - isDefaultDragHandle: dragOptions && !dragOptions.dragHandleSelector + } + function use(_registerIcons, _unregisterIcons) { + registerIcons = _registerIcons; + unregisterIcons = _unregisterIcons; + } + var ONKEYDOWN_TIMEOUT_DURATION = 1e3; + var getClassNames$3 = classNamesFunction(); + var getSlotStyleFn = function(sty) { + return function(value2) { + var _a2; + return _a2 = {}, _a2[sty] = "".concat(value2, "%"), _a2; + }; + }; + var getPercent = function(value2, sliderMin, sliderMax) { + return sliderMax === sliderMin ? 0 : (value2 - sliderMin) / (sliderMax - sliderMin) * 100; + }; + var useComponentRef$1 = function(props, sliderBoxRef, value2, range2) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + get value() { + return value2; + }, + get range() { + return range2; + }, + focus: function() { + var _a2; + (_a2 = sliderBoxRef.current) === null || _a2 === void 0 ? void 0 : _a2.focus(); + } + }; + }, [range2, sliderBoxRef, value2]); + }; + var useSlider = function(props, ref2) { + var _a2 = props.step, step = _a2 === void 0 ? 1 : _a2, className2 = props.className, _b2 = props.disabled, disabled = _b2 === void 0 ? false : _b2, label2 = props.label, _c2 = props.max, max2 = _c2 === void 0 ? 10 : _c2, _d2 = props.min, min2 = _d2 === void 0 ? 0 : _d2, _e2 = props.showValue, showValue = _e2 === void 0 ? true : _e2, _f = props.buttonProps, buttonProps = _f === void 0 ? {} : _f, _g = props.vertical, vertical = _g === void 0 ? false : _g, snapToStep = props.snapToStep, valueFormat = props.valueFormat, styles = props.styles, theme = props.theme, originFromZero = props.originFromZero, ariaLabelledBy = props["aria-labelledby"], _h = props.ariaLabel, ariaLabel2 = _h === void 0 ? props["aria-label"] : _h, ranged = props.ranged, onChange = props.onChange, onChanged = props.onChanged; + var disposables = React__namespace.useRef([]); + var _j = useSetTimeout(), setTimeout2 = _j.setTimeout, clearTimeout2 = _j.clearTimeout; + var sliderLine = React__namespace.useRef(null); + var win = useWindowEx(); + var _k = useControllableValue(props.value, props.defaultValue, function(ev, v) { + return onChange === null || onChange === void 0 ? void 0 : onChange(v, ranged ? [internalState.latestLowerValue, v] : void 0, ev); + }), unclampedValue = _k[0], setValue = _k[1]; + var _l = useControllableValue(props.lowerValue, props.defaultLowerValue, function(ev, lv) { + return onChange === null || onChange === void 0 ? void 0 : onChange(internalState.latestValue, [lv, internalState.latestValue], ev); + }), unclampedLowerValue = _l[0], setLowerValue = _l[1]; + var value2 = Math.max(min2, Math.min(max2, unclampedValue || 0)); + var lowerValue = Math.max(min2, Math.min(value2, unclampedLowerValue || 0)); + var internalState = useConst({ + onKeyDownTimer: -1, + isAdjustingLowerValue: false, + latestValue: value2, + latestLowerValue: lowerValue }); - var mergedLayerProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - eventBubblingEnabled: false - }, layerProps), { - onLayerDidMount: layerProps && layerProps.onLayerDidMount ? layerProps.onLayerDidMount : onLayerDidMount, - insertFirst: (layerProps === null || layerProps === void 0 ? void 0 : layerProps.insertFirst) || isModeless, - className: classNames.layer + internalState.latestValue = value2; + internalState.latestLowerValue = lowerValue; + var id2 = useId("Slider", props.id || (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.id)); + var classNames2 = getClassNames$3(styles, { + className: className2, + disabled, + vertical, + showTransitions: !snapToStep && !internalState.isBetweenSteps, + showValue, + ranged, + theme }); - // Allow the user to scroll within the modal but not on the body - var allowScrollOnModal = _react.useCallback(function(elt) { - if (elt) { - if (internalState.allowTouchBodyScroll) (0, _utilities.allowOverscrollOnElement)(elt, internalState.events); - else (0, _utilities.allowScrollOnElement)(elt, internalState.events); - } else internalState.events.off(internalState.scrollableContent); - internalState.scrollableContent = elt; - }, [ - internalState - ]); - var registerInitialModalPosition = function() { - var dialogMain = focusTrapZoneElm.current; - var modalRectangle = dialogMain === null || dialogMain === void 0 ? void 0 : dialogMain.getBoundingClientRect(); - if (modalRectangle) { - if (topOffsetFixed) setModalRectangleTop(modalRectangle.top); - if (keepInBounds) { - // x/y are unavailable in IE, so use the equivalent left/top - internalState.minPosition = { - x: -modalRectangle.left, - y: -modalRectangle.top - }; - internalState.maxPosition = { - x: modalRectangle.left, - y: modalRectangle.top - }; - } + var steps = (max2 - min2) / step; + var clearOnKeyDownTimer = function() { + clearTimeout2(internalState.onKeyDownTimer); + internalState.onKeyDownTimer = -1; + }; + var setOnKeyDownTimer = function(event2) { + clearOnKeyDownTimer(); + if (onChanged) { + internalState.onKeyDownTimer = setTimeout2(function() { + onChanged(event2, internalState.latestValue, ranged ? [internalState.latestLowerValue, internalState.latestValue] : void 0); + }, ONKEYDOWN_TIMEOUT_DURATION); + } + }; + var getAriaValueText = function(valueProps) { + var ariaValueText = props.ariaValueText; + if (valueProps !== void 0) { + return ariaValueText ? ariaValueText(valueProps) : valueProps.toString(); + } + return void 0; + }; + var updateValue = function(ev, newValue, newUnroundedValue) { + newValue = Math.min(max2, Math.max(min2, newValue)); + newUnroundedValue = newUnroundedValue !== void 0 ? Math.min(max2, Math.max(min2, newUnroundedValue)) : void 0; + var numDec = 0; + if (isFinite(step)) { + while (Math.round(step * Math.pow(10, numDec)) / Math.pow(10, numDec) !== step) { + numDec++; } + } + var roundedValue = parseFloat(newValue.toFixed(numDec)); + internalState.isBetweenSteps = newUnroundedValue !== void 0 && newUnroundedValue !== roundedValue; + if (ranged) { + if (internalState.isAdjustingLowerValue && (originFromZero ? roundedValue <= 0 : roundedValue <= internalState.latestValue)) { + setLowerValue(roundedValue, ev); + } else if (!internalState.isAdjustingLowerValue && (originFromZero ? roundedValue >= 0 : roundedValue >= internalState.latestLowerValue)) { + setValue(roundedValue, ev); + } + } else { + setValue(roundedValue, ev); + } }; - /** - * Clamps an axis to a specified min and max position. - * - * @param axis A string that represents the axis (x/y). - * @param position The position on the axis. - */ var getClampedAxis = _react.useCallback(function(axis, position) { - var minPosition = internalState.minPosition, maxPosition = internalState.maxPosition; - if (keepInBounds && minPosition && maxPosition) { - position = Math.max(minPosition[axis], position); - position = Math.min(maxPosition[axis], position); - } - return position; - }, [ - keepInBounds, - internalState - ]); - var handleModalClose = function() { - var _a; - internalState.lastSetCoordinates = ZERO; - setModalMenuClose(); - internalState.isInKeyboardMoveMode = false; - setIsModalOpen(false); - setCoordinates(ZERO); - (_a = internalState.disposeOnKeyUp) === null || _a === void 0 || _a.call(internalState); - onDismissed === null || onDismissed === void 0 || onDismissed(); - }; - var handleDragStart = _react.useCallback(function() { - setModalMenuClose(); - internalState.isInKeyboardMoveMode = false; - }, [ - internalState, - setModalMenuClose - ]); - var handleDrag = _react.useCallback(function(ev, dragData) { - setCoordinates(function(prevValue) { - return { - x: getClampedAxis('x', prevValue.x + dragData.delta.x), - y: getClampedAxis('y', prevValue.y + dragData.delta.y) - }; - }); - }, [ - getClampedAxis - ]); - var handleDragStop = _react.useCallback(function() { - if (focusTrapZone.current) focusTrapZone.current.focus(); - }, []); - var handleEnterKeyboardMoveMode = function() { - // We need a global handleKeyDown event when we are in the move mode so that we can - // handle the key presses and the components inside the modal do not get the events - var handleKeyDown = function(ev) { - // eslint-disable-next-line deprecation/deprecation - if (ev.altKey && ev.ctrlKey && ev.keyCode === (0, _utilities.KeyCodes).space) { - // CTRL + ALT + SPACE is handled during keyUp - ev.preventDefault(); - ev.stopPropagation(); - return; - } - // eslint-disable-next-line deprecation/deprecation - var newLocal = ev.altKey || ev.keyCode === (0, _utilities.KeyCodes).escape; - if (isModalMenuOpen && newLocal) setModalMenuClose(); - // eslint-disable-next-line deprecation/deprecation - if (internalState.isInKeyboardMoveMode && (ev.keyCode === (0, _utilities.KeyCodes).escape || ev.keyCode === (0, _utilities.KeyCodes).enter)) { - internalState.isInKeyboardMoveMode = false; - ev.preventDefault(); - ev.stopPropagation(); - } - if (internalState.isInKeyboardMoveMode) { - var handledEvent = true; - var delta_1 = getMoveDelta(ev); - // eslint-disable-next-line deprecation/deprecation - switch(ev.keyCode){ - /* eslint-disable no-fallthrough */ case (0, _utilities.KeyCodes).escape: - setCoordinates(internalState.lastSetCoordinates); - case (0, _utilities.KeyCodes).enter: - // TODO: determine if fallthrough was intentional - /* eslint-enable no-fallthrough */ internalState.lastSetCoordinates = ZERO; - break; - case (0, _utilities.KeyCodes).up: - setCoordinates(function(prevValue) { - return { - x: prevValue.x, - y: getClampedAxis('y', prevValue.y - delta_1) - }; - }); - break; - case (0, _utilities.KeyCodes).down: - setCoordinates(function(prevValue) { - return { - x: prevValue.x, - y: getClampedAxis('y', prevValue.y + delta_1) - }; - }); - break; - case (0, _utilities.KeyCodes).left: - setCoordinates(function(prevValue) { - return { - x: getClampedAxis('x', prevValue.x - delta_1), - y: prevValue.y - }; - }); - break; - case (0, _utilities.KeyCodes).right: - setCoordinates(function(prevValue) { - return { - x: getClampedAxis('x', prevValue.x + delta_1), - y: prevValue.y - }; - }); - break; - default: - handledEvent = false; - } - if (handledEvent) { - ev.preventDefault(); - ev.stopPropagation(); - } - } - }; - internalState.lastSetCoordinates = coordinates; - setModalMenuClose(); - internalState.isInKeyboardMoveMode = true; - internalState.events.on(win, 'keydown', handleKeyDown, true); - internalState.disposeOnKeyDown = function() { - internalState.events.off(win, 'keydown', handleKeyDown, true); - internalState.disposeOnKeyDown = undefined; - }; + var onKeyDown = function(event2) { + var newCurrentValue = internalState.isAdjustingLowerValue ? internalState.latestLowerValue : internalState.latestValue; + var diff = 0; + switch (event2.which) { + case getRTLSafeKeyCode(KeyCodes.left, props.theme): + case KeyCodes.down: + diff = -step; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + case getRTLSafeKeyCode(KeyCodes.right, props.theme): + case KeyCodes.up: + diff = step; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + case KeyCodes.home: + newCurrentValue = min2; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + case KeyCodes.end: + newCurrentValue = max2; + clearOnKeyDownTimer(); + setOnKeyDownTimer(event2); + break; + default: + return; + } + updateValue(event2, newCurrentValue + diff); + event2.preventDefault(); + event2.stopPropagation(); + }; + var getPosition2 = function(event2, verticalProp) { + var currentPosition = 0; + switch (event2.type) { + case "mousedown": + case "mousemove": + currentPosition = !verticalProp ? event2.clientX : event2.clientY; + break; + case "touchstart": + case "touchmove": + currentPosition = !verticalProp ? event2.touches[0].clientX : event2.touches[0].clientY; + break; + } + return currentPosition; + }; + var calculateCurrentSteps = function(event2) { + var sliderPositionRect = sliderLine.current.getBoundingClientRect(); + var sliderLength = !props.vertical ? sliderPositionRect.width : sliderPositionRect.height; + var stepLength = sliderLength / steps; + var currentSteps; + var distance2; + if (!props.vertical) { + var left = getPosition2(event2, props.vertical); + distance2 = getRTL(props.theme) ? sliderPositionRect.right - left : left - sliderPositionRect.left; + currentSteps = distance2 / stepLength; + } else { + var bottom = getPosition2(event2, props.vertical); + distance2 = sliderPositionRect.bottom - bottom; + currentSteps = distance2 / stepLength; + } + return currentSteps; + }; + var onMouseMoveOrTouchMove = function(event2, suppressEventCancelation) { + var currentSteps = calculateCurrentSteps(event2); + var newUnroundedValue = min2 + step * currentSteps; + var newCurrentValue = min2 + step * Math.round(currentSteps); + updateValue(event2, newCurrentValue, newUnroundedValue); + if (!suppressEventCancelation) { + event2.preventDefault(); + event2.stopPropagation(); + } }; - var handleExitKeyboardMoveMode = function(ev) { - var _a, _b; - (_a = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.onBlur) === null || _a === void 0 || _a.call(focusTrapZoneProps, ev); - internalState.lastSetCoordinates = ZERO; - internalState.isInKeyboardMoveMode = false; - (_b = internalState.disposeOnKeyDown) === null || _b === void 0 || _b.call(internalState); + var onMouseDownOrTouchStart = function(event2) { + if (ranged) { + var currentSteps = calculateCurrentSteps(event2); + var newValue = min2 + step * currentSteps; + internalState.isAdjustingLowerValue = newValue <= internalState.latestLowerValue || newValue - internalState.latestLowerValue <= internalState.latestValue - newValue; + } + if (event2.type === "mousedown") { + disposables.current.push(on$1(win, "mousemove", onMouseMoveOrTouchMove, true), on$1(win, "mouseup", onMouseUpOrTouchEnd, true)); + } else if (event2.type === "touchstart") { + disposables.current.push(on$1(win, "touchmove", onMouseMoveOrTouchMove, true), on$1(win, "touchend", onMouseUpOrTouchEnd, true)); + } + onMouseMoveOrTouchMove(event2, true); }; - var registerForKeyUp = function() { - var handleKeyUp = function(ev) { - // Needs to handle the CTRL + ALT + SPACE key during keyup due to FireFox bug: - // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143 - // eslint-disable-next-line deprecation/deprecation - if (ev.altKey && ev.ctrlKey && ev.keyCode === (0, _utilities.KeyCodes).space) { - if ((0, _utilities.elementContains)(internalState.scrollableContent, ev.target)) { - toggleModalMenuOpen(); - ev.preventDefault(); - ev.stopPropagation(); - } - } - }; - if (!internalState.disposeOnKeyUp) { - internalState.events.on(win, 'keyup', handleKeyUp, true); - internalState.disposeOnKeyUp = function() { - internalState.events.off(win, 'keyup', handleKeyUp, true); - internalState.disposeOnKeyUp = undefined; - }; - } + var onMouseUpOrTouchEnd = function(event2) { + internalState.isBetweenSteps = void 0; + onChanged === null || onChanged === void 0 ? void 0 : onChanged(event2, internalState.latestValue, ranged ? [internalState.latestLowerValue, internalState.latestValue] : void 0); + disposeListeners(); }; - _react.useEffect(function() { - clearTimeout(internalState.onModalCloseTimer); - // Opening the dialog - if (isOpen) { - // This must be done after the modal content has rendered - requestAnimationFrame(function() { - return setTimeout(registerInitialModalPosition, 0); - }); - setIsModalOpen(true); - // Add a keyUp handler for all key up events once the dialog is open. - if (dragOptions) registerForKeyUp(); - internalState.hasBeenOpened = true; - setIsVisible(true); - } - // Closing the dialog - if (!isOpen && isModalOpen) { - internalState.onModalCloseTimer = setTimeout(handleModalClose, parseFloat((0, _modalStyles.animationDuration)) * 1000); - setIsVisible(false); - } - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run if isModalOpen or isOpen mutates. - }, [ - isModalOpen, - isOpen - ]); - (0, _reactHooks.useUnmount)(function() { - internalState.events.dispose(); - if (internalState.onModalCloseTimer) { - clearTimeout(internalState.onModalCloseTimer); - internalState.onModalCloseTimer = 0; - } - }); - useComponentRef(props, focusTrapZone); - useDebugWarnings(props); - var modalContent = _react.createElement((0, _focusTrapZone.FocusTrapZone), (0, _tslib.__assign)({}, focusTrapZoneProps, { - id: focusTrapZoneId, - ref: focusTrapZoneElm, - componentRef: focusTrapZoneRef, - className: (0, _utilities.css)(classNames.main, focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.className), - elementToFocusOnDismiss: (_a = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.elementToFocusOnDismiss) !== null && _a !== void 0 ? _a : elementToFocusOnDismiss, - isClickableOutsideFocusTrap: (_b = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.isClickableOutsideFocusTrap) !== null && _b !== void 0 ? _b : isModeless || isClickableOutsideFocusTrap || !isBlocking, - disableRestoreFocus: (_c = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.disableRestoreFocus) !== null && _c !== void 0 ? _c : disableRestoreFocus, - forceFocusInsideTrap: ((_d = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.forceFocusInsideTrap) !== null && _d !== void 0 ? _d : forceFocusInsideTrap) && !isModeless, - // eslint-disable-next-line deprecation/deprecation - firstFocusableSelector: (focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.firstFocusableSelector) || firstFocusableSelector, - focusPreviouslyFocusedInnerElement: (_e = focusTrapZoneProps === null || focusTrapZoneProps === void 0 ? void 0 : focusTrapZoneProps.focusPreviouslyFocusedInnerElement) !== null && _e !== void 0 ? _e : true, - onBlur: internalState.isInKeyboardMoveMode ? handleExitKeyboardMoveMode : undefined - }), dragOptions && internalState.isInKeyboardMoveMode && _react.createElement("div", { - className: classNames.keyboardMoveIconContainer - }, dragOptions.keyboardMoveIconProps ? _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({}, dragOptions.keyboardMoveIconProps)) : _react.createElement((0, _icon.Icon), { - iconName: "move", - className: classNames.keyboardMoveIcon - })), _react.createElement("div", { - ref: allowScrollOnModal, - className: classNames.scrollableContent, - "data-is-scrollable": true - }, dragOptions && isModalMenuOpen && _react.createElement(dragOptions.menu, { - items: [ - { - key: 'move', - text: dragOptions.moveMenuItemText, - onClick: handleEnterKeyboardMoveMode - }, - { - key: 'close', - text: dragOptions.closeMenuItemText, - onClick: handleModalClose - } - ], - onDismiss: setModalMenuClose, - alignTargetEdge: true, - coverTarget: true, - directionalHint: (0, _directionalHint.DirectionalHint).topLeftEdge, - directionalHintFixed: true, - shouldFocusOnMount: true, - target: internalState.scrollableContent - }), children)); - return isModalOpen && modalResponsiveMode >= (responsiveMode || (0, _responsiveMode.ResponsiveMode).small) && _react.createElement((0, _layer.Layer), (0, _tslib.__assign)({ - ref: mergedRef - }, mergedLayerProps), _react.createElement((0, _popup.Popup), (0, _tslib.__assign)({ - role: isAlertRole ? 'alertdialog' : 'dialog', - ariaLabelledBy: titleAriaId, - ariaDescribedBy: subtitleAriaId, - onDismiss: onDismiss, - shouldRestoreFocus: !disableRestoreFocus, - // Modeless modals shouldn't hide siblings. - // Popup will automatically handle this based on the aria-modal setting. - enableAriaHiddenSiblings: enableAriaHiddenSiblings, - "aria-modal": !isModeless - }, popupProps), _react.createElement("div", { - className: classNames.root, - role: !isModeless ? 'document' : undefined - }, !isModeless && _react.createElement((0, _overlay.Overlay), (0, _tslib.__assign)({ - "aria-hidden": true, - isDarkThemed: isDarkOverlay, - onClick: isBlocking ? undefined : onDismiss, - allowTouchBodyScroll: allowTouchBodyScroll - }, overlay)), dragOptions ? _react.createElement((0, _index.DraggableZone), { - handleSelector: dragOptions.dragHandleSelector || "#".concat(focusTrapZoneId), - preventDragSelector: "button", - onStart: handleDragStart, - onDragChange: handleDrag, - onStop: handleDragStop, - position: coordinates - }, modalContent) : modalContent))) || null; -}); -ModalBase.displayName = 'Modal'; -function useDebugWarnings(props) {} - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../FocusTrapZone":"5R7BQ","./Modal.styles":"kcVY7","../../Overlay":"eCuPP","../../Layer":"hQjxQ","../../Popup":"bOJlv","../../ResponsiveMode":"cFpqz","../../common/DirectionalHint":"avdAc","../../Icon":"hiMUP","../../utilities/DraggableZone/index":"gcdmd","@fluentui/react-window-provider":"iP8C0","@fluentui/react-hooks":"2LHjM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5R7BQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/FocusTrapZone/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/FocusTrapZone/index":"dzHmS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dzHmS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _focusTrapZone = require("./FocusTrapZone"); -parcelHelpers.exportAll(_focusTrapZone, exports); -var _focusTrapZoneTypes = require("./FocusTrapZone.types"); -parcelHelpers.exportAll(_focusTrapZoneTypes, exports); - -},{"./FocusTrapZone":"hqYwI","./FocusTrapZone.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hqYwI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FocusTrapZone", ()=>FocusTrapZone); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _windowProvider = require("../../WindowProvider"); -var _dom = require("../../utilities/dom"); -var COMPONENT_NAME = 'FocusTrapZone'; -var DEFAULT_PROPS = { - disabled: false, - disableFirstFocus: false, - forceFocusInsideTrap: true, - isClickableOutsideFocusTrap: false, - // Hardcoding completely uncontrolled flag for proper interop with FluentUI V9. - 'data-tabster': '{"uncontrolled": {"completely": true}}' -}; -var useComponentRef = function(componentRef, previouslyFocusedElement, focusFTZ) { - _react.useImperativeHandle(componentRef, function() { - return { - get previouslyFocusedElement () { - return previouslyFocusedElement; - }, - focus: focusFTZ - }; - }, [ - focusFTZ, - previouslyFocusedElement - ]); -}; -var FocusTrapZone = _react.forwardRef(function(propsWithoutDefaults, ref) { - var _a; - var root = _react.useRef(null); - var firstBumper = _react.useRef(null); - var lastBumper = _react.useRef(null); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(root, ref); - var doc = (0, _windowProvider.useDocument)(); - var win = (0, _dom.useWindowEx)(); - var inShadow = (0, _utilities.useHasMergeStylesShadowRootContext)(); - var isFirstRender = (_a = (0, _reactHooks.usePrevious)(false)) !== null && _a !== void 0 ? _a : true; - var props = (0, _utilities.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var internalState = (0, _reactHooks.useConst)({ - hasFocus: false, - focusStackId: (0, _reactHooks.useId)('ftz-', props.id) - }); - var children = props.children, componentRef = props.componentRef, disabled = props.disabled, disableFirstFocus = props.disableFirstFocus, forceFocusInsideTrap = props.forceFocusInsideTrap, focusPreviouslyFocusedInnerElement = props.focusPreviouslyFocusedInnerElement, // eslint-disable-next-line deprecation/deprecation - firstFocusableSelector = props.firstFocusableSelector, firstFocusableTarget = props.firstFocusableTarget, // eslint-disable-next-line deprecation/deprecation - _b = props.disableRestoreFocus, // eslint-disable-next-line deprecation/deprecation - disableRestoreFocus = _b === void 0 ? props.ignoreExternalFocusing : _b, isClickableOutsideFocusTrap = props.isClickableOutsideFocusTrap, enableAriaHiddenSiblings = props.enableAriaHiddenSiblings; - var bumperProps = { - 'aria-hidden': true, - style: { - pointerEvents: 'none', - position: 'fixed' - }, - tabIndex: disabled ? -1 : 0, - 'data-is-visible': true, - 'data-is-focus-trap-zone-bumper': true + var onThumbFocus = function(event2) { + internalState.isAdjustingLowerValue = event2.target === lowerValueThumbRef.current; }; - var focusElementAsync = _react.useCallback(function(element) { - if (element !== firstBumper.current && element !== lastBumper.current) (0, _utilities.focusAsync)(element); + var disposeListeners = React__namespace.useCallback(function() { + disposables.current.forEach(function(dispose) { + return dispose(); + }); + disposables.current = []; }, []); - /** - * Callback to force focus into FTZ (named to avoid overlap with global focus() callback). - * useEventCallback always returns the same callback reference but updates the implementation - * every render to avoid stale captured values. - */ var focusFTZ = (0, _reactHooks.useEventCallback)(function() { - if (!root.current) return; // not done mounting - var previouslyFocusedElementInTrapZone = internalState.previouslyFocusedElementInTrapZone; - if (focusPreviouslyFocusedInnerElement && previouslyFocusedElementInTrapZone && (0, _utilities.elementContains)(root.current, previouslyFocusedElementInTrapZone)) { - // focus on the last item that had focus in the zone before we left the zone - focusElementAsync(previouslyFocusedElementInTrapZone); - return; + React__namespace.useEffect(function() { + return disposeListeners; + }, [disposeListeners]); + var lowerValueThumbRef = React__namespace.useRef(null); + var thumbRef = React__namespace.useRef(null); + var sliderBoxRef = React__namespace.useRef(null); + useComponentRef$1(props, sliderBoxRef, value2, ranged ? [lowerValue, value2] : void 0); + var getPositionStyles = getSlotStyleFn(vertical ? "bottom" : getRTL(props.theme) ? "right" : "left"); + var getTrackStyles = getSlotStyleFn(vertical ? "height" : "width"); + var originValue = originFromZero ? 0 : min2; + var valuePercent = getPercent(value2, min2, max2); + var lowerValuePercent = getPercent(lowerValue, min2, max2); + var originPercentOfLine = getPercent(originValue, min2, max2); + var activeSectionWidth = ranged ? valuePercent - lowerValuePercent : Math.abs(originPercentOfLine - valuePercent); + var topSectionWidth = Math.min(100 - valuePercent, 100 - originPercentOfLine); + var bottomSectionWidth = ranged ? lowerValuePercent : Math.min(valuePercent, originPercentOfLine); + var rootProps = { + className: classNames2.root, + ref: ref2 + }; + var labelProps = { + className: classNames2.titleLabel, + children: label2, + disabled, + htmlFor: ariaLabel2 ? void 0 : id2 + }; + var valueLabelProps = showValue ? { + className: classNames2.valueLabel, + children: valueFormat ? valueFormat(value2) : value2, + disabled, + htmlFor: disabled ? id2 : void 0 + } : void 0; + var lowerValueLabelProps = ranged && showValue ? { + className: classNames2.valueLabel, + children: valueFormat ? valueFormat(lowerValue) : lowerValue, + disabled + } : void 0; + var zeroTickProps = originFromZero ? { + className: classNames2.zeroTick, + style: getPositionStyles(originPercentOfLine) + } : void 0; + var trackActiveProps = { + className: css(classNames2.lineContainer, classNames2.activeSection), + style: getTrackStyles(activeSectionWidth) + }; + var trackTopInactiveProps = { + className: css(classNames2.lineContainer, classNames2.inactiveSection), + style: getTrackStyles(topSectionWidth) + }; + var trackBottomInactiveProps = { + className: css(classNames2.lineContainer, classNames2.inactiveSection), + style: getTrackStyles(bottomSectionWidth) + }; + var sliderProps = __assign$1({ "aria-disabled": disabled, role: "slider", tabIndex: disabled ? void 0 : 0 }, { "data-is-focusable": !disabled }); + var sliderBoxProps = __assign$1(__assign$1(__assign$1({ id: id2, className: css(classNames2.slideBox, buttonProps.className), ref: sliderBoxRef }, !disabled && { + onMouseDown: onMouseDownOrTouchStart, + onTouchStart: onMouseDownOrTouchStart, + onKeyDown + }), buttonProps && getNativeProps(buttonProps, divProperties, ["id", "className"])), !ranged && __assign$1(__assign$1({}, sliderProps), { "aria-valuemin": min2, "aria-valuemax": max2, "aria-valuenow": value2, "aria-valuetext": getAriaValueText(value2), "aria-label": ariaLabel2 || label2, "aria-labelledby": ariaLabelledBy })); + var onFocusProp = disabled ? {} : { onFocus: onThumbFocus }; + var thumbProps = __assign$1({ ref: thumbRef, className: classNames2.thumb, style: getPositionStyles(valuePercent) }, ranged && __assign$1(__assign$1(__assign$1({}, sliderProps), onFocusProp), { id: "max-".concat(id2), "aria-valuemin": lowerValue, "aria-valuemax": max2, "aria-valuenow": value2, "aria-valuetext": getAriaValueText(value2), "aria-label": "max ".concat(ariaLabel2 || label2) })); + var lowerValueThumbProps = ranged ? __assign$1(__assign$1(__assign$1({ ref: lowerValueThumbRef, className: classNames2.thumb, style: getPositionStyles(lowerValuePercent) }, sliderProps), onFocusProp), { id: "min-".concat(id2), "aria-valuemin": min2, "aria-valuemax": value2, "aria-valuenow": lowerValue, "aria-valuetext": getAriaValueText(lowerValue), "aria-label": "min ".concat(ariaLabel2 || label2) }) : void 0; + var containerProps = { + className: classNames2.container + }; + var sliderLineProps = { + ref: sliderLine, + className: classNames2.line + }; + return { + root: rootProps, + label: labelProps, + sliderBox: sliderBoxProps, + container: containerProps, + valueLabel: valueLabelProps, + lowerValueLabel: lowerValueLabelProps, + thumb: thumbProps, + lowerValueThumb: lowerValueThumbProps, + zeroTick: zeroTickProps, + activeTrack: trackActiveProps, + topInactiveTrack: trackTopInactiveProps, + bottomInactiveTrack: trackBottomInactiveProps, + sliderLine: sliderLineProps + }; + }; + var COMPONENT_NAME$2 = "SliderBase"; + var SliderBase = React__namespace.forwardRef(function(props, ref2) { + var slotProps = useSlider(props, ref2); + return React__namespace.createElement( + "div", + __assign$1({}, slotProps.root), + slotProps && React__namespace.createElement(Label$2, __assign$1({}, slotProps.label)), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.container), + props.ranged && (props.vertical ? slotProps.valueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.valueLabel)) : slotProps.lowerValueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.lowerValueLabel))), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.sliderBox), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.sliderLine), + props.ranged && React__namespace.createElement("span", __assign$1({}, slotProps.lowerValueThumb)), + React__namespace.createElement("span", __assign$1({}, slotProps.thumb)), + slotProps.zeroTick && React__namespace.createElement("span", __assign$1({}, slotProps.zeroTick)), + React__namespace.createElement("span", __assign$1({}, slotProps.bottomInactiveTrack)), + React__namespace.createElement("span", __assign$1({}, slotProps.activeTrack)), + React__namespace.createElement("span", __assign$1({}, slotProps.topInactiveTrack)) + ) + ), + props.ranged && props.vertical ? slotProps.lowerValueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.lowerValueLabel)) : slotProps.valueLabel && React__namespace.createElement(Label$2, __assign$1({}, slotProps.valueLabel)) + ), + React__namespace.createElement(FocusRects, null) + ); + }); + SliderBase.displayName = COMPONENT_NAME$2; + var GlobalClassNames$1 = { + root: "ms-Slider", + enabled: "ms-Slider-enabled", + disabled: "ms-Slider-disabled", + row: "ms-Slider-row", + column: "ms-Slider-column", + container: "ms-Slider-container", + slideBox: "ms-Slider-slideBox", + line: "ms-Slider-line", + thumb: "ms-Slider-thumb", + activeSection: "ms-Slider-active", + inactiveSection: "ms-Slider-inactive", + valueLabel: "ms-Slider-value", + showValue: "ms-Slider-showValue", + showTransitions: "ms-Slider-showTransitions", + zeroTick: "ms-Slider-zeroTick" + }; + var getStyles$3 = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m, _o; + var className2 = props.className, titleLabelClassName = props.titleLabelClassName, theme = props.theme, vertical = props.vertical, disabled = props.disabled, showTransitions = props.showTransitions, showValue = props.showValue, ranged = props.ranged; + var semanticColors = theme.semanticColors, palette = theme.palette; + var classNames2 = getGlobalClassNames(GlobalClassNames$1, theme); + var pressedActiveSectionColor = semanticColors.inputBackgroundCheckedHovered; + var hoveredActiveSectionColor = semanticColors.inputBackgroundChecked; + var hoveredPressedinactiveSectionColor = palette.neutralSecondaryAlt; + var restActiveSectionColor = palette.neutralPrimary; + var restInactiveSectionColor = palette.neutralSecondaryAlt; + var disabledActiveSectionColor = semanticColors.disabledText; + var disabledInactiveSectionColor = semanticColors.disabledBackground; + var thumbBackgroundColor = semanticColors.inputBackground; + var thumbBorderColor = semanticColors.smallInputBorder; + var thumbDisabledBorderColor = semanticColors.disabledBorder; + var slideBoxActiveSectionStyles = !disabled && { + backgroundColor: pressedActiveSectionColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _a2) + }; + var slideBoxInactiveSectionStyles = !disabled && { + backgroundColor: hoveredPressedinactiveSectionColor, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "Highlight" + }, _b2) + }; + var slideHoverSectionStyles = !disabled && { + backgroundColor: hoveredActiveSectionColor, + selectors: (_c2 = {}, _c2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _c2) + }; + var slideBoxActiveThumbStyles = !disabled && { + border: "2px solid ".concat(pressedActiveSectionColor), + selectors: (_d2 = {}, _d2[HighContrastSelector] = { + borderColor: "Highlight" + }, _d2) + }; + var slideBoxActiveZeroTickStyles = !props.disabled && { + backgroundColor: semanticColors.inputPlaceholderBackgroundChecked, + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _e2) + }; + return { + root: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([ + classNames2.root, + theme.fonts.medium, + { + userSelect: "none" + }, + vertical && { + marginRight: 8 } - var firstFocusableChild = null; - if (typeof firstFocusableTarget === 'string') firstFocusableChild = root.current.querySelector(firstFocusableTarget); - else if (firstFocusableTarget) firstFocusableChild = firstFocusableTarget(root.current); - else if (firstFocusableSelector) { - var focusSelector = typeof firstFocusableSelector === 'string' ? firstFocusableSelector : firstFocusableSelector(); - firstFocusableChild = root.current.querySelector('.' + focusSelector); + ], [!disabled ? classNames2.enabled : void 0], false), [disabled ? classNames2.disabled : void 0], false), [!vertical ? classNames2.row : void 0], false), [vertical ? classNames2.column : void 0], false), [ + className2 + ], false), + titleLabel: [ + { + padding: 0 + }, + titleLabelClassName + ], + container: [ + classNames2.container, + { + display: "flex", + flexWrap: "nowrap", + alignItems: "center" + }, + vertical && { + flexDirection: "column", + height: "100%", + textAlign: "center", + margin: "8px 0" + } + ], + slideBox: __spreadArray(__spreadArray([ + classNames2.slideBox, + !ranged && getFocusStyle(theme), + { + background: "transparent", + border: "none", + flexGrow: 1, + lineHeight: 28, + display: "flex", + alignItems: "center", + selectors: (_f = {}, _f[":active .".concat(classNames2.activeSection)] = slideBoxActiveSectionStyles, _f[":hover .".concat(classNames2.activeSection)] = slideHoverSectionStyles, _f[":active .".concat(classNames2.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":hover .".concat(classNames2.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":active .".concat(classNames2.thumb)] = slideBoxActiveThumbStyles, _f[":hover .".concat(classNames2.thumb)] = slideBoxActiveThumbStyles, _f[":active .".concat(classNames2.zeroTick)] = slideBoxActiveZeroTickStyles, _f[":hover .".concat(classNames2.zeroTick)] = slideBoxActiveZeroTickStyles, _f[HighContrastSelector] = { + forcedColorAdjust: "none" + }, _f) + }, + vertical ? { + height: "100%", + width: 28, + padding: "8px 0" + // Make room for thumb at bottom of line + } : { + height: 28, + width: "auto", + padding: "0 8px" + // Make room for thumb at ends of line + } + ], [showValue ? classNames2.showValue : void 0], false), [showTransitions ? classNames2.showTransitions : void 0], false), + thumb: [ + classNames2.thumb, + ranged && getFocusStyle(theme, { inset: -4 }), + { + borderWidth: 2, + borderStyle: "solid", + borderColor: thumbBorderColor, + borderRadius: 10, + boxSizing: "border-box", + background: thumbBackgroundColor, + display: "block", + width: 16, + height: 16, + position: "absolute" + }, + vertical ? { + left: -6, + margin: "0 auto", + transform: "translateY(8px)" + } : { + top: -6, + transform: getRTL(theme) ? "translateX(50%)" : "translateX(-50%)" + }, + showTransitions && { + transition: "left ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction1) + }, + disabled && { + borderColor: thumbDisabledBorderColor, + selectors: (_g = {}, _g[HighContrastSelector] = { + borderColor: "GrayText" + }, _g) + } + ], + line: [ + classNames2.line, + { + display: "flex", + position: "relative" + }, + vertical ? { + height: "100%", + width: 4, + margin: "0 auto", + flexDirection: "column-reverse" + } : { + width: "100%" } - // Fall back to first element if query selector did not match any elements. - if (!firstFocusableChild) firstFocusableChild = (0, _utilities.getNextElement)(root.current, root.current.firstChild, false, false, false, true, undefined, undefined, undefined, inShadow); - if (firstFocusableChild) focusElementAsync(firstFocusableChild); - }); - /** Used in root div focus/blur handlers */ var focusBumper = function(isFirstBumper) { - if (disabled || !root.current) return; - var nextFocusable = isFirstBumper === internalState.hasFocus ? (0, _utilities.getLastTabbable)(root.current, lastBumper.current, true, false, inShadow) : (0, _utilities.getFirstTabbable)(root.current, firstBumper.current, true, false, inShadow); - if (nextFocusable) { - if (nextFocusable === firstBumper.current || nextFocusable === lastBumper.current) // This can happen when FTZ contains no tabbable elements. - // focusFTZ() will take care of finding a focusable element in FTZ. - focusFTZ(); - else nextFocusable.focus(); - } - }; - /** Root div blur handler (doesn't need useCallback since it's for a native element) */ var onRootBlurCapture = function(ev) { - var _a; - (_a = props.onBlurCapture) === null || _a === void 0 || _a.call(props, ev); - var relatedTarget = ev.relatedTarget; - if (ev.relatedTarget === null) // In IE11, due to lack of support, event.relatedTarget is always - // null making every onBlur call to be "outside" of the root - // even when it's not. Using document.activeElement is another way - // for us to be able to get what the relatedTarget without relying - // on the event - relatedTarget = (0, _utilities.getActiveElement)(doc); - if (!(0, _utilities.elementContains)(root.current, relatedTarget)) internalState.hasFocus = false; - }; - /** Root div focus handler (doesn't need useCallback since it's for a native element) */ var onRootFocusCapture = function(ev) { - var _a; - (_a = props.onFocusCapture) === null || _a === void 0 || _a.call(props, ev); - if (ev.target === firstBumper.current) focusBumper(true); - else if (ev.target === lastBumper.current) focusBumper(false); - internalState.hasFocus = true; - if (ev.target !== ev.currentTarget && !(ev.target === firstBumper.current || ev.target === lastBumper.current)) // every time focus changes within the trap zone, remember the focused element so that - // it can be restored if focus leaves the pane and returns via keystroke (i.e. via a call to this.focus(true)) - internalState.previouslyFocusedElementInTrapZone = (0, _utilities.getEventTarget)(ev.nativeEvent); - }; - /** Called to restore focus on unmount or props change. (useEventCallback ensures latest prop values are used.) */ var returnFocusToInitiator = (0, _reactHooks.useEventCallback)(function(elementToFocusOnDismiss) { - FocusTrapZone.focusStack = FocusTrapZone.focusStack.filter(function(value) { - return internalState.focusStackId !== value; - }); - if (!doc) return; - // Do not use getActiveElement() here. - // When the FTZ is in shadow DOM focus returns to the - // shadow host rather than body so we need to be - // able to inspect that - var activeElement = doc.activeElement; - if (!disableRestoreFocus && typeof (elementToFocusOnDismiss === null || elementToFocusOnDismiss === void 0 ? void 0 : elementToFocusOnDismiss.focus) === 'function' && // only restore focus if the current focused element is within the FTZ, or if nothing is focused - ((0, _utilities.elementContains)(root.current, activeElement) || activeElement === doc.body || activeElement.shadowRoot)) focusElementAsync(elementToFocusOnDismiss); - }); - /** Called in window event handlers. (useEventCallback ensures latest prop values are used.) */ var forceFocusOrClickInTrap = (0, _reactHooks.useEventCallback)(function(ev) { - // be sure to use the latest values here - if (disabled) return; - if (internalState.focusStackId === FocusTrapZone.focusStack.slice(-1)[0]) { - var targetElement = (0, _utilities.getEventTarget)(ev); - if (targetElement && !(0, _utilities.elementContains)(root.current, targetElement)) { - if (doc && (0, _utilities.getActiveElement)(doc) === doc.body) setTimeout(function() { - if (doc && (0, _utilities.getActiveElement)(doc) === doc.body) { - focusFTZ(); - internalState.hasFocus = true; // set focus here since we stop event propagation - } - }, 0); - else { - focusFTZ(); - internalState.hasFocus = true; // set focus here since we stop event propagation - } - ev.preventDefault(); - ev.stopPropagation(); - } + ], + lineContainer: [ + { + borderRadius: 4, + boxSizing: "border-box" + }, + vertical ? { + width: 4, + height: "100%" + } : { + height: 4, + width: "100%" } - }); - // Update window event handlers when relevant props change - _react.useEffect(function() { - var disposables = []; - if (forceFocusInsideTrap) disposables.push((0, _utilities.on)(win, 'focus', forceFocusOrClickInTrap, true)); - if (!isClickableOutsideFocusTrap) disposables.push((0, _utilities.on)(win, 'click', forceFocusOrClickInTrap, true)); - return function() { - disposables.forEach(function(dispose) { - return dispose(); - }); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run when these two props change - }, [ - forceFocusInsideTrap, - isClickableOutsideFocusTrap, - win - ]); - // On prop change or first render, focus the FTZ and update focusStack if appropriate - _react.useEffect(function() { - // Do nothing if disabled, or if it's a re-render and forceFocusInsideTrap is false - // (to match existing behavior, the FTZ handles first focus even if forceFocusInsideTrap - // is false, though it's debatable whether it should do this) - if (disabled || !isFirstRender && !forceFocusInsideTrap || !root.current) return; - // Transition from forceFocusInsideTrap / FTZ disabled to enabled (or initial mount) - FocusTrapZone.focusStack.push(internalState.focusStackId); - var elementToFocusOnDismiss = props.elementToFocusOnDismiss || (0, _utilities.getActiveElement)(doc); - if (!disableFirstFocus && !(0, _utilities.elementContains)(root.current, elementToFocusOnDismiss)) focusFTZ(); - // To match existing behavior, always return focus on cleanup (even if we didn't handle - // initial focus), but it's debatable whether that's correct - return function() { - return returnFocusToInitiator(elementToFocusOnDismiss); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps -- should only run when these two props change - }, [ - forceFocusInsideTrap, - disabled - ]); - // Handle modalization separately from first focus - _react.useEffect(function() { - if (!disabled && enableAriaHiddenSiblings) { - var unmodalize = (0, _utilities.modalize)(root.current); - return unmodalize; + ], + activeSection: [ + classNames2.activeSection, + { + background: restActiveSectionColor, + selectors: (_h = {}, _h[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _h) + }, + showTransitions && { + transition: "width ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction1) + }, + disabled && { + background: disabledActiveSectionColor, + selectors: (_j = {}, _j[HighContrastSelector] = { + backgroundColor: "GrayText", + borderColor: "GrayText" + }, _j) + } + ], + inactiveSection: [ + classNames2.inactiveSection, + { + background: restInactiveSectionColor, + selectors: (_k = {}, _k[HighContrastSelector] = { + border: "1px solid WindowText" + }, _k) + }, + showTransitions && { + transition: "width ".concat(AnimationVariables.durationValue3, " ").concat(AnimationVariables.easeFunction1) + }, + disabled && { + background: disabledInactiveSectionColor, + selectors: (_l = {}, _l[HighContrastSelector] = { + borderColor: "GrayText" + }, _l) + } + ], + zeroTick: [ + classNames2.zeroTick, + { + position: "absolute", + background: semanticColors.disabledBorder, + selectors: (_m = {}, _m[HighContrastSelector] = { + backgroundColor: "WindowText" + }, _m) + }, + props.disabled && { + background: semanticColors.disabledBackground, + selectors: (_o = {}, _o[HighContrastSelector] = { + backgroundColor: "GrayText" + }, _o) + }, + props.vertical ? { + width: "16px", + height: "1px", + transform: getRTL(theme) ? "translateX(6px)" : "translateX(-6px)" + } : { + width: "1px", + height: "16px", + transform: "translateY(-6px)" } - }, [ - disabled, - enableAriaHiddenSiblings, - root - ]); - // Cleanup lifecyle method for internalState. - (0, _reactHooks.useUnmount)(function() { - // Dispose of element references so the DOM Nodes can be garbage-collected - delete internalState.previouslyFocusedElementInTrapZone; + ], + valueLabel: [ + classNames2.valueLabel, + { + flexShrink: 1, + width: 30, + lineHeight: "1" + // using a string here meaning it's relative to the size of the font + }, + vertical ? { + margin: "0 auto", + whiteSpace: "nowrap", + width: 40 + } : { + margin: "0 8px", + whiteSpace: "nowrap", + width: 40 + } + ] + }; + }; + var Slider = styled(SliderBase, getStyles$3, void 0, { + scope: "Slider" + }); + var SpinnerSize; + (function(SpinnerSize2) { + SpinnerSize2[SpinnerSize2["xSmall"] = 0] = "xSmall"; + SpinnerSize2[SpinnerSize2["small"] = 1] = "small"; + SpinnerSize2[SpinnerSize2["medium"] = 2] = "medium"; + SpinnerSize2[SpinnerSize2["large"] = 3] = "large"; + })(SpinnerSize || (SpinnerSize = {})); + var SpinnerType; + (function(SpinnerType2) { + SpinnerType2[SpinnerType2["normal"] = 0] = "normal"; + SpinnerType2[SpinnerType2["large"] = 1] = "large"; + })(SpinnerType || (SpinnerType = {})); + var getClassNames$2 = classNamesFunction(); + var SpinnerBase = ( + /** @class */ + (function(_super) { + __extends(SpinnerBase2, _super); + function SpinnerBase2() { + return _super !== null && _super.apply(this, arguments) || this; + } + SpinnerBase2.prototype.render = function() { + var _a2 = this.props, type2 = _a2.type, size = _a2.size, ariaLabel2 = _a2.ariaLabel, ariaLive = _a2.ariaLive, styles = _a2.styles, label2 = _a2.label, theme = _a2.theme, className2 = _a2.className, labelPosition = _a2.labelPosition; + var statusMessage = ariaLabel2; + var nativeProps = getNativeProps(this.props, divProperties, ["size"]); + var styleSize = size; + if (styleSize === void 0 && type2 !== void 0) { + styleSize = type2 === SpinnerType.large ? SpinnerSize.large : SpinnerSize.medium; + } + var classNames2 = getClassNames$2(styles, { + theme, + size: styleSize, + className: className2, + labelPosition + }); + return React__namespace.createElement( + "div", + __assign$1({}, nativeProps, { className: classNames2.root }), + React__namespace.createElement("div", { className: classNames2.circle }), + label2 && React__namespace.createElement("div", { className: classNames2.label }, label2), + statusMessage && React__namespace.createElement( + "div", + { role: "status", "aria-live": ariaLive }, + React__namespace.createElement( + DelayedRender, + null, + React__namespace.createElement("div", { className: classNames2.screenReaderText }, statusMessage) + ) + ) + ); + }; + SpinnerBase2.defaultProps = { + size: SpinnerSize.medium, + ariaLive: "polite", + labelPosition: "bottom" + }; + return SpinnerBase2; + })(React__namespace.Component) + ); + var GlobalClassNames = { + root: "ms-Spinner", + circle: "ms-Spinner-circle", + label: "ms-Spinner-label" + }; + var spinAnimation = memoizeFunction(function() { + return keyframes({ + "0%": { + transform: "rotate(0deg)" + }, + "100%": { + transform: "rotate(360deg)" + } }); - useComponentRef(componentRef, internalState.previouslyFocusedElementInTrapZone, focusFTZ); - return _react.createElement("div", (0, _tslib.__assign)({ - "aria-labelledby": props.ariaLabelledBy - }, (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)), { - ref: mergedRootRef, - onFocusCapture: onRootFocusCapture, - onBlurCapture: onRootBlurCapture - }), _react.createElement("div", (0, _tslib.__assign)({}, bumperProps, { - ref: firstBumper - })), children, _react.createElement("div", (0, _tslib.__assign)({}, bumperProps, { - ref: lastBumper - }))); -}); -FocusTrapZone.displayName = COMPONENT_NAME; -FocusTrapZone.focusStack = []; - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@fluentui/react-hooks":"2LHjM","../../WindowProvider":"diLL7","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kcVY7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "animationDuration", ()=>animationDuration); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var animationDuration = (0, _styling.AnimationVariables).durationValue2; -var globalClassNames = { - root: 'ms-Modal', - main: 'ms-Dialog-main', - scrollableContent: 'ms-Modal-scrollableContent', - isOpen: 'is-open', - layer: 'ms-Modal-Layer' -}; -var getStyles = function(props) { - var _a; - var className = props.className, containerClassName = props.containerClassName, scrollableContentClassName = props.scrollableContentClassName, isOpen = props.isOpen, isVisible = props.isVisible, hasBeenOpened = props.hasBeenOpened, modalRectangleTop = props.modalRectangleTop, theme = props.theme, topOffsetFixed = props.topOffsetFixed, isModeless = props.isModeless, layerClassName = props.layerClassName, isDefaultDragHandle = props.isDefaultDragHandle, windowInnerHeight = props.windowInnerHeight; - var palette = theme.palette, effects = theme.effects, fonts = theme.fonts; - var classNames = (0, _styling.getGlobalClassNames)(globalClassNames, theme); + }); + var getStyles$2 = function(props) { + var _a2; + var theme = props.theme, size = props.size, className2 = props.className, labelPosition = props.labelPosition; + var palette = theme.palette; + var classNames2 = getGlobalClassNames(GlobalClassNames, theme); return { - root: [ - classNames.root, - fonts.medium, - { - backgroundColor: 'transparent', - position: 'fixed', - height: '100%', - width: '100%', - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - opacity: 0, - pointerEvents: 'none', - transition: "opacity ".concat(animationDuration) - }, - topOffsetFixed && typeof modalRectangleTop === 'number' && hasBeenOpened && { - alignItems: 'flex-start' - }, - isOpen && classNames.isOpen, - isVisible && { - opacity: 1 - }, - isVisible && !isModeless && { - pointerEvents: 'auto' - }, - className - ], - main: [ - classNames.main, - { - boxShadow: effects.elevation64, - borderRadius: effects.roundedCorner2, - backgroundColor: palette.white, - boxSizing: 'border-box', - position: 'relative', - textAlign: 'left', - outline: '3px solid transparent', - maxHeight: 'calc(100% - 32px)', - maxWidth: 'calc(100% - 32px)', - minHeight: '176px', - minWidth: '288px', - overflowY: 'auto', - zIndex: isModeless ? (0, _styling.ZIndexes).Layer : undefined - }, - isModeless && { - pointerEvents: 'auto' - }, - topOffsetFixed && typeof modalRectangleTop === 'number' && hasBeenOpened && { - top: modalRectangleTop - }, - isDefaultDragHandle && { - cursor: 'move' - }, - containerClassName + root: [ + classNames2.root, + { + display: "flex", + flexDirection: "column", + alignItems: "center", + justifyContent: "center" + }, + labelPosition === "top" && { + flexDirection: "column-reverse" + }, + labelPosition === "right" && { + flexDirection: "row" + }, + labelPosition === "left" && { + flexDirection: "row-reverse" + }, + className2 + ], + circle: [ + classNames2.circle, + { + boxSizing: "border-box", + borderRadius: "50%", + borderWidth: "1.5px", + borderStyle: "solid", + borderTopColor: palette.themePrimary, + borderRightColor: palette.themeLight, + borderBottomColor: palette.themeLight, + borderLeftColor: palette.themeLight, + animationName: spinAnimation(), + animationDuration: "1.3s", + animationIterationCount: "infinite", + animationTimingFunction: "cubic-bezier(.53,.21,.29,.67)", + selectors: (_a2 = {}, _a2[HighContrastSelector] = __assign$1({ borderTopColor: "Highlight" }, getHighContrastNoAdjustStyle()), _a2) + }, + size === SpinnerSize.xSmall && [ + "ms-Spinner--xSmall", + { + width: 12, + height: 12 + } ], - scrollableContent: [ - classNames.scrollableContent, - { - overflowY: 'auto', - flexGrow: 1, - maxHeight: '100vh', - selectors: (_a = {}, _a['@supports (-webkit-overflow-scrolling: touch)'] = { - maxHeight: windowInnerHeight - }, _a) - }, - scrollableContentClassName + size === SpinnerSize.small && [ + "ms-Spinner--small", + { + width: 16, + height: 16 + } ], - layer: isModeless && [ - layerClassName, - classNames.layer, - { - pointerEvents: 'none' - } + size === SpinnerSize.medium && [ + "ms-Spinner--medium", + { + width: 20, + height: 20 + } ], - keyboardMoveIconContainer: { - position: 'absolute', - display: 'flex', - justifyContent: 'center', - width: '100%', - padding: '3px 0px' - }, - keyboardMoveIcon: { - // eslint-disable-next-line deprecation/deprecation - fontSize: fonts.xLargePlus.fontSize, - width: '24px' - } - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eCuPP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Overlay/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Overlay/index":"fluGv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fluGv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _overlay = require("./Overlay"); -parcelHelpers.exportAll(_overlay, exports); -var _overlayBase = require("./Overlay.base"); -parcelHelpers.exportAll(_overlayBase, exports); -var _overlayTypes = require("./Overlay.types"); -parcelHelpers.exportAll(_overlayTypes, exports); - -},{"./Overlay":"fMVXG","./Overlay.base":false,"./Overlay.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fMVXG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Overlay", ()=>Overlay); -var _utilities = require("../../Utilities"); -var _overlayBase = require("./Overlay.base"); -var _overlayStyles = require("./Overlay.styles"); -var Overlay = (0, _utilities.styled)((0, _overlayBase.OverlayBase), (0, _overlayStyles.getStyles), undefined, { - scope: 'Overlay' -}); - -},{"../../Utilities":"1NZCy","./Overlay.base":"3Jzwk","./Overlay.styles":"fMY1q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Jzwk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OverlayBase", ()=>OverlayBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var OverlayBase = /** @class */ function(_super) { - (0, _tslib.__extends)(OverlayBase, _super); - function OverlayBase(props) { - var _this = _super.call(this, props) || this; - (0, _utilities.initializeComponentRef)(_this); - var _a = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a === void 0 ? false : _a; - _this._allowTouchBodyScroll = allowTouchBodyScroll; - return _this; - } - OverlayBase.prototype.componentDidMount = function() { - !this._allowTouchBodyScroll && (0, _utilities.disableBodyScroll)(); - }; - OverlayBase.prototype.componentWillUnmount = function() { - !this._allowTouchBodyScroll && (0, _utilities.enableBodyScroll)(); - }; - OverlayBase.prototype.render = function() { - var _a = this.props, isDark = _a.isDarkThemed, className = _a.className, theme = _a.theme, styles = _a.styles; - var divProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)); - var classNames = getClassNames(styles, { - theme: theme, - className: className, - isDark: isDark - }); - return _react.createElement("div", (0, _tslib.__assign)({}, divProps, { - className: classNames.root - })); - }; - return OverlayBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fMY1q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-Overlay', - rootDark: 'ms-Overlay--dark' -}; -var getStyles = function(props) { - var _a; - var className = props.className, theme = props.theme, isNone = props.isNone, isDark = props.isDark; - var palette = theme.palette; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - root: [ - classNames.root, - theme.fonts.medium, - { - backgroundColor: palette.whiteTranslucent40, - top: 0, - right: 0, - bottom: 0, - left: 0, - position: 'absolute', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - border: '1px solid WindowText', - opacity: 0 - }, _a) - }, - isNone && { - visibility: 'hidden' - }, - isDark && [ - classNames.rootDark, - { - backgroundColor: palette.blackTranslucent40 - } - ], - className + size === SpinnerSize.large && [ + "ms-Spinner--large", + { + width: 28, + height: 28 + } ] + ], + label: [ + classNames2.label, + theme.fonts.small, + { + color: palette.themePrimary, + margin: "8px 0 0", + textAlign: "center" + }, + labelPosition === "top" && { + margin: "0 0 8px" + }, + labelPosition === "right" && { + margin: "0 0 0 8px" + }, + labelPosition === "left" && { + margin: "0 8px 0 0" + } + ], + screenReaderText: hiddenContentStyle }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gcdmd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _draggableZone = require("./DraggableZone"); -parcelHelpers.exportAll(_draggableZone, exports); -var _draggableZoneTypes = require("./DraggableZone.types"); -parcelHelpers.exportAll(_draggableZoneTypes, exports); -var _draggableZoneStyles = require("./DraggableZone.styles"); -parcelHelpers.exportAll(_draggableZoneStyles, exports); - -},{"./DraggableZone":"kP7CU","./DraggableZone.types":false,"./DraggableZone.styles":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kP7CU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DraggableZone", ()=>DraggableZone); -var _tslib = require("tslib"); -var _react = require("react"); -var _draggableZoneStyles = require("./DraggableZone.styles"); -var _utilities = require("../../Utilities"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../dom"); -var eventMapping = { - touch: { - start: 'touchstart', - move: 'touchmove', - stop: 'touchend' - }, - mouse: { - start: 'mousedown', - move: 'mousemove', - stop: 'mouseup' - } -}; -var DraggableZone = /** @class */ function(_super) { - (0, _tslib.__extends)(DraggableZone, _super); - function DraggableZone(props) { + }; + var Spinner = styled(SpinnerBase, getStyles$2, void 0, { scope: "Spinner" }); + var getClassNames$1 = classNamesFunction(); + var DEFAULT_STATE_VALUE = ""; + var COMPONENT_NAME$1 = "TextField"; + var REVEAL_ICON_NAME = "RedEye"; + var HIDE_ICON_NAME = "Hide"; + var TextFieldBase = ( + /** @class */ + (function(_super) { + __extends(TextFieldBase2, _super); + function TextFieldBase2(props) { var _this = _super.call(this, props) || this; - _this._currentEventType = eventMapping.mouse; - _this._events = []; - _this._onMouseDown = function(event) { - var onMouseDown = _react.Children.only(_this.props.children).props.onMouseDown; - if (onMouseDown) onMouseDown(event); - _this._currentEventType = eventMapping.mouse; - return _this._onDragStart(event); - }; - _this._onMouseUp = function(event) { - var onMouseUp = _react.Children.only(_this.props.children).props.onMouseUp; - if (onMouseUp) onMouseUp(event); - _this._currentEventType = eventMapping.mouse; - return _this._onDragStop(event); - }; - _this._onTouchStart = function(event) { - var onTouchStart = _react.Children.only(_this.props.children).props.onTouchStart; - if (onTouchStart) onTouchStart(event); - _this._currentEventType = eventMapping.touch; - return _this._onDragStart(event); - }; - _this._onTouchEnd = function(event) { - var onTouchEnd = _react.Children.only(_this.props.children).props.onTouchEnd; - if (onTouchEnd) onTouchEnd(event); - _this._currentEventType = eventMapping.touch; - _this._onDragStop(event); - }; - _this._onDragStart = function(event) { - // Only handle left click for dragging - if (typeof event.button === 'number' && event.button !== 0) return false; - // If the target doesn't match the handleSelector OR - // if the target does match the preventDragSelector, bail out - if (_this.props.handleSelector && !_this._matchesSelector(event.target, _this.props.handleSelector) || _this.props.preventDragSelector && _this._matchesSelector(event.target, _this.props.preventDragSelector)) return; - // Remember the touch identifier if this is a touch event so we can - // distinguish between individual touches in multitouch scenarios - // by remembering which touch point we were given - _this._touchId = _this._getTouchId(event); - var position = _this._getControlPosition(event); - if (position === undefined) return; - var dragData = _this._createDragDataFromPosition(position); - _this.props.onStart && _this.props.onStart(event, dragData); - _this.setState({ - isDragging: true, - lastPosition: position - }); - // hook up the appropriate mouse/touch events to the body to ensure - // smooth dragging - var doc = (0, _dom.getDocumentEx)(_this.context); - _this._events = [ - (0, _utilities.on)(doc.body, _this._currentEventType.move, _this._onDrag, true), - (0, _utilities.on)(doc.body, _this._currentEventType.stop, _this._onDragStop, true) - ]; - }; - _this._onDrag = function(event) { - // Prevent scrolling on mobile devices - if (event.type === 'touchmove') event.preventDefault(); - var position = _this._getControlPosition(event); - if (!position) return; - // create the updated drag data from the position data - var updatedData = _this._createUpdatedDragData(_this._createDragDataFromPosition(position)); - var updatedPosition = updatedData.position; - _this.props.onDragChange && _this.props.onDragChange(event, updatedData); - _this.setState({ - position: updatedPosition, - lastPosition: position - }); - }; - _this._onDragStop = function(event) { - if (!_this.state.isDragging) return; - var position = _this._getControlPosition(event); - if (!position) return; - var baseDragData = _this._createDragDataFromPosition(position); - // Set dragging to false and reset the lastPosition - _this.setState({ - isDragging: false, - lastPosition: undefined - }); - _this.props.onStop && _this.props.onStop(event, baseDragData); - if (_this.props.position) _this.setState({ - position: _this.props.position - }); - // Remove event handlers - _this._events.forEach(function(dispose) { - return dispose(); - }); + _this._textElement = React__namespace.createRef(); + _this._onFocus = function(ev) { + if (_this.props.onFocus) { + _this.props.onFocus(ev); + } + _this.setState({ isFocused: true }, function() { + if (_this.props.validateOnFocusIn) { + _this._validate(_this.value); + } + }); }; + _this._onBlur = function(ev) { + if (_this.props.onBlur) { + _this.props.onBlur(ev); + } + _this.setState({ isFocused: false }, function() { + if (_this.props.validateOnFocusOut) { + _this._validate(_this.value); + } + }); + }; + _this._onRenderLabel = function(props2) { + var label2 = props2.label, required2 = props2.required; + var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : void 0; + if (label2) { + return React__namespace.createElement(Label$2, { required: required2, htmlFor: _this._id, styles: labelStyles, disabled: props2.disabled, id: _this._labelId }, props2.label); + } + return null; + }; + _this._onRenderDescription = function(props2) { + if (props2.description) { + return React__namespace.createElement("span", { className: _this._classNames.description }, props2.description); + } + return null; + }; + _this._onRevealButtonClick = function(event2) { + _this.setState(function(prevState) { + return { isRevealingPassword: !prevState.isRevealingPassword }; + }); + }; + _this._onInputChange = function(event2) { + var _a22, _b2; + var element2 = event2.target; + var value2 = element2.value; + var previousValue = _getValue(_this.props, _this.state) || ""; + if (value2 === void 0 || value2 === _this._lastChangeValue || value2 === previousValue) { + _this._lastChangeValue = void 0; + return; + } + _this._lastChangeValue = value2; + (_b2 = (_a22 = _this.props).onChange) === null || _b2 === void 0 ? void 0 : _b2.call(_a22, event2, value2); + if (!_this._isControlled) { + _this.setState({ uncontrolledValue: value2 }); + } + }; + initializeComponentRef(_this); + _this._async = new Async(_this); + _this._fallbackId = getId(COMPONENT_NAME$1); + _this._descriptionId = getId(COMPONENT_NAME$1 + "Description"); + _this._labelId = getId(COMPONENT_NAME$1 + "Label"); + _this._prefixId = getId(COMPONENT_NAME$1 + "Prefix"); + _this._suffixId = getId(COMPONENT_NAME$1 + "Suffix"); + _this._warnControlledUsage(); + var _a2 = props.defaultValue, defaultValue = _a2 === void 0 ? DEFAULT_STATE_VALUE : _a2; + if (typeof defaultValue === "number") { + defaultValue = String(defaultValue); + } _this.state = { - isDragging: false, - position: _this.props.position || { - x: 0, - y: 0 - }, - lastPosition: undefined + uncontrolledValue: _this._isControlled ? void 0 : defaultValue, + isFocused: false, + errorMessage: "" }; + _this._delayedValidate = _this._async.debounce(_this._validate, _this.props.deferredValidationTime); + _this._lastValidation = 0; return _this; - } - DraggableZone.prototype.componentDidUpdate = function(prevProps) { - if (this.props.position && (!prevProps.position || this.props.position !== prevProps.position)) this.setState({ - position: this.props.position - }); - }; - DraggableZone.prototype.componentWillUnmount = function() { - this._events.forEach(function(dispose) { - return dispose(); + } + Object.defineProperty(TextFieldBase2.prototype, "value", { + /** + * Gets the current value of the text field. + */ + get: function() { + return _getValue(this.props, this.state); + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype.componentDidMount = function() { + this._adjustInputHeight(); + if (this.props.validateOnLoad) { + this._validate(this.value); + } + }; + TextFieldBase2.prototype.componentWillUnmount = function() { + this._async.dispose(); + }; + TextFieldBase2.prototype.getSnapshotBeforeUpdate = function(prevProps, prevState) { + return { + selection: [this.selectionStart, this.selectionEnd] + }; + }; + TextFieldBase2.prototype.componentDidUpdate = function(prevProps, prevState, snapshot) { + var props = this.props; + var _a2 = (snapshot || {}).selection, selection = _a2 === void 0 ? [null, null] : _a2; + var start = selection[0], end = selection[1]; + if (!!prevProps.multiline !== !!props.multiline && prevState.isFocused) { + this.focus(); + if (start !== null && end !== null && start >= 0 && end >= 0) { + this.setSelectionRange(start, end); + } + } + if (prevProps.value !== props.value) { + this._lastChangeValue = void 0; + } + var prevValue = _getValue(prevProps, prevState); + var value2 = this.value; + if (prevValue !== value2) { + this._warnControlledUsage(prevProps); + if (this.state.errorMessage && !props.errorMessage) { + this.setState({ errorMessage: "" }); + } + this._adjustInputHeight(); + if (_shouldValidateAllChanges(props)) { + this._delayedValidate(value2); + } + } + }; + TextFieldBase2.prototype.render = function() { + var _a2 = this.props, borderless = _a2.borderless, className2 = _a2.className, disabled = _a2.disabled, invalid = _a2.invalid, iconProps = _a2.iconProps, inputClassName = _a2.inputClassName, label2 = _a2.label, multiline = _a2.multiline, required2 = _a2.required, underlined = _a2.underlined, prefix = _a2.prefix, resizable = _a2.resizable, suffix = _a2.suffix, theme = _a2.theme, styles = _a2.styles, autoAdjustHeight = _a2.autoAdjustHeight, canRevealPassword = _a2.canRevealPassword, revealPasswordAriaLabel = _a2.revealPasswordAriaLabel, type2 = _a2.type, _b2 = _a2.onRenderPrefix, onRenderPrefix = _b2 === void 0 ? this._onRenderPrefix : _b2, _c2 = _a2.onRenderSuffix, onRenderSuffix = _c2 === void 0 ? this._onRenderSuffix : _c2, _d2 = _a2.onRenderLabel, onRenderLabel = _d2 === void 0 ? this._onRenderLabel : _d2, _e2 = _a2.onRenderDescription, onRenderDescription = _e2 === void 0 ? this._onRenderDescription : _e2; + var _f = this.state, isFocused = _f.isFocused, isRevealingPassword = _f.isRevealingPassword; + var errorMessage = this._errorMessage; + var isInvalid = typeof invalid === "boolean" ? invalid : !!errorMessage; + var hasRevealButton = !!canRevealPassword && type2 === "password" && _browserNeedsRevealButton(); + var classNames2 = this._classNames = getClassNames$1(styles, { + theme, + className: className2, + disabled, + focused: isFocused, + required: required2, + multiline, + hasLabel: !!label2, + hasErrorMessage: isInvalid, + borderless, + resizable, + hasIcon: !!iconProps, + underlined, + inputClassName, + autoAdjustHeight, + hasRevealButton }); - }; - DraggableZone.prototype.render = function() { - var child = _react.Children.only(this.props.children); - var props = child.props; - var position = this.props.position; - var _a = this.state, statePosition = _a.position, isDragging = _a.isDragging; - var x = statePosition.x; - var y = statePosition.y; - if (position && !isDragging) { - x = position.x; - y = position.y; - } - return _react.cloneElement(child, { - style: (0, _tslib.__assign)((0, _tslib.__assign)({}, props.style), { - transform: "translate(".concat(x, "px, ").concat(y, "px)") - }), - className: (0, _draggableZoneStyles.getClassNames)(props.className, this.state.isDragging).root, - onMouseDown: this._onMouseDown, - onMouseUp: this._onMouseUp, - onTouchStart: this._onTouchStart, - onTouchEnd: this._onTouchEnd + return ( + // eslint-disable-next-line @typescript-eslint/no-deprecated + React__namespace.createElement( + "div", + { ref: this.props.elementRef, className: classNames2.root }, + React__namespace.createElement( + "div", + { className: classNames2.wrapper }, + onRenderLabel(this.props, this._onRenderLabel), + React__namespace.createElement( + "div", + { className: classNames2.fieldGroup }, + (prefix !== void 0 || this.props.onRenderPrefix) && React__namespace.createElement("div", { className: classNames2.prefix, id: this._prefixId }, onRenderPrefix(this.props, this._onRenderPrefix)), + multiline ? this._renderTextArea() : this._renderInput(), + iconProps && React__namespace.createElement(Icon, __assign$1({ className: classNames2.icon }, iconProps)), + hasRevealButton && // Explicitly set type="button" since the default button type within a form is "submit" + React__namespace.createElement( + "button", + { "aria-label": revealPasswordAriaLabel, className: classNames2.revealButton, onClick: this._onRevealButtonClick, "aria-pressed": !!isRevealingPassword, type: "button" }, + React__namespace.createElement( + "span", + { className: classNames2.revealSpan }, + React__namespace.createElement(Icon, { className: classNames2.revealIcon, iconName: isRevealingPassword ? HIDE_ICON_NAME : REVEAL_ICON_NAME }) + ) + ), + (suffix !== void 0 || this.props.onRenderSuffix) && React__namespace.createElement("div", { className: classNames2.suffix, id: this._suffixId }, onRenderSuffix(this.props, this._onRenderSuffix)) + ) + ), + this._isDescriptionAvailable && React__namespace.createElement( + "span", + { id: this._descriptionId }, + onRenderDescription(this.props, this._onRenderDescription), + errorMessage && React__namespace.createElement( + "div", + { role: "alert" }, + React__namespace.createElement(DelayedRender, null, this._renderErrorMessage()) + ) + ) + ) + ); + }; + TextFieldBase2.prototype.focus = function() { + if (this._textElement.current) { + this._textElement.current.focus(); + } + }; + TextFieldBase2.prototype.blur = function() { + if (this._textElement.current) { + this._textElement.current.blur(); + } + }; + TextFieldBase2.prototype.select = function() { + if (this._textElement.current) { + this._textElement.current.select(); + } + }; + TextFieldBase2.prototype.setSelectionStart = function(value2) { + if (this._textElement.current) { + this._textElement.current.selectionStart = value2; + } + }; + TextFieldBase2.prototype.setSelectionEnd = function(value2) { + if (this._textElement.current) { + this._textElement.current.selectionEnd = value2; + } + }; + Object.defineProperty(TextFieldBase2.prototype, "selectionStart", { + /** + * Gets the selection start of the text field + */ + get: function() { + return this._textElement.current ? this._textElement.current.selectionStart : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextFieldBase2.prototype, "selectionEnd", { + /** + * Gets the selection end of the text field + */ + get: function() { + return this._textElement.current ? this._textElement.current.selectionEnd : -1; + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype.setSelectionRange = function(start, end) { + if (this._textElement.current) { + this._textElement.current.setSelectionRange(start, end); + } + }; + TextFieldBase2.prototype._warnControlledUsage = function(prevProps) { + warnControlledUsage({ + componentId: this._id, + props: this.props }); - }; - /** - * Get the control position based off the event that fired - * @param event - The event to get offsets from - */ DraggableZone.prototype._getControlPosition = function(event) { - var touchObj = this._getActiveTouch(event); - // did we get the right touch? - if (this._touchId !== undefined && !touchObj) return undefined; - var eventToGetOffset = touchObj || event; - return { - x: eventToGetOffset.clientX, - y: eventToGetOffset.clientY + if (this.props.value === null && !this._hasWarnedNullValue) { + this._hasWarnedNullValue = true; + warn$1("Warning: 'value' prop on '".concat(COMPONENT_NAME$1, "' should not be null. Consider using an ") + "empty string to clear the component or undefined to indicate an uncontrolled component."); + } + }; + Object.defineProperty(TextFieldBase2.prototype, "_id", { + /** Returns `props.id` if available, or a fallback if not. */ + get: function() { + return this.props.id || this._fallbackId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextFieldBase2.prototype, "_isControlled", { + get: function() { + return isControlled(this.props, "value"); + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype._onRenderPrefix = function(props) { + var prefix = props.prefix; + return React__namespace.createElement("span", { style: { paddingBottom: "1px" } }, prefix); + }; + TextFieldBase2.prototype._onRenderSuffix = function(props) { + var suffix = props.suffix; + return React__namespace.createElement("span", { style: { paddingBottom: "1px" } }, suffix); + }; + Object.defineProperty(TextFieldBase2.prototype, "_errorMessage", { + /** + * Current error message from either `props.errorMessage` or the result of `props.onGetErrorMessage`. + * + * - If there is no validation error or we have not validated the input value, errorMessage is an empty string. + * - If we have done the validation and there is validation error, errorMessage is the validation error message. + */ + get: function() { + var _a2 = this.props.errorMessage, errorMessage = _a2 === void 0 ? this.state.errorMessage : _a2; + return errorMessage || ""; + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype._renderErrorMessage = function() { + var errorMessage = this._errorMessage; + return errorMessage ? typeof errorMessage === "string" ? React__namespace.createElement( + "p", + { className: this._classNames.errorMessage }, + React__namespace.createElement("span", { "data-automation-id": "error-message" }, errorMessage) + ) : React__namespace.createElement("div", { className: this._classNames.errorMessage, "data-automation-id": "error-message" }, errorMessage) : null; + }; + Object.defineProperty(TextFieldBase2.prototype, "_isDescriptionAvailable", { + /** + * If a custom description render function is supplied then treat description as always available. + * Otherwise defer to the presence of description or error message text. + */ + get: function() { + var props = this.props; + return !!(props.onRenderDescription || props.description || this._errorMessage); + }, + enumerable: false, + configurable: true + }); + TextFieldBase2.prototype._renderTextArea = function() { + var _a2 = this.props.invalid, invalid = _a2 === void 0 ? !!this._errorMessage : _a2; + var textAreaProps = getNativeProps(this.props, textAreaProperties, ["defaultValue"]); + var ariaLabelledBy = this.props["aria-labelledby"] || (this.props.label ? this._labelId : void 0); + return React__namespace.createElement("textarea", __assign$1({ id: this._id }, textAreaProps, { ref: this._textElement, value: this.value || "", onInput: this._onInputChange, onChange: this._onInputChange, className: this._classNames.field, "aria-labelledby": ariaLabelledBy, "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props["aria-describedby"], "aria-invalid": invalid, "aria-label": this.props.ariaLabel, readOnly: this.props.readOnly, onFocus: this._onFocus, onBlur: this._onBlur })); + }; + TextFieldBase2.prototype._renderInput = function() { + var _a2 = this.props, ariaLabel2 = _a2.ariaLabel, _b2 = _a2.invalid, invalid = _b2 === void 0 ? !!this._errorMessage : _b2, onRenderPrefix = _a2.onRenderPrefix, onRenderSuffix = _a2.onRenderSuffix, prefix = _a2.prefix, suffix = _a2.suffix, _c2 = _a2.type, type2 = _c2 === void 0 ? "text" : _c2, label2 = _a2.label; + var labelIds = []; + label2 && labelIds.push(this._labelId); + (prefix !== void 0 || onRenderPrefix) && labelIds.push(this._prefixId); + (suffix !== void 0 || onRenderSuffix) && labelIds.push(this._suffixId); + var inputProps = __assign$1(__assign$1({ type: this.state.isRevealingPassword ? "text" : type2, id: this._id }, getNativeProps(this.props, inputProperties, ["defaultValue", "type"])), { "aria-labelledby": this.props["aria-labelledby"] || (labelIds.length > 0 ? labelIds.join(" ") : void 0), ref: this._textElement, value: this.value || "", onInput: this._onInputChange, onChange: this._onInputChange, className: this._classNames.field, "aria-label": ariaLabel2, "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props["aria-describedby"], "aria-invalid": invalid, onFocus: this._onFocus, onBlur: this._onBlur }); + var defaultRender = function(updatedInputProps) { + return React__namespace.createElement("input", __assign$1({}, updatedInputProps)); }; - }; - /** - * Get the active touch point that we have saved from the event's TouchList - * @param event - The event used to get the TouchList for the active touch point - */ DraggableZone.prototype._getActiveTouch = function(event) { - return event.targetTouches && this._findTouchInTouchList(event.targetTouches) || event.changedTouches && this._findTouchInTouchList(event.changedTouches); - }; - /** - * Get the initial touch identifier associated with the given event - * @param event - The event that contains the TouchList - */ DraggableZone.prototype._getTouchId = function(event) { - var touch = event.targetTouches && event.targetTouches[0] || event.changedTouches && event.changedTouches[0]; - if (touch) return touch.identifier; - }; - /** - * Returns if an element (or any of the element's parents) match the given selector - */ DraggableZone.prototype._matchesSelector = function(element, selector) { - var _a; - if (!element || element === ((_a = (0, _dom.getDocumentEx)(this.context)) === null || _a === void 0 ? void 0 : _a.body)) return false; - var matchesSelectorFn = // eslint-disable-next-line deprecation/deprecation - element.matches || element.webkitMatchesSelector || element.msMatchesSelector; /* for IE */ - if (!matchesSelectorFn) return false; - return matchesSelectorFn.call(element, selector) || this._matchesSelector(element.parentElement, selector); - }; - /** - * Attempts to find the Touch that matches the identifier we stored in dragStart - * @param touchList The TouchList to look for the stored identifier from dragStart - */ DraggableZone.prototype._findTouchInTouchList = function(touchList) { - if (this._touchId === undefined) return; - for(var i = 0; i < touchList.length; i++){ - if (touchList[i].identifier === this._touchId) return touchList[i]; + var onRenderInput = this.props.onRenderInput || defaultRender; + return onRenderInput(inputProps, defaultRender); + }; + TextFieldBase2.prototype._validate = function(value2) { + var _this = this; + if (this._latestValidateValue === value2 && _shouldValidateAllChanges(this.props)) { + return; + } + this._latestValidateValue = value2; + var onGetErrorMessage = this.props.onGetErrorMessage; + var result = onGetErrorMessage && onGetErrorMessage(value2 || ""); + if (result !== void 0) { + if (typeof result === "string" || !("then" in result)) { + this.setState({ errorMessage: result }); + this._notifyAfterValidate(value2, result); + } else { + var currentValidation_1 = ++this._lastValidation; + result.then(function(errorMessage) { + if (currentValidation_1 === _this._lastValidation) { + _this.setState({ errorMessage }); + } + _this._notifyAfterValidate(value2, errorMessage); + }); + } + } else { + this._notifyAfterValidate(value2, ""); } - return undefined; + }; + TextFieldBase2.prototype._notifyAfterValidate = function(value2, errorMessage) { + if (value2 === this.value && this.props.onNotifyValidationResult) { + this.props.onNotifyValidationResult(errorMessage, value2); + } + }; + TextFieldBase2.prototype._adjustInputHeight = function() { + var _a2, _b2; + if (this._textElement.current && this.props.autoAdjustHeight && this.props.multiline) { + var scrollTop = (_b2 = (_a2 = this.props.scrollContainerRef) === null || _a2 === void 0 ? void 0 : _a2.current) === null || _b2 === void 0 ? void 0 : _b2.scrollTop; + var textField = this._textElement.current; + textField.style.height = ""; + textField.style.height = textField.scrollHeight + "px"; + if (scrollTop) { + this.props.scrollContainerRef.current.scrollTop = scrollTop; + } + } + }; + TextFieldBase2.defaultProps = { + resizable: true, + deferredValidationTime: 200, + validateOnLoad: true + }; + return TextFieldBase2; + })(React__namespace.Component) + ); + function _getValue(props, state) { + var _a2 = props.value, value2 = _a2 === void 0 ? state.uncontrolledValue : _a2; + if (typeof value2 === "number") { + return String(value2); + } + return value2; + } + function _shouldValidateAllChanges(props) { + return !(props.validateOnFocusIn || props.validateOnFocusOut); + } + var __browserNeedsRevealButton; + function _browserNeedsRevealButton() { + if (typeof __browserNeedsRevealButton !== "boolean") { + var win = getWindow(); + if (win === null || win === void 0 ? void 0 : win.navigator) { + var isEdge = /Edg/.test(win.navigator.userAgent || ""); + __browserNeedsRevealButton = !(isIE11() || isEdge); + } else { + __browserNeedsRevealButton = true; + } + } + return __browserNeedsRevealButton; + } + var globalClassNames = { + root: "ms-TextField", + description: "ms-TextField-description", + errorMessage: "ms-TextField-errorMessage", + field: "ms-TextField-field", + fieldGroup: "ms-TextField-fieldGroup", + prefix: "ms-TextField-prefix", + suffix: "ms-TextField-suffix", + wrapper: "ms-TextField-wrapper", + revealButton: "ms-TextField-reveal", + multiline: "ms-TextField--multiline", + borderless: "ms-TextField--borderless", + underlined: "ms-TextField--underlined", + unresizable: "ms-TextField--unresizable", + required: "is-required", + disabled: "is-disabled", + active: "is-active" + }; + function getLabelStyles(props) { + var underlined = props.underlined, disabled = props.disabled, focused = props.focused, theme = props.theme; + var palette = theme.palette, fonts = theme.fonts; + return function() { + var _a2; + return { + root: [ + underlined && disabled && { + color: palette.neutralTertiary + }, + underlined && { + fontSize: fonts.medium.fontSize, + marginRight: 8, + paddingLeft: 12, + paddingRight: 0, + lineHeight: "22px", + height: 32 + }, + underlined && focused && { + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + height: 31 + // -1px to prevent jumpiness in HC with the increased border-width to 2px + }, _a2) + } + ] + }; }; - /** - * Create DragData based off of the last known position and the new position passed in - * @param position The new position as part of the drag - */ DraggableZone.prototype._createDragDataFromPosition = function(position) { - var lastPosition = this.state.lastPosition; - // If we have no lastPosition, use the given position - // for last position - if (lastPosition === undefined) return { - delta: { - x: 0, - y: 0 - }, - lastPosition: position, - position: position - }; - return { - delta: { - x: position.x - lastPosition.x, - y: position.y - lastPosition.y - }, - lastPosition: lastPosition, - position: position - }; + } + function getStyles$1(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g, _h, _j, _k, _l, _m; + var theme = props.theme, className2 = props.className, disabled = props.disabled, focused = props.focused, required2 = props.required, multiline = props.multiline, hasLabel = props.hasLabel, borderless = props.borderless, underlined = props.underlined, hasIcon = props.hasIcon, resizable = props.resizable, hasErrorMessage = props.hasErrorMessage, inputClassName = props.inputClassName, autoAdjustHeight = props.autoAdjustHeight, hasRevealButton = props.hasRevealButton; + var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; + var classNames2 = getGlobalClassNames(globalClassNames, theme); + var fieldPrefixSuffix = { + // Suffix/Prefix are not editable so the disabled slot perfectly fits. + background: semanticColors.disabledBackground, + color: !disabled ? semanticColors.inputPlaceholderText : semanticColors.disabledText, + display: "flex", + alignItems: "center", + padding: "0 10px", + lineHeight: 1, + whiteSpace: "nowrap", + flexShrink: 0, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + background: "Window", + color: disabled ? "GrayText" : "WindowText" + }, _a2) }; - /** - * Creates an updated DragData based off the current position and given baseDragData - * @param baseDragData The base DragData (from _createDragDataFromPosition) used to calculate the updated positions - */ DraggableZone.prototype._createUpdatedDragData = function(baseDragData) { - var position = this.state.position; - return { - position: { - x: position.x + baseDragData.delta.x, - y: position.y + baseDragData.delta.y - }, - delta: baseDragData.delta, - lastPosition: position - }; + var placeholderStyles = [ + { + color: semanticColors.inputPlaceholderText, + opacity: 1, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + color: "GrayText" + }, _b2) + } + ]; + var disabledPlaceholderStyles = { + color: semanticColors.disabledText, + selectors: (_c2 = {}, _c2[HighContrastSelector] = { + color: "GrayText" + }, _c2) }; - DraggableZone.contextType = (0, _reactWindowProvider.WindowContext); - return DraggableZone; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./DraggableZone.styles":"bCq86","../../Utilities":"1NZCy","@fluentui/react-window-provider":"iP8C0","../dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bCq86":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getClassNames", ()=>getClassNames); -var _utilities = require("../../Utilities"); -var _styling = require("../../Styling"); -var getClassNames = (0, _utilities.memoizeFunction)(function(className, isDragging) { return { - root: (0, _styling.mergeStyles)(className, isDragging && { - touchAction: 'none', + root: [ + classNames2.root, + fonts.medium, + required2 && classNames2.required, + disabled && classNames2.disabled, + focused && classNames2.active, + multiline && classNames2.multiline, + borderless && classNames2.borderless, + underlined && classNames2.underlined, + normalize$1, + { + position: "relative" + }, + className2 + ], + wrapper: [ + classNames2.wrapper, + underlined && [ + { + display: "flex", + borderBottom: "1px solid ".concat(!hasErrorMessage ? semanticColors.inputBorder : semanticColors.errorText), + width: "100%" + }, + disabled && { + borderBottomColor: semanticColors.disabledBackground, + selectors: (_d2 = {}, _d2[HighContrastSelector] = __assign$1({ borderColor: "GrayText" }, getHighContrastNoAdjustStyle()), _d2) + }, + !disabled && { selectors: { - '& *': { - userSelect: 'none' - } + ":hover": { + borderBottomColor: !hasErrorMessage ? semanticColors.inputBorderHovered : semanticColors.errorText, + selectors: (_e2 = {}, _e2[HighContrastSelector] = __assign$1({ borderBottomColor: "Highlight" }, getHighContrastNoAdjustStyle()), _e2) + } } - }) - }; -}); - -},{"../../Utilities":"1NZCy","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7qNNV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogContent", ()=>DialogContent); -var _utilities = require("../../Utilities"); -var _dialogContentBase = require("./DialogContent.base"); -var _dialogContentStyles = require("./DialogContent.styles"); -var DialogContent = (0, _utilities.styled)((0, _dialogContentBase.DialogContentBase), (0, _dialogContentStyles.getStyles), undefined, { - scope: 'DialogContent' -}); -DialogContent.displayName = 'DialogContent'; - -},{"../../Utilities":"1NZCy","./DialogContent.base":"duIEt","./DialogContent.styles":"a7LGo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"duIEt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogContentBase", ()=>DialogContentBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _dialogContentTypes = require("./DialogContent.types"); -var _button = require("../../Button"); -var _dialogFooter = require("./DialogFooter"); -var _responsiveMode = require("../../ResponsiveMode"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DialogFooterType = _react.createElement((0, _dialogFooter.DialogFooter), null).type; -var COMPONENT_NAME = 'DialogContent'; -// eslint-disable-next-line deprecation/deprecation -var DialogContentBase = /** @class */ function(_super) { - (0, _tslib.__extends)(DialogContentBase, _super); - function DialogContentBase(props) { - var _this = _super.call(this, props) || this; - (0, _utilities.initializeComponentRef)(_this); - (0, _utilities.warnDeprecations)(COMPONENT_NAME, props, { - titleId: 'titleProps.id' - }); - return _this; - } - DialogContentBase.prototype.render = function() { - var _a = this.props, showCloseButton = _a.showCloseButton, className = _a.className, closeButtonAriaLabel = _a.closeButtonAriaLabel, onDismiss = _a.onDismiss, subTextId = _a.subTextId, subText = _a.subText, _b = _a.titleProps, titleProps = _b === void 0 ? {} : _b, // eslint-disable-next-line deprecation/deprecation - titleId = _a.titleId, title = _a.title, type = _a.type, styles = _a.styles, theme = _a.theme, draggableHeaderClassName = _a.draggableHeaderClassName; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - isLargeHeader: type === (0, _dialogContentTypes.DialogType).largeHeader, - isClose: type === (0, _dialogContentTypes.DialogType).close, - draggableHeaderClassName: draggableHeaderClassName - }); - var groupings = this._groupChildren(); - var subTextContent; - if (subText) subTextContent = _react.createElement("p", { - className: classNames.subText, - id: subTextId - }, subText); - return _react.createElement("div", { - className: classNames.content - }, _react.createElement("div", { - className: classNames.header - }, _react.createElement("div", (0, _tslib.__assign)({ - id: titleId, - role: "heading", - "aria-level": 1 - }, titleProps, { - className: (0, _utilities.css)(classNames.title, titleProps.className) - }), title), _react.createElement("div", { - className: classNames.topButton - }, this.props.topButtonsProps.map(function(props, index) { - return _react.createElement((0, _button.IconButton), (0, _tslib.__assign)({ - key: props.uniqueId || index - }, props)); - }), (type === (0, _dialogContentTypes.DialogType).close || showCloseButton && type !== (0, _dialogContentTypes.DialogType).largeHeader) && _react.createElement((0, _button.IconButton), { - className: classNames.button, - iconProps: { - iconName: 'Cancel' + }, + focused && [ + { + position: "relative" + }, + getInputFocusStyle(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, 0, "borderBottom") + ] + ] + ], + fieldGroup: [ + classNames2.fieldGroup, + normalize$1, + { + border: "1px solid ".concat(semanticColors.inputBorder), + borderRadius: effects.roundedCorner2, + background: semanticColors.inputBackground, + cursor: "text", + height: 32, + display: "flex", + flexDirection: "row", + alignItems: "stretch", + position: "relative" + }, + multiline && { + minHeight: "60px", + height: "auto", + display: "flex" + }, + !focused && !disabled && { + selectors: { + ":hover": { + borderColor: semanticColors.inputBorderHovered, + selectors: (_f = {}, _f[HighContrastSelector] = __assign$1({ borderColor: "Highlight" }, getHighContrastNoAdjustStyle()), _f) + } + } + }, + focused && !underlined && getInputFocusStyle(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, effects.roundedCorner2), + disabled && { + borderColor: semanticColors.disabledBackground, + selectors: (_g = {}, _g[HighContrastSelector] = __assign$1({ borderColor: "GrayText" }, getHighContrastNoAdjustStyle()), _g), + cursor: "default" + }, + borderless && { + border: "none" + }, + borderless && focused && { + border: "none", + selectors: { + ":after": { + border: "none" + } + } + }, + underlined && { + flex: "1 1 0px", + border: "none", + textAlign: "left" + }, + underlined && disabled && { + backgroundColor: "transparent" + }, + hasErrorMessage && !underlined && { + borderColor: semanticColors.errorText, + selectors: { + "&:hover": { + borderColor: semanticColors.errorText + } + } + }, + !hasLabel && required2 && { + selectors: (_h = { + ":before": { + content: "'*'", + color: semanticColors.errorText, + position: "absolute", + top: -5, + right: -10 + } + }, _h[HighContrastSelector] = { + selectors: { + ":before": { + color: "WindowText", + right: -14 + // moving the * 4 pixel to right to alleviate border clipping in HC mode. + } + } + }, _h) + } + ], + field: [ + fonts.medium, + classNames2.field, + normalize$1, + { + borderRadius: 0, + border: "none", + background: "none", + backgroundColor: "transparent", + color: semanticColors.inputText, + padding: "0 8px", + width: "100%", + minWidth: 0, + textOverflow: "ellipsis", + outline: 0, + selectors: (_j = { + "&:active, &:focus, &:hover": { outline: 0 }, + "::-ms-clear": { + display: "none" + } + }, _j[HighContrastSelector] = { + background: "Window", + color: disabled ? "GrayText" : "WindowText" + }, _j) + }, + getPlaceholderStyles(placeholderStyles), + multiline && !resizable && [ + classNames2.unresizable, + { + resize: "none" + } + ], + multiline && { + minHeight: "inherit", + lineHeight: 17, + flexGrow: 1, + paddingTop: 6, + paddingBottom: 6, + overflow: "auto", + width: "100%" + }, + multiline && autoAdjustHeight && { + overflow: "hidden" + }, + hasIcon && !hasRevealButton && { + paddingRight: 24 + }, + multiline && hasIcon && { + paddingRight: 40 + }, + disabled && [ + { + backgroundColor: semanticColors.disabledBackground, + color: semanticColors.disabledText, + borderColor: semanticColors.disabledBackground + }, + getPlaceholderStyles(disabledPlaceholderStyles) + ], + underlined && { + textAlign: "left" + }, + focused && !borderless && { + selectors: (_k = {}, _k[HighContrastSelector] = { + paddingLeft: 11, + paddingRight: 11 + }, _k) + }, + focused && multiline && !borderless && { + selectors: (_l = {}, _l[HighContrastSelector] = { + paddingTop: 4 + // take into consideration the 2px increased border-width (not when borderless). + }, _l) + }, + inputClassName + ], + icon: [ + multiline && { + paddingRight: 24, + alignItems: "flex-end" + }, + { + pointerEvents: "none", + position: "absolute", + bottom: 6, + right: 8, + top: "auto", + fontSize: IconFontSizes.medium, + lineHeight: 18 + }, + disabled && { + color: semanticColors.disabledText + } + ], + description: [ + classNames2.description, + { + color: semanticColors.bodySubtext, + fontSize: fonts.xSmall.fontSize + } + ], + errorMessage: [ + classNames2.errorMessage, + AnimationClassNames.slideDownIn20, + fonts.small, + { + color: semanticColors.errorText, + margin: 0, + paddingTop: 5, + display: "flex", + alignItems: "center" + } + ], + prefix: [classNames2.prefix, fieldPrefixSuffix], + suffix: [classNames2.suffix, fieldPrefixSuffix], + revealButton: [ + classNames2.revealButton, + "ms-Button", + "ms-Button--icon", + getFocusStyle(theme, { inset: 1 }), + { + height: 30, + width: 32, + border: "none", + padding: "0px 4px", + backgroundColor: "transparent", + color: semanticColors.link, + selectors: { + ":hover": { + outline: 0, + color: semanticColors.primaryButtonBackgroundHovered, + backgroundColor: semanticColors.buttonBackgroundHovered, + selectors: (_m = {}, _m[HighContrastSelector] = { + borderColor: "Highlight", + color: "Highlight" + }, _m) }, - ariaLabel: closeButtonAriaLabel, - onClick: onDismiss - }))), _react.createElement("div", { - className: classNames.inner - }, _react.createElement("div", { - className: classNames.innerContent - }, subTextContent, groupings.contents), groupings.footers)); - }; - // @TODO - typing the footers as an array of DialogFooter is difficult because - // casing "child as DialogFooter" causes a problem because - // "Neither type 'ReactElement<any>' nor type 'DialogFooter' is assignable to the other." - DialogContentBase.prototype._groupChildren = function() { - var groupings = { - footers: [], - contents: [] - }; - _react.Children.map(this.props.children, function(child) { - if (typeof child === 'object' && child !== null && child.type === DialogFooterType) groupings.footers.push(child); - else groupings.contents.push(child); - }); - return groupings; + ":focus": { outline: 0 } + } + }, + hasIcon && { + marginRight: 28 + } + ], + revealSpan: { + display: "flex", + height: "100%", + alignItems: "center" + }, + revealIcon: { + margin: "0px 4px", + pointerEvents: "none", + bottom: 6, + right: 8, + top: "auto", + fontSize: IconFontSizes.medium, + lineHeight: 18 + }, + subComponentStyles: { + label: getLabelStyles(props) + } }; - DialogContentBase.defaultProps = { - showCloseButton: false, - className: '', - topButtonsProps: [], - closeButtonAriaLabel: 'Close' - }; - DialogContentBase = (0, _tslib.__decorate)([ - (0, _responsiveMode.withResponsiveMode) - ], DialogContentBase); - return DialogContentBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","./DialogContent.types":"lz1qp","../../Button":"1457j","./DialogFooter":"8shIu","../../ResponsiveMode":"cFpqz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8shIu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogFooter", ()=>DialogFooter); -var _utilities = require("../../Utilities"); -var _dialogFooterBase = require("./DialogFooter.base"); -var _dialogFooterStyles = require("./DialogFooter.styles"); -var DialogFooter = (0, _utilities.styled)((0, _dialogFooterBase.DialogFooterBase), (0, _dialogFooterStyles.getStyles), undefined, { - scope: 'DialogFooter' -}); -DialogFooter.displayName = 'DialogFooter'; - -},{"../../Utilities":"1NZCy","./DialogFooter.base":"cL4C4","./DialogFooter.styles":"lWgMk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cL4C4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DialogFooterBase", ()=>DialogFooterBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DialogFooterBase = /** @class */ function(_super) { - (0, _tslib.__extends)(DialogFooterBase, _super); - function DialogFooterBase(props) { - var _this = _super.call(this, props) || this; - (0, _utilities.initializeComponentRef)(_this); - return _this; + } + var TextField = styled(TextFieldBase, getStyles$1, void 0, { + scope: "TextField" + }); + var getClassNames = classNamesFunction(); + var COMPONENT_NAME = "Toggle"; + var ToggleBase = React__namespace.forwardRef(function(props, forwardedRef) { + var _a2 = props.as, RootType = _a2 === void 0 ? "div" : _a2, ariaLabel2 = props.ariaLabel, controlledChecked = props.checked, className2 = props.className, _b2 = props.defaultChecked, defaultChecked = _b2 === void 0 ? false : _b2, disabled = props.disabled, inlineLabel = props.inlineLabel, label2 = props.label, offAriaLabel = props.offAriaLabel, offText = props.offText, onAriaLabel = props.onAriaLabel, onChange = props.onChange, onChanged = props.onChanged, onToggleClick = props.onClick, onText = props.onText, role = props.role, styles = props.styles, theme = props.theme; + var _c2 = useControllableValue(controlledChecked, defaultChecked, React__namespace.useCallback(function(ev, isChecked) { + onChange === null || onChange === void 0 ? void 0 : onChange(ev, isChecked); + onChanged === null || onChanged === void 0 ? void 0 : onChanged(isChecked); + }, [onChange, onChanged])), checked = _c2[0], setChecked = _c2[1]; + var classNames2 = getClassNames(styles, { + theme, + className: className2, + disabled, + checked, + inlineLabel, + onOffMissing: !onText && !offText + }); + var badAriaLabel = checked ? onAriaLabel : offAriaLabel; + var id2 = useId(COMPONENT_NAME, props.id); + var labelId = "".concat(id2, "-label"); + var stateTextId = "".concat(id2, "-stateText"); + var stateText = checked ? onText : offText; + var toggleNativeProps = getNativeProps(props, inputProperties, [ + "defaultChecked" + ]); + var labelledById = void 0; + if (!ariaLabel2 && !badAriaLabel) { + if (label2) { + labelledById = labelId; + } + if (stateText && !labelledById) { + labelledById = stateTextId; + } } - DialogFooterBase.prototype.render = function() { - var _a = this.props, className = _a.className, styles = _a.styles, theme = _a.theme; - this._classNames = getClassNames(styles, { - theme: theme, - className: className - }); - return _react.createElement("div", { - className: this._classNames.actions - }, _react.createElement("div", { - className: this._classNames.actionsRight - }, this._renderChildrenAsActions())); + var toggleButton = React__namespace.useRef(null); + useFocusRects(toggleButton); + useComponentRef(props, checked, toggleButton); + var onClick = function(ev) { + if (!disabled) { + setChecked(!checked, ev); + if (onToggleClick) { + onToggleClick(ev); + } + } }; - DialogFooterBase.prototype._renderChildrenAsActions = function() { - var _this = this; - return _react.Children.map(this.props.children, function(child) { - return child ? _react.createElement("span", { - className: _this._classNames.action - }, child) : null; - }); + var slotProps = { + root: { + className: classNames2.root, + hidden: toggleNativeProps.hidden + }, + label: { + children: label2, + className: classNames2.label, + htmlFor: id2, + id: labelId + }, + container: { + className: classNames2.container + }, + pill: __assign$1(__assign$1({}, toggleNativeProps), { "aria-disabled": disabled, "aria-checked": checked, "aria-label": ariaLabel2 ? ariaLabel2 : badAriaLabel, "aria-labelledby": labelledById, className: classNames2.pill, "data-is-focusable": true, "data-ktp-target": true, disabled, id: id2, onClick, ref: toggleButton, role: role ? role : "switch", type: "button" }), + thumb: { + className: classNames2.thumb + }, + stateText: { + children: stateText, + className: classNames2.text, + htmlFor: id2, + id: stateTextId + } }; - return DialogFooterBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lWgMk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - actions: 'ms-Dialog-actions', - action: 'ms-Dialog-action', - actionsRight: 'ms-Dialog-actionsRight' -}; -var getStyles = function(props) { - var className = props.className, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + return React__namespace.createElement( + RootType, + __assign$1({ ref: forwardedRef }, slotProps.root), + label2 && React__namespace.createElement(Label$2, __assign$1({}, slotProps.label)), + React__namespace.createElement( + "div", + __assign$1({}, slotProps.container), + React__namespace.createElement( + "button", + __assign$1({}, slotProps.pill), + React__namespace.createElement("span", __assign$1({}, slotProps.thumb)) + ), + (checked && onText || offText) && React__namespace.createElement(Label$2, __assign$1({}, slotProps.stateText)) + ) + ); + }); + ToggleBase.displayName = COMPONENT_NAME + "Base"; + var useComponentRef = function(props, isChecked, toggleButtonRef) { + React__namespace.useImperativeHandle(props.componentRef, function() { + return { + get checked() { + return !!isChecked; + }, + focus: function() { + if (toggleButtonRef.current) { + toggleButtonRef.current.focus(); + } + } + }; + }, [isChecked, toggleButtonRef]); + }; + var DEFAULT_PILL_WIDTH = 40; + var DEFAULT_PILL_HEIGHT = 20; + var DEFAULT_THUMB_SIZE = 12; + var getStyles = function(props) { + var _a2, _b2, _c2, _d2, _e2, _f, _g; + var theme = props.theme, className2 = props.className, disabled = props.disabled, checked = props.checked, inlineLabel = props.inlineLabel, onOffMissing = props.onOffMissing; + var semanticColors = theme.semanticColors, palette = theme.palette; + var pillUncheckedBackground = semanticColors.bodyBackground; + var pillCheckedBackground = semanticColors.inputBackgroundChecked; + var pillCheckedHoveredBackground = semanticColors.inputBackgroundCheckedHovered; + var thumbUncheckedHoveredBackground = palette.neutralDark; + var pillCheckedDisabledBackground = semanticColors.disabledBodySubtext; + var thumbBackground = semanticColors.smallInputBorder; + var thumbCheckedBackground = semanticColors.inputForegroundChecked; + var thumbDisabledBackground = semanticColors.disabledBodySubtext; + var thumbCheckedDisabledBackground = semanticColors.disabledBackground; + var pillBorderColor = semanticColors.smallInputBorder; + var pillBorderHoveredColor = semanticColors.inputBorderHovered; + var pillBorderDisabledColor = semanticColors.disabledBodySubtext; + var textDisabledColor = semanticColors.disabledText; return { - actions: [ - classNames.actions, - { - position: 'relative', - width: '100%', - minHeight: '24px', - lineHeight: '24px', - margin: '16px 0 0', - fontSize: '0', - selectors: { - '.ms-Button': { - lineHeight: 'normal', - verticalAlign: 'middle' - } + root: [ + "ms-Toggle", + checked && "is-checked", + !disabled && "is-enabled", + disabled && "is-disabled", + theme.fonts.medium, + { + marginBottom: "8px" + }, + inlineLabel && { + display: "flex", + alignItems: "center" + }, + className2 + ], + label: [ + "ms-Toggle-label", + { display: "inline-block" }, + disabled && { + color: textDisabledColor, + selectors: (_a2 = {}, _a2[HighContrastSelector] = { + color: "GrayText" + }, _a2) + }, + inlineLabel && !onOffMissing && { + marginRight: 16 + }, + onOffMissing && inlineLabel && { + order: 1, + marginLeft: 16 + }, + inlineLabel && { wordBreak: "break-word" } + ], + container: [ + "ms-Toggle-innerContainer", + { + display: "flex", + position: "relative" + } + ], + pill: [ + "ms-Toggle-background", + getFocusStyle(theme, { inset: -3 }), + { + fontSize: "20px", + boxSizing: "border-box", + width: DEFAULT_PILL_WIDTH, + height: DEFAULT_PILL_HEIGHT, + borderRadius: DEFAULT_PILL_HEIGHT / 2, + transition: "all 0.1s ease", + border: "1px solid ".concat(pillBorderColor), + background: pillUncheckedBackground, + cursor: "pointer", + display: "flex", + alignItems: "center", + padding: "0 3px", + overflow: "visible" + }, + !disabled && [ + !checked && { + selectors: { + ":hover": [ + { + borderColor: pillBorderHoveredColor } - }, - className - ], - action: [ - classNames.action, - { - margin: '0 4px' - } - ], - actionsRight: [ - classNames.actionsRight, - { - alignItems: 'center', - display: 'flex', - fontSize: '0', - justifyContent: 'flex-end', - marginRight: '-4px' - } - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a7LGo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - contentLgHeader: 'ms-Dialog-lgHeader', - close: 'ms-Dialog--close', - subText: 'ms-Dialog-subText', - header: 'ms-Dialog-header', - headerLg: 'ms-Dialog--lgHeader', - button: 'ms-Dialog-button ms-Dialog-button--close', - inner: 'ms-Dialog-inner', - content: 'ms-Dialog-content', - title: 'ms-Dialog-title' -}; -var getStyles = function(props) { - var _a, _b, _c; - var className = props.className, theme = props.theme, isLargeHeader = props.isLargeHeader, isClose = props.isClose, hidden = props.hidden, isMultiline = props.isMultiline, draggableHeaderClassName = props.draggableHeaderClassName; - var palette = theme.palette, fonts = theme.fonts, effects = theme.effects, semanticColors = theme.semanticColors; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - content: [ - isLargeHeader && [ - classNames.contentLgHeader, + ], + ":hover .ms-Toggle-thumb": [ { - borderTop: "4px solid ".concat(palette.themePrimary) + backgroundColor: thumbUncheckedHoveredBackground, + selectors: (_b2 = {}, _b2[HighContrastSelector] = { + borderColor: "Highlight" + }, _b2) } - ], - isClose && classNames.close, + ] + } + }, + checked && [ { - flexGrow: 1, - overflowY: 'hidden' + background: pillCheckedBackground, + borderColor: "transparent", + justifyContent: "flex-end" }, - className - ], - subText: [ - classNames.subText, - fonts.medium, { - margin: '0 0 24px 0', - color: semanticColors.bodySubtext, - lineHeight: '1.5', - wordWrap: 'break-word', - fontWeight: (0, _styling.FontWeights).regular + selectors: (_c2 = { + ":hover": [ + { + backgroundColor: pillCheckedHoveredBackground, + borderColor: "transparent", + selectors: (_d2 = {}, _d2[HighContrastSelector] = { + backgroundColor: "Highlight" + }, _d2) + } + ] + }, _c2[HighContrastSelector] = __assign$1({ backgroundColor: "Highlight" }, getHighContrastNoAdjustStyle()), _c2) } + ] ], - header: [ - classNames.header, + disabled && [ + { + cursor: "default" + }, + !checked && [ { - position: 'relative', - width: '100%', - boxSizing: 'border-box' - }, - isClose && classNames.close, - draggableHeaderClassName && [ - draggableHeaderClassName, - { - cursor: 'move' - } - ] - ], - button: [ - classNames.button, - hidden && { - selectors: { - '.ms-Icon.ms-Icon--Cancel': { - color: semanticColors.buttonText, - fontSize: (0, _styling.IconFontSizes).medium - } - } + borderColor: pillBorderDisabledColor } - ], - inner: [ - classNames.inner, + ], + checked && [ { - padding: '0 24px 24px', - selectors: (_a = {}, _a["@media (min-width: ".concat((0, _styling.ScreenWidthMinSmall), "px) and (max-width: ").concat((0, _styling.ScreenWidthMaxSmall), "px)")] = { - padding: '0 16px 16px' - }, _a) + backgroundColor: pillCheckedDisabledBackground, + borderColor: "transparent", + justifyContent: "flex-end" } + ] ], - innerContent: [ - classNames.content, - { - position: 'relative', - width: '100%' - } + !disabled && { + selectors: { + "&:hover": { + selectors: (_e2 = {}, _e2[HighContrastSelector] = { + borderColor: "Highlight" + }, _e2) + } + } + } + ], + thumb: [ + "ms-Toggle-thumb", + { + display: "block", + width: DEFAULT_THUMB_SIZE, + height: DEFAULT_THUMB_SIZE, + borderRadius: "50%", + transition: "all 0.1s ease", + backgroundColor: thumbBackground, + /* Border is added to handle high contrast mode for Firefox */ + borderColor: "transparent", + borderWidth: DEFAULT_THUMB_SIZE / 2, + borderStyle: "solid", + boxSizing: "border-box" + }, + !disabled && checked && [ + { + backgroundColor: thumbCheckedBackground, + selectors: (_f = {}, _f[HighContrastSelector] = { + backgroundColor: "Window", + borderColor: "Window" + }, _f) + } ], - title: [ - classNames.title, - fonts.xLarge, + disabled && [ + !checked && [ { - color: semanticColors.bodyText, - margin: '0', - minHeight: fonts.xLarge.fontSize, - padding: '16px 46px 20px 24px', - lineHeight: 'normal', - selectors: (_b = {}, _b["@media (min-width: ".concat((0, _styling.ScreenWidthMinSmall), "px) and (max-width: ").concat((0, _styling.ScreenWidthMaxSmall), "px)")] = { - padding: '16px 46px 16px 16px' - }, _b) - }, - isLargeHeader && { - color: semanticColors.menuHeader - }, - isMultiline && { - fontSize: fonts.xxLarge.fontSize + backgroundColor: thumbDisabledBackground } - ], - topButton: [ + ], + checked && [ { - display: 'flex', - flexDirection: 'row', - flexWrap: 'nowrap', - position: 'absolute', - top: '0', - right: '0', - padding: '15px 15px 0 0', - selectors: (_c = { - '> *': { - flex: '0 0 auto' - }, - '.ms-Dialog-button': { - color: semanticColors.buttonText - }, - '.ms-Dialog-button:hover': { - color: semanticColors.buttonTextHovered, - borderRadius: effects.roundedCorner2 - } - }, _c["@media (min-width: ".concat((0, _styling.ScreenWidthMinSmall), "px) and (max-width: ").concat((0, _styling.ScreenWidthMaxSmall), "px)")] = { - padding: '15px 8px 0 0' - }, _c) + backgroundColor: thumbCheckedDisabledBackground } + ] ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73MTE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _styling = require("../../Styling"); -var GlobalClassNames = { - root: 'ms-Dialog' -}; -var getStyles = function(props) { - var _a; - var className = props.className, containerClassName = props.containerClassName, _b = props.dialogDefaultMinWidth, dialogDefaultMinWidth = _b === void 0 ? '288px' : _b, _c = props.dialogDefaultMaxWidth, dialogDefaultMaxWidth = _c === void 0 ? '340px' : _c, hidden = props.hidden, theme = props.theme; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - return { - root: [ - classNames.root, - theme.fonts.medium, - className - ], - main: [ - { - width: dialogDefaultMinWidth, - outline: '3px solid transparent', - selectors: (_a = {}, _a["@media (min-width: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - width: 'auto', - maxWidth: dialogDefaultMaxWidth, - minWidth: dialogDefaultMinWidth - }, _a) - }, - !hidden && { - display: 'flex' - }, - containerClassName - ] - }; -}; - -},{"../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8LUqt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Dropdown/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Dropdown/index":"dXF00","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dXF00":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _dropdown = require("./Dropdown"); -parcelHelpers.exportAll(_dropdown, exports); -var _dropdownBase = require("./Dropdown.base"); -parcelHelpers.exportAll(_dropdownBase, exports); -var _dropdownTypes = require("./Dropdown.types"); -parcelHelpers.exportAll(_dropdownTypes, exports); - -},{"./Dropdown":"5RWqB","./Dropdown.base":false,"./Dropdown.types":"deOYw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5RWqB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dropdown", ()=>Dropdown); -var _utilities = require("../../Utilities"); -var _dropdownBase = require("./Dropdown.base"); -var _dropdownStyles = require("./Dropdown.styles"); -var Dropdown = (0, _utilities.styled)((0, _dropdownBase.DropdownBase), (0, _dropdownStyles.getStyles), undefined, { - scope: 'Dropdown' -}); -Dropdown.displayName = 'Dropdown'; - -},{"../../Utilities":"1NZCy","./Dropdown.base":"kXZn2","./Dropdown.styles":"cUemW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kXZn2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DropdownBase", ()=>DropdownBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _utilities = require("../../Utilities"); -var _callout = require("../../Callout"); -var _button = require("../../Button"); -var _dropdownTypes = require("./Dropdown.types"); -var _dropdownSizePosCache = require("./utilities/DropdownSizePosCache"); -var _focusZone = require("../../FocusZone"); -var _icon = require("../../Icon"); -var _label = require("../../Label"); -var _panel = require("../../Panel"); -var _responsiveMode = require("../../ResponsiveMode"); -var _selectableOption = require("../../SelectableOption"); -// import and use V7 Checkbox to ensure no breaking changes. -var _checkbox = require("../../Checkbox"); -var _utilities1 = require("@fluentui/utilities"); -var _reactHooks = require("@fluentui/react-hooks"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var COMPONENT_NAME = 'Dropdown'; -var getClassNames = (0, _utilities.classNamesFunction)(); -var DEFAULT_PROPS = { - options: [] -}; -function useSelectedItemsState(_a) { - var defaultSelectedKeys = _a.defaultSelectedKeys, selectedKeys = _a.selectedKeys, defaultSelectedKey = _a.defaultSelectedKey, selectedKey = _a.selectedKey, options = _a.options, multiSelect = _a.multiSelect; - var oldOptions = (0, _reactHooks.usePrevious)(options); - var _b = _react.useState([]), selectedIndices = _b[0], setSelectedIndices = _b[1]; - // In controlled component usage where selectedKey is provided, update the selectedIndex - // state if the key or options change. - var selectedKeyPropToUse; - // this does a shallow compare (assumes options are pure), for the purposes of determining whether - // defaultSelectedKey/defaultSelectedKeys are respected. - var didOptionsChange = options !== oldOptions; - if (multiSelect) { - if (didOptionsChange && defaultSelectedKeys !== undefined) selectedKeyPropToUse = defaultSelectedKeys; - else selectedKeyPropToUse = selectedKeys; - } else if (didOptionsChange && defaultSelectedKey !== undefined) selectedKeyPropToUse = defaultSelectedKey; - else selectedKeyPropToUse = selectedKey; - var oldSelectedKeyProp = (0, _reactHooks.usePrevious)(selectedKeyPropToUse); - _react.useEffect(function() { - /** Get all selected indexes for multi-select mode */ var getSelectedIndexes = function() { - if (selectedKeyPropToUse === undefined) { - if (multiSelect) return getAllSelectedIndices(); - var selectedIndex = getSelectedIndex(null); - return selectedIndex !== -1 ? [ - selectedIndex - ] : []; - } else if (!Array.isArray(selectedKeyPropToUse)) { - var selectedIndex = getSelectedIndex(selectedKeyPropToUse); - return selectedIndex !== -1 ? [ - selectedIndex - ] : []; + ], + text: [ + "ms-Toggle-stateText", + { + selectors: { + // Workaround: make rules more specific than Label rules. + "&&": { + padding: "0", + margin: "0 8px", + userSelect: "none", + fontWeight: FontWeights.regular } - var returnValue = []; - for(var _i = 0, selectedKeyPropToUse_1 = selectedKeyPropToUse; _i < selectedKeyPropToUse_1.length; _i++){ - var key = selectedKeyPropToUse_1[_i]; - var selectedIndex = getSelectedIndex(key); - selectedIndex !== -1 && returnValue.push(selectedIndex); + } + }, + disabled && { + selectors: { + "&&": { + color: textDisabledColor, + selectors: (_g = {}, _g[HighContrastSelector] = { + color: "GrayText" + }, _g) } - return returnValue; - }; - var getAllSelectedIndices = function() { - return options.map(function(option, index) { - return option.selected ? index : -1; - }).filter(function(index) { - return index !== -1; - }); - }; - var getSelectedIndex = function(searchKey) { - return (0, _utilities.findIndex)(options, function(option) { - // eslint-disable-next-line eqeqeq - if (searchKey != null) return option.key === searchKey; - else // eslint-disable-next-line deprecation/deprecation - return !!option.selected || !!option.isSelected; - }); - }; - if ((selectedKeyPropToUse !== undefined || !oldOptions) && (selectedKeyPropToUse !== oldSelectedKeyProp || didOptionsChange)) setSelectedIndices(getSelectedIndexes()); - }, [ - didOptionsChange, - multiSelect, - oldOptions, - oldSelectedKeyProp, - options, - selectedKeyPropToUse - ]); - return [ - selectedIndices, - setSelectedIndices - ]; -} -var DropdownBase = _react.forwardRef(function(propsWithoutDefaults, forwardedRef) { - var props = (0, _utilities1.getPropsWithDefaults)(DEFAULT_PROPS, propsWithoutDefaults); - var rootRef = _react.useRef(null); - var mergedRootRef = (0, _reactHooks.useMergedRefs)(forwardedRef, rootRef); - var responsiveMode = (0, _responsiveMode.useResponsiveMode)(rootRef, props.responsiveMode); - var _a = useSelectedItemsState(props), selectedIndices = _a[0], setSelectedIndices = _a[1]; - return _react.createElement(DropdownInternal, (0, _tslib.__assign)({}, props, { - responsiveMode: responsiveMode, - hoisted: { - rootRef: mergedRootRef, - selectedIndices: selectedIndices, - setSelectedIndices: setSelectedIndices + } } - })); -}); -DropdownBase.displayName = 'DropdownBase'; -var DropdownInternal = /** @class */ function(_super) { - (0, _tslib.__extends)(DropdownInternal, _super); - function DropdownInternal(props) { - var _this = _super.call(this, props) || this; - _this._host = _react.createRef(); - _this._focusZone = _react.createRef(); - _this._dropDown = _react.createRef(); - _this._scrollIdleDelay = 250 /* ms */ ; - _this._sizePosCache = new (0, _dropdownSizePosCache.DropdownSizePosCache)(); - _this._requestAnimationFrame = (0, _utilities.safeRequestAnimationFrame)(_this); - /** - * Close menu callout if it is open - */ _this.dismissMenu = function() { - var isOpen = _this.state.isOpen; - isOpen && _this.setState({ - isOpen: false - }); - }; - _this._onChange = function(event, options, index, checked, multiSelect) { - // eslint-disable-next-line deprecation/deprecation - var _a = _this.props, onChange = _a.onChange, onChanged = _a.onChanged; - if (onChange || onChanged) { - // for single-select, option passed in will always be selected. - // for multi-select, flip the checked value - var changedOpt = multiSelect ? (0, _tslib.__assign)((0, _tslib.__assign)({}, options[index]), { - selected: !checked - }) : options[index]; - onChange && onChange((0, _tslib.__assign)((0, _tslib.__assign)({}, event), { - target: _this._dropDown.current - }), changedOpt, index); - onChanged && onChanged(changedOpt, index); - } - }; - /** Get either props.placeholder (new name) or props.placeHolder (old name) */ _this._getPlaceholder = function() { - // eslint-disable-next-line deprecation/deprecation - return _this.props.placeholder || _this.props.placeHolder; - }; - /** Get text in dropdown input as a string */ _this._getTitle = function(items, _unused) { - var _a = _this.props.multiSelectDelimiter, multiSelectDelimiter = _a === void 0 ? ', ' : _a; - return items.map(function(i) { - return i.text; - }).join(multiSelectDelimiter); - }; - /** Render text in dropdown input */ _this._onRenderTitle = function(items) { - return _react.createElement(_react.Fragment, null, _this._getTitle(items)); - }; - /** Render placeholder text in dropdown input */ _this._onRenderPlaceholder = function(props) { - if (!_this._getPlaceholder()) return null; - return _react.createElement(_react.Fragment, null, _this._getPlaceholder()); - }; - /** Render Callout or Panel container and pass in list */ _this._onRenderContainer = function(props) { - var calloutProps = props.calloutProps, panelProps = props.panelProps; - var _a = _this.props, responsiveMode = _a.responsiveMode, dropdownWidth = _a.dropdownWidth; - var isSmall = responsiveMode <= (0, _responsiveMode.ResponsiveMode).medium; - var focusTrapZoneProps = { - firstFocusableTarget: "#".concat(_this._listId, "1") - }; - var panelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.panel : undefined; - var calloutWidth = undefined; - var calloutMinWidth = undefined; - if (dropdownWidth === 'auto') calloutMinWidth = _this._dropDown.current ? _this._dropDown.current.clientWidth : 0; - else calloutWidth = dropdownWidth || (_this._dropDown.current ? _this._dropDown.current.clientWidth : 0); - return isSmall ? _react.createElement((0, _panel.Panel), (0, _tslib.__assign)({ - closeButtonAriaLabel: "Close", - focusTrapZoneProps: focusTrapZoneProps, - hasCloseButton: true, - isOpen: true, - isLightDismiss: true, - onDismiss: _this._onDismiss, - styles: panelStyles - }, panelProps), _this._renderFocusableList(props)) : _react.createElement((0, _callout.Callout), (0, _tslib.__assign)({ - isBeakVisible: false, - gapSpace: 0, - doNotLayer: false, - directionalHintFixed: false, - directionalHint: (0, _callout.DirectionalHint).bottomLeftEdge, - calloutWidth: calloutWidth, - calloutMinWidth: calloutMinWidth - }, calloutProps, { - className: _this._classNames.callout, - target: _this._dropDown.current, - onDismiss: _this._onDismiss, - onScroll: _this._onScroll, - onPositioned: _this._onPositioned - }), _this._renderFocusableList(props)); - }; - /** Render Caret Down Icon */ _this._onRenderCaretDown = function(props) { - return _react.createElement((0, _icon.Icon), { - className: _this._classNames.caretDown, - iconName: "ChevronDown", - "aria-hidden": true - }); - }; - /** Render List of items */ _this._onRenderList = function(props) { - var _a = props.onRenderItem, onRenderItem = _a === void 0 ? _this._onRenderItem : _a; - var queue = { - items: [] - }; - var renderedList = []; - var emptyQueue = function() { - var newGroup = queue.id ? [ - _react.createElement("div", { - role: "group", - key: queue.id, - "aria-labelledby": queue.id - }, queue.items) - ] : queue.items; - renderedList = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], renderedList, true), newGroup, true); - // Flush items and id - queue = { - items: [] - }; - }; - var placeRenderedOptionIntoQueue = function(item, index) { - /* - Case Header - empty queue if it's not already empty - ensure unique ID for header and set queue ID - push header into queue - Case Divider - push divider into queue if not first item - empty queue if not already empty - Default - push item into queue - */ switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - queue.items.length > 0 && emptyQueue(); - var id = _this._id + item.key; - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({ - id: id - }, item), { - index: index - }), _this._onRenderItem)); - queue.id = id; - break; - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - index > 0 && queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); - queue.items.length > 0 && emptyQueue(); - break; - default: - queue.items.push(onRenderItem((0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - index: index - }), _this._onRenderItem)); + ] + }; + }; + var Toggle = styled(ToggleBase, getStyles, void 0, { + scope: "Toggle" + }); + use(registerIcons$1); + initializeIcons(); + const fluentUI = { + ActionButton, + ChoiceGroup, + ComboBox, + CommandBar, + ContextualMenuItemType, + Customizer, + DefaultButton, + Dialog, + DialogFooter, + DialogType, + Dropdown, + DropdownMenuItemType: SelectableOptionMenuItemType, + Icon, + IconButton, + getFocusStyle, + getTheme, + Label: Label$2, + loadTheme, + Modal, + PrimaryButton, + Slider, + Spinner, + SpinnerSize, + TextField, + Toggle, + registerIcons: registerIcons$1, + unregisterIcons: unregisterIcons$1 + }; + const strings = { + buttonLoadData: "Load data", + buttonThemeDark: "Dark", + buttonThemeLight: "Light", + buttonExport: "Export", + menuUserData: "Use your own data", + menuLocal: "On this computer ...", + menuUrl: "Enter a URL ...", + menuSnapshotsExportAsJSON: "Export as .snapshots JSON file", + menuSnapshotsExportAs: "Export as ...", + menuSnapshotsImport: "Import a .snapshots JSON file", + dialogTitleLocal: "Use a file from your computer", + dialogSubtextLocal: "Your file will not be uploaded, it is only used by the browser on this computer. The currently supported data formats are json (the default), csv (comma-separated values), tsv (tab-separated values), and topojson.", + dialogTitleUrl: "Use a data file via URL", + dialogTitleSnapshotsExport: "Export as", + dialogTitleSnapshotsLocal: "Use a snapshots file from your computer", + dialogSubtextSnapshotsLocal: "Use a file that was previously exported snapshots file. Your file will not be uploaded, it is only used by the browser on this computer.", + dialogTitleSnapshotsUrl: "Use a snapshots file via URL", + dialogLoadButton: "Load", + labelLocal: "[local]", + labelColorFilter: "Note: Colors will be re-mapped to the filter when viewing this saved chart.", + labelPreferences: "Preferences", + labelCompactUI: "Compact UI", + labelCompactUIDescription: "Compact UI hides collapses labels on dropdown menus.", + labelSnapshotsExportHTMLTitle: "HTML", + labelSnapshotsExportHTMLDescription: "A self contained HTML page with current data and snapshots pre-loaded.", + labelSnapshotsExportMarkdownTitle: "Markdown", + labelSnapshotsExportMarkdownDescription: "Markdown is a language used by many blogging platforms. Exports a Markdown file with thumbnails of these snapshots which link back to the SandDance website.", + labelSnapshotsShortcut: "Tip: Your .snapshots JSON file can also be pre-loaded with this", + labelShare: "share", + labelLink: "link", + labelLinkDescription: "A URL to revive this snapshot.", + labelUrl: "Url", + labelDataFormat: "Data format", + labelDataUrlShortcut: "Tip: Your data file can also be pre-loaded with this", + urlInputPlaceholder: "paste URL", + sampleDataPrefix: "Sample data", + localFilePrefix: "Local file", + urlPrefix: "Url", + errorInvalidFileFormat: "Invalid file format", + errorNoUrl: "Please enter a url", + errorUrlHttp: 'Url must begin with "http"', + errorDownloadFailure: "Data could not be prepared for download.", + errorDataSourceFromLocal: (ds) => `Could not load ${ds.type} from local file.`, + errorDataSourceFromUrl: (ds) => `Could not load ${ds.type} from ${ds.dataUrl}` + }; + function invalidUrlError(url) { + if (!url) { + return strings.errorNoUrl; + } + if (url.toLocaleLowerCase().substr(0, 4) !== "http") { + return strings.errorUrlHttp; + } + } + function DataSourceButton(props) { + const picker = props.getPicker(); + if (!picker) + return null; + const menuProps = { + items: [ + { + key: "sample-section", + itemType: base.fluentUI.ContextualMenuItemType.Section, + sectionProps: { + title: strings.sampleDataPrefix, + items: props.dataSources.map((ds, i) => { + const item = { + key: ds.id, + text: ds.displayName, + onClick: (e) => { + picker.changeDataSource(ds); } + }; + return item; + }) + } + }, + { + key: "user-section", + itemType: base.fluentUI.ContextualMenuItemType.Section, + sectionProps: { + topDivider: true, + title: strings.menuUserData, + items: [ + { + key: "local", + text: strings.menuLocal, + onClick: (e) => picker.setState({ dialogMode: "local" }) + }, + { + key: "url", + text: strings.menuUrl, + onClick: (e) => picker.setState({ dialogMode: "url" }) + } + ] + } + } + ] + }; + return React__namespace.createElement(base.fluentUI.PrimaryButton, { className: "sanddance-datasource-picker", text: dataSourcePrefix(props.dataSource.dataSourceType, props.dataSource.displayName), menuProps }); + } + class DataSourcePicker extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + url: "", + urlType: DataSourcePicker.urlTypes[0], + working: false + }; + } + changeDataSource(dataSource) { + this.setState({ working: true }); + return new Promise((resolve2, reject) => { + const uploadFormatError = ""; + const urlError = ""; + this.setState({ uploadFormatError, urlError }); + this.props.changeDataSource(dataSource).then(() => { + this.setState({ + working: false, + uploadFormatError: "", + urlError: "", + dialogMode: null + }); + resolve2(); + }).catch((reason) => { + this.setState({ working: false }); + reject(reason); + }); + }); + } + upload(e) { + if (e.target.files) { + const file = e.target.files[0]; + const split = file.name.split("."); + const type2 = split[split.length - 1]; + if (DataSourcePicker.urlTypes.indexOf(type2) >= 0) { + const reader = new FileReader(); + reader.onload = () => { + const id2 = file.name; + const displayName = file.name; + const rawText = reader.result; + const ds = { + dataSourceType: "local", + displayName, + id: id2, + rawText, + type: type2 }; - // Place options into the queue. Queue will be emptied anytime a Header or Divider is encountered - props.options.forEach(function(item, index) { - placeRenderedOptionIntoQueue(item, index); - }); - // Push remaining items into all renderedList - queue.items.length > 0 && emptyQueue(); - return _react.createElement(_react.Fragment, null, renderedList); - }; - _this._onRenderItem = function(item) { - switch(item.itemType){ - case (0, _selectableOption.SelectableOptionMenuItemType).Divider: - return _this._renderSeparator(item); - case (0, _selectableOption.SelectableOptionMenuItemType).Header: - return _this._renderHeader(item); - default: - return _this._renderOption(item); - } - }; - _this._renderOption = function(item) { - var _a; - var _b = _this.props, _c = _b.onRenderOption, onRenderOption = _c === void 0 ? _this._onRenderOption : _c, _d = _b.hoisted.selectedIndices, selectedIndices = _d === void 0 ? [] : _d; - var isItemSelected = item.index !== undefined && selectedIndices ? selectedIndices.indexOf(item.index) > -1 : false; - // select the right className based on the combination of selected/disabled - var itemClassName = item.hidden // predicate: item hidden - ? _this._classNames.dropdownItemHidden : isItemSelected && item.disabled === true // predicate: both selected and disabled - ? _this._classNames.dropdownItemSelectedAndDisabled : isItemSelected // predicate: selected only - ? _this._classNames.dropdownItemSelected : item.disabled === true // predicate: disabled only - ? _this._classNames.dropdownItemDisabled : _this._classNames.dropdownItem; - var title = item.title; - // define the id and label id (for multiselect checkboxes) - var id = _this._listId + item.index; - var labelId = (_a = item.id) !== null && _a !== void 0 ? _a : id + '-label'; - var multiSelectItemStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.multiSelectItem : undefined; - return !_this.props.multiSelect ? _react.createElement((0, _button.CommandButton), { - id: id, - key: item.key, - "data-index": item.index, - "data-is-focusable": !item.disabled, - disabled: item.disabled, - className: itemClassName, - onClick: _this._onItemClick(item), - // eslint-disable-next-line react/jsx-no-bind - onMouseEnter: _this._onItemMouseEnter.bind(_this, item), - // eslint-disable-next-line react/jsx-no-bind - onMouseLeave: _this._onMouseItemLeave.bind(_this, item), - // eslint-disable-next-line react/jsx-no-bind - onMouseMove: _this._onItemMouseMove.bind(_this, item), - role: "option", - "aria-selected": isItemSelected ? 'true' : 'false', - ariaLabel: item.ariaLabel, - title: title, - "aria-posinset": _this._sizePosCache.positionInSet(item.index), - "aria-setsize": _this._sizePosCache.optionSetSize - }, onRenderOption(item, _this._onRenderOption)) : _react.createElement((0, _checkbox.Checkbox), { - id: id, - key: item.key, - disabled: item.disabled, - onChange: _this._onItemClick(item), - inputProps: (0, _tslib.__assign)({ - 'aria-selected': isItemSelected, - onMouseEnter: _this._onItemMouseEnter.bind(_this, item), - onMouseLeave: _this._onMouseItemLeave.bind(_this, item), - onMouseMove: _this._onItemMouseMove.bind(_this, item), - role: 'option' - }, { - 'data-index': item.index, - 'data-is-focusable': !(item.disabled || item.hidden) - }), - label: item.text, - title: title, - // eslint-disable-next-line react/jsx-no-bind - onRenderLabel: _this._onRenderItemLabel.bind(_this, (0, _tslib.__assign)((0, _tslib.__assign)({}, item), { - id: labelId - })), - className: (0, _utilities.css)(itemClassName, 'is-multi-select'), - checked: isItemSelected, - styles: multiSelectItemStyles, - ariaPositionInSet: !item.hidden ? _this._sizePosCache.positionInSet(item.index) : undefined, - ariaSetSize: !item.hidden ? _this._sizePosCache.optionSetSize : undefined, - ariaLabel: item.ariaLabel, - ariaLabelledBy: item.ariaLabel ? undefined : labelId - }); - }; - /** Render content of item (i.e. text/icon inside of button) */ _this._onRenderOption = function(item) { - return _react.createElement("span", { - className: _this._classNames.dropdownOptionText - }, item.text); - }; - /* - * Render content of a multiselect item label. - * Text within the label is aria-hidden, to prevent duplicate input/label exposure - */ _this._onRenderMultiselectOption = function(item) { - return _react.createElement("span", { - id: item.id, - "aria-hidden": "true", - className: _this._classNames.dropdownOptionText - }, item.text); - }; - /** Render custom label for multiselect checkbox items */ _this._onRenderItemLabel = function(item) { - var _a = _this.props.onRenderOption, onRenderOption = _a === void 0 ? _this._onRenderMultiselectOption : _a; - return onRenderOption(item, _this._onRenderMultiselectOption); + this.changeDataSource(ds); + }; + reader.readAsText(file); + } else { + const uploadFormatError = strings.errorInvalidFileFormat; + this.setState({ uploadFormatError }); + } + } + } + loadUrl() { + if (!this.state.url) { + return this.setState({ urlError: strings.errorNoUrl }); + } + if (this.state.url.toLocaleLowerCase().substr(0, 4) !== "http") { + return this.setState({ urlError: strings.errorUrlHttp }); + } + const { url } = this.state; + const ds = { + dataSourceType: "url", + displayName: url, + id: url, + dataUrl: url, + type: this.state.urlType + }; + this.changeDataSource(ds).catch((e) => { + this.setState({ urlError: e.message }); + }); + } + getUrlShortcut(dataUrl, type2) { + const dss = { + dataSource: { + dataSourceType: "url", + dataUrl, + displayName: dataUrl.substring(dataUrl.lastIndexOf("/") + 1, dataUrl.lastIndexOf(".")), + id: "", + type: type2 + } + }; + return "#" + JSON.stringify(dss); + } + render() { + const closeDialog = () => { + this.setState({ dialogMode: null }); + }; + let shortcut; + if (this.state.url && !invalidUrlError(this.state.url) && !this.state.urlError) { + shortcut = this.getUrlShortcut(this.state.url, this.state.urlType); + } + return [React__namespace.createElement( + Dialog$1, + { key: "local", hidden: !(this.state.dialogMode === "local"), onDismiss: closeDialog, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleLocal, + subText: strings.dialogSubtextLocal + } }, + React__namespace.createElement("input", { type: "file", onChange: (e) => this.upload(e), disabled: this.state.working }), + this.state.uploadFormatError && React__namespace.createElement("div", { className: "error" }, this.state.uploadFormatError) + ), React__namespace.createElement( + Dialog$1, + { key: "url", hidden: !(this.state.dialogMode === "url"), onDismiss: closeDialog, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleUrl + }, buttons: [ + React__namespace.createElement(base.fluentUI.PrimaryButton, { key: 0, onClick: (e) => this.loadUrl(), iconProps: { iconName: "CloudDownload" }, text: strings.dialogLoadButton, disabled: this.state.working }) + ] }, + React__namespace.createElement( + "section", + null, + React__namespace.createElement(base.fluentUI.TextField, { label: strings.labelUrl, placeholder: strings.urlInputPlaceholder, onKeyUp: (e) => e.keyCode === 13 && this.loadUrl(), onChange: (e, url) => this.setState({ url, urlError: "" }), value: this.state.url, disabled: this.state.working }), + this.state.urlError && React__namespace.createElement("div", { className: "error" }, this.state.urlError) + ), + React__namespace.createElement( + "section", + null, + React__namespace.createElement(base.fluentUI.ChoiceGroup, { selectedKey: this.state.urlType, options: DataSourcePicker.urlTypes.map((urlType, i) => { + return { + key: urlType, + text: urlType, + disabled: this.state.working + }; + }), onChange: (ev, option) => this.setState({ urlType: option.text, urlError: "" }), label: strings.labelDataFormat }) + ), + React__namespace.createElement( + "section", + { className: "tip", style: { visibility: !invalidUrlError(this.state.url) && !this.state.urlError ? "visible" : "hidden" } }, + strings.labelDataUrlShortcut, + " ", + React__namespace.createElement("a", { href: shortcut, title: strings.labelLinkDescription, "aria-label": strings.labelLinkDescription }, strings.labelLink) + ) + )]; + } + } + DataSourcePicker.urlTypes = ["json", "csv", "tsv", "topojson"]; + function dataSourcePrefix(dt, displayName) { + switch (dt) { + case "sample": + return `${strings.sampleDataPrefix}: ${displayName}`; + case "local": + return strings.localFilePrefix; + case "url": + return strings.urlPrefix; + } + return strings.buttonLoadData; + } + function downloadData(data2, fileName) { + const a2 = document.createElement("a"); + a2.setAttribute("download", fileName); + document.body.appendChild(a2); + const blob = dataURIToBlob(data2); + a2.href = URL.createObjectURL(blob); + a2.onclick = () => { + requestAnimationFrame(() => URL.revokeObjectURL(a2.href)); + document.body.removeChild(a2); + }; + a2.click(); + } + function dataURIToBlob(binStr) { + const len2 = binStr.length, arr = new Uint8Array(len2); + for (let i = 0; i < len2; i++) { + arr[i] = binStr.charCodeAt(i); + } + return new Blob([arr]); + } + var util = util$4; + function markdownImageLink(alt, imageUrl, link2) { + return `[![${alt}](${imageUrl})](${link2})`; + } + function cleanSnapshots(snapshots) { + const clean = util.clone(snapshots); + clean.forEach((snapshot) => { + if (snapshot.dataSource) { + delete snapshot.dataSource.snapshotsUrl; + } + }); + return clean; + } + function downloadSnapshotsJSON(snapshots, filename) { + const clean = cleanSnapshots(snapshots); + downloadData(JSON.stringify(clean, null, 2), filename); + } + function serializeSnapshot(snapshotWithImage) { + const snapshot = util.clone(snapshotWithImage); + delete snapshot.bgColor; + delete snapshot.image; + if (snapshot.dataSource) { + delete snapshot.dataSource.rawText; + } + return JSON.stringify(snapshot); + } + function isSnapshot(snapshot) { + return snapshot.insight && snapshot.title; + } + function validSnapshots(snapshots) { + if (Array.isArray(snapshots)) { + for (let i = 0; i < snapshots.length; i++) { + if (!isSnapshot(snapshots[i])) { + return false; + } + } + return true; + } + return false; + } + class SnapshotImportLocal extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + working: false + }; + } + readFile(e) { + if (e.target.files) { + this.setState({ working: true }); + const file = e.target.files[0]; + const reader = new FileReader(); + reader.onload = () => { + const rawText = reader.result; + let snapshots; + try { + snapshots = JSON.parse(rawText); + } catch (e3) { + this.setState({ fileFormatError: strings.errorInvalidFileFormat, working: false }); + } + if (validSnapshots(snapshots)) { + this.props.onImportSnapshot(snapshots); + this.setState({ working: false }); + this.props.onDismiss(); + } else { + this.setState({ fileFormatError: strings.errorInvalidFileFormat, working: false }); + } }; - _this._onPositioned = function(positions) { - if (_this._focusZone.current) // Focusing an element can trigger a reflow. Making this wait until there is an animation - // frame can improve perf significantly. - _this._requestAnimationFrame(function() { - var selectedIndices = _this.props.hoisted.selectedIndices; - if (_this._focusZone.current) { - if (!_this._hasBeenPositioned && selectedIndices && selectedIndices[0] && !_this.props.options[selectedIndices[0]].disabled) { - var element = (0, _utilities.getDocument)().getElementById("".concat(_this._id, "-list").concat(selectedIndices[0])); - if (element) _this._focusZone.current.focusElement(element); - _this._hasBeenPositioned = true; - } else _this._focusZone.current.focus(); - } + reader.readAsText(file); + } + } + render() { + return React__namespace.createElement( + "div", + null, + React__namespace.createElement( + Dialog$1, + { hidden: false, onDismiss: this.props.onDismiss, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleSnapshotsLocal, + subText: strings.dialogSubtextSnapshotsLocal + } }, + React__namespace.createElement( + "section", + null, + React__namespace.createElement("input", { type: "file", onChange: (e) => this.readFile(e), disabled: this.state.working }), + this.state.fileFormatError && React__namespace.createElement("div", { className: "error" }, this.state.fileFormatError) + ) + ) + ); + } + } + class SnapshotImportRemote extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + working: false + }; + } + getUrlShortcut() { + const dataSource = util.clone(this.props.dataSource); + delete dataSource.snapshots; + dataSource.snapshotsUrl = this.state.url; + const dss = { + dataSource + }; + return "#" + JSON.stringify(dss); + } + loadUrl() { + const urlError = invalidUrlError(this.state.url); + if (urlError) { + return this.setState({ urlError }); + } + const { url } = this.state; + fetch(url).then((response) => { + if (response.status === 200) { + return response.json(); + } else { + this.setState({ urlError: response.statusText }); + } + }).then((snapshots) => { + if (validSnapshots(snapshots)) { + this.props.onImportSnapshot(snapshots); + this.props.onSnapshotsUrl(url); + this.setState({ working: false }); + this.props.onDismiss(); + } else { + this.setState({ fileFormatError: strings.errorInvalidFileFormat, working: false }); + } + }).catch((e) => { + this.setState({ urlError: e }); + }); + } + render() { + let shortcut; + if (this.props.dataSource.dataSourceType !== "local" && this.state.url && !invalidUrlError(this.state.url) && !this.state.urlError) { + shortcut = this.getUrlShortcut(); + } + return React__namespace.createElement( + "div", + null, + React__namespace.createElement( + Dialog$1, + { hidden: false, onDismiss: this.props.onDismiss, dialogContentProps: { + className: `sanddance-dialog ${this.props.theme}`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleSnapshotsUrl + }, buttons: [ + React__namespace.createElement(base.fluentUI.PrimaryButton, { disabled: !this.state.url || !!this.state.urlError, key: 0, onClick: (e) => this.loadUrl(), iconProps: { iconName: "CloudDownload" }, text: strings.dialogLoadButton }) + ] }, + React__namespace.createElement( + "section", + null, + React__namespace.createElement(base.fluentUI.TextField, { label: strings.labelUrl, placeholder: strings.urlInputPlaceholder, onKeyUp: (e) => e.keyCode === 13 && this.loadUrl(), onChange: (e, url) => this.setState({ url, urlError: "" }), value: this.state.url, disabled: this.state.working }), + this.state.urlError && React__namespace.createElement("div", { className: "error" }, this.state.urlError) + ), + this.props.dataSource.dataSourceType !== "local" && React__namespace.createElement( + "section", + { className: "tip", style: { visibility: !invalidUrlError(this.state.url) && !this.state.urlError ? "visible" : "hidden" } }, + strings.labelSnapshotsShortcut, + " ", + React__namespace.createElement("a", { href: shortcut, title: strings.labelLinkDescription, "aria-label": strings.labelLinkDescription }, strings.labelShare) + ) + ) + ); + } + } + function SnapshotExport(props) { + return React__namespace.createElement( + Dialog$1, + { hidden: false, onDismiss: props.onDismiss, dialogContentProps: { + className: `sanddance-dialog ${props.theme} sanddance-export`, + type: base.fluentUI.DialogType.normal, + title: strings.dialogTitleSnapshotsExport + } }, + React__namespace.createElement( + "ul", + null, + React__namespace.createElement( + "li", + null, + React__namespace.createElement("strong", null, strings.labelSnapshotsExportHTMLTitle), + React__namespace.createElement("div", null, strings.labelSnapshotsExportHTMLDescription), + React__namespace.createElement(base.fluentUI.PrimaryButton, { iconProps: { iconName: "Download" }, text: `${strings.buttonExport} ${strings.labelSnapshotsExportHTMLTitle}`, onClick: (e) => { + const clean = cleanSnapshots(props.snapshots); + const html = getEmbedHTML(props.explorer.state.dataContent.data, props.dataSource.displayName, clean); + downloadData(html, `${props.dataSource.displayName}.html`); + } }) + ), + React__namespace.createElement( + "li", + null, + React__namespace.createElement("strong", null, strings.labelSnapshotsExportMarkdownTitle), + React__namespace.createElement("div", null, strings.labelSnapshotsExportMarkdownDescription), + React__namespace.createElement(base.fluentUI.PrimaryButton, { iconProps: { iconName: "Download" }, text: `${strings.buttonExport} ${strings.labelSnapshotsExportMarkdownTitle}`, onClick: (e) => { + const sections = props.snapshots.map((snapshot) => { + const section = [`## ${snapshot.title}`]; + section.push(snapshot.description); + section.push("\n"); + const url = `${location.origin}/#${encodeURIComponent(serializeSnapshot(snapshot))}`; + section.push(markdownImageLink(snapshot.title, snapshot.image, url)); + return section.join("\n"); }); - if (!_this.state.calloutRenderEdge || _this.state.calloutRenderEdge !== positions.targetEdge) _this.setState({ - calloutRenderEdge: positions.targetEdge + sections.unshift(`# ${props.dataSource.displayName}`); + downloadData(sections.join("\n\n"), `${props.dataSource.displayName}.snapshots.md`); + } }) + ) + ) + ); + } + function getViewerOptions(darkTheme2, themeColors2) { + const colors2 = themeColors2 && themeColors2[darkTheme2 ? "dark" : "light"]; + const viewerOptions = { + colors: Object.assign(Object.assign({}, getColorSettingsFromThemePalette(themePalettes[darkTheme2 ? "dark-theme" : ""])), colors2) + }; + return viewerOptions; + } + function getSnapshotFromHash() { + const hash = document.location.hash && document.location.hash.substring(1); + if (hash) { + try { + return JSON.parse(decodeURIComponent(hash)); + } catch (e) { + } + } + } + let snapshotOnLoad = getSnapshotFromHash(); + if (snapshotOnLoad && snapshotOnLoad.dataSource && snapshotOnLoad.dataSource.dataSourceType === "local") { + snapshotOnLoad = null; + } + class SandDanceApp extends React__namespace.Component { + constructor(props) { + super(props); + this.state = { + compactUI: !!localStorage.getItem("compactUI"), + dialogMode: null, + dataSource: snapshotOnLoad && snapshotOnLoad.dataSource || props.dataSources[0], + darkTheme: props.darkTheme + }; + this.viewerOptions = getViewerOptions(this.state.darkTheme, props.themeColors); + this.handlers = { + hashchange: (e) => { + const snapshot = getSnapshotFromHash(); + if (snapshot) { + this.explorer && this.explorer.calculate(() => this.hydrateSnapshot(snapshot)); + } + }, + resize: (e) => { + this.explorer && this.explorer.resize(); + } + }; + this.wireEventHandlers(true); + this.changeColorScheme(this.state.darkTheme); + } + wireEventHandlers(add2) { + for (const key2 in this.handlers) { + if (add2) { + window.addEventListener(key2, this.handlers[key2]); + } else { + window.removeEventListener(key2, this.handlers[key2]); + } + } + } + isSameDataSource(a2, b2) { + if (a2.dataSourceType === b2.dataSourceType && a2.type === b2.type && a2.id === b2.id) { + if (a2.dataSourceType === "url") { + return a2.dataUrl === b2.dataUrl; + } + return true; + } + return false; + } + hydrateSnapshot(snapshot, selectedSnapshotIndex = -1) { + if (snapshot.dataSource) { + if (this.isSameDataSource(snapshot.dataSource, this.state.dataSource)) { + if (selectedSnapshotIndex === -1) { + this.explorer.reviveSnapshot(snapshot); + } else { + this.explorer.reviveSnapshot(selectedSnapshotIndex); + } + if (snapshot.dataSource.snapshotsUrl && snapshot.dataSource.snapshotsUrl !== this.state.dataSource.snapshotsUrl) { + fetch(snapshot.dataSource.snapshotsUrl).then((response) => response.json()).then((snapshots) => { + if (validSnapshots(snapshots)) { + this.explorer.setState({ snapshots }); + const dataSource = Object.assign({}, this.state.dataSource); + dataSource.snapshotsUrl = snapshot.dataSource.snapshotsUrl; + this.setState({ dataSource }); + } }); - }; - _this._onItemClick = function(item) { - return function(event) { - if (!item.disabled) { - _this.setSelectedIndex(event, item.index); - if (!_this.props.multiSelect) // only close the callout when it's in single-select mode - _this.setState({ - isOpen: false - }); - } + } + } else { + if (snapshot.dataSource.dataSourceType === "local") { + this.dataSourcePicker.setState({ dialogMode: "local" }); + this.postLoad = (ds) => { + if (this.isSameDataSource(snapshot.dataSource, ds)) { + this.hydrateSnapshot(snapshot, selectedSnapshotIndex); + } }; - }; - /** - * Scroll handler for the callout to make sure the mouse events - * for updating focus are not interacting during scroll - */ _this._onScroll = function() { - var win = (0, _dom.getWindowEx)(_this.context); // can only be called on the client - if (!_this._isScrollIdle && _this._scrollIdleTimeoutId !== undefined) { - win.clearTimeout(_this._scrollIdleTimeoutId); - _this._scrollIdleTimeoutId = undefined; - } else _this._isScrollIdle = false; - _this._scrollIdleTimeoutId = win.setTimeout(function() { - _this._isScrollIdle = true; - }, _this._scrollIdleDelay); - }; - _this._onMouseItemLeave = function(item, ev) { - if (_this._shouldIgnoreMouseEvent()) return; - /** - * IE11 focus() method forces parents to scroll to top of element. - * Edge and IE expose a setActive() function for focusable divs that - * sets the page focus but does not scroll the parent element. - */ if (_this._host.current) { - if (_this._host.current.setActive) try { - _this._host.current.setActive(); - } catch (e) { - /* no-op */ } - else _this._host.current.focus(); - } - }; - _this._onDismiss = function() { - _this.setState({ - isOpen: false + } else { + this.load(snapshot.dataSource, snapshot.insight).then(() => { + this.explorer.setState({ sideTabId: SideTabId.Snapshots, note: snapshot.description }); + this.explorer.scrollSnapshotIntoView(selectedSnapshotIndex); + }).catch((e) => { + this.loadError(snapshot.dataSource); }); - }; - _this._onDropdownBlur = function(ev) { - // If Dropdown disabled do not proceed with this logic. - var disabled = _this._isDisabled(); - if (disabled) return; - if (_this.state.isOpen) // Do not call onBlur or update focus state when the callout is opened - return; - _this.setState({ - hasFocus: false - }); - if (_this.props.onBlur) _this.props.onBlur(ev); - }; - _this._onDropdownKeyDown = function(ev) { - // If Dropdown disabled do not process any keyboard events. - var disabled = _this._isDisabled(); - if (disabled) return; - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in _shouldHandleKeyUp for reasoning. - _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); - if (_this.props.onKeyDown) { - _this.props.onKeyDown(ev); - if (ev.defaultPrevented) return; - } - var newIndex; - var selectedIndex = _this.props.hoisted.selectedIndices.length ? _this.props.hoisted.selectedIndices[0] : -1; - var containsExpandCollapseModifier = ev.altKey || ev.metaKey; - var isOpen = _this.state.isOpen; - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).enter: - _this.setState({ - isOpen: !isOpen - }); - break; - case (0, _utilities.KeyCodes).escape: - if (!isOpen) return; - _this.setState({ - isOpen: false - }); - break; - case (0, _utilities.KeyCodes).up: - if (containsExpandCollapseModifier) { - if (isOpen) { - _this.setState({ - isOpen: false - }); - break; - } - return; - } - if (_this.props.multiSelect) _this.setState({ - isOpen: true - }); - else if (!_this._isDisabled()) newIndex = _this._moveIndex(ev, -1, selectedIndex - 1, selectedIndex); - break; - case (0, _utilities.KeyCodes).down: - if (containsExpandCollapseModifier) { - ev.stopPropagation(); - ev.preventDefault(); - } - if (containsExpandCollapseModifier && !isOpen || _this.props.multiSelect) _this.setState({ - isOpen: true - }); - else if (!_this._isDisabled()) newIndex = _this._moveIndex(ev, 1, selectedIndex + 1, selectedIndex); - break; - case (0, _utilities.KeyCodes).home: - if (!_this.props.multiSelect) newIndex = _this._moveIndex(ev, 1, 0, selectedIndex); - break; - case (0, _utilities.KeyCodes).end: - if (!_this.props.multiSelect) newIndex = _this._moveIndex(ev, -1, _this.props.options.length - 1, selectedIndex); - break; - case (0, _utilities.KeyCodes).space: - break; - default: - return; - } - if (newIndex !== selectedIndex) { - ev.stopPropagation(); - ev.preventDefault(); - } - }; - _this._onDropdownKeyUp = function(ev) { - // If Dropdown disabled do not process any keyboard events. - var disabled = _this._isDisabled(); - if (disabled) return; - var shouldHandleKey = _this._shouldHandleKeyUp(ev); - var isOpen = _this.state.isOpen; - if (_this.props.onKeyUp) { - _this.props.onKeyUp(ev); - if (ev.defaultPrevented) return; - } - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).space: - _this.setState({ - isOpen: !isOpen - }); - break; - default: - if (shouldHandleKey && isOpen) _this.setState({ - isOpen: false - }); - return; - } - ev.stopPropagation(); - ev.preventDefault(); - }; - _this._onZoneKeyDown = function(ev) { - var _a, _b; - var elementToFocus; - // Take note if we are processing an alt (option) or meta (command) keydown. - // See comment in _shouldHandleKeyUp for reasoning. - _this._lastKeyDownWasAltOrMeta = _this._isAltOrMeta(ev); - var containsExpandCollapseModifier = ev.altKey || ev.metaKey; - // eslint-disable-next-line deprecation/deprecation - switch(ev.which){ - case (0, _utilities.KeyCodes).up: - if (containsExpandCollapseModifier) _this.setState({ - isOpen: false - }); - else if (_this._host.current) elementToFocus = (0, _utilities.getLastFocusable)(_this._host.current, _this._host.current.lastChild, true); - break; - // All directional keystrokes should be canceled when the zone is rendered. - // This avoids the body scroll from reacting and thus dismissing the dropdown. - case (0, _utilities.KeyCodes).home: - case (0, _utilities.KeyCodes).end: - case (0, _utilities.KeyCodes).pageUp: - case (0, _utilities.KeyCodes).pageDown: - break; - case (0, _utilities.KeyCodes).down: - if (!containsExpandCollapseModifier && _this._host.current) elementToFocus = (0, _utilities.getFirstFocusable)(_this._host.current, _this._host.current.firstChild, true); - break; - case (0, _utilities.KeyCodes).escape: - _this.setState({ - isOpen: false - }); - break; - case (0, _utilities.KeyCodes).tab: - _this.setState({ - isOpen: false - }); - var document_1 = (0, _utilities.getDocument)(); - if (document_1) { - if (ev.shiftKey) (_a = (0, _utilities1.getPreviousElement)(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _a === void 0 || _a.focus(); - else (_b = (0, _utilities1.getNextElement)(document_1.body, _this._dropDown.current, false, false, true, true)) === null || _b === void 0 || _b.focus(); + } + } + return true; + } + } + load(dataSource, partialInsight) { + dataSource = clone(dataSource); + this.setState({ dataSource }); + document.title = `SandDance - ${dataSource.displayName}`; + return this.explorer.load(dataSource, (columns) => { + return partialInsight || this.props.insights && this.props.insights[dataSource.id]; + }, this.props.initialOptions && deepMerge({}, this.props.initialOptions["*"], this.props.initialOptions[dataSource.id])); + } + dataSourceError(dataSource) { + switch (dataSource.dataSourceType) { + case "local": + return strings.errorDataSourceFromLocal(dataSource); + case "sample": + case "url": + return strings.errorDataSourceFromUrl(dataSource); + } + } + loadError(dataSource) { + const error2 = this.dataSourceError(dataSource); + this.explorer.setState({ errors: [error2] }); + this.setState({ dataSource: { dataSourceType: null, id: null, type: null } }); + } + updateExplorerViewerOptions(viewerOptions) { + this.viewerOptions = viewerOptions; + this.explorer && this.explorer.updateViewerOptions(this.viewerOptions); + } + getThemePalette(darkTheme2) { + const theme = darkTheme2 ? "dark-theme" : ""; + return themePalettes[theme]; + } + changeColorScheme(darkTheme2) { + this.updateExplorerViewerOptions(getViewerOptions(darkTheme2, this.props.themeColors)); + base$3.vega.scheme(ColorScaleNone, (x2) => this.explorer.viewer.options.colors.defaultCube); + this.explorer && this.explorer.viewer && this.explorer.viewer.renderSameLayout(this.viewerOptions); + base.fluentUI.loadTheme({ palette: this.getThemePalette(darkTheme2) }); + } + render() { + const theme = this.state.darkTheme ? "dark-theme" : ""; + const dataSourceProps = { + dataSource: this.state.dataSource, + dataSources: this.props.dataSources, + changeDataSource: (dataSource) => { + document.location.hash = ""; + return this.load(dataSource).then(() => { + if (this.postLoad) { + this.postLoad(dataSource); + this.postLoad = null; + } + }).catch(() => this.loadError(dataSource)); + } + }; + return React__namespace.createElement( + "section", + { className: "sanddance-app" }, + React__namespace.createElement(Explorer, { logoClickTarget: "_self", logoClickUrl: "/SandDance/", theme, snapshotProps: { + modifySnapShot: (snapshot) => { + snapshot.dataSource = this.state.dataSource; + }, + getTopActions: (snapshots) => { + const items = [ + { + key: "import", + text: strings.menuSnapshotsImport, + subMenuProps: { + items: [ + { + key: "import-local", + text: strings.menuLocal, + onClick: () => this.setState({ dialogMode: "import-local" }) + }, + { + key: "import-remote", + text: strings.menuUrl, + onClick: () => this.setState({ dialogMode: "import-remote" }) } - break; - default: - return; - } - if (elementToFocus) elementToFocus.focus(); - ev.stopPropagation(); - ev.preventDefault(); - }; - _this._onZoneKeyUp = function(ev) { - var shouldHandleKey = _this._shouldHandleKeyUp(ev); - if (shouldHandleKey && _this.state.isOpen) { - _this.setState({ - isOpen: false - }); - ev.preventDefault(); - } - }; - _this._onDropdownClick = function(ev) { - if (_this.props.onClick) { - _this.props.onClick(ev); - if (ev.defaultPrevented) return; - } - var isOpen = _this.state.isOpen; - var disabled = _this._isDisabled(); - if (!disabled && !_this._shouldOpenOnFocus()) _this.setState({ - isOpen: !isOpen - }); - _this._isFocusedByClick = false; // reset - }; - _this._onDropdownMouseDown = function() { - _this._isFocusedByClick = true; - }; - _this._onFocus = function(ev) { - var disabled = _this._isDisabled(); - if (!disabled) { - if (_this.props.onFocus) _this.props.onFocus(ev); - var state = { - hasFocus: true - }; - if (_this._shouldOpenOnFocus()) state.isOpen = true; - _this.setState(state); - } - }; - /** - * Because the isDisabled prop is deprecated, we have had to repeat this logic all over the place. - * This helper method avoids all the repetition. - */ _this._isDisabled = function() { - var disabled = _this.props.disabled; - // eslint-disable-next-line deprecation/deprecation - var isDisabled = _this.props.isDisabled; - // Remove this deprecation workaround at 1.0.0 - if (disabled === undefined) disabled = isDisabled; - return disabled; - }; - _this._onRenderLabel = function(props) { - var label = props.label, required = props.required, disabled = props.disabled; - var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined; - return label ? _react.createElement((0, _label.Label), { - className: _this._classNames.label, - id: _this._labelId, - required: required, - styles: labelStyles, - disabled: disabled - }, label) : null; - }; - (0, _utilities.initializeComponentRef)(_this); - var multiSelect = props.multiSelect, selectedKey = props.selectedKey, selectedKeys = props.selectedKeys, defaultSelectedKey = props.defaultSelectedKey, defaultSelectedKeys = props.defaultSelectedKeys, options = props.options; - var warnMultiSelect, warnNotMultiSelect; - _this._id = props.id || (0, _utilities.getId)('Dropdown'); - _this._labelId = _this._id + '-label'; - _this._listId = _this._id + '-list'; - _this._optionId = _this._id + '-option'; - _this._isScrollIdle = true; - _this._hasBeenPositioned = false; - _this._sizePosCache.updateOptions(options); - _this.state = { - isOpen: false, - hasFocus: false, - calloutRenderEdge: undefined - }; - return _this; + ] + } + }, + { + key: "export", + text: strings.menuSnapshotsExportAsJSON, + disabled: snapshots.length === 0, + onClick: () => downloadSnapshotsJSON(snapshots, `${this.state.dataSource.displayName}.snapshots`) + }, + { + key: "export-as", + text: strings.menuSnapshotsExportAs, + disabled: snapshots.length === 0, + onClick: () => this.setState({ dialogMode: "export" }) + } + ]; + return items; + }, + getChildren: (snapshots) => React__namespace.createElement( + "div", + null, + this.state.dialogMode === "import-local" && React__namespace.createElement(SnapshotImportLocal, { theme, dataSource: this.state.dataSource, onImportSnapshot: (snapshots2) => this.explorer.setState({ snapshots: snapshots2 }), onDismiss: () => this.setState({ dialogMode: null }) }), + this.state.dialogMode === "import-remote" && React__namespace.createElement(SnapshotImportRemote, { theme, dataSource: this.state.dataSource, onImportSnapshot: (snapshots2) => this.explorer.setState({ snapshots: snapshots2 }), onSnapshotsUrl: (snapshotsUrl) => { + const dataSource = Object.assign({}, this.state.dataSource); + dataSource.snapshotsUrl = snapshotsUrl; + this.setState({ dataSource }); + }, onDismiss: () => this.setState({ dialogMode: null }) }), + this.state.dialogMode === "export" && React__namespace.createElement(SnapshotExport, { explorer: this.explorer, dataSource: this.state.dataSource, snapshots, onDismiss: () => this.setState({ dialogMode: null }), theme }) + ), + getActions: (snapshot, i) => { + const url = "#" + serializeSnapshot(snapshot); + let element2; + if (snapshot.dataSource && snapshot.dataSource.dataSourceType === "local") { + element2 = React__namespace.createElement("span", { key: `link${i}` }, strings.labelLocal); + } else { + element2 = React__namespace.createElement("a", { key: `link${i}`, href: url, title: strings.labelLinkDescription, "aria-label": strings.labelLinkDescription }, strings.labelShare); + } + return [{ element: element2 }]; + }, + getTitle: (insight) => `${this.state.dataSource.displayName} ${insight.chart}`, + getDescription: (insight) => "" + //TODO create description from filter etc. + }, onSnapshotClick: (snapshot, selectedSnapshotIndex) => this.hydrateSnapshot(snapshot, selectedSnapshotIndex), initialView: "2d", mounted: (e) => { + this.explorer = e; + this.load(this.state.dataSource, snapshotOnLoad && snapshotOnLoad.insight).catch((e3) => { + this.loadError(this.state.dataSource); + }); + this.props.mounted(this); + }, dataExportHandler: (data2, datatype, displayName) => { + try { + downloadData(data2, `${displayName}.${datatype}`); + } catch (e) { + this.explorer.setState({ errors: [strings.errorDownloadFailure] }); + } + }, datasetElement: React__namespace.createElement(DataSourceButton, Object.assign({ getPicker: () => this.dataSourcePicker }, dataSourceProps)), topBarButtonProps: [ + { + key: "theme", + text: this.state.darkTheme ? strings.buttonThemeLight : strings.buttonThemeDark, + iconProps: { + iconName: this.state.darkTheme ? "Sunny" : "ClearNight" + }, + onClick: () => { + const darkTheme2 = !this.state.darkTheme; + this.props.setTheme && this.props.setTheme(darkTheme2); + this.setState({ darkTheme: darkTheme2 }); + this.changeColorScheme(darkTheme2); + } + } + ], viewerOptions: this.viewerOptions, compactUI: this.state.compactUI, additionalSettings: [ + { + groupLabel: strings.labelPreferences, + children: React__namespace.createElement(base.fluentUI.Toggle, { label: strings.labelCompactUI, title: strings.labelCompactUIDescription, checked: this.state.compactUI, onChange: (e, checked) => { + if (checked) { + localStorage.setItem("compactUI", "true"); + } else { + localStorage.removeItem("compactUI"); + } + this.setState({ compactUI: checked }); + } }) + } + ] }), + React__namespace.createElement(DataSourcePicker, Object.assign({ ref: (dsp) => { + if (dsp && !this.dataSourcePicker) + this.dataSourcePicker = dsp; + }, theme }, dataSourceProps)) + ); } - Object.defineProperty(DropdownInternal.prototype, "selectedOptions", { - /** - * All selected options - */ get: function() { - var _a = this.props, options = _a.options, selectedIndices = _a.hoisted.selectedIndices; - return (0, _selectableOption.getAllSelectedOptions)(options, selectedIndices); - }, - enumerable: false, - configurable: true - }); - DropdownInternal.prototype.componentWillUnmount = function() { - clearTimeout(this._scrollIdleTimeoutId); + } + function accessor(fn2, fields, name) { + fn2.fields = fields || []; + fn2.fname = name; + return fn2; + } + function accessorName(fn2) { + return fn2 == null ? null : fn2.fname; + } + function accessorFields(fn2) { + return fn2 == null ? null : fn2.fields; + } + function getter$1(path2) { + return path2.length === 1 ? get1(path2[0]) : getN(path2); + } + const get1 = (field2) => function(obj2) { + return obj2[field2]; + }; + const getN = (path2) => { + const len2 = path2.length; + return function(obj2) { + for (let i = 0; i < len2; ++i) { + obj2 = obj2[path2[i]]; + } + return obj2; }; - DropdownInternal.prototype.componentDidUpdate = function(prevProps, prevState) { - if (prevState.isOpen === true && this.state.isOpen === false) { - this._gotMouseMove = false; - this._hasBeenPositioned = false; - if (this.props.onDismiss) this.props.onDismiss(); + }; + function error(message) { + throw Error(message); + } + function splitAccessPath(p) { + const path2 = [], n = p.length; + let q = null, b2 = 0, s2 = "", i, j, c2; + p = p + ""; + function push2() { + path2.push(s2 + p.substring(i, j)); + s2 = ""; + i = j + 1; + } + for (i = j = 0; j < n; ++j) { + c2 = p[j]; + if (c2 === "\\") { + s2 += p.substring(i, j++); + i = j; + } else if (c2 === q) { + push2(); + q = null; + b2 = -1; + } else if (q) { + continue; + } else if (i === b2 && c2 === '"') { + i = j + 1; + q = c2; + } else if (i === b2 && c2 === "'") { + i = j + 1; + q = c2; + } else if (c2 === "." && !b2) { + if (j > i) { + push2(); + } else { + i = j + 1; + } + } else if (c2 === "[") { + if (j > i) push2(); + b2 = i = j + 1; + } else if (c2 === "]") { + if (!b2) error("Access path missing open bracket: " + p); + if (b2 > 0) push2(); + b2 = 0; + i = j + 1; + } + } + if (b2) error("Access path missing closing bracket: " + p); + if (q) error("Access path missing closing quote: " + p); + if (j > i) { + j++; + push2(); + } + return path2; + } + function field$1(field2, name, opt) { + const path2 = splitAccessPath(field2); + field2 = path2.length === 1 ? path2[0] : field2; + return accessor((opt && opt.get || getter$1)(path2), [field2], name || field2); + } + const id = field$1("id"); + const identity$2 = accessor((_) => _, [], "identity"); + const zero$1 = accessor(() => 0, [], "zero"); + const one$1 = accessor(() => 1, [], "one"); + const truthy = accessor(() => true, [], "true"); + const falsy = accessor(() => false, [], "false"); + const DisallowedObjectProperties = /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + function log$1$1(method2, level, input) { + const args = [level].concat([].slice.call(input)); + console[method2].apply(console, args); + } + const None$2 = 0; + const Error$1 = 1; + const Warn = 2; + const Info = 3; + const Debug = 4; + function logger(_, method2, handler = log$1$1) { + let level = _ || None$2; + return { + level(_2) { + if (arguments.length) { + level = +_2; + return this; + } else { + return level; } + }, + error() { + if (level >= Error$1) handler(method2 || "error", "ERROR", arguments); + return this; + }, + warn() { + if (level >= Warn) handler(method2 || "warn", "WARN", arguments); + return this; + }, + info() { + if (level >= Info) handler(method2 || "log", "INFO", arguments); + return this; + }, + debug() { + if (level >= Debug) handler(method2 || "log", "DEBUG", arguments); + return this; + } }; - DropdownInternal.prototype.render = function() { - var id = this._id; - var props = this.props; - var className = props.className, label = props.label, options = props.options, ariaLabel = props.ariaLabel, required = props.required, errorMessage = props.errorMessage, propStyles = props.styles, theme = props.theme, panelProps = props.panelProps, calloutProps = props.calloutProps, _a = props.onRenderTitle, onRenderTitle = _a === void 0 ? this._getTitle : _a, _b = props.onRenderContainer, onRenderContainer = _b === void 0 ? this._onRenderContainer : _b, _c = props.onRenderCaretDown, onRenderCaretDown = _c === void 0 ? this._onRenderCaretDown : _c, _d = props.onRenderLabel, onRenderLabel = _d === void 0 ? this._onRenderLabel : _d, _e = props.onRenderItem, onRenderItem = _e === void 0 ? this._onRenderItem : _e, selectedIndices = props.hoisted.selectedIndices; - var _f = this.state, isOpen = _f.isOpen, calloutRenderEdge = _f.calloutRenderEdge, hasFocus = _f.hasFocus; - // eslint-disable-next-line deprecation/deprecation - var onRenderPlaceholder = props.onRenderPlaceholder || props.onRenderPlaceHolder || this._getPlaceholder; - // If our cached options are out of date update our cache - if (options !== this._sizePosCache.cachedOptions) this._sizePosCache.updateOptions(options); - var selectedOptions = (0, _selectableOption.getAllSelectedOptions)(options, selectedIndices); - var divProps = (0, _utilities.getNativeProps)(props, (0, _utilities.divProperties)); - var disabled = this._isDisabled(); - var errorMessageId = id + '-errorMessage'; - this._classNames = getClassNames(propStyles, { - theme: theme, - className: className, - hasError: !!(errorMessage && errorMessage.length > 0), - hasLabel: !!label, - isOpen: isOpen, - required: required, - disabled: disabled, - isRenderingPlaceholder: !selectedOptions.length, - panelClassName: panelProps ? panelProps.className : undefined, - calloutClassName: calloutProps ? calloutProps.className : undefined, - calloutRenderEdge: calloutRenderEdge - }); - var hasErrorMessage = !!errorMessage && errorMessage.length > 0; - return _react.createElement("div", { - className: this._classNames.root, - ref: this.props.hoisted.rootRef, - "aria-owns": isOpen ? this._listId : undefined - }, onRenderLabel(this.props, this._onRenderLabel), _react.createElement("div", (0, _tslib.__assign)({ - "data-is-focusable": !disabled, - "data-ktp-target": true, - ref: this._dropDown, - id: id, - tabIndex: disabled ? -1 : 0, - role: "combobox", - "aria-haspopup": "listbox", - "aria-expanded": isOpen ? 'true' : 'false', - "aria-label": ariaLabel, - "aria-labelledby": label && !ariaLabel ? (0, _utilities.mergeAriaAttributeValues)(this._labelId, this._optionId) : undefined, - "aria-describedby": hasErrorMessage ? this._id + '-errorMessage' : undefined, - "aria-required": required, - "aria-disabled": disabled, - "aria-controls": isOpen ? this._listId : undefined - }, divProps, { - className: this._classNames.dropdown, - onBlur: this._onDropdownBlur, - onKeyDown: this._onDropdownKeyDown, - onKeyUp: this._onDropdownKeyUp, - onClick: this._onDropdownClick, - onMouseDown: this._onDropdownMouseDown, - onFocus: this._onFocus - }), _react.createElement("span", { - id: this._optionId, - className: this._classNames.title, - "aria-live": hasFocus ? 'polite' : undefined, - "aria-atomic": hasFocus ? true : undefined, - "aria-invalid": hasErrorMessage - }, // If option is selected render title, otherwise render the placeholder text - selectedOptions.length ? onRenderTitle(selectedOptions, this._onRenderTitle) : onRenderPlaceholder(props, this._onRenderPlaceholder)), _react.createElement("span", { - className: this._classNames.caretDownWrapper - }, onRenderCaretDown(props, this._onRenderCaretDown))), isOpen && onRenderContainer((0, _tslib.__assign)((0, _tslib.__assign)({}, props), { - onDismiss: this._onDismiss, - onRenderItem: onRenderItem - }), this._onRenderContainer), hasErrorMessage && _react.createElement("div", { - role: "alert", - id: errorMessageId, - className: this._classNames.errorMessage - }, errorMessage)); - }; - DropdownInternal.prototype.focus = function(shouldOpenOnFocus) { - if (this._dropDown.current) { - this._dropDown.current.focus(); - if (shouldOpenOnFocus) this.setState({ - isOpen: true - }); + } + var isArray = Array.isArray; + function isObject(_) { + return _ === Object(_); + } + const isLegalKey = (key2) => key2 !== "__proto__"; + function mergeConfig(...configs) { + return configs.reduce((out, source2) => { + for (const key2 in source2) { + if (key2 === "signals") { + out.signals = mergeNamed(out.signals, source2.signals); + } else { + const r = key2 === "legend" ? { + layout: 1 + } : key2 === "style" ? true : null; + writeConfig(out, key2, source2[key2], r); + } + } + return out; + }, {}); + } + function writeConfig(output2, key2, value2, recurse2) { + if (!isLegalKey(key2)) return; + let k, o; + if (isObject(value2) && !isArray(value2)) { + o = isObject(output2[key2]) ? output2[key2] : output2[key2] = {}; + for (k in value2) { + if (recurse2 && (recurse2 === true || recurse2[k])) { + writeConfig(o, k, value2[k]); + } else if (isLegalKey(k)) { + o[k] = value2[k]; } + } + } else { + output2[key2] = value2; + } + } + function mergeNamed(a2, b2) { + if (a2 == null) return b2; + const map2 = {}, out = []; + function add2(_) { + if (!map2[_.name]) { + map2[_.name] = 1; + out.push(_); + } + } + b2.forEach(add2); + a2.forEach(add2); + return out; + } + function peek$1(array2) { + return array2[array2.length - 1]; + } + function toNumber(_) { + return _ == null || _ === "" ? null : +_; + } + const exp$2 = (sign2) => (x2) => sign2 * Math.exp(x2); + const log$3 = (sign2) => (x2) => Math.log(sign2 * x2); + const symlog = (c2) => (x2) => Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); + const symexp = (c2) => (x2) => Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + const pow$3 = (exponent2) => (x2) => x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); + function pan(domain2, delta, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), dd = (d1 - d0) * delta; + return [ground(d0 - dd), ground(d1 - dd)]; + } + function panLinear(domain2, delta) { + return pan(domain2, delta, toNumber, identity$2); + } + function panLog(domain2, delta) { + var sign2 = Math.sign(domain2[0]); + return pan(domain2, delta, log$3(sign2), exp$2(sign2)); + } + function panPow(domain2, delta, exponent2) { + return pan(domain2, delta, pow$3(exponent2), pow$3(1 / exponent2)); + } + function panSymlog(domain2, delta, constant2) { + return pan(domain2, delta, symlog(constant2), symexp(constant2)); + } + function zoom(domain2, anchor, scale2, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; + return [ground(da + (d0 - da) * scale2), ground(da + (d1 - da) * scale2)]; + } + function zoomLinear(domain2, anchor, scale2) { + return zoom(domain2, anchor, scale2, toNumber, identity$2); + } + function zoomLog(domain2, anchor, scale2) { + const sign2 = Math.sign(domain2[0]); + return zoom(domain2, anchor, scale2, log$3(sign2), exp$2(sign2)); + } + function zoomPow(domain2, anchor, scale2, exponent2) { + return zoom(domain2, anchor, scale2, pow$3(exponent2), pow$3(1 / exponent2)); + } + function zoomSymlog(domain2, anchor, scale2, constant2) { + return zoom(domain2, anchor, scale2, symlog(constant2), symexp(constant2)); + } + function quarter(date2) { + return 1 + ~~(new Date(date2).getMonth() / 3); + } + function utcquarter(date2) { + return 1 + ~~(new Date(date2).getUTCMonth() / 3); + } + function array$4(_) { + return _ != null ? isArray(_) ? _ : [_] : []; + } + function clampRange(range2, min2, max2) { + let lo = range2[0], hi = range2[1], span2; + if (hi < lo) { + span2 = hi; + hi = lo; + lo = span2; + } + span2 = hi - lo; + return span2 >= max2 - min2 ? [min2, max2] : [lo = Math.min(Math.max(lo, min2), max2 - span2), lo + span2]; + } + function isFunction(_) { + return typeof _ === "function"; + } + const DESCENDING = "descending"; + function compare$1(fields, orders, opt) { + opt = opt || {}; + orders = array$4(orders) || []; + const ord = [], get2 = [], fmap = {}, gen = opt.comparator || comparator; + array$4(fields).forEach((f, i) => { + if (f == null) return; + ord.push(orders[i] === DESCENDING ? -1 : 1); + get2.push(f = isFunction(f) ? f : field$1(f, null, opt)); + (accessorFields(f) || []).forEach((_) => fmap[_] = 1); + }); + return get2.length === 0 ? null : accessor(gen(get2, ord), Object.keys(fmap)); + } + const ascending$1 = (u2, v) => (u2 < v || u2 == null) && v != null ? -1 : (u2 > v || v == null) && u2 != null ? 1 : (v = v instanceof Date ? +v : v, u2 = u2 instanceof Date ? +u2 : u2) !== u2 && v === v ? -1 : v !== v && u2 === u2 ? 1 : 0; + const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); + const compare1 = (field2, order) => function(a2, b2) { + return ascending$1(field2(a2), field2(b2)) * order; + }; + const compareN = (fields, orders, n) => { + orders.push(0); + return function(a2, b2) { + let f, c2 = 0, i = -1; + while (c2 === 0 && ++i < n) { + f = fields[i]; + c2 = ascending$1(f(a2), f(b2)); + } + return c2 * orders[i]; }; - DropdownInternal.prototype.setSelectedIndex = function(event, index) { - var _a = this.props, options = _a.options, selectedKey = _a.selectedKey, selectedKeys = _a.selectedKeys, multiSelect = _a.multiSelect, notifyOnReselect = _a.notifyOnReselect, _b = _a.hoisted.selectedIndices, selectedIndices = _b === void 0 ? [] : _b; - var checked = selectedIndices ? selectedIndices.indexOf(index) > -1 : false; - var newIndexes = []; - index = Math.max(0, Math.min(options.length - 1, index)); - // If this is a controlled component then no state change should take place. - if (selectedKey !== undefined || selectedKeys !== undefined) { - this._onChange(event, options, index, checked, multiSelect); - return; + }; + function constant$4(_) { + return isFunction(_) ? _ : () => _; + } + function debounce(delay, handler) { + let tid; + return (e) => { + if (tid) clearTimeout(tid); + tid = setTimeout(() => (handler(e), tid = null), delay); + }; + } + function extend(_) { + for (let x2, k, i = 1, len2 = arguments.length; i < len2; ++i) { + x2 = arguments[i]; + for (k in x2) { + _[k] = x2[k]; + } + } + return _; + } + function extent(array2, f) { + let i = 0, n, v, min2, max2; + if (array2 && (n = array2.length)) { + if (f == null) { + for (v = array2[i]; i < n && (v == null || v !== v); v = array2[++i]) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = array2[i]; + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + } + } else { + for (v = f(array2[i]); i < n && (v == null || v !== v); v = f(array2[++i])) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = f(array2[i]); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + } + } + } + return [min2, max2]; + } + function extentIndex(array2, f) { + const n = array2.length; + let i = -1, a2, b2, c2, u2, v; + if (f == null) { + while (++i < n) { + b2 = array2[i]; + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; + } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = array2[i]; + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } + } + } + } else { + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; + } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } + } + } + } + return [u2, v]; + } + function has$1(object2, property2) { + return Object.hasOwn(object2, property2); + } + const NULL = {}; + function fastmap(input) { + let obj2 = {}, test2; + function has$1$1(key2) { + return has$1(obj2, key2) && obj2[key2] !== NULL; + } + const map2 = { + size: 0, + empty: 0, + object: obj2, + has: has$1$1, + get(key2) { + return has$1$1(key2) ? obj2[key2] : void 0; + }, + set(key2, value2) { + if (!has$1$1(key2)) { + ++map2.size; + if (obj2[key2] === NULL) --map2.empty; + } + obj2[key2] = value2; + return this; + }, + delete(key2) { + if (has$1$1(key2)) { + --map2.size; + ++map2.empty; + obj2[key2] = NULL; } - if (!multiSelect && !notifyOnReselect && index === selectedIndices[0]) return; - else if (multiSelect) { - newIndexes = selectedIndices ? this._copyArray(selectedIndices) : []; - if (checked) { - var position = newIndexes.indexOf(index); - if (position > -1) // unchecked the current one - newIndexes.splice(position, 1); - } else // add the new selected index into the existing one - newIndexes.push(index); - } else // Set the selected option if this is an uncontrolled component - newIndexes = [ - index - ]; - event.persist(); - // Call onChange after state is updated - this.props.hoisted.setSelectedIndices(newIndexes); - this._onChange(event, options, index, checked, multiSelect); - }; - DropdownInternal.prototype._copyArray = function(array) { - var newArray = []; - for(var _i = 0, array_1 = array; _i < array_1.length; _i++){ - var element = array_1[_i]; - newArray.push(element); + return this; + }, + clear() { + map2.size = map2.empty = 0; + map2.object = obj2 = {}; + }, + test(_) { + if (arguments.length) { + test2 = _; + return map2; + } else { + return test2; } - return newArray; - }; - /** - * Finds the next valid Dropdown option and sets the selected index to it. - * @param stepValue - Value of how many items the function should traverse. Should be -1 or 1. - * @param index - Index of where the search should start - * @param selectedIndex - The selectedIndex Dropdown's state - * @returns The next valid dropdown option's index - */ DropdownInternal.prototype._moveIndex = function(event, stepValue, index, selectedIndex) { - var options = this.props.options; - // Return selectedIndex if nothing has changed or options is empty - if (selectedIndex === index || options.length === 0) return selectedIndex; - // If the user is pressing the up or down key we want to make - // sure that the dropdown cycles through the options without - // causing the screen to scroll. In _onDropdownKeyDown - // at the very end is a check to see if newIndex !== selectedIndex. - // If the index is less than 0 and we set it back to 0, then - // newIndex will equal selectedIndex and not stop the action - // of the key press happening and vice versa for indexes greater - // than or equal to the options length. - if (index >= options.length) index = 0; - else if (index < 0) index = options.length - 1; - var stepCounter = 0; - // If current index is a header or divider, or disabled, increment by step - while(options[index].itemType === (0, _dropdownTypes.DropdownMenuItemType).Header || options[index].itemType === (0, _dropdownTypes.DropdownMenuItemType).Divider || options[index].disabled){ - // If stepCounter exceeds length of options, then return selectedIndex (-1) - if (stepCounter >= options.length) return selectedIndex; - // If index + stepValue is out of bounds, wrap around - if (index + stepValue < 0) index = options.length; - else if (index + stepValue >= options.length) index = -1; - index = index + stepValue; - stepCounter++; - } - this.setSelectedIndex(event, index); - return index; - }; - /** Wrap item list in a FocusZone */ DropdownInternal.prototype._renderFocusableList = function(props) { - var _a = props.onRenderList, onRenderList = _a === void 0 ? this._onRenderList : _a, label = props.label, ariaLabel = props.ariaLabel, multiSelect = props.multiSelect; - return _react.createElement("div", { - className: this._classNames.dropdownItemsWrapper, - onKeyDown: this._onZoneKeyDown, - onKeyUp: this._onZoneKeyUp, - ref: this._host, - tabIndex: 0 - }, _react.createElement((0, _focusZone.FocusZone), { - ref: this._focusZone, - direction: (0, _focusZone.FocusZoneDirection).vertical, - id: this._listId, - className: this._classNames.dropdownItems, - role: "listbox", - "aria-label": ariaLabel, - "aria-labelledby": label && !ariaLabel ? this._labelId : undefined, - "aria-multiselectable": multiSelect - }, onRenderList(props, this._onRenderList))); - }; - DropdownInternal.prototype._renderSeparator = function(item) { - var index = item.index, key = item.key; - var separatorClassName = item.hidden ? this._classNames.dropdownDividerHidden : this._classNames.dropdownDivider; - if (index > 0) return _react.createElement("div", { - role: "presentation", - key: key, - className: separatorClassName - }); - return null; - }; - DropdownInternal.prototype._renderHeader = function(item) { - var _a = this.props.onRenderOption, onRenderOption = _a === void 0 ? this._onRenderOption : _a; - var key = item.key, id = item.id; - var headerClassName = item.hidden ? this._classNames.dropdownItemHeaderHidden : this._classNames.dropdownItemHeader; - return _react.createElement("div", { - id: id, - key: key, - className: headerClassName - }, onRenderOption(item, this._onRenderOption)); - }; - DropdownInternal.prototype._onItemMouseEnter = function(item, ev) { - if (this._shouldIgnoreMouseEvent()) return; - var targetElement = ev.currentTarget; - targetElement.focus(); - }; - DropdownInternal.prototype._onItemMouseMove = function(item, ev) { - var doc = (0, _dom.getDocumentEx)(this.context); // can only be called on the client - var targetElement = ev.currentTarget; - this._gotMouseMove = true; - if (!this._isScrollIdle || doc.activeElement === targetElement) return; - targetElement.focus(); + }, + clean() { + const next = {}; + let size = 0; + for (const key2 in obj2) { + const value2 = obj2[key2]; + if (value2 !== NULL && (!test2 || !test2(value2))) { + next[key2] = value2; + ++size; + } + } + map2.size = size; + map2.empty = 0; + map2.object = obj2 = next; + } }; - DropdownInternal.prototype._shouldIgnoreMouseEvent = function() { - return !this._isScrollIdle || !this._gotMouseMove; + if (input) Object.keys(input).forEach((key2) => { + map2.set(key2, input[key2]); + }); + return map2; + } + function flush(range2, value2, threshold2, left, right, center) { + if (!threshold2 && threshold2 !== 0) return center; + const t = +threshold2; + let a2 = range2[0], b2 = peek$1(range2), l; + if (b2 < a2) { + l = a2; + a2 = b2; + b2 = l; + } + l = Math.abs(value2 - a2); + const r = Math.abs(b2 - value2); + return l < r && l <= t ? left : r <= t ? right : center; + } + function inherits(child, parent, members) { + const proto = child.prototype = Object.create(parent.prototype); + Object.defineProperty(proto, "constructor", { + value: child, + writable: true, + enumerable: true, + configurable: true + }); + return extend(proto, members); + } + function inrange(value2, range2, left, right) { + let r0 = range2[0], r1 = range2[range2.length - 1], t; + if (r0 > r1) { + t = r0; + r0 = r1; + r1 = t; + } + left = left === void 0 || left; + right = right === void 0 || right; + return (left ? r0 <= value2 : r0 < value2) && (right ? value2 <= r1 : value2 < r1); + } + function isBoolean$1(_) { + return typeof _ === "boolean"; + } + function isDate$1(_) { + return Object.prototype.toString.call(_) === "[object Date]"; + } + function isIterable(_) { + return _ && isFunction(_[Symbol.iterator]); + } + function isNumber$1(_) { + return typeof _ === "number"; + } + function isRegExp(_) { + return Object.prototype.toString.call(_) === "[object RegExp]"; + } + function isString(_) { + return typeof _ === "string"; + } + function key(fields, flat, opt) { + if (fields) { + fields = flat ? array$4(fields).map((f) => f.replace(/\\(.)/g, "$1")) : array$4(fields); + } + const len2 = fields && fields.length, gen = opt && opt.get || getter$1, map2 = (f) => gen(flat ? [f] : splitAccessPath(f)); + let fn2; + if (!len2) { + fn2 = function() { + return ""; + }; + } else if (len2 === 1) { + const get2 = map2(fields[0]); + fn2 = function(_) { + return "" + get2(_); + }; + } else { + const get2 = fields.map(map2); + fn2 = function(_) { + let s2 = "" + get2[0](_), i = 0; + while (++i < len2) s2 += "|" + get2[i](_); + return s2; + }; + } + return accessor(fn2, fields, "key"); + } + function lerp(array2, frac) { + const lo = array2[0], hi = peek$1(array2), f = +frac; + return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); + } + const DEFAULT_MAX_SIZE = 1e4; + function lruCache(maxsize) { + maxsize = +maxsize || DEFAULT_MAX_SIZE; + let curr, prev, size; + const clear = () => { + curr = {}; + prev = {}; + size = 0; + }; + const update2 = (key2, value2) => { + if (++size > maxsize) { + prev = curr; + curr = {}; + size = 1; + } + return curr[key2] = value2; }; - /** - * Returns true if the key for the event is alt (Mac option) or meta (Mac command). - */ DropdownInternal.prototype._isAltOrMeta = function(ev) { - // eslint-disable-next-line deprecation/deprecation - return ev.which === (0, _utilities.KeyCodes).alt || ev.key === 'Meta'; + clear(); + return { + clear, + has: (key2) => has$1(curr, key2) || has$1(prev, key2), + get: (key2) => has$1(curr, key2) ? curr[key2] : has$1(prev, key2) ? update2(key2, prev[key2]) : void 0, + set: (key2, value2) => has$1(curr, key2) ? curr[key2] = value2 : update2(key2, value2) }; - /** - * We close the menu on key up only if ALL of the following are true: - * - Most recent key down was alt or meta (command) - * - The alt/meta key down was NOT followed by some other key (such as down/up arrow to - * expand/collapse the menu) - * - We're not on a Mac (or iOS) - * - * This is because on Windows, pressing alt moves focus to the application menu bar or similar, - * closing any open context menus. There is not a similar behavior on Macs. - */ DropdownInternal.prototype._shouldHandleKeyUp = function(ev) { - var keyPressIsAltOrMetaAlone = this._lastKeyDownWasAltOrMeta && this._isAltOrMeta(ev); - this._lastKeyDownWasAltOrMeta = false; - return !!keyPressIsAltOrMetaAlone && !((0, _utilities.isMac)() || (0, _utilities.isIOS)()); + } + function merge$2(compare2, array0, array1, output2) { + const n0 = array0.length, n1 = array1.length; + if (!n1) return array0; + if (!n0) return array1; + const merged = output2 || new array0.constructor(n0 + n1); + let i0 = 0, i1 = 0, i = 0; + for (; i0 < n0 && i1 < n1; ++i) { + merged[i] = compare2(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; + } + for (; i0 < n0; ++i0, ++i) { + merged[i] = array0[i0]; + } + for (; i1 < n1; ++i1, ++i) { + merged[i] = array1[i1]; + } + return merged; + } + function repeat(str, reps) { + let s2 = ""; + while (--reps >= 0) s2 += str; + return s2; + } + function pad$1(str, length2, padchar, align) { + const c2 = padchar || " ", s2 = str + "", n = length2 - s2.length; + return n <= 0 ? s2 : align === "left" ? repeat(c2, n) + s2 : align === "center" ? repeat(c2, ~~(n / 2)) + s2 + repeat(c2, Math.ceil(n / 2)) : s2 + repeat(c2, n); + } + function span(array2) { + return array2 && peek$1(array2) - array2[0] || 0; + } + function $(x2) { + return isArray(x2) ? `[${x2.map((v) => v === null ? "null" : $(v))}]` : isObject(x2) || isString(x2) ? ( + // Output valid JSON and JS source strings. + // See https://github.com/judofyr/timeless/blob/master/posts/json-isnt-a-javascript-subset.md + JSON.stringify(x2).replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029") + ) : x2; + } + function toBoolean(_) { + return _ == null || _ === "" ? null : !_ || _ === "false" || _ === "0" ? false : !!_; + } + const defaultParser = (_) => isNumber$1(_) ? _ : isDate$1(_) ? _ : Date.parse(_); + function toDate(_, parser2) { + parser2 = parser2 || defaultParser; + return _ == null || _ === "" ? null : parser2(_); + } + function toString(_) { + return _ == null || _ === "" ? null : _ + ""; + } + function toSet(_) { + const s2 = {}, n = _.length; + for (let i = 0; i < n; ++i) s2[_[i]] = true; + return s2; + } + function truncate$1(str, length2, align, ellipsis) { + const e = ellipsis != null ? ellipsis : "…", s2 = str + "", n = s2.length, l = Math.max(0, length2 - e.length); + return n <= length2 ? s2 : align === "left" ? e + s2.slice(n - l) : align === "center" ? s2.slice(0, Math.ceil(l / 2)) + e + s2.slice(n - ~~(l / 2)) : s2.slice(0, l) + e; + } + function visitArray(array2, filter2, visitor) { + if (array2) { + if (filter2) { + const n = array2.length; + for (let i = 0; i < n; ++i) { + const t = filter2(array2[i]); + if (t) visitor(t, i, array2); + } + } else { + array2.forEach(visitor); + } + } + } + var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; + function objectConverter(columns) { + return new Function("d", "return {" + columns.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + '] || ""'; + }).join(",") + "}"); + } + function customConverter(columns, f) { + var object2 = objectConverter(columns); + return function(row, i) { + return f(object2(row), i, columns); }; - /** - * Returns true if dropdown should set to open on focus. - * Otherwise, isOpen state should be toggled on click - */ DropdownInternal.prototype._shouldOpenOnFocus = function() { - var hasFocus = this.state.hasFocus; - var openOnKeyboardFocus = this.props.openOnKeyboardFocus; - return !this._isFocusedByClick && openOnKeyboardFocus === true && !hasFocus; + } + function inferColumns(rows) { + var columnSet = /* @__PURE__ */ Object.create(null), columns = []; + rows.forEach(function(row) { + for (var column in row) { + if (!(column in columnSet)) { + columns.push(columnSet[column] = column); + } + } + }); + return columns; + } + function pad(value2, width2) { + var s2 = value2 + "", length2 = s2.length; + return length2 < width2 ? new Array(width2 - length2 + 1).join(0) + s2 : s2; + } + function formatYear(year) { + return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); + } + function formatDate(date2) { + var hours = date2.getUTCHours(), minutes = date2.getUTCMinutes(), seconds = date2.getUTCSeconds(), milliseconds = date2.getUTCMilliseconds(); + return isNaN(date2) ? "Invalid Date" : formatYear(date2.getUTCFullYear()) + "-" + pad(date2.getUTCMonth() + 1, 2) + "-" + pad(date2.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); + } + function dsvFormat(delimiter) { + var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); + function parse2(text2, f) { + var convert2, columns, rows = parseRows(text2, function(row, i) { + if (convert2) return convert2(row, i - 1); + columns = row, convert2 = f ? customConverter(row, f) : objectConverter(row); + }); + rows.columns = columns || []; + return rows; + } + function parseRows(text2, f) { + var rows = [], N = text2.length, I = 0, n = 0, t, eof = N <= 0, eol = false; + if (text2.charCodeAt(N - 1) === NEWLINE) --N; + if (text2.charCodeAt(N - 1) === RETURN) --N; + function token() { + if (eof) return EOF; + if (eol) return eol = false, EOL; + var i, j = I, c2; + if (text2.charCodeAt(j) === QUOTE) { + while (I++ < N && text2.charCodeAt(I) !== QUOTE || text2.charCodeAt(++I) === QUOTE) ; + if ((i = I) >= N) eof = true; + else if ((c2 = text2.charCodeAt(I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } + return text2.slice(j + 1, i - 1).replace(/""/g, '"'); + } + while (I < N) { + if ((c2 = text2.charCodeAt(i = I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } else if (c2 !== DELIMITER) continue; + return text2.slice(j, i); + } + return eof = true, text2.slice(j, N); + } + while ((t = token()) !== EOF) { + var row = []; + while (t !== EOL && t !== EOF) row.push(t), t = token(); + if (f && (row = f(row, n++)) == null) continue; + rows.push(row); + } + return rows; + } + function preformatBody(rows, columns) { + return rows.map(function(row) { + return columns.map(function(column) { + return formatValue2(row[column]); + }).join(delimiter); + }); + } + function format2(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return [columns.map(formatValue2).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); + } + function formatBody(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return preformatBody(rows, columns).join("\n"); + } + function formatRows(rows) { + return rows.map(formatRow).join("\n"); + } + function formatRow(row) { + return row.map(formatValue2).join(delimiter); + } + function formatValue2(value2) { + return value2 == null ? "" : value2 instanceof Date ? formatDate(value2) : reFormat.test(value2 += "") ? '"' + value2.replace(/"/g, '""') + '"' : value2; + } + return { + parse: parse2, + parseRows, + format: format2, + formatBody, + formatRows, + formatRow, + formatValue: formatValue2 }; - DropdownInternal.defaultProps = { - options: [] + } + function identity$1(x2) { + return x2; + } + function transform$3(transform2) { + if (transform2 == null) return identity$1; + var x02, y02, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1]; + return function(input, i) { + if (!i) x02 = y02 = 0; + var j = 2, n = input.length, output2 = new Array(n); + output2[0] = (x02 += input[0]) * kx + dx; + output2[1] = (y02 += input[1]) * ky + dy; + while (j < n) output2[j] = input[j], ++j; + return output2; }; - DropdownInternal.contextType = (0, _reactWindowProvider.WindowContext); - return DropdownInternal; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Utilities":"1NZCy","../../Callout":"g2jXk","../../Button":"1457j","./Dropdown.types":"deOYw","./utilities/DropdownSizePosCache":"52sRB","../../FocusZone":"k9nPH","../../Icon":"hiMUP","../../Label":"8FZUu","../../Panel":"9ziwh","../../ResponsiveMode":"cFpqz","../../SelectableOption":"jqbZ7","../../Checkbox":"dwb0b","@fluentui/utilities":"55bj3","@fluentui/react-hooks":"2LHjM","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"deOYw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DropdownMenuItemType", ()=>(0, _selectableOption.SelectableOptionMenuItemType)); -var _selectableOption = require("../../SelectableOption"); - -},{"../../SelectableOption":"jqbZ7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"52sRB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DropdownSizePosCache", ()=>DropdownSizePosCache); -var _tslib = require("tslib"); -var _dropdownTypes = require("../Dropdown.types"); -/** - * A utility class to cache size and position in cache. - * - * Dropdown options has non-selectable display types. It is therefore not cheap to determine - * the total number of actual selectable options as well as the position an option is in the - * list of options - O(n) cost for each lookup. - * - * Given that we potentially have to make this determination on every single render pass, this - * cache should provide a little bit of relief. - */ var DropdownSizePosCache = /** @class */ function() { - function DropdownSizePosCache() { - this._size = 0; + } + function reverse$1(array2, n) { + var t, j = array2.length, i = j - n; + while (i < --j) t = array2[i], array2[i++] = array2[j], array2[j] = t; + } + function feature(topology, o) { + if (typeof o === "string") o = topology.objects[o]; + return o.type === "GeometryCollection" ? { type: "FeatureCollection", features: o.geometries.map(function(o2) { + return feature$1(topology, o2); + }) } : feature$1(topology, o); + } + function feature$1(topology, o) { + var id2 = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o); + return id2 == null && bbox == null ? { type: "Feature", properties, geometry } : bbox == null ? { type: "Feature", id: id2, properties, geometry } : { type: "Feature", id: id2, bbox, properties, geometry }; + } + function object(topology, o) { + var transformPoint = transform$3(topology.transform), arcs = topology.arcs; + function arc2(i, points2) { + if (points2.length) points2.pop(); + for (var a2 = arcs[i < 0 ? ~i : i], k = 0, n = a2.length; k < n; ++k) { + points2.push(transformPoint(a2[k], k)); + } + if (i < 0) reverse$1(points2, n); + } + function point2(p) { + return transformPoint(p); + } + function line2(arcs2) { + var points2 = []; + for (var i = 0, n = arcs2.length; i < n; ++i) arc2(arcs2[i], points2); + if (points2.length < 2) points2.push(points2[0]); + return points2; + } + function ring(arcs2) { + var points2 = line2(arcs2); + while (points2.length < 4) points2.push(points2[0]); + return points2; + } + function polygon(arcs2) { + return arcs2.map(ring); + } + function geometry(o2) { + var type2 = o2.type, coordinates; + switch (type2) { + case "GeometryCollection": + return { type: type2, geometries: o2.geometries.map(geometry) }; + case "Point": + coordinates = point2(o2.coordinates); + break; + case "MultiPoint": + coordinates = o2.coordinates.map(point2); + break; + case "LineString": + coordinates = line2(o2.arcs); + break; + case "MultiLineString": + coordinates = o2.arcs.map(line2); + break; + case "Polygon": + coordinates = polygon(o2.arcs); + break; + case "MultiPolygon": + coordinates = o2.arcs.map(polygon); + break; + default: + return null; + } + return { type: type2, coordinates }; } - /** - * Invalidates the cache and recalculate the size of selectable options. - */ DropdownSizePosCache.prototype.updateOptions = function(options) { - var displayOnlyOptionsCache = []; - var notSelectableOptionsCache = []; - var size = 0; - for(var i = 0; i < options.length; i++){ - var _a = options[i], itemType = _a.itemType, hidden = _a.hidden; - if (itemType === (0, _dropdownTypes.DropdownMenuItemType).Divider || itemType === (0, _dropdownTypes.DropdownMenuItemType).Header) { - displayOnlyOptionsCache.push(i); - notSelectableOptionsCache.push(i); - } else if (hidden) notSelectableOptionsCache.push(i); - else size++; - } - this._size = size; - this._displayOnlyOptionsCache = displayOnlyOptionsCache; - this._notSelectableOptionsCache = notSelectableOptionsCache; - this._cachedOptions = (0, _tslib.__spreadArray)([], options, true); - }; - Object.defineProperty(DropdownSizePosCache.prototype, "optionSetSize", { - /** - * The size of all the selectable options. - */ get: function() { - return this._size; - }, - enumerable: false, - configurable: true + return geometry(o); + } + function stitch(topology, arcs) { + var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; + arcs.forEach(function(i, j) { + var arc2 = topology.arcs[i < 0 ? ~i : i], t; + if (arc2.length < 3 && !arc2[1][0] && !arc2[1][1]) { + t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; + } }); - Object.defineProperty(DropdownSizePosCache.prototype, "cachedOptions", { - /** - * The chached options array. - */ get: function() { - return this._cachedOptions; - }, - enumerable: false, - configurable: true + arcs.forEach(function(i) { + var e = ends(i), start = e[0], end = e[1], f, g; + if (f = fragmentByEnd[start]) { + delete fragmentByEnd[f.end]; + f.push(i); + f.end = end; + if (g = fragmentByStart[end]) { + delete fragmentByStart[g.start]; + var fg = g === f ? f : f.concat(g); + fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; + } else { + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; + } + } else if (f = fragmentByStart[end]) { + delete fragmentByStart[f.start]; + f.unshift(i); + f.start = start; + if (g = fragmentByEnd[start]) { + delete fragmentByEnd[g.end]; + var gf = g === f ? f : g.concat(f); + fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; + } else { + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; + } + } else { + f = [i]; + fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; + } }); - /** - * Returns the position of this option element relative to the full set of selectable option elements. - * Note: the first selectable element is position 1 in the set. - * @param index The raw index of the option element. - */ DropdownSizePosCache.prototype.positionInSet = function(index) { - if (index === undefined) return undefined; - // we could possibly memoize this too but this should be good enough, most of the time (the expectation is that - // when you have a lot of options, the selectable options will heavily dominate over the non-selectable options. - var offset = 0; - while(index > this._notSelectableOptionsCache[offset])offset++; - if (this._displayOnlyOptionsCache[offset] === index) throw new Error("Unexpected: Option at index ".concat(index, " is not a selectable element.")); - if (this._notSelectableOptionsCache[offset] === index) return undefined; - return index - offset + 1; - }; - return DropdownSizePosCache; -}(); - -},{"tslib":"9gizs","../Dropdown.types":"deOYw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ziwh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Panel/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Panel/index":"5kPn7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5kPn7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _panel = require("./Panel"); -parcelHelpers.exportAll(_panel, exports); -var _panelBase = require("./Panel.base"); -parcelHelpers.exportAll(_panelBase, exports); -var _panelTypes = require("./Panel.types"); -parcelHelpers.exportAll(_panelTypes, exports); - -},{"./Panel":"7cUsY","./Panel.base":false,"./Panel.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7cUsY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Panel", ()=>Panel); -var _utilities = require("../../Utilities"); -var _panelBase = require("./Panel.base"); -var _panelStyles = require("./Panel.styles"); -var Panel = (0, _utilities.styled)((0, _panelBase.PanelBase), (0, _panelStyles.getStyles), undefined, { - scope: 'Panel' -}); - -},{"../../Utilities":"1NZCy","./Panel.base":"a9rbr","./Panel.styles":"6pUAU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a9rbr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PanelBase", ()=>PanelBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _button = require("../../Button"); -var _layer = require("../../Layer"); -var _overlay = require("../../Overlay"); -var _popup = require("../../Popup"); -var _utilities = require("../../Utilities"); -var _index = require("../FocusTrapZone/index"); -var _panelTypes = require("./Panel.types"); -var _reactWindowProvider = require("@fluentui/react-window-provider"); -var _dom = require("../../utilities/dom"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var COMPONENT_NAME = 'Panel'; -var PanelVisibilityState; -(function(PanelVisibilityState) { - PanelVisibilityState[PanelVisibilityState["closed"] = 0] = "closed"; - PanelVisibilityState[PanelVisibilityState["animatingOpen"] = 1] = "animatingOpen"; - PanelVisibilityState[PanelVisibilityState["open"] = 2] = "open"; - PanelVisibilityState[PanelVisibilityState["animatingClosed"] = 3] = "animatingClosed"; -})(PanelVisibilityState || (PanelVisibilityState = {})); -var PanelBase = /** @class */ function(_super) { - (0, _tslib.__extends)(PanelBase, _super); - function PanelBase(props) { - var _this = _super.call(this, props) || this; - _this._panel = _react.createRef(); - _this._animationCallback = null; - _this._hasCustomNavigation = !!(_this.props.onRenderNavigation || _this.props.onRenderNavigationContent); - _this.dismiss = function(ev) { - if (_this.props.onDismiss && _this.isActive) _this.props.onDismiss(ev); - if (!ev || ev && !ev.defaultPrevented) _this.close(); - }; - // Allow the user to scroll within the panel but not on the body - _this._allowScrollOnPanel = function(elt) { - if (elt) { - if (_this._allowTouchBodyScroll) (0, _utilities.allowOverscrollOnElement)(elt, _this._events); - else (0, _utilities.allowScrollOnElement)(elt, _this._events); - } else _this._events.off(_this._scrollableContent); - _this._scrollableContent = elt; - }; - _this._onRenderNavigation = function(props) { - if (!_this.props.onRenderNavigationContent && !_this.props.onRenderNavigation && !_this.props.hasCloseButton) return null; - var _a = _this.props.onRenderNavigationContent, onRenderNavigationContent = _a === void 0 ? _this._onRenderNavigationContent : _a; - return _react.createElement("div", { - className: _this._classNames.navigation - }, onRenderNavigationContent(props, _this._onRenderNavigationContent)); - }; - _this._onRenderNavigationContent = function(props) { - var _a; - var closeButtonAriaLabel = props.closeButtonAriaLabel, hasCloseButton = props.hasCloseButton, _b = props.onRenderHeader, onRenderHeader = _b === void 0 ? _this._onRenderHeader : _b; - if (hasCloseButton) { - var iconButtonStyles = (_a = _this._classNames.subComponentStyles) === null || _a === void 0 ? void 0 : _a.closeButton(); - return _react.createElement(_react.Fragment, null, !_this._hasCustomNavigation && onRenderHeader(_this.props, _this._onRenderHeader, _this._headerTextId), _react.createElement((0, _button.IconButton), { - styles: iconButtonStyles, - className: _this._classNames.closeButton, - onClick: _this._onPanelClick, - ariaLabel: closeButtonAriaLabel, - title: closeButtonAriaLabel, - "data-is-visible": true, - iconProps: { - iconName: 'Cancel' - } - })); - } - return null; - }; - _this._onRenderHeader = function(props, defaultRender, headerTextId) { - var headerText = props.headerText, _a = props.headerTextProps, headerTextProps = _a === void 0 ? {} : _a; - if (headerText) return _react.createElement("div", { - className: _this._classNames.header - }, _react.createElement("div", (0, _tslib.__assign)({ - id: headerTextId, - role: "heading", - "aria-level": 1 - }, headerTextProps, { - className: (0, _utilities.css)(_this._classNames.headerText, headerTextProps.className) - }), headerText)); - return null; - }; - _this._onRenderBody = function(props) { - return _react.createElement("div", { - className: _this._classNames.content - }, props.children); - }; - _this._onRenderFooter = function(props) { - var _a = _this.props.onRenderFooterContent, onRenderFooterContent = _a === void 0 ? null : _a; - if (onRenderFooterContent) return _react.createElement("div", { - className: _this._classNames.footer - }, _react.createElement("div", { - className: _this._classNames.footerInner - }, onRenderFooterContent())); - return null; - }; - _this._animateTo = function(newVisibilityState) { - if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpen) _this.props.onOpen(); - _this._animationCallback = _this._async.setTimeout(function() { - _this.setState({ - visibility: newVisibilityState - }); - _this._onTransitionComplete(newVisibilityState); - }, 200); - }; - _this._clearExistingAnimationTimer = function() { - if (_this._animationCallback !== null) _this._async.clearTimeout(_this._animationCallback); - }; - _this._onPanelClick = function(ev) { - _this.dismiss(ev); - }; - _this._onTransitionComplete = function(newVisibilityState) { - _this._updateFooterPosition(); - if (newVisibilityState === PanelVisibilityState.open && _this.props.onOpened) _this.props.onOpened(); - if (newVisibilityState === PanelVisibilityState.closed && _this.props.onDismissed) _this.props.onDismissed(); - }; - var _a = _this.props.allowTouchBodyScroll, allowTouchBodyScroll = _a === void 0 ? false : _a; - _this._allowTouchBodyScroll = allowTouchBodyScroll; - (0, _utilities.initializeComponentRef)(_this); - (0, _utilities.warnDeprecations)(COMPONENT_NAME, props, { - ignoreExternalFocusing: 'focusTrapZoneProps', - forceFocusInsideTrap: 'focusTrapZoneProps', - firstFocusableSelector: 'focusTrapZoneProps' + function ends(i) { + var arc2 = topology.arcs[i < 0 ? ~i : i], p02 = arc2[0], p1; + if (topology.transform) p1 = [0, 0], arc2.forEach(function(dp) { + p1[0] += dp[0], p1[1] += dp[1]; + }); + else p1 = arc2[arc2.length - 1]; + return i < 0 ? [p1, p02] : [p02, p1]; + } + function flush2(fragmentByEnd2, fragmentByStart2) { + for (var k in fragmentByEnd2) { + var f = fragmentByEnd2[k]; + delete fragmentByStart2[f.start]; + delete f.start; + delete f.end; + f.forEach(function(i) { + stitchedArcs[i < 0 ? ~i : i] = 1; }); - _this.state = { - isFooterSticky: false, - // intentionally ignore props so animation takes place during componentDidMount - visibility: PanelVisibilityState.closed, - id: (0, _utilities.getId)('Panel') - }; - return _this; + fragments.push(f); + } + } + flush2(fragmentByEnd, fragmentByStart); + flush2(fragmentByStart, fragmentByEnd); + arcs.forEach(function(i) { + if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); + }); + return fragments; + } + function mesh(topology) { + return object(topology, meshArcs.apply(this, arguments)); + } + function meshArcs(topology, object2, filter2) { + var arcs, i, n; + if (arguments.length > 1) arcs = extractArcs(topology, object2, filter2); + else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; + return { type: "MultiLineString", arcs: stitch(topology, arcs) }; + } + function extractArcs(topology, object2, filter2) { + var arcs = [], geomsByArc = [], geom; + function extract0(i) { + var j = i < 0 ? ~i : i; + (geomsByArc[j] || (geomsByArc[j] = [])).push({ i, g: geom }); + } + function extract1(arcs2) { + arcs2.forEach(extract0); + } + function extract2(arcs2) { + arcs2.forEach(extract1); + } + function extract3(arcs2) { + arcs2.forEach(extract2); + } + function geometry(o) { + switch (geom = o, o.type) { + case "GeometryCollection": + o.geometries.forEach(geometry); + break; + case "LineString": + extract1(o.arcs); + break; + case "MultiLineString": + case "Polygon": + extract2(o.arcs); + break; + case "MultiPolygon": + extract3(o.arcs); + break; + } + } + geometry(object2); + geomsByArc.forEach(filter2 == null ? function(geoms) { + arcs.push(geoms[0].i); + } : function(geoms) { + if (filter2(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); + }); + return arcs; + } + const YEAR = "year"; + const QUARTER = "quarter"; + const MONTH = "month"; + const WEEK = "week"; + const DATE = "date"; + const DAY = "day"; + const DAYOFYEAR = "dayofyear"; + const HOURS = "hours"; + const MINUTES = "minutes"; + const SECONDS = "seconds"; + const MILLISECONDS = "milliseconds"; + const TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS]; + const UNITS = TIME_UNITS.reduce((o, u2, i) => (o[u2] = 1 + i, o), {}); + function timeUnits(units) { + const u2 = array$4(units).slice(), m2 = {}; + if (!u2.length) error("Missing time unit."); + u2.forEach((unit2) => { + if (has$1(UNITS, unit2)) { + m2[unit2] = 1; + } else { + error(`Invalid time unit: ${unit2}.`); + } + }); + const numTypes = (m2[WEEK] || m2[DAY] ? 1 : 0) + (m2[QUARTER] || m2[MONTH] || m2[DATE] ? 1 : 0) + (m2[DAYOFYEAR] ? 1 : 0); + if (numTypes > 1) { + error(`Incompatible time units: ${units}`); + } + u2.sort((a2, b2) => UNITS[a2] - UNITS[b2]); + return u2; + } + const defaultSpecifiers = { + [YEAR]: "%Y ", + [QUARTER]: "Q%q ", + [MONTH]: "%b ", + [DATE]: "%d ", + [WEEK]: "W%U ", + [DAY]: "%a ", + [DAYOFYEAR]: "%j ", + [HOURS]: "%H:00", + [MINUTES]: "00:%M", + [SECONDS]: ":%S", + [MILLISECONDS]: ".%L", + [`${YEAR}-${MONTH}`]: "%Y-%m ", + [`${YEAR}-${MONTH}-${DATE}`]: "%Y-%m-%d ", + [`${HOURS}-${MINUTES}`]: "%H:%M" + }; + function timeUnitSpecifier(units, specifiers) { + const s2 = extend({}, defaultSpecifiers, specifiers), u2 = timeUnits(units), n = u2.length; + let fmt = "", start = 0, end, key2; + for (start = 0; start < n; ) { + for (end = u2.length; end > start; --end) { + key2 = u2.slice(start, end).join("-"); + if (s2[key2] != null) { + fmt += s2[key2]; + start = end; + break; + } + } + } + return fmt.trim(); + } + const t0 = /* @__PURE__ */ new Date(); + function localYear(y2) { + t0.setFullYear(y2); + t0.setMonth(0); + t0.setDate(1); + t0.setHours(0, 0, 0, 0); + return t0; + } + function dayofyear(d2) { + return localDayOfYear(new Date(d2)); + } + function week(d2) { + return localWeekNum(new Date(d2)); + } + function localDayOfYear(d2) { + return timeDay.count(localYear(d2.getFullYear()) - 1, d2); + } + function localWeekNum(d2) { + return timeSunday.count(localYear(d2.getFullYear()) - 1, d2); + } + function localFirst(y2) { + return localYear(y2).getDay(); + } + function localDate(y2, m2, d2, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(-1, m2, d2, H, M2, S, L); + date2.setFullYear(y2); + return date2; + } + return new Date(y2, m2, d2, H, M2, S, L); + } + function utcdayofyear(d2) { + return utcDayOfYear(new Date(d2)); + } + function utcweek(d2) { + return utcWeekNum(new Date(d2)); + } + function utcDayOfYear(d2) { + const y2 = Date.UTC(d2.getUTCFullYear(), 0, 1); + return utcDay.count(y2 - 1, d2); + } + function utcWeekNum(d2) { + const y2 = Date.UTC(d2.getUTCFullYear(), 0, 1); + return utcSunday.count(y2 - 1, d2); + } + function utcFirst(y2) { + t0.setTime(Date.UTC(y2, 0, 1)); + return t0.getUTCDay(); + } + function utcDate(y2, m2, d2, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(Date.UTC(-1, m2, d2, H, M2, S, L)); + date2.setUTCFullYear(d2.y); + return date2; + } + return new Date(Date.UTC(y2, m2, d2, H, M2, S, L)); + } + function floor(units, step, get2, inv, newDate2) { + const s2 = step || 1, b2 = peek$1(units), _ = (unit2, p, key2) => { + key2 = key2 || unit2; + return getUnit(get2[key2], inv[key2], unit2 === b2 && s2, p); + }; + const t = /* @__PURE__ */ new Date(), u2 = toSet(units), y2 = u2[YEAR] ? _(YEAR) : constant$4(2012), m2 = u2[MONTH] ? _(MONTH) : u2[QUARTER] ? _(QUARTER) : zero$1, d2 = u2[WEEK] && u2[DAY] ? _(DAY, 1, WEEK + DAY) : u2[WEEK] ? _(WEEK, 1) : u2[DAY] ? _(DAY, 1) : u2[DATE] ? _(DATE, 1) : u2[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one$1, H = u2[HOURS] ? _(HOURS) : zero$1, M2 = u2[MINUTES] ? _(MINUTES) : zero$1, S = u2[SECONDS] ? _(SECONDS) : zero$1, L = u2[MILLISECONDS] ? _(MILLISECONDS) : zero$1; + return function(v) { + t.setTime(+v); + const year = y2(t); + return newDate2(year, m2(t), d2(t, year), H(t), M2(t), S(t), L(t)); + }; + } + function getUnit(f, inv, step, phase) { + const u2 = step <= 1 ? f : phase ? (d2, y2) => phase + step * Math.floor((f(d2, y2) - phase) / step) : (d2, y2) => step * Math.floor(f(d2, y2) / step); + return inv ? (d2, y2) => inv(u2(d2, y2), y2) : u2; + } + function weekday(week2, day, firstDay) { + return day + week2 * 7 - (firstDay + 6) % 7; + } + const localGet = { + [YEAR]: (d2) => d2.getFullYear(), + [QUARTER]: (d2) => Math.floor(d2.getMonth() / 3), + [MONTH]: (d2) => d2.getMonth(), + [DATE]: (d2) => d2.getDate(), + [HOURS]: (d2) => d2.getHours(), + [MINUTES]: (d2) => d2.getMinutes(), + [SECONDS]: (d2) => d2.getSeconds(), + [MILLISECONDS]: (d2) => d2.getMilliseconds(), + [DAYOFYEAR]: (d2) => localDayOfYear(d2), + [WEEK]: (d2) => localWeekNum(d2), + [WEEK + DAY]: (d2, y2) => weekday(localWeekNum(d2), d2.getDay(), localFirst(y2)), + [DAY]: (d2, y2) => weekday(1, d2.getDay(), localFirst(y2)) + }; + const localInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, localFirst(y2)) + }; + function timeFloor(units, step) { + return floor(units, step || 1, localGet, localInv, localDate); + } + const utcGet = { + [YEAR]: (d2) => d2.getUTCFullYear(), + [QUARTER]: (d2) => Math.floor(d2.getUTCMonth() / 3), + [MONTH]: (d2) => d2.getUTCMonth(), + [DATE]: (d2) => d2.getUTCDate(), + [HOURS]: (d2) => d2.getUTCHours(), + [MINUTES]: (d2) => d2.getUTCMinutes(), + [SECONDS]: (d2) => d2.getUTCSeconds(), + [MILLISECONDS]: (d2) => d2.getUTCMilliseconds(), + [DAYOFYEAR]: (d2) => utcDayOfYear(d2), + [WEEK]: (d2) => utcWeekNum(d2), + [DAY]: (d2, y2) => weekday(1, d2.getUTCDay(), utcFirst(y2)), + [WEEK + DAY]: (d2, y2) => weekday(utcWeekNum(d2), d2.getUTCDay(), utcFirst(y2)) + }; + const utcInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, utcFirst(y2)) + }; + function utcFloor(units, step) { + return floor(units, step || 1, utcGet, utcInv, utcDate); + } + const timeIntervals = { + [YEAR]: timeYear, + [QUARTER]: timeMonth.every(3), + [MONTH]: timeMonth, + [WEEK]: timeSunday, + [DATE]: timeDay, + [DAY]: timeDay, + [DAYOFYEAR]: timeDay, + [HOURS]: timeHour, + [MINUTES]: timeMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + const utcIntervals = { + [YEAR]: utcYear, + [QUARTER]: utcMonth.every(3), + [MONTH]: utcMonth, + [WEEK]: utcSunday, + [DATE]: utcDay, + [DAY]: utcDay, + [DAYOFYEAR]: utcDay, + [HOURS]: utcHour, + [MINUTES]: utcMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + function timeInterval(unit2) { + return timeIntervals[unit2]; + } + function utcInterval(unit2) { + return utcIntervals[unit2]; + } + function offset$3(ival, date2, step) { + return ival ? ival.offset(date2, step) : void 0; + } + function timeOffset(unit2, date2, step) { + return offset$3(timeInterval(unit2), date2, step); + } + function utcOffset(unit2, date2, step) { + return offset$3(utcInterval(unit2), date2, step); + } + function sequence$1(ival, start, stop2, step) { + return ival ? ival.range(start, stop2, step) : void 0; + } + function timeSequence(unit2, start, stop2, step) { + return sequence$1(timeInterval(unit2), start, stop2, step); + } + function utcSequence(unit2, start, stop2, step) { + return sequence$1(utcInterval(unit2), start, stop2, step); + } + const durationSecond = 1e3, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; + const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [YEAR, WEEK], Month = [YEAR, MONTH], Year = [YEAR]; + const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]]; + function bin$1(opt) { + const ext = opt.extent, max2 = opt.maxbins || 40, target2 = Math.abs(span(ext)) / max2; + let i = bisector((i2) => i2[2]).right(intervals, target2), units, step; + if (i === intervals.length) { + units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max2); + } else if (i) { + i = intervals[target2 / intervals[i - 1][2] < intervals[i][2] / target2 ? i - 1 : i]; + units = i[0]; + step = i[1]; + } else { + units = Milli; + step = Math.max(tickStep(ext[0], ext[1], max2), 1); } - PanelBase.getDerivedStateFromProps = function(nextProps, prevState) { - if (nextProps.isOpen === undefined) return null; // no state update - if (nextProps.isOpen && (prevState.visibility === PanelVisibilityState.closed || prevState.visibility === PanelVisibilityState.animatingClosed)) return { - visibility: PanelVisibilityState.animatingOpen - }; - if (!nextProps.isOpen && (prevState.visibility === PanelVisibilityState.open || prevState.visibility === PanelVisibilityState.animatingOpen)) return { - visibility: PanelVisibilityState.animatingClosed - }; - return null; + return { + units, + step }; - PanelBase.prototype.componentDidMount = function() { - this._async = new (0, _utilities.Async)(this); - this._events = new (0, _utilities.EventGroup)(this); - var win = (0, _dom.getWindowEx)(this.context); - var doc = (0, _dom.getDocumentEx)(this.context); - this._events.on(win, 'resize', this._updateFooterPosition); - if (this._shouldListenForOuterClick(this.props)) this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, 'mousedown', this._dismissOnOuterClick, true); - if (this.props.isOpen) this.setState({ - visibility: PanelVisibilityState.animatingOpen - }); + } + function memoize(method2) { + const cache2 = {}; + return (spec) => cache2[spec] || (cache2[spec] = method2(spec)); + } + function trimZeroes(numberFormat, decimalChar) { + return (x2) => { + const str = numberFormat(x2), dec = str.indexOf(decimalChar); + if (dec < 0) return str; + let idx = rightmostDigit(str, dec); + const end = idx < str.length ? str.slice(idx) : ""; + while (--idx > dec) if (str[idx] !== "0") { + ++idx; + break; + } + return str.slice(0, idx) + end; }; - PanelBase.prototype.componentDidUpdate = function(previousProps, previousState) { - var shouldListenOnOuterClick = this._shouldListenForOuterClick(this.props); - var previousShouldListenOnOuterClick = this._shouldListenForOuterClick(previousProps); - if (this.state.visibility !== previousState.visibility) { - this._clearExistingAnimationTimer(); - if (this.state.visibility === PanelVisibilityState.animatingOpen) this._animateTo(PanelVisibilityState.open); - else if (this.state.visibility === PanelVisibilityState.animatingClosed) this._animateTo(PanelVisibilityState.closed); + } + function rightmostDigit(str, dec) { + let i = str.lastIndexOf("e"), c2; + if (i > 0) return i; + for (i = str.length; --i > dec; ) { + c2 = str.charCodeAt(i); + if (c2 >= 48 && c2 <= 57) return i + 1; + } + } + function numberLocale(locale2) { + const format2 = memoize(locale2.format), formatPrefix2 = locale2.formatPrefix; + return { + format: format2, + formatPrefix: formatPrefix2, + formatFloat(spec) { + const s2 = formatSpecifier$1(spec || ","); + if (s2.precision == null) { + s2.precision = 12; + switch (s2.type) { + case "%": + s2.precision -= 2; + break; + case "e": + s2.precision -= 1; + break; + } + return trimZeroes( + format2(s2), + // number format + format2(".1f")(1)[1] + // decimal point character + ); + } else { + return format2(s2); } - var doc = (0, _dom.getDocumentEx)(this.context); - if (shouldListenOnOuterClick && !previousShouldListenOnOuterClick) this._events.on(doc === null || doc === void 0 ? void 0 : doc.body, 'mousedown', this._dismissOnOuterClick, true); - else if (!shouldListenOnOuterClick && previousShouldListenOnOuterClick) this._events.off(doc === null || doc === void 0 ? void 0 : doc.body, 'mousedown', this._dismissOnOuterClick, true); - }; - PanelBase.prototype.componentWillUnmount = function() { - this._async.dispose(); - this._events.dispose(); - }; - PanelBase.prototype.render = function() { - var _a = this.props, _b = _a.className, className = _b === void 0 ? '' : _b, elementToFocusOnDismiss = _a.elementToFocusOnDismiss, /* eslint-disable deprecation/deprecation */ firstFocusableSelector = _a.firstFocusableSelector, focusTrapZoneProps = _a.focusTrapZoneProps, forceFocusInsideTrap = _a.forceFocusInsideTrap, hasCloseButton = _a.hasCloseButton, headerText = _a.headerText, _c = _a.headerClassName, headerClassName = _c === void 0 ? '' : _c, ignoreExternalFocusing = _a.ignoreExternalFocusing, isBlocking = _a.isBlocking, isFooterAtBottom = _a.isFooterAtBottom, isLightDismiss = _a.isLightDismiss, isHiddenOnDismiss = _a.isHiddenOnDismiss, layerProps = _a.layerProps, overlayProps = _a.overlayProps, popupProps = _a.popupProps, type = _a.type, styles = _a.styles, theme = _a.theme, customWidth = _a.customWidth, _d = _a.onLightDismissClick, onLightDismissClick = _d === void 0 ? this._onPanelClick : _d, _e = _a.onRenderNavigation, onRenderNavigation = _e === void 0 ? this._onRenderNavigation : _e, _f = _a.onRenderHeader, onRenderHeader = _f === void 0 ? this._onRenderHeader : _f, _g = _a.onRenderBody, onRenderBody = _g === void 0 ? this._onRenderBody : _g, _h = _a.onRenderFooter, onRenderFooter = _h === void 0 ? this._onRenderFooter : _h; - var _j = this.state, isFooterSticky = _j.isFooterSticky, visibility = _j.visibility, id = _j.id; - var isLeft = type === (0, _panelTypes.PanelType).smallFixedNear || type === (0, _panelTypes.PanelType).customNear ? true : false; - var isRTL = (0, _utilities.getRTL)(theme); - var isOnRightSide = isRTL ? isLeft : !isLeft; - var customWidthStyles = type === (0, _panelTypes.PanelType).custom || type === (0, _panelTypes.PanelType).customNear ? { - width: customWidth - } : {}; - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties)); - var isOpen = this.isActive; - var isAnimating = visibility === PanelVisibilityState.animatingClosed || visibility === PanelVisibilityState.animatingOpen; - this._headerTextId = headerText && id + '-headerText'; - if (!isOpen && !isAnimating && !isHiddenOnDismiss) return null; - this._classNames = getClassNames(styles, { - theme: theme, - className: className, - focusTrapZoneClassName: focusTrapZoneProps ? focusTrapZoneProps.className : undefined, - hasCloseButton: hasCloseButton, - headerClassName: headerClassName, - isAnimating: isAnimating, - isFooterSticky: isFooterSticky, - isFooterAtBottom: isFooterAtBottom, - isOnRightSide: isOnRightSide, - isOpen: isOpen, - isHiddenOnDismiss: isHiddenOnDismiss, - type: type, - hasCustomNavigation: this._hasCustomNavigation - }); - var _k = this, _classNames = _k._classNames, _allowTouchBodyScroll = _k._allowTouchBodyScroll; - var overlay; - if (isBlocking && isOpen) overlay = _react.createElement((0, _overlay.Overlay), (0, _tslib.__assign)({ - className: _classNames.overlay, - isDarkThemed: false, - onClick: isLightDismiss ? onLightDismissClick : undefined, - allowTouchBodyScroll: _allowTouchBodyScroll - }, overlayProps)); - return _react.createElement((0, _layer.Layer), (0, _tslib.__assign)({}, layerProps), _react.createElement((0, _popup.Popup), (0, _tslib.__assign)({ - role: "dialog", - "aria-modal": isBlocking ? 'true' : undefined, - ariaLabelledBy: this._headerTextId ? this._headerTextId : undefined, - onDismiss: this.dismiss, - className: _classNames.hiddenPanel, - enableAriaHiddenSiblings: isOpen ? true : false - }, popupProps), _react.createElement("div", (0, _tslib.__assign)({ - "aria-hidden": !isOpen && isAnimating - }, nativeProps, { - ref: this._panel, - className: _classNames.root - }), overlay, _react.createElement((0, _index.FocusTrapZone), (0, _tslib.__assign)({ - ignoreExternalFocusing: ignoreExternalFocusing, - forceFocusInsideTrap: !isBlocking || isHiddenOnDismiss && !isOpen ? false : forceFocusInsideTrap, - firstFocusableSelector: firstFocusableSelector, - isClickableOutsideFocusTrap: true - }, focusTrapZoneProps, { - className: _classNames.main, - style: customWidthStyles, - elementToFocusOnDismiss: elementToFocusOnDismiss - }), _react.createElement("div", { - className: _classNames.contentInner - }, _react.createElement("div", { - ref: this._allowScrollOnPanel, - className: _classNames.scrollableContent, - "data-is-scrollable": true - }, _react.createElement("div", { - className: _classNames.commands, - "data-is-visible": true - }, onRenderNavigation(this.props, this._onRenderNavigation)), (this._hasCustomNavigation || !hasCloseButton) && onRenderHeader(this.props, this._onRenderHeader, this._headerTextId), onRenderBody(this.props, this._onRenderBody), onRenderFooter(this.props, this._onRenderFooter))))))); - }; - PanelBase.prototype.open = function() { - if (this.props.isOpen !== undefined) return; - if (this.isActive) return; - this.setState({ - visibility: PanelVisibilityState.animatingOpen - }); - }; - PanelBase.prototype.close = function() { - if (this.props.isOpen !== undefined) return; - if (!this.isActive) return; - this.setState({ - visibility: PanelVisibilityState.animatingClosed - }); + }, + formatSpan(start, stop2, count2, specifier) { + specifier = formatSpecifier$1(specifier == null ? ",f" : specifier); + const step = tickStep(start, stop2, count2), value2 = Math.max(Math.abs(start), Math.abs(stop2)); + let precision; + if (specifier.precision == null) { + switch (specifier.type) { + case "s": { + if (!isNaN(precision = precisionPrefix(step, value2))) { + specifier.precision = precision; + } + return formatPrefix2(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (!isNaN(precision = precisionRound(step, value2))) { + specifier.precision = precision - (specifier.type === "e"); + } + break; + } + case "f": + case "%": { + if (!isNaN(precision = precisionFixed(step))) { + specifier.precision = precision - (specifier.type === "%") * 2; + } + break; + } + } + } + return format2(specifier); + } }; - Object.defineProperty(PanelBase.prototype, "isActive", { - /** isActive is true when panel is open or opening. */ get: function() { - return this.state.visibility === PanelVisibilityState.open || this.state.visibility === PanelVisibilityState.animatingOpen; - }, - enumerable: false, - configurable: true + } + let defaultNumberLocale; + resetNumberFormatDefaultLocale(); + function resetNumberFormatDefaultLocale() { + return defaultNumberLocale = numberLocale({ + format: format$4, + formatPrefix }); - PanelBase.prototype._shouldListenForOuterClick = function(props) { - return !!props.isBlocking && !!props.isOpen; + } + function numberFormatLocale(definition2) { + return numberLocale(formatLocale$2(definition2)); + } + function numberFormatDefaultLocale(definition2) { + return arguments.length ? defaultNumberLocale = numberFormatLocale(definition2) : defaultNumberLocale; + } + function timeMultiFormat(format2, interval2, spec) { + spec = spec || {}; + if (!isObject(spec)) { + error(`Invalid time multi-format specifier: ${spec}`); + } + const second2 = interval2(SECONDS), minute = interval2(MINUTES), hour = interval2(HOURS), day = interval2(DATE), week2 = interval2(WEEK), month = interval2(MONTH), quarter2 = interval2(QUARTER), year = interval2(YEAR), L = format2(spec[MILLISECONDS] || ".%L"), S = format2(spec[SECONDS] || ":%S"), M2 = format2(spec[MINUTES] || "%I:%M"), H = format2(spec[HOURS] || "%I %p"), d2 = format2(spec[DATE] || spec[DAY] || "%a %d"), w2 = format2(spec[WEEK] || "%b %d"), m2 = format2(spec[MONTH] || "%B"), q = format2(spec[QUARTER] || "%B"), y2 = format2(spec[YEAR] || "%Y"); + return (date2) => (second2(date2) < date2 ? L : minute(date2) < date2 ? S : hour(date2) < date2 ? M2 : day(date2) < date2 ? H : month(date2) < date2 ? week2(date2) < date2 ? d2 : w2 : year(date2) < date2 ? quarter2(date2) < date2 ? m2 : q : y2)(date2); + } + function timeLocale(locale2) { + const timeFormat2 = memoize(locale2.format), utcFormat2 = memoize(locale2.utcFormat); + return { + timeFormat: (spec) => isString(spec) ? timeFormat2(spec) : timeMultiFormat(timeFormat2, timeInterval, spec), + utcFormat: (spec) => isString(spec) ? utcFormat2(spec) : timeMultiFormat(utcFormat2, utcInterval, spec), + timeParse: memoize(locale2.parse), + utcParse: memoize(locale2.utcParse) }; - PanelBase.prototype._updateFooterPosition = function() { - var scrollableContent = this._scrollableContent; - if (scrollableContent) { - var height = scrollableContent.clientHeight; - var innerHeight_1 = scrollableContent.scrollHeight; - this.setState({ - isFooterSticky: height < innerHeight_1 ? true : false - }); - } + } + let defaultTimeLocale; + resetTimeFormatDefaultLocale(); + function resetTimeFormatDefaultLocale() { + return defaultTimeLocale = timeLocale({ + format: timeFormat$1, + parse: timeParse$1, + utcFormat: utcFormat$1, + utcParse: utcParse$1 + }); + } + function timeFormatLocale(definition2) { + return timeLocale(formatLocale$1(definition2)); + } + function timeFormatDefaultLocale(definition2) { + return arguments.length ? defaultTimeLocale = timeFormatLocale(definition2) : defaultTimeLocale; + } + const createLocale = (number2, time2) => extend({}, number2, time2); + function locale(numberSpec, timeSpec) { + const number2 = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); + const time2 = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); + return createLocale(number2, time2); + } + function defaultLocale(numberSpec, timeSpec) { + const args = arguments.length; + if (args && args !== 2) { + error("defaultLocale expects either zero or two arguments."); + } + return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); + } + function resetDefaultLocale() { + resetNumberFormatDefaultLocale(); + resetTimeFormatDefaultLocale(); + return defaultLocale(); + } + const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; + const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; + const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; + const fileProtocol = "file://"; + function loaderFactory(fs) { + return (options2) => ({ + options: options2 || {}, + sanitize, + load: load$1, + fileAccess: false, + file: fileLoader(), + http: httpLoader + }); + } + async function load$1(uri, options2) { + const opt = await this.sanitize(uri, options2), url = opt.href; + return opt.localFile ? this.file(url) : this.http(url, options2?.http); + } + async function sanitize(uri, options2) { + options2 = extend({}, this.options, options2); + const fileAccess = this.fileAccess, result = { + href: null }; - PanelBase.prototype._dismissOnOuterClick = function(ev) { - var panel = this._panel.current; - if (this.isActive && panel && !ev.defaultPrevented) { - if (!(0, _utilities.elementContains)(panel, ev.target)) { - if (this.props.onOuterClick) this.props.onOuterClick(ev); - else this.dismiss(ev); - } + let isFile, loadFile, base2; + const isAllowed = allowed_re.test(uri.replace(whitespace_re, "")); + if (uri == null || typeof uri !== "string" || !isAllowed) { + error("Sanitize failure, invalid URI: " + $(uri)); + } + const hasProtocol = protocol_re.test(uri); + if ((base2 = options2.baseURL) && !hasProtocol) { + if (!uri.startsWith("/") && !base2.endsWith("/")) { + uri = "/" + uri; + } + uri = base2 + uri; + } + loadFile = (isFile = uri.startsWith(fileProtocol)) || options2.mode === "file" || options2.mode !== "http" && !hasProtocol && fileAccess; + if (isFile) { + uri = uri.slice(fileProtocol.length); + } else if (uri.startsWith("//")) { + if (options2.defaultProtocol === "file") { + uri = uri.slice(2); + loadFile = true; + } else { + uri = (options2.defaultProtocol || "http") + ":" + uri; + } + } + Object.defineProperty(result, "localFile", { + value: !!loadFile + }); + result.href = uri; + if (options2.target) { + result.target = options2.target + ""; + } + if (options2.rel) { + result.rel = options2.rel + ""; + } + if (options2.context === "image" && options2.crossOrigin) { + result.crossOrigin = options2.crossOrigin + ""; + } + return result; + } + function fileLoader(fs) { + return fileReject; + } + async function fileReject() { + error("No file system access."); + } + async function httpLoader(url, options2) { + const opt = extend({}, this.options.http, options2), type2 = options2 && options2.response, response = await fetch(url, opt); + return !response.ok ? error(response.status + "" + response.statusText) : isFunction(response[type2]) ? response[type2]() : response.text(); + } + const isValid = (_) => _ != null && _ === _; + const isBoolean = (_) => _ === "true" || _ === "false" || _ === true || _ === false; + const isDate = (_) => !Number.isNaN(Date.parse(_)); + const isNumber = (_) => !Number.isNaN(+_) && !(_ instanceof Date); + const isInteger = (_) => isNumber(_) && Number.isInteger(+_); + const typeParsers = { + boolean: toBoolean, + integer: toNumber, + number: toNumber, + date: toDate, + string: toString, + unknown: identity$2 + }; + const typeTests = [isBoolean, isInteger, isNumber, isDate]; + const typeList = ["boolean", "integer", "number", "date"]; + function inferType(values2, field2) { + if (!values2 || !values2.length) return "unknown"; + const n = values2.length, m2 = typeTests.length, a2 = typeTests.map((_, i) => i + 1); + for (let i = 0, t = 0, j, value2; i < n; ++i) { + value2 = field2 ? values2[i][field2] : values2[i]; + for (j = 0; j < m2; ++j) { + if (a2[j] && isValid(value2) && !typeTests[j](value2)) { + a2[j] = 0; + ++t; + if (t === typeTests.length) return "string"; } + } + } + return typeList[a2.reduce((u2, v) => u2 === 0 ? v : u2, 0) - 1]; + } + function inferTypes(data2, fields) { + return fields.reduce((types2, field2) => { + types2[field2] = inferType(data2, field2); + return types2; + }, {}); + } + function delimitedFormat(delimiter) { + const parse2 = function(data2, format2) { + const delim = { + delimiter + }; + return dsv(data2, format2 ? extend(format2, delim) : delim); + }; + parse2.responseType = "text"; + return parse2; + } + function dsv(data2, format2) { + if (format2.header) { + data2 = format2.header.map($).join(format2.delimiter) + "\n" + data2; + } + return dsvFormat(format2.delimiter).parse(data2 + ""); + } + dsv.responseType = "text"; + function isBuffer(_) { + return typeof Buffer === "function" && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; + } + function json(data2, format2) { + const prop = format2 && format2.property ? field$1(format2.property) : identity$2; + return isObject(data2) && !isBuffer(data2) ? parseJSON(prop(data2), format2) : prop(JSON.parse(data2)); + } + json.responseType = "json"; + function parseJSON(data2, format2) { + if (!isArray(data2) && isIterable(data2)) { + data2 = [...data2]; + } + return format2 && format2.copy ? JSON.parse(JSON.stringify(data2)) : data2; + } + const filters = { + interior: (a2, b2) => a2 !== b2, + exterior: (a2, b2) => a2 === b2 + }; + function topojson(data2, format2) { + let method2, object2, property2, filter2; + data2 = json(data2, format2); + if (format2 && format2.feature) { + method2 = feature; + property2 = format2.feature; + } else if (format2 && format2.mesh) { + method2 = mesh; + property2 = format2.mesh; + filter2 = filters[format2.filter]; + } else { + error("Missing TopoJSON feature or mesh parameter."); + } + object2 = (object2 = data2.objects[property2]) ? method2(data2, object2, filter2) : error("Invalid TopoJSON object: " + property2); + return object2 && object2.features || [object2]; + } + topojson.responseType = "json"; + const format$2 = { + dsv, + csv: delimitedFormat(","), + tsv: delimitedFormat(" "), + json, + topojson + }; + function formats$1(name, reader) { + if (arguments.length > 1) { + format$2[name] = reader; + return this; + } else { + return has$1(format$2, name) ? format$2[name] : null; + } + } + function responseType(type2) { + const f = formats$1(type2); + return f && f.responseType || "text"; + } + function read(data2, schema, timeParser, utcParser) { + schema = schema || {}; + const reader = formats$1(schema.type || "json"); + if (!reader) error("Unknown data format type: " + schema.type); + data2 = reader(data2, schema); + if (schema.parse) parse$6(data2, schema.parse, timeParser, utcParser); + if (has$1(data2, "columns")) delete data2.columns; + return data2; + } + function parse$6(data2, types2, timeParser, utcParser) { + if (!data2.length) return; + const locale2 = timeFormatDefaultLocale(); + timeParser = timeParser || locale2.timeParse; + utcParser = utcParser || locale2.utcParse; + let fields = data2.columns || Object.keys(data2[0]), datum2, field2, i, j, n, m2; + if (types2 === "auto") types2 = inferTypes(data2, fields); + fields = Object.keys(types2); + const parsers = fields.map((field3) => { + const type2 = types2[field3]; + let parts, pattern; + if (type2 && (type2.startsWith("date:") || type2.startsWith("utc:"))) { + parts = type2.split(/:(.+)?/, 2); + pattern = parts[1]; + if (pattern[0] === "'" && pattern[pattern.length - 1] === "'" || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { + pattern = pattern.slice(1, -1); + } + const parse2 = parts[0] === "utc" ? utcParser : timeParser; + return parse2(pattern); + } + if (!typeParsers[type2]) { + throw Error("Illegal format pattern: " + field3 + ":" + type2); + } + return typeParsers[type2]; + }); + for (i = 0, n = data2.length, m2 = fields.length; i < n; ++i) { + datum2 = data2[i]; + for (j = 0; j < m2; ++j) { + field2 = fields[j]; + datum2[field2] = parsers[j](datum2[field2]); + } + } + } + const loader = loaderFactory(); + function UniqueList(idFunc) { + const $2 = idFunc || identity$2, list = [], ids = {}; + list.add = (_) => { + const id2 = $2(_); + if (!ids[id2]) { + ids[id2] = 1; + list.push(_); + } + return list; + }; + list.remove = (_) => { + const id2 = $2(_); + if (ids[id2]) { + ids[id2] = 0; + const idx = list.indexOf(_); + if (idx >= 0) list.splice(idx, 1); + } + return list; }; - PanelBase.defaultProps = { - isHiddenOnDismiss: false, - isOpen: undefined, - isBlocking: true, - hasCloseButton: true, - type: (0, _panelTypes.PanelType).smallFixedFar - }; - PanelBase.contextType = (0, _reactWindowProvider.WindowContext); - return PanelBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","../../Button":"1457j","../../Layer":"hQjxQ","../../Overlay":"eCuPP","../../Popup":"bOJlv","../../Utilities":"1NZCy","../FocusTrapZone/index":"dzHmS","./Panel.types":"kzGXk","@fluentui/react-window-provider":"iP8C0","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kzGXk":[function(require,module,exports,__globalThis) { -/** - * {@docCategory Panel} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PanelType", ()=>PanelType); -var PanelType; -(function(PanelType) { - /** - * Renders the Panel with a `fluid` (full screen) width. - * Recommended for use on small screen breakpoints. - * - Small (320-479): full screen width, 16px left/right padding - * - Medium (480-639): full screen width, 16px left/right padding - * - Large (640-1023): full screen width, 32px left/right padding - * - XLarge (1024-1365): full screen width, 32px left/right padding - * - XXLarge (1366-up): full screen width, 40px left/right padding - */ PanelType[PanelType["smallFluid"] = 0] = "smallFluid"; - /** - * Renders the Panel in fixed-width `small` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): 340px width, 16px left/right padding - * - Large (640-1023): 340px width, 32px left/right padding - * - XLarge (1024-1365): 340px width, 32px left/right padding - * - XXLarge (1366-up): 340px width, 40px left/right padding - */ PanelType[PanelType["smallFixedFar"] = 1] = "smallFixedFar"; - /** - * Renders the Panel in fixed-width `small` size, anchored to the near side (left in LTR mode). - * - Small (320-479): 272px width, 16px left/right padding - * - Medium (480-639): 272px width, 16px left/right padding - * - Large (640-1023): 272px width, 32px left/right padding - * - XLarge (1024-1365): 272px width, 32px left/right padding - * - XXLarge (1366-up): 272px width, 40px left/right padding - */ PanelType[PanelType["smallFixedNear"] = 2] = "smallFixedNear"; - /** - * Renders the Panel in `medium` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): 592px width, 32px left/right padding - * - XLarge (1024-1365): 644px width, 32px left/right padding - * - XXLarge (1366-up): 644px width, 40px left/right padding - */ PanelType[PanelType["medium"] = 3] = "medium"; - /** - * Renders the Panel in `large` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint - * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding - * - XXLarge (1366-up): 428px fixed left margin, fluid width, 40px left/right padding - */ PanelType[PanelType["large"] = 4] = "large"; - /** - * Renders the Panel in `large` size, anchored to the far side (right in LTR mode), with a fixed width at - * XX-Large breakpoint. - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint - * - XLarge (1024-1365): 48px fixed left margin, fluid width, 32px left/right padding - * - XXLarge (1366-up): 940px width, 40px left/right padding - */ PanelType[PanelType["largeFixed"] = 5] = "largeFixed"; - /** - * Renders the Panel in `extra large` size, anchored to the far side (right in LTR mode). - * - Small (320-479): adapts to `PanelType.smallFluid` at this breakpoint - * - Medium (480-639): adapts to `PanelType.smallFixedFar` at this breakpoint - * - Large (640-1023): adapts to `PanelType.medium` at this breakpoint - * - XLarge (1024-1365): adapts to `PanelType.large` at this breakpoint - * - XXLarge (1366-1919): 176px fixed left margin, fluid width, 40px left/right padding - * - XXXLarge (1920-up): 176px fixed left margin, fluid width, 40px left/right padding - */ PanelType[PanelType["extraLarge"] = 6] = "extraLarge"; - /** - * Renders the Panel in `custom` size using `customWidth`, anchored to the far side (right in LTR mode). - * - Has a fixed width provided by the `customWidth` prop - * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel - * taking up 100% of the viewport width - */ PanelType[PanelType["custom"] = 7] = "custom"; - /** - * Renders the Panel in `custom` size using `customWidth`, anchored to the near side (left in LTR mode). - * - Has a fixed width provided by the `customWidth` prop - * - When screen width reaches the `customWidth` value it will behave like a fluid width Panel - * taking up 100% of the viewport width - */ PanelType[PanelType["customNear"] = 8] = "customNear"; -})(PanelType || (PanelType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6pUAU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _panelTypes = require("./Panel.types"); -var _styling = require("../../Styling"); -var _a, _b, _c, _d, _e; -var GlobalClassNames = { - root: 'ms-Panel', - main: 'ms-Panel-main', - commands: 'ms-Panel-commands', - contentInner: 'ms-Panel-contentInner', - scrollableContent: 'ms-Panel-scrollableContent', - navigation: 'ms-Panel-navigation', - closeButton: 'ms-Panel-closeButton ms-PanelAction-close', - header: 'ms-Panel-header', - headerText: 'ms-Panel-headerText', - content: 'ms-Panel-content', - footer: 'ms-Panel-footer', - footerInner: 'ms-Panel-footerInner', - isOpen: 'is-open', - hasCloseButton: 'ms-Panel--hasCloseButton', - smallFluid: 'ms-Panel--smFluid', - smallFixedNear: 'ms-Panel--smLeft', - smallFixedFar: 'ms-Panel--sm', - medium: 'ms-Panel--md', - large: 'ms-Panel--lg', - largeFixed: 'ms-Panel--fixed', - extraLarge: 'ms-Panel--xl', - custom: 'ms-Panel--custom', - customNear: 'ms-Panel--customLeft' -}; -var panelWidth = { - full: '100%', - auto: 'auto', - xs: 272, - sm: 340, - md1: 592, - md2: 644, - lg: 940 -}; -var panelMargin = { - auto: 'auto', - none: 0, - md: 48, - lg: 428, - xl: 176 -}; -// Following consts are used below in `getPanelBreakpoints()` function to provide -// necessary fallbacks for different types of Panel in different breakpoints. -var smallPanelSelectors = (_a = {}, _a["@media (min-width: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - width: panelWidth.sm -}, _a); -var mediumPanelSelectors = (_b = {}, _b["@media (min-width: ".concat((0, _styling.ScreenWidthMinLarge), "px)")] = { - width: panelWidth.md1 -}, _b["@media (min-width: ".concat((0, _styling.ScreenWidthMinXLarge), "px)")] = { - width: panelWidth.md2 -}, _b); -var largePanelSelectors = (_c = {}, _c["@media (min-width: ".concat((0, _styling.ScreenWidthMinUhfMobile), "px)")] = { - left: panelMargin.md, - width: panelWidth.auto -}, _c["@media (min-width: ".concat((0, _styling.ScreenWidthMinXXLarge), "px)")] = { - left: panelMargin.lg -}, _c); -var largeFixedPanelSelectors = (_d = {}, _d["@media (min-width: ".concat((0, _styling.ScreenWidthMinXXLarge), "px)")] = { - left: panelMargin.auto, - width: panelWidth.lg -}, _d); -var extraLargePanelSelectors = (_e = {}, _e["@media (min-width: ".concat((0, _styling.ScreenWidthMinXXLarge), "px)")] = { - left: panelMargin.xl -}, _e); -// Make sure Panels have fallbacks to different breakpoints by reusing same selectors. -// This is done in the effort to follow design redlines. -var getPanelBreakpoints = function(type) { - var selectors; - // Panel types `smallFluid`, `smallFixedNear`, `custom` and `customNear` - // are not checked in here because they render the same in all the breakpoints - // and have the checks done separately in the `getStyles` function below. - switch(type){ - case (0, _panelTypes.PanelType).smallFixedFar: - selectors = (0, _tslib.__assign)({}, smallPanelSelectors); - break; - case (0, _panelTypes.PanelType).medium: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors); - break; - case (0, _panelTypes.PanelType).large: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors); - break; - case (0, _panelTypes.PanelType).largeFixed: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), largeFixedPanelSelectors); - break; - case (0, _panelTypes.PanelType).extraLarge: - selectors = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, smallPanelSelectors), mediumPanelSelectors), largePanelSelectors), extraLargePanelSelectors); - break; - default: - break; + return list; + } + async function asyncCallback(df, callback) { + try { + await callback(df); + } catch (err) { + df.error(err); } - return selectors; -}; -var commandBarHeight = '44px'; -var sharedPaddingStyles = { - paddingLeft: '24px', - paddingRight: '24px' -}; -var getStyles = function(props) { - var _a, _b, _c, _d; - var className = props.className, focusTrapZoneClassName = props.focusTrapZoneClassName, hasCloseButton = props.hasCloseButton, headerClassName = props.headerClassName, isAnimating = props.isAnimating, isFooterSticky = props.isFooterSticky, isFooterAtBottom = props.isFooterAtBottom, isOnRightSide = props.isOnRightSide, isOpen = props.isOpen, isHiddenOnDismiss = props.isHiddenOnDismiss, hasCustomNavigation = props.hasCustomNavigation, theme = props.theme, _e = props.type, type = _e === void 0 ? (0, _panelTypes.PanelType).smallFixedFar : _e; - var effects = theme.effects, fonts = theme.fonts, semanticColors = theme.semanticColors; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var isCustomPanel = type === (0, _panelTypes.PanelType).custom || type === (0, _panelTypes.PanelType).customNear; + } + const TUPLE_ID_KEY = Symbol("vega_id"); + let TUPLE_ID = 1; + function isTuple(t) { + return !!(t && tupleid(t)); + } + function tupleid(t) { + return t[TUPLE_ID_KEY]; + } + function setid(t, id2) { + t[TUPLE_ID_KEY] = id2; + return t; + } + function ingest$1(datum2) { + const t = datum2 === Object(datum2) ? datum2 : { + data: datum2 + }; + return tupleid(t) ? t : setid(t, TUPLE_ID++); + } + function derive(t) { + return rederive(t, ingest$1({})); + } + function rederive(t, d2) { + for (const k in t) d2[k] = t[k]; + return d2; + } + function replace$1(t, d2) { + return setid(d2, tupleid(t)); + } + function stableCompare(cmp, f) { + return !cmp ? null : f ? (a2, b2) => cmp(a2, b2) || tupleid(f(a2)) - tupleid(f(b2)) : (a2, b2) => cmp(a2, b2) || tupleid(a2) - tupleid(b2); + } + function isChangeSet(v) { + return v && v.constructor === changeset; + } + function changeset() { + const add2 = [], rem2 = [], mod = [], remp = [], modp = []; + let clean = null, reflow2 = false; return { - root: [ - classNames.root, - theme.fonts.medium, - isOpen && classNames.isOpen, - hasCloseButton && classNames.hasCloseButton, - { - pointerEvents: 'none', - position: 'absolute', - top: 0, - left: 0, - right: 0, - bottom: 0 - }, - isCustomPanel && isOnRightSide && classNames.custom, - isCustomPanel && !isOnRightSide && classNames.customNear, - className - ], - overlay: [ - { - pointerEvents: 'auto', - cursor: 'pointer' - }, - isOpen && isAnimating && (0, _styling.AnimationClassNames).fadeIn100, - !isOpen && isAnimating && (0, _styling.AnimationClassNames).fadeOut100 - ], - hiddenPanel: [ - !isOpen && !isAnimating && isHiddenOnDismiss && { - visibility: 'hidden' - } - ], - main: [ - classNames.main, - { - backgroundColor: semanticColors.bodyBackground, - boxShadow: effects.elevation64, - pointerEvents: 'auto', - position: 'absolute', - display: 'flex', - flexDirection: 'column', - overflowX: 'hidden', - overflowY: 'auto', - WebkitOverflowScrolling: 'touch', - bottom: 0, - top: 0, - // left, right, width are overridden depending on the type of the Panel and the screen breakpoint. - left: panelMargin.auto, - right: panelMargin.none, - width: panelWidth.full, - selectors: (0, _tslib.__assign)((_a = {}, _a[0, _styling.HighContrastSelector] = { - borderLeft: "3px solid ".concat(semanticColors.variantBorder), - borderRight: "3px solid ".concat(semanticColors.variantBorder) - }, _a), getPanelBreakpoints(type)) - }, - type === (0, _panelTypes.PanelType).smallFluid && { - left: panelMargin.none - }, - type === (0, _panelTypes.PanelType).smallFixedNear && { - left: panelMargin.none, - right: panelMargin.auto, - width: panelWidth.xs - }, - type === (0, _panelTypes.PanelType).customNear && { - right: 'auto', - left: 0 - }, - isCustomPanel && { - maxWidth: '100vw' - }, - isOpen && isAnimating && !isOnRightSide && (0, _styling.AnimationClassNames).slideRightIn40, - isOpen && isAnimating && isOnRightSide && (0, _styling.AnimationClassNames).slideLeftIn40, - !isOpen && isAnimating && !isOnRightSide && (0, _styling.AnimationClassNames).slideLeftOut40, - !isOpen && isAnimating && isOnRightSide && (0, _styling.AnimationClassNames).slideRightOut40, - focusTrapZoneClassName - ], - commands: [ - classNames.commands, - { - // Ensures that the sticky header always has a background to prevent overlaps on scroll. - backgroundColor: semanticColors.bodyBackground, - paddingTop: 18, - selectors: (_b = {}, _b["@media (min-height: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - position: 'sticky', - top: 0, - zIndex: 1 - }, _b) - }, - hasCustomNavigation && { - paddingTop: 'inherit' - } - ], - navigation: [ - classNames.navigation, - { - display: 'flex', - justifyContent: 'flex-end' - }, - hasCustomNavigation && { - height: commandBarHeight - } - ], - contentInner: [ - classNames.contentInner, - { - display: 'flex', - flexDirection: 'column', - flexGrow: 1, - overflowY: 'hidden' - } - ], - header: [ - classNames.header, - sharedPaddingStyles, - { - alignSelf: 'flex-start' - }, - hasCloseButton && !hasCustomNavigation && { - flexGrow: 1 - }, - hasCustomNavigation && { - // Ensure that title doesn't shrink if screen is too small - flexShrink: 0 - } - ], - headerText: [ - classNames.headerText, - fonts.xLarge, - { - color: semanticColors.bodyText, - lineHeight: '27px', - overflowWrap: 'break-word', - wordWrap: 'break-word', - wordBreak: 'break-word', - hyphens: 'auto' - }, - headerClassName - ], - scrollableContent: [ - classNames.scrollableContent, - { - overflowY: 'auto' - }, - isFooterAtBottom && { - flexGrow: 1, - display: 'inherit', - flexDirection: 'inherit' - } - ], - content: [ - classNames.content, - sharedPaddingStyles, - { - paddingBottom: 20 - }, - isFooterAtBottom && { - selectors: (_c = {}, _c["@media (min-height: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - flexGrow: 1 - }, _c) - } - ], - footer: [ - classNames.footer, - { - // Ensure that footer doesn't shrink if screen is too small - flexShrink: 0, - borderTop: '1px solid transparent', - transition: "opacity ".concat((0, _styling.AnimationVariables).durationValue3, " ").concat((0, _styling.AnimationVariables).easeFunction2), - selectors: (_d = {}, _d["@media (min-height: ".concat((0, _styling.ScreenWidthMinMedium), "px)")] = { - position: 'sticky', - bottom: 0 - }, _d) - }, - isFooterSticky && { - backgroundColor: semanticColors.bodyBackground, - borderTopColor: semanticColors.variantBorder - } - ], - footerInner: [ - classNames.footerInner, - sharedPaddingStyles, - { - paddingBottom: 16, - paddingTop: 16 - } - ], - subComponentStyles: { - closeButton: { - root: [ - classNames.closeButton, - { - marginRight: 14, - color: theme.palette.neutralSecondary, - fontSize: (0, _styling.IconFontSizes).large - }, - hasCustomNavigation && { - marginRight: 0, - height: 'auto', - width: '44px' - } - ], - rootHovered: { - color: theme.palette.neutralPrimary - } - } + constructor: changeset, + insert(t) { + const d2 = array$4(t), n = d2.length; + for (let i = 0; i < n; ++i) add2.push(d2[i]); + return this; + }, + remove(t) { + const a2 = isFunction(t) ? remp : rem2, d2 = array$4(t), n = d2.length; + for (let i = 0; i < n; ++i) a2.push(d2[i]); + return this; + }, + modify(t, field2, value2) { + const m2 = { + field: field2, + value: constant$4(value2) + }; + if (isFunction(t)) { + m2.filter = t; + modp.push(m2); + } else { + m2.tuple = t; + mod.push(m2); + } + return this; + }, + encode(t, set2) { + if (isFunction(t)) modp.push({ + filter: t, + field: set2 + }); + else mod.push({ + tuple: t, + field: set2 + }); + return this; + }, + clean(value2) { + clean = value2; + return this; + }, + reflow() { + reflow2 = true; + return this; + }, + pulse(pulse2, tuples) { + const cur = {}, out = {}; + let i, n, m2, f, t, id2; + for (i = 0, n = tuples.length; i < n; ++i) { + cur[tupleid(tuples[i])] = 1; + } + for (i = 0, n = rem2.length; i < n; ++i) { + t = rem2[i]; + cur[tupleid(t)] = -1; + } + for (i = 0, n = remp.length; i < n; ++i) { + f = remp[i]; + tuples.forEach((t4) => { + if (f(t4)) cur[tupleid(t4)] = -1; + }); + } + for (i = 0, n = add2.length; i < n; ++i) { + t = add2[i]; + id2 = tupleid(t); + if (cur[id2]) { + cur[id2] = 1; + } else { + pulse2.add.push(ingest$1(add2[i])); + } + } + for (i = 0, n = tuples.length; i < n; ++i) { + t = tuples[i]; + if (cur[tupleid(t)] < 0) pulse2.rem.push(t); + } + function modify2(t4, f2, v) { + if (v) { + t4[f2] = v(t4); + } else { + pulse2.encode = f2; + } + if (!reflow2) out[tupleid(t4)] = t4; + } + for (i = 0, n = mod.length; i < n; ++i) { + m2 = mod[i]; + t = m2.tuple; + f = m2.field; + id2 = cur[tupleid(t)]; + if (id2 > 0) { + modify2(t, f, m2.value); + pulse2.modifies(f); + } + } + for (i = 0, n = modp.length; i < n; ++i) { + m2 = modp[i]; + f = m2.filter; + tuples.forEach((t4) => { + if (f(t4) && cur[tupleid(t4)] > 0) { + modify2(t4, m2.field, m2.value); + } + }); + pulse2.modifies(m2.field); + } + if (reflow2) { + pulse2.mod = rem2.length || remp.length ? tuples.filter((t4) => cur[tupleid(t4)] > 0) : tuples.slice(); + } else { + for (id2 in out) pulse2.mod.push(out[id2]); } + if (clean || clean == null && (rem2.length || remp.length)) { + pulse2.clean(true); + } + return pulse2; + } }; -}; - -},{"tslib":"9gizs","./Panel.types":"kzGXk","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cUemW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _utilities = require("../../Utilities"); -var _positioning = require("../../Positioning"); -var _styling = require("../../Styling"); -var _a, _b, _c, _d, _e; -var GlobalClassNames = { - root: 'ms-Dropdown-container', - label: 'ms-Dropdown-label', - dropdown: 'ms-Dropdown', - title: 'ms-Dropdown-title', - caretDownWrapper: 'ms-Dropdown-caretDownWrapper', - caretDown: 'ms-Dropdown-caretDown', - callout: 'ms-Dropdown-callout', - panel: 'ms-Dropdown-panel', - dropdownItems: 'ms-Dropdown-items', - dropdownItem: 'ms-Dropdown-item', - dropdownDivider: 'ms-Dropdown-divider', - dropdownOptionText: 'ms-Dropdown-optionText', - dropdownItemHeader: 'ms-Dropdown-header', - titleIsPlaceHolder: 'ms-Dropdown-titleIsPlaceHolder', - titleHasError: 'ms-Dropdown-title--hasError' -}; -var DROPDOWN_HEIGHT = 32; -var DROPDOWN_ITEM_HEIGHT = 36; -var highContrastAdjustMixin = (_a = {}, _a["".concat((0, _styling.HighContrastSelector), ", ").concat((0, _styling.HighContrastSelectorWhite).replace('@media ', ''))] = (0, _tslib.__assign)({}, (0, _styling.getHighContrastNoAdjustStyle)()), _a); -var highContrastItemAndTitleStateMixin = { - selectors: (0, _tslib.__assign)((_b = {}, _b[0, _styling.HighContrastSelector] = (_c = { - backgroundColor: 'Highlight', - borderColor: 'Highlight', - color: 'HighlightText' - }, _c[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus:after")] = { - borderColor: 'HighlightText' - }, _c), _b['.ms-Checkbox-checkbox'] = (_d = {}, _d[0, _styling.HighContrastSelector] = { - borderColor: 'HighlightText' - }, _d), _b), highContrastAdjustMixin) -}; -var highContrastBorderState = { - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight' - }, _e) -}; -var MinimumScreenSelector = (0, _styling.getScreenSelector)(0, (0, _styling.ScreenWidthMinMedium)); -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; - var theme = props.theme, hasError = props.hasError, hasLabel = props.hasLabel, className = props.className, isOpen = props.isOpen, disabled = props.disabled, required = props.required, isRenderingPlaceholder = props.isRenderingPlaceholder, panelClassName = props.panelClassName, calloutClassName = props.calloutClassName, calloutRenderEdge = props.calloutRenderEdge; - if (!theme) throw new Error('theme is undefined or null in base Dropdown getStyles function.'); - var globalClassnames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); - var palette = theme.palette, semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; - var rootHoverFocusActiveSelectorNeutralDarkMixin = { - color: semanticColors.menuItemTextHovered - }; - var rootHoverFocusActiveSelectorNeutralPrimaryMixin = { - color: semanticColors.menuItemText - }; - var borderColorError = { - borderColor: semanticColors.errorText - }; - var dropdownItemStyle = [ - globalClassnames.dropdownItem, - { - backgroundColor: 'transparent', - boxSizing: 'border-box', - cursor: 'pointer', - display: 'flex', - alignItems: 'center', - padding: '0 8px', - width: '100%', - minHeight: DROPDOWN_ITEM_HEIGHT, - lineHeight: 20, - height: 0, - position: 'relative', - border: '1px solid transparent', - borderRadius: 0, - wordWrap: 'break-word', - overflowWrap: 'break-word', - textAlign: 'left', - '.ms-Button-flexContainer': { - width: '100%' - } + } + const CACHE = "_:mod:_"; + function Parameters() { + Object.defineProperty(this, CACHE, { + writable: true, + value: {} + }); + } + Parameters.prototype = { + /** + * Set a parameter value. If the parameter value changes, the parameter + * will be recorded as modified. + * @param {string} name - The parameter name. + * @param {number} index - The index into an array-value parameter. Ignored if + * the argument is undefined, null or less than zero. + * @param {*} value - The parameter value to set. + * @param {boolean} [force=false] - If true, records the parameter as modified + * even if the value is unchanged. + * @return {Parameters} - This parameter object. + */ + set(name, index2, value2, force2) { + const o = this, v = o[name], mod = o[CACHE]; + if (index2 != null && index2 >= 0) { + if (v[index2] !== value2 || force2) { + v[index2] = value2; + mod[index2 + ":" + name] = -1; + mod[name] = -1; + } + } else if (v !== value2 || force2) { + o[name] = value2; + mod[name] = isArray(value2) ? 1 + value2.length : -1; + } + return o; + }, + /** + * Tests if one or more parameters has been modified. If invoked with no + * arguments, returns true if any parameter value has changed. If the first + * argument is array, returns trues if any parameter name in the array has + * changed. Otherwise, tests if the given name and optional array index has + * changed. + * @param {string} name - The parameter name to test. + * @param {number} [index=undefined] - The parameter array index to test. + * @return {boolean} - Returns true if a queried parameter was modified. + */ + modified(name, index2) { + const mod = this[CACHE]; + if (!arguments.length) { + for (const k in mod) { + if (mod[k]) return true; } - ]; - var dropdownHeaderStyle = [ - globalClassnames.dropdownItemHeader, - (0, _tslib.__assign)((0, _tslib.__assign)({}, fonts.medium), { - fontWeight: (0, _styling.FontWeights).semibold, - color: semanticColors.menuHeader, - background: 'none', - backgroundColor: 'transparent', - border: 'none', - height: DROPDOWN_ITEM_HEIGHT, - lineHeight: DROPDOWN_ITEM_HEIGHT, - cursor: 'default', - padding: '0 8px', - userSelect: 'none', - textAlign: 'left', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) - }) - ]; - var selectedItemBackgroundColor = semanticColors.menuItemBackgroundPressed; - var itemSelectors = function(isSelected) { - var _a, _b; - if (isSelected === void 0) isSelected = false; - return { - selectors: (_a = { - '&:hover': [ - { - color: semanticColors.menuItemTextHovered, - backgroundColor: !isSelected ? semanticColors.menuItemBackgroundHovered : selectedItemBackgroundColor - }, - highContrastItemAndTitleStateMixin - ], - '&.is-multi-select:hover': [ - { - backgroundColor: !isSelected ? 'transparent' : selectedItemBackgroundColor - }, - highContrastItemAndTitleStateMixin - ], - '&:active:hover': [ - { - color: semanticColors.menuItemTextHovered, - backgroundColor: !isSelected ? semanticColors.menuItemBackgroundPressed : semanticColors.menuItemBackgroundHovered - }, - highContrastItemAndTitleStateMixin - ] - }, _a[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus:after, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus:after")] = (_b = { - left: 0, - top: 0, - bottom: 0, - right: 0 - }, _b[0, _styling.HighContrastSelector] = { - inset: '2px' - }, _b), _a[0, _styling.HighContrastSelector] = { - border: 'none' - }, _a) - }; + return false; + } else if (isArray(name)) { + for (let k = 0; k < name.length; ++k) { + if (mod[name[k]]) return true; + } + return false; + } + return index2 != null && index2 >= 0 ? index2 + 1 < mod[name] || !!mod[index2 + ":" + name] : !!mod[name]; + }, + /** + * Clears the modification records. After calling this method, + * all parameters are considered unmodified. + */ + clear() { + this[CACHE] = {}; + return this; + } + }; + let OP_ID = 0; + const PULSE = "pulse", NO_PARAMS = new Parameters(); + const SKIP$1$1 = 1, MODIFIED = 2; + function Operator(init2, update2, params2, react) { + this.id = ++OP_ID; + this.value = init2; + this.stamp = -1; + this.rank = -1; + this.qrank = -1; + this.flags = 0; + if (update2) { + this._update = update2; + } + if (params2) this.parameters(params2, react); + } + function flag(bit) { + return function(state) { + const f = this.flags; + if (arguments.length === 0) return !!(f & bit); + this.flags = state ? f | bit : f & ~bit; + return this; }; - var dropdownItemSelected = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - { - backgroundColor: selectedItemBackgroundColor, - color: semanticColors.menuItemTextHovered - }, - itemSelectors(true), - highContrastItemAndTitleStateMixin - ], false); - var dropdownItemDisabled = (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - { - color: semanticColors.disabledText, - cursor: 'default', - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText', - border: 'none' - }, _b) + } + Operator.prototype = { + /** + * Returns a list of target operators dependent on this operator. + * If this list does not exist, it is created and then returned. + * @return {UniqueList} + */ + targets() { + return this._targets || (this._targets = UniqueList(id)); + }, + /** + * Sets the value of this operator. + * @param {*} value - the value to set. + * @return {Number} Returns 1 if the operator value has changed + * according to strict equality, returns 0 otherwise. + */ + set(value2) { + if (this.value !== value2) { + this.value = value2; + return 1; + } else { + return 0; + } + }, + /** + * Indicates that operator evaluation should be skipped on the next pulse. + * This operator will still propagate incoming pulses, but its update function + * will not be invoked. The skip flag is reset after every pulse, so calling + * this method will affect processing of the next pulse only. + */ + skip: flag(SKIP$1$1), + /** + * Indicates that this operator's value has been modified on its most recent + * pulse. Normally modification is checked via strict equality; however, in + * some cases it is more efficient to update the internal state of an object. + * In those cases, the modified flag can be used to trigger propagation. Once + * set, the modification flag persists across pulses until unset. The flag can + * be used with the last timestamp to test if a modification is recent. + */ + modified: flag(MODIFIED), + /** + * Sets the parameters for this operator. The parameter values are analyzed for + * operator instances. If found, this operator will be added as a dependency + * of the parameterizing operator. Operator values are dynamically marshalled + * from each operator parameter prior to evaluation. If a parameter value is + * an array, the array will also be searched for Operator instances. However, + * the search does not recurse into sub-arrays or object properties. + * @param {object} params - A hash of operator parameters. + * @param {boolean} [react=true] - A flag indicating if this operator should + * automatically update (react) when parameter values change. In other words, + * this flag determines if the operator registers itself as a listener on + * any upstream operators included in the parameters. + * @param {boolean} [initonly=false] - A flag indicating if this operator + * should calculate an update only upon its initial evaluation, then + * deregister dependencies and suppress all future update invocations. + * @return {Operator[]} - An array of upstream dependencies. + */ + parameters(params2, react, initonly) { + react = react !== false; + const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; + let name, value2, n, i; + const add2 = (name2, index2, value3) => { + if (value3 instanceof Operator) { + if (value3 !== this) { + if (react) value3.targets().add(this); + deps.push(value3); + } + argops.push({ + op: value3, + name: name2, + index: index2 + }); + } else { + argval.set(name2, index2, value3); + } + }; + for (name in params2) { + value2 = params2[name]; + if (name === PULSE) { + array$4(value2).forEach((op) => { + if (!(op instanceof Operator)) { + error("Pulse parameters must be operator instances."); + } else if (op !== this) { + op.targets().add(this); + deps.push(op); + } + }); + this.source = value2; + } else if (isArray(value2)) { + argval.set(name, -1, Array(n = value2.length)); + for (i = 0; i < n; ++i) add2(name, i, value2[i]); + } else { + add2(name, -1, value2); } - ], false); - var titleOpenBorderRadius = calloutRenderEdge === (0, _positioning.RectangleEdge).bottom ? "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0") : "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2); - var calloutOpenBorderRadius = calloutRenderEdge === (0, _positioning.RectangleEdge).bottom ? "0 0 ".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2) : "".concat(effects.roundedCorner2, " ").concat(effects.roundedCorner2, " 0 0"); - return { - root: [ - globalClassnames.root, - className - ], - label: globalClassnames.label, - dropdown: [ - globalClassnames.dropdown, - (0, _styling.normalize), - fonts.medium, - { - color: semanticColors.menuItemText, - borderColor: semanticColors.focusBorder, - position: 'relative', - outline: 0, - userSelect: 'none', - selectors: (_c = {}, _c['&:hover .' + globalClassnames.title] = [ - !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, - { - borderColor: isOpen ? palette.neutralSecondary : palette.neutralPrimary - }, - highContrastBorderState - ], _c['&:focus .' + globalClassnames.title] = [ - !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, - { - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _d) - } - ], _c['&:focus:after'] = [ - { - pointerEvents: 'none', - content: "''", - position: 'absolute', - boxSizing: 'border-box', - top: '0px', - left: '0px', - width: '100%', - height: '100%', - // see https://github.com/microsoft/fluentui/pull/9182 for semantic color disc - border: !disabled ? "2px solid ".concat(palette.themePrimary) : 'none', - borderRadius: '2px', - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _e) - } - ], _c['&:active .' + globalClassnames.title] = [ - !disabled && rootHoverFocusActiveSelectorNeutralDarkMixin, - { - borderColor: palette.themePrimary - }, - highContrastBorderState - ], _c['&:hover .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:focus .' + globalClassnames.caretDown] = [ - !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, - { - selectors: (_f = {}, _f[0, _styling.HighContrastSelector] = { - color: 'Highlight' - }, _f) - } - ], _c['&:active .' + globalClassnames.caretDown] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:hover .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:focus .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:active .' + globalClassnames.titleIsPlaceHolder] = !disabled && rootHoverFocusActiveSelectorNeutralPrimaryMixin, _c['&:hover .' + globalClassnames.titleHasError] = borderColorError, _c['&:active .' + globalClassnames.titleHasError] = borderColorError, _c) - }, - isOpen && 'is-open', - disabled && 'is-disabled', - required && 'is-required', - required && !hasLabel && { - selectors: (_g = { - ':before': { - content: "'*'", - color: semanticColors.errorText, - position: 'absolute', - top: -5, - right: -10 - } - }, _g[0, _styling.HighContrastSelector] = { - selectors: { - ':after': { - right: -14 - } - } - }, _g) - } - ], - title: [ - globalClassnames.title, - (0, _styling.normalize), - { - backgroundColor: semanticColors.inputBackground, - borderWidth: 1, - borderStyle: 'solid', - borderColor: semanticColors.inputBorder, - borderRadius: isOpen ? titleOpenBorderRadius : effects.roundedCorner2, - cursor: 'pointer', - display: 'block', - height: DROPDOWN_HEIGHT, - lineHeight: DROPDOWN_HEIGHT - 2, - padding: "0 28px 0 8px", - position: 'relative', - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis' - }, - isRenderingPlaceholder && [ - globalClassnames.titleIsPlaceHolder, - { - color: semanticColors.inputPlaceholderText - } - ], - hasError && [ - globalClassnames.titleHasError, - borderColorError - ], - disabled && { - backgroundColor: semanticColors.disabledBackground, - border: 'none', - color: semanticColors.disabledText, - cursor: 'default', - selectors: (_h = {}, _h[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - border: '1px solid GrayText', - color: 'GrayText', - backgroundColor: 'Window' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _h) - } - ], - caretDownWrapper: [ - globalClassnames.caretDownWrapper, - { - height: DROPDOWN_HEIGHT, - lineHeight: DROPDOWN_HEIGHT - 2, - paddingTop: 1, - position: 'absolute', - right: 8, - top: 0 - }, - !disabled && { - cursor: 'pointer' - } - ], - caretDown: [ - globalClassnames.caretDown, - { - color: palette.neutralSecondary, - fontSize: fonts.small.fontSize, - pointerEvents: 'none' - }, - disabled && { - color: semanticColors.disabledText, - selectors: (_j = {}, _j[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - color: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _j) - } - ], - errorMessage: (0, _tslib.__assign)((0, _tslib.__assign)({ - color: semanticColors.errorText - }, theme.fonts.small), { - paddingTop: 5 - }), - callout: [ - globalClassnames.callout, - { - boxShadow: effects.elevation8, - borderRadius: calloutOpenBorderRadius, - selectors: (_k = {}, _k['.ms-Callout-main'] = { - borderRadius: calloutOpenBorderRadius - }, _k) - }, - calloutClassName - ], - dropdownItemsWrapper: { - selectors: { - '&:focus': { - outline: 0 - } - } - }, - dropdownItems: [ - globalClassnames.dropdownItems, - { - display: 'block' - } - ], - dropdownItem: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - itemSelectors() - ], false), - dropdownItemSelected: dropdownItemSelected, - dropdownItemDisabled: dropdownItemDisabled, - dropdownItemSelectedAndDisabled: [ - dropdownItemSelected, - dropdownItemDisabled, - { - backgroundColor: 'transparent' - } - ], - dropdownItemHidden: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownItemStyle, true), [ - { - display: 'none' - } - ], false), - dropdownDivider: [ - globalClassnames.dropdownDivider, - { - height: 1, - backgroundColor: semanticColors.bodyDivider - } - ], - dropdownDividerHidden: [ - globalClassnames.dropdownDivider, - { - display: 'none' - } - ], - dropdownOptionText: [ - globalClassnames.dropdownOptionText, - { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - minWidth: 0, - maxWidth: '100%', - wordWrap: 'break-word', - overflowWrap: 'break-word', - margin: '1px' - } - ], - dropdownItemHeader: dropdownHeaderStyle, - dropdownItemHeaderHidden: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([], dropdownHeaderStyle, true), [ - { - display: 'none' - } - ], false), - subComponentStyles: { - label: { - root: { - display: 'inline-block' - } - }, - multiSelectItem: { - root: { - padding: 0 - }, - label: { - alignSelf: 'stretch', - padding: '0 8px', - width: '100%' - }, - input: { - selectors: (_l = {}, // eslint-disable-next-line @fluentui/max-len - _l[".".concat((0, _utilities.IsFocusVisibleClassName), " &:focus + label::before, :host(.").concat((0, _utilities.IsFocusVisibleClassName), ") &:focus + label::before")] = { - outlineOffset: '0px' - }, _l) - } - }, - panel: { - root: [ - panelClassName - ], - main: { - selectors: (_m = {}, // In case of extra small screen sizes - _m[MinimumScreenSelector] = { - // panelWidth xs - width: 272 - }, _m) - }, - contentInner: { - padding: '0 0 20px' - } - } + } + this.marshall().clear(); + if (initonly) argops.initonly = true; + return deps; + }, + /** + * Internal method for marshalling parameter values. + * Visits each operator dependency to pull the latest value. + * @return {Parameters} A Parameters object to pass to the update function. + */ + marshall(stamp) { + const argval = this._argval || NO_PARAMS, argops = this._argops; + let item, i, op, mod; + if (argops) { + const n = argops.length; + for (i = 0; i < n; ++i) { + item = argops[i]; + op = item.op; + mod = op.modified() && op.stamp === stamp; + argval.set(item.name, item.index, op.value, mod); + } + if (argops.initonly) { + for (i = 0; i < n; ++i) { + item = argops[i]; + item.op.targets().remove(this); + } + this._argops = null; + this._update = null; + } + } + return argval; + }, + /** + * Detach this operator from the dataflow. + * Unregisters listeners on upstream dependencies. + */ + detach() { + const argops = this._argops; + let i, n, item, op; + if (argops) { + for (i = 0, n = argops.length; i < n; ++i) { + item = argops[i]; + op = item.op; + if (op._targets) { + op._targets.remove(this); + } + } + } + this.pulse = null; + this.source = null; + }, + /** + * Delegate method to perform operator processing. + * Subclasses can override this method to perform custom processing. + * By default, it marshalls parameters and calls the update function + * if that function is defined. If the update function does not + * change the operator value then StopPropagation is returned. + * If no update function is defined, this method does nothing. + * @param {Pulse} pulse - the current dataflow pulse. + * @return The output pulse or StopPropagation. A falsy return value + * (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const update2 = this._update; + if (update2) { + const params2 = this.marshall(pulse2.stamp), v = update2.call(this, params2, pulse2); + params2.clear(); + if (v !== this.value) { + this.value = v; + } else if (!this.modified()) { + return pulse2.StopPropagation; + } + } + }, + /** + * Run this operator for the current pulse. If this operator has already + * been run at (or after) the pulse timestamp, returns StopPropagation. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + rv = 0; + } else { + rv = this.evaluate(pulse2); + } + return this.pulse = rv || pulse2; + } + }; + function add$3(init2, update2, params2, react) { + let shift = 1, op; + if (init2 instanceof Operator) { + op = init2; + } else if (init2 && init2.prototype instanceof Operator) { + op = new init2(); + } else if (isFunction(init2)) { + op = new Operator(null, init2); + } else { + shift = 0; + op = new Operator(init2, update2); + } + this.rank(op); + if (shift) { + react = params2; + params2 = update2; + } + if (params2) this.connect(op, op.parameters(params2, react)); + this.touch(op); + return op; + } + function connect(target2, sources) { + const targetRank = target2.rank, n = sources.length; + for (let i = 0; i < n; ++i) { + if (targetRank < sources[i].rank) { + this.rerank(target2); + return; + } + } + } + let STREAM_ID = 0; + function EventStream(filter2, apply2, receive) { + this.id = ++STREAM_ID; + this.value = null; + if (receive) this.receive = receive; + if (filter2) this._filter = filter2; + if (apply2) this._apply = apply2; + } + function stream(filter2, apply2, receive) { + return new EventStream(filter2, apply2, receive); + } + EventStream.prototype = { + _filter: truthy, + _apply: identity$2, + targets() { + return this._targets || (this._targets = UniqueList(id)); + }, + consume(_) { + if (!arguments.length) return !!this._consume; + this._consume = !!_; + return this; + }, + receive(evt) { + if (this._filter(evt)) { + const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; + for (let i = 0; i < n; ++i) trg[i].receive(val); + if (this._consume) { + evt.preventDefault(); + evt.stopPropagation(); } + } + }, + filter(filter2) { + const s2 = stream(filter2); + this.targets().add(s2); + return s2; + }, + apply(apply2) { + const s2 = stream(null, apply2); + this.targets().add(s2); + return s2; + }, + merge() { + const s2 = stream(); + this.targets().add(s2); + for (let i = 0, n = arguments.length; i < n; ++i) { + arguments[i].targets().add(s2); + } + return s2; + }, + throttle(pause) { + let t = -1; + return this.filter(() => { + const now2 = Date.now(); + if (now2 - t > pause) { + t = now2; + return 1; + } else { + return 0; + } + }); + }, + debounce(delay) { + const s2 = stream(); + this.targets().add(stream(null, null, debounce(delay, (e) => { + const df = e.dataflow; + s2.receive(e); + if (df && df.run) df.run(); + }))); + return s2; + }, + between(a2, b2) { + let active = false; + a2.targets().add(stream(null, null, () => active = true)); + b2.targets().add(stream(null, null, () => active = false)); + return this.filter(() => active); + }, + detach() { + this._filter = truthy; + this._targets = null; + } + }; + function events$1(source2, type2, filter2, apply2) { + const df = this, s2 = stream(filter2, apply2), send = function(e) { + e.dataflow = df; + try { + s2.receive(e); + } catch (error2) { + df.error(error2); + } finally { + df.run(); + } }; -}; - -},{"tslib":"9gizs","../../Utilities":"1NZCy","../../Positioning":"bWPOk","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1pQ7X":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializeIcons", ()=>initializeIcons); -parcelHelpers.export(exports, "use", ()=>use); -var _fabricIcons = require("./fabric-icons"); -let registerIcons; -let unregisterIcons; -function initializeIcons() { - [ - (0, _fabricIcons.initializeIcons) - ].forEach((initialize)=>{ - const subset = initialize(); - unregisterIcons && unregisterIcons(Object.keys(subset.icons)); - registerIcons(subset, { - disableWarnings: true - }); - }); -} -function use(_registerIcons, _unregisterIcons) { - registerIcons = _registerIcons; - unregisterIcons = _unregisterIcons; -} - -},{"./fabric-icons":"6P3kt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6P3kt":[function(require,module,exports,__globalThis) { -// Your use of the content in the files referenced here is subject to the terms of the license at https://aka.ms/fabric-assets-license -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializeIcons", ()=>initializeIcons); -var _fabricIcons4Ac17Eec = require("./fabric_icons_4ac17eec"); -function initializeIcons() { - const subset = { - style: { - MozOsxFontSmoothing: 'grayscale', - WebkitFontSmoothing: 'antialiased', - fontStyle: 'normal', - fontWeight: 'normal', - speak: 'none' - }, - fontFace: { - fontFamily: '"FabricMDL2Icons"', - src: `url("${(0, _fabricIcons4Ac17Eec.fabricIconsWoff)}") format("woff")` - }, - icons: { - Accept: '\uE8FB', - Add: '\uE710', - BIDashboard: '\uF543', - Camera: '\uE722', - Cancel: '\uE711', - ChevronDown: '\uE70D', - ChevronLeftMed: '\uE973', - ChevronRightMed: '\uE974', - Clear: '\uE894', - ClearFilter: '\uEF8F', - ClearNight: '\uE9C2', - CloudDownload: '\uEBD3', - Color: '\uE790', - Copy: '\uE8C8', - CubeShape: '\uF1AA', - Delete: '\uE74D', - Diamond: '\uED02', - DiamondSolid: '\uF34C', - DoubleChevronLeft12: '\uEE98', - DoubleChevronRight12: '\uEE99', - Download: '\uE896', - Edit: '\uE70F', - Filter: '\uE71C', - Filters: '\uE795', - FiltersSolid: '\uF353', - Flow: '\uEF90', - History: '\uE81C', - HourGlass: '\uEA03', - More: '\uE712', - Next: '\uE893', - OpenInNewWindow: '\uE8A7', - Page: '\uE7C3', - Pause: '\uE769', - Photo2Add: '\uECAB', - Photo2Remove: '\uECAC', - PicturePosition: '\uF524', - Pin: '\uE718', - Pinned: '\uE840', - PlayResume: '\uF2C6', - PlayReverseResume: '\uF3E4', - Previous: '\uE892', - RadioBtnOff: '\uECCA', - RadioBtnOn: '\uECCB', - RadioBullet: '\uE915', - Redo: '\uE7A6', - RemoveFilter: '\uEB08', - ScaleVolume: '\uF18C', - Search: '\uE721', - Settings: '\uE713', - SortDown: '\uEE69', - SortUp: '\uEE68', - Sunny: '\uE9BD', - Table: '\uED86', - Undo: '\uE7A7' + let sources; + if (typeof source2 === "string" && typeof document !== "undefined") { + sources = document.querySelectorAll(source2); + } else { + sources = array$4(source2); + } + const n = sources.length; + for (let i = 0; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + return s2; + } + function parse$5(data2, format2) { + const locale2 = this.locale(); + return read(data2, format2, locale2.timeParse, locale2.utcParse); + } + function ingest(target2, data2, format2) { + data2 = this.parse(data2, format2); + return this.pulse(target2, this.changeset().insert(data2)); + } + async function request(url, format2) { + const df = this; + let status = 0, data2; + try { + data2 = await df.loader().load(url, { + context: "dataflow", + response: responseType(format2 && format2.type) + }); + try { + data2 = df.parse(data2, format2); + } catch (err) { + status = -2; + df.warn("Data ingestion failed", url, err); + } + } catch (err) { + status = -1; + df.warn("Loading failed", url, err); + } + return { + data: data2, + status + }; + } + async function preload(target2, url, format2) { + const df = this, pending = df._pending || loadPending(df); + pending.requests += 1; + const res = await df.request(url, format2); + df.pulse(target2, df.changeset().remove(truthy).insert(res.data || [])); + pending.done(); + return res; + } + function loadPending(df) { + let accept; + const pending = new Promise((a2) => accept = a2); + pending.requests = 0; + pending.done = () => { + if (--pending.requests === 0) { + df._pending = null; + accept(df); + } + }; + return df._pending = pending; + } + const SKIP$2 = { + skip: true + }; + function on(source2, target2, update2, params2, options2) { + const fn2 = source2 instanceof Operator ? onOperator : onStream; + fn2(this, source2, target2, update2, params2, options2); + return this; + } + function onStream(df, stream2, target2, update2, params2, options2) { + const opt = extend({}, options2, SKIP$2); + let func, op; + if (!isFunction(target2)) target2 = constant$4(target2); + if (update2 === void 0) { + func = (e) => df.touch(target2(e)); + } else if (isFunction(update2)) { + op = new Operator(null, update2, params2, false); + func = (e) => { + op.evaluate(e); + const t = target2(e), v = op.value; + isChangeSet(v) ? df.pulse(t, v, options2) : df.update(t, v, opt); + }; + } else { + func = (e) => df.update(target2(e), update2, opt); + } + stream2.apply(func); + } + function onOperator(df, source2, target2, update2, params2, options2) { + if (update2 === void 0) { + source2.targets().add(target2); + } else { + const opt = options2 || {}, op = new Operator(null, updater(target2, update2), params2, false); + op.modified(opt.force); + op.rank = source2.rank; + source2.targets().add(op); + if (target2) { + op.skip(true); + op.value = target2.value; + op.targets().add(target2); + df.connect(target2, [op]); + } + } + } + function updater(target2, update2) { + update2 = isFunction(update2) ? update2 : constant$4(update2); + return target2 ? function(_, pulse2) { + const value2 = update2(_, pulse2); + if (!target2.skip()) { + target2.skip(value2 !== this.value).value = value2; + } + return value2; + } : update2; + } + function rank(op) { + op.rank = ++this._rank; + } + function rerank(op) { + const queue = [op]; + let cur, list, i; + while (queue.length) { + this.rank(cur = queue.pop()); + if (list = cur._targets) { + for (i = list.length; --i >= 0; ) { + queue.push(cur = list[i]); + if (cur === op) error("Cycle detected in dataflow graph."); } - }; - return subset; -} - -},{"./fabric_icons_4ac17eec":"f8QKu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8QKu":[function(require,module,exports,__globalThis) { -// Auto-generated font data - do not edit manually -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fabricIconsWoff", ()=>fabricIconsWoff); -const fabricIconsWoff = 'data:font/woff;base64,d09GRgABAAAAABuQAA4AAAAAMIgABKj2AAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABRAAAAEgAAABgMVN8b2NtYXAAAAGMAAABEAAAArIn/BeDY3Z0IAAAApwAAAAgAAAAKgnZCa9mcGdtAAACvAAAAPAAAAFZ/J7mjmdhc3AAAAOsAAAADAAAAAwACAAbZ2x5ZgAAA7gAABITAAAepM100RhoZWFkAAAVzAAAADIAAAA2BVACQGhoZWEAABYAAAAAFQAAACQQAQgDaG10eAAAFhgAAABQAAAAchoOED5sb2NhAAAWaAAAAHAAAABw0ZDZvG1heHAAABbYAAAAHQAAACAAWQIibmFtZQAAFvgAAAP3AAAJ+pKX8lVwb3N0AAAa8AAAABQAAAAg/1EArnByZXAAABsEAAAAiQAAANN4vfIOeJxjYGH/xDiBgZWBgXUWqzEDA6M0hGa+yJDGJMTBysrFyMQIBgxAIMCAAL7BCgoMDs95vzpzgPkQkgGsjgXCU2BgAAD3EghqeJxjYGBgZoBgGQZGIMnAuAbIYwTzWRgnAOkEBgcGVgaF57zP+Z8LPhd6Lvxc4rnMc6Xnvs8zn094PvX5sufLnx9+IfPC4cWUF9NeLH9x4sXvl6IvS17ufXnoFfNrjteX36x+s+bNqTen3zK9bXuX+W7m+/73Ez72fFz16dhnn8/Bn598Vfnq/P8/AwPYBgG4DYpYbJiEZEMxDhsy3s3AboPEF4nfEp8kvkp8lHgr8QoID0jMl6iTqJLIkciU8BN/K35ZvEm8UbxQPFBcXpxNbKVYolismJyohIi/cKVwuXCMcJSwqtAiwYOCkwXmC8zlW8zXxpvN85znPk8AtyDXZ0jo0RYwstHejsEOAFLcpEl4nGPQYghlKGBoYFjFyMDYwOzAeIDBAYsIEAAAqhwHlXicXY+/TsNADMZzJLSEJ0A6IZ11KkOViJ3phksk1CUlDOelgNRKpO+AlIXFA8/ibhnzYgjMEf4utr/P+ny/c6f5yXx2nKVHKilWnDfhoNQLDurtmf35IU/vNmVhTNV5VvdlwWoJomtOF/VNsGjI0PWWTG0eH7acLWKXxY7w0nDShk7qbQB2qL/HHeJVPJLFI4QS30/xfYxL+rUsVobTiyasA/des/OoAUzFYxN49BoQf8ikP3VnE+NsOWXbwE5zgkSfygL3RJqE+0uPf/Wgkv+G+23Iv6tB9U3c9Bb0h2HBgrChl2fbUAkaYPkOhPxkxgABAAIACAAK//8AD3icnVh7cFRVmj/ffaYREm46SedFwk2nuwkhCelOp8E86EQSeSwkBgapboMwCktQMrqKGEDngKPgBHFMZtx1YLWUCZY7o7vrc2uYXdupLXGmZsQdtsbaSu38oQKzs+Jzq5TOvSf7nXNvd5rglu509+3zuOfxnfO9ft9HJHKKEOV76j1EJjohMcM0AqZhnpL/YL0qvWqvIeo96e//UFlP8APECxf0S1oDUbHh80AM9PGE5bW8CXlca8CafClh7cZx+MnDL7kGxxWbht8wo6YRMfKIFadWXE5RxS3llBXH8Z+Tz/V5+jw+3gO6B0K4tgd8SlJ6MWGvs9clpBft9QnpJemlhEKuaNrrcQhupxCNaHpaT5MYuYscJsdx56KS4iKtWJUDmu5V5RrNXxP0ywFvMIRdLcFoS2s04FVbY9gVbo2ESyI4qMQX8EInRFuCoVhIbYSQN6Q3gr9G00O6Nx/0gO7Lh+KiEp/uC1SBT/bFqiASbo35YnInxNQYhKuk4qJ8yV/TKEVbOiVvuBPLRmznY3+VpH0BAPJT7N3S8pXs4NOeQg/+nmYHV5aXsnefAhmA2U9BHb6F72bewnfxLdQ9xY5IiiJ9uIl9Wt0VXPHOD31LfaVNpePvrAjGF7JPN33ovIWCq99CwSZrbP3DO9radjy8PlPGtq6qq1u1NeaWSu3/jxg79yDsP3Ev3DG73YdXkpr79ipSpV25ZPHSpjmEiZJIBH95RKOkkoSRtwYyM2Tmy/VgmKEYChdevM/shIieL+tmCDlndMIKMKtkXx6Jrz/UxAorNw6NdMVtSqlE410jQxsr4aOmQ+vjpTUVvrn2XQWV9w8M3F9ZID0y11dRU6oRi17X0XZzd61E4nGJ1Hbf3NZx3Whe6YLaovq+YcM6Zgz31RfVLijN4+KO9BGaR3SKWlTApR7pMiCqmk4lj9iE4aPTy6howJWNTtrEmpQDMpmkAZvYAWlSJviCylSnCiVeEiJtuNIsiTK/pg2kotFfVORvrHBLueLrOhSa0/hGJZ5XokBUqhPHbkDE8CNPDAlvF4+gkzTqI38yd+PYA5X0cN6BDoaKyqlr/OuvCQXxiyyLVUlKJNypoMYoXGN0s5ibDdSs1lhrbSTsK/GVKAR2J9huZWl///pjx15LnX3hmScfODTY1FOyf9GzH0DJ4/vPn/nJnnh8z0/OnN9/6H/OPReDOkaosahky/3fg8aTZ1OvHTumEXuSjSVgTEremTorutb3L49t3/5wz+M31Dz22Qtb+fwPDjhrrX7on++mEmEfLexYcF9yy7f5xkTYnMy58kkRqSD13OZoOqjchHCBBDQRHinQKIegU86YAT2PhJemJ+3DT6qBpQe6e/Ylo5d7dz3hV5azyamlsHpOQ3ygUWVljbXF5vK19cHlzUvKtH/sPoBznpRGcE44mtw3dY//iV3KtRBIXzPQOBBvmCO/V7akeXmwfu1ys7i2sSznzv1oEbkUKSglCtca4IYw2hKDRrRzncpsE6XGt7184uBN4fBNB0+8vO2+81utj73l5UGvPL9vo9O393cnkskTv9vrlnge0e1M29hnfeINlpd7ZWPr+fucvimSM1yUwoOQrL5wGq/jkoGuJ2b6VDNk6lj9OmsKYW7hxWla88iXRApQ6VUKEyxA7VcpC+iow7tOj/b3j57elSn7ju7s6Nh5tM8t7UfLg0htMOiILOWfKaLQ3Cm8tGjOJFHKVMzDh181TiV4FLzvajxNA2kmUbIcT+Q3OP0mP4Dhj5r8FBGusgugToqaYBpFJdhGT+Q3IuA+OqFVLb2LLLKot6UKBY9rHVCudxKxCFCGKjaFuyukPGgjyeA+Gk3H+RQ+WU1RmtFYSqdJOs5pTSm4gPMQTm5GRprJLWQvGSVPkZfIGS4tSpVUWFwk5UuKe/eKe+9uu7BTqvXOaKrCucE1N+JwTHG4M8syzW67pTsHuXvle3lWWyGPgPbB6QdXr37w9Acs/Uh0sKfOW1lT6a3r2dISbIu2tK9Zyvv4a1CP5doBp87vAsdF2taE+4/ubBdzsY/NNnFwfFaHNHvE9lnt87PaecSl8RGW5hTX9QxGm1e3t0Tbgi1bslQPRt0DfUlzyXTqfCUxrn3n0f7mtW0RnMv7VDLbGMNVPewqgz79DcYQGTIyXE/ayVrH9ywAoW2OGBsZdhiORHPuQZRbaYf/2AUtrTFETKaYZGpCIGsMs8Lg20yjSA9Go4O9i6aFm+ItmXKZzh6GtoXzSudZcd5QkBYuzHFlXlmJlRJkEz6bz3P0Qqa8PYVaa2flXaJyPLaldI6HN2xKAAGpV7PwXMGMJUQrHRI4z7XJrqNRlfjWF0/Qm8JD26zTCXll36bkiXf23D5x9OD1MIHIAT3E0N5R3QrfRE+8uPXh6W3WLxJyT9/ZO/a8cyLZdduRVQgtWHLZ0OC6WLXw5e59KljMc+2b1/SI0tDJZaokAxBgk6jTaKrUyXQgD2ECBC4nVbTglznmBoV4xRqcdrNRdmxfiQ99qGO/UX0UHxJvKmj5rj94dOJ2TsymPnllwjq9bcghdePo3qHtty7DS9LIqiO3dfFj3XG2Txxy2/TDzqGrY+sGh5bxg7o+W39Tf5PUkm7cOR83DqE/4wqJAF1HeB7jTs4HQa6bCHxjoAm6OIl4vc7l8in6m+aK6/rCNdXswXlzy5t7l7D77beONEjL2f0Nva/cMrAW9mvFwZgJx2LNzCifl8eKypYsaapYfluj9PTCGn1e4Rz47/JmtciMBYs19mCwf1HXri3fWgKH7DMNR6RlcKihd00Z7K+uae5bucK028rh4+ZYZXM5K55TOFc3F9o3N962rKKpYUkZfJiHbJABfY9OBHbRiIfzJWIgU0IGSgqFOAYndhUIACPjN02+UArtL75qHqIek88EDQUwjVGNFZfeczyJTSTP1EeSx4mbkIeX9EtXxzfyGAZM1u6EPGYNYxAlj2N8c0XTGsYhHEPBBnQyDXl877mEBFDpvDwAQ8oBEC422OP2eALOUTiHnkA+Zx+T/irBFqvPpW+E3zsYDBBX6tzgF3JJQm+EKuA3eMQnnK2GAyhbloS3JuhlqhJUS47vGJ0QnSj9NvpFalGUZi7XiHZxrWuIQXyuZKPDjngjoQB3a+LBhdGZMiIncenAxIRFpcA0sZOcYIayqBBlcioA6LgYficmgaRRgQBvUsSaAYw1L3EM6dwWSBSPKHlVbyI9DgFpOGF/pBYm0mMiNpVwpopfvOurMLNC+o4OtbcPHe3rH+XlqEpzGv38pVgDDpMy9aJ+ke8Z8PAIV1eHrTL54og1Jg+PYEVUrbER3K+MlGkj7liHn9LYiDyML+WLVlkZVnGKVWaVkTk8NhD3xTF9PWkiEcQ7bWQFYp7rr6Z2NsrxIiSQOb4uNjGeiJpe3EvSwRvCK/FBSE4NntzX27vv5GCm7L77xkjkxru7u/fcGA7fuOeQADUKcnIKbxnofvZpAubLTVCQYJ8kkzA/MfWXSfZJQiO5i/DSJji9O3c5mXMHV1IEUoLFOJl9av0bzoYCuSmJS1qVSVwf5U3lMqJ/iXgI8ac3XNspFUZbpFCVmsEVtYj4qwAcFCGFSpx+vUSh6BbfP/3Q6pVd9E9vPXNX5+qHTr+PvvT7LH0xtbK6Q64+cP7MyT3x/sfeRgNy6J/eY5cfo9AjET4OtEceBHLX/MTR1979/CC6X77QqsNv3KsoDL3syTPnDxyZ/o+/ixx/Zox9/PnZv91u0COc99xWc/2gIp5BGfKi9AZ46ObqKsoCKhDaZERZPASBMTacgHEYT7BhGMOIhId2lNsM8F7Rz/hYvA++Pse7UcRaIk7AQNXJJWCMioY1guyNoPPslGNOAgLDBrTwCBqLuU/FIAhjCBPlAQfz8XwFwEWKTX57eJeNaIU62qtXrtvUHKivDzRvWreyur0DdRl7F65cuylcu2SmV0Nt3rRqQWv5tckV5hQ1VySvLW9dsGpTtk+Z6dPJrl9tbljT0eIz2hYvbjN8LR1rGjb/ahel2N+0uj1carRf2W+TgXv9+RXeRUMjh3t7D48MLfJW5PvvHfjKXuFrdojYfhW5Ae+mSubqUA/RSFYTNN3xfHowoxVtUOzPAkhfpyzirRhPSqEz1AY3P3Fn1/UjJwfjcVcLugv9xpz19/zNxt5DuzeWrd2QUX48xM9Hb7hh9Oe7GpsW7TpwdHXyuUdvZ13IvnPsXGKcKtPampEnNw+eHLmeCm3A5RRl46ND7Yv/4rZuf8aOUL4CX8nT8e2ewLLtxywNmX8OGhJj0oQbKz6g2zrPifmEDSDI1UgmgAGfHtJDsVDMF/OpukAHIfzjih7SIWKCbqjZeAN+/H7i/czPfrkr/QOdxONpkpLQbMJ1yT+egq4fsVfsipSacqMbqzxnyvtxlVrzu7rkO1jydYQbhP1L8r9OsZR04Q170qWV5zIcWuswmrmS1pyMnoc3RJPTWuxHLTHMGUoljDzwh17V+jHsmMIlaYbMVJIdt0lKnpihMeEMBYJFnB1PIpUY6WRo7ErCDiCcQjkbt1SgbdkwO16pbZS+OkLBUDcTBTcqHDrNjihctP5/BhBOUmDwp4/v27x06eZ9j/90MKc+G/O7q1wB8TMZhdxFtYVXLeXWr8ydVDhx/Dc76Z91sj/3BDmxJNq3ElJOqoiJuDHkZER0nnAIgUg5IGQ0wwgSS8CUEQebXo/Ci5AJ/jxSYMULq6sLrXiBB2helaFQoyoPqMf6Efv9b6RfWg+w38Ktv7H/KO1mf4AP4Rb7WqkB668A3Mp+ayspX+EU9fkUWugrLJBovmHk27RAamR4ifyxqV0i/cm6U36Ul1TcLEo4zWI6HVsFaPt9eNc8ihf0cz/A0U3UFXMMasok08h8IfOgPqBRvSzwC6PC0WKc7j7gPhxSpUV2TCYzsk5cJbGzTfHQ3H8q8Mk5QtTn9bTAnjrIfi/3TurzCfYCjmM/S8AluKTNS8ANX1q6LtqMwyH4d6Kpf6/bYp7I28sRL6gbk8zLCpMwgJNhg7QuwbxwCdfSpS9tDjclEiZlOsdDqkCuHPirAr8qY9Zj8ndGODSS3xbYiFf1YYGNZlASrwkZRqykvz2zDhIdECCYD7AQKn3Hesyudaq4hn6Rw6YZACVqwkc7OSPicokIjOkHv+BEBCIZZqjIBZvey1acsbF2L7xxxsLL51hWF5ds4XVz0yQjInLYxP+FXZnJ4VZw3jvZW462xbo+PWunyVUp3UDywoXk+fPiPye72xpws7uTmZf472RGhV7nIYIuz0gbmDw36jfqJPxDfG4iwnNiU/FETYgF3EOiUE/CQII9j5KscHzBnk/AAJucOsfFIcA43KA8mGQvJKwNMh5cQlrdQRJx38CG9PPOGrganwQbEnww3g/XGYH1S1E/diLvPBjDGhzr84in2KOIEsNYK2Wl5Lj9qHSndGf6LL96lT9npj5jN8PTSj48/QP2FnsLllk72etyM3RZZ+Vm9rp1lvOUC7gevzKmwnUxuEGhp2pqKkWl9+wqR2dsHpR9IXlEWIUxUSa+Lhf+1Cz+qiRFbhLDdDIW1EmizM5GKKlssmJKvMLDf1XOQaHZpISdkkQCAumqJK36By5+nEPySTH2oAQhPzEschjpkUxuAbHBjWANfAbPavAzuxPIL1mH9K/syR54Fj6zdrNfTxOmw260gVot01H/v4WWUKFTZwzl13i/xNr7D8ryqVf1NcjUbfkGl3IjH3dOYdRKc+NaP+eR7OHxaTol4tqZ+JRHtqrH/oKHtiQvK4+yyFWUoQUMoEQ2O1qG0blehnYjYsgi2+qAAa7CesgrQBeganhkrhqSyDBiqMeOp1JSRSDj39nBJA+gkxMTyWm0ackJO3nqVHJaxNTYxLrG58GON6QkOn37AreRWSQRSIIYlZ4vpiRPyZ/gQiBM5bRYlGdY3Lh0ti2/i3yXjJK/Jifd06CMqbPKTH+gJBuLtUMslA/cd5XkxmfZpIdIXFbiwXMSIZFsMBeCcCvCeMSuiPFB/EdEzxX9OXVJpHZ5WEXdylSmomYq7JKXyx6XU/hFeW9gcd00yfbwcnEdkNlDYPaQ9AaXJZp7u8GpC25FyvSgtFE0jAjBULhQnZECGX0XRu7jdYszS2lztS3lld5pMtPFSy+Qq8bA7DH27gxvZzLpLFub4Tz5X7oQ0KMAeJxjYGRgYGBZ8W1igahBPL/NVwZuDgYQ2P/3YAOIvmfgdQZEczCAxTkZmEAUAE1pCdgAAHicY2BkYOBgAAE4yciACpgAAsoAHQAAAHicY9ViWMbBwCDMwMDwmYGNAQQamBoYYADIYmxgBNKMLEAWEDIIMwaDxYWZGhjbmSSBbFYgD6EDrIvxMuMVBiMGSTgfCBlkGA6AOACflgxrAAAAFgAqAEIAZAFUAaQByAIcAjICngLsAzwDpAP+BQYFcgWuBdAGDAZ6BpYGsgbUBvQHGgdMB2QHhgecB7IILAiECLQJQgm0CgoKWgrQCyQLgAvWC/IMDgwyDFYMhgy8DRANQA1eDaQN5g4EDmYPUnicY2BkYGAwZzjBwMsAAoxgkguEGSNBTAAdRwF9AAAAeJy1VD+LHDcUf3u79l1wfARDwKWKEM7HMmtfzJnY1WHHla85mwM3Ae2MdkZ4diQkjYcxLlK6yMdIY8inCAmkTJ1PkDpVyrz3pNnb827MJZAdRvPT0/v7e08LALdHX8II4u8rfCMewS3cRbwDu/BNwmOUP0t4gvjbhK/Bp2ATvg6fwduEd+Fr+D7hPfgcfkn4BhzC7wnfHP08miS8D4c7v2KU0eQT3BU7fyY8gi/G5wnvwP74TcJjlL9LeIL4x4Svwe3xbwlfBzH+I+FdcJO9hPfgcDL4uQEvJj8kfHP8bvJXwvvwYu+7n96Lo7v3HohTnTvjzSKIx8ZZ42TQpsnESV2LM11WwYsz5ZV7rYrsqZw7nYvTJ8+OxIn3KvgzVba1dJsHm5Jz5Tx6Fvez4+N4Sofx7LkqjRLaCymCk4VaSvdKmIUIlVrLr3SmtSTOzdLKRiufbU2+CsE+nM26rsuWw3mGNrPQW1M6aat+tjBN8LMLc99aW2tVCDrIxEvTiqXsResVJoGJkVgEI3KnZFBTUWhva9lPhWwKYZ3G0xxVFH6lF1a5pQ4B3c17LqLWuWrIFx54YdwAFhRhulmqdaZo8zAVxDzaTslmCKAb0VU6r9Yy6zCobvK6LbBNq+xNU/fiQN8RajnHXC7U0cPHsmX1QjelcMoH7BSxehGAzFe+HjEDBxqjBLWkFjiNUQvTNbWRxWX2ZKRKOSrHYChc22DbIApFZZJOpWp7mVEcxqZP6tQQdIj8VHquMefs6t2G9yDgCO7CPXiA6BQ05ODAgMd3AQFljxE5vPO0SpRoRA1keHICNT4CzlBWQoVnnncKvwq1X+NaoOZTtJvjnnxTjCf4z3LE9p41yY6sSmjRn0TNq1hcReec8/ApZwH3MZtjfNZtB8t1u+ecjcFVoA5VJfENzECB0iVn+QplxBKdVKy7jb+S9y0yOGjn+F3iXmJOmtnK/gXzxHNA6UOY4dPxk6G/D+2zFGeGuGcvJfux6KFH6YK9UbWzrdE952yxI5r7KFYW1PuXXJNgJnr8tsxdZCIyNmiTzHDVDjWoDgVT3BesZ7njPUuID4pjuTPRNk9eVNpL9m25r1Rz4DOymnMeQydqroishryihecuuA3JYlXD9Epdtbwv0CbH/ZT5ijMf405XcT6sQPMkdsxTjut2zrpUKWnnWE3Lc1ds5Z5sakYHqH8HvzSh88TLNu8xh//K7YX3gj2VKHM8xyHdqWFWt1UwRN/M69HaDFAlsZbA8YZbQP5jrQVKOq7c8K382OzJS1OluC8mrbGqiFu+WS1bUrZDNwc/pFnzTf7nGY3/jE3qzIX34YboxDLND+U7Z6Zjb/+Hu/03hsc4mgB4nGNgZgCD/34M5QyYwBwAKWEB/3ic28CgzbCJkZNJm3ETF4jcztWaG2qrysChvZ07NdhBTwbE4onwsNCQBLF4nc215YVBLD4dFRkRHhCLX05CmI8DxBLg4+FkZwGxBMEAxBLaMKEgwADIYtjOCDeaCW40M9xoFrjRrHCj2eQkoUazw43mgBvNCTd6kzAju/YGBgXX2kwJFwDEASgaAAAA'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e6BwJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Slider/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Slider/index":"6LlnL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6LlnL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _slider = require("./Slider"); -parcelHelpers.exportAll(_slider, exports); -var _sliderBase = require("./Slider.base"); -parcelHelpers.exportAll(_sliderBase, exports); -var _sliderTypes = require("./Slider.types"); -parcelHelpers.exportAll(_sliderTypes, exports); - -},{"./Slider":"hVh6b","./Slider.base":false,"./Slider.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hVh6b":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Slider", ()=>Slider); -var _utilities = require("@fluentui/utilities"); -var _sliderBase = require("./Slider.base"); -var _sliderStyles = require("./Slider.styles"); -var Slider = (0, _utilities.styled)((0, _sliderBase.SliderBase), (0, _sliderStyles.getStyles), undefined, { - scope: 'Slider' -}); - -},{"@fluentui/utilities":"55bj3","./Slider.base":"6pnLq","./Slider.styles":"7YHnV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6pnLq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SliderBase", ()=>SliderBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _label = require("../Label/Label"); -var _useSlider = require("./useSlider"); -var COMPONENT_NAME = 'SliderBase'; -var SliderBase = _react.forwardRef(function(props, ref) { - var slotProps = (0, _useSlider.useSlider)(props, ref); - return _react.createElement("div", (0, _tslib.__assign)({}, slotProps.root), slotProps && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.label)), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.container), props.ranged && (props.vertical ? slotProps.valueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.valueLabel)) : slotProps.lowerValueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.lowerValueLabel))), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.sliderBox), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.sliderLine), props.ranged && _react.createElement("span", (0, _tslib.__assign)({}, slotProps.lowerValueThumb)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.thumb)), slotProps.zeroTick && _react.createElement("span", (0, _tslib.__assign)({}, slotProps.zeroTick)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.bottomInactiveTrack)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.activeTrack)), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.topInactiveTrack)))), props.ranged && props.vertical ? slotProps.lowerValueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.lowerValueLabel)) : slotProps.valueLabel && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.valueLabel))), _react.createElement((0, _utilities.FocusRects), null)); -}); -SliderBase.displayName = COMPONENT_NAME; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../Label/Label":"4UD9B","./useSlider":"8W46H","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8W46H":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ONKEYDOWN_TIMEOUT_DURATION", ()=>ONKEYDOWN_TIMEOUT_DURATION); -parcelHelpers.export(exports, "useSlider", ()=>useSlider); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _dom = require("../../utilities/dom"); -var ONKEYDOWN_TIMEOUT_DURATION = 1000; -var getClassNames = (0, _utilities.classNamesFunction)(); -var getSlotStyleFn = function(sty) { - return function(value) { - var _a; - return _a = {}, _a[sty] = "".concat(value, "%"), _a; - }; -}; -var getPercent = function(value, sliderMin, sliderMax) { - return sliderMax === sliderMin ? 0 : (value - sliderMin) / (sliderMax - sliderMin) * 100; -}; -var useComponentRef = function(props, sliderBoxRef, value, range) { - _react.useImperativeHandle(props.componentRef, function() { - return { - get value () { - return value; - }, - get range () { - return range; - }, - focus: function() { - var _a; - (_a = sliderBoxRef.current) === null || _a === void 0 || _a.focus(); - } - }; - }, [ - range, - sliderBoxRef, - value - ]); -}; -var useSlider = function(props, ref) { - var _a = props.step, step = _a === void 0 ? 1 : _a, className = props.className, _b = props.disabled, disabled = _b === void 0 ? false : _b, label = props.label, _c = props.max, max = _c === void 0 ? 10 : _c, _d = props.min, min = _d === void 0 ? 0 : _d, _e = props.showValue, showValue = _e === void 0 ? true : _e, _f = props.buttonProps, buttonProps = _f === void 0 ? {} : _f, _g = props.vertical, vertical = _g === void 0 ? false : _g, snapToStep = props.snapToStep, valueFormat = props.valueFormat, styles = props.styles, theme = props.theme, originFromZero = props.originFromZero, ariaLabelledBy = props["aria-labelledby"], _h = props.ariaLabel, ariaLabel = _h === void 0 ? props['aria-label'] : _h, ranged = props.ranged, onChange = props.onChange, onChanged = props.onChanged; - var disposables = _react.useRef([]); - var _j = (0, _reactHooks.useSetTimeout)(), setTimeout = _j.setTimeout, clearTimeout = _j.clearTimeout; - var sliderLine = _react.useRef(null); - var win = (0, _dom.useWindowEx)(); - // Casting here is necessary because useControllableValue expects the event for the change callback - // to extend React.SyntheticEvent, when in fact for Slider, the event could be either a React event - // or a native browser event depending on the context. - var _k = (0, _reactHooks.useControllableValue)(props.value, props.defaultValue, function(ev, v) { - return onChange === null || onChange === void 0 ? void 0 : onChange(v, ranged ? [ - internalState.latestLowerValue, - v - ] : undefined, ev); - }), unclampedValue = _k[0], setValue = _k[1]; - var _l = (0, _reactHooks.useControllableValue)(props.lowerValue, props.defaultLowerValue, function(ev, lv) { - return onChange === null || onChange === void 0 ? void 0 : onChange(internalState.latestValue, [ - lv, - internalState.latestValue - ], ev); - }), unclampedLowerValue = _l[0], setLowerValue = _l[1]; - // Ensure that value is always a number and is clamped by min/max. - var value = Math.max(min, Math.min(max, unclampedValue || 0)); - var lowerValue = Math.max(min, Math.min(value, unclampedLowerValue || 0)); - var internalState = (0, _reactHooks.useConst)({ - onKeyDownTimer: -1, - isAdjustingLowerValue: false, - latestValue: value, - latestLowerValue: lowerValue - }); - // On each render, update this saved value used by callbacks. (This should be safe even if render - // is called multiple times, because an event handler or timeout callback will only run once.) - internalState.latestValue = value; - internalState.latestLowerValue = lowerValue; - var id = (0, _reactHooks.useId)('Slider', props.id || (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.id)); - var classNames = getClassNames(styles, { - className: className, - disabled: disabled, - vertical: vertical, - showTransitions: !snapToStep && !internalState.isBetweenSteps, - showValue: showValue, - ranged: ranged, - theme: theme + } + } + } + const StopPropagation = {}; + const ADD = 1 << 0, REM = 1 << 1, MOD$1 = 1 << 2, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD$1, ALL = ADD | REM | MOD$1, REFLOW = 1 << 3, SOURCE = 1 << 4, NO_SOURCE = 1 << 5, NO_FIELDS = 1 << 6; + function Pulse(dataflow, stamp, encode2) { + this.dataflow = dataflow; + this.stamp = stamp == null ? -1 : stamp; + this.add = []; + this.rem = []; + this.mod = []; + this.fields = null; + this.encode = encode2 || null; + } + function materialize(data2, filter2) { + const out = []; + visitArray(data2, filter2, (_) => out.push(_)); + return out; + } + function filter$1(pulse2, flags) { + const map2 = {}; + pulse2.visit(flags, (t) => { + map2[tupleid(t)] = 1; }); - var steps = (max - min) / step; - var clearOnKeyDownTimer = function() { - clearTimeout(internalState.onKeyDownTimer); - internalState.onKeyDownTimer = -1; - }; - var setOnKeyDownTimer = function(event) { - clearOnKeyDownTimer(); - if (onChanged) internalState.onKeyDownTimer = setTimeout(function() { - onChanged(event, internalState.latestValue, ranged ? [ - internalState.latestLowerValue, - internalState.latestValue - ] : undefined); - }, ONKEYDOWN_TIMEOUT_DURATION); - }; - var getAriaValueText = function(valueProps) { - var ariaValueText = props.ariaValueText; - if (valueProps !== undefined) return ariaValueText ? ariaValueText(valueProps) : valueProps.toString(); - return undefined; - }; + return (t) => map2[tupleid(t)] ? null : t; + } + function addFilter(a2, b2) { + return a2 ? (t, i) => a2(t, i) && b2(t, i) : b2; + } + Pulse.prototype = { /** - * Update `value` or `lowerValue`, including clamping between min/max and rounding to - * appropriate precision. - * @param newValue - New current value of the slider, possibly rounded to a whole step. - * @param newUnroundedValue - Like `newValue` but without the rounding to a step. If this is - * provided and not equal to `newValue`, `internalState.isBetweenSteps` will be set, which - * may cause thumb movement animations to be disabled. - */ var updateValue = function(ev, newValue, newUnroundedValue) { - newValue = Math.min(max, Math.max(min, newValue)); - newUnroundedValue = newUnroundedValue !== undefined ? Math.min(max, Math.max(min, newUnroundedValue)) : undefined; - var numDec = 0; - if (isFinite(step)) while(Math.round(step * Math.pow(10, numDec)) / Math.pow(10, numDec) !== step)numDec++; - // Make sure value has correct number of decimal places based on number of decimals in step - var roundedValue = parseFloat(newValue.toFixed(numDec)); - internalState.isBetweenSteps = newUnroundedValue !== undefined && newUnroundedValue !== roundedValue; - if (ranged) { - // decided which thumb value to change - if (internalState.isAdjustingLowerValue && (originFromZero ? roundedValue <= 0 : roundedValue <= internalState.latestValue)) setLowerValue(roundedValue, ev); - else if (!internalState.isAdjustingLowerValue && (originFromZero ? roundedValue >= 0 : roundedValue >= internalState.latestLowerValue)) setValue(roundedValue, ev); - } else setValue(roundedValue, ev); - }; - var onKeyDown = function(event) { - var newCurrentValue = internalState.isAdjustingLowerValue ? internalState.latestLowerValue : internalState.latestValue; - var diff = 0; - // eslint-disable-next-line deprecation/deprecation - switch(event.which){ - case (0, _utilities.getRTLSafeKeyCode)((0, _utilities.KeyCodes).left, props.theme): - case (0, _utilities.KeyCodes).down: - diff = -step; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - case (0, _utilities.getRTLSafeKeyCode)((0, _utilities.KeyCodes).right, props.theme): - case (0, _utilities.KeyCodes).up: - diff = step; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - case (0, _utilities.KeyCodes).home: - newCurrentValue = min; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - case (0, _utilities.KeyCodes).end: - newCurrentValue = max; - clearOnKeyDownTimer(); - setOnKeyDownTimer(event); - break; - default: - return; + * Sentinel value indicating pulse propagation should stop. + */ + StopPropagation, + /** + * Boolean flag indicating ADD (added) tuples. + */ + ADD, + /** + * Boolean flag indicating REM (removed) tuples. + */ + REM, + /** + * Boolean flag indicating MOD (modified) tuples. + */ + MOD: MOD$1, + /** + * Boolean flag indicating ADD (added) and REM (removed) tuples. + */ + ADD_REM, + /** + * Boolean flag indicating ADD (added) and MOD (modified) tuples. + */ + ADD_MOD, + /** + * Boolean flag indicating ADD, REM and MOD tuples. + */ + ALL, + /** + * Boolean flag indicating all tuples in a data source + * except for the ADD, REM and MOD tuples. + */ + REFLOW, + /** + * Boolean flag indicating a 'pass-through' to a + * backing data source, ignoring ADD, REM and MOD tuples. + */ + SOURCE, + /** + * Boolean flag indicating that source data should be + * suppressed when creating a forked pulse. + */ + NO_SOURCE, + /** + * Boolean flag indicating that field modifications should be + * suppressed when creating a forked pulse. + */ + NO_FIELDS, + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. + * @return {Pulse} - The forked pulse instance. + * @see init + */ + fork(flags) { + return new Pulse(this.dataflow).init(this, flags); + }, + /** + * Creates a copy of this pulse with new materialized array + * instances for the ADD, REM, MOD, and SOURCE arrays. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} - The cloned pulse instance. + * @see init + */ + clone() { + const p = this.fork(ALL); + p.add = p.add.slice(); + p.rem = p.rem.slice(); + p.mod = p.mod.slice(); + if (p.source) p.source = p.source.slice(); + return p.materialize(ALL | SOURCE); + }, + /** + * Returns a pulse that adds all tuples from a backing source. This is + * useful for cases where operators are added to a dataflow after an + * upstream data pipeline has already been processed, ensuring that + * new operators can observe all tuples within a stream. + * @return {Pulse} - A pulse instance with all source tuples included + * in the add array. If the current pulse already has all source + * tuples in its add array, it is returned directly. If the current + * pulse does not have a backing source, it is returned directly. + */ + addAll() { + let p = this; + const reuse = !p.source || p.add === p.rem || !p.rem.length && p.source.length === p.add.length; + if (reuse) { + return p; + } else { + p = new Pulse(this.dataflow).init(this); + p.add = p.source; + p.rem = []; + return p; + } + }, + /** + * Initialize this pulse based on the values of another pulse. This method + * is used internally by {@link fork} to initialize a new forked tuple. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {Pulse} src - The source pulse to copy from. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. By default, source data arrays are copied + * to the new pulse. Use the NO_SOURCE flag to enforce a null source. + * @return {Pulse} - Returns this Pulse instance. + */ + init(src, flags) { + const p = this; + p.stamp = src.stamp; + p.encode = src.encode; + if (src.fields && !(flags & NO_FIELDS)) { + p.fields = src.fields; + } + if (flags & ADD) { + p.addF = src.addF; + p.add = src.add; + } else { + p.addF = null; + p.add = []; + } + if (flags & REM) { + p.remF = src.remF; + p.rem = src.rem; + } else { + p.remF = null; + p.rem = []; + } + if (flags & MOD$1) { + p.modF = src.modF; + p.mod = src.mod; + } else { + p.modF = null; + p.mod = []; + } + if (flags & NO_SOURCE) { + p.srcF = null; + p.source = null; + } else { + p.srcF = src.srcF; + p.source = src.source; + if (src.cleans) p.cleans = src.cleans; + } + return p; + }, + /** + * Schedules a function to run after pulse propagation completes. + * @param {function} func - The function to run. + */ + runAfter(func) { + this.dataflow.runAfter(func); + }, + /** + * Indicates if tuples have been added, removed or modified. + * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. + * Defaults to ALL, returning true if any tuple type has changed. + * @return {boolean} - Returns true if one or more queried tuple types have + * changed, false otherwise. + */ + changed(flags) { + const f = flags || ALL; + return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD$1 && this.mod.length; + }, + /** + * Forces a "reflow" of tuple values, such that all tuples in the backing + * source are added to the MOD set, unless already present in the ADD set. + * @param {boolean} [fork=false] - If true, returns a forked copy of this + * pulse, and invokes reflow on that derived pulse. + * @return {Pulse} - The reflowed pulse instance. + */ + reflow(fork) { + if (fork) return this.fork(ALL).reflow(); + const len2 = this.add.length, src = this.source && this.source.length; + if (src && src !== len2) { + this.mod = this.source; + if (len2) this.filter(MOD$1, filter$1(this, ADD)); + } + return this; + }, + /** + * Get/set metadata to pulse requesting garbage collection + * to reclaim currently unused resources. + */ + clean(value2) { + if (arguments.length) { + this.cleans = !!value2; + return this; + } else { + return this.cleans; + } + }, + /** + * Marks one or more data field names as modified to assist dependency + * tracking and incremental processing by transform operators. + * @param {string|Array<string>} _ - The field(s) to mark as modified. + * @return {Pulse} - This pulse instance. + */ + modifies(_) { + const hash = this.fields || (this.fields = {}); + if (isArray(_)) { + _.forEach((f) => hash[f] = true); + } else { + hash[_] = true; + } + return this; + }, + /** + * Checks if one or more data fields have been modified during this pulse + * propagation timestamp. + * @param {string|Array<string>} _ - The field(s) to check for modified. + * @param {boolean} nomod - If true, will check the modified flag even if + * no mod tuples exist. If false (default), mod tuples must be present. + * @return {boolean} - Returns true if any of the provided fields has been + * marked as modified, false otherwise. + */ + modified(_, nomod) { + const fields = this.fields; + return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some((f) => fields[f]) : fields[_]; + }, + /** + * Adds a filter function to one more tuple sets. Filters are applied to + * backing tuple arrays, to determine the actual set of tuples considered + * added, removed or modified. They can be used to delay materialization of + * a tuple set in order to avoid expensive array copies. In addition, the + * filter functions can serve as value transformers: unlike standard predicate + * function (which return boolean values), Pulse filters should return the + * actual tuple value to process. If a tuple set is already filtered, the + * new filter function will be appended into a conjuntive ('and') query. + * @param {number} flags - Flags indicating the tuple set(s) to filter. + * @param {function(*):object} filter - Filter function that will be applied + * to the tuple set array, and should return a data tuple if the value + * should be included in the tuple set, and falsy (or null) otherwise. + * @return {Pulse} - Returns this pulse instance. + */ + filter(flags, filter2) { + const p = this; + if (flags & ADD) p.addF = addFilter(p.addF, filter2); + if (flags & REM) p.remF = addFilter(p.remF, filter2); + if (flags & MOD$1) p.modF = addFilter(p.modF, filter2); + if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter2); + return p; + }, + /** + * Materialize one or more tuple sets in this pulse. If the tuple set(s) have + * a registered filter function, it will be applied and the tuple set(s) will + * be replaced with materialized tuple arrays. + * @param {number} flags - Flags indicating the tuple set(s) to materialize. + * @return {Pulse} - Returns this pulse instance. + */ + materialize(flags) { + flags = flags || ALL; + const p = this; + if (flags & ADD && p.addF) { + p.add = materialize(p.add, p.addF); + p.addF = null; + } + if (flags & REM && p.remF) { + p.rem = materialize(p.rem, p.remF); + p.remF = null; + } + if (flags & MOD$1 && p.modF) { + p.mod = materialize(p.mod, p.modF); + p.modF = null; + } + if (flags & SOURCE && p.srcF) { + p.source = p.source.filter(p.srcF); + p.srcF = null; + } + return p; + }, + /** + * Visit one or more tuple sets in this pulse. + * @param {number} flags - Flags indicating the tuple set(s) to visit. + * Legal values are ADD, REM, MOD and SOURCE (if a backing data source + * has been set). + * @param {function(object):*} - Visitor function invoked per-tuple. + * @return {Pulse} - Returns this pulse instance. + */ + visit(flags, visitor) { + const p = this, v = visitor; + if (flags & SOURCE) { + visitArray(p.source, p.srcF, v); + return p; + } + if (flags & ADD) visitArray(p.add, p.addF, v); + if (flags & REM) visitArray(p.rem, p.remF, v); + if (flags & MOD$1) visitArray(p.mod, p.modF, v); + const src = p.source; + if (flags & REFLOW && src) { + const sum2 = p.add.length + p.mod.length; + if (sum2 === src.length) ; + else if (sum2) { + visitArray(src, filter$1(p, ADD_MOD), v); + } else { + visitArray(src, p.srcF, v); } - updateValue(event, newCurrentValue + diff); - event.preventDefault(); - event.stopPropagation(); - }; - var getPosition = function(event, verticalProp) { - var currentPosition = 0; - switch(event.type){ - case 'mousedown': - case 'mousemove': - currentPosition = !verticalProp ? event.clientX : event.clientY; - break; - case 'touchstart': - case 'touchmove': - currentPosition = !verticalProp ? event.touches[0].clientX : event.touches[0].clientY; - break; + } + return p; + } + }; + function MultiPulse(dataflow, stamp, pulses, encode2) { + const p = this; + let c2 = 0; + this.dataflow = dataflow; + this.stamp = stamp; + this.fields = null; + this.encode = encode2 || null; + this.pulses = pulses; + for (const pulse2 of pulses) { + if (pulse2.stamp !== stamp) continue; + if (pulse2.fields) { + const hash = p.fields || (p.fields = {}); + for (const f in pulse2.fields) { + hash[f] = 1; } - return currentPosition; - }; - var calculateCurrentSteps = function(event) { - // eslint-disable-next-line deprecation/deprecation - var sliderPositionRect = sliderLine.current.getBoundingClientRect(); - var sliderLength = !props.vertical ? sliderPositionRect.width : sliderPositionRect.height; - var stepLength = sliderLength / steps; - var currentSteps; - var distance; - if (!props.vertical) { - var left = getPosition(event, props.vertical); - distance = (0, _utilities.getRTL)(props.theme) ? sliderPositionRect.right - left : left - sliderPositionRect.left; - currentSteps = distance / stepLength; - } else { - var bottom = getPosition(event, props.vertical); - distance = sliderPositionRect.bottom - bottom; - currentSteps = distance / stepLength; - } - return currentSteps; - }; - var onMouseMoveOrTouchMove = function(event, suppressEventCancelation) { - var currentSteps = calculateCurrentSteps(event); - var newUnroundedValue = min + step * currentSteps; - var newCurrentValue = min + step * Math.round(currentSteps); - updateValue(event, newCurrentValue, newUnroundedValue); - if (!suppressEventCancelation) { - event.preventDefault(); - event.stopPropagation(); - } - }; - var onMouseDownOrTouchStart = function(event) { - if (ranged) { - var currentSteps = calculateCurrentSteps(event); - var newValue = min + step * currentSteps; - internalState.isAdjustingLowerValue = newValue <= internalState.latestLowerValue || newValue - internalState.latestLowerValue <= internalState.latestValue - newValue; - } - // safe to use `win!` since it can only be called on the client - if (event.type === 'mousedown') disposables.current.push((0, _utilities.on)(win, 'mousemove', onMouseMoveOrTouchMove, true), (0, _utilities.on)(win, 'mouseup', onMouseUpOrTouchEnd, true)); - else if (event.type === 'touchstart') disposables.current.push((0, _utilities.on)(win, 'touchmove', onMouseMoveOrTouchMove, true), (0, _utilities.on)(win, 'touchend', onMouseUpOrTouchEnd, true)); - onMouseMoveOrTouchMove(event, true); - }; - var onMouseUpOrTouchEnd = function(event) { - // Done adjusting, so clear this value - internalState.isBetweenSteps = undefined; - onChanged === null || onChanged === void 0 || onChanged(event, internalState.latestValue, ranged ? [ - internalState.latestLowerValue, - internalState.latestValue - ] : undefined); - disposeListeners(); - }; - var onThumbFocus = function(event) { - internalState.isAdjustingLowerValue = event.target === lowerValueThumbRef.current; - }; - var disposeListeners = _react.useCallback(function() { - disposables.current.forEach(function(dispose) { - return dispose(); + } + if (pulse2.changed(p.ADD)) c2 |= p.ADD; + if (pulse2.changed(p.REM)) c2 |= p.REM; + if (pulse2.changed(p.MOD)) c2 |= p.MOD; + } + this.changes = c2; + } + inherits(MultiPulse, Pulse, { + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} + */ + fork(flags) { + const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); + if (flags !== void 0) { + if (flags & p.ADD) this.visit(p.ADD, (t) => p.add.push(t)); + if (flags & p.REM) this.visit(p.REM, (t) => p.rem.push(t)); + if (flags & p.MOD) this.visit(p.MOD, (t) => p.mod.push(t)); + } + return p; + }, + changed(flags) { + return this.changes & flags; + }, + modified(_) { + const p = this, fields = p.fields; + return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some((f) => fields[f]) : fields[_]; + }, + filter() { + error("MultiPulse does not support filtering."); + }, + materialize() { + error("MultiPulse does not support materialization."); + }, + visit(flags, visitor) { + const p = this, pulses = p.pulses, n = pulses.length; + let i = 0; + if (flags & p.SOURCE) { + for (; i < n; ++i) { + pulses[i].visit(flags, visitor); + } + } else { + for (; i < n; ++i) { + if (pulses[i].stamp === p.stamp) { + pulses[i].visit(flags, visitor); + } + } + } + return p; + } + }); + async function evaluate(encode2, prerun, postrun) { + const df = this, async = []; + if (df._pulse) return reentrant(df); + if (df._pending) await df._pending; + if (prerun) await asyncCallback(df, prerun); + if (!df._touched.length) { + df.debug("Dataflow invoked, but nothing to do."); + return df; + } + const stamp = ++df._clock; + df._pulse = new Pulse(df, stamp, encode2); + df._touched.forEach((op2) => df._enqueue(op2, true)); + df._touched = UniqueList(id); + let count2 = 0, op, next, error2; + try { + while (df._heap.size() > 0) { + op = df._heap.pop(); + if (op.rank !== op.qrank) { + df._enqueue(op, true); + continue; + } + next = op.run(df._getPulse(op, encode2)); + if (next.then) { + next = await next; + } else if (next.async) { + async.push(next.async); + next = StopPropagation; + } + if (next !== StopPropagation) { + if (op._targets) op._targets.forEach((op2) => df._enqueue(op2)); + } + ++count2; + } + } catch (err) { + df._heap.clear(); + error2 = err; + } + df._input = {}; + df._pulse = null; + df.debug(`Pulse ${stamp}: ${count2} operators`); + if (error2) { + df._postrun = []; + df.error(error2); + } + if (df._postrun.length) { + const pr = df._postrun.sort((a2, b2) => b2.priority - a2.priority); + df._postrun = []; + for (let i = 0; i < pr.length; ++i) { + await asyncCallback(df, pr[i].callback); + } + } + if (postrun) await asyncCallback(df, postrun); + if (async.length) { + Promise.all(async).then((cb) => df.runAsync(null, () => { + cb.forEach((f) => { + try { + f(df); + } catch (err) { + df.error(err); + } }); - disposables.current = []; - }, []); - _react.useEffect(function() { - return disposeListeners; - }, [ - disposeListeners - ]); - var lowerValueThumbRef = _react.useRef(null); - var thumbRef = _react.useRef(null); - var sliderBoxRef = _react.useRef(null); - useComponentRef(props, sliderBoxRef, value, ranged ? [ - lowerValue, - value - ] : undefined); - var getPositionStyles = getSlotStyleFn(vertical ? 'bottom' : (0, _utilities.getRTL)(props.theme) ? 'right' : 'left'); - var getTrackStyles = getSlotStyleFn(vertical ? 'height' : 'width'); - var originValue = originFromZero ? 0 : min; - var valuePercent = getPercent(value, min, max); - var lowerValuePercent = getPercent(lowerValue, min, max); - var originPercentOfLine = getPercent(originValue, min, max); - var activeSectionWidth = ranged ? valuePercent - lowerValuePercent : Math.abs(originPercentOfLine - valuePercent); - var topSectionWidth = Math.min(100 - valuePercent, 100 - originPercentOfLine); - var bottomSectionWidth = ranged ? lowerValuePercent : Math.min(valuePercent, originPercentOfLine); - var rootProps = { - className: classNames.root, - ref: ref - }; - var labelProps = { - className: classNames.titleLabel, - children: label, - disabled: disabled, - htmlFor: ariaLabel ? undefined : id - }; - var valueLabelProps = showValue ? { - className: classNames.valueLabel, - children: valueFormat ? valueFormat(value) : value, - disabled: disabled, - htmlFor: disabled ? id : undefined - } : undefined; - var lowerValueLabelProps = ranged && showValue ? { - className: classNames.valueLabel, - children: valueFormat ? valueFormat(lowerValue) : lowerValue, - disabled: disabled - } : undefined; - var zeroTickProps = originFromZero ? { - className: classNames.zeroTick, - style: getPositionStyles(originPercentOfLine) - } : undefined; - var trackActiveProps = { - className: (0, _utilities.css)(classNames.lineContainer, classNames.activeSection), - style: getTrackStyles(activeSectionWidth) - }; - var trackTopInactiveProps = { - className: (0, _utilities.css)(classNames.lineContainer, classNames.inactiveSection), - style: getTrackStyles(topSectionWidth) - }; - var trackBottomInactiveProps = { - className: (0, _utilities.css)(classNames.lineContainer, classNames.inactiveSection), - style: getTrackStyles(bottomSectionWidth) - }; - var sliderProps = (0, _tslib.__assign)({ - 'aria-disabled': disabled, - role: 'slider', - tabIndex: disabled ? undefined : 0 - }, { - 'data-is-focusable': !disabled - }); - var sliderBoxProps = (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({ - id: id, - className: (0, _utilities.css)(classNames.slideBox, buttonProps.className), - ref: sliderBoxRef - }, !disabled && { - onMouseDown: onMouseDownOrTouchStart, - onTouchStart: onMouseDownOrTouchStart, - onKeyDown: onKeyDown - }), buttonProps && (0, _utilities.getNativeProps)(buttonProps, (0, _utilities.divProperties), [ - 'id', - 'className' - ])), !ranged && (0, _tslib.__assign)((0, _tslib.__assign)({}, sliderProps), { - 'aria-valuemin': min, - 'aria-valuemax': max, - 'aria-valuenow': value, - 'aria-valuetext': getAriaValueText(value), - 'aria-label': ariaLabel || label, - 'aria-labelledby': ariaLabelledBy - })); - var onFocusProp = disabled ? {} : { - onFocus: onThumbFocus - }; - var thumbProps = (0, _tslib.__assign)({ - ref: thumbRef, - className: classNames.thumb, - style: getPositionStyles(valuePercent) - }, ranged && (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({}, sliderProps), onFocusProp), { - id: "max-".concat(id), - 'aria-valuemin': lowerValue, - 'aria-valuemax': max, - 'aria-valuenow': value, - 'aria-valuetext': getAriaValueText(value), - 'aria-label': "max ".concat(ariaLabel || label) - })); - var lowerValueThumbProps = ranged ? (0, _tslib.__assign)((0, _tslib.__assign)((0, _tslib.__assign)({ - ref: lowerValueThumbRef, - className: classNames.thumb, - style: getPositionStyles(lowerValuePercent) - }, sliderProps), onFocusProp), { - id: "min-".concat(id), - 'aria-valuemin': min, - 'aria-valuemax': value, - 'aria-valuenow': lowerValue, - 'aria-valuetext': getAriaValueText(lowerValue), - 'aria-label': "min ".concat(ariaLabel || label) - }) : undefined; - var containerProps = { - className: classNames.container - }; - var sliderLineProps = { - ref: sliderLine, - className: classNames.line - }; - return { - root: rootProps, - label: labelProps, - sliderBox: sliderBoxProps, - container: containerProps, - valueLabel: valueLabelProps, - lowerValueLabel: lowerValueLabelProps, - thumb: thumbProps, - lowerValueThumb: lowerValueThumbProps, - zeroTick: zeroTickProps, - activeTrack: trackActiveProps, - topInactiveTrack: trackTopInactiveProps, - bottomInactiveTrack: trackBottomInactiveProps, - sliderLine: sliderLineProps - }; -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../../utilities/dom":"55K1t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7YHnV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styleUtilities = require("@fluentui/style-utilities"); -var _utilities = require("@fluentui/utilities"); -var GlobalClassNames = { - root: 'ms-Slider', - enabled: 'ms-Slider-enabled', - disabled: 'ms-Slider-disabled', - row: 'ms-Slider-row', - column: 'ms-Slider-column', - container: 'ms-Slider-container', - slideBox: 'ms-Slider-slideBox', - line: 'ms-Slider-line', - thumb: 'ms-Slider-thumb', - activeSection: 'ms-Slider-active', - inactiveSection: 'ms-Slider-inactive', - valueLabel: 'ms-Slider-value', - showValue: 'ms-Slider-showValue', - showTransitions: 'ms-Slider-showTransitions', - zeroTick: 'ms-Slider-zeroTick' -}; -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; - var className = props.className, titleLabelClassName = props.titleLabelClassName, theme = props.theme, vertical = props.vertical, disabled = props.disabled, showTransitions = props.showTransitions, showValue = props.showValue, ranged = props.ranged; - var semanticColors = theme.semanticColors, palette = theme.palette; - var classNames = (0, _styleUtilities.getGlobalClassNames)(GlobalClassNames, theme); - /** Tokens: - * The word "active" in the token refers to the selected section of the slider - * The word "inactive" in the token refers to the unselected section of the slider */ var pressedActiveSectionColor = semanticColors.inputBackgroundCheckedHovered; - var hoveredActiveSectionColor = semanticColors.inputBackgroundChecked; - var hoveredPressedinactiveSectionColor = palette.neutralSecondaryAlt; - var restActiveSectionColor = palette.neutralPrimary; - var restInactiveSectionColor = palette.neutralSecondaryAlt; - var disabledActiveSectionColor = semanticColors.disabledText; - var disabledInactiveSectionColor = semanticColors.disabledBackground; - var thumbBackgroundColor = semanticColors.inputBackground; - var thumbBorderColor = semanticColors.smallInputBorder; - var thumbDisabledBorderColor = semanticColors.disabledBorder; - var slideBoxActiveSectionStyles = !disabled && { - backgroundColor: pressedActiveSectionColor, - selectors: (_a = {}, _a[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _a) - }; - var slideBoxInactiveSectionStyles = !disabled && { - backgroundColor: hoveredPressedinactiveSectionColor, - selectors: (_b = {}, _b[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _b) - }; - var slideHoverSectionStyles = !disabled && { - backgroundColor: hoveredActiveSectionColor, - selectors: (_c = {}, _c[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _c) - }; - var slideBoxActiveThumbStyles = !disabled && { - border: "2px solid ".concat(pressedActiveSectionColor), - selectors: (_d = {}, _d[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _d) - }; - var slideBoxActiveZeroTickStyles = !props.disabled && { - backgroundColor: semanticColors.inputPlaceholderBackgroundChecked, - selectors: (_e = {}, _e[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _e) - }; - return { - root: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([ - classNames.root, - theme.fonts.medium, - { - userSelect: 'none' - }, - vertical && { - marginRight: 8 - } - ], [ - !disabled ? classNames.enabled : undefined - ], false), [ - disabled ? classNames.disabled : undefined - ], false), [ - !vertical ? classNames.row : undefined - ], false), [ - vertical ? classNames.column : undefined - ], false), [ - className - ], false), - titleLabel: [ - { - padding: 0 - }, - titleLabelClassName - ], - container: [ - classNames.container, - { - display: 'flex', - flexWrap: 'nowrap', - alignItems: 'center' - }, - vertical && { - flexDirection: 'column', - height: '100%', - textAlign: 'center', - margin: '8px 0' - } - ], - slideBox: (0, _tslib.__spreadArray)((0, _tslib.__spreadArray)([ - classNames.slideBox, - !ranged && (0, _styleUtilities.getFocusStyle)(theme), - { - background: 'transparent', - border: 'none', - flexGrow: 1, - lineHeight: 28, - display: 'flex', - alignItems: 'center', - selectors: (_f = {}, _f[":active .".concat(classNames.activeSection)] = slideBoxActiveSectionStyles, _f[":hover .".concat(classNames.activeSection)] = slideHoverSectionStyles, _f[":active .".concat(classNames.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":hover .".concat(classNames.inactiveSection)] = slideBoxInactiveSectionStyles, _f[":active .".concat(classNames.thumb)] = slideBoxActiveThumbStyles, _f[":hover .".concat(classNames.thumb)] = slideBoxActiveThumbStyles, _f[":active .".concat(classNames.zeroTick)] = slideBoxActiveZeroTickStyles, _f[":hover .".concat(classNames.zeroTick)] = slideBoxActiveZeroTickStyles, _f[0, _styleUtilities.HighContrastSelector] = { - forcedColorAdjust: 'none' - }, _f) - }, - vertical ? { - height: '100%', - width: 28, - padding: '8px 0' - } : { - height: 28, - width: 'auto', - padding: '0 8px' - } - ], [ - showValue ? classNames.showValue : undefined - ], false), [ - showTransitions ? classNames.showTransitions : undefined - ], false), - thumb: [ - classNames.thumb, - ranged && (0, _styleUtilities.getFocusStyle)(theme, { - inset: -4 - }), - { - borderWidth: 2, - borderStyle: 'solid', - borderColor: thumbBorderColor, - borderRadius: 10, - boxSizing: 'border-box', - background: thumbBackgroundColor, - display: 'block', - width: 16, - height: 16, - position: 'absolute' - }, - vertical ? { - left: -6, - margin: '0 auto', - transform: 'translateY(8px)' - } : { - top: -6, - transform: (0, _utilities.getRTL)(theme) ? 'translateX(50%)' : 'translateX(-50%)' - }, - showTransitions && { - transition: "left ".concat((0, _styleUtilities.AnimationVariables).durationValue3, " ").concat((0, _styleUtilities.AnimationVariables).easeFunction1) - }, - disabled && { - borderColor: thumbDisabledBorderColor, - selectors: (_g = {}, _g[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'GrayText' - }, _g) - } - ], - line: [ - classNames.line, - { - display: 'flex', - position: 'relative' - }, - vertical ? { - height: '100%', - width: 4, - margin: '0 auto', - flexDirection: 'column-reverse' - } : { - width: '100%' - } - ], - lineContainer: [ - { - borderRadius: 4, - boxSizing: 'border-box' - }, - vertical ? { - width: 4, - height: '100%' - } : { - height: 4, - width: '100%' - } - ], - activeSection: [ - classNames.activeSection, - { - background: restActiveSectionColor, - selectors: (_h = {}, _h[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _h) - }, - showTransitions && { - transition: "width ".concat((0, _styleUtilities.AnimationVariables).durationValue3, " ").concat((0, _styleUtilities.AnimationVariables).easeFunction1) - }, - disabled && { - background: disabledActiveSectionColor, - selectors: (_j = {}, _j[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'GrayText', - borderColor: 'GrayText' - }, _j) - } - ], - inactiveSection: [ - classNames.inactiveSection, - { - background: restInactiveSectionColor, - selectors: (_k = {}, _k[0, _styleUtilities.HighContrastSelector] = { - border: '1px solid WindowText' - }, _k) - }, - showTransitions && { - transition: "width ".concat((0, _styleUtilities.AnimationVariables).durationValue3, " ").concat((0, _styleUtilities.AnimationVariables).easeFunction1) - }, - disabled && { - background: disabledInactiveSectionColor, - selectors: (_l = {}, _l[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'GrayText' - }, _l) - } - ], - zeroTick: [ - classNames.zeroTick, - { - position: 'absolute', - background: semanticColors.disabledBorder, - selectors: (_m = {}, _m[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'WindowText' - }, _m) - }, - props.disabled && { - background: semanticColors.disabledBackground, - selectors: (_o = {}, _o[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'GrayText' - }, _o) - }, - props.vertical ? { - width: '16px', - height: '1px', - transform: (0, _utilities.getRTL)(theme) ? 'translateX(6px)' : 'translateX(-6px)' - } : { - width: '1px', - height: '16px', - transform: 'translateY(-6px)' - } - ], - valueLabel: [ - classNames.valueLabel, - { - flexShrink: 1, - width: 30, - lineHeight: '1' - }, - vertical ? { - margin: '0 auto', - whiteSpace: 'nowrap', - width: 40 - } : { - margin: '0 8px', - whiteSpace: 'nowrap', - width: 40 - } - ] + })); + } + return df; + } + async function runAsync(encode2, prerun, postrun) { + while (this._running) await this._running; + const clear = () => this._running = null; + (this._running = this.evaluate(encode2, prerun, postrun)).then(clear, clear); + return this._running; + } + function run(encode2, prerun, postrun) { + return this._pulse ? reentrant(this) : (this.evaluate(encode2, prerun, postrun), this); + } + function runAfter(callback, enqueue2, priority) { + if (this._pulse || enqueue2) { + this._postrun.push({ + priority: priority || 0, + callback + }); + } else { + try { + callback(this); + } catch (err) { + this.error(err); + } + } + } + function reentrant(df) { + df.error("Dataflow already running. Use runAsync() to chain invocations."); + return df; + } + function enqueue(op, force2) { + const q = op.stamp < this._clock; + if (q) op.stamp = this._clock; + if (q || force2) { + op.qrank = op.rank; + this._heap.push(op); + } + } + function getPulse(op, encode2) { + const s2 = op.source, stamp = this._clock; + return s2 && isArray(s2) ? new MultiPulse(this, stamp, s2.map((_) => _.pulse), encode2) : this._input[op.id] || singlePulse(this._pulse, s2 && s2.pulse); + } + function singlePulse(p, s2) { + if (s2 && s2.stamp === p.stamp) { + return s2; + } + p = p.fork(); + if (s2 && s2 !== StopPropagation) { + p.source = s2.source; + } + return p; + } + const NO_OPT = { + skip: false, + force: false + }; + function touch(op, options2) { + const opt = options2 || NO_OPT; + if (this._pulse) { + this._enqueue(op); + } else { + this._touched.add(op); + } + if (opt.skip) op.skip(true); + return this; + } + function update$6(op, value2, options2) { + const opt = options2 || NO_OPT; + if (op.set(value2) || opt.force) { + this.touch(op, opt); + } + return this; + } + function pulse(op, changeset2, options2) { + this.touch(op, options2 || NO_OPT); + const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; + p.target = op; + this._input[op.id] = changeset2.pulse(p, t); + return this; + } + function Heap(cmp) { + let nodes = []; + return { + clear: () => nodes = [], + size: () => nodes.length, + peek: () => nodes[0], + push: (x2) => { + nodes.push(x2); + return siftdown(nodes, 0, nodes.length - 1, cmp); + }, + pop: () => { + const last = nodes.pop(); + let item; + if (nodes.length) { + item = nodes[0]; + nodes[0] = last; + siftup(nodes, 0, cmp); + } else { + item = last; + } + return item; + } }; -}; - -},{"tslib":"9gizs","@fluentui/style-utilities":"bJvmh","@fluentui/utilities":"55bj3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4BGE1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Spinner/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Spinner/index":"6cGjO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6cGjO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _spinner = require("./Spinner"); -parcelHelpers.exportAll(_spinner, exports); -var _spinnerBase = require("./Spinner.base"); -parcelHelpers.exportAll(_spinnerBase, exports); -var _spinnerTypes = require("./Spinner.types"); -parcelHelpers.exportAll(_spinnerTypes, exports); - -},{"./Spinner":"ehJr7","./Spinner.base":false,"./Spinner.types":"lljUP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ehJr7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Spinner", ()=>Spinner); -var _utilities = require("../../Utilities"); -var _spinnerBase = require("./Spinner.base"); -var _spinnerStyles = require("./Spinner.styles"); -var Spinner = (0, _utilities.styled)((0, _spinnerBase.SpinnerBase), (0, _spinnerStyles.getStyles), undefined, { - scope: 'Spinner' -}); - -},{"../../Utilities":"1NZCy","./Spinner.base":"iBpcH","./Spinner.styles":"2rElf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iBpcH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SpinnerBase", ()=>SpinnerBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _spinnerTypes = require("./Spinner.types"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var SpinnerBase = /** @class */ function(_super) { - (0, _tslib.__extends)(SpinnerBase, _super); - function SpinnerBase() { - return _super !== null && _super.apply(this, arguments) || this; + } + function siftdown(array2, start, idx, cmp) { + let parent, pidx; + const item = array2[idx]; + while (idx > start) { + pidx = idx - 1 >> 1; + parent = array2[pidx]; + if (cmp(item, parent) < 0) { + array2[idx] = parent; + idx = pidx; + continue; + } + break; } - SpinnerBase.prototype.render = function() { - // eslint-disable-next-line deprecation/deprecation - var _a = this.props, type = _a.type, size = _a.size, ariaLabel = _a.ariaLabel, ariaLive = _a.ariaLive, styles = _a.styles, label = _a.label, theme = _a.theme, className = _a.className, labelPosition = _a.labelPosition; - var statusMessage = ariaLabel; - var nativeProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.divProperties), [ - 'size' - ]); - // SpinnerType is deprecated. If someone is still using this property, rather than putting the SpinnerType into the - // ISpinnerStyleProps, we'll map SpinnerType to its equivalent SpinnerSize and pass that in. Once SpinnerType - // finally goes away we should delete this. - var styleSize = size; - if (styleSize === undefined && type !== undefined) // eslint-disable-next-line deprecation/deprecation - styleSize = type === (0, _spinnerTypes.SpinnerType).large ? (0, _spinnerTypes.SpinnerSize).large : (0, _spinnerTypes.SpinnerSize).medium; - var classNames = getClassNames(styles, { - theme: theme, - size: styleSize, - className: className, - labelPosition: labelPosition - }); - return _react.createElement("div", (0, _tslib.__assign)({}, nativeProps, { - className: classNames.root - }), _react.createElement("div", { - className: classNames.circle - }), label && _react.createElement("div", { - className: classNames.label - }, label), statusMessage && _react.createElement("div", { - role: "status", - "aria-live": ariaLive - }, _react.createElement((0, _utilities.DelayedRender), null, _react.createElement("div", { - className: classNames.screenReaderText - }, statusMessage)))); - }; - SpinnerBase.defaultProps = { - size: (0, _spinnerTypes.SpinnerSize).medium, - ariaLive: 'polite', - labelPosition: 'bottom' - }; - return SpinnerBase; -}(_react.Component); - -},{"tslib":"9gizs","react":"jGrId","./Spinner.types":"lljUP","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lljUP":[function(require,module,exports,__globalThis) { -/** - * Possible variations of the spinner circle size. - * {@docCategory Spinner} - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SpinnerSize", ()=>SpinnerSize); -parcelHelpers.export(exports, "SpinnerType", ()=>SpinnerType); -var SpinnerSize; -(function(SpinnerSize) { + return array2[idx] = item; + } + function siftup(array2, idx, cmp) { + const start = idx, end = array2.length, item = array2[idx]; + let cidx = (idx << 1) + 1, ridx; + while (cidx < end) { + ridx = cidx + 1; + if (ridx < end && cmp(array2[cidx], array2[ridx]) >= 0) { + cidx = ridx; + } + array2[idx] = array2[cidx]; + idx = cidx; + cidx = (idx << 1) + 1; + } + array2[idx] = item; + return siftdown(array2, start, idx, cmp); + } + function Dataflow() { + this.logger(logger()); + this.logLevel(Error$1); + this._clock = 0; + this._rank = 0; + this._locale = defaultLocale(); + try { + this._loader = loader(); + } catch (e) { + } + this._touched = UniqueList(id); + this._input = {}; + this._pulse = null; + this._heap = Heap((a2, b2) => a2.qrank - b2.qrank); + this._postrun = []; + } + function logMethod(method2) { + return function() { + return this._log[method2].apply(this, arguments); + }; + } + Dataflow.prototype = { + /** + * The current timestamp of this dataflow. This value reflects the + * timestamp of the previous dataflow run. The dataflow is initialized + * with a stamp value of 0. The initial run of the dataflow will have + * a timestap of 1, and so on. This value will match the + * {@link Pulse.stamp} property. + * @return {number} - The current timestamp value. + */ + stamp() { + return this._clock; + }, + /** + * Gets or sets the loader instance to use for data file loading. A + * loader object must provide a "load" method for loading files and a + * "sanitize" method for checking URL/filename validity. Both methods + * should accept a URI and options hash as arguments, and return a Promise + * that resolves to the loaded file contents (load) or a hash containing + * sanitized URI data with the sanitized url assigned to the "href" property + * (sanitize). + * @param {object} _ - The loader instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current loader instance. Otherwise returns this Dataflow instance. + */ + loader(_) { + if (arguments.length) { + this._loader = _; + return this; + } else { + return this._loader; + } + }, + /** + * Gets or sets the locale instance to use for formatting and parsing + * string values. The locale object should be provided by the + * vega-format library, and include methods such as format, timeFormat, + * utcFormat, timeParse, and utcParse. + * @param {object} _ - The locale instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current locale instance. Otherwise returns this Dataflow instance. + */ + locale(_) { + if (arguments.length) { + this._locale = _; + return this; + } else { + return this._locale; + } + }, + /** + * Get or set the logger instance used to log messages. If no arguments are + * provided, returns the current logger instance. Otherwise, sets the logger + * and return this Dataflow instance. Provided loggers must support the full + * API of logger objects generated by the vega-util logger method. Note that + * by default the log level of the new logger will be used; use the logLevel + * method to adjust the log level as needed. + */ + logger(logger2) { + if (arguments.length) { + this._log = logger2; + return this; + } else { + return this._log; + } + }, /** - * 12px Spinner diameter - */ SpinnerSize[SpinnerSize["xSmall"] = 0] = "xSmall"; + * Logs an error message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit error messages. + */ + error: logMethod("error"), /** - * 16px Spinner diameter - */ SpinnerSize[SpinnerSize["small"] = 1] = "small"; + * Logs a warning message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit warning messages. + */ + warn: logMethod("warn"), /** - * 20px Spinner diameter - */ SpinnerSize[SpinnerSize["medium"] = 2] = "medium"; + * Logs a information message. By default, logged messages are written to + * console output. The message will only be logged if the current log level is + * high enough to permit information messages. + */ + info: logMethod("info"), /** - * 28px Spinner diameter - */ SpinnerSize[SpinnerSize["large"] = 3] = "large"; -})(SpinnerSize || (SpinnerSize = {})); -var SpinnerType; -(function(SpinnerType) { + * Logs a debug message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit debug messages. + */ + debug: logMethod("debug"), /** - * @deprecated Use `SpinnerSize.medium` instead. Will be removed at \>= 2.0.0. - */ SpinnerType[SpinnerType["normal"] = 0] = "normal"; + * Get or set the current log level. If an argument is provided, it + * will be used as the new log level. + * @param {number} [level] - Should be one of None, Warn, Info + * @return {number} - The current log level. + */ + logLevel: logMethod("level"), /** - * @deprecated Use `SpinnerSize.large` instead. Will be removed at \>= 2.0.0. - */ SpinnerType[SpinnerType["large"] = 1] = "large"; -})(SpinnerType || (SpinnerType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2rElf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _spinnerTypes = require("./Spinner.types"); -var _styling = require("../../Styling"); -var _utilities = require("../../Utilities"); -var GlobalClassNames = { - root: 'ms-Spinner', - circle: 'ms-Spinner-circle', - label: 'ms-Spinner-label' -}; -var spinAnimation = (0, _utilities.memoizeFunction)(function() { - return (0, _styling.keyframes)({ - '0%': { - transform: 'rotate(0deg)' - }, - '100%': { - transform: 'rotate(360deg)' + * Empty entry threshold for garbage cleaning. Map data structures will + * perform cleaning once the number of empty entries exceeds this value. + */ + cleanThreshold: 1e4, + // OPERATOR REGISTRATION + add: add$3, + connect, + rank, + rerank, + // OPERATOR UPDATES + pulse, + touch, + update: update$6, + changeset, + // DATA LOADING + ingest, + parse: parse$5, + preload, + request, + // EVENT HANDLING + events: events$1, + on, + // PULSE PROPAGATION + evaluate, + run, + runAsync, + runAfter, + _enqueue: enqueue, + _getPulse: getPulse + }; + function Transform(init2, params2) { + Operator.call(this, init2, null, params2); + } + inherits(Transform, Operator, { + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + } else { + rv = this.evaluate(pulse2); + } + rv = rv || pulse2; + if (rv.then) { + rv = rv.then((_) => this.pulse = _); + } else if (rv !== pulse2.StopPropagation) { + this.pulse = rv; + } + return rv; + }, + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Marshalls parameter values and then invokes {@link transform}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + value (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const params2 = this.marshall(pulse2.stamp), out = this.transform(params2, pulse2); + params2.clear(); + return out; + }, + /** + * Process incoming pulses. + * Subclasses should override this method to implement transforms. + * @param {Parameters} _ - The operator parameter values. + * @param {Pulse} pulse - The current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + * value (including undefined) will let the input pulse pass through. + */ + transform() { + } + }); + const transforms = {}; + function definition$1(type2) { + const t = transform$2(type2); + return t && t.Definition || null; + } + function transform$2(type2) { + type2 = type2 && type2.toLowerCase(); + return has$1(transforms, type2) ? transforms[type2] : null; + } + function* numbers$1(values2, valueof) { + if (valueof == null) { + for (let value2 of values2) { + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; } - }); -}); -var getStyles = function(props) { - var _a; - var theme = props.theme, size = props.size, className = props.className, labelPosition = props.labelPosition; - var palette = theme.palette; - var classNames = (0, _styling.getGlobalClassNames)(GlobalClassNames, theme); + } + } else { + let index2 = -1; + for (let value2 of values2) { + value2 = valueof(value2, ++index2, values2); + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; + } + } + } + } + function quantiles(array2, p, f) { + const values2 = Float64Array.from(numbers$1(array2, f)); + values2.sort(ascending$2); + return p.map((_) => quantileSorted(values2, _)); + } + function quartiles(array2, f) { + return quantiles(array2, [0.25, 0.5, 0.75], f); + } + function estimateBandwidth(array2, f) { + const n = array2.length, d2 = deviation(array2, f), q = quartiles(array2, f), h2 = (q[2] - q[0]) / 1.34, v = Math.min(d2, h2) || d2 || Math.abs(q[0]) || 1; + return 1.06 * v * Math.pow(n, -0.2); + } + function bin(_) { + const maxb = _.maxbins || 20, base2 = _.base || 10, logb = Math.log(base2), div = _.divide || [5, 2]; + let min2 = _.extent[0], max2 = _.extent[1], step, level, minstep, v, i, n; + const span2 = _.span || max2 - min2 || Math.abs(min2) || 1; + if (_.step) { + step = _.step; + } else if (_.steps) { + v = span2 / maxb; + for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i) ; + step = _.steps[Math.max(0, i - 1)]; + } else { + level = Math.ceil(Math.log(maxb) / logb); + minstep = _.minstep || 0; + step = Math.max(minstep, Math.pow(base2, Math.round(Math.log(span2) / logb) - level)); + while (Math.ceil(span2 / step) > maxb) { + step *= base2; + } + for (i = 0, n = div.length; i < n; ++i) { + v = step / div[i]; + if (v >= minstep && span2 / v <= maxb) step = v; + } + } + v = Math.log(step); + const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base2, -precision - 1); + if (_.nice || _.nice === void 0) { + v = Math.floor(min2 / step + eps) * step; + min2 = min2 < v ? v - step : v; + max2 = Math.ceil(max2 / step) * step; + } return { - root: [ - classNames.root, - { - display: 'flex', - flexDirection: 'column', - alignItems: 'center', - justifyContent: 'center' - }, - labelPosition === 'top' && { - flexDirection: 'column-reverse' - }, - labelPosition === 'right' && { - flexDirection: 'row' - }, - labelPosition === 'left' && { - flexDirection: 'row-reverse' - }, - className - ], - circle: [ - classNames.circle, - { - boxSizing: 'border-box', - borderRadius: '50%', - borderWidth: '1.5px', - borderStyle: 'solid', - borderTopColor: palette.themePrimary, - borderRightColor: palette.themeLight, - borderBottomColor: palette.themeLight, - borderLeftColor: palette.themeLight, - animationName: spinAnimation(), - animationDuration: '1.3s', - animationIterationCount: 'infinite', - animationTimingFunction: 'cubic-bezier(.53,.21,.29,.67)', - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderTopColor: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _a) - }, - size === (0, _spinnerTypes.SpinnerSize).xSmall && [ - 'ms-Spinner--xSmall', - { - width: 12, - height: 12 - } - ], - size === (0, _spinnerTypes.SpinnerSize).small && [ - 'ms-Spinner--small', - { - width: 16, - height: 16 - } - ], - size === (0, _spinnerTypes.SpinnerSize).medium && [ - 'ms-Spinner--medium', - { - width: 20, - height: 20 - } - ], - size === (0, _spinnerTypes.SpinnerSize).large && [ - 'ms-Spinner--large', - { - width: 28, - height: 28 - } - ] - ], - label: [ - classNames.label, - theme.fonts.small, - { - color: palette.themePrimary, - margin: '8px 0 0', - textAlign: 'center' - }, - labelPosition === 'top' && { - margin: '0 0 8px' - }, - labelPosition === 'right' && { - margin: '0 0 0 8px' - }, - labelPosition === 'left' && { - margin: '0 8px 0 0' - } - ], - screenReaderText: (0, _styling.hiddenContentStyle) - }; -}; - -},{"tslib":"9gizs","./Spinner.types":"lljUP","../../Styling":"hTimn","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4CWIf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/TextField/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/TextField/index":"dasul","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dasul":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getTextFieldStyles", ()=>(0, _textFieldStyles.getStyles)); -var _textField = require("./TextField"); -parcelHelpers.exportAll(_textField, exports); -var _textFieldBase = require("./TextField.base"); -parcelHelpers.exportAll(_textFieldBase, exports); -var _textFieldStyles = require("./TextField.styles"); -var _textFieldTypes = require("./TextField.types"); -parcelHelpers.exportAll(_textFieldTypes, exports); -var _maskedTextField = require("./MaskedTextField/MaskedTextField"); -parcelHelpers.exportAll(_maskedTextField, exports); - -},{"./TextField":"iY6ic","./TextField.base":false,"./TextField.styles":false,"./TextField.types":false,"./MaskedTextField/MaskedTextField":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iY6ic":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextField", ()=>TextField); -var _utilities = require("../../Utilities"); -var _textFieldBase = require("./TextField.base"); -var _textFieldStyles = require("./TextField.styles"); -var TextField = (0, _utilities.styled)((0, _textFieldBase.TextFieldBase), (0, _textFieldStyles.getStyles), undefined, { - scope: 'TextField' -}); - -},{"../../Utilities":"1NZCy","./TextField.base":"eARAk","./TextField.styles":"eaSCw","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eARAk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextFieldBase", ()=>TextFieldBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _label = require("../../Label"); -var _icon = require("../../Icon"); -var _utilities = require("../../Utilities"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var DEFAULT_STATE_VALUE = ''; -var COMPONENT_NAME = 'TextField'; -var REVEAL_ICON_NAME = 'RedEye'; -var HIDE_ICON_NAME = 'Hide'; -var TextFieldBase = /** @class */ function(_super) { - (0, _tslib.__extends)(TextFieldBase, _super); - function TextFieldBase(props) { - var _this = _super.call(this, props) || this; - _this._textElement = _react.createRef(); - _this._onFocus = function(ev) { - if (_this.props.onFocus) _this.props.onFocus(ev); - _this.setState({ - isFocused: true - }, function() { - if (_this.props.validateOnFocusIn) _this._validate(_this.value); - }); - }; - _this._onBlur = function(ev) { - if (_this.props.onBlur) _this.props.onBlur(ev); - _this.setState({ - isFocused: false - }, function() { - if (_this.props.validateOnFocusOut) _this._validate(_this.value); - }); - }; - _this._onRenderLabel = function(props) { - var label = props.label, required = props.required; - // IProcessedStyleSet definition requires casting for what Label expects as its styles prop - var labelStyles = _this._classNames.subComponentStyles ? _this._classNames.subComponentStyles.label : undefined; - if (label) return _react.createElement((0, _label.Label), { - required: required, - htmlFor: _this._id, - styles: labelStyles, - disabled: props.disabled, - id: _this._labelId - }, props.label); - return null; - }; - _this._onRenderDescription = function(props) { - if (props.description) return _react.createElement("span", { - className: _this._classNames.description - }, props.description); - return null; - }; - _this._onRevealButtonClick = function(event) { - _this.setState(function(prevState) { - return { - isRevealingPassword: !prevState.isRevealingPassword - }; - }); - }; - _this._onInputChange = function(event) { - // Previously, we needed to call both onInput and onChange due to some weird IE/React issues, - // which have *probably* been fixed now: - // - https://github.com/microsoft/fluentui/issues/744 (likely fixed) - // - https://github.com/microsoft/fluentui/issues/824 (confirmed fixed) - var _a, _b; - // TODO (Fabric 8?) - Switch to calling only onChange. This switch is pretty disruptive for - // tests (ours and maybe consumers' too), so it seemed best to do the switch in a major bump. - var element = event.target; - var value = element.value; - // Ignore this event if any of the following are true: - // - the value is undefined (in case one of the IE bugs comes back) - // - it's a duplicate event (important since onInputChange is called twice per actual user event) - // - it's the same as the previous value - var previousValue = _getValue(_this.props, _this.state) || ''; - if (value === undefined || value === _this._lastChangeValue || value === previousValue) { - _this._lastChangeValue = undefined; - return; - } - _this._lastChangeValue = value; - (_b = (_a = _this.props).onChange) === null || _b === void 0 || _b.call(_a, event, value); - if (!_this._isControlled) // ONLY if this is an uncontrolled component, update the displayed value. - // (Controlled components must update the `value` prop from `onChange`.) - _this.setState({ - uncontrolledValue: value - }); - }; - (0, _utilities.initializeComponentRef)(_this); - _this._async = new (0, _utilities.Async)(_this); - _this._fallbackId = (0, _utilities.getId)(COMPONENT_NAME); - _this._descriptionId = (0, _utilities.getId)(COMPONENT_NAME + 'Description'); - _this._labelId = (0, _utilities.getId)(COMPONENT_NAME + 'Label'); - _this._prefixId = (0, _utilities.getId)(COMPONENT_NAME + 'Prefix'); - _this._suffixId = (0, _utilities.getId)(COMPONENT_NAME + 'Suffix'); - _this._warnControlledUsage(); - var _a = props.defaultValue, defaultValue = _a === void 0 ? DEFAULT_STATE_VALUE : _a; - if (typeof defaultValue === 'number') // This isn't allowed per the props, but happens anyway. - defaultValue = String(defaultValue); - _this.state = { - uncontrolledValue: _this._isControlled ? undefined : defaultValue, - isFocused: false, - errorMessage: '' - }; - _this._delayedValidate = _this._async.debounce(_this._validate, _this.props.deferredValidationTime); - _this._lastValidation = 0; - return _this; + start: min2, + stop: max2 === min2 ? min2 + step : max2, + step + }; + } + var random = Math.random; + function setRandom(r) { + random = r; + } + function bootstrapCI(array2, samples, alpha, f) { + if (!array2.length) return [void 0, void 0]; + const values2 = Float64Array.from(numbers$1(array2, f)), n = values2.length, m2 = samples; + let a2, i, j, mu; + for (j = 0, mu = Array(m2); j < m2; ++j) { + for (a2 = 0, i = 0; i < n; ++i) { + a2 += values2[~~(random() * n)]; + } + mu[j] = a2 / n; } - Object.defineProperty(TextFieldBase.prototype, "value", { - /** - * Gets the current value of the text field. - */ get: function() { - return _getValue(this.props, this.state); - }, - enumerable: false, - configurable: true - }); - TextFieldBase.prototype.componentDidMount = function() { - this._adjustInputHeight(); - if (this.props.validateOnLoad) this._validate(this.value); + mu.sort(ascending$2); + return [quantile$1(mu, alpha / 2), quantile$1(mu, 1 - alpha / 2)]; + } + function dotbin(array2, step, smooth, f) { + f = f || ((_) => _); + const n = array2.length, v = new Float64Array(n); + let i = 0, j = 1, a2 = f(array2[0]), b2 = a2, w2 = a2 + step, x2; + for (; j < n; ++j) { + x2 = f(array2[j]); + if (x2 >= w2) { + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + w2 = x2 + step; + a2 = x2; + } + b2 = x2; + } + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + return smooth ? smoothing(v, step + step / 4) : v; + } + function smoothing(v, thresh) { + const n = v.length; + let a2 = 0, b2 = 1, c2, d2; + while (v[a2] === v[b2]) ++b2; + while (b2 < n) { + c2 = b2 + 1; + while (v[b2] === v[c2]) ++c2; + if (v[b2] - v[b2 - 1] < thresh) { + d2 = b2 + (a2 + c2 - b2 - b2 >> 1); + while (d2 < b2) v[d2++] = v[b2]; + while (d2 > b2) v[d2--] = v[a2]; + } + a2 = b2; + b2 = c2; + } + return v; + } + function lcg$2(seed) { + return function() { + seed = (1103515245 * seed + 12345) % 2147483647; + return seed / 2147483647; }; - TextFieldBase.prototype.componentWillUnmount = function() { - this._async.dispose(); + } + function integer(min2, max2) { + if (max2 == null) { + max2 = min2; + min2 = 0; + } + let a2, b2, d2; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + d2 = b2 - a2; + return dist2; + } else { + return a2; + } + }, + max(_) { + if (arguments.length) { + b2 = _ || 0; + d2 = b2 - a2; + return dist2; + } else { + return b2; + } + }, + sample() { + return a2 + Math.floor(d2 * random()); + }, + pdf(x2) { + return x2 === Math.floor(x2) && x2 >= a2 && x2 < b2 ? 1 / d2 : 0; + }, + cdf(x2) { + const v = Math.floor(x2); + return v < a2 ? 0 : v >= b2 ? 1 : (v - a2 + 1) / d2; + }, + icdf(p) { + return p >= 0 && p <= 1 ? a2 - 1 + Math.floor(p * d2) : NaN; + } }; - TextFieldBase.prototype.getSnapshotBeforeUpdate = function(prevProps, prevState) { - return { - selection: [ - this.selectionStart, - this.selectionEnd - ] - }; + return dist2.min(min2).max(max2); + } + const SQRT2PI = Math.sqrt(2 * Math.PI); + const SQRT2 = Math.SQRT2; + let nextSample = NaN; + function sampleNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + let x2 = 0, y2 = 0, rds, c2; + if (nextSample === nextSample) { + x2 = nextSample; + nextSample = NaN; + } else { + do { + x2 = random() * 2 - 1; + y2 = random() * 2 - 1; + rds = x2 * x2 + y2 * y2; + } while (rds === 0 || rds > 1); + c2 = Math.sqrt(-2 * Math.log(rds) / rds); + x2 *= c2; + nextSample = y2 * c2; + } + return mean2 + x2 * stdev; + } + function densityNormal(value2, mean2, stdev) { + stdev = stdev == null ? 1 : stdev; + const z2 = (value2 - (mean2 || 0)) / stdev; + return Math.exp(-0.5 * z2 * z2) / (stdev * SQRT2PI); + } + function cumulativeNormal(value2, mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z2 = (value2 - mean2) / stdev, Z3 = Math.abs(z2); + let cd; + if (Z3 > 37) { + cd = 0; + } else { + const exp2 = Math.exp(-Z3 * Z3 / 2); + let sum2; + if (Z3 < 7.07106781186547) { + sum2 = 0.0352624965998911 * Z3 + 0.700383064443688; + sum2 = sum2 * Z3 + 6.37396220353165; + sum2 = sum2 * Z3 + 33.912866078383; + sum2 = sum2 * Z3 + 112.079291497871; + sum2 = sum2 * Z3 + 221.213596169931; + sum2 = sum2 * Z3 + 220.206867912376; + cd = exp2 * sum2; + sum2 = 0.0883883476483184 * Z3 + 1.75566716318264; + sum2 = sum2 * Z3 + 16.064177579207; + sum2 = sum2 * Z3 + 86.7807322029461; + sum2 = sum2 * Z3 + 296.564248779674; + sum2 = sum2 * Z3 + 637.333633378831; + sum2 = sum2 * Z3 + 793.826512519948; + sum2 = sum2 * Z3 + 440.413735824752; + cd = cd / sum2; + } else { + sum2 = Z3 + 0.65; + sum2 = Z3 + 4 / sum2; + sum2 = Z3 + 3 / sum2; + sum2 = Z3 + 2 / sum2; + sum2 = Z3 + 1 / sum2; + cd = exp2 / sum2 / 2.506628274631; + } + } + return z2 > 0 ? 1 - cd : cd; + } + function quantileNormal(p, mean2, stdev) { + if (p < 0 || p > 1) return NaN; + return (mean2 || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); + } + function erfinv(x2) { + let w2 = -Math.log((1 - x2) * (1 + x2)), p; + if (w2 < 6.25) { + w2 -= 3.125; + p = -364441206401782e-35; + p = -16850591381820166e-35 + p * w2; + p = 128584807152564e-32 + p * w2; + p = 11157877678025181e-33 + p * w2; + p = -1333171662854621e-31 + p * w2; + p = 20972767875968562e-33 + p * w2; + p = 6637638134358324e-30 + p * w2; + p = -4054566272975207e-29 + p * w2; + p = -8151934197605472e-29 + p * w2; + p = 26335093153082323e-28 + p * w2; + p = -12975133253453532e-27 + p * w2; + p = -5415412054294628e-26 + p * w2; + p = 10512122733215323e-25 + p * w2; + p = -4112633980346984e-24 + p * w2; + p = -29070369957882005e-24 + p * w2; + p = 42347877827932404e-23 + p * w2; + p = -13654692000834679e-22 + p * w2; + p = -13882523362786469e-21 + p * w2; + p = 18673420803405714e-20 + p * w2; + p = -740702534166267e-18 + p * w2; + p = -0.006033670871430149 + p * w2; + p = 0.24015818242558962 + p * w2; + p = 1.6536545626831027 + p * w2; + } else if (w2 < 16) { + w2 = Math.sqrt(w2) - 3.25; + p = 22137376921775787e-25; + p = 9075656193888539e-23 + p * w2; + p = -27517406297064545e-23 + p * w2; + p = 18239629214389228e-24 + p * w2; + p = 15027403968909828e-22 + p * w2; + p = -4013867526981546e-21 + p * w2; + p = 29234449089955446e-22 + p * w2; + p = 12475304481671779e-21 + p * w2; + p = -47318229009055734e-21 + p * w2; + p = 6828485145957318e-20 + p * w2; + p = 24031110387097894e-21 + p * w2; + p = -3550375203628475e-19 + p * w2; + p = 9532893797373805e-19 + p * w2; + p = -0.0016882755560235047 + p * w2; + p = 0.002491442096107851 + p * w2; + p = -0.003751208507569241 + p * w2; + p = 0.005370914553590064 + p * w2; + p = 1.0052589676941592 + p * w2; + p = 3.0838856104922208 + p * w2; + } else if (Number.isFinite(w2)) { + w2 = Math.sqrt(w2) - 5; + p = -27109920616438573e-27; + p = -2555641816996525e-25 + p * w2; + p = 15076572693500548e-25 + p * w2; + p = -3789465440126737e-24 + p * w2; + p = 761570120807834e-23 + p * w2; + p = -1496002662714924e-23 + p * w2; + p = 2914795345090108e-23 + p * w2; + p = -6771199775845234e-23 + p * w2; + p = 22900482228026655e-23 + p * w2; + p = -99298272942317e-20 + p * w2; + p = 4526062597223154e-21 + p * w2; + p = -1968177810553167e-20 + p * w2; + p = 7599527703001776e-20 + p * w2; + p = -21503011930044477e-20 + p * w2; + p = -13871931833623122e-20 + p * w2; + p = 1.0103004648645344 + p * w2; + p = 4.849906401408584 + p * w2; + } else { + p = Infinity; + } + return p * x2; + } + function gaussian(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; + } else { + return mu; + } + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; + } + }, + sample: () => sampleNormal(mu, sigma), + pdf: (value2) => densityNormal(value2, mu, sigma), + cdf: (value2) => cumulativeNormal(value2, mu, sigma), + icdf: (p) => quantileNormal(p, mu, sigma) }; - TextFieldBase.prototype.componentDidUpdate = function(prevProps, prevState, snapshot) { - var props = this.props; - var _a = (snapshot || {}).selection, selection = _a === void 0 ? [ - null, - null - ] : _a; - var start = selection[0], end = selection[1]; - if (!!prevProps.multiline !== !!props.multiline && prevState.isFocused) { - // The text field has just changed between single- and multi-line, so we need to reset focus - // and selection/cursor. - this.focus(); - if (start !== null && end !== null && start >= 0 && end >= 0) this.setSelectionRange(start, end); + return dist2.mean(mean2).stdev(stdev); + } + function kde(support, bandwidth2) { + const kernel = gaussian(); + let n = 0; + const dist2 = { + data(_) { + if (arguments.length) { + support = _; + n = _ ? _.length : 0; + return dist2.bandwidth(bandwidth2); + } else { + return support; + } + }, + bandwidth(_) { + if (!arguments.length) return bandwidth2; + bandwidth2 = _; + if (!bandwidth2 && support) bandwidth2 = estimateBandwidth(support); + return dist2; + }, + sample() { + return support[~~(random() * n)] + bandwidth2 * kernel.sample(); + }, + pdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.pdf((x2 - support[i]) / bandwidth2); } - if (prevProps.value !== props.value) // Only if the value in props changed, reset the record of the last value seen by a - // change/input event (don't do this if the value in state changed, since at least in tests - // the state update may happen before the second event in a series) - this._lastChangeValue = undefined; - var prevValue = _getValue(prevProps, prevState); - var value = this.value; - if (prevValue !== value) { - // Handle controlled/uncontrolled warnings and status - this._warnControlledUsage(prevProps); - // Clear error message if needed - // TODO: is there any way to do this without an extra render? - if (this.state.errorMessage && !props.errorMessage) this.setState({ - errorMessage: '' - }); - // Adjust height if needed based on new value - this._adjustInputHeight(); - // TODO: #5875 added logic to trigger validation in componentWillReceiveProps and other places. - // This seems a bit odd and hard to integrate with the new approach. - // (Starting to think we should just put the validation logic in a separate wrapper component...?) - if (_shouldValidateAllChanges(props)) this._delayedValidate(value); + return y2 / bandwidth2 / n; + }, + cdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.cdf((x2 - support[i]) / bandwidth2); } + return y2 / n; + }, + icdf() { + throw Error("KDE icdf not supported."); + } }; - TextFieldBase.prototype.render = function() { - var _a = this.props, borderless = _a.borderless, className = _a.className, disabled = _a.disabled, invalid = _a.invalid, iconProps = _a.iconProps, inputClassName = _a.inputClassName, label = _a.label, multiline = _a.multiline, required = _a.required, underlined = _a.underlined, prefix = _a.prefix, resizable = _a.resizable, suffix = _a.suffix, theme = _a.theme, styles = _a.styles, autoAdjustHeight = _a.autoAdjustHeight, canRevealPassword = _a.canRevealPassword, revealPasswordAriaLabel = _a.revealPasswordAriaLabel, type = _a.type, _b = _a.onRenderPrefix, onRenderPrefix = _b === void 0 ? this._onRenderPrefix : _b, _c = _a.onRenderSuffix, onRenderSuffix = _c === void 0 ? this._onRenderSuffix : _c, _d = _a.onRenderLabel, onRenderLabel = _d === void 0 ? this._onRenderLabel : _d, _e = _a.onRenderDescription, onRenderDescription = _e === void 0 ? this._onRenderDescription : _e; - var _f = this.state, isFocused = _f.isFocused, isRevealingPassword = _f.isRevealingPassword; - var errorMessage = this._errorMessage; - var isInvalid = typeof invalid === 'boolean' ? invalid : !!errorMessage; - var hasRevealButton = !!canRevealPassword && type === 'password' && _browserNeedsRevealButton(); - var classNames = this._classNames = getClassNames(styles, { - theme: theme, - className: className, - disabled: disabled, - focused: isFocused, - required: required, - multiline: multiline, - hasLabel: !!label, - hasErrorMessage: isInvalid, - borderless: borderless, - resizable: resizable, - hasIcon: !!iconProps, - underlined: underlined, - inputClassName: inputClassName, - autoAdjustHeight: autoAdjustHeight, - hasRevealButton: hasRevealButton - }); - return(// eslint-disable-next-line deprecation/deprecation - _react.createElement("div", { - ref: this.props.elementRef, - className: classNames.root - }, _react.createElement("div", { - className: classNames.wrapper - }, onRenderLabel(this.props, this._onRenderLabel), _react.createElement("div", { - className: classNames.fieldGroup - }, (prefix !== undefined || this.props.onRenderPrefix) && _react.createElement("div", { - className: classNames.prefix, - id: this._prefixId - }, onRenderPrefix(this.props, this._onRenderPrefix)), multiline ? this._renderTextArea() : this._renderInput(), iconProps && _react.createElement((0, _icon.Icon), (0, _tslib.__assign)({ - className: classNames.icon - }, iconProps)), hasRevealButton && // Explicitly set type="button" since the default button type within a form is "submit" - _react.createElement("button", { - "aria-label": revealPasswordAriaLabel, - className: classNames.revealButton, - onClick: this._onRevealButtonClick, - "aria-pressed": !!isRevealingPassword, - type: "button" - }, _react.createElement("span", { - className: classNames.revealSpan - }, _react.createElement((0, _icon.Icon), { - className: classNames.revealIcon, - iconName: isRevealingPassword ? HIDE_ICON_NAME : REVEAL_ICON_NAME - }))), (suffix !== undefined || this.props.onRenderSuffix) && _react.createElement("div", { - className: classNames.suffix, - id: this._suffixId - }, onRenderSuffix(this.props, this._onRenderSuffix)))), this._isDescriptionAvailable && _react.createElement("span", { - id: this._descriptionId - }, onRenderDescription(this.props, this._onRenderDescription), errorMessage && _react.createElement("div", { - role: "alert" - }, _react.createElement((0, _utilities.DelayedRender), null, this._renderErrorMessage()))))); - }; - /** - * Sets focus on the text field - */ TextFieldBase.prototype.focus = function() { - if (this._textElement.current) this._textElement.current.focus(); - }; - /** - * Blurs the text field. - */ TextFieldBase.prototype.blur = function() { - if (this._textElement.current) this._textElement.current.blur(); + return dist2.data(support); + } + function sampleLogNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + return Math.exp(mean2 + sampleNormal() * stdev); + } + function densityLogNormal(value2, mean2, stdev) { + if (value2 <= 0) return 0; + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z2 = (Math.log(value2) - mean2) / stdev; + return Math.exp(-0.5 * z2 * z2) / (stdev * SQRT2PI * value2); + } + function cumulativeLogNormal(value2, mean2, stdev) { + return cumulativeNormal(Math.log(value2), mean2, stdev); + } + function quantileLogNormal(p, mean2, stdev) { + return Math.exp(quantileNormal(p, mean2, stdev)); + } + function lognormal(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; + } else { + return mu; + } + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; + } + }, + sample: () => sampleLogNormal(mu, sigma), + pdf: (value2) => densityLogNormal(value2, mu, sigma), + cdf: (value2) => cumulativeLogNormal(value2, mu, sigma), + icdf: (p) => quantileLogNormal(p, mu, sigma) }; - /** - * Selects the text field - */ TextFieldBase.prototype.select = function() { - if (this._textElement.current) this._textElement.current.select(); + return dist2.mean(mean2).stdev(stdev); + } + function mixture$1(dists, weights) { + let m2 = 0, w2; + function normalize2(x2) { + const w3 = []; + let sum2 = 0, i; + for (i = 0; i < m2; ++i) { + sum2 += w3[i] = x2[i] == null ? 1 : +x2[i]; + } + for (i = 0; i < m2; ++i) { + w3[i] /= sum2; + } + return w3; + } + const dist2 = { + weights(_) { + if (arguments.length) { + w2 = normalize2(weights = _ || []); + return dist2; + } + return weights; + }, + distributions(_) { + if (arguments.length) { + if (_) { + m2 = _.length; + dists = _; + } else { + m2 = 0; + dists = []; + } + return dist2.weights(weights); + } + return dists; + }, + sample() { + const r = random(); + let d2 = dists[m2 - 1], v = w2[0], i = 0; + for (; i < m2 - 1; v += w2[++i]) { + if (r < v) { + d2 = dists[i]; + break; + } + } + return d2.sample(); + }, + pdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].pdf(x2); + } + return p; + }, + cdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].cdf(x2); + } + return p; + }, + icdf() { + throw Error("Mixture icdf not supported."); + } }; - /** - * Sets the selection start of the text field to a specified value - */ TextFieldBase.prototype.setSelectionStart = function(value) { - if (this._textElement.current) this._textElement.current.selectionStart = value; + return dist2.distributions(dists).weights(weights); + } + function sampleUniform(min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return min2 + (max2 - min2) * random(); + } + function densityUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return value2 >= min2 && value2 <= max2 ? 1 / (max2 - min2) : 0; + } + function cumulativeUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return value2 < min2 ? 0 : value2 > max2 ? 1 : (value2 - min2) / (max2 - min2); + } + function quantileUniform(p, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return p >= 0 && p <= 1 ? min2 + p * (max2 - min2) : NaN; + } + function uniform(min2, max2) { + let a2, b2; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + return dist2; + } else { + return a2; + } + }, + max(_) { + if (arguments.length) { + b2 = _ == null ? 1 : _; + return dist2; + } else { + return b2; + } + }, + sample: () => sampleUniform(a2, b2), + pdf: (value2) => densityUniform(value2, a2, b2), + cdf: (value2) => cumulativeUniform(value2, a2, b2), + icdf: (p) => quantileUniform(p, a2, b2) }; - /** - * Sets the selection end of the text field to a specified value - */ TextFieldBase.prototype.setSelectionEnd = function(value) { - if (this._textElement.current) this._textElement.current.selectionEnd = value; + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return dist2.min(min2).max(max2); + } + function constant$3(data2, x2, y2) { + let mean2 = 0, n = 0; + for (const d2 of data2) { + const val = y2(d2); + if (x2(d2) == null || val == null || isNaN(val)) continue; + mean2 += (val - mean2) / ++n; + } + return { + coef: [mean2], + predict: () => mean2, + rSquared: 0 }; - Object.defineProperty(TextFieldBase.prototype, "selectionStart", { - /** - * Gets the selection start of the text field - */ get: function() { - return this._textElement.current ? this._textElement.current.selectionStart : -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextFieldBase.prototype, "selectionEnd", { - /** - * Gets the selection end of the text field - */ get: function() { - return this._textElement.current ? this._textElement.current.selectionEnd : -1; - }, - enumerable: false, - configurable: true + } + function ols(uX, uY, uXY, uX2) { + const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; + return [intercept, slope]; + } + function points(data2, x2, y2, sort2) { + data2 = data2.filter((d3) => { + let u2 = x2(d3), v = y2(d3); + return u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v; }); - /** - * Sets the start and end positions of a selection in a text field. - * @param start - Index of the start of the selection. - * @param end - Index of the end of the selection. - */ TextFieldBase.prototype.setSelectionRange = function(start, end) { - if (this._textElement.current) this._textElement.current.setSelectionRange(start, end); - }; - TextFieldBase.prototype._warnControlledUsage = function(prevProps) { - // Show warnings if props are being used in an invalid way - (0, _utilities.warnControlledUsage)({ - componentId: this._id, - componentName: COMPONENT_NAME, - props: this.props, - oldProps: prevProps, - valueProp: 'value', - defaultValueProp: 'defaultValue', - onChangeProp: 'onChange', - readOnlyProp: 'readOnly' - }); - if (this.props.value === null && !this._hasWarnedNullValue) { - this._hasWarnedNullValue = true; - (0, _utilities.warn)("Warning: 'value' prop on '".concat(COMPONENT_NAME, "' should not be null. Consider using an ") + 'empty string to clear the component or undefined to indicate an uncontrolled component.'); - } - }; - Object.defineProperty(TextFieldBase.prototype, "_id", { - /** Returns `props.id` if available, or a fallback if not. */ get: function() { - return this.props.id || this._fallbackId; - }, - enumerable: false, - configurable: true + if (sort2) { + data2.sort((a2, b2) => x2(a2) - x2(b2)); + } + const n = data2.length, X3 = new Float64Array(n), Y3 = new Float64Array(n); + let i = 0, ux = 0, uy = 0, xv, yv, d2; + for (d2 of data2) { + X3[i] = xv = +x2(d2); + Y3[i] = yv = +y2(d2); + ++i; + ux += (xv - ux) / i; + uy += (yv - uy) / i; + } + for (i = 0; i < n; ++i) { + X3[i] -= ux; + Y3[i] -= uy; + } + return [X3, Y3, ux, uy]; + } + function visitPoints(data2, x2, y2, callback) { + let i = -1, u2, v; + for (const d2 of data2) { + u2 = x2(d2); + v = y2(d2); + if (u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v) { + callback(u2, v, ++i); + } + } + } + function rSquared(data2, x2, y2, uY, predict) { + let SSE = 0, SST = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const sse = dy - predict(dx), sst = dy - uY; + SSE += sse * sse; + SST += sst * sst; }); - Object.defineProperty(TextFieldBase.prototype, "_isControlled", { - get: function() { - return (0, _utilities.isControlled)(this.props, 'value'); - }, - enumerable: false, - configurable: true + return 1 - SSE / SST; + } + function linear(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; }); - TextFieldBase.prototype._onRenderPrefix = function(props) { - var prefix = props.prefix; - return _react.createElement("span", { - style: { - paddingBottom: '1px' - } - }, prefix); - }; - TextFieldBase.prototype._onRenderSuffix = function(props) { - var suffix = props.suffix; - return _react.createElement("span", { - style: { - paddingBottom: '1px' - } - }, suffix); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * x3; + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) }; - Object.defineProperty(TextFieldBase.prototype, "_errorMessage", { - /** - * Current error message from either `props.errorMessage` or the result of `props.onGetErrorMessage`. - * - * - If there is no validation error or we have not validated the input value, errorMessage is an empty string. - * - If we have done the validation and there is validation error, errorMessage is the validation error message. - */ get: function() { - var _a = this.props.errorMessage, errorMessage = _a === void 0 ? this.state.errorMessage : _a; - return errorMessage || ''; - }, - enumerable: false, - configurable: true + } + function log$2(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + dx = Math.log(dx); + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; }); - /** - * Renders error message based on the type of the message. - * - * - If error message is string, it will render using the built in styles. - * - If error message is an element, user has full control over how it's rendered. - */ TextFieldBase.prototype._renderErrorMessage = function() { - var errorMessage = this._errorMessage; - return errorMessage ? typeof errorMessage === 'string' ? _react.createElement("p", { - className: this._classNames.errorMessage - }, _react.createElement("span", { - "data-automation-id": "error-message" - }, errorMessage)) : _react.createElement("div", { - className: this._classNames.errorMessage, - "data-automation-id": "error-message" - }, errorMessage) : null; - }; - Object.defineProperty(TextFieldBase.prototype, "_isDescriptionAvailable", { - /** - * If a custom description render function is supplied then treat description as always available. - * Otherwise defer to the presence of description or error message text. - */ get: function() { - var props = this.props; - return !!(props.onRenderDescription || props.description || this._errorMessage); - }, - enumerable: false, - configurable: true + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * Math.log(x3); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) + }; + } + function exp$1(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2); + let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly2, xy; + visitPoints(data2, x2, y2, (_, dy) => { + dx = xv[n++]; + ly2 = Math.log(dy); + xy = dx * dy; + YL += (dy * ly2 - YL) / n; + XY += (xy - XY) / n; + XYL += (xy * ly2 - XYL) / n; + X2Y += (dx * xy - X2Y) / n; }); - TextFieldBase.prototype._renderTextArea = function() { - var _a = this.props.invalid, invalid = _a === void 0 ? !!this._errorMessage : _a; - var textAreaProps = (0, _utilities.getNativeProps)(this.props, (0, _utilities.textAreaProperties), [ - 'defaultValue' - ]); - var ariaLabelledBy = this.props['aria-labelledby'] || (this.props.label ? this._labelId : undefined); - return _react.createElement("textarea", (0, _tslib.__assign)({ - id: this._id - }, textAreaProps, { - ref: this._textElement, - value: this.value || '', - onInput: this._onInputChange, - onChange: this._onInputChange, - className: this._classNames.field, - "aria-labelledby": ariaLabelledBy, - "aria-describedby": this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'], - "aria-invalid": invalid, - "aria-label": this.props.ariaLabel, - readOnly: this.props.readOnly, - onFocus: this._onFocus, - onBlur: this._onBlur - })); + const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x3) => Math.exp(c0 + c1 * (x3 - ux)); + return { + coef: [Math.exp(c0 - c1 * ux), c1], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) }; - TextFieldBase.prototype._renderInput = function() { - var _a = this.props, ariaLabel = _a.ariaLabel, _b = _a.invalid, invalid = _b === void 0 ? !!this._errorMessage : _b, onRenderPrefix = _a.onRenderPrefix, onRenderSuffix = _a.onRenderSuffix, prefix = _a.prefix, suffix = _a.suffix, _c = _a.type, type = _c === void 0 ? 'text' : _c, label = _a.label; - // build aria-labelledby list from label, prefix, and suffix - var labelIds = []; - label && labelIds.push(this._labelId); - (prefix !== undefined || onRenderPrefix) && labelIds.push(this._prefixId); - (suffix !== undefined || onRenderSuffix) && labelIds.push(this._suffixId); - var inputProps = (0, _tslib.__assign)((0, _tslib.__assign)({ - type: this.state.isRevealingPassword ? 'text' : type, - id: this._id - }, (0, _utilities.getNativeProps)(this.props, (0, _utilities.inputProperties), [ - 'defaultValue', - 'type' - ])), { - 'aria-labelledby': this.props['aria-labelledby'] || (labelIds.length > 0 ? labelIds.join(' ') : undefined), - ref: this._textElement, - value: this.value || '', - onInput: this._onInputChange, - onChange: this._onInputChange, - className: this._classNames.field, - 'aria-label': ariaLabel, - 'aria-describedby': this._isDescriptionAvailable ? this._descriptionId : this.props['aria-describedby'], - 'aria-invalid': invalid, - onFocus: this._onFocus, - onBlur: this._onBlur - }); - var defaultRender = function(updatedInputProps) { - return _react.createElement("input", (0, _tslib.__assign)({}, updatedInputProps)); - }; - var onRenderInput = this.props.onRenderInput || defaultRender; - return onRenderInput(inputProps, defaultRender); + } + function pow$2(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, YS = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const lx2 = Math.log(dx), ly2 = Math.log(dy); + ++n; + X3 += (lx2 - X3) / n; + Y3 += (ly2 - Y3) / n; + XY += (lx2 * ly2 - XY) / n; + X22 += (lx2 * lx2 - X22) / n; + YS += (dy - YS) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] * Math.pow(x3, coef[1]); + coef[0] = Math.exp(coef[0]); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, YS, predict) }; - TextFieldBase.prototype._validate = function(value) { - var _this = this; - // In case _validate is called again while validation promise is executing - if (this._latestValidateValue === value && _shouldValidateAllChanges(this.props)) return; - this._latestValidateValue = value; - var onGetErrorMessage = this.props.onGetErrorMessage; - var result = onGetErrorMessage && onGetErrorMessage(value || ''); - if (result !== undefined) { - if (typeof result === 'string' || !('then' in result)) { - this.setState({ - errorMessage: result - }); - this._notifyAfterValidate(value, result); - } else { - var currentValidation_1 = ++this._lastValidation; - result.then(function(errorMessage) { - if (currentValidation_1 === _this._lastValidation) _this.setState({ - errorMessage: errorMessage - }); - _this._notifyAfterValidate(value, errorMessage); - }); - } - } else this._notifyAfterValidate(value, ''); + } + function quad(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length; + let X22 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x22; + for (i = 0; i < n; ) { + dx = xv[i]; + dy = yv[i++]; + x22 = dx * dx; + X22 += (x22 - X22) / i; + X3 += (x22 * dx - X3) / i; + X4 += (x22 * x22 - X4) / i; + XY += (dx * dy - XY) / i; + X2Y += (x22 * dy - X2Y) / i; + } + const X2X2 = X4 - X22 * X22, d2 = X22 * X2X2 - X3 * X3, a2 = (X2Y * X22 - XY * X3) / d2, b2 = (XY * X2X2 - X2Y * X3) / d2, c2 = -a2 * X22, predict = (x3) => { + x3 = x3 - ux; + return a2 * x3 * x3 + b2 * x3 + c2 + uy; }; - TextFieldBase.prototype._notifyAfterValidate = function(value, errorMessage) { - if (value === this.value && this.props.onNotifyValidationResult) this.props.onNotifyValidationResult(errorMessage, value); + return { + coef: [c2 - b2 * ux + a2 * ux * ux + uy, b2 - 2 * a2 * ux, a2], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) }; - TextFieldBase.prototype._adjustInputHeight = function() { - var _a, _b; - if (this._textElement.current && this.props.autoAdjustHeight && this.props.multiline) { - var scrollTop = (_b = (_a = this.props.scrollContainerRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.scrollTop; - var textField = this._textElement.current; - textField.style.height = ''; - textField.style.height = textField.scrollHeight + 'px'; - if (scrollTop) // Safe to assert not null, otherwise we wouldn't have a scrollTop; - this.props.scrollContainerRef.current.scrollTop = scrollTop; + } + function poly(data2, x2, y2, order) { + if (order === 0) return constant$3(data2, x2, y2); + if (order === 1) return linear(data2, x2, y2); + if (order === 2) return quad(data2, x2, y2); + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length, lhs = [], rhs = [], k = order + 1; + let i, j, l, v, c2; + for (i = 0; i < k; ++i) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i) * yv[l]; + } + lhs.push(v); + c2 = new Float64Array(k); + for (j = 0; j < k; ++j) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i + j); } + c2[j] = v; + } + rhs.push(c2); + } + rhs.push(lhs); + const coef = gaussianElimination(rhs), predict = (x3) => { + x3 -= ux; + let y3 = uy + coef[0] + coef[1] * x3 + coef[2] * x3 * x3; + for (i = 3; i < k; ++i) y3 += coef[i] * Math.pow(x3, i); + return y3; }; - TextFieldBase.defaultProps = { - resizable: true, - deferredValidationTime: 200, - validateOnLoad: true + return { + coef: uncenter(k, coef, -ux, uy), + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) }; - return TextFieldBase; -}(_react.Component); -/** Get the value from the given state and props (converting from number to string if needed) */ function _getValue(props, state) { - var _a = props.value, value = _a === void 0 ? state.uncontrolledValue : _a; - if (typeof value === 'number') // not allowed per typings, but happens anyway - return String(value); - return value; -} -/** - * If `validateOnFocusIn` or `validateOnFocusOut` is true, validation should run **only** on that event. - * Otherwise, validation should run on every change. - */ function _shouldValidateAllChanges(props) { - return !(props.validateOnFocusIn || props.validateOnFocusOut); -} -// Only calculate this once across all TextFields, since will stay the same -var __browserNeedsRevealButton; -function _browserNeedsRevealButton() { - if (typeof __browserNeedsRevealButton !== 'boolean') { - var win = (0, _utilities.getWindow)(); - if (win === null || win === void 0 ? void 0 : win.navigator) { - // Edge, Chromium Edge - var isEdge = /Edg/.test(win.navigator.userAgent || ''); - __browserNeedsRevealButton = !((0, _utilities.isIE11)() || isEdge); - } else __browserNeedsRevealButton = true; + } + function uncenter(k, a2, x2, y2) { + const z2 = Array(k); + let i, j, v, c2; + for (i = 0; i < k; ++i) z2[i] = 0; + for (i = k - 1; i >= 0; --i) { + v = a2[i]; + c2 = 1; + z2[i] += v; + for (j = 1; j <= i; ++j) { + c2 *= (i + 1 - j) / j; + z2[i - j] += v * Math.pow(x2, j) * c2; + } + } + z2[0] += y2; + return z2; + } + function gaussianElimination(matrix) { + const n = matrix.length - 1, coef = []; + let i, j, k, r, t; + for (i = 0; i < n; ++i) { + r = i; + for (j = i + 1; j < n; ++j) { + if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { + r = j; + } + } + for (k = i; k < n + 1; ++k) { + t = matrix[k][i]; + matrix[k][i] = matrix[k][r]; + matrix[k][r] = t; + } + for (j = i + 1; j < n; ++j) { + for (k = n; k >= i; k--) { + matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; + } + } + } + for (j = n - 1; j >= 0; --j) { + t = 0; + for (k = j + 1; k < n; ++k) { + t += matrix[k][j] * coef[k]; + } + coef[j] = (matrix[n][j] - t) / matrix[j][j]; + } + return coef; + } + const maxiters = 2, epsilon$6 = 1e-12; + function loess(data2, x2, y2, bandwidth2) { + const [xv, yv, ux, uy] = points(data2, x2, y2, true), n = xv.length, bw = Math.max(2, ~~(bandwidth2 * n)), yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); + for (let iter = -1; ++iter <= maxiters; ) { + const interval2 = [0, bw - 1]; + for (let i = 0; i < n; ++i) { + const dx = xv[i], i0 = interval2[0], i1 = interval2[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; + let W = 0, X3 = 0, Y3 = 0, XY = 0, X22 = 0; + const denom = 1 / Math.abs(xv[edge] - dx || 1); + for (let k = i0; k <= i1; ++k) { + const xk = xv[k], yk = yv[k], w2 = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w2; + W += w2; + X3 += xkw; + Y3 += yk * w2; + XY += yk * xkw; + X22 += xk * xkw; + } + const [a2, b2] = ols(X3 / W, Y3 / W, XY / W, X22 / W); + yhat[i] = a2 + b2 * dx; + residuals[i] = Math.abs(yv[i] - yhat[i]); + updateInterval(xv, i + 1, interval2); + } + if (iter === maxiters) { + break; + } + const medianResidual = median(residuals); + if (Math.abs(medianResidual) < epsilon$6) break; + for (let i = 0, arg, w2; i < n; ++i) { + arg = residuals[i] / (6 * medianResidual); + robustWeights[i] = arg >= 1 ? epsilon$6 : (w2 = 1 - arg * arg) * w2; + } + } + return output$1(xv, yhat, ux, uy); + } + function tricube(x2) { + return (x2 = 1 - x2 * x2 * x2) * x2 * x2; + } + function updateInterval(xv, i, interval2) { + const val = xv[i]; + let left = interval2[0], right = interval2[1] + 1; + if (right >= xv.length) return; + while (i > left && xv[right] - val <= val - xv[left]) { + interval2[0] = ++left; + interval2[1] = right; + ++right; + } + } + function output$1(xv, yhat, ux, uy) { + const n = xv.length, out = []; + let i = 0, cnt = 0, prev = [], v; + for (; i < n; ++i) { + v = xv[i] + ux; + if (prev[0] === v) { + prev[1] += (yhat[i] - prev[1]) / ++cnt; + } else { + cnt = 0; + prev[1] += uy; + prev = [v, yhat[i]]; + out.push(prev); + } + } + prev[1] += uy; + return out; + } + const MIN_RADIANS = 0.5 * Math.PI / 180; + function sampleCurve(f, extent2, minSteps, maxSteps) { + minSteps = minSteps || 25; + maxSteps = Math.max(minSteps, maxSteps || 200); + const point2 = (x2) => [x2, f(x2)], minX = extent2[0], maxX = extent2[1], span2 = maxX - minX, stop2 = span2 / maxSteps, prev = [point2(minX)], next = []; + if (minSteps === maxSteps) { + for (let i = 1; i < maxSteps; ++i) { + prev.push(point2(minX + i / minSteps * span2)); + } + prev.push(point2(maxX)); + return prev; + } else { + next.push(point2(maxX)); + for (let i = minSteps; --i > 0; ) { + next.push(point2(minX + i / minSteps * span2)); + } + } + let p02 = prev[0]; + let p1 = next[next.length - 1]; + const sx = 1 / span2; + const sy = scaleY(p02[1], next); + while (p1) { + const pm = point2((p02[0] + p1[0]) / 2); + const dx = pm[0] - p02[0] >= stop2; + if (dx && angleDelta(p02, pm, p1, sx, sy) > MIN_RADIANS) { + next.push(pm); + } else { + p02 = p1; + prev.push(p1); + next.pop(); + } + p1 = next[next.length - 1]; + } + return prev; + } + function scaleY(init2, points2) { + let ymin = init2; + let ymax = init2; + const n = points2.length; + for (let i = 0; i < n; ++i) { + const y2 = points2[i][1]; + if (y2 < ymin) ymin = y2; + if (y2 > ymax) ymax = y2; + } + return 1 / (ymax - ymin); + } + function angleDelta(p, q, r, sx, sy) { + const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])), a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0])); + return Math.abs(a0 - a1); + } + function multikey(f) { + return (x2) => { + const n = f.length; + let i = 1, k = String(f[0](x2)); + for (; i < n; ++i) { + k += "|" + f[i](x2); + } + return k; + }; + } + function groupkey(fields) { + return !fields || !fields.length ? function() { + return ""; + } : fields.length === 1 ? fields[0] : multikey(fields); + } + function measureName(op, field2, as) { + return as || op + (!field2 ? "" : "_" + field2); + } + const noop$4 = () => { + }; + const base_op = { + init: noop$4, + add: noop$4, + rem: noop$4, + idx: 0 + }; + const AggregateOps = { + values: { + init: (m2) => m2.cell.store = true, + value: (m2) => m2.cell.data.values(), + idx: -1 + }, + count: { + value: (m2) => m2.cell.num + }, + __count__: { + value: (m2) => m2.missing + m2.valid + }, + missing: { + value: (m2) => m2.missing + }, + valid: { + value: (m2) => m2.valid + }, + sum: { + init: (m2) => m2.sum = 0, + value: (m2) => m2.valid ? m2.sum : void 0, + add: (m2, v) => m2.sum += +v, + rem: (m2, v) => m2.sum -= v + }, + product: { + init: (m2) => m2.product = 1, + value: (m2) => m2.valid ? m2.product : void 0, + add: (m2, v) => m2.product *= v, + rem: (m2, v) => m2.product /= v + }, + mean: { + init: (m2) => m2.mean = 0, + value: (m2) => m2.valid ? m2.mean : void 0, + add: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean += m2.mean_d / m2.valid), + rem: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean -= m2.valid ? m2.mean_d / m2.valid : m2.mean) + }, + average: { + value: (m2) => m2.valid ? m2.mean : void 0, + req: ["mean"], + idx: 1 + }, + variance: { + init: (m2) => m2.dev = 0, + value: (m2) => m2.valid > 1 ? m2.dev / (m2.valid - 1) : void 0, + add: (m2, v) => m2.dev += m2.mean_d * (v - m2.mean), + rem: (m2, v) => m2.dev -= m2.mean_d * (v - m2.mean), + req: ["mean"], + idx: 1 + }, + variancep: { + value: (m2) => m2.valid > 1 ? m2.dev / m2.valid : void 0, + req: ["variance"], + idx: 2 + }, + stdev: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid - 1)) : void 0, + req: ["variance"], + idx: 2 + }, + stdevp: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / m2.valid) : void 0, + req: ["variance"], + idx: 2 + }, + stderr: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid * (m2.valid - 1))) : void 0, + req: ["variance"], + idx: 2 + }, + distinct: { + value: (m2) => m2.cell.data.distinct(m2.get), + req: ["values"], + idx: 3 + }, + ci0: { + value: (m2) => m2.cell.data.ci0(m2.get), + req: ["values"], + idx: 3 + }, + ci1: { + value: (m2) => m2.cell.data.ci1(m2.get), + req: ["values"], + idx: 3 + }, + median: { + value: (m2) => m2.cell.data.q2(m2.get), + req: ["values"], + idx: 3 + }, + q1: { + value: (m2) => m2.cell.data.q1(m2.get), + req: ["values"], + idx: 3 + }, + q3: { + value: (m2) => m2.cell.data.q3(m2.get), + req: ["values"], + idx: 3 + }, + min: { + init: (m2) => m2.min = void 0, + value: (m2) => m2.min = Number.isNaN(m2.min) ? m2.cell.data.min(m2.get) : m2.min, + add: (m2, v) => { + if (v < m2.min || m2.min === void 0) m2.min = v; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.min = NaN; + }, + req: ["values"], + idx: 4 + }, + max: { + init: (m2) => m2.max = void 0, + value: (m2) => m2.max = Number.isNaN(m2.max) ? m2.cell.data.max(m2.get) : m2.max, + add: (m2, v) => { + if (v > m2.max || m2.max === void 0) m2.max = v; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.max = NaN; + }, + req: ["values"], + idx: 4 + }, + argmin: { + init: (m2) => m2.argmin = void 0, + value: (m2) => m2.argmin || m2.cell.data.argmin(m2.get), + add: (m2, v, t) => { + if (v < m2.min) m2.argmin = t; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.argmin = void 0; + }, + req: ["min", "values"], + idx: 3 + }, + argmax: { + init: (m2) => m2.argmax = void 0, + value: (m2) => m2.argmax || m2.cell.data.argmax(m2.get), + add: (m2, v, t) => { + if (v > m2.max) m2.argmax = t; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.argmax = void 0; + }, + req: ["max", "values"], + idx: 3 + }, + exponential: { + init: (m2, r) => { + m2.exp = 0; + m2.exp_r = r; + }, + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) / (1 - m2.exp_r ** m2.valid) : void 0, + add: (m2, v) => m2.exp = m2.exp_r * m2.exp + v, + rem: (m2, v) => m2.exp = (m2.exp - v / m2.exp_r ** (m2.valid - 1)) / m2.exp_r + }, + exponentialb: { + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) : void 0, + req: ["exponential"], + idx: 1 } - return __browserNeedsRevealButton; -} - -},{"tslib":"9gizs","react":"jGrId","../../Label":"8FZUu","../../Icon":"hiMUP","../../Utilities":"1NZCy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eaSCw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styling = require("../../Styling"); -var globalClassNames = { - root: 'ms-TextField', - description: 'ms-TextField-description', - errorMessage: 'ms-TextField-errorMessage', - field: 'ms-TextField-field', - fieldGroup: 'ms-TextField-fieldGroup', - prefix: 'ms-TextField-prefix', - suffix: 'ms-TextField-suffix', - wrapper: 'ms-TextField-wrapper', - revealButton: 'ms-TextField-reveal', - multiline: 'ms-TextField--multiline', - borderless: 'ms-TextField--borderless', - underlined: 'ms-TextField--underlined', - unresizable: 'ms-TextField--unresizable', - required: 'is-required', - disabled: 'is-disabled', - active: 'is-active' -}; -function getLabelStyles(props) { - var underlined = props.underlined, disabled = props.disabled, focused = props.focused, theme = props.theme; - var palette = theme.palette, fonts = theme.fonts; - return function() { - var _a; - return { - root: [ - underlined && disabled && { - color: palette.neutralTertiary - }, - underlined && { - fontSize: fonts.medium.fontSize, - marginRight: 8, - paddingLeft: 12, - paddingRight: 0, - lineHeight: '22px', - height: 32 - }, - underlined && focused && { - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - height: 31 - }, _a) - } - ] - }; + }; + const ValidAggregateOps = Object.keys(AggregateOps).filter((d2) => d2 !== "__count__"); + function measure(key2, value2) { + return (out, aggregate_param) => extend({ + name: key2, + aggregate_param, + out: out || key2 + }, base_op, value2); + } + [...ValidAggregateOps, "__count__"].forEach((key2) => { + AggregateOps[key2] = measure(key2, AggregateOps[key2]); + }); + function createMeasure(op, param2, name) { + return AggregateOps[op](name, param2); + } + function compareIndex(a2, b2) { + return a2.idx - b2.idx; + } + function resolve(agg) { + const map2 = {}; + agg.forEach((a2) => map2[a2.name] = a2); + const getreqs = (a2) => { + if (!a2.req) return; + a2.req.forEach((key2) => { + if (!map2[key2]) getreqs(map2[key2] = AggregateOps[key2]()); + }); }; -} -function getStyles(props) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; - var theme = props.theme, className = props.className, disabled = props.disabled, focused = props.focused, required = props.required, multiline = props.multiline, hasLabel = props.hasLabel, borderless = props.borderless, underlined = props.underlined, hasIcon = props.hasIcon, resizable = props.resizable, hasErrorMessage = props.hasErrorMessage, inputClassName = props.inputClassName, autoAdjustHeight = props.autoAdjustHeight, hasRevealButton = props.hasRevealButton; - var semanticColors = theme.semanticColors, effects = theme.effects, fonts = theme.fonts; - var classNames = (0, _styling.getGlobalClassNames)(globalClassNames, theme); - var fieldPrefixSuffix = { - // Suffix/Prefix are not editable so the disabled slot perfectly fits. - background: semanticColors.disabledBackground, - color: !disabled ? semanticColors.inputPlaceholderText : semanticColors.disabledText, - display: 'flex', - alignItems: 'center', - padding: '0 10px', - lineHeight: 1, - whiteSpace: 'nowrap', - flexShrink: 0, - selectors: (_a = {}, _a[0, _styling.HighContrastSelector] = { - background: 'Window', - color: disabled ? 'GrayText' : 'WindowText' - }, _a) - }; - // placeholder style constants - var placeholderStyles = [ - { - color: semanticColors.inputPlaceholderText, - opacity: 1, - selectors: (_b = {}, _b[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _b) + agg.forEach(getreqs); + return Object.values(map2).sort(compareIndex); + } + function init() { + this.valid = 0; + this.missing = 0; + this._ops.forEach((op) => op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); + } + function add$2(v, t) { + if (v == null || v === "") { + ++this.missing; + return; + } + if (v !== v) return; + ++this.valid; + this._ops.forEach((op) => op.add(this, v, t)); + } + function rem(v, t) { + if (v == null || v === "") { + --this.missing; + return; + } + if (v !== v) return; + --this.valid; + this._ops.forEach((op) => op.rem(this, v, t)); + } + function set$3(t) { + this._out.forEach((op) => t[op.out] = op.value(this)); + return t; + } + function compileMeasures(agg, field2) { + const get2 = field2 || identity$2, ops2 = resolve(agg), out = agg.slice().sort(compareIndex); + function ctr(cell2) { + this._ops = ops2; + this._out = out; + this.cell = cell2; + this.init(); + } + ctr.prototype.init = init; + ctr.prototype.add = add$2; + ctr.prototype.rem = rem; + ctr.prototype.set = set$3; + ctr.prototype.get = get2; + ctr.fields = agg.map((op) => op.out); + return ctr; + } + function TupleStore(key2) { + this._key = key2 ? field$1(key2) : tupleid; + this.reset(); + } + const prototype$1 = TupleStore.prototype; + prototype$1.reset = function() { + this._add = []; + this._rem = []; + this._ext = null; + this._get = null; + this._q = null; + }; + prototype$1.add = function(v) { + this._add.push(v); + }; + prototype$1.rem = function(v) { + this._rem.push(v); + }; + prototype$1.values = function() { + this._get = null; + if (this._rem.length === 0) return this._add; + const a2 = this._add, r = this._rem, k = this._key, n = a2.length, m2 = r.length, x2 = Array(n - m2), map2 = {}; + let i, j, v; + for (i = 0; i < m2; ++i) { + map2[k(r[i])] = 1; + } + for (i = 0, j = 0; i < n; ++i) { + if (map2[k(v = a2[i])]) { + map2[k(v)] = 0; + } else { + x2[j++] = v; + } + } + this._rem = []; + return this._add = x2; + }; + prototype$1.distinct = function(get2) { + const v = this.values(), map2 = {}; + let n = v.length, count2 = 0, s2; + while (--n >= 0) { + s2 = get2(v[n]) + ""; + if (!has$1(map2, s2)) { + map2[s2] = 1; + ++count2; + } + } + return count2; + }; + prototype$1.extent = function(get2) { + if (this._get !== get2 || !this._ext) { + const v = this.values(), i = extentIndex(v, get2); + this._ext = [v[i[0]], v[i[1]]]; + this._get = get2; + } + return this._ext; + }; + prototype$1.argmin = function(get2) { + return this.extent(get2)[0] || {}; + }; + prototype$1.argmax = function(get2) { + return this.extent(get2)[1] || {}; + }; + prototype$1.min = function(get2) { + const m2 = this.extent(get2)[0]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.max = function(get2) { + const m2 = this.extent(get2)[1]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.quartile = function(get2) { + if (this._get !== get2 || !this._q) { + this._q = quartiles(this.values(), get2); + this._get = get2; + } + return this._q; + }; + prototype$1.q1 = function(get2) { + return this.quartile(get2)[0]; + }; + prototype$1.q2 = function(get2) { + return this.quartile(get2)[1]; + }; + prototype$1.q3 = function(get2) { + return this.quartile(get2)[2]; + }; + prototype$1.ci = function(get2) { + if (this._get !== get2 || !this._ci) { + this._ci = bootstrapCI(this.values(), 1e3, 0.05, get2); + this._get = get2; + } + return this._ci; + }; + prototype$1.ci0 = function(get2) { + return this.ci(get2)[0]; + }; + prototype$1.ci1 = function(get2) { + return this.ci(get2)[1]; + }; + function Aggregate$1(params2) { + Transform.call(this, null, params2); + this._adds = []; + this._mods = []; + this._alen = 0; + this._mlen = 0; + this._drop = true; + this._cross = false; + this._dims = []; + this._dnames = []; + this._measures = []; + this._countOnly = false; + this._counts = null; + this._prev = null; + this._inputs = null; + this._outputs = null; + } + Aggregate$1.Definition = { + "type": "Aggregate", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "drop", + "type": "boolean", + "default": true + }, { + "name": "cross", + "type": "boolean", + "default": false + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Aggregate$1, Transform, { + transform(_, pulse2) { + const aggr = this, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), mod = _.modified(); + aggr.stamp = out.stamp; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + aggr._prev = aggr.value; + aggr.value = mod ? aggr.init(_) : /* @__PURE__ */ Object.create(null); + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + aggr.value = aggr.value || aggr.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + out.modifies(aggr._outputs); + aggr._drop = _.drop !== false; + if (_.cross && aggr._dims.length > 1) { + aggr._drop = false; + aggr.cross(); + } + if (pulse2.clean() && aggr._drop) { + out.clean(true).runAfter(() => this.clean()); + } + return aggr.changes(out); + }, + cross() { + const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(() => ({})), n = dims.length; + function collect2(cells) { + let key2, i, t, v; + for (key2 in cells) { + t = cells[key2].tuple; + for (i = 0; i < n; ++i) { + vals[i][v = t[dims[i]]] = v; + } } - ]; - var disabledPlaceholderStyles = { - color: semanticColors.disabledText, - selectors: (_c = {}, _c[0, _styling.HighContrastSelector] = { - color: 'GrayText' - }, _c) - }; - return { - root: [ - classNames.root, - fonts.medium, - required && classNames.required, - disabled && classNames.disabled, - focused && classNames.active, - multiline && classNames.multiline, - borderless && classNames.borderless, - underlined && classNames.underlined, - (0, _styling.normalize), - { - position: 'relative' - }, - className - ], - wrapper: [ - classNames.wrapper, - underlined && [ - { - display: 'flex', - borderBottom: "1px solid ".concat(!hasErrorMessage ? semanticColors.inputBorder : semanticColors.errorText), - width: '100%' - }, - disabled && { - borderBottomColor: semanticColors.disabledBackground, - selectors: (_d = {}, _d[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _d) - }, - !disabled && { - selectors: { - ':hover': { - borderBottomColor: !hasErrorMessage ? semanticColors.inputBorderHovered : semanticColors.errorText, - selectors: (_e = {}, _e[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderBottomColor: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _e) - } - } - }, - focused && [ - { - position: 'relative' - }, - (0, _styling.getInputFocusStyle)(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, 0, 'borderBottom') - ] - ] - ], - fieldGroup: [ - classNames.fieldGroup, - (0, _styling.normalize), - { - border: "1px solid ".concat(semanticColors.inputBorder), - borderRadius: effects.roundedCorner2, - background: semanticColors.inputBackground, - cursor: 'text', - height: 32, - display: 'flex', - flexDirection: 'row', - alignItems: 'stretch', - position: 'relative' - }, - multiline && { - minHeight: '60px', - height: 'auto', - display: 'flex' - }, - !focused && !disabled && { - selectors: { - ':hover': { - borderColor: semanticColors.inputBorderHovered, - selectors: (_f = {}, _f[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'Highlight' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _f) - } - } - }, - focused && !underlined && (0, _styling.getInputFocusStyle)(!hasErrorMessage ? semanticColors.inputFocusBorderAlt : semanticColors.errorText, effects.roundedCorner2), - disabled && { - borderColor: semanticColors.disabledBackground, - selectors: (_g = {}, _g[0, _styling.HighContrastSelector] = (0, _tslib.__assign)({ - borderColor: 'GrayText' - }, (0, _styling.getHighContrastNoAdjustStyle)()), _g), - cursor: 'default' - }, - borderless && { - border: 'none' - }, - borderless && focused && { - border: 'none', - selectors: { - ':after': { - border: 'none' - } - } - }, - underlined && { - flex: '1 1 0px', - border: 'none', - textAlign: 'left' - }, - underlined && disabled && { - backgroundColor: 'transparent' - }, - hasErrorMessage && !underlined && { - borderColor: semanticColors.errorText, - selectors: { - '&:hover': { - borderColor: semanticColors.errorText - } - } - }, - !hasLabel && required && { - selectors: (_h = { - ':before': { - content: "'*'", - color: semanticColors.errorText, - position: 'absolute', - top: -5, - right: -10 - } - }, _h[0, _styling.HighContrastSelector] = { - selectors: { - ':before': { - color: 'WindowText', - right: -14 - } - } - }, _h) - } - ], - field: [ - fonts.medium, - classNames.field, - (0, _styling.normalize), - { - borderRadius: 0, - border: 'none', - background: 'none', - backgroundColor: 'transparent', - color: semanticColors.inputText, - padding: '0 8px', - width: '100%', - minWidth: 0, - textOverflow: 'ellipsis', - outline: 0, - selectors: (_j = { - '&:active, &:focus, &:hover': { - outline: 0 - }, - '::-ms-clear': { - display: 'none' - } - }, _j[0, _styling.HighContrastSelector] = { - background: 'Window', - color: disabled ? 'GrayText' : 'WindowText' - }, _j) - }, - (0, _styling.getPlaceholderStyles)(placeholderStyles), - multiline && !resizable && [ - classNames.unresizable, - { - resize: 'none' - } - ], - multiline && { - minHeight: 'inherit', - lineHeight: 17, - flexGrow: 1, - paddingTop: 6, - paddingBottom: 6, - overflow: 'auto', - width: '100%' - }, - multiline && autoAdjustHeight && { - overflow: 'hidden' - }, - hasIcon && !hasRevealButton && { - paddingRight: 24 - }, - multiline && hasIcon && { - paddingRight: 40 - }, - disabled && [ - { - backgroundColor: semanticColors.disabledBackground, - color: semanticColors.disabledText, - borderColor: semanticColors.disabledBackground - }, - (0, _styling.getPlaceholderStyles)(disabledPlaceholderStyles) - ], - underlined && { - textAlign: 'left' - }, - focused && !borderless && { - selectors: (_k = {}, _k[0, _styling.HighContrastSelector] = { - paddingLeft: 11, - paddingRight: 11 - }, _k) - }, - focused && multiline && !borderless && { - selectors: (_l = {}, _l[0, _styling.HighContrastSelector] = { - paddingTop: 4 - }, _l) - }, - inputClassName - ], - icon: [ - multiline && { - paddingRight: 24, - alignItems: 'flex-end' - }, - { - pointerEvents: 'none', - position: 'absolute', - bottom: 6, - right: 8, - top: 'auto', - fontSize: (0, _styling.IconFontSizes).medium, - lineHeight: 18 - }, - disabled && { - color: semanticColors.disabledText - } - ], - description: [ - classNames.description, - { - color: semanticColors.bodySubtext, - fontSize: fonts.xSmall.fontSize - } - ], - errorMessage: [ - classNames.errorMessage, - (0, _styling.AnimationClassNames).slideDownIn20, - fonts.small, - { - color: semanticColors.errorText, - margin: 0, - paddingTop: 5, - display: 'flex', - alignItems: 'center' - } - ], - prefix: [ - classNames.prefix, - fieldPrefixSuffix - ], - suffix: [ - classNames.suffix, - fieldPrefixSuffix - ], - revealButton: [ - classNames.revealButton, - 'ms-Button', - 'ms-Button--icon', - (0, _styling.getFocusStyle)(theme, { - inset: 1 - }), - { - height: 30, - width: 32, - border: 'none', - padding: '0px 4px', - backgroundColor: 'transparent', - color: semanticColors.link, - selectors: { - ':hover': { - outline: 0, - color: semanticColors.primaryButtonBackgroundHovered, - backgroundColor: semanticColors.buttonBackgroundHovered, - selectors: (_m = {}, _m[0, _styling.HighContrastSelector] = { - borderColor: 'Highlight', - color: 'Highlight' - }, _m) - }, - ':focus': { - outline: 0 - } - } - }, - hasIcon && { - marginRight: 28 - } - ], - revealSpan: { - display: 'flex', - height: '100%', - alignItems: 'center' - }, - revealIcon: { - margin: '0px 4px', - pointerEvents: 'none', - bottom: 6, - right: 8, - top: 'auto', - fontSize: (0, _styling.IconFontSizes).medium, - lineHeight: 18 - }, - subComponentStyles: { - label: getLabelStyles(props) - } - }; -} - -},{"tslib":"9gizs","../../Styling":"hTimn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cpdGU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _index = require("./components/Toggle/index"); -parcelHelpers.exportAll(_index, exports); - -},{"./components/Toggle/index":"ejet7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ejet7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _toggle = require("./Toggle"); -parcelHelpers.exportAll(_toggle, exports); -var _toggleBase = require("./Toggle.base"); -parcelHelpers.exportAll(_toggleBase, exports); -var _toggleTypes = require("./Toggle.types"); -parcelHelpers.exportAll(_toggleTypes, exports); - -},{"./Toggle":"1L6df","./Toggle.base":false,"./Toggle.types":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1L6df":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Toggle", ()=>Toggle); -var _utilities = require("@fluentui/utilities"); -var _toggleBase = require("./Toggle.base"); -var _toggleStyles = require("./Toggle.styles"); -var Toggle = (0, _utilities.styled)((0, _toggleBase.ToggleBase), (0, _toggleStyles.getStyles), undefined, { - scope: 'Toggle' -}); - -},{"@fluentui/utilities":"55bj3","./Toggle.base":"fZ4mc","./Toggle.styles":"2Ls2q","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fZ4mc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ToggleBase", ()=>ToggleBase); -var _tslib = require("tslib"); -var _react = require("react"); -var _reactHooks = require("@fluentui/react-hooks"); -var _utilities = require("@fluentui/utilities"); -var _label = require("../Label/Label"); -var getClassNames = (0, _utilities.classNamesFunction)(); -var COMPONENT_NAME = 'Toggle'; -var ToggleBase = _react.forwardRef(function(props, forwardedRef) { - var _a = props.as, RootType = _a === void 0 ? 'div' : _a, ariaLabel = props.ariaLabel, controlledChecked = props.checked, className = props.className, _b = props.defaultChecked, defaultChecked = _b === void 0 ? false : _b, disabled = props.disabled, inlineLabel = props.inlineLabel, label = props.label, // eslint-disable-next-line deprecation/deprecation - offAriaLabel = props.offAriaLabel, offText = props.offText, // eslint-disable-next-line deprecation/deprecation - onAriaLabel = props.onAriaLabel, onChange = props.onChange, // eslint-disable-next-line deprecation/deprecation - onChanged = props.onChanged, onToggleClick = props.onClick, onText = props.onText, role = props.role, styles = props.styles, theme = props.theme; - var _c = (0, _reactHooks.useControllableValue)(controlledChecked, defaultChecked, _react.useCallback(function(ev, isChecked) { - onChange === null || onChange === void 0 || onChange(ev, isChecked); - onChanged === null || onChanged === void 0 || onChanged(isChecked); - }, [ - onChange, - onChanged - ])), checked = _c[0], setChecked = _c[1]; - var classNames = getClassNames(styles, { - theme: theme, - className: className, - disabled: disabled, - checked: checked, - inlineLabel: inlineLabel, - onOffMissing: !onText && !offText - }); - var badAriaLabel = checked ? onAriaLabel : offAriaLabel; - var id = (0, _reactHooks.useId)(COMPONENT_NAME, props.id); - var labelId = "".concat(id, "-label"); - var stateTextId = "".concat(id, "-stateText"); - var stateText = checked ? onText : offText; - var toggleNativeProps = (0, _utilities.getNativeProps)(props, (0, _utilities.inputProperties), [ - 'defaultChecked' - ]); - // The following properties take priority for what Narrator should read: - // 1. ariaLabel - // 2. onAriaLabel (if checked) or offAriaLabel (if not checked) - // 3. label, if existent - var labelledById = undefined; - if (!ariaLabel && !badAriaLabel) { - if (label) labelledById = labelId; - if (stateText && !labelledById) labelledById = stateTextId; - } - var toggleButton = _react.useRef(null); - (0, _utilities.useFocusRects)(toggleButton); - useComponentRef(props, checked, toggleButton); - var onClick = function(ev) { - if (!disabled) { - setChecked(!checked, ev); - if (onToggleClick) onToggleClick(ev); + } + collect2(aggr._prev); + collect2(curr); + function generate2(base2, tuple, index2) { + const name = dims[index2], v = vals[index2++]; + for (const k in v) { + const key2 = base2 ? base2 + "|" + k : k; + tuple[name] = v[k]; + if (index2 < n) generate2(key2, tuple, index2); + else if (!curr[key2]) aggr.cell(key2, tuple); } - }; - var slotProps = { - root: { - className: classNames.root, - hidden: toggleNativeProps.hidden - }, - label: { - children: label, - className: classNames.label, - htmlFor: id, - id: labelId - }, - container: { - className: classNames.container - }, - pill: (0, _tslib.__assign)((0, _tslib.__assign)({}, toggleNativeProps), { - 'aria-disabled': disabled, - 'aria-checked': checked, - 'aria-label': ariaLabel ? ariaLabel : badAriaLabel, - 'aria-labelledby': labelledById, - className: classNames.pill, - 'data-is-focusable': true, - 'data-ktp-target': true, - disabled: disabled, - id: id, - onClick: onClick, - ref: toggleButton, - role: role ? role : 'switch', - type: 'button' - }), - thumb: { - className: classNames.thumb - }, - stateText: { - children: stateText, - className: classNames.text, - htmlFor: id, - id: stateTextId - } - }; - return _react.createElement(RootType, (0, _tslib.__assign)({ - ref: forwardedRef - }, slotProps.root), label && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.label)), _react.createElement("div", (0, _tslib.__assign)({}, slotProps.container), _react.createElement("button", (0, _tslib.__assign)({}, slotProps.pill), _react.createElement("span", (0, _tslib.__assign)({}, slotProps.thumb))), (checked && onText || offText) && _react.createElement((0, _label.Label), (0, _tslib.__assign)({}, slotProps.stateText)))); -}); -ToggleBase.displayName = COMPONENT_NAME + 'Base'; -var useComponentRef = function(props, isChecked, toggleButtonRef) { - _react.useImperativeHandle(props.componentRef, function() { - return { - get checked () { - return !!isChecked; - }, - focus: function() { - if (toggleButtonRef.current) toggleButtonRef.current.focus(); - } - }; - }, [ - isChecked, - toggleButtonRef - ]); -}; - -},{"tslib":"9gizs","react":"jGrId","@fluentui/react-hooks":"2LHjM","@fluentui/utilities":"55bj3","../Label/Label":"4UD9B","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Ls2q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStyles", ()=>getStyles); -var _tslib = require("tslib"); -var _styleUtilities = require("@fluentui/style-utilities"); -var DEFAULT_PILL_WIDTH = 40; -var DEFAULT_PILL_HEIGHT = 20; -var DEFAULT_THUMB_SIZE = 12; -var getStyles = function(props) { - var _a, _b, _c, _d, _e, _f, _g; - var theme = props.theme, className = props.className, disabled = props.disabled, checked = props.checked, inlineLabel = props.inlineLabel, onOffMissing = props.onOffMissing; - var semanticColors = theme.semanticColors, palette = theme.palette; - // Tokens - var pillUncheckedBackground = semanticColors.bodyBackground; - var pillCheckedBackground = semanticColors.inputBackgroundChecked; - var pillCheckedHoveredBackground = semanticColors.inputBackgroundCheckedHovered; - var thumbUncheckedHoveredBackground = palette.neutralDark; - var pillCheckedDisabledBackground = semanticColors.disabledBodySubtext; - var thumbBackground = semanticColors.smallInputBorder; - var thumbCheckedBackground = semanticColors.inputForegroundChecked; - var thumbDisabledBackground = semanticColors.disabledBodySubtext; - var thumbCheckedDisabledBackground = semanticColors.disabledBackground; - var pillBorderColor = semanticColors.smallInputBorder; - var pillBorderHoveredColor = semanticColors.inputBorderHovered; - var pillBorderDisabledColor = semanticColors.disabledBodySubtext; - var textDisabledColor = semanticColors.disabledText; + } + generate2("", {}, 0); + }, + init(_) { + const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; + function inputVisit(get2) { + const fields2 = array$4(accessorFields(get2)), n2 = fields2.length; + let i2 = 0, f; + for (; i2 < n2; ++i2) { + if (!inputMap[f = fields2[i2]]) { + inputMap[f] = 1; + inputs.push(f); + } + } + } + this._dims = array$4(_.groupby); + this._dnames = this._dims.map((d2) => { + const dname = accessorName(d2); + inputVisit(d2); + outputs.push(dname); + return dname; + }); + this.cellkey = _.key ? _.key : groupkey(this._dims); + this._countOnly = true; + this._counts = []; + this._measures = []; + const fields = _.fields || [null], ops2 = _.ops || ["count"], aggregate_params = _.aggregate_params || [null], as = _.as || [], n = fields.length, map2 = {}; + let field2, op, aggregate_param, m2, mname, outname, i; + if (n !== ops2.length) { + error("Unmatched number of fields and aggregate ops."); + } + for (i = 0; i < n; ++i) { + field2 = fields[i]; + op = ops2[i]; + aggregate_param = aggregate_params[i] || null; + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + mname = accessorName(field2); + outname = measureName(op, mname, as[i]); + outputs.push(outname); + if (op === "count") { + this._counts.push(outname); + continue; + } + m2 = map2[mname]; + if (!m2) { + inputVisit(field2); + m2 = map2[mname] = []; + m2.field = field2; + this._measures.push(m2); + } + if (op !== "count") this._countOnly = false; + m2.push(createMeasure(op, aggregate_param, outname)); + } + this._measures = this._measures.map((m3) => compileMeasures(m3, m3.field)); + return /* @__PURE__ */ Object.create(null); + }, + // -- Cell Management ----- + cellkey: groupkey(), + cell(key2, t) { + let cell2 = this.value[key2]; + if (!cell2) { + cell2 = this.value[key2] = this.newcell(key2, t); + this._adds[this._alen++] = cell2; + } else if (cell2.num === 0 && this._drop && cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._adds[this._alen++] = cell2; + } else if (cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._mods[this._mlen++] = cell2; + } + return cell2; + }, + newcell(key2, t) { + const cell2 = { + key: key2, + num: 0, + agg: null, + tuple: this.newtuple(t, this._prev && this._prev[key2]), + stamp: this.stamp, + store: false + }; + if (!this._countOnly) { + const measures = this._measures, n = measures.length; + cell2.agg = Array(n); + for (let i = 0; i < n; ++i) { + cell2.agg[i] = new measures[i](cell2); + } + } + if (cell2.store) { + cell2.data = new TupleStore(); + } + return cell2; + }, + newtuple(t, p) { + const names = this._dnames, dims = this._dims, n = dims.length, x2 = {}; + for (let i = 0; i < n; ++i) { + x2[names[i]] = dims[i](t); + } + return p ? replace$1(p.tuple, x2) : ingest$1(x2); + }, + clean() { + const cells = this.value; + for (const key2 in cells) { + if (cells[key2].num === 0) { + delete cells[key2]; + } + } + }, + // -- Process Tuples ----- + add(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num += 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.add(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].add(agg[i].get(t), t); + } + }, + rem(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num -= 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.rem(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].rem(agg[i].get(t), t); + } + }, + celltuple(cell2) { + const tuple = cell2.tuple, counts = this._counts; + if (cell2.store) { + cell2.data.values(); + } + for (let i = 0, n = counts.length; i < n; ++i) { + tuple[counts[i]] = cell2.num; + } + if (!this._countOnly) { + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].set(tuple); + } + } + return tuple; + }, + changes(out) { + const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add2 = out.add, rem2 = out.rem, mod = out.mod; + let cell2, key2, i, n; + if (prev) for (key2 in prev) { + cell2 = prev[key2]; + if (!drop || cell2.num) rem2.push(cell2.tuple); + } + for (i = 0, n = this._alen; i < n; ++i) { + add2.push(this.celltuple(adds[i])); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + cell2 = mods[i]; + (cell2.num === 0 && drop ? rem2 : mod).push(this.celltuple(cell2)); + mods[i] = null; + } + this._alen = this._mlen = 0; + this._prev = null; + return out; + } + }); + const EPSILON$1 = 1e-14; + function Bin(params2) { + Transform.call(this, null, params2); + } + Bin.Definition = { + "type": "Bin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "anchor", + "type": "number" + }, { + "name": "maxbins", + "type": "number", + "default": 20 + }, { + "name": "base", + "type": "number", + "default": 10 + }, { + "name": "divide", + "type": "number", + "array": true, + "default": [5, 2] + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "span", + "type": "number" + }, { + "name": "step", + "type": "number" + }, { + "name": "steps", + "type": "number", + "array": true + }, { + "name": "minstep", + "type": "number", + "default": 0 + }, { + "name": "nice", + "type": "boolean", + "default": true + }, { + "name": "name", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["bin0", "bin1"] + }] + }; + inherits(Bin, Transform, { + transform(_, pulse2) { + const band2 = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || ["bin0", "bin1"], b0 = as[0], b1 = as[1]; + let flag2; + if (_.modified()) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + } else { + flag2 = pulse2.modified(accessorFields(_.field)) ? pulse2.ADD_MOD : pulse2.ADD; + } + pulse2.visit(flag2, band2 ? (t) => { + const v = bins(t); + t[b0] = v; + t[b1] = v == null ? null : start + step * (1 + (v - start) / step); + } : (t) => t[b0] = bins(t)); + return pulse2.modifies(band2 ? as : b0); + }, + _bins(_) { + if (this.value && !_.modified()) { + return this.value; + } + const field2 = _.field, bins = bin(_), step = bins.step; + let start = bins.start, stop2 = start + Math.ceil((bins.stop - start) / step) * step, a2, d2; + if ((a2 = _.anchor) != null) { + d2 = a2 - (start + step * Math.floor((a2 - start) / step)); + start += d2; + stop2 += d2; + } + const f = function(t) { + let v = toNumber(field2(t)); + return v == null ? null : v < start ? -Infinity : v > stop2 ? Infinity : (v = Math.max(start, Math.min(v, stop2 - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step)); + }; + f.start = start; + f.stop = bins.stop; + f.step = step; + return this.value = accessor(f, accessorFields(field2), _.name || "bin_" + accessorName(field2)); + } + }); + function SortedList(idFunc, source2, input) { + const $2 = idFunc; + let data2 = source2 || [], add2 = input || [], rem2 = {}, cnt = 0; return { - root: [ - 'ms-Toggle', - checked && 'is-checked', - !disabled && 'is-enabled', - disabled && 'is-disabled', - theme.fonts.medium, - { - marginBottom: '8px' - }, - inlineLabel && { - display: 'flex', - alignItems: 'center' - }, - className - ], - label: [ - 'ms-Toggle-label', - { - display: 'inline-block' - }, - disabled && { - color: textDisabledColor, - selectors: (_a = {}, _a[0, _styleUtilities.HighContrastSelector] = { - color: 'GrayText' - }, _a) - }, - inlineLabel && !onOffMissing && { - marginRight: 16 - }, - onOffMissing && inlineLabel && { - order: 1, - marginLeft: 16 - }, - inlineLabel && { - wordBreak: 'break-word' - } - ], - container: [ - 'ms-Toggle-innerContainer', - { - display: 'flex', - position: 'relative' - } - ], - pill: [ - 'ms-Toggle-background', - (0, _styleUtilities.getFocusStyle)(theme, { - inset: -3 - }), - { - fontSize: '20px', - boxSizing: 'border-box', - width: DEFAULT_PILL_WIDTH, - height: DEFAULT_PILL_HEIGHT, - borderRadius: DEFAULT_PILL_HEIGHT / 2, - transition: 'all 0.1s ease', - border: "1px solid ".concat(pillBorderColor), - background: pillUncheckedBackground, - cursor: 'pointer', - display: 'flex', - alignItems: 'center', - padding: '0 3px', - overflow: 'visible' - }, - !disabled && [ - !checked && { - selectors: { - ':hover': [ - { - borderColor: pillBorderHoveredColor - } - ], - ':hover .ms-Toggle-thumb': [ - { - backgroundColor: thumbUncheckedHoveredBackground, - selectors: (_b = {}, _b[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _b) - } - ] - } - }, - checked && [ - { - background: pillCheckedBackground, - borderColor: 'transparent', - justifyContent: 'flex-end' - }, - { - selectors: (_c = { - ':hover': [ - { - backgroundColor: pillCheckedHoveredBackground, - borderColor: 'transparent', - selectors: (_d = {}, _d[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Highlight' - }, _d) - } - ] - }, _c[0, _styleUtilities.HighContrastSelector] = (0, _tslib.__assign)({ - backgroundColor: 'Highlight' - }, (0, _styleUtilities.getHighContrastNoAdjustStyle)()), _c) - } - ] - ], - disabled && [ - { - cursor: 'default' - }, - !checked && [ - { - borderColor: pillBorderDisabledColor - } - ], - checked && [ - { - backgroundColor: pillCheckedDisabledBackground, - borderColor: 'transparent', - justifyContent: 'flex-end' - } - ] - ], - !disabled && { - selectors: { - '&:hover': { - selectors: (_e = {}, _e[0, _styleUtilities.HighContrastSelector] = { - borderColor: 'Highlight' - }, _e) - } - } - } - ], - thumb: [ - 'ms-Toggle-thumb', - { - display: 'block', - width: DEFAULT_THUMB_SIZE, - height: DEFAULT_THUMB_SIZE, - borderRadius: '50%', - transition: 'all 0.1s ease', - backgroundColor: thumbBackground, - /* Border is added to handle high contrast mode for Firefox */ borderColor: 'transparent', - borderWidth: DEFAULT_THUMB_SIZE / 2, - borderStyle: 'solid', - boxSizing: 'border-box' - }, - !disabled && checked && [ - { - backgroundColor: thumbCheckedBackground, - selectors: (_f = {}, _f[0, _styleUtilities.HighContrastSelector] = { - backgroundColor: 'Window', - borderColor: 'Window' - }, _f) - } - ], - disabled && [ - !checked && [ - { - backgroundColor: thumbDisabledBackground - } - ], - checked && [ - { - backgroundColor: thumbCheckedDisabledBackground - } - ] - ] - ], - text: [ - 'ms-Toggle-stateText', - { - selectors: { - // Workaround: make rules more specific than Label rules. - '&&': { - padding: '0', - margin: '0 8px', - userSelect: 'none', - fontWeight: (0, _styleUtilities.FontWeights).regular - } - } - }, - disabled && { - selectors: { - '&&': { - color: textDisabledColor, - selectors: (_g = {}, _g[0, _styleUtilities.HighContrastSelector] = { - color: 'GrayText' - }, _g) - } - } - } - ] - }; -}; - -},{"tslib":"9gizs","@fluentui/style-utilities":"bJvmh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7pzEo":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SandDanceApp", ()=>SandDanceApp); -var _base = require("./base"); -var _dataSourcePicker = require("./dataSourcePicker"); -var _download = require("./download"); -var _language = require("./language"); -var _snapshots = require("./snapshots"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -function getViewerOptions(darkTheme, themeColors) { - const colors = themeColors && themeColors[darkTheme ? 'dark' : 'light']; - const viewerOptions = { - colors: Object.assign(Object.assign({}, (0, _sanddanceExplorer.getColorSettingsFromThemePalette)((0, _sanddanceExplorer.themePalettes)[darkTheme ? 'dark-theme' : ''])), colors) + add: (t) => add2.push(t), + remove: (t) => rem2[$2(t)] = ++cnt, + size: () => data2.length, + data: (compare2, resort) => { + if (cnt) { + data2 = data2.filter((t) => !rem2[$2(t)]); + rem2 = {}; + cnt = 0; + } + if (resort && compare2) { + data2.sort(compare2); + } + if (add2.length) { + data2 = compare2 ? merge$2(compare2, data2, add2.sort(compare2)) : data2.concat(add2); + add2 = []; + } + return data2; + } }; - return viewerOptions; -} -function getSnapshotFromHash() { - const hash = document.location.hash && document.location.hash.substring(1); - if (hash) try { - return JSON.parse(decodeURIComponent(hash)); - } catch (e) { - // continue regardless of error - } -} -let snapshotOnLoad = getSnapshotFromHash(); -if (snapshotOnLoad && snapshotOnLoad.dataSource && snapshotOnLoad.dataSource.dataSourceType === 'local') snapshotOnLoad = null; -class SandDanceApp extends _react.Component { - constructor(props){ - super(props); - this.state = { - compactUI: !!localStorage.getItem('compactUI'), - dialogMode: null, - dataSource: snapshotOnLoad && snapshotOnLoad.dataSource || props.dataSources[0], - darkTheme: props.darkTheme - }; - this.viewerOptions = getViewerOptions(this.state.darkTheme, props.themeColors); - this.handlers = { - hashchange: (e)=>{ - const snapshot = getSnapshotFromHash(); - if (snapshot) this.explorer && this.explorer.calculate(()=>this.hydrateSnapshot(snapshot)); - }, - resize: (e)=>{ - this.explorer && this.explorer.resize(); - } - }; - this.wireEventHandlers(true); - this.changeColorScheme(this.state.darkTheme); + } + function Collect$1(params2) { + Transform.call(this, [], params2); + } + Collect$1.Definition = { + "type": "Collect", + "metadata": { + "source": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }] + }; + inherits(Collect$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), sort2 = _.sort, mod = pulse2.changed() || sort2 && (_.modified("sort") || pulse2.modified(sort2.fields)); + out.visit(out.REM, list.remove); + this.modified(mod); + this.value = out.source = list.data(stableCompare(sort2), mod); + if (pulse2.source && pulse2.source.root) { + this.value.root = pulse2.source.root; + } + return out; } - wireEventHandlers(add) { - for(const key in this.handlers)if (add) window.addEventListener(key, this.handlers[key]); - else window.removeEventListener(key, this.handlers[key]); + }); + function Compare$1(params2) { + Operator.call(this, null, update$5, params2); + } + inherits(Compare$1, Operator); + function update$5(_) { + return this.value && !_.modified() ? this.value : compare$1(_.fields, _.orders); + } + function CountPattern(params2) { + Transform.call(this, null, params2); + } + CountPattern.Definition = { + "type": "CountPattern", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "case", + "type": "enum", + "values": ["upper", "lower", "mixed"], + "default": "mixed" + }, { + "name": "pattern", + "type": "string", + "default": '[\\w"]+' + }, { + "name": "stopwords", + "type": "string", + "default": "" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["text", "count"] + }] + }; + function tokenize(text2, tcase, match2) { + switch (tcase) { + case "upper": + text2 = text2.toUpperCase(); + break; + case "lower": + text2 = text2.toLowerCase(); + break; } - isSameDataSource(a, b) { - if (a.dataSourceType === b.dataSourceType && a.type === b.type && a.id === b.id) { - if (a.dataSourceType === 'url') return a.dataUrl === b.dataUrl; - return true; + return text2.match(match2); + } + inherits(CountPattern, Transform, { + transform(_, pulse2) { + const process = (update2) => (tuple) => { + var tokens = tokenize(get2(tuple), _.case, match2) || [], t; + for (var i = 0, n = tokens.length; i < n; ++i) { + if (!stop2.test(t = tokens[i])) update2(t); + } + }; + const init2 = this._parameterCheck(_, pulse2), counts = this._counts, match2 = this._match, stop2 = this._stop, get2 = _.field, as = _.as || ["text", "count"], add2 = process((t) => counts[t] = 1 + (counts[t] || 0)), rem2 = process((t) => counts[t] -= 1); + if (init2) { + pulse2.visit(pulse2.SOURCE, add2); + } else { + pulse2.visit(pulse2.ADD, add2); + pulse2.visit(pulse2.REM, rem2); + } + return this._finish(pulse2, as); + }, + _parameterCheck(_, pulse2) { + let init2 = false; + if (_.modified("stopwords") || !this._stop) { + this._stop = new RegExp("^" + (_.stopwords || "") + "$", "i"); + init2 = true; + } + if (_.modified("pattern") || !this._match) { + this._match = new RegExp(_.pattern || "[\\w']+", "g"); + init2 = true; + } + if (_.modified("field") || pulse2.modified(_.field.fields)) { + init2 = true; + } + if (init2) this._counts = {}; + return init2; + }, + _finish(pulse2, as) { + const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text2 = as[0], count2 = as[1], out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + let w2, t, c2; + for (w2 in counts) { + t = tuples[w2]; + c2 = counts[w2] || 0; + if (!t && c2) { + tuples[w2] = t = ingest$1({}); + t[text2] = w2; + t[count2] = c2; + out.add.push(t); + } else if (c2 === 0) { + if (t) out.rem.push(t); + counts[w2] = null; + tuples[w2] = null; + } else if (t[count2] !== c2) { + t[count2] = c2; + out.mod.push(t); } - return false; + } + return out.modifies(as); } - hydrateSnapshot(snapshot, selectedSnapshotIndex = -1) { - if (snapshot.dataSource) { - if (this.isSameDataSource(snapshot.dataSource, this.state.dataSource)) { - if (selectedSnapshotIndex === -1) this.explorer.reviveSnapshot(snapshot); - else this.explorer.reviveSnapshot(selectedSnapshotIndex); - if (snapshot.dataSource.snapshotsUrl && snapshot.dataSource.snapshotsUrl !== this.state.dataSource.snapshotsUrl) //load new snapshots url - fetch(snapshot.dataSource.snapshotsUrl).then((response)=>response.json()).then((snapshots)=>{ - if ((0, _snapshots.validSnapshots)(snapshots)) { - this.explorer.setState({ - snapshots - }); - const dataSource = Object.assign({}, this.state.dataSource); - dataSource.snapshotsUrl = snapshot.dataSource.snapshotsUrl; - this.setState({ - dataSource - }); - } - }); - } else if (snapshot.dataSource.dataSourceType === 'local') { - this.dataSourcePicker.setState({ - dialogMode: 'local' - }); - this.postLoad = (ds)=>{ - if (this.isSameDataSource(snapshot.dataSource, ds)) this.hydrateSnapshot(snapshot, selectedSnapshotIndex); - }; - } else this.load(snapshot.dataSource, snapshot.insight).then(()=>{ - this.explorer.setState({ - sideTabId: (0, _sanddanceExplorer.SideTabId).Snapshots, - note: snapshot.description - }); - this.explorer.scrollSnapshotIntoView(selectedSnapshotIndex); - }).catch((e)=>{ - this.loadError(snapshot.dataSource); - }); - return true; + }); + function Cross(params2) { + Transform.call(this, null, params2); + } + Cross.Definition = { + "type": "Cross", + "metadata": { + "generates": true + }, + "params": [{ + "name": "filter", + "type": "expr" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["a", "b"] + }] + }; + inherits(Cross, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), as = _.as || ["a", "b"], a2 = as[0], b2 = as[1], reset2 = !this.value || pulse2.changed(pulse2.ADD_REM) || _.modified("as") || _.modified("filter"); + let data2 = this.value; + if (reset2) { + if (data2) out.rem = data2; + data2 = pulse2.materialize(pulse2.SOURCE).source; + out.add = this.value = cross(data2, a2, b2, _.filter || truthy); + } else { + out.mod = data2; + } + out.source = this.value; + return out.modifies(as); + } + }); + function cross(input, a2, b2, filter2) { + var data2 = [], t = {}, n = input.length, i = 0, j, left; + for (; i < n; ++i) { + t[a2] = left = input[i]; + for (j = 0; j < n; ++j) { + t[b2] = input[j]; + if (filter2(t)) { + data2.push(ingest$1(t)); + t = {}; + t[a2] = left; } + } } - load(dataSource, partialInsight) { - //clone so that we do not modify original object - dataSource = (0, _sanddanceExplorer.SandDance).VegaMorphCharts.util.clone(dataSource); - this.setState({ - dataSource + return data2; + } + const Distributions = { + kde, + mixture: mixture$1, + normal: gaussian, + lognormal, + uniform + }; + const DISTRIBUTIONS = "distributions", FUNCTION = "function", FIELD = "field"; + function parse$4(def2, data2) { + const func = def2[FUNCTION]; + if (!has$1(Distributions, func)) { + error("Unknown distribution function: " + func); + } + const d2 = Distributions[func](); + for (const name in def2) { + if (name === FIELD) { + d2.data((def2.from || data2()).map(def2[name])); + } else if (name === DISTRIBUTIONS) { + d2[name](def2[name].map((_) => parse$4(_, data2))); + } else if (typeof d2[name] === FUNCTION) { + d2[name](def2[name]); + } + } + return d2; + } + function Density(params2) { + Transform.call(this, null, params2); + } + const distributions = [{ + "key": { + "function": "normal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "lognormal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "uniform" + }, + "params": [{ + "name": "min", + "type": "number", + "default": 0 + }, { + "name": "max", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "kde" + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "from", + "type": "data" + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }] + }]; + const mixture = { + "key": { + "function": "mixture" + }, + "params": [{ + "name": "distributions", + "type": "param", + "array": true, + "params": distributions + }, { + "name": "weights", + "type": "number", + "array": true + }] + }; + Density.Definition = { + "type": "Density", + "metadata": { + "generates": true + }, + "params": [{ + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "method", + "type": "string", + "default": "pdf", + "values": ["pdf", "cdf"] + }, { + "name": "distribution", + "type": "param", + "params": distributions.concat(mixture) + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(Density, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const dist2 = parse$4(_.distribution, source$1(pulse2)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + let method2 = _.method || "pdf"; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (!_.extent && !dist2.data) { + error("Missing density extent parameter."); + } + method2 = dist2[method2]; + const as = _.as || ["value", "density"], domain2 = _.extent || extent(dist2.data()), values2 = sampleCurve(method2, domain2, minsteps, maxsteps).map((v) => { + const tuple = {}; + tuple[as[0]] = v[0]; + tuple[as[1]] = v[1]; + return ingest$1(tuple); }); - document.title = `SandDance - ${dataSource.displayName}`; - return this.explorer.load(dataSource, (columns)=>{ - return partialInsight || this.props.insights && this.props.insights[dataSource.id]; - }, this.props.initialOptions && (0, _sanddanceExplorer.SandDance).VegaMorphCharts.util.deepMerge({}, this.props.initialOptions['*'], this.props.initialOptions[dataSource.id])); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; } - dataSourceError(dataSource) { - switch(dataSource.dataSourceType){ - case 'local': - return (0, _language.strings).errorDataSourceFromLocal(dataSource); - case 'sample': - case 'url': - return (0, _language.strings).errorDataSourceFromUrl(dataSource); + }); + function source$1(pulse2) { + return () => pulse2.materialize(pulse2.SOURCE).source; + } + function fieldNames(fields, as) { + if (!fields) return null; + return fields.map((f, i) => as[i] || accessorName(f)); + } + function partition$1$1(data2, groupby, field2) { + const groups = [], get2 = (f) => f(t); + let map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2.map(field2)); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); + } + g.push(field2(t)); + } + } + return groups; + } + const Output$5 = "bin"; + function DotBin(params2) { + Transform.call(this, null, params2); + } + DotBin.Definition = { + "type": "DotBin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "step", + "type": "number" + }, { + "name": "smooth", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": Output$5 + }] + }; + const autostep = (data2, field2) => span(extent(data2, field2)) / 30; + inherits(DotBin, Transform, { + transform(_, pulse2) { + if (this.value && !(_.modified() || pulse2.changed())) { + return pulse2; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(pulse2.source, _.groupby, identity$2), smooth = _.smooth || false, field2 = _.field, step = _.step || autostep(source2, field2), sort2 = stableCompare((a2, b2) => field2(a2) - field2(b2)), as = _.as || Output$5, n = groups.length; + let min2 = Infinity, max2 = -Infinity, i = 0, j; + for (; i < n; ++i) { + const g = groups[i].sort(sort2); + j = -1; + for (const v of dotbin(g, step, smooth, field2)) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + g[++j][as] = v; + } + } + this.value = { + start: min2, + stop: max2, + step + }; + return pulse2.reflow(true).modifies(as); + } + }); + function Expression$1(params2) { + Operator.call(this, null, update$4, params2); + this.modified(true); + } + inherits(Expression$1, Operator); + function update$4(_) { + const expr2 = _.expr; + return this.value && !_.modified("expr") ? this.value : accessor((datum2) => expr2(datum2, _), accessorFields(expr2), accessorName(expr2)); + } + function Extent(params2) { + Transform.call(this, [void 0, void 0], params2); + } + Extent.Definition = { + "type": "Extent", + "metadata": {}, + "params": [{ + "name": "field", + "type": "field", + "required": true + }] + }; + inherits(Extent, Transform, { + transform(_, pulse2) { + const extent2 = this.value, field2 = _.field, mod = pulse2.changed() || pulse2.modified(field2.fields) || _.modified("field"); + let min2 = extent2[0], max2 = extent2[1]; + if (mod || min2 == null) { + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(mod ? pulse2.SOURCE : pulse2.ADD, (t) => { + const v = toNumber(field2(t)); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + }); + if (!Number.isFinite(min2) || !Number.isFinite(max2)) { + let name = accessorName(field2); + if (name) name = ` for field "${name}"`; + pulse2.dataflow.warn(`Infinite extent${name}: [${min2}, ${max2}]`); + min2 = max2 = void 0; + } + this.value = [min2, max2]; + } + }); + function Subflow(pulse2, parent) { + Operator.call(this, pulse2); + this.parent = parent; + this.count = 0; + } + inherits(Subflow, Operator, { + /** + * Routes pulses from this subflow to a target transform. + * @param {Transform} target - A transform that receives the subflow of tuples. + */ + connect(target2) { + this.detachSubflow = target2.detachSubflow; + this.targets().add(target2); + return target2.source = this; + }, + /** + * Add an 'add' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being added. + */ + add(t) { + this.count += 1; + this.value.add.push(t); + }, + /** + * Add a 'rem' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being removed. + */ + rem(t) { + this.count -= 1; + this.value.rem.push(t); + }, + /** + * Add a 'mod' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being modified. + */ + mod(t) { + this.value.mod.push(t); + }, + /** + * Re-initialize this operator's pulse value. + * @param {Pulse} pulse - The pulse to copy from. + * @see Pulse.init + */ + init(pulse2) { + this.value.init(pulse2, pulse2.NO_SOURCE); + }, + /** + * Evaluate this operator. This method overrides the + * default behavior to simply return the contained pulse value. + * @return {Pulse} + */ + evaluate() { + return this.value; + } + }); + function Facet$1(params2) { + Transform.call(this, {}, params2); + this._keys = fastmap(); + const a2 = this._targets = []; + a2.active = 0; + a2.forEach = (f) => { + for (let i = 0, n = a2.active; i < n; ++i) { + f(a2[i], i, a2); + } + }; + } + inherits(Facet$1, Transform, { + activate(flow) { + this._targets[this._targets.active++] = flow; + }, + // parent argument provided by PreFacet subclass + subflow(key2, flow, pulse2, parent) { + const flows = this.value; + let sf = has$1(flows, key2) && flows[key2], df, p; + if (!sf) { + p = parent || (p = this._group[key2]) && p.tuple; + df = pulse2.dataflow; + sf = new Subflow(pulse2.fork(pulse2.NO_SOURCE), this); + df.add(sf).connect(flow(df, key2, p)); + flows[key2] = sf; + this.activate(sf); + } else if (sf.value.stamp < pulse2.stamp) { + sf.init(pulse2); + this.activate(sf); + } + return sf; + }, + clean() { + const flows = this.value; + let detached = 0; + for (const key2 in flows) { + if (flows[key2].count === 0) { + const detach = flows[key2].detachSubflow; + if (detach) detach(); + delete flows[key2]; + ++detached; + } + } + if (detached) { + const active = this._targets.filter((sf) => sf && sf.count > 0); + this.initTargets(active); + } + }, + initTargets(act) { + const a2 = this._targets, n = a2.length, m2 = act ? act.length : 0; + let i = 0; + for (; i < m2; ++i) { + a2[i] = act[i]; + } + for (; i < n && a2[i] != null; ++i) { + a2[i] = null; + } + a2.active = m2; + }, + transform(_, pulse2) { + const df = pulse2.dataflow, key2 = _.key, flow = _.subflow, cache2 = this._keys, rekey = _.modified("key"), subflow = (key3) => this.subflow(key3, flow, pulse2); + this._group = _.group || {}; + this.initTargets(); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t), k = cache2.get(id2); + if (k !== void 0) { + cache2.delete(id2); + subflow(k).rem(t); } - } - loadError(dataSource) { - const error = this.dataSourceError(dataSource); - this.explorer.setState({ - errors: [ - error - ] + }); + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + cache2.set(tupleid(t), k); + subflow(k).add(t); + }); + if (rekey || pulse2.modified(key2.fields)) { + pulse2.visit(pulse2.MOD, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 === k1) { + subflow(k1).mod(t); + } else { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } }); - this.setState({ - dataSource: { - dataSourceType: null, - id: null, - type: null - } + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => { + subflow(cache2.get(tupleid(t))).mod(t); }); - } - updateExplorerViewerOptions(viewerOptions) { - this.viewerOptions = viewerOptions; - this.explorer && this.explorer.updateViewerOptions(this.viewerOptions); - } - getThemePalette(darkTheme) { - const theme = darkTheme ? 'dark-theme' : ''; - return (0, _sanddanceExplorer.themePalettes)[theme]; - } - changeColorScheme(darkTheme) { - this.updateExplorerViewerOptions(getViewerOptions(darkTheme, this.props.themeColors)); - (0, _sanddanceExplorer.SandDance).VegaMorphCharts.base.vega.scheme((0, _sanddanceExplorer.SandDance).constants.ColorScaleNone, (x)=>this.explorer.viewer.options.colors.defaultCube); - this.explorer && this.explorer.viewer && this.explorer.viewer.renderSameLayout(this.viewerOptions); - (0, _base.base).fluentUI.loadTheme({ - palette: this.getThemePalette(darkTheme) + } + if (rekey) { + pulse2.visit(pulse2.REFLOW, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 !== k1) { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } + }); + } + if (pulse2.clean()) { + df.runAfter(() => { + this.clean(); + cache2.clean(); }); + } else if (cache2.empty > df.cleanThreshold) { + df.runAfter(cache2.clean); + } + return pulse2; } - render() { - const theme = this.state.darkTheme ? 'dark-theme' : ''; - const dataSourceProps = { - dataSource: this.state.dataSource, - dataSources: this.props.dataSources, - changeDataSource: (dataSource)=>{ - document.location.hash = ''; - return this.load(dataSource).then(()=>{ - if (this.postLoad) { - this.postLoad(dataSource); - this.postLoad = null; - } - }).catch(()=>this.loadError(dataSource)); - } - }; - return _react.createElement("section", { - className: "sanddance-app" - }, _react.createElement((0, _sanddanceExplorer.Explorer), { - logoClickTarget: "_self", - logoClickUrl: "/SandDance/", - theme: theme, - snapshotProps: { - modifySnapShot: (snapshot)=>{ - snapshot.dataSource = this.state.dataSource; - }, - getTopActions: (snapshots)=>{ - const items = [ - { - key: 'import', - text: (0, _language.strings).menuSnapshotsImport, - subMenuProps: { - items: [ - { - key: 'import-local', - text: (0, _language.strings).menuLocal, - onClick: ()=>this.setState({ - dialogMode: 'import-local' - }) - }, - { - key: 'import-remote', - text: (0, _language.strings).menuUrl, - onClick: ()=>this.setState({ - dialogMode: 'import-remote' - }) - } - ] - } - }, - { - key: 'export', - text: (0, _language.strings).menuSnapshotsExportAsJSON, - disabled: snapshots.length === 0, - onClick: ()=>(0, _snapshots.downloadSnapshotsJSON)(snapshots, `${this.state.dataSource.displayName}.snapshots`) - }, - { - key: 'export-as', - text: (0, _language.strings).menuSnapshotsExportAs, - disabled: snapshots.length === 0, - onClick: ()=>this.setState({ - dialogMode: 'export' - }) - } - ]; - return items; - }, - getChildren: (snapshots)=>_react.createElement("div", null, this.state.dialogMode === 'import-local' && _react.createElement((0, _snapshots.SnapshotImportLocal), { - theme: theme, - dataSource: this.state.dataSource, - onImportSnapshot: (snapshots)=>this.explorer.setState({ - snapshots - }), - onDismiss: ()=>this.setState({ - dialogMode: null - }) - }), this.state.dialogMode === 'import-remote' && _react.createElement((0, _snapshots.SnapshotImportRemote), { - theme: theme, - dataSource: this.state.dataSource, - onImportSnapshot: (snapshots)=>this.explorer.setState({ - snapshots - }), - onSnapshotsUrl: (snapshotsUrl)=>{ - const dataSource = Object.assign({}, this.state.dataSource); - dataSource.snapshotsUrl = snapshotsUrl; - this.setState({ - dataSource - }); - }, - onDismiss: ()=>this.setState({ - dialogMode: null - }) - }), this.state.dialogMode === 'export' && _react.createElement((0, _snapshots.SnapshotExport), { - explorer: this.explorer, - dataSource: this.state.dataSource, - snapshots: snapshots, - onDismiss: ()=>this.setState({ - dialogMode: null - }), - theme: theme - })), - getActions: (snapshot, i)=>{ - const url = '#' + (0, _snapshots.serializeSnapshot)(snapshot); - let element; - if (snapshot.dataSource && snapshot.dataSource.dataSourceType === 'local') element = _react.createElement("span", { - key: `link${i}` - }, (0, _language.strings).labelLocal); - else element = _react.createElement("a", { - key: `link${i}`, - href: url, - title: (0, _language.strings).labelLinkDescription, - "aria-label": (0, _language.strings).labelLinkDescription - }, (0, _language.strings).labelShare); - return [ - { - element - } - ]; - }, - getTitle: (insight)=>`${this.state.dataSource.displayName} ${insight.chart}`, - getDescription: (insight)=>'' - }, - onSnapshotClick: (snapshot, selectedSnapshotIndex)=>this.hydrateSnapshot(snapshot, selectedSnapshotIndex), - initialView: "2d", - mounted: (e)=>{ - this.explorer = e; - this.load(this.state.dataSource, snapshotOnLoad && snapshotOnLoad.insight).catch((e)=>{ - this.loadError(this.state.dataSource); - }); - this.props.mounted(this); - }, - dataExportHandler: (data, datatype, displayName)=>{ - try { - (0, _download.downloadData)(data, `${displayName}.${datatype}`); - } catch (e) { - this.explorer.setState({ - errors: [ - (0, _language.strings).errorDownloadFailure - ] - }); - } - }, - datasetElement: _react.createElement((0, _dataSourcePicker.DataSourceButton), Object.assign({ - getPicker: ()=>this.dataSourcePicker - }, dataSourceProps)), - topBarButtonProps: [ - { - key: 'theme', - text: this.state.darkTheme ? (0, _language.strings).buttonThemeLight : (0, _language.strings).buttonThemeDark, - iconProps: { - iconName: this.state.darkTheme ? 'Sunny' : 'ClearNight' - }, - onClick: ()=>{ - const darkTheme = !this.state.darkTheme; - this.props.setTheme && this.props.setTheme(darkTheme); - this.setState({ - darkTheme - }); - this.changeColorScheme(darkTheme); - } - } - ], - viewerOptions: this.viewerOptions, - compactUI: this.state.compactUI, - additionalSettings: [ - { - groupLabel: (0, _language.strings).labelPreferences, - children: _react.createElement((0, _base.base).fluentUI.Toggle, { - label: (0, _language.strings).labelCompactUI, - title: (0, _language.strings).labelCompactUIDescription, - checked: this.state.compactUI, - onChange: (e, checked)=>{ - if (checked) localStorage.setItem('compactUI', 'true'); - else localStorage.removeItem('compactUI'); - this.setState({ - compactUI: checked - }); - } - }) - } - ] - }), _react.createElement((0, _dataSourcePicker.DataSourcePicker), Object.assign({ - ref: (dsp)=>{ - if (dsp && !this.dataSourcePicker) this.dataSourcePicker = dsp; - }, - theme: theme - }, dataSourceProps))); - } -} - -},{"./base":"4CyyC","./dataSourcePicker":"1N9JZ","./download":"hRClM","./language":"ieP7V","./snapshots":"EBWBP","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1N9JZ":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataSourceButton", ()=>DataSourceButton); -parcelHelpers.export(exports, "DataSourcePicker", ()=>DataSourcePicker); -var _base = require("./base"); -var _language = require("./language"); -var _url = require("./url"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -function DataSourceButton(props) { - const picker = props.getPicker(); - if (!picker) return null; - const menuProps = { - items: [ - { - key: 'sample-section', - itemType: (0, _base.base).fluentUI.ContextualMenuItemType.Section, - sectionProps: { - title: (0, _language.strings).sampleDataPrefix, - items: props.dataSources.map((ds, i)=>{ - const item = { - key: ds.id, - text: ds.displayName, - onClick: (e)=>{ - picker.changeDataSource(ds); - } - }; - return item; - }) - } - }, - { - key: 'user-section', - itemType: (0, _base.base).fluentUI.ContextualMenuItemType.Section, - sectionProps: { - topDivider: true, - title: (0, _language.strings).menuUserData, - items: [ - { - key: 'local', - text: (0, _language.strings).menuLocal, - onClick: (e)=>picker.setState({ - dialogMode: 'local' - }) - }, - { - key: 'url', - text: (0, _language.strings).menuUrl, - onClick: (e)=>picker.setState({ - dialogMode: 'url' - }) - } - ] - } - } - ] - }; - return _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - className: "sanddance-datasource-picker", - text: dataSourcePrefix(props.dataSource.dataSourceType, props.dataSource.displayName), - menuProps: menuProps - }); -} -class DataSourcePicker extends _react.Component { - constructor(props){ - super(props); - this.state = { - url: '', - urlType: DataSourcePicker.urlTypes[0], - working: false - }; + }); + function Field$1(params2) { + Operator.call(this, null, update$3, params2); + } + inherits(Field$1, Operator); + function update$3(_) { + return this.value && !_.modified() ? this.value : isArray(_.name) ? array$4(_.name).map((f) => field$1(f)) : field$1(_.name, _.as); + } + function Filter(params2) { + Transform.call(this, fastmap(), params2); + } + Filter.Definition = { + "type": "Filter", + "metadata": { + "changes": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }] + }; + inherits(Filter, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, cache2 = this.value, output2 = pulse2.fork(), add2 = output2.add, rem2 = output2.rem, mod = output2.mod, test2 = _.expr; + let isMod = true; + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (!cache2.has(id2)) rem2.push(t); + else cache2.delete(id2); + }); + pulse2.visit(pulse2.ADD, (t) => { + if (test2(t, _)) add2.push(t); + else cache2.set(tupleid(t), 1); + }); + function revisit(t) { + const id2 = tupleid(t), b2 = test2(t, _), s2 = cache2.get(id2); + if (b2 && s2) { + cache2.delete(id2); + add2.push(t); + } else if (!b2 && !s2) { + cache2.set(id2, 1); + rem2.push(t); + } else if (isMod && b2 && !s2) { + mod.push(t); + } + } + pulse2.visit(pulse2.MOD, revisit); + if (_.modified()) { + isMod = false; + pulse2.visit(pulse2.REFLOW, revisit); + } + if (cache2.empty > df.cleanThreshold) df.runAfter(cache2.clean); + return output2; } - changeDataSource(dataSource) { - this.setState({ - working: true - }); - return new Promise((resolve, reject)=>{ - const uploadFormatError = ''; - const urlError = ''; - this.setState({ - uploadFormatError, - urlError - }); - this.props.changeDataSource(dataSource).then(()=>{ - this.setState({ - working: false, - uploadFormatError: '', - urlError: '', - dialogMode: null - }); - resolve(); - }).catch((reason)=>{ - this.setState({ - working: false - }); - reject(reason); - }); - }); + }); + function Flatten(params2) { + Transform.call(this, [], params2); + } + Flatten.Definition = { + "type": "Flatten", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "index", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Flatten, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index2 = _.index || null, m2 = as.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + const arrays = fields.map((f) => f(t)), maxlen = arrays.reduce((l, a2) => Math.max(l, a2.length), 0); + let i = 0, j, d2, v; + for (; i < maxlen; ++i) { + d2 = derive(t); + for (j = 0; j < m2; ++j) { + d2[as[j]] = (v = arrays[j][i]) == null ? null : v; + } + if (index2) { + d2[index2] = i; + } + out.add.push(d2); + } + }); + this.value = out.source = out.add; + if (index2) out.modifies(index2); + return out.modifies(as); } - upload(e) { - if (e.target.files) { - const file = e.target.files[0]; - const split = file.name.split('.'); - const type = split[split.length - 1]; - if (DataSourcePicker.urlTypes.indexOf(type) >= 0) { - const reader = new FileReader(); - reader.onload = ()=>{ - const id = file.name; - const displayName = file.name; - const rawText = reader.result; - const ds = { - dataSourceType: 'local', - displayName, - id, - rawText, - type - }; - this.changeDataSource(ds); - }; - reader.readAsText(file); - } else { - const uploadFormatError = (0, _language.strings).errorInvalidFileFormat; - this.setState({ - uploadFormatError - }); - } + }); + function Fold(params2) { + Transform.call(this, [], params2); + } + Fold.Definition = { + "type": "Fold", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["key", "value"] + }] + }; + inherits(Fold, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, fnames = fields.map(accessorName), as = _.as || ["key", "value"], k = as[0], v = as[1], n = fields.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + for (let i = 0, d2; i < n; ++i) { + d2 = derive(t); + d2[k] = fnames[i]; + d2[v] = fields[i](t); + out.add.push(d2); } + }); + this.value = out.source = out.add; + return out.modifies(as); } - loadUrl() { - if (!this.state.url) return this.setState({ - urlError: (0, _language.strings).errorNoUrl - }); - if (this.state.url.toLocaleLowerCase().substr(0, 4) !== 'http') return this.setState({ - urlError: (0, _language.strings).errorUrlHttp - }); - //TODO: check url - const { url } = this.state; - const ds = { - dataSourceType: 'url', - displayName: url, - id: url, - dataUrl: url, - type: this.state.urlType - }; - this.changeDataSource(ds).catch((e)=>{ - this.setState({ - urlError: e.message - }); - }); + }); + function Formula(params2) { + Transform.call(this, null, params2); + } + Formula.Definition = { + "type": "Formula", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }, { + "name": "as", + "type": "string", + "required": true + }, { + "name": "initonly", + "type": "boolean" + }] + }; + inherits(Formula, Transform, { + transform(_, pulse2) { + const func = _.expr, as = _.as, mod = _.modified(), flag2 = _.initonly ? pulse2.ADD : mod ? pulse2.SOURCE : pulse2.modified(func.fields) || pulse2.modified(as) ? pulse2.ADD_MOD : pulse2.ADD; + if (mod) { + pulse2 = pulse2.materialize().reflow(true); + } + if (!_.initonly) { + pulse2.modifies(as); + } + return pulse2.visit(flag2, (t) => t[as] = func(t, _)); } - getUrlShortcut(dataUrl, type) { - const dss = { - dataSource: { - dataSourceType: 'url', - dataUrl, - displayName: dataUrl.substring(dataUrl.lastIndexOf('/') + 1, dataUrl.lastIndexOf('.')), - id: '', - type - } - }; - return '#' + JSON.stringify(dss); + }); + function Generate(params2) { + Transform.call(this, [], params2); + } + inherits(Generate, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), gen = _.generator; + let data2 = this.value, num = _.size - data2.length, add2, rem2, t; + if (num > 0) { + for (add2 = []; --num >= 0; ) { + add2.push(t = ingest$1(gen(_))); + data2.push(t); + } + out.add = out.add.length ? out.materialize(out.ADD).add.concat(add2) : add2; + } else { + rem2 = data2.slice(0, -num); + out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem2) : rem2; + data2 = data2.slice(-num); + } + out.source = this.value = data2; + return out; } - render() { - const closeDialog = ()=>{ - this.setState({ - dialogMode: null - }); - }; - let shortcut; - if (this.state.url && !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError) shortcut = this.getUrlShortcut(this.state.url, this.state.urlType); - return [ - _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - key: 'local', - hidden: !(this.state.dialogMode === 'local'), - onDismiss: closeDialog, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleLocal, - subText: (0, _language.strings).dialogSubtextLocal - } - }, _react.createElement("input", { - type: "file", - onChange: (e)=>this.upload(e), - disabled: this.state.working - }), this.state.uploadFormatError && _react.createElement("div", { - className: "error" - }, this.state.uploadFormatError)), - _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - key: 'url', - hidden: !(this.state.dialogMode === 'url'), - onDismiss: closeDialog, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleUrl - }, - buttons: [ - _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - key: 0, - onClick: (e)=>this.loadUrl(), - iconProps: { - iconName: 'CloudDownload' - }, - text: (0, _language.strings).dialogLoadButton, - disabled: this.state.working - }) - ] - }, _react.createElement("section", null, _react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelUrl, - placeholder: (0, _language.strings).urlInputPlaceholder, - onKeyUp: (e)=>e.keyCode === 13 && this.loadUrl(), - onChange: (e, url)=>this.setState({ - url, - urlError: '' - }), - value: this.state.url, - disabled: this.state.working - }), this.state.urlError && _react.createElement("div", { - className: "error" - }, this.state.urlError)), _react.createElement("section", null, _react.createElement((0, _base.base).fluentUI.ChoiceGroup, { - selectedKey: this.state.urlType, - options: DataSourcePicker.urlTypes.map((urlType, i)=>{ - return { - key: urlType, - text: urlType, - disabled: this.state.working - }; - }), - onChange: (ev, option)=>this.setState({ - urlType: option.text, - urlError: '' - }), - label: (0, _language.strings).labelDataFormat - })), _react.createElement("section", { - className: 'tip', - style: { - visibility: !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError ? 'visible' : 'hidden' - } - }, (0, _language.strings).labelDataUrlShortcut, " ", _react.createElement("a", { - href: shortcut, - title: (0, _language.strings).labelLinkDescription, - "aria-label": (0, _language.strings).labelLinkDescription - }, (0, _language.strings).labelLink))) - ]; + }); + const Methods$1 = { + value: "value", + median, + mean, + min: min$2, + max: max$2 + }; + const Empty$1 = []; + function Impute(params2) { + Transform.call(this, [], params2); + } + Impute.Definition = { + "type": "Impute", + "metadata": { + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }, { + "name": "keyvals", + "array": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "enum", + "default": "value", + "values": ["value", "mean", "median", "max", "min"] + }, { + "name": "value", + "default": 0 + }] + }; + function getValue(_) { + var m2 = _.method || Methods$1.value, v; + if (Methods$1[m2] == null) { + error("Unrecognized imputation method: " + m2); + } else if (m2 === Methods$1.value) { + v = _.value !== void 0 ? _.value : 0; + return () => v; + } else { + return Methods$1[m2]; } -} -DataSourcePicker.urlTypes = [ - 'json', - 'csv', - 'tsv', - 'topojson' -]; -function dataSourcePrefix(dt, displayName) { - switch(dt){ - case 'sample': - return `${(0, _language.strings).sampleDataPrefix}: ${displayName}`; - case 'local': - return (0, _language.strings).localFilePrefix; - case 'url': - return (0, _language.strings).urlPrefix; - } - return (0, _language.strings).buttonLoadData; -} - -},{"./base":"4CyyC","./language":"ieP7V","./url":"c7hj5","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ieP7V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "strings", ()=>strings); -const strings = { - buttonLoadData: 'Load data', - buttonThemeDark: 'Dark', - buttonThemeLight: 'Light', - buttonExport: 'Export', - menuUserData: 'Use your own data', - menuLocal: 'On this computer ...', - menuUrl: 'Enter a URL ...', - menuSnapshotsExportAsJSON: 'Export as .snapshots JSON file', - menuSnapshotsExportAs: 'Export as ...', - menuSnapshotsImport: 'Import a .snapshots JSON file', - dialogTitleLocal: 'Use a file from your computer', - dialogSubtextLocal: 'Your file will not be uploaded, it is only used by the browser on this computer. The currently supported data formats are json (the default), csv (comma-separated values), tsv (tab-separated values), and topojson.', - dialogTitleUrl: 'Use a data file via URL', - dialogTitleSnapshotsExport: 'Export as', - dialogTitleSnapshotsLocal: 'Use a snapshots file from your computer', - dialogSubtextSnapshotsLocal: 'Use a file that was previously exported snapshots file. Your file will not be uploaded, it is only used by the browser on this computer.', - dialogTitleSnapshotsUrl: 'Use a snapshots file via URL', - dialogLoadButton: 'Load', - labelLocal: '[local]', - labelColorFilter: 'Note: Colors will be re-mapped to the filter when viewing this saved chart.', - labelPreferences: 'Preferences', - labelCompactUI: 'Compact UI', - labelCompactUIDescription: 'Compact UI hides collapses labels on dropdown menus.', - labelSnapshotsExportHTMLTitle: 'HTML', - labelSnapshotsExportHTMLDescription: 'A self contained HTML page with current data and snapshots pre-loaded.', - labelSnapshotsExportMarkdownTitle: 'Markdown', - labelSnapshotsExportMarkdownDescription: 'Markdown is a language used by many blogging platforms. Exports a Markdown file with thumbnails of these snapshots which link back to the SandDance website.', - labelSnapshotsShortcut: 'Tip: Your .snapshots JSON file can also be pre-loaded with this', - labelShare: 'share', - labelLink: 'link', - labelLinkDescription: 'A URL to revive this snapshot.', - labelUrl: 'Url', - labelDataFormat: 'Data format', - labelDataUrlShortcut: 'Tip: Your data file can also be pre-loaded with this', - urlInputPlaceholder: 'paste URL', - sampleDataPrefix: 'Sample data', - localFilePrefix: 'Local file', - urlPrefix: 'Url', - errorInvalidFileFormat: 'Invalid file format', - errorNoUrl: 'Please enter a url', - errorUrlHttp: 'Url must begin with "http"', - errorDownloadFailure: 'Data could not be prepared for download.', - errorDataSourceFromLocal: (ds)=>`Could not load ${ds.type} from local file.`, - errorDataSourceFromUrl: (ds)=>`Could not load ${ds.type} from ${ds.dataUrl}` -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c7hj5":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "invalidUrlError", ()=>invalidUrlError); -var _language = require("./language"); -function invalidUrlError(url) { - if (!url) return (0, _language.strings).errorNoUrl; - if (url.toLocaleLowerCase().substr(0, 4) !== 'http') return (0, _language.strings).errorUrlHttp; -} - -},{"./language":"ieP7V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hRClM":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "downloadData", ()=>downloadData); -function downloadData(data, fileName) { - // Adapted from https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server - const a = document.createElement('a'); - a.setAttribute('download', fileName); - document.body.appendChild(a); - const blob = dataURIToBlob(data); - a.href = URL.createObjectURL(blob); - // we must revoke the object URL, - // since we can't know when the download occured, we have to attach it on the click handler.. - a.onclick = ()=>{ - // ..and to wait a frame - requestAnimationFrame(()=>URL.revokeObjectURL(a.href)); - document.body.removeChild(a); - }; - a.click(); -} -//from https://stackoverflow.com/a/37151835/620501 -function dataURIToBlob(binStr) { - const len = binStr.length, arr = new Uint8Array(len); - for(let i = 0; i < len; i++)arr[i] = binStr.charCodeAt(i); - return new Blob([ - arr - ]); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"EBWBP":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cleanSnapshots", ()=>cleanSnapshots); -parcelHelpers.export(exports, "downloadSnapshotsJSON", ()=>downloadSnapshotsJSON); -parcelHelpers.export(exports, "serializeSnapshot", ()=>serializeSnapshot); -parcelHelpers.export(exports, "validSnapshots", ()=>validSnapshots); -parcelHelpers.export(exports, "SnapshotImportLocal", ()=>SnapshotImportLocal); -parcelHelpers.export(exports, "SnapshotImportRemote", ()=>SnapshotImportRemote); -parcelHelpers.export(exports, "SnapshotExport", ()=>SnapshotExport); -var _base = require("./base"); -var _download = require("./download"); -var _language = require("./language"); -var _url = require("./url"); -var _sanddanceExplorer = require("@msrvida/sanddance-explorer"); -var _react = require("react"); -var util = (0, _sanddanceExplorer.SandDance).VegaMorphCharts.util; -function markdownImageLink(alt, imageUrl, link) { - return `[![${alt}](${imageUrl})](${link})`; -} -function cleanSnapshots(snapshots) { - //remove data sources from snapshots - const clean = util.clone(snapshots); - clean.forEach((snapshot)=>{ - if (snapshot.dataSource) delete snapshot.dataSource.snapshotsUrl; - }); - return clean; -} -function downloadSnapshotsJSON(snapshots, filename) { - //clean prior to exporting - const clean = cleanSnapshots(snapshots); - (0, _download.downloadData)(JSON.stringify(clean, null, 2), filename); -} -function serializeSnapshot(snapshotWithImage) { - const snapshot = util.clone(snapshotWithImage); - //remove the image data from the snapshot - delete snapshot.bgColor; - delete snapshot.image; - if (snapshot.dataSource) delete snapshot.dataSource.rawText; - return JSON.stringify(snapshot); -} -function isSnapshot(snapshot) { - return snapshot.insight && snapshot.title; -} -function validSnapshots(snapshots) { - if (Array.isArray(snapshots)) { - for(let i = 0; i < snapshots.length; i++){ - if (!isSnapshot(snapshots[i])) return false; + } + function getField$1(_) { + const f = _.field; + return (t) => t ? f(t) : NaN; + } + inherits(Impute, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), impute = getValue(_), field2 = getField$1(_), fName = accessorName(_.field), kName = accessorName(_.key), gNames = (_.groupby || []).map(accessorName), groups = partition$4(pulse2.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m2 = groups.domain.length, group2, value2, gVals, kVal, g, i, j, l, n, t; + for (g = 0, l = groups.length; g < l; ++g) { + group2 = groups[g]; + gVals = group2.values; + value2 = NaN; + for (j = 0; j < m2; ++j) { + if (group2[j] != null) continue; + kVal = groups.domain[j]; + t = { + _impute: true + }; + for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i]; + t[kName] = kVal; + t[fName] = Number.isNaN(value2) ? value2 = impute(group2, field2) : value2; + curr.push(ingest$1(t)); } - return true; + } + if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); + if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); + this.value = curr; + return out; } - return false; -} -class SnapshotImportLocal extends _react.Component { - constructor(props){ - super(props); - this.state = { - working: false - }; + }); + function partition$4(data2, groupby, key2, keyvals) { + var get2 = (f) => f(t), groups = [], domain2 = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group2, i, j, k, n, t; + domain2.forEach((k2, i2) => kMap[k2] = i2 + 1); + for (i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = key2(t); + j = kMap[k] || (kMap[k] = domain2.push(k)); + gKey = (gVals = groupby ? groupby.map(get2) : Empty$1) + ""; + if (!(group2 = gMap[gKey])) { + group2 = gMap[gKey] = []; + groups.push(group2); + group2.values = gVals; + } + group2[j - 1] = t; } - readFile(e) { - if (e.target.files) { - this.setState({ - working: true - }); - const file = e.target.files[0]; - const reader = new FileReader(); - reader.onload = ()=>{ - const rawText = reader.result; - let snapshots; - try { - snapshots = JSON.parse(rawText); - } catch (e) { - this.setState({ - fileFormatError: (0, _language.strings).errorInvalidFileFormat, - working: false - }); - } - //validate these are snapshots - if (validSnapshots(snapshots)) { - this.props.onImportSnapshot(snapshots); - this.setState({ - working: false - }); - this.props.onDismiss(); - } else this.setState({ - fileFormatError: (0, _language.strings).errorInvalidFileFormat, - working: false - }); - }; - reader.readAsText(file); - } + groups.domain = domain2; + return groups; + } + function JoinAggregate(params2) { + Aggregate$1.call(this, params2); + } + JoinAggregate.Definition = { + "type": "JoinAggregate", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "key", + "type": "field" + }] + }; + inherits(JoinAggregate, Aggregate$1, { + transform(_, pulse2) { + const aggr = this, mod = _.modified(); + let cells; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + cells = aggr.value = mod ? aggr.init(_) : {}; + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + cells = aggr.value = aggr.value || this.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + aggr.changes(); + pulse2.visit(pulse2.SOURCE, (t) => { + extend(t, cells[aggr.cellkey(t)].tuple); + }); + return pulse2.reflow(mod).modifies(this._outputs); + }, + changes() { + const adds = this._adds, mods = this._mods; + let i, n; + for (i = 0, n = this._alen; i < n; ++i) { + this.celltuple(adds[i]); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + this.celltuple(mods[i]); + mods[i] = null; + } + this._alen = this._mlen = 0; } - render() { - return _react.createElement("div", null, _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - hidden: false, - onDismiss: this.props.onDismiss, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleSnapshotsLocal, - subText: (0, _language.strings).dialogSubtextSnapshotsLocal + }); + function KDE(params2) { + Transform.call(this, null, params2); + } + KDE.Definition = { + "type": "KDE", + "metadata": { + "generates": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "cumulative", + "type": "boolean", + "default": false + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(KDE, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), bandwidth2 = _.bandwidth, method2 = _.cumulative ? "cdf" : "pdf", as = _.as || ["value", "density"], values2 = []; + let domain2 = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (_.resolve === "shared") { + if (!domain2) domain2 = extent(source2, _.field); + minsteps = maxsteps = _.steps || maxsteps; + } + groups.forEach((g) => { + const density2 = kde(g, bandwidth2)[method2], scale2 = _.counts ? g.length : 1, local = domain2 || extent(g); + sampleCurve(density2, local, minsteps, maxsteps).forEach((v) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; } - }, _react.createElement("section", null, _react.createElement("input", { - type: "file", - onChange: (e)=>this.readFile(e), - disabled: this.state.working - }), this.state.fileFormatError && _react.createElement("div", { - className: "error" - }, this.state.fileFormatError)))); - } -} -class SnapshotImportRemote extends _react.Component { - constructor(props){ - super(props); - this.state = { - working: false + t[as[0]] = v[0]; + t[as[1]] = v[1] * scale2; + values2.push(ingest$1(t)); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + function Key$1(params2) { + Operator.call(this, null, update$2, params2); + } + inherits(Key$1, Operator); + function update$2(_) { + return this.value && !_.modified() ? this.value : key(_.fields, _.flat); + } + function Load$1(params2) { + Transform.call(this, [], params2); + this._pending = null; + } + inherits(Load$1, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow; + if (this._pending) { + return output(this, pulse2, this._pending); + } + if (stop(_)) return pulse2.StopPropagation; + if (_.values) { + return output(this, pulse2, df.parse(_.values, _.format)); + } else if (_.async) { + const p = df.request(_.url, _.format).then((res) => { + this._pending = array$4(res.data); + return (df2) => df2.touch(this); + }); + return { + async: p }; + } else { + return df.request(_.url, _.format).then((res) => output(this, pulse2, array$4(res.data))); + } } - getUrlShortcut() { - const dataSource = util.clone(this.props.dataSource); - delete dataSource.snapshots; - dataSource.snapshotsUrl = this.state.url; - const dss = { - dataSource + }); + function stop(_) { + return _.modified("async") && !(_.modified("values") || _.modified("url") || _.modified("format")); + } + function output(op, pulse2, data2) { + data2.forEach(ingest$1); + const out = pulse2.fork(pulse2.NO_FIELDS & pulse2.NO_SOURCE); + out.rem = op.value; + op.value = out.source = out.add = data2; + op._pending = null; + if (out.rem.length) out.clean(true); + return out; + } + function Lookup(params2) { + Transform.call(this, {}, params2); + } + Lookup.Definition = { + "type": "Lookup", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "index", + "type": "index", + "params": [{ + "name": "from", + "type": "data", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }] + }, { + "name": "values", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true + }, { + "name": "default", + "default": null + }] + }; + inherits(Lookup, Transform, { + transform(_, pulse2) { + const keys2 = _.fields, index2 = _.index, values2 = _.values, defaultValue = _.default == null ? null : _.default, reset2 = _.modified(), n = keys2.length; + let flag2 = reset2 ? pulse2.SOURCE : pulse2.ADD, out = pulse2, as = _.as, set2, m2, mods; + if (values2) { + m2 = values2.length; + if (n > 1 && !as) { + error('Multi-field lookup requires explicit "as" parameter.'); + } + if (as && as.length !== n * m2) { + error('The "as" parameter has too few output field names.'); + } + as = as || values2.map(accessorName); + set2 = function(t) { + for (var i = 0, k = 0, j, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + if (v == null) for (j = 0; j < m2; ++j, ++k) t[as[k]] = defaultValue; + else for (j = 0; j < m2; ++j, ++k) t[as[k]] = values2[j](v); + } + }; + } else { + if (!as) { + error("Missing output field names."); + } + set2 = function(t) { + for (var i = 0, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + t[as[i]] = v == null ? defaultValue : v; + } }; - return '#' + JSON.stringify(dss); + } + if (reset2) { + out = pulse2.reflow(true); + } else { + mods = keys2.some((k) => pulse2.modified(k.fields)); + flag2 |= mods ? pulse2.MOD : 0; + } + pulse2.visit(flag2, set2); + return out.modifies(as); } - loadUrl() { - const urlError = (0, _url.invalidUrlError)(this.state.url); - if (urlError) return this.setState({ - urlError - }); - const { url } = this.state; - fetch(url).then((response)=>{ - if (response.status === 200) return response.json(); - else this.setState({ - urlError: response.statusText - }); - }).then((snapshots)=>{ - if (validSnapshots(snapshots)) { - this.props.onImportSnapshot(snapshots); - this.props.onSnapshotsUrl(url); - this.setState({ - working: false - }); - this.props.onDismiss(); - } else this.setState({ - fileFormatError: (0, _language.strings).errorInvalidFileFormat, - working: false - }); - }).catch((e)=>{ - this.setState({ - urlError: e - }); - }); + }); + function MultiExtent$1(params2) { + Operator.call(this, null, update$1, params2); + } + inherits(MultiExtent$1, Operator); + function update$1(_) { + if (this.value && !_.modified()) { + return this.value; + } + const ext = _.extents, n = ext.length; + let min2 = Infinity, max2 = -Infinity, i, e; + for (i = 0; i < n; ++i) { + e = ext[i]; + if (e[0] < min2) min2 = e[0]; + if (e[1] > max2) max2 = e[1]; + } + return [min2, max2]; + } + function MultiValues$1(params2) { + Operator.call(this, null, update, params2); + } + inherits(MultiValues$1, Operator); + function update(_) { + return this.value && !_.modified() ? this.value : _.values.reduce((data2, _2) => data2.concat(_2), []); + } + function Params$2(params2) { + Transform.call(this, null, params2); + } + inherits(Params$2, Transform, { + transform(_, pulse2) { + this.modified(_.modified()); + this.value = _; + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - render() { - let shortcut; - if (this.props.dataSource.dataSourceType !== 'local' && this.state.url && !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError) shortcut = this.getUrlShortcut(); - return _react.createElement("div", null, _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - hidden: false, - onDismiss: this.props.onDismiss, - dialogContentProps: { - className: `sanddance-dialog ${this.props.theme}`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleSnapshotsUrl - }, - buttons: [ - _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - disabled: !this.state.url || !!this.state.urlError, - key: 0, - onClick: (e)=>this.loadUrl(), - iconProps: { - iconName: 'CloudDownload' - }, - text: (0, _language.strings).dialogLoadButton - }) - ] - }, _react.createElement("section", null, _react.createElement((0, _base.base).fluentUI.TextField, { - label: (0, _language.strings).labelUrl, - placeholder: (0, _language.strings).urlInputPlaceholder, - onKeyUp: (e)=>e.keyCode === 13 && this.loadUrl(), - onChange: (e, url)=>this.setState({ - url, - urlError: '' - }), - value: this.state.url, - disabled: this.state.working - }), this.state.urlError && _react.createElement("div", { - className: "error" - }, this.state.urlError)), this.props.dataSource.dataSourceType !== 'local' && _react.createElement("section", { - className: 'tip', - style: { - visibility: !(0, _url.invalidUrlError)(this.state.url) && !this.state.urlError ? 'visible' : 'hidden' - } - }, (0, _language.strings).labelSnapshotsShortcut, " ", _react.createElement("a", { - href: shortcut, - title: (0, _language.strings).labelLinkDescription, - "aria-label": (0, _language.strings).labelLinkDescription - }, (0, _language.strings).labelShare)))); - } -} -function SnapshotExport(props) { - return _react.createElement((0, _sanddanceExplorer.controls).Dialog, { - hidden: false, - onDismiss: props.onDismiss, - dialogContentProps: { - className: `sanddance-dialog ${props.theme} sanddance-export`, - type: (0, _base.base).fluentUI.DialogType.normal, - title: (0, _language.strings).dialogTitleSnapshotsExport - } - }, _react.createElement("ul", null, _react.createElement("li", null, _react.createElement("strong", null, (0, _language.strings).labelSnapshotsExportHTMLTitle), _react.createElement("div", null, (0, _language.strings).labelSnapshotsExportHTMLDescription), _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - iconProps: { - iconName: 'Download' - }, - text: `${(0, _language.strings).buttonExport} ${(0, _language.strings).labelSnapshotsExportHTMLTitle}`, - onClick: (e)=>{ - const clean = cleanSnapshots(props.snapshots); - const html = (0, _sanddanceExplorer.getEmbedHTML)(props.explorer.state.dataContent.data, props.dataSource.displayName, clean); - (0, _download.downloadData)(html, `${props.dataSource.displayName}.html`); - } - })), _react.createElement("li", null, _react.createElement("strong", null, (0, _language.strings).labelSnapshotsExportMarkdownTitle), _react.createElement("div", null, (0, _language.strings).labelSnapshotsExportMarkdownDescription), _react.createElement((0, _base.base).fluentUI.PrimaryButton, { - iconProps: { - iconName: 'Download' - }, - text: `${(0, _language.strings).buttonExport} ${(0, _language.strings).labelSnapshotsExportMarkdownTitle}`, - onClick: (e)=>{ - const sections = props.snapshots.map((snapshot)=>{ - const section = [ - `## ${snapshot.title}` - ]; - section.push(snapshot.description); - section.push('\n'); - const url = `${location.origin}/#${encodeURIComponent(serializeSnapshot(snapshot))}`; - section.push(markdownImageLink(snapshot.title, snapshot.image, url)); - return section.join('\n'); - }); - sections.unshift(`# ${props.dataSource.displayName}`); - (0, _download.downloadData)(sections.join('\n\n'), `${props.dataSource.displayName}.snapshots.md`); - } - })))); -} - -},{"./base":"4CyyC","./download":"hRClM","./language":"ieP7V","./url":"c7hj5","@msrvida/sanddance-explorer":"cEojs","react":"jGrId","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"75mIL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>(0, _vegaDataflow.Dataflow)); -parcelHelpers.export(exports, "EventStream", ()=>(0, _vegaDataflow.EventStream)); -parcelHelpers.export(exports, "MultiPulse", ()=>(0, _vegaDataflow.MultiPulse)); -parcelHelpers.export(exports, "Operator", ()=>(0, _vegaDataflow.Operator)); -parcelHelpers.export(exports, "Parameters", ()=>(0, _vegaDataflow.Parameters)); -parcelHelpers.export(exports, "Pulse", ()=>(0, _vegaDataflow.Pulse)); -parcelHelpers.export(exports, "Transform", ()=>(0, _vegaDataflow.Transform)); -parcelHelpers.export(exports, "changeset", ()=>(0, _vegaDataflow.changeset)); -parcelHelpers.export(exports, "definition", ()=>(0, _vegaDataflow.definition)); -parcelHelpers.export(exports, "ingest", ()=>(0, _vegaDataflow.ingest)); -parcelHelpers.export(exports, "isTuple", ()=>(0, _vegaDataflow.isTuple)); -parcelHelpers.export(exports, "transform", ()=>(0, _vegaDataflow.transform)); -parcelHelpers.export(exports, "transforms", ()=>(0, _vegaDataflow.transforms)); -parcelHelpers.export(exports, "tupleid", ()=>(0, _vegaDataflow.tupleid)); -parcelHelpers.export(exports, "interpolate", ()=>(0, _vegaScale.interpolate)); -parcelHelpers.export(exports, "interpolateColors", ()=>(0, _vegaScale.interpolateColors)); -parcelHelpers.export(exports, "interpolateRange", ()=>(0, _vegaScale.interpolateRange)); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>(0, _vegaScale.quantizeInterpolator)); -parcelHelpers.export(exports, "scale", ()=>(0, _vegaScale.scale)); -parcelHelpers.export(exports, "scheme", ()=>(0, _vegaScale.scheme)); -parcelHelpers.export(exports, "projection", ()=>(0, _vegaProjection.projection)); -parcelHelpers.export(exports, "View", ()=>(0, _vegaView.View)); -parcelHelpers.export(exports, "defaultLocale", ()=>(0, _vegaFormat.defaultLocale)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _vegaFormat.numberFormatDefaultLocale)); -parcelHelpers.export(exports, "locale", ()=>(0, _vegaFormat.locale)); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>(0, _vegaFormat.resetDefaultLocale)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _vegaFormat.timeFormatDefaultLocale)); -parcelHelpers.export(exports, "expressionFunction", ()=>(0, _vegaFunctions.expressionFunction)); -parcelHelpers.export(exports, "parse", ()=>(0, _vegaParser.parse)); -parcelHelpers.export(exports, "runtimeContext", ()=>(0, _vegaRuntime.context)); -parcelHelpers.export(exports, "codegenExpression", ()=>(0, _vegaExpression.codegenExpression)); -parcelHelpers.export(exports, "parseExpression", ()=>(0, _vegaExpression.parseExpression)); -parcelHelpers.export(exports, "parseSelector", ()=>(0, _vegaEventSelector.parseSelector)); -parcelHelpers.export(exports, "version", ()=>version); -var _vegaUtil = require("vega-util"); -parcelHelpers.exportAll(_vegaUtil, exports); -var _vegaDataflow = require("vega-dataflow"); -var _vegaTransforms = require("vega-transforms"); -var _vegaViewTransforms = require("vega-view-transforms"); -var _vegaEncode = require("vega-encode"); -var _vegaGeo = require("vega-geo"); -var _vegaForce = require("vega-force"); -var _vegaHierarchy = require("vega-hierarchy"); -var _vegaLabel = require("vega-label"); -var _vegaRegression = require("vega-regression"); -var _vegaVoronoi = require("vega-voronoi"); -var _vegaWordcloud = require("vega-wordcloud"); -var _vegaCrossfilter = require("vega-crossfilter"); -var _vegaStatistics = require("vega-statistics"); -parcelHelpers.exportAll(_vegaStatistics, exports); -var _vegaTime = require("vega-time"); -parcelHelpers.exportAll(_vegaTime, exports); -var _vegaLoader = require("vega-loader"); -parcelHelpers.exportAll(_vegaLoader, exports); -var _vegaScenegraph = require("vega-scenegraph"); -parcelHelpers.exportAll(_vegaScenegraph, exports); -var _vegaScale = require("vega-scale"); -var _vegaProjection = require("vega-projection"); -var _vegaView = require("vega-view"); -var _vegaFormat = require("vega-format"); -var _vegaFunctions = require("vega-functions"); -var _vegaParser = require("vega-parser"); -var _vegaRuntime = require("vega-runtime"); -var _vegaExpression = require("vega-expression"); -var _vegaEventSelector = require("vega-event-selector"); -var version = "5.32.0"; -// -- Transforms ----- -(0, _vegaUtil.extend)((0, _vegaDataflow.transforms), _vegaTransforms, _vegaViewTransforms, _vegaEncode, _vegaGeo, _vegaForce, _vegaLabel, _vegaHierarchy, _vegaRegression, _vegaVoronoi, _vegaWordcloud, _vegaCrossfilter); - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","vega-transforms":"2YZ3v","vega-view-transforms":"hvqjl","vega-encode":"1JcF5","vega-geo":"5TaRi","vega-force":"7a0MQ","vega-hierarchy":"4Esn8","vega-label":"htBqA","vega-regression":"c1OiC","vega-voronoi":"g4ZwP","vega-wordcloud":"3Db9C","vega-crossfilter":"ipwtZ","vega-statistics":"4QSQj","vega-time":"kjkWX","vega-loader":"8kWcg","vega-scenegraph":"gJqm6","vega-scale":"gHN3E","vega-projection":"erWDs","vega-view":"15ELa","vega-format":"3VXXV","vega-functions":"6VJ1U","vega-parser":"4Bjyk","vega-runtime":"boQgz","vega-expression":"8Nghf","vega-event-selector":"b96Fh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f2ulH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Debug", ()=>Debug); -parcelHelpers.export(exports, "Error", ()=>Error$1); -parcelHelpers.export(exports, "Info", ()=>Info); -parcelHelpers.export(exports, "None", ()=>None); -parcelHelpers.export(exports, "Warn", ()=>Warn); -parcelHelpers.export(exports, "accessor", ()=>accessor); -parcelHelpers.export(exports, "accessorFields", ()=>accessorFields); -parcelHelpers.export(exports, "accessorName", ()=>accessorName); -parcelHelpers.export(exports, "array", ()=>array); -parcelHelpers.export(exports, "ascending", ()=>ascending); -parcelHelpers.export(exports, "clampRange", ()=>clampRange); -parcelHelpers.export(exports, "compare", ()=>compare); -parcelHelpers.export(exports, "constant", ()=>constant); -parcelHelpers.export(exports, "debounce", ()=>debounce); -parcelHelpers.export(exports, "error", ()=>error); -parcelHelpers.export(exports, "extend", ()=>extend); -parcelHelpers.export(exports, "extent", ()=>extent); -parcelHelpers.export(exports, "extentIndex", ()=>extentIndex); -parcelHelpers.export(exports, "falsy", ()=>falsy); -parcelHelpers.export(exports, "fastmap", ()=>fastmap); -parcelHelpers.export(exports, "field", ()=>field); -parcelHelpers.export(exports, "flush", ()=>flush); -parcelHelpers.export(exports, "hasOwnProperty", ()=>has); -parcelHelpers.export(exports, "id", ()=>id); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "inherits", ()=>inherits); -parcelHelpers.export(exports, "inrange", ()=>inrange); -parcelHelpers.export(exports, "isArray", ()=>isArray); -parcelHelpers.export(exports, "isBoolean", ()=>isBoolean); -parcelHelpers.export(exports, "isDate", ()=>isDate); -parcelHelpers.export(exports, "isFunction", ()=>isFunction); -parcelHelpers.export(exports, "isIterable", ()=>isIterable); -parcelHelpers.export(exports, "isNumber", ()=>isNumber); -parcelHelpers.export(exports, "isObject", ()=>isObject); -parcelHelpers.export(exports, "isRegExp", ()=>isRegExp); -parcelHelpers.export(exports, "isString", ()=>isString); -parcelHelpers.export(exports, "key", ()=>key); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "logger", ()=>logger); -parcelHelpers.export(exports, "lruCache", ()=>lruCache); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "mergeConfig", ()=>mergeConfig); -parcelHelpers.export(exports, "one", ()=>one); -parcelHelpers.export(exports, "pad", ()=>pad); -parcelHelpers.export(exports, "panLinear", ()=>panLinear); -parcelHelpers.export(exports, "panLog", ()=>panLog); -parcelHelpers.export(exports, "panPow", ()=>panPow); -parcelHelpers.export(exports, "panSymlog", ()=>panSymlog); -parcelHelpers.export(exports, "peek", ()=>peek); -parcelHelpers.export(exports, "quarter", ()=>quarter); -parcelHelpers.export(exports, "repeat", ()=>repeat); -parcelHelpers.export(exports, "span", ()=>span); -parcelHelpers.export(exports, "splitAccessPath", ()=>splitAccessPath); -parcelHelpers.export(exports, "stringValue", ()=>$); -parcelHelpers.export(exports, "toBoolean", ()=>toBoolean); -parcelHelpers.export(exports, "toDate", ()=>toDate); -parcelHelpers.export(exports, "toNumber", ()=>toNumber); -parcelHelpers.export(exports, "toSet", ()=>toSet); -parcelHelpers.export(exports, "toString", ()=>toString); -parcelHelpers.export(exports, "truncate", ()=>truncate); -parcelHelpers.export(exports, "truthy", ()=>truthy); -parcelHelpers.export(exports, "utcquarter", ()=>utcquarter); -parcelHelpers.export(exports, "visitArray", ()=>visitArray); -parcelHelpers.export(exports, "writeConfig", ()=>writeConfig); -parcelHelpers.export(exports, "zero", ()=>zero); -parcelHelpers.export(exports, "zoomLinear", ()=>zoomLinear); -parcelHelpers.export(exports, "zoomLog", ()=>zoomLog); -parcelHelpers.export(exports, "zoomPow", ()=>zoomPow); -parcelHelpers.export(exports, "zoomSymlog", ()=>zoomSymlog); -function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; -} -function accessorName(fn) { - return fn == null ? null : fn.fname; -} -function accessorFields(fn) { - return fn == null ? null : fn.fields; -} -function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); -} -const get1 = (field)=>function(obj) { - return obj[field]; - }; -const getN = (path)=>{ - const len = path.length; - return function(obj) { - for(let i = 0; i < len; ++i)obj = obj[path[i]]; - return obj; - }; -}; -function error(message) { - throw Error(message); -} -function splitAccessPath(p) { - const path = [], n = p.length; - let q = null, b = 0, s = '', i, j, c; - p = p + ''; - function push() { - path.push(s + p.substring(i, j)); - s = ''; - i = j + 1; + }); + function Pivot(params2) { + Aggregate$1.call(this, params2); + } + Pivot.Definition = { + "type": "Pivot", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "value", + "type": "field", + "required": true + }, { + "name": "op", + "type": "enum", + "values": ValidAggregateOps, + "default": "sum" + }, { + "name": "limit", + "type": "number", + "default": 0 + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Pivot, Aggregate$1, { + _transform: Aggregate$1.prototype.transform, + transform(_, pulse2) { + return this._transform(aggregateParams(_, pulse2), pulse2); } - for(i = j = 0; j < n; ++j){ - c = p[j]; - if (c === '\\') { - s += p.substring(i, j++); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) continue; - else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) push(); - else i = j + 1; - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); - if (j > i) { - j++; - push(); - } - return path; -} -function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [ - field - ], name || field); -} -const id = field('id'); -const identity = accessor((_)=>_, [], 'identity'); -const zero = accessor(()=>0, [], 'zero'); -const one = accessor(()=>1, [], 'one'); -const truthy = accessor(()=>true, [], 'true'); -const falsy = accessor(()=>false, [], 'false'); -function log$1(method, level, input) { - const args = [ - level - ].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console -} -const None = 0; -const Error$1 = 1; -const Warn = 2; -const Info = 3; -const Debug = 4; -function logger(_, method) { - let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1; - let level = _ || None; + }); + function aggregateParams(_, pulse2) { + const key2 = _.field, value2 = _.value, op = (_.op === "count" ? "__count__" : _.op) || "sum", fields = accessorFields(key2).concat(accessorFields(value2)), keys2 = pivotKeys(key2, _.limit || 0, pulse2); + if (pulse2.changed()) _.set("__pivot__", null, null, true); return { - level (_) { - if (arguments.length) { - level = +_; - return this; - } else return level; - }, - error () { - if (level >= Error$1) handler(method || 'error', 'ERROR', arguments); - return this; - }, - warn () { - if (level >= Warn) handler(method || 'warn', 'WARN', arguments); - return this; - }, - info () { - if (level >= Info) handler(method || 'log', 'INFO', arguments); - return this; - }, - debug () { - if (level >= Debug) handler(method || 'log', 'DEBUG', arguments); - return this; - } + key: _.key, + groupby: _.groupby, + ops: keys2.map(() => op), + fields: keys2.map((k) => get$4(k, key2, value2, fields)), + as: keys2.map((k) => k + ""), + modified: _.modified.bind(_) }; -} -var isArray = Array.isArray; -function isObject(_) { - return _ === Object(_); -} -const isLegalKey = (key)=>key !== '__proto__'; -function mergeConfig() { - for(var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++)configs[_key] = arguments[_key]; - return configs.reduce((out, source)=>{ - for(const key in source)if (key === 'signals') // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - const r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); - } - return out; - }, {}); -} -function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; - let k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - for(k in value){ - if (recurse && (recurse === true || recurse[k])) writeConfig(o, k, value[k]); - else if (isLegalKey(k)) o[k] = value[k]; - } - } else output[key] = value; -} -function mergeNamed(a, b) { - if (a == null) return b; - const map = {}, out = []; - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - b.forEach(add); - a.forEach(add); - return out; -} -function peek(array) { - return array[array.length - 1]; -} -function toNumber(_) { - return _ == null || _ === '' ? null : +_; -} -const exp = (sign)=>(x)=>sign * Math.exp(x); -const log = (sign)=>(x)=>Math.log(sign * x); -const symlog = (c)=>(x)=>Math.sign(x) * Math.log1p(Math.abs(x / c)); -const symexp = (c)=>(x)=>Math.sign(x) * Math.expm1(Math.abs(x)) * c; -const pow = (exponent)=>(x)=>x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); -function pan(domain, delta, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), dd = (d1 - d0) * delta; - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; -} -function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); -} -function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log(sign), exp(sign)); -} -function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1 / exponent)); -} -function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); -} -function zoom(domain, anchor, scale, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; -} -function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); -} -function zoomLog(domain, anchor, scale) { - const sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log(sign), exp(sign)); -} -function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent)); -} -function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); -} -function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); -} -function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); -} -function array(_) { - return _ != null ? isArray(_) ? _ : [ - _ - ] : []; -} -/** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ function clampRange(range, min, max) { - let lo = range[0], hi = range[1], span; - if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - return span >= max - min ? [ - min, - max - ] : [ - lo = Math.min(Math.max(lo, min), max - span), - lo + span - ]; -} -function isFunction(_) { - return typeof _ === 'function'; -} -const DESCENDING = 'descending'; -function compare(fields, orders, opt) { - opt = opt || {}; - orders = array(orders) || []; - const ord = [], get = [], fmap = {}, gen = opt.comparator || comparator; - array(fields).forEach((f, i)=>{ - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach((_)=>fmap[_] = 1); + } + function get$4(k, key2, value2, fields) { + return accessor((d2) => key2(d2) === k ? value2(d2) : NaN, fields, k + ""); + } + function pivotKeys(key2, limit, pulse2) { + const map2 = {}, list = []; + pulse2.visit(pulse2.SOURCE, (t) => { + const k = key2(t); + if (!map2[k]) { + map2[k] = 1; + list.push(k); + } }); - return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap)); -} -const ascending = (u, v)=>(u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; -const comparator = (fields, orders)=>fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); -const compare1 = (field, order)=>function(a, b) { - return ascending(field(a), field(b)) * order; - }; -const compareN = (fields, orders, n)=>{ - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while(c === 0 && ++i < n){ - f = fields[i]; - c = ascending(f(a), f(b)); - } - return c * orders[i]; - }; -}; -function constant(_) { - return isFunction(_) ? _ : ()=>_; -} -function debounce(delay, handler) { - let tid; - return (e)=>{ - if (tid) clearTimeout(tid); - tid = setTimeout(()=>(handler(e), tid = null), delay); - }; -} -function extend(_) { - for(let x, k, i = 1, len = arguments.length; i < len; ++i){ - x = arguments[i]; - for(k in x)_[k] = x[k]; - } - return _; -} -/** - * Return an array with minimum and maximum values, in the - * form [min, max]. Ignores null, undefined, and NaN values. - */ function extent(array, f) { - let i = 0, n, v, min, max; - if (array && (n = array.length)) { - if (f == null) { - // find first valid value - for(v = array[i]; i < n && (v == null || v !== v); v = array[++i]); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = array[i]; - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } else { - // find first valid value - for(v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = f(array[i]); - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } + list.sort(ascending$1); + return limit ? list.slice(0, limit) : list; + } + function PreFacet$1(params2) { + Facet$1.call(this, params2); + } + inherits(PreFacet$1, Facet$1, { + transform(_, pulse2) { + const flow = _.subflow, field2 = _.field, subflow = (t) => this.subflow(tupleid(t), flow, pulse2, t); + if (_.modified("field") || field2 && pulse2.modified(accessorFields(field2))) { + error("PreFacet does not support field modification."); + } + this.initTargets(); + if (field2) { + pulse2.visit(pulse2.MOD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.mod(_2)); + }); + pulse2.visit(pulse2.ADD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.add(ingest$1(_2))); + }); + pulse2.visit(pulse2.REM, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.rem(_2)); + }); + } else { + pulse2.visit(pulse2.MOD, (t) => subflow(t).mod(t)); + pulse2.visit(pulse2.ADD, (t) => subflow(t).add(t)); + pulse2.visit(pulse2.REM, (t) => subflow(t).rem(t)); + } + if (pulse2.clean()) { + pulse2.runAfter(() => this.clean()); + } + return pulse2; } - return [ - min, - max - ]; -} -function extentIndex(array, f) { - const n = array.length; - let i = -1, a, b, c, u, v; - if (f == null) { - while(++i < n){ - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } - } else { - while(++i < n){ - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } - } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } - } + }); + function Project(params2) { + Transform.call(this, null, params2); + } + Project.Definition = { + "type": "Project", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }] + }; + inherits(Project, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive2 = fields ? (s2, t) => project(s2, t, fields, as) : rederive; + let lut; + if (this.value) { + lut = this.value; + } else { + pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive2(t, ingest$1({})); + lut[tupleid(t)] = dt; + out.add.push(dt); + }); + pulse2.visit(pulse2.MOD, (t) => { + out.mod.push(derive2(t, lut[tupleid(t)])); + }); + return out; } - return [ - u, - v - ]; -} -function has(object, property) { - return Object.hasOwn(object, property); -} -const NULL = {}; -function fastmap(input) { - let obj = {}, test; - function has$1(key) { - return has(obj, key) && obj[key] !== NULL; - } - const map = { - size: 0, - empty: 0, - object: obj, - has: has$1, - get (key) { - return has$1(key) ? obj[key] : undefined; - }, - set (key, value) { - if (!has$1(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete (key) { - if (has$1(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear () { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test (_) { - if (arguments.length) { - test = _; - return map; - } else return test; - }, - clean () { - const next = {}; - let size = 0; - for(const key in obj){ - const value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = obj = next; - } - }; - if (input) Object.keys(input).forEach((key)=>{ - map.set(key, input[key]); - }); - return map; -} -function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - const t = +threshold; - let a = range[0], b = peek(range), l; - // swap endpoints if range is reversed - if (b < a) { - l = a; - a = b; - b = l; - } - // compare value to endpoints - l = Math.abs(value - a); - const r = Math.abs(b - value); - // adjust if value is within threshold distance of endpoint - return l < r && l <= t ? left : r <= t ? right : center; -} -function inherits(child, parent, members) { - const proto = child.prototype = Object.create(parent.prototype); - Object.defineProperty(proto, 'constructor', { - value: child, - writable: true, - enumerable: true, - configurable: true - }); - return extend(proto, members); -} -/** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ function inrange(value, range, left, right) { - let r0 = range[0], r1 = range[range.length - 1], t; - if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1); -} -function isBoolean(_) { - return typeof _ === 'boolean'; -} -function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; -} -function isIterable(_) { - return _ && isFunction(_[Symbol.iterator]); -} -function isNumber(_) { - return typeof _ === 'number'; -} -function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; -} -function isString(_) { - return typeof _ === 'string'; -} -function key(fields, flat, opt) { - if (fields) fields = flat ? array(fields).map((f)=>f.replace(/\\(.)/g, '$1')) : array(fields); - const len = fields && fields.length, gen = opt && opt.get || getter, map = (f)=>gen(flat ? [ - f - ] : splitAccessPath(f)); - let fn; - if (!len) fn = function() { - return ''; - }; - else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { - return '' + get(_); - }; - } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while(++i < len)s += '|' + get[i](_); - return s; - }; + }); + function project(s2, t, fields, as) { + for (let i = 0, n = fields.length; i < n; ++i) { + t[as[i]] = fields[i](s2); } - return accessor(fn, fields, 'key'); -} -function lerp(array, frac) { - const lo = array[0], hi = peek(array), f = +frac; - return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); -} -const DEFAULT_MAX_SIZE = 10000; -// adapted from https://github.com/dominictarr/hashlru/ (MIT License) -function lruCache(maxsize) { - maxsize = +maxsize || DEFAULT_MAX_SIZE; - let curr, prev, size; - const clear = ()=>{ - curr = {}; - prev = {}; - size = 0; - }; - const update = (key, value)=>{ - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return curr[key] = value; - }; - clear(); - return { - clear, - has: (key)=>has(curr, key) || has(prev, key), - get: (key)=>has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined, - set: (key, value)=>has(curr, key) ? curr[key] = value : update(key, value) - }; -} -function merge(compare, array0, array1, output) { - const n0 = array0.length, n1 = array1.length; - if (!n1) return array0; - if (!n0) return array1; - const merged = output || new array0.constructor(n0 + n1); - let i0 = 0, i1 = 0, i = 0; - for(; i0 < n0 && i1 < n1; ++i)merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; - for(; i0 < n0; ++i0, ++i)merged[i] = array0[i0]; - for(; i1 < n1; ++i1, ++i)merged[i] = array1[i1]; - return merged; -} -function repeat(str, reps) { - let s = ''; - while(--reps >= 0)s += str; - return s; -} -function pad(str, length, padchar, align) { - const c = padchar || ' ', s = str + '', n = length - s.length; - return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n); -} -/** - * Return the numerical span of an array: the difference between - * the last and first values. - */ function span(array) { - return array && peek(array) - array[0] || 0; -} -function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') : x; -} -function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; -} -const defaultParser = (_)=>isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); -function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); -} -function toString(_) { - return _ == null || _ === '' ? null : _ + ''; -} -function toSet(_) { - const s = {}, n = _.length; - for(let i = 0; i < n; ++i)s[_[i]] = true; - return s; -} -function truncate(str, length, align, ellipsis) { - const e = ellipsis != null ? ellipsis : '\u2026', s = str + '', n = s.length, l = Math.max(0, length - e.length); - return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; -} -function visitArray(array, filter, visitor) { - if (array) { - if (filter) { - const n = array.length; - for(let i = 0; i < n; ++i){ - const t = filter(array[i]); - if (t) visitor(t, i, array); - } - } else array.forEach(visitor); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cFRfY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>Dataflow); -parcelHelpers.export(exports, "EventStream", ()=>EventStream); -parcelHelpers.export(exports, "MultiPulse", ()=>MultiPulse); -parcelHelpers.export(exports, "Operator", ()=>Operator); -parcelHelpers.export(exports, "Parameters", ()=>Parameters); -parcelHelpers.export(exports, "Pulse", ()=>Pulse); -parcelHelpers.export(exports, "Transform", ()=>Transform); -parcelHelpers.export(exports, "UniqueList", ()=>UniqueList); -parcelHelpers.export(exports, "asyncCallback", ()=>asyncCallback); -parcelHelpers.export(exports, "changeset", ()=>changeset); -parcelHelpers.export(exports, "definition", ()=>definition); -parcelHelpers.export(exports, "derive", ()=>derive); -parcelHelpers.export(exports, "ingest", ()=>ingest$1); -parcelHelpers.export(exports, "isChangeSet", ()=>isChangeSet); -parcelHelpers.export(exports, "isTuple", ()=>isTuple); -parcelHelpers.export(exports, "rederive", ()=>rederive); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "stableCompare", ()=>stableCompare); -parcelHelpers.export(exports, "transform", ()=>transform); -parcelHelpers.export(exports, "transforms", ()=>transforms); -parcelHelpers.export(exports, "tupleid", ()=>tupleid); -var _vegaUtil = require("vega-util"); -var _vegaLoader = require("vega-loader"); -var _vegaFormat = require("vega-format"); -function UniqueList(idFunc) { - const $ = idFunc || (0, _vegaUtil.identity), list = [], ids = {}; - list.add = (_)=>{ - const id = $(_); - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - return list; - }; - list.remove = (_)=>{ - const id = $(_); - if (ids[id]) { - ids[id] = 0; - const idx = list.indexOf(_); - if (idx >= 0) list.splice(idx, 1); - } - return list; - }; - return list; -} -/** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ async function asyncCallback(df, callback) { - try { - await callback(df); - } catch (err) { - df.error(err); - } -} -const TUPLE_ID_KEY = Symbol('vega_id'); -let TUPLE_ID = 1; -/** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ function isTuple(t) { - return !!(t && tupleid(t)); -} -/** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ function tupleid(t) { - return t[TUPLE_ID_KEY]; -} -/** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ function setid(t, id) { - t[TUPLE_ID_KEY] = id; return t; -} -/** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ function ingest$1(datum) { - const t = datum === Object(datum) ? datum : { - data: datum - }; - return tupleid(t) ? t : setid(t, TUPLE_ID++); -} -/** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ function derive(t) { - return rederive(t, ingest$1({})); -} -/** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ function rederive(t, d) { - for(const k in t)d[k] = t[k]; - return d; -} -/** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ function replace(t, d) { - return setid(d, tupleid(t)); -} -/** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ function stableCompare(cmp, f) { - return !cmp ? null : f ? (a, b)=>cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b)=>cmp(a, b) || tupleid(a) - tupleid(b); -} -function isChangeSet(v) { - return v && v.constructor === changeset; -} -function changeset() { - const add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = []; // modify by predicate - let clean = null, reflow = false; - return { - constructor: changeset, - insert (t) { - const d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)add.push(d[i]); - return this; - }, - remove (t) { - const a = (0, _vegaUtil.isFunction)(t) ? remp : rem, d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)a.push(d[i]); - return this; - }, - modify (t, field, value) { - const m = { - field: field, - value: (0, _vegaUtil.constant)(value) - }; - if ((0, _vegaUtil.isFunction)(t)) { - m.filter = t; - modp.push(m); - } else { - m.tuple = t; - mod.push(m); - } - return this; - }, - encode (t, set) { - if ((0, _vegaUtil.isFunction)(t)) modp.push({ - filter: t, - field: set - }); - else mod.push({ - tuple: t, - field: set - }); - return this; - }, - clean (value) { - clean = value; - return this; - }, - reflow () { - reflow = true; - return this; - }, - pulse (pulse, tuples) { - const cur = {}, out = {}; - let i, n, m, f, t, id; - // build lookup table of current tuples - for(i = 0, n = tuples.length; i < n; ++i)cur[tupleid(tuples[i])] = 1; - // process individual tuples to remove - for(i = 0, n = rem.length; i < n; ++i){ - t = rem[i]; - cur[tupleid(t)] = -1; - } - // process predicate-based removals - for(i = 0, n = remp.length; i < n; ++i){ - f = remp[i]; - tuples.forEach((t)=>{ - if (f(t)) cur[tupleid(t)] = -1; - }); - } - // process all add tuples - for(i = 0, n = add.length; i < n; ++i){ - t = add[i]; - id = tupleid(t); - if (cur[id]) // tuple already resides in dataset - // if flagged for both add and remove, cancel - cur[id] = 1; - else // tuple does not reside in dataset, add - pulse.add.push(ingest$1(add[i])); - } - // populate pulse rem list - for(i = 0, n = tuples.length; i < n; ++i){ - t = tuples[i]; - if (cur[tupleid(t)] < 0) pulse.rem.push(t); - } - // modify helper method - function modify(t, f, v) { - if (v) t[f] = v(t); - else pulse.encode = f; - if (!reflow) out[tupleid(t)] = t; - } - // process individual tuples to modify - for(i = 0, n = mod.length; i < n; ++i){ - m = mod[i]; - t = m.tuple; - f = m.field; - id = cur[tupleid(t)]; - if (id > 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - // process predicate-based modifications - for(i = 0, n = modp.length; i < n; ++i){ - m = modp[i]; - f = m.filter; - tuples.forEach((t)=>{ - if (f(t) && cur[tupleid(t)] > 0) modify(t, m.field, m.value); - }); - pulse.modifies(m.field); - } - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) pulse.mod = rem.length || remp.length ? tuples.filter((t)=>cur[tupleid(t)] > 0) : tuples.slice(); - else for(id in out)pulse.mod.push(out[id]); - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) pulse.clean(true); - return pulse; - } - }; -} -const CACHE = '_:mod:_'; -/** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ function Parameters() { - Object.defineProperty(this, CACHE, { - writable: true, - value: {} - }); -} -Parameters.prototype = { - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ set (name, index, value, force) { - const o = this, v = o[name], mod = o[CACHE]; - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = (0, _vegaUtil.isArray)(value) ? 1 + value.length : -1; - } - return o; + } + function Proxy$1(params2) { + Transform.call(this, null, params2); + } + inherits(Proxy$1, Transform, { + transform(_, pulse2) { + this.value = _.value; + return _.modified("value") ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; + } + }); + function Quantile$1(params2) { + Transform.call(this, null, params2); + } + Quantile$1.Definition = { + "type": "Quantile", + "metadata": { + "generates": true, + "changes": true }, - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ modified (name, index) { - const mod = this[CACHE]; - if (!arguments.length) { - for(const k in mod){ - if (mod[k]) return true; - } - return false; - } else if ((0, _vegaUtil.isArray)(name)) { - for(let k = 0; k < name.length; ++k){ - if (mod[name[k]]) return true; - } - return false; + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "probs", + "type": "number", + "array": true + }, { + "name": "step", + "type": "number", + "default": 0.01 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["prob", "value"] + }] + }; + const EPSILON$2 = 1e-14; + inherits(Quantile$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), as = _.as || ["prob", "value"]; + if (this.value && !_.modified() && !pulse2.changed()) { + out.source = this.value; + return out; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), values2 = [], step = _.step || 0.01, p = _.probs || range$3(step / 2, 1 - EPSILON$2, step), n = p.length; + groups.forEach((g) => { + const q = quantiles(g, p); + for (let i = 0; i < n; ++i) { + const t = {}; + for (let i2 = 0; i2 < names.length; ++i2) { + t[names[i2]] = g.dims[i2]; + } + t[as[0]] = p[i]; + t[as[1]] = q[i]; + values2.push(ingest$1(t)); } - return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name]; - }, - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ clear () { - this[CACHE] = {}; - return this; + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + return out; } -}; -let OP_ID = 0; -const PULSE = 'pulse', NO_PARAMS = new Parameters(); -// Boolean Flags -const SKIP$1 = 1, MODIFIED = 2; -/** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - if (update) this._update = update; - if (params) this.parameters(params, react); -} -function flag(bit) { - return function(state) { - const f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? f | bit : f & ~bit; - return this; - }; -} -Operator.prototype = { - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); - }, - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ set (value) { - if (this.value !== value) { - this.value = value; - return 1; - } else return 0; - }, - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ skip: flag(SKIP$1), - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ modified: flag(MODIFIED), - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initial evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ parameters (params, react, initonly) { - react = react !== false; - const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; - let name, value, n, i; - const add = (name, index, value)=>{ - if (value instanceof Operator) { - if (value !== this) { - if (react) value.targets().add(this); - deps.push(value); - } - argops.push({ - op: value, - name: name, - index: index - }); - } else argval.set(name, index, value); - }; - for(name in params){ - value = params[name]; - if (name === PULSE) { - (0, _vegaUtil.array)(value).forEach((op)=>{ - if (!(op instanceof Operator)) (0, _vegaUtil.error)('Pulse parameters must be operator instances.'); - else if (op !== this) { - op.targets().add(this); - deps.push(op); - } - }); - this.source = value; - } else if ((0, _vegaUtil.isArray)(value)) { - argval.set(name, -1, Array(n = value.length)); - for(i = 0; i < n; ++i)add(name, i, value[i]); - } else add(name, -1, value); - } - this.marshall().clear(); // initialize values - if (initonly) argops.initonly = true; - return deps; - }, - /** - * Internal method for marshalling parameter values. - * Visits each operator dependency to pull the latest value. - * @return {Parameters} A Parameters object to pass to the update function. - */ marshall (stamp) { - const argval = this._argval || NO_PARAMS, argops = this._argops; - let item, i, op, mod; - if (argops) { - const n = argops.length; - for(i = 0; i < n; ++i){ - item = argops[i]; - op = item.op; - mod = op.modified() && op.stamp === stamp; - argval.set(item.name, item.index, op.value, mod); - } - if (argops.initonly) { - for(i = 0; i < n; ++i){ - item = argops[i]; - item.op.targets().remove(this); - } - this._argops = null; - this._update = null; - } + }); + function Relay$1(params2) { + Transform.call(this, null, params2); + } + inherits(Relay$1, Transform, { + transform(_, pulse2) { + let out, lut; + if (this.value) { + lut = this.value; + } else { + out = pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + if (_.derive) { + out = pulse2.fork(pulse2.NO_SOURCE); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive(t); + lut[tupleid(t)] = dt; + out.add.push(dt); + }); + pulse2.visit(pulse2.MOD, (t) => { + const dt = lut[tupleid(t)]; + for (const k in t) { + dt[k] = t[k]; + out.modifies(k); + } + out.mod.push(dt); + }); + } + return out; + } + }); + function Sample(params2) { + Transform.call(this, [], params2); + this.count = 0; + } + Sample.Definition = { + "type": "Sample", + "metadata": {}, + "params": [{ + "name": "size", + "type": "number", + "default": 1e3 + }] + }; + inherits(Sample, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), mod = _.modified("size"), num = _.size, map2 = this.value.reduce((m2, t) => (m2[tupleid(t)] = 1, m2), {}); + let res = this.value, cnt = this.count, cap = 0; + function update2(t) { + let p, idx; + if (res.length < num) { + res.push(t); + } else { + idx = ~~((cnt + 1) * random()); + if (idx < res.length && idx >= cap) { + p = res[idx]; + if (map2[tupleid(p)]) out.rem.push(p); + res[idx] = t; + } + } + ++cnt; + } + if (pulse2.rem.length) { + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (map2[id2]) { + map2[id2] = -1; + out.rem.push(t); + } + --cnt; + }); + res = res.filter((t) => map2[tupleid(t)] !== -1); + } + if ((pulse2.rem.length || mod) && res.length < num && pulse2.source) { + cap = cnt = res.length; + pulse2.visit(pulse2.SOURCE, (t) => { + if (!map2[tupleid(t)]) update2(t); + }); + cap = -1; + } + if (mod && res.length > num) { + const n = res.length - num; + for (let i = 0; i < n; ++i) { + map2[tupleid(res[i])] = -1; + out.rem.push(res[i]); } - return argval; + res = res.slice(n); + } + if (pulse2.mod.length) { + pulse2.visit(pulse2.MOD, (t) => { + if (map2[tupleid(t)]) out.mod.push(t); + }); + } + if (pulse2.add.length) { + pulse2.visit(pulse2.ADD, update2); + } + if (pulse2.add.length || cap < 0) { + out.add = res.filter((t) => !map2[tupleid(t)]); + } + this.count = cnt; + this.value = out.source = res; + return out; + } + }); + function Sequence(params2) { + Transform.call(this, null, params2); + } + Sequence.Definition = { + "type": "Sequence", + "metadata": { + "generates": true, + "changes": true }, - /** - * Detach this operator from the dataflow. - * Unregisters listeners on upstream dependencies. - */ detach () { - const argops = this._argops; - let i, n, item, op; - if (argops) for(i = 0, n = argops.length; i < n; ++i){ - item = argops[i]; - op = item.op; - if (op._targets) op._targets.remove(this); - } - // remove references to the source and pulse object, - // if present, to prevent memory leaks of old data. - this.pulse = null; - this.source = null; + "params": [{ + "name": "start", + "type": "number", + "required": true + }, { + "name": "stop", + "type": "number", + "required": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "as", + "type": "string", + "default": "data" + }] + }; + inherits(Sequence, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) return; + const out = pulse2.materialize().fork(pulse2.MOD), as = _.as || "data"; + out.rem = this.value ? pulse2.rem.concat(this.value) : pulse2.rem; + this.value = range$3(_.start, _.stop, _.step || 1).map((v) => { + const t = {}; + t[as] = v; + return ingest$1(t); + }); + out.add = pulse2.add.concat(this.value); + return out; + } + }); + function Sieve$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Sieve$1, Transform, { + transform(_, pulse2) { + this.value = pulse2.source; + return pulse2.changed() ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; + } + }); + function TimeUnit(params2) { + Transform.call(this, null, params2); + } + const OUTPUT = ["unit0", "unit1"]; + TimeUnit.Definition = { + "type": "TimeUnit", + "metadata": { + "modifies": true }, - /** - * Delegate method to perform operator processing. - * Subclasses can override this method to perform custom processing. - * By default, it marshalls parameters and calls the update function - * if that function is defined. If the update function does not - * change the operator value then StopPropagation is returned. - * If no update function is defined, this method does nothing. - * @param {Pulse} pulse - the current dataflow pulse. - * @return The output pulse or StopPropagation. A falsy return value - * (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const update = this._update; - if (update) { - const params = this.marshall(pulse.stamp), v = update.call(this, params, pulse); - params.clear(); - if (v !== this.value) this.value = v; - else if (!this.modified()) return pulse.StopPropagation; + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "units", + "type": "enum", + "values": TIME_UNITS, + "array": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "maxbins", + "type": "number", + "default": 40 + }, { + "name": "extent", + "type": "date", + "array": true + }, { + "name": "timezone", + "type": "enum", + "default": "local", + "values": ["local", "utc"] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": OUTPUT + }] + }; + inherits(TimeUnit, Transform, { + transform(_, pulse2) { + const field2 = _.field, band2 = _.interval !== false, utc = _.timezone === "utc", floor2 = this._floor(_, pulse2), offset2 = (utc ? utcInterval : timeInterval)(floor2.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor2.step; + let min2 = floor2.start || Infinity, max2 = floor2.stop || -Infinity, flag2 = pulse2.ADD; + if (_.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(field2))) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(flag2, (t) => { + const v = field2(t); + let a2, b2; + if (v == null) { + t[u0] = null; + if (band2) t[u1] = null; + } else { + t[u0] = a2 = b2 = floor2(v); + if (band2) t[u1] = b2 = offset2(a2, step); + if (a2 < min2) min2 = a2; + if (b2 > max2) max2 = b2; } + }); + floor2.start = min2; + floor2.stop = max2; + return pulse2.modifies(band2 ? as : u0); }, - /** - * Run this operator for the current pulse. If this operator has already - * been run at (or after) the pulse timestamp, returns StopPropagation. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) { - this.skip(false); - rv = 0; - } else rv = this.evaluate(pulse); - return this.pulse = rv || pulse; - } -}; -/** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ function add(init, update, params, react) { - let shift = 1, op; - if (init instanceof Operator) op = init; - else if (init && init.prototype instanceof Operator) op = new init(); - else if ((0, _vegaUtil.isFunction)(init)) op = new Operator(null, init); - else { - shift = 0; - op = new Operator(init, update); + _floor(_, pulse2) { + const utc = _.timezone === "utc"; + const { + units, + step + } = _.units ? { + units: _.units, + step: _.step || 1 + } : bin$1({ + extent: _.extent || extent(pulse2.materialize(pulse2.SOURCE).source, _.field), + maxbins: _.maxbins + }); + const tunits = timeUnits(units), prev = this.value || {}, floor2 = (utc ? utcFloor : timeFloor)(tunits, step); + floor2.unit = peek$1(tunits); + floor2.units = tunits; + floor2.step = step; + floor2.start = prev.start; + floor2.stop = prev.stop; + return this.value = floor2; } - this.rank(op); - if (shift) { - react = params; - params = update; + }); + function TupleIndex(params2) { + Transform.call(this, fastmap(), params2); + } + inherits(TupleIndex, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, field2 = _.field, index2 = this.value, set2 = (t) => index2.set(field2(t), t); + let mod = true; + if (_.modified("field") || pulse2.modified(field2.fields)) { + index2.clear(); + pulse2.visit(pulse2.SOURCE, set2); + } else if (pulse2.changed()) { + pulse2.visit(pulse2.REM, (t) => index2.delete(field2(t))); + pulse2.visit(pulse2.ADD, set2); + } else { + mod = false; + } + this.modified(mod); + if (index2.empty > df.cleanThreshold) df.runAfter(index2.clean); + return pulse2.fork(); } - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - return op; -} -/** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array<Operator>} - The source operators that should propagate - * to the target operator. - */ function connect(target, sources) { - const targetRank = target.rank, n = sources.length; - for(let i = 0; i < n; ++i)if (targetRank < sources[i].rank) { - this.rerank(target); - return; + }); + function Values$1(params2) { + Transform.call(this, null, params2); + } + inherits(Values$1, Transform, { + transform(_, pulse2) { + const run2 = !this.value || _.modified("field") || _.modified("sort") || pulse2.changed() || _.sort && pulse2.modified(_.sort.fields); + if (run2) { + this.value = (_.sort ? pulse2.source.slice().sort(stableCompare(_.sort)) : pulse2.source).map(_.field); + } } -} -let STREAM_ID = 0; -/** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; -} -/** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); -} -EventStream.prototype = { - _filter: (0, _vegaUtil.truthy), - _apply: (0, _vegaUtil.identity), - targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); + }); + function WindowOp(op, field2, param2, as) { + const fn2 = WindowOps[op](field2, param2); + return { + init: fn2.init || zero$1, + update: function(w2, t) { + t[as] = fn2.next(w2); + } + }; + } + const WindowOps = { + row_number: function() { + return { + next: (w2) => w2.index + 1 + }; }, - consume (_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; + rank: function() { + let rank2; + return { + init: () => rank2 = 1, + next: (w2) => { + const i = w2.index, data2 = w2.data; + return i && w2.compare(data2[i - 1], data2[i]) ? rank2 = i + 1 : rank2; + } + }; }, - receive (evt) { - if (this._filter(evt)) { - const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; - for(let i = 0; i < n; ++i)trg[i].receive(val); - if (this._consume) { - evt.preventDefault(); - evt.stopPropagation(); - } - } + dense_rank: function() { + let drank; + return { + init: () => drank = 1, + next: (w2) => { + const i = w2.index, d2 = w2.data; + return i && w2.compare(d2[i - 1], d2[i]) ? ++drank : drank; + } + }; + }, + percent_rank: function() { + const rank2 = WindowOps.rank(), next = rank2.next; + return { + init: rank2.init, + next: (w2) => (next(w2) - 1) / (w2.data.length - 1) + }; }, - filter (filter) { - const s = stream(filter); - this.targets().add(s); - return s; + cume_dist: function() { + let cume; + return { + init: () => cume = 0, + next: (w2) => { + const d2 = w2.data, c2 = w2.compare; + let i = w2.index; + if (cume < i) { + while (i + 1 < d2.length && !c2(d2[i], d2[i + 1])) ++i; + cume = i; + } + return (1 + cume) / d2.length; + } + }; }, - apply (apply) { - const s = stream(null, apply); - this.targets().add(s); - return s; + ntile: function(field2, num) { + num = +num; + if (!(num > 0)) error("ntile num must be greater than zero."); + const cume = WindowOps.cume_dist(), next = cume.next; + return { + init: cume.init, + next: (w2) => Math.ceil(num * next(w2)) + }; }, - merge () { - const s = stream(); - this.targets().add(s); - for(let i = 0, n = arguments.length; i < n; ++i)arguments[i].targets().add(s); - return s; + lag: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index - offset2; + return i >= 0 ? field2(w2.data[i]) : null; + } + }; }, - throttle (pause) { - let t = -1; - return this.filter(()=>{ - const now = Date.now(); - if (now - t > pause) { - t = now; - return 1; - } else return 0; - }); + lead: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index + offset2, d2 = w2.data; + return i < d2.length ? field2(d2[i]) : null; + } + }; }, - debounce (delay) { - const s = stream(); - this.targets().add(stream(null, null, (0, _vegaUtil.debounce)(delay, (e)=>{ - const df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }))); - return s; + first_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i0]) + }; }, - between (a, b) { - let active = false; - a.targets().add(stream(null, null, ()=>active = true)); - b.targets().add(stream(null, null, ()=>active = false)); - return this.filter(()=>active); + last_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i1 - 1]) + }; }, - detach () { - // ensures compatibility with operators (#2753) - // remove references to other streams and filter functions that may - // be bound to subcontexts that need to be garbage collected. - this._filter = (0, _vegaUtil.truthy); - this._targets = null; - } -}; -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ function events(source, type, filter, apply) { - const df = this, s = stream(filter, apply), send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally{ - df.run(); + nth_value: function(field2, nth) { + nth = +nth; + if (!(nth > 0)) error("nth_value nth must be greater than zero."); + return { + next: (w2) => { + const i = w2.i0 + (nth - 1); + return i < w2.i1 ? field2(w2.data[i]) : null; + } + }; + }, + prev_value: function(field2) { + let prev; + return { + init: () => prev = null, + next: (w2) => { + const v = field2(w2.data[w2.index]); + return v != null ? prev = v : prev; + } + }; + }, + next_value: function(field2) { + let v, i; + return { + init: () => (v = null, i = -1), + next: (w2) => { + const d2 = w2.data; + return w2.index <= i ? v : (i = find$2(field2, d2, w2.index)) < 0 ? (i = d2.length, v = null) : v = field2(d2[i]); } + }; + } + }; + function find$2(field2, data2, index2) { + for (let n = data2.length; index2 < n; ++index2) { + const v = field2(data2[index2]); + if (v != null) return index2; + } + return -1; + } + const ValidWindowOps = Object.keys(WindowOps); + function WindowState(_) { + const ops2 = array$4(_.ops), fields = array$4(_.fields), params2 = array$4(_.params), aggregate_params = array$4(_.aggregate_params), as = array$4(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map2 = {}, counts = [], measures = []; + let countOnly = true; + function visitInputs(f) { + array$4(accessorFields(f)).forEach((_2) => inputs[_2] = 1); + } + visitInputs(_.sort); + ops2.forEach((op, i) => { + const field2 = fields[i], param2 = params2[i], aggregate_param = aggregate_params[i] || null, mname = accessorName(field2), name = measureName(op, mname, as[i]); + visitInputs(field2); + outputs.push(name); + if (has$1(WindowOps, op)) { + windows.push(WindowOp(op, field2, param2, name)); + } else { + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + if (op === "count") { + counts.push(name); + return; + } + countOnly = false; + let m2 = map2[mname]; + if (!m2) { + m2 = map2[mname] = []; + m2.field = field2; + measures.push(m2); + } + m2.push(createMeasure(op, aggregate_param, name)); + } + }); + if (counts.length || measures.length) { + this.cell = cell(measures, counts, countOnly); + } + this.inputs = Object.keys(inputs); + } + const prototype = WindowState.prototype; + prototype.init = function() { + this.windows.forEach((_) => _.init()); + if (this.cell) this.cell.init(); + }; + prototype.update = function(w2, t) { + const cell2 = this.cell, wind = this.windows, data2 = w2.data, m2 = wind && wind.length; + let j; + if (cell2) { + for (j = w2.p0; j < w2.i0; ++j) cell2.rem(data2[j]); + for (j = w2.p1; j < w2.i1; ++j) cell2.add(data2[j]); + cell2.set(t); + } + for (j = 0; j < m2; ++j) wind[j].update(w2, t); + }; + function cell(measures, counts, countOnly) { + measures = measures.map((m2) => compileMeasures(m2, m2.field)); + const cell2 = { + num: 0, + agg: null, + store: false, + count: counts }; - let sources; - if (typeof source === 'string' && typeof document !== 'undefined') sources = document.querySelectorAll(source); - else sources = (0, _vegaUtil.array)(source); - const n = sources.length; - for(let i = 0; i < n; ++i)sources[i].addEventListener(type, send); - return s; -} -function parse(data, format) { - const locale = this.locale(); - return (0, _vegaLoader.read)(data, format, locale.timeParse, locale.utcParse); -} -/** - * Ingests new data into the dataflow. First parses the data using the - * vega-loader read method, then pulses a changeset to the target operator. - * @param {Operator} target - The Operator to target with ingested data, - * typically a Collect transform instance. - * @param {*} data - The input data, prior to parsing. For JSON this may - * be a string or an object. For CSV, TSV, etc should be a string. - * @param {object} format - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @returns {Dataflow} - */ function ingest(target, data, format) { - data = this.parse(data, format); - return this.pulse(target, this.changeset().insert(data)); -} -/** - * Request data from an external source, parse it, and return a Promise. - * @param {string} url - The URL from which to load the data. This string - * is passed to the vega-loader load method. - * @param {object} [format] - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @return {Promise} A Promise that resolves upon completion of the request. - * The resolved object contains the following properties: - * - data: an array of parsed data (or null upon error) - * - status: a code for success (0), load fail (-1), or parse fail (-2) - */ async function request(url, format) { - const df = this; - let status = 0, data; - try { - data = await df.loader().load(url, { - context: 'dataflow', - response: (0, _vegaLoader.responseType)(format && format.type) - }); - try { - data = df.parse(data, format); - } catch (err) { - status = -2; - df.warn('Data ingestion failed', url, err); - } - } catch (err) { - status = -1; - df.warn('Loading failed', url, err); + if (!countOnly) { + var n = measures.length, a2 = cell2.agg = Array(n), i = 0; + for (; i < n; ++i) a2[i] = new measures[i](cell2); + } + if (cell2.store) { + var store = cell2.data = new TupleStore(); + } + cell2.add = function(t) { + cell2.num += 1; + if (countOnly) return; + if (store) store.add(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].add(a2[i2].get(t), t); + } + }; + cell2.rem = function(t) { + cell2.num -= 1; + if (countOnly) return; + if (store) store.rem(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].rem(a2[i2].get(t), t); + } + }; + cell2.set = function(t) { + let i2, n2; + if (store) store.values(); + for (i2 = 0, n2 = counts.length; i2 < n2; ++i2) t[counts[i2]] = cell2.num; + if (!countOnly) for (i2 = 0, n2 = a2.length; i2 < n2; ++i2) a2[i2].set(t); + }; + cell2.init = function() { + cell2.num = 0; + if (store) store.reset(); + for (let i2 = 0; i2 < n; ++i2) a2[i2].init(); + }; + return cell2; + } + function Window(params2) { + Transform.call(this, {}, params2); + this._mlen = 0; + this._mods = []; + } + Window.Definition = { + "type": "Window", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidWindowOps.concat(ValidAggregateOps) + }, { + "name": "params", + "type": "number", + "null": true, + "array": true + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "frame", + "type": "number", + "null": true, + "array": true, + "length": 2, + "default": [null, 0] + }, { + "name": "ignorePeers", + "type": "boolean", + "default": false + }] + }; + inherits(Window, Transform, { + transform(_, pulse2) { + this.stamp = pulse2.stamp; + const mod = _.modified(), cmp = stableCompare(_.sort), key2 = groupkey(_.groupby), group2 = (t) => this.group(key2(t)); + let state = this.state; + if (!state || mod) { + state = this.state = new WindowState(_); + } + if (mod || pulse2.modified(state.inputs)) { + this.value = {}; + pulse2.visit(pulse2.SOURCE, (t) => group2(t).add(t)); + } else { + pulse2.visit(pulse2.REM, (t) => group2(t).remove(t)); + pulse2.visit(pulse2.ADD, (t) => group2(t).add(t)); + } + for (let i = 0, n = this._mlen; i < n; ++i) { + processPartition(this._mods[i], state, cmp, _); + } + this._mlen = 0; + this._mods = []; + return pulse2.reflow(mod).modifies(state.outputs); + }, + group(key2) { + let group2 = this.value[key2]; + if (!group2) { + group2 = this.value[key2] = SortedList(tupleid); + group2.stamp = -1; + } + if (group2.stamp < this.stamp) { + group2.stamp = this.stamp; + this._mods[this._mlen++] = group2; + } + return group2; + } + }); + function processPartition(list, state, cmp, _) { + const sort2 = _.sort, range2 = sort2 && !_.ignorePeers, frame2 = _.frame || [null, 0], data2 = list.data(cmp), n = data2.length, b2 = range2 ? bisector(sort2) : null, w2 = { + i0: 0, + i1: 0, + p0: 0, + p1: 0, + index: 0, + data: data2, + compare: sort2 || constant$4(-1) + }; + state.init(); + for (let i = 0; i < n; ++i) { + setWindow(w2, frame2, i, n); + if (range2) adjustRange(w2, b2); + state.update(w2, data2[i]); + } + } + function setWindow(w2, f, i, n) { + w2.p0 = w2.i0; + w2.p1 = w2.i1; + w2.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); + w2.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); + w2.index = i; + } + function adjustRange(w2, bisect2) { + const r0 = w2.i0, r1 = w2.i1 - 1, c2 = w2.compare, d2 = w2.data, n = d2.length - 1; + if (r0 > 0 && !c2(d2[r0], d2[r0 - 1])) w2.i0 = bisect2.left(d2, d2[r0]); + if (r1 < n && !c2(d2[r1], d2[r1 + 1])) w2.i1 = bisect2.right(d2, d2[r1]); + } + const tx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + aggregate: Aggregate$1, + bin: Bin, + collect: Collect$1, + compare: Compare$1, + countpattern: CountPattern, + cross: Cross, + density: Density, + dotbin: DotBin, + expression: Expression$1, + extent: Extent, + facet: Facet$1, + field: Field$1, + filter: Filter, + flatten: Flatten, + fold: Fold, + formula: Formula, + generate: Generate, + impute: Impute, + joinaggregate: JoinAggregate, + kde: KDE, + key: Key$1, + load: Load$1, + lookup: Lookup, + multiextent: MultiExtent$1, + multivalues: MultiValues$1, + params: Params$2, + pivot: Pivot, + prefacet: PreFacet$1, + project: Project, + proxy: Proxy$1, + quantile: Quantile$1, + relay: Relay$1, + sample: Sample, + sequence: Sequence, + sieve: Sieve$1, + subflow: Subflow, + timeunit: TimeUnit, + tupleindex: TupleIndex, + values: Values$1, + window: Window + }, Symbol.toStringTag, { value: "Module" })); + function constant$2(x2) { + return function constant2() { + return x2; + }; + } + const abs$2 = Math.abs; + const atan2$1 = Math.atan2; + const cos$2 = Math.cos; + const max$1 = Math.max; + const min$1 = Math.min; + const sin$2 = Math.sin; + const sqrt$2 = Math.sqrt; + const epsilon$5 = 1e-12; + const pi$3 = Math.PI; + const halfPi$2 = pi$3 / 2; + const tau$3 = 2 * pi$3; + function acos$1(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$3 : Math.acos(x2); + } + function asin$2(x2) { + return x2 >= 1 ? halfPi$2 : x2 <= -1 ? -halfPi$2 : Math.asin(x2); + } + const pi$2 = Math.PI, tau$2 = 2 * pi$2, epsilon$4 = 1e-6, tauEpsilon = tau$2 - epsilon$4; + function append$1(strings2) { + this._ += strings2[0]; + for (let i = 1, n = strings2.length; i < n; ++i) { + this._ += arguments[i] + strings2[i]; + } + } + function appendRound$1(digits) { + let d2 = Math.floor(digits); + if (!(d2 >= 0)) throw new Error(`invalid digits: ${digits}`); + if (d2 > 15) return append$1; + const k = 10 ** d2; + return function(strings2) { + this._ += strings2[0]; + for (let i = 1, n = strings2.length; i < n; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings2[i]; + } + }; + } + let Path$1 = class Path { + constructor(digits) { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + this._append = digits == null ? append$1 : appendRound$1(digits); } + moveTo(x2, y2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; + } + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._append`Z`; + } + } + lineTo(x2, y2) { + this._append`L${this._x1 = +x2},${this._y1 = +y2}`; + } + quadraticCurveTo(x12, y12, x2, y2) { + this._append`Q${+x12},${+y12},${this._x1 = +x2},${this._y1 = +y2}`; + } + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + this._append`C${+x12},${+y12},${+x2},${+y2},${this._x1 = +x3},${this._y1 = +y3}`; + } + arcTo(x12, y12, x2, y2, r) { + x12 = +x12, y12 = +y12, x2 = +x2, y2 = +y2, r = +r; + if (r < 0) throw new Error(`negative radius: ${r}`); + let x02 = this._x1, y02 = this._y1, x21 = x2 - x12, y21 = y2 - y12, x01 = x02 - x12, y01 = y02 - y12, l01_2 = x01 * x01 + y01 * y01; + if (this._x1 === null) { + this._append`M${this._x1 = x12},${this._y1 = y12}`; + } else if (!(l01_2 > epsilon$4)) ; + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$4) || !r) { + this._append`L${this._x1 = x12},${this._y1 = y12}`; + } else { + let x20 = x2 - x02, y20 = y2 - y02, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; + if (Math.abs(t01 - 1) > epsilon$4) { + this._append`L${x12 + t01 * x01},${y12 + t01 * y01}`; + } + this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x12 + t21 * x21},${this._y1 = y12 + t21 * y21}`; + } + } + arc(x2, y2, r, a0, a1, ccw) { + x2 = +x2, y2 = +y2, r = +r, ccw = !!ccw; + if (r < 0) throw new Error(`negative radius: ${r}`); + let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x02 = x2 + dx, y02 = y2 + dy, cw2 = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; + if (this._x1 === null) { + this._append`M${x02},${y02}`; + } else if (Math.abs(this._x1 - x02) > epsilon$4 || Math.abs(this._y1 - y02) > epsilon$4) { + this._append`L${x02},${y02}`; + } + if (!r) return; + if (da < 0) da = da % tau$2 + tau$2; + if (da > tauEpsilon) { + this._append`A${r},${r},0,1,${cw2},${x2 - dx},${y2 - dy}A${r},${r},0,1,${cw2},${this._x1 = x02},${this._y1 = y02}`; + } else if (da > epsilon$4) { + this._append`A${r},${r},0,${+(da >= pi$2)},${cw2},${this._x1 = x2 + r * Math.cos(a1)},${this._y1 = y2 + r * Math.sin(a1)}`; + } + } + rect(x2, y2, w2, h2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${w2 = +w2}v${+h2}h${-w2}Z`; + } + toString() { + return this._; + } + }; + function path$3() { + return new Path$1(); + } + path$3.prototype = Path$1.prototype; + function withPath(shape2) { + let digits = 3; + shape2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) { + digits = null; + } else { + const d2 = Math.floor(_); + if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d2; + } + return shape2; + }; + return () => new Path$1(digits); + } + function arcInnerRadius(d2) { + return d2.innerRadius; + } + function arcOuterRadius(d2) { + return d2.outerRadius; + } + function arcStartAngle(d2) { + return d2.startAngle; + } + function arcEndAngle(d2) { + return d2.endAngle; + } + function arcPadAngle(d2) { + return d2 && d2.padAngle; + } + function intersect$3(x02, y02, x12, y12, x2, y2, x3, y3) { + var x10 = x12 - x02, y10 = y12 - y02, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; + if (t * t < epsilon$5) return; + t = (x32 * (y02 - y2) - y32 * (x02 - x2)) / t; + return [x02 + t * x10, y02 + t * y10]; + } + function cornerTangents(x02, y02, x12, y12, r1, rc, cw2) { + var x01 = x02 - x12, y01 = y02 - y12, lo = (cw2 ? rc : -rc) / sqrt$2(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x02 + ox, y11 = y02 + oy, x10 = x12 + ox, y10 = y12 + oy, x002 = (x11 + x10) / 2, y002 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x11 * y10 - x10 * y11, d3 = (dy < 0 ? -1 : 1) * sqrt$2(max$1(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d3) / d2, cy0 = (-D2 * dx - dy * d3) / d2, cx1 = (D2 * dy + dx * d3) / d2, cy1 = (-D2 * dx + dy * d3) / d2, dx0 = cx0 - x002, dy0 = cy0 - y002, dx1 = cx1 - x002, dy1 = cy1 - y002; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; return { - data, - status + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r - 1), + y11: cy0 * (r1 / r - 1) }; -} -async function preload(target, url, format) { - const df = this, pending = df._pending || loadPending(df); - pending.requests += 1; - const res = await df.request(url, format); - df.pulse(target, df.changeset().remove((0, _vegaUtil.truthy)).insert(res.data || [])); - pending.done(); - return res; -} -function loadPending(df) { - let accept; - const pending = new Promise((a)=>accept = a); - pending.requests = 0; - pending.done = ()=>{ - if (--pending.requests === 0) { - df._pending = null; - accept(df); - } + } + function arc$2$1() { + var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant$2(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context2 = null, path2 = withPath(arc2); + function arc2() { + var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi$2, a1 = endAngle.apply(this, arguments) - halfPi$2, da = abs$2(a1 - a0), cw2 = a1 > a0; + if (!context2) context2 = buffer = path2(); + if (r1 < r0) r = r1, r1 = r0, r0 = r; + if (!(r1 > epsilon$5)) context2.moveTo(0, 0); + else if (da > tau$3 - epsilon$5) { + context2.moveTo(r1 * cos$2(a0), r1 * sin$2(a0)); + context2.arc(0, 0, r1, a0, a1, !cw2); + if (r0 > epsilon$5) { + context2.moveTo(r0 * cos$2(a1), r0 * sin$2(a1)); + context2.arc(0, 0, r0, a1, a0, cw2); + } + } else { + var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon$5 && (padRadius ? +padRadius.apply(this, arguments) : sqrt$2(r0 * r0 + r1 * r1)), rc = min$1(abs$2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t02, t12; + if (rp > epsilon$5) { + var p02 = asin$2(rp / r0 * sin$2(ap)), p1 = asin$2(rp / r1 * sin$2(ap)); + if ((da0 -= p02 * 2) > epsilon$5) p02 *= cw2 ? 1 : -1, a00 += p02, a10 -= p02; + else da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon$5) p1 *= cw2 ? 1 : -1, a01 += p1, a11 -= p1; + else da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + var x01 = r1 * cos$2(a01), y01 = r1 * sin$2(a01), x10 = r0 * cos$2(a10), y10 = r0 * sin$2(a10); + if (rc > epsilon$5) { + var x11 = r1 * cos$2(a11), y11 = r1 * sin$2(a11), x002 = r0 * cos$2(a00), y002 = r0 * sin$2(a00), oc; + if (da < pi$3) { + if (oc = intersect$3(x01, y01, x002, y002, x11, y11, x10, y10)) { + var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) / 2), lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = min$1(rc, (r0 - lc) / (kc - 1)); + rc1 = min$1(rc, (r1 - lc) / (kc + 1)); + } else { + rc0 = rc1 = 0; + } + } + } + if (!(da1 > epsilon$5)) context2.moveTo(x01, y01); + else if (rc1 > epsilon$5) { + t02 = cornerTangents(x002, y002, x01, y01, r1, rc1, cw2); + t12 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw2); + context2.moveTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc1 < rc) context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r1, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), !cw2); + context2.arc(t12.cx, t12.cy, rc1, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.moveTo(x01, y01), context2.arc(0, 0, r1, a01, a11, !cw2); + if (!(r0 > epsilon$5) || !(da0 > epsilon$5)) context2.lineTo(x10, y10); + else if (rc0 > epsilon$5) { + t02 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw2); + t12 = cornerTangents(x01, y01, x002, y002, r0, -rc0, cw2); + context2.lineTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc0 < rc) context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r0, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), cw2); + context2.arc(t12.cx, t12.cy, rc0, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.arc(0, 0, r0, a10, a00, cw2); + } + context2.closePath(); + if (buffer) return context2 = null, buffer + "" || null; + } + arc2.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$3 / 2; + return [cos$2(a2) * r, sin$2(a2) * r]; }; - return df._pending = pending; -} -const SKIP = { - skip: true -}; -/** - * Perform operator updates in response to events. Applies an - * update function to compute a new operator value. If the update function - * returns a {@link ChangeSet}, the operator will be pulsed with those tuple - * changes. Otherwise, the operator value will be updated to the return value. - * @param {EventStream|Operator} source - The event source to react to. - * This argument can be either an EventStream or an Operator. - * @param {Operator|function(object):Operator} target - The operator to update. - * This argument can either be an Operator instance or (if the source - * argument is an EventStream), a function that accepts an event object as - * input and returns an Operator to target. - * @param {function(Parameters,Event): *} [update] - Optional update function - * to compute the new operator value, or a literal value to set. Update - * functions expect to receive a parameter object and event as arguments. - * This function can either return a new operator value or (if the source - * argument is an EventStream) a {@link ChangeSet} instance to pulse - * the target operator with tuple changes. - * @param {object} [params] - The update function parameters. - * @param {object} [options] - Additional options hash. If not overridden, - * updated operators will be skipped by default. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @return {Dataflow} - */ function on(source, target, update, params, options) { - const fn = source instanceof Operator ? onOperator : onStream; - fn(this, source, target, update, params, options); - return this; -} -function onStream(df, stream, target, update, params, options) { - const opt = (0, _vegaUtil.extend)({}, options, SKIP); - let func, op; - if (!(0, _vegaUtil.isFunction)(target)) target = (0, _vegaUtil.constant)(target); - if (update === undefined) func = (e)=>df.touch(target(e)); - else if ((0, _vegaUtil.isFunction)(update)) { - op = new Operator(null, update, params, false); - func = (e)=>{ - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else func = (e)=>df.update(target(e), update, opt); - stream.apply(func); -} -function onOperator(df, source, target, update, params, options) { - if (update === undefined) source.targets().add(target); - else { - const opt = options || {}, op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [ - op - ]); // rerank as needed, #1672 - } - } -} -function updater(target, update) { - update = (0, _vegaUtil.isFunction)(update) ? update : (0, _vegaUtil.constant)(update); - return target ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) target.skip(value !== this.value).value = value; - return value; - } : update; -} -/** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ function rank(op) { - op.rank = ++this._rank; -} -/** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ function rerank(op) { - const queue = [ - op - ]; - let cur, list, i; - while(queue.length){ - this.rank(cur = queue.pop()); - if (list = cur._targets) for(i = list.length; --i >= 0;){ - queue.push(cur = list[i]); - if (cur === op) (0, _vegaUtil.error)('Cycle detected in dataflow graph.'); - } - } -} -/** - * Sentinel value indicating pulse propagation should stop. - */ const StopPropagation = {}; -// Pulse visit type flags -const ADD = 1, REM = 2, MOD = 4, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD, ALL = ADD | REM | MOD, REFLOW = 8, SOURCE = 16, NO_SOURCE = 32, NO_FIELDS = 64; -/** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; -} -function materialize(data, filter) { - const out = []; - (0, _vegaUtil.visitArray)(data, filter, (_)=>out.push(_)); - return out; -} -function filter(pulse, flags) { - const map = {}; - pulse.visit(flags, (t)=>{ - map[tupleid(t)] = 1; - }); - return (t)=>map[tupleid(t)] ? null : t; -} -function addFilter(a, b) { - return a ? (t, i)=>a(t, i) && b(t, i) : b; -} -Pulse.prototype = { - /** - * Sentinel value indicating pulse propagation should stop. - */ StopPropagation, - /** - * Boolean flag indicating ADD (added) tuples. - */ ADD, - /** - * Boolean flag indicating REM (removed) tuples. - */ REM, - /** - * Boolean flag indicating MOD (modified) tuples. - */ MOD, - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ ADD_REM, - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ ADD_MOD, - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ ALL, - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ REFLOW, - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ SOURCE, - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ NO_SOURCE, - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ NO_FIELDS, - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ fork (flags) { - return new Pulse(this.dataflow).init(this, flags); + arc2.innerRadius = function(_) { + return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$2(+_), arc2) : innerRadius; + }; + arc2.outerRadius = function(_) { + return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$2(+_), arc2) : outerRadius; + }; + arc2.cornerRadius = function(_) { + return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$2(+_), arc2) : cornerRadius; + }; + arc2.padRadius = function(_) { + return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), arc2) : padRadius; + }; + arc2.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$2(+_), arc2) : startAngle; + }; + arc2.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$2(+_), arc2) : endAngle; + }; + arc2.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$2(+_), arc2) : padAngle; + }; + arc2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, arc2) : context2; + }; + return arc2; + } + function array$3(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function Linear$1(context2) { + this._context = context2; + } + Linear$1.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ clone () { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: + this._context.lineTo(x2, y2); + break; + } + } + }; + function curveLinear(context2) { + return new Linear$1(context2); + } + function x$3(p) { + return p[0]; + } + function y$3(p) { + return p[1]; + } + function line$2$1(x2, y2) { + var defined = constant$2(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(line2); + x2 = typeof x2 === "function" ? x2 : x2 === void 0 ? x$3 : constant$2(x2); + y2 = typeof y2 === "function" ? y2 : y2 === void 0 ? y$3 : constant$2(y2); + function line2(data2) { + var i, n = (data2 = array$3(data2)).length, d2, defined0 = false, buffer; + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d2 = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) output2.lineStart(); + else output2.lineEnd(); + } + if (defined0) output2.point(+x2(d2, i, data2), +y2(d2, i, data2)); + } + if (buffer) return output2 = null, buffer + "" || null; + } + line2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$2(+_), line2) : x2; + }; + line2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$2(+_), line2) : y2; + }; + line2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$2(!!_), line2) : defined; + }; + line2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), line2) : curve2; + }; + line2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), line2) : context2; + }; + return line2; + } + function area$2$1(x02, y02, y12) { + var x12 = null, defined = constant$2(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(area2); + x02 = typeof x02 === "function" ? x02 : x02 === void 0 ? x$3 : constant$2(+x02); + y02 = typeof y02 === "function" ? y02 : y02 === void 0 ? constant$2(0) : constant$2(+y02); + y12 = typeof y12 === "function" ? y12 : y12 === void 0 ? y$3 : constant$2(+y12); + function area2(data2) { + var i, j, k, n = (data2 = array$3(data2)).length, d2, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d2 = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) { + j = i; + output2.areaStart(); + output2.lineStart(); + } else { + output2.lineEnd(); + output2.lineStart(); + for (k = i - 1; k >= j; --k) { + output2.point(x0z[k], y0z[k]); + } + output2.lineEnd(); + output2.areaEnd(); + } + } + if (defined0) { + x0z[i] = +x02(d2, i, data2), y0z[i] = +y02(d2, i, data2); + output2.point(x12 ? +x12(d2, i, data2) : x0z[i], y12 ? +y12(d2, i, data2) : y0z[i]); + } + } + if (buffer) return output2 = null, buffer + "" || null; + } + function arealine() { + return line$2$1().defined(defined).curve(curve2).context(context2); + } + area2.x = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$2(+_), x12 = null, area2) : x02; + }; + area2.x0 = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$2(+_), area2) : x02; + }; + area2.x1 = function(_) { + return arguments.length ? (x12 = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), area2) : x12; + }; + area2.y = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$2(+_), y12 = null, area2) : y02; + }; + area2.y0 = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$2(+_), area2) : y02; + }; + area2.y1 = function(_) { + return arguments.length ? (y12 = _ == null ? null : typeof _ === "function" ? _ : constant$2(+_), area2) : y12; + }; + area2.lineX0 = area2.lineY0 = function() { + return arealine().x(x02).y(y02); + }; + area2.lineY1 = function() { + return arealine().x(x02).y(y12); + }; + area2.lineX1 = function() { + return arealine().x(x12).y(y02); + }; + area2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$2(!!_), area2) : defined; + }; + area2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), area2) : curve2; + }; + area2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), area2) : context2; + }; + return area2; + } + const circle = { + draw(context2, size) { + const r = sqrt$2(size / pi$3); + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, tau$3); + } + }; + function Symbol$1(type2, size) { + let context2 = null, path2 = withPath(symbol2); + type2 = typeof type2 === "function" ? type2 : constant$2(type2 || circle); + size = typeof size === "function" ? size : constant$2(size === void 0 ? 64 : +size); + function symbol2() { + let buffer; + if (!context2) context2 = buffer = path2(); + type2.apply(this, arguments).draw(context2, +size.apply(this, arguments)); + if (buffer) return context2 = null, buffer + "" || null; + } + symbol2.type = function(_) { + return arguments.length ? (type2 = typeof _ === "function" ? _ : constant$2(_), symbol2) : type2; + }; + symbol2.size = function(_) { + return arguments.length ? (size = typeof _ === "function" ? _ : constant$2(+_), symbol2) : size; + }; + symbol2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, symbol2) : context2; + }; + return symbol2; + } + function noop$3() { + } + function point$5(that, x2, y2) { + that._context.bezierCurveTo( + (2 * that._x0 + that._x1) / 3, + (2 * that._y0 + that._y1) / 3, + (that._x0 + 2 * that._x1) / 3, + (that._y0 + 2 * that._y1) / 3, + (that._x0 + 4 * that._x1 + x2) / 6, + (that._y0 + 4 * that._y1 + y2) / 6 + ); + } + function Basis(context2) { + this._context = context2; + } + Basis.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ addAll () { - let p = this; - const reuse = !p.source || p.add === p.rem // special case for indexed set (e.g., crossfilter) - || !p.rem.length && p.source.length === p.add.length; - if (reuse) return p; - else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - p.rem = []; // new operators can ignore rem #2769 - return p; - } + areaEnd: function() { + this._line = NaN; }, - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ init (src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - if (src.fields && !(flags & NO_FIELDS)) p.fields = src.fields; - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - return p; + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; }, - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ runAfter (func) { - this.dataflow.runAfter(func); + lineEnd: function() { + switch (this._point) { + case 3: + point$5(this, this._x1, this._y1); + // falls through + case 2: + this._context.lineTo(this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; }, - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ changed (flags) { - const f = flags || ALL; - return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + } + }; + function curveBasis(context2) { + return new Basis(context2); + } + function BasisClosed(context2) { + this._context = context2; + } + BasisClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; + this._point = 0; }, - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ reflow (fork) { - if (fork) return this.fork(ALL).reflow(); - const len = this.add.length, src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x2, this._y2); + this._context.closePath(); + break; + } + case 2: { + this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); + this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x2, this._y2); + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + break; } - return this; - }, - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ clean (value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else return this.cleans; + } }, - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array<string>} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ modifies (_) { - const hash = this.fields || (this.fields = {}); - if ((0, _vegaUtil.isArray)(_)) _.forEach((f)=>hash[f] = true); - else hash[_] = true; - return this; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x2 = x2, this._y2 = y2; + break; + case 1: + this._point = 2; + this._x3 = x2, this._y3 = y2; + break; + case 2: + this._point = 3; + this._x4 = x2, this._y4 = y2; + this._context.moveTo((this._x0 + 4 * this._x1 + x2) / 6, (this._y0 + 4 * this._y1 + y2) / 6); + break; + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + } + }; + function curveBasisClosed(context2) { + return new BasisClosed(context2); + } + function BasisOpen(context2) { + this._context = context2; + } + BasisOpen.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array<string>} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ modified (_, nomod) { - const fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; + areaEnd: function() { + this._line = NaN; }, - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ filter (flags, filter) { - const p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; }, - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ materialize (flags) { - flags = flags || ALL; - const p = this; - if (flags & ADD && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if (flags & REM && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if (flags & MOD && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if (flags & SOURCE && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; - } - return p; + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; }, - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ visit (flags, visitor) { - const p = this, v = visitor; - if (flags & SOURCE) { - (0, _vegaUtil.visitArray)(p.source, p.srcF, v); - return p; - } - if (flags & ADD) (0, _vegaUtil.visitArray)(p.add, p.addF, v); - if (flags & REM) (0, _vegaUtil.visitArray)(p.rem, p.remF, v); - if (flags & MOD) (0, _vegaUtil.visitArray)(p.mod, p.modF, v); - const src = p.source; - if (flags & REFLOW && src) { - const sum = p.add.length + p.mod.length; - if (sum === src.length) ; - else if (sum) (0, _vegaUtil.visitArray)(src, filter(p, ADD_MOD), v); - else // if no add/rem/mod tuples, visit source - (0, _vegaUtil.visitArray)(src, p.srcF, v); - } - return p; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + var x02 = (this._x0 + 4 * this._x1 + x2) / 6, y02 = (this._y0 + 4 * this._y1 + y2) / 6; + this._line ? this._context.lineTo(x02, y02) : this._context.moveTo(x02, y02); + break; + case 3: + this._point = 4; + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; } -}; -/** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse. - */ function MultiPulse(dataflow, stamp, pulses, encode) { - const p = this; - let c = 0; - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - for (const pulse of pulses){ - if (pulse.stamp !== stamp) continue; - if (pulse.fields) { - const hash = p.fields || (p.fields = {}); - for(const f in pulse.fields)hash[f] = 1; - } - if (pulse.changed(p.ADD)) c |= p.ADD; - if (pulse.changed(p.REM)) c |= p.REM; - if (pulse.changed(p.MOD)) c |= p.MOD; - } - this.changes = c; -} -(0, _vegaUtil.inherits)(MultiPulse, Pulse, { - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - */ fork (flags) { - const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); - if (flags !== undefined) { - if (flags & p.ADD) this.visit(p.ADD, (t)=>p.add.push(t)); - if (flags & p.REM) this.visit(p.REM, (t)=>p.rem.push(t)); - if (flags & p.MOD) this.visit(p.MOD, (t)=>p.mod.push(t)); + }; + function curveBasisOpen(context2) { + return new BasisOpen(context2); + } + function Bundle(context2, beta) { + this._basis = new Basis(context2); + this._beta = beta; + } + Bundle.prototype = { + lineStart: function() { + this._x = []; + this._y = []; + this._basis.lineStart(); + }, + lineEnd: function() { + var x2 = this._x, y2 = this._y, j = x2.length - 1; + if (j > 0) { + var x02 = x2[0], y02 = y2[0], dx = x2[j] - x02, dy = y2[j] - y02, i = -1, t; + while (++i <= j) { + t = i / j; + this._basis.point( + this._beta * x2[i] + (1 - this._beta) * (x02 + t * dx), + this._beta * y2[i] + (1 - this._beta) * (y02 + t * dy) + ); } - return p; + } + this._x = this._y = null; + this._basis.lineEnd(); }, - changed (flags) { - return this.changes & flags; + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); + } + }; + const curveBundle = (function custom2(beta) { + function bundle2(context2) { + return beta === 1 ? new Basis(context2) : new Bundle(context2, beta); + } + bundle2.beta = function(beta2) { + return custom2(+beta2); + }; + return bundle2; + })(0.85); + function point$4(that, x2, y2) { + that._context.bezierCurveTo( + that._x1 + that._k * (that._x2 - that._x0), + that._y1 + that._k * (that._y2 - that._y0), + that._x2 + that._k * (that._x1 - x2), + that._y2 + that._k * (that._y1 - y2), + that._x2, + that._y2 + ); + } + function Cardinal(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + Cardinal.prototype = { + areaStart: function() { + this._line = 0; }, - modified (_) { - const p = this, fields = p.fields; - return !(fields && p.changes & p.MOD) ? 0 : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; + areaEnd: function() { + this._line = NaN; }, - filter () { - (0, _vegaUtil.error)('MultiPulse does not support filtering.'); + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; }, - materialize () { - (0, _vegaUtil.error)('MultiPulse does not support materialization.'); + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + point$4(this, this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; }, - visit (flags, visitor) { - const p = this, pulses = p.pulses, n = pulses.length; - let i = 0; - if (flags & p.SOURCE) for(; i < n; ++i)pulses[i].visit(flags, visitor); - else { - for(; i < n; ++i)if (pulses[i].stamp === p.stamp) pulses[i].visit(flags, visitor); - } - return p; - } -}); -/* eslint-disable require-atomic-updates */ /** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function evaluate(encode, prerun, postrun) { - const df = this, async = []; - // if the pulse value is set, this is a re-entrant call - if (df._pulse) return reentrant(df); - // wait for pending datasets to load - if (df._pending) await df._pending; - // invoke prerun function, if provided - if (prerun) await asyncCallback(df, prerun); - // exit early if there are no updates - if (!df._touched.length) { - df.debug('Dataflow invoked, but nothing to do.'); - return df; - } - // increment timestamp clock - const stamp = ++df._clock; - // set the current pulse - df._pulse = new Pulse(df, stamp, encode); - // initialize priority queue, reset touched operators - df._touched.forEach((op)=>df._enqueue(op, true)); - df._touched = UniqueList((0, _vegaUtil.id)); - let count = 0, op, next, error; - try { - while(df._heap.size() > 0){ - // dequeue operator with highest priority - op = df._heap.pop(); - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - if (next.then) // await if operator returns a promise directly - next = await next; - else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach((op)=>df._enqueue(op)); - } - // increment visit counter - ++count; - } - } catch (err) { - df._heap.clear(); - error = err; - } - // reset pulse map - df._input = {}; - df._pulse = null; - df.debug(`Pulse ${stamp}: ${count} operators`); - if (error) { - df._postrun = []; - df.error(error); - } - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b)=>b.priority - a.priority); - df._postrun = []; - for(let i = 0; i < pr.length; ++i)await asyncCallback(df, pr[i].callback); + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + this._x1 = x2, this._y1 = y2; + break; + case 2: + this._point = 3; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - // invoke postrun function, if provided - if (postrun) await asyncCallback(df, postrun); - // handle non-blocking asynchronous callbacks - if (async.length) Promise.all(async).then((cb)=>df.runAsync(null, ()=>{ - cb.forEach((f)=>{ - try { - f(df); - } catch (err) { - df.error(err); - } - }); - })); - return df; -} -/** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while(this._running)await this._running; - // run dataflow, manage running promise - const clear = ()=>this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear); - return this._running; -} -/** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this); -} -/** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - else // pulse propagation already complete, invoke immediately - try { - callback(this); - } catch (err) { - this.error(err); + }; + const curveCardinal = (function custom2(tension) { + function cardinal(context2) { + return new Cardinal(context2, tension); } -} -/** - * Raise an error for re-entrant dataflow evaluation. - */ function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; -} -/** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ function enqueue(op, force) { - const q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } -} -/** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ function getPulse(op, encode) { - const s = op.source, stamp = this._clock; - return s && (0, _vegaUtil.isArray)(s) ? new MultiPulse(this, stamp, s.map((_)=>_.pulse), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); -} -function singlePulse(p, s) { - if (s && s.stamp === p.stamp) return s; - p = p.fork(); - if (s && s !== StopPropagation) p.source = s.source; - return p; -} -const NO_OPT = { - skip: false, - force: false -}; -/** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function touch(op, options) { - const opt = options || NO_OPT; - if (this._pulse) // if in midst of propagation, add to priority queue - this._enqueue(op); - else // otherwise, queue for next propagation - this._touched.add(op); - if (opt.skip) op.skip(true); - return this; -} -/** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function update(op, value, options) { - const opt = options || NO_OPT; - if (op.set(value) || opt.force) this.touch(op, opt); - return this; -} -/** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - return this; -} -function Heap(cmp) { - let nodes = []; - return { - clear: ()=>nodes = [], - size: ()=>nodes.length, - peek: ()=>nodes[0], - push: (x)=>{ - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: ()=>{ - const last = nodes.pop(); - let item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else item = last; - return item; - } - }; -} -function siftdown(array, start, idx, cmp) { - let parent, pidx; - const item = array[idx]; - while(idx > start){ - pidx = idx - 1 >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function CardinalClosed(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + CardinalClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; } - break; + } + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - return array[idx] = item; -} -function siftup(array, idx, cmp) { - const start = idx, end = array.length, item = array[idx]; - let cidx = (idx << 1) + 1, ridx; - while(cidx < end){ - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) cidx = ridx; - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); -} -/** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ function Dataflow() { - this.logger((0, _vegaUtil.logger)()); - this.logLevel((0, _vegaUtil.Error)); - this._clock = 0; - this._rank = 0; - this._locale = (0, _vegaFormat.defaultLocale)(); - try { - this._loader = (0, _vegaLoader.loader)(); - } catch (e) { - // do nothing if loader module is unavailable + }; + const curveCardinalClosed = (function custom2(tension) { + function cardinal(context2) { + return new CardinalClosed(context2, tension); } - this._touched = UniqueList((0, _vegaUtil.id)); - this._input = {}; - this._pulse = null; - this._heap = Heap((a, b)=>a.qrank - b.qrank); - this._postrun = []; -} -function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); + cardinal.tension = function(tension2) { + return custom2(+tension2); }; -} -Dataflow.prototype = { - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ stamp () { - return this._clock; - }, - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ loader (_) { - if (arguments.length) { - this._loader = _; - return this; - } else return this._loader; - }, - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ locale (_) { - if (arguments.length) { - this._locale = _; - return this; - } else return this._locale; + return cardinal; + })(0); + function CardinalOpen(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + CardinalOpen.prototype = { + areaStart: function() { + this._line = 0; }, - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ logger (logger) { - if (arguments.length) { - this._log = logger; - return this; - } else return this._log; + areaEnd: function() { + this._line = NaN; }, - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ error: logMethod('error'), - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ warn: logMethod('warn'), - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ info: logMethod('info'), - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ debug: logMethod('debug'), - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ logLevel: logMethod('level'), - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ cleanThreshold: 1e4, - // OPERATOR REGISTRATION - add, - connect, - rank, - rerank, - // OPERATOR UPDATES - pulse, - touch, - update, - changeset, - // DATA LOADING - ingest, - parse, - preload, - request, - // EVENT HANDLING - events, - on, - // PULSE PROPAGATION - evaluate, - run, - runAsync, - runAfter, - _enqueue: enqueue, - _getPulse: getPulse -}; -/** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ function Transform(init, params) { - Operator.call(this, init, null, params); -} -(0, _vegaUtil.inherits)(Transform, Operator, { - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) this.skip(false); - else rv = this.evaluate(pulse); - rv = rv || pulse; - if (rv.then) rv = rv.then((_)=>this.pulse = _); - else if (rv !== pulse.StopPropagation) this.pulse = rv; - return rv; + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; }, - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const params = this.marshall(pulse.stamp), out = this.transform(params, pulse); - params.clear(); - return out; + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; }, - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ transform () {} -}); -const transforms = {}; -function definition(type) { - const t = transform(type); - return t && t.Definition || null; -} -function transform(type) { - type = type && type.toLowerCase(); - return (0, _vegaUtil.hasOwnProperty)(transforms, type) ? transforms[type] : null; -} - -},{"vega-util":"f2ulH","vega-loader":"8kWcg","vega-format":"3VXXV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8kWcg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formats", ()=>formats); -parcelHelpers.export(exports, "inferType", ()=>inferType); -parcelHelpers.export(exports, "inferTypes", ()=>inferTypes); -parcelHelpers.export(exports, "loader", ()=>loader); -parcelHelpers.export(exports, "read", ()=>read); -parcelHelpers.export(exports, "responseType", ()=>responseType); -parcelHelpers.export(exports, "typeParsers", ()=>typeParsers); -var _vegaUtil = require("vega-util"); -var _d3Dsv = require("d3-dsv"); -var _topojsonClient = require("topojson-client"); -var _vegaFormat = require("vega-format"); -var Buffer = require("d2bd1b4e1a5e867b").Buffer; -// Matches absolute URLs with optional protocol -// https://... file://... //... -const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; -// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// -const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape -const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex -// Special treatment in node.js for the file: protocol -const fileProtocol = 'file://'; -/** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ function loaderFactory(fetch1, fs) { - return (options)=>({ - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: false, - file: fileLoader(fs), - http: httpLoader(fetch1) - }); -} -/** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ async function load(uri, options) { - const opt = await this.sanitize(uri, options), url = opt.href; - return opt.localFile ? this.file(url) : this.http(url, options); -} -/** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ async function sanitize(uri, options) { - options = (0, _vegaUtil.extend)({}, this.options, options); - const fileAccess = this.fileAccess, result = { - href: null - }; - let isFile, loadFile, base; - const isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - if (uri == null || typeof uri !== 'string' || !isAllowed) (0, _vegaUtil.error)('Sanitize failure, invalid URI: ' + (0, _vegaUtil.stringValue)(uri)); - const hasProtocol = protocol_re.test(uri); - // if relative url (no protocol/host), prepend baseURL - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && !base.endsWith('/')) uri = '/' + uri; - uri = base + uri; - } - // should we load from file system? - loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess; - if (isFile) // strip file protocol - uri = uri.slice(fileProtocol.length); - else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - // set non-enumerable mode flag to indicate local file load - Object.defineProperty(result, 'localFile', { - value: !!loadFile - }); - // set uri - result.href = uri; - // set default result target, if specified - if (options.target) result.target = options.target + ''; - // set default result rel, if specified (#1542) - if (options.rel) result.rel = options.rel + ''; - // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - if (options.context === 'image' && options.crossOrigin) result.crossOrigin = options.crossOrigin + ''; - // return - return result; -} -/** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ function fileLoader(fs) { - return fs ? (filename)=>new Promise((accept, reject)=>{ - fs.readFile(filename, (error, data)=>{ - if (error) reject(error); - else accept(data); - }); - }) : fileReject; -} -/** - * Default file system loader that simply rejects. - */ async function fileReject() { - (0, _vegaUtil.error)('No file system access.'); -} -/** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ function httpLoader(fetch1) { - return fetch1 ? async function(url, options) { - const opt = (0, _vegaUtil.extend)({}, this.options.http, options), type = options && options.response, response = await fetch1(url, opt); - return !response.ok ? (0, _vegaUtil.error)(response.status + '' + response.statusText) : (0, _vegaUtil.isFunction)(response[type]) ? response[type]() : response.text(); - } : httpReject; -} -/** - * Default http request handler that simply rejects. - */ async function httpReject() { - (0, _vegaUtil.error)('No HTTP fetch method available.'); -} -const isValid = (_)=>_ != null && _ === _; -const isBoolean = (_)=>_ === 'true' || _ === 'false' || _ === true || _ === false; -const isDate = (_)=>!Number.isNaN(Date.parse(_)); -const isNumber = (_)=>!Number.isNaN(+_) && !(_ instanceof Date); -const isInteger = (_)=>isNumber(_) && Number.isInteger(+_); -const typeParsers = { - boolean: (0, _vegaUtil.toBoolean), - integer: (0, _vegaUtil.toNumber), - number: (0, _vegaUtil.toNumber), - date: (0, _vegaUtil.toDate), - string: (0, _vegaUtil.toString), - unknown: (0, _vegaUtil.identity) -}; -const typeTests = [ - isBoolean, - isInteger, - isNumber, - isDate -]; -const typeList = [ - 'boolean', - 'integer', - 'number', - 'date' -]; -function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - const n = values.length, m = typeTests.length, a = typeTests.map((_, i)=>i + 1); - for(let i = 0, t = 0, j, value; i < n; ++i){ - value = field ? values[i][field] : values[i]; - for(j = 0; j < m; ++j)if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - return typeList[a.reduce((u, v)=>u === 0 ? v : u, 0) - 1]; -} -function inferTypes(data, fields) { - return fields.reduce((types, field)=>{ - types[field] = inferType(data, field); - return types; - }, {}); -} -function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = { - delimiter: delimiter - }; - return dsv(data, format ? (0, _vegaUtil.extend)(format, delim) : delim); - }; - parse.responseType = 'text'; - return parse; -} -function dsv(data, format) { - if (format.header) data = format.header.map((0, _vegaUtil.stringValue)).join(format.delimiter) + '\n' + data; - return (0, _d3Dsv.dsvFormat)(format.delimiter).parse(data + ''); -} -dsv.responseType = 'text'; -function isBuffer(_) { - return typeof Buffer === 'function' && (0, _vegaUtil.isFunction)(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; -} -function json(data, format) { - const prop = format && format.property ? (0, _vegaUtil.field)(format.property) : (0, _vegaUtil.identity); - return (0, _vegaUtil.isObject)(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data)); -} -json.responseType = 'json'; -function parseJSON(data, format) { - if (!(0, _vegaUtil.isArray)(data) && (0, _vegaUtil.isIterable)(data)) data = [ - ...data - ]; - return format && format.copy ? JSON.parse(JSON.stringify(data)) : data; -} -const filters = { - interior: (a, b)=>a !== b, - exterior: (a, b)=>a === b -}; -function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - if (format && format.feature) { - method = (0, _topojsonClient.feature); - property = format.feature; - } else if (format && format.mesh) { - method = (0, _topojsonClient.mesh); - property = format.mesh; - filter = filters[format.filter]; - } else (0, _vegaUtil.error)('Missing TopoJSON feature or mesh parameter.'); - object = (object = data.objects[property]) ? method(data, object, filter) : (0, _vegaUtil.error)('Invalid TopoJSON object: ' + property); - return object && object.features || [ - object - ]; -} -topojson.responseType = 'json'; -const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson -}; -function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else return (0, _vegaUtil.hasOwnProperty)(format, name) ? format[name] : null; -} -function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; -} -function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - const reader = formats(schema.type || 'json'); - if (!reader) (0, _vegaUtil.error)('Unknown data format type: ' + schema.type); - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - if ((0, _vegaUtil.hasOwnProperty)(data, 'columns')) delete data.columns; - return data; -} -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - const locale = (0, _vegaFormat.timeFormatDefaultLocale)(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - let fields = data.columns || Object.keys(data[0]), datum, field, i, j, n, m; - if (types === 'auto') types = inferTypes(data, fields); - fields = Object.keys(types); - const parsers = fields.map((field)=>{ - const type = types[field]; - let parts, pattern; - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') pattern = pattern.slice(1, -1); - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - if (!typeParsers[type]) throw Error('Illegal format pattern: ' + field + ':' + type); - return typeParsers[type]; - }); - for(i = 0, n = data.length, m = fields.length; i < n; ++i){ - datum = data[i]; - for(j = 0; j < m; ++j){ - field = fields[j]; - datum[field] = parsers[j](datum[field]); - } - } -} -const loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API -null // no file system access -); - -},{"d2bd1b4e1a5e867b":"6tQNr","vega-util":"f2ulH","d3-dsv":"dYJ1x","topojson-client":"esWvi","vega-format":"3VXXV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6tQNr":[function(require,module,exports,__globalThis) { -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh <https://feross.org> - * @license MIT - */ /* eslint-disable no-proto */ 'use strict'; -const base64 = require("9c62938f1dccc73c"); -const ieee754 = require("aceacb6a4531a9d2"); -const customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null; -exports.Buffer = Buffer; -exports.SlowBuffer = SlowBuffer; -exports.INSPECT_MAX_BYTES = 50; -const K_MAX_LENGTH = 0x7fffffff; -exports.kMaxLength = K_MAX_LENGTH; -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); -function typedArraySupport() { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1); - const proto = { - foo: function() { - return 42; - } - }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -} -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.buffer; - } -}); -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.byteOffset; - } -}); -function createBuffer(length) { - if (length > K_MAX_LENGTH) throw new RangeError('The value "' + length + '" is invalid for option "size"'); - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ function Buffer(arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') throw new TypeError('The "string" argument must be of type string. Received type number'); - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); -} -Buffer.poolSize = 8192 // not used by this implementation -; -function from(value, encodingOrOffset, length) { - if (typeof value === 'string') return fromString(value, encodingOrOffset); - if (ArrayBuffer.isView(value)) return fromArrayView(value); - if (value == null) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof value === 'number') throw new TypeError('The "value" argument must not be of type number. Received type number'); - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); -} -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ Buffer.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); -}; -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); -Object.setPrototypeOf(Buffer, Uint8Array); -function assertSize(size) { - if (typeof size !== 'number') throw new TypeError('"size" argument must be of type number'); - else if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); -} -function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) return createBuffer(size); - if (fill !== undefined) // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - return createBuffer(size); -} -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ Buffer.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); -}; -function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); -} -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ Buffer.allocUnsafe = function(size) { - return allocUnsafe(size); -}; -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ Buffer.allocUnsafeSlow = function(size) { - return allocUnsafe(size); -}; -function fromString(string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'; - if (!Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual); - return buf; -} -function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for(let i = 0; i < length; i += 1)buf[i] = array[i] & 255; - return buf; -} -function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); -} -function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); - let buf; - if (byteOffset === undefined && length === undefined) buf = new Uint8Array(array); - else if (length === undefined) buf = new Uint8Array(array, byteOffset); - else buf = new Uint8Array(array, byteOffset, length); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -function fromObject(obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) return buf; - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) return createBuffer(0); - return fromArrayLike(obj); - } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) return fromArrayLike(obj.data); -} -function checked(length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + ' bytes'); - return length | 0; -} -function SlowBuffer(length) { - if (+length != length) length = 0; - return Buffer.alloc(+length); -} -Buffer.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false - ; -}; -Buffer.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - if (a === b) return 0; - let x = a.length; - let y = b.length; - for(let i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; + }; + const curveCardinalOpen = (function custom2(tension) { + function cardinal(context2) { + return new CardinalOpen(context2, tension); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -Buffer.isEncoding = function isEncoding(encoding) { - switch(String(encoding).toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true; + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function point$3(that, x2, y2) { + var x12 = that._x1, y12 = that._y1, x22 = that._x2, y22 = that._y2; + if (that._l01_a > epsilon$5) { + var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); + x12 = (x12 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; + y12 = (y12 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; + } + if (that._l23_a > epsilon$5) { + var b2 = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m2 = 3 * that._l23_a * (that._l23_a + that._l12_a); + x22 = (x22 * b2 + that._x1 * that._l23_2a - x2 * that._l12_2a) / m2; + y22 = (y22 * b2 + that._y1 * that._l23_2a - y2 * that._l12_2a) / m2; + } + that._context.bezierCurveTo(x12, y12, x22, y22, that._x2, that._y2); + } + function CatmullRom(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRom.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + this.point(this._x2, this._y2); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + // falls through default: - return false; + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; -Buffer.concat = function concat(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); - if (list.length === 0) return Buffer.alloc(0); - let i; - if (length === undefined) { - length = 0; - for(i = 0; i < list.length; ++i)length += list[i].length; - } - const buffer = Buffer.allocUnsafe(length); - let pos = 0; - for(i = 0; i < list.length; ++i){ - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf); - buf.copy(buffer, pos); - } else Uint8Array.prototype.set.call(buffer, buf, pos); - } else if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); - else buf.copy(buffer, pos); - pos += buf.length; - } - return buffer; -}; -function byteLength(string, encoding) { - if (Buffer.isBuffer(string)) return string.length; - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if (typeof string !== 'string') throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - // Use a for loop to avoid recursion - let loweredCase = false; - for(;;)switch(encoding){ - case 'ascii': - case 'latin1': - case 'binary': - return len; - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2; - case 'hex': - return len >>> 1; - case 'base64': - return base64ToBytes(string).length; - default: - if (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - ; - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } -} -Buffer.byteLength = byteLength; -function slowToString(encoding, start, end) { - let loweredCase = false; - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) start = 0; - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) return ''; - if (end === undefined || end > this.length) end = this.length; - if (end <= 0) return ''; - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0; - start >>>= 0; - if (end <= start) return ''; - if (!encoding) encoding = 'utf8'; - while(true)switch(encoding){ - case 'hex': - return hexSlice(this, start, end); - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end); - case 'ascii': - return asciiSlice(this, start, end); - case 'latin1': - case 'binary': - return latin1Slice(this, start, end); - case 'base64': - return base64Slice(this, start, end); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end); + }; + const curveCatmullRom = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRom(context2, alpha) : new Cardinal(context2, 0); + } + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function CatmullRomClosed(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRomClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = (encoding + '').toLowerCase(); - loweredCase = true; - } -} -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true; -function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; -} -Buffer.prototype.swap16 = function swap16() { - const len = this.length; - if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits'); - for(let i = 0; i < len; i += 2)swap(this, i, i + 1); - return this; -}; -Buffer.prototype.swap32 = function swap32() { - const len = this.length; - if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits'); - for(let i = 0; i < len; i += 4){ - swap(this, i, i + 3); - swap(this, i + 1, i + 2); + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - return this; -}; -Buffer.prototype.swap64 = function swap64() { - const len = this.length; - if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits'); - for(let i = 0; i < len; i += 8){ - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); + }; + const curveCatmullRomClosed = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomClosed(context2, alpha) : new CardinalClosed(context2, 0); } - return this; -}; -Buffer.prototype.toString = function toString() { - const length = this.length; - if (length === 0) return ''; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); -}; -Buffer.prototype.toLocaleString = Buffer.prototype.toString; -Buffer.prototype.equals = function equals(b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); - if (this === b) return true; - return Buffer.compare(this, b) === 0; -}; -Buffer.prototype.inspect = function inspect() { - let str = ''; - const max = exports.INSPECT_MAX_BYTES; - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); - if (this.length > max) str += ' ... '; - return '<Buffer ' + str + '>'; -}; -if (customInspectSymbol) Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; -Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) target = Buffer.from(target, target.offset, target.byteLength); - if (!Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (start === undefined) start = 0; - if (end === undefined) end = target ? target.length : 0; - if (thisStart === undefined) thisStart = 0; - if (thisEnd === undefined) thisEnd = this.length; - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError('out of range index'); - if (thisStart >= thisEnd && start >= end) return 0; - if (thisStart >= thisEnd) return -1; - if (start >= end) return 1; - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for(let i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function CatmullRomOpen(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRomOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1; - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff; - else if (byteOffset < -2147483648) byteOffset = -2147483648; - byteOffset = +byteOffset // Coerce to Number. - ; - if (numberIsNaN(byteOffset)) // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : buffer.length - 1; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - else byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - // Normalize val - if (typeof val === 'string') val = Buffer.from(val, encoding); - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) return -1; - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - ; - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - return arrayIndexOf(buffer, [ - val - ], byteOffset, encoding, dir); - } - throw new TypeError('val must be string, number or Buffer'); -} -function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase(); - if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) return -1; - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i) { - if (indexSize === 1) return buf[i]; - else return buf.readUInt16BE(i * indexSize); - } - let i; - if (dir) { - let foundIndex = -1; - for(i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for(i = byteOffset; i >= 0; i--){ - let found = true; - for(let j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - if (found) return i; - } + }; + const curveCatmullRomOpen = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomOpen(context2, alpha) : new CardinalOpen(context2, 0); } - return -1; -} -Buffer.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; -}; -Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); -}; -Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); -}; -function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) length = remaining; - else { - length = Number(length); - if (length > remaining) length = remaining; + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function LinearClosed(context2) { + this._context = context2; + } + LinearClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._point) this._context.closePath(); + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) this._context.lineTo(x2, y2); + else this._point = 1, this._context.moveTo(x2, y2); + } + }; + function curveLinearClosed(context2) { + return new LinearClosed(context2); + } + function sign$1(x2) { + return x2 < 0 ? -1 : 1; + } + function slope3(that, x2, y2) { + var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); + return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; + } + function slope2(that, t) { + var h2 = that._x1 - that._x0; + return h2 ? (3 * (that._y1 - that._y0) / h2 - t) / 2 : t; + } + function point$2(that, t02, t12) { + var x02 = that._x0, y02 = that._y0, x12 = that._x1, y12 = that._y1, dx = (x12 - x02) / 3; + that._context.bezierCurveTo(x02 + dx, y02 + dx * t02, x12 - dx, y12 - dx * t12, x12, y12); + } + function MonotoneX(context2) { + this._context = context2; + } + MonotoneX.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x1, this._y1); + break; + case 3: + point$2(this, this._t0, slope2(this, this._t0)); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + var t12 = NaN; + x2 = +x2, y2 = +y2; + if (x2 === this._x1 && y2 === this._y1) return; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + point$2(this, slope2(this, t12 = slope3(this, x2, y2)), t12); + break; + default: + point$2(this, this._t0, t12 = slope3(this, x2, y2)); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + this._t0 = t12; } - const strLen = string.length; - if (length > strLen / 2) length = strLen / 2; - let i; - for(i = 0; i < length; ++i){ - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; + }; + function MonotoneY(context2) { + this._context = new ReflectContext(context2); + } + (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) { + MonotoneX.prototype.point.call(this, y2, x2); + }; + function ReflectContext(context2) { + this._context = context2; + } + ReflectContext.prototype = { + moveTo: function(x2, y2) { + this._context.moveTo(y2, x2); + }, + closePath: function() { + this._context.closePath(); + }, + lineTo: function(x2, y2) { + this._context.lineTo(y2, x2); + }, + bezierCurveTo: function(x12, y12, x2, y2, x3, y3) { + this._context.bezierCurveTo(y12, x12, y2, x2, y3, x3); } - return i; -} -function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); -} -function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); -} -function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); -} -function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); -} -Buffer.prototype.write = function write(string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8'; - length = this.length; - offset = 0; - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset; - length = this.length; - offset = 0; - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === undefined) encoding = 'utf8'; + }; + function monotoneX(context2) { + return new MonotoneX(context2); + } + function monotoneY(context2) { + return new MonotoneY(context2); + } + function Natural(context2) { + this._context = context2; + } + Natural.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = []; + this._y = []; + }, + lineEnd: function() { + var x2 = this._x, y2 = this._y, n = x2.length; + if (n) { + this._line ? this._context.lineTo(x2[0], y2[0]) : this._context.moveTo(x2[0], y2[0]); + if (n === 2) { + this._context.lineTo(x2[1], y2[1]); } else { - encoding = length; - length = undefined; - } - } else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); - const remaining = this.length - offset; - if (length === undefined || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError('Attempt to write outside buffer bounds'); - if (!encoding) encoding = 'utf8'; - let loweredCase = false; - for(;;)switch(encoding){ - case 'hex': - return hexWrite(this, string, offset, length); - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length); - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; + var px2 = controlPoints(x2), py2 = controlPoints(y2); + for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { + this._context.bezierCurveTo(px2[0][i0], py2[0][i0], px2[1][i0], py2[1][i0], x2[i1], y2[i1]); + } + } + } + if (this._line || this._line !== 0 && n === 1) this._context.closePath(); + this._line = 1 - this._line; + this._x = this._y = null; + }, + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); } -}; -Buffer.prototype.toJSON = function toJSON() { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - }; -}; -function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) return base64.fromByteArray(buf); - else return base64.fromByteArray(buf.slice(start, end)); -} -function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while(i < end){ - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch(bytesPerSequence){ - case 1: - if (firstByte < 0x80) codePoint = firstByte; - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; - if (tempCodePoint > 0x7F) codePoint = tempCodePoint; - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) codePoint = tempCodePoint; - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) codePoint = tempCodePoint; - } - } + }; + function controlPoints(x2) { + var i, n = x2.length - 1, m2, a2 = new Array(n), b2 = new Array(n), r = new Array(n); + a2[0] = 0, b2[0] = 2, r[0] = x2[0] + 2 * x2[1]; + for (i = 1; i < n - 1; ++i) a2[i] = 1, b2[i] = 4, r[i] = 4 * x2[i] + 2 * x2[i + 1]; + a2[n - 1] = 2, b2[n - 1] = 7, r[n - 1] = 8 * x2[n - 1] + x2[n]; + for (i = 1; i < n; ++i) m2 = a2[i] / b2[i - 1], b2[i] -= m2, r[i] -= m2 * r[i - 1]; + a2[n - 1] = r[n - 1] / b2[n - 1]; + for (i = n - 2; i >= 0; --i) a2[i] = (r[i] - a2[i + 1]) / b2[i]; + b2[n - 1] = (x2[n] + a2[n - 1]) / 2; + for (i = 0; i < n - 1; ++i) b2[i] = 2 * x2[i + 1] - a2[i + 1]; + return [a2, b2]; + } + function curveNatural(context2) { + return new Natural(context2); + } + function Step(context2, t) { + this._context = context2; + this._t = t; + } + Step.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = this._y = NaN; + this._point = 0; + }, + lineEnd: function() { + if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: { + if (this._t <= 0) { + this._context.lineTo(this._x, y2); + this._context.lineTo(x2, y2); + } else { + var x12 = this._x * (1 - this._t) + x2 * this._t; + this._context.lineTo(x12, this._y); + this._context.lineTo(x12, y2); + } + break; } - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD; - bytesPerSequence = 1; - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000; - res.push(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | codePoint & 0x3FF; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); -} -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000; -function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - ; - // Decode in chunks to avoid "call stack size exceeded". - let res = ''; - let i = 0; - while(i < len)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - return res; -} -function asciiSlice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i] & 0x7F); - return ret; -} -function latin1Slice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); - return ret; -} -function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ''; - for(let i = start; i < end; ++i)out += hexSliceLookupTable[buf[i]]; - return out; -} -function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ''; - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for(let i = 0; i < bytes.length - 1; i += 2)res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - return res; -} -Buffer.prototype.slice = function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === undefined ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) start = len; - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) end = len; - if (end < start) end = start; - const newBuf = this.subarray(start, end); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype); - return newBuf; -}; -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); -} -Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - return val; -}; -Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset + --byteLength]; - let mul = 1; - while(byteLength > 0 && (mul *= 0x100))val += this[offset + --byteLength] * mul; - return val; -}; -Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; -}; -Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; -}; -Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; -}; -Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; -}; -Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); -}; -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const lo = first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 256 + this[++offset] * 2 ** 16 + last * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); -}); -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); -}); -Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let i = byteLength; - let mul = 1; - let val = this[offset + --i]; - while(i > 0 && (mul *= 0x100))val += this[offset + --i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 0x80)) return this[offset]; - return (0xff - this[offset] + 1) * -1; -}; -Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; -}; -Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; -}; -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = this[offset + 4] + this[offset + 5] * 256 + this[offset + 6] * 2 ** 16 + (last << 24 // Overflow - ); - return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); -}); -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last); -}); -Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); -}; -Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); -}; -Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); -}; -Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); -}; -function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError('Index out of range'); -} -Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let i = byteLength - 1; - let mul = 1; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; -} -function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; -} -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + this._x = x2, this._y = y2; } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - let i = byteLength - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128); - if (value < 0) value = 0xff + value + 1; - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; -}; -Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - if (value < 0) value = 0xffffffff + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); -} -function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; -} -Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); -}; -function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; -} -Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); -}; -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - // Copy 0 bytes; we're done - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - // Fatal error conditions - if (targetStart < 0) throw new RangeError('targetStart out of bounds'); - if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); - if (end < 0) throw new RangeError('sourceEnd out of bounds'); - // Are we oob? - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) end = target.length - targetStart + start; - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end); - else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); - return len; -}; -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill(val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === 'string') { - encoding = end; - end = this.length; - } - if (encoding !== undefined && typeof encoding !== 'string') throw new TypeError('encoding must be a string'); - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === 'utf8' && code < 128 || encoding === 'latin1') // Fast path: If `val` fits into a single byte, use that numeric value. - val = code; - } - } else if (typeof val === 'number') val = val & 255; - else if (typeof val === 'boolean') val = Number(val); - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) throw new RangeError('Out of range index'); - if (end <= start) return this; - start = start >>> 0; - end = end === undefined ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === 'number') for(i = start; i < end; ++i)this[i] = val; - else { - const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding); - const len = bytes.length; - if (len === 0) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; + }; + function curveStep(context2) { + return new Step(context2, 0.5); + } + function stepBefore(context2) { + return new Step(context2, 0); + } + function stepAfter(context2) { + return new Step(context2, 1); + } + function domCanvas(w2, h2) { + if (typeof document !== "undefined" && document.createElement) { + const c2 = document.createElement("canvas"); + if (c2 && c2.getContext) { + c2.width = w2; + c2.height = h2; + return c2; + } } - return this; -}; -// CUSTOM ERRORS -// ============= -// Simplified versions from Node, changed for Buffer-only usage -const errors = {}; -function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor(){ - super(); - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]`; - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - ; - // Reset the name to the actual name. - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }); + return null; + } + const domImage = () => typeof Image !== "undefined" ? Image : null; + function colors$1(specifier) { + var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0; + while (i < n) colors2[i] = "#" + specifier.slice(i * 6, ++i * 6); + return colors2; + } + const schemeCategory10 = colors$1("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); + const schemeAccent = colors$1("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); + const schemeDark2 = colors$1("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); + const schemeObservable10 = colors$1("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); + const schemePaired = colors$1("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); + const schemePastel1 = colors$1("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); + const schemePastel2 = colors$1("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); + const schemeSet1 = colors$1("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); + const schemeSet2 = colors$1("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); + const schemeSet3 = colors$1("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); + function bandSpace(count2, paddingInner, paddingOuter) { + const space = count2 - paddingInner + paddingOuter * 2; + return count2 ? space > 0 ? space : 1 : 0; + } + const Identity = "identity"; + const Linear = "linear"; + const Log = "log"; + const Pow = "pow"; + const Sqrt = "sqrt"; + const Symlog = "symlog"; + const Time = "time"; + const UTC = "utc"; + const Sequential = "sequential"; + const Diverging = "diverging"; + const Quantile = "quantile"; + const Quantize = "quantize"; + const Threshold = "threshold"; + const Ordinal = "ordinal"; + const Point = "point"; + const Band = "band"; + const BinOrdinal = "bin-ordinal"; + const Continuous = "continuous"; + const Discrete$1 = "discrete"; + const Discretizing = "discretizing"; + const Interpolating = "interpolating"; + const Temporal = "temporal"; + function invertRange(scale2) { + return function(_) { + let lo = _[0], hi = _[1], t; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + return [scale2.invert(lo), scale2.invert(hi)]; + }; + } + function invertRangeExtent(scale2) { + return function(_) { + const range2 = scale2.range(); + let lo = _[0], hi = _[1], min2 = -1, max2, t, i, n; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + for (i = 0, n = range2.length; i < n; ++i) { + if (range2[i] >= lo && range2[i] <= hi) { + if (min2 < 0) min2 = i; + max2 = i; } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; -} -E('ERR_BUFFER_OUT_OF_BOUNDS', function(name) { - if (name) return `${name} is outside of buffer bounds`; - return 'Attempt to access memory outside buffer bounds'; -}, RangeError); -E('ERR_INVALID_ARG_TYPE', function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; -}, TypeError); -E('ERR_OUT_OF_RANGE', function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) received = addNumericalSeparator(String(input)); - else if (typeof input === 'bigint') { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) received = addNumericalSeparator(received); - received += 'n'; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; -}, RangeError); -function addNumericalSeparator(val) { - let res = ''; - let i = val.length; - const start = val[0] === '-' ? 1 : 0; - for(; i >= start + 4; i -= 3)res = `_${val.slice(i - 3, i)}${res}`; - return `${val.slice(0, i)}${res}`; -} -// CHECK FUNCTIONS -// =============== -function checkBounds(buf, offset, byteLength) { - validateNumber(offset, 'offset'); - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) boundsError(offset, buf.length - (byteLength + 1)); -} -function checkIntBI(value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : ''; - let range; - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; - else range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}`; - } else range = `>= ${min}${n} and <= ${max}${n}`; - throw new errors.ERR_OUT_OF_RANGE('value', range, value); - } - checkBounds(buf, offset, byteLength); -} -function validateNumber(value, name) { - if (typeof value !== 'number') throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value); -} -function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value); - } - if (length < 0) throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', `>= ${type ? 1 : 0} and <= ${length}`, value); -} -// HELPER FUNCTIONS -// ================ -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; -function base64clean(str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0]; - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, ''); - // Node converts strings with length < 2 to '' - if (str.length < 2) return ''; - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while(str.length % 4 !== 0)str = str + '='; - return str; -} -function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for(let i = 0; i < length; ++i){ - codePoint = string.charCodeAt(i); - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - // valid lead - leadSurrogate = codePoint; - continue; - } - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - leadSurrogate = codePoint; - continue; - } - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; - } else if (leadSurrogate) // valid bmp char, but last char was a lead - { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - } - leadSurrogate = null; - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break; - bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break; - bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break; - bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else throw new Error('Invalid code point'); - } - return bytes; -} -function asciiToBytes(str) { - const byteArray = []; - for(let i = 0; i < str.length; ++i)// Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF); - return byteArray; -} -function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for(let i = 0; i < str.length; ++i){ - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; -} -function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); -} -function blitBuffer(src, dst, offset, length) { - let i; - for(i = 0; i < length; ++i){ - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; + } + if (min2 < 0) return void 0; + lo = scale2.invertExtent(range2[min2]); + hi = scale2.invertExtent(range2[max2]); + return [lo[0] === void 0 ? lo[1] : lo[0], hi[1] === void 0 ? hi[0] : hi[1]]; + }; + } + function band() { + const scale2 = ordinal().unknown(void 0), domain2 = scale2.domain, ordinalRange = scale2.range; + let range$12 = [0, 1], step, bandwidth2, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; + delete scale2.unknown; + function rescale() { + const n = domain2().length, reverse2 = range$12[1] < range$12[0], stop2 = range$12[1 - reverse2], space = bandSpace(n, paddingInner, paddingOuter); + let start = range$12[reverse2 - 0]; + step = (stop2 - start) / (space || 1); + if (round) { + step = Math.floor(step); + } + start += (stop2 - start - step * (n - paddingInner)) * align; + bandwidth2 = step * (1 - paddingInner); + if (round) { + start = Math.round(start); + bandwidth2 = Math.round(bandwidth2); + } + const values2 = range$3(n).map((i) => start + step * i); + return ordinalRange(reverse2 ? values2.reverse() : values2); } - return i; -} -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; -} -function numberIsNaN(obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare - ; -} -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = function() { - const alphabet = '0123456789abcdef'; - const table = new Array(256); - for(let i = 0; i < 16; ++i){ - const i16 = i * 16; - for(let j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; - } - return table; -}(); -// Return not function with Error if BigInt not supported -function defineBigIntMethod(fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn; -} -function BufferBigIntNotDefined() { - throw new Error('BigInt not supported'); -} - -},{"9c62938f1dccc73c":"7jAMi","aceacb6a4531a9d2":"hITcF"}],"7jAMi":[function(require,module,exports,__globalThis) { -'use strict'; -exports.byteLength = byteLength; -exports.toByteArray = toByteArray; -exports.fromByteArray = fromByteArray; -var lookup = []; -var revLookup = []; -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -for(var i = 0, len = code.length; i < len; ++i){ - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; -} -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62; -revLookup['_'.charCodeAt(0)] = 63; -function getLens(b64) { - var len = b64.length; - if (len % 4 > 0) throw new Error('Invalid string. Length must be a multiple of 4'); - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('='); - if (validLen === -1) validLen = len; - var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; - return [ - validLen, - placeHoldersLen - ]; -} -// base64 is 4/3 + up to two characters of the original data -function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i; - for(i = 0; i < len; i += 4){ - tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[curByte++] = tmp >> 16 & 0xFF; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - return arr; -} -function tripletToBase64(num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; -} -function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for(var i = start; i < end; i += 3){ - tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); - output.push(tripletToBase64(tmp)); - } - return output.join(''); -} -function fromByteArray(uint8) { - var tmp; - var len = uint8.length; - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - ; - var parts = []; - var maxChunkLength = 16383 // must be multiple of 3 - ; - // go through the array every three bytes, we'll deal with trailing stuff later - for(var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1]; - parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); - } - return parts.join(''); -} - -},{}],"hITcF":[function(require,module,exports,__globalThis) { -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ exports.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for(; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for(; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - if (e === 0) e = 1 - eBias; - else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity; - else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; -exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) value += rt / c; - else value += rt * Math.pow(2, 1 - eBias); - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for(; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for(; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - buffer[offset + i - d] |= s * 128; -}; - -},{}],"dYJ1x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dsvFormat", ()=>(0, _dsvJsDefault.default)); -parcelHelpers.export(exports, "csvParse", ()=>(0, _csvJs.csvParse)); -parcelHelpers.export(exports, "csvParseRows", ()=>(0, _csvJs.csvParseRows)); -parcelHelpers.export(exports, "csvFormat", ()=>(0, _csvJs.csvFormat)); -parcelHelpers.export(exports, "csvFormatBody", ()=>(0, _csvJs.csvFormatBody)); -parcelHelpers.export(exports, "csvFormatRows", ()=>(0, _csvJs.csvFormatRows)); -parcelHelpers.export(exports, "csvFormatRow", ()=>(0, _csvJs.csvFormatRow)); -parcelHelpers.export(exports, "csvFormatValue", ()=>(0, _csvJs.csvFormatValue)); -parcelHelpers.export(exports, "tsvParse", ()=>(0, _tsvJs.tsvParse)); -parcelHelpers.export(exports, "tsvParseRows", ()=>(0, _tsvJs.tsvParseRows)); -parcelHelpers.export(exports, "tsvFormat", ()=>(0, _tsvJs.tsvFormat)); -parcelHelpers.export(exports, "tsvFormatBody", ()=>(0, _tsvJs.tsvFormatBody)); -parcelHelpers.export(exports, "tsvFormatRows", ()=>(0, _tsvJs.tsvFormatRows)); -parcelHelpers.export(exports, "tsvFormatRow", ()=>(0, _tsvJs.tsvFormatRow)); -parcelHelpers.export(exports, "tsvFormatValue", ()=>(0, _tsvJs.tsvFormatValue)); -parcelHelpers.export(exports, "autoType", ()=>(0, _autoTypeJsDefault.default)); -var _dsvJs = require("./dsv.js"); -var _dsvJsDefault = parcelHelpers.interopDefault(_dsvJs); -var _csvJs = require("./csv.js"); -var _tsvJs = require("./tsv.js"); -var _autoTypeJs = require("./autoType.js"); -var _autoTypeJsDefault = parcelHelpers.interopDefault(_autoTypeJs); - -},{"./dsv.js":"kLCST","./csv.js":false,"./tsv.js":false,"./autoType.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kLCST":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - function parseRows(text, f) { - var rows = [], N = text.length, I = 0, n = 0, t, eof = N <= 0, eol = false; // current token followed by EOL? - // Strip the trailing newline. - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; - // Unescape quotes. - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while(I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); - if ((i = I) >= N) eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } - // Find next delimiter or newline. - while(I < N){ - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } else if (c !== DELIMITER) continue; - return text.slice(j, i); - } - // Return last token before EOF. - return eof = true, text.slice(j, N); - } - while((t = token()) !== EOF){ - var row = []; - while(t !== EOL && t !== EOF)row.push(t), t = token(); - if (f && (row = f(row, n++)) == null) continue; - rows.push(row); - } - return rows; - } - function preformatBody(rows, columns) { - return rows.map(function(row) { - return columns.map(function(column) { - return formatValue(row[column]); - }).join(delimiter); - }); - } - function format(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return [ - columns.map(formatValue).join(delimiter) - ].concat(preformatBody(rows, columns)).join("\n"); - } - function formatBody(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return preformatBody(rows, columns).join("\n"); - } - function formatRows(rows) { - return rows.map(formatRow).join("\n"); - } - function formatRow(row) { - return row.map(formatValue).join(delimiter); - } - function formatValue(value) { - return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; - } - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; - }); -var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; -function objectConverter(columns) { - return new Function("d", "return {" + columns.map(function(name, i) { - return JSON.stringify(name) + ": d[" + i + "] || \"\""; - }).join(",") + "}"); -} -function customConverter(columns, f) { - var object = objectConverter(columns); - return function(row, i) { - return f(object(row), i, columns); + scale2.domain = function(_) { + if (arguments.length) { + domain2(_); + return rescale(); + } else { + return domain2(); + } + }; + scale2.range = function(_) { + if (arguments.length) { + range$12 = [+_[0], +_[1]]; + return rescale(); + } else { + return range$12.slice(); + } + }; + scale2.rangeRound = function(_) { + range$12 = [+_[0], +_[1]]; + round = true; + return rescale(); + }; + scale2.bandwidth = function() { + return bandwidth2; + }; + scale2.step = function() { + return step; + }; + scale2.round = function(_) { + if (arguments.length) { + round = !!_; + return rescale(); + } else { + return round; + } + }; + scale2.padding = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + paddingInner = paddingOuter; + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingInner = function(_) { + if (arguments.length) { + paddingInner = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingOuter = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingOuter; + } + }; + scale2.align = function(_) { + if (arguments.length) { + align = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return align; + } + }; + scale2.invertRange = function(_) { + if (_[0] == null || _[1] == null) return; + const reverse2 = range$12[1] < range$12[0], values2 = reverse2 ? ordinalRange().reverse() : ordinalRange(), n = values2.length - 1; + let lo = +_[0], hi = +_[1], a2, b2, t; + if (lo !== lo || hi !== hi) return; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + if (hi < values2[0] || lo > range$12[1 - reverse2]) return; + a2 = Math.max(0, bisectRight$1(values2, lo) - 1); + b2 = lo === hi ? a2 : bisectRight$1(values2, hi) - 1; + if (lo - values2[a2] > bandwidth2 + 1e-10) ++a2; + if (reverse2) { + t = a2; + a2 = n - b2; + b2 = n - t; + } + return a2 > b2 ? void 0 : domain2().slice(a2, b2 + 1); + }; + scale2.invert = function(_) { + const value2 = scale2.invertRange([_, _]); + return value2 ? value2[0] : value2; + }; + scale2.copy = function() { + return band().domain(domain2()).range(range$12).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); }; -} -// Compute unique columns in order of discovery. -function inferColumns(rows) { - var columnSet = Object.create(null), columns = []; - rows.forEach(function(row) { - for(var column in row)if (!(column in columnSet)) columns.push(columnSet[column] = column); - }); - return columns; -} -function pad(value, width) { - var s = value + "", length = s.length; - return length < width ? new Array(width - length + 1).join(0) + s : s; -} -function formatYear(year) { - return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); -} -function formatDate(date) { - var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"esWvi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bbox", ()=>(0, _bboxJsDefault.default)); -parcelHelpers.export(exports, "feature", ()=>(0, _featureJsDefault.default)); -parcelHelpers.export(exports, "mesh", ()=>(0, _meshJsDefault.default)); -parcelHelpers.export(exports, "meshArcs", ()=>(0, _meshJs.meshArcs)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "mergeArcs", ()=>(0, _mergeJs.mergeArcs)); -parcelHelpers.export(exports, "neighbors", ()=>(0, _neighborsJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "transform", ()=>(0, _transformJsDefault.default)); -parcelHelpers.export(exports, "untransform", ()=>(0, _untransformJsDefault.default)); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _featureJs = require("./feature.js"); -var _featureJsDefault = parcelHelpers.interopDefault(_featureJs); -var _meshJs = require("./mesh.js"); -var _meshJsDefault = parcelHelpers.interopDefault(_meshJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _neighborsJs = require("./neighbors.js"); -var _neighborsJsDefault = parcelHelpers.interopDefault(_neighborsJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"4TJoC","./feature.js":"jKknB","./mesh.js":"lhGnJ","./merge.js":"JJVBO","./neighbors.js":"4qqBD","./quantize.js":"dGt9E","./transform.js":"fErFZ","./untransform.js":"hdkvK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4TJoC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - var t = (0, _transformJsDefault.default)(topology.transform), key, x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; - function bboxPoint(p) { - p = t(p); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - function bboxGeometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(bboxGeometry); - break; - case "Point": - bboxPoint(o.coordinates); - break; - case "MultiPoint": - o.coordinates.forEach(bboxPoint); - break; - } - } - topology.arcs.forEach(function(arc) { - var i = -1, n = arc.length, p; - while(++i < n){ - p = t(arc[i], i); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - }); - for(key in topology.objects)bboxGeometry(topology.objects[key]); - return [ - x0, - y0, - x1, - y1 - ]; - }); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./transform.js":"fErFZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fErFZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - while(j < n)output[j] = input[j], ++j; - return output; - }; - }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"3Ojm8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Ojm8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jKknB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function(o) { - return feature(topology, o); - }) - } : feature(topology, o); - }); -parcelHelpers.export(exports, "object", ()=>object); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -function feature(topology, o) { - var id = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o); - return id == null && bbox == null ? { - type: "Feature", - properties: properties, - geometry: geometry - } : bbox == null ? { - type: "Feature", - id: id, - properties: properties, - geometry: geometry - } : { - type: "Feature", - id: id, - bbox: bbox, - properties: properties, - geometry: geometry - }; -} -function object(topology, o) { - var transformPoint = (0, _transformJsDefault.default)(topology.transform), arcs = topology.arcs; - function arc(i, points) { - if (points.length) points.pop(); - for(var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k)points.push(transformPoint(a[k], k)); - if (i < 0) (0, _reverseJsDefault.default)(points, n); - } - function point(p) { - return transformPoint(p); - } - function line(arcs) { - var points = []; - for(var i = 0, n = arcs.length; i < n; ++i)arc(arcs[i], points); - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - return points; - } - function ring(arcs) { - var points = line(arcs); - while(points.length < 4)points.push(points[0]); // This may happen if an arc has only two points. - return points; - } - function polygon(arcs) { - return arcs.map(ring); - } - function geometry(o) { - var type = o.type, coordinates; - switch(type){ - case "GeometryCollection": - return { - type: type, - geometries: o.geometries.map(geometry) - }; - case "Point": - coordinates = point(o.coordinates); - break; - case "MultiPoint": - coordinates = o.coordinates.map(point); - break; - case "LineString": - coordinates = line(o.arcs); - break; - case "MultiLineString": - coordinates = o.arcs.map(line); - break; - case "Polygon": - coordinates = polygon(o.arcs); - break; - case "MultiPolygon": - coordinates = o.arcs.map(polygon); - break; - default: - return null; - } - return { - type: type, - coordinates: coordinates - }; + return rescale(); + } + function pointish(scale2) { + const copy2 = scale2.copy; + scale2.padding = scale2.paddingOuter; + delete scale2.paddingInner; + scale2.copy = function() { + return pointish(copy2()); + }; + return scale2; + } + function point$1() { + return pointish(band().paddingInner(1)); + } + var map = Array.prototype.map; + function numbers(_) { + return map.call(_, toNumber); + } + const slice$1 = Array.prototype.slice; + function scaleBinOrdinal() { + let domain2 = [], range2 = []; + function scale2(x2) { + return x2 == null || x2 !== x2 ? void 0 : range2[(bisectRight$1(domain2, x2) - 1) % range2.length]; + } + scale2.domain = function(_) { + if (arguments.length) { + domain2 = numbers(_); + return scale2; + } else { + return domain2.slice(); + } + }; + scale2.range = function(_) { + if (arguments.length) { + range2 = slice$1.call(_); + return scale2; + } else { + return range2.slice(); + } + }; + scale2.tickFormat = function(count2, specifier) { + return tickFormat$1(domain2[0], peek$1(domain2), count2 == null ? 10 : count2, specifier); + }; + scale2.copy = function() { + return scaleBinOrdinal().domain(scale2.domain()).range(scale2.range()); + }; + return scale2; + } + const scales = /* @__PURE__ */ new Map(); + const VEGA_SCALE = Symbol("vega_scale"); + function registerScale(scale2) { + scale2[VEGA_SCALE] = true; + return scale2; + } + function isRegisteredScale(scale2) { + return scale2 && scale2[VEGA_SCALE] === true; + } + function create$2(type2, constructor, metadata2) { + const ctr = function scale2() { + const s2 = constructor(); + if (!s2.invertRange) { + s2.invertRange = s2.invert ? invertRange(s2) : s2.invertExtent ? invertRangeExtent(s2) : void 0; + } + s2.type = type2; + return registerScale(s2); + }; + ctr.metadata = toSet(array$4(metadata2)); + return ctr; + } + function scale$4(type2, scale2, metadata2) { + if (arguments.length > 1) { + scales.set(type2, create$2(type2, scale2, metadata2)); + return this; + } else { + return isValidScaleType(type2) ? scales.get(type2) : void 0; } - return geometry(o); -} - -},{"./reverse.js":"fIOxk","./transform.js":"fErFZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fIOxk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(array, n) { - var t, j = array.length, i = j - n; - while(i < --j)t = array[i], array[i++] = array[j], array[j] = t; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lhGnJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, meshArcs.apply(this, arguments)); - }); -parcelHelpers.export(exports, "meshArcs", ()=>meshArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter); - else for(i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i)arcs[i] = i; - return { - type: "MultiLineString", - arcs: (0, _stitchJsDefault.default)(topology, arcs) + } + scale$4(Identity, identity$4); + scale$4(Linear, linear$1, Continuous); + scale$4(Log, log$4, [Continuous, Log]); + scale$4(Pow, pow$4, Continuous); + scale$4(Sqrt, sqrt$3, Continuous); + scale$4(Symlog, symlog$1, Continuous); + scale$4(Time, time$1, [Continuous, Temporal]); + scale$4(UTC, utcTime, [Continuous, Temporal]); + scale$4(Sequential, sequential, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Log}`, sequentialLog, [Continuous, Interpolating, Log]); + scale$4(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]); + scale$4(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Linear}`, diverging$1, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Log}`, divergingLog, [Continuous, Interpolating, Log]); + scale$4(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]); + scale$4(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); + scale$4(Quantile, quantile, [Discretizing, Quantile]); + scale$4(Quantize, quantize$1, Discretizing); + scale$4(Threshold, threshold, Discretizing); + scale$4(BinOrdinal, scaleBinOrdinal, [Discrete$1, Discretizing]); + scale$4(Ordinal, ordinal, Discrete$1); + scale$4(Band, band, Discrete$1); + scale$4(Point, point$1, Discrete$1); + function isValidScaleType(type2) { + return scales.has(type2); + } + function hasType(key2, type2) { + const s2 = scales.get(key2); + return s2 && s2.metadata[type2]; + } + function isContinuous(key2) { + return hasType(key2, Continuous); + } + function isDiscrete(key2) { + return hasType(key2, Discrete$1); + } + function isDiscretizing(key2) { + return hasType(key2, Discretizing); + } + function isLogarithmic(key2) { + return hasType(key2, Log); + } + function isTemporal(key2) { + return hasType(key2, Temporal); + } + function isInterpolating(key2) { + return hasType(key2, Interpolating); + } + function isQuantile(key2) { + return hasType(key2, Quantile); + } + const scaleProps = ["clamp", "base", "constant", "exponent"]; + function interpolateRange(interpolator, range2) { + const start = range2[0], span2 = peek$1(range2) - start; + return function(i) { + return interpolator(start + i * span2); }; -} -function extractArcs(topology, object, filter) { - var arcs = [], geomsByArc = [], geom; - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({ - i: i, - g: geom - }); + } + function interpolateColors(colors2, type2, gamma2) { + return piecewise(interpolate(type2 || "rgb", gamma2), colors2); + } + function quantizeInterpolator(interpolator, count2) { + const samples = new Array(count2), n = count2 + 1; + for (let i = 0; i < count2; ) samples[i] = interpolator(++i / n); + return samples; + } + function scaleFraction(scale$12, min2, max2) { + const delta = max2 - min2; + let i, t, s2; + if (!delta || !Number.isFinite(delta)) { + return constant$4(0.5); + } else { + i = (t = scale$12.type).indexOf("-"); + t = i < 0 ? t : t.slice(i + 1); + s2 = scale$4(t)().domain([min2, max2]).range([0, 1]); + scaleProps.forEach((m2) => scale$12[m2] ? s2[m2](scale$12[m2]()) : 0); + return s2; } - function extract1(arcs) { - arcs.forEach(extract0); + } + function interpolate(type2, gamma2) { + const interp = $$1[method(type2)]; + return gamma2 != null && interp && interp.gamma ? interp.gamma(gamma2) : interp; + } + function method(type2) { + return "interpolate" + type2.toLowerCase().split("-").map((s2) => s2[0].toUpperCase() + s2.slice(1)).join(""); + } + const continuous = { + blues: "cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90", + greens: "d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429", + greys: "e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e", + oranges: "fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303", + purples: "e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c", + reds: "fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13", + blueGreen: "d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429", + bluePurple: "ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71", + greenBlue: "d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1", + orangeRed: "fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403", + purpleBlue: "dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281", + purpleBlueGreen: "dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353", + purpleRed: "dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a", + redPurple: "fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174", + yellowGreen: "e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034", + yellowOrangeBrown: "feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204", + yellowOrangeRed: "fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225", + blueOrange: "134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07", + brownBlueGreen: "704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147", + purpleGreen: "5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29", + purpleOrange: "4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07", + redBlue: "8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85", + redGrey: "8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434", + yellowGreenBlue: "eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185", + redYellowBlue: "a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695", + redYellowGreen: "a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837", + pinkYellowGreen: "8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419", + spectral: "9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2", + viridis: "440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725", + magma: "0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf", + inferno: "0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4", + plasma: "0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921", + cividis: "00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647", + rainbow: "6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa", + sinebow: "ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040", + turbo: "23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00", + browns: "eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632", + tealBlues: "bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985", + teals: "bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667", + warmGreys: "dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e", + goldGreen: "f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36", + goldOrange: "f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26", + goldRed: "f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e", + lightGreyRed: "efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b", + lightGreyTeal: "e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc", + lightMulti: "e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c", + lightOrange: "f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b", + lightTealBlue: "e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988", + darkBlue: "3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff", + darkGold: "3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff", + darkGreen: "3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa", + darkMulti: "3737371f5287197d8c29a86995ce3fffe800ffffff", + darkRed: "3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c" + }; + const discrete = { + accent: schemeAccent, + category10: schemeCategory10, + category20: "1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5", + category20b: "393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6", + category20c: "3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9", + dark2: schemeDark2, + observable10: schemeObservable10, + paired: schemePaired, + pastel1: schemePastel1, + pastel2: schemePastel2, + set1: schemeSet1, + set2: schemeSet2, + set3: schemeSet3, + tableau10: "4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac", + tableau20: "4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5" + }; + function colors(palette) { + if (isArray(palette)) return palette; + const n = palette.length / 6 | 0, c2 = new Array(n); + for (let i = 0; i < n; ) { + c2[i] = "#" + palette.slice(i * 6, ++i * 6); } - function extract2(arcs) { - arcs.forEach(extract1); + return c2; + } + function apply(_, f) { + for (const k in _) scheme(k, f(_[k])); + } + const schemes = {}; + apply(discrete, colors); + apply(continuous, (_) => interpolateColors(colors(_))); + function scheme(name, scheme2) { + name = name && name.toLowerCase(); + if (arguments.length > 1) { + schemes[name] = scheme2; + return this; + } else { + return schemes[name]; } - function extract3(arcs) { - arcs.forEach(extract2); + } + const SymbolLegend = "symbol"; + const DiscreteLegend = "discrete"; + const GradientLegend = "gradient"; + const defaultFormatter = (value2) => isArray(value2) ? value2.map((v) => String(v)) : String(value2); + const ascending = (a2, b2) => a2[1] - b2[1]; + const descending = (a2, b2) => b2[1] - a2[1]; + function tickCount(scale2, count2, minStep) { + let step; + if (isNumber$1(count2)) { + if (scale2.bins) { + count2 = Math.max(count2, scale2.bins.length); + } + if (minStep != null) { + count2 = Math.min(count2, Math.floor(span(scale2.domain()) / minStep || 1) + 1); + } } - function geometry(o) { - switch(geom = o, o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "LineString": - extract1(o.arcs); - break; - case "MultiLineString": - case "Polygon": - extract2(o.arcs); - break; - case "MultiPolygon": - extract3(o.arcs); - break; - } + if (isObject(count2)) { + step = count2.step; + count2 = count2.interval; } - geometry(object); - geomsByArc.forEach(filter == null ? function(geoms) { - arcs.push(geoms[0].i); - } : function(geoms) { - if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); - }); - return arcs; -} - -},{"./feature.js":"jKknB","./stitch.js":"2rzgE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2rzgE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, arcs) { - var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - }); - arcs.forEach(function(i) { - var e = ends(i), start = e[0], end = e[1], f, g; - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else { - f = [ - i - ]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [ - 0, - 0 - ], arc.forEach(function(dp) { - p1[0] += dp[0], p1[1] += dp[1]; - }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [ - p1, - p0 - ] : [ - p0, - p1 - ]; - } - function flush(fragmentByEnd, fragmentByStart) { - for(var k in fragmentByEnd){ - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { - stitchedArcs[i < 0 ? ~i : i] = 1; - }); - fragments.push(f); - } - } - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { - if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([ - i - ]); - }); - return fragments; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"JJVBO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, mergeArcs.apply(this, arguments)); - }); -parcelHelpers.export(exports, "mergeArcs", ()=>mergeArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function planarRingArea(ring) { - var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; - while(++i < n)a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - return Math.abs(area); // Note: doubled area! -} -function mergeArcs(topology, objects) { - var polygonsByArc = {}, polygons = [], groups = []; - objects.forEach(geometry); - function geometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "Polygon": - extract(o.arcs); - break; - case "MultiPolygon": - o.arcs.forEach(extract); - break; - } + if (isString(count2)) { + count2 = scale2.type === Time ? timeInterval(count2) : scale2.type == UTC ? utcInterval(count2) : error("Only time and utc scales accept interval strings."); + if (step) count2 = count2.every(step); } - function extract(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); + return count2; + } + function validTicks(scale2, ticks2, count2) { + let range2 = scale2.range(), lo = range2[0], hi = peek$1(range2), cmp = ascending; + if (lo > hi) { + range2 = hi; + hi = lo; + lo = range2; + cmp = descending; } - function area(ring) { - return planarRingArea((0, _featureJs.object)(topology, { - type: "Polygon", - arcs: [ - ring - ] - }).coordinates[0]); + lo = Math.floor(lo); + hi = Math.ceil(hi); + ticks2 = ticks2.map((v) => [v, scale2(v)]).filter((_) => lo <= _[1] && _[1] <= hi).sort(cmp).map((_) => _[0]); + if (count2 > 0 && ticks2.length > 1) { + const endpoints = [ticks2[0], peek$1(ticks2)]; + while (ticks2.length > count2 && ticks2.length >= 3) { + ticks2 = ticks2.filter((_, i) => !(i % 2)); + } + if (ticks2.length < 3) { + ticks2 = endpoints; + } } - polygons.forEach(function(polygon) { - if (!polygon._) { - var group = [], neighbors = [ - polygon - ]; - polygon._ = 1; - groups.push(group); - while(polygon = neighbors.pop()){ - group.push(polygon); - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - polygons.forEach(function(polygon) { - delete polygon._; - }); - return { - type: "MultiPolygon", - arcs: groups.map(function(polygons) { - var arcs = [], n; - // Extract the exterior (unique) arcs. - polygons.forEach(function(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) arcs.push(arc); - }); - }); - }); - // Stitch the arcs into one or more rings. - arcs = (0, _stitchJsDefault.default)(topology, arcs); - // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - if ((n = arcs.length) > 1) { - for(var i = 1, k = area(arcs[0]), ki, t; i < n; ++i)if ((ki = area(arcs[i])) > k) t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - return arcs; - }).filter(function(arcs) { - return arcs.length > 0; - }) - }; -} - -},{"./feature.js":"jKknB","./stitch.js":"2rzgE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4qqBD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(objects) { - var indexesByArc = {}, neighbors = objects.map(function() { - return []; - }); - function line(arcs, i) { - arcs.forEach(function(a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i); - else indexesByArc[a] = [ - i - ]; - }); - } - function polygon(arcs, i) { - arcs.forEach(function(arc) { - line(arc, i); - }); - } - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { - geometry(o, i); - }); - else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs, i) { - arcs.forEach(function(arc) { - polygon(arc, i); - }); - } - }; - objects.forEach(geometry); - for(var i in indexesByArc){ - for(var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j)for(var k = j + 1; k < m; ++k){ - var ij = indexes[j], ik = indexes[k], n; - if ((n = neighbors[ij])[i = (0, _bisectJsDefault.default)(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = (0, _bisectJsDefault.default)(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - return neighbors; - }); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); - -},{"./bisect.js":"hkLok","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hkLok":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, x) { - var lo = 0, hi = a.length; - while(lo < hi){ - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dGt9E":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, transform) { - if (topology.transform) throw new Error("already quantized"); - if (!transform || !transform.scale) { - if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be \u22652"); - box = topology.bbox || (0, _bboxJsDefault.default)(topology); - var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n; - transform = { - scale: [ - x1 - x0 ? (x1 - x0) / (n - 1) : 1, - y1 - y0 ? (y1 - y0) / (n - 1) : 1 - ], - translate: [ - x0, - y0 - ] - }; - } else box = topology.bbox; - var t = (0, _untransformJsDefault.default)(transform), box, key, inputs = topology.objects, outputs = {}; - function quantizePoint(point) { - return t(point); - } - function quantizeGeometry(input) { - var output; - switch(input.type){ - case "GeometryCollection": - output = { - type: "GeometryCollection", - geometries: input.geometries.map(quantizeGeometry) - }; - break; - case "Point": - output = { - type: "Point", - coordinates: quantizePoint(input.coordinates) - }; - break; - case "MultiPoint": - output = { - type: "MultiPoint", - coordinates: input.coordinates.map(quantizePoint) - }; - break; - default: - return input; - } - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; - } - function quantizeArc(input) { - var i = 0, j = 1, n = input.length, p, output = new Array(n); // pessimistic - output[0] = t(input[0], 0); - while(++i < n)if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; // non-coincident points - if (j === 1) output[j++] = [ - 0, - 0 - ]; // an arc must have at least two points - output.length = j; - return output; - } - for(key in inputs)outputs[key] = quantizeGeometry(inputs[key]); - return { - type: "Topology", - bbox: box, - transform: transform, - objects: outputs, - arcs: topology.arcs.map(quantizeArc) - }; - }); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"4TJoC","./untransform.js":"hdkvK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdkvK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky); - output[0] = x1 - x0, x0 = x1; - output[1] = y1 - y0, y0 = y1; - while(j < n)output[j] = input[j], ++j; - return output; - }; - }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"3Ojm8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3VXXV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultLocale", ()=>defaultLocale); -parcelHelpers.export(exports, "locale", ()=>locale); -parcelHelpers.export(exports, "numberFormatDefaultLocale", ()=>numberFormatDefaultLocale); -parcelHelpers.export(exports, "numberFormatLocale", ()=>numberFormatLocale); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>resetDefaultLocale); -parcelHelpers.export(exports, "resetNumberFormatDefaultLocale", ()=>resetNumberFormatDefaultLocale); -parcelHelpers.export(exports, "resetTimeFormatDefaultLocale", ()=>resetTimeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>timeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatLocale", ()=>timeFormatLocale); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _vegaTime = require("vega-time"); -var _vegaUtil = require("vega-util"); -var _d3TimeFormat = require("d3-time-format"); -function memoize(method) { - const cache = {}; - return (spec)=>cache[spec] || (cache[spec] = method(spec)); -} -function trimZeroes(numberFormat, decimalChar) { - return (x)=>{ - const str = numberFormat(x), dec = str.indexOf(decimalChar); - if (dec < 0) return str; - let idx = rightmostDigit(str, dec); - const end = idx < str.length ? str.slice(idx) : ''; - while(--idx > dec)if (str[idx] !== '0') { - ++idx; - break; - } - return str.slice(0, idx) + end; - }; -} -function rightmostDigit(str, dec) { - let i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for(i = str.length; --i > dec;){ - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit + return ticks2; + } + function tickValues(scale2, count2) { + return scale2.bins ? validTicks(scale2, scale2.bins, count2) : scale2.ticks ? scale2.ticks(count2) : scale2.domain(); + } + function tickFormat(locale2, scale2, count2, specifier, formatType, noSkip) { + const type2 = scale2.type; + let format2 = defaultFormatter; + if (type2 === Time || formatType === Time) { + format2 = locale2.timeFormat(specifier); + } else if (type2 === UTC || formatType === UTC) { + format2 = locale2.utcFormat(specifier); + } else if (isLogarithmic(type2)) { + const varfmt = locale2.formatFloat(specifier); + if (noSkip || scale2.bins) { + format2 = varfmt; + } else { + const test2 = tickLog(scale2, count2, false); + format2 = (_) => test2(_) ? varfmt(_) : ""; + } + } else if (scale2.tickFormat) { + const d2 = scale2.domain(); + format2 = locale2.formatSpan(d2[0], d2[d2.length - 1], count2, specifier); + } else if (specifier) { + format2 = locale2.format(specifier); } -} -function numberLocale(locale) { - const format = memoize(locale.format), formatPrefix = locale.formatPrefix; - return { - format, - formatPrefix, - formatFloat (spec) { - const s = (0, _d3Format.formatSpecifier)(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch(s.type){ - case '%': - s.precision -= 2; - break; - case 'e': - s.precision -= 1; - break; - } - return trimZeroes(format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else return format(s); - }, - formatSpan (start, stop, count, specifier) { - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ',f' : specifier); - const step = (0, _d3Array.tickStep)(start, stop, count), value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - if (specifier.precision == null) switch(specifier.type){ - case 's': - if (!isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - case '': - case 'e': - case 'g': - case 'p': - case 'r': - if (!isNaN(precision = (0, _d3Format.precisionRound)(step, value))) specifier.precision = precision - (specifier.type === 'e'); - break; - case 'f': - case '%': - if (!isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === '%') * 2; - break; - } - return format(specifier); - } - }; -} -let defaultNumberLocale; -resetNumberFormatDefaultLocale(); -function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: (0, _d3Format.format), - formatPrefix: (0, _d3Format.formatPrefix) - }); -} -function numberFormatLocale(definition) { - return numberLocale((0, _d3Format.formatLocale)(definition)); -} -function numberFormatDefaultLocale(definition) { - return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale; -} -function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)(`Invalid time multi-format specifier: ${spec}`); - const second = interval((0, _vegaTime.SECONDS)), minute = interval((0, _vegaTime.MINUTES)), hour = interval((0, _vegaTime.HOURS)), day = interval((0, _vegaTime.DATE)), week = interval((0, _vegaTime.WEEK)), month = interval((0, _vegaTime.MONTH)), quarter = interval((0, _vegaTime.QUARTER)), year = interval((0, _vegaTime.YEAR)), L = format(spec[0, _vegaTime.MILLISECONDS] || '.%L'), S = format(spec[0, _vegaTime.SECONDS] || ':%S'), M = format(spec[0, _vegaTime.MINUTES] || '%I:%M'), H = format(spec[0, _vegaTime.HOURS] || '%I %p'), d = format(spec[0, _vegaTime.DATE] || spec[0, _vegaTime.DAY] || '%a %d'), w = format(spec[0, _vegaTime.WEEK] || '%b %d'), m = format(spec[0, _vegaTime.MONTH] || '%B'), q = format(spec[0, _vegaTime.QUARTER] || '%B'), y = format(spec[0, _vegaTime.YEAR] || '%Y'); - return (date)=>(second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date); -} -function timeLocale(locale) { - const timeFormat = memoize(locale.format), utcFormat = memoize(locale.utcFormat); - return { - timeFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? timeFormat(spec) : timeMultiFormat(timeFormat, (0, _vegaTime.timeInterval), spec), - utcFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? utcFormat(spec) : timeMultiFormat(utcFormat, (0, _vegaTime.utcInterval), spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; -} -let defaultTimeLocale; -resetTimeFormatDefaultLocale(); -function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: (0, _d3TimeFormat.timeFormat), - parse: (0, _d3TimeFormat.timeParse), - utcFormat: (0, _d3TimeFormat.utcFormat), - utcParse: (0, _d3TimeFormat.utcParse) - }); -} -function timeFormatLocale(definition) { - return timeLocale((0, _d3TimeFormat.timeFormatLocale)(definition)); -} -function timeFormatDefaultLocale(definition) { - return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale; -} -const createLocale = (number, time)=>(0, _vegaUtil.extend)({}, number, time); -function locale(numberSpec, timeSpec) { - const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); - const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); - return createLocale(number, time); -} -function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) (0, _vegaUtil.error)('defaultLocale expects either zero or two arguments.'); - return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); -} -function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); -} - -},{"d3-array":"5lCYW","d3-format":"4fjQY","vega-time":"kjkWX","vega-util":"f2ulH","d3-time-format":"eC6Bi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kjkWX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATE", ()=>DATE); -parcelHelpers.export(exports, "DAY", ()=>DAY); -parcelHelpers.export(exports, "DAYOFYEAR", ()=>DAYOFYEAR); -parcelHelpers.export(exports, "HOURS", ()=>HOURS); -parcelHelpers.export(exports, "MILLISECONDS", ()=>MILLISECONDS); -parcelHelpers.export(exports, "MINUTES", ()=>MINUTES); -parcelHelpers.export(exports, "MONTH", ()=>MONTH); -parcelHelpers.export(exports, "QUARTER", ()=>QUARTER); -parcelHelpers.export(exports, "SECONDS", ()=>SECONDS); -parcelHelpers.export(exports, "TIME_UNITS", ()=>TIME_UNITS); -parcelHelpers.export(exports, "WEEK", ()=>WEEK); -parcelHelpers.export(exports, "YEAR", ()=>YEAR); -parcelHelpers.export(exports, "dayofyear", ()=>dayofyear); -parcelHelpers.export(exports, "timeBin", ()=>bin); -parcelHelpers.export(exports, "timeFloor", ()=>timeFloor); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -parcelHelpers.export(exports, "timeOffset", ()=>timeOffset); -parcelHelpers.export(exports, "timeSequence", ()=>timeSequence); -parcelHelpers.export(exports, "timeUnitSpecifier", ()=>timeUnitSpecifier); -parcelHelpers.export(exports, "timeUnits", ()=>timeUnits); -parcelHelpers.export(exports, "utcFloor", ()=>utcFloor); -parcelHelpers.export(exports, "utcInterval", ()=>utcInterval); -parcelHelpers.export(exports, "utcOffset", ()=>utcOffset); -parcelHelpers.export(exports, "utcSequence", ()=>utcSequence); -parcelHelpers.export(exports, "utcdayofyear", ()=>utcdayofyear); -parcelHelpers.export(exports, "utcweek", ()=>utcweek); -parcelHelpers.export(exports, "week", ()=>week); -var _vegaUtil = require("vega-util"); -var _d3Time = require("d3-time"); -var _d3Array = require("d3-array"); -const YEAR = 'year'; -const QUARTER = 'quarter'; -const MONTH = 'month'; -const WEEK = 'week'; -const DATE = 'date'; -const DAY = 'day'; -const DAYOFYEAR = 'dayofyear'; -const HOURS = 'hours'; -const MINUTES = 'minutes'; -const SECONDS = 'seconds'; -const MILLISECONDS = 'milliseconds'; -const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -]; -const UNITS = TIME_UNITS.reduce((o, u, i)=>(o[u] = 1 + i, o), {}); -function timeUnits(units) { - const u = (0, _vegaUtil.array)(units).slice(), m = {}; - // check validity - if (!u.length) (0, _vegaUtil.error)('Missing time unit.'); - u.forEach((unit)=>{ - if ((0, _vegaUtil.hasOwnProperty)(UNITS, unit)) m[unit] = 1; - else (0, _vegaUtil.error)(`Invalid time unit: ${unit}.`); - }); - const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); - if (numTypes > 1) (0, _vegaUtil.error)(`Incompatible time units: ${units}`); - // ensure proper sort order - u.sort((a, b)=>UNITS[a] - UNITS[b]); - return u; -} -const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' -}; -function timeUnitSpecifier(units, specifiers) { - const s = (0, _vegaUtil.extend)({}, defaultSpecifiers, specifiers), u = timeUnits(units), n = u.length; - let fmt = '', start = 0, end, key; - for(start = 0; start < n;)for(end = u.length; end > start; --end){ - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } + return format2; + } + function tickLog(scale2, count2, values2) { + const ticks2 = tickValues(scale2, count2), base2 = scale2.base(), logb = Math.log(base2), k = Math.max(1, base2 * count2 / ticks2.length); + const test2 = (d2) => { + let i = d2 / Math.pow(base2, Math.round(Math.log(d2) / logb)); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k; + }; + return values2 ? ticks2.filter(test2) : test2; + } + const symbols$1 = { + [Quantile]: "quantiles", + [Quantize]: "thresholds", + [Threshold]: "domain" + }; + const formats = { + [Quantile]: "quantiles", + [Quantize]: "domain" + }; + function labelValues(scale2, count2) { + return scale2.bins ? binValues(scale2.bins) : scale2.type === Log ? tickLog(scale2, count2, true) : symbols$1[scale2.type] ? thresholdValues(scale2[symbols$1[scale2.type]]()) : tickValues(scale2, count2); + } + function thresholdFormat(locale2, scale2, specifier) { + const _ = scale2[formats[scale2.type]](), n = _.length; + let d2 = n > 1 ? _[1] - _[0] : _[0], i; + for (i = 1; i < n; ++i) { + d2 = Math.min(d2, _[i] - _[i - 1]); } - return fmt.trim(); -} -const t0 = new Date(); -function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; -} -function dayofyear(d) { - return localDayOfYear(new Date(d)); -} -function week(d) { - return localWeekNum(new Date(d)); -} -function localDayOfYear(d) { - return (0, _d3Time.timeDay).count(localYear(d.getFullYear()) - 1, d); -} -function localWeekNum(d) { - return (0, _d3Time.timeWeek).count(localYear(d.getFullYear()) - 1, d); -} -function localFirst(y) { - return localYear(y).getDay(); -} -function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); -} -function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); -} -function utcweek(d) { - return utcWeekNum(new Date(d)); -} -function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcDay).count(y - 1, d); -} -function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcWeek).count(y - 1, d); -} -function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); -} -function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); -} -function floor(units, step, get, inv, newDate) { - const s = step || 1, b = (0, _vegaUtil.peek)(units), _ = (unit, p, key)=>{ - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - const t = new Date(), u = (0, _vegaUtil.toSet)(units), y = u[YEAR] ? _(YEAR) : (0, _vegaUtil.constant)(2012), m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : (0, _vegaUtil.zero), d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : (0, _vegaUtil.one), H = u[HOURS] ? _(HOURS) : (0, _vegaUtil.zero), M = u[MINUTES] ? _(MINUTES) : (0, _vegaUtil.zero), S = u[SECONDS] ? _(SECONDS) : (0, _vegaUtil.zero), L = u[MILLISECONDS] ? _(MILLISECONDS) : (0, _vegaUtil.zero); - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; -} -function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f : phase ? (d, y)=>phase + step * Math.floor((f(d, y) - phase) / step) : (d, y)=>step * Math.floor(f(d, y) / step); - return inv ? (d, y)=>inv(u(d, y), y) : u; -} -// returns the day of the year based on week number, day of week, -// and the day of the week for the first day of the year -function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; -} -// -- LOCAL TIME -- -const localGet = { - [YEAR]: (d)=>d.getFullYear(), - [QUARTER]: (d)=>Math.floor(d.getMonth() / 3), - [MONTH]: (d)=>d.getMonth(), - [DATE]: (d)=>d.getDate(), - [HOURS]: (d)=>d.getHours(), - [MINUTES]: (d)=>d.getMinutes(), - [SECONDS]: (d)=>d.getSeconds(), - [MILLISECONDS]: (d)=>d.getMilliseconds(), - [DAYOFYEAR]: (d)=>localDayOfYear(d), - [WEEK]: (d)=>localWeekNum(d), - [WEEK + DAY]: (d, y)=>weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y)=>weekday(1, d.getDay(), localFirst(y)) -}; -const localInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, localFirst(y)) -}; -function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); -} -// -- UTC TIME -- -const utcGet = { - [YEAR]: (d)=>d.getUTCFullYear(), - [QUARTER]: (d)=>Math.floor(d.getUTCMonth() / 3), - [MONTH]: (d)=>d.getUTCMonth(), - [DATE]: (d)=>d.getUTCDate(), - [HOURS]: (d)=>d.getUTCHours(), - [MINUTES]: (d)=>d.getUTCMinutes(), - [SECONDS]: (d)=>d.getUTCSeconds(), - [MILLISECONDS]: (d)=>d.getUTCMilliseconds(), - [DAYOFYEAR]: (d)=>utcDayOfYear(d), - [WEEK]: (d)=>utcWeekNum(d), - [DAY]: (d, y)=>weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y)=>weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) -}; -const utcInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, utcFirst(y)) -}; -function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); -} -const timeIntervals = { - [YEAR]: (0, _d3Time.timeYear), - [QUARTER]: (0, _d3Time.timeMonth).every(3), - [MONTH]: (0, _d3Time.timeMonth), - [WEEK]: (0, _d3Time.timeWeek), - [DATE]: (0, _d3Time.timeDay), - [DAY]: (0, _d3Time.timeDay), - [DAYOFYEAR]: (0, _d3Time.timeDay), - [HOURS]: (0, _d3Time.timeHour), - [MINUTES]: (0, _d3Time.timeMinute), - [SECONDS]: (0, _d3Time.timeSecond), - [MILLISECONDS]: (0, _d3Time.timeMillisecond) -}; -const utcIntervals = { - [YEAR]: (0, _d3Time.utcYear), - [QUARTER]: (0, _d3Time.utcMonth).every(3), - [MONTH]: (0, _d3Time.utcMonth), - [WEEK]: (0, _d3Time.utcWeek), - [DATE]: (0, _d3Time.utcDay), - [DAY]: (0, _d3Time.utcDay), - [DAYOFYEAR]: (0, _d3Time.utcDay), - [HOURS]: (0, _d3Time.utcHour), - [MINUTES]: (0, _d3Time.utcMinute), - [SECONDS]: (0, _d3Time.utcSecond), - [MILLISECONDS]: (0, _d3Time.utcMillisecond) -}; -function timeInterval(unit) { - return timeIntervals[unit]; -} -function utcInterval(unit) { - return utcIntervals[unit]; -} -function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; -} -function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); -} -function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); -} -function sequence(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; -} -function timeSequence(unit, start, stop, step) { - return sequence(timeInterval(unit), start, stop, step); -} -function utcSequence(unit, start, stop, step) { - return sequence(utcInterval(unit), start, stop, step); -} -const durationSecond = 1000, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; -const Milli = [ - YEAR, - MONTH, - DATE, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [ - YEAR, - WEEK -], Month = [ - YEAR, - MONTH -], Year = [ - YEAR -]; -const intervals = [ - [ - Seconds, - 1, - durationSecond - ], - [ - Seconds, - 5, - 5 * durationSecond - ], - [ - Seconds, - 15, - 15 * durationSecond - ], - [ - Seconds, - 30, - 30 * durationSecond - ], - [ - Minutes, - 1, - durationMinute - ], - [ - Minutes, - 5, - 5 * durationMinute - ], - [ - Minutes, - 15, - 15 * durationMinute - ], - [ - Minutes, - 30, - 30 * durationMinute - ], - [ - Hours, - 1, - durationHour - ], - [ - Hours, - 3, - 3 * durationHour - ], - [ - Hours, - 6, - 6 * durationHour - ], - [ - Hours, - 12, - 12 * durationHour - ], - [ - Day, - 1, - durationDay - ], - [ - Week, - 1, - durationWeek - ], - [ - Month, - 1, - durationMonth - ], - [ - Month, - 3, - 3 * durationMonth - ], - [ - Year, - 1, - durationYear - ] -]; -function bin(opt) { - const ext = opt.extent, max = opt.maxbins || 40, target = Math.abs((0, _vegaUtil.span)(ext)) / max; - let i = (0, _d3Array.bisector)((i)=>i[2]).right(intervals, target), units, step; - if (i === intervals.length) units = Year, step = (0, _d3Array.tickStep)(ext[0] / durationYear, ext[1] / durationYear, max); - else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; + return locale2.formatSpan(0, d2, 3 * 10, specifier); + } + function thresholdValues(thresholds) { + const values2 = [-Infinity].concat(thresholds); + values2.max = Infinity; + return values2; + } + function binValues(bins) { + const values2 = bins.slice(0, -1); + values2.max = peek$1(bins); + return values2; + } + const isDiscreteRange = (scale2) => symbols$1[scale2.type] || scale2.bins; + function labelFormat(locale2, scale2, count2, type2, specifier, formatType, noSkip) { + const format2 = formats[scale2.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale2, scale2, specifier) : tickFormat(locale2, scale2, count2, specifier, formatType, noSkip); + return type2 === SymbolLegend && isDiscreteRange(scale2) ? formatRange(format2) : type2 === DiscreteLegend ? formatDiscrete(format2) : formatPoint(format2); + } + const formatRange = (format2) => (value2, index2, array2) => { + const limit = get$3(array2[index2 + 1], get$3(array2.max, Infinity)), lo = formatValue$1(value2, format2), hi = formatValue$1(limit, format2); + return lo && hi ? lo + " – " + hi : hi ? "< " + hi : "≥ " + lo; + }; + const get$3 = (value2, dflt) => value2 != null ? value2 : dflt; + const formatDiscrete = (format2) => (value2, index2) => index2 ? format2(value2) : null; + const formatPoint = (format2) => (value2) => format2(value2); + const formatValue$1 = (value2, format2) => Number.isFinite(value2) ? format2(value2) : null; + function labelFraction(scale2) { + const domain2 = scale2.domain(), count2 = domain2.length - 1; + let lo = +domain2[0], hi = +peek$1(domain2), span2 = hi - lo; + if (scale2.type === Threshold) { + const adjust = count2 ? span2 / count2 : 0.1; + lo -= adjust; + hi += adjust; + span2 = hi - lo; + } + return (value2) => (value2 - lo) / span2; + } + function format$1(locale2, scale2, specifier, formatType) { + const type2 = formatType || scale2.type; + if (isString(specifier) && isTemporal(type2)) { + specifier = specifier.replace(/%a/g, "%A").replace(/%b/g, "%B"); + } + return !specifier && type2 === Time ? locale2.timeFormat("%A, %d %B %Y, %X") : !specifier && type2 === UTC ? locale2.utcFormat("%A, %d %B %Y, %X UTC") : labelFormat(locale2, scale2, 5, null, specifier, formatType, true); + } + function domainCaption(locale2, scale2, opt) { + opt = opt || {}; + const max2 = Math.max(3, opt.maxlen || 7), fmt = format$1(locale2, scale2, opt.format, opt.formatType); + if (isDiscretizing(scale2.type)) { + const v = labelValues(scale2).slice(1).map(fmt), n = v.length; + return `${n} boundar${n === 1 ? "y" : "ies"}: ${v.join(", ")}`; + } else if (isDiscrete(scale2.type)) { + const d2 = scale2.domain(), n = d2.length, v = n > max2 ? d2.slice(0, max2 - 2).map(fmt).join(", ") + ", ending with " + d2.slice(-1).map(fmt) : d2.map(fmt).join(", "); + return `${n} value${n === 1 ? "" : "s"}: ${v}`; } else { - units = Milli; - step = Math.max((0, _d3Array.tickStep)(ext[0], ext[1], max), 1); + const d2 = scale2.domain(); + return `values from ${fmt(d2[0])} to ${fmt(peek$1(d2))}`; } - return { - units, - step + } + let gradient_id = 0; + function resetSVGGradientId() { + gradient_id = 0; + } + const patternPrefix = "p_"; + function isGradient(value2) { + return value2 && value2.gradient; + } + function gradientRef(g, defs, base2) { + const type2 = g.gradient; + let id2 = g.id, prefix = type2 === "radial" ? patternPrefix : ""; + if (!id2) { + id2 = g.id = "gradient_" + gradient_id++; + if (type2 === "radial") { + g.x1 = get$2(g.x1, 0.5); + g.y1 = get$2(g.y1, 0.5); + g.r1 = get$2(g.r1, 0); + g.x2 = get$2(g.x2, 0.5); + g.y2 = get$2(g.y2, 0.5); + g.r2 = get$2(g.r2, 0.5); + prefix = patternPrefix; + } else { + g.x1 = get$2(g.x1, 0); + g.y1 = get$2(g.y1, 0); + g.x2 = get$2(g.x2, 1); + g.y2 = get$2(g.y2, 0); + } + } + defs[id2] = g; + return "url(" + (base2 || "") + "#" + prefix + id2 + ")"; + } + function get$2(val, def2) { + return val != null ? val : def2; + } + function Gradient$1(p02, p1) { + var stops = [], gradient2; + return gradient2 = { + gradient: "linear", + x1: p02 ? p02[0] : 0, + y1: p02 ? p02[1] : 0, + x2: p1 ? p1[0] : 1, + y2: p1 ? p1[1] : 0, + stops, + stop: function(offset2, color2) { + stops.push({ + offset: offset2, + color: color2 + }); + return gradient2; + } }; -} - -},{"vega-util":"f2ulH","d3-time":"6KMda","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2YZ3v":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "aggregate", ()=>Aggregate); -parcelHelpers.export(exports, "bin", ()=>Bin); -parcelHelpers.export(exports, "collect", ()=>Collect); -parcelHelpers.export(exports, "compare", ()=>Compare); -parcelHelpers.export(exports, "countpattern", ()=>CountPattern); -parcelHelpers.export(exports, "cross", ()=>Cross); -parcelHelpers.export(exports, "density", ()=>Density); -parcelHelpers.export(exports, "dotbin", ()=>DotBin); -parcelHelpers.export(exports, "expression", ()=>Expression); -parcelHelpers.export(exports, "extent", ()=>Extent); -parcelHelpers.export(exports, "facet", ()=>Facet); -parcelHelpers.export(exports, "field", ()=>Field); -parcelHelpers.export(exports, "filter", ()=>Filter); -parcelHelpers.export(exports, "flatten", ()=>Flatten); -parcelHelpers.export(exports, "fold", ()=>Fold); -parcelHelpers.export(exports, "formula", ()=>Formula); -parcelHelpers.export(exports, "generate", ()=>Generate); -parcelHelpers.export(exports, "impute", ()=>Impute); -parcelHelpers.export(exports, "joinaggregate", ()=>JoinAggregate); -parcelHelpers.export(exports, "kde", ()=>KDE); -parcelHelpers.export(exports, "key", ()=>Key); -parcelHelpers.export(exports, "load", ()=>Load); -parcelHelpers.export(exports, "lookup", ()=>Lookup); -parcelHelpers.export(exports, "multiextent", ()=>MultiExtent); -parcelHelpers.export(exports, "multivalues", ()=>MultiValues); -parcelHelpers.export(exports, "params", ()=>Params); -parcelHelpers.export(exports, "pivot", ()=>Pivot); -parcelHelpers.export(exports, "prefacet", ()=>PreFacet); -parcelHelpers.export(exports, "project", ()=>Project); -parcelHelpers.export(exports, "proxy", ()=>Proxy); -parcelHelpers.export(exports, "quantile", ()=>Quantile); -parcelHelpers.export(exports, "relay", ()=>Relay); -parcelHelpers.export(exports, "sample", ()=>Sample); -parcelHelpers.export(exports, "sequence", ()=>Sequence); -parcelHelpers.export(exports, "sieve", ()=>Sieve); -parcelHelpers.export(exports, "subflow", ()=>Subflow); -parcelHelpers.export(exports, "timeunit", ()=>TimeUnit); -parcelHelpers.export(exports, "tupleindex", ()=>TupleIndex); -parcelHelpers.export(exports, "values", ()=>Values); -parcelHelpers.export(exports, "window", ()=>Window); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaStatistics = require("vega-statistics"); -var _d3Array = require("d3-array"); -var _vegaTime = require("vega-time"); -function multikey(f) { - return (x)=>{ - const n = f.length; - let i = 1, k = String(f[0](x)); - for(; i < n; ++i)k += '|' + f[i](x); - return k; - }; -} -function groupkey(fields) { - return !fields || !fields.length ? function() { - return ''; - } : fields.length === 1 ? fields[0] : multikey(fields); -} -function measureName(op, field, as) { - return as || op + (!field ? '' : '_' + field); -} -const noop = ()=>{}; -const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 -}; -const AggregateOps = { - values: { - init: (m)=>m.cell.store = true, - value: (m)=>m.cell.data.values(), - idx: -1 + } + const lookup$4 = { + "basis": { + curve: curveBasis }, - count: { - value: (m)=>m.cell.num + "basis-closed": { + curve: curveBasisClosed }, - __count__: { - value: (m)=>m.missing + m.valid + "basis-open": { + curve: curveBasisOpen }, - missing: { - value: (m)=>m.missing + "bundle": { + curve: curveBundle, + tension: "beta", + value: 0.85 }, - valid: { - value: (m)=>m.valid + "cardinal": { + curve: curveCardinal, + tension: "tension", + value: 0 }, - sum: { - init: (m)=>m.sum = 0, - value: (m)=>m.valid ? m.sum : undefined, - add: (m, v)=>m.sum += +v, - rem: (m, v)=>m.sum -= v + "cardinal-open": { + curve: curveCardinalOpen, + tension: "tension", + value: 0 }, - product: { - init: (m)=>m.product = 1, - value: (m)=>m.valid ? m.product : undefined, - add: (m, v)=>m.product *= v, - rem: (m, v)=>m.product /= v + "cardinal-closed": { + curve: curveCardinalClosed, + tension: "tension", + value: 0 }, - mean: { - init: (m)=>m.mean = 0, - value: (m)=>m.valid ? m.mean : undefined, - add: (m, v)=>(m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v)=>(m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) + "catmull-rom": { + curve: curveCatmullRom, + tension: "alpha", + value: 0.5 }, - average: { - value: (m)=>m.valid ? m.mean : undefined, - req: [ - 'mean' - ], - idx: 1 + "catmull-rom-closed": { + curve: curveCatmullRomClosed, + tension: "alpha", + value: 0.5 }, - variance: { - init: (m)=>m.dev = 0, - value: (m)=>m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v)=>m.dev += m.mean_d * (v - m.mean), - rem: (m, v)=>m.dev -= m.mean_d * (v - m.mean), - req: [ - 'mean' - ], - idx: 1 + "catmull-rom-open": { + curve: curveCatmullRomOpen, + tension: "alpha", + value: 0.5 }, - variancep: { - value: (m)=>m.valid > 1 ? m.dev / m.valid : undefined, - req: [ - 'variance' - ], - idx: 2 + "linear": { + curve: curveLinear }, - stdev: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: [ - 'variance' - ], - idx: 2 + "linear-closed": { + curve: curveLinearClosed }, - stdevp: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: [ - 'variance' - ], - idx: 2 + "monotone": { + horizontal: monotoneY, + vertical: monotoneX }, - stderr: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: [ - 'variance' - ], - idx: 2 + "natural": { + curve: curveNatural }, - distinct: { - value: (m)=>m.cell.data.distinct(m.get), - req: [ - 'values' - ], - idx: 3 + "step": { + curve: curveStep }, - ci0: { - value: (m)=>m.cell.data.ci0(m.get), - req: [ - 'values' - ], - idx: 3 + "step-after": { + curve: stepAfter }, - ci1: { - value: (m)=>m.cell.data.ci1(m.get), - req: [ - 'values' - ], - idx: 3 + "step-before": { + curve: stepBefore + } + }; + function curves(type2, orientation, tension) { + var entry2 = has$1(lookup$4, type2) && lookup$4[type2], curve2 = null; + if (entry2) { + curve2 = entry2.curve || entry2[orientation || "vertical"]; + if (entry2.tension && tension != null) { + curve2 = curve2[entry2.tension](tension); + } + } + return curve2; + } + const paramCounts = { + m: 2, + l: 2, + h: 1, + v: 1, + z: 0, + c: 6, + s: 4, + q: 4, + t: 2, + a: 7 + }; + const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; + const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; + const spacePattern = /^((\s+,?\s*)|(,\s*))/; + const flagPattern = /^[01]/; + function parse$3(path2) { + const commands = []; + const matches = path2.match(commandPattern) || []; + matches.forEach((str) => { + let cmd = str[0]; + const type2 = cmd.toLowerCase(); + const paramCount = paramCounts[type2]; + const params2 = parseParams(type2, paramCount, str.slice(1).trim()); + const count2 = params2.length; + if (count2 < paramCount || count2 && count2 % paramCount !== 0) { + throw Error("Invalid SVG path, incorrect parameter count"); + } + commands.push([cmd, ...params2.slice(0, paramCount)]); + if (count2 === paramCount) { + return; + } + if (type2 === "m") { + cmd = cmd === "M" ? "L" : "l"; + } + for (let i = paramCount; i < count2; i += paramCount) { + commands.push([cmd, ...params2.slice(i, i + paramCount)]); + } + }); + return commands; + } + function parseParams(type2, paramCount, segment) { + const params2 = []; + for (let index2 = 0; paramCount && index2 < segment.length; ) { + for (let i = 0; i < paramCount; ++i) { + const pattern = type2 === "a" && (i === 3 || i === 4) ? flagPattern : numberPattern; + const match2 = segment.slice(index2).match(pattern); + if (match2 === null) { + throw Error("Invalid SVG path, incorrect parameter type"); + } + index2 += match2[0].length; + params2.push(+match2[0]); + const ws = segment.slice(index2).match(spacePattern); + if (ws !== null) { + index2 += ws[0].length; + } + } + } + return params2; + } + const DegToRad = Math.PI / 180; + const Epsilon = 1e-14; + const HalfPi = Math.PI / 2; + const Tau = Math.PI * 2; + const HalfSqrt3 = Math.sqrt(3) / 2; + var segmentCache = {}; + var bezierCache = {}; + var join$1 = [].join; + function segments(x2, y2, rx, ry, large, sweep, rotateX2, ox, oy) { + const key2 = join$1.call(arguments); + if (segmentCache[key2]) { + return segmentCache[key2]; + } + const th = rotateX2 * DegToRad; + const sin_th = Math.sin(th); + const cos_th = Math.cos(th); + rx = Math.abs(rx); + ry = Math.abs(ry); + const px2 = cos_th * (ox - x2) * 0.5 + sin_th * (oy - y2) * 0.5; + const py2 = cos_th * (oy - y2) * 0.5 - sin_th * (ox - x2) * 0.5; + let pl = px2 * px2 / (rx * rx) + py2 * py2 / (ry * ry); + if (pl > 1) { + pl = Math.sqrt(pl); + rx *= pl; + ry *= pl; + } + const a00 = cos_th / rx; + const a01 = sin_th / rx; + const a10 = -sin_th / ry; + const a11 = cos_th / ry; + const x02 = a00 * ox + a01 * oy; + const y02 = a10 * ox + a11 * oy; + const x12 = a00 * x2 + a01 * y2; + const y12 = a10 * x2 + a11 * y2; + const d2 = (x12 - x02) * (x12 - x02) + (y12 - y02) * (y12 - y02); + let sfactor_sq = 1 / d2 - 0.25; + if (sfactor_sq < 0) sfactor_sq = 0; + let sfactor = Math.sqrt(sfactor_sq); + if (sweep == large) sfactor = -sfactor; + const xc = 0.5 * (x02 + x12) - sfactor * (y12 - y02); + const yc = 0.5 * (y02 + y12) + sfactor * (x12 - x02); + const th0 = Math.atan2(y02 - yc, x02 - xc); + const th1 = Math.atan2(y12 - yc, x12 - xc); + let th_arc = th1 - th0; + if (th_arc < 0 && sweep === 1) { + th_arc += Tau; + } else if (th_arc > 0 && sweep === 0) { + th_arc -= Tau; + } + const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 1e-3))); + const result = []; + for (let i = 0; i < segs; ++i) { + const th2 = th0 + i * th_arc / segs; + const th3 = th0 + (i + 1) * th_arc / segs; + result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th]; + } + return segmentCache[key2] = result; + } + function bezier(params2) { + const key2 = join$1.call(params2); + if (bezierCache[key2]) { + return bezierCache[key2]; + } + var cx = params2[0], cy = params2[1], th0 = params2[2], th1 = params2[3], rx = params2[4], ry = params2[5], sin_th = params2[6], cos_th = params2[7]; + const a00 = cos_th * rx; + const a01 = -sin_th * ry; + const a10 = sin_th * rx; + const a11 = cos_th * ry; + const cos_th0 = Math.cos(th0); + const sin_th0 = Math.sin(th0); + const cos_th1 = Math.cos(th1); + const sin_th1 = Math.sin(th1); + const th_half = 0.5 * (th1 - th0); + const sin_th_h2 = Math.sin(th_half * 0.5); + const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); + const x12 = cx + cos_th0 - t * sin_th0; + const y12 = cy + sin_th0 + t * cos_th0; + const x3 = cx + cos_th1; + const y3 = cy + sin_th1; + const x2 = x3 + t * sin_th1; + const y2 = y3 - t * cos_th1; + return bezierCache[key2] = [a00 * x12 + a01 * y12, a10 * x12 + a11 * y12, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3]; + } + const temp = ["l", 0, 0, 0, 0, 0, 0, 0]; + function scale$1$1(current, sX, sY) { + const c2 = temp[0] = current[0]; + if (c2 === "a" || c2 === "A") { + temp[1] = sX * current[1]; + temp[2] = sY * current[2]; + temp[3] = current[3]; + temp[4] = current[4]; + temp[5] = current[5]; + temp[6] = sX * current[6]; + temp[7] = sY * current[7]; + } else if (c2 === "h" || c2 === "H") { + temp[1] = sX * current[1]; + } else if (c2 === "v" || c2 === "V") { + temp[1] = sY * current[1]; + } else { + for (var i = 1, n = current.length; i < n; ++i) { + temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; + } + } + return temp; + } + function pathRender(context2, path2, l, t, sX, sY) { + var current, previous = null, x2 = 0, y2 = 0, controlX = 0, controlY = 0, tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; + if (l == null) l = 0; + if (t == null) t = 0; + if (sX == null) sX = 1; + if (sY == null) sY = sX; + if (context2.beginPath) context2.beginPath(); + for (var i = 0, len2 = path2.length; i < len2; ++i) { + current = path2[i]; + if (sX !== 1 || sY !== 1) { + current = scale$1$1(current, sX, sY); + } + switch (current[0]) { + // first letter + case "l": + x2 += current[1]; + y2 += current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "L": + x2 = current[1]; + y2 = current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "h": + x2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "H": + x2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "v": + y2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "V": + y2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "m": + x2 += current[1]; + y2 += current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "M": + x2 = current[1]; + y2 = current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "c": + tempX = x2 + current[5]; + tempY = y2 + current[6]; + controlX = x2 + current[3]; + controlY = y2 + current[4]; + context2.bezierCurveTo( + x2 + current[1] + l, + // x1 + y2 + current[2] + t, + // y1 + controlX + l, + // x2 + controlY + t, + // y2 + tempX + l, + tempY + t + ); + x2 = tempX; + y2 = tempY; + break; + case "C": + x2 = current[5]; + y2 = current[6]; + controlX = current[3]; + controlY = current[4]; + context2.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x2 + l, y2 + t); + break; + case "s": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, x2 + current[1] + l, y2 + current[2] + t, tempX + l, tempY + t); + controlX = x2 + current[1]; + controlY = y2 + current[2]; + x2 = tempX; + y2 = tempY; + break; + case "S": + tempX = current[3]; + tempY = current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "q": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "Q": + tempX = current[3]; + tempY = current[4]; + context2.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "t": + tempX = x2 + current[1]; + tempY = y2 + current[2]; + if (previous[0].match(/[QqTt]/) === null) { + controlX = x2; + controlY = y2; + } else if (previous[0] === "t") { + controlX = 2 * x2 - tempControlX; + controlY = 2 * y2 - tempControlY; + } else if (previous[0] === "q") { + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + } + tempControlX = controlX; + tempControlY = controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + break; + case "T": + tempX = current[1]; + tempY = current[2]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "a": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x2 + l, current[7] + y2 + t]); + x2 += current[6]; + y2 += current[7]; + break; + case "A": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]); + x2 = current[6]; + y2 = current[7]; + break; + case "z": + case "Z": + x2 = anchorX; + y2 = anchorY; + context2.closePath(); + break; + } + previous = current; + } + } + function drawArc(context2, x2, y2, coords) { + const seg = segments( + coords[5], + // end x + coords[6], + // end y + coords[0], + // radius x + coords[1], + // radius y + coords[3], + // large flag + coords[4], + // sweep flag + coords[2], + // rotation + x2, + y2 + ); + for (let i = 0; i < seg.length; ++i) { + const bez = bezier(seg[i]); + context2.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); + } + } + const Tan30 = 0.5773502691896257; + const builtins = { + "circle": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, Tau); + } }, - median: { - value: (m)=>m.cell.data.q2(m.get), - req: [ - 'values' - ], - idx: 3 + "cross": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, s2 = r / 2.5; + context2.moveTo(-r, -s2); + context2.lineTo(-r, s2); + context2.lineTo(-s2, s2); + context2.lineTo(-s2, r); + context2.lineTo(s2, r); + context2.lineTo(s2, s2); + context2.lineTo(r, s2); + context2.lineTo(r, -s2); + context2.lineTo(s2, -s2); + context2.lineTo(s2, -r); + context2.lineTo(-s2, -r); + context2.lineTo(-s2, -s2); + context2.closePath(); + } }, - q1: { - value: (m)=>m.cell.data.q1(m.get), - req: [ - 'values' - ], - idx: 3 + "diamond": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(-r, 0); + context2.lineTo(0, -r); + context2.lineTo(r, 0); + context2.lineTo(0, r); + context2.closePath(); + } }, - q3: { - value: (m)=>m.cell.data.q3(m.get), - req: [ - 'values' - ], - idx: 3 + "square": { + draw: function(context2, size) { + var w2 = Math.sqrt(size), x2 = -w2 / 2; + context2.rect(x2, x2, w2, w2); + } }, - min: { - init: (m)=>m.min = undefined, - value: (m)=>m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min, - add: (m, v)=>{ - if (v < m.min || m.min === undefined) m.min = v; - }, - rem: (m, v)=>{ - if (v <= m.min) m.min = NaN; - }, - req: [ - 'values' - ], - idx: 4 + "arrow": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, s2 = r / 7, t = r / 2.5, v = r / 8; + context2.moveTo(-s2, r); + context2.lineTo(s2, r); + context2.lineTo(s2, -v); + context2.lineTo(t, -v); + context2.lineTo(0, -r); + context2.lineTo(-t, -v); + context2.lineTo(-s2, -v); + context2.closePath(); + } }, - max: { - init: (m)=>m.max = undefined, - value: (m)=>m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max, - add: (m, v)=>{ - if (v > m.max || m.max === undefined) m.max = v; - }, - rem: (m, v)=>{ - if (v >= m.max) m.max = NaN; - }, - req: [ - 'values' - ], - idx: 4 + "wedge": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30, b2 = r / 4; + context2.moveTo(0, -h2 - o); + context2.lineTo(-b2, h2 - o); + context2.lineTo(b2, h2 - o); + context2.closePath(); + } }, - argmin: { - init: (m)=>m.argmin = undefined, - value: (m)=>m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t)=>{ - if (v < m.min) m.argmin = t; - }, - rem: (m, v)=>{ - if (v <= m.min) m.argmin = undefined; - }, - req: [ - 'min', - 'values' - ], - idx: 3 + "triangle": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30; + context2.moveTo(0, -h2 - o); + context2.lineTo(-r, h2 - o); + context2.lineTo(r, h2 - o); + context2.closePath(); + } }, - argmax: { - init: (m)=>m.argmax = undefined, - value: (m)=>m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t)=>{ - if (v > m.max) m.argmax = t; - }, - rem: (m, v)=>{ - if (v >= m.max) m.argmax = undefined; - }, - req: [ - 'max', - 'values' - ], - idx: 3 + "triangle-up": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, -h2); + context2.lineTo(-r, h2); + context2.lineTo(r, h2); + context2.closePath(); + } }, - exponential: { - init: (m, r)=>{ - m.exp = 0; - m.exp_r = r; - }, - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) / (1 - m.exp_r ** m.valid) : undefined, - add: (m, v)=>m.exp = m.exp_r * m.exp + v, - rem: (m, v)=>m.exp = (m.exp - v / m.exp_r ** (m.valid - 1)) / m.exp_r + "triangle-down": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, h2); + context2.lineTo(-r, -h2); + context2.lineTo(r, -h2); + context2.closePath(); + } }, - exponentialb: { - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) : undefined, - req: [ - 'exponential' - ], - idx: 1 - } -}; -const ValidAggregateOps = Object.keys(AggregateOps).filter((d)=>d !== '__count__'); -function measure(key, value) { - return (out, aggregate_param)=>(0, _vegaUtil.extend)({ - name: key, - aggregate_param: aggregate_param, - out: out || key - }, base_op, value); -} -[ - ...ValidAggregateOps, - '__count__' -].forEach((key)=>{ - AggregateOps[key] = measure(key, AggregateOps[key]); -}); -function createMeasure(op, param, name) { - return AggregateOps[op](name, param); -} -function compareIndex(a, b) { - return a.idx - b.idx; -} -function resolve(agg) { - const map = {}; - agg.forEach((a)=>map[a.name] = a); - const getreqs = (a)=>{ - if (!a.req) return; - a.req.forEach((key)=>{ - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - return Object.values(map).sort(compareIndex); -} -function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach((op)=>op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); -} -function add(v, t) { - if (v == null || v === '') { - ++this.missing; - return; - } - if (v !== v) return; - ++this.valid; - this._ops.forEach((op)=>op.add(this, v, t)); -} -function rem(v, t) { - if (v == null || v === '') { - --this.missing; - return; + "triangle-right": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(h2, 0); + context2.lineTo(-h2, -r); + context2.lineTo(-h2, r); + context2.closePath(); + } + }, + "triangle-left": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(-h2, 0); + context2.lineTo(h2, -r); + context2.lineTo(h2, r); + context2.closePath(); + } + }, + "stroke": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(-r, 0); + context2.lineTo(r, 0); + } } - if (v !== v) return; - --this.valid; - this._ops.forEach((op)=>op.rem(this, v, t)); -} -function set(t) { - this._out.forEach((op)=>t[op.out] = op.value(this)); - return t; -} -function compileMeasures(agg, field) { - const get = field || (0, _vegaUtil.identity), ops = resolve(agg), out = agg.slice().sort(compareIndex); - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); + }; + function symbols(_) { + return has$1(builtins, _) ? builtins[_] : customSymbol(_); + } + var custom = {}; + function customSymbol(path2) { + if (!has$1(custom, path2)) { + const parsed = parse$3(path2); + custom[path2] = { + draw: function(context2, size) { + pathRender(context2, parsed, 0, 0, Math.sqrt(size) / 2); + } + }; } - ctr.prototype.init = init; - ctr.prototype.add = add; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map((op)=>op.out); - return ctr; -} -function TupleStore(key) { - this._key = key ? (0, _vegaUtil.field)(key) : (0, _vegaDataflow.tupleid); - this.reset(); -} -const prototype$1 = TupleStore.prototype; -prototype$1.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; -}; -prototype$1.add = function(v) { - this._add.push(v); -}; -prototype$1.rem = function(v) { - this._rem.push(v); -}; -prototype$1.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - const a = this._add, r = this._rem, k = this._key, n = a.length, m = r.length, x = Array(n - m), map = {}; - let i, j, v; - // use unique key field to clear removed values - for(i = 0; i < m; ++i)map[k(r[i])] = 1; - for(i = 0, j = 0; i < n; ++i)if (map[k(v = a[i])]) map[k(v)] = 0; - else x[j++] = v; - this._rem = []; - return this._add = x; -}; -// memoizing statistics methods -prototype$1.distinct = function(get) { - const v = this.values(), map = {}; - let n = v.length, count = 0, s; - while(--n >= 0){ - s = get(v[n]) + ''; - if (!(0, _vegaUtil.hasOwnProperty)(map, s)) { - map[s] = 1; - ++count; - } - } - return count; -}; -prototype$1.extent = function(get) { - if (this._get !== get || !this._ext) { - const v = this.values(), i = (0, _vegaUtil.extentIndex)(v, get); - this._ext = [ - v[i[0]], - v[i[1]] - ]; - this._get = get; + return custom[path2]; + } + const C = 0.448084975506; + function rectangleX(d2) { + return d2.x; + } + function rectangleY(d2) { + return d2.y; + } + function rectangleWidth(d2) { + return d2.width; + } + function rectangleHeight(d2) { + return d2.height; + } + function number$3(_) { + return typeof _ === "function" ? _ : () => +_; + } + function clamp(value2, min2, max2) { + return Math.max(min2, Math.min(value2, max2)); + } + function vg_rect() { + var x2 = rectangleX, y2 = rectangleY, width2 = rectangleWidth, height2 = rectangleHeight, crTL = number$3(0), crTR = crTL, crBL = crTL, crBR = crTL, context2 = null; + function rectangle2(_, x02, y02) { + var buffer, x12 = x02 != null ? x02 : +x2.call(this, _), y12 = y02 != null ? y02 : +y2.call(this, _), w2 = +width2.call(this, _), h2 = +height2.call(this, _), s2 = Math.min(w2, h2) / 2, tl2 = clamp(+crTL.call(this, _), 0, s2), tr2 = clamp(+crTR.call(this, _), 0, s2), bl2 = clamp(+crBL.call(this, _), 0, s2), br2 = clamp(+crBR.call(this, _), 0, s2); + if (!context2) context2 = buffer = path$3(); + if (tl2 <= 0 && tr2 <= 0 && bl2 <= 0 && br2 <= 0) { + context2.rect(x12, y12, w2, h2); + } else { + var x22 = x12 + w2, y22 = y12 + h2; + context2.moveTo(x12 + tl2, y12); + context2.lineTo(x22 - tr2, y12); + context2.bezierCurveTo(x22 - C * tr2, y12, x22, y12 + C * tr2, x22, y12 + tr2); + context2.lineTo(x22, y22 - br2); + context2.bezierCurveTo(x22, y22 - C * br2, x22 - C * br2, y22, x22 - br2, y22); + context2.lineTo(x12 + bl2, y22); + context2.bezierCurveTo(x12 + C * bl2, y22, x12, y22 - C * bl2, x12, y22 - bl2); + context2.lineTo(x12, y12 + tl2); + context2.bezierCurveTo(x12, y12 + C * tl2, x12 + C * tl2, y12, x12 + tl2, y12); + context2.closePath(); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } } - return this._ext; -}; -prototype$1.argmin = function(get) { - return this.extent(get)[0] || {}; -}; -prototype$1.argmax = function(get) { - return this.extent(get)[1] || {}; -}; -prototype$1.min = function(get) { - const m = this.extent(get)[0]; - return m != null ? get(m) : undefined; -}; -prototype$1.max = function(get) { - const m = this.extent(get)[1]; - return m != null ? get(m) : undefined; -}; -prototype$1.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = (0, _vegaStatistics.quartiles)(this.values(), get); - this._get = get; + rectangle2.x = function(_) { + if (arguments.length) { + x2 = number$3(_); + return rectangle2; + } else { + return x2; + } + }; + rectangle2.y = function(_) { + if (arguments.length) { + y2 = number$3(_); + return rectangle2; + } else { + return y2; + } + }; + rectangle2.width = function(_) { + if (arguments.length) { + width2 = number$3(_); + return rectangle2; + } else { + return width2; + } + }; + rectangle2.height = function(_) { + if (arguments.length) { + height2 = number$3(_); + return rectangle2; + } else { + return height2; + } + }; + rectangle2.cornerRadius = function(tl2, tr2, br2, bl2) { + if (arguments.length) { + crTL = number$3(tl2); + crTR = tr2 != null ? number$3(tr2) : crTL; + crBR = br2 != null ? number$3(br2) : crTL; + crBL = bl2 != null ? number$3(bl2) : crTR; + return rectangle2; + } else { + return crTL; + } + }; + rectangle2.context = function(_) { + if (arguments.length) { + context2 = _ == null ? null : _; + return rectangle2; + } else { + return context2; + } + }; + return rectangle2; + } + function vg_trail() { + var x2, y2, size, defined, context2 = null, ready, x12, y12, r1; + function point2(x22, y22, w2) { + const r2 = w2 / 2; + if (ready) { + var ux = y12 - y22, uy = x22 - x12; + if (ux || uy) { + var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); + context2.moveTo(x12 - rx, y12 - ry); + context2.lineTo(x22 - ux * r2, y22 - uy * r2); + context2.arc(x22, y22, r2, t - Math.PI, t); + context2.lineTo(x12 + rx, y12 + ry); + context2.arc(x12, y12, r1, t, t + Math.PI); + } else { + context2.arc(x22, y22, r2, 0, Tau); + } + context2.closePath(); + } else { + ready = 1; + } + x12 = x22; + y12 = y22; + r1 = r2; + } + function trail2(data2) { + var i, n = data2.length, d2, defined0 = false, buffer; + if (context2 == null) context2 = buffer = path$3(); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d2 = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) ready = 0; + } + if (defined0) point2(+x2(d2, i, data2), +y2(d2, i, data2), +size(d2, i, data2)); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } } - return this._q; -}; -prototype$1.q1 = function(get) { - return this.quartile(get)[0]; -}; -prototype$1.q2 = function(get) { - return this.quartile(get)[1]; -}; -prototype$1.q3 = function(get) { - return this.quartile(get)[2]; -}; -prototype$1.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = (0, _vegaStatistics.bootstrapCI)(this.values(), 1000, 0.05, get); - this._get = get; + trail2.x = function(_) { + if (arguments.length) { + x2 = _; + return trail2; + } else { + return x2; + } + }; + trail2.y = function(_) { + if (arguments.length) { + y2 = _; + return trail2; + } else { + return y2; + } + }; + trail2.size = function(_) { + if (arguments.length) { + size = _; + return trail2; + } else { + return size; + } + }; + trail2.defined = function(_) { + if (arguments.length) { + defined = _; + return trail2; + } else { + return defined; + } + }; + trail2.context = function(_) { + if (arguments.length) { + if (_ == null) { + context2 = null; + } else { + context2 = _; + } + return trail2; + } else { + return context2; + } + }; + return trail2; + } + function value$1(a2, b2) { + return a2 != null ? a2 : b2; + } + const x$2 = (item) => item.x || 0, y$2 = (item) => item.y || 0, w = (item) => item.width || 0, h = (item) => item.height || 0, xw = (item) => (item.x || 0) + (item.width || 0), yh = (item) => (item.y || 0) + (item.height || 0), sa = (item) => item.startAngle || 0, ea = (item) => item.endAngle || 0, pa = (item) => item.padAngle || 0, ir = (item) => item.innerRadius || 0, or = (item) => item.outerRadius || 0, cr = (item) => item.cornerRadius || 0, tl = (item) => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item) => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item) => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item) => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item) => value$1(item.size, 64), ts = (item) => item.size || 1, def = (item) => !(item.defined === false), type = (item) => symbols(item.shape || "circle"); + const arcShape = arc$2$1().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = area$2$1().x(x$2).y1(y$2).y0(yh).defined(def), areahShape = area$2$1().y(y$2).x1(x$2).x0(xw).defined(def), lineShape = line$2$1().x(x$2).y(y$2).defined(def), rectShape = vg_rect().x(x$2).y(y$2).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = Symbol$1().type(type).size(sz), trailShape = vg_trail().x(x$2).y(y$2).defined(def).size(ts); + function hasCornerRadius(item) { + return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; + } + function arc$1(context2, item) { + return arcShape.context(context2)(item); + } + function area$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return (item.orient === "horizontal" ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function line$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return lineShape.curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function rectangle(context2, item, x2, y2) { + return rectShape.context(context2)(item, x2, y2); + } + function shape$1(context2, item) { + return (item.mark.shape || item.shape).context(context2)(item); + } + function symbol$1(context2, item) { + return symbolShape.context(context2)(item); + } + function trail$1(context2, items) { + return trailShape.context(context2)(items); + } + var clip_id = 1; + function resetSVGClipId() { + clip_id = 1; + } + function clip$1$1(renderer, item, size) { + var clip2 = item.clip, defs = renderer._defs, id2 = item.clip_id || (item.clip_id = "clip" + clip_id++), c2 = defs.clipping[id2] || (defs.clipping[id2] = { + id: id2 + }); + if (isFunction(clip2)) { + c2.path = clip2(null); + } else if (hasCornerRadius(size)) { + c2.path = rectangle(null, size, 0, 0); + } else { + c2.width = size.width || 0; + c2.height = size.height || 0; } - return this._ci; -}; -prototype$1.ci0 = function(get) { - return this.ci(get)[0]; -}; -prototype$1.ci1 = function(get) { - return this.ci(get)[1]; -}; -/** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<function(object): *>} [params.fields] - An array of accessors to aggregate. - * @param {Array<string>} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameters for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ function Aggregate(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names -} -Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': { - 'generates': true, - 'changes': true + return "url(#" + id2 + ")"; + } + function Bounds(b2) { + this.clear(); + if (b2) this.union(b2); + } + Bounds.prototype = { + clone() { + return new Bounds(this); }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'drop', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'cross', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Aggregate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const aggr = this, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), mod = _.modified(); - aggr.stamp = out.stamp; - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : Object.create(null); - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - if (pulse.clean() && aggr._drop) out.clean(true).runAfter(()=>this.clean()); - return aggr.changes(out); + clear() { + this.x1 = +Number.MAX_VALUE; + this.y1 = +Number.MAX_VALUE; + this.x2 = -Number.MAX_VALUE; + this.y2 = -Number.MAX_VALUE; + return this; }, - cross () { - const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(()=>({})), n = dims.length; - // collect all group-by domain values - function collect(cells) { - let key, i, t, v; - for(key in cells){ - t = cells[key].tuple; - for(i = 0; i < n; ++i)vals[i][v = t[dims[i]]] = v; - } - } - collect(aggr._prev); - collect(curr); - // iterate over key cross-product, create cells as needed - function generate(base, tuple, index) { - const name = dims[index], v = vals[index++]; - for(const k in v){ - const key = base ? base + '|' + k : k; - tuple[name] = v[k]; - if (index < n) generate(key, tuple, index); - else if (!curr[key]) aggr.cell(key, tuple); - } - } - generate('', {}, 0); + empty() { + return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; }, - init (_) { - // initialize input and output fields - const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; - function inputVisit(get) { - const fields = (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(get)), n = fields.length; - let i = 0, f; - for(; i < n; ++i)if (!inputMap[f = fields[i]]) { - inputMap[f] = 1; - inputs.push(f); - } - } - // initialize group-by dimensions - this._dims = (0, _vegaUtil.array)(_.groupby); - this._dnames = this._dims.map((d)=>{ - const dname = (0, _vegaUtil.accessorName)(d); - inputVisit(d); - outputs.push(dname); - return dname; - }); - this.cellkey = _.key ? _.key : groupkey(this._dims); - // initialize aggregate measures - this._countOnly = true; - this._counts = []; - this._measures = []; - const fields = _.fields || [ - null - ], ops = _.ops || [ - 'count' - ], aggregate_params = _.aggregate_params || [ - null - ], as = _.as || [], n = fields.length, map = {}; - let field, op, aggregate_param, m, mname, outname, i; - if (n !== ops.length) (0, _vegaUtil.error)('Unmatched number of fields and aggregate ops.'); - for(i = 0; i < n; ++i){ - field = fields[i]; - op = ops[i]; - aggregate_param = aggregate_params[i] || null; - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - mname = (0, _vegaUtil.accessorName)(field); - outname = measureName(op, mname, as[i]); - outputs.push(outname); - if (op === 'count') { - this._counts.push(outname); - continue; - } - m = map[mname]; - if (!m) { - inputVisit(field); - m = map[mname] = []; - m.field = field; - this._measures.push(m); - } - if (op !== 'count') this._countOnly = false; - m.push(createMeasure(op, aggregate_param, outname)); - } - this._measures = this._measures.map((m)=>compileMeasures(m, m.field)); - return Object.create(null); // aggregation cells (this.value) + equals(b2) { + return this.x1 === b2.x1 && this.y1 === b2.y1 && this.x2 === b2.x2 && this.y2 === b2.y2; }, - // -- Cell Management ----- - cellkey: groupkey(), - cell (key, t) { - let cell = this.value[key]; - if (!cell) { - cell = this.value[key] = this.newcell(key, t); - this._adds[this._alen++] = cell; - } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._adds[this._alen++] = cell; - } else if (cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._mods[this._mlen++] = cell; - } - return cell; + set(x12, y12, x2, y2) { + if (x2 < x12) { + this.x2 = x12; + this.x1 = x2; + } else { + this.x1 = x12; + this.x2 = x2; + } + if (y2 < y12) { + this.y2 = y12; + this.y1 = y2; + } else { + this.y1 = y12; + this.y2 = y2; + } + return this; }, - newcell (key, t) { - const cell = { - key: key, - num: 0, - agg: null, - tuple: this.newtuple(t, this._prev && this._prev[key]), - stamp: this.stamp, - store: false - }; - if (!this._countOnly) { - const measures = this._measures, n = measures.length; - cell.agg = Array(n); - for(let i = 0; i < n; ++i)cell.agg[i] = new measures[i](cell); - } - if (cell.store) cell.data = new TupleStore(); - return cell; + add(x2, y2) { + if (x2 < this.x1) this.x1 = x2; + if (y2 < this.y1) this.y1 = y2; + if (x2 > this.x2) this.x2 = x2; + if (y2 > this.y2) this.y2 = y2; + return this; }, - newtuple (t, p) { - const names = this._dnames, dims = this._dims, n = dims.length, x = {}; - for(let i = 0; i < n; ++i)x[names[i]] = dims[i](t); - return p ? (0, _vegaDataflow.replace)(p.tuple, x) : (0, _vegaDataflow.ingest)(x); + expand(d2) { + this.x1 -= d2; + this.y1 -= d2; + this.x2 += d2; + this.y2 += d2; + return this; }, - clean () { - const cells = this.value; - for(const key in cells)if (cells[key].num === 0) delete cells[key]; + round() { + this.x1 = Math.floor(this.x1); + this.y1 = Math.floor(this.y1); + this.x2 = Math.ceil(this.x2); + this.y2 = Math.ceil(this.y2); + return this; }, - // -- Process Tuples ----- - add (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num += 1; - if (this._countOnly) return; - if (cell.store) cell.data.add(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].add(agg[i].get(t), t); + scale(s2) { + this.x1 *= s2; + this.y1 *= s2; + this.x2 *= s2; + this.y2 *= s2; + return this; }, - rem (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num -= 1; - if (this._countOnly) return; - if (cell.store) cell.data.rem(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].rem(agg[i].get(t), t); + translate(dx, dy) { + this.x1 += dx; + this.x2 += dx; + this.y1 += dy; + this.y2 += dy; + return this; }, - celltuple (cell) { - const tuple = cell.tuple, counts = this._counts; - // consolidate stored values - if (cell.store) cell.data.values(); - // update tuple properties - for(let i = 0, n = counts.length; i < n; ++i)tuple[counts[i]] = cell.num; - if (!this._countOnly) { - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].set(tuple); - } - return tuple; + rotate(angle2, x2, y2) { + const p = this.rotatedPoints(angle2, x2, y2); + return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); }, - changes (out) { - const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add = out.add, rem = out.rem, mod = out.mod; - let cell, key, i, n; - if (prev) for(key in prev){ - cell = prev[key]; - if (!drop || cell.num) rem.push(cell.tuple); - } - for(i = 0, n = this._alen; i < n; ++i){ - add.push(this.celltuple(adds[i])); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - cell = mods[i]; - (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell)); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - this._prev = null; - return out; - } -}); -// epsilon bias to offset floating point error (#1737) -const EPSILON$1 = 1e-14; -/** - * Generates a binning function for discretizing data. - * @constructor - * @param {object} params - The parameters for this operator. The - * provided values should be valid options for the {@link bin} function. - * @param {function(object): *} params.field - The data field to bin. - */ function Bin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Bin.Definition = { - 'type': 'Bin', - 'metadata': { - 'modifies': true + rotatedPoints(angle2, x2, y2) { + var { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = this, cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), cx = x2 - x2 * cos2 + y2 * sin2, cy = y2 - x2 * sin2 - y2 * cos2; + return [cos2 * x12 - sin2 * y12 + cx, sin2 * x12 + cos2 * y12 + cy, cos2 * x12 - sin2 * y22 + cx, sin2 * x12 + cos2 * y22 + cy, cos2 * x22 - sin2 * y12 + cx, sin2 * x22 + cos2 * y12 + cy, cos2 * x22 - sin2 * y22 + cx, sin2 * x22 + cos2 * y22 + cy]; }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'anchor', - 'type': 'number' - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 20 - }, - { - 'name': 'base', - 'type': 'number', - 'default': 10 - }, - { - 'name': 'divide', - 'type': 'number', - 'array': true, - 'default': [ - 5, - 2 - ] - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'span', - 'type': 'number' - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'steps', - 'type': 'number', - 'array': true - }, - { - 'name': 'minstep', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'name', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'bin0', - 'bin1' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Bin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const band = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || [ - 'bin0', - 'bin1' - ], b0 = as[0], b1 = as[1]; - let flag; - if (_.modified()) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - } else flag = pulse.modified((0, _vegaUtil.accessorFields)(_.field)) ? pulse.ADD_MOD : pulse.ADD; - pulse.visit(flag, band ? (t)=>{ - const v = bins(t); - // minimum bin value (inclusive) - t[b0] = v; - // maximum bin value (exclusive) - // use convoluted math for better floating point agreement - // see https://github.com/vega/vega/issues/830 - // infinite values propagate through this formula! #2227 - t[b1] = v == null ? null : start + step * (1 + (v - start) / step); - } : (t)=>t[b0] = bins(t)); - return pulse.modifies(band ? as : b0); + union(b2) { + if (b2.x1 < this.x1) this.x1 = b2.x1; + if (b2.y1 < this.y1) this.y1 = b2.y1; + if (b2.x2 > this.x2) this.x2 = b2.x2; + if (b2.y2 > this.y2) this.y2 = b2.y2; + return this; }, - _bins (_) { - if (this.value && !_.modified()) return this.value; - const field = _.field, bins = (0, _vegaStatistics.bin)(_), step = bins.step; - let start = bins.start, stop = start + Math.ceil((bins.stop - start) / step) * step, a, d; - if ((a = _.anchor) != null) { - d = a - (start + step * Math.floor((a - start) / step)); - start += d; - stop += d; - } - const f = function(t) { - let v = (0, _vegaUtil.toNumber)(field(t)); - return v == null ? null : v < start ? -Infinity : v > stop ? Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step)); - }; - f.start = start; - f.stop = bins.stop; - f.step = step; - return this.value = (0, _vegaUtil.accessor)(f, (0, _vegaUtil.accessorFields)(field), _.name || 'bin_' + (0, _vegaUtil.accessorName)(field)); - } -}); -function SortedList(idFunc, source, input) { - const $ = idFunc; - let data = source || [], add = input || [], rem = {}, cnt = 0; - return { - add: (t)=>add.push(t), - remove: (t)=>rem[$(t)] = ++cnt, - size: ()=>data.length, - data: (compare, resort)=>{ - if (cnt) { - data = data.filter((t)=>!rem[$(t)]); - rem = {}; - cnt = 0; - } - if (resort && compare) data.sort(compare); - if (add.length) { - data = compare ? (0, _vegaUtil.merge)(compare, data, add.sort(compare)) : data.concat(add); - add = []; - } - return data; - } - }; -} -/** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ function Collect(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Collect.Definition = { - 'type': 'Collect', - 'metadata': { - 'source': true + intersect(b2) { + if (b2.x1 > this.x1) this.x1 = b2.x1; + if (b2.y1 > this.y1) this.y1 = b2.y1; + if (b2.x2 < this.x2) this.x2 = b2.x2; + if (b2.y2 < this.y2) this.y2 = b2.y2; + return this; }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - } - ] -}; -(0, _vegaUtil.inherits)(Collect, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), list = SortedList((0, _vegaDataflow.tupleid), this.value, out.materialize(out.ADD).add), sort = _.sort, mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields)); - out.visit(out.REM, list.remove); - this.modified(mod); - this.value = out.source = list.data((0, _vegaDataflow.stableCompare)(sort), mod); - // propagate tree root if defined - if (pulse.source && pulse.source.root) this.value.root = pulse.source.root; - return out; - } -}); -/** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string|function>} params.fields - The fields to compare. - * @param {Array<string>} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ function Compare(params) { - (0, _vegaDataflow.Operator).call(this, null, update$5, params); -} -(0, _vegaUtil.inherits)(Compare, (0, _vegaDataflow.Operator)); -function update$5(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.compare)(_.fields, _.orders); -} -/** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ function CountPattern(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': { - 'generates': true, - 'changes': true + encloses(b2) { + return b2 && this.x1 <= b2.x1 && this.x2 >= b2.x2 && this.y1 <= b2.y1 && this.y2 >= b2.y2; }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'case', - 'type': 'enum', - 'values': [ - 'upper', - 'lower', - 'mixed' - ], - 'default': 'mixed' - }, - { - 'name': 'pattern', - 'type': 'string', - 'default': '[\\w"]+' - }, - { - 'name': 'stopwords', - 'type': 'string', - 'default': '' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'text', - 'count' - ] - } - ] -}; -function tokenize(text, tcase, match) { - switch(tcase){ - case 'upper': - text = text.toUpperCase(); - break; - case 'lower': - text = text.toLowerCase(); - break; - } - return text.match(match); -} -(0, _vegaUtil.inherits)(CountPattern, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const process = (update)=>(tuple)=>{ - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for(var i = 0, n = tokens.length; i < n; ++i)if (!stop.test(t = tokens[i])) update(t); - }; - const init = this._parameterCheck(_, pulse), counts = this._counts, match = this._match, stop = this._stop, get = _.field, as = _.as || [ - 'text', - 'count' - ], add = process((t)=>counts[t] = 1 + (counts[t] || 0)), rem = process((t)=>counts[t] -= 1); - if (init) pulse.visit(pulse.SOURCE, add); - else { - pulse.visit(pulse.ADD, add); - pulse.visit(pulse.REM, rem); - } - return this._finish(pulse, as); // generate output tuples + alignsWith(b2) { + return b2 && (this.x1 == b2.x1 || this.x2 == b2.x2 || this.y1 == b2.y1 || this.y2 == b2.y2); }, - _parameterCheck (_, pulse) { - let init = false; - if (_.modified('stopwords') || !this._stop) { - this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i'); - init = true; - } - if (_.modified('pattern') || !this._match) { - this._match = new RegExp(_.pattern || '[\\w\']+', 'g'); - init = true; - } - if (_.modified('field') || pulse.modified(_.field.fields)) init = true; - if (init) this._counts = {}; - return init; + intersects(b2) { + return b2 && !(this.x2 < b2.x1 || this.x1 > b2.x2 || this.y2 < b2.y1 || this.y1 > b2.y2); }, - _finish (pulse, as) { - const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text = as[0], count = as[1], out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - let w, t, c; - for(w in counts){ - t = tuples[w]; - c = counts[w] || 0; - if (!t && c) { - tuples[w] = t = (0, _vegaDataflow.ingest)({}); - t[text] = w; - t[count] = c; - out.add.push(t); - } else if (c === 0) { - if (t) out.rem.push(t); - counts[w] = null; - tuples[w] = null; - } else if (t[count] !== c) { - t[count] = c; - out.mod.push(t); - } - } - return out.modifies(as); - } -}); -/** - * Perform a cross-product of a tuple stream with itself. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object):boolean} [params.filter] - An optional filter - * function for selectively including tuples in the cross product. - * @param {Array<string>} [params.as] - The names of the output fields. - */ function Cross(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Cross.Definition = { - 'type': 'Cross', - 'metadata': { - 'generates': true + contains(x2, y2) { + return !(x2 < this.x1 || x2 > this.x2 || y2 < this.y1 || y2 > this.y2); }, - 'params': [ - { - 'name': 'filter', - 'type': 'expr' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'a', - 'b' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Cross, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), as = _.as || [ - 'a', - 'b' - ], a = as[0], b = as[1], reset = !this.value || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter'); - let data = this.value; - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || (0, _vegaUtil.truthy)); - } else out.mod = data; - out.source = this.value; - return out.modifies(as); - } -}); -function cross(input, a, b, filter) { - var data = [], t = {}, n = input.length, i = 0, j, left; - for(; i < n; ++i){ - t[a] = left = input[i]; - for(j = 0; j < n; ++j){ - t[b] = input[j]; - if (filter(t)) { - data.push((0, _vegaDataflow.ingest)(t)); - t = {}; - t[a] = left; - } - } + width() { + return this.x2 - this.x1; + }, + height() { + return this.y2 - this.y1; } - return data; -} -const Distributions = { - kde: (0, _vegaStatistics.randomKDE), - mixture: (0, _vegaStatistics.randomMixture), - normal: (0, _vegaStatistics.randomNormal), - lognormal: (0, _vegaStatistics.randomLogNormal), - uniform: (0, _vegaStatistics.randomUniform) -}; -const DISTRIBUTIONS = 'distributions', FUNCTION = 'function', FIELD = 'field'; -/** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array<object>} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ function parse(def, data) { - const func = def[FUNCTION]; - if (!(0, _vegaUtil.hasOwnProperty)(Distributions, func)) (0, _vegaUtil.error)('Unknown distribution function: ' + func); - const d = Distributions[func](); - for(const name in def){ - // if data field, extract values - if (name === FIELD) d.data((def.from || data()).map(def[name])); - else if (name === DISTRIBUTIONS) d[name](def[name].map((_)=>parse(_, data))); - else if (typeof d[name] === FUNCTION) d[name](def[name]); - } - return d; -} -/** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array<number>} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function Density(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const distributions = [ - { - 'key': { - 'function': 'normal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] + }; + function Item(mark) { + this.mark = mark; + this.bounds = this.bounds || new Bounds(); + } + function GroupItem(mark) { + Item.call(this, mark); + this.items = this.items || []; + } + inherits(GroupItem, Item); + class ResourceLoader { + constructor(customLoader) { + this._pending = 0; + this._loader = customLoader || loader(); + } + pending() { + return this._pending; + } + sanitizeURL(uri) { + const loader2 = this; + increment(loader2); + return loader2._loader.sanitize(uri, { + context: "href" + }).then((opt) => { + decrement(loader2); + return opt; + }).catch(() => { + decrement(loader2); + return null; + }); + } + loadImage(uri) { + const loader2 = this, Image2 = domImage(); + increment(loader2); + return loader2._loader.sanitize(uri, { + context: "image" + }).then((opt) => { + const url = opt.href; + if (!url || !Image2) throw { + url + }; + const img = new Image2(); + const cors = has$1(opt, "crossOrigin") ? opt.crossOrigin : "anonymous"; + if (cors != null) img.crossOrigin = cors; + img.onload = () => decrement(loader2); + img.onerror = () => decrement(loader2); + img.src = url; + return img; + }).catch((e) => { + decrement(loader2); + return { + complete: false, + width: 0, + height: 0, + src: e && e.url || "" + }; + }); + } + ready() { + const loader2 = this; + return new Promise((accept) => { + function poll(value2) { + if (!loader2.pending()) accept(value2); + else setTimeout(() => { + poll(true); + }, 10); + } + poll(false); + }); + } + } + function increment(loader2) { + loader2._pending += 1; + } + function decrement(loader2) { + loader2._pending -= 1; + } + function boundStroke(bounds2, item, miter) { + if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { + const sw = item.strokeWidth != null ? +item.strokeWidth : 1; + bounds2.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); + } + return bounds2; + } + function miterAdjustment(item, strokeWidth) { + return item.strokeJoin && item.strokeJoin !== "miter" ? 0 : strokeWidth; + } + const circleThreshold = Tau - 1e-8; + let bounds, lx, ly, rot, ma, mb, mc, md; + const add$1 = (x2, y2) => bounds.add(x2, y2); + const addL = (x2, y2) => add$1(lx = x2, ly = y2); + const addX = (x2) => add$1(x2, bounds.y1); + const addY = (y2) => add$1(bounds.x1, y2); + const px = (x2, y2) => ma * x2 + mc * y2; + const py = (x2, y2) => mb * x2 + md * y2; + const addp = (x2, y2) => add$1(px(x2, y2), py(x2, y2)); + const addpL = (x2, y2) => addL(px(x2, y2), py(x2, y2)); + function boundContext(_, deg) { + bounds = _; + if (deg) { + rot = deg * DegToRad; + ma = md = Math.cos(rot); + mb = Math.sin(rot); + mc = -mb; + } else { + ma = md = 1; + rot = mb = mc = 0; + } + return context$1; + } + const context$1 = { + beginPath() { }, - { - 'key': { - 'function': 'lognormal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] + closePath() { }, - { - 'key': { - 'function': 'uniform' - }, - 'params': [ - { - 'name': 'min', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'max', - 'type': 'number', - 'default': 1 - } - ] + moveTo: addpL, + lineTo: addpL, + rect(x2, y2, w2, h2) { + if (rot) { + addp(x2 + w2, y2); + addp(x2 + w2, y2 + h2); + addp(x2, y2 + h2); + addpL(x2, y2); + } else { + add$1(x2 + w2, y2 + h2); + addL(x2, y2); + } }, - { - 'key': { - 'function': 'kde' - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'from', - 'type': 'data' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - } - ] - } -]; -const mixture = { - 'key': { - 'function': 'mixture' + quadraticCurveTo(x12, y12, x2, y2) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2); + quadExtrema(lx, px1, px2, addX); + quadExtrema(ly, py1, py2, addY); + addL(px2, py2); }, - 'params': [ - { - 'name': 'distributions', - 'type': 'param', - 'array': true, - 'params': distributions - }, - { - 'name': 'weights', - 'type': 'number', - 'array': true - } - ] -}; -Density.Definition = { - 'type': 'Density', - 'metadata': { - 'generates': true + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); + cubicExtrema(lx, px1, px2, px3, addX); + cubicExtrema(ly, py1, py2, py3, addY); + addL(px3, py3); }, - 'params': [ - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'pdf', - 'values': [ - 'pdf', - 'cdf' - ] - }, - { - 'name': 'distribution', - 'type': 'param', - 'params': distributions.concat(mixture) - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] + arc(cx, cy, r, sa2, ea2, ccw) { + sa2 += rot; + ea2 += rot; + lx = r * Math.cos(ea2) + cx; + ly = r * Math.sin(ea2) + cy; + if (Math.abs(ea2 - sa2) > circleThreshold) { + add$1(cx - r, cy - r); + add$1(cx + r, cy + r); + } else { + const update2 = (a2) => add$1(r * Math.cos(a2) + cx, r * Math.sin(a2) + cy); + let s2, i; + update2(sa2); + update2(ea2); + if (ea2 !== sa2) { + sa2 = sa2 % Tau; + if (sa2 < 0) sa2 += Tau; + ea2 = ea2 % Tau; + if (ea2 < 0) ea2 += Tau; + if (ea2 < sa2) { + ccw = !ccw; + s2 = sa2; + sa2 = ea2; + ea2 = s2; + } + if (ccw) { + ea2 -= Tau; + s2 = sa2 - sa2 % HalfPi; + for (i = 0; i < 4 && s2 > ea2; ++i, s2 -= HalfPi) update2(s2); + } else { + s2 = sa2 - sa2 % HalfPi + HalfPi; + for (i = 0; i < 4 && s2 < ea2; ++i, s2 = s2 + HalfPi) update2(s2); + } } - ] -}; -(0, _vegaUtil.inherits)(Density, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const dist = parse(_.distribution, source(pulse)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - let method = _.method || 'pdf'; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (!_.extent && !dist.data) (0, _vegaUtil.error)('Missing density extent parameter.'); - method = dist[method]; - const as = _.as || [ - 'value', - 'density' - ], domain = _.extent || (0, _vegaUtil.extent)(dist.data()), values = (0, _vegaStatistics.sampleCurve)(method, domain, minsteps, maxsteps).map((v)=>{ - const tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return (0, _vegaDataflow.ingest)(tuple); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + } + } + }; + function quadExtrema(x02, x12, x2, cb) { + const t = (x02 - x12) / (x02 + x2 - 2 * x12); + if (0 < t && t < 1) cb(x02 + (x12 - x02) * t); + } + function cubicExtrema(x02, x12, x2, x3, cb) { + const a2 = x3 - x02 + 3 * x12 - 3 * x2, b2 = x02 + x2 - 2 * x12, c2 = x02 - x12; + let t02 = 0, t12 = 0, r; + if (Math.abs(a2) > Epsilon) { + r = b2 * b2 + c2 * a2; + if (r >= 0) { + r = Math.sqrt(r); + t02 = (-b2 + r) / a2; + t12 = (-b2 - r) / a2; + } + } else { + t02 = 0.5 * c2 / b2; + } + if (0 < t02 && t02 < 1) cb(cubic(t02, x02, x12, x2, x3)); + if (0 < t12 && t12 < 1) cb(cubic(t12, x02, x12, x2, x3)); + } + function cubic(t, x02, x12, x2, x3) { + const s2 = 1 - t, s22 = s2 * s2, t22 = t * t; + return s22 * s2 * x02 + 3 * s22 * t * x12 + 3 * s2 * t22 * x2 + t22 * t * x3; + } + var context$2 = (context$2 = domCanvas(1, 1)) ? context$2.getContext("2d") : null; + const b = new Bounds(); + function intersectPath(draw2) { + return function(item, brush) { + if (!context$2) return true; + draw2(context$2, item); + b.clear().union(item.bounds).intersect(brush).round(); + const { + x1: x12, + y1: y12, + x2, + y2 + } = b; + for (let y3 = y12; y3 <= y2; ++y3) { + for (let x3 = x12; x3 <= x2; ++x3) { + if (context$2.isPointInPath(x3, y3)) { + return true; + } } - return out; + } + return false; + }; + } + function intersectPoint(item, box2) { + return box2.contains(item.x || 0, item.y || 0); + } + function intersectRect(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, w2 = item.width || 0, h2 = item.height || 0; + return box2.intersects(b.set(x2, y2, x2 + w2, y2 + h2)); + } + function intersectRule(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, x22 = item.x2 != null ? item.x2 : x2, y22 = item.y2 != null ? item.y2 : y2; + return intersectBoxLine(box2, x2, y2, x22, y22); + } + function intersectBoxLine(box2, x2, y2, u2, v) { + const { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = box2, dx = u2 - x2, dy = v - y2; + let t02 = 0, t12 = 1, p, q, r, e; + for (e = 0; e < 4; ++e) { + if (e === 0) { + p = -dx; + q = -(x12 - x2); + } + if (e === 1) { + p = dx; + q = x22 - x2; + } + if (e === 2) { + p = -dy; + q = -(y12 - y2); + } + if (e === 3) { + p = dy; + q = y22 - y2; + } + if (Math.abs(p) < 1e-10 && q < 0) return false; + r = q / p; + if (p < 0) { + if (r > t12) return false; + else if (r > t02) t02 = r; + } else if (p > 0) { + if (r < t02) return false; + else if (r < t12) t12 = r; + } + } + return true; + } + function blend(context2, item) { + context2.globalCompositeOperation = item.blend || "source-over"; + } + function value$2(value2, dflt) { + return value2 == null ? dflt : value2; + } + function addStops(gradient2, stops) { + const n = stops.length; + for (let i = 0; i < n; ++i) { + gradient2.addColorStop(stops[i].offset, stops[i].color); + } + return gradient2; + } + function gradient$1(context2, spec, bounds2) { + const w2 = bounds2.width(), h2 = bounds2.height(); + let gradient2; + if (spec.gradient === "radial") { + gradient2 = context2.createRadialGradient(bounds2.x1 + value$2(spec.x1, 0.5) * w2, bounds2.y1 + value$2(spec.y1, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r1, 0), bounds2.x1 + value$2(spec.x2, 0.5) * w2, bounds2.y1 + value$2(spec.y2, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r2, 0.5)); + } else { + const x12 = value$2(spec.x1, 0), y12 = value$2(spec.y1, 0), x2 = value$2(spec.x2, 1), y2 = value$2(spec.y2, 0); + if (x12 === x2 || y12 === y2 || w2 === h2) { + gradient2 = context2.createLinearGradient(bounds2.x1 + x12 * w2, bounds2.y1 + y12 * h2, bounds2.x1 + x2 * w2, bounds2.y1 + y2 * h2); + } else { + const image2 = domCanvas(Math.ceil(w2), Math.ceil(h2)), ictx = image2.getContext("2d"); + ictx.scale(w2, h2); + ictx.fillStyle = addStops(ictx.createLinearGradient(x12, y12, x2, y2), spec.stops); + ictx.fillRect(0, 0, w2, h2); + return context2.createPattern(image2, "no-repeat"); + } + } + return addStops(gradient2, spec.stops); + } + function color$1(context2, item, value2) { + return isGradient(value2) ? gradient$1(context2, value2, item.bounds) : value2; + } + function fill(context2, item, opacity2) { + opacity2 *= item.fillOpacity == null ? 1 : item.fillOpacity; + if (opacity2 > 0) { + context2.globalAlpha = opacity2; + context2.fillStyle = color$1(context2, item, item.fill); + return true; + } else { + return false; + } + } + var Empty = []; + function stroke(context2, item, opacity2) { + var lw = (lw = item.strokeWidth) != null ? lw : 1; + if (lw <= 0) return false; + opacity2 *= item.strokeOpacity == null ? 1 : item.strokeOpacity; + if (opacity2 > 0) { + context2.globalAlpha = opacity2; + context2.strokeStyle = color$1(context2, item, item.stroke); + context2.lineWidth = lw; + context2.lineCap = item.strokeCap || "butt"; + context2.lineJoin = item.strokeJoin || "miter"; + context2.miterLimit = item.strokeMiterLimit || 10; + if (context2.setLineDash) { + context2.setLineDash(item.strokeDash || Empty); + context2.lineDashOffset = item.strokeDashOffset || 0; + } + return true; + } else { + return false; + } + } + function compare(a2, b2) { + return a2.zindex - b2.zindex || a2.index - b2.index; + } + function zorder(scene) { + if (!scene.zdirty) return scene.zitems; + var items = scene.items, output2 = [], item, i, n; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + item.index = i; + if (item.zindex) output2.push(item); + } + scene.zdirty = false; + return scene.zitems = output2.sort(compare); + } + function visit(scene, visitor) { + var items = scene.items, i, n; + if (!items || !items.length) return; + const zitems = zorder(scene); + if (zitems && zitems.length) { + for (i = 0, n = items.length; i < n; ++i) { + if (!items[i].zindex) visitor(items[i]); + } + items = zitems; } -}); -function source(pulse) { - return ()=>pulse.materialize(pulse.SOURCE).source; -} -// use either provided alias or accessor field name -function fieldNames(fields, as) { - if (!fields) return null; - return fields.map((f, i)=>as[i] || (0, _vegaUtil.accessorName)(f)); -} -function partition$1(data, groupby, field) { - const groups = [], get = (f)=>f(t); - let map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data.map(field)); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - g.push(field(t)); + for (i = 0, n = items.length; i < n; ++i) { + visitor(items[i]); } - return groups; -} -const Output = 'bin'; -/** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ function DotBin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -DotBin.Definition = { - 'type': 'DotBin', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': Output - } - ] -}; -const autostep = (data, field)=>(0, _vegaUtil.span)((0, _vegaUtil.extent)(data, field)) / 30; -(0, _vegaUtil.inherits)(DotBin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) return pulse; // early exit - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(pulse.source, _.groupby, (0, _vegaUtil.identity)), smooth = _.smooth || false, field = _.field, step = _.step || autostep(source, field), sort = (0, _vegaDataflow.stableCompare)((a, b)=>field(a) - field(b)), as = _.as || Output, n = groups.length; - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for(; i < n; ++i){ - const g = groups[i].sort(sort); - j = -1; - for (const v of (0, _vegaStatistics.dotbin)(g, step, smooth, field)){ - if (v < min) min = v; - if (v > max) max = v; - g[++j][as] = v; - } + } + function pickVisit(scene, visitor) { + var items = scene.items, hit2, i; + if (!items || !items.length) return null; + const zitems = zorder(scene); + if (zitems && zitems.length) items = zitems; + for (i = items.length; --i >= 0; ) { + if (hit2 = visitor(items[i])) return hit2; + } + if (items === zitems) { + for (items = scene.items, i = items.length; --i >= 0; ) { + if (!items[i].zindex) { + if (hit2 = visitor(items[i])) return hit2; } - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - } -}); -/** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ function Expression(params) { - (0, _vegaDataflow.Operator).call(this, null, update$4, params); - this.modified(true); -} -(0, _vegaUtil.inherits)(Expression, (0, _vegaDataflow.Operator)); -function update$4(_) { - const expr = _.expr; - return this.value && !_.modified('expr') ? this.value : (0, _vegaUtil.accessor)((datum)=>expr(datum, _), (0, _vegaUtil.accessorFields)(expr), (0, _vegaUtil.accessorName)(expr)); -} -/** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ function Extent(params) { - (0, _vegaDataflow.Transform).call(this, [ - undefined, - undefined - ], params); -} -Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true + } + } + return null; + } + function drawAll(path2) { + return function(context2, scene, bounds2) { + visit(scene, (item) => { + if (!bounds2 || bounds2.intersects(item.bounds)) { + drawPath(path2, context2, item, item); } - ] -}; -(0, _vegaUtil.inherits)(Extent, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const extent = this.value, field = _.field, mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field'); - let min = extent[0], max = extent[1]; - if (mod || min == null) { - min = Infinity; - max = -Infinity; - } - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, (t)=>{ - const v = (0, _vegaUtil.toNumber)(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = (0, _vegaUtil.accessorName)(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [ - min, - max - ]; + }); + }; + } + function drawOne(path2) { + return function(context2, scene, bounds2) { + if (scene.items.length && (!bounds2 || bounds2.intersects(scene.bounds))) { + drawPath(path2, context2, scene.items[0], scene.items); + } + }; + } + function drawPath(path2, context2, item, items) { + var opacity2 = item.opacity == null ? 1 : item.opacity; + if (opacity2 === 0) return; + if (path2(context2, items)) return; + blend(context2, item); + if (item.fill && fill(context2, item, opacity2)) { + context2.fill(); } -}); -/** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ function Subflow(pulse, parent) { - (0, _vegaDataflow.Operator).call(this, pulse); - this.parent = parent; - this.count = 0; -} -(0, _vegaUtil.inherits)(Subflow, (0, _vegaDataflow.Operator), { - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ connect (target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return target.source = this; - }, - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ add (t) { - this.count += 1; - this.value.add.push(t); - }, - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ rem (t) { - this.count -= 1; - this.value.rem.push(t); - }, - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ mod (t) { - this.value.mod.push(t); - }, - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ init (pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }, - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ evaluate () { - // assert: this.value.stamp === pulse.stamp - return this.value; + if (item.stroke && stroke(context2, item, opacity2)) { + context2.stroke(); } -}); -/** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ function Facet(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._keys = (0, _vegaUtil.fastmap)(); // cache previously calculated key values - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = (f)=>{ - for(let i = 0, n = a.active; i < n; ++i)f(a[i], i, a); - }; -} -(0, _vegaUtil.inherits)(Facet, (0, _vegaDataflow.Transform), { - activate (flow) { - this._targets[this._targets.active++] = flow; - }, - // parent argument provided by PreFacet subclass - subflow (key, flow, pulse, parent) { - const flows = this.value; - let sf = (0, _vegaUtil.hasOwnProperty)(flows, key) && flows[key], df, p; - if (!sf) { - p = parent || (p = this._group[key]) && p.tuple; - df = pulse.dataflow; - sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this); - df.add(sf).connect(flow(df, key, p)); - flows[key] = sf; - this.activate(sf); - } else if (sf.value.stamp < pulse.stamp) { - sf.init(pulse); - this.activate(sf); - } - return sf; - }, - clean () { - const flows = this.value; - let detached = 0; - for(const key in flows)if (flows[key].count === 0) { - const detach = flows[key].detachSubflow; - if (detach) detach(); - delete flows[key]; - ++detached; - } - // remove inactive targets from the active targets array - if (detached) { - const active = this._targets.filter((sf)=>sf && sf.count > 0); - this.initTargets(active); - } - }, - initTargets (act) { - const a = this._targets, n = a.length, m = act ? act.length : 0; - let i = 0; - for(; i < m; ++i)a[i] = act[i]; - for(; i < n && a[i] != null; ++i)a[i] = null; // ensure old flows can be garbage collected - a.active = m; - }, - transform (_, pulse) { - const df = pulse.dataflow, key = _.key, flow = _.subflow, cache = this._keys, rekey = _.modified('key'), subflow = (key)=>this.subflow(key, flow, pulse); - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - cache.set((0, _vegaDataflow.tupleid)(t), k); - subflow(k).add(t); - }); - if (rekey || pulse.modified(key.fields)) pulse.visit(pulse.MOD, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 === k1) subflow(k1).mod(t); - else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - else if (pulse.changed(pulse.MOD)) pulse.visit(pulse.MOD, (t)=>{ - subflow(cache.get((0, _vegaDataflow.tupleid)(t))).mod(t); - }); - if (rekey) pulse.visit(pulse.REFLOW, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - if (pulse.clean()) df.runAfter(()=>{ - this.clean(); - cache.clean(); - }); - else if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return pulse; - } -}); -/** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ function Field(params) { - (0, _vegaDataflow.Operator).call(this, null, update$3, params); -} -(0, _vegaUtil.inherits)(Field, (0, _vegaDataflow.Operator)); -function update$3(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.isArray)(_.name) ? (0, _vegaUtil.array)(_.name).map((f)=>(0, _vegaUtil.field)(f)) : (0, _vegaUtil.field)(_.name, _.as); -} -/** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ function Filter(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -Filter.Definition = { - 'type': 'Filter', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Filter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), add = output.add, rem = output.rem, mod = output.mod, test = _.expr; - let isMod = true; - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - pulse.visit(pulse.ADD, (t)=>{ - if (test(t, _)) add.push(t); - else cache.set((0, _vegaDataflow.tupleid)(t), 1); - }); - function revisit(t) { - const id = (0, _vegaDataflow.tupleid)(t), b = test(t, _), s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) mod.push(t); - } - pulse.visit(pulse.MOD, revisit); - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - } -}); -/** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array<string>} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ function Flatten(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Flatten.Definition = { - 'type': 'Flatten', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'index', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true + } + function pick$1(test2) { + test2 = test2 || truthy; + return function(context2, scene, x2, y2, gx, gy) { + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return pickVisit(scene, (item) => { + const b2 = item.bounds; + if (b2 && !b2.contains(gx, gy) || !b2) return; + if (test2(context2, item, x2, y2, gx, gy)) return item; + }); + }; + } + function hitPath(path2, filled) { + return function(context2, o, x2, y2) { + var item = Array.isArray(o) ? o[0] : o, fill2 = filled == null ? item.fill : filled, stroke2 = item.stroke && context2.isPointInStroke, lw, lc; + if (stroke2) { + lw = item.strokeWidth; + lc = item.strokeCap; + context2.lineWidth = lw != null ? lw : 1; + context2.lineCap = lc != null ? lc : "butt"; + } + return path2(context2, o) ? false : fill2 && context2.isPointInPath(x2, y2) || stroke2 && context2.isPointInStroke(x2, y2); + }; + } + function pickPath(path2) { + return pick$1(hitPath(path2)); + } + function translate$1(x2, y2) { + return "translate(" + x2 + "," + y2 + ")"; + } + function rotate(a2) { + return "rotate(" + a2 + ")"; + } + function scale$3(scaleX, scaleY2) { + return "scale(" + scaleX + "," + scaleY2 + ")"; + } + function translateItem(item) { + return translate$1(item.x || 0, item.y || 0); + } + function rotateItem(item) { + return translate$1(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : ""); + } + function transformItem(item) { + return translate$1(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : "") + (item.scaleX || item.scaleY ? " " + scale$3(item.scaleX || 1, item.scaleY || 1) : ""); + } + function markItemPath(type2, shape2, isect) { + function attr2(emit2, item) { + emit2("transform", rotateItem(item)); + emit2("d", shape2(null, item)); + } + function bound2(bounds2, item) { + shape2(boundContext(bounds2, item.angle), item); + return boundStroke(bounds2, item).translate(item.x || 0, item.y || 0); + } + function draw2(context2, item) { + var x2 = item.x || 0, y2 = item.y || 0, a2 = item.angle || 0; + context2.translate(x2, y2); + if (a2) context2.rotate(a2 *= DegToRad); + context2.beginPath(); + shape2(context2, item); + if (a2) context2.rotate(-a2); + context2.translate(-x2, -y2); + } + return { + type: type2, + tag: "path", + nested: false, + attr: attr2, + bound: bound2, + draw: drawAll(draw2), + pick: pickPath(draw2), + isect: isect || intersectPath(draw2) + }; + } + var arc$2 = markItemPath("arc", arc$1); + function pickArea(a2, p) { + var v = a2[0].orient === "horizontal" ? p[1] : p[0], z2 = a2[0].orient === "horizontal" ? "y" : "x", i = a2.length, min2 = Infinity, hit2, d2; + while (--i >= 0) { + if (a2[i].defined === false) continue; + d2 = Math.abs(a2[i][z2] - v); + if (d2 < min2) { + min2 = d2; + hit2 = a2[i]; + } + } + return hit2; + } + function pickLine(a2, p) { + var t = Math.pow(a2[0].strokeWidth || 1, 2), i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + if (dd < t) return a2[i]; + } + return null; + } + function pickTrail(a2, p) { + var i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + dx = a2[i].size || 1; + if (dd < dx * dx) return a2[i]; + } + return null; + } + function markMultiItemPath(type2, shape2, tip) { + function attr2(emit2, item) { + var items = item.mark.items; + if (items.length) emit2("d", shape2(null, items)); + } + function bound2(bounds2, mark) { + var items = mark.items; + if (items.length === 0) { + return bounds2; + } else { + shape2(boundContext(bounds2), items); + return boundStroke(bounds2, items[0]); + } + } + function draw2(context2, items) { + context2.beginPath(); + shape2(context2, items); + } + const hit2 = hitPath(draw2); + function pick2(context2, scene, x2, y2, gx, gy) { + var items = scene.items, b2 = scene.bounds; + if (!items || !items.length || b2 && !b2.contains(gx, gy)) { + return null; + } + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return hit2(context2, items, x2, y2) ? items[0] : null; + } + return { + type: type2, + tag: "path", + nested: true, + attr: attr2, + bound: bound2, + draw: drawOne(draw2), + pick: pick2, + isect: intersectPoint, + tip + }; + } + var area$2 = markMultiItemPath("area", area$1, pickArea); + function clip$2(context2, scene) { + var clip2 = scene.clip; + context2.save(); + if (isFunction(clip2)) { + context2.beginPath(); + clip2(context2); + context2.clip(); + } else { + clipGroup(context2, scene.group); + } + } + function clipGroup(context2, group2) { + context2.beginPath(); + hasCornerRadius(group2) ? rectangle(context2, group2, 0, 0) : context2.rect(0, 0, group2.width || 0, group2.height || 0); + context2.clip(); + } + function offset$1(item) { + const sw = value$2(item.strokeWidth, 1); + return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; + } + function attr$5(emit2, item) { + emit2("transform", translateItem(item)); + } + function emitRectangle(emit2, item) { + const off = offset$1(item); + emit2("d", rectangle(null, item, off, off)); + } + function background$1(emit2, item) { + emit2("class", "background"); + emit2("aria-hidden", true); + emitRectangle(emit2, item); + } + function foreground(emit2, item) { + emit2("class", "foreground"); + emit2("aria-hidden", true); + if (item.strokeForeground) { + emitRectangle(emit2, item); + } else { + emit2("d", ""); + } + } + function content(emit2, item, renderer) { + const url = item.clip ? clip$1$1(renderer, item, item) : null; + emit2("clip-path", url); + } + function bound$5(bounds2, group2) { + if (!group2.clip && group2.items) { + const items = group2.items, m2 = items.length; + for (let j = 0; j < m2; ++j) { + bounds2.union(items[j].bounds); + } + } + if ((group2.clip || group2.width || group2.height) && !group2.noBound) { + bounds2.add(0, 0).add(group2.width || 0, group2.height || 0); + } + boundStroke(bounds2, group2); + return bounds2.translate(group2.x || 0, group2.y || 0); + } + function rectanglePath(context2, group2, x2, y2) { + const off = offset$1(group2); + context2.beginPath(); + rectangle(context2, group2, (x2 || 0) + off, (y2 || 0) + off); + } + const hitBackground = hitPath(rectanglePath); + const hitForeground = hitPath(rectanglePath, false); + const hitCorner = hitPath(rectanglePath, true); + function draw$4(context2, scene, bounds2, markTypes) { + visit(scene, (group2) => { + const gx = group2.x || 0, gy = group2.y || 0, fore = group2.strokeForeground, opacity2 = group2.opacity == null ? 1 : group2.opacity; + if ((group2.stroke || group2.fill) && opacity2) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (group2.fill && fill(context2, group2, opacity2)) { + context2.fill(); + } + if (group2.stroke && !fore && stroke(context2, group2, opacity2)) { + context2.stroke(); } - ] -}; -(0, _vegaUtil.inherits)(Flatten, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index = _.index || null, m = as.length; - // remove any previous results - out.rem = this.value; - // generate flattened tuples - pulse.visit(pulse.SOURCE, (t)=>{ - const arrays = fields.map((f)=>f(t)), maxlen = arrays.reduce((l, a)=>Math.max(l, a.length), 0); - let i = 0, j, d, v; - for(; i < maxlen; ++i){ - d = (0, _vegaDataflow.derive)(t); - for(j = 0; j < m; ++j)d[as[j]] = (v = arrays[j][i]) == null ? null : v; - if (index) d[index] = i; - out.add.push(d); - } - }); - this.value = out.source = out.add; - if (index) out.modifies(index); - return out.modifies(as); - } -}); -/** - * Folds one more tuple fields into multiple tuples in which the field - * name and values are available under new 'key' and 'value' fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.fields - An array of field accessors - * for the tuple fields that should be folded. - * @param {Array<string>} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ function Fold(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Fold.Definition = { - 'type': 'Fold', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'key', - 'value' - ] + } + context2.save(); + context2.translate(gx, gy); + if (group2.clip) clipGroup(context2, group2); + if (bounds2) bounds2.translate(-gx, -gy); + visit(group2, (item) => { + if (item.marktype === "group" || markTypes == null || markTypes.includes(item.marktype)) { + this.draw(context2, item, bounds2, markTypes); } - ] -}; -(0, _vegaUtil.inherits)(Fold, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, fnames = fields.map((0, _vegaUtil.accessorName)), as = _.as || [ - 'key', - 'value' - ], k = as[0], v = as[1], n = fields.length; - out.rem = this.value; - pulse.visit(pulse.SOURCE, (t)=>{ - for(let i = 0, d; i < n; ++i){ - d = (0, _vegaDataflow.derive)(t); - d[k] = fnames[i]; - d[v] = fields[i](t); - out.add.push(d); - } - }); - this.value = out.source = out.add; - return out.modifies(as); - } -}); -/** - * Invokes a function for each data tuple and saves the results as a new field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The formula function to invoke for each tuple. - * @param {string} params.as - The field name under which to save the result. - * @param {boolean} [params.initonly=false] - If true, the formula is applied to - * added tuples only, and does not update in response to modifications. - */ function Formula(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Formula.Definition = { - 'type': 'Formula', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'required': true - }, - { - 'name': 'initonly', - 'type': 'boolean' + }); + if (bounds2) bounds2.translate(gx, gy); + context2.restore(); + if (fore && group2.stroke && opacity2) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (stroke(context2, group2, opacity2)) { + context2.stroke(); } - ] -}; -(0, _vegaUtil.inherits)(Formula, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const func = _.expr, as = _.as, mod = _.modified(), flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD; - if (mod) // parameters updated, need to reflow - pulse = pulse.materialize().reflow(true); - if (!_.initonly) pulse.modifies(as); - return pulse.visit(flag, (t)=>t[as] = func(t, _)); - } -}); -/** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ function Generate(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(Generate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), gen = _.generator; - let data = this.value, num = _.size - data.length, add, rem, t; - if (num > 0) { - // need more tuples, generate and add - for(add = []; --num >= 0;){ - add.push(t = (0, _vegaDataflow.ingest)(gen(_))); - data.push(t); - } - out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem; - data = data.slice(-num); + } + }); + } + function pick(context2, scene, x2, y2, gx, gy) { + if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { + return null; + } + const cx = x2 * context2.pixelRatio, cy = y2 * context2.pixelRatio; + return pickVisit(scene, (group2) => { + let hit2, dx, dy; + const b2 = group2.bounds; + if (b2 && !b2.contains(gx, gy)) return; + dx = group2.x || 0; + dy = group2.y || 0; + const dw = dx + (group2.width || 0), dh = dy + (group2.height || 0), c2 = group2.clip; + if (c2 && (gx < dx || gx > dw || gy < dy || gy > dh)) return; + context2.save(); + context2.translate(dx, dy); + dx = gx - dx; + dy = gy - dy; + if (c2 && hasCornerRadius(group2) && !hitCorner(context2, group2, cx, cy)) { + context2.restore(); + return null; + } + const fore = group2.strokeForeground, ix = scene.interactive !== false; + if (ix && fore && group2.stroke && hitForeground(context2, group2, cx, cy)) { + context2.restore(); + return group2; + } + hit2 = pickVisit(group2, (mark) => pickMark(mark, dx, dy) ? this.pick(mark, x2, y2, dx, dy) : null); + if (!hit2 && ix && (group2.fill || !fore && group2.stroke) && hitBackground(context2, group2, cx, cy)) { + hit2 = group2; + } + context2.restore(); + return hit2 || null; + }); + } + function pickMark(mark, x2, y2) { + return (mark.interactive !== false || mark.marktype === "group") && mark.bounds && mark.bounds.contains(x2, y2); + } + var group = { + type: "group", + tag: "g", + nested: false, + attr: attr$5, + bound: bound$5, + draw: draw$4, + pick, + isect: intersectRect, + content, + background: background$1, + foreground + }; + var metadata = { + "xmlns": "http://www.w3.org/2000/svg", + "xmlns:xlink": "http://www.w3.org/1999/xlink", + "version": "1.1" + }; + function getImage(item, renderer) { + var image2 = item.image; + if (!image2 || item.url && item.url !== image2.url) { + image2 = { + complete: false, + width: 0, + height: 0 + }; + renderer.loadImage(item.url).then((image3) => { + item.image = image3; + item.image.url = item.url; + }); + } + return image2; + } + function imageWidth(item, image2) { + return item.width != null ? item.width : !image2 || !image2.width ? 0 : item.aspect !== false && item.height ? item.height * image2.width / image2.height : image2.width; + } + function imageHeight(item, image2) { + return item.height != null ? item.height : !image2 || !image2.height ? 0 : item.aspect !== false && item.width ? item.width * image2.height / image2.width : image2.height; + } + function imageXOffset(align, w2) { + return align === "center" ? w2 / 2 : align === "right" ? w2 : 0; + } + function imageYOffset(baseline2, h2) { + return baseline2 === "middle" ? h2 / 2 : baseline2 === "bottom" ? h2 : 0; + } + function attr$4(emit2, item, renderer) { + const img = getImage(item, renderer), w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ""; + emit2("href", i, metadata["xmlns:xlink"], "xlink:href"); + emit2("transform", translate$1(x2, y2)); + emit2("width", w2); + emit2("height", h2); + emit2("preserveAspectRatio", item.aspect === false ? "none" : "xMidYMid"); + } + function bound$4(bounds2, item) { + const img = item.image, w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2); + return bounds2.set(x2, y2, x2 + w2, y2 + h2); + } + function draw$3(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + const img = getImage(item, this); + let w2 = imageWidth(item, img); + let h2 = imageHeight(item, img); + if (w2 === 0 || h2 === 0) return; + let x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), opacity2, ar0, ar1, t; + if (item.aspect !== false) { + ar0 = img.width / img.height; + ar1 = item.width / item.height; + if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { + if (ar1 < ar0) { + t = w2 / ar0; + y2 += (h2 - t) / 2; + h2 = t; + } else { + t = h2 * ar0; + x2 += (w2 - t) / 2; + w2 = t; + } } - out.source = this.value = data; - return out; + } + if (img.complete || img.toDataURL) { + blend(context2, item); + context2.globalAlpha = (opacity2 = item.opacity) != null ? opacity2 : 1; + context2.imageSmoothingEnabled = item.smooth !== false; + context2.drawImage(img, x2, y2, w2, h2); + } + }); + } + var image = { + type: "image", + tag: "image", + nested: false, + attr: attr$4, + bound: bound$4, + draw: draw$3, + pick: pick$1(), + isect: truthy, + // bounds check is sufficient + get: getImage, + xOffset: imageXOffset, + yOffset: imageYOffset + }; + var line$2 = markMultiItemPath("line", line$1, pickLine); + function attr$3(emit2, item) { + var sx = item.scaleX || 1, sy = item.scaleY || 1; + if (sx !== 1 || sy !== 1) { + emit2("vector-effect", "non-scaling-stroke"); + } + emit2("transform", transformItem(item)); + emit2("d", item.path); + } + function path$1(context2, item) { + var path2 = item.path; + if (path2 == null) return true; + var x2 = item.x || 0, y2 = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a2 = (item.angle || 0) * DegToRad, cache2 = item.pathCache; + if (!cache2 || cache2.path !== path2) { + (item.pathCache = cache2 = parse$3(path2)).path = path2; + } + if (a2 && context2.rotate && context2.translate) { + context2.translate(x2, y2); + context2.rotate(a2); + pathRender(context2, cache2, 0, 0, sx, sy); + context2.rotate(-a2); + context2.translate(-x2, -y2); + } else { + pathRender(context2, cache2, x2, y2, sx, sy); + } + } + function bound$3(bounds2, item) { + return path$1(boundContext(bounds2, item.angle), item) ? bounds2.set(0, 0, 0, 0) : boundStroke(bounds2, item, true); + } + var path$2 = { + type: "path", + tag: "path", + nested: false, + attr: attr$3, + bound: bound$3, + draw: drawAll(path$1), + pick: pickPath(path$1), + isect: intersectPath(path$1) + }; + function attr$2(emit2, item) { + emit2("d", rectangle(null, item)); + } + function bound$2(bounds2, item) { + var x2, y2; + return boundStroke(bounds2.set(x2 = item.x || 0, y2 = item.y || 0, x2 + item.width || 0, y2 + item.height || 0), item); + } + function draw$2(context2, item) { + context2.beginPath(); + rectangle(context2, item); + } + var rect = { + type: "rect", + tag: "path", + nested: false, + attr: attr$2, + bound: bound$2, + draw: drawAll(draw$2), + pick: pickPath(draw$2), + isect: intersectRect + }; + function attr$1(emit2, item) { + emit2("transform", translateItem(item)); + emit2("x2", item.x2 != null ? item.x2 - (item.x || 0) : 0); + emit2("y2", item.y2 != null ? item.y2 - (item.y || 0) : 0); + } + function bound$1(bounds2, item) { + var x12, y12; + return boundStroke(bounds2.set(x12 = item.x || 0, y12 = item.y || 0, item.x2 != null ? item.x2 : x12, item.y2 != null ? item.y2 : y12), item); + } + function path(context2, item, opacity2) { + var x12, y12, x2, y2; + if (item.stroke && stroke(context2, item, opacity2)) { + x12 = item.x || 0; + y12 = item.y || 0; + x2 = item.x2 != null ? item.x2 : x12; + y2 = item.y2 != null ? item.y2 : y12; + context2.beginPath(); + context2.moveTo(x12, y12); + context2.lineTo(x2, y2); + return true; + } + return false; + } + function draw$1(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + var opacity2 = item.opacity == null ? 1 : item.opacity; + if (opacity2 && path(context2, item, opacity2)) { + blend(context2, item); + context2.stroke(); + } + }); + } + function hit$1(context2, item, x2, y2) { + if (!context2.isPointInStroke) return false; + return path(context2, item, 1) && context2.isPointInStroke(x2, y2); + } + var rule$1 = { + type: "rule", + tag: "line", + nested: false, + attr: attr$1, + bound: bound$1, + draw: draw$1, + pick: pick$1(hit$1), + isect: intersectRule + }; + var shape = markItemPath("shape", shape$1); + var symbol = markItemPath("symbol", symbol$1, intersectPoint); + const widthCache = lruCache(); + var textMetrics = { + height: fontSize, + measureWidth, + estimateWidth, + width: estimateWidth, + canvas: useCanvas + }; + useCanvas(true); + function useCanvas(use2) { + textMetrics.width = use2 && context$2 ? measureWidth : estimateWidth; + } + function estimateWidth(item, text2) { + return _estimateWidth(textValue(item, text2), fontSize(item)); + } + function _estimateWidth(text2, currentFontHeight) { + return ~~(0.8 * text2.length * currentFontHeight); + } + function measureWidth(item, text2) { + return fontSize(item) <= 0 || !(text2 = textValue(item, text2)) ? 0 : _measureWidth(text2, font(item)); + } + function _measureWidth(text2, currentFont) { + const key2 = `(${currentFont}) ${text2}`; + let width2 = widthCache.get(key2); + if (width2 === void 0) { + context$2.font = currentFont; + width2 = context$2.measureText(text2).width; + widthCache.set(key2, width2); + } + return width2; + } + function fontSize(item) { + return item.fontSize != null ? +item.fontSize || 0 : 11; + } + function lineHeight(item) { + return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; + } + function lineArray(_) { + return isArray(_) ? _.length > 1 ? _ : _[0] : _; + } + function textLines(item) { + return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text); + } + function multiLineOffset(item) { + const tl2 = textLines(item); + return (isArray(tl2) ? tl2.length - 1 : 0) * lineHeight(item); + } + function textValue(item, line2) { + const text2 = line2 == null ? "" : (line2 + "").trim(); + return item.limit > 0 && text2.length ? truncate(item, text2) : text2; + } + function widthGetter(item) { + if (textMetrics.width === measureWidth) { + const currentFont = font(item); + return (text2) => _measureWidth(text2, currentFont); + } else if (textMetrics.width === estimateWidth) { + const currentFontHeight = fontSize(item); + return (text2) => _estimateWidth(text2, currentFontHeight); + } else { + return (text2) => textMetrics.width(item, text2); } -}); -const Methods = { - value: 'value', - median: (0, _d3Array.median), - mean: (0, _d3Array.mean), - min: (0, _d3Array.min), - max: (0, _d3Array.max) -}; -const Empty = []; -/** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array<function(object): *>} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ function Impute(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Impute.Definition = { - 'type': 'Impute', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'keyvals', - 'array': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'value', - 'values': [ - 'value', - 'mean', - 'median', - 'max', - 'min' - ] - }, - { - 'name': 'value', - 'default': 0 - } - ] -}; -function getValue(_) { - var m = _.method || Methods.value, v; - if (Methods[m] == null) (0, _vegaUtil.error)('Unrecognized imputation method: ' + m); - else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return ()=>v; - } else return Methods[m]; -} -function getField(_) { - const f = _.field; - return (t)=>t ? f(t) : NaN; -} -(0, _vegaUtil.inherits)(Impute, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), impute = getValue(_), field = getField(_), fName = (0, _vegaUtil.accessorName)(_.field), kName = (0, _vegaUtil.accessorName)(_.key), gNames = (_.groupby || []).map((0, _vegaUtil.accessorName)), groups = partition(pulse.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m = groups.domain.length, group, value, gVals, kVal, g, i, j, l, n, t; - for(g = 0, l = groups.length; g < l; ++g){ - group = groups[g]; - gVals = group.values; - value = NaN; - // add tuples for missing values - for(j = 0; j < m; ++j){ - if (group[j] != null) continue; - kVal = groups.domain[j]; - t = { - _impute: true - }; - for(i = 0, n = gVals.length; i < n; ++i)t[gNames[i]] = gVals[i]; - t[kName] = kVal; - t[fName] = Number.isNaN(value) ? value = impute(group, field) : value; - curr.push((0, _vegaDataflow.ingest)(t)); - } - } - // update pulse with imputed tuples - if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); - if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); - this.value = curr; - return out; + } + function truncate(item, text2) { + var limit = +item.limit, width2 = widthGetter(item); + if (width2(text2) < limit) return text2; + var ellipsis = item.ellipsis || "…", rtl = item.dir === "rtl", lo = 0, hi = text2.length, mid; + limit -= width2(ellipsis); + if (rtl) { + while (lo < hi) { + mid = lo + hi >>> 1; + if (width2(text2.slice(mid)) > limit) lo = mid + 1; + else hi = mid; + } + return ellipsis + text2.slice(lo); + } else { + while (lo < hi) { + mid = 1 + (lo + hi >>> 1); + if (width2(text2.slice(0, mid)) < limit) lo = mid; + else hi = mid - 1; + } + return text2.slice(0, lo) + ellipsis; } -}); -function partition(data, groupby, key, keyvals) { - var get = (f)=>f(t), groups = [], domain = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group, i, j, k, n, t; - domain.forEach((k, i)=>kMap[k] = i + 1); - for(i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = key(t); - j = kMap[k] || (kMap[k] = domain.push(k)); - gKey = (gVals = groupby ? groupby.map(get) : Empty) + ''; - if (!(group = gMap[gKey])) { - group = gMap[gKey] = []; - groups.push(group); - group.values = gVals; - } - group[j - 1] = t; - } - groups.domain = domain; - return groups; -} -/** - * Extend input tuples with aggregate values. - * Calcuates aggregate values and joins them with the input stream. - * @constructor - */ function JoinAggregate(params) { - Aggregate.call(this, params); -} -JoinAggregate.Definition = { - 'type': 'JoinAggregate', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(JoinAggregate, Aggregate, { - transform (_, pulse) { - const aggr = this, mod = _.modified(); - let cells; - // process all input tuples to calculate aggregates - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - cells = aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - cells = aggr.value = aggr.value || this.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // update aggregation cells - aggr.changes(); - // write aggregate values to input tuples - pulse.visit(pulse.SOURCE, (t)=>{ - (0, _vegaUtil.extend)(t, cells[aggr.cellkey(t)].tuple); - }); - return pulse.reflow(mod).modifies(this._outputs); - }, - changes () { - const adds = this._adds, mods = this._mods; - let i, n; - for(i = 0, n = this._alen; i < n; ++i){ - this.celltuple(adds[i]); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - this.celltuple(mods[i]); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - } -}); -/** - * Compute kernel density estimates (KDE) for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array<number>} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function KDE(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE.Definition = { - 'type': 'KDE', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'cumulative', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] - } - ] -}; -(0, _vegaUtil.inherits)(KDE, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), bandwidth = _.bandwidth, method = _.cumulative ? 'cdf' : 'pdf', as = _.as || [ - 'value', - 'density' - ], values = []; - let domain = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (_.resolve === 'shared') { - if (!domain) domain = (0, _vegaUtil.extent)(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - groups.forEach((g)=>{ - const density = (0, _vegaStatistics.randomKDE)(g, bandwidth)[method], scale = _.counts ? g.length : 1, local = domain || (0, _vegaUtil.extent)(g); - (0, _vegaStatistics.sampleCurve)(density, local, minsteps, maxsteps).forEach((v)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = v[0]; - t[as[1]] = v[1] * scale; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - return out; + } + function fontFamily(item, quote) { + var font2 = item.font; + return (quote && font2 ? String(font2).replace(/"/g, "'") : font2) || "sans-serif"; + } + function font(item, quote) { + return (item.fontStyle ? item.fontStyle + " " : "") + (item.fontVariant ? item.fontVariant + " " : "") + (item.fontWeight ? item.fontWeight + " " : "") + fontSize(item) + "px " + fontFamily(item, quote); + } + function offset$2(item) { + var baseline2 = item.baseline, h2 = fontSize(item); + return Math.round(baseline2 === "top" ? 0.79 * h2 : baseline2 === "middle" ? 0.3 * h2 : baseline2 === "bottom" ? -0.21 * h2 : baseline2 === "line-top" ? 0.29 * h2 + 0.5 * lineHeight(item) : baseline2 === "line-bottom" ? 0.29 * h2 - 0.5 * lineHeight(item) : 0); + } + const textAlign = { + "left": "start", + "center": "middle", + "right": "end" + }; + const tempBounds$1 = new Bounds(); + function anchorPoint(item) { + var x2 = item.x || 0, y2 = item.y || 0, r = item.radius || 0, t; + if (r) { + t = (item.theta || 0) - HalfPi; + x2 += r * Math.cos(t); + y2 += r * Math.sin(t); } -}); -/** - * Generates a key function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string>} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ function Key(params) { - (0, _vegaDataflow.Operator).call(this, null, update$2, params); -} -(0, _vegaUtil.inherits)(Key, (0, _vegaDataflow.Operator)); -function update$2(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.key)(_.fields, _.flat); -} -/** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ function Load(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this._pending = null; -} -(0, _vegaUtil.inherits)(Load, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow; - if (this._pending) // update state and return pulse - return output(this, pulse, this._pending); - if (stop(_)) return pulse.StopPropagation; - if (_.values) // parse and ingest values, return output pulse - return output(this, pulse, df.parse(_.values, _.format)); - else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then((res)=>{ - this._pending = (0, _vegaUtil.array)(res.data); - return (df)=>df.touch(this); - }); - return { - async: p - }; - } else // return promise for synchronous loading - return df.request(_.url, _.format).then((res)=>output(this, pulse, (0, _vegaUtil.array)(res.data))); - } -}); -function stop(_) { - return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format')); -} -function output(op, pulse, data) { - data.forEach((0, _vegaDataflow.ingest)); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; -} -/** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array<function(object): *} params.fields - The fields to lookup. - * @param {Array<string>} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ function Lookup(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -Lookup.Definition = { - 'type': 'Lookup', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'index', - 'type': 'index', - 'params': [ - { - 'name': 'from', - 'type': 'data', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - } - ] - }, - { - 'name': 'values', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - }, - { - 'name': 'default', - 'default': null - } - ] -}; -(0, _vegaUtil.inherits)(Lookup, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const keys = _.fields, index = _.index, values = _.values, defaultValue = _.default == null ? null : _.default, reset = _.modified(), n = keys.length; - let flag = reset ? pulse.SOURCE : pulse.ADD, out = pulse, as = _.as, set, m, mods; - if (values) { - m = values.length; - if (n > 1 && !as) (0, _vegaUtil.error)('Multi-field lookup requires explicit "as" parameter.'); - if (as && as.length !== n * m) (0, _vegaUtil.error)('The "as" parameter has too few output field names.'); - as = as || values.map((0, _vegaUtil.accessorName)); - set = function(t) { - for(var i = 0, k = 0, j, v; i < n; ++i){ - v = index.get(keys[i](t)); - if (v == null) for(j = 0; j < m; ++j, ++k)t[as[k]] = defaultValue; - else for(j = 0; j < m; ++j, ++k)t[as[k]] = values[j](v); - } - }; - } else { - if (!as) (0, _vegaUtil.error)('Missing output field names.'); - set = function(t) { - for(var i = 0, v; i < n; ++i){ - v = index.get(keys[i](t)); - t[as[i]] = v == null ? defaultValue : v; - } - }; - } - if (reset) out = pulse.reflow(true); - else { - mods = keys.some((k)=>pulse.modified(k.fields)); - flag |= mods ? pulse.MOD : 0; - } - pulse.visit(flag, set); - return out.modifies(as); - } -}); -/** - * Computes global min/max extents over a collection of extents. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<number>>} params.extents - The input extents. - */ function MultiExtent(params) { - (0, _vegaDataflow.Operator).call(this, null, update$1, params); -} -(0, _vegaUtil.inherits)(MultiExtent, (0, _vegaDataflow.Operator)); -function update$1(_) { - if (this.value && !_.modified()) return this.value; - const ext = _.extents, n = ext.length; - let min = Infinity, max = -Infinity, i, e; - for(i = 0; i < n; ++i){ - e = ext[i]; - if (e[0] < min) min = e[0]; - if (e[1] > max) max = e[1]; + tempBounds$1.x1 = x2; + tempBounds$1.y1 = y2; + return tempBounds$1; + } + function attr(emit2, item) { + var dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item), p = anchorPoint(item), x2 = p.x1, y2 = p.y1, a2 = item.angle || 0, t; + emit2("text-anchor", textAlign[item.align] || "start"); + if (a2) { + t = translate$1(x2, y2) + " " + rotate(a2); + if (dx || dy) t += " " + translate$1(dx, dy); + } else { + t = translate$1(x2 + dx, y2 + dy); } - return [ - min, - max - ]; -} -/** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<*>>} params.values - The input value arrrays. - */ function MultiValues(params) { - (0, _vegaDataflow.Operator).call(this, null, update, params); -} -(0, _vegaUtil.inherits)(MultiValues, (0, _vegaDataflow.Operator)); -function update(_) { - return this.value && !_.modified() ? this.value : _.values.reduce((data, _)=>data.concat(_), []); -} -/** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Params(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Params, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - } -}); -/** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ function Pivot(params) { - Aggregate.call(this, params); -} -Pivot.Definition = { - 'type': 'Pivot', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'value', - 'type': 'field', - 'required': true - }, - { - 'name': 'op', - 'type': 'enum', - 'values': ValidAggregateOps, - 'default': 'sum' - }, - { - 'name': 'limit', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Pivot, Aggregate, { - _transform: Aggregate.prototype.transform, - transform (_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - } -}); -// Shoehorn a pivot transform into an aggregate transform! -// First collect all unique pivot field values. -// Then generate aggregate fields for each output pivot field. -function aggregateParams(_, pulse) { - const key = _.field, value = _.value, op = (_.op === 'count' ? '__count__' : _.op) || 'sum', fields = (0, _vegaUtil.accessorFields)(key).concat((0, _vegaUtil.accessorFields)(value)), keys = pivotKeys(key, _.limit || 0, pulse); - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); - return { - key: _.key, - groupby: _.groupby, - ops: keys.map(()=>op), - fields: keys.map((k)=>get(k, key, value, fields)), - as: keys.map((k)=>k + ''), - modified: _.modified.bind(_) - }; -} -// Generate aggregate field accessor. -// Output NaN for non-existent values; aggregator will ignore! -function get(k, key, value, fields) { - return (0, _vegaUtil.accessor)((d)=>key(d) === k ? value(d) : NaN, fields, k + ''); -} -// Collect (and optionally limit) all unique pivot values. -function pivotKeys(key, limit, pulse) { - const map = {}, list = []; - pulse.visit(pulse.SOURCE, (t)=>{ - const k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); + emit2("transform", t); + } + function bound(bounds2, item, mode) { + var h2 = textMetrics.height(item), a2 = item.align, p = anchorPoint(item), x2 = p.x1, y2 = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h2), tl2 = textLines(item), w2; + if (isArray(tl2)) { + h2 += lineHeight(item) * (tl2.length - 1); + w2 = tl2.reduce((w3, t) => Math.max(w3, textMetrics.width(item, t)), 0); + } else { + w2 = textMetrics.width(item, tl2); + } + if (a2 === "center") { + dx -= w2 / 2; + } else if (a2 === "right") { + dx -= w2; + } else ; + bounds2.set(dx += x2, dy += y2, dx + w2, dy + h2); + if (item.angle && !mode) { + bounds2.rotate(item.angle * DegToRad, x2, y2); + } else if (mode === 2) { + return bounds2.rotatedPoints(item.angle * DegToRad, x2, y2); + } + return bounds2; + } + function draw$5(context2, scene, bounds2) { + visit(scene, (item) => { + var opacity2 = item.opacity == null ? 1 : item.opacity, p, x2, y2, i, lh, tl2, str; + if (bounds2 && !bounds2.intersects(item.bounds) || // bounds check + opacity2 === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; + context2.font = font(item); + context2.textAlign = item.align || "left"; + p = anchorPoint(item); + x2 = p.x1, y2 = p.y1; + if (item.angle) { + context2.save(); + context2.translate(x2, y2); + context2.rotate(item.angle * DegToRad); + x2 = y2 = 0; + } + x2 += item.dx || 0; + y2 += (item.dy || 0) + offset$2(item); + tl2 = textLines(item); + blend(context2, item); + if (isArray(tl2)) { + lh = lineHeight(item); + for (i = 0; i < tl2.length; ++i) { + str = textValue(item, tl2[i]); + if (item.fill && fill(context2, item, opacity2)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity2)) { + context2.strokeText(str, x2, y2); + } + y2 += lh; + } + } else { + str = textValue(item, tl2); + if (item.fill && fill(context2, item, opacity2)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity2)) { + context2.strokeText(str, x2, y2); } + } + if (item.angle) context2.restore(); }); - list.sort((0, _vegaUtil.ascending)); - return limit ? list.slice(0, limit) : list; -} -/** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array<object>} params.field - The field - * accessor for an array of subflow tuple objects. - */ function PreFacet(params) { - Facet.call(this, params); -} -(0, _vegaUtil.inherits)(PreFacet, Facet, { - transform (_, pulse) { - const flow = _.subflow, field = _.field, subflow = (t)=>this.subflow((0, _vegaDataflow.tupleid)(t), flow, pulse, t); - if (_.modified('field') || field && pulse.modified((0, _vegaUtil.accessorFields)(field))) (0, _vegaUtil.error)('PreFacet does not support field modification.'); - this.initTargets(); // reset list of active subflows - if (field) { - pulse.visit(pulse.MOD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.mod(_)); - }); - pulse.visit(pulse.ADD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.add((0, _vegaDataflow.ingest)(_))); - }); - pulse.visit(pulse.REM, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, (t)=>subflow(t).mod(t)); - pulse.visit(pulse.ADD, (t)=>subflow(t).add(t)); - pulse.visit(pulse.REM, (t)=>subflow(t).rem(t)); - } - if (pulse.clean()) pulse.runAfter(()=>this.clean()); - return pulse; - } -}); -/** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *} params.fields - The fields to project, - * as an array of field accessors. If unspecified, all fields will be - * copied with names unchanged. - * @param {Array<string>} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ function Project(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Project.Definition = { - 'type': 'Project', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Project, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive = fields ? (s, t)=>project(s, t, fields, as) : (0, _vegaDataflow.rederive); - let lut; - if (this.value) lut = this.value; - else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = derive(t, (0, _vegaDataflow.ingest)({})); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - out.mod.push(derive(t, lut[(0, _vegaDataflow.tupleid)(t)])); - }); - return out; + } + function hit(context2, item, x2, y2, gx, gy) { + if (item.fontSize <= 0) return false; + if (!item.angle) return true; + var p = anchorPoint(item), ax = p.x1, ay = p.y1, b2 = bound(tempBounds$1, item, 1), a2 = -item.angle * DegToRad, cos2 = Math.cos(a2), sin2 = Math.sin(a2), px2 = cos2 * gx - sin2 * gy + (ax - cos2 * ax + sin2 * ay), py2 = sin2 * gx + cos2 * gy + (ay - sin2 * ax - cos2 * ay); + return b2.contains(px2, py2); + } + function intersectText(item, box2) { + const p = bound(tempBounds$1, item, 2); + return intersectBoxLine(box2, p[0], p[1], p[2], p[3]) || intersectBoxLine(box2, p[0], p[1], p[4], p[5]) || intersectBoxLine(box2, p[4], p[5], p[6], p[7]) || intersectBoxLine(box2, p[2], p[3], p[6], p[7]); + } + var text = { + type: "text", + tag: "text", + nested: false, + attr, + bound, + draw: draw$5, + pick: pick$1(hit), + isect: intersectText + }; + var trail = markMultiItemPath("trail", trail$1, pickTrail); + var Marks = { + arc: arc$2, + area: area$2, + group, + image, + line: line$2, + path: path$2, + rect, + rule: rule$1, + shape, + symbol, + text, + trail + }; + function boundItem$1(item, func, opt) { + var type2 = Marks[item.mark.marktype], bound2 = func || type2.bound; + if (type2.nested) item = item.mark; + return bound2(item.bounds || (item.bounds = new Bounds()), item, opt); + } + var DUMMY = { + mark: null + }; + function boundMark(mark, bounds2, opt) { + var type2 = Marks[mark.marktype], bound2 = type2.bound, items = mark.items, hasItems = items && items.length, i, n, item, b2; + if (type2.nested) { + if (hasItems) { + item = items[0]; + } else { + DUMMY.mark = mark; + item = DUMMY; + } + b2 = boundItem$1(item, bound2, opt); + bounds2 = bounds2 && bounds2.union(b2) || b2; + return bounds2; + } + bounds2 = bounds2 || mark.bounds && mark.bounds.clear() || new Bounds(); + if (hasItems) { + for (i = 0, n = items.length; i < n; ++i) { + bounds2.union(boundItem$1(items[i], bound2, opt)); + } } -}); -function project(s, t, fields, as) { - for(let i = 0, n = fields.length; i < n; ++i)t[as[i]] = fields[i](s); - return t; -} -/** - * Proxy the value of another operator as a pure signal value. - * Ensures no tuples are propagated. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {*} params.value - The value to proxy, becomes the value of this operator. - */ function Proxy(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Proxy, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = _.value; - return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Generates sample quantile values from an input data stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the data field - * over which to calculate quantile values. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {Array<number>} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array<number>} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ function Quantile(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Quantile.Definition = { - 'type': 'Quantile', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'probs', - 'type': 'number', - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 0.01 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'prob', - 'value' - ] - } - ] -}; -const EPSILON = 1e-14; -(0, _vegaUtil.inherits)(Quantile, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), as = _.as || [ - 'prob', - 'value' - ]; - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), values = [], step = _.step || 0.01, p = _.probs || (0, _d3Array.range)(step / 2, 1 - EPSILON, step), n = p.length; - groups.forEach((g)=>{ - const q = (0, _vegaStatistics.quantiles)(g, p); - for(let i = 0; i < n; ++i){ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[i]; - t[as[1]] = q[i]; - values.push((0, _vegaDataflow.ingest)(t)); - } + return mark.bounds = bounds2; + } + const keys$1 = [ + "marktype", + "name", + "role", + "interactive", + "clip", + "items", + "zindex", + "x", + "y", + "width", + "height", + "align", + "baseline", + // layout + "fill", + "fillOpacity", + "opacity", + "blend", + // fill + "stroke", + "strokeOpacity", + "strokeWidth", + "strokeCap", + // stroke + "strokeDash", + "strokeDashOffset", + // stroke dash + "strokeForeground", + "strokeOffset", + // group + "startAngle", + "endAngle", + "innerRadius", + "outerRadius", + // arc + "cornerRadius", + "padAngle", + // arc, rect + "cornerRadiusTopLeft", + "cornerRadiusTopRight", + // rect, group + "cornerRadiusBottomLeft", + "cornerRadiusBottomRight", + "interpolate", + "tension", + "orient", + "defined", + // area, line + "url", + "aspect", + "smooth", + // image + "path", + "scaleX", + "scaleY", + // path + "x2", + "y2", + // rule + "size", + "shape", + // symbol + "text", + "angle", + "theta", + "radius", + "dir", + "dx", + "dy", + // text + "ellipsis", + "limit", + "lineBreak", + "lineHeight", + "font", + "fontSize", + "fontWeight", + "fontStyle", + "fontVariant", + // font + "description", + "aria", + "ariaRole", + "ariaRoleDescription" + // aria + ]; + function sceneToJSON(scene, indent) { + return JSON.stringify(scene, keys$1, indent); + } + function sceneFromJSON(json2) { + const scene = typeof json2 === "string" ? JSON.parse(json2) : json2; + return initialize$1(scene); + } + function initialize$1(scene) { + var type2 = scene.marktype, items = scene.items, parent, i, n; + if (items) { + for (i = 0, n = items.length; i < n; ++i) { + parent = type2 ? "mark" : "group"; + items[i][parent] = scene; + if (items[i].zindex) items[i][parent].zdirty = true; + if ("group" === (type2 || parent)) initialize$1(items[i]); + } + } + if (type2) boundMark(scene); + return scene; + } + class Scenegraph { + constructor(scene) { + if (arguments.length) { + this.root = sceneFromJSON(scene); + } else { + this.root = createMark({ + marktype: "group", + name: "root", + role: "frame" }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - return out; + this.root.items = [new GroupItem(this.root)]; + } + } + toJSON(indent) { + return sceneToJSON(this.root, indent || 0); + } + mark(markdef, group2, index2) { + group2 = group2 || this.root.items[0]; + const mark = createMark(markdef, group2); + group2.items[index2] = mark; + if (mark.zindex) mark.group.zdirty = true; + return mark; + } + } + function createMark(def2, group2) { + const mark = { + bounds: new Bounds(), + clip: !!def2.clip, + group: group2, + interactive: def2.interactive === false ? false : true, + items: [], + marktype: def2.marktype, + name: def2.name || void 0, + role: def2.role || void 0, + zindex: def2.zindex || 0 + }; + if (def2.aria != null) { + mark.aria = def2.aria; + } + if (def2.description) { + mark.description = def2.description; + } + return mark; + } + function domCreate(doc, tag, ns) { + if (!doc && typeof document !== "undefined" && document.createElement) { + doc = document; + } + return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; + } + function domFind(el, tag) { + tag = tag.toLowerCase(); + var nodes = el.childNodes, i = 0, n = nodes.length; + for (; i < n; ++i) if (nodes[i].tagName.toLowerCase() === tag) { + return nodes[i]; + } + } + function domChild(el, index2, tag, ns) { + var a2 = el.childNodes[index2], b2; + if (!a2 || a2.tagName.toLowerCase() !== tag.toLowerCase()) { + b2 = a2 || null; + a2 = domCreate(el.ownerDocument, tag, ns); + el.insertBefore(a2, b2); + } + return a2; + } + function domClear(el, index2) { + var nodes = el.childNodes, curr = nodes.length; + while (curr > index2) el.removeChild(nodes[--curr]); + return el; + } + function cssClass(mark) { + return "mark-" + mark.marktype + (mark.role ? " role-" + mark.role : "") + (mark.name ? " " + mark.name : ""); + } + function point(event2, el) { + const rect2 = el.getBoundingClientRect(); + return [event2.clientX - rect2.left - (el.clientLeft || 0), event2.clientY - rect2.top - (el.clientTop || 0)]; + } + function resolveItem(item, event2, el, origin) { + var mark = item && item.mark, mdef, p; + if (mark && (mdef = Marks[mark.marktype]).tip) { + p = point(event2, el); + p[0] -= origin[0]; + p[1] -= origin[1]; + while (item = item.mark.group) { + p[0] -= item.x || 0; + p[1] -= item.y || 0; + } + item = mdef.tip(mark.items, p); + } + return item; + } + class Handler { + /** + * Create a new Handler instance. + * @param {object} [customLoader] - Optional loader instance for + * href URL sanitization. If not specified, a standard loader + * instance will be generated. + * @param {function} [customTooltip] - Optional tooltip handler + * function for custom tooltip display. + * @constructor + */ + constructor(customLoader, customTooltip) { + this._active = null; + this._handlers = {}; + this._loader = customLoader || loader(); + this._tooltip = customTooltip || defaultTooltip$1; + } + /** + * Initialize a new Handler instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {object} [obj] - Optional context object that should serve as + * the "this" context for event callbacks. + * @return {Handler} - This handler instance. + */ + initialize(el, origin, obj2) { + this._el = el; + this._obj = obj2 || null; + return this.origin(origin); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the origin coordinates of the visualization. + */ + origin(origin) { + if (arguments.length) { + this._origin = origin || [0, 0]; + return this; + } else { + return this._origin.slice(); + } } -}); -/** - * Relays a data stream between data processing pipelines. - * If the derive parameter is set, this transform will create derived - * copies of observed tuples. This provides derived data streams in which - * modifications to the tuples do not pollute an upstream data source. - * @param {object} params - The parameters for this operator. - * @param {number} [params.derive=false] - Boolean flag indicating if - * the transform should make derived copies of incoming tuples. - * @constructor - */ function Relay(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Relay, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let out, lut; - if (this.value) lut = this.value; - else { - out = pulse = pulse.addAll(); - lut = this.value = {}; - } - if (_.derive) { - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = (0, _vegaDataflow.derive)(t); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - const dt = lut[(0, _vegaDataflow.tupleid)(t)]; - for(const k in t){ - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); - } - return out; + /** + * Get / set the scenegraph root. + */ + scene(scene) { + if (!arguments.length) return this._scene; + this._scene = scene; + return this; } -}); -/** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ function Sample(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.count = 0; -} -Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'default': 1000 - } - ] -}; -(0, _vegaUtil.inherits)(Sample, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), mod = _.modified('size'), num = _.size, map = this.value.reduce((m, t)=>(m[(0, _vegaDataflow.tupleid)(t)] = 1, m), {}); - let res = this.value, cnt = this.count, cap = 0; - // sample reservoir update function - function update(t) { - let p, idx; - if (res.length < num) res.push(t); - else { - idx = ~~((cnt + 1) * (0, _vegaStatistics.random)()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[(0, _vegaDataflow.tupleid)(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - // filter removed tuples out of the sample reservoir - res = res.filter((t)=>map[(0, _vegaDataflow.tupleid)(t)] !== -1); - } - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, (t)=>{ - // update, but skip previously sampled tuples - if (!map[(0, _vegaDataflow.tupleid)(t)]) update(t); - }); - cap = -1; - } - if (mod && res.length > num) { - const n = res.length - num; - for(let i = 0; i < n; ++i){ - map[(0, _vegaDataflow.tupleid)(res[i])] = -1; - out.rem.push(res[i]); - } - res = res.slice(n); - } - if (pulse.mod.length) // propagate modified tuples in the sample reservoir - pulse.visit(pulse.MOD, (t)=>{ - if (map[(0, _vegaDataflow.tupleid)(t)]) out.mod.push(t); - }); - if (pulse.add.length) // update sample reservoir - pulse.visit(pulse.ADD, update); - if (pulse.add.length || cap < 0) // output newly added tuples - out.add = res.filter((t)=>!map[(0, _vegaDataflow.tupleid)(t)]); - this.count = cnt; - this.value = out.source = res; - return out; + /** + * Add an event handler. Subclasses should override this method. + */ + on() { } -}); -/** - * Generates data tuples for a specified sequence range of numbers. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} params.start - The first number in the sequence. - * @param {number} params.stop - The last number (exclusive) in the sequence. - * @param {number} [params.step=1] - The step size between numbers in the sequence. - */ function Sequence(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Sequence.Definition = { - 'type': 'Sequence', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'start', - 'type': 'number', - 'required': true - }, - { - 'name': 'stop', - 'type': 'number', - 'required': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'data' + /** + * Remove an event handler. Subclasses should override this method. + */ + off() { + } + /** + * Utility method for finding the array index of an event handler. + * @param {Array} h - An array of registered event handlers. + * @param {string} type - The event type. + * @param {function} handler - The event handler instance to find. + * @return {number} - The handler's array index or -1 if not registered. + */ + _handlerIndex(h2, type2, handler) { + for (let i = h2 ? h2.length : 0; --i >= 0; ) { + if (h2[i].type === type2 && (!handler || h2[i].handler === handler)) { + return i; } - ] -}; -(0, _vegaUtil.inherits)(Sequence, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return; - const out = pulse.materialize().fork(pulse.MOD), as = _.as || 'data'; - out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem; - this.value = (0, _d3Array.range)(_.start, _.stop, _.step || 1).map((v)=>{ - const t = {}; - t[as] = v; - return (0, _vegaDataflow.ingest)(t); - }); - out.add = pulse.add.concat(this.value); - return out; + } + return -1; } -}); -/** - * Propagates a new pulse without any tuples so long as the input - * pulse contains some added, removed or modified tuples. - * @param {object} params - The parameters for this operator. - * @constructor - */ function Sieve(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Sieve, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = pulse.source; - return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Discretize dates to specific time units. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The data field containing date/time values. - */ function TimeUnit(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const OUTPUT = [ - 'unit0', - 'unit1' -]; -TimeUnit.Definition = { - 'type': 'TimeUnit', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'units', - 'type': 'enum', - 'values': (0, _vegaTime.TIME_UNITS), - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 40 - }, - { - 'name': 'extent', - 'type': 'date', - 'array': true - }, - { - 'name': 'timezone', - 'type': 'enum', - 'default': 'local', - 'values': [ - 'local', - 'utc' - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': OUTPUT + /** + * Returns an array with registered event handlers. + * @param {string} [type] - The event type to query. Any annotations + * are ignored; for example, for the argument "click.foo", ".foo" will + * be ignored and the method returns all "click" handlers. If type is + * null or unspecified, this method returns handlers for all types. + * @return {Array} - A new array containing all registered event handlers. + */ + handlers(type2) { + const h2 = this._handlers, a2 = []; + if (type2) { + a2.push(...h2[this.eventName(type2)]); + } else { + for (const k in h2) { + a2.push(...h2[k]); } - ] -}; -(0, _vegaUtil.inherits)(TimeUnit, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const field = _.field, band = _.interval !== false, utc = _.timezone === 'utc', floor = this._floor(_, pulse), offset = (utc ? (0, _vegaTime.utcInterval) : (0, _vegaTime.timeInterval))(floor.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor.step; - let min = floor.start || Infinity, max = floor.stop || -Infinity, flag = pulse.ADD; - if (_.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(field))) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - min = Infinity; - max = -Infinity; - } - pulse.visit(flag, (t)=>{ - const v = field(t); - let a, b; - if (v == null) { - t[u0] = null; - if (band) t[u1] = null; - } else { - t[u0] = a = b = floor(v); - if (band) t[u1] = b = offset(a, step); - if (a < min) min = a; - if (b > max) max = b; - } - }); - floor.start = min; - floor.stop = max; - return pulse.modifies(band ? as : u0); - }, - _floor (_, pulse) { - const utc = _.timezone === 'utc'; - // get parameters - const { units, step } = _.units ? { - units: _.units, - step: _.step || 1 - } : (0, _vegaTime.timeBin)({ - extent: _.extent || (0, _vegaUtil.extent)(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins + } + return a2; + } + /** + * Parses an event name string to return the specific event type. + * For example, given "click.foo" returns "click" + * @param {string} name - The input event type string. + * @return {string} - A string with the event type only. + */ + eventName(name) { + const i = name.indexOf("."); + return i < 0 ? name : name.slice(0, i); + } + /** + * Handle hyperlink navigation in response to an item.href value. + * @param {Event} event - The event triggering hyperlink navigation. + * @param {Item} item - The scenegraph item. + * @param {string} href - The URL to navigate to. + */ + handleHref(event2, item, href2) { + this._loader.sanitize(href2, { + context: "href" + }).then((opt) => { + const e = new MouseEvent(event2.type, event2), a2 = domCreate(null, "a"); + for (const name in opt) a2.setAttribute(name, opt[name]); + a2.dispatchEvent(e); + }).catch(() => { + }); + } + /** + * Handle tooltip display in response to an item.tooltip value. + * @param {Event} event - The event triggering tooltip display. + * @param {Item} item - The scenegraph item. + * @param {boolean} show - A boolean flag indicating whether + * to show or hide a tooltip for the given item. + */ + handleTooltip(event2, item, show) { + if (item && item.tooltip != null) { + item = resolveItem(item, event2, this.canvas(), this._origin); + const value2 = show && item && item.tooltip || null; + this._tooltip.call(this._obj, this, event2, item, value2); + } + } + /** + * Returns the size of a scenegraph item and its position relative + * to the viewport. + * @param {Item} item - The scenegraph item. + * @return {object} - A bounding box object (compatible with the + * DOMRect type) consisting of x, y, width, heigh, top, left, + * right, and bottom properties. + */ + getItemBoundingClientRect(item) { + const el = this.canvas(); + if (!el) return; + const rect2 = el.getBoundingClientRect(), origin = this._origin, bounds2 = item.bounds, width2 = bounds2.width(), height2 = bounds2.height(); + let x2 = bounds2.x1 + origin[0] + rect2.left, y2 = bounds2.y1 + origin[1] + rect2.top; + while (item.mark && (item = item.mark.group)) { + x2 += item.x || 0; + y2 += item.y || 0; + } + return { + x: x2, + y: y2, + width: width2, + height: height2, + left: x2, + top: y2, + right: x2 + width2, + bottom: y2 + height2 + }; + } + } + function defaultTooltip$1(handler, event2, item, value2) { + handler.element().setAttribute("title", value2 || ""); + } + class Renderer { + /** + * Create a new Renderer instance. + * @param {object} [loader] - Optional loader instance for + * image and href URL sanitization. If not specified, a + * standard loader instance will be generated. + * @constructor + */ + constructor(loader2) { + this._el = null; + this._bgcolor = null; + this._loader = new ResourceLoader(loader2); + } + /** + * Initialize a new Renderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._el = el; + return this.resize(width2, height2, origin, scaleFactor); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length === 0) return this._bgcolor; + this._bgcolor = bgcolor; + return this; + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + this._width = width2; + this._height = height2; + this._origin = origin || [0, 0]; + this._scale = scaleFactor || 1; + return this; + } + /** + * Report a dirty item whose bounds should be redrawn. + * This base class method does nothing. Subclasses that perform + * incremental should implement this method. + * @param {Item} item - The dirty item whose bounds should be redrawn. + */ + dirty() { + } + /** + * Render an input scenegraph, potentially with a set of dirty items. + * This method will perform an immediate rendering with available resources. + * The renderer may also need to perform image loading to perform a complete + * render. This process can lead to asynchronous re-rendering of the scene + * after this method returns. To receive notification when rendering is + * complete, use the renderAsync method instead. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Renderer} - This renderer instance. + */ + render(scene, markTypes) { + const r = this; + r._call = function() { + r._render(scene, markTypes); + }; + r._call(); + r._call = null; + return r; + } + /** + * Internal rendering method. Renderer subclasses should override this + * method to actually perform rendering. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render() { + } + /** + * Asynchronous rendering method. Similar to render, but returns a Promise + * that resolves when all rendering is completed. Sometimes a renderer must + * perform image loading to get a complete rendering. The returned + * Promise will not resolve until this process completes. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Promise} - A Promise that resolves when rendering is complete. + */ + renderAsync(scene, markTypes) { + const r = this.render(scene, markTypes); + return this._ready ? this._ready.then(() => r) : Promise.resolve(r); + } + /** + * Internal method for asynchronous resource loading. + * Proxies method calls to the ImageLoader, and tracks loading + * progress to invoke a re-render once complete. + * @param {string} method - The method name to invoke on the ImageLoader. + * @param {string} uri - The URI for the requested resource. + * @return {Promise} - A Promise that resolves to the requested resource. + */ + _load(method2, uri) { + var r = this, p = r._loader[method2](uri); + if (!r._ready) { + const call = r._call; + r._ready = r._loader.ready().then((redraw) => { + if (redraw) call(); + r._ready = null; }); - // check / standardize time units - const tunits = (0, _vegaTime.timeUnits)(units), prev = this.value || {}, floor = (utc ? (0, _vegaTime.utcFloor) : (0, _vegaTime.timeFloor))(tunits, step); - floor.unit = (0, _vegaUtil.peek)(tunits); - floor.units = tunits; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - } -}); -/** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ function TupleIndex(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -(0, _vegaUtil.inherits)(TupleIndex, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, field = _.field, index = this.value, set = (t)=>index.set(field(t), t); - let mod = true; - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, (t)=>index.delete(field(t))); - pulse.visit(pulse.ADD, set); - } else mod = false; - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - } -}); -/** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ function Values(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Values, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields); - if (run) this.value = (_.sort ? pulse.source.slice().sort((0, _vegaDataflow.stableCompare)(_.sort)) : pulse.source).map(_.field); - } -}); -function WindowOp(op, field, param, as) { - const fn = WindowOps[op](field, param); - return { - init: fn.init || (0, _vegaUtil.zero), - update: function(w, t) { - t[as] = fn.next(w); - } - }; -} -const WindowOps = { - row_number: function() { - return { - next: (w)=>w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: ()=>rank = 1, - next: (w)=>{ - const i = w.index, data = w.data; - return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: ()=>drank = 1, - next: (w)=>{ - const i = w.index, d = w.data; - return i && w.compare(d[i - 1], d[i]) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - const rank = WindowOps.rank(), next = rank.next; - return { - init: rank.init, - next: (w)=>(next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: ()=>cume = 0, - next: (w)=>{ - const d = w.data, c = w.compare; - let i = w.index; - if (cume < i) { - while(i + 1 < d.length && !c(d[i], d[i + 1]))++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) (0, _vegaUtil.error)('ntile num must be greater than zero.'); - const cume = WindowOps.cume_dist(), next = cume.next; - return { - init: cume.init, - next: (w)=>Math.ceil(num * next(w)) - }; - }, - lag: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index + offset, d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - first_value: function(field) { - return { - next: (w)=>field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: (w)=>field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) (0, _vegaUtil.error)('nth_value nth must be greater than zero.'); - return { - next: (w)=>{ - const i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - prev_value: function(field) { - let prev; - return { - init: ()=>prev = null, - next: (w)=>{ - const v = field(w.data[w.index]); - return v != null ? prev = v : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: ()=>(v = null, i = -1), - next: (w)=>{ - const d = w.data; - return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]); - } - }; + } + return p; } -}; -function find(field, data, index) { - for(let n = data.length; index < n; ++index){ - const v = field(data[index]); - if (v != null) return index; + /** + * Sanitize a URL to include as a hyperlink in the rendered scene. + * This method proxies a call to ImageLoader.sanitizeURL, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string to sanitize. + * @return {Promise} - A Promise that resolves to the sanitized URL. + */ + sanitizeURL(uri) { + return this._load("sanitizeURL", uri); } - return -1; -} -const ValidWindowOps = Object.keys(WindowOps); -function WindowState(_) { - const ops = (0, _vegaUtil.array)(_.ops), fields = (0, _vegaUtil.array)(_.fields), params = (0, _vegaUtil.array)(_.params), aggregate_params = (0, _vegaUtil.array)(_.aggregate_params), as = (0, _vegaUtil.array)(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map = {}, counts = [], measures = []; - let countOnly = true; - function visitInputs(f) { - (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(f)).forEach((_)=>inputs[_] = 1); + /** + * Requests an image to include in the rendered scene. + * This method proxies a call to ImageLoader.loadImage, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string of the image. + * @return {Promise} - A Promise that resolves to the loaded Image. + */ + loadImage(uri) { + return this._load("loadImage", uri); } - visitInputs(_.sort); - ops.forEach((op, i)=>{ - const field = fields[i], param = params[i], aggregate_param = aggregate_params[i] || null, mname = (0, _vegaUtil.accessorName)(field), name = measureName(op, mname, as[i]); - visitInputs(field); - outputs.push(name); - // Window operation - if ((0, _vegaUtil.hasOwnProperty)(WindowOps, op)) windows.push(WindowOp(op, field, param, name)); - else { - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - if (op === 'count') { - counts.push(name); - return; - } - countOnly = false; - let m = map[mname]; - if (!m) { - m = map[mname] = []; - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, aggregate_param, name)); - } - }); - if (counts.length || measures.length) this.cell = cell(measures, counts, countOnly); - this.inputs = Object.keys(inputs); -} -const prototype = WindowState.prototype; -prototype.init = function() { - this.windows.forEach((_)=>_.init()); - if (this.cell) this.cell.init(); -}; -prototype.update = function(w, t) { - const cell = this.cell, wind = this.windows, data = w.data, m = wind && wind.length; - let j; - if (cell) { - for(j = w.p0; j < w.i0; ++j)cell.rem(data[j]); - for(j = w.p1; j < w.i1; ++j)cell.add(data[j]); - cell.set(t); - } - for(j = 0; j < m; ++j)wind[j].update(w, t); -}; -function cell(measures, counts, countOnly) { - measures = measures.map((m)=>compileMeasures(m, m.field)); - const cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - if (!countOnly) { - var n = measures.length, a = cell.agg = Array(n), i = 0; - for(; i < n; ++i)a[i] = new measures[i](cell); - } - if (cell.store) var store = cell.data = new TupleStore(); - cell.add = function(t) { - cell.num += 1; - if (countOnly) return; - if (store) store.add(t); - for(let i = 0; i < n; ++i)a[i].add(a[i].get(t), t); - }; - cell.rem = function(t) { - cell.num -= 1; - if (countOnly) return; - if (store) store.rem(t); - for(let i = 0; i < n; ++i)a[i].rem(a[i].get(t), t); - }; - cell.set = function(t) { - let i, n; - // consolidate stored values - if (store) store.values(); - // update tuple properties - for(i = 0, n = counts.length; i < n; ++i)t[counts[i]] = cell.num; - if (!countOnly) for(i = 0, n = a.length; i < n; ++i)a[i].set(t); - }; - cell.init = function() { - cell.num = 0; - if (store) store.reset(); - for(let i = 0; i < n; ++i)a[i].init(); - }; - return cell; -} -/** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array<string>} params.ops - An array of strings indicating window operations to perform. - * @param {Array<function(object): *>} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameter values for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for window operations. - * @param {Array<number>} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ function Window(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._mlen = 0; - this._mods = []; -} -Window.Definition = { - 'type': 'Window', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidWindowOps.concat(ValidAggregateOps) - }, - { - 'name': 'params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'frame', - 'type': 'number', - 'null': true, - 'array': true, - 'length': 2, - 'default': [ - null, - 0 - ] - }, - { - 'name': 'ignorePeers', - 'type': 'boolean', - 'default': false - } - ] -}; -(0, _vegaUtil.inherits)(Window, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.stamp = pulse.stamp; - const mod = _.modified(), cmp = (0, _vegaDataflow.stableCompare)(_.sort), key = groupkey(_.groupby), group = (t)=>this.group(key(t)); - // initialize window state - let state = this.state; - if (!state || mod) state = this.state = new WindowState(_); - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - this.value = {}; - pulse.visit(pulse.SOURCE, (t)=>group(t).add(t)); - } else { - pulse.visit(pulse.REM, (t)=>group(t).remove(t)); - pulse.visit(pulse.ADD, (t)=>group(t).add(t)); - } - // perform window calculations for each modified partition - for(let i = 0, n = this._mlen; i < n; ++i)processPartition(this._mods[i], state, cmp, _); - this._mlen = 0; - this._mods = []; - // TODO don't reflow everything? - return pulse.reflow(mod).modifies(state.outputs); - }, - group (key) { - let group = this.value[key]; - if (!group) { - group = this.value[key] = SortedList((0, _vegaDataflow.tupleid)); - group.stamp = -1; - } - if (group.stamp < this.stamp) { - group.stamp = this.stamp; - this._mods[this._mlen++] = group; + } + const KeyDownEvent = "keydown"; + const KeyPressEvent = "keypress"; + const KeyUpEvent = "keyup"; + const DragEnterEvent = "dragenter"; + const DragLeaveEvent = "dragleave"; + const DragOverEvent = "dragover"; + const PointerDownEvent = "pointerdown"; + const PointerUpEvent = "pointerup"; + const PointerMoveEvent = "pointermove"; + const PointerOutEvent = "pointerout"; + const PointerOverEvent = "pointerover"; + const MouseDownEvent = "mousedown"; + const MouseUpEvent = "mouseup"; + const MouseMoveEvent = "mousemove"; + const MouseOutEvent = "mouseout"; + const MouseOverEvent = "mouseover"; + const ClickEvent = "click"; + const DoubleClickEvent = "dblclick"; + const WheelEvent = "wheel"; + const MouseWheelEvent = "mousewheel"; + const TouchStartEvent = "touchstart"; + const TouchMoveEvent = "touchmove"; + const TouchEndEvent = "touchend"; + const Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, PointerDownEvent, PointerUpEvent, PointerMoveEvent, PointerOutEvent, PointerOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent]; + const TooltipShowEvent = PointerMoveEvent; + const TooltipHideEvent = MouseOutEvent; + const HrefEvent = ClickEvent; + class CanvasHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + this._down = null; + this._touch = null; + this._first = true; + this._events = {}; + this.events = Events; + this.pointermove = move([PointerMoveEvent, MouseMoveEvent], [PointerOverEvent, MouseOverEvent], [PointerOutEvent, MouseOutEvent]); + this.dragover = move([DragOverEvent], [DragEnterEvent], [DragLeaveEvent]), this.pointerout = inactive([PointerOutEvent, MouseOutEvent]); + this.dragleave = inactive([DragLeaveEvent]); + } + initialize(el, origin, obj2) { + this._canvas = el && domFind(el, "canvas"); + [ClickEvent, MouseDownEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, DragLeaveEvent].forEach((type2) => eventListenerCheck(this, type2)); + return super.initialize(el, origin, obj2); + } + // return the backing canvas instance + canvas() { + return this._canvas; + } + // retrieve the current canvas context + context() { + return this._canvas.getContext("2d"); + } + // to keep old versions of firefox happy + DOMMouseScroll(evt) { + this.fire(MouseWheelEvent, evt); + } + pointerdown(evt) { + this._down = this._active; + this.fire(PointerDownEvent, evt); + } + mousedown(evt) { + this._down = this._active; + this.fire(MouseDownEvent, evt); + } + click(evt) { + if (this._down === this._active) { + this.fire(ClickEvent, evt); + this._down = null; + } + } + touchstart(evt) { + this._touch = this.pickEvent(evt.changedTouches[0]); + if (this._first) { + this._active = this._touch; + this._first = false; + } + this.fire(TouchStartEvent, evt, true); + } + touchmove(evt) { + this.fire(TouchMoveEvent, evt, true); + } + touchend(evt) { + this.fire(TouchEndEvent, evt, true); + this._touch = null; + } + // fire an event + fire(type2, evt, touch2) { + const a2 = touch2 ? this._touch : this._active, h2 = this._handlers[type2]; + evt.vegaType = type2; + if (type2 === HrefEvent && a2 && a2.href) { + this.handleHref(evt, a2, a2.href); + } else if (type2 === TooltipShowEvent || type2 === TooltipHideEvent) { + this.handleTooltip(evt, a2, type2 !== TooltipHideEvent); + } + if (h2) { + for (let i = 0, len2 = h2.length; i < len2; ++i) { + h2[i].handler.call(this._obj, evt, a2); } - return group; + } } -}); -function processPartition(list, state, cmp, _) { - const sort = _.sort, range = sort && !_.ignorePeers, frame = _.frame || [ - null, - 0 - ], data = list.data(cmp), // use cmp for stable sort - n = data.length, b = range ? (0, _d3Array.bisector)(sort) : null, w = { - i0: 0, - i1: 0, - p0: 0, - p1: 0, - index: 0, - data: data, - compare: sort || (0, _vegaUtil.constant)(-1) - }; - state.init(); - for(let i = 0; i < n; ++i){ - setWindow(w, frame, i, n); - if (range) adjustRange(w, b); - state.update(w, data[i]); - } -} -function setWindow(w, f, i, n) { - w.p0 = w.i0; - w.p1 = w.i1; - w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); - w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); - w.index = i; -} -// if frame type is 'range', adjust window for peer values -function adjustRange(w, bisect) { - const r0 = w.i0, r1 = w.i1 - 1, c = w.compare, d = w.data, n = d.length - 1; - if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]); -} - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","vega-statistics":"4QSQj","d3-array":"5lCYW","vega-time":"kjkWX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4QSQj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bandwidthNRD", ()=>estimateBandwidth); -parcelHelpers.export(exports, "bin", ()=>bin); -parcelHelpers.export(exports, "bootstrapCI", ()=>bootstrapCI); -parcelHelpers.export(exports, "cumulativeLogNormal", ()=>cumulativeLogNormal); -parcelHelpers.export(exports, "cumulativeNormal", ()=>cumulativeNormal); -parcelHelpers.export(exports, "cumulativeUniform", ()=>cumulativeUniform); -parcelHelpers.export(exports, "densityLogNormal", ()=>densityLogNormal); -parcelHelpers.export(exports, "densityNormal", ()=>densityNormal); -parcelHelpers.export(exports, "densityUniform", ()=>densityUniform); -parcelHelpers.export(exports, "dotbin", ()=>dotbin); -parcelHelpers.export(exports, "quantileLogNormal", ()=>quantileLogNormal); -parcelHelpers.export(exports, "quantileNormal", ()=>quantileNormal); -parcelHelpers.export(exports, "quantileUniform", ()=>quantileUniform); -parcelHelpers.export(exports, "quantiles", ()=>quantiles); -parcelHelpers.export(exports, "quartiles", ()=>quartiles); -parcelHelpers.export(exports, "random", ()=>random); -parcelHelpers.export(exports, "randomInteger", ()=>integer); -parcelHelpers.export(exports, "randomKDE", ()=>kde); -parcelHelpers.export(exports, "randomLCG", ()=>lcg); -parcelHelpers.export(exports, "randomLogNormal", ()=>lognormal); -parcelHelpers.export(exports, "randomMixture", ()=>mixture); -parcelHelpers.export(exports, "randomNormal", ()=>gaussian); -parcelHelpers.export(exports, "randomUniform", ()=>uniform); -parcelHelpers.export(exports, "regressionConstant", ()=>constant); -parcelHelpers.export(exports, "regressionExp", ()=>exp); -parcelHelpers.export(exports, "regressionLinear", ()=>linear); -parcelHelpers.export(exports, "regressionLoess", ()=>loess); -parcelHelpers.export(exports, "regressionLog", ()=>log); -parcelHelpers.export(exports, "regressionPoly", ()=>poly); -parcelHelpers.export(exports, "regressionPow", ()=>pow); -parcelHelpers.export(exports, "regressionQuad", ()=>quad); -parcelHelpers.export(exports, "sampleCurve", ()=>sampleCurve); -parcelHelpers.export(exports, "sampleLogNormal", ()=>sampleLogNormal); -parcelHelpers.export(exports, "sampleNormal", ()=>sampleNormal); -parcelHelpers.export(exports, "sampleUniform", ()=>sampleUniform); -parcelHelpers.export(exports, "setRandom", ()=>setRandom); -var _d3Array = require("d3-array"); -function* numbers(values, valueof) { - if (valueof == null) { - for (let value of values)if (value != null && value !== '' && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values){ - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) yield value; - } - } -} -function quantiles(array, p, f) { - const values = Float64Array.from(numbers(array, f)); - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort((0, _d3Array.ascending)); - return p.map((_)=>(0, _d3Array.quantileSorted)(values, _)); -} -function quartiles(array, f) { - return quantiles(array, [ - 0.25, - 0.50, - 0.75 - ], f); -} -// Scott, D. W. (1992) Multivariate Density Estimation: -// Theory, Practice, and Visualization. Wiley. -function estimateBandwidth(array, f) { - const n = array.length, d = (0, _d3Array.deviation)(array, f), q = quartiles(array, f), h = (q[2] - q[0]) / 1.34, v = Math.min(d, h) || d || Math.abs(q[0]) || 1; - return 1.06 * v * Math.pow(n, -0.2); -} -function bin(_) { - // determine range - const maxb = _.maxbins || 20, base = _.base || 10, logb = Math.log(base), div = _.divide || [ - 5, - 2 - ]; - let min = _.extent[0], max = _.extent[1], step, level, minstep, v, i, n; - const span = _.span || max - min || Math.abs(min) || 1; - if (_.step) // if step size is explicitly given, use that - step = _.step; - else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for(i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i - 1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); - // increase step size if too many bins - while(Math.ceil(span / step) > maxb)step *= base; - // decrease step size if allowed - for(i = 0, n = div.length; i < n; ++i){ - v = step / div[i]; - if (v >= minstep && span / v <= maxb) step = v; - } - } - // update precision, min and max - v = Math.log(step); - const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + eventListenerCheck(this, type2); + (h2[name] || (h2[name] = [])).push({ + type: type2, + handler + }); + } + return this; } - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; -} -var random = Math.random; -function setRandom(r) { - random = r; -} -function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [ - undefined, - undefined - ]; - const values = Float64Array.from(numbers(array, f)), n = values.length, m = samples; - let a, i, j, mu; - for(j = 0, mu = Array(m); j < m; ++j){ - for(a = 0, i = 0; i < n; ++i)a += values[~~(random() * n)]; - mu[j] = a / n; + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + h2.splice(i, 1); + } + return this; + } + pickEvent(evt) { + const p = point(evt, this._canvas), o = this._origin; + return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); } - mu.sort((0, _d3Array.ascending)); - return [ - (0, _d3Array.quantile)(mu, alpha / 2), - (0, _d3Array.quantile)(mu, 1 - alpha / 2) - ]; -} -// Dot density binning for dot plot construction. -// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. -// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf -function dotbin(array, step, smooth, f) { - f = f || ((_)=>_); - const n = array.length, v = new Float64Array(n); - let i = 0, j = 1, a = f(array[0]), b = a, w = a + step, x; - for(; j < n; ++j){ - x = f(array[j]); - if (x >= w) { - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - w = x + step; - a = x; - } - b = x; - } - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - return smooth ? smoothing(v, step + step / 4) : v; -} -// perform smoothing to reduce variance -// swap points between "adjacent" stacks -// Wilkinson defines adjacent as within step/4 units -function smoothing(v, thresh) { - const n = v.length; - let a = 0, b = 1, c, d; - // get left stack - while(v[a] === v[b])++b; - while(b < n){ - // get right stack - c = b + 1; - while(v[b] === v[c])++c; - // are stacks adjacent? - // if so, compare sizes and swap as needed - if (v[b] - v[b - 1] < thresh) { - d = b + (a + c - b - b >> 1); - while(d < b)v[d++] = v[b]; - while(d > b)v[d--] = v[a]; - } - // update left stack indices - a = b; - b = c; + // find the scenegraph item at the current pointer position + // x, y -- the absolute x, y pointer coordinates on the canvas element + // gx, gy -- the relative coordinates within the current group + pick(scene, x2, y2, gx, gy) { + const g = this.context(), mark = Marks[scene.marktype]; + return mark.pick.call(this, g, scene, x2, y2, gx, gy); } - return v; -} -function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; -} -function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - let a, b, d; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else return b; - }, - sample () { - return a + Math.floor(d * random()); - }, - pdf (x) { - return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0; - }, - cdf (x) { - const v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }, - icdf (p) { - return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN; - } + } + const eventBundle = (type2) => type2 === TouchStartEvent || type2 === TouchMoveEvent || type2 === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type2]; + function eventListenerCheck(handler, type2) { + eventBundle(type2).forEach((_) => addEventListener(handler, _)); + } + function addEventListener(handler, type2) { + const canvas = handler.canvas(); + if (canvas && !handler._events[type2]) { + handler._events[type2] = 1; + canvas.addEventListener(type2, handler[type2] ? (evt) => handler[type2](evt) : (evt) => handler.fire(type2, evt)); + } + } + function fireAll(handler, types2, event2) { + types2.forEach((type2) => handler.fire(type2, event2)); + } + function move(moveEvents, overEvents, outEvents) { + return function(evt) { + const a2 = this._active, p = this.pickEvent(evt); + if (p === a2) { + fireAll(this, moveEvents, evt); + } else { + if (!a2 || !a2.exit) { + fireAll(this, outEvents, evt); + } + this._active = p; + fireAll(this, overEvents, evt); + fireAll(this, moveEvents, evt); + } }; - return dist.min(min).max(max); -} -const SQRT2PI = Math.sqrt(2 * Math.PI); -const SQRT2 = Math.SQRT2; -let nextSample = NaN; -function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = random() * 2 - 1; - y = random() * 2 - 1; - rds = x * x + y * y; - }while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; -} -function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); -} -// Approximation from West (2009) -// Better Approximations to Cumulative Normal Functions -function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (value - mean) / stdev, Z = Math.abs(z); - let cd; - if (Z > 37) cd = 0; - else { - const exp = Math.exp(-Z * Z / 2); - let sum; - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; -} -// Approximation of Probit function using inverse error function. -function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); -} -// Approximate inverse error function. Implementation from "Approximating -// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. -// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 -function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = -Math.log((1 - x) * (1 + x)), p; - if (w < 6.25) { - w -= 3.125; - p = -0.00000000000000000000364441206401782; - p = -0.00000000000000000016850591381820166 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -0.0000000000000001333171662854621 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -0.00000000000004054566272975207 + p * w; - p = -0.00000000000008151934197605472 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -0.000000000012975133253453532 + p * w; - p = -0.00000000005415412054294628 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -0.000000004112633980346984 + p * w; - p = -0.000000029070369957882005 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -0.0000013654692000834679 + p * w; - p = -0.000013882523362786469 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.000740702534166267 + p * w; - p = -0.006033670871430149 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -0.00000027517406297064545 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -0.000004013867526981546 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -0.000047318229009055734 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628475 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.003751208507569241 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -0.000000000027109920616438573; - p = -0.0000000002555641816996525 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -0.000000003789465440126737 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -0.00000001496002662714924 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -0.00000006771199775845234 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -0.00000099298272942317 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -0.00001968177810553167 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477 + p * w; - p = -0.00013871931833623122 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else p = Infinity; - return p * x; -} -function gaussian(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleNormal(mu, sigma), - pdf: (value)=>densityNormal(value, mu, sigma), - cdf: (value)=>cumulativeNormal(value, mu, sigma), - icdf: (p)=>quantileNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function kde(support, bandwidth) { - const kernel = gaussian(); - let n = 0; - const dist = { - data (_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else return support; - }, - bandwidth (_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = estimateBandwidth(support); - return dist; - }, - sample () { - return support[~~(random() * n)] + bandwidth * kernel.sample(); - }, - pdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.pdf((x - support[i]) / bandwidth); - return y / bandwidth / n; - }, - cdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.cdf((x - support[i]) / bandwidth); - return y / n; - }, - icdf () { - throw Error('KDE icdf not supported.'); - } + } + function inactive(types2) { + return function(evt) { + fireAll(this, types2, evt); + this._active = null; }; - return dist.data(support); -} -function sampleLogNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - return Math.exp(mean + sampleNormal() * stdev); -} -function densityLogNormal(value, mean, stdev) { - if (value <= 0) return 0; - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (Math.log(value) - mean) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value); -} -function cumulativeLogNormal(value, mean, stdev) { - return cumulativeNormal(Math.log(value), mean, stdev); -} -function quantileLogNormal(p, mean, stdev) { - return Math.exp(quantileNormal(p, mean, stdev)); -} -function lognormal(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleLogNormal(mu, sigma), - pdf: (value)=>densityLogNormal(value, mu, sigma), - cdf: (value)=>cumulativeLogNormal(value, mu, sigma), - icdf: (p)=>quantileLogNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function mixture(dists, weights) { - let m = 0, w; - function normalize(x) { - const w = []; - let sum = 0, i; - for(i = 0; i < m; ++i)sum += w[i] = x[i] == null ? 1 : +x[i]; - for(i = 0; i < m; ++i)w[i] /= sum; - return w; - } - const dist = { - weights (_) { - if (arguments.length) { - w = normalize(weights = _ || []); - return dist; - } - return weights; - }, - distributions (_) { - if (arguments.length) { - if (_) { - m = _.length; - dists = _; - } else { - m = 0; - dists = []; - } - return dist.weights(weights); - } - return dists; - }, - sample () { - const r = random(); - let d = dists[m - 1], v = w[0], i = 0; - // first select distribution - for(; i < m - 1; v += w[++i])if (r < v) { - d = dists[i]; - break; - } - // then sample from it - return d.sample(); - }, - pdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].pdf(x); - return p; - }, - cdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].cdf(x); - return p; - }, - icdf () { - throw Error('Mixture icdf not supported.'); - } - }; - return dist.distributions(dists).weights(weights); -} -function sampleUniform(min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return min + (max - min) * random(); -} -function densityUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value >= min && value <= max ? 1 / (max - min) : 0; -} -function cumulativeUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); -} -function quantileUniform(p, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return p >= 0 && p <= 1 ? min + p * (max - min) : NaN; -} -function uniform(min, max) { - let a, b; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else return b; - }, - sample: ()=>sampleUniform(a, b), - pdf: (value)=>densityUniform(value, a, b), - cdf: (value)=>cumulativeUniform(value, a, b), - icdf: (p)=>quantileUniform(p, a, b) - }; - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return dist.min(min).max(max); -} -function constant(data, x, y) { - let mean = 0, n = 0; - for (const d of data){ - const val = y(d); - if (x(d) == null || val == null || isNaN(val)) continue; - mean += (val - mean) / ++n; + } + function devicePixelRatio$1() { + return typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1; + } + function resize(canvas, width2, height2, origin, scaleFactor, opt) { + const inDOM = typeof HTMLElement !== "undefined" && canvas instanceof HTMLElement && canvas.parentNode != null, context2 = canvas.getContext("2d"), ratio = inDOM ? devicePixelRatio$1() : scaleFactor; + canvas.width = width2 * ratio; + canvas.height = height2 * ratio; + for (const key2 in opt) { + context2[key2] = opt[key2]; } - return { - coef: [ - mean - ], - predict: ()=>mean, - rSquared: 0 - }; -} -// Ordinary Least Squares -function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; - return [ - intercept, - slope - ]; -} -function points(data, x, y, sort) { - data = data.filter((d)=>{ - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - if (sort) data.sort((a, b)=>x(a) - x(b)); - const n = data.length, X = new Float64Array(n), Y = new Float64Array(n); - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data){ - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; + if (inDOM && ratio !== 1) { + canvas.style.width = width2 + "px"; + canvas.style.height = height2 + "px"; } - // mean center the data - for(i = 0; i < n; ++i){ - X[i] -= ux; - Y[i] -= uy; + context2.pixelRatio = ratio; + context2.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); + return canvas; + } + class CanvasRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._options = {}; + this._redraw = false; + this._dirty = new Bounds(); + this._tempb = new Bounds(); + } + initialize(el, width2, height2, origin, scaleFactor, options2) { + this._options = options2 || {}; + this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); + if (el && this._canvas) { + domClear(el, 0).appendChild(this._canvas); + this._canvas.setAttribute("class", "marks"); + } + return super.initialize(el, width2, height2, origin, scaleFactor); } - return [ - X, - Y, - ux, - uy - ]; -} -function visitPoints(data, x, y, callback) { - let i = -1, u, v; - for (const d of data){ - u = x(d); - v = y(d); - if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) callback(u, v, ++i); - } -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const sse = dy - predict(dx), sst = dy - uY; - SSE += sse * sse; - SST += sst * sst; - }); - return 1 - SSE / SST; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function linear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * x; - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function log(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * Math.log(x); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -function exp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - visitPoints(data, x, y, (_, dy)=>{ - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x)=>Math.exp(c0 + c1 * (x - ux)); - return { - coef: [ - Math.exp(c0 - c1 * ux), - c1 - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function pow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const lx = Math.log(dx), ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] * Math.pow(x, coef[1]); - coef[0] = Math.exp(coef[0]); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; -} -function quad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length; - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x2; - for(i = 0; i < n;){ - dx = xv[i]; - dy = yv[i++]; - x2 = dx * dx; - X2 += (x2 - X2) / i; - X3 += (x2 * dx - X3) / i; - X4 += (x2 * x2 - X4) / i; - XY += (dx * dy - XY) / i; - X2Y += (x2 * dy - X2Y) / i; - } - const X2X2 = X4 - X2 * X2, d = X2 * X2X2 - X3 * X3, a = (X2Y * X2 - XY * X3) / d, b = (XY * X2X2 - X2Y * X3) / d, c = -a * X2, predict = (x)=>{ - x = x - ux; - return a * x * x + b * x + c + uy; - }; - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -// ... which was adapted from regression-js by Tom Alexander -// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 -// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE -function poly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 0) return constant(data, x, y); - if (order === 1) return linear(data, x, y); - if (order === 2) return quad(data, x, y); - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length, lhs = [], rhs = [], k = order + 1; - let i, j, l, v, c; - for(i = 0; i < k; ++i){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i) * yv[l]; - lhs.push(v); - c = new Float64Array(k); - for(j = 0; j < k; ++j){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i + j); - c[j] = v; - } - rhs.push(c); + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._canvas) { + resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); + } else { + const ctx = this._options.externalContext; + if (!ctx) error("CanvasRenderer is missing a valid canvas or context"); + ctx.scale(this._scale, this._scale); + ctx.translate(this._origin[0], this._origin[1]); + } + this._redraw = true; + return this; } - rhs.push(lhs); - const coef = gaussianElimination(rhs), predict = (x)=>{ - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for(i = 3; i < k; ++i)y += coef[i] * Math.pow(x, i); - return y; - }; - return { - coef: uncenter(k, coef, -ux, uy), - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -function uncenter(k, a, x, y) { - const z = Array(k); - let i, j, v, c; - // initialize to zero - for(i = 0; i < k; ++i)z[i] = 0; - // polynomial expansion - for(i = k - 1; i >= 0; --i){ - v = a[i]; - c = 1; - z[i] += v; - for(j = 1; j <= i; ++j){ - c *= (i + 1 - j) / j; // binomial coefficent - z[i - j] += v * Math.pow(x, j) * c; - } - } - // bias term - z[0] += y; - return z; -} -// Given an array for a two-dimensional matrix and the polynomial order, -// solve A * x = b using Gaussian elimination. -function gaussianElimination(matrix) { - const n = matrix.length - 1, coef = []; - let i, j, k, r, t; - for(i = 0; i < n; ++i){ - r = i; // max row - for(j = i + 1; j < n; ++j)if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) r = j; - for(k = i; k < n + 1; ++k){ - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - for(j = i + 1; j < n; ++j)for(k = n; k >= i; k--)matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; + canvas() { + return this._canvas; } - for(j = n - 1; j >= 0; --j){ - t = 0; - for(k = j + 1; k < n; ++k)t += matrix[k][j] * coef[k]; - coef[j] = (matrix[n][j] - t) / matrix[j][j]; + context() { + return this._options.externalContext || (this._canvas ? this._canvas.getContext("2d") : null); } - return coef; -} -const maxiters = 2, epsilon = 1e-12; -// Adapted from science.js by Jason Davies -// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js -// License: https://github.com/jasondavies/science.js/blob/master/LICENSE -function loess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), n = xv.length, bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); - for(let iter = -1; ++iter <= maxiters;){ - const interval = [ - 0, - bw - 1 - ]; - for(let i = 0; i < n; ++i){ - const dx = xv[i], i0 = interval[0], i1 = interval[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0; - const denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - for(let k = i0; k <= i1; ++k){ - const xk = xv[k], yk = yv[k], w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w; - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - updateInterval(xv, i + 1, interval); - } - if (iter === maxiters) break; - const medianResidual = (0, _d3Array.median)(residuals); - if (Math.abs(medianResidual) < epsilon) break; - for(let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w; - } - } - return output(xv, yhat, ux, uy); -} -// weighting kernel for local regression -function tricube(x) { - return (x = 1 - x * x * x) * x * x; -} -// advance sliding window interval of nearest neighbors -function updateInterval(xv, i, interval) { - const val = xv[i]; - let left = interval[0], right = interval[1] + 1; - if (right >= xv.length) return; - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while(i > left && xv[right] - val <= val - xv[left]){ - interval[0] = ++left; - interval[1] = right; - ++right; - } -} -// generate smoothed output points -// average points with repeated x values -function output(xv, yhat, ux, uy) { - const n = xv.length, out = []; - let i = 0, cnt = 0, prev = [], v; - for(; i < n; ++i){ - v = xv[i] + ux; - if (prev[0] === v) // average output values via online update - prev[1] += (yhat[i] - prev[1]) / ++cnt; - else { - // add new output point - cnt = 0; - prev[1] += uy; - prev = [ - v, - yhat[i] - ]; - out.push(prev); + dirty(item) { + const b2 = this._tempb.clear().union(item.bounds); + let g = item.mark.group; + while (g) { + b2.translate(g.x || 0, g.y || 0); + g = g.mark.group; + } + this._dirty.union(b2); + } + _render(scene, markTypes) { + const g = this.context(), o = this._origin, w2 = this._width, h2 = this._height, db = this._dirty, vb = viewBounds(o, w2, h2); + g.save(); + const b2 = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); + this.clear(-o[0], -o[1], w2, h2); + this.draw(g, scene, b2, markTypes); + g.restore(); + db.clear(); + return this; + } + draw(ctx, scene, bounds2, markTypes) { + if (scene.marktype !== "group" && markTypes != null && !markTypes.includes(scene.marktype)) { + return; + } + const mark = Marks[scene.marktype]; + if (scene.clip) clip$2(ctx, scene); + mark.draw.call(this, ctx, scene, bounds2, markTypes); + if (scene.clip) ctx.restore(); + } + clear(x2, y2, w2, h2) { + const opt = this._options, g = this.context(); + if (opt.type !== "pdf" && !opt.externalContext) { + g.clearRect(x2, y2, w2, h2); + } + if (this._bgcolor != null) { + g.fillStyle = this._bgcolor; + g.fillRect(x2, y2, w2, h2); + } + } + } + const viewBounds = (origin, width2, height2) => new Bounds().set(0, 0, width2, height2).translate(-origin[0], -origin[1]); + function clipToBounds(g, b2, origin) { + b2.expand(1).round(); + if (g.pixelRatio % 1) { + b2.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); + } + b2.translate(-(origin[0] % 1), -(origin[1] % 1)); + g.beginPath(); + g.rect(b2.x1, b2.y1, b2.width(), b2.height()); + g.clip(); + return b2; + } + class SVGHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + const h2 = this; + h2._hrefHandler = listener(h2, (evt, item) => { + if (item && item.href) h2.handleHref(evt, item, item.href); + }); + h2._tooltipHandler = listener(h2, (evt, item) => { + h2.handleTooltip(evt, item, evt.type !== TooltipHideEvent); + }); + } + initialize(el, origin, obj2) { + let svg = this._svg; + if (svg) { + svg.removeEventListener(HrefEvent, this._hrefHandler); + svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); + svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); + } + this._svg = svg = el && domFind(el, "svg"); + if (svg) { + svg.addEventListener(HrefEvent, this._hrefHandler); + svg.addEventListener(TooltipShowEvent, this._tooltipHandler); + svg.addEventListener(TooltipHideEvent, this._tooltipHandler); + } + return super.initialize(el, origin, obj2); + } + canvas() { + return this._svg; + } + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + const x2 = { + type: type2, + handler, + listener: listener(this, handler) + }; + (h2[name] || (h2[name] = [])).push(x2); + if (this._svg) { + this._svg.addEventListener(name, x2.listener); } + } + return this; } - prev[1] += uy; - return out; -} -// subdivide up to accuracy of 0.5 degrees -const MIN_RADIANS = 0.5 * Math.PI / 180; -// Adaptively sample an interpolated function over a domain extent -function sampleCurve(f, extent, minSteps, maxSteps) { - minSteps = minSteps || 25; - maxSteps = Math.max(minSteps, maxSteps || 200); - const point = (x)=>[ - x, - f(x) - ], minX = extent[0], maxX = extent[1], span = maxX - minX, stop = span / maxSteps, prev = [ - point(minX) - ], next = []; - if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for(let i = 1; i < maxSteps; ++i)prev.push(point(minX + i / minSteps * span)); - prev.push(point(maxX)); - return prev; + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + if (this._svg) { + this._svg.removeEventListener(name, h2[i].listener); + } + h2.splice(i, 1); + } + return this; + } + } + const listener = (context2, handler) => (evt) => { + let item = evt.target.__data__; + item = Array.isArray(item) ? item[0] : item; + evt.vegaType = evt.type; + handler.call(context2._obj, evt, item); + }; + const ARIA_HIDDEN = "aria-hidden"; + const ARIA_LABEL = "aria-label"; + const ARIA_ROLE = "role"; + const ARIA_ROLEDESCRIPTION = "aria-roledescription"; + const GRAPHICS_OBJECT = "graphics-object"; + const GRAPHICS_SYMBOL = "graphics-symbol"; + const bundle = (role, roledesc, label2) => ({ + [ARIA_ROLE]: role, + [ARIA_ROLEDESCRIPTION]: roledesc, + [ARIA_LABEL]: label2 || void 0 + }); + const AriaIgnore = toSet(["axis-domain", "axis-grid", "axis-label", "axis-tick", "axis-title", "legend-band", "legend-entry", "legend-gradient", "legend-label", "legend-title", "legend-symbol", "title"]); + const AriaGuides = { + "axis": { + desc: "axis", + caption: axisCaption + }, + "legend": { + desc: "legend", + caption: legendCaption + }, + "title-text": { + desc: "title", + caption: (item) => `Title text '${titleCaption(item)}'` + }, + "title-subtitle": { + desc: "subtitle", + caption: (item) => `Subtitle text '${titleCaption(item)}'` + } + }; + const AriaEncode = { + ariaRole: ARIA_ROLE, + ariaRoleDescription: ARIA_ROLEDESCRIPTION, + description: ARIA_LABEL + }; + function ariaItemAttributes(emit2, item) { + const hide = item.aria === false; + emit2(ARIA_HIDDEN, hide || void 0); + if (hide || item.description == null) { + for (const prop in AriaEncode) { + emit2(AriaEncode[prop], void 0); + } } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for(let i = minSteps; --i > 0;)next.push(point(minX + i / minSteps * span)); + const type2 = item.mark.marktype; + emit2(ARIA_LABEL, item.description); + emit2(ARIA_ROLE, item.ariaRole || (type2 === "group" ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); + emit2(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type2} mark`); } - let p0 = prev[0]; - let p1 = next[next.length - 1]; - const sx = 1 / span; - const sy = scaleY(p0[1], next); - while(p1){ - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - const dx = pm[0] - p0[0] >= stop; - if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) // maximum resolution has not yet been met, and - // subdivision midpoint is sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack - next.push(pm); - else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; + } + function ariaMarkAttributes(mark) { + return mark.aria === false ? { + [ARIA_HIDDEN]: true + } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); + } + function ariaMark(mark) { + const type2 = mark.marktype; + const recurse2 = type2 === "group" || type2 === "text" || mark.items.some((_) => _.description != null && _.aria !== false); + return bundle(recurse2 ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type2} mark container`, mark.description); + } + function ariaGuide(mark, opt) { + try { + const item = mark.items[0], caption = opt.caption || (() => ""); + return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); + } catch (err) { + return null; } - return prev; -} -function scaleY(init, points) { - let ymin = init; - let ymax = init; - const n = points.length; - for(let i = 0; i < n; ++i){ - const y = points[i][1]; - if (y < ymin) ymin = y; - if (y > ymax) ymax = y; + } + function titleCaption(item) { + return array$4(item.text).join(" "); + } + function axisCaption(item) { + const datum2 = item.datum, orient = item.orient, title = datum2.title ? extractTitle(item) : null, ctx = item.context, scale2 = ctx.scales[datum2.scale].value, locale2 = ctx.dataflow.locale(), type2 = scale2.type, xy = orient === "left" || orient === "right" ? "Y" : "X"; + return `${xy}-axis` + (title ? ` titled '${title}'` : "") + ` for a ${isDiscrete(type2) ? "discrete" : type2} scale with ${domainCaption(locale2, scale2, item)}`; + } + function legendCaption(item) { + const datum2 = item.datum, title = datum2.title ? extractTitle(item) : null, type2 = `${datum2.type || ""} legend`.trim(), scales2 = datum2.scales, props = Object.keys(scales2), ctx = item.context, scale2 = ctx.scales[scales2[props[0]]].value, locale2 = ctx.dataflow.locale(); + return capitalize(type2) + (title ? ` titled '${title}'` : "") + ` for ${channelCaption(props)} with ${domainCaption(locale2, scale2, item)}`; + } + function extractTitle(item) { + try { + return array$4(peek$1(item.items).items[0].text).join(" "); + } catch (err) { + return null; } - return 1 / (ymax - ymin); -} -function angleDelta(p, q, r, sx, sy) { - const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])), a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0])); - return Math.abs(a0 - a1); -} - -},{"d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hvqjl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bound", ()=>Bound); -parcelHelpers.export(exports, "identifier", ()=>Identifier); -parcelHelpers.export(exports, "mark", ()=>Mark); -parcelHelpers.export(exports, "overlap", ()=>Overlap); -parcelHelpers.export(exports, "render", ()=>Render); -parcelHelpers.export(exports, "viewlayout", ()=>ViewLayout); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaUtil = require("vega-util"); -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const TopLeft = 'top-left'; -const TopRight = 'top-right'; -const BottomLeft = 'bottom-left'; -const BottomRight = 'bottom-right'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const X = 'x'; -const Y = 'y'; -const Group = 'group'; -const AxisRole = 'axis'; -const TitleRole = 'title'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const LegendRole = 'legend'; -const RowHeader = 'row-header'; -const RowFooter = 'row-footer'; -const RowTitle = 'row-title'; -const ColHeader = 'column-header'; -const ColFooter = 'column-footer'; -const ColTitle = 'column-title'; -const Padding = 'padding'; -const Symbols = 'symbol'; -const Fit = 'fit'; -const FitX = 'fit-x'; -const FitY = 'fit-y'; -const Pad = 'pad'; -const None = 'none'; -const All = 'all'; -const Each = 'each'; -const Flush = 'flush'; -const Column = 'column'; -const Row = 'row'; -/** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ function Bound(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Bound, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow, mark = _.mark, type = mark.marktype, entry = (0, _vegaScenegraph.Marks)[type], bound = entry.bound; - let markBounds = mark.bounds, rebound; - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem(mark, bound); - mark.items.forEach((item)=>{ - item.bounds.clear().union(markBounds); - }); - } else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, (item)=>view.dirty(item)); - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(boundItem(item, bound))); - // force reflow for axes/legends/titles to propagate any layout changes - switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } + } + function channelCaption(props) { + props = props.map((p) => p + (p === "fill" || p === "stroke" ? " color" : "")); + return props.length < 2 ? props[0] : props.slice(0, -1).join(", ") + " and " + peek$1(props); + } + function capitalize(s2) { + return s2.length ? s2[0].toUpperCase() + s2.slice(1) : s2; + } + const innerText = (val) => (val + "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); + const attrText = (val) => innerText(val).replace(/"/g, """).replace(/\t/g, " ").replace(/\n/g, " ").replace(/\r/g, " "); + function markup() { + let buf = "", outer = "", inner = ""; + const stack = [], clear = () => outer = inner = "", push2 = (tag) => { + if (outer) { + buf += `${outer}>${inner}`; + clear(); + } + stack.push(tag); + }, attr2 = (name, value2) => { + if (value2 != null) outer += ` ${name}="${attrText(value2)}"`; + return m2; + }, m2 = { + open(tag, ...attrs) { + push2(tag); + outer = "<" + tag; + for (const set2 of attrs) { + for (const key2 in set2) attr2(key2, set2[key2]); + } + return m2; + }, + close() { + const tag = stack.pop(); + if (outer) { + buf += outer + (inner ? `>${inner}</${tag}>` : "/>"); } else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - pulse.visit(pulse.ADD, (item)=>{ - markBounds.union(boundItem(item, bound)); - }); - pulse.visit(pulse.MOD, (item)=>{ - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem(item, bound)); - }); - if (rebound) { - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(item.bounds)); - } - } - // ensure mark bounds do not exceed any clipping region - (0, _vegaScenegraph.boundClip)(mark); - return pulse.modifies('bounds'); - } -}); -function boundItem(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); -} -const COUNTER_NAME = ':vega_identifier:'; -/** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ function Identifier(params) { - (0, _vegaDataflow.Transform).call(this, 0, params); -} -Identifier.Definition = { - 'type': 'Identifier', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'as', - 'type': 'string', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Identifier, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const counter = getCounter(pulse.dataflow), as = _.as; - let id = counter.value; - pulse.visit(pulse.ADD, (t)=>t[as] = t[as] || ++id); - counter.set(this.value = id); - return pulse; - } -}); -function getCounter(view) { - return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); -} -/** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ function Mark(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Mark, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let mark = this.value; - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - // initialize entering items - const Init = mark.marktype === Group ? (0, _vegaScenegraph.GroupItem) : (0, _vegaScenegraph.Item); - pulse.visit(pulse.ADD, (item)=>Init.call(item, mark)); - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; - } -}); -function lookup$1(_) { - const g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; -} -/** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ function Overlap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const methods = { - parity: (items)=>items.filter((item, i)=>i % 2 ? item.opacity = 0 : 1), - greedy: (items, sep)=>{ - let a; - return items.filter((b, i)=>!i || !intersect(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0); - } -}; -// compute bounding box intersection -// including padding pixels of separation -const intersect = (a, b, sep)=>sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2); -const hasOverlap = (items, pad)=>{ - for(var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i){ - if (intersect(a, b = items[i].bounds, pad)) return true; - } -}; -const hasBounds = (item)=>{ - const b = item.bounds; - return b.width() > 1 && b.height() > 1; -}; -const boundTest = (scale, orient, tolerance)=>{ - var range = scale.range(), b = new (0, _vegaScenegraph.Bounds)(); - if (orient === Top || orient === Bottom) b.set(range[0], -Infinity, range[1], Infinity); - else b.set(-Infinity, range[0], Infinity, range[1]); - b.expand(tolerance || 1); - return (item)=>b.encloses(item.bounds); -}; -// reset all items to be fully opaque -const reset = (source)=>{ - source.forEach((item)=>item.opacity = 1); - return source; -}; -// add all tuples to mod, fork pulse if parameters were modified -// fork prevents cross-stream tuple pollution (e.g., pulse from scale) -const reflow = (pulse, _)=>pulse.reflow(_.modified()).modifies('opacity'); -(0, _vegaUtil.inherits)(Overlap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; - let source = pulse.materialize(pulse.SOURCE).source, items, test; - if (!source || !source.length) return; - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - // skip labels with no content - source = source.filter(hasBounds); - // early exit, nothing to do - if (!source.length) return; - if (_.sort) source = source.slice().sort(_.sort); - items = reset(source); - pulse = reflow(pulse, _); - if (items.length >= 3 && hasOverlap(items, sep)) { - do items = reduce(items, sep); - while (items.length >= 3 && hasOverlap(items, sep)); - if (items.length < 3 && !(0, _vegaUtil.peek)(source).opacity) { - if (items.length > 1) (0, _vegaUtil.peek)(items).opacity = 0; - (0, _vegaUtil.peek)(source).opacity = 1; - } + buf += `</${tag}>`; } - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach((item)=>{ - if (!test(item)) item.opacity = 0; - }); - } - // re-calculate mark bounds - const bounds = items[0].mark.bounds.clear(); - source.forEach((item)=>{ - if (item.opacity) bounds.union(item.bounds); + clear(); + return m2; + }, + attr: attr2, + text: (t) => (inner += innerText(t), m2), + toString: () => buf + }; + return m2; + } + const serializeXML = (node) => _serialize(markup(), node) + ""; + function _serialize(m2, node) { + m2.open(node.tagName); + if (node.hasAttributes()) { + const attrs = node.attributes, n = attrs.length; + for (let i = 0; i < n; ++i) { + m2.attr(attrs[i].name, attrs[i].value); + } + } + if (node.hasChildNodes()) { + const children2 = node.childNodes; + for (const child of children2) { + child.nodeType === 3 ? m2.text(child.nodeValue) : _serialize(m2, child); + } + } + return m2.close(); + } + const stylesAttr = { + fill: "fill", + fillOpacity: "fill-opacity", + stroke: "stroke", + strokeOpacity: "stroke-opacity", + strokeWidth: "stroke-width", + strokeCap: "stroke-linecap", + strokeJoin: "stroke-linejoin", + strokeDash: "stroke-dasharray", + strokeDashOffset: "stroke-dashoffset", + strokeMiterLimit: "stroke-miterlimit", + opacity: "opacity" + }; + const stylesCss = { + blend: "mix-blend-mode" + }; + const rootAttributes = { + "fill": "none", + "stroke-miterlimit": 10 + }; + const RootIndex = 0, xmlns = "http://www.w3.org/2000/xmlns/", svgns = metadata.xmlns; + class SVGRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._dirtyID = 0; + this._dirty = []; + this._svg = null; + this._root = null; + this._defs = null; + } + /** + * Initialize a new SVGRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._defs = {}; + this._clearDefs(); + if (el) { + this._svg = domChild(el, 0, "svg", svgns); + this._svg.setAttributeNS(xmlns, "xmlns", svgns); + this._svg.setAttributeNS(xmlns, "xmlns:xlink", metadata["xmlns:xlink"]); + this._svg.setAttribute("version", metadata["version"]); + this._svg.setAttribute("class", "marks"); + domClear(el, 1); + this._root = domChild(this._svg, RootIndex, "g", svgns); + setAttributes(this._root, rootAttributes); + domClear(this._svg, RootIndex + 1); + } + this.background(this._bgcolor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length && this._svg) { + this._svg.style.setProperty("background-color", bgcolor); + } + return super.background(...arguments); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._svg) { + setAttributes(this._svg, { + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` }); - return pulse; - } -}); -/** - * Queue modified scenegraph items for rendering. - * @constructor - */ function Render(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Render, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - pulse.visit(pulse.ALL, (item)=>view.dirty(item)); - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - const item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - } -}); -const tempBounds = new (0, _vegaScenegraph.Bounds)(); -function set(item, property, value) { - return item[property] === value ? 0 : (item[property] = value, 1); -} -function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; -} -function axisIndices(datum) { - let index = +datum.grid; - return [ - datum.ticks ? index++ : -1, - // ticks index - datum.labels ? index++ : -1, - // labels index - index + +datum.domain // title index - ]; -} -function axisLayout(view, axis, width, height) { - var item = axis.items[0], datum = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum), range = item.range, offset = item.offset, position = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds = item.bounds, dl = title && (0, _vegaScenegraph.multiLineOffset)(title), x = 0, y = 0, i, s; - tempBounds.clear().union(bounds); - bounds.clear(); - if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); - // position axis group and title - switch(orient){ - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - // update bounds - (0, _vegaScenegraph.boundStroke)(bounds.translate(x, y), item); - if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) { - item.bounds = tempBounds; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - return item.mark.bounds.clear().union(bounds); -} -function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - view.dirty(title); - isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - bounds.union(b); -} -// aggregation functions for grid margin determination -const min = (a, b)=>Math.floor(Math.min(a, b)); -const max = (a, b)=>Math.ceil(Math.max(a, b)); -function gridLayoutGroups(group) { - var groups = group.items, n = groups.length, i = 0, mark, items; - const views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - // layout axes, gather legends, collect bounds - for(; i < n; ++i){ - mark = groups[i]; - items = mark.items; - if (mark.marktype === Group) switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - break; - case RowHeader: - views.rowheaders.push(...items); - break; - case RowFooter: - views.rowfooters.push(...items); - break; - case ColHeader: - views.colheaders.push(...items); - break; - case ColFooter: - views.colfooters.push(...items); - break; - case RowTitle: - views.rowtitle = items[0]; - break; - case ColTitle: - views.coltitle = items[0]; - break; - default: - views.marks.push(...items); - } + this._root.setAttribute("transform", `translate(${this._origin})`); + } + this._dirty = []; + return this; } - return views; -} -function bboxFlush(item) { - return new (0, _vegaScenegraph.Bounds)().set(0, 0, item.width || 0, item.height || 0); -} -function bboxFull(item) { - const b = item.bounds.clone(); - return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0)); -} -function get(opt, key, d) { - const v = (0, _vegaUtil.isObject)(opt) ? opt[key] : opt; - return v != null ? v : d !== undefined ? d : 0; -} -function offsetValue(v) { - return v < 0 ? Math.ceil(-v) : 0; -} -function gridLayout(view, groups, opt) { - var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds = tempBounds.set(0, 0, 0, 0), alignCol = get(opt.align, Column), alignRow = get(opt.align, Row), padCol = get(opt.padding, Column), padRow = get(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m, i, c, r, b, g, px, py, x, y, offset; - for(i = 0; i < ncols; ++i)xExtent[i] = 0; - for(i = 0; i < nrows; ++i)yExtent[i] = 0; - // determine offsets for each group - for(i = 0; i < n; ++i){ - g = groups[i]; - b = boxes[i] = bbox(g); - g.x = g.x || 0; - dx[i] = 0; - g.y = g.y || 0; - dy[i] = 0; - c = i % ncols; - r = ~~(i / ncols); - xMax = Math.max(xMax, px = Math.ceil(b.x2)); - yMax = Math.max(yMax, py = Math.ceil(b.y2)); - xExtent[c] = Math.max(xExtent[c], px); - yExtent[r] = Math.max(yExtent[r], py); - xOffset[i] = padCol + offsetValue(b.x1); - yOffset[i] = padRow + offsetValue(b.y1); - if (dirty) view.dirty(groups[i]); - } - // set initial alignment offsets - for(i = 0; i < n; ++i){ - if (i % ncols === 0) xOffset[i] = 0; - if (i < ncols) yOffset[i] = 0; - } - // enforce column alignment constraints - if (alignCol === Each) for(c = 1; c < ncols; ++c){ - for(offset = 0, i = c; i < n; i += ncols)if (offset < xOffset[i]) offset = xOffset[i]; - for(i = c; i < n; i += ncols)xOffset[i] = offset + xExtent[c - 1]; - } - else if (alignCol === All) { - for(offset = 0, i = 0; i < n; ++i)if (i % ncols && offset < xOffset[i]) offset = xOffset[i]; - for(i = 0; i < n; ++i)if (i % ncols) xOffset[i] = offset + xMax; - } else { - for(alignCol = false, c = 1; c < ncols; ++c)for(i = c; i < n; i += ncols)xOffset[i] += xExtent[c - 1]; + /** + * Returns the SVG element of the visualization. + * @return {DOMElement} - The SVG element. + */ + canvas() { + return this._svg; } - // enforce row alignment constraints - if (alignRow === Each) for(r = 1; r < nrows; ++r){ - for(offset = 0, i = r * ncols, m = i + ncols; i < m; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = r * ncols; i < m; ++i)yOffset[i] = offset + yExtent[r - 1]; + /** + * Returns an SVG text string for the rendered content, + * or null if this renderer is currently headless. + */ + svg() { + const svg = this._svg, bg = this._bgcolor; + if (!svg) return null; + let node; + if (bg) { + svg.removeAttribute("style"); + node = domChild(svg, RootIndex, "rect", svgns); + setAttributes(node, { + width: this._width, + height: this._height, + fill: bg + }); + } + const text2 = serializeXML(svg); + if (bg) { + svg.removeChild(node); + this._svg.style.setProperty("background-color", bg); + } + return text2; } - else if (alignRow === All) { - for(offset = 0, i = ncols; i < n; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = ncols; i < n; ++i)yOffset[i] = offset + yMax; - } else { - for(alignRow = false, r = 1; r < nrows; ++r)for(i = r * ncols, m = i + ncols; i < m; ++i)yOffset[i] += yExtent[r - 1]; - } - // perform horizontal grid layout - for(x = 0, i = 0; i < n; ++i){ - x = xOffset[i] + (i % ncols ? x : 0); - dx[i] += x - groups[i].x; - } - // perform vertical grid layout - for(c = 0; c < ncols; ++c)for(y = 0, i = c; i < n; i += ncols){ - y += yOffset[i]; - dy[i] += y - groups[i].y; - } - // perform horizontal centering - if (alignCol && get(opt.center, Column) && nrows > 1) for(i = 0; i < n; ++i){ - b = alignCol === All ? xMax : xExtent[i % ncols]; - x = b - boxes[i].x2 - groups[i].x - dx[i]; - if (x > 0) dx[i] += x / 2; - } - // perform vertical centering - if (alignRow && get(opt.center, Row) && ncols !== 1) for(i = 0; i < n; ++i){ - b = alignRow === All ? yMax : yExtent[~~(i / ncols)]; - y = b - boxes[i].y2 - groups[i].y - dy[i]; - if (y > 0) dy[i] += y / 2; - } - // position grid relative to anchor - for(i = 0; i < n; ++i)bounds.union(boxes[i].translate(dx[i], dy[i])); - x = get(opt.anchor, X); - y = get(opt.anchor, Y); - switch(get(opt.anchor, Column)){ - case End: - x -= bounds.width(); - break; - case Middle: - x -= bounds.width() / 2; + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + if (this._dirtyCheck()) { + if (this._dirtyAll) this._clearDefs(); + this.mark(this._root, scene, void 0, markTypes); + domClear(this._root, 1); + } + this.defs(); + this._dirty = []; + ++this._dirtyID; + return this; } - switch(get(opt.anchor, Row)){ - case End: - y -= bounds.height(); - break; - case Middle: - y -= bounds.height() / 2; - } - x = Math.round(x); - y = Math.round(y); - // update mark positions, bounds, dirty - bounds.clear(); - for(i = 0; i < n; ++i)groups[i].mark.bounds.clear(); - for(i = 0; i < n; ++i){ - g = groups[i]; - g.x += dx[i] += x; - g.y += dy[i] += y; - bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); - if (dirty) view.dirty(g); - } - return bounds; -} -function trellisLayout(view, group, opt) { - var views = gridLayoutGroups(group), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x, y, x2, y2, anchor, band, offset; - // -- initial grid layout - const bounds = gridLayout(view, groups, opt); - if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid - // -- layout grid headers and footers -- - // perform row header layout - if (views.rowheaders) { - band = get(opt.headerBand, Row, null); - x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band); + // -- Manage rendering of items marked as dirty -- + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (item.dirty !== this._dirtyID) { + item.dirty = this._dirtyID; + this._dirty.push(item); + } } - // perform column header layout - if (views.colheaders) { - band = get(opt.headerBand, Column, null); - y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band); + /** + * Check if a mark item is considered dirty. + * @param {Item} item - The mark item. + */ + isDirty(item) { + return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; } - // perform row footer layout - if (views.rowfooters) { - band = get(opt.footerBand, Row, null); - x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band); + /** + * Internal method to check dirty status and, if possible, + * make targetted updates without a full rendering pass. + */ + _dirtyCheck() { + this._dirtyAll = true; + const items = this._dirty; + if (!items.length || !this._dirtyID) return true; + const id2 = ++this._dirtyID; + let item, mark, type2, mdef, i, n, o; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + mark = item.mark; + if (mark.marktype !== type2) { + type2 = mark.marktype; + mdef = Marks[type2]; + } + if (mark.zdirty && mark.dirty !== id2) { + this._dirtyAll = false; + dirtyParents(item, id2); + mark.items.forEach((i2) => { + i2.dirty = id2; + }); + } + if (mark.zdirty) continue; + if (item.exit) { + if (mdef.nested && mark.items.length) { + o = mark.items[0]; + if (o._svg) this._update(mdef, o._svg, o); + } else if (item._svg) { + o = item._svg.parentNode; + if (o) o.removeChild(item._svg); + } + item._svg = null; + continue; + } + item = mdef.nested ? mark.items[0] : item; + if (item._update === id2) continue; + if (!item._svg || !item._svg.ownerSVGElement) { + this._dirtyAll = false; + dirtyParents(item, id2); + } else { + this._update(mdef, item._svg, item); + } + item._update = id2; + } + return !this._dirtyAll; } - // perform column footer layout - if (views.colfooters) { - band = get(opt.footerBand, Column, null); - y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band); + // -- Construct & maintain scenegraph to SVG mapping --- + /** + * Render a set of mark items. + * @param {SVGElement} el - The parent element in the SVG tree. + * @param {object} scene - The mark parent to render. + * @param {SVGElement} prev - The previous sibling in the SVG tree. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + mark(el, scene, prev, markTypes) { + if (!this.isDirty(scene)) { + return scene._svg; + } + const svg = this._svg, markType2 = scene.marktype, mdef = Marks[markType2], events2 = scene.interactive === false ? "none" : null, isGroup = mdef.tag === "g"; + const parent = bind$1(scene, el, prev, "g", svg); + if (markType2 !== "group" && markTypes != null && !markTypes.includes(markType2)) { + domClear(parent, 0); + return scene._svg; + } + parent.setAttribute("class", cssClass(scene)); + const aria = ariaMarkAttributes(scene); + for (const key2 in aria) setAttribute(parent, key2, aria[key2]); + if (!isGroup) { + setAttribute(parent, "pointer-events", events2); + } + setAttribute(parent, "clip-path", scene.clip ? clip$1$1(this, scene, scene.group) : null); + let sibling = null, i = 0; + const process = (item) => { + const dirty = this.isDirty(item), node = bind$1(item, parent, sibling, mdef.tag, svg); + if (dirty) { + this._update(mdef, node, item); + if (isGroup) recurse(this, node, item, markTypes); + } + sibling = node; + ++i; + }; + if (mdef.nested) { + if (scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + domClear(parent, i); + return parent; } - // perform row title layout - if (views.rowtitle) { - anchor = get(opt.titleAnchor, Row); - offset = get(off, 'rowTitle'); - offset = anchor === End ? x2 + offset : x - offset; - band = get(opt.titleBand, Row, 0.5); - layoutTitle(view, views.rowtitle, offset, 0, bounds, band); + /** + * Update the attributes of an SVG element for a mark item. + * @param {object} mdef - The mark definition object + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + _update(mdef, el, item) { + element$1 = el; + values = el.__values__; + ariaItemAttributes(emit, item); + mdef.attr(emit, item, this); + const extra = mark_extras[mdef.type]; + if (extra) extra.call(this, mdef, el, item); + if (element$1) this.style(element$1, item); } - // perform column title layout - if (views.coltitle) { - anchor = get(opt.titleAnchor, Column); - offset = get(off, 'columnTitle'); - offset = anchor === End ? y2 + offset : y - offset; - band = get(opt.titleBand, Column, 0.5); - layoutTitle(view, views.coltitle, offset, 1, bounds, band); - } -} -function boundFlush(item, field) { - return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined; -} -function boundFull(item, field) { - return item.bounds[field]; -} -function layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) { - var n = groups.length, init = 0, edge = 0, i, j, k, m, b, h, g, x, y; - // if no groups, early exit and return 0 - if (!n) return init; - // compute margin - for(i = start; i < n; i += stride)if (groups[i]) init = agg(init, bound(groups[i], bf)); - // if no headers, return margin calculation - if (!headers.length) return init; - // check if number of headers exceeds number of rows or columns - if (headers.length > limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - // apply offset - init += offset; - // clear mark bounds for all headers - for(j = 0, m = headers.length; j < m; ++j){ - view.dirty(headers[j]); - headers[j].mark.bounds.clear(); - } - // layout each header - for(i = start, j = 0, m = headers.length; j < m; ++j, i += stride){ - h = headers[j]; - b = h.mark.bounds; - // search for nearest group to align to - // necessary if table has empty cells - for(k = i; k >= 0 && (g = groups[k]) == null; k -= back); - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; + /** + * Update the presentation attributes of an SVG element for a mark item. + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + style(el, item) { + if (item == null) return; + for (const prop in stylesAttr) { + let value2 = prop === "font" ? fontFamily(item) : item[prop]; + if (value2 === values[prop]) continue; + const name = stylesAttr[prop]; + if (value2 == null) { + el.removeAttribute(name); } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); + if (isGradient(value2)) { + value2 = gradientRef(value2, this._defs.gradient, href()); + } + el.setAttribute(name, value2 + ""); } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - // update current edge of layout bounds - edge = agg(edge, b[bf]); + values[prop] = value2; + } + for (const prop in stylesCss) { + setStyle(el, stylesCss[prop], item[prop]); + } } - return edge; -} -function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - // compute title coordinates - var x = offset, y = offset; - isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - // queue title for redraw - view.dirty(g); -} -// utility for looking up legend layout configuration -function lookup(config, orient) { - const opt = config[orient] || {}; - return (key, d)=>opt[key] != null ? opt[key] : config[key] != null ? config[key] : d; -} -// if legends specify offset directly, use the maximum specified value -function offsets(legends, value) { - let max = -Infinity; - legends.forEach((item)=>{ - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; -} -function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup(config, orient), offset = offsets(g, _('offset', 0)), anchor = _('anchor', Start), mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - switch(orient){ - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, - column: End, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, - row: End, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case TopLeft: - p.anchor = { - x: offset, - y: offset - }; - break; - case TopRight: - p.anchor = { - x: w - offset, - y: offset, - column: End - }; - break; - case BottomLeft: - p.anchor = { - x: offset, - y: h - offset, - row: End - }; - break; - case BottomRight: - p.anchor = { - x: w - offset, - y: h - offset, - column: End, - row: End - }; - break; + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + */ + defs() { + const svg = this._svg, defs = this._defs; + let el = defs.el, index2 = 0; + for (const id2 in defs.gradient) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateGradient(el, defs.gradient[id2], index2); + } + for (const id2 in defs.clipping) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateClipping(el, defs.clipping[id2], index2); + } + if (el) { + index2 === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index2); + } } - return p; -} -function legendLayout(view, legend) { - var item = legend.items[0], datum = item.datum, orient = item.orient, bounds = item.bounds, x = item.x, y = item.y, w, h; - // cache current bounds for later comparison - item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); - bounds.clear(); - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - if (datum.type === Symbols) legendEntryLayout(item.items[0].items[0].items[0].items); - if (orient !== None) { - item.x = x = 0; - item.y = y = 0; + /** + * Clear defs caches. + */ + _clearDefs() { + const def2 = this._defs; + def2.gradient = {}; + def2.clipping = {}; } - item.width = w; - item.height = h; - (0, _vegaScenegraph.boundStroke)(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - return item; -} -function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach((_)=>b.union(_.bounds)); - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - return b; -} -function legendGroupLayout(view, item, entry) { - var pad = item.padding, ex = pad - entry.x, ey = pad - entry.y; - if (!item.datum.title) { - if (ex || ey) translate(view, entry, ex, ey); + } + function dirtyParents(item, id2) { + for (; item && item.dirty !== id2; item = item.mark.group) { + item.dirty = id2; + if (item.mark && item.mark.dirty !== id2) { + item.mark.dirty = id2; + } else return; + } + } + function updateGradient(el, grad, index2) { + let i, n, stop2; + if (grad.gradient === "radial") { + let pt = domChild(el, index2++, "pattern", svgns); + setAttributes(pt, { + id: patternPrefix + grad.id, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + pt = domChild(pt, 0, "rect", svgns); + setAttributes(pt, { + width: 1, + height: 1, + fill: `url(${href()}#${grad.id})` + }); + el = domChild(el, index2++, "radialGradient", svgns); + setAttributes(el, { + id: grad.id, + fx: grad.x1, + fy: grad.y1, + fr: grad.r1, + cx: grad.x2, + cy: grad.y2, + r: grad.r2 + }); } else { - var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx = pad - title.x, ty = pad - title.y; - switch(title.orient){ - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate(view, entry, ex, ey); - switch(title.orient){ - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate(view, title, tx, ty); - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate(view, entry, -tx, 0); - translate(view, title, -tx, 0); - } + el = domChild(el, index2++, "linearGradient", svgns); + setAttributes(el, { + id: grad.id, + x1: grad.x1, + x2: grad.x2, + y1: grad.y1, + y2: grad.y2 + }); } -} -function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, s = e.bounds[y ? 'y2' : 'x2'] - item.padding, u = vgrad && lr ? s : 0, v = vgrad && lr ? 0 : s, o = y <= 0 ? 0 : (0, _vegaScenegraph.multiLineOffset)(title); - return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o)); -} -function translate(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); -} -function legendEntryLayout(entries) { - // get max widths for each column - const widths = entries.reduce((w, g)=>{ - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - // set dimensions of legend entry groups - entries.forEach((g)=>{ - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); -} -function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], frame = group.frame, orient = group.orient, anchor = group.anchor, offset = group.offset, padding = group.padding, title = group.items[0].items[0], subtitle = group.items[1] && group.items[1].items[0], end = orient === Left || orient === Right ? height : width, start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - if (frame !== Group) orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2); - else if (orient === Left) start = height, end = 0; - pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2; - if (subtitle && subtitle.text) { - // position subtitle - switch(orient){ - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - tempBounds.clear().union(subtitle.bounds); - tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds); - subtitle.mark.bounds.clear().union(tempBounds); - view.dirty(subtitle); - } - tempBounds.clear().union(subtitle.bounds); - } else tempBounds.clear(); - tempBounds.union(title.bounds); - // position title group - switch(orient){ - case Top: - x = pos; - y = viewBounds.y1 - tempBounds.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - if (set(group, 'x', x) | set(group, 'y', y)) { - tempBounds.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds); - mark.bounds.clear().union(tempBounds); - view.dirty(group); - } - return group.bounds; -} -/** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ function ViewLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(ViewLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - _.mark.items.forEach((group)=>{ - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - } -}); -function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; -} -function layoutGroup(view, group, _) { - var items = group.items, width = Math.max(0, group.width || 0), height = Math.max(0, group.height || 0), viewBounds = new (0, _vegaScenegraph.Bounds)().set(0, 0, width, height), xBounds = viewBounds.clone(), yBounds = viewBounds.clone(), legends = [], title, mark, orient, b, i, n; - // layout axes, gather legends, collect bounds - for(i = 0, n = items.length; i < n; ++i){ - mark = items[i]; - switch(mark.role){ - case AxisRole: - b = isYAxis(mark) ? xBounds : yBounds; - b.union(axisLayout(view, mark, width, height)); - break; - case TitleRole: - title = mark; - break; - case LegendRole: - legends.push(legendLayout(view, mark)); - break; - case FrameRole: - case ScopeRole: - case RowHeader: - case RowFooter: - case RowTitle: - case ColHeader: - case ColFooter: - case ColTitle: - xBounds.union(mark.bounds); - yBounds.union(mark.bounds); - break; - default: - viewBounds.union(mark.bounds); - } + for (i = 0, n = grad.stops.length; i < n; ++i) { + stop2 = domChild(el, i, "stop", svgns); + stop2.setAttribute("offset", grad.stops[i].offset); + stop2.setAttribute("stop-color", grad.stops[i].color); } - // layout legends, adjust viewBounds - if (legends.length) { - // group legends by orient - const l = {}; - legends.forEach((item)=>{ - orient = item.orient || Right; - if (orient !== None) (l[orient] || (l[orient] = [])).push(item); - }); - // perform grid layout for each orient group - for(const orient in l){ - const g = l[orient]; - gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height)); - } - // update view bounds - legends.forEach((item)=>{ - const b = item.bounds; - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient){ - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - else viewBounds.union(b); - }); + domClear(el, i); + return index2; + } + function updateClipping(el, clip2, index2) { + let mask; + el = domChild(el, index2, "clipPath", svgns); + el.setAttribute("id", clip2.id); + if (clip2.path) { + mask = domChild(el, 0, "path", svgns); + mask.setAttribute("d", clip2.path); + } else { + mask = domChild(el, 0, "rect", svgns); + setAttributes(mask, { + x: 0, + y: 0, + width: clip2.width, + height: clip2.height + }); } - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - // layout title, adjust bounds - if (title) viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - // override aggregated view bounds if content is clipped - if (group.clip) viewBounds.set(0, 0, group.width || 0, group.height || 0); - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); -} -function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, type = auto.type; - if (view._autosize < 1 || !type) return; - let viewWidth = view._width, viewHeight = view._height, width = Math.max(0, group.width || 0), left = Math.max(0, Math.ceil(-viewBounds.x1)), height = Math.max(0, group.height || 0), top = Math.max(0, Math.ceil(-viewBounds.y1)); - const right = Math.max(0, Math.ceil(viewBounds.x2 - width)), bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - if (type === None) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - view._resizeView(viewWidth, viewHeight, width, height, [ - left, - top - ], auto.resize); -} - -},{"vega-dataflow":"cFRfY","vega-scenegraph":"gJqm6","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gJqm6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "path", ()=>(0, _d3Path.path)); -parcelHelpers.export(exports, "Bounds", ()=>Bounds); -parcelHelpers.export(exports, "CanvasHandler", ()=>CanvasHandler); -parcelHelpers.export(exports, "CanvasRenderer", ()=>CanvasRenderer); -parcelHelpers.export(exports, "Gradient", ()=>Gradient); -parcelHelpers.export(exports, "GroupItem", ()=>GroupItem); -parcelHelpers.export(exports, "Handler", ()=>Handler); -parcelHelpers.export(exports, "HybridHandler", ()=>HybridHandler); -parcelHelpers.export(exports, "HybridRenderer", ()=>HybridRenderer); -parcelHelpers.export(exports, "Item", ()=>Item); -parcelHelpers.export(exports, "Marks", ()=>Marks); -parcelHelpers.export(exports, "RenderType", ()=>RenderType); -parcelHelpers.export(exports, "Renderer", ()=>Renderer); -parcelHelpers.export(exports, "ResourceLoader", ()=>ResourceLoader); -parcelHelpers.export(exports, "SVGHandler", ()=>SVGHandler); -parcelHelpers.export(exports, "SVGRenderer", ()=>SVGRenderer); -parcelHelpers.export(exports, "SVGStringRenderer", ()=>SVGStringRenderer); -parcelHelpers.export(exports, "Scenegraph", ()=>Scenegraph); -parcelHelpers.export(exports, "boundClip", ()=>boundClip); -parcelHelpers.export(exports, "boundContext", ()=>boundContext); -parcelHelpers.export(exports, "boundItem", ()=>boundItem); -parcelHelpers.export(exports, "boundMark", ()=>boundMark); -parcelHelpers.export(exports, "boundStroke", ()=>boundStroke); -parcelHelpers.export(exports, "domChild", ()=>domChild); -parcelHelpers.export(exports, "domClear", ()=>domClear); -parcelHelpers.export(exports, "domCreate", ()=>domCreate); -parcelHelpers.export(exports, "domFind", ()=>domFind); -parcelHelpers.export(exports, "font", ()=>font); -parcelHelpers.export(exports, "fontFamily", ()=>fontFamily); -parcelHelpers.export(exports, "fontSize", ()=>fontSize); -parcelHelpers.export(exports, "intersect", ()=>intersect); -parcelHelpers.export(exports, "intersectBoxLine", ()=>intersectBoxLine); -parcelHelpers.export(exports, "intersectPath", ()=>intersectPath); -parcelHelpers.export(exports, "intersectPoint", ()=>intersectPoint); -parcelHelpers.export(exports, "intersectRule", ()=>intersectRule); -parcelHelpers.export(exports, "lineHeight", ()=>lineHeight); -parcelHelpers.export(exports, "markup", ()=>markup); -parcelHelpers.export(exports, "multiLineOffset", ()=>multiLineOffset); -parcelHelpers.export(exports, "pathCurves", ()=>curves); -parcelHelpers.export(exports, "pathEqual", ()=>pathEqual); -parcelHelpers.export(exports, "pathParse", ()=>parse); -parcelHelpers.export(exports, "pathRectangle", ()=>vg_rect); -parcelHelpers.export(exports, "pathRender", ()=>pathRender); -parcelHelpers.export(exports, "pathSymbols", ()=>symbols); -parcelHelpers.export(exports, "pathTrail", ()=>vg_trail); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "renderModule", ()=>renderModule); -parcelHelpers.export(exports, "resetSVGClipId", ()=>resetSVGClipId); -parcelHelpers.export(exports, "resetSVGDefIds", ()=>resetSVGDefIds); -parcelHelpers.export(exports, "sceneEqual", ()=>sceneEqual); -parcelHelpers.export(exports, "sceneFromJSON", ()=>sceneFromJSON); -parcelHelpers.export(exports, "scenePickVisit", ()=>pickVisit); -parcelHelpers.export(exports, "sceneToJSON", ()=>sceneToJSON); -parcelHelpers.export(exports, "sceneVisit", ()=>visit); -parcelHelpers.export(exports, "sceneZOrder", ()=>zorder); -parcelHelpers.export(exports, "serializeXML", ()=>serializeXML); -parcelHelpers.export(exports, "setHybridRendererOptions", ()=>setHybridRendererOptions); -parcelHelpers.export(exports, "textMetrics", ()=>textMetrics); -var _vegaUtil = require("vega-util"); -var _d3Shape = require("d3-shape"); -var _d3Path = require("d3-path"); -var _vegaCanvas = require("vega-canvas"); -var _vegaLoader = require("vega-loader"); -var _vegaScale = require("vega-scale"); -let gradient_id = 0; -function resetSVGGradientId() { - gradient_id = 0; -} -const patternPrefix = 'p_'; -function isGradient(value) { - return value && value.gradient; -} -function gradientRef(g, defs, base) { - const type = g.gradient; - let id = g.id, prefix = type === 'radial' ? patternPrefix : ''; - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + gradient_id++; - if (type === 'radial') { - g.x1 = get(g.x1, 0.5); - g.y1 = get(g.y1, 0.5); - g.r1 = get(g.r1, 0); - g.x2 = get(g.x2, 0.5); - g.y2 = get(g.y2, 0.5); - g.r2 = get(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get(g.x1, 0); - g.y1 = get(g.y1, 0); - g.x2 = get(g.x2, 1); - g.y2 = get(g.y2, 0); - } - } - // register definition - defs[id] = g; - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; -} -function get(val, def) { - return val != null ? val : def; -} -function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({ - offset: offset, - color: color - }); - return gradient; - } - }; -} -const lookup = { - 'basis': { - curve: (0, _d3Shape.curveBasis) - }, - 'basis-closed': { - curve: (0, _d3Shape.curveBasisClosed) - }, - 'basis-open': { - curve: (0, _d3Shape.curveBasisOpen) - }, - 'bundle': { - curve: (0, _d3Shape.curveBundle), - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: (0, _d3Shape.curveCardinal), - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: (0, _d3Shape.curveCardinalOpen), - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: (0, _d3Shape.curveCardinalClosed), - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: (0, _d3Shape.curveCatmullRom), - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: (0, _d3Shape.curveCatmullRomClosed), - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: (0, _d3Shape.curveCatmullRomOpen), - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: (0, _d3Shape.curveLinear) - }, - 'linear-closed': { - curve: (0, _d3Shape.curveLinearClosed) - }, - 'monotone': { - horizontal: (0, _d3Shape.curveMonotoneY), - vertical: (0, _d3Shape.curveMonotoneX) - }, - 'natural': { - curve: (0, _d3Shape.curveNatural) - }, - 'step': { - curve: (0, _d3Shape.curveStep) - }, - 'step-after': { - curve: (0, _d3Shape.curveStepAfter) - }, - 'step-before': { - curve: (0, _d3Shape.curveStepBefore) - } -}; -function curves(type, orientation, tension) { - var entry = (0, _vegaUtil.hasOwnProperty)(lookup, type) && lookup[type], curve = null; - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) curve = curve[entry.tension](tension); - } - return curve; -} -const paramCounts = { - m: 2, - l: 2, - h: 1, - v: 1, - z: 0, - c: 6, - s: 4, - q: 4, - t: 2, - a: 7 -}; -const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; -const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; -const spacePattern = /^((\s+,?\s*)|(,\s*))/; -const flagPattern = /^[01]/; -function parse(path) { - const commands = []; - const matches = path.match(commandPattern) || []; - matches.forEach((str)=>{ - let cmd = str[0]; - const type = cmd.toLowerCase(); - // parse parameters - const paramCount = paramCounts[type]; - const params = parseParams(type, paramCount, str.slice(1).trim()); - const count = params.length; - // error checking based on parameter count - if (count < paramCount || count && count % paramCount !== 0) throw Error('Invalid SVG path, incorrect parameter count'); - // register the command - commands.push([ - cmd, - ...params.slice(0, paramCount) - ]); - // exit now if we're done, also handles zero-param 'z' - if (count === paramCount) return; - // handle implicit line-to - if (type === 'm') cmd = cmd === 'M' ? 'L' : 'l'; - // repeat command when given extended param list - for(let i = paramCount; i < count; i += paramCount)commands.push([ - cmd, - ...params.slice(i, i + paramCount) - ]); + domClear(el, 1); + return index2 + 1; + } + function recurse(renderer, el, group2, markTypes) { + el = el.lastChild.previousSibling; + let prev, idx = 0; + visit(group2, (item) => { + prev = renderer.mark(el, item, prev, markTypes); + ++idx; }); - return commands; -} -function parseParams(type, paramCount, segment) { - const params = []; - for(let index = 0; paramCount && index < segment.length;)for(let i = 0; i < paramCount; ++i){ - const pattern = type === 'a' && (i === 3 || i === 4) ? flagPattern : numberPattern; - const match = segment.slice(index).match(pattern); - if (match === null) throw Error('Invalid SVG path, incorrect parameter type'); - index += match[0].length; - params.push(+match[0]); - const ws = segment.slice(index).match(spacePattern); - if (ws !== null) index += ws[0].length; - } - return params; -} -const DegToRad = Math.PI / 180; -const Epsilon = 1e-14; -const HalfPi = Math.PI / 2; -const Tau = Math.PI * 2; -const HalfSqrt3 = Math.sqrt(3) / 2; -var segmentCache = {}; -var bezierCache = {}; -var join = [].join; -// Copied from Inkscape svgtopdf, thanks! -function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - const key = join.call(arguments); - if (segmentCache[key]) return segmentCache[key]; - const th = rotateX * DegToRad; - const sin_th = Math.sin(th); - const cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - let pl = px * px / (rx * rx) + py * py / (ry * ry); - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - const a00 = cos_th / rx; - const a01 = sin_th / rx; - const a10 = -sin_th / ry; - const a11 = cos_th / ry; - const x0 = a00 * ox + a01 * oy; - const y0 = a10 * ox + a11 * oy; - const x1 = a00 * x + a01 * y; - const y1 = a10 * x + a11 * y; - const d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - let sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - let sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - const xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - const yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - const th0 = Math.atan2(y0 - yc, x0 - xc); - const th1 = Math.atan2(y1 - yc, x1 - xc); - let th_arc = th1 - th0; - if (th_arc < 0 && sweep === 1) th_arc += Tau; - else if (th_arc > 0 && sweep === 0) th_arc -= Tau; - const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - const result = []; - for(let i = 0; i < segs; ++i){ - const th2 = th0 + i * th_arc / segs; - const th3 = th0 + (i + 1) * th_arc / segs; - result[i] = [ - xc, - yc, - th2, - th3, - rx, - ry, - sin_th, - cos_th - ]; - } - return segmentCache[key] = result; -} -function bezier(params) { - const key = join.call(params); - if (bezierCache[key]) return bezierCache[key]; - var cx = params[0], cy = params[1], th0 = params[2], th1 = params[3], rx = params[4], ry = params[5], sin_th = params[6], cos_th = params[7]; - const a00 = cos_th * rx; - const a01 = -sin_th * ry; - const a10 = sin_th * rx; - const a11 = cos_th * ry; - const cos_th0 = Math.cos(th0); - const sin_th0 = Math.sin(th0); - const cos_th1 = Math.cos(th1); - const sin_th1 = Math.sin(th1); - const th_half = 0.5 * (th1 - th0); - const sin_th_h2 = Math.sin(th_half * 0.5); - const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); - const x1 = cx + cos_th0 - t * sin_th0; - const y1 = cy + sin_th0 + t * cos_th0; - const x3 = cx + cos_th1; - const y3 = cy + sin_th1; - const x2 = x3 + t * sin_th1; - const y2 = y3 - t * cos_th1; - return bezierCache[key] = [ - a00 * x1 + a01 * y1, - a10 * x1 + a11 * y1, - a00 * x2 + a01 * y2, - a10 * x2 + a11 * y2, - a00 * x3 + a01 * y3, - a10 * x3 + a11 * y3 - ]; -} -const temp = [ - 'l', - 0, - 0, - 0, - 0, - 0, - 0, - 0 -]; -function scale$1(current, sX, sY) { - const c = temp[0] = current[0]; - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') temp[1] = sX * current[1]; - else if (c === 'v' || c === 'V') temp[1] = sY * current[1]; - else for(var i = 1, n = current.length; i < n; ++i)temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; - return temp; -} -function pathRender(context, path, l, t, sX, sY) { - var current, // current instruction - previous = null, x = 0, // current x - y = 0, // current y - controlX = 0, // current control point x - controlY = 0, // current control point y - tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; - if (l == null) l = 0; - if (t == null) t = 0; - if (sX == null) sX = 1; - if (sY == null) sY = sX; - if (context.beginPath) context.beginPath(); - for(var i = 0, len = path.length; i < len; ++i){ - current = path[i]; - if (sX !== 1 || sY !== 1) current = scale$1(current, sX, sY); - switch(current[0]){ - // first letter - case 'l': - // lineto, relative - x += current[1]; - y += current[2]; - context.lineTo(x + l, y + t); - break; - case 'L': - // lineto, absolute - x = current[1]; - y = current[2]; - context.lineTo(x + l, y + t); - break; - case 'h': - // horizontal lineto, relative - x += current[1]; - context.lineTo(x + l, y + t); - break; - case 'H': - // horizontal lineto, absolute - x = current[1]; - context.lineTo(x + l, y + t); - break; - case 'v': - // vertical lineto, relative - y += current[1]; - context.lineTo(x + l, y + t); - break; - case 'V': - // verical lineto, absolute - y = current[1]; - context.lineTo(x + l, y + t); - break; - case 'm': - // moveTo, relative - x += current[1]; - y += current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'M': - // moveTo, absolute - x = current[1]; - y = current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'c': - // bezierCurveTo, relative - tempX = x + current[5]; - tempY = y + current[6]; - controlX = x + current[3]; - controlY = y + current[4]; - context.bezierCurveTo(x + current[1] + l, // x1 - y + current[2] + t, // y1 - controlX + l, // x2 - controlY + t, // y2 - tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'C': - // bezierCurveTo, absolute - x = current[5]; - y = current[6]; - controlX = current[3]; - controlY = current[4]; - context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t); - break; - case 's': - // shorthand cubic bezierCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = x + current[1]; - controlY = y + current[2]; - x = tempX; - y = tempY; - break; - case 'S': - // shorthand cubic bezierCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = current[1]; - controlY = current[2]; - break; - case 'q': - // quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - controlX = x + current[1]; - controlY = y + current[2]; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'Q': - // quadraticCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = current[1]; - controlY = current[2]; - break; - case 't': - // shorthand quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[1]; - tempY = y + current[2]; - if (previous[0].match(/[QqTt]/) === null) { - // If there is no previous command or if the previous command was not a Q, q, T or t, - // assume the control point is coincident with the current point - controlX = x; - controlY = y; - } else if (previous[0] === 't') { - // calculate reflection of previous control points for t - controlX = 2 * x - tempControlX; - controlY = 2 * y - tempControlY; - } else if (previous[0] === 'q') { - // calculate reflection of previous control points for q - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - } - tempControlX = controlX; - tempControlY = controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = x + current[1]; - controlY = y + current[2]; - break; - case 'T': - tempX = current[1]; - tempY = current[2]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'a': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + x + l, - current[7] + y + t - ]); - x += current[6]; - y += current[7]; - break; - case 'A': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + l, - current[7] + t - ]); - x = current[6]; - y = current[7]; - break; - case 'z': - case 'Z': - x = anchorX; - y = anchorY; - context.closePath(); - break; - } - previous = current; - } -} -function drawArc(context, x, y, coords) { - const seg = segments(coords[5], // end x - coords[6], // end y - coords[0], // radius x - coords[1], // radius y - coords[3], // large flag - coords[4], // sweep flag - coords[2], // rotation - x, y); - for(let i = 0; i < seg.length; ++i){ - const bez = bezier(seg[i]); - context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); - } -} -const Tan30 = 0.5773502691896257; -const builtins = { - 'circle': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } - }, - 'cross': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); - } - }, - 'diamond': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); - } - }, - 'square': { - draw: function(context, size) { - var w = Math.sqrt(size), x = -w / 2; - context.rect(x, x, w, w); - } - }, - 'arrow': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 7, t = r / 2.5, v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } - }, - 'wedge': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30, b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); - } - }, - 'triangle': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30; - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } - }, - 'triangle-up': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); - } - }, - 'triangle-down': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); + domClear(el, 1 + idx); + } + function bind$1(item, el, sibling, tag, svg) { + let node = item._svg, doc; + if (!node) { + doc = el.ownerDocument; + node = domCreate(doc, tag, svgns); + item._svg = node; + if (item.mark) { + node.__data__ = item; + node.__values__ = { + fill: "default" + }; + if (tag === "g") { + const bg = domCreate(doc, "path", svgns); + node.appendChild(bg); + bg.__data__ = item; + const cg = domCreate(doc, "g", svgns); + node.appendChild(cg); + cg.__data__ = item; + const fg = domCreate(doc, "path", svgns); + node.appendChild(fg); + fg.__data__ = item; + fg.__values__ = { + fill: "default" + }; } + } + } + if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { + el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); + } + return node; + } + function siblingCheck(node, sibling) { + return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; + } + let element$1 = null, values = null; + const mark_extras = { + group(mdef, el, item) { + const fg = element$1 = el.childNodes[2]; + values = fg.__values__; + mdef.foreground(emit, item, this); + values = el.__values__; + element$1 = el.childNodes[1]; + mdef.content(emit, item, this); + const bg = element$1 = el.childNodes[0]; + mdef.background(emit, item, this); + const value2 = item.mark.interactive === false ? "none" : null; + if (value2 !== values.events) { + setAttribute(fg, "pointer-events", value2); + setAttribute(bg, "pointer-events", value2); + values.events = value2; + } + if (item.strokeForeground && item.stroke) { + const fill2 = item.fill; + setAttribute(fg, "display", null); + this.style(bg, item); + setAttribute(bg, "stroke", null); + if (fill2) item.fill = null; + values = fg.__values__; + this.style(fg, item); + if (fill2) item.fill = fill2; + element$1 = null; + } else { + setAttribute(fg, "display", "none"); + } }, - 'triangle-right': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } + image(mdef, el, item) { + if (item.smooth === false) { + setStyle(el, "image-rendering", "optimizeSpeed"); + setStyle(el, "image-rendering", "pixelated"); + } else { + setStyle(el, "image-rendering", null); + } }, - 'triangle-left': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); + text(mdef, el, item) { + const tl2 = textLines(item); + let key2, value2, doc, lh; + if (isArray(tl2)) { + value2 = tl2.map((_) => textValue(item, _)); + key2 = value2.join("\n"); + if (key2 !== values.text) { + domClear(el, 0); + doc = el.ownerDocument; + lh = lineHeight(item); + value2.forEach((t, i) => { + const ts2 = domCreate(doc, "tspan", svgns); + ts2.__data__ = item; + ts2.textContent = t; + if (i) { + ts2.setAttribute("x", 0); + ts2.setAttribute("dy", lh); + } + el.appendChild(ts2); + }); + values.text = key2; + } + } else { + value2 = textValue(item, tl2); + if (value2 !== values.text) { + el.textContent = value2; + values.text = value2; } - }, - 'stroke': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } -}; -function symbols(_) { - return (0, _vegaUtil.hasOwnProperty)(builtins, _) ? builtins[_] : customSymbol(_); -} -var custom = {}; -function customSymbol(path) { - if (!(0, _vegaUtil.hasOwnProperty)(custom, path)) { - const parsed = parse(path); - custom[path] = { - draw: function(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; + } + setAttribute(el, "font-family", fontFamily(item)); + setAttribute(el, "font-size", fontSize(item) + "px"); + setAttribute(el, "font-style", item.fontStyle); + setAttribute(el, "font-variant", item.fontVariant); + setAttribute(el, "font-weight", item.fontWeight); } - return custom[path]; -} -// See http://spencermortensen.com/articles/bezier-circle/ -const C = 0.448084975506; // C = 1 - c -function rectangleX(d) { - return d.x; -} -function rectangleY(d) { - return d.y; -} -function rectangleWidth(d) { - return d.width; -} -function rectangleHeight(d) { - return d.height; -} -function number(_) { - return typeof _ === 'function' ? _ : ()=>+_; -} -function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); -} -function vg_rect() { - var x = rectangleX, y = rectangleY, width = rectangleWidth, height = rectangleHeight, crTL = number(0), crTR = crTL, crBL = crTL, crBR = crTL, context = null; - function rectangle(_, x0, y0) { - var buffer, x1 = x0 != null ? x0 : +x.call(this, _), y1 = y0 != null ? y0 : +y.call(this, _), w = +width.call(this, _), h = +height.call(this, _), s = Math.min(w, h) / 2, tl = clamp(+crTL.call(this, _), 0, s), tr = clamp(+crTR.call(this, _), 0, s), bl = clamp(+crBL.call(this, _), 0, s), br = clamp(+crBR.call(this, _), 0, s); - if (!context) context = buffer = (0, _d3Path.path)(); - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) context.rect(x1, y1, w, h); - else { - var x2 = x1 + w, y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - if (buffer) { - context = null; - return buffer + '' || null; - } - } - rectangle.x = function(_) { - if (arguments.length) { - x = number(_); - return rectangle; - } else return x; - }; - rectangle.y = function(_) { - if (arguments.length) { - y = number(_); - return rectangle; - } else return y; - }; - rectangle.width = function(_) { - if (arguments.length) { - width = number(_); - return rectangle; - } else return width; - }; - rectangle.height = function(_) { - if (arguments.length) { - height = number(_); - return rectangle; - } else return height; - }; - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number(tl); - crTR = tr != null ? number(tr) : crTL; - crBR = br != null ? number(br) : crTL; - crBL = bl != null ? number(bl) : crTR; - return rectangle; - } else return crTL; - }; - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else return context; - }; - return rectangle; -} -function vg_trail() { - var x, y, size, defined, context = null, ready, x1, y1, r1; - function point(x2, y2, w2) { - const r2 = w2 / 2; - if (ready) { - var ux = y1 - y2, uy = x2 - x1; - if (ux || uy) { - // get normal vector - var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else context.arc(x2, y2, r2, 0, Tau); - context.closePath(); - } else ready = 1; - x1 = x2; - y1 = y2; - r1 = r2; - } - function trail(data) { - var i, n = data.length, d, defined0 = false, buffer; - if (context == null) context = buffer = (0, _d3Path.path)(); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - if (buffer) { - context = null; - return buffer + '' || null; - } + }; + function emit(name, value2, ns) { + if (value2 === values[name]) return; + if (ns) { + setAttributeNS(element$1, name, value2, ns); + } else { + setAttribute(element$1, name, value2); } - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else return x; - }; - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else return y; - }; - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else return size; - }; - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else return defined; - }; - trail.context = function(_) { - if (arguments.length) { - if (_ == null) context = null; - else context = _; - return trail; - } else return context; - }; - return trail; -} -function value$1(a, b) { - return a != null ? a : b; -} -const x = (item)=>item.x || 0, y = (item)=>item.y || 0, w = (item)=>item.width || 0, h = (item)=>item.height || 0, xw = (item)=>(item.x || 0) + (item.width || 0), yh = (item)=>(item.y || 0) + (item.height || 0), sa = (item)=>item.startAngle || 0, ea = (item)=>item.endAngle || 0, pa = (item)=>item.padAngle || 0, ir = (item)=>item.innerRadius || 0, or = (item)=>item.outerRadius || 0, cr = (item)=>item.cornerRadius || 0, tl = (item)=>value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item)=>value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item)=>value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item)=>value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item)=>value$1(item.size, 64), ts = (item)=>item.size || 1, def = (item)=>!(item.defined === false), type = (item)=>symbols(item.shape || 'circle'); -const arcShape = (0, _d3Shape.arc)().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = (0, _d3Shape.area)().x(x).y1(y).y0(yh).defined(def), areahShape = (0, _d3Shape.area)().y(y).x1(x).x0(xw).defined(def), lineShape = (0, _d3Shape.line)().x(x).y(y).defined(def), rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = (0, _d3Shape.symbol)().type(type).size(sz), trailShape = vg_trail().x(x).y(y).defined(def).size(ts); -function hasCornerRadius(item) { - return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; -} -function arc$1(context, item) { - return arcShape.context(context)(item); -} -function area$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function line$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); -} -function shape$1(context, item) { - return (item.mark.shape || item.shape).context(context)(item); -} -function symbol$1(context, item) { - return symbolShape.context(context)(item); -} -function trail$1(context, items) { - return trailShape.context(context)(items); -} -var clip_id = 1; -function resetSVGClipId() { - clip_id = 1; -} -function clip$1(renderer, item, size) { - var clip = item.clip, defs = renderer._defs, id = item.clip_id || (item.clip_id = 'clip' + clip_id++), c = defs.clipping[id] || (defs.clipping[id] = { - id: id - }); - if ((0, _vegaUtil.isFunction)(clip)) c.path = clip(null); - else if (hasCornerRadius(size)) c.path = rectangle(null, size, 0, 0); - else { - c.width = size.width || 0; - c.height = size.height || 0; + values[name] = value2; + } + function setStyle(el, name, value2) { + if (value2 !== values[name]) { + if (value2 == null) { + el.style.removeProperty(name); + } else { + el.style.setProperty(name, value2 + ""); + } + values[name] = value2; } - return 'url(#' + id + ')'; -} -function Bounds(b) { - this.clear(); - if (b) this.union(b); -} -Bounds.prototype = { - clone () { - return new Bounds(this); - }, - clear () { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }, - empty () { - return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; - }, - equals (b) { - return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2; - }, - set (x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; + } + function setAttributes(el, attrs) { + for (const key2 in attrs) { + setAttribute(el, key2, attrs[key2]); + } + } + function setAttribute(el, name, value2) { + if (value2 != null) { + el.setAttribute(name, value2); + } else { + el.removeAttribute(name); + } + } + function setAttributeNS(el, name, value2, ns) { + if (value2 != null) { + el.setAttributeNS(ns, name, value2); + } else { + el.removeAttributeNS(ns, name); + } + } + function href() { + let loc; + return typeof window === "undefined" ? "" : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; + } + class SVGStringRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._text = null; + this._defs = { + gradient: {}, + clipping: {} + }; + } + /** + * Returns the rendered SVG text string, + * or null if rendering has not yet occurred. + */ + svg() { + return this._text; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + */ + _render(scene) { + const m2 = markup(); + m2.open("svg", extend({}, metadata, { + class: "marks", + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` + })); + const bg = this._bgcolor; + if (bg && bg !== "transparent" && bg !== "none") { + m2.open("rect", { + width: this._width, + height: this._height, + fill: bg + }).close(); + } + m2.open("g", rootAttributes, { + transform: "translate(" + this._origin + ")" + }); + this.mark(m2, scene); + m2.close(); + this.defs(m2); + this._text = m2.close() + ""; + return this; + } + /** + * Render a set of mark items. + * @param {object} m - The markup context. + * @param {object} scene - The mark parent to render. + */ + mark(m2, scene) { + const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ariaItemAttributes, mdef.attr]; + m2.open("g", { + "class": cssClass(scene), + "clip-path": scene.clip ? clip$1$1(this, scene, scene.group) : null + }, ariaMarkAttributes(scene), { + "pointer-events": tag !== "g" && scene.interactive === false ? "none" : null + }); + const process = (item) => { + const href2 = this.href(item); + if (href2) m2.open("a", href2); + m2.open(tag, this.attr(scene, item, attrList, tag !== "g" ? tag : null)); + if (tag === "text") { + const tl2 = textLines(item); + if (isArray(tl2)) { + const attrs = { + x: 0, + dy: lineHeight(item) + }; + for (let i = 0; i < tl2.length; ++i) { + m2.open("tspan", i ? attrs : null).text(textValue(item, tl2[i])).close(); + } + } else { + m2.text(textValue(item, tl2)); + } + } else if (tag === "g") { + const fore = item.strokeForeground, fill2 = item.fill, stroke2 = item.stroke; + if (fore && stroke2) { + item.stroke = null; + } + m2.open("path", this.attr(scene, item, mdef.background, "bgrect")).close(); + m2.open("g", this.attr(scene, item, mdef.content)); + visit(item, (scene2) => this.mark(m2, scene2)); + m2.close(); + if (fore && stroke2) { + if (fill2) item.fill = null; + item.stroke = stroke2; + m2.open("path", this.attr(scene, item, mdef.foreground, "bgrect")).close(); + if (fill2) item.fill = fill2; + } else { + m2.open("path", this.attr(scene, item, mdef.foreground, "bgfore")).close(); + } + } + m2.close(); + if (href2) m2.close(); + }; + if (mdef.nested) { + if (scene.items && scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + return m2.close(); + } + /** + * Get href attributes for a hyperlinked mark item. + * @param {Item} item - The mark item. + */ + href(item) { + const href2 = item.href; + let attr2; + if (href2) { + if (attr2 = this._hrefs && this._hrefs[href2]) { + return attr2; } else { - this.x1 = x1; - this.x2 = x2; + this.sanitizeURL(href2).then((attr3) => { + attr3["xlink:href"] = attr3.href; + attr3.href = null; + (this._hrefs || (this._hrefs = {}))[href2] = attr3; + }); } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; + } + return null; + } + /** + * Get an object of SVG attributes for a mark item. + * @param {object} scene - The mark parent. + * @param {Item} item - The mark item. + * @param {array|function} attrs - One or more attribute emitters. + * @param {string} tag - The tag being rendered. + */ + attr(scene, item, attrs, tag) { + const object2 = {}, emit2 = (name, value2, ns, prefixed) => { + object2[prefixed || name] = value2; + }; + if (Array.isArray(attrs)) { + attrs.forEach((fn2) => fn2(emit2, item, this)); + } else { + attrs(emit2, item, this); + } + if (tag) { + style(object2, item, scene, tag, this._defs); + } + return object2; + } + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + * @param {object} m - The markup context. + */ + defs(m2) { + const gradient2 = this._defs.gradient, clipping = this._defs.clipping, count2 = Object.keys(gradient2).length + Object.keys(clipping).length; + if (count2 === 0) return; + m2.open("defs"); + for (const id2 in gradient2) { + const def2 = gradient2[id2], stops = def2.stops; + if (def2.gradient === "radial") { + m2.open("pattern", { + id: patternPrefix + id2, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + m2.open("rect", { + width: "1", + height: "1", + fill: "url(#" + id2 + ")" + }).close(); + m2.close(); + m2.open("radialGradient", { + id: id2, + fx: def2.x1, + fy: def2.y1, + fr: def2.r1, + cx: def2.x2, + cy: def2.y2, + r: def2.r2 + }); + } else { + m2.open("linearGradient", { + id: id2, + x1: def2.x1, + x2: def2.x2, + y1: def2.y1, + y2: def2.y2 + }); + } + for (let i = 0; i < stops.length; ++i) { + m2.open("stop", { + offset: stops[i].offset, + "stop-color": stops[i].color + }).close(); + } + m2.close(); + } + for (const id2 in clipping) { + const def2 = clipping[id2]; + m2.open("clipPath", { + id: id2 + }); + if (def2.path) { + m2.open("path", { + d: def2.path + }).close(); } else { - this.y1 = y1; - this.y2 = y2; + m2.open("rect", { + x: 0, + y: 0, + width: def2.width, + height: def2.height + }).close(); } - return this; - }, - add (x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }, - expand (d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }, - round () { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }, - scale (s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }, - translate (dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }, - rotate (angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); - }, - rotatedPoints (angle, x, y) { - var { x1, y1, x2, y2 } = this, cos = Math.cos(angle), sin = Math.sin(angle), cx = x - x * cos + y * sin, cy = y - x * sin - y * cos; - return [ - cos * x1 - sin * y1 + cx, - sin * x1 + cos * y1 + cy, - cos * x1 - sin * y2 + cx, - sin * x1 + cos * y2 + cy, - cos * x2 - sin * y1 + cx, - sin * x2 + cos * y1 + cy, - cos * x2 - sin * y2 + cx, - sin * x2 + cos * y2 + cy - ]; - }, - union (b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }, - intersect (b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }, - encloses (b) { - return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2; - }, - alignsWith (b) { - return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2); - }, - intersects (b) { - return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2); - }, - contains (x, y) { - return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2); - }, - width () { - return this.x2 - this.x1; - }, - height () { - return this.y2 - this.y1; + m2.close(); + } + m2.close(); } -}; -function Item(mark) { - this.mark = mark; - this.bounds = this.bounds || new Bounds(); -} -function GroupItem(mark) { - Item.call(this, mark); - this.items = this.items || []; -} -(0, _vegaUtil.inherits)(GroupItem, Item); -class ResourceLoader { - constructor(customLoader){ - this._pending = 0; - this._loader = customLoader || (0, _vegaLoader.loader)(); + } + function style(s2, item, scene, tag, defs) { + let styleList; + if (item == null) return s2; + if (tag === "bgrect" && scene.interactive === false) { + s2["pointer-events"] = "none"; } - pending() { - return this._pending; + if (tag === "bgfore") { + if (scene.interactive === false) { + s2["pointer-events"] = "none"; + } + s2.display = "none"; + if (item.fill !== null) return s2; + } + if (tag === "image" && item.smooth === false) { + styleList = ["image-rendering: optimizeSpeed;", "image-rendering: pixelated;"]; + } + if (tag === "text") { + s2["font-family"] = fontFamily(item); + s2["font-size"] = fontSize(item) + "px"; + s2["font-style"] = item.fontStyle; + s2["font-variant"] = item.fontVariant; + s2["font-weight"] = item.fontWeight; + } + for (const prop in stylesAttr) { + let value2 = item[prop]; + const name = stylesAttr[prop]; + if (value2 === "transparent" && (name === "fill" || name === "stroke")) ; + else if (value2 != null) { + if (isGradient(value2)) { + value2 = gradientRef(value2, defs.gradient, ""); + } + s2[name] = value2; + } } - sanitizeURL(uri) { - const loader = this; - increment(loader); - return loader._loader.sanitize(uri, { - context: 'href' - }).then((opt)=>{ - decrement(loader); - return opt; - }).catch(()=>{ - decrement(loader); - return null; - }); + for (const prop in stylesCss) { + const value2 = item[prop]; + if (value2 != null) { + styleList = styleList || []; + styleList.push(`${stylesCss[prop]}: ${value2};`); + } } - loadImage(uri) { - const loader = this, Image = (0, _vegaCanvas.image)(); - increment(loader); - return loader._loader.sanitize(uri, { - context: 'image' - }).then((opt)=>{ - const url = opt.href; - if (!url || !Image) throw { - url: url - }; - const img = new Image(); - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = (0, _vegaUtil.hasOwnProperty)(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - // attempt to load image resource - img.onload = ()=>decrement(loader); - img.onerror = ()=>decrement(loader); - img.src = url; - return img; - }).catch((e)=>{ - decrement(loader); - return { - complete: false, - width: 0, - height: 0, - src: e && e.url || '' - }; - }); + if (styleList) { + s2.style = styleList.join(" "); } - ready() { - const loader = this; - return new Promise((accept)=>{ - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(()=>{ - poll(true); - }, 10); - } - poll(false); - }); + return s2; + } + const OPTS = { + svgMarkTypes: ["text"], + svgOnTop: true, + debug: false + }; + function setHybridRendererOptions(options2) { + OPTS["svgMarkTypes"] = options2.svgMarkTypes ?? ["text"]; + OPTS["svgOnTop"] = options2.svgOnTop ?? true; + OPTS["debug"] = options2.debug ?? false; + } + class HybridRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._svgRenderer = new SVGRenderer(loader2); + this._canvasRenderer = new CanvasRenderer(loader2); } -} -function increment(loader) { - loader._pending += 1; -} -function decrement(loader) { - loader._pending -= 1; -} -function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; -} -function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; -} -const circleThreshold = Tau - 1e-8; -let bounds, lx, ly, rot, ma, mb, mc, md; -const add = (x, y)=>bounds.add(x, y); -const addL = (x, y)=>add(lx = x, ly = y); -const addX = (x)=>add(x, bounds.y1); -const addY = (y)=>add(bounds.x1, y); -const px = (x, y)=>ma * x + mc * y; -const py = (x, y)=>mb * x + md * y; -const addp = (x, y)=>add(px(x, y), py(x, y)); -const addpL = (x, y)=>addL(px(x, y), py(x, y)); -function boundContext(_, deg) { - bounds = _; - if (deg) { - rot = deg * DegToRad; - ma = md = Math.cos(rot); - mb = Math.sin(rot); - mc = -mb; + /** + * Initialize a new HybridRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {HybridRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._root_el = domChild(el, 0, "div"); + const bottomEl = domChild(this._root_el, 0, "div"); + const topEl = domChild(this._root_el, 1, "div"); + this._root_el.style.position = "relative"; + if (!OPTS.debug) { + bottomEl.style.height = "100%"; + topEl.style.position = "absolute"; + topEl.style.top = "0"; + topEl.style.left = "0"; + topEl.style.height = "100%"; + topEl.style.width = "100%"; + } + this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; + this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; + this._svgEl.style.pointerEvents = "none"; + this._canvasRenderer.initialize(this._canvasEl, width2, height2, origin, scaleFactor); + this._svgRenderer.initialize(this._svgEl, width2, height2, origin, scaleFactor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (OPTS.svgMarkTypes.includes(item.mark.marktype)) { + this._svgRenderer.dirty(item); + } else { + this._canvasRenderer.dirty(item); + } + return this; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + const allMarkTypes = markTypes ?? ["arc", "area", "image", "line", "path", "rect", "rule", "shape", "symbol", "text", "trail"]; + const canvasMarkTypes = allMarkTypes.filter((m2) => !OPTS.svgMarkTypes.includes(m2)); + this._svgRenderer.render(scene, OPTS.svgMarkTypes); + this._canvasRenderer.render(scene, canvasMarkTypes); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + this._svgRenderer.resize(width2, height2, origin, scaleFactor); + this._canvasRenderer.resize(width2, height2, origin, scaleFactor); + return this; + } + background(bgcolor) { + if (OPTS.svgOnTop) { + this._canvasRenderer.background(bgcolor); + } else { + this._svgRenderer.background(bgcolor); + } + return this; + } + } + class HybridHandler extends CanvasHandler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + } + initialize(el, origin, obj2) { + const canvas = domChild(domChild(el, 0, "div"), OPTS.svgOnTop ? 0 : 1, "div"); + return super.initialize(canvas, origin, obj2); + } + } + const Canvas = "canvas"; + const Hybrid = "hybrid"; + const PNG = "png"; + const SVG = "svg"; + const None$1 = "none"; + const RenderType = { + Canvas, + PNG, + SVG, + Hybrid, + None: None$1 + }; + const modules = {}; + modules[Canvas] = modules[PNG] = { + renderer: CanvasRenderer, + headless: CanvasRenderer, + handler: CanvasHandler + }; + modules[SVG] = { + renderer: SVGRenderer, + headless: SVGStringRenderer, + handler: SVGHandler + }; + modules[Hybrid] = { + renderer: HybridRenderer, + headless: HybridRenderer, + handler: HybridHandler + }; + modules[None$1] = {}; + function renderModule(name, _) { + name = String(name || "").toLowerCase(); + if (arguments.length > 1) { + modules[name] = _; + return this; } else { - ma = md = 1; - rot = mb = mc = 0; + return modules[name]; } - return context$1; -} -const context$1 = { - beginPath () {}, - closePath () {}, - moveTo: addpL, - lineTo: addpL, - rect (x, y, w, h) { - if (rot) { - addp(x + w, y); - addp(x + w, y + h); - addp(x, y + h); - addpL(x, y); - } else { - add(x + w, y + h); - addL(x, y); - } - }, - quadraticCurveTo (x1, y1, x2, y2) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2); - quadExtrema(lx, px1, px2, addX); - quadExtrema(ly, py1, py2, addY); - addL(px2, py2); - }, - bezierCurveTo (x1, y1, x2, y2, x3, y3) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); - cubicExtrema(lx, px1, px2, px3, addX); - cubicExtrema(ly, py1, py2, py3, addY); - addL(px3, py3); - }, - arc (cx, cy, r, sa, ea, ccw) { - sa += rot; - ea += rot; - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add(cx - r, cy - r); - add(cx + r, cy + r); - } else { - const update = (a)=>add(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - // sample end points - update(sa); - update(ea); - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; - if (sa < 0) sa += Tau; - ea = ea % Tau; - if (ea < 0) ea += Tau; - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; - sa = ea; - ea = s; // swap end-points - } - if (ccw) { - ea -= Tau; - s = sa - sa % HalfPi; - for(i = 0; i < 4 && s > ea; ++i, s -= HalfPi)update(s); - } else { - s = sa - sa % HalfPi + HalfPi; - for(i = 0; i < 4 && s < ea; ++i, s = s + HalfPi)update(s); - } - } + } + function intersect$2(scene, bounds2, filter2) { + const hits = [], box2 = new Bounds().union(bounds2), type2 = scene.marktype; + return type2 ? intersectMark(scene, box2, filter2, hits) : type2 === "group" ? intersectGroup(scene, box2, filter2, hits) : error("Intersect scene must be mark node or group item."); + } + function intersectMark(mark, box2, filter2, hits) { + if (visitMark(mark, box2, filter2)) { + const items = mark.items, type2 = mark.marktype, n = items.length; + let i = 0; + if (type2 === "group") { + for (; i < n; ++i) { + intersectGroup(items[i], box2, filter2, hits); + } + } else { + for (const test2 = Marks[type2].isect; i < n; ++i) { + const item = items[i]; + if (intersectItem(item, box2, test2)) hits.push(item); } + } } -}; -function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); -} -function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, b = x0 + x2 - 2 * x1, c = x0 - x1; - let t0 = 0, t1 = 0, r; - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else // linear equation - t0 = 0.5 * c / b; - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); -} -function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3; -} -var context = (context = (0, _vegaCanvas.canvas)(1, 1)) ? context.getContext('2d') : null; -const b = new Bounds(); -function intersectPath(draw) { - return function(item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context) return true; - // add path to offscreen graphics context - draw(context, item); - // get bounds intersection region - b.clear().union(item.bounds).intersect(brush).round(); - const { x1, y1, x2, y2 } = b; - // iterate over intersection region - // perform fine grained inclusion test - for(let y = y1; y <= y2; ++y)for(let x = x1; x <= x2; ++x){ - if (context.isPointInPath(x, y)) return true; - } - // false if no hits in intersection region - return false; - }; -} -function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); -} -function intersectRect(item, box) { - const x = item.x || 0, y = item.y || 0, w = item.width || 0, h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); -} -function intersectRule(item, box) { - const x = item.x || 0, y = item.y || 0, x2 = item.x2 != null ? item.x2 : x, y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); -} -function intersectBoxLine(box, x, y, u, v) { - const { x1, y1, x2, y2 } = box, dx = u - x, dy = v - y; - let t0 = 0, t1 = 1, p, q, r, e; - for(e = 0; e < 4; ++e){ - if (e === 0) { - p = -dx; - q = -(x1 - x); - } - if (e === 1) { - p = dx; - q = x2 - x; - } - if (e === 2) { - p = -dy; - q = -(y1 - y); - } - if (e === 3) { - p = dy; - q = y2 - y; - } - if (Math.abs(p) < 1e-10 && q < 0) return false; - r = q / p; - if (p < 0) { - if (r > t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } + return hits; + } + function visitMark(mark, box2, filter2) { + return mark.bounds && box2.intersects(mark.bounds) && (mark.marktype === "group" || mark.interactive !== false && (!filter2 || filter2(mark))); + } + function intersectGroup(group2, box2, filter2, hits) { + if (filter2 && filter2(group2.mark) && intersectItem(group2, box2, Marks.group.isect)) { + hits.push(group2); } - return true; -} -function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; -} -function value(value, dflt) { - return value == null ? dflt : value; -} -function addStops(gradient, stops) { - const n = stops.length; - for(let i = 0; i < n; ++i)gradient.addColorStop(stops[i].offset, stops[i].color); - return gradient; -} -function gradient(context, spec, bounds) { - const w = bounds.width(), h = bounds.height(); - let gradient; - if (spec.gradient === 'radial') gradient = context.createRadialGradient(bounds.x1 + value(spec.x1, 0.5) * w, bounds.y1 + value(spec.y1, 0.5) * h, Math.max(w, h) * value(spec.r1, 0), bounds.x1 + value(spec.x2, 0.5) * w, bounds.y1 + value(spec.y2, 0.5) * h, Math.max(w, h) * value(spec.r2, 0.5)); - else { - // linear gradient - const x1 = value(spec.x1, 0), y1 = value(spec.y1, 0), x2 = value(spec.x2, 1), y2 = value(spec.y2, 0); - if (x1 === x2 || y1 === y2 || w === h) // axis aligned: use normal gradient - gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h); - else { - // not axis aligned: render gradient into a pattern (#2365) - // this allows us to use normalized bounding box coordinates - const image = (0, _vegaCanvas.canvas)(Math.ceil(w), Math.ceil(h)), ictx = image.getContext('2d'); - ictx.scale(w, h); - ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops); - ictx.fillRect(0, 0, w, h); - return context.createPattern(image, 'no-repeat'); - } - } - return addStops(gradient, spec.stops); -} -function color(context, item, value) { - return isGradient(value) ? gradient(context, value, item.bounds) : value; -} -function fill(context, item, opacity) { - opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else return false; -} -var Empty = []; -function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - if (lw <= 0) return false; - opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty); - context.lineDashOffset = item.strokeDashOffset || 0; - } - return true; - } else return false; -} -function compare(a, b) { - return a.zindex - b.zindex || a.index - b.index; -} -function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - var items = scene.items, output = [], item, i, n; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - item.index = i; - if (item.zindex) output.push(item); + const marks = group2.items, n = marks && marks.length; + if (n) { + const x2 = group2.x || 0, y2 = group2.y || 0; + box2.translate(-x2, -y2); + for (let i = 0; i < n; ++i) { + intersectMark(marks[i], box2, filter2, hits); + } + box2.translate(x2, y2); } - scene.zdirty = false; - return scene.zitems = output.sort(compare); -} -function visit(scene, visitor) { - var items = scene.items, i, n; - if (!items || !items.length) return; - const zitems = zorder(scene); - if (zitems && zitems.length) { - for(i = 0, n = items.length; i < n; ++i)if (!items[i].zindex) visitor(items[i]); - items = zitems; + return hits; + } + function intersectItem(item, box2, test2) { + const bounds2 = item.bounds; + return box2.encloses(bounds2) || box2.intersects(bounds2) && test2(item, box2); + } + const clipBounds = new Bounds(); + function boundClip(mark) { + const clip2 = mark.clip; + if (isFunction(clip2)) { + clip2(boundContext(clipBounds.clear())); + } else if (clip2) { + clipBounds.set(0, 0, mark.group.width, mark.group.height); + } else return; + mark.bounds.intersect(clipBounds); + } + const TOLERANCE = 1e-9; + function sceneEqual(a2, b2, key2) { + return a2 === b2 ? true : key2 === "path" ? pathEqual(a2, b2) : a2 instanceof Date && b2 instanceof Date ? +a2 === +b2 : isNumber$1(a2) && isNumber$1(b2) ? Math.abs(a2 - b2) <= TOLERANCE : !a2 || !b2 || !isObject(a2) && !isObject(b2) ? a2 == b2 : objectEqual(a2, b2); + } + function pathEqual(a2, b2) { + return sceneEqual(parse$3(a2), parse$3(b2)); + } + function objectEqual(a2, b2) { + var ka = Object.keys(a2), kb = Object.keys(b2), key2, i; + if (ka.length !== kb.length) return false; + ka.sort(); + kb.sort(); + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) return false; } - for(i = 0, n = items.length; i < n; ++i)visitor(items[i]); -} -function pickVisit(scene, visitor) { - var items = scene.items, hit, i; - if (!items || !items.length) return null; - const zitems = zorder(scene); - if (zitems && zitems.length) items = zitems; - for(i = items.length; --i >= 0;){ - if (hit = visitor(items[i])) return hit; + for (i = ka.length - 1; i >= 0; i--) { + key2 = ka[i]; + if (!sceneEqual(a2[key2], b2[key2], key2)) return false; } - if (items === zitems) { - for(items = scene.items, i = items.length; --i >= 0;)if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; + return typeof a2 === typeof b2; + } + function resetSVGDefIds() { + resetSVGClipId(); + resetSVGGradientId(); + } + const Top$1 = "top"; + const Left$1 = "left"; + const Right$1 = "right"; + const Bottom$1 = "bottom"; + const TopLeft = "top-left"; + const TopRight = "top-right"; + const BottomLeft = "bottom-left"; + const BottomRight = "bottom-right"; + const Start$1 = "start"; + const Middle$1 = "middle"; + const End$1 = "end"; + const X = "x"; + const Y = "y"; + const Group = "group"; + const AxisRole$1 = "axis"; + const TitleRole$1 = "title"; + const FrameRole$1 = "frame"; + const ScopeRole$1 = "scope"; + const LegendRole$1 = "legend"; + const RowHeader = "row-header"; + const RowFooter = "row-footer"; + const RowTitle = "row-title"; + const ColHeader = "column-header"; + const ColFooter = "column-footer"; + const ColTitle = "column-title"; + const Padding$1 = "padding"; + const Symbols$1 = "symbol"; + const Fit = "fit"; + const FitX = "fit-x"; + const FitY = "fit-y"; + const Pad = "pad"; + const None = "none"; + const All = "all"; + const Each = "each"; + const Flush = "flush"; + const Column = "column"; + const Row = "row"; + function Bound$1(params2) { + Transform.call(this, null, params2); + } + inherits(Bound$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow, mark = _.mark, type2 = mark.marktype, entry2 = Marks[type2], bound2 = entry2.bound; + let markBounds = mark.bounds, rebound; + if (entry2.nested) { + if (mark.items.length) view.dirty(mark.items[0]); + markBounds = boundItem(mark, bound2); + mark.items.forEach((item) => { + item.bounds.clear().union(markBounds); + }); + } else if (type2 === Group || _.modified()) { + pulse2.visit(pulse2.MOD, (item) => view.dirty(item)); + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(boundItem(item, bound2))); + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + pulse2.reflow(); + } + } else { + rebound = pulse2.changed(pulse2.REM); + pulse2.visit(pulse2.ADD, (item) => { + markBounds.union(boundItem(item, bound2)); + }); + pulse2.visit(pulse2.MOD, (item) => { + rebound = rebound || markBounds.alignsWith(item.bounds); + view.dirty(item); + markBounds.union(boundItem(item, bound2)); + }); + if (rebound) { + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(item.bounds)); } + } + boundClip(mark); + return pulse2.modifies("bounds"); + } + }); + function boundItem(item, bound2, opt) { + return bound2(item.bounds.clear(), item, opt); + } + const COUNTER_NAME = ":vega_identifier:"; + function Identifier$1(params2) { + Transform.call(this, 0, params2); + } + Identifier$1.Definition = { + "type": "Identifier", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "as", + "type": "string", + "required": true + }] + }; + inherits(Identifier$1, Transform, { + transform(_, pulse2) { + const counter = getCounter(pulse2.dataflow), as = _.as; + let id2 = counter.value; + pulse2.visit(pulse2.ADD, (t) => t[as] = t[as] || ++id2); + counter.set(this.value = id2); + return pulse2; + } + }); + function getCounter(view) { + return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); + } + function Mark$1(params2) { + Transform.call(this, null, params2); + } + inherits(Mark$1, Transform, { + transform(_, pulse2) { + let mark = this.value; + if (!mark) { + mark = pulse2.dataflow.scenegraph().mark(_.markdef, lookup$1$1(_), _.index); + mark.group.context = _.context; + if (!_.context.group) _.context.group = mark.group; + mark.source = this.source; + mark.clip = _.clip; + mark.interactive = _.interactive; + this.value = mark; + } + const Init = mark.marktype === Group ? GroupItem : Item; + pulse2.visit(pulse2.ADD, (item) => Init.call(item, mark)); + if (_.modified("clip") || _.modified("interactive")) { + mark.clip = _.clip; + mark.interactive = !!_.interactive; + mark.zdirty = true; + pulse2.reflow(); + } + mark.items = pulse2.source; + return pulse2; } - return null; -} -function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, (item)=>{ - if (!bounds || bounds.intersects(item.bounds)) drawPath(path, context, item, item); - }); - }; -} -function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) drawPath(path, context, scene.items[0], scene.items); - }; -} -function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - if (path(context, items)) return; - blend(context, item); - if (item.fill && fill(context, item, opacity)) context.fill(); - if (item.stroke && stroke(context, item, opacity)) context.stroke(); -} -function pick$1(test) { - test = test || (0, _vegaUtil.truthy); - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - return pickVisit(scene, (item)=>{ - const b = item.bounds; - // first hit test against bounding box - if (b && !b.contains(gx, gy) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; - }); - }; -} -function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, fill = filled == null ? item.fill : filled, stroke = item.stroke && context.isPointInStroke, lw, lc; - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y); - }; -} -function pickPath(path) { - return pick$1(hitPath(path)); -} -function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} -function rotate(a) { - return 'rotate(' + a + ')'; -} -function scale(scaleX, scaleY) { - return 'scale(' + scaleX + ',' + scaleY + ')'; -} -function translateItem(item) { - return translate(item.x || 0, item.y || 0); -} -function rotateItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : ''); -} -function transformItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : ''); -} -function markItemPath(type, shape, isect) { - function attr(emit, item) { - emit('transform', rotateItem(item)); - emit('d', shape(null, item)); - } - function bound(bounds, item) { - shape(boundContext(bounds, item.angle), item); - return boundStroke(bounds, item).translate(item.x || 0, item.y || 0); - } - function draw(context, item) { - var x = item.x || 0, y = item.y || 0, a = item.angle || 0; - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); + }); + function lookup$1$1(_) { + const g = _.groups, p = _.parent; + return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; + } + function Overlap$1(params2) { + Transform.call(this, null, params2); + } + const methods = { + parity: (items) => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1), + greedy: (items, sep) => { + let a2; + return items.filter((b2, i) => !i || !intersect$1(a2.bounds, b2.bounds, sep) ? (a2 = b2, 1) : b2.opacity = 0); } - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; -} -var arc = markItemPath('arc', arc$1); -function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], z = a[0].orient === 'horizontal' ? 'y' : 'x', i = a.length, min = Infinity, hit, d; - while(--i >= 0){ - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - return hit; -} -function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; + }; + const intersect$1 = (a2, b2, sep) => sep > Math.max(b2.x1 - a2.x2, a2.x1 - b2.x2, b2.y1 - a2.y2, a2.y1 - b2.y2); + const hasOverlap = (items, pad2) => { + for (var i = 1, n = items.length, a2 = items[0].bounds, b2; i < n; a2 = b2, ++i) { + if (intersect$1(a2, b2 = items[i].bounds, pad2)) return true; } - return null; -} -function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx * dx) return a[i]; + }; + const hasBounds = (item) => { + const b2 = item.bounds; + return b2.width() > 1 && b2.height() > 1; + }; + const boundTest = (scale2, orient, tolerance) => { + var range2 = scale2.range(), b2 = new Bounds(); + if (orient === Top$1 || orient === Bottom$1) { + b2.set(range2[0], -Infinity, range2[1], Infinity); + } else { + b2.set(-Infinity, range2[0], Infinity, range2[1]); } - return null; -} -function markMultiItemPath(type, shape, tip) { - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) return bounds; - else { - shape(boundContext(bounds), items); - return boundStroke(bounds, items[0]); + b2.expand(tolerance || 1); + return (item) => b2.encloses(item.bounds); + }; + const reset = (source2) => { + source2.forEach((item) => item.opacity = 1); + return source2; + }; + const reflow = (pulse2, _) => pulse2.reflow(_.modified()).modifies("opacity"); + inherits(Overlap$1, Transform, { + transform(_, pulse2) { + const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; + let source2 = pulse2.materialize(pulse2.SOURCE).source, items, test2; + if (!source2 || !source2.length) return; + if (!_.method) { + if (_.modified("method")) { + reset(source2); + pulse2 = reflow(pulse2, _); + } + return pulse2; + } + source2 = source2.filter(hasBounds); + if (!source2.length) return; + if (_.sort) { + source2 = source2.slice().sort(_.sort); + } + items = reset(source2); + pulse2 = reflow(pulse2, _); + if (items.length >= 3 && hasOverlap(items, sep)) { + do { + items = reduce(items, sep); + } while (items.length >= 3 && hasOverlap(items, sep)); + if (items.length < 3 && !peek$1(source2).opacity) { + if (items.length > 1) peek$1(items).opacity = 0; + peek$1(source2).opacity = 1; } + } + if (_.boundScale && _.boundTolerance >= 0) { + test2 = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); + source2.forEach((item) => { + if (!test2(item)) item.opacity = 0; + }); + } + const bounds2 = items[0].mark.bounds.clear(); + source2.forEach((item) => { + if (item.opacity) bounds2.union(item.bounds); + }); + return pulse2; } - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - const hit = hitPath(draw); - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, b = scene.bounds; - if (!items || !items.length || b && !b.contains(gx, gy)) return null; - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; + }); + function Render$1(params2) { + Transform.call(this, null, params2); + } + inherits(Render$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + pulse2.visit(pulse2.ALL, (item) => view.dirty(item)); + if (pulse2.fields && pulse2.fields["zindex"]) { + const item = pulse2.source && pulse2.source[0]; + if (item) item.mark.zdirty = true; + } } - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; -} -var area = markMultiItemPath('area', area$1, pickArea); -function clip(context, scene) { - var clip = scene.clip; - context.save(); - if ((0, _vegaUtil.isFunction)(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else clipGroup(context, scene.group); -} -function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); -} -function offset$1(item) { - const sw = value(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; -} -function attr$5(emit, item) { - emit('transform', translateItem(item)); -} -function emitRectangle(emit, item) { - const off = offset$1(item); - emit('d', rectangle(null, item, off, off)); -} -function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); -} -function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) emitRectangle(emit, item); - else emit('d', ''); -} -function content(emit, item, renderer) { - const url = item.clip ? clip$1(renderer, item, item) : null; - emit('clip-path', url); -} -function bound$5(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for(let j = 0; j < m; ++j)bounds.union(items[j].bounds); - } - if ((group.clip || group.width || group.height) && !group.noBound) bounds.add(0, 0).add(group.width || 0, group.height || 0); - boundStroke(bounds, group); - return bounds.translate(group.x || 0, group.y || 0); -} -function rectanglePath(context, group, x, y) { - const off = offset$1(group); - context.beginPath(); - rectangle(context, group, (x || 0) + off, (y || 0) + off); -} -const hitBackground = hitPath(rectanglePath); -const hitForeground = hitPath(rectanglePath, false); -const hitCorner = hitPath(rectanglePath, true); -function draw$4(context, scene, bounds, markTypes) { - visit(scene, (group)=>{ - const gx = group.x || 0, gy = group.y || 0, fore = group.strokeForeground, opacity = group.opacity == null ? 1 : group.opacity; - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) context.fill(); - if (group.stroke && !fore && stroke(context, group, opacity)) context.stroke(); - } - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - // draw group contents - visit(group, (item)=>{ - if (item.marktype === 'group' || markTypes == null || markTypes.includes(item.marktype)) this.draw(context, item, bounds, markTypes); - }); - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) context.stroke(); - } - }); -} -function pick(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) return null; - const cx = x * context.pixelRatio, cy = y * context.pixelRatio; - return pickVisit(scene, (group)=>{ - let hit, dx, dy; - // first hit test bounding box - const b = group.bounds; - if (b && !b.contains(gx, gy)) return; - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - const dw = dx + (group.width || 0), dh = dy + (group.height || 0), c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitCorner(context, group, cx, cy)) { - context.restore(); - return null; + }); + const tempBounds = new Bounds(); + function set$2(item, property2, value2) { + return item[property2] === value2 ? 0 : (item[property2] = value2, 1); + } + function isYAxis(mark) { + var orient = mark.items[0].orient; + return orient === Left$1 || orient === Right$1; + } + function axisIndices(datum2) { + let index2 = +datum2.grid; + return [ + datum2.ticks ? index2++ : -1, + // ticks index + datum2.labels ? index2++ : -1, + // labels index + index2 + +datum2.domain + // title index + ]; + } + function axisLayout(view, axis, width2, height2) { + var item = axis.items[0], datum2 = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum2), range2 = item.range, offset2 = item.offset, position2 = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum2.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds2 = item.bounds, dl = title && multiLineOffset(title), x2 = 0, y2 = 0, i, s2; + tempBounds.clear().union(bounds2); + bounds2.clear(); + if ((i = indices[0]) > -1) bounds2.union(item.items[i].bounds); + if ((i = indices[1]) > -1) bounds2.union(item.items[i].bounds); + switch (orient) { + case Top$1: + x2 = position2 || 0; + y2 = -offset2; + s2 = Math.max(minExtent, Math.min(maxExtent, -bounds2.y1)); + bounds2.add(0, -s2).add(range2, 0); + if (title) axisTitleLayout(view, title, s2, titlePadding, dl, 0, -1, bounds2); + break; + case Left$1: + x2 = -offset2; + y2 = position2 || 0; + s2 = Math.max(minExtent, Math.min(maxExtent, -bounds2.x1)); + bounds2.add(-s2, 0).add(0, range2); + if (title) axisTitleLayout(view, title, s2, titlePadding, dl, 1, -1, bounds2); + break; + case Right$1: + x2 = width2 + offset2; + y2 = position2 || 0; + s2 = Math.max(minExtent, Math.min(maxExtent, bounds2.x2)); + bounds2.add(0, 0).add(s2, range2); + if (title) axisTitleLayout(view, title, s2, titlePadding, dl, 1, 1, bounds2); + break; + case Bottom$1: + x2 = position2 || 0; + y2 = height2 + offset2; + s2 = Math.max(minExtent, Math.min(maxExtent, bounds2.y2)); + bounds2.add(0, 0).add(range2, s2); + if (title) axisTitleLayout(view, title, s2, titlePadding, 0, 0, 1, bounds2); + break; + default: + x2 = item.x; + y2 = item.y; + } + boundStroke(bounds2.translate(x2, y2), item); + if (set$2(item, "x", x2 + delta) | set$2(item, "y", y2 + delta)) { + item.bounds = tempBounds; + view.dirty(item); + item.bounds = bounds2; + view.dirty(item); + } + return item.mark.bounds.clear().union(bounds2); + } + function axisTitleLayout(view, title, offset2, pad2, dl, isYAxis2, sign2, bounds2) { + const b2 = title.bounds; + if (title.auto) { + const v = sign2 * (offset2 + dl + pad2); + let dx = 0, dy = 0; + view.dirty(title); + isYAxis2 ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); + title.mark.bounds.clear().union(b2.translate(-dx, -dy)); + view.dirty(title); + } + bounds2.union(b2); + } + const min = (a2, b2) => Math.floor(Math.min(a2, b2)); + const max = (a2, b2) => Math.ceil(Math.max(a2, b2)); + function gridLayoutGroups(group2) { + var groups = group2.items, n = groups.length, i = 0, mark, items; + const views = { + marks: [], + rowheaders: [], + rowfooters: [], + colheaders: [], + colfooters: [], + rowtitle: null, + coltitle: null + }; + for (; i < n; ++i) { + mark = groups[i]; + items = mark.items; + if (mark.marktype === Group) { + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + break; + case RowHeader: + views.rowheaders.push(...items); + break; + case RowFooter: + views.rowfooters.push(...items); + break; + case ColHeader: + views.colheaders.push(...items); + break; + case ColFooter: + views.colfooters.push(...items); + break; + case RowTitle: + views.rowtitle = items[0]; + break; + case ColTitle: + views.coltitle = items[0]; + break; + default: + views.marks.push(...items); } - const fore = group.strokeForeground, ix = scene.interactive !== false; - // hit test against group foreground - if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - // hit test against contained marks - hit = pickVisit(group, (mark)=>pickMark(mark, dx, dy) ? this.pick(mark, x, y, dx, dy) : null); - // hit test against group background - if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) hit = group; - // restore state and return - context.restore(); - return hit || null; - }); -} -function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y); -} -var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr$5, - bound: bound$5, - draw: draw$4, - pick: pick, - isect: intersectRect, - content: content, - background: background, - foreground: foreground -}; -var metadata = { - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink', - 'version': '1.1' -}; -function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = { - complete: false, - width: 0, - height: 0 - }; - renderer.loadImage(item.url).then((image)=>{ - item.image = image; - item.image.url = item.url; - }); + } } - return image; -} -function imageWidth(item, image) { - return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width; -} -function imageHeight(item, image) { - return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height; -} -function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; -} -function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; -} -function attr$4(emit, item, renderer) { - const img = getImage(item, renderer), w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); -} -function bound$4(bounds, item) { - const img = item.image, w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h); - return bounds.set(x, y, x + w, y + h); -} -function draw$3(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - const img = getImage(item, this); - let w = imageWidth(item, img); - let h = imageHeight(item, img); - if (w === 0 || h === 0) return; // early exit - let x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), opacity, ar0, ar1, t; - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } + return views; + } + function bboxFlush(item) { + return new Bounds().set(0, 0, item.width || 0, item.height || 0); + } + function bboxFull(item) { + const b2 = item.bounds.clone(); + return b2.empty() ? b2.set(0, 0, 0, 0) : b2.translate(-(item.x || 0), -(item.y || 0)); + } + function get$1(opt, key2, d2) { + const v = isObject(opt) ? opt[key2] : opt; + return v != null ? v : d2 !== void 0 ? d2 : 0; + } + function offsetValue$1(v) { + return v < 0 ? Math.ceil(-v) : 0; + } + function gridLayout(view, groups, opt) { + var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds2 = tempBounds.set(0, 0, 0, 0), alignCol = get$1(opt.align, Column), alignRow = get$1(opt.align, Row), padCol = get$1(opt.padding, Column), padRow = get$1(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m2, i, c2, r, b2, g, px2, py2, x2, y2, offset2; + for (i = 0; i < ncols; ++i) xExtent[i] = 0; + for (i = 0; i < nrows; ++i) yExtent[i] = 0; + for (i = 0; i < n; ++i) { + g = groups[i]; + b2 = boxes[i] = bbox(g); + g.x = g.x || 0; + dx[i] = 0; + g.y = g.y || 0; + dy[i] = 0; + c2 = i % ncols; + r = ~~(i / ncols); + xMax = Math.max(xMax, px2 = Math.ceil(b2.x2)); + yMax = Math.max(yMax, py2 = Math.ceil(b2.y2)); + xExtent[c2] = Math.max(xExtent[c2], px2); + yExtent[r] = Math.max(yExtent[r], py2); + xOffset[i] = padCol + offsetValue$1(b2.x1); + yOffset[i] = padRow + offsetValue$1(b2.y1); + if (dirty) view.dirty(groups[i]); + } + for (i = 0; i < n; ++i) { + if (i % ncols === 0) xOffset[i] = 0; + if (i < ncols) yOffset[i] = 0; + } + if (alignCol === Each) { + for (c2 = 1; c2 < ncols; ++c2) { + for (offset2 = 0, i = c2; i < n; i += ncols) { + if (offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = c2; i < n; i += ncols) { + xOffset[i] = offset2 + xExtent[c2 - 1]; } - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); + } + } else if (alignCol === All) { + for (offset2 = 0, i = 0; i < n; ++i) { + if (i % ncols && offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = 0; i < n; ++i) { + if (i % ncols) xOffset[i] = offset2 + xMax; + } + } else { + for (alignCol = false, c2 = 1; c2 < ncols; ++c2) { + for (i = c2; i < n; i += ncols) { + xOffset[i] += xExtent[c2 - 1]; } - }); -} -var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick$1(), - isect: (0, _vegaUtil.truthy), - // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset -}; -var line = markMultiItemPath('line', line$1, pickLine); -function attr$3(emit, item) { - var sx = item.scaleX || 1, sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) emit('vector-effect', 'non-scaling-stroke'); - emit('transform', transformItem(item)); - emit('d', item.path); -} -function path$1(context, item) { - var path = item.path; - if (path == null) return true; - var x = item.x || 0, y = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a = (item.angle || 0) * DegToRad, cache = item.pathCache; - if (!cache || cache.path !== path) (item.pathCache = cache = parse(path)).path = path; - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else pathRender(context, cache, x, y, sx, sy); -} -function bound$3(bounds, item) { - return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true); -} -var path$2 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(path$1), - pick: pickPath(path$1), - isect: intersectPath(path$1) -}; -function attr$2(emit, item) { - emit('d', rectangle(null, item)); -} -function bound$2(bounds, item) { - var x, y; - return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item); -} -function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); -} -var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect -}; -function attr$1(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); -} -function bound$1(bounds, item) { - var x1, y1; - return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item); -} -function path(context, item, opacity) { - var x1, y1, x2, y2; - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; + } } - return false; -} -function draw$1(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path(context, item, opacity)) { - blend(context, item); - context.stroke(); + if (alignRow === Each) { + for (r = 1; r < nrows; ++r) { + for (offset2 = 0, i = r * ncols, m2 = i + ncols; i < m2; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; } - }); -} -function hit$1(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path(context, item, 1) && context.isPointInStroke(x, y); -} -var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick$1(hit$1), - isect: intersectRule -}; -var shape = markItemPath('shape', shape$1); -var symbol = markItemPath('symbol', symbol$1, intersectPoint); -// memoize text width measurement -const widthCache = (0, _vegaUtil.lruCache)(); -var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas -}; -useCanvas(true); -function useCanvas(use) { - textMetrics.width = use && context ? measureWidth : estimateWidth; -} -// make simple estimate if no canvas is available -function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); -} -function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); -} -// measure text width if canvas is available -function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item)); -} -function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context.font = currentFont; - width = context.measureText(text).width; - widthCache.set(key, width); - } - return width; -} -function fontSize(item) { - return item.fontSize != null ? +item.fontSize || 0 : 11; -} -function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; -} -function lineArray(_) { - return (0, _vegaUtil.isArray)(_) ? _.length > 1 ? _ : _[0] : _; -} -function textLines(item) { - return lineArray(item.lineBreak && item.text && !(0, _vegaUtil.isArray)(item.text) ? item.text.split(item.lineBreak) : item.text); -} -function multiLineOffset(item) { - const tl = textLines(item); - return ((0, _vegaUtil.isArray)(tl) ? tl.length - 1 : 0) * lineHeight(item); -} -function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate(item, text) : text; -} -function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return (text)=>_measureWidth(text, currentFont); - } else if (textMetrics.width === estimateWidth) { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return (text)=>_estimateWidth(text, currentFontHeight); - } else // User defined textMetrics.width function in use (e.g. vl-convert) - return (text)=>textMetrics.width(item, text); -} -function truncate(item, text) { - var limit = +item.limit, width = widthGetter(item); - if (width(text) < limit) return text; - var ellipsis = item.ellipsis || '\u2026', rtl = item.dir === 'rtl', lo = 0, hi = text.length, mid; - limit -= width(ellipsis); - if (rtl) { - while(lo < hi){ - mid = lo + hi >>> 1; - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; + for (i = r * ncols; i < m2; ++i) { + yOffset[i] = offset2 + yExtent[r - 1]; } - return ellipsis + text.slice(lo); + } + } else if (alignRow === All) { + for (offset2 = 0, i = ncols; i < n; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; + } + for (i = ncols; i < n; ++i) { + yOffset[i] = offset2 + yMax; + } } else { - while(lo < hi){ - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } -} -function fontFamily(item, quote) { - var font = item.font; - return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif'; -} -function font(item, quote) { - return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote); -} -function offset(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, h = fontSize(item); - return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0); -} -const textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' -}; -const tempBounds = new Bounds(); -function anchorPoint(item) { - var x = item.x || 0, y = item.y || 0, r = item.radius || 0, t; - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; -} -function attr(emit, item) { - var dx = item.dx || 0, dy = (item.dy || 0) + offset(item), p = anchorPoint(item), x = p.x1, y = p.y1, a = item.angle || 0, t; - emit('text-anchor', textAlign[item.align] || 'start'); - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else t = translate(x + dx, y + dy); - emit('transform', t); -} -function bound(bounds, item, mode) { - var h = textMetrics.height(item), a = item.align, p = anchorPoint(item), x = p.x1, y = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset(item) - Math.round(0.8 * h), // use 4/5 offset - tl = textLines(item), w; - // get dimensions - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t)=>Math.max(w, textMetrics.width(item, t)), 0); - } else // single-line text - w = textMetrics.width(item, tl); - // horizontal alignment - if (a === 'center') dx -= w / 2; - else if (a === 'right') dx -= w; - bounds.set(dx += x, dy += y, dx + w, dy + h); - if (item.angle && !mode) bounds.rotate(item.angle * DegToRad, x, y); - else if (mode === 2) return bounds.rotatedPoints(item.angle * DegToRad, x, y); - return bounds; -} -function draw(context, scene, bounds) { - visit(scene, (item)=>{ - var opacity = item.opacity == null ? 1 : item.opacity, p, x, y, i, lh, tl, str; - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; - context.font = font(item); - context.textAlign = item.align || 'left'; - p = anchorPoint(item); - x = p.x1, y = p.y1; - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += item.dx || 0; - y += (item.dy || 0) + offset(item); - tl = textLines(item); - blend(context, item); - if ((0, _vegaUtil.isArray)(tl)) { - lh = lineHeight(item); - for(i = 0; i < tl.length; ++i){ - str = textValue(item, tl[i]); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); - y += lh; - } - } else { - str = textValue(item, tl); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); - } - if (item.angle) context.restore(); - }); -} -function hit(context, item, x, y, gx, gy) { - if (item.fontSize <= 0) return false; - if (!item.angle) return true; // bounds sufficient if no rotation - // project point into space of unrotated bounds - var p = anchorPoint(item), ax = p.x1, ay = p.y1, b = bound(tempBounds, item, 1), a = -item.angle * DegToRad, cos = Math.cos(a), sin = Math.sin(a), px = cos * gx - sin * gy + (ax - cos * ax + sin * ay), py = sin * gx + cos * gy + (ay - sin * ax - cos * ay); - return b.contains(px, py); -} -function intersectText(item, box) { - const p = bound(tempBounds, item, 2); - return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]); -} -var text = { - type: 'text', - tag: 'text', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1(hit), - isect: intersectText -}; -var trail = markMultiItemPath('trail', trail$1, pickTrail); -var Marks = { - arc: arc, - area: area, - group: group, - image: image, - line: line, - path: path$2, - rect: rect, - rule: rule, - shape: shape, - symbol: symbol, - text: text, - trail: trail -}; -function boundItem(item, func, opt) { - var type = Marks[item.mark.marktype], bound = func || type.bound; - if (type.nested) item = item.mark; - return bound(item.bounds || (item.bounds = new Bounds()), item, opt); -} -var DUMMY = { - mark: null -}; -function boundMark(mark, bounds, opt) { - var type = Marks[mark.marktype], bound = type.bound, items = mark.items, hasItems = items && items.length, i, n, item, b; - if (type.nested) { - if (hasItems) item = items[0]; - else { - // no items, fake it - DUMMY.mark = mark; - item = DUMMY; - } - b = boundItem(item, bound, opt); - bounds = bounds && bounds.union(b) || b; - return bounds; - } - bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds(); - if (hasItems) for(i = 0, n = items.length; i < n; ++i)bounds.union(boundItem(items[i], bound, opt)); - return mark.bounds = bounds; -} -const keys = [ - 'marktype', - 'name', - 'role', - 'interactive', - 'clip', - 'items', - 'zindex', - 'x', - 'y', - 'width', - 'height', - 'align', - 'baseline', - // layout - 'fill', - 'fillOpacity', - 'opacity', - 'blend', - // fill - 'stroke', - 'strokeOpacity', - 'strokeWidth', - 'strokeCap', - // stroke - 'strokeDash', - 'strokeDashOffset', - // stroke dash - 'strokeForeground', - 'strokeOffset', - // group - 'startAngle', - 'endAngle', - 'innerRadius', - 'outerRadius', - // arc - 'cornerRadius', - 'padAngle', - // arc, rect - 'cornerRadiusTopLeft', - 'cornerRadiusTopRight', - // rect, group - 'cornerRadiusBottomLeft', - 'cornerRadiusBottomRight', - 'interpolate', - 'tension', - 'orient', - 'defined', - // area, line - 'url', - 'aspect', - 'smooth', - // image - 'path', - 'scaleX', - 'scaleY', - // path - 'x2', - 'y2', - // rule - 'size', - 'shape', - // symbol - 'text', - 'angle', - 'theta', - 'radius', - 'dir', - 'dx', - 'dy', - // text - 'ellipsis', - 'limit', - 'lineBreak', - 'lineHeight', - 'font', - 'fontSize', - 'fontWeight', - 'fontStyle', - 'fontVariant', - // font - 'description', - 'aria', - 'ariaRole', - 'ariaRoleDescription' // aria -]; -function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); -} -function sceneFromJSON(json) { - const scene = typeof json === 'string' ? JSON.parse(json) : json; - return initialize(scene); -} -function initialize(scene) { - var type = scene.marktype, items = scene.items, parent, i, n; - if (items) for(i = 0, n = items.length; i < n; ++i){ - parent = type ? 'mark' : 'group'; - items[i][parent] = scene; - if (items[i].zindex) items[i][parent].zdirty = true; - if ('group' === (type || parent)) initialize(items[i]); - } - if (type) boundMark(scene); - return scene; -} -class Scenegraph { - constructor(scene){ - if (arguments.length) this.root = sceneFromJSON(scene); - else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [ - new GroupItem(this.root) - ]; + for (alignRow = false, r = 1; r < nrows; ++r) { + for (i = r * ncols, m2 = i + ncols; i < m2; ++i) { + yOffset[i] += yExtent[r - 1]; } + } } - toJSON(indent) { - return sceneToJSON(this.root, indent || 0); + for (x2 = 0, i = 0; i < n; ++i) { + x2 = xOffset[i] + (i % ncols ? x2 : 0); + dx[i] += x2 - groups[i].x; } - mark(markdef, group, index) { - group = group || this.root.items[0]; - const mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; + for (c2 = 0; c2 < ncols; ++c2) { + for (y2 = 0, i = c2; i < n; i += ncols) { + y2 += yOffset[i]; + dy[i] += y2 - groups[i].y; + } } -} -function createMark(def, group) { - const mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; - // add accessibility properties if defined - if (def.aria != null) mark.aria = def.aria; - if (def.description) mark.description = def.description; - return mark; -} -// create a new DOM element -function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) doc = document; - return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; -} -// find first child element with matching tag -function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, i = 0, n = nodes.length; - for(; i < n; ++i)if (nodes[i].tagName.toLowerCase() === tag) return nodes[i]; -} -// retrieve child element at given index -// create & insert if doesn't exist or if tags do not match -function domChild(el, index, tag, ns) { - var a = el.childNodes[index], b; - if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) { - b = a || null; - a = domCreate(el.ownerDocument, tag, ns); - el.insertBefore(a, b); - } - return a; -} -// remove all child elements at or above the given index -function domClear(el, index) { - var nodes = el.childNodes, curr = nodes.length; - while(curr > index)el.removeChild(nodes[--curr]); - return el; -} -// generate css class name for mark -function cssClass(mark) { - return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : ''); -} -function point(event, el) { - const rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; -} -function resolveItem(item, event, el, origin) { - var mark = item && item.mark, mdef, p; - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while(item = item.mark.group){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; - } - item = mdef.tip(mark.items, p); + if (alignCol && get$1(opt.center, Column) && nrows > 1) { + for (i = 0; i < n; ++i) { + b2 = alignCol === All ? xMax : xExtent[i % ncols]; + x2 = b2 - boxes[i].x2 - groups[i].x - dx[i]; + if (x2 > 0) dx[i] += x2 / 2; + } } - return item; -} -class Handler { - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ constructor(customLoader, customTooltip){ - this._active = null; - this._handlers = {}; - this._loader = customLoader || (0, _vegaLoader.loader)(); - this._tooltip = customTooltip || defaultTooltip; + if (alignRow && get$1(opt.center, Row) && ncols !== 1) { + for (i = 0; i < n; ++i) { + b2 = alignRow === All ? yMax : yExtent[~~(i / ncols)]; + y2 = b2 - boxes[i].y2 - groups[i].y - dy[i]; + if (y2 > 0) dy[i] += y2 / 2; + } } - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ initialize(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); + for (i = 0; i < n; ++i) { + bounds2.union(boxes[i].translate(dx[i], dy[i])); } - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; + x2 = get$1(opt.anchor, X); + y2 = get$1(opt.anchor, Y); + switch (get$1(opt.anchor, Column)) { + case End$1: + x2 -= bounds2.width(); + break; + case Middle$1: + x2 -= bounds2.width() / 2; } - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; + switch (get$1(opt.anchor, Row)) { + case End$1: + y2 -= bounds2.height(); + break; + case Middle$1: + y2 -= bounds2.height() / 2; + } + x2 = Math.round(x2); + y2 = Math.round(y2); + bounds2.clear(); + for (i = 0; i < n; ++i) { + groups[i].mark.bounds.clear(); + } + for (i = 0; i < n; ++i) { + g = groups[i]; + g.x += dx[i] += x2; + g.y += dy[i] += y2; + bounds2.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); + if (dirty) view.dirty(g); + } + return bounds2; + } + function trellisLayout(view, group2, opt) { + var views = gridLayoutGroups(group2), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x2, y2, x22, y22, anchor, band2, offset2; + const bounds2 = gridLayout(view, groups, opt); + if (bounds2.empty()) bounds2.set(0, 0, 0, 0); + if (views.rowheaders) { + band2 = get$1(opt.headerBand, Row, null); + x2 = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$1(off, "rowHeader"), min, 0, bbox, "x1", 0, ncols, 1, band2); } - /** - * Get / set the origin coordinates of the visualization. - */ origin(origin) { - if (arguments.length) { - this._origin = origin || [ - 0, - 0 - ]; - return this; - } else return this._origin.slice(); + if (views.colheaders) { + band2 = get$1(opt.headerBand, Column, null); + y2 = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$1(off, "columnHeader"), min, 1, bbox, "y1", 0, 1, ncols, band2); } - /** - * Get / set the scenegraph root. - */ scene(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; + if (views.rowfooters) { + band2 = get$1(opt.footerBand, Row, null); + x22 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$1(off, "rowFooter"), max, 0, bbox, "x2", ncols - 1, ncols, 1, band2); } - /** - * Add an event handler. Subclasses should override this method. - */ on() {} - /** - * Remove an event handler. Subclasses should override this method. - */ off() {} - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ _handlerIndex(h, type, handler) { - for(let i = h ? h.length : 0; --i >= 0;){ - if (h[i].type === type && (!handler || h[i].handler === handler)) return i; - } - return -1; + if (views.colfooters) { + band2 = get$1(opt.footerBand, Column, null); + y22 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$1(off, "columnFooter"), max, 1, bbox, "y2", cells - ncols, 1, ncols, band2); } - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ handlers(type) { - const h = this._handlers, a = []; - if (type) a.push(...h[this.eventName(type)]); - else for(const k in h)a.push(...h[k]); - return a; + if (views.rowtitle) { + anchor = get$1(opt.titleAnchor, Row); + offset2 = get$1(off, "rowTitle"); + offset2 = anchor === End$1 ? x22 + offset2 : x2 - offset2; + band2 = get$1(opt.titleBand, Row, 0.5); + layoutTitle(view, views.rowtitle, offset2, 0, bounds2, band2); } - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ eventName(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); + if (views.coltitle) { + anchor = get$1(opt.titleAnchor, Column); + offset2 = get$1(off, "columnTitle"); + offset2 = anchor === End$1 ? y22 + offset2 : y2 - offset2; + band2 = get$1(opt.titleBand, Column, 0.5); + layoutTitle(view, views.coltitle, offset2, 1, bounds2, band2); } - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ handleHref(event, item, href) { - this._loader.sanitize(href, { - context: 'href' - }).then((opt)=>{ - const e = new MouseEvent(event.type, event), a = domCreate(null, 'a'); - for(const name in opt)a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }).catch(()=>{}); + } + function boundFlush(item, field2) { + return field2 === "x1" ? item.x || 0 : field2 === "y1" ? item.y || 0 : field2 === "x2" ? (item.x || 0) + (item.width || 0) : field2 === "y2" ? (item.y || 0) + (item.height || 0) : void 0; + } + function boundFull(item, field2) { + return item.bounds[field2]; + } + function layoutHeaders(view, headers, groups, ncols, limit, offset2, agg, isX2, bound2, bf, start, stride, back, band2) { + var n = groups.length, init2 = 0, edge = 0, i, j, k, m2, b2, h2, g, x2, y2; + if (!n) return init2; + for (i = start; i < n; i += stride) { + if (groups[i]) init2 = agg(init2, bound2(groups[i], bf)); } - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ handleTooltip(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = show && item && item.tooltip || null; - this._tooltip.call(this._obj, this, event, item, value); - } + if (!headers.length) return init2; + if (headers.length > limit) { + view.warn("Grid headers exceed limit: " + limit); + headers = headers.slice(0, limit); + } + init2 += offset2; + for (j = 0, m2 = headers.length; j < m2; ++j) { + view.dirty(headers[j]); + headers[j].mark.bounds.clear(); + } + for (i = start, j = 0, m2 = headers.length; j < m2; ++j, i += stride) { + h2 = headers[j]; + b2 = h2.mark.bounds; + for (k = i; k >= 0 && (g = groups[k]) == null; k -= back) ; + if (isX2) { + x2 = band2 == null ? g.x : Math.round(g.bounds.x1 + band2 * g.bounds.width()); + y2 = init2; + } else { + x2 = init2; + y2 = band2 == null ? g.y : Math.round(g.bounds.y1 + band2 * g.bounds.height()); + } + b2.union(h2.bounds.translate(x2 - (h2.x || 0), y2 - (h2.y || 0))); + h2.x = x2; + h2.y = y2; + view.dirty(h2); + edge = agg(edge, b2[bf]); } - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ getItemBoundingClientRect(item) { - const el = this.canvas(); - if (!el) return; - const rect = el.getBoundingClientRect(), origin = this._origin, bounds = item.bounds, width = bounds.width(), height = bounds.height(); - let x = bounds.x1 + origin[0] + rect.left, y = bounds.y1 + origin[1] + rect.top; - // translate coordinate for each parent group - while(item.mark && (item = item.mark.group)){ - x += item.x || 0; - y += item.y || 0; - } - // return DOMRect-compatible bounding box - return { - x, - y, - width, - height, - left: x, - top: y, - right: x + width, - bottom: y + height + return edge; + } + function layoutTitle(view, g, offset2, isX2, bounds2, band2) { + if (!g) return; + view.dirty(g); + var x2 = offset2, y2 = offset2; + isX2 ? x2 = Math.round(bounds2.x1 + band2 * bounds2.width()) : y2 = Math.round(bounds2.y1 + band2 * bounds2.height()); + g.bounds.translate(x2 - (g.x || 0), y2 - (g.y || 0)); + g.mark.bounds.clear().union(g.bounds); + g.x = x2; + g.y = y2; + view.dirty(g); + } + function lookup$3(config, orient) { + const opt = config[orient] || {}; + return (key2, d2) => opt[key2] != null ? opt[key2] : config[key2] != null ? config[key2] : d2; + } + function offsets(legends, value2) { + let max2 = -Infinity; + legends.forEach((item) => { + if (item.offset != null) max2 = Math.max(max2, item.offset); + }); + return max2 > -Infinity ? max2 : value2; + } + function legendParams(g, orient, config, xb, yb, w2, h2) { + const _ = lookup$3(config, orient), offset2 = offsets(g, _("offset", 0)), anchor = _("anchor", Start$1), mult2 = anchor === End$1 ? 1 : anchor === Middle$1 ? 0.5 : 0; + const p = { + align: Each, + bounds: _("bounds", Flush), + columns: _("direction") === "vertical" ? 1 : g.length, + padding: _("margin", 8), + center: _("center"), + nodirty: true + }; + switch (orient) { + case Left$1: + p.anchor = { + x: Math.floor(xb.x1) - offset2, + column: End$1, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor }; - } -} -// The default tooltip display handler. -// Sets the HTML title attribute on the visualization container. -function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); -} -class Renderer { - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ constructor(loader){ - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - } - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; - } - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; - } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [ - 0, - 0 - ]; - this._scale = scaleFactor || 1; - return this; - } - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ dirty() {} - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Renderer} - This renderer instance. - */ render(scene, markTypes) { - const r = this; - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { - r._render(scene, markTypes); + break; + case Right$1: + p.anchor = { + x: Math.ceil(xb.x2) + offset2, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor + }; + break; + case Top$1: + p.anchor = { + y: Math.floor(yb.y1) - offset2, + row: End$1, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case Bottom$1: + p.anchor = { + y: Math.ceil(yb.y2) + offset2, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case TopLeft: + p.anchor = { + x: offset2, + y: offset2 }; - // invoke the renderer - r._call(); - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - return r; - } - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render() { - // subclasses to override - } - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Promise} - A Promise that resolves when rendering is complete. - */ renderAsync(scene, markTypes) { - const r = this.render(scene, markTypes); - return this._ready ? this._ready.then(()=>r) : Promise.resolve(r); - } - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ _load(method, uri) { - var r = this, p = r._loader[method](uri); - if (!r._ready) { - // re-render the scene when loading completes - const call = r._call; - r._ready = r._loader.ready().then((redraw)=>{ - if (redraw) call(); - r._ready = null; - }); - } - return p; - } - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ sanitizeURL(uri) { - return this._load('sanitizeURL', uri); - } - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ loadImage(uri) { - return this._load('loadImage', uri); - } -} -const KeyDownEvent = 'keydown'; -const KeyPressEvent = 'keypress'; -const KeyUpEvent = 'keyup'; -const DragEnterEvent = 'dragenter'; -const DragLeaveEvent = 'dragleave'; -const DragOverEvent = 'dragover'; -const PointerDownEvent = 'pointerdown'; -const PointerUpEvent = 'pointerup'; -const PointerMoveEvent = 'pointermove'; -const PointerOutEvent = 'pointerout'; -const PointerOverEvent = 'pointerover'; -const MouseDownEvent = 'mousedown'; -const MouseUpEvent = 'mouseup'; -const MouseMoveEvent = 'mousemove'; -const MouseOutEvent = 'mouseout'; -const MouseOverEvent = 'mouseover'; -const ClickEvent = 'click'; -const DoubleClickEvent = 'dblclick'; -const WheelEvent = 'wheel'; -const MouseWheelEvent = 'mousewheel'; -const TouchStartEvent = 'touchstart'; -const TouchMoveEvent = 'touchmove'; -const TouchEndEvent = 'touchend'; -const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - PointerDownEvent, - PointerUpEvent, - PointerMoveEvent, - PointerOutEvent, - PointerOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent -]; -const TooltipShowEvent = PointerMoveEvent; -const TooltipHideEvent = MouseOutEvent; -const HrefEvent = ClickEvent; -class CanvasHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - // supported events - this.events = Events; - this.pointermove = move([ - PointerMoveEvent, - MouseMoveEvent - ], [ - PointerOverEvent, - MouseOverEvent - ], [ - PointerOutEvent, - MouseOutEvent - ]); - this.dragover = move([ - DragOverEvent - ], [ - DragEnterEvent - ], [ - DragLeaveEvent - ]), this.pointerout = inactive([ - PointerOutEvent, - MouseOutEvent - ]); - this.dragleave = inactive([ - DragLeaveEvent - ]); + break; + case TopRight: + p.anchor = { + x: w2 - offset2, + y: offset2, + column: End$1 + }; + break; + case BottomLeft: + p.anchor = { + x: offset2, + y: h2 - offset2, + row: End$1 + }; + break; + case BottomRight: + p.anchor = { + x: w2 - offset2, + y: h2 - offset2, + column: End$1, + row: End$1 + }; + break; } - initialize(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - // add minimal events required for proper state management - [ - ClickEvent, - MouseDownEvent, - PointerDownEvent, - PointerMoveEvent, - PointerOutEvent, - DragLeaveEvent - ].forEach((type)=>eventListenerCheck(this, type)); - return super.initialize(el, origin, obj); + return p; + } + function legendLayout(view, legend2) { + var item = legend2.items[0], datum2 = item.datum, orient = item.orient, bounds2 = item.bounds, x2 = item.x, y2 = item.y, w2, h2; + item._bounds ? item._bounds.clear().union(bounds2) : item._bounds = bounds2.clone(); + bounds2.clear(); + legendGroupLayout(view, item, item.items[0].items[0]); + bounds2 = legendBounds(item, bounds2); + w2 = 2 * item.padding; + h2 = 2 * item.padding; + if (!bounds2.empty()) { + w2 = Math.ceil(bounds2.width() + w2); + h2 = Math.ceil(bounds2.height() + h2); } - // return the backing canvas instance - canvas() { - return this._canvas; + if (datum2.type === Symbols$1) { + legendEntryLayout(item.items[0].items[0].items[0].items); } - // retrieve the current canvas context - context() { - return this._canvas.getContext('2d'); + if (orient !== None) { + item.x = x2 = 0; + item.y = y2 = 0; } - // to keep old versions of firefox happy - DOMMouseScroll(evt) { - this.fire(MouseWheelEvent, evt); + item.width = w2; + item.height = h2; + boundStroke(bounds2.set(x2, y2, x2 + w2, y2 + h2), item); + item.mark.bounds.clear().union(bounds2); + return item; + } + function legendBounds(item, b2) { + item.items.forEach((_) => b2.union(_.bounds)); + b2.x1 = item.padding; + b2.y1 = item.padding; + return b2; + } + function legendGroupLayout(view, item, entry2) { + var pad2 = item.padding, ex = pad2 - entry2.x, ey = pad2 - entry2.y; + if (!item.datum.title) { + if (ex || ey) translate(view, entry2, ex, ey); + } else { + var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx2 = pad2 - title.x, ty2 = pad2 - title.y; + switch (title.orient) { + case Left$1: + ex += Math.ceil(title.bounds.width()) + tpad; + break; + case Right$1: + case Bottom$1: + break; + default: + ey += title.bounds.height() + tpad; + } + if (ex || ey) translate(view, entry2, ex, ey); + switch (title.orient) { + case Left$1: + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Right$1: + tx2 += legendTitleOffset(item, entry2, title, End$1, 0, 0) + tpad; + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Bottom$1: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + ty2 += legendTitleOffset(item, entry2, title, End$1, -1, 0, 1) + tpad; + break; + default: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + } + if (tx2 || ty2) translate(view, title, tx2, ty2); + if ((tx2 = Math.round(title.bounds.x1 - pad2)) < 0) { + translate(view, entry2, -tx2, 0); + translate(view, title, -tx2, 0); + } } - pointerdown(evt) { - this._down = this._active; - this.fire(PointerDownEvent, evt); + } + function legendTitleOffset(item, entry2, title, anchor, y2, lr, noBar) { + const grad = item.datum.type !== "symbol", vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry2.items[0] : entry2, s2 = e.bounds[y2 ? "y2" : "x2"] - item.padding, u2 = vgrad && lr ? s2 : 0, v = vgrad && lr ? 0 : s2, o = y2 <= 0 ? 0 : multiLineOffset(title); + return Math.round(anchor === Start$1 ? u2 : anchor === End$1 ? v - o : 0.5 * (s2 - o)); + } + function translate(view, item, dx, dy) { + item.x += dx; + item.y += dy; + item.bounds.translate(dx, dy); + item.mark.bounds.translate(dx, dy); + view.dirty(item); + } + function legendEntryLayout(entries) { + const widths = entries.reduce((w2, g) => { + w2[g.column] = Math.max(g.bounds.x2 - g.x, w2[g.column] || 0); + return w2; + }, {}); + entries.forEach((g) => { + g.width = widths[g.column]; + g.height = g.bounds.y2 - g.y; + }); + } + function titleLayout(view, mark, width2, height2, viewBounds2) { + var group2 = mark.items[0], frame2 = group2.frame, orient = group2.orient, anchor = group2.anchor, offset2 = group2.offset, padding2 = group2.padding, title = group2.items[0].items[0], subtitle = group2.items[1] && group2.items[1].items[0], end = orient === Left$1 || orient === Right$1 ? height2 : width2, start = 0, x2 = 0, y2 = 0, sx = 0, sy = 0, pos; + if (frame2 !== Group) { + orient === Left$1 ? (start = viewBounds2.y2, end = viewBounds2.y1) : orient === Right$1 ? (start = viewBounds2.y1, end = viewBounds2.y2) : (start = viewBounds2.x1, end = viewBounds2.x2); + } else if (orient === Left$1) { + start = height2, end = 0; + } + pos = anchor === Start$1 ? start : anchor === End$1 ? end : (start + end) / 2; + if (subtitle && subtitle.text) { + switch (orient) { + case Top$1: + case Bottom$1: + sy = title.bounds.height() + padding2; + break; + case Left$1: + sx = title.bounds.width() + padding2; + break; + case Right$1: + sx = -title.bounds.width() - padding2; + break; + } + tempBounds.clear().union(subtitle.bounds); + tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); + if (set$2(subtitle, "x", sx) | set$2(subtitle, "y", sy)) { + view.dirty(subtitle); + subtitle.bounds.clear().union(tempBounds); + subtitle.mark.bounds.clear().union(tempBounds); + view.dirty(subtitle); + } + tempBounds.clear().union(subtitle.bounds); + } else { + tempBounds.clear(); } - mousedown(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); + tempBounds.union(title.bounds); + switch (orient) { + case Top$1: + x2 = pos; + y2 = viewBounds2.y1 - tempBounds.height() - offset2; + break; + case Left$1: + x2 = viewBounds2.x1 - tempBounds.width() - offset2; + y2 = pos; + break; + case Right$1: + x2 = viewBounds2.x2 + tempBounds.width() + offset2; + y2 = pos; + break; + case Bottom$1: + x2 = pos; + y2 = viewBounds2.y2 + offset2; + break; + default: + x2 = group2.x; + y2 = group2.y; + } + if (set$2(group2, "x", x2) | set$2(group2, "y", y2)) { + tempBounds.translate(x2, y2); + view.dirty(group2); + group2.bounds.clear().union(tempBounds); + mark.bounds.clear().union(tempBounds); + view.dirty(group2); + } + return group2.bounds; + } + function ViewLayout$1(params2) { + Transform.call(this, null, params2); + } + inherits(ViewLayout$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + _.mark.items.forEach((group2) => { + if (_.layout) trellisLayout(view, group2, _.layout); + layoutGroup(view, group2, _); + }); + return shouldReflow(_.mark.group) ? pulse2.reflow() : pulse2; } - click(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } + }); + function shouldReflow(group2) { + return group2 && group2.mark.role !== "legend-entry"; + } + function layoutGroup(view, group2, _) { + var items = group2.items, width2 = Math.max(0, group2.width || 0), height2 = Math.max(0, group2.height || 0), viewBounds2 = new Bounds().set(0, 0, width2, height2), xBounds = viewBounds2.clone(), yBounds = viewBounds2.clone(), legends = [], title, mark, orient, b2, i, n; + for (i = 0, n = items.length; i < n; ++i) { + mark = items[i]; + switch (mark.role) { + case AxisRole$1: + b2 = isYAxis(mark) ? xBounds : yBounds; + b2.union(axisLayout(view, mark, width2, height2)); + break; + case TitleRole$1: + title = mark; + break; + case LegendRole$1: + legends.push(legendLayout(view, mark)); + break; + case FrameRole$1: + case ScopeRole$1: + case RowHeader: + case RowFooter: + case RowTitle: + case ColHeader: + case ColFooter: + case ColTitle: + xBounds.union(mark.bounds); + yBounds.union(mark.bounds); + break; + default: + viewBounds2.union(mark.bounds); + } } - touchstart(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - if (this._first) { - this._active = this._touch; - this._first = false; + if (legends.length) { + const l = {}; + legends.forEach((item) => { + orient = item.orient || Right$1; + if (orient !== None) (l[orient] || (l[orient] = [])).push(item); + }); + for (const orient2 in l) { + const g = l[orient2]; + gridLayout(view, g, legendParams(g, orient2, _.legends, xBounds, yBounds, width2, height2)); + } + legends.forEach((item) => { + const b3 = item.bounds; + if (!b3.equals(item._bounds)) { + item.bounds = item._bounds; + view.dirty(item); + item.bounds = b3; + view.dirty(item); + } + if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) { + switch (item.orient) { + case Left$1: + case Right$1: + viewBounds2.add(b3.x1, 0).add(b3.x2, 0); + break; + case Top$1: + case Bottom$1: + viewBounds2.add(0, b3.y1).add(0, b3.y2); + } + } else { + viewBounds2.union(b3); } - this.fire(TouchStartEvent, evt, true); + }); } - touchmove(evt) { - this.fire(TouchMoveEvent, evt, true); + viewBounds2.union(xBounds).union(yBounds); + if (title) { + viewBounds2.union(titleLayout(view, title, width2, height2, viewBounds2)); } - touchend(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; + if (group2.clip) { + viewBounds2.set(0, 0, group2.width || 0, group2.height || 0); } - // fire an event - fire(type, evt, touch) { - const a = touch ? this._touch : this._active, h = this._handlers[type]; - // set event type relative to scenegraph items - evt.vegaType = type; - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) this.handleHref(evt, a, a.href); - else if (type === TooltipShowEvent || type === TooltipHideEvent) this.handleTooltip(evt, a, type !== TooltipHideEvent); - // invoke all registered handlers - if (h) for(let i = 0, len = h.length; i < len; ++i)h[i].handler.call(this._obj, evt, a); + viewSizeLayout(view, group2, viewBounds2, _); + } + function viewSizeLayout(view, group2, viewBounds2, _) { + const auto = _.autosize || {}, type2 = auto.type; + if (view._autosize < 1 || !type2) return; + let viewWidth2 = view._width, viewHeight2 = view._height, width2 = Math.max(0, group2.width || 0), left = Math.max(0, Math.ceil(-viewBounds2.x1)), height2 = Math.max(0, group2.height || 0), top = Math.max(0, Math.ceil(-viewBounds2.y1)); + const right = Math.max(0, Math.ceil(viewBounds2.x2 - width2)), bottom = Math.max(0, Math.ceil(viewBounds2.y2 - height2)); + if (auto.contains === Padding$1) { + const padding2 = view.padding(); + viewWidth2 -= padding2.left + padding2.right; + viewHeight2 -= padding2.top + padding2.bottom; + } + if (type2 === None) { + left = 0; + top = 0; + width2 = viewWidth2; + height2 = viewHeight2; + } else if (type2 === Fit) { + width2 = Math.max(0, viewWidth2 - left - right); + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === FitX) { + width2 = Math.max(0, viewWidth2 - left - right); + viewHeight2 = height2 + top + bottom; + } else if (type2 === FitY) { + viewWidth2 = width2 + left + right; + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === Pad) { + viewWidth2 = width2 + left + right; + viewHeight2 = height2 + top + bottom; + } + view._resizeView(viewWidth2, viewHeight2, width2, height2, [left, top], auto.resize); + } + const vtx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + bound: Bound$1, + identifier: Identifier$1, + mark: Mark$1, + overlap: Overlap$1, + render: Render$1, + viewlayout: ViewLayout$1 + }, Symbol.toStringTag, { value: "Module" })); + function AxisTicks$1(params2) { + Transform.call(this, null, params2); + } + inherits(AxisTicks$1, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), ticks2 = this.value, scale2 = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count2 = tickCount(scale2, tally, _.minstep), format2 = _.format || tickFormat(locale2, scale2, count2, _.formatSpecifier, _.formatType, !!_.values), values2 = _.values ? validTicks(scale2, _.values, count2) : tickValues(scale2, count2); + if (ticks2) out.rem = ticks2; + ticks2 = values2.map((value2, i) => ingest$1({ + index: i / (values2.length - 1 || 1), + value: value2, + label: format2(value2) + })); + if (_.extra && ticks2.length) { + ticks2.push(ingest$1({ + index: -1, + extra: { + value: ticks2[0].value + }, + label: "" + })); + } + out.source = ticks2; + out.add = ticks2; + this.value = ticks2; + return out; } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - eventListenerCheck(this, type); - (h[name] || (h[name] = [])).push({ - type: type, - handler: handler - }); + }); + function DataJoin$1(params2) { + Transform.call(this, null, params2); + } + function defaultItemCreate() { + return ingest$1({}); + } + function newMap(key2) { + const map2 = fastmap().test((t) => t.exit); + map2.lookup = (t) => map2.get(key2(t)); + return map2; + } + inherits(DataJoin$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), item = _.item || defaultItemCreate, key2 = _.key || tupleid, map2 = this.value; + if (isArray(out.encode)) { + out.encode = null; + } + if (map2 && (_.modified("key") || pulse2.modified(key2))) { + error("DataJoin does not support modified key function or fields."); + } + if (!map2) { + pulse2 = pulse2.addAll(); + this.value = map2 = newMap(key2); + } + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + let x2 = map2.get(k); + if (x2) { + if (x2.exit) { + map2.empty--; + out.add.push(x2); + } else { + out.mod.push(x2); + } + } else { + x2 = item(t); + map2.set(k, x2); + out.add.push(x2); } - return this; - } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) h.splice(i, 1); - return this; - } - pickEvent(evt) { - const p = point(evt, this._canvas), o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); - } - // find the scenegraph item at the current pointer position - // x, y -- the absolute x, y pointer coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - pick(scene, x, y, gx, gy) { - const g = this.context(), mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - } -} -const eventBundle = (type)=>type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [ - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent - ] : [ - type - ]; -// lazily add listeners to the canvas as needed -function eventListenerCheck(handler, type) { - eventBundle(type).forEach((_)=>addEventListener(handler, _)); -} -function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] ? (evt)=>handler[type](evt) : (evt)=>handler.fire(type, evt)); - } -} -function fireAll(handler, types, event) { - types.forEach((type)=>handler.fire(type, event)); -} -function move(moveEvents, overEvents, outEvents) { - return function(evt) { - const a = this._active, p = this.pickEvent(evt); - if (p === a) // active item and picked item are the same - fireAll(this, moveEvents, evt); // fire move - else { - // active item and picked item are different - if (!a || !a.exit) // fire out for prior active item - // suppress if active item was removed from scene - fireAll(this, outEvents, evt); - this._active = p; // set new active item - fireAll(this, overEvents, evt); // fire over for new active item - fireAll(this, moveEvents, evt); // fire move for new active item + x2.datum = t; + x2.exit = false; + }); + pulse2.visit(pulse2.MOD, (t) => { + const k = key2(t), x2 = map2.get(k); + if (x2) { + x2.datum = t; + out.mod.push(x2); } - }; -} -function inactive(types) { - return function(evt) { - fireAll(this, types, evt); - this._active = null; - }; -} -function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; -} -function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null, context = canvas.getContext('2d'), ratio = inDOM ? devicePixelRatio() : scaleFactor; - canvas.width = width * ratio; - canvas.height = height * ratio; - for(const key in opt)context[key] = opt[key]; - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - } - context.pixelRatio = ratio; - context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); - return canvas; -} -class CanvasRenderer extends Renderer { - constructor(loader){ - super(loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - initialize(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - this._canvas = this._options.externalContext ? null : (0, _vegaCanvas.canvas)(1, 1, this._options.type); // instantiate a small canvas - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin, scaleFactor); - } - resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._canvas) // configure canvas size and transform - resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); - else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) (0, _vegaUtil.error)('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); + }); + pulse2.visit(pulse2.REM, (t) => { + const k = key2(t), x2 = map2.get(k); + if (t === x2.datum && !x2.exit) { + out.rem.push(x2); + x2.exit = true; + ++map2.empty; } - this._redraw = true; - return this; - } - canvas() { - return this._canvas; - } - context() { - return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null); + }); + if (pulse2.changed(pulse2.ADD_MOD)) out.modifies("datum"); + if (pulse2.clean() || _.clean && map2.empty > df.cleanThreshold) { + df.runAfter(map2.clean); + } + return out; } - dirty(item) { - const b = this._tempb.clear().union(item.bounds); - let g = item.mark.group; - while(g){ - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; + }); + function Encode$1(params2) { + Transform.call(this, null, params2); + } + inherits(Encode$1, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode2 = pulse2.encode; + if (isArray(encode2)) { + if (out.changed() || encode2.every((e) => encoders[e])) { + encode2 = encode2[0]; + out.encode = null; + } else { + return pulse2.StopPropagation; } - this._dirty.union(b); - } - _render(scene, markTypes) { - const g = this.context(), o = this._origin, w = this._width, h = this._height, db = this._dirty, vb = viewBounds(o, w, h); - // setup - g.save(); - const b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); - this.clear(-o[0], -o[1], w, h); - // render - this.draw(g, scene, b, markTypes); - // takedown - g.restore(); - db.clear(); - return this; - } - draw(ctx, scene, bounds, markTypes) { - if (scene.marktype !== 'group' && markTypes != null && !markTypes.includes(scene.marktype)) return; - const mark = Marks[scene.marktype]; - if (scene.clip) clip(ctx, scene); - mark.draw.call(this, ctx, scene, bounds, markTypes); - if (scene.clip) ctx.restore(); - } - clear(x, y, w, h) { - const opt = this._options, g = this.context(); - if (opt.type !== 'pdf' && !opt.externalContext) // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - } -} -const viewBounds = (origin, width, height)=>new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]); -function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - return b; -} -class SVGHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item)=>{ - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item)=>{ - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); + } + var reenter = encode2 === "enter", update2 = encoders.update || falsy, enter = encoders.enter || falsy, exit = encoders.exit || falsy, set2 = (encode2 && !reenter ? encoders[encode2] : update2) || falsy; + if (pulse2.changed(pulse2.ADD)) { + pulse2.visit(pulse2.ADD, (t) => { + enter(t, _); + update2(t, _); }); - } - initialize(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); + out.modifies(enter.output); + out.modifies(update2.output); + if (set2 !== falsy && set2 !== update2) { + pulse2.visit(pulse2.ADD, (t) => { + set2(t, _); + }); + out.modifies(set2.output); } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return super.initialize(el, origin, obj); - } - canvas() { - return this._svg; - } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - (h[name] || (h[name] = [])).push(x); - if (this._svg) this._svg.addEventListener(name, x.listener); + } + if (pulse2.changed(pulse2.REM) && exit !== falsy) { + pulse2.visit(pulse2.REM, (t) => { + exit(t, _); + }); + out.modifies(exit.output); + } + if (reenter || set2 !== falsy) { + const flag2 = pulse2.MOD | (_.modified() ? pulse2.REFLOW : 0); + if (reenter) { + pulse2.visit(flag2, (t) => { + const mod = enter(t, _) || fmod; + if (set2(t, _) || mod) out.mod.push(t); + }); + if (out.mod.length) out.modifies(enter.output); + } else { + pulse2.visit(flag2, (t) => { + if (set2(t, _) || fmod) out.mod.push(t); + }); } - return this; + if (out.mod.length) out.modifies(set2.output); + } + return out.changed() ? out : pulse2.StopPropagation; } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) { - if (this._svg) this._svg.removeEventListener(name, h[i].listener); - h.splice(i, 1); + }); + function LegendEntries$1(params2) { + Transform.call(this, [], params2); + } + inherits(LegendEntries$1, Transform, { + transform(_, pulse2) { + if (this.value != null && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), items = this.value, type2 = _.type || SymbolLegend, scale2 = _.scale, limit = +_.limit, count2 = tickCount(scale2, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type2 === SymbolLegend, format2 = _.format || labelFormat(locale2, scale2, count2, type2, _.formatSpecifier, _.formatType, lskip), values2 = _.values || labelValues(scale2, count2), domain2, fraction, size, offset2, ellipsis; + if (items) out.rem = items; + if (type2 === SymbolLegend) { + if (limit && values2.length > limit) { + pulse2.dataflow.warn("Symbol legend count exceeds limit, filtering items."); + items = values2.slice(0, limit - 1); + ellipsis = true; + } else { + items = values2; } - return this; + if (isFunction(size = _.size)) { + if (!_.values && scale2(items[0]) === 0) { + items = items.slice(1); + } + offset2 = items.reduce((max2, value2) => Math.max(max2, size(value2, _)), 0); + } else { + size = constant$4(offset2 = size || 8); + } + items = items.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, items), + value: value2, + offset: offset2, + size: size(value2, _) + })); + if (ellipsis) { + ellipsis = values2[items.length]; + items.push(ingest$1({ + index: items.length, + label: `…${values2.length - items.length} entries`, + value: ellipsis, + offset: offset2, + size: size(ellipsis, _) + })); + } + } else if (type2 === GradientLegend) { + domain2 = scale2.domain(), fraction = scaleFraction(scale2, domain2[0], peek$1(domain2)); + if (values2.length < 3 && !_.values && domain2[0] !== peek$1(domain2)) { + values2 = [domain2[0], peek$1(domain2)]; + } + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: fraction(value2) + })); + } else { + size = values2.length - 1; + fraction = labelFraction(scale2); + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: index2 ? fraction(value2) : 0, + perc2: index2 === size ? 1 : fraction(values2[index2 + 1]) + })); + } + out.source = items; + out.add = items; + this.value = items; + return out; } -} -// wrap an event listener for the SVG DOM -const listener = (context, handler)=>(evt)=>{ - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; -const ARIA_HIDDEN = 'aria-hidden'; -const ARIA_LABEL = 'aria-label'; -const ARIA_ROLE = 'role'; -const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; -const GRAPHICS_OBJECT = 'graphics-object'; -const GRAPHICS_SYMBOL = 'graphics-symbol'; -const bundle = (role, roledesc, label)=>({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined - }); -// these roles are covered by related roles -// we can ignore them, no need to generate attributes -const AriaIgnore = (0, _vegaUtil.toSet)([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' -]); -// aria attribute generators for guide roles -const AriaGuides = { - 'axis': { - desc: 'axis', - caption: axisCaption - }, - 'legend': { - desc: 'legend', - caption: legendCaption - }, - 'title-text': { - desc: 'title', - caption: (item)=>`Title text '${titleCaption(item)}'` + }); + const sourceX = (t) => t.source.x; + const sourceY = (t) => t.source.y; + const targetX = (t) => t.target.x; + const targetY = (t) => t.target.y; + function LinkPath(params2) { + Transform.call(this, {}, params2); + } + LinkPath.Definition = { + "type": "LinkPath", + "metadata": { + "modifies": true }, - 'title-subtitle': { - desc: 'subtitle', - caption: (item)=>`Subtitle text '${titleCaption(item)}'` - } -}; -// aria properties generated for mark item encoding channels -const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL -}; -function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - if (hide || item.description == null) for(const prop in AriaEncode)emit(AriaEncode[prop], undefined); - else { - const type = item.mark.marktype; - emit(ARIA_LABEL, item.description); - emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); - emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`); - } -} -function ariaMarkAttributes(mark) { - return mark.aria === false ? { - [ARIA_HIDDEN]: true - } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); -} -function ariaMark(mark) { - const type = mark.marktype; - const recurse = type === 'group' || type === 'text' || mark.items.some((_)=>_.description != null && _.aria !== false); - return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description); -} -function ariaGuide(mark, opt) { - try { - const item = mark.items[0], caption = opt.caption || (()=>''); - return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); - } catch (err) { - return null; - } -} -function titleCaption(item) { - return (0, _vegaUtil.array)(item.text).join(' '); -} -function axisCaption(item) { - const datum = item.datum, orient = item.orient, title = datum.title ? extractTitle(item) : null, ctx = item.context, scale = ctx.scales[datum.scale].value, locale = ctx.dataflow.locale(), type = scale.type, xy = orient === 'left' || orient === 'right' ? 'Y' : 'X'; - return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${(0, _vegaScale.isDiscrete)(type) ? 'discrete' : type} scale` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function legendCaption(item) { - const datum = item.datum, title = datum.title ? extractTitle(item) : null, type = `${datum.type || ''} legend`.trim(), scales = datum.scales, props = Object.keys(scales), ctx = item.context, scale = ctx.scales[scales[props[0]]].value, locale = ctx.dataflow.locale(); - return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function extractTitle(item) { - try { - return (0, _vegaUtil.array)((0, _vegaUtil.peek)(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } -} -function channelCaption(props) { - props = props.map((p)=>p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + (0, _vegaUtil.peek)(props); -} -function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; -} -const innerText = (val)=>(val + '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); -const attrText = (val)=>innerText(val).replace(/"/g, '"').replace(/\t/g, ' ').replace(/\n/g, ' ').replace(/\r/g, ' '); -function markup() { - let buf = '', outer = '', inner = ''; - const stack = [], clear = ()=>outer = inner = '', push = (tag)=>{ - if (outer) { - buf += `${outer}>${inner}`; - clear(); - } - stack.push(tag); - }, attr = (name, value)=>{ - if (value != null) outer += ` ${name}="${attrText(value)}"`; - return m; - }, m = { - open (tag) { - push(tag); - outer = '<' + tag; - for(var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)attrs[_key - 1] = arguments[_key]; - for (const set of attrs)for(const key in set)attr(key, set[key]); - return m; - }, - close () { - const tag = stack.pop(); - if (outer) buf += outer + (inner ? `>${inner}</${tag}>` : '/>'); - else buf += `</${tag}>`; - clear(); - return m; - }, - attr, - text: (t)=>(inner += innerText(t), m), - toString: ()=>buf - }; - return m; -} -const serializeXML = (node)=>_serialize(markup(), node) + ''; -function _serialize(m, node) { - m.open(node.tagName); - if (node.hasAttributes()) { - const attrs = node.attributes, n = attrs.length; - for(let i = 0; i < n; ++i)m.attr(attrs[i].name, attrs[i].value); - } - if (node.hasChildNodes()) { - const children = node.childNodes; - for (const child of children)child.nodeType === 3 // text node - ? m.text(child.nodeValue) : _serialize(m, child); - } - return m.close(); -} -const stylesAttr = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity' -}; -const stylesCss = { - blend: 'mix-blend-mode' -}; -// ensure miter limit default is consistent with canvas (#2498) -const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 -}; -const RootIndex = 0, xmlns = 'http://www.w3.org/2000/xmlns/', svgns = metadata.xmlns; -class SVGRenderer extends Renderer { - constructor(loader){ - super(loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - /** - * Initialize a new SVGRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - // create the svg definitions cache - this._defs = {}; - this._clearDefs(); - if (el) { - this._svg = domChild(el, 0, 'svg', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']); - this._svg.setAttribute('version', metadata['version']); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', svgns); - setAttributes(this._root, rootAttributes); - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - // set background color if defined - this.background(this._bgcolor); - return super.initialize(el, width, height, origin, scaleFactor); + "params": [{ + "name": "sourceX", + "type": "field", + "default": "source.x" + }, { + "name": "sourceY", + "type": "field", + "default": "source.y" + }, { + "name": "targetX", + "type": "field", + "default": "target.x" + }, { + "name": "targetY", + "type": "field", + "default": "target.y" + }, { + "name": "orient", + "type": "enum", + "default": "vertical", + "values": ["horizontal", "vertical", "radial"] + }, { + "name": "shape", + "type": "enum", + "default": "line", + "values": ["line", "arc", "curve", "diagonal", "orthogonal"] + }, { + "name": "require", + "type": "signal" + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(LinkPath, Transform, { + transform(_, pulse2) { + var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx2 = _.targetX || targetX, ty2 = _.targetY || targetY, as = _.as || "path", orient = _.orient || "vertical", shape2 = _.shape || "line", path2 = Paths.get(shape2 + "-" + orient) || Paths.get(shape2); + if (!path2) { + error("LinkPath unsupported type: " + _.shape + (_.orient ? "-" + _.orient : "")); + } + pulse2.visit(pulse2.SOURCE, (t) => { + t[as] = path2(sx(t), sy(t), tx2(t), ty2(t)); + }); + return pulse2.reflow(_.modified()).modifies(as); } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length && this._svg) this._svg.style.setProperty('background-color', bgcolor); - return super.background(...arguments); + }); + const line = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "L" + tx2 + "," + ty2; + const lineR = (sa2, sr, ta, tr2) => line(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const arc = (sx, sy, tx2, ty2) => { + var dx = tx2 - sx, dy = ty2 - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; + return "M" + sx + "," + sy + "A" + rr + "," + rr + " " + ra + " 0 1 " + tx2 + "," + ty2; + }; + const arcR = (sa2, sr, ta, tr2) => arc(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const curve = (sx, sy, tx2, ty2) => { + const dx = tx2 - sx, dy = ty2 - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); + return "M" + sx + "," + sy + "C" + (sx + ix) + "," + (sy + iy) + " " + (tx2 + iy) + "," + (ty2 - ix) + " " + tx2 + "," + ty2; + }; + const curveR = (sa2, sr, ta, tr2) => curve(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const orthoX = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "V" + ty2 + "H" + tx2; + const orthoY = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "H" + tx2 + "V" + ty2; + const orthoR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), sf = Math.abs(ta - sa2) > Math.PI ? ta <= sa2 : ta > sa2; + return "M" + sr * sc + "," + sr * ss + "A" + sr + "," + sr + " 0 0," + (sf ? 1 : 0) + " " + sr * tc + "," + sr * ts2 + "L" + tr2 * tc + "," + tr2 * ts2; + }; + const diagonalX = (sx, sy, tx2, ty2) => { + const m2 = (sx + tx2) / 2; + return "M" + sx + "," + sy + "C" + m2 + "," + sy + " " + m2 + "," + ty2 + " " + tx2 + "," + ty2; + }; + const diagonalY = (sx, sy, tx2, ty2) => { + const m2 = (sy + ty2) / 2; + return "M" + sx + "," + sy + "C" + sx + "," + m2 + " " + tx2 + "," + m2 + " " + tx2 + "," + ty2; + }; + const diagonalR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), mr = (sr + tr2) / 2; + return "M" + sr * sc + "," + sr * ss + "C" + mr * sc + "," + mr * ss + " " + mr * tc + "," + mr * ts2 + " " + tr2 * tc + "," + tr2 * ts2; + }; + const Paths = fastmap({ + "line": line, + "line-radial": lineR, + "arc": arc, + "arc-radial": arcR, + "curve": curve, + "curve-radial": curveR, + "orthogonal-horizontal": orthoX, + "orthogonal-vertical": orthoY, + "orthogonal-radial": orthoR, + "diagonal-horizontal": diagonalX, + "diagonal-vertical": diagonalY, + "diagonal-radial": diagonalR + }); + function Pie(params2) { + Transform.call(this, null, params2); + } + Pie.Definition = { + "type": "Pie", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "startAngle", + "type": "number", + "default": 0 + }, { + "name": "endAngle", + "type": "number", + "default": 6.283185307179586 + }, { + "name": "sort", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["startAngle", "endAngle"] + }] + }; + inherits(Pie, Transform, { + transform(_, pulse2) { + var as = _.as || ["startAngle", "endAngle"], startAngle = as[0], endAngle = as[1], field2 = _.field || one$1, start = _.startAngle || 0, stop2 = _.endAngle != null ? _.endAngle : 2 * Math.PI, data2 = pulse2.source, values2 = data2.map(field2), n = values2.length, a2 = start, k = (stop2 - start) / sum$1(values2), index2 = range$3(n), i, t, v; + if (_.sort) { + index2.sort((a3, b2) => values2[a3] - values2[b2]); + } + for (i = 0; i < n; ++i) { + v = values2[index2[i]]; + t = data2[index2[i]]; + t[startAngle] = a2; + t[endAngle] = a2 += v * k; + } + this.value = values2; + return pulse2.reflow(_.modified()).modifies(as); } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._svg) { - setAttributes(this._svg, { - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - }); - this._root.setAttribute('transform', `translate(${this._origin})`); - } - this._dirty = []; - return this; + }); + const DEFAULT_COUNT = 5; + function includeZero(scale2) { + const type2 = scale2.type; + return !scale2.bins && (type2 === Linear || type2 === Pow || type2 === Sqrt); + } + function includePad(type2) { + return isContinuous(type2) && type2 !== Sequential; + } + const SKIP$1 = toSet(["set", "modified", "clear", "type", "scheme", "schemeExtent", "schemeCount", "domain", "domainMin", "domainMid", "domainMax", "domainRaw", "domainImplicit", "nice", "zero", "bins", "range", "rangeStep", "round", "reverse", "interpolate", "interpolateGamma"]); + function Scale$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Scale$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, scale$12 = this.value, key2 = scaleKey(_); + if (!scale$12 || key2 !== scale$12.type) { + this.value = scale$12 = scale$4(key2)(); + } + for (key2 in _) if (!SKIP$1[key2]) { + if (key2 === "padding" && includePad(scale$12.type)) continue; + isFunction(scale$12[key2]) ? scale$12[key2](_[key2]) : df.warn("Unsupported scale property: " + key2); + } + configureRange(scale$12, _, configureBins(scale$12, _, configureDomain(scale$12, _, df))); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - /** - * Returns the SVG element of the visualization. - * @return {DOMElement} - The SVG element. - */ canvas() { - return this._svg; + }); + function scaleKey(_) { + var t = _.type, d2 = "", n; + if (t === Sequential) return Sequential + "-" + Linear; + if (isContinuousColor(_)) { + n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; + d2 = n === 2 ? Sequential + "-" : n === 3 ? Diverging + "-" : ""; } - /** - * Returns an SVG text string for the rendered content, - * or null if this renderer is currently headless. - */ svg() { - const svg = this._svg, bg = this._bgcolor; - if (!svg) return null; - let node; - if (bg) { - svg.removeAttribute('style'); - node = domChild(svg, RootIndex, 'rect', svgns); - setAttributes(node, { - width: this._width, - height: this._height, - fill: bg - }); - } - const text = serializeXML(svg); - if (bg) { - svg.removeChild(node); - this._svg.style.setProperty('background-color', bg); - } - return text; + return (d2 + t || Linear).toLowerCase(); + } + function isContinuousColor(_) { + const t = _.type; + return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString)); + } + function configureDomain(scale2, _, df) { + const raw = rawDomain(scale2, _.domainRaw, df); + if (raw > -1) return raw; + var domain2 = _.domain, type2 = scale2.type, zero2 = _.zero || _.zero === void 0 && includeZero(scale2), n, mid; + if (!domain2) return 0; + if (zero2 || _.domainMin != null || _.domainMax != null || _.domainMid != null) { + n = (domain2 = domain2.slice()).length - 1 || 1; + if (zero2) { + if (domain2[0] > 0) domain2[0] = 0; + if (domain2[n] < 0) domain2[n] = 0; + } + if (_.domainMin != null) domain2[0] = _.domainMin; + if (_.domainMax != null) domain2[n] = _.domainMax; + if (_.domainMid != null) { + mid = _.domainMid; + const i = mid > domain2[n] ? n + 1 : mid < domain2[0] ? 0 : n; + if (i !== n) df.warn("Scale domainMid exceeds domain min or max.", mid); + domain2.splice(i, 0, mid); + } } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._clearDefs(); - this.mark(this._root, scene, undefined, markTypes); - domClear(this._root, 1); - } - this.defs(); - this._dirty = []; - ++this._dirtyID; - return this; + if (includePad(type2) && _.padding && domain2[0] !== peek$1(domain2)) { + domain2 = padDomain(type2, domain2, _.range, _.padding, _.exponent, _.constant); } - // -- Manage rendering of items marked as dirty -- - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (item.dirty !== this._dirtyID) { - item.dirty = this._dirtyID; - this._dirty.push(item); - } + scale2.domain(domainCheck(type2, domain2, df)); + if (type2 === Ordinal) { + scale2.unknown(_.domainImplicit ? implicit : void 0); } - /** - * Check if a mark item is considered dirty. - * @param {Item} item - The mark item. - */ isDirty(item) { - return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; + if (_.nice && scale2.nice) { + scale2.nice(_.nice !== true && tickCount(scale2, _.nice) || null); } - /** - * Internal method to check dirty status and, if possible, - * make targetted updates without a full rendering pass. - */ _dirtyCheck() { - this._dirtyAll = true; - const items = this._dirty; - if (!items.length || !this._dirtyID) return true; - const id = ++this._dirtyID; - let item, mark, type, mdef, i, n, o; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - mark = item.mark; - if (mark.marktype !== type) { - // memoize mark instance lookup - type = mark.marktype; - mdef = Marks[type]; - } - if (mark.zdirty && mark.dirty !== id) { - this._dirtyAll = false; - dirtyParents(item, id); - mark.items.forEach((i)=>{ - i.dirty = id; - }); - } - if (mark.zdirty) continue; // handle in standard drawing pass - if (item.exit) { - // EXIT - if (mdef.nested && mark.items.length) { - // if nested mark with remaining points, update instead - o = mark.items[0]; - if (o._svg) this._update(mdef, o._svg, o); - } else if (item._svg) { - // otherwise remove from DOM - o = item._svg.parentNode; - if (o) o.removeChild(item._svg); - } - item._svg = null; - continue; - } - item = mdef.nested ? mark.items[0] : item; - if (item._update === id) continue; // already visited - if (!item._svg || !item._svg.ownerSVGElement) { - // ENTER - this._dirtyAll = false; - dirtyParents(item, id); - } else // IN-PLACE UPDATE - this._update(mdef, item._svg, item); - item._update = id; - } - return !this._dirtyAll; + return domain2.length; + } + function rawDomain(scale2, raw, df) { + if (raw) { + scale2.domain(domainCheck(scale2.type, raw, df)); + return raw.length; + } else { + return -1; } - // -- Construct & maintain scenegraph to SVG mapping --- - /** - * Render a set of mark items. - * @param {SVGElement} el - The parent element in the SVG tree. - * @param {object} scene - The mark parent to render. - * @param {SVGElement} prev - The previous sibling in the SVG tree. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ mark(el, scene, prev, markTypes) { - if (!this.isDirty(scene)) return scene._svg; - const svg = this._svg, markType = scene.marktype, mdef = Marks[markType], events = scene.interactive === false ? 'none' : null, isGroup = mdef.tag === 'g'; - const parent = bind(scene, el, prev, 'g', svg); - if (markType !== 'group' && markTypes != null && !markTypes.includes(markType)) { - domClear(parent, 0); - return scene._svg; - } - parent.setAttribute('class', cssClass(scene)); - // apply aria attributes to parent container element - const aria = ariaMarkAttributes(scene); - for(const key in aria)setAttribute(parent, key, aria[key]); - if (!isGroup) setAttribute(parent, 'pointer-events', events); - setAttribute(parent, 'clip-path', scene.clip ? clip$1(this, scene, scene.group) : null); - let sibling = null, i = 0; - const process = (item)=>{ - const dirty = this.isDirty(item), node = bind(item, parent, sibling, mdef.tag, svg); - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item, markTypes); - } - sibling = node; - ++i; - }; - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else visit(scene, process); - domClear(parent, i); - return parent; + } + function padDomain(type2, domain2, range2, pad2, exponent2, constant2) { + var span2 = Math.abs(peek$1(range2) - range2[0]), frac = span2 / (span2 - 2 * pad2), d2 = type2 === Log ? zoomLog(domain2, null, frac) : type2 === Sqrt ? zoomPow(domain2, null, frac, 0.5) : type2 === Pow ? zoomPow(domain2, null, frac, exponent2 || 1) : type2 === Symlog ? zoomSymlog(domain2, null, frac, constant2 || 1) : zoomLinear(domain2, null, frac); + domain2 = domain2.slice(); + domain2[0] = d2[0]; + domain2[domain2.length - 1] = d2[1]; + return domain2; + } + function domainCheck(type2, domain2, df) { + if (isLogarithmic(type2)) { + var s2 = Math.abs(domain2.reduce((s3, v) => s3 + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); + if (s2 !== domain2.length) { + df.warn("Log scale domain includes zero: " + $(domain2)); + } } - /** - * Update the attributes of an SVG element for a mark item. - * @param {object} mdef - The mark definition object - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ _update(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - // apply aria-specific properties - ariaItemAttributes(emit, item); - // apply svg attributes - mdef.attr(emit, item, this); - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - // apply svg style attributes - // note: element state may have been modified by 'extra' method - if (element) this.style(element, item); + return domain2; + } + function configureBins(scale2, _, count2) { + let bins = _.bins; + if (bins && !isArray(bins)) { + const domain2 = scale2.domain(), lo = domain2[0], hi = peek$1(domain2), step = bins.step; + let start = bins.start == null ? lo : bins.start, stop2 = bins.stop == null ? hi : bins.stop; + if (!step) error("Scale bins parameter missing step property."); + if (start < lo) start = step * Math.ceil(lo / step); + if (stop2 > hi) stop2 = step * Math.floor(hi / step); + bins = range$3(start, stop2 + step / 2, step); + } + if (bins) { + scale2.bins = bins; + } else if (scale2.bins) { + delete scale2.bins; + } + if (scale2.type === BinOrdinal) { + if (!bins) { + scale2.bins = scale2.domain(); + } else if (!_.domain && !_.domainRaw) { + scale2.domain(bins); + count2 = bins.length; + } } - /** - * Update the presentation attributes of an SVG element for a mark item. - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ style(el, item) { - if (item == null) return; - for(const prop in stylesAttr){ - let value = prop === 'font' ? fontFamily(item) : item[prop]; - if (value === values[prop]) continue; - const name = stylesAttr[prop]; - if (value == null) el.removeAttribute(name); - else { - if (isGradient(value)) value = gradientRef(value, this._defs.gradient, href()); - el.setAttribute(name, value + ''); - } - values[prop] = value; + return count2; + } + function configureRange(scale2, _, count2) { + var type2 = scale2.type, round = _.round || false, range2 = _.range; + if (_.rangeStep != null) { + range2 = configureRangeStep(type2, _, count2); + } else if (_.scheme) { + range2 = configureScheme(type2, _, count2); + if (isFunction(range2)) { + if (scale2.interpolator) { + return scale2.interpolator(range2); + } else { + error(`Scale type ${type2} does not support interpolating color schemes.`); } - for(const prop in stylesCss)setStyle(el, stylesCss[prop], item[prop]); + } } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - */ defs() { - const svg = this._svg, defs = this._defs; - let el = defs.el, index = 0; - for(const id in defs.gradient){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateGradient(el, defs.gradient[id], index); - } - for(const id in defs.clipping){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateClipping(el, defs.clipping[id], index); - } - // clean-up - if (el) index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index); + if (range2 && isInterpolating(type2)) { + return scale2.interpolator(interpolateColors(flip(range2, _.reverse), _.interpolate, _.interpolateGamma)); } - /** - * Clear defs caches. - */ _clearDefs() { - const def = this._defs; - def.gradient = {}; - def.clipping = {}; - } -} -// mark ancestor chain with a dirty id -function dirtyParents(item, id) { - for(; item && item.dirty !== id; item = item.mark.group){ - item.dirty = id; - if (item.mark && item.mark.dirty !== id) item.mark.dirty = id; - else return; - } -} -// update gradient definitions -function updateGradient(el, grad, index) { - let i, n, stop; - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - let pt = domChild(el, index++, 'pattern', svgns); - setAttributes(pt, { - id: patternPrefix + grad.id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - pt = domChild(pt, 0, 'rect', svgns); - setAttributes(pt, { - width: 1, - height: 1, - fill: `url(${href()}#${grad.id})` - }); - el = domChild(el, index++, 'radialGradient', svgns); - setAttributes(el, { - id: grad.id, - fx: grad.x1, - fy: grad.y1, - fr: grad.r1, - cx: grad.x2, - cy: grad.y2, - r: grad.r2 - }); - } else { - el = domChild(el, index++, 'linearGradient', svgns); - setAttributes(el, { - id: grad.id, - x1: grad.x1, - x2: grad.x2, - y1: grad.y1, - y2: grad.y2 - }); + if (range2 && _.interpolate && scale2.interpolate) { + scale2.interpolate(interpolate(_.interpolate, _.interpolateGamma)); + } else if (isFunction(scale2.round)) { + scale2.round(round); + } else if (isFunction(scale2.rangeRound)) { + scale2.interpolate(round ? interpolateRound : interpolate$1); } - for(i = 0, n = grad.stops.length; i < n; ++i){ - stop = domChild(el, i, 'stop', svgns); - stop.setAttribute('offset', grad.stops[i].offset); - stop.setAttribute('stop-color', grad.stops[i].color); + if (range2) scale2.range(flip(range2, _.reverse)); + } + function configureRangeStep(type2, _, count2) { + if (type2 !== Band && type2 !== Point) { + error("Only band and point scales support rangeStep."); } - domClear(el, i); - return index; -} -// update clipping path definitions -function updateClipping(el, clip, index) { - let mask; - el = domChild(el, index, 'clipPath', svgns); - el.setAttribute('id', clip.id); - if (clip.path) { - mask = domChild(el, 0, 'path', svgns); - mask.setAttribute('d', clip.path); + var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type2 === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; + return [0, _.rangeStep * bandSpace(count2, inner, outer)]; + } + function configureScheme(type2, _, count2) { + var extent2 = _.schemeExtent, name, scheme$1; + if (isArray(_.scheme)) { + scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); } else { - mask = domChild(el, 0, 'rect', svgns); - setAttributes(mask, { - x: 0, - y: 0, - width: clip.width, - height: clip.height - }); + name = _.scheme.toLowerCase(); + scheme$1 = scheme(name); + if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`); } - domClear(el, 1); - return index + 1; -} -// Recursively process group contents. -function recurse(renderer, el, group, markTypes) { - // child 'g' element is second to last among children (path, g, path) - // other children here are foreground and background path elements - el = el.lastChild.previousSibling; - let prev, idx = 0; - visit(group, (item)=>{ - prev = renderer.mark(el, item, prev, markTypes); - ++idx; - }); - // remove any extraneous DOM elements - domClear(el, 1 + idx); -} -// Bind a scenegraph item to an SVG DOM element. -// Create new SVG elements as needed. -function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, svgns); - item._svg = node; - if (item.mark) { - node.__data__ = item; - node.__values__ = { - fill: 'default' - }; - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', svgns); - node.appendChild(bg); - bg.__data__ = item; - const cg = domCreate(doc, 'g', svgns); - node.appendChild(cg); - cg.__data__ = item; - const fg = domCreate(doc, 'path', svgns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = { - fill: 'default' - }; - } - } + count2 = type2 === Threshold ? count2 + 1 : type2 === BinOrdinal ? count2 - 1 : type2 === Quantile || type2 === Quantize ? +_.schemeCount || DEFAULT_COUNT : count2; + return isInterpolating(type2) ? adjustScheme(scheme$1, extent2, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent2), count2) : type2 === Ordinal ? scheme$1 : scheme$1.slice(0, count2); + } + function adjustScheme(scheme2, extent2, reverse2) { + return isFunction(scheme2) && (extent2 || reverse2) ? interpolateRange(scheme2, flip(extent2 || [0, 1], reverse2)) : scheme2; + } + function flip(array2, reverse2) { + return reverse2 ? array2.slice().reverse() : array2; + } + function SortItems$1(params2) { + Transform.call(this, null, params2); + } + inherits(SortItems$1, Transform, { + transform(_, pulse2) { + const mod = _.modified("sort") || pulse2.changed(pulse2.ADD) || pulse2.modified(_.sort.fields) || pulse2.modified("datum"); + if (mod) pulse2.source.sort(stableCompare(_.sort)); + this.modified(mod); + return pulse2; } - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - return node; -} -// check if two nodes are ordered siblings -function siblingCheck(node, sibling) { - return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same -} -// -- Set attributes & styles on SVG elements --- -let element = null, // temp var for current SVG element -values = null; // temp var for current values hash -// Extra configuration for certain mark types -const mark_extras = { - group (mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - // leave element null to prevent downstream styling - element = null; - } else // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); - }, - image (mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else setStyle(el, 'image-rendering', null); + }); + const Zero = "zero", Center$1 = "center", Normalize = "normalize", DefOutput = ["y0", "y1"]; + function Stack(params2) { + Transform.call(this, null, params2); + } + Stack.Definition = { + "type": "Stack", + "metadata": { + "modifies": true }, - text (mdef, el, item) { - const tl = textLines(item); - let key, value, doc, lh; - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - value = tl.map((_)=>textValue(item, _)); - key = value.join('\n'); // content cache key - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i)=>{ - const ts = domCreate(doc, 'tspan', svgns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } -}; -function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - // use appropriate method given namespace (ns) - if (ns) setAttributeNS(element, name, value, ns); - else setAttribute(element, name, value); - // note current value for future comparison - values[name] = value; -} -function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) el.style.removeProperty(name); - else el.style.setProperty(name, value + ''); - values[name] = value; - } -} -function setAttributes(el, attrs) { - for(const key in attrs)setAttribute(el, key, attrs[key]); -} -function setAttribute(el, name, value) { - if (value != null) // if value is provided, update DOM attribute - el.setAttribute(name, value); - else // else remove DOM attribute - el.removeAttribute(name); -} -function setAttributeNS(el, name, value, ns) { - if (value != null) // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - else // else remove DOM attribute - el.removeAttributeNS(ns, name); -} -function href() { - let loc; - return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; -} -class SVGStringRenderer extends Renderer { - constructor(loader){ - super(loader); - this._text = null; - this._defs = { - gradient: {}, - clipping: {} - }; + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "sort", + "type": "compare" + }, { + "name": "offset", + "type": "enum", + "default": Zero, + "values": [Zero, Center$1, Normalize] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": DefOutput + }] + }; + inherits(Stack, Transform, { + transform(_, pulse2) { + var as = _.as || DefOutput, y02 = as[0], y12 = as[1], sort2 = stableCompare(_.sort), field2 = _.field || one$1, stack = _.offset === Center$1 ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max2; + groups = partition$3(pulse2.source, _.groupby, sort2, field2); + for (i = 0, n = groups.length, max2 = groups.max; i < n; ++i) { + stack(groups[i], max2, field2, y02, y12); + } + return pulse2.reflow(_.modified()).modifies(as); } - /** - * Returns the rendered SVG text string, - * or null if rendering has not yet occurred. - */ svg() { - return this._text; + }); + function stackCenter(group2, max2, field2, y02, y12) { + var last = (max2 - group2.sum) / 2, m2 = group2.length, j = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last += Math.abs(field2(t)); } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - */ _render(scene) { - const m = markup(); - // svg tag - m.open('svg', (0, _vegaUtil.extend)({}, metadata, { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - })); - // background, if defined - const bg = this._bgcolor; - if (bg && bg !== 'transparent' && bg !== 'none') m.open('rect', { - width: this._width, - height: this._height, - fill: bg - }).close(); - // root content group - m.open('g', rootAttributes, { - transform: 'translate(' + this._origin + ')' - }); - this.mark(m, scene); - m.close(); // </g> - // defs - this.defs(m); - // get SVG text string - this._text = m.close() + ''; - return this; + } + function stackNormalize(group2, max2, field2, y02, y12) { + var scale2 = 1 / group2.sum, last = 0, m2 = group2.length, j = 0, v = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last = scale2 * (v += Math.abs(field2(t))); } - /** - * Render a set of mark items. - * @param {object} m - The markup context. - * @param {object} scene - The mark parent to render. - */ mark(m, scene) { - const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ - ariaItemAttributes, - mdef.attr - ]; - // render opening group tag - m.open('g', { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip$1(this, scene, scene.group) : null - }, ariaMarkAttributes(scene), { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - }); - // render contained elements - const process = (item)=>{ - const href = this.href(item); - if (href) m.open('a', href); - m.open(tag, this.attr(scene, item, attrList, tag !== 'g' ? tag : null)); - if (tag === 'text') { - const tl = textLines(item); - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - const attrs = { - x: 0, - dy: lineHeight(item) - }; - for(let i = 0; i < tl.length; ++i)m.open('tspan', i ? attrs : null).text(textValue(item, tl[i])).close(); - } else // single-line text - m.text(textValue(item, tl)); - } else if (tag === 'g') { - const fore = item.strokeForeground, fill = item.fill, stroke = item.stroke; - if (fore && stroke) item.stroke = null; - m.open('path', this.attr(scene, item, mdef.background, 'bgrect')).close(); - // recurse for group content - m.open('g', this.attr(scene, item, mdef.content)); - visit(item, (scene)=>this.mark(m, scene)); - m.close(); - if (fore && stroke) { - if (fill) item.fill = null; - item.stroke = stroke; - m.open('path', this.attr(scene, item, mdef.foreground, 'bgrect')).close(); - if (fill) item.fill = fill; - } else m.open('path', this.attr(scene, item, mdef.foreground, 'bgfore')).close(); - } - m.close(); // </tag> - if (href) m.close(); // </a> - }; - if (mdef.nested) { - if (scene.items && scene.items.length) process(scene.items[0]); - } else visit(scene, process); - // render closing group tag - return m.close(); // </g> + } + function stackZero(group2, max2, field2, y02, y12) { + var lastPos = 0, lastNeg = 0, m2 = group2.length, j = 0, v, t; + for (; j < m2; ++j) { + t = group2[j]; + v = +field2(t); + if (v < 0) { + t[y02] = lastNeg; + t[y12] = lastNeg += v; + } else { + t[y02] = lastPos; + t[y12] = lastPos += v; + } } - /** - * Get href attributes for a hyperlinked mark item. - * @param {Item} item - The mark item. - */ href(item) { - const href = item.href; - let attr; - if (href) { - if (attr = this._hrefs && this._hrefs[href]) return attr; - else this.sanitizeURL(href).then((attr)=>{ - // rewrite to use xlink namespace - attr['xlink:href'] = attr.href; - attr.href = null; - (this._hrefs || (this._hrefs = {}))[href] = attr; - }); + } + function partition$3(data2, groupby, sort2, field2) { + var groups = [], get2 = (f) => f(t), map2, i, n, m2, t, k, g, s2, max2; + if (groupby == null) { + groups.push(data2.slice()); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + groups.push(g); } - return null; + g.push(t); + } } - /** - * Get an object of SVG attributes for a mark item. - * @param {object} scene - The mark parent. - * @param {Item} item - The mark item. - * @param {array|function} attrs - One or more attribute emitters. - * @param {string} tag - The tag being rendered. - */ attr(scene, item, attrs, tag) { - const object = {}, emit = (name, value, ns, prefixed)=>{ - object[prefixed || name] = value; - }; - // apply mark specific attributes - if (Array.isArray(attrs)) attrs.forEach((fn)=>fn(emit, item, this)); - else attrs(emit, item, this); - // apply style attributes - if (tag) style(object, item, scene, tag, this._defs); - return object; + for (k = 0, max2 = 0, m2 = groups.length; k < m2; ++k) { + g = groups[k]; + for (i = 0, s2 = 0, n = g.length; i < n; ++i) { + s2 += Math.abs(field2(g[i])); + } + g.sum = s2; + if (s2 > max2) max2 = s2; + if (sort2) g.sort(sort2); } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - * @param {object} m - The markup context. - */ defs(m) { - const gradient = this._defs.gradient, clipping = this._defs.clipping, count = Object.keys(gradient).length + Object.keys(clipping).length; - if (count === 0) return; // nothing to do - m.open('defs'); - for(const id in gradient){ - const def = gradient[id], stops = def.stops; - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - m.open('pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - m.open('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }).close(); - m.close(); // </pattern> - m.open('radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else m.open('linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - for(let i = 0; i < stops.length; ++i)m.open('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }).close(); - m.close(); - } - for(const id in clipping){ - const def = clipping[id]; - m.open('clipPath', { - id: id - }); - if (def.path) m.open('path', { - d: def.path - }).close(); - else m.open('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }).close(); - m.close(); - } - m.close(); - } -} -// Helper function for attr for style presentation attributes -function style(s, item, scene, tag, defs) { - let styleList; - if (item == null) return s; - if (tag === 'bgrect' && scene.interactive === false) s['pointer-events'] = 'none'; - if (tag === 'bgfore') { - if (scene.interactive === false) s['pointer-events'] = 'none'; - s.display = 'none'; - if (item.fill !== null) return s; - } - if (tag === 'image' && item.smooth === false) styleList = [ - 'image-rendering: optimizeSpeed;', - 'image-rendering: pixelated;' - ]; - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - s['font-style'] = item.fontStyle; - s['font-variant'] = item.fontVariant; - s['font-weight'] = item.fontWeight; - } - for(const prop in stylesAttr){ - let value = item[prop]; - const name = stylesAttr[prop]; - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; - else if (value != null) { - if (isGradient(value)) value = gradientRef(value, defs.gradient, ''); - s[name] = value; - } - } - for(const prop in stylesCss){ - const value = item[prop]; - if (value != null) { - styleList = styleList || []; - styleList.push(`${stylesCss[prop]}: ${value};`); - } - } - if (styleList) s.style = styleList.join(' '); - return s; -} -/** - * @typedef {Object} HybridRendererOptions - * - * @property {string[]} [svgMarkTypes=['text']] - An array of SVG mark types to render - * in the SVG layer. All other mark types - * will be rendered in the Canvas layer. - * @property {boolean} [svgOnTop=true] - Flag to determine if SVG should be rendered on top. - * @property {boolean} [debug=false] - Flag to enable or disable debugging mode. When true, - * the top layer will be stacked below the bottom layer - * rather than overlaid on top. - */ /** @type {HybridRendererOptions} */ const OPTS = { - svgMarkTypes: [ - 'text' - ], - svgOnTop: true, - debug: false -}; -/** - * Configure the HybridRenderer - * - * @param {HybridRendererOptions} options - HybridRenderer configuration options. - */ function setHybridRendererOptions(options) { - OPTS['svgMarkTypes'] = options.svgMarkTypes ?? [ - 'text' - ]; - OPTS['svgOnTop'] = options.svgOnTop ?? true; - OPTS['debug'] = options.debug ?? false; -} -class HybridRenderer extends Renderer { - constructor(loader){ - super(loader); - this._svgRenderer = new SVGRenderer(loader); - this._canvasRenderer = new CanvasRenderer(loader); + groups.max = max2; + return groups; + } + const encode$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + axisticks: AxisTicks$1, + datajoin: DataJoin$1, + encode: Encode$1, + legendentries: LegendEntries$1, + linkpath: LinkPath, + pie: Pie, + scale: Scale$1, + sortitems: SortItems$1, + stack: Stack + }, Symbol.toStringTag, { value: "Module" })); + var epsilon$3 = 1e-6; + var epsilon2 = 1e-12; + var pi$1 = Math.PI; + var halfPi$1 = pi$1 / 2; + var quarterPi = pi$1 / 4; + var tau$1 = pi$1 * 2; + var degrees = 180 / pi$1; + var radians = pi$1 / 180; + var abs$1 = Math.abs; + var atan = Math.atan; + var atan2 = Math.atan2; + var cos$1 = Math.cos; + var ceil = Math.ceil; + var exp = Math.exp; + var hypot = Math.hypot; + var log$1 = Math.log; + var pow$1 = Math.pow; + var sin$1 = Math.sin; + var sign = Math.sign || function(x2) { + return x2 > 0 ? 1 : x2 < 0 ? -1 : 0; + }; + var sqrt$1 = Math.sqrt; + var tan = Math.tan; + function acos(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$1 : Math.acos(x2); + } + function asin$1(x2) { + return x2 > 1 ? halfPi$1 : x2 < -1 ? -halfPi$1 : Math.asin(x2); + } + function noop$2() { + } + function streamGeometry(geometry, stream2) { + if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { + streamGeometryType[geometry.type](geometry, stream2); } - /** - * Initialize a new HybridRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {HybridRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._root_el = domChild(el, 0, 'div'); - const bottomEl = domChild(this._root_el, 0, 'div'); - const topEl = domChild(this._root_el, 1, 'div'); - this._root_el.style.position = 'relative'; - // Set position absolute to overlay svg on top of canvas - if (!OPTS.debug) { - bottomEl.style.height = '100%'; - topEl.style.position = 'absolute'; - topEl.style.top = '0'; - topEl.style.left = '0'; - topEl.style.height = '100%'; - topEl.style.width = '100%'; - } - this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; - this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; - // pointer-events to none on SVG layer so that canvas gets all events - this._svgEl.style.pointerEvents = 'none'; - this._canvasRenderer.initialize(this._canvasEl, width, height, origin, scaleFactor); - this._svgRenderer.initialize(this._svgEl, width, height, origin, scaleFactor); - return super.initialize(el, width, height, origin, scaleFactor); + } + var streamObjectType = { + Feature: function(object2, stream2) { + streamGeometry(object2.geometry, stream2); + }, + FeatureCollection: function(object2, stream2) { + var features = object2.features, i = -1, n = features.length; + while (++i < n) streamGeometry(features[i].geometry, stream2); } - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (OPTS.svgMarkTypes.includes(item.mark.marktype)) this._svgRenderer.dirty(item); - else this._canvasRenderer.dirty(item); - return this; + }; + var streamGeometryType = { + Sphere: function(object2, stream2) { + stream2.sphere(); + }, + Point: function(object2, stream2) { + object2 = object2.coordinates; + stream2.point(object2[0], object2[1], object2[2]); + }, + MultiPoint: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) object2 = coordinates[i], stream2.point(object2[0], object2[1], object2[2]); + }, + LineString: function(object2, stream2) { + streamLine(object2.coordinates, stream2, 0); + }, + MultiLineString: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamLine(coordinates[i], stream2, 0); + }, + Polygon: function(object2, stream2) { + streamPolygon(object2.coordinates, stream2); + }, + MultiPolygon: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamPolygon(coordinates[i], stream2); + }, + GeometryCollection: function(object2, stream2) { + var geometries = object2.geometries, i = -1, n = geometries.length; + while (++i < n) streamGeometry(geometries[i], stream2); } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - const allMarkTypes = markTypes ?? [ - 'arc', - 'area', - 'image', - 'line', - 'path', - 'rect', - 'rule', - 'shape', - 'symbol', - 'text', - 'trail' - ]; - const canvasMarkTypes = allMarkTypes.filter((m)=>!OPTS.svgMarkTypes.includes(m)); - this._svgRenderer.render(scene, OPTS.svgMarkTypes); - this._canvasRenderer.render(scene, canvasMarkTypes); + }; + function streamLine(coordinates, stream2, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + stream2.lineStart(); + while (++i < n) coordinate = coordinates[i], stream2.point(coordinate[0], coordinate[1], coordinate[2]); + stream2.lineEnd(); + } + function streamPolygon(coordinates, stream2) { + var i = -1, n = coordinates.length; + stream2.polygonStart(); + while (++i < n) streamLine(coordinates[i], stream2, 1); + stream2.polygonEnd(); + } + function geoStream(object2, stream2) { + if (object2 && streamObjectType.hasOwnProperty(object2.type)) { + streamObjectType[object2.type](object2, stream2); + } else { + streamGeometry(object2, stream2); } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - this._svgRenderer.resize(width, height, origin, scaleFactor); - this._canvasRenderer.resize(width, height, origin, scaleFactor); - return this; + } + var areaRingSum$1 = new Adder(); + var areaSum$1 = new Adder(), lambda00$2, phi00$2, lambda0$1, cosPhi0, sinPhi0; + var areaStream$1 = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaRingSum$1 = new Adder(); + areaStream$1.lineStart = areaRingStart$1; + areaStream$1.lineEnd = areaRingEnd$1; + }, + polygonEnd: function() { + var areaRing = +areaRingSum$1; + areaSum$1.add(areaRing < 0 ? tau$1 + areaRing : areaRing); + this.lineStart = this.lineEnd = this.point = noop$2; + }, + sphere: function() { + areaSum$1.add(tau$1); } - background(bgcolor) { - // Propagate background color to lower canvas renderer - if (OPTS.svgOnTop) this._canvasRenderer.background(bgcolor); - else this._svgRenderer.background(bgcolor); - return this; + }; + function areaRingStart$1() { + areaStream$1.point = areaPointFirst$1; + } + function areaRingEnd$1() { + areaPoint$1(lambda00$2, phi00$2); + } + function areaPointFirst$1(lambda, phi2) { + areaStream$1.point = areaPoint$1; + lambda00$2 = lambda, phi00$2 = phi2; + lambda *= radians, phi2 *= radians; + lambda0$1 = lambda, cosPhi0 = cos$1(phi2 = phi2 / 2 + quarterPi), sinPhi0 = sin$1(phi2); + } + function areaPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + phi2 = phi2 / 2 + quarterPi; + var dLambda = lambda - lambda0$1, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos$1(phi2), sinPhi = sin$1(phi2), k = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k * cos$1(adLambda), v = k * sdLambda * sin$1(adLambda); + areaRingSum$1.add(atan2(v, u2)); + lambda0$1 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; + } + function geoArea$1(object2) { + areaSum$1 = new Adder(); + geoStream(object2, areaStream$1); + return areaSum$1 * 2; + } + function spherical(cartesian2) { + return [atan2(cartesian2[1], cartesian2[0]), asin$1(cartesian2[2])]; + } + function cartesian(spherical2) { + var lambda = spherical2[0], phi2 = spherical2[1], cosPhi = cos$1(phi2); + return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)]; + } + function cartesianDot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cartesianCross(a2, b2) { + return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]]; + } + function cartesianAddInPlace(a2, b2) { + a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2]; + } + function cartesianScale(vector, k) { + return [vector[0] * k, vector[1] * k, vector[2] * k]; + } + function cartesianNormalizeInPlace(d2) { + var l = sqrt$1(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]); + d2[0] /= l, d2[1] /= l, d2[2] /= l; + } + var lambda0, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, deltaSum, ranges, range$2; + var boundsStream$1 = { + point: boundsPoint$1, + lineStart: boundsLineStart, + lineEnd: boundsLineEnd, + polygonStart: function() { + boundsStream$1.point = boundsRingPoint; + boundsStream$1.lineStart = boundsRingStart; + boundsStream$1.lineEnd = boundsRingEnd; + deltaSum = new Adder(); + areaStream$1.polygonStart(); + }, + polygonEnd: function() { + areaStream$1.polygonEnd(); + boundsStream$1.point = boundsPoint$1; + boundsStream$1.lineStart = boundsLineStart; + boundsStream$1.lineEnd = boundsLineEnd; + if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); + else if (deltaSum > epsilon$3) phi1 = 90; + else if (deltaSum < -epsilon$3) phi0 = -90; + range$2[0] = lambda0, range$2[1] = lambda1; + }, + sphere: function() { + lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); } -} -class HybridHandler extends CanvasHandler { - constructor(loader, tooltip){ - super(loader, tooltip); - } - initialize(el, origin, obj) { - const canvas = domChild(domChild(el, 0, 'div'), OPTS.svgOnTop ? 0 : 1, 'div'); - return super.initialize(canvas, origin, obj); - } -} -const Canvas = 'canvas'; -const Hybrid = 'hybrid'; -const PNG = 'png'; -const SVG = 'svg'; -const None = 'none'; -const RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - Hybrid: Hybrid, - None: None -}; -const modules = {}; -modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler -}; -modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler -}; -modules[Hybrid] = { - renderer: HybridRenderer, - headless: HybridRenderer, - handler: HybridHandler -}; -modules[None] = {}; -function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else return modules[name]; -} -function intersect(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : (0, _vegaUtil.error)('Intersect scene must be mark node or group item.'); -} -function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, type = mark.marktype, n = items.length; - let i = 0; - if (type === 'group') for(; i < n; ++i)intersectGroup(items[i], box, filter, hits); - else for(const test = Marks[type].isect; i < n; ++i){ - const item = items[i]; - if (intersectItem(item, box, test)) hits.push(item); + }; + function boundsPoint$1(lambda, phi2) { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + function linePoint(lambda, phi2) { + var p = cartesian([lambda * radians, phi2 * radians]); + if (p0) { + var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal); + cartesianNormalizeInPlace(inflection); + inflection = spherical(inflection); + var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs$1(delta) > 180; + if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = inflection[1] * degrees; + if (phii > phi1) phi1 = phii; + } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = -inflection[1] * degrees; + if (phii < phi0) phi0 = phii; + } else { + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + if (antimeridian) { + if (lambda < lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } + } else { + if (lambda1 >= lambda0) { + if (lambda < lambda0) lambda0 = lambda; + if (lambda > lambda1) lambda1 = lambda; + } else { + if (lambda > lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } } + } + } else { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); } - return hits; -} -function visitMark(mark, box, filter) { - // process if bounds intersect and if - // (1) mark is a group mark (so we must recurse), or - // (2) mark is interactive and passes filter - return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark))); -} -function intersectGroup(group, box, filter, hits) { - // test intersect against group - // skip groups by default unless filter says otherwise - if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) hits.push(group); - // recursively test children marks - // translate box to group coordinate space - const marks = group.items, n = marks && marks.length; - if (n) { - const x = group.x || 0, y = group.y || 0; - box.translate(-x, -y); - for(let i = 0; i < n; ++i)intersectMark(marks[i], box, filter, hits); - box.translate(x, y); + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + p0 = p, lambda2 = lambda; + } + function boundsLineStart() { + boundsStream$1.point = linePoint; + } + function boundsLineEnd() { + range$2[0] = lambda0, range$2[1] = lambda1; + boundsStream$1.point = boundsPoint$1; + p0 = null; + } + function boundsRingPoint(lambda, phi2) { + if (p0) { + var delta = lambda - lambda2; + deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); + } else { + lambda00$1 = lambda, phi00$1 = phi2; } - return hits; -} -function intersectItem(item, box, test) { - // test bounds enclosure, bounds intersection, then detailed test - const bounds = item.bounds; - return box.encloses(bounds) || box.intersects(bounds) && test(item, box); -} -const clipBounds = new Bounds(); -function boundClip(mark) { - const clip = mark.clip; - if ((0, _vegaUtil.isFunction)(clip)) clip(boundContext(clipBounds.clear())); - else if (clip) clipBounds.set(0, 0, mark.group.width, mark.group.height); - else return; - mark.bounds.intersect(clipBounds); -} -const TOLERANCE = 1e-9; -function sceneEqual(a, b, key) { - return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : (0, _vegaUtil.isNumber)(a) && (0, _vegaUtil.isNumber)(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !(0, _vegaUtil.isObject)(a) && !(0, _vegaUtil.isObject)(b) ? a == b : objectEqual(a, b); -} -function pathEqual(a, b) { - return sceneEqual(parse(a), parse(b)); -} -function objectEqual(a, b) { - var ka = Object.keys(a), kb = Object.keys(b), key, i; - if (ka.length !== kb.length) return false; - ka.sort(); - kb.sort(); - for(i = ka.length - 1; i >= 0; i--){ - if (ka[i] != kb[i]) return false; + areaStream$1.point(lambda, phi2); + linePoint(lambda, phi2); + } + function boundsRingStart() { + areaStream$1.lineStart(); + } + function boundsRingEnd() { + boundsRingPoint(lambda00$1, phi00$1); + areaStream$1.lineEnd(); + if (abs$1(deltaSum) > epsilon$3) lambda0 = -(lambda1 = 180); + range$2[0] = lambda0, range$2[1] = lambda1; + p0 = null; + } + function angle(lambda02, lambda12) { + return (lambda12 -= lambda02) < 0 ? lambda12 + 360 : lambda12; + } + function rangeCompare(a2, b2) { + return a2[0] - b2[0]; + } + function rangeContains(range2, x2) { + return range2[0] <= range2[1] ? range2[0] <= x2 && x2 <= range2[1] : x2 < range2[0] || range2[1] < x2; + } + function geoBounds$1(feature2) { + var i, n, a2, b2, merged, deltaMax, delta; + phi1 = lambda1 = -(lambda0 = phi0 = Infinity); + ranges = []; + geoStream(feature2, boundsStream$1); + if (n = ranges.length) { + ranges.sort(rangeCompare); + for (i = 1, a2 = ranges[0], merged = [a2]; i < n; ++i) { + b2 = ranges[i]; + if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) { + if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1]; + if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0]; + } else { + merged.push(a2 = b2); + } + } + for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a2 = merged[n]; i <= n; a2 = b2, ++i) { + b2 = merged[i]; + if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda0 = b2[0], lambda1 = a2[1]; + } } - for(i = ka.length - 1; i >= 0; i--){ - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; + ranges = range$2 = null; + return lambda0 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]]; + } + var W0, W1, X0$1, Y0$1, Z0$1, X1$1, Y1$1, Z1$1, X2$1, Y2$1, Z2$1, lambda00, phi00, x0$4, y0$4, z0; + var centroidStream$1 = { + sphere: noop$2, + point: centroidPoint$1, + lineStart: centroidLineStart$1, + lineEnd: centroidLineEnd$1, + polygonStart: function() { + centroidStream$1.lineStart = centroidRingStart$1; + centroidStream$1.lineEnd = centroidRingEnd$1; + }, + polygonEnd: function() { + centroidStream$1.lineStart = centroidLineStart$1; + centroidStream$1.lineEnd = centroidLineEnd$1; } - return typeof a === typeof b; -} -function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); -} - -},{"vega-util":"f2ulH","d3-shape":"50n1e","d3-path":"7nzmW","vega-canvas":"4O1hR","vega-loader":"8kWcg","vega-scale":"gHN3E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"50n1e":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "arc", ()=>(0, _arcJsDefault.default)); -parcelHelpers.export(exports, "area", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "line", ()=>(0, _lineJsDefault.default)); -parcelHelpers.export(exports, "pie", ()=>(0, _pieJsDefault.default)); -parcelHelpers.export(exports, "areaRadial", ()=>(0, _areaRadialJsDefault.default)) // Note: radialArea is deprecated! -; -parcelHelpers.export(exports, "radialArea", ()=>(0, _areaRadialJsDefault.default)); -parcelHelpers.export(exports, "lineRadial", ()=>(0, _lineRadialJsDefault.default)) // Note: radialLine is deprecated! -; -parcelHelpers.export(exports, "radialLine", ()=>(0, _lineRadialJsDefault.default)); -parcelHelpers.export(exports, "pointRadial", ()=>(0, _pointRadialJsDefault.default)); -parcelHelpers.export(exports, "link", ()=>(0, _linkJs.link)); -parcelHelpers.export(exports, "linkHorizontal", ()=>(0, _linkJs.linkHorizontal)); -parcelHelpers.export(exports, "linkVertical", ()=>(0, _linkJs.linkVertical)); -parcelHelpers.export(exports, "linkRadial", ()=>(0, _linkJs.linkRadial)); -parcelHelpers.export(exports, "symbol", ()=>(0, _symbolJsDefault.default)); -parcelHelpers.export(exports, "symbolsStroke", ()=>(0, _symbolJs.symbolsStroke)); -parcelHelpers.export(exports, "symbolsFill", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbols", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbolAsterisk", ()=>(0, _asteriskJsDefault.default)); -parcelHelpers.export(exports, "symbolCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "symbolCross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond", ()=>(0, _diamondJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond2", ()=>(0, _diamond2JsDefault.default)); -parcelHelpers.export(exports, "symbolPlus", ()=>(0, _plusJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare", ()=>(0, _squareJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare2", ()=>(0, _square2JsDefault.default)); -parcelHelpers.export(exports, "symbolStar", ()=>(0, _starJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle", ()=>(0, _triangleJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle2", ()=>(0, _triangle2JsDefault.default)); -parcelHelpers.export(exports, "symbolWye", ()=>(0, _wyeJsDefault.default)); -parcelHelpers.export(exports, "symbolTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "symbolX", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "curveBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "curveBasisOpen", ()=>(0, _basisOpenJsDefault.default)); -parcelHelpers.export(exports, "curveBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "curveBumpX", ()=>(0, _bumpJs.bumpX)); -parcelHelpers.export(exports, "curveBumpY", ()=>(0, _bumpJs.bumpY)); -parcelHelpers.export(exports, "curveBundle", ()=>(0, _bundleJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalClosed", ()=>(0, _cardinalClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalOpen", ()=>(0, _cardinalOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCardinal", ()=>(0, _cardinalJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomClosed", ()=>(0, _catmullRomClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomOpen", ()=>(0, _catmullRomOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRom", ()=>(0, _catmullRomJsDefault.default)); -parcelHelpers.export(exports, "curveLinearClosed", ()=>(0, _linearClosedJsDefault.default)); -parcelHelpers.export(exports, "curveLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "curveMonotoneX", ()=>(0, _monotoneJs.monotoneX)); -parcelHelpers.export(exports, "curveMonotoneY", ()=>(0, _monotoneJs.monotoneY)); -parcelHelpers.export(exports, "curveNatural", ()=>(0, _naturalJsDefault.default)); -parcelHelpers.export(exports, "curveStep", ()=>(0, _stepJsDefault.default)); -parcelHelpers.export(exports, "curveStepAfter", ()=>(0, _stepJs.stepAfter)); -parcelHelpers.export(exports, "curveStepBefore", ()=>(0, _stepJs.stepBefore)); -parcelHelpers.export(exports, "stack", ()=>(0, _stackJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetExpand", ()=>(0, _expandJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetNone", ()=>(0, _noneJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetSilhouette", ()=>(0, _silhouetteJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetWiggle", ()=>(0, _wiggleJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAppearance", ()=>(0, _appearanceJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAscending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderDescending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderInsideOut", ()=>(0, _insideOutJsDefault.default)); -parcelHelpers.export(exports, "stackOrderNone", ()=>(0, _noneJsDefault1.default)); -parcelHelpers.export(exports, "stackOrderReverse", ()=>(0, _reverseJsDefault.default)); -var _arcJs = require("./arc.js"); -var _arcJsDefault = parcelHelpers.interopDefault(_arcJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pieJs = require("./pie.js"); -var _pieJsDefault = parcelHelpers.interopDefault(_pieJs); -var _areaRadialJs = require("./areaRadial.js"); -var _areaRadialJsDefault = parcelHelpers.interopDefault(_areaRadialJs); -var _lineRadialJs = require("./lineRadial.js"); -var _lineRadialJsDefault = parcelHelpers.interopDefault(_lineRadialJs); -var _pointRadialJs = require("./pointRadial.js"); -var _pointRadialJsDefault = parcelHelpers.interopDefault(_pointRadialJs); -var _linkJs = require("./link.js"); -var _symbolJs = require("./symbol.js"); -var _symbolJsDefault = parcelHelpers.interopDefault(_symbolJs); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _basisClosedJs = require("./curve/basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _basisOpenJs = require("./curve/basisOpen.js"); -var _basisOpenJsDefault = parcelHelpers.interopDefault(_basisOpenJs); -var _basisJs = require("./curve/basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _bumpJs = require("./curve/bump.js"); -var _bundleJs = require("./curve/bundle.js"); -var _bundleJsDefault = parcelHelpers.interopDefault(_bundleJs); -var _cardinalClosedJs = require("./curve/cardinalClosed.js"); -var _cardinalClosedJsDefault = parcelHelpers.interopDefault(_cardinalClosedJs); -var _cardinalOpenJs = require("./curve/cardinalOpen.js"); -var _cardinalOpenJsDefault = parcelHelpers.interopDefault(_cardinalOpenJs); -var _cardinalJs = require("./curve/cardinal.js"); -var _cardinalJsDefault = parcelHelpers.interopDefault(_cardinalJs); -var _catmullRomClosedJs = require("./curve/catmullRomClosed.js"); -var _catmullRomClosedJsDefault = parcelHelpers.interopDefault(_catmullRomClosedJs); -var _catmullRomOpenJs = require("./curve/catmullRomOpen.js"); -var _catmullRomOpenJsDefault = parcelHelpers.interopDefault(_catmullRomOpenJs); -var _catmullRomJs = require("./curve/catmullRom.js"); -var _catmullRomJsDefault = parcelHelpers.interopDefault(_catmullRomJs); -var _linearClosedJs = require("./curve/linearClosed.js"); -var _linearClosedJsDefault = parcelHelpers.interopDefault(_linearClosedJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _monotoneJs = require("./curve/monotone.js"); -var _naturalJs = require("./curve/natural.js"); -var _naturalJsDefault = parcelHelpers.interopDefault(_naturalJs); -var _stepJs = require("./curve/step.js"); -var _stepJsDefault = parcelHelpers.interopDefault(_stepJs); -var _stackJs = require("./stack.js"); -var _stackJsDefault = parcelHelpers.interopDefault(_stackJs); -var _expandJs = require("./offset/expand.js"); -var _expandJsDefault = parcelHelpers.interopDefault(_expandJs); -var _divergingJs = require("./offset/diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _noneJs = require("./offset/none.js"); -var _noneJsDefault = parcelHelpers.interopDefault(_noneJs); -var _silhouetteJs = require("./offset/silhouette.js"); -var _silhouetteJsDefault = parcelHelpers.interopDefault(_silhouetteJs); -var _wiggleJs = require("./offset/wiggle.js"); -var _wiggleJsDefault = parcelHelpers.interopDefault(_wiggleJs); -var _appearanceJs = require("./order/appearance.js"); -var _appearanceJsDefault = parcelHelpers.interopDefault(_appearanceJs); -var _ascendingJs = require("./order/ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./order/descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _insideOutJs = require("./order/insideOut.js"); -var _insideOutJsDefault = parcelHelpers.interopDefault(_insideOutJs); -var _noneJs1 = require("./order/none.js"); -var _noneJsDefault1 = parcelHelpers.interopDefault(_noneJs1); -var _reverseJs = require("./order/reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); - -},{"./arc.js":"lpXto","./area.js":"7vpk0","./line.js":"jLRWM","./pie.js":false,"./areaRadial.js":false,"./lineRadial.js":false,"./pointRadial.js":false,"./link.js":false,"./symbol.js":"hyGNI","./symbol/asterisk.js":false,"./symbol/circle.js":false,"./symbol/cross.js":false,"./symbol/diamond.js":false,"./symbol/diamond2.js":false,"./symbol/plus.js":false,"./symbol/square.js":false,"./symbol/square2.js":false,"./symbol/star.js":false,"./symbol/triangle.js":false,"./symbol/triangle2.js":false,"./symbol/wye.js":false,"./symbol/times.js":false,"./curve/basisClosed.js":"jDlXi","./curve/basisOpen.js":"ibrVq","./curve/basis.js":"7M9eM","./curve/bump.js":false,"./curve/bundle.js":"cEseX","./curve/cardinalClosed.js":"fflpg","./curve/cardinalOpen.js":"7Tvq2","./curve/cardinal.js":"2iU9W","./curve/catmullRomClosed.js":"bV8Z8","./curve/catmullRomOpen.js":"4v7dm","./curve/catmullRom.js":"3GXnl","./curve/linearClosed.js":"hl4Xi","./curve/linear.js":"bEzz9","./curve/monotone.js":"6A7Kk","./curve/natural.js":"1yP6t","./curve/step.js":"hq3zp","./stack.js":false,"./offset/expand.js":false,"./offset/diverging.js":false,"./offset/none.js":false,"./offset/silhouette.js":false,"./offset/wiggle.js":false,"./order/appearance.js":false,"./order/ascending.js":false,"./order/descending.js":false,"./order/insideOut.js":false,"./order/none.js":false,"./order/reverse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lpXto":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = (0, _constantJsDefault.default)(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = (0, _pathJs.withPath)(arc); - function arc() { - var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - (0, _mathJs.halfPi), a1 = endAngle.apply(this, arguments) - (0, _mathJs.halfPi), da = (0, _mathJs.abs)(a1 - a0), cw = a1 > a0; - if (!context) context = buffer = path(); - // Ensure that the outer radius is always larger than the inner radius. - if (r1 < r0) r = r1, r1 = r0, r0 = r; - // Is it a point? - if (!(r1 > (0, _mathJs.epsilon))) context.moveTo(0, 0); - else if (da > (0, _mathJs.tau) - (0, _mathJs.epsilon)) { - context.moveTo(r1 * (0, _mathJs.cos)(a0), r1 * (0, _mathJs.sin)(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > (0, _mathJs.epsilon)) { - context.moveTo(r0 * (0, _mathJs.cos)(a1), r0 * (0, _mathJs.sin)(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } else { - var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > (0, _mathJs.epsilon) && (padRadius ? +padRadius.apply(this, arguments) : (0, _mathJs.sqrt)(r0 * r0 + r1 * r1)), rc = (0, _mathJs.min)((0, _mathJs.abs)(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; - // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - if (rp > (0, _mathJs.epsilon)) { - var p0 = (0, _mathJs.asin)(rp / r0 * (0, _mathJs.sin)(ap)), p1 = (0, _mathJs.asin)(rp / r1 * (0, _mathJs.sin)(ap)); - if ((da0 -= p0 * 2) > (0, _mathJs.epsilon)) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; - else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > (0, _mathJs.epsilon)) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; - else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - var x01 = r1 * (0, _mathJs.cos)(a01), y01 = r1 * (0, _mathJs.sin)(a01), x10 = r0 * (0, _mathJs.cos)(a10), y10 = r0 * (0, _mathJs.sin)(a10); - // Apply rounded corners? - if (rc > (0, _mathJs.epsilon)) { - var x11 = r1 * (0, _mathJs.cos)(a11), y11 = r1 * (0, _mathJs.sin)(a11), x00 = r0 * (0, _mathJs.cos)(a00), y00 = r0 * (0, _mathJs.sin)(a00), oc; - // Restrict the corner radius according to the sector angle. If this - // intersection fails, it’s probably because the arc is too small, so - // disable the corner radius entirely. - if (da < (0, _mathJs.pi)) { - if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) { - var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / (0, _mathJs.sin)((0, _mathJs.acos)((ax * bx + ay * by) / ((0, _mathJs.sqrt)(ax * ax + ay * ay) * (0, _mathJs.sqrt)(bx * bx + by * by))) / 2), lc = (0, _mathJs.sqrt)(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = (0, _mathJs.min)(rc, (r0 - lc) / (kc - 1)); - rc1 = (0, _mathJs.min)(rc, (r1 - lc) / (kc + 1)); - } else rc0 = rc1 = 0; - } - } - // Is the sector collapsed to a line? - if (!(da1 > (0, _mathJs.epsilon))) context.moveTo(x01, y01); - else if (rc1 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); - context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); - // Is there no inner ring, and it’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - if (!(r0 > (0, _mathJs.epsilon)) || !(da0 > (0, _mathJs.epsilon))) context.lineTo(x10, y10); - else if (rc0 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); - context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.arc(0, 0, r0, a10, a00, cw); - } - context.closePath(); - if (buffer) return context = null, buffer + "" || null; - } - arc.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - (0, _mathJs.pi) / 2; - return [ - (0, _mathJs.cos)(a) * r, - (0, _mathJs.sin)(a) * r - ]; - }; - arc.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : innerRadius; - }; - arc.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : outerRadius; - }; - arc.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : cornerRadius; - }; - arc.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padRadius; - }; - arc.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : startAngle; - }; - arc.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : endAngle; - }; - arc.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padAngle; - }; - arc.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, arc) : context; - }; - return arc; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _pathJs = require("./path.js"); -function arcInnerRadius(d) { - return d.innerRadius; -} -function arcOuterRadius(d) { - return d.outerRadius; -} -function arcStartAngle(d) { - return d.startAngle; -} -function arcEndAngle(d) { - return d.endAngle; -} -function arcPadAngle(d) { - return d && d.padAngle; // Note: optional! -} -function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { - var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; - if (t * t < (0, _mathJs.epsilon)) return; - t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; - return [ - x0 + t * x10, - y0 + t * y10 - ]; -} -// Compute perpendicular offset line of length rc. -// http://mathworld.wolfram.com/Circle-LineIntersection.html -function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { - var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / (0, _mathJs.sqrt)(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * (0, _mathJs.sqrt)((0, _mathJs.max)(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; - // Pick the closer of the two intersection points. - // TODO Is there a faster way to determine which intersection to use? - if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + }; + function centroidPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)); + } + function centroidPointCartesian(x2, y2, z2) { + ++W0; + X0$1 += (x2 - X0$1) / W0; + Y0$1 += (y2 - Y0$1) / W0; + Z0$1 += (z2 - Z0$1) / W0; + } + function centroidLineStart$1() { + centroidStream$1.point = centroidLinePointFirst; + } + function centroidLinePointFirst(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidStream$1.point = centroidLinePoint; + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLinePoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z2 = sin$1(phi2), w2 = atan2(sqrt$1((w2 = y0$4 * z2 - z0 * y2) * w2 + (w2 = z0 * x2 - x0$4 * z2) * w2 + (w2 = x0$4 * y2 - y0$4 * x2) * w2), x0$4 * x2 + y0$4 * y2 + z0 * z2); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z2)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLineEnd$1() { + centroidStream$1.point = centroidPoint$1; + } + function centroidRingStart$1() { + centroidStream$1.point = centroidRingPointFirst; + } + function centroidRingEnd$1() { + centroidRingPoint(lambda00, phi00); + centroidStream$1.point = centroidPoint$1; + } + function centroidRingPointFirst(lambda, phi2) { + lambda00 = lambda, phi00 = phi2; + lambda *= radians, phi2 *= radians; + centroidStream$1.point = centroidRingPoint; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidRingPoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z2 = sin$1(phi2), cx = y0$4 * z2 - z0 * y2, cy = z0 * x2 - x0$4 * z2, cz = x0$4 * y2 - y0$4 * x2, m2 = hypot(cx, cy, cz), w2 = asin$1(m2), v = m2 && -w2 / m2; + X2$1.add(v * cx); + Y2$1.add(v * cy); + Z2$1.add(v * cz); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z2)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function geoCentroid$1(object2) { + W0 = W1 = X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = 0; + X2$1 = new Adder(); + Y2$1 = new Adder(); + Z2$1 = new Adder(); + geoStream(object2, centroidStream$1); + var x2 = +X2$1, y2 = +Y2$1, z2 = +Z2$1, m2 = hypot(x2, y2, z2); + if (m2 < epsilon2) { + x2 = X1$1, y2 = Y1$1, z2 = Z1$1; + if (W1 < epsilon$3) x2 = X0$1, y2 = Y0$1, z2 = Z0$1; + m2 = hypot(x2, y2, z2); + if (m2 < epsilon2) return [NaN, NaN]; + } + return [atan2(y2, x2) * degrees, asin$1(z2 / m2) * degrees]; + } + function compose(a2, b2) { + function compose2(x2, y2) { + return x2 = a2(x2, y2), b2(x2[0], x2[1]); + } + if (a2.invert && b2.invert) compose2.invert = function(x2, y2) { + return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]); + }; + return compose2; + } + function rotationIdentity(lambda, phi2) { + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + } + rotationIdentity.invert = rotationIdentity; + function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { + return (deltaLambda %= tau$1) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; + } + function forwardRotationLambda(deltaLambda) { + return function(lambda, phi2) { + lambda += deltaLambda; + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + }; + } + function rotationLambda(deltaLambda) { + var rotation2 = forwardRotationLambda(deltaLambda); + rotation2.invert = forwardRotationLambda(-deltaLambda); + return rotation2; + } + function rotationPhiGamma(deltaPhi, deltaGamma) { + var cosDeltaPhi = cos$1(deltaPhi), sinDeltaPhi = sin$1(deltaPhi), cosDeltaGamma = cos$1(deltaGamma), sinDeltaGamma = sin$1(deltaGamma); + function rotation2(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z2 = sin$1(phi2), k = z2 * cosDeltaPhi + x2 * sinDeltaPhi; + return [ + atan2(y2 * cosDeltaGamma - k * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi), + asin$1(k * cosDeltaGamma + y2 * sinDeltaGamma) + ]; + } + rotation2.invert = function(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z2 = sin$1(phi2), k = z2 * cosDeltaGamma - y2 * sinDeltaGamma; + return [ + atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k * sinDeltaPhi), + asin$1(k * cosDeltaPhi - x2 * sinDeltaPhi) + ]; + }; + return rotation2; + } + function rotation(rotate2) { + rotate2 = rotateRadians(rotate2[0] * radians, rotate2[1] * radians, rotate2.length > 2 ? rotate2[2] * radians : 0); + function forward(coordinates) { + coordinates = rotate2(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate2.invert(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + }; + return forward; + } + function circleStream(stream2, radius2, delta, direction, t02, t12) { + if (!delta) return; + var cosRadius = cos$1(radius2), sinRadius = sin$1(radius2), step = direction * delta; + if (t02 == null) { + t02 = radius2 + direction * tau$1; + t12 = radius2 - step / 2; + } else { + t02 = circleRadius(cosRadius, t02); + t12 = circleRadius(cosRadius, t12); + if (direction > 0 ? t02 < t12 : t02 > t12) t02 += direction * tau$1; + } + for (var point2, t = t02; direction > 0 ? t > t12 : t < t12; t -= step) { + point2 = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]); + stream2.point(point2[0], point2[1]); + } + } + function circleRadius(cosRadius, point2) { + point2 = cartesian(point2), point2[0] -= cosRadius; + cartesianNormalizeInPlace(point2); + var radius2 = acos(-point2[1]); + return ((-point2[2] < 0 ? -radius2 : radius2) + tau$1 - epsilon$3) % tau$1; + } + function clipBuffer() { + var lines = [], line2; return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; -} - -},{"./constant.js":"9zjIM","./math.js":"74irK","./path.js":"g9lLY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9zjIM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function constant() { - return x; - }; + point: function(x2, y2, m2) { + line2.push([x2, y2, m2]); + }, + lineStart: function() { + lines.push(line2 = []); + }, + lineEnd: noop$2, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + }, + result: function() { + var result = lines; + lines = []; + line2 = null; + return result; + } + }; + } + function pointEqual(a2, b2) { + return abs$1(a2[0] - b2[0]) < epsilon$3 && abs$1(a2[1] - b2[1]) < epsilon$3; + } + function Intersection(point2, points2, other, entry2) { + this.x = point2; + this.z = points2; + this.o = other; + this.e = entry2; + this.v = false; + this.n = this.p = null; + } + function clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2) { + var subject = [], clip2 = [], i, n; + segments2.forEach(function(segment) { + if ((n2 = segment.length - 1) <= 0) return; + var n2, p02 = segment[0], p1 = segment[n2], x2; + if (pointEqual(p02, p1)) { + if (!p02[2] && !p1[2]) { + stream2.lineStart(); + for (i = 0; i < n2; ++i) stream2.point((p02 = segment[i])[0], p02[1]); + stream2.lineEnd(); + return; + } + p1[0] += 2 * epsilon$3; + } + subject.push(x2 = new Intersection(p02, segment, null, true)); + clip2.push(x2.o = new Intersection(p02, null, x2, false)); + subject.push(x2 = new Intersection(p1, segment, null, false)); + clip2.push(x2.o = new Intersection(p1, null, x2, true)); }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"74irK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -const abs = Math.abs; -const atan2 = Math.atan2; -const cos = Math.cos; -const max = Math.max; -const min = Math.min; -const sin = Math.sin; -const sqrt = Math.sqrt; -const epsilon = 1e-12; -const pi = Math.PI; -const halfPi = pi / 2; -const tau = 2 * pi; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g9lLY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "withPath", ()=>withPath); -var _d3Path = require("d3-path"); -function withPath(shape) { - let digits = 3; - shape.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - return shape; - }; - return ()=>new (0, _d3Path.Path)(digits); -} - -},{"d3-path":"7nzmW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7nzmW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>(0, _pathJs.Path)); -parcelHelpers.export(exports, "path", ()=>(0, _pathJs.path)); -parcelHelpers.export(exports, "pathRound", ()=>(0, _pathJs.pathRound)); -var _pathJs = require("./path.js"); - -},{"./path.js":"5aBf0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5aBf0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>Path); -parcelHelpers.export(exports, "path", ()=>path); -parcelHelpers.export(exports, "pathRound", ()=>pathRound); -const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon; -function append(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - let d = Math.floor(digits); - if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`); - if (d > 15) return append; - const k = 10 ** d; - return function(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; - }; -} -class Path { - constructor(digits){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - this._append = digits == null ? append : appendRound(digits); - } - moveTo(x, y) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; + if (!subject.length) return; + clip2.sort(compareIntersection2); + link(subject); + link(clip2); + for (i = 0, n = clip2.length; i < n; ++i) { + clip2[i].e = startInside = !startInside; + } + var start = subject[0], points2, point2; + while (1) { + var current = start, isSubject = true; + while (current.v) if ((current = current.n) === start) return; + points2 = current.z; + stream2.lineStart(); + do { + current.v = current.o.v = true; + if (current.e) { + if (isSubject) { + for (i = 0, n = points2.length; i < n; ++i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.n.x, 1, stream2); + } + current = current.n; + } else { + if (isSubject) { + points2 = current.p.z; + for (i = points2.length - 1; i >= 0; --i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.p.x, -1, stream2); + } + current = current.p; + } + current = current.o; + points2 = current.z; + isSubject = !isSubject; + } while (!current.v); + stream2.lineEnd(); } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._append`Z`; + } + function link(array2) { + if (!(n = array2.length)) return; + var n, i = 0, a2 = array2[0], b2; + while (++i < n) { + a2.n = b2 = array2[i]; + b2.p = a2; + a2 = b2; + } + a2.n = b2 = array2[0]; + b2.p = a2; + } + function longitude(point2) { + return abs$1(point2[0]) <= pi$1 ? point2[0] : sign(point2[0]) * ((abs$1(point2[0]) + pi$1) % tau$1 - pi$1); + } + function polygonContains(polygon, point2) { + var lambda = longitude(point2), phi2 = point2[1], sinPhi = sin$1(phi2), normal = [sin$1(lambda), -cos$1(lambda), 0], angle2 = 0, winding = 0; + var sum2 = new Adder(); + if (sinPhi === 1) phi2 = halfPi$1 + epsilon$3; + else if (sinPhi === -1) phi2 = -halfPi$1 - epsilon$3; + for (var i = 0, n = polygon.length; i < n; ++i) { + if (!(m2 = (ring = polygon[i]).length)) continue; + var ring, m2, point0 = ring[m2 - 1], lambda02 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi02 = sin$1(phi02), cosPhi02 = cos$1(phi02); + for (var j = 0; j < m2; ++j, lambda02 = lambda12, sinPhi02 = sinPhi1, cosPhi02 = cosPhi1, point0 = point1) { + var point1 = ring[j], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin$1(phi12), cosPhi1 = cos$1(phi12), delta = lambda12 - lambda02, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi$1, k = sinPhi02 * sinPhi1; + sum2.add(atan2(k * sign2 * sin$1(absDelta), cosPhi02 * cosPhi1 + k * cos$1(absDelta))); + angle2 += antimeridian ? delta + sign2 * tau$1 : delta; + if (antimeridian ^ lambda02 >= lambda ^ lambda12 >= lambda) { + var arc2 = cartesianCross(cartesian(point0), cartesian(point1)); + cartesianNormalizeInPlace(arc2); + var intersection2 = cartesianCross(normal, arc2); + cartesianNormalizeInPlace(intersection2); + var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection2[2]); + if (phi2 > phiArc || phi2 === phiArc && (arc2[0] || arc2[1])) { + winding += antimeridian ^ delta >= 0 ? 1 : -1; + } } + } + } + return (angle2 < -epsilon$3 || angle2 < epsilon$3 && sum2 < -epsilon2) ^ winding & 1; + } + function clip$1(pointVisible, clipLine2, interpolate2, start) { + return function(sink) { + var line2 = clipLine2(sink), ringBuffer = clipBuffer(), ringSink = clipLine2(ringBuffer), polygonStarted = false, polygon, segments2, ring; + var clip2 = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + clip2.point = pointRing; + clip2.lineStart = ringStart; + clip2.lineEnd = ringEnd; + segments2 = []; + polygon = []; + }, + polygonEnd: function() { + clip2.point = point2; + clip2.lineStart = lineStart; + clip2.lineEnd = lineEnd; + segments2 = merge$4(segments2); + var startInside = polygonContains(polygon, start); + if (segments2.length) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + clipRejoin(segments2, compareIntersection, startInside, interpolate2, sink); + } else if (startInside) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + } + if (polygonStarted) sink.polygonEnd(), polygonStarted = false; + segments2 = polygon = null; + }, + sphere: function() { + sink.polygonStart(); + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + sink.polygonEnd(); + } + }; + function point2(lambda, phi2) { + if (pointVisible(lambda, phi2)) sink.point(lambda, phi2); + } + function pointLine(lambda, phi2) { + line2.point(lambda, phi2); + } + function lineStart() { + clip2.point = pointLine; + line2.lineStart(); + } + function lineEnd() { + clip2.point = point2; + line2.lineEnd(); + } + function pointRing(lambda, phi2) { + ring.push([lambda, phi2]); + ringSink.point(lambda, phi2); + } + function ringStart() { + ringSink.lineStart(); + ring = []; + } + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringSink.lineEnd(); + var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m2, segment, point3; + ring.pop(); + polygon.push(ring); + ring = null; + if (!n) return; + if (clean & 1) { + segment = ringSegments[0]; + if ((m2 = segment.length - 1) > 0) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + for (i = 0; i < m2; ++i) sink.point((point3 = segment[i])[0], point3[1]); + sink.lineEnd(); + } + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments2.push(ringSegments.filter(validSegment)); + } + return clip2; + }; + } + function validSegment(segment) { + return segment.length > 1; + } + function compareIntersection(a2, b2) { + return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi$1 - epsilon$3 : halfPi$1 - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi$1 - epsilon$3 : halfPi$1 - b2[1]); + } + const clipAntimeridian = clip$1( + function() { + return true; + }, + clipAntimeridianLine, + clipAntimeridianInterpolate, + [-pi$1, -halfPi$1] + ); + function clipAntimeridianLine(stream2) { + var lambda02 = NaN, phi02 = NaN, sign0 = NaN, clean; + return { + lineStart: function() { + stream2.lineStart(); + clean = 1; + }, + point: function(lambda12, phi12) { + var sign1 = lambda12 > 0 ? pi$1 : -pi$1, delta = abs$1(lambda12 - lambda02); + if (abs$1(delta - pi$1) < epsilon$3) { + stream2.point(lambda02, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi$1 : -halfPi$1); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + stream2.point(lambda12, phi02); + clean = 0; + } else if (sign0 !== sign1 && delta >= pi$1) { + if (abs$1(lambda02 - sign0) < epsilon$3) lambda02 -= sign0 * epsilon$3; + if (abs$1(lambda12 - sign1) < epsilon$3) lambda12 -= sign1 * epsilon$3; + phi02 = clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + clean = 0; + } + stream2.point(lambda02 = lambda12, phi02 = phi12); + sign0 = sign1; + }, + lineEnd: function() { + stream2.lineEnd(); + lambda02 = phi02 = NaN; + }, + clean: function() { + return 2 - clean; + } + }; + } + function clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12) { + var cosPhi02, cosPhi1, sinLambda0Lambda1 = sin$1(lambda02 - lambda12); + return abs$1(sinLambda0Lambda1) > epsilon$3 ? atan((sin$1(phi02) * (cosPhi1 = cos$1(phi12)) * sin$1(lambda12) - sin$1(phi12) * (cosPhi02 = cos$1(phi02)) * sin$1(lambda02)) / (cosPhi02 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2; + } + function clipAntimeridianInterpolate(from, to, direction, stream2) { + var phi2; + if (from == null) { + phi2 = direction * halfPi$1; + stream2.point(-pi$1, phi2); + stream2.point(0, phi2); + stream2.point(pi$1, phi2); + stream2.point(pi$1, 0); + stream2.point(pi$1, -phi2); + stream2.point(0, -phi2); + stream2.point(-pi$1, -phi2); + stream2.point(-pi$1, 0); + stream2.point(-pi$1, phi2); + } else if (abs$1(from[0] - to[0]) > epsilon$3) { + var lambda = from[0] < to[0] ? pi$1 : -pi$1; + phi2 = direction * lambda / 2; + stream2.point(-lambda, phi2); + stream2.point(0, phi2); + stream2.point(lambda, phi2); + } else { + stream2.point(to[0], to[1]); } - lineTo(x, y) { - this._append`L${this._x1 = +x},${this._y1 = +y}`; + } + function clipCircle(radius2) { + var cr2 = cos$1(radius2), delta = 2 * radians, smallRadius = cr2 > 0, notHemisphere = abs$1(cr2) > epsilon$3; + function interpolate2(from, to, direction, stream2) { + circleStream(stream2, radius2, delta, direction, from, to); } - quadraticCurveTo(x1, y1, x, y) { - this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`; + function visible(lambda, phi2) { + return cos$1(lambda) * cos$1(phi2) > cr2; } - bezierCurveTo(x1, y1, x2, y2, x, y) { - this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`; + function clipLine2(stream2) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(lambda, phi2) { + var point1 = [lambda, phi2], point2, v = visible(lambda, phi2), c2 = smallRadius ? v ? 0 : code(lambda, phi2) : v ? code(lambda + (lambda < 0 ? pi$1 : -pi$1), phi2) : 0; + if (!point0 && (v00 = v0 = v)) stream2.lineStart(); + if (v !== v0) { + point2 = intersect2(point0, point1); + if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) + point1[2] = 1; + } + if (v !== v0) { + clean = 0; + if (v) { + stream2.lineStart(); + point2 = intersect2(point1, point0); + stream2.point(point2[0], point2[1]); + } else { + point2 = intersect2(point0, point1); + stream2.point(point2[0], point2[1], 2); + stream2.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c2 & c0) && (t = intersect2(point1, point0, true))) { + clean = 0; + if (smallRadius) { + stream2.lineStart(); + stream2.point(t[0][0], t[0][1]); + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + } else { + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(t[0][0], t[0][1], 3); + } + } + } + if (v && (!point0 || !pointEqual(point0, point1))) { + stream2.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c2; + }, + lineEnd: function() { + if (v0) stream2.lineEnd(); + point0 = null; + }, + // Rejoin first and last segments if there were intersections and the first + // and last points were visible. + clean: function() { + return clean | (v00 && v0) << 1; + } + }; + } + function intersect2(a2, b2, two) { + var pa2 = cartesian(a2), pb = cartesian(b2); + var n1 = [1, 0, 0], n2 = cartesianCross(pa2, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a2; + var c1 = cr2 * n2n2 / determinant, c2 = -cr2 * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A5 = cartesianScale(n1, c1), B2 = cartesianScale(n2, c2); + cartesianAddInPlace(A5, B2); + var u2 = n1xn2, w2 = cartesianDot(A5, u2), uu = cartesianDot(u2, u2), t22 = w2 * w2 - uu * (cartesianDot(A5, A5) - 1); + if (t22 < 0) return; + var t = sqrt$1(t22), q = cartesianScale(u2, (-w2 - t) / uu); + cartesianAddInPlace(q, A5); + q = spherical(q); + if (!two) return q; + var lambda02 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2; + if (lambda12 < lambda02) z2 = lambda02, lambda02 = lambda12, lambda12 = z2; + var delta2 = lambda12 - lambda02, polar = abs$1(delta2 - pi$1) < epsilon$3, meridian = polar || delta2 < epsilon$3; + if (!polar && phi12 < phi02) z2 = phi02, phi02 = phi12, phi12 = z2; + if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs$1(q[0] - lambda02) < epsilon$3 ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi$1 ^ (lambda02 <= q[0] && q[0] <= lambda12)) { + var q1 = cartesianScale(u2, (-w2 + t) / uu); + cartesianAddInPlace(q1, A5); + return [q, spherical(q1)]; + } } - arcTo(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; - // Is this path empty? Move to (x1,y1). - if (this._x1 === null) this._append`M${this._x1 = x1},${this._y1 = y1}`; - else if (!(l01_2 > epsilon)) ; - else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._append`L${this._x1 = x1},${this._y1 = y1}`; - else { - let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; - // If the start tangent is not coincident with (x0,y0), line to. - if (Math.abs(t01 - 1) > epsilon) this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`; - this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`; - } - } - arc(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; - // Is this path empty? Move to (x0,y0). - if (this._x1 === null) this._append`M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._append`L${x0},${y0}`; - // Is this arc empty? We’re done. - if (!r) return; - // Does the angle go the wrong way? Flip the direction. - if (da < 0) da = da % tau + tau; - // Is this a complete circle? Draw two arcs to complete the circle. - if (da > tauEpsilon) this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`; - else if (da > epsilon) this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`; - } - rect(x, y, w, h) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`; + function code(lambda, phi2) { + var r = smallRadius ? radius2 : pi$1 - radius2, code2 = 0; + if (lambda < -r) code2 |= 1; + else if (lambda > r) code2 |= 2; + if (phi2 < -r) code2 |= 4; + else if (phi2 > r) code2 |= 8; + return code2; } - toString() { - return this._; - } -} -function path() { - return new Path; -} -// Allow instanceof d3.path -path.prototype = Path.prototype; -function pathRound(digits = 3) { - return new Path(+digits); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7vpk0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x0, y0, y1) { - var x1 = null, defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(area); - x0 = typeof x0 === "function" ? x0 : x0 === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(+x0); - y0 = typeof y0 === "function" ? y0 : y0 === undefined ? (0, _constantJsDefault.default)(0) : (0, _constantJsDefault.default)(+y0); - y1 = typeof y1 === "function" ? y1 : y1 === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(+y1); - function area(data) { - var i, j, k, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for(k = i - 1; k >= j; --k)output.point(x0z[k], y0z[k]); - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - if (buffer) return output = null, buffer + "" || null; - } - function arealine() { - return (0, _lineJsDefault.default)().defined(defined).curve(curve).context(context); - } - area.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), x1 = null, area) : x0; - }; - area.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x0; - }; - area.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x1; - }; - area.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), y1 = null, area) : y0; - }; - area.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y0; - }; - area.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y1; - }; - area.lineX0 = area.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - area.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - area.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - area.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), area) : defined; - }; - area.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - area.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - return area; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"Qn4uj","./constant.js":"9zjIM","./curve/linear.js":"bEzz9","./line.js":"jLRWM","./path.js":"g9lLY","./point.js":"dpSNq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Qn4uj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -var slice = Array.prototype.slice; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bEzz9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Linear(context); - }); -function Linear(context) { - this._context = context; -} -Linear.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - this._context.lineTo(x, y); - break; - } + return clip$1(visible, clipLine2, interpolate2, smallRadius ? [0, -radius2] : [-pi$1, radius2 - pi$1]); + } + function clipLine(a2, b2, x02, y02, x12, y12) { + var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r; + r = x02 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dx > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = x12 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dx > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + r = y02 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dy > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = y12 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dy > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + if (t02 > 0) a2[0] = ax + t02 * dx, a2[1] = ay + t02 * dy; + if (t12 < 1) b2[0] = ax + t12 * dx, b2[1] = ay + t12 * dy; + return true; + } + var clipMax = 1e9, clipMin = -clipMax; + function clipRectangle(x02, y02, x12, y12) { + function visible(x2, y2) { + return x02 <= x2 && x2 <= x12 && y02 <= y2 && y2 <= y12; + } + function interpolate2(from, to, direction, stream2) { + var a2 = 0, a1 = 0; + if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { + do + stream2.point(a2 === 0 || a2 === 3 ? x02 : x12, a2 > 1 ? y12 : y02); + while ((a2 = (a2 + direction + 4) % 4) !== a1); + } else { + stream2.point(to[0], to[1]); + } } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jLRWM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(line); - x = typeof x === "function" ? x : x === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(x); - y = typeof y === "function" ? y : y === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(y); - function line(data) { - var i, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer; - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart(); - else output.lineEnd(); - } - if (defined0) output.point(+x(d, i, data), +y(d, i, data)); + function corner(p, direction) { + return abs$1(p[0] - x02) < epsilon$3 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x12) < epsilon$3 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y02) < epsilon$3 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; + } + function compareIntersection2(a2, b2) { + return comparePoint(a2.x, b2.x); + } + function comparePoint(a2, b2) { + var ca = corner(a2, 1), cb = corner(b2, 1); + return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[0]; + } + return function(stream2) { + var activeStream = stream2, bufferStream = clipBuffer(), segments2, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; + var clipStream = { + point: point2, + lineStart, + lineEnd, + polygonStart, + polygonEnd + }; + function point2(x2, y2) { + if (visible(x2, y2)) activeStream.point(x2, y2); + } + function polygonInside() { + var winding = 0; + for (var i = 0, n = polygon.length; i < n; ++i) { + for (var ring2 = polygon[i], j = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j < m2; ++j) { + a0 = b0, a1 = b1, point3 = ring2[j], b0 = point3[0], b1 = point3[1]; + if (a1 <= y12) { + if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x02 - a0)) ++winding; + } else { + if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x02 - a0)) --winding; } - if (buffer) return output = null, buffer + "" || null; - } - line.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : x; - }; - line.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : y; - }; - line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), line) : defined; - }; - line.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - line.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - return line; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"Qn4uj","./constant.js":"9zjIM","./curve/linear.js":"bEzz9","./path.js":"g9lLY","./point.js":"dpSNq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dpSNq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -function x(p) { - return p[0]; -} -function y(p) { - return p[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hyGNI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symbolsFill", ()=>symbolsFill); -parcelHelpers.export(exports, "symbolsStroke", ()=>symbolsStroke); -parcelHelpers.export(exports, "default", ()=>Symbol); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _pathJs = require("./path.js"); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -const symbolsFill = [ - (0, _circleJsDefault.default), - (0, _crossJsDefault.default), - (0, _diamondJsDefault.default), - (0, _squareJsDefault.default), - (0, _starJsDefault.default), - (0, _triangleJsDefault.default), - (0, _wyeJsDefault.default) -]; -const symbolsStroke = [ - (0, _circleJsDefault.default), - (0, _plusJsDefault.default), - (0, _timesJsDefault.default), - (0, _triangle2JsDefault.default), - (0, _asteriskJsDefault.default), - (0, _square2JsDefault.default), - (0, _diamond2JsDefault.default) -]; -function Symbol(type, size) { - let context = null, path = (0, _pathJs.withPath)(symbol); - type = typeof type === "function" ? type : (0, _constantJsDefault.default)(type || (0, _circleJsDefault.default)); - size = typeof size === "function" ? size : (0, _constantJsDefault.default)(size === undefined ? 64 : +size); - function symbol() { - let buffer; - if (!context) context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), symbol) : type; - }; - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), symbol) : size; - }; - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - return symbol; -} - -},{"./constant.js":"9zjIM","./path.js":"g9lLY","./symbol/asterisk.js":"hRLT0","./symbol/circle.js":"crWIh","./symbol/cross.js":"6bCEC","./symbol/diamond.js":"ekOwj","./symbol/diamond2.js":"2a3OP","./symbol/plus.js":"lmTLp","./symbol/square.js":"kiI0g","./symbol/square2.js":"fJ0sL","./symbol/star.js":"j2VKI","./symbol/triangle.js":"lg6wx","./symbol/triangle2.js":"ejtY4","./symbol/wye.js":"2zs6m","./symbol/times.js":"dIFHp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hRLT0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size + (0, _mathJs.min)(size / 28, 0.75)) * 0.59436; - const t = r / 2; - const u = t * sqrt3; - context.moveTo(0, r); - context.lineTo(0, -r); - context.moveTo(-u, -t); - context.lineTo(u, t); - context.moveTo(-u, t); - context.lineTo(u, -t); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"crWIh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / (0, _mathJs.pi)); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, (0, _mathJs.tau)); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6bCEC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / 5) / 2; - context.moveTo(-3 * r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, -3 * r); - context.lineTo(r, -3 * r); - context.lineTo(r, -r); - context.lineTo(3 * r, -r); - context.lineTo(3 * r, r); - context.lineTo(r, r); - context.lineTo(r, 3 * r); - context.lineTo(-r, 3 * r); - context.lineTo(-r, r); - context.lineTo(-3 * r, r); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ekOwj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const tan30 = (0, _mathJs.sqrt)(1 / 3); -const tan30_2 = tan30 * 2; -exports.default = { - draw (context, size) { - const y = (0, _mathJs.sqrt)(size / tan30_2); - const x = y * tan30; - context.moveTo(0, -y); - context.lineTo(x, 0); - context.lineTo(0, y); - context.lineTo(-x, 0); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2a3OP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.62625; - context.moveTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.lineTo(-r, 0); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lmTLp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 7, 2)) * 0.87559; - context.moveTo(-r, 0); - context.lineTo(r, 0); - context.moveTo(0, r); - context.lineTo(0, -r); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kiI0g":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const w = (0, _mathJs.sqrt)(size); - const x = -w / 2; - context.rect(x, x, w, w); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fJ0sL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.4431; - context.moveTo(r, r); - context.lineTo(r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, r); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2VKI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const ka = 0.89081309152928522810; -const kr = (0, _mathJs.sin)((0, _mathJs.pi) / 10) / (0, _mathJs.sin)(7 * (0, _mathJs.pi) / 10); -const kx = (0, _mathJs.sin)((0, _mathJs.tau) / 10) * kr; -const ky = -(0, _mathJs.cos)((0, _mathJs.tau) / 10) * kr; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size * ka); - const x = kx * r; - const y = ky * r; - context.moveTo(0, -r); - context.lineTo(x, y); - for(let i = 1; i < 5; ++i){ - const a = (0, _mathJs.tau) * i / 5; - const c = (0, _mathJs.cos)(a); - const s = (0, _mathJs.sin)(a); - context.lineTo(s * r, -c * r); - context.lineTo(c * x - s * y, s * x + c * y); - } - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lg6wx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const y = -(0, _mathJs.sqrt)(size / (sqrt3 * 3)); - context.moveTo(0, y * 2); - context.lineTo(-sqrt3 * y, -y); - context.lineTo(sqrt3 * y, -y); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ejtY4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const s = (0, _mathJs.sqrt)(size) * 0.6824; - const t = s / 2; - const u = s * sqrt3 / 2; // cos(Math.PI / 6) - context.moveTo(0, -s); - context.lineTo(u, t); - context.lineTo(-u, t); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2zs6m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const c = -0.5; -const s = (0, _mathJs.sqrt)(3) / 2; -const k = 1 / (0, _mathJs.sqrt)(12); -const a = (k / 2 + 1) * 3; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / a); - const x0 = r / 2, y0 = r * k; - const x1 = x0, y1 = r * k + r; - const x2 = -x1, y2 = y1; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.lineTo(c * x0 - s * y0, s * x0 + c * y0); - context.lineTo(c * x1 - s * y1, s * x1 + c * y1); - context.lineTo(c * x2 - s * y2, s * x2 + c * y2); - context.lineTo(c * x0 + s * y0, c * y0 - s * x0); - context.lineTo(c * x1 + s * y1, c * y1 - s * x1); - context.lineTo(c * x2 + s * y2, c * y2 - s * x2); - context.closePath(); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dIFHp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 6, 1.7)) * 0.6189; - context.moveTo(-r, -r); - context.lineTo(r, r); - context.moveTo(-r, r); - context.lineTo(r, -r); - } -}; - -},{"../math.js":"74irK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jDlXi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _basisJs = require("./basis.js"); -function BasisClosed(context) { - this._context = context; -} -BasisClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x2, this._y2); - this._context.closePath(); - break; - case 2: - this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); - this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); - this._context.closePath(); - break; - case 3: - this.point(this._x2, this._y2); - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - break; - } - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x2 = x, this._y2 = y; - break; - case 1: - this._point = 2; - this._x3 = x, this._y3 = y; - break; - case 2: - this._point = 3; - this._x4 = x, this._y4 = y; - this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); - break; - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"../noop.js":"1qyaT","./basis.js":"7M9eM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1qyaT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() {}); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7M9eM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Basis", ()=>Basis); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Basis(context); - }); -function point(that, x, y) { - that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6); -} -function Basis(context) { - this._context = context; -} -Basis.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 3: - point(this, this._x1, this._y1); // falls through - case 2: - this._context.lineTo(this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through - default: - point(this, x, y); - break; + } } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; + return winding; + } + function polygonStart() { + activeStream = bufferStream, segments2 = [], polygon = [], clean = true; + } + function polygonEnd() { + var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments2 = merge$4(segments2)).length; + if (cleanInside || visible2) { + stream2.polygonStart(); + if (cleanInside) { + stream2.lineStart(); + interpolate2(null, null, 1, stream2); + stream2.lineEnd(); + } + if (visible2) { + clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2); + } + stream2.polygonEnd(); + } + activeStream = stream2, segments2 = polygon = ring = null; + } + function lineStart() { + clipStream.point = linePoint2; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + function lineEnd() { + if (segments2) { + linePoint2(x__, y__); + if (v__ && v_) bufferStream.rejoin(); + segments2.push(bufferStream.result()); + } + clipStream.point = point2; + if (v_) activeStream.lineEnd(); + } + function linePoint2(x2, y2) { + var v = visible(x2, y2); + if (polygon) ring.push([x2, y2]); + if (first) { + x__ = x2, y__ = y2, v__ = v; + first = false; + if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + } + } else { + if (v && v_) activeStream.point(x2, y2); + else { + var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))]; + if (clipLine(a2, b2, x02, y02, x12, y12)) { + if (!v_) { + activeStream.lineStart(); + activeStream.point(a2[0], a2[1]); + } + activeStream.point(b2[0], b2[1]); + if (!v) activeStream.lineEnd(); + clean = false; + } else if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + clean = false; + } + } + } + x_ = x2, y_ = y2, v_ = v; + } + return clipStream; + }; + } + function graticuleX(y02, y12, dy) { + var y2 = range$3(y02, y12 - epsilon$3, dy).concat(y12); + return function(x2) { + return y2.map(function(y3) { + return [x2, y3]; + }); + }; + } + function graticuleY(x02, x12, dx) { + var x2 = range$3(x02, x12 - epsilon$3, dx).concat(x12); + return function(y2) { + return x2.map(function(x3) { + return [x3, y2]; + }); + }; + } + function graticule() { + var x12, x02, X12, X02, y12, y02, Y12, Y02, dx = 10, dy = dx, DX = 90, DY = 360, x2, y2, X3, Y3, precision = 2.5; + function graticule2() { + return { type: "MultiLineString", coordinates: lines() }; } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ibrVq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisOpen(context); - }); -var _basisJs = require("./basis.js"); -function BasisOpen(context) { - this._context = context; -} -BasisOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; - this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); - break; - case 3: - this._point = 4; // falls through - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"./basis.js":"7M9eM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEseX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _basisJs = require("./basis.js"); -function Bundle(context, beta) { - this._basis = new (0, _basisJs.Basis)(context); - this._beta = beta; -} -Bundle.prototype = { - lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); + function lines() { + return range$3(ceil(X02 / DX) * DX, X12, DX).map(X3).concat(range$3(ceil(Y02 / DY) * DY, Y12, DY).map(Y3)).concat(range$3(ceil(x02 / dx) * dx, x12, dx).filter(function(x3) { + return abs$1(x3 % DX) > epsilon$3; + }).map(x2)).concat(range$3(ceil(y02 / dy) * dy, y12, dy).filter(function(y3) { + return abs$1(y3 % DY) > epsilon$3; + }).map(y2)); + } + graticule2.lines = function() { + return lines().map(function(coordinates) { + return { type: "LineString", coordinates }; + }); + }; + graticule2.outline = function() { + return { + type: "Polygon", + coordinates: [ + X3(X02).concat( + Y3(Y12).slice(1), + X3(X12).reverse().slice(1), + Y3(Y02).reverse().slice(1) + ) + ] + }; + }; + graticule2.extent = function(_) { + if (!arguments.length) return graticule2.extentMinor(); + return graticule2.extentMajor(_).extentMinor(_); + }; + graticule2.extentMajor = function(_) { + if (!arguments.length) return [[X02, Y02], [X12, Y12]]; + X02 = +_[0][0], X12 = +_[1][0]; + Y02 = +_[0][1], Y12 = +_[1][1]; + if (X02 > X12) _ = X02, X02 = X12, X12 = _; + if (Y02 > Y12) _ = Y02, Y02 = Y12, Y12 = _; + return graticule2.precision(precision); + }; + graticule2.extentMinor = function(_) { + if (!arguments.length) return [[x02, y02], [x12, y12]]; + x02 = +_[0][0], x12 = +_[1][0]; + y02 = +_[0][1], y12 = +_[1][1]; + if (x02 > x12) _ = x02, x02 = x12, x12 = _; + if (y02 > y12) _ = y02, y02 = y12, y12 = _; + return graticule2.precision(precision); + }; + graticule2.step = function(_) { + if (!arguments.length) return graticule2.stepMinor(); + return graticule2.stepMajor(_).stepMinor(_); + }; + graticule2.stepMajor = function(_) { + if (!arguments.length) return [DX, DY]; + DX = +_[0], DY = +_[1]; + return graticule2; + }; + graticule2.stepMinor = function(_) { + if (!arguments.length) return [dx, dy]; + dx = +_[0], dy = +_[1]; + return graticule2; + }; + graticule2.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x2 = graticuleX(y02, y12, 90); + y2 = graticuleY(x02, x12, precision); + X3 = graticuleX(Y02, Y12, 90); + Y3 = graticuleY(X02, X12, precision); + return graticule2; + }; + return graticule2.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]); + } + const identity = (x2) => x2; + var areaSum = new Adder(), areaRingSum = new Adder(), x00$2, y00$2, x0$3, y0$3; + var areaStream = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaStream.lineStart = areaRingStart; + areaStream.lineEnd = areaRingEnd; }, - lineEnd: function() { - var x = this._x, y = this._y, j = x.length - 1; - if (j > 0) { - var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t; - while(++i <= j){ - t = i / j; - this._basis.point(this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)); - } - } - this._x = this._y = null; - this._basis.lineEnd(); + polygonEnd: function() { + areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$2; + areaSum.add(abs$1(areaRingSum)); + areaRingSum = new Adder(); }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -exports.default = function custom(beta) { - function bundle(context) { - return beta === 1 ? new (0, _basisJs.Basis)(context) : new Bundle(context, beta); - } - bundle.beta = function(beta) { - return custom(+beta); - }; - return bundle; -}(0.85); - -},{"./basis.js":"7M9eM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fflpg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalClosed", ()=>CardinalClosed); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _cardinalJs = require("./cardinal.js"); -function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 0; + result: function() { + var area2 = areaSum / 2; + areaSum = new Adder(); + return area2; + } + }; + function areaRingStart() { + areaStream.point = areaPointFirst; + } + function areaPointFirst(x2, y2) { + areaStream.point = areaPoint; + x00$2 = x0$3 = x2, y00$2 = y0$3 = y2; + } + function areaPoint(x2, y2) { + areaRingSum.add(y0$3 * x2 - x0$3 * y2); + x0$3 = x2, y0$3 = y2; + } + function areaRingEnd() { + areaPoint(x00$2, y00$2); + } + var x0$2 = Infinity, y0$2 = x0$2, x1 = -x0$2, y1 = x1; + var boundsStream = { + point: boundsPoint, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: noop$2, + polygonEnd: noop$2, + result: function() { + var bounds2 = [[x0$2, y0$2], [x1, y1]]; + x1 = y1 = -(y0$2 = x0$2 = Infinity); + return bounds2; + } + }; + function boundsPoint(x2, y2) { + if (x2 < x0$2) x0$2 = x2; + if (x2 > x1) x1 = x2; + if (y2 < y0$2) y0$2 = y2; + if (y2 > y1) y1 = y2; + } + var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00$1, y00$1, x0$1, y0$1; + var centroidStream = { + point: centroidPoint, + lineStart: centroidLineStart, + lineEnd: centroidLineEnd, + polygonStart: function() { + centroidStream.lineStart = centroidRingStart; + centroidStream.lineEnd = centroidRingEnd; }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } + polygonEnd: function() { + centroidStream.point = centroidPoint; + centroidStream.lineStart = centroidLineStart; + centroidStream.lineEnd = centroidLineEnd; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _cardinalJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalClosed(context, tension); + result: function() { + var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN]; + X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; + return centroid; } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"../noop.js":"1qyaT","./cardinal.js":"2iU9W","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2iU9W":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Cardinal", ()=>Cardinal); -function point(that, x, y) { - that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2); -} -function Cardinal(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -Cardinal.prototype = { - areaStart: function() { - this._line = 0; + }; + function centroidPoint(x2, y2) { + X0 += x2; + Y0 += y2; + ++Z0; + } + function centroidLineStart() { + centroidStream.point = centroidPointFirstLine; + } + function centroidPointFirstLine(x2, y2) { + centroidStream.point = centroidPointLine; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidPointLine(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z2 = sqrt$1(dx * dx + dy * dy); + X1 += z2 * (x0$1 + x2) / 2; + Y1 += z2 * (y0$1 + y2) / 2; + Z1 += z2; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidLineEnd() { + centroidStream.point = centroidPoint; + } + function centroidRingStart() { + centroidStream.point = centroidPointFirstRing; + } + function centroidRingEnd() { + centroidPointRing(x00$1, y00$1); + } + function centroidPointFirstRing(x2, y2) { + centroidStream.point = centroidPointRing; + centroidPoint(x00$1 = x0$1 = x2, y00$1 = y0$1 = y2); + } + function centroidPointRing(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z2 = sqrt$1(dx * dx + dy * dy); + X1 += z2 * (x0$1 + x2) / 2; + Y1 += z2 * (y0$1 + y2) / 2; + Z1 += z2; + z2 = y0$1 * x2 - x0$1 * y2; + X2 += z2 * (x0$1 + x2); + Y2 += z2 * (y0$1 + y2); + Z2 += z2 * 3; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function PathContext(context2) { + this._context = context2; + } + PathContext.prototype = { + _radius: 4.5, + pointRadius: function(_) { + return this._radius = _, this; }, - areaEnd: function() { - this._line = NaN; + polygonStart: function() { + this._line = 0; + }, + polygonEnd: function() { + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - point(this, this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + if (this._line === 0) this._context.closePath(); + this._point = NaN; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - this._x1 = x, this._y1 = y; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; + point: function(x2, y2) { + switch (this._point) { + case 0: { + this._context.moveTo(x2, y2); + this._point = 1; + break; } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new Cardinal(context, tension); - } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Tvq2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalOpen", ()=>CardinalOpen); -var _cardinalJs = require("./cardinal.js"); -function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; + case 1: { + this._context.lineTo(x2, y2); + break; + } + default: { + this._context.moveTo(x2 + this._radius, y2); + this._context.arc(x2, y2, this._radius, 0, tau$1); + break; + } + } }, + result: noop$2 + }; + var lengthSum = new Adder(), lengthRing, x00, y00, x0, y0; + var lengthStream = { + point: noop$2, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; + lengthStream.point = lengthPointFirst; }, lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; + if (lengthRing) lengthPoint(x00, y00); + lengthStream.point = noop$2; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _cardinalJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalOpen(context, tension); - } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"./cardinal.js":"2iU9W","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bV8Z8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalClosedJs = require("./cardinalClosed.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + polygonStart: function() { + lengthRing = true; }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } + polygonEnd: function() { + lengthRing = null; }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + result: function() { + var length2 = +lengthSum; + lengthSum = new Adder(); + return length2; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new (0, _cardinalClosedJs.CardinalClosed)(context, 0); + }; + function lengthPointFirst(x2, y2) { + lengthStream.point = lengthPoint; + x00 = x0 = x2, y00 = y0 = y2; + } + function lengthPoint(x2, y2) { + x0 -= x2, y0 -= y2; + lengthSum.add(sqrt$1(x0 * x0 + y0 * y0)); + x0 = x2, y0 = y2; + } + let cacheDigits, cacheAppend, cacheRadius, cacheCircle; + class PathString { + constructor(digits) { + this._append = digits == null ? append : appendRound(digits); + this._radius = 4.5; + this._ = ""; } - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - return catmullRom; -}(0.5); - -},{"./cardinalClosed.js":"fflpg","../noop.js":"1qyaT","./catmullRom.js":"3GXnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3GXnl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -var _mathJs = require("../math.js"); -var _cardinalJs = require("./cardinal.js"); -function point(that, x, y) { - var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2; - if (that._l01_a > (0, _mathJs.epsilon)) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - if (that._l23_a > (0, _mathJs.epsilon)) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; - } - that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); -} -function CatmullRom(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - this.point(this._x2, this._y2); - break; + pointRadius(_) { + this._radius = +_; + return this; + } + polygonStart() { + this._line = 0; + } + polygonEnd() { + this._line = NaN; + } + lineStart() { + this._point = 0; + } + lineEnd() { + if (this._line === 0) this._ += "Z"; + this._point = NaN; + } + point(x2, y2) { + switch (this._point) { + case 0: { + this._append`M${x2},${y2}`; + this._point = 1; + break; } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; + case 1: { + this._append`L${x2},${y2}`; + break; + } + default: { + this._append`M${x2},${y2}`; + if (this._radius !== cacheRadius || this._append !== cacheAppend) { + const r = this._radius; + const s2 = this._; + this._ = ""; + this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; + cacheRadius = r; + cacheAppend = this._append; + cacheCircle = this._; + this._ = s2; + } + this._ += cacheCircle; + break; } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new (0, _cardinalJs.Cardinal)(context, 0); + result() { + const result = this._; + this._ = ""; + return result.length ? result : null; } - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - return catmullRom; -}(0.5); - -},{"../math.js":"74irK","./cardinal.js":"2iU9W","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4v7dm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalOpenJs = require("./cardinalOpen.js"); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } + function append(strings2) { + let i = 1; + this._ += strings2[0]; + for (const j = strings2.length; i < j; ++i) { + this._ += arguments[i] + strings2[i]; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new (0, _cardinalOpenJs.CardinalOpen)(context, 0); + } + function appendRound(digits) { + const d2 = Math.floor(digits); + if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${digits}`); + if (d2 > 15) return append; + if (d2 !== cacheDigits) { + const k = 10 ** d2; + cacheDigits = d2; + cacheAppend = function append2(strings2) { + let i = 1; + this._ += strings2[0]; + for (const j = strings2.length; i < j; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings2[i]; + } + }; } - catmullRom.alpha = function(alpha) { - return custom(+alpha); + return cacheAppend; + } + function geoPath(projection2, context2) { + let digits = 3, pointRadius = 4.5, projectionStream, contextStream; + function path2(object2) { + if (object2) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + geoStream(object2, projectionStream(contextStream)); + } + return contextStream.result(); + } + path2.area = function(object2) { + geoStream(object2, projectionStream(areaStream)); + return areaStream.result(); + }; + path2.measure = function(object2) { + geoStream(object2, projectionStream(lengthStream)); + return lengthStream.result(); + }; + path2.bounds = function(object2) { + geoStream(object2, projectionStream(boundsStream)); + return boundsStream.result(); + }; + path2.centroid = function(object2) { + geoStream(object2, projectionStream(centroidStream)); + return centroidStream.result(); + }; + path2.projection = function(_) { + if (!arguments.length) return projection2; + projectionStream = _ == null ? (projection2 = null, identity) : (projection2 = _).stream; + return path2; + }; + path2.context = function(_) { + if (!arguments.length) return context2; + contextStream = _ == null ? (context2 = null, new PathString(digits)) : new PathContext(context2 = _); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return path2; + }; + path2.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path2; + }; + path2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) digits = null; + else { + const d2 = Math.floor(_); + if (!(d2 >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d2; + } + if (context2 === null) contextStream = new PathString(digits); + return path2; }; - return catmullRom; -}(0.5); - -},{"./cardinalOpen.js":"7Tvq2","./catmullRom.js":"3GXnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hl4Xi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new LinearClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function LinearClosed(context) { - this._context = context; -} -LinearClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._point) this._context.closePath(); - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y); - else this._point = 1, this._context.moveTo(x, y); - } -}; - -},{"../noop.js":"1qyaT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6A7Kk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "monotoneX", ()=>monotoneX); -parcelHelpers.export(exports, "monotoneY", ()=>monotoneY); -function sign(x) { - return x < 0 ? -1 : 1; -} -// Calculate the slopes of the tangents (Hermite-type interpolation) based on -// the following paper: Steffen, M. 1990. A Simple Method for Monotonic -// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. -// NOV(II), P. 443, 1990. -function slope3(that, x2, y2) { - var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; -} -// Calculate a one-sided slope. -function slope2(that, t) { - var h = that._x1 - that._x0; - return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; -} -// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations -// "you can express cubic Hermite interpolation in terms of cubic Bézier curves -// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". -function point(that, t0, t1) { - var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); -} -function MonotoneX(context) { - this._context = context; -} -MonotoneX.prototype = { - areaStart: function() { - this._line = 0; + return path2.projection(projection2).digits(digits).context(context2); + } + function transformer(methods2) { + return function(stream2) { + var s2 = new TransformStream(); + for (var key2 in methods2) s2[key2] = methods2[key2]; + s2.stream = stream2; + return s2; + }; + } + function TransformStream() { + } + TransformStream.prototype = { + constructor: TransformStream, + point: function(x2, y2) { + this.stream.point(x2, y2); }, - areaEnd: function() { - this._line = NaN; + sphere: function() { + this.stream.sphere(); }, lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; - this._point = 0; + this.stream.lineStart(); }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x1, this._y1); - break; - case 3: - point(this, this._t0, slope2(this, this._t0)); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - var t1 = NaN; - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - point(this, slope2(this, t1 = slope3(this, x, y)), t1); - break; - default: - point(this, this._t0, t1 = slope3(this, x, y)); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } -}; -function MonotoneY(context) { - this._context = new ReflectContext(context); -} -(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { - MonotoneX.prototype.point.call(this, y, x); -}; -function ReflectContext(context) { - this._context = context; -} -ReflectContext.prototype = { - moveTo: function(x, y) { - this._context.moveTo(y, x); - }, - closePath: function() { - this._context.closePath(); + this.stream.lineEnd(); }, - lineTo: function(x, y) { - this._context.lineTo(y, x); + polygonStart: function() { + this.stream.polygonStart(); }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._context.bezierCurveTo(y1, x1, y2, x2, y, x); - } -}; -function monotoneX(context) { - return new MonotoneX(context); -} -function monotoneY(context) { - return new MonotoneY(context); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1yP6t":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Natural(context); + polygonEnd: function() { + this.stream.polygonEnd(); + } + }; + function fit$1(projection2, fitBounds, object2) { + var clip2 = projection2.clipExtent && projection2.clipExtent(); + projection2.scale(150).translate([0, 0]); + if (clip2 != null) projection2.clipExtent(null); + geoStream(object2, projection2.stream(boundsStream)); + fitBounds(boundsStream.result()); + if (clip2 != null) projection2.clipExtent(clip2); + return projection2; + } + function fitExtent(projection2, extent2, object2) { + return fit$1(projection2, function(b2) { + var w2 = extent2[1][0] - extent2[0][0], h2 = extent2[1][1] - extent2[0][1], k = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent2[0][0] + (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = +extent2[0][1] + (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitSize(projection2, size, object2) { + return fitExtent(projection2, [[0, 0], size], object2); + } + function fitWidth(projection2, width2, object2) { + return fit$1(projection2, function(b2) { + var w2 = +width2, k = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = -k * b2[0][1]; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitHeight(projection2, height2, object2) { + return fit$1(projection2, function(b2) { + var h2 = +height2, k = h2 / (b2[1][1] - b2[0][1]), x2 = -k * b2[0][0], y2 = (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + var maxDepth = 16, cosMinDistance = cos$1(30 * radians); + function resample(project2, delta2) { + return +delta2 ? resample$1(project2, delta2) : resampleNone(project2); + } + function resampleNone(project2) { + return transformer({ + point: function(x2, y2) { + x2 = project2(x2, y2); + this.stream.point(x2[0], x2[1]); + } }); -function Natural(context) { - this._context = context; -} -Natural.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = []; - this._y = []; - }, - lineEnd: function() { - var x = this._x, y = this._y, n = x.length; - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - if (n === 2) this._context.lineTo(x[1], y[1]); - else { - var px = controlPoints(x), py = controlPoints(y); - for(var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1)this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); - } + } + function resample$1(project2, delta2) { + function resampleLineTo(x02, y02, lambda02, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream2) { + var dx = x12 - x02, dy = y12 - y02, d2 = dx * dx + dy * dy; + if (d2 > 4 * delta2 && depth--) { + var a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt$1(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin$1(c2 /= m2), lambda22 = abs$1(abs$1(c2) - 1) < epsilon$3 || abs$1(lambda02 - lambda12) < epsilon$3 ? (lambda02 + lambda12) / 2 : atan2(b2, a2), p = project2(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > delta2 || abs$1((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream2); + stream2.point(x2, y2); + resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream2); } - if (this._line || this._line !== 0 && n === 1) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = null; - }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -// See https://www.particleincell.com/2012/bezier-splines/ for derivation. -function controlPoints(x) { - var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - for(i = 1; i < n - 1; ++i)a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - for(i = 1; i < n; ++i)m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a[n - 1] = r[n - 1] / b[n - 1]; - for(i = n - 2; i >= 0; --i)a[i] = (r[i] - a[i + 1]) / b[i]; - b[n - 1] = (x[n] + a[n - 1]) / 2; - for(i = 0; i < n - 1; ++i)b[i] = 2 * x[i + 1] - a[i + 1]; + } + } + return function(stream2) { + var lambda002, x002, y002, a00, b00, c00, lambda02, x02, y02, a0, b0, c0; + var resampleStream = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + stream2.polygonStart(); + resampleStream.lineStart = ringStart; + }, + polygonEnd: function() { + stream2.polygonEnd(); + resampleStream.lineStart = lineStart; + } + }; + function point2(x2, y2) { + x2 = project2(x2, y2); + stream2.point(x2[0], x2[1]); + } + function lineStart() { + x02 = NaN; + resampleStream.point = linePoint2; + stream2.lineStart(); + } + function linePoint2(lambda, phi2) { + var c2 = cartesian([lambda, phi2]), p = project2(lambda, phi2); + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x02 = p[0], y02 = p[1], lambda02 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream2); + stream2.point(x02, y02); + } + function lineEnd() { + resampleStream.point = point2; + stream2.lineEnd(); + } + function ringStart() { + lineStart(); + resampleStream.point = ringPoint; + resampleStream.lineEnd = ringEnd; + } + function ringPoint(lambda, phi2) { + linePoint2(lambda002 = lambda, phi2), x002 = x02, y002 = y02, a00 = a0, b00 = b0, c00 = c0; + resampleStream.point = linePoint2; + } + function ringEnd() { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x002, y002, lambda002, a00, b00, c00, maxDepth, stream2); + resampleStream.lineEnd = lineEnd; + lineEnd(); + } + return resampleStream; + }; + } + var transformRadians = transformer({ + point: function(x2, y2) { + this.stream.point(x2 * radians, y2 * radians); + } + }); + function transformRotate(rotate2) { + return transformer({ + point: function(x2, y2) { + var r = rotate2(x2, y2); + return this.stream.point(r[0], r[1]); + } + }); + } + function scaleTranslate(k, dx, dy, sx, sy) { + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [dx + k * x2, dy - k * y2]; + } + transform2.invert = function(x2, y2) { + return [(x2 - dx) / k * sx, (dy - y2) / k * sy]; + }; + return transform2; + } + function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { + if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); + var cosAlpha = cos$1(alpha), sinAlpha = sin$1(alpha), a2 = cosAlpha * k, b2 = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2]; + } + transform2.invert = function(x2, y2) { + return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)]; + }; + return transform2; + } + function projection$1(project2) { + return projectionMutator(function() { + return project2; + })(); + } + function projectionMutator(projectAt) { + var project2, k = 150, x2 = 480, y2 = 250, lambda = 0, phi2 = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate2, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache2, cacheStream; + function projection2(point2) { + return projectRotateTransform(point2[0] * radians, point2[1] * radians); + } + function invert2(point2) { + point2 = projectRotateTransform.invert(point2[0], point2[1]); + return point2 && [point2[0] * degrees, point2[1] * degrees]; + } + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transformRadians(transformRotate(rotate2)(preclip(projectResample(postclip(cacheStream = stream2))))); + }; + projection2.preclip = function(_) { + return arguments.length ? (preclip = _, theta = void 0, reset2()) : preclip; + }; + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; + }; + projection2.clipAngle = function(_) { + return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset2()) : theta * degrees; + }; + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + projection2.scale = function(_) { + return arguments.length ? (k = +_, recenter()) : k; + }; + projection2.translate = function(_) { + return arguments.length ? (x2 = +_[0], y2 = +_[1], recenter()) : [x2, y2]; + }; + projection2.center = function(_) { + return arguments.length ? (lambda = _[0] % 360 * radians, phi2 = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi2 * degrees]; + }; + projection2.rotate = function(_) { + return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; + }; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; + }; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; + }; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; + }; + projection2.precision = function(_) { + return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset2()) : sqrt$1(delta2); + }; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); + }; + projection2.fitSize = function(size, object2) { + return fitSize(projection2, size, object2); + }; + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); + }; + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); + }; + function recenter() { + var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project2(lambda, phi2)), transform2 = scaleTranslateRotate(k, x2 - center[0], y2 - center[1], sx, sy, alpha); + rotate2 = rotateRadians(deltaLambda, deltaPhi, deltaGamma); + projectTransform = compose(project2, transform2); + projectRotateTransform = compose(rotate2, projectTransform); + projectResample = resample(projectTransform, delta2); + return reset2(); + } + function reset2() { + cache2 = cacheStream = null; + return projection2; + } + return function() { + project2 = projectAt.apply(this, arguments); + projection2.invert = project2.invert && invert2; + return recenter(); + }; + } + function conicProjection(projectAt) { + var phi02 = 0, phi12 = pi$1 / 3, m2 = projectionMutator(projectAt), p = m2(phi02, phi12); + p.parallels = function(_) { + return arguments.length ? m2(phi02 = _[0] * radians, phi12 = _[1] * radians) : [phi02 * degrees, phi12 * degrees]; + }; + return p; + } + function cylindricalEqualAreaRaw(phi02) { + var cosPhi02 = cos$1(phi02); + function forward(lambda, phi2) { + return [lambda * cosPhi02, sin$1(phi2) / cosPhi02]; + } + forward.invert = function(x2, y2) { + return [x2 / cosPhi02, asin$1(y2 * cosPhi02)]; + }; + return forward; + } + function conicEqualAreaRaw(y02, y12) { + var sy0 = sin$1(y02), n = (sy0 + sin$1(y12)) / 2; + if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y02); + var c2 = 1 + sy0 * (2 * n - sy0), r0 = sqrt$1(c2) / n; + function project2(x2, y2) { + var r = sqrt$1(c2 - 2 * n * sin$1(y2)) / n; + return [r * sin$1(x2 *= n), r0 - r * cos$1(x2)]; + } + project2.invert = function(x2, y2) { + var r0y = r0 - y2, l = atan2(x2, abs$1(r0y)) * sign(r0y); + if (r0y * n < 0) + l -= pi$1 * sign(x2) * sign(r0y); + return [l / n, asin$1((c2 - (x2 * x2 + r0y * r0y) * n * n) / (2 * n))]; + }; + return project2; + } + function geoConicEqualArea() { + return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); + } + function geoAlbers() { + return geoConicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]); + } + function multiplex(streams) { + var n = streams.length; + return { + point: function(x2, y2) { + var i = -1; + while (++i < n) streams[i].point(x2, y2); + }, + sphere: function() { + var i = -1; + while (++i < n) streams[i].sphere(); + }, + lineStart: function() { + var i = -1; + while (++i < n) streams[i].lineStart(); + }, + lineEnd: function() { + var i = -1; + while (++i < n) streams[i].lineEnd(); + }, + polygonStart: function() { + var i = -1; + while (++i < n) streams[i].polygonStart(); + }, + polygonEnd: function() { + var i = -1; + while (++i < n) streams[i].polygonEnd(); + } + }; + } + function geoAlbersUsa() { + var cache2, cacheStream, lower48 = geoAlbers(), lower48Point, alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point2, pointStream = { point: function(x2, y2) { + point2 = [x2, y2]; + } }; + function albersUsa(coordinates) { + var x2 = coordinates[0], y2 = coordinates[1]; + return point2 = null, (lower48Point.point(x2, y2), point2) || (alaskaPoint.point(x2, y2), point2) || (hawaiiPoint.point(x2, y2), point2); + } + albersUsa.invert = function(coordinates) { + var k = lower48.scale(), t = lower48.translate(), x2 = (coordinates[0] - t[0]) / k, y2 = (coordinates[1] - t[1]) / k; + return (y2 >= 0.12 && y2 < 0.234 && x2 >= -0.425 && x2 < -0.214 ? alaska : y2 >= 0.166 && y2 < 0.234 && x2 >= -0.214 && x2 < -0.115 ? hawaii : lower48).invert(coordinates); + }; + albersUsa.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = multiplex([lower48.stream(cacheStream = stream2), alaska.stream(stream2), hawaii.stream(stream2)]); + }; + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_), alaska.precision(_), hawaii.precision(_); + return reset2(); + }; + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x2 = +_[0], y2 = +_[1]; + lower48Point = lower48.translate(_).clipExtent([[x2 - 0.455 * k, y2 - 0.238 * k], [x2 + 0.455 * k, y2 + 0.238 * k]]).stream(pointStream); + alaskaPoint = alaska.translate([x2 - 0.307 * k, y2 + 0.201 * k]).clipExtent([[x2 - 0.425 * k + epsilon$3, y2 + 0.12 * k + epsilon$3], [x2 - 0.214 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + hawaiiPoint = hawaii.translate([x2 - 0.205 * k, y2 + 0.212 * k]).clipExtent([[x2 - 0.214 * k + epsilon$3, y2 + 0.166 * k + epsilon$3], [x2 - 0.115 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + return reset2(); + }; + albersUsa.fitExtent = function(extent2, object2) { + return fitExtent(albersUsa, extent2, object2); + }; + albersUsa.fitSize = function(size, object2) { + return fitSize(albersUsa, size, object2); + }; + albersUsa.fitWidth = function(width2, object2) { + return fitWidth(albersUsa, width2, object2); + }; + albersUsa.fitHeight = function(height2, object2) { + return fitHeight(albersUsa, height2, object2); + }; + function reset2() { + cache2 = cacheStream = null; + return albersUsa; + } + return albersUsa.scale(1070); + } + function azimuthalRaw(scale2) { + return function(x2, y2) { + var cx = cos$1(x2), cy = cos$1(y2), k = scale2(cx * cy); + if (k === Infinity) return [2, 0]; + return [ + k * cy * sin$1(x2), + k * sin$1(y2) + ]; + }; + } + function azimuthalInvert(angle2) { + return function(x2, y2) { + var z2 = sqrt$1(x2 * x2 + y2 * y2), c2 = angle2(z2), sc = sin$1(c2), cc = cos$1(c2); + return [ + atan2(x2 * sc, z2 * cc), + asin$1(z2 && y2 * sc / z2) + ]; + }; + } + var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { + return sqrt$1(2 / (1 + cxcy)); + }); + azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z2) { + return 2 * asin$1(z2 / 2); + }); + function geoAzimuthalEqualArea() { + return projection$1(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); + } + var azimuthalEquidistantRaw = azimuthalRaw(function(c2) { + return (c2 = acos(c2)) && c2 / sin$1(c2); + }); + azimuthalEquidistantRaw.invert = azimuthalInvert(function(z2) { + return z2; + }); + function geoAzimuthalEquidistant() { + return projection$1(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); + } + function mercatorRaw(lambda, phi2) { + return [lambda, log$1(tan((halfPi$1 + phi2) / 2))]; + } + mercatorRaw.invert = function(x2, y2) { + return [x2, 2 * atan(exp(y2)) - halfPi$1]; + }; + function geoMercator() { + return mercatorProjection(mercatorRaw).scale(961 / tau$1); + } + function mercatorProjection(project2) { + var m2 = projection$1(project2), center = m2.center, scale2 = m2.scale, translate2 = m2.translate, clipExtent = m2.clipExtent, x02 = null, y02, x12, y12; + m2.scale = function(_) { + return arguments.length ? (scale2(_), reclip()) : scale2(); + }; + m2.translate = function(_) { + return arguments.length ? (translate2(_), reclip()) : translate2(); + }; + m2.center = function(_) { + return arguments.length ? (center(_), reclip()) : center(); + }; + m2.clipExtent = function(_) { + return arguments.length ? (_ == null ? x02 = y02 = x12 = y12 = null : (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + function reclip() { + var k = pi$1 * scale2(), t = m2(rotation(m2.rotate()).invert([0, 0])); + return clipExtent(x02 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project2 === mercatorRaw ? [[Math.max(t[0] - k, x02), y02], [Math.min(t[0] + k, x12), y12]] : [[x02, Math.max(t[1] - k, y02)], [x12, Math.min(t[1] + k, y12)]]); + } + return reclip(); + } + function tany(y2) { + return tan((halfPi$1 + y2) / 2); + } + function conicConformalRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : log$1(cy0 / cos$1(y12)) / log$1(tany(y12) / tany(y02)), f = cy0 * pow$1(tany(y02), n) / n; + if (!n) return mercatorRaw; + function project2(x2, y2) { + if (f > 0) { + if (y2 < -halfPi$1 + epsilon$3) y2 = -halfPi$1 + epsilon$3; + } else { + if (y2 > halfPi$1 - epsilon$3) y2 = halfPi$1 - epsilon$3; + } + var r = f / pow$1(tany(y2), n); + return [r * sin$1(n * x2), f - r * cos$1(n * x2)]; + } + project2.invert = function(x2, y2) { + var fy = f - y2, r = sign(n) * sqrt$1(x2 * x2 + fy * fy), l = atan2(x2, abs$1(fy)) * sign(fy); + if (fy * n < 0) + l -= pi$1 * sign(x2) * sign(fy); + return [l / n, 2 * atan(pow$1(f / r, 1 / n)) - halfPi$1]; + }; + return project2; + } + function geoConicConformal() { + return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); + } + function equirectangularRaw(lambda, phi2) { + return [lambda, phi2]; + } + equirectangularRaw.invert = equirectangularRaw; + function geoEquirectangular() { + return projection$1(equirectangularRaw).scale(152.63); + } + function conicEquidistantRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : (cy0 - cos$1(y12)) / (y12 - y02), g = cy0 / n + y02; + if (abs$1(n) < epsilon$3) return equirectangularRaw; + function project2(x2, y2) { + var gy = g - y2, nx = n * x2; + return [gy * sin$1(nx), g - gy * cos$1(nx)]; + } + project2.invert = function(x2, y2) { + var gy = g - y2, l = atan2(x2, abs$1(gy)) * sign(gy); + if (gy * n < 0) + l -= pi$1 * sign(x2) * sign(gy); + return [l / n, g - sign(n) * sqrt$1(x2 * x2 + gy * gy)]; + }; + return project2; + } + function geoConicEquidistant() { + return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); + } + var A1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt$1(3) / 2, iterations = 12; + function equalEarthRaw(lambda, phi2) { + var l = asin$1(M * sin$1(phi2)), l2 = l * l, l6 = l2 * l2 * l2; return [ - a, - b + lambda * cos$1(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), + l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hq3zp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Step(context, 0.5); - }); -parcelHelpers.export(exports, "stepBefore", ()=>stepBefore); -parcelHelpers.export(exports, "stepAfter", ()=>stepAfter); -function Step(context, t) { - this._context = context; - this._t = t; -} -Step.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - if (this._t <= 0) { - this._context.lineTo(this._x, y); - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y); - } - break; - } - this._x = x, this._y = y; - } -}; -function stepBefore(context) { - return new Step(context, 0); -} -function stepAfter(context) { - return new Step(context, 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4O1hR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "canvas", ()=>domCanvas); -parcelHelpers.export(exports, "domCanvas", ()=>domCanvas); -parcelHelpers.export(exports, "image", ()=>domImage); -function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - const c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } + } + equalEarthRaw.invert = function(x2, y2) { + var l = y2, l2 = l * l, l6 = l2 * l2 * l2; + for (var i = 0, delta, fy, fpy; i < iterations; ++i) { + fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y2; + fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); + l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; + if (abs$1(delta) < epsilon2) break; } - return null; -} -const domImage = ()=>typeof Image !== 'undefined' ? Image : null; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gHN3E":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _d3Scale.scaleImplicit)); -parcelHelpers.export(exports, "Band", ()=>Band); -parcelHelpers.export(exports, "BinOrdinal", ()=>BinOrdinal); -parcelHelpers.export(exports, "DiscreteLegend", ()=>DiscreteLegend); -parcelHelpers.export(exports, "Diverging", ()=>Diverging); -parcelHelpers.export(exports, "GradientLegend", ()=>GradientLegend); -parcelHelpers.export(exports, "Identity", ()=>Identity); -parcelHelpers.export(exports, "Linear", ()=>Linear); -parcelHelpers.export(exports, "Log", ()=>Log); -parcelHelpers.export(exports, "Ordinal", ()=>Ordinal); -parcelHelpers.export(exports, "Point", ()=>Point); -parcelHelpers.export(exports, "Pow", ()=>Pow); -parcelHelpers.export(exports, "Quantile", ()=>Quantile); -parcelHelpers.export(exports, "Quantize", ()=>Quantize); -parcelHelpers.export(exports, "Sequential", ()=>Sequential); -parcelHelpers.export(exports, "Sqrt", ()=>Sqrt); -parcelHelpers.export(exports, "SymbolLegend", ()=>SymbolLegend); -parcelHelpers.export(exports, "Symlog", ()=>Symlog); -parcelHelpers.export(exports, "Threshold", ()=>Threshold); -parcelHelpers.export(exports, "Time", ()=>Time); -parcelHelpers.export(exports, "UTC", ()=>UTC); -parcelHelpers.export(exports, "bandSpace", ()=>bandSpace); -parcelHelpers.export(exports, "domainCaption", ()=>domainCaption); -parcelHelpers.export(exports, "interpolate", ()=>interpolate); -parcelHelpers.export(exports, "interpolateColors", ()=>interpolateColors); -parcelHelpers.export(exports, "interpolateRange", ()=>interpolateRange); -parcelHelpers.export(exports, "isContinuous", ()=>isContinuous); -parcelHelpers.export(exports, "isDiscrete", ()=>isDiscrete); -parcelHelpers.export(exports, "isDiscretizing", ()=>isDiscretizing); -parcelHelpers.export(exports, "isInterpolating", ()=>isInterpolating); -parcelHelpers.export(exports, "isLogarithmic", ()=>isLogarithmic); -parcelHelpers.export(exports, "isQuantile", ()=>isQuantile); -parcelHelpers.export(exports, "isRegisteredScale", ()=>isRegisteredScale); -parcelHelpers.export(exports, "isTemporal", ()=>isTemporal); -parcelHelpers.export(exports, "isValidScaleType", ()=>isValidScaleType); -parcelHelpers.export(exports, "labelFormat", ()=>labelFormat); -parcelHelpers.export(exports, "labelFraction", ()=>labelFraction); -parcelHelpers.export(exports, "labelValues", ()=>labelValues); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>quantizeInterpolator); -parcelHelpers.export(exports, "registerScale", ()=>registerScale); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleCopy", ()=>scaleCopy); -parcelHelpers.export(exports, "scaleFraction", ()=>scaleFraction); -parcelHelpers.export(exports, "scheme", ()=>scheme); -parcelHelpers.export(exports, "tickCount", ()=>tickCount); -parcelHelpers.export(exports, "tickFormat", ()=>tickFormat); -parcelHelpers.export(exports, "tickValues", ()=>tickValues); -parcelHelpers.export(exports, "validTicks", ()=>validTicks); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Scale = require("d3-scale"); -var _d3Interpolate = require("d3-interpolate"); -var _d3ScaleChromatic = require("d3-scale-chromatic"); -var _vegaTime = require("vega-time"); -function bandSpace(count, paddingInner, paddingOuter) { - const space = count - paddingInner + paddingOuter * 2; - return count ? space > 0 ? space : 1 : 0; -} -const Identity = 'identity'; -const Linear = 'linear'; -const Log = 'log'; -const Pow = 'pow'; -const Sqrt = 'sqrt'; -const Symlog = 'symlog'; -const Time = 'time'; -const UTC = 'utc'; -const Sequential = 'sequential'; -const Diverging = 'diverging'; -const Quantile = 'quantile'; -const Quantize = 'quantize'; -const Threshold = 'threshold'; -const Ordinal = 'ordinal'; -const Point = 'point'; -const Band = 'band'; -const BinOrdinal = 'bin-ordinal'; -// categories -const Continuous = 'continuous'; -const Discrete = 'discrete'; -const Discretizing = 'discretizing'; -const Interpolating = 'interpolating'; -const Temporal = 'temporal'; -function invertRange(scale) { - return function(_) { - let lo = _[0], hi = _[1], t; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; -} -function invertRangeExtent(scale) { - return function(_) { - const range = scale.range(); - let lo = _[0], hi = _[1], min = -1, max, t, i, n; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - for(i = 0, n = range.length; i < n; ++i)if (range[i] >= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - if (min < 0) return undefined; - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[1] - ]; + return [ + M * x2 * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), + asin$1(sin$1(l) / M) + ]; + }; + function geoEqualEarth() { + return projection$1(equalEarthRaw).scale(177.158); + } + function gnomonicRaw(x2, y2) { + var cy = cos$1(y2), k = cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + gnomonicRaw.invert = azimuthalInvert(atan); + function geoGnomonic() { + return projection$1(gnomonicRaw).scale(144.049).clipAngle(60); + } + function geoIdentity() { + var k = 1, tx2 = 0, ty2 = 0, sx = 1, sy = 1, alpha = 0, ca, sa2, x02 = null, y02, x12, y12, kx = 1, ky = 1, transform2 = transformer({ + point: function(x2, y2) { + var p = projection2([x2, y2]); + this.stream.point(p[0], p[1]); + } + }), postclip = identity, cache2, cacheStream; + function reset2() { + kx = k * sx; + ky = k * sy; + cache2 = cacheStream = null; + return projection2; + } + function projection2(p) { + var x2 = p[0] * kx, y2 = p[1] * ky; + if (alpha) { + var t = y2 * ca - x2 * sa2; + x2 = x2 * ca + y2 * sa2; + y2 = t; + } + return [x2 + tx2, y2 + ty2]; + } + projection2.invert = function(p) { + var x2 = p[0] - tx2, y2 = p[1] - ty2; + if (alpha) { + var t = y2 * ca + x2 * sa2; + x2 = x2 * ca - y2 * sa2; + y2 = t; + } + return [x2 / kx, y2 / ky]; }; -} -function band() { - const scale = (0, _d3Scale.scaleOrdinal)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range; - let range$1 = [ - 0, - 1 - ], step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - const n = domain().length, reverse = range$1[1] < range$1[0], stop = range$1[1 - reverse], space = bandSpace(n, paddingInner, paddingOuter); - let start = range$1[reverse - 0]; - step = (stop - start) / (space || 1); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - const values = (0, _d3Array.range)(n).map((i)=>start + step * i); - return ordinalRange(reverse ? values.reverse() : values); - } - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else return domain(); + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transform2(postclip(cacheStream = stream2)); }; - scale.range = function(_) { - if (arguments.length) { - range$1 = [ - +_[0], - +_[1] - ]; - return rescale(); - } else return range$1.slice(); + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; }; - scale.rangeRound = function(_) { - range$1 = [ - +_[0], - +_[1] - ]; - round = true; - return rescale(); + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; }; - scale.bandwidth = function() { - return bandwidth; + projection2.scale = function(_) { + return arguments.length ? (k = +_, reset2()) : k; }; - scale.step = function() { - return step; + projection2.translate = function(_) { + return arguments.length ? (tx2 = +_[0], ty2 = +_[1], reset2()) : [tx2, ty2]; }; - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else return round; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, sa2 = sin$1(alpha), ca = cos$1(alpha), reset2()) : alpha * degrees; }; - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else return paddingInner; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, reset2()) : sx < 0; }; - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingInner; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, reset2()) : sy < 0; }; - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingOuter; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); }; - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else return align; - }; - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - const reverse = range$1[1] < range$1[0], values = reverse ? ordinalRange().reverse() : ordinalRange(), n = values.length - 1; - let lo = +_[0], hi = +_[1], a, b, t; - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range$1[1 - reverse]) return; - // binary search to index into scale range - a = Math.max(0, (0, _d3Array.bisectRight)(values, lo) - 1); - b = lo === hi ? a : (0, _d3Array.bisectRight)(values, hi) - 1; - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return a > b ? undefined : domain().slice(a, b + 1); - }; - scale.invert = function(_) { - const value = scale.invertRange([ - _, - _ - ]); - return value ? value[0] : value; + projection2.fitSize = function(size, object2) { + return fitSize(projection2, size, object2); }; - scale.copy = function() { - return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); }; - return rescale(); -} -function pointish(scale) { - const copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band().paddingInner(1)); -} -var map = Array.prototype.map; -function numbers(_) { - return map.call(_, (0, _vegaUtil.toNumber)); -} -const slice = Array.prototype.slice; -function scaleBinOrdinal() { - let domain = [], range = []; - function scale(x) { - return x == null || x !== x ? undefined : range[((0, _d3Array.bisect)(domain, x) - 1) % range.length]; - } - scale.domain = function(_) { - if (arguments.length) { - domain = numbers(_); - return scale; - } else return domain.slice(); + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); }; - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else return range.slice(); - }; - scale.tickFormat = function(count, specifier) { - return (0, _d3Scale.tickFormat)(domain[0], (0, _vegaUtil.peek)(domain), count == null ? 10 : count, specifier); - }; - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - return scale; -} -/** Private scale registry: should not be exported */ const scales = new Map(); -const VEGA_SCALE = Symbol('vega_scale'); -function registerScale(scale) { - scale[VEGA_SCALE] = true; - return scale; -} -/** - * Return true if object was created by a constructor from the vega-scale `scale` function. - */ function isRegisteredScale(scale) { - return scale && scale[VEGA_SCALE] === true; -} -/** - * Augment scales with their type and needed inverse methods. - */ function create(type, constructor, metadata) { - const ctr = function scale() { - const s = constructor(); - if (!s.invertRange) s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined; - s.type = type; - return registerScale(s); - }; - ctr.metadata = (0, _vegaUtil.toSet)((0, _vegaUtil.array)(metadata)); - return ctr; -} -/** - * Registry function for adding and accessing scale constructor functions. - * The *type* argument is a String indicating the name of the scale type. - * - * If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found. - * If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name. - * The *metadata* argument provides additional information to guide appropriate use of scales within Vega. - * - * *metadata* can be either a string or string array. The valid string values are: - * - `"continuous"` - the scale is defined over a continuous-valued domain. - * - `"discrete"` - the scale is defined over a discrete domain and range. - * - `"discretizing"` - the scale discretizes a continuous domain to a discrete range. - * - `"interpolating"` - the scale range is defined using a color interpolator. - * - `"log"` - the scale performs a logarithmic transform of the continuous domain. - * - `"temporal"` - the scale domain is defined over date-time values. - */ function scale(type, scale, metadata) { - if (arguments.length > 1) { - scales.set(type, create(type, scale, metadata)); - return this; - } else return isValidScaleType(type) ? scales.get(type) : undefined; -} -// identity scale -scale(Identity, _d3Scale.scaleIdentity); -// continuous scales -scale(Linear, _d3Scale.scaleLinear, Continuous); -scale(Log, _d3Scale.scaleLog, [ - Continuous, - Log -]); -scale(Pow, _d3Scale.scalePow, Continuous); -scale(Sqrt, _d3Scale.scaleSqrt, Continuous); -scale(Symlog, _d3Scale.scaleSymlog, Continuous); -scale(Time, _d3Scale.scaleTime, [ - Continuous, - Temporal -]); -scale(UTC, _d3Scale.scaleUtc, [ - Continuous, - Temporal -]); -// sequential scales -scale(Sequential, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); // backwards compat -scale(`${Sequential}-${Linear}`, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Log}`, _d3Scale.scaleSequentialLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Sequential}-${Pow}`, _d3Scale.scaleSequentialPow, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Sqrt}`, _d3Scale.scaleSequentialSqrt, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Symlog}`, _d3Scale.scaleSequentialSymlog, [ - Continuous, - Interpolating -]); -// diverging scales -scale(`${Diverging}-${Linear}`, _d3Scale.scaleDiverging, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Log}`, _d3Scale.scaleDivergingLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Diverging}-${Pow}`, _d3Scale.scaleDivergingPow, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Sqrt}`, _d3Scale.scaleDivergingSqrt, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Symlog}`, _d3Scale.scaleDivergingSymlog, [ - Continuous, - Interpolating -]); -// discretizing scales -scale(Quantile, _d3Scale.scaleQuantile, [ - Discretizing, - Quantile -]); -scale(Quantize, _d3Scale.scaleQuantize, Discretizing); -scale(Threshold, _d3Scale.scaleThreshold, Discretizing); -// discrete scales -scale(BinOrdinal, scaleBinOrdinal, [ - Discrete, - Discretizing -]); -scale(Ordinal, _d3Scale.scaleOrdinal, Discrete); -scale(Band, band, Discrete); -scale(Point, point, Discrete); -function isValidScaleType(type) { - return scales.has(type); -} -function hasType(key, type) { - const s = scales.get(key); - return s && s.metadata[type]; -} -function isContinuous(key) { - return hasType(key, Continuous); -} -function isDiscrete(key) { - return hasType(key, Discrete); -} -function isDiscretizing(key) { - return hasType(key, Discretizing); -} -function isLogarithmic(key) { - return hasType(key, Log); -} -function isTemporal(key) { - return hasType(key, Temporal); -} -function isInterpolating(key) { - return hasType(key, Interpolating); -} -function isQuantile(key) { - return hasType(key, Quantile); -} -const scaleProps = [ - 'clamp', - 'base', - 'constant', - 'exponent' -]; -function interpolateRange(interpolator, range) { - const start = range[0], span = (0, _vegaUtil.peek)(range) - start; - return function(i) { - return interpolator(start + i * span); - }; -} -function interpolateColors(colors, type, gamma) { - return _d3Interpolate.piecewise(interpolate(type || 'rgb', gamma), colors); -} -function quantizeInterpolator(interpolator, count) { - const samples = new Array(count), n = count + 1; - for(let i = 0; i < count;)samples[i] = interpolator(++i / n); - return samples; -} -function scaleCopy(scale) { - const t = scale.type, s = scale.copy(); - s.type = t; - return s; -} -function scaleFraction(scale$1, min, max) { - const delta = max - min; - let i, t, s; - if (!delta || !Number.isFinite(delta)) return (0, _vegaUtil.constant)(0.5); - else { - i = (t = scale$1.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale(t)().domain([ - min, - max - ]).range([ - 0, - 1 - ]); - scaleProps.forEach((m)=>scale$1[m] ? s[m](scale$1[m]()) : 0); - return s; - } -} -function interpolate(type, gamma) { - const interp = _d3Interpolate[method(type)]; - return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp; -} -function method(type) { - return 'interpolate' + type.toLowerCase().split('-').map((s)=>s[0].toUpperCase() + s.slice(1)).join(''); -} -const continuous = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - cividis: '00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647', - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - turbo: '23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00', - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' -}; -const discrete = { - accent: (0, _d3ScaleChromatic.schemeAccent), - category10: (0, _d3ScaleChromatic.schemeCategory10), - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - dark2: (0, _d3ScaleChromatic.schemeDark2), - observable10: (0, _d3ScaleChromatic.schemeObservable10), - paired: (0, _d3ScaleChromatic.schemePaired), - pastel1: (0, _d3ScaleChromatic.schemePastel1), - pastel2: (0, _d3ScaleChromatic.schemePastel2), - set1: (0, _d3ScaleChromatic.schemeSet1), - set2: (0, _d3ScaleChromatic.schemeSet2), - set3: (0, _d3ScaleChromatic.schemeSet3), - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5' -}; -function colors(palette) { - if ((0, _vegaUtil.isArray)(palette)) return palette; - const n = palette.length / 6 | 0, c = new Array(n); - for(let i = 0; i < n;)c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; -} -function apply(_, f) { - for(const k in _)scheme(k, f(_[k])); -} -const schemes = {}; -apply(discrete, colors); -apply(continuous, (_)=>interpolateColors(colors(_))); -function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else return schemes[name]; -} -const SymbolLegend = 'symbol'; -const DiscreteLegend = 'discrete'; -const GradientLegend = 'gradient'; -const defaultFormatter = (value)=>(0, _vegaUtil.isArray)(value) ? value.map((v)=>String(v)) : String(value); -const ascending = (a, b)=>a[1] - b[1]; -const descending = (a, b)=>b[1] - a[1]; -/** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ function tickCount(scale, count, minStep) { - let step; - if ((0, _vegaUtil.isNumber)(count)) { - if (scale.bins) count = Math.max(count, scale.bins.length); - if (minStep != null) count = Math.min(count, Math.floor((0, _vegaUtil.span)(scale.domain()) / minStep || 1) + 1); - } - if ((0, _vegaUtil.isObject)(count)) { - step = count.step; - count = count.interval; - } - if ((0, _vegaUtil.isString)(count)) { - count = scale.type === Time ? (0, _vegaTime.timeInterval)(count) : scale.type == UTC ? (0, _vegaTime.utcInterval)(count) : (0, _vegaUtil.error)('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - return count; -} -/** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ function validTicks(scale, ticks, count) { - let range = scale.range(), lo = range[0], hi = (0, _vegaUtil.peek)(range), cmp = ascending; - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; - } - lo = Math.floor(lo); - hi = Math.ceil(hi); - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map((v)=>[ - v, - scale(v) - ]).filter((_)=>lo <= _[1] && _[1] <= hi).sort(cmp).map((_)=>_[0]); - if (count > 0 && ticks.length > 1) { - const endpoints = [ - ticks[0], - (0, _vegaUtil.peek)(ticks) - ]; - while(ticks.length > count && ticks.length >= 3)ticks = ticks.filter((_, i)=>!(i % 2)); - if (ticks.length < 3) ticks = endpoints; - } - return ticks; -} -/** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins, count) : scale.ticks ? scale.ticks(count) : scale.domain(); -} -/** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ function tickFormat(locale, scale, count, specifier, formatType, noSkip) { - const type = scale.type; - let format = defaultFormatter; - if (type === Time || formatType === Time) format = locale.timeFormat(specifier); - else if (type === UTC || formatType === UTC) format = locale.utcFormat(specifier); - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) format = varfmt; - else { - const test = tickLog(scale, count, false); - format = (_)=>test(_) ? varfmt(_) : ''; - } - } else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } else if (specifier) format = locale.format(specifier); - return format; -} -function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), base = scale.base(), logb = Math.log(base), k = Math.max(1, base * count / ticks.length); - // apply d3-scale's log format filter criteria - const test = (d)=>{ - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - return values ? ticks.filter(test) : test; -} -const symbols = { - [Quantile]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' -}; -const formats = { - [Quantile]: 'quantiles', - [Quantize]: 'domain' -}; -function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : tickValues(scale, count); -} -function thresholdFormat(locale, scale, specifier) { - const _ = scale[formats[scale.type]](), n = _.length; - let d = n > 1 ? _[1] - _[0] : _[0], i; - for(i = 1; i < n; ++i)d = Math.min(d, _[i] - _[i - 1]); - // tickCount = 3 ticks times 10 for increased resolution - return locale.formatSpan(0, d, 30, specifier); -} -function thresholdValues(thresholds) { - const values = [ - -Infinity - ].concat(thresholds); - values.max = Infinity; - return values; -} -function binValues(bins) { - const values = bins.slice(0, -1); - values.max = (0, _vegaUtil.peek)(bins); - return values; -} -const isDiscreteRange = (scale)=>symbols[scale.type] || scale.bins; -function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) { - const format = formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat(locale, scale, count, specifier, formatType, noSkip); - return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format); -} -const formatRange = (format)=>(value, index, array)=>{ - const limit = get(array[index + 1], get(array.max, Infinity)), lo = formatValue(value, format), hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; -const get = (value, dflt)=>value != null ? value : dflt; -const formatDiscrete = (format)=>(value, index)=>index ? format(value) : null; -const formatPoint = (format)=>(value)=>format(value); -const formatValue = (value, format)=>Number.isFinite(value) ? format(value) : null; -function labelFraction(scale) { - const domain = scale.domain(), count = domain.length - 1; - let lo = +domain[0], hi = +(0, _vegaUtil.peek)(domain), span = hi - lo; - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - return (value)=>(value - lo) / span; -} -function format(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - // replace abbreviated time specifiers to improve screen reader experience - if ((0, _vegaUtil.isString)(specifier) && isTemporal(type)) specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true); -} -function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), fmt = format(locale, scale, opt.format, opt.formatType); - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } else if (isDiscrete(scale.type)) { - const d = scale.domain(), n = d.length, v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt((0, _vegaUtil.peek)(d))}`; - } -} - -},{"vega-util":"f2ulH","d3-array":"5lCYW","d3-scale":"1PRVx","d3-interpolate":"hWyQt","d3-scale-chromatic":"dU3kB","vega-time":"kjkWX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dU3kB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "schemeCategory10", ()=>(0, _category10JsDefault.default)); -parcelHelpers.export(exports, "schemeAccent", ()=>(0, _accentJsDefault.default)); -parcelHelpers.export(exports, "schemeDark2", ()=>(0, _dark2JsDefault.default)); -parcelHelpers.export(exports, "schemeObservable10", ()=>(0, _observable10JsDefault.default)); -parcelHelpers.export(exports, "schemePaired", ()=>(0, _pairedJsDefault.default)); -parcelHelpers.export(exports, "schemePastel1", ()=>(0, _pastel1JsDefault.default)); -parcelHelpers.export(exports, "schemePastel2", ()=>(0, _pastel2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet1", ()=>(0, _set1JsDefault.default)); -parcelHelpers.export(exports, "schemeSet2", ()=>(0, _set2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet3", ()=>(0, _set3JsDefault.default)); -parcelHelpers.export(exports, "schemeTableau10", ()=>(0, _tableau10JsDefault.default)); -parcelHelpers.export(exports, "interpolateBrBG", ()=>(0, _brBGJsDefault.default)); -parcelHelpers.export(exports, "schemeBrBG", ()=>(0, _brBGJs.scheme)); -parcelHelpers.export(exports, "interpolatePRGn", ()=>(0, _prgnJsDefault.default)); -parcelHelpers.export(exports, "schemePRGn", ()=>(0, _prgnJs.scheme)); -parcelHelpers.export(exports, "interpolatePiYG", ()=>(0, _piYGJsDefault.default)); -parcelHelpers.export(exports, "schemePiYG", ()=>(0, _piYGJs.scheme)); -parcelHelpers.export(exports, "interpolatePuOr", ()=>(0, _puOrJsDefault.default)); -parcelHelpers.export(exports, "schemePuOr", ()=>(0, _puOrJs.scheme)); -parcelHelpers.export(exports, "interpolateRdBu", ()=>(0, _rdBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdBu", ()=>(0, _rdBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdGy", ()=>(0, _rdGyJsDefault.default)); -parcelHelpers.export(exports, "schemeRdGy", ()=>(0, _rdGyJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlBu", ()=>(0, _rdYlBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlBu", ()=>(0, _rdYlBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlGn", ()=>(0, _rdYlGnJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlGn", ()=>(0, _rdYlGnJs.scheme)); -parcelHelpers.export(exports, "interpolateSpectral", ()=>(0, _spectralJsDefault.default)); -parcelHelpers.export(exports, "schemeSpectral", ()=>(0, _spectralJs.scheme)); -parcelHelpers.export(exports, "interpolateBuGn", ()=>(0, _buGnJsDefault.default)); -parcelHelpers.export(exports, "schemeBuGn", ()=>(0, _buGnJs.scheme)); -parcelHelpers.export(exports, "interpolateBuPu", ()=>(0, _buPuJsDefault.default)); -parcelHelpers.export(exports, "schemeBuPu", ()=>(0, _buPuJs.scheme)); -parcelHelpers.export(exports, "interpolateGnBu", ()=>(0, _gnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeGnBu", ()=>(0, _gnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateOrRd", ()=>(0, _orRdJsDefault.default)); -parcelHelpers.export(exports, "schemeOrRd", ()=>(0, _orRdJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBuGn", ()=>(0, _puBuGnJsDefault.default)); -parcelHelpers.export(exports, "schemePuBuGn", ()=>(0, _puBuGnJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBu", ()=>(0, _puBuJsDefault.default)); -parcelHelpers.export(exports, "schemePuBu", ()=>(0, _puBuJs.scheme)); -parcelHelpers.export(exports, "interpolatePuRd", ()=>(0, _puRdJsDefault.default)); -parcelHelpers.export(exports, "schemePuRd", ()=>(0, _puRdJs.scheme)); -parcelHelpers.export(exports, "interpolateRdPu", ()=>(0, _rdPuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdPu", ()=>(0, _rdPuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGnBu", ()=>(0, _ylGnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGnBu", ()=>(0, _ylGnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGn", ()=>(0, _ylGnJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGn", ()=>(0, _ylGnJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrBr", ()=>(0, _ylOrBrJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrBr", ()=>(0, _ylOrBrJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrRd", ()=>(0, _ylOrRdJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrRd", ()=>(0, _ylOrRdJs.scheme)); -parcelHelpers.export(exports, "interpolateBlues", ()=>(0, _bluesJsDefault.default)); -parcelHelpers.export(exports, "schemeBlues", ()=>(0, _bluesJs.scheme)); -parcelHelpers.export(exports, "interpolateGreens", ()=>(0, _greensJsDefault.default)); -parcelHelpers.export(exports, "schemeGreens", ()=>(0, _greensJs.scheme)); -parcelHelpers.export(exports, "interpolateGreys", ()=>(0, _greysJsDefault.default)); -parcelHelpers.export(exports, "schemeGreys", ()=>(0, _greysJs.scheme)); -parcelHelpers.export(exports, "interpolatePurples", ()=>(0, _purplesJsDefault.default)); -parcelHelpers.export(exports, "schemePurples", ()=>(0, _purplesJs.scheme)); -parcelHelpers.export(exports, "interpolateReds", ()=>(0, _redsJsDefault.default)); -parcelHelpers.export(exports, "schemeReds", ()=>(0, _redsJs.scheme)); -parcelHelpers.export(exports, "interpolateOranges", ()=>(0, _orangesJsDefault.default)); -parcelHelpers.export(exports, "schemeOranges", ()=>(0, _orangesJs.scheme)); -parcelHelpers.export(exports, "interpolateCividis", ()=>(0, _cividisJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixDefault", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateRainbow", ()=>(0, _rainbowJsDefault.default)); -parcelHelpers.export(exports, "interpolateWarm", ()=>(0, _rainbowJs.warm)); -parcelHelpers.export(exports, "interpolateCool", ()=>(0, _rainbowJs.cool)); -parcelHelpers.export(exports, "interpolateSinebow", ()=>(0, _sinebowJsDefault.default)); -parcelHelpers.export(exports, "interpolateTurbo", ()=>(0, _turboJsDefault.default)); -parcelHelpers.export(exports, "interpolateViridis", ()=>(0, _viridisJsDefault.default)); -parcelHelpers.export(exports, "interpolateMagma", ()=>(0, _viridisJs.magma)); -parcelHelpers.export(exports, "interpolateInferno", ()=>(0, _viridisJs.inferno)); -parcelHelpers.export(exports, "interpolatePlasma", ()=>(0, _viridisJs.plasma)); -var _category10Js = require("./categorical/category10.js"); -var _category10JsDefault = parcelHelpers.interopDefault(_category10Js); -var _accentJs = require("./categorical/Accent.js"); -var _accentJsDefault = parcelHelpers.interopDefault(_accentJs); -var _dark2Js = require("./categorical/Dark2.js"); -var _dark2JsDefault = parcelHelpers.interopDefault(_dark2Js); -var _observable10Js = require("./categorical/observable10.js"); -var _observable10JsDefault = parcelHelpers.interopDefault(_observable10Js); -var _pairedJs = require("./categorical/Paired.js"); -var _pairedJsDefault = parcelHelpers.interopDefault(_pairedJs); -var _pastel1Js = require("./categorical/Pastel1.js"); -var _pastel1JsDefault = parcelHelpers.interopDefault(_pastel1Js); -var _pastel2Js = require("./categorical/Pastel2.js"); -var _pastel2JsDefault = parcelHelpers.interopDefault(_pastel2Js); -var _set1Js = require("./categorical/Set1.js"); -var _set1JsDefault = parcelHelpers.interopDefault(_set1Js); -var _set2Js = require("./categorical/Set2.js"); -var _set2JsDefault = parcelHelpers.interopDefault(_set2Js); -var _set3Js = require("./categorical/Set3.js"); -var _set3JsDefault = parcelHelpers.interopDefault(_set3Js); -var _tableau10Js = require("./categorical/Tableau10.js"); -var _tableau10JsDefault = parcelHelpers.interopDefault(_tableau10Js); -var _brBGJs = require("./diverging/BrBG.js"); -var _brBGJsDefault = parcelHelpers.interopDefault(_brBGJs); -var _prgnJs = require("./diverging/PRGn.js"); -var _prgnJsDefault = parcelHelpers.interopDefault(_prgnJs); -var _piYGJs = require("./diverging/PiYG.js"); -var _piYGJsDefault = parcelHelpers.interopDefault(_piYGJs); -var _puOrJs = require("./diverging/PuOr.js"); -var _puOrJsDefault = parcelHelpers.interopDefault(_puOrJs); -var _rdBuJs = require("./diverging/RdBu.js"); -var _rdBuJsDefault = parcelHelpers.interopDefault(_rdBuJs); -var _rdGyJs = require("./diverging/RdGy.js"); -var _rdGyJsDefault = parcelHelpers.interopDefault(_rdGyJs); -var _rdYlBuJs = require("./diverging/RdYlBu.js"); -var _rdYlBuJsDefault = parcelHelpers.interopDefault(_rdYlBuJs); -var _rdYlGnJs = require("./diverging/RdYlGn.js"); -var _rdYlGnJsDefault = parcelHelpers.interopDefault(_rdYlGnJs); -var _spectralJs = require("./diverging/Spectral.js"); -var _spectralJsDefault = parcelHelpers.interopDefault(_spectralJs); -var _buGnJs = require("./sequential-multi/BuGn.js"); -var _buGnJsDefault = parcelHelpers.interopDefault(_buGnJs); -var _buPuJs = require("./sequential-multi/BuPu.js"); -var _buPuJsDefault = parcelHelpers.interopDefault(_buPuJs); -var _gnBuJs = require("./sequential-multi/GnBu.js"); -var _gnBuJsDefault = parcelHelpers.interopDefault(_gnBuJs); -var _orRdJs = require("./sequential-multi/OrRd.js"); -var _orRdJsDefault = parcelHelpers.interopDefault(_orRdJs); -var _puBuGnJs = require("./sequential-multi/PuBuGn.js"); -var _puBuGnJsDefault = parcelHelpers.interopDefault(_puBuGnJs); -var _puBuJs = require("./sequential-multi/PuBu.js"); -var _puBuJsDefault = parcelHelpers.interopDefault(_puBuJs); -var _puRdJs = require("./sequential-multi/PuRd.js"); -var _puRdJsDefault = parcelHelpers.interopDefault(_puRdJs); -var _rdPuJs = require("./sequential-multi/RdPu.js"); -var _rdPuJsDefault = parcelHelpers.interopDefault(_rdPuJs); -var _ylGnBuJs = require("./sequential-multi/YlGnBu.js"); -var _ylGnBuJsDefault = parcelHelpers.interopDefault(_ylGnBuJs); -var _ylGnJs = require("./sequential-multi/YlGn.js"); -var _ylGnJsDefault = parcelHelpers.interopDefault(_ylGnJs); -var _ylOrBrJs = require("./sequential-multi/YlOrBr.js"); -var _ylOrBrJsDefault = parcelHelpers.interopDefault(_ylOrBrJs); -var _ylOrRdJs = require("./sequential-multi/YlOrRd.js"); -var _ylOrRdJsDefault = parcelHelpers.interopDefault(_ylOrRdJs); -var _bluesJs = require("./sequential-single/Blues.js"); -var _bluesJsDefault = parcelHelpers.interopDefault(_bluesJs); -var _greensJs = require("./sequential-single/Greens.js"); -var _greensJsDefault = parcelHelpers.interopDefault(_greensJs); -var _greysJs = require("./sequential-single/Greys.js"); -var _greysJsDefault = parcelHelpers.interopDefault(_greysJs); -var _purplesJs = require("./sequential-single/Purples.js"); -var _purplesJsDefault = parcelHelpers.interopDefault(_purplesJs); -var _redsJs = require("./sequential-single/Reds.js"); -var _redsJsDefault = parcelHelpers.interopDefault(_redsJs); -var _orangesJs = require("./sequential-single/Oranges.js"); -var _orangesJsDefault = parcelHelpers.interopDefault(_orangesJs); -var _cividisJs = require("./sequential-multi/cividis.js"); -var _cividisJsDefault = parcelHelpers.interopDefault(_cividisJs); -var _cubehelixJs = require("./sequential-multi/cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _rainbowJs = require("./sequential-multi/rainbow.js"); -var _rainbowJsDefault = parcelHelpers.interopDefault(_rainbowJs); -var _sinebowJs = require("./sequential-multi/sinebow.js"); -var _sinebowJsDefault = parcelHelpers.interopDefault(_sinebowJs); -var _turboJs = require("./sequential-multi/turbo.js"); -var _turboJsDefault = parcelHelpers.interopDefault(_turboJs); -var _viridisJs = require("./sequential-multi/viridis.js"); -var _viridisJsDefault = parcelHelpers.interopDefault(_viridisJs); - -},{"./categorical/category10.js":"fNUpb","./categorical/Accent.js":"l6HfJ","./categorical/Dark2.js":"2WDW3","./categorical/observable10.js":"6iC9c","./categorical/Paired.js":"cEUm7","./categorical/Pastel1.js":"h7k3H","./categorical/Pastel2.js":"dc8lr","./categorical/Set1.js":"dPPYu","./categorical/Set2.js":"bLevt","./categorical/Set3.js":"idTTy","./categorical/Tableau10.js":false,"./diverging/BrBG.js":false,"./diverging/PRGn.js":false,"./diverging/PiYG.js":false,"./diverging/PuOr.js":false,"./diverging/RdBu.js":false,"./diverging/RdGy.js":false,"./diverging/RdYlBu.js":false,"./diverging/RdYlGn.js":false,"./diverging/Spectral.js":false,"./sequential-multi/BuGn.js":false,"./sequential-multi/BuPu.js":false,"./sequential-multi/GnBu.js":false,"./sequential-multi/OrRd.js":false,"./sequential-multi/PuBuGn.js":false,"./sequential-multi/PuBu.js":false,"./sequential-multi/PuRd.js":false,"./sequential-multi/RdPu.js":false,"./sequential-multi/YlGnBu.js":false,"./sequential-multi/YlGn.js":false,"./sequential-multi/YlOrBr.js":false,"./sequential-multi/YlOrRd.js":false,"./sequential-single/Blues.js":false,"./sequential-single/Greens.js":false,"./sequential-single/Greys.js":false,"./sequential-single/Purples.js":false,"./sequential-single/Reds.js":false,"./sequential-single/Oranges.js":false,"./sequential-multi/cividis.js":false,"./sequential-multi/cubehelix.js":false,"./sequential-multi/rainbow.js":false,"./sequential-multi/sinebow.js":false,"./sequential-multi/turbo.js":false,"./sequential-multi/viridis.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fNUpb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jNRnl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specifier) { - var n = specifier.length / 6 | 0, colors = new Array(n), i = 0; - while(i < n)colors[i] = "#" + specifier.slice(i * 6, ++i * 6); - return colors; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l6HfJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2WDW3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iC9c":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEUm7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h7k3H":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dc8lr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dPPYu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bLevt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"idTTy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); - -},{"../colors.js":"jNRnl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1JcF5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "axisticks", ()=>AxisTicks); -parcelHelpers.export(exports, "datajoin", ()=>DataJoin); -parcelHelpers.export(exports, "encode", ()=>Encode); -parcelHelpers.export(exports, "legendentries", ()=>LegendEntries); -parcelHelpers.export(exports, "linkpath", ()=>LinkPath); -parcelHelpers.export(exports, "pie", ()=>Pie); -parcelHelpers.export(exports, "scale", ()=>Scale); -parcelHelpers.export(exports, "sortitems", ()=>SortItems); -parcelHelpers.export(exports, "stack", ()=>Stack); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScale = require("vega-scale"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -/** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function AxisTicks(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(AxisTicks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), ticks = this.value, scale = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count = (0, _vegaScale.tickCount)(scale, tally, _.minstep), format = _.format || (0, _vegaScale.tickFormat)(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), values = _.values ? (0, _vegaScale.validTicks)(scale, _.values, count) : (0, _vegaScale.tickValues)(scale, count); - if (ticks) out.rem = ticks; - ticks = values.map((value, i)=>(0, _vegaDataflow.ingest)({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - })); - if (_.extra && ticks.length) // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push((0, _vegaDataflow.ingest)({ - index: -1, - extra: { - value: ticks[0].value - }, - label: '' - })); - out.source = ticks; - out.add = ticks; - this.value = ticks; - return out; - } -}); -/** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ function DataJoin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -function defaultItemCreate() { - return (0, _vegaDataflow.ingest)({}); -} -function newMap(key) { - const map = (0, _vegaUtil.fastmap)().test((t)=>t.exit); - map.lookup = (t)=>map.get(key(t)); - return map; -} -(0, _vegaUtil.inherits)(DataJoin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), item = _.item || defaultItemCreate, key = _.key || (0, _vegaDataflow.tupleid), map = this.value; - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if ((0, _vegaUtil.isArray)(out.encode)) out.encode = null; - if (map && (_.modified('key') || pulse.modified(key))) (0, _vegaUtil.error)('DataJoin does not support modified key function or fields.'); - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - let x = map.get(k); - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else out.mod.push(x); - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - x.datum = t; - x.exit = false; - }); - pulse.visit(pulse.MOD, (t)=>{ - const k = key(t), x = map.get(k); - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - pulse.visit(pulse.REM, (t)=>{ - const k = key(t), x = map.get(k); - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) df.runAfter(map.clean); - return out; - } -}); -/** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ function Encode(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Encode, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode = pulse.encode; - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if ((0, _vegaUtil.isArray)(encode)) { - if (out.changed() || encode.every((e)=>encoders[e])) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else return pulse.StopPropagation; - } - // marshall encoder functions - var reenter = encode === 'enter', update = encoders.update || (0, _vegaUtil.falsy), enter = encoders.enter || (0, _vegaUtil.falsy), exit = encoders.exit || (0, _vegaUtil.falsy), set = (encode && !reenter ? encoders[encode] : update) || (0, _vegaUtil.falsy); - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, (t)=>{ - enter(t, _); - update(t, _); - }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== (0, _vegaUtil.falsy) && set !== update) { - pulse.visit(pulse.ADD, (t)=>{ - set(t, _); - }); - out.modifies(set.output); - } - } - if (pulse.changed(pulse.REM) && exit !== (0, _vegaUtil.falsy)) { - pulse.visit(pulse.REM, (t)=>{ - exit(t, _); - }); - out.modifies(exit.output); - } - if (reenter || set !== (0, _vegaUtil.falsy)) { - const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, (t)=>{ - const mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else pulse.visit(flag, (t)=>{ - if (set(t, _) || fmod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(set.output); - } - return out.changed() ? out : pulse.StopPropagation; - } -}); -/** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function LegendEntries(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(LegendEntries, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value != null && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), items = this.value, type = _.type || (0, _vegaScale.SymbolLegend), scale = _.scale, limit = +_.limit, count = (0, _vegaScale.tickCount)(scale, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type === (0, _vegaScale.SymbolLegend), format = _.format || (0, _vegaScale.labelFormat)(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), values = _.values || (0, _vegaScale.labelValues)(scale, count), domain, fraction, size, offset, ellipsis; - if (items) out.rem = items; - if (type === (0, _vegaScale.SymbolLegend)) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else items = values; - if ((0, _vegaUtil.isFunction)(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) items = items.slice(1); - // compute size offset for legend entries - offset = items.reduce((max, value)=>Math.max(max, size(value, _)), 0); - } else size = (0, _vegaUtil.constant)(offset = size || 8); - items = items.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - })); - if (ellipsis) { - ellipsis = values[items.length]; - items.push((0, _vegaDataflow.ingest)({ - index: items.length, - label: `\u2026${values.length - items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } else if (type === (0, _vegaScale.GradientLegend)) { - domain = scale.domain(), fraction = (0, _vegaScale.scaleFraction)(scale, domain[0], (0, _vegaUtil.peek)(domain)); - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== (0, _vegaUtil.peek)(domain)) values = [ - domain[0], - (0, _vegaUtil.peek)(domain) - ]; - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - })); - } else { - size = values.length - 1; - fraction = (0, _vegaScale.labelFraction)(scale); - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index + 1]) - })); - } - out.source = items; - out.add = items; - this.value = items; - return out; - } -}); -const sourceX = (t)=>t.source.x; -const sourceY = (t)=>t.source.y; -const targetX = (t)=>t.target.x; -const targetY = (t)=>t.target.y; -/** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ function LinkPath(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sourceX', - 'type': 'field', - 'default': 'source.x' - }, - { - 'name': 'sourceY', - 'type': 'field', - 'default': 'source.y' - }, - { - 'name': 'targetX', - 'type': 'field', - 'default': 'target.x' - }, - { - 'name': 'targetY', - 'type': 'field', - 'default': 'target.y' - }, - { - 'name': 'orient', - 'type': 'enum', - 'default': 'vertical', - 'values': [ - 'horizontal', - 'vertical', - 'radial' - ] - }, - { - 'name': 'shape', - 'type': 'enum', - 'default': 'line', - 'values': [ - 'line', - 'arc', - 'curve', - 'diagonal', - 'orthogonal' - ] - }, - { - 'name': 'require', - 'type': 'signal' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(LinkPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx = _.targetX || targetX, ty = _.targetY || targetY, as = _.as || 'path', orient = _.orient || 'vertical', shape = _.shape || 'line', path = Paths.get(shape + '-' + orient) || Paths.get(shape); - if (!path) (0, _vegaUtil.error)('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : '')); - pulse.visit(pulse.SOURCE, (t)=>{ - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - return pulse.reflow(_.modified()).modifies(as); - } -}); -const line = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'L' + tx + ',' + ty; -const lineR = (sa, sr, ta, tr)=>line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const arc = (sx, sy, tx, ty)=>{ - var dx = tx - sx, dy = ty - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty; -}; -const arcR = (sa, sr, ta, tr)=>arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const curve = (sx, sy, tx, ty)=>{ - const dx = tx - sx, dy = ty - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty; -}; -const curveR = (sa, sr, ta, tr)=>curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const orthoX = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'V' + ty + 'H' + tx; -const orthoY = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'H' + tx + 'V' + ty; -const orthoR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts; -}; -const diagonalX = (sx, sy, tx, ty)=>{ - const m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty; -}; -const diagonalY = (sx, sy, tx, ty)=>{ - const m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty; -}; -const diagonalR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), mr = (sr + tr) / 2; - return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts; -}; -const Paths = (0, _vegaUtil.fastmap)({ - 'line': line, - 'line-radial': lineR, - 'arc': arc, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR -}); -/** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ function Pie(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Pie.Definition = { - 'type': 'Pie', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'startAngle', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'endAngle', - 'type': 'number', - 'default': 6.283185307179586 - }, - { - 'name': 'sort', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'startAngle', - 'endAngle' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Pie, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || [ - 'startAngle', - 'endAngle' - ], startAngle = as[0], endAngle = as[1], field = _.field || (0, _vegaUtil.one), start = _.startAngle || 0, stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, data = pulse.source, values = data.map(field), n = values.length, a = start, k = (stop - start) / (0, _d3Array.sum)(values), index = (0, _d3Array.range)(n), i, t, v; - if (_.sort) index.sort((a, b)=>values[a] - values[b]); - for(i = 0; i < n; ++i){ - v = values[index[i]]; - t = data[index[i]]; - t[startAngle] = a; - t[endAngle] = a += v * k; - } - this.value = values; - return pulse.reflow(_.modified()).modifies(as); - } -}); -const DEFAULT_COUNT = 5; -function includeZero(scale) { - const type = scale.type; - return !scale.bins && (type === (0, _vegaScale.Linear) || type === (0, _vegaScale.Pow) || type === (0, _vegaScale.Sqrt)); -} -function includePad(type) { - return (0, _vegaScale.isContinuous)(type) && type !== (0, _vegaScale.Sequential); -} -const SKIP = (0, _vegaUtil.toSet)([ - 'set', - 'modified', - 'clear', - 'type', - 'scheme', - 'schemeExtent', - 'schemeCount', - 'domain', - 'domainMin', - 'domainMid', - 'domainMax', - 'domainRaw', - 'domainImplicit', - 'nice', - 'zero', - 'bins', - 'range', - 'rangeStep', - 'round', - 'reverse', - 'interpolate', - 'interpolateGamma' -]); -/** - * Maintains a scale function mapping data values to visual channels. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Scale(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Scale, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, scale$1 = this.value, key = scaleKey(_); - if (!scale$1 || key !== scale$1.type) this.value = scale$1 = (0, _vegaScale.scale)(key)(); - for(key in _)if (!SKIP[key]) { - // padding is a scale property for band/point but not others - if (key === 'padding' && includePad(scale$1.type)) continue; - // invoke scale property setter, raise warning if not found - (0, _vegaUtil.isFunction)(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key); - } - configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df))); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function scaleKey(_) { - var t = _.type, d = '', n; - // backwards compatibility pre Vega 5. - if (t === (0, _vegaScale.Sequential)) return (0, _vegaScale.Sequential) + '-' + (0, _vegaScale.Linear); - if (isContinuousColor(_)) { - n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; - d = n === 2 ? (0, _vegaScale.Sequential) + '-' : n === 3 ? (0, _vegaScale.Diverging) + '-' : ''; - } - return (d + t || (0, _vegaScale.Linear)).toLowerCase(); -} -function isContinuousColor(_) { - const t = _.type; - return (0, _vegaScale.isContinuous)(t) && t !== (0, _vegaScale.Time) && t !== (0, _vegaScale.UTC) && (_.scheme || _.range && _.range.length && _.range.every((0, _vegaUtil.isString))); -} -function configureDomain(scale, _, df) { - // check raw domain, if provided use that and exit early - const raw = rawDomain(scale, _.domainRaw, df); - if (raw > -1) return raw; - var domain = _.domain, type = scale.type, zero = _.zero || _.zero === undefined && includeZero(scale), n, mid; - if (!domain) return 0; - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = (domain = domain.slice()).length - 1 || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== (0, _vegaUtil.peek)(domain)) domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === (0, _vegaScale.Ordinal)) scale.unknown(_.domainImplicit ? (0, _vegaScale.scaleImplicit) : undefined); - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) scale.nice(_.nice !== true && (0, _vegaScale.tickCount)(scale, _.nice) || null); - // return the cardinality of the domain - return domain.length; -} -function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else return -1; -} -function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs((0, _vegaUtil.peek)(range) - range[0]), frac = span / (span - 2 * pad), d = type === (0, _vegaScale.Log) ? (0, _vegaUtil.zoomLog)(domain, null, frac) : type === (0, _vegaScale.Sqrt) ? (0, _vegaUtil.zoomPow)(domain, null, frac, 0.5) : type === (0, _vegaScale.Pow) ? (0, _vegaUtil.zoomPow)(domain, null, frac, exponent || 1) : type === (0, _vegaScale.Symlog) ? (0, _vegaUtil.zoomSymlog)(domain, null, frac, constant || 1) : (0, _vegaUtil.zoomLinear)(domain, null, frac); - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length - 1] = d[1]; - return domain; -} -function domainCheck(type, domain, df) { - if ((0, _vegaScale.isLogarithmic)(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce((s, v)=>s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); - if (s !== domain.length) df.warn('Log scale domain includes zero: ' + (0, _vegaUtil.stringValue)(domain)); - } - return domain; -} -function configureBins(scale, _, count) { - let bins = _.bins; - if (bins && !(0, _vegaUtil.isArray)(bins)) { - // generate bin boundary array - const domain = scale.domain(), lo = domain[0], hi = (0, _vegaUtil.peek)(domain), step = bins.step; - let start = bins.start == null ? lo : bins.start, stop = bins.stop == null ? hi : bins.stop; - if (!step) (0, _vegaUtil.error)('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = (0, _d3Array.range)(start, stop + step / 2, step); - } - if (bins) // assign bin boundaries to scale instance - scale.bins = bins; - else if (scale.bins) // no current bins, remove bins if previously set - delete scale.bins; - // special handling for bin-ordinal scales - if (scale.type === (0, _vegaScale.BinOrdinal)) { - if (!bins) // the domain specifies the bins - scale.bins = scale.domain(); - else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - // return domain cardinality - return count; -} -function configureRange(scale, _, count) { - var type = scale.type, round = _.round || false, range = _.range; - // if range step specified, calculate full range extent - if (_.rangeStep != null) range = configureRangeStep(type, _, count); - else if (_.scheme) { - range = configureScheme(type, _, count); - if ((0, _vegaUtil.isFunction)(range)) { - if (scale.interpolator) return scale.interpolator(range); - else (0, _vegaUtil.error)(`Scale type ${type} does not support interpolating color schemes.`); - } - } - // given a range array for an interpolating scale, convert to interpolator - if (range && (0, _vegaScale.isInterpolating)(type)) return scale.interpolator((0, _vegaScale.interpolateColors)(flip(range, _.reverse), _.interpolate, _.interpolateGamma)); - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) scale.interpolate((0, _vegaScale.interpolate)(_.interpolate, _.interpolateGamma)); - else if ((0, _vegaUtil.isFunction)(scale.round)) scale.round(round); - else if ((0, _vegaUtil.isFunction)(scale.rangeRound)) scale.interpolate(round ? (0, _d3Interpolate.interpolateRound) : (0, _d3Interpolate.interpolate)); - if (range) scale.range(flip(range, _.reverse)); -} -function configureRangeStep(type, _, count) { - if (type !== (0, _vegaScale.Band) && type !== (0, _vegaScale.Point)) (0, _vegaUtil.error)('Only band and point scales support rangeStep.'); - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type === (0, _vegaScale.Point) ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; + return projection2; + } + function naturalEarth1Raw(lambda, phi2) { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; return [ - 0, - _.rangeStep * (0, _vegaScale.bandSpace)(count, inner, outer) + lambda * (0.8707 - 0.131979 * phi22 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi22 - 1529e-6 * phi4))), + phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) ]; -} -function configureScheme(type, _, count) { - var extent = _.schemeExtent, name, scheme$1; - if ((0, _vegaUtil.isArray)(_.scheme)) scheme$1 = (0, _vegaScale.interpolateColors)(_.scheme, _.interpolate, _.interpolateGamma); - else { - name = _.scheme.toLowerCase(); - scheme$1 = (0, _vegaScale.scheme)(name); - if (!scheme$1) (0, _vegaUtil.error)(`Unrecognized scheme name: ${_.scheme}`); - } - // determine size for potential discrete range - count = type === (0, _vegaScale.Threshold) ? count + 1 : type === (0, _vegaScale.BinOrdinal) ? count - 1 : type === (0, _vegaScale.Quantile) || type === (0, _vegaScale.Quantize) ? +_.schemeCount || DEFAULT_COUNT : count; - // adjust and/or quantize scheme as appropriate - return (0, _vegaScale.isInterpolating)(type) ? adjustScheme(scheme$1, extent, _.reverse) : (0, _vegaUtil.isFunction)(scheme$1) ? (0, _vegaScale.quantizeInterpolator)(adjustScheme(scheme$1, extent), count) : type === (0, _vegaScale.Ordinal) ? scheme$1 : scheme$1.slice(0, count); -} -function adjustScheme(scheme, extent, reverse) { - return (0, _vegaUtil.isFunction)(scheme) && (extent || reverse) ? (0, _vegaScale.interpolateRange)(scheme, flip(extent || [ - 0, - 1 - ], reverse)) : scheme; -} -function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; -} -/** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ function SortItems(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(SortItems, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum'); - if (mod) pulse.source.sort((0, _vegaDataflow.stableCompare)(_.sort)); - this.modified(mod); - return pulse; - } -}); -const Zero = 'zero', Center = 'center', Normalize = 'normalize', DefOutput = [ - 'y0', - 'y1' -]; -/** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ function Stack(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stack.Definition = { - 'type': 'Stack', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'offset', - 'type': 'enum', - 'default': Zero, - 'values': [ - Zero, - Center, - Normalize - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': DefOutput - } - ] -}; -(0, _vegaUtil.inherits)(Stack, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || DefOutput, y0 = as[0], y1 = as[1], sort = (0, _vegaDataflow.stableCompare)(_.sort), field = _.field || (0, _vegaUtil.one), stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max; - // partition, sum, and sort the stack groups - groups = partition(pulse.source, _.groupby, sort, field); - // compute stack layouts per group - for(i = 0, n = groups.length, max = groups.max; i < n; ++i)stack(groups[i], max, field, y0, y1); - return pulse.reflow(_.modified()).modifies(as); - } -}); -function stackCenter(group, max, field, y0, y1) { - var last = (max - group.sum) / 2, m = group.length, j = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last += Math.abs(field(t)); - } -} -function stackNormalize(group, max, field, y0, y1) { - var scale = 1 / group.sum, last = 0, m = group.length, j = 0, v = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last = scale * (v += Math.abs(field(t))); - } -} -function stackZero(group, max, field, y0, y1) { - var lastPos = 0, lastNeg = 0, m = group.length, j = 0, v, t; - for(; j < m; ++j){ - t = group[j]; - v = +field(t); - if (v < 0) { - t[y0] = lastNeg; - t[y1] = lastNeg += v; - } else { - t[y0] = lastPos; - t[y1] = lastPos += v; - } - } -} -function partition(data, groupby, sort, field) { - var groups = [], get = (f)=>f(t), map, i, n, m, t, k, g, s, max; - // partition data points into stack groups - if (groupby == null) groups.push(data.slice()); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - groups.push(g); - } - g.push(t); - } - // compute sums of groups, sort groups as needed - for(k = 0, max = 0, m = groups.length; k < m; ++k){ - g = groups[k]; - for(i = 0, s = 0, n = g.length; i < n; ++i)s += Math.abs(field(g[i])); - g.sum = s; - if (s > max) max = s; - if (sort) g.sort(sort); - } - groups.max = max; - return groups; -} - -},{"vega-dataflow":"cFRfY","vega-scale":"gHN3E","vega-util":"f2ulH","d3-array":"5lCYW","d3-interpolate":"hWyQt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5TaRi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "contour", ()=>Contour); -parcelHelpers.export(exports, "geojson", ()=>GeoJSON); -parcelHelpers.export(exports, "geopath", ()=>GeoPath); -parcelHelpers.export(exports, "geopoint", ()=>GeoPoint); -parcelHelpers.export(exports, "geoshape", ()=>GeoShape); -parcelHelpers.export(exports, "graticule", ()=>Graticule); -parcelHelpers.export(exports, "heatmap", ()=>Heatmap); -parcelHelpers.export(exports, "isocontour", ()=>Isocontour); -parcelHelpers.export(exports, "kde2d", ()=>KDE2D); -parcelHelpers.export(exports, "projection", ()=>Projection); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _vegaStatistics = require("vega-statistics"); -var _vegaProjection = require("vega-projection"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaCanvas = require("vega-canvas"); -function noop() {} -const cases = [ - [], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ], - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ], - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [] -]; -// Implementation adapted from d3/d3-contour. Thanks! -function contours() { - var dx = 1, dy = 1, smooth = smoothLinear; - function contours(values, tz) { - return tz.map((value)=>contour(values, value)); - } - // Accumulate, smooth contour rings, assign holes to exterior rings. - // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js - function contour(values, value) { - var polygons = [], holes = []; - isorings(values, value, (ring)=>{ - smooth(ring, values, value); - if (area(ring) > 0) polygons.push([ - ring - ]); - else holes.push(ring); - }); - holes.forEach((hole)=>{ - for(var i = 0, n = polygons.length, polygon; i < n; ++i)if (contains((polygon = polygons[i])[0], hole) !== -1) { - polygon.push(hole); - return; - } + } + naturalEarth1Raw.invert = function(x2, y2) { + var phi2 = y2, i = 25, delta; + do { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; + phi2 -= delta = (phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) - y2) / (1.007226 + phi22 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi22 - 5916e-6 * 11 * phi4))); + } while (abs$1(delta) > epsilon$3 && --i > 0); + return [ + x2 / (0.8707 + (phi22 = phi2 * phi2) * (-0.131979 + phi22 * (-0.013791 + phi22 * phi22 * phi22 * (3971e-6 - 1529e-6 * phi22)))), + phi2 + ]; + }; + function geoNaturalEarth1() { + return projection$1(naturalEarth1Raw).scale(175.295); + } + function orthographicRaw(x2, y2) { + return [cos$1(y2) * sin$1(x2), sin$1(y2)]; + } + orthographicRaw.invert = azimuthalInvert(asin$1); + function geoOrthographic() { + return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3); + } + function stereographicRaw(x2, y2) { + var cy = cos$1(y2), k = 1 + cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + stereographicRaw.invert = azimuthalInvert(function(z2) { + return 2 * atan(z2); + }); + function geoStereographic() { + return projection$1(stereographicRaw).scale(250).clipAngle(142); + } + function transverseMercatorRaw(lambda, phi2) { + return [log$1(tan((halfPi$1 + phi2) / 2)), -lambda]; + } + transverseMercatorRaw.invert = function(x2, y2) { + return [-y2, 2 * atan(exp(x2)) - halfPi$1]; + }; + function geoTransverseMercator() { + var m2 = mercatorProjection(transverseMercatorRaw), center = m2.center, rotate2 = m2.rotate; + m2.center = function(_) { + return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); + }; + m2.rotate = function(_) { + return arguments.length ? rotate2([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate2(), [_[0], _[1], _[2] - 90]); + }; + return rotate2([0, 0, 90]).scale(159.155); + } + var abs = Math.abs; + var cos = Math.cos; + var sin = Math.sin; + var epsilon$2 = 1e-6; + var pi = Math.PI; + var halfPi = pi / 2; + var sqrt2 = sqrt(2); + function asin(x2) { + return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2); + } + function sqrt(x2) { + return x2 > 0 ? Math.sqrt(x2) : 0; + } + function mollweideBromleyTheta(cp, phi2) { + var cpsinPhi = cp * sin(phi2), i = 30, delta; + do + phi2 -= delta = (phi2 + sin(phi2) - cpsinPhi) / (1 + cos(phi2)); + while (abs(delta) > epsilon$2 && --i > 0); + return phi2 / 2; + } + function mollweideBromleyRaw(cx, cy, cp) { + function forward(lambda, phi2) { + return [cx * lambda * cos(phi2 = mollweideBromleyTheta(cp, phi2)), cy * sin(phi2)]; + } + forward.invert = function(x2, y2) { + return y2 = asin(y2 / cy), [x2 / (cx * cos(y2)), asin((2 * y2 + sin(2 * y2)) / cp)]; + }; + return forward; + } + var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); + function geoMollweide() { + return projection$1(mollweideRaw).scale(169.529); + } + const defaultPath = geoPath(); + const projectionProperties = [ + // standard properties in d3-geo + "clipAngle", + "clipExtent", + "scale", + "translate", + "center", + "rotate", + "parallels", + "precision", + "reflectX", + "reflectY", + // extended properties in d3-geo-projections + "coefficient", + "distance", + "fraction", + "lobes", + "parallel", + "radius", + "ratio", + "spacing", + "tilt" + ]; + function create$1(type2, constructor) { + return function projection2() { + const p = constructor(); + p.type = type2; + p.path = geoPath().projection(p); + p.copy = p.copy || function() { + const c2 = projection2(); + projectionProperties.forEach((prop) => { + if (p[prop]) c2[prop](p[prop]()); }); - return { - type: 'MultiPolygon', - value: value, - coordinates: polygons - }; + c2.path.pointRadius(p.path.pointRadius()); + return c2; + }; + return registerScale(p); + }; + } + function projection(type2, proj) { + if (!type2 || typeof type2 !== "string") { + throw new Error("Projection type must be a name string."); } - // Marching squares with isolines stitched into rings. - // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = [], fragmentByEnd = [], x, y, t0, t1, t2, t3; - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - // General case for the intermediate rows. - while(++y < dy - 1){ - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - function stitch(line) { - var start = [ - line[0][0] + x, - line[0][1] + y - ], end = [ - line[1][0] + x, - line[1][1] + y - ], startIndex = index(start), endIndex = index(end), f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[f.start] = fragmentByEnd[g.end] = { - start: f.start, - end: g.end, - ring: f.ring.concat(g.ring) - }; - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[g.start] = fragmentByEnd[f.end] = { - start: g.start, - end: f.end, - ring: g.ring.concat(f.ring) - }; - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { - start: startIndex, - end: endIndex, - ring: [ - start, - end - ] - }; + type2 = type2.toLowerCase(); + if (arguments.length > 1) { + projections[type2] = create$1(type2, proj); + return this; + } else { + return projections[type2] || null; + } + } + function getProjectionPath(proj) { + return proj && proj.path || defaultPath; + } + const projections = { + // base d3-geo projection types + albers: geoAlbers, + albersusa: geoAlbersUsa, + azimuthalequalarea: geoAzimuthalEqualArea, + azimuthalequidistant: geoAzimuthalEquidistant, + conicconformal: geoConicConformal, + conicequalarea: geoConicEqualArea, + conicequidistant: geoConicEquidistant, + equalEarth: geoEqualEarth, + equirectangular: geoEquirectangular, + gnomonic: geoGnomonic, + identity: geoIdentity, + mercator: geoMercator, + mollweide: geoMollweide, + naturalEarth1: geoNaturalEarth1, + orthographic: geoOrthographic, + stereographic: geoStereographic, + transversemercator: geoTransverseMercator + }; + for (const key2 in projections) { + projection(key2, projections[key2]); + } + function noop$1() { + } + const cases = [[], [[[1, 1.5], [0.5, 1]]], [[[1.5, 1], [1, 1.5]]], [[[1.5, 1], [0.5, 1]]], [[[1, 0.5], [1.5, 1]]], [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]], [[[1, 0.5], [1, 1.5]]], [[[1, 0.5], [0.5, 1]]], [[[0.5, 1], [1, 0.5]]], [[[1, 1.5], [1, 0.5]]], [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]], [[[1.5, 1], [1, 0.5]]], [[[0.5, 1], [1.5, 1]]], [[[1, 1.5], [1.5, 1]]], [[[0.5, 1], [1, 1.5]]], []]; + function contours() { + var dx = 1, dy = 1, smooth = smoothLinear; + function contours2(values2, tz) { + return tz.map((value2) => contour(values2, value2)); + } + function contour(values2, value2) { + var polygons = [], holes = []; + isorings(values2, value2, (ring) => { + smooth(ring, values2, value2); + if (area(ring) > 0) polygons.push([ring]); + else holes.push(ring); + }); + holes.forEach((hole) => { + for (var i = 0, n = polygons.length, polygon; i < n; ++i) { + if (contains((polygon = polygons[i])[0], hole) !== -1) { + polygon.push(hole); + return; + } + } + }); + return { + type: "MultiPolygon", + value: value2, + coordinates: polygons + }; + } + function isorings(values2, value2, callback) { + var fragmentByStart = [], fragmentByEnd = [], x2, y2, t02, t12, t22, t32; + x2 = y2 = -1; + t12 = values2[0] >= value2; + cases[t12 << 1].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[x2 + 1] >= value2; + cases[t02 | t12 << 1].forEach(stitch2); + } + cases[t12 << 0].forEach(stitch2); + while (++y2 < dy - 1) { + x2 = -1; + t12 = values2[y2 * dx + dx] >= value2; + t22 = values2[y2 * dx] >= value2; + cases[t12 << 1 | t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[y2 * dx + dx + x2 + 1] >= value2; + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t02 | t12 << 1 | t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t12 | t22 << 3].forEach(stitch2); + } + x2 = -1; + t22 = values2[y2 * dx] >= value2; + cases[t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t22 << 3].forEach(stitch2); + function stitch2(line2) { + var start = [line2[0][0] + x2, line2[0][1] + y2], end = [line2[1][0] + x2, line2[1][1] + y2], startIndex = index2(start), endIndex = index2(end), f, g; + if (f = fragmentByEnd[startIndex]) { + if (g = fragmentByStart[endIndex]) { + delete fragmentByEnd[f.end]; + delete fragmentByStart[g.start]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[f.start] = fragmentByEnd[g.end] = { + start: f.start, + end: g.end, + ring: f.ring.concat(g.ring) + }; + } + } else { + delete fragmentByEnd[f.end]; + f.ring.push(end); + fragmentByEnd[f.end = endIndex] = f; + } + } else if (f = fragmentByStart[endIndex]) { + if (g = fragmentByEnd[startIndex]) { + delete fragmentByStart[f.start]; + delete fragmentByEnd[g.end]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[g.start] = fragmentByEnd[f.end] = { + start: g.start, + end: f.end, + ring: g.ring.concat(f.ring) + }; + } + } else { + delete fragmentByStart[f.start]; + f.ring.unshift(start); + fragmentByStart[f.start = startIndex] = f; + } + } else { + fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { + start: startIndex, + end: endIndex, + ring: [start, end] + }; } + } } - function index(point) { - return point[0] * 2 + point[1] * (dx + 1) * 4; + function index2(point2) { + return point2[0] * 2 + point2[1] * (dx + 1) * 4; } - function smoothLinear(ring, values, value) { - ring.forEach((point)=>{ - var x = point[0], y = point[1], xt = x | 0, yt = y | 0, v0, v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); + function smoothLinear(ring, values2, value2) { + ring.forEach((point2) => { + var x2 = point2[0], y2 = point2[1], xt = x2 | 0, yt = y2 | 0, v0, v1 = values2[yt * dx + xt]; + if (x2 > 0 && x2 < dx && xt === x2) { + v0 = values2[yt * dx + xt - 1]; + point2[0] = x2 + (value2 - v0) / (v1 - v0) - 0.5; + } + if (y2 > 0 && y2 < dy && yt === y2) { + v0 = values2[(yt - 1) * dx + xt]; + point2[1] = y2 + (value2 - v0) / (v1 - v0) - 0.5; + } + }); } - contours.contour = contour; - contours.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, contours; - }; - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear; - }; - return contours; -} -function area(ring) { - var i = 0, n = ring.length, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while(++i < n)area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; -} -function contains(ring, hole) { - var i = -1, n = hole.length, c; - while(++i < n)if (c = ringContains(ring, hole[i])) return c; + contours2.contour = contour; + contours2.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, contours2; + }; + contours2.smooth = function(_) { + return arguments.length ? (smooth = _ ? smoothLinear : noop$1, contours2) : smooth === smoothLinear; + }; + return contours2; + } + function area(ring) { + var i = 0, n = ring.length, area2 = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; + while (++i < n) area2 += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; + return area2; + } + function contains(ring, hole) { + var i = -1, n = hole.length, c2; + while (++i < n) if (c2 = ringContains(ring, hole[i])) return c2; return 0; -} -function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for(var i = 0, n = ring.length, j = n - 1; i < n; j = i++){ - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains; - } - return contains; -} -function segmentContains(a, b, c) { + } + function ringContains(ring, point2) { + var x2 = point2[0], y2 = point2[1], contains2 = -1; + for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { + var pi2 = ring[i], xi = pi2[0], yi = pi2[1], pj = ring[j], xj = pj[0], yj = pj[1]; + if (segmentContains(pi2, pj, point2)) return 0; + if (yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi) contains2 = -contains2; + } + return contains2; + } + function segmentContains(a2, b2, c2) { var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} -function within(p, q, r) { + return collinear$1(a2, b2, c2) && within(a2[i = +(a2[0] === b2[0])], c2[i], b2[i]); + } + function collinear$1(a2, b2, c2) { + return (b2[0] - a2[0]) * (c2[1] - a2[1]) === (c2[0] - a2[0]) * (b2[1] - a2[1]); + } + function within(p, q, r) { return p <= q && q <= r || r <= q && q <= p; -} -function quantize(k, nice, zero) { - return function(values) { - var ex = (0, _vegaUtil.extent)(values), start = zero ? Math.min(ex[0], 0) : ex[0], stop = ex[1], span = stop - start, step = nice ? (0, _d3Array.tickStep)(start, stop, k) : span / (k + 1); - return (0, _d3Array.range)(start + step, stop, step); - }; -} -/** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ function Isocontour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': { - 'generates': true + } + function quantize(k, nice2, zero2) { + return function(values2) { + var ex = extent(values2), start = zero2 ? Math.min(ex[0], 0) : ex[0], stop2 = ex[1], span2 = stop2 - start, step = nice2 ? tickStep(start, stop2, k) : span2 / (k + 1); + return range$3(start + step, stop2, step); + }; + } + function Isocontour(params2) { + Transform.call(this, null, params2); + } + Isocontour.Definition = { + "type": "Isocontour", + "metadata": { + "generates": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'levels', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'zero', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'scale', - 'type': 'number', - 'expr': true - }, - { - 'name': 'translate', - 'type': 'number', - 'array': true, - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'default': 'contour' - } - ] -}; -(0, _vegaUtil.inherits)(Isocontour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, field = _.field || (0, _vegaUtil.identity), contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source, field, _), as = _.as === null ? null : _.as || 'contour', values = []; - source.forEach((t)=>{ - const grid = field(t); - // generate contour paths in GeoJSON format - const paths = contour.size([ - grid.width, - grid.height - ])(grid.values, (0, _vegaUtil.isArray)(tz) ? tz : tz(grid.values)); - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - // ingest; copy source data properties to output - paths.forEach((p)=>{ - values.push((0, _vegaDataflow.rederive)(t, (0, _vegaDataflow.ingest)(as != null ? { - [as]: p - } : p))); - }); + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "levels", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "zero", + "type": "boolean", + "default": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }, { + "name": "scale", + "type": "number", + "expr": true + }, { + "name": "translate", + "type": "number", + "array": true, + "expr": true + }, { + "name": "as", + "type": "string", + "null": true, + "default": "contour" + }] + }; + inherits(Isocontour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, field2 = _.field || identity$2, contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source2, field2, _), as = _.as === null ? null : _.as || "contour", values2 = []; + source2.forEach((t) => { + const grid2 = field2(t); + const paths = contour.size([grid2.width, grid2.height])(grid2.values, isArray(tz) ? tz : tz(grid2.values)); + transformPaths(paths, grid2, t, _); + paths.forEach((p) => { + values2.push(rederive(t, ingest$1(as != null ? { + [as]: p + } : p))); }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; + }); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; } -}); -function levels(values, f, _) { + }); + function levels(values2, f, _) { const q = quantize(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' ? q : q(values.map((t)=>(0, _d3Array.max)(f(t).values))); -} -function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, t = _.translate || grid.translate; - if ((0, _vegaUtil.isFunction)(s)) s = s(datum, _); - if ((0, _vegaUtil.isFunction)(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - const sx = ((0, _vegaUtil.isNumber)(s) ? s : s[0]) || 1, sy = ((0, _vegaUtil.isNumber)(s) ? s : s[1]) || 1, tx = t && t[0] || 0, ty = t && t[1] || 0; - paths.forEach(transform(grid, sx, sy, tx, ty)); -} -function transform(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, y1 = grid.y1 || 0, flip = sx * sy < 0; + return _.resolve !== "shared" ? q : q(values2.map((t) => max$2(f(t).values))); + } + function transformPaths(paths, grid2, datum2, _) { + let s2 = _.scale || grid2.scale, t = _.translate || grid2.translate; + if (isFunction(s2)) s2 = s2(datum2, _); + if (isFunction(t)) t = t(datum2, _); + if ((s2 === 1 || s2 == null) && !t) return; + const sx = (isNumber$1(s2) ? s2 : s2[0]) || 1, sy = (isNumber$1(s2) ? s2 : s2[1]) || 1, tx2 = t && t[0] || 0, ty2 = t && t[1] || 0; + paths.forEach(transform$1(grid2, sx, sy, tx2, ty2)); + } + function transform$1(grid2, sx, sy, tx2, ty2) { + const x12 = grid2.x1 || 0, y12 = grid2.y1 || 0, flip2 = sx * sy < 0; function transformPolygon(coordinates) { - coordinates.forEach(transformRing); + coordinates.forEach(transformRing); } function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); + if (flip2) coordinates.reverse(); + coordinates.forEach(transformPoint); } function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; + coordinates[0] = (coordinates[0] - x12) * sx + tx2; + coordinates[1] = (coordinates[1] - y12) * sy + ty2; } return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; + geometry.coordinates.forEach(transformPolygon); + return geometry; }; -} -function radius(bw, data, f) { - const v = bw >= 0 ? bw : (0, _vegaStatistics.bandwidthNRD)(data, f); + } + function radius(bw, data2, f) { + const v = bw >= 0 ? bw : estimateBandwidth(data2, f); return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); -} -function number(_) { - return (0, _vegaUtil.isFunction)(_) ? _ : (0, _vegaUtil.constant)(+_); -} -// Implementation adapted from d3/d3-contour. Thanks! -function density2D() { - var x = (d)=>d[0], y = (d)=>d[1], weight = (0, _vegaUtil.one), bandwidth = [ - -1, - -1 - ], dx = 960, dy = 500, k = 2; // log2(cellSize) - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), values1 = new Float32Array(n * m); - let values = values0; - data.forEach((d)=>{ - const xi = ox + (+x(d) >> k), yi = oy + (+y(d) >> k); - if (xi >= 0 && xi < n && yi >= 0 && yi < m) values0[xi + yi * n] += +weight(d); - }); - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - // scale density estimates - // density in points per square pixel or probability density - const s = counts ? Math.pow(2, -2 * k) : 1 / (0, _d3Array.sum)(values); - for(let i = 0, sz = n * m; i < sz; ++i)values[i] *= s; - return { - values: values, - scale: 1 << k, - width: n, - height: m, - x1: ox, - y1: oy, - x2: ox + (dx >> k), - y2: oy + (dy >> k) - }; - } - density.x = function(_) { - return arguments.length ? (x = number(_), density) : x; - }; - density.y = function(_) { - return arguments.length ? (y = number(_), density) : y; - }; - density.weight = function(_) { - return arguments.length ? (weight = number(_), density) : weight; - }; - density.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, density; - }; - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) (0, _vegaUtil.error)('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = (0, _vegaUtil.array)(_); - if (_.length === 1) _ = [ - +_[0], - +_[0] - ]; - if (_.length !== 2) (0, _vegaUtil.error)('invalid bandwidth'); - return bandwidth = _, density; - }; - return density; -} -function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let j = 0; j < m; ++j)for(let i = 0, sr = 0; i < n + r; ++i){ - if (i < n) sr += source[i + j * n]; + } + function number$2(_) { + return isFunction(_) ? _ : constant$4(+_); + } + function density2D() { + var x2 = (d2) => d2[0], y2 = (d2) => d2[1], weight = one$1, bandwidth2 = [-1, -1], dx = 960, dy = 500, k = 2; + function density2(data2, counts) { + const rx = radius(bandwidth2[0], data2, x2) >> k, ry = radius(bandwidth2[1], data2, y2) >> k, ox = rx ? rx + 2 : 0, oy = ry ? ry + 2 : 0, n = 2 * ox + (dx >> k), m2 = 2 * oy + (dy >> k), values0 = new Float32Array(n * m2), values1 = new Float32Array(n * m2); + let values2 = values0; + data2.forEach((d2) => { + const xi = ox + (+x2(d2) >> k), yi = oy + (+y2(d2) >> k); + if (xi >= 0 && xi < n && yi >= 0 && yi < m2) { + values0[xi + yi * n] += +weight(d2); + } + }); + if (rx > 0 && ry > 0) { + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + } else if (rx > 0) { + blurX(n, m2, values0, values1, rx); + blurX(n, m2, values1, values0, rx); + blurX(n, m2, values0, values1, rx); + values2 = values1; + } else if (ry > 0) { + blurY(n, m2, values0, values1, ry); + blurY(n, m2, values1, values0, ry); + blurY(n, m2, values0, values1, ry); + values2 = values1; + } + const s2 = counts ? Math.pow(2, -2 * k) : 1 / sum$1(values2); + for (let i = 0, sz2 = n * m2; i < sz2; ++i) values2[i] *= s2; + return { + values: values2, + scale: 1 << k, + width: n, + height: m2, + x1: ox, + y1: oy, + x2: ox + (dx >> k), + y2: oy + (dy >> k) + }; + } + density2.x = function(_) { + return arguments.length ? (x2 = number$2(_), density2) : x2; + }; + density2.y = function(_) { + return arguments.length ? (y2 = number$2(_), density2) : y2; + }; + density2.weight = function(_) { + return arguments.length ? (weight = number$2(_), density2) : weight; + }; + density2.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = +_[0], _1 = +_[1]; + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, density2; + }; + density2.cellSize = function(_) { + if (!arguments.length) return 1 << k; + if (!((_ = +_) >= 1)) error("invalid cell size"); + k = Math.floor(Math.log(_) / Math.LN2); + return density2; + }; + density2.bandwidth = function(_) { + if (!arguments.length) return bandwidth2; + _ = array$4(_); + if (_.length === 1) _ = [+_[0], +_[0]]; + if (_.length !== 2) error("invalid bandwidth"); + return bandwidth2 = _, density2; + }; + return density2; + } + function blurX(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let j = 0; j < m2; ++j) { + for (let i = 0, sr = 0; i < n + r; ++i) { + if (i < n) { + sr += source2[i + j * n]; + } if (i >= r) { - if (i >= w) sr -= source[i - w + j * n]; - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); + if (i >= w2) { + sr -= source2[i - w2 + j * n]; + } + target2[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w2 - i, w2); } + } } -} -function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let i = 0; i < n; ++i)for(let j = 0, sr = 0; j < m + r; ++j){ - if (j < m) sr += source[i + j * n]; + } + function blurY(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let i = 0; i < n; ++i) { + for (let j = 0, sr = 0; j < m2 + r; ++j) { + if (j < m2) { + sr += source2[i + j * n]; + } if (j >= r) { - if (j >= w) sr -= source[i + (j - w) * n]; - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } -} -/** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array<number>} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ function KDE2D(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'grid' + if (j >= w2) { + sr -= source2[i + (j - w2) * n]; + } + target2[i + (j - r) * n] = sr / Math.min(j + 1, m2 - 1 + w2 - j, w2); } - ] -}; -const PARAMS = [ - 'x', - 'y', - 'weight', - 'size', - 'cellSize', - 'bandwidth' -]; -function params(obj, _) { - PARAMS.forEach((param)=>_[param] != null ? obj[param](_[param]) : 0); - return obj; -} -(0, _vegaUtil.inherits)(KDE2D, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), kde = params(density2D(), _), as = _.as || 'grid', values = []; - function set(t, vals) { - for(let i = 0; i < names.length; ++i)t[names[i]] = vals[i]; - return t; - } - // generate density raster grids - values = groups.map((g)=>(0, _vegaDataflow.ingest)(set({ - [as]: kde(g, _.counts) - }, g.dims))); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; + } + } + } + function KDE2D(params2) { + Transform.call(this, null, params2); + } + KDE2D.Definition = { + "type": "KDE2D", + "metadata": { + "generates": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "weight", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": "grid" + }] + }; + const PARAMS = ["x", "y", "weight", "size", "cellSize", "bandwidth"]; + function params(obj2, _) { + PARAMS.forEach((param2) => _[param2] != null ? obj2[param2](_[param2]) : 0); + return obj2; + } + inherits(KDE2D, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) return pulse2.StopPropagation; + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$2(source2, _.groupby), names = (_.groupby || []).map(accessorName), kde2 = params(density2D(), _), as = _.as || "grid", values2 = []; + function set2(t, vals) { + for (let i = 0; i < names.length; ++i) t[names[i]] = vals[i]; + return t; + } + values2 = groups.map((g) => ingest$1(set2({ + [as]: kde2(g, _.counts) + }, g.dims))); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; } -}); -function partition(data, groupby) { - var groups = [], get = (f)=>f(t), map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; + }); + function partition$2(data2, groupby) { + var groups = [], get2 = (f) => f(t), map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); + map2[k] = g = []; + g.dims = k; + groups.push(g); } g.push(t); + } } return groups; -} -/** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array<number>} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ function Contour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Contour.Definition = { - 'type': 'Contour', - 'metadata': { - 'generates': true + } + function Contour(params2) { + Transform.call(this, null, params2); + } + Contour.Definition = { + "type": "Contour", + "metadata": { + "generates": true }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'values', - 'type': 'number', - 'array': true - }, - { - 'name': 'x', - 'type': 'field' - }, - { - 'name': 'y', - 'type': 'field' - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number' - }, - { - 'name': 'count', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - } - ] -}; -(0, _vegaUtil.inherits)(Contour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values), size = _.size, grid, post; - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [ - grid.width, - grid.height - ]; - values = grid.values; - } - thresh = (0, _vegaUtil.isArray)(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map((0, _vegaDataflow.ingest)); - return out; + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "values", + "type": "number", + "array": true + }, { + "name": "x", + "type": "field" + }, { + "name": "y", + "type": "field" + }, { + "name": "weight", + "type": "field" + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number" + }, { + "name": "count", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }] + }; + inherits(Contour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values2 = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values2), size = _.size, grid2, post; + if (!values2) { + values2 = pulse2.materialize(pulse2.SOURCE).source; + grid2 = params(density2D(), _)(values2, true); + post = transform$1(grid2, grid2.scale || 1, grid2.scale || 1, 0, 0); + size = [grid2.width, grid2.height]; + values2 = grid2.values; + } + thresh = isArray(thresh) ? thresh : thresh(values2); + values2 = contour.size(size)(values2, thresh); + if (post) values2.forEach(post); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = (values2 || []).map(ingest$1); + return out; } -}); -const Feature = 'Feature'; -const FeatureCollection = 'FeatureCollection'; -const MultiPoint = 'MultiPoint'; -/** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ function GeoJSON(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'length': 2 - }, - { - 'name': 'geojson', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(GeoJSON, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var features = this._features, points = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && (0, _vegaUtil.identity), flag = pulse.ADD, mod; - mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(geojson)) || lon && pulse.modified((0, _vegaUtil.accessorFields)(lon)) || lat && pulse.modified((0, _vegaUtil.accessorFields)(lat)); - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = features = []; - this._points = points = []; - } - if (geojson) pulse.visit(flag, (t)=>features.push(geojson(t))); - if (lon && lat) { - pulse.visit(flag, (t)=>{ - var x = lon(t), y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) points.push([ - x, - y - ]); - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - this.value = { - type: FeatureCollection, - features: features - }; + }); + const Feature = "Feature"; + const FeatureCollection = "FeatureCollection"; + const MultiPoint = "MultiPoint"; + function GeoJSON(params2) { + Transform.call(this, null, params2); + } + GeoJSON.Definition = { + "type": "GeoJSON", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "length": 2 + }, { + "name": "geojson", + "type": "field" + }] + }; + inherits(GeoJSON, Transform, { + transform(_, pulse2) { + var features = this._features, points2 = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && identity$2, flag2 = pulse2.ADD, mod; + mod = _.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(geojson)) || lon && pulse2.modified(accessorFields(lon)) || lat && pulse2.modified(accessorFields(lat)); + if (!this.value || mod) { + flag2 = pulse2.SOURCE; + this._features = features = []; + this._points = points2 = []; + } + if (geojson) { + pulse2.visit(flag2, (t) => features.push(geojson(t))); + } + if (lon && lat) { + pulse2.visit(flag2, (t) => { + var x2 = lon(t), y2 = lat(t); + if (x2 != null && y2 != null && (x2 = +x2) === x2 && (y2 = +y2) === y2) { + points2.push([x2, y2]); + } + }); + features = features.concat({ + type: Feature, + geometry: { + type: MultiPoint, + coordinates: points2 + } + }); + } + this.value = { + type: FeatureCollection, + features + }; } -}); -/** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ function GeoPath(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(GeoPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), path = this.value, field = _.field || (0, _vegaUtil.identity), as = _.as || 'path', flag = out.SOURCE; - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = (0, _vegaProjection.getProjectionPath)(_.projection); - out.materialize().reflow(); - } else flag = field === (0, _vegaUtil.identity) || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD; - const prev = initPath(path, _.pointRadius); - out.visit(flag, (t)=>t[as] = path(field(t))); - path.pointRadius(prev); - return out.modifies(as); - } -}); -function initPath(path, pointRadius) { - const prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) path.pointRadius(pointRadius); - return prev; -} -/** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array<function(object): *>} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array<string>} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ function GeoPoint(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': { - 'modifies': true + }); + function GeoPath(params2) { + Transform.call(this, null, params2); + } + GeoPath.Definition = { + "type": "GeoPath", + "metadata": { + "modifies": true }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection', - 'required': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'x', - 'y' - ] - } - ] -}; -(0, _vegaUtil.inherits)(GeoPoint, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || [ - 'x', - 'y' - ], x = as[0], y = as[1], mod; - function set(t) { - const xy = proj([ - lon(t), - lat(t) - ]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - if (_.modified()) // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - return pulse.modifies(as); - } -}); -/** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ function GeoShape(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': { - 'modifies': true, - 'nomod': true + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(GeoPath, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), path2 = this.value, field2 = _.field || identity$2, as = _.as || "path", flag2 = out.SOURCE; + if (!path2 || _.modified()) { + this.value = path2 = getProjectionPath(_.projection); + out.materialize().reflow(); + } else { + flag2 = field2 === identity$2 || pulse2.modified(field2.fields) ? out.ADD_MOD : out.ADD; + } + const prev = initPath(path2, _.pointRadius); + out.visit(flag2, (t) => t[as] = path2(field2(t))); + path2.pointRadius(prev); + return out.modifies(as); + } + }); + function initPath(path2, pointRadius) { + const prev = path2.pointRadius(); + path2.context(null); + if (pointRadius != null) { + path2.pointRadius(pointRadius); + } + return prev; + } + function GeoPoint(params2) { + Transform.call(this, null, params2); + } + GeoPoint.Definition = { + "type": "GeoPoint", + "metadata": { + "modifies": true }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field', - 'default': 'datum' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'shape' + "params": [{ + "name": "projection", + "type": "projection", + "required": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["x", "y"] + }] + }; + inherits(GeoPoint, Transform, { + transform(_, pulse2) { + var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || ["x", "y"], x2 = as[0], y2 = as[1], mod; + function set2(t) { + const xy = proj([lon(t), lat(t)]); + if (xy) { + t[x2] = xy[0]; + t[y2] = xy[1]; + } else { + t[x2] = void 0; + t[y2] = void 0; } - ] -}; -(0, _vegaUtil.inherits)(GeoShape, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), shape = this.value, as = _.as || 'shape', flag = out.ADD; - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator((0, _vegaProjection.getProjectionPath)(_.projection), _.field || (0, _vegaUtil.field)('datum'), _.pointRadius); - out.materialize().reflow(); - flag = out.SOURCE; - } - out.visit(flag, (t)=>t[as] = shape); - return out.modifies(as); - } -}); -function shapeGenerator(path, field, pointRadius) { - const shape = pointRadius == null ? (_)=>path(field(_)) : (_)=>{ - var prev = path.pointRadius(), value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = (_)=>{ - path.context(_); - return shape; - }; - return shape; -} -/** - * GeoJSON feature generator for creating graticules. - * @constructor - */ function Graticule(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.generator = (0, _d3Geo.geoGraticule)(); -} -Graticule.Definition = { - 'type': 'Graticule', - 'metadata': { - 'changes': true, - 'generates': true + } + if (_.modified()) { + pulse2 = pulse2.materialize().reflow(true).visit(pulse2.SOURCE, set2); + } else { + mod = pulse2.modified(lon.fields) || pulse2.modified(lat.fields); + pulse2.visit(mod ? pulse2.ADD_MOD : pulse2.ADD, set2); + } + return pulse2.modifies(as); + } + }); + function GeoShape(params2) { + Transform.call(this, null, params2); + } + GeoShape.Definition = { + "type": "GeoShape", + "metadata": { + "modifies": true, + "nomod": true }, - 'params': [ - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMajor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMinor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'step', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'stepMajor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 90, - 360 - ] - }, - { - 'name': 'stepMinor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 10, - 10 - ] - }, - { - 'name': 'precision', - 'type': 'number', - 'default': 2.5 - } - ] -}; -(0, _vegaUtil.inherits)(Graticule, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var src = this.value, gen = this.generator, t; - if (!src.length || _.modified()) { - for(const prop in _)if ((0, _vegaUtil.isFunction)(gen[prop])) gen[prop](_[prop]); - } - t = gen(); - if (src.length) pulse.mod.push((0, _vegaDataflow.replace)(src[0], t)); - else pulse.add.push((0, _vegaDataflow.ingest)(t)); - src[0] = t; - return pulse; - } -}); -/** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ function Heatmap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': { - 'modifies': true + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field", + "default": "datum" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "shape" + }] + }; + inherits(GeoShape, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), shape2 = this.value, as = _.as || "shape", flag2 = out.ADD; + if (!shape2 || _.modified()) { + this.value = shape2 = shapeGenerator(getProjectionPath(_.projection), _.field || field$1("datum"), _.pointRadius); + out.materialize().reflow(); + flag2 = out.SOURCE; + } + out.visit(flag2, (t) => t[as] = shape2); + return out.modifies(as); + } + }); + function shapeGenerator(path2, field2, pointRadius) { + const shape2 = pointRadius == null ? (_) => path2(field2(_)) : (_) => { + var prev = path2.pointRadius(), value2 = path2.pointRadius(pointRadius)(field2(_)); + path2.pointRadius(prev); + return value2; + }; + shape2.context = (_) => { + path2.context(_); + return shape2; + }; + return shape2; + } + function Graticule(params2) { + Transform.call(this, [], params2); + this.generator = graticule(); + } + Graticule.Definition = { + "type": "Graticule", + "metadata": { + "changes": true, + "generates": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'color', - 'type': 'string', - 'expr': true - }, - { - 'name': 'opacity', - 'type': 'number', - 'expr': true - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'image' + "params": [{ + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMajor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMinor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "step", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "stepMajor", + "type": "number", + "array": true, + "length": 2, + "default": [90, 360] + }, { + "name": "stepMinor", + "type": "number", + "array": true, + "length": 2, + "default": [10, 10] + }, { + "name": "precision", + "type": "number", + "default": 2.5 + }] + }; + inherits(Graticule, Transform, { + transform(_, pulse2) { + var src = this.value, gen = this.generator, t; + if (!src.length || _.modified()) { + for (const prop in _) { + if (isFunction(gen[prop])) { + gen[prop](_[prop]); + } } - ] -}; -(0, _vegaUtil.inherits)(Heatmap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.changed() && !_.modified()) return pulse.StopPropagation; - var source = pulse.materialize(pulse.SOURCE).source, shared = _.resolve === 'shared', field = _.field || (0, _vegaUtil.identity), opacity = opacity_(_.opacity, _), color = color_(_.color, _), as = _.as || 'image', obj = { - $x: 0, - $y: 0, - $value: 0, - $max: shared ? (0, _d3Array.max)(source.map((t)=>(0, _d3Array.max)(field(t).values))) : 0 - }; - source.forEach((t)=>{ - const v = field(t); - // build proxy data object - const o = (0, _vegaUtil.extend)({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = (0, _d3Array.max)(v.values || []); - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, color.dep ? color : (0, _vegaUtil.constant)(color(o)), opacity.dep ? opacity : (0, _vegaUtil.constant)(opacity(o))); - }); - return pulse.reflow(true).modifies(as); + } + t = gen(); + if (src.length) { + pulse2.mod.push(replace$1(src[0], t)); + } else { + pulse2.add.push(ingest$1(t)); + } + src[0] = t; + return pulse2; + } + }); + function Heatmap(params2) { + Transform.call(this, null, params2); + } + Heatmap.Definition = { + "type": "heatmap", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "color", + "type": "string", + "expr": true + }, { + "name": "opacity", + "type": "number", + "expr": true + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "as", + "type": "string", + "default": "image" + }] + }; + inherits(Heatmap, Transform, { + transform(_, pulse2) { + if (!pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var source2 = pulse2.materialize(pulse2.SOURCE).source, shared = _.resolve === "shared", field2 = _.field || identity$2, opacity2 = opacity_(_.opacity, _), color2 = color_(_.color, _), as = _.as || "image", obj2 = { + $x: 0, + $y: 0, + $value: 0, + $max: shared ? max$2(source2.map((t) => max$2(field2(t).values))) : 0 + }; + source2.forEach((t) => { + const v = field2(t); + const o = extend({}, t, obj2); + if (!shared) o.$max = max$2(v.values || []); + t[as] = toCanvas(v, o, color2.dep ? color2 : constant$4(color2(o)), opacity2.dep ? opacity2 : constant$4(opacity2(o))); + }); + return pulse2.reflow(true).modifies(as); } -}); -// get image color function -function color_(color, _) { + }); + function color_(color2, _) { let f; - if ((0, _vegaUtil.isFunction)(color)) { - f = (obj)=>(0, _d3Color.rgb)(color(obj, _)); - f.dep = dependency(color); - } else // default to mid-grey - f = (0, _vegaUtil.constant)((0, _d3Color.rgb)(color || '#888')); + if (isFunction(color2)) { + f = (obj2) => rgb$1(color2(obj2, _)); + f.dep = dependency(color2); + } else { + f = constant$4(rgb$1(color2 || "#888")); + } return f; -} -// get image opacity function -function opacity_(opacity, _) { + } + function opacity_(opacity2, _) { let f; - if ((0, _vegaUtil.isFunction)(opacity)) { - f = (obj)=>opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) f = (0, _vegaUtil.constant)(opacity); - else { - // default to [0, max] opacity gradient - f = (obj)=>obj.$value / obj.$max || 0; - f.dep = true; + if (isFunction(opacity2)) { + f = (obj2) => opacity2(obj2, _); + f.dep = dependency(opacity2); + } else if (opacity2) { + f = constant$4(opacity2); + } else { + f = (obj2) => obj2.$value / obj2.$max || 0; + f.dep = true; } return f; -} -// check if function depends on individual pixel data -function dependency(f) { - if (!(0, _vegaUtil.isFunction)(f)) return false; - const set = (0, _vegaUtil.toSet)((0, _vegaUtil.accessorFields)(f)); - return set.$x || set.$y || set.$value || set.$max; -} -// render raster grid to canvas -function toCanvas(grid, obj, color, opacity) { - const n = grid.width, m = grid.height, x1 = grid.x1 || 0, y1 = grid.y1 || 0, x2 = grid.x2 || n, y2 = grid.y2 || m, val = grid.values, value = val ? (i)=>val[i] : (0, _vegaUtil.zero), can = (0, _vegaCanvas.canvas)(x2 - x1, y2 - y1), ctx = can.getContext('2d'), img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), pix = img.data; - for(let j = y1, k = 0; j < y2; ++j){ - obj.$y = j - y1; - for(let i = x1, r = j * n; i < x2; ++i, k += 4){ - obj.$x = i - x1; - obj.$value = value(i + r); - const v = color(obj); - pix[k + 0] = v.r; - pix[k + 1] = v.g; - pix[k + 2] = v.b; - pix[k + 3] = ~~(255 * opacity(obj)); - } + } + function dependency(f) { + if (!isFunction(f)) return false; + const set2 = toSet(accessorFields(f)); + return set2.$x || set2.$y || set2.$value || set2.$max; + } + function toCanvas(grid2, obj2, color2, opacity2) { + const n = grid2.width, m2 = grid2.height, x12 = grid2.x1 || 0, y12 = grid2.y1 || 0, x2 = grid2.x2 || n, y2 = grid2.y2 || m2, val = grid2.values, value2 = val ? (i) => val[i] : zero$1, can = domCanvas(x2 - x12, y2 - y12), ctx = can.getContext("2d"), img = ctx.getImageData(0, 0, x2 - x12, y2 - y12), pix = img.data; + for (let j = y12, k = 0; j < y2; ++j) { + obj2.$y = j - y12; + for (let i = x12, r = j * n; i < x2; ++i, k += 4) { + obj2.$x = i - x12; + obj2.$value = value2(i + r); + const v = color2(obj2); + pix[k + 0] = v.r; + pix[k + 1] = v.g; + pix[k + 2] = v.b; + pix[k + 3] = ~~(255 * opacity2(obj2)); + } } ctx.putImageData(img, 0, 0); return can; -} -/** - * Maintains a cartographic projection. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Projection(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Projection, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let proj = this.value; - if (!proj || _.modified('type')) { - this.value = proj = create(_.type); - (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_[prop] != null) set(proj, prop, _[prop]); - }); - } else (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_.modified(prop)) set(proj, prop, _[prop]); + } + function Projection$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Projection$1, Transform, { + transform(_, pulse2) { + let proj = this.value; + if (!proj || _.modified("type")) { + this.value = proj = create(_.type); + projectionProperties.forEach((prop) => { + if (_[prop] != null) set$1(proj, prop, _[prop]); }); - if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); - if (_.fit) fit(proj, _); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function fit(proj, _) { - const data = collectGeoJSON(_.fit); - _.extent ? proj.fitExtent(_.extent, data) : _.size && proj.fitSize(_.size, data); -} -function create(type) { - const constructor = (0, _vegaProjection.projection)((type || 'mercator').toLowerCase()); - if (!constructor) (0, _vegaUtil.error)('Unrecognized projection type: ' + type); - return constructor(); -} -function set(proj, key, value) { - if ((0, _vegaUtil.isFunction)(proj[key])) proj[key](value); -} -function collectGeoJSON(data) { - data = (0, _vegaUtil.array)(data); - return data.length === 1 ? data[0] : { - type: FeatureCollection, - features: data.reduce((a, f)=>a.concat(featurize(f)), []) - }; -} -function featurize(f) { - return f.type === FeatureCollection ? f.features : (0, _vegaUtil.array)(f).filter((d)=>d != null).map((d)=>d.type === Feature ? d : { - type: Feature, - geometry: d + } else { + projectionProperties.forEach((prop) => { + if (_.modified(prop)) set$1(proj, prop, _[prop]); }); -} - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-array":"5lCYW","vega-statistics":"4QSQj","vega-projection":"erWDs","d3-geo":"8qTbc","d3-color":"37LNF","vega-canvas":"4O1hR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erWDs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getProjectionPath", ()=>getProjectionPath); -parcelHelpers.export(exports, "projection", ()=>projection); -parcelHelpers.export(exports, "projectionProperties", ()=>projectionProperties); -var _d3Geo = require("d3-geo"); -var _d3GeoProjection = require("d3-geo-projection"); -var _vegaScale = require("vega-scale"); -const defaultPath = (0, _d3Geo.geoPath)(); -const projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; -/** - * Augment projections with their type and a copy method. - */ function create(type, constructor) { - return function projection() { - const p = constructor(); - p.type = type; - p.path = (0, _d3Geo.geoPath)().projection(p); - p.copy = p.copy || function() { - const c = projection(); - projectionProperties.forEach((prop)=>{ - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - return (0, _vegaScale.registerScale)(p); - }; -} -function projection(type, proj) { - if (!type || typeof type !== 'string') throw new Error('Projection type must be a name string.'); - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create(type, proj); - return this; - } else return projections[type] || null; -} -function getProjectionPath(proj) { - return proj && proj.path || defaultPath; -} -const projections = { - // base d3-geo projection types - albers: (0, _d3Geo.geoAlbers), - albersusa: (0, _d3Geo.geoAlbersUsa), - azimuthalequalarea: (0, _d3Geo.geoAzimuthalEqualArea), - azimuthalequidistant: (0, _d3Geo.geoAzimuthalEquidistant), - conicconformal: (0, _d3Geo.geoConicConformal), - conicequalarea: (0, _d3Geo.geoConicEqualArea), - conicequidistant: (0, _d3Geo.geoConicEquidistant), - equalEarth: (0, _d3Geo.geoEqualEarth), - equirectangular: (0, _d3Geo.geoEquirectangular), - gnomonic: (0, _d3Geo.geoGnomonic), - identity: (0, _d3Geo.geoIdentity), - mercator: (0, _d3Geo.geoMercator), - mollweide: (0, _d3GeoProjection.geoMollweide), - naturalEarth1: (0, _d3Geo.geoNaturalEarth1), - orthographic: (0, _d3Geo.geoOrthographic), - stereographic: (0, _d3Geo.geoStereographic), - transversemercator: (0, _d3Geo.geoTransverseMercator) -}; -for(const key in projections)projection(key, projections[key]); - -},{"d3-geo":"8qTbc","d3-geo-projection":"fqIqT","vega-scale":"gHN3E","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8qTbc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoArea", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "geoBounds", ()=>(0, _boundsJsDefault.default)); -parcelHelpers.export(exports, "geoCentroid", ()=>(0, _centroidJsDefault.default)); -parcelHelpers.export(exports, "geoCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "geoClipAntimeridian", ()=>(0, _antimeridianJsDefault.default)); -parcelHelpers.export(exports, "geoClipCircle", ()=>(0, _circleJsDefault1.default)); -parcelHelpers.export(exports, "geoClipExtent", ()=>(0, _extentJsDefault.default)) // DEPRECATED! Use d3.geoIdentity().clipExtent(…). -; -parcelHelpers.export(exports, "geoClipRectangle", ()=>(0, _rectangleJsDefault.default)); -parcelHelpers.export(exports, "geoContains", ()=>(0, _containsJsDefault.default)); -parcelHelpers.export(exports, "geoDistance", ()=>(0, _distanceJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule", ()=>(0, _graticuleJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule10", ()=>(0, _graticuleJs.graticule10)); -parcelHelpers.export(exports, "geoInterpolate", ()=>(0, _interpolateJsDefault.default)); -parcelHelpers.export(exports, "geoLength", ()=>(0, _lengthJsDefault.default)); -parcelHelpers.export(exports, "geoPath", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoAlbers", ()=>(0, _albersJsDefault.default)); -parcelHelpers.export(exports, "geoAlbersUsa", ()=>(0, _albersUsaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualArea", ()=>(0, _azimuthalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualAreaRaw", ()=>(0, _azimuthalEqualAreaJs.azimuthalEqualAreaRaw)); -parcelHelpers.export(exports, "geoAzimuthalEquidistant", ()=>(0, _azimuthalEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEquidistantRaw", ()=>(0, _azimuthalEquidistantJs.azimuthalEquidistantRaw)); -parcelHelpers.export(exports, "geoConicConformal", ()=>(0, _conicConformalJsDefault.default)); -parcelHelpers.export(exports, "geoConicConformalRaw", ()=>(0, _conicConformalJs.conicConformalRaw)); -parcelHelpers.export(exports, "geoConicEqualArea", ()=>(0, _conicEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoConicEqualAreaRaw", ()=>(0, _conicEqualAreaJs.conicEqualAreaRaw)); -parcelHelpers.export(exports, "geoConicEquidistant", ()=>(0, _conicEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoConicEquidistantRaw", ()=>(0, _conicEquidistantJs.conicEquidistantRaw)); -parcelHelpers.export(exports, "geoEqualEarth", ()=>(0, _equalEarthJsDefault.default)); -parcelHelpers.export(exports, "geoEqualEarthRaw", ()=>(0, _equalEarthJs.equalEarthRaw)); -parcelHelpers.export(exports, "geoEquirectangular", ()=>(0, _equirectangularJsDefault.default)); -parcelHelpers.export(exports, "geoEquirectangularRaw", ()=>(0, _equirectangularJs.equirectangularRaw)); -parcelHelpers.export(exports, "geoGnomonic", ()=>(0, _gnomonicJsDefault.default)); -parcelHelpers.export(exports, "geoGnomonicRaw", ()=>(0, _gnomonicJs.gnomonicRaw)); -parcelHelpers.export(exports, "geoIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "geoProjection", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoProjectionMutator", ()=>(0, _indexJs1.projectionMutator)); -parcelHelpers.export(exports, "geoMercator", ()=>(0, _mercatorJsDefault.default)); -parcelHelpers.export(exports, "geoMercatorRaw", ()=>(0, _mercatorJs.mercatorRaw)); -parcelHelpers.export(exports, "geoNaturalEarth1", ()=>(0, _naturalEarth1JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth1Raw", ()=>(0, _naturalEarth1Js.naturalEarth1Raw)); -parcelHelpers.export(exports, "geoOrthographic", ()=>(0, _orthographicJsDefault.default)); -parcelHelpers.export(exports, "geoOrthographicRaw", ()=>(0, _orthographicJs.orthographicRaw)); -parcelHelpers.export(exports, "geoStereographic", ()=>(0, _stereographicJsDefault.default)); -parcelHelpers.export(exports, "geoStereographicRaw", ()=>(0, _stereographicJs.stereographicRaw)); -parcelHelpers.export(exports, "geoTransverseMercator", ()=>(0, _transverseMercatorJsDefault.default)); -parcelHelpers.export(exports, "geoTransverseMercatorRaw", ()=>(0, _transverseMercatorJs.transverseMercatorRaw)); -parcelHelpers.export(exports, "geoRotation", ()=>(0, _rotationJsDefault.default)); -parcelHelpers.export(exports, "geoStream", ()=>(0, _streamJsDefault.default)); -parcelHelpers.export(exports, "geoTransform", ()=>(0, _transformJsDefault.default)); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _circleJs = require("./circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _antimeridianJs = require("./clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs1 = require("./clip/circle.js"); -var _circleJsDefault1 = parcelHelpers.interopDefault(_circleJs1); -var _extentJs = require("./clip/extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _rectangleJs = require("./clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _containsJs = require("./contains.js"); -var _containsJsDefault = parcelHelpers.interopDefault(_containsJs); -var _distanceJs = require("./distance.js"); -var _distanceJsDefault = parcelHelpers.interopDefault(_distanceJs); -var _graticuleJs = require("./graticule.js"); -var _graticuleJsDefault = parcelHelpers.interopDefault(_graticuleJs); -var _interpolateJs = require("./interpolate.js"); -var _interpolateJsDefault = parcelHelpers.interopDefault(_interpolateJs); -var _lengthJs = require("./length.js"); -var _lengthJsDefault = parcelHelpers.interopDefault(_lengthJs); -var _indexJs = require("./path/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _albersJs = require("./projection/albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _albersUsaJs = require("./projection/albersUsa.js"); -var _albersUsaJsDefault = parcelHelpers.interopDefault(_albersUsaJs); -var _azimuthalEqualAreaJs = require("./projection/azimuthalEqualArea.js"); -var _azimuthalEqualAreaJsDefault = parcelHelpers.interopDefault(_azimuthalEqualAreaJs); -var _azimuthalEquidistantJs = require("./projection/azimuthalEquidistant.js"); -var _azimuthalEquidistantJsDefault = parcelHelpers.interopDefault(_azimuthalEquidistantJs); -var _conicConformalJs = require("./projection/conicConformal.js"); -var _conicConformalJsDefault = parcelHelpers.interopDefault(_conicConformalJs); -var _conicEqualAreaJs = require("./projection/conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _conicEquidistantJs = require("./projection/conicEquidistant.js"); -var _conicEquidistantJsDefault = parcelHelpers.interopDefault(_conicEquidistantJs); -var _equalEarthJs = require("./projection/equalEarth.js"); -var _equalEarthJsDefault = parcelHelpers.interopDefault(_equalEarthJs); -var _equirectangularJs = require("./projection/equirectangular.js"); -var _equirectangularJsDefault = parcelHelpers.interopDefault(_equirectangularJs); -var _gnomonicJs = require("./projection/gnomonic.js"); -var _gnomonicJsDefault = parcelHelpers.interopDefault(_gnomonicJs); -var _identityJs = require("./projection/identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _indexJs1 = require("./projection/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _mercatorJs = require("./projection/mercator.js"); -var _mercatorJsDefault = parcelHelpers.interopDefault(_mercatorJs); -var _naturalEarth1Js = require("./projection/naturalEarth1.js"); -var _naturalEarth1JsDefault = parcelHelpers.interopDefault(_naturalEarth1Js); -var _orthographicJs = require("./projection/orthographic.js"); -var _orthographicJsDefault = parcelHelpers.interopDefault(_orthographicJs); -var _stereographicJs = require("./projection/stereographic.js"); -var _stereographicJsDefault = parcelHelpers.interopDefault(_stereographicJs); -var _transverseMercatorJs = require("./projection/transverseMercator.js"); -var _transverseMercatorJsDefault = parcelHelpers.interopDefault(_transverseMercatorJs); -var _rotationJs = require("./rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./area.js":"3gH4a","./bounds.js":"9hzuk","./centroid.js":"copnD","./circle.js":false,"./clip/antimeridian.js":false,"./clip/circle.js":false,"./clip/extent.js":false,"./clip/rectangle.js":false,"./contains.js":false,"./distance.js":false,"./graticule.js":"24Rpv","./interpolate.js":false,"./length.js":false,"./path/index.js":"aay0S","./projection/albers.js":"lnSxc","./projection/albersUsa.js":"3HuY2","./projection/azimuthalEqualArea.js":"02C8V","./projection/azimuthalEquidistant.js":"7a1uH","./projection/conicConformal.js":"7BV5L","./projection/conicEqualArea.js":"g4p5m","./projection/conicEquidistant.js":"9oUmd","./projection/equalEarth.js":"eILUC","./projection/equirectangular.js":"73t8d","./projection/gnomonic.js":"93udH","./projection/identity.js":"9vqqR","./projection/index.js":"7QH2d","./projection/mercator.js":"a3UOt","./projection/naturalEarth1.js":"erpNS","./projection/orthographic.js":"7NqTM","./projection/stereographic.js":"grd1o","./projection/transverseMercator.js":"93Ws5","./rotation.js":false,"./stream.js":false,"./transform.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3gH4a":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "areaRingSum", ()=>areaRingSum); -parcelHelpers.export(exports, "areaStream", ()=>areaStream); -parcelHelpers.export(exports, "default", ()=>function(object) { - areaSum = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, areaStream); - return areaSum * 2; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var areaRingSum = new (0, _d3Array.Adder)(); -// hello? -var areaSum = new (0, _d3Array.Adder)(), lambda00, phi00, lambda0, cosPhi0, sinPhi0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaRingSum = new (0, _d3Array.Adder)(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? (0, _mathJs.tau) + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = (0, _noopJsDefault.default); - }, - sphere: function() { - areaSum.add((0, _mathJs.tau)); - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaRingEnd() { - areaPoint(lambda00, phi00); -} -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - lambda0 = lambda, cosPhi0 = (0, _mathJs.cos)(phi = phi / 2 + (0, _mathJs.quarterPi)), sinPhi0 = (0, _mathJs.sin)(phi); -} -function areaPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - phi = phi / 2 + (0, _mathJs.quarterPi); // half the angular distance from south pole - // Spherical excess E for a spherical triangle with vertices: south pole, - // previous point, current point. Uses a formula derived from Cagnoli’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = (0, _mathJs.cos)(phi), sinPhi = (0, _mathJs.sin)(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * (0, _mathJs.cos)(adLambda), v = k * sdLambda * (0, _mathJs.sin)(adLambda); - areaRingSum.add((0, _mathJs.atan2)(v, u)); - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} - -},{"d3-array":"5lCYW","./math.js":"kc9MU","./noop.js":"cEfoF","./stream.js":"hPbYn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kc9MU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "hypot", ()=>hypot); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "haversin", ()=>haversin); -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var ceil = Math.ceil; -var exp = Math.exp; -var floor = Math.floor; -var hypot = Math.hypot; -var log = Math.log; -var pow = Math.pow; -var sin = Math.sin; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sqrt = Math.sqrt; -var tan = Math.tan; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function haversin(x) { - return (x = sin(x / 2)) * x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cEfoF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>noop); -function noop() {} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hPbYn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object, stream) { - if (object && streamObjectType.hasOwnProperty(object.type)) streamObjectType[object.type](object, stream); - else streamGeometry(object, stream); - }); -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) streamGeometryType[geometry.type](geometry, stream); -} -var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while(++i < n)streamGeometry(features[i].geometry, stream); - } -}; -var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); - }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)object = coordinates[i], stream.point(object[0], object[1], object[2]); - }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamLine(coordinates[i], stream, 0); - }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamPolygon(coordinates[i], stream); - }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while(++i < n)streamGeometry(geometries[i], stream); - } -}; -function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while(++i < n)coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} -function streamPolygon(coordinates, stream) { - var i = -1, n = coordinates.length; - stream.polygonStart(); - while(++i < n)streamLine(coordinates[i], stream, 1); - stream.polygonEnd(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9hzuk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(feature) { - var i, n, a, b, merged, deltaMax, delta; - phi1 = lambda1 = -(lambda0 = phi0 = Infinity); - ranges = []; - (0, _streamJsDefault.default)(feature, boundsStream); - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - // Then, merge any ranges that overlap. - for(i = 1, a = ranges[0], merged = [ - a - ]; i < n; ++i){ - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; - } else merged.push(a = b); - } - // Finally, find the largest gap between the merged ranges. - // The final bounding box will be the inverse of this gap. - for(deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i){ - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1]; - } - } - ranges = range = null; - return lambda0 === Infinity || phi0 === Infinity ? [ - [ - NaN, - NaN - ], - [ - NaN, - NaN - ] - ] : [ - [ - lambda0, - phi0 - ], - [ - lambda1, - phi1 - ] - ]; - }); -var _d3Array = require("d3-array"); -var _areaJs = require("./area.js"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var lambda0, phi0, lambda1, phi1, lambda2, lambda00, phi00, p0, deltaSum, ranges, range; -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum = new (0, _d3Array.Adder)(); - (0, _areaJs.areaStream).polygonStart(); - }, - polygonEnd: function() { - (0, _areaJs.areaStream).polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if ((0, _areaJs.areaRingSum) < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > (0, _mathJs.epsilon)) phi1 = 90; - else if (deltaSum < -(0, _mathJs.epsilon)) phi0 = -90; - range[0] = lambda0, range[1] = lambda1; - }, - sphere: function() { - lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } -}; -function boundsPoint(lambda, phi) { - ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; -} -function linePoint(lambda, phi) { - var p = (0, _cartesianJs.cartesian)([ - lambda * (0, _mathJs.radians), - phi * (0, _mathJs.radians) - ]); - if (p0) { - var normal = (0, _cartesianJs.cartesianCross)(p0, p), equatorial = [ - normal[1], - -normal[0], - 0 - ], inflection = (0, _cartesianJs.cartesianCross)(equatorial, normal); - (0, _cartesianJs.cartesianNormalizeInPlace)(inflection); - inflection = (0, _cartesianJs.spherical)(inflection); - var delta = lambda - lambda2, sign = delta > 0 ? 1 : -1, lambdai = inflection[0] * (0, _mathJs.degrees) * sign, phii, antimeridian = (0, _mathJs.abs)(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * (0, _mathJs.degrees); - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * (0, _mathJs.degrees); - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } else if (lambda1 >= lambda0) { - if (lambda < lambda0) lambda0 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } - } else ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; -} -function boundsLineStart() { - boundsStream.point = linePoint; -} -function boundsLineEnd() { - range[0] = lambda0, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add((0, _mathJs.abs)(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else lambda00 = lambda, phi00 = phi; - (0, _areaJs.areaStream).point(lambda, phi); - linePoint(lambda, phi); -} -function boundsRingStart() { - (0, _areaJs.areaStream).lineStart(); -} -function boundsRingEnd() { - boundsRingPoint(lambda00, phi00); - (0, _areaJs.areaStream).lineEnd(); - if ((0, _mathJs.abs)(deltaSum) > (0, _mathJs.epsilon)) lambda0 = -(lambda1 = 180); - range[0] = lambda0, range[1] = lambda1; - p0 = null; -} -// Finds the left-right distance between two longitudes. -// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want -// the distance between ±180° to be 360°. -function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; -} -function rangeCompare(a, b) { - return a[0] - b[0]; -} -function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; -} - -},{"d3-array":"5lCYW","./area.js":"3gH4a","./cartesian.js":"9WnrC","./math.js":"kc9MU","./stream.js":"hPbYn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9WnrC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "spherical", ()=>spherical); -parcelHelpers.export(exports, "cartesian", ()=>cartesian); -parcelHelpers.export(exports, "cartesianDot", ()=>cartesianDot); -parcelHelpers.export(exports, "cartesianCross", ()=>cartesianCross); -// TODO return a -parcelHelpers.export(exports, "cartesianAddInPlace", ()=>cartesianAddInPlace); -parcelHelpers.export(exports, "cartesianScale", ()=>cartesianScale); -// TODO return d -parcelHelpers.export(exports, "cartesianNormalizeInPlace", ()=>cartesianNormalizeInPlace); -var _mathJs = require("./math.js"); -function spherical(cartesian) { - return [ - (0, _mathJs.atan2)(cartesian[1], cartesian[0]), - (0, _mathJs.asin)(cartesian[2]) - ]; -} -function cartesian(spherical) { - var lambda = spherical[0], phi = spherical[1], cosPhi = (0, _mathJs.cos)(phi); - return [ - cosPhi * (0, _mathJs.cos)(lambda), - cosPhi * (0, _mathJs.sin)(lambda), - (0, _mathJs.sin)(phi) - ]; -} -function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cartesianCross(a, b) { - return [ - a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0] - ]; -} -function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; -} -function cartesianScale(vector, k) { - return [ - vector[0] * k, - vector[1] * k, - vector[2] * k - ]; -} -function cartesianNormalizeInPlace(d) { - var l = (0, _mathJs.sqrt)(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} - -},{"./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"copnD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object) { - W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0; - X2 = new (0, _d3Array.Adder)(); - Y2 = new (0, _d3Array.Adder)(); - Z2 = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, centroidStream); - var x = +X2, y = +Y2, z = +Z2, m = (0, _mathJs.hypot)(x, y, z); - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < (0, _mathJs.epsilon2)) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < (0, _mathJs.epsilon)) x = X0, y = Y0, z = Z0; - m = (0, _mathJs.hypot)(x, y, z); - // If the feature still has an undefined ccentroid, then return. - if (m < (0, _mathJs.epsilon2)) return [ - NaN, - NaN - ]; - } - return [ - (0, _mathJs.atan2)(y, x) * (0, _mathJs.degrees), - (0, _mathJs.asin)(z / m) * (0, _mathJs.degrees) - ]; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00, phi00, x0, y0, z0; // previous point -var centroidStream = { - sphere: (0, _noopJsDefault.default), - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; -// Arithmetic mean of Cartesian vectors. -function centroidPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - centroidPointCartesian(cosPhi * (0, _mathJs.cos)(lambda), cosPhi * (0, _mathJs.sin)(lambda), (0, _mathJs.sin)(phi)); -} -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} -function centroidLinePointFirst(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} -function centroidLinePoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), w = (0, _mathJs.atan2)((0, _mathJs.sqrt)((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, -// J. Applied Mechanics 42, 239 (1975). -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} -function centroidRingEnd() { - centroidRingPoint(lambda00, phi00); - centroidStream.point = centroidPoint; -} -function centroidRingPointFirst(lambda, phi) { - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - centroidStream.point = centroidRingPoint; - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidPointCartesian(x0, y0, z0); -} -function centroidRingPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = (0, _mathJs.hypot)(cx, cy, cz), w = (0, _mathJs.asin)(m), v = m && -w / m; // area weight multiplier - X2.add(v * cx); - Y2.add(v * cy); - Z2.add(v * cz); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -},{"d3-array":"5lCYW","./math.js":"kc9MU","./noop.js":"cEfoF","./stream.js":"hPbYn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"JRkjq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Generates a circle centered at [0°, 0°], with a given radius and precision. -parcelHelpers.export(exports, "circleStream", ()=>circleStream); -parcelHelpers.export(exports, "default", ()=>function() { - var center = (0, _constantJsDefault.default)([ - 0, - 0 - ]), radius = (0, _constantJsDefault.default)(90), precision = (0, _constantJsDefault.default)(2), ring, rotate, stream = { - point: point - }; - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= (0, _mathJs.degrees), x[1] *= (0, _mathJs.degrees); - } - function circle() { - var c = center.apply(this, arguments), r = radius.apply(this, arguments) * (0, _mathJs.radians), p = precision.apply(this, arguments) * (0, _mathJs.radians); - ring = []; - rotate = (0, _rotationJs.rotateRadians)(-c[0] * (0, _mathJs.radians), -c[1] * (0, _mathJs.radians), 0).invert; - circleStream(stream, r, p, 1); - c = { - type: "Polygon", - coordinates: [ - ring - ] - }; - ring = rotate = null; - return c; - } - circle.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - +_[0], - +_[1] - ]), circle) : center; - }; - circle.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : radius; - }; - circle.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : precision; - }; - return circle; - }); -var _cartesianJs = require("./cartesian.js"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _rotationJs = require("./rotation.js"); -function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = (0, _mathJs.cos)(radius), sinRadius = (0, _mathJs.sin)(radius), step = direction * delta; - if (t0 == null) { - t0 = radius + direction * (0, _mathJs.tau); - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * (0, _mathJs.tau); - } - for(var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step){ - point = (0, _cartesianJs.spherical)([ - cosRadius, - -sinRadius * (0, _mathJs.cos)(t), - -sinRadius * (0, _mathJs.sin)(t) - ]); - stream.point(point[0], point[1]); - } -} -// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. -function circleRadius(cosRadius, point) { - point = (0, _cartesianJs.cartesian)(point), point[0] -= cosRadius; - (0, _cartesianJs.cartesianNormalizeInPlace)(point); - var radius = (0, _mathJs.acos)(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + (0, _mathJs.tau) - (0, _mathJs.epsilon)) % (0, _mathJs.tau); -} - -},{"./cartesian.js":"9WnrC","./constant.js":"5lnun","./math.js":"kc9MU","./rotation.js":"7JtV8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5lnun":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7JtV8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rotateRadians", ()=>rotateRadians); -parcelHelpers.export(exports, "default", ()=>function(rotate) { - rotate = rotateRadians(rotate[0] * (0, _mathJs.radians), rotate[1] * (0, _mathJs.radians), rotate.length > 2 ? rotate[2] * (0, _mathJs.radians) : 0); - function forward(coordinates) { - coordinates = rotate(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - } - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - }; - return forward; - }); -var _composeJs = require("./compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _mathJs = require("./math.js"); -function rotationIdentity(lambda, phi) { - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; -} -rotationIdentity.invert = rotationIdentity; -function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= (0, _mathJs.tau)) ? deltaPhi || deltaGamma ? (0, _composeJsDefault.default)(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; -} -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - lambda += deltaLambda; - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; - }; -} -function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; -} -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = (0, _mathJs.cos)(deltaPhi), sinDeltaPhi = (0, _mathJs.sin)(deltaPhi), cosDeltaGamma = (0, _mathJs.cos)(deltaGamma), sinDeltaGamma = (0, _mathJs.sin)(deltaGamma); - function rotation(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaGamma + y * sinDeltaGamma) - ]; + } + if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); + if (_.fit) fit(proj, _); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - rotation.invert = function(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - return rotation; -} - -},{"./compose.js":"P6ZIv","./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"P6ZIv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6JM2n":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -exports.default = (0, _indexJsDefault.default)(function() { - return true; -}, clipAntimeridianLine, clipAntimeridianInterpolate, [ - -(0, _mathJs.pi), - -(0, _mathJs.halfPi) -]); -// Takes a line and cuts into visible segments. Return values: 0 - there were -// intersections or the line was empty; 1 - no intersections; 2 - there were -// intersections, and the first and last segments should be rejoined. -function clipAntimeridianLine(stream) { - var lambda0 = NaN, phi0 = NaN, sign0 = NaN, clean; // no intersections - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi), delta = (0, _mathJs.abs)(lambda1 - lambda0); - if ((0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon)) { - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? (0, _mathJs.halfPi) : -(0, _mathJs.halfPi)); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= (0, _mathJs.pi)) { - if ((0, _mathJs.abs)(lambda0 - sign0) < (0, _mathJs.epsilon)) lambda0 -= sign0 * (0, _mathJs.epsilon); // handle degeneracies - if ((0, _mathJs.abs)(lambda1 - sign1) < (0, _mathJs.epsilon)) lambda1 -= sign1 * (0, _mathJs.epsilon); - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; -} -function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, cosPhi1, sinLambda0Lambda1 = (0, _mathJs.sin)(lambda0 - lambda1); - return (0, _mathJs.abs)(sinLambda0Lambda1) > (0, _mathJs.epsilon) ? (0, _mathJs.atan)(((0, _mathJs.sin)(phi0) * (cosPhi1 = (0, _mathJs.cos)(phi1)) * (0, _mathJs.sin)(lambda1) - (0, _mathJs.sin)(phi1) * (cosPhi0 = (0, _mathJs.cos)(phi0)) * (0, _mathJs.sin)(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2; -} -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * (0, _mathJs.halfPi); - stream.point(-(0, _mathJs.pi), phi); - stream.point(0, phi); - stream.point((0, _mathJs.pi), phi); - stream.point((0, _mathJs.pi), 0); - stream.point((0, _mathJs.pi), -phi); - stream.point(0, -phi); - stream.point(-(0, _mathJs.pi), -phi); - stream.point(-(0, _mathJs.pi), 0); - stream.point(-(0, _mathJs.pi), phi); - } else if ((0, _mathJs.abs)(from[0] - to[0]) > (0, _mathJs.epsilon)) { - var lambda = from[0] < to[0] ? (0, _mathJs.pi) : -(0, _mathJs.pi); - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else stream.point(to[0], to[1]); -} - -},{"./index.js":"6CuX6","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6CuX6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(pointVisible, clipLine, interpolate, start) { - return function(sink) { - var line = clipLine(sink), ringBuffer = (0, _bufferJsDefault.default)(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon, segments, ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = (0, _d3Array.merge)(segments); - var startInside = (0, _polygonContainsJsDefault.default)(polygon, start); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function() { - sink.polygonStart(); - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - sink.polygonEnd(); - } - }; - function point(lambda, phi) { - if (pointVisible(lambda, phi)) sink.point(lambda, phi); - } - function pointLine(lambda, phi) { - line.point(lambda, phi); - } - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - function pointRing(lambda, phi) { - ring.push([ - lambda, - phi - ]); - ringSink.point(lambda, phi); - } - function ringStart() { - ringSink.lineStart(); - ring = []; - } - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for(i = 0; i < m; ++i)sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(validSegment)); - } - return clip; - }; - }); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _mathJs = require("../math.js"); -var _polygonContainsJs = require("../polygonContains.js"); -var _polygonContainsJsDefault = parcelHelpers.interopDefault(_polygonContainsJs); -var _d3Array = require("d3-array"); -function validSegment(segment) { - return segment.length > 1; -} -// Intersections are sorted along the clip edge. For both antimeridian cutting -// and circle clipping, the same comparison is used. -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - a[1]) - ((b = b.x)[0] < 0 ? b[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - b[1]); -} - -},{"./buffer.js":"k9qlR","./rejoin.js":"jrWAP","../math.js":"kc9MU","../polygonContains.js":"5DZUf","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k9qlR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var lines = [], line; - return { - point: function(x, y, m) { - line.push([ - x, - y, - m - ]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: (0, _noopJsDefault.default), - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; + }); + function fit(proj, _) { + const data2 = collectGeoJSON(_.fit); + _.extent ? proj.fitExtent(_.extent, data2) : _.size ? proj.fitSize(_.size, data2) : 0; + } + function create(type2) { + const constructor = projection((type2 || "mercator").toLowerCase()); + if (!constructor) error("Unrecognized projection type: " + type2); + return constructor(); + } + function set$1(proj, key2, value2) { + if (isFunction(proj[key2])) proj[key2](value2); + } + function collectGeoJSON(data2) { + data2 = array$4(data2); + return data2.length === 1 ? data2[0] : { + type: FeatureCollection, + features: data2.reduce((a2, f) => a2.concat(featurize(f)), []) + }; + } + function featurize(f) { + return f.type === FeatureCollection ? f.features : array$4(f).filter((d2) => d2 != null).map((d2) => d2.type === Feature ? d2 : { + type: Feature, + geometry: d2 }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); - -},{"../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jrWAP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A generalized polygon clipping algorithm: given a polygon that has been cut -// into its visible line segments, and rejoins the segments by interpolating -// along the clip edge. -parcelHelpers.export(exports, "default", ()=>function(segments, compareIntersection, startInside, interpolate, stream) { - var subject = [], clip = [], i, n; - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - if ((0, _pointEqualJsDefault.default)(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - for(i = 0; i < n; ++i)stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - // handle degenerate cases by moving the point - p1[0] += 2 * (0, _mathJs.epsilon); - } - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - if (!subject.length) return; - clip.sort(compareIntersection); - link(subject); - link(clip); - for(i = 0, n = clip.length; i < n; ++i)clip[i].e = startInside = !startInside; - var start = subject[0], points, point; - while(true){ - // Find first unvisited intersection. - var current = start, isSubject = true; - while(current.v)if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) for(i = 0, n = points.length; i < n; ++i)stream.point((point = points[i])[0], point[1]); - else interpolate(current.x, current.n.x, 1, stream); - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for(i = points.length - 1; i >= 0; --i)stream.point((point = points[i])[0], point[1]); - } else interpolate(current.x, current.p.x, -1, stream); - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - }while (!current.v); - stream.lineEnd(); + } + const geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + contour: Contour, + geojson: GeoJSON, + geopath: GeoPath, + geopoint: GeoPoint, + geoshape: GeoShape, + graticule: Graticule, + heatmap: Heatmap, + isocontour: Isocontour, + kde2d: KDE2D, + projection: Projection$1 + }, Symbol.toStringTag, { value: "Module" })); + function forceCenter(x2, y2) { + var nodes, strength = 1; + if (x2 == null) x2 = 0; + if (y2 == null) y2 = 0; + function force2() { + var i, n = nodes.length, node, sx = 0, sy = 0; + for (i = 0; i < n; ++i) { + node = nodes[i], sx += node.x, sy += node.y; + } + for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) { + node = nodes[i], node.x -= sx, node.y -= sy; + } + } + force2.initialize = function(_) { + nodes = _; + }; + force2.x = function(_) { + return arguments.length ? (x2 = +_, force2) : x2; + }; + force2.y = function(_) { + return arguments.length ? (y2 = +_, force2) : y2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + return force2; + } + function tree_add(d2) { + const x2 = +this._x.call(null, d2), y2 = +this._y.call(null, d2); + return add(this.cover(x2, y2), x2, y2, d2); + } + function add(tree2, x2, y2, d2) { + if (isNaN(x2) || isNaN(y2)) return tree2; + var parent, node = tree2._root, leaf = { data: d2 }, x02 = tree2._x0, y02 = tree2._y0, x12 = tree2._x1, y12 = tree2._y1, xm, ym, xp, yp, right, bottom, i, j; + if (!node) return tree2._root = leaf, tree2; + while (node.length) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree2; + } + xp = +tree2._x.call(null, node.data); + yp = +tree2._y.call(null, node.data); + if (x2 === xp && y2 === yp) return leaf.next = node, parent ? parent[i] = leaf : tree2._root = leaf, tree2; + do { + parent = parent ? parent[i] = new Array(4) : tree2._root = new Array(4); + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); + return parent[j] = node, parent[i] = leaf, tree2; + } + function addAll(data2) { + var d2, i, n = data2.length, x2, y2, xz = new Array(n), yz = new Array(n), x02 = Infinity, y02 = Infinity, x12 = -Infinity, y12 = -Infinity; + for (i = 0; i < n; ++i) { + if (isNaN(x2 = +this._x.call(null, d2 = data2[i])) || isNaN(y2 = +this._y.call(null, d2))) continue; + xz[i] = x2; + yz[i] = y2; + if (x2 < x02) x02 = x2; + if (x2 > x12) x12 = x2; + if (y2 < y02) y02 = y2; + if (y2 > y12) y12 = y2; + } + if (x02 > x12 || y02 > y12) return this; + this.cover(x02, y02).cover(x12, y12); + for (i = 0; i < n; ++i) { + add(this, xz[i], yz[i], data2[i]); + } + return this; + } + function tree_cover(x2, y2) { + if (isNaN(x2 = +x2) || isNaN(y2 = +y2)) return this; + var x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1; + if (isNaN(x02)) { + x12 = (x02 = Math.floor(x2)) + 1; + y12 = (y02 = Math.floor(y2)) + 1; + } else { + var z2 = x12 - x02 || 1, node = this._root, parent, i; + while (x02 > x2 || x2 >= x12 || y02 > y2 || y2 >= y12) { + i = (y2 < y02) << 1 | x2 < x02; + parent = new Array(4), parent[i] = node, node = parent, z2 *= 2; + switch (i) { + case 0: + x12 = x02 + z2, y12 = y02 + z2; + break; + case 1: + x02 = x12 - z2, y12 = y02 + z2; + break; + case 2: + x12 = x02 + z2, y02 = y12 - z2; + break; + case 3: + x02 = x12 - z2, y02 = y12 - z2; + break; } + } + if (this._root && this._root.length) this._root = node; + } + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + return this; + } + function tree_data() { + var data2 = []; + this.visit(function(node) { + if (!node.length) do + data2.push(node.data); + while (node = node.next); }); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _mathJs = require("../math.js"); -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = null; // next & previous -} -function link(array) { - if (!(n = array.length)) return; - var n, i = 0, a = array[0], b; - while(++i < n){ - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} - -},{"../pointEqual.js":"8yvsz","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8yvsz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return (0, _mathJs.abs)(a[0] - b[0]) < (0, _mathJs.epsilon) && (0, _mathJs.abs)(a[1] - b[1]) < (0, _mathJs.epsilon); - }); -var _mathJs = require("./math.js"); - -},{"./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5DZUf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(polygon, point) { - var lambda = longitude(point), phi = point[1], sinPhi = (0, _mathJs.sin)(phi), normal = [ - (0, _mathJs.sin)(lambda), - -(0, _mathJs.cos)(lambda), - 0 - ], angle = 0, winding = 0; - var sum = new (0, _d3Array.Adder)(); - if (sinPhi === 1) phi = (0, _mathJs.halfPi) + (0, _mathJs.epsilon); - else if (sinPhi === -1) phi = -(0, _mathJs.halfPi) - (0, _mathJs.epsilon); - for(var i = 0, n = polygon.length; i < n; ++i){ - if (!(m = (ring = polygon[i]).length)) continue; - var ring, m, point0 = ring[m - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + (0, _mathJs.quarterPi), sinPhi0 = (0, _mathJs.sin)(phi0), cosPhi0 = (0, _mathJs.cos)(phi0); - for(var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1){ - var point1 = ring[j], lambda1 = longitude(point1), phi1 = point1[1] / 2 + (0, _mathJs.quarterPi), sinPhi1 = (0, _mathJs.sin)(phi1), cosPhi1 = (0, _mathJs.cos)(phi1), delta = lambda1 - lambda0, sign = delta >= 0 ? 1 : -1, absDelta = sign * delta, antimeridian = absDelta > (0, _mathJs.pi), k = sinPhi0 * sinPhi1; - sum.add((0, _mathJs.atan2)(k * sign * (0, _mathJs.sin)(absDelta), cosPhi0 * cosPhi1 + k * (0, _mathJs.cos)(absDelta))); - angle += antimeridian ? delta + sign * (0, _mathJs.tau) : delta; - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = (0, _cartesianJs.cartesianCross)((0, _cartesianJs.cartesian)(point0), (0, _cartesianJs.cartesian)(point1)); - (0, _cartesianJs.cartesianNormalizeInPlace)(arc); - var intersection = (0, _cartesianJs.cartesianCross)(normal, arc); - (0, _cartesianJs.cartesianNormalizeInPlace)(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * (0, _mathJs.asin)(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) winding += antimeridian ^ delta >= 0 ? 1 : -1; - } - } + return data2; + } + function tree_extent(_) { + return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]]; + } + function Quad(node, x02, y02, x12, y12) { + this.node = node; + this.x0 = x02; + this.y0 = y02; + this.x1 = x12; + this.y1 = y12; + } + function tree_find(x2, y2, radius2) { + var data2, x02 = this._x0, y02 = this._y0, x12, y12, x22, y22, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; + if (node) quads.push(new Quad(node, x02, y02, x3, y3)); + if (radius2 == null) radius2 = Infinity; + else { + x02 = x2 - radius2, y02 = y2 - radius2; + x3 = x2 + radius2, y3 = y2 + radius2; + radius2 *= radius2; + } + while (q = quads.pop()) { + if (!(node = q.node) || (x12 = q.x0) > x3 || (y12 = q.y0) > y3 || (x22 = q.x1) < x02 || (y22 = q.y1) < y02) continue; + if (node.length) { + var xm = (x12 + x22) / 2, ym = (y12 + y22) / 2; + quads.push( + new Quad(node[3], xm, ym, x22, y22), + new Quad(node[2], x12, ym, xm, y22), + new Quad(node[1], xm, y12, x22, ym), + new Quad(node[0], x12, y12, xm, ym) + ); + if (i = (y2 >= ym) << 1 | x2 >= xm) { + q = quads[quads.length - 1]; + quads[quads.length - 1] = quads[quads.length - 1 - i]; + quads[quads.length - 1 - i] = q; + } + } else { + var dx = x2 - +this._x.call(null, node.data), dy = y2 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; + if (d2 < radius2) { + var d3 = Math.sqrt(radius2 = d2); + x02 = x2 - d3, y02 = y2 - d3; + x3 = x2 + d3, y3 = y2 + d3; + data2 = node.data; } - // First, determine whether the South pole is inside or outside: - // - // It is inside if: - // * the polygon winds around it in a clockwise direction. - // * the polygon does not (cumulatively) wind around it, but has a negative - // (counter-clockwise) area. - // - // Second, count the (signed) number of times a segment crosses a lambda - // from the point to the South pole. If it is zero, then the point is the - // same side as the South pole. - return (angle < -(0, _mathJs.epsilon) || angle < (0, _mathJs.epsilon) && sum < -(0, _mathJs.epsilon2)) ^ winding & 1; + } + } + return data2; + } + function tree_remove(d2) { + if (isNaN(x2 = +this._x.call(null, d2)) || isNaN(y2 = +this._y.call(null, d2))) return this; + var parent, node = this._root, retainer, previous, next, x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1, x2, y2, xm, ym, right, bottom, i, j; + if (!node) return this; + if (node.length) while (true) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (!(parent = node, node = node[i = bottom << 1 | right])) return this; + if (!node.length) break; + if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; + } + while (node.data !== d2) if (!(previous = node, node = node.next)) return this; + if (next = node.next) delete node.next; + if (previous) return next ? previous.next = next : delete previous.next, this; + if (!parent) return this._root = next, this; + next ? parent[i] = next : delete parent[i]; + if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { + if (retainer) retainer[j] = node; + else this._root = node; + } + return this; + } + function removeAll(data2) { + for (var i = 0, n = data2.length; i < n; ++i) this.remove(data2[i]); + return this; + } + function tree_root() { + return this._root; + } + function tree_size() { + var size = 0; + this.visit(function(node) { + if (!node.length) do + ++size; + while (node = node.next); }); -var _d3Array = require("d3-array"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -function longitude(point) { - return (0, _mathJs.abs)(point[0]) <= (0, _mathJs.pi) ? point[0] : (0, _mathJs.sign)(point[0]) * (((0, _mathJs.abs)(point[0]) + (0, _mathJs.pi)) % (0, _mathJs.tau) - (0, _mathJs.pi)); -} - -},{"d3-array":"5lCYW","./cartesian.js":"9WnrC","./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iw60F":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var cr = (0, _mathJs.cos)(radius), delta = 2 * (0, _mathJs.radians), smallRadius = cr > 0, notHemisphere = (0, _mathJs.abs)(cr) > (0, _mathJs.epsilon); // TODO optimise for this common case - function interpolate(from, to, direction, stream) { - (0, _circleJs.circleStream)(stream, radius, delta, direction, from, to); - } - function visible(lambda, phi) { - return (0, _mathJs.cos)(lambda) * (0, _mathJs.cos)(phi) > cr; - } - // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // should be rejoined. - function clipLine(stream) { - var point0, c0, v0, v00, clean; // no intersections - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [ - lambda, - phi - ], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi)), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || (0, _pointEqualJsDefault.default)(point0, point2) || (0, _pointEqualJsDefault.default)(point1, point2)) point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - // If the codes for two points are different, or are both zero, - // and there this segment intersects with the small circle. - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - } else { - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - stream.lineStart(); - stream.point(t[0][0], t[0][1], 3); - } - } - } - if (v && (!point0 || !(0, _pointEqualJsDefault.default)(point0, point1))) stream.point(point1[0], point1[1]); - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = null; - }, - // Rejoin first and last segments if there were intersections and the first - // and last points were visible. - clean: function() { - return clean | (v00 && v0) << 1; - } - }; + return size; + } + function tree_visit(callback) { + var quads = [], q, node = this._root, child, x02, y02, x12, y12; + if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + if (!callback(node = q.node, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1) && node.length) { + var xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[3]) quads.push(new Quad(child, xm, ym, x12, y12)); + if (child = node[2]) quads.push(new Quad(child, x02, ym, xm, y12)); + if (child = node[1]) quads.push(new Quad(child, xm, y02, x12, ym)); + if (child = node[0]) quads.push(new Quad(child, x02, y02, xm, ym)); + } + } + return this; + } + function tree_visitAfter(callback) { + var quads = [], next = [], q; + if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + var node = q.node; + if (node.length) { + var child, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1, xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[0]) quads.push(new Quad(child, x02, y02, xm, ym)); + if (child = node[1]) quads.push(new Quad(child, xm, y02, x12, ym)); + if (child = node[2]) quads.push(new Quad(child, x02, ym, xm, y12)); + if (child = node[3]) quads.push(new Quad(child, xm, ym, x12, y12)); + } + next.push(q); + } + while (q = next.pop()) { + callback(q.node, q.x0, q.y0, q.x1, q.y1); + } + return this; + } + function defaultX(d2) { + return d2[0]; + } + function tree_x(_) { + return arguments.length ? (this._x = _, this) : this._x; + } + function defaultY(d2) { + return d2[1]; + } + function tree_y(_) { + return arguments.length ? (this._y = _, this) : this._y; + } + function quadtree(nodes, x2, y2) { + var tree2 = new Quadtree(x2 == null ? defaultX : x2, y2 == null ? defaultY : y2, NaN, NaN, NaN, NaN); + return nodes == null ? tree2 : tree2.addAll(nodes); + } + function Quadtree(x2, y2, x02, y02, x12, y12) { + this._x = x2; + this._y = y2; + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + this._root = void 0; + } + function leaf_copy(leaf) { + var copy2 = { data: leaf.data }, next = copy2; + while (leaf = leaf.next) next = next.next = { data: leaf.data }; + return copy2; + } + var treeProto = quadtree.prototype = Quadtree.prototype; + treeProto.copy = function() { + var copy2 = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; + if (!node) return copy2; + if (!node.length) return copy2._root = leaf_copy(node), copy2; + nodes = [{ source: node, target: copy2._root = new Array(4) }]; + while (node = nodes.pop()) { + for (var i = 0; i < 4; ++i) { + if (child = node.source[i]) { + if (child.length) nodes.push({ source: child, target: node.target[i] = new Array(4) }); + else node.target[i] = leaf_copy(child); } - // Intersects the great circle between a and b with the clip circle. - function intersect(a, b, two) { - var pa = (0, _cartesianJs.cartesian)(a), pb = (0, _cartesianJs.cartesian)(b); - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [ - 1, - 0, - 0 - ], n2 = (0, _cartesianJs.cartesianCross)(pa, pb), n2n2 = (0, _cartesianJs.cartesianDot)(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; - // Two polar points. - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = (0, _cartesianJs.cartesianCross)(n1, n2), A = (0, _cartesianJs.cartesianScale)(n1, c1), B = (0, _cartesianJs.cartesianScale)(n2, c2); - (0, _cartesianJs.cartesianAddInPlace)(A, B); - // Solve |p(t)|^2 = 1. - var u = n1xn2, w = (0, _cartesianJs.cartesianDot)(A, u), uu = (0, _cartesianJs.cartesianDot)(u, u), t2 = w * w - uu * ((0, _cartesianJs.cartesianDot)(A, A) - 1); - if (t2 < 0) return; - var t = (0, _mathJs.sqrt)(t2), q = (0, _cartesianJs.cartesianScale)(u, (-w - t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q, A); - q = (0, _cartesianJs.spherical)(q); - if (!two) return q; - // Two intersection points. - var lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1], z; - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - var delta = lambda1 - lambda0, polar = (0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon), meridian = polar || delta < (0, _mathJs.epsilon); - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - // Check that the first point is between a and b. - if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < ((0, _mathJs.abs)(q[0] - lambda0) < (0, _mathJs.epsilon) ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > (0, _mathJs.pi) ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = (0, _cartesianJs.cartesianScale)(u, (-w + t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q1, A); - return [ - q, - (0, _cartesianJs.spherical)(q1) - ]; - } + } + } + return copy2; + }; + treeProto.add = tree_add; + treeProto.addAll = addAll; + treeProto.cover = tree_cover; + treeProto.data = tree_data; + treeProto.extent = tree_extent; + treeProto.find = tree_find; + treeProto.remove = tree_remove; + treeProto.removeAll = removeAll; + treeProto.root = tree_root; + treeProto.size = tree_size; + treeProto.visit = tree_visit; + treeProto.visitAfter = tree_visitAfter; + treeProto.x = tree_x; + treeProto.y = tree_y; + function constant$1(x2) { + return function() { + return x2; + }; + } + function jiggle(random2) { + return (random2() - 0.5) * 1e-6; + } + function x$1(d2) { + return d2.x + d2.vx; + } + function y$1(d2) { + return d2.y + d2.vy; + } + function forceCollide(radius2) { + var nodes, radii, random2, strength = 1, iterations2 = 1; + if (typeof radius2 !== "function") radius2 = constant$1(radius2 == null ? 1 : +radius2); + function force2() { + var i, n = nodes.length, tree2, node, xi, yi, ri, ri2; + for (var k = 0; k < iterations2; ++k) { + tree2 = quadtree(nodes, x$1, y$1).visitAfter(prepare2); + for (i = 0; i < n; ++i) { + node = nodes[i]; + ri = radii[node.index], ri2 = ri * ri; + xi = node.x + node.vx; + yi = node.y + node.vy; + tree2.visit(apply2); } - // Generates a 4-bit vector representing the location of a point relative to - // the small circle's bounding box. - function code(lambda, phi) { - var r = smallRadius ? radius : (0, _mathJs.pi) - radius, code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - return (0, _indexJsDefault.default)(visible, clipLine, interpolate, smallRadius ? [ - 0, - -radius - ] : [ - -(0, _mathJs.pi), - radius - (0, _mathJs.pi) - ]); - }); -var _cartesianJs = require("../cartesian.js"); -var _circleJs = require("../circle.js"); -var _mathJs = require("../math.js"); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); - -},{"../cartesian.js":"9WnrC","../circle.js":"JRkjq","../math.js":"kc9MU","../pointEqual.js":"8yvsz","./index.js":"6CuX6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4qylb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>clipRectangle); -var _mathJs = require("../math.js"); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _d3Array = require("d3-array"); -var clipMax = 1e9, clipMin = -clipMax; -function clipRectangle(x0, y0, x1, y1) { - function visible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - else stream.point(to[0], to[1]); + } + function apply2(quad2, x02, y02, x12, y12) { + var data2 = quad2.data, rj = quad2.r, r = ri + rj; + if (data2) { + if (data2.index > node.index) { + var x2 = xi - data2.x - data2.vx, y2 = yi - data2.y - data2.vy, l = x2 * x2 + y2 * y2; + if (l < r * r) { + if (x2 === 0) x2 = jiggle(random2), l += x2 * x2; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + l = (r - (l = Math.sqrt(l))) / l * strength; + node.vx += (x2 *= l) * (r = (rj *= rj) / (ri2 + rj)); + node.vy += (y2 *= l) * r; + data2.vx -= x2 * (r = 1 - r); + data2.vy -= y2 * r; + } + } + return; + } + return x02 > xi + r || x12 < xi - r || y02 > yi + r || y12 < yi - r; + } } - function corner(p, direction) { - return (0, _mathJs.abs)(p[0] - x0) < (0, _mathJs.epsilon) ? direction > 0 ? 0 : 3 : (0, _mathJs.abs)(p[0] - x1) < (0, _mathJs.epsilon) ? direction > 0 ? 2 : 1 : (0, _mathJs.abs)(p[1] - y0) < (0, _mathJs.epsilon) ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon - } - function compareIntersection(a, b) { - return comparePoint(a.x, b.x); - } - function comparePoint(a, b) { - var ca = corner(a, 1), cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - return function(stream) { - var activeStream = stream, bufferStream = (0, _bufferJsDefault.default)(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; - var clipStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: polygonStart, - polygonEnd: polygonEnd - }; - function point(x, y) { - if (visible(x, y)) activeStream.point(x, y); - } - function polygonInside() { - var winding = 0; - for(var i = 0, n = polygon.length; i < n; ++i)for(var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j){ - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { - if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; - } else if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; - } - return winding; - } - // Buffer geometry within a polygon and then clip it en masse. - function polygonStart() { - activeStream = bufferStream, segments = [], polygon = [], clean = true; - } - function polygonEnd() { - var startInside = polygonInside(), cleanInside = clean && startInside, visible = (segments = (0, _d3Array.merge)(segments)).length; - if (cleanInside || visible) { - stream.polygonStart(); - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - if (visible) (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, stream); - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - // TODO rather than special-case polygons, simply handle them separately. - // Ideally, coincident intersection points should be jittered to avoid - // clipping issues. - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferStream.rejoin(); - segments.push(bufferStream.result()); - } - clipStream.point = point; - if (v_) activeStream.lineEnd(); - } - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([ - x, - y - ]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else if (v && v_) activeStream.point(x, y); - else { - var a = [ - x_ = Math.max(clipMin, Math.min(clipMax, x_)), - y_ = Math.max(clipMin, Math.min(clipMax, y_)) - ], b = [ - x = Math.max(clipMin, Math.min(clipMax, x)), - y = Math.max(clipMin, Math.min(clipMax, y)) - ]; - if ((0, _lineJsDefault.default)(a, b, x0, y0, x1, y1)) { - if (!v_) { - activeStream.lineStart(); - activeStream.point(a[0], a[1]); - } - activeStream.point(b[0], b[1]); - if (!v) activeStream.lineEnd(); - clean = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - x_ = x, y_ = y, v_ = v; - } - return clipStream; - }; -} - -},{"../math.js":"kc9MU","./buffer.js":"k9qlR","./line.js":"gx2l4","./rejoin.js":"jrWAP","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gx2l4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b, x0, y0, x1, y1) { - var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"24Rpv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>graticule); -parcelHelpers.export(exports, "graticule10", ()=>graticule10); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -function graticuleX(y0, y1, dy) { - var y = (0, _d3Array.range)(y0, y1 - (0, _mathJs.epsilon), dy).concat(y1); - return function(x) { - return y.map(function(y) { - return [ - x, - y - ]; - }); + function prepare2(quad2) { + if (quad2.data) return quad2.r = radii[quad2.data.index]; + for (var i = quad2.r = 0; i < 4; ++i) { + if (quad2[i] && quad2[i].r > quad2.r) { + quad2.r = quad2[i].r; + } + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node; + radii = new Array(n); + for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius2(node, i, nodes); + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); }; -} -function graticuleY(x0, x1, dx) { - var x = (0, _d3Array.range)(x0, x1 - (0, _mathJs.epsilon), dx).concat(x1); - return function(y) { - return x.map(function(x) { - return [ - x, - y - ]; - }); + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; }; -} -function graticule() { - var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + force2.radius = function(_) { + return arguments.length ? (radius2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : radius2; + }; + return force2; + } + function index$1(d2) { + return d2.index; + } + function find$1(nodeById, nodeId) { + var node = nodeById.get(nodeId); + if (!node) throw new Error("node not found: " + nodeId); + return node; + } + function forceLink(links) { + var id2 = index$1, strength = defaultStrength, strengths, distance2 = constant$1(30), distances, nodes, count2, bias, random2, iterations2 = 1; + if (links == null) links = []; + function defaultStrength(link2) { + return 1 / Math.min(count2[link2.source.index], count2[link2.target.index]); + } + function force2(alpha) { + for (var k = 0, n = links.length; k < iterations2; ++k) { + for (var i = 0, link2, source2, target2, x2, y2, l, b2; i < n; ++i) { + link2 = links[i], source2 = link2.source, target2 = link2.target; + x2 = target2.x + target2.vx - source2.x - source2.vx || jiggle(random2); + y2 = target2.y + target2.vy - source2.y - source2.vy || jiggle(random2); + l = Math.sqrt(x2 * x2 + y2 * y2); + l = (l - distances[i]) / l * alpha * strengths[i]; + x2 *= l, y2 *= l; + target2.vx -= x2 * (b2 = bias[i]); + target2.vy -= y2 * b2; + source2.vx += x2 * (b2 = 1 - b2); + source2.vy += y2 * b2; + } + } } - function lines() { - return (0, _d3Array.range)((0, _mathJs.ceil)(X0 / DX) * DX, X1, DX).map(X).concat((0, _d3Array.range)((0, _mathJs.ceil)(Y0 / DY) * DY, Y1, DY).map(Y)).concat((0, _d3Array.range)((0, _mathJs.ceil)(x0 / dx) * dx, x1, dx).filter(function(x) { - return (0, _mathJs.abs)(x % DX) > (0, _mathJs.epsilon); - }).map(x)).concat((0, _d3Array.range)((0, _mathJs.ceil)(y0 / dy) * dy, y1, dy).filter(function(y) { - return (0, _mathJs.abs)(y % DY) > (0, _mathJs.epsilon); - }).map(y)); - } - graticule.lines = function() { - return lines().map(function(coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; - }); + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, m2 = links.length, nodeById = new Map(nodes.map((d2, i2) => [id2(d2, i2, nodes), d2])), link2; + for (i = 0, count2 = new Array(n); i < m2; ++i) { + link2 = links[i], link2.index = i; + if (typeof link2.source !== "object") link2.source = find$1(nodeById, link2.source); + if (typeof link2.target !== "object") link2.target = find$1(nodeById, link2.target); + count2[link2.source.index] = (count2[link2.source.index] || 0) + 1; + count2[link2.target.index] = (count2[link2.target.index] || 0) + 1; + } + for (i = 0, bias = new Array(m2); i < m2; ++i) { + link2 = links[i], bias[i] = count2[link2.source.index] / (count2[link2.source.index] + count2[link2.target.index]); + } + strengths = new Array(m2), initializeStrength(); + distances = new Array(m2), initializeDistance(); + } + function initializeStrength() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + strengths[i] = +strength(links[i], i, links); + } + } + function initializeDistance() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + distances[i] = +distance2(links[i], i, links); + } + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); }; - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) - ] - }; + force2.links = function(_) { + return arguments.length ? (links = _, initialize2(), force2) : links; }; - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - graticule.extentMajor = function(_) { - if (!arguments.length) return [ - [ - X0, - Y0 - ], - [ - X1, - Y1 - ] - ]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - graticule.extentMinor = function(_) { - if (!arguments.length) return [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - graticule.stepMajor = function(_) { - if (!arguments.length) return [ - DX, - DY - ]; - DX = +_[0], DY = +_[1]; - return graticule; + force2.id = function(_) { + return arguments.length ? (id2 = _, force2) : id2; }; - graticule.stepMinor = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - return graticule.extentMajor([ - [ - -180, - -90 + (0, _mathJs.epsilon) - ], - [ - 180, - 90 - (0, _mathJs.epsilon) - ] - ]).extentMinor([ - [ - -180, - -80 - (0, _mathJs.epsilon) - ], - [ - 180, - 80 + (0, _mathJs.epsilon) - ] - ]); -} -function graticule10() { - return graticule()(); -} - -},{"d3-array":"5lCYW","./math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aay0S":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(projection, context) { - let digits = 3, pointRadius = 4.5, projectionStream, contextStream; - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - (0, _streamJsDefault.default)(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - path.area = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _areaJsDefault.default))); - return (0, _areaJsDefault.default).result(); - }; - path.measure = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _measureJsDefault.default))); - return (0, _measureJsDefault.default).result(); - }; - path.bounds = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _boundsJsDefault.default))); - return (0, _boundsJsDefault.default).result(); - }; - path.centroid = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _centroidJsDefault.default))); - return (0, _centroidJsDefault.default).result(); - }; - path.projection = function(_) { - if (!arguments.length) return projection; - projectionStream = _ == null ? (projection = null, _identityJsDefault.default) : (projection = _).stream; - return path; - }; - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new (0, _stringJsDefault.default)(digits)) : new (0, _contextJsDefault.default)(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - path.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - if (context === null) contextStream = new (0, _stringJsDefault.default)(digits); - return path; - }; - return path.projection(projection).digits(digits).context(context); + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force2) : strength; + }; + force2.distance = function(_) { + return arguments.length ? (distance2 = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force2) : distance2; + }; + return force2; + } + var noop = { value: () => { + } }; + function dispatch() { + for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { + if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); + _[t] = []; + } + return new Dispatch(_); + } + function Dispatch(_) { + this._ = _; + } + function parseTypenames(typenames, types2) { + return typenames.trim().split(/^|\s+/).map(function(t) { + var name = "", i = t.indexOf("."); + if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + if (t && !types2.hasOwnProperty(t)) throw new Error("unknown type: " + t); + return { type: t, name }; }); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _contextJs = require("./context.js"); -var _contextJsDefault = parcelHelpers.interopDefault(_contextJs); -var _measureJs = require("./measure.js"); -var _measureJsDefault = parcelHelpers.interopDefault(_measureJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); - -},{"../identity.js":"53el5","../stream.js":"hPbYn","./area.js":"l5Wy6","./bounds.js":"gWZWO","./centroid.js":"jis2d","./context.js":"gjaUo","./measure.js":"1UAzP","./string.js":"149At","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"53el5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l5Wy6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var areaSum = new (0, _d3Array.Adder)(), areaRingSum = new (0, _d3Array.Adder)(), x00, y00, x0, y0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - areaStream.lineStart = areaStream.lineEnd = areaStream.point = (0, _noopJsDefault.default); - areaSum.add((0, _mathJs.abs)(areaRingSum)); - areaRingSum = new (0, _d3Array.Adder)(); + } + Dispatch.prototype = dispatch.prototype = { + constructor: Dispatch, + on: function(typename, callback) { + var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; + if (arguments.length < 2) { + while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; + return; + } + if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); + while (++i < n) { + if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); + else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); + } + return this; }, - result: function() { - var area = areaSum / 2; - areaSum = new (0, _d3Array.Adder)(); - return area; - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaPointFirst(x, y) { - areaStream.point = areaPoint; - x00 = x0 = x, y00 = y0 = y; -} -function areaPoint(x, y) { - areaRingSum.add(y0 * x - x0 * y); - x0 = x, y0 = y; -} -function areaRingEnd() { - areaPoint(x00, y00); -} -exports.default = areaStream; - -},{"d3-array":"5lCYW","../math.js":"kc9MU","../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gWZWO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var x0 = Infinity, y0 = x0, x1 = -x0, y1 = x1; -var boundsStream = { - point: boundsPoint, - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: (0, _noopJsDefault.default), - polygonEnd: (0, _noopJsDefault.default), - result: function() { - var bounds = [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x1 = y1 = -(y0 = x0 = Infinity); - return bounds; - } -}; -function boundsPoint(x, y) { - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; -} -exports.default = boundsStream; - -},{"../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jis2d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -// TODO Enforce positive area for exterior, negative area for interior? -var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00, y00, x0, y0; -var centroidStream = { - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; + copy: function() { + var copy2 = {}, _ = this._; + for (var t in _) copy2[t] = _[t].slice(); + return new Dispatch(copy2); }, - polygonEnd: function() { - centroidStream.point = centroidPoint; - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; + call: function(type2, that) { + if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); }, - result: function() { - var centroid = Z2 ? [ - X2 / Z2, - Y2 / Z2 - ] : Z1 ? [ - X1 / Z1, - Y1 / Z1 - ] : Z0 ? [ - X0 / Z0, - Y0 / Z0 - ] : [ - NaN, - NaN - ]; - X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; - return centroid; + apply: function(type2, that, args) { + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (var t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); } -}; -function centroidPoint(x, y) { - X0 += x; - Y0 += y; - ++Z0; -} -function centroidLineStart() { - centroidStream.point = centroidPointFirstLine; -} -function centroidPointFirstLine(x, y) { - centroidStream.point = centroidPointLine; - centroidPoint(x0 = x, y0 = y); -} -function centroidPointLine(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - centroidPoint(x0 = x, y0 = y); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -function centroidRingStart() { - centroidStream.point = centroidPointFirstRing; -} -function centroidRingEnd() { - centroidPointRing(x00, y00); -} -function centroidPointFirstRing(x, y) { - centroidStream.point = centroidPointRing; - centroidPoint(x00 = x0 = x, y00 = y0 = y); -} -function centroidPointRing(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - z = y0 * x - x0 * y; - X2 += z * (x0 + x); - Y2 += z * (y0 + y); - Z2 += z * 3; - centroidPoint(x0 = x, y0 = y); -} -exports.default = centroidStream; - -},{"../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gjaUo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>PathContext); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function PathContext(context) { - this._context = context; -} -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; - }, - polygonEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._point = 0; - }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function(x, y) { - switch(this._point){ - case 0: - this._context.moveTo(x, y); - this._point = 1; - break; - case 1: - this._context.lineTo(x, y); - break; - default: - this._context.moveTo(x + this._radius, y); - this._context.arc(x, y, this._radius, 0, (0, _mathJs.tau)); - break; - } - }, - result: (0, _noopJsDefault.default) -}; - -},{"../math.js":"kc9MU","../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1UAzP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var lengthSum = new (0, _d3Array.Adder)(), lengthRing, x00, y00, x0, y0; -var lengthStream = { - point: (0, _noopJsDefault.default), - lineStart: function() { - lengthStream.point = lengthPointFirst; - }, - lineEnd: function() { - if (lengthRing) lengthPoint(x00, y00); - lengthStream.point = (0, _noopJsDefault.default); - }, - polygonStart: function() { - lengthRing = true; - }, - polygonEnd: function() { - lengthRing = null; + }; + function get(type2, name) { + for (var i = 0, n = type2.length, c2; i < n; ++i) { + if ((c2 = type2[i]).name === name) { + return c2.value; + } + } + } + function set(type2, name, callback) { + for (var i = 0, n = type2.length; i < n; ++i) { + if (type2[i].name === name) { + type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1)); + break; + } + } + if (callback != null) type2.push({ name, value: callback }); + return type2; + } + var frame = 0, timeout = 0, interval$1 = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { + setTimeout(f, 17); + }; + function now() { + return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); + } + function clearNow() { + clockNow = 0; + } + function Timer$1() { + this._call = this._time = this._next = null; + } + Timer$1.prototype = timer$1.prototype = { + constructor: Timer$1, + restart: function(callback, delay, time2) { + if (typeof callback !== "function") throw new TypeError("callback is not a function"); + time2 = (time2 == null ? now() : +time2) + (delay == null ? 0 : +delay); + if (!this._next && taskTail !== this) { + if (taskTail) taskTail._next = this; + else taskHead = this; + taskTail = this; + } + this._call = callback; + this._time = time2; + sleep(); }, - result: function() { - var length = +lengthSum; - lengthSum = new (0, _d3Array.Adder)(); - return length; + stop: function() { + if (this._call) { + this._call = null; + this._time = Infinity; + sleep(); + } } -}; -function lengthPointFirst(x, y) { - lengthStream.point = lengthPoint; - x00 = x0 = x, y00 = y0 = y; -} -function lengthPoint(x, y) { - x0 -= x, y0 -= y; - lengthSum.add((0, _mathJs.sqrt)(x0 * x0 + y0 * y0)); - x0 = x, y0 = y; -} -exports.default = lengthStream; - -},{"d3-array":"5lCYW","../math.js":"kc9MU","../noop.js":"cEfoF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"149At":[function(require,module,exports,__globalThis) { -// Simple caching for constant-radius points. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -let cacheDigits, cacheAppend, cacheRadius, cacheCircle; -class PathString { - constructor(digits){ - this._append = digits == null ? append : appendRound(digits); - this._radius = 4.5; - this._ = ""; + }; + function timer$1(callback, delay, time2) { + var t = new Timer$1(); + t.restart(callback, delay, time2); + return t; + } + function timerFlush() { + now(); + ++frame; + var t = taskHead, e; + while (t) { + if ((e = clockNow - t._time) >= 0) t._call.call(void 0, e); + t = t._next; } - pointRadius(_) { - this._radius = +_; - return this; + --frame; + } + function wake() { + clockNow = (clockLast = clock.now()) + clockSkew; + frame = timeout = 0; + try { + timerFlush(); + } finally { + frame = 0; + nap(); + clockNow = 0; } - polygonStart() { - this._line = 0; + } + function poke() { + var now2 = clock.now(), delay = now2 - clockLast; + if (delay > pokeDelay) clockSkew -= delay, clockLast = now2; + } + function nap() { + var t02, t12 = taskHead, t22, time2 = Infinity; + while (t12) { + if (t12._call) { + if (time2 > t12._time) time2 = t12._time; + t02 = t12, t12 = t12._next; + } else { + t22 = t12._next, t12._next = null; + t12 = t02 ? t02._next = t22 : taskHead = t22; + } } - polygonEnd() { - this._line = NaN; + taskTail = t02; + sleep(time2); + } + function sleep(time2) { + if (frame) return; + if (timeout) timeout = clearTimeout(timeout); + var delay = time2 - clockNow; + if (delay > 24) { + if (time2 < Infinity) timeout = setTimeout(wake, time2 - clock.now() - clockSkew); + if (interval$1) interval$1 = clearInterval(interval$1); + } else { + if (!interval$1) clockLast = clock.now(), interval$1 = setInterval(poke, pokeDelay); + frame = 1, setFrame(wake); } - lineStart() { - this._point = 0; + } + function interval(callback, delay, time2) { + var t = new Timer$1(), total = delay; + if (delay == null) return t.restart(callback, delay, time2), t; + t._restart = t.restart; + t.restart = function(callback2, delay2, time3) { + delay2 = +delay2, time3 = time3 == null ? now() : +time3; + t._restart(function tick(elapsed) { + elapsed += total; + t._restart(tick, total += delay2, time3); + callback2(elapsed); + }, delay2, time3); + }; + t.restart(callback, delay, time2); + return t; + } + const a$1 = 1664525; + const c$1 = 1013904223; + const m$1 = 4294967296; + function lcg$1() { + let s2 = 1; + return () => (s2 = (a$1 * s2 + c$1) % m$1) / m$1; + } + function x(d2) { + return d2.x; + } + function y(d2) { + return d2.y; + } + var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); + function forceSimulation(nodes) { + var simulation2, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = /* @__PURE__ */ new Map(), stepper = timer$1(step), event2 = dispatch("tick", "end"), random2 = lcg$1(); + if (nodes == null) nodes = []; + function step() { + tick(); + event2.call("tick", simulation2); + if (alpha < alphaMin) { + stepper.stop(); + event2.call("end", simulation2); + } } - lineEnd() { - if (this._line === 0) this._ += "Z"; - this._point = NaN; - } - point(x, y) { - switch(this._point){ - case 0: - this._append`M${x},${y}`; - this._point = 1; - break; - case 1: - this._append`L${x},${y}`; - break; - default: - this._append`M${x},${y}`; - if (this._radius !== cacheRadius || this._append !== cacheAppend) { - const r = this._radius; - const s = this._; - this._ = ""; // stash the old string so we can cache the circle path fragment - this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; - cacheRadius = r; - cacheAppend = this._append; - cacheCircle = this._; - this._ = s; - } - this._ += cacheCircle; - break; + function tick(iterations2) { + var i, n = nodes.length, node; + if (iterations2 === void 0) iterations2 = 1; + for (var k = 0; k < iterations2; ++k) { + alpha += (alphaTarget - alpha) * alphaDecay; + forces.forEach(function(force2) { + force2(alpha); + }); + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (node.fx == null) node.x += node.vx *= velocityDecay; + else node.x = node.fx, node.vx = 0; + if (node.fy == null) node.y += node.vy *= velocityDecay; + else node.y = node.fy, node.vy = 0; } + } + return simulation2; } - result() { - const result = this._; - this._ = ""; - return result.length ? result : null; - } -} -exports.default = PathString; -function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - const d = Math.floor(digits); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`); - if (d > 15) return append; - if (d !== cacheDigits) { - const k = 10 ** d; - cacheDigits = d; - cacheAppend = function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; - }; + function initializeNodes() { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.index = i; + if (node.fx != null) node.x = node.fx; + if (node.fy != null) node.y = node.fy; + if (isNaN(node.x) || isNaN(node.y)) { + var radius2 = initialRadius * Math.sqrt(0.5 + i), angle2 = i * initialAngle; + node.x = radius2 * Math.cos(angle2); + node.y = radius2 * Math.sin(angle2); + } + if (isNaN(node.vx) || isNaN(node.vy)) { + node.vx = node.vy = 0; + } + } } - return cacheAppend; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lnSxc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicEqualAreaJsDefault.default)().parallels([ - 29.5, - 45.5 - ]).scale(1070).translate([ - 480, - 250 - ]).rotate([ - 96, - 0 - ]).center([ - -0.6, - 38.7 - ]); - }); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); - -},{"./conicEqualArea.js":"g4p5m","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g4p5m":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEqualAreaRaw", ()=>conicEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEqualAreaRaw).scale(155.424).center([ - 0, - 33.6442 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -function conicEqualAreaRaw(y0, y1) { - var sy0 = (0, _mathJs.sin)(y0), n = (sy0 + (0, _mathJs.sin)(y1)) / 2; - // Are the parallels symmetrical around the Equator? - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return (0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)(y0); - var c = 1 + sy0 * (2 * n - sy0), r0 = (0, _mathJs.sqrt)(c) / n; - function project(x, y) { - var r = (0, _mathJs.sqrt)(c - 2 * n * (0, _mathJs.sin)(y)) / n; - return [ - r * (0, _mathJs.sin)(x *= n), - r0 - r * (0, _mathJs.cos)(x) - ]; + function initializeForce(force2) { + if (force2.initialize) force2.initialize(nodes, random2); + return force2; } - project.invert = function(x, y) { - var r0y = r0 - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(r0y)) * (0, _mathJs.sign)(r0y); - if (r0y * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(r0y); - return [ - l / n, - (0, _mathJs.asin)((c - (x * x + r0y * r0y) * n * n) / (2 * n)) - ]; - }; - return project; -} - -},{"../math.js":"kc9MU","./conic.js":"iEvpw","./cylindricalEqualArea.js":"7VwKL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iEvpw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicProjection", ()=>conicProjection); -var _mathJs = require("../math.js"); -var _indexJs = require("./index.js"); -function conicProjection(projectAt) { - var phi0 = 0, phi1 = (0, _mathJs.pi) / 3, m = (0, _indexJs.projectionMutator)(projectAt), p = m(phi0, phi1); - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * (0, _mathJs.radians), phi1 = _[1] * (0, _mathJs.radians)) : [ - phi0 * (0, _mathJs.degrees), - phi1 * (0, _mathJs.degrees) - ]; + initializeNodes(); + return simulation2 = { + tick, + restart: function() { + return stepper.restart(step), simulation2; + }, + stop: function() { + return stepper.stop(), simulation2; + }, + nodes: function(_) { + return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation2) : nodes; + }, + alpha: function(_) { + return arguments.length ? (alpha = +_, simulation2) : alpha; + }, + alphaMin: function(_) { + return arguments.length ? (alphaMin = +_, simulation2) : alphaMin; + }, + alphaDecay: function(_) { + return arguments.length ? (alphaDecay = +_, simulation2) : +alphaDecay; + }, + alphaTarget: function(_) { + return arguments.length ? (alphaTarget = +_, simulation2) : alphaTarget; + }, + velocityDecay: function(_) { + return arguments.length ? (velocityDecay = 1 - _, simulation2) : 1 - velocityDecay; + }, + randomSource: function(_) { + return arguments.length ? (random2 = _, forces.forEach(initializeForce), simulation2) : random2; + }, + force: function(name, _) { + return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation2) : forces.get(name); + }, + find: function(x2, y2, radius2) { + var i = 0, n = nodes.length, dx, dy, d2, node, closest; + if (radius2 == null) radius2 = Infinity; + else radius2 *= radius2; + for (i = 0; i < n; ++i) { + node = nodes[i]; + dx = x2 - node.x; + dy = y2 - node.y; + d2 = dx * dx + dy * dy; + if (d2 < radius2) closest = node, radius2 = d2; + } + return closest; + }, + on: function(name, _) { + return arguments.length > 1 ? (event2.on(name, _), simulation2) : event2.on(name); + } }; - return p; -} - -},{"../math.js":"kc9MU","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7QH2d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>projection); -parcelHelpers.export(exports, "projectionMutator", ()=>projectionMutator); -var _antimeridianJs = require("../clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs = require("../clip/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _composeJs = require("../compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _resampleJs = require("./resample.js"); -var _resampleJsDefault = parcelHelpers.interopDefault(_resampleJs); -var transformRadians = (0, _transformJs.transformer)({ - point: function(x, y) { - this.stream.point(x * (0, _mathJs.radians), y * (0, _mathJs.radians)); - } -}); -function transformRotate(rotate) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); + } + function forceManyBody() { + var nodes, node, random2, alpha, strength = constant$1(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; + function force2(_) { + var i, n = nodes.length, tree2 = quadtree(nodes, x, y).visitAfter(accumulate); + for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree2.visit(apply2); + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node2; + strengths = new Array(n); + for (i = 0; i < n; ++i) node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes); + } + function accumulate(quad2) { + var strength2 = 0, q, c2, weight = 0, x2, y2, i; + if (quad2.length) { + for (x2 = y2 = i = 0; i < 4; ++i) { + if ((q = quad2[i]) && (c2 = Math.abs(q.value))) { + strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y; + } + } + quad2.x = x2 / weight; + quad2.y = y2 / weight; + } else { + q = quad2; + q.x = q.data.x; + q.y = q.data.y; + do + strength2 += strengths[q.data.index]; + while (q = q.next); + } + quad2.value = strength2; + } + function apply2(quad2, x12, _, x2) { + if (!quad2.value) return true; + var x3 = quad2.x - node.x, y2 = quad2.y - node.y, w2 = x2 - x12, l = x3 * x3 + y2 * y2; + if (w2 * w2 / theta2 < l) { + if (l < distanceMax2) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + node.vx += x3 * quad2.value * alpha / l; + node.vy += y2 * quad2.value * alpha / l; } - }); -} -function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; - y *= sy; - return [ - dx + k * x, - dy - k * y - ]; - } - transform.invert = function(x, y) { - return [ - (x - dx) / k * sx, - (dy - y) / k * sy - ]; - }; - return transform; -} -function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); - var cosAlpha = (0, _mathJs.cos)(alpha), sinAlpha = (0, _mathJs.sin)(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform(x, y) { - x *= sx; - y *= sy; - return [ - a * x - b * y + dx, - dy - b * x - a * y - ]; + return true; + } else if (quad2.length || l >= distanceMax2) return; + if (quad2.data !== node || quad2.next) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + } + do + if (quad2.data !== node) { + w2 = strengths[quad2.data.index] * alpha / l; + node.vx += x3 * w2; + node.vy += y2 * w2; + } + while (quad2 = quad2.next); } - transform.invert = function(x, y) { - return [ - sx * (ai * x - bi * y + ci), - sy * (fi - bi * x - ai * y) - ]; + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); }; - return transform; -} -function projection(project) { - return projectionMutator(function() { - return project; - })(); -} -function projectionMutator(projectAt) { - var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = (0, _antimeridianJsDefault.default), x0 = null, y0, x1, y1, postclip = (0, _identityJsDefault.default), delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream; - function projection(point) { - return projectRotateTransform(point[0] * (0, _mathJs.radians), point[1] * (0, _mathJs.radians)); - } - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [ - point[0] * (0, _mathJs.degrees), - point[1] * (0, _mathJs.degrees) - ]; - } - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; }; - projection.preclip = function(_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; + force2.distanceMin = function(_) { + return arguments.length ? (distanceMin2 = _ * _, force2) : Math.sqrt(distanceMin2); }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; + force2.distanceMax = function(_) { + return arguments.length ? (distanceMax2 = _ * _, force2) : Math.sqrt(distanceMax2); }; - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? (0, _circleJsDefault.default)(theta = _ * (0, _mathJs.radians)) : (theta = null, _antimeridianJsDefault.default), reset()) : theta * (0, _mathJs.degrees); + force2.theta = function(_) { + return arguments.length ? (theta2 = _ * _, force2) : Math.sqrt(theta2); }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; + return force2; + } + function forceX(x2) { + var strength = constant$1(0.1), nodes, strengths, xz; + if (typeof x2 !== "function") x2 = constant$1(x2 == null ? 0 : +x2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + xz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(xz[i] = +x2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); }; - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; }; - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [ - x, - y - ]; + force2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : x2; }; - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * (0, _mathJs.radians), phi = _[1] % 360 * (0, _mathJs.radians), recenter()) : [ - lambda * (0, _mathJs.degrees), - phi * (0, _mathJs.degrees) - ]; + return force2; + } + function forceY(y2) { + var strength = constant$1(0.1), nodes, strengths, yz; + if (typeof y2 !== "function") y2 = constant$1(y2 == null ? 0 : +y2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + yz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(yz[i] = +y2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); }; - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * (0, _mathJs.radians), deltaPhi = _[1] % 360 * (0, _mathJs.radians), deltaGamma = _.length > 2 ? _[2] % 360 * (0, _mathJs.radians) : 0, recenter()) : [ - deltaLambda * (0, _mathJs.degrees), - deltaPhi * (0, _mathJs.degrees), - deltaGamma * (0, _mathJs.degrees) - ]; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), recenter()) : alpha * (0, _mathJs.degrees); + force2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : y2; }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; + return force2; + } + const ForceMap = { + center: forceCenter, + collide: forceCollide, + nbody: forceManyBody, + link: forceLink, + x: forceX, + y: forceY + }; + const Forces = "forces", ForceParams = ["alpha", "alphaMin", "alphaTarget", "velocityDecay", "forces"], ForceConfig = ["static", "iterations"], ForceOutput = ["x", "y", "vx", "vy"]; + function Force(params2) { + Transform.call(this, null, params2); + } + Force.Definition = { + "type": "Force", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "static", + "type": "boolean", + "default": false + }, { + "name": "restart", + "type": "boolean", + "default": false + }, { + "name": "iterations", + "type": "number", + "default": 300 + }, { + "name": "alpha", + "type": "number", + "default": 1 + }, { + "name": "alphaMin", + "type": "number", + "default": 1e-3 + }, { + "name": "alphaTarget", + "type": "number", + "default": 0 + }, { + "name": "velocityDecay", + "type": "number", + "default": 0.4 + }, { + "name": "forces", + "type": "param", + "array": true, + "params": [{ + "key": { + "force": "center" + }, + "params": [{ + "name": "x", + "type": "number", + "default": 0 + }, { + "name": "y", + "type": "number", + "default": 0 + }] + }, { + "key": { + "force": "collide" + }, + "params": [{ + "name": "radius", + "type": "number", + "expr": true + }, { + "name": "strength", + "type": "number", + "default": 0.7 + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "nbody" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": -30, + "expr": true + }, { + "name": "theta", + "type": "number", + "default": 0.9 + }, { + "name": "distanceMin", + "type": "number", + "default": 1 + }, { + "name": "distanceMax", + "type": "number" + }] + }, { + "key": { + "force": "link" + }, + "params": [{ + "name": "links", + "type": "data" + }, { + "name": "id", + "type": "field" + }, { + "name": "distance", + "type": "number", + "default": 30, + "expr": true + }, { + "name": "strength", + "type": "number", + "expr": true + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "x" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "x", + "type": "field" + }] + }, { + "key": { + "force": "y" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "y", + "type": "field" + }] + }] + }, { + "name": "as", + "type": "string", + "array": true, + "modify": false, + "default": ForceOutput + }] + }; + inherits(Force, Transform, { + transform(_, pulse2) { + var sim = this.value, change2 = pulse2.changed(pulse2.ADD_REM), params2 = _.modified(ForceParams), iters = _.iterations || 300; + if (!sim) { + this.value = sim = simulation(pulse2.source, _); + sim.on("tick", rerun(pulse2.dataflow, this)); + if (!_.static) { + change2 = true; + sim.tick(); + } + pulse2.modifies("index"); + } else { + if (change2) { + pulse2.modifies("index"); + sim.nodes(pulse2.source); + } + if (params2 || pulse2.changed(pulse2.MOD)) { + setup(sim, _, 0, pulse2); + } + } + if (params2 || change2 || _.modified(ForceConfig) || pulse2.changed() && _.restart) { + sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); + if (_.static) { + for (sim.stop(); --iters >= 0; ) sim.tick(); + } else { + if (sim.stopped()) sim.restart(); + if (!change2) return pulse2.StopPropagation; + } + } + return this.finish(_, pulse2); + }, + finish(_, pulse2) { + const dataflow = pulse2.dataflow; + for (let args = this._argops, j = 0, m2 = args.length, arg; j < m2; ++j) { + arg = args[j]; + if (arg.name !== Forces || arg.op._argval.force !== "link") { + continue; + } + for (var ops2 = arg.op._argops, i = 0, n = ops2.length, op; i < n; ++i) { + if (ops2[i].name === "links" && (op = ops2[i].op.source)) { + dataflow.pulse(op, dataflow.changeset().reflow()); + break; + } + } + } + return pulse2.reflow(_.modified()).modifies(ForceOutput); + } + }); + function rerun(df, op) { + return () => df.touch(op).run(); + } + function simulation(nodes, _) { + const sim = forceSimulation(nodes), stop2 = sim.stop, restart = sim.restart; + let stopped = false; + sim.stopped = () => stopped; + sim.restart = () => (stopped = false, restart()); + sim.stop = () => (stopped = true, stop2()); + return setup(sim, _, true).on("end", () => stopped = true); + } + function setup(sim, _, init2, pulse2) { + var f = array$4(_.forces), i, n, p, name; + for (i = 0, n = ForceParams.length; i < n; ++i) { + p = ForceParams[i]; + if (p !== Forces && _.modified(p)) sim[p](_[p]); + } + for (i = 0, n = f.length; i < n; ++i) { + name = Forces + i; + p = init2 || _.modified(Forces, i) ? getForce(f[i]) : pulse2 && modified(f[i], pulse2) ? sim.force(name) : null; + if (p) sim.force(name, p); + } + for (n = sim.numForces || 0; i < n; ++i) { + sim.force(Forces + i, null); + } + sim.numForces = f.length; + return sim; + } + function modified(f, pulse2) { + var k, v; + for (k in f) { + if (isFunction(v = f[k]) && pulse2.modified(accessorFields(v))) return 1; + } + return 0; + } + function getForce(_) { + var f, p; + if (!has$1(ForceMap, _.force)) { + error("Unrecognized force: " + _.force); + } + f = ForceMap[_.force](); + for (p in _) { + if (isFunction(f[p])) setForceParam(f[p], _[p], _); + } + return f; + } + function setForceParam(f, v, _) { + f(isFunction(v) ? (d2) => v(d2, _) : v); + } + const force = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + force: Force + }, Symbol.toStringTag, { value: "Module" })); + function defaultSeparation$2(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function meanX(children2) { + return children2.reduce(meanXReduce, 0) / children2.length; + } + function meanXReduce(x2, c2) { + return x2 + c2.x; + } + function maxY(children2) { + return 1 + children2.reduce(maxYReduce, 0); + } + function maxYReduce(y2, c2) { + return Math.max(y2, c2.y); + } + function leafLeft(node) { + var children2; + while (children2 = node.children) node = children2[0]; + return node; + } + function leafRight(node) { + var children2; + while (children2 = node.children) node = children2[children2.length - 1]; + return node; + } + function cluster() { + var separation = defaultSeparation$2, dx = 1, dy = 1, nodeSize = false; + function cluster2(root) { + var previousNode, x2 = 0; + root.eachAfter(function(node) { + var children2 = node.children; + if (children2) { + node.x = meanX(children2); + node.y = maxY(children2); + } else { + node.x = previousNode ? x2 += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = leafLeft(root), right = leafRight(root), x02 = left.x - separation(left, right) / 2, x12 = right.x + separation(right, left) / 2; + return root.eachAfter(nodeSize ? function(node) { + node.x = (node.x - root.x) * dx; + node.y = (root.y - node.y) * dy; + } : function(node) { + node.x = (node.x - x02) / (x12 - x02) * dx; + node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; + }); + } + cluster2.separation = function(x2) { + return arguments.length ? (separation = x2, cluster2) : separation; }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; + cluster2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? null : [dx, dy]; }; - projection.precision = function(_) { - return arguments.length ? (projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2 = _ * _), reset()) : (0, _mathJs.sqrt)(delta2); + cluster2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? [dx, dy] : null; }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); + return cluster2; + } + function count(node) { + var sum2 = 0, children2 = node.children, i = children2 && children2.length; + if (!i) sum2 = 1; + else while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + } + function node_count() { + return this.eachAfter(count); + } + function node_each(callback, that) { + let index2 = -1; + for (const node of this) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_eachBefore(callback, that) { + var node = this, nodes = [node], children2, i, index2 = -1; + while (node = nodes.pop()) { + callback.call(that, node, ++index2, this); + if (children2 = node.children) { + for (i = children2.length - 1; i >= 0; --i) { + nodes.push(children2[i]); + } + } + } + return this; + } + function node_eachAfter(callback, that) { + var node = this, nodes = [node], next = [], children2, i, n, index2 = -1; + while (node = nodes.pop()) { + next.push(node); + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + nodes.push(children2[i]); + } + } + } + while (node = next.pop()) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_find(callback, that) { + let index2 = -1; + for (const node of this) { + if (callback.call(that, node, ++index2, this)) { + return node; + } + } + } + function node_sum(value2) { + return this.eachAfter(function(node) { + var sum2 = +value2(node.data) || 0, children2 = node.children, i = children2 && children2.length; + while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + }); + } + function node_sort(compare2) { + return this.eachBefore(function(node) { + if (node.children) { + node.children.sort(compare2); + } + }); + } + function node_path(end) { + var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start]; + while (start !== ancestor) { + start = start.parent; + nodes.push(start); + } + var k = nodes.length; + while (end !== ancestor) { + nodes.splice(k, 0, end); + end = end.parent; + } + return nodes; + } + function leastCommonAncestor(a2, b2) { + if (a2 === b2) return a2; + var aNodes = a2.ancestors(), bNodes = b2.ancestors(), c2 = null; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + while (a2 === b2) { + c2 = a2; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + } + return c2; + } + function node_ancestors() { + var node = this, nodes = [node]; + while (node = node.parent) { + nodes.push(node); + } + return nodes; + } + function node_descendants() { + return Array.from(this); + } + function node_leaves() { + var leaves = []; + this.eachBefore(function(node) { + if (!node.children) { + leaves.push(node); + } + }); + return leaves; + } + function node_links() { + var root = this, links = []; + root.each(function(node) { + if (node !== root) { + links.push({ source: node.parent, target: node }); + } + }); + return links; + } + function* node_iterator() { + var node = this, current, next = [node], children2, i, n; + do { + current = next.reverse(), next = []; + while (node = current.pop()) { + yield node; + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + next.push(children2[i]); + } + } + } + } while (next.length); + } + function hierarchy(data2, children2) { + if (data2 instanceof Map) { + data2 = [void 0, data2]; + if (children2 === void 0) children2 = mapChildren; + } else if (children2 === void 0) { + children2 = objectChildren; + } + var root = new Node$2(data2), node, nodes = [root], child, childs, i, n; + while (node = nodes.pop()) { + if ((childs = children2(node.data)) && (n = (childs = Array.from(childs)).length)) { + node.children = childs; + for (i = n - 1; i >= 0; --i) { + nodes.push(child = childs[i] = new Node$2(childs[i])); + child.parent = node; + child.depth = node.depth + 1; + } + } + } + return root.eachBefore(computeHeight); + } + function node_copy() { + return hierarchy(this).eachBefore(copyData); + } + function objectChildren(d2) { + return d2.children; + } + function mapChildren(d2) { + return Array.isArray(d2) ? d2[1] : null; + } + function copyData(node) { + if (node.data.value !== void 0) node.value = node.data.value; + node.data = node.data.data; + } + function computeHeight(node) { + var height2 = 0; + do + node.height = height2; + while ((node = node.parent) && node.height < ++height2); + } + function Node$2(data2) { + this.data = data2; + this.depth = this.height = 0; + this.parent = null; + } + Node$2.prototype = hierarchy.prototype = { + constructor: Node$2, + count: node_count, + each: node_each, + eachAfter: node_eachAfter, + eachBefore: node_eachBefore, + find: node_find, + sum: node_sum, + sort: node_sort, + path: node_path, + ancestors: node_ancestors, + descendants: node_descendants, + leaves: node_leaves, + links: node_links, + copy: node_copy, + [Symbol.iterator]: node_iterator + }; + function optional(f) { + return f == null ? null : required(f); + } + function required(f) { + if (typeof f !== "function") throw new Error(); + return f; + } + function constantZero() { + return 0; + } + function constant(x2) { + return function() { + return x2; }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); + } + const a = 1664525; + const c = 1013904223; + const m = 4294967296; + function lcg() { + let s2 = 1; + return () => (s2 = (a * s2 + c) % m) / m; + } + function array$2(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function shuffle(array2, random2) { + let m2 = array2.length, t, i; + while (m2) { + i = random2() * m2-- | 0; + t = array2[m2]; + array2[m2] = array2[i]; + array2[i] = t; + } + return array2; + } + function packEncloseRandom(circles, random2) { + var i = 0, n = (circles = shuffle(Array.from(circles), random2)).length, B2 = [], p, e; + while (i < n) { + p = circles[i]; + if (e && enclosesWeak(e, p)) ++i; + else e = encloseBasis(B2 = extendBasis(B2, p)), i = 0; + } + return e; + } + function extendBasis(B2, p) { + var i, j; + if (enclosesWeakAll(p, B2)) return [p]; + for (i = 0; i < B2.length; ++i) { + if (enclosesNot(p, B2[i]) && enclosesWeakAll(encloseBasis2(B2[i], p), B2)) { + return [B2[i], p]; + } + } + for (i = 0; i < B2.length - 1; ++i) { + for (j = i + 1; j < B2.length; ++j) { + if (enclosesNot(encloseBasis2(B2[i], B2[j]), p) && enclosesNot(encloseBasis2(B2[i], p), B2[j]) && enclosesNot(encloseBasis2(B2[j], p), B2[i]) && enclosesWeakAll(encloseBasis3(B2[i], B2[j], p), B2)) { + return [B2[i], B2[j], p]; + } + } + } + throw new Error(); + } + function enclosesNot(a2, b2) { + var dr = a2.r - b2.r, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr < 0 || dr * dr < dx * dx + dy * dy; + } + function enclosesWeak(a2, b2) { + var dr = a2.r - b2.r + Math.max(a2.r, b2.r, 1) * 1e-9, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function enclosesWeakAll(a2, B2) { + for (var i = 0; i < B2.length; ++i) { + if (!enclosesWeak(a2, B2[i])) { + return false; + } + } + return true; + } + function encloseBasis(B2) { + switch (B2.length) { + case 1: + return encloseBasis1(B2[0]); + case 2: + return encloseBasis2(B2[0], B2[1]); + case 3: + return encloseBasis3(B2[0], B2[1], B2[2]); + } + } + function encloseBasis1(a2) { + return { + x: a2.x, + y: a2.y, + r: a2.r }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); + } + function encloseBasis2(a2, b2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x21 = x2 - x12, y21 = y2 - y12, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); + return { + x: (x12 + x2 + x21 / l * r21) / 2, + y: (y12 + y2 + y21 / l * r21) / 2, + r: (l + r1 + r2) / 2 }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); + } + function encloseBasis3(a2, b2, c2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x3 = c2.x, y3 = c2.y, r3 = c2.r, a22 = x12 - x2, a3 = x12 - x3, b22 = y12 - y2, b3 = y12 - y3, c22 = r2 - r1, c3 = r3 - r1, d1 = x12 * x12 + y12 * y12 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b22 - a22 * b3, xa = (b22 * d3 - b3 * d2) / (ab * 2) - x12, xb = (b3 * c22 - b22 * c3) / ab, ya = (a3 * d2 - a22 * d3) / (ab * 2) - y12, yb = (a22 * c3 - a3 * c22) / ab, A5 = xb * xb + yb * yb - 1, B2 = 2 * (r1 + xa * xb + ya * yb), C3 = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A5) > 1e-6 ? (B2 + Math.sqrt(B2 * B2 - 4 * A5 * C3)) / (2 * A5) : C3 / B2); + return { + x: x12 + xa + xb * r, + y: y12 + ya + yb * r, + r }; - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = (0, _rotationJs.rotateRadians)(deltaLambda, deltaPhi, deltaGamma); - projectTransform = (0, _composeJsDefault.default)(project, transform); - projectRotateTransform = (0, _composeJsDefault.default)(rotate, projectTransform); - projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2); - return reset(); - } - function reset() { - cache = cacheStream = null; - return projection; + } + function place(b2, a2, c2) { + var dx = b2.x - a2.x, x2, a22, dy = b2.y - a2.y, y2, b22, d2 = dx * dx + dy * dy; + if (d2) { + a22 = a2.r + c2.r, a22 *= a22; + b22 = b2.r + c2.r, b22 *= b22; + if (a22 > b22) { + x2 = (d2 + b22 - a22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, b22 / d2 - x2 * x2)); + c2.x = b2.x - x2 * dx - y2 * dy; + c2.y = b2.y - x2 * dy + y2 * dx; + } else { + x2 = (d2 + a22 - b22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, a22 / d2 - x2 * x2)); + c2.x = a2.x + x2 * dx - y2 * dy; + c2.y = a2.y + x2 * dy + y2 * dx; + } + } else { + c2.x = a2.x + c2.r; + c2.y = a2.y; } - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; -} - -},{"../clip/antimeridian.js":"6JM2n","../clip/circle.js":"iw60F","../clip/rectangle.js":"4qylb","../compose.js":"P6ZIv","../identity.js":"53el5","../math.js":"kc9MU","../rotation.js":"7JtV8","../transform.js":"7yOQv","./fit.js":"1SqNP","./resample.js":"gyxzZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7yOQv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(methods) { - return { - stream: transformer(methods) - }; - }); -parcelHelpers.export(exports, "transformer", ()=>transformer); -function transformer(methods) { - return function(stream) { - var s = new TransformStream; - for(var key in methods)s[key] = methods[key]; - s.stream = stream; - return s; - }; -} -function TransformStream() {} -TransformStream.prototype = { - constructor: TransformStream, - point: function(x, y) { - this.stream.point(x, y); - }, - sphere: function() { - this.stream.sphere(); - }, - lineStart: function() { - this.stream.lineStart(); - }, - lineEnd: function() { - this.stream.lineEnd(); - }, - polygonStart: function() { - this.stream.polygonStart(); - }, - polygonEnd: function() { - this.stream.polygonEnd(); - } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1SqNP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fitExtent", ()=>fitExtent); -parcelHelpers.export(exports, "fitSize", ()=>fitSize); -parcelHelpers.export(exports, "fitWidth", ()=>fitWidth); -parcelHelpers.export(exports, "fitHeight", ()=>fitHeight); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _boundsJs = require("../path/bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -function fit(projection, fitBounds, object) { - var clip = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([ - 0, - 0 - ]); - if (clip != null) projection.clipExtent(null); - (0, _streamJsDefault.default)(object, projection.stream((0, _boundsJsDefault.default))); - fitBounds((0, _boundsJsDefault.default).result()); - if (clip != null) projection.clipExtent(clip); - return projection; -} -function fitExtent(projection, extent, object) { - return fit(projection, function(b) { - var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitSize(projection, size, object) { - return fitExtent(projection, [ - [ - 0, - 0 - ], - size - ], object); -} -function fitWidth(projection, width, object) { - return fit(projection, function(b) { - var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1]; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitHeight(projection, height, object) { - return fit(projection, function(b) { - var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} - -},{"../stream.js":"hPbYn","../path/bounds.js":"gWZWO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gyxzZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(project, delta2) { - return +delta2 ? resample(project, delta2) : resampleNone(project); - }); -var _cartesianJs = require("../cartesian.js"); -var _mathJs = require("../math.js"); -var _transformJs = require("../transform.js"); -var maxDepth = 16, cosMinDistance = (0, _mathJs.cos)(30 * (0, _mathJs.radians)); // cos(minimum angular distance) -function resampleNone(project) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); -} -function resample(project, delta2) { - function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = (0, _mathJs.sqrt)(a * a + b * b + c * c), phi2 = (0, _mathJs.asin)(c /= m), lambda2 = (0, _mathJs.abs)((0, _mathJs.abs)(c) - 1) < (0, _mathJs.epsilon) || (0, _mathJs.abs)(lambda0 - lambda1) < (0, _mathJs.epsilon) ? (lambda0 + lambda1) / 2 : (0, _mathJs.atan2)(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > delta2 // perpendicular projected distance - || (0, _mathJs.abs)((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } + } + function intersects(a2, b2) { + var dr = a2.r + b2.r - 1e-6, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function score(node) { + var a2 = node._, b2 = node.next._, ab = a2.r + b2.r, dx = (a2.x * b2.r + b2.x * a2.r) / ab, dy = (a2.y * b2.r + b2.y * a2.r) / ab; + return dx * dx + dy * dy; + } + function Node$1(circle2) { + this._ = circle2; + this.next = null; + this.previous = null; + } + function packSiblingsRandom(circles, random2) { + if (!(n = (circles = array$2(circles)).length)) return 0; + var a2, b2, c2, n, aa, ca, i, j, k, sj, sk; + a2 = circles[0], a2.x = 0, a2.y = 0; + if (!(n > 1)) return a2.r; + b2 = circles[1], a2.x = -b2.r, b2.x = a2.r, b2.y = 0; + if (!(n > 2)) return a2.r + b2.r; + place(b2, a2, c2 = circles[2]); + a2 = new Node$1(a2), b2 = new Node$1(b2), c2 = new Node$1(c2); + a2.next = c2.previous = b2; + b2.next = a2.previous = c2; + c2.next = b2.previous = a2; + pack: for (i = 3; i < n; ++i) { + place(a2._, b2._, c2 = circles[i]), c2 = new Node$1(c2); + j = b2.next, k = a2.previous, sj = b2._.r, sk = a2._.r; + do { + if (sj <= sk) { + if (intersects(j._, c2._)) { + b2 = j, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sj += j._.r, j = j.next; + } else { + if (intersects(k._, c2._)) { + a2 = k, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sk += k._.r, k = k.previous; + } + } while (j !== k.next); + c2.previous = a2, c2.next = b2, a2.next = b2.previous = b2 = c2; + aa = score(a2); + while ((c2 = c2.next) !== b2) { + if ((ca = score(c2)) < aa) { + a2 = c2, aa = ca; } + } + b2 = a2.next; } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, lambda0, x0, y0, a0, b0, c0; // previous point - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - stream.polygonStart(); - resampleStream.lineStart = ringStart; - }, - polygonEnd: function() { - stream.polygonEnd(); - resampleStream.lineStart = lineStart; - } - }; - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - function linePoint(lambda, phi) { - var c = (0, _cartesianJs.cartesian)([ - lambda, - phi - ]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - return resampleStream; - }; -} - -},{"../cartesian.js":"9WnrC","../math.js":"kc9MU","../transform.js":"7yOQv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7VwKL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cylindricalEqualAreaRaw", ()=>cylindricalEqualAreaRaw); -var _mathJs = require("../math.js"); -function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = (0, _mathJs.cos)(phi0); - function forward(lambda, phi) { - return [ - lambda * cosPhi0, - (0, _mathJs.sin)(phi) / cosPhi0 - ]; + a2 = [b2._], c2 = b2; + while ((c2 = c2.next) !== b2) a2.push(c2._); + c2 = packEncloseRandom(a2, random2); + for (i = 0; i < n; ++i) a2 = circles[i], a2.x -= c2.x, a2.y -= c2.y; + return c2.r; + } + function defaultRadius(d2) { + return Math.sqrt(d2.value); + } + function pack() { + var radius2 = null, dx = 1, dy = 1, padding2 = constantZero; + function pack2(root) { + const random2 = lcg(); + root.x = dx / 2, root.y = dy / 2; + if (radius2) { + root.eachBefore(radiusLeaf(radius2)).eachAfter(packChildrenRandom(padding2, 0.5, random2)).eachBefore(translateChild(1)); + } else { + root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero, 1, random2)).eachAfter(packChildrenRandom(padding2, root.r / Math.min(dx, dy), random2)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); + } + return root; } - forward.invert = function(x, y) { - return [ - x / cosPhi0, - (0, _mathJs.asin)(y * cosPhi0) - ]; + pack2.radius = function(x2) { + return arguments.length ? (radius2 = optional(x2), pack2) : radius2; }; - return forward; -} - -},{"../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3HuY2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A composite projection for the United States, configured by default for -// 960×500. The projection also works quite well at 960×600 if you change the -// scale to 1285 and adjust the translate accordingly. The set of standard -// parallels for each region comes from USGS, which is published here: -// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers -parcelHelpers.export(exports, "default", ()=>function() { - var cache, cacheStream, lower48 = (0, _albersJsDefault.default)(), lower48Point, alaska = (0, _conicEqualAreaJsDefault.default)().rotate([ - 154, - 0 - ]).center([ - -2, - 58.5 - ]).parallels([ - 55, - 65 - ]), alaskaPoint, hawaii = (0, _conicEqualAreaJsDefault.default)().rotate([ - 157, - 0 - ]).center([ - -3, - 19.9 - ]).parallels([ - 8, - 18 - ]), hawaiiPoint, point, pointStream = { - point: function(x, y) { - point = [ - x, - y - ]; - } - }; - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point); - } - albersUsa.invert = function(coordinates) { - var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; - return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates); - }; - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([ - lower48.stream(cacheStream = stream), - alaska.stream(stream), - hawaii.stream(stream) - ]); - }; - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - albersUsa.scale = function(_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); - return albersUsa.translate(lower48.translate()); - }; - albersUsa.translate = function(_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([ - [ - x - 0.455 * k, - y - 0.238 * k - ], - [ - x + 0.455 * k, - y + 0.238 * k - ] - ]).stream(pointStream); - alaskaPoint = alaska.translate([ - x - 0.307 * k, - y + 0.201 * k - ]).clipExtent([ - [ - x - 0.425 * k + (0, _mathJs.epsilon), - y + 0.120 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.214 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - hawaiiPoint = hawaii.translate([ - x - 0.205 * k, - y + 0.212 * k - ]).clipExtent([ - [ - x - 0.214 * k + (0, _mathJs.epsilon), - y + 0.166 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.115 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - return reset(); - }; - albersUsa.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(albersUsa, extent, object); - }; - albersUsa.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(albersUsa, size, object); - }; - albersUsa.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(albersUsa, width, object); - }; - albersUsa.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(albersUsa, height, object); - }; - function reset() { - cache = cacheStream = null; - return albersUsa; - } - return albersUsa.scale(1070); - }); -var _mathJs = require("../math.js"); -var _albersJs = require("./albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _fitJs = require("./fit.js"); -// The projections must have mutually exclusive clip regions on the sphere, -// as this will avoid emitting interleaving lines and polygons. -function multiplex(streams) { - var n = streams.length; - return { - point: function(x, y) { - var i = -1; - while(++i < n)streams[i].point(x, y); - }, - sphere: function() { - var i = -1; - while(++i < n)streams[i].sphere(); - }, - lineStart: function() { - var i = -1; - while(++i < n)streams[i].lineStart(); - }, - lineEnd: function() { - var i = -1; - while(++i < n)streams[i].lineEnd(); - }, - polygonStart: function() { - var i = -1; - while(++i < n)streams[i].polygonStart(); - }, - polygonEnd: function() { - var i = -1; - while(++i < n)streams[i].polygonEnd(); - } - }; -} - -},{"../math.js":"kc9MU","./albers.js":"lnSxc","./conicEqualArea.js":"g4p5m","./fit.js":"1SqNP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"02C8V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEqualAreaRaw", ()=>azimuthalEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEqualAreaRaw).scale(124.75).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEqualAreaRaw = (0, _azimuthalJs.azimuthalRaw)(function(cxcy) { - return (0, _mathJs.sqrt)(2 / (1 + cxcy)); -}); -azimuthalEqualAreaRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.asin)(z / 2); -}); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ej3I1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalRaw", ()=>azimuthalRaw); -parcelHelpers.export(exports, "azimuthalInvert", ()=>azimuthalInvert); -var _mathJs = require("../math.js"); -function azimuthalRaw(scale) { - return function(x, y) { - var cx = (0, _mathJs.cos)(x), cy = (0, _mathJs.cos)(y), k = scale(cx * cy); - if (k === Infinity) return [ - 2, - 0 - ]; - return [ - k * cy * (0, _mathJs.sin)(x), - k * (0, _mathJs.sin)(y) - ]; + pack2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], pack2) : [dx, dy]; }; -} -function azimuthalInvert(angle) { - return function(x, y) { - var z = (0, _mathJs.sqrt)(x * x + y * y), c = angle(z), sc = (0, _mathJs.sin)(c), cc = (0, _mathJs.cos)(c); - return [ - (0, _mathJs.atan2)(x * sc, z * cc), - (0, _mathJs.asin)(z && y * sc / z) - ]; + pack2.padding = function(x2) { + return arguments.length ? (padding2 = typeof x2 === "function" ? x2 : constant(+x2), pack2) : padding2; }; -} - -},{"../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7a1uH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEquidistantRaw", ()=>azimuthalEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEquidistantRaw).scale(79.4188).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEquidistantRaw = (0, _azimuthalJs.azimuthalRaw)(function(c) { - return (c = (0, _mathJs.acos)(c)) && c / (0, _mathJs.sin)(c); -}); -azimuthalEquidistantRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return z; -}); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7BV5L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicConformalRaw", ()=>conicConformalRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicConformalRaw).scale(109.5).parallels([ - 30, - 30 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _mercatorJs = require("./mercator.js"); -function tany(y) { - return (0, _mathJs.tan)(((0, _mathJs.halfPi) + y) / 2); -} -function conicConformalRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (0, _mathJs.log)(cy0 / (0, _mathJs.cos)(y1)) / (0, _mathJs.log)(tany(y1) / tany(y0)), f = cy0 * (0, _mathJs.pow)(tany(y0), n) / n; - if (!n) return 0, _mercatorJs.mercatorRaw; - function project(x, y) { - if (f > 0) { - if (y < -(0, _mathJs.halfPi) + (0, _mathJs.epsilon)) y = -(0, _mathJs.halfPi) + (0, _mathJs.epsilon); - } else if (y > (0, _mathJs.halfPi) - (0, _mathJs.epsilon)) y = (0, _mathJs.halfPi) - (0, _mathJs.epsilon); - var r = f / (0, _mathJs.pow)(tany(y), n); - return [ - r * (0, _mathJs.sin)(n * x), - f - r * (0, _mathJs.cos)(n * x) - ]; - } - project.invert = function(x, y) { - var fy = f - y, r = (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + fy * fy), l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(fy)) * (0, _mathJs.sign)(fy); - if (fy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(fy); - return [ - l / n, - 2 * (0, _mathJs.atan)((0, _mathJs.pow)(f / r, 1 / n)) - (0, _mathJs.halfPi) - ]; + return pack2; + } + function radiusLeaf(radius2) { + return function(node) { + if (!node.children) { + node.r = Math.max(0, +radius2(node) || 0); + } }; - return project; -} - -},{"../math.js":"kc9MU","./conic.js":"iEvpw","./mercator.js":"a3UOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a3UOt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mercatorRaw", ()=>mercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return mercatorProjection(mercatorRaw).scale(961 / (0, _mathJs.tau)); - }); -parcelHelpers.export(exports, "mercatorProjection", ()=>mercatorProjection); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function mercatorRaw(lambda, phi) { - return [ - lambda, - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)) - ]; -} -mercatorRaw.invert = function(x, y) { - return [ - x, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(y)) - (0, _mathJs.halfPi) - ]; -}; -function mercatorProjection(project) { - var m = (0, _indexJsDefault.default)(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x0 = null, y0, x1, y1; // clip extent - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - m.clipExtent = function(_) { - return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; + } + function packChildrenRandom(padding2, k, random2) { + return function(node) { + if (children2 = node.children) { + var children2, i, n = children2.length, r = padding2(node) * k || 0, e; + if (r) for (i = 0; i < n; ++i) children2[i].r += r; + e = packSiblingsRandom(children2, random2); + if (r) for (i = 0; i < n; ++i) children2[i].r -= r; + node.r = e + r; + } }; - function reclip() { - var k = (0, _mathJs.pi) * scale(), t = m((0, _rotationJsDefault.default)(m.rotate()).invert([ - 0, - 0 - ])); - return clipExtent(x0 == null ? [ - [ - t[0] - k, - t[1] - k - ], - [ - t[0] + k, - t[1] + k - ] - ] : project === mercatorRaw ? [ - [ - Math.max(t[0] - k, x0), - y0 - ], - [ - Math.min(t[0] + k, x1), - y1 - ] - ] : [ - [ - x0, - Math.max(t[1] - k, y0) - ], - [ - x1, - Math.min(t[1] + k, y1) - ] - ]); - } - return reclip(); -} - -},{"../math.js":"kc9MU","../rotation.js":"7JtV8","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9oUmd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEquidistantRaw", ()=>conicEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEquidistantRaw).scale(131.154).center([ - 0, - 13.9389 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _equirectangularJs = require("./equirectangular.js"); -function conicEquidistantRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (cy0 - (0, _mathJs.cos)(y1)) / (y1 - y0), g = cy0 / n + y0; - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return 0, _equirectangularJs.equirectangularRaw; - function project(x, y) { - var gy = g - y, nx = n * x; - return [ - gy * (0, _mathJs.sin)(nx), - g - gy * (0, _mathJs.cos)(nx) - ]; - } - project.invert = function(x, y) { - var gy = g - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(gy)) * (0, _mathJs.sign)(gy); - if (gy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(gy); - return [ - l / n, - g - (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + gy * gy) - ]; + } + function translateChild(k) { + return function(node) { + var parent = node.parent; + node.r *= k; + if (parent) { + node.x = parent.x + k * node.x; + node.y = parent.y + k * node.y; + } }; - return project; -} - -},{"../math.js":"kc9MU","./conic.js":"iEvpw","./equirectangular.js":"73t8d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73t8d":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equirectangularRaw", ()=>equirectangularRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equirectangularRaw).scale(152.63); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function equirectangularRaw(lambda, phi) { - return [ - lambda, - phi - ]; -} -equirectangularRaw.invert = equirectangularRaw; - -},{"./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eILUC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equalEarthRaw", ()=>equalEarthRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equalEarthRaw).scale(177.158); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -var A1 = 1.340264, A2 = -0.081106, A3 = 0.000893, A4 = 0.003796, M = (0, _mathJs.sqrt)(3) / 2, iterations = 12; -function equalEarthRaw(lambda, phi) { - var l = (0, _mathJs.asin)(M * (0, _mathJs.sin)(phi)), l2 = l * l, l6 = l2 * l2 * l2; - return [ - lambda * (0, _mathJs.cos)(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), - l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - ]; -} -equalEarthRaw.invert = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for(var i = 0, delta, fy, fpy; i < iterations; ++i){ - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if ((0, _mathJs.abs)(delta) < (0, _mathJs.epsilon2)) break; - } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / (0, _mathJs.cos)(l), - (0, _mathJs.asin)((0, _mathJs.sin)(l) / M) - ]; -}; - -},{"./index.js":"7QH2d","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93udH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gnomonicRaw", ()=>gnomonicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(gnomonicRaw).scale(144.049).clipAngle(60); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function gnomonicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -gnomonicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.atan)); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9vqqR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x0 = null, y0, x1, y1, kx = 1, ky = 1, transform = (0, _transformJs.transformer)({ - point: function(x, y) { - var p = projection([ - x, - y - ]); - this.stream.point(p[0], p[1]); - } - }), postclip = (0, _identityJsDefault.default), cache, cacheStream; - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - function projection(p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [ - x + tx, - y + ty - ]; - } - projection.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [ - x / kx, - y / ky - ]; - }; - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [ - tx, - ty - ]; - }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), sa = (0, _mathJs.sin)(alpha), ca = (0, _mathJs.cos)(alpha), reset()) : alpha * (0, _mathJs.degrees); - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); - }; - return projection; - }); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _mathJs = require("../math.js"); - -},{"../clip/rectangle.js":"4qylb","../identity.js":"53el5","../transform.js":"7yOQv","./fit.js":"1SqNP","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erpNS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "naturalEarth1Raw", ()=>naturalEarth1Raw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(naturalEarth1Raw).scale(175.295); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; -} -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.045255 + phi4 * (-0.311325 + 0.259866 * phi2 - 0.005916 * 11 * phi4))); - }while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; -}; - -},{"./index.js":"7QH2d","../math.js":"kc9MU","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7NqTM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orthographicRaw", ()=>orthographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(orthographicRaw).scale(249.5).clipAngle(90 + (0, _mathJs.epsilon)); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function orthographicRaw(x, y) { - return [ - (0, _mathJs.cos)(y) * (0, _mathJs.sin)(x), - (0, _mathJs.sin)(y) - ]; -} -orthographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.asin)); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"grd1o":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "stereographicRaw", ()=>stereographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(stereographicRaw).scale(250).clipAngle(142); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function stereographicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = 1 + (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -stereographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.atan)(z); -}); - -},{"../math.js":"kc9MU","./azimuthal.js":"ej3I1","./index.js":"7QH2d","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"93Ws5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "transverseMercatorRaw", ()=>transverseMercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - var m = (0, _mercatorJs.mercatorProjection)(transverseMercatorRaw), center = m.center, rotate = m.rotate; - m.center = function(_) { - return arguments.length ? center([ - -_[1], - _[0] - ]) : (_ = center(), [ - _[1], - -_[0] - ]); - }; - m.rotate = function(_) { - return arguments.length ? rotate([ - _[0], - _[1], - _.length > 2 ? _[2] + 90 : 90 - ]) : (_ = rotate(), [ - _[0], - _[1], - _[2] - 90 - ]); - }; - return rotate([ - 0, - 0, - 90 - ]).scale(159.155); - }); -var _mathJs = require("../math.js"); -var _mercatorJs = require("./mercator.js"); -function transverseMercatorRaw(lambda, phi) { - return [ - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)), - -lambda - ]; -} -transverseMercatorRaw.invert = function(x, y) { - return [ - -y, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(x)) - (0, _mathJs.halfPi) - ]; -}; - -},{"../math.js":"kc9MU","./mercator.js":"a3UOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fqIqT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoAiry", ()=>(0, _airyJsDefault.default)); -parcelHelpers.export(exports, "geoAiryRaw", ()=>(0, _airyJs.airyRaw)); -parcelHelpers.export(exports, "geoAitoff", ()=>(0, _aitoffJsDefault.default)); -parcelHelpers.export(exports, "geoAitoffRaw", ()=>(0, _aitoffJs.aitoffRaw)); -parcelHelpers.export(exports, "geoArmadillo", ()=>(0, _armadilloJsDefault.default)); -parcelHelpers.export(exports, "geoArmadilloRaw", ()=>(0, _armadilloJs.armadilloRaw)); -parcelHelpers.export(exports, "geoAugust", ()=>(0, _augustJsDefault.default)); -parcelHelpers.export(exports, "geoAugustRaw", ()=>(0, _augustJs.augustRaw)); -parcelHelpers.export(exports, "geoBaker", ()=>(0, _bakerJsDefault.default)); -parcelHelpers.export(exports, "geoBakerRaw", ()=>(0, _bakerJs.bakerRaw)); -parcelHelpers.export(exports, "geoBerghaus", ()=>(0, _berghausJsDefault.default)); -parcelHelpers.export(exports, "geoBerghausRaw", ()=>(0, _berghausJs.berghausRaw)); -parcelHelpers.export(exports, "geoBertin1953", ()=>(0, _bertinJsDefault.default)); -parcelHelpers.export(exports, "geoBertin1953Raw", ()=>(0, _bertinJs.bertin1953Raw)); -parcelHelpers.export(exports, "geoBoggs", ()=>(0, _boggsJsDefault.default)); -parcelHelpers.export(exports, "geoBoggsRaw", ()=>(0, _boggsJs.boggsRaw)); -parcelHelpers.export(exports, "geoBonne", ()=>(0, _bonneJsDefault.default)); -parcelHelpers.export(exports, "geoBonneRaw", ()=>(0, _bonneJs.bonneRaw)); -parcelHelpers.export(exports, "geoBottomley", ()=>(0, _bottomleyJsDefault.default)); -parcelHelpers.export(exports, "geoBottomleyRaw", ()=>(0, _bottomleyJs.bottomleyRaw)); -parcelHelpers.export(exports, "geoBromley", ()=>(0, _bromleyJsDefault.default)); -parcelHelpers.export(exports, "geoBromleyRaw", ()=>(0, _bromleyJs.bromleyRaw)); -parcelHelpers.export(exports, "geoChamberlin", ()=>(0, _chamberlinJsDefault.default)); -parcelHelpers.export(exports, "geoChamberlinRaw", ()=>(0, _chamberlinJs.chamberlinRaw)); -parcelHelpers.export(exports, "geoChamberlinAfrica", ()=>(0, _chamberlinJs.chamberlinAfrica)); -parcelHelpers.export(exports, "geoCollignon", ()=>(0, _collignonJsDefault.default)); -parcelHelpers.export(exports, "geoCollignonRaw", ()=>(0, _collignonJs.collignonRaw)); -parcelHelpers.export(exports, "geoCraig", ()=>(0, _craigJsDefault.default)); -parcelHelpers.export(exports, "geoCraigRaw", ()=>(0, _craigJs.craigRaw)); -parcelHelpers.export(exports, "geoCraster", ()=>(0, _crasterJsDefault.default)); -parcelHelpers.export(exports, "geoCrasterRaw", ()=>(0, _crasterJs.crasterRaw)); -parcelHelpers.export(exports, "geoCylindricalEqualArea", ()=>(0, _cylindricalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalEqualAreaRaw", ()=>(0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)); -parcelHelpers.export(exports, "geoCylindricalStereographic", ()=>(0, _cylindricalStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalStereographicRaw", ()=>(0, _cylindricalStereographicJs.cylindricalStereographicRaw)); -parcelHelpers.export(exports, "geoEckert1", ()=>(0, _eckert1JsDefault.default)); -parcelHelpers.export(exports, "geoEckert1Raw", ()=>(0, _eckert1Js.eckert1Raw)); -parcelHelpers.export(exports, "geoEckert2", ()=>(0, _eckert2JsDefault.default)); -parcelHelpers.export(exports, "geoEckert2Raw", ()=>(0, _eckert2Js.eckert2Raw)); -parcelHelpers.export(exports, "geoEckert3", ()=>(0, _eckert3JsDefault.default)); -parcelHelpers.export(exports, "geoEckert3Raw", ()=>(0, _eckert3Js.eckert3Raw)); -parcelHelpers.export(exports, "geoEckert4", ()=>(0, _eckert4JsDefault.default)); -parcelHelpers.export(exports, "geoEckert4Raw", ()=>(0, _eckert4Js.eckert4Raw)); -parcelHelpers.export(exports, "geoEckert5", ()=>(0, _eckert5JsDefault.default)); -parcelHelpers.export(exports, "geoEckert5Raw", ()=>(0, _eckert5Js.eckert5Raw)); -parcelHelpers.export(exports, "geoEckert6", ()=>(0, _eckert6JsDefault.default)); -parcelHelpers.export(exports, "geoEckert6Raw", ()=>(0, _eckert6Js.eckert6Raw)); -parcelHelpers.export(exports, "geoEisenlohr", ()=>(0, _eisenlohrJsDefault.default)); -parcelHelpers.export(exports, "geoEisenlohrRaw", ()=>(0, _eisenlohrJs.eisenlohrRaw)); -parcelHelpers.export(exports, "geoFahey", ()=>(0, _faheyJsDefault.default)); -parcelHelpers.export(exports, "geoFaheyRaw", ()=>(0, _faheyJs.faheyRaw)); -parcelHelpers.export(exports, "geoFoucaut", ()=>(0, _foucautJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautRaw", ()=>(0, _foucautJs.foucautRaw)); -parcelHelpers.export(exports, "geoFoucautSinusoidal", ()=>(0, _foucautSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautSinusoidalRaw", ()=>(0, _foucautSinusoidalJs.foucautSinusoidalRaw)); -parcelHelpers.export(exports, "geoGilbert", ()=>(0, _gilbertJsDefault.default)); -parcelHelpers.export(exports, "geoGingery", ()=>(0, _gingeryJsDefault.default)); -parcelHelpers.export(exports, "geoGingeryRaw", ()=>(0, _gingeryJs.gingeryRaw)); -parcelHelpers.export(exports, "geoGinzburg4", ()=>(0, _ginzburg4JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg4Raw", ()=>(0, _ginzburg4Js.ginzburg4Raw)); -parcelHelpers.export(exports, "geoGinzburg5", ()=>(0, _ginzburg5JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg5Raw", ()=>(0, _ginzburg5Js.ginzburg5Raw)); -parcelHelpers.export(exports, "geoGinzburg6", ()=>(0, _ginzburg6JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg6Raw", ()=>(0, _ginzburg6Js.ginzburg6Raw)); -parcelHelpers.export(exports, "geoGinzburg8", ()=>(0, _ginzburg8JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg8Raw", ()=>(0, _ginzburg8Js.ginzburg8Raw)); -parcelHelpers.export(exports, "geoGinzburg9", ()=>(0, _ginzburg9JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg9Raw", ()=>(0, _ginzburg9Js.ginzburg9Raw)); -parcelHelpers.export(exports, "geoGringorten", ()=>(0, _gringortenJsDefault.default)); -parcelHelpers.export(exports, "geoGringortenRaw", ()=>(0, _gringortenJs.gringortenRaw)); -parcelHelpers.export(exports, "geoGuyou", ()=>(0, _guyouJsDefault.default)); -parcelHelpers.export(exports, "geoGuyouRaw", ()=>(0, _guyouJs.guyouRaw)); -parcelHelpers.export(exports, "geoHammer", ()=>(0, _hammerJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRaw", ()=>(0, _hammerJs.hammerRaw)); -parcelHelpers.export(exports, "geoHammerRetroazimuthal", ()=>(0, _hammerRetroazimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRetroazimuthalRaw", ()=>(0, _hammerRetroazimuthalJs.hammerRetroazimuthalRaw)); -parcelHelpers.export(exports, "geoHealpix", ()=>(0, _healpixJsDefault.default)); -parcelHelpers.export(exports, "geoHealpixRaw", ()=>(0, _healpixJs.healpixRaw)); -parcelHelpers.export(exports, "geoHill", ()=>(0, _hillJsDefault.default)); -parcelHelpers.export(exports, "geoHillRaw", ()=>(0, _hillJs.hillRaw)); -parcelHelpers.export(exports, "geoHomolosine", ()=>(0, _homolosineJsDefault.default)); -parcelHelpers.export(exports, "geoHomolosineRaw", ()=>(0, _homolosineJs.homolosineRaw)); -parcelHelpers.export(exports, "geoHufnagel", ()=>(0, _hufnagelJsDefault.default)); -parcelHelpers.export(exports, "geoHufnagelRaw", ()=>(0, _hufnagelJs.hufnagelRaw)); -parcelHelpers.export(exports, "geoHyperelliptical", ()=>(0, _hyperellipticalJsDefault.default)); -parcelHelpers.export(exports, "geoHyperellipticalRaw", ()=>(0, _hyperellipticalJs.hyperellipticalRaw)); -parcelHelpers.export(exports, "geoInterrupt", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedBoggs", ()=>(0, _boggsJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedHomolosine", ()=>(0, _homolosineJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedMollweide", ()=>(0, _mollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedMollweideHemispheres", ()=>(0, _mollweideHemispheresJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinuMollweide", ()=>(0, _sinuMollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinusoidal", ()=>(0, _sinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7", ()=>(0, _kavrayskiy7JsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7Raw", ()=>(0, _kavrayskiy7Js.kavrayskiy7Raw)); -parcelHelpers.export(exports, "geoLagrange", ()=>(0, _lagrangeJsDefault.default)); -parcelHelpers.export(exports, "geoLagrangeRaw", ()=>(0, _lagrangeJs.lagrangeRaw)); -parcelHelpers.export(exports, "geoLarrivee", ()=>(0, _larriveeJsDefault.default)); -parcelHelpers.export(exports, "geoLarriveeRaw", ()=>(0, _larriveeJs.larriveeRaw)); -parcelHelpers.export(exports, "geoLaskowski", ()=>(0, _laskowskiJsDefault.default)); -parcelHelpers.export(exports, "geoLaskowskiRaw", ()=>(0, _laskowskiJs.laskowskiRaw)); -parcelHelpers.export(exports, "geoLittrow", ()=>(0, _littrowJsDefault.default)); -parcelHelpers.export(exports, "geoLittrowRaw", ()=>(0, _littrowJs.littrowRaw)); -parcelHelpers.export(exports, "geoLoximuthal", ()=>(0, _loximuthalJsDefault.default)); -parcelHelpers.export(exports, "geoLoximuthalRaw", ()=>(0, _loximuthalJs.loximuthalRaw)); -parcelHelpers.export(exports, "geoMiller", ()=>(0, _millerJsDefault.default)); -parcelHelpers.export(exports, "geoMillerRaw", ()=>(0, _millerJs.millerRaw)); -parcelHelpers.export(exports, "geoModifiedStereographic", ()=>(0, _modifiedStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoModifiedStereographicRaw", ()=>(0, _modifiedStereographicJs.modifiedStereographicRaw)); -parcelHelpers.export(exports, "geoModifiedStereographicAlaska", ()=>(0, _modifiedStereographicJs.modifiedStereographicAlaska)); -parcelHelpers.export(exports, "geoModifiedStereographicGs48", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs48)); -parcelHelpers.export(exports, "geoModifiedStereographicGs50", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs50)); -parcelHelpers.export(exports, "geoModifiedStereographicMiller", ()=>(0, _modifiedStereographicJs.modifiedStereographicMiller)); -parcelHelpers.export(exports, "geoModifiedStereographicLee", ()=>(0, _modifiedStereographicJs.modifiedStereographicLee)); -parcelHelpers.export(exports, "geoMollweide", ()=>(0, _mollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoMollweideRaw", ()=>(0, _mollweideJs1.mollweideRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolic", ()=>(0, _mtFlatPolarParabolicJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolicRaw", ()=>(0, _mtFlatPolarParabolicJs.mtFlatPolarParabolicRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarQuartic", ()=>(0, _mtFlatPolarQuarticJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarQuarticRaw", ()=>(0, _mtFlatPolarQuarticJs.mtFlatPolarQuarticRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidal", ()=>(0, _mtFlatPolarSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidalRaw", ()=>(0, _mtFlatPolarSinusoidalJs.mtFlatPolarSinusoidalRaw)); -parcelHelpers.export(exports, "geoNaturalEarth2", ()=>(0, _naturalEarth2JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth2Raw", ()=>(0, _naturalEarth2Js.naturalEarth2Raw)); -parcelHelpers.export(exports, "geoNellHammer", ()=>(0, _nellHammerJsDefault.default)); -parcelHelpers.export(exports, "geoNellHammerRaw", ()=>(0, _nellHammerJs.nellHammerRaw)); -parcelHelpers.export(exports, "geoInterruptedQuarticAuthalic", ()=>(0, _quarticAuthalicJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosi", ()=>(0, _nicolosiJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosiRaw", ()=>(0, _nicolosiJs.nicolosiRaw)); -parcelHelpers.export(exports, "geoPatterson", ()=>(0, _pattersonJsDefault.default)); -parcelHelpers.export(exports, "geoPattersonRaw", ()=>(0, _pattersonJs.pattersonRaw)); -parcelHelpers.export(exports, "geoPolyconic", ()=>(0, _polyconicJsDefault.default)); -parcelHelpers.export(exports, "geoPolyconicRaw", ()=>(0, _polyconicJs.polyconicRaw)); -parcelHelpers.export(exports, "geoPolyhedral", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralButterfly", ()=>(0, _butterflyJsDefault.default)); -parcelHelpers.export(exports, "geoPolyhedralCollignon", ()=>(0, _collignonJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralWaterman", ()=>(0, _watermanJsDefault.default)); -parcelHelpers.export(exports, "geoProject", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "geoGringortenQuincuncial", ()=>(0, _gringortenJsDefault1.default)); -parcelHelpers.export(exports, "geoPeirceQuincuncial", ()=>(0, _peirceJsDefault.default)); -parcelHelpers.export(exports, "geoQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "geoQuincuncial", ()=>(0, _indexJsDefault3.default)); -parcelHelpers.export(exports, "geoRectangularPolyconic", ()=>(0, _rectangularPolyconicJsDefault.default)); -parcelHelpers.export(exports, "geoRectangularPolyconicRaw", ()=>(0, _rectangularPolyconicJs.rectangularPolyconicRaw)); -parcelHelpers.export(exports, "geoRobinson", ()=>(0, _robinsonJsDefault.default)); -parcelHelpers.export(exports, "geoRobinsonRaw", ()=>(0, _robinsonJs.robinsonRaw)); -parcelHelpers.export(exports, "geoSatellite", ()=>(0, _satelliteJsDefault.default)); -parcelHelpers.export(exports, "geoSatelliteRaw", ()=>(0, _satelliteJs.satelliteRaw)); -parcelHelpers.export(exports, "geoSinuMollweide", ()=>(0, _sinuMollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoSinuMollweideRaw", ()=>(0, _sinuMollweideJs1.sinuMollweideRaw)); -parcelHelpers.export(exports, "geoSinusoidal", ()=>(0, _sinusoidalJsDefault1.default)); -parcelHelpers.export(exports, "geoSinusoidalRaw", ()=>(0, _sinusoidalJs1.sinusoidalRaw)); -parcelHelpers.export(exports, "geoStitch", ()=>(0, _stitchJsDefault.default)); -parcelHelpers.export(exports, "geoTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "geoTimesRaw", ()=>(0, _timesJs.timesRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthal", ()=>(0, _twoPointAzimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalRaw", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalUsa", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalUsa)); -parcelHelpers.export(exports, "geoTwoPointEquidistant", ()=>(0, _twoPointEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointEquidistantRaw", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantRaw)); -parcelHelpers.export(exports, "geoTwoPointEquidistantUsa", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantUsa)); -parcelHelpers.export(exports, "geoVanDerGrinten", ()=>(0, _vanDerGrintenJsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrintenRaw", ()=>(0, _vanDerGrintenJs.vanDerGrintenRaw)); -parcelHelpers.export(exports, "geoVanDerGrinten2", ()=>(0, _vanDerGrinten2JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten2Raw", ()=>(0, _vanDerGrinten2Js.vanDerGrinten2Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten3", ()=>(0, _vanDerGrinten3JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten3Raw", ()=>(0, _vanDerGrinten3Js.vanDerGrinten3Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten4", ()=>(0, _vanDerGrinten4JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten4Raw", ()=>(0, _vanDerGrinten4Js.vanDerGrinten4Raw)); -parcelHelpers.export(exports, "geoWagner", ()=>(0, _wagnerJsDefault.default)); -parcelHelpers.export(exports, "geoWagner7", ()=>(0, _wagnerJs.wagner7)); -parcelHelpers.export(exports, "geoWagnerRaw", ()=>(0, _wagnerJs.wagnerRaw)); -parcelHelpers.export(exports, "geoWagner4", ()=>(0, _wagner4JsDefault.default)); -parcelHelpers.export(exports, "geoWagner4Raw", ()=>(0, _wagner4Js.wagner4Raw)); -parcelHelpers.export(exports, "geoWagner6", ()=>(0, _wagner6JsDefault.default)); -parcelHelpers.export(exports, "geoWagner6Raw", ()=>(0, _wagner6Js.wagner6Raw)); -parcelHelpers.export(exports, "geoWiechel", ()=>(0, _wiechelJsDefault.default)); -parcelHelpers.export(exports, "geoWiechelRaw", ()=>(0, _wiechelJs.wiechelRaw)); -parcelHelpers.export(exports, "geoWinkel3", ()=>(0, _winkel3JsDefault.default)); -parcelHelpers.export(exports, "geoWinkel3Raw", ()=>(0, _winkel3Js.winkel3Raw)); -var _airyJs = require("./airy.js"); -var _airyJsDefault = parcelHelpers.interopDefault(_airyJs); -var _aitoffJs = require("./aitoff.js"); -var _aitoffJsDefault = parcelHelpers.interopDefault(_aitoffJs); -var _armadilloJs = require("./armadillo.js"); -var _armadilloJsDefault = parcelHelpers.interopDefault(_armadilloJs); -var _augustJs = require("./august.js"); -var _augustJsDefault = parcelHelpers.interopDefault(_augustJs); -var _bakerJs = require("./baker.js"); -var _bakerJsDefault = parcelHelpers.interopDefault(_bakerJs); -var _berghausJs = require("./berghaus.js"); -var _berghausJsDefault = parcelHelpers.interopDefault(_berghausJs); -var _bertinJs = require("./bertin.js"); -var _bertinJsDefault = parcelHelpers.interopDefault(_bertinJs); -var _boggsJs = require("./boggs.js"); -var _boggsJsDefault = parcelHelpers.interopDefault(_boggsJs); -var _bonneJs = require("./bonne.js"); -var _bonneJsDefault = parcelHelpers.interopDefault(_bonneJs); -var _bottomleyJs = require("./bottomley.js"); -var _bottomleyJsDefault = parcelHelpers.interopDefault(_bottomleyJs); -var _bromleyJs = require("./bromley.js"); -var _bromleyJsDefault = parcelHelpers.interopDefault(_bromleyJs); -var _chamberlinJs = require("./chamberlin.js"); -var _chamberlinJsDefault = parcelHelpers.interopDefault(_chamberlinJs); -var _collignonJs = require("./collignon.js"); -var _collignonJsDefault = parcelHelpers.interopDefault(_collignonJs); -var _craigJs = require("./craig.js"); -var _craigJsDefault = parcelHelpers.interopDefault(_craigJs); -var _crasterJs = require("./craster.js"); -var _crasterJsDefault = parcelHelpers.interopDefault(_crasterJs); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -var _cylindricalEqualAreaJsDefault = parcelHelpers.interopDefault(_cylindricalEqualAreaJs); -var _cylindricalStereographicJs = require("./cylindricalStereographic.js"); -var _cylindricalStereographicJsDefault = parcelHelpers.interopDefault(_cylindricalStereographicJs); -var _eckert1Js = require("./eckert1.js"); -var _eckert1JsDefault = parcelHelpers.interopDefault(_eckert1Js); -var _eckert2Js = require("./eckert2.js"); -var _eckert2JsDefault = parcelHelpers.interopDefault(_eckert2Js); -var _eckert3Js = require("./eckert3.js"); -var _eckert3JsDefault = parcelHelpers.interopDefault(_eckert3Js); -var _eckert4Js = require("./eckert4.js"); -var _eckert4JsDefault = parcelHelpers.interopDefault(_eckert4Js); -var _eckert5Js = require("./eckert5.js"); -var _eckert5JsDefault = parcelHelpers.interopDefault(_eckert5Js); -var _eckert6Js = require("./eckert6.js"); -var _eckert6JsDefault = parcelHelpers.interopDefault(_eckert6Js); -var _eisenlohrJs = require("./eisenlohr.js"); -var _eisenlohrJsDefault = parcelHelpers.interopDefault(_eisenlohrJs); -var _faheyJs = require("./fahey.js"); -var _faheyJsDefault = parcelHelpers.interopDefault(_faheyJs); -var _foucautJs = require("./foucaut.js"); -var _foucautJsDefault = parcelHelpers.interopDefault(_foucautJs); -var _foucautSinusoidalJs = require("./foucautSinusoidal.js"); -var _foucautSinusoidalJsDefault = parcelHelpers.interopDefault(_foucautSinusoidalJs); -var _gilbertJs = require("./gilbert.js"); -var _gilbertJsDefault = parcelHelpers.interopDefault(_gilbertJs); -var _gingeryJs = require("./gingery.js"); -var _gingeryJsDefault = parcelHelpers.interopDefault(_gingeryJs); -var _ginzburg4Js = require("./ginzburg4.js"); -var _ginzburg4JsDefault = parcelHelpers.interopDefault(_ginzburg4Js); -var _ginzburg5Js = require("./ginzburg5.js"); -var _ginzburg5JsDefault = parcelHelpers.interopDefault(_ginzburg5Js); -var _ginzburg6Js = require("./ginzburg6.js"); -var _ginzburg6JsDefault = parcelHelpers.interopDefault(_ginzburg6Js); -var _ginzburg8Js = require("./ginzburg8.js"); -var _ginzburg8JsDefault = parcelHelpers.interopDefault(_ginzburg8Js); -var _ginzburg9Js = require("./ginzburg9.js"); -var _ginzburg9JsDefault = parcelHelpers.interopDefault(_ginzburg9Js); -var _gringortenJs = require("./gringorten.js"); -var _gringortenJsDefault = parcelHelpers.interopDefault(_gringortenJs); -var _guyouJs = require("./guyou.js"); -var _guyouJsDefault = parcelHelpers.interopDefault(_guyouJs); -var _hammerJs = require("./hammer.js"); -var _hammerJsDefault = parcelHelpers.interopDefault(_hammerJs); -var _hammerRetroazimuthalJs = require("./hammerRetroazimuthal.js"); -var _hammerRetroazimuthalJsDefault = parcelHelpers.interopDefault(_hammerRetroazimuthalJs); -var _healpixJs = require("./healpix.js"); -var _healpixJsDefault = parcelHelpers.interopDefault(_healpixJs); -var _hillJs = require("./hill.js"); -var _hillJsDefault = parcelHelpers.interopDefault(_hillJs); -var _homolosineJs = require("./homolosine.js"); -var _homolosineJsDefault = parcelHelpers.interopDefault(_homolosineJs); -var _hufnagelJs = require("./hufnagel.js"); -var _hufnagelJsDefault = parcelHelpers.interopDefault(_hufnagelJs); -var _hyperellipticalJs = require("./hyperelliptical.js"); -var _hyperellipticalJsDefault = parcelHelpers.interopDefault(_hyperellipticalJs); -var _indexJs = require("./interrupted/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _boggsJs1 = require("./interrupted/boggs.js"); -var _boggsJsDefault1 = parcelHelpers.interopDefault(_boggsJs1); -var _homolosineJs1 = require("./interrupted/homolosine.js"); -var _homolosineJsDefault1 = parcelHelpers.interopDefault(_homolosineJs1); -var _mollweideJs = require("./interrupted/mollweide.js"); -var _mollweideJsDefault = parcelHelpers.interopDefault(_mollweideJs); -var _mollweideHemispheresJs = require("./interrupted/mollweideHemispheres.js"); -var _mollweideHemispheresJsDefault = parcelHelpers.interopDefault(_mollweideHemispheresJs); -var _sinuMollweideJs = require("./interrupted/sinuMollweide.js"); -var _sinuMollweideJsDefault = parcelHelpers.interopDefault(_sinuMollweideJs); -var _sinusoidalJs = require("./interrupted/sinusoidal.js"); -var _sinusoidalJsDefault = parcelHelpers.interopDefault(_sinusoidalJs); -var _kavrayskiy7Js = require("./kavrayskiy7.js"); -var _kavrayskiy7JsDefault = parcelHelpers.interopDefault(_kavrayskiy7Js); -var _lagrangeJs = require("./lagrange.js"); -var _lagrangeJsDefault = parcelHelpers.interopDefault(_lagrangeJs); -var _larriveeJs = require("./larrivee.js"); -var _larriveeJsDefault = parcelHelpers.interopDefault(_larriveeJs); -var _laskowskiJs = require("./laskowski.js"); -var _laskowskiJsDefault = parcelHelpers.interopDefault(_laskowskiJs); -var _littrowJs = require("./littrow.js"); -var _littrowJsDefault = parcelHelpers.interopDefault(_littrowJs); -var _loximuthalJs = require("./loximuthal.js"); -var _loximuthalJsDefault = parcelHelpers.interopDefault(_loximuthalJs); -var _millerJs = require("./miller.js"); -var _millerJsDefault = parcelHelpers.interopDefault(_millerJs); -var _modifiedStereographicJs = require("./modifiedStereographic.js"); -var _modifiedStereographicJsDefault = parcelHelpers.interopDefault(_modifiedStereographicJs); -var _mollweideJs1 = require("./mollweide.js"); -var _mollweideJsDefault1 = parcelHelpers.interopDefault(_mollweideJs1); -var _mtFlatPolarParabolicJs = require("./mtFlatPolarParabolic.js"); -var _mtFlatPolarParabolicJsDefault = parcelHelpers.interopDefault(_mtFlatPolarParabolicJs); -var _mtFlatPolarQuarticJs = require("./mtFlatPolarQuartic.js"); -var _mtFlatPolarQuarticJsDefault = parcelHelpers.interopDefault(_mtFlatPolarQuarticJs); -var _mtFlatPolarSinusoidalJs = require("./mtFlatPolarSinusoidal.js"); -var _mtFlatPolarSinusoidalJsDefault = parcelHelpers.interopDefault(_mtFlatPolarSinusoidalJs); -var _naturalEarth2Js = require("./naturalEarth2.js"); -var _naturalEarth2JsDefault = parcelHelpers.interopDefault(_naturalEarth2Js); -var _nellHammerJs = require("./nellHammer.js"); -var _nellHammerJsDefault = parcelHelpers.interopDefault(_nellHammerJs); -var _quarticAuthalicJs = require("./interrupted/quarticAuthalic.js"); -var _quarticAuthalicJsDefault = parcelHelpers.interopDefault(_quarticAuthalicJs); -var _nicolosiJs = require("./nicolosi.js"); -var _nicolosiJsDefault = parcelHelpers.interopDefault(_nicolosiJs); -var _pattersonJs = require("./patterson.js"); -var _pattersonJsDefault = parcelHelpers.interopDefault(_pattersonJs); -var _polyconicJs = require("./polyconic.js"); -var _polyconicJsDefault = parcelHelpers.interopDefault(_polyconicJs); -var _indexJs1 = require("./polyhedral/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _butterflyJs = require("./polyhedral/butterfly.js"); -var _butterflyJsDefault = parcelHelpers.interopDefault(_butterflyJs); -var _collignonJs1 = require("./polyhedral/collignon.js"); -var _collignonJsDefault1 = parcelHelpers.interopDefault(_collignonJs1); -var _watermanJs = require("./polyhedral/waterman.js"); -var _watermanJsDefault = parcelHelpers.interopDefault(_watermanJs); -var _indexJs2 = require("./project/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _gringortenJs1 = require("./quincuncial/gringorten.js"); -var _gringortenJsDefault1 = parcelHelpers.interopDefault(_gringortenJs1); -var _peirceJs = require("./quincuncial/peirce.js"); -var _peirceJsDefault = parcelHelpers.interopDefault(_peirceJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _indexJs3 = require("./quincuncial/index.js"); -var _indexJsDefault3 = parcelHelpers.interopDefault(_indexJs3); -var _rectangularPolyconicJs = require("./rectangularPolyconic.js"); -var _rectangularPolyconicJsDefault = parcelHelpers.interopDefault(_rectangularPolyconicJs); -var _robinsonJs = require("./robinson.js"); -var _robinsonJsDefault = parcelHelpers.interopDefault(_robinsonJs); -var _satelliteJs = require("./satellite.js"); -var _satelliteJsDefault = parcelHelpers.interopDefault(_satelliteJs); -var _sinuMollweideJs1 = require("./sinuMollweide.js"); -var _sinuMollweideJsDefault1 = parcelHelpers.interopDefault(_sinuMollweideJs1); -var _sinusoidalJs1 = require("./sinusoidal.js"); -var _sinusoidalJsDefault1 = parcelHelpers.interopDefault(_sinusoidalJs1); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -var _timesJs = require("./times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _twoPointAzimuthalJs = require("./twoPointAzimuthal.js"); -var _twoPointAzimuthalJsDefault = parcelHelpers.interopDefault(_twoPointAzimuthalJs); -var _twoPointEquidistantJs = require("./twoPointEquidistant.js"); -var _twoPointEquidistantJsDefault = parcelHelpers.interopDefault(_twoPointEquidistantJs); -var _vanDerGrintenJs = require("./vanDerGrinten.js"); -var _vanDerGrintenJsDefault = parcelHelpers.interopDefault(_vanDerGrintenJs); -var _vanDerGrinten2Js = require("./vanDerGrinten2.js"); -var _vanDerGrinten2JsDefault = parcelHelpers.interopDefault(_vanDerGrinten2Js); -var _vanDerGrinten3Js = require("./vanDerGrinten3.js"); -var _vanDerGrinten3JsDefault = parcelHelpers.interopDefault(_vanDerGrinten3Js); -var _vanDerGrinten4Js = require("./vanDerGrinten4.js"); -var _vanDerGrinten4JsDefault = parcelHelpers.interopDefault(_vanDerGrinten4Js); -var _wagnerJs = require("./wagner.js"); -var _wagnerJsDefault = parcelHelpers.interopDefault(_wagnerJs); -var _wagner4Js = require("./wagner4.js"); -var _wagner4JsDefault = parcelHelpers.interopDefault(_wagner4Js); -var _wagner6Js = require("./wagner6.js"); -var _wagner6JsDefault = parcelHelpers.interopDefault(_wagner6Js); -var _wiechelJs = require("./wiechel.js"); -var _wiechelJsDefault = parcelHelpers.interopDefault(_wiechelJs); -var _winkel3Js = require("./winkel3.js"); -var _winkel3JsDefault = parcelHelpers.interopDefault(_winkel3Js); - -},{"./airy.js":false,"./aitoff.js":false,"./armadillo.js":false,"./august.js":false,"./baker.js":false,"./berghaus.js":false,"./bertin.js":false,"./boggs.js":false,"./bonne.js":false,"./bottomley.js":false,"./bromley.js":false,"./chamberlin.js":false,"./collignon.js":false,"./craig.js":false,"./craster.js":false,"./cylindricalEqualArea.js":false,"./cylindricalStereographic.js":false,"./eckert1.js":false,"./eckert2.js":false,"./eckert3.js":false,"./eckert4.js":false,"./eckert5.js":false,"./eckert6.js":false,"./eisenlohr.js":false,"./fahey.js":false,"./foucaut.js":false,"./foucautSinusoidal.js":false,"./gilbert.js":false,"./gingery.js":false,"./ginzburg4.js":false,"./ginzburg5.js":false,"./ginzburg6.js":false,"./ginzburg8.js":false,"./ginzburg9.js":false,"./gringorten.js":false,"./guyou.js":false,"./hammer.js":false,"./hammerRetroazimuthal.js":false,"./healpix.js":false,"./hill.js":false,"./homolosine.js":false,"./hufnagel.js":false,"./hyperelliptical.js":false,"./interrupted/index.js":false,"./interrupted/boggs.js":false,"./interrupted/homolosine.js":false,"./interrupted/mollweide.js":false,"./interrupted/mollweideHemispheres.js":false,"./interrupted/sinuMollweide.js":false,"./interrupted/sinusoidal.js":false,"./kavrayskiy7.js":false,"./lagrange.js":false,"./larrivee.js":false,"./laskowski.js":false,"./littrow.js":false,"./loximuthal.js":false,"./miller.js":false,"./modifiedStereographic.js":false,"./mollweide.js":"7BhiE","./mtFlatPolarParabolic.js":false,"./mtFlatPolarQuartic.js":false,"./mtFlatPolarSinusoidal.js":false,"./naturalEarth2.js":false,"./nellHammer.js":false,"./interrupted/quarticAuthalic.js":false,"./nicolosi.js":false,"./patterson.js":false,"./polyconic.js":false,"./polyhedral/index.js":false,"./polyhedral/butterfly.js":false,"./polyhedral/collignon.js":false,"./polyhedral/waterman.js":false,"./project/index.js":false,"./quincuncial/gringorten.js":false,"./quincuncial/peirce.js":false,"./quantize.js":false,"./quincuncial/index.js":false,"./rectangularPolyconic.js":false,"./robinson.js":false,"./satellite.js":false,"./sinuMollweide.js":false,"./sinusoidal.js":false,"./stitch.js":false,"./times.js":false,"./twoPointAzimuthal.js":false,"./twoPointEquidistant.js":false,"./vanDerGrinten.js":false,"./vanDerGrinten2.js":false,"./vanDerGrinten3.js":false,"./vanDerGrinten4.js":false,"./wagner.js":false,"./wagner4.js":false,"./wagner6.js":false,"./wiechel.js":false,"./winkel3.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7BhiE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mollweideBromleyTheta", ()=>mollweideBromleyTheta); -parcelHelpers.export(exports, "mollweideBromleyRaw", ()=>mollweideBromleyRaw); -parcelHelpers.export(exports, "mollweideRaw", ()=>mollweideRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _d3Geo.geoProjection)(mollweideRaw).scale(169.529); - }); -var _d3Geo = require("d3-geo"); -var _mathJs = require("./math.js"); -function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * (0, _mathJs.sin)(phi), i = 30, delta; - do phi -= delta = (phi + (0, _mathJs.sin)(phi) - cpsinPhi) / (1 + (0, _mathJs.cos)(phi)); - while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return phi / 2; -} -function mollweideBromleyRaw(cx, cy, cp) { - function forward(lambda, phi) { - return [ - cx * lambda * (0, _mathJs.cos)(phi = mollweideBromleyTheta(cp, phi)), - cy * (0, _mathJs.sin)(phi) - ]; + } + function roundNode(node) { + node.x0 = Math.round(node.x0); + node.y0 = Math.round(node.y0); + node.x1 = Math.round(node.x1); + node.y1 = Math.round(node.y1); + } + function treemapDice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x12 - x02) / parent.value; + while (++i < n) { + node = nodes[i], node.y0 = y02, node.y1 = y12; + node.x0 = x02, node.x1 = x02 += node.value * k; } - forward.invert = function(x, y) { - return y = (0, _mathJs.asin)(y / cy), [ - x / (cx * (0, _mathJs.cos)(y)), - (0, _mathJs.asin)((2 * y + (0, _mathJs.sin)(2 * y)) / cp) - ]; - }; - return forward; -} -var mollweideRaw = mollweideBromleyRaw((0, _mathJs.sqrt2) / (0, _mathJs.halfPi), (0, _mathJs.sqrt2), (0, _mathJs.pi)); - -},{"d3-geo":"8qTbc","./math.js":"1h9uT","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1h9uT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "round", ()=>round); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "sqrt1_2", ()=>sqrt1_2); -parcelHelpers.export(exports, "sqrt2", ()=>sqrt2); -parcelHelpers.export(exports, "sqrtPi", ()=>sqrtPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "sinci", ()=>sinci); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tanh", ()=>tanh); -parcelHelpers.export(exports, "sinh", ()=>sinh); -parcelHelpers.export(exports, "cosh", ()=>cosh); -parcelHelpers.export(exports, "arsinh", ()=>arsinh); -parcelHelpers.export(exports, "arcosh", ()=>arcosh); -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var ceil = Math.ceil; -var cos = Math.cos; -var exp = Math.exp; -var floor = Math.floor; -var log = Math.log; -var max = Math.max; -var min = Math.min; -var pow = Math.pow; -var round = Math.round; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sin = Math.sin; -var tan = Math.tan; -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var sqrt1_2 = Math.SQRT1_2; -var sqrt2 = sqrt(2); -var sqrtPi = sqrt(pi); -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -function sinci(x) { - return x ? x / Math.sin(x) : 1; -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function sqrt(x) { - return x > 0 ? Math.sqrt(x) : 0; -} -function tanh(x) { - x = exp(2 * x); - return (x - 1) / (x + 1); -} -function sinh(x) { - return (exp(x) - exp(-x)) / 2; -} -function cosh(x) { - return (exp(x) + exp(-x)) / 2; -} -function arsinh(x) { - return log(x + sqrt(x * x + 1)); -} -function arcosh(x) { - return log(x + sqrt(x * x - 1)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7a0MQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "force", ()=>Force); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Force = require("d3-force"); -const ForceMap = { - center: (0, _d3Force.forceCenter), - collide: (0, _d3Force.forceCollide), - nbody: (0, _d3Force.forceManyBody), - link: (0, _d3Force.forceLink), - x: (0, _d3Force.forceX), - y: (0, _d3Force.forceY) -}; -const Forces = 'forces', ForceParams = [ - 'alpha', - 'alphaMin', - 'alphaTarget', - 'velocityDecay', - 'forces' -], ForceConfig = [ - 'static', - 'iterations' -], ForceOutput = [ - 'x', - 'y', - 'vx', - 'vy' -]; -/** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<object>} params.forces - The forces to apply. - */ function Force(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Force.Definition = { - 'type': 'Force', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'static', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'restart', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 300 - }, - { - 'name': 'alpha', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'alphaMin', - 'type': 'number', - 'default': 0.001 - }, - { - 'name': 'alphaTarget', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'velocityDecay', - 'type': 'number', - 'default': 0.4 - }, - { - 'name': 'forces', - 'type': 'param', - 'array': true, - 'params': [ - { - 'key': { - 'force': 'center' - }, - 'params': [ - { - 'name': 'x', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'y', - 'type': 'number', - 'default': 0 - } - ] - }, - { - 'key': { - 'force': 'collide' - }, - 'params': [ - { - 'name': 'radius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'default': 0.7 - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'nbody' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': -30, - 'expr': true - }, - { - 'name': 'theta', - 'type': 'number', - 'default': 0.9 - }, - { - 'name': 'distanceMin', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'distanceMax', - 'type': 'number' - } - ] - }, - { - 'key': { - 'force': 'link' - }, - 'params': [ - { - 'name': 'links', - 'type': 'data' - }, - { - 'name': 'id', - 'type': 'field' - }, - { - 'name': 'distance', - 'type': 'number', - 'default': 30, - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'expr': true - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'x' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'x', - 'type': 'field' - } - ] - }, - { - 'key': { - 'force': 'y' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'y', - 'type': 'field' - } - ] - } - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'modify': false, - 'default': ForceOutput + } + function partition$1() { + var dx = 1, dy = 1, padding2 = 0, round = false; + function partition2(root) { + var n = root.height + 1; + root.x0 = root.y0 = padding2; + root.x1 = dx; + root.y1 = dy / n; + root.eachBefore(positionNode(dy, n)); + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(dy2, n) { + return function(node) { + if (node.children) { + treemapDice(node, node.x0, dy2 * (node.depth + 1) / n, node.x1, dy2 * (node.depth + 2) / n); + } + var x02 = node.x0, y02 = node.y0, x12 = node.x1 - padding2, y12 = node.y1 - padding2; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + }; + } + partition2.round = function(x2) { + return arguments.length ? (round = !!x2, partition2) : round; + }; + partition2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], partition2) : [dx, dy]; + }; + partition2.padding = function(x2) { + return arguments.length ? (padding2 = +x2, partition2) : padding2; + }; + return partition2; + } + var preroot = { depth: -1 }, ambiguous = {}, imputed = {}; + function defaultId(d2) { + return d2.id; + } + function defaultParentId(d2) { + return d2.parentId; + } + function stratify() { + var id2 = defaultId, parentId = defaultParentId, path2; + function stratify2(data2) { + var nodes = Array.from(data2), currentId = id2, currentParentId = parentId, n, d2, i, root, parent, node, nodeId, nodeKey, nodeByKey = /* @__PURE__ */ new Map(); + if (path2 != null) { + const I = nodes.map((d3, i2) => normalize(path2(d3, i2, data2))); + const P = I.map(parentof); + const S = new Set(I).add(""); + for (const i2 of P) { + if (!S.has(i2)) { + S.add(i2); + I.push(i2); + P.push(parentof(i2)); + nodes.push(imputed); + } + } + currentId = (_, i2) => I[i2]; + currentParentId = (_, i2) => P[i2]; + } + for (i = 0, n = nodes.length; i < n; ++i) { + d2 = nodes[i], node = nodes[i] = new Node$2(d2); + if ((nodeId = currentId(d2, i, data2)) != null && (nodeId += "")) { + nodeKey = node.id = nodeId; + nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); } - ] -}; -(0, _vegaUtil.inherits)(Force, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sim = this.value, change = pulse.changed(pulse.ADD_REM), params = _.modified(ForceParams), iters = _.iterations || 300; - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); + if ((nodeId = currentParentId(d2, i, data2)) != null && (nodeId += "")) { + node.parent = nodeId; + } + } + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (nodeId = node.parent) { + parent = nodeByKey.get(nodeId); + if (!parent) throw new Error("missing: " + nodeId); + if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); + if (parent.children) parent.children.push(node); + else parent.children = [node]; + node.parent = parent; } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) setup(sim, _, 0, pulse); - } - // run simulation - if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - if (_.static) for(sim.stop(); --iters >= 0;)sim.tick(); - else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } + if (root) throw new Error("multiple roots"); + root = node; } - return this.finish(_, pulse); - }, - finish (_, pulse) { - const dataflow = pulse.dataflow; - // inspect dependencies, touch link source data - for(let args = this._argops, j = 0, m = args.length, arg; j < m; ++j){ - arg = args[j]; - if (arg.name !== Forces || arg.op._argval.force !== 'link') continue; - for(var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i)if (ops[i].name === 'links' && (op = ops[i].op.source)) { - dataflow.pulse(op, dataflow.changeset().reflow()); - break; - } + } + if (!root) throw new Error("no root"); + if (path2 != null) { + while (root.data === imputed && root.children.length === 1) { + root = root.children[0], --n; } - // reflow all nodes - return pulse.reflow(_.modified()).modifies(ForceOutput); + for (let i2 = nodes.length - 1; i2 >= 0; --i2) { + node = nodes[i2]; + if (node.data !== imputed) break; + node.data = null; + } + } + root.parent = preroot; + root.eachBefore(function(node2) { + node2.depth = node2.parent.depth + 1; + --n; + }).eachBefore(computeHeight); + root.parent = null; + if (n > 0) throw new Error("cycle"); + return root; } -}); -function rerun(df, op) { - return ()=>df.touch(op).run(); -} -function simulation(nodes, _) { - const sim = (0, _d3Force.forceSimulation)(nodes), stop = sim.stop, restart = sim.restart; - let stopped = false; - sim.stopped = ()=>stopped; - sim.restart = ()=>(stopped = false, restart()); - sim.stop = ()=>(stopped = true, stop()); - return setup(sim, _, true).on('end', ()=>stopped = true); -} -function setup(sim, _, init, pulse) { - var f = (0, _vegaUtil.array)(_.forces), i, n, p, name; - for(i = 0, n = ForceParams.length; i < n; ++i){ - p = ForceParams[i]; - if (p !== Forces && _.modified(p)) sim[p](_[p]); - } - for(i = 0, n = f.length; i < n; ++i){ - name = Forces + i; - p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null; - if (p) sim.force(name, p); - } - for(n = sim.numForces || 0; i < n; ++i)sim.force(Forces + i, null); // remove - sim.numForces = f.length; - return sim; -} -function modified(f, pulse) { - var k, v; - for(k in f){ - if ((0, _vegaUtil.isFunction)(v = f[k]) && pulse.modified((0, _vegaUtil.accessorFields)(v))) return 1; + stratify2.id = function(x2) { + return arguments.length ? (id2 = optional(x2), stratify2) : id2; + }; + stratify2.parentId = function(x2) { + return arguments.length ? (parentId = optional(x2), stratify2) : parentId; + }; + stratify2.path = function(x2) { + return arguments.length ? (path2 = optional(x2), stratify2) : path2; + }; + return stratify2; + } + function normalize(path2) { + path2 = `${path2}`; + let i = path2.length; + if (slash(path2, i - 1) && !slash(path2, i - 2)) path2 = path2.slice(0, -1); + return path2[0] === "/" ? path2 : `/${path2}`; + } + function parentof(path2) { + let i = path2.length; + if (i < 2) return ""; + while (--i > 1) if (slash(path2, i)) break; + return path2.slice(0, i); + } + function slash(path2, i) { + if (path2[i] === "/") { + let k = 0; + while (i > 0 && path2[--i] === "\\") ++k; + if ((k & 1) === 0) return true; } - return 0; -} -function getForce(_) { - var f, p; - if (!(0, _vegaUtil.hasOwnProperty)(ForceMap, _.force)) (0, _vegaUtil.error)('Unrecognized force: ' + _.force); - f = ForceMap[_.force](); - for(p in _)if ((0, _vegaUtil.isFunction)(f[p])) setForceParam(f[p], _[p], _); - return f; -} -function setForceParam(f, v, _) { - f((0, _vegaUtil.isFunction)(v) ? (d)=>v(d, _) : v); -} - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-force":"40vzv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"40vzv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "forceCenter", ()=>(0, _centerJsDefault.default)); -parcelHelpers.export(exports, "forceCollide", ()=>(0, _collideJsDefault.default)); -parcelHelpers.export(exports, "forceLink", ()=>(0, _linkJsDefault.default)); -parcelHelpers.export(exports, "forceManyBody", ()=>(0, _manyBodyJsDefault.default)); -parcelHelpers.export(exports, "forceRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "forceSimulation", ()=>(0, _simulationJsDefault.default)); -parcelHelpers.export(exports, "forceX", ()=>(0, _xJsDefault.default)); -parcelHelpers.export(exports, "forceY", ()=>(0, _yJsDefault.default)); -var _centerJs = require("./center.js"); -var _centerJsDefault = parcelHelpers.interopDefault(_centerJs); -var _collideJs = require("./collide.js"); -var _collideJsDefault = parcelHelpers.interopDefault(_collideJs); -var _linkJs = require("./link.js"); -var _linkJsDefault = parcelHelpers.interopDefault(_linkJs); -var _manyBodyJs = require("./manyBody.js"); -var _manyBodyJsDefault = parcelHelpers.interopDefault(_manyBodyJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _simulationJs = require("./simulation.js"); -var _simulationJsDefault = parcelHelpers.interopDefault(_simulationJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); - -},{"./center.js":"hGtrR","./collide.js":"g4yWa","./link.js":"lHhAG","./manyBody.js":"e0pBR","./radial.js":false,"./simulation.js":"gj5vV","./x.js":"gU1Aq","./y.js":"ldvAB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hGtrR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var nodes, strength = 1; - if (x == null) x = 0; - if (y == null) y = 0; - function force() { - var i, n = nodes.length, node, sx = 0, sy = 0; - for(i = 0; i < n; ++i)node = nodes[i], sx += node.x, sy += node.y; - for(sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i)node = nodes[i], node.x -= sx, node.y -= sy; - } - force.initialize = function(_) { - nodes = _; - }; - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - return force; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g4yWa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var nodes, radii, random, strength = 1, iterations = 1; - if (typeof radius !== "function") radius = (0, _constantJsDefault.default)(radius == null ? 1 : +radius); - function force() { - var i, n = nodes.length, tree, node, xi, yi, ri, ri2; - for(var k = 0; k < iterations; ++k){ - tree = (0, _d3Quadtree.quadtree)(nodes, x, y).visitAfter(prepare); - for(i = 0; i < n; ++i){ - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, y = yi - data.y - data.vy, l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= y * r; - } - } - return; - } - return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; - } - } - function prepare(quad) { - if (quad.data) return quad.r = radii[quad.data.index]; - for(var i = quad.r = 0; i < 4; ++i)if (quad[i] && quad[i].r > quad.r) quad.r = quad[i].r; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : radius; - }; - return force; - }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function x(d) { - return d.x + d.vx; -} -function y(d) { - return d.y + d.vy; -} - -},{"d3-quadtree":"2k0t6","./constant.js":"2YYtK","./jiggle.js":"80LBz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2k0t6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "quadtree", ()=>(0, _quadtreeJsDefault.default)); -var _quadtreeJs = require("./quadtree.js"); -var _quadtreeJsDefault = parcelHelpers.interopDefault(_quadtreeJs); - -},{"./quadtree.js":"ayjpH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ayjpH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quadtree); -var _addJs = require("./add.js"); -var _addJsDefault = parcelHelpers.interopDefault(_addJs); -var _coverJs = require("./cover.js"); -var _coverJsDefault = parcelHelpers.interopDefault(_coverJs); -var _dataJs = require("./data.js"); -var _dataJsDefault = parcelHelpers.interopDefault(_dataJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _removeJs = require("./remove.js"); -var _removeJsDefault = parcelHelpers.interopDefault(_removeJs); -var _rootJs = require("./root.js"); -var _rootJsDefault = parcelHelpers.interopDefault(_rootJs); -var _sizeJs = require("./size.js"); -var _sizeJsDefault = parcelHelpers.interopDefault(_sizeJs); -var _visitJs = require("./visit.js"); -var _visitJsDefault = parcelHelpers.interopDefault(_visitJs); -var _visitAfterJs = require("./visitAfter.js"); -var _visitAfterJsDefault = parcelHelpers.interopDefault(_visitAfterJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); -function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? (0, _xJs.defaultX) : x, y == null ? (0, _yJs.defaultY) : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; -} -function leaf_copy(leaf) { - var copy = { - data: leaf.data - }, next = copy; - while(leaf = leaf.next)next = next.next = { - data: leaf.data - }; - return copy; -} -var treeProto = quadtree.prototype = Quadtree.prototype; -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; - if (!node) return copy; - if (!node.length) return copy._root = leaf_copy(node), copy; - nodes = [ - { - source: node, - target: copy._root = new Array(4) - } - ]; - while(node = nodes.pop()){ - for(var i = 0; i < 4; ++i)if (child = node.source[i]) { - if (child.length) nodes.push({ - source: child, - target: node.target[i] = new Array(4) - }); - else node.target[i] = leaf_copy(child); - } - } - return copy; -}; -treeProto.add = (0, _addJsDefault.default); -treeProto.addAll = (0, _addJs.addAll); -treeProto.cover = (0, _coverJsDefault.default); -treeProto.data = (0, _dataJsDefault.default); -treeProto.extent = (0, _extentJsDefault.default); -treeProto.find = (0, _findJsDefault.default); -treeProto.remove = (0, _removeJsDefault.default); -treeProto.removeAll = (0, _removeJs.removeAll); -treeProto.root = (0, _rootJsDefault.default); -treeProto.size = (0, _sizeJsDefault.default); -treeProto.visit = (0, _visitJsDefault.default); -treeProto.visitAfter = (0, _visitAfterJsDefault.default); -treeProto.x = (0, _xJsDefault.default); -treeProto.y = (0, _yJsDefault.default); - -},{"./add.js":"hFdIa","./cover.js":"bvF75","./data.js":"dtNPJ","./extent.js":"5rMqb","./find.js":"lNVWe","./remove.js":"K1L4u","./root.js":"iouwv","./size.js":"kFehL","./visit.js":"77UEv","./visitAfter.js":"210Zv","./x.js":"kTlM7","./y.js":"i1Jyy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hFdIa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - const x = +this._x.call(null, d), y = +this._y.call(null, d); - return add(this.cover(x, y), x, y, d); - }); -parcelHelpers.export(exports, "addAll", ()=>addAll); -function add(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points - var parent, node = tree._root, leaf = { - data: d - }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return tree._root = leaf, tree; - // Find the existing leaf for the new point, or add it. - while(node.length){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - }while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); - return parent[j] = node, parent[i] = leaf, tree; -} -function addAll(data) { - var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity; - // Compute the points and their extent. - for(i = 0; i < n; ++i){ - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; - } - // If there were no (valid) points, abort. - if (x0 > x1 || y0 > y1) return this; - // Expand the tree to cover the new points. - this.cover(x0, y0).cover(x1, y1); - // Add the new points. - for(i = 0; i < n; ++i)add(this, xz[i], yz[i], data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bvF75":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1; - // If the quadtree has no extent, initialize them. - // Integer extent are necessary so that if we later double the extent, - // the existing quadrant boundaries don’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } else { - var z = x1 - x0 || 1, node = this._root, parent, i; - while(x0 > x || x >= x1 || y0 > y || y >= y1){ - i = (y < y0) << 1 | x < x0; - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch(i){ - case 0: - x1 = x0 + z, y1 = y0 + z; - break; - case 1: - x0 = x1 - z, y1 = y0 + z; - break; - case 2: - x1 = x0 + z, y0 = y1 - z; - break; - case 3: - x0 = x1 - z, y0 = y1 - z; - break; - } - } - if (this._root && this._root.length) this._root = node; + return false; + } + function defaultSeparation$1(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function nextLeft(v) { + var children2 = v.children; + return children2 ? children2[0] : v.t; + } + function nextRight(v) { + var children2 = v.children; + return children2 ? children2[children2.length - 1] : v.t; + } + function moveSubtree(wm, wp, shift) { + var change2 = shift / (wp.i - wm.i); + wp.c -= change2; + wp.s += shift; + wm.c += change2; + wp.z += shift; + wp.m += shift; + } + function executeShifts(v) { + var shift = 0, change2 = 0, children2 = v.children, i = children2.length, w2; + while (--i >= 0) { + w2 = children2[i]; + w2.z += shift; + w2.m += shift; + shift += w2.s + (change2 += w2.c); + } + } + function nextAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; + } + function TreeNode(node, i) { + this._ = node; + this.parent = null; + this.children = null; + this.A = null; + this.a = this; + this.z = 0; + this.m = 0; + this.c = 0; + this.s = 0; + this.t = null; + this.i = i; + } + TreeNode.prototype = Object.create(Node$2.prototype); + function treeRoot(root) { + var tree2 = new TreeNode(root, 0), node, nodes = [tree2], child, children2, i, n; + while (node = nodes.pop()) { + if (children2 = node._.children) { + node.children = new Array(n = children2.length); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new TreeNode(children2[i], i)); + child.parent = node; } - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dtNPJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); - while (node = node.next); + } + } + (tree2.parent = new TreeNode(null, 0)).children = [tree2]; + return tree2; + } + function tree$1() { + var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null; + function tree2(root) { + var t = treeRoot(root); + t.eachAfter(firstWalk), t.parent.m = -t.z; + t.eachBefore(secondWalk); + if (nodeSize) root.eachBefore(sizeNode); + else { + var left = root, right = root, bottom = root; + root.eachBefore(function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; }); - return data; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5rMqb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [ - [ - this._x0, - this._y0 - ], - [ - this._x1, - this._y1 - ] - ]; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lNVWe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y, radius) { - var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; - if (node) quads.push(new (0, _quadJsDefault.default)(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - while(q = quads.pop()){ - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue; - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2; - quads.push(new (0, _quadJsDefault.default)(node[3], xm, ym, x2, y2), new (0, _quadJsDefault.default)(node[2], x1, ym, xm, y2), new (0, _quadJsDefault.default)(node[1], xm, y1, x2, ym), new (0, _quadJsDefault.default)(node[0], x1, y1, xm, ym)); - // Visit the closest quadrant first. - if (i = (y >= ym) << 1 | x >= xm) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } else { - var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - return data; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"5cUrX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5cUrX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"K1L4u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return this; - // Find the leaf node for the point. - // While descending, also retain the deepest parent with a non-removed sibling. - if (node.length) while(true){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; - } - // Find the point to remove. - while(node.data !== d)if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - // If there are multiple coincident points, remove just the point. - if (previous) return next ? previous.next = next : delete previous.next, this; - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; - } - return this; - }); -parcelHelpers.export(exports, "removeAll", ()=>removeAll); -function removeAll(data) { - for(var i = 0, n = data.length; i < n; ++i)this.remove(data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iouwv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this._root; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kFehL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; - while (node = node.next); + var s2 = left === right ? 1 : separation(left, right) / 2, tx2 = s2 - left.x, kx = dx / (right.x + s2 + tx2), ky = dy / (bottom.depth || 1); + root.eachBefore(function(node) { + node.x = (node.x + tx2) * kx; + node.y = node.depth * ky; }); - return size; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"77UEv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new (0, _quadJsDefault.default)(node, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop())if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); - } - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"5cUrX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"210Zv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new (0, _quadJsDefault.default)(this._root, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop()){ - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - } - next.push(q); - } - while(q = next.pop())callback(q.node, q.x0, q.y0, q.x1, q.y1); - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"5cUrX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kTlM7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultX", ()=>defaultX); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._x = _, this) : this._x; - }); -function defaultX(d) { - return d[0]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i1Jyy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultY", ()=>defaultY); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._y = _, this) : this._y; - }); -function defaultY(d) { - return d[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2YYtK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"80LBz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(random) { - return (random() - 0.5) * 1e-6; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lHhAG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(links) { - var id = index, strength = defaultStrength, strengths, distance = (0, _constantJsDefault.default)(30), distances, nodes, count, bias, random, iterations = 1; - if (links == null) links = []; - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - function force(alpha) { - for(var k = 0, n = links.length; k < iterations; ++k)for(var i = 0, link, source, target, x, y, l, b; i < n; ++i){ - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || (0, _jiggleJsDefault.default)(random); - y = target.y + target.vy - source.y - source.vy || (0, _jiggleJsDefault.default)(random); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, m = links.length, nodeById = new Map(nodes.map((d, i)=>[ - id(d, i, nodes), - d - ])), link; - for(i = 0, count = new Array(n); i < m; ++i){ - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find(nodeById, link.source); - if (typeof link.target !== "object") link.target = find(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - for(i = 0, bias = new Array(m); i < m; ++i)link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - function initializeStrength() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)strengths[i] = +strength(links[i], i, links); - } - function initializeDistance() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)distances[i] = +distance(links[i], i, links); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeStrength(), force) : strength; - }; - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeDistance(), force) : distance; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function index(d) { - return d.index; -} -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("node not found: " + nodeId); - return node; -} - -},{"./constant.js":"2YYtK","./jiggle.js":"80LBz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0pBR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var nodes, node, random, alpha, strength = (0, _constantJsDefault.default)(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; - function force(_) { - var i, n = nodes.length, tree = (0, _d3Quadtree.quadtree)(nodes, (0, _simulationJs.x), (0, _simulationJs.y)).visitAfter(accumulate); - for(alpha = _, i = 0; i < n; ++i)node = nodes[i], tree.visit(apply); - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for(x = y = i = 0; i < 4; ++i)if ((q = quad[i]) && (c = Math.abs(q.value))) strength += q.value, weight += c, x += c * q.x, y += c * q.y; - quad.x = x / weight; - quad.y = y / weight; - } else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - quad.value = strength; - } - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - var x = quad.x - node.x, y = quad.y - node.y, w = x2 - x1, l = x * x + y * y; - // Apply the Barnes-Hut approximation if possible. - // Limit forces for very close nodes; randomize direction if coincident. - if (w * w / theta2 < l) { - if (l < distanceMax2) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } else if (quad.length || l >= distanceMax2) return; - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } - while (quad = quad.next); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - return force; - }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -var _simulationJs = require("./simulation.js"); - -},{"d3-quadtree":"2k0t6","./constant.js":"2YYtK","./jiggle.js":"80LBz","./simulation.js":"gj5vV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gj5vV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -parcelHelpers.export(exports, "default", ()=>function(nodes) { - var simulation, alpha = 1, alphaMin = 0.001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = (0, _d3Timer.timer)(step), event = (0, _d3Dispatch.dispatch)("tick", "end"), random = (0, _lcgJsDefault.default)(); - if (nodes == null) nodes = []; - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); - } - } - function tick(iterations) { - var i, n = nodes.length, node; - if (iterations === undefined) iterations = 1; - for(var k = 0; k < iterations; ++k){ - alpha += (alphaTarget - alpha) * alphaDecay; - forces.forEach(function(force) { - force(alpha); - }); - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; - } - } - return simulation; - } - function initializeNodes() { - for(var i = 0, n = nodes.length, node; i < n; ++i){ - node = nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) node.vx = node.vy = 0; - } + } + return root; + } + function firstWalk(v) { + var children2 = v.children, siblings = v.parent.children, w2 = v.i ? siblings[v.i - 1] : null; + if (children2) { + executeShifts(v); + var midpoint = (children2[0].z + children2[children2.length - 1].z) / 2; + if (w2) { + v.z = w2.z + separation(v._, w2._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; } - function initializeForce(force) { - if (force.initialize) force.initialize(nodes, random); - return force; + } else if (w2) { + v.z = w2.z + separation(v._, w2._); + } + v.parent.A = apportion(v, w2, v.parent.A || siblings[0]); + } + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + function apportion(v, w2, ancestor) { + if (w2) { + var vip = v, vop = v, vim = w2, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; + while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { + vom = nextLeft(vom); + vop = nextRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + moveSubtree(nextAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !nextRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !nextLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; } - initializeNodes(); - return simulation = { - tick: tick, - restart: function() { - return stepper.restart(step), simulation; - }, - stop: function() { - return stepper.stop(), simulation; - }, - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes; - }, - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - randomSource: function(_) { - return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random; - }, - force: function(name, _) { - return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name); - }, - find: function(x, y, radius) { - var i = 0, n = nodes.length, dx, dy, d2, node, closest; - if (radius == null) radius = Infinity; - else radius *= radius; - for(i = 0; i < n; ++i){ - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - return closest; - }, - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; - }); -var _d3Dispatch = require("d3-dispatch"); -var _d3Timer = require("d3-timer"); -var _lcgJs = require("./lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function x(d) { - return d.x; -} -function y(d) { - return d.y; -} -var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); - -},{"d3-dispatch":"jYyZ6","d3-timer":"832oa","./lcg.js":"jy8z0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jYyZ6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dispatch", ()=>(0, _dispatchJsDefault.default)); -var _dispatchJs = require("./dispatch.js"); -var _dispatchJsDefault = parcelHelpers.interopDefault(_dispatchJs); - -},{"./dispatch.js":"9x2VR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9x2VR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var noop = { - value: ()=>{} -}; -function dispatch() { - for(var i = 0, n = arguments.length, _ = {}, t; i < n; ++i){ - if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); - _[t] = []; + } + return ancestor; } - return new Dispatch(_); -} -function Dispatch(_) { - this._ = _; -} -function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return { - type: t, - name: name - }; - }); -} -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; - // If no callback was specified, return the callback of the given type and name. - if (arguments.length < 2) { - while(++i < n)if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; - return; - } - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while(++i < n){ - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for(t in _)_[t] = set(_[t], typename.name, null); - } - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for(var t in _)copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for(var args = new Array(n), i = 0, n, t; i < n; ++i)args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(var t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - } -}; -function get(type, name) { - for(var i = 0, n = type.length, c; i < n; ++i){ - if ((c = type[i]).name === name) return c.value; - } -} -function set(type, name, callback) { - for(var i = 0, n = type.length; i < n; ++i)if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; + function sizeNode(node) { + node.x *= dx; + node.y = node.depth * dy; } - if (callback != null) type.push({ - name: name, - value: callback - }); - return type; -} -exports.default = dispatch; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"832oa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>(0, _timerJs.now)); -parcelHelpers.export(exports, "timer", ()=>(0, _timerJs.timer)); -parcelHelpers.export(exports, "timerFlush", ()=>(0, _timerJs.timerFlush)); -parcelHelpers.export(exports, "timeout", ()=>(0, _timeoutJsDefault.default)); -parcelHelpers.export(exports, "interval", ()=>(0, _intervalJsDefault.default)); -var _timerJs = require("./timer.js"); -var _timeoutJs = require("./timeout.js"); -var _timeoutJsDefault = parcelHelpers.interopDefault(_timeoutJs); -var _intervalJs = require("./interval.js"); -var _intervalJsDefault = parcelHelpers.interopDefault(_intervalJs); - -},{"./timer.js":"90OuR","./timeout.js":false,"./interval.js":"iKxV8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"90OuR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>now); -parcelHelpers.export(exports, "Timer", ()=>Timer); -parcelHelpers.export(exports, "timer", ()=>timer); -parcelHelpers.export(exports, "timerFlush", ()=>timerFlush); -var frame = 0, timeout = 0, interval = 0, pokeDelay = 1000, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { - setTimeout(f, 17); -}; -function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} -function clearNow() { - clockNow = 0; -} -function Timer() { - this._call = this._time = this._next = null; -} -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); + tree2.separation = function(x2) { + return arguments.length ? (separation = x2, tree2) : separation; + }; + tree2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? null : [dx, dy]; + }; + tree2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? [dx, dy] : null; + }; + return tree2; + } + function treemapSlice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y12 - y02) / parent.value; + while (++i < n) { + node = nodes[i], node.x0 = x02, node.x1 = x12; + node.y0 = y02, node.y1 = y02 += node.value * k; + } + } + var phi = (1 + Math.sqrt(5)) / 2; + function squarifyRatio(ratio, parent, x02, y02, x12, y12) { + var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value2 = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; + while (i0 < n) { + dx = x12 - x02, dy = y12 - y02; + do + sumValue = nodes[i1++].value; + while (!sumValue && i1 < n); + minValue = maxValue = sumValue; + alpha = Math.max(dy / dx, dx / dy) / (value2 * ratio); + beta = sumValue * sumValue * alpha; + minRatio = Math.max(maxValue / beta, beta / minValue); + for (; i1 < n; ++i1) { + sumValue += nodeValue = nodes[i1].value; + if (nodeValue < minValue) minValue = nodeValue; + if (nodeValue > maxValue) maxValue = nodeValue; + beta = sumValue * sumValue * alpha; + newRatio = Math.max(maxValue / beta, beta / minValue); + if (newRatio > minRatio) { + sumValue -= nodeValue; + break; } + minRatio = newRatio; + } + rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) }); + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += dy * sumValue / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += dx * sumValue / value2 : x12, y12); + value2 -= sumValue, i0 = i1; } -}; -function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; -} -function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while(t){ - if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e); - t = t._next; + return rows; + } + const treemapSquarify = (function custom2(ratio) { + function squarify(parent, x02, y02, x12, y12) { + squarifyRatio(ratio, parent, x02, y02, x12, y12); } - --frame; -} -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally{ - frame = 0; - nap(); - clockNow = 0; - } -} -function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; -} -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while(t1)if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - taskTail = t0; - sleep(time); -} -function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iKxV8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, delay, time) { - var t = new (0, _timerJs.Timer), total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - t._restart = t.restart; - t.restart = function(callback, delay, time) { - delay = +delay, time = time == null ? (0, _timerJs.now)() : +time; - t._restart(function tick(elapsed) { - elapsed += total; - t._restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - }; - t.restart(callback, delay, time); - return t; - }); -var _timerJs = require("./timer.js"); - -},{"./timer.js":"90OuR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jy8z0":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gU1Aq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, xz; - if (typeof x !== "function") x = (0, _constantJsDefault.default)(x == null ? 0 : +x); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : x; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"2YYtK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ldvAB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(y) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, yz; - if (typeof y !== "function") y = (0, _constantJsDefault.default)(y == null ? 0 : +y); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : y; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"2YYtK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Esn8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "nest", ()=>Nest); -parcelHelpers.export(exports, "pack", ()=>Pack); -parcelHelpers.export(exports, "partition", ()=>Partition); -parcelHelpers.export(exports, "stratify", ()=>Stratify); -parcelHelpers.export(exports, "tree", ()=>Tree); -parcelHelpers.export(exports, "treelinks", ()=>TreeLinks); -parcelHelpers.export(exports, "treemap", ()=>Treemap); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Hierarchy = require("d3-hierarchy"); -// Build lookup table mapping tuple keys to tree node instances -function lookup(tree, key, filter) { - const map = {}; - tree.each((node)=>{ - const t = node.data; - if (filter(t)) map[key(t)] = node; + squarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return squarify; + })(phi); + function treemap() { + var tile = treemapSquarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero; + function treemap2(root) { + root.x0 = root.y0 = 0; + root.x1 = dx; + root.y1 = dy; + root.eachBefore(positionNode); + paddingStack = [0]; + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(node) { + var p = paddingStack[node.depth], x02 = node.x0 + p, y02 = node.y0 + p, x12 = node.x1 - p, y12 = node.y1 - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + if (node.children) { + p = paddingStack[node.depth + 1] = paddingInner(node) / 2; + x02 += paddingLeft(node) - p; + y02 += paddingTop(node) - p; + x12 -= paddingRight(node) - p; + y12 -= paddingBottom(node) - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + tile(node, x02, y02, x12, y12); + } + } + treemap2.round = function(x2) { + return arguments.length ? (round = !!x2, treemap2) : round; + }; + treemap2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], treemap2) : [dx, dy]; + }; + treemap2.tile = function(x2) { + return arguments.length ? (tile = required(x2), treemap2) : tile; + }; + treemap2.padding = function(x2) { + return arguments.length ? treemap2.paddingInner(x2).paddingOuter(x2) : treemap2.paddingInner(); + }; + treemap2.paddingInner = function(x2) { + return arguments.length ? (paddingInner = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingInner; + }; + treemap2.paddingOuter = function(x2) { + return arguments.length ? treemap2.paddingTop(x2).paddingRight(x2).paddingBottom(x2).paddingLeft(x2) : treemap2.paddingTop(); + }; + treemap2.paddingTop = function(x2) { + return arguments.length ? (paddingTop = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingTop; + }; + treemap2.paddingRight = function(x2) { + return arguments.length ? (paddingRight = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingRight; + }; + treemap2.paddingBottom = function(x2) { + return arguments.length ? (paddingBottom = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingBottom; + }; + treemap2.paddingLeft = function(x2) { + return arguments.length ? (paddingLeft = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingLeft; + }; + return treemap2; + } + function treemapBinary(parent, x02, y02, x12, y12) { + var nodes = parent.children, i, n = nodes.length, sum2, sums = new Array(n + 1); + for (sums[0] = sum2 = i = 0; i < n; ++i) { + sums[i + 1] = sum2 += nodes[i].value; + } + partition2(0, n, parent.value, x02, y02, x12, y12); + function partition2(i2, j, value2, x03, y03, x13, y13) { + if (i2 >= j - 1) { + var node = nodes[i2]; + node.x0 = x03, node.y0 = y03; + node.x1 = x13, node.y1 = y13; + return; + } + var valueOffset = sums[i2], valueTarget = value2 / 2 + valueOffset, k = i2 + 1, hi = j - 1; + while (k < hi) { + var mid = k + hi >>> 1; + if (sums[mid] < valueTarget) k = mid + 1; + else hi = mid; + } + if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i2 + 1 < k) --k; + var valueLeft = sums[k] - valueOffset, valueRight = value2 - valueLeft; + if (x13 - x03 > y13 - y03) { + var xk = value2 ? (x03 * valueRight + x13 * valueLeft) / value2 : x13; + partition2(i2, k, valueLeft, x03, y03, xk, y13); + partition2(k, j, valueRight, xk, y03, x13, y13); + } else { + var yk = value2 ? (y03 * valueRight + y13 * valueLeft) / value2 : y13; + partition2(i2, k, valueLeft, x03, y03, x13, yk); + partition2(k, j, valueRight, x03, yk, x13, y13); + } + } + } + function treemapSliceDice(parent, x02, y02, x12, y12) { + (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x02, y02, x12, y12); + } + const treemapResquarify = (function custom2(ratio) { + function resquarify(parent, x02, y02, x12, y12) { + if ((rows = parent._squarify) && rows.ratio === ratio) { + var rows, row, nodes, i, j = -1, n, m2 = rows.length, value2 = parent.value; + while (++j < m2) { + row = rows[j], nodes = row.children; + for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += (y12 - y02) * row.value / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += (x12 - x02) * row.value / value2 : x12, y12); + value2 -= row.value; + } + } else { + parent._squarify = rows = squarifyRatio(ratio, parent, x02, y02, x12, y12); + rows.ratio = ratio; + } + } + resquarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return resquarify; + })(phi); + function lookup$2(tree2, key2, filter2) { + const map2 = {}; + tree2.each((node) => { + const t = node.data; + if (filter2(t)) map2[key2(t)] = node; }); - tree.lookup = map; - return tree; -} -/** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ function Nest(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Nest.Definition = { - 'type': 'Nest', - 'metadata': { - 'treesource': true, - 'changes': true - }, - 'params': [ - { - 'name': 'keys', - 'type': 'field', - 'array': true - }, - { - 'name': 'generate', - 'type': 'boolean' - } - ] -}; -const children = (n)=>n.values; -(0, _vegaUtil.inherits)(Nest, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Nest transform requires an upstream data source.'); - var gen = _.generate, mod = _.modified(), out = pulse.clone(), tree = this.value; - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) tree.each((node)=>{ - if (node.children && (0, _vegaDataflow.isTuple)(node.data)) out.rem.push(node.data); - }); - // generate new tree structure - this.value = tree = (0, _d3Hierarchy.hierarchy)({ - values: (0, _vegaUtil.array)(_.keys).reduce((n, k)=>{ - n.key(k); - return n; - }, nest()).entries(out.source) - }, children); - // collect nodes to add - if (gen) tree.each((node)=>{ - if (node.children) { - node = (0, _vegaDataflow.ingest)(node.data); - out.add.push(node); - out.source.push(node); - } - }); - // build lookup table - lookup(tree, (0, _vegaDataflow.tupleid), (0, _vegaDataflow.tupleid)); + tree2.lookup = map2; + return tree2; + } + function Nest(params2) { + Transform.call(this, null, params2); + } + Nest.Definition = { + "type": "Nest", + "metadata": { + "treesource": true, + "changes": true + }, + "params": [{ + "name": "keys", + "type": "field", + "array": true + }, { + "name": "generate", + "type": "boolean" + }] + }; + const children$1 = (n) => n.values; + inherits(Nest, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Nest transform requires an upstream data source."); + } + var gen = _.generate, mod = _.modified(), out = pulse2.clone(), tree2 = this.value; + if (!tree2 || mod || pulse2.changed()) { + if (tree2) { + tree2.each((node) => { + if (node.children && isTuple(node.data)) { + out.rem.push(node.data); + } + }); + } + this.value = tree2 = hierarchy({ + values: array$4(_.keys).reduce((n, k) => { + n.key(k); + return n; + }, nest()).entries(out.source) + }, children$1); + if (gen) { + tree2.each((node) => { + if (node.children) { + node = ingest$1(node.data); + out.add.push(node); + out.source.push(node); + } + }); } - out.source.root = tree; - return out; + lookup$2(tree2, tupleid, tupleid); + } + out.source.root = tree2; + return out; } -}); -function nest() { - const keys = [], nest = { - entries: (array)=>entries(apply(array, 0), 0), - key: (d)=>(keys.push(d), nest) - }; - function apply(array, depth) { - if (depth >= keys.length) return array; - const n = array.length, key = keys[depth++], valuesByKey = {}, result = {}; - let i = -1, keyValue, value, values; - while(++i < n){ - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) values.push(value); - else valuesByKey[keyValue] = [ - value - ]; + }); + function nest() { + const keys2 = [], nest2 = { + entries: (array2) => entries(apply2(array2, 0), 0), + key: (d2) => (keys2.push(d2), nest2) + }; + function apply2(array2, depth) { + if (depth >= keys2.length) { + return array2; + } + const n = array2.length, key2 = keys2[depth++], valuesByKey = {}, result = {}; + let i = -1, keyValue, value2, values2; + while (++i < n) { + keyValue = key2(value2 = array2[i]) + ""; + if (values2 = valuesByKey[keyValue]) { + values2.push(value2); + } else { + valuesByKey[keyValue] = [value2]; } - for(keyValue in valuesByKey)result[keyValue] = apply(valuesByKey[keyValue], depth); - return result; - } - function entries(map, depth) { - if (++depth > keys.length) return map; - const array = []; - for(const key in map)array.push({ - key, - values: entries(map[key], depth) + } + for (keyValue in valuesByKey) { + result[keyValue] = apply2(valuesByKey[keyValue], depth); + } + return result; + } + function entries(map2, depth) { + if (++depth > keys2.length) return map2; + const array2 = []; + for (const key2 in map2) { + array2.push({ + key: key2, + values: entries(map2[key2], depth) }); - return array; - } - return nest; -} -/** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function HierarchyLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const defaultSeparation = (a, b)=>a.parent === b.parent ? 1 : 2; -(0, _vegaUtil.inherits)(HierarchyLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source || !pulse.source.root) (0, _vegaUtil.error)(this.constructor.name + ' transform requires a backing tree data source.'); - const layout = this.layout(_.method), fields = this.fields, root = pulse.source.root, as = _.as || fields; - if (_.field) root.sum(_.field); - else root.count(); - if (_.sort) root.sort((0, _vegaDataflow.stableCompare)(_.sort, (d)=>d.data)); - setParams(layout, this.params, _); - if (layout.separation) layout.separation(_.separation !== false ? defaultSeparation : (0, _vegaUtil.one)); - try { - this.value = layout(root); - } catch (err) { - (0, _vegaUtil.error)(err); - } - root.each((node)=>setFields(node, fields, as)); - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); + } + return array2; + } + return nest2; + } + function HierarchyLayout(params2) { + Transform.call(this, null, params2); + } + const defaultSeparation = (a2, b2) => a2.parent === b2.parent ? 1 : 2; + inherits(HierarchyLayout, Transform, { + transform(_, pulse2) { + if (!pulse2.source || !pulse2.source.root) { + error(this.constructor.name + " transform requires a backing tree data source."); + } + const layout = this.layout(_.method), fields = this.fields, root = pulse2.source.root, as = _.as || fields; + if (_.field) root.sum(_.field); + else root.count(); + if (_.sort) root.sort(stableCompare(_.sort, (d2) => d2.data)); + setParams(layout, this.params, _); + if (layout.separation) { + layout.separation(_.separation !== false ? defaultSeparation : one$1); + } + try { + this.value = layout(root); + } catch (err) { + error(err); + } + root.each((node) => setFields(node, fields, as)); + return pulse2.reflow(_.modified()).modifies(as).modifies("leaf"); } -}); -function setParams(layout, params, _) { - for(let p, i = 0, n = params.length; i < n; ++i){ - p = params[i]; - if (p in _) layout[p](_[p]); + }); + function setParams(layout, params2, _) { + for (let p, i = 0, n = params2.length; i < n; ++i) { + p = params2[i]; + if (p in _) layout[p](_[p]); } -} -function setFields(node, fields, as) { + } + function setFields(node, fields, as) { const t = node.data, n = fields.length - 1; - for(let i = 0; i < n; ++i)t[as[i]] = node[fields[i]]; + for (let i = 0; i < n; ++i) { + t[as[i]] = node[fields[i]]; + } t[as[n]] = node.children ? node.children.length : 0; -} -const Output$3 = [ - 'x', - 'y', - 'r', - 'depth', - 'children' -]; -/** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Pack(params) { - HierarchyLayout.call(this, params); -} -Pack.Definition = { - 'type': 'Pack', - 'metadata': { - 'tree': true, - 'modifies': true + } + const Output$3 = ["x", "y", "r", "depth", "children"]; + function Pack(params2) { + HierarchyLayout.call(this, params2); + } + Pack.Definition = { + "type": "Pack", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'radius', - 'type': 'field', - 'default': null - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$3.length, - 'default': Output$3 - } - ] -}; -(0, _vegaUtil.inherits)(Pack, HierarchyLayout, { - layout: (0, _d3Hierarchy.pack), - params: [ - 'radius', - 'size', - 'padding' - ], + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "radius", + "type": "field", + "default": null + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$3.length, + "default": Output$3 + }] + }; + inherits(Pack, HierarchyLayout, { + layout: pack, + params: ["radius", "size", "padding"], fields: Output$3 -}); -const Output$2 = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Partition(params) { - HierarchyLayout.call(this, params); -} -Partition.Definition = { - 'type': 'Partition', - 'metadata': { - 'tree': true, - 'modifies': true + }); + const Output$2 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Partition(params2) { + HierarchyLayout.call(this, params2); + } + Partition.Definition = { + "type": "Partition", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$2.length, - 'default': Output$2 - } - ] -}; -(0, _vegaUtil.inherits)(Partition, HierarchyLayout, { - layout: (0, _d3Hierarchy.partition), - params: [ - 'size', - 'round', - 'padding' - ], + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$2.length, + "default": Output$2 + }] + }; + inherits(Partition, HierarchyLayout, { + layout: partition$1, + params: ["size", "round", "padding"], fields: Output$2 -}); -/** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ function Stratify(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stratify.Definition = { - 'type': 'Stratify', - 'metadata': { - 'treesource': true + }); + function Stratify(params2) { + Transform.call(this, null, params2); + } + Stratify.Definition = { + "type": "Stratify", + "metadata": { + "treesource": true }, - 'params': [ - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'parentKey', - 'type': 'field', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Stratify, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Stratify transform requires an upstream data source.'); - let tree = this.value; - const mod = _.modified(), out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), run = !tree || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); - // prevent upstream source pollution - out.source = out.source.slice(); - if (run) tree = out.source.length ? lookup((0, _d3Hierarchy.stratify)().id(_.key).parentId(_.parentKey)(out.source), _.key, (0, _vegaUtil.truthy)) : lookup((0, _d3Hierarchy.stratify)()([ - {} - ]), _.key, _.key); - out.source.root = this.value = tree; - return out; + "params": [{ + "name": "key", + "type": "field", + "required": true + }, { + "name": "parentKey", + "type": "field", + "required": true + }] + }; + inherits(Stratify, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Stratify transform requires an upstream data source."); + } + let tree2 = this.value; + const mod = _.modified(), out = pulse2.fork(pulse2.ALL).materialize(pulse2.SOURCE), run2 = !tree2 || mod || pulse2.changed(pulse2.ADD_REM) || pulse2.modified(_.key.fields) || pulse2.modified(_.parentKey.fields); + out.source = out.source.slice(); + if (run2) { + tree2 = out.source.length ? lookup$2(stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy) : lookup$2(stratify()([{}]), _.key, _.key); + } + out.source.root = this.value = tree2; + return out; } -}); -const Layouts = { - tidy: (0, _d3Hierarchy.tree), - cluster: (0, _d3Hierarchy.cluster) -}; -const Output$1 = [ - 'x', - 'y', - 'depth', - 'children' -]; -/** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Tree(params) { - HierarchyLayout.call(this, params); -} -Tree.Definition = { - 'type': 'Tree', - 'metadata': { - 'tree': true, - 'modifies': true + }); + const Layouts = { + tidy: tree$1, + cluster + }; + const Output$1$1 = ["x", "y", "depth", "children"]; + function Tree(params2) { + HierarchyLayout.call(this, params2); + } + Tree.Definition = { + "type": "Tree", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'tidy', - 'values': [ - 'tidy', - 'cluster' - ] - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'nodeSize', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'separation', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$1.length, - 'default': Output$1 - } - ] -}; -(0, _vegaUtil.inherits)(Tree, HierarchyLayout, { + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "tidy", + "values": ["tidy", "cluster"] + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "nodeSize", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "separation", + "type": "boolean", + "default": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$1$1.length, + "default": Output$1$1 + }] + }; + inherits(Tree, HierarchyLayout, { /** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ layout (method) { - const m = method || 'tidy'; - if ((0, _vegaUtil.hasOwnProperty)(Layouts, m)) return Layouts[m](); - else (0, _vegaUtil.error)('Unrecognized Tree layout method: ' + m); + * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. + */ + layout(method2) { + const m2 = method2 || "tidy"; + if (has$1(Layouts, m2)) return Layouts[m2](); + else error("Unrecognized Tree layout method: " + m2); }, - params: [ - 'size', - 'nodeSize' - ], - fields: Output$1 -}); -/** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ function TreeLinks(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': { - 'tree': true, - 'generates': true, - 'changes': true + params: ["size", "nodeSize"], + fields: Output$1$1 + }); + function TreeLinks(params2) { + Transform.call(this, [], params2); + } + TreeLinks.Definition = { + "type": "TreeLinks", + "metadata": { + "tree": true, + "generates": true, + "changes": true }, - 'params': [] -}; -(0, _vegaUtil.inherits)(TreeLinks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const links = this.value, tree = pulse.source && pulse.source.root, out = pulse.fork(pulse.NO_SOURCE), lut = {}; - if (!tree) (0, _vegaUtil.error)('TreeLinks transform requires a tree data source.'); - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; - // build lookup table of valid tuples - pulse.visit(pulse.SOURCE, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // generate links for all edges incident on valid tuples - tree.each((node)=>{ - const t = node.data, p = node.parent && node.parent.data; - if (p && lut[(0, _vegaDataflow.tupleid)(t)] && lut[(0, _vegaDataflow.tupleid)(p)]) out.add.push((0, _vegaDataflow.ingest)({ - source: p, - target: t - })); - }); - this.value = out.add; - } else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // gather links incident on modified tuples - links.forEach((link)=>{ - if (lut[(0, _vegaDataflow.tupleid)(link.source)] || lut[(0, _vegaDataflow.tupleid)(link.target)]) out.mod.push(link); - }); - } - return out; + "params": [] + }; + inherits(TreeLinks, Transform, { + transform(_, pulse2) { + const links = this.value, tree2 = pulse2.source && pulse2.source.root, out = pulse2.fork(pulse2.NO_SOURCE), lut = {}; + if (!tree2) error("TreeLinks transform requires a tree data source."); + if (pulse2.changed(pulse2.ADD_REM)) { + out.rem = links; + pulse2.visit(pulse2.SOURCE, (t) => lut[tupleid(t)] = 1); + tree2.each((node) => { + const t = node.data, p = node.parent && node.parent.data; + if (p && lut[tupleid(t)] && lut[tupleid(p)]) { + out.add.push(ingest$1({ + source: p, + target: t + })); + } + }); + this.value = out.add; + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => lut[tupleid(t)] = 1); + links.forEach((link2) => { + if (lut[tupleid(link2.source)] || lut[tupleid(link2.target)]) { + out.mod.push(link2); + } + }); + } + return out; } -}); -const Tiles = { - binary: (0, _d3Hierarchy.treemapBinary), - dice: (0, _d3Hierarchy.treemapDice), - slice: (0, _d3Hierarchy.treemapSlice), - slicedice: (0, _d3Hierarchy.treemapSliceDice), - squarify: (0, _d3Hierarchy.treemapSquarify), - resquarify: (0, _d3Hierarchy.treemapResquarify) -}; -const Output = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Treemap(params) { - HierarchyLayout.call(this, params); -} -Treemap.Definition = { - 'type': 'Treemap', - 'metadata': { - 'tree': true, - 'modifies': true + }); + const Tiles = { + binary: treemapBinary, + dice: treemapDice, + slice: treemapSlice, + slicedice: treemapSliceDice, + squarify: treemapSquarify, + resquarify: treemapResquarify + }; + const Output$4 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Treemap(params2) { + HierarchyLayout.call(this, params2); + } + Treemap.Definition = { + "type": "Treemap", + "metadata": { + "tree": true, + "modifies": true }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'squarify', - 'values': [ - 'squarify', - 'resquarify', - 'binary', - 'dice', - 'slice', - 'slicedice' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingInner', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingOuter', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingTop', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingRight', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingBottom', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingLeft', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'ratio', - 'type': 'number', - 'default': 1.618033988749895 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output.length, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Treemap, HierarchyLayout, { + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "squarify", + "values": ["squarify", "resquarify", "binary", "dice", "slice", "slicedice"] + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "paddingInner", + "type": "number", + "default": 0 + }, { + "name": "paddingOuter", + "type": "number", + "default": 0 + }, { + "name": "paddingTop", + "type": "number", + "default": 0 + }, { + "name": "paddingRight", + "type": "number", + "default": 0 + }, { + "name": "paddingBottom", + "type": "number", + "default": 0 + }, { + "name": "paddingLeft", + "type": "number", + "default": 0 + }, { + "name": "ratio", + "type": "number", + "default": 1.618033988749895 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$4.length, + "default": Output$4 + }] + }; + inherits(Treemap, HierarchyLayout, { /** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ layout () { - const x = (0, _d3Hierarchy.treemap)(); - x.ratio = (_)=>{ - const t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - x.method = (_)=>{ - if ((0, _vegaUtil.hasOwnProperty)(Tiles, _)) x.tile(Tiles[_]); - else (0, _vegaUtil.error)('Unrecognized Treemap layout method: ' + _); - }; - return x; + * Treemap layout generator. Adds 'method' and 'ratio' parameters + * to configure the underlying tile method. + */ + layout() { + const x2 = treemap(); + x2.ratio = (_) => { + const t = x2.tile(); + if (t.ratio) x2.tile(t.ratio(_)); + }; + x2.method = (_) => { + if (has$1(Tiles, _)) x2.tile(Tiles[_]); + else error("Unrecognized Treemap layout method: " + _); + }; + return x2; }, - params: [ - 'method', - 'ratio', - 'size', - 'round', - 'padding', - 'paddingInner', - 'paddingOuter', - 'paddingTop', - 'paddingRight', - 'paddingBottom', - 'paddingLeft' - ], - fields: Output -}); - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-hierarchy":"1ebQr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1ebQr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cluster", ()=>(0, _clusterJsDefault.default)); -parcelHelpers.export(exports, "hierarchy", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "Node", ()=>(0, _indexJs.Node)); -parcelHelpers.export(exports, "pack", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "packSiblings", ()=>(0, _siblingsJsDefault.default)); -parcelHelpers.export(exports, "packEnclose", ()=>(0, _encloseJsDefault.default)); -parcelHelpers.export(exports, "partition", ()=>(0, _partitionJsDefault.default)); -parcelHelpers.export(exports, "stratify", ()=>(0, _stratifyJsDefault.default)); -parcelHelpers.export(exports, "tree", ()=>(0, _treeJsDefault.default)); -parcelHelpers.export(exports, "treemap", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "treemapBinary", ()=>(0, _binaryJsDefault.default)); -parcelHelpers.export(exports, "treemapDice", ()=>(0, _diceJsDefault.default)); -parcelHelpers.export(exports, "treemapSlice", ()=>(0, _sliceJsDefault.default)); -parcelHelpers.export(exports, "treemapSliceDice", ()=>(0, _sliceDiceJsDefault.default)); -parcelHelpers.export(exports, "treemapSquarify", ()=>(0, _squarifyJsDefault.default)); -parcelHelpers.export(exports, "treemapResquarify", ()=>(0, _resquarifyJsDefault.default)); -var _clusterJs = require("./cluster.js"); -var _clusterJsDefault = parcelHelpers.interopDefault(_clusterJs); -var _indexJs = require("./hierarchy/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _indexJs1 = require("./pack/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _siblingsJs = require("./pack/siblings.js"); -var _siblingsJsDefault = parcelHelpers.interopDefault(_siblingsJs); -var _encloseJs = require("./pack/enclose.js"); -var _encloseJsDefault = parcelHelpers.interopDefault(_encloseJs); -var _partitionJs = require("./partition.js"); -var _partitionJsDefault = parcelHelpers.interopDefault(_partitionJs); -var _stratifyJs = require("./stratify.js"); -var _stratifyJsDefault = parcelHelpers.interopDefault(_stratifyJs); -var _treeJs = require("./tree.js"); -var _treeJsDefault = parcelHelpers.interopDefault(_treeJs); -var _indexJs2 = require("./treemap/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _binaryJs = require("./treemap/binary.js"); -var _binaryJsDefault = parcelHelpers.interopDefault(_binaryJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./treemap/slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _sliceDiceJs = require("./treemap/sliceDice.js"); -var _sliceDiceJsDefault = parcelHelpers.interopDefault(_sliceDiceJs); -var _squarifyJs = require("./treemap/squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _resquarifyJs = require("./treemap/resquarify.js"); -var _resquarifyJsDefault = parcelHelpers.interopDefault(_resquarifyJs); - -},{"./cluster.js":"iBepz","./hierarchy/index.js":"aKFc0","./pack/index.js":"lUJH5","./pack/siblings.js":false,"./pack/enclose.js":false,"./partition.js":"2uWl8","./stratify.js":"81qCy","./tree.js":"i82wc","./treemap/index.js":"gn3Lw","./treemap/binary.js":"lIsJs","./treemap/dice.js":"5Coec","./treemap/slice.js":"bB6OY","./treemap/sliceDice.js":"lS2RY","./treemap/squarify.js":"6L9bi","./treemap/resquarify.js":"3C5OD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iBepz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false; - function cluster(root) { - var previousNode, x = 0; - // First walk, computing the initial x & y values. - root.eachAfter(function(node) { - var children = node.children; - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - var left = leafLeft(root), right = leafRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; - // Second walk, normalizing x & y to the desired size. - return root.eachAfter(nodeSize ? function(node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); + params: ["method", "ratio", "size", "round", "padding", "paddingInner", "paddingOuter", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"], + fields: Output$4 + }); + const tree = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + nest: Nest, + pack: Pack, + partition: Partition, + stratify: Stratify, + tree: Tree, + treelinks: TreeLinks, + treemap: Treemap + }, Symbol.toStringTag, { value: "Module" })); + const ALPHA_MASK = 4278190080; + function baseBitmaps($2, data2) { + const bitmap = $2.bitmap(); + (data2 || []).forEach((d2) => bitmap.set($2(d2.boundary[0]), $2(d2.boundary[3]))); + return [bitmap, void 0]; + } + function markBitmaps($2, baseMark, avoidMarks, labelInside, isGroupArea) { + const width2 = $2.width, height2 = $2.height, border = labelInside || isGroupArea, context2 = domCanvas(width2, height2).getContext("2d"), baseMarkContext = domCanvas(width2, height2).getContext("2d"), strokeContext = border && domCanvas(width2, height2).getContext("2d"); + avoidMarks.forEach((items) => draw(context2, items, false)); + draw(baseMarkContext, baseMark, false); + if (border) { + draw(strokeContext, baseMark, true); + } + const buffer = getBuffer(context2, width2, height2), baseMarkBuffer = getBuffer(baseMarkContext, width2, height2), strokeBuffer = border && getBuffer(strokeContext, width2, height2), layer1 = $2.bitmap(), layer2 = border && $2.bitmap(); + let x2, y2, u2, v, index2, alpha, strokeAlpha, baseMarkAlpha; + for (y2 = 0; y2 < height2; ++y2) { + for (x2 = 0; x2 < width2; ++x2) { + index2 = y2 * width2 + x2; + alpha = buffer[index2] & ALPHA_MASK; + baseMarkAlpha = baseMarkBuffer[index2] & ALPHA_MASK; + strokeAlpha = border && strokeBuffer[index2] & ALPHA_MASK; + if (alpha || strokeAlpha || baseMarkAlpha) { + u2 = $2(x2); + v = $2(y2); + if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u2, v); + if (border && (alpha || strokeAlpha)) layer2.set(u2, v); } - cluster.separation = function(x) { - return arguments.length ? (separation = x, cluster) : separation; - }; - cluster.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : nodeSize ? null : [ - dx, - dy - ]; - }; - cluster.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : nodeSize ? [ - dx, - dy - ] : null; - }; - return cluster; - }); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -function meanX(children) { - return children.reduce(meanXReduce, 0) / children.length; -} -function meanXReduce(x, c) { - return x + c.x; -} -function maxY(children) { - return 1 + children.reduce(maxYReduce, 0); -} -function maxYReduce(y, c) { - return Math.max(y, c.y); -} -function leafLeft(node) { - var children; - while(children = node.children)node = children[0]; - return node; -} -function leafRight(node) { - var children; - while(children = node.children)node = children[children.length - 1]; - return node; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aKFc0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>hierarchy); -parcelHelpers.export(exports, "computeHeight", ()=>computeHeight); -parcelHelpers.export(exports, "Node", ()=>Node); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _eachJs = require("./each.js"); -var _eachJsDefault = parcelHelpers.interopDefault(_eachJs); -var _eachBeforeJs = require("./eachBefore.js"); -var _eachBeforeJsDefault = parcelHelpers.interopDefault(_eachBeforeJs); -var _eachAfterJs = require("./eachAfter.js"); -var _eachAfterJsDefault = parcelHelpers.interopDefault(_eachAfterJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _ancestorsJs = require("./ancestors.js"); -var _ancestorsJsDefault = parcelHelpers.interopDefault(_ancestorsJs); -var _descendantsJs = require("./descendants.js"); -var _descendantsJsDefault = parcelHelpers.interopDefault(_descendantsJs); -var _leavesJs = require("./leaves.js"); -var _leavesJsDefault = parcelHelpers.interopDefault(_leavesJs); -var _linksJs = require("./links.js"); -var _linksJsDefault = parcelHelpers.interopDefault(_linksJs); -var _iteratorJs = require("./iterator.js"); -var _iteratorJsDefault = parcelHelpers.interopDefault(_iteratorJs); -function hierarchy(data, children) { - if (data instanceof Map) { - data = [ - undefined, - data - ]; - if (children === undefined) children = mapChildren; - } else if (children === undefined) children = objectChildren; - var root = new Node(data), node, nodes = [ - root - ], child, childs, i, n; - while(node = nodes.pop())if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) { - node.children = childs; - for(i = n - 1; i >= 0; --i){ - nodes.push(child = childs[i] = new Node(childs[i])); - child.parent = node; - child.depth = node.depth + 1; + } + } + return [layer1, layer2]; + } + function getBuffer(context2, width2, height2) { + return new Uint32Array(context2.getImageData(0, 0, width2, height2).data.buffer); + } + function draw(context2, items, interior) { + if (!items.length) return; + const type2 = items[0].mark.marktype; + if (type2 === "group") { + items.forEach((group2) => { + group2.items.forEach((mark) => draw(context2, mark.items, interior)); + }); + } else { + Marks[type2].draw(context2, { + items: interior ? items.map(prepare) : items + }); + } + } + function prepare(source2) { + const item = rederive(source2, {}); + if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) { + return { + ...item, + strokeOpacity: 1, + stroke: "#000", + fillOpacity: 0 + }; + } + return item; + } + const DIV = 5, MOD = 31, SIZE = 32, RIGHT0 = new Uint32Array(SIZE + 1), RIGHT1 = new Uint32Array(SIZE + 1); + RIGHT1[0] = 0; + RIGHT0[0] = ~RIGHT1[0]; + for (let i = 1; i <= SIZE; ++i) { + RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; + RIGHT0[i] = ~RIGHT1[i]; + } + function Bitmap(w2, h2) { + const array2 = new Uint32Array(~~((w2 * h2 + SIZE) / SIZE)); + function _set(index2, mask) { + array2[index2] |= mask; + } + function _clear(index2, mask) { + array2[index2] &= mask; + } + return { + array: array2, + get: (x2, y2) => { + const index2 = y2 * w2 + x2; + return array2[index2 >>> DIV] & 1 << (index2 & MOD); + }, + set: (x2, y2) => { + const index2 = y2 * w2 + x2; + _set(index2 >>> DIV, 1 << (index2 & MOD)); + }, + clear: (x2, y2) => { + const index2 = y2 * w2 + x2; + _clear(index2 >>> DIV, ~(1 << (index2 & MOD))); + }, + getRange: (x2, y2, x22, y22) => { + let r = y22, start, end, indexStart, indexEnd; + for (; r >= y2; --r) { + start = r * w2 + x2; + end = r * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + if (array2[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) { + return true; + } + } else { + if (array2[indexStart] & RIGHT0[start & MOD]) return true; + if (array2[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; + for (let i = indexStart + 1; i < indexEnd; ++i) { + if (array2[i]) return true; + } + } + } + return false; + }, + setRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); + } else { + _set(indexStart, RIGHT0[start & MOD]); + _set(indexEnd, RIGHT1[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 4294967295); + } + } + }, + clearRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); + } else { + _clear(indexStart, RIGHT1[start & MOD]); + _clear(indexEnd, RIGHT0[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0); + } + } + }, + outOfBounds: (x2, y2, x22, y22) => x2 < 0 || y2 < 0 || y22 >= h2 || x22 >= w2 + }; + } + function scaler(width2, height2, padding2) { + const ratio = Math.max(1, Math.sqrt(width2 * height2 / 1e6)), w2 = ~~((width2 + 2 * padding2 + ratio) / ratio), h2 = ~~((height2 + 2 * padding2 + ratio) / ratio), scale2 = (_) => ~~((_ + padding2) / ratio); + scale2.invert = (_) => _ * ratio - padding2; + scale2.bitmap = () => Bitmap(w2, h2); + scale2.ratio = ratio; + scale2.padding = padding2; + scale2.width = width2; + scale2.height = height2; + return scale2; + } + function placeAreaLabelNaive($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height; + return function(d2) { + const items = d2.datum.datum.items[markIndex].items, n = items.length, textHeight = d2.datum.fontSize, textWidth = textMetrics.width(d2.datum, d2.datum.text); + let maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + areaWidth = Math.abs(x2 - x12 + y2 - y12); + if (areaWidth >= maxAreaWidth) { + maxAreaWidth = areaWidth; + d2.x = x3; + d2.y = y3; + } + } + x3 = textWidth / 2; + y3 = textHeight / 2; + x12 = d2.x - x3; + x2 = d2.x + x3; + y12 = d2.y - y3; + y2 = d2.y + y3; + d2.align = "center"; + if (x12 < 0 && x2 <= width2) { + d2.align = "left"; + } else if (0 <= x12 && width2 < x2) { + d2.align = "right"; + } + d2.baseline = "middle"; + if (y12 < 0 && y2 <= height2) { + d2.baseline = "top"; + } else if (0 <= y12 && height2 < y2) { + d2.baseline = "bottom"; + } + return true; + }; + } + function outOfBounds(x2, y2, textWidth, textHeight, width2, height2) { + let r = textWidth / 2; + return x2 - r < 0 || x2 + r > width2 || y2 - (r = textHeight / 2) < 0 || y2 + r > height2; + } + function collision($2, x2, y2, textHeight, textWidth, h2, bm0, bm1) { + const w2 = textWidth * h2 / (textHeight * 2), x12 = $2(x2 - w2), x22 = $2(x2 + w2), y12 = $2(y2 - (h2 = h2 / 2)), y22 = $2(y2 + h2); + return bm0.outOfBounds(x12, y12, x22, y22) || bm0.getRange(x12, y12, x22, y22) || bm1 && bm1.getRange(x12, y12, x22, y22); + } + function placeAreaLabelReducedSearch($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1]; + function tryLabel(_x, _y, maxSize, textWidth, textHeight) { + const x2 = $2.invert(_x), y2 = $2.invert(_y); + let lo = maxSize, hi = height2, mid; + if (!outOfBounds(x2, y2, textWidth, textHeight, width2, height2) && !collision($2, x2, y2, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x2, y2, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x2, y2, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + return [x2, y2, lo, true]; } + } } - return root.eachBefore(computeHeight); -} -function node_copy() { - return hierarchy(this).eachBefore(copyData); -} -function objectChildren(d) { - return d.children; -} -function mapChildren(d) { - return Array.isArray(d) ? d[1] : null; -} -function copyData(node) { - if (node.data.value !== undefined) node.value = node.data.value; - node.data = node.data.data; -} -function computeHeight(node) { - var height = 0; - do node.height = height; - while ((node = node.parent) && node.height < ++height); -} -function Node(data) { - this.data = data; - this.depth = this.height = 0; - this.parent = null; -} -Node.prototype = hierarchy.prototype = { - constructor: Node, - count: (0, _countJsDefault.default), - each: (0, _eachJsDefault.default), - eachAfter: (0, _eachAfterJsDefault.default), - eachBefore: (0, _eachBeforeJsDefault.default), - find: (0, _findJsDefault.default), - sum: (0, _sumJsDefault.default), - sort: (0, _sortJsDefault.default), - path: (0, _pathJsDefault.default), - ancestors: (0, _ancestorsJsDefault.default), - descendants: (0, _descendantsJsDefault.default), - leaves: (0, _leavesJsDefault.default), - links: (0, _linksJsDefault.default), - copy: node_copy, - [Symbol.iterator]: (0, _iteratorJsDefault.default) -}; - -},{"./count.js":"dvcf4","./each.js":"eTn7P","./eachBefore.js":"ieOTr","./eachAfter.js":"2hfOH","./find.js":"cbIl9","./sum.js":"6qKl0","./sort.js":"0VcFA","./path.js":"kCaNs","./ancestors.js":"ciAJo","./descendants.js":"exMS3","./leaves.js":"2HPU5","./links.js":"8bu7D","./iterator.js":"flf9N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dvcf4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this.eachAfter(count); - }); -function count(node) { - var sum = 0, children = node.children, i = children && children.length; - if (!i) sum = 1; - else while(--i >= 0)sum += children[i].value; - node.value = sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eTn7P":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this)callback.call(that, node, ++index, this); - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ieOTr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], children, i, index = -1; - while(node = nodes.pop()){ - callback.call(that, node, ++index, this); - if (children = node.children) for(i = children.length - 1; i >= 0; --i)nodes.push(children[i]); + return function(d2) { + const items = d2.datum.datum.items[markIndex].items, n = items.length, textHeight = d2.datum.fontSize, textWidth = textMetrics.width(d2.datum, d2.datum.text); + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + if (x12 > x2) { + swapTmp = x12; + x12 = x2; + x2 = swapTmp; + } + if (y12 > y2) { + swapTmp = y12; + y12 = y2; + y2 = swapTmp; + } + _x1 = $2(x12); + _x2 = $2(x2); + _xMid = ~~((_x1 + _x2) / 2); + _y1 = $2(y12); + _y2 = $2(y2); + _yMid = ~~((_y1 + _y2) / 2); + for (_x = _xMid; _x >= _x1; --_x) { + for (_y = _yMid; _y >= _y1; --_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d2.x, d2.y, maxSize, labelPlaced] = result; + } + } + } + for (_x = _xMid; _x <= _x2; ++_x) { + for (_y = _yMid; _y <= _y2; ++_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d2.x, d2.y, maxSize, labelPlaced] = result; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d2.x = x3; + d2.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d2.x - x3), $2(d2.y - y3), $2(d2.x + x3), $2(d2.y + y3)); + d2.align = "center"; + d2.baseline = "middle"; + return true; + } else { + return false; + } + }; + } + const X_DIR = [-1, -1, 1, 1]; + const Y_DIR = [-1, 1, -1, 1]; + function placeAreaLabelFloodFill($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], bm2 = $2.bitmap(); + return function(d2) { + const items = d2.datum.datum.items[markIndex].items, n = items.length, textHeight = d2.datum.fontSize, textWidth = textMetrics.width(d2.datum, d2.datum.text), stack = []; + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, lo, hi, mid, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + stack.push([$2((x12 + x2) / 2), $2((y12 + y2) / 2)]); + while (stack.length) { + [_x, _y] = stack.pop(); + if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; + bm2.set(_x, _y); + for (let j = 0; j < 4; ++j) { + x3 = _x + X_DIR[j]; + y3 = _y + Y_DIR[j]; + if (!bm2.outOfBounds(x3, y3, x3, y3)) stack.push([x3, y3]); + } + x3 = $2.invert(_x); + y3 = $2.invert(_y); + lo = maxSize; + hi = height2; + if (!outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x3, y3, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + d2.x = x3; + d2.y = y3; + maxSize = lo; + labelPlaced = true; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d2.x = x3; + d2.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d2.x - x3), $2(d2.y - y3), $2(d2.x + x3), $2(d2.y + y3)); + d2.align = "center"; + d2.baseline = "middle"; + return true; + } else { + return false; + } + }; + } + const Aligns = ["right", "center", "left"], Baselines = ["bottom", "middle", "top"]; + function placeMarkLabel($2, bitmaps, anchors, offsets2) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets2.length; + return function(d2) { + const boundary = d2.boundary, textHeight = d2.datum.fontSize; + if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width2 || boundary[3] > height2) { + return false; + } + let textWidth = d2.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x12, x2, y12, y2, xc, yc, _x1, _x2, _y1, _y2; + for (let i = 0; i < n; ++i) { + dx = (anchors[i] & 3) - 1; + dy = (anchors[i] >>> 2 & 3) - 1; + isInside = dx === 0 && dy === 0 || offsets2[i] < 0; + sizeFactor = dx && dy ? Math.SQRT1_2 : 1; + insideFactor = offsets2[i] < 0 ? -1 : 1; + x12 = boundary[1 + dx] + offsets2[i] * dx * sizeFactor; + yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets2[i] * dy * sizeFactor; + y12 = yc - textHeight / 2; + y2 = yc + textHeight / 2; + _x1 = $2(x12); + _y1 = $2(y12); + _y2 = $2(y2); + if (!textWidth) { + if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x12, x12, y12, y2, boundary, isInside)) { + continue; + } else { + textWidth = textMetrics.width(d2.datum, d2.datum.text); + } + } + xc = x12 + insideFactor * textWidth * dx / 2; + x12 = xc - textWidth / 2; + x2 = xc + textWidth / 2; + _x1 = $2(x12); + _x2 = $2(x2); + if (test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside)) { + d2.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x12; + d2.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y12; + d2.align = Aligns[dx * insideFactor + 1]; + d2.baseline = Baselines[dy * insideFactor + 1]; + bm0.setRange(_x1, _y1, _x2, _y2); + return true; } - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2hfOH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], next = [], children, i, n, index = -1; - while(node = nodes.pop()){ - next.push(node); - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)nodes.push(children[i]); - } - while(node = next.pop())callback.call(that, node, ++index, this); - return this; + } + return false; + }; + } + function test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside) { + return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); + } + const TOP = 0, MIDDLE = 4, BOTTOM = 8, LEFT = 0, CENTER = 1, RIGHT = 2; + const anchorCode = { + "top-left": TOP + LEFT, + "top": TOP + CENTER, + "top-right": TOP + RIGHT, + "left": MIDDLE + LEFT, + "middle": MIDDLE + CENTER, + "right": MIDDLE + RIGHT, + "bottom-left": BOTTOM + LEFT, + "bottom": BOTTOM + CENTER, + "bottom-right": BOTTOM + RIGHT + }; + const placeAreaLabel = { + "naive": placeAreaLabelNaive, + "reduced-search": placeAreaLabelReducedSearch, + "floodfill": placeAreaLabelFloodFill + }; + function labelLayout(texts, size, compare2, offset2, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding2, method2) { + if (!texts.length) return texts; + const positions2 = Math.max(offset2.length, anchor.length), offsets2 = getOffsets(offset2, positions2), anchors = getAnchors(anchor, positions2), marktype = markType(texts[0].datum), grouptype = marktype === "group" && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === "area", boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding2 === null || padding2 === Infinity, isNaiveGroupArea = isGroupArea && method2 === "naive"; + let maxTextWidth = -1, maxTextHeight = -1; + const data2 = texts.map((d2) => { + const textWidth = infPadding ? textMetrics.width(d2, d2.text) : void 0; + maxTextWidth = Math.max(maxTextWidth, textWidth); + maxTextHeight = Math.max(maxTextHeight, d2.fontSize); + return { + datum: d2, + opacity: 0, + x: void 0, + y: void 0, + align: void 0, + baseline: void 0, + boundary: boundary(d2), + textWidth + }; }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cbIl9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this){ - if (callback.call(that, node, ++index, this)) return node; + padding2 = padding2 === null || padding2 === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset2) : padding2; + const $2 = scaler(size[0], size[1], padding2); + let bitmaps; + if (!isNaiveGroupArea) { + if (compare2) { + data2.sort((a2, b2) => compare2(a2.datum, b2.datum)); + } + let labelInside = false; + for (let i = 0; i < anchors.length && !labelInside; ++i) { + labelInside = anchors[i] === 5 || offsets2[i] < 0; + } + const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d2) => d2.datum); + bitmaps = avoidMarks.length || baseMark ? markBitmaps($2, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($2, avoidBaseMark && data2); + } + const place2 = isGroupArea ? placeAreaLabel[method2]($2, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($2, bitmaps, anchors, offsets2); + data2.forEach((d2) => d2.opacity = +place2(d2)); + return data2; + } + function getOffsets(_, count2) { + const offsets2 = new Float64Array(count2), n = _.length; + for (let i = 0; i < n; ++i) offsets2[i] = _[i] || 0; + for (let i = n; i < count2; ++i) offsets2[i] = offsets2[n - 1]; + return offsets2; + } + function getAnchors(_, count2) { + const anchors = new Int8Array(count2), n = _.length; + for (let i = 0; i < n; ++i) anchors[i] |= anchorCode[_[i]]; + for (let i = n; i < count2; ++i) anchors[i] = anchors[n - 1]; + return anchors; + } + function markType(item) { + return item && item.mark && item.mark.marktype; + } + function markBoundary(marktype, grouptype, lineAnchor, markIndex) { + const xy = (d2) => [d2.x, d2.x, d2.x, d2.y, d2.y, d2.y]; + if (!marktype) { + return xy; + } else if (marktype === "line" || marktype === "area") { + return (d2) => xy(d2.datum); + } else if (grouptype === "line") { + return (d2) => { + const items = d2.datum.items[markIndex].items; + return xy(items.length ? items[lineAnchor === "start" ? 0 : items.length - 1] : { + x: NaN, + y: NaN + }); + }; + } else { + return (d2) => { + const b2 = d2.datum.bounds; + return [b2.x1, (b2.x1 + b2.x2) / 2, b2.x2, b2.y1, (b2.y1 + b2.y2) / 2, b2.y2]; + }; + } + } + const Output$1 = ["x", "y", "opacity", "align", "baseline"]; + const Anchors = ["top-left", "left", "bottom-left", "top", "bottom", "top-right", "right", "bottom-right"]; + function Label$1(params2) { + Transform.call(this, null, params2); + } + Label$1.Definition = { + type: "Label", + metadata: { + modifies: true + }, + params: [{ + name: "size", + type: "number", + array: true, + length: 2, + required: true + }, { + name: "sort", + type: "compare" + }, { + name: "anchor", + type: "string", + array: true, + default: Anchors + }, { + name: "offset", + type: "number", + array: true, + default: [1] + }, { + name: "padding", + type: "number", + default: 0, + null: true + }, { + name: "lineAnchor", + type: "string", + values: ["start", "end"], + default: "end" + }, { + name: "markIndex", + type: "number", + default: 0 + }, { + name: "avoidBaseMark", + type: "boolean", + default: true + }, { + name: "avoidMarks", + type: "data", + array: true + }, { + name: "method", + type: "string", + default: "naive" + }, { + name: "as", + type: "string", + array: true, + length: Output$1.length, + default: Output$1 + }] + }; + inherits(Label$1, Transform, { + transform(_, pulse2) { + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || modp("sort"))) return; + if (!_.size || _.size.length !== 2) { + error("Size parameter should be specified as a [width, height] array."); + } + const as = _.as || Output$1; + labelLayout(pulse2.materialize(pulse2.SOURCE).source || [], _.size, _.sort, array$4(_.offset == null ? 1 : _.offset), array$4(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || "end", _.markIndex || 0, _.padding === void 0 ? 0 : _.padding, _.method || "naive").forEach((l) => { + const t = l.datum; + t[as[0]] = l.x; + t[as[1]] = l.y; + t[as[2]] = l.opacity; + t[as[3]] = l.align; + t[as[4]] = l.baseline; + }); + return pulse2.reflow(mod).modifies(as); + } + }); + const label = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + label: Label$1 + }, Symbol.toStringTag, { value: "Module" })); + function partition(data2, groupby) { + var groups = [], get2 = function(f) { + return f(t); + }, map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6qKl0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, children = node.children, i = children && children.length; - while(--i >= 0)sum += children[i].value; - node.value = sum; + g.push(t); + } + } + return groups; + } + function Loess(params2) { + Transform.call(this, null, params2); + } + Loess.Definition = { + "type": "Loess", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "bandwidth", + "type": "number", + "default": 0.3 + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Loess, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), m2 = names.length, as = _.as || [accessorName(_.x), accessorName(_.y)], values2 = []; + groups.forEach((g) => { + loess(g, _.x, _.y, _.bandwidth || 0.3).forEach((p) => { + const t = {}; + for (let i = 0; i < m2; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }); }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0VcFA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(compare) { - return this.eachBefore(function(node) { - if (node.children) node.children.sort(compare); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const Methods = { + constant: constant$3, + linear, + log: log$2, + exp: exp$1, + pow: pow$2, + quad, + poly + }; + const degreesOfFreedom = (method2, order) => method2 === "poly" ? order : method2 === "quad" ? 2 : 1; + function Regression(params2) { + Transform.call(this, null, params2); + } + Regression.Definition = { + "type": "Regression", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "string", + "default": "linear", + "values": Object.keys(Methods) + }, { + "name": "order", + "type": "number", + "default": 3 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "params", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Regression, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), method2 = _.method || "linear", order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method2, order), as = _.as || [accessorName(_.x), accessorName(_.y)], fit2 = Methods[method2], values2 = []; + let domain2 = _.extent; + if (!has$1(Methods, method2)) { + error("Invalid regression method: " + method2); + } + if (domain2 != null) { + if (method2 === "log" && domain2[0] <= 0) { + pulse2.dataflow.warn("Ignoring extent with values <= 0 for log regression."); + domain2 = null; + } + } + groups.forEach((g) => { + const n = g.length; + if (n <= dof) { + pulse2.dataflow.warn("Skipping regression with more parameters than data points."); + return; + } + const model = fit2(g, _.x, _.y, order); + if (_.params) { + values2.push(ingest$1({ + keys: g.dims, + coef: model.coef, + rSquared: model.rSquared + })); + return; + } + const dom = domain2 || extent(g, _.x), add2 = (p) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }; + if (method2 === "linear" || method2 === "constant") { + dom.forEach((x2) => add2([x2, model.predict(x2)])); + } else { + sampleCurve(model.predict, dom, 25, 200).forEach(add2); + } }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kCaNs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(end) { - var start = this, ancestor = leastCommonAncestor(start, end), nodes = [ - start - ]; - while(start !== ancestor){ - start = start.parent; - nodes.push(start); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const reg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + loess: Loess, + regression: Regression + }, Symbol.toStringTag, { value: "Module" })); + const epsilon$1 = 11102230246251565e-32; + const splitter = 134217729; + const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1; + function sum(elen, e, flen, f, h2) { + let Q, Qnew, hh, bvirt; + let enow = e[0]; + let fnow = f[0]; + let eindex = 0; + let findex = 0; + if (fnow > enow === fnow > -enow) { + Q = enow; + enow = e[++eindex]; + } else { + Q = fnow; + fnow = f[++findex]; + } + let hindex = 0; + if (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = enow + Q; + hh = Q - (Qnew - enow); + enow = e[++eindex]; + } else { + Qnew = fnow + Q; + hh = Q - (Qnew - fnow); + fnow = f[++findex]; + } + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + while (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; + } else { + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; } - var k = nodes.length; - while(end !== ancestor){ - nodes.splice(k, 0, end); - end = end.parent; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; } - return nodes; - }); -function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null; - a = aNodes.pop(); - b = bNodes.pop(); - while(a === b){ - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - return c; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ciAJo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var node = this, nodes = [ - node - ]; - while(node = node.parent)nodes.push(node); - return nodes; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"exMS3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return Array.from(this); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2HPU5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) leaves.push(node); - }); - return leaves; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8bu7D":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) links.push({ - source: node.parent, - target: node - }); - }); - return links; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flf9N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function*() { - var node = this, current, next = [ - node - ], children, i, n; - do { - current = next.reverse(), next = []; - while(node = current.pop()){ - yield node; - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)next.push(children[i]); - } - }while (next.length); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lUJH5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var radius = null, dx = 1, dy = 1, padding = (0, _constantJs.constantZero); - function pack(root) { - const random = (0, _lcgJsDefault.default)(); - root.x = dx / 2, root.y = dy / 2; - if (radius) root.eachBefore(radiusLeaf(radius)).eachAfter(packChildrenRandom(padding, 0.5, random)).eachBefore(translateChild(1)); - else root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom((0, _constantJs.constantZero), 1, random)).eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); - return root; - } - pack.radius = function(x) { - return arguments.length ? (radius = (0, _accessorsJs.optional)(x), pack) : radius; - }; - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [ - dx, - dy - ]; - }; - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), pack) : padding; - }; - return pack; - }); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _siblingsJs = require("./siblings.js"); -function defaultRadius(d) { - return Math.sqrt(d.value); -} -function radiusLeaf(radius) { - return function(node) { - if (!node.children) node.r = Math.max(0, +radius(node) || 0); - }; -} -function packChildrenRandom(padding, k, random) { - return function(node) { - if (children = node.children) { - var children, i, n = children.length, r = padding(node) * k || 0, e; - if (r) for(i = 0; i < n; ++i)children[i].r += r; - e = (0, _siblingsJs.packSiblingsRandom)(children, random); - if (r) for(i = 0; i < n; ++i)children[i].r -= r; - node.r = e + r; + } + } + while (eindex < elen) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + while (findex < flen) { + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + if (Q !== 0 || hindex === 0) { + h2[hindex++] = Q; + } + return hindex; + } + function estimate(elen, e) { + let Q = e[0]; + for (let i = 1; i < elen; i++) Q += e[i]; + return Q; + } + function vec(n) { + return new Float64Array(n); + } + const ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1; + const ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1; + const ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1; + const B = vec(4); + const C1 = vec(8); + const C2 = vec(12); + const D = vec(16); + const u = vec(4); + function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { + let acxtail, acytail, bcxtail, bcytail; + let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3; + const acx = ax - cx; + const bcx = bx - cx; + const acy = ay - cy; + const bcy = by - cy; + s1 = acx * bcy; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcx; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + B[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + B[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + B[2] = _j - (u3 - bvirt) + (_i - bvirt); + B[3] = u3; + let det = estimate(4, B); + let errbound = ccwerrboundB * detsum; + if (det >= errbound || -det >= errbound) { + return det; + } + bvirt = ax - acx; + acxtail = ax - (acx + bvirt) + (bvirt - cx); + bvirt = bx - bcx; + bcxtail = bx - (bcx + bvirt) + (bvirt - cx); + bvirt = ay - acy; + acytail = ay - (acy + bvirt) + (bvirt - cy); + bvirt = by - bcy; + bcytail = by - (bcy + bvirt) + (bvirt - cy); + if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) { + return det; + } + errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); + det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); + if (det >= errbound || -det >= errbound) return det; + s1 = acxtail * bcy; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcx; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C1len = sum(4, B, 4, u, C1); + s1 = acx * bcytail; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcxtail; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C2len = sum(C1len, C1, 4, u, C2); + s1 = acxtail * bcytail; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcxtail; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const Dlen = sum(C2len, C2, 4, u, D); + return D[Dlen - 1]; + } + function orient2d(ax, ay, bx, by, cx, cy) { + const detleft = (ay - cy) * (bx - cx); + const detright = (ax - cx) * (by - cy); + const det = detleft - detright; + const detsum = Math.abs(detleft + detright); + if (Math.abs(det) >= ccwerrboundA * detsum) return det; + return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); + } + const EPSILON = Math.pow(2, -52); + const EDGE_STACK = new Uint32Array(512); + class Delaunator { + static from(points2, getX = defaultGetX, getY = defaultGetY) { + const n = points2.length; + const coords = new Float64Array(n * 2); + for (let i = 0; i < n; i++) { + const p = points2[i]; + coords[2 * i] = getX(p); + coords[2 * i + 1] = getY(p); + } + return new Delaunator(coords); + } + constructor(coords) { + const n = coords.length >> 1; + if (n > 0 && typeof coords[0] !== "number") throw new Error("Expected coords to contain numbers."); + this.coords = coords; + const maxTriangles = Math.max(2 * n - 5, 0); + this._triangles = new Uint32Array(maxTriangles * 3); + this._halfedges = new Int32Array(maxTriangles * 3); + this._hashSize = Math.ceil(Math.sqrt(n)); + this._hullPrev = new Uint32Array(n); + this._hullNext = new Uint32Array(n); + this._hullTri = new Uint32Array(n); + this._hullHash = new Int32Array(this._hashSize); + this._ids = new Uint32Array(n); + this._dists = new Float64Array(n); + this.update(); + } + update() { + const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; + const n = coords.length >> 1; + let minX = Infinity; + let minY = Infinity; + let maxX = -Infinity; + let maxY2 = -Infinity; + for (let i = 0; i < n; i++) { + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (x2 < minX) minX = x2; + if (y2 < minY) minY = y2; + if (x2 > maxX) maxX = x2; + if (y2 > maxY2) maxY2 = y2; + this._ids[i] = i; + } + const cx = (minX + maxX) / 2; + const cy = (minY + maxY2) / 2; + let i0, i1, i2; + for (let i = 0, minDist = Infinity; i < n; i++) { + const d2 = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); + if (d2 < minDist) { + i0 = i; + minDist = d2; } - }; -} -function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; -} - -},{"../accessors.js":"jK6n5","../constant.js":"72P4a","../lcg.js":"d0wK8","./siblings.js":"goIsb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jK6n5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "optional", ()=>optional); -parcelHelpers.export(exports, "required", ()=>required); -function optional(f) { - return f == null ? null : required(f); -} -function required(f) { - if (typeof f !== "function") throw new Error; - return f; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"72P4a":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "constantZero", ()=>constantZero); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); -function constantZero() { - return 0; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d0wK8":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"goIsb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "packSiblingsRandom", ()=>packSiblingsRandom); -parcelHelpers.export(exports, "default", ()=>function(circles) { - packSiblingsRandom(circles, (0, _lcgJsDefault.default)()); - return circles; - }); -var _arrayJs = require("../array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _encloseJs = require("./enclose.js"); -function place(b, a, c) { - var dx = b.x - a.x, x, a2, dy = b.y - a.y, y, b2, d2 = dx * dx + dy * dy; - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; + } + const i0x = coords[2 * i0]; + const i0y = coords[2 * i0 + 1]; + for (let i = 0, minDist = Infinity; i < n; i++) { + if (i === i0) continue; + const d2 = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); + if (d2 < minDist && d2 > 0) { + i1 = i; + minDist = d2; + } + } + let i1x = coords[2 * i1]; + let i1y = coords[2 * i1 + 1]; + let minRadius = Infinity; + for (let i = 0; i < n; i++) { + if (i === i0 || i === i1) continue; + const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); + if (r < minRadius) { + i2 = i; + minRadius = r; + } + } + let i2x = coords[2 * i2]; + let i2y = coords[2 * i2 + 1]; + if (minRadius === Infinity) { + for (let i = 0; i < n; i++) { + this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; + } + quicksort(this._ids, this._dists, 0, n - 1); + const hull = new Uint32Array(n); + let j = 0; + for (let i = 0, d0 = -Infinity; i < n; i++) { + const id2 = this._ids[i]; + const d2 = this._dists[id2]; + if (d2 > d0) { + hull[j++] = id2; + d0 = d2; + } + } + this.hull = hull.subarray(0, j); + this.triangles = new Uint32Array(0); + this.halfedges = new Uint32Array(0); + return; + } + if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { + const i = i1; + const x2 = i1x; + const y2 = i1y; + i1 = i2; + i1x = i2x; + i1y = i2y; + i2 = i; + i2x = x2; + i2y = y2; + } + const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); + this._cx = center.x; + this._cy = center.y; + for (let i = 0; i < n; i++) { + this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); + } + quicksort(this._ids, this._dists, 0, n - 1); + this._hullStart = i0; + let hullSize = 3; + hullNext[i0] = hullPrev[i2] = i1; + hullNext[i1] = hullPrev[i0] = i2; + hullNext[i2] = hullPrev[i1] = i0; + hullTri[i0] = 0; + hullTri[i1] = 1; + hullTri[i2] = 2; + hullHash.fill(-1); + hullHash[this._hashKey(i0x, i0y)] = i0; + hullHash[this._hashKey(i1x, i1y)] = i1; + hullHash[this._hashKey(i2x, i2y)] = i2; + this.trianglesLen = 0; + this._addTriangle(i0, i1, i2, -1, -1, -1); + for (let k = 0, xp, yp; k < this._ids.length; k++) { + const i = this._ids[k]; + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (k > 0 && Math.abs(x2 - xp) <= EPSILON && Math.abs(y2 - yp) <= EPSILON) continue; + xp = x2; + yp = y2; + if (i === i0 || i === i1 || i === i2) continue; + let start = 0; + for (let j = 0, key2 = this._hashKey(x2, y2); j < this._hashSize; j++) { + start = hullHash[(key2 + j) % this._hashSize]; + if (start !== -1 && start !== hullNext[start]) break; + } + start = hullPrev[start]; + let e = start, q; + while (q = hullNext[e], orient2d(x2, y2, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) { + e = q; + if (e === start) { + e = -1; + break; + } + } + if (e === -1) continue; + let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); + hullTri[i] = this._legalize(t + 2); + hullTri[e] = t; + hullSize++; + let n2 = hullNext[e]; + while (q = hullNext[n2], orient2d(x2, y2, coords[2 * n2], coords[2 * n2 + 1], coords[2 * q], coords[2 * q + 1]) < 0) { + t = this._addTriangle(n2, i, q, hullTri[i], -1, hullTri[n2]); + hullTri[i] = this._legalize(t + 2); + hullNext[n2] = n2; + hullSize--; + n2 = q; + } + if (e === start) { + while (q = hullPrev[e], orient2d(x2, y2, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) { + t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); + this._legalize(t + 2); + hullTri[q] = t; + hullNext[e] = e; + hullSize--; + e = q; + } + } + this._hullStart = hullPrev[i] = e; + hullNext[e] = hullPrev[n2] = i; + hullNext[i] = n2; + hullHash[this._hashKey(x2, y2)] = i; + hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; + } + this.hull = new Uint32Array(hullSize); + for (let i = 0, e = this._hullStart; i < hullSize; i++) { + this.hull[i] = e; + e = hullNext[e]; + } + this.triangles = this._triangles.subarray(0, this.trianglesLen); + this.halfedges = this._halfedges.subarray(0, this.trianglesLen); + } + _hashKey(x2, y2) { + return Math.floor(pseudoAngle(x2 - this._cx, y2 - this._cy) * this._hashSize) % this._hashSize; + } + _legalize(a2) { + const { _triangles: triangles, _halfedges: halfedges, coords } = this; + let i = 0; + let ar = 0; + while (true) { + const b2 = halfedges[a2]; + const a0 = a2 - a2 % 3; + ar = a0 + (a2 + 2) % 3; + if (b2 === -1) { + if (i === 0) break; + a2 = EDGE_STACK[--i]; + continue; + } + const b0 = b2 - b2 % 3; + const al = a0 + (a2 + 1) % 3; + const bl2 = b0 + (b2 + 2) % 3; + const p02 = triangles[ar]; + const pr = triangles[a2]; + const pl = triangles[al]; + const p1 = triangles[bl2]; + const illegal = inCircle( + coords[2 * p02], + coords[2 * p02 + 1], + coords[2 * pr], + coords[2 * pr + 1], + coords[2 * pl], + coords[2 * pl + 1], + coords[2 * p1], + coords[2 * p1 + 1] + ); + if (illegal) { + triangles[a2] = p1; + triangles[b2] = p02; + const hbl = halfedges[bl2]; + if (hbl === -1) { + let e = this._hullStart; + do { + if (this._hullTri[e] === bl2) { + this._hullTri[e] = a2; + break; + } + e = this._hullPrev[e]; + } while (e !== this._hullStart); + } + this._link(a2, hbl); + this._link(b2, halfedges[ar]); + this._link(ar, bl2); + const br2 = b0 + (b2 + 1) % 3; + if (i < EDGE_STACK.length) { + EDGE_STACK[i++] = br2; + } } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; + if (i === 0) break; + a2 = EDGE_STACK[--i]; } - } else { - c.x = a.x + c.r; - c.y = a.y; + } + return ar; } -} -function intersects(a, b) { - var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function score(node) { - var a = node._, b = node.next._, ab = a.r + b.r, dx = (a.x * b.r + b.x * a.r) / ab, dy = (a.y * b.r + b.y * a.r) / ab; + _link(a2, b2) { + this._halfedges[a2] = b2; + if (b2 !== -1) this._halfedges[b2] = a2; + } + // add a new triangle given vertex indices and adjacent half-edge ids + _addTriangle(i0, i1, i2, a2, b2, c2) { + const t = this.trianglesLen; + this._triangles[t] = i0; + this._triangles[t + 1] = i1; + this._triangles[t + 2] = i2; + this._link(t, a2); + this._link(t + 1, b2); + this._link(t + 2, c2); + this.trianglesLen += 3; + return t; + } + } + function pseudoAngle(dx, dy) { + const p = dx / (Math.abs(dx) + Math.abs(dy)); + return (dy > 0 ? 3 - p : 1 + p) / 4; + } + function dist(ax, ay, bx, by) { + const dx = ax - bx; + const dy = ay - by; return dx * dx + dy * dy; -} -function Node(circle) { - this._ = circle; - this.next = null; - this.previous = null; -} -function packSiblingsRandom(circles, random) { - if (!(n = (circles = (0, _arrayJsDefault.default)(circles)).length)) return 0; - var a, b, c, n, aa, ca, i, j, k, sj, sk; - // Place the first circle. - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; - // Place the second circle. - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; - // Place the third circle. - place(b, a, c = circles[2]); - // Initialize the front-chain using the first three circles a, b and c. - a = new Node(a), b = new Node(b), c = new Node(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; - // Attempt to place each remaining circle… - pack: for(i = 3; i < n; ++i){ - place(a._, b._, c = circles[i]), c = new Node(c); - // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - do if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - while (j !== k.next); - // Success! Insert the new circle c between a and b. - c.previous = a, c.next = b, a.next = b.previous = b = c; - // Compute the new closest circle pair to the centroid. - aa = score(a); - while((c = c.next) !== b)if ((ca = score(c)) < aa) a = c, aa = ca; - b = a.next; - } - // Compute the enclosing circle of the front chain. - a = [ - b._ - ], c = b; - while((c = c.next) !== b)a.push(c._); - c = (0, _encloseJs.packEncloseRandom)(a, random); - // Translate the circles to put the enclosing circle around the origin. - for(i = 0; i < n; ++i)a = circles[i], a.x -= c.x, a.y -= c.y; - return c.r; -} - -},{"../array.js":"2JoJW","../lcg.js":"d0wK8","./enclose.js":"4VLut","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2JoJW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -parcelHelpers.export(exports, "shuffle", ()=>shuffle); -function shuffle(array, random) { - let m = array.length, t, i; - while(m){ - i = random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4VLut":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(circles) { - return packEncloseRandom(circles, (0, _lcgJsDefault.default)()); - }); -parcelHelpers.export(exports, "packEncloseRandom", ()=>packEncloseRandom); -var _arrayJs = require("../array.js"); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function packEncloseRandom(circles, random) { - var i = 0, n = (circles = (0, _arrayJs.shuffle)(Array.from(circles), random)).length, B = [], p, e; - while(i < n){ - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i; - else e = encloseBasis(B = extendBasis(B, p)), i = 0; + } + function inCircle(ax, ay, bx, by, cx, cy, px2, py2) { + const dx = ax - px2; + const dy = ay - py2; + const ex = bx - px2; + const ey = by - py2; + const fx = cx - px2; + const fy = cy - py2; + const ap = dx * dx + dy * dy; + const bp = ex * ex + ey * ey; + const cp = fx * fx + fy * fy; + return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; + } + function circumradius(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d2 = 0.5 / (dx * ey - dy * ex); + const x2 = (ey * bl2 - dy * cl) * d2; + const y2 = (dx * cl - ex * bl2) * d2; + return x2 * x2 + y2 * y2; + } + function circumcenter(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d2 = 0.5 / (dx * ey - dy * ex); + const x2 = ax + (ey * bl2 - dy * cl) * d2; + const y2 = ay + (dx * cl - ex * bl2) * d2; + return { x: x2, y: y2 }; + } + function quicksort(ids, dists, left, right) { + if (right - left <= 20) { + for (let i = left + 1; i <= right; i++) { + const temp2 = ids[i]; + const tempDist = dists[temp2]; + let j = i - 1; + while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; + ids[j + 1] = temp2; + } + } else { + const median2 = left + right >> 1; + let i = left + 1; + let j = right; + swap(ids, median2, i); + if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); + if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); + if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); + const temp2 = ids[i]; + const tempDist = dists[temp2]; + while (true) { + do + i++; + while (dists[ids[i]] < tempDist); + do + j--; + while (dists[ids[j]] > tempDist); + if (j < i) break; + swap(ids, i, j); + } + ids[left + 1] = ids[j]; + ids[j] = temp2; + if (right - i + 1 >= j - left) { + quicksort(ids, dists, i, right); + quicksort(ids, dists, left, j - 1); + } else { + quicksort(ids, dists, left, j - 1); + quicksort(ids, dists, i, right); + } } - return e; -} -function extendBasis(B, p) { - var i, j; - if (enclosesWeakAll(p, B)) return [ - p - ]; - // If we get here then B must have at least one element. - for(i = 0; i < B.length; ++i){ - if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) return [ - B[i], - p - ]; + } + function swap(arr, i, j) { + const tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + } + function defaultGetX(p) { + return p[0]; + } + function defaultGetY(p) { + return p[1]; + } + const epsilon = 1e-6; + class Path { + constructor() { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; } - // If we get here then B must have at least two elements. - for(i = 0; i < B.length - 1; ++i)for(j = i + 1; j < B.length; ++j){ - if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) return [ - B[i], - B[j], - p - ]; + moveTo(x2, y2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; } - // If we get here then something is very wrong. - throw new Error; -} -function enclosesNot(a, b) { - var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; -} -function enclosesWeak(a, b) { - var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function enclosesWeakAll(a, B) { - for(var i = 0; i < B.length; ++i){ - if (!enclosesWeak(a, B[i])) return false; + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._ += "Z"; + } } - return true; -} -function encloseBasis(B) { - switch(B.length){ - case 1: - return encloseBasis1(B[0]); - case 2: - return encloseBasis2(B[0], B[1]); - case 3: - return encloseBasis3(B[0], B[1], B[2]); + lineTo(x2, y2) { + this._ += `L${this._x1 = +x2},${this._y1 = +y2}`; } -} -function encloseBasis1(a) { - return { - x: a.x, - y: a.y, - r: a.r - }; -} -function encloseBasis2(a, b) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); - return { - x: (x1 + x2 + x21 / l * r21) / 2, - y: (y1 + y2 + y21 / l * r21) / 2, - r: (l + r1 + r2) / 2 - }; -} -function encloseBasis3(a, b, c) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c.x, y3 = c.y, r3 = c.r, a2 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c2 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a2 * b3, xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb = (b3 * c2 - b2 * c3) / ab, ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, yb = (a2 * c3 - a3 * c2) / ab, A = xb * xb + yb * yb - 1, B = 2 * (r1 + xa * xb + ya * yb), C = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B); - return { - x: x1 + xa + xb * r, - y: y1 + ya + yb * r, - r: r - }; -} - -},{"../array.js":"2JoJW","../lcg.js":"d0wK8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2uWl8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var dx = 1, dy = 1, padding = 0, round = false; - function partition(root) { - var n = root.height + 1; - root.x0 = root.y0 = padding; - root.x1 = dx; - root.y1 = dy / n; - root.eachBefore(positionNode(dy, n)); - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(dy, n) { - return function(node) { - if (node.children) (0, _diceJsDefault.default)(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n); - var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - partition.round = function(x) { - return arguments.length ? (round = !!x, partition) : round; - }; - partition.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [ - dx, - dy - ]; - }; - partition.padding = function(x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - return partition; - }); -var _roundJs = require("./treemap/round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); - -},{"./treemap/round.js":"4XKsQ","./treemap/dice.js":"5Coec","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4XKsQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Coec":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value; - while(++i < n){ - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"81qCy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var id = defaultId, parentId = defaultParentId, path; - function stratify(data) { - var nodes = Array.from(data), currentId = id, currentParentId = parentId, n, d, i, root, parent, node, nodeId, nodeKey, nodeByKey = new Map; - if (path != null) { - const I = nodes.map((d, i)=>normalize(path(d, i, data))); - const P = I.map(parentof); - const S = new Set(I).add(""); - for (const i of P)if (!S.has(i)) { - S.add(i); - I.push(i); - P.push(parentof(i)); - nodes.push(imputed); - } - currentId = (_, i)=>I[i]; - currentParentId = (_, i)=>P[i]; - } - for(i = 0, n = nodes.length; i < n; ++i){ - d = nodes[i], node = nodes[i] = new (0, _indexJs.Node)(d); - if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) { - nodeKey = node.id = nodeId; - nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); - } - if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) node.parent = nodeId; - } - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (nodeId = node.parent) { - parent = nodeByKey.get(nodeId); - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node); - else parent.children = [ - node - ]; - node.parent = parent; - } else { - if (root) throw new Error("multiple roots"); - root = node; - } - } - if (!root) throw new Error("no root"); - // When imputing internal nodes, only introduce roots if needed. - // Then replace the imputed marker data with null. - if (path != null) { - while(root.data === imputed && root.children.length === 1)root = root.children[0], --n; - for(let i = nodes.length - 1; i >= 0; --i){ - node = nodes[i]; - if (node.data !== imputed) break; - node.data = null; - } - } - root.parent = preroot; - root.eachBefore(function(node) { - node.depth = node.parent.depth + 1; - --n; - }).eachBefore((0, _indexJs.computeHeight)); - root.parent = null; - if (n > 0) throw new Error("cycle"); - return root; - } - stratify.id = function(x) { - return arguments.length ? (id = (0, _accessorsJs.optional)(x), stratify) : id; - }; - stratify.parentId = function(x) { - return arguments.length ? (parentId = (0, _accessorsJs.optional)(x), stratify) : parentId; - }; - stratify.path = function(x) { - return arguments.length ? (path = (0, _accessorsJs.optional)(x), stratify) : path; - }; - return stratify; - }); -var _accessorsJs = require("./accessors.js"); -var _indexJs = require("./hierarchy/index.js"); -var preroot = { - depth: -1 -}, ambiguous = {}, imputed = {}; -function defaultId(d) { - return d.id; -} -function defaultParentId(d) { - return d.parentId; -} -// To normalize a path, we coerce to a string, strip the trailing slash if any -// (as long as the trailing slash is not immediately preceded by another slash), -// and add leading slash if missing. -function normalize(path) { - path = `${path}`; - let i = path.length; - if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1); - return path[0] === "/" ? path : `/${path}`; -} -// Walk backwards to find the first slash that is not the leading slash, e.g.: -// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased -// because the id of the root must be a truthy value.) -function parentof(path) { - let i = path.length; - if (i < 2) return ""; - while(--i > 1)if (slash(path, i)) break; - return path.slice(0, i); -} -// Slashes can be escaped; to determine whether a slash is a path delimiter, we -// count the number of preceding backslashes escaping the forward slash: an odd -// number indicates an escaped forward slash. -function slash(path, i) { - if (path[i] === "/") { - let k = 0; - while(i > 0 && path[--i] === "\\")++k; - if ((k & 1) === 0) return true; + arc(x2, y2, r) { + x2 = +x2, y2 = +y2, r = +r; + const x02 = x2 + r; + const y02 = y2; + if (r < 0) throw new Error("negative radius"); + if (this._x1 === null) this._ += `M${x02},${y02}`; + else if (Math.abs(this._x1 - x02) > epsilon || Math.abs(this._y1 - y02) > epsilon) this._ += "L" + x02 + "," + y02; + if (!r) return; + this._ += `A${r},${r},0,1,1,${x2 - r},${y2}A${r},${r},0,1,1,${this._x1 = x02},${this._y1 = y02}`; } - return false; -} - -},{"./accessors.js":"jK6n5","./hierarchy/index.js":"aKFc0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i82wc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null; - function tree(root) { - var t = treeRoot(root); - // Compute the layout using Buchheim et al.’s algorithm. - t.eachAfter(firstWalk), t.parent.m = -t.z; - t.eachBefore(secondWalk); - // If a fixed node size is specified, scale x and y. - if (nodeSize) root.eachBefore(sizeNode); - else { - var left = root, right = root, bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = node.depth * ky; - }); - } - return root; - } - // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is - // applied recursively to the children of v, as well as the function - // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the - // node v is placed to the midpoint of its outermost children. - function firstWalk(v) { - var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else v.z = midpoint; - } else if (w) v.z = w.z + separation(v._, w._); - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } - // Computes all real x-coordinates by summing up the modifiers recursively. - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += v.parent.m; - } - // The core of the algorithm. Here, a new subtree is combined with the - // previous subtrees. Threads are used to traverse the inside and outside - // contours of the left and right subtree up to the highest common level. The - // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the - // superscript o means outside and i means inside, the subscript - means left - // subtree and + means right subtree. For summing up the modifiers along the - // contour, we use respective variables si+, si-, so-, and so+. Whenever two - // nodes of the inside contours conflict, we compute the left one of the - // greatest uncommon ancestors using the function ANCESTOR and call MOVE - // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. - // Finally, we add a new thread (if necessary). - function apportion(v, w, ancestor) { - if (w) { - var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; - while(vim = nextRight(vim), vip = nextLeft(vip), vim && vip){ - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; - } - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; - } - tree.separation = function(x) { - return arguments.length ? (separation = x, tree) : separation; - }; - tree.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [ - dx, - dy - ]; - }; - tree.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : nodeSize ? [ - dx, - dy - ] : null; - }; - return tree; - }); -var _indexJs = require("./hierarchy/index.js"); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -// function radialSeparation(a, b) { -// return (a.parent === b.parent ? 1 : 2) / a.depth; -// } -// This function is used to traverse the left contour of a subtree (or -// subforest). It returns the successor of v on this contour. This successor is -// either given by the leftmost child of v or by the thread of v. The function -// returns null if and only if v is on the highest level of its subtree. -function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; -} -// This function works analogously to nextLeft. -function nextRight(v) { - var children = v.children; - return children ? children[children.length - 1] : v.t; -} -// Shifts the current subtree rooted at w+. This is done by increasing -// prelim(w+) and mod(w+) by shift. -function moveSubtree(wm, wp, shift) { - var change = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += shift; -} -// All other shifts, applied to the smaller subtrees between w- and w+, are -// performed by this function. To prepare the shifts, we have to adjust -// change(w+), shift(w+), and change(w-). -function executeShifts(v) { - var shift = 0, change = 0, children = v.children, i = children.length, w; - while(--i >= 0){ - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } -} -// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, -// returns the specified (default) ancestor. -function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; -} -function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - this.a = this; // ancestor - this.z = 0; // prelim - this.m = 0; // mod - this.c = 0; // change - this.s = 0; // shift - this.t = null; // thread - this.i = i; // number -} -TreeNode.prototype = Object.create((0, _indexJs.Node).prototype); -function treeRoot(root) { - var tree = new TreeNode(root, 0), node, nodes = [ - tree - ], child, children, i, n; - while(node = nodes.pop())if (children = node._.children) { - node.children = new Array(n = children.length); - for(i = n - 1; i >= 0; --i){ - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - (tree.parent = new TreeNode(null, 0)).children = [ - tree - ]; - return tree; -} - -},{"./hierarchy/index.js":"aKFc0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gn3Lw":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var tile = (0, _squarifyJsDefault.default), round = false, dx = 1, dy = 1, paddingStack = [ - 0 - ], paddingInner = (0, _constantJs.constantZero), paddingTop = (0, _constantJs.constantZero), paddingRight = (0, _constantJs.constantZero), paddingBottom = (0, _constantJs.constantZero), paddingLeft = (0, _constantJs.constantZero); - function treemap(root) { - root.x0 = root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [ - 0 - ]; - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(node) { - var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } - } - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [ - dx, - dy - ]; - }; - treemap.tile = function(x) { - return arguments.length ? (tile = (0, _accessorsJs.required)(x), treemap) : tile; - }; - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingInner; - }; - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingTop; - }; - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingRight; - }; - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingBottom; - }; - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingLeft; - }; - return treemap; - }); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _squarifyJs = require("./squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./round.js":"4XKsQ","./squarify.js":"6L9bi","../accessors.js":"jK6n5","../constant.js":"72P4a","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6L9bi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "phi", ()=>phi); -parcelHelpers.export(exports, "squarifyRatio", ()=>squarifyRatio); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var phi = (1 + Math.sqrt(5)) / 2; -function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; - while(i0 < n){ - dx = x1 - x0, dy = y1 - y0; - // Find the next non-empty node. - do sumValue = nodes[i1++].value; - while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - // Keep adding nodes while the aspect ratio maintains or improves. - for(; i1 < n; ++i1){ - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { - sumValue -= nodeValue; - break; - } - minRatio = newRatio; - } - // Position and record the row orientation. - rows.push(row = { - value: sumValue, - dice: dx < dy, - children: nodes.slice(i0, i1) - }); - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; + rect(x2, y2, w2, h2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${+w2}v${+h2}h${-w2}Z`; } - return rows; -} -exports.default = function custom(ratio) { - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); + value() { + return this._ || null; } - squarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - return squarify; -}(phi); - -},{"./dice.js":"5Coec","./slice.js":"bB6OY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bB6OY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value; - while(++i < n){ - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lIsJs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1); - for(sums[0] = sum = i = 0; i < n; ++i)sums[i + 1] = sum += nodes[i].value; - partition(0, n, parent.value, x0, y0, x1, y1); - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - var valueOffset = sums[i], valueTarget = value / 2 + valueOffset, k = i + 1, hi = j - 1; - while(k < hi){ - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1; - else hi = mid; - } - if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i + 1 < k) --k; - var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft; - if (x1 - x0 > y1 - y0) { - var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lS2RY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? (0, _sliceJsDefault.default) : (0, _diceJsDefault.default))(parent, x0, y0, x1, y1); - }); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); - -},{"./dice.js":"5Coec","./slice.js":"bB6OY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3C5OD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _squarifyJs = require("./squarify.js"); -exports.default = function custom(ratio) { - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && rows.ratio === ratio) { - var rows, row, nodes, i, j = -1, n, m = rows.length, value = parent.value; - while(++j < m){ - row = rows[j], nodes = row.children; - for(i = row.value = 0, n = nodes.length; i < n; ++i)row.value += nodes[i].value; - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1); - value -= row.value; - } - } else { - parent._squarify = rows = (0, _squarifyJs.squarifyRatio)(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; - } + } + class Polygon { + constructor() { + this._ = []; } - resquarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - return resquarify; -}((0, _squarifyJs.phi)); - -},{"./dice.js":"5Coec","./slice.js":"bB6OY","./squarify.js":"6L9bi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"htBqA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "label", ()=>Label); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -// bit mask for getting first 2 bytes of alpha value -const ALPHA_MASK = 0xff000000; -function baseBitmaps($, data) { - const bitmap = $.bitmap(); - // when there is no base mark but data points are to be avoided - (data || []).forEach((d)=>bitmap.set($(d.boundary[0]), $(d.boundary[3]))); - return [ - bitmap, - undefined - ]; -} -function markBitmaps($, baseMark, avoidMarks, labelInside, isGroupArea) { - // create canvas - const width = $.width, height = $.height, border = labelInside || isGroupArea, context = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), baseMarkContext = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), strokeContext = border && (0, _vegaCanvas.canvas)(width, height).getContext('2d'); - // render all marks to be avoided into canvas - avoidMarks.forEach((items)=>draw(context, items, false)); - draw(baseMarkContext, baseMark, false); - if (border) draw(strokeContext, baseMark, true); - // get canvas buffer, create bitmaps - const buffer = getBuffer(context, width, height), baseMarkBuffer = getBuffer(baseMarkContext, width, height), strokeBuffer = border && getBuffer(strokeContext, width, height), layer1 = $.bitmap(), layer2 = border && $.bitmap(); - // populate bitmap layers - let x, y, u, v, index, alpha, strokeAlpha, baseMarkAlpha; - for(y = 0; y < height; ++y)for(x = 0; x < width; ++x){ - index = y * width + x; - alpha = buffer[index] & ALPHA_MASK; - baseMarkAlpha = baseMarkBuffer[index] & ALPHA_MASK; - strokeAlpha = border && strokeBuffer[index] & ALPHA_MASK; - if (alpha || strokeAlpha || baseMarkAlpha) { - u = $(x); - v = $(y); - if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u, v); // update interior bitmap - if (border && (alpha || strokeAlpha)) layer2.set(u, v); // update border bitmap - } + moveTo(x2, y2) { + this._.push([x2, y2]); } - return [ - layer1, - layer2 - ]; -} -function getBuffer(context, width, height) { - return new Uint32Array(context.getImageData(0, 0, width, height).data.buffer); -} -function draw(context, items, interior) { - if (!items.length) return; - const type = items[0].mark.marktype; - if (type === 'group') items.forEach((group)=>{ - group.items.forEach((mark)=>draw(context, mark.items, interior)); - }); - else (0, _vegaScenegraph.Marks)[type].draw(context, { - items: interior ? items.map(prepare) : items - }); -} -/** - * Prepare item before drawing into canvas (setting stroke and opacity) - * @param {object} source item to be prepared - * @returns prepared item - */ function prepare(source) { - const item = (0, _vegaDataflow.rederive)(source, {}); - if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) return { - ...item, - strokeOpacity: 1, - stroke: '#000', - fillOpacity: 0 - }; - return item; -} -const DIV = 5, // bit shift from x, y index to bit vector array index -MOD = 31, // bit mask for index lookup within a bit vector -SIZE = 32, // individual bit vector size -RIGHT0 = new Uint32Array(SIZE + 1), // left-anchored bit vectors, full -> 0 -RIGHT1 = new Uint32Array(SIZE + 1); // right-anchored bit vectors, 0 -> full -RIGHT1[0] = 0; -RIGHT0[0] = ~RIGHT1[0]; -for(let i = 1; i <= SIZE; ++i){ - RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; - RIGHT0[i] = ~RIGHT1[i]; -} -function Bitmap(w, h) { - const array = new Uint32Array(~~((w * h + SIZE) / SIZE)); - function _set(index, mask) { - array[index] |= mask; + closePath() { + this._.push(this._[0].slice()); } - function _clear(index, mask) { - array[index] &= mask; + lineTo(x2, y2) { + this._.push([x2, y2]); } - return { - array: array, - get: (x, y)=>{ - const index = y * w + x; - return array[index >>> DIV] & 1 << (index & MOD); - }, - set: (x, y)=>{ - const index = y * w + x; - _set(index >>> DIV, 1 << (index & MOD)); - }, - clear: (x, y)=>{ - const index = y * w + x; - _clear(index >>> DIV, ~(1 << (index & MOD))); - }, - getRange: (x, y, x2, y2)=>{ - let r = y2, start, end, indexStart, indexEnd; - for(; r >= y; --r){ - start = r * w + x; - end = r * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) { - if (array[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) return true; - } else { - if (array[indexStart] & RIGHT0[start & MOD]) return true; - if (array[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; - for(let i = indexStart + 1; i < indexEnd; ++i){ - if (array[i]) return true; - } - } - } - return false; - }, - setRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); - else { - _set(indexStart, RIGHT0[start & MOD]); - _set(indexEnd, RIGHT1[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_set(i, 0xffffffff); - } - } - }, - clearRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); - else { - _clear(indexStart, RIGHT1[start & MOD]); - _clear(indexEnd, RIGHT0[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_clear(i, 0); - } - } - }, - outOfBounds: (x, y, x2, y2)=>x < 0 || y < 0 || y2 >= h || x2 >= w - }; -} -function scaler(width, height, padding) { - const ratio = Math.max(1, Math.sqrt(width * height / 1e6)), w = ~~((width + 2 * padding + ratio) / ratio), h = ~~((height + 2 * padding + ratio) / ratio), scale = (_)=>~~((_ + padding) / ratio); - scale.invert = (_)=>_ * ratio - padding; - scale.bitmap = ()=>Bitmap(w, h); - scale.ratio = ratio; - scale.padding = padding; - scale.width = width; - scale.height = height; - return scale; -} -function placeAreaLabelNaive($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height; - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxAreaWidth = 0, x1, x2, y1, y2, x, y, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - areaWidth = Math.abs(x2 - x1 + y2 - y1); - if (areaWidth >= maxAreaWidth) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - } - } - x = textWidth / 2; - y = textHeight / 2; - x1 = d.x - x; - x2 = d.x + x; - y1 = d.y - y; - y2 = d.y + y; - d.align = 'center'; - if (x1 < 0 && x2 <= width) d.align = 'left'; - else if (0 <= x1 && width < x2) d.align = 'right'; - d.baseline = 'middle'; - if (y1 < 0 && y2 <= height) d.baseline = 'top'; - else if (0 <= y1 && height < y2) d.baseline = 'bottom'; - return true; - }; -} -function outOfBounds(x, y, textWidth, textHeight, width, height) { - let r = textWidth / 2; - return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height; -} -function collision($, x, y, textHeight, textWidth, h, bm0, bm1) { - const w = textWidth * h / (textHeight * 2), x1 = $(x - w), x2 = $(x + w), y1 = $(y - (h = h / 2)), y2 = $(y + h); - return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2); -} -function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1]; // area outlines - function tryLabel(_x, _y, maxSize, textWidth, textHeight) { - const x = $.invert(_x), y = $.invert(_y); - let lo = maxSize, hi = height, mid; - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) return [ - x, - y, - lo, - true - ]; - } + value() { + return this._.length ? this._ : null; } - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - if (x1 > x2) { - swapTmp = x1; - x1 = x2; - x2 = swapTmp; - } - if (y1 > y2) { - swapTmp = y1; - y1 = y2; - y2 = swapTmp; - } - _x1 = $(x1); - _x2 = $(x2); - _xMid = ~~((_x1 + _x2) / 2); - _y1 = $(y1); - _y2 = $(y2); - _yMid = ~~((_y1 + _y2) / 2); - // search along the line from mid point between the 2 border to lower border - for(_x = _xMid; _x >= _x1; --_x)for(_y = _yMid; _y >= _y1; --_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // search along the line from mid point between the 2 border to upper border - for(_x = _xMid; _x <= _x2; ++_x)for(_y = _yMid; _y <= _y2; ++_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } - } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; - }; -} -// pixel direction offsets for flood fill search -const X_DIR = [ - -1, - -1, - 1, - 1 -]; -const Y_DIR = [ - -1, - 1, - -1, - 1 -]; -function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1], // area outlines - bm2 = $.bitmap(); // flood-fill visitations - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text), // label height - stack = []; // flood fill stack - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, lo, hi, mid, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - // add scaled center point to stack - stack.push([ - $((x1 + x2) / 2), - $((y1 + y2) / 2) - ]); - // perform flood fill, visit points - while(stack.length){ - [_x, _y] = stack.pop(); - // exit if point already marked - if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; - // mark point in flood fill bitmap - // add search points for all (in bound) directions - bm2.set(_x, _y); - for(let j = 0; j < 4; ++j){ - x = _x + X_DIR[j]; - y = _y + Y_DIR[j]; - if (!bm2.outOfBounds(x, y, x, y)) stack.push([ - x, - y - ]); - } - // unscale point back to x, y space - x = $.invert(_x); - y = $.invert(_y); - lo = maxSize; - hi = height; // TODO: make this bound smaller - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) { - d.x = x; - d.y = y; - maxSize = lo; - labelPlaced = true; - } - } - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } - } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; - }; -} -const Aligns = [ - 'right', - 'center', - 'left' -], Baselines = [ - 'bottom', - 'middle', - 'top' -]; -function placeMarkLabel($, bitmaps, anchors, offsets) { - const width = $.width, height = $.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets.length; - return function(d) { - const boundary = d.boundary, textHeight = d.datum.fontSize; - // can not be placed if the mark is not visible in the graph bound - if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) return false; - let textWidth = d.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x1, x2, y1, y2, xc, yc, _x1, _x2, _y1, _y2; - // for each anchor and offset - for(let i = 0; i < n; ++i){ - dx = (anchors[i] & 0x3) - 1; - dy = (anchors[i] >>> 0x2 & 0x3) - 1; - isInside = dx === 0 && dy === 0 || offsets[i] < 0; - sizeFactor = dx && dy ? Math.SQRT1_2 : 1; - insideFactor = offsets[i] < 0 ? -1 : 1; - x1 = boundary[1 + dx] + offsets[i] * dx * sizeFactor; - yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets[i] * dy * sizeFactor; - y1 = yc - textHeight / 2; - y2 = yc + textHeight / 2; - _x1 = $(x1); - _y1 = $(y1); - _y2 = $(y2); - if (!textWidth) { - // to avoid finding width of text label, - if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) continue; - else // Otherwise, find the label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); - } - xc = x1 + insideFactor * textWidth * dx / 2; - x1 = xc - textWidth / 2; - x2 = xc + textWidth / 2; - _x1 = $(x1); - _x2 = $(x2); - if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) { - // place label if the position is placeable - d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1; - d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1; - d.align = Aligns[dx * insideFactor + 1]; - d.baseline = Baselines[dy * insideFactor + 1]; - bm0.setRange(_x1, _y1, _x2, _y2); - return true; + } + let Voronoi$1 = class Voronoi { + constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { + if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); + this.delaunay = delaunay; + this._circumcenters = new Float64Array(delaunay.points.length * 2); + this.vectors = new Float64Array(delaunay.points.length * 2); + this.xmax = xmax, this.xmin = xmin; + this.ymax = ymax, this.ymin = ymin; + this._init(); + } + update() { + this.delaunay.update(); + this._init(); + return this; + } + _init() { + const { delaunay: { points: points2, hull, triangles }, vectors } = this; + let bx, by; + const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); + for (let i = 0, j = 0, n = triangles.length, x2, y2; i < n; i += 3, j += 2) { + const t12 = triangles[i] * 2; + const t22 = triangles[i + 1] * 2; + const t32 = triangles[i + 2] * 2; + const x13 = points2[t12]; + const y13 = points2[t12 + 1]; + const x22 = points2[t22]; + const y22 = points2[t22 + 1]; + const x3 = points2[t32]; + const y3 = points2[t32 + 1]; + const dx = x22 - x13; + const dy = y22 - y13; + const ex = x3 - x13; + const ey = y3 - y13; + const ab = (dx * ey - dy * ex) * 2; + if (Math.abs(ab) < 1e-9) { + if (bx === void 0) { + bx = by = 0; + for (const i2 of hull) bx += points2[i2 * 2], by += points2[i2 * 2 + 1]; + bx /= hull.length, by /= hull.length; + } + const a2 = 1e9 * Math.sign((bx - x13) * ey - (by - y13) * ex); + x2 = (x13 + x3) / 2 - a2 * ey; + y2 = (y13 + y3) / 2 + a2 * ex; + } else { + const d2 = 1 / ab; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + x2 = x13 + (ey * bl2 - dy * cl) * d2; + y2 = y13 + (dx * cl - ex * bl2) * d2; + } + circumcenters[j] = x2; + circumcenters[j + 1] = y2; + } + let h2 = hull[hull.length - 1]; + let p02, p1 = h2 * 4; + let x02, x12 = points2[2 * h2]; + let y02, y12 = points2[2 * h2 + 1]; + vectors.fill(0); + for (let i = 0; i < hull.length; ++i) { + h2 = hull[i]; + p02 = p1, x02 = x12, y02 = y12; + p1 = h2 * 4, x12 = points2[2 * h2], y12 = points2[2 * h2 + 1]; + vectors[p02 + 2] = vectors[p1] = y02 - y12; + vectors[p02 + 3] = vectors[p1 + 1] = x12 - x02; + } + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; + if (hull.length <= 1) return null; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = Math.floor(i / 3) * 2; + const tj = Math.floor(j / 3) * 2; + const xi = circumcenters[ti]; + const yi = circumcenters[ti + 1]; + const xj = circumcenters[tj]; + const yj = circumcenters[tj + 1]; + this._renderSegment(xi, yi, xj, yj, context2); + } + let h0, h1 = hull[hull.length - 1]; + for (let i = 0; i < hull.length; ++i) { + h0 = h1, h1 = hull[i]; + const t = Math.floor(inedges[h1] / 3) * 2; + const x2 = circumcenters[t]; + const y2 = circumcenters[t + 1]; + const v = h0 * 4; + const p = this._project(x2, y2, vectors[v + 2], vectors[v + 3]); + if (p) this._renderSegment(x2, y2, p[0], p[1], context2); + } + return buffer && buffer.value(); + } + renderBounds(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + context2.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); + return buffer && buffer.value(); + } + renderCell(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const points2 = this._clip(i); + if (points2 === null || !points2.length) return; + context2.moveTo(points2[0], points2[1]); + let n = points2.length; + while (points2[0] === points2[n - 2] && points2[1] === points2[n - 1] && n > 1) n -= 2; + for (let i2 = 2; i2 < n; i2 += 2) { + if (points2[i2] !== points2[i2 - 2] || points2[i2 + 1] !== points2[i2 - 1]) + context2.lineTo(points2[i2], points2[i2 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + *cellPolygons() { + const { delaunay: { points: points2 } } = this; + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const cell2 = this.cellPolygon(i); + if (cell2) cell2.index = i, yield cell2; + } + } + cellPolygon(i) { + const polygon = new Polygon(); + this.renderCell(i, polygon); + return polygon.value(); + } + _renderSegment(x02, y02, x12, y12, context2) { + let S; + const c0 = this._regioncode(x02, y02); + const c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + context2.moveTo(x02, y02); + context2.lineTo(x12, y12); + } else if (S = this._clipSegment(x02, y02, x12, y12, c0, c1)) { + context2.moveTo(S[0], S[1]); + context2.lineTo(S[2], S[3]); + } + } + contains(i, x2, y2) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return false; + return this.delaunay._step(i, x2, y2) === i; + } + *neighbors(i) { + const ci = this._clip(i); + if (ci) for (const j of this.delaunay.neighbors(i)) { + const cj = this._clip(j); + if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { + for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { + if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { + yield j; + break loop; } + } } - return false; - }; -} -// Test if a label with the given dimensions can be added without overlap -function test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) { - return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); -} -// 8-bit representation of anchors -const TOP = 0x0, MIDDLE = 0x4, BOTTOM = 0x8, LEFT = 0x0, CENTER = 0x1, RIGHT = 0x2; -// Mapping from text anchor to number representation -const anchorCode = { - 'top-left': TOP + LEFT, - 'top': TOP + CENTER, - 'top-right': TOP + RIGHT, - 'left': MIDDLE + LEFT, - 'middle': MIDDLE + CENTER, - 'right': MIDDLE + RIGHT, - 'bottom-left': BOTTOM + LEFT, - 'bottom': BOTTOM + CENTER, - 'bottom-right': BOTTOM + RIGHT -}; -const placeAreaLabel = { - 'naive': placeAreaLabelNaive, - 'reduced-search': placeAreaLabelReducedSearch, - 'floodfill': placeAreaLabelFloodFill -}; -function labelLayout(texts, size, compare, offset, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding, method) { - // early exit for empty data - if (!texts.length) return texts; - const positions = Math.max(offset.length, anchor.length), offsets = getOffsets(offset, positions), anchors = getAnchors(anchor, positions), marktype = markType(texts[0].datum), grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === 'area', boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding === null || padding === Infinity, isNaiveGroupArea = isGroupArea && method === 'naive'; - let maxTextWidth = -1, maxTextHeight = -1; - // prepare text mark data for placing - const data = texts.map((d)=>{ - const textWidth = infPadding ? (0, _vegaScenegraph.textMetrics).width(d, d.text) : undefined; - maxTextWidth = Math.max(maxTextWidth, textWidth); - maxTextHeight = Math.max(maxTextHeight, d.fontSize); - return { - datum: d, - opacity: 0, - x: undefined, - y: undefined, - align: undefined, - baseline: undefined, - boundary: boundary(d), - textWidth - }; - }); - padding = padding === null || padding === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset) : padding; - const $ = scaler(size[0], size[1], padding); - let bitmaps; - if (!isNaiveGroupArea) { - // sort labels in priority order, if comparator is provided - if (compare) data.sort((a, b)=>compare(a.datum, b.datum)); - // flag indicating if label can be placed inside its base mark - let labelInside = false; - for(let i = 0; i < anchors.length && !labelInside; ++i)// label inside if anchor is at center - // label inside if offset to be inside the mark bound - labelInside = anchors[i] === 0x5 || offsets[i] < 0; - // extract data information from base mark when base mark is to be avoided - // base mark is implicitly avoided if it is a group area - const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d)=>d.datum); - // generate bitmaps for layout calculation - bitmaps = avoidMarks.length || baseMark ? markBitmaps($, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data); - } - // generate label placement function - const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets); - // place all labels - data.forEach((d)=>d.opacity = +place(d)); - return data; -} -function getOffsets(_, count) { - const offsets = new Float64Array(count), n = _.length; - for(let i = 0; i < n; ++i)offsets[i] = _[i] || 0; - for(let i = n; i < count; ++i)offsets[i] = offsets[n - 1]; - return offsets; -} -function getAnchors(_, count) { - const anchors = new Int8Array(count), n = _.length; - for(let i = 0; i < n; ++i)anchors[i] |= anchorCode[_[i]]; - for(let i = n; i < count; ++i)anchors[i] = anchors[n - 1]; - return anchors; -} -function markType(item) { - return item && item.mark && item.mark.marktype; -} -/** - * Factory function for function for getting base mark boundary, depending - * on mark and group type. When mark type is undefined, line or area: boundary - * is the coordinate of each data point. When base mark is grouped line, - * boundary is either at the start or end of the line depending on the - * value of lineAnchor. Otherwise, use bounds of base mark. - */ function markBoundary(marktype, grouptype, lineAnchor, markIndex) { - const xy = (d)=>[ - d.x, - d.x, - d.x, - d.y, - d.y, - d.y - ]; - if (!marktype) return xy; // no reactive geometry - else if (marktype === 'line' || marktype === 'area') return (d)=>xy(d.datum); - else if (grouptype === 'line') return (d)=>{ - const items = d.datum.items[markIndex].items; - return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : { - x: NaN, - y: NaN - }); - }; - else return (d)=>{ - const b = d.datum.bounds; - return [ - b.x1, - (b.x1 + b.x2) / 2, - b.x2, - b.y1, - (b.y1 + b.y2) / 2, - b.y2 - ]; - }; -} -const Output = [ - 'x', - 'y', - 'opacity', - 'align', - 'baseline' -]; -const Anchors = [ - 'top-left', - 'left', - 'bottom-left', - 'top', - 'bottom', - 'top-right', - 'right', - 'bottom-right' -]; -/** - * Compute text label layout to annotate marks. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The size of the layout, provided as a [width, height] array. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting label data in priority order. - * @param {Array<string>} [params.anchor] - Label anchor points relative to the base mark bounding box. - * The available options are 'top-left', 'left', 'bottom-left', 'top', - * 'bottom', 'top-right', 'right', 'bottom-right', 'middle'. - * @param {Array<number>} [params.offset] - Label offsets (in pixels) from the base mark bounding box. - * This parameter is parallel to the list of anchor points. - * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size. - * If this parameter is null, a label may exceed the layout size without any boundary. - * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor - * position for labels. One of 'start' or 'end'. - * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating - * which mark within the group should be labeled. - * @param {Array<number>} [params.avoidMarks] - A list of additional mark names for which the label - * layout should avoid overlap. - * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid - * overlap with the underlying base mark being labeled. - * @param {string} [params.method='naive'] - For area make labels only, a method for - * place labels. One of 'naive', 'reduced-search', or 'floodfill'. - * @param {Array<string>} [params.as] - The output fields written by the transform. - * The default is ['x', 'y', 'opacity', 'align', 'baseline']. - */ function Label(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Label.Definition = { - type: 'Label', - metadata: { - modifies: true - }, - params: [ - { - name: 'size', - type: 'number', - array: true, - length: 2, - required: true - }, - { - name: 'sort', - type: 'compare' - }, - { - name: 'anchor', - type: 'string', - array: true, - default: Anchors - }, - { - name: 'offset', - type: 'number', - array: true, - default: [ - 1 - ] - }, - { - name: 'padding', - type: 'number', - default: 0, - null: true - }, - { - name: 'lineAnchor', - type: 'string', - values: [ - 'start', - 'end' - ], - default: 'end' - }, - { - name: 'markIndex', - type: 'number', - default: 0 - }, - { - name: 'avoidBaseMark', - type: 'boolean', - default: true - }, - { - name: 'avoidMarks', - type: 'data', - array: true - }, - { - name: 'method', - type: 'string', - default: 'naive' - }, - { - name: 'as', - type: 'string', - array: true, - length: Output.length, - default: Output - } - ] -}; -(0, _vegaUtil.inherits)(Label, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || modp('sort'))) return; - if (!_.size || _.size.length !== 2) (0, _vegaUtil.error)('Size parameter should be specified as a [width, height] array.'); - const as = _.as || Output; - // run label layout - labelLayout(pulse.materialize(pulse.SOURCE).source || [], _.size, _.sort, (0, _vegaUtil.array)(_.offset == null ? 1 : _.offset), (0, _vegaUtil.array)(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || 'end', _.markIndex || 0, _.padding === undefined ? 0 : _.padding, _.method || 'naive').forEach((l)=>{ - // write layout results to data stream - const t = l.datum; - t[as[0]] = l.x; - t[as[1]] = l.y; - t[as[2]] = l.opacity; - t[as[3]] = l.align; - t[as[4]] = l.baseline; - }); - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-scenegraph":"gJqm6","vega-canvas":"4O1hR","vega-dataflow":"cFRfY","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c1OiC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loess", ()=>Loess); -parcelHelpers.export(exports, "regression", ()=>Regression); -var _vegaStatistics = require("vega-statistics"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -function partition(data, groupby) { - var groups = [], get = function(f) { - return f(t); - }, map, i, n, t, k, g; - // partition data points into stack groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - g.push(t); + } } - return groups; -} -/** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ function Loess(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Loess.Definition = { - 'type': 'Loess', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0.3 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Loess, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), m = names.length, as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], values = []; - groups.forEach((g)=>{ - (0, _vegaStatistics.regressionLoess)(g, _.x, _.y, _.bandwidth || 0.3).forEach((p)=>{ - const t = {}; - for(let i = 0; i < m; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + _cell(i) { + const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; + const e0 = inedges[i]; + if (e0 === -1) return null; + const points2 = []; + let e = e0; + do { + const t = Math.floor(e / 3); + points2.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + } while (e !== e0 && e !== -1); + return points2; + } + _clip(i) { + if (i === 0 && this.delaunay.hull.length === 1) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + const points2 = this._cell(i); + if (points2 === null) return null; + const { vectors: V } = this; + const v = i * 4; + return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points2, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points2)); + } + _clipFinite(i, points2) { + const n = points2.length; + let P = null; + let x02, y02, x12 = points2[n - 2], y12 = points2[n - 1]; + let c0, c1 = this._regioncode(x12, y12); + let e0, e1 = 0; + for (let j = 0; j < n; j += 2) { + x02 = x12, y02 = y12, x12 = points2[j], y12 = points2[j + 1]; + c0 = c1, c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + e0 = e1, e1 = 0; + if (P) P.push(x12, y12); + else P = [x12, y12]; + } else { + let S, sx0, sy0, sx1, sy1; + if (c0 === 0) { + if ((S = this._clipSegment(x02, y02, x12, y12, c0, c1)) === null) continue; + [sx0, sy0, sx1, sy1] = S; + } else { + if ((S = this._clipSegment(x12, y12, x02, y02, c1, c0)) === null) continue; + [sx1, sy1, sx0, sy0] = S; + e0 = e1, e1 = this._edgecode(sx0, sy0); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx0, sy0); + else P = [sx0, sy0]; + } + e0 = e1, e1 = this._edgecode(sx1, sy1); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx1, sy1); + else P = [sx1, sy1]; } - return out; + } + if (P) { + e0 = e1, e1 = this._edgecode(P[0], P[1]); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + return P; + } + _clipSegment(x02, y02, x12, y12, c0, c1) { + const flip2 = c0 < c1; + if (flip2) [x02, y02, x12, y12, c0, c1] = [x12, y12, x02, y02, c1, c0]; + while (true) { + if (c0 === 0 && c1 === 0) return flip2 ? [x12, y12, x02, y02] : [x02, y02, x12, y12]; + if (c0 & c1) return null; + let x2, y2, c2 = c0 || c1; + if (c2 & 8) x2 = x02 + (x12 - x02) * (this.ymax - y02) / (y12 - y02), y2 = this.ymax; + else if (c2 & 4) x2 = x02 + (x12 - x02) * (this.ymin - y02) / (y12 - y02), y2 = this.ymin; + else if (c2 & 2) y2 = y02 + (y12 - y02) * (this.xmax - x02) / (x12 - x02), x2 = this.xmax; + else y2 = y02 + (y12 - y02) * (this.xmin - x02) / (x12 - x02), x2 = this.xmin; + if (c0) x02 = x2, y02 = y2, c0 = this._regioncode(x02, y02); + else x12 = x2, y12 = y2, c1 = this._regioncode(x12, y12); + } } -}); -const Methods = { - constant: (0, _vegaStatistics.regressionConstant), - linear: (0, _vegaStatistics.regressionLinear), - log: (0, _vegaStatistics.regressionLog), - exp: (0, _vegaStatistics.regressionExp), - pow: (0, _vegaStatistics.regressionPow), - quad: (0, _vegaStatistics.regressionQuad), - poly: (0, _vegaStatistics.regressionPoly) -}; -const degreesOfFreedom = (method, order)=>method === 'poly' ? order : method === 'quad' ? 2 : 1; -/** - * Compute regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {string} [params.method='linear'] - The regression method to apply. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<number>} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ function Regression(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Regression.Definition = { - 'type': 'Regression', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'linear', - 'values': Object.keys(Methods) - }, - { - 'name': 'order', - 'type': 'number', - 'default': 3 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'params', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true + _clipInfinite(i, points2, vx0, vy0, vxn, vyn) { + let P = Array.from(points2), p; + if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); + if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); + if (P = this._clipFinite(i, P)) { + for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { + c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); + if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; + } + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; + } + return P; + } + _edge(i, e0, e1, P, j) { + while (e0 !== e1) { + let x2, y2; + switch (e0) { + case 5: + e0 = 4; + continue; + // top-left + case 4: + e0 = 6, x2 = this.xmax, y2 = this.ymin; + break; + // top + case 6: + e0 = 2; + continue; + // top-right + case 2: + e0 = 10, x2 = this.xmax, y2 = this.ymax; + break; + // right + case 10: + e0 = 8; + continue; + // bottom-right + case 8: + e0 = 9, x2 = this.xmin, y2 = this.ymax; + break; + // bottom + case 9: + e0 = 1; + continue; + // bottom-left + case 1: + e0 = 5, x2 = this.xmin, y2 = this.ymin; + break; } - ] -}; -(0, _vegaUtil.inherits)(Regression, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), method = _.method || 'linear', order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method, order), as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], fit = Methods[method], values = []; - let domain = _.extent; - if (!(0, _vegaUtil.hasOwnProperty)(Methods, method)) (0, _vegaUtil.error)('Invalid regression method: ' + method); - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - groups.forEach((g)=>{ - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - const model = fit(g, _.x, _.y, order); - if (_.params) { - // if parameter vectors requested return those - values.push((0, _vegaDataflow.ingest)({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - const dom = domain || (0, _vegaUtil.extent)(g, _.x), add = (p)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }; - if (method === 'linear' || method === 'constant') // for linear or constant regression we only need the end points - dom.forEach((x)=>add([ - x, - model.predict(x) - ])); - else // otherwise return trend line sample points - (0, _vegaStatistics.sampleCurve)(model.predict, dom, 25, 200).forEach(add); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + if ((P[j] !== x2 || P[j + 1] !== y2) && this.contains(i, x2, y2)) { + P.splice(j, 0, x2, y2), j += 2; } - return out; + } + return j; + } + _project(x02, y02, vx, vy) { + let t = Infinity, c2, x2, y2; + if (vy < 0) { + if (y02 <= this.ymin) return null; + if ((c2 = (this.ymin - y02) / vy) < t) y2 = this.ymin, x2 = x02 + (t = c2) * vx; + } else if (vy > 0) { + if (y02 >= this.ymax) return null; + if ((c2 = (this.ymax - y02) / vy) < t) y2 = this.ymax, x2 = x02 + (t = c2) * vx; + } + if (vx > 0) { + if (x02 >= this.xmax) return null; + if ((c2 = (this.xmax - x02) / vx) < t) x2 = this.xmax, y2 = y02 + (t = c2) * vy; + } else if (vx < 0) { + if (x02 <= this.xmin) return null; + if ((c2 = (this.xmin - x02) / vx) < t) x2 = this.xmin, y2 = y02 + (t = c2) * vy; + } + return [x2, y2]; } -}); - -},{"vega-statistics":"4QSQj","vega-dataflow":"cFRfY","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g4ZwP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "voronoi", ()=>Voronoi); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Delaunay = require("d3-delaunay"); -function Voronoi(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Voronoi.Definition = { - 'type': 'Voronoi', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'default': [ - [ - -100000, - -100000 - ], - [ - 1e5, - 1e5 - ] - ], - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -const defaultExtent = [ - -100000, - -100000, - 1e5, - 1e5 -]; -(0, _vegaUtil.inherits)(Voronoi, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const as = _.as || 'path', data = pulse.source; - // nothing to do if no data - if (!data || !data.length) return pulse; - // configure and construct voronoi diagram - let s = _.size; - s = s ? [ - 0, - 0, - s[0], - s[1] - ] : (s = _.extent) ? [ - s[0][0], - s[0][1], - s[1][0], - s[1][1] - ] : defaultExtent; - const voronoi = this.value = (0, _d3Delaunay.Delaunay).from(data, _.x, _.y).voronoi(s); - // map polygons to paths - for(let i = 0, n = data.length; i < n; ++i){ - const polygon = voronoi.cellPolygon(i); - data[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; - } - return pulse.reflow(_.modified()).modifies(as); - } -}); -// suppress duplicated end point vertices -function toPathString(p) { - const x = p[0][0], y = p[0][1]; - let n = p.length - 1; - for(; p[n][0] === x && p[n][1] === y; --n); - return 'M' + p.slice(0, n + 1).join('L') + 'Z'; -} -function isPoint(p) { - return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; -} - -},{"vega-dataflow":"cFRfY","vega-util":"f2ulH","d3-delaunay":"7xaDA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7xaDA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Delaunay", ()=>(0, _delaunayJsDefault.default)); -parcelHelpers.export(exports, "Voronoi", ()=>(0, _voronoiJsDefault.default)); -var _delaunayJs = require("./delaunay.js"); -var _delaunayJsDefault = parcelHelpers.interopDefault(_delaunayJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); - -},{"./delaunay.js":"hjOX3","./voronoi.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hjOX3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _delaunator = require("delaunator"); -var _delaunatorDefault = parcelHelpers.interopDefault(_delaunator); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); -const tau = 2 * Math.PI, pow = Math.pow; -function pointX(p) { + _edgecode(x2, y2) { + return (x2 === this.xmin ? 1 : x2 === this.xmax ? 2 : 0) | (y2 === this.ymin ? 4 : y2 === this.ymax ? 8 : 0); + } + _regioncode(x2, y2) { + return (x2 < this.xmin ? 1 : x2 > this.xmax ? 2 : 0) | (y2 < this.ymin ? 4 : y2 > this.ymax ? 8 : 0); + } + _simplify(P) { + if (P && P.length > 4) { + for (let i = 0; i < P.length; i += 2) { + const j = (i + 2) % P.length, k = (i + 4) % P.length; + if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) { + P.splice(j, 2), i -= 2; + } + } + if (!P.length) P = null; + } + return P; + } + }; + const tau = 2 * Math.PI, pow = Math.pow; + function pointX(p) { return p[0]; -} -function pointY(p) { + } + function pointY(p) { return p[1]; -} -// A triangulation is collinear if all its triangles have a non-null area -function collinear(d) { - const { triangles, coords } = d; - for(let i = 0; i < triangles.length; i += 3){ - const a = 2 * triangles[i], b = 2 * triangles[i + 1], c = 2 * triangles[i + 2], cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; + } + function collinear(d2) { + const { triangles, coords } = d2; + for (let i = 0; i < triangles.length; i += 3) { + const a2 = 2 * triangles[i], b2 = 2 * triangles[i + 1], c2 = 2 * triangles[i + 2], cross2 = (coords[c2] - coords[a2]) * (coords[b2 + 1] - coords[a2 + 1]) - (coords[b2] - coords[a2]) * (coords[c2 + 1] - coords[a2 + 1]); + if (cross2 > 1e-10) return false; } return true; -} -function jitter(x, y, r) { - return [ - x + Math.sin(x + y) * r, - y + Math.cos(x - y) * r - ]; -} -class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points){ - this._delaunator = new (0, _delaunatorDefault.default)(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); + } + function jitter(x2, y2, r) { + return [x2 + Math.sin(x2 + y2) * r, y2 + Math.cos(x2 - y2) * r]; + } + class Delaunay { + static from(points2, fx = pointX, fy = pointY, that) { + return new Delaunay("length" in points2 ? flatArray(points2, fx, fy, that) : Float64Array.from(flatIterable(points2, fx, fy, that))); + } + constructor(points2) { + this._delaunator = new Delaunator(points2); + this.inedges = new Int32Array(points2.length / 2); + this._hullIndex = new Int32Array(points2.length / 2); + this.points = this._delaunator.coords; + this._init(); } update() { - this._delaunator.update(); - this._init(); - return this; + this._delaunator.update(); + this._init(); + return this; + } + _init() { + const d2 = this._delaunator, points2 = this.points; + if (d2.hull && d2.hull.length > 2 && collinear(d2)) { + this.collinear = Int32Array.from({ length: points2.length / 2 }, (_, i) => i).sort((i, j) => points2[2 * i] - points2[2 * j] || points2[2 * i + 1] - points2[2 * j + 1]); + const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds2 = [points2[2 * e], points2[2 * e + 1], points2[2 * f], points2[2 * f + 1]], r = 1e-8 * Math.hypot(bounds2[3] - bounds2[1], bounds2[2] - bounds2[0]); + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const p = jitter(points2[2 * i], points2[2 * i + 1], r); + points2[2 * i] = p[0]; + points2[2 * i + 1] = p[1]; + } + this._delaunator = new Delaunator(points2); + } else { + delete this.collinear; + } + const halfedges = this.halfedges = this._delaunator.halfedges; + const hull = this.hull = this._delaunator.hull; + const triangles = this.triangles = this._delaunator.triangles; + const inedges = this.inedges.fill(-1); + const hullIndex = this._hullIndex.fill(-1); + for (let e = 0, n = halfedges.length; e < n; ++e) { + const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; + if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; + } + for (let i = 0, n = hull.length; i < n; ++i) { + hullIndex[hull[i]] = i; + } + if (hull.length <= 2 && hull.length > 0) { + this.triangles = new Int32Array(3).fill(-1); + this.halfedges = new Int32Array(3).fill(-1); + this.triangles[0] = hull[0]; + inedges[hull[0]] = 1; + if (hull.length === 2) { + inedges[hull[1]] = 0; + this.triangles[1] = hull[1]; + this.triangles[2] = hull[1]; + } + } + } + voronoi(bounds2) { + return new Voronoi$1(this, bounds2); + } + *neighbors(i) { + const { inedges, hull, _hullIndex, halfedges, triangles, collinear: collinear2 } = this; + if (collinear2) { + const l = collinear2.indexOf(i); + if (l > 0) yield collinear2[l - 1]; + if (l < collinear2.length - 1) yield collinear2[l + 1]; + return; + } + const e0 = inedges[i]; + if (e0 === -1) return; + let e = e0, p02 = -1; + do { + yield p02 = triangles[e]; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) return; + e = halfedges[e]; + if (e === -1) { + const p = hull[(_hullIndex[i] + 1) % hull.length]; + if (p !== p02) yield p; + return; + } + } while (e !== e0); + } + find(x2, y2, i = 0) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return -1; + const i0 = i; + let c2; + while ((c2 = this._step(i, x2, y2)) >= 0 && c2 !== i && c2 !== i0) i = c2; + return c2; + } + _step(i, x2, y2) { + const { inedges, hull, _hullIndex, halfedges, triangles, points: points2 } = this; + if (inedges[i] === -1 || !points2.length) return (i + 1) % (points2.length >> 1); + let c2 = i; + let dc = pow(x2 - points2[i * 2], 2) + pow(y2 - points2[i * 2 + 1], 2); + const e0 = inedges[i]; + let e = e0; + do { + let t = triangles[e]; + const dt = pow(x2 - points2[t * 2], 2) + pow(y2 - points2[t * 2 + 1], 2); + if (dt < dc) dc = dt, c2 = t; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + if (e === -1) { + e = hull[(_hullIndex[i] + 1) % hull.length]; + if (e !== t) { + if (pow(x2 - points2[e * 2], 2) + pow(y2 - points2[e * 2 + 1], 2) < dc) return e; + } + break; + } + } while (e !== e0); + return c2; + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, halfedges, triangles } = this; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = triangles[i] * 2; + const tj = triangles[j] * 2; + context2.moveTo(points2[ti], points2[ti + 1]); + context2.lineTo(points2[tj], points2[tj + 1]); + } + this.renderHull(context2); + return buffer && buffer.value(); + } + renderPoints(context2, r) { + if (r === void 0 && (!context2 || typeof context2.moveTo !== "function")) r = context2, context2 = null; + r = r == void 0 ? 2 : +r; + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2 } = this; + for (let i = 0, n = points2.length; i < n; i += 2) { + const x2 = points2[i], y2 = points2[i + 1]; + context2.moveTo(x2 + r, y2); + context2.arc(x2, y2, r, 0, tau); + } + return buffer && buffer.value(); + } + renderHull(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { hull, points: points2 } = this; + const h2 = hull[0] * 2, n = hull.length; + context2.moveTo(points2[h2], points2[h2 + 1]); + for (let i = 1; i < n; ++i) { + const h3 = 2 * hull[i]; + context2.lineTo(points2[h3], points2[h3 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + hullPolygon() { + const polygon = new Polygon(); + this.renderHull(polygon); + return polygon.value(); + } + renderTriangle(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, triangles } = this; + const t02 = triangles[i *= 3] * 2; + const t12 = triangles[i + 1] * 2; + const t22 = triangles[i + 2] * 2; + context2.moveTo(points2[t02], points2[t02 + 1]); + context2.lineTo(points2[t12], points2[t12 + 1]); + context2.lineTo(points2[t22], points2[t22 + 1]); + context2.closePath(); + return buffer && buffer.value(); + } + *trianglePolygons() { + const { triangles } = this; + for (let i = 0, n = triangles.length / 3; i < n; ++i) { + yield this.trianglePolygon(i); + } + } + trianglePolygon(i) { + const polygon = new Polygon(); + this.renderTriangle(i, polygon); + return polygon.value(); + } + } + function flatArray(points2, fx, fy, that) { + const n = points2.length; + const array2 = new Float64Array(n * 2); + for (let i = 0; i < n; ++i) { + const p = points2[i]; + array2[i * 2] = fx.call(that, p, i, points2); + array2[i * 2 + 1] = fy.call(that, p, i, points2); + } + return array2; + } + function* flatIterable(points2, fx, fy, that) { + let i = 0; + for (const p of points2) { + yield fx.call(that, p, i, points2); + yield fy.call(that, p, i, points2); + ++i; + } + } + function Voronoi(params2) { + Transform.call(this, null, params2); + } + Voronoi.Definition = { + "type": "Voronoi", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "default": [[-1e5, -1e5], [1e5, 1e5]], + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; + inherits(Voronoi, Transform, { + transform(_, pulse2) { + const as = _.as || "path", data2 = pulse2.source; + if (!data2 || !data2.length) return pulse2; + let s2 = _.size; + s2 = s2 ? [0, 0, s2[0], s2[1]] : (s2 = _.extent) ? [s2[0][0], s2[0][1], s2[1][0], s2[1][1]] : defaultExtent; + const voronoi2 = this.value = Delaunay.from(data2, _.x, _.y).voronoi(s2); + for (let i = 0, n = data2.length; i < n; ++i) { + const polygon = voronoi2.cellPolygon(i); + data2[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; + } + return pulse2.reflow(_.modified()).modifies(as); + } + }); + function toPathString(p) { + const x2 = p[0][0], y2 = p[0][1]; + let n = p.length - 1; + for (; p[n][0] === x2 && p[n][1] === y2; --n) ; + return "M" + p.slice(0, n + 1).join("L") + "Z"; + } + function isPoint(p) { + return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; + } + const voronoi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + voronoi: Voronoi + }, Symbol.toStringTag, { value: "Module" })); + var cloudRadians = Math.PI / 180, cw = 1 << 11 >> 5, ch = 1 << 11; + function cloud() { + var size = [256, 256], text2, font2, fontSize2, fontStyle, fontWeight, rotate2, padding2, spiral = archimedeanSpiral, words = [], random2 = Math.random, cloud2 = {}; + cloud2.layout = function() { + var contextAndRatio = getContext2(domCanvas()), board = zeroArray((size[0] >> 5) * size[1]), bounds2 = null, n = words.length, i = -1, tags = [], data2 = words.map((d3) => ({ + text: text2(d3), + font: font2(d3), + style: fontStyle(d3), + weight: fontWeight(d3), + rotate: rotate2(d3), + size: ~~(fontSize2(d3) + 1e-14), + padding: padding2(d3), + xoff: 0, + yoff: 0, + x1: 0, + y1: 0, + x0: 0, + y0: 0, + hasText: false, + sprite: null, + datum: d3 + })).sort((a2, b2) => b2.size - a2.size); + while (++i < n) { + var d2 = data2[i]; + d2.x = size[0] * (random2() + 0.5) >> 1; + d2.y = size[1] * (random2() + 0.5) >> 1; + cloudSprite(contextAndRatio, d2, data2, i); + if (d2.hasText && place2(board, d2, bounds2)) { + tags.push(d2); + if (bounds2) cloudBounds(bounds2, d2); + else bounds2 = [{ + x: d2.x + d2.x0, + y: d2.y + d2.y0 + }, { + x: d2.x + d2.x1, + y: d2.y + d2.y1 + }]; + d2.x -= size[0] >> 1; + d2.y -= size[1] >> 1; + } + } + return tags; + }; + function getContext2(canvas) { + canvas.width = canvas.height = 1; + var ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2); + canvas.width = (cw << 5) / ratio; + canvas.height = ch / ratio; + var context2 = canvas.getContext("2d"); + context2.fillStyle = context2.strokeStyle = "red"; + context2.textAlign = "center"; + return { + context: context2, + ratio + }; + } + function place2(board, tag, bounds2) { + var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size[0], size[1]), s2 = spiral(size), dt = random2() < 0.5 ? 1 : -1, t = -dt, dxdy, dx, dy; + while (dxdy = s2(t += dt)) { + dx = ~~dxdy[0]; + dy = ~~dxdy[1]; + if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; + tag.x = startX + dx; + tag.y = startY + dy; + if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; + if (!bounds2 || !cloudCollide(tag, board, size[0])) { + if (!bounds2 || collideRects(tag, bounds2)) { + var sprite = tag.sprite, w2 = tag.width >> 5, sw = size[0] >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + board[x2 + i] |= last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0); + } + x2 += sw; + } + tag.sprite = null; + return true; + } + } + } + return false; + } + cloud2.words = function(_) { + if (arguments.length) { + words = _; + return cloud2; + } else { + return words; + } + }; + cloud2.size = function(_) { + if (arguments.length) { + size = [+_[0], +_[1]]; + return cloud2; + } else { + return size; + } + }; + cloud2.font = function(_) { + if (arguments.length) { + font2 = functor(_); + return cloud2; + } else { + return font2; + } + }; + cloud2.fontStyle = function(_) { + if (arguments.length) { + fontStyle = functor(_); + return cloud2; + } else { + return fontStyle; + } + }; + cloud2.fontWeight = function(_) { + if (arguments.length) { + fontWeight = functor(_); + return cloud2; + } else { + return fontWeight; + } + }; + cloud2.rotate = function(_) { + if (arguments.length) { + rotate2 = functor(_); + return cloud2; + } else { + return rotate2; + } + }; + cloud2.text = function(_) { + if (arguments.length) { + text2 = functor(_); + return cloud2; + } else { + return text2; + } + }; + cloud2.spiral = function(_) { + if (arguments.length) { + spiral = spirals[_] || _; + return cloud2; + } else { + return spiral; + } + }; + cloud2.fontSize = function(_) { + if (arguments.length) { + fontSize2 = functor(_); + return cloud2; + } else { + return fontSize2; + } + }; + cloud2.padding = function(_) { + if (arguments.length) { + padding2 = functor(_); + return cloud2; + } else { + return padding2; + } + }; + cloud2.random = function(_) { + if (arguments.length) { + random2 = _; + return cloud2; + } else { + return random2; + } + }; + return cloud2; + } + function cloudSprite(contextAndRatio, d2, data2, di) { + if (d2.sprite) return; + var c2 = contextAndRatio.context, ratio = contextAndRatio.ratio; + c2.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); + var x2 = 0, y2 = 0, maxh = 0, n = data2.length, w2, w32, h2, i, j; + --di; + while (++di < n) { + d2 = data2[di]; + c2.save(); + c2.font = d2.style + " " + d2.weight + " " + ~~((d2.size + 1) / ratio) + "px " + d2.font; + w2 = c2.measureText(d2.text + "m").width * ratio; + h2 = d2.size << 1; + if (d2.rotate) { + var sr = Math.sin(d2.rotate * cloudRadians), cr2 = Math.cos(d2.rotate * cloudRadians), wcr = w2 * cr2, wsr = w2 * sr, hcr = h2 * cr2, hsr = h2 * sr; + w2 = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 31 >> 5 << 5; + h2 = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); + } else { + w2 = w2 + 31 >> 5 << 5; + } + if (h2 > maxh) maxh = h2; + if (x2 + w2 >= cw << 5) { + x2 = 0; + y2 += maxh; + maxh = 0; + } + if (y2 + h2 >= ch) break; + c2.translate((x2 + (w2 >> 1)) / ratio, (y2 + (h2 >> 1)) / ratio); + if (d2.rotate) c2.rotate(d2.rotate * cloudRadians); + c2.fillText(d2.text, 0, 0); + if (d2.padding) { + c2.lineWidth = 2 * d2.padding; + c2.strokeText(d2.text, 0, 0); + } + c2.restore(); + d2.width = w2; + d2.height = h2; + d2.xoff = x2; + d2.yoff = y2; + d2.x1 = w2 >> 1; + d2.y1 = h2 >> 1; + d2.x0 = -d2.x1; + d2.y0 = -d2.y1; + d2.hasText = true; + x2 += w2; + } + var pixels = c2.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; + while (--di >= 0) { + d2 = data2[di]; + if (!d2.hasText) continue; + w2 = d2.width; + w32 = w2 >> 5; + h2 = d2.y1 - d2.y0; + for (i = 0; i < h2 * w32; i++) sprite[i] = 0; + x2 = d2.xoff; + if (x2 == null) return; + y2 = d2.yoff; + var seen = 0, seenRow = -1; + for (j = 0; j < h2; j++) { + for (i = 0; i < w2; i++) { + var k = w32 * j + (i >> 5), m2 = pixels[(y2 + j) * (cw << 5) + (x2 + i) << 2] ? 1 << 31 - i % 32 : 0; + sprite[k] |= m2; + seen |= m2; + } + if (seen) seenRow = j; + else { + d2.y0++; + h2--; + j--; + y2++; + } + } + d2.y1 = d2.y0 + seenRow; + d2.sprite = sprite.slice(0, (d2.y1 - d2.y0) * w32); + } + } + function cloudCollide(tag, board, sw) { + sw >>= 5; + var sprite = tag.sprite, w2 = tag.width >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + if ((last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0)) & board[x2 + i]) return true; + } + x2 += sw; + } + return false; + } + function cloudBounds(bounds2, d2) { + var b0 = bounds2[0], b1 = bounds2[1]; + if (d2.x + d2.x0 < b0.x) b0.x = d2.x + d2.x0; + if (d2.y + d2.y0 < b0.y) b0.y = d2.y + d2.y0; + if (d2.x + d2.x1 > b1.x) b1.x = d2.x + d2.x1; + if (d2.y + d2.y1 > b1.y) b1.y = d2.y + d2.y1; + } + function collideRects(a2, b2) { + return a2.x + a2.x1 > b2[0].x && a2.x + a2.x0 < b2[1].x && a2.y + a2.y1 > b2[0].y && a2.y + a2.y0 < b2[1].y; + } + function archimedeanSpiral(size) { + var e = size[0] / size[1]; + return function(t) { + return [e * (t *= 0.1) * Math.cos(t), t * Math.sin(t)]; + }; + } + function rectangularSpiral(size) { + var dy = 4, dx = dy * size[0] / size[1], x2 = 0, y2 = 0; + return function(t) { + var sign2 = t < 0 ? -1 : 1; + switch (Math.sqrt(1 + 4 * sign2 * t) - sign2 & 3) { + case 0: + x2 += dx; + break; + case 1: + y2 += dy; + break; + case 2: + x2 -= dx; + break; + default: + y2 -= dy; + break; + } + return [x2, y2]; + }; + } + function zeroArray(n) { + var a2 = [], i = -1; + while (++i < n) a2[i] = 0; + return a2; + } + function functor(d2) { + return typeof d2 === "function" ? d2 : function() { + return d2; + }; + } + var spirals = { + archimedean: archimedeanSpiral, + rectangular: rectangularSpiral + }; + const Output = ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"]; + const Params$1 = ["text", "font", "rotate", "fontSize", "fontStyle", "fontWeight"]; + function Wordcloud(params2) { + Transform.call(this, cloud(), params2); + } + Wordcloud.Definition = { + "type": "Wordcloud", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "font", + "type": "string", + "expr": true, + "default": "sans-serif" + }, { + "name": "fontStyle", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontWeight", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontSize", + "type": "number", + "expr": true, + "default": 14 + }, { + "name": "fontSizeRange", + "type": "number", + "array": "nullable", + "default": [10, 50] + }, { + "name": "rotate", + "type": "number", + "expr": true, + "default": 0 + }, { + "name": "text", + "type": "field" + }, { + "name": "spiral", + "type": "string", + "values": ["archimedean", "rectangular"] + }, { + "name": "padding", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 7, + "default": Output + }] + }; + inherits(Wordcloud, Transform, { + transform(_, pulse2) { + if (_.size && !(_.size[0] && _.size[1])) { + error("Wordcloud size dimensions must be non-zero."); + } + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || Params$1.some(modp))) return; + const data2 = pulse2.materialize(pulse2.SOURCE).source, layout = this.value, as = _.as || Output; + let fontSize2 = _.fontSize || 14, range2; + isFunction(fontSize2) ? range2 = _.fontSizeRange : fontSize2 = constant$4(fontSize2); + if (range2) { + const fsize = fontSize2, sizeScale = scale$4("sqrt")().domain(extent(data2, fsize)).range(range2); + fontSize2 = (x2) => sizeScale(fsize(x2)); + } + data2.forEach((t) => { + t[as[0]] = NaN; + t[as[1]] = NaN; + t[as[3]] = 0; + }); + const words = layout.words(data2).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || "archimedean").rotate(_.rotate || 0).font(_.font || "sans-serif").fontStyle(_.fontStyle || "normal").fontWeight(_.fontWeight || "normal").fontSize(fontSize2).random(random).layout(); + const size = layout.size(), dx = size[0] >> 1, dy = size[1] >> 1, n = words.length; + for (let i = 0, w2, t; i < n; ++i) { + w2 = words[i]; + t = w2.datum; + t[as[0]] = w2.x + dx; + t[as[1]] = w2.y + dy; + t[as[2]] = w2.font; + t[as[3]] = w2.size; + t[as[4]] = w2.style; + t[as[5]] = w2.weight; + t[as[6]] = w2.rotate; + } + return pulse2.reflow(mod).modifies(as); } - _init() { - const d = this._delaunator, points = this.points; - // check for collinear - if (d.hull && d.hull.length > 2 && collinear(d)) { - this.collinear = Int32Array.from({ - length: points.length / 2 - }, (_, i)=>i).sort((i, j)=>points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds = [ - points[2 * e], - points[2 * e + 1], - points[2 * f], - points[2 * f + 1] - ], r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for(let i = 0, n = points.length / 2; i < n; ++i){ - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new (0, _delaunatorDefault.default)(points); - } else delete this.collinear; - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for(let e = 0, n = halfedges.length; e < n; ++e){ - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for(let i = 0, n = hull.length; i < n; ++i)hullIndex[hull[i]] = i; - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - inedges[hull[0]] = 1; - if (hull.length === 2) { - inedges[hull[1]] = 0; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - } + }); + const wordcloud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + wordcloud: Wordcloud + }, Symbol.toStringTag, { value: "Module" })); + const array8 = (n) => new Uint8Array(n); + const array16 = (n) => new Uint16Array(n); + const array32 = (n) => new Uint32Array(n); + function Bitmaps() { + let width2 = 8, data2 = [], seen = array32(0), curr = array$1(0, width2), prev = array$1(0, width2); + return { + data: () => data2, + seen: () => seen = lengthen(seen, data2.length), + add(array2) { + for (let i = 0, j = data2.length, n = array2.length, t; i < n; ++i) { + t = array2[i]; + t._index = j++; + data2.push(t); } - } - voronoi(bounds) { - return new (0, _voronoiJsDefault.default)(this, bounds); - } - *neighbors(i) { - const { inedges, hull, _hullIndex, halfedges, triangles, collinear } = this; - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; + }, + remove(num, map2) { + const n = data2.length, copy2 = Array(n - num), reindex = data2; + let t, i, j; + for (i = 0; !map2[i] && i < n; ++i) { + copy2[i] = data2[i]; + reindex[i] = i; + } + for (j = i; i < n; ++i) { + t = data2[i]; + if (!map2[i]) { + reindex[i] = j; + curr[j] = curr[i]; + prev[j] = prev[i]; + copy2[j] = t; + t._index = j++; + } else { + reindex[i] = -1; + } + curr[i] = 0; + } + data2 = copy2; + return reindex; + }, + size: () => data2.length, + curr: () => curr, + prev: () => prev, + reset: (k) => prev[k] = curr[k], + all: () => width2 < 257 ? 255 : width2 < 65537 ? 65535 : 4294967295, + set(k, one2) { + curr[k] |= one2; + }, + clear(k, one2) { + curr[k] &= ~one2; + }, + resize(n, m2) { + const k = curr.length; + if (n > k || m2 > width2) { + width2 = Math.max(m2, width2); + curr = array$1(n, width2, curr); + prev = array$1(n, width2); } - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - }while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0)i = c; - return c; - } - _step(i, x, y) { - const { inedges, hull, _hullIndex, halfedges, triangles, points } = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - }while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, halfedges, triangles } = this; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r) { - if (r === undefined && (!context || typeof context.moveTo !== "function")) r = context, context = null; - r = r == undefined ? 2 : +r; - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points } = this; - for(let i = 0, n = points.length; i < n; i += 2){ - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { hull, points } = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for(let i = 1; i < n; ++i){ - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); + } + }; + } + function lengthen(array2, length2, copy2) { + if (array2.length >= length2) return array2; + copy2 = copy2 || new array2.constructor(length2); + copy2.set(array2); + return copy2; + } + function array$1(n, m2, array2) { + const copy2 = (m2 < 257 ? array8 : m2 < 65537 ? array16 : array32)(n); + if (array2) copy2.set(array2); + return copy2; + } + function Dimension(index2, i, query) { + const bit = 1 << i; + return { + one: bit, + zero: ~bit, + range: query.slice(), + bisect: index2.bisect, + index: index2.index, + size: index2.size, + onAdd(added, curr) { + const dim = this, range2 = dim.bisect(dim.range, added.value), idx = added.index, lo = range2[0], hi = range2[1], n1 = idx.length; + let i2; + for (i2 = 0; i2 < lo; ++i2) curr[idx[i2]] |= bit; + for (i2 = hi; i2 < n1; ++i2) curr[idx[i2]] |= bit; + return dim; + } + }; + } + function SortedIndex() { + let index2 = array32(0), value2 = [], size = 0; + function insert2(key2, data2, base2) { + if (!data2.length) return []; + const n0 = size, n1 = data2.length, addi = array32(n1); + let addv = Array(n1), oldv, oldi, i; + for (i = 0; i < n1; ++i) { + addv[i] = key2(data2[i]); + addi[i] = i; + } + addv = sort$1(addv, addi); + if (n0) { + oldv = value2; + oldi = index2; + value2 = Array(n0 + n1); + index2 = array32(n0 + n1); + merge$1(base2, oldv, oldi, n0, addv, addi, n1, value2, index2); + } else { + if (base2 > 0) for (i = 0; i < n1; ++i) { + addi[i] += base2; + } + value2 = addv; + index2 = addi; + } + size = n0 + n1; + return { + index: addi, + value: addv + }; + } + function remove2(num, map2) { + const n = size; + let idx, i, j; + for (i = 0; !map2[index2[i]] && i < n; ++i) ; + for (j = i; i < n; ++i) { + if (!map2[idx = index2[i]]) { + index2[j] = idx; + value2[j] = value2[i]; + ++j; + } + } + size = n - num; } - hullPolygon() { - const polygon = new (0, _polygonJsDefault.default); - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, triangles } = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); + function reindex(map2) { + for (let i = 0, n = size; i < n; ++i) { + index2[i] = map2[index2[i]]; + } } - *trianglePolygons() { - const { triangles } = this; - for(let i = 0, n = triangles.length / 3; i < n; ++i)yield this.trianglePolygon(i); + function bisect2(range2, array2) { + let n; + if (array2) { + n = array2.length; + } else { + array2 = value2; + n = size; + } + return [bisectLeft$1(array2, range2[0], 0, n), bisectRight$1(array2, range2[1], 0, n)]; } - trianglePolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderTriangle(i, polygon); - return polygon.value(); - } -} -exports.default = Delaunay; -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for(let i = 0; i < n; ++i){ - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points){ - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; + return { + insert: insert2, + remove: remove2, + bisect: bisect2, + reindex, + index: () => index2, + size: () => size + }; + } + function sort$1(values2, index2) { + values2.sort.call(index2, (a2, b2) => { + const x2 = values2[a2], y2 = values2[b2]; + return x2 < y2 ? -1 : x2 > y2 ? 1 : 0; + }); + return permute(values2, index2); + } + function merge$1(base2, value0, index0, n0, value1, index1, n1, value2, index2) { + let i0 = 0, i1 = 0, i; + for (i = 0; i0 < n0 && i1 < n1; ++i) { + if (value0[i0] < value1[i1]) { + value2[i] = value0[i0]; + index2[i] = index0[i0++]; + } else { + value2[i] = value1[i1]; + index2[i] = index1[i1++] + base2; + } } -} - -},{"delaunator":"2B9KR","./path.js":"52EAe","./polygon.js":"1V5gi","./voronoi.js":"dCf1s","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2B9KR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _robustPredicates = require("robust-predicates"); -const EPSILON = Math.pow(2, -52); -const EDGE_STACK = new Uint32Array(512); -class Delaunator { - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - for(let i = 0; i < n; i++){ - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - return new Delaunator(coords); - } - constructor(coords){ - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - this.coords = coords; - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize); // angular edge hash - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); + for (; i0 < n0; ++i0, ++i) { + value2[i] = value0[i0]; + index2[i] = index0[i0]; } - update() { - const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; - const n = coords.length >> 1; - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - for(let i = 0; i < n; i++){ - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - let i0, i1, i2; - // pick a seed point close to the center - for(let i = 0, minDist = Infinity; i < n; i++){ - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } + for (; i1 < n1; ++i1, ++i) { + value2[i] = value1[i1]; + index2[i] = index1[i1] + base2; + } + } + function CrossFilter(params2) { + Transform.call(this, Bitmaps(), params2); + this._indices = null; + this._dims = null; + } + CrossFilter.Definition = { + "type": "CrossFilter", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "query", + "type": "array", + "array": true, + "required": true, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }] + }; + inherits(CrossFilter, Transform, { + transform(_, pulse2) { + if (!this._dims) { + return this.init(_, pulse2); + } else { + var init2 = _.modified("fields") || _.fields.some((f) => pulse2.modified(f.fields)); + return init2 ? this.reinit(_, pulse2) : this.eval(_, pulse2); + } + }, + init(_, pulse2) { + const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m2 = query.length; + let i = 0, key2, index2; + for (; i < m2; ++i) { + key2 = fields[i].fname; + index2 = indices[key2] || (indices[key2] = SortedIndex()); + dims.push(Dimension(index2, i, query[i])); + } + return this.eval(_, pulse2); + }, + reinit(_, pulse2) { + const output2 = pulse2.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output2.rem = output2.add, mod = output2.mod, m2 = query.length, adds = {}; + let add2, index2, key2, mods, remMap, modMap, i, n, f; + prev.set(curr); + if (pulse2.rem.length) { + remMap = this.remove(_, pulse2, output2); + } + if (pulse2.add.length) { + bits.add(pulse2.add); + } + if (pulse2.mod.length) { + modMap = {}; + for (mods = pulse2.mod, i = 0, n = mods.length; i < n; ++i) { + modMap[mods[i]._index] = 1; } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - // find the point closest to the seed - for(let i = 0, minDist = Infinity; i < n; i++){ - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } + } + for (i = 0; i < m2; ++i) { + f = fields[i]; + if (!dims[i] || _.modified("fields", i) || pulse2.modified(f.fields)) { + key2 = f.fname; + if (!(add2 = adds[key2])) { + indices[key2] = index2 = SortedIndex(); + adds[key2] = add2 = index2.insert(f, pulse2.source, 0); + } + dims[i] = Dimension(index2, i, query[i]).onAdd(add2, curr); } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - let minRadius = Infinity; - // find the third point which forms the smallest circumcircle with the first two - for(let i = 0; i < n; i++){ - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } + } + for (i = 0, n = bits.data().length; i < n; ++i) { + if (remMap[i]) { + continue; + } else if (prev[i] !== curr[i]) { + out.push(i); + } else if (modMap[i] && curr[i] !== all) { + mod.push(i); } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for(let i = 0; i < n; i++)this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for(let i = 0, d0 = -Infinity; i < n; i++){ - const id = this._ids[i]; - const d = this._dists[id]; - if (d > d0) { - hull[j++] = id; - d0 = d; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; + } + bits.mask = (1 << m2) - 1; + return output2; + }, + eval(_, pulse2) { + const output2 = pulse2.materialize().fork(), m2 = this._dims.length; + let mask = 0; + if (pulse2.rem.length) { + this.remove(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (_.modified("query") && !_.modified("fields")) { + mask |= this.update(_, pulse2, output2); + } + if (pulse2.add.length) { + this.insert(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (pulse2.mod.length) { + this.modify(pulse2, output2); + mask |= (1 << m2) - 1; + } + this.value.mask = mask; + return output2; + }, + insert(_, pulse2, output2) { + const tuples = pulse2.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output2.add, n = bits.size() + tuples.length, m2 = dims.length; + let k = bits.size(), j, key2, add2; + bits.resize(n, m2); + bits.add(tuples); + const curr = bits.curr(), prev = bits.prev(), all = bits.all(); + for (j = 0; j < m2; ++j) { + key2 = fields[j].fname; + add2 = adds[key2] || (adds[key2] = indices[key2].insert(fields[j], tuples, k)); + dims[j].onAdd(add2, curr); + } + for (; k < n; ++k) { + prev[k] = all; + if (curr[k] !== all) out.push(k); + } + }, + modify(pulse2, output2) { + const out = output2.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse2.mod; + let i, n, k; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + if (curr[k] !== all) out.push(k); + } + }, + remove(_, pulse2, output2) { + const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map2 = {}, out = output2.rem, tuples = pulse2.rem; + let i, n, k, f; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + map2[k] = 1; + prev[k] = f = curr[k]; + curr[k] = all; + if (f !== all) out.push(k); + } + for (k in indices) { + indices[k].remove(n, map2); + } + this.reindex(pulse2, n, map2); + return map2; + }, + // reindex filters and indices after propagation completes + reindex(pulse2, num, map2) { + const indices = this._indices, bits = this.value; + pulse2.runAfter(() => { + const indexMap = bits.remove(num, map2); + for (const key2 in indices) indices[key2].reindex(indexMap); + }); + }, + update(_, pulse2, output2) { + const dims = this._dims, query = _.query, stamp = pulse2.stamp, m2 = dims.length; + let mask = 0, i, q; + output2.filters = 0; + for (q = 0; q < m2; ++q) { + if (_.modified("query", q)) { + i = q; + ++mask; } - // swap the order of the seed points for counter-clockwise orientation - if ((0, _robustPredicates.orient2d)(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - for(let i = 0; i < n; i++)this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - for(let k = 0, xp, yp; k < this._ids.length; k++){ - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue; - xp = x; - yp = y; - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - // find a visible edge on the convex hull using edge hash - let start = 0; - for(let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++){ - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - start = hullPrev[start]; - let e = start, q; - while(q = hullNext[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0){ - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while(q = hullNext[n], (0, _robustPredicates.orient2d)(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0){ - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - // walk backward from the other side, adding more triangles and flipping - if (e === start) while(q = hullPrev[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0){ - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - this.hull = new Uint32Array(hullSize); - for(let i = 0, e = this._hullStart; i < hullSize; i++){ - this.hull[i] = e; - e = hullNext[e]; - } - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - _legalize(a) { - const { _triangles: triangles, _halfedges: halfedges, coords } = this; - let i = 0; - let ar = 0; - // recursion eliminated with a fixed-size stack - while(true){ - const b = halfedges[a]; - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - if (b === -1) { - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - const illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - const hbl = halfedges[bl]; - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - }while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - const br = b0 + (b + 1) % 3; - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) EDGE_STACK[i++] = br; - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } + } + if (mask === 1) { + mask = dims[i].one; + this.incrementOne(dims[i], query[i], output2.add, output2.rem); + } else { + for (q = 0, mask = 0; q < m2; ++q) { + if (!_.modified("query", q)) continue; + mask |= dims[q].one; + this.incrementAll(dims[q], query[q], stamp, output2.add); + output2.rem = output2.add; } - return ar; - } - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; - } - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - this.trianglesLen += 3; - return t; - } -} -exports.default = Delaunator; -// monotonically increases with real angle, but doesn't need expensive trigonometry -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; -} -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - return x * x + y * y; -} -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - return { - x, - y - }; -} -function quicksort(ids, dists, left, right) { - if (right - left <= 20) for(let i = left + 1; i <= right; i++){ - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while(j >= left && dists[ids[j]] > tempDist)ids[j + 1] = ids[j--]; - ids[j + 1] = temp; - } - else { - const median = left + right >> 1; - let i = left + 1; - let j = right; - swap(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); - const temp = ids[i]; - const tempDist = dists[temp]; - while(true){ - do i++; - while (dists[ids[i]] < tempDist); - do j--; - while (dists[ids[j]] > tempDist); - if (j < i) break; - swap(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); + } + return mask; + }, + incrementAll(dim, query, stamp, out) { + const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; } - } -} -function swap(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} - -},{"robust-predicates":"dNpb1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dNpb1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>(0, _orient2DJs.orient2d)); -parcelHelpers.export(exports, "orient2dfast", ()=>(0, _orient2DJs.orient2dfast)); -parcelHelpers.export(exports, "orient3d", ()=>(0, _orient3DJs.orient3d)); -parcelHelpers.export(exports, "orient3dfast", ()=>(0, _orient3DJs.orient3dfast)); -parcelHelpers.export(exports, "incircle", ()=>(0, _incircleJs.incircle)); -parcelHelpers.export(exports, "incirclefast", ()=>(0, _incircleJs.incirclefast)); -parcelHelpers.export(exports, "insphere", ()=>(0, _insphereJs.insphere)); -parcelHelpers.export(exports, "inspherefast", ()=>(0, _insphereJs.inspherefast)); -var _orient2DJs = require("./esm/orient2d.js"); -var _orient3DJs = require("./esm/orient3d.js"); -var _incircleJs = require("./esm/incircle.js"); -var _insphereJs = require("./esm/insphere.js"); - -},{"./esm/orient2d.js":"bI0hj","./esm/orient3d.js":"9tMOz","./esm/incircle.js":"60fkW","./esm/insphere.js":"hdazk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bI0hj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>orient2d); -parcelHelpers.export(exports, "orient2dfast", ()=>orient2dfast); -var _utilJs = require("./util.js"); -const ccwerrboundA = (3 + 16 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundB = (2 + 12 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundC = (9 + 64 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const B = (0, _utilJs.vec)(4); -const C1 = (0, _utilJs.vec)(8); -const C2 = (0, _utilJs.vec)(12); -const D = (0, _utilJs.vec)(16); -const u = (0, _utilJs.vec)(4); -function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { - let acxtail, acytail, bcxtail, bcytail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const acx = ax - cx; - const bcx = bx - cx; - const acy = ay - cy; - const bcy = by - cy; - s1 = acx * bcy; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcx; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - B[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - B[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - B[2] = _j - (u3 - bvirt) + (_i - bvirt); - B[3] = u3; - let det = (0, _utilJs.estimate)(4, B); - let errbound = ccwerrboundB * detsum; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - acx; - acxtail = ax - (acx + bvirt) + (bvirt - cx); - bvirt = bx - bcx; - bcxtail = bx - (bcx + bvirt) + (bvirt - cx); - bvirt = ay - acy; - acytail = ay - (acy + bvirt) + (bvirt - cy); - bvirt = by - bcy; - bcytail = by - (bcy + bvirt) + (bvirt - cy); - if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) return det; - errbound = ccwerrboundC * detsum + (0, _utilJs.resulterrbound) * Math.abs(det); - det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); - if (det >= errbound || -det >= errbound) return det; - s1 = acxtail * bcy; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcx; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C1len = (0, _utilJs.sum)(4, B, 4, u, C1); - s1 = acx * bcytail; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcxtail; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C2len = (0, _utilJs.sum)(C1len, C1, 4, u, C2); - s1 = acxtail * bcytail; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcxtail; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const Dlen = (0, _utilJs.sum)(C2len, C2, 4, u, D); - return D[Dlen - 1]; -} -function orient2d(ax, ay, bx, by, cx, cy) { - const detleft = (ay - cy) * (bx - cx); - const detright = (ax - cx) * (by - cy); - const det = detleft - detright; - const detsum = Math.abs(detleft + detright); - if (Math.abs(det) >= ccwerrboundA * detsum) return det; - return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); -} -function orient2dfast(ax, ay, bx, by, cx, cy) { - return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy); -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8D5If":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "splitter", ()=>splitter); -parcelHelpers.export(exports, "resulterrbound", ()=>resulterrbound); -// fast_expansion_sum_zeroelim routine from oritinal code -parcelHelpers.export(exports, "sum", ()=>sum); -parcelHelpers.export(exports, "sum_three", ()=>sum_three); -// scale_expansion_zeroelim routine from oritinal code -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "negate", ()=>negate); -parcelHelpers.export(exports, "estimate", ()=>estimate); -parcelHelpers.export(exports, "vec", ()=>vec); -const epsilon = 1.1102230246251565e-16; -const splitter = 134217729; -const resulterrbound = (3 + 8 * epsilon) * epsilon; -function sum(elen, e, flen, f, h) { - let Q, Qnew, hh, bvirt; - let enow = e[0]; - let fnow = f[0]; - let eindex = 0; - let findex = 0; - if (fnow > enow === fnow > -enow) { - Q = enow; - enow = e[++eindex]; - } else { - Q = fnow; - fnow = f[++findex]; - } - let hindex = 0; - if (eindex < elen && findex < flen) { - if (fnow > enow === fnow > -enow) { - Qnew = enow + Q; - hh = Q - (Qnew - enow); - enow = e[++eindex]; - } else { - Qnew = fnow + Q; - hh = Q - (Qnew - fnow); - fnow = f[++findex]; + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; - while(eindex < elen && findex < flen){ - if (fnow > enow === fnow > -enow) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - } else { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + } + dim.range = query.slice(); + }, + incrementOne(dim, query, add2, rem2) { + const bits = this.value, curr = bits.curr(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); + } + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); } + } + dim.range = query.slice(); } - while(eindex < elen){ - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + }); + function ResolveFilter(params2) { + Transform.call(this, null, params2); + } + ResolveFilter.Definition = { + "type": "ResolveFilter", + "metadata": {}, + "params": [{ + "name": "ignore", + "type": "number", + "required": true, + "description": "A bit mask indicating which filters to ignore." + }, { + "name": "filter", + "type": "object", + "required": true, + "description": "Per-tuple filter bitmaps from a CrossFilter transform." + }] + }; + inherits(ResolveFilter, Transform, { + transform(_, pulse2) { + const ignore = ~(_.ignore || 0), bitmap = _.filter, mask = bitmap.mask; + if ((mask & ignore) === 0) return pulse2.StopPropagation; + const output2 = pulse2.fork(pulse2.ALL), data2 = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k) => !(curr[k] & ignore) ? data2[k] : null; + output2.filter(output2.MOD, pass); + if (!(mask & mask - 1)) { + output2.filter(output2.ADD, pass); + output2.filter(output2.REM, (k) => (curr[k] & ignore) === mask ? data2[k] : null); + } else { + output2.filter(output2.ADD, (k) => { + const c2 = curr[k] & ignore, f = !c2 && c2 ^ prev[k] & ignore; + return f ? data2[k] : null; + }); + output2.filter(output2.REM, (k) => { + const c2 = curr[k] & ignore, f = c2 && !(c2 ^ (c2 ^ prev[k] & ignore)); + return f ? data2[k] : null; + }); + } + return output2.filter(output2.SOURCE, (t) => pass(t._index)); } - while(findex < flen){ - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + }); + const xf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + crossfilter: CrossFilter, + resolvefilter: ResolveFilter + }, Symbol.toStringTag, { value: "Module" })); + const RawCode = "RawCode"; + const Literal = "Literal"; + const Property = "Property"; + const Identifier = "Identifier"; + const ArrayExpression = "ArrayExpression"; + const BinaryExpression = "BinaryExpression"; + const CallExpression = "CallExpression"; + const ConditionalExpression = "ConditionalExpression"; + const LogicalExpression = "LogicalExpression"; + const MemberExpression = "MemberExpression"; + const ObjectExpression = "ObjectExpression"; + const UnaryExpression = "UnaryExpression"; + function ASTNode(type2) { + this.type = type2; + } + ASTNode.prototype.visit = function(visitor) { + let c2, i, n; + if (visitor(this)) return 1; + for (c2 = children(this), i = 0, n = c2.length; i < n; ++i) { + if (c2[i].visit(visitor)) return 1; } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function sum_three(alen, a, blen, b, clen, c, tmp, out) { - return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out); -} -function scale(elen, e, b, h) { - let Q, sum, hh, product1, product0; - let bvirt, c, ahi, alo, bhi, blo; - c = splitter * b; - bhi = c - (c - b); - blo = b - bhi; - let enow = e[0]; - Q = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo); - let hindex = 0; - if (hh !== 0) h[hindex++] = hh; - for(let i = 1; i < elen; i++){ - enow = e[i]; - product1 = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo); - sum = Q + product0; - bvirt = sum - Q; - hh = Q - (sum - bvirt) + (product0 - bvirt); - if (hh !== 0) h[hindex++] = hh; - Q = product1 + sum; - hh = sum - (Q - product1); - if (hh !== 0) h[hindex++] = hh; - } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function negate(elen, e) { - for(let i = 0; i < elen; i++)e[i] = -e[i]; - return elen; -} -function estimate(elen, e) { - let Q = e[0]; - for(let i = 1; i < elen; i++)Q += e[i]; - return Q; -} -function vec(n) { - return new Float64Array(n); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9tMOz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient3d", ()=>orient3d); -parcelHelpers.export(exports, "orient3dfast", ()=>orient3dfast); -var _utilJs = require("./util.js"); -const o3derrboundA = (7 + 56 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundB = (3 + 28 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundC = (26 + 288 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const at_b = (0, _utilJs.vec)(4); -const at_c = (0, _utilJs.vec)(4); -const bt_c = (0, _utilJs.vec)(4); -const bt_a = (0, _utilJs.vec)(4); -const ct_a = (0, _utilJs.vec)(4); -const ct_b = (0, _utilJs.vec)(4); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const u = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(8); -const _12 = (0, _utilJs.vec)(12); -let fin = (0, _utilJs.vec)(192); -let fin2 = (0, _utilJs.vec)(192); -function finadd(finlen, alen, a) { - finlen = (0, _utilJs.sum)(finlen, fin, alen, a, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function tailinit(xtail, ytail, ax, ay, bx, by, a, b) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3, negate; - if (xtail === 0) { - if (ytail === 0) { - a[0] = 0; - b[0] = 0; - return 1; - } else { - negate = -ytail; - s1 = negate * ax; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } - } else if (ytail === 0) { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - negate = -xtail; - s1 = negate * by; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; + }; + function children(node) { + switch (node.type) { + case ArrayExpression: + return node.elements; + case BinaryExpression: + case LogicalExpression: + return [node.left, node.right]; + case CallExpression: + return [node.callee].concat(node.arguments); + case ConditionalExpression: + return [node.test, node.consequent, node.alternate]; + case MemberExpression: + return [node.object, node.property]; + case ObjectExpression: + return node.properties; + case Property: + return [node.key, node.value]; + case UnaryExpression: + return [node.argument]; + case Identifier: + case Literal: + case RawCode: + default: + return []; + } + } + var TokenName, source, index, length, lookahead; + var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; + TokenName = {}; + TokenName[TokenBooleanLiteral] = "Boolean"; + TokenName[TokenEOF] = "<end>"; + TokenName[TokenIdentifier] = "Identifier"; + TokenName[TokenKeyword] = "Keyword"; + TokenName[TokenNullLiteral] = "Null"; + TokenName[TokenNumericLiteral] = "Numeric"; + TokenName[TokenPunctuator] = "Punctuator"; + TokenName[TokenStringLiteral] = "String"; + TokenName[TokenRegularExpression] = "RegularExpression"; + var SyntaxArrayExpression = "ArrayExpression", SyntaxBinaryExpression = "BinaryExpression", SyntaxCallExpression = "CallExpression", SyntaxConditionalExpression = "ConditionalExpression", SyntaxIdentifier = "Identifier", SyntaxLiteral = "Literal", SyntaxLogicalExpression = "LogicalExpression", SyntaxMemberExpression = "MemberExpression", SyntaxObjectExpression = "ObjectExpression", SyntaxProperty = "Property", SyntaxUnaryExpression = "UnaryExpression"; + var MessageUnexpectedToken = "Unexpected token %0", MessageUnexpectedNumber = "Unexpected number", MessageUnexpectedString = "Unexpected string", MessageUnexpectedIdentifier = "Unexpected identifier", MessageUnexpectedReserved = "Unexpected reserved word", MessageUnexpectedEOS = "Unexpected end of input", MessageInvalidRegExp = "Invalid regular expression", MessageUnterminatedRegExp = "Invalid regular expression: missing /", MessageStrictOctalLiteral = "Octal literals are not allowed in strict mode.", MessageStrictDuplicateProperty = "Duplicate data property in object literal not allowed in strict mode"; + var ILLEGAL$1 = "ILLEGAL", DISABLED = "Disabled."; + var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); + function assert(condition, message) { + if (!condition) { + throw new Error("ASSERT: " + message); + } + } + function isDecimalDigit(ch2) { + return ch2 >= 48 && ch2 <= 57; + } + function isHexDigit(ch2) { + return "0123456789abcdefABCDEF".includes(ch2); + } + function isOctalDigit(ch2) { + return "01234567".includes(ch2); + } + function isWhiteSpace(ch2) { + return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && [5760, 6158, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].includes(ch2); + } + function isLineTerminator(ch2) { + return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233; + } + function isIdentifierStart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch2)); + } + function isIdentifierPart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 >= 48 && ch2 <= 57 || // 0..9 + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch2)); + } + const keywords = { + "if": 1, + "in": 1, + "do": 1, + "var": 1, + "for": 1, + "new": 1, + "try": 1, + "let": 1, + "this": 1, + "else": 1, + "case": 1, + "void": 1, + "with": 1, + "enum": 1, + "while": 1, + "break": 1, + "catch": 1, + "throw": 1, + "const": 1, + "yield": 1, + "class": 1, + "super": 1, + "return": 1, + "typeof": 1, + "delete": 1, + "switch": 1, + "export": 1, + "import": 1, + "public": 1, + "static": 1, + "default": 1, + "finally": 1, + "extends": 1, + "package": 1, + "private": 1, + "function": 1, + "continue": 1, + "debugger": 1, + "interface": 1, + "protected": 1, + "instanceof": 1, + "implements": 1 + }; + function skipComment() { + while (index < length) { + const ch2 = source.charCodeAt(index); + if (isWhiteSpace(ch2) || isLineTerminator(ch2)) { + ++index; + } else { + break; + } + } + } + function scanHexEscape(prefix) { + var i, len2, ch2, code = 0; + len2 = prefix === "u" ? 4 : 2; + for (i = 0; i < len2; ++i) { + if (index < length && isHexDigit(source[index])) { + ch2 = source[index++]; + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + } + return String.fromCharCode(code); + } + function scanUnicodeCodePointEscape() { + var ch2, code, cu1, cu2; + ch2 = source[index]; + code = 0; + if (ch2 === "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + while (index < length) { + ch2 = source[index++]; + if (!isHexDigit(ch2)) { + break; + } + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); + } + if (code > 1114111 || ch2 !== "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + if (code <= 65535) { + return String.fromCharCode(code); + } + cu1 = (code - 65536 >> 10) + 55296; + cu2 = (code - 65536 & 1023) + 56320; + return String.fromCharCode(cu1, cu2); + } + function getEscapedIdentifier() { + var ch2, id2; + ch2 = source.charCodeAt(index++); + id2 = String.fromCharCode(ch2); + if (ch2 === 92) { + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierStart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + id2 = ch2; + } + while (index < length) { + ch2 = source.charCodeAt(index); + if (!isIdentifierPart(ch2)) { + break; + } + ++index; + id2 += String.fromCharCode(ch2); + if (ch2 === 92) { + id2 = id2.substr(0, id2.length - 1); + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierPart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + id2 += ch2; + } + } + return id2; + } + function getIdentifier() { + var start, ch2; + start = index++; + while (index < length) { + ch2 = source.charCodeAt(index); + if (ch2 === 92) { + index = start; + return getEscapedIdentifier(); + } + if (isIdentifierPart(ch2)) { + ++index; + } else { + break; + } + } + return source.slice(start, index); + } + function scanIdentifier() { + var start, id2, type2; + start = index; + id2 = source.charCodeAt(index) === 92 ? getEscapedIdentifier() : getIdentifier(); + if (id2.length === 1) { + type2 = TokenIdentifier; + } else if (keywords.hasOwnProperty(id2)) { + type2 = TokenKeyword; + } else if (id2 === "null") { + type2 = TokenNullLiteral; + } else if (id2 === "true" || id2 === "false") { + type2 = TokenBooleanLiteral; } else { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ytail * ax; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - a[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - a[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - a[2] = _j - (u3 - bvirt) + (_i - bvirt); - a[3] = u3; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = xtail * by; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - b[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - b[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - b[2] = _j - (u3 - bvirt) + (_i - bvirt); - b[3] = u3; - return 4; - } -} -function tailadd(finlen, a, b, k, z) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, u3; - s1 = a * b; - c = (0, _utilJs.splitter) * a; - ahi = c - (c - a); - alo = a - ahi; - c = (0, _utilJs.splitter) * b; - bhi = c - (c - b); - blo = b - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - c = (0, _utilJs.splitter) * k; - bhi = c - (c - k); - blo = k - bhi; - _i = s0 * k; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * k; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - if (z !== 0) { - c = (0, _utilJs.splitter) * z; - bhi = c - (c - z); - blo = z - bhi; - _i = s0 * z; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * z; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - } - return finlen; -} -function orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail; - let adytail, bdytail, cdytail; - let adztail, bdztail, cdztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)(4, bc, adz, _8), _8, (0, _utilJs.scale)(4, ca, bdz, _8b), _8b, _16), _16, (0, _utilJs.scale)(4, ab, cdz, _8), _8, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = o3derrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - bvirt = az - adz; - adztail = az - (adz + bvirt) + (bvirt - dz); - bvirt = bz - bdz; - bdztail = bz - (bdz + bvirt) + (bvirt - dz); - bvirt = cz - cdz; - cdztail = cz - (cdz + bvirt) + (bvirt - dz); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0 && adztail === 0 && bdztail === 0 && cdztail === 0) return det; - errbound = o3derrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += adz * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + adztail * (bdx * cdy - bdy * cdx) + bdz * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + bdztail * (cdx * ady - cdy * adx) + cdz * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + cdztail * (adx * bdy - ady * bdx); - if (det >= errbound || -det >= errbound) return det; - const at_len = tailinit(adxtail, adytail, bdx, bdy, cdx, cdy, at_b, at_c); - const bt_len = tailinit(bdxtail, bdytail, cdx, cdy, adx, ady, bt_c, bt_a); - const ct_len = tailinit(cdxtail, cdytail, adx, ady, bdx, bdy, ct_a, ct_b); - const bctlen = (0, _utilJs.sum)(bt_len, bt_c, ct_len, ct_b, bct); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adz, _16), _16); - const catlen = (0, _utilJs.sum)(ct_len, ct_a, at_len, at_c, cat); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdz, _16), _16); - const abtlen = (0, _utilJs.sum)(at_len, at_b, bt_len, bt_a, abt); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdz, _16), _16); - if (adztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, bc, adztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adztail, _16), _16); - } - if (bdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ca, bdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdztail, _16), _16); - } - if (cdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ab, cdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdztail, _16), _16); - } - if (adxtail !== 0) { - if (bdytail !== 0) finlen = tailadd(finlen, adxtail, bdytail, cdz, cdztail); - if (cdytail !== 0) finlen = tailadd(finlen, -adxtail, cdytail, bdz, bdztail); - } - if (bdxtail !== 0) { - if (cdytail !== 0) finlen = tailadd(finlen, bdxtail, cdytail, adz, adztail); - if (adytail !== 0) finlen = tailadd(finlen, -bdxtail, adytail, cdz, cdztail); - } - if (cdxtail !== 0) { - if (adytail !== 0) finlen = tailadd(finlen, cdxtail, adytail, bdz, bdztail); - if (bdytail !== 0) finlen = tailadd(finlen, -cdxtail, bdytail, adz, adztail); - } - return fin[finlen - 1]; -} -function orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const det = adz * (bdxcdy - cdxbdy) + bdz * (cdxady - adxcdy) + cdz * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz); - const errbound = o3derrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent); -} -function orient3dfast(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - return adx * (bdy * cdz - bdz * cdy) + bdx * (cdy * adz - cdz * ady) + cdx * (ady * bdz - adz * bdy); -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60fkW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "incircle", ()=>incircle); -parcelHelpers.export(exports, "incirclefast", ()=>incirclefast); -var _utilJs = require("./util.js"); -const iccerrboundA = (10 + 96 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundB = (4 + 48 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundC = (44 + 576 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const aa = (0, _utilJs.vec)(4); -const bb = (0, _utilJs.vec)(4); -const cc = (0, _utilJs.vec)(4); -const u = (0, _utilJs.vec)(4); -const v = (0, _utilJs.vec)(4); -const axtbc = (0, _utilJs.vec)(8); -const aytbc = (0, _utilJs.vec)(8); -const bxtca = (0, _utilJs.vec)(8); -const bytca = (0, _utilJs.vec)(8); -const cxtab = (0, _utilJs.vec)(8); -const cytab = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abtt = (0, _utilJs.vec)(4); -const bctt = (0, _utilJs.vec)(4); -const catt = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _16b = (0, _utilJs.vec)(16); -const _16c = (0, _utilJs.vec)(16); -const _32 = (0, _utilJs.vec)(32); -const _32b = (0, _utilJs.vec)(32); -const _48 = (0, _utilJs.vec)(48); -const _64 = (0, _utilJs.vec)(64); -let fin = (0, _utilJs.vec)(1152); -let fin2 = (0, _utilJs.vec)(1152); -function finadd(finlen, a, alen) { - finlen = (0, _utilJs.sum)(finlen, fin, a, alen, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail; - let axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen; - let abtlen, bctlen, catlen; - let abttlen, bcttlen, cattlen; - let n1, n0; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, bc, adx, _8), _8, adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bc, ady, _8), _8, ady, _16b), _16b, _32), _32, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdx, _8), _8, bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdy, _8), _8, bdy, _16b), _16b, _32b), _32b, _64), _64, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdx, _8), _8, cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdy, _8), _8, cdy, _16b), _16b, _32), _32, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = iccerrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0) return det; - errbound = iccerrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += (adx * adx + ady * ady) * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + 2 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx) + ((bdx * bdx + bdy * bdy) * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + 2 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) + ((cdx * cdx + cdy * cdy) * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + 2 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx)); - if (det >= errbound || -det >= errbound) return det; - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = adx * adx; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = ady * ady; - c = (0, _utilJs.splitter) * ady; - ahi = c - (c - ady); - alo = ady - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - aa[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - aa[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - aa[2] = _j - (u3 - bvirt) + (_i - bvirt); - aa[3] = u3; - } - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = bdx * bdx; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = bdy * bdy; - c = (0, _utilJs.splitter) * bdy; - ahi = c - (c - bdy); - alo = bdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - bb[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - bb[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - bb[2] = _j - (u3 - bvirt) + (_i - bvirt); - bb[3] = u3; - } - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = cdx * cdx; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = cdy * cdy; - c = (0, _utilJs.splitter) * cdy; - ahi = c - (c - cdy); - alo = cdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - cc[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - cc[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - cc[2] = _j - (u3 - bvirt) + (_i - bvirt); - cc[3] = u3; - } - if (adxtail !== 0) { - axtbclen = (0, _utilJs.scale)(4, bc, adxtail, axtbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(axtbclen, axtbc, 2 * adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adxtail, _8), _8, -cdy, _16c), _16c, _32, _48), _48); - } - if (adytail !== 0) { - aytbclen = (0, _utilJs.scale)(4, bc, adytail, aytbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(aytbclen, aytbc, 2 * ady, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adytail, _8), _8, cdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adytail, _8), _8, -bdx, _16c), _16c, _32, _48), _48); - } - if (bdxtail !== 0) { - bxtcalen = (0, _utilJs.scale)(4, ca, bdxtail, bxtca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bxtcalen, bxtca, 2 * bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdxtail, _8), _8, -ady, _16c), _16c, _32, _48), _48); - } - if (bdytail !== 0) { - bytcalen = (0, _utilJs.scale)(4, ca, bdytail, bytca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bytcalen, bytca, 2 * bdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdytail, _8), _8, adx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdytail, _8), _8, -cdx, _16c), _16c, _32, _48), _48); - } - if (cdxtail !== 0) { - cxtablen = (0, _utilJs.scale)(4, ab, cdxtail, cxtab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cxtablen, cxtab, 2 * cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, ady, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdxtail, _8), _8, -bdy, _16c), _16c, _32, _48), _48); - } - if (cdytail !== 0) { - cytablen = (0, _utilJs.scale)(4, ab, cdytail, cytab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cytablen, cytab, 2 * cdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdytail, _8), _8, bdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdytail, _8), _8, -adx, _16c), _16c, _32, _48), _48); - } - if (adxtail !== 0 || adytail !== 0) { - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = bdxtail * cdy; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * cdytail; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - s1 = cdxtail * -bdy; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * -bdy; - bhi = c - (c - -bdy); - blo = -bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * -bdytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * -bdytail; - bhi = c - (c - -bdytail); - blo = -bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - bctlen = (0, _utilJs.sum)(4, u, 4, v, bct); - s1 = bdxtail * cdytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdxtail * bdytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bctt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bctt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bctt[2] = _j - (u3 - bvirt) + (_i - bvirt); - bctt[3] = u3; - bcttlen = 4; - } else { - bct[0] = 0; - bctlen = 1; - bctt[0] = 0; - bcttlen = 1; - } - if (adxtail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(axtbclen, axtbc, adxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * adx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * adx, _16), _16, (0, _utilJs.scale)(len2, _8, adxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adxtail, _32), _32, _32b, _64), _64); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdytail, _16), _16); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, -adxtail, _8), _8, cdytail, _16), _16); - } - if (adytail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(aytbclen, aytbc, adytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * ady, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * ady, _16), _16, (0, _utilJs.scale)(len2, _8, adytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adytail, _32), _32, _32b, _64), _64); - } - } - if (bdxtail !== 0 || bdytail !== 0) { - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = cdxtail * ady; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * adytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -cdy; - n0 = -cdytail; - s1 = adxtail * n1; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * n0; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - catlen = (0, _utilJs.sum)(4, u, 4, v, cat); - s1 = cdxtail * adytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adxtail * cdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - catt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - catt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - catt[2] = _j - (u3 - bvirt) + (_i - bvirt); - catt[3] = u3; - cattlen = 4; - } else { - cat[0] = 0; - catlen = 1; - catt[0] = 0; - cattlen = 1; - } - if (bdxtail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bxtcalen, bxtca, bdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdx, _16), _16, (0, _utilJs.scale)(len2, _8, bdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdxtail, _32), _32, _32b, _64), _64); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdytail, _16), _16); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, -bdxtail, _8), _8, adytail, _16), _16); - } - if (bdytail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bytcalen, bytca, bdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdy, _16), _16, (0, _utilJs.scale)(len2, _8, bdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdytail, _32), _32, _32b, _64), _64); - } - } - if (cdxtail !== 0 || cdytail !== 0) { - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = adxtail * bdy; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * bdytail; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -ady; - n0 = -adytail; - s1 = bdxtail * n1; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * n0; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - abtlen = (0, _utilJs.sum)(4, u, 4, v, abt); - s1 = adxtail * bdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdxtail * adytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - abtt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - abtt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - abtt[2] = _j - (u3 - bvirt) + (_i - bvirt); - abtt[3] = u3; - abttlen = 4; - } else { - abt[0] = 0; - abtlen = 1; - abtt[0] = 0; - abttlen = 1; - } - if (cdxtail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cxtablen, cxtab, cdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdx, _16), _16, (0, _utilJs.scale)(len2, _8, cdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdxtail, _32), _32, _32b, _64), _64); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, adytail, _16), _16); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, -cdxtail, _8), _8, bdytail, _16), _16); - } - if (cdytail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cytablen, cytab, cdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdy, _16), _16, (0, _utilJs.scale)(len2, _8, cdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdytail, _32), _32, _32b, _64), _64); - } - } - return fin[finlen - 1]; -} -function incircle(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const alift = adx * adx + ady * ady; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const blift = bdx * bdx + bdy * bdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const clift = cdx * cdx + cdy * cdy; - const det = alift * (bdxcdy - cdxbdy) + blift * (cdxady - adxcdy) + clift * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * alift + (Math.abs(cdxady) + Math.abs(adxcdy)) * blift + (Math.abs(adxbdy) + Math.abs(bdxady)) * clift; - const errbound = iccerrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent); -} -function incirclefast(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const ady = ay - dy; - const bdx = bx - dx; - const bdy = by - dy; - const cdx = cx - dx; - const cdy = cy - dy; - const abdet = adx * bdy - bdx * ady; - const bcdet = bdx * cdy - cdx * bdy; - const cadet = cdx * ady - adx * cdy; - const alift = adx * adx + ady * ady; - const blift = bdx * bdx + bdy * bdy; - const clift = cdx * cdx + cdy * cdy; - return alift * bcdet + blift * cadet + clift * abdet; -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdazk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "insphere", ()=>insphere); -parcelHelpers.export(exports, "inspherefast", ()=>inspherefast); -var _utilJs = require("./util.js"); -const isperrboundA = (16 + 224 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundB = (5 + 72 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundC = (71 + 1408 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const ab = (0, _utilJs.vec)(4); -const bc = (0, _utilJs.vec)(4); -const cd = (0, _utilJs.vec)(4); -const de = (0, _utilJs.vec)(4); -const ea = (0, _utilJs.vec)(4); -const ac = (0, _utilJs.vec)(4); -const bd = (0, _utilJs.vec)(4); -const ce = (0, _utilJs.vec)(4); -const da = (0, _utilJs.vec)(4); -const eb = (0, _utilJs.vec)(4); -const abc = (0, _utilJs.vec)(24); -const bcd = (0, _utilJs.vec)(24); -const cde = (0, _utilJs.vec)(24); -const dea = (0, _utilJs.vec)(24); -const eab = (0, _utilJs.vec)(24); -const abd = (0, _utilJs.vec)(24); -const bce = (0, _utilJs.vec)(24); -const cda = (0, _utilJs.vec)(24); -const deb = (0, _utilJs.vec)(24); -const eac = (0, _utilJs.vec)(24); -const adet = (0, _utilJs.vec)(1152); -const bdet = (0, _utilJs.vec)(1152); -const cdet = (0, _utilJs.vec)(1152); -const ddet = (0, _utilJs.vec)(1152); -const edet = (0, _utilJs.vec)(1152); -const abdet = (0, _utilJs.vec)(2304); -const cddet = (0, _utilJs.vec)(2304); -const cdedet = (0, _utilJs.vec)(3456); -const deter = (0, _utilJs.vec)(5760); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _8c = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _24 = (0, _utilJs.vec)(24); -const _48 = (0, _utilJs.vec)(48); -const _48b = (0, _utilJs.vec)(48); -const _96 = (0, _utilJs.vec)(96); -const _192 = (0, _utilJs.vec)(192); -const _384x = (0, _utilJs.vec)(384); -const _384y = (0, _utilJs.vec)(384); -const _384z = (0, _utilJs.vec)(384); -const _768 = (0, _utilJs.vec)(768); -function sum_three_scale(a, b, c, az, bz, cz, out) { - return (0, _utilJs.sum_three)((0, _utilJs.scale)(4, a, az, _8), _8, (0, _utilJs.scale)(4, b, bz, _8b), _8b, (0, _utilJs.scale)(4, c, cz, _8c), _8c, _16, out); -} -function liftexact(alen, a, blen, b, clen, c, dlen, d, x, y, z, out) { - const len = (0, _utilJs.sum)((0, _utilJs.sum)(alen, a, blen, b, _48), _48, (0, _utilJs.negate)((0, _utilJs.sum)(clen, c, dlen, d, _48b), _48b), _48b, _96); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _96, x, _192), _192, x, _384x), _384x, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, y, _192), _192, y, _384y), _384y, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, z, _192), _192, z, _384z), _384z, _768, out); -} -function insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - s1 = ax * by; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ay; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - s1 = bx * cy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * by; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cx * dy; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * cy; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - cd[2] = _j - (u3 - bvirt) + (_i - bvirt); - cd[3] = u3; - s1 = dx * ey; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * dy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - de[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - de[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - de[2] = _j - (u3 - bvirt) + (_i - bvirt); - de[3] = u3; - s1 = ex * ay; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * ey; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ea[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ea[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ea[2] = _j - (u3 - bvirt) + (_i - bvirt); - ea[3] = u3; - s1 = ax * cy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * ay; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ac[2] = _j - (u3 - bvirt) + (_i - bvirt); - ac[3] = u3; - s1 = bx * dy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * by; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bd[2] = _j - (u3 - bvirt) + (_i - bvirt); - bd[3] = u3; - s1 = cx * ey; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * cy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ce[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ce[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ce[2] = _j - (u3 - bvirt) + (_i - bvirt); - ce[3] = u3; - s1 = dx * ay; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * dy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - da[2] = _j - (u3 - bvirt) + (_i - bvirt); - da[3] = u3; - s1 = ex * by; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ey; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - eb[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - eb[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - eb[2] = _j - (u3 - bvirt) + (_i - bvirt); - eb[3] = u3; - const abclen = sum_three_scale(ab, bc, ac, cz, az, -bz, abc); - const bcdlen = sum_three_scale(bc, cd, bd, dz, bz, -cz, bcd); - const cdelen = sum_three_scale(cd, de, ce, ez, cz, -dz, cde); - const dealen = sum_three_scale(de, ea, da, az, dz, -ez, dea); - const eablen = sum_three_scale(ea, ab, eb, bz, ez, -az, eab); - const abdlen = sum_three_scale(ab, bd, da, dz, az, bz, abd); - const bcelen = sum_three_scale(bc, ce, eb, ez, bz, cz, bce); - const cdalen = sum_three_scale(cd, da, ac, az, cz, dz, cda); - const deblen = sum_three_scale(de, eb, bd, bz, dz, ez, deb); - const eaclen = sum_three_scale(ea, ac, ce, cz, ez, az, eac); - const deterlen = (0, _utilJs.sum_three)(liftexact(cdelen, cde, bcelen, bce, deblen, deb, bcdlen, bcd, ax, ay, az, adet), adet, liftexact(dealen, dea, cdalen, cda, eaclen, eac, cdelen, cde, bx, by, bz, bdet), bdet, (0, _utilJs.sum_three)(liftexact(eablen, eab, deblen, deb, abdlen, abd, dealen, dea, cx, cy, cz, cdet), cdet, liftexact(abclen, abc, eaclen, eac, bcelen, bce, eablen, eab, dx, dy, dz, ddet), ddet, liftexact(bcdlen, bcd, abdlen, abd, cdalen, cda, abclen, abc, ex, ey, ez, edet), edet, cddet, cdedet), cdedet, abdet, deter); - return deter[deterlen - 1]; -} -const xdet = (0, _utilJs.vec)(96); -const ydet = (0, _utilJs.vec)(96); -const zdet = (0, _utilJs.vec)(96); -const fin = (0, _utilJs.vec)(1152); -function liftadapt(a, b, c, az, bz, cz, x, y, z, out) { - const len = sum_three_scale(a, b, c, az, bz, cz, _24); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _24, x, _48), _48, x, xdet), xdet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, y, _48), _48, y, ydet), ydet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, z, _48), _48, z, zdet), zdet, _192, out); -} -function insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent) { - let ab3, bc3, cd3, da3, ac3, bd3; - let aextail, bextail, cextail, dextail; - let aeytail, beytail, ceytail, deytail; - let aeztail, beztail, ceztail, deztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0; - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - s1 = aex * bey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bex * aey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - ab3 = _j + _i; - bvirt = ab3 - _j; - ab[2] = _j - (ab3 - bvirt) + (_i - bvirt); - ab[3] = ab3; - s1 = bex * cey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * bey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - bc3 = _j + _i; - bvirt = bc3 - _j; - bc[2] = _j - (bc3 - bvirt) + (_i - bvirt); - bc[3] = bc3; - s1 = cex * dey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * cey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - cd3 = _j + _i; - bvirt = cd3 - _j; - cd[2] = _j - (cd3 - bvirt) + (_i - bvirt); - cd[3] = cd3; - s1 = dex * aey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = aex * dey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - da3 = _j + _i; - bvirt = da3 - _j; - da[2] = _j - (da3 - bvirt) + (_i - bvirt); - da[3] = da3; - s1 = aex * cey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * aey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - ac3 = _j + _i; - bvirt = ac3 - _j; - ac[2] = _j - (ac3 - bvirt) + (_i - bvirt); - ac[3] = ac3; - s1 = bex * dey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * bey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - bd3 = _j + _i; - bvirt = bd3 - _j; - bd[2] = _j - (bd3 - bvirt) + (_i - bvirt); - bd[3] = bd3; - const finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(bc, cd, bd, dez, bez, -cez, aex, aey, aez, adet), adet), adet, liftadapt(cd, da, ac, aez, cez, dez, bex, bey, bez, bdet), bdet, abdet), abdet, (0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(da, ab, bd, bez, dez, aez, cex, cey, cez, cdet), cdet), cdet, liftadapt(ab, bc, ac, cez, aez, -bez, dex, dey, dez, ddet), ddet, cddet), cddet, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = isperrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - aex; - aextail = ax - (aex + bvirt) + (bvirt - ex); - bvirt = ay - aey; - aeytail = ay - (aey + bvirt) + (bvirt - ey); - bvirt = az - aez; - aeztail = az - (aez + bvirt) + (bvirt - ez); - bvirt = bx - bex; - bextail = bx - (bex + bvirt) + (bvirt - ex); - bvirt = by - bey; - beytail = by - (bey + bvirt) + (bvirt - ey); - bvirt = bz - bez; - beztail = bz - (bez + bvirt) + (bvirt - ez); - bvirt = cx - cex; - cextail = cx - (cex + bvirt) + (bvirt - ex); - bvirt = cy - cey; - ceytail = cy - (cey + bvirt) + (bvirt - ey); - bvirt = cz - cez; - ceztail = cz - (cez + bvirt) + (bvirt - ez); - bvirt = dx - dex; - dextail = dx - (dex + bvirt) + (bvirt - ex); - bvirt = dy - dey; - deytail = dy - (dey + bvirt) + (bvirt - ey); - bvirt = dz - dez; - deztail = dz - (dez + bvirt) + (bvirt - ez); - if (aextail === 0 && aeytail === 0 && aeztail === 0 && bextail === 0 && beytail === 0 && beztail === 0 && cextail === 0 && ceytail === 0 && ceztail === 0 && dextail === 0 && deytail === 0 && deztail === 0) return det; - errbound = isperrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - const abeps = aex * beytail + bey * aextail - (aey * bextail + bex * aeytail); - const bceps = bex * ceytail + cey * bextail - (bey * cextail + cex * beytail); - const cdeps = cex * deytail + dey * cextail - (cey * dextail + dex * ceytail); - const daeps = dex * aeytail + aey * dextail - (dey * aextail + aex * deytail); - const aceps = aex * ceytail + cey * aextail - (aey * cextail + cex * aeytail); - const bdeps = bex * deytail + dey * bextail - (bey * dextail + dex * beytail); - det += (bex * bex + bey * bey + bez * bez) * (cez * daeps + dez * aceps + aez * cdeps + (ceztail * da3 + deztail * ac3 + aeztail * cd3)) + (dex * dex + dey * dey + dez * dez) * (aez * bceps - bez * aceps + cez * abeps + (aeztail * bc3 - beztail * ac3 + ceztail * ab3)) - ((aex * aex + aey * aey + aez * aez) * (bez * cdeps - cez * bdeps + dez * bceps + (beztail * cd3 - ceztail * bd3 + deztail * bc3)) + (cex * cex + cey * cey + cez * cez) * (dez * abeps + aez * bdeps + bez * daeps + (deztail * ab3 + aeztail * bd3 + beztail * da3))) + 2 * ((bex * bextail + bey * beytail + bez * beztail) * (cez * da3 + dez * ac3 + aez * cd3) + (dex * dextail + dey * deytail + dez * deztail) * (aez * bc3 - bez * ac3 + cez * ab3) - ((aex * aextail + aey * aeytail + aez * aeztail) * (bez * cd3 - cez * bd3 + dez * bc3) + (cex * cextail + cey * ceytail + cez * ceztail) * (dez * ab3 + aez * bd3 + bez * da3))); - if (det >= errbound || -det >= errbound) return det; - return insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez); -} -function insphere(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - const aexbey = aex * bey; - const bexaey = bex * aey; - const ab = aexbey - bexaey; - const bexcey = bex * cey; - const cexbey = cex * bey; - const bc = bexcey - cexbey; - const cexdey = cex * dey; - const dexcey = dex * cey; - const cd = cexdey - dexcey; - const dexaey = dex * aey; - const aexdey = aex * dey; - const da = dexaey - aexdey; - const aexcey = aex * cey; - const cexaey = cex * aey; - const ac = aexcey - cexaey; - const bexdey = bex * dey; - const dexbey = dex * bey; - const bd = bexdey - dexbey; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - const det = clift * (dez * ab + aez * bd + bez * da) - dlift * (aez * bc - bez * ac + cez * ab) + (alift * (bez * cd - cez * bd + dez * bc) - blift * (cez * da + dez * ac + aez * cd)); - const aezplus = Math.abs(aez); - const bezplus = Math.abs(bez); - const cezplus = Math.abs(cez); - const dezplus = Math.abs(dez); - const aexbeyplus = Math.abs(aexbey) + Math.abs(bexaey); - const bexceyplus = Math.abs(bexcey) + Math.abs(cexbey); - const cexdeyplus = Math.abs(cexdey) + Math.abs(dexcey); - const dexaeyplus = Math.abs(dexaey) + Math.abs(aexdey); - const aexceyplus = Math.abs(aexcey) + Math.abs(cexaey); - const bexdeyplus = Math.abs(bexdey) + Math.abs(dexbey); - const permanent = (cexdeyplus * bezplus + bexdeyplus * cezplus + bexceyplus * dezplus) * alift + (dexaeyplus * cezplus + aexceyplus * dezplus + cexdeyplus * aezplus) * blift + (aexbeyplus * dezplus + bexdeyplus * aezplus + dexaeyplus * bezplus) * clift + (bexceyplus * aezplus + aexceyplus * bezplus + aexbeyplus * cezplus) * dlift; - const errbound = isperrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return -insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent); -} -function inspherefast(pax, pay, paz, pbx, pby, pbz, pcx, pcy, pcz, pdx, pdy, pdz, pex, pey, pez) { - const aex = pax - pex; - const bex = pbx - pex; - const cex = pcx - pex; - const dex = pdx - pex; - const aey = pay - pey; - const bey = pby - pey; - const cey = pcy - pey; - const dey = pdy - pey; - const aez = paz - pez; - const bez = pbz - pez; - const cez = pcz - pez; - const dez = pdz - pez; - const ab = aex * bey - bex * aey; - const bc = bex * cey - cex * bey; - const cd = cex * dey - dex * cey; - const da = dex * aey - aex * dey; - const ac = aex * cey - cex * aey; - const bd = bex * dey - dex * bey; - const abc = aez * bc - bez * ac + cez * ab; - const bcd = bez * cd - cez * bd + dez * bc; - const cda = cez * da + dez * ac + aez * cd; - const dab = dez * ab + aez * bd + bez * da; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - return clift * dab - dlift * abc + (alift * bcd - blift * cda); -} - -},{"./util.js":"8D5If","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"52EAe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -const epsilon = 1e-6; -class Path { - constructor(){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; + type2 = TokenIdentifier; } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; + return { + type: type2, + value: id2, + start, + end: index + }; + } + function scanPunctuator() { + var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; + switch (code) { + // Check for most common single-character punctuators. + case 46: + // . dot + case 40: + // ( open bracket + case 41: + // ) close bracket + case 59: + // ; semicolon + case 44: + // , comma + case 123: + // { open curly brace + case 125: + // } close curly brace + case 91: + // [ + case 93: + // ] + case 58: + // : + case 63: + // ? + case 126: + ++index; + return { + type: TokenPunctuator, + value: String.fromCharCode(code), + start, + end: index + }; + default: + code2 = source.charCodeAt(index + 1); + if (code2 === 61) { + switch (code) { + case 43: + // + + case 45: + // - + case 47: + // / + case 60: + // < + case 62: + // > + case 94: + // ^ + case 124: + // | + case 37: + // % + case 38: + // & + case 42: + index += 2; + return { + type: TokenPunctuator, + value: String.fromCharCode(code) + String.fromCharCode(code2), + start, + end: index + }; + case 33: + // ! + case 61: + index += 2; + if (source.charCodeAt(index) === 61) { + ++index; + } + return { + type: TokenPunctuator, + value: source.slice(start, index), + start, + end: index + }; + } } } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; + ch4 = source.substr(index, 4); + if (ch4 === ">>>=") { + index += 4; + return { + type: TokenPunctuator, + value: ch4, + start, + end: index + }; } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; + ch3 = ch4.substr(0, 3); + if (ch3 === ">>>" || ch3 === "<<=" || ch3 === ">>=") { + index += 3; + return { + type: TokenPunctuator, + value: ch3, + start, + end: index + }; } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; + ch2 = ch3.substr(0, 2); + if (ch1 === ch2[1] && "+-<>&|".includes(ch1) || ch2 === "=>") { + index += 2; + return { + type: TokenPunctuator, + value: ch2, + start, + end: index + }; } - value() { - return this._ || null; - } -} -exports.default = Path; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1V5gi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -class Polygon { - constructor(){ - this._ = []; - } - moveTo(x, y) { - this._.push([ - x, - y - ]); + if (ch2 === "//") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - closePath() { - this._.push(this._[0].slice()); + if ("<>=!+-*%&|^/".includes(ch1)) { + ++index; + return { + type: TokenPunctuator, + value: ch1, + start, + end: index + }; } - lineTo(x, y) { - this._.push([ - x, - y - ]); + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + function scanHexLiteral(start) { + let number2 = ""; + while (index < length) { + if (!isHexDigit(source[index])) { + break; + } + number2 += source[index++]; } - value() { - return this._.length ? this._ : null; - } -} -exports.default = Polygon; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dCf1s":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [ - 0, - 0, - 960, - 500 - ]){ - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); + if (number2.length === 0) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - update() { - this.delaunay.update(); - this._init(); - return this; + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - _init() { - const { delaunay: { points, hull, triangles }, vectors } = this; - let bx, by; // lazily computed barycenter of the hull - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for(let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2){ - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const ab = (dx * ey - dy * ex) * 2; - if (Math.abs(ab) < 1e-9) { - // For a degenerate triangle, the circumcenter is at the infinity, in a - // direction orthogonal to the halfedge and away from the “center” of - // the diagram <bx, by>, defined as the hull’s barycenter. - if (bx === undefined) { - bx = by = 0; - for (const i of hull)bx += points[i * 2], by += points[i * 2 + 1]; - bx /= hull.length, by /= hull.length; - } - const a = 1e9 * Math.sign((bx - x1) * ey - (by - y1) * ex); - x = (x1 + x3) / 2 - a * ey; - y = (y1 + y3) / 2 + a * ex; - } else { - const d = 1 / ab; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for(let i = 0; i < hull.length; ++i){ - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; - if (hull.length <= 1) return null; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for(let i = 0; i < hull.length; ++i){ - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while(points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1)n -= 2; - for(let i = 2; i < n; i += 2)if (points[i] !== points[i - 2] || points[i + 1] !== points[i - 1]) context.lineTo(points[i], points[i + 1]); - context.closePath(); - return buffer && buffer.value(); + return { + type: TokenNumericLiteral, + value: parseInt("0x" + number2, 16), + start, + end: index + }; + } + function scanOctalLiteral(start) { + let number2 = "0" + source[index++]; + while (index < length) { + if (!isOctalDigit(source[index])) { + break; + } + number2 += source[index++]; } - *cellPolygons() { - const { delaunay: { points } } = this; - for(let i = 0, n = points.length / 2; i < n; ++i){ - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; + if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + return { + type: TokenNumericLiteral, + value: parseInt(number2, 8), + octal: true, + start, + end: index + }; + } + function scanNumericLiteral() { + var number2, start, ch2; + ch2 = source[index]; + assert(isDecimalDigit(ch2.charCodeAt(0)) || ch2 === ".", "Numeric literal must start with a decimal digit or a decimal point"); + start = index; + number2 = ""; + if (ch2 !== ".") { + number2 = source[index++]; + ch2 = source[index]; + if (number2 === "0") { + if (ch2 === "x" || ch2 === "X") { + ++index; + return scanHexLiteral(start); + } + if (isOctalDigit(ch2)) { + return scanOctalLiteral(start); + } + if (ch2 && isDecimalDigit(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } + } + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; } - cellPolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); + if (ch2 === ".") { + number2 += source[index++]; + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; + } + if (ch2 === "e" || ch2 === "E") { + number2 += source[index++]; + ch2 = source[index]; + if (ch2 === "+" || ch2 === "-") { + number2 += source[index++]; + } + if (isDecimalDigit(source.charCodeAt(index))) { + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; } + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)){ - const cj = this._clip(j); - // find the common edge - if (cj) loop: for(let ai = 0, li = ci.length; ai < li; ai += 2){ - for(let aj = 0, lj = cj.length; aj < lj; aj += 2)if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { - yield j; - break loop; + return { + type: TokenNumericLiteral, + value: parseFloat(number2), + start, + end: index + }; + } + function scanStringLiteral() { + var str = "", quote, start, ch2, code, octal = false; + quote = source[index]; + assert(quote === "'" || quote === '"', "String literal must starts with a quote"); + start = index; + ++index; + while (index < length) { + ch2 = source[index++]; + if (ch2 === quote) { + quote = ""; + break; + } else if (ch2 === "\\") { + ch2 = source[index++]; + if (!ch2 || !isLineTerminator(ch2.charCodeAt(0))) { + switch (ch2) { + case "u": + case "x": + if (source[index] === "{") { + ++index; + str += scanUnicodeCodePointEscape(); + } else { + str += scanHexEscape(ch2); + } + break; + case "n": + str += "\n"; + break; + case "r": + str += "\r"; + break; + case "t": + str += " "; + break; + case "b": + str += "\b"; + break; + case "f": + str += "\f"; + break; + case "v": + str += "\v"; + break; + default: + if (isOctalDigit(ch2)) { + code = "01234567".indexOf(ch2); + if (code !== 0) { + octal = true; } - } + if (index < length && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + "01234567".indexOf(source[index++]); + if ("0123".includes(ch2) && index < length && isOctalDigit(source[index])) { + code = code * 8 + "01234567".indexOf(source[index++]); + } + } + str += String.fromCharCode(code); + } else { + str += ch2; + } + break; + } + } else { + if (ch2 === "\r" && source[index] === "\n") { + ++index; + } } + } else if (isLineTerminator(ch2.charCodeAt(0))) { + break; + } else { + str += ch2; + } } - _cell(i) { - const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - }while (e !== e0 && e !== -1); - return points; + if (quote !== "") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - const points = this._cell(i); - if (points === null) return null; - const { vectors: V } = this; - const v = i * 4; - return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points)); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1 = 0; - for(let j = 0; j < n; j += 2){ - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [ - x1, - y1 - ]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [ - sx0, - sy0 - ]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [ - sx1, - sy1 - ]; - } + return { + type: TokenStringLiteral, + value: str, + octal, + start, + end: index + }; + } + function testRegExp(pattern, flags) { + let tmp = pattern; + if (flags.includes("u")) { + tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1) => { + if (parseInt($1, 16) <= 1114111) { + return "x"; } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - // for more robustness, always consider the segment in the same order - const flip = c0 < c1; - if (flip) [x0, y0, x1, y1, c0, c1] = [ - x1, - y1, - x0, - y0, - c1, - c0 - ]; - while(true){ - if (c0 === 0 && c1 === 0) return flip ? [ - x1, - y1, - x0, - y0 - ] : [ - x0, - y0, - x1, - y1 - ]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 8) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 4) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 2) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) for(let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2){ - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) P = [ - this.xmin, - this.ymin, - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax - ]; - return P; + throwError({}, MessageInvalidRegExp); + }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"); } - _edge(i, e0, e1, P, j) { - while(e0 !== e1){ - let x, y; - switch(e0){ - case 5: - e0 = 4; - continue; // top-left - case 4: - e0 = 6, x = this.xmax, y = this.ymin; - break; // top - case 6: - e0 = 2; - continue; // top-right - case 2: - e0 = 10, x = this.xmax, y = this.ymax; - break; // right - case 10: - e0 = 8; - continue; // bottom-right - case 8: - e0 = 9, x = this.xmin, y = this.ymax; - break; // bottom - case 9: - e0 = 1; - continue; // bottom-left - case 1: - e0 = 5, x = this.xmin, y = this.ymin; - break; // left - } - // Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are - // undefined, the conditional statement will be executed. - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) P.splice(j, 0, x, y), j += 2; - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; + try { + new RegExp(tmp); + } catch (e) { + throwError({}, MessageInvalidRegExp); + } + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } + } + function scanRegExpBody() { + var ch2, str, classMarker, terminated, body; + ch2 = source[index]; + assert(ch2 === "/", "Regular expression literal must start with a slash"); + str = source[index++]; + classMarker = false; + terminated = false; + while (index < length) { + ch2 = source[index++]; + str += ch2; + if (ch2 === "\\") { + ch2 = source[index++]; + if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } + str += ch2; + } else if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } else if (classMarker) { + if (ch2 === "]") { + classMarker = false; + } + } else { + if (ch2 === "/") { + terminated = true; + break; + } else if (ch2 === "[") { + classMarker = true; } - return [ - x, - y - ]; + } + } + if (!terminated) { + throwError({}, MessageUnterminatedRegExp); + } + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; + } + function scanRegExpFlags() { + var ch2, str, flags; + str = ""; + flags = ""; + while (index < length) { + ch2 = source[index]; + if (!isIdentifierPart(ch2.charCodeAt(0))) { + break; + } + ++index; + if (ch2 === "\\" && index < length) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } else { + flags += ch2; + str += ch2; + } + } + if (flags.search(/[^gimuy]/g) >= 0) { + throwError({}, MessageInvalidRegExp, flags); + } + return { + value: flags, + literal: str + }; + } + function scanRegExp() { + var start, body, flags, value2; + lookahead = null; + skipComment(); + start = index; + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value2 = testRegExp(body.value, flags.value); + return { + literal: body.literal + flags.literal, + value: value2, + regex: { + pattern: body.value, + flags: flags.value + }, + start, + end: index + }; + } + function isIdentifierName(token) { + return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; + } + function advance() { + skipComment(); + if (index >= length) { + return { + type: TokenEOF, + start: index, + end: index + }; + } + const ch2 = source.charCodeAt(index); + if (isIdentifierStart(ch2)) { + return scanIdentifier(); + } + if (ch2 === 40 || ch2 === 41 || ch2 === 59) { + return scanPunctuator(); + } + if (ch2 === 39 || ch2 === 34) { + return scanStringLiteral(); + } + if (ch2 === 46) { + if (isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } + if (isDecimalDigit(ch2)) { + return scanNumericLiteral(); + } + return scanPunctuator(); + } + function lex() { + const token = lookahead; + index = token.end; + lookahead = advance(); + index = token.end; + return token; + } + function peek() { + const pos = index; + lookahead = advance(); + index = pos; + } + function finishArrayExpression(elements) { + const node = new ASTNode(SyntaxArrayExpression); + node.elements = elements; + return node; + } + function finishBinaryExpression(operator2, left, right) { + const node = new ASTNode(operator2 === "||" || operator2 === "&&" ? SyntaxLogicalExpression : SyntaxBinaryExpression); + node.operator = operator2; + node.left = left; + node.right = right; + return node; + } + function finishCallExpression(callee, args) { + const node = new ASTNode(SyntaxCallExpression); + node.callee = callee; + node.arguments = args; + return node; + } + function finishConditionalExpression(test2, consequent, alternate) { + const node = new ASTNode(SyntaxConditionalExpression); + node.test = test2; + node.consequent = consequent; + node.alternate = alternate; + return node; + } + function finishIdentifier(name) { + const node = new ASTNode(SyntaxIdentifier); + node.name = name; + return node; + } + function finishLiteral(token) { + const node = new ASTNode(SyntaxLiteral); + node.value = token.value; + node.raw = source.slice(token.start, token.end); + if (token.regex) { + if (node.raw === "//") { + node.raw = "/(?:)/"; + } + node.regex = token.regex; + } + return node; + } + function finishMemberExpression(accessor2, object2, property2) { + const node = new ASTNode(SyntaxMemberExpression); + node.computed = accessor2 === "["; + node.object = object2; + node.property = property2; + if (!node.computed) property2.member = true; + return node; + } + function finishObjectExpression(properties) { + const node = new ASTNode(SyntaxObjectExpression); + node.properties = properties; + return node; + } + function finishProperty(kind, key2, value2) { + const node = new ASTNode(SyntaxProperty); + node.key = key2; + node.value = value2; + node.kind = kind; + return node; + } + function finishUnaryExpression(operator2, argument) { + const node = new ASTNode(SyntaxUnaryExpression); + node.operator = operator2; + node.argument = argument; + node.prefix = true; + return node; + } + function throwError(token, messageFormat) { + var error2, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index2) => { + assert(index2 < args.length, "Message reference must be in range"); + return args[index2]; + }); + error2 = new Error(msg); + error2.index = index; + error2.description = msg; + throw error2; + } + function throwUnexpected(token) { + if (token.type === TokenEOF) { + throwError(token, MessageUnexpectedEOS); + } + if (token.type === TokenNumericLiteral) { + throwError(token, MessageUnexpectedNumber); + } + if (token.type === TokenStringLiteral) { + throwError(token, MessageUnexpectedString); + } + if (token.type === TokenIdentifier) { + throwError(token, MessageUnexpectedIdentifier); + } + if (token.type === TokenKeyword) { + throwError(token, MessageUnexpectedReserved); + } + throwError(token, MessageUnexpectedToken, token.value); + } + function expect(value2) { + const token = lex(); + if (token.type !== TokenPunctuator || token.value !== value2) { + throwUnexpected(token); + } + } + function match(value2) { + return lookahead.type === TokenPunctuator && lookahead.value === value2; + } + function matchKeyword(keyword) { + return lookahead.type === TokenKeyword && lookahead.value === keyword; + } + function parseArrayInitialiser() { + const elements = []; + index = lookahead.start; + expect("["); + while (!match("]")) { + if (match(",")) { + lex(); + elements.push(null); + } else { + elements.push(parseConditionalExpression()); + if (!match("]")) { + expect(","); + } + } + } + lex(); + return finishArrayExpression(elements); + } + function parseObjectPropertyKey() { + index = lookahead.start; + const token = lex(); + if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { + if (token.octal) { + throwError(token, MessageStrictOctalLiteral); + } + return finishLiteral(token); + } + return finishIdentifier(token.value); + } + function parseObjectProperty() { + var token, key2, id2, value2; + index = lookahead.start; + token = lookahead; + if (token.type === TokenIdentifier) { + id2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", id2, value2); + } + if (token.type === TokenEOF || token.type === TokenPunctuator) { + throwUnexpected(token); + } else { + key2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", key2, value2); + } + } + function parseObjectInitialiser() { + var properties = [], property2, name, key2, map2 = {}, toString2 = String; + index = lookahead.start; + expect("{"); + while (!match("}")) { + property2 = parseObjectProperty(); + if (property2.key.type === SyntaxIdentifier) { + name = property2.key.name; + } else { + name = toString2(property2.key.value); + } + key2 = "$" + name; + if (Object.prototype.hasOwnProperty.call(map2, key2)) { + throwError({}, MessageStrictDuplicateProperty); + } else { + map2[key2] = true; + } + properties.push(property2); + if (!match("}")) { + expect(","); + } + } + expect("}"); + return finishObjectExpression(properties); + } + function parseGroupExpression() { + expect("("); + const expr2 = parseExpression(); + expect(")"); + return expr2; + } + const legalKeywords = { + "if": 1 + }; + function parsePrimaryExpression() { + var type2, token, expr2; + if (match("(")) { + return parseGroupExpression(); + } + if (match("[")) { + return parseArrayInitialiser(); + } + if (match("{")) { + return parseObjectInitialiser(); + } + type2 = lookahead.type; + index = lookahead.start; + if (type2 === TokenIdentifier || legalKeywords[lookahead.value]) { + expr2 = finishIdentifier(lex().value); + } else if (type2 === TokenStringLiteral || type2 === TokenNumericLiteral) { + if (lookahead.octal) { + throwError(lookahead, MessageStrictOctalLiteral); + } + expr2 = finishLiteral(lex()); + } else if (type2 === TokenKeyword) { + throw new Error(DISABLED); + } else if (type2 === TokenBooleanLiteral) { + token = lex(); + token.value = token.value === "true"; + expr2 = finishLiteral(token); + } else if (type2 === TokenNullLiteral) { + token = lex(); + token.value = null; + expr2 = finishLiteral(token); + } else if (match("/") || match("/=")) { + expr2 = finishLiteral(scanRegExp()); + peek(); + } else { + throwUnexpected(lex()); } - _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); + return expr2; + } + function parseArguments() { + const args = []; + expect("("); + if (!match(")")) { + while (index < length) { + args.push(parseConditionalExpression()); + if (match(")")) { + break; + } + expect(","); + } } - _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); + expect(")"); + return args; + } + function parseNonComputedProperty() { + index = lookahead.start; + const token = lex(); + if (!isIdentifierName(token)) { + throwUnexpected(token); } - _simplify(P) { - if (P && P.length > 4) { - for(let i = 0; i < P.length; i += 2){ - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) P.splice(j, 2), i -= 2; - } - if (!P.length) P = null; - } - return P; - } -} -exports.default = Voronoi; - -},{"./path.js":"52EAe","./polygon.js":"1V5gi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Db9C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "wordcloud", ()=>Wordcloud); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _vegaScale = require("vega-scale"); -var _vegaStatistics = require("vega-statistics"); -/* -Copyright (c) 2013, Jason Davies. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * The name Jason Davies may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ // Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ -// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf -var cloudRadians = Math.PI / 180, cw = 64, ch = 2048; -function cloud() { - var size = [ - 256, - 256 - ], text, font, fontSize, fontStyle, fontWeight, rotate, padding, spiral = archimedeanSpiral, words = [], random = Math.random, cloud = {}; - cloud.layout = function() { - var contextAndRatio = getContext((0, _vegaCanvas.canvas)()), board = zeroArray((size[0] >> 5) * size[1]), bounds = null, n = words.length, i = -1, tags = [], data = words.map((d)=>({ - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - })).sort((a, b)=>b.size - a.size); - while(++i < n){ - var d = data[i]; - d.x = size[0] * (random() + .5) >> 1; - d.y = size[1] * (random() + .5) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [ - { - x: d.x + d.x0, - y: d.y + d.y0 - }, - { - x: d.x + d.x1, - y: d.y + d.y1 - } - ]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - return tags; - }; - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - return { - context: context, - ratio: ratio - }; + return finishIdentifier(token.value); + } + function parseNonComputedMember() { + expect("."); + return parseNonComputedProperty(); + } + function parseComputedMember() { + expect("["); + const expr2 = parseExpression(); + expect("]"); + return expr2; + } + function parseLeftHandSideExpressionAllowCall() { + var expr2, args, property2; + expr2 = parsePrimaryExpression(); + for (; ; ) { + if (match(".")) { + property2 = parseNonComputedMember(); + expr2 = finishMemberExpression(".", expr2, property2); + } else if (match("(")) { + args = parseArguments(); + expr2 = finishCallExpression(expr2, args); + } else if (match("[")) { + property2 = parseComputedMember(); + expr2 = finishMemberExpression("[", expr2, property2); + } else { + break; + } } - function place(board, tag, bounds) { - var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size[0], size[1]), s = spiral(size), dt = random() < .5 ? 1 : -1, t = -dt, dxdy, dx, dy; - while(dxdy = s(t += dt)){ - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - tag.x = startX + dx; - tag.y = startY + dy; - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, w = tag.width >> 5, sw = size[0] >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++)board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; + return expr2; + } + function parsePostfixExpression() { + const expr2 = parseLeftHandSideExpressionAllowCall(); + if (lookahead.type === TokenPunctuator) { + if (match("++") || match("--")) { + throw new Error(DISABLED); + } } - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else return words; - }; - cloud.size = function(_) { - if (arguments.length) { - size = [ - +_[0], - +_[1] - ]; - return cloud; - } else return size; - }; - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else return font; - }; - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else return fontStyle; - }; - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else return fontWeight; - }; - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else return rotate; - }; - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else return text; - }; - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else return spiral; - }; - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else return fontSize; - }; - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else return padding; - }; - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else return random; - }; - return cloud; -} -// Fetches a monochrome sprite bitmap for the specified text. -// Load in batches for speed. -function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, ratio = contextAndRatio.ratio; - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, y = 0, maxh = 0, n = data.length, w, w32, h, i, j; - --di; - while(++di < n){ - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), cr = Math.cos(d.rotate * cloudRadians), wcr = w * cr, wsr = w * sr, hcr = h * cr, hsr = h * sr; - w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else w = w + 0x1f >> 5 << 5; - if (h > maxh) maxh = h; - if (x + w >= cw << 5) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; - while(--di >= 0){ - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for(i = 0; i < h * w32; i++)sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, seenRow = -1; - for(j = 0; j < h; j++){ - for(i = 0; i < w; i++){ - var k = w32 * j + (i >> 5), m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); + return expr2; + } + function parseUnaryExpression() { + var token, expr2; + if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { + expr2 = parsePostfixExpression(); + } else if (match("++") || match("--")) { + throw new Error(DISABLED); + } else if (match("+") || match("-") || match("~") || match("!")) { + token = lex(); + expr2 = parseUnaryExpression(); + expr2 = finishUnaryExpression(token.value, expr2); + } else if (matchKeyword("delete") || matchKeyword("void") || matchKeyword("typeof")) { + throw new Error(DISABLED); + } else { + expr2 = parsePostfixExpression(); } -} -// Use mask-based collision detection. -function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, w = tag.width >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++){ - if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true; - } - x += sw; + return expr2; + } + function binaryPrecedence(token) { + let prec = 0; + if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { + return 0; } - return false; -} -function cloudBounds(bounds, d) { - var b0 = bounds[0], b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; -} -function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; -} -function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [ - e * (t *= .1) * Math.cos(t), - t * Math.sin(t) - ]; - }; -} -function rectangularSpiral(size) { - var dy = 4, dx = dy * size[0] / size[1], x = 0, y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch(Math.sqrt(1 + 4 * sign * t) - sign & 3){ - case 0: - x += dx; - break; - case 1: - y += dy; - break; - case 2: - x -= dx; - break; - default: - y -= dy; - break; - } - return [ - x, - y - ]; - }; -} -// TODO reuse arrays? -function zeroArray(n) { - var a = [], i = -1; - while(++i < n)a[i] = 0; - return a; -} -function functor(d) { - return typeof d === 'function' ? d : function() { - return d; - }; -} -var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral -}; -const Output = [ - 'x', - 'y', - 'font', - 'fontSize', - 'fontStyle', - 'fontWeight', - 'angle' -]; -const Params = [ - 'text', - 'font', - 'rotate', - 'fontSize', - 'fontStyle', - 'fontWeight' -]; -function Wordcloud(params) { - (0, _vegaDataflow.Transform).call(this, cloud(), params); -} -Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'font', - 'type': 'string', - 'expr': true, - 'default': 'sans-serif' - }, - { - 'name': 'fontStyle', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontWeight', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontSize', - 'type': 'number', - 'expr': true, - 'default': 14 - }, - { - 'name': 'fontSizeRange', - 'type': 'number', - 'array': 'nullable', - 'default': [ - 10, - 50 - ] - }, - { - 'name': 'rotate', - 'type': 'number', - 'expr': true, - 'default': 0 - }, - { - 'name': 'text', - 'type': 'field' - }, - { - 'name': 'spiral', - 'type': 'string', - 'values': [ - 'archimedean', - 'rectangular' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 7, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Wordcloud, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) (0, _vegaUtil.error)('Wordcloud size dimensions must be non-zero.'); - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return; - const data = pulse.materialize(pulse.SOURCE).source, layout = this.value, as = _.as || Output; - let fontSize = _.fontSize || 14, range; - (0, _vegaUtil.isFunction)(fontSize) ? range = _.fontSizeRange : fontSize = (0, _vegaUtil.constant)(fontSize); - // create font size scaling function as needed - if (range) { - const fsize = fontSize, sizeScale = (0, _vegaScale.scale)('sqrt')().domain((0, _vegaUtil.extent)(data, fsize)).range(range); - fontSize = (x)=>sizeScale(fsize(x)); - } - data.forEach((t)=>{ - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - // configure layout - const words = layout.words(data).text(_.text).size(_.size || [ - 500, - 500 - ]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random((0, _vegaStatistics.random)).layout(); - const size = layout.size(), dx = size[0] >> 1, dy = size[1] >> 1, n = words.length; - for(let i = 0, w, t; i < n; ++i){ - w = words[i]; - t = w.datum; - t[as[0]] = w.x + dx; - t[as[1]] = w.y + dy; - t[as[2]] = w.font; - t[as[3]] = w.size; - t[as[4]] = w.style; - t[as[5]] = w.weight; - t[as[6]] = w.rotate; - } - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-canvas":"4O1hR","vega-dataflow":"cFRfY","vega-util":"f2ulH","vega-scale":"gHN3E","vega-statistics":"4QSQj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ipwtZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "crossfilter", ()=>CrossFilter); -parcelHelpers.export(exports, "resolvefilter", ()=>ResolveFilter); -var _d3Array = require("d3-array"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -const array8 = (n)=>new Uint8Array(n); -const array16 = (n)=>new Uint16Array(n); -const array32 = (n)=>new Uint32Array(n); -/** - * Maintains CrossFilter state. - */ function Bitmaps() { - let width = 8, data = [], seen = array32(0), curr = array(0, width), prev = array(0, width); - return { - data: ()=>data, - seen: ()=>seen = lengthen(seen, data.length), - add (array) { - for(let i = 0, j = data.length, n = array.length, t; i < n; ++i){ - t = array[i]; - t._index = j++; - data.push(t); - } - }, - remove (num, map) { - // map: index -> boolean (true => remove) - const n = data.length, copy = Array(n - num), reindex = data; // reuse old data array for index map - let t, i, j; - // seek forward to first removal - for(i = 0; !map[i] && i < n; ++i){ - copy[i] = data[i]; - reindex[i] = i; - } - // condense arrays - for(j = i; i < n; ++i){ - t = data[i]; - if (!map[i]) { - reindex[i] = j; - curr[j] = curr[i]; - prev[j] = prev[i]; - copy[j] = t; - t._index = j++; - } else reindex[i] = -1; - curr[i] = 0; // clear unused bits - } - data = copy; - return reindex; - }, - size: ()=>data.length, - curr: ()=>curr, - prev: ()=>prev, - reset: (k)=>prev[k] = curr[k], - all: ()=>width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff, - set (k, one) { - curr[k] |= one; - }, - clear (k, one) { - curr[k] &= ~one; - }, - resize (n, m) { - const k = curr.length; - if (n > k || m > width) { - width = Math.max(m, width); - curr = array(n, width, curr); - prev = array(n, width); - } - } - }; -} -function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; -} -function array(n, m, array) { - const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; -} -function Dimension(index, i, query) { - const bit = 1 << i; - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - onAdd (added, curr) { - const dim = this, range = dim.bisect(dim.range, added.value), idx = added.index, lo = range[0], hi = range[1], n1 = idx.length; - let i; - for(i = 0; i < lo; ++i)curr[idx[i]] |= bit; - for(i = hi; i < n1; ++i)curr[idx[i]] |= bit; - return dim; - } - }; -} -/** - * Maintains a list of values, sorted by key. - */ function SortedIndex() { - let index = array32(0), value = [], size = 0; - function insert(key, data, base) { - if (!data.length) return []; - const n0 = size, n1 = data.length, addi = array32(n1); - let addv = Array(n1), oldv, oldi, i; - for(i = 0; i < n1; ++i){ - addv[i] = key(data[i]); - addi[i] = i; - } - addv = sort(addv, addi); - if (n0) { - oldv = value; - oldi = index; - value = Array(n0 + n1); - index = array32(n0 + n1); - merge(base, oldv, oldi, n0, addv, addi, n1, value, index); - } else { - if (base > 0) for(i = 0; i < n1; ++i)addi[i] += base; - value = addv; - index = addi; - } - size = n0 + n1; - return { - index: addi, - value: addv - }; + switch (token.value) { + case "||": + prec = 1; + break; + case "&&": + prec = 2; + break; + case "|": + prec = 3; + break; + case "^": + prec = 4; + break; + case "&": + prec = 5; + break; + case "==": + case "!=": + case "===": + case "!==": + prec = 6; + break; + case "<": + case ">": + case "<=": + case ">=": + case "instanceof": + case "in": + prec = 7; + break; + case "<<": + case ">>": + case ">>>": + prec = 8; + break; + case "+": + case "-": + prec = 9; + break; + case "*": + case "/": + case "%": + prec = 11; + break; } - function remove(num, map) { - // map: index -> remove - const n = size; - let idx, i, j; - // seek forward to first removal - for(i = 0; !map[index[i]] && i < n; ++i); - // condense index and value arrays - for(j = i; i < n; ++i)if (!map[idx = index[i]]) { - index[j] = idx; - value[j] = value[i]; - ++j; - } - size = n - num; - } - function reindex(map) { - for(let i = 0, n = size; i < n; ++i)index[i] = map[index[i]]; - } - function bisect(range, array) { - let n; - if (array) n = array.length; - else { - array = value; - n = size; - } - return [ - (0, _d3Array.bisectLeft)(array, range[0], 0, n), - (0, _d3Array.bisectRight)(array, range[1], 0, n) - ]; + return prec; + } + function parseBinaryExpression() { + var marker, markers, expr2, token, prec, stack, right, operator2, left, i; + marker = lookahead; + left = parseUnaryExpression(); + token = lookahead; + prec = binaryPrecedence(token); + if (prec === 0) { + return left; } - return { - insert: insert, - remove: remove, - bisect: bisect, - reindex: reindex, - index: ()=>index, - size: ()=>size - }; -} -function sort(values, index) { - values.sort.call(index, (a, b)=>{ - const x = values[a], y = values[b]; - return x < y ? -1 : x > y ? 1 : 0; - }); - return (0, _d3Array.permute)(values, index); -} -function merge(base, value0, index0, n0, value1, index1, n1, value, index) { - let i0 = 0, i1 = 0, i; - for(i = 0; i0 < n0 && i1 < n1; ++i)if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - for(; i0 < n0; ++i0, ++i){ - value[i] = value0[i0]; - index[i] = index0[i0]; - } - for(; i1 < n1; ++i1, ++i){ - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } -} -/** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ function CrossFilter(params) { - (0, _vegaDataflow.Transform).call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; -} -CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'query', - 'type': 'array', - 'array': true, - 'required': true, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - } - ] -}; -(0, _vegaUtil.inherits)(CrossFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!this._dims) return this.init(_, pulse); - else { - var init = _.modified('fields') || _.fields.some((f)=>pulse.modified(f.fields)); - return init ? this.reinit(_, pulse) : this.eval(_, pulse); - } - }, - init (_, pulse) { - const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m = query.length; - let i = 0, key, index; - // instantiate indices and dimensions - for(; i < m; ++i){ - key = fields[i].fname; - index = indices[key] || (indices[key] = SortedIndex()); - dims.push(Dimension(index, i, query[i])); - } - return this.eval(_, pulse); - }, - reinit (_, pulse) { - const output = pulse.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output.rem = output.add, mod = output.mod, m = query.length, adds = {}; - let add, index, key, mods, remMap, modMap, i, n, f; - // set prev to current state - prev.set(curr); - // if pulse has remove tuples, process them first - if (pulse.rem.length) remMap = this.remove(_, pulse, output); - // if pulse has added tuples, add them to state - if (pulse.add.length) bits.add(pulse.add); - // if pulse has modified tuples, create an index map - if (pulse.mod.length) { - modMap = {}; - for(mods = pulse.mod, i = 0, n = mods.length; i < n; ++i)modMap[mods[i]._index] = 1; - } - // re-initialize indices as needed, update curr bitmap - for(i = 0; i < m; ++i){ - f = fields[i]; - if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) { - key = f.fname; - if (!(add = adds[key])) { - indices[key] = index = SortedIndex(); - adds[key] = add = index.insert(f, pulse.source, 0); - } - dims[i] = Dimension(index, i, query[i]).onAdd(add, curr); - } - } - // visit each tuple - // if filter state changed, push index to add/rem - // else if in mod and passes a filter, push index to mod - for(i = 0, n = bits.data().length; i < n; ++i){ - if (remMap[i]) continue; - else if (prev[i] !== curr[i]) // add if state changed - out.push(i); - else if (modMap[i] && curr[i] !== all) // otherwise, pass mods through - mod.push(i); - } - bits.mask = (1 << m) - 1; - return output; - }, - eval (_, pulse) { - const output = pulse.materialize().fork(), m = this._dims.length; - let mask = 0; - if (pulse.rem.length) { - this.remove(_, pulse, output); - mask |= (1 << m) - 1; - } - if (_.modified('query') && !_.modified('fields')) mask |= this.update(_, pulse, output); - if (pulse.add.length) { - this.insert(_, pulse, output); - mask |= (1 << m) - 1; - } - if (pulse.mod.length) { - this.modify(pulse, output); - mask |= (1 << m) - 1; - } - this.value.mask = mask; - return output; - }, - insert (_, pulse, output) { - const tuples = pulse.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output.add, n = bits.size() + tuples.length, m = dims.length; - let k = bits.size(), j, key, add; - // resize bitmaps and add tuples as needed - bits.resize(n, m); - bits.add(tuples); - const curr = bits.curr(), prev = bits.prev(), all = bits.all(); - // add to dimensional indices - for(j = 0; j < m; ++j){ - key = fields[j].fname; - add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k)); - dims[j].onAdd(add, curr); - } - // set previous filters, output if passes at least one filter - for(; k < n; ++k){ - prev[k] = all; - if (curr[k] !== all) out.push(k); - } - }, - modify (pulse, output) { - const out = output.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse.mod; - let i, n, k; - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - if (curr[k] !== all) out.push(k); - } - }, - remove (_, pulse, output) { - const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map = {}, out = output.rem, tuples = pulse.rem; - let i, n, k, f; - // process tuples, output if passes at least one filter - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - map[k] = 1; // build index map - prev[k] = f = curr[k]; - curr[k] = all; - if (f !== all) out.push(k); - } - // remove from dimensional indices - for(k in indices)indices[k].remove(n, map); - this.reindex(pulse, n, map); - return map; - }, - // reindex filters and indices after propagation completes - reindex (pulse, num, map) { - const indices = this._indices, bits = this.value; - pulse.runAfter(()=>{ - const indexMap = bits.remove(num, map); - for(const key in indices)indices[key].reindex(indexMap); - }); - }, - update (_, pulse, output) { - const dims = this._dims, query = _.query, stamp = pulse.stamp, m = dims.length; - let mask = 0, i, q; - // survey how many queries have changed - output.filters = 0; - for(q = 0; q < m; ++q)if (_.modified('query', q)) { - i = q; - ++mask; - } - if (mask === 1) { - // only one query changed, use more efficient update - mask = dims[i].one; - this.incrementOne(dims[i], query[i], output.add, output.rem); - } else // multiple queries changed, perform full record keeping - for(q = 0, mask = 0; q < m; ++q){ - if (!_.modified('query', q)) continue; - mask |= dims[q].one; - this.incrementAll(dims[q], query[q], stamp, output.add); - output.rem = output.add; // duplicate add/rem for downstream resolve - } - return mask; - }, - incrementAll (dim, query, stamp, out) { - const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - dim.range = query.slice(); - }, - incrementOne (dim, query, add, rem) { - const bits = this.value, curr = bits.curr(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - dim.range = query.slice(); - } -}); -/** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ function ResolveFilter(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'ignore', - 'type': 'number', - 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' - }, - { - 'name': 'filter', - 'type': 'object', - 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' - } - ] -}; -(0, _vegaUtil.inherits)(ResolveFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, mask = bitmap.mask; - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - const output = pulse.fork(pulse.ALL), data = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k)=>!(curr[k] & ignore) ? data[k] : null; - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - if (!(mask & mask - 1)) { - // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, (k)=>(curr[k] & ignore) === mask ? data[k] : null); - } else { - // multiple filters changed - output.filter(output.ADD, (k)=>{ - const c = curr[k] & ignore, f = !c && c ^ prev[k] & ignore; - return f ? data[k] : null; - }); - output.filter(output.REM, (k)=>{ - const c = curr[k] & ignore, f = c && !(c ^ (c ^ prev[k] & ignore)); - return f ? data[k] : null; - }); - } - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, (t)=>pass(t._index)); - } -}); - -},{"d3-array":"5lCYW","vega-dataflow":"cFRfY","vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"15ELa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "View", ()=>View); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _d3Array = require("d3-array"); -var _vegaFunctions = require("vega-functions"); -var _vegaRuntime = require("vega-runtime"); -var _d3Timer = require("d3-timer"); -var _vegaFormat = require("vega-format"); -// initialize aria role and label attributes -function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } -} -// update aria-label if we have a DOM container element -function ariaLabel(el, desc) { - if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc); -} -function background(view) { - // respond to background signal - view.add(null, (_)=>{ - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { - bg: view._signals.background - }); -} -const Default = 'default'; -function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - // evaluate cursor on each pointermove event - view.on(view.events('view', 'pointermove'), cursor, (_, event)=>{ - const value = cursor.value, user = value ? (0, _vegaUtil.isString)(value) ? value : value.user : Default, item = event.item && event.item.cursor || null; - return value && user === value.user && item == value.item ? value : { - user: user, - item: item - }; - }); - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, item = this.value; - if (!(0, _vegaUtil.isString)(user)) { - item = user.item; - user = user.user; - } - setCursor(view, user && user !== Default ? user : item || user); - return item; - }, { - cursor: cursor - }); -} -function setCursor(view, cursor) { - const el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container(); - if (el) return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor; -} -function dataref(view, name) { - var data = view._runtime.data; - if (!(0, _vegaUtil.hasOwnProperty)(data, name)) (0, _vegaUtil.error)('Unrecognized data set: ' + name); - return data[name]; -} -function data(name, values) { - return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, (0, _vegaDataflow.changeset)().remove((0, _vegaUtil.truthy)).insert(values)); -} -function change(name, changes) { - if (!(0, _vegaDataflow.isChangeSet)(changes)) (0, _vegaUtil.error)('Second argument to changes must be a changeset.'); - const dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); -} -function insert(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().insert(_)); -} -function remove(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().remove(_)); -} -function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); -} -function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); -} -function offset(view) { - var padding = view.padding(), origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; -} -function resizeRenderer(view) { - var origin = offset(view), w = width(view), h = height(view); - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - view._resizeListeners.forEach((handler)=>{ - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); -} -/** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ function eventExtend(view, event, item) { - var r = view._renderer, el = r && r.canvas(), p, e, translate; - if (el) { - translate = offset(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = (0, _vegaScenegraph.point)(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; -} -function extension(view, item, point) { - const itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null; - function group(name) { - var g = itemGroup, i; - if (name) { - for(i = item; i; i = i.mark.group)if (i.mark.name === name) { - g = i; - break; - } - } - return g && g.mark && g.mark.interactive ? g : {}; + token.prec = prec; + lex(); + markers = [marker, lookahead]; + right = parseUnaryExpression(); + stack = [left, token, right]; + while ((prec = binaryPrecedence(lookahead)) > 0) { + while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { + right = stack.pop(); + operator2 = stack.pop().value; + left = stack.pop(); + markers.pop(); + expr2 = finishBinaryExpression(operator2, left, right); + stack.push(expr2); + } + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(lookahead); + expr2 = parseUnaryExpression(); + stack.push(expr2); } - function xy(item) { - if (!item) return point; - if ((0, _vegaUtil.isString)(item)) item = group(item); - const p = point.slice(); - while(item){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; - } - return p; + i = stack.length - 1; + expr2 = stack[i]; + markers.pop(); + while (i > 1) { + markers.pop(); + expr2 = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr2); + i -= 2; } - return { - view: (0, _vegaUtil.constant)(view), - item: (0, _vegaUtil.constant)(item || {}), - group: group, - xy: xy, - x: (item)=>xy(item)[0], - y: (item)=>xy(item)[1] - }; -} -const VIEW = 'view', TIMER = 'timer', WINDOW = 'window', NO_TRAP = { - trap: false -}; -/** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ function initializeEventConfig(config) { - const events = (0, _vegaUtil.extend)({ - defaults: {} - }, config); - const unpack = (obj, keys)=>{ - keys.forEach((k)=>{ - if ((0, _vegaUtil.isArray)(obj[k])) obj[k] = (0, _vegaUtil.toSet)(obj[k]); - }); - }; - unpack(events.defaults, [ - 'prevent', - 'allow' - ]); - unpack(events, [ - 'view', - 'window', - 'selector' - ]); - return events; -} -function trackEventListener(view, sources, type, handler) { - view._eventListeners.push({ - type: type, - sources: (0, _vegaUtil.array)(sources), - handler: handler - }); -} -function prevent(view, type) { - var def = view._eventConfig.defaults, prevent = def.prevent, allow = def.allow; - return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault(); -} -function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - if (rule === false || (0, _vegaUtil.isObject)(rule) && !rule[type]) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; + return expr2; + } + function parseConditionalExpression() { + var expr2, consequent, alternate; + expr2 = parseBinaryExpression(); + if (match("?")) { + lex(); + consequent = parseConditionalExpression(); + expect(":"); + alternate = parseConditionalExpression(); + expr2 = finishConditionalExpression(expr2, consequent, alternate); + } + return expr2; + } + function parseExpression() { + const expr2 = parseConditionalExpression(); + if (match(",")) { + throw new Error(DISABLED); } - return true; -} -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ function events(source, type, filter) { - var view = this, s = new (0, _vegaDataflow.EventStream)(filter), send = function(e, item) { - view.runAsync(null, ()=>{ - if (source === VIEW && prevent(view, type)) e.preventDefault(); - s.receive(eventExtend(view, e, item)); - }); - }, sources; - if (source === TIMER) { - if (permit(view, 'timer', type)) view.timer(send, type); - } else if (source === VIEW) { - if (permit(view, 'view', type)) // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') sources = [ - window - ]; - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) sources = Array.from(document.querySelectorAll(source)); - } - if (!sources) view.warn('Can not resolve event source: ' + source); - else { - for(var i = 0, n = sources.length; i < n; ++i)sources[i].addEventListener(type, send); - trackEventListener(view, sources, type, send); - } - } - return s; -} -function itemFilter(event) { - return event.item; -} -function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; -} -function invoke(name) { - return function(_, event) { - return event.vega.view().changeset().encode(event.item, name); - }; -} -function hover(hoverSet, leaveSet) { - hoverSet = [ - hoverSet || 'hover' - ]; - leaveSet = [ - leaveSet || 'update', - hoverSet[0] - ]; - // invoke hover set upon pointerover - this.on(this.events('view', 'pointerover', itemFilter), markTarget, invoke(hoverSet)); - // invoke leave set upon pointerout - this.on(this.events('view', 'pointerout', itemFilter), markTarget, invoke(leaveSet)); - return this; -} -/** - * Finalize a View instance that is being removed. - * Cancel any running timers. - * Remove all external event listeners. - * Remove any currently displayed tooltip. - */ function finalize() { - var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m, e, h, t; - n = timers.length; - while(--n >= 0)timers[n].stop(); - n = listeners.length; - while(--n >= 0){ - e = listeners[n]; - m = e.sources.length; - while(--m >= 0)e.sources[m].removeEventListener(e.type, e.handler); + return expr2; + } + function parser$1(code) { + source = code; + index = 0; + length = source.length; + lookahead = null; + peek(); + const expr2 = parseExpression(); + if (lookahead.type !== TokenEOF) { + throw new Error("Unexpect token after expression."); } - if (tooltip) tooltip.call(this, this._handler, null, null, null); - // turn off all registered handlers - n = handlers.length; - while(--n >= 0){ - t = handlers[n].type; - h = handlers[n].handler; - this._handler.off(t, h); + return expr2; + } + var Constants = { + NaN: "NaN", + E: "Math.E", + LN2: "Math.LN2", + LN10: "Math.LN10", + LOG2E: "Math.LOG2E", + LOG10E: "Math.LOG10E", + PI: "Math.PI", + SQRT1_2: "Math.SQRT1_2", + SQRT2: "Math.SQRT2", + MIN_VALUE: "Number.MIN_VALUE", + MAX_VALUE: "Number.MAX_VALUE" + }; + function Functions(codegen2) { + function fncall(name, args, cast, type2) { + let obj2 = codegen2(args[0]); + if (cast) { + obj2 = cast + "(" + obj2 + ")"; + if (cast.lastIndexOf("new ", 0) === 0) obj2 = "(" + obj2 + ")"; + } + return obj2 + "." + name + (type2 < 0 ? "" : type2 === 0 ? "()" : "(" + args.slice(1).map(codegen2).join(",") + ")"); } - return this; -} -function element(tag, attr, text) { - const el = document.createElement(tag); - for(const key in attr)el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; -} -const BindClass = 'vega-bind', NameClass = 'vega-bind-name', RadioClass = 'vega-bind-radio'; -/** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ function bind(view, el, binding) { - if (!el) return; - const param = binding.param; - let bind = binding.state; - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: (value)=>{ - if (value != view.signal(param.signal)) view.runAsync(null, ()=>{ - bind.source = true; - view.signal(param.signal, value); - }); - } - }; - if (param.debounce) bind.update = (0, _vegaUtil.debounce)(param.debounce, bind.update); + function fn2(name, cast, type2) { + return (args) => fncall(name, args, cast, type2); } - const create = param.input == null && param.element ? target : generate; - create(bind, el, param, view); - if (!bind.active) { - view.on(view._signals[param.signal], null, ()=>{ - bind.source ? bind.source = false : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - return bind; -} -/** - * Bind the signal to an external EventTarget. - */ function target(bind, node, param, view) { - const type = param.event || 'input'; - const handler = ()=>bind.update(node.value); - // initialize signal value to external input value - view.signal(param.signal, node.value); - // listen for changes on the element - node.addEventListener(type, handler); - // register with view, so we can remove it upon finalization - trackEventListener(view, node, type, handler); - // propagate change to element - bind.set = (value)=>{ - node.value = value; - node.dispatchEvent(event(type)); - }; -} -function event(type) { - return typeof Event !== 'undefined' ? new Event(type) : { - type - }; -} -/** - * Generate an HTML input form element and bind it to a signal. - */ function generate(bind, el, param, view) { - const value = view.signal(param.signal); - const div = element('div', { - 'class': BindClass - }); - const wrapper = param.input === 'radio' ? div : div.appendChild(element('label')); - wrapper.appendChild(element('span', { - 'class': NameClass - }, param.name || param.signal)); - el.appendChild(div); - let input = form; - switch(param.input){ - case 'checkbox': - input = checkbox; - break; - case 'select': - input = select; - break; - case 'radio': - input = radio; - break; - case 'range': - input = range; - break; + const DATE2 = "new Date", STRING = "String", REGEXP = "RegExp"; + return { + // MATH functions + isNaN: "Number.isNaN", + isFinite: "Number.isFinite", + abs: "Math.abs", + acos: "Math.acos", + asin: "Math.asin", + atan: "Math.atan", + atan2: "Math.atan2", + ceil: "Math.ceil", + cos: "Math.cos", + exp: "Math.exp", + floor: "Math.floor", + hypot: "Math.hypot", + log: "Math.log", + max: "Math.max", + min: "Math.min", + pow: "Math.pow", + random: "Math.random", + round: "Math.round", + sin: "Math.sin", + sqrt: "Math.sqrt", + tan: "Math.tan", + clamp: function(args) { + if (args.length < 3) error("Missing arguments to clamp function."); + if (args.length > 3) error("Too many arguments to clamp function."); + const a2 = args.map(codegen2); + return "Math.max(" + a2[1] + ", Math.min(" + a2[2] + "," + a2[0] + "))"; + }, + // DATE functions + now: "Date.now", + utc: "Date.UTC", + datetime: DATE2, + date: fn2("getDate", DATE2, 0), + day: fn2("getDay", DATE2, 0), + year: fn2("getFullYear", DATE2, 0), + month: fn2("getMonth", DATE2, 0), + hours: fn2("getHours", DATE2, 0), + minutes: fn2("getMinutes", DATE2, 0), + seconds: fn2("getSeconds", DATE2, 0), + milliseconds: fn2("getMilliseconds", DATE2, 0), + time: fn2("getTime", DATE2, 0), + timezoneoffset: fn2("getTimezoneOffset", DATE2, 0), + utcdate: fn2("getUTCDate", DATE2, 0), + utcday: fn2("getUTCDay", DATE2, 0), + utcyear: fn2("getUTCFullYear", DATE2, 0), + utcmonth: fn2("getUTCMonth", DATE2, 0), + utchours: fn2("getUTCHours", DATE2, 0), + utcminutes: fn2("getUTCMinutes", DATE2, 0), + utcseconds: fn2("getUTCSeconds", DATE2, 0), + utcmilliseconds: fn2("getUTCMilliseconds", DATE2, 0), + // sequence functions + length: fn2("length", null, -1), + // STRING functions + parseFloat: "parseFloat", + parseInt: "parseInt", + upper: fn2("toUpperCase", STRING, 0), + lower: fn2("toLowerCase", STRING, 0), + substring: fn2("substring", STRING), + split: fn2("split", STRING), + trim: fn2("trim", STRING, 0), + // base64 encode/decode + btoa: "btoa", + atob: "atob", + // REGEXP functions + regexp: REGEXP, + test: fn2("test", REGEXP), + // Control Flow functions + if: function(args) { + if (args.length < 3) error("Missing arguments to if function."); + if (args.length > 3) error("Too many arguments to if function."); + const a2 = args.map(codegen2); + return "(" + a2[0] + "?" + a2[1] + ":" + a2[2] + ")"; + } + }; + } + function stripQuotes(s2) { + const n = s2 && s2.length - 1; + return n && (s2[0] === '"' && s2[n] === '"' || s2[0] === "'" && s2[n] === "'") ? s2.slice(1, -1) : s2; + } + function codegen(opt) { + opt = opt || {}; + const allowed = opt.allowed ? toSet(opt.allowed) : {}, forbidden = opt.forbidden ? toSet(opt.forbidden) : {}, constants2 = opt.constants || Constants, functions = (opt.functions || Functions)(visit2), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = isFunction(globalvar) ? globalvar : (id2) => `${globalvar}["${id2}"]`; + /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + let globals = {}, fields = {}, memberDepth = 0; + function visit2(ast) { + if (isString(ast)) return ast; + const generator = Generators[ast.type]; + if (generator == null) error("Unsupported type: " + ast.type); + return generator(ast); } - input(bind, wrapper, param, value); -} -/** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ function form(bind, el, param, value) { - const node = element('input'); - for(const key in param)if (key !== 'signal' && key !== 'element') node.setAttribute(key === 'input' ? 'type' : key, param[key]); - node.setAttribute('name', param.signal); - node.value = value; - el.appendChild(node); - node.addEventListener('input', ()=>bind.update(node.value)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.value = value; -} -/** - * Generates a checkbox input element. - */ function checkbox(bind, el, param, value) { - const attr = { - type: 'checkbox', - name: param.signal - }; - if (value) attr.checked = true; - const node = element('input', attr); - el.appendChild(node); - node.addEventListener('change', ()=>bind.update(node.checked)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.checked = !!value || null; -} -/** - * Generates a selection list input element. - */ function select(bind, el, param, value) { - const node = element('select', { - name: param.signal - }), labels = param.labels || []; - param.options.forEach((option, i)=>{ - const attr = { - value: option - }; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element('option', attr, (labels[i] || option) + '')); - }); - el.appendChild(node); - node.addEventListener('change', ()=>{ - bind.update(param.options[node.selectedIndex]); - }); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - for(let i = 0, n = param.options.length; i < n; ++i)if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; - return; + const Generators = { + Literal: (n) => n.raw, + Identifier: (n) => { + const id2 = n.name; + if (memberDepth > 0) { + return id2; + } else if (has$1(forbidden, id2)) { + return error("Illegal identifier: " + id2); + } else if (has$1(constants2, id2)) { + return constants2[id2]; + } else if (has$1(allowed, id2)) { + return id2; + } else { + globals[id2] = 1; + return outputGlobal(id2); } - }; -} -/** - * Generates a radio button group. - */ function radio(bind, el, param, value) { - const group = element('span', { - 'class': RadioClass - }), labels = param.labels || []; - el.appendChild(group); - bind.elements = param.options.map((option, i)=>{ - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - const input = element('input', attr); - input.addEventListener('change', ()=>bind.update(option)); - const label = element('label', {}, (labels[i] || option) + ''); - label.prepend(input); - group.appendChild(label); - return input; - }); - bind.set = (value)=>{ - const nodes = bind.elements, n = nodes.length; - for(let i = 0; i < n; ++i)if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - }; -} -/** - * Generates a slider input element. - */ function range(bind, el, param, value) { - value = value !== undefined ? value : (+param.max + +param.min) / 2; - const max = param.max != null ? param.max : Math.max(100, +value) || 100, min = param.min || Math.min(0, max, +value) || 0, step = param.step || (0, _d3Array.tickStep)(min, max, 100); - const node = element('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - const span = element('span', {}, +value); - el.appendChild(node); - el.appendChild(span); - const update = ()=>{ - span.textContent = node.value; - bind.update(+node.value); - }; - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - node.value = value; - span.textContent = value; - }; -} -function valuesEqual(a, b) { - return a === b || a + '' === b + ''; -} -function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); -} -function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); + }, + MemberExpression: (n) => { + const d2 = !n.computed, o = visit2(n.object); + if (d2) memberDepth += 1; + const p = visit2(n.property); + if (o === fieldvar) { + fields[stripQuotes(p)] = 1; + } + if (d2) memberDepth -= 1; + return o + (d2 ? "." + p : "[" + p + "]"); + }, + CallExpression: (n) => { + if (n.callee.type !== "Identifier") { + error("Illegal callee type: " + n.callee.type); } + const callee = n.callee.name, args = n.arguments, fn2 = has$1(functions, callee) && functions[callee]; + if (!fn2) error("Unrecognized function: " + callee); + return isFunction(fn2) ? fn2(args) : fn2 + "(" + args.map(visit2).join(",") + ")"; + }, + ArrayExpression: (n) => "[" + n.elements.map(visit2).join(",") + "]", + BinaryExpression: (n) => "(" + visit2(n.left) + " " + n.operator + " " + visit2(n.right) + ")", + UnaryExpression: (n) => "(" + n.operator + visit2(n.argument) + ")", + ConditionalExpression: (n) => "(" + visit2(n.test) + "?" + visit2(n.consequent) + ":" + visit2(n.alternate) + ")", + LogicalExpression: (n) => "(" + visit2(n.left) + n.operator + visit2(n.right) + ")", + ObjectExpression: (n) => { + for (const prop of n.properties) { + const keyName = prop.key.name; + if (DisallowedObjectProperties.has(keyName)) { + error("Illegal property: " + keyName); + } + } + return "{" + n.properties.map(visit2).join(",") + "}"; + }, + Property: (n) => { + memberDepth += 1; + const k = visit2(n.key); + memberDepth -= 1; + return k + ":" + visit2(n.value); + } }; -} -function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); - // transfer event handlers - if (prevHandler) prevHandler.handlers().forEach((h)=>{ - handler.on(h.type, h.handler); - }); - return handler; -} -function initialize(el, elBind) { - const view = this, type = view._renderType, config = view._eventConfig.bind, module = (0, _vegaScenegraph.renderModule)(type); - // containing dom element - el = view._el = el ? lookup(view, el, true) : null; - // initialize aria attributes - initializeAria(view); - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || (0, _vegaScenegraph.CanvasHandler), Renderer = el ? module.renderer : module.headless; - // initialize renderer and input handler - view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? view._elBind = lookup(view, elBind, true) : el.appendChild(element('form', { - 'class': 'vega-bindings' - })); - view._bind.forEach((_)=>{ - if (_.param.element && config !== 'container') _.element = lookup(view, _.param.element, !!_.param.input); - }); - view._bind.forEach((_)=>{ - bind(view, _.element || elBind, _); - }); + function codegen2(ast) { + const result = { + code: visit2(ast), + globals: Object.keys(globals), + fields: Object.keys(fields) + }; + globals = {}; + fields = {}; + return result; + } + codegen2.functions = functions; + codegen2.constants = constants2; + return codegen2; + } + const SELECTION_GETTER = Symbol("vega_selection_getter"); + function getter(f) { + if (!f.getter || !f.getter[SELECTION_GETTER]) { + f.getter = field$1(f.field); + f.getter[SELECTION_GETTER] = true; } - return view; -} -function lookup(view, el, clear) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; + return f.getter; + } + const Intersect = "intersect"; + const Union = "union"; + const VlMulti = "vlMulti"; + const VlPoint = "vlPoint"; + const Or = "or"; + const And = "and"; + const SelectionId = "_vgsid_"; + const $selectionId = field$1(SelectionId); + const TYPE_ENUM = "E", TYPE_RANGE_INC = "R", TYPE_RANGE_EXC = "R-E", TYPE_RANGE_LE = "R-LE", TYPE_RANGE_RE = "R-RE", TYPE_PRED_LT = "E-LT", TYPE_PRED_LTE = "E-LTE", TYPE_PRED_GT = "E-GT", TYPE_PRED_GTE = "E-GTE", TYPE_PRED_VALID = "E-VALID", TYPE_PRED_ONE_OF = "E-ONE", UNIT_INDEX = "index:unit"; + function testPoint(datum2, entry2) { + var fields = entry2.fields, values2 = entry2.values, n = fields.length, i = 0, dval, f; + for (; i < n; ++i) { + f = fields[i]; + dval = getter(f)(datum2); + if (isDate$1(dval)) dval = toNumber(dval); + if (isDate$1(values2[i])) values2[i] = toNumber(values2[i]); + if (isArray(values2[i]) && isDate$1(values2[i][0])) values2[i] = values2[i].map(toNumber); + if (f.type === TYPE_ENUM) { + if (isArray(values2[i]) ? !values2[i].includes(dval) : dval !== values2[i]) { + return false; + } + } else { + if (f.type === TYPE_RANGE_INC) { + if (!inrange(dval, values2[i])) return false; + } else if (f.type === TYPE_RANGE_RE) { + if (!inrange(dval, values2[i], true, false)) return false; + } else if (f.type === TYPE_RANGE_EXC) { + if (!inrange(dval, values2[i], false, false)) return false; + } else if (f.type === TYPE_RANGE_LE) { + if (!inrange(dval, values2[i], false, true)) return false; + } else if (f.type === TYPE_PRED_LT) { + if (dval >= values2[i]) return false; + } else if (f.type === TYPE_PRED_LTE) { + if (dval > values2[i]) return false; + } else if (f.type === TYPE_PRED_GT) { + if (dval <= values2[i]) return false; + } else if (f.type === TYPE_PRED_GTE) { + if (dval < values2[i]) return false; + } else if (f.type === TYPE_PRED_VALID) { + if (dval === null || isNaN(dval)) return false; + } else if (f.type === TYPE_PRED_ONE_OF) { + if (values2[i].indexOf(dval) === -1) return false; } + } } - if (el && clear) try { - el.textContent = ''; - } catch (e) { - el = null; - view.error(e); - } - return el; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ - }); -function padding(_) { - return (0, _vegaUtil.isObject)(_) ? { - top: number(_.top), - bottom: number(_.bottom), - left: number(_.left), - right: number(_.right) - } : paddingObject(number(_)); -} -/** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ async function renderHeadless(view, type, scaleFactor, opt) { - const module = (0, _vegaScenegraph.renderModule)(type), ctr = module && module.headless; - if (!ctr) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); -} -/** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ async function renderToImageURL(type, scaleFactor) { - if (type !== (0, _vegaScenegraph.RenderType).Canvas && type !== (0, _vegaScenegraph.RenderType).SVG && type !== (0, _vegaScenegraph.RenderType).PNG) (0, _vegaUtil.error)('Unrecognized image type: ' + type); - const r = await renderHeadless(this, type, scaleFactor); - return type === (0, _vegaScenegraph.RenderType).SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png'); -} -function toBlobURL(data, mime) { - const blob = new Blob([ - data - ], { - type: mime - }); - return window.URL.createObjectURL(blob); -} -/** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).Canvas, scaleFactor, opt); - return r.canvas(); -} -/** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).SVG, scaleFactor); - return r.svg(); -} -function runtime(view, spec, expr) { - return (0, _vegaRuntime.context)(view, (0, _vegaDataflow.transforms), (0, _vegaFunctions.functionContext), expr).parse(spec); -} -function scale(name) { - var scales = this._runtime.scales; - if (!(0, _vegaUtil.hasOwnProperty)(scales, name)) (0, _vegaUtil.error)('Unrecognized scale or projection: ' + name); - return scales[name].value; -} -var Width = 'width', Height = 'height', Padding = 'padding', Skip = { - skip: true -}; -function viewWidth(view, width) { - var a = view.autosize(), p = view.padding(); - return width - (a && a.contains === Padding ? p.left + p.right : 0); -} -function viewHeight(view, height) { - var a = view.autosize(), p = view.padding(); - return height - (a && a.contains === Padding ? p.top + p.bottom : 0); -} -function initializeResize(view) { - var s = view._signals, w = s[Width], h = s[Height], p = s[Padding]; - function resetSize() { - view._autosize = view._resize = 1; + return true; + } + function selectionTest(name, datum2, op) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, n = entries.length, i = 0, entry2, miss, count2, unit2, b2; + for (; i < n; ++i) { + entry2 = entries[i]; + if (unitIdx && intersect2) { + miss = miss || {}; + count2 = miss[unit2 = entry2.unit] || 0; + if (count2 === -1) continue; + b2 = testPoint(datum2, entry2); + miss[unit2] = b2 ? -1 : ++count2; + if (b2 && unitIdx.size === 1) return true; + if (!b2 && count2 === unitIdx.get(unit2).count) return false; + } else { + b2 = testPoint(datum2, entry2); + if (intersect2 ^ b2) return b2; + } } - // respond to width signal - view._resizeWidth = view.add(null, (_)=>{ - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, { - size: w - }); - // respond to height signal - view._resizeHeight = view.add(null, (_)=>{ - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, { - size: h - }); - // respond to padding signal - const resizePadding = view.add(null, resetSize, { - pad: p - }); - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; -} -function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter((view)=>{ - let rerun = 0; - // reset autosize flag - view._autosize = 0; - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter((v)=>v.resize()); - }, false, 1); -} -/** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ function getState(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); -} -function dataTest(name, data) { - return data.modified && (0, _vegaUtil.isArray)(data.input.value) && !name.startsWith('_:vega:_'); -} -function signalTest(name, op) { - return !(name === 'parent' || op instanceof (0, _vegaDataflow.transforms).proxy); -} -/** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ function setState(state) { - this.runAsync(null, (v)=>{ - v._trigger = false; - v._runtime.setState(state); - }, (v)=>{ - v._trigger = true; - }); - return this; -} -function timer(callback, delay) { - function tick(elapsed) { - callback({ - timestamp: Date.now(), - elapsed: elapsed - }); + return n && intersect2; + } + const bisect = bisector($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; + function selectionIdTest(name, datum2, op) { + const data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, value2 = $selectionId(datum2), index2 = bisectLeft(entries, value2); + if (index2 === entries.length) return false; + if ($selectionId(entries[index2]) !== value2) return false; + if (unitIdx && intersect2) { + if (unitIdx.size === 1) return true; + if (bisectRight(entries, value2) - index2 < unitIdx.size) return false; } - this._timers.push((0, _d3Timer.interval)(tick, delay)); -} -function defaultTooltip(handler, event, item, value) { - const el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); -} -function formatTooltip(value) { - return value == null ? '' : (0, _vegaUtil.isArray)(value) ? formatArray(value) : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? formatObject(value) : value + ''; -} -function formatObject(obj) { - return Object.keys(obj).map((key)=>{ - const v = obj[key]; - return key + ': ' + ((0, _vegaUtil.isArray)(v) ? formatArray(v) : formatValue(v)); - }).join('\n'); -} -function formatArray(value) { - return '[' + value.map(formatValue).join(', ') + ']'; -} -function formatValue(value) { - return (0, _vegaUtil.isArray)(value) ? '[\u2026]' : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? '{\u2026}' : value; -} -function watchPixelRatio() { - // based on https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes - if (this.renderer() === 'canvas' && this._renderer._canvas) { - let remove = null; - const updatePixelRatio = ()=>{ - if (remove != null) remove(); - const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); - media.addEventListener('change', updatePixelRatio); - remove = ()=>{ - media.removeEventListener('change', updatePixelRatio); - }; - this._renderer._canvas.getContext('2d').pixelRatio = window.devicePixelRatio || 1; - this._redraw = true; - this._resize = 1; - this.resize().runAsync(); - }; - updatePixelRatio(); - } -} -/** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ function View(spec, options) { - const view = this; - options = options || {}; - (0, _vegaDataflow.Dataflow).call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = (0, _vegaUtil.extend)({}, spec.locale, options.locale); - view.locale((0, _vegaFormat.locale)(loc.number, loc.time)); + return true; + } + function selectionTuples(array2, base2) { + if (!isArray(array2)) { + error("First argument to selectionTuples must be an array."); } - view._el = null; - view._elBind = null; - view._renderType = options.renderer || (0, _vegaScenegraph.RenderType).Canvas; - view._scenegraph = new (0, _vegaScenegraph.Scenegraph)(); - const root = view._scenegraph.root; - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip, view._redraw = true; - view._handler = new (0, _vegaScenegraph.CanvasHandler)().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map((_)=>({ - state: null, - param: (0, _vegaUtil.extend)({}, _) - })); - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [ - 0, - 0 - ]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - // initialize background color - background(view); - // initialize cursor - cursor(view); - // initialize view description - view.description(spec.description); - // initialize hover proessing, if requested - if (options.hover) view.hover(); - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); - if (options.watchPixelRatio) view._watchPixelRatio(); -} -function lookupSignal(view, name) { - return (0, _vegaUtil.hasOwnProperty)(view._signals, name) ? view._signals[name] : (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); -} -function findOperatorHandler(op, handler) { - const h = (op._targets || []).filter((op)=>op._update && op._update.handler === handler); - return h.length ? h[0] : null; -} -function addOperatorListener(view, name, op, handler) { - let h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, ()=>handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); + if (!isObject(base2)) { + error("Second argument to selectionTuples must be an object."); } - return view; -} -function removeOperatorListener(view, op, handler) { - const h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; -} -(0, _vegaUtil.inherits)(View, (0, _vegaDataflow.Dataflow), { - // -- DATAFLOW / RENDERING ---- - async evaluate (encode, prerun, postrun) { - // evaluate dataflow and prerun - await (0, _vegaDataflow.Dataflow).prototype.evaluate.call(this, encode, prerun); - // render as needed - if (this._redraw || this._resize) try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - // evaluate postrun - if (postrun) (0, _vegaDataflow.asyncCallback)(this, postrun); - return this; - }, - dirty (item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }, - // -- GET / SET ---- - description (text) { - if (arguments.length) { - const desc = text != null ? text + '' : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; - }, - container () { - return this._el; - }, - scenegraph () { - return this._scenegraph; - }, - origin () { - return this._origin.slice(); - }, - signal (name, value, options) { - const op = lookupSignal(this, name); - return arguments.length === 1 ? op.value : this.update(op, value, options); - }, - width (_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }, - height (_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }, - padding (_) { - return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding')); - }, - autosize (_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }, - background (_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }, - renderer (type) { - if (!arguments.length) return this._renderType; - if (!(0, _vegaScenegraph.renderModule)(type)) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; - }, - tooltip (handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; - }, - loader (loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - (0, _vegaDataflow.Dataflow).prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; - }, - resize () { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); - }, - _resetRenderer () { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }, - // -- SIZING ---- - _resizeView: resizeView, - // -- EVENT HANDLING ---- - addEventListener (type, handler, options) { - let callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; - }, - removeEventListener (type, handler) { - var handlers = this._handler.handlers(type), i = handlers.length, h, t; - // search registered handlers, remove if match found - while(--i >= 0){ - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } + return array2.map((x2) => extend(base2.fields ? { + values: base2.fields.map((f) => getter(f)(x2.datum)) + } : { + [SelectionId]: $selectionId(x2.datum) + }, base2)); + } + function selectionResolve(name, op, isMulti, vl5) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], resolved = {}, multiRes = {}, types2 = {}, entry2, fields, values2, unit2, field2, value2, res, resUnit, type2, union2, n = entries.length, i = 0, j, m2; + for (; i < n; ++i) { + entry2 = entries[i]; + unit2 = entry2.unit; + fields = entry2.fields; + values2 = entry2.values; + if (fields && values2) { + for (j = 0, m2 = fields.length; j < m2; ++j) { + field2 = fields[j]; + res = resolved[field2.field] || (resolved[field2.field] = {}); + resUnit = res[unit2] || (res[unit2] = []); + types2[field2.field] = type2 = field2.type.charAt(0); + union2 = ops[`${type2}_union`]; + res[unit2] = union2(resUnit, array$4(values2[j])); + } + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push(array$4(values2).reduce((obj2, curr, j2) => (obj2[fields[j2].field] = curr, obj2), {})); + } + } else { + field2 = SelectionId; + value2 = $selectionId(entry2); + res = resolved[field2] || (resolved[field2] = {}); + resUnit = res[unit2] || (res[unit2] = []); + resUnit.push(value2); + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push({ + [SelectionId]: value2 + }); } - return this; - }, - addResizeListener (handler) { - const l = this._resizeListeners; - if (!l.includes(handler)) // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - return this; - }, - removeResizeListener (handler) { - var l = this._resizeListeners, i = l.indexOf(handler); - if (i >= 0) l.splice(i, 1); - return this; - }, - addSignalListener (name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }, - removeSignalListener (name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }, - addDataListener (name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }, - removeDataListener (name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); + } + } + op = op || Union; + if (resolved[SelectionId]) { + resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); + } else { + Object.keys(resolved).forEach((field3) => { + resolved[field3] = Object.keys(resolved[field3]).map((unit3) => resolved[field3][unit3]).reduce((acc, curr) => acc === void 0 ? curr : ops[`${types2[field3]}_${op}`](acc, curr)); + }); + } + entries = Object.keys(multiRes); + if (isMulti && entries.length) { + const key2 = vl5 ? VlPoint : VlMulti; + resolved[key2] = op === Union ? { + [Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), []) + } : { + [And]: entries.map((k) => ({ + [Or]: multiRes[k] + })) + }; + } + return resolved; + } + var ops = { + [`${SelectionId}_union`]: union, + [`${SelectionId}_intersect`]: intersection, + E_union: function(base2, value2) { + if (!base2.length) return value2; + var i = 0, n = value2.length; + for (; i < n; ++i) if (!base2.includes(value2[i])) base2.push(value2[i]); + return base2; }, - globalCursor (_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else return this._globalCursor; + E_intersect: function(base2, value2) { + return !base2.length ? value2 : base2.filter((v) => value2.includes(v)); }, - preventDefault (_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else return this._preventDefault; + R_union: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (base2[0] > lo) base2[0] = lo; + if (base2[1] < hi) base2[1] = hi; + return base2; }, - timer, - events, - finalize, - hover, - // -- DATA ---- - data, - change, - insert, - remove, - // -- SCALES -- - scale, - // -- INITIALIZATION ---- - initialize, - // -- HEADLESS RENDERING ---- - toImageURL: renderToImageURL, - toCanvas: renderToCanvas, - toSVG: renderToSVG, - // -- SAVE / RESTORE STATE ---- - getState, - setState, - // RE-RENDER ON ZOOM - _watchPixelRatio: watchPixelRatio -}); - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","vega-scenegraph":"gJqm6","d3-array":"5lCYW","vega-functions":"6VJ1U","vega-runtime":"boQgz","d3-timer":"832oa","vega-format":"3VXXV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6VJ1U":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataPrefix", ()=>DataPrefix); -parcelHelpers.export(exports, "IndexPrefix", ()=>IndexPrefix); -parcelHelpers.export(exports, "ScalePrefix", ()=>ScalePrefix); -parcelHelpers.export(exports, "SignalPrefix", ()=>SignalPrefix); -parcelHelpers.export(exports, "bandspace", ()=>bandspace); -parcelHelpers.export(exports, "bandwidth", ()=>bandwidth); -parcelHelpers.export(exports, "codeGenerator", ()=>codeGenerator); -parcelHelpers.export(exports, "codegenParams", ()=>codegenParams); -parcelHelpers.export(exports, "containerSize", ()=>containerSize); -parcelHelpers.export(exports, "contrast", ()=>contrast); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "data", ()=>data); -parcelHelpers.export(exports, "dataVisitor", ()=>dataVisitor); -parcelHelpers.export(exports, "dayAbbrevFormat", ()=>dayAbbrevFormat); -parcelHelpers.export(exports, "dayFormat", ()=>dayFormat); -parcelHelpers.export(exports, "debug", ()=>debug); -parcelHelpers.export(exports, "domain", ()=>domain); -parcelHelpers.export(exports, "encode", ()=>encode); -parcelHelpers.export(exports, "expressionFunction", ()=>expressionFunction); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "functionContext", ()=>functionContext); -parcelHelpers.export(exports, "geoArea", ()=>geoArea); -parcelHelpers.export(exports, "geoBounds", ()=>geoBounds); -parcelHelpers.export(exports, "geoCentroid", ()=>geoCentroid); -parcelHelpers.export(exports, "geoScale", ()=>geoScale); -parcelHelpers.export(exports, "geoShape", ()=>geoShape); -parcelHelpers.export(exports, "inScope", ()=>inScope); -parcelHelpers.export(exports, "indata", ()=>indata); -parcelHelpers.export(exports, "indataVisitor", ()=>indataVisitor); -parcelHelpers.export(exports, "indexof", ()=>indexof); -parcelHelpers.export(exports, "info", ()=>info); -parcelHelpers.export(exports, "invert", ()=>invert); -parcelHelpers.export(exports, "join", ()=>join); -parcelHelpers.export(exports, "lastindexof", ()=>lastindexof); -parcelHelpers.export(exports, "luminance", ()=>luminance); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "modify", ()=>modify); -parcelHelpers.export(exports, "monthAbbrevFormat", ()=>monthAbbrevFormat); -parcelHelpers.export(exports, "monthFormat", ()=>monthFormat); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -parcelHelpers.export(exports, "pathShape", ()=>pathShape); -parcelHelpers.export(exports, "pinchAngle", ()=>pinchAngle); -parcelHelpers.export(exports, "pinchDistance", ()=>pinchDistance); -parcelHelpers.export(exports, "pluck", ()=>pluck); -parcelHelpers.export(exports, "range", ()=>range); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "reverse", ()=>reverse); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleGradient", ()=>scaleGradient); -parcelHelpers.export(exports, "scaleVisitor", ()=>scaleVisitor); -parcelHelpers.export(exports, "screen", ()=>screen); -parcelHelpers.export(exports, "setdata", ()=>setdata); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "sort", ()=>sort); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "treeAncestors", ()=>treeAncestors); -parcelHelpers.export(exports, "treePath", ()=>treePath); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "warn", ()=>warn); -parcelHelpers.export(exports, "windowSize", ()=>windowSize); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -var _vegaScale = require("vega-scale"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaSelections = require("vega-selections"); -var _vegaStatistics = require("vega-statistics"); -var _vegaTime = require("vega-time"); -var _d3Array = require("d3-array"); -function data(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; -} -function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; -} -function setdata(name, tuples) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input; - df.pulse(input, df.changeset().remove((0, _vegaUtil.truthy)).insert(tuples)); + R_intersect: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (hi < base2[0] || base2[1] < lo) { + return []; + } else { + if (base2[0] < lo) base2[0] = lo; + if (base2[1] > hi) base2[1] = hi; + } + return base2; + } + }; + const DataPrefix$1 = ":", IndexPrefix$1 = "@"; + function selectionVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to selection functions must be a string literal."); + const data2 = args[0].value, op = args.length >= 2 && peek$1(args).value, field2 = "unit", indexName = IndexPrefix$1 + field2, dataName = DataPrefix$1 + data2; + if (op === Intersect && !has$1(params2, indexName)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); + } + if (!has$1(params2, dataName)) { + params2[dataName] = scope.getData(data2).tuplesRef(); + } + } + function data$1(name) { + const data2 = this.context.data[name]; + return data2 ? data2.values.value : []; + } + function indata(name, field2, value2) { + const index2 = this.context.data[name]["index:" + field2], entry2 = index2 ? index2.value.get(value2) : void 0; + return entry2 ? entry2.count : entry2; + } + function setdata(name, tuples) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input; + df.pulse(input, df.changeset().remove(truthy).insert(tuples)); return 1; -} -function encode(item, name, retval) { + } + function encode(item, name, retval) { if (item) { - const df = this.context.dataflow, target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; -} -const wrap = (method)=>function(value, spec) { - const locale = this.context.dataflow.locale(); - return value === null ? 'null' : locale[method](spec)(value); - }; -const format = wrap('format'); -const timeFormat = wrap('timeFormat'); -const utcFormat = wrap('utcFormat'); -const timeParse = wrap('timeParse'); -const utcParse = wrap('utcParse'); -const dateObj = new Date(2000, 0, 1); -function time(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); + const df = this.context.dataflow, target2 = item.mark.source; + df.pulse(target2, df.changeset().encode(item, name)); + } + return retval !== void 0 ? retval : item; + } + const wrap = (method2) => function(value2, spec) { + const locale2 = this.context.dataflow.locale(); + return value2 === null ? "null" : locale2[method2](spec)(value2); + }; + const format = wrap("format"); + const timeFormat = wrap("timeFormat"); + const utcFormat = wrap("utcFormat"); + const timeParse = wrap("timeParse"); + const utcParse = wrap("utcParse"); + const dateObj = new Date(2e3, 0, 1); + function time(month, day, specifier) { + if (!Number.isInteger(month) || !Number.isInteger(day)) return ""; + dateObj.setYear(2e3); dateObj.setMonth(month); dateObj.setDate(day); return timeFormat.call(this, dateObj, specifier); -} -function monthFormat(month) { - return time.call(this, month, 1, '%B'); -} -function monthAbbrevFormat(month) { - return time.call(this, month, 1, '%b'); -} -function dayFormat(day) { - return time.call(this, 0, 2 + day, '%A'); -} -function dayAbbrevFormat(day) { - return time.call(this, 0, 2 + day, '%a'); -} -const DataPrefix = ':'; -const IndexPrefix = '@'; -const ScalePrefix = '%'; -const SignalPrefix = '$'; -function dataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to data functions must be a string literal.'); - const data = args[0].value, dataName = DataPrefix + data; - if (!(0, _vegaUtil.hasOwnProperty)(dataName, params)) try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } -} -function indataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to indata must be a string literal.'); - if (args[1].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('Second argument to indata must be a string literal.'); - const data = args[0].value, field = args[1].value, indexName = IndexPrefix + field; - if (!(0, _vegaUtil.hasOwnProperty)(indexName, params)) params[indexName] = scope.getData(data).indataRef(scope, field); -} -function scaleVisitor(name, args, scope, params) { - if (args[0].type === (0, _vegaExpression.Literal)) // add scale dependency - addScaleDependency(scope, params, args[0].value); - else // indirect scale lookup; add all scales as parameters - for(name in scope.scales)addScaleDependency(scope, params, name); -} -function addScaleDependency(scope, params, name) { + } + function monthFormat(month) { + return time.call(this, month, 1, "%B"); + } + function monthAbbrevFormat(month) { + return time.call(this, month, 1, "%b"); + } + function dayFormat(day) { + return time.call(this, 0, 2 + day, "%A"); + } + function dayAbbrevFormat(day) { + return time.call(this, 0, 2 + day, "%a"); + } + const DataPrefix = ":"; + const IndexPrefix = "@"; + const ScalePrefix = "%"; + const SignalPrefix = "$"; + function dataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) { + error("First argument to data functions must be a string literal."); + } + const data2 = args[0].value, dataName = DataPrefix + data2; + if (!has$1(dataName, params2)) { + try { + params2[dataName] = scope.getData(data2).tuplesRef(); + } catch (err) { + } + } + } + function indataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to indata must be a string literal."); + if (args[1].type !== Literal) error("Second argument to indata must be a string literal."); + const data2 = args[0].value, field2 = args[1].value, indexName = IndexPrefix + field2; + if (!has$1(indexName, params2)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); + } + } + function scaleVisitor(name, args, scope, params2) { + if (args[0].type === Literal) { + addScaleDependency(scope, params2, args[0].value); + } else { + for (name in scope.scales) { + addScaleDependency(scope, params2, name); + } + } + } + function addScaleDependency(scope, params2, name) { const scaleName = ScalePrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, scaleName)) try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } -} -/** - * Name must be a string. Return undefined if the scale is not registered. - */ function getScale(name, ctx) { - if ((0, _vegaUtil.isString)(name)) { - const maybeScale = ctx.scales[name]; - return maybeScale && (0, _vegaScale.isRegisteredScale)(maybeScale.value) ? maybeScale.value : undefined; - } - return undefined; -} -function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = (s)=>s && s.bandwidth ? s.bandwidth() : 0; - // register AST visitors for internal scale functions + if (!has$1(params2, scaleName)) { + try { + params2[scaleName] = scope.scaleRef(name); + } catch (err) { + } + } + } + function getScale(nameOrFunction, ctx) { + if (isString(nameOrFunction)) { + const maybeScale = ctx.scales[nameOrFunction]; + return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : void 0; + } else if (isFunction(nameOrFunction)) { + return isRegisteredScale(nameOrFunction) ? nameOrFunction : void 0; + } + return void 0; + } + function internalScaleFunctions(codegen2, fnctx, visitors) { + fnctx.__bandwidth = (s2) => s2 && s2.bandwidth ? s2.bandwidth() : 0; visitors._bandwidth = scaleVisitor; visitors._range = scaleVisitor; visitors._scale = scaleVisitor; - // resolve scale reference directly to the signal hash argument - const ref = (arg)=>'_[' + (arg.type === (0, _vegaExpression.Literal) ? (0, _vegaUtil.stringValue)(ScalePrefix + arg.value) : (0, _vegaUtil.stringValue)(ScalePrefix) + '+' + codegen(arg)) + ']'; - // define and return internal scale function code generators - // these internal functions are called by mark encoders + const ref2 = (arg) => "_[" + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + "+" + codegen2(arg)) + "]"; return { - _bandwidth: (args)=>`this.__bandwidth(${ref(args[0])})`, - _range: (args)=>`${ref(args[0])}.range()`, - _scale: (args)=>`${ref(args[0])}(${codegen(args[1])})` - }; -} -function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else // projection undefined, use global method + _bandwidth: (args) => `this.__bandwidth(${ref2(args[0])})`, + _range: (args) => `${ref2(args[0])}.range()`, + _scale: (args) => `${ref2(args[0])}(${codegen2(args[1])})` + }; + } + function geoMethod(methodName, globalMethod) { + return function(projection2, geojson, group2) { + if (projection2) { + const p = getScale(projection2, (group2 || this).context); + return p && p.path[methodName](geojson); + } else { return globalMethod(geojson); + } }; -} -const geoArea = geoMethod('area', (0, _d3Geo.geoArea)); -const geoBounds = geoMethod('bounds', (0, _d3Geo.geoBounds)); -const geoCentroid = geoMethod('centroid', (0, _d3Geo.geoCentroid)); -function geoScale(projection, group) { - const p = getScale(projection, (group || this).context); + } + const geoArea = geoMethod("area", geoArea$1); + const geoBounds = geoMethod("bounds", geoBounds$1); + const geoCentroid = geoMethod("centroid", geoCentroid$1); + function geoScale(projection2, group2) { + const p = getScale(projection2, (group2 || this).context); return p && p.scale(); -} -function inScope(item) { - const group = this.context.group; - let value = false; - if (group) while(item){ - if (item === group) { - value = true; - break; - } - item = item.mark.group; + } + function inScope(item) { + const group2 = this.context.group; + let value2 = false; + if (group2) while (item) { + if (item === group2) { + value2 = true; + break; + } + item = item.mark.group; } - return value; -} -function log(df, method, args) { + return value2; + } + function log(df, method2, args) { try { - df[method].apply(df, [ - 'EXPRESSION' - ].concat([].slice.call(args))); + df[method2].apply(df, ["EXPRESSION"].concat([].slice.call(args))); } catch (err) { - df.warn(err); + df.warn(err); } return args[args.length - 1]; -} -function warn() { - return log(this.context.dataflow, 'warn', arguments); -} -function info() { - return log(this.context.dataflow, 'info', arguments); -} -function debug() { - return log(this.context.dataflow, 'debug', arguments); -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef -function channel_luminance_value(channelValue) { + } + function warn() { + return log(this.context.dataflow, "warn", arguments); + } + function info() { + return log(this.context.dataflow, "info", arguments); + } + function debug() { + return log(this.context.dataflow, "debug", arguments); + } + function channel_luminance_value(channelValue) { const val = channelValue / 255; - if (val <= 0.03928) return val / 12.92; + if (val <= 0.03928) { + return val / 12.92; + } return Math.pow((val + 0.055) / 1.055, 2.4); -} -function luminance(color) { - const c = (0, _d3Color.rgb)(color), r = channel_luminance_value(c.r), g = channel_luminance_value(c.g), b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef -function contrast(color1, color2) { + } + function luminance(color2) { + const c2 = rgb$1(color2), r = channel_luminance_value(c2.r), g = channel_luminance_value(c2.g), b2 = channel_luminance_value(c2.b); + return 0.2126 * r + 0.7152 * g + 0.0722 * b2; + } + function contrast(color1, color2) { const lum1 = luminance(color1), lum2 = luminance(color2), lumL = Math.max(lum1, lum2), lumD = Math.min(lum1, lum2); return (lumL + 0.05) / (lumD + 0.05); -} -function merge() { + } + function merge() { const args = [].slice.call(arguments); args.unshift({}); - return (0, _vegaUtil.extend)(...args); -} -function equal(a, b) { - return a === b || a !== a && b !== b ? true : (0, _vegaUtil.isArray)(a) ? (0, _vegaUtil.isArray)(b) && a.length === b.length ? equalArray(a, b) : false : (0, _vegaUtil.isObject)(a) && (0, _vegaUtil.isObject)(b) ? equalObject(a, b) : false; -} -function equalArray(a, b) { - for(let i = 0, n = a.length; i < n; ++i){ - if (!equal(a[i], b[i])) return false; + return extend(...args); + } + function equal(a2, b2) { + return a2 === b2 || a2 !== a2 && b2 !== b2 ? true : isArray(a2) ? isArray(b2) && a2.length === b2.length ? equalArray(a2, b2) : false : isObject(a2) && isObject(b2) ? equalObject(a2, b2) : false; + } + function equalArray(a2, b2) { + for (let i = 0, n = a2.length; i < n; ++i) { + if (!equal(a2[i], b2[i])) return false; + } + return true; + } + function equalObject(a2, b2) { + for (const key2 in a2) { + if (!equal(a2[key2], b2[key2])) return false; } return true; -} -function equalObject(a, b) { - for(const key in a){ - if (!equal(a[key], b[key])) return false; + } + function removePredicate(props) { + return (_) => equalObject(props, _); + } + function modify(name, insert2, remove2, toggle, modify2, values2) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input, stamp = df.stamp(); + let changes = data2.changes, predicate, key2; + if (df._trigger === false || !(input.value.length || insert2 || toggle)) { + return 0; + } + if (!changes || changes.stamp < stamp) { + data2.changes = changes = df.changeset(); + changes.stamp = stamp; + df.runAfter(() => { + data2.modified = true; + df.pulse(input, changes).run(); + }, true, 1); + } + if (remove2) { + predicate = remove2 === true ? truthy : isArray(remove2) || isTuple(remove2) ? remove2 : removePredicate(remove2); + changes.remove(predicate); + } + if (insert2) { + changes.insert(insert2); + } + if (toggle) { + predicate = removePredicate(toggle); + if (input.value.some(predicate)) { + changes.remove(predicate); + } else { + changes.insert(toggle); + } + } + if (modify2) { + for (key2 in values2) { + changes.modify(modify2, key2, values2[key2]); + } + } + return 1; + } + function pinchDistance(event2) { + const t = event2.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; + return Math.hypot(dx, dy); + } + function pinchAngle(event2) { + const t = event2.touches; + return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); + } + const accessors = {}; + function pluck(data2, name) { + const accessor2 = accessors[name] || (accessors[name] = field$1(name)); + return isArray(data2) ? data2.map(accessor2) : accessor2(data2); + } + function array(seq) { + return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null; + } + function sequence(seq) { + return array(seq) || (isString(seq) ? seq : null); + } + function join(seq, ...args) { + return array(seq).join(...args); + } + function indexof(seq, ...args) { + return sequence(seq).indexOf(...args); + } + function lastindexof(seq, ...args) { + return sequence(seq).lastIndexOf(...args); + } + function slice(seq, ...args) { + return sequence(seq).slice(...args); + } + function replace(str, pattern, repl) { + if (isFunction(repl)) error("Function argument passed to replace."); + if (!isString(pattern) && !isRegExp(pattern)) error("Please pass a string or RegExp argument to replace."); + return String(str).replace(pattern, repl); + } + function reverse(seq) { + return array(seq).slice().reverse(); + } + function sort(seq) { + return array(seq).slice().sort(ascending$1); + } + function bandspace(count2, paddingInner, paddingOuter) { + return bandSpace(count2 || 0, paddingInner || 0, paddingOuter || 0); + } + function bandwidth(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 && s2.bandwidth ? s2.bandwidth() : 0; + } + function copy(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 ? s2.copy() : void 0; + } + function domain(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 ? s2.domain() : []; + } + function invert(name, range2, group2) { + const s2 = getScale(name, (group2 || this).context); + return !s2 ? void 0 : isArray(range2) ? (s2.invertRange || s2.invert)(range2) : (s2.invert || s2.invertExtent)(range2); + } + function range$1(name, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 && s2.range ? s2.range() : []; + } + function scale$2(name, value2, group2) { + const s2 = getScale(name, (group2 || this).context); + return s2 ? s2(value2) : void 0; + } + function scaleGradient(scale2, p02, p1, count2, group2) { + scale2 = getScale(scale2, (group2 || this).context); + const gradient2 = Gradient$1(p02, p1); + let stops = scale2.domain(), min2 = stops[0], max2 = peek$1(stops), fraction = identity$2; + if (!(max2 - min2)) { + scale2 = (scale2.interpolator ? scale$4("sequential")().interpolator(scale2.interpolator()) : scale$4("linear")().interpolate(scale2.interpolate()).range(scale2.range())).domain([min2 = 0, max2 = 1]); + } else { + fraction = scaleFraction(scale2, min2, max2); + } + if (scale2.ticks) { + stops = scale2.ticks(+count2 || 15); + if (min2 !== stops[0]) stops.unshift(min2); + if (max2 !== peek$1(stops)) stops.push(max2); + } + stops.forEach((_) => gradient2.stop(fraction(_), scale2(_))); + return gradient2; + } + function geoShape(projection2, geojson, group2) { + const p = getScale(projection2, (group2 || this).context); + return function(context2) { + return p ? p.path.context(context2)(geojson) : ""; + }; + } + function pathShape(path2) { + let p = null; + return function(context2) { + return context2 ? pathRender(context2, p = p || parse$3(path2)) : path2; + }; + } + const datum = (d2) => d2.data; + function treeNodes(name, context2) { + const tree2 = data$1.call(context2, name); + return tree2.root && tree2.root.lookup || {}; + } + function treePath(name, source2, target2) { + const nodes = treeNodes(name, this), s2 = nodes[source2], t = nodes[target2]; + return s2 && t ? s2.path(t).map(datum) : void 0; + } + function treeAncestors(name, node) { + const n = treeNodes(name, this)[node]; + return n ? n.ancestors().map(datum) : void 0; + } + const _window = () => typeof window !== "undefined" && window || null; + function screen() { + const w2 = _window(); + return w2 ? w2.screen : {}; + } + function windowSize() { + const w2 = _window(); + return w2 ? [w2.innerWidth, w2.innerHeight] : [void 0, void 0]; + } + function containerSize() { + const view = this.context.dataflow, el = view.container && view.container(); + return el ? [el.clientWidth, el.clientHeight] : [void 0, void 0]; + } + function intersect(b2, opt, group2) { + if (!b2) return []; + const [u2, v] = b2, box2 = new Bounds().set(u2[0], u2[1], v[0], v[1]), scene = group2 || this.context.dataflow.scenegraph().root; + return intersect$2(scene, box2, filter(opt)); + } + function filter(opt) { + let p = null; + if (opt) { + const types2 = array$4(opt.marktype), names = array$4(opt.markname); + p = (_) => (!types2.length || types2.some((t) => _.marktype === t)) && (!names.length || names.some((s2) => _.name === s2)); + } + return p; + } + function lassoAppend(lasso, x2, y2, minDist = 5) { + lasso = array$4(lasso); + const last = lasso[lasso.length - 1]; + return last === void 0 || Math.hypot(last[0] - x2, last[1] - y2) > minDist ? [...lasso, [x2, y2]] : lasso; + } + function lassoPath(lasso) { + return array$4(lasso).reduce((svg, [x2, y2], i) => { + return svg += i == 0 ? `M ${x2},${y2} ` : i === lasso.length - 1 ? " Z" : `L ${x2},${y2} `; + }, ""); + } + function intersectLasso(markname, pixelLasso, unit2) { + const { + x: x2, + y: y2, + mark + } = unit2; + const bb = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); + for (const [px2, py2] of pixelLasso) { + if (px2 < bb.x1) bb.x1 = px2; + if (px2 > bb.x2) bb.x2 = px2; + if (py2 < bb.y1) bb.y1 = py2; + if (py2 > bb.y2) bb.y2 = py2; + } + bb.translate(x2, y2); + const intersection2 = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark); + return intersection2.filter((tuple) => pointInPolygon(tuple.x, tuple.y, pixelLasso)); + } + function pointInPolygon(testx, testy, polygon) { + let intersections = 0; + for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { + const [prevX, prevY] = polygon[j]; + const [x2, y2] = polygon[i]; + if (y2 > testy != prevY > testy && testx < (prevX - x2) * (testy - y2) / (prevY - y2) + x2) { + intersections++; + } + } + return intersections & 1; + } + const functionContext = { + random() { + return random(); + }, + // override default + cumulativeNormal, + cumulativeLogNormal, + cumulativeUniform, + densityNormal, + densityLogNormal, + densityUniform, + quantileNormal, + quantileLogNormal, + quantileUniform, + sampleNormal, + sampleLogNormal, + sampleUniform, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isDefined(_) { + return _ !== void 0; + }, + isNumber: isNumber$1, + isObject, + isRegExp, + isString, + isTuple, + isValid(_) { + return _ != null && _ === _; + }, + toBoolean, + toDate(_) { + return toDate(_); + }, + // suppress extra arguments + toNumber, + toString, + indexof, + join, + lastindexof, + replace, + reverse, + sort, + slice, + flush, + lerp, + merge, + pad: pad$1, + peek: peek$1, + pluck, + span, + inrange, + truncate: truncate$1, + rgb: rgb$1, + lab: lab$1, + hcl: hcl$1, + hsl: hsl$1, + luminance, + contrast, + sequence: range$3, + format, + utcFormat, + utcParse, + utcOffset, + utcSequence, + timeFormat, + timeParse, + timeOffset, + timeSequence, + timeUnitSpecifier, + monthFormat, + monthAbbrevFormat, + dayFormat, + dayAbbrevFormat, + quarter, + utcquarter, + week, + utcweek, + dayofyear, + utcdayofyear, + warn, + info, + debug, + extent(_) { + return extent(_); + }, + // suppress extra arguments + inScope, + intersect, + clampRange, + pinchDistance, + pinchAngle, + screen, + containerSize, + windowSize, + bandspace, + setdata, + pathShape, + panLinear, + panLog, + panPow, + panSymlog, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog, + encode, + modify, + lassoAppend, + lassoPath, + intersectLasso + }; + const eventFunctions = ["view", "item", "group", "xy", "x", "y"], eventPrefix = "event.vega.", thisPrefix = "this.", astVisitors = {}; + const codegenParams = { + forbidden: ["_"], + allowed: ["datum", "event", "item"], + fieldvar: "datum", + globalvar: (id2) => `_[${$(SignalPrefix + id2)}]`, + functions: buildFunctions, + constants: Constants, + visitors: astVisitors + }; + const codeGenerator = codegen(codegenParams); + function buildFunctions(codegen2) { + const fn2 = Functions(codegen2); + eventFunctions.forEach((name) => fn2[name] = eventPrefix + name); + for (const name in functionContext) { + fn2[name] = thisPrefix + name; + } + extend(fn2, internalScaleFunctions(codegen2, functionContext, astVisitors)); + return fn2; + } + function expressionFunction(name, fn2, visitor) { + if (arguments.length === 1) { + return functionContext[name]; + } + functionContext[name] = fn2; + if (visitor) astVisitors[name] = visitor; + if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; + return this; + } + expressionFunction("bandwidth", bandwidth, scaleVisitor); + expressionFunction("copy", copy, scaleVisitor); + expressionFunction("domain", domain, scaleVisitor); + expressionFunction("range", range$1, scaleVisitor); + expressionFunction("invert", invert, scaleVisitor); + expressionFunction("scale", scale$2, scaleVisitor); + expressionFunction("gradient", scaleGradient, scaleVisitor); + expressionFunction("geoArea", geoArea, scaleVisitor); + expressionFunction("geoBounds", geoBounds, scaleVisitor); + expressionFunction("geoCentroid", geoCentroid, scaleVisitor); + expressionFunction("geoShape", geoShape, scaleVisitor); + expressionFunction("geoScale", geoScale, scaleVisitor); + expressionFunction("indata", indata, indataVisitor); + expressionFunction("data", data$1, dataVisitor); + expressionFunction("treePath", treePath, dataVisitor); + expressionFunction("treeAncestors", treeAncestors, dataVisitor); + expressionFunction("vlSelectionTest", selectionTest, selectionVisitor); + expressionFunction("vlSelectionIdTest", selectionIdTest, selectionVisitor); + expressionFunction("vlSelectionResolve", selectionResolve, selectionVisitor); + expressionFunction("vlSelectionTuples", selectionTuples); + function parser(expr2, scope) { + const params2 = {}; + let ast; + try { + expr2 = isString(expr2) ? expr2 : $(expr2) + ""; + ast = parser$1(expr2); + } catch (err) { + error("Expression parse error: " + expr2); + } + ast.visit((node) => { + if (node.type !== CallExpression) return; + const name = node.callee.name, visit2 = codegenParams.visitors[name]; + if (visit2) visit2(name, node.arguments, scope, params2); + }); + const gen = codeGenerator(ast); + gen.globals.forEach((name) => { + const signalName = SignalPrefix + name; + if (!has$1(params2, signalName) && scope.getSignal(name)) { + params2[signalName] = scope.signalRef(name); + } + }); + return { + $expr: extend({ + code: gen.code + }, scope.options.ast ? { + ast + } : null), + $fields: gen.fields, + $params: params2 + }; + } + function parse$2(spec) { + const ctx = this, operators = spec.operators || []; + if (spec.background) { + ctx.background = spec.background; + } + if (spec.eventConfig) { + ctx.eventConfig = spec.eventConfig; + } + if (spec.locale) { + ctx.locale = spec.locale; + } + operators.forEach((entry2) => ctx.parseOperator(entry2)); + operators.forEach((entry2) => ctx.parseOperatorParameters(entry2)); + (spec.streams || []).forEach((entry2) => ctx.parseStream(entry2)); + (spec.updates || []).forEach((entry2) => ctx.parseUpdate(entry2)); + return ctx.resolve(); + } + const Skip$2 = toSet(["rule"]), Swap = toSet(["group", "image", "rect"]); + function adjustSpatial(encode2, marktype) { + let code = ""; + if (Skip$2[marktype]) return code; + if (encode2.x2) { + if (encode2.x) { + if (Swap[marktype]) { + code += "if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"; + } + code += "o.width=o.x2-o.x;"; + } else { + code += "o.x=o.x2-(o.width||0);"; + } + } + if (encode2.xc) { + code += "o.x=o.xc-(o.width||0)/2;"; + } + if (encode2.y2) { + if (encode2.y) { + if (Swap[marktype]) { + code += "if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"; + } + code += "o.height=o.y2-o.y;"; + } else { + code += "o.y=o.y2-(o.height||0);"; + } + } + if (encode2.yc) { + code += "o.y=o.yc-(o.height||0)/2;"; + } + return code; + } + function canonicalType(type2) { + return (type2 + "").toLowerCase(); + } + function isOperator(type2) { + return canonicalType(type2) === "operator"; + } + function isCollect(type2) { + return canonicalType(type2) === "collect"; + } + function expression(ctx, args, code) { + if (!code.endsWith(";")) { + code = "return(" + code + ");"; + } + const fn2 = Function(...args.concat(code)); + return ctx && ctx.functions ? fn2.bind(ctx.functions) : fn2; + } + function _compare(u2, v, lt, gt) { + return `((u = ${u2}) < (v = ${v}) || u == null) && v != null ? ${lt} + : (u > v || v == null) && u != null ? ${gt} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} + : v !== v && u === u ? ${gt} : `; + } + var expressionCodegen = { + /** + * Parse an expression used to update an operator value. + */ + operator: (ctx, expr2) => expression(ctx, ["_"], expr2.code), + /** + * Parse an expression provided as an operator parameter value. + */ + parameter: (ctx, expr2) => expression(ctx, ["datum", "_"], expr2.code), + /** + * Parse an expression applied to an event stream. + */ + event: (ctx, expr2) => expression(ctx, ["event"], expr2.code), + /** + * Parse an expression used to handle an event-driven operator update. + */ + handler: (ctx, expr2) => { + const code = `var datum=event.item&&event.item.datum;return ${expr2.code};`; + return expression(ctx, ["_", "event"], code); + }, + /** + * Parse an expression that performs visual encoding. + */ + encode: (ctx, encode2) => { + const { + marktype, + channels + } = encode2; + let code = "var o=item,datum=o.datum,m=0,$;"; + for (const name in channels) { + const o = "o[" + $(name) + "]"; + code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; + } + code += adjustSpatial(channels, marktype); + code += "return m;"; + return expression(ctx, ["item", "_"], code); + }, + /** + * Optimized code generators for access and comparison. + */ + codegen: { + get(path2) { + const ref2 = `[${path2.map($).join("][")}]`; + const get2 = Function("_", `return _${ref2};`); + get2.path = ref2; + return get2; + }, + comparator(fields, orders) { + let t; + const map2 = (f, i) => { + const o = orders[i]; + let u2, v; + if (f.path) { + u2 = `a${f.path}`; + v = `b${f.path}`; + } else { + (t = t || {})["f" + i] = f; + u2 = `this.f${i}(a)`; + v = `this.f${i}(b)`; + } + return _compare(u2, v, -o, o); + }; + const fn2 = Function("a", "b", "var u, v; return " + fields.map(map2).join("") + "0;"); + return t ? fn2.bind(t) : fn2; + } + } + }; + function parseOperator(spec) { + const ctx = this; + if (isOperator(spec.type) || !spec.type) { + ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); + } else { + ctx.transform(spec, spec.type); + } + } + function parseOperatorParameters(spec) { + const ctx = this; + if (spec.params) { + const op = ctx.get(spec.id); + if (!op) error("Invalid operator id: " + spec.id); + ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); + } + } + function parseParameters$1(spec, params2) { + params2 = params2 || {}; + const ctx = this; + for (const key2 in spec) { + const value2 = spec[key2]; + params2[key2] = isArray(value2) ? value2.map((v) => parseParameter$2(v, ctx, params2)) : parseParameter$2(value2, ctx, params2); + } + return params2; + } + function parseParameter$2(spec, ctx, params2) { + if (!spec || !isObject(spec)) return spec; + for (let i = 0, n = PARSERS.length, p; i < n; ++i) { + p = PARSERS[i]; + if (has$1(spec, p.key)) { + return p.parse(spec, ctx, params2); + } + } + return spec; + } + var PARSERS = [{ + key: "$ref", + parse: getOperator + }, { + key: "$key", + parse: getKey + }, { + key: "$expr", + parse: getExpression + }, { + key: "$field", + parse: getField + }, { + key: "$encode", + parse: getEncode + }, { + key: "$compare", + parse: getCompare + }, { + key: "$context", + parse: getContext + }, { + key: "$subflow", + parse: getSubflow + }, { + key: "$tupleid", + parse: getTupleId + }]; + function getOperator(_, ctx) { + return ctx.get(_.$ref) || error("Operator not defined: " + _.$ref); + } + function getExpression(_, ctx, params2) { + if (_.$params) { + ctx.parseParameters(_.$params, params2); + } + const k = "e:" + _.$expr.code; + return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields)); + } + function getKey(_, ctx) { + const k = "k:" + _.$key + "_" + !!_.$flat; + return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat, ctx.expr.codegen)); + } + function getField(_, ctx) { + if (!_.$field) return null; + const k = "f:" + _.$field + "_" + _.$name; + return ctx.fn[k] || (ctx.fn[k] = field$1(_.$field, _.$name, ctx.expr.codegen)); + } + function getCompare(_, ctx) { + const k = "c:" + _.$compare + "_" + _.$order, c2 = array$4(_.$compare).map((_2) => _2 && _2.$tupleid ? tupleid : _2); + return ctx.fn[k] || (ctx.fn[k] = compare$1(c2, _.$order, ctx.expr.codegen)); + } + function getEncode(_, ctx) { + const spec = _.$encode, encode2 = {}; + for (const name in spec) { + const enc = spec[name]; + encode2[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); + encode2[name].output = enc.$output; + } + return encode2; + } + function getContext(_, ctx) { + return ctx; + } + function getSubflow(_, ctx) { + const spec = _.$subflow; + return function(dataflow, key2, parent) { + const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; + if (p) p.set(parent); + op.detachSubflow = () => ctx.detach(subctx); + return op; + }; + } + function getTupleId() { + return tupleid; + } + function parseStream$2(spec) { + var ctx = this, filter2 = spec.filter != null ? ctx.eventExpression(spec.filter) : void 0, stream2 = spec.stream != null ? ctx.get(spec.stream) : void 0, args; + if (spec.source) { + stream2 = ctx.events(spec.source, spec.type, filter2); + } else if (spec.merge) { + args = spec.merge.map((_) => ctx.get(_)); + stream2 = args[0].merge.apply(args[0], args.slice(1)); + } + if (spec.between) { + args = spec.between.map((_) => ctx.get(_)); + stream2 = stream2.between(args[0], args[1]); + } + if (spec.filter) { + stream2 = stream2.filter(filter2); + } + if (spec.throttle != null) { + stream2 = stream2.throttle(+spec.throttle); + } + if (spec.debounce != null) { + stream2 = stream2.debounce(+spec.debounce); + } + if (stream2 == null) { + error("Invalid stream definition: " + JSON.stringify(spec)); + } + if (spec.consume) stream2.consume(true); + ctx.stream(spec, stream2); + } + function parseUpdate$1(spec) { + var ctx = this, srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid, source2 = ctx.get(srcid), target2 = null, update2 = spec.update, params2 = void 0; + if (!source2) error("Source not defined: " + spec.source); + target2 = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); + if (update2 && update2.$expr) { + if (update2.$params) { + params2 = ctx.parseParameters(update2.$params); + } + update2 = ctx.handlerExpression(update2.$expr); + } + ctx.update(spec, source2, target2, update2, params2); + } + const SKIP = { + skip: true + }; + function getState$1(options2) { + var ctx = this, state = {}; + if (options2.signals) { + var signals = state.signals = {}; + Object.keys(ctx.signals).forEach((key2) => { + const op = ctx.signals[key2]; + if (options2.signals(key2, op)) { + signals[key2] = op.value; + } + }); } - return true; -} -function removePredicate(props) { - return (_)=>equalObject(props, _); -} -function modify(name, insert, remove, toggle, modify, values) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input, stamp = df.stamp(); - let changes = data.changes, predicate, key; - if (df._trigger === false || !(input.value.length || insert || toggle)) // nothing to do! - return 0; - if (!changes || changes.stamp < stamp) { - data.changes = changes = df.changeset(); - changes.stamp = stamp; - df.runAfter(()=>{ - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - if (remove) { - predicate = remove === true ? (0, _vegaUtil.truthy) : (0, _vegaUtil.isArray)(remove) || (0, _vegaDataflow.isTuple)(remove) ? remove : removePredicate(remove); - changes.remove(predicate); + if (options2.data) { + var data2 = state.data = {}; + Object.keys(ctx.data).forEach((key2) => { + const dataset = ctx.data[key2]; + if (options2.data(key2, dataset)) { + data2[key2] = dataset.input.value; + } + }); } - if (insert) changes.insert(insert); - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) changes.remove(predicate); - else changes.insert(toggle); + if (ctx.subcontext && options2.recurse !== false) { + state.subcontext = ctx.subcontext.map((ctx2) => ctx2.getState(options2)); } - if (modify) for(key in values)changes.modify(modify, key, values[key]); - return 1; -} -function pinchDistance(event) { - const t = event.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; - return Math.hypot(dx, dy); -} -function pinchAngle(event) { - const t = event.touches; - return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); -} -// memoize accessor functions -const accessors = {}; -function pluck(data, name) { - const accessor = accessors[name] || (accessors[name] = (0, _vegaUtil.field)(name)); - return (0, _vegaUtil.isArray)(data) ? data.map(accessor) : accessor(data); -} -function array(seq) { - return (0, _vegaUtil.isArray)(seq) || ArrayBuffer.isView(seq) ? seq : null; -} -function sequence(seq) { - return array(seq) || ((0, _vegaUtil.isString)(seq) ? seq : null); -} -function join(seq) { - for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; - return array(seq).join(...args); -} -function indexof(seq) { - for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)args[_key2 - 1] = arguments[_key2]; - return sequence(seq).indexOf(...args); -} -function lastindexof(seq) { - for(var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)args[_key3 - 1] = arguments[_key3]; - return sequence(seq).lastIndexOf(...args); -} -function slice(seq) { - for(var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++)args[_key4 - 1] = arguments[_key4]; - return sequence(seq).slice(...args); -} -function replace(str, pattern, repl) { - if ((0, _vegaUtil.isFunction)(repl)) (0, _vegaUtil.error)('Function argument passed to replace.'); - if (!(0, _vegaUtil.isString)(pattern) && !(0, _vegaUtil.isRegExp)(pattern)) (0, _vegaUtil.error)('Please pass a string or RegExp argument to replace.'); - return String(str).replace(pattern, repl); -} -function reverse(seq) { - return array(seq).slice().reverse(); -} -function sort(seq) { - return array(seq).slice().sort((0, _vegaUtil.ascending)); -} -function bandspace(count, paddingInner, paddingOuter) { - return (0, _vegaScale.bandSpace)(count || 0, paddingInner || 0, paddingOuter || 0); -} -function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; -} -function copy(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; -} -function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; -} -function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined : (0, _vegaUtil.isArray)(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range); -} -function range(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; -} -function scale(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; -} -/** - * Passing a function is only used for for testing. - * Outside of tests, the first argument should be a string. - */ function scaleGradient(scaleOrFunction, p0, p1, count, group) { - let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction; - const gradient = (0, _vegaScenegraph.Gradient)(p0, p1); - let stops = scale.domain(), min = stops[0], max = (0, _vegaUtil.peek)(stops), fraction = (0, _vegaUtil.identity); - if (!(max - min)) // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator ? (0, _vegaScale.scale)('sequential')().interpolator(scale.interpolator()) : (0, _vegaScale.scale)('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([ - min = 0, - max = 1 - ]); - else fraction = (0, _vegaScale.scaleFraction)(scale, min, max); - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== (0, _vegaUtil.peek)(stops)) stops.push(max); - } - stops.forEach((_)=>gradient.stop(fraction(_), scale(_))); - return gradient; -} -function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; -} -function pathShape(path) { - let p = null; - return function(context) { - return context ? (0, _vegaScenegraph.pathRender)(context, p = p || (0, _vegaScenegraph.pathParse)(path)) : path; - }; -} -const datum = (d)=>d.data; -function treeNodes(name, context) { - const tree = data.call(context, name); - return tree.root && tree.root.lookup || {}; -} -function treePath(name, source, target) { - const nodes = treeNodes(name, this), s = nodes[source], t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; -} -function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; -} -const _window = ()=>typeof window !== 'undefined' && window || null; -function screen() { - const w = _window(); - return w ? w.screen : {}; -} -function windowSize() { - const w = _window(); - return w ? [ - w.innerWidth, - w.innerHeight - ] : [ - undefined, - undefined - ]; -} -function containerSize() { - const view = this.context.dataflow, el = view.container && view.container(); - return el ? [ - el.clientWidth, - el.clientHeight - ] : [ - undefined, - undefined - ]; -} -function intersect(b, opt, group) { - if (!b) return []; - const [u, v] = b, box = new (0, _vegaScenegraph.Bounds)().set(u[0], u[1], v[0], v[1]), scene = group || this.context.dataflow.scenegraph().root; - return (0, _vegaScenegraph.intersect)(scene, box, filter(opt)); -} -function filter(opt) { - let p = null; - if (opt) { - const types = (0, _vegaUtil.array)(opt.marktype), names = (0, _vegaUtil.array)(opt.markname); - p = (_)=>(!types.length || types.some((t)=>_.marktype === t)) && (!names.length || names.some((s)=>_.name === s)); + return state; + } + function setState$1(state) { + var ctx = this, df = ctx.dataflow, data2 = state.data, signals = state.signals; + Object.keys(signals || {}).forEach((key2) => { + df.update(ctx.signals[key2], signals[key2], SKIP); + }); + Object.keys(data2 || {}).forEach((key2) => { + df.pulse(ctx.data[key2].input, df.changeset().remove(truthy).insert(data2[key2])); + }); + (state.subcontext || []).forEach((substate, i) => { + const subctx = ctx.subcontext[i]; + if (subctx) subctx.setState(substate); + }); + } + function context(df, transforms2, functions, expr2) { + return new Context(df, transforms2, functions, expr2); + } + function Context(df, transforms2, functions, expr2) { + this.dataflow = df; + this.transforms = transforms2; + this.events = df.events.bind(df); + this.expr = expr2 || expressionCodegen, this.signals = {}; + this.scales = {}; + this.nodes = {}; + this.data = {}; + this.fn = {}; + if (functions) { + this.functions = Object.create(functions); + this.functions.context = this; } - return p; -} -/** - * Appends a new point to the lasso - * - * @param {*} lasso the lasso in pixel space - * @param {*} x the x coordinate in pixel space - * @param {*} y the y coordinate in pixel space - * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point - * @returns a new array containing the lasso with the new point - */ function lassoAppend(lasso, x, y) { - let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5; - lasso = (0, _vegaUtil.array)(lasso); - const last = lasso[lasso.length - 1]; - // Add point to lasso if its the first point or distance to last point exceed minDist - return last === undefined || Math.hypot(last[0] - x, last[1] - y) > minDist ? [ - ...lasso, - [ - x, - y - ] - ] : lasso; -} -/** - * Generates a svg path command which draws a lasso - * - * @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...] - * @returns the svg path command that draws the lasso - */ function lassoPath(lasso) { - return (0, _vegaUtil.array)(lasso).reduce((svg, _ref, i)=>{ - let [x, y] = _ref; - return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `; - }, ''); -} -/** - * Inverts the lasso from pixel space to an array of vega scenegraph tuples - * - * @param {*} data the dataset - * @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...] - * @param {*} unit the unit where the lasso is defined - * - * @returns an array of vega scenegraph tuples - */ function intersectLasso(markname, pixelLasso, unit) { - const { x, y, mark } = unit; - const bb = new (0, _vegaScenegraph.Bounds)().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); - // Get bounding box around lasso - for (const [px, py] of pixelLasso){ - if (px < bb.x1) bb.x1 = px; - if (px > bb.x2) bb.x2 = px; - if (py < bb.y1) bb.y1 = py; - if (py > bb.y2) bb.y2 = py; - } - // Translate bb against unit coordinates - bb.translate(x, y); - const intersection = intersect([ - [ - bb.x1, - bb.y1 - ], - [ - bb.x2, - bb.y2 - ] - ], markname, mark); - // Check every point against the lasso - return intersection.filter((tuple)=>pointInPolygon(tuple.x, tuple.y, pixelLasso)); -} -/** - * Performs a test if a point is inside a polygon based on the idea from - * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html - * - * This method will not need the same start/end point since it wraps around the edges of the array - * - * @param {*} test a point to test against - * @param {*} polygon a polygon in the form [[x,y], [x,y], ...] - * @returns true if the point lies inside the polygon, false otherwise - */ function pointInPolygon(testx, testy, polygon) { - let intersections = 0; - for(let i = 0, j = polygon.length - 1; i < polygon.length; j = i++){ - const [prevX, prevY] = polygon[j]; - const [x, y] = polygon[i]; - // count intersections - if (y > testy != prevY > testy && testx < (prevX - x) * (testy - y) / (prevY - y) + x) intersections++; + } + function Subcontext(ctx) { + this.dataflow = ctx.dataflow; + this.transforms = ctx.transforms; + this.events = ctx.events; + this.expr = ctx.expr; + this.signals = Object.create(ctx.signals); + this.scales = Object.create(ctx.scales); + this.nodes = Object.create(ctx.nodes); + this.data = Object.create(ctx.data); + this.fn = Object.create(ctx.fn); + if (ctx.functions) { + this.functions = Object.create(ctx.functions); + this.functions.context = this; } - // point is in polygon if intersection count is odd - return intersections & 1; -} -// Expression function context object -const functionContext = { - random () { - return (0, _vegaStatistics.random)(); + } + Context.prototype = Subcontext.prototype = { + fork() { + const ctx = new Subcontext(this); + (this.subcontext || (this.subcontext = [])).push(ctx); + return ctx; }, - cumulativeNormal: // override default - (0, _vegaStatistics.cumulativeNormal), - cumulativeLogNormal: (0, _vegaStatistics.cumulativeLogNormal), - cumulativeUniform: (0, _vegaStatistics.cumulativeUniform), - densityNormal: (0, _vegaStatistics.densityNormal), - densityLogNormal: (0, _vegaStatistics.densityLogNormal), - densityUniform: (0, _vegaStatistics.densityUniform), - quantileNormal: (0, _vegaStatistics.quantileNormal), - quantileLogNormal: (0, _vegaStatistics.quantileLogNormal), - quantileUniform: (0, _vegaStatistics.quantileUniform), - sampleNormal: (0, _vegaStatistics.sampleNormal), - sampleLogNormal: (0, _vegaStatistics.sampleLogNormal), - sampleUniform: (0, _vegaStatistics.sampleUniform), - isArray: (0, _vegaUtil.isArray), - isBoolean: (0, _vegaUtil.isBoolean), - isDate: (0, _vegaUtil.isDate), - isDefined (_) { - return _ !== undefined; + detach(ctx) { + this.subcontext = this.subcontext.filter((c2) => c2 !== ctx); + const keys2 = Object.keys(ctx.nodes); + for (const key2 of keys2) ctx.nodes[key2]._targets = null; + for (const key2 of keys2) ctx.nodes[key2].detach(); + ctx.nodes = null; }, - isNumber: (0, _vegaUtil.isNumber), - isObject: (0, _vegaUtil.isObject), - isRegExp: (0, _vegaUtil.isRegExp), - isString: (0, _vegaUtil.isString), - isTuple: (0, _vegaDataflow.isTuple), - isValid (_) { - return _ != null && _ === _; + get(id2) { + return this.nodes[id2]; }, - toBoolean: (0, _vegaUtil.toBoolean), - toDate (_) { - return (0, _vegaUtil.toDate)(_); + set(id2, node) { + return this.nodes[id2] = node; }, - toNumber: // suppress extra arguments - (0, _vegaUtil.toNumber), - toString: (0, _vegaUtil.toString), - indexof, - join, - lastindexof, - replace, - reverse, - sort, - slice, - flush: (0, _vegaUtil.flush), - lerp: (0, _vegaUtil.lerp), - merge, - pad: (0, _vegaUtil.pad), - peek: (0, _vegaUtil.peek), - pluck, - span: (0, _vegaUtil.span), - inrange: (0, _vegaUtil.inrange), - truncate: (0, _vegaUtil.truncate), - rgb: (0, _d3Color.rgb), - lab: (0, _d3Color.lab), - hcl: (0, _d3Color.hcl), - hsl: (0, _d3Color.hsl), - luminance, - contrast, - sequence: (0, _d3Array.range), - format, - utcFormat, - utcParse, - utcOffset: (0, _vegaTime.utcOffset), - utcSequence: (0, _vegaTime.utcSequence), - timeFormat, - timeParse, - timeOffset: (0, _vegaTime.timeOffset), - timeSequence: (0, _vegaTime.timeSequence), - timeUnitSpecifier: (0, _vegaTime.timeUnitSpecifier), - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter: (0, _vegaUtil.quarter), - utcquarter: (0, _vegaUtil.utcquarter), - week: (0, _vegaTime.week), - utcweek: (0, _vegaTime.utcweek), - dayofyear: (0, _vegaTime.dayofyear), - utcdayofyear: (0, _vegaTime.utcdayofyear), - warn, - info, - debug, - extent (_) { - return (0, _vegaUtil.extent)(_); + add(spec, op) { + const ctx = this, df = ctx.dataflow, data2 = spec.value; + ctx.set(spec.id, op); + if (isCollect(spec.type) && data2) { + if (data2.$ingest) { + df.ingest(op, data2.$ingest, data2.$format); + } else if (data2.$request) { + df.preload(op, data2.$request, data2.$format); + } else { + df.pulse(op, df.changeset().insert(data2)); + } + } + if (spec.root) { + ctx.root = op; + } + if (spec.parent) { + let p = ctx.get(spec.parent.$ref); + if (p) { + df.connect(p, [op]); + op.targets().add(p); + } else { + (ctx.unresolved = ctx.unresolved || []).push(() => { + p = ctx.get(spec.parent.$ref); + df.connect(p, [op]); + op.targets().add(p); + }); + } + } + if (spec.signal) { + ctx.signals[spec.signal] = op; + } + if (spec.scale) { + ctx.scales[spec.scale] = op; + } + if (spec.data) { + for (const name in spec.data) { + const data3 = ctx.data[name] || (ctx.data[name] = {}); + spec.data[name].forEach((role) => data3[role] = op); + } + } }, - // suppress extra arguments - inScope, - intersect, - clampRange: (0, _vegaUtil.clampRange), - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear: (0, _vegaUtil.panLinear), - panLog: (0, _vegaUtil.panLog), - panPow: (0, _vegaUtil.panPow), - panSymlog: (0, _vegaUtil.panSymlog), - zoomLinear: (0, _vegaUtil.zoomLinear), - zoomLog: (0, _vegaUtil.zoomLog), - zoomPow: (0, _vegaUtil.zoomPow), - zoomSymlog: (0, _vegaUtil.zoomSymlog), - encode, - modify, - lassoAppend, - lassoPath, - intersectLasso -}; -const eventFunctions = [ - 'view', - 'item', - 'group', - 'xy', - 'x', - 'y' -], // event functions -eventPrefix = 'event.vega.', // event function prefix -thisPrefix = 'this.', // function context prefix -astVisitors = {}; // AST visitors for dependency analysis -// export code generator parameters -const codegenParams = { - forbidden: [ - '_' - ], - allowed: [ - 'datum', - 'event', - 'item' - ], - fieldvar: 'datum', - globalvar: (id)=>`_[${(0, _vegaUtil.stringValue)(SignalPrefix + id)}]`, - functions: buildFunctions, - constants: (0, _vegaExpression.constants), - visitors: astVisitors -}; -// export code generator -const codeGenerator = (0, _vegaExpression.codegenExpression)(codegenParams); -// Build expression function registry -function buildFunctions(codegen) { - const fn = (0, _vegaExpression.functions)(codegen); - eventFunctions.forEach((name)=>fn[name] = eventPrefix + name); - for(const name in functionContext)fn[name] = thisPrefix + name; - (0, _vegaUtil.extend)(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; -} -// Register an expression function -function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) return functionContext[name]; - // register with the functionContext - functionContext[name] = fn; - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; -} -// register expression functions with ast visitors -expressionFunction('bandwidth', bandwidth, scaleVisitor); -expressionFunction('copy', copy, scaleVisitor); -expressionFunction('domain', domain, scaleVisitor); -expressionFunction('range', range, scaleVisitor); -expressionFunction('invert', invert, scaleVisitor); -expressionFunction('scale', scale, scaleVisitor); -expressionFunction('gradient', scaleGradient, scaleVisitor); -expressionFunction('geoArea', geoArea, scaleVisitor); -expressionFunction('geoBounds', geoBounds, scaleVisitor); -expressionFunction('geoCentroid', geoCentroid, scaleVisitor); -expressionFunction('geoShape', geoShape, scaleVisitor); -expressionFunction('geoScale', geoScale, scaleVisitor); -expressionFunction('indata', indata, indataVisitor); -expressionFunction('data', data, dataVisitor); -expressionFunction('treePath', treePath, dataVisitor); -expressionFunction('treeAncestors', treeAncestors, dataVisitor); -// register Vega-Lite selection functions -expressionFunction('vlSelectionTest', (0, _vegaSelections.selectionTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionIdTest', (0, _vegaSelections.selectionIdTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionResolve', (0, _vegaSelections.selectionResolve), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionTuples', (0, _vegaSelections.selectionTuples)); -function parser(expr, scope) { - const params = {}; - // parse the expression to an abstract syntax tree (ast) - let ast; - try { - expr = (0, _vegaUtil.isString)(expr) ? expr : (0, _vegaUtil.stringValue)(expr) + ''; - ast = (0, _vegaExpression.parseExpression)(expr); - } catch (err) { - (0, _vegaUtil.error)('Expression parse error: ' + expr); + resolve() { + (this.unresolved || []).forEach((fn2) => fn2()); + delete this.unresolved; + return this; + }, + operator(spec, update2) { + this.add(spec, this.dataflow.add(spec.value, update2)); + }, + transform(spec, type2) { + this.add(spec, this.dataflow.add(this.transforms[canonicalType(type2)])); + }, + stream(spec, stream2) { + this.set(spec.id, stream2); + }, + update(spec, stream2, target2, update2, params2) { + this.dataflow.on(stream2, target2, update2, params2, spec.options); + }, + // expression parsing + operatorExpression(expr2) { + return this.expr.operator(this, expr2); + }, + parameterExpression(expr2) { + return this.expr.parameter(this, expr2); + }, + eventExpression(expr2) { + return this.expr.event(this, expr2); + }, + handlerExpression(expr2) { + return this.expr.handler(this, expr2); + }, + encodeExpression(encode2) { + return this.expr.encode(this, encode2); + }, + // parse methods + parse: parse$2, + parseOperator, + parseOperatorParameters, + parseParameters: parseParameters$1, + parseStream: parseStream$2, + parseUpdate: parseUpdate$1, + // state methods + getState: getState$1, + setState: setState$1 + }; + function initializeAria(view) { + const el = view.container(); + if (el) { + el.setAttribute("role", "graphics-document"); + el.setAttribute("aria-roleDescription", "visualization"); + ariaLabel(el, view.description()); } - // analyze ast function calls for dependencies - ast.visit((node)=>{ - if (node.type !== (0, _vegaExpression.CallExpression)) return; - const name = node.callee.name, visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); + } + function ariaLabel(el, desc) { + if (el) desc == null ? el.removeAttribute("aria-label") : el.setAttribute("aria-label", desc); + } + function background(view) { + view.add(null, (_) => { + view._background = _.bg; + view._resize = 1; + return _.bg; + }, { + bg: view._signals.background }); - // perform code generation - const gen = codeGenerator(ast); - // collect signal dependencies - gen.globals.forEach((name)=>{ - const signalName = SignalPrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, signalName) && scope.getSignal(name)) params[signalName] = scope.signalRef(name); + } + const Default = "default"; + function cursor(view) { + const cursor2 = view._signals.cursor || (view._signals.cursor = view.add({ + user: Default, + item: null + })); + view.on(view.events("view", "pointermove"), cursor2, (_, event2) => { + const value2 = cursor2.value, user = value2 ? isString(value2) ? value2 : value2.user : Default, item = event2.item && event2.item.cursor || null; + return value2 && user === value2.user && item == value2.item ? value2 : { + user, + item + }; }); - // return generated expression code and dependencies - return { - $expr: (0, _vegaUtil.extend)({ - code: gen.code - }, scope.options.ast ? { - ast - } : null), - $fields: gen.fields, - $params: params - }; -} - -},{"vega-util":"f2ulH","vega-expression":"8Nghf","vega-scale":"gHN3E","d3-geo":"8qTbc","d3-color":"37LNF","vega-dataflow":"cFRfY","vega-scenegraph":"gJqm6","vega-selections":"inIVI","vega-statistics":"4QSQj","vega-time":"kjkWX","d3-array":"5lCYW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Nghf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ASTNode", ()=>ASTNode); -parcelHelpers.export(exports, "ArrayExpression", ()=>ArrayExpression); -parcelHelpers.export(exports, "BinaryExpression", ()=>BinaryExpression); -parcelHelpers.export(exports, "CallExpression", ()=>CallExpression); -parcelHelpers.export(exports, "ConditionalExpression", ()=>ConditionalExpression); -parcelHelpers.export(exports, "Identifier", ()=>Identifier); -parcelHelpers.export(exports, "Literal", ()=>Literal); -parcelHelpers.export(exports, "LogicalExpression", ()=>LogicalExpression); -parcelHelpers.export(exports, "MemberExpression", ()=>MemberExpression); -parcelHelpers.export(exports, "ObjectExpression", ()=>ObjectExpression); -parcelHelpers.export(exports, "Property", ()=>Property); -parcelHelpers.export(exports, "RawCode", ()=>RawCode); -parcelHelpers.export(exports, "UnaryExpression", ()=>UnaryExpression); -parcelHelpers.export(exports, "codegenExpression", ()=>codegen); -parcelHelpers.export(exports, "constants", ()=>Constants); -parcelHelpers.export(exports, "functions", ()=>Functions); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -var _vegaUtil = require("vega-util"); -const RawCode = 'RawCode'; -const Literal = 'Literal'; -const Property = 'Property'; -const Identifier = 'Identifier'; -const ArrayExpression = 'ArrayExpression'; -const BinaryExpression = 'BinaryExpression'; -const CallExpression = 'CallExpression'; -const ConditionalExpression = 'ConditionalExpression'; -const LogicalExpression = 'LogicalExpression'; -const MemberExpression = 'MemberExpression'; -const ObjectExpression = 'ObjectExpression'; -const UnaryExpression = 'UnaryExpression'; -function ASTNode(type) { - this.type = type; -} -ASTNode.prototype.visit = function(visitor) { - let c, i, n; - if (visitor(this)) return 1; - for(c = children(this), i = 0, n = c.length; i < n; ++i){ - if (c[i].visit(visitor)) return 1; - } -}; -function children(node) { - switch(node.type){ - case ArrayExpression: - return node.elements; - case BinaryExpression: - case LogicalExpression: - return [ - node.left, - node.right - ]; - case CallExpression: - return [ - node.callee - ].concat(node.arguments); - case ConditionalExpression: - return [ - node.test, - node.consequent, - node.alternate - ]; - case MemberExpression: - return [ - node.object, - node.property - ]; - case ObjectExpression: - return node.properties; - case Property: - return [ - node.key, - node.value - ]; - case UnaryExpression: - return [ - node.argument - ]; - case Identifier: - case Literal: - case RawCode: - default: - return []; - } -} -/* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - - Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com> - Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> - Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com> - Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> - Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> - Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ var TokenName, source, index, length, lookahead; -var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; -TokenName = {}; -TokenName[TokenBooleanLiteral] = 'Boolean'; -TokenName[TokenEOF] = '<end>'; -TokenName[TokenIdentifier] = 'Identifier'; -TokenName[TokenKeyword] = 'Keyword'; -TokenName[TokenNullLiteral] = 'Null'; -TokenName[TokenNumericLiteral] = 'Numeric'; -TokenName[TokenPunctuator] = 'Punctuator'; -TokenName[TokenStringLiteral] = 'String'; -TokenName[TokenRegularExpression] = 'RegularExpression'; -var SyntaxArrayExpression = 'ArrayExpression', SyntaxBinaryExpression = 'BinaryExpression', SyntaxCallExpression = 'CallExpression', SyntaxConditionalExpression = 'ConditionalExpression', SyntaxIdentifier = 'Identifier', SyntaxLiteral = 'Literal', SyntaxLogicalExpression = 'LogicalExpression', SyntaxMemberExpression = 'MemberExpression', SyntaxObjectExpression = 'ObjectExpression', SyntaxProperty = 'Property', SyntaxUnaryExpression = 'UnaryExpression'; -// Error messages should be identical to V8. -var MessageUnexpectedToken = 'Unexpected token %0', MessageUnexpectedNumber = 'Unexpected number', MessageUnexpectedString = 'Unexpected string', MessageUnexpectedIdentifier = 'Unexpected identifier', MessageUnexpectedReserved = 'Unexpected reserved word', MessageUnexpectedEOS = 'Unexpected end of input', MessageInvalidRegExp = 'Invalid regular expression', MessageUnterminatedRegExp = 'Invalid regular expression: missing /', MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; -var ILLEGAL = 'ILLEGAL', DISABLED = 'Disabled.'; -// See also tools/generate-unicode-regex.py. -var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), // eslint-disable-next-line no-misleading-character-class -RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); -// Ensure the condition is true, otherwise throw an error. -// This is only to have a better contract semantic, i.e. another safety net -// to catch a logic error. The condition shall be fulfilled in normal case. -// Do NOT use this to enforce a certain condition on any user input. -function assert(condition, message) { - /* istanbul ignore next */ if (!condition) throw new Error('ASSERT: ' + message); -} -function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 -} -function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.includes(ch); -} -function isOctalDigit(ch) { - return '01234567'.includes(ch); -} -// 7.2 White Space -function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [ - 0x1680, - 0x180E, - 0x2000, - 0x2001, - 0x2002, - 0x2003, - 0x2004, - 0x2005, - 0x2006, - 0x2007, - 0x2008, - 0x2009, - 0x200A, - 0x202F, - 0x205F, - 0x3000, - 0xFEFF - ].includes(ch); -} -// 7.3 Line Terminators -function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; -} -// 7.6 Identifier Names and Identifiers -function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); -} -function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); -} -// 7.6.1.1 Keywords -const keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 -}; -function skipComment() { - while(index < length){ - const ch = source.charCodeAt(index); - if (isWhiteSpace(ch) || isLineTerminator(ch)) ++index; - else break; - } -} -function scanHexEscape(prefix) { - var i, len, ch, code = 0; - len = prefix === 'u' ? 4 : 2; - for(i = 0; i < len; ++i)if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else throwError({}, MessageUnexpectedToken, ILLEGAL); - return String.fromCharCode(code); -} -function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source[index]; - code = 0; - // At least, one hex digit is required. - if (ch === '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - while(index < length){ - ch = source[index++]; - if (!isHexDigit(ch)) break; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - if (code > 0x10FFFF || ch !== '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - // UTF-16 Encoding - if (code <= 0xFFFF) return String.fromCharCode(code); - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); -} -function getEscapedIdentifier() { - var ch, id; - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id = ch; + view.add(null, function(_) { + let user = _.cursor, item = this.value; + if (!isString(user)) { + item = user.item; + user = user.user; + } + setCursor(view, user && user !== Default ? user : item || user); + return item; + }, { + cursor: cursor2 + }); + } + function setCursor(view, cursor2) { + const el = view.globalCursor() ? typeof document !== "undefined" && document.body : view.container(); + if (el) { + return cursor2 == null ? el.style.removeProperty("cursor") : el.style.cursor = cursor2; } - while(index < length){ - ch = source.charCodeAt(index); - if (!isIdentifierPart(ch)) break; - ++index; - id += String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id += ch; - } + } + function dataref(view, name) { + var data2 = view._runtime.data; + if (!has$1(data2, name)) { + error("Unrecognized data set: " + name); } - return id; -} -function getIdentifier() { - var start, ch; - start = index++; - while(index < length){ - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); + return data2[name]; + } + function data(name, values2) { + return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values2)); + } + function change(name, changes) { + if (!isChangeSet(changes)) { + error("Second argument to changes must be a changeset."); + } + const dataset = dataref(this, name); + dataset.modified = true; + return this.pulse(dataset.input, changes); + } + function insert(name, _) { + return change.call(this, name, changeset().insert(_)); + } + function remove(name, _) { + return change.call(this, name, changeset().remove(_)); + } + function width(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewWidth + padding2.left + padding2.right); + } + function height(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewHeight + padding2.top + padding2.bottom); + } + function offset(view) { + var padding2 = view.padding(), origin = view._origin; + return [padding2.left + origin[0], padding2.top + origin[1]]; + } + function resizeRenderer(view) { + var origin = offset(view), w2 = width(view), h2 = height(view); + view._renderer.background(view.background()); + view._renderer.resize(w2, h2, origin); + view._handler.origin(origin); + view._resizeListeners.forEach((handler) => { + try { + handler(w2, h2); + } catch (error2) { + view.error(error2); + } + }); + } + function eventExtend(view, event2, item) { + var r = view._renderer, el = r && r.canvas(), p, e, translate2; + if (el) { + translate2 = offset(view); + e = event2.changedTouches ? event2.changedTouches[0] : event2; + p = point(e, el); + p[0] -= translate2[0]; + p[1] -= translate2[1]; + } + event2.dataflow = view; + event2.item = item; + event2.vega = extension(view, item, p); + return event2; + } + function extension(view, item, point2) { + const itemGroup = item ? item.mark.marktype === "group" ? item : item.mark.group : null; + function group2(name) { + var g = itemGroup, i; + if (name) for (i = item; i; i = i.mark.group) { + if (i.mark.name === name) { + g = i; + break; } - if (isIdentifierPart(ch)) ++index; - else break; + } + return g && g.mark && g.mark.interactive ? g : {}; + } + function xy(item2) { + if (!item2) return point2; + if (isString(item2)) item2 = group2(item2); + const p = point2.slice(); + while (item2) { + p[0] -= item2.x || 0; + p[1] -= item2.y || 0; + item2 = item2.mark && item2.mark.group; + } + return p; } - return source.slice(start, index); -} -function scanIdentifier() { - var start, id, type; - start = index; - // Backslash (U+005C) starts an escaped character. - id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) type = TokenIdentifier; - else if (keywords.hasOwnProperty(id)) // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - else if (id === 'null') type = TokenNullLiteral; - else if (id === 'true' || id === 'false') type = TokenBooleanLiteral; - else type = TokenIdentifier; return { - type: type, - value: id, - start: start, - end: index + view: constant$4(view), + item: constant$4(item || {}), + group: group2, + xy, + x: (item2) => xy(item2)[0], + y: (item2) => xy(item2)[1] }; -} -// 7.7 Punctuators -function scanPunctuator() { - var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; - switch(code){ - // Check for most common single-character punctuators. - case 0x2E: - case 0x28: - case 0x29: - case 0x3B: - case 0x2C: - case 0x7B: - case 0x7D: - case 0x5B: - case 0x5D: - case 0x3A: - case 0x3F: - case 0x7E: - // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - default: - code2 = source.charCodeAt(index + 1); - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) switch(code){ - case 0x2B: - case 0x2D: - case 0x2F: - case 0x3C: - case 0x3E: - case 0x5E: - case 0x7C: - case 0x25: - case 0x26: - case 0x2A: - // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - case 0x21: - case 0x3D: - // = - index += 2; - // !== and === - if (source.charCodeAt(index) === 0x3D) ++index; - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - // 4-character punctuator: >>>= - ch4 = source.substr(index, 4); - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - // 3-character punctuators: === !== >>> <<= >>= - ch3 = ch4.substr(0, 3); - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - if (ch1 === ch2[1] && '+-<>&|'.includes(ch1) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - if (ch2 === '//') throwError({}, MessageUnexpectedToken, ILLEGAL); - // 1-character punctuators: < > = ! + - * % & | ^ / - if ('<>=!+-*%&|^/'.includes(ch1)) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - throwError({}, MessageUnexpectedToken, ILLEGAL); -} -// 7.8.3 Numeric Literals -function scanHexLiteral(start) { - let number = ''; - while(index < length){ - if (!isHexDigit(source[index])) break; - number += source[index++]; - } - if (number.length === 0) throwError({}, MessageUnexpectedToken, ILLEGAL); - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index + } + const VIEW$1 = "view", TIMER = "timer", WINDOW = "window", NO_TRAP = { + trap: false + }; + function initializeEventConfig(config) { + const events2 = extend({ + defaults: {} + }, config); + const unpack = (obj2, keys2) => { + keys2.forEach((k) => { + if (isArray(obj2[k])) obj2[k] = toSet(obj2[k]); + }); }; -} -function scanOctalLiteral(start) { - let number = '0' + source[index++]; - while(index < length){ - if (!isOctalDigit(source[index])) break; - number += source[index++]; + unpack(events2.defaults, ["prevent", "allow"]); + unpack(events2, ["view", "window", "selector"]); + return events2; + } + function trackEventListener(view, sources, type2, handler) { + view._eventListeners.push({ + type: type2, + sources: array$4(sources), + handler + }); + } + function prevent(view, type2) { + var def2 = view._eventConfig.defaults, prevent2 = def2.prevent, allow = def2.allow; + return prevent2 === false || allow === true ? false : prevent2 === true || allow === false ? true : prevent2 ? prevent2[type2] : allow ? !allow[type2] : view.preventDefault(); + } + function permit(view, key2, type2) { + const rule2 = view._eventConfig && view._eventConfig[key2]; + if (rule2 === false || isObject(rule2) && !rule2[type2]) { + view.warn(`Blocked ${key2} ${type2} event listener.`); + return false; } - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; -} -function scanNumericLiteral() { - var number, start, ch; - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) return scanOctalLiteral(start); - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - } - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === '.') { - number += source[index++]; - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === 'e' || ch === 'E') { - number += source[index++]; - ch = source[index]; - if (ch === '+' || ch === '-') number += source[index++]; - if (isDecimalDigit(source.charCodeAt(index))) while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - else throwError({}, MessageUnexpectedToken, ILLEGAL); - } - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; -} -// 7.8.4 String Literals -function scanStringLiteral() { - var str = '', quote, start, ch, code, octal = false; - quote = source[index]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index; - ++index; - while(index < length){ - ch = source[index++]; - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) switch(ch){ - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else str += scanHexEscape(ch); - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - // \0 is not octal escape sequence - if (code !== 0) octal = true; - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.includes(ch) && index < length && isOctalDigit(source[index])) code = code * 8 + '01234567'.indexOf(source[index++]); - } - str += String.fromCharCode(code); - } else str += ch; - break; - } - else if (ch === '\r' && source[index] === '\n') ++index; - } else if (isLineTerminator(ch.charCodeAt(0))) break; - else str += ch; + return true; + } + function events(source2, type2, filter2) { + var view = this, s2 = new EventStream(filter2), send = function(e, item) { + view.runAsync(null, () => { + if (source2 === VIEW$1 && prevent(view, type2)) { + e.preventDefault(); + } + s2.receive(eventExtend(view, e, item)); + }); + }, sources; + if (source2 === TIMER) { + if (permit(view, "timer", type2)) { + view.timer(send, type2); + } + } else if (source2 === VIEW$1) { + if (permit(view, "view", type2)) { + view.addEventListener(type2, send, NO_TRAP); + } + } else { + if (source2 === WINDOW) { + if (permit(view, "window", type2) && typeof window !== "undefined") { + sources = [window]; + } + } else if (typeof document !== "undefined") { + if (permit(view, "selector", type2)) { + sources = Array.from(document.querySelectorAll(source2)); + } + } + if (!sources) { + view.warn("Can not resolve event source: " + source2); + } else { + for (var i = 0, n = sources.length; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + trackEventListener(view, sources, type2, send); + } } - if (quote !== '') throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index + return s2; + } + function itemFilter(event2) { + return event2.item; + } + function markTarget(event2) { + return event2.item.mark.source; + } + function invoke(name) { + return function(_, event2) { + return event2.vega.view().changeset().encode(event2.item, name); }; -} -function testRegExp(pattern, flags) { - let tmp = pattern; - if (flags.includes('u')) // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1)=>{ - if (parseInt($1, 16) <= 0x10FFFF) return 'x'; - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); + } + function hover(hoverSet, leaveSet) { + hoverSet = [hoverSet || "hover"]; + leaveSet = [leaveSet || "update", hoverSet[0]]; + this.on(this.events("view", "pointerover", itemFilter), markTarget, invoke(hoverSet)); + this.on(this.events("view", "pointerout", itemFilter), markTarget, invoke(leaveSet)); + return this; + } + function finalize() { + var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m2, e, h2, t; + n = timers.length; + while (--n >= 0) { + timers[n].stop(); } - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; + n = listeners.length; + while (--n >= 0) { + e = listeners[n]; + m2 = e.sources.length; + while (--m2 >= 0) { + e.sources[m2].removeEventListener(e.type, e.handler); + } } -} -function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - classMarker = false; - terminated = false; - while(index < length){ - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - else if (classMarker) { - if (ch === ']') classMarker = false; - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') classMarker = true; - } + if (tooltip) { + tooltip.call(this, this._handler, null, null, null); } - if (!terminated) throwError({}, MessageUnterminatedRegExp); - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; -} -function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - while(index < length){ - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) break; - ++index; - if (ch === '\\' && index < length) throwError({}, MessageUnexpectedToken, ILLEGAL); - else { - flags += ch; - str += ch; + n = handlers.length; + while (--n >= 0) { + t = handlers[n].type; + h2 = handlers[n].handler; + this._handler.off(t, h2); + } + return this; + } + function element(tag, attr2, text2) { + const el = document.createElement(tag); + for (const key2 in attr2) el.setAttribute(key2, attr2[key2]); + if (text2 != null) el.textContent = text2; + return el; + } + const BindClass = "vega-bind", NameClass = "vega-bind-name", RadioClass = "vega-bind-radio"; + function bind(view, el, binding) { + if (!el) return; + const param2 = binding.param; + let bind2 = binding.state; + if (!bind2) { + bind2 = binding.state = { + elements: null, + active: false, + set: null, + update: (value2) => { + if (value2 != view.signal(param2.signal)) { + view.runAsync(null, () => { + bind2.source = true; + view.signal(param2.signal, value2); + }); + } } + }; + if (param2.debounce) { + bind2.update = debounce(param2.debounce, bind2.update); + } } - if (flags.search(/[^gimuy]/g) >= 0) throwError({}, MessageInvalidRegExp, flags); - return { - value: flags, - literal: str - }; -} -function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index + const create2 = param2.input == null && param2.element ? target : generate; + create2(bind2, el, param2, view); + if (!bind2.active) { + view.on(view._signals[param2.signal], null, () => { + bind2.source ? bind2.source = false : bind2.set(view.signal(param2.signal)); + }); + bind2.active = true; + } + return bind2; + } + function target(bind2, node, param2, view) { + const type2 = param2.event || "input"; + const handler = () => bind2.update(node.value); + view.signal(param2.signal, node.value); + node.addEventListener(type2, handler); + trackEventListener(view, node, type2, handler); + bind2.set = (value2) => { + node.value = value2; + node.dispatchEvent(event(type2)); }; -} -function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; -} -function advance() { - skipComment(); - if (index >= length) return { - type: TokenEOF, - start: index, - end: index + } + function event(type2) { + return typeof Event !== "undefined" ? new Event(type2) : { + type: type2 }; - const ch = source.charCodeAt(index); - if (isIdentifierStart(ch)) return scanIdentifier(); - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) return scanPunctuator(); - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) return scanStringLiteral(); - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) return scanNumericLiteral(); - return scanPunctuator(); - } - if (isDecimalDigit(ch)) return scanNumericLiteral(); - return scanPunctuator(); -} -function lex() { - const token = lookahead; - index = token.end; - lookahead = advance(); - index = token.end; - return token; -} -function peek() { - const pos = index; - lookahead = advance(); - index = pos; -} -function finishArrayExpression(elements) { - const node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; -} -function finishBinaryExpression(operator, left, right) { - const node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; -} -function finishCallExpression(callee, args) { - const node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; -} -function finishConditionalExpression(test, consequent, alternate) { - const node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; -} -function finishIdentifier(name) { - const node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; -} -function finishLiteral(token) { - const node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') node.raw = '/(?:)/'; - node.regex = token.regex; - } - return node; -} -function finishMemberExpression(accessor, object, property) { - const node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; -} -function finishObjectExpression(properties) { - const node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; -} -function finishProperty(kind, key, value) { - const node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; -} -function finishUnaryExpression(operator, argument) { - const node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; -} -// Throw an exception -function throwError(token, messageFormat) { - var error, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index)=>{ - assert(index < args.length, 'Message reference must be in range'); - return args[index]; + } + function generate(bind2, el, param2, view) { + const value2 = view.signal(param2.signal); + const div = element("div", { + "class": BindClass }); - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; -} -// Throw an exception because of the token. -function throwUnexpected(token) { - if (token.type === TokenEOF) throwError(token, MessageUnexpectedEOS); - if (token.type === TokenNumericLiteral) throwError(token, MessageUnexpectedNumber); - if (token.type === TokenStringLiteral) throwError(token, MessageUnexpectedString); - if (token.type === TokenIdentifier) throwError(token, MessageUnexpectedIdentifier); - if (token.type === TokenKeyword) throwError(token, MessageUnexpectedReserved); - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); -} -// Expect the next token to match the specified punctuator. -// If not, an exception will be thrown. -function expect(value) { - const token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) throwUnexpected(token); -} -// Return true if the next token matches the specified punctuator. -function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; -} -// Return true if the next token matches the specified keyword -function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; -} -// 11.1.4 Array Initialiser -function parseArrayInitialiser() { - const elements = []; - index = lookahead.start; - expect('['); - while(!match(']'))if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - if (!match(']')) expect(','); + const wrapper = param2.input === "radio" ? div : div.appendChild(element("label")); + wrapper.appendChild(element("span", { + "class": NameClass + }, param2.name || param2.signal)); + el.appendChild(div); + let input = form; + switch (param2.input) { + case "checkbox": + input = checkbox; + break; + case "select": + input = select; + break; + case "radio": + input = radio; + break; + case "range": + input = range; + break; } - lex(); - return finishArrayExpression(elements); -} -// 11.1.5 Object Initialiser -function parseObjectPropertyKey() { - index = lookahead.start; - const token = lex(); - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) throwError(token, MessageStrictOctalLiteral); - return finishLiteral(token); + input(bind2, wrapper, param2, value2); + } + function form(bind2, el, param2, value2) { + const node = element("input"); + for (const key2 in param2) { + if (key2 !== "signal" && key2 !== "element") { + node.setAttribute(key2 === "input" ? "type" : key2, param2[key2]); + } } - return finishIdentifier(token.value); -} -function parseObjectProperty() { - var token, key, id, value; - index = lookahead.start; - token = lookahead; - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); + node.setAttribute("name", param2.signal); + node.value = value2; + el.appendChild(node); + node.addEventListener("input", () => bind2.update(node.value)); + bind2.elements = [node]; + bind2.set = (value3) => node.value = value3; + } + function checkbox(bind2, el, param2, value2) { + const attr2 = { + type: "checkbox", + name: param2.signal + }; + if (value2) attr2.checked = true; + const node = element("input", attr2); + el.appendChild(node); + node.addEventListener("change", () => bind2.update(node.checked)); + bind2.elements = [node]; + bind2.set = (value3) => node.checked = !!value3 || null; + } + function select(bind2, el, param2, value2) { + const node = element("select", { + name: param2.signal + }), labels = param2.labels || []; + param2.options.forEach((option, i) => { + const attr2 = { + value: option + }; + if (valuesEqual(option, value2)) attr2.selected = true; + node.appendChild(element("option", attr2, (labels[i] || option) + "")); + }); + el.appendChild(node); + node.addEventListener("change", () => { + bind2.update(param2.options[node.selectedIndex]); + }); + bind2.elements = [node]; + bind2.set = (value3) => { + for (let i = 0, n = param2.options.length; i < n; ++i) { + if (valuesEqual(param2.options[i], value3)) { + node.selectedIndex = i; + return; + } + } + }; + } + function radio(bind2, el, param2, value2) { + const group2 = element("span", { + "class": RadioClass + }), labels = param2.labels || []; + el.appendChild(group2); + bind2.elements = param2.options.map((option, i) => { + const attr2 = { + type: "radio", + name: param2.signal, + value: option + }; + if (valuesEqual(option, value2)) attr2.checked = true; + const input = element("input", attr2); + input.addEventListener("change", () => bind2.update(option)); + const label2 = element("label", {}, (labels[i] || option) + ""); + label2.prepend(input); + group2.appendChild(label2); + return input; + }); + bind2.set = (value3) => { + const nodes = bind2.elements, n = nodes.length; + for (let i = 0; i < n; ++i) { + if (valuesEqual(nodes[i].value, value3)) nodes[i].checked = true; + } + }; + } + function range(bind2, el, param2, value2) { + value2 = value2 !== void 0 ? value2 : (+param2.max + +param2.min) / 2; + const max2 = param2.max != null ? param2.max : Math.max(100, +value2) || 100, min2 = param2.min || Math.min(0, max2, +value2) || 0, step = param2.step || tickStep(min2, max2, 100); + const node = element("input", { + type: "range", + name: param2.signal, + min: min2, + max: max2, + step + }); + node.value = value2; + const span2 = element("span", {}, +value2); + el.appendChild(node); + el.appendChild(span2); + const update2 = () => { + span2.textContent = node.value; + bind2.update(+node.value); + }; + node.addEventListener("input", update2); + node.addEventListener("change", update2); + bind2.elements = [node]; + bind2.set = (value3) => { + node.value = value3; + span2.textContent = value3; + }; + } + function valuesEqual(a2, b2) { + return a2 === b2 || a2 + "" === b2 + ""; + } + function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { + r = r || new constructor(view.loader()); + return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); + } + function trap(view, fn2) { + return !fn2 ? null : function() { + try { + fn2.apply(this, arguments); + } catch (error2) { + view.error(error2); + } + }; + } + function initializeHandler(view, prevHandler, el, constructor) { + const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); + if (prevHandler) { + prevHandler.handlers().forEach((h2) => { + handler.on(h2.type, h2.handler); + }); } - if (token.type === TokenEOF || token.type === TokenPunctuator) throwUnexpected(token); - else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } -} -function parseObjectInitialiser() { - var properties = [], property, name, key, map = {}, toString = String; - index = lookahead.start; - expect('{'); - while(!match('}')){ - property = parseObjectProperty(); - if (property.key.type === SyntaxIdentifier) name = property.key.name; - else name = toString(property.key.value); - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) throwError({}, MessageStrictDuplicateProperty); - else map[key] = true; - properties.push(property); - if (!match('}')) expect(','); - } - expect('}'); - return finishObjectExpression(properties); -} -// 11.1.6 The Grouping Operator -function parseGroupExpression() { - expect('('); - const expr = parseExpression(); - expect(')'); - return expr; -} -// 11.1 Primary Expressions -const legalKeywords = { - 'if': 1 -}; -function parsePrimaryExpression() { - var type, token, expr; - if (match('(')) return parseGroupExpression(); - if (match('[')) return parseArrayInitialiser(); - if (match('{')) return parseObjectInitialiser(); - type = lookahead.type; - index = lookahead.start; - if (type === TokenIdentifier || legalKeywords[lookahead.value]) expr = finishIdentifier(lex().value); - else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) throwError(lookahead, MessageStrictOctalLiteral); - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) throw new Error(DISABLED); - else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else throwUnexpected(lex()); - return expr; -} -// 11.2 Left-Hand-Side Expressions -function parseArguments() { - const args = []; - expect('('); - if (!match(')')) while(index < length){ - args.push(parseConditionalExpression()); - if (match(')')) break; - expect(','); + return handler; + } + function initialize(el, elBind) { + const view = this, type2 = view._renderType, config = view._eventConfig.bind, module2 = renderModule(type2); + el = view._el = el ? lookup$1(view, el, true) : null; + initializeAria(view); + if (!module2) view.error("Unrecognized renderer type: " + type2); + const Handler2 = module2.handler || CanvasHandler, Renderer2 = el ? module2.renderer : module2.headless; + view._renderer = !Renderer2 ? null : initializeRenderer(view, view._renderer, el, Renderer2); + view._handler = initializeHandler(view, view._handler, el, Handler2); + view._redraw = true; + if (el && config !== "none") { + elBind = elBind ? view._elBind = lookup$1(view, elBind, true) : el.appendChild(element("form", { + "class": "vega-bindings" + })); + view._bind.forEach((_) => { + if (_.param.element && config !== "container") { + _.element = lookup$1(view, _.param.element, !!_.param.input); + } + }); + view._bind.forEach((_) => { + bind(view, _.element || elBind, _); + }); } - expect(')'); - return args; -} -function parseNonComputedProperty() { - index = lookahead.start; - const token = lex(); - if (!isIdentifierName(token)) throwUnexpected(token); - return finishIdentifier(token.value); -} -function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); -} -function parseComputedMember() { - expect('['); - const expr = parseExpression(); - expect(']'); - return expr; -} -function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - for(;;){ - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else break; - } - return expr; -} -// 11.3 Postfix Expressions -function parsePostfixExpression() { - const expr = parseLeftHandSideExpressionAllowCall(); - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) throw new Error(DISABLED); - } - return expr; -} -// 11.4 Unary Operators -function parseUnaryExpression() { - var token, expr; - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) expr = parsePostfixExpression(); - else if (match('++') || match('--')) throw new Error(DISABLED); - else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) throw new Error(DISABLED); - else expr = parsePostfixExpression(); - return expr; -} -function binaryPrecedence(token) { - let prec = 0; - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) return 0; - switch(token.value){ - case '||': - prec = 1; - break; - case '&&': - prec = 2; - break; - case '|': - prec = 3; - break; - case '^': - prec = 4; - break; - case '&': - prec = 5; - break; - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - case '+': - case '-': - prec = 9; - break; - case '*': - case '/': - case '%': - prec = 11; - break; + return view; + } + function lookup$1(view, el, clear) { + if (typeof el === "string") { + if (typeof document !== "undefined") { + el = document.querySelector(el); + if (!el) { + view.error("Signal bind element not found: " + el); + return null; + } + } else { + view.error("DOM document instance not found."); + return null; + } } - return prec; -} -// 11.5 Multiplicative Operators -// 11.6 Additive Operators -// 11.7 Bitwise Shift Operators -// 11.8 Relational Operators -// 11.9 Equality Operators -// 11.10 Binary Bitwise Operators -// 11.11 Binary Logical Operators -function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) return left; - token.prec = prec; - lex(); - markers = [ - marker, - lookahead - ]; - right = parseUnaryExpression(); - stack = [ - left, - token, - right - ]; - while((prec = binaryPrecedence(lookahead)) > 0){ - // Reduce: make a binary expression from the three topmost entries. - while(stack.length > 2 && prec <= stack[stack.length - 2].prec){ - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while(i > 1){ - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - return expr; -} -// 11.12 Conditional Operator -function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - return expr; -} -// 11.14 Comma Operator -function parseExpression() { - const expr = parseConditionalExpression(); - if (match(',')) throw new Error(DISABLED); // no sequence expressions - return expr; -} -function parser(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - peek(); - const expr = parseExpression(); - if (lookahead.type !== TokenEOF) throw new Error('Unexpect token after expression.'); - return expr; -} -var Constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' -}; -function Functions(codegen) { - function fncall(name, args, cast, type) { - let obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')'); - } - function fn(name, cast, type) { - return (args)=>fncall(name, args, cast, type); - } - const DATE = 'new Date', STRING = 'String', REGEXP = 'RegExp'; - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - hypot: 'Math.hypot', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - clamp: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to clamp function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to clamp function.'); - const a = args.map(codegen); - return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))'; - }, - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - // sequence functions - length: fn('length', null, -1), - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - trim: fn('trim', STRING, 0), - // base64 encode/decode - btoa: 'btoa', - atob: 'atob', - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - // Control Flow functions - if: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to if function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to if function.'); - const a = args.map(codegen); - return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')'; - } - }; -} -function stripQuotes(s) { - const n = s && s.length - 1; - return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s; -} -function codegen(opt) { - opt = opt || {}; - const allowed = opt.allowed ? (0, _vegaUtil.toSet)(opt.allowed) : {}, forbidden = opt.forbidden ? (0, _vegaUtil.toSet)(opt.forbidden) : {}, constants = opt.constants || Constants, functions = (opt.functions || Functions)(visit), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = (0, _vegaUtil.isFunction)(globalvar) ? globalvar : (id)=>`${globalvar}["${id}"]`; - let globals = {}, fields = {}, memberDepth = 0; - function visit(ast) { - if ((0, _vegaUtil.isString)(ast)) return ast; - const generator = Generators[ast.type]; - if (generator == null) (0, _vegaUtil.error)('Unsupported type: ' + ast.type); - return generator(ast); + if (el && clear) { + try { + el.textContent = ""; + } catch (e) { + el = null; + view.error(e); + } } - const Generators = { - Literal: (n)=>n.raw, - Identifier: (n)=>{ - const id = n.name; - if (memberDepth > 0) return id; - else if ((0, _vegaUtil.hasOwnProperty)(forbidden, id)) return (0, _vegaUtil.error)('Illegal identifier: ' + id); - else if ((0, _vegaUtil.hasOwnProperty)(constants, id)) return constants[id]; - else if ((0, _vegaUtil.hasOwnProperty)(allowed, id)) return id; - else { - globals[id] = 1; - return outputGlobal(id); - } - }, - MemberExpression: (n)=>{ - const d = !n.computed, o = visit(n.object); - if (d) memberDepth += 1; - const p = visit(n.property); - if (o === fieldvar) // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - if (d) memberDepth -= 1; - return o + (d ? '.' + p : '[' + p + ']'); - }, - CallExpression: (n)=>{ - if (n.callee.type !== 'Identifier') (0, _vegaUtil.error)('Illegal callee type: ' + n.callee.type); - const callee = n.callee.name, args = n.arguments, fn = (0, _vegaUtil.hasOwnProperty)(functions, callee) && functions[callee]; - if (!fn) (0, _vegaUtil.error)('Unrecognized function: ' + callee); - return (0, _vegaUtil.isFunction)(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')'; - }, - ArrayExpression: (n)=>'[' + n.elements.map(visit).join(',') + ']', - BinaryExpression: (n)=>'(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')', - UnaryExpression: (n)=>'(' + n.operator + visit(n.argument) + ')', - ConditionalExpression: (n)=>'(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')', - LogicalExpression: (n)=>'(' + visit(n.left) + n.operator + visit(n.right) + ')', - ObjectExpression: (n)=>'{' + n.properties.map(visit).join(',') + '}', - Property: (n)=>{ - memberDepth += 1; - const k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - function codegen(ast) { - const result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; + return el; + } + const number$1 = (_) => +_ || 0; + const paddingObject$1 = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function padding(_) { + return isObject(_) ? { + top: number$1(_.top), + bottom: number$1(_.bottom), + left: number$1(_.left), + right: number$1(_.right) + } : paddingObject$1(number$1(_)); + } + async function renderHeadless(view, type2, scaleFactor, opt) { + const module2 = renderModule(type2), ctr = module2 && module2.headless; + if (!ctr) error("Unrecognized renderer type: " + type2); + await view.runAsync(); + return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); + } + async function renderToImageURL(type2, scaleFactor) { + if (type2 !== RenderType.Canvas && type2 !== RenderType.SVG && type2 !== RenderType.PNG) { + error("Unrecognized image type: " + type2); } - codegen.functions = functions; - codegen.constants = constants; - return codegen; -} - -},{"vega-util":"f2ulH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"inIVI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "selectionIdTest", ()=>selectionIdTest); -parcelHelpers.export(exports, "selectionResolve", ()=>selectionResolve); -parcelHelpers.export(exports, "selectionTest", ()=>selectionTest); -parcelHelpers.export(exports, "selectionTuples", ()=>selectionTuples); -parcelHelpers.export(exports, "selectionVisitor", ()=>selectionVisitor); -var _d3Array = require("d3-array"); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -// Registers vega-util field accessors to protect against XSS attacks -const SELECTION_GETTER = Symbol('vega_selection_getter'); -function getter(f) { - if (!f.getter || !f.getter[SELECTION_GETTER]) { - f.getter = (0, _vegaUtil.field)(f.field); - f.getter[SELECTION_GETTER] = true; + const r = await renderHeadless(this, type2, scaleFactor); + return type2 === RenderType.SVG ? toBlobURL(r.svg(), "image/svg+xml") : r.canvas().toDataURL("image/png"); + } + function toBlobURL(data2, mime) { + const blob = new Blob([data2], { + type: mime + }); + return window.URL.createObjectURL(blob); + } + async function renderToCanvas(scaleFactor, opt) { + const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); + return r.canvas(); + } + async function renderToSVG(scaleFactor) { + const r = await renderHeadless(this, RenderType.SVG, scaleFactor); + return r.svg(); + } + function runtime(view, spec, expr2) { + return context(view, transforms, functionContext, expr2).parse(spec); + } + function scale$1(name) { + var scales2 = this._runtime.scales; + if (!has$1(scales2, name)) { + error("Unrecognized scale or projection: " + name); + } + return scales2[name].value; + } + var Width = "width", Height = "height", Padding = "padding", Skip$1 = { + skip: true + }; + function viewWidth(view, width2) { + var a2 = view.autosize(), p = view.padding(); + return width2 - (a2 && a2.contains === Padding ? p.left + p.right : 0); + } + function viewHeight(view, height2) { + var a2 = view.autosize(), p = view.padding(); + return height2 - (a2 && a2.contains === Padding ? p.top + p.bottom : 0); + } + function initializeResize(view) { + var s2 = view._signals, w2 = s2[Width], h2 = s2[Height], p = s2[Padding]; + function resetSize() { + view._autosize = view._resize = 1; } - return f.getter; -} -const Intersect = 'intersect'; -const Union = 'union'; -const VlMulti = 'vlMulti'; -const VlPoint = 'vlPoint'; -const Or = 'or'; -const And = 'and'; -const SelectionId = '_vgsid_'; -const $selectionId = (0, _vegaUtil.field)(SelectionId); -const TYPE_ENUM = 'E', TYPE_RANGE_INC = 'R', TYPE_RANGE_EXC = 'R-E', TYPE_RANGE_LE = 'R-LE', TYPE_RANGE_RE = 'R-RE', TYPE_PRED_LT = 'E-LT', TYPE_PRED_LTE = 'E-LTE', TYPE_PRED_GT = 'E-GT', TYPE_PRED_GTE = 'E-GTE', TYPE_PRED_VALID = 'E-VALID', TYPE_PRED_ONE_OF = 'E-ONE', UNIT_INDEX = 'index:unit'; -// TODO: revisit date coercion? -function testPoint(datum, entry) { - var fields = entry.fields, values = entry.values, n = fields.length, i = 0, dval, f; - for(; i < n; ++i){ - f = fields[i]; - dval = getter(f)(datum); - if ((0, _vegaUtil.isDate)(dval)) dval = (0, _vegaUtil.toNumber)(dval); - if ((0, _vegaUtil.isDate)(values[i])) values[i] = (0, _vegaUtil.toNumber)(values[i]); - if ((0, _vegaUtil.isArray)(values[i]) && (0, _vegaUtil.isDate)(values[i][0])) values[i] = values[i].map((0, _vegaUtil.toNumber)); - if (f.type === TYPE_ENUM) { - // Enumerated fields can either specify individual values (single/multi selections) - // or an array of values (interval selections). - if ((0, _vegaUtil.isArray)(values[i]) ? !values[i].includes(dval) : dval !== values[i]) return false; - } else { - if (f.type === TYPE_RANGE_INC) { - if (!(0, _vegaUtil.inrange)(dval, values[i])) return false; - } else if (f.type === TYPE_RANGE_RE) { - // Discrete selection of bins test within the range [bin_start, bin_end). - if (!(0, _vegaUtil.inrange)(dval, values[i], true, false)) return false; - } else if (f.type === TYPE_RANGE_EXC) { - // 'R-E'/'R-LE' included for completeness. - if (!(0, _vegaUtil.inrange)(dval, values[i], false, false)) return false; - } else if (f.type === TYPE_RANGE_LE) { - if (!(0, _vegaUtil.inrange)(dval, values[i], false, true)) return false; - } else if (f.type === TYPE_PRED_LT) { - if (dval >= values[i]) return false; - } else if (f.type === TYPE_PRED_LTE) { - if (dval > values[i]) return false; - } else if (f.type === TYPE_PRED_GT) { - if (dval <= values[i]) return false; - } else if (f.type === TYPE_PRED_GTE) { - if (dval < values[i]) return false; - } else if (f.type === TYPE_PRED_VALID) { - if (dval === null || isNaN(dval)) return false; - } else if (f.type === TYPE_PRED_ONE_OF) { - if (values[i].indexOf(dval) === -1) return false; - } - } + view._resizeWidth = view.add(null, (_) => { + view._width = _.size; + view._viewWidth = viewWidth(view, _.size); + resetSize(); + }, { + size: w2 + }); + view._resizeHeight = view.add(null, (_) => { + view._height = _.size; + view._viewHeight = viewHeight(view, _.size); + resetSize(); + }, { + size: h2 + }); + const resizePadding = view.add(null, resetSize, { + pad: p + }); + view._resizeWidth.rank = w2.rank + 1; + view._resizeHeight.rank = h2.rank + 1; + resizePadding.rank = p.rank + 1; + } + function resizeView(viewWidth2, viewHeight2, width2, height2, origin, auto) { + this.runAfter((view) => { + let rerun2 = 0; + view._autosize = 0; + if (view.width() !== width2) { + rerun2 = 1; + view.signal(Width, width2, Skip$1); + view._resizeWidth.skip(true); + } + if (view.height() !== height2) { + rerun2 = 1; + view.signal(Height, height2, Skip$1); + view._resizeHeight.skip(true); + } + if (view._viewWidth !== viewWidth2) { + view._resize = 1; + view._viewWidth = viewWidth2; + } + if (view._viewHeight !== viewHeight2) { + view._resize = 1; + view._viewHeight = viewHeight2; + } + if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { + view._resize = 1; + view._origin = origin; + } + if (rerun2) view.run("enter"); + if (auto) view.runAfter((v) => v.resize()); + }, false, 1); + } + function getState(options2) { + return this._runtime.getState(options2 || { + data: dataTest, + signals: signalTest, + recurse: true + }); + } + function dataTest(name, data2) { + return data2.modified && isArray(data2.input.value) && !name.startsWith("_:vega:_"); + } + function signalTest(name, op) { + return !(name === "parent" || op instanceof transforms.proxy); + } + function setState(state) { + this.runAsync(null, (v) => { + v._trigger = false; + v._runtime.setState(state); + }, (v) => { + v._trigger = true; + }); + return this; + } + function timer(callback, delay) { + function tick(elapsed) { + callback({ + timestamp: Date.now(), + elapsed + }); } - return true; -} -/** - * Tests if a tuple is contained within an interactive selection. - * @param {string} name - The name of the data set representing the selection. - * Tuples in the dataset are of the form - * {unit: string, fields: array<fielddef>, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ function selectionTest(name, datum, op) { - var data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, n = entries.length, i = 0, entry, miss, count, unit, b; - for(; i < n; ++i){ - entry = entries[i]; - if (unitIdx && intersect) { - // multi selections union within the same unit and intersect across units. - miss = miss || {}; - count = miss[unit = entry.unit] || 0; - // if we've already matched this unit, skip. - if (count === -1) continue; - b = testPoint(datum, entry); - miss[unit] = b ? -1 : ++count; - // if we match and there are no other units return true - // if we've missed against all tuples in this unit return false - if (b && unitIdx.size === 1) return true; - if (!b && count === unitIdx.get(unit).count) return false; - } else { - b = testPoint(datum, entry); - // if we find a miss and we do require intersection return false - // if we find a match and we don't require intersection return true - if (intersect ^ b) return b; - } - } - // if intersecting and we made it here, then we saw no misses - // if not intersecting, then we saw no matches - // if no active selections, return false - return n && intersect; -} -const bisect = (0, _d3Array.bisector)($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; -function selectionIdTest(name, datum, op) { - const data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, value = $selectionId(datum), index = bisectLeft(entries, value); - if (index === entries.length) return false; - if ($selectionId(entries[index]) !== value) return false; - if (unitIdx && intersect) { - if (unitIdx.size === 1) return true; - if (bisectRight(entries, value) - index < unitIdx.size) return false; + this._timers.push(interval(tick, delay)); + } + function defaultTooltip(handler, event2, item, value2) { + const el = handler.element(); + if (el) el.setAttribute("title", formatTooltip(value2)); + } + function formatTooltip(value2) { + return value2 == null ? "" : isArray(value2) ? formatArray(value2) : isObject(value2) && !isDate$1(value2) ? formatObject(value2) : value2 + ""; + } + function formatObject(obj2) { + return Object.keys(obj2).map((key2) => { + const v = obj2[key2]; + return key2 + ": " + (isArray(v) ? formatArray(v) : formatValue(v)); + }).join("\n"); + } + function formatArray(value2) { + return "[" + value2.map(formatValue).join(", ") + "]"; + } + function formatValue(value2) { + return isArray(value2) ? "[…]" : isObject(value2) && !isDate$1(value2) ? "{…}" : value2; + } + function watchPixelRatio() { + if (this.renderer() === "canvas" && this._renderer._canvas) { + let remove2 = null; + const updatePixelRatio = () => { + if (remove2 != null) { + remove2(); + } + const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); + media.addEventListener("change", updatePixelRatio); + remove2 = () => { + media.removeEventListener("change", updatePixelRatio); + }; + this._renderer._canvas.getContext("2d").pixelRatio = window.devicePixelRatio || 1; + this._redraw = true; + this._resize = 1; + this.resize().runAsync(); + }; + updatePixelRatio(); } - return true; -} -/** - * Maps an array of scene graph items to an array of selection tuples. - * @param {string} name - The name of the dataset representing the selection. - * @param {string} base - The base object that generated tuples extend. - * - * @returns {array} An array of selection entries for the given unit. - */ function selectionTuples(array, base) { - return array.map((x)=>(0, _vegaUtil.extend)(base.fields ? { - values: base.fields.map((f)=>getter(f)(x.datum)) - } : { - [SelectionId]: $selectionId(x.datum) - }, base)); -} -/** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @param {boolean} isMulti - Identifies a "multi" selection to perform more - * expensive resolution computation. - * @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point" - * selections, and thus the resolved tuple should reflect this name. - * This parameter allows us to reflect this change without triggering - * a major version bump for Vega. - * @returns {object} An object of selected fields and values. - */ function selectionResolve(name, op, isMulti, vl5) { - var data = this.context.data[name], entries = data ? data.values.value : [], resolved = {}, multiRes = {}, types = {}, entry, fields, values, unit, field, value, res, resUnit, type, union, n = entries.length, i = 0, j, m; - // First union all entries within the same unit. - for(; i < n; ++i){ - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - if (fields && values) { - // Intentional selection stores - for(j = 0, m = fields.length; j < m; ++j){ - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[`${type}_union`]; - res[unit] = union(resUnit, (0, _vegaUtil.array)(values[j])); - } - // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push((0, _vegaUtil.array)(values).reduce((obj, curr, j)=>(obj[fields[j].field] = curr, obj), {})); - } - } else { - // Short circuit extensional selectionId stores which hold sorted IDs unique to each unit. - field = SelectionId; - value = $selectionId(entry); - res = resolved[field] || (resolved[field] = {}); - resUnit = res[unit] || (res[unit] = []); - resUnit.push(value); - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push({ - [SelectionId]: value - }); - } - } + } + function View$1(spec, options2) { + const view = this; + options2 = options2 || {}; + Dataflow.call(view); + if (options2.loader) view.loader(options2.loader); + if (options2.logger) view.logger(options2.logger); + if (options2.logLevel != null) view.logLevel(options2.logLevel); + if (options2.locale || spec.locale) { + const loc = extend({}, spec.locale, options2.locale); + view.locale(locale(loc.number, loc.time)); } - // Then resolve fields across units as per the op. - op = op || Union; - if (resolved[SelectionId]) resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); - else Object.keys(resolved).forEach((field)=>{ - resolved[field] = Object.keys(resolved[field]).map((unit)=>resolved[field][unit]).reduce((acc, curr)=>acc === undefined ? curr : ops[`${types[field]}_${op}`](acc, curr)); - }); - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - const key = vl5 ? VlPoint : VlMulti; - resolved[key] = op === Union ? { - [Or]: entries.reduce((acc, k)=>(acc.push(...multiRes[k]), acc), []) - } : { - [And]: entries.map((k)=>({ - [Or]: multiRes[k] - })) - }; + view._el = null; + view._elBind = null; + view._renderType = options2.renderer || RenderType.Canvas; + view._scenegraph = new Scenegraph(); + const root = view._scenegraph.root; + view._renderer = null; + view._tooltip = options2.tooltip || defaultTooltip, view._redraw = true; + view._handler = new CanvasHandler().scene(root); + view._globalCursor = false; + view._preventDefault = false; + view._timers = []; + view._eventListeners = []; + view._resizeListeners = []; + view._eventConfig = initializeEventConfig(spec.eventConfig); + view.globalCursor(view._eventConfig.globalCursor); + const ctx = runtime(view, spec, options2.expr); + view._runtime = ctx; + view._signals = ctx.signals; + view._bind = (spec.bindings || []).map((_) => ({ + state: null, + param: extend({}, _) + })); + if (ctx.root) ctx.root.set(root); + root.source = ctx.data.root.input; + view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); + view._width = view.width(); + view._height = view.height(); + view._viewWidth = viewWidth(view, view._width); + view._viewHeight = viewHeight(view, view._height); + view._origin = [0, 0]; + view._resize = 0; + view._autosize = 1; + initializeResize(view); + background(view); + cursor(view); + view.description(spec.description); + if (options2.hover) view.hover(); + if (options2.container) view.initialize(options2.container, options2.bind); + if (options2.watchPixelRatio) view._watchPixelRatio(); + } + function lookupSignal(view, name) { + return has$1(view._signals, name) ? view._signals[name] : error("Unrecognized signal name: " + $(name)); + } + function findOperatorHandler(op, handler) { + const h2 = (op._targets || []).filter((op2) => op2._update && op2._update.handler === handler); + return h2.length ? h2[0] : null; + } + function addOperatorListener(view, name, op, handler) { + let h2 = findOperatorHandler(op, handler); + if (!h2) { + h2 = trap(view, () => handler(name, op.value)); + h2.handler = handler; + view.on(op, null, h2); } - return resolved; -} -var ops = { - [`${SelectionId}_union`]: (0, _d3Array.union), - [`${SelectionId}_intersect`]: (0, _d3Array.intersection), - E_union: function(base, value) { - if (!base.length) return value; - var i = 0, n = value.length; - for(; i < n; ++i)if (!base.includes(value[i])) base.push(value[i]); - return base; - }, - E_intersect: function(base, value) { - return !base.length ? value : base.filter((v)=>value.includes(v)); + return view; + } + function removeOperatorListener(view, op, handler) { + const h2 = findOperatorHandler(op, handler); + if (h2) op._targets.remove(h2); + return view; + } + inherits(View$1, Dataflow, { + // -- DATAFLOW / RENDERING ---- + async evaluate(encode2, prerun, postrun) { + await Dataflow.prototype.evaluate.call(this, encode2, prerun); + if (this._redraw || this._resize) { + try { + if (this._renderer) { + if (this._resize) { + this._resize = 0; + resizeRenderer(this); + } + await this._renderer.renderAsync(this._scenegraph.root); + } + this._redraw = false; + } catch (e) { + this.error(e); + } + } + if (postrun) asyncCallback(this, postrun); + return this; }, - R_union: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; + dirty(item) { + this._redraw = true; + this._renderer && this._renderer.dirty(item); }, - R_intersect: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (hi < base[0] || base[1] < lo) return []; - else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } -}; -const DataPrefix = ':', IndexPrefix = '@'; -function selectionVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to selection functions must be a string literal.'); - const data = args[0].value, op = args.length >= 2 && (0, _vegaUtil.peek)(args).value, field = 'unit', indexName = IndexPrefix + field, dataName = DataPrefix + data; - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !(0, _vegaUtil.hasOwnProperty)(params, indexName)) params[indexName] = scope.getData(data).indataRef(scope, field); - // eslint-disable-next-line no-prototype-builtins - if (!(0, _vegaUtil.hasOwnProperty)(params, dataName)) params[dataName] = scope.getData(data).tuplesRef(); -} - -},{"d3-array":"5lCYW","vega-util":"f2ulH","vega-expression":"8Nghf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"boQgz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "context", ()=>context); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -/** - * Parse a serialized dataflow specification. - */ function parse(spec) { - const ctx = this, operators = spec.operators || []; - // parse background - if (spec.background) ctx.background = spec.background; - // parse event configuration - if (spec.eventConfig) ctx.eventConfig = spec.eventConfig; - // parse locale configuration - if (spec.locale) ctx.locale = spec.locale; - // parse operators - operators.forEach((entry)=>ctx.parseOperator(entry)); - // parse operator parameters - operators.forEach((entry)=>ctx.parseOperatorParameters(entry)); - // parse streams - (spec.streams || []).forEach((entry)=>ctx.parseStream(entry)); - // parse updates - (spec.updates || []).forEach((entry)=>ctx.parseUpdate(entry)); - return ctx.resolve(); -} -const Skip = (0, _vegaUtil.toSet)([ - 'rule' -]), Swap = (0, _vegaUtil.toSet)([ - 'group', - 'image', - 'rect' -]); -function adjustSpatial(encode, marktype) { - let code = ''; - if (Skip[marktype]) return code; - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - code += 'o.width=o.x2-o.x;'; - } else code += 'o.x=o.x2-(o.width||0);'; - } - if (encode.xc) code += 'o.x=o.xc-(o.width||0)/2;'; - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - code += 'o.height=o.y2-o.y;'; - } else code += 'o.y=o.y2-(o.height||0);'; - } - if (encode.yc) code += 'o.y=o.yc-(o.height||0)/2;'; - return code; -} -function canonicalType(type) { - return (type + '').toLowerCase(); -} -function isOperator(type) { - return canonicalType(type) === 'operator'; -} -function isCollect(type) { - return canonicalType(type) === 'collect'; -} -function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (!code.endsWith(';')) code = 'return(' + code + ');'; - const fn = Function(...args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; -} -// generate code for comparing a single field -function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; -} -var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ operator: (ctx, expr)=>expression(ctx, [ - '_' - ], expr.code), - /** - * Parse an expression provided as an operator parameter value. - */ parameter: (ctx, expr)=>expression(ctx, [ - 'datum', - '_' - ], expr.code), - /** - * Parse an expression applied to an event stream. - */ event: (ctx, expr)=>expression(ctx, [ - 'event' - ], expr.code), - /** - * Parse an expression used to handle an event-driven operator update. - */ handler: (ctx, expr)=>{ - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, [ - '_', - 'event' - ], code); + // -- GET / SET ---- + description(text2) { + if (arguments.length) { + const desc = text2 != null ? text2 + "" : null; + if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); + return this; + } + return this._desc; }, - /** - * Parse an expression that performs visual encoding. - */ encode: (ctx, encode)=>{ - const { marktype, channels } = encode; - let code = 'var o=item,datum=o.datum,m=0,$;'; - for(const name in channels){ - const o = 'o[' + (0, _vegaUtil.stringValue)(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - return expression(ctx, [ - 'item', - '_' - ], code); + container() { + return this._el; }, - /** - * Optimized code generators for access and comparison. - */ codegen: { - get (path) { - const ref = `[${path.map((0, _vegaUtil.stringValue)).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator (fields, orders) { - let t; - const map = (f, i)=>{ - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f' + i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } -}; -/** - * Parse a dataflow operator. - */ function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); - else ctx.transform(spec, spec.type); -} -/** - * Parse and assign operator parameters. - */ function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) (0, _vegaUtil.error)('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); - } -} -/** - * Parse a set of operator parameters. - */ function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - for(const key in spec){ - const value = spec[key]; - params[key] = (0, _vegaUtil.isArray)(value) ? value.map((v)=>parseParameter(v, ctx, params)) : parseParameter(value, ctx, params); - } - return params; -} -/** - * Parse a single parameter. - */ function parseParameter(spec, ctx, params) { - if (!spec || !(0, _vegaUtil.isObject)(spec)) return spec; - for(let i = 0, n = PARSERS.length, p; i < n; ++i){ - p = PARSERS[i]; - if ((0, _vegaUtil.hasOwnProperty)(spec, p.key)) return p.parse(spec, ctx, params); - } - return spec; -} -/** Reference parsers. */ var PARSERS = [ - { - key: '$ref', - parse: getOperator + scenegraph() { + return this._scenegraph; }, - { - key: '$key', - parse: getKey + origin() { + return this._origin.slice(); }, - { - key: '$expr', - parse: getExpression + signal(name, value2, options2) { + const op = lookupSignal(this, name); + return arguments.length === 1 ? op.value : this.update(op, value2, options2); }, - { - key: '$field', - parse: getField + width(_) { + return arguments.length ? this.signal("width", _) : this.signal("width"); }, - { - key: '$encode', - parse: getEncode + height(_) { + return arguments.length ? this.signal("height", _) : this.signal("height"); }, - { - key: '$compare', - parse: getCompare + padding(_) { + return arguments.length ? this.signal("padding", padding(_)) : padding(this.signal("padding")); }, - { - key: '$context', - parse: getContext + autosize(_) { + return arguments.length ? this.signal("autosize", _) : this.signal("autosize"); }, - { - key: '$subflow', - parse: getSubflow + background(_) { + return arguments.length ? this.signal("background", _) : this.signal("background"); }, - { - key: '$tupleid', - parse: getTupleId - } -]; -/** - * Resolve an operator reference. - */ function getOperator(_, ctx) { - return ctx.get(_.$ref) || (0, _vegaUtil.error)('Operator not defined: ' + _.$ref); -} -/** - * Resolve an expression reference. - */ function getExpression(_, ctx, params) { - if (_.$params) // parse expression parameters - ctx.parseParameters(_.$params, params); - const k = 'e:' + _.$expr.code; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.accessor)(ctx.parameterExpression(_.$expr), _.$fields)); -} -/** - * Resolve a key accessor reference. - */ function getKey(_, ctx) { - const k = 'k:' + _.$key + '_' + !!_.$flat; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.key)(_.$key, _.$flat, ctx.expr.codegen)); -} -/** - * Resolve a field accessor reference. - */ function getField(_, ctx) { - if (!_.$field) return null; - const k = 'f:' + _.$field + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.field)(_.$field, _.$name, ctx.expr.codegen)); -} -/** - * Resolve a comparator function reference. - */ function getCompare(_, ctx) { - // As of Vega 5.5.3, $tupleid sort is no longer used. - // Keep here for now for backwards compatibility. - const k = 'c:' + _.$compare + '_' + _.$order, c = (0, _vegaUtil.array)(_.$compare).map((_)=>_ && _.$tupleid ? (0, _vegaDataflow.tupleid) : _); - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.compare)(c, _.$order, ctx.expr.codegen)); -} -/** - * Resolve an encode operator reference. - */ function getEncode(_, ctx) { - const spec = _.$encode, encode = {}; - for(const name in spec){ - const enc = spec[name]; - encode[name] = (0, _vegaUtil.accessor)(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; -} -/** - * Resolve a context reference. - */ function getContext(_, ctx) { - return ctx; -} -/** - * Resolve a recursive subflow specification. - */ function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = ()=>ctx.detach(subctx); - return op; - }; -} -/** - * Resolve a tuple id reference. - */ function getTupleId() { - return 0, _vegaDataflow.tupleid; -} -/** - * Parse an event stream specification. - */ function parseStream(spec) { - var ctx = this, filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, stream = spec.stream != null ? ctx.get(spec.stream) : undefined, args; - if (spec.source) stream = ctx.events(spec.source, spec.type, filter); - else if (spec.merge) { - args = spec.merge.map((_)=>ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - if (spec.between) { - args = spec.between.map((_)=>ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - if (spec.filter) stream = stream.filter(filter); - if (spec.throttle != null) stream = stream.throttle(+spec.throttle); - if (spec.debounce != null) stream = stream.debounce(+spec.debounce); - if (stream == null) (0, _vegaUtil.error)('Invalid stream definition: ' + JSON.stringify(spec)); - if (spec.consume) stream.consume(true); - ctx.stream(spec, stream); -} -/** - * Parse an event-driven operator update. - */ function parseUpdate(spec) { - var ctx = this, srcid = (0, _vegaUtil.isObject)(srcid = spec.source) ? srcid.$ref : srcid, source = ctx.get(srcid), target = null, update = spec.update, params = undefined; - if (!source) (0, _vegaUtil.error)('Source not defined: ' + spec.source); - target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); - if (update && update.$expr) { - if (update.$params) params = ctx.parseParameters(update.$params); - update = ctx.handlerExpression(update.$expr); - } - ctx.update(spec, source, target, update, params); -} -const SKIP = { - skip: true -}; -function getState(options) { - var ctx = this, state = {}; - if (options.signals) { - var signals = state.signals = {}; - Object.keys(ctx.signals).forEach((key)=>{ - const op = ctx.signals[key]; - if (options.signals(key, op)) signals[key] = op.value; - }); - } - if (options.data) { - var data = state.data = {}; - Object.keys(ctx.data).forEach((key)=>{ - const dataset = ctx.data[key]; - if (options.data(key, dataset)) data[key] = dataset.input.value; - }); - } - if (ctx.subcontext && options.recurse !== false) state.subcontext = ctx.subcontext.map((ctx)=>ctx.getState(options)); - return state; -} -function setState(state) { - var ctx = this, df = ctx.dataflow, data = state.data, signals = state.signals; - Object.keys(signals || {}).forEach((key)=>{ - df.update(ctx.signals[key], signals[key], SKIP); - }); - Object.keys(data || {}).forEach((key)=>{ - df.pulse(ctx.data[key].input, df.changeset().remove((0, _vegaUtil.truthy)).insert(data[key])); - }); - (state.subcontext || []).forEach((substate, i)=>{ - const subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); -} -/** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ function context(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); -} -function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } -} -function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } -} -Context.prototype = Subcontext.prototype = { - fork () { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; + renderer(type2) { + if (!arguments.length) return this._renderType; + if (!renderModule(type2)) error("Unrecognized renderer type: " + type2); + if (type2 !== this._renderType) { + this._renderType = type2; + this._resetRenderer(); + } + return this; }, - detach (ctx) { - this.subcontext = this.subcontext.filter((c)=>c !== ctx); - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys)ctx.nodes[key]._targets = null; - for (const key of keys)ctx.nodes[key].detach(); - ctx.nodes = null; + tooltip(handler) { + if (!arguments.length) return this._tooltip; + if (handler !== this._tooltip) { + this._tooltip = handler; + this._resetRenderer(); + } + return this; }, - get (id) { - return this.nodes[id]; + loader(loader2) { + if (!arguments.length) return this._loader; + if (loader2 !== this._loader) { + Dataflow.prototype.loader.call(this, loader2); + this._resetRenderer(); + } + return this; }, - set (id, node) { - return this.nodes[id] = node; + resize() { + this._autosize = 1; + return this.touch(lookupSignal(this, "autosize")); }, - add (spec, op) { - const ctx = this, df = ctx.dataflow, data = spec.value; - ctx.set(spec.id, op); - if (isCollect(spec.type) && data) { - if (data.$ingest) df.ingest(op, data.$ingest, data.$format); - else if (data.$request) df.preload(op, data.$request, data.$format); - else df.pulse(op, df.changeset().insert(data)); - } - if (spec.root) ctx.root = op; - if (spec.parent) { - let p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [ - op - ]); - op.targets().add(p); - } else (ctx.unresolved = ctx.unresolved || []).push(()=>{ - p = ctx.get(spec.parent.$ref); - df.connect(p, [ - op - ]); - op.targets().add(p); - }); - } - if (spec.signal) ctx.signals[spec.signal] = op; - if (spec.scale) ctx.scales[spec.scale] = op; - if (spec.data) for(const name in spec.data){ - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach((role)=>data[role] = op); - } + _resetRenderer() { + if (this._renderer) { + this._renderer = null; + this.initialize(this._el, this._elBind); + } }, - resolve () { - (this.unresolved || []).forEach((fn)=>fn()); - delete this.unresolved; - return this; + // -- SIZING ---- + _resizeView: resizeView, + // -- EVENT HANDLING ---- + addEventListener(type2, handler, options2) { + let callback = handler; + if (!(options2 && options2.trap === false)) { + callback = trap(this, handler); + callback.raw = handler; + } + this._handler.on(type2, callback); + return this; }, - operator (spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); + removeEventListener(type2, handler) { + var handlers = this._handler.handlers(type2), i = handlers.length, h2, t; + while (--i >= 0) { + t = handlers[i].type; + h2 = handlers[i].handler; + if (type2 === t && (handler === h2 || handler === h2.raw)) { + this._handler.off(t, h2); + break; + } + } + return this; }, - transform (spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); + addResizeListener(handler) { + const l = this._resizeListeners; + if (!l.includes(handler)) { + l.push(handler); + } + return this; }, - stream (spec, stream) { - this.set(spec.id, stream); + removeResizeListener(handler) { + var l = this._resizeListeners, i = l.indexOf(handler); + if (i >= 0) { + l.splice(i, 1); + } + return this; }, - update (spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); + addSignalListener(name, handler) { + return addOperatorListener(this, name, lookupSignal(this, name), handler); }, - // expression parsing - operatorExpression (expr) { - return this.expr.operator(this, expr); + removeSignalListener(name, handler) { + return removeOperatorListener(this, lookupSignal(this, name), handler); }, - parameterExpression (expr) { - return this.expr.parameter(this, expr); + addDataListener(name, handler) { + return addOperatorListener(this, name, dataref(this, name).values, handler); }, - eventExpression (expr) { - return this.expr.event(this, expr); + removeDataListener(name, handler) { + return removeOperatorListener(this, dataref(this, name).values, handler); }, - handlerExpression (expr) { - return this.expr.handler(this, expr); + globalCursor(_) { + if (arguments.length) { + if (this._globalCursor !== !!_) { + const prev = setCursor(this, null); + this._globalCursor = !!_; + if (prev) setCursor(this, prev); + } + return this; + } else { + return this._globalCursor; + } }, - encodeExpression (encode) { - return this.expr.encode(this, encode); + preventDefault(_) { + if (arguments.length) { + this._preventDefault = _; + return this; + } else { + return this._preventDefault; + } }, - // parse methods - parse, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - // state methods + timer, + events, + finalize, + hover, + // -- DATA ---- + data, + change, + insert, + remove, + // -- SCALES -- + scale: scale$1, + // -- INITIALIZATION ---- + initialize, + // -- HEADLESS RENDERING ---- + toImageURL: renderToImageURL, + toCanvas: renderToCanvas, + toSVG: renderToSVG, + // -- SAVE / RESTORE STATE ---- getState, - setState -}; - -},{"vega-util":"f2ulH","vega-dataflow":"cFRfY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Bjyk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisDomainRole", ()=>AxisDomainRole); -parcelHelpers.export(exports, "AxisGridRole", ()=>AxisGridRole); -parcelHelpers.export(exports, "AxisLabelRole", ()=>AxisLabelRole); -parcelHelpers.export(exports, "AxisRole", ()=>AxisRole); -parcelHelpers.export(exports, "AxisTickRole", ()=>AxisTickRole); -parcelHelpers.export(exports, "AxisTitleRole", ()=>AxisTitleRole); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -parcelHelpers.export(exports, "FrameRole", ()=>FrameRole); -parcelHelpers.export(exports, "LegendEntryRole", ()=>LegendEntryRole); -parcelHelpers.export(exports, "LegendLabelRole", ()=>LegendLabelRole); -parcelHelpers.export(exports, "LegendRole", ()=>LegendRole); -parcelHelpers.export(exports, "LegendSymbolRole", ()=>LegendSymbolRole); -parcelHelpers.export(exports, "LegendTitleRole", ()=>LegendTitleRole); -parcelHelpers.export(exports, "MarkRole", ()=>MarkRole); -parcelHelpers.export(exports, "Scope", ()=>Scope); -parcelHelpers.export(exports, "ScopeRole", ()=>ScopeRole); -parcelHelpers.export(exports, "config", ()=>defaults); -parcelHelpers.export(exports, "parse", ()=>parse); -parcelHelpers.export(exports, "signal", ()=>parseSignal); -parcelHelpers.export(exports, "signalUpdates", ()=>parseSignalUpdates); -parcelHelpers.export(exports, "stream", ()=>parseStream); -var _vegaUtil = require("vega-util"); -var _vegaFunctions = require("vega-functions"); -var _vegaEventSelector = require("vega-event-selector"); -var _vegaScale = require("vega-scale"); -var _vegaDataflow = require("vega-dataflow"); -function parseAutosize(spec) { - return (0, _vegaUtil.isObject)(spec) ? spec : { - type: spec || 'pad' - }; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ + setState, + // RE-RENDER ON ZOOM + _watchPixelRatio: watchPixelRatio + }); + const VIEW = "view", LBRACK = "[", RBRACK = "]", LBRACE = "{", RBRACE = "}", COLON = ":", COMMA = ",", NAME = "@", GT = ">", ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { + "*": 1, + arc: 1, + area: 1, + group: 1, + image: 1, + line: 1, + path: 1, + rect: 1, + rule: 1, + shape: 1, + symbol: 1, + text: 1, + trail: 1 + }; + let DEFAULT_SOURCE, MARKS; + function eventSelector(selector, source2, marks) { + DEFAULT_SOURCE = source2 || VIEW; + MARKS = marks || DEFAULT_MARKS; + return parseMerge(selector.trim()).map(parseSelector); + } + function isMarkType(type2) { + return MARKS[type2]; + } + function find(s2, i, endChar, pushChar, popChar) { + const n = s2.length; + let count2 = 0, c2; + for (; i < n; ++i) { + c2 = s2[i]; + if (!count2 && c2 === endChar) return i; + else if (popChar && popChar.includes(c2)) --count2; + else if (pushChar && pushChar.includes(c2)) ++count2; + } + return i; + } + function parseMerge(s2) { + const output2 = [], n = s2.length; + let start = 0, i = 0; + while (i < n) { + i = find(s2, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); + output2.push(s2.substring(start, i).trim()); + start = ++i; + } + if (output2.length === 0) { + throw "Empty event selector: " + s2; + } + return output2; + } + function parseSelector(s2) { + return s2[0] === "[" ? parseBetween(s2) : parseStream$1(s2); + } + function parseBetween(s2) { + const n = s2.length; + let i = 1, b2; + i = find(s2, i, RBRACK, LBRACK, RBRACK); + if (i === n) { + throw "Empty between selector: " + s2; + } + b2 = parseMerge(s2.substring(1, i)); + if (b2.length !== 2) { + throw "Between selector must have two elements: " + s2; + } + s2 = s2.slice(i + 1).trim(); + if (s2[0] !== GT) { + throw "Expected '>' after between selector: " + s2; + } + b2 = b2.map(parseSelector); + const stream2 = parseSelector(s2.slice(1).trim()); + if (stream2.between) { + return { + between: b2, + stream: stream2 + }; + } else { + stream2.between = b2; + } + return stream2; + } + function parseStream$1(s2) { + const stream2 = { + source: DEFAULT_SOURCE + }, source2 = []; + let throttle = [0, 0], markname = 0, start = 0, n = s2.length, i = 0, j, filter2; + if (s2[n - 1] === RBRACE) { + i = s2.lastIndexOf(LBRACE); + if (i >= 0) { + try { + throttle = parseThrottle(s2.substring(i + 1, n - 1)); + } catch (e) { + throw "Invalid throttle specification: " + s2; + } + s2 = s2.slice(0, i).trim(); + n = s2.length; + } else throw "Unmatched right brace: " + s2; + i = 0; + } + if (!n) throw s2; + if (s2[0] === NAME) markname = ++i; + j = find(s2, i, COLON); + if (j < n) { + source2.push(s2.substring(start, j).trim()); + start = i = ++j; + } + i = find(s2, i, LBRACK); + if (i === n) { + source2.push(s2.substring(start, n).trim()); + } else { + source2.push(s2.substring(start, i).trim()); + filter2 = []; + start = ++i; + if (start === n) throw "Unmatched left bracket: " + s2; + } + while (i < n) { + i = find(s2, i, RBRACK); + if (i === n) throw "Unmatched left bracket: " + s2; + filter2.push(s2.substring(start, i).trim()); + if (i < n - 1 && s2[++i] !== LBRACK) throw "Expected left bracket: " + s2; + start = ++i; + } + if (!(n = source2.length) || ILLEGAL.test(source2[n - 1])) { + throw "Invalid event selector: " + s2; + } + if (n > 1) { + stream2.type = source2[1]; + if (markname) { + stream2.markname = source2[0].slice(1); + } else if (isMarkType(source2[0])) { + stream2.marktype = source2[0]; + } else { + stream2.source = source2[0]; + } + } else { + stream2.type = source2[0]; + } + if (stream2.type.slice(-1) === "!") { + stream2.consume = true; + stream2.type = stream2.type.slice(0, -1); + } + if (filter2 != null) stream2.filter = filter2; + if (throttle[0]) stream2.throttle = throttle[0]; + if (throttle[1]) stream2.debounce = throttle[1]; + return stream2; + } + function parseThrottle(s2) { + const a2 = s2.split(COMMA); + if (!s2.length || a2.length > 2) throw s2; + return a2.map((_) => { + const x2 = +_; + if (x2 !== x2) throw s2; + return x2; }); -function parsePadding(spec) { - return !(0, _vegaUtil.isObject)(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { - top: number(spec.top), - bottom: number(spec.bottom), - left: number(spec.left), - right: number(spec.right) - }; -} -const encoder = (_)=>(0, _vegaUtil.isObject)(_) && !(0, _vegaUtil.isArray)(_) ? (0, _vegaUtil.extend)({}, _) : { - value: _ - }; -function addEncode(object, name, value, set) { - if (value != null) { - const isEncoder = (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isArray)(value) || (0, _vegaUtil.isArray)(value) && value.length && (0, _vegaUtil.isObject)(value[0]); - // Always assign signal to update, even if the signal is from the enter block - if (isEncoder) object.update[name] = value; - else object[set || 'enter'][name] = { - value: value + } + function parseAutosize(spec) { + return isObject(spec) ? spec : { + type: spec || "pad" + }; + } + const number = (_) => +_ || 0; + const paddingObject = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function parsePadding(spec) { + return !isObject(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { + top: number(spec.top), + bottom: number(spec.bottom), + left: number(spec.left), + right: number(spec.right) + }; + } + const encoder = (_) => isObject(_) && !isArray(_) ? extend({}, _) : { + value: _ + }; + function addEncode(object2, name, value2, set2) { + if (value2 != null) { + const isEncoder = isObject(value2) && !isArray(value2) || isArray(value2) && value2.length && isObject(value2[0]); + if (isEncoder) { + object2.update[name] = value2; + } else { + object2[set2 || "enter"][name] = { + value: value2 }; - return 1; - } else return 0; -} -function addEncoders(object, enter, update) { - for(const name in enter)addEncode(object, name, enter[name]); - for(const name in update)addEncode(object, name, update[name], 'update'); -} -function extendEncode(encode, extra, skip) { - for(const name in extra){ - if (skip && (0, _vegaUtil.hasOwnProperty)(skip, name)) continue; - encode[name] = (0, _vegaUtil.extend)(encode[name] || {}, extra[name]); - } - return encode; -} -function has(key, encode) { - return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]); -} -const MarkRole = 'mark'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const AxisRole = 'axis'; -const AxisDomainRole = 'axis-domain'; -const AxisGridRole = 'axis-grid'; -const AxisLabelRole = 'axis-label'; -const AxisTickRole = 'axis-tick'; -const AxisTitleRole = 'axis-title'; -const LegendRole = 'legend'; -const LegendBandRole = 'legend-band'; -const LegendEntryRole = 'legend-entry'; -const LegendGradientRole = 'legend-gradient'; -const LegendLabelRole = 'legend-label'; -const LegendSymbolRole = 'legend-symbol'; -const LegendTitleRole = 'legend-title'; -const TitleRole = 'title'; -const TitleTextRole = 'title-text'; -const TitleSubtitleRole = 'title-subtitle'; -function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) applyDefault(defaults, key, config[key]); - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) role = null; - // resolve mark config - props = role === FrameRole ? config.group : role === MarkRole ? (0, _vegaUtil.extend)({}, config.mark, config[type]) : null; - for(key in props){ - // do not apply defaults if relevant fields are defined - skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode)); - if (!skip) applyDefault(defaults, key, props[key]); - } - // resolve styles, apply with increasing precedence - (0, _vegaUtil.array)(style).forEach((name)=>{ - const props = config.style && config.style[name]; - for(const key in props)if (!has(key, encode)) applyDefault(defaults, key, props[key]); + } + return 1; + } else { + return 0; + } + } + function addEncoders(object2, enter, update2) { + for (const name in enter) { + addEncode(object2, name, enter[name]); + } + for (const name in update2) { + addEncode(object2, name, update2[name], "update"); + } + } + function extendEncode(encode2, extra, skip) { + for (const name in extra) { + if (skip && has$1(skip, name)) continue; + encode2[name] = extend(encode2[name] || {}, extra[name]); + } + return encode2; + } + function has(key2, encode2) { + return encode2 && (encode2.enter && encode2.enter[key2] || encode2.update && encode2.update[key2]); + } + const MarkRole = "mark"; + const FrameRole = "frame"; + const ScopeRole = "scope"; + const AxisRole = "axis"; + const AxisDomainRole = "axis-domain"; + const AxisGridRole = "axis-grid"; + const AxisLabelRole = "axis-label"; + const AxisTickRole = "axis-tick"; + const AxisTitleRole = "axis-title"; + const LegendRole = "legend"; + const LegendBandRole = "legend-band"; + const LegendEntryRole = "legend-entry"; + const LegendGradientRole = "legend-gradient"; + const LegendLabelRole = "legend-label"; + const LegendSymbolRole = "legend-symbol"; + const LegendTitleRole = "legend-title"; + const TitleRole = "title"; + const TitleTextRole = "title-text"; + const TitleSubtitleRole = "title-subtitle"; + function applyDefaults(encode2, type2, role, style2, config) { + const defaults2 = {}, enter = {}; + let update2, key2, skip, props; + key2 = "lineBreak"; + if (type2 === "text" && config[key2] != null && !has(key2, encode2)) { + applyDefault(defaults2, key2, config[key2]); + } + if (role == "legend" || String(role).startsWith("axis")) { + role = null; + } + props = role === FrameRole ? config.group : role === MarkRole ? extend({}, config.mark, config[type2]) : null; + for (key2 in props) { + skip = has(key2, encode2) || (key2 === "fill" || key2 === "stroke") && (has("fill", encode2) || has("stroke", encode2)); + if (!skip) applyDefault(defaults2, key2, props[key2]); + } + array$4(style2).forEach((name) => { + const props2 = config.style && config.style[name]; + for (const key3 in props2) { + if (!has(key3, encode2)) { + applyDefault(defaults2, key3, props2[key3]); + } + } }); - encode = (0, _vegaUtil.extend)({}, encode); // defensive copy - for(key in defaults){ - props = defaults[key]; - if (props.signal) (update = update || {})[key] = props; - else enter[key] = props; - } - encode.enter = (0, _vegaUtil.extend)(enter, encode.enter); - if (update) encode.update = (0, _vegaUtil.extend)(update, encode.update); - return encode; -} -function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal ? { - signal: value.signal + encode2 = extend({}, encode2); + for (key2 in defaults2) { + props = defaults2[key2]; + if (props.signal) { + (update2 = update2 || {})[key2] = props; + } else { + enter[key2] = props; + } + } + encode2.enter = extend(enter, encode2.enter); + if (update2) encode2.update = extend(update2, encode2.update); + return encode2; + } + function applyDefault(defaults2, key2, value2) { + defaults2[key2] = value2 && value2.signal ? { + signal: value2.signal } : { - value: value - }; -} -const scaleRef = (scale)=>(0, _vegaUtil.isString)(scale) ? (0, _vegaUtil.stringValue)(scale) : scale.signal ? `(${scale.signal})` : field(scale); -function entry$1(enc) { - if (enc.gradient != null) return gradient(enc); - let value = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? (0, _vegaUtil.stringValue)(enc.value) : undefined; - if (enc.scale != null) value = scale(enc, value); - if (value === undefined) value = null; - if (enc.exponent != null) value = `pow(${value},${property(enc.exponent)})`; - if (enc.mult != null) value += `*${property(enc.mult)}`; - if (enc.offset != null) value += `+${property(enc.offset)}`; - if (enc.round) value = `round(${value})`; - return value; -} -const _color = (type, x, y, z)=>`(${type}(${[ - x, - y, - z - ].map(entry$1).join(',')})+'')`; -function color(enc) { - return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null; -} -function gradient(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [ - enc.start, - enc.stop, - enc.count - ].map((_)=>_ == null ? null : (0, _vegaUtil.stringValue)(_)); - // trim null inputs from the end - while(args.length && (0, _vegaUtil.peek)(args) == null)args.pop(); + value: value2 + }; + } + const scaleRef = (scale2) => isString(scale2) ? $(scale2) : scale2.signal ? `(${scale2.signal})` : field(scale2); + function entry$1(enc) { + if (enc.gradient != null) { + return gradient(enc); + } + let value2 = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== void 0 ? $(enc.value) : void 0; + if (enc.scale != null) { + value2 = scale(enc, value2); + } + if (value2 === void 0) { + value2 = null; + } + if (enc.exponent != null) { + value2 = `pow(${value2},${property(enc.exponent)})`; + } + if (enc.mult != null) { + value2 += `*${property(enc.mult)}`; + } + if (enc.offset != null) { + value2 += `+${property(enc.offset)}`; + } + if (enc.round) { + value2 = `round(${value2})`; + } + return value2; + } + const _color = (type2, x2, y2, z2) => `(${type2}(${[x2, y2, z2].map(entry$1).join(",")})+'')`; + function color(enc) { + return enc.c ? _color("hcl", enc.h, enc.c, enc.l) : enc.h || enc.s ? _color("hsl", enc.h, enc.s, enc.l) : enc.l || enc.a ? _color("lab", enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color("rgb", enc.r, enc.g, enc.b) : null; + } + function gradient(enc) { + const args = [enc.start, enc.stop, enc.count].map((_) => _ == null ? null : $(_)); + while (args.length && peek$1(args) == null) args.pop(); args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; -} -function property(property) { - return (0, _vegaUtil.isObject)(property) ? '(' + entry$1(property) + ')' : property; -} -function field(ref) { - return resolveField((0, _vegaUtil.isObject)(ref) ? ref : { - datum: ref + return `gradient(${args.join(",")})`; + } + function property(property2) { + return isObject(property2) ? "(" + entry$1(property2) + ")" : property2; + } + function field(ref2) { + return resolveField(isObject(ref2) ? ref2 : { + datum: ref2 }); -} -function resolveField(ref) { - let object, level, field; - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - while(level-- > 0)object += '.mark.group'; - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else field = ref.group; - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else (0, _vegaUtil.error)('Invalid field reference: ' + (0, _vegaUtil.stringValue)(ref)); - if (!ref.signal) field = (0, _vegaUtil.isString)(field) ? (0, _vegaUtil.splitAccessPath)(field).map((0, _vegaUtil.stringValue)).join('][') : resolveField(field); - return object + '[' + field + ']'; -} -function scale(enc, value) { - const scale = scaleRef(enc.scale); - if (enc.range != null) // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - if (enc.band) { - value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + property(enc.band)); - if (enc.extra) // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - if (value == null) value = '0'; - } - return value; -} -function rule(enc) { - let code = ''; - enc.forEach((rule)=>{ - const value = entry$1(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; + } + function resolveField(ref2) { + let object2, level, field2; + if (ref2.signal) { + object2 = "datum"; + field2 = ref2.signal; + } else if (ref2.group || ref2.parent) { + level = Math.max(1, ref2.level || 1); + object2 = "item"; + while (level-- > 0) { + object2 += ".mark.group"; + } + if (ref2.parent) { + field2 = ref2.parent; + object2 += ".datum"; + } else { + field2 = ref2.group; + } + } else if (ref2.datum) { + object2 = "datum"; + field2 = ref2.datum; + } else { + error("Invalid field reference: " + $(ref2)); + } + if (!ref2.signal) { + field2 = isString(field2) ? splitAccessPath(field2).map($).join("][") : resolveField(field2); + } + return object2 + "[" + field2 + "]"; + } + function scale(enc, value2) { + const scale2 = scaleRef(enc.scale); + if (enc.range != null) { + value2 = `lerp(_range(${scale2}), ${+enc.range})`; + } else { + if (value2 !== void 0) value2 = `_scale(${scale2}, ${value2})`; + if (enc.band) { + value2 = (value2 ? value2 + "+" : "") + `_bandwidth(${scale2})` + (+enc.band === 1 ? "" : "*" + property(enc.band)); + if (enc.extra) { + value2 = `(datum.extra ? _scale(${scale2}, datum.extra.value) : ${value2})`; + } + } + if (value2 == null) value2 = "0"; + } + return value2; + } + function rule(enc) { + let code = ""; + enc.forEach((rule2) => { + const value2 = entry$1(rule2); + code += rule2.test ? `(${rule2.test})?${value2}:` : value2; }); - // if no else clause, terminate with null (#1366) - if ((0, _vegaUtil.peek)(code) === ':') code += 'null'; + if (peek$1(code) === ":") { + code += "null"; + } return code; -} -function parseEncode(encode, type, role, style, scope, params) { + } + function parseEncode(encode2, type2, role, style2, scope, params2) { const enc = {}; - params = params || {}; - params.encoders = { - $encode: enc - }; - encode = applyDefaults(encode, type, role, style, scope.config); - for(const key in encode)enc[key] = parseBlock(encode[key], type, params, scope); - return params; -} -function parseBlock(block, marktype, params, scope) { + params2 = params2 || {}; + params2.encoders = { + $encode: enc + }; + encode2 = applyDefaults(encode2, type2, role, style2, scope.config); + for (const key2 in encode2) { + enc[key2] = parseBlock(encode2[key2], type2, params2, scope); + } + return params2; + } + function parseBlock(block, marktype, params2, scope) { const channels = {}, fields = {}; - for(const name in block)if (block[name] != null) // skip any null entries - channels[name] = parse$1(expr(block[name]), scope, params, fields); + for (const name in block) { + if (block[name] != null) { + channels[name] = parse$1(expr(block[name]), scope, params2, fields); + } + } return { - $expr: { - marktype, - channels - }, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; -} -function expr(enc) { - return (0, _vegaUtil.isArray)(enc) ? rule(enc) : entry$1(enc); -} -function parse$1(code, scope, params, fields) { - const expr = (0, _vegaFunctions.parseExpression)(code, scope); - expr.$fields.forEach((name)=>fields[name] = 1); - (0, _vegaUtil.extend)(params, expr.$params); - return expr.$expr; -} -const OUTER = 'outer', OUTER_INVALID = [ - 'value', - 'update', - 'init', - 'react', - 'bind' -]; -function outerError(prefix, name) { - (0, _vegaUtil.error)(prefix + ' for "outer" push: ' + (0, _vegaUtil.stringValue)(name)); -} -function parseSignal(signal, scope) { + $expr: { + marktype, + channels + }, + $fields: Object.keys(fields), + $output: Object.keys(block) + }; + } + function expr(enc) { + return isArray(enc) ? rule(enc) : entry$1(enc); + } + function parse$1(code, scope, params2, fields) { + const expr2 = parser(code, scope); + expr2.$fields.forEach((name) => fields[name] = 1); + extend(params2, expr2.$params); + return expr2.$expr; + } + const OUTER = "outer", OUTER_INVALID = ["value", "update", "init", "react", "bind"]; + function outerError(prefix, name) { + error(prefix + ' for "outer" push: ' + $(name)); + } + function parseSignal(signal, scope) { const name = signal.name; if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach((prop)=>{ - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); + if (!scope.signals[name]) outerError("No prior signal definition", name); + OUTER_INVALID.forEach((prop) => { + if (signal[prop] !== void 0) outerError("Invalid property ", prop); + }); } else { - // define a new signal in the current scope - const op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); + const op = scope.addSignal(name, signal.value); + if (signal.react === false) op.react = false; + if (signal.bind) scope.addBinding(name, signal.bind); } -} -function Entry(type, value, params, parent) { + } + function Entry(type2, value2, params2, parent) { this.id = -1; - this.type = type; - this.value = value; - this.params = params; + this.type = type2; + this.value = value2; + this.params = params2; if (parent) this.parent = parent; -} -function entry(type, value, params, parent) { - return new Entry(type, value, params, parent); -} -function operator(value, params) { - return entry('operator', value, params); -} -// ----- -function ref(op) { - const ref = { - $ref: op.id - }; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; -} -function fieldRef$1(field, name) { + } + function entry(type2, value2, params2, parent) { + return new Entry(type2, value2, params2, parent); + } + function operator(value2, params2) { + return entry("operator", value2, params2); + } + function ref(op) { + const ref2 = { + $ref: op.id + }; + if (op.id < 0) (op.refs = op.refs || []).push(ref2); + return ref2; + } + function fieldRef$1(field2, name) { return name ? { - $field: field, - $name: name + $field: field2, + $name: name } : { - $field: field + $field: field2 }; -} -const keyFieldRef = fieldRef$1('key'); -function compareRef(fields, orders) { + } + const keyFieldRef = fieldRef$1("key"); + function compareRef(fields, orders) { return { - $compare: fields, - $order: orders - }; -} -function keyRef(fields, flat) { - const ref = { - $key: fields - }; - if (flat) ref.$flat = true; - return ref; -} -// ----- -const Ascending = 'ascending'; -const Descending = 'descending'; -function sortKey(sort) { - return !(0, _vegaUtil.isObject)(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field); -} -function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || ''); -} -// ----- -const Scope$1 = 'scope'; -const View = 'view'; -function isSignal(_) { + $compare: fields, + $order: orders + }; + } + function keyRef(fields, flat) { + const ref2 = { + $key: fields + }; + if (flat) ref2.$flat = true; + return ref2; + } + const Ascending = "ascending"; + const Descending = "descending"; + function sortKey(sort2) { + return !isObject(sort2) ? "" : (sort2.order === Descending ? "-" : "+") + aggrField(sort2.op, sort2.field); + } + function aggrField(op, field2) { + return (op && op.signal ? "$" + op.signal : op || "") + (op && field2 ? "_" : "") + (field2 && field2.signal ? "$" + field2.signal : field2 || ""); + } + const Scope$1 = "scope"; + const View = "view"; + function isSignal(_) { return _ && _.signal; -} -function isExpr$1(_) { + } + function isExpr$1(_) { return _ && _.expr; -} -function hasSignal(_) { + } + function hasSignal(_) { if (isSignal(_)) return true; - if ((0, _vegaUtil.isObject)(_)) for(const key in _){ - if (hasSignal(_[key])) return true; + if (isObject(_)) for (const key2 in _) { + if (hasSignal(_[key2])) return true; } return false; -} -function value(specValue, defaultValue) { + } + function value(specValue, defaultValue) { return specValue != null ? specValue : defaultValue; -} -function deref(v) { + } + function deref(v) { return v && v.signal || v; -} -const Timer = 'timer'; -function parseStream(stream, scope) { - const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : (0, _vegaUtil.error)('Invalid stream specification: ' + (0, _vegaUtil.stringValue)(stream)); - return method(stream, scope); -} -function eventSource(source) { - return source === Scope$1 ? View : source || View; -} -function mergeStream(stream, scope) { - const list = stream.merge.map((s)=>parseStream(s, scope)), entry = streamParameters({ - merge: list - }, stream, scope); - return scope.addStream(entry).id; -} -function nestedStream(stream, scope) { - const id = parseStream(stream.stream, scope), entry = streamParameters({ - stream: id - }, stream, scope); - return scope.addStream(entry).id; -} -function eventStream(stream, scope) { - let id; - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = { - between: stream.between, - filter: stream.filter - }; - } else id = scope.event(eventSource(stream.source), stream.type); - const entry = streamParameters({ - stream: id - }, stream, scope); - return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id; -} -function streamParameters(entry, stream, scope) { - let param = stream.between; - if (param) { - if (param.length !== 2) (0, _vegaUtil.error)('Stream "between" parameter must have 2 entries: ' + (0, _vegaUtil.stringValue)(stream)); - entry.between = [ - parseStream(param[0], scope), - parseStream(param[1], scope) - ]; + } + const Timer = "timer"; + function parseStream(stream2, scope) { + const method2 = stream2.merge ? mergeStream : stream2.stream ? nestedStream : stream2.type ? eventStream : error("Invalid stream specification: " + $(stream2)); + return method2(stream2, scope); + } + function eventSource(source2) { + return source2 === Scope$1 ? View : source2 || View; + } + function mergeStream(stream2, scope) { + const list = stream2.merge.map((s2) => parseStream(s2, scope)), entry2 = streamParameters({ + merge: list + }, stream2, scope); + return scope.addStream(entry2).id; + } + function nestedStream(stream2, scope) { + const id2 = parseStream(stream2.stream, scope), entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return scope.addStream(entry2).id; + } + function eventStream(stream2, scope) { + let id2; + if (stream2.type === Timer) { + id2 = scope.event(Timer, stream2.throttle); + stream2 = { + between: stream2.between, + filter: stream2.filter + }; + } else { + id2 = scope.event(eventSource(stream2.source), stream2.type); + } + const entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return Object.keys(entry2).length === 1 ? id2 : scope.addStream(entry2).id; + } + function streamParameters(entry2, stream2, scope) { + let param2 = stream2.between; + if (param2) { + if (param2.length !== 2) { + error('Stream "between" parameter must have 2 entries: ' + $(stream2)); + } + entry2.between = [parseStream(param2[0], scope), parseStream(param2[1], scope)]; + } + param2 = stream2.filter ? [].concat(stream2.filter) : []; + if (stream2.marktype || stream2.markname || stream2.markrole) { + param2.push(filterMark(stream2.marktype, stream2.markname, stream2.markrole)); + } + if (stream2.source === Scope$1) { + param2.push("inScope(event.item)"); + } + if (param2.length) { + entry2.filter = parser("(" + param2.join(")&&(") + ")", scope).$expr; + } + if ((param2 = stream2.throttle) != null) { + entry2.throttle = +param2; + } + if ((param2 = stream2.debounce) != null) { + entry2.debounce = +param2; + } + if (stream2.consume) { + entry2.consume = true; } - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - if (stream.source === Scope$1) // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - if (param.length) entry.filter = (0, _vegaFunctions.parseExpression)('(' + param.join(')&&(') + ')', scope).$expr; - if ((param = stream.throttle) != null) entry.throttle = +param; - if ((param = stream.debounce) != null) entry.debounce = +param; - if (stream.consume) entry.consume = true; - return entry; -} -function filterMark(type, name, role) { - const item = 'event.item'; - return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); -} -// bypass expression parser for internal operator references -const OP_VALUE_EXPR = { - code: '_.$value', + return entry2; + } + function filterMark(type2, name, role) { + const item = "event.item"; + return item + (type2 && type2 !== "*" ? "&&" + item + ".mark.marktype==='" + type2 + "'" : "") + (role ? "&&" + item + ".mark.role==='" + role + "'" : "") + (name ? "&&" + item + ".mark.name==='" + name + "'" : ""); + } + const OP_VALUE_EXPR = { + code: "_.$value", ast: { - type: 'Identifier', - value: 'value' - } -}; -function parseUpdate(spec, scope, target) { - const encode = spec.encode, entry = { - target: target - }; - let events = spec.events, update = spec.update, sources = []; - if (!events) (0, _vegaUtil.error)('Signal update missing events specification.'); - // interpret as an event selector string - if ((0, _vegaUtil.isString)(events)) events = (0, _vegaEventSelector.parseSelector)(events, scope.isSubscope() ? Scope$1 : View); - // separate event streams from signal updates - events = (0, _vegaUtil.array)(events).filter((s)=>s.signal || s.scale ? (sources.push(s), 0) : 1); - // merge internal operator listeners - if (sources.length > 1) sources = [ - mergeSources(sources) - ]; - // merge event streams, include as source - if (events.length) sources.push(events.length > 1 ? { - merge: events - } : events[0]); - if (encode != null) { - if (update) (0, _vegaUtil.error)('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + (0, _vegaUtil.stringValue)(encode) + ')'; - } - // resolve update value - entry.update = (0, _vegaUtil.isString)(update) ? (0, _vegaFunctions.parseExpression)(update, scope) : update.expr != null ? (0, _vegaFunctions.parseExpression)(update.expr, scope) : update.value != null ? update.value : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: { - $value: scope.signalRef(update.signal) - } - } : (0, _vegaUtil.error)('Invalid signal update specification.'); - if (spec.force) entry.options = { + type: "Identifier", + value: "value" + } + }; + function parseUpdate(spec, scope, target2) { + const encode2 = spec.encode, entry2 = { + target: target2 + }; + let events2 = spec.events, update2 = spec.update, sources = []; + if (!events2) { + error("Signal update missing events specification."); + } + if (isString(events2)) { + events2 = eventSelector(events2, scope.isSubscope() ? Scope$1 : View); + } + events2 = array$4(events2).filter((s2) => s2.signal || s2.scale ? (sources.push(s2), 0) : 1); + if (sources.length > 1) { + sources = [mergeSources(sources)]; + } + if (events2.length) { + sources.push(events2.length > 1 ? { + merge: events2 + } : events2[0]); + } + if (encode2 != null) { + if (update2) error("Signal encode and update are mutually exclusive."); + update2 = "encode(item()," + $(encode2) + ")"; + } + entry2.update = isString(update2) ? parser(update2, scope) : update2.expr != null ? parser(update2.expr, scope) : update2.value != null ? update2.value : update2.signal != null ? { + $expr: OP_VALUE_EXPR, + $params: { + $value: scope.signalRef(update2.signal) + } + } : error("Invalid signal update specification."); + if (spec.force) { + entry2.options = { force: true - }; - sources.forEach((source)=>scope.addUpdate((0, _vegaUtil.extend)(streamSource(source, scope), entry))); -} -function streamSource(stream, scope) { + }; + } + sources.forEach((source2) => scope.addUpdate(extend(streamSource(source2, scope), entry2))); + } + function streamSource(stream2, scope) { return { - source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream(stream, scope) + source: stream2.signal ? scope.signalRef(stream2.signal) : stream2.scale ? scope.scaleRef(stream2.scale) : parseStream(stream2, scope) }; -} -function mergeSources(sources) { + } + function mergeSources(sources) { return { - signal: '[' + sources.map((s)=>s.scale ? 'scale("' + s.scale + '")' : s.signal) + ']' + signal: "[" + sources.map((s2) => s2.scale ? 'scale("' + s2.scale + '")' : s2.signal) + "]" }; -} -function parseSignalUpdates(signal, scope) { + } + function parseSignalUpdates(signal, scope) { const op = scope.getSignal(signal.name); - let expr = signal.update; + let expr2 = signal.update; if (signal.init) { - if (expr) (0, _vegaUtil.error)('Signals can not include both init and update expressions.'); - else { - expr = signal.init; - op.initonly = true; - } - } - if (expr) { - expr = (0, _vegaFunctions.parseExpression)(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - if (signal.on) signal.on.forEach((_)=>parseUpdate(_, scope, op.id)); -} -const transform = (name)=>(params, value, parent)=>entry(name, value, params || undefined, parent); -const Aggregate = transform('aggregate'); -const AxisTicks = transform('axisticks'); -const Bound = transform('bound'); -const Collect = transform('collect'); -const Compare = transform('compare'); -const DataJoin = transform('datajoin'); -const Encode = transform('encode'); -const Expression = transform('expression'); -const Facet = transform('facet'); -const Field = transform('field'); -const Key = transform('key'); -const LegendEntries = transform('legendentries'); -const Load = transform('load'); -const Mark = transform('mark'); -const MultiExtent = transform('multiextent'); -const MultiValues = transform('multivalues'); -const Overlap = transform('overlap'); -const Params = transform('params'); -const PreFacet = transform('prefacet'); -const Projection = transform('projection'); -const Proxy = transform('proxy'); -const Relay = transform('relay'); -const Render = transform('render'); -const Scale = transform('scale'); -const Sieve = transform('sieve'); -const SortItems = transform('sortitems'); -const ViewLayout = transform('viewlayout'); -const Values = transform('values'); -let FIELD_REF_ID = 0; -const MULTIDOMAIN_SORT_OPS = { - min: 'min', - max: 'max', - count: 'sum' -}; -function initScale(spec, scope) { - const type = spec.type || 'linear'; - if (!(0, _vegaScale.isValidScaleType)(type)) (0, _vegaUtil.error)('Unrecognized scale type: ' + (0, _vegaUtil.stringValue)(type)); + if (expr2) { + error("Signals can not include both init and update expressions."); + } else { + expr2 = signal.init; + op.initonly = true; + } + } + if (expr2) { + expr2 = parser(expr2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + if (signal.on) { + signal.on.forEach((_) => parseUpdate(_, scope, op.id)); + } + } + const transform = (name) => (params2, value2, parent) => entry(name, value2, params2 || void 0, parent); + const Aggregate = transform("aggregate"); + const AxisTicks = transform("axisticks"); + const Bound = transform("bound"); + const Collect = transform("collect"); + const Compare = transform("compare"); + const DataJoin = transform("datajoin"); + const Encode = transform("encode"); + const Expression = transform("expression"); + const Facet = transform("facet"); + const Field = transform("field"); + const Key = transform("key"); + const LegendEntries = transform("legendentries"); + const Load = transform("load"); + const Mark = transform("mark"); + const MultiExtent = transform("multiextent"); + const MultiValues = transform("multivalues"); + const Overlap = transform("overlap"); + const Params = transform("params"); + const PreFacet = transform("prefacet"); + const Projection = transform("projection"); + const Proxy = transform("proxy"); + const Relay = transform("relay"); + const Render = transform("render"); + const Scale = transform("scale"); + const Sieve = transform("sieve"); + const SortItems = transform("sortitems"); + const ViewLayout = transform("viewlayout"); + const Values = transform("values"); + let FIELD_REF_ID = 0; + const MULTIDOMAIN_SORT_OPS = { + min: "min", + max: "max", + count: "sum" + }; + function initScale(spec, scope) { + const type2 = spec.type || "linear"; + if (!isValidScaleType(type2)) { + error("Unrecognized scale type: " + $(type2)); + } scope.addScale(spec.name, { - type, - domain: undefined + type: type2, + domain: void 0 }); -} -function parseScale(spec, scope) { - const params = scope.getScale(spec.name).params; - let key; - params.domain = parseScaleDomain(spec.domain, spec, scope); - if (spec.range != null) params.range = parseScaleRange(spec, scope, params); - if (spec.interpolate != null) parseScaleInterpolate(spec.interpolate, params); - if (spec.nice != null) params.nice = parseScaleNice(spec.nice, scope); - if (spec.bins != null) params.bins = parseScaleBins(spec.bins, scope); - for(key in spec){ - if ((0, _vegaUtil.hasOwnProperty)(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } -} -function parseLiteral(v, scope) { - return !(0, _vegaUtil.isObject)(v) ? v : v.signal ? scope.signalRef(v.signal) : (0, _vegaUtil.error)('Unsupported object: ' + (0, _vegaUtil.stringValue)(v)); -} -function parseArray(v, scope) { - return v.signal ? scope.signalRef(v.signal) : v.map((v)=>parseLiteral(v, scope)); -} -function dataLookupError(name) { - (0, _vegaUtil.error)('Can not find data set: ' + (0, _vegaUtil.stringValue)(name)); -} -// -- SCALE DOMAIN ---- -function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) (0, _vegaUtil.error)('No scale domain defined for domainMin/domainMax to override.'); - return; // default domain - } - return domain.signal ? scope.signalRef(domain.signal) : ((0, _vegaUtil.isArray)(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope); -} -function explicitDomain(domain, spec, scope) { - return domain.map((v)=>parseLiteral(v, scope)); -} -function singularDomain(domain, spec, scope) { - const data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - return (0, _vegaScale.isDiscrete)(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : (0, _vegaScale.isQuantile)(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field); -} -function multipleDomain(domain, spec, scope) { - const data = domain.data, fields = domain.fields.reduce((dom, d)=>{ - d = (0, _vegaUtil.isString)(d) ? { - data: data, - field: d - } : (0, _vegaUtil.isArray)(d) || d.signal ? fieldRef(d, scope) : d; - dom.push(d); - return dom; + } + function parseScale(spec, scope) { + const params2 = scope.getScale(spec.name).params; + let key2; + params2.domain = parseScaleDomain(spec.domain, spec, scope); + if (spec.range != null) { + params2.range = parseScaleRange(spec, scope, params2); + } + if (spec.interpolate != null) { + parseScaleInterpolate(spec.interpolate, params2); + } + if (spec.nice != null) { + params2.nice = parseScaleNice(spec.nice, scope); + } + if (spec.bins != null) { + params2.bins = parseScaleBins(spec.bins, scope); + } + for (key2 in spec) { + if (has$1(params2, key2) || key2 === "name") continue; + params2[key2] = parseLiteral(spec[key2], scope); + } + } + function parseLiteral(v, scope) { + return !isObject(v) ? v : v.signal ? scope.signalRef(v.signal) : error("Unsupported object: " + $(v)); + } + function parseArray(v, scope) { + return v.signal ? scope.signalRef(v.signal) : v.map((v2) => parseLiteral(v2, scope)); + } + function dataLookupError(name) { + error("Can not find data set: " + $(name)); + } + function parseScaleDomain(domain2, spec, scope) { + if (!domain2) { + if (spec.domainMin != null || spec.domainMax != null) { + error("No scale domain defined for domainMin/domainMax to override."); + } + return; + } + return domain2.signal ? scope.signalRef(domain2.signal) : (isArray(domain2) ? explicitDomain : domain2.fields ? multipleDomain : singularDomain)(domain2, spec, scope); + } + function explicitDomain(domain2, spec, scope) { + return domain2.map((v) => parseLiteral(v, scope)); + } + function singularDomain(domain2, spec, scope) { + const data2 = scope.getData(domain2.data); + if (!data2) dataLookupError(domain2.data); + return isDiscrete(spec.type) ? data2.valuesRef(scope, domain2.field, parseSort(domain2.sort, false)) : isQuantile(spec.type) ? data2.domainRef(scope, domain2.field) : data2.extentRef(scope, domain2.field); + } + function multipleDomain(domain2, spec, scope) { + const data2 = domain2.data, fields = domain2.fields.reduce((dom, d2) => { + d2 = isString(d2) ? { + data: data2, + field: d2 + } : isArray(d2) || d2.signal ? fieldRef(d2, scope) : d2; + dom.push(d2); + return dom; }, []); - return ((0, _vegaScale.isDiscrete)(spec.type) ? ordinalMultipleDomain : (0, _vegaScale.isQuantile)(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields); -} -function fieldRef(data, scope) { - const name = '_:vega:_' + FIELD_REF_ID++, coll = Collect({}); - if ((0, _vegaUtil.isArray)(data)) coll.value = { - $ingest: data - }; - else if (data.signal) { - const code = 'setdata(' + (0, _vegaUtil.stringValue)(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [ - coll, - Sieve({}) - ]); + return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain2, scope, fields); + } + function fieldRef(data2, scope) { + const name = "_:vega:_" + FIELD_REF_ID++, coll = Collect({}); + if (isArray(data2)) { + coll.value = { + $ingest: data2 + }; + } else if (data2.signal) { + const code = "setdata(" + $(name) + "," + data2.signal + ")"; + coll.params.input = scope.signalRef(code); + } + scope.addDataPipeline(name, [coll, Sieve({})]); return { - data: name, - field: 'data' - }; -} -function ordinalMultipleDomain(domain, scope, fields) { - const sort = parseSort(domain.sort, true); - let a, v; - // get value counts for each domain field - const counts = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); + data: name, + field: "data" + }; + } + function ordinalMultipleDomain(domain2, scope, fields) { + const sort2 = parseSort(domain2.sort, true); + let a2, v; + const counts = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.countsRef(scope, f.field, sort2); }); - // aggregate the results from each domain field const p = { - groupby: keyFieldRef, - pulse: counts - }; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [ - MULTIDOMAIN_SORT_OPS[a] - ]; - p.fields = [ - scope.fieldRef(v) - ]; - p.as = [ - v - ]; - } - a = scope.add(Aggregate(p)); - // collect aggregate output - const c = scope.add(Collect({ - pulse: ref(a) + groupby: keyFieldRef, + pulse: counts + }; + if (sort2) { + a2 = sort2.op || "count"; + v = sort2.field ? aggrField(a2, sort2.field) : "count"; + p.ops = [MULTIDOMAIN_SORT_OPS[a2]]; + p.fields = [scope.fieldRef(v)]; + p.as = [v]; + } + a2 = scope.add(Aggregate(p)); + const c2 = scope.add(Collect({ + pulse: ref(a2) })); - // extract values for combined domain v = scope.add(Values({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) + field: keyFieldRef, + sort: scope.sortRef(sort2), + pulse: ref(c2) })); return ref(v); -} -function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if ((0, _vegaUtil.isObject)(sort)) sort.field = 'key'; - else sort = { - field: 'key' - }; - } else if (!sort.field && sort.op !== 'count') (0, _vegaUtil.error)('No field provided for sort aggregate op: ' + sort.op); - else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) (0, _vegaUtil.error)('Multiple domain scales can not be sorted using ' + sort.op); - } - } - return sort; -} -function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - const values = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); + } + function parseSort(sort2, multidomain) { + if (sort2) { + if (!sort2.field && !sort2.op) { + if (isObject(sort2)) sort2.field = "key"; + else sort2 = { + field: "key" + }; + } else if (!sort2.field && sort2.op !== "count") { + error("No field provided for sort aggregate op: " + sort2.op); + } else if (multidomain && sort2.field) { + if (sort2.op && !MULTIDOMAIN_SORT_OPS[sort2.op]) { + error("Multiple domain scales can not be sorted using " + sort2.op); + } + } + } + return sort2; + } + function quantileMultipleDomain(domain2, scope, fields) { + const values2 = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.domainRef(scope, f.field); }); - // combine value arrays return ref(scope.add(MultiValues({ - values: values + values: values2 }))); -} -function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - const extents = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); + } + function numericMultipleDomain(domain2, scope, fields) { + const extents = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.extentRef(scope, f.field); }); - // combine extents return ref(scope.add(MultiExtent({ - extents: extents + extents }))); -} -// -- SCALE BINS ----- -function parseScaleBins(v, scope) { - return v.signal || (0, _vegaUtil.isArray)(v) ? parseArray(v, scope) : scope.objectProperty(v); -} -// -- SCALE NICE ----- -function parseScaleNice(nice, scope) { - return nice.signal ? scope.signalRef(nice.signal) : (0, _vegaUtil.isObject)(nice) ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } : parseLiteral(nice); -} -// -- SCALE INTERPOLATION ----- -function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) params.interpolateGamma = parseLiteral(interpolate.gamma); -} -// -- SCALE RANGE ----- -function parseScaleRange(spec, scope, params) { + } + function parseScaleBins(v, scope) { + return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v); + } + function parseScaleNice(nice2, scope) { + return nice2.signal ? scope.signalRef(nice2.signal) : isObject(nice2) ? { + interval: parseLiteral(nice2.interval), + step: parseLiteral(nice2.step) + } : parseLiteral(nice2); + } + function parseScaleInterpolate(interpolate2, params2) { + params2.interpolate = parseLiteral(interpolate2.type || interpolate2); + if (interpolate2.gamma != null) { + params2.interpolateGamma = parseLiteral(interpolate2.gamma); + } + } + function parseScaleRange(spec, scope, params2) { const config = scope.config.range; - let range = spec.range; - if (range.signal) return scope.signalRef(range.signal); - else if ((0, _vegaUtil.isString)(range)) { - if (config && (0, _vegaUtil.hasOwnProperty)(config, range)) { - spec = (0, _vegaUtil.extend)({}, spec, { - range: config[range] - }); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') range = [ - 0, - { - signal: 'width' - } - ]; - else if (range === 'height') range = (0, _vegaScale.isDiscrete)(spec.type) ? [ - 0, - { - signal: 'height' - } - ] : [ - { - signal: 'height' - }, - 0 - ]; - else (0, _vegaUtil.error)('Unrecognized scale range value: ' + (0, _vegaUtil.stringValue)(range)); - } else if (range.scheme) { - params.scheme = (0, _vegaUtil.isArray)(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if ((0, _vegaScale.isDiscrete)(spec.type) && !(0, _vegaUtil.isArray)(range)) return parseScaleDomain(range, spec, scope); - else if (!(0, _vegaUtil.isArray)(range)) (0, _vegaUtil.error)('Unsupported range type: ' + (0, _vegaUtil.stringValue)(range)); - return range.map((v)=>((0, _vegaUtil.isArray)(v) ? parseArray : parseLiteral)(v, scope)); -} -function parseProjection(proj, scope) { - const config = scope.config.projection || {}, params = {}; - for(const name in proj){ - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } - // apply projection defaults from config - for(const name in config)if (params[name] == null) params[name] = parseParameter$1(config[name], name, scope); - scope.addProjection(proj.name, params); -} -function parseParameter$1(_, name, scope) { - return (0, _vegaUtil.isArray)(_) ? _.map((_)=>parseParameter$1(_, name, scope)) : !(0, _vegaUtil.isObject)(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : (0, _vegaUtil.error)('Unsupported parameter object: ' + (0, _vegaUtil.stringValue)(_)); -} -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const Center = 'center'; -const Vertical = 'vertical'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const Index = 'index'; -const Label = 'label'; -const Offset = 'offset'; -const Perc = 'perc'; -const Perc2 = 'perc2'; -const Value = 'value'; -const GuideLabelStyle = 'guide-label'; -const GuideTitleStyle = 'guide-title'; -const GroupTitleStyle = 'group-title'; -const GroupSubtitleStyle = 'group-subtitle'; -/** All values of LegendType */ const Symbols = 'symbol'; -const Gradient = 'gradient'; -const Discrete = 'discrete'; -const Size = 'size'; -const Shape = 'shape'; -const Fill = 'fill'; -const Stroke = 'stroke'; -const StrokeWidth = 'strokeWidth'; -const StrokeDash = 'strokeDash'; -const Opacity = 'opacity'; -// Encoding channels supported by legends -// In priority order of 'canonical' scale -const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity -]; -const Skip = { + let range2 = spec.range; + if (range2.signal) { + return scope.signalRef(range2.signal); + } else if (isString(range2)) { + if (config && has$1(config, range2)) { + spec = extend({}, spec, { + range: config[range2] + }); + return parseScaleRange(spec, scope, params2); + } else if (range2 === "width") { + range2 = [0, { + signal: "width" + }]; + } else if (range2 === "height") { + range2 = isDiscrete(spec.type) ? [0, { + signal: "height" + }] : [{ + signal: "height" + }, 0]; + } else { + error("Unrecognized scale range value: " + $(range2)); + } + } else if (range2.scheme) { + params2.scheme = isArray(range2.scheme) ? parseArray(range2.scheme, scope) : parseLiteral(range2.scheme, scope); + if (range2.extent) params2.schemeExtent = parseArray(range2.extent, scope); + if (range2.count) params2.schemeCount = parseLiteral(range2.count, scope); + return; + } else if (range2.step) { + params2.rangeStep = parseLiteral(range2.step, scope); + return; + } else if (isDiscrete(spec.type) && !isArray(range2)) { + return parseScaleDomain(range2, spec, scope); + } else if (!isArray(range2)) { + error("Unsupported range type: " + $(range2)); + } + return range2.map((v) => (isArray(v) ? parseArray : parseLiteral)(v, scope)); + } + function parseProjection(proj, scope) { + const config = scope.config.projection || {}, params2 = {}; + for (const name in proj) { + if (name === "name") continue; + params2[name] = parseParameter$1(proj[name], name, scope); + } + for (const name in config) { + if (params2[name] == null) { + params2[name] = parseParameter$1(config[name], name, scope); + } + } + scope.addProjection(proj.name, params2); + } + function parseParameter$1(_, name, scope) { + return isArray(_) ? _.map((_2) => parseParameter$1(_2, name, scope)) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === "fit" ? _ : error("Unsupported parameter object: " + $(_)); + } + const Top = "top"; + const Left = "left"; + const Right = "right"; + const Bottom = "bottom"; + const Center = "center"; + const Vertical = "vertical"; + const Start = "start"; + const Middle = "middle"; + const End = "end"; + const Index = "index"; + const Label = "label"; + const Offset = "offset"; + const Perc = "perc"; + const Perc2 = "perc2"; + const Value = "value"; + const GuideLabelStyle = "guide-label"; + const GuideTitleStyle = "guide-title"; + const GroupTitleStyle = "group-title"; + const GroupSubtitleStyle = "group-subtitle"; + const Symbols = "symbol"; + const Gradient = "gradient"; + const Discrete = "discrete"; + const Size = "size"; + const Shape = "shape"; + const Fill = "fill"; + const Stroke = "stroke"; + const StrokeWidth = "strokeWidth"; + const StrokeDash = "strokeDash"; + const Opacity = "opacity"; + const LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity]; + const Skip = { name: 1, style: 1, interactive: 1 -}; -const zero = { + }; + const zero = { value: 0 -}; -const one = { + }; + const one = { value: 1 -}; -const GroupMark = 'group'; -const RectMark = 'rect'; -const RuleMark = 'rule'; -const SymbolMark = 'symbol'; -const TextMark = 'text'; -function guideGroup(mark) { + }; + const GroupMark = "group"; + const RectMark = "rect"; + const RuleMark = "rule"; + const SymbolMark = "symbol"; + const TextMark = "text"; + function guideGroup(mark) { mark.type = GroupMark; mark.interactive = mark.interactive || false; return mark; -} -function lookup(spec, config) { - const _ = (name, dflt)=>value(spec[name], value(config[name], dflt)); - _.isVertical = (s)=>Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); - _.gradientLength = ()=>value(spec.gradientLength, config.gradientLength || config.gradientWidth); - _.gradientThickness = ()=>value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); - _.entryColumns = ()=>value(spec.columns, value(config.columns, +_.isVertical(true))); + } + function lookup(spec, config) { + const _ = (name, dflt) => value(spec[name], value(config[name], dflt)); + _.isVertical = (s2) => Vertical === value(spec.direction, config.direction || (s2 ? config.symbolDirection : config.gradientDirection)); + _.gradientLength = () => value(spec.gradientLength, config.gradientLength || config.gradientWidth); + _.gradientThickness = () => value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); + _.entryColumns = () => value(spec.columns, value(config.columns, +_.isVertical(true))); return _; -} -function getEncoding(name, encode) { - const v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]); + } + function getEncoding(name, encode2) { + const v = encode2 && (encode2.update && encode2.update[name] || encode2.enter && encode2.enter[name]); return v && v.signal ? v : v ? v.value : null; -} -function getStyle(name, scope, style) { - const s = scope.config.style[style]; - return s && s[name]; -} -function anchorExpr(s, e, m) { - return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`; -} -const alignExpr$1 = anchorExpr((0, _vegaUtil.stringValue)(Left), (0, _vegaUtil.stringValue)(Right), (0, _vegaUtil.stringValue)(Center)); -function tickBand(_) { - const v = _('tickBand'); - let offset = _('tickOffset'), band, extra; + } + function getStyle(name, scope, style2) { + const s2 = scope.config.style[style2]; + return s2 && s2[name]; + } + function anchorExpr(s2, e, m2) { + return `item.anchor === '${Start}' ? ${s2} : item.anchor === '${End}' ? ${e} : ${m2}`; + } + const alignExpr$1 = anchorExpr($(Left), $(Right), $(Center)); + function tickBand(_) { + const v = _("tickBand"); + let offset2 = _("tickOffset"), band2, extra; if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); + band2 = _("bandPosition"); + extra = _("tickExtra"); } else if (v.signal) { - // if signal, augment code to interpret values - band = { - signal: `(${v.signal}) === 'extent' ? 1 : 0.5` - }; - extra = { - signal: `(${v.signal}) === 'extent'` + band2 = { + signal: `(${v.signal}) === 'extent' ? 1 : 0.5` + }; + extra = { + signal: `(${v.signal}) === 'extent'` + }; + if (!isObject(offset2)) { + offset2 = { + signal: `(${v.signal}) === 'extent' ? 0 : ${offset2}` }; - if (!(0, _vegaUtil.isObject)(offset)) offset = { - signal: `(${v.signal}) === 'extent' ? 0 : ${offset}` - }; - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; + } + } else if (v === "extent") { + band2 = 1; + extra = true; + offset2 = 0; } else { - band = 0.5; - extra = false; + band2 = 0.5; + extra = false; } return { - extra, - band, - offset - }; -} -function extendOffset(value, offset) { - return !offset ? value : !value ? offset : !(0, _vegaUtil.isObject)(value) ? { - value, - offset - } : Object.assign({}, value, { - offset: extendOffset(value.offset, offset) + extra, + band: band2, + offset: offset2 + }; + } + function extendOffset(value2, offset2) { + return !offset2 ? value2 : !value2 ? offset2 : !isObject(value2) ? { + value: value2, + offset: offset2 + } : Object.assign({}, value2, { + offset: extendOffset(value2.offset, offset2) }); -} -function guideMark(mark, extras) { + } + function guideMark(mark, extras) { if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip); - } else mark.interactive = false; + mark.name = extras.name; + mark.style = extras.style || mark.style; + mark.interactive = !!extras.interactive; + mark.encode = extendEncode(mark.encode, extras, Skip); + } else { + mark.interactive = false; + } return mark; -} -function legendGradient(spec, scale, config, userEncode) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let enter, start, stop, width, height; + } + function legendGradient(spec, scale2, config, userEncode) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let enter, start, stop2, width2, height2; if (vertical) { - start = [ - 0, - 1 - ]; - stop = [ - 0, - 0 - ]; - width = thickness; - height = length; + start = [0, 1]; + stop2 = [0, 0]; + width2 = thickness; + height2 = length2; } else { - start = [ - 0, - 0 - ]; - stop = [ - 1, - 0 - ]; - width = length; - height = thickness; - } - const encode = { - enter: enter = { - opacity: zero, - x: zero, - y: zero, - width: encoder(width), - height: encoder(height) - }, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one, - fill: { - gradient: scale, - start: start, - stop: stop - } - }), - exit: { - opacity: zero + start = [0, 0]; + stop2 = [1, 0]; + width2 = length2; + height2 = thickness; + } + const encode2 = { + enter: enter = { + opacity: zero, + x: zero, + y: zero, + width: encoder(width2), + height: encoder(height2) + }, + update: extend({}, enter, { + opacity: one, + fill: { + gradient: scale2, + start, + stop: stop2 } + }), + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode + type: RectMark, + role: LegendGradientRole, + encode: encode2 }, userEncode); -} -function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let u, v, uu, vv, adjust = ''; - vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); + } + function legendGradientDiscrete(spec, scale2, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let u2, v, uu, vv, adjust = ""; + vertical ? (u2 = "y", uu = "y2", v = "x", vv = "width", adjust = "1-") : (u2 = "x", uu = "x2", v = "y", vv = "height"); const enter = { - opacity: zero, - fill: { - scale: scale, - field: Value - } + opacity: zero, + fill: { + scale: scale2, + field: Value + } }; - enter[u] = { - signal: adjust + 'datum.' + Perc, - mult: length + enter[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 }; enter[v] = zero; enter[uu] = { - signal: adjust + 'datum.' + Perc2, - mult: length + signal: adjust + "datum." + Perc2, + mult: length2 }; enter[vv] = encoder(thickness); - const encode = { - enter: enter, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one - }), - exit: { - opacity: zero - } + const encode2 = { + enter, + update: extend({}, enter, { + opacity: one + }), + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode + type: RectMark, + role: LegendBandRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; -function legendGradientLabels(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length = _.gradientLength(); - let overlap = _('labelOverlap'), enter, update, u, v, adjust = ''; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one, - text: { - field: Label - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value(spec.labelLimit, config.gradientLabelLimit) + } + const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; + function legendGradientLabels(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length2 = _.gradientLength(); + let overlap = _("labelOverlap"), enter, update2, u2, v, adjust = ""; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one, + text: { + field: Label + } + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: value(spec.labelLimit, config.gradientLabelLimit) }); if (vertical) { - enter.align = { - value: 'left' - }; - enter.baseline = update.baseline = { - signal: baselineExpr - }; - u = 'y'; - v = 'x'; - adjust = '1-'; + enter.align = { + value: "left" + }; + enter.baseline = update2.baseline = { + signal: baselineExpr + }; + u2 = "y"; + v = "x"; + adjust = "1-"; } else { - enter.align = update.align = { - signal: alignExpr - }; - enter.baseline = { - value: 'top' - }; - u = 'x'; - v = 'y'; - } - enter[u] = update[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = update[v] = thickness; + enter.align = update2.align = { + signal: alignExpr + }; + enter.baseline = { + value: "top" + }; + u2 = "x"; + v = "y"; + } + enter[u2] = update2[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 + }; + enter[v] = update2[v] = thickness; thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0; overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - // type, role, style, key, dataRef, encode, extras + separation: _("labelSeparation"), + method: overlap, + order: "datum." + Index + } : void 0; return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -// userEncode is top-level, includes entries, symbols, labels -function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - const _ = lookup(spec, config), entries = userEncode.entries, interactive = !!(entries && entries.interactive), name = entries ? entries.name : undefined, height = _('clipHeight'), symbolOffset = _('symbolOffset'), valueRef = { - data: 'value' - }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height ? encoder(height) : { - field: Size - }, index = `datum.${Index}`, ncols = `max(1, ${columns})`; - let encode, enter, update, nrows, sort; + } + function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { + const _ = lookup(spec, config), entries = userEncode.entries, interactive2 = !!(entries && entries.interactive), name = entries ? entries.name : void 0, height2 = _("clipHeight"), symbolOffset = _("symbolOffset"), valueRef = { + data: "value" + }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height2 ? encoder(height2) : { + field: Size + }, index2 = `datum.${Index}`, ncols = `max(1, ${columns})`; + let encode2, enter, update2, nrows, sort2; yEncode.mult = 0.5; - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - mult: 0.5, - offset: symbolOffset - }, - y: yEncode - }, - update: update = { - opacity: one, - x: enter.x, - y: enter.y + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + mult: 0.5, + offset: symbolOffset }, - exit: { - opacity: zero - } + y: yEncode + }, + update: update2 = { + opacity: one, + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } }; let baseFill = null, baseStroke = null; if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') + baseFill = config.symbolBaseFillColor; + baseStroke = config.symbolBaseStrokeColor; + } + addEncoders(encode2, { + fill: _("symbolFillColor", baseFill), + shape: _("symbolType"), + size: _("symbolSize"), + stroke: _("symbolStrokeColor", baseStroke), + strokeDash: _("symbolDash"), + strokeDashOffset: _("symbolDashOffset"), + strokeWidth: _("symbolStrokeWidth") }, { - // update - opacity: _('symbolOpacity') + // update + opacity: _("symbolOpacity") }); - LegendScales.forEach((scale)=>{ - if (spec[scale]) update[scale] = enter[scale] = { - scale: spec[scale], - field: Value + LegendScales.forEach((scale2) => { + if (spec[scale2]) { + update2[scale2] = enter[scale2] = { + scale: spec[scale2], + field: Value }; + } }); - const symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode + const symbols2 = guideMark({ + type: SymbolMark, + role: LegendSymbolRole, + key: Value, + from: valueRef, + clip: height2 ? true : void 0, + encode: encode2 }, userEncode.symbols); - // -- LEGEND LABELS -- const labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - offset: labelOffset - }, - y: yEncode + labelOffset.offset = _("labelOffset"); + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + offset: labelOffset }, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y + y: yEncode + }, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + align: _("labelAlign"), + baseline: _("labelBaseline"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: _("labelLimit") }); const labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: valueRef, + encode: encode2 }, userEncode.labels); - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: { - value: !height - }, - // ignore width/height in bounds calc - width: zero, - height: height ? encoder(height) : zero, - opacity: zero - }, - exit: { - opacity: zero + encode2 = { + enter: { + noBound: { + value: !height2 + }, + // ignore width/height in bounds calc + width: zero, + height: height2 ? encoder(height2) : zero, + opacity: zero + }, + exit: { + opacity: zero + }, + update: update2 = { + opacity: one, + row: { + signal: null }, - update: update = { - opacity: one, - row: { - signal: null - }, - column: { - signal: null - } + column: { + signal: null } + } }; - // annotate and sort groups to ensure correct ordering if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = { - field: [ - 'row', - index - ] - }; + nrows = `ceil(item.mark.items.length / ${ncols})`; + update2.row.signal = `${index2}%${nrows}`; + update2.column.signal = `floor(${index2} / ${nrows})`; + sort2 = { + field: ["row", index2] + }; } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = { - field: index - }; + update2.row.signal = `floor(${index2} / ${ncols})`; + update2.column.signal = `${index2} % ${ncols}`; + sort2 = { + field: index2 + }; } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - // facet legend entries into sub-groups + update2.column.signal = `(${columns})?${update2.column.signal}:${index2}`; dataRef = { - facet: { - data: dataRef, - name: 'value', - groupby: Index - } + facet: { + data: dataRef, + name: "value", + groupby: Index + } }; return guideGroup({ - role: ScopeRole, - from: dataRef, - encode: extendEncode(encode, entries, Skip), - marks: [ - symbols, - labels - ], - name, - interactive, - sort + role: ScopeRole, + from: dataRef, + encode: extendEncode(encode2, entries, Skip), + marks: [symbols2, labels], + name, + interactive: interactive2, + sort: sort2 }); -} -function legendSymbolLayout(spec, config) { + } + function legendSymbolLayout(spec, config) { const _ = lookup(spec, config); - // layout parameters for legend entries return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } + align: _("gridAlign"), + columns: _.entryColumns(), + center: { + row: true, + column: false + }, + padding: { + row: _("rowPadding"), + column: _("columnPadding") + } }; -} -// expression logic for align, anchor, angle, and baseline calculation -const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; -function legendTitle(spec, config, userEncode, dataRef) { + } + const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; + function legendTitle(spec, config, userEncode, dataRef) { const _ = lookup(spec, config); - const encode = { - enter: { - opacity: zero - }, - update: { - opacity: one, - x: { - field: { - group: 'padding' - } - }, - y: { - field: { - group: 'padding' - } - } - }, - exit: { - opacity: zero + const encode2 = { + enter: { + opacity: zero + }, + update: { + opacity: one, + x: { + field: { + group: "padding" + } + }, + y: { + field: { + group: "padding" + } } + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: { - signal: exprAnchor - }, - angle: { - signal: exprAngle - }, - align: { - signal: exprAlign - }, - baseline: { - signal: exprBaseline - }, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + addEncoders(encode2, { + orient: _("titleOrient"), + _anchor: _("titleAnchor"), + anchor: { + signal: exprAnchor + }, + angle: { + signal: exprAngle + }, + align: { + signal: exprAlign + }, + baseline: { + signal: exprBaseline + }, + text: spec.title, + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - baseline: _('titleBaseline') + // require update + align: _("titleAlign"), + baseline: _("titleBaseline") }); return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: LegendTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function clip(clip, scope) { - let expr; - if ((0, _vegaUtil.isObject)(clip)) { - if (clip.signal) expr = clip.signal; - else if (clip.path) expr = 'pathShape(' + param(clip.path) + ')'; - else if (clip.sphere) expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - return expr ? scope.signalRef(expr) : !!clip; -} -function param(value) { - return (0, _vegaUtil.isObject)(value) && value.signal ? value.signal : (0, _vegaUtil.stringValue)(value); -} -function getRole(spec) { - const role = spec.role || ''; - return role.startsWith('axis') || role.startsWith('legend') || role.startsWith('title') ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; -} -function definition(spec) { + } + function clip(clip2, scope) { + let expr2; + if (isObject(clip2)) { + if (clip2.signal) { + expr2 = clip2.signal; + } else if (clip2.path) { + expr2 = "pathShape(" + param(clip2.path) + ")"; + } else if (clip2.sphere) { + expr2 = "geoShape(" + param(clip2.sphere) + ', {type: "Sphere"})'; + } + } + return expr2 ? scope.signalRef(expr2) : !!clip2; + } + function param(value2) { + return isObject(value2) && value2.signal ? value2.signal : $(value2); + } + function getRole(spec) { + const role = spec.role || ""; + return role.startsWith("axis") || role.startsWith("legend") || role.startsWith("title") ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; + } + function definition(spec) { return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; -} -function interactive(spec, scope) { + marktype: spec.type, + name: spec.name || void 0, + role: spec.role || getRole(spec), + zindex: +spec.zindex || void 0, + aria: spec.aria, + description: spec.description + }; + } + function interactive(spec, scope) { return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true; -} -/** - * Parse a data transform specification. - */ function parseTransform(spec, scope) { - const def = (0, _vegaDataflow.definition)(spec.type); - if (!def) (0, _vegaUtil.error)('Unrecognized transform type: ' + (0, _vegaUtil.stringValue)(spec.type)); - const t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope)); + } + function parseTransform(spec, scope) { + const def2 = definition$1(spec.type); + if (!def2) error("Unrecognized transform type: " + $(spec.type)); + const t = entry(def2.type.toLowerCase(), null, parseParameters(def2, spec, scope)); if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; + t.metadata = def2.metadata || {}; return t; -} -/** - * Parse all parameters of a data transform. - */ function parseParameters(def, spec, scope) { - const params = {}, n = def.params.length; - for(let i = 0; i < n; ++i){ - const pdef = def.params[i]; - params[pdef.name] = parseParameter(pdef, spec, scope); - } - return params; -} -/** - * Parse a data transform parameter. - */ function parseParameter(def, spec, scope) { - const type = def.type, value = spec[def.name]; - if (type === 'index') return parseIndexParameter(def, spec, scope); - else if (value === undefined) { - if (def.required) (0, _vegaUtil.error)('Missing required ' + (0, _vegaUtil.stringValue)(spec.type) + ' parameter: ' + (0, _vegaUtil.stringValue)(def.name)); - return; - } else if (type === 'param') return parseSubParameters(def, spec, scope); - else if (type === 'projection') return scope.projectionRef(spec[def.name]); - return def.array && !isSignal(value) ? value.map((v)=>parameterValue(def, v, scope)) : parameterValue(def, value, scope); -} -/** - * Parse a single parameter value. - */ function parameterValue(def, value, scope) { - const type = def.type; - if (isSignal(value)) return isExpr(type) ? (0, _vegaUtil.error)('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal); - else { - const expr = def.expr || isField(type); - return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : isExpr(type) ? (0, _vegaFunctions.parseExpression)(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value; - } -} -/** - * Parse parameter for accessing an index of another data set. - */ function parseIndexParameter(def, spec, scope) { - if (!(0, _vegaUtil.isString)(spec.from)) (0, _vegaUtil.error)('Lookup "from" parameter must be a string literal.'); + } + function parseParameters(def2, spec, scope) { + const params2 = {}, n = def2.params.length; + for (let i = 0; i < n; ++i) { + const pdef = def2.params[i]; + params2[pdef.name] = parseParameter(pdef, spec, scope); + } + return params2; + } + function parseParameter(def2, spec, scope) { + const type2 = def2.type, value2 = spec[def2.name]; + if (type2 === "index") { + return parseIndexParameter(def2, spec, scope); + } else if (value2 === void 0) { + if (def2.required) { + error("Missing required " + $(spec.type) + " parameter: " + $(def2.name)); + } + return; + } else if (type2 === "param") { + return parseSubParameters(def2, spec, scope); + } else if (type2 === "projection") { + return scope.projectionRef(spec[def2.name]); + } + return def2.array && !isSignal(value2) ? value2.map((v) => parameterValue(def2, v, scope)) : parameterValue(def2, value2, scope); + } + function parameterValue(def2, value2, scope) { + const type2 = def2.type; + if (isSignal(value2)) { + return isExpr(type2) ? error("Expression references can not be signals.") : isField(type2) ? scope.fieldRef(value2) : isCompare(type2) ? scope.compareRef(value2) : scope.signalRef(value2.signal); + } else { + const expr2 = def2.expr || isField(type2); + return expr2 && outerExpr(value2) ? scope.exprRef(value2.expr, value2.as) : expr2 && outerField(value2) ? fieldRef$1(value2.field, value2.as) : isExpr(type2) ? parser(value2, scope) : isData(type2) ? ref(scope.getData(value2).values) : isField(type2) ? fieldRef$1(value2) : isCompare(type2) ? scope.compareRef(value2) : value2; + } + } + function parseIndexParameter(def2, spec, scope) { + if (!isString(spec.from)) { + error('Lookup "from" parameter must be a string literal.'); + } return scope.getData(spec.from).lookupRef(scope, spec.key); -} -/** - * Parse a parameter that contains one or more sub-parameter objects. - */ function parseSubParameters(def, spec, scope) { - const value = spec[def.name]; - if (def.array) { - if (!(0, _vegaUtil.isArray)(value)) // signals not allowed! - (0, _vegaUtil.error)('Expected an array of sub-parameters. Instead: ' + (0, _vegaUtil.stringValue)(value)); - return value.map((v)=>parseSubParameter(def, v, scope)); - } else return parseSubParameter(def, value, scope); -} -/** - * Parse a sub-parameter object. - */ function parseSubParameter(def, value, scope) { - const n = def.params.length; + } + function parseSubParameters(def2, spec, scope) { + const value2 = spec[def2.name]; + if (def2.array) { + if (!isArray(value2)) { + error("Expected an array of sub-parameters. Instead: " + $(value2)); + } + return value2.map((v) => parseSubParameter(def2, v, scope)); + } else { + return parseSubParameter(def2, value2, scope); + } + } + function parseSubParameter(def2, value2, scope) { + const n = def2.params.length; let pdef; - // loop over defs to find matching key - for(let i = 0; i < n; ++i){ - pdef = def.params[i]; - for(const k in pdef.key)if (pdef.key[k] !== value[k]) { - pdef = null; - break; + for (let i = 0; i < n; ++i) { + pdef = def2.params[i]; + for (const k in pdef.key) { + if (pdef.key[k] !== value2[k]) { + pdef = null; + break; } - if (pdef) break; - } - // raise error if matching key not found - if (!pdef) (0, _vegaUtil.error)('Unsupported parameter: ' + (0, _vegaUtil.stringValue)(value)); - // parse params, create Params transform, return ref - const params = (0, _vegaUtil.extend)(parseParameters(pdef, value, scope), pdef.key); - return ref(scope.add(Params(params))); -} -// -- Utilities ----- -const outerExpr = (_)=>_ && _.expr; -const outerField = (_)=>_ && _.field; -const isData = (_)=>_ === 'data'; -const isExpr = (_)=>_ === 'expr'; -const isField = (_)=>_ === 'field'; -const isCompare = (_)=>_ === 'compare'; -function parseData$1(from, group, scope) { - let facet, key, op, dataRef, parent; - // if no source data, generate singleton datum - if (!from) dataRef = ref(scope.add(Collect(null, [ - {} - ]))); - else if (facet = from.facet) { - if (!group) (0, _vegaUtil.error)('Only group marks can be faceted.'); - // use pre-faceted source data, if available - if (facet.field != null) dataRef = parent = getDataRef(facet, scope); - else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform((0, _vegaUtil.extend)({ - type: 'aggregate', - groupby: (0, _vegaUtil.array)(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else parent = ref(scope.getData(from.data).aggregate); - key = scope.keyRef(facet.groupby, true); - } - } - // if not yet defined, get source data reference - if (!dataRef) dataRef = getDataRef(from, scope); + } + if (pdef) break; + } + if (!pdef) error("Unsupported parameter: " + $(value2)); + const params2 = extend(parseParameters(pdef, value2, scope), pdef.key); + return ref(scope.add(Params(params2))); + } + const outerExpr = (_) => _ && _.expr; + const outerField = (_) => _ && _.field; + const isData = (_) => _ === "data"; + const isExpr = (_) => _ === "expr"; + const isField = (_) => _ === "field"; + const isCompare = (_) => _ === "compare"; + function parseData$1(from, group2, scope) { + let facet, key2, op, dataRef, parent; + if (!from) { + dataRef = ref(scope.add(Collect(null, [{}]))); + } else if (facet = from.facet) { + if (!group2) error("Only group marks can be faceted."); + if (facet.field != null) { + dataRef = parent = getDataRef(facet, scope); + } else { + if (!from.data) { + op = parseTransform(extend({ + type: "aggregate", + groupby: array$4(facet.groupby) + }, facet.aggregate), scope); + op.params.key = scope.keyRef(facet.groupby); + op.params.pulse = getDataRef(facet, scope); + dataRef = parent = ref(scope.add(op)); + } else { + parent = ref(scope.getData(from.data).aggregate); + } + key2 = scope.keyRef(facet.groupby, true); + } + } + if (!dataRef) { + dataRef = getDataRef(from, scope); + } return { - key: key, - pulse: dataRef, - parent: parent + key: key2, + pulse: dataRef, + parent }; -} -function getDataRef(from, scope) { + } + function getDataRef(from, scope) { return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output); -} -function DataScope(scope, input, output, values, aggr) { - this.scope = scope; // parent scope object - this.input = input; // first operator in pipeline (tuple input) - this.output = output; // last operator in pipeline (tuple output) - this.values = values; // operator for accessing tuples (but not tuple flow) - // last aggregate in transform pipeline + } + function DataScope(scope, input, output2, values2, aggr) { + this.scope = scope; + this.input = input; + this.output = output2; + this.values = values2; this.aggregate = aggr; - // lookup table of field indices this.index = {}; -} -DataScope.fromEntries = function(scope, entries) { - const n = entries.length, values = entries[n - 1], output = entries[n - 2]; + } + DataScope.fromEntries = function(scope, entries) { + const n = entries.length, values2 = entries[n - 1], output2 = entries[n - 2]; let input = entries[0], aggr = null, i = 1; - if (input && input.type === 'load') input = entries[1]; - // add operator entries to this scope, wire up pulse chain + if (input && input.type === "load") { + input = entries[1]; + } scope.add(entries[0]); - for(; i < n; ++i){ - entries[i].params.pulse = ref(entries[i - 1]); - scope.add(entries[i]); - if (entries[i].type === 'aggregate') aggr = entries[i]; - } - return new DataScope(scope, input, output, values, aggr); -}; -function fieldKey(field) { - return (0, _vegaUtil.isString)(field) ? field : null; -} -function addSortField(scope, p, sort) { - const as = aggrField(sort.op, sort.field); - let s; - if (p.ops) for(let i = 0, n = p.as.length; i < n; ++i){ - if (p.as[i] === as) return; + for (; i < n; ++i) { + entries[i].params.pulse = ref(entries[i - 1]); + scope.add(entries[i]); + if (entries[i].type === "aggregate") aggr = entries[i]; } - else { - p.ops = [ - 'count' - ]; - p.fields = [ - null - ]; - p.as = [ - 'count' - ]; + return new DataScope(scope, input, output2, values2, aggr); + }; + function fieldKey(field2) { + return isString(field2) ? field2 : null; + } + function addSortField(scope, p, sort2) { + const as = aggrField(sort2.op, sort2.field); + let s2; + if (p.ops) { + for (let i = 0, n = p.as.length; i < n; ++i) { + if (p.as[i] === as) return; + } + } else { + p.ops = ["count"]; + p.fields = [null]; + p.as = ["count"]; } - if (sort.op) { - p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op); - p.fields.push(scope.fieldRef(sort.field)); - p.as.push(as); + if (sort2.op) { + p.ops.push((s2 = sort2.op.signal) ? scope.signalRef(s2) : sort2.op); + p.fields.push(scope.fieldRef(sort2.field)); + p.as.push(as); } -} -function cache(scope, ds, name, optype, field, counts, index) { - const cache = ds[name] || (ds[name] = {}), sort = sortKey(counts); - let k = fieldKey(field), v, op; + } + function cache(scope, ds, name, optype, field2, counts, index2) { + const cache2 = ds[name] || (ds[name] = {}), sort2 = sortKey(counts); + let k = fieldKey(field2), v, op; if (k != null) { - scope = ds.scope; - k = k + (sort ? '|' + sort : ''); - v = cache[k]; + scope = ds.scope; + k = k + (sort2 ? "|" + sort2 : ""); + v = cache2[k]; } if (!v) { - const params = counts ? { - field: keyFieldRef, - pulse: ds.countsRef(scope, field, counts) - } : { - field: scope.fieldRef(field), - pulse: ref(ds.output) - }; - if (sort) params.sort = scope.sortRef(counts); - op = scope.add(entry(optype, undefined, params)); - if (index) ds.index[field] = op; - v = ref(op); - if (k != null) cache[k] = v; + const params2 = counts ? { + field: keyFieldRef, + pulse: ds.countsRef(scope, field2, counts) + } : { + field: scope.fieldRef(field2), + pulse: ref(ds.output) + }; + if (sort2) params2.sort = scope.sortRef(counts); + op = scope.add(entry(optype, void 0, params2)); + if (index2) ds.index[field2] = op; + v = ref(op); + if (k != null) cache2[k] = v; } return v; -} -DataScope.prototype = { - countsRef (scope, field, sort) { - const ds = this, cache = ds.counts || (ds.counts = {}), k = fieldKey(field); - let v, a, p; - if (k != null) { - scope = ds.scope; - v = cache[k]; - } - if (!v) { - p = { - groupby: scope.fieldRef(field, 'key'), - pulse: ref(ds.output) - }; - if (sort && sort.field) addSortField(scope, p, sort); - a = scope.add(Aggregate(p)); - v = scope.add(Collect({ - pulse: ref(a) - })); - v = { - agg: a, - ref: ref(v) - }; - if (k != null) cache[k] = v; - } else if (sort && sort.field) addSortField(scope, v.agg.params, sort); - return v.ref; + } + DataScope.prototype = { + countsRef(scope, field2, sort2) { + const ds = this, cache2 = ds.counts || (ds.counts = {}), k = fieldKey(field2); + let v, a2, p; + if (k != null) { + scope = ds.scope; + v = cache2[k]; + } + if (!v) { + p = { + groupby: scope.fieldRef(field2, "key"), + pulse: ref(ds.output) + }; + if (sort2 && sort2.field) addSortField(scope, p, sort2); + a2 = scope.add(Aggregate(p)); + v = scope.add(Collect({ + pulse: ref(a2) + })); + v = { + agg: a2, + ref: ref(v) + }; + if (k != null) cache2[k] = v; + } else if (sort2 && sort2.field) { + addSortField(scope, v.agg.params, sort2); + } + return v.ref; }, - tuplesRef () { - return ref(this.values); + tuplesRef() { + return ref(this.values); }, - extentRef (scope, field) { - return cache(scope, this, 'extent', 'extent', field, false); + extentRef(scope, field2) { + return cache(scope, this, "extent", "extent", field2, false); }, - domainRef (scope, field) { - return cache(scope, this, 'domain', 'values', field, false); + domainRef(scope, field2) { + return cache(scope, this, "domain", "values", field2, false); }, - valuesRef (scope, field, sort) { - return cache(scope, this, 'vals', 'values', field, sort || true); + valuesRef(scope, field2, sort2) { + return cache(scope, this, "vals", "values", field2, sort2 || true); }, - lookupRef (scope, field) { - return cache(scope, this, 'lookup', 'tupleindex', field, false); + lookupRef(scope, field2) { + return cache(scope, this, "lookup", "tupleindex", field2, false); }, - indataRef (scope, field) { - return cache(scope, this, 'indata', 'tupleindex', field, true, true); + indataRef(scope, field2) { + return cache(scope, this, "indata", "tupleindex", field2, true, true); } -}; -function parseFacet(spec, scope, group) { - const facet = spec.from.facet, name = facet.name, data = getDataRef(facet, scope); + }; + function parseFacet(spec, scope, group2) { + const facet = spec.from.facet, name = facet.name, data2 = getDataRef(facet, scope); let op; - if (!facet.name) (0, _vegaUtil.error)('Facet must have a name: ' + (0, _vegaUtil.stringValue)(facet)); - if (!facet.data) (0, _vegaUtil.error)('Facet must reference a data set: ' + (0, _vegaUtil.stringValue)(facet)); - if (facet.field) op = scope.add(PreFacet({ + if (!facet.name) { + error("Facet must have a name: " + $(facet)); + } + if (!facet.data) { + error("Facet must reference a data set: " + $(facet)); + } + if (facet.field) { + op = scope.add(PreFacet({ field: scope.fieldRef(facet.field), - pulse: data - })); - else if (facet.groupby) op = scope.add(Facet({ + pulse: data2 + })); + } else if (facet.groupby) { + op = scope.add(Facet({ key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - else (0, _vegaUtil.error)('Facet must specify groupby or field: ' + (0, _vegaUtil.stringValue)(facet)); - // initialize facet subscope - const subscope = scope.fork(), source = subscope.add(Collect()), values = subscope.add(Sieve({ - pulse: ref(source) + group: ref(scope.proxy(group2.parent)), + pulse: data2 + })); + } else { + error("Facet must specify groupby or field: " + $(facet)); + } + const subscope = scope.fork(), source2 = subscope.add(Collect()), values2 = subscope.add(Sieve({ + pulse: ref(source2) })); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); - // parse faceted subflow + subscope.addData(name, new DataScope(subscope, source2, source2, values2)); + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() + $subflow: subscope.parse(spec).toRuntime() }; -} -function parseSubflow(spec, scope, input) { + } + function parseSubflow(spec, scope, input) { const op = scope.add(PreFacet({ - pulse: input.pulse + pulse: input.pulse })), subscope = scope.fork(); subscope.add(Sieve()); - subscope.addSignal('parent', null); - // parse group mark subflow + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} -function parseTrigger(spec, scope, name) { - const remove = spec.remove, insert = spec.insert, toggle = spec.toggle, modify = spec.modify, values = spec.values, op = scope.add(operator()); - const update = 'if(' + spec.trigger + ',modify("' + name + '",' + [ - insert, - remove, - toggle, - modify, - values - ].map((_)=>_ == null ? 'null' : _).join(',') + '),0)'; - const expr = (0, _vegaFunctions.parseExpression)(update, scope); - op.update = expr.$expr; - op.params = expr.$params; -} -function parseMark(spec, scope) { - const role = getRole(spec), group = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; - let layout = spec.layout || role === ScopeRole || role === FrameRole, ops, op, store, enc, name, layoutRef, boundRef; + $subflow: subscope.parse(spec).toRuntime() + }; + } + function parseTrigger(spec, scope, name) { + const remove2 = spec.remove, insert2 = spec.insert, toggle = spec.toggle, modify2 = spec.modify, values2 = spec.values, op = scope.add(operator()); + const update2 = "if(" + spec.trigger + ',modify("' + name + '",' + [insert2, remove2, toggle, modify2, values2].map((_) => _ == null ? "null" : _).join(",") + "),0)"; + const expr2 = parser(update2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + function parseMark(spec, scope) { + const role = getRole(spec), group2 = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; + let layout = spec.layout || role === ScopeRole || role === FrameRole, ops2, op, store, enc, name, layoutRef, boundRef; const nested = role === MarkRole || layout || facet; - // resolve input data - const input = parseData$1(spec.from, group, scope); - // data join to map tuples to visual items + const input = parseData$1(spec.from, group2, scope); op = scope.add(DataJoin({ - key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined), - pulse: input.pulse, - clean: !group + key: input.key || (spec.key ? fieldRef$1(spec.key) : void 0), + pulse: input.pulse, + clean: !group2 })); const joinRef = ref(op); - // collect visual items op = store = scope.add(Collect({ - pulse: joinRef + pulse: joinRef })); - // connect visual items to scenegraph op = scope.add(Mark({ - markdef: definition(spec), - interactive: interactive(spec.interactive, scope), - clip: clip(spec.clip, scope), - context: { - $context: true - }, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) + markdef: definition(spec), + interactive: interactive(spec.interactive, scope), + clip: clip(spec.clip, scope), + context: { + $context: true + }, + groups: scope.lookup(), + parent: scope.signals.parent ? scope.signalRef("parent") : null, + index: scope.markpath(), + pulse: ref(op) })); const markRef = ref(op); - // add visual encoders op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, { - mod: false, - pulse: markRef + mod: false, + pulse: markRef }))); - // monitor parent marks to propagate changes op.params.parent = scope.encode(); - // add post-encoding transforms, if defined - if (spec.transform) spec.transform.forEach((_)=>{ - const tx = parseTransform(_, scope), md = tx.metadata; - if (md.generates || md.changes) (0, _vegaUtil.error)('Mark transforms should not generate new data.'); - if (!md.nomod) enc.params.mod = true; // update encode mod handling - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - // if item sort specified, perform post-encoding - if (spec.sort) op = scope.add(SortItems({ + if (spec.transform) { + spec.transform.forEach((_) => { + const tx2 = parseTransform(_, scope), md2 = tx2.metadata; + if (md2.generates || md2.changes) { + error("Mark transforms should not generate new data."); + } + if (!md2.nomod) enc.params.mod = true; + tx2.params.pulse = ref(op); + scope.add(op = tx2); + }); + } + if (spec.sort) { + op = scope.add(SortItems({ sort: scope.compareRef(spec.sort), pulse: ref(op) - })); + })); + } const encodeRef = ref(op); - // add view layout operator if needed if (facet || layout) { - layout = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); - } - // compute bounding boxes - const bound = scope.add(Bound({ + layout = scope.add(ViewLayout({ + layout: scope.objectProperty(spec.layout), + legends: scope.legends, mark: markRef, - pulse: layoutRef || encodeRef + pulse: encodeRef + })); + layoutRef = ref(layout); + } + const bound2 = scope.add(Bound({ + mark: markRef, + pulse: layoutRef || encodeRef })); - boundRef = ref(bound); - // if group mark, recurse to parse nested content - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { - ops = scope.operators; - ops.pop(); - if (layout) ops.pop(); - } - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - scope.popState(); - if (nested) { - if (layout) ops.push(layout); - ops.push(bound); - } - } - // if requested, add overlap removal transform - if (overlap) boundRef = parseOverlap(overlap, boundRef, scope); - // render / sieve items + boundRef = ref(bound2); + if (group2) { + if (nested) { + ops2 = scope.operators; + ops2.pop(); + if (layout) ops2.pop(); + } + scope.pushState(encodeRef, layoutRef || boundRef, joinRef); + facet ? parseFacet(spec, scope, input) : nested ? parseSubflow(spec, scope, input) : scope.parse(spec); + scope.popState(); + if (nested) { + if (layout) ops2.push(layout); + ops2.push(bound2); + } + } + if (overlap) { + boundRef = parseOverlap(overlap, boundRef, scope); + } const render = scope.add(Render({ - pulse: boundRef + pulse: boundRef })), sieve = scope.add(Sieve({ - pulse: ref(render) - }, undefined, scope.parent())); - // if mark is named, make accessible as reactive geometry - // add trigger updates if defined + pulse: ref(render) + }, void 0, scope.parent())); if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach((on)=>{ - if (on.insert || on.remove || on.toggle) (0, _vegaUtil.error)('Marks only support modify triggers.'); - parseTrigger(on, scope, name); - }); + name = spec.name; + scope.addData(name, new DataScope(scope, store, render, sieve)); + if (spec.on) spec.on.forEach((on2) => { + if (on2.insert || on2.remove || on2.toggle) { + error("Marks only support modify triggers."); + } + parseTrigger(on2, scope, name); + }); } -} -function parseOverlap(overlap, source, scope) { - const method = overlap.method, bound = overlap.bound, sep = overlap.separation; - const params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - if (overlap.order) params.sort = scope.compareRef({ + } + function parseOverlap(overlap, source2, scope) { + const method2 = overlap.method, bound2 = overlap.bound, sep = overlap.separation; + const params2 = { + separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, + method: isSignal(method2) ? scope.signalRef(method2.signal) : method2, + pulse: source2 + }; + if (overlap.order) { + params2.sort = scope.compareRef({ field: overlap.order - }); - if (bound) { - const tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - return ref(scope.add(Overlap(params))); -} -function parseLegend(spec, scope) { - const config = scope.config.legend, encode = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode.legend || {}, name = legendEncode.name || undefined, interactive = legendEncode.interactive, style = legendEncode.style, scales = {}; - let scale = 0, entryLayout, params, children; - // resolve scales and 'canonical' scale name - LegendScales.forEach((s)=>spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0); - if (!scale) (0, _vegaUtil.error)('Missing valid scale for legend.'); - // resolve legend type (symbol, gradient, or discrete gradient) - const type = legendType(spec, scope.scaleType(scale)); - // single-element data source for legend group - const datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - const dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // encoding properties for legend entry sub-group + }); + } + if (bound2) { + const tol = bound2.tolerance; + params2.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; + params2.boundScale = scope.scaleRef(bound2.scale); + params2.boundOrient = bound2.orient; + } + return ref(scope.add(Overlap(params2))); + } + function parseLegend(spec, scope) { + const config = scope.config.legend, encode2 = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode2.legend || {}, name = legendEncode.name || void 0, interactive2 = legendEncode.interactive, style2 = legendEncode.style, scales2 = {}; + let scale2 = 0, entryLayout, params2, children2; + LegendScales.forEach((s2) => spec[s2] ? (scales2[s2] = spec[s2], scale2 = scale2 || spec[s2]) : 0); + if (!scale2) error("Missing valid scale for legend."); + const type2 = legendType(spec, scope.scaleType(scale2)); + const datum2 = { + title: spec.title != null, + scales: scales2, + type: type2, + vgrad: type2 !== "symbol" && _.isVertical() + }; + const dataRef = ref(scope.add(Collect(null, [datum2]))); const entryEncode = { - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } + enter: { + x: { + value: 0 + }, + y: { + value: 0 } + } }; - // data source for legend values - const entryRef = ref(scope.add(LegendEntries(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + const entryRef = ref(scope.add(LegendEntries(params2 = { + type: type2, + scale: scope.scaleRef(scale2), + count: scope.objectProperty(_("tickCount")), + limit: scope.property(_("symbolLimit")), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // continuous gradient legend - if (type === Gradient) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); - } else if (type === Discrete) children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - // include legend title if defined - if (datum.title) children.push(legendTitle(spec, config, encode.title, dataRef)); - // parse legend specification + if (type2 === Gradient) { + children2 = [legendGradient(spec, scale2, config, encode2.gradient), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + params2.count = params2.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); + } else if (type2 === Discrete) { + children2 = [legendGradientDiscrete(spec, scale2, config, encode2.gradient, entryRef), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + } else { + entryLayout = legendSymbolLayout(spec, config); + children2 = [legendSymbolGroups(spec, config, encode2, entryRef, deref(entryLayout.columns))]; + params2.size = sizeExpression(spec, scope, children2[0].marks); + } + children2 = [guideGroup({ + role: LegendEntryRole, + from: dataRef, + encode: entryEncode, + marks: children2, + layout: entryLayout, + interactive: interactive2 + })]; + if (datum2.title) { + children2.push(legendTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: LegendRole, - from: dataRef, - encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: LegendRole, + from: dataRef, + encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function legendType(spec, scaleType) { - let type = spec.type || Symbols; - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) type = (0, _vegaScale.isContinuous)(scaleType) ? Gradient : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Symbols; - return type !== Gradient ? type : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Gradient; -} -function scaleCount(spec) { - return LegendScales.reduce((count, type)=>count + (spec[type] ? 1 : 0), 0); -} -function buildLegendEncode(_, spec, config) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - // accessibility support - format: spec.format, - formatType: spec.formatType + } + function legendType(spec, scaleType) { + let type2 = spec.type || Symbols; + if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { + type2 = isContinuous(scaleType) ? Gradient : isDiscretizing(scaleType) ? Discrete : Symbols; + } + return type2 !== Gradient ? type2 : isDiscretizing(scaleType) ? Discrete : Gradient; + } + function scaleCount(spec) { + return LegendScales.reduce((count2, type2) => count2 + (spec[type2] ? 1 : 0), 0); + } + function buildLegendEncode(_, spec, config) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset"), + padding: _("padding"), + titlePadding: _("titlePadding"), + cornerRadius: _("cornerRadius"), + fill: _("fillColor"), + stroke: _("strokeColor"), + strokeWidth: config.strokeWidth, + strokeDash: config.strokeDash, + x: _("legendX"), + y: _("legendY"), + // accessibility support + format: spec.format, + formatType: spec.formatType }); - return encode; -} -function sizeExpression(spec, scope, marks) { - const size = deref(getChannel('size', spec, marks)), strokeWidth = deref(getChannel('strokeWidth', spec, marks)), fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - return (0, _vegaFunctions.parseExpression)(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope); -} -function getChannel(name, spec, marks) { + return encode2; + } + function sizeExpression(spec, scope, marks) { + const size = deref(getChannel("size", spec, marks)), strokeWidth = deref(getChannel("strokeWidth", spec, marks)), fontSize2 = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); + return parser(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize2})`, scope); + } + function getChannel(name, spec, marks) { return spec[name] ? `scale("${spec[name]}",datum)` : getEncoding(name, marks[0].encode); -} -function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); -} -const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; -function parseTitle(spec, scope) { - spec = (0, _vegaUtil.isString)(spec) ? { - text: spec + } + function getFontSize(encode2, scope, style2) { + return getEncoding("fontSize", encode2) || getStyle("fontSize", scope, style2); + } + const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; + function parseTitle(spec, scope) { + spec = isString(spec) ? { + text: spec } : spec; - const _ = lookup(spec, scope.config.title), encode = spec.encode || {}, userEncode = encode.group || {}, name = userEncode.name || undefined, interactive = userEncode.interactive, style = userEncode.style, children = []; - // single-element data source for group title - const datum = {}, dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - // include subtitle text - if (spec.subtitle) children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - // parse title specification + const _ = lookup(spec, scope.config.title), encode2 = spec.encode || {}, userEncode = encode2.group || {}, name = userEncode.name || void 0, interactive2 = userEncode.interactive, style2 = userEncode.style, children2 = []; + const datum2 = {}, dataRef = ref(scope.add(Collect(null, [datum2]))); + children2.push(buildTitle(spec, _, titleEncode(spec), dataRef)); + if (spec.subtitle) { + children2.push(buildSubTitle(spec, _, encode2.subtitle, dataRef)); + } return parseMark(guideGroup({ - role: TitleRole, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: TitleRole, + from: dataRef, + encode: groupEncode(_, userEncode), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -// provide backwards-compatibility for title custom encode; -// the top-level encode block has been *deprecated*. -function titleEncode(spec) { - const encode = spec.encode; - return encode && encode.title || (0, _vegaUtil.extend)({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); -} -function groupEncode(_, userEncode) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: { - signal: alignExpr$1 - }, - angle: { - signal: angleExpr - }, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') + } + function titleEncode(spec) { + const encode2 = spec.encode; + return encode2 && encode2.title || extend({ + name: spec.name, + interactive: spec.interactive, + style: spec.style + }, encode2); + } + function groupEncode(_, userEncode) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + anchor: _("anchor"), + align: { + signal: alignExpr$1 + }, + angle: { + signal: angleExpr + }, + limit: _("limit"), + frame: _("frame"), + offset: _("offset") || 0, + padding: _("subtitlePadding") }); - return extendEncode(encode, userEncode, Skip); -} -function buildTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.text, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + return extendEncode(encode2, userEncode, Skip); + } + function buildTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.text, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("color"), + font: _("font"), + fontSize: _("fontSize"), + fontStyle: _("fontStyle"), + fontWeight: _("fontWeight"), + lineHeight: _("lineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleTextRole, + style: GroupTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function buildSubTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.subtitle, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + } + function buildSubTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.subtitle, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("subtitleColor"), + font: _("subtitleFont"), + fontSize: _("subtitleFontSize"), + fontStyle: _("subtitleFontStyle"), + fontWeight: _("subtitleFontWeight"), + lineHeight: _("subtitleLineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleSubtitleRole, + style: GroupSubtitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function parseData(data, scope) { - const transforms = []; - if (data.transform) data.transform.forEach((tx)=>{ - transforms.push(parseTransform(tx, scope)); - }); - if (data.on) data.on.forEach((on)=>{ - parseTrigger(on, scope, data.name); - }); - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); -} -/** - * Analyze a data pipeline, add needed operators. - */ function analyze(data, scope, ops) { - const output = []; - let source = null, modify = false, generate = false, upstream, i, n, t, m; - if (data.values) { - // hard-wired input data set - if (isSignal(data.values) || hasSignal(data.format)) { - // if either values is signal or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format + } + function parseData(data2, scope) { + const transforms2 = []; + if (data2.transform) { + data2.transform.forEach((tx2) => { + transforms2.push(parseTransform(tx2, scope)); + }); + } + if (data2.on) { + data2.on.forEach((on2) => { + parseTrigger(on2, scope, data2.name); + }); + } + scope.addDataPipeline(data2.name, analyze(data2, scope, transforms2)); + } + function analyze(data2, scope, ops2) { + const output2 = []; + let source2 = null, modify2 = false, generate2 = false, upstream, i, n, t, m2; + if (data2.values) { + if (isSignal(data2.values) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $ingest: data2.values, + $format: data2.format })); - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format + } + } else if (data2.url) { + if (hasSignal(data2.url) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $request: data2.url, + $format: data2.format })); - } else if (data.source) { - // derives from one or more other data sets - source = upstream = (0, _vegaUtil.array)(data.source).map((d)=>ref(scope.getData(d).output)); - output.push(null); // populate later - } - // scan data transforms, add collectors as needed - for(i = 0, n = ops.length; i < n; ++i){ - t = ops[i]; - m = t.metadata; - if (!source && !m.source) output.push(source = collect()); - output.push(t); - if (m.generates) generate = true; - if (m.modifies && !generate) modify = true; - if (m.source) source = t; - else if (m.changes) source = null; + } + } else if (data2.source) { + source2 = upstream = array$4(data2.source).map((d2) => ref(scope.getData(d2).output)); + output2.push(null); + } + for (i = 0, n = ops2.length; i < n; ++i) { + t = ops2[i]; + m2 = t.metadata; + if (!source2 && !m2.source) { + output2.push(source2 = collect()); + } + output2.push(t); + if (m2.generates) generate2 = true; + if (m2.modifies && !generate2) modify2 = true; + if (m2.source) source2 = t; + else if (m2.changes) source2 = null; } if (upstream) { - n = upstream.length - 1; - output[0] = Relay({ - derive: modify, - pulse: n ? upstream : upstream[0] - }); - if (modify || n) // collect derived and multi-pulse tuples - output.splice(1, 0, collect()); - } - if (!source) output.push(collect()); - output.push(Sieve({})); - return output; -} -function collect(values) { - const s = Collect({}, values); - s.metadata = { - source: true - }; - return s; -} -function load(scope, data) { - return Load({ - url: data.url ? scope.property(data.url) : undefined, - async: data.async ? scope.property(data.async) : undefined, - values: data.values ? scope.property(data.values) : undefined, - format: scope.objectProperty(data.format) - }); -} -const isX = (orient)=>orient === Bottom || orient === Top; -// get sign coefficient based on axis orient -const getSign = (orient, a, b)=>isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left || orient === Top ? a : b; -// condition on axis x-direction -const ifX = (orient, a, b)=>isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; -// condition on axis y-direction -const ifY = (orient, a, b)=>isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a; -const ifTop = (orient, a, b)=>isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top ? { - value: a - } : { - value: b + n = upstream.length - 1; + output2[0] = Relay({ + derive: modify2, + pulse: n ? upstream : upstream[0] + }); + if (modify2 || n) { + output2.splice(1, 0, collect()); + } + } + if (!source2) output2.push(collect()); + output2.push(Sieve({})); + return output2; + } + function collect(values2) { + const s2 = Collect({}, values2); + s2.metadata = { + source: true }; -const ifRight = (orient, a, b)=>isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right ? { - value: a - } : { - value: b - }; -const ifXEnc = ($orient, a, b)=>ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b); -const ifYEnc = ($orient, a, b)=>ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b); -const ifLeftTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b); -const ifTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Top}'`, a, b); -const ifRightExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Right}'`, a, b); -const ifEnc = (test, a, b)=>{ - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? a.signal || (0, _vegaUtil.stringValue)(a.value) : null; - b = b ? b.signal || (0, _vegaUtil.stringValue)(b.value) : null; - return { - signal: `${test} ? (${a}) : (${b})` - }; - } else // otherwise generate rule set - return [ - (0, _vegaUtil.extend)({ - test - }, a) - ].concat(b || []); -}; -const isSimple = (enc)=>enc == null || Object.keys(enc).length === 1; -const ifExpr = (test, a, b)=>({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` - }); -const ifOrient = ($orient, t, b, l, r)=>({ - signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') + '(null)' + return s2; + } + function load(scope, data2) { + return Load({ + url: data2.url ? scope.property(data2.url) : void 0, + async: data2.async ? scope.property(data2.async) : void 0, + values: data2.values ? scope.property(data2.values) : void 0, + format: scope.objectProperty(data2.format) }); -const toExpr = (v)=>isSignal(v) ? v.signal : v == null ? null : (0, _vegaUtil.stringValue)(v); -const mult = (sign, value)=>value === 0 ? 0 : isSignal(sign) ? { - signal: `(${sign.signal}) * ${value}` - } : { - value: sign * value - }; -const patch = (value, base)=>{ - const s = value.signal; - return s && s.endsWith('(null)') ? { - signal: s.slice(0, -6) + base.signal - } : value; -}; -function fallback(prop, config, axisConfig, style) { + } + const isX = (orient) => orient === Bottom || orient === Top; + const getSign = (orient, a2, b2) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a2, b2) : orient === Left || orient === Top ? a2 : b2; + const ifX = (orient, a2, b2) => isSignal(orient) ? ifXEnc(orient.signal, a2, b2) : isX(orient) ? a2 : b2; + const ifY = (orient, a2, b2) => isSignal(orient) ? ifYEnc(orient.signal, a2, b2) : isX(orient) ? b2 : a2; + const ifTop = (orient, a2, b2) => isSignal(orient) ? ifTopExpr(orient.signal, a2, b2) : orient === Top ? { + value: a2 + } : { + value: b2 + }; + const ifRight = (orient, a2, b2) => isSignal(orient) ? ifRightExpr(orient.signal, a2, b2) : orient === Right ? { + value: a2 + } : { + value: b2 + }; + const ifXEnc = ($orient, a2, b2) => ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a2, b2); + const ifYEnc = ($orient, a2, b2) => ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a2, b2); + const ifLeftTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a2, b2); + const ifTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Top}'`, a2, b2); + const ifRightExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Right}'`, a2, b2); + const ifEnc = (test2, a2, b2) => { + a2 = a2 != null ? encoder(a2) : a2; + b2 = b2 != null ? encoder(b2) : b2; + if (isSimple(a2) && isSimple(b2)) { + a2 = a2 ? a2.signal || $(a2.value) : null; + b2 = b2 ? b2.signal || $(b2.value) : null; + return { + signal: `${test2} ? (${a2}) : (${b2})` + }; + } else { + return [extend({ + test: test2 + }, a2)].concat(b2 || []); + } + }; + const isSimple = (enc) => enc == null || Object.keys(enc).length === 1; + const ifExpr = (test2, a2, b2) => ({ + signal: `${test2} ? (${toExpr(a2)}) : (${toExpr(b2)})` + }); + const ifOrient = ($orient, t, b2, l, r) => ({ + signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : "") + (b2 != null ? `${$orient} === '${Bottom}' ? (${toExpr(b2)}) : ` : "") + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : "") + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : "") + "(null)" + }); + const toExpr = (v) => isSignal(v) ? v.signal : v == null ? null : $(v); + const mult = (sign2, value2) => value2 === 0 ? 0 : isSignal(sign2) ? { + signal: `(${sign2.signal}) * ${value2}` + } : { + value: sign2 * value2 + }; + const patch = (value2, base2) => { + const s2 = value2.signal; + return s2 && s2.endsWith("(null)") ? { + signal: s2.slice(0, -6) + base2.signal + } : value2; + }; + function fallback(prop, config, axisConfig2, style2) { let styleProp; - if (config && (0, _vegaUtil.hasOwnProperty)(config, prop)) return config[prop]; - else if ((0, _vegaUtil.hasOwnProperty)(axisConfig, prop)) return axisConfig[prop]; - else if (prop.startsWith('title')) { - switch(prop){ - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } else if (prop.startsWith('label')) { - switch(prop){ - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; + if (config && has$1(config, prop)) { + return config[prop]; + } else if (has$1(axisConfig2, prop)) { + return axisConfig2[prop]; + } else if (prop.startsWith("title")) { + switch (prop) { + case "titleColor": + styleProp = "fill"; + break; + case "titleFont": + case "titleFontSize": + case "titleFontWeight": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideTitleStyle][styleProp]; + } else if (prop.startsWith("label")) { + switch (prop) { + case "labelColor": + styleProp = "fill"; + break; + case "labelFont": + case "labelFontSize": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideLabelStyle][styleProp]; } return null; -} -function keys(objects) { - const map = {}; - for (const obj of objects){ - if (!obj) continue; - for(const key in obj)map[key] = 1; - } - return Object.keys(map); -} -function axisConfig(spec, scope) { - var config = scope.config, style = config.style, axis = config.axis, band = scope.scaleType(spec.scale) === 'band' && config.axisBand, orient = spec.orient, xy, or, key; + } + function keys(objects) { + const map2 = {}; + for (const obj2 of objects) { + if (!obj2) continue; + for (const key2 in obj2) map2[key2] = 1; + } + return Object.keys(map2); + } + function axisConfig(spec, scope) { + var config = scope.config, style2 = config.style, axis = config.axis, band2 = scope.scaleType(spec.scale) === "band" && config.axisBand, orient = spec.orient, xy, or2, key2; if (isSignal(orient)) { - const xyKeys = keys([ - config.axisX, - config.axisY - ]), orientKeys = keys([ - config.axisTop, - config.axisBottom, - config.axisLeft, - config.axisRight - ]); - xy = {}; - for (key of xyKeys)xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style)); - or = {}; - for (key of orientKeys)or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style)); + const xyKeys = keys([config.axisX, config.axisY]), orientKeys = keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]); + xy = {}; + for (key2 of xyKeys) { + xy[key2] = ifX(orient, fallback(key2, config.axisX, axis, style2), fallback(key2, config.axisY, axis, style2)); + } + or2 = {}; + for (key2 of orientKeys) { + or2[key2] = ifOrient(orient.signal, fallback(key2, config.axisTop, axis, style2), fallback(key2, config.axisBottom, axis, style2), fallback(key2, config.axisLeft, axis, style2), fallback(key2, config.axisRight, axis, style2)); + } } else { - xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; + xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; + or2 = config["axis" + orient[0].toUpperCase() + orient.slice(1)]; } - const result = xy || or || band ? (0, _vegaUtil.extend)({}, axis, xy, or, band) : axis; + const result = xy || or2 || band2 ? extend({}, axis, xy, or2, band2) : axis; return result; -} -function axisDomain(spec, config, userEncode, dataRef) { + } + function axisDomain(spec, config, userEncode, dataRef) { const _ = lookup(spec, config), orient = spec.orient; - let enter, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: { - opacity: zero - } + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') + addEncoders(encode2, { + stroke: _("domainColor"), + strokeCap: _("domainCap"), + strokeDash: _("domainDash"), + strokeDashOffset: _("domainDashOffset"), + strokeWidth: _("domainWidth"), + strokeOpacity: _("domainOpacity") }); const pos0 = position(spec, 0); const pos1 = position(spec, 1); - enter.x = update.x = ifX(orient, pos0, zero); - enter.x2 = update.x2 = ifX(orient, pos1); - enter.y = update.y = ifY(orient, pos0, zero); - enter.y2 = update.y2 = ifY(orient, pos1); + enter.x = update2.x = ifX(orient, pos0, zero); + enter.x2 = update2.x2 = ifX(orient, pos1); + enter.y = update2.y = ifY(orient, pos0, zero); + enter.y2 = update2.y2 = ifY(orient, pos1); return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode + type: RuleMark, + role: AxisDomainRole, + from: dataRef, + encode: encode2 }, userEncode); -} -function position(spec, pos) { + } + function position(spec, pos) { return { - scale: spec.scale, - range: pos - }; -} -function axisGrid(spec, config, userEncode, dataRef, band) { - const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign = getSign(orient, 1, -1), offset = offsetValue(spec.offset, sign); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero - } + scale: spec.scale, + range: pos + }; + } + function axisGrid(spec, config, userEncode, dataRef, band2) { + const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign2 = getSign(orient, 1, -1), offset2 = offsetValue(spec.offset, sign2); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') + addEncoders(encode2, { + stroke: _("gridColor"), + strokeCap: _("gridCap"), + strokeDash: _("gridDash"), + strokeDashOffset: _("gridDashOffset"), + strokeOpacity: _("gridOpacity"), + strokeWidth: _("gridWidth") }); const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - const sz = ifX(orient, { - signal: 'height' + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + const sz2 = ifX(orient, { + signal: "height" }, { - signal: 'width' + signal: "width" }); const gridStart = vscale ? { - scale: vscale, - range: 0, - mult: sign, - offset: offset + scale: vscale, + range: 0, + mult: sign2, + offset: offset2 } : { - value: 0, - offset: offset + value: 0, + offset: offset2 }; const gridEnd = vscale ? { - scale: vscale, - range: 1, - mult: sign, - offset: offset - } : (0, _vegaUtil.extend)(sz, { - mult: sign, - offset: offset + scale: vscale, + range: 1, + mult: sign2, + offset: offset2 + } : extend(sz2, { + mult: sign2, + offset: offset2 }); - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); + enter.x = update2.x = ifX(orient, tickPos, gridStart); + enter.y = update2.y = ifY(orient, tickPos, gridStart); + enter.x2 = update2.x2 = ifY(orient, gridEnd); + enter.y2 = update2.y2 = ifX(orient, gridEnd); exit.x = ifX(orient, tickPos); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisGridRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function offsetValue(offset, sign) { - if (sign === 1) ; - else if (!(0, _vegaUtil.isObject)(offset)) offset = isSignal(sign) ? { - signal: `(${sign.signal}) * (${offset || 0})` - } : sign * (offset || 0); - else { - let entry = offset = (0, _vegaUtil.extend)({}, offset); - while(entry.mult != null)if (!(0, _vegaUtil.isObject)(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? { - signal: `(${entry.mult}) * (${sign.signal})` - } : entry.mult * sign; - return offset; - } else entry = entry.mult = (0, _vegaUtil.extend)({}, entry.mult); - entry.mult = sign; - } - return offset; -} -function axisTicks(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero + } + function offsetValue(offset2, sign2) { + if (sign2 === 1) ; + else if (!isObject(offset2)) { + offset2 = isSignal(sign2) ? { + signal: `(${sign2.signal}) * (${offset2 || 0})` + } : sign2 * (offset2 || 0); + } else { + let entry2 = offset2 = extend({}, offset2); + while (entry2.mult != null) { + if (!isObject(entry2.mult)) { + entry2.mult = isSignal(sign2) ? { + signal: `(${entry2.mult}) * (${sign2.signal})` + } : entry2.mult * sign2; + return offset2; + } else { + entry2 = entry2.mult = extend({}, entry2.mult); } + } + entry2.mult = sign2; + } + return offset2; + } + function axisTicks(spec, config, userEncode, dataRef, size, band2) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') + addEncoders(encode2, { + stroke: _("tickColor"), + strokeCap: _("tickCap"), + strokeDash: _("tickDash"), + strokeDashOffset: _("tickDashOffset"), + strokeOpacity: _("tickOpacity"), + strokeWidth: _("tickWidth") }); const tickSize = encoder(size); - tickSize.mult = sign; + tickSize.mult = sign2; const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - update.y = enter.y = ifX(orient, zero, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + update2.y = enter.y = ifX(orient, zero, tickPos); + update2.y2 = enter.y2 = ifX(orient, tickSize); exit.x = ifX(orient, tickPos); - update.x = enter.x = ifY(orient, zero, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); + update2.x = enter.x = ifY(orient, zero, tickPos); + update2.x2 = enter.x2 = ifY(orient, tickSize); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisTickRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function flushExpr(scale, threshold, a, b, c) { + } + function flushExpr(scale2, threshold2, a2, b2, c2) { return { - signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')' + signal: 'flush(range("' + scale2 + '"), scale("' + scale2 + '", datum.value), ' + threshold2 + "," + a2 + "," + b2 + "," + c2 + ")" }; -} -function axisLabels(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, scale = spec.scale, sign = getSign(orient, -1, 1), flush = deref(_('labelFlush')), flushOffset = deref(_('labelFlushOffset')), labelAlign = _('labelAlign'), labelBaseline = _('labelBaseline'); - let flushOn = flush === 0 || !!flush, update; + } + function axisLabels(spec, config, userEncode, dataRef, size, band2) { + const _ = lookup(spec, config), orient = spec.orient, scale2 = spec.scale, sign2 = getSign(orient, -1, 1), flush2 = deref(_("labelFlush")), flushOffset = deref(_("labelFlushOffset")), labelAlign = _("labelAlign"), labelBaseline = _("labelBaseline"); + let flushOn = flush2 === 0 || !!flush2, update2; const tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; + tickSize.mult = sign2; + tickSize.offset = encoder(_("labelPadding") || 0); + tickSize.offset.mult = sign2; const tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - const align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : { - value: 'center' - }, ifRight(orient, 'left', 'right')); - const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : { - value: 'middle' + scale: scale2, + field: Value, + band: 0.5, + offset: extendOffset(band2.offset, _("labelOffset")) + }; + const align = ifX(orient, flushOn ? flushExpr(scale2, flush2, '"left"', '"right"', '"center"') : { + value: "center" + }, ifRight(orient, "left", "right")); + const baseline2 = ifX(orient, ifTop(orient, "bottom", "top"), flushOn ? flushExpr(scale2, flush2, '"top"', '"bottom"', '"middle"') : { + value: "middle" }); - const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); + const offsetExpr = flushExpr(scale2, flush2, `-(${flushOffset})`, flushOffset, 0); flushOn = flushOn && flushOffset; const enter = { - opacity: zero, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - const encode = { - enter: enter, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y, - align, - baseline + opacity: zero, + x: ifX(orient, tickPos, tickSize), + y: ifY(orient, tickPos, tickSize) + }; + const encode2 = { + enter, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero, - x: enter.x, - y: enter.y - } + x: enter.x, + y: enter.y, + align, + baseline: baseline2 + }, + exit: { + opacity: zero, + x: enter.x, + y: enter.y + } }; - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null + addEncoders(encode2, { + dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, + dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null }); - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') + addEncoders(encode2, { + angle: _("labelAngle"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontWeight: _("labelFontWeight"), + fontStyle: _("labelFontStyle"), + limit: _("labelLimit"), + lineHeight: _("labelLineHeight") }, { - align: labelAlign, - baseline: labelBaseline + align: labelAlign, + baseline: labelBaseline }); - const bound = _('labelBound'); - let overlap = _('labelOverlap'); - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? { - scale, - orient, - tolerance: bound - } : null - } : undefined; - if (update.align !== align) update.align = patch(update.align, align); - if (update.baseline !== baseline) update.baseline = patch(update.baseline, baseline); + const bound2 = _("labelBound"); + let overlap = _("labelOverlap"); + overlap = overlap || bound2 ? { + separation: _("labelSeparation"), + method: overlap, + order: "datum.index", + bound: bound2 ? { + scale: scale2, + orient, + tolerance: bound2 + } : null + } : void 0; + if (update2.align !== align) { + update2.align = patch(update2.align, align); + } + if (update2.baseline !== baseline2) { + update2.baseline = patch(update2.baseline, baseline2); + } return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: AxisLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -function axisTitle(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, update; - const encode = { - enter: enter = { - opacity: zero, - anchor: encoder(_('titleAnchor', null)), - align: { - signal: alignExpr$1 - } - }, - update: update = (0, _vegaUtil.extend)({}, enter, { - opacity: one, - text: encoder(spec.title) - }), - exit: { - opacity: zero + } + function axisTitle(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero, + anchor: encoder(_("titleAnchor", null)), + align: { + signal: alignExpr$1 } + }, + update: update2 = extend({}, enter, { + opacity: one, + text: encoder(spec.title) + }), + exit: { + opacity: zero + } }; const titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` + signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` }; - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero, mult(sign, 90)); + update2.x = ifX(orient, titlePos); + update2.y = ifY(orient, titlePos); + enter.angle = ifX(orient, zero, mult(sign2, 90)); enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), { - value: Bottom + value: Bottom }); - update.angle = enter.angle; - update.baseline = enter.baseline; - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + update2.angle = enter.angle; + update2.baseline = enter.baseline; + addEncoders(encode2, { + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') + // require update + align: _("titleAlign"), + angle: _("titleAngle"), + baseline: _("titleBaseline") }); - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); + autoLayout(_, orient, encode2, userEncode); + encode2.update.align = patch(encode2.update.align, enter.align); + encode2.update.angle = patch(encode2.update.angle, enter.angle); + encode2.update.baseline = patch(encode2.update.baseline, enter.baseline); return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: AxisTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim)=>value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false; - const autoY = auto(_('titleX'), 'x'), autoX = auto(_('titleY'), 'y'); - encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); -} -function parseAxis(spec, scope) { - const config = axisConfig(spec, scope), encode = spec.encode || {}, axisEncode = encode.axis || {}, name = axisEncode.name || undefined, interactive = axisEncode.interactive, style = axisEncode.style, _ = lookup(spec, config), band = tickBand(_); - // single-element data source for axis group - const datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - const dataRef = ref(scope.add(Collect({}, [ - datum - ]))); - // data source for axis ticks + } + function autoLayout(_, orient, encode2, userEncode) { + const auto = (value2, dim) => value2 != null ? (encode2.update[dim] = patch(encoder(value2), encode2.update[dim]), false) : !has(dim, userEncode) ? true : false; + const autoY = auto(_("titleX"), "x"), autoX = auto(_("titleY"), "y"); + encode2.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); + } + function parseAxis(spec, scope) { + const config = axisConfig(spec, scope), encode2 = spec.encode || {}, axisEncode = encode2.axis || {}, name = axisEncode.name || void 0, interactive2 = axisEncode.interactive, style2 = axisEncode.style, _ = lookup(spec, config), band2 = tickBand(_); + const datum2 = { + scale: spec.scale, + ticks: !!_("ticks"), + labels: !!_("labels"), + grid: !!_("grid"), + domain: !!_("domain"), + title: spec.title != null + }; + const dataRef = ref(scope.add(Collect({}, [datum2]))); const ticksRef = ref(scope.add(AxisTicks({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + scale: scope.scaleRef(spec.scale), + extra: scope.property(band2.extra), + count: scope.objectProperty(spec.tickCount), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // generate axis marks - const children = []; + const children2 = []; let size; - // include axis gridlines if requested - if (datum.grid) children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - // include axis domain path if requested - if (datum.domain) children.push(axisDomain(spec, config, encode.domain, dataRef)); - // include axis title if defined - if (datum.title) children.push(axisTitle(spec, config, encode.title, dataRef)); - // parse axis specification + if (datum2.grid) { + children2.push(axisGrid(spec, config, encode2.grid, ticksRef, band2)); + } + if (datum2.ticks) { + size = _("tickSize"); + children2.push(axisTicks(spec, config, encode2.ticks, ticksRef, size, band2)); + } + if (datum2.labels) { + size = datum2.ticks ? size : 0; + children2.push(axisLabels(spec, config, encode2.labels, ticksRef, size, band2)); + } + if (datum2.domain) { + children2.push(axisDomain(spec, config, encode2.domain, dataRef)); + } + if (datum2.title) { + children2.push(axisTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: AxisRole, - from: dataRef, - encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: AxisRole, + from: dataRef, + encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function buildAxisEncode(_, spec) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: { - signal: `abs(span(range("${spec.scale}")))` - }, - translate: _('translate'), - // accessibility support - format: spec.format, - formatType: spec.formatType + } + function buildAxisEncode(_, spec) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset") || 0, + position: value(spec.position, 0), + titlePadding: _("titlePadding"), + minExtent: _("minExtent"), + maxExtent: _("maxExtent"), + range: { + signal: `abs(span(range("${spec.scale}")))` + }, + translate: _("translate"), + // accessibility support + format: spec.format, + formatType: spec.formatType }); - return encode; -} -function parseScope(spec, scope, preprocessed) { - const signals = (0, _vegaUtil.array)(spec.signals), scales = (0, _vegaUtil.array)(spec.scales); - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach((_)=>parseSignal(_, scope)); - // parse cartographic projection definitions - (0, _vegaUtil.array)(spec.projections).forEach((_)=>parseProjection(_, scope)); - // initialize scale references - scales.forEach((_)=>initScale(_, scope)); - // parse data sources - (0, _vegaUtil.array)(spec.data).forEach((_)=>parseData(_, scope)); - // parse scale definitions - scales.forEach((_)=>parseScale(_, scope)); - // parse signal updates - (preprocessed || signals).forEach((_)=>parseSignalUpdates(_, scope)); - // parse axis definitions - (0, _vegaUtil.array)(spec.axes).forEach((_)=>parseAxis(_, scope)); - // parse mark definitions - (0, _vegaUtil.array)(spec.marks).forEach((_)=>parseMark(_, scope)); - // parse legend definitions - (0, _vegaUtil.array)(spec.legends).forEach((_)=>parseLegend(_, scope)); - // parse title, if defined + return encode2; + } + function parseScope(spec, scope, preprocessed) { + const signals = array$4(spec.signals), scales2 = array$4(spec.scales); + if (!preprocessed) signals.forEach((_) => parseSignal(_, scope)); + array$4(spec.projections).forEach((_) => parseProjection(_, scope)); + scales2.forEach((_) => initScale(_, scope)); + array$4(spec.data).forEach((_) => parseData(_, scope)); + scales2.forEach((_) => parseScale(_, scope)); + (preprocessed || signals).forEach((_) => parseSignalUpdates(_, scope)); + array$4(spec.axes).forEach((_) => parseAxis(_, scope)); + array$4(spec.marks).forEach((_) => parseMark(_, scope)); + array$4(spec.legends).forEach((_) => parseLegend(_, scope)); if (spec.title) parseTitle(spec.title, scope); - // parse collected lambda (anonymous) expressions scope.parseLambdas(); return scope; -} -const rootEncode = (spec)=>extendEncode({ - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - }, - update: { - width: { - signal: 'width' - }, - height: { - signal: 'height' - } - } - }, spec); -function parseView(spec, scope) { + } + const rootEncode = (spec) => extendEncode({ + enter: { + x: { + value: 0 + }, + y: { + value: 0 + } + }, + update: { + width: { + signal: "width" + }, + height: { + signal: "height" + } + } + }, spec); + function parseView(spec, scope) { const config = scope.config; - // add scenegraph root const root = ref(scope.root = scope.add(operator())); - // parse top-level signal definitions const signals = collectSignals(spec, config); - signals.forEach((_)=>parseSignal(_, scope)); - // assign description, event, legend, and locale configuration + signals.forEach((_) => parseSignal(_, scope)); scope.description = spec.description || config.description; scope.eventConfig = config.events; scope.legends = scope.objectProperty(config.legend && config.legend.layout); scope.locale = config.locale; - // store root group item const input = scope.add(Collect()); - // encode root group item - const encode = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { - pulse: ref(input) + const encode2 = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { + pulse: ref(input) }))); - // perform view layout const parent = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) + layout: scope.objectProperty(spec.layout), + legends: scope.legends, + autosize: scope.signalRef("autosize"), + mark: root, + pulse: ref(encode2) })); scope.operators.pop(); - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); + scope.pushState(ref(encode2), ref(parent), null); parseScope(spec, scope, signals); scope.operators.push(parent); - // bound / render / sieve root item let op = scope.add(Bound({ - mark: root, - pulse: ref(parent) + mark: root, + pulse: ref(parent) })); op = scope.add(Render({ - pulse: ref(op) + pulse: ref(op) })); op = scope.add(Sieve({ - pulse: ref(op) + pulse: ref(op) })); - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); + scope.addData("root", new DataScope(scope, input, input, op)); return scope; -} -function signalObject(name, value) { - return value && value.signal ? { - name, - update: value.signal + } + function signalObject(name, value2) { + return value2 && value2.signal ? { + name, + update: value2.signal } : { - name, - value - }; -} -/** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ function collectSignals(spec, config) { - const _ = (name)=>value(spec[name], config[name]), signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], pre = signals.reduce((p, s)=>(p[s.name] = s, p), {}), map = {}; - // add spec signal array - (0, _vegaUtil.array)(spec.signals).forEach((s)=>{ - if ((0, _vegaUtil.hasOwnProperty)(pre, s.name)) // merge if built-in signal - s = (0, _vegaUtil.extend)(pre[s.name], s); - else // otherwise add to signal list - signals.push(s); - map[s.name] = s; + name, + value: value2 + }; + } + function collectSignals(spec, config) { + const _ = (name) => value(spec[name], config[name]), signals = [signalObject("background", _("background")), signalObject("autosize", parseAutosize(_("autosize"))), signalObject("padding", parsePadding(_("padding"))), signalObject("width", _("width") || 0), signalObject("height", _("height") || 0)], pre = signals.reduce((p, s2) => (p[s2.name] = s2, p), {}), map2 = {}; + array$4(spec.signals).forEach((s2) => { + if (has$1(pre, s2.name)) { + s2 = extend(pre[s2.name], s2); + } else { + signals.push(s2); + } + map2[s2.name] = s2; }); - // add config signal array - (0, _vegaUtil.array)(config.signals).forEach((s)=>{ - if (!(0, _vegaUtil.hasOwnProperty)(map, s.name) && !(0, _vegaUtil.hasOwnProperty)(pre, s.name)) // add to signal list if not already defined - signals.push(s); + array$4(config.signals).forEach((s2) => { + if (!has$1(map2, s2.name) && !has$1(pre, s2.name)) { + signals.push(s2); + } }); return signals; -} -function Scope(config, options) { + } + function Scope(config, options2) { this.config = config || {}; - this.options = options || {}; + this.options = options2 || {}; this.bindings = []; this.field = {}; this.signals = {}; @@ -132577,15 +87160,13 @@ function Scope(config, options) { this.locale = null; this._id = 0; this._subid = 0; - this._nextsub = [ - 0 - ]; + this._nextsub = [0]; this._parent = []; this._encode = []; this._lookup = []; this._markpath = []; -} -function Subscope(scope) { + } + function Subscope(scope) { this.config = scope.config; this.options = scope.options; this.legends = scope.legends; @@ -132605,665 +87186,789 @@ function Subscope(scope) { this._encode = scope._encode.slice(); this._lookup = scope._lookup.slice(); this._markpath = scope._markpath; -} -Scope.prototype = Subscope.prototype = { - parse (spec) { - return parseScope(spec, this); + } + Scope.prototype = Subscope.prototype = { + parse(spec) { + return parseScope(spec, this); }, - fork () { - return new Subscope(this); + fork() { + return new Subscope(this); }, - isSubscope () { - return this._subid > 0; + isSubscope() { + return this._subid > 0; }, - toRuntime () { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; + toRuntime() { + this.finish(); + return { + description: this.description, + operators: this.operators, + streams: this.streams, + updates: this.updates, + bindings: this.bindings, + eventConfig: this.eventConfig, + locale: this.locale + }; }, - id () { - return (this._subid ? this._subid + ':' : 0) + this._id++; + id() { + return (this._subid ? this._subid + ":" : 0) + this._id++; }, - add (op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach((ref)=>{ - ref.$ref = op.id; - }); - op.refs = null; - } - return op; + add(op) { + this.operators.push(op); + op.id = this.id(); + if (op.refs) { + op.refs.forEach((ref2) => { + ref2.$ref = op.id; + }); + op.refs = null; + } + return op; }, - proxy (op) { - const vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy({ - value: vref - })); + proxy(op) { + const vref = op instanceof Entry ? ref(op) : op; + return this.add(Proxy({ + value: vref + })); }, - addStream (stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; + addStream(stream2) { + this.streams.push(stream2); + stream2.id = this.id(); + return stream2; }, - addUpdate (update) { - this.updates.push(update); - return update; + addUpdate(update2) { + this.updates.push(update2); + return update2; }, // Apply metadata - finish () { - let name, ds; - // annotate root - if (this.root) this.root.root = true; - // annotate signals - for(name in this.signals)this.signals[name].signal = name; - // annotate scales - for(name in this.scales)this.scales[name].scale = name; - // annotate data sets - function annotate(op, name, type) { - let data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } + finish() { + let name, ds; + if (this.root) this.root.root = true; + for (name in this.signals) { + this.signals[name].signal = name; + } + for (name in this.scales) { + this.scales[name].scale = name; + } + function annotate(op, name2, type2) { + let data2, list; + if (op) { + data2 = op.data || (op.data = {}); + list = data2[name2] || (data2[name2] = []); + list.push(type2); } - for(name in this.data){ - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for(const field in ds.index)annotate(ds.index[field], name, 'index:' + field); + } + for (name in this.data) { + ds = this.data[name]; + annotate(ds.input, name, "input"); + annotate(ds.output, name, "output"); + annotate(ds.values, name, "values"); + for (const field2 in ds.index) { + annotate(ds.index[field2], name, "index:" + field2); } - return this; + } + return this; }, // ---- - pushState (encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve({ - pulse: encode - })))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); + pushState(encode2, parent, lookup2) { + this._encode.push(ref(this.add(Sieve({ + pulse: encode2 + })))); + this._parent.push(parent); + this._lookup.push(lookup2 ? ref(this.proxy(lookup2)) : null); + this._markpath.push(-1); }, - popState () { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); + popState() { + this._encode.pop(); + this._parent.pop(); + this._lookup.pop(); + this._markpath.pop(); }, - parent () { - return (0, _vegaUtil.peek)(this._parent); + parent() { + return peek$1(this._parent); }, - encode () { - return (0, _vegaUtil.peek)(this._encode); + encode() { + return peek$1(this._encode); }, - lookup () { - return (0, _vegaUtil.peek)(this._lookup); + lookup() { + return peek$1(this._lookup); }, - markpath () { - const p = this._markpath; - return ++p[p.length - 1]; + markpath() { + const p = this._markpath; + return ++p[p.length - 1]; }, // ---- - fieldRef (field, name) { - if ((0, _vegaUtil.isString)(field)) return fieldRef$1(field, name); - if (!field.signal) (0, _vegaUtil.error)('Unsupported field reference: ' + (0, _vegaUtil.stringValue)(field)); - const s = field.signal; - let f = this.field[s]; - if (!f) { - const params = { - name: this.signalRef(s) - }; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field(params))); - } - return f; + fieldRef(field2, name) { + if (isString(field2)) return fieldRef$1(field2, name); + if (!field2.signal) { + error("Unsupported field reference: " + $(field2)); + } + const s2 = field2.signal; + let f = this.field[s2]; + if (!f) { + const params2 = { + name: this.signalRef(s2) + }; + if (name) params2.as = name; + this.field[s2] = f = ref(this.add(Field(params2))); + } + return f; }, - compareRef (cmp) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; - const fields = (0, _vegaUtil.array)(cmp.field).map(check), orders = (0, _vegaUtil.array)(cmp.order).map(check); - return signal ? ref(this.add(Compare({ - fields: fields, - orders: orders - }))) : compareRef(fields, orders); + compareRef(cmp) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; + const fields = array$4(cmp.field).map(check), orders = array$4(cmp.order).map(check); + return signal ? ref(this.add(Compare({ + fields, + orders + }))) : compareRef(fields, orders); }, - keyRef (fields, flat) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; - const sig = this.signals; - fields = (0, _vegaUtil.array)(fields).map(check); - return signal ? ref(this.add(Key({ - fields: fields, - flat: flat - }))) : keyRef(fields, flat); + keyRef(fields, flat) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; + const sig = this.signals; + fields = array$4(fields).map(check); + return signal ? ref(this.add(Key({ + fields, + flat + }))) : keyRef(fields, flat); }, - sortRef (sort) { - if (!sort) return sort; - // including id ensures stable sorting - const a = aggrField(sort.op, sort.field), o = sort.order || Ascending; - return o.signal ? ref(this.add(Compare({ - fields: a, - orders: this.signalRef(o.signal) - }))) : compareRef(a, o); + sortRef(sort2) { + if (!sort2) return sort2; + const a2 = aggrField(sort2.op, sort2.field), o = sort2.order || Ascending; + return o.signal ? ref(this.add(Compare({ + fields: a2, + orders: this.signalRef(o.signal) + }))) : compareRef(a2, o); }, // ---- - event (source, type) { - const key = source + ':' + type; - if (!this.events[key]) { - const id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; + event(source2, type2) { + const key2 = source2 + ":" + type2; + if (!this.events[key2]) { + const id2 = this.id(); + this.streams.push({ + id: id2, + source: source2, + type: type2 + }); + this.events[key2] = id2; + } + return this.events[key2]; }, // ---- - hasOwnSignal (name) { - return (0, _vegaUtil.hasOwnProperty)(this.signals, name); + hasOwnSignal(name) { + return has$1(this.signals, name); }, - addSignal (name, value) { - if (this.hasOwnSignal(name)) (0, _vegaUtil.error)('Duplicate signal name: ' + (0, _vegaUtil.stringValue)(name)); - const op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; + addSignal(name, value2) { + if (this.hasOwnSignal(name)) { + error("Duplicate signal name: " + $(name)); + } + const op = value2 instanceof Entry ? value2 : this.add(operator(value2)); + return this.signals[name] = op; }, - getSignal (name) { - if (!this.signals[name]) (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); - return this.signals[name]; + getSignal(name) { + if (!this.signals[name]) { + error("Unrecognized signal name: " + $(name)); + } + return this.signals[name]; }, - signalRef (s) { - if (this.signals[s]) return ref(this.signals[s]); - else if (!(0, _vegaUtil.hasOwnProperty)(this.lambdas, s)) this.lambdas[s] = this.add(operator(null)); - return ref(this.lambdas[s]); + signalRef(s2) { + if (this.signals[s2]) { + return ref(this.signals[s2]); + } else if (!has$1(this.lambdas, s2)) { + this.lambdas[s2] = this.add(operator(null)); + } + return ref(this.lambdas[s2]); }, - parseLambdas () { - const code = Object.keys(this.lambdas); - for(let i = 0, n = code.length; i < n; ++i){ - const s = code[i], e = (0, _vegaFunctions.parseExpression)(s, this), op = this.lambdas[s]; - op.params = e.$params; - op.update = e.$expr; - } + parseLambdas() { + const code = Object.keys(this.lambdas); + for (let i = 0, n = code.length; i < n; ++i) { + const s2 = code[i], e = parser(s2, this), op = this.lambdas[s2]; + op.params = e.$params; + op.update = e.$expr; + } }, - property (spec) { - return spec && spec.signal ? this.signalRef(spec.signal) : spec; + property(spec) { + return spec && spec.signal ? this.signalRef(spec.signal) : spec; }, - objectProperty (spec) { - return !spec || !(0, _vegaUtil.isObject)(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); + objectProperty(spec) { + return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); }, - exprRef (code, name) { - const params = { - expr: (0, _vegaFunctions.parseExpression)(code, this) - }; - if (name) params.expr.$name = name; - return ref(this.add(Expression(params))); + exprRef(code, name) { + const params2 = { + expr: parser(code, this) + }; + if (name) params2.expr.$name = name; + return ref(this.add(Expression(params2))); }, - addBinding (name, bind) { - if (!this.bindings) (0, _vegaUtil.error)('Nested signals do not support binding: ' + (0, _vegaUtil.stringValue)(name)); - this.bindings.push((0, _vegaUtil.extend)({ - signal: name - }, bind)); + addBinding(name, bind2) { + if (!this.bindings) { + error("Nested signals do not support binding: " + $(name)); + } + this.bindings.push(extend({ + signal: name + }, bind2)); }, // ---- - addScaleProj (name, transform) { - if ((0, _vegaUtil.hasOwnProperty)(this.scales, name)) (0, _vegaUtil.error)('Duplicate scale or projection name: ' + (0, _vegaUtil.stringValue)(name)); - this.scales[name] = this.add(transform); + addScaleProj(name, transform2) { + if (has$1(this.scales, name)) { + error("Duplicate scale or projection name: " + $(name)); + } + this.scales[name] = this.add(transform2); }, - addScale (name, params) { - this.addScaleProj(name, Scale(params)); + addScale(name, params2) { + this.addScaleProj(name, Scale(params2)); }, - addProjection (name, params) { - this.addScaleProj(name, Projection(params)); + addProjection(name, params2) { + this.addScaleProj(name, Projection(params2)); }, - getScale (name) { - if (!this.scales[name]) (0, _vegaUtil.error)('Unrecognized scale name: ' + (0, _vegaUtil.stringValue)(name)); - return this.scales[name]; + getScale(name) { + if (!this.scales[name]) { + error("Unrecognized scale name: " + $(name)); + } + return this.scales[name]; }, - scaleRef (name) { - return ref(this.getScale(name)); + scaleRef(name) { + return ref(this.getScale(name)); }, - scaleType (name) { - return this.getScale(name).params.type; + scaleType(name) { + return this.getScale(name).params.type; }, - projectionRef (name) { - return this.scaleRef(name); + projectionRef(name) { + return this.scaleRef(name); }, - projectionType (name) { - return this.scaleType(name); + projectionType(name) { + return this.scaleType(name); }, // ---- - addData (name, dataScope) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name] = dataScope; + addData(name, dataScope) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.data[name] = dataScope; }, - getData (name) { - if (!this.data[name]) (0, _vegaUtil.error)('Undefined data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name]; + getData(name) { + if (!this.data[name]) { + error("Undefined data set name: " + $(name)); + } + return this.data[name]; }, - addDataPipeline (name, entries) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.addData(name, DataScope.fromEntries(this, entries)); - } -}; -function propertyLambda(spec) { - return ((0, _vegaUtil.isArray)(spec) ? arrayLambda : objectLambda)(spec); -} -function arrayLambda(array) { - const n = array.length; - let code = '['; - for(let i = 0; i < n; ++i){ - const value = array[i]; - code += (i > 0 ? ',' : '') + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + ']'; -} -function objectLambda(obj) { - let code = '{', i = 0, key, value; - for(key in obj){ - value = obj[key]; - code += (++i > 1 ? ',' : '') + (0, _vegaUtil.stringValue)(key) + ':' + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + '}'; -} -/** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ function defaults() { - const defaultFont = 'sans-serif', defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = '#4c78a8', black = '#000', gray = '#888', lightGray = '#ddd'; + addDataPipeline(name, entries) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.addData(name, DataScope.fromEntries(this, entries)); + } + }; + function propertyLambda(spec) { + return (isArray(spec) ? arrayLambda : objectLambda)(spec); + } + function arrayLambda(array2) { + const n = array2.length; + let code = "["; + for (let i = 0; i < n; ++i) { + const value2 = array2[i]; + code += (i > 0 ? "," : "") + (isObject(value2) ? value2.signal || propertyLambda(value2) : $(value2)); + } + return code + "]"; + } + function objectLambda(obj2) { + let code = "{", i = 0, key2, value2; + for (key2 in obj2) { + value2 = obj2[key2]; + code += (++i > 1 ? "," : "") + $(key2) + ":" + (isObject(value2) ? value2.signal || propertyLambda(value2) : $(value2)); + } + return code + "}"; + } + function defaults() { + const defaultFont = "sans-serif", defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = "#4c78a8", black = "#000", gray = "#888", lightGray = "#ddd"; return { - // default visualization description - description: 'Vega visualization', - // default padding around visualization + // default visualization description + description: "Vega visualization", + // default padding around visualization + padding: 0, + // default for automatic sizing; options: 'none', 'pad', 'fit' + // or provide an object (e.g., {'type': 'pad', 'resize': true}) + autosize: "pad", + // default view background color + // covers the entire view component + background: null, + // default event handling configuration + // preventDefault for view-sourced event types except 'wheel' + events: { + defaults: { + allow: ["wheel"] + } + }, + // defaults for top-level group marks + // accepts mark properties (fill, stroke, etc) + // covers the data rectangle within group width/height + group: null, + // defaults for basic mark types + // each subset accepts mark properties (fill, stroke, etc) + mark: null, + arc: { + fill: defaultColor + }, + area: { + fill: defaultColor + }, + image: null, + line: { + stroke: defaultColor, + strokeWidth: defaultStrokeWidth + }, + path: { + stroke: defaultColor + }, + rect: { + fill: defaultColor + }, + rule: { + stroke: black + }, + shape: { + stroke: defaultColor + }, + symbol: { + fill: defaultColor, + size: 64 + }, + text: { + fill: black, + font: defaultFont, + fontSize: 11 + }, + trail: { + fill: defaultColor, + size: defaultStrokeWidth + }, + // style definitions + style: { + // axis & legend labels + "guide-label": { + fill: black, + font: defaultFont, + fontSize: 10 + }, + // axis & legend titles + "guide-title": { + fill: black, + font: defaultFont, + fontSize: 11, + fontWeight: "bold" + }, + // headers, including chart title + "group-title": { + fill: black, + font: defaultFont, + fontSize: 13, + fontWeight: "bold" + }, + // chart subtitle + "group-subtitle": { + fill: black, + font: defaultFont, + fontSize: 12 + }, + // defaults for styled point marks in Vega-Lite + point: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "circle" + }, + circle: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth + }, + square: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "square" + }, + // defaults for styled group marks in Vega-Lite + cell: { + fill: "transparent", + stroke: lightGray + }, + view: { + fill: "transparent" + } + }, + // defaults for title + title: { + orient: "top", + anchor: "middle", + offset: 4, + subtitlePadding: 3 + }, + // defaults for axes + axis: { + minExtent: 0, + maxExtent: 200, + bandPosition: 0.5, + domain: true, + domainWidth: 1, + domainColor: gray, + grid: false, + gridWidth: 1, + gridColor: lightGray, + labels: true, + labelAngle: 0, + labelLimit: 180, + labelOffset: 0, + labelPadding: 2, + ticks: true, + tickColor: gray, + tickOffset: 0, + tickRound: true, + tickSize: 5, + tickWidth: 1, + titlePadding: 4 + }, + // correction for centering bias + axisBand: { + tickOffset: -0.5 + }, + // defaults for cartographic projection + projection: { + type: "mercator" + }, + // defaults for legends + legend: { + orient: "right", padding: 0, - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - // default view background color - // covers the entire view component - background: null, - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: { - allow: [ - 'wheel' - ] - } - }, - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - }, - view: { - fill: 'transparent' - } - }, - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 + gridAlign: "each", + columnPadding: 10, + rowPadding: 2, + symbolDirection: "vertical", + gradientDirection: "vertical", + gradientLength: 200, + gradientThickness: 16, + gradientStrokeColor: lightGray, + gradientStrokeWidth: 0, + gradientLabelOffset: 2, + labelAlign: "left", + labelBaseline: "middle", + labelLimit: 160, + labelOffset: 4, + labelOverlap: true, + symbolLimit: 30, + symbolType: "circle", + symbolSize: 100, + symbolOffset: 0, + symbolStrokeWidth: 1.5, + symbolBaseFillColor: "transparent", + symbolBaseStrokeColor: gray, + titleLimit: 180, + titleOrient: "top", + titlePadding: 5, + layout: { + offset: 18, + direction: "horizontal", + left: { + direction: "vertical" + }, + right: { + direction: "vertical" + } + } + }, + // defaults for scale ranges + range: { + category: { + scheme: "tableau10" }, - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 + ordinal: { + scheme: "blues" }, - // correction for centering bias - axisBand: { - tickOffset: -0.5 + heatmap: { + scheme: "yellowgreenblue" }, - // defaults for cartographic projection - projection: { - type: 'mercator' + ramp: { + scheme: "blues" }, - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { - direction: 'vertical' - }, - right: { - direction: 'vertical' - } - } + diverging: { + scheme: "blueorange", + extent: [1, 0] }, - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [ - 1, - 0 - ] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } + symbol: ["circle", "square", "triangle-up", "cross", "diamond", "triangle-right", "triangle-down", "triangle-left"] + } }; -} -function parse(spec, config, options) { - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)('Input Vega specification must be an object.'); - config = (0, _vegaUtil.mergeConfig)(defaults(), config, spec.config); - return parseView(spec, new Scope(config, options)).toRuntime(); -} - -},{"vega-util":"f2ulH","vega-functions":"6VJ1U","vega-event-selector":"b96Fh","vega-scale":"gHN3E","vega-dataflow":"cFRfY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b96Fh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "parseSelector", ()=>eventSelector); -const VIEW = 'view', LBRACK = '[', RBRACK = ']', LBRACE = '{', RBRACE = '}', COLON = ':', COMMA = ',', NAME = '@', GT = '>', ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 -}; -let DEFAULT_SOURCE, MARKS; -/** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ function eventSelector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); -} -function isMarkType(type) { - return MARKS[type]; -} -function find(s, i, endChar, pushChar, popChar) { - const n = s.length; - let count = 0, c; - for(; i < n; ++i){ - c = s[i]; - if (!count && c === endChar) return i; - else if (popChar && popChar.indexOf(c) >= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; + } + function parse(spec, config, options2) { + if (!isObject(spec)) { + error("Input Vega specification must be an object."); } - return i; -} -function parseMerge(s) { - const output = [], n = s.length; - let start = 0, i = 0; - while(i < n){ - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - if (output.length === 0) throw 'Empty event selector: ' + s; - return output; -} -function parseSelector(s) { - return s[0] === '[' ? parseBetween(s) : parseStream(s); -} -function parseBetween(s) { - const n = s.length; - let i = 1, b; - i = find(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) throw 'Empty between selector: ' + s; - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) throw 'Between selector must have two elements: ' + s; - s = s.slice(i + 1).trim(); - if (s[0] !== GT) throw 'Expected \'>\' after between selector: ' + s; - b = b.map(parseSelector); - const stream = parseSelector(s.slice(1).trim()); - if (stream.between) return { - between: b, - stream: stream - }; - else stream.between = b; - return stream; -} -function parseStream(s) { - const stream = { - source: DEFAULT_SOURCE - }, source = []; - let throttle = [ - 0, - 0 - ], markname = 0, start = 0, n = s.length, i = 0, j, filter; - // extract throttle from end - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - if (!n) throw s; - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - // extract first part of multi-part stream selector - j = find(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; + config = mergeConfig(defaults(), config, spec.config); + return parseView(spec, new Scope(config, options2)).toRuntime(); + } + var version$1 = "6.2.0"; + extend(transforms, tx, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf); + const version = version$1; + const vega = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Bounds, + CanvasHandler, + CanvasRenderer, + DATE, + DAY, + DAYOFYEAR, + Dataflow, + Debug, + DisallowedObjectProperties, + Error: Error$1, + EventStream, + Gradient: Gradient$1, + GroupItem, + HOURS, + Handler, + HybridHandler, + HybridRenderer, + Info, + Item, + MILLISECONDS, + MINUTES, + MONTH, + Marks, + MultiPulse, + None: None$2, + Operator, + Parameters, + Pulse, + QUARTER, + RenderType, + Renderer, + ResourceLoader, + SECONDS, + SVGHandler, + SVGRenderer, + SVGStringRenderer, + Scenegraph, + TIME_UNITS, + Transform, + View: View$1, + WEEK, + Warn, + YEAR, + accessor, + accessorFields, + accessorName, + array: array$4, + ascending: ascending$1, + bandwidthNRD: estimateBandwidth, + bin, + bootstrapCI, + boundClip, + boundContext, + boundItem: boundItem$1, + boundMark, + boundStroke, + changeset, + clampRange, + codegenExpression: codegen, + compare: compare$1, + constant: constant$4, + cumulativeLogNormal, + cumulativeNormal, + cumulativeUniform, + dayofyear, + debounce, + defaultLocale, + definition: definition$1, + densityLogNormal, + densityNormal, + densityUniform, + domChild, + domClear, + domCreate, + domFind, + dotbin, + error, + expressionFunction, + extend, + extent, + extentIndex, + falsy, + fastmap, + field: field$1, + flush, + font, + fontFamily, + fontSize, + format: format$2, + formatLocale: numberFormatDefaultLocale, + formats: formats$1, + hasOwnProperty: has$1, + id, + identity: identity$2, + inferType, + inferTypes, + ingest: ingest$1, + inherits, + inrange, + interpolate, + interpolateColors, + interpolateRange, + intersect: intersect$2, + intersectBoxLine, + intersectPath, + intersectPoint, + intersectRule, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isFunction, + isIterable, + isNumber: isNumber$1, + isObject, + isRegExp, + isString, + isTuple, + key, + lerp, + lineHeight, + loader, + locale, + logger, + lruCache, + markup, + merge: merge$2, + mergeConfig, + multiLineOffset, + one: one$1, + pad: pad$1, + panLinear, + panLog, + panPow, + panSymlog, + parse, + parseExpression: parser$1, + parseSelector: eventSelector, + path: path$3, + pathCurves: curves, + pathEqual, + pathParse: parse$3, + pathRectangle: vg_rect, + pathRender, + pathSymbols: symbols, + pathTrail: vg_trail, + peek: peek$1, + point, + projection, + quantileLogNormal, + quantileNormal, + quantileUniform, + quantiles, + quantizeInterpolator, + quarter, + quartiles, + get random() { + return random; + }, + randomInteger: integer, + randomKDE: kde, + randomLCG: lcg$2, + randomLogNormal: lognormal, + randomMixture: mixture$1, + randomNormal: gaussian, + randomUniform: uniform, + read, + regressionConstant: constant$3, + regressionExp: exp$1, + regressionLinear: linear, + regressionLoess: loess, + regressionLog: log$2, + regressionPoly: poly, + regressionPow: pow$2, + regressionQuad: quad, + renderModule, + repeat, + resetDefaultLocale, + resetSVGDefIds, + responseType, + runtimeContext: context, + sampleCurve, + sampleLogNormal, + sampleNormal, + sampleUniform, + scale: scale$4, + sceneEqual, + sceneFromJSON, + scenePickVisit: pickVisit, + sceneToJSON, + sceneVisit: visit, + sceneZOrder: zorder, + scheme, + serializeXML, + setHybridRendererOptions, + setRandom, + span, + splitAccessPath, + stringValue: $, + textMetrics, + timeBin: bin$1, + timeFloor, + timeFormatLocale: timeFormatDefaultLocale, + timeInterval, + timeOffset, + timeSequence, + timeUnitSpecifier, + timeUnits, + toBoolean, + toDate, + toNumber, + toSet, + toString, + transform: transform$2, + transforms, + truncate: truncate$1, + truthy, + tupleid, + typeParsers, + utcFloor, + utcInterval, + utcOffset, + utcSequence, + utcdayofyear, + utcquarter, + utcweek, + version, + visitArray, + week, + writeConfig, + zero: zero$1, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog + }, Symbol.toStringTag, { value: "Module" })); + use$1(fluentUI, vega); + const staticContent = Array.from(document.querySelectorAll("a.sanddance-app-static-content")); + const dataSets = staticContent.filter((f) => f.id).map((n) => { + const forData = staticContent.filter((f) => f.dataset["for"] === n.id)[0]; + return { + dataSourceType: "sample", + id: n.id, + displayName: n.dataset["displayName"], + dataUrl: n.href, + type: n.dataset["type"], + snapshotsUrl: forData ? forData.href : null + }; + }); + let explorer; + const undef = "undefined"; + ReactDOM__namespace.render(React__namespace.createElement(SandDanceApp, { setTheme: typeof setTheme !== undef && setTheme, darkTheme: typeof darkTheme !== undef && darkTheme, insights: typeof insights !== undef && insights, initialOptions: typeof options !== undef && options, themeColors: typeof themeColors !== undef && themeColors, dataSources: dataSets, mounted: (app) => { + explorer = app.explorer; + } }), document.getElementById("app")); + const z = "z".charCodeAt(0); + const Z = "Z".charCodeAt(0); + document.onkeyup = (e) => { + if (e.ctrlKey && (e.keyCode === z || e.keyCode === Z)) { + if (e.shiftKey) { + explorer.redo(); + } else { + explorer.undo(); + } } - // extract remaining part of stream selector - i = find(s, i, LBRACK); - if (i === n) source.push(s.substring(start, n).trim()); - else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - // extract filters - while(i < n){ - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - // marshall event stream specification - if (!(n = source.length) || ILLEGAL.test(source[n - 1])) throw 'Invalid event selector: ' + s; - if (n > 1) { - stream.type = source[1]; - if (markname) stream.markname = source[0].slice(1); - else if (isMarkType(source[0])) stream.marktype = source[0]; - else stream.source = source[0]; - } else stream.type = source[0]; - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; -} -function parseThrottle(s) { - const a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map((_)=>{ - const x = +_; - if (x !== x) throw s; - return x; - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}]},["bxQeC"], "bxQeC", "parcelRequirec6f8", {}) - + }; + window["SandDanceApp"] = { explorer, SandDanceExplorer }; +})); diff --git a/docs/tests/v4/es6/js/sanddance-test-es6.js b/docs/tests/v4/es6/js/sanddance-test-es6.js index c84af1cad..2ea3ab95b 100644 --- a/docs/tests/v4/es6/js/sanddance-test-es6.js +++ b/docs/tests/v4/es6/js/sanddance-test-es6.js @@ -1,42116 +1,28229 @@ -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles - -(function ( - modules, - entry, - mainEntry, - parcelRequireName, - externals, - distDir, - publicUrl, - devServer -) { - /* eslint-disable no-undef */ - var globalObject = - typeof globalThis !== 'undefined' - ? globalThis - : typeof self !== 'undefined' - ? self - : typeof window !== 'undefined' - ? window - : typeof global !== 'undefined' - ? global - : {}; - /* eslint-enable no-undef */ - - // Save the require from previous bundle to this closure if any - var previousRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - - var importMap = previousRequire.i || {}; - var cache = previousRequire.cache || {}; - // Do not use `require` to prevent Webpack from trying to bundle this call - var nodeRequire = - typeof module !== 'undefined' && - typeof module.require === 'function' && - module.require.bind(module); - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - if (externals[name]) { - return externals[name]; - } - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error("Cannot find module '" + name + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = (cache[name] = new newRequire.Module(name)); - - modules[name][0].call( - module.exports, - localRequire, - module, - module.exports, - globalObject - ); - } - - return cache[name].exports; - - function localRequire(x) { - var res = localRequire.resolve(x); - return res === false ? {} : newRequire(res); - } - - function resolve(x) { - var id = modules[name][1][x]; - return id != null ? id : x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.require = nodeRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.distDir = distDir; - newRequire.publicUrl = publicUrl; - newRequire.devServer = devServer; - newRequire.i = importMap; - newRequire.register = function (id, exports) { - modules[id] = [ - function (require, module) { - module.exports = exports; - }, - {}, - ]; - }; - - // Only insert newRequire.load when it is actually used. - // The code in this file is linted against ES5, so dynamic import is not allowed. - // INSERT_LOAD_HERE - - Object.defineProperty(newRequire, 'root', { - get: function () { - return globalObject[parcelRequireName]; - }, - }); - - globalObject[parcelRequireName] = newRequire; - - for (var i = 0; i < entry.length; i++) { - newRequire(entry[i]); - } - - if (mainEntry) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(mainEntry); - - // CommonJS - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === 'function' && define.amd) { - define(function () { - return mainExports; - }); - } +(function(factory) { + typeof define === "function" && define.amd ? define(factory) : factory(); +})((function() { + "use strict"; + function accessor(fn2, fields, name) { + fn2.fields = fields || []; + fn2.fname = name; + return fn2; } -})({"adfDD":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var _vega = require("vega"); -var _sanddance = require("@msrvida/sanddance"); -const data = []; -const size = 100; -for(let x = 0; x < size; x++)for(let y = 0; y < size; y++){ - const id = x * y; - const z = Math.random() * size * (x % 10) * (y % 10); - const w = Math.random() * size; - data.push({ - id, - x, - y, - z, - w - }); -} -_sanddance.use(_vega); -const viewer = new _sanddance.Viewer(document.getElementById('vis')); -const insight = { - columns: { - color: 'z', - uid: 'id', - x: 'x', - y: 'y', - z: 'z' - }, - scheme: 'blues', - size: { - height: 500, - width: 500 - }, - chart: 'scatterplot', - view: '3d' -}; -viewer.render({ - insight -}, data); - -},{"vega":"2BRQe","@msrvida/sanddance":"4UlE2"}],"2BRQe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>(0, _vegaDataflow.Dataflow)); -parcelHelpers.export(exports, "EventStream", ()=>(0, _vegaDataflow.EventStream)); -parcelHelpers.export(exports, "MultiPulse", ()=>(0, _vegaDataflow.MultiPulse)); -parcelHelpers.export(exports, "Operator", ()=>(0, _vegaDataflow.Operator)); -parcelHelpers.export(exports, "Parameters", ()=>(0, _vegaDataflow.Parameters)); -parcelHelpers.export(exports, "Pulse", ()=>(0, _vegaDataflow.Pulse)); -parcelHelpers.export(exports, "Transform", ()=>(0, _vegaDataflow.Transform)); -parcelHelpers.export(exports, "changeset", ()=>(0, _vegaDataflow.changeset)); -parcelHelpers.export(exports, "definition", ()=>(0, _vegaDataflow.definition)); -parcelHelpers.export(exports, "ingest", ()=>(0, _vegaDataflow.ingest)); -parcelHelpers.export(exports, "isTuple", ()=>(0, _vegaDataflow.isTuple)); -parcelHelpers.export(exports, "transform", ()=>(0, _vegaDataflow.transform)); -parcelHelpers.export(exports, "transforms", ()=>(0, _vegaDataflow.transforms)); -parcelHelpers.export(exports, "tupleid", ()=>(0, _vegaDataflow.tupleid)); -parcelHelpers.export(exports, "interpolate", ()=>(0, _vegaScale.interpolate)); -parcelHelpers.export(exports, "interpolateColors", ()=>(0, _vegaScale.interpolateColors)); -parcelHelpers.export(exports, "interpolateRange", ()=>(0, _vegaScale.interpolateRange)); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>(0, _vegaScale.quantizeInterpolator)); -parcelHelpers.export(exports, "scale", ()=>(0, _vegaScale.scale)); -parcelHelpers.export(exports, "scheme", ()=>(0, _vegaScale.scheme)); -parcelHelpers.export(exports, "projection", ()=>(0, _vegaProjection.projection)); -parcelHelpers.export(exports, "View", ()=>(0, _vegaView.View)); -parcelHelpers.export(exports, "defaultLocale", ()=>(0, _vegaFormat.defaultLocale)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _vegaFormat.numberFormatDefaultLocale)); -parcelHelpers.export(exports, "locale", ()=>(0, _vegaFormat.locale)); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>(0, _vegaFormat.resetDefaultLocale)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _vegaFormat.timeFormatDefaultLocale)); -parcelHelpers.export(exports, "expressionFunction", ()=>(0, _vegaFunctions.expressionFunction)); -parcelHelpers.export(exports, "parse", ()=>(0, _vegaParser.parse)); -parcelHelpers.export(exports, "runtimeContext", ()=>(0, _vegaRuntime.context)); -parcelHelpers.export(exports, "codegenExpression", ()=>(0, _vegaExpression.codegenExpression)); -parcelHelpers.export(exports, "parseExpression", ()=>(0, _vegaExpression.parseExpression)); -parcelHelpers.export(exports, "parseSelector", ()=>(0, _vegaEventSelector.parseSelector)); -parcelHelpers.export(exports, "version", ()=>version); -var _vegaUtil = require("vega-util"); -parcelHelpers.exportAll(_vegaUtil, exports); -var _vegaDataflow = require("vega-dataflow"); -var _vegaTransforms = require("vega-transforms"); -var _vegaViewTransforms = require("vega-view-transforms"); -var _vegaEncode = require("vega-encode"); -var _vegaGeo = require("vega-geo"); -var _vegaForce = require("vega-force"); -var _vegaHierarchy = require("vega-hierarchy"); -var _vegaLabel = require("vega-label"); -var _vegaRegression = require("vega-regression"); -var _vegaVoronoi = require("vega-voronoi"); -var _vegaWordcloud = require("vega-wordcloud"); -var _vegaCrossfilter = require("vega-crossfilter"); -var _vegaStatistics = require("vega-statistics"); -parcelHelpers.exportAll(_vegaStatistics, exports); -var _vegaTime = require("vega-time"); -parcelHelpers.exportAll(_vegaTime, exports); -var _vegaLoader = require("vega-loader"); -parcelHelpers.exportAll(_vegaLoader, exports); -var _vegaScenegraph = require("vega-scenegraph"); -parcelHelpers.exportAll(_vegaScenegraph, exports); -var _vegaScale = require("vega-scale"); -var _vegaProjection = require("vega-projection"); -var _vegaView = require("vega-view"); -var _vegaFormat = require("vega-format"); -var _vegaFunctions = require("vega-functions"); -var _vegaParser = require("vega-parser"); -var _vegaRuntime = require("vega-runtime"); -var _vegaExpression = require("vega-expression"); -var _vegaEventSelector = require("vega-event-selector"); -var version = "5.32.0"; -// -- Transforms ----- -(0, _vegaUtil.extend)((0, _vegaDataflow.transforms), _vegaTransforms, _vegaViewTransforms, _vegaEncode, _vegaGeo, _vegaForce, _vegaLabel, _vegaHierarchy, _vegaRegression, _vegaVoronoi, _vegaWordcloud, _vegaCrossfilter); - -},{"vega-util":"bApja","vega-dataflow":"3NitK","vega-transforms":"gA9mK","vega-view-transforms":"i63Ad","vega-encode":"fpesP","vega-geo":"3rF9B","vega-force":"4JCry","vega-hierarchy":"lserr","vega-label":"lZyUZ","vega-regression":"elv3U","vega-voronoi":"96rkJ","vega-wordcloud":"7Z7Aq","vega-crossfilter":"8iEZv","vega-statistics":"5ncfv","vega-time":"27kpp","vega-loader":"gmbOr","vega-scenegraph":"jattk","vega-scale":"bEydG","vega-projection":"4wv4C","vega-view":"cGC2i","vega-format":"47kOt","vega-functions":"iuqsd","vega-parser":"hsy9Z","vega-runtime":"k7ppL","vega-expression":"2l1no","vega-event-selector":"gXMNx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bApja":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Debug", ()=>Debug); -parcelHelpers.export(exports, "Error", ()=>Error$1); -parcelHelpers.export(exports, "Info", ()=>Info); -parcelHelpers.export(exports, "None", ()=>None); -parcelHelpers.export(exports, "Warn", ()=>Warn); -parcelHelpers.export(exports, "accessor", ()=>accessor); -parcelHelpers.export(exports, "accessorFields", ()=>accessorFields); -parcelHelpers.export(exports, "accessorName", ()=>accessorName); -parcelHelpers.export(exports, "array", ()=>array); -parcelHelpers.export(exports, "ascending", ()=>ascending); -parcelHelpers.export(exports, "clampRange", ()=>clampRange); -parcelHelpers.export(exports, "compare", ()=>compare); -parcelHelpers.export(exports, "constant", ()=>constant); -parcelHelpers.export(exports, "debounce", ()=>debounce); -parcelHelpers.export(exports, "error", ()=>error); -parcelHelpers.export(exports, "extend", ()=>extend); -parcelHelpers.export(exports, "extent", ()=>extent); -parcelHelpers.export(exports, "extentIndex", ()=>extentIndex); -parcelHelpers.export(exports, "falsy", ()=>falsy); -parcelHelpers.export(exports, "fastmap", ()=>fastmap); -parcelHelpers.export(exports, "field", ()=>field); -parcelHelpers.export(exports, "flush", ()=>flush); -parcelHelpers.export(exports, "hasOwnProperty", ()=>has); -parcelHelpers.export(exports, "id", ()=>id); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "inherits", ()=>inherits); -parcelHelpers.export(exports, "inrange", ()=>inrange); -parcelHelpers.export(exports, "isArray", ()=>isArray); -parcelHelpers.export(exports, "isBoolean", ()=>isBoolean); -parcelHelpers.export(exports, "isDate", ()=>isDate); -parcelHelpers.export(exports, "isFunction", ()=>isFunction); -parcelHelpers.export(exports, "isIterable", ()=>isIterable); -parcelHelpers.export(exports, "isNumber", ()=>isNumber); -parcelHelpers.export(exports, "isObject", ()=>isObject); -parcelHelpers.export(exports, "isRegExp", ()=>isRegExp); -parcelHelpers.export(exports, "isString", ()=>isString); -parcelHelpers.export(exports, "key", ()=>key); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "logger", ()=>logger); -parcelHelpers.export(exports, "lruCache", ()=>lruCache); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "mergeConfig", ()=>mergeConfig); -parcelHelpers.export(exports, "one", ()=>one); -parcelHelpers.export(exports, "pad", ()=>pad); -parcelHelpers.export(exports, "panLinear", ()=>panLinear); -parcelHelpers.export(exports, "panLog", ()=>panLog); -parcelHelpers.export(exports, "panPow", ()=>panPow); -parcelHelpers.export(exports, "panSymlog", ()=>panSymlog); -parcelHelpers.export(exports, "peek", ()=>peek); -parcelHelpers.export(exports, "quarter", ()=>quarter); -parcelHelpers.export(exports, "repeat", ()=>repeat); -parcelHelpers.export(exports, "span", ()=>span); -parcelHelpers.export(exports, "splitAccessPath", ()=>splitAccessPath); -parcelHelpers.export(exports, "stringValue", ()=>$); -parcelHelpers.export(exports, "toBoolean", ()=>toBoolean); -parcelHelpers.export(exports, "toDate", ()=>toDate); -parcelHelpers.export(exports, "toNumber", ()=>toNumber); -parcelHelpers.export(exports, "toSet", ()=>toSet); -parcelHelpers.export(exports, "toString", ()=>toString); -parcelHelpers.export(exports, "truncate", ()=>truncate); -parcelHelpers.export(exports, "truthy", ()=>truthy); -parcelHelpers.export(exports, "utcquarter", ()=>utcquarter); -parcelHelpers.export(exports, "visitArray", ()=>visitArray); -parcelHelpers.export(exports, "writeConfig", ()=>writeConfig); -parcelHelpers.export(exports, "zero", ()=>zero); -parcelHelpers.export(exports, "zoomLinear", ()=>zoomLinear); -parcelHelpers.export(exports, "zoomLog", ()=>zoomLog); -parcelHelpers.export(exports, "zoomPow", ()=>zoomPow); -parcelHelpers.export(exports, "zoomSymlog", ()=>zoomSymlog); -function accessor(fn, fields, name) { - fn.fields = fields || []; - fn.fname = name; - return fn; -} -function accessorName(fn) { - return fn == null ? null : fn.fname; -} -function accessorFields(fn) { - return fn == null ? null : fn.fields; -} -function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); -} -const get1 = (field)=>function(obj) { - return obj[field]; - }; -const getN = (path)=>{ - const len = path.length; - return function(obj) { - for(let i = 0; i < len; ++i)obj = obj[path[i]]; - return obj; - }; -}; -function error(message) { + function accessorName(fn2) { + return fn2 == null ? null : fn2.fname; + } + function accessorFields(fn2) { + return fn2 == null ? null : fn2.fields; + } + function getter$1(path2) { + return path2.length === 1 ? get1(path2[0]) : getN(path2); + } + const get1 = (field2) => function(obj2) { + return obj2[field2]; + }; + const getN = (path2) => { + const len2 = path2.length; + return function(obj2) { + for (let i = 0; i < len2; ++i) { + obj2 = obj2[path2[i]]; + } + return obj2; + }; + }; + function error(message) { throw Error(message); -} -function splitAccessPath(p) { - const path = [], n = p.length; - let q = null, b = 0, s = '', i, j, c; - p = p + ''; - function push() { - path.push(s + p.substring(i, j)); - s = ''; + } + function splitAccessPath(p) { + const path2 = [], n = p.length; + let q = null, b2 = 0, s = "", i, j, c2; + p = p + ""; + function push2() { + path2.push(s + p.substring(i, j)); + s = ""; + i = j + 1; + } + for (i = j = 0; j < n; ++j) { + c2 = p[j]; + if (c2 === "\\") { + s += p.substring(i, j++); + i = j; + } else if (c2 === q) { + push2(); + q = null; + b2 = -1; + } else if (q) { + continue; + } else if (i === b2 && c2 === '"') { + i = j + 1; + q = c2; + } else if (i === b2 && c2 === "'") { + i = j + 1; + q = c2; + } else if (c2 === "." && !b2) { + if (j > i) { + push2(); + } else { + i = j + 1; + } + } else if (c2 === "[") { + if (j > i) push2(); + b2 = i = j + 1; + } else if (c2 === "]") { + if (!b2) error("Access path missing open bracket: " + p); + if (b2 > 0) push2(); + b2 = 0; i = j + 1; + } } - for(i = j = 0; j < n; ++j){ - c = p[j]; - if (c === '\\') { - s += p.substring(i, j++); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) continue; - else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) push(); - else i = j + 1; - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); + if (b2) error("Access path missing closing bracket: " + p); + if (q) error("Access path missing closing quote: " + p); if (j > i) { - j++; - push(); - } - return path; -} -function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [ - field - ], name || field); -} -const id = field('id'); -const identity = accessor((_)=>_, [], 'identity'); -const zero = accessor(()=>0, [], 'zero'); -const one = accessor(()=>1, [], 'one'); -const truthy = accessor(()=>true, [], 'true'); -const falsy = accessor(()=>false, [], 'false'); -function log$1(method, level, input) { - const args = [ - level - ].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console -} -const None = 0; -const Error$1 = 1; -const Warn = 2; -const Info = 3; -const Debug = 4; -function logger(_, method) { - let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1; - let level = _ || None; + j++; + push2(); + } + return path2; + } + function field$1(field2, name, opt) { + const path2 = splitAccessPath(field2); + field2 = path2.length === 1 ? path2[0] : field2; + return accessor((opt && opt.get || getter$1)(path2), [field2], name || field2); + } + const id = field$1("id"); + const identity$7 = accessor((_) => _, [], "identity"); + const zero$3 = accessor(() => 0, [], "zero"); + const one$2 = accessor(() => 1, [], "one"); + const truthy = accessor(() => true, [], "true"); + const falsy = accessor(() => false, [], "false"); + const DisallowedObjectProperties = /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + function log$1$1(method2, level, input) { + const args = [level].concat([].slice.call(input)); + console[method2].apply(console, args); + } + const None$2 = 0; + const Error$1 = 1; + const Warn = 2; + const Info = 3; + const Debug = 4; + function logger(_, method2, handler = log$1$1) { + let level = _ || None$2; return { - level (_) { - if (arguments.length) { - level = +_; - return this; - } else return level; - }, - error () { - if (level >= Error$1) handler(method || 'error', 'ERROR', arguments); - return this; - }, - warn () { - if (level >= Warn) handler(method || 'warn', 'WARN', arguments); - return this; - }, - info () { - if (level >= Info) handler(method || 'log', 'INFO', arguments); - return this; - }, - debug () { - if (level >= Debug) handler(method || 'log', 'DEBUG', arguments); - return this; + level(_2) { + if (arguments.length) { + level = +_2; + return this; + } else { + return level; } + }, + error() { + if (level >= Error$1) handler(method2 || "error", "ERROR", arguments); + return this; + }, + warn() { + if (level >= Warn) handler(method2 || "warn", "WARN", arguments); + return this; + }, + info() { + if (level >= Info) handler(method2 || "log", "INFO", arguments); + return this; + }, + debug() { + if (level >= Debug) handler(method2 || "log", "DEBUG", arguments); + return this; + } }; -} -var isArray = Array.isArray; -function isObject(_) { + } + var isArray = Array.isArray; + function isObject$1(_) { return _ === Object(_); -} -const isLegalKey = (key)=>key !== '__proto__'; -function mergeConfig() { - for(var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++)configs[_key] = arguments[_key]; - return configs.reduce((out, source)=>{ - for(const key in source)if (key === 'signals') // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - const r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); + } + const isLegalKey = (key2) => key2 !== "__proto__"; + function mergeConfig(...configs) { + return configs.reduce((out, source2) => { + for (const key2 in source2) { + if (key2 === "signals") { + out.signals = mergeNamed(out.signals, source2.signals); + } else { + const r = key2 === "legend" ? { + layout: 1 + } : key2 === "style" ? true : null; + writeConfig(out, key2, source2[key2], r); } - return out; + } + return out; }, {}); -} -function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; + } + function writeConfig(output2, key2, value2, recurse2) { + if (!isLegalKey(key2)) return; let k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - for(k in value){ - if (recurse && (recurse === true || recurse[k])) writeConfig(o, k, value[k]); - else if (isLegalKey(k)) o[k] = value[k]; - } - } else output[key] = value; -} -function mergeNamed(a, b) { - if (a == null) return b; - const map = {}, out = []; - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - b.forEach(add); - a.forEach(add); + if (isObject$1(value2) && !isArray(value2)) { + o = isObject$1(output2[key2]) ? output2[key2] : output2[key2] = {}; + for (k in value2) { + if (recurse2 && (recurse2 === true || recurse2[k])) { + writeConfig(o, k, value2[k]); + } else if (isLegalKey(k)) { + o[k] = value2[k]; + } + } + } else { + output2[key2] = value2; + } + } + function mergeNamed(a2, b2) { + if (a2 == null) return b2; + const map2 = {}, out = []; + function add2(_) { + if (!map2[_.name]) { + map2[_.name] = 1; + out.push(_); + } + } + b2.forEach(add2); + a2.forEach(add2); return out; -} -function peek(array) { - return array[array.length - 1]; -} -function toNumber(_) { - return _ == null || _ === '' ? null : +_; -} -const exp = (sign)=>(x)=>sign * Math.exp(x); -const log = (sign)=>(x)=>Math.log(sign * x); -const symlog = (c)=>(x)=>Math.sign(x) * Math.log1p(Math.abs(x / c)); -const symexp = (c)=>(x)=>Math.sign(x) * Math.expm1(Math.abs(x)) * c; -const pow = (exponent)=>(x)=>x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); -function pan(domain, delta, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), dd = (d1 - d0) * delta; - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; -} -function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); -} -function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log(sign), exp(sign)); -} -function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1 / exponent)); -} -function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); -} -function zoom(domain, anchor, scale, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; -} -function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); -} -function zoomLog(domain, anchor, scale) { - const sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log(sign), exp(sign)); -} -function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent)); -} -function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); -} -function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); -} -function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); -} -function array(_) { - return _ != null ? isArray(_) ? _ : [ - _ - ] : []; -} -/** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ function clampRange(range, min, max) { - let lo = range[0], hi = range[1], span; + } + function peek$1(array2) { + return array2[array2.length - 1]; + } + function toNumber(_) { + return _ == null || _ === "" ? null : +_; + } + const exp$2 = (sign2) => (x2) => sign2 * Math.exp(x2); + const log$4 = (sign2) => (x2) => Math.log(sign2 * x2); + const symlog$1 = (c2) => (x2) => Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); + const symexp = (c2) => (x2) => Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + const pow$4 = (exponent2) => (x2) => x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); + function pan(domain2, delta, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), dd = (d1 - d0) * delta; + return [ground(d0 - dd), ground(d1 - dd)]; + } + function panLinear(domain2, delta) { + return pan(domain2, delta, toNumber, identity$7); + } + function panLog(domain2, delta) { + var sign2 = Math.sign(domain2[0]); + return pan(domain2, delta, log$4(sign2), exp$2(sign2)); + } + function panPow(domain2, delta, exponent2) { + return pan(domain2, delta, pow$4(exponent2), pow$4(1 / exponent2)); + } + function panSymlog(domain2, delta, constant2) { + return pan(domain2, delta, symlog$1(constant2), symexp(constant2)); + } + function zoom$1(domain2, anchor, scale2, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; + return [ground(da + (d0 - da) * scale2), ground(da + (d1 - da) * scale2)]; + } + function zoomLinear(domain2, anchor, scale2) { + return zoom$1(domain2, anchor, scale2, toNumber, identity$7); + } + function zoomLog(domain2, anchor, scale2) { + const sign2 = Math.sign(domain2[0]); + return zoom$1(domain2, anchor, scale2, log$4(sign2), exp$2(sign2)); + } + function zoomPow(domain2, anchor, scale2, exponent2) { + return zoom$1(domain2, anchor, scale2, pow$4(exponent2), pow$4(1 / exponent2)); + } + function zoomSymlog(domain2, anchor, scale2, constant2) { + return zoom$1(domain2, anchor, scale2, symlog$1(constant2), symexp(constant2)); + } + function quarter(date2) { + return 1 + ~~(new Date(date2).getMonth() / 3); + } + function utcquarter(date2) { + return 1 + ~~(new Date(date2).getUTCMonth() / 3); + } + function array$5(_) { + return _ != null ? isArray(_) ? _ : [_] : []; + } + function clampRange(range2, min2, max2) { + let lo = range2[0], hi = range2[1], span2; if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - return span >= max - min ? [ - min, - max - ] : [ - lo = Math.min(Math.max(lo, min), max - span), - lo + span - ]; -} -function isFunction(_) { - return typeof _ === 'function'; -} -const DESCENDING = 'descending'; -function compare(fields, orders, opt) { + span2 = hi; + hi = lo; + lo = span2; + } + span2 = hi - lo; + return span2 >= max2 - min2 ? [min2, max2] : [lo = Math.min(Math.max(lo, min2), max2 - span2), lo + span2]; + } + function isFunction(_) { + return typeof _ === "function"; + } + const DESCENDING = "descending"; + function compare$2(fields, orders, opt) { opt = opt || {}; - orders = array(orders) || []; - const ord = [], get = [], fmap = {}, gen = opt.comparator || comparator; - array(fields).forEach((f, i)=>{ - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach((_)=>fmap[_] = 1); - }); - return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap)); -} -const ascending = (u, v)=>(u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; -const comparator = (fields, orders)=>fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); -const compare1 = (field, order)=>function(a, b) { - return ascending(field(a), field(b)) * order; - }; -const compareN = (fields, orders, n)=>{ - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while(c === 0 && ++i < n){ - f = fields[i]; - c = ascending(f(a), f(b)); - } - return c * orders[i]; - }; -}; -function constant(_) { - return isFunction(_) ? _ : ()=>_; -} -function debounce(delay, handler) { + orders = array$5(orders) || []; + const ord = [], get2 = [], fmap = {}, gen = opt.comparator || comparator; + array$5(fields).forEach((f, i) => { + if (f == null) return; + ord.push(orders[i] === DESCENDING ? -1 : 1); + get2.push(f = isFunction(f) ? f : field$1(f, null, opt)); + (accessorFields(f) || []).forEach((_) => fmap[_] = 1); + }); + return get2.length === 0 ? null : accessor(gen(get2, ord), Object.keys(fmap)); + } + const ascending$2 = (u2, v) => (u2 < v || u2 == null) && v != null ? -1 : (u2 > v || v == null) && u2 != null ? 1 : (v = v instanceof Date ? +v : v, u2 = u2 instanceof Date ? +u2 : u2) !== u2 && v === v ? -1 : v !== v && u2 === u2 ? 1 : 0; + const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); + const compare1 = (field2, order) => function(a2, b2) { + return ascending$2(field2(a2), field2(b2)) * order; + }; + const compareN = (fields, orders, n) => { + orders.push(0); + return function(a2, b2) { + let f, c2 = 0, i = -1; + while (c2 === 0 && ++i < n) { + f = fields[i]; + c2 = ascending$2(f(a2), f(b2)); + } + return c2 * orders[i]; + }; + }; + function constant$5(_) { + return isFunction(_) ? _ : () => _; + } + function debounce$1(delay, handler) { let tid; - return (e)=>{ - if (tid) clearTimeout(tid); - tid = setTimeout(()=>(handler(e), tid = null), delay); + return (e) => { + if (tid) clearTimeout(tid); + tid = setTimeout(() => (handler(e), tid = null), delay); }; -} -function extend(_) { - for(let x, k, i = 1, len = arguments.length; i < len; ++i){ - x = arguments[i]; - for(k in x)_[k] = x[k]; + } + function extend$1(_) { + for (let x2, k, i = 1, len2 = arguments.length; i < len2; ++i) { + x2 = arguments[i]; + for (k in x2) { + _[k] = x2[k]; + } } return _; -} -/** - * Return an array with minimum and maximum values, in the - * form [min, max]. Ignores null, undefined, and NaN values. - */ function extent(array, f) { - let i = 0, n, v, min, max; - if (array && (n = array.length)) { - if (f == null) { - // find first valid value - for(v = array[i]; i < n && (v == null || v !== v); v = array[++i]); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = array[i]; - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } else { - // find first valid value - for(v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = f(array[i]); - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } + } + function extent(array2, f) { + let i = 0, n, v, min2, max2; + if (array2 && (n = array2.length)) { + if (f == null) { + for (v = array2[i]; i < n && (v == null || v !== v); v = array2[++i]) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = array2[i]; + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + } + } else { + for (v = f(array2[i]); i < n && (v == null || v !== v); v = f(array2[++i])) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = f(array2[i]); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } } + } } - return [ - min, - max - ]; -} -function extentIndex(array, f) { - const n = array.length; - let i = -1, a, b, c, u, v; + return [min2, max2]; + } + function extentIndex(array2, f) { + const n = array2.length; + let i = -1, a2, b2, c2, u2, v; if (f == null) { - while(++i < n){ - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } + while (++i < n) { + b2 = array2[i]; + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = array2[i]; + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } } + } } else { - while(++i < n){ - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } } + } } - return [ - u, - v - ]; -} -function has(object, property) { - return Object.hasOwn(object, property); -} -const NULL = {}; -function fastmap(input) { - let obj = {}, test; - function has$1(key) { - return has(obj, key) && obj[key] !== NULL; - } - const map = { - size: 0, - empty: 0, - object: obj, - has: has$1, - get (key) { - return has$1(key) ? obj[key] : undefined; - }, - set (key, value) { - if (!has$1(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete (key) { - if (has$1(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear () { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test (_) { - if (arguments.length) { - test = _; - return map; - } else return test; - }, - clean () { - const next = {}; - let size = 0; - for(const key in obj){ - const value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = obj = next; + return [u2, v]; + } + function has$1(object2, property2) { + return Object.hasOwn(object2, property2); + } + const NULL = {}; + function fastmap(input) { + let obj2 = {}, test2; + function has$1$1(key2) { + return has$1(obj2, key2) && obj2[key2] !== NULL; + } + const map2 = { + size: 0, + empty: 0, + object: obj2, + has: has$1$1, + get(key2) { + return has$1$1(key2) ? obj2[key2] : void 0; + }, + set(key2, value2) { + if (!has$1$1(key2)) { + ++map2.size; + if (obj2[key2] === NULL) --map2.empty; + } + obj2[key2] = value2; + return this; + }, + delete(key2) { + if (has$1$1(key2)) { + --map2.size; + ++map2.empty; + obj2[key2] = NULL; + } + return this; + }, + clear() { + map2.size = map2.empty = 0; + map2.object = obj2 = {}; + }, + test(_) { + if (arguments.length) { + test2 = _; + return map2; + } else { + return test2; } + }, + clean() { + const next = {}; + let size2 = 0; + for (const key2 in obj2) { + const value2 = obj2[key2]; + if (value2 !== NULL && (!test2 || !test2(value2))) { + next[key2] = value2; + ++size2; + } + } + map2.size = size2; + map2.empty = 0; + map2.object = obj2 = next; + } }; - if (input) Object.keys(input).forEach((key)=>{ - map.set(key, input[key]); + if (input) Object.keys(input).forEach((key2) => { + map2.set(key2, input[key2]); }); - return map; -} -function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - const t = +threshold; - let a = range[0], b = peek(range), l; - // swap endpoints if range is reversed - if (b < a) { - l = a; - a = b; - b = l; - } - // compare value to endpoints - l = Math.abs(value - a); - const r = Math.abs(b - value); - // adjust if value is within threshold distance of endpoint + return map2; + } + function flush(range2, value2, threshold2, left, right, center) { + if (!threshold2 && threshold2 !== 0) return center; + const t = +threshold2; + let a2 = range2[0], b2 = peek$1(range2), l; + if (b2 < a2) { + l = a2; + a2 = b2; + b2 = l; + } + l = Math.abs(value2 - a2); + const r = Math.abs(b2 - value2); return l < r && l <= t ? left : r <= t ? right : center; -} -function inherits(child, parent, members) { + } + function inherits(child, parent, members) { const proto = child.prototype = Object.create(parent.prototype); - Object.defineProperty(proto, 'constructor', { - value: child, - writable: true, - enumerable: true, - configurable: true + Object.defineProperty(proto, "constructor", { + value: child, + writable: true, + enumerable: true, + configurable: true }); - return extend(proto, members); -} -/** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ function inrange(value, range, left, right) { - let r0 = range[0], r1 = range[range.length - 1], t; + return extend$1(proto, members); + } + function inrange(value2, range2, left, right) { + let r0 = range2[0], r1 = range2[range2.length - 1], t; if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1); -} -function isBoolean(_) { - return typeof _ === 'boolean'; -} -function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; -} -function isIterable(_) { + t = r0; + r0 = r1; + r1 = t; + } + left = left === void 0 || left; + right = right === void 0 || right; + return (left ? r0 <= value2 : r0 < value2) && (right ? value2 <= r1 : value2 < r1); + } + function isBoolean$1(_) { + return typeof _ === "boolean"; + } + function isDate$1(_) { + return Object.prototype.toString.call(_) === "[object Date]"; + } + function isIterable(_) { return _ && isFunction(_[Symbol.iterator]); -} -function isNumber(_) { - return typeof _ === 'number'; -} -function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; -} -function isString(_) { - return typeof _ === 'string'; -} -function key(fields, flat, opt) { - if (fields) fields = flat ? array(fields).map((f)=>f.replace(/\\(.)/g, '$1')) : array(fields); - const len = fields && fields.length, gen = opt && opt.get || getter, map = (f)=>gen(flat ? [ - f - ] : splitAccessPath(f)); - let fn; - if (!len) fn = function() { - return ''; - }; - else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { - return '' + get(_); - }; + } + function isNumber$1(_) { + return typeof _ === "number"; + } + function isRegExp(_) { + return Object.prototype.toString.call(_) === "[object RegExp]"; + } + function isString(_) { + return typeof _ === "string"; + } + function key$2(fields, flat, opt) { + if (fields) { + fields = flat ? array$5(fields).map((f) => f.replace(/\\(.)/g, "$1")) : array$5(fields); + } + const len2 = fields && fields.length, gen = opt && opt.get || getter$1, map2 = (f) => gen(flat ? [f] : splitAccessPath(f)); + let fn2; + if (!len2) { + fn2 = function() { + return ""; + }; + } else if (len2 === 1) { + const get2 = map2(fields[0]); + fn2 = function(_) { + return "" + get2(_); + }; } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while(++i < len)s += '|' + get[i](_); - return s; - }; + const get2 = fields.map(map2); + fn2 = function(_) { + let s = "" + get2[0](_), i = 0; + while (++i < len2) s += "|" + get2[i](_); + return s; + }; } - return accessor(fn, fields, 'key'); -} -function lerp(array, frac) { - const lo = array[0], hi = peek(array), f = +frac; + return accessor(fn2, fields, "key"); + } + function lerp$1(array2, frac) { + const lo = array2[0], hi = peek$1(array2), f = +frac; return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); -} -const DEFAULT_MAX_SIZE = 10000; -// adapted from https://github.com/dominictarr/hashlru/ (MIT License) -function lruCache(maxsize) { + } + const DEFAULT_MAX_SIZE = 1e4; + function lruCache(maxsize) { maxsize = +maxsize || DEFAULT_MAX_SIZE; - let curr, prev, size; - const clear = ()=>{ + let curr, prev, size2; + const clear = () => { + curr = {}; + prev = {}; + size2 = 0; + }; + const update2 = (key2, value2) => { + if (++size2 > maxsize) { + prev = curr; curr = {}; - prev = {}; - size = 0; - }; - const update = (key, value)=>{ - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return curr[key] = value; + size2 = 1; + } + return curr[key2] = value2; }; clear(); return { - clear, - has: (key)=>has(curr, key) || has(prev, key), - get: (key)=>has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined, - set: (key, value)=>has(curr, key) ? curr[key] = value : update(key, value) + clear, + has: (key2) => has$1(curr, key2) || has$1(prev, key2), + get: (key2) => has$1(curr, key2) ? curr[key2] : has$1(prev, key2) ? update2(key2, prev[key2]) : void 0, + set: (key2, value2) => has$1(curr, key2) ? curr[key2] = value2 : update2(key2, value2) }; -} -function merge(compare, array0, array1, output) { + } + function merge$3(compare2, array0, array1, output2) { const n0 = array0.length, n1 = array1.length; if (!n1) return array0; if (!n0) return array1; - const merged = output || new array0.constructor(n0 + n1); + const merged = output2 || new array0.constructor(n0 + n1); let i0 = 0, i1 = 0, i = 0; - for(; i0 < n0 && i1 < n1; ++i)merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; - for(; i0 < n0; ++i0, ++i)merged[i] = array0[i0]; - for(; i1 < n1; ++i1, ++i)merged[i] = array1[i1]; + for (; i0 < n0 && i1 < n1; ++i) { + merged[i] = compare2(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; + } + for (; i0 < n0; ++i0, ++i) { + merged[i] = array0[i0]; + } + for (; i1 < n1; ++i1, ++i) { + merged[i] = array1[i1]; + } return merged; -} -function repeat(str, reps) { - let s = ''; - while(--reps >= 0)s += str; + } + function repeat(str, reps) { + let s = ""; + while (--reps >= 0) s += str; return s; -} -function pad(str, length, padchar, align) { - const c = padchar || ' ', s = str + '', n = length - s.length; - return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n); -} -/** - * Return the numerical span of an array: the difference between - * the last and first values. - */ function span(array) { - return array && peek(array) - array[0] || 0; -} -function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') : x; -} -function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; -} -const defaultParser = (_)=>isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); -function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); -} -function toString(_) { - return _ == null || _ === '' ? null : _ + ''; -} -function toSet(_) { + } + function pad$2(str, length2, padchar, align) { + const c2 = padchar || " ", s = str + "", n = length2 - s.length; + return n <= 0 ? s : align === "left" ? repeat(c2, n) + s : align === "center" ? repeat(c2, ~~(n / 2)) + s + repeat(c2, Math.ceil(n / 2)) : s + repeat(c2, n); + } + function span(array2) { + return array2 && peek$1(array2) - array2[0] || 0; + } + function $(x2) { + return isArray(x2) ? `[${x2.map((v) => v === null ? "null" : $(v))}]` : isObject$1(x2) || isString(x2) ? ( + // Output valid JSON and JS source strings. + // See https://github.com/judofyr/timeless/blob/master/posts/json-isnt-a-javascript-subset.md + JSON.stringify(x2).replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029") + ) : x2; + } + function toBoolean(_) { + return _ == null || _ === "" ? null : !_ || _ === "false" || _ === "0" ? false : !!_; + } + const defaultParser = (_) => isNumber$1(_) ? _ : isDate$1(_) ? _ : Date.parse(_); + function toDate(_, parser2) { + parser2 = parser2 || defaultParser; + return _ == null || _ === "" ? null : parser2(_); + } + function toString(_) { + return _ == null || _ === "" ? null : _ + ""; + } + function toSet(_) { const s = {}, n = _.length; - for(let i = 0; i < n; ++i)s[_[i]] = true; + for (let i = 0; i < n; ++i) s[_[i]] = true; return s; -} -function truncate(str, length, align, ellipsis) { - const e = ellipsis != null ? ellipsis : '\u2026', s = str + '', n = s.length, l = Math.max(0, length - e.length); - return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; -} -function visitArray(array, filter, visitor) { - if (array) { - if (filter) { - const n = array.length; - for(let i = 0; i < n; ++i){ - const t = filter(array[i]); - if (t) visitor(t, i, array); - } - } else array.forEach(visitor); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j7FRh":[function(require,module,exports,__globalThis) { -exports.interopDefault = function(a) { - return a && a.__esModule ? a : { - default: a - }; -}; -exports.defineInteropFlag = function(a) { - Object.defineProperty(a, '__esModule', { - value: true - }); -}; -exports.exportAll = function(source, dest) { - Object.keys(source).forEach(function(key) { - if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return; - Object.defineProperty(dest, key, { - enumerable: true, - get: function() { - return source[key]; - } - }); - }); - return dest; -}; -exports.export = function(dest, destName, get) { - Object.defineProperty(dest, destName, { - enumerable: true, - get: get + } + function truncate$1(str, length2, align, ellipsis) { + const e = ellipsis != null ? ellipsis : "…", s = str + "", n = s.length, l = Math.max(0, length2 - e.length); + return n <= length2 ? s : align === "left" ? e + s.slice(n - l) : align === "center" ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; + } + function visitArray(array2, filter2, visitor) { + if (array2) { + if (filter2) { + const n = array2.length; + for (let i = 0; i < n; ++i) { + const t = filter2(array2[i]); + if (t) visitor(t, i, array2); + } + } else { + array2.forEach(visitor); + } + } + } + var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; + function objectConverter(columns) { + return new Function("d", "return {" + columns.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + '] || ""'; + }).join(",") + "}"); + } + function customConverter(columns, f) { + var object2 = objectConverter(columns); + return function(row, i) { + return f(object2(row), i, columns); + }; + } + function inferColumns(rows) { + var columnSet = /* @__PURE__ */ Object.create(null), columns = []; + rows.forEach(function(row) { + for (var column in row) { + if (!(column in columnSet)) { + columns.push(columnSet[column] = column); + } + } }); -}; - -},{}],"3NitK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>Dataflow); -parcelHelpers.export(exports, "EventStream", ()=>EventStream); -parcelHelpers.export(exports, "MultiPulse", ()=>MultiPulse); -parcelHelpers.export(exports, "Operator", ()=>Operator); -parcelHelpers.export(exports, "Parameters", ()=>Parameters); -parcelHelpers.export(exports, "Pulse", ()=>Pulse); -parcelHelpers.export(exports, "Transform", ()=>Transform); -parcelHelpers.export(exports, "UniqueList", ()=>UniqueList); -parcelHelpers.export(exports, "asyncCallback", ()=>asyncCallback); -parcelHelpers.export(exports, "changeset", ()=>changeset); -parcelHelpers.export(exports, "definition", ()=>definition); -parcelHelpers.export(exports, "derive", ()=>derive); -parcelHelpers.export(exports, "ingest", ()=>ingest$1); -parcelHelpers.export(exports, "isChangeSet", ()=>isChangeSet); -parcelHelpers.export(exports, "isTuple", ()=>isTuple); -parcelHelpers.export(exports, "rederive", ()=>rederive); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "stableCompare", ()=>stableCompare); -parcelHelpers.export(exports, "transform", ()=>transform); -parcelHelpers.export(exports, "transforms", ()=>transforms); -parcelHelpers.export(exports, "tupleid", ()=>tupleid); -var _vegaUtil = require("vega-util"); -var _vegaLoader = require("vega-loader"); -var _vegaFormat = require("vega-format"); -function UniqueList(idFunc) { - const $ = idFunc || (0, _vegaUtil.identity), list = [], ids = {}; - list.add = (_)=>{ - const id = $(_); - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - return list; - }; - list.remove = (_)=>{ - const id = $(_); - if (ids[id]) { - ids[id] = 0; - const idx = list.indexOf(_); - if (idx >= 0) list.splice(idx, 1); - } - return list; + return columns; + } + function pad$1(value2, width2) { + var s = value2 + "", length2 = s.length; + return length2 < width2 ? new Array(width2 - length2 + 1).join(0) + s : s; + } + function formatYear$1(year) { + return year < 0 ? "-" + pad$1(-year, 6) : year > 9999 ? "+" + pad$1(year, 6) : pad$1(year, 4); + } + function formatDate(date2) { + var hours = date2.getUTCHours(), minutes = date2.getUTCMinutes(), seconds = date2.getUTCSeconds(), milliseconds = date2.getUTCMilliseconds(); + return isNaN(date2) ? "Invalid Date" : formatYear$1(date2.getUTCFullYear()) + "-" + pad$1(date2.getUTCMonth() + 1, 2) + "-" + pad$1(date2.getUTCDate(), 2) + (milliseconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "." + pad$1(milliseconds, 3) + "Z" : seconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "Z" : minutes || hours ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + "Z" : ""); + } + function dsvFormat(delimiter) { + var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); + function parse2(text2, f) { + var convert2, columns, rows = parseRows(text2, function(row, i) { + if (convert2) return convert2(row, i - 1); + columns = row, convert2 = f ? customConverter(row, f) : objectConverter(row); + }); + rows.columns = columns || []; + return rows; + } + function parseRows(text2, f) { + var rows = [], N = text2.length, I = 0, n = 0, t, eof = N <= 0, eol = false; + if (text2.charCodeAt(N - 1) === NEWLINE) --N; + if (text2.charCodeAt(N - 1) === RETURN) --N; + function token() { + if (eof) return EOF; + if (eol) return eol = false, EOL; + var i, j = I, c2; + if (text2.charCodeAt(j) === QUOTE) { + while (I++ < N && text2.charCodeAt(I) !== QUOTE || text2.charCodeAt(++I) === QUOTE) ; + if ((i = I) >= N) eof = true; + else if ((c2 = text2.charCodeAt(I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } + return text2.slice(j + 1, i - 1).replace(/""/g, '"'); + } + while (I < N) { + if ((c2 = text2.charCodeAt(i = I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } else if (c2 !== DELIMITER) continue; + return text2.slice(j, i); + } + return eof = true, text2.slice(j, N); + } + while ((t = token()) !== EOF) { + var row = []; + while (t !== EOL && t !== EOF) row.push(t), t = token(); + if (f && (row = f(row, n++)) == null) continue; + rows.push(row); + } + return rows; + } + function preformatBody(rows, columns) { + return rows.map(function(row) { + return columns.map(function(column) { + return formatValue2(row[column]); + }).join(delimiter); + }); + } + function format2(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return [columns.map(formatValue2).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); + } + function formatBody(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return preformatBody(rows, columns).join("\n"); + } + function formatRows(rows) { + return rows.map(formatRow).join("\n"); + } + function formatRow(row) { + return row.map(formatValue2).join(delimiter); + } + function formatValue2(value2) { + return value2 == null ? "" : value2 instanceof Date ? formatDate(value2) : reFormat.test(value2 += "") ? '"' + value2.replace(/"/g, '""') + '"' : value2; + } + return { + parse: parse2, + parseRows, + format: format2, + formatBody, + formatRows, + formatRow, + formatValue: formatValue2 }; - return list; -} -/** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ async function asyncCallback(df, callback) { - try { - await callback(df); - } catch (err) { - df.error(err); - } -} -const TUPLE_ID_KEY = Symbol('vega_id'); -let TUPLE_ID = 1; -/** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ function isTuple(t) { - return !!(t && tupleid(t)); -} -/** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ function tupleid(t) { - return t[TUPLE_ID_KEY]; -} -/** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; -} -/** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ function ingest$1(datum) { - const t = datum === Object(datum) ? datum : { - data: datum + } + function identity$6(x2) { + return x2; + } + function transform$3(transform2) { + if (transform2 == null) return identity$6; + var x02, y02, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1]; + return function(input, i) { + if (!i) x02 = y02 = 0; + var j = 2, n = input.length, output2 = new Array(n); + output2[0] = (x02 += input[0]) * kx + dx; + output2[1] = (y02 += input[1]) * ky + dy; + while (j < n) output2[j] = input[j], ++j; + return output2; }; - return tupleid(t) ? t : setid(t, TUPLE_ID++); -} -/** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ function derive(t) { - return rederive(t, ingest$1({})); -} -/** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ function rederive(t, d) { - for(const k in t)d[k] = t[k]; - return d; -} -/** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ function replace(t, d) { - return setid(d, tupleid(t)); -} -/** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ function stableCompare(cmp, f) { - return !cmp ? null : f ? (a, b)=>cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b)=>cmp(a, b) || tupleid(a) - tupleid(b); -} -function isChangeSet(v) { - return v && v.constructor === changeset; -} -function changeset() { - const add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = []; // modify by predicate - let clean = null, reflow = false; - return { - constructor: changeset, - insert (t) { - const d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)add.push(d[i]); - return this; - }, - remove (t) { - const a = (0, _vegaUtil.isFunction)(t) ? remp : rem, d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)a.push(d[i]); - return this; - }, - modify (t, field, value) { - const m = { - field: field, - value: (0, _vegaUtil.constant)(value) - }; - if ((0, _vegaUtil.isFunction)(t)) { - m.filter = t; - modp.push(m); - } else { - m.tuple = t; - mod.push(m); - } - return this; - }, - encode (t, set) { - if ((0, _vegaUtil.isFunction)(t)) modp.push({ - filter: t, - field: set - }); - else mod.push({ - tuple: t, - field: set - }); - return this; - }, - clean (value) { - clean = value; - return this; - }, - reflow () { - reflow = true; - return this; - }, - pulse (pulse, tuples) { - const cur = {}, out = {}; - let i, n, m, f, t, id; - // build lookup table of current tuples - for(i = 0, n = tuples.length; i < n; ++i)cur[tupleid(tuples[i])] = 1; - // process individual tuples to remove - for(i = 0, n = rem.length; i < n; ++i){ - t = rem[i]; - cur[tupleid(t)] = -1; - } - // process predicate-based removals - for(i = 0, n = remp.length; i < n; ++i){ - f = remp[i]; - tuples.forEach((t)=>{ - if (f(t)) cur[tupleid(t)] = -1; - }); - } - // process all add tuples - for(i = 0, n = add.length; i < n; ++i){ - t = add[i]; - id = tupleid(t); - if (cur[id]) // tuple already resides in dataset - // if flagged for both add and remove, cancel - cur[id] = 1; - else // tuple does not reside in dataset, add - pulse.add.push(ingest$1(add[i])); - } - // populate pulse rem list - for(i = 0, n = tuples.length; i < n; ++i){ - t = tuples[i]; - if (cur[tupleid(t)] < 0) pulse.rem.push(t); - } - // modify helper method - function modify(t, f, v) { - if (v) t[f] = v(t); - else pulse.encode = f; - if (!reflow) out[tupleid(t)] = t; - } - // process individual tuples to modify - for(i = 0, n = mod.length; i < n; ++i){ - m = mod[i]; - t = m.tuple; - f = m.field; - id = cur[tupleid(t)]; - if (id > 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - // process predicate-based modifications - for(i = 0, n = modp.length; i < n; ++i){ - m = modp[i]; - f = m.filter; - tuples.forEach((t)=>{ - if (f(t) && cur[tupleid(t)] > 0) modify(t, m.field, m.value); - }); - pulse.modifies(m.field); - } - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) pulse.mod = rem.length || remp.length ? tuples.filter((t)=>cur[tupleid(t)] > 0) : tuples.slice(); - else for(id in out)pulse.mod.push(out[id]); - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) pulse.clean(true); - return pulse; - } - }; -} -const CACHE = '_:mod:_'; -/** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ function Parameters() { - Object.defineProperty(this, CACHE, { - writable: true, - value: {} + } + function reverse$1(array2, n) { + var t, j = array2.length, i = j - n; + while (i < --j) t = array2[i], array2[i++] = array2[j], array2[j] = t; + } + function feature(topology, o) { + if (typeof o === "string") o = topology.objects[o]; + return o.type === "GeometryCollection" ? { type: "FeatureCollection", features: o.geometries.map(function(o2) { + return feature$1(topology, o2); + }) } : feature$1(topology, o); + } + function feature$1(topology, o) { + var id2 = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object$1(topology, o); + return id2 == null && bbox == null ? { type: "Feature", properties, geometry } : bbox == null ? { type: "Feature", id: id2, properties, geometry } : { type: "Feature", id: id2, bbox, properties, geometry }; + } + function object$1(topology, o) { + var transformPoint = transform$3(topology.transform), arcs = topology.arcs; + function arc2(i, points2) { + if (points2.length) points2.pop(); + for (var a2 = arcs[i < 0 ? ~i : i], k = 0, n = a2.length; k < n; ++k) { + points2.push(transformPoint(a2[k], k)); + } + if (i < 0) reverse$1(points2, n); + } + function point2(p) { + return transformPoint(p); + } + function line2(arcs2) { + var points2 = []; + for (var i = 0, n = arcs2.length; i < n; ++i) arc2(arcs2[i], points2); + if (points2.length < 2) points2.push(points2[0]); + return points2; + } + function ring(arcs2) { + var points2 = line2(arcs2); + while (points2.length < 4) points2.push(points2[0]); + return points2; + } + function polygon(arcs2) { + return arcs2.map(ring); + } + function geometry(o2) { + var type2 = o2.type, coordinates; + switch (type2) { + case "GeometryCollection": + return { type: type2, geometries: o2.geometries.map(geometry) }; + case "Point": + coordinates = point2(o2.coordinates); + break; + case "MultiPoint": + coordinates = o2.coordinates.map(point2); + break; + case "LineString": + coordinates = line2(o2.arcs); + break; + case "MultiLineString": + coordinates = o2.arcs.map(line2); + break; + case "Polygon": + coordinates = polygon(o2.arcs); + break; + case "MultiPolygon": + coordinates = o2.arcs.map(polygon); + break; + default: + return null; + } + return { type: type2, coordinates }; + } + return geometry(o); + } + function stitch(topology, arcs) { + var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; + arcs.forEach(function(i, j) { + var arc2 = topology.arcs[i < 0 ? ~i : i], t; + if (arc2.length < 3 && !arc2[1][0] && !arc2[1][1]) { + t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; + } }); -} -Parameters.prototype = { - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ set (name, index, value, force) { - const o = this, v = o[name], mod = o[CACHE]; - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = (0, _vegaUtil.isArray)(value) ? 1 + value.length : -1; + arcs.forEach(function(i) { + var e = ends(i), start = e[0], end = e[1], f, g; + if (f = fragmentByEnd[start]) { + delete fragmentByEnd[f.end]; + f.push(i); + f.end = end; + if (g = fragmentByStart[end]) { + delete fragmentByStart[g.start]; + var fg = g === f ? f : f.concat(g); + fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; + } else { + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } - return o; - }, - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ modified (name, index) { - const mod = this[CACHE]; - if (!arguments.length) { - for(const k in mod){ - if (mod[k]) return true; - } - return false; - } else if ((0, _vegaUtil.isArray)(name)) { - for(let k = 0; k < name.length; ++k){ - if (mod[name[k]]) return true; - } - return false; + } else if (f = fragmentByStart[end]) { + delete fragmentByStart[f.start]; + f.unshift(i); + f.start = start; + if (g = fragmentByEnd[start]) { + delete fragmentByEnd[g.end]; + var gf = g === f ? f : g.concat(f); + fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; + } else { + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } - return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name]; - }, - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ clear () { - this[CACHE] = {}; - return this; + } else { + f = [i]; + fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; + } + }); + function ends(i) { + var arc2 = topology.arcs[i < 0 ? ~i : i], p02 = arc2[0], p1; + if (topology.transform) p1 = [0, 0], arc2.forEach(function(dp) { + p1[0] += dp[0], p1[1] += dp[1]; + }); + else p1 = arc2[arc2.length - 1]; + return i < 0 ? [p1, p02] : [p02, p1]; + } + function flush2(fragmentByEnd2, fragmentByStart2) { + for (var k in fragmentByEnd2) { + var f = fragmentByEnd2[k]; + delete fragmentByStart2[f.start]; + delete f.start; + delete f.end; + f.forEach(function(i) { + stitchedArcs[i < 0 ? ~i : i] = 1; + }); + fragments.push(f); + } } -}; -let OP_ID = 0; -const PULSE = 'pulse', NO_PARAMS = new Parameters(); -// Boolean Flags -const SKIP$1 = 1, MODIFIED = 2; -/** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - if (update) this._update = update; - if (params) this.parameters(params, react); -} -function flag(bit) { - return function(state) { - const f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? f | bit : f & ~bit; - return this; - }; -} -Operator.prototype = { - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); - }, - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ set (value) { - if (this.value !== value) { - this.value = value; - return 1; - } else return 0; - }, - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ skip: flag(SKIP$1), - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ modified: flag(MODIFIED), - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initial evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ parameters (params, react, initonly) { - react = react !== false; - const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; - let name, value, n, i; - const add = (name, index, value)=>{ - if (value instanceof Operator) { - if (value !== this) { - if (react) value.targets().add(this); - deps.push(value); - } - argops.push({ - op: value, - name: name, - index: index - }); - } else argval.set(name, index, value); - }; - for(name in params){ - value = params[name]; - if (name === PULSE) { - (0, _vegaUtil.array)(value).forEach((op)=>{ - if (!(op instanceof Operator)) (0, _vegaUtil.error)('Pulse parameters must be operator instances.'); - else if (op !== this) { - op.targets().add(this); - deps.push(op); - } - }); - this.source = value; - } else if ((0, _vegaUtil.isArray)(value)) { - argval.set(name, -1, Array(n = value.length)); - for(i = 0; i < n; ++i)add(name, i, value[i]); - } else add(name, -1, value); - } - this.marshall().clear(); // initialize values - if (initonly) argops.initonly = true; - return deps; - }, - /** - * Internal method for marshalling parameter values. - * Visits each operator dependency to pull the latest value. - * @return {Parameters} A Parameters object to pass to the update function. - */ marshall (stamp) { - const argval = this._argval || NO_PARAMS, argops = this._argops; - let item, i, op, mod; - if (argops) { - const n = argops.length; - for(i = 0; i < n; ++i){ - item = argops[i]; - op = item.op; - mod = op.modified() && op.stamp === stamp; - argval.set(item.name, item.index, op.value, mod); - } - if (argops.initonly) { - for(i = 0; i < n; ++i){ - item = argops[i]; - item.op.targets().remove(this); - } - this._argops = null; - this._update = null; - } - } - return argval; - }, - /** - * Detach this operator from the dataflow. - * Unregisters listeners on upstream dependencies. - */ detach () { - const argops = this._argops; - let i, n, item, op; - if (argops) for(i = 0, n = argops.length; i < n; ++i){ - item = argops[i]; - op = item.op; - if (op._targets) op._targets.remove(this); - } - // remove references to the source and pulse object, - // if present, to prevent memory leaks of old data. - this.pulse = null; - this.source = null; - }, - /** - * Delegate method to perform operator processing. - * Subclasses can override this method to perform custom processing. - * By default, it marshalls parameters and calls the update function - * if that function is defined. If the update function does not - * change the operator value then StopPropagation is returned. - * If no update function is defined, this method does nothing. - * @param {Pulse} pulse - the current dataflow pulse. - * @return The output pulse or StopPropagation. A falsy return value - * (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const update = this._update; - if (update) { - const params = this.marshall(pulse.stamp), v = update.call(this, params, pulse); - params.clear(); - if (v !== this.value) this.value = v; - else if (!this.modified()) return pulse.StopPropagation; - } - }, - /** - * Run this operator for the current pulse. If this operator has already - * been run at (or after) the pulse timestamp, returns StopPropagation. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) { - this.skip(false); - rv = 0; - } else rv = this.evaluate(pulse); - return this.pulse = rv || pulse; - } -}; -/** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ function add(init, update, params, react) { - let shift = 1, op; - if (init instanceof Operator) op = init; - else if (init && init.prototype instanceof Operator) op = new init(); - else if ((0, _vegaUtil.isFunction)(init)) op = new Operator(null, init); - else { - shift = 0; - op = new Operator(init, update); + flush2(fragmentByEnd, fragmentByStart); + flush2(fragmentByStart, fragmentByEnd); + arcs.forEach(function(i) { + if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); + }); + return fragments; + } + function mesh(topology) { + return object$1(topology, meshArcs.apply(this, arguments)); + } + function meshArcs(topology, object2, filter2) { + var arcs, i, n; + if (arguments.length > 1) arcs = extractArcs(topology, object2, filter2); + else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; + return { type: "MultiLineString", arcs: stitch(topology, arcs) }; + } + function extractArcs(topology, object2, filter2) { + var arcs = [], geomsByArc = [], geom; + function extract0(i) { + var j = i < 0 ? ~i : i; + (geomsByArc[j] || (geomsByArc[j] = [])).push({ i, g: geom }); } - this.rank(op); - if (shift) { - react = params; - params = update; + function extract1(arcs2) { + arcs2.forEach(extract0); } - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - return op; -} -/** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array<Operator>} - The source operators that should propagate - * to the target operator. - */ function connect(target, sources) { - const targetRank = target.rank, n = sources.length; - for(let i = 0; i < n; ++i)if (targetRank < sources[i].rank) { - this.rerank(target); - return; + function extract2(arcs2) { + arcs2.forEach(extract1); } -} -let STREAM_ID = 0; -/** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; -} -/** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); -} -EventStream.prototype = { - _filter: (0, _vegaUtil.truthy), - _apply: (0, _vegaUtil.identity), - targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); - }, - consume (_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; - }, - receive (evt) { - if (this._filter(evt)) { - const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; - for(let i = 0; i < n; ++i)trg[i].receive(val); - if (this._consume) { - evt.preventDefault(); - evt.stopPropagation(); - } - } - }, - filter (filter) { - const s = stream(filter); - this.targets().add(s); - return s; - }, - apply (apply) { - const s = stream(null, apply); - this.targets().add(s); - return s; - }, - merge () { - const s = stream(); - this.targets().add(s); - for(let i = 0, n = arguments.length; i < n; ++i)arguments[i].targets().add(s); - return s; - }, - throttle (pause) { - let t = -1; - return this.filter(()=>{ - const now = Date.now(); - if (now - t > pause) { - t = now; - return 1; - } else return 0; - }); - }, - debounce (delay) { - const s = stream(); - this.targets().add(stream(null, null, (0, _vegaUtil.debounce)(delay, (e)=>{ - const df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }))); - return s; - }, - between (a, b) { - let active = false; - a.targets().add(stream(null, null, ()=>active = true)); - b.targets().add(stream(null, null, ()=>active = false)); - return this.filter(()=>active); - }, - detach () { - // ensures compatibility with operators (#2753) - // remove references to other streams and filter functions that may - // be bound to subcontexts that need to be garbage collected. - this._filter = (0, _vegaUtil.truthy); - this._targets = null; - } -}; -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ function events(source, type, filter, apply) { - const df = this, s = stream(filter, apply), send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally{ - df.run(); - } - }; - let sources; - if (typeof source === 'string' && typeof document !== 'undefined') sources = document.querySelectorAll(source); - else sources = (0, _vegaUtil.array)(source); - const n = sources.length; - for(let i = 0; i < n; ++i)sources[i].addEventListener(type, send); - return s; -} -function parse(data, format) { - const locale = this.locale(); - return (0, _vegaLoader.read)(data, format, locale.timeParse, locale.utcParse); -} -/** - * Ingests new data into the dataflow. First parses the data using the - * vega-loader read method, then pulses a changeset to the target operator. - * @param {Operator} target - The Operator to target with ingested data, - * typically a Collect transform instance. - * @param {*} data - The input data, prior to parsing. For JSON this may - * be a string or an object. For CSV, TSV, etc should be a string. - * @param {object} format - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @returns {Dataflow} - */ function ingest(target, data, format) { - data = this.parse(data, format); - return this.pulse(target, this.changeset().insert(data)); -} -/** - * Request data from an external source, parse it, and return a Promise. - * @param {string} url - The URL from which to load the data. This string - * is passed to the vega-loader load method. - * @param {object} [format] - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @return {Promise} A Promise that resolves upon completion of the request. - * The resolved object contains the following properties: - * - data: an array of parsed data (or null upon error) - * - status: a code for success (0), load fail (-1), or parse fail (-2) - */ async function request(url, format) { - const df = this; - let status = 0, data; - try { - data = await df.loader().load(url, { - context: 'dataflow', - response: (0, _vegaLoader.responseType)(format && format.type) - }); - try { - data = df.parse(data, format); - } catch (err) { - status = -2; - df.warn('Data ingestion failed', url, err); - } - } catch (err) { - status = -1; - df.warn('Loading failed', url, err); + function extract3(arcs2) { + arcs2.forEach(extract2); } - return { - data, - status - }; -} -async function preload(target, url, format) { - const df = this, pending = df._pending || loadPending(df); - pending.requests += 1; - const res = await df.request(url, format); - df.pulse(target, df.changeset().remove((0, _vegaUtil.truthy)).insert(res.data || [])); - pending.done(); - return res; -} -function loadPending(df) { - let accept; - const pending = new Promise((a)=>accept = a); - pending.requests = 0; - pending.done = ()=>{ - if (--pending.requests === 0) { - df._pending = null; - accept(df); - } - }; - return df._pending = pending; -} -const SKIP = { - skip: true -}; -/** - * Perform operator updates in response to events. Applies an - * update function to compute a new operator value. If the update function - * returns a {@link ChangeSet}, the operator will be pulsed with those tuple - * changes. Otherwise, the operator value will be updated to the return value. - * @param {EventStream|Operator} source - The event source to react to. - * This argument can be either an EventStream or an Operator. - * @param {Operator|function(object):Operator} target - The operator to update. - * This argument can either be an Operator instance or (if the source - * argument is an EventStream), a function that accepts an event object as - * input and returns an Operator to target. - * @param {function(Parameters,Event): *} [update] - Optional update function - * to compute the new operator value, or a literal value to set. Update - * functions expect to receive a parameter object and event as arguments. - * This function can either return a new operator value or (if the source - * argument is an EventStream) a {@link ChangeSet} instance to pulse - * the target operator with tuple changes. - * @param {object} [params] - The update function parameters. - * @param {object} [options] - Additional options hash. If not overridden, - * updated operators will be skipped by default. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @return {Dataflow} - */ function on(source, target, update, params, options) { - const fn = source instanceof Operator ? onOperator : onStream; - fn(this, source, target, update, params, options); - return this; -} -function onStream(df, stream, target, update, params, options) { - const opt = (0, _vegaUtil.extend)({}, options, SKIP); - let func, op; - if (!(0, _vegaUtil.isFunction)(target)) target = (0, _vegaUtil.constant)(target); - if (update === undefined) func = (e)=>df.touch(target(e)); - else if ((0, _vegaUtil.isFunction)(update)) { - op = new Operator(null, update, params, false); - func = (e)=>{ - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else func = (e)=>df.update(target(e), update, opt); - stream.apply(func); -} -function onOperator(df, source, target, update, params, options) { - if (update === undefined) source.targets().add(target); - else { - const opt = options || {}, op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [ - op - ]); // rerank as needed, #1672 - } - } -} -function updater(target, update) { - update = (0, _vegaUtil.isFunction)(update) ? update : (0, _vegaUtil.constant)(update); - return target ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) target.skip(value !== this.value).value = value; - return value; - } : update; -} -/** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ function rank(op) { - op.rank = ++this._rank; -} -/** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ function rerank(op) { - const queue = [ - op - ]; - let cur, list, i; - while(queue.length){ - this.rank(cur = queue.pop()); - if (list = cur._targets) for(i = list.length; --i >= 0;){ - queue.push(cur = list[i]); - if (cur === op) (0, _vegaUtil.error)('Cycle detected in dataflow graph.'); - } - } -} -/** - * Sentinel value indicating pulse propagation should stop. - */ const StopPropagation = {}; -// Pulse visit type flags -const ADD = 1, REM = 2, MOD = 4, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD, ALL = ADD | REM | MOD, REFLOW = 8, SOURCE = 16, NO_SOURCE = 32, NO_FIELDS = 64; -/** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; -} -function materialize(data, filter) { - const out = []; - (0, _vegaUtil.visitArray)(data, filter, (_)=>out.push(_)); - return out; -} -function filter(pulse, flags) { - const map = {}; - pulse.visit(flags, (t)=>{ - map[tupleid(t)] = 1; + function geometry(o) { + switch (geom = o, o.type) { + case "GeometryCollection": + o.geometries.forEach(geometry); + break; + case "LineString": + extract1(o.arcs); + break; + case "MultiLineString": + case "Polygon": + extract2(o.arcs); + break; + case "MultiPolygon": + extract3(o.arcs); + break; + } + } + geometry(object2); + geomsByArc.forEach(filter2 == null ? function(geoms) { + arcs.push(geoms[0].i); + } : function(geoms) { + if (filter2(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); }); - return (t)=>map[tupleid(t)] ? null : t; -} -function addFilter(a, b) { - return a ? (t, i)=>a(t, i) && b(t, i) : b; -} -Pulse.prototype = { - /** - * Sentinel value indicating pulse propagation should stop. - */ StopPropagation, - /** - * Boolean flag indicating ADD (added) tuples. - */ ADD, - /** - * Boolean flag indicating REM (removed) tuples. - */ REM, - /** - * Boolean flag indicating MOD (modified) tuples. - */ MOD, - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ ADD_REM, - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ ADD_MOD, - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ ALL, - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ REFLOW, - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ SOURCE, - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ NO_SOURCE, - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ NO_FIELDS, - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ fork (flags) { - return new Pulse(this.dataflow).init(this, flags); - }, - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ clone () { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); - }, - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ addAll () { - let p = this; - const reuse = !p.source || p.add === p.rem // special case for indexed set (e.g., crossfilter) - || !p.rem.length && p.source.length === p.add.length; - if (reuse) return p; - else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - p.rem = []; // new operators can ignore rem #2769 - return p; - } - }, - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ init (src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - if (src.fields && !(flags & NO_FIELDS)) p.fields = src.fields; - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; - } else { - p.modF = null; - p.mod = []; - } - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; - } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - return p; - }, - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ runAfter (func) { - this.dataflow.runAfter(func); - }, - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ changed (flags) { - const f = flags || ALL; - return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length; - }, - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ reflow (fork) { - if (fork) return this.fork(ALL).reflow(); - const len = this.add.length, src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); - } - return this; - }, - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ clean (value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else return this.cleans; - }, - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array<string>} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ modifies (_) { - const hash = this.fields || (this.fields = {}); - if ((0, _vegaUtil.isArray)(_)) _.forEach((f)=>hash[f] = true); - else hash[_] = true; - return this; - }, - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array<string>} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ modified (_, nomod) { - const fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; - }, - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ filter (flags, filter) { - const p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; - }, - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ materialize (flags) { - flags = flags || ALL; - const p = this; - if (flags & ADD && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if (flags & REM && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if (flags & MOD && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if (flags & SOURCE && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; + return arcs; + } + function ascending$1(a2, b2) { + return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN; + } + function descending$1(a2, b2) { + return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN; + } + function bisector(f) { + let compare12, compare2, delta; + if (f.length !== 2) { + compare12 = ascending$1; + compare2 = (d, x2) => ascending$1(f(d), x2); + delta = (d, x2) => f(d) - x2; + } else { + compare12 = f === ascending$1 || f === descending$1 ? f : zero$2; + compare2 = f; + delta = f; + } + function left(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) < 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + function right(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) <= 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + function center(a2, x2, lo = 0, hi = a2.length) { + const i = left(a2, x2, lo, hi - 1); + return i > lo && delta(a2[i - 1], x2) > -delta(a2[i], x2) ? i - 1 : i; + } + return { left, center, right }; + } + function zero$2() { + return 0; + } + function number$6(x2) { + return x2 === null ? NaN : +x2; + } + function* numbers$2(values2, valueof) { + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + yield value2; } - return p; - }, - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ visit (flags, visitor) { - const p = this, v = visitor; - if (flags & SOURCE) { - (0, _vegaUtil.visitArray)(p.source, p.srcF, v); - return p; - } - if (flags & ADD) (0, _vegaUtil.visitArray)(p.add, p.addF, v); - if (flags & REM) (0, _vegaUtil.visitArray)(p.rem, p.remF, v); - if (flags & MOD) (0, _vegaUtil.visitArray)(p.mod, p.modF, v); - const src = p.source; - if (flags & REFLOW && src) { - const sum = p.add.length + p.mod.length; - if (sum === src.length) ; - else if (sum) (0, _vegaUtil.visitArray)(src, filter(p, ADD_MOD), v); - else // if no add/rem/mod tuples, visit source - (0, _vegaUtil.visitArray)(src, p.srcF, v); + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + yield value2; } - return p; + } } -}; -/** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse. - */ function MultiPulse(dataflow, stamp, pulses, encode) { - const p = this; - let c = 0; - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - for (const pulse of pulses){ - if (pulse.stamp !== stamp) continue; - if (pulse.fields) { - const hash = p.fields || (p.fields = {}); - for(const f in pulse.fields)hash[f] = 1; - } - if (pulse.changed(p.ADD)) c |= p.ADD; - if (pulse.changed(p.REM)) c |= p.REM; - if (pulse.changed(p.MOD)) c |= p.MOD; - } - this.changes = c; -} -(0, _vegaUtil.inherits)(MultiPulse, Pulse, { - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - */ fork (flags) { - const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); - if (flags !== undefined) { - if (flags & p.ADD) this.visit(p.ADD, (t)=>p.add.push(t)); - if (flags & p.REM) this.visit(p.REM, (t)=>p.rem.push(t)); - if (flags & p.MOD) this.visit(p.MOD, (t)=>p.mod.push(t)); + } + const ascendingBisect = bisector(ascending$1); + const bisectRight$1 = ascendingBisect.right; + const bisectLeft$1 = ascendingBisect.left; + bisector(number$6).center; + function variance(values2, valueof) { + let count2 = 0; + let delta; + let mean2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); } - return p; - }, - changed (flags) { - return this.changes & flags; - }, - modified (_) { - const p = this, fields = p.fields; - return !(fields && p.changes & p.MOD) ? 0 : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; - }, - filter () { - (0, _vegaUtil.error)('MultiPulse does not support filtering.'); - }, - materialize () { - (0, _vegaUtil.error)('MultiPulse does not support materialization.'); - }, - visit (flags, visitor) { - const p = this, pulses = p.pulses, n = pulses.length; - let i = 0; - if (flags & p.SOURCE) for(; i < n; ++i)pulses[i].visit(flags, visitor); - else { - for(; i < n; ++i)if (pulses[i].stamp === p.stamp) pulses[i].visit(flags, visitor); + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); } - return p; + } } -}); -/* eslint-disable require-atomic-updates */ /** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function evaluate(encode, prerun, postrun) { - const df = this, async = []; - // if the pulse value is set, this is a re-entrant call - if (df._pulse) return reentrant(df); - // wait for pending datasets to load - if (df._pending) await df._pending; - // invoke prerun function, if provided - if (prerun) await asyncCallback(df, prerun); - // exit early if there are no updates - if (!df._touched.length) { - df.debug('Dataflow invoked, but nothing to do.'); - return df; + if (count2 > 1) return sum2 / (count2 - 1); + } + function deviation(values2, valueof) { + const v = variance(values2, valueof); + return v ? Math.sqrt(v) : v; + } + class Adder { + constructor() { + this._partials = new Float64Array(32); + this._n = 0; + } + add(x2) { + const p = this._partials; + let i = 0; + for (let j = 0; j < this._n && j < 32; j++) { + const y2 = p[j], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2); + if (lo) p[i++] = lo; + x2 = hi; + } + p[i] = x2; + this._n = i + 1; + return this; } - // increment timestamp clock - const stamp = ++df._clock; - // set the current pulse - df._pulse = new Pulse(df, stamp, encode); - // initialize priority queue, reset touched operators - df._touched.forEach((op)=>df._enqueue(op, true)); - df._touched = UniqueList((0, _vegaUtil.id)); - let count = 0, op, next, error; - try { - while(df._heap.size() > 0){ - // dequeue operator with highest priority - op = df._heap.pop(); - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - if (next.then) // await if operator returns a promise directly - next = await next; - else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach((op)=>df._enqueue(op)); - } - // increment visit counter - ++count; + valueOf() { + const p = this._partials; + let n = this._n, x2, y2, lo, hi = 0; + if (n > 0) { + hi = p[--n]; + while (n > 0) { + x2 = hi; + y2 = p[--n]; + hi = x2 + y2; + lo = y2 - (hi - x2); + if (lo) break; + } + if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { + y2 = lo * 2; + x2 = hi + y2; + if (y2 == x2 - hi) hi = x2; } - } catch (err) { - df._heap.clear(); - error = err; + } + return hi; } - // reset pulse map - df._input = {}; - df._pulse = null; - df.debug(`Pulse ${stamp}: ${count} operators`); - if (error) { - df._postrun = []; - df.error(error); + } + class InternMap extends Map { + constructor(entries, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (entries != null) for (const [key3, value2] of entries) this.set(key3, value2); } - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b)=>b.priority - a.priority); - df._postrun = []; - for(let i = 0; i < pr.length; ++i)await asyncCallback(df, pr[i].callback); + get(key2) { + return super.get(intern_get(this, key2)); } - // invoke postrun function, if provided - if (postrun) await asyncCallback(df, postrun); - // handle non-blocking asynchronous callbacks - if (async.length) Promise.all(async).then((cb)=>df.runAsync(null, ()=>{ - cb.forEach((f)=>{ - try { - f(df); - } catch (err) { - df.error(err); - } - }); - })); - return df; -} -/** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while(this._running)await this._running; - // run dataflow, manage running promise - const clear = ()=>this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear); - return this._running; -} -/** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this); -} -/** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - else // pulse propagation already complete, invoke immediately - try { - callback(this); - } catch (err) { - this.error(err); + has(key2) { + return super.has(intern_get(this, key2)); } -} -/** - * Raise an error for re-entrant dataflow evaluation. - */ function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; -} -/** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ function enqueue(op, force) { - const q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } -} -/** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ function getPulse(op, encode) { - const s = op.source, stamp = this._clock; - return s && (0, _vegaUtil.isArray)(s) ? new MultiPulse(this, stamp, s.map((_)=>_.pulse), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); -} -function singlePulse(p, s) { - if (s && s.stamp === p.stamp) return s; - p = p.fork(); - if (s && s !== StopPropagation) p.source = s.source; - return p; -} -const NO_OPT = { - skip: false, - force: false -}; -/** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function touch(op, options) { - const opt = options || NO_OPT; - if (this._pulse) // if in midst of propagation, add to priority queue - this._enqueue(op); - else // otherwise, queue for next propagation - this._touched.add(op); - if (opt.skip) op.skip(true); - return this; -} -/** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function update(op, value, options) { - const opt = options || NO_OPT; - if (op.set(value) || opt.force) this.touch(op, opt); - return this; -} -/** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - return this; -} -function Heap(cmp) { - let nodes = []; - return { - clear: ()=>nodes = [], - size: ()=>nodes.length, - peek: ()=>nodes[0], - push: (x)=>{ - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: ()=>{ - const last = nodes.pop(); - let item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else item = last; - return item; - } - }; -} -function siftdown(array, start, idx, cmp) { - let parent, pidx; - const item = array[idx]; - while(idx > start){ - pidx = idx - 1 >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - break; + set(key2, value2) { + return super.set(intern_set(this, key2), value2); } - return array[idx] = item; -} -function siftup(array, idx, cmp) { - const start = idx, end = array.length, item = array[idx]; - let cidx = (idx << 1) + 1, ridx; - while(cidx < end){ - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) cidx = ridx; - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); -} -/** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ function Dataflow() { - this.logger((0, _vegaUtil.logger)()); - this.logLevel((0, _vegaUtil.Error)); - this._clock = 0; - this._rank = 0; - this._locale = (0, _vegaFormat.defaultLocale)(); - try { - this._loader = (0, _vegaLoader.loader)(); - } catch (e) { - // do nothing if loader module is unavailable + delete(key2) { + return super.delete(intern_delete(this, key2)); } - this._touched = UniqueList((0, _vegaUtil.id)); - this._input = {}; - this._pulse = null; - this._heap = Heap((a, b)=>a.qrank - b.qrank); - this._postrun = []; -} -function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); - }; -} -Dataflow.prototype = { - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ stamp () { - return this._clock; - }, - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ loader (_) { - if (arguments.length) { - this._loader = _; - return this; - } else return this._loader; - }, - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ locale (_) { - if (arguments.length) { - this._locale = _; - return this; - } else return this._locale; - }, - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ logger (logger) { - if (arguments.length) { - this._log = logger; - return this; - } else return this._log; - }, - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ error: logMethod('error'), - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ warn: logMethod('warn'), - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ info: logMethod('info'), - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ debug: logMethod('debug'), - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ logLevel: logMethod('level'), - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ cleanThreshold: 1e4, - // OPERATOR REGISTRATION - add, - connect, - rank, - rerank, - // OPERATOR UPDATES - pulse, - touch, - update, - changeset, - // DATA LOADING - ingest, - parse, - preload, - request, - // EVENT HANDLING - events, - on, - // PULSE PROPAGATION - evaluate, - run, - runAsync, - runAfter, - _enqueue: enqueue, - _getPulse: getPulse -}; -/** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ function Transform(init, params) { - Operator.call(this, init, null, params); -} -(0, _vegaUtil.inherits)(Transform, Operator, { - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) this.skip(false); - else rv = this.evaluate(pulse); - rv = rv || pulse; - if (rv.then) rv = rv.then((_)=>this.pulse = _); - else if (rv !== pulse.StopPropagation) this.pulse = rv; - return rv; - }, - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const params = this.marshall(pulse.stamp), out = this.transform(params, pulse); - params.clear(); - return out; - }, - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ transform () {} -}); -const transforms = {}; -function definition(type) { - const t = transform(type); - return t && t.Definition || null; -} -function transform(type) { - type = type && type.toLowerCase(); - return (0, _vegaUtil.hasOwnProperty)(transforms, type) ? transforms[type] : null; -} - -},{"vega-util":"bApja","vega-loader":"gmbOr","vega-format":"47kOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gmbOr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formats", ()=>formats); -parcelHelpers.export(exports, "inferType", ()=>inferType); -parcelHelpers.export(exports, "inferTypes", ()=>inferTypes); -parcelHelpers.export(exports, "loader", ()=>loader); -parcelHelpers.export(exports, "read", ()=>read); -parcelHelpers.export(exports, "responseType", ()=>responseType); -parcelHelpers.export(exports, "typeParsers", ()=>typeParsers); -var _vegaUtil = require("vega-util"); -var _d3Dsv = require("d3-dsv"); -var _topojsonClient = require("topojson-client"); -var _vegaFormat = require("vega-format"); -var Buffer = require("d2bd1b4e1a5e867b").Buffer; -// Matches absolute URLs with optional protocol -// https://... file://... //... -const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; -// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// -const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape -const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex -// Special treatment in node.js for the file: protocol -const fileProtocol = 'file://'; -/** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ function loaderFactory(fetch1, fs) { - return (options)=>({ - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: false, - file: fileLoader(fs), - http: httpLoader(fetch1) - }); -} -/** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ async function load(uri, options) { - const opt = await this.sanitize(uri, options), url = opt.href; - return opt.localFile ? this.file(url) : this.http(url, options); -} -/** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ async function sanitize(uri, options) { - options = (0, _vegaUtil.extend)({}, this.options, options); - const fileAccess = this.fileAccess, result = { - href: null - }; - let isFile, loadFile, base; - const isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - if (uri == null || typeof uri !== 'string' || !isAllowed) (0, _vegaUtil.error)('Sanitize failure, invalid URI: ' + (0, _vegaUtil.stringValue)(uri)); - const hasProtocol = protocol_re.test(uri); - // if relative url (no protocol/host), prepend baseURL - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && !base.endsWith('/')) uri = '/' + uri; - uri = base + uri; - } - // should we load from file system? - loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess; - if (isFile) // strip file protocol - uri = uri.slice(fileProtocol.length); - else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - // set non-enumerable mode flag to indicate local file load - Object.defineProperty(result, 'localFile', { - value: !!loadFile - }); - // set uri - result.href = uri; - // set default result target, if specified - if (options.target) result.target = options.target + ''; - // set default result rel, if specified (#1542) - if (options.rel) result.rel = options.rel + ''; - // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - if (options.context === 'image' && options.crossOrigin) result.crossOrigin = options.crossOrigin + ''; - // return - return result; -} -/** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ function fileLoader(fs) { - return fs ? (filename)=>new Promise((accept, reject)=>{ - fs.readFile(filename, (error, data)=>{ - if (error) reject(error); - else accept(data); - }); - }) : fileReject; -} -/** - * Default file system loader that simply rejects. - */ async function fileReject() { - (0, _vegaUtil.error)('No file system access.'); -} -/** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ function httpLoader(fetch1) { - return fetch1 ? async function(url, options) { - const opt = (0, _vegaUtil.extend)({}, this.options.http, options), type = options && options.response, response = await fetch1(url, opt); - return !response.ok ? (0, _vegaUtil.error)(response.status + '' + response.statusText) : (0, _vegaUtil.isFunction)(response[type]) ? response[type]() : response.text(); - } : httpReject; -} -/** - * Default http request handler that simply rejects. - */ async function httpReject() { - (0, _vegaUtil.error)('No HTTP fetch method available.'); -} -const isValid = (_)=>_ != null && _ === _; -const isBoolean = (_)=>_ === 'true' || _ === 'false' || _ === true || _ === false; -const isDate = (_)=>!Number.isNaN(Date.parse(_)); -const isNumber = (_)=>!Number.isNaN(+_) && !(_ instanceof Date); -const isInteger = (_)=>isNumber(_) && Number.isInteger(+_); -const typeParsers = { - boolean: (0, _vegaUtil.toBoolean), - integer: (0, _vegaUtil.toNumber), - number: (0, _vegaUtil.toNumber), - date: (0, _vegaUtil.toDate), - string: (0, _vegaUtil.toString), - unknown: (0, _vegaUtil.identity) -}; -const typeTests = [ - isBoolean, - isInteger, - isNumber, - isDate -]; -const typeList = [ - 'boolean', - 'integer', - 'number', - 'date' -]; -function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - const n = values.length, m = typeTests.length, a = typeTests.map((_, i)=>i + 1); - for(let i = 0, t = 0, j, value; i < n; ++i){ - value = field ? values[i][field] : values[i]; - for(j = 0; j < m; ++j)if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - return typeList[a.reduce((u, v)=>u === 0 ? v : u, 0) - 1]; -} -function inferTypes(data, fields) { - return fields.reduce((types, field)=>{ - types[field] = inferType(data, field); - return types; - }, {}); -} -function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = { - delimiter: delimiter - }; - return dsv(data, format ? (0, _vegaUtil.extend)(format, delim) : delim); - }; - parse.responseType = 'text'; - return parse; -} -function dsv(data, format) { - if (format.header) data = format.header.map((0, _vegaUtil.stringValue)).join(format.delimiter) + '\n' + data; - return (0, _d3Dsv.dsvFormat)(format.delimiter).parse(data + ''); -} -dsv.responseType = 'text'; -function isBuffer(_) { - return typeof Buffer === 'function' && (0, _vegaUtil.isFunction)(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; -} -function json(data, format) { - const prop = format && format.property ? (0, _vegaUtil.field)(format.property) : (0, _vegaUtil.identity); - return (0, _vegaUtil.isObject)(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data)); -} -json.responseType = 'json'; -function parseJSON(data, format) { - if (!(0, _vegaUtil.isArray)(data) && (0, _vegaUtil.isIterable)(data)) data = [ - ...data - ]; - return format && format.copy ? JSON.parse(JSON.stringify(data)) : data; -} -const filters = { - interior: (a, b)=>a !== b, - exterior: (a, b)=>a === b -}; -function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - if (format && format.feature) { - method = (0, _topojsonClient.feature); - property = format.feature; - } else if (format && format.mesh) { - method = (0, _topojsonClient.mesh); - property = format.mesh; - filter = filters[format.filter]; - } else (0, _vegaUtil.error)('Missing TopoJSON feature or mesh parameter.'); - object = (object = data.objects[property]) ? method(data, object, filter) : (0, _vegaUtil.error)('Invalid TopoJSON object: ' + property); - return object && object.features || [ - object - ]; -} -topojson.responseType = 'json'; -const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson -}; -function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else return (0, _vegaUtil.hasOwnProperty)(format, name) ? format[name] : null; -} -function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; -} -function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - const reader = formats(schema.type || 'json'); - if (!reader) (0, _vegaUtil.error)('Unknown data format type: ' + schema.type); - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - if ((0, _vegaUtil.hasOwnProperty)(data, 'columns')) delete data.columns; - return data; -} -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - const locale = (0, _vegaFormat.timeFormatDefaultLocale)(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - let fields = data.columns || Object.keys(data[0]), datum, field, i, j, n, m; - if (types === 'auto') types = inferTypes(data, fields); - fields = Object.keys(types); - const parsers = fields.map((field)=>{ - const type = types[field]; - let parts, pattern; - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') pattern = pattern.slice(1, -1); - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - if (!typeParsers[type]) throw Error('Illegal format pattern: ' + field + ':' + type); - return typeParsers[type]; - }); - for(i = 0, n = data.length, m = fields.length; i < n; ++i){ - datum = data[i]; - for(j = 0; j < m; ++j){ - field = fields[j]; - datum[field] = parsers[j](datum[field]); - } - } -} -const loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API -null // no file system access -); - -},{"d2bd1b4e1a5e867b":"6tQNr","vega-util":"bApja","d3-dsv":"70Sp2","topojson-client":"aKIOa","vega-format":"47kOt","buffer":"9AXxu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6tQNr":[function(require,module,exports,__globalThis) { -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh <https://feross.org> - * @license MIT - */ /* eslint-disable no-proto */ 'use strict'; -const base64 = require("9c62938f1dccc73c"); -const ieee754 = require("aceacb6a4531a9d2"); -const customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null; -exports.Buffer = Buffer; -exports.SlowBuffer = SlowBuffer; -exports.INSPECT_MAX_BYTES = 50; -const K_MAX_LENGTH = 0x7fffffff; -exports.kMaxLength = K_MAX_LENGTH; -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); -function typedArraySupport() { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1); - const proto = { - foo: function() { - return 42; - } - }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; + } + class InternSet extends Set { + constructor(values2, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (values2 != null) for (const value2 of values2) this.add(value2); } -} -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.buffer; - } -}); -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.byteOffset; - } -}); -function createBuffer(length) { - if (length > K_MAX_LENGTH) throw new RangeError('The value "' + length + '" is invalid for option "size"'); - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ function Buffer(arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') throw new TypeError('The "string" argument must be of type string. Received type number'); - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); -} -Buffer.poolSize = 8192 // not used by this implementation -; -function from(value, encodingOrOffset, length) { - if (typeof value === 'string') return fromString(value, encodingOrOffset); - if (ArrayBuffer.isView(value)) return fromArrayView(value); - if (value == null) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof value === 'number') throw new TypeError('The "value" argument must not be of type number. Received type number'); - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); -} -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ Buffer.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); -}; -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); -Object.setPrototypeOf(Buffer, Uint8Array); -function assertSize(size) { - if (typeof size !== 'number') throw new TypeError('"size" argument must be of type number'); - else if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); -} -function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) return createBuffer(size); - if (fill !== undefined) // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - return createBuffer(size); -} -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ Buffer.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); -}; -function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); -} -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ Buffer.allocUnsafe = function(size) { - return allocUnsafe(size); -}; -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ Buffer.allocUnsafeSlow = function(size) { - return allocUnsafe(size); -}; -function fromString(string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'; - if (!Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual); - return buf; -} -function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for(let i = 0; i < length; i += 1)buf[i] = array[i] & 255; - return buf; -} -function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); -} -function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); - let buf; - if (byteOffset === undefined && length === undefined) buf = new Uint8Array(array); - else if (length === undefined) buf = new Uint8Array(array, byteOffset); - else buf = new Uint8Array(array, byteOffset, length); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -function fromObject(obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) return buf; - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) return createBuffer(0); - return fromArrayLike(obj); - } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) return fromArrayLike(obj.data); -} -function checked(length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + ' bytes'); - return length | 0; -} -function SlowBuffer(length) { - if (+length != length) length = 0; - return Buffer.alloc(+length); -} -Buffer.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false - ; -}; -Buffer.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - if (a === b) return 0; - let x = a.length; - let y = b.length; - for(let i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; + has(value2) { + return super.has(intern_get(this, value2)); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -Buffer.isEncoding = function isEncoding(encoding) { - switch(String(encoding).toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true; - default: - return false; - } -}; -Buffer.concat = function concat(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); - if (list.length === 0) return Buffer.alloc(0); - let i; - if (length === undefined) { - length = 0; - for(i = 0; i < list.length; ++i)length += list[i].length; - } - const buffer = Buffer.allocUnsafe(length); - let pos = 0; - for(i = 0; i < list.length; ++i){ - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf); - buf.copy(buffer, pos); - } else Uint8Array.prototype.set.call(buffer, buf, pos); - } else if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); - else buf.copy(buffer, pos); - pos += buf.length; - } - return buffer; -}; -function byteLength(string, encoding) { - if (Buffer.isBuffer(string)) return string.length; - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if (typeof string !== 'string') throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - // Use a for loop to avoid recursion - let loweredCase = false; - for(;;)switch(encoding){ - case 'ascii': - case 'latin1': - case 'binary': - return len; - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2; - case 'hex': - return len >>> 1; - case 'base64': - return base64ToBytes(string).length; - default: - if (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - ; - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } -} -Buffer.byteLength = byteLength; -function slowToString(encoding, start, end) { - let loweredCase = false; - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) start = 0; - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) return ''; - if (end === undefined || end > this.length) end = this.length; - if (end <= 0) return ''; - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0; - start >>>= 0; - if (end <= start) return ''; - if (!encoding) encoding = 'utf8'; - while(true)switch(encoding){ - case 'hex': - return hexSlice(this, start, end); - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end); - case 'ascii': - return asciiSlice(this, start, end); - case 'latin1': - case 'binary': - return latin1Slice(this, start, end); - case 'base64': - return base64Slice(this, start, end); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = (encoding + '').toLowerCase(); - loweredCase = true; - } -} -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true; -function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; -} -Buffer.prototype.swap16 = function swap16() { - const len = this.length; - if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits'); - for(let i = 0; i < len; i += 2)swap(this, i, i + 1); - return this; -}; -Buffer.prototype.swap32 = function swap32() { - const len = this.length; - if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits'); - for(let i = 0; i < len; i += 4){ - swap(this, i, i + 3); - swap(this, i + 1, i + 2); + add(value2) { + return super.add(intern_set(this, value2)); } - return this; -}; -Buffer.prototype.swap64 = function swap64() { - const len = this.length; - if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits'); - for(let i = 0; i < len; i += 8){ - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); + delete(value2) { + return super.delete(intern_delete(this, value2)); } - return this; -}; -Buffer.prototype.toString = function toString() { - const length = this.length; - if (length === 0) return ''; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); -}; -Buffer.prototype.toLocaleString = Buffer.prototype.toString; -Buffer.prototype.equals = function equals(b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); - if (this === b) return true; - return Buffer.compare(this, b) === 0; -}; -Buffer.prototype.inspect = function inspect() { - let str = ''; - const max = exports.INSPECT_MAX_BYTES; - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); - if (this.length > max) str += ' ... '; - return '<Buffer ' + str + '>'; -}; -if (customInspectSymbol) Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; -Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) target = Buffer.from(target, target.offset, target.byteLength); - if (!Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (start === undefined) start = 0; - if (end === undefined) end = target ? target.length : 0; - if (thisStart === undefined) thisStart = 0; - if (thisEnd === undefined) thisEnd = this.length; - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError('out of range index'); - if (thisStart >= thisEnd && start >= end) return 0; - if (thisStart >= thisEnd) return -1; - if (start >= end) return 1; - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for(let i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; + } + function intern_get({ _intern, _key }, value2) { + const key2 = _key(value2); + return _intern.has(key2) ? _intern.get(key2) : value2; + } + function intern_set({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) return _intern.get(key2); + _intern.set(key2, value2); + return value2; + } + function intern_delete({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) { + value2 = _intern.get(key2); + _intern.delete(key2); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1; - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff; - else if (byteOffset < -2147483648) byteOffset = -2147483648; - byteOffset = +byteOffset // Coerce to Number. - ; - if (numberIsNaN(byteOffset)) // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : buffer.length - 1; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - else byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - // Normalize val - if (typeof val === 'string') val = Buffer.from(val, encoding); - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) return -1; - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - ; - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - return arrayIndexOf(buffer, [ - val - ], byteOffset, encoding, dir); - } - throw new TypeError('val must be string, number or Buffer'); -} -function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase(); - if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) return -1; - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i) { - if (indexSize === 1) return buf[i]; - else return buf.readUInt16BE(i * indexSize); - } - let i; - if (dir) { - let foundIndex = -1; - for(i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; + return value2; + } + function keyof(value2) { + return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2; + } + function permute(source2, keys2) { + return Array.from(keys2, (key2) => source2[key2]); + } + function compareDefined(compare2 = ascending$1) { + if (compare2 === ascending$1) return ascendingDefined; + if (typeof compare2 !== "function") throw new TypeError("compare is not a function"); + return (a2, b2) => { + const x2 = compare2(a2, b2); + if (x2 || x2 === 0) return x2; + return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0); + }; + } + function ascendingDefined(a2, b2) { + return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0); + } + const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); + function tickSpec(start, stop2, count2) { + const step = (stop2 - start) / Math.max(0, count2), power = Math.floor(Math.log10(step)), error2 = step / Math.pow(10, power), factor = error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1; + let i1, i2, inc; + if (power < 0) { + inc = Math.pow(10, -power) / factor; + i1 = Math.round(start * inc); + i2 = Math.round(stop2 * inc); + if (i1 / inc < start) ++i1; + if (i2 / inc > stop2) --i2; + inc = -inc; + } else { + inc = Math.pow(10, power) * factor; + i1 = Math.round(start / inc); + i2 = Math.round(stop2 / inc); + if (i1 * inc < start) ++i1; + if (i2 * inc > stop2) --i2; + } + if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start, stop2, count2 * 2); + return [i1, i2, inc]; + } + function ticks(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + if (!(count2 > 0)) return []; + if (start === stop2) return [start]; + const reverse2 = stop2 < start, [i1, i2, inc] = reverse2 ? tickSpec(stop2, start, count2) : tickSpec(start, stop2, count2); + if (!(i2 >= i1)) return []; + const n = i2 - i1 + 1, ticks2 = new Array(n); + if (reverse2) { + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc; + } else { + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc; + } + return ticks2; + } + function tickIncrement(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + return tickSpec(start, stop2, count2)[2]; + } + function tickStep(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + const reverse2 = stop2 < start, inc = reverse2 ? tickIncrement(stop2, start, count2) : tickIncrement(start, stop2, count2); + return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + } + function max$3(values2, valueof) { + let max2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; } + } } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for(i = byteOffset; i >= 0; i--){ - let found = true; - for(let j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - if (found) return i; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; } + } } - return -1; -} -Buffer.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; -}; -Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); -}; -Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); -}; -function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) length = remaining; - else { - length = Number(length); - if (length > remaining) length = remaining; - } - const strLen = string.length; - if (length > strLen / 2) length = strLen / 2; - let i; - for(i = 0; i < length; ++i){ - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; + return max2; + } + function min$3(values2, valueof) { + let min2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } } - return i; -} -function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); -} -function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); -} -function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); -} -function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); -} -Buffer.prototype.write = function write(string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8'; - length = this.length; - offset = 0; - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset; - length = this.length; - offset = 0; - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === undefined) encoding = 'utf8'; - } else { - encoding = length; - length = undefined; - } - } else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); - const remaining = this.length - offset; - if (length === undefined || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError('Attempt to write outside buffer bounds'); - if (!encoding) encoding = 'utf8'; - let loweredCase = false; - for(;;)switch(encoding){ - case 'hex': - return hexWrite(this, string, offset, length); - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length); - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; + return min2; + } + function quickselect(array2, k, left = 0, right = Infinity, compare2) { + k = Math.floor(k); + left = Math.floor(Math.max(0, left)); + right = Math.floor(Math.min(array2.length - 1, right)); + if (!(left <= k && k <= right)) return array2; + compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2); + while (right > left) { + if (right - left > 600) { + const n = right - left + 1; + const m2 = k - left + 1; + const z = Math.log(n); + const s = 0.5 * Math.exp(2 * z / 3); + const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m2 - n / 2 < 0 ? -1 : 1); + const newLeft = Math.max(left, Math.floor(k - m2 * s / n + sd)); + const newRight = Math.min(right, Math.floor(k + (n - m2) * s / n + sd)); + quickselect(array2, k, newLeft, newRight, compare2); + } + const t = array2[k]; + let i = left; + let j = right; + swap$1(array2, left, k); + if (compare2(array2[right], t) > 0) swap$1(array2, left, right); + while (i < j) { + swap$1(array2, i, j), ++i, --j; + while (compare2(array2[i], t) < 0) ++i; + while (compare2(array2[j], t) > 0) --j; + } + if (compare2(array2[left], t) === 0) swap$1(array2, left, j); + else ++j, swap$1(array2, j, right); + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; } -}; -Buffer.prototype.toJSON = function toJSON() { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - }; -}; -function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) return base64.fromByteArray(buf); - else return base64.fromByteArray(buf.slice(start, end)); -} -function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while(i < end){ - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch(bytesPerSequence){ - case 1: - if (firstByte < 0x80) codePoint = firstByte; - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; - if (tempCodePoint > 0x7F) codePoint = tempCodePoint; - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) codePoint = tempCodePoint; - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) codePoint = tempCodePoint; - } - } + return array2; + } + function swap$1(array2, i, j) { + const t = array2[i]; + array2[i] = array2[j]; + array2[j] = t; + } + function quantile$1(values2, p, valueof) { + values2 = Float64Array.from(numbers$2(values2, valueof)); + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return min$3(values2); + if (p >= 1) return max$3(values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$3(quickselect(values2, i0).subarray(0, i0 + 1)), value1 = min$3(values2.subarray(i0 + 1)); + return value0 + (value1 - value0) * (i - i0); + } + function quantileSorted(values2, p, valueof = number$6) { + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return +valueof(values2[0], 0, values2); + if (p >= 1) return +valueof(values2[n - 1], n - 1, values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values2[i0], i0, values2), value1 = +valueof(values2[i0 + 1], i0 + 1, values2); + return value0 + (value1 - value0) * (i - i0); + } + function mean(values2, valueof) { + let count2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; } - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD; - bytesPerSequence = 1; - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000; - res.push(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | codePoint & 0x3FF; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); -} -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000; -function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - ; - // Decode in chunks to avoid "call stack size exceeded". - let res = ''; - let i = 0; - while(i < len)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - return res; -} -function asciiSlice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i] & 0x7F); - return ret; -} -function latin1Slice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); - return ret; -} -function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ''; - for(let i = start; i < end; ++i)out += hexSliceLookupTable[buf[i]]; - return out; -} -function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ''; - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for(let i = 0; i < bytes.length - 1; i += 2)res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - return res; -} -Buffer.prototype.slice = function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === undefined ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) start = len; - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) end = len; - if (end < start) end = start; - const newBuf = this.subarray(start, end); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype); - return newBuf; -}; -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); -} -Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - return val; -}; -Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset + --byteLength]; - let mul = 1; - while(byteLength > 0 && (mul *= 0x100))val += this[offset + --byteLength] * mul; - return val; -}; -Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; -}; -Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; -}; -Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; -}; -Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; -}; -Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); -}; -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const lo = first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 256 + this[++offset] * 2 ** 16 + last * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); -}); -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); -}); -Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let i = byteLength; - let mul = 1; - let val = this[offset + --i]; - while(i > 0 && (mul *= 0x100))val += this[offset + --i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 0x80)) return this[offset]; - return (0xff - this[offset] + 1) * -1; -}; -Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; -}; -Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; -}; -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = this[offset + 4] + this[offset + 5] * 256 + this[offset + 6] * 2 ** 16 + (last << 24 // Overflow - ); - return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); -}); -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last); -}); -Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); -}; -Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); -}; -Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); -}; -Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); -}; -function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError('Index out of range'); -} -Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let i = byteLength - 1; - let mul = 1; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; -} -function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; -} -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; + } + } } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - let i = byteLength - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128); - if (value < 0) value = 0xff + value + 1; - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; -}; -Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - if (value < 0) value = 0xffffffff + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); -} -function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; -} -Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); -}; -function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; -} -Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); -}; -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - // Copy 0 bytes; we're done - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - // Fatal error conditions - if (targetStart < 0) throw new RangeError('targetStart out of bounds'); - if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); - if (end < 0) throw new RangeError('sourceEnd out of bounds'); - // Are we oob? - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) end = target.length - targetStart + start; - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end); - else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); - return len; -}; -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill(val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === 'string') { - encoding = end; - end = this.length; - } - if (encoding !== undefined && typeof encoding !== 'string') throw new TypeError('encoding must be a string'); - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === 'utf8' && code < 128 || encoding === 'latin1') // Fast path: If `val` fits into a single byte, use that numeric value. - val = code; - } - } else if (typeof val === 'number') val = val & 255; - else if (typeof val === 'boolean') val = Number(val); - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) throw new RangeError('Out of range index'); - if (end <= start) return this; - start = start >>> 0; - end = end === undefined ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === 'number') for(i = start; i < end; ++i)this[i] = val; - else { - const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding); - const len = bytes.length; - if (len === 0) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; + if (count2) return sum2 / count2; + } + function median(values2, valueof) { + return quantile$1(values2, 0.5, valueof); + } + function* flatten$1(arrays) { + for (const array2 of arrays) { + yield* array2; } - return this; -}; -// CUSTOM ERRORS -// ============= -// Simplified versions from Node, changed for Buffer-only usage -const errors = {}; -function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor(){ - super(); - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]`; - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - ; - // Reset the name to the actual name. - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }); + } + function merge$2(arrays) { + return Array.from(flatten$1(arrays)); + } + function range$3(start, stop2, step) { + start = +start, stop2 = +stop2, step = (n = arguments.length) < 2 ? (stop2 = start, start = 0, 1) : n < 3 ? 1 : +step; + var i = -1, n = Math.max(0, Math.ceil((stop2 - start) / step)) | 0, range2 = new Array(n); + while (++i < n) { + range2[i] = start + i * step; + } + return range2; + } + function sum$1(values2, valueof) { + let sum2 = 0; + { + for (let value2 of values2) { + if (value2 = +value2) { + sum2 += value2; } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; -} -E('ERR_BUFFER_OUT_OF_BOUNDS', function(name) { - if (name) return `${name} is outside of buffer bounds`; - return 'Attempt to access memory outside buffer bounds'; -}, RangeError); -E('ERR_INVALID_ARG_TYPE', function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; -}, TypeError); -E('ERR_OUT_OF_RANGE', function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) received = addNumericalSeparator(String(input)); - else if (typeof input === 'bigint') { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) received = addNumericalSeparator(received); - received += 'n'; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; -}, RangeError); -function addNumericalSeparator(val) { - let res = ''; - let i = val.length; - const start = val[0] === '-' ? 1 : 0; - for(; i >= start + 4; i -= 3)res = `_${val.slice(i - 3, i)}${res}`; - return `${val.slice(0, i)}${res}`; -} -// CHECK FUNCTIONS -// =============== -function checkBounds(buf, offset, byteLength) { - validateNumber(offset, 'offset'); - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) boundsError(offset, buf.length - (byteLength + 1)); -} -function checkIntBI(value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : ''; - let range; - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; - else range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}`; - } else range = `>= ${min}${n} and <= ${max}${n}`; - throw new errors.ERR_OUT_OF_RANGE('value', range, value); - } - checkBounds(buf, offset, byteLength); -} -function validateNumber(value, name) { - if (typeof value !== 'number') throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value); -} -function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value); - } - if (length < 0) throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', `>= ${type ? 1 : 0} and <= ${length}`, value); -} -// HELPER FUNCTIONS -// ================ -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; -function base64clean(str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0]; - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, ''); - // Node converts strings with length < 2 to '' - if (str.length < 2) return ''; - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while(str.length % 4 !== 0)str = str + '='; - return str; -} -function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for(let i = 0; i < length; ++i){ - codePoint = string.charCodeAt(i); - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - // valid lead - leadSurrogate = codePoint; - continue; - } - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - leadSurrogate = codePoint; - continue; - } - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; - } else if (leadSurrogate) // valid bmp char, but last char was a lead - { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - } - leadSurrogate = null; - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break; - bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break; - bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break; - bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else throw new Error('Invalid code point'); - } - return bytes; -} -function asciiToBytes(str) { - const byteArray = []; - for(let i = 0; i < str.length; ++i)// Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF); - return byteArray; -} -function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for(let i = 0; i < str.length; ++i){ - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; -} -function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); -} -function blitBuffer(src, dst, offset, length) { - let i; - for(i = 0; i < length; ++i){ - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; + } } - return i; -} -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; -} -function numberIsNaN(obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare - ; -} -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = function() { - const alphabet = '0123456789abcdef'; - const table = new Array(256); - for(let i = 0; i < 16; ++i){ - const i16 = i * 16; - for(let j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; - } - return table; -}(); -// Return not function with Error if BigInt not supported -function defineBigIntMethod(fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn; -} -function BufferBigIntNotDefined() { - throw new Error('BigInt not supported'); -} - -},{"9c62938f1dccc73c":"7jAMi","aceacb6a4531a9d2":"hITcF"}],"7jAMi":[function(require,module,exports,__globalThis) { -'use strict'; -exports.byteLength = byteLength; -exports.toByteArray = toByteArray; -exports.fromByteArray = fromByteArray; -var lookup = []; -var revLookup = []; -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -for(var i = 0, len = code.length; i < len; ++i){ - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; -} -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62; -revLookup['_'.charCodeAt(0)] = 63; -function getLens(b64) { - var len = b64.length; - if (len % 4 > 0) throw new Error('Invalid string. Length must be a multiple of 4'); - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('='); - if (validLen === -1) validLen = len; - var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; + return sum2; + } + function intersection(values2, ...others) { + values2 = new InternSet(values2); + others = others.map(set$8); + out: for (const value2 of values2) { + for (const other of others) { + if (!other.has(value2)) { + values2.delete(value2); + continue out; + } + } + } + return values2; + } + function set$8(values2) { + return values2 instanceof InternSet ? values2 : new InternSet(values2); + } + function union(...others) { + const set2 = new InternSet(); + for (const other of others) { + for (const o of other) { + set2.add(o); + } + } + return set2; + } + function formatDecimal(x2) { + return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); + } + function formatDecimalParts(x2, p) { + if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; + var i, coefficient = x2.slice(0, i); return [ - validLen, - placeHoldersLen + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x2.slice(i + 1) ]; -} -// base64 is 4/3 + up to two characters of the original data -function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i; - for(i = 0; i < len; i += 4){ - tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[curByte++] = tmp >> 16 & 0xFF; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - return arr; -} -function tripletToBase64(num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; -} -function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for(var i = start; i < end; i += 3){ - tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); - output.push(tripletToBase64(tmp)); - } - return output.join(''); -} -function fromByteArray(uint8) { - var tmp; - var len = uint8.length; - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - ; - var parts = []; - var maxChunkLength = 16383 // must be multiple of 3 - ; - // go through the array every three bytes, we'll deal with trailing stuff later - for(var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1]; - parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); - } - return parts.join(''); -} - -},{}],"hITcF":[function(require,module,exports,__globalThis) { -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ exports.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for(; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for(; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - if (e === 0) e = 1 - eBias; - else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity; - else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; -exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) value += rt / c; - else value += rt * Math.pow(2, 1 - eBias); - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; + } + function exponent(x2) { + return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN; + } + function formatGroup(grouping, thousands) { + return function(value2, width2) { + var i = value2.length, t = [], j = 0, g = grouping[0], length2 = 0; + while (i > 0 && g > 0) { + if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); + t.push(value2.substring(i -= g, i + g)); + if ((length2 += g + 1) > width2) break; + g = grouping[j = (j + 1) % grouping.length]; + } + return t.reverse().join(thousands); + }; + } + function formatNumerals(numerals) { + return function(value2) { + return value2.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } + var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + function formatSpecifier(specifier) { + if (!(match2 = re.exec(specifier))) throw new Error("invalid format: " + specifier); + var match2; + return new FormatSpecifier({ + fill: match2[1], + align: match2[2], + sign: match2[3], + symbol: match2[4], + zero: match2[5], + width: match2[6], + comma: match2[7], + precision: match2[8] && match2[8].slice(1), + trim: match2[9], + type: match2[10] + }); + } + formatSpecifier.prototype = FormatSpecifier.prototype; + function FormatSpecifier(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; + this.zero = !!specifier.zero; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; + this.comma = !!specifier.comma; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; + this.trim = !!specifier.trim; + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + FormatSpecifier.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + function formatTrim(s) { + out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s[i]) { + case ".": + i0 = i1 = i; + break; + case "0": + if (i0 === 0) i0 = i; + i1 = i; + break; + default: + if (!+s[i]) break out; + if (i0 > 0) i0 = 0; + break; + } + } + return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; + } + var prefixExponent; + function formatPrefixAuto(x2, p) { + var d = formatDecimalParts(x2, p); + if (!d) return x2 + ""; + var coefficient = d[0], exponent2 = d[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; + return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x2, Math.max(0, p + i - 1))[0]; + } + function formatRounded(x2, p) { + var d = formatDecimalParts(x2, p); + if (!d) return x2 + ""; + var coefficient = d[0], exponent2 = d[1]; + return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); + } + const formatTypes = { + "%": (x2, p) => (x2 * 100).toFixed(p), + "b": (x2) => Math.round(x2).toString(2), + "c": (x2) => x2 + "", + "d": formatDecimal, + "e": (x2, p) => x2.toExponential(p), + "f": (x2, p) => x2.toFixed(p), + "g": (x2, p) => x2.toPrecision(p), + "o": (x2) => Math.round(x2).toString(8), + "p": (x2, p) => formatRounded(x2 * 100, p), + "r": formatRounded, + "s": formatPrefixAuto, + "X": (x2) => Math.round(x2).toString(16).toUpperCase(), + "x": (x2) => Math.round(x2).toString(16) + }; + function identity$5(x2) { + return x2; + } + var map$2 = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; + function formatLocale$1(locale2) { + var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$5 : formatGroup(map$2.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$5 : formatNumerals(map$2.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "−" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; + function newFormat(specifier) { + specifier = formatSpecifier(specifier); + var fill2 = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol2 = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type; + if (type2 === "n") comma = true, type2 = "g"; + else if (!formatTypes[type2]) precision === void 0 && (precision = 12), trim = true, type2 = "g"; + if (zero2 || fill2 === "0" && align === "=") zero2 = true, fill2 = "0", align = "="; + var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; + var formatType = formatTypes[type2], maybeSuffix = /[defgprs%]/.test(type2); + precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format2(value2) { + var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; + if (type2 === "c") { + valueSuffix = formatType(value2) + valueSuffix; + value2 = ""; } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for(; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for(; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - buffer[offset + i - d] |= s * 128; -}; - -},{}],"70Sp2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dsvFormat", ()=>(0, _dsvJsDefault.default)); -parcelHelpers.export(exports, "csvParse", ()=>(0, _csvJs.csvParse)); -parcelHelpers.export(exports, "csvParseRows", ()=>(0, _csvJs.csvParseRows)); -parcelHelpers.export(exports, "csvFormat", ()=>(0, _csvJs.csvFormat)); -parcelHelpers.export(exports, "csvFormatBody", ()=>(0, _csvJs.csvFormatBody)); -parcelHelpers.export(exports, "csvFormatRows", ()=>(0, _csvJs.csvFormatRows)); -parcelHelpers.export(exports, "csvFormatRow", ()=>(0, _csvJs.csvFormatRow)); -parcelHelpers.export(exports, "csvFormatValue", ()=>(0, _csvJs.csvFormatValue)); -parcelHelpers.export(exports, "tsvParse", ()=>(0, _tsvJs.tsvParse)); -parcelHelpers.export(exports, "tsvParseRows", ()=>(0, _tsvJs.tsvParseRows)); -parcelHelpers.export(exports, "tsvFormat", ()=>(0, _tsvJs.tsvFormat)); -parcelHelpers.export(exports, "tsvFormatBody", ()=>(0, _tsvJs.tsvFormatBody)); -parcelHelpers.export(exports, "tsvFormatRows", ()=>(0, _tsvJs.tsvFormatRows)); -parcelHelpers.export(exports, "tsvFormatRow", ()=>(0, _tsvJs.tsvFormatRow)); -parcelHelpers.export(exports, "tsvFormatValue", ()=>(0, _tsvJs.tsvFormatValue)); -parcelHelpers.export(exports, "autoType", ()=>(0, _autoTypeJsDefault.default)); -var _dsvJs = require("./dsv.js"); -var _dsvJsDefault = parcelHelpers.interopDefault(_dsvJs); -var _csvJs = require("./csv.js"); -var _tsvJs = require("./tsv.js"); -var _autoTypeJs = require("./autoType.js"); -var _autoTypeJsDefault = parcelHelpers.interopDefault(_autoTypeJs); - -},{"./dsv.js":"fRZim","./csv.js":false,"./tsv.js":false,"./autoType.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fRZim":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - function parseRows(text, f) { - var rows = [], N = text.length, I = 0, n = 0, t, eof = N <= 0, eol = false; // current token followed by EOL? - // Strip the trailing newline. - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; - // Unescape quotes. - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while(I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); - if ((i = I) >= N) eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } - // Find next delimiter or newline. - while(I < N){ - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } else if (c !== DELIMITER) continue; - return text.slice(j, i); - } - // Return last token before EOF. - return eof = true, text.slice(j, N); - } - while((t = token()) !== EOF){ - var row = []; - while(t !== EOL && t !== EOF)row.push(t), t = token(); - if (f && (row = f(row, n++)) == null) continue; - rows.push(row); + value2 = +value2; + var valueNegative = value2 < 0 || 1 / value2 < 0; + value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); + if (trim) value2 = formatTrim(value2); + if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; + valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); + if (maybeSuffix) { + i = -1, n = value2.length; + while (++i < n) { + if (c2 = value2.charCodeAt(i), 48 > c2 || c2 > 57) { + valueSuffix = (c2 === 46 ? decimal + value2.slice(i + 1) : value2.slice(i)) + valueSuffix; + value2 = value2.slice(0, i); + break; + } } - return rows; - } - function preformatBody(rows, columns) { - return rows.map(function(row) { - return columns.map(function(column) { - return formatValue(row[column]); - }).join(delimiter); - }); - } - function format(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return [ - columns.map(formatValue).join(delimiter) - ].concat(preformatBody(rows, columns)).join("\n"); + } } - function formatBody(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return preformatBody(rows, columns).join("\n"); - } - function formatRows(rows) { - return rows.map(formatRow).join("\n"); - } - function formatRow(row) { - return row.map(formatValue).join(delimiter); - } - function formatValue(value) { - return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; + if (comma && !zero2) value2 = group2(value2, Infinity); + var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) : ""; + if (comma && zero2) value2 = group2(padding2 + value2, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; + switch (align) { + case "<": + value2 = valuePrefix + value2 + valueSuffix + padding2; + break; + case "=": + value2 = valuePrefix + padding2 + value2 + valueSuffix; + break; + case "^": + value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); + break; + default: + value2 = padding2 + valuePrefix + value2 + valueSuffix; + break; } - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; - }); -var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; -function objectConverter(columns) { - return new Function("d", "return {" + columns.map(function(name, i) { - return JSON.stringify(name) + ": d[" + i + "] || \"\""; - }).join(",") + "}"); -} -function customConverter(columns, f) { - var object = objectConverter(columns); - return function(row, i) { - return f(object(row), i, columns); + return numerals(value2); + } + format2.toString = function() { + return specifier + ""; + }; + return format2; + } + function formatPrefix2(specifier, value2) { + var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value2) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; + return function(value3) { + return f(k * value3) + prefix; + }; + } + return { + format: newFormat, + formatPrefix: formatPrefix2 }; -} -// Compute unique columns in order of discovery. -function inferColumns(rows) { - var columnSet = Object.create(null), columns = []; - rows.forEach(function(row) { - for(var column in row)if (!(column in columnSet)) columns.push(columnSet[column] = column); - }); - return columns; -} -function pad(value, width) { - var s = value + "", length = s.length; - return length < width ? new Array(width - length + 1).join(0) + s : s; -} -function formatYear(year) { - return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); -} -function formatDate(date) { - var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aKIOa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bbox", ()=>(0, _bboxJsDefault.default)); -parcelHelpers.export(exports, "feature", ()=>(0, _featureJsDefault.default)); -parcelHelpers.export(exports, "mesh", ()=>(0, _meshJsDefault.default)); -parcelHelpers.export(exports, "meshArcs", ()=>(0, _meshJs.meshArcs)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "mergeArcs", ()=>(0, _mergeJs.mergeArcs)); -parcelHelpers.export(exports, "neighbors", ()=>(0, _neighborsJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "transform", ()=>(0, _transformJsDefault.default)); -parcelHelpers.export(exports, "untransform", ()=>(0, _untransformJsDefault.default)); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _featureJs = require("./feature.js"); -var _featureJsDefault = parcelHelpers.interopDefault(_featureJs); -var _meshJs = require("./mesh.js"); -var _meshJsDefault = parcelHelpers.interopDefault(_meshJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _neighborsJs = require("./neighbors.js"); -var _neighborsJsDefault = parcelHelpers.interopDefault(_neighborsJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"e3LWp","./feature.js":"6K0pm","./mesh.js":"k2dDp","./merge.js":"7l4hb","./neighbors.js":"9d2MJ","./quantize.js":"kXipT","./transform.js":"ToH0M","./untransform.js":"6T4yq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e3LWp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - var t = (0, _transformJsDefault.default)(topology.transform), key, x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; - function bboxPoint(p) { - p = t(p); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - function bboxGeometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(bboxGeometry); - break; - case "Point": - bboxPoint(o.coordinates); - break; - case "MultiPoint": - o.coordinates.forEach(bboxPoint); - break; - } + } + var locale$2; + var format$3; + var formatPrefix; + defaultLocale$2({ + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); + function defaultLocale$2(definition2) { + locale$2 = formatLocale$1(definition2); + format$3 = locale$2.format; + formatPrefix = locale$2.formatPrefix; + return locale$2; + } + function precisionFixed(step) { + return Math.max(0, -exponent(Math.abs(step))); + } + function precisionPrefix(step, value2) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value2) / 3))) * 3 - exponent(Math.abs(step))); + } + function precisionRound(step, max2) { + step = Math.abs(step), max2 = Math.abs(max2) - step; + return Math.max(0, exponent(max2) - exponent(step)) + 1; + } + const t0$2 = /* @__PURE__ */ new Date(), t1$1 = /* @__PURE__ */ new Date(); + function timeInterval$1(floori, offseti, count2, field2) { + function interval2(date2) { + return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2; + } + interval2.floor = (date2) => { + return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2; + }; + interval2.ceil = (date2) => { + return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2; + }; + interval2.round = (date2) => { + const d0 = interval2(date2), d1 = interval2.ceil(date2); + return date2 - d0 < d1 - date2 ? d0 : d1; + }; + interval2.offset = (date2, step) => { + return offseti(date2 = /* @__PURE__ */ new Date(+date2), step == null ? 1 : Math.floor(step)), date2; + }; + interval2.range = (start, stop2, step) => { + const range2 = []; + start = interval2.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop2) || !(step > 0)) return range2; + let previous; + do + range2.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start); + while (previous < start && start < stop2); + return range2; + }; + interval2.filter = (test2) => { + return timeInterval$1((date2) => { + if (date2 >= date2) while (floori(date2), !test2(date2)) date2.setTime(date2 - 1); + }, (date2, step) => { + if (date2 >= date2) { + if (step < 0) while (++step <= 0) { + while (offseti(date2, -1), !test2(date2)) { + } + } + else while (--step >= 0) { + while (offseti(date2, 1), !test2(date2)) { + } + } } - topology.arcs.forEach(function(arc) { - var i = -1, n = arc.length, p; - while(++i < n){ - p = t(arc[i], i); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - }); - for(key in topology.objects)bboxGeometry(topology.objects[key]); - return [ - x0, - y0, - x1, - y1 - ]; + }); + }; + if (count2) { + interval2.count = (start, end) => { + t0$2.setTime(+start), t1$1.setTime(+end); + floori(t0$2), floori(t1$1); + return Math.floor(count2(t0$2, t1$1)); + }; + interval2.every = (step) => { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field2 ? (d) => field2(d) % step === 0 : (d) => interval2.count(0, d) % step === 0); + }; + } + return interval2; + } + const millisecond = timeInterval$1(() => { + }, (date2, step) => { + date2.setTime(+date2 + step); + }, (start, end) => { + return end - start; + }); + millisecond.every = (k) => { + k = Math.floor(k); + if (!isFinite(k) || !(k > 0)) return null; + if (!(k > 1)) return millisecond; + return timeInterval$1((date2) => { + date2.setTime(Math.floor(date2 / k) * k); + }, (date2, step) => { + date2.setTime(+date2 + step * k); + }, (start, end) => { + return (end - start) / k; }); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./transform.js":"ToH0M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ToH0M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - while(j < n)output[j] = input[j], ++j; - return output; - }; + }; + millisecond.range; + const durationSecond$1 = 1e3; + const durationMinute$1 = durationSecond$1 * 60; + const durationHour$1 = durationMinute$1 * 60; + const durationDay$1 = durationHour$1 * 24; + const durationWeek$1 = durationDay$1 * 7; + const durationMonth$1 = durationDay$1 * 30; + const durationYear$1 = durationDay$1 * 365; + const second = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds()); + }, (date2, step) => { + date2.setTime(+date2 + step * durationSecond$1); + }, (start, end) => { + return (end - start) / durationSecond$1; + }, (date2) => { + return date2.getUTCSeconds(); + }); + second.range; + const timeMinute = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getMinutes(); + }); + timeMinute.range; + const utcMinute = timeInterval$1((date2) => { + date2.setUTCSeconds(0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getUTCMinutes(); + }); + utcMinute.range; + const timeHour = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1 - date2.getMinutes() * durationMinute$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getHours(); + }); + timeHour.range; + const utcHour = timeInterval$1((date2) => { + date2.setUTCMinutes(0, 0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getUTCHours(); + }); + utcHour.range; + const timeDay = timeInterval$1( + (date2) => date2.setHours(0, 0, 0, 0), + (date2, step) => date2.setDate(date2.getDate() + step), + (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, + (date2) => date2.getDate() - 1 + ); + timeDay.range; + const utcDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return date2.getUTCDate() - 1; + }); + utcDay.range; + const unixDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return Math.floor(date2 / durationDay$1); + }); + unixDay.range; + function timeWeekday(i) { + return timeInterval$1((date2) => { + date2.setDate(date2.getDate() - (date2.getDay() + 7 - i) % 7); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setDate(date2.getDate() + step * 7); + }, (start, end) => { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1; }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"dZ2Lk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dZ2Lk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; + } + const timeSunday = timeWeekday(0); + const timeMonday = timeWeekday(1); + const timeTuesday = timeWeekday(2); + const timeWednesday = timeWeekday(3); + const timeThursday = timeWeekday(4); + const timeFriday = timeWeekday(5); + const timeSaturday = timeWeekday(6); + timeSunday.range; + timeMonday.range; + timeTuesday.range; + timeWednesday.range; + timeThursday.range; + timeFriday.range; + timeSaturday.range; + function utcWeekday(i) { + return timeInterval$1((date2) => { + date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i) % 7); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step * 7); + }, (start, end) => { + return (end - start) / durationWeek$1; }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6K0pm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function(o) { - return feature(topology, o); - }) - } : feature(topology, o); + } + const utcSunday = utcWeekday(0); + const utcMonday = utcWeekday(1); + const utcTuesday = utcWeekday(2); + const utcWednesday = utcWeekday(3); + const utcThursday = utcWeekday(4); + const utcFriday = utcWeekday(5); + const utcSaturday = utcWeekday(6); + utcSunday.range; + utcMonday.range; + utcTuesday.range; + utcWednesday.range; + utcThursday.range; + utcFriday.range; + utcSaturday.range; + const timeMonth = timeInterval$1((date2) => { + date2.setDate(1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setMonth(date2.getMonth() + step); + }, (start, end) => { + return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; + }, (date2) => { + return date2.getMonth(); + }); + timeMonth.range; + const utcMonth = timeInterval$1((date2) => { + date2.setUTCDate(1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCMonth(date2.getUTCMonth() + step); + }, (start, end) => { + return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; + }, (date2) => { + return date2.getUTCMonth(); + }); + utcMonth.range; + const timeYear = timeInterval$1((date2) => { + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step); + }, (start, end) => { + return end.getFullYear() - start.getFullYear(); + }, (date2) => { + return date2.getFullYear(); + }); + timeYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setFullYear(Math.floor(date2.getFullYear() / k) * k); + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step * k); }); -parcelHelpers.export(exports, "object", ()=>object); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -function feature(topology, o) { - var id = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o); - return id == null && bbox == null ? { - type: "Feature", - properties: properties, - geometry: geometry - } : bbox == null ? { - type: "Feature", - id: id, - properties: properties, - geometry: geometry - } : { - type: "Feature", - id: id, - bbox: bbox, - properties: properties, - geometry: geometry - }; -} -function object(topology, o) { - var transformPoint = (0, _transformJsDefault.default)(topology.transform), arcs = topology.arcs; - function arc(i, points) { - if (points.length) points.pop(); - for(var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k)points.push(transformPoint(a[k], k)); - if (i < 0) (0, _reverseJsDefault.default)(points, n); - } - function point(p) { - return transformPoint(p); - } - function line(arcs) { - var points = []; - for(var i = 0, n = arcs.length; i < n; ++i)arc(arcs[i], points); - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - return points; - } - function ring(arcs) { - var points = line(arcs); - while(points.length < 4)points.push(points[0]); // This may happen if an arc has only two points. - return points; - } - function polygon(arcs) { - return arcs.map(ring); - } - function geometry(o) { - var type = o.type, coordinates; - switch(type){ - case "GeometryCollection": - return { - type: type, - geometries: o.geometries.map(geometry) - }; - case "Point": - coordinates = point(o.coordinates); - break; - case "MultiPoint": - coordinates = o.coordinates.map(point); - break; - case "LineString": - coordinates = line(o.arcs); - break; - case "MultiLineString": - coordinates = o.arcs.map(line); - break; - case "Polygon": - coordinates = polygon(o.arcs); - break; - case "MultiPolygon": - coordinates = o.arcs.map(polygon); - break; - default: - return null; - } - return { - type: type, - coordinates: coordinates - }; - } - return geometry(o); -} - -},{"./reverse.js":"7nB9v","./transform.js":"ToH0M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7nB9v":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(array, n) { - var t, j = array.length, i = j - n; - while(i < --j)t = array[i], array[i++] = array[j], array[j] = t; + }; + timeYear.range; + const utcYear = timeInterval$1((date2) => { + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step); + }, (start, end) => { + return end.getUTCFullYear() - start.getUTCFullYear(); + }, (date2) => { + return date2.getUTCFullYear(); + }); + utcYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k) * k); + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step * k); }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k2dDp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, meshArcs.apply(this, arguments)); + }; + utcYear.range; + function ticker(year, month, week2, day, hour, minute) { + const tickIntervals = [ + [second, 1, durationSecond$1], + [second, 5, 5 * durationSecond$1], + [second, 15, 15 * durationSecond$1], + [second, 30, 30 * durationSecond$1], + [minute, 1, durationMinute$1], + [minute, 5, 5 * durationMinute$1], + [minute, 15, 15 * durationMinute$1], + [minute, 30, 30 * durationMinute$1], + [hour, 1, durationHour$1], + [hour, 3, 3 * durationHour$1], + [hour, 6, 6 * durationHour$1], + [hour, 12, 12 * durationHour$1], + [day, 1, durationDay$1], + [day, 2, 2 * durationDay$1], + [week2, 1, durationWeek$1], + [month, 1, durationMonth$1], + [month, 3, 3 * durationMonth$1], + [year, 1, durationYear$1] + ]; + function ticks2(start, stop2, count2) { + const reverse2 = stop2 < start; + if (reverse2) [start, stop2] = [stop2, start]; + const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval(start, stop2, count2); + const ticks3 = interval2 ? interval2.range(start, +stop2 + 1) : []; + return reverse2 ? ticks3.reverse() : ticks3; + } + function tickInterval(start, stop2, count2) { + const target2 = Math.abs(stop2 - start) / count2; + const i = bisector(([, , step2]) => step2).right(tickIntervals, target2); + if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop2 / durationYear$1, count2)); + if (i === 0) return millisecond.every(Math.max(tickStep(start, stop2, count2), 1)); + const [t, step] = tickIntervals[target2 / tickIntervals[i - 1][2] < tickIntervals[i][2] / target2 ? i - 1 : i]; + return t.every(step); + } + return [ticks2, tickInterval]; + } + const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute); + const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute); + const YEAR = "year"; + const QUARTER = "quarter"; + const MONTH = "month"; + const WEEK = "week"; + const DATE = "date"; + const DAY = "day"; + const DAYOFYEAR = "dayofyear"; + const HOURS = "hours"; + const MINUTES = "minutes"; + const SECONDS = "seconds"; + const MILLISECONDS = "milliseconds"; + const TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS]; + const UNITS = TIME_UNITS.reduce((o, u2, i) => (o[u2] = 1 + i, o), {}); + function timeUnits(units) { + const u2 = array$5(units).slice(), m2 = {}; + if (!u2.length) error("Missing time unit."); + u2.forEach((unit2) => { + if (has$1(UNITS, unit2)) { + m2[unit2] = 1; + } else { + error(`Invalid time unit: ${unit2}.`); + } }); -parcelHelpers.export(exports, "meshArcs", ()=>meshArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter); - else for(i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i)arcs[i] = i; - return { - type: "MultiLineString", - arcs: (0, _stitchJsDefault.default)(topology, arcs) - }; -} -function extractArcs(topology, object, filter) { - var arcs = [], geomsByArc = [], geom; - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({ - i: i, - g: geom - }); - } - function extract1(arcs) { - arcs.forEach(extract0); + const numTypes = (m2[WEEK] || m2[DAY] ? 1 : 0) + (m2[QUARTER] || m2[MONTH] || m2[DATE] ? 1 : 0) + (m2[DAYOFYEAR] ? 1 : 0); + if (numTypes > 1) { + error(`Incompatible time units: ${units}`); } - function extract2(arcs) { - arcs.forEach(extract1); - } - function extract3(arcs) { - arcs.forEach(extract2); - } - function geometry(o) { - switch(geom = o, o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "LineString": - extract1(o.arcs); - break; - case "MultiLineString": - case "Polygon": - extract2(o.arcs); - break; - case "MultiPolygon": - extract3(o.arcs); - break; + u2.sort((a2, b2) => UNITS[a2] - UNITS[b2]); + return u2; + } + const defaultSpecifiers = { + [YEAR]: "%Y ", + [QUARTER]: "Q%q ", + [MONTH]: "%b ", + [DATE]: "%d ", + [WEEK]: "W%U ", + [DAY]: "%a ", + [DAYOFYEAR]: "%j ", + [HOURS]: "%H:00", + [MINUTES]: "00:%M", + [SECONDS]: ":%S", + [MILLISECONDS]: ".%L", + [`${YEAR}-${MONTH}`]: "%Y-%m ", + [`${YEAR}-${MONTH}-${DATE}`]: "%Y-%m-%d ", + [`${HOURS}-${MINUTES}`]: "%H:%M" + }; + function timeUnitSpecifier(units, specifiers) { + const s = extend$1({}, defaultSpecifiers, specifiers), u2 = timeUnits(units), n = u2.length; + let fmt = "", start = 0, end, key2; + for (start = 0; start < n; ) { + for (end = u2.length; end > start; --end) { + key2 = u2.slice(start, end).join("-"); + if (s[key2] != null) { + fmt += s[key2]; + start = end; + break; } + } } - geometry(object); - geomsByArc.forEach(filter == null ? function(geoms) { - arcs.push(geoms[0].i); - } : function(geoms) { - if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); - }); - return arcs; -} - -},{"./feature.js":"6K0pm","./stitch.js":"26mb3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"26mb3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, arcs) { - var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - }); - arcs.forEach(function(i) { - var e = ends(i), start = e[0], end = e[1], f, g; - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else { - f = [ - i - ]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [ - 0, - 0 - ], arc.forEach(function(dp) { - p1[0] += dp[0], p1[1] += dp[1]; - }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [ - p1, - p0 - ] : [ - p0, - p1 - ]; - } - function flush(fragmentByEnd, fragmentByStart) { - for(var k in fragmentByEnd){ - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { - stitchedArcs[i < 0 ? ~i : i] = 1; - }); - fragments.push(f); - } - } - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { - if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([ - i - ]); - }); - return fragments; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7l4hb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, mergeArcs.apply(this, arguments)); - }); -parcelHelpers.export(exports, "mergeArcs", ()=>mergeArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function planarRingArea(ring) { - var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; - while(++i < n)a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - return Math.abs(area); // Note: doubled area! -} -function mergeArcs(topology, objects) { - var polygonsByArc = {}, polygons = [], groups = []; - objects.forEach(geometry); - function geometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "Polygon": - extract(o.arcs); - break; - case "MultiPolygon": - o.arcs.forEach(extract); - break; - } + return fmt.trim(); + } + const t0$1 = /* @__PURE__ */ new Date(); + function localYear(y2) { + t0$1.setFullYear(y2); + t0$1.setMonth(0); + t0$1.setDate(1); + t0$1.setHours(0, 0, 0, 0); + return t0$1; + } + function dayofyear(d) { + return localDayOfYear(new Date(d)); + } + function week(d) { + return localWeekNum(new Date(d)); + } + function localDayOfYear(d) { + return timeDay.count(localYear(d.getFullYear()) - 1, d); + } + function localWeekNum(d) { + return timeSunday.count(localYear(d.getFullYear()) - 1, d); + } + function localFirst(y2) { + return localYear(y2).getDay(); + } + function localDate$1(y2, m2, d, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(-1, m2, d, H, M2, S, L); + date2.setFullYear(y2); + return date2; } - function extract(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); + return new Date(y2, m2, d, H, M2, S, L); + } + function utcdayofyear(d) { + return utcDayOfYear(new Date(d)); + } + function utcweek(d) { + return utcWeekNum(new Date(d)); + } + function utcDayOfYear(d) { + const y2 = Date.UTC(d.getUTCFullYear(), 0, 1); + return utcDay.count(y2 - 1, d); + } + function utcWeekNum(d) { + const y2 = Date.UTC(d.getUTCFullYear(), 0, 1); + return utcSunday.count(y2 - 1, d); + } + function utcFirst(y2) { + t0$1.setTime(Date.UTC(y2, 0, 1)); + return t0$1.getUTCDay(); + } + function utcDate$1(y2, m2, d, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(Date.UTC(-1, m2, d, H, M2, S, L)); + date2.setUTCFullYear(d.y); + return date2; } - function area(ring) { - return planarRingArea((0, _featureJs.object)(topology, { - type: "Polygon", - arcs: [ - ring - ] - }).coordinates[0]); - } - polygons.forEach(function(polygon) { - if (!polygon._) { - var group = [], neighbors = [ - polygon - ]; - polygon._ = 1; - groups.push(group); - while(polygon = neighbors.pop()){ - group.push(polygon); - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - polygons.forEach(function(polygon) { - delete polygon._; - }); - return { - type: "MultiPolygon", - arcs: groups.map(function(polygons) { - var arcs = [], n; - // Extract the exterior (unique) arcs. - polygons.forEach(function(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) arcs.push(arc); - }); - }); - }); - // Stitch the arcs into one or more rings. - arcs = (0, _stitchJsDefault.default)(topology, arcs); - // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - if ((n = arcs.length) > 1) { - for(var i = 1, k = area(arcs[0]), ki, t; i < n; ++i)if ((ki = area(arcs[i])) > k) t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - return arcs; - }).filter(function(arcs) { - return arcs.length > 0; - }) - }; -} - -},{"./feature.js":"6K0pm","./stitch.js":"26mb3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9d2MJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(objects) { - var indexesByArc = {}, neighbors = objects.map(function() { - return []; - }); - function line(arcs, i) { - arcs.forEach(function(a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i); - else indexesByArc[a] = [ - i - ]; - }); - } - function polygon(arcs, i) { - arcs.forEach(function(arc) { - line(arc, i); - }); - } - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { - geometry(o, i); - }); - else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs, i) { - arcs.forEach(function(arc) { - polygon(arc, i); - }); - } - }; - objects.forEach(geometry); - for(var i in indexesByArc){ - for(var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j)for(var k = j + 1; k < m; ++k){ - var ij = indexes[j], ik = indexes[k], n; - if ((n = neighbors[ij])[i = (0, _bisectJsDefault.default)(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = (0, _bisectJsDefault.default)(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - return neighbors; - }); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); - -},{"./bisect.js":"lbTH3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lbTH3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, x) { - var lo = 0, hi = a.length; - while(lo < hi){ - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kXipT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, transform) { - if (topology.transform) throw new Error("already quantized"); - if (!transform || !transform.scale) { - if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be \u22652"); - box = topology.bbox || (0, _bboxJsDefault.default)(topology); - var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n; - transform = { - scale: [ - x1 - x0 ? (x1 - x0) / (n - 1) : 1, - y1 - y0 ? (y1 - y0) / (n - 1) : 1 - ], - translate: [ - x0, - y0 - ] - }; - } else box = topology.bbox; - var t = (0, _untransformJsDefault.default)(transform), box, key, inputs = topology.objects, outputs = {}; - function quantizePoint(point) { - return t(point); - } - function quantizeGeometry(input) { - var output; - switch(input.type){ - case "GeometryCollection": - output = { - type: "GeometryCollection", - geometries: input.geometries.map(quantizeGeometry) - }; - break; - case "Point": - output = { - type: "Point", - coordinates: quantizePoint(input.coordinates) - }; - break; - case "MultiPoint": - output = { - type: "MultiPoint", - coordinates: input.coordinates.map(quantizePoint) - }; - break; - default: - return input; - } - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; - } - function quantizeArc(input) { - var i = 0, j = 1, n = input.length, p, output = new Array(n); // pessimistic - output[0] = t(input[0], 0); - while(++i < n)if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; // non-coincident points - if (j === 1) output[j++] = [ - 0, - 0 - ]; // an arc must have at least two points - output.length = j; - return output; - } - for(key in inputs)outputs[key] = quantizeGeometry(inputs[key]); - return { - type: "Topology", - bbox: box, - transform: transform, - objects: outputs, - arcs: topology.arcs.map(quantizeArc) - }; - }); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"e3LWp","./untransform.js":"6T4yq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6T4yq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky); - output[0] = x1 - x0, x0 = x1; - output[1] = y1 - y0, y0 = y1; - while(j < n)output[j] = input[j], ++j; - return output; - }; - }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"dZ2Lk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"47kOt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultLocale", ()=>defaultLocale); -parcelHelpers.export(exports, "locale", ()=>locale); -parcelHelpers.export(exports, "numberFormatDefaultLocale", ()=>numberFormatDefaultLocale); -parcelHelpers.export(exports, "numberFormatLocale", ()=>numberFormatLocale); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>resetDefaultLocale); -parcelHelpers.export(exports, "resetNumberFormatDefaultLocale", ()=>resetNumberFormatDefaultLocale); -parcelHelpers.export(exports, "resetTimeFormatDefaultLocale", ()=>resetTimeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>timeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatLocale", ()=>timeFormatLocale); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _vegaTime = require("vega-time"); -var _vegaUtil = require("vega-util"); -var _d3TimeFormat = require("d3-time-format"); -function memoize(method) { - const cache = {}; - return (spec)=>cache[spec] || (cache[spec] = method(spec)); -} -function trimZeroes(numberFormat, decimalChar) { - return (x)=>{ - const str = numberFormat(x), dec = str.indexOf(decimalChar); - if (dec < 0) return str; - let idx = rightmostDigit(str, dec); - const end = idx < str.length ? str.slice(idx) : ''; - while(--idx > dec)if (str[idx] !== '0') { - ++idx; - break; - } - return str.slice(0, idx) + end; + return new Date(Date.UTC(y2, m2, d, H, M2, S, L)); + } + function floor(units, step, get2, inv, newDate2) { + const s = step || 1, b2 = peek$1(units), _ = (unit2, p, key2) => { + key2 = key2 || unit2; + return getUnit(get2[key2], inv[key2], unit2 === b2 && s, p); }; -} -function rightmostDigit(str, dec) { - let i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for(i = str.length; --i > dec;){ - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit + const t = /* @__PURE__ */ new Date(), u2 = toSet(units), y2 = u2[YEAR] ? _(YEAR) : constant$5(2012), m2 = u2[MONTH] ? _(MONTH) : u2[QUARTER] ? _(QUARTER) : zero$3, d = u2[WEEK] && u2[DAY] ? _(DAY, 1, WEEK + DAY) : u2[WEEK] ? _(WEEK, 1) : u2[DAY] ? _(DAY, 1) : u2[DATE] ? _(DATE, 1) : u2[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one$2, H = u2[HOURS] ? _(HOURS) : zero$3, M2 = u2[MINUTES] ? _(MINUTES) : zero$3, S = u2[SECONDS] ? _(SECONDS) : zero$3, L = u2[MILLISECONDS] ? _(MILLISECONDS) : zero$3; + return function(v) { + t.setTime(+v); + const year = y2(t); + return newDate2(year, m2(t), d(t, year), H(t), M2(t), S(t), L(t)); + }; + } + function getUnit(f, inv, step, phase) { + const u2 = step <= 1 ? f : phase ? (d, y2) => phase + step * Math.floor((f(d, y2) - phase) / step) : (d, y2) => step * Math.floor(f(d, y2) / step); + return inv ? (d, y2) => inv(u2(d, y2), y2) : u2; + } + function weekday(week2, day, firstDay) { + return day + week2 * 7 - (firstDay + 6) % 7; + } + const localGet = { + [YEAR]: (d) => d.getFullYear(), + [QUARTER]: (d) => Math.floor(d.getMonth() / 3), + [MONTH]: (d) => d.getMonth(), + [DATE]: (d) => d.getDate(), + [HOURS]: (d) => d.getHours(), + [MINUTES]: (d) => d.getMinutes(), + [SECONDS]: (d) => d.getSeconds(), + [MILLISECONDS]: (d) => d.getMilliseconds(), + [DAYOFYEAR]: (d) => localDayOfYear(d), + [WEEK]: (d) => localWeekNum(d), + [WEEK + DAY]: (d, y2) => weekday(localWeekNum(d), d.getDay(), localFirst(y2)), + [DAY]: (d, y2) => weekday(1, d.getDay(), localFirst(y2)) + }; + const localInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, localFirst(y2)) + }; + function timeFloor(units, step) { + return floor(units, step || 1, localGet, localInv, localDate$1); + } + const utcGet = { + [YEAR]: (d) => d.getUTCFullYear(), + [QUARTER]: (d) => Math.floor(d.getUTCMonth() / 3), + [MONTH]: (d) => d.getUTCMonth(), + [DATE]: (d) => d.getUTCDate(), + [HOURS]: (d) => d.getUTCHours(), + [MINUTES]: (d) => d.getUTCMinutes(), + [SECONDS]: (d) => d.getUTCSeconds(), + [MILLISECONDS]: (d) => d.getUTCMilliseconds(), + [DAYOFYEAR]: (d) => utcDayOfYear(d), + [WEEK]: (d) => utcWeekNum(d), + [DAY]: (d, y2) => weekday(1, d.getUTCDay(), utcFirst(y2)), + [WEEK + DAY]: (d, y2) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y2)) + }; + const utcInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, utcFirst(y2)) + }; + function utcFloor(units, step) { + return floor(units, step || 1, utcGet, utcInv, utcDate$1); + } + const timeIntervals = { + [YEAR]: timeYear, + [QUARTER]: timeMonth.every(3), + [MONTH]: timeMonth, + [WEEK]: timeSunday, + [DATE]: timeDay, + [DAY]: timeDay, + [DAYOFYEAR]: timeDay, + [HOURS]: timeHour, + [MINUTES]: timeMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + const utcIntervals = { + [YEAR]: utcYear, + [QUARTER]: utcMonth.every(3), + [MONTH]: utcMonth, + [WEEK]: utcSunday, + [DATE]: utcDay, + [DAY]: utcDay, + [DAYOFYEAR]: utcDay, + [HOURS]: utcHour, + [MINUTES]: utcMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + function timeInterval(unit2) { + return timeIntervals[unit2]; + } + function utcInterval(unit2) { + return utcIntervals[unit2]; + } + function offset$3(ival, date2, step) { + return ival ? ival.offset(date2, step) : void 0; + } + function timeOffset(unit2, date2, step) { + return offset$3(timeInterval(unit2), date2, step); + } + function utcOffset(unit2, date2, step) { + return offset$3(utcInterval(unit2), date2, step); + } + function sequence$1(ival, start, stop2, step) { + return ival ? ival.range(start, stop2, step) : void 0; + } + function timeSequence(unit2, start, stop2, step) { + return sequence$1(timeInterval(unit2), start, stop2, step); + } + function utcSequence(unit2, start, stop2, step) { + return sequence$1(utcInterval(unit2), start, stop2, step); + } + const durationSecond = 1e3, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; + const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [YEAR, WEEK], Month = [YEAR, MONTH], Year = [YEAR]; + const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]]; + function bin$1(opt) { + const ext = opt.extent, max2 = opt.maxbins || 40, target2 = Math.abs(span(ext)) / max2; + let i = bisector((i2) => i2[2]).right(intervals, target2), units, step; + if (i === intervals.length) { + units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max2); + } else if (i) { + i = intervals[target2 / intervals[i - 1][2] < intervals[i][2] / target2 ? i - 1 : i]; + units = i[0]; + step = i[1]; + } else { + units = Milli; + step = Math.max(tickStep(ext[0], ext[1], max2), 1); } -} -function numberLocale(locale) { - const format = memoize(locale.format), formatPrefix = locale.formatPrefix; return { - format, - formatPrefix, - formatFloat (spec) { - const s = (0, _d3Format.formatSpecifier)(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch(s.type){ - case '%': - s.precision -= 2; - break; - case 'e': - s.precision -= 1; - break; - } - return trimZeroes(format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else return format(s); - }, - formatSpan (start, stop, count, specifier) { - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ',f' : specifier); - const step = (0, _d3Array.tickStep)(start, stop, count), value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - if (specifier.precision == null) switch(specifier.type){ - case 's': - if (!isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - case '': - case 'e': - case 'g': - case 'p': - case 'r': - if (!isNaN(precision = (0, _d3Format.precisionRound)(step, value))) specifier.precision = precision - (specifier.type === 'e'); - break; - case 'f': - case '%': - if (!isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === '%') * 2; - break; - } - return format(specifier); - } + units, + step }; -} -let defaultNumberLocale; -resetNumberFormatDefaultLocale(); -function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: (0, _d3Format.format), - formatPrefix: (0, _d3Format.formatPrefix) - }); -} -function numberFormatLocale(definition) { - return numberLocale((0, _d3Format.formatLocale)(definition)); -} -function numberFormatDefaultLocale(definition) { - return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale; -} -function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)(`Invalid time multi-format specifier: ${spec}`); - const second = interval((0, _vegaTime.SECONDS)), minute = interval((0, _vegaTime.MINUTES)), hour = interval((0, _vegaTime.HOURS)), day = interval((0, _vegaTime.DATE)), week = interval((0, _vegaTime.WEEK)), month = interval((0, _vegaTime.MONTH)), quarter = interval((0, _vegaTime.QUARTER)), year = interval((0, _vegaTime.YEAR)), L = format(spec[0, _vegaTime.MILLISECONDS] || '.%L'), S = format(spec[0, _vegaTime.SECONDS] || ':%S'), M = format(spec[0, _vegaTime.MINUTES] || '%I:%M'), H = format(spec[0, _vegaTime.HOURS] || '%I %p'), d = format(spec[0, _vegaTime.DATE] || spec[0, _vegaTime.DAY] || '%a %d'), w = format(spec[0, _vegaTime.WEEK] || '%b %d'), m = format(spec[0, _vegaTime.MONTH] || '%B'), q = format(spec[0, _vegaTime.QUARTER] || '%B'), y = format(spec[0, _vegaTime.YEAR] || '%Y'); - return (date)=>(second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date); -} -function timeLocale(locale) { - const timeFormat = memoize(locale.format), utcFormat = memoize(locale.utcFormat); - return { - timeFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? timeFormat(spec) : timeMultiFormat(timeFormat, (0, _vegaTime.timeInterval), spec), - utcFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? utcFormat(spec) : timeMultiFormat(utcFormat, (0, _vegaTime.utcInterval), spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; -} -let defaultTimeLocale; -resetTimeFormatDefaultLocale(); -function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: (0, _d3TimeFormat.timeFormat), - parse: (0, _d3TimeFormat.timeParse), - utcFormat: (0, _d3TimeFormat.utcFormat), - utcParse: (0, _d3TimeFormat.utcParse) - }); -} -function timeFormatLocale(definition) { - return timeLocale((0, _d3TimeFormat.timeFormatLocale)(definition)); -} -function timeFormatDefaultLocale(definition) { - return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale; -} -const createLocale = (number, time)=>(0, _vegaUtil.extend)({}, number, time); -function locale(numberSpec, timeSpec) { - const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); - const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); - return createLocale(number, time); -} -function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) (0, _vegaUtil.error)('defaultLocale expects either zero or two arguments.'); - return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); -} -function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); -} - -},{"d3-array":"6IwJG","d3-format":"8dYFL","vega-time":"27kpp","vega-util":"bApja","d3-time-format":"242jH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6IwJG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisect", ()=>(0, _bisectJsDefault.default)); -parcelHelpers.export(exports, "bisectRight", ()=>(0, _bisectJs.bisectRight)); -parcelHelpers.export(exports, "bisectLeft", ()=>(0, _bisectJs.bisectLeft)); -parcelHelpers.export(exports, "bisectCenter", ()=>(0, _bisectJs.bisectCenter)); -parcelHelpers.export(exports, "ascending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "bisector", ()=>(0, _bisectorJsDefault.default)); -parcelHelpers.export(exports, "blur", ()=>(0, _blurJs.blur)); -parcelHelpers.export(exports, "blur2", ()=>(0, _blurJs.blur2)); -parcelHelpers.export(exports, "blurImage", ()=>(0, _blurJs.blurImage)); -parcelHelpers.export(exports, "count", ()=>(0, _countJsDefault.default)); -parcelHelpers.export(exports, "cross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "cumsum", ()=>(0, _cumsumJsDefault.default)); -parcelHelpers.export(exports, "descending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "deviation", ()=>(0, _deviationJsDefault.default)); -parcelHelpers.export(exports, "extent", ()=>(0, _extentJsDefault.default)); -parcelHelpers.export(exports, "Adder", ()=>(0, _fsumJs.Adder)); -parcelHelpers.export(exports, "fsum", ()=>(0, _fsumJs.fsum)); -parcelHelpers.export(exports, "fcumsum", ()=>(0, _fsumJs.fcumsum)); -parcelHelpers.export(exports, "group", ()=>(0, _groupJsDefault.default)); -parcelHelpers.export(exports, "flatGroup", ()=>(0, _groupJs.flatGroup)); -parcelHelpers.export(exports, "flatRollup", ()=>(0, _groupJs.flatRollup)); -parcelHelpers.export(exports, "groups", ()=>(0, _groupJs.groups)); -parcelHelpers.export(exports, "index", ()=>(0, _groupJs.index)); -parcelHelpers.export(exports, "indexes", ()=>(0, _groupJs.indexes)); -parcelHelpers.export(exports, "rollup", ()=>(0, _groupJs.rollup)); -parcelHelpers.export(exports, "rollups", ()=>(0, _groupJs.rollups)); -parcelHelpers.export(exports, "groupSort", ()=>(0, _groupSortJsDefault.default)); -parcelHelpers.export(exports, "bin", ()=>(0, _binJsDefault.default)) // Deprecated; use bin. -; -parcelHelpers.export(exports, "histogram", ()=>(0, _binJsDefault.default)); -parcelHelpers.export(exports, "thresholdFreedmanDiaconis", ()=>(0, _freedmanDiaconisJsDefault.default)); -parcelHelpers.export(exports, "thresholdScott", ()=>(0, _scottJsDefault.default)); -parcelHelpers.export(exports, "thresholdSturges", ()=>(0, _sturgesJsDefault.default)); -parcelHelpers.export(exports, "max", ()=>(0, _maxJsDefault.default)); -parcelHelpers.export(exports, "maxIndex", ()=>(0, _maxIndexJsDefault.default)); -parcelHelpers.export(exports, "mean", ()=>(0, _meanJsDefault.default)); -parcelHelpers.export(exports, "median", ()=>(0, _medianJsDefault.default)); -parcelHelpers.export(exports, "medianIndex", ()=>(0, _medianJs.medianIndex)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "min", ()=>(0, _minJsDefault.default)); -parcelHelpers.export(exports, "minIndex", ()=>(0, _minIndexJsDefault.default)); -parcelHelpers.export(exports, "mode", ()=>(0, _modeJsDefault.default)); -parcelHelpers.export(exports, "nice", ()=>(0, _niceJsDefault.default)); -parcelHelpers.export(exports, "pairs", ()=>(0, _pairsJsDefault.default)); -parcelHelpers.export(exports, "permute", ()=>(0, _permuteJsDefault.default)); -parcelHelpers.export(exports, "quantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "quantileIndex", ()=>(0, _quantileJs.quantileIndex)); -parcelHelpers.export(exports, "quantileSorted", ()=>(0, _quantileJs.quantileSorted)); -parcelHelpers.export(exports, "quickselect", ()=>(0, _quickselectJsDefault.default)); -parcelHelpers.export(exports, "range", ()=>(0, _rangeJsDefault.default)); -parcelHelpers.export(exports, "rank", ()=>(0, _rankJsDefault.default)); -parcelHelpers.export(exports, "least", ()=>(0, _leastJsDefault.default)); -parcelHelpers.export(exports, "leastIndex", ()=>(0, _leastIndexJsDefault.default)); -parcelHelpers.export(exports, "greatest", ()=>(0, _greatestJsDefault.default)); -parcelHelpers.export(exports, "greatestIndex", ()=>(0, _greatestIndexJsDefault.default)); -parcelHelpers.export(exports, "scan", ()=>(0, _scanJsDefault.default)) // Deprecated; use leastIndex. -; -parcelHelpers.export(exports, "shuffle", ()=>(0, _shuffleJsDefault.default)); -parcelHelpers.export(exports, "shuffler", ()=>(0, _shuffleJs.shuffler)); -parcelHelpers.export(exports, "sum", ()=>(0, _sumJsDefault.default)); -parcelHelpers.export(exports, "ticks", ()=>(0, _ticksJsDefault.default)); -parcelHelpers.export(exports, "tickIncrement", ()=>(0, _ticksJs.tickIncrement)); -parcelHelpers.export(exports, "tickStep", ()=>(0, _ticksJs.tickStep)); -parcelHelpers.export(exports, "transpose", ()=>(0, _transposeJsDefault.default)); -parcelHelpers.export(exports, "variance", ()=>(0, _varianceJsDefault.default)); -parcelHelpers.export(exports, "zip", ()=>(0, _zipJsDefault.default)); -parcelHelpers.export(exports, "every", ()=>(0, _everyJsDefault.default)); -parcelHelpers.export(exports, "some", ()=>(0, _someJsDefault.default)); -parcelHelpers.export(exports, "filter", ()=>(0, _filterJsDefault.default)); -parcelHelpers.export(exports, "map", ()=>(0, _mapJsDefault.default)); -parcelHelpers.export(exports, "reduce", ()=>(0, _reduceJsDefault.default)); -parcelHelpers.export(exports, "reverse", ()=>(0, _reverseJsDefault.default)); -parcelHelpers.export(exports, "sort", ()=>(0, _sortJsDefault.default)); -parcelHelpers.export(exports, "difference", ()=>(0, _differenceJsDefault.default)); -parcelHelpers.export(exports, "disjoint", ()=>(0, _disjointJsDefault.default)); -parcelHelpers.export(exports, "intersection", ()=>(0, _intersectionJsDefault.default)); -parcelHelpers.export(exports, "subset", ()=>(0, _subsetJsDefault.default)); -parcelHelpers.export(exports, "superset", ()=>(0, _supersetJsDefault.default)); -parcelHelpers.export(exports, "union", ()=>(0, _unionJsDefault.default)); -parcelHelpers.export(exports, "InternMap", ()=>(0, _internmap.InternMap)); -parcelHelpers.export(exports, "InternSet", ()=>(0, _internmap.InternSet)); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _blurJs = require("./blur.js"); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _crossJs = require("./cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _cumsumJs = require("./cumsum.js"); -var _cumsumJsDefault = parcelHelpers.interopDefault(_cumsumJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _deviationJs = require("./deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _fsumJs = require("./fsum.js"); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _groupSortJs = require("./groupSort.js"); -var _groupSortJsDefault = parcelHelpers.interopDefault(_groupSortJs); -var _binJs = require("./bin.js"); -var _binJsDefault = parcelHelpers.interopDefault(_binJs); -var _freedmanDiaconisJs = require("./threshold/freedmanDiaconis.js"); -var _freedmanDiaconisJsDefault = parcelHelpers.interopDefault(_freedmanDiaconisJs); -var _scottJs = require("./threshold/scott.js"); -var _scottJsDefault = parcelHelpers.interopDefault(_scottJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _meanJs = require("./mean.js"); -var _meanJsDefault = parcelHelpers.interopDefault(_meanJs); -var _medianJs = require("./median.js"); -var _medianJsDefault = parcelHelpers.interopDefault(_medianJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _modeJs = require("./mode.js"); -var _modeJsDefault = parcelHelpers.interopDefault(_modeJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _pairsJs = require("./pairs.js"); -var _pairsJsDefault = parcelHelpers.interopDefault(_pairsJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _rangeJs = require("./range.js"); -var _rangeJsDefault = parcelHelpers.interopDefault(_rangeJs); -var _rankJs = require("./rank.js"); -var _rankJsDefault = parcelHelpers.interopDefault(_rankJs); -var _leastJs = require("./least.js"); -var _leastJsDefault = parcelHelpers.interopDefault(_leastJs); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -var _greatestIndexJs = require("./greatestIndex.js"); -var _greatestIndexJsDefault = parcelHelpers.interopDefault(_greatestIndexJs); -var _scanJs = require("./scan.js"); -var _scanJsDefault = parcelHelpers.interopDefault(_scanJs); -var _shuffleJs = require("./shuffle.js"); -var _shuffleJsDefault = parcelHelpers.interopDefault(_shuffleJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -var _zipJs = require("./zip.js"); -var _zipJsDefault = parcelHelpers.interopDefault(_zipJs); -var _everyJs = require("./every.js"); -var _everyJsDefault = parcelHelpers.interopDefault(_everyJs); -var _someJs = require("./some.js"); -var _someJsDefault = parcelHelpers.interopDefault(_someJs); -var _filterJs = require("./filter.js"); -var _filterJsDefault = parcelHelpers.interopDefault(_filterJs); -var _mapJs = require("./map.js"); -var _mapJsDefault = parcelHelpers.interopDefault(_mapJs); -var _reduceJs = require("./reduce.js"); -var _reduceJsDefault = parcelHelpers.interopDefault(_reduceJs); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _differenceJs = require("./difference.js"); -var _differenceJsDefault = parcelHelpers.interopDefault(_differenceJs); -var _disjointJs = require("./disjoint.js"); -var _disjointJsDefault = parcelHelpers.interopDefault(_disjointJs); -var _intersectionJs = require("./intersection.js"); -var _intersectionJsDefault = parcelHelpers.interopDefault(_intersectionJs); -var _subsetJs = require("./subset.js"); -var _subsetJsDefault = parcelHelpers.interopDefault(_subsetJs); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -var _unionJs = require("./union.js"); -var _unionJsDefault = parcelHelpers.interopDefault(_unionJs); -var _internmap = require("internmap"); - -},{"./bisect.js":"iJojn","./ascending.js":"60o1Z","./bisector.js":"k5JwJ","./blur.js":"dJz57","./count.js":"hAOxG","./cross.js":"5Mx0K","./cumsum.js":"izk5G","./descending.js":"kIC2x","./deviation.js":"euifj","./extent.js":"2l7Ul","./fsum.js":"g7Aa0","./group.js":"gDEW5","./groupSort.js":"6XFT5","./bin.js":"k5qBC","./threshold/freedmanDiaconis.js":"7zq9L","./threshold/scott.js":"84aHL","./threshold/sturges.js":"20cg0","./max.js":"5fCPh","./maxIndex.js":"fm7WL","./mean.js":"8HbAa","./median.js":"ai1Kc","./merge.js":"d56l7","./min.js":"h0RAg","./minIndex.js":"3rpRW","./mode.js":"0gW2M","./nice.js":"lCn8Q","./pairs.js":"jCTEB","./permute.js":"3ydIg","./quantile.js":"49cDh","./quickselect.js":"doA4Q","./range.js":"7QVPN","./rank.js":"7wNFQ","./least.js":"blduW","./leastIndex.js":"9lwr3","./greatest.js":"c4GrS","./greatestIndex.js":"9hgwE","./scan.js":"6EUfu","./shuffle.js":"gPIAO","./sum.js":"hdZOC","./ticks.js":"71MAh","./transpose.js":"iwW5c","./variance.js":"gba1Y","./zip.js":"jZBBF","./every.js":"38T8N","./some.js":"8z051","./filter.js":"lgrhD","./map.js":"dbY4R","./reduce.js":"1uy4z","./reverse.js":"8g01M","./sort.js":"bV3FZ","./difference.js":"bwetK","./disjoint.js":"ilJ5C","./intersection.js":"gohoZ","./subset.js":"f9sTm","./superset.js":"9my10","./union.js":"66hcN","internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iJojn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisectRight", ()=>bisectRight); -parcelHelpers.export(exports, "bisectLeft", ()=>bisectLeft); -parcelHelpers.export(exports, "bisectCenter", ()=>bisectCenter); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -const ascendingBisect = (0, _bisectorJsDefault.default)((0, _ascendingJsDefault.default)); -const bisectRight = ascendingBisect.right; -const bisectLeft = ascendingBisect.left; -const bisectCenter = (0, _bisectorJsDefault.default)((0, _numberJsDefault.default)).center; -exports.default = bisectRight; - -},{"./ascending.js":"60o1Z","./bisector.js":"k5JwJ","./number.js":"gcMRK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60o1Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ascending); -function ascending(a, b) { - return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k5JwJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bisector); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -function bisector(f) { - let compare1, compare2, delta; - // If an accessor is specified, promote it to a comparator. In this case we - // can test whether the search value is (self-) comparable. We can’t do this - // for a comparator (except for specific, known comparators) because we can’t - // tell if the comparator is symmetric, and an asymmetric comparator can’t be - // used to test whether a single value is comparable. - if (f.length !== 2) { - compare1 = (0, _ascendingJsDefault.default); - compare2 = (d, x)=>(0, _ascendingJsDefault.default)(f(d), x); - delta = (d, x)=>f(d) - x; - } else { - compare1 = f === (0, _ascendingJsDefault.default) || f === (0, _descendingJsDefault.default) ? f : zero; - compare2 = f; - delta = f; + } + function localDate(d) { + if (0 <= d.y && d.y < 100) { + var date2 = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); + date2.setFullYear(d.y); + return date2; } - function left(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) < 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); - } - return lo; + return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); + } + function utcDate(d) { + if (0 <= d.y && d.y < 100) { + var date2 = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); + date2.setUTCFullYear(d.y); + return date2; } - function right(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) <= 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); + return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); + } + function newDate(y2, m2, d) { + return { y: y2, m: m2, d, H: 0, M: 0, S: 0, L: 0 }; + } + function formatLocale(locale2) { + var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths; + var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); + var formats2 = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "f": formatMicroseconds, + "g": formatYearISO, + "G": formatFullYearISO, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "q": formatQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatSeconds, + "u": formatWeekdayNumberMonday, + "U": formatWeekNumberSunday, + "V": formatWeekNumberISO, + "w": formatWeekdayNumberSunday, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "f": formatUTCMicroseconds, + "g": formatUTCYearISO, + "G": formatUTCFullYearISO, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "q": formatUTCQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatUTCSeconds, + "u": formatUTCWeekdayNumberMonday, + "U": formatUTCWeekNumberSunday, + "V": formatUTCWeekNumberISO, + "w": formatUTCWeekdayNumberSunday, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "f": parseMicroseconds, + "g": parseYear, + "G": parseFullYear, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "q": parseQuarter, + "Q": parseUnixTimestamp, + "s": parseUnixTimestampSeconds, + "S": parseSeconds, + "u": parseWeekdayNumberMonday, + "U": parseWeekNumberSunday, + "V": parseWeekNumberISO, + "w": parseWeekdayNumberSunday, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + formats2.x = newFormat(locale_date, formats2); + formats2.X = newFormat(locale_time, formats2); + formats2.c = newFormat(locale_dateTime, formats2); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + function newFormat(specifier, formats3) { + return function(date2) { + var string2 = [], i = -1, j = 0, n = specifier.length, c2, pad2, format2; + if (!(date2 instanceof Date)) date2 = /* @__PURE__ */ new Date(+date2); + while (++i < n) { + if (specifier.charCodeAt(i) === 37) { + string2.push(specifier.slice(j, i)); + if ((pad2 = pads[c2 = specifier.charAt(++i)]) != null) c2 = specifier.charAt(++i); + else pad2 = c2 === "e" ? " " : "0"; + if (format2 = formats3[c2]) c2 = format2(date2, pad2); + string2.push(c2); + j = i + 1; + } + } + string2.push(specifier.slice(j, i)); + return string2.join(""); + }; + } + function newParse(specifier, Z) { + return function(string2) { + var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string2 += "", 0), week2, day; + if (i != string2.length) return null; + if ("Q" in d) return new Date(d.Q); + if ("s" in d) return new Date(d.s * 1e3 + ("L" in d ? d.L : 0)); + if (Z && !("Z" in d)) d.Z = 0; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + if (d.m === void 0) d.m = "q" in d ? d.q : 0; + if ("V" in d) { + if (d.V < 1 || d.V > 53) return null; + if (!("w" in d)) d.w = 1; + if ("Z" in d) { + week2 = utcDate(newDate(d.y, 0, 1)), day = week2.getUTCDay(); + week2 = day > 4 || day === 0 ? utcMonday.ceil(week2) : utcMonday(week2); + week2 = utcDay.offset(week2, (d.V - 1) * 7); + d.y = week2.getUTCFullYear(); + d.m = week2.getUTCMonth(); + d.d = week2.getUTCDate() + (d.w + 6) % 7; + } else { + week2 = localDate(newDate(d.y, 0, 1)), day = week2.getDay(); + week2 = day > 4 || day === 0 ? timeMonday.ceil(week2) : timeMonday(week2); + week2 = timeDay.offset(week2, (d.V - 1) * 7); + d.y = week2.getFullYear(); + d.m = week2.getMonth(); + d.d = week2.getDate() + (d.w + 6) % 7; + } + } else if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; + day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); + d.m = 0; + d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; + } + if ("Z" in d) { + d.H += d.Z / 100 | 0; + d.M += d.Z % 100; + return utcDate(d); + } + return localDate(d); + }; + } + function parseSpecifier(d, specifier, string2, j) { + var i = 0, n = specifier.length, m2 = string2.length, c2, parse2; + while (i < n) { + if (j >= m2) return -1; + c2 = specifier.charCodeAt(i++); + if (c2 === 37) { + c2 = specifier.charAt(i++); + parse2 = parses[c2 in pads ? specifier.charAt(i++) : c2]; + if (!parse2 || (j = parse2(d, string2, j)) < 0) return -1; + } else if (c2 != string2.charCodeAt(j++)) { + return -1; } - return lo; + } + return j; } - function center(a, x, lo = 0, hi = a.length) { - const i = left(a, x, lo, hi - 1); - return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; + function parsePeriod(d, string2, i) { + var n = periodRe.exec(string2.slice(i)); + return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - return { - left, - center, - right - }; -} -function zero() { - return 0; -} - -},{"./ascending.js":"60o1Z","./descending.js":"kIC2x","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kIC2x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>descending); -function descending(a, b) { - return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gcMRK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -parcelHelpers.export(exports, "numbers", ()=>numbers); -function number(x) { - return x === null ? NaN : +x; -} -function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) yield value; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dJz57":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "blur", ()=>blur); -parcelHelpers.export(exports, "blur2", ()=>blur2); -parcelHelpers.export(exports, "blurImage", ()=>blurImage); -function blur(values, r) { - if (!((r = +r) >= 0)) throw new RangeError("invalid r"); - let length = values.length; - if (!((length = Math.floor(length)) >= 0)) throw new RangeError("invalid length"); - if (!length || !r) return values; - const blur = blurf(r); - const temp = values.slice(); - blur(values, temp, 0, length, 1); - blur(temp, values, 0, length, 1); - blur(values, temp, 0, length, 1); - return values; -} -const blur2 = Blur2(blurf); -const blurImage = Blur2(blurfImage); -function Blur2(blur) { - return function(data, rx, ry = rx) { - if (!((rx = +rx) >= 0)) throw new RangeError("invalid rx"); - if (!((ry = +ry) >= 0)) throw new RangeError("invalid ry"); - let { data: values, width, height } = data; - if (!((width = Math.floor(width)) >= 0)) throw new RangeError("invalid width"); - if (!((height = Math.floor(height !== undefined ? height : values.length / width)) >= 0)) throw new RangeError("invalid height"); - if (!width || !height || !rx && !ry) return data; - const blurx = rx && blur(rx); - const blury = ry && blur(ry); - const temp = values.slice(); - if (blurx && blury) { - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } else if (blurx) { - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - } else if (blury) { - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } - return data; - }; -} -function blurh(blur, T, S, w, h) { - for(let y = 0, n = w * h; y < n;)blur(T, S, y, y += w, 1); -} -function blurv(blur, T, S, w, h) { - for(let x = 0, n = w * h; x < w; ++x)blur(T, S, x, x + n, w); -} -function blurfImage(radius) { - const blur = blurf(radius); - return (T, S, start, stop, step)=>{ - start <<= 2, stop <<= 2, step <<= 2; - blur(T, S, start + 0, stop + 0, step); - blur(T, S, start + 1, stop + 1, step); - blur(T, S, start + 2, stop + 2, step); - blur(T, S, start + 3, stop + 3, step); - }; -} -// Given a target array T, a source array S, sets each value T[i] to the average -// of {S[i - r], …, S[i], …, S[i + r]}, where r = ⌊radius⌋, start <= i < stop, -// for each i, i + step, i + 2 * step, etc., and where S[j] is clamped between -// S[start] (inclusive) and S[stop] (exclusive). If the given radius is not an -// integer, S[i - r - 1] and S[i + r + 1] are added to the sum, each weighted -// according to r - ⌊radius⌋. -function blurf(radius) { - const radius0 = Math.floor(radius); - if (radius0 === radius) return bluri(radius); - const t = radius - radius0; - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius0 * S[start]; - const s0 = step * radius0; - const s1 = s0 + step; - for(let i = start, j = start + s0; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s0)]; - T[i] = (sum + t * (S[Math.max(start, i - s1)] + S[Math.min(stop, i + s1)])) / w; - sum -= S[Math.max(start, i - s0)]; - } - }; -} -// Like blurf, but optimized for integer radius. -function bluri(radius) { - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius * S[start]; - const s = step * radius; - for(let i = start, j = start + s; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s)]; - T[i] = sum / w; - sum -= S[Math.max(start, i - s)]; - } - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hAOxG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>count); -function count(values, valueof) { - let count = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count; - } - return count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Mx0K":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cross); -function length(array) { - return array.length | 0; -} -function empty(length) { - return !(length > 0); -} -function arrayify(values) { - return typeof values !== "object" || "length" in values ? values : Array.from(values); -} -function reducer(reduce) { - return (values)=>reduce(...values); -} -function cross(...values) { - const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop()); - values = values.map(arrayify); - const lengths = values.map(length); - const j = values.length - 1; - const index = new Array(j + 1).fill(0); - const product = []; - if (j < 0 || lengths.some(empty)) return product; - while(true){ - product.push(index.map((j, i)=>values[i][j])); - let i = j; - while(++index[i] === lengths[i]){ - if (i === 0) return reduce ? product.map(reduce) : product; - index[i--] = 0; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"izk5G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cumsum); -function cumsum(values, valueof) { - var sum = 0, index = 0; - return Float64Array.from(values, valueof === undefined ? (v)=>sum += +v || 0 : (v)=>sum += +valueof(v, index++, values) || 0); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"euifj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>deviation); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -function deviation(values, valueof) { - const v = (0, _varianceJsDefault.default)(values, valueof); - return v ? Math.sqrt(v) : v; -} - -},{"./variance.js":"gba1Y","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gba1Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>variance); -function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - if (count > 1) return sum / (count - 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2l7Ul":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>extent); -function extent(values, valueof) { - let min; - let max; - if (valueof === undefined) { - for (const value of values)if (value != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } + function parseShortWeekday(d, string2, i) { + var n = shortWeekdayRe.exec(string2.slice(i)); + return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - return [ - min, - max - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g7Aa0":[function(require,module,exports,__globalThis) { -// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423 -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Adder", ()=>Adder); -parcelHelpers.export(exports, "fsum", ()=>fsum); -parcelHelpers.export(exports, "fcumsum", ()=>fcumsum); -class Adder { - constructor(){ - this._partials = new Float64Array(32); - this._n = 0; - } - add(x) { - const p = this._partials; - let i = 0; - for(let j = 0; j < this._n && j < 32; j++){ - const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); - if (lo) p[i++] = lo; - x = hi; - } - p[i] = x; - this._n = i + 1; - return this; + function parseWeekday(d, string2, i) { + var n = weekdayRe.exec(string2.slice(i)); + return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - valueOf() { - const p = this._partials; - let n = this._n, x, y, lo, hi = 0; - if (n > 0) { - hi = p[--n]; - while(n > 0){ - x = hi; - y = p[--n]; - hi = x + y; - lo = y - (hi - x); - if (lo) break; - } - if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { - y = lo * 2; - x = hi + y; - if (y == x - hi) hi = x; - } - } - return hi; + function parseShortMonth(d, string2, i) { + var n = shortMonthRe.exec(string2.slice(i)); + return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } -} -function fsum(values, valueof) { - const adder = new Adder(); - if (valueof === undefined) { - for (let value of values)if (value = +value) adder.add(value); - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) adder.add(value); - } - return +adder; -} -function fcumsum(values, valueof) { - const adder = new Adder(); - let index = -1; - return Float64Array.from(values, valueof === undefined ? (v)=>adder.add(+v || 0) : (v)=>adder.add(+valueof(v, ++index, values) || 0)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gDEW5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>group); -parcelHelpers.export(exports, "groups", ()=>groups); -parcelHelpers.export(exports, "flatGroup", ()=>flatGroup); -parcelHelpers.export(exports, "flatRollup", ()=>flatRollup); -parcelHelpers.export(exports, "rollup", ()=>rollup); -parcelHelpers.export(exports, "rollups", ()=>rollups); -parcelHelpers.export(exports, "index", ()=>index); -parcelHelpers.export(exports, "indexes", ()=>indexes); -var _internmap = require("internmap"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -function group(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), (0, _identityJsDefault.default), keys); -} -function groups(values, ...keys) { - return nest(values, Array.from, (0, _identityJsDefault.default), keys); -} -function flatten(groups, keys) { - for(let i = 1, n = keys.length; i < n; ++i)groups = groups.flatMap((g)=>g.pop().map(([key, value])=>[ - ...g, - key, - value - ])); - return groups; -} -function flatGroup(values, ...keys) { - return flatten(groups(values, ...keys), keys); -} -function flatRollup(values, reduce, ...keys) { - return flatten(rollups(values, reduce, ...keys), keys); -} -function rollup(values, reduce, ...keys) { - return nest(values, (0, _identityJsDefault.default), reduce, keys); -} -function rollups(values, reduce, ...keys) { - return nest(values, Array.from, reduce, keys); -} -function index(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), unique, keys); -} -function indexes(values, ...keys) { - return nest(values, Array.from, unique, keys); -} -function unique(values) { - if (values.length !== 1) throw new Error("duplicate key"); - return values[0]; -} -function nest(values, map, reduce, keys) { - return function regroup(values, i) { - if (i >= keys.length) return reduce(values); - const groups = new (0, _internmap.InternMap)(); - const keyof = keys[i++]; - let index = -1; - for (const value of values){ - const key = keyof(value, ++index, values); - const group = groups.get(key); - if (group) group.push(value); - else groups.set(key, [ - value - ]); - } - for (const [key, values] of groups)groups.set(key, regroup(values, i)); - return map(groups); - }(values, 0); -} - -},{"internmap":"3ULAv","./identity.js":"eyTHz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ULAv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InternMap", ()=>InternMap); -parcelHelpers.export(exports, "InternSet", ()=>InternSet); -class InternMap extends Map { - constructor(entries, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (entries != null) for (const [key, value] of entries)this.set(key, value); + function parseMonth(d, string2, i) { + var n = monthRe.exec(string2.slice(i)); + return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - get(key) { - return super.get(intern_get(this, key)); + function parseLocaleDateTime(d, string2, i) { + return parseSpecifier(d, locale_dateTime, string2, i); } - has(key) { - return super.has(intern_get(this, key)); + function parseLocaleDate(d, string2, i) { + return parseSpecifier(d, locale_date, string2, i); } - set(key, value) { - return super.set(intern_set(this, key), value); + function parseLocaleTime(d, string2, i) { + return parseSpecifier(d, locale_time, string2, i); } - delete(key) { - return super.delete(intern_delete(this, key)); - } -} -class InternSet extends Set { - constructor(values, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (values != null) for (const value of values)this.add(value); - } - has(value) { - return super.has(intern_get(this, value)); - } - add(value) { - return super.add(intern_set(this, value)); - } - delete(value) { - return super.delete(intern_delete(this, value)); - } -} -function intern_get({ _intern, _key }, value) { - const key = _key(value); - return _intern.has(key) ? _intern.get(key) : value; -} -function intern_set({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) return _intern.get(key); - _intern.set(key, value); - return value; -} -function intern_delete({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) { - value = _intern.get(key); - _intern.delete(key); - } - return value; -} -function keyof(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eyTHz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -function identity(x) { - return x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6XFT5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>groupSort); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -function groupSort(values, reduce, key) { - return (reduce.length !== 2 ? (0, _sortJsDefault.default)((0, _groupJs.rollup)(values, reduce, key), ([ak, av], [bk, bv])=>(0, _ascendingJsDefault.default)(av, bv) || (0, _ascendingJsDefault.default)(ak, bk)) : (0, _sortJsDefault.default)((0, _groupJsDefault.default)(values, key), ([ak, av], [bk, bv])=>reduce(av, bv) || (0, _ascendingJsDefault.default)(ak, bk))).map(([key])=>key); -} - -},{"./ascending.js":"60o1Z","./group.js":"gDEW5","./sort.js":"bV3FZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bV3FZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sort); -parcelHelpers.export(exports, "compareDefined", ()=>compareDefined); -parcelHelpers.export(exports, "ascendingDefined", ()=>ascendingDefined); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -function sort(values, ...F) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - values = Array.from(values); - let [f] = F; - if (f && f.length !== 2 || F.length > 1) { - const index = Uint32Array.from(values, (d, i)=>i); - if (F.length > 1) { - F = F.map((f)=>values.map(f)); - index.sort((i, j)=>{ - for (const f of F){ - const c = ascendingDefined(f[i], f[j]); - if (c) return c; - } - }); - } else { - f = values.map(f); - index.sort((i, j)=>ascendingDefined(f[i], f[j])); - } - return (0, _permuteJsDefault.default)(values, index); - } - return values.sort(compareDefined(f)); -} -function compareDefined(compare = (0, _ascendingJsDefault.default)) { - if (compare === (0, _ascendingJsDefault.default)) return ascendingDefined; - if (typeof compare !== "function") throw new TypeError("compare is not a function"); - return (a, b)=>{ - const x = compare(a, b); - if (x || x === 0) return x; - return (compare(b, b) === 0) - (compare(a, a) === 0); - }; -} -function ascendingDefined(a, b) { - return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0); -} - -},{"./ascending.js":"60o1Z","./permute.js":"3ydIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ydIg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>permute); -function permute(source, keys) { - return Array.from(keys, (key)=>source[key]); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k5qBC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bin); -var _arrayJs = require("./array.js"); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -function bin() { - var value = (0, _identityJsDefault.default), domain = (0, _extentJsDefault.default), threshold = (0, _sturgesJsDefault.default); - function histogram(data) { - if (!Array.isArray(data)) data = Array.from(data); - var i, n = data.length, x, step, values = new Array(n); - for(i = 0; i < n; ++i)values[i] = value(data[i], i, data); - var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); - // Convert number of thresholds into uniform thresholds, and nice the - // default domain accordingly. - if (!Array.isArray(tz)) { - const max = x1, tn = +tz; - if (domain === (0, _extentJsDefault.default)) [x0, x1] = (0, _niceJsDefault.default)(x0, x1, tn); - tz = (0, _ticksJsDefault.default)(x0, x1, tn); - // If the domain is aligned with the first tick (which it will by - // default), then we can use quantization rather than bisection to bin - // values, which is substantially faster. - if (tz[0] <= x0) step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - // If the last threshold is coincident with the domain’s upper bound, the - // last bin will be zero-width. If the default domain is used, and this - // last threshold is coincident with the maximum input value, we can - // extend the niced upper bound by one tick to ensure uniform bin widths; - // otherwise, we simply remove the last threshold. Note that we don’t - // coerce values or the domain to numbers, and thus must be careful to - // compare order (>=) rather than strict equality (===)! - if (tz[tz.length - 1] >= x1) { - if (max >= x1 && domain === (0, _extentJsDefault.default)) { - const step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - if (isFinite(step)) { - if (step > 0) x1 = (Math.floor(x1 / step) + 1) * step; - else if (step < 0) x1 = (Math.ceil(x1 * -step) + 1) / -step; - } - } else tz.pop(); - } - } - // Remove any thresholds outside the domain. - // Be careful not to mutate an array owned by the user! - var m = tz.length, a = 0, b = m; - while(tz[a] <= x0)++a; - while(tz[b - 1] > x1)--b; - if (a || b < m) tz = tz.slice(a, b), m = b - a; - var bins = new Array(m + 1), bin; - // Initialize bins. - for(i = 0; i <= m; ++i){ - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - // Assign data to bins by value, ignoring any outside the domain. - if (isFinite(step)) { - if (step > 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]); - } else if (step < 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) { - const j = Math.floor((x0 - x) * step); - bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); // handle off-by-one due to rounding - } - } - } else { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[(0, _bisectJsDefault.default)(tz, x, 0, m)].push(data[i]); - } - return bins; - } - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), histogram) : value; - }; - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - _[0], - _[1] - ]), histogram) : domain; - }; - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(Array.isArray(_) ? (0, _arrayJs.slice).call(_) : _), histogram) : threshold; - }; - return histogram; -} - -},{"./array.js":"kI9nk","./bisect.js":"iJojn","./constant.js":"aOeVu","./extent.js":"2l7Ul","./identity.js":"eyTHz","./nice.js":"lCn8Q","./ticks.js":"71MAh","./threshold/sturges.js":"20cg0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kI9nk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "map", ()=>map); -var array = Array.prototype; -var slice = array.slice; -var map = array.map; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aOeVu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constant); -function constant(x) { - return ()=>x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lCn8Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -var _ticksJs = require("./ticks.js"); -function nice(start, stop, count) { - let prestep; - while(true){ - const step = (0, _ticksJs.tickIncrement)(start, stop, count); - if (step === prestep || step === 0 || !isFinite(step)) return [ - start, - stop - ]; - else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } - prestep = step; - } -} - -},{"./ticks.js":"71MAh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"71MAh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ticks); -parcelHelpers.export(exports, "tickIncrement", ()=>tickIncrement); -parcelHelpers.export(exports, "tickStep", ()=>tickStep); -const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); -function tickSpec(start, stop, count) { - const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; - let i1, i2, inc; - if (power < 0) { - inc = Math.pow(10, -power) / factor; - i1 = Math.round(start * inc); - i2 = Math.round(stop * inc); - if (i1 / inc < start) ++i1; - if (i2 / inc > stop) --i2; - inc = -inc; - } else { - inc = Math.pow(10, power) * factor; - i1 = Math.round(start / inc); - i2 = Math.round(stop / inc); - if (i1 * inc < start) ++i1; - if (i2 * inc > stop) --i2; - } - if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2); - return [ - i1, - i2, - inc - ]; -} -function ticks(start, stop, count) { - stop = +stop, start = +start, count = +count; - if (!(count > 0)) return []; - if (start === stop) return [ - start - ]; - const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count); - if (!(i2 >= i1)) return []; - const n = i2 - i1 + 1, ticks = new Array(n); - if (reverse) { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) * inc; - } else { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) * inc; - } - return ticks; -} -function tickIncrement(start, stop, count) { - stop = +stop, start = +start, count = +count; - return tickSpec(start, stop, count)[2]; -} -function tickStep(start, stop, count) { - stop = +stop, start = +start, count = +count; - const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count); - return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"20cg0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdSturges); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -function thresholdSturges(values) { - return Math.max(1, Math.ceil(Math.log((0, _countJsDefault.default)(values)) / Math.LN2) + 1); -} - -},{"../count.js":"hAOxG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7zq9L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdFreedmanDiaconis); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _quantileJs = require("../quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function thresholdFreedmanDiaconis(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _quantileJsDefault.default)(values, 0.75) - (0, _quantileJsDefault.default)(values, 0.25); - return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1; -} - -},{"../count.js":"hAOxG","../quantile.js":"49cDh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49cDh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -parcelHelpers.export(exports, "quantileSorted", ()=>quantileSorted); -parcelHelpers.export(exports, "quantileIndex", ()=>quantileIndex); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _sortJs = require("./sort.js"); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -function quantile(values, p, valueof) { - values = Float64Array.from((0, _numberJs.numbers)(values, valueof)); - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return (0, _minJsDefault.default)(values); - if (p >= 1) return (0, _maxJsDefault.default)(values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = (0, _maxJsDefault.default)((0, _quickselectJsDefault.default)(values, i0).subarray(0, i0 + 1)), value1 = (0, _minJsDefault.default)(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} -function quantileSorted(values, p, valueof = (0, _numberJsDefault.default)) { - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} -function quantileIndex(values, p, valueof = (0, _numberJsDefault.default)) { - if (isNaN(p = +p)) return; - numbers = Float64Array.from(values, (_, i)=>(0, _numberJsDefault.default)(valueof(values[i], i, values))); - if (p <= 0) return (0, _minIndexJsDefault.default)(numbers); - if (p >= 1) return (0, _maxIndexJsDefault.default)(numbers); - var numbers, index = Uint32Array.from(values, (_, i)=>i), j = numbers.length - 1, i = Math.floor(j * p); - (0, _quickselectJsDefault.default)(index, i, 0, j, (i, j)=>(0, _sortJs.ascendingDefined)(numbers[i], numbers[j])); - i = (0, _greatestJsDefault.default)(index.subarray(0, i + 1), (i)=>numbers[i]); - return i >= 0 ? i : -1; -} - -},{"./max.js":"5fCPh","./maxIndex.js":"fm7WL","./min.js":"h0RAg","./minIndex.js":"3rpRW","./quickselect.js":"doA4Q","./number.js":"gcMRK","./sort.js":"bV3FZ","./greatest.js":"c4GrS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5fCPh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>max); -function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values)if (value != null && (max < value || max === undefined && value >= value)) max = value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value; - } - return max; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fm7WL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>maxIndex); -function maxIndex(values, valueof) { - let max; - let maxIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; - } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; - } - return maxIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h0RAg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>min); -function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values)if (value != null && (min > value || min === undefined && value >= value)) min = value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value; - } - return min; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rpRW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>minIndex); -function minIndex(values, valueof) { - let min; - let minIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; - } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; - } - return minIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"doA4Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quickselect); -var _sortJs = require("./sort.js"); -function quickselect(array, k, left = 0, right = Infinity, compare) { - k = Math.floor(k); - left = Math.floor(Math.max(0, left)); - right = Math.floor(Math.min(array.length - 1, right)); - if (!(left <= k && k <= right)) return array; - compare = compare === undefined ? (0, _sortJs.ascendingDefined) : (0, _sortJs.compareDefined)(compare); - while(right > left){ - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - const t = array[k]; - let i = left; - let j = right; - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - while(i < j){ - swap(array, i, j), ++i, --j; - while(compare(array[i], t) < 0)++i; - while(compare(array[j], t) > 0)--j; - } - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; -} -function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; -} - -},{"./sort.js":"bV3FZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c4GrS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatest); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function greatest(values, compare = (0, _ascendingJsDefault.default)) { - let max; - let defined = false; - if (compare.length === 1) { - let maxValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, maxValue) > 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - max = element; - maxValue = value; - defined = true; - } - } - } else { - for (const value of values)if (defined ? compare(value, max) > 0 : compare(value, value) === 0) { - max = value; - defined = true; - } - } - return max; -} - -},{"./ascending.js":"60o1Z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"84aHL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdScott); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _deviationJs = require("../deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -function thresholdScott(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _deviationJsDefault.default)(values); - return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1; -} - -},{"../count.js":"hAOxG","../deviation.js":"euifj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8HbAa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mean); -function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count, sum += value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count, sum += value; - } - if (count) return sum / count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ai1Kc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>median); -parcelHelpers.export(exports, "medianIndex", ()=>medianIndex); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function median(values, valueof) { - return (0, _quantileJsDefault.default)(values, 0.5, valueof); -} -function medianIndex(values, valueof) { - return (0, _quantileJs.quantileIndex)(values, 0.5, valueof); -} - -},{"./quantile.js":"49cDh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d56l7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>merge); -function* flatten(arrays) { - for (const array of arrays)yield* array; -} -function merge(arrays) { - return Array.from(flatten(arrays)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0gW2M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mode); -var _internmap = require("internmap"); -function mode(values, valueof) { - const counts = new (0, _internmap.InternMap)(); - if (valueof === undefined) { - for (let value of values)if (value != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } - let modeValue; - let modeCount = 0; - for (const [value, count] of counts)if (count > modeCount) { - modeCount = count; - modeValue = value; - } - return modeValue; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jCTEB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>pairs); -parcelHelpers.export(exports, "pair", ()=>pair); -function pairs(values, pairof = pair) { - const pairs1 = []; - let previous; - let first = false; - for (const value of values){ - if (first) pairs1.push(pairof(previous, value)); - previous = value; - first = true; - } - return pairs1; -} -function pair(a, b) { - return [ - a, - b - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7QVPN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>range); -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); - while(++i < n)range[i] = start + i * step; - return range; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wNFQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>rank); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _sortJs = require("./sort.js"); -function rank(values, valueof = (0, _ascendingJsDefault.default)) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - let V = Array.from(values); - const R = new Float64Array(V.length); - if (valueof.length !== 2) V = V.map(valueof), valueof = (0, _ascendingJsDefault.default); - const compareIndex = (i, j)=>valueof(V[i], V[j]); - let k, r; - values = Uint32Array.from(V, (_, i)=>i); - // Risky chaining due to Safari 14 https://github.com/d3/d3-array/issues/123 - values.sort(valueof === (0, _ascendingJsDefault.default) ? (i, j)=>(0, _sortJs.ascendingDefined)(V[i], V[j]) : (0, _sortJs.compareDefined)(compareIndex)); - values.forEach((j, i)=>{ - const c = compareIndex(j, k === undefined ? j : k); - if (c >= 0) { - if (k === undefined || c > 0) k = j, r = i; - R[j] = r; - } else R[j] = NaN; - }); - return R; -} - -},{"./ascending.js":"60o1Z","./sort.js":"bV3FZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"blduW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>least); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function least(values, compare = (0, _ascendingJsDefault.default)) { - let min; - let defined = false; - if (compare.length === 1) { - let minValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, minValue) < 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - min = element; - minValue = value; - defined = true; - } - } - } else { - for (const value of values)if (defined ? compare(value, min) < 0 : compare(value, value) === 0) { - min = value; - defined = true; - } - } - return min; -} - -},{"./ascending.js":"60o1Z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9lwr3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>leastIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -function leastIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _minIndexJsDefault.default)(values, compare); - let minValue; - let min = -1; - let index = -1; - for (const value of values){ - ++index; - if (min < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { - minValue = value; - min = index; - } - } - return min; -} - -},{"./ascending.js":"60o1Z","./minIndex.js":"3rpRW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9hgwE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatestIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -function greatestIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _maxIndexJsDefault.default)(values, compare); - let maxValue; - let max = -1; - let index = -1; - for (const value of values){ - ++index; - if (max < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { - maxValue = value; - max = index; - } - } - return max; -} - -},{"./ascending.js":"60o1Z","./maxIndex.js":"fm7WL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6EUfu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>scan); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -function scan(values, compare) { - const index = (0, _leastIndexJsDefault.default)(values, compare); - return index < 0 ? undefined : index; -} - -},{"./leastIndex.js":"9lwr3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gPIAO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shuffler", ()=>shuffler); -exports.default = shuffler(Math.random); -function shuffler(random) { - return function shuffle(array, i0 = 0, i1 = array.length) { - let m = i1 - (i0 = +i0); - while(m){ - const i = random() * m-- | 0, t = array[m + i0]; - array[m + i0] = array[i + i0]; - array[i + i0] = t; - } - return array; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdZOC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sum); -function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value = +value) sum += value; - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) sum += value; - } - return sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iwW5c":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>transpose); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for(var i = -1, m = (0, _minJsDefault.default)(matrix, length), transpose = new Array(m); ++i < m;)for(var j = -1, n, row = transpose[i] = new Array(n); ++j < n;)row[j] = matrix[j][i]; - return transpose; -} -function length(d) { - return d.length; -} - -},{"./min.js":"h0RAg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jZBBF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>zip); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -function zip() { - return (0, _transposeJsDefault.default)(arguments); -} - -},{"./transpose.js":"iwW5c","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"38T8N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>every); -function every(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (!test(value, ++index, values)) return false; - } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8z051":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>some); -function some(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (test(value, ++index, values)) return true; - } - return false; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lgrhD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>filter); -function filter(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - const array = []; - let index = -1; - for (const value of values)if (test(value, ++index, values)) array.push(value); - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dbY4R":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>map); -function map(values, mapper) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - if (typeof mapper !== "function") throw new TypeError("mapper is not a function"); - return Array.from(values, (value, index)=>mapper(value, index, values)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1uy4z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reduce); -function reduce(values, reducer, value) { - if (typeof reducer !== "function") throw new TypeError("reducer is not a function"); - const iterator = values[Symbol.iterator](); - let done, next, index = -1; - if (arguments.length < 3) { - ({ done, value } = iterator.next()); - if (done) return; - ++index; - } - while({ done, value: next } = iterator.next(), !done)value = reducer(value, next, ++index, values); - return value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8g01M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reverse); -function reverse(values) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - return Array.from(values).reverse(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bwetK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>difference); -var _internmap = require("internmap"); -function difference(values, ...others) { - values = new (0, _internmap.InternSet)(values); - for (const other of others)for (const value of other)values.delete(value); - return values; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ilJ5C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>disjoint); -var _internmap = require("internmap"); -function disjoint(values, other) { - const iterator = other[Symbol.iterator](), set = new (0, _internmap.InternSet)(); - for (const v of values){ - if (set.has(v)) return false; - let value, done; - while({ value, done } = iterator.next()){ - if (done) break; - if (Object.is(v, value)) return false; - set.add(value); - } - } - return true; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gohoZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>intersection); -var _internmap = require("internmap"); -function intersection(values, ...others) { - values = new (0, _internmap.InternSet)(values); - others = others.map(set); - out: for (const value of values){ - for (const other of others)if (!other.has(value)) { - values.delete(value); - continue out; - } - } - return values; -} -function set(values) { - return values instanceof (0, _internmap.InternSet) ? values : new (0, _internmap.InternSet)(values); -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f9sTm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>subset); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -function subset(values, other) { - return (0, _supersetJsDefault.default)(other, values); -} - -},{"./superset.js":"9my10","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9my10":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>superset); -function superset(values, other) { - const iterator = values[Symbol.iterator](), set = new Set(); - for (const o of other){ - const io = intern(o); - if (set.has(io)) continue; - let value, done; - while({ value, done } = iterator.next()){ - if (done) return false; - const ivalue = intern(value); - set.add(ivalue); - if (Object.is(io, ivalue)) break; - } - } - return true; -} -function intern(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"66hcN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>union); -var _internmap = require("internmap"); -function union(...others) { - const set = new (0, _internmap.InternSet)(); - for (const other of others)for (const o of other)set.add(o); - return set; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8dYFL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "formatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "format", ()=>(0, _defaultLocaleJs.format)); -parcelHelpers.export(exports, "formatPrefix", ()=>(0, _defaultLocaleJs.formatPrefix)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "formatSpecifier", ()=>(0, _formatSpecifierJsDefault.default)); -parcelHelpers.export(exports, "FormatSpecifier", ()=>(0, _formatSpecifierJs.FormatSpecifier)); -parcelHelpers.export(exports, "precisionFixed", ()=>(0, _precisionFixedJsDefault.default)); -parcelHelpers.export(exports, "precisionPrefix", ()=>(0, _precisionPrefixJsDefault.default)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _precisionRoundJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _precisionFixedJs = require("./precisionFixed.js"); -var _precisionFixedJsDefault = parcelHelpers.interopDefault(_precisionFixedJs); -var _precisionPrefixJs = require("./precisionPrefix.js"); -var _precisionPrefixJsDefault = parcelHelpers.interopDefault(_precisionPrefixJs); -var _precisionRoundJs = require("./precisionRound.js"); -var _precisionRoundJsDefault = parcelHelpers.interopDefault(_precisionRoundJs); - -},{"./defaultLocale.js":"1ffdx","./locale.js":"dwvYJ","./formatSpecifier.js":"bIdqX","./precisionFixed.js":"8IQWL","./precisionPrefix.js":"iTn3h","./precisionRound.js":"kzQd5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1ffdx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formatPrefix", ()=>formatPrefix); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var format; -var formatPrefix; -defaultLocale({ - thousands: ",", - grouping: [ - 3 - ], - currency: [ - "$", - "" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} - -},{"./locale.js":"dwvYJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dwvYJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? (0, _identityJsDefault.default) : (0, _formatGroupJsDefault.default)(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? (0, _identityJsDefault.default) : (0, _formatNumeralsJsDefault.default)(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "\u2212" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - function newFormat(specifier) { - specifier = (0, _formatSpecifierJsDefault.default)(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - else if (!(0, _formatTypesJsDefault.default)[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - // If zero fill is specified, padding goes after sign and before digits. - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = (0, _formatTypesJsDefault.default)[type], maybeSuffix = /[defgprs%]/.test(type); - // Set the default precision if not specified, - // or clamp the specified precision to the supported range. - // For significant precision, it must be in [1, 21]. - // For fixed precision, it must be in [0, 20]. - precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - // Trim insignificant zeros. - if (trim) value = (0, _formatTrimJsDefault.default)(value); - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + (0, _formatPrefixAutoJs.prefixExponent) / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while(++i < n)if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - // Reconstruct the final output based on the desired alignment. - switch(align){ - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format.toString = function() { - return specifier + ""; - }; - return format; - } - function formatPrefix(specifier, value) { - var f = newFormat((specifier = (0, _formatSpecifierJsDefault.default)(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; - } - return { - format: newFormat, - formatPrefix: formatPrefix - }; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); -var _formatGroupJs = require("./formatGroup.js"); -var _formatGroupJsDefault = parcelHelpers.interopDefault(_formatGroupJs); -var _formatNumeralsJs = require("./formatNumerals.js"); -var _formatNumeralsJsDefault = parcelHelpers.interopDefault(_formatNumeralsJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _formatTrimJs = require("./formatTrim.js"); -var _formatTrimJsDefault = parcelHelpers.interopDefault(_formatTrimJs); -var _formatTypesJs = require("./formatTypes.js"); -var _formatTypesJsDefault = parcelHelpers.interopDefault(_formatTypesJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var map = Array.prototype.map, prefixes = [ - "y", - "z", - "a", - "f", - "p", - "n", - "\xb5", - "m", - "", - "k", - "M", - "G", - "T", - "P", - "E", - "Z", - "Y" -]; - -},{"./exponent.js":"iqnEO","./formatGroup.js":"d3NPN","./formatNumerals.js":"32lVM","./formatSpecifier.js":"bIdqX","./formatTrim.js":"1v59S","./formatTypes.js":"eJoM5","./formatPrefixAuto.js":"5DQGQ","./identity.js":"5utPE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iqnEO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x = (0, _formatDecimalJs.formatDecimalParts)(Math.abs(x)), x ? x[1] : NaN; - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"8WhgD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8WhgD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); - }); -// Computes the decimal coefficient and exponent of the specified number x with -// significant digits p, where x is positive and p is in [1, 21] or undefined. -// For example, formatDecimalParts(1.23) returns ["123", 0]. -parcelHelpers.export(exports, "formatDecimalParts", ()=>formatDecimalParts); -function formatDecimalParts(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = x.slice(0, i); - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). - return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d3NPN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while(i > 0 && g > 0){ - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"32lVM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bIdqX":[function(require,module,exports,__globalThis) { -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatSpecifier); -parcelHelpers.export(exports, "FormatSpecifier", ()=>FormatSpecifier); -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); -} -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof -function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} -FormatSpecifier.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1v59S":[function(require,module,exports,__globalThis) { -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(s) { - out: for(var n = s.length, i = 1, i0 = -1, i1; i < n; ++i)switch(s[i]){ - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; - break; - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eJoM5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _formatDecimalJs = require("./formatDecimal.js"); -var _formatDecimalJsDefault = parcelHelpers.interopDefault(_formatDecimalJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _formatPrefixAutoJsDefault = parcelHelpers.interopDefault(_formatPrefixAutoJs); -var _formatRoundedJs = require("./formatRounded.js"); -var _formatRoundedJsDefault = parcelHelpers.interopDefault(_formatRoundedJs); -exports.default = { - "%": (x, p)=>(x * 100).toFixed(p), - "b": (x)=>Math.round(x).toString(2), - "c": (x)=>x + "", - "d": (0, _formatDecimalJsDefault.default), - "e": (x, p)=>x.toExponential(p), - "f": (x, p)=>x.toFixed(p), - "g": (x, p)=>x.toPrecision(p), - "o": (x)=>Math.round(x).toString(8), - "p": (x, p)=>(0, _formatRoundedJsDefault.default)(x * 100, p), - "r": (0, _formatRoundedJsDefault.default), - "s": (0, _formatPrefixAutoJsDefault.default), - "X": (x)=>Math.round(x).toString(16).toUpperCase(), - "x": (x)=>Math.round(x).toString(16) -}; - -},{"./formatDecimal.js":"8WhgD","./formatPrefixAuto.js":"5DQGQ","./formatRounded.js":"dJog3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5DQGQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixExponent", ()=>prefixExponent); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + (0, _formatDecimalJs.formatDecimalParts)(x, Math.max(0, p + i - 1))[0]; // less than 1y! - }); -var _formatDecimalJs = require("./formatDecimal.js"); -var prefixExponent; - -},{"./formatDecimal.js":"8WhgD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dJog3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"8WhgD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5utPE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8IQWL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step) { - return Math.max(0, -(0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"iqnEO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iTn3h":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3 - (0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"iqnEO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kzQd5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, (0, _exponentJsDefault.default)(max) - (0, _exponentJsDefault.default)(step)) + 1; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"iqnEO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"27kpp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATE", ()=>DATE); -parcelHelpers.export(exports, "DAY", ()=>DAY); -parcelHelpers.export(exports, "DAYOFYEAR", ()=>DAYOFYEAR); -parcelHelpers.export(exports, "HOURS", ()=>HOURS); -parcelHelpers.export(exports, "MILLISECONDS", ()=>MILLISECONDS); -parcelHelpers.export(exports, "MINUTES", ()=>MINUTES); -parcelHelpers.export(exports, "MONTH", ()=>MONTH); -parcelHelpers.export(exports, "QUARTER", ()=>QUARTER); -parcelHelpers.export(exports, "SECONDS", ()=>SECONDS); -parcelHelpers.export(exports, "TIME_UNITS", ()=>TIME_UNITS); -parcelHelpers.export(exports, "WEEK", ()=>WEEK); -parcelHelpers.export(exports, "YEAR", ()=>YEAR); -parcelHelpers.export(exports, "dayofyear", ()=>dayofyear); -parcelHelpers.export(exports, "timeBin", ()=>bin); -parcelHelpers.export(exports, "timeFloor", ()=>timeFloor); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -parcelHelpers.export(exports, "timeOffset", ()=>timeOffset); -parcelHelpers.export(exports, "timeSequence", ()=>timeSequence); -parcelHelpers.export(exports, "timeUnitSpecifier", ()=>timeUnitSpecifier); -parcelHelpers.export(exports, "timeUnits", ()=>timeUnits); -parcelHelpers.export(exports, "utcFloor", ()=>utcFloor); -parcelHelpers.export(exports, "utcInterval", ()=>utcInterval); -parcelHelpers.export(exports, "utcOffset", ()=>utcOffset); -parcelHelpers.export(exports, "utcSequence", ()=>utcSequence); -parcelHelpers.export(exports, "utcdayofyear", ()=>utcdayofyear); -parcelHelpers.export(exports, "utcweek", ()=>utcweek); -parcelHelpers.export(exports, "week", ()=>week); -var _vegaUtil = require("vega-util"); -var _d3Time = require("d3-time"); -var _d3Array = require("d3-array"); -const YEAR = 'year'; -const QUARTER = 'quarter'; -const MONTH = 'month'; -const WEEK = 'week'; -const DATE = 'date'; -const DAY = 'day'; -const DAYOFYEAR = 'dayofyear'; -const HOURS = 'hours'; -const MINUTES = 'minutes'; -const SECONDS = 'seconds'; -const MILLISECONDS = 'milliseconds'; -const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -]; -const UNITS = TIME_UNITS.reduce((o, u, i)=>(o[u] = 1 + i, o), {}); -function timeUnits(units) { - const u = (0, _vegaUtil.array)(units).slice(), m = {}; - // check validity - if (!u.length) (0, _vegaUtil.error)('Missing time unit.'); - u.forEach((unit)=>{ - if ((0, _vegaUtil.hasOwnProperty)(UNITS, unit)) m[unit] = 1; - else (0, _vegaUtil.error)(`Invalid time unit: ${unit}.`); - }); - const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); - if (numTypes > 1) (0, _vegaUtil.error)(`Incompatible time units: ${units}`); - // ensure proper sort order - u.sort((a, b)=>UNITS[a] - UNITS[b]); - return u; -} -const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' -}; -function timeUnitSpecifier(units, specifiers) { - const s = (0, _vegaUtil.extend)({}, defaultSpecifiers, specifiers), u = timeUnits(units), n = u.length; - let fmt = '', start = 0, end, key; - for(start = 0; start < n;)for(end = u.length; end > start; --end){ - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - return fmt.trim(); -} -const t0 = new Date(); -function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; -} -function dayofyear(d) { - return localDayOfYear(new Date(d)); -} -function week(d) { - return localWeekNum(new Date(d)); -} -function localDayOfYear(d) { - return (0, _d3Time.timeDay).count(localYear(d.getFullYear()) - 1, d); -} -function localWeekNum(d) { - return (0, _d3Time.timeWeek).count(localYear(d.getFullYear()) - 1, d); -} -function localFirst(y) { - return localYear(y).getDay(); -} -function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); -} -function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); -} -function utcweek(d) { - return utcWeekNum(new Date(d)); -} -function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcDay).count(y - 1, d); -} -function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcWeek).count(y - 1, d); -} -function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); -} -function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); -} -function floor(units, step, get, inv, newDate) { - const s = step || 1, b = (0, _vegaUtil.peek)(units), _ = (unit, p, key)=>{ - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - const t = new Date(), u = (0, _vegaUtil.toSet)(units), y = u[YEAR] ? _(YEAR) : (0, _vegaUtil.constant)(2012), m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : (0, _vegaUtil.zero), d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : (0, _vegaUtil.one), H = u[HOURS] ? _(HOURS) : (0, _vegaUtil.zero), M = u[MINUTES] ? _(MINUTES) : (0, _vegaUtil.zero), S = u[SECONDS] ? _(SECONDS) : (0, _vegaUtil.zero), L = u[MILLISECONDS] ? _(MILLISECONDS) : (0, _vegaUtil.zero); - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; -} -function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f : phase ? (d, y)=>phase + step * Math.floor((f(d, y) - phase) / step) : (d, y)=>step * Math.floor(f(d, y) / step); - return inv ? (d, y)=>inv(u(d, y), y) : u; -} -// returns the day of the year based on week number, day of week, -// and the day of the week for the first day of the year -function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; -} -// -- LOCAL TIME -- -const localGet = { - [YEAR]: (d)=>d.getFullYear(), - [QUARTER]: (d)=>Math.floor(d.getMonth() / 3), - [MONTH]: (d)=>d.getMonth(), - [DATE]: (d)=>d.getDate(), - [HOURS]: (d)=>d.getHours(), - [MINUTES]: (d)=>d.getMinutes(), - [SECONDS]: (d)=>d.getSeconds(), - [MILLISECONDS]: (d)=>d.getMilliseconds(), - [DAYOFYEAR]: (d)=>localDayOfYear(d), - [WEEK]: (d)=>localWeekNum(d), - [WEEK + DAY]: (d, y)=>weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y)=>weekday(1, d.getDay(), localFirst(y)) -}; -const localInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, localFirst(y)) -}; -function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); -} -// -- UTC TIME -- -const utcGet = { - [YEAR]: (d)=>d.getUTCFullYear(), - [QUARTER]: (d)=>Math.floor(d.getUTCMonth() / 3), - [MONTH]: (d)=>d.getUTCMonth(), - [DATE]: (d)=>d.getUTCDate(), - [HOURS]: (d)=>d.getUTCHours(), - [MINUTES]: (d)=>d.getUTCMinutes(), - [SECONDS]: (d)=>d.getUTCSeconds(), - [MILLISECONDS]: (d)=>d.getUTCMilliseconds(), - [DAYOFYEAR]: (d)=>utcDayOfYear(d), - [WEEK]: (d)=>utcWeekNum(d), - [DAY]: (d, y)=>weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y)=>weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) -}; -const utcInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, utcFirst(y)) -}; -function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); -} -const timeIntervals = { - [YEAR]: (0, _d3Time.timeYear), - [QUARTER]: (0, _d3Time.timeMonth).every(3), - [MONTH]: (0, _d3Time.timeMonth), - [WEEK]: (0, _d3Time.timeWeek), - [DATE]: (0, _d3Time.timeDay), - [DAY]: (0, _d3Time.timeDay), - [DAYOFYEAR]: (0, _d3Time.timeDay), - [HOURS]: (0, _d3Time.timeHour), - [MINUTES]: (0, _d3Time.timeMinute), - [SECONDS]: (0, _d3Time.timeSecond), - [MILLISECONDS]: (0, _d3Time.timeMillisecond) -}; -const utcIntervals = { - [YEAR]: (0, _d3Time.utcYear), - [QUARTER]: (0, _d3Time.utcMonth).every(3), - [MONTH]: (0, _d3Time.utcMonth), - [WEEK]: (0, _d3Time.utcWeek), - [DATE]: (0, _d3Time.utcDay), - [DAY]: (0, _d3Time.utcDay), - [DAYOFYEAR]: (0, _d3Time.utcDay), - [HOURS]: (0, _d3Time.utcHour), - [MINUTES]: (0, _d3Time.utcMinute), - [SECONDS]: (0, _d3Time.utcSecond), - [MILLISECONDS]: (0, _d3Time.utcMillisecond) -}; -function timeInterval(unit) { - return timeIntervals[unit]; -} -function utcInterval(unit) { - return utcIntervals[unit]; -} -function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; -} -function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); -} -function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); -} -function sequence(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; -} -function timeSequence(unit, start, stop, step) { - return sequence(timeInterval(unit), start, stop, step); -} -function utcSequence(unit, start, stop, step) { - return sequence(utcInterval(unit), start, stop, step); -} -const durationSecond = 1000, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; -const Milli = [ - YEAR, - MONTH, - DATE, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [ - YEAR, - WEEK -], Month = [ - YEAR, - MONTH -], Year = [ - YEAR -]; -const intervals = [ - [ - Seconds, - 1, - durationSecond - ], - [ - Seconds, - 5, - 5 * durationSecond - ], - [ - Seconds, - 15, - 15 * durationSecond - ], - [ - Seconds, - 30, - 30 * durationSecond - ], - [ - Minutes, - 1, - durationMinute - ], - [ - Minutes, - 5, - 5 * durationMinute - ], - [ - Minutes, - 15, - 15 * durationMinute - ], - [ - Minutes, - 30, - 30 * durationMinute - ], - [ - Hours, - 1, - durationHour - ], - [ - Hours, - 3, - 3 * durationHour - ], - [ - Hours, - 6, - 6 * durationHour - ], - [ - Hours, - 12, - 12 * durationHour - ], - [ - Day, - 1, - durationDay - ], - [ - Week, - 1, - durationWeek - ], - [ - Month, - 1, - durationMonth - ], - [ - Month, - 3, - 3 * durationMonth - ], - [ - Year, - 1, - durationYear - ] -]; -function bin(opt) { - const ext = opt.extent, max = opt.maxbins || 40, target = Math.abs((0, _vegaUtil.span)(ext)) / max; - let i = (0, _d3Array.bisector)((i)=>i[2]).right(intervals, target), units, step; - if (i === intervals.length) units = Year, step = (0, _d3Array.tickStep)(ext[0] / durationYear, ext[1] / durationYear, max); - else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max((0, _d3Array.tickStep)(ext[0], ext[1], max), 1); - } - return { - units, - step - }; -} - -},{"vega-util":"bApja","d3-time":"8e7eR","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8e7eR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>(0, _intervalJs.timeInterval)); -parcelHelpers.export(exports, "utcMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "utcMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "timeMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "timeMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "utcSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "utcSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "timeSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeMinute", ()=>(0, _minuteJs.timeMinute)); -parcelHelpers.export(exports, "timeMinutes", ()=>(0, _minuteJs.timeMinutes)); -parcelHelpers.export(exports, "utcMinute", ()=>(0, _minuteJs.utcMinute)); -parcelHelpers.export(exports, "utcMinutes", ()=>(0, _minuteJs.utcMinutes)); -parcelHelpers.export(exports, "timeHour", ()=>(0, _hourJs.timeHour)); -parcelHelpers.export(exports, "timeHours", ()=>(0, _hourJs.timeHours)); -parcelHelpers.export(exports, "utcHour", ()=>(0, _hourJs.utcHour)); -parcelHelpers.export(exports, "utcHours", ()=>(0, _hourJs.utcHours)); -parcelHelpers.export(exports, "timeDay", ()=>(0, _dayJs.timeDay)); -parcelHelpers.export(exports, "timeDays", ()=>(0, _dayJs.timeDays)); -parcelHelpers.export(exports, "utcDay", ()=>(0, _dayJs.utcDay)); -parcelHelpers.export(exports, "utcDays", ()=>(0, _dayJs.utcDays)); -parcelHelpers.export(exports, "unixDay", ()=>(0, _dayJs.unixDay)); -parcelHelpers.export(exports, "unixDays", ()=>(0, _dayJs.unixDays)); -parcelHelpers.export(exports, "timeWeek", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeWeeks", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeSunday", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeSundays", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeMonday", ()=>(0, _weekJs.timeMonday)); -parcelHelpers.export(exports, "timeMondays", ()=>(0, _weekJs.timeMondays)); -parcelHelpers.export(exports, "timeTuesday", ()=>(0, _weekJs.timeTuesday)); -parcelHelpers.export(exports, "timeTuesdays", ()=>(0, _weekJs.timeTuesdays)); -parcelHelpers.export(exports, "timeWednesday", ()=>(0, _weekJs.timeWednesday)); -parcelHelpers.export(exports, "timeWednesdays", ()=>(0, _weekJs.timeWednesdays)); -parcelHelpers.export(exports, "timeThursday", ()=>(0, _weekJs.timeThursday)); -parcelHelpers.export(exports, "timeThursdays", ()=>(0, _weekJs.timeThursdays)); -parcelHelpers.export(exports, "timeFriday", ()=>(0, _weekJs.timeFriday)); -parcelHelpers.export(exports, "timeFridays", ()=>(0, _weekJs.timeFridays)); -parcelHelpers.export(exports, "timeSaturday", ()=>(0, _weekJs.timeSaturday)); -parcelHelpers.export(exports, "timeSaturdays", ()=>(0, _weekJs.timeSaturdays)); -parcelHelpers.export(exports, "utcWeek", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcWeeks", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcSunday", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcSundays", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcMonday", ()=>(0, _weekJs.utcMonday)); -parcelHelpers.export(exports, "utcMondays", ()=>(0, _weekJs.utcMondays)); -parcelHelpers.export(exports, "utcTuesday", ()=>(0, _weekJs.utcTuesday)); -parcelHelpers.export(exports, "utcTuesdays", ()=>(0, _weekJs.utcTuesdays)); -parcelHelpers.export(exports, "utcWednesday", ()=>(0, _weekJs.utcWednesday)); -parcelHelpers.export(exports, "utcWednesdays", ()=>(0, _weekJs.utcWednesdays)); -parcelHelpers.export(exports, "utcThursday", ()=>(0, _weekJs.utcThursday)); -parcelHelpers.export(exports, "utcThursdays", ()=>(0, _weekJs.utcThursdays)); -parcelHelpers.export(exports, "utcFriday", ()=>(0, _weekJs.utcFriday)); -parcelHelpers.export(exports, "utcFridays", ()=>(0, _weekJs.utcFridays)); -parcelHelpers.export(exports, "utcSaturday", ()=>(0, _weekJs.utcSaturday)); -parcelHelpers.export(exports, "utcSaturdays", ()=>(0, _weekJs.utcSaturdays)); -parcelHelpers.export(exports, "timeMonth", ()=>(0, _monthJs.timeMonth)); -parcelHelpers.export(exports, "timeMonths", ()=>(0, _monthJs.timeMonths)); -parcelHelpers.export(exports, "utcMonth", ()=>(0, _monthJs.utcMonth)); -parcelHelpers.export(exports, "utcMonths", ()=>(0, _monthJs.utcMonths)); -parcelHelpers.export(exports, "timeYear", ()=>(0, _yearJs.timeYear)); -parcelHelpers.export(exports, "timeYears", ()=>(0, _yearJs.timeYears)); -parcelHelpers.export(exports, "utcYear", ()=>(0, _yearJs.utcYear)); -parcelHelpers.export(exports, "utcYears", ()=>(0, _yearJs.utcYears)); -parcelHelpers.export(exports, "utcTicks", ()=>(0, _ticksJs.utcTicks)); -parcelHelpers.export(exports, "utcTickInterval", ()=>(0, _ticksJs.utcTickInterval)); -parcelHelpers.export(exports, "timeTicks", ()=>(0, _ticksJs.timeTicks)); -parcelHelpers.export(exports, "timeTickInterval", ()=>(0, _ticksJs.timeTickInterval)); -var _intervalJs = require("./interval.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -var _ticksJs = require("./ticks.js"); - -},{"./interval.js":false,"./millisecond.js":"1aEMD","./second.js":"22XHb","./minute.js":"6j7Ml","./hour.js":"llDoC","./day.js":"ewpwG","./week.js":"gpqk4","./month.js":"gnhQl","./year.js":"flVyx","./ticks.js":"hqlJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l16eQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -const t0 = new Date, t1 = new Date; -function timeInterval(floori, offseti, count, field) { - function interval(date) { - return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date; - } - interval.floor = (date)=>{ - return floori(date = new Date(+date)), date; - }; - interval.ceil = (date)=>{ - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - interval.round = (date)=>{ - const d0 = interval(date), d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - interval.offset = (date, step)=>{ - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - interval.range = (start, stop, step)=>{ - const range = []; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - let previous; - do range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - interval.filter = (test)=>{ - return timeInterval((date)=>{ - if (date >= date) while(floori(date), !test(date))date.setTime(date - 1); - }, (date, step)=>{ - if (date >= date) { - if (step < 0) while(++step <= 0){ - while(offseti(date, -1), !test(date)); // eslint-disable-line no-empty - } - else while(--step >= 0){ - while(offseti(date, 1), !test(date)); // eslint-disable-line no-empty - } - } - }); - }; - if (count) { - interval.count = (start, end)=>{ - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - interval.every = (step)=>{ - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d)=>field(d) % step === 0 : (d)=>interval.count(0, d) % step === 0); - }; - } - return interval; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1aEMD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "millisecond", ()=>millisecond); -parcelHelpers.export(exports, "milliseconds", ()=>milliseconds); -var _intervalJs = require("./interval.js"); -const millisecond = (0, _intervalJs.timeInterval)(()=>{ -// noop -}, (date, step)=>{ - date.setTime(+date + step); -}, (start, end)=>{ - return end - start; -}); -// An optimized implementation for this simple case. -millisecond.every = (k)=>{ - k = Math.floor(k); - if (!isFinite(k) || !(k > 0)) return null; - if (!(k > 1)) return millisecond; - return (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(Math.floor(date / k) * k); - }, (date, step)=>{ - date.setTime(+date + step * k); - }, (start, end)=>{ - return (end - start) / k; - }); -}; -const milliseconds = millisecond.range; - -},{"./interval.js":"l16eQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"22XHb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "second", ()=>second); -parcelHelpers.export(exports, "seconds", ()=>seconds); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const second = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds()); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationSecond)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationSecond); -}, (date)=>{ - return date.getUTCSeconds(); -}); -const seconds = second.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1XXl6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "durationSecond", ()=>durationSecond); -parcelHelpers.export(exports, "durationMinute", ()=>durationMinute); -parcelHelpers.export(exports, "durationHour", ()=>durationHour); -parcelHelpers.export(exports, "durationDay", ()=>durationDay); -parcelHelpers.export(exports, "durationWeek", ()=>durationWeek); -parcelHelpers.export(exports, "durationMonth", ()=>durationMonth); -parcelHelpers.export(exports, "durationYear", ()=>durationYear); -const durationSecond = 1000; -const durationMinute = durationSecond * 60; -const durationHour = durationMinute * 60; -const durationDay = durationHour * 24; -const durationWeek = durationDay * 7; -const durationMonth = durationDay * 30; -const durationYear = durationDay * 365; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6j7Ml":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMinute", ()=>timeMinute); -parcelHelpers.export(exports, "timeMinutes", ()=>timeMinutes); -parcelHelpers.export(exports, "utcMinute", ()=>utcMinute); -parcelHelpers.export(exports, "utcMinutes", ()=>utcMinutes); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getMinutes(); -}); -const timeMinutes = timeMinute.range; -const utcMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCSeconds(0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getUTCMinutes(); -}); -const utcMinutes = utcMinute.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"llDoC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeHour", ()=>timeHour); -parcelHelpers.export(exports, "timeHours", ()=>timeHours); -parcelHelpers.export(exports, "utcHour", ()=>utcHour); -parcelHelpers.export(exports, "utcHours", ()=>utcHours); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond) - date.getMinutes() * (0, _durationJs.durationMinute)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getHours(); -}); -const timeHours = timeHour.range; -const utcHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMinutes(0, 0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getUTCHours(); -}); -const utcHours = utcHour.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewpwG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeDay", ()=>timeDay); -parcelHelpers.export(exports, "timeDays", ()=>timeDays); -parcelHelpers.export(exports, "utcDay", ()=>utcDay); -parcelHelpers.export(exports, "utcDays", ()=>utcDays); -parcelHelpers.export(exports, "unixDay", ()=>unixDay); -parcelHelpers.export(exports, "unixDays", ()=>unixDays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeDay = (0, _intervalJs.timeInterval)((date)=>date.setHours(0, 0, 0, 0), (date, step)=>date.setDate(date.getDate() + step), (start, end)=>(end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationDay), (date)=>date.getDate() - 1); -const timeDays = timeDay.range; -const utcDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return date.getUTCDate() - 1; -}); -const utcDays = utcDay.range; -const unixDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return Math.floor(date / (0, _durationJs.durationDay)); -}); -const unixDays = unixDay.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gpqk4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeSunday", ()=>timeSunday); -parcelHelpers.export(exports, "timeMonday", ()=>timeMonday); -parcelHelpers.export(exports, "timeTuesday", ()=>timeTuesday); -parcelHelpers.export(exports, "timeWednesday", ()=>timeWednesday); -parcelHelpers.export(exports, "timeThursday", ()=>timeThursday); -parcelHelpers.export(exports, "timeFriday", ()=>timeFriday); -parcelHelpers.export(exports, "timeSaturday", ()=>timeSaturday); -parcelHelpers.export(exports, "timeSundays", ()=>timeSundays); -parcelHelpers.export(exports, "timeMondays", ()=>timeMondays); -parcelHelpers.export(exports, "timeTuesdays", ()=>timeTuesdays); -parcelHelpers.export(exports, "timeWednesdays", ()=>timeWednesdays); -parcelHelpers.export(exports, "timeThursdays", ()=>timeThursdays); -parcelHelpers.export(exports, "timeFridays", ()=>timeFridays); -parcelHelpers.export(exports, "timeSaturdays", ()=>timeSaturdays); -parcelHelpers.export(exports, "utcSunday", ()=>utcSunday); -parcelHelpers.export(exports, "utcMonday", ()=>utcMonday); -parcelHelpers.export(exports, "utcTuesday", ()=>utcTuesday); -parcelHelpers.export(exports, "utcWednesday", ()=>utcWednesday); -parcelHelpers.export(exports, "utcThursday", ()=>utcThursday); -parcelHelpers.export(exports, "utcFriday", ()=>utcFriday); -parcelHelpers.export(exports, "utcSaturday", ()=>utcSaturday); -parcelHelpers.export(exports, "utcSundays", ()=>utcSundays); -parcelHelpers.export(exports, "utcMondays", ()=>utcMondays); -parcelHelpers.export(exports, "utcTuesdays", ()=>utcTuesdays); -parcelHelpers.export(exports, "utcWednesdays", ()=>utcWednesdays); -parcelHelpers.export(exports, "utcThursdays", ()=>utcThursdays); -parcelHelpers.export(exports, "utcFridays", ()=>utcFridays); -parcelHelpers.export(exports, "utcSaturdays", ()=>utcSaturdays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -function timeWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setDate(date.getDate() + step * 7); - }, (start, end)=>{ - return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationWeek); - }); -} -const timeSunday = timeWeekday(0); -const timeMonday = timeWeekday(1); -const timeTuesday = timeWeekday(2); -const timeWednesday = timeWeekday(3); -const timeThursday = timeWeekday(4); -const timeFriday = timeWeekday(5); -const timeSaturday = timeWeekday(6); -const timeSundays = timeSunday.range; -const timeMondays = timeMonday.range; -const timeTuesdays = timeTuesday.range; -const timeWednesdays = timeWednesday.range; -const timeThursdays = timeThursday.range; -const timeFridays = timeFriday.range; -const timeSaturdays = timeSaturday.range; -function utcWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step * 7); - }, (start, end)=>{ - return (end - start) / (0, _durationJs.durationWeek); - }); -} -const utcSunday = utcWeekday(0); -const utcMonday = utcWeekday(1); -const utcTuesday = utcWeekday(2); -const utcWednesday = utcWeekday(3); -const utcThursday = utcWeekday(4); -const utcFriday = utcWeekday(5); -const utcSaturday = utcWeekday(6); -const utcSundays = utcSunday.range; -const utcMondays = utcMonday.range; -const utcTuesdays = utcTuesday.range; -const utcWednesdays = utcWednesday.range; -const utcThursdays = utcThursday.range; -const utcFridays = utcFriday.range; -const utcSaturdays = utcSaturday.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gnhQl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMonth", ()=>timeMonth); -parcelHelpers.export(exports, "timeMonths", ()=>timeMonths); -parcelHelpers.export(exports, "utcMonth", ()=>utcMonth); -parcelHelpers.export(exports, "utcMonths", ()=>utcMonths); -var _intervalJs = require("./interval.js"); -const timeMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setMonth(date.getMonth() + step); -}, (start, end)=>{ - return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; -}, (date)=>{ - return date.getMonth(); -}); -const timeMonths = timeMonth.range; -const utcMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCMonth(date.getUTCMonth() + step); -}, (start, end)=>{ - return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; -}, (date)=>{ - return date.getUTCMonth(); -}); -const utcMonths = utcMonth.range; - -},{"./interval.js":"l16eQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flVyx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeYear", ()=>timeYear); -parcelHelpers.export(exports, "timeYears", ()=>timeYears); -parcelHelpers.export(exports, "utcYear", ()=>utcYear); -parcelHelpers.export(exports, "utcYears", ()=>utcYears); -var _intervalJs = require("./interval.js"); -const timeYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setFullYear(date.getFullYear() + step); -}, (start, end)=>{ - return end.getFullYear() - start.getFullYear(); -}, (date)=>{ - return date.getFullYear(); -}); -// An optimized implementation for this simple case. -timeYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setFullYear(Math.floor(date.getFullYear() / k) * k); - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setFullYear(date.getFullYear() + step * k); - }); -}; -const timeYears = timeYear.range; -const utcYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step); -}, (start, end)=>{ - return end.getUTCFullYear() - start.getUTCFullYear(); -}, (date)=>{ - return date.getUTCFullYear(); -}); -// An optimized implementation for this simple case. -utcYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step * k); - }); -}; -const utcYears = utcYear.range; - -},{"./interval.js":"l16eQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hqlJr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "utcTicks", ()=>utcTicks); -parcelHelpers.export(exports, "utcTickInterval", ()=>utcTickInterval); -parcelHelpers.export(exports, "timeTicks", ()=>timeTicks); -parcelHelpers.export(exports, "timeTickInterval", ()=>timeTickInterval); -var _d3Array = require("d3-array"); -var _durationJs = require("./duration.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -function ticker(year, month, week, day, hour, minute) { - const tickIntervals = [ - [ - (0, _secondJs.second), - 1, - (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 5, - 5 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 15, - 15 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 30, - 30 * (0, _durationJs.durationSecond) - ], - [ - minute, - 1, - (0, _durationJs.durationMinute) - ], - [ - minute, - 5, - 5 * (0, _durationJs.durationMinute) - ], - [ - minute, - 15, - 15 * (0, _durationJs.durationMinute) - ], - [ - minute, - 30, - 30 * (0, _durationJs.durationMinute) - ], - [ - hour, - 1, - (0, _durationJs.durationHour) - ], - [ - hour, - 3, - 3 * (0, _durationJs.durationHour) - ], - [ - hour, - 6, - 6 * (0, _durationJs.durationHour) - ], - [ - hour, - 12, - 12 * (0, _durationJs.durationHour) - ], - [ - day, - 1, - (0, _durationJs.durationDay) - ], - [ - day, - 2, - 2 * (0, _durationJs.durationDay) - ], - [ - week, - 1, - (0, _durationJs.durationWeek) - ], - [ - month, - 1, - (0, _durationJs.durationMonth) - ], - [ - month, - 3, - 3 * (0, _durationJs.durationMonth) - ], - [ - year, - 1, - (0, _durationJs.durationYear) - ] - ]; - function ticks(start, stop, count) { - const reverse = stop < start; - if (reverse) [start, stop] = [ - stop, - start - ]; - const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count); - const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop - return reverse ? ticks.reverse() : ticks; - } - function tickInterval(start, stop, count) { - const target = Math.abs(stop - start) / count; - const i = (0, _d3Array.bisector)(([, , step])=>step).right(tickIntervals, target); - if (i === tickIntervals.length) return year.every((0, _d3Array.tickStep)(start / (0, _durationJs.durationYear), stop / (0, _durationJs.durationYear), count)); - if (i === 0) return (0, _millisecondJs.millisecond).every(Math.max((0, _d3Array.tickStep)(start, stop, count), 1)); - const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - return t.every(step); - } - return [ - ticks, - tickInterval - ]; -} -const [utcTicks, utcTickInterval] = ticker((0, _yearJs.utcYear), (0, _monthJs.utcMonth), (0, _weekJs.utcSunday), (0, _dayJs.unixDay), (0, _hourJs.utcHour), (0, _minuteJs.utcMinute)); -const [timeTicks, timeTickInterval] = ticker((0, _yearJs.timeYear), (0, _monthJs.timeMonth), (0, _weekJs.timeSunday), (0, _dayJs.timeDay), (0, _hourJs.timeHour), (0, _minuteJs.timeMinute)); - -},{"d3-array":"6IwJG","./duration.js":"1XXl6","./millisecond.js":"1aEMD","./second.js":"22XHb","./minute.js":"6j7Ml","./hour.js":"llDoC","./day.js":"ewpwG","./week.js":"gpqk4","./month.js":"gnhQl","./year.js":"flVyx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"242jH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "timeFormat", ()=>(0, _defaultLocaleJs.timeFormat)); -parcelHelpers.export(exports, "timeParse", ()=>(0, _defaultLocaleJs.timeParse)); -parcelHelpers.export(exports, "utcFormat", ()=>(0, _defaultLocaleJs.utcFormat)); -parcelHelpers.export(exports, "utcParse", ()=>(0, _defaultLocaleJs.utcParse)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "isoFormat", ()=>(0, _isoFormatJsDefault.default)); -parcelHelpers.export(exports, "isoParse", ()=>(0, _isoParseJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _isoFormatJs = require("./isoFormat.js"); -var _isoFormatJsDefault = parcelHelpers.interopDefault(_isoFormatJs); -var _isoParseJs = require("./isoParse.js"); -var _isoParseJsDefault = parcelHelpers.interopDefault(_isoParseJs); - -},{"./defaultLocale.js":"hRBbX","./locale.js":"iUewg","./isoFormat.js":false,"./isoParse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hRBbX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var timeFormat; -var timeParse; -var utcFormat; -var utcParse; -defaultLocale({ - dateTime: "%x, %X", - date: "%-m/%-d/%Y", - time: "%-I:%M:%S %p", - periods: [ - "AM", - "PM" - ], - days: [ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday" - ], - shortDays: [ - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat" - ], - months: [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" - ], - shortMonths: [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - timeFormat = locale.format; - timeParse = locale.parse; - utcFormat = locale.utcFormat; - utcParse = locale.utcParse; - return locale; -} - -},{"./locale.js":"iUewg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUewg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatLocale); -var _d3Time = require("d3-time"); -function localDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); - date.setFullYear(d.y); - return date; - } - return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); -} -function utcDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); -} -function newDate(y, m, d) { - return { - y: y, - m: m, - d: d, - H: 0, - M: 0, - S: 0, - L: 0 - }; -} -function formatLocale(locale) { - var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; - var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); - var formats = { - "a": formatShortWeekday, - "A": formatWeekday, - "b": formatShortMonth, - "B": formatMonth, - "c": null, - "d": formatDayOfMonth, - "e": formatDayOfMonth, - "f": formatMicroseconds, - "g": formatYearISO, - "G": formatFullYearISO, - "H": formatHour24, - "I": formatHour12, - "j": formatDayOfYear, - "L": formatMilliseconds, - "m": formatMonthNumber, - "M": formatMinutes, - "p": formatPeriod, - "q": formatQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatSeconds, - "u": formatWeekdayNumberMonday, - "U": formatWeekNumberSunday, - "V": formatWeekNumberISO, - "w": formatWeekdayNumberSunday, - "W": formatWeekNumberMonday, - "x": null, - "X": null, - "y": formatYear, - "Y": formatFullYear, - "Z": formatZone, - "%": formatLiteralPercent - }; - var utcFormats = { - "a": formatUTCShortWeekday, - "A": formatUTCWeekday, - "b": formatUTCShortMonth, - "B": formatUTCMonth, - "c": null, - "d": formatUTCDayOfMonth, - "e": formatUTCDayOfMonth, - "f": formatUTCMicroseconds, - "g": formatUTCYearISO, - "G": formatUTCFullYearISO, - "H": formatUTCHour24, - "I": formatUTCHour12, - "j": formatUTCDayOfYear, - "L": formatUTCMilliseconds, - "m": formatUTCMonthNumber, - "M": formatUTCMinutes, - "p": formatUTCPeriod, - "q": formatUTCQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatUTCSeconds, - "u": formatUTCWeekdayNumberMonday, - "U": formatUTCWeekNumberSunday, - "V": formatUTCWeekNumberISO, - "w": formatUTCWeekdayNumberSunday, - "W": formatUTCWeekNumberMonday, - "x": null, - "X": null, - "y": formatUTCYear, - "Y": formatUTCFullYear, - "Z": formatUTCZone, - "%": formatLiteralPercent - }; - var parses = { - "a": parseShortWeekday, - "A": parseWeekday, - "b": parseShortMonth, - "B": parseMonth, - "c": parseLocaleDateTime, - "d": parseDayOfMonth, - "e": parseDayOfMonth, - "f": parseMicroseconds, - "g": parseYear, - "G": parseFullYear, - "H": parseHour24, - "I": parseHour24, - "j": parseDayOfYear, - "L": parseMilliseconds, - "m": parseMonthNumber, - "M": parseMinutes, - "p": parsePeriod, - "q": parseQuarter, - "Q": parseUnixTimestamp, - "s": parseUnixTimestampSeconds, - "S": parseSeconds, - "u": parseWeekdayNumberMonday, - "U": parseWeekNumberSunday, - "V": parseWeekNumberISO, - "w": parseWeekdayNumberSunday, - "W": parseWeekNumberMonday, - "x": parseLocaleDate, - "X": parseLocaleTime, - "y": parseYear, - "Y": parseFullYear, - "Z": parseZone, - "%": parseLiteralPercent - }; - // These recursive directive definitions must be deferred. - formats.x = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - function newFormat(specifier, formats) { - return function(date) { - var string = [], i = -1, j = 0, n = specifier.length, c, pad, format; - if (!(date instanceof Date)) date = new Date(+date); - while(++i < n)if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); - else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - string.push(specifier.slice(j, i)); - return string.join(""); - }; - } - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, undefined, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day; - if (i != string.length) return null; - // If a UNIX timestamp is specified, return it. - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); - // If this is utcParse, never use the local timezone. - if (Z && !("Z" in d)) d.Z = 0; - // The am-pm flag is 0 for AM, and 1 for PM. - if ("p" in d) d.H = d.H % 12 + d.p * 12; - // If the month was not specified, inherit from the quarter. - if (d.m === undefined) d.m = "q" in d ? d.q : 0; - // Convert day-of-week and week-of-year to day-of-year. - if ("V" in d) { - if (d.V < 1 || d.V > 53) return null; - if (!("w" in d)) d.w = 1; - if ("Z" in d) { - week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); - week = day > 4 || day === 0 ? (0, _d3Time.utcMonday).ceil(week) : (0, _d3Time.utcMonday)(week); - week = (0, _d3Time.utcDay).offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); - week = day > 4 || day === 0 ? (0, _d3Time.timeMonday).ceil(week) : (0, _d3Time.timeMonday)(week); - week = (0, _d3Time.timeDay).offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; - } - // If a time zone is specified, all fields are interpreted as UTC and then - // offset according to the specified time zone. - if ("Z" in d) { - d.H += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate(d); - } - // Otherwise, all fields are in local time. - return localDate(d); - }; - } - function parseSpecifier(d, specifier, string, j) { - var i = 0, n = specifier.length, m = string.length, c, parse; - while(i < n){ - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || (j = parse(d, string, j)) < 0) return -1; - } else if (c != string.charCodeAt(j++)) return -1; - } - return j; - } - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseLocaleDateTime(d, string, i) { - return parseSpecifier(d, locale_dateTime, string, i); - } - function parseLocaleDate(d, string, i) { - return parseSpecifier(d, locale_date, string, i); - } - function parseLocaleTime(d, string, i) { - return parseSpecifier(d, locale_time, string, i); - } - function formatShortWeekday(d) { - return locale_shortWeekdays[d.getDay()]; + function formatShortWeekday(d) { + return locale_shortWeekdays[d.getDay()]; } function formatWeekday(d) { - return locale_weekdays[d.getDay()]; + return locale_weekdays[d.getDay()]; } function formatShortMonth(d) { - return locale_shortMonths[d.getMonth()]; + return locale_shortMonths[d.getMonth()]; } function formatMonth(d) { - return locale_months[d.getMonth()]; + return locale_months[d.getMonth()]; } function formatPeriod(d) { - return locale_periods[+(d.getHours() >= 12)]; + return locale_periods[+(d.getHours() >= 12)]; } function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); + return 1 + ~~(d.getMonth() / 3); } function formatUTCShortWeekday(d) { - return locale_shortWeekdays[d.getUTCDay()]; + return locale_shortWeekdays[d.getUTCDay()]; } function formatUTCWeekday(d) { - return locale_weekdays[d.getUTCDay()]; + return locale_weekdays[d.getUTCDay()]; } function formatUTCShortMonth(d) { - return locale_shortMonths[d.getUTCMonth()]; + return locale_shortMonths[d.getUTCMonth()]; } function formatUTCMonth(d) { - return locale_months[d.getUTCMonth()]; + return locale_months[d.getUTCMonth()]; } function formatUTCPeriod(d) { - return locale_periods[+(d.getUTCHours() >= 12)]; + return locale_periods[+(d.getUTCHours() >= 12)]; } function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); + return 1 + ~~(d.getUTCMonth() / 3); } return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { - return specifier; - }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { - return specifier; - }; - return p; - }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { - return specifier; - }; - return f; - }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { - return specifier; - }; - return p; - } - }; -} -var pads = { - "-": "", - "_": " ", - "0": "0" -}, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; -function pad(value, fill, width) { - var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); -} -function requote(s) { + format: function(specifier) { + var f = newFormat(specifier += "", formats2); + f.toString = function() { + return specifier; + }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", false); + p.toString = function() { + return specifier; + }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { + return specifier; + }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier += "", true); + p.toString = function() { + return specifier; + }; + return p; + } + }; + } + var pads = { "-": "", "_": " ", "0": "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; + function pad(value2, fill2, width2) { + var sign2 = value2 < 0 ? "-" : "", string2 = (sign2 ? -value2 : value2) + "", length2 = string2.length; + return sign2 + (length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) + string2 : string2); + } + function requote(s) { return s.replace(requoteRe, "\\$&"); -} -function formatRe(names) { + } + function formatRe(names) { return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); -} -function formatLookup(names) { - return new Map(names.map((name, i)=>[ - name.toLowerCase(), - i - ])); -} -function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); + } + function formatLookup(names) { + return new Map(names.map((name, i) => [name.toLowerCase(), i])); + } + function parseWeekdayNumberSunday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); return n ? (d.w = +n[0], i + n[0].length) : -1; -} -function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); + } + function parseWeekdayNumberMonday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); return n ? (d.u = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseWeekNumberSunday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.U = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseWeekNumberISO(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.V = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseWeekNumberMonday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.W = +n[0], i + n[0].length) : -1; -} -function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); + } + function parseFullYear(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 4)); return n ? (d.y = +n[0], i + n[0].length) : -1; -} -function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; -} -function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); + } + function parseYear(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; + } + function parseZone(d, string2, i) { + var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string2.slice(i, i + 6)); return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; -} -function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); + } + function parseQuarter(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; -} -function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseMonthNumber(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.m = n[0] - 1, i + n[0].length) : -1; -} -function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseDayOfMonth(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.d = +n[0], i + n[0].length) : -1; -} -function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); + } + function parseDayOfYear(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; -} -function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseHour24(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.H = +n[0], i + n[0].length) : -1; -} -function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseMinutes(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.M = +n[0], i + n[0].length) : -1; -} -function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseSeconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.S = +n[0], i + n[0].length) : -1; -} -function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); + } + function parseMilliseconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); return n ? (d.L = +n[0], i + n[0].length) : -1; -} -function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; -} -function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); + } + function parseMicroseconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 6)); + return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; + } + function parseLiteralPercent(d, string2, i) { + var n = percentRe.exec(string2.slice(i, i + 1)); return n ? i + n[0].length : -1; -} -function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); + } + function parseUnixTimestamp(d, string2, i) { + var n = numberRe.exec(string2.slice(i)); return n ? (d.Q = +n[0], i + n[0].length) : -1; -} -function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); + } + function parseUnixTimestampSeconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i)); return n ? (d.s = +n[0], i + n[0].length) : -1; -} -function formatDayOfMonth(d, p) { + } + function formatDayOfMonth(d, p) { return pad(d.getDate(), p, 2); -} -function formatHour24(d, p) { + } + function formatHour24(d, p) { return pad(d.getHours(), p, 2); -} -function formatHour12(d, p) { + } + function formatHour12(d, p) { return pad(d.getHours() % 12 || 12, p, 2); -} -function formatDayOfYear(d, p) { - return pad(1 + (0, _d3Time.timeDay).count((0, _d3Time.timeYear)(d), d), p, 3); -} -function formatMilliseconds(d, p) { + } + function formatDayOfYear(d, p) { + return pad(1 + timeDay.count(timeYear(d), d), p, 3); + } + function formatMilliseconds(d, p) { return pad(d.getMilliseconds(), p, 3); -} -function formatMicroseconds(d, p) { + } + function formatMicroseconds(d, p) { return formatMilliseconds(d, p) + "000"; -} -function formatMonthNumber(d, p) { + } + function formatMonthNumber(d, p) { return pad(d.getMonth() + 1, p, 2); -} -function formatMinutes(d, p) { + } + function formatMinutes(d, p) { return pad(d.getMinutes(), p, 2); -} -function formatSeconds(d, p) { + } + function formatSeconds(d, p) { return pad(d.getSeconds(), p, 2); -} -function formatWeekdayNumberMonday(d) { + } + function formatWeekdayNumberMonday(d) { var day = d.getDay(); return day === 0 ? 7 : day; -} -function formatWeekNumberSunday(d, p) { - return pad((0, _d3Time.timeSunday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function dISO(d) { + } + function formatWeekNumberSunday(d, p) { + return pad(timeSunday.count(timeYear(d) - 1, d), p, 2); + } + function dISO(d) { var day = d.getDay(); - return day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); -} -function formatWeekNumberISO(d, p) { + return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); + } + function formatWeekNumberISO(d, p) { d = dISO(d); - return pad((0, _d3Time.timeThursday).count((0, _d3Time.timeYear)(d), d) + ((0, _d3Time.timeYear)(d).getDay() === 4), p, 2); -} -function formatWeekdayNumberSunday(d) { + return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); + } + function formatWeekdayNumberSunday(d) { return d.getDay(); -} -function formatWeekNumberMonday(d, p) { - return pad((0, _d3Time.timeMonday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function formatYear(d, p) { + } + function formatWeekNumberMonday(d, p) { + return pad(timeMonday.count(timeYear(d) - 1, d), p, 2); + } + function formatYear(d, p) { return pad(d.getFullYear() % 100, p, 2); -} -function formatYearISO(d, p) { + } + function formatYearISO(d, p) { d = dISO(d); return pad(d.getFullYear() % 100, p, 2); -} -function formatFullYear(d, p) { - return pad(d.getFullYear() % 10000, p, 4); -} -function formatFullYearISO(d, p) { + } + function formatFullYear(d, p) { + return pad(d.getFullYear() % 1e4, p, 4); + } + function formatFullYearISO(d, p) { var day = d.getDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); - return pad(d.getFullYear() % 10000, p, 4); -} -function formatZone(d) { + d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); + return pad(d.getFullYear() % 1e4, p, 4); + } + function formatZone(d) { var z = d.getTimezoneOffset(); return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); -} -function formatUTCDayOfMonth(d, p) { + } + function formatUTCDayOfMonth(d, p) { return pad(d.getUTCDate(), p, 2); -} -function formatUTCHour24(d, p) { + } + function formatUTCHour24(d, p) { return pad(d.getUTCHours(), p, 2); -} -function formatUTCHour12(d, p) { + } + function formatUTCHour12(d, p) { return pad(d.getUTCHours() % 12 || 12, p, 2); -} -function formatUTCDayOfYear(d, p) { - return pad(1 + (0, _d3Time.utcDay).count((0, _d3Time.utcYear)(d), d), p, 3); -} -function formatUTCMilliseconds(d, p) { + } + function formatUTCDayOfYear(d, p) { + return pad(1 + utcDay.count(utcYear(d), d), p, 3); + } + function formatUTCMilliseconds(d, p) { return pad(d.getUTCMilliseconds(), p, 3); -} -function formatUTCMicroseconds(d, p) { + } + function formatUTCMicroseconds(d, p) { return formatUTCMilliseconds(d, p) + "000"; -} -function formatUTCMonthNumber(d, p) { + } + function formatUTCMonthNumber(d, p) { return pad(d.getUTCMonth() + 1, p, 2); -} -function formatUTCMinutes(d, p) { + } + function formatUTCMinutes(d, p) { return pad(d.getUTCMinutes(), p, 2); -} -function formatUTCSeconds(d, p) { + } + function formatUTCSeconds(d, p) { return pad(d.getUTCSeconds(), p, 2); -} -function formatUTCWeekdayNumberMonday(d) { + } + function formatUTCWeekdayNumberMonday(d) { var dow = d.getUTCDay(); return dow === 0 ? 7 : dow; -} -function formatUTCWeekNumberSunday(d, p) { - return pad((0, _d3Time.utcSunday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function UTCdISO(d) { + } + function formatUTCWeekNumberSunday(d, p) { + return pad(utcSunday.count(utcYear(d) - 1, d), p, 2); + } + function UTCdISO(d) { var day = d.getUTCDay(); - return day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); -} -function formatUTCWeekNumberISO(d, p) { + return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); + } + function formatUTCWeekNumberISO(d, p) { d = UTCdISO(d); - return pad((0, _d3Time.utcThursday).count((0, _d3Time.utcYear)(d), d) + ((0, _d3Time.utcYear)(d).getUTCDay() === 4), p, 2); -} -function formatUTCWeekdayNumberSunday(d) { + return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); + } + function formatUTCWeekdayNumberSunday(d) { return d.getUTCDay(); -} -function formatUTCWeekNumberMonday(d, p) { - return pad((0, _d3Time.utcMonday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function formatUTCYear(d, p) { + } + function formatUTCWeekNumberMonday(d, p) { + return pad(utcMonday.count(utcYear(d) - 1, d), p, 2); + } + function formatUTCYear(d, p) { return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCYearISO(d, p) { + } + function formatUTCYearISO(d, p) { d = UTCdISO(d); return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCFullYear(d, p) { - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCFullYearISO(d, p) { + } + function formatUTCFullYear(d, p) { + return pad(d.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCFullYearISO(d, p) { var day = d.getUTCDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCZone() { + d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); + return pad(d.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCZone() { return "+0000"; -} -function formatLiteralPercent() { + } + function formatLiteralPercent() { return "%"; -} -function formatUnixTimestamp(d) { + } + function formatUnixTimestamp(d) { return +d; -} -function formatUnixTimestampSeconds(d) { - return Math.floor(+d / 1000); -} - -},{"d3-time":"8e7eR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9AXxu":[function(require,module,exports,__globalThis) { -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh <https://feross.org> - * @license MIT - */ /* eslint-disable no-proto */ 'use strict'; -const base64 = require("9c62938f1dccc73c"); -const ieee754 = require("aceacb6a4531a9d2"); -const customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null; -exports.Buffer = Buffer; -exports.SlowBuffer = SlowBuffer; -exports.INSPECT_MAX_BYTES = 50; -const K_MAX_LENGTH = 0x7fffffff; -exports.kMaxLength = K_MAX_LENGTH; -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); -function typedArraySupport() { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1); - const proto = { - foo: function() { - return 42; - } - }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } -} -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.buffer; - } -}); -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.byteOffset; - } -}); -function createBuffer(length) { - if (length > K_MAX_LENGTH) throw new RangeError('The value "' + length + '" is invalid for option "size"'); - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ function Buffer(arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') throw new TypeError('The "string" argument must be of type string. Received type number'); - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); -} -Buffer.poolSize = 8192 // not used by this implementation -; -function from(value, encodingOrOffset, length) { - if (typeof value === 'string') return fromString(value, encodingOrOffset); - if (ArrayBuffer.isView(value)) return fromArrayView(value); - if (value == null) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof value === 'number') throw new TypeError('The "value" argument must not be of type number. Received type number'); - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); -} -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ Buffer.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); -}; -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); -Object.setPrototypeOf(Buffer, Uint8Array); -function assertSize(size) { - if (typeof size !== 'number') throw new TypeError('"size" argument must be of type number'); - else if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); -} -function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) return createBuffer(size); - if (fill !== undefined) // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - return createBuffer(size); -} -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ Buffer.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); -}; -function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); -} -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ Buffer.allocUnsafe = function(size) { - return allocUnsafe(size); -}; -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ Buffer.allocUnsafeSlow = function(size) { - return allocUnsafe(size); -}; -function fromString(string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'; - if (!Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual); - return buf; -} -function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for(let i = 0; i < length; i += 1)buf[i] = array[i] & 255; - return buf; -} -function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); -} -function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); - let buf; - if (byteOffset === undefined && length === undefined) buf = new Uint8Array(array); - else if (length === undefined) buf = new Uint8Array(array, byteOffset); - else buf = new Uint8Array(array, byteOffset, length); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -function fromObject(obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) return buf; - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) return createBuffer(0); - return fromArrayLike(obj); - } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) return fromArrayLike(obj.data); -} -function checked(length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + ' bytes'); - return length | 0; -} -function SlowBuffer(length) { - if (+length != length) length = 0; - return Buffer.alloc(+length); -} -Buffer.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false - ; -}; -Buffer.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - if (a === b) return 0; - let x = a.length; - let y = b.length; - for(let i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; + } + function formatUnixTimestampSeconds(d) { + return Math.floor(+d / 1e3); + } + var locale$1; + var timeFormat$1; + var timeParse$1; + var utcFormat$1; + var utcParse$1; + defaultLocale$1({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + }); + function defaultLocale$1(definition2) { + locale$1 = formatLocale(definition2); + timeFormat$1 = locale$1.format; + timeParse$1 = locale$1.parse; + utcFormat$1 = locale$1.utcFormat; + utcParse$1 = locale$1.utcParse; + return locale$1; + } + function memoize(method2) { + const cache2 = {}; + return (spec) => cache2[spec] || (cache2[spec] = method2(spec)); + } + function trimZeroes(numberFormat, decimalChar) { + return (x2) => { + const str = numberFormat(x2), dec = str.indexOf(decimalChar); + if (dec < 0) return str; + let idx = rightmostDigit(str, dec); + const end = idx < str.length ? str.slice(idx) : ""; + while (--idx > dec) if (str[idx] !== "0") { + ++idx; break; + } + return str.slice(0, idx) + end; + }; + } + function rightmostDigit(str, dec) { + let i = str.lastIndexOf("e"), c2; + if (i > 0) return i; + for (i = str.length; --i > dec; ) { + c2 = str.charCodeAt(i); + if (c2 >= 48 && c2 <= 57) return i + 1; } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -Buffer.isEncoding = function isEncoding(encoding) { - switch(String(encoding).toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true; - default: - return false; - } -}; -Buffer.concat = function concat(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); - if (list.length === 0) return Buffer.alloc(0); - let i; - if (length === undefined) { - length = 0; - for(i = 0; i < list.length; ++i)length += list[i].length; - } - const buffer = Buffer.allocUnsafe(length); - let pos = 0; - for(i = 0; i < list.length; ++i){ - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf); - buf.copy(buffer, pos); - } else Uint8Array.prototype.set.call(buffer, buf, pos); - } else if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); - else buf.copy(buffer, pos); - pos += buf.length; - } - return buffer; -}; -function byteLength(string, encoding) { - if (Buffer.isBuffer(string)) return string.length; - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if (typeof string !== 'string') throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - // Use a for loop to avoid recursion - let loweredCase = false; - for(;;)switch(encoding){ - case 'ascii': - case 'latin1': - case 'binary': - return len; - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2; - case 'hex': - return len >>> 1; - case 'base64': - return base64ToBytes(string).length; - default: - if (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - ; - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } -} -Buffer.byteLength = byteLength; -function slowToString(encoding, start, end) { - let loweredCase = false; - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) start = 0; - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) return ''; - if (end === undefined || end > this.length) end = this.length; - if (end <= 0) return ''; - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0; - start >>>= 0; - if (end <= start) return ''; - if (!encoding) encoding = 'utf8'; - while(true)switch(encoding){ - case 'hex': - return hexSlice(this, start, end); - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end); - case 'ascii': - return asciiSlice(this, start, end); - case 'latin1': - case 'binary': - return latin1Slice(this, start, end); - case 'base64': - return base64Slice(this, start, end); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = (encoding + '').toLowerCase(); - loweredCase = true; - } -} -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true; -function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; -} -Buffer.prototype.swap16 = function swap16() { - const len = this.length; - if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits'); - for(let i = 0; i < len; i += 2)swap(this, i, i + 1); - return this; -}; -Buffer.prototype.swap32 = function swap32() { - const len = this.length; - if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits'); - for(let i = 0; i < len; i += 4){ - swap(this, i, i + 3); - swap(this, i + 1, i + 2); + } + function numberLocale(locale2) { + const format2 = memoize(locale2.format), formatPrefix2 = locale2.formatPrefix; + return { + format: format2, + formatPrefix: formatPrefix2, + formatFloat(spec) { + const s = formatSpecifier(spec || ","); + if (s.precision == null) { + s.precision = 12; + switch (s.type) { + case "%": + s.precision -= 2; + break; + case "e": + s.precision -= 1; + break; + } + return trimZeroes( + format2(s), + // number format + format2(".1f")(1)[1] + // decimal point character + ); + } else { + return format2(s); + } + }, + formatSpan(start, stop2, count2, specifier) { + specifier = formatSpecifier(specifier == null ? ",f" : specifier); + const step = tickStep(start, stop2, count2), value2 = Math.max(Math.abs(start), Math.abs(stop2)); + let precision; + if (specifier.precision == null) { + switch (specifier.type) { + case "s": { + if (!isNaN(precision = precisionPrefix(step, value2))) { + specifier.precision = precision; + } + return formatPrefix2(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (!isNaN(precision = precisionRound(step, value2))) { + specifier.precision = precision - (specifier.type === "e"); + } + break; + } + case "f": + case "%": { + if (!isNaN(precision = precisionFixed(step))) { + specifier.precision = precision - (specifier.type === "%") * 2; + } + break; + } + } + } + return format2(specifier); + } + }; + } + let defaultNumberLocale; + resetNumberFormatDefaultLocale(); + function resetNumberFormatDefaultLocale() { + return defaultNumberLocale = numberLocale({ + format: format$3, + formatPrefix + }); + } + function numberFormatLocale(definition2) { + return numberLocale(formatLocale$1(definition2)); + } + function numberFormatDefaultLocale(definition2) { + return arguments.length ? defaultNumberLocale = numberFormatLocale(definition2) : defaultNumberLocale; + } + function timeMultiFormat(format2, interval2, spec) { + spec = spec || {}; + if (!isObject$1(spec)) { + error(`Invalid time multi-format specifier: ${spec}`); } - return this; -}; -Buffer.prototype.swap64 = function swap64() { - const len = this.length; - if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits'); - for(let i = 0; i < len; i += 8){ - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); + const second2 = interval2(SECONDS), minute = interval2(MINUTES), hour = interval2(HOURS), day = interval2(DATE), week2 = interval2(WEEK), month = interval2(MONTH), quarter2 = interval2(QUARTER), year = interval2(YEAR), L = format2(spec[MILLISECONDS] || ".%L"), S = format2(spec[SECONDS] || ":%S"), M2 = format2(spec[MINUTES] || "%I:%M"), H = format2(spec[HOURS] || "%I %p"), d = format2(spec[DATE] || spec[DAY] || "%a %d"), w2 = format2(spec[WEEK] || "%b %d"), m2 = format2(spec[MONTH] || "%B"), q = format2(spec[QUARTER] || "%B"), y2 = format2(spec[YEAR] || "%Y"); + return (date2) => (second2(date2) < date2 ? L : minute(date2) < date2 ? S : hour(date2) < date2 ? M2 : day(date2) < date2 ? H : month(date2) < date2 ? week2(date2) < date2 ? d : w2 : year(date2) < date2 ? quarter2(date2) < date2 ? m2 : q : y2)(date2); + } + function timeLocale(locale2) { + const timeFormat2 = memoize(locale2.format), utcFormat2 = memoize(locale2.utcFormat); + return { + timeFormat: (spec) => isString(spec) ? timeFormat2(spec) : timeMultiFormat(timeFormat2, timeInterval, spec), + utcFormat: (spec) => isString(spec) ? utcFormat2(spec) : timeMultiFormat(utcFormat2, utcInterval, spec), + timeParse: memoize(locale2.parse), + utcParse: memoize(locale2.utcParse) + }; + } + let defaultTimeLocale; + resetTimeFormatDefaultLocale(); + function resetTimeFormatDefaultLocale() { + return defaultTimeLocale = timeLocale({ + format: timeFormat$1, + parse: timeParse$1, + utcFormat: utcFormat$1, + utcParse: utcParse$1 + }); + } + function timeFormatLocale(definition2) { + return timeLocale(formatLocale(definition2)); + } + function timeFormatDefaultLocale(definition2) { + return arguments.length ? defaultTimeLocale = timeFormatLocale(definition2) : defaultTimeLocale; + } + const createLocale = (number2, time2) => extend$1({}, number2, time2); + function locale(numberSpec, timeSpec) { + const number2 = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); + const time2 = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); + return createLocale(number2, time2); + } + function defaultLocale(numberSpec, timeSpec) { + const args = arguments.length; + if (args && args !== 2) { + error("defaultLocale expects either zero or two arguments."); } - return this; -}; -Buffer.prototype.toString = function toString() { - const length = this.length; - if (length === 0) return ''; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); -}; -Buffer.prototype.toLocaleString = Buffer.prototype.toString; -Buffer.prototype.equals = function equals(b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); - if (this === b) return true; - return Buffer.compare(this, b) === 0; -}; -Buffer.prototype.inspect = function inspect() { - let str = ''; - const max = exports.INSPECT_MAX_BYTES; - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); - if (this.length > max) str += ' ... '; - return '<Buffer ' + str + '>'; -}; -if (customInspectSymbol) Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; -Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) target = Buffer.from(target, target.offset, target.byteLength); - if (!Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (start === undefined) start = 0; - if (end === undefined) end = target ? target.length : 0; - if (thisStart === undefined) thisStart = 0; - if (thisEnd === undefined) thisEnd = this.length; - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError('out of range index'); - if (thisStart >= thisEnd && start >= end) return 0; - if (thisStart >= thisEnd) return -1; - if (start >= end) return 1; - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for(let i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; + return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); + } + function resetDefaultLocale() { + resetNumberFormatDefaultLocale(); + resetTimeFormatDefaultLocale(); + return defaultLocale(); + } + const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; + const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; + const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; + const fileProtocol = "file://"; + function loaderFactory(fs) { + return (options) => ({ + options: options || {}, + sanitize, + load: load$1, + fileAccess: false, + file: fileLoader(), + http: httpLoader + }); + } + async function load$1(uri, options) { + const opt = await this.sanitize(uri, options), url = opt.href; + return opt.localFile ? this.file(url) : this.http(url, options?.http); + } + async function sanitize(uri, options) { + options = extend$1({}, this.options, options); + const fileAccess = this.fileAccess, result = { + href: null + }; + let isFile, loadFile, base2; + const isAllowed = allowed_re.test(uri.replace(whitespace_re, "")); + if (uri == null || typeof uri !== "string" || !isAllowed) { + error("Sanitize failure, invalid URI: " + $(uri)); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1; - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff; - else if (byteOffset < -2147483648) byteOffset = -2147483648; - byteOffset = +byteOffset // Coerce to Number. - ; - if (numberIsNaN(byteOffset)) // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : buffer.length - 1; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - else byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - // Normalize val - if (typeof val === 'string') val = Buffer.from(val, encoding); - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) return -1; - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - ; - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - return arrayIndexOf(buffer, [ - val - ], byteOffset, encoding, dir); - } - throw new TypeError('val must be string, number or Buffer'); -} -function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase(); - if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) return -1; - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i) { - if (indexSize === 1) return buf[i]; - else return buf.readUInt16BE(i * indexSize); - } - let i; - if (dir) { - let foundIndex = -1; - for(i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for(i = byteOffset; i >= 0; i--){ - let found = true; - for(let j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - if (found) return i; - } + const hasProtocol = protocol_re.test(uri); + if ((base2 = options.baseURL) && !hasProtocol) { + if (!uri.startsWith("/") && !base2.endsWith("/")) { + uri = "/" + uri; + } + uri = base2 + uri; + } + loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === "file" || options.mode !== "http" && !hasProtocol && fileAccess; + if (isFile) { + uri = uri.slice(fileProtocol.length); + } else if (uri.startsWith("//")) { + if (options.defaultProtocol === "file") { + uri = uri.slice(2); + loadFile = true; + } else { + uri = (options.defaultProtocol || "http") + ":" + uri; + } } - return -1; -} -Buffer.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; -}; -Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); -}; -Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); -}; -function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) length = remaining; - else { - length = Number(length); - if (length > remaining) length = remaining; + Object.defineProperty(result, "localFile", { + value: !!loadFile + }); + result.href = uri; + if (options.target) { + result.target = options.target + ""; } - const strLen = string.length; - if (length > strLen / 2) length = strLen / 2; - let i; - for(i = 0; i < length; ++i){ - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; + if (options.rel) { + result.rel = options.rel + ""; } - return i; -} -function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); -} -function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); -} -function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); -} -function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); -} -Buffer.prototype.write = function write(string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8'; - length = this.length; - offset = 0; - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset; - length = this.length; - offset = 0; - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === undefined) encoding = 'utf8'; - } else { - encoding = length; - length = undefined; - } - } else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); - const remaining = this.length - offset; - if (length === undefined || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError('Attempt to write outside buffer bounds'); - if (!encoding) encoding = 'utf8'; - let loweredCase = false; - for(;;)switch(encoding){ - case 'hex': - return hexWrite(this, string, offset, length); - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length); - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; + if (options.context === "image" && options.crossOrigin) { + result.crossOrigin = options.crossOrigin + ""; } -}; -Buffer.prototype.toJSON = function toJSON() { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - }; -}; -function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) return base64.fromByteArray(buf); - else return base64.fromByteArray(buf.slice(start, end)); -} -function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while(i < end){ - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch(bytesPerSequence){ - case 1: - if (firstByte < 0x80) codePoint = firstByte; - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; - if (tempCodePoint > 0x7F) codePoint = tempCodePoint; - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) codePoint = tempCodePoint; - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) codePoint = tempCodePoint; - } - } + return result; + } + function fileLoader(fs) { + return fileReject; + } + async function fileReject() { + error("No file system access."); + } + async function httpLoader(url, options) { + const opt = extend$1({}, this.options.http, options), type2 = options && options.response, response = await fetch(url, opt); + return !response.ok ? error(response.status + "" + response.statusText) : isFunction(response[type2]) ? response[type2]() : response.text(); + } + const isValid = (_) => _ != null && _ === _; + const isBoolean = (_) => _ === "true" || _ === "false" || _ === true || _ === false; + const isDate = (_) => !Number.isNaN(Date.parse(_)); + const isNumber = (_) => !Number.isNaN(+_) && !(_ instanceof Date); + const isInteger = (_) => isNumber(_) && Number.isInteger(+_); + const typeParsers = { + boolean: toBoolean, + integer: toNumber, + number: toNumber, + date: toDate, + string: toString, + unknown: identity$7 + }; + const typeTests = [isBoolean, isInteger, isNumber, isDate]; + const typeList = ["boolean", "integer", "number", "date"]; + function inferType(values2, field2) { + if (!values2 || !values2.length) return "unknown"; + const n = values2.length, m2 = typeTests.length, a2 = typeTests.map((_, i) => i + 1); + for (let i = 0, t = 0, j, value2; i < n; ++i) { + value2 = field2 ? values2[i][field2] : values2[i]; + for (j = 0; j < m2; ++j) { + if (a2[j] && isValid(value2) && !typeTests[j](value2)) { + a2[j] = 0; + ++t; + if (t === typeTests.length) return "string"; } - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD; - bytesPerSequence = 1; - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000; - res.push(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | codePoint & 0x3FF; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); -} -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000; -function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - ; - // Decode in chunks to avoid "call stack size exceeded". - let res = ''; - let i = 0; - while(i < len)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - return res; -} -function asciiSlice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i] & 0x7F); - return ret; -} -function latin1Slice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); - return ret; -} -function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ''; - for(let i = start; i < end; ++i)out += hexSliceLookupTable[buf[i]]; - return out; -} -function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ''; - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for(let i = 0; i < bytes.length - 1; i += 2)res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - return res; -} -Buffer.prototype.slice = function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === undefined ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) start = len; - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) end = len; - if (end < start) end = start; - const newBuf = this.subarray(start, end); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype); - return newBuf; -}; -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); -} -Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - return val; -}; -Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset + --byteLength]; - let mul = 1; - while(byteLength > 0 && (mul *= 0x100))val += this[offset + --byteLength] * mul; - return val; -}; -Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; -}; -Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; -}; -Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; -}; -Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; -}; -Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); -}; -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const lo = first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 256 + this[++offset] * 2 ** 16 + last * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); -}); -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); -}); -Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let i = byteLength; - let mul = 1; - let val = this[offset + --i]; - while(i > 0 && (mul *= 0x100))val += this[offset + --i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 0x80)) return this[offset]; - return (0xff - this[offset] + 1) * -1; -}; -Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; -}; -Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; -}; -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = this[offset + 4] + this[offset + 5] * 256 + this[offset + 6] * 2 ** 16 + (last << 24 // Overflow - ); - return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); -}); -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last); -}); -Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); -}; -Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); -}; -Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); -}; -Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); -}; -function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError('Index out of range'); -} -Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let i = byteLength - 1; - let mul = 1; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; -} -function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; -} -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); + } } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - let i = byteLength - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128); - if (value < 0) value = 0xff + value + 1; - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; -}; -Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - if (value < 0) value = 0xffffffff + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); -} -function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; -} -Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); -}; -function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; -} -Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); -}; -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - // Copy 0 bytes; we're done - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - // Fatal error conditions - if (targetStart < 0) throw new RangeError('targetStart out of bounds'); - if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); - if (end < 0) throw new RangeError('sourceEnd out of bounds'); - // Are we oob? - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) end = target.length - targetStart + start; - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end); - else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); - return len; -}; -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill(val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === 'string') { - encoding = end; - end = this.length; - } - if (encoding !== undefined && typeof encoding !== 'string') throw new TypeError('encoding must be a string'); - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === 'utf8' && code < 128 || encoding === 'latin1') // Fast path: If `val` fits into a single byte, use that numeric value. - val = code; - } - } else if (typeof val === 'number') val = val & 255; - else if (typeof val === 'boolean') val = Number(val); - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) throw new RangeError('Out of range index'); - if (end <= start) return this; - start = start >>> 0; - end = end === undefined ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === 'number') for(i = start; i < end; ++i)this[i] = val; - else { - const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding); - const len = bytes.length; - if (len === 0) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; + return typeList[a2.reduce((u2, v) => u2 === 0 ? v : u2, 0) - 1]; + } + function inferTypes(data2, fields) { + return fields.reduce((types, field2) => { + types[field2] = inferType(data2, field2); + return types; + }, {}); + } + function delimitedFormat(delimiter) { + const parse2 = function(data2, format2) { + const delim = { + delimiter + }; + return dsv(data2, format2 ? extend$1(format2, delim) : delim); + }; + parse2.responseType = "text"; + return parse2; + } + function dsv(data2, format2) { + if (format2.header) { + data2 = format2.header.map($).join(format2.delimiter) + "\n" + data2; } - return this; -}; -// CUSTOM ERRORS -// ============= -// Simplified versions from Node, changed for Buffer-only usage -const errors = {}; -function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor(){ - super(); - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]`; - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - ; - // Reset the name to the actual name. - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }); - } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; -} -E('ERR_BUFFER_OUT_OF_BOUNDS', function(name) { - if (name) return `${name} is outside of buffer bounds`; - return 'Attempt to access memory outside buffer bounds'; -}, RangeError); -E('ERR_INVALID_ARG_TYPE', function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; -}, TypeError); -E('ERR_OUT_OF_RANGE', function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) received = addNumericalSeparator(String(input)); - else if (typeof input === 'bigint') { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) received = addNumericalSeparator(received); - received += 'n'; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; -}, RangeError); -function addNumericalSeparator(val) { - let res = ''; - let i = val.length; - const start = val[0] === '-' ? 1 : 0; - for(; i >= start + 4; i -= 3)res = `_${val.slice(i - 3, i)}${res}`; - return `${val.slice(0, i)}${res}`; -} -// CHECK FUNCTIONS -// =============== -function checkBounds(buf, offset, byteLength) { - validateNumber(offset, 'offset'); - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) boundsError(offset, buf.length - (byteLength + 1)); -} -function checkIntBI(value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : ''; - let range; - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; - else range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}`; - } else range = `>= ${min}${n} and <= ${max}${n}`; - throw new errors.ERR_OUT_OF_RANGE('value', range, value); - } - checkBounds(buf, offset, byteLength); -} -function validateNumber(value, name) { - if (typeof value !== 'number') throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value); -} -function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value); - } - if (length < 0) throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', `>= ${type ? 1 : 0} and <= ${length}`, value); -} -// HELPER FUNCTIONS -// ================ -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; -function base64clean(str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0]; - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, ''); - // Node converts strings with length < 2 to '' - if (str.length < 2) return ''; - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while(str.length % 4 !== 0)str = str + '='; - return str; -} -function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for(let i = 0; i < length; ++i){ - codePoint = string.charCodeAt(i); - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - // valid lead - leadSurrogate = codePoint; - continue; - } - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - leadSurrogate = codePoint; - continue; - } - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; - } else if (leadSurrogate) // valid bmp char, but last char was a lead - { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - } - leadSurrogate = null; - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break; - bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break; - bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break; - bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else throw new Error('Invalid code point'); - } - return bytes; -} -function asciiToBytes(str) { - const byteArray = []; - for(let i = 0; i < str.length; ++i)// Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF); - return byteArray; -} -function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for(let i = 0; i < str.length; ++i){ - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; -} -function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); -} -function blitBuffer(src, dst, offset, length) { - let i; - for(i = 0; i < length; ++i){ - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; + return dsvFormat(format2.delimiter).parse(data2 + ""); + } + dsv.responseType = "text"; + function isBuffer(_) { + return typeof Buffer === "function" && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; + } + function json(data2, format2) { + const prop = format2 && format2.property ? field$1(format2.property) : identity$7; + return isObject$1(data2) && !isBuffer(data2) ? parseJSON(prop(data2), format2) : prop(JSON.parse(data2)); + } + json.responseType = "json"; + function parseJSON(data2, format2) { + if (!isArray(data2) && isIterable(data2)) { + data2 = [...data2]; } - return i; -} -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; -} -function numberIsNaN(obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare - ; -} -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = function() { - const alphabet = '0123456789abcdef'; - const table = new Array(256); - for(let i = 0; i < 16; ++i){ - const i16 = i * 16; - for(let j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; - } - return table; -}(); -// Return not function with Error if BigInt not supported -function defineBigIntMethod(fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn; -} -function BufferBigIntNotDefined() { - throw new Error('BigInt not supported'); -} - -},{"9c62938f1dccc73c":"yVC7r","aceacb6a4531a9d2":"6kJAR"}],"yVC7r":[function(require,module,exports,__globalThis) { -'use strict'; -exports.byteLength = byteLength; -exports.toByteArray = toByteArray; -exports.fromByteArray = fromByteArray; -var lookup = []; -var revLookup = []; -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -for(var i = 0, len = code.length; i < len; ++i){ - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; -} -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62; -revLookup['_'.charCodeAt(0)] = 63; -function getLens(b64) { - var len = b64.length; - if (len % 4 > 0) throw new Error('Invalid string. Length must be a multiple of 4'); - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('='); - if (validLen === -1) validLen = len; - var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; - return [ - validLen, - placeHoldersLen - ]; -} -// base64 is 4/3 + up to two characters of the original data -function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i; - for(i = 0; i < len; i += 4){ - tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[curByte++] = tmp >> 16 & 0xFF; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - return arr; -} -function tripletToBase64(num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; -} -function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for(var i = start; i < end; i += 3){ - tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); - output.push(tripletToBase64(tmp)); - } - return output.join(''); -} -function fromByteArray(uint8) { - var tmp; - var len = uint8.length; - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - ; - var parts = []; - var maxChunkLength = 16383 // must be multiple of 3 - ; - // go through the array every three bytes, we'll deal with trailing stuff later - for(var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1]; - parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); - } - return parts.join(''); -} - -},{}],"6kJAR":[function(require,module,exports,__globalThis) { -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ exports.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for(; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for(; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - if (e === 0) e = 1 - eBias; - else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity; - else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; -exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; + return format2 && format2.copy ? JSON.parse(JSON.stringify(data2)) : data2; + } + const filters = { + interior: (a2, b2) => a2 !== b2, + exterior: (a2, b2) => a2 === b2 + }; + function topojson(data2, format2) { + let method2, object2, property2, filter2; + data2 = json(data2, format2); + if (format2 && format2.feature) { + method2 = feature; + property2 = format2.feature; + } else if (format2 && format2.mesh) { + method2 = mesh; + property2 = format2.mesh; + filter2 = filters[format2.filter]; + } else { + error("Missing TopoJSON feature or mesh parameter."); + } + object2 = (object2 = data2.objects[property2]) ? method2(data2, object2, filter2) : error("Invalid TopoJSON object: " + property2); + return object2 && object2.features || [object2]; + } + topojson.responseType = "json"; + const format$2 = { + dsv, + csv: delimitedFormat(","), + tsv: delimitedFormat(" "), + json, + topojson + }; + function formats$1(name, reader) { + if (arguments.length > 1) { + format$2[name] = reader; + return this; } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) value += rt / c; - else value += rt * Math.pow(2, 1 - eBias); - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; + return has$1(format$2, name) ? format$2[name] : null; + } + } + function responseType(type2) { + const f = formats$1(type2); + return f && f.responseType || "text"; + } + function read(data2, schema, timeParser, utcParser) { + schema = schema || {}; + const reader = formats$1(schema.type || "json"); + if (!reader) error("Unknown data format type: " + schema.type); + data2 = reader(data2, schema); + if (schema.parse) parse$6(data2, schema.parse, timeParser, utcParser); + if (has$1(data2, "columns")) delete data2.columns; + return data2; + } + function parse$6(data2, types, timeParser, utcParser) { + if (!data2.length) return; + const locale2 = timeFormatDefaultLocale(); + timeParser = timeParser || locale2.timeParse; + utcParser = utcParser || locale2.utcParse; + let fields = data2.columns || Object.keys(data2[0]), datum2, field2, i, j, n, m2; + if (types === "auto") types = inferTypes(data2, fields); + fields = Object.keys(types); + const parsers = fields.map((field3) => { + const type2 = types[field3]; + let parts, pattern; + if (type2 && (type2.startsWith("date:") || type2.startsWith("utc:"))) { + parts = type2.split(/:(.+)?/, 2); + pattern = parts[1]; + if (pattern[0] === "'" && pattern[pattern.length - 1] === "'" || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { + pattern = pattern.slice(1, -1); + } + const parse2 = parts[0] === "utc" ? utcParser : timeParser; + return parse2(pattern); + } + if (!typeParsers[type2]) { + throw Error("Illegal format pattern: " + field3 + ":" + type2); + } + return typeParsers[type2]; + }); + for (i = 0, n = data2.length, m2 = fields.length; i < n; ++i) { + datum2 = data2[i]; + for (j = 0; j < m2; ++j) { + field2 = fields[j]; + datum2[field2] = parsers[j](datum2[field2]); + } + } + } + const loader = loaderFactory(); + function UniqueList(idFunc) { + const $2 = idFunc || identity$7, list = [], ids = {}; + list.add = (_) => { + const id2 = $2(_); + if (!ids[id2]) { + ids[id2] = 1; + list.push(_); + } + return list; + }; + list.remove = (_) => { + const id2 = $2(_); + if (ids[id2]) { + ids[id2] = 0; + const idx = list.indexOf(_); + if (idx >= 0) list.splice(idx, 1); + } + return list; + }; + return list; + } + async function asyncCallback(df, callback) { + try { + await callback(df); + } catch (err) { + df.error(err); + } + } + const TUPLE_ID_KEY = Symbol("vega_id"); + let TUPLE_ID = 1; + function isTuple(t) { + return !!(t && tupleid(t)); + } + function tupleid(t) { + return t[TUPLE_ID_KEY]; + } + function setid(t, id2) { + t[TUPLE_ID_KEY] = id2; + return t; + } + function ingest$1(datum2) { + const t = datum2 === Object(datum2) ? datum2 : { + data: datum2 + }; + return tupleid(t) ? t : setid(t, TUPLE_ID++); + } + function derive(t) { + return rederive(t, ingest$1({})); + } + function rederive(t, d) { + for (const k in t) d[k] = t[k]; + return d; + } + function replace$1(t, d) { + return setid(d, tupleid(t)); + } + function stableCompare(cmp, f) { + return !cmp ? null : f ? (a2, b2) => cmp(a2, b2) || tupleid(f(a2)) - tupleid(f(b2)) : (a2, b2) => cmp(a2, b2) || tupleid(a2) - tupleid(b2); + } + function isChangeSet(v) { + return v && v.constructor === changeset; + } + function changeset() { + const add2 = [], rem2 = [], mod = [], remp = [], modp = []; + let clean = null, reflow2 = false; + return { + constructor: changeset, + insert(t) { + const d = array$5(t), n = d.length; + for (let i = 0; i < n; ++i) add2.push(d[i]); + return this; + }, + remove(t) { + const a2 = isFunction(t) ? remp : rem2, d = array$5(t), n = d.length; + for (let i = 0; i < n; ++i) a2.push(d[i]); + return this; + }, + modify(t, field2, value2) { + const m2 = { + field: field2, + value: constant$5(value2) + }; + if (isFunction(t)) { + m2.filter = t; + modp.push(m2); } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for(; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for(; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - buffer[offset + i - d] |= s * 128; -}; - -},{}],"gA9mK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "aggregate", ()=>Aggregate); -parcelHelpers.export(exports, "bin", ()=>Bin); -parcelHelpers.export(exports, "collect", ()=>Collect); -parcelHelpers.export(exports, "compare", ()=>Compare); -parcelHelpers.export(exports, "countpattern", ()=>CountPattern); -parcelHelpers.export(exports, "cross", ()=>Cross); -parcelHelpers.export(exports, "density", ()=>Density); -parcelHelpers.export(exports, "dotbin", ()=>DotBin); -parcelHelpers.export(exports, "expression", ()=>Expression); -parcelHelpers.export(exports, "extent", ()=>Extent); -parcelHelpers.export(exports, "facet", ()=>Facet); -parcelHelpers.export(exports, "field", ()=>Field); -parcelHelpers.export(exports, "filter", ()=>Filter); -parcelHelpers.export(exports, "flatten", ()=>Flatten); -parcelHelpers.export(exports, "fold", ()=>Fold); -parcelHelpers.export(exports, "formula", ()=>Formula); -parcelHelpers.export(exports, "generate", ()=>Generate); -parcelHelpers.export(exports, "impute", ()=>Impute); -parcelHelpers.export(exports, "joinaggregate", ()=>JoinAggregate); -parcelHelpers.export(exports, "kde", ()=>KDE); -parcelHelpers.export(exports, "key", ()=>Key); -parcelHelpers.export(exports, "load", ()=>Load); -parcelHelpers.export(exports, "lookup", ()=>Lookup); -parcelHelpers.export(exports, "multiextent", ()=>MultiExtent); -parcelHelpers.export(exports, "multivalues", ()=>MultiValues); -parcelHelpers.export(exports, "params", ()=>Params); -parcelHelpers.export(exports, "pivot", ()=>Pivot); -parcelHelpers.export(exports, "prefacet", ()=>PreFacet); -parcelHelpers.export(exports, "project", ()=>Project); -parcelHelpers.export(exports, "proxy", ()=>Proxy); -parcelHelpers.export(exports, "quantile", ()=>Quantile); -parcelHelpers.export(exports, "relay", ()=>Relay); -parcelHelpers.export(exports, "sample", ()=>Sample); -parcelHelpers.export(exports, "sequence", ()=>Sequence); -parcelHelpers.export(exports, "sieve", ()=>Sieve); -parcelHelpers.export(exports, "subflow", ()=>Subflow); -parcelHelpers.export(exports, "timeunit", ()=>TimeUnit); -parcelHelpers.export(exports, "tupleindex", ()=>TupleIndex); -parcelHelpers.export(exports, "values", ()=>Values); -parcelHelpers.export(exports, "window", ()=>Window); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaStatistics = require("vega-statistics"); -var _d3Array = require("d3-array"); -var _vegaTime = require("vega-time"); -function multikey(f) { - return (x)=>{ - const n = f.length; - let i = 1, k = String(f[0](x)); - for(; i < n; ++i)k += '|' + f[i](x); - return k; - }; -} -function groupkey(fields) { - return !fields || !fields.length ? function() { - return ''; - } : fields.length === 1 ? fields[0] : multikey(fields); -} -function measureName(op, field, as) { - return as || op + (!field ? '' : '_' + field); -} -const noop = ()=>{}; -const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 -}; -const AggregateOps = { - values: { - init: (m)=>m.cell.store = true, - value: (m)=>m.cell.data.values(), - idx: -1 - }, - count: { - value: (m)=>m.cell.num + m2.tuple = t; + mod.push(m2); + } + return this; + }, + encode(t, set2) { + if (isFunction(t)) modp.push({ + filter: t, + field: set2 + }); + else mod.push({ + tuple: t, + field: set2 + }); + return this; + }, + clean(value2) { + clean = value2; + return this; + }, + reflow() { + reflow2 = true; + return this; + }, + pulse(pulse2, tuples) { + const cur = {}, out = {}; + let i, n, m2, f, t, id2; + for (i = 0, n = tuples.length; i < n; ++i) { + cur[tupleid(tuples[i])] = 1; + } + for (i = 0, n = rem2.length; i < n; ++i) { + t = rem2[i]; + cur[tupleid(t)] = -1; + } + for (i = 0, n = remp.length; i < n; ++i) { + f = remp[i]; + tuples.forEach((t4) => { + if (f(t4)) cur[tupleid(t4)] = -1; + }); + } + for (i = 0, n = add2.length; i < n; ++i) { + t = add2[i]; + id2 = tupleid(t); + if (cur[id2]) { + cur[id2] = 1; + } else { + pulse2.add.push(ingest$1(add2[i])); + } + } + for (i = 0, n = tuples.length; i < n; ++i) { + t = tuples[i]; + if (cur[tupleid(t)] < 0) pulse2.rem.push(t); + } + function modify2(t4, f2, v) { + if (v) { + t4[f2] = v(t4); + } else { + pulse2.encode = f2; + } + if (!reflow2) out[tupleid(t4)] = t4; + } + for (i = 0, n = mod.length; i < n; ++i) { + m2 = mod[i]; + t = m2.tuple; + f = m2.field; + id2 = cur[tupleid(t)]; + if (id2 > 0) { + modify2(t, f, m2.value); + pulse2.modifies(f); + } + } + for (i = 0, n = modp.length; i < n; ++i) { + m2 = modp[i]; + f = m2.filter; + tuples.forEach((t4) => { + if (f(t4) && cur[tupleid(t4)] > 0) { + modify2(t4, m2.field, m2.value); + } + }); + pulse2.modifies(m2.field); + } + if (reflow2) { + pulse2.mod = rem2.length || remp.length ? tuples.filter((t4) => cur[tupleid(t4)] > 0) : tuples.slice(); + } else { + for (id2 in out) pulse2.mod.push(out[id2]); + } + if (clean || clean == null && (rem2.length || remp.length)) { + pulse2.clean(true); + } + return pulse2; + } + }; + } + const CACHE = "_:mod:_"; + function Parameters() { + Object.defineProperty(this, CACHE, { + writable: true, + value: {} + }); + } + Parameters.prototype = { + /** + * Set a parameter value. If the parameter value changes, the parameter + * will be recorded as modified. + * @param {string} name - The parameter name. + * @param {number} index - The index into an array-value parameter. Ignored if + * the argument is undefined, null or less than zero. + * @param {*} value - The parameter value to set. + * @param {boolean} [force=false] - If true, records the parameter as modified + * even if the value is unchanged. + * @return {Parameters} - This parameter object. + */ + set(name, index2, value2, force2) { + const o = this, v = o[name], mod = o[CACHE]; + if (index2 != null && index2 >= 0) { + if (v[index2] !== value2 || force2) { + v[index2] = value2; + mod[index2 + ":" + name] = -1; + mod[name] = -1; + } + } else if (v !== value2 || force2) { + o[name] = value2; + mod[name] = isArray(value2) ? 1 + value2.length : -1; + } + return o; }, - __count__: { - value: (m)=>m.missing + m.valid + /** + * Tests if one or more parameters has been modified. If invoked with no + * arguments, returns true if any parameter value has changed. If the first + * argument is array, returns trues if any parameter name in the array has + * changed. Otherwise, tests if the given name and optional array index has + * changed. + * @param {string} name - The parameter name to test. + * @param {number} [index=undefined] - The parameter array index to test. + * @return {boolean} - Returns true if a queried parameter was modified. + */ + modified(name, index2) { + const mod = this[CACHE]; + if (!arguments.length) { + for (const k in mod) { + if (mod[k]) return true; + } + return false; + } else if (isArray(name)) { + for (let k = 0; k < name.length; ++k) { + if (mod[name[k]]) return true; + } + return false; + } + return index2 != null && index2 >= 0 ? index2 + 1 < mod[name] || !!mod[index2 + ":" + name] : !!mod[name]; }, - missing: { - value: (m)=>m.missing + /** + * Clears the modification records. After calling this method, + * all parameters are considered unmodified. + */ + clear() { + this[CACHE] = {}; + return this; + } + }; + let OP_ID = 0; + const PULSE = "pulse", NO_PARAMS = new Parameters(); + const SKIP$1$1 = 1, MODIFIED = 2; + function Operator(init2, update2, params2, react) { + this.id = ++OP_ID; + this.value = init2; + this.stamp = -1; + this.rank = -1; + this.qrank = -1; + this.flags = 0; + if (update2) { + this._update = update2; + } + if (params2) this.parameters(params2, react); + } + function flag(bit) { + return function(state) { + const f = this.flags; + if (arguments.length === 0) return !!(f & bit); + this.flags = state ? f | bit : f & ~bit; + return this; + }; + } + Operator.prototype = { + /** + * Returns a list of target operators dependent on this operator. + * If this list does not exist, it is created and then returned. + * @return {UniqueList} + */ + targets() { + return this._targets || (this._targets = UniqueList(id)); }, - valid: { - value: (m)=>m.valid + /** + * Sets the value of this operator. + * @param {*} value - the value to set. + * @return {Number} Returns 1 if the operator value has changed + * according to strict equality, returns 0 otherwise. + */ + set(value2) { + if (this.value !== value2) { + this.value = value2; + return 1; + } else { + return 0; + } }, - sum: { - init: (m)=>m.sum = 0, - value: (m)=>m.valid ? m.sum : undefined, - add: (m, v)=>m.sum += +v, - rem: (m, v)=>m.sum -= v + /** + * Indicates that operator evaluation should be skipped on the next pulse. + * This operator will still propagate incoming pulses, but its update function + * will not be invoked. The skip flag is reset after every pulse, so calling + * this method will affect processing of the next pulse only. + */ + skip: flag(SKIP$1$1), + /** + * Indicates that this operator's value has been modified on its most recent + * pulse. Normally modification is checked via strict equality; however, in + * some cases it is more efficient to update the internal state of an object. + * In those cases, the modified flag can be used to trigger propagation. Once + * set, the modification flag persists across pulses until unset. The flag can + * be used with the last timestamp to test if a modification is recent. + */ + modified: flag(MODIFIED), + /** + * Sets the parameters for this operator. The parameter values are analyzed for + * operator instances. If found, this operator will be added as a dependency + * of the parameterizing operator. Operator values are dynamically marshalled + * from each operator parameter prior to evaluation. If a parameter value is + * an array, the array will also be searched for Operator instances. However, + * the search does not recurse into sub-arrays or object properties. + * @param {object} params - A hash of operator parameters. + * @param {boolean} [react=true] - A flag indicating if this operator should + * automatically update (react) when parameter values change. In other words, + * this flag determines if the operator registers itself as a listener on + * any upstream operators included in the parameters. + * @param {boolean} [initonly=false] - A flag indicating if this operator + * should calculate an update only upon its initial evaluation, then + * deregister dependencies and suppress all future update invocations. + * @return {Operator[]} - An array of upstream dependencies. + */ + parameters(params2, react, initonly) { + react = react !== false; + const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; + let name, value2, n, i; + const add2 = (name2, index2, value3) => { + if (value3 instanceof Operator) { + if (value3 !== this) { + if (react) value3.targets().add(this); + deps.push(value3); + } + argops.push({ + op: value3, + name: name2, + index: index2 + }); + } else { + argval.set(name2, index2, value3); + } + }; + for (name in params2) { + value2 = params2[name]; + if (name === PULSE) { + array$5(value2).forEach((op) => { + if (!(op instanceof Operator)) { + error("Pulse parameters must be operator instances."); + } else if (op !== this) { + op.targets().add(this); + deps.push(op); + } + }); + this.source = value2; + } else if (isArray(value2)) { + argval.set(name, -1, Array(n = value2.length)); + for (i = 0; i < n; ++i) add2(name, i, value2[i]); + } else { + add2(name, -1, value2); + } + } + this.marshall().clear(); + if (initonly) argops.initonly = true; + return deps; }, - product: { - init: (m)=>m.product = 1, - value: (m)=>m.valid ? m.product : undefined, - add: (m, v)=>m.product *= v, - rem: (m, v)=>m.product /= v + /** + * Internal method for marshalling parameter values. + * Visits each operator dependency to pull the latest value. + * @return {Parameters} A Parameters object to pass to the update function. + */ + marshall(stamp) { + const argval = this._argval || NO_PARAMS, argops = this._argops; + let item, i, op, mod; + if (argops) { + const n = argops.length; + for (i = 0; i < n; ++i) { + item = argops[i]; + op = item.op; + mod = op.modified() && op.stamp === stamp; + argval.set(item.name, item.index, op.value, mod); + } + if (argops.initonly) { + for (i = 0; i < n; ++i) { + item = argops[i]; + item.op.targets().remove(this); + } + this._argops = null; + this._update = null; + } + } + return argval; }, - mean: { - init: (m)=>m.mean = 0, - value: (m)=>m.valid ? m.mean : undefined, - add: (m, v)=>(m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v)=>(m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) + /** + * Detach this operator from the dataflow. + * Unregisters listeners on upstream dependencies. + */ + detach() { + const argops = this._argops; + let i, n, item, op; + if (argops) { + for (i = 0, n = argops.length; i < n; ++i) { + item = argops[i]; + op = item.op; + if (op._targets) { + op._targets.remove(this); + } + } + } + this.pulse = null; + this.source = null; }, - average: { - value: (m)=>m.valid ? m.mean : undefined, - req: [ - 'mean' - ], - idx: 1 + /** + * Delegate method to perform operator processing. + * Subclasses can override this method to perform custom processing. + * By default, it marshalls parameters and calls the update function + * if that function is defined. If the update function does not + * change the operator value then StopPropagation is returned. + * If no update function is defined, this method does nothing. + * @param {Pulse} pulse - the current dataflow pulse. + * @return The output pulse or StopPropagation. A falsy return value + * (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const update2 = this._update; + if (update2) { + const params2 = this.marshall(pulse2.stamp), v = update2.call(this, params2, pulse2); + params2.clear(); + if (v !== this.value) { + this.value = v; + } else if (!this.modified()) { + return pulse2.StopPropagation; + } + } }, - variance: { - init: (m)=>m.dev = 0, - value: (m)=>m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v)=>m.dev += m.mean_d * (v - m.mean), - rem: (m, v)=>m.dev -= m.mean_d * (v - m.mean), - req: [ - 'mean' - ], - idx: 1 + /** + * Run this operator for the current pulse. If this operator has already + * been run at (or after) the pulse timestamp, returns StopPropagation. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + rv = 0; + } else { + rv = this.evaluate(pulse2); + } + return this.pulse = rv || pulse2; + } + }; + function add$4(init2, update2, params2, react) { + let shift = 1, op; + if (init2 instanceof Operator) { + op = init2; + } else if (init2 && init2.prototype instanceof Operator) { + op = new init2(); + } else if (isFunction(init2)) { + op = new Operator(null, init2); + } else { + shift = 0; + op = new Operator(init2, update2); + } + this.rank(op); + if (shift) { + react = params2; + params2 = update2; + } + if (params2) this.connect(op, op.parameters(params2, react)); + this.touch(op); + return op; + } + function connect(target2, sources) { + const targetRank = target2.rank, n = sources.length; + for (let i = 0; i < n; ++i) { + if (targetRank < sources[i].rank) { + this.rerank(target2); + return; + } + } + } + let STREAM_ID = 0; + function EventStream(filter2, apply2, receive) { + this.id = ++STREAM_ID; + this.value = null; + if (receive) this.receive = receive; + if (filter2) this._filter = filter2; + if (apply2) this._apply = apply2; + } + function stream(filter2, apply2, receive) { + return new EventStream(filter2, apply2, receive); + } + EventStream.prototype = { + _filter: truthy, + _apply: identity$7, + targets() { + return this._targets || (this._targets = UniqueList(id)); + }, + consume(_) { + if (!arguments.length) return !!this._consume; + this._consume = !!_; + return this; + }, + receive(evt) { + if (this._filter(evt)) { + const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; + for (let i = 0; i < n; ++i) trg[i].receive(val); + if (this._consume) { + evt.preventDefault(); + evt.stopPropagation(); + } + } }, - variancep: { - value: (m)=>m.valid > 1 ? m.dev / m.valid : undefined, - req: [ - 'variance' - ], - idx: 2 + filter(filter2) { + const s = stream(filter2); + this.targets().add(s); + return s; + }, + apply(apply2) { + const s = stream(null, apply2); + this.targets().add(s); + return s; + }, + merge() { + const s = stream(); + this.targets().add(s); + for (let i = 0, n = arguments.length; i < n; ++i) { + arguments[i].targets().add(s); + } + return s; + }, + throttle(pause) { + let t = -1; + return this.filter(() => { + const now2 = Date.now(); + if (now2 - t > pause) { + t = now2; + return 1; + } else { + return 0; + } + }); }, - stdev: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: [ - 'variance' - ], - idx: 2 + debounce(delay) { + const s = stream(); + this.targets().add(stream(null, null, debounce$1(delay, (e) => { + const df = e.dataflow; + s.receive(e); + if (df && df.run) df.run(); + }))); + return s; + }, + between(a2, b2) { + let active = false; + a2.targets().add(stream(null, null, () => active = true)); + b2.targets().add(stream(null, null, () => active = false)); + return this.filter(() => active); + }, + detach() { + this._filter = truthy; + this._targets = null; + } + }; + function events$1(source2, type2, filter2, apply2) { + const df = this, s = stream(filter2, apply2), send = function(e) { + e.dataflow = df; + try { + s.receive(e); + } catch (error2) { + df.error(error2); + } finally { + df.run(); + } + }; + let sources; + if (typeof source2 === "string" && typeof document !== "undefined") { + sources = document.querySelectorAll(source2); + } else { + sources = array$5(source2); + } + const n = sources.length; + for (let i = 0; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + return s; + } + function parse$5(data2, format2) { + const locale2 = this.locale(); + return read(data2, format2, locale2.timeParse, locale2.utcParse); + } + function ingest(target2, data2, format2) { + data2 = this.parse(data2, format2); + return this.pulse(target2, this.changeset().insert(data2)); + } + async function request(url, format2) { + const df = this; + let status = 0, data2; + try { + data2 = await df.loader().load(url, { + context: "dataflow", + response: responseType(format2 && format2.type) + }); + try { + data2 = df.parse(data2, format2); + } catch (err) { + status = -2; + df.warn("Data ingestion failed", url, err); + } + } catch (err) { + status = -1; + df.warn("Loading failed", url, err); + } + return { + data: data2, + status + }; + } + async function preload(target2, url, format2) { + const df = this, pending = df._pending || loadPending(df); + pending.requests += 1; + const res = await df.request(url, format2); + df.pulse(target2, df.changeset().remove(truthy).insert(res.data || [])); + pending.done(); + return res; + } + function loadPending(df) { + let accept; + const pending = new Promise((a2) => accept = a2); + pending.requests = 0; + pending.done = () => { + if (--pending.requests === 0) { + df._pending = null; + accept(df); + } + }; + return df._pending = pending; + } + const SKIP$2 = { + skip: true + }; + function on(source2, target2, update2, params2, options) { + const fn2 = source2 instanceof Operator ? onOperator : onStream; + fn2(this, source2, target2, update2, params2, options); + return this; + } + function onStream(df, stream2, target2, update2, params2, options) { + const opt = extend$1({}, options, SKIP$2); + let func, op; + if (!isFunction(target2)) target2 = constant$5(target2); + if (update2 === void 0) { + func = (e) => df.touch(target2(e)); + } else if (isFunction(update2)) { + op = new Operator(null, update2, params2, false); + func = (e) => { + op.evaluate(e); + const t = target2(e), v = op.value; + isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); + }; + } else { + func = (e) => df.update(target2(e), update2, opt); + } + stream2.apply(func); + } + function onOperator(df, source2, target2, update2, params2, options) { + if (update2 === void 0) { + source2.targets().add(target2); + } else { + const opt = options || {}, op = new Operator(null, updater(target2, update2), params2, false); + op.modified(opt.force); + op.rank = source2.rank; + source2.targets().add(op); + if (target2) { + op.skip(true); + op.value = target2.value; + op.targets().add(target2); + df.connect(target2, [op]); + } + } + } + function updater(target2, update2) { + update2 = isFunction(update2) ? update2 : constant$5(update2); + return target2 ? function(_, pulse2) { + const value2 = update2(_, pulse2); + if (!target2.skip()) { + target2.skip(value2 !== this.value).value = value2; + } + return value2; + } : update2; + } + function rank(op) { + op.rank = ++this._rank; + } + function rerank(op) { + const queue = [op]; + let cur, list, i; + while (queue.length) { + this.rank(cur = queue.pop()); + if (list = cur._targets) { + for (i = list.length; --i >= 0; ) { + queue.push(cur = list[i]); + if (cur === op) error("Cycle detected in dataflow graph."); + } + } + } + } + const StopPropagation = {}; + const ADD = 1 << 0, REM = 1 << 1, MOD$1 = 1 << 2, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD$1, ALL = ADD | REM | MOD$1, REFLOW = 1 << 3, SOURCE = 1 << 4, NO_SOURCE = 1 << 5, NO_FIELDS = 1 << 6; + function Pulse(dataflow, stamp, encode2) { + this.dataflow = dataflow; + this.stamp = stamp == null ? -1 : stamp; + this.add = []; + this.rem = []; + this.mod = []; + this.fields = null; + this.encode = encode2 || null; + } + function materialize(data2, filter2) { + const out = []; + visitArray(data2, filter2, (_) => out.push(_)); + return out; + } + function filter$1(pulse2, flags) { + const map2 = {}; + pulse2.visit(flags, (t) => { + map2[tupleid(t)] = 1; + }); + return (t) => map2[tupleid(t)] ? null : t; + } + function addFilter(a2, b2) { + return a2 ? (t, i) => a2(t, i) && b2(t, i) : b2; + } + Pulse.prototype = { + /** + * Sentinel value indicating pulse propagation should stop. + */ + StopPropagation, + /** + * Boolean flag indicating ADD (added) tuples. + */ + ADD, + /** + * Boolean flag indicating REM (removed) tuples. + */ + REM, + /** + * Boolean flag indicating MOD (modified) tuples. + */ + MOD: MOD$1, + /** + * Boolean flag indicating ADD (added) and REM (removed) tuples. + */ + ADD_REM, + /** + * Boolean flag indicating ADD (added) and MOD (modified) tuples. + */ + ADD_MOD, + /** + * Boolean flag indicating ADD, REM and MOD tuples. + */ + ALL, + /** + * Boolean flag indicating all tuples in a data source + * except for the ADD, REM and MOD tuples. + */ + REFLOW, + /** + * Boolean flag indicating a 'pass-through' to a + * backing data source, ignoring ADD, REM and MOD tuples. + */ + SOURCE, + /** + * Boolean flag indicating that source data should be + * suppressed when creating a forked pulse. + */ + NO_SOURCE, + /** + * Boolean flag indicating that field modifications should be + * suppressed when creating a forked pulse. + */ + NO_FIELDS, + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. + * @return {Pulse} - The forked pulse instance. + * @see init + */ + fork(flags) { + return new Pulse(this.dataflow).init(this, flags); }, - stdevp: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: [ - 'variance' - ], - idx: 2 + /** + * Creates a copy of this pulse with new materialized array + * instances for the ADD, REM, MOD, and SOURCE arrays. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} - The cloned pulse instance. + * @see init + */ + clone() { + const p = this.fork(ALL); + p.add = p.add.slice(); + p.rem = p.rem.slice(); + p.mod = p.mod.slice(); + if (p.source) p.source = p.source.slice(); + return p.materialize(ALL | SOURCE); }, - stderr: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: [ - 'variance' - ], - idx: 2 + /** + * Returns a pulse that adds all tuples from a backing source. This is + * useful for cases where operators are added to a dataflow after an + * upstream data pipeline has already been processed, ensuring that + * new operators can observe all tuples within a stream. + * @return {Pulse} - A pulse instance with all source tuples included + * in the add array. If the current pulse already has all source + * tuples in its add array, it is returned directly. If the current + * pulse does not have a backing source, it is returned directly. + */ + addAll() { + let p = this; + const reuse = !p.source || p.add === p.rem || !p.rem.length && p.source.length === p.add.length; + if (reuse) { + return p; + } else { + p = new Pulse(this.dataflow).init(this); + p.add = p.source; + p.rem = []; + return p; + } }, - distinct: { - value: (m)=>m.cell.data.distinct(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Initialize this pulse based on the values of another pulse. This method + * is used internally by {@link fork} to initialize a new forked tuple. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {Pulse} src - The source pulse to copy from. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. By default, source data arrays are copied + * to the new pulse. Use the NO_SOURCE flag to enforce a null source. + * @return {Pulse} - Returns this Pulse instance. + */ + init(src, flags) { + const p = this; + p.stamp = src.stamp; + p.encode = src.encode; + if (src.fields && !(flags & NO_FIELDS)) { + p.fields = src.fields; + } + if (flags & ADD) { + p.addF = src.addF; + p.add = src.add; + } else { + p.addF = null; + p.add = []; + } + if (flags & REM) { + p.remF = src.remF; + p.rem = src.rem; + } else { + p.remF = null; + p.rem = []; + } + if (flags & MOD$1) { + p.modF = src.modF; + p.mod = src.mod; + } else { + p.modF = null; + p.mod = []; + } + if (flags & NO_SOURCE) { + p.srcF = null; + p.source = null; + } else { + p.srcF = src.srcF; + p.source = src.source; + if (src.cleans) p.cleans = src.cleans; + } + return p; }, - ci0: { - value: (m)=>m.cell.data.ci0(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Schedules a function to run after pulse propagation completes. + * @param {function} func - The function to run. + */ + runAfter(func) { + this.dataflow.runAfter(func); }, - ci1: { - value: (m)=>m.cell.data.ci1(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Indicates if tuples have been added, removed or modified. + * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. + * Defaults to ALL, returning true if any tuple type has changed. + * @return {boolean} - Returns true if one or more queried tuple types have + * changed, false otherwise. + */ + changed(flags) { + const f = flags || ALL; + return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD$1 && this.mod.length; }, - median: { - value: (m)=>m.cell.data.q2(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Forces a "reflow" of tuple values, such that all tuples in the backing + * source are added to the MOD set, unless already present in the ADD set. + * @param {boolean} [fork=false] - If true, returns a forked copy of this + * pulse, and invokes reflow on that derived pulse. + * @return {Pulse} - The reflowed pulse instance. + */ + reflow(fork) { + if (fork) return this.fork(ALL).reflow(); + const len2 = this.add.length, src = this.source && this.source.length; + if (src && src !== len2) { + this.mod = this.source; + if (len2) this.filter(MOD$1, filter$1(this, ADD)); + } + return this; }, - q1: { - value: (m)=>m.cell.data.q1(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Get/set metadata to pulse requesting garbage collection + * to reclaim currently unused resources. + */ + clean(value2) { + if (arguments.length) { + this.cleans = !!value2; + return this; + } else { + return this.cleans; + } }, - q3: { - value: (m)=>m.cell.data.q3(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Marks one or more data field names as modified to assist dependency + * tracking and incremental processing by transform operators. + * @param {string|Array<string>} _ - The field(s) to mark as modified. + * @return {Pulse} - This pulse instance. + */ + modifies(_) { + const hash = this.fields || (this.fields = {}); + if (isArray(_)) { + _.forEach((f) => hash[f] = true); + } else { + hash[_] = true; + } + return this; }, - min: { - init: (m)=>m.min = undefined, - value: (m)=>m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min, - add: (m, v)=>{ - if (v < m.min || m.min === undefined) m.min = v; - }, - rem: (m, v)=>{ - if (v <= m.min) m.min = NaN; - }, - req: [ - 'values' - ], - idx: 4 + /** + * Checks if one or more data fields have been modified during this pulse + * propagation timestamp. + * @param {string|Array<string>} _ - The field(s) to check for modified. + * @param {boolean} nomod - If true, will check the modified flag even if + * no mod tuples exist. If false (default), mod tuples must be present. + * @return {boolean} - Returns true if any of the provided fields has been + * marked as modified, false otherwise. + */ + modified(_, nomod) { + const fields = this.fields; + return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some((f) => fields[f]) : fields[_]; }, - max: { - init: (m)=>m.max = undefined, - value: (m)=>m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max, - add: (m, v)=>{ - if (v > m.max || m.max === undefined) m.max = v; - }, - rem: (m, v)=>{ - if (v >= m.max) m.max = NaN; - }, - req: [ - 'values' - ], - idx: 4 + /** + * Adds a filter function to one more tuple sets. Filters are applied to + * backing tuple arrays, to determine the actual set of tuples considered + * added, removed or modified. They can be used to delay materialization of + * a tuple set in order to avoid expensive array copies. In addition, the + * filter functions can serve as value transformers: unlike standard predicate + * function (which return boolean values), Pulse filters should return the + * actual tuple value to process. If a tuple set is already filtered, the + * new filter function will be appended into a conjuntive ('and') query. + * @param {number} flags - Flags indicating the tuple set(s) to filter. + * @param {function(*):object} filter - Filter function that will be applied + * to the tuple set array, and should return a data tuple if the value + * should be included in the tuple set, and falsy (or null) otherwise. + * @return {Pulse} - Returns this pulse instance. + */ + filter(flags, filter2) { + const p = this; + if (flags & ADD) p.addF = addFilter(p.addF, filter2); + if (flags & REM) p.remF = addFilter(p.remF, filter2); + if (flags & MOD$1) p.modF = addFilter(p.modF, filter2); + if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter2); + return p; }, - argmin: { - init: (m)=>m.argmin = undefined, - value: (m)=>m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t)=>{ - if (v < m.min) m.argmin = t; - }, - rem: (m, v)=>{ - if (v <= m.min) m.argmin = undefined; - }, - req: [ - 'min', - 'values' - ], - idx: 3 + /** + * Materialize one or more tuple sets in this pulse. If the tuple set(s) have + * a registered filter function, it will be applied and the tuple set(s) will + * be replaced with materialized tuple arrays. + * @param {number} flags - Flags indicating the tuple set(s) to materialize. + * @return {Pulse} - Returns this pulse instance. + */ + materialize(flags) { + flags = flags || ALL; + const p = this; + if (flags & ADD && p.addF) { + p.add = materialize(p.add, p.addF); + p.addF = null; + } + if (flags & REM && p.remF) { + p.rem = materialize(p.rem, p.remF); + p.remF = null; + } + if (flags & MOD$1 && p.modF) { + p.mod = materialize(p.mod, p.modF); + p.modF = null; + } + if (flags & SOURCE && p.srcF) { + p.source = p.source.filter(p.srcF); + p.srcF = null; + } + return p; }, - argmax: { - init: (m)=>m.argmax = undefined, - value: (m)=>m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t)=>{ - if (v > m.max) m.argmax = t; - }, - rem: (m, v)=>{ - if (v >= m.max) m.argmax = undefined; - }, - req: [ - 'max', - 'values' - ], - idx: 3 + /** + * Visit one or more tuple sets in this pulse. + * @param {number} flags - Flags indicating the tuple set(s) to visit. + * Legal values are ADD, REM, MOD and SOURCE (if a backing data source + * has been set). + * @param {function(object):*} - Visitor function invoked per-tuple. + * @return {Pulse} - Returns this pulse instance. + */ + visit(flags, visitor) { + const p = this, v = visitor; + if (flags & SOURCE) { + visitArray(p.source, p.srcF, v); + return p; + } + if (flags & ADD) visitArray(p.add, p.addF, v); + if (flags & REM) visitArray(p.rem, p.remF, v); + if (flags & MOD$1) visitArray(p.mod, p.modF, v); + const src = p.source; + if (flags & REFLOW && src) { + const sum2 = p.add.length + p.mod.length; + if (sum2 === src.length) ; + else if (sum2) { + visitArray(src, filter$1(p, ADD_MOD), v); + } else { + visitArray(src, p.srcF, v); + } + } + return p; + } + }; + function MultiPulse(dataflow, stamp, pulses, encode2) { + const p = this; + let c2 = 0; + this.dataflow = dataflow; + this.stamp = stamp; + this.fields = null; + this.encode = encode2 || null; + this.pulses = pulses; + for (const pulse2 of pulses) { + if (pulse2.stamp !== stamp) continue; + if (pulse2.fields) { + const hash = p.fields || (p.fields = {}); + for (const f in pulse2.fields) { + hash[f] = 1; + } + } + if (pulse2.changed(p.ADD)) c2 |= p.ADD; + if (pulse2.changed(p.REM)) c2 |= p.REM; + if (pulse2.changed(p.MOD)) c2 |= p.MOD; + } + this.changes = c2; + } + inherits(MultiPulse, Pulse, { + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} + */ + fork(flags) { + const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); + if (flags !== void 0) { + if (flags & p.ADD) this.visit(p.ADD, (t) => p.add.push(t)); + if (flags & p.REM) this.visit(p.REM, (t) => p.rem.push(t)); + if (flags & p.MOD) this.visit(p.MOD, (t) => p.mod.push(t)); + } + return p; }, - exponential: { - init: (m, r)=>{ - m.exp = 0; - m.exp_r = r; - }, - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) / (1 - m.exp_r ** m.valid) : undefined, - add: (m, v)=>m.exp = m.exp_r * m.exp + v, - rem: (m, v)=>m.exp = (m.exp - v / m.exp_r ** (m.valid - 1)) / m.exp_r + changed(flags) { + return this.changes & flags; }, - exponentialb: { - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) : undefined, - req: [ - 'exponential' - ], - idx: 1 - } -}; -const ValidAggregateOps = Object.keys(AggregateOps).filter((d)=>d !== '__count__'); -function measure(key, value) { - return (out, aggregate_param)=>(0, _vegaUtil.extend)({ - name: key, - aggregate_param: aggregate_param, - out: out || key - }, base_op, value); -} -[ - ...ValidAggregateOps, - '__count__' -].forEach((key)=>{ - AggregateOps[key] = measure(key, AggregateOps[key]); -}); -function createMeasure(op, param, name) { - return AggregateOps[op](name, param); -} -function compareIndex(a, b) { - return a.idx - b.idx; -} -function resolve(agg) { - const map = {}; - agg.forEach((a)=>map[a.name] = a); - const getreqs = (a)=>{ - if (!a.req) return; - a.req.forEach((key)=>{ - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - return Object.values(map).sort(compareIndex); -} -function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach((op)=>op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); -} -function add(v, t) { - if (v == null || v === '') { - ++this.missing; - return; + modified(_) { + const p = this, fields = p.fields; + return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some((f) => fields[f]) : fields[_]; + }, + filter() { + error("MultiPulse does not support filtering."); + }, + materialize() { + error("MultiPulse does not support materialization."); + }, + visit(flags, visitor) { + const p = this, pulses = p.pulses, n = pulses.length; + let i = 0; + if (flags & p.SOURCE) { + for (; i < n; ++i) { + pulses[i].visit(flags, visitor); + } + } else { + for (; i < n; ++i) { + if (pulses[i].stamp === p.stamp) { + pulses[i].visit(flags, visitor); + } + } + } + return p; } - if (v !== v) return; - ++this.valid; - this._ops.forEach((op)=>op.add(this, v, t)); -} -function rem(v, t) { - if (v == null || v === '') { - --this.missing; - return; + }); + async function evaluate(encode2, prerun, postrun) { + const df = this, async = []; + if (df._pulse) return reentrant(df); + if (df._pending) await df._pending; + if (prerun) await asyncCallback(df, prerun); + if (!df._touched.length) { + df.debug("Dataflow invoked, but nothing to do."); + return df; } - if (v !== v) return; - --this.valid; - this._ops.forEach((op)=>op.rem(this, v, t)); -} -function set(t) { - this._out.forEach((op)=>t[op.out] = op.value(this)); - return t; -} -function compileMeasures(agg, field) { - const get = field || (0, _vegaUtil.identity), ops = resolve(agg), out = agg.slice().sort(compareIndex); - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - ctr.prototype.init = init; - ctr.prototype.add = add; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map((op)=>op.out); - return ctr; -} -function TupleStore(key) { - this._key = key ? (0, _vegaUtil.field)(key) : (0, _vegaDataflow.tupleid); - this.reset(); -} -const prototype$1 = TupleStore.prototype; -prototype$1.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; -}; -prototype$1.add = function(v) { - this._add.push(v); -}; -prototype$1.rem = function(v) { - this._rem.push(v); -}; -prototype$1.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - const a = this._add, r = this._rem, k = this._key, n = a.length, m = r.length, x = Array(n - m), map = {}; - let i, j, v; - // use unique key field to clear removed values - for(i = 0; i < m; ++i)map[k(r[i])] = 1; - for(i = 0, j = 0; i < n; ++i)if (map[k(v = a[i])]) map[k(v)] = 0; - else x[j++] = v; - this._rem = []; - return this._add = x; -}; -// memoizing statistics methods -prototype$1.distinct = function(get) { - const v = this.values(), map = {}; - let n = v.length, count = 0, s; - while(--n >= 0){ - s = get(v[n]) + ''; - if (!(0, _vegaUtil.hasOwnProperty)(map, s)) { - map[s] = 1; - ++count; - } - } - return count; -}; -prototype$1.extent = function(get) { - if (this._get !== get || !this._ext) { - const v = this.values(), i = (0, _vegaUtil.extentIndex)(v, get); - this._ext = [ - v[i[0]], - v[i[1]] - ]; - this._get = get; + const stamp = ++df._clock; + df._pulse = new Pulse(df, stamp, encode2); + df._touched.forEach((op2) => df._enqueue(op2, true)); + df._touched = UniqueList(id); + let count2 = 0, op, next, error2; + try { + while (df._heap.size() > 0) { + op = df._heap.pop(); + if (op.rank !== op.qrank) { + df._enqueue(op, true); + continue; + } + next = op.run(df._getPulse(op, encode2)); + if (next.then) { + next = await next; + } else if (next.async) { + async.push(next.async); + next = StopPropagation; + } + if (next !== StopPropagation) { + if (op._targets) op._targets.forEach((op2) => df._enqueue(op2)); + } + ++count2; + } + } catch (err) { + df._heap.clear(); + error2 = err; } - return this._ext; -}; -prototype$1.argmin = function(get) { - return this.extent(get)[0] || {}; -}; -prototype$1.argmax = function(get) { - return this.extent(get)[1] || {}; -}; -prototype$1.min = function(get) { - const m = this.extent(get)[0]; - return m != null ? get(m) : undefined; -}; -prototype$1.max = function(get) { - const m = this.extent(get)[1]; - return m != null ? get(m) : undefined; -}; -prototype$1.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = (0, _vegaStatistics.quartiles)(this.values(), get); - this._get = get; + df._input = {}; + df._pulse = null; + df.debug(`Pulse ${stamp}: ${count2} operators`); + if (error2) { + df._postrun = []; + df.error(error2); } - return this._q; -}; -prototype$1.q1 = function(get) { - return this.quartile(get)[0]; -}; -prototype$1.q2 = function(get) { - return this.quartile(get)[1]; -}; -prototype$1.q3 = function(get) { - return this.quartile(get)[2]; -}; -prototype$1.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = (0, _vegaStatistics.bootstrapCI)(this.values(), 1000, 0.05, get); - this._get = get; + if (df._postrun.length) { + const pr = df._postrun.sort((a2, b2) => b2.priority - a2.priority); + df._postrun = []; + for (let i = 0; i < pr.length; ++i) { + await asyncCallback(df, pr[i].callback); + } } - return this._ci; -}; -prototype$1.ci0 = function(get) { - return this.ci(get)[0]; -}; -prototype$1.ci1 = function(get) { - return this.ci(get)[1]; -}; -/** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<function(object): *>} [params.fields] - An array of accessors to aggregate. - * @param {Array<string>} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameters for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ function Aggregate(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names -} -Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'drop', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'cross', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Aggregate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const aggr = this, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), mod = _.modified(); - aggr.stamp = out.stamp; - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : Object.create(null); - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - if (pulse.clean() && aggr._drop) out.clean(true).runAfter(()=>this.clean()); - return aggr.changes(out); - }, - cross () { - const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(()=>({})), n = dims.length; - // collect all group-by domain values - function collect(cells) { - let key, i, t, v; - for(key in cells){ - t = cells[key].tuple; - for(i = 0; i < n; ++i)vals[i][v = t[dims[i]]] = v; - } - } - collect(aggr._prev); - collect(curr); - // iterate over key cross-product, create cells as needed - function generate(base, tuple, index) { - const name = dims[index], v = vals[index++]; - for(const k in v){ - const key = base ? base + '|' + k : k; - tuple[name] = v[k]; - if (index < n) generate(key, tuple, index); - else if (!curr[key]) aggr.cell(key, tuple); - } - } - generate('', {}, 0); - }, - init (_) { - // initialize input and output fields - const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; - function inputVisit(get) { - const fields = (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(get)), n = fields.length; - let i = 0, f; - for(; i < n; ++i)if (!inputMap[f = fields[i]]) { - inputMap[f] = 1; - inputs.push(f); - } - } - // initialize group-by dimensions - this._dims = (0, _vegaUtil.array)(_.groupby); - this._dnames = this._dims.map((d)=>{ - const dname = (0, _vegaUtil.accessorName)(d); - inputVisit(d); - outputs.push(dname); - return dname; + if (postrun) await asyncCallback(df, postrun); + if (async.length) { + Promise.all(async).then((cb) => df.runAsync(null, () => { + cb.forEach((f) => { + try { + f(df); + } catch (err) { + df.error(err); + } }); - this.cellkey = _.key ? _.key : groupkey(this._dims); - // initialize aggregate measures - this._countOnly = true; - this._counts = []; - this._measures = []; - const fields = _.fields || [ - null - ], ops = _.ops || [ - 'count' - ], aggregate_params = _.aggregate_params || [ - null - ], as = _.as || [], n = fields.length, map = {}; - let field, op, aggregate_param, m, mname, outname, i; - if (n !== ops.length) (0, _vegaUtil.error)('Unmatched number of fields and aggregate ops.'); - for(i = 0; i < n; ++i){ - field = fields[i]; - op = ops[i]; - aggregate_param = aggregate_params[i] || null; - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - mname = (0, _vegaUtil.accessorName)(field); - outname = measureName(op, mname, as[i]); - outputs.push(outname); - if (op === 'count') { - this._counts.push(outname); - continue; - } - m = map[mname]; - if (!m) { - inputVisit(field); - m = map[mname] = []; - m.field = field; - this._measures.push(m); - } - if (op !== 'count') this._countOnly = false; - m.push(createMeasure(op, aggregate_param, outname)); - } - this._measures = this._measures.map((m)=>compileMeasures(m, m.field)); - return Object.create(null); // aggregation cells (this.value) - }, - // -- Cell Management ----- - cellkey: groupkey(), - cell (key, t) { - let cell = this.value[key]; - if (!cell) { - cell = this.value[key] = this.newcell(key, t); - this._adds[this._alen++] = cell; - } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._adds[this._alen++] = cell; - } else if (cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._mods[this._mlen++] = cell; - } - return cell; - }, - newcell (key, t) { - const cell = { - key: key, - num: 0, - agg: null, - tuple: this.newtuple(t, this._prev && this._prev[key]), - stamp: this.stamp, - store: false - }; - if (!this._countOnly) { - const measures = this._measures, n = measures.length; - cell.agg = Array(n); - for(let i = 0; i < n; ++i)cell.agg[i] = new measures[i](cell); + })); + } + return df; + } + async function runAsync(encode2, prerun, postrun) { + while (this._running) await this._running; + const clear = () => this._running = null; + (this._running = this.evaluate(encode2, prerun, postrun)).then(clear, clear); + return this._running; + } + function run(encode2, prerun, postrun) { + return this._pulse ? reentrant(this) : (this.evaluate(encode2, prerun, postrun), this); + } + function runAfter(callback, enqueue2, priority) { + if (this._pulse || enqueue2) { + this._postrun.push({ + priority: priority || 0, + callback + }); + } else { + try { + callback(this); + } catch (err) { + this.error(err); + } + } + } + function reentrant(df) { + df.error("Dataflow already running. Use runAsync() to chain invocations."); + return df; + } + function enqueue(op, force2) { + const q = op.stamp < this._clock; + if (q) op.stamp = this._clock; + if (q || force2) { + op.qrank = op.rank; + this._heap.push(op); + } + } + function getPulse(op, encode2) { + const s = op.source, stamp = this._clock; + return s && isArray(s) ? new MultiPulse(this, stamp, s.map((_) => _.pulse), encode2) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); + } + function singlePulse(p, s) { + if (s && s.stamp === p.stamp) { + return s; + } + p = p.fork(); + if (s && s !== StopPropagation) { + p.source = s.source; + } + return p; + } + const NO_OPT = { + skip: false, + force: false + }; + function touch(op, options) { + const opt = options || NO_OPT; + if (this._pulse) { + this._enqueue(op); + } else { + this._touched.add(op); + } + if (opt.skip) op.skip(true); + return this; + } + function update$6(op, value2, options) { + const opt = options || NO_OPT; + if (op.set(value2) || opt.force) { + this.touch(op, opt); + } + return this; + } + function pulse(op, changeset2, options) { + this.touch(op, options || NO_OPT); + const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; + p.target = op; + this._input[op.id] = changeset2.pulse(p, t); + return this; + } + function Heap(cmp) { + let nodes = []; + return { + clear: () => nodes = [], + size: () => nodes.length, + peek: () => nodes[0], + push: (x2) => { + nodes.push(x2); + return siftdown(nodes, 0, nodes.length - 1, cmp); + }, + pop: () => { + const last = nodes.pop(); + let item; + if (nodes.length) { + item = nodes[0]; + nodes[0] = last; + siftup(nodes, 0, cmp); + } else { + item = last; } - if (cell.store) cell.data = new TupleStore(); - return cell; + return item; + } + }; + } + function siftdown(array2, start, idx, cmp) { + let parent, pidx; + const item = array2[idx]; + while (idx > start) { + pidx = idx - 1 >> 1; + parent = array2[pidx]; + if (cmp(item, parent) < 0) { + array2[idx] = parent; + idx = pidx; + continue; + } + break; + } + return array2[idx] = item; + } + function siftup(array2, idx, cmp) { + const start = idx, end = array2.length, item = array2[idx]; + let cidx = (idx << 1) + 1, ridx; + while (cidx < end) { + ridx = cidx + 1; + if (ridx < end && cmp(array2[cidx], array2[ridx]) >= 0) { + cidx = ridx; + } + array2[idx] = array2[cidx]; + idx = cidx; + cidx = (idx << 1) + 1; + } + array2[idx] = item; + return siftdown(array2, start, idx, cmp); + } + function Dataflow() { + this.logger(logger()); + this.logLevel(Error$1); + this._clock = 0; + this._rank = 0; + this._locale = defaultLocale(); + try { + this._loader = loader(); + } catch (e) { + } + this._touched = UniqueList(id); + this._input = {}; + this._pulse = null; + this._heap = Heap((a2, b2) => a2.qrank - b2.qrank); + this._postrun = []; + } + function logMethod(method2) { + return function() { + return this._log[method2].apply(this, arguments); + }; + } + Dataflow.prototype = { + /** + * The current timestamp of this dataflow. This value reflects the + * timestamp of the previous dataflow run. The dataflow is initialized + * with a stamp value of 0. The initial run of the dataflow will have + * a timestap of 1, and so on. This value will match the + * {@link Pulse.stamp} property. + * @return {number} - The current timestamp value. + */ + stamp() { + return this._clock; }, - newtuple (t, p) { - const names = this._dnames, dims = this._dims, n = dims.length, x = {}; - for(let i = 0; i < n; ++i)x[names[i]] = dims[i](t); - return p ? (0, _vegaDataflow.replace)(p.tuple, x) : (0, _vegaDataflow.ingest)(x); + /** + * Gets or sets the loader instance to use for data file loading. A + * loader object must provide a "load" method for loading files and a + * "sanitize" method for checking URL/filename validity. Both methods + * should accept a URI and options hash as arguments, and return a Promise + * that resolves to the loaded file contents (load) or a hash containing + * sanitized URI data with the sanitized url assigned to the "href" property + * (sanitize). + * @param {object} _ - The loader instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current loader instance. Otherwise returns this Dataflow instance. + */ + loader(_) { + if (arguments.length) { + this._loader = _; + return this; + } else { + return this._loader; + } }, - clean () { - const cells = this.value; - for(const key in cells)if (cells[key].num === 0) delete cells[key]; + /** + * Gets or sets the locale instance to use for formatting and parsing + * string values. The locale object should be provided by the + * vega-format library, and include methods such as format, timeFormat, + * utcFormat, timeParse, and utcParse. + * @param {object} _ - The locale instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current locale instance. Otherwise returns this Dataflow instance. + */ + locale(_) { + if (arguments.length) { + this._locale = _; + return this; + } else { + return this._locale; + } }, - // -- Process Tuples ----- - add (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num += 1; - if (this._countOnly) return; - if (cell.store) cell.data.add(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].add(agg[i].get(t), t); + /** + * Get or set the logger instance used to log messages. If no arguments are + * provided, returns the current logger instance. Otherwise, sets the logger + * and return this Dataflow instance. Provided loggers must support the full + * API of logger objects generated by the vega-util logger method. Note that + * by default the log level of the new logger will be used; use the logLevel + * method to adjust the log level as needed. + */ + logger(logger2) { + if (arguments.length) { + this._log = logger2; + return this; + } else { + return this._log; + } }, - rem (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num -= 1; - if (this._countOnly) return; - if (cell.store) cell.data.rem(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].rem(agg[i].get(t), t); + /** + * Logs an error message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit error messages. + */ + error: logMethod("error"), + /** + * Logs a warning message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit warning messages. + */ + warn: logMethod("warn"), + /** + * Logs a information message. By default, logged messages are written to + * console output. The message will only be logged if the current log level is + * high enough to permit information messages. + */ + info: logMethod("info"), + /** + * Logs a debug message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit debug messages. + */ + debug: logMethod("debug"), + /** + * Get or set the current log level. If an argument is provided, it + * will be used as the new log level. + * @param {number} [level] - Should be one of None, Warn, Info + * @return {number} - The current log level. + */ + logLevel: logMethod("level"), + /** + * Empty entry threshold for garbage cleaning. Map data structures will + * perform cleaning once the number of empty entries exceeds this value. + */ + cleanThreshold: 1e4, + // OPERATOR REGISTRATION + add: add$4, + connect, + rank, + rerank, + // OPERATOR UPDATES + pulse, + touch, + update: update$6, + changeset, + // DATA LOADING + ingest, + parse: parse$5, + preload, + request, + // EVENT HANDLING + events: events$1, + on, + // PULSE PROPAGATION + evaluate, + run, + runAsync, + runAfter, + _enqueue: enqueue, + _getPulse: getPulse + }; + function Transform(init2, params2) { + Operator.call(this, init2, null, params2); + } + inherits(Transform, Operator, { + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + } else { + rv = this.evaluate(pulse2); + } + rv = rv || pulse2; + if (rv.then) { + rv = rv.then((_) => this.pulse = _); + } else if (rv !== pulse2.StopPropagation) { + this.pulse = rv; + } + return rv; }, - celltuple (cell) { - const tuple = cell.tuple, counts = this._counts; - // consolidate stored values - if (cell.store) cell.data.values(); - // update tuple properties - for(let i = 0, n = counts.length; i < n; ++i)tuple[counts[i]] = cell.num; - if (!this._countOnly) { - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].set(tuple); - } - return tuple; + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Marshalls parameter values and then invokes {@link transform}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + value (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const params2 = this.marshall(pulse2.stamp), out = this.transform(params2, pulse2); + params2.clear(); + return out; }, - changes (out) { - const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add = out.add, rem = out.rem, mod = out.mod; - let cell, key, i, n; - if (prev) for(key in prev){ - cell = prev[key]; - if (!drop || cell.num) rem.push(cell.tuple); - } - for(i = 0, n = this._alen; i < n; ++i){ - add.push(this.celltuple(adds[i])); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - cell = mods[i]; - (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell)); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - this._prev = null; - return out; + /** + * Process incoming pulses. + * Subclasses should override this method to implement transforms. + * @param {Parameters} _ - The operator parameter values. + * @param {Pulse} pulse - The current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + * value (including undefined) will let the input pulse pass through. + */ + transform() { } -}); -// epsilon bias to offset floating point error (#1737) -const EPSILON$1 = 1e-14; -/** - * Generates a binning function for discretizing data. - * @constructor - * @param {object} params - The parameters for this operator. The - * provided values should be valid options for the {@link bin} function. - * @param {function(object): *} params.field - The data field to bin. - */ function Bin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Bin.Definition = { - 'type': 'Bin', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'anchor', - 'type': 'number' - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 20 - }, - { - 'name': 'base', - 'type': 'number', - 'default': 10 - }, - { - 'name': 'divide', - 'type': 'number', - 'array': true, - 'default': [ - 5, - 2 - ] - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'span', - 'type': 'number' - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'steps', - 'type': 'number', - 'array': true - }, - { - 'name': 'minstep', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'name', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'bin0', - 'bin1' - ] + }); + const transforms = {}; + function definition$1(type2) { + const t = transform$2(type2); + return t && t.Definition || null; + } + function transform$2(type2) { + type2 = type2 && type2.toLowerCase(); + return has$1(transforms, type2) ? transforms[type2] : null; + } + function* numbers$1(values2, valueof) { + if (valueof == null) { + for (let value2 of values2) { + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; } - ] -}; -(0, _vegaUtil.inherits)(Bin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const band = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || [ - 'bin0', - 'bin1' - ], b0 = as[0], b1 = as[1]; - let flag; - if (_.modified()) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - } else flag = pulse.modified((0, _vegaUtil.accessorFields)(_.field)) ? pulse.ADD_MOD : pulse.ADD; - pulse.visit(flag, band ? (t)=>{ - const v = bins(t); - // minimum bin value (inclusive) - t[b0] = v; - // maximum bin value (exclusive) - // use convoluted math for better floating point agreement - // see https://github.com/vega/vega/issues/830 - // infinite values propagate through this formula! #2227 - t[b1] = v == null ? null : start + step * (1 + (v - start) / step); - } : (t)=>t[b0] = bins(t)); - return pulse.modifies(band ? as : b0); - }, - _bins (_) { - if (this.value && !_.modified()) return this.value; - const field = _.field, bins = (0, _vegaStatistics.bin)(_), step = bins.step; - let start = bins.start, stop = start + Math.ceil((bins.stop - start) / step) * step, a, d; - if ((a = _.anchor) != null) { - d = a - (start + step * Math.floor((a - start) / step)); - start += d; - stop += d; - } - const f = function(t) { - let v = (0, _vegaUtil.toNumber)(field(t)); - return v == null ? null : v < start ? -Infinity : v > stop ? Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step)); - }; - f.start = start; - f.stop = bins.stop; - f.step = step; - return this.value = (0, _vegaUtil.accessor)(f, (0, _vegaUtil.accessorFields)(field), _.name || 'bin_' + (0, _vegaUtil.accessorName)(field)); - } -}); -function SortedList(idFunc, source, input) { - const $ = idFunc; - let data = source || [], add = input || [], rem = {}, cnt = 0; - return { - add: (t)=>add.push(t), - remove: (t)=>rem[$(t)] = ++cnt, - size: ()=>data.length, - data: (compare, resort)=>{ - if (cnt) { - data = data.filter((t)=>!rem[$(t)]); - rem = {}; - cnt = 0; - } - if (resort && compare) data.sort(compare); - if (add.length) { - data = compare ? (0, _vegaUtil.merge)(compare, data, add.sort(compare)) : data.concat(add); - add = []; - } - return data; - } - }; -} -/** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ function Collect(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Collect.Definition = { - 'type': 'Collect', - 'metadata': { - 'source': true - }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - } - ] -}; -(0, _vegaUtil.inherits)(Collect, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), list = SortedList((0, _vegaDataflow.tupleid), this.value, out.materialize(out.ADD).add), sort = _.sort, mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields)); - out.visit(out.REM, list.remove); - this.modified(mod); - this.value = out.source = list.data((0, _vegaDataflow.stableCompare)(sort), mod); - // propagate tree root if defined - if (pulse.source && pulse.source.root) this.value.root = pulse.source.root; - return out; - } -}); -/** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string|function>} params.fields - The fields to compare. - * @param {Array<string>} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ function Compare(params) { - (0, _vegaDataflow.Operator).call(this, null, update$5, params); -} -(0, _vegaUtil.inherits)(Compare, (0, _vegaDataflow.Operator)); -function update$5(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.compare)(_.fields, _.orders); -} -/** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ function CountPattern(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'case', - 'type': 'enum', - 'values': [ - 'upper', - 'lower', - 'mixed' - ], - 'default': 'mixed' - }, - { - 'name': 'pattern', - 'type': 'string', - 'default': '[\\w"]+' - }, - { - 'name': 'stopwords', - 'type': 'string', - 'default': '' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'text', - 'count' - ] + } + } else { + let index2 = -1; + for (let value2 of values2) { + value2 = valueof(value2, ++index2, values2); + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; } - ] -}; -function tokenize(text, tcase, match) { - switch(tcase){ - case 'upper': - text = text.toUpperCase(); - break; - case 'lower': - text = text.toLowerCase(); - break; + } } - return text.match(match); -} -(0, _vegaUtil.inherits)(CountPattern, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const process = (update)=>(tuple)=>{ - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for(var i = 0, n = tokens.length; i < n; ++i)if (!stop.test(t = tokens[i])) update(t); - }; - const init = this._parameterCheck(_, pulse), counts = this._counts, match = this._match, stop = this._stop, get = _.field, as = _.as || [ - 'text', - 'count' - ], add = process((t)=>counts[t] = 1 + (counts[t] || 0)), rem = process((t)=>counts[t] -= 1); - if (init) pulse.visit(pulse.SOURCE, add); - else { - pulse.visit(pulse.ADD, add); - pulse.visit(pulse.REM, rem); - } - return this._finish(pulse, as); // generate output tuples - }, - _parameterCheck (_, pulse) { - let init = false; - if (_.modified('stopwords') || !this._stop) { - this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i'); - init = true; - } - if (_.modified('pattern') || !this._match) { - this._match = new RegExp(_.pattern || '[\\w\']+', 'g'); - init = true; - } - if (_.modified('field') || pulse.modified(_.field.fields)) init = true; - if (init) this._counts = {}; - return init; - }, - _finish (pulse, as) { - const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text = as[0], count = as[1], out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - let w, t, c; - for(w in counts){ - t = tuples[w]; - c = counts[w] || 0; - if (!t && c) { - tuples[w] = t = (0, _vegaDataflow.ingest)({}); - t[text] = w; - t[count] = c; - out.add.push(t); - } else if (c === 0) { - if (t) out.rem.push(t); - counts[w] = null; - tuples[w] = null; - } else if (t[count] !== c) { - t[count] = c; - out.mod.push(t); - } - } - return out.modifies(as); - } -}); -/** - * Perform a cross-product of a tuple stream with itself. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object):boolean} [params.filter] - An optional filter - * function for selectively including tuples in the cross product. - * @param {Array<string>} [params.as] - The names of the output fields. - */ function Cross(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Cross.Definition = { - 'type': 'Cross', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'filter', - 'type': 'expr' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'a', - 'b' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Cross, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), as = _.as || [ - 'a', - 'b' - ], a = as[0], b = as[1], reset = !this.value || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter'); - let data = this.value; - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || (0, _vegaUtil.truthy)); - } else out.mod = data; - out.source = this.value; - return out.modifies(as); - } -}); -function cross(input, a, b, filter) { - var data = [], t = {}, n = input.length, i = 0, j, left; - for(; i < n; ++i){ - t[a] = left = input[i]; - for(j = 0; j < n; ++j){ - t[b] = input[j]; - if (filter(t)) { - data.push((0, _vegaDataflow.ingest)(t)); - t = {}; - t[a] = left; - } - } + } + function quantiles(array2, p, f) { + const values2 = Float64Array.from(numbers$1(array2, f)); + values2.sort(ascending$1); + return p.map((_) => quantileSorted(values2, _)); + } + function quartiles(array2, f) { + return quantiles(array2, [0.25, 0.5, 0.75], f); + } + function estimateBandwidth(array2, f) { + const n = array2.length, d = deviation(array2, f), q = quartiles(array2, f), h2 = (q[2] - q[0]) / 1.34, v = Math.min(d, h2) || d || Math.abs(q[0]) || 1; + return 1.06 * v * Math.pow(n, -0.2); + } + function bin(_) { + const maxb = _.maxbins || 20, base2 = _.base || 10, logb = Math.log(base2), div = _.divide || [5, 2]; + let min2 = _.extent[0], max2 = _.extent[1], step, level, minstep, v, i, n; + const span2 = _.span || max2 - min2 || Math.abs(min2) || 1; + if (_.step) { + step = _.step; + } else if (_.steps) { + v = span2 / maxb; + for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i) ; + step = _.steps[Math.max(0, i - 1)]; + } else { + level = Math.ceil(Math.log(maxb) / logb); + minstep = _.minstep || 0; + step = Math.max(minstep, Math.pow(base2, Math.round(Math.log(span2) / logb) - level)); + while (Math.ceil(span2 / step) > maxb) { + step *= base2; + } + for (i = 0, n = div.length; i < n; ++i) { + v = step / div[i]; + if (v >= minstep && span2 / v <= maxb) step = v; + } } - return data; -} -const Distributions = { - kde: (0, _vegaStatistics.randomKDE), - mixture: (0, _vegaStatistics.randomMixture), - normal: (0, _vegaStatistics.randomNormal), - lognormal: (0, _vegaStatistics.randomLogNormal), - uniform: (0, _vegaStatistics.randomUniform) -}; -const DISTRIBUTIONS = 'distributions', FUNCTION = 'function', FIELD = 'field'; -/** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array<object>} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ function parse(def, data) { - const func = def[FUNCTION]; - if (!(0, _vegaUtil.hasOwnProperty)(Distributions, func)) (0, _vegaUtil.error)('Unknown distribution function: ' + func); - const d = Distributions[func](); - for(const name in def){ - // if data field, extract values - if (name === FIELD) d.data((def.from || data()).map(def[name])); - else if (name === DISTRIBUTIONS) d[name](def[name].map((_)=>parse(_, data))); - else if (typeof d[name] === FUNCTION) d[name](def[name]); + v = Math.log(step); + const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base2, -precision - 1); + if (_.nice || _.nice === void 0) { + v = Math.floor(min2 / step + eps) * step; + min2 = min2 < v ? v - step : v; + max2 = Math.ceil(max2 / step) * step; } - return d; -} -/** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array<number>} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function Density(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const distributions = [ - { - 'key': { - 'function': 'normal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'function': 'lognormal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'function': 'uniform' - }, - 'params': [ - { - 'name': 'min', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'max', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'function': 'kde' - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'from', - 'type': 'data' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - } - ] + return { + start: min2, + stop: max2 === min2 ? min2 + step : max2, + step + }; + } + var random = Math.random; + function setRandom(r) { + random = r; + } + function bootstrapCI(array2, samples, alpha, f) { + if (!array2.length) return [void 0, void 0]; + const values2 = Float64Array.from(numbers$1(array2, f)), n = values2.length, m2 = samples; + let a2, i, j, mu; + for (j = 0, mu = Array(m2); j < m2; ++j) { + for (a2 = 0, i = 0; i < n; ++i) { + a2 += values2[~~(random() * n)]; + } + mu[j] = a2 / n; } -]; -const mixture = { - 'key': { - 'function': 'mixture' - }, - 'params': [ - { - 'name': 'distributions', - 'type': 'param', - 'array': true, - 'params': distributions - }, - { - 'name': 'weights', - 'type': 'number', - 'array': true - } - ] -}; -Density.Definition = { - 'type': 'Density', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'pdf', - 'values': [ - 'pdf', - 'cdf' - ] - }, - { - 'name': 'distribution', - 'type': 'param', - 'params': distributions.concat(mixture) - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] + mu.sort(ascending$1); + return [quantile$1(mu, alpha / 2), quantile$1(mu, 1 - alpha / 2)]; + } + function dotbin(array2, step, smooth, f) { + f = f || ((_) => _); + const n = array2.length, v = new Float64Array(n); + let i = 0, j = 1, a2 = f(array2[0]), b2 = a2, w2 = a2 + step, x2; + for (; j < n; ++j) { + x2 = f(array2[j]); + if (x2 >= w2) { + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + w2 = x2 + step; + a2 = x2; + } + b2 = x2; + } + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + return smooth ? smoothing(v, step + step / 4) : v; + } + function smoothing(v, thresh) { + const n = v.length; + let a2 = 0, b2 = 1, c2, d; + while (v[a2] === v[b2]) ++b2; + while (b2 < n) { + c2 = b2 + 1; + while (v[b2] === v[c2]) ++c2; + if (v[b2] - v[b2 - 1] < thresh) { + d = b2 + (a2 + c2 - b2 - b2 >> 1); + while (d < b2) v[d++] = v[b2]; + while (d > b2) v[d--] = v[a2]; + } + a2 = b2; + b2 = c2; + } + return v; + } + function lcg$2(seed) { + return function() { + seed = (1103515245 * seed + 12345) % 2147483647; + return seed / 2147483647; + }; + } + function integer(min2, max2) { + if (max2 == null) { + max2 = min2; + min2 = 0; + } + let a2, b2, d; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + d = b2 - a2; + return dist2; + } else { + return a2; } - ] -}; -(0, _vegaUtil.inherits)(Density, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const dist = parse(_.distribution, source(pulse)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - let method = _.method || 'pdf'; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (!_.extent && !dist.data) (0, _vegaUtil.error)('Missing density extent parameter.'); - method = dist[method]; - const as = _.as || [ - 'value', - 'density' - ], domain = _.extent || (0, _vegaUtil.extent)(dist.data()), values = (0, _vegaStatistics.sampleCurve)(method, domain, minsteps, maxsteps).map((v)=>{ - const tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return (0, _vegaDataflow.ingest)(tuple); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + }, + max(_) { + if (arguments.length) { + b2 = _ || 0; + d = b2 - a2; + return dist2; + } else { + return b2; } - return out; + }, + sample() { + return a2 + Math.floor(d * random()); + }, + pdf(x2) { + return x2 === Math.floor(x2) && x2 >= a2 && x2 < b2 ? 1 / d : 0; + }, + cdf(x2) { + const v = Math.floor(x2); + return v < a2 ? 0 : v >= b2 ? 1 : (v - a2 + 1) / d; + }, + icdf(p) { + return p >= 0 && p <= 1 ? a2 - 1 + Math.floor(p * d) : NaN; + } + }; + return dist2.min(min2).max(max2); + } + const SQRT2PI = Math.sqrt(2 * Math.PI); + const SQRT2 = Math.SQRT2; + let nextSample = NaN; + function sampleNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + let x2 = 0, y2 = 0, rds, c2; + if (nextSample === nextSample) { + x2 = nextSample; + nextSample = NaN; + } else { + do { + x2 = random() * 2 - 1; + y2 = random() * 2 - 1; + rds = x2 * x2 + y2 * y2; + } while (rds === 0 || rds > 1); + c2 = Math.sqrt(-2 * Math.log(rds) / rds); + x2 *= c2; + nextSample = y2 * c2; + } + return mean2 + x2 * stdev; + } + function densityNormal(value2, mean2, stdev) { + stdev = stdev == null ? 1 : stdev; + const z = (value2 - (mean2 || 0)) / stdev; + return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); + } + function cumulativeNormal(value2, mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z = (value2 - mean2) / stdev, Z = Math.abs(z); + let cd; + if (Z > 37) { + cd = 0; + } else { + const exp2 = Math.exp(-Z * Z / 2); + let sum2; + if (Z < 7.07106781186547) { + sum2 = 0.0352624965998911 * Z + 0.700383064443688; + sum2 = sum2 * Z + 6.37396220353165; + sum2 = sum2 * Z + 33.912866078383; + sum2 = sum2 * Z + 112.079291497871; + sum2 = sum2 * Z + 221.213596169931; + sum2 = sum2 * Z + 220.206867912376; + cd = exp2 * sum2; + sum2 = 0.0883883476483184 * Z + 1.75566716318264; + sum2 = sum2 * Z + 16.064177579207; + sum2 = sum2 * Z + 86.7807322029461; + sum2 = sum2 * Z + 296.564248779674; + sum2 = sum2 * Z + 637.333633378831; + sum2 = sum2 * Z + 793.826512519948; + sum2 = sum2 * Z + 440.413735824752; + cd = cd / sum2; + } else { + sum2 = Z + 0.65; + sum2 = Z + 4 / sum2; + sum2 = Z + 3 / sum2; + sum2 = Z + 2 / sum2; + sum2 = Z + 1 / sum2; + cd = exp2 / sum2 / 2.506628274631; + } } -}); -function source(pulse) { - return ()=>pulse.materialize(pulse.SOURCE).source; -} -// use either provided alias or accessor field name -function fieldNames(fields, as) { - if (!fields) return null; - return fields.map((f, i)=>as[i] || (0, _vegaUtil.accessorName)(f)); -} -function partition$1(data, groupby, field) { - const groups = [], get = (f)=>f(t); - let map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data.map(field)); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - g.push(field(t)); + return z > 0 ? 1 - cd : cd; + } + function quantileNormal(p, mean2, stdev) { + if (p < 0 || p > 1) return NaN; + return (mean2 || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); + } + function erfinv(x2) { + let w2 = -Math.log((1 - x2) * (1 + x2)), p; + if (w2 < 6.25) { + w2 -= 3.125; + p = -364441206401782e-35; + p = -16850591381820166e-35 + p * w2; + p = 128584807152564e-32 + p * w2; + p = 11157877678025181e-33 + p * w2; + p = -1333171662854621e-31 + p * w2; + p = 20972767875968562e-33 + p * w2; + p = 6637638134358324e-30 + p * w2; + p = -4054566272975207e-29 + p * w2; + p = -8151934197605472e-29 + p * w2; + p = 26335093153082323e-28 + p * w2; + p = -12975133253453532e-27 + p * w2; + p = -5415412054294628e-26 + p * w2; + p = 10512122733215323e-25 + p * w2; + p = -4112633980346984e-24 + p * w2; + p = -29070369957882005e-24 + p * w2; + p = 42347877827932404e-23 + p * w2; + p = -13654692000834679e-22 + p * w2; + p = -13882523362786469e-21 + p * w2; + p = 18673420803405714e-20 + p * w2; + p = -740702534166267e-18 + p * w2; + p = -0.006033670871430149 + p * w2; + p = 0.24015818242558962 + p * w2; + p = 1.6536545626831027 + p * w2; + } else if (w2 < 16) { + w2 = Math.sqrt(w2) - 3.25; + p = 22137376921775787e-25; + p = 9075656193888539e-23 + p * w2; + p = -27517406297064545e-23 + p * w2; + p = 18239629214389228e-24 + p * w2; + p = 15027403968909828e-22 + p * w2; + p = -4013867526981546e-21 + p * w2; + p = 29234449089955446e-22 + p * w2; + p = 12475304481671779e-21 + p * w2; + p = -47318229009055734e-21 + p * w2; + p = 6828485145957318e-20 + p * w2; + p = 24031110387097894e-21 + p * w2; + p = -3550375203628475e-19 + p * w2; + p = 9532893797373805e-19 + p * w2; + p = -0.0016882755560235047 + p * w2; + p = 0.002491442096107851 + p * w2; + p = -0.003751208507569241 + p * w2; + p = 0.005370914553590064 + p * w2; + p = 1.0052589676941592 + p * w2; + p = 3.0838856104922208 + p * w2; + } else if (Number.isFinite(w2)) { + w2 = Math.sqrt(w2) - 5; + p = -27109920616438573e-27; + p = -2555641816996525e-25 + p * w2; + p = 15076572693500548e-25 + p * w2; + p = -3789465440126737e-24 + p * w2; + p = 761570120807834e-23 + p * w2; + p = -1496002662714924e-23 + p * w2; + p = 2914795345090108e-23 + p * w2; + p = -6771199775845234e-23 + p * w2; + p = 22900482228026655e-23 + p * w2; + p = -99298272942317e-20 + p * w2; + p = 4526062597223154e-21 + p * w2; + p = -1968177810553167e-20 + p * w2; + p = 7599527703001776e-20 + p * w2; + p = -21503011930044477e-20 + p * w2; + p = -13871931833623122e-20 + p * w2; + p = 1.0103004648645344 + p * w2; + p = 4.849906401408584 + p * w2; + } else { + p = Infinity; } - return groups; -} -const Output = 'bin'; -/** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ function DotBin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -DotBin.Definition = { - 'type': 'DotBin', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': Output - } - ] -}; -const autostep = (data, field)=>(0, _vegaUtil.span)((0, _vegaUtil.extent)(data, field)) / 30; -(0, _vegaUtil.inherits)(DotBin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) return pulse; // early exit - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(pulse.source, _.groupby, (0, _vegaUtil.identity)), smooth = _.smooth || false, field = _.field, step = _.step || autostep(source, field), sort = (0, _vegaDataflow.stableCompare)((a, b)=>field(a) - field(b)), as = _.as || Output, n = groups.length; - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for(; i < n; ++i){ - const g = groups[i].sort(sort); - j = -1; - for (const v of (0, _vegaStatistics.dotbin)(g, step, smooth, field)){ - if (v < min) min = v; - if (v > max) max = v; - g[++j][as] = v; - } + return p * x2; + } + function gaussian(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; + } else { + return mu; } - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - } -}); -/** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ function Expression(params) { - (0, _vegaDataflow.Operator).call(this, null, update$4, params); - this.modified(true); -} -(0, _vegaUtil.inherits)(Expression, (0, _vegaDataflow.Operator)); -function update$4(_) { - const expr = _.expr; - return this.value && !_.modified('expr') ? this.value : (0, _vegaUtil.accessor)((datum)=>expr(datum, _), (0, _vegaUtil.accessorFields)(expr), (0, _vegaUtil.accessorName)(expr)); -} -/** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ function Extent(params) { - (0, _vegaDataflow.Transform).call(this, [ - undefined, - undefined - ], params); -} -Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Extent, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const extent = this.value, field = _.field, mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field'); - let min = extent[0], max = extent[1]; - if (mod || min == null) { - min = Infinity; - max = -Infinity; - } - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, (t)=>{ - const v = (0, _vegaUtil.toNumber)(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = (0, _vegaUtil.accessorName)(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [ - min, - max - ]; - } -}); -/** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ function Subflow(pulse, parent) { - (0, _vegaDataflow.Operator).call(this, pulse); - this.parent = parent; - this.count = 0; -} -(0, _vegaUtil.inherits)(Subflow, (0, _vegaDataflow.Operator), { - /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ connect (target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return target.source = this; - }, - /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ add (t) { - this.count += 1; - this.value.add.push(t); - }, - /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ rem (t) { - this.count -= 1; - this.value.rem.push(t); - }, - /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ mod (t) { - this.value.mod.push(t); - }, - /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ init (pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }, - /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ evaluate () { - // assert: this.value.stamp === pulse.stamp - return this.value; - } -}); -/** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ function Facet(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._keys = (0, _vegaUtil.fastmap)(); // cache previously calculated key values - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = (f)=>{ - for(let i = 0, n = a.active; i < n; ++i)f(a[i], i, a); - }; -} -(0, _vegaUtil.inherits)(Facet, (0, _vegaDataflow.Transform), { - activate (flow) { - this._targets[this._targets.active++] = flow; - }, - // parent argument provided by PreFacet subclass - subflow (key, flow, pulse, parent) { - const flows = this.value; - let sf = (0, _vegaUtil.hasOwnProperty)(flows, key) && flows[key], df, p; - if (!sf) { - p = parent || (p = this._group[key]) && p.tuple; - df = pulse.dataflow; - sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this); - df.add(sf).connect(flow(df, key, p)); - flows[key] = sf; - this.activate(sf); - } else if (sf.value.stamp < pulse.stamp) { - sf.init(pulse); - this.activate(sf); - } - return sf; - }, - clean () { - const flows = this.value; - let detached = 0; - for(const key in flows)if (flows[key].count === 0) { - const detach = flows[key].detachSubflow; - if (detach) detach(); - delete flows[key]; - ++detached; - } - // remove inactive targets from the active targets array - if (detached) { - const active = this._targets.filter((sf)=>sf && sf.count > 0); - this.initTargets(active); + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; } - }, - initTargets (act) { - const a = this._targets, n = a.length, m = act ? act.length : 0; - let i = 0; - for(; i < m; ++i)a[i] = act[i]; - for(; i < n && a[i] != null; ++i)a[i] = null; // ensure old flows can be garbage collected - a.active = m; - }, - transform (_, pulse) { - const df = pulse.dataflow, key = _.key, flow = _.subflow, cache = this._keys, rekey = _.modified('key'), subflow = (key)=>this.subflow(key, flow, pulse); - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - cache.set((0, _vegaDataflow.tupleid)(t), k); - subflow(k).add(t); - }); - if (rekey || pulse.modified(key.fields)) pulse.visit(pulse.MOD, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 === k1) subflow(k1).mod(t); - else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - else if (pulse.changed(pulse.MOD)) pulse.visit(pulse.MOD, (t)=>{ - subflow(cache.get((0, _vegaDataflow.tupleid)(t))).mod(t); - }); - if (rekey) pulse.visit(pulse.REFLOW, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - if (pulse.clean()) df.runAfter(()=>{ - this.clean(); - cache.clean(); - }); - else if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return pulse; - } -}); -/** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ function Field(params) { - (0, _vegaDataflow.Operator).call(this, null, update$3, params); -} -(0, _vegaUtil.inherits)(Field, (0, _vegaDataflow.Operator)); -function update$3(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.isArray)(_.name) ? (0, _vegaUtil.array)(_.name).map((f)=>(0, _vegaUtil.field)(f)) : (0, _vegaUtil.field)(_.name, _.as); -} -/** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ function Filter(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -Filter.Definition = { - 'type': 'Filter', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Filter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), add = output.add, rem = output.rem, mod = output.mod, test = _.expr; - let isMod = true; - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - pulse.visit(pulse.ADD, (t)=>{ - if (test(t, _)) add.push(t); - else cache.set((0, _vegaDataflow.tupleid)(t), 1); - }); - function revisit(t) { - const id = (0, _vegaDataflow.tupleid)(t), b = test(t, _), s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) mod.push(t); - } - pulse.visit(pulse.MOD, revisit); - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - } -}); -/** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array<string>} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ function Flatten(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Flatten.Definition = { - 'type': 'Flatten', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'index', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Flatten, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index = _.index || null, m = as.length; - // remove any previous results - out.rem = this.value; - // generate flattened tuples - pulse.visit(pulse.SOURCE, (t)=>{ - const arrays = fields.map((f)=>f(t)), maxlen = arrays.reduce((l, a)=>Math.max(l, a.length), 0); - let i = 0, j, d, v; - for(; i < maxlen; ++i){ - d = (0, _vegaDataflow.derive)(t); - for(j = 0; j < m; ++j)d[as[j]] = (v = arrays[j][i]) == null ? null : v; - if (index) d[index] = i; - out.add.push(d); - } - }); - this.value = out.source = out.add; - if (index) out.modifies(index); - return out.modifies(as); - } -}); -/** - * Folds one more tuple fields into multiple tuples in which the field - * name and values are available under new 'key' and 'value' fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.fields - An array of field accessors - * for the tuple fields that should be folded. - * @param {Array<string>} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ function Fold(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Fold.Definition = { - 'type': 'Fold', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'key', - 'value' - ] + }, + sample: () => sampleNormal(mu, sigma), + pdf: (value2) => densityNormal(value2, mu, sigma), + cdf: (value2) => cumulativeNormal(value2, mu, sigma), + icdf: (p) => quantileNormal(p, mu, sigma) + }; + return dist2.mean(mean2).stdev(stdev); + } + function kde(support, bandwidth2) { + const kernel = gaussian(); + let n = 0; + const dist2 = { + data(_) { + if (arguments.length) { + support = _; + n = _ ? _.length : 0; + return dist2.bandwidth(bandwidth2); + } else { + return support; } - ] -}; -(0, _vegaUtil.inherits)(Fold, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, fnames = fields.map((0, _vegaUtil.accessorName)), as = _.as || [ - 'key', - 'value' - ], k = as[0], v = as[1], n = fields.length; - out.rem = this.value; - pulse.visit(pulse.SOURCE, (t)=>{ - for(let i = 0, d; i < n; ++i){ - d = (0, _vegaDataflow.derive)(t); - d[k] = fnames[i]; - d[v] = fields[i](t); - out.add.push(d); - } - }); - this.value = out.source = out.add; - return out.modifies(as); - } -}); -/** - * Invokes a function for each data tuple and saves the results as a new field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The formula function to invoke for each tuple. - * @param {string} params.as - The field name under which to save the result. - * @param {boolean} [params.initonly=false] - If true, the formula is applied to - * added tuples only, and does not update in response to modifications. - */ function Formula(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Formula.Definition = { - 'type': 'Formula', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'required': true - }, - { - 'name': 'initonly', - 'type': 'boolean' - } - ] -}; -(0, _vegaUtil.inherits)(Formula, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const func = _.expr, as = _.as, mod = _.modified(), flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD; - if (mod) // parameters updated, need to reflow - pulse = pulse.materialize().reflow(true); - if (!_.initonly) pulse.modifies(as); - return pulse.visit(flag, (t)=>t[as] = func(t, _)); - } -}); -/** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ function Generate(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(Generate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), gen = _.generator; - let data = this.value, num = _.size - data.length, add, rem, t; - if (num > 0) { - // need more tuples, generate and add - for(add = []; --num >= 0;){ - add.push(t = (0, _vegaDataflow.ingest)(gen(_))); - data.push(t); - } - out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add; + }, + bandwidth(_) { + if (!arguments.length) return bandwidth2; + bandwidth2 = _; + if (!bandwidth2 && support) bandwidth2 = estimateBandwidth(support); + return dist2; + }, + sample() { + return support[~~(random() * n)] + bandwidth2 * kernel.sample(); + }, + pdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.pdf((x2 - support[i]) / bandwidth2); + } + return y2 / bandwidth2 / n; + }, + cdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.cdf((x2 - support[i]) / bandwidth2); + } + return y2 / n; + }, + icdf() { + throw Error("KDE icdf not supported."); + } + }; + return dist2.data(support); + } + function sampleLogNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + return Math.exp(mean2 + sampleNormal() * stdev); + } + function densityLogNormal(value2, mean2, stdev) { + if (value2 <= 0) return 0; + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z = (Math.log(value2) - mean2) / stdev; + return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value2); + } + function cumulativeLogNormal(value2, mean2, stdev) { + return cumulativeNormal(Math.log(value2), mean2, stdev); + } + function quantileLogNormal(p, mean2, stdev) { + return Math.exp(quantileNormal(p, mean2, stdev)); + } + function lognormal(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem; - data = data.slice(-num); + return mu; } - out.source = this.value = data; - return out; - } -}); -const Methods = { - value: 'value', - median: (0, _d3Array.median), - mean: (0, _d3Array.mean), - min: (0, _d3Array.min), - max: (0, _d3Array.max) -}; -const Empty = []; -/** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array<function(object): *>} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ function Impute(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Impute.Definition = { - 'type': 'Impute', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'keyvals', - 'array': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'value', - 'values': [ - 'value', - 'mean', - 'median', - 'max', - 'min' - ] - }, - { - 'name': 'value', - 'default': 0 - } - ] -}; -function getValue(_) { - var m = _.method || Methods.value, v; - if (Methods[m] == null) (0, _vegaUtil.error)('Unrecognized imputation method: ' + m); - else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return ()=>v; - } else return Methods[m]; -} -function getField(_) { - const f = _.field; - return (t)=>t ? f(t) : NaN; -} -(0, _vegaUtil.inherits)(Impute, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), impute = getValue(_), field = getField(_), fName = (0, _vegaUtil.accessorName)(_.field), kName = (0, _vegaUtil.accessorName)(_.key), gNames = (_.groupby || []).map((0, _vegaUtil.accessorName)), groups = partition(pulse.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m = groups.domain.length, group, value, gVals, kVal, g, i, j, l, n, t; - for(g = 0, l = groups.length; g < l; ++g){ - group = groups[g]; - gVals = group.values; - value = NaN; - // add tuples for missing values - for(j = 0; j < m; ++j){ - if (group[j] != null) continue; - kVal = groups.domain[j]; - t = { - _impute: true - }; - for(i = 0, n = gVals.length; i < n; ++i)t[gNames[i]] = gVals[i]; - t[kName] = kVal; - t[fName] = Number.isNaN(value) ? value = impute(group, field) : value; - curr.push((0, _vegaDataflow.ingest)(t)); - } + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; } - // update pulse with imputed tuples - if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); - if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); - this.value = curr; - return out; - } -}); -function partition(data, groupby, key, keyvals) { - var get = (f)=>f(t), groups = [], domain = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group, i, j, k, n, t; - domain.forEach((k, i)=>kMap[k] = i + 1); - for(i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = key(t); - j = kMap[k] || (kMap[k] = domain.push(k)); - gKey = (gVals = groupby ? groupby.map(get) : Empty) + ''; - if (!(group = gMap[gKey])) { - group = gMap[gKey] = []; - groups.push(group); - group.values = gVals; - } - group[j - 1] = t; - } - groups.domain = domain; - return groups; -} -/** - * Extend input tuples with aggregate values. - * Calcuates aggregate values and joins them with the input stream. - * @constructor - */ function JoinAggregate(params) { - Aggregate.call(this, params); -} -JoinAggregate.Definition = { - 'type': 'JoinAggregate', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(JoinAggregate, Aggregate, { - transform (_, pulse) { - const aggr = this, mod = _.modified(); - let cells; - // process all input tuples to calculate aggregates - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - cells = aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - cells = aggr.value = aggr.value || this.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // update aggregation cells - aggr.changes(); - // write aggregate values to input tuples - pulse.visit(pulse.SOURCE, (t)=>{ - (0, _vegaUtil.extend)(t, cells[aggr.cellkey(t)].tuple); - }); - return pulse.reflow(mod).modifies(this._outputs); - }, - changes () { - const adds = this._adds, mods = this._mods; - let i, n; - for(i = 0, n = this._alen; i < n; ++i){ - this.celltuple(adds[i]); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - this.celltuple(mods[i]); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - } -}); -/** - * Compute kernel density estimates (KDE) for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array<number>} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function KDE(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE.Definition = { - 'type': 'KDE', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'cumulative', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] + }, + sample: () => sampleLogNormal(mu, sigma), + pdf: (value2) => densityLogNormal(value2, mu, sigma), + cdf: (value2) => cumulativeLogNormal(value2, mu, sigma), + icdf: (p) => quantileLogNormal(p, mu, sigma) + }; + return dist2.mean(mean2).stdev(stdev); + } + function mixture$1(dists, weights) { + let m2 = 0, w2; + function normalize2(x2) { + const w3 = []; + let sum2 = 0, i; + for (i = 0; i < m2; ++i) { + sum2 += w3[i] = x2[i] == null ? 1 : +x2[i]; + } + for (i = 0; i < m2; ++i) { + w3[i] /= sum2; + } + return w3; + } + const dist2 = { + weights(_) { + if (arguments.length) { + w2 = normalize2(weights = _ || []); + return dist2; } - ] -}; -(0, _vegaUtil.inherits)(KDE, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), bandwidth = _.bandwidth, method = _.cumulative ? 'cdf' : 'pdf', as = _.as || [ - 'value', - 'density' - ], values = []; - let domain = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (_.resolve === 'shared') { - if (!domain) domain = (0, _vegaUtil.extent)(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - groups.forEach((g)=>{ - const density = (0, _vegaStatistics.randomKDE)(g, bandwidth)[method], scale = _.counts ? g.length : 1, local = domain || (0, _vegaUtil.extent)(g); - (0, _vegaStatistics.sampleCurve)(density, local, minsteps, maxsteps).forEach((v)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = v[0]; - t[as[1]] = v[1] * scale; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + return weights; + }, + distributions(_) { + if (arguments.length) { + if (_) { + m2 = _.length; + dists = _; + } else { + m2 = 0; + dists = []; + } + return dist2.weights(weights); + } + return dists; + }, + sample() { + const r = random(); + let d = dists[m2 - 1], v = w2[0], i = 0; + for (; i < m2 - 1; v += w2[++i]) { + if (r < v) { + d = dists[i]; + break; + } } - return out; + return d.sample(); + }, + pdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].pdf(x2); + } + return p; + }, + cdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].cdf(x2); + } + return p; + }, + icdf() { + throw Error("Mixture icdf not supported."); + } + }; + return dist2.distributions(dists).weights(weights); + } + function sampleUniform(min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; } -}); -/** - * Generates a key function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string>} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ function Key(params) { - (0, _vegaDataflow.Operator).call(this, null, update$2, params); -} -(0, _vegaUtil.inherits)(Key, (0, _vegaDataflow.Operator)); -function update$2(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.key)(_.fields, _.flat); -} -/** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ function Load(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this._pending = null; -} -(0, _vegaUtil.inherits)(Load, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow; - if (this._pending) // update state and return pulse - return output(this, pulse, this._pending); - if (stop(_)) return pulse.StopPropagation; - if (_.values) // parse and ingest values, return output pulse - return output(this, pulse, df.parse(_.values, _.format)); - else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then((res)=>{ - this._pending = (0, _vegaUtil.array)(res.data); - return (df)=>df.touch(this); - }); - return { - async: p - }; - } else // return promise for synchronous loading - return df.request(_.url, _.format).then((res)=>output(this, pulse, (0, _vegaUtil.array)(res.data))); - } -}); -function stop(_) { - return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format')); -} -function output(op, pulse, data) { - data.forEach((0, _vegaDataflow.ingest)); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; -} -/** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array<function(object): *} params.fields - The fields to lookup. - * @param {Array<string>} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ function Lookup(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -Lookup.Definition = { - 'type': 'Lookup', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'index', - 'type': 'index', - 'params': [ - { - 'name': 'from', - 'type': 'data', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - } - ] - }, - { - 'name': 'values', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - }, - { - 'name': 'default', - 'default': null - } - ] -}; -(0, _vegaUtil.inherits)(Lookup, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const keys = _.fields, index = _.index, values = _.values, defaultValue = _.default == null ? null : _.default, reset = _.modified(), n = keys.length; - let flag = reset ? pulse.SOURCE : pulse.ADD, out = pulse, as = _.as, set, m, mods; - if (values) { - m = values.length; - if (n > 1 && !as) (0, _vegaUtil.error)('Multi-field lookup requires explicit "as" parameter.'); - if (as && as.length !== n * m) (0, _vegaUtil.error)('The "as" parameter has too few output field names.'); - as = as || values.map((0, _vegaUtil.accessorName)); - set = function(t) { - for(var i = 0, k = 0, j, v; i < n; ++i){ - v = index.get(keys[i](t)); - if (v == null) for(j = 0; j < m; ++j, ++k)t[as[k]] = defaultValue; - else for(j = 0; j < m; ++j, ++k)t[as[k]] = values[j](v); - } - }; + return min2 + (max2 - min2) * random(); + } + function densityUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return value2 >= min2 && value2 <= max2 ? 1 / (max2 - min2) : 0; + } + function cumulativeUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return value2 < min2 ? 0 : value2 > max2 ? 1 : (value2 - min2) / (max2 - min2); + } + function quantileUniform(p, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return p >= 0 && p <= 1 ? min2 + p * (max2 - min2) : NaN; + } + function uniform(min2, max2) { + let a2, b2; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + return dist2; } else { - if (!as) (0, _vegaUtil.error)('Missing output field names.'); - set = function(t) { - for(var i = 0, v; i < n; ++i){ - v = index.get(keys[i](t)); - t[as[i]] = v == null ? defaultValue : v; - } - }; + return a2; } - if (reset) out = pulse.reflow(true); - else { - mods = keys.some((k)=>pulse.modified(k.fields)); - flag |= mods ? pulse.MOD : 0; - } - pulse.visit(flag, set); - return out.modifies(as); - } -}); -/** - * Computes global min/max extents over a collection of extents. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<number>>} params.extents - The input extents. - */ function MultiExtent(params) { - (0, _vegaDataflow.Operator).call(this, null, update$1, params); -} -(0, _vegaUtil.inherits)(MultiExtent, (0, _vegaDataflow.Operator)); -function update$1(_) { - if (this.value && !_.modified()) return this.value; - const ext = _.extents, n = ext.length; - let min = Infinity, max = -Infinity, i, e; - for(i = 0; i < n; ++i){ - e = ext[i]; - if (e[0] < min) min = e[0]; - if (e[1] > max) max = e[1]; + }, + max(_) { + if (arguments.length) { + b2 = _ == null ? 1 : _; + return dist2; + } else { + return b2; + } + }, + sample: () => sampleUniform(a2, b2), + pdf: (value2) => densityUniform(value2, a2, b2), + cdf: (value2) => cumulativeUniform(value2, a2, b2), + icdf: (p) => quantileUniform(p, a2, b2) + }; + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return dist2.min(min2).max(max2); + } + function constant$4(data2, x2, y2) { + let mean2 = 0, n = 0; + for (const d of data2) { + const val = y2(d); + if (x2(d) == null || val == null || isNaN(val)) continue; + mean2 += (val - mean2) / ++n; } - return [ - min, - max - ]; -} -/** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<*>>} params.values - The input value arrrays. - */ function MultiValues(params) { - (0, _vegaDataflow.Operator).call(this, null, update, params); -} -(0, _vegaUtil.inherits)(MultiValues, (0, _vegaDataflow.Operator)); -function update(_) { - return this.value && !_.modified() ? this.value : _.values.reduce((data, _)=>data.concat(_), []); -} -/** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Params(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Params, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - } -}); -/** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ function Pivot(params) { - Aggregate.call(this, params); -} -Pivot.Definition = { - 'type': 'Pivot', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'value', - 'type': 'field', - 'required': true - }, - { - 'name': 'op', - 'type': 'enum', - 'values': ValidAggregateOps, - 'default': 'sum' - }, - { - 'name': 'limit', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Pivot, Aggregate, { - _transform: Aggregate.prototype.transform, - transform (_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - } -}); -// Shoehorn a pivot transform into an aggregate transform! -// First collect all unique pivot field values. -// Then generate aggregate fields for each output pivot field. -function aggregateParams(_, pulse) { - const key = _.field, value = _.value, op = (_.op === 'count' ? '__count__' : _.op) || 'sum', fields = (0, _vegaUtil.accessorFields)(key).concat((0, _vegaUtil.accessorFields)(value)), keys = pivotKeys(key, _.limit || 0, pulse); - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); return { - key: _.key, - groupby: _.groupby, - ops: keys.map(()=>op), - fields: keys.map((k)=>get(k, key, value, fields)), - as: keys.map((k)=>k + ''), - modified: _.modified.bind(_) - }; -} -// Generate aggregate field accessor. -// Output NaN for non-existent values; aggregator will ignore! -function get(k, key, value, fields) { - return (0, _vegaUtil.accessor)((d)=>key(d) === k ? value(d) : NaN, fields, k + ''); -} -// Collect (and optionally limit) all unique pivot values. -function pivotKeys(key, limit, pulse) { - const map = {}, list = []; - pulse.visit(pulse.SOURCE, (t)=>{ - const k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); - } + coef: [mean2], + predict: () => mean2, + rSquared: 0 + }; + } + function ols(uX, uY, uXY, uX2) { + const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; + return [intercept, slope]; + } + function points(data2, x2, y2, sort2) { + data2 = data2.filter((d2) => { + let u2 = x2(d2), v = y2(d2); + return u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v; }); - list.sort((0, _vegaUtil.ascending)); - return limit ? list.slice(0, limit) : list; -} -/** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array<object>} params.field - The field - * accessor for an array of subflow tuple objects. - */ function PreFacet(params) { - Facet.call(this, params); -} -(0, _vegaUtil.inherits)(PreFacet, Facet, { - transform (_, pulse) { - const flow = _.subflow, field = _.field, subflow = (t)=>this.subflow((0, _vegaDataflow.tupleid)(t), flow, pulse, t); - if (_.modified('field') || field && pulse.modified((0, _vegaUtil.accessorFields)(field))) (0, _vegaUtil.error)('PreFacet does not support field modification.'); - this.initTargets(); // reset list of active subflows - if (field) { - pulse.visit(pulse.MOD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.mod(_)); - }); - pulse.visit(pulse.ADD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.add((0, _vegaDataflow.ingest)(_))); - }); - pulse.visit(pulse.REM, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.rem(_)); - }); - } else { - pulse.visit(pulse.MOD, (t)=>subflow(t).mod(t)); - pulse.visit(pulse.ADD, (t)=>subflow(t).add(t)); - pulse.visit(pulse.REM, (t)=>subflow(t).rem(t)); - } - if (pulse.clean()) pulse.runAfter(()=>this.clean()); - return pulse; - } -}); -/** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *} params.fields - The fields to project, - * as an array of field accessors. If unspecified, all fields will be - * copied with names unchanged. - * @param {Array<string>} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ function Project(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Project.Definition = { - 'type': 'Project', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Project, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive = fields ? (s, t)=>project(s, t, fields, as) : (0, _vegaDataflow.rederive); - let lut; - if (this.value) lut = this.value; - else { - pulse = pulse.addAll(); - lut = this.value = {}; - } - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = derive(t, (0, _vegaDataflow.ingest)({})); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - out.mod.push(derive(t, lut[(0, _vegaDataflow.tupleid)(t)])); - }); - return out; + if (sort2) { + data2.sort((a2, b2) => x2(a2) - x2(b2)); } -}); -function project(s, t, fields, as) { - for(let i = 0, n = fields.length; i < n; ++i)t[as[i]] = fields[i](s); - return t; -} -/** - * Proxy the value of another operator as a pure signal value. - * Ensures no tuples are propagated. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {*} params.value - The value to proxy, becomes the value of this operator. - */ function Proxy(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Proxy, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = _.value; - return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Generates sample quantile values from an input data stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the data field - * over which to calculate quantile values. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {Array<number>} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array<number>} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ function Quantile(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Quantile.Definition = { - 'type': 'Quantile', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'probs', - 'type': 'number', - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 0.01 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'prob', - 'value' - ] - } - ] -}; -const EPSILON = 1e-14; -(0, _vegaUtil.inherits)(Quantile, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), as = _.as || [ - 'prob', - 'value' - ]; - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), values = [], step = _.step || 0.01, p = _.probs || (0, _d3Array.range)(step / 2, 1 - EPSILON, step), n = p.length; - groups.forEach((g)=>{ - const q = (0, _vegaStatistics.quantiles)(g, p); - for(let i = 0; i < n; ++i){ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[i]; - t[as[1]] = q[i]; - values.push((0, _vegaDataflow.ingest)(t)); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - return out; + const n = data2.length, X3 = new Float64Array(n), Y3 = new Float64Array(n); + let i = 0, ux = 0, uy = 0, xv, yv, d; + for (d of data2) { + X3[i] = xv = +x2(d); + Y3[i] = yv = +y2(d); + ++i; + ux += (xv - ux) / i; + uy += (yv - uy) / i; + } + for (i = 0; i < n; ++i) { + X3[i] -= ux; + Y3[i] -= uy; + } + return [X3, Y3, ux, uy]; + } + function visitPoints(data2, x2, y2, callback) { + let i = -1, u2, v; + for (const d of data2) { + u2 = x2(d); + v = y2(d); + if (u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v) { + callback(u2, v, ++i); + } } -}); -/** - * Relays a data stream between data processing pipelines. - * If the derive parameter is set, this transform will create derived - * copies of observed tuples. This provides derived data streams in which - * modifications to the tuples do not pollute an upstream data source. - * @param {object} params - The parameters for this operator. - * @param {number} [params.derive=false] - Boolean flag indicating if - * the transform should make derived copies of incoming tuples. - * @constructor - */ function Relay(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Relay, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let out, lut; - if (this.value) lut = this.value; - else { - out = pulse = pulse.addAll(); - lut = this.value = {}; - } - if (_.derive) { - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = (0, _vegaDataflow.derive)(t); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - const dt = lut[(0, _vegaDataflow.tupleid)(t)]; - for(const k in t){ - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); + } + function rSquared(data2, x2, y2, uY, predict) { + let SSE = 0, SST = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const sse = dy - predict(dx), sst = dy - uY; + SSE += sse * sse; + SST += sst * sst; + }); + return 1 - SSE / SST; + } + function linear$2(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * x3; + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) + }; + } + function log$3(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + dx = Math.log(dx); + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * Math.log(x3); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) + }; + } + function exp$1(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2); + let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly2, xy; + visitPoints(data2, x2, y2, (_, dy) => { + dx = xv[n++]; + ly2 = Math.log(dy); + xy = dx * dy; + YL += (dy * ly2 - YL) / n; + XY += (xy - XY) / n; + XYL += (xy * ly2 - XYL) / n; + X2Y += (dx * xy - X2Y) / n; + }); + const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x3) => Math.exp(c0 + c1 * (x3 - ux)); + return { + coef: [Math.exp(c0 - c1 * ux), c1], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) + }; + } + function pow$3(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, YS = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const lx2 = Math.log(dx), ly2 = Math.log(dy); + ++n; + X3 += (lx2 - X3) / n; + Y3 += (ly2 - Y3) / n; + XY += (lx2 * ly2 - XY) / n; + X22 += (lx2 * lx2 - X22) / n; + YS += (dy - YS) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] * Math.pow(x3, coef[1]); + coef[0] = Math.exp(coef[0]); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, YS, predict) + }; + } + function quad(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length; + let X22 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x22; + for (i = 0; i < n; ) { + dx = xv[i]; + dy = yv[i++]; + x22 = dx * dx; + X22 += (x22 - X22) / i; + X3 += (x22 * dx - X3) / i; + X4 += (x22 * x22 - X4) / i; + XY += (dx * dy - XY) / i; + X2Y += (x22 * dy - X2Y) / i; + } + const X2X2 = X4 - X22 * X22, d = X22 * X2X2 - X3 * X3, a2 = (X2Y * X22 - XY * X3) / d, b2 = (XY * X2X2 - X2Y * X3) / d, c2 = -a2 * X22, predict = (x3) => { + x3 = x3 - ux; + return a2 * x3 * x3 + b2 * x3 + c2 + uy; + }; + return { + coef: [c2 - b2 * ux + a2 * ux * ux + uy, b2 - 2 * a2 * ux, a2], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) + }; + } + function poly(data2, x2, y2, order) { + if (order === 0) return constant$4(data2, x2, y2); + if (order === 1) return linear$2(data2, x2, y2); + if (order === 2) return quad(data2, x2, y2); + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length, lhs = [], rhs = [], k = order + 1; + let i, j, l, v, c2; + for (i = 0; i < k; ++i) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i) * yv[l]; + } + lhs.push(v); + c2 = new Float64Array(k); + for (j = 0; j < k; ++j) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i + j); } - return out; + c2[j] = v; + } + rhs.push(c2); } -}); -/** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ function Sample(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.count = 0; -} -Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'default': 1000 - } - ] -}; -(0, _vegaUtil.inherits)(Sample, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), mod = _.modified('size'), num = _.size, map = this.value.reduce((m, t)=>(m[(0, _vegaDataflow.tupleid)(t)] = 1, m), {}); - let res = this.value, cnt = this.count, cap = 0; - // sample reservoir update function - function update(t) { - let p, idx; - if (res.length < num) res.push(t); - else { - idx = ~~((cnt + 1) * (0, _vegaStatistics.random)()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[(0, _vegaDataflow.tupleid)(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - // filter removed tuples out of the sample reservoir - res = res.filter((t)=>map[(0, _vegaDataflow.tupleid)(t)] !== -1); - } - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, (t)=>{ - // update, but skip previously sampled tuples - if (!map[(0, _vegaDataflow.tupleid)(t)]) update(t); - }); - cap = -1; + rhs.push(lhs); + const coef = gaussianElimination(rhs), predict = (x3) => { + x3 -= ux; + let y3 = uy + coef[0] + coef[1] * x3 + coef[2] * x3 * x3; + for (i = 3; i < k; ++i) y3 += coef[i] * Math.pow(x3, i); + return y3; + }; + return { + coef: uncenter(k, coef, -ux, uy), + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) + }; + } + function uncenter(k, a2, x2, y2) { + const z = Array(k); + let i, j, v, c2; + for (i = 0; i < k; ++i) z[i] = 0; + for (i = k - 1; i >= 0; --i) { + v = a2[i]; + c2 = 1; + z[i] += v; + for (j = 1; j <= i; ++j) { + c2 *= (i + 1 - j) / j; + z[i - j] += v * Math.pow(x2, j) * c2; + } + } + z[0] += y2; + return z; + } + function gaussianElimination(matrix) { + const n = matrix.length - 1, coef = []; + let i, j, k, r, t; + for (i = 0; i < n; ++i) { + r = i; + for (j = i + 1; j < n; ++j) { + if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { + r = j; } - if (mod && res.length > num) { - const n = res.length - num; - for(let i = 0; i < n; ++i){ - map[(0, _vegaDataflow.tupleid)(res[i])] = -1; - out.rem.push(res[i]); - } - res = res.slice(n); + } + for (k = i; k < n + 1; ++k) { + t = matrix[k][i]; + matrix[k][i] = matrix[k][r]; + matrix[k][r] = t; + } + for (j = i + 1; j < n; ++j) { + for (k = n; k >= i; k--) { + matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; } - if (pulse.mod.length) // propagate modified tuples in the sample reservoir - pulse.visit(pulse.MOD, (t)=>{ - if (map[(0, _vegaDataflow.tupleid)(t)]) out.mod.push(t); - }); - if (pulse.add.length) // update sample reservoir - pulse.visit(pulse.ADD, update); - if (pulse.add.length || cap < 0) // output newly added tuples - out.add = res.filter((t)=>!map[(0, _vegaDataflow.tupleid)(t)]); - this.count = cnt; - this.value = out.source = res; - return out; + } } -}); -/** - * Generates data tuples for a specified sequence range of numbers. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} params.start - The first number in the sequence. - * @param {number} params.stop - The last number (exclusive) in the sequence. - * @param {number} [params.step=1] - The step size between numbers in the sequence. - */ function Sequence(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Sequence.Definition = { - 'type': 'Sequence', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'start', - 'type': 'number', - 'required': true - }, - { - 'name': 'stop', - 'type': 'number', - 'required': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'data' - } - ] -}; -(0, _vegaUtil.inherits)(Sequence, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return; - const out = pulse.materialize().fork(pulse.MOD), as = _.as || 'data'; - out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem; - this.value = (0, _d3Array.range)(_.start, _.stop, _.step || 1).map((v)=>{ - const t = {}; - t[as] = v; - return (0, _vegaDataflow.ingest)(t); - }); - out.add = pulse.add.concat(this.value); - return out; - } -}); -/** - * Propagates a new pulse without any tuples so long as the input - * pulse contains some added, removed or modified tuples. - * @param {object} params - The parameters for this operator. - * @constructor - */ function Sieve(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Sieve, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = pulse.source; - return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Discretize dates to specific time units. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The data field containing date/time values. - */ function TimeUnit(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const OUTPUT = [ - 'unit0', - 'unit1' -]; -TimeUnit.Definition = { - 'type': 'TimeUnit', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'units', - 'type': 'enum', - 'values': (0, _vegaTime.TIME_UNITS), - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 40 - }, - { - 'name': 'extent', - 'type': 'date', - 'array': true - }, - { - 'name': 'timezone', - 'type': 'enum', - 'default': 'local', - 'values': [ - 'local', - 'utc' - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': OUTPUT - } - ] -}; -(0, _vegaUtil.inherits)(TimeUnit, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const field = _.field, band = _.interval !== false, utc = _.timezone === 'utc', floor = this._floor(_, pulse), offset = (utc ? (0, _vegaTime.utcInterval) : (0, _vegaTime.timeInterval))(floor.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor.step; - let min = floor.start || Infinity, max = floor.stop || -Infinity, flag = pulse.ADD; - if (_.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(field))) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - min = Infinity; - max = -Infinity; - } - pulse.visit(flag, (t)=>{ - const v = field(t); - let a, b; - if (v == null) { - t[u0] = null; - if (band) t[u1] = null; - } else { - t[u0] = a = b = floor(v); - if (band) t[u1] = b = offset(a, step); - if (a < min) min = a; - if (b > max) max = b; - } - }); - floor.start = min; - floor.stop = max; - return pulse.modifies(band ? as : u0); - }, - _floor (_, pulse) { - const utc = _.timezone === 'utc'; - // get parameters - const { units, step } = _.units ? { - units: _.units, - step: _.step || 1 - } : (0, _vegaTime.timeBin)({ - extent: _.extent || (0, _vegaUtil.extent)(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }); - // check / standardize time units - const tunits = (0, _vegaTime.timeUnits)(units), prev = this.value || {}, floor = (utc ? (0, _vegaTime.utcFloor) : (0, _vegaTime.timeFloor))(tunits, step); - floor.unit = (0, _vegaUtil.peek)(tunits); - floor.units = tunits; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - } -}); -/** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ function TupleIndex(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -(0, _vegaUtil.inherits)(TupleIndex, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, field = _.field, index = this.value, set = (t)=>index.set(field(t), t); - let mod = true; - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, (t)=>index.delete(field(t))); - pulse.visit(pulse.ADD, set); - } else mod = false; - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - } -}); -/** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ function Values(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Values, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields); - if (run) this.value = (_.sort ? pulse.source.slice().sort((0, _vegaDataflow.stableCompare)(_.sort)) : pulse.source).map(_.field); - } -}); -function WindowOp(op, field, param, as) { - const fn = WindowOps[op](field, param); - return { - init: fn.init || (0, _vegaUtil.zero), - update: function(w, t) { - t[as] = fn.next(w); - } - }; -} -const WindowOps = { - row_number: function() { - return { - next: (w)=>w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: ()=>rank = 1, - next: (w)=>{ - const i = w.index, data = w.data; - return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: ()=>drank = 1, - next: (w)=>{ - const i = w.index, d = w.data; - return i && w.compare(d[i - 1], d[i]) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - const rank = WindowOps.rank(), next = rank.next; - return { - init: rank.init, - next: (w)=>(next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: ()=>cume = 0, - next: (w)=>{ - const d = w.data, c = w.compare; - let i = w.index; - if (cume < i) { - while(i + 1 < d.length && !c(d[i], d[i + 1]))++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) (0, _vegaUtil.error)('ntile num must be greater than zero.'); - const cume = WindowOps.cume_dist(), next = cume.next; - return { - init: cume.init, - next: (w)=>Math.ceil(num * next(w)) - }; - }, - lag: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index + offset, d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - first_value: function(field) { - return { - next: (w)=>field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: (w)=>field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) (0, _vegaUtil.error)('nth_value nth must be greater than zero.'); - return { - next: (w)=>{ - const i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - prev_value: function(field) { - let prev; - return { - init: ()=>prev = null, - next: (w)=>{ - const v = field(w.data[w.index]); - return v != null ? prev = v : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: ()=>(v = null, i = -1), - next: (w)=>{ - const d = w.data; - return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]); - } - }; - } -}; -function find(field, data, index) { - for(let n = data.length; index < n; ++index){ - const v = field(data[index]); - if (v != null) return index; - } - return -1; -} -const ValidWindowOps = Object.keys(WindowOps); -function WindowState(_) { - const ops = (0, _vegaUtil.array)(_.ops), fields = (0, _vegaUtil.array)(_.fields), params = (0, _vegaUtil.array)(_.params), aggregate_params = (0, _vegaUtil.array)(_.aggregate_params), as = (0, _vegaUtil.array)(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map = {}, counts = [], measures = []; - let countOnly = true; - function visitInputs(f) { - (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(f)).forEach((_)=>inputs[_] = 1); - } - visitInputs(_.sort); - ops.forEach((op, i)=>{ - const field = fields[i], param = params[i], aggregate_param = aggregate_params[i] || null, mname = (0, _vegaUtil.accessorName)(field), name = measureName(op, mname, as[i]); - visitInputs(field); - outputs.push(name); - // Window operation - if ((0, _vegaUtil.hasOwnProperty)(WindowOps, op)) windows.push(WindowOp(op, field, param, name)); - else { - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - if (op === 'count') { - counts.push(name); - return; - } - countOnly = false; - let m = map[mname]; - if (!m) { - m = map[mname] = []; - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, aggregate_param, name)); - } - }); - if (counts.length || measures.length) this.cell = cell(measures, counts, countOnly); - this.inputs = Object.keys(inputs); -} -const prototype = WindowState.prototype; -prototype.init = function() { - this.windows.forEach((_)=>_.init()); - if (this.cell) this.cell.init(); -}; -prototype.update = function(w, t) { - const cell = this.cell, wind = this.windows, data = w.data, m = wind && wind.length; - let j; - if (cell) { - for(j = w.p0; j < w.i0; ++j)cell.rem(data[j]); - for(j = w.p1; j < w.i1; ++j)cell.add(data[j]); - cell.set(t); - } - for(j = 0; j < m; ++j)wind[j].update(w, t); -}; -function cell(measures, counts, countOnly) { - measures = measures.map((m)=>compileMeasures(m, m.field)); - const cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - if (!countOnly) { - var n = measures.length, a = cell.agg = Array(n), i = 0; - for(; i < n; ++i)a[i] = new measures[i](cell); - } - if (cell.store) var store = cell.data = new TupleStore(); - cell.add = function(t) { - cell.num += 1; - if (countOnly) return; - if (store) store.add(t); - for(let i = 0; i < n; ++i)a[i].add(a[i].get(t), t); - }; - cell.rem = function(t) { - cell.num -= 1; - if (countOnly) return; - if (store) store.rem(t); - for(let i = 0; i < n; ++i)a[i].rem(a[i].get(t), t); - }; - cell.set = function(t) { - let i, n; - // consolidate stored values - if (store) store.values(); - // update tuple properties - for(i = 0, n = counts.length; i < n; ++i)t[counts[i]] = cell.num; - if (!countOnly) for(i = 0, n = a.length; i < n; ++i)a[i].set(t); - }; - cell.init = function() { - cell.num = 0; - if (store) store.reset(); - for(let i = 0; i < n; ++i)a[i].init(); - }; - return cell; -} -/** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array<string>} params.ops - An array of strings indicating window operations to perform. - * @param {Array<function(object): *>} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameter values for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for window operations. - * @param {Array<number>} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ function Window(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._mlen = 0; - this._mods = []; -} -Window.Definition = { - 'type': 'Window', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidWindowOps.concat(ValidAggregateOps) - }, - { - 'name': 'params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'frame', - 'type': 'number', - 'null': true, - 'array': true, - 'length': 2, - 'default': [ - null, - 0 - ] - }, - { - 'name': 'ignorePeers', - 'type': 'boolean', - 'default': false - } - ] -}; -(0, _vegaUtil.inherits)(Window, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.stamp = pulse.stamp; - const mod = _.modified(), cmp = (0, _vegaDataflow.stableCompare)(_.sort), key = groupkey(_.groupby), group = (t)=>this.group(key(t)); - // initialize window state - let state = this.state; - if (!state || mod) state = this.state = new WindowState(_); - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - this.value = {}; - pulse.visit(pulse.SOURCE, (t)=>group(t).add(t)); - } else { - pulse.visit(pulse.REM, (t)=>group(t).remove(t)); - pulse.visit(pulse.ADD, (t)=>group(t).add(t)); - } - // perform window calculations for each modified partition - for(let i = 0, n = this._mlen; i < n; ++i)processPartition(this._mods[i], state, cmp, _); - this._mlen = 0; - this._mods = []; - // TODO don't reflow everything? - return pulse.reflow(mod).modifies(state.outputs); - }, - group (key) { - let group = this.value[key]; - if (!group) { - group = this.value[key] = SortedList((0, _vegaDataflow.tupleid)); - group.stamp = -1; - } - if (group.stamp < this.stamp) { - group.stamp = this.stamp; - this._mods[this._mlen++] = group; - } - return group; - } -}); -function processPartition(list, state, cmp, _) { - const sort = _.sort, range = sort && !_.ignorePeers, frame = _.frame || [ - null, - 0 - ], data = list.data(cmp), // use cmp for stable sort - n = data.length, b = range ? (0, _d3Array.bisector)(sort) : null, w = { - i0: 0, - i1: 0, - p0: 0, - p1: 0, - index: 0, - data: data, - compare: sort || (0, _vegaUtil.constant)(-1) - }; - state.init(); - for(let i = 0; i < n; ++i){ - setWindow(w, frame, i, n); - if (range) adjustRange(w, b); - state.update(w, data[i]); - } -} -function setWindow(w, f, i, n) { - w.p0 = w.i0; - w.p1 = w.i1; - w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); - w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); - w.index = i; -} -// if frame type is 'range', adjust window for peer values -function adjustRange(w, bisect) { - const r0 = w.i0, r1 = w.i1 - 1, c = w.compare, d = w.data, n = d.length - 1; - if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]); -} - -},{"vega-util":"bApja","vega-dataflow":"3NitK","vega-statistics":"5ncfv","d3-array":"6IwJG","vega-time":"27kpp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ncfv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bandwidthNRD", ()=>estimateBandwidth); -parcelHelpers.export(exports, "bin", ()=>bin); -parcelHelpers.export(exports, "bootstrapCI", ()=>bootstrapCI); -parcelHelpers.export(exports, "cumulativeLogNormal", ()=>cumulativeLogNormal); -parcelHelpers.export(exports, "cumulativeNormal", ()=>cumulativeNormal); -parcelHelpers.export(exports, "cumulativeUniform", ()=>cumulativeUniform); -parcelHelpers.export(exports, "densityLogNormal", ()=>densityLogNormal); -parcelHelpers.export(exports, "densityNormal", ()=>densityNormal); -parcelHelpers.export(exports, "densityUniform", ()=>densityUniform); -parcelHelpers.export(exports, "dotbin", ()=>dotbin); -parcelHelpers.export(exports, "quantileLogNormal", ()=>quantileLogNormal); -parcelHelpers.export(exports, "quantileNormal", ()=>quantileNormal); -parcelHelpers.export(exports, "quantileUniform", ()=>quantileUniform); -parcelHelpers.export(exports, "quantiles", ()=>quantiles); -parcelHelpers.export(exports, "quartiles", ()=>quartiles); -parcelHelpers.export(exports, "random", ()=>random); -parcelHelpers.export(exports, "randomInteger", ()=>integer); -parcelHelpers.export(exports, "randomKDE", ()=>kde); -parcelHelpers.export(exports, "randomLCG", ()=>lcg); -parcelHelpers.export(exports, "randomLogNormal", ()=>lognormal); -parcelHelpers.export(exports, "randomMixture", ()=>mixture); -parcelHelpers.export(exports, "randomNormal", ()=>gaussian); -parcelHelpers.export(exports, "randomUniform", ()=>uniform); -parcelHelpers.export(exports, "regressionConstant", ()=>constant); -parcelHelpers.export(exports, "regressionExp", ()=>exp); -parcelHelpers.export(exports, "regressionLinear", ()=>linear); -parcelHelpers.export(exports, "regressionLoess", ()=>loess); -parcelHelpers.export(exports, "regressionLog", ()=>log); -parcelHelpers.export(exports, "regressionPoly", ()=>poly); -parcelHelpers.export(exports, "regressionPow", ()=>pow); -parcelHelpers.export(exports, "regressionQuad", ()=>quad); -parcelHelpers.export(exports, "sampleCurve", ()=>sampleCurve); -parcelHelpers.export(exports, "sampleLogNormal", ()=>sampleLogNormal); -parcelHelpers.export(exports, "sampleNormal", ()=>sampleNormal); -parcelHelpers.export(exports, "sampleUniform", ()=>sampleUniform); -parcelHelpers.export(exports, "setRandom", ()=>setRandom); -var _d3Array = require("d3-array"); -function* numbers(values, valueof) { - if (valueof == null) { - for (let value of values)if (value != null && value !== '' && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values){ - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) yield value; - } - } -} -function quantiles(array, p, f) { - const values = Float64Array.from(numbers(array, f)); - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort((0, _d3Array.ascending)); - return p.map((_)=>(0, _d3Array.quantileSorted)(values, _)); -} -function quartiles(array, f) { - return quantiles(array, [ - 0.25, - 0.50, - 0.75 - ], f); -} -// Scott, D. W. (1992) Multivariate Density Estimation: -// Theory, Practice, and Visualization. Wiley. -function estimateBandwidth(array, f) { - const n = array.length, d = (0, _d3Array.deviation)(array, f), q = quartiles(array, f), h = (q[2] - q[0]) / 1.34, v = Math.min(d, h) || d || Math.abs(q[0]) || 1; - return 1.06 * v * Math.pow(n, -0.2); -} -function bin(_) { - // determine range - const maxb = _.maxbins || 20, base = _.base || 10, logb = Math.log(base), div = _.divide || [ - 5, - 2 - ]; - let min = _.extent[0], max = _.extent[1], step, level, minstep, v, i, n; - const span = _.span || max - min || Math.abs(min) || 1; - if (_.step) // if step size is explicitly given, use that - step = _.step; - else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for(i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i - 1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); - // increase step size if too many bins - while(Math.ceil(span / step) > maxb)step *= base; - // decrease step size if allowed - for(i = 0, n = div.length; i < n; ++i){ - v = step / div[i]; - if (v >= minstep && span / v <= maxb) step = v; - } - } - // update precision, min and max - v = Math.log(step); - const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; - } - return { - start: min, - stop: max === min ? min + step : max, - step: step - }; -} -var random = Math.random; -function setRandom(r) { - random = r; -} -function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [ - undefined, - undefined - ]; - const values = Float64Array.from(numbers(array, f)), n = values.length, m = samples; - let a, i, j, mu; - for(j = 0, mu = Array(m); j < m; ++j){ - for(a = 0, i = 0; i < n; ++i)a += values[~~(random() * n)]; - mu[j] = a / n; - } - mu.sort((0, _d3Array.ascending)); - return [ - (0, _d3Array.quantile)(mu, alpha / 2), - (0, _d3Array.quantile)(mu, 1 - alpha / 2) - ]; -} -// Dot density binning for dot plot construction. -// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. -// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf -function dotbin(array, step, smooth, f) { - f = f || ((_)=>_); - const n = array.length, v = new Float64Array(n); - let i = 0, j = 1, a = f(array[0]), b = a, w = a + step, x; - for(; j < n; ++j){ - x = f(array[j]); - if (x >= w) { - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - w = x + step; - a = x; - } - b = x; - } - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - return smooth ? smoothing(v, step + step / 4) : v; -} -// perform smoothing to reduce variance -// swap points between "adjacent" stacks -// Wilkinson defines adjacent as within step/4 units -function smoothing(v, thresh) { - const n = v.length; - let a = 0, b = 1, c, d; - // get left stack - while(v[a] === v[b])++b; - while(b < n){ - // get right stack - c = b + 1; - while(v[b] === v[c])++c; - // are stacks adjacent? - // if so, compare sizes and swap as needed - if (v[b] - v[b - 1] < thresh) { - d = b + (a + c - b - b >> 1); - while(d < b)v[d++] = v[b]; - while(d > b)v[d--] = v[a]; - } - // update left stack indices - a = b; - b = c; - } - return v; -} -function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; -} -function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - let a, b, d; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else return b; - }, - sample () { - return a + Math.floor(d * random()); - }, - pdf (x) { - return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0; - }, - cdf (x) { - const v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }, - icdf (p) { - return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN; - } - }; - return dist.min(min).max(max); -} -const SQRT2PI = Math.sqrt(2 * Math.PI); -const SQRT2 = Math.SQRT2; -let nextSample = NaN; -function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = random() * 2 - 1; - y = random() * 2 - 1; - rds = x * x + y * y; - }while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; -} -function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); -} -// Approximation from West (2009) -// Better Approximations to Cumulative Normal Functions -function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (value - mean) / stdev, Z = Math.abs(z); - let cd; - if (Z > 37) cd = 0; - else { - const exp = Math.exp(-Z * Z / 2); - let sum; - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; -} -// Approximation of Probit function using inverse error function. -function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); -} -// Approximate inverse error function. Implementation from "Approximating -// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. -// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 -function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = -Math.log((1 - x) * (1 + x)), p; - if (w < 6.25) { - w -= 3.125; - p = -0.00000000000000000000364441206401782; - p = -0.00000000000000000016850591381820166 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -0.0000000000000001333171662854621 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -0.00000000000004054566272975207 + p * w; - p = -0.00000000000008151934197605472 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -0.000000000012975133253453532 + p * w; - p = -0.00000000005415412054294628 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -0.000000004112633980346984 + p * w; - p = -0.000000029070369957882005 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -0.0000013654692000834679 + p * w; - p = -0.000013882523362786469 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.000740702534166267 + p * w; - p = -0.006033670871430149 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -0.00000027517406297064545 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -0.000004013867526981546 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -0.000047318229009055734 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628475 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.003751208507569241 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -0.000000000027109920616438573; - p = -0.0000000002555641816996525 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -0.000000003789465440126737 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -0.00000001496002662714924 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -0.00000006771199775845234 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -0.00000099298272942317 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -0.00001968177810553167 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477 + p * w; - p = -0.00013871931833623122 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else p = Infinity; - return p * x; -} -function gaussian(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleNormal(mu, sigma), - pdf: (value)=>densityNormal(value, mu, sigma), - cdf: (value)=>cumulativeNormal(value, mu, sigma), - icdf: (p)=>quantileNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function kde(support, bandwidth) { - const kernel = gaussian(); - let n = 0; - const dist = { - data (_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else return support; - }, - bandwidth (_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = estimateBandwidth(support); - return dist; - }, - sample () { - return support[~~(random() * n)] + bandwidth * kernel.sample(); - }, - pdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.pdf((x - support[i]) / bandwidth); - return y / bandwidth / n; - }, - cdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.cdf((x - support[i]) / bandwidth); - return y / n; - }, - icdf () { - throw Error('KDE icdf not supported.'); - } - }; - return dist.data(support); -} -function sampleLogNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - return Math.exp(mean + sampleNormal() * stdev); -} -function densityLogNormal(value, mean, stdev) { - if (value <= 0) return 0; - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (Math.log(value) - mean) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value); -} -function cumulativeLogNormal(value, mean, stdev) { - return cumulativeNormal(Math.log(value), mean, stdev); -} -function quantileLogNormal(p, mean, stdev) { - return Math.exp(quantileNormal(p, mean, stdev)); -} -function lognormal(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleLogNormal(mu, sigma), - pdf: (value)=>densityLogNormal(value, mu, sigma), - cdf: (value)=>cumulativeLogNormal(value, mu, sigma), - icdf: (p)=>quantileLogNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function mixture(dists, weights) { - let m = 0, w; - function normalize(x) { - const w = []; - let sum = 0, i; - for(i = 0; i < m; ++i)sum += w[i] = x[i] == null ? 1 : +x[i]; - for(i = 0; i < m; ++i)w[i] /= sum; - return w; - } - const dist = { - weights (_) { - if (arguments.length) { - w = normalize(weights = _ || []); - return dist; - } - return weights; - }, - distributions (_) { - if (arguments.length) { - if (_) { - m = _.length; - dists = _; - } else { - m = 0; - dists = []; - } - return dist.weights(weights); - } - return dists; - }, - sample () { - const r = random(); - let d = dists[m - 1], v = w[0], i = 0; - // first select distribution - for(; i < m - 1; v += w[++i])if (r < v) { - d = dists[i]; - break; - } - // then sample from it - return d.sample(); - }, - pdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].pdf(x); - return p; - }, - cdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].cdf(x); - return p; - }, - icdf () { - throw Error('Mixture icdf not supported.'); - } - }; - return dist.distributions(dists).weights(weights); -} -function sampleUniform(min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return min + (max - min) * random(); -} -function densityUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value >= min && value <= max ? 1 / (max - min) : 0; -} -function cumulativeUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); -} -function quantileUniform(p, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return p >= 0 && p <= 1 ? min + p * (max - min) : NaN; -} -function uniform(min, max) { - let a, b; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else return b; - }, - sample: ()=>sampleUniform(a, b), - pdf: (value)=>densityUniform(value, a, b), - cdf: (value)=>cumulativeUniform(value, a, b), - icdf: (p)=>quantileUniform(p, a, b) - }; - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return dist.min(min).max(max); -} -function constant(data, x, y) { - let mean = 0, n = 0; - for (const d of data){ - const val = y(d); - if (x(d) == null || val == null || isNaN(val)) continue; - mean += (val - mean) / ++n; - } - return { - coef: [ - mean - ], - predict: ()=>mean, - rSquared: 0 - }; -} -// Ordinary Least Squares -function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; - return [ - intercept, - slope - ]; -} -function points(data, x, y, sort) { - data = data.filter((d)=>{ - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - if (sort) data.sort((a, b)=>x(a) - x(b)); - const n = data.length, X = new Float64Array(n), Y = new Float64Array(n); - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data){ - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } - // mean center the data - for(i = 0; i < n; ++i){ - X[i] -= ux; - Y[i] -= uy; - } - return [ - X, - Y, - ux, - uy - ]; -} -function visitPoints(data, x, y, callback) { - let i = -1, u, v; - for (const d of data){ - u = x(d); - v = y(d); - if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) callback(u, v, ++i); - } -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const sse = dy - predict(dx), sst = dy - uY; - SSE += sse * sse; - SST += sst * sst; - }); - return 1 - SSE / SST; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function linear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * x; - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function log(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * Math.log(x); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -function exp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - visitPoints(data, x, y, (_, dy)=>{ - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x)=>Math.exp(c0 + c1 * (x - ux)); - return { - coef: [ - Math.exp(c0 - c1 * ux), - c1 - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function pow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const lx = Math.log(dx), ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] * Math.pow(x, coef[1]); - coef[0] = Math.exp(coef[0]); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; -} -function quad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length; - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x2; - for(i = 0; i < n;){ - dx = xv[i]; - dy = yv[i++]; - x2 = dx * dx; - X2 += (x2 - X2) / i; - X3 += (x2 * dx - X3) / i; - X4 += (x2 * x2 - X4) / i; - XY += (dx * dy - XY) / i; - X2Y += (x2 * dy - X2Y) / i; - } - const X2X2 = X4 - X2 * X2, d = X2 * X2X2 - X3 * X3, a = (X2Y * X2 - XY * X3) / d, b = (XY * X2X2 - X2Y * X3) / d, c = -a * X2, predict = (x)=>{ - x = x - ux; - return a * x * x + b * x + c + uy; - }; - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -// ... which was adapted from regression-js by Tom Alexander -// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 -// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE -function poly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 0) return constant(data, x, y); - if (order === 1) return linear(data, x, y); - if (order === 2) return quad(data, x, y); - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length, lhs = [], rhs = [], k = order + 1; - let i, j, l, v, c; - for(i = 0; i < k; ++i){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i) * yv[l]; - lhs.push(v); - c = new Float64Array(k); - for(j = 0; j < k; ++j){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i + j); - c[j] = v; - } - rhs.push(c); - } - rhs.push(lhs); - const coef = gaussianElimination(rhs), predict = (x)=>{ - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for(i = 3; i < k; ++i)y += coef[i] * Math.pow(x, i); - return y; - }; - return { - coef: uncenter(k, coef, -ux, uy), - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -function uncenter(k, a, x, y) { - const z = Array(k); - let i, j, v, c; - // initialize to zero - for(i = 0; i < k; ++i)z[i] = 0; - // polynomial expansion - for(i = k - 1; i >= 0; --i){ - v = a[i]; - c = 1; - z[i] += v; - for(j = 1; j <= i; ++j){ - c *= (i + 1 - j) / j; // binomial coefficent - z[i - j] += v * Math.pow(x, j) * c; - } - } - // bias term - z[0] += y; - return z; -} -// Given an array for a two-dimensional matrix and the polynomial order, -// solve A * x = b using Gaussian elimination. -function gaussianElimination(matrix) { - const n = matrix.length - 1, coef = []; - let i, j, k, r, t; - for(i = 0; i < n; ++i){ - r = i; // max row - for(j = i + 1; j < n; ++j)if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) r = j; - for(k = i; k < n + 1; ++k){ - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; - } - for(j = i + 1; j < n; ++j)for(k = n; k >= i; k--)matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; - } - for(j = n - 1; j >= 0; --j){ - t = 0; - for(k = j + 1; k < n; ++k)t += matrix[k][j] * coef[k]; - coef[j] = (matrix[n][j] - t) / matrix[j][j]; + for (j = n - 1; j >= 0; --j) { + t = 0; + for (k = j + 1; k < n; ++k) { + t += matrix[k][j] * coef[k]; + } + coef[j] = (matrix[n][j] - t) / matrix[j][j]; } return coef; -} -const maxiters = 2, epsilon = 1e-12; -// Adapted from science.js by Jason Davies -// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js -// License: https://github.com/jasondavies/science.js/blob/master/LICENSE -function loess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), n = xv.length, bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); - for(let iter = -1; ++iter <= maxiters;){ - const interval = [ - 0, - bw - 1 - ]; - for(let i = 0; i < n; ++i){ - const dx = xv[i], i0 = interval[0], i1 = interval[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0; - const denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - for(let k = i0; k <= i1; ++k){ - const xk = xv[k], yk = yv[k], w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w; - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - updateInterval(xv, i + 1, interval); - } - if (iter === maxiters) break; - const medianResidual = (0, _d3Array.median)(residuals); - if (Math.abs(medianResidual) < epsilon) break; - for(let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w; - } - } - return output(xv, yhat, ux, uy); -} -// weighting kernel for local regression -function tricube(x) { - return (x = 1 - x * x * x) * x * x; -} -// advance sliding window interval of nearest neighbors -function updateInterval(xv, i, interval) { + } + const maxiters = 2, epsilon$6 = 1e-12; + function loess(data2, x2, y2, bandwidth2) { + const [xv, yv, ux, uy] = points(data2, x2, y2, true), n = xv.length, bw = Math.max(2, ~~(bandwidth2 * n)), yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); + for (let iter = -1; ++iter <= maxiters; ) { + const interval2 = [0, bw - 1]; + for (let i = 0; i < n; ++i) { + const dx = xv[i], i0 = interval2[0], i1 = interval2[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; + let W = 0, X3 = 0, Y3 = 0, XY = 0, X22 = 0; + const denom = 1 / Math.abs(xv[edge] - dx || 1); + for (let k = i0; k <= i1; ++k) { + const xk = xv[k], yk = yv[k], w2 = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w2; + W += w2; + X3 += xkw; + Y3 += yk * w2; + XY += yk * xkw; + X22 += xk * xkw; + } + const [a2, b2] = ols(X3 / W, Y3 / W, XY / W, X22 / W); + yhat[i] = a2 + b2 * dx; + residuals[i] = Math.abs(yv[i] - yhat[i]); + updateInterval(xv, i + 1, interval2); + } + if (iter === maxiters) { + break; + } + const medianResidual = median(residuals); + if (Math.abs(medianResidual) < epsilon$6) break; + for (let i = 0, arg, w2; i < n; ++i) { + arg = residuals[i] / (6 * medianResidual); + robustWeights[i] = arg >= 1 ? epsilon$6 : (w2 = 1 - arg * arg) * w2; + } + } + return output$1(xv, yhat, ux, uy); + } + function tricube(x2) { + return (x2 = 1 - x2 * x2 * x2) * x2 * x2; + } + function updateInterval(xv, i, interval2) { const val = xv[i]; - let left = interval[0], right = interval[1] + 1; + let left = interval2[0], right = interval2[1] + 1; if (right >= xv.length) return; - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while(i > left && xv[right] - val <= val - xv[left]){ - interval[0] = ++left; - interval[1] = right; - ++right; - } -} -// generate smoothed output points -// average points with repeated x values -function output(xv, yhat, ux, uy) { + while (i > left && xv[right] - val <= val - xv[left]) { + interval2[0] = ++left; + interval2[1] = right; + ++right; + } + } + function output$1(xv, yhat, ux, uy) { const n = xv.length, out = []; let i = 0, cnt = 0, prev = [], v; - for(; i < n; ++i){ - v = xv[i] + ux; - if (prev[0] === v) // average output values via online update + for (; i < n; ++i) { + v = xv[i] + ux; + if (prev[0] === v) { prev[1] += (yhat[i] - prev[1]) / ++cnt; - else { - // add new output point - cnt = 0; - prev[1] += uy; - prev = [ - v, - yhat[i] - ]; - out.push(prev); - } + } else { + cnt = 0; + prev[1] += uy; + prev = [v, yhat[i]]; + out.push(prev); + } } prev[1] += uy; return out; -} -// subdivide up to accuracy of 0.5 degrees -const MIN_RADIANS = 0.5 * Math.PI / 180; -// Adaptively sample an interpolated function over a domain extent -function sampleCurve(f, extent, minSteps, maxSteps) { + } + const MIN_RADIANS = 0.5 * Math.PI / 180; + function sampleCurve(f, extent2, minSteps, maxSteps) { minSteps = minSteps || 25; maxSteps = Math.max(minSteps, maxSteps || 200); - const point = (x)=>[ - x, - f(x) - ], minX = extent[0], maxX = extent[1], span = maxX - minX, stop = span / maxSteps, prev = [ - point(minX) - ], next = []; + const point2 = (x2) => [x2, f(x2)], minX = extent2[0], maxX = extent2[1], span2 = maxX - minX, stop2 = span2 / maxSteps, prev = [point2(minX)], next = []; if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for(let i = 1; i < maxSteps; ++i)prev.push(point(minX + i / minSteps * span)); - prev.push(point(maxX)); - return prev; + for (let i = 1; i < maxSteps; ++i) { + prev.push(point2(minX + i / minSteps * span2)); + } + prev.push(point2(maxX)); + return prev; } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for(let i = minSteps; --i > 0;)next.push(point(minX + i / minSteps * span)); + next.push(point2(maxX)); + for (let i = minSteps; --i > 0; ) { + next.push(point2(minX + i / minSteps * span2)); + } } - let p0 = prev[0]; + let p02 = prev[0]; let p1 = next[next.length - 1]; - const sx = 1 / span; - const sy = scaleY(p0[1], next); - while(p1){ - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - const dx = pm[0] - p0[0] >= stop; - if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) // maximum resolution has not yet been met, and - // subdivision midpoint is sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack + const sx = 1 / span2; + const sy = scaleY(p02[1], next); + while (p1) { + const pm = point2((p02[0] + p1[0]) / 2); + const dx = pm[0] - p02[0] >= stop2; + if (dx && angleDelta(p02, pm, p1, sx, sy) > MIN_RADIANS) { next.push(pm); - else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; + } else { + p02 = p1; + prev.push(p1); + next.pop(); + } + p1 = next[next.length - 1]; } return prev; -} -function scaleY(init, points) { - let ymin = init; - let ymax = init; - const n = points.length; - for(let i = 0; i < n; ++i){ - const y = points[i][1]; - if (y < ymin) ymin = y; - if (y > ymax) ymax = y; + } + function scaleY(init2, points2) { + let ymin = init2; + let ymax = init2; + const n = points2.length; + for (let i = 0; i < n; ++i) { + const y2 = points2[i][1]; + if (y2 < ymin) ymin = y2; + if (y2 > ymax) ymax = y2; } return 1 / (ymax - ymin); -} -function angleDelta(p, q, r, sx, sy) { + } + function angleDelta(p, q, r, sx, sy) { const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])), a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0])); return Math.abs(a0 - a1); -} - -},{"d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i63Ad":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bound", ()=>Bound); -parcelHelpers.export(exports, "identifier", ()=>Identifier); -parcelHelpers.export(exports, "mark", ()=>Mark); -parcelHelpers.export(exports, "overlap", ()=>Overlap); -parcelHelpers.export(exports, "render", ()=>Render); -parcelHelpers.export(exports, "viewlayout", ()=>ViewLayout); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaUtil = require("vega-util"); -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const TopLeft = 'top-left'; -const TopRight = 'top-right'; -const BottomLeft = 'bottom-left'; -const BottomRight = 'bottom-right'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const X = 'x'; -const Y = 'y'; -const Group = 'group'; -const AxisRole = 'axis'; -const TitleRole = 'title'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const LegendRole = 'legend'; -const RowHeader = 'row-header'; -const RowFooter = 'row-footer'; -const RowTitle = 'row-title'; -const ColHeader = 'column-header'; -const ColFooter = 'column-footer'; -const ColTitle = 'column-title'; -const Padding = 'padding'; -const Symbols = 'symbol'; -const Fit = 'fit'; -const FitX = 'fit-x'; -const FitY = 'fit-y'; -const Pad = 'pad'; -const None = 'none'; -const All = 'all'; -const Each = 'each'; -const Flush = 'flush'; -const Column = 'column'; -const Row = 'row'; -/** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ function Bound(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Bound, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow, mark = _.mark, type = mark.marktype, entry = (0, _vegaScenegraph.Marks)[type], bound = entry.bound; - let markBounds = mark.bounds, rebound; - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem(mark, bound); - mark.items.forEach((item)=>{ - item.bounds.clear().union(markBounds); - }); - } else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, (item)=>view.dirty(item)); - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(boundItem(item, bound))); - // force reflow for axes/legends/titles to propagate any layout changes - switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - pulse.visit(pulse.ADD, (item)=>{ - markBounds.union(boundItem(item, bound)); - }); - pulse.visit(pulse.MOD, (item)=>{ - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem(item, bound)); - }); - if (rebound) { - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(item.bounds)); - } - } - // ensure mark bounds do not exceed any clipping region - (0, _vegaScenegraph.boundClip)(mark); - return pulse.modifies('bounds'); - } -}); -function boundItem(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); -} -const COUNTER_NAME = ':vega_identifier:'; -/** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ function Identifier(params) { - (0, _vegaDataflow.Transform).call(this, 0, params); -} -Identifier.Definition = { - 'type': 'Identifier', - 'metadata': { - 'modifies': true + } + function multikey(f) { + return (x2) => { + const n = f.length; + let i = 1, k = String(f[0](x2)); + for (; i < n; ++i) { + k += "|" + f[i](x2); + } + return k; + }; + } + function groupkey(fields) { + return !fields || !fields.length ? function() { + return ""; + } : fields.length === 1 ? fields[0] : multikey(fields); + } + function measureName(op, field2, as) { + return as || op + (!field2 ? "" : "_" + field2); + } + const noop$4 = () => { + }; + const base_op = { + init: noop$4, + add: noop$4, + rem: noop$4, + idx: 0 + }; + const AggregateOps = { + values: { + init: (m2) => m2.cell.store = true, + value: (m2) => m2.cell.data.values(), + idx: -1 }, - 'params': [ - { - 'name': 'as', - 'type': 'string', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Identifier, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const counter = getCounter(pulse.dataflow), as = _.as; - let id = counter.value; - pulse.visit(pulse.ADD, (t)=>t[as] = t[as] || ++id); - counter.set(this.value = id); - return pulse; - } -}); -function getCounter(view) { - return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); -} -/** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ function Mark(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Mark, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let mark = this.value; - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - // initialize entering items - const Init = mark.marktype === Group ? (0, _vegaScenegraph.GroupItem) : (0, _vegaScenegraph.Item); - pulse.visit(pulse.ADD, (item)=>Init.call(item, mark)); - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; - } -}); -function lookup$1(_) { - const g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; -} -/** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ function Overlap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const methods = { - parity: (items)=>items.filter((item, i)=>i % 2 ? item.opacity = 0 : 1), - greedy: (items, sep)=>{ - let a; - return items.filter((b, i)=>!i || !intersect(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0); - } -}; -// compute bounding box intersection -// including padding pixels of separation -const intersect = (a, b, sep)=>sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2); -const hasOverlap = (items, pad)=>{ - for(var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i){ - if (intersect(a, b = items[i].bounds, pad)) return true; - } -}; -const hasBounds = (item)=>{ - const b = item.bounds; - return b.width() > 1 && b.height() > 1; -}; -const boundTest = (scale, orient, tolerance)=>{ - var range = scale.range(), b = new (0, _vegaScenegraph.Bounds)(); - if (orient === Top || orient === Bottom) b.set(range[0], -Infinity, range[1], Infinity); - else b.set(-Infinity, range[0], Infinity, range[1]); - b.expand(tolerance || 1); - return (item)=>b.encloses(item.bounds); -}; -// reset all items to be fully opaque -const reset = (source)=>{ - source.forEach((item)=>item.opacity = 1); - return source; -}; -// add all tuples to mod, fork pulse if parameters were modified -// fork prevents cross-stream tuple pollution (e.g., pulse from scale) -const reflow = (pulse, _)=>pulse.reflow(_.modified()).modifies('opacity'); -(0, _vegaUtil.inherits)(Overlap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; - let source = pulse.materialize(pulse.SOURCE).source, items, test; - if (!source || !source.length) return; - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - // skip labels with no content - source = source.filter(hasBounds); - // early exit, nothing to do - if (!source.length) return; - if (_.sort) source = source.slice().sort(_.sort); - items = reset(source); - pulse = reflow(pulse, _); - if (items.length >= 3 && hasOverlap(items, sep)) { - do items = reduce(items, sep); - while (items.length >= 3 && hasOverlap(items, sep)); - if (items.length < 3 && !(0, _vegaUtil.peek)(source).opacity) { - if (items.length > 1) (0, _vegaUtil.peek)(items).opacity = 0; - (0, _vegaUtil.peek)(source).opacity = 1; - } - } - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach((item)=>{ - if (!test(item)) item.opacity = 0; - }); - } - // re-calculate mark bounds - const bounds = items[0].mark.bounds.clear(); - source.forEach((item)=>{ - if (item.opacity) bounds.union(item.bounds); - }); - return pulse; - } -}); -/** - * Queue modified scenegraph items for rendering. - * @constructor - */ function Render(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Render, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - pulse.visit(pulse.ALL, (item)=>view.dirty(item)); - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - const item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - } -}); -const tempBounds = new (0, _vegaScenegraph.Bounds)(); -function set(item, property, value) { - return item[property] === value ? 0 : (item[property] = value, 1); -} -function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; -} -function axisIndices(datum) { - let index = +datum.grid; - return [ - datum.ticks ? index++ : -1, - // ticks index - datum.labels ? index++ : -1, - // labels index - index + +datum.domain // title index - ]; -} -function axisLayout(view, axis, width, height) { - var item = axis.items[0], datum = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum), range = item.range, offset = item.offset, position = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds = item.bounds, dl = title && (0, _vegaScenegraph.multiLineOffset)(title), x = 0, y = 0, i, s; - tempBounds.clear().union(bounds); - bounds.clear(); - if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); - // position axis group and title - switch(orient){ - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - // update bounds - (0, _vegaScenegraph.boundStroke)(bounds.translate(x, y), item); - if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) { - item.bounds = tempBounds; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - return item.mark.bounds.clear().union(bounds); -} -function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - view.dirty(title); - isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - bounds.union(b); -} -// aggregation functions for grid margin determination -const min = (a, b)=>Math.floor(Math.min(a, b)); -const max = (a, b)=>Math.ceil(Math.max(a, b)); -function gridLayoutGroups(group) { - var groups = group.items, n = groups.length, i = 0, mark, items; - const views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - // layout axes, gather legends, collect bounds - for(; i < n; ++i){ - mark = groups[i]; - items = mark.items; - if (mark.marktype === Group) switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - break; - case RowHeader: - views.rowheaders.push(...items); - break; - case RowFooter: - views.rowfooters.push(...items); - break; - case ColHeader: - views.colheaders.push(...items); - break; - case ColFooter: - views.colfooters.push(...items); - break; - case RowTitle: - views.rowtitle = items[0]; - break; - case ColTitle: - views.coltitle = items[0]; - break; - default: - views.marks.push(...items); - } - } - return views; -} -function bboxFlush(item) { - return new (0, _vegaScenegraph.Bounds)().set(0, 0, item.width || 0, item.height || 0); -} -function bboxFull(item) { - const b = item.bounds.clone(); - return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0)); -} -function get(opt, key, d) { - const v = (0, _vegaUtil.isObject)(opt) ? opt[key] : opt; - return v != null ? v : d !== undefined ? d : 0; -} -function offsetValue(v) { - return v < 0 ? Math.ceil(-v) : 0; -} -function gridLayout(view, groups, opt) { - var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds = tempBounds.set(0, 0, 0, 0), alignCol = get(opt.align, Column), alignRow = get(opt.align, Row), padCol = get(opt.padding, Column), padRow = get(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m, i, c, r, b, g, px, py, x, y, offset; - for(i = 0; i < ncols; ++i)xExtent[i] = 0; - for(i = 0; i < nrows; ++i)yExtent[i] = 0; - // determine offsets for each group - for(i = 0; i < n; ++i){ - g = groups[i]; - b = boxes[i] = bbox(g); - g.x = g.x || 0; - dx[i] = 0; - g.y = g.y || 0; - dy[i] = 0; - c = i % ncols; - r = ~~(i / ncols); - xMax = Math.max(xMax, px = Math.ceil(b.x2)); - yMax = Math.max(yMax, py = Math.ceil(b.y2)); - xExtent[c] = Math.max(xExtent[c], px); - yExtent[r] = Math.max(yExtent[r], py); - xOffset[i] = padCol + offsetValue(b.x1); - yOffset[i] = padRow + offsetValue(b.y1); - if (dirty) view.dirty(groups[i]); - } - // set initial alignment offsets - for(i = 0; i < n; ++i){ - if (i % ncols === 0) xOffset[i] = 0; - if (i < ncols) yOffset[i] = 0; - } - // enforce column alignment constraints - if (alignCol === Each) for(c = 1; c < ncols; ++c){ - for(offset = 0, i = c; i < n; i += ncols)if (offset < xOffset[i]) offset = xOffset[i]; - for(i = c; i < n; i += ncols)xOffset[i] = offset + xExtent[c - 1]; - } - else if (alignCol === All) { - for(offset = 0, i = 0; i < n; ++i)if (i % ncols && offset < xOffset[i]) offset = xOffset[i]; - for(i = 0; i < n; ++i)if (i % ncols) xOffset[i] = offset + xMax; - } else { - for(alignCol = false, c = 1; c < ncols; ++c)for(i = c; i < n; i += ncols)xOffset[i] += xExtent[c - 1]; - } - // enforce row alignment constraints - if (alignRow === Each) for(r = 1; r < nrows; ++r){ - for(offset = 0, i = r * ncols, m = i + ncols; i < m; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = r * ncols; i < m; ++i)yOffset[i] = offset + yExtent[r - 1]; - } - else if (alignRow === All) { - for(offset = 0, i = ncols; i < n; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = ncols; i < n; ++i)yOffset[i] = offset + yMax; - } else { - for(alignRow = false, r = 1; r < nrows; ++r)for(i = r * ncols, m = i + ncols; i < m; ++i)yOffset[i] += yExtent[r - 1]; - } - // perform horizontal grid layout - for(x = 0, i = 0; i < n; ++i){ - x = xOffset[i] + (i % ncols ? x : 0); - dx[i] += x - groups[i].x; - } - // perform vertical grid layout - for(c = 0; c < ncols; ++c)for(y = 0, i = c; i < n; i += ncols){ - y += yOffset[i]; - dy[i] += y - groups[i].y; - } - // perform horizontal centering - if (alignCol && get(opt.center, Column) && nrows > 1) for(i = 0; i < n; ++i){ - b = alignCol === All ? xMax : xExtent[i % ncols]; - x = b - boxes[i].x2 - groups[i].x - dx[i]; - if (x > 0) dx[i] += x / 2; - } - // perform vertical centering - if (alignRow && get(opt.center, Row) && ncols !== 1) for(i = 0; i < n; ++i){ - b = alignRow === All ? yMax : yExtent[~~(i / ncols)]; - y = b - boxes[i].y2 - groups[i].y - dy[i]; - if (y > 0) dy[i] += y / 2; - } - // position grid relative to anchor - for(i = 0; i < n; ++i)bounds.union(boxes[i].translate(dx[i], dy[i])); - x = get(opt.anchor, X); - y = get(opt.anchor, Y); - switch(get(opt.anchor, Column)){ - case End: - x -= bounds.width(); - break; - case Middle: - x -= bounds.width() / 2; - } - switch(get(opt.anchor, Row)){ - case End: - y -= bounds.height(); - break; - case Middle: - y -= bounds.height() / 2; - } - x = Math.round(x); - y = Math.round(y); - // update mark positions, bounds, dirty - bounds.clear(); - for(i = 0; i < n; ++i)groups[i].mark.bounds.clear(); - for(i = 0; i < n; ++i){ - g = groups[i]; - g.x += dx[i] += x; - g.y += dy[i] += y; - bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); - if (dirty) view.dirty(g); - } - return bounds; -} -function trellisLayout(view, group, opt) { - var views = gridLayoutGroups(group), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x, y, x2, y2, anchor, band, offset; - // -- initial grid layout - const bounds = gridLayout(view, groups, opt); - if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid - // -- layout grid headers and footers -- - // perform row header layout - if (views.rowheaders) { - band = get(opt.headerBand, Row, null); - x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band); - } - // perform column header layout - if (views.colheaders) { - band = get(opt.headerBand, Column, null); - y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band); - } - // perform row footer layout - if (views.rowfooters) { - band = get(opt.footerBand, Row, null); - x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band); - } - // perform column footer layout - if (views.colfooters) { - band = get(opt.footerBand, Column, null); - y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band); - } - // perform row title layout - if (views.rowtitle) { - anchor = get(opt.titleAnchor, Row); - offset = get(off, 'rowTitle'); - offset = anchor === End ? x2 + offset : x - offset; - band = get(opt.titleBand, Row, 0.5); - layoutTitle(view, views.rowtitle, offset, 0, bounds, band); - } - // perform column title layout - if (views.coltitle) { - anchor = get(opt.titleAnchor, Column); - offset = get(off, 'columnTitle'); - offset = anchor === End ? y2 + offset : y - offset; - band = get(opt.titleBand, Column, 0.5); - layoutTitle(view, views.coltitle, offset, 1, bounds, band); - } -} -function boundFlush(item, field) { - return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined; -} -function boundFull(item, field) { - return item.bounds[field]; -} -function layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) { - var n = groups.length, init = 0, edge = 0, i, j, k, m, b, h, g, x, y; - // if no groups, early exit and return 0 - if (!n) return init; - // compute margin - for(i = start; i < n; i += stride)if (groups[i]) init = agg(init, bound(groups[i], bf)); - // if no headers, return margin calculation - if (!headers.length) return init; - // check if number of headers exceeds number of rows or columns - if (headers.length > limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - // apply offset - init += offset; - // clear mark bounds for all headers - for(j = 0, m = headers.length; j < m; ++j){ - view.dirty(headers[j]); - headers[j].mark.bounds.clear(); - } - // layout each header - for(i = start, j = 0, m = headers.length; j < m; ++j, i += stride){ - h = headers[j]; - b = h.mark.bounds; - // search for nearest group to align to - // necessary if table has empty cells - for(k = i; k >= 0 && (g = groups[k]) == null; k -= back); - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - // update current edge of layout bounds - edge = agg(edge, b[bf]); - } - return edge; -} -function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - // compute title coordinates - var x = offset, y = offset; - isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - // queue title for redraw - view.dirty(g); -} -// utility for looking up legend layout configuration -function lookup(config, orient) { - const opt = config[orient] || {}; - return (key, d)=>opt[key] != null ? opt[key] : config[key] != null ? config[key] : d; -} -// if legends specify offset directly, use the maximum specified value -function offsets(legends, value) { - let max = -Infinity; - legends.forEach((item)=>{ - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; -} -function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup(config, orient), offset = offsets(g, _('offset', 0)), anchor = _('anchor', Start), mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - switch(orient){ - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, - column: End, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, - row: End, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case TopLeft: - p.anchor = { - x: offset, - y: offset - }; - break; - case TopRight: - p.anchor = { - x: w - offset, - y: offset, - column: End - }; - break; - case BottomLeft: - p.anchor = { - x: offset, - y: h - offset, - row: End - }; - break; - case BottomRight: - p.anchor = { - x: w - offset, - y: h - offset, - column: End, - row: End - }; - break; - } - return p; -} -function legendLayout(view, legend) { - var item = legend.items[0], datum = item.datum, orient = item.orient, bounds = item.bounds, x = item.x, y = item.y, w, h; - // cache current bounds for later comparison - item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); - bounds.clear(); - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - if (datum.type === Symbols) legendEntryLayout(item.items[0].items[0].items[0].items); - if (orient !== None) { - item.x = x = 0; - item.y = y = 0; - } - item.width = w; - item.height = h; - (0, _vegaScenegraph.boundStroke)(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - return item; -} -function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach((_)=>b.union(_.bounds)); - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - return b; -} -function legendGroupLayout(view, item, entry) { - var pad = item.padding, ex = pad - entry.x, ey = pad - entry.y; - if (!item.datum.title) { - if (ex || ey) translate(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx = pad - title.x, ty = pad - title.y; - switch(title.orient){ - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate(view, entry, ex, ey); - switch(title.orient){ - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate(view, title, tx, ty); - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate(view, entry, -tx, 0); - translate(view, title, -tx, 0); - } - } -} -function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, s = e.bounds[y ? 'y2' : 'x2'] - item.padding, u = vgrad && lr ? s : 0, v = vgrad && lr ? 0 : s, o = y <= 0 ? 0 : (0, _vegaScenegraph.multiLineOffset)(title); - return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o)); -} -function translate(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); -} -function legendEntryLayout(entries) { - // get max widths for each column - const widths = entries.reduce((w, g)=>{ - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - // set dimensions of legend entry groups - entries.forEach((g)=>{ - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); -} -function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], frame = group.frame, orient = group.orient, anchor = group.anchor, offset = group.offset, padding = group.padding, title = group.items[0].items[0], subtitle = group.items[1] && group.items[1].items[0], end = orient === Left || orient === Right ? height : width, start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - if (frame !== Group) orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2); - else if (orient === Left) start = height, end = 0; - pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2; - if (subtitle && subtitle.text) { - // position subtitle - switch(orient){ - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - tempBounds.clear().union(subtitle.bounds); - tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds); - subtitle.mark.bounds.clear().union(tempBounds); - view.dirty(subtitle); - } - tempBounds.clear().union(subtitle.bounds); - } else tempBounds.clear(); - tempBounds.union(title.bounds); - // position title group - switch(orient){ - case Top: - x = pos; - y = viewBounds.y1 - tempBounds.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - if (set(group, 'x', x) | set(group, 'y', y)) { - tempBounds.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds); - mark.bounds.clear().union(tempBounds); - view.dirty(group); - } - return group.bounds; -} -/** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ function ViewLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(ViewLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - _.mark.items.forEach((group)=>{ - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - } -}); -function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; -} -function layoutGroup(view, group, _) { - var items = group.items, width = Math.max(0, group.width || 0), height = Math.max(0, group.height || 0), viewBounds = new (0, _vegaScenegraph.Bounds)().set(0, 0, width, height), xBounds = viewBounds.clone(), yBounds = viewBounds.clone(), legends = [], title, mark, orient, b, i, n; - // layout axes, gather legends, collect bounds - for(i = 0, n = items.length; i < n; ++i){ - mark = items[i]; - switch(mark.role){ - case AxisRole: - b = isYAxis(mark) ? xBounds : yBounds; - b.union(axisLayout(view, mark, width, height)); - break; - case TitleRole: - title = mark; - break; - case LegendRole: - legends.push(legendLayout(view, mark)); - break; - case FrameRole: - case ScopeRole: - case RowHeader: - case RowFooter: - case RowTitle: - case ColHeader: - case ColFooter: - case ColTitle: - xBounds.union(mark.bounds); - yBounds.union(mark.bounds); - break; - default: - viewBounds.union(mark.bounds); - } - } - // layout legends, adjust viewBounds - if (legends.length) { - // group legends by orient - const l = {}; - legends.forEach((item)=>{ - orient = item.orient || Right; - if (orient !== None) (l[orient] || (l[orient] = [])).push(item); - }); - // perform grid layout for each orient group - for(const orient in l){ - const g = l[orient]; - gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height)); - } - // update view bounds - legends.forEach((item)=>{ - const b = item.bounds; - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient){ - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - else viewBounds.union(b); - }); - } - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - // layout title, adjust bounds - if (title) viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - // override aggregated view bounds if content is clipped - if (group.clip) viewBounds.set(0, 0, group.width || 0, group.height || 0); - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); -} -function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, type = auto.type; - if (view._autosize < 1 || !type) return; - let viewWidth = view._width, viewHeight = view._height, width = Math.max(0, group.width || 0), left = Math.max(0, Math.ceil(-viewBounds.x1)), height = Math.max(0, group.height || 0), top = Math.max(0, Math.ceil(-viewBounds.y1)); - const right = Math.max(0, Math.ceil(viewBounds.x2 - width)), bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - if (type === None) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - view._resizeView(viewWidth, viewHeight, width, height, [ - left, - top - ], auto.resize); -} - -},{"vega-dataflow":"3NitK","vega-scenegraph":"jattk","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jattk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "path", ()=>(0, _d3Path.path)); -parcelHelpers.export(exports, "Bounds", ()=>Bounds); -parcelHelpers.export(exports, "CanvasHandler", ()=>CanvasHandler); -parcelHelpers.export(exports, "CanvasRenderer", ()=>CanvasRenderer); -parcelHelpers.export(exports, "Gradient", ()=>Gradient); -parcelHelpers.export(exports, "GroupItem", ()=>GroupItem); -parcelHelpers.export(exports, "Handler", ()=>Handler); -parcelHelpers.export(exports, "HybridHandler", ()=>HybridHandler); -parcelHelpers.export(exports, "HybridRenderer", ()=>HybridRenderer); -parcelHelpers.export(exports, "Item", ()=>Item); -parcelHelpers.export(exports, "Marks", ()=>Marks); -parcelHelpers.export(exports, "RenderType", ()=>RenderType); -parcelHelpers.export(exports, "Renderer", ()=>Renderer); -parcelHelpers.export(exports, "ResourceLoader", ()=>ResourceLoader); -parcelHelpers.export(exports, "SVGHandler", ()=>SVGHandler); -parcelHelpers.export(exports, "SVGRenderer", ()=>SVGRenderer); -parcelHelpers.export(exports, "SVGStringRenderer", ()=>SVGStringRenderer); -parcelHelpers.export(exports, "Scenegraph", ()=>Scenegraph); -parcelHelpers.export(exports, "boundClip", ()=>boundClip); -parcelHelpers.export(exports, "boundContext", ()=>boundContext); -parcelHelpers.export(exports, "boundItem", ()=>boundItem); -parcelHelpers.export(exports, "boundMark", ()=>boundMark); -parcelHelpers.export(exports, "boundStroke", ()=>boundStroke); -parcelHelpers.export(exports, "domChild", ()=>domChild); -parcelHelpers.export(exports, "domClear", ()=>domClear); -parcelHelpers.export(exports, "domCreate", ()=>domCreate); -parcelHelpers.export(exports, "domFind", ()=>domFind); -parcelHelpers.export(exports, "font", ()=>font); -parcelHelpers.export(exports, "fontFamily", ()=>fontFamily); -parcelHelpers.export(exports, "fontSize", ()=>fontSize); -parcelHelpers.export(exports, "intersect", ()=>intersect); -parcelHelpers.export(exports, "intersectBoxLine", ()=>intersectBoxLine); -parcelHelpers.export(exports, "intersectPath", ()=>intersectPath); -parcelHelpers.export(exports, "intersectPoint", ()=>intersectPoint); -parcelHelpers.export(exports, "intersectRule", ()=>intersectRule); -parcelHelpers.export(exports, "lineHeight", ()=>lineHeight); -parcelHelpers.export(exports, "markup", ()=>markup); -parcelHelpers.export(exports, "multiLineOffset", ()=>multiLineOffset); -parcelHelpers.export(exports, "pathCurves", ()=>curves); -parcelHelpers.export(exports, "pathEqual", ()=>pathEqual); -parcelHelpers.export(exports, "pathParse", ()=>parse); -parcelHelpers.export(exports, "pathRectangle", ()=>vg_rect); -parcelHelpers.export(exports, "pathRender", ()=>pathRender); -parcelHelpers.export(exports, "pathSymbols", ()=>symbols); -parcelHelpers.export(exports, "pathTrail", ()=>vg_trail); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "renderModule", ()=>renderModule); -parcelHelpers.export(exports, "resetSVGClipId", ()=>resetSVGClipId); -parcelHelpers.export(exports, "resetSVGDefIds", ()=>resetSVGDefIds); -parcelHelpers.export(exports, "sceneEqual", ()=>sceneEqual); -parcelHelpers.export(exports, "sceneFromJSON", ()=>sceneFromJSON); -parcelHelpers.export(exports, "scenePickVisit", ()=>pickVisit); -parcelHelpers.export(exports, "sceneToJSON", ()=>sceneToJSON); -parcelHelpers.export(exports, "sceneVisit", ()=>visit); -parcelHelpers.export(exports, "sceneZOrder", ()=>zorder); -parcelHelpers.export(exports, "serializeXML", ()=>serializeXML); -parcelHelpers.export(exports, "setHybridRendererOptions", ()=>setHybridRendererOptions); -parcelHelpers.export(exports, "textMetrics", ()=>textMetrics); -var _vegaUtil = require("vega-util"); -var _d3Shape = require("d3-shape"); -var _d3Path = require("d3-path"); -var _vegaCanvas = require("vega-canvas"); -var _vegaLoader = require("vega-loader"); -var _vegaScale = require("vega-scale"); -let gradient_id = 0; -function resetSVGGradientId() { - gradient_id = 0; -} -const patternPrefix = 'p_'; -function isGradient(value) { - return value && value.gradient; -} -function gradientRef(g, defs, base) { - const type = g.gradient; - let id = g.id, prefix = type === 'radial' ? patternPrefix : ''; - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + gradient_id++; - if (type === 'radial') { - g.x1 = get(g.x1, 0.5); - g.y1 = get(g.y1, 0.5); - g.r1 = get(g.r1, 0); - g.x2 = get(g.x2, 0.5); - g.y2 = get(g.y2, 0.5); - g.r2 = get(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get(g.x1, 0); - g.y1 = get(g.y1, 0); - g.x2 = get(g.x2, 1); - g.y2 = get(g.y2, 0); - } - } - // register definition - defs[id] = g; - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; -} -function get(val, def) { - return val != null ? val : def; -} -function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({ - offset: offset, - color: color - }); - return gradient; - } - }; -} -const lookup = { - 'basis': { - curve: (0, _d3Shape.curveBasis) - }, - 'basis-closed': { - curve: (0, _d3Shape.curveBasisClosed) - }, - 'basis-open': { - curve: (0, _d3Shape.curveBasisOpen) - }, - 'bundle': { - curve: (0, _d3Shape.curveBundle), - tension: 'beta', - value: 0.85 + count: { + value: (m2) => m2.cell.num }, - 'cardinal': { - curve: (0, _d3Shape.curveCardinal), - tension: 'tension', - value: 0 + __count__: { + value: (m2) => m2.missing + m2.valid }, - 'cardinal-open': { - curve: (0, _d3Shape.curveCardinalOpen), - tension: 'tension', - value: 0 + missing: { + value: (m2) => m2.missing }, - 'cardinal-closed': { - curve: (0, _d3Shape.curveCardinalClosed), - tension: 'tension', - value: 0 + valid: { + value: (m2) => m2.valid }, - 'catmull-rom': { - curve: (0, _d3Shape.curveCatmullRom), - tension: 'alpha', - value: 0.5 + sum: { + init: (m2) => m2.sum = 0, + value: (m2) => m2.valid ? m2.sum : void 0, + add: (m2, v) => m2.sum += +v, + rem: (m2, v) => m2.sum -= v }, - 'catmull-rom-closed': { - curve: (0, _d3Shape.curveCatmullRomClosed), - tension: 'alpha', - value: 0.5 + product: { + init: (m2) => m2.product = 1, + value: (m2) => m2.valid ? m2.product : void 0, + add: (m2, v) => m2.product *= v, + rem: (m2, v) => m2.product /= v }, - 'catmull-rom-open': { - curve: (0, _d3Shape.curveCatmullRomOpen), - tension: 'alpha', - value: 0.5 + mean: { + init: (m2) => m2.mean = 0, + value: (m2) => m2.valid ? m2.mean : void 0, + add: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean += m2.mean_d / m2.valid), + rem: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean -= m2.valid ? m2.mean_d / m2.valid : m2.mean) }, - 'linear': { - curve: (0, _d3Shape.curveLinear) + average: { + value: (m2) => m2.valid ? m2.mean : void 0, + req: ["mean"], + idx: 1 }, - 'linear-closed': { - curve: (0, _d3Shape.curveLinearClosed) + variance: { + init: (m2) => m2.dev = 0, + value: (m2) => m2.valid > 1 ? m2.dev / (m2.valid - 1) : void 0, + add: (m2, v) => m2.dev += m2.mean_d * (v - m2.mean), + rem: (m2, v) => m2.dev -= m2.mean_d * (v - m2.mean), + req: ["mean"], + idx: 1 }, - 'monotone': { - horizontal: (0, _d3Shape.curveMonotoneY), - vertical: (0, _d3Shape.curveMonotoneX) + variancep: { + value: (m2) => m2.valid > 1 ? m2.dev / m2.valid : void 0, + req: ["variance"], + idx: 2 }, - 'natural': { - curve: (0, _d3Shape.curveNatural) + stdev: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid - 1)) : void 0, + req: ["variance"], + idx: 2 }, - 'step': { - curve: (0, _d3Shape.curveStep) + stdevp: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / m2.valid) : void 0, + req: ["variance"], + idx: 2 }, - 'step-after': { - curve: (0, _d3Shape.curveStepAfter) + stderr: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid * (m2.valid - 1))) : void 0, + req: ["variance"], + idx: 2 }, - 'step-before': { - curve: (0, _d3Shape.curveStepBefore) - } -}; -function curves(type, orientation, tension) { - var entry = (0, _vegaUtil.hasOwnProperty)(lookup, type) && lookup[type], curve = null; - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) curve = curve[entry.tension](tension); - } - return curve; -} -const paramCounts = { - m: 2, - l: 2, - h: 1, - v: 1, - z: 0, - c: 6, - s: 4, - q: 4, - t: 2, - a: 7 -}; -const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; -const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; -const spacePattern = /^((\s+,?\s*)|(,\s*))/; -const flagPattern = /^[01]/; -function parse(path) { - const commands = []; - const matches = path.match(commandPattern) || []; - matches.forEach((str)=>{ - let cmd = str[0]; - const type = cmd.toLowerCase(); - // parse parameters - const paramCount = paramCounts[type]; - const params = parseParams(type, paramCount, str.slice(1).trim()); - const count = params.length; - // error checking based on parameter count - if (count < paramCount || count && count % paramCount !== 0) throw Error('Invalid SVG path, incorrect parameter count'); - // register the command - commands.push([ - cmd, - ...params.slice(0, paramCount) - ]); - // exit now if we're done, also handles zero-param 'z' - if (count === paramCount) return; - // handle implicit line-to - if (type === 'm') cmd = cmd === 'M' ? 'L' : 'l'; - // repeat command when given extended param list - for(let i = paramCount; i < count; i += paramCount)commands.push([ - cmd, - ...params.slice(i, i + paramCount) - ]); - }); - return commands; -} -function parseParams(type, paramCount, segment) { - const params = []; - for(let index = 0; paramCount && index < segment.length;)for(let i = 0; i < paramCount; ++i){ - const pattern = type === 'a' && (i === 3 || i === 4) ? flagPattern : numberPattern; - const match = segment.slice(index).match(pattern); - if (match === null) throw Error('Invalid SVG path, incorrect parameter type'); - index += match[0].length; - params.push(+match[0]); - const ws = segment.slice(index).match(spacePattern); - if (ws !== null) index += ws[0].length; - } - return params; -} -const DegToRad = Math.PI / 180; -const Epsilon = 1e-14; -const HalfPi = Math.PI / 2; -const Tau = Math.PI * 2; -const HalfSqrt3 = Math.sqrt(3) / 2; -var segmentCache = {}; -var bezierCache = {}; -var join = [].join; -// Copied from Inkscape svgtopdf, thanks! -function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - const key = join.call(arguments); - if (segmentCache[key]) return segmentCache[key]; - const th = rotateX * DegToRad; - const sin_th = Math.sin(th); - const cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - let pl = px * px / (rx * rx) + py * py / (ry * ry); - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; - } - const a00 = cos_th / rx; - const a01 = sin_th / rx; - const a10 = -sin_th / ry; - const a11 = cos_th / ry; - const x0 = a00 * ox + a01 * oy; - const y0 = a10 * ox + a11 * oy; - const x1 = a00 * x + a01 * y; - const y1 = a10 * x + a11 * y; - const d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - let sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - let sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - const xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - const yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - const th0 = Math.atan2(y0 - yc, x0 - xc); - const th1 = Math.atan2(y1 - yc, x1 - xc); - let th_arc = th1 - th0; - if (th_arc < 0 && sweep === 1) th_arc += Tau; - else if (th_arc > 0 && sweep === 0) th_arc -= Tau; - const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - const result = []; - for(let i = 0; i < segs; ++i){ - const th2 = th0 + i * th_arc / segs; - const th3 = th0 + (i + 1) * th_arc / segs; - result[i] = [ - xc, - yc, - th2, - th3, - rx, - ry, - sin_th, - cos_th - ]; - } - return segmentCache[key] = result; -} -function bezier(params) { - const key = join.call(params); - if (bezierCache[key]) return bezierCache[key]; - var cx = params[0], cy = params[1], th0 = params[2], th1 = params[3], rx = params[4], ry = params[5], sin_th = params[6], cos_th = params[7]; - const a00 = cos_th * rx; - const a01 = -sin_th * ry; - const a10 = sin_th * rx; - const a11 = cos_th * ry; - const cos_th0 = Math.cos(th0); - const sin_th0 = Math.sin(th0); - const cos_th1 = Math.cos(th1); - const sin_th1 = Math.sin(th1); - const th_half = 0.5 * (th1 - th0); - const sin_th_h2 = Math.sin(th_half * 0.5); - const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); - const x1 = cx + cos_th0 - t * sin_th0; - const y1 = cy + sin_th0 + t * cos_th0; - const x3 = cx + cos_th1; - const y3 = cy + sin_th1; - const x2 = x3 + t * sin_th1; - const y2 = y3 - t * cos_th1; - return bezierCache[key] = [ - a00 * x1 + a01 * y1, - a10 * x1 + a11 * y1, - a00 * x2 + a01 * y2, - a10 * x2 + a11 * y2, - a00 * x3 + a01 * y3, - a10 * x3 + a11 * y3 - ]; -} -const temp = [ - 'l', - 0, - 0, - 0, - 0, - 0, - 0, - 0 -]; -function scale$1(current, sX, sY) { - const c = temp[0] = current[0]; - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') temp[1] = sX * current[1]; - else if (c === 'v' || c === 'V') temp[1] = sY * current[1]; - else for(var i = 1, n = current.length; i < n; ++i)temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; - return temp; -} -function pathRender(context, path, l, t, sX, sY) { - var current, // current instruction - previous = null, x = 0, // current x - y = 0, // current y - controlX = 0, // current control point x - controlY = 0, // current control point y - tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; - if (l == null) l = 0; - if (t == null) t = 0; - if (sX == null) sX = 1; - if (sY == null) sY = sX; - if (context.beginPath) context.beginPath(); - for(var i = 0, len = path.length; i < len; ++i){ - current = path[i]; - if (sX !== 1 || sY !== 1) current = scale$1(current, sX, sY); - switch(current[0]){ - // first letter - case 'l': - // lineto, relative - x += current[1]; - y += current[2]; - context.lineTo(x + l, y + t); - break; - case 'L': - // lineto, absolute - x = current[1]; - y = current[2]; - context.lineTo(x + l, y + t); - break; - case 'h': - // horizontal lineto, relative - x += current[1]; - context.lineTo(x + l, y + t); - break; - case 'H': - // horizontal lineto, absolute - x = current[1]; - context.lineTo(x + l, y + t); - break; - case 'v': - // vertical lineto, relative - y += current[1]; - context.lineTo(x + l, y + t); - break; - case 'V': - // verical lineto, absolute - y = current[1]; - context.lineTo(x + l, y + t); - break; - case 'm': - // moveTo, relative - x += current[1]; - y += current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'M': - // moveTo, absolute - x = current[1]; - y = current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'c': - // bezierCurveTo, relative - tempX = x + current[5]; - tempY = y + current[6]; - controlX = x + current[3]; - controlY = y + current[4]; - context.bezierCurveTo(x + current[1] + l, // x1 - y + current[2] + t, // y1 - controlX + l, // x2 - controlY + t, // y2 - tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'C': - // bezierCurveTo, absolute - x = current[5]; - y = current[6]; - controlX = current[3]; - controlY = current[4]; - context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t); - break; - case 's': - // shorthand cubic bezierCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = x + current[1]; - controlY = y + current[2]; - x = tempX; - y = tempY; - break; - case 'S': - // shorthand cubic bezierCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = current[1]; - controlY = current[2]; - break; - case 'q': - // quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - controlX = x + current[1]; - controlY = y + current[2]; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'Q': - // quadraticCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = current[1]; - controlY = current[2]; - break; - case 't': - // shorthand quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[1]; - tempY = y + current[2]; - if (previous[0].match(/[QqTt]/) === null) { - // If there is no previous command or if the previous command was not a Q, q, T or t, - // assume the control point is coincident with the current point - controlX = x; - controlY = y; - } else if (previous[0] === 't') { - // calculate reflection of previous control points for t - controlX = 2 * x - tempControlX; - controlY = 2 * y - tempControlY; - } else if (previous[0] === 'q') { - // calculate reflection of previous control points for q - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - } - tempControlX = controlX; - tempControlY = controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = x + current[1]; - controlY = y + current[2]; - break; - case 'T': - tempX = current[1]; - tempY = current[2]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'a': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + x + l, - current[7] + y + t - ]); - x += current[6]; - y += current[7]; - break; - case 'A': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + l, - current[7] + t - ]); - x = current[6]; - y = current[7]; - break; - case 'z': - case 'Z': - x = anchorX; - y = anchorY; - context.closePath(); - break; - } - previous = current; - } -} -function drawArc(context, x, y, coords) { - const seg = segments(coords[5], // end x - coords[6], // end y - coords[0], // radius x - coords[1], // radius y - coords[3], // large flag - coords[4], // sweep flag - coords[2], // rotation - x, y); - for(let i = 0; i < seg.length; ++i){ - const bez = bezier(seg[i]); - context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); - } -} -const Tan30 = 0.5773502691896257; -const builtins = { - 'circle': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } + distinct: { + value: (m2) => m2.cell.data.distinct(m2.get), + req: ["values"], + idx: 3 }, - 'cross': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); - } + ci0: { + value: (m2) => m2.cell.data.ci0(m2.get), + req: ["values"], + idx: 3 }, - 'diamond': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); - } + ci1: { + value: (m2) => m2.cell.data.ci1(m2.get), + req: ["values"], + idx: 3 }, - 'square': { - draw: function(context, size) { - var w = Math.sqrt(size), x = -w / 2; - context.rect(x, x, w, w); - } + median: { + value: (m2) => m2.cell.data.q2(m2.get), + req: ["values"], + idx: 3 }, - 'arrow': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 7, t = r / 2.5, v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } + q1: { + value: (m2) => m2.cell.data.q1(m2.get), + req: ["values"], + idx: 3 }, - 'wedge': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30, b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); - } + q3: { + value: (m2) => m2.cell.data.q3(m2.get), + req: ["values"], + idx: 3 }, - 'triangle': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30; - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } + min: { + init: (m2) => m2.min = void 0, + value: (m2) => m2.min = Number.isNaN(m2.min) ? m2.cell.data.min(m2.get) : m2.min, + add: (m2, v) => { + if (v < m2.min || m2.min === void 0) m2.min = v; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.min = NaN; + }, + req: ["values"], + idx: 4 }, - 'triangle-up': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); - } + max: { + init: (m2) => m2.max = void 0, + value: (m2) => m2.max = Number.isNaN(m2.max) ? m2.cell.data.max(m2.get) : m2.max, + add: (m2, v) => { + if (v > m2.max || m2.max === void 0) m2.max = v; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.max = NaN; + }, + req: ["values"], + idx: 4 }, - 'triangle-down': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); - } + argmin: { + init: (m2) => m2.argmin = void 0, + value: (m2) => m2.argmin || m2.cell.data.argmin(m2.get), + add: (m2, v, t) => { + if (v < m2.min) m2.argmin = t; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.argmin = void 0; + }, + req: ["min", "values"], + idx: 3 }, - 'triangle-right': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } + argmax: { + init: (m2) => m2.argmax = void 0, + value: (m2) => m2.argmax || m2.cell.data.argmax(m2.get), + add: (m2, v, t) => { + if (v > m2.max) m2.argmax = t; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.argmax = void 0; + }, + req: ["max", "values"], + idx: 3 }, - 'triangle-left': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); - } + exponential: { + init: (m2, r) => { + m2.exp = 0; + m2.exp_r = r; + }, + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) / (1 - m2.exp_r ** m2.valid) : void 0, + add: (m2, v) => m2.exp = m2.exp_r * m2.exp + v, + rem: (m2, v) => m2.exp = (m2.exp - v / m2.exp_r ** (m2.valid - 1)) / m2.exp_r }, - 'stroke': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } -}; -function symbols(_) { - return (0, _vegaUtil.hasOwnProperty)(builtins, _) ? builtins[_] : customSymbol(_); -} -var custom = {}; -function customSymbol(path) { - if (!(0, _vegaUtil.hasOwnProperty)(custom, path)) { - const parsed = parse(path); - custom[path] = { - draw: function(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; + exponentialb: { + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) : void 0, + req: ["exponential"], + idx: 1 } - return custom[path]; -} -// See http://spencermortensen.com/articles/bezier-circle/ -const C = 0.448084975506; // C = 1 - c -function rectangleX(d) { - return d.x; -} -function rectangleY(d) { - return d.y; -} -function rectangleWidth(d) { - return d.width; -} -function rectangleHeight(d) { - return d.height; -} -function number(_) { - return typeof _ === 'function' ? _ : ()=>+_; -} -function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); -} -function vg_rect() { - var x = rectangleX, y = rectangleY, width = rectangleWidth, height = rectangleHeight, crTL = number(0), crTR = crTL, crBL = crTL, crBR = crTL, context = null; - function rectangle(_, x0, y0) { - var buffer, x1 = x0 != null ? x0 : +x.call(this, _), y1 = y0 != null ? y0 : +y.call(this, _), w = +width.call(this, _), h = +height.call(this, _), s = Math.min(w, h) / 2, tl = clamp(+crTL.call(this, _), 0, s), tr = clamp(+crTR.call(this, _), 0, s), bl = clamp(+crBL.call(this, _), 0, s), br = clamp(+crBR.call(this, _), 0, s); - if (!context) context = buffer = (0, _d3Path.path)(); - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) context.rect(x1, y1, w, h); - else { - var x2 = x1 + w, y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - if (buffer) { - context = null; - return buffer + '' || null; - } - } - rectangle.x = function(_) { - if (arguments.length) { - x = number(_); - return rectangle; - } else return x; - }; - rectangle.y = function(_) { - if (arguments.length) { - y = number(_); - return rectangle; - } else return y; - }; - rectangle.width = function(_) { - if (arguments.length) { - width = number(_); - return rectangle; - } else return width; - }; - rectangle.height = function(_) { - if (arguments.length) { - height = number(_); - return rectangle; - } else return height; + }; + const ValidAggregateOps = Object.keys(AggregateOps).filter((d) => d !== "__count__"); + function measure(key2, value2) { + return (out, aggregate_param) => extend$1({ + name: key2, + aggregate_param, + out: out || key2 + }, base_op, value2); + } + [...ValidAggregateOps, "__count__"].forEach((key2) => { + AggregateOps[key2] = measure(key2, AggregateOps[key2]); + }); + function createMeasure(op, param2, name) { + return AggregateOps[op](name, param2); + } + function compareIndex(a2, b2) { + return a2.idx - b2.idx; + } + function resolve(agg) { + const map2 = {}; + agg.forEach((a2) => map2[a2.name] = a2); + const getreqs = (a2) => { + if (!a2.req) return; + a2.req.forEach((key2) => { + if (!map2[key2]) getreqs(map2[key2] = AggregateOps[key2]()); + }); }; - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number(tl); - crTR = tr != null ? number(tr) : crTL; - crBR = br != null ? number(br) : crTL; - crBL = bl != null ? number(bl) : crTR; - return rectangle; - } else return crTL; - }; - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else return context; - }; - return rectangle; -} -function vg_trail() { - var x, y, size, defined, context = null, ready, x1, y1, r1; - function point(x2, y2, w2) { - const r2 = w2 / 2; - if (ready) { - var ux = y1 - y2, uy = x2 - x1; - if (ux || uy) { - // get normal vector - var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else context.arc(x2, y2, r2, 0, Tau); - context.closePath(); - } else ready = 1; - x1 = x2; - y1 = y2; - r1 = r2; - } - function trail(data) { - var i, n = data.length, d, defined0 = false, buffer; - if (context == null) context = buffer = (0, _d3Path.path)(); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - if (buffer) { - context = null; - return buffer + '' || null; - } + agg.forEach(getreqs); + return Object.values(map2).sort(compareIndex); + } + function init$1() { + this.valid = 0; + this.missing = 0; + this._ops.forEach((op) => op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); + } + function add$3(v, t) { + if (v == null || v === "") { + ++this.missing; + return; } - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else return x; - }; - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else return y; - }; - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else return size; - }; - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else return defined; - }; - trail.context = function(_) { - if (arguments.length) { - if (_ == null) context = null; - else context = _; - return trail; - } else return context; - }; - return trail; -} -function value$1(a, b) { - return a != null ? a : b; -} -const x = (item)=>item.x || 0, y = (item)=>item.y || 0, w = (item)=>item.width || 0, h = (item)=>item.height || 0, xw = (item)=>(item.x || 0) + (item.width || 0), yh = (item)=>(item.y || 0) + (item.height || 0), sa = (item)=>item.startAngle || 0, ea = (item)=>item.endAngle || 0, pa = (item)=>item.padAngle || 0, ir = (item)=>item.innerRadius || 0, or = (item)=>item.outerRadius || 0, cr = (item)=>item.cornerRadius || 0, tl = (item)=>value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item)=>value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item)=>value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item)=>value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item)=>value$1(item.size, 64), ts = (item)=>item.size || 1, def = (item)=>!(item.defined === false), type = (item)=>symbols(item.shape || 'circle'); -const arcShape = (0, _d3Shape.arc)().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = (0, _d3Shape.area)().x(x).y1(y).y0(yh).defined(def), areahShape = (0, _d3Shape.area)().y(y).x1(x).x0(xw).defined(def), lineShape = (0, _d3Shape.line)().x(x).y(y).defined(def), rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = (0, _d3Shape.symbol)().type(type).size(sz), trailShape = vg_trail().x(x).y(y).defined(def).size(ts); -function hasCornerRadius(item) { - return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; -} -function arc$1(context, item) { - return arcShape.context(context)(item); -} -function area$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function line$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); -} -function shape$1(context, item) { - return (item.mark.shape || item.shape).context(context)(item); -} -function symbol$1(context, item) { - return symbolShape.context(context)(item); -} -function trail$1(context, items) { - return trailShape.context(context)(items); -} -var clip_id = 1; -function resetSVGClipId() { - clip_id = 1; -} -function clip$1(renderer, item, size) { - var clip = item.clip, defs = renderer._defs, id = item.clip_id || (item.clip_id = 'clip' + clip_id++), c = defs.clipping[id] || (defs.clipping[id] = { - id: id - }); - if ((0, _vegaUtil.isFunction)(clip)) c.path = clip(null); - else if (hasCornerRadius(size)) c.path = rectangle(null, size, 0, 0); - else { - c.width = size.width || 0; - c.height = size.height || 0; + if (v !== v) return; + ++this.valid; + this._ops.forEach((op) => op.add(this, v, t)); + } + function rem(v, t) { + if (v == null || v === "") { + --this.missing; + return; } - return 'url(#' + id + ')'; -} -function Bounds(b) { - this.clear(); - if (b) this.union(b); -} -Bounds.prototype = { - clone () { - return new Bounds(this); - }, - clear () { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }, - empty () { - return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; - }, - equals (b) { - return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2; - }, - set (x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; + if (v !== v) return; + --this.valid; + this._ops.forEach((op) => op.rem(this, v, t)); + } + function set$7(t) { + this._out.forEach((op) => t[op.out] = op.value(this)); + return t; + } + function compileMeasures(agg, field2) { + const get2 = field2 || identity$7, ops2 = resolve(agg), out = agg.slice().sort(compareIndex); + function ctr(cell2) { + this._ops = ops2; + this._out = out; + this.cell = cell2; + this.init(); + } + ctr.prototype.init = init$1; + ctr.prototype.add = add$3; + ctr.prototype.rem = rem; + ctr.prototype.set = set$7; + ctr.prototype.get = get2; + ctr.fields = agg.map((op) => op.out); + return ctr; + } + function TupleStore(key2) { + this._key = key2 ? field$1(key2) : tupleid; + this.reset(); + } + const prototype$1 = TupleStore.prototype; + prototype$1.reset = function() { + this._add = []; + this._rem = []; + this._ext = null; + this._get = null; + this._q = null; + }; + prototype$1.add = function(v) { + this._add.push(v); + }; + prototype$1.rem = function(v) { + this._rem.push(v); + }; + prototype$1.values = function() { + this._get = null; + if (this._rem.length === 0) return this._add; + const a2 = this._add, r = this._rem, k = this._key, n = a2.length, m2 = r.length, x2 = Array(n - m2), map2 = {}; + let i, j, v; + for (i = 0; i < m2; ++i) { + map2[k(r[i])] = 1; + } + for (i = 0, j = 0; i < n; ++i) { + if (map2[k(v = a2[i])]) { + map2[k(v)] = 0; + } else { + x2[j++] = v; + } + } + this._rem = []; + return this._add = x2; + }; + prototype$1.distinct = function(get2) { + const v = this.values(), map2 = {}; + let n = v.length, count2 = 0, s; + while (--n >= 0) { + s = get2(v[n]) + ""; + if (!has$1(map2, s)) { + map2[s] = 1; + ++count2; + } + } + return count2; + }; + prototype$1.extent = function(get2) { + if (this._get !== get2 || !this._ext) { + const v = this.values(), i = extentIndex(v, get2); + this._ext = [v[i[0]], v[i[1]]]; + this._get = get2; + } + return this._ext; + }; + prototype$1.argmin = function(get2) { + return this.extent(get2)[0] || {}; + }; + prototype$1.argmax = function(get2) { + return this.extent(get2)[1] || {}; + }; + prototype$1.min = function(get2) { + const m2 = this.extent(get2)[0]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.max = function(get2) { + const m2 = this.extent(get2)[1]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.quartile = function(get2) { + if (this._get !== get2 || !this._q) { + this._q = quartiles(this.values(), get2); + this._get = get2; + } + return this._q; + }; + prototype$1.q1 = function(get2) { + return this.quartile(get2)[0]; + }; + prototype$1.q2 = function(get2) { + return this.quartile(get2)[1]; + }; + prototype$1.q3 = function(get2) { + return this.quartile(get2)[2]; + }; + prototype$1.ci = function(get2) { + if (this._get !== get2 || !this._ci) { + this._ci = bootstrapCI(this.values(), 1e3, 0.05, get2); + this._get = get2; + } + return this._ci; + }; + prototype$1.ci0 = function(get2) { + return this.ci(get2)[0]; + }; + prototype$1.ci1 = function(get2) { + return this.ci(get2)[1]; + }; + function Aggregate$1(params2) { + Transform.call(this, null, params2); + this._adds = []; + this._mods = []; + this._alen = 0; + this._mlen = 0; + this._drop = true; + this._cross = false; + this._dims = []; + this._dnames = []; + this._measures = []; + this._countOnly = false; + this._counts = null; + this._prev = null; + this._inputs = null; + this._outputs = null; + } + Aggregate$1.Definition = { + "type": "Aggregate", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "drop", + "type": "boolean", + "default": true + }, { + "name": "cross", + "type": "boolean", + "default": false + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Aggregate$1, Transform, { + transform(_, pulse2) { + const aggr = this, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), mod = _.modified(); + aggr.stamp = out.stamp; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + aggr._prev = aggr.value; + aggr.value = mod ? aggr.init(_) : /* @__PURE__ */ Object.create(null); + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + aggr.value = aggr.value || aggr.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + out.modifies(aggr._outputs); + aggr._drop = _.drop !== false; + if (_.cross && aggr._dims.length > 1) { + aggr._drop = false; + aggr.cross(); + } + if (pulse2.clean() && aggr._drop) { + out.clean(true).runAfter(() => this.clean()); + } + return aggr.changes(out); + }, + cross() { + const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(() => ({})), n = dims.length; + function collect2(cells) { + let key2, i, t, v; + for (key2 in cells) { + t = cells[key2].tuple; + for (i = 0; i < n; ++i) { + vals[i][v = t[dims[i]]] = v; + } } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; + } + collect2(aggr._prev); + collect2(curr); + function generate2(base2, tuple, index2) { + const name = dims[index2], v = vals[index2++]; + for (const k in v) { + const key2 = base2 ? base2 + "|" + k : k; + tuple[name] = v[k]; + if (index2 < n) generate2(key2, tuple, index2); + else if (!curr[key2]) aggr.cell(key2, tuple); } - return this; - }, - add (x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }, - expand (d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }, - round () { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }, - scale (s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }, - translate (dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }, - rotate (angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); - }, - rotatedPoints (angle, x, y) { - var { x1, y1, x2, y2 } = this, cos = Math.cos(angle), sin = Math.sin(angle), cx = x - x * cos + y * sin, cy = y - x * sin - y * cos; - return [ - cos * x1 - sin * y1 + cx, - sin * x1 + cos * y1 + cy, - cos * x1 - sin * y2 + cx, - sin * x1 + cos * y2 + cy, - cos * x2 - sin * y1 + cx, - sin * x2 + cos * y1 + cy, - cos * x2 - sin * y2 + cx, - sin * x2 + cos * y2 + cy - ]; - }, - union (b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; + } + generate2("", {}, 0); + }, + init(_) { + const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; + function inputVisit(get2) { + const fields2 = array$5(accessorFields(get2)), n2 = fields2.length; + let i2 = 0, f; + for (; i2 < n2; ++i2) { + if (!inputMap[f = fields2[i2]]) { + inputMap[f] = 1; + inputs.push(f); + } + } + } + this._dims = array$5(_.groupby); + this._dnames = this._dims.map((d) => { + const dname = accessorName(d); + inputVisit(d); + outputs.push(dname); + return dname; + }); + this.cellkey = _.key ? _.key : groupkey(this._dims); + this._countOnly = true; + this._counts = []; + this._measures = []; + const fields = _.fields || [null], ops2 = _.ops || ["count"], aggregate_params = _.aggregate_params || [null], as = _.as || [], n = fields.length, map2 = {}; + let field2, op, aggregate_param, m2, mname, outname, i; + if (n !== ops2.length) { + error("Unmatched number of fields and aggregate ops."); + } + for (i = 0; i < n; ++i) { + field2 = fields[i]; + op = ops2[i]; + aggregate_param = aggregate_params[i] || null; + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + mname = accessorName(field2); + outname = measureName(op, mname, as[i]); + outputs.push(outname); + if (op === "count") { + this._counts.push(outname); + continue; + } + m2 = map2[mname]; + if (!m2) { + inputVisit(field2); + m2 = map2[mname] = []; + m2.field = field2; + this._measures.push(m2); + } + if (op !== "count") this._countOnly = false; + m2.push(createMeasure(op, aggregate_param, outname)); + } + this._measures = this._measures.map((m3) => compileMeasures(m3, m3.field)); + return /* @__PURE__ */ Object.create(null); }, - intersect (b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; + // -- Cell Management ----- + cellkey: groupkey(), + cell(key2, t) { + let cell2 = this.value[key2]; + if (!cell2) { + cell2 = this.value[key2] = this.newcell(key2, t); + this._adds[this._alen++] = cell2; + } else if (cell2.num === 0 && this._drop && cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._adds[this._alen++] = cell2; + } else if (cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._mods[this._mlen++] = cell2; + } + return cell2; }, - encloses (b) { - return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2; + newcell(key2, t) { + const cell2 = { + key: key2, + num: 0, + agg: null, + tuple: this.newtuple(t, this._prev && this._prev[key2]), + stamp: this.stamp, + store: false + }; + if (!this._countOnly) { + const measures = this._measures, n = measures.length; + cell2.agg = Array(n); + for (let i = 0; i < n; ++i) { + cell2.agg[i] = new measures[i](cell2); + } + } + if (cell2.store) { + cell2.data = new TupleStore(); + } + return cell2; }, - alignsWith (b) { - return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2); + newtuple(t, p) { + const names = this._dnames, dims = this._dims, n = dims.length, x2 = {}; + for (let i = 0; i < n; ++i) { + x2[names[i]] = dims[i](t); + } + return p ? replace$1(p.tuple, x2) : ingest$1(x2); }, - intersects (b) { - return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2); + clean() { + const cells = this.value; + for (const key2 in cells) { + if (cells[key2].num === 0) { + delete cells[key2]; + } + } }, - contains (x, y) { - return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2); + // -- Process Tuples ----- + add(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num += 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.add(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].add(agg[i].get(t), t); + } }, - width () { - return this.x2 - this.x1; + rem(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num -= 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.rem(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].rem(agg[i].get(t), t); + } }, - height () { - return this.y2 - this.y1; - } -}; -function Item(mark) { - this.mark = mark; - this.bounds = this.bounds || new Bounds(); -} -function GroupItem(mark) { - Item.call(this, mark); - this.items = this.items || []; -} -(0, _vegaUtil.inherits)(GroupItem, Item); -class ResourceLoader { - constructor(customLoader){ - this._pending = 0; - this._loader = customLoader || (0, _vegaLoader.loader)(); - } - pending() { - return this._pending; - } - sanitizeURL(uri) { - const loader = this; - increment(loader); - return loader._loader.sanitize(uri, { - context: 'href' - }).then((opt)=>{ - decrement(loader); - return opt; - }).catch(()=>{ - decrement(loader); - return null; - }); + celltuple(cell2) { + const tuple = cell2.tuple, counts = this._counts; + if (cell2.store) { + cell2.data.values(); + } + for (let i = 0, n = counts.length; i < n; ++i) { + tuple[counts[i]] = cell2.num; + } + if (!this._countOnly) { + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].set(tuple); + } + } + return tuple; + }, + changes(out) { + const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add2 = out.add, rem2 = out.rem, mod = out.mod; + let cell2, key2, i, n; + if (prev) for (key2 in prev) { + cell2 = prev[key2]; + if (!drop || cell2.num) rem2.push(cell2.tuple); + } + for (i = 0, n = this._alen; i < n; ++i) { + add2.push(this.celltuple(adds[i])); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + cell2 = mods[i]; + (cell2.num === 0 && drop ? rem2 : mod).push(this.celltuple(cell2)); + mods[i] = null; + } + this._alen = this._mlen = 0; + this._prev = null; + return out; } - loadImage(uri) { - const loader = this, Image = (0, _vegaCanvas.image)(); - increment(loader); - return loader._loader.sanitize(uri, { - context: 'image' - }).then((opt)=>{ - const url = opt.href; - if (!url || !Image) throw { - url: url - }; - const img = new Image(); - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = (0, _vegaUtil.hasOwnProperty)(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - // attempt to load image resource - img.onload = ()=>decrement(loader); - img.onerror = ()=>decrement(loader); - img.src = url; - return img; - }).catch((e)=>{ - decrement(loader); - return { - complete: false, - width: 0, - height: 0, - src: e && e.url || '' - }; - }); + }); + const EPSILON$1$1 = 1e-14; + function Bin(params2) { + Transform.call(this, null, params2); + } + Bin.Definition = { + "type": "Bin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "anchor", + "type": "number" + }, { + "name": "maxbins", + "type": "number", + "default": 20 + }, { + "name": "base", + "type": "number", + "default": 10 + }, { + "name": "divide", + "type": "number", + "array": true, + "default": [5, 2] + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "span", + "type": "number" + }, { + "name": "step", + "type": "number" + }, { + "name": "steps", + "type": "number", + "array": true + }, { + "name": "minstep", + "type": "number", + "default": 0 + }, { + "name": "nice", + "type": "boolean", + "default": true + }, { + "name": "name", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["bin0", "bin1"] + }] + }; + inherits(Bin, Transform, { + transform(_, pulse2) { + const band2 = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || ["bin0", "bin1"], b0 = as[0], b1 = as[1]; + let flag2; + if (_.modified()) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + } else { + flag2 = pulse2.modified(accessorFields(_.field)) ? pulse2.ADD_MOD : pulse2.ADD; + } + pulse2.visit(flag2, band2 ? (t) => { + const v = bins(t); + t[b0] = v; + t[b1] = v == null ? null : start + step * (1 + (v - start) / step); + } : (t) => t[b0] = bins(t)); + return pulse2.modifies(band2 ? as : b0); + }, + _bins(_) { + if (this.value && !_.modified()) { + return this.value; + } + const field2 = _.field, bins = bin(_), step = bins.step; + let start = bins.start, stop2 = start + Math.ceil((bins.stop - start) / step) * step, a2, d; + if ((a2 = _.anchor) != null) { + d = a2 - (start + step * Math.floor((a2 - start) / step)); + start += d; + stop2 += d; + } + const f = function(t) { + let v = toNumber(field2(t)); + return v == null ? null : v < start ? -Infinity : v > stop2 ? Infinity : (v = Math.max(start, Math.min(v, stop2 - step)), start + step * Math.floor(EPSILON$1$1 + (v - start) / step)); + }; + f.start = start; + f.stop = bins.stop; + f.step = step; + return this.value = accessor(f, accessorFields(field2), _.name || "bin_" + accessorName(field2)); } - ready() { - const loader = this; - return new Promise((accept)=>{ - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(()=>{ - poll(true); - }, 10); - } - poll(false); - }); + }); + function SortedList(idFunc, source2, input) { + const $2 = idFunc; + let data2 = source2 || [], add2 = input || [], rem2 = {}, cnt = 0; + return { + add: (t) => add2.push(t), + remove: (t) => rem2[$2(t)] = ++cnt, + size: () => data2.length, + data: (compare2, resort) => { + if (cnt) { + data2 = data2.filter((t) => !rem2[$2(t)]); + rem2 = {}; + cnt = 0; + } + if (resort && compare2) { + data2.sort(compare2); + } + if (add2.length) { + data2 = compare2 ? merge$3(compare2, data2, add2.sort(compare2)) : data2.concat(add2); + add2 = []; + } + return data2; + } + }; + } + function Collect$1(params2) { + Transform.call(this, [], params2); + } + Collect$1.Definition = { + "type": "Collect", + "metadata": { + "source": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }] + }; + inherits(Collect$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), sort2 = _.sort, mod = pulse2.changed() || sort2 && (_.modified("sort") || pulse2.modified(sort2.fields)); + out.visit(out.REM, list.remove); + this.modified(mod); + this.value = out.source = list.data(stableCompare(sort2), mod); + if (pulse2.source && pulse2.source.root) { + this.value.root = pulse2.source.root; + } + return out; } -} -function increment(loader) { - loader._pending += 1; -} -function decrement(loader) { - loader._pending -= 1; -} -function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; -} -function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; -} -const circleThreshold = Tau - 1e-8; -let bounds, lx, ly, rot, ma, mb, mc, md; -const add = (x, y)=>bounds.add(x, y); -const addL = (x, y)=>add(lx = x, ly = y); -const addX = (x)=>add(x, bounds.y1); -const addY = (y)=>add(bounds.x1, y); -const px = (x, y)=>ma * x + mc * y; -const py = (x, y)=>mb * x + md * y; -const addp = (x, y)=>add(px(x, y), py(x, y)); -const addpL = (x, y)=>addL(px(x, y), py(x, y)); -function boundContext(_, deg) { - bounds = _; - if (deg) { - rot = deg * DegToRad; - ma = md = Math.cos(rot); - mb = Math.sin(rot); - mc = -mb; - } else { - ma = md = 1; - rot = mb = mc = 0; + }); + function Compare$1(params2) { + Operator.call(this, null, update$5, params2); + } + inherits(Compare$1, Operator); + function update$5(_) { + return this.value && !_.modified() ? this.value : compare$2(_.fields, _.orders); + } + function CountPattern(params2) { + Transform.call(this, null, params2); + } + CountPattern.Definition = { + "type": "CountPattern", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "case", + "type": "enum", + "values": ["upper", "lower", "mixed"], + "default": "mixed" + }, { + "name": "pattern", + "type": "string", + "default": '[\\w"]+' + }, { + "name": "stopwords", + "type": "string", + "default": "" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["text", "count"] + }] + }; + function tokenize(text2, tcase, match2) { + switch (tcase) { + case "upper": + text2 = text2.toUpperCase(); + break; + case "lower": + text2 = text2.toLowerCase(); + break; } - return context$1; -} -const context$1 = { - beginPath () {}, - closePath () {}, - moveTo: addpL, - lineTo: addpL, - rect (x, y, w, h) { - if (rot) { - addp(x + w, y); - addp(x + w, y + h); - addp(x, y + h); - addpL(x, y); - } else { - add(x + w, y + h); - addL(x, y); - } - }, - quadraticCurveTo (x1, y1, x2, y2) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2); - quadExtrema(lx, px1, px2, addX); - quadExtrema(ly, py1, py2, addY); - addL(px2, py2); - }, - bezierCurveTo (x1, y1, x2, y2, x3, y3) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); - cubicExtrema(lx, px1, px2, px3, addX); - cubicExtrema(ly, py1, py2, py3, addY); - addL(px3, py3); + return text2.match(match2); + } + inherits(CountPattern, Transform, { + transform(_, pulse2) { + const process = (update2) => (tuple) => { + var tokens = tokenize(get2(tuple), _.case, match2) || [], t; + for (var i = 0, n = tokens.length; i < n; ++i) { + if (!stop2.test(t = tokens[i])) update2(t); + } + }; + const init2 = this._parameterCheck(_, pulse2), counts = this._counts, match2 = this._match, stop2 = this._stop, get2 = _.field, as = _.as || ["text", "count"], add2 = process((t) => counts[t] = 1 + (counts[t] || 0)), rem2 = process((t) => counts[t] -= 1); + if (init2) { + pulse2.visit(pulse2.SOURCE, add2); + } else { + pulse2.visit(pulse2.ADD, add2); + pulse2.visit(pulse2.REM, rem2); + } + return this._finish(pulse2, as); }, - arc (cx, cy, r, sa, ea, ccw) { - sa += rot; - ea += rot; - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add(cx - r, cy - r); - add(cx + r, cy + r); - } else { - const update = (a)=>add(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - // sample end points - update(sa); - update(ea); - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; - if (sa < 0) sa += Tau; - ea = ea % Tau; - if (ea < 0) ea += Tau; - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; - sa = ea; - ea = s; // swap end-points - } - if (ccw) { - ea -= Tau; - s = sa - sa % HalfPi; - for(i = 0; i < 4 && s > ea; ++i, s -= HalfPi)update(s); - } else { - s = sa - sa % HalfPi + HalfPi; - for(i = 0; i < 4 && s < ea; ++i, s = s + HalfPi)update(s); - } - } + _parameterCheck(_, pulse2) { + let init2 = false; + if (_.modified("stopwords") || !this._stop) { + this._stop = new RegExp("^" + (_.stopwords || "") + "$", "i"); + init2 = true; + } + if (_.modified("pattern") || !this._match) { + this._match = new RegExp(_.pattern || "[\\w']+", "g"); + init2 = true; + } + if (_.modified("field") || pulse2.modified(_.field.fields)) { + init2 = true; + } + if (init2) this._counts = {}; + return init2; + }, + _finish(pulse2, as) { + const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text2 = as[0], count2 = as[1], out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + let w2, t, c2; + for (w2 in counts) { + t = tuples[w2]; + c2 = counts[w2] || 0; + if (!t && c2) { + tuples[w2] = t = ingest$1({}); + t[text2] = w2; + t[count2] = c2; + out.add.push(t); + } else if (c2 === 0) { + if (t) out.rem.push(t); + counts[w2] = null; + tuples[w2] = null; + } else if (t[count2] !== c2) { + t[count2] = c2; + out.mod.push(t); } + } + return out.modifies(as); } -}; -function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); -} -function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, b = x0 + x2 - 2 * x1, c = x0 - x1; - let t0 = 0, t1 = 0, r; - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else // linear equation - t0 = 0.5 * c / b; - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); -} -function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3; -} -var context = (context = (0, _vegaCanvas.canvas)(1, 1)) ? context.getContext('2d') : null; -const b = new Bounds(); -function intersectPath(draw) { - return function(item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context) return true; - // add path to offscreen graphics context - draw(context, item); - // get bounds intersection region - b.clear().union(item.bounds).intersect(brush).round(); - const { x1, y1, x2, y2 } = b; - // iterate over intersection region - // perform fine grained inclusion test - for(let y = y1; y <= y2; ++y)for(let x = x1; x <= x2; ++x){ - if (context.isPointInPath(x, y)) return true; - } - // false if no hits in intersection region - return false; - }; -} -function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); -} -function intersectRect(item, box) { - const x = item.x || 0, y = item.y || 0, w = item.width || 0, h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); -} -function intersectRule(item, box) { - const x = item.x || 0, y = item.y || 0, x2 = item.x2 != null ? item.x2 : x, y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); -} -function intersectBoxLine(box, x, y, u, v) { - const { x1, y1, x2, y2 } = box, dx = u - x, dy = v - y; - let t0 = 0, t1 = 1, p, q, r, e; - for(e = 0; e < 4; ++e){ - if (e === 0) { - p = -dx; - q = -(x1 - x); - } - if (e === 1) { - p = dx; - q = x2 - x; - } - if (e === 2) { - p = -dy; - q = -(y1 - y); - } - if (e === 3) { - p = dy; - q = y2 - y; - } - if (Math.abs(p) < 1e-10 && q < 0) return false; - r = q / p; - if (p < 0) { - if (r > t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } + }); + function Cross$1(params2) { + Transform.call(this, null, params2); + } + Cross$1.Definition = { + "type": "Cross", + "metadata": { + "generates": true + }, + "params": [{ + "name": "filter", + "type": "expr" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["a", "b"] + }] + }; + inherits(Cross$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), as = _.as || ["a", "b"], a2 = as[0], b2 = as[1], reset2 = !this.value || pulse2.changed(pulse2.ADD_REM) || _.modified("as") || _.modified("filter"); + let data2 = this.value; + if (reset2) { + if (data2) out.rem = data2; + data2 = pulse2.materialize(pulse2.SOURCE).source; + out.add = this.value = cross$1(data2, a2, b2, _.filter || truthy); + } else { + out.mod = data2; + } + out.source = this.value; + return out.modifies(as); } - return true; -} -function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; -} -function value(value, dflt) { - return value == null ? dflt : value; -} -function addStops(gradient, stops) { - const n = stops.length; - for(let i = 0; i < n; ++i)gradient.addColorStop(stops[i].offset, stops[i].color); - return gradient; -} -function gradient(context, spec, bounds) { - const w = bounds.width(), h = bounds.height(); - let gradient; - if (spec.gradient === 'radial') gradient = context.createRadialGradient(bounds.x1 + value(spec.x1, 0.5) * w, bounds.y1 + value(spec.y1, 0.5) * h, Math.max(w, h) * value(spec.r1, 0), bounds.x1 + value(spec.x2, 0.5) * w, bounds.y1 + value(spec.y2, 0.5) * h, Math.max(w, h) * value(spec.r2, 0.5)); - else { - // linear gradient - const x1 = value(spec.x1, 0), y1 = value(spec.y1, 0), x2 = value(spec.x2, 1), y2 = value(spec.y2, 0); - if (x1 === x2 || y1 === y2 || w === h) // axis aligned: use normal gradient - gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h); - else { - // not axis aligned: render gradient into a pattern (#2365) - // this allows us to use normalized bounding box coordinates - const image = (0, _vegaCanvas.canvas)(Math.ceil(w), Math.ceil(h)), ictx = image.getContext('2d'); - ictx.scale(w, h); - ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops); - ictx.fillRect(0, 0, w, h); - return context.createPattern(image, 'no-repeat'); - } - } - return addStops(gradient, spec.stops); -} -function color(context, item, value) { - return isGradient(value) ? gradient(context, value, item.bounds) : value; -} -function fill(context, item, opacity) { - opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else return false; -} -var Empty = []; -function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - if (lw <= 0) return false; - opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty); - context.lineDashOffset = item.strokeDashOffset || 0; + }); + function cross$1(input, a2, b2, filter2) { + var data2 = [], t = {}, n = input.length, i = 0, j, left; + for (; i < n; ++i) { + t[a2] = left = input[i]; + for (j = 0; j < n; ++j) { + t[b2] = input[j]; + if (filter2(t)) { + data2.push(ingest$1(t)); + t = {}; + t[a2] = left; } - return true; - } else return false; -} -function compare(a, b) { - return a.zindex - b.zindex || a.index - b.index; -} -function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - var items = scene.items, output = [], item, i, n; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - item.index = i; - if (item.zindex) output.push(item); + } } - scene.zdirty = false; - return scene.zitems = output.sort(compare); -} -function visit(scene, visitor) { - var items = scene.items, i, n; - if (!items || !items.length) return; - const zitems = zorder(scene); - if (zitems && zitems.length) { - for(i = 0, n = items.length; i < n; ++i)if (!items[i].zindex) visitor(items[i]); - items = zitems; - } - for(i = 0, n = items.length; i < n; ++i)visitor(items[i]); -} -function pickVisit(scene, visitor) { - var items = scene.items, hit, i; - if (!items || !items.length) return null; - const zitems = zorder(scene); - if (zitems && zitems.length) items = zitems; - for(i = items.length; --i >= 0;){ - if (hit = visitor(items[i])) return hit; - } - if (items === zitems) { - for(items = scene.items, i = items.length; --i >= 0;)if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; - } - } - return null; -} -function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, (item)=>{ - if (!bounds || bounds.intersects(item.bounds)) drawPath(path, context, item, item); - }); - }; -} -function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) drawPath(path, context, scene.items[0], scene.items); - }; -} -function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - if (path(context, items)) return; - blend(context, item); - if (item.fill && fill(context, item, opacity)) context.fill(); - if (item.stroke && stroke(context, item, opacity)) context.stroke(); -} -function pick$1(test) { - test = test || (0, _vegaUtil.truthy); - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - return pickVisit(scene, (item)=>{ - const b = item.bounds; - // first hit test against bounding box - if (b && !b.contains(gx, gy) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; - }); - }; -} -function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, fill = filled == null ? item.fill : filled, stroke = item.stroke && context.isPointInStroke, lw, lc; - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y); - }; -} -function pickPath(path) { - return pick$1(hitPath(path)); -} -function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} -function rotate(a) { - return 'rotate(' + a + ')'; -} -function scale(scaleX, scaleY) { - return 'scale(' + scaleX + ',' + scaleY + ')'; -} -function translateItem(item) { - return translate(item.x || 0, item.y || 0); -} -function rotateItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : ''); -} -function transformItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : ''); -} -function markItemPath(type, shape, isect) { - function attr(emit, item) { - emit('transform', rotateItem(item)); - emit('d', shape(null, item)); - } - function bound(bounds, item) { - shape(boundContext(bounds, item.angle), item); - return boundStroke(bounds, item).translate(item.x || 0, item.y || 0); - } - function draw(context, item) { - var x = item.x || 0, y = item.y || 0, a = item.angle || 0; - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); - } - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; -} -var arc = markItemPath('arc', arc$1); -function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], z = a[0].orient === 'horizontal' ? 'y' : 'x', i = a.length, min = Infinity, hit, d; - while(--i >= 0){ - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - return hit; -} -function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - return null; -} -function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx * dx) return a[i]; - } - return null; -} -function markMultiItemPath(type, shape, tip) { - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) return bounds; - else { - shape(boundContext(bounds), items); - return boundStroke(bounds, items[0]); - } - } - function draw(context, items) { - context.beginPath(); - shape(context, items); + return data2; + } + const Distributions = { + kde, + mixture: mixture$1, + normal: gaussian, + lognormal, + uniform + }; + const DISTRIBUTIONS = "distributions", FUNCTION = "function", FIELD = "field"; + function parse$4(def2, data2) { + const func = def2[FUNCTION]; + if (!has$1(Distributions, func)) { + error("Unknown distribution function: " + func); } - const hit = hitPath(draw); - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, b = scene.bounds; - if (!items || !items.length || b && !b.contains(gx, gy)) return null; - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; + const d = Distributions[func](); + for (const name in def2) { + if (name === FIELD) { + d.data((def2.from || data2()).map(def2[name])); + } else if (name === DISTRIBUTIONS) { + d[name](def2[name].map((_) => parse$4(_, data2))); + } else if (typeof d[name] === FUNCTION) { + d[name](def2[name]); + } } - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; -} -var area = markMultiItemPath('area', area$1, pickArea); -function clip(context, scene) { - var clip = scene.clip; - context.save(); - if ((0, _vegaUtil.isFunction)(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else clipGroup(context, scene.group); -} -function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); -} -function offset$1(item) { - const sw = value(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; -} -function attr$5(emit, item) { - emit('transform', translateItem(item)); -} -function emitRectangle(emit, item) { - const off = offset$1(item); - emit('d', rectangle(null, item, off, off)); -} -function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); -} -function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) emitRectangle(emit, item); - else emit('d', ''); -} -function content(emit, item, renderer) { - const url = item.clip ? clip$1(renderer, item, item) : null; - emit('clip-path', url); -} -function bound$5(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for(let j = 0; j < m; ++j)bounds.union(items[j].bounds); - } - if ((group.clip || group.width || group.height) && !group.noBound) bounds.add(0, 0).add(group.width || 0, group.height || 0); - boundStroke(bounds, group); - return bounds.translate(group.x || 0, group.y || 0); -} -function rectanglePath(context, group, x, y) { - const off = offset$1(group); - context.beginPath(); - rectangle(context, group, (x || 0) + off, (y || 0) + off); -} -const hitBackground = hitPath(rectanglePath); -const hitForeground = hitPath(rectanglePath, false); -const hitCorner = hitPath(rectanglePath, true); -function draw$4(context, scene, bounds, markTypes) { - visit(scene, (group)=>{ - const gx = group.x || 0, gy = group.y || 0, fore = group.strokeForeground, opacity = group.opacity == null ? 1 : group.opacity; - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) context.fill(); - if (group.stroke && !fore && stroke(context, group, opacity)) context.stroke(); - } - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - // draw group contents - visit(group, (item)=>{ - if (item.marktype === 'group' || markTypes == null || markTypes.includes(item.marktype)) this.draw(context, item, bounds, markTypes); - }); - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) context.stroke(); - } - }); -} -function pick(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) return null; - const cx = x * context.pixelRatio, cy = y * context.pixelRatio; - return pickVisit(scene, (group)=>{ - let hit, dx, dy; - // first hit test bounding box - const b = group.bounds; - if (b && !b.contains(gx, gy)) return; - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - const dw = dx + (group.width || 0), dh = dy + (group.height || 0), c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitCorner(context, group, cx, cy)) { - context.restore(); - return null; - } - const fore = group.strokeForeground, ix = scene.interactive !== false; - // hit test against group foreground - if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - // hit test against contained marks - hit = pickVisit(group, (mark)=>pickMark(mark, dx, dy) ? this.pick(mark, x, y, dx, dy) : null); - // hit test against group background - if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) hit = group; - // restore state and return - context.restore(); - return hit || null; - }); -} -function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y); -} -var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr$5, - bound: bound$5, - draw: draw$4, - pick: pick, - isect: intersectRect, - content: content, - background: background, - foreground: foreground -}; -var metadata = { - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink', - 'version': '1.1' -}; -function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = { - complete: false, - width: 0, - height: 0 - }; - renderer.loadImage(item.url).then((image)=>{ - item.image = image; - item.image.url = item.url; + return d; + } + function Density(params2) { + Transform.call(this, null, params2); + } + const distributions = [{ + "key": { + "function": "normal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "lognormal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "uniform" + }, + "params": [{ + "name": "min", + "type": "number", + "default": 0 + }, { + "name": "max", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "kde" + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "from", + "type": "data" + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }] + }]; + const mixture = { + "key": { + "function": "mixture" + }, + "params": [{ + "name": "distributions", + "type": "param", + "array": true, + "params": distributions + }, { + "name": "weights", + "type": "number", + "array": true + }] + }; + Density.Definition = { + "type": "Density", + "metadata": { + "generates": true + }, + "params": [{ + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "method", + "type": "string", + "default": "pdf", + "values": ["pdf", "cdf"] + }, { + "name": "distribution", + "type": "param", + "params": distributions.concat(mixture) + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(Density, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const dist2 = parse$4(_.distribution, source$1(pulse2)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + let method2 = _.method || "pdf"; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (!_.extent && !dist2.data) { + error("Missing density extent parameter."); + } + method2 = dist2[method2]; + const as = _.as || ["value", "density"], domain2 = _.extent || extent(dist2.data()), values2 = sampleCurve(method2, domain2, minsteps, maxsteps).map((v) => { + const tuple = {}; + tuple[as[0]] = v[0]; + tuple[as[1]] = v[1]; + return ingest$1(tuple); }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; } - return image; -} -function imageWidth(item, image) { - return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width; -} -function imageHeight(item, image) { - return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height; -} -function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; -} -function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; -} -function attr$4(emit, item, renderer) { - const img = getImage(item, renderer), w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); -} -function bound$4(bounds, item) { - const img = item.image, w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h); - return bounds.set(x, y, x + w, y + h); -} -function draw$3(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - const img = getImage(item, this); - let w = imageWidth(item, img); - let h = imageHeight(item, img); - if (w === 0 || h === 0) return; // early exit - let x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), opacity, ar0, ar1, t; - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); -} -var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick$1(), - isect: (0, _vegaUtil.truthy), - // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset -}; -var line = markMultiItemPath('line', line$1, pickLine); -function attr$3(emit, item) { - var sx = item.scaleX || 1, sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) emit('vector-effect', 'non-scaling-stroke'); - emit('transform', transformItem(item)); - emit('d', item.path); -} -function path$1(context, item) { - var path = item.path; - if (path == null) return true; - var x = item.x || 0, y = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a = (item.angle || 0) * DegToRad, cache = item.pathCache; - if (!cache || cache.path !== path) (item.pathCache = cache = parse(path)).path = path; - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else pathRender(context, cache, x, y, sx, sy); -} -function bound$3(bounds, item) { - return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true); -} -var path$2 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(path$1), - pick: pickPath(path$1), - isect: intersectPath(path$1) -}; -function attr$2(emit, item) { - emit('d', rectangle(null, item)); -} -function bound$2(bounds, item) { - var x, y; - return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item); -} -function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); -} -var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect -}; -function attr$1(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); -} -function bound$1(bounds, item) { - var x1, y1; - return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item); -} -function path(context, item, opacity) { - var x1, y1, x2, y2; - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - return false; -} -function draw$1(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); -} -function hit$1(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path(context, item, 1) && context.isPointInStroke(x, y); -} -var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick$1(hit$1), - isect: intersectRule -}; -var shape = markItemPath('shape', shape$1); -var symbol = markItemPath('symbol', symbol$1, intersectPoint); -// memoize text width measurement -const widthCache = (0, _vegaUtil.lruCache)(); -var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas -}; -useCanvas(true); -function useCanvas(use) { - textMetrics.width = use && context ? measureWidth : estimateWidth; -} -// make simple estimate if no canvas is available -function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); -} -function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); -} -// measure text width if canvas is available -function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item)); -} -function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context.font = currentFont; - width = context.measureText(text).width; - widthCache.set(key, width); - } - return width; -} -function fontSize(item) { - return item.fontSize != null ? +item.fontSize || 0 : 11; -} -function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; -} -function lineArray(_) { - return (0, _vegaUtil.isArray)(_) ? _.length > 1 ? _ : _[0] : _; -} -function textLines(item) { - return lineArray(item.lineBreak && item.text && !(0, _vegaUtil.isArray)(item.text) ? item.text.split(item.lineBreak) : item.text); -} -function multiLineOffset(item) { - const tl = textLines(item); - return ((0, _vegaUtil.isArray)(tl) ? tl.length - 1 : 0) * lineHeight(item); -} -function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate(item, text) : text; -} -function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return (text)=>_measureWidth(text, currentFont); - } else if (textMetrics.width === estimateWidth) { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return (text)=>_estimateWidth(text, currentFontHeight); - } else // User defined textMetrics.width function in use (e.g. vl-convert) - return (text)=>textMetrics.width(item, text); -} -function truncate(item, text) { - var limit = +item.limit, width = widthGetter(item); - if (width(text) < limit) return text; - var ellipsis = item.ellipsis || '\u2026', rtl = item.dir === 'rtl', lo = 0, hi = text.length, mid; - limit -= width(ellipsis); - if (rtl) { - while(lo < hi){ - mid = lo + hi >>> 1; - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; - } - return ellipsis + text.slice(lo); + }); + function source$1(pulse2) { + return () => pulse2.materialize(pulse2.SOURCE).source; + } + function fieldNames(fields, as) { + if (!fields) return null; + return fields.map((f, i) => as[i] || accessorName(f)); + } + function partition$1$1(data2, groupby, field2) { + const groups = [], get2 = (f) => f(t); + let map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2.map(field2)); } else { - while(lo < hi){ - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } -} -function fontFamily(item, quote) { - var font = item.font; - return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif'; -} -function font(item, quote) { - return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote); -} -function offset(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, h = fontSize(item); - return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0); -} -const textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' -}; -const tempBounds = new Bounds(); -function anchorPoint(item) { - var x = item.x || 0, y = item.y || 0, r = item.radius || 0, t; - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; -} -function attr(emit, item) { - var dx = item.dx || 0, dy = (item.dy || 0) + offset(item), p = anchorPoint(item), x = p.x1, y = p.y1, a = item.angle || 0, t; - emit('text-anchor', textAlign[item.align] || 'start'); - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else t = translate(x + dx, y + dy); - emit('transform', t); -} -function bound(bounds, item, mode) { - var h = textMetrics.height(item), a = item.align, p = anchorPoint(item), x = p.x1, y = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset(item) - Math.round(0.8 * h), // use 4/5 offset - tl = textLines(item), w; - // get dimensions - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t)=>Math.max(w, textMetrics.width(item, t)), 0); - } else // single-line text - w = textMetrics.width(item, tl); - // horizontal alignment - if (a === 'center') dx -= w / 2; - else if (a === 'right') dx -= w; - bounds.set(dx += x, dy += y, dx + w, dy + h); - if (item.angle && !mode) bounds.rotate(item.angle * DegToRad, x, y); - else if (mode === 2) return bounds.rotatedPoints(item.angle * DegToRad, x, y); - return bounds; -} -function draw(context, scene, bounds) { - visit(scene, (item)=>{ - var opacity = item.opacity == null ? 1 : item.opacity, p, x, y, i, lh, tl, str; - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; - context.font = font(item); - context.textAlign = item.align || 'left'; - p = anchorPoint(item); - x = p.x1, y = p.y1; - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += item.dx || 0; - y += (item.dy || 0) + offset(item); - tl = textLines(item); - blend(context, item); - if ((0, _vegaUtil.isArray)(tl)) { - lh = lineHeight(item); - for(i = 0; i < tl.length; ++i){ - str = textValue(item, tl[i]); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); - y += lh; - } - } else { - str = textValue(item, tl); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); } - if (item.angle) context.restore(); - }); -} -function hit(context, item, x, y, gx, gy) { - if (item.fontSize <= 0) return false; - if (!item.angle) return true; // bounds sufficient if no rotation - // project point into space of unrotated bounds - var p = anchorPoint(item), ax = p.x1, ay = p.y1, b = bound(tempBounds, item, 1), a = -item.angle * DegToRad, cos = Math.cos(a), sin = Math.sin(a), px = cos * gx - sin * gy + (ax - cos * ax + sin * ay), py = sin * gx + cos * gy + (ay - sin * ax - cos * ay); - return b.contains(px, py); -} -function intersectText(item, box) { - const p = bound(tempBounds, item, 2); - return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]); -} -var text = { - type: 'text', - tag: 'text', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1(hit), - isect: intersectText -}; -var trail = markMultiItemPath('trail', trail$1, pickTrail); -var Marks = { - arc: arc, - area: area, - group: group, - image: image, - line: line, - path: path$2, - rect: rect, - rule: rule, - shape: shape, - symbol: symbol, - text: text, - trail: trail -}; -function boundItem(item, func, opt) { - var type = Marks[item.mark.marktype], bound = func || type.bound; - if (type.nested) item = item.mark; - return bound(item.bounds || (item.bounds = new Bounds()), item, opt); -} -var DUMMY = { - mark: null -}; -function boundMark(mark, bounds, opt) { - var type = Marks[mark.marktype], bound = type.bound, items = mark.items, hasItems = items && items.length, i, n, item, b; - if (type.nested) { - if (hasItems) item = items[0]; - else { - // no items, fake it - DUMMY.mark = mark; - item = DUMMY; - } - b = boundItem(item, bound, opt); - bounds = bounds && bounds.union(b) || b; - return bounds; - } - bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds(); - if (hasItems) for(i = 0, n = items.length; i < n; ++i)bounds.union(boundItem(items[i], bound, opt)); - return mark.bounds = bounds; -} -const keys = [ - 'marktype', - 'name', - 'role', - 'interactive', - 'clip', - 'items', - 'zindex', - 'x', - 'y', - 'width', - 'height', - 'align', - 'baseline', - // layout - 'fill', - 'fillOpacity', - 'opacity', - 'blend', - // fill - 'stroke', - 'strokeOpacity', - 'strokeWidth', - 'strokeCap', - // stroke - 'strokeDash', - 'strokeDashOffset', - // stroke dash - 'strokeForeground', - 'strokeOffset', - // group - 'startAngle', - 'endAngle', - 'innerRadius', - 'outerRadius', - // arc - 'cornerRadius', - 'padAngle', - // arc, rect - 'cornerRadiusTopLeft', - 'cornerRadiusTopRight', - // rect, group - 'cornerRadiusBottomLeft', - 'cornerRadiusBottomRight', - 'interpolate', - 'tension', - 'orient', - 'defined', - // area, line - 'url', - 'aspect', - 'smooth', - // image - 'path', - 'scaleX', - 'scaleY', - // path - 'x2', - 'y2', - // rule - 'size', - 'shape', - // symbol - 'text', - 'angle', - 'theta', - 'radius', - 'dir', - 'dx', - 'dy', - // text - 'ellipsis', - 'limit', - 'lineBreak', - 'lineHeight', - 'font', - 'fontSize', - 'fontWeight', - 'fontStyle', - 'fontVariant', - // font - 'description', - 'aria', - 'ariaRole', - 'ariaRoleDescription' // aria -]; -function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); -} -function sceneFromJSON(json) { - const scene = typeof json === 'string' ? JSON.parse(json) : json; - return initialize(scene); -} -function initialize(scene) { - var type = scene.marktype, items = scene.items, parent, i, n; - if (items) for(i = 0, n = items.length; i < n; ++i){ - parent = type ? 'mark' : 'group'; - items[i][parent] = scene; - if (items[i].zindex) items[i][parent].zdirty = true; - if ('group' === (type || parent)) initialize(items[i]); + g.push(field2(t)); + } } - if (type) boundMark(scene); - return scene; -} -class Scenegraph { - constructor(scene){ - if (arguments.length) this.root = sceneFromJSON(scene); - else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [ - new GroupItem(this.root) - ]; + return groups; + } + const Output$5 = "bin"; + function DotBin(params2) { + Transform.call(this, null, params2); + } + DotBin.Definition = { + "type": "DotBin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "step", + "type": "number" + }, { + "name": "smooth", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": Output$5 + }] + }; + const autostep = (data2, field2) => span(extent(data2, field2)) / 30; + inherits(DotBin, Transform, { + transform(_, pulse2) { + if (this.value && !(_.modified() || pulse2.changed())) { + return pulse2; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(pulse2.source, _.groupby, identity$7), smooth = _.smooth || false, field2 = _.field, step = _.step || autostep(source2, field2), sort2 = stableCompare((a2, b2) => field2(a2) - field2(b2)), as = _.as || Output$5, n = groups.length; + let min2 = Infinity, max2 = -Infinity, i = 0, j; + for (; i < n; ++i) { + const g = groups[i].sort(sort2); + j = -1; + for (const v of dotbin(g, step, smooth, field2)) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + g[++j][as] = v; } + } + this.value = { + start: min2, + stop: max2, + step + }; + return pulse2.reflow(true).modifies(as); } - toJSON(indent) { - return sceneToJSON(this.root, indent || 0); - } - mark(markdef, group, index) { - group = group || this.root.items[0]; - const mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; - } -} -function createMark(def, group) { - const mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; - // add accessibility properties if defined - if (def.aria != null) mark.aria = def.aria; - if (def.description) mark.description = def.description; - return mark; -} -// create a new DOM element -function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) doc = document; - return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; -} -// find first child element with matching tag -function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, i = 0, n = nodes.length; - for(; i < n; ++i)if (nodes[i].tagName.toLowerCase() === tag) return nodes[i]; -} -// retrieve child element at given index -// create & insert if doesn't exist or if tags do not match -function domChild(el, index, tag, ns) { - var a = el.childNodes[index], b; - if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) { - b = a || null; - a = domCreate(el.ownerDocument, tag, ns); - el.insertBefore(a, b); - } - return a; -} -// remove all child elements at or above the given index -function domClear(el, index) { - var nodes = el.childNodes, curr = nodes.length; - while(curr > index)el.removeChild(nodes[--curr]); - return el; -} -// generate css class name for mark -function cssClass(mark) { - return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : ''); -} -function point(event, el) { - const rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; -} -function resolveItem(item, event, el, origin) { - var mark = item && item.mark, mdef, p; - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while(item = item.mark.group){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; + }); + function Expression$1(params2) { + Operator.call(this, null, update$4, params2); + this.modified(true); + } + inherits(Expression$1, Operator); + function update$4(_) { + const expr2 = _.expr; + return this.value && !_.modified("expr") ? this.value : accessor((datum2) => expr2(datum2, _), accessorFields(expr2), accessorName(expr2)); + } + function Extent(params2) { + Transform.call(this, [void 0, void 0], params2); + } + Extent.Definition = { + "type": "Extent", + "metadata": {}, + "params": [{ + "name": "field", + "type": "field", + "required": true + }] + }; + inherits(Extent, Transform, { + transform(_, pulse2) { + const extent2 = this.value, field2 = _.field, mod = pulse2.changed() || pulse2.modified(field2.fields) || _.modified("field"); + let min2 = extent2[0], max2 = extent2[1]; + if (mod || min2 == null) { + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(mod ? pulse2.SOURCE : pulse2.ADD, (t) => { + const v = toNumber(field2(t)); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; } - item = mdef.tip(mark.items, p); + }); + if (!Number.isFinite(min2) || !Number.isFinite(max2)) { + let name = accessorName(field2); + if (name) name = ` for field "${name}"`; + pulse2.dataflow.warn(`Infinite extent${name}: [${min2}, ${max2}]`); + min2 = max2 = void 0; + } + this.value = [min2, max2]; } - return item; -} -class Handler { + }); + function Subflow(pulse2, parent) { + Operator.call(this, pulse2); + this.parent = parent; + this.count = 0; + } + inherits(Subflow, Operator, { /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ constructor(customLoader, customTooltip){ - this._active = null; - this._handlers = {}; - this._loader = customLoader || (0, _vegaLoader.loader)(); - this._tooltip = customTooltip || defaultTooltip; - } + * Routes pulses from this subflow to a target transform. + * @param {Transform} target - A transform that receives the subflow of tuples. + */ + connect(target2) { + this.detachSubflow = target2.detachSubflow; + this.targets().add(target2); + return target2.source = this; + }, /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ initialize(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); - } + * Add an 'add' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being added. + */ + add(t) { + this.count += 1; + this.value.add.push(t); + }, /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; - } + * Add a 'rem' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being removed. + */ + rem(t) { + this.count -= 1; + this.value.rem.push(t); + }, /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; - } + * Add a 'mod' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being modified. + */ + mod(t) { + this.value.mod.push(t); + }, /** - * Get / set the origin coordinates of the visualization. - */ origin(origin) { - if (arguments.length) { - this._origin = origin || [ - 0, - 0 - ]; - return this; - } else return this._origin.slice(); - } + * Re-initialize this operator's pulse value. + * @param {Pulse} pulse - The pulse to copy from. + * @see Pulse.init + */ + init(pulse2) { + this.value.init(pulse2, pulse2.NO_SOURCE); + }, /** - * Get / set the scenegraph root. - */ scene(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; + * Evaluate this operator. This method overrides the + * default behavior to simply return the contained pulse value. + * @return {Pulse} + */ + evaluate() { + return this.value; } - /** - * Add an event handler. Subclasses should override this method. - */ on() {} - /** - * Remove an event handler. Subclasses should override this method. - */ off() {} - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ _handlerIndex(h, type, handler) { - for(let i = h ? h.length : 0; --i >= 0;){ - if (h[i].type === type && (!handler || h[i].handler === handler)) return i; + }); + function Facet$1(params2) { + Transform.call(this, {}, params2); + this._keys = fastmap(); + const a2 = this._targets = []; + a2.active = 0; + a2.forEach = (f) => { + for (let i = 0, n = a2.active; i < n; ++i) { + f(a2[i], i, a2); + } + }; + } + inherits(Facet$1, Transform, { + activate(flow) { + this._targets[this._targets.active++] = flow; + }, + // parent argument provided by PreFacet subclass + subflow(key2, flow, pulse2, parent) { + const flows = this.value; + let sf = has$1(flows, key2) && flows[key2], df, p; + if (!sf) { + p = parent || (p = this._group[key2]) && p.tuple; + df = pulse2.dataflow; + sf = new Subflow(pulse2.fork(pulse2.NO_SOURCE), this); + df.add(sf).connect(flow(df, key2, p)); + flows[key2] = sf; + this.activate(sf); + } else if (sf.value.stamp < pulse2.stamp) { + sf.init(pulse2); + this.activate(sf); + } + return sf; + }, + clean() { + const flows = this.value; + let detached = 0; + for (const key2 in flows) { + if (flows[key2].count === 0) { + const detach = flows[key2].detachSubflow; + if (detach) detach(); + delete flows[key2]; + ++detached; } - return -1; - } - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ handlers(type) { - const h = this._handlers, a = []; - if (type) a.push(...h[this.eventName(type)]); - else for(const k in h)a.push(...h[k]); - return a; - } - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ eventName(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); - } - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ handleHref(event, item, href) { - this._loader.sanitize(href, { - context: 'href' - }).then((opt)=>{ - const e = new MouseEvent(event.type, event), a = domCreate(null, 'a'); - for(const name in opt)a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }).catch(()=>{}); + } + if (detached) { + const active = this._targets.filter((sf) => sf && sf.count > 0); + this.initTargets(active); + } + }, + initTargets(act) { + const a2 = this._targets, n = a2.length, m2 = act ? act.length : 0; + let i = 0; + for (; i < m2; ++i) { + a2[i] = act[i]; + } + for (; i < n && a2[i] != null; ++i) { + a2[i] = null; + } + a2.active = m2; + }, + transform(_, pulse2) { + const df = pulse2.dataflow, key2 = _.key, flow = _.subflow, cache2 = this._keys, rekey = _.modified("key"), subflow = (key3) => this.subflow(key3, flow, pulse2); + this._group = _.group || {}; + this.initTargets(); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t), k = cache2.get(id2); + if (k !== void 0) { + cache2.delete(id2); + subflow(k).rem(t); + } + }); + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + cache2.set(tupleid(t), k); + subflow(k).add(t); + }); + if (rekey || pulse2.modified(key2.fields)) { + pulse2.visit(pulse2.MOD, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 === k1) { + subflow(k1).mod(t); + } else { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } + }); + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => { + subflow(cache2.get(tupleid(t))).mod(t); + }); + } + if (rekey) { + pulse2.visit(pulse2.REFLOW, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 !== k1) { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } + }); + } + if (pulse2.clean()) { + df.runAfter(() => { + this.clean(); + cache2.clean(); + }); + } else if (cache2.empty > df.cleanThreshold) { + df.runAfter(cache2.clean); + } + return pulse2; } - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ handleTooltip(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = show && item && item.tooltip || null; - this._tooltip.call(this._obj, this, event, item, value); + }); + function Field$1(params2) { + Operator.call(this, null, update$3, params2); + } + inherits(Field$1, Operator); + function update$3(_) { + return this.value && !_.modified() ? this.value : isArray(_.name) ? array$5(_.name).map((f) => field$1(f)) : field$1(_.name, _.as); + } + function Filter(params2) { + Transform.call(this, fastmap(), params2); + } + Filter.Definition = { + "type": "Filter", + "metadata": { + "changes": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }] + }; + inherits(Filter, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, cache2 = this.value, output2 = pulse2.fork(), add2 = output2.add, rem2 = output2.rem, mod = output2.mod, test2 = _.expr; + let isMod = true; + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (!cache2.has(id2)) rem2.push(t); + else cache2.delete(id2); + }); + pulse2.visit(pulse2.ADD, (t) => { + if (test2(t, _)) add2.push(t); + else cache2.set(tupleid(t), 1); + }); + function revisit(t) { + const id2 = tupleid(t), b2 = test2(t, _), s = cache2.get(id2); + if (b2 && s) { + cache2.delete(id2); + add2.push(t); + } else if (!b2 && !s) { + cache2.set(id2, 1); + rem2.push(t); + } else if (isMod && b2 && !s) { + mod.push(t); } + } + pulse2.visit(pulse2.MOD, revisit); + if (_.modified()) { + isMod = false; + pulse2.visit(pulse2.REFLOW, revisit); + } + if (cache2.empty > df.cleanThreshold) df.runAfter(cache2.clean); + return output2; } - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ getItemBoundingClientRect(item) { - const el = this.canvas(); - if (!el) return; - const rect = el.getBoundingClientRect(), origin = this._origin, bounds = item.bounds, width = bounds.width(), height = bounds.height(); - let x = bounds.x1 + origin[0] + rect.left, y = bounds.y1 + origin[1] + rect.top; - // translate coordinate for each parent group - while(item.mark && (item = item.mark.group)){ - x += item.x || 0; - y += item.y || 0; - } - // return DOMRect-compatible bounding box - return { - x, - y, - width, - height, - left: x, - top: y, - right: x + width, - bottom: y + height - }; + }); + function Flatten(params2) { + Transform.call(this, [], params2); + } + Flatten.Definition = { + "type": "Flatten", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "index", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Flatten, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index2 = _.index || null, m2 = as.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + const arrays = fields.map((f) => f(t)), maxlen = arrays.reduce((l, a2) => Math.max(l, a2.length), 0); + let i = 0, j, d, v; + for (; i < maxlen; ++i) { + d = derive(t); + for (j = 0; j < m2; ++j) { + d[as[j]] = (v = arrays[j][i]) == null ? null : v; + } + if (index2) { + d[index2] = i; + } + out.add.push(d); + } + }); + this.value = out.source = out.add; + if (index2) out.modifies(index2); + return out.modifies(as); } -} -// The default tooltip display handler. -// Sets the HTML title attribute on the visualization container. -function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); -} -class Renderer { - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ constructor(loader){ - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); + }); + function Fold(params2) { + Transform.call(this, [], params2); + } + Fold.Definition = { + "type": "Fold", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["key", "value"] + }] + }; + inherits(Fold, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, fnames = fields.map(accessorName), as = _.as || ["key", "value"], k = as[0], v = as[1], n = fields.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + for (let i = 0, d; i < n; ++i) { + d = derive(t); + d[k] = fnames[i]; + d[v] = fields[i](t); + out.add.push(d); + } + }); + this.value = out.source = out.add; + return out.modifies(as); } - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); - } - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; - } - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; - } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; - } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [ - 0, - 0 - ]; - this._scale = scaleFactor || 1; - return this; - } - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ dirty() {} - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Renderer} - This renderer instance. - */ render(scene, markTypes) { - const r = this; - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { - r._render(scene, markTypes); - }; - // invoke the renderer - r._call(); - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - return r; + }); + function Formula(params2) { + Transform.call(this, null, params2); + } + Formula.Definition = { + "type": "Formula", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }, { + "name": "as", + "type": "string", + "required": true + }, { + "name": "initonly", + "type": "boolean" + }] + }; + inherits(Formula, Transform, { + transform(_, pulse2) { + const func = _.expr, as = _.as, mod = _.modified(), flag2 = _.initonly ? pulse2.ADD : mod ? pulse2.SOURCE : pulse2.modified(func.fields) || pulse2.modified(as) ? pulse2.ADD_MOD : pulse2.ADD; + if (mod) { + pulse2 = pulse2.materialize().reflow(true); + } + if (!_.initonly) { + pulse2.modifies(as); + } + return pulse2.visit(flag2, (t) => t[as] = func(t, _)); } - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render() { - // subclasses to override + }); + function Generate(params2) { + Transform.call(this, [], params2); + } + inherits(Generate, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), gen = _.generator; + let data2 = this.value, num = _.size - data2.length, add2, rem2, t; + if (num > 0) { + for (add2 = []; --num >= 0; ) { + add2.push(t = ingest$1(gen(_))); + data2.push(t); + } + out.add = out.add.length ? out.materialize(out.ADD).add.concat(add2) : add2; + } else { + rem2 = data2.slice(0, -num); + out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem2) : rem2; + data2 = data2.slice(-num); + } + out.source = this.value = data2; + return out; } - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Promise} - A Promise that resolves when rendering is complete. - */ renderAsync(scene, markTypes) { - const r = this.render(scene, markTypes); - return this._ready ? this._ready.then(()=>r) : Promise.resolve(r); + }); + const Methods$1 = { + value: "value", + median, + mean, + min: min$3, + max: max$3 + }; + const Empty$1 = []; + function Impute(params2) { + Transform.call(this, [], params2); + } + Impute.Definition = { + "type": "Impute", + "metadata": { + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }, { + "name": "keyvals", + "array": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "enum", + "default": "value", + "values": ["value", "mean", "median", "max", "min"] + }, { + "name": "value", + "default": 0 + }] + }; + function getValue(_) { + var m2 = _.method || Methods$1.value, v; + if (Methods$1[m2] == null) { + error("Unrecognized imputation method: " + m2); + } else if (m2 === Methods$1.value) { + v = _.value !== void 0 ? _.value : 0; + return () => v; + } else { + return Methods$1[m2]; } - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ _load(method, uri) { - var r = this, p = r._loader[method](uri); - if (!r._ready) { - // re-render the scene when loading completes - const call = r._call; - r._ready = r._loader.ready().then((redraw)=>{ - if (redraw) call(); - r._ready = null; - }); + } + function getField$1(_) { + const f = _.field; + return (t) => t ? f(t) : NaN; + } + inherits(Impute, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), impute = getValue(_), field2 = getField$1(_), fName = accessorName(_.field), kName = accessorName(_.key), gNames = (_.groupby || []).map(accessorName), groups = partition$4(pulse2.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m2 = groups.domain.length, group2, value2, gVals, kVal, g, i, j, l, n, t; + for (g = 0, l = groups.length; g < l; ++g) { + group2 = groups[g]; + gVals = group2.values; + value2 = NaN; + for (j = 0; j < m2; ++j) { + if (group2[j] != null) continue; + kVal = groups.domain[j]; + t = { + _impute: true + }; + for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i]; + t[kName] = kVal; + t[fName] = Number.isNaN(value2) ? value2 = impute(group2, field2) : value2; + curr.push(ingest$1(t)); } - return p; - } - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ sanitizeURL(uri) { - return this._load('sanitizeURL', uri); - } - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ loadImage(uri) { - return this._load('loadImage', uri); - } -} -const KeyDownEvent = 'keydown'; -const KeyPressEvent = 'keypress'; -const KeyUpEvent = 'keyup'; -const DragEnterEvent = 'dragenter'; -const DragLeaveEvent = 'dragleave'; -const DragOverEvent = 'dragover'; -const PointerDownEvent = 'pointerdown'; -const PointerUpEvent = 'pointerup'; -const PointerMoveEvent = 'pointermove'; -const PointerOutEvent = 'pointerout'; -const PointerOverEvent = 'pointerover'; -const MouseDownEvent = 'mousedown'; -const MouseUpEvent = 'mouseup'; -const MouseMoveEvent = 'mousemove'; -const MouseOutEvent = 'mouseout'; -const MouseOverEvent = 'mouseover'; -const ClickEvent = 'click'; -const DoubleClickEvent = 'dblclick'; -const WheelEvent = 'wheel'; -const MouseWheelEvent = 'mousewheel'; -const TouchStartEvent = 'touchstart'; -const TouchMoveEvent = 'touchmove'; -const TouchEndEvent = 'touchend'; -const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - PointerDownEvent, - PointerUpEvent, - PointerMoveEvent, - PointerOutEvent, - PointerOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent -]; -const TooltipShowEvent = PointerMoveEvent; -const TooltipHideEvent = MouseOutEvent; -const HrefEvent = ClickEvent; -class CanvasHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - // supported events - this.events = Events; - this.pointermove = move([ - PointerMoveEvent, - MouseMoveEvent - ], [ - PointerOverEvent, - MouseOverEvent - ], [ - PointerOutEvent, - MouseOutEvent - ]); - this.dragover = move([ - DragOverEvent - ], [ - DragEnterEvent - ], [ - DragLeaveEvent - ]), this.pointerout = inactive([ - PointerOutEvent, - MouseOutEvent - ]); - this.dragleave = inactive([ - DragLeaveEvent - ]); - } - initialize(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - // add minimal events required for proper state management - [ - ClickEvent, - MouseDownEvent, - PointerDownEvent, - PointerMoveEvent, - PointerOutEvent, - DragLeaveEvent - ].forEach((type)=>eventListenerCheck(this, type)); - return super.initialize(el, origin, obj); - } - // return the backing canvas instance - canvas() { - return this._canvas; - } - // retrieve the current canvas context - context() { - return this._canvas.getContext('2d'); - } - // to keep old versions of firefox happy - DOMMouseScroll(evt) { - this.fire(MouseWheelEvent, evt); - } - pointerdown(evt) { - this._down = this._active; - this.fire(PointerDownEvent, evt); + } + if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); + if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); + this.value = curr; + return out; } - mousedown(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); + }); + function partition$4(data2, groupby, key2, keyvals) { + var get2 = (f) => f(t), groups = [], domain2 = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group2, i, j, k, n, t; + domain2.forEach((k2, i2) => kMap[k2] = i2 + 1); + for (i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = key2(t); + j = kMap[k] || (kMap[k] = domain2.push(k)); + gKey = (gVals = groupby ? groupby.map(get2) : Empty$1) + ""; + if (!(group2 = gMap[gKey])) { + group2 = gMap[gKey] = []; + groups.push(group2); + group2.values = gVals; + } + group2[j - 1] = t; } - click(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; - } + groups.domain = domain2; + return groups; + } + function JoinAggregate(params2) { + Aggregate$1.call(this, params2); + } + JoinAggregate.Definition = { + "type": "JoinAggregate", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "key", + "type": "field" + }] + }; + inherits(JoinAggregate, Aggregate$1, { + transform(_, pulse2) { + const aggr = this, mod = _.modified(); + let cells; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + cells = aggr.value = mod ? aggr.init(_) : {}; + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + cells = aggr.value = aggr.value || this.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + aggr.changes(); + pulse2.visit(pulse2.SOURCE, (t) => { + extend$1(t, cells[aggr.cellkey(t)].tuple); + }); + return pulse2.reflow(mod).modifies(this._outputs); + }, + changes() { + const adds = this._adds, mods = this._mods; + let i, n; + for (i = 0, n = this._alen; i < n; ++i) { + this.celltuple(adds[i]); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + this.celltuple(mods[i]); + mods[i] = null; + } + this._alen = this._mlen = 0; } - touchstart(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - if (this._first) { - this._active = this._touch; - this._first = false; - } - this.fire(TouchStartEvent, evt, true); + }); + function KDE(params2) { + Transform.call(this, null, params2); + } + KDE.Definition = { + "type": "KDE", + "metadata": { + "generates": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "cumulative", + "type": "boolean", + "default": false + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(KDE, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), bandwidth2 = _.bandwidth, method2 = _.cumulative ? "cdf" : "pdf", as = _.as || ["value", "density"], values2 = []; + let domain2 = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (_.resolve === "shared") { + if (!domain2) domain2 = extent(source2, _.field); + minsteps = maxsteps = _.steps || maxsteps; + } + groups.forEach((g) => { + const density2 = kde(g, bandwidth2)[method2], scale2 = _.counts ? g.length : 1, local = domain2 || extent(g); + sampleCurve(density2, local, minsteps, maxsteps).forEach((v) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = v[0]; + t[as[1]] = v[1] * scale2; + values2.push(ingest$1(t)); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; } - touchmove(evt) { - this.fire(TouchMoveEvent, evt, true); + }); + function Key$1(params2) { + Operator.call(this, null, update$2, params2); + } + inherits(Key$1, Operator); + function update$2(_) { + return this.value && !_.modified() ? this.value : key$2(_.fields, _.flat); + } + function Load$1(params2) { + Transform.call(this, [], params2); + this._pending = null; + } + inherits(Load$1, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow; + if (this._pending) { + return output(this, pulse2, this._pending); + } + if (stop(_)) return pulse2.StopPropagation; + if (_.values) { + return output(this, pulse2, df.parse(_.values, _.format)); + } else if (_.async) { + const p = df.request(_.url, _.format).then((res) => { + this._pending = array$5(res.data); + return (df2) => df2.touch(this); + }); + return { + async: p + }; + } else { + return df.request(_.url, _.format).then((res) => output(this, pulse2, array$5(res.data))); + } } - touchend(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; + }); + function stop(_) { + return _.modified("async") && !(_.modified("values") || _.modified("url") || _.modified("format")); + } + function output(op, pulse2, data2) { + data2.forEach(ingest$1); + const out = pulse2.fork(pulse2.NO_FIELDS & pulse2.NO_SOURCE); + out.rem = op.value; + op.value = out.source = out.add = data2; + op._pending = null; + if (out.rem.length) out.clean(true); + return out; + } + function Lookup(params2) { + Transform.call(this, {}, params2); + } + Lookup.Definition = { + "type": "Lookup", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "index", + "type": "index", + "params": [{ + "name": "from", + "type": "data", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }] + }, { + "name": "values", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true + }, { + "name": "default", + "default": null + }] + }; + inherits(Lookup, Transform, { + transform(_, pulse2) { + const keys2 = _.fields, index2 = _.index, values2 = _.values, defaultValue = _.default == null ? null : _.default, reset2 = _.modified(), n = keys2.length; + let flag2 = reset2 ? pulse2.SOURCE : pulse2.ADD, out = pulse2, as = _.as, set2, m2, mods; + if (values2) { + m2 = values2.length; + if (n > 1 && !as) { + error('Multi-field lookup requires explicit "as" parameter.'); + } + if (as && as.length !== n * m2) { + error('The "as" parameter has too few output field names.'); + } + as = as || values2.map(accessorName); + set2 = function(t) { + for (var i = 0, k = 0, j, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + if (v == null) for (j = 0; j < m2; ++j, ++k) t[as[k]] = defaultValue; + else for (j = 0; j < m2; ++j, ++k) t[as[k]] = values2[j](v); + } + }; + } else { + if (!as) { + error("Missing output field names."); + } + set2 = function(t) { + for (var i = 0, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + t[as[i]] = v == null ? defaultValue : v; + } + }; + } + if (reset2) { + out = pulse2.reflow(true); + } else { + mods = keys2.some((k) => pulse2.modified(k.fields)); + flag2 |= mods ? pulse2.MOD : 0; + } + pulse2.visit(flag2, set2); + return out.modifies(as); } - // fire an event - fire(type, evt, touch) { - const a = touch ? this._touch : this._active, h = this._handlers[type]; - // set event type relative to scenegraph items - evt.vegaType = type; - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) this.handleHref(evt, a, a.href); - else if (type === TooltipShowEvent || type === TooltipHideEvent) this.handleTooltip(evt, a, type !== TooltipHideEvent); - // invoke all registered handlers - if (h) for(let i = 0, len = h.length; i < len; ++i)h[i].handler.call(this._obj, evt, a); + }); + function MultiExtent$1(params2) { + Operator.call(this, null, update$1, params2); + } + inherits(MultiExtent$1, Operator); + function update$1(_) { + if (this.value && !_.modified()) { + return this.value; } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - eventListenerCheck(this, type); - (h[name] || (h[name] = [])).push({ - type: type, - handler: handler - }); - } - return this; + const ext = _.extents, n = ext.length; + let min2 = Infinity, max2 = -Infinity, i, e; + for (i = 0; i < n; ++i) { + e = ext[i]; + if (e[0] < min2) min2 = e[0]; + if (e[1] > max2) max2 = e[1]; } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) h.splice(i, 1); - return this; + return [min2, max2]; + } + function MultiValues$1(params2) { + Operator.call(this, null, update, params2); + } + inherits(MultiValues$1, Operator); + function update(_) { + return this.value && !_.modified() ? this.value : _.values.reduce((data2, _2) => data2.concat(_2), []); + } + function Params$2(params2) { + Transform.call(this, null, params2); + } + inherits(Params$2, Transform, { + transform(_, pulse2) { + this.modified(_.modified()); + this.value = _; + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - pickEvent(evt) { - const p = point(evt, this._canvas), o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); + }); + function Pivot(params2) { + Aggregate$1.call(this, params2); + } + Pivot.Definition = { + "type": "Pivot", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "value", + "type": "field", + "required": true + }, { + "name": "op", + "type": "enum", + "values": ValidAggregateOps, + "default": "sum" + }, { + "name": "limit", + "type": "number", + "default": 0 + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Pivot, Aggregate$1, { + _transform: Aggregate$1.prototype.transform, + transform(_, pulse2) { + return this._transform(aggregateParams(_, pulse2), pulse2); } - // find the scenegraph item at the current pointer position - // x, y -- the absolute x, y pointer coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - pick(scene, x, y, gx, gy) { - const g = this.context(), mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - } -} -const eventBundle = (type)=>type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [ - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent - ] : [ - type - ]; -// lazily add listeners to the canvas as needed -function eventListenerCheck(handler, type) { - eventBundle(type).forEach((_)=>addEventListener(handler, _)); -} -function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] ? (evt)=>handler[type](evt) : (evt)=>handler.fire(type, evt)); - } -} -function fireAll(handler, types, event) { - types.forEach((type)=>handler.fire(type, event)); -} -function move(moveEvents, overEvents, outEvents) { - return function(evt) { - const a = this._active, p = this.pickEvent(evt); - if (p === a) // active item and picked item are the same - fireAll(this, moveEvents, evt); // fire move - else { - // active item and picked item are different - if (!a || !a.exit) // fire out for prior active item - // suppress if active item was removed from scene - fireAll(this, outEvents, evt); - this._active = p; // set new active item - fireAll(this, overEvents, evt); // fire over for new active item - fireAll(this, moveEvents, evt); // fire move for new active item - } + }); + function aggregateParams(_, pulse2) { + const key2 = _.field, value2 = _.value, op = (_.op === "count" ? "__count__" : _.op) || "sum", fields = accessorFields(key2).concat(accessorFields(value2)), keys2 = pivotKeys(key2, _.limit || 0, pulse2); + if (pulse2.changed()) _.set("__pivot__", null, null, true); + return { + key: _.key, + groupby: _.groupby, + ops: keys2.map(() => op), + fields: keys2.map((k) => get$4(k, key2, value2, fields)), + as: keys2.map((k) => k + ""), + modified: _.modified.bind(_) }; -} -function inactive(types) { - return function(evt) { - fireAll(this, types, evt); - this._active = null; - }; -} -function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; -} -function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null, context = canvas.getContext('2d'), ratio = inDOM ? devicePixelRatio() : scaleFactor; - canvas.width = width * ratio; - canvas.height = height * ratio; - for(const key in opt)context[key] = opt[key]; - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; + } + function get$4(k, key2, value2, fields) { + return accessor((d) => key2(d) === k ? value2(d) : NaN, fields, k + ""); + } + function pivotKeys(key2, limit, pulse2) { + const map2 = {}, list = []; + pulse2.visit(pulse2.SOURCE, (t) => { + const k = key2(t); + if (!map2[k]) { + map2[k] = 1; + list.push(k); + } + }); + list.sort(ascending$2); + return limit ? list.slice(0, limit) : list; + } + function PreFacet$1(params2) { + Facet$1.call(this, params2); + } + inherits(PreFacet$1, Facet$1, { + transform(_, pulse2) { + const flow = _.subflow, field2 = _.field, subflow = (t) => this.subflow(tupleid(t), flow, pulse2, t); + if (_.modified("field") || field2 && pulse2.modified(accessorFields(field2))) { + error("PreFacet does not support field modification."); + } + this.initTargets(); + if (field2) { + pulse2.visit(pulse2.MOD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.mod(_2)); + }); + pulse2.visit(pulse2.ADD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.add(ingest$1(_2))); + }); + pulse2.visit(pulse2.REM, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.rem(_2)); + }); + } else { + pulse2.visit(pulse2.MOD, (t) => subflow(t).mod(t)); + pulse2.visit(pulse2.ADD, (t) => subflow(t).add(t)); + pulse2.visit(pulse2.REM, (t) => subflow(t).rem(t)); + } + if (pulse2.clean()) { + pulse2.runAfter(() => this.clean()); + } + return pulse2; } - context.pixelRatio = ratio; - context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); - return canvas; -} -class CanvasRenderer extends Renderer { - constructor(loader){ - super(loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - initialize(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - this._canvas = this._options.externalContext ? null : (0, _vegaCanvas.canvas)(1, 1, this._options.type); // instantiate a small canvas - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin, scaleFactor); - } - resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._canvas) // configure canvas size and transform - resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); - else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) (0, _vegaUtil.error)('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - this._redraw = true; - return this; + }); + function Project(params2) { + Transform.call(this, null, params2); + } + Project.Definition = { + "type": "Project", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }] + }; + inherits(Project, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive2 = fields ? (s, t) => project(s, t, fields, as) : rederive; + let lut; + if (this.value) { + lut = this.value; + } else { + pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive2(t, ingest$1({})); + lut[tupleid(t)] = dt; + out.add.push(dt); + }); + pulse2.visit(pulse2.MOD, (t) => { + out.mod.push(derive2(t, lut[tupleid(t)])); + }); + return out; } - canvas() { - return this._canvas; + }); + function project(s, t, fields, as) { + for (let i = 0, n = fields.length; i < n; ++i) { + t[as[i]] = fields[i](s); } - context() { - return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null); + return t; + } + function Proxy$1(params2) { + Transform.call(this, null, params2); + } + inherits(Proxy$1, Transform, { + transform(_, pulse2) { + this.value = _.value; + return _.modified("value") ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; } - dirty(item) { - const b = this._tempb.clear().union(item.bounds); - let g = item.mark.group; - while(g){ - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; + }); + function Quantile$1(params2) { + Transform.call(this, null, params2); + } + Quantile$1.Definition = { + "type": "Quantile", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "probs", + "type": "number", + "array": true + }, { + "name": "step", + "type": "number", + "default": 0.01 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["prob", "value"] + }] + }; + const EPSILON$2 = 1e-14; + inherits(Quantile$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), as = _.as || ["prob", "value"]; + if (this.value && !_.modified() && !pulse2.changed()) { + out.source = this.value; + return out; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), values2 = [], step = _.step || 0.01, p = _.probs || range$3(step / 2, 1 - EPSILON$2, step), n = p.length; + groups.forEach((g) => { + const q = quantiles(g, p); + for (let i = 0; i < n; ++i) { + const t = {}; + for (let i2 = 0; i2 < names.length; ++i2) { + t[names[i2]] = g.dims[i2]; + } + t[as[0]] = p[i]; + t[as[1]] = q[i]; + values2.push(ingest$1(t)); } - this._dirty.union(b); - } - _render(scene, markTypes) { - const g = this.context(), o = this._origin, w = this._width, h = this._height, db = this._dirty, vb = viewBounds(o, w, h); - // setup - g.save(); - const b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); - this.clear(-o[0], -o[1], w, h); - // render - this.draw(g, scene, b, markTypes); - // takedown - g.restore(); - db.clear(); - return this; + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + return out; } - draw(ctx, scene, bounds, markTypes) { - if (scene.marktype !== 'group' && markTypes != null && !markTypes.includes(scene.marktype)) return; - const mark = Marks[scene.marktype]; - if (scene.clip) clip(ctx, scene); - mark.draw.call(this, ctx, scene, bounds, markTypes); - if (scene.clip) ctx.restore(); - } - clear(x, y, w, h) { - const opt = this._options, g = this.context(); - if (opt.type !== 'pdf' && !opt.externalContext) // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - } -} -const viewBounds = (origin, width, height)=>new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]); -function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - return b; -} -class SVGHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item)=>{ - if (item && item.href) h.handleHref(evt, item, item.href); + }); + function Relay$1(params2) { + Transform.call(this, null, params2); + } + inherits(Relay$1, Transform, { + transform(_, pulse2) { + let out, lut; + if (this.value) { + lut = this.value; + } else { + out = pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + if (_.derive) { + out = pulse2.fork(pulse2.NO_SOURCE); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive(t); + lut[tupleid(t)] = dt; + out.add.push(dt); }); - h._tooltipHandler = listener(h, (evt, item)=>{ - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); + pulse2.visit(pulse2.MOD, (t) => { + const dt = lut[tupleid(t)]; + for (const k in t) { + dt[k] = t[k]; + out.modifies(k); + } + out.mod.push(dt); }); + } + return out; } - initialize(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); + }); + function Sample(params2) { + Transform.call(this, [], params2); + this.count = 0; + } + Sample.Definition = { + "type": "Sample", + "metadata": {}, + "params": [{ + "name": "size", + "type": "number", + "default": 1e3 + }] + }; + inherits(Sample, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), mod = _.modified("size"), num = _.size, map2 = this.value.reduce((m2, t) => (m2[tupleid(t)] = 1, m2), {}); + let res = this.value, cnt = this.count, cap = 0; + function update2(t) { + let p, idx; + if (res.length < num) { + res.push(t); + } else { + idx = ~~((cnt + 1) * random()); + if (idx < res.length && idx >= cap) { + p = res[idx]; + if (map2[tupleid(p)]) out.rem.push(p); + res[idx] = t; + } + } + ++cnt; + } + if (pulse2.rem.length) { + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (map2[id2]) { + map2[id2] = -1; + out.rem.push(t); + } + --cnt; + }); + res = res.filter((t) => map2[tupleid(t)] !== -1); + } + if ((pulse2.rem.length || mod) && res.length < num && pulse2.source) { + cap = cnt = res.length; + pulse2.visit(pulse2.SOURCE, (t) => { + if (!map2[tupleid(t)]) update2(t); + }); + cap = -1; + } + if (mod && res.length > num) { + const n = res.length - num; + for (let i = 0; i < n; ++i) { + map2[tupleid(res[i])] = -1; + out.rem.push(res[i]); } - return super.initialize(el, origin, obj); - } - canvas() { - return this._svg; + res = res.slice(n); + } + if (pulse2.mod.length) { + pulse2.visit(pulse2.MOD, (t) => { + if (map2[tupleid(t)]) out.mod.push(t); + }); + } + if (pulse2.add.length) { + pulse2.visit(pulse2.ADD, update2); + } + if (pulse2.add.length || cap < 0) { + out.add = res.filter((t) => !map2[tupleid(t)]); + } + this.count = cnt; + this.value = out.source = res; + return out; } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - (h[name] || (h[name] = [])).push(x); - if (this._svg) this._svg.addEventListener(name, x.listener); - } - return this; + }); + function Sequence(params2) { + Transform.call(this, null, params2); + } + Sequence.Definition = { + "type": "Sequence", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "start", + "type": "number", + "required": true + }, { + "name": "stop", + "type": "number", + "required": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "as", + "type": "string", + "default": "data" + }] + }; + inherits(Sequence, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) return; + const out = pulse2.materialize().fork(pulse2.MOD), as = _.as || "data"; + out.rem = this.value ? pulse2.rem.concat(this.value) : pulse2.rem; + this.value = range$3(_.start, _.stop, _.step || 1).map((v) => { + const t = {}; + t[as] = v; + return ingest$1(t); + }); + out.add = pulse2.add.concat(this.value); + return out; } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) { - if (this._svg) this._svg.removeEventListener(name, h[i].listener); - h.splice(i, 1); - } - return this; + }); + function Sieve$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Sieve$1, Transform, { + transform(_, pulse2) { + this.value = pulse2.source; + return pulse2.changed() ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; } -} -// wrap an event listener for the SVG DOM -const listener = (context, handler)=>(evt)=>{ - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; -const ARIA_HIDDEN = 'aria-hidden'; -const ARIA_LABEL = 'aria-label'; -const ARIA_ROLE = 'role'; -const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; -const GRAPHICS_OBJECT = 'graphics-object'; -const GRAPHICS_SYMBOL = 'graphics-symbol'; -const bundle = (role, roledesc, label)=>({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined - }); -// these roles are covered by related roles -// we can ignore them, no need to generate attributes -const AriaIgnore = (0, _vegaUtil.toSet)([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' -]); -// aria attribute generators for guide roles -const AriaGuides = { - 'axis': { - desc: 'axis', - caption: axisCaption - }, - 'legend': { - desc: 'legend', - caption: legendCaption - }, - 'title-text': { - desc: 'title', - caption: (item)=>`Title text '${titleCaption(item)}'` - }, - 'title-subtitle': { - desc: 'subtitle', - caption: (item)=>`Subtitle text '${titleCaption(item)}'` - } -}; -// aria properties generated for mark item encoding channels -const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL -}; -function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - if (hide || item.description == null) for(const prop in AriaEncode)emit(AriaEncode[prop], undefined); - else { - const type = item.mark.marktype; - emit(ARIA_LABEL, item.description); - emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); - emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`); - } -} -function ariaMarkAttributes(mark) { - return mark.aria === false ? { - [ARIA_HIDDEN]: true - } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); -} -function ariaMark(mark) { - const type = mark.marktype; - const recurse = type === 'group' || type === 'text' || mark.items.some((_)=>_.description != null && _.aria !== false); - return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description); -} -function ariaGuide(mark, opt) { - try { - const item = mark.items[0], caption = opt.caption || (()=>''); - return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); - } catch (err) { - return null; - } -} -function titleCaption(item) { - return (0, _vegaUtil.array)(item.text).join(' '); -} -function axisCaption(item) { - const datum = item.datum, orient = item.orient, title = datum.title ? extractTitle(item) : null, ctx = item.context, scale = ctx.scales[datum.scale].value, locale = ctx.dataflow.locale(), type = scale.type, xy = orient === 'left' || orient === 'right' ? 'Y' : 'X'; - return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${(0, _vegaScale.isDiscrete)(type) ? 'discrete' : type} scale` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function legendCaption(item) { - const datum = item.datum, title = datum.title ? extractTitle(item) : null, type = `${datum.type || ''} legend`.trim(), scales = datum.scales, props = Object.keys(scales), ctx = item.context, scale = ctx.scales[scales[props[0]]].value, locale = ctx.dataflow.locale(); - return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function extractTitle(item) { - try { - return (0, _vegaUtil.array)((0, _vegaUtil.peek)(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } -} -function channelCaption(props) { - props = props.map((p)=>p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + (0, _vegaUtil.peek)(props); -} -function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; -} -const innerText = (val)=>(val + '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); -const attrText = (val)=>innerText(val).replace(/"/g, '"').replace(/\t/g, ' ').replace(/\n/g, ' ').replace(/\r/g, ' '); -function markup() { - let buf = '', outer = '', inner = ''; - const stack = [], clear = ()=>outer = inner = '', push = (tag)=>{ - if (outer) { - buf += `${outer}>${inner}`; - clear(); - } - stack.push(tag); - }, attr = (name, value)=>{ - if (value != null) outer += ` ${name}="${attrText(value)}"`; - return m; - }, m = { - open (tag) { - push(tag); - outer = '<' + tag; - for(var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)attrs[_key - 1] = arguments[_key]; - for (const set of attrs)for(const key in set)attr(key, set[key]); - return m; - }, - close () { - const tag = stack.pop(); - if (outer) buf += outer + (inner ? `>${inner}</${tag}>` : '/>'); - else buf += `</${tag}>`; - clear(); - return m; - }, - attr, - text: (t)=>(inner += innerText(t), m), - toString: ()=>buf - }; - return m; -} -const serializeXML = (node)=>_serialize(markup(), node) + ''; -function _serialize(m, node) { - m.open(node.tagName); - if (node.hasAttributes()) { - const attrs = node.attributes, n = attrs.length; - for(let i = 0; i < n; ++i)m.attr(attrs[i].name, attrs[i].value); - } - if (node.hasChildNodes()) { - const children = node.childNodes; - for (const child of children)child.nodeType === 3 // text node - ? m.text(child.nodeValue) : _serialize(m, child); - } - return m.close(); -} -const stylesAttr = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity' -}; -const stylesCss = { - blend: 'mix-blend-mode' -}; -// ensure miter limit default is consistent with canvas (#2498) -const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 -}; -const RootIndex = 0, xmlns = 'http://www.w3.org/2000/xmlns/', svgns = metadata.xmlns; -class SVGRenderer extends Renderer { - constructor(loader){ - super(loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; + }); + function TimeUnit(params2) { + Transform.call(this, null, params2); + } + const OUTPUT = ["unit0", "unit1"]; + TimeUnit.Definition = { + "type": "TimeUnit", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "units", + "type": "enum", + "values": TIME_UNITS, + "array": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "maxbins", + "type": "number", + "default": 40 + }, { + "name": "extent", + "type": "date", + "array": true + }, { + "name": "timezone", + "type": "enum", + "default": "local", + "values": ["local", "utc"] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": OUTPUT + }] + }; + inherits(TimeUnit, Transform, { + transform(_, pulse2) { + const field2 = _.field, band2 = _.interval !== false, utc = _.timezone === "utc", floor2 = this._floor(_, pulse2), offset2 = (utc ? utcInterval : timeInterval)(floor2.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor2.step; + let min2 = floor2.start || Infinity, max2 = floor2.stop || -Infinity, flag2 = pulse2.ADD; + if (_.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(field2))) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(flag2, (t) => { + const v = field2(t); + let a2, b2; + if (v == null) { + t[u0] = null; + if (band2) t[u1] = null; + } else { + t[u0] = a2 = b2 = floor2(v); + if (band2) t[u1] = b2 = offset2(a2, step); + if (a2 < min2) min2 = a2; + if (b2 > max2) max2 = b2; + } + }); + floor2.start = min2; + floor2.stop = max2; + return pulse2.modifies(band2 ? as : u0); + }, + _floor(_, pulse2) { + const utc = _.timezone === "utc"; + const { + units, + step + } = _.units ? { + units: _.units, + step: _.step || 1 + } : bin$1({ + extent: _.extent || extent(pulse2.materialize(pulse2.SOURCE).source, _.field), + maxbins: _.maxbins + }); + const tunits = timeUnits(units), prev = this.value || {}, floor2 = (utc ? utcFloor : timeFloor)(tunits, step); + floor2.unit = peek$1(tunits); + floor2.units = tunits; + floor2.step = step; + floor2.start = prev.start; + floor2.stop = prev.stop; + return this.value = floor2; } - /** - * Initialize a new SVGRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - // create the svg definitions cache - this._defs = {}; - this._clearDefs(); - if (el) { - this._svg = domChild(el, 0, 'svg', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']); - this._svg.setAttribute('version', metadata['version']); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', svgns); - setAttributes(this._root, rootAttributes); - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - // set background color if defined - this.background(this._bgcolor); - return super.initialize(el, width, height, origin, scaleFactor); + }); + function TupleIndex(params2) { + Transform.call(this, fastmap(), params2); + } + inherits(TupleIndex, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, field2 = _.field, index2 = this.value, set2 = (t) => index2.set(field2(t), t); + let mod = true; + if (_.modified("field") || pulse2.modified(field2.fields)) { + index2.clear(); + pulse2.visit(pulse2.SOURCE, set2); + } else if (pulse2.changed()) { + pulse2.visit(pulse2.REM, (t) => index2.delete(field2(t))); + pulse2.visit(pulse2.ADD, set2); + } else { + mod = false; + } + this.modified(mod); + if (index2.empty > df.cleanThreshold) df.runAfter(index2.clean); + return pulse2.fork(); } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length && this._svg) this._svg.style.setProperty('background-color', bgcolor); - return super.background(...arguments); + }); + function Values$1(params2) { + Transform.call(this, null, params2); + } + inherits(Values$1, Transform, { + transform(_, pulse2) { + const run2 = !this.value || _.modified("field") || _.modified("sort") || pulse2.changed() || _.sort && pulse2.modified(_.sort.fields); + if (run2) { + this.value = (_.sort ? pulse2.source.slice().sort(stableCompare(_.sort)) : pulse2.source).map(_.field); + } } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._svg) { - setAttributes(this._svg, { - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - }); - this._root.setAttribute('transform', `translate(${this._origin})`); + }); + function WindowOp(op, field2, param2, as) { + const fn2 = WindowOps[op](field2, param2); + return { + init: fn2.init || zero$3, + update: function(w2, t) { + t[as] = fn2.next(w2); + } + }; + } + const WindowOps = { + row_number: function() { + return { + next: (w2) => w2.index + 1 + }; + }, + rank: function() { + let rank2; + return { + init: () => rank2 = 1, + next: (w2) => { + const i = w2.index, data2 = w2.data; + return i && w2.compare(data2[i - 1], data2[i]) ? rank2 = i + 1 : rank2; } - this._dirty = []; - return this; + }; + }, + dense_rank: function() { + let drank; + return { + init: () => drank = 1, + next: (w2) => { + const i = w2.index, d = w2.data; + return i && w2.compare(d[i - 1], d[i]) ? ++drank : drank; + } + }; + }, + percent_rank: function() { + const rank2 = WindowOps.rank(), next = rank2.next; + return { + init: rank2.init, + next: (w2) => (next(w2) - 1) / (w2.data.length - 1) + }; + }, + cume_dist: function() { + let cume; + return { + init: () => cume = 0, + next: (w2) => { + const d = w2.data, c2 = w2.compare; + let i = w2.index; + if (cume < i) { + while (i + 1 < d.length && !c2(d[i], d[i + 1])) ++i; + cume = i; + } + return (1 + cume) / d.length; + } + }; + }, + ntile: function(field2, num) { + num = +num; + if (!(num > 0)) error("ntile num must be greater than zero."); + const cume = WindowOps.cume_dist(), next = cume.next; + return { + init: cume.init, + next: (w2) => Math.ceil(num * next(w2)) + }; + }, + lag: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index - offset2; + return i >= 0 ? field2(w2.data[i]) : null; + } + }; + }, + lead: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index + offset2, d = w2.data; + return i < d.length ? field2(d[i]) : null; + } + }; + }, + first_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i0]) + }; + }, + last_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i1 - 1]) + }; + }, + nth_value: function(field2, nth) { + nth = +nth; + if (!(nth > 0)) error("nth_value nth must be greater than zero."); + return { + next: (w2) => { + const i = w2.i0 + (nth - 1); + return i < w2.i1 ? field2(w2.data[i]) : null; + } + }; + }, + prev_value: function(field2) { + let prev; + return { + init: () => prev = null, + next: (w2) => { + const v = field2(w2.data[w2.index]); + return v != null ? prev = v : prev; + } + }; + }, + next_value: function(field2) { + let v, i; + return { + init: () => (v = null, i = -1), + next: (w2) => { + const d = w2.data; + return w2.index <= i ? v : (i = find$2(field2, d, w2.index)) < 0 ? (i = d.length, v = null) : v = field2(d[i]); + } + }; } - /** - * Returns the SVG element of the visualization. - * @return {DOMElement} - The SVG element. - */ canvas() { - return this._svg; + }; + function find$2(field2, data2, index2) { + for (let n = data2.length; index2 < n; ++index2) { + const v = field2(data2[index2]); + if (v != null) return index2; } - /** - * Returns an SVG text string for the rendered content, - * or null if this renderer is currently headless. - */ svg() { - const svg = this._svg, bg = this._bgcolor; - if (!svg) return null; - let node; - if (bg) { - svg.removeAttribute('style'); - node = domChild(svg, RootIndex, 'rect', svgns); - setAttributes(node, { - width: this._width, - height: this._height, - fill: bg - }); - } - const text = serializeXML(svg); - if (bg) { - svg.removeChild(node); - this._svg.style.setProperty('background-color', bg); - } - return text; + return -1; + } + const ValidWindowOps = Object.keys(WindowOps); + function WindowState(_) { + const ops2 = array$5(_.ops), fields = array$5(_.fields), params2 = array$5(_.params), aggregate_params = array$5(_.aggregate_params), as = array$5(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map2 = {}, counts = [], measures = []; + let countOnly = true; + function visitInputs(f) { + array$5(accessorFields(f)).forEach((_2) => inputs[_2] = 1); } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._clearDefs(); - this.mark(this._root, scene, undefined, markTypes); - domClear(this._root, 1); - } - this.defs(); - this._dirty = []; - ++this._dirtyID; - return this; + visitInputs(_.sort); + ops2.forEach((op, i) => { + const field2 = fields[i], param2 = params2[i], aggregate_param = aggregate_params[i] || null, mname = accessorName(field2), name = measureName(op, mname, as[i]); + visitInputs(field2); + outputs.push(name); + if (has$1(WindowOps, op)) { + windows.push(WindowOp(op, field2, param2, name)); + } else { + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + if (op === "count") { + counts.push(name); + return; + } + countOnly = false; + let m2 = map2[mname]; + if (!m2) { + m2 = map2[mname] = []; + m2.field = field2; + measures.push(m2); + } + m2.push(createMeasure(op, aggregate_param, name)); + } + }); + if (counts.length || measures.length) { + this.cell = cell(measures, counts, countOnly); } - // -- Manage rendering of items marked as dirty -- - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (item.dirty !== this._dirtyID) { - item.dirty = this._dirtyID; - this._dirty.push(item); - } + this.inputs = Object.keys(inputs); + } + const prototype = WindowState.prototype; + prototype.init = function() { + this.windows.forEach((_) => _.init()); + if (this.cell) this.cell.init(); + }; + prototype.update = function(w2, t) { + const cell2 = this.cell, wind = this.windows, data2 = w2.data, m2 = wind && wind.length; + let j; + if (cell2) { + for (j = w2.p0; j < w2.i0; ++j) cell2.rem(data2[j]); + for (j = w2.p1; j < w2.i1; ++j) cell2.add(data2[j]); + cell2.set(t); } - /** - * Check if a mark item is considered dirty. - * @param {Item} item - The mark item. - */ isDirty(item) { - return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; + for (j = 0; j < m2; ++j) wind[j].update(w2, t); + }; + function cell(measures, counts, countOnly) { + measures = measures.map((m2) => compileMeasures(m2, m2.field)); + const cell2 = { + num: 0, + agg: null, + store: false, + count: counts + }; + if (!countOnly) { + var n = measures.length, a2 = cell2.agg = Array(n), i = 0; + for (; i < n; ++i) a2[i] = new measures[i](cell2); + } + if (cell2.store) { + var store = cell2.data = new TupleStore(); + } + cell2.add = function(t) { + cell2.num += 1; + if (countOnly) return; + if (store) store.add(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].add(a2[i2].get(t), t); + } + }; + cell2.rem = function(t) { + cell2.num -= 1; + if (countOnly) return; + if (store) store.rem(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].rem(a2[i2].get(t), t); + } + }; + cell2.set = function(t) { + let i2, n2; + if (store) store.values(); + for (i2 = 0, n2 = counts.length; i2 < n2; ++i2) t[counts[i2]] = cell2.num; + if (!countOnly) for (i2 = 0, n2 = a2.length; i2 < n2; ++i2) a2[i2].set(t); + }; + cell2.init = function() { + cell2.num = 0; + if (store) store.reset(); + for (let i2 = 0; i2 < n; ++i2) a2[i2].init(); + }; + return cell2; + } + function Window(params2) { + Transform.call(this, {}, params2); + this._mlen = 0; + this._mods = []; + } + Window.Definition = { + "type": "Window", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidWindowOps.concat(ValidAggregateOps) + }, { + "name": "params", + "type": "number", + "null": true, + "array": true + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "frame", + "type": "number", + "null": true, + "array": true, + "length": 2, + "default": [null, 0] + }, { + "name": "ignorePeers", + "type": "boolean", + "default": false + }] + }; + inherits(Window, Transform, { + transform(_, pulse2) { + this.stamp = pulse2.stamp; + const mod = _.modified(), cmp = stableCompare(_.sort), key2 = groupkey(_.groupby), group2 = (t) => this.group(key2(t)); + let state = this.state; + if (!state || mod) { + state = this.state = new WindowState(_); + } + if (mod || pulse2.modified(state.inputs)) { + this.value = {}; + pulse2.visit(pulse2.SOURCE, (t) => group2(t).add(t)); + } else { + pulse2.visit(pulse2.REM, (t) => group2(t).remove(t)); + pulse2.visit(pulse2.ADD, (t) => group2(t).add(t)); + } + for (let i = 0, n = this._mlen; i < n; ++i) { + processPartition(this._mods[i], state, cmp, _); + } + this._mlen = 0; + this._mods = []; + return pulse2.reflow(mod).modifies(state.outputs); + }, + group(key2) { + let group2 = this.value[key2]; + if (!group2) { + group2 = this.value[key2] = SortedList(tupleid); + group2.stamp = -1; + } + if (group2.stamp < this.stamp) { + group2.stamp = this.stamp; + this._mods[this._mlen++] = group2; + } + return group2; } - /** - * Internal method to check dirty status and, if possible, - * make targetted updates without a full rendering pass. - */ _dirtyCheck() { - this._dirtyAll = true; - const items = this._dirty; - if (!items.length || !this._dirtyID) return true; - const id = ++this._dirtyID; - let item, mark, type, mdef, i, n, o; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - mark = item.mark; - if (mark.marktype !== type) { - // memoize mark instance lookup - type = mark.marktype; - mdef = Marks[type]; - } - if (mark.zdirty && mark.dirty !== id) { - this._dirtyAll = false; - dirtyParents(item, id); - mark.items.forEach((i)=>{ - i.dirty = id; - }); - } - if (mark.zdirty) continue; // handle in standard drawing pass - if (item.exit) { - // EXIT - if (mdef.nested && mark.items.length) { - // if nested mark with remaining points, update instead - o = mark.items[0]; - if (o._svg) this._update(mdef, o._svg, o); - } else if (item._svg) { - // otherwise remove from DOM - o = item._svg.parentNode; - if (o) o.removeChild(item._svg); - } - item._svg = null; - continue; - } - item = mdef.nested ? mark.items[0] : item; - if (item._update === id) continue; // already visited - if (!item._svg || !item._svg.ownerSVGElement) { - // ENTER - this._dirtyAll = false; - dirtyParents(item, id); - } else // IN-PLACE UPDATE - this._update(mdef, item._svg, item); - item._update = id; - } - return !this._dirtyAll; + }); + function processPartition(list, state, cmp, _) { + const sort2 = _.sort, range2 = sort2 && !_.ignorePeers, frame2 = _.frame || [null, 0], data2 = list.data(cmp), n = data2.length, b2 = range2 ? bisector(sort2) : null, w2 = { + i0: 0, + i1: 0, + p0: 0, + p1: 0, + index: 0, + data: data2, + compare: sort2 || constant$5(-1) + }; + state.init(); + for (let i = 0; i < n; ++i) { + setWindow(w2, frame2, i, n); + if (range2) adjustRange(w2, b2); + state.update(w2, data2[i]); } - // -- Construct & maintain scenegraph to SVG mapping --- - /** - * Render a set of mark items. - * @param {SVGElement} el - The parent element in the SVG tree. - * @param {object} scene - The mark parent to render. - * @param {SVGElement} prev - The previous sibling in the SVG tree. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ mark(el, scene, prev, markTypes) { - if (!this.isDirty(scene)) return scene._svg; - const svg = this._svg, markType = scene.marktype, mdef = Marks[markType], events = scene.interactive === false ? 'none' : null, isGroup = mdef.tag === 'g'; - const parent = bind(scene, el, prev, 'g', svg); - if (markType !== 'group' && markTypes != null && !markTypes.includes(markType)) { - domClear(parent, 0); - return scene._svg; - } - parent.setAttribute('class', cssClass(scene)); - // apply aria attributes to parent container element - const aria = ariaMarkAttributes(scene); - for(const key in aria)setAttribute(parent, key, aria[key]); - if (!isGroup) setAttribute(parent, 'pointer-events', events); - setAttribute(parent, 'clip-path', scene.clip ? clip$1(this, scene, scene.group) : null); - let sibling = null, i = 0; - const process = (item)=>{ - const dirty = this.isDirty(item), node = bind(item, parent, sibling, mdef.tag, svg); - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item, markTypes); - } - sibling = node; - ++i; - }; - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else visit(scene, process); - domClear(parent, i); - return parent; + } + function setWindow(w2, f, i, n) { + w2.p0 = w2.i0; + w2.p1 = w2.i1; + w2.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); + w2.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); + w2.index = i; + } + function adjustRange(w2, bisect2) { + const r0 = w2.i0, r1 = w2.i1 - 1, c2 = w2.compare, d = w2.data, n = d.length - 1; + if (r0 > 0 && !c2(d[r0], d[r0 - 1])) w2.i0 = bisect2.left(d, d[r0]); + if (r1 < n && !c2(d[r1], d[r1 + 1])) w2.i1 = bisect2.right(d, d[r1]); + } + const tx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + aggregate: Aggregate$1, + bin: Bin, + collect: Collect$1, + compare: Compare$1, + countpattern: CountPattern, + cross: Cross$1, + density: Density, + dotbin: DotBin, + expression: Expression$1, + extent: Extent, + facet: Facet$1, + field: Field$1, + filter: Filter, + flatten: Flatten, + fold: Fold, + formula: Formula, + generate: Generate, + impute: Impute, + joinaggregate: JoinAggregate, + kde: KDE, + key: Key$1, + load: Load$1, + lookup: Lookup, + multiextent: MultiExtent$1, + multivalues: MultiValues$1, + params: Params$2, + pivot: Pivot, + prefacet: PreFacet$1, + project: Project, + proxy: Proxy$1, + quantile: Quantile$1, + relay: Relay$1, + sample: Sample, + sequence: Sequence, + sieve: Sieve$1, + subflow: Subflow, + timeunit: TimeUnit, + tupleindex: TupleIndex, + values: Values$1, + window: Window + }, Symbol.toStringTag, { value: "Module" })); + function constant$3(x2) { + return function constant2() { + return x2; + }; + } + const abs$2 = Math.abs; + const atan2$1 = Math.atan2; + const cos$2 = Math.cos; + const max$2 = Math.max; + const min$2 = Math.min; + const sin$2 = Math.sin; + const sqrt$3 = Math.sqrt; + const epsilon$5 = 1e-12; + const pi$3 = Math.PI; + const halfPi$2 = pi$3 / 2; + const tau$3 = 2 * pi$3; + function acos$1(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$3 : Math.acos(x2); + } + function asin$2(x2) { + return x2 >= 1 ? halfPi$2 : x2 <= -1 ? -halfPi$2 : Math.asin(x2); + } + const pi$2 = Math.PI, tau$2 = 2 * pi$2, epsilon$4 = 1e-6, tauEpsilon = tau$2 - epsilon$4; + function append$1(strings) { + this._ += strings[0]; + for (let i = 1, n = strings.length; i < n; ++i) { + this._ += arguments[i] + strings[i]; } - /** - * Update the attributes of an SVG element for a mark item. - * @param {object} mdef - The mark definition object - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ _update(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - // apply aria-specific properties - ariaItemAttributes(emit, item); - // apply svg attributes - mdef.attr(emit, item, this); - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - // apply svg style attributes - // note: element state may have been modified by 'extra' method - if (element) this.style(element, item); + } + function appendRound$1(digits) { + let d = Math.floor(digits); + if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`); + if (d > 15) return append$1; + const k = 10 ** d; + return function(strings) { + this._ += strings[0]; + for (let i = 1, n = strings.length; i < n; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings[i]; + } + }; + } + let Path$1 = class Path { + constructor(digits) { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + this._append = digits == null ? append$1 : appendRound$1(digits); } - /** - * Update the presentation attributes of an SVG element for a mark item. - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ style(el, item) { - if (item == null) return; - for(const prop in stylesAttr){ - let value = prop === 'font' ? fontFamily(item) : item[prop]; - if (value === values[prop]) continue; - const name = stylesAttr[prop]; - if (value == null) el.removeAttribute(name); - else { - if (isGradient(value)) value = gradientRef(value, this._defs.gradient, href()); - el.setAttribute(name, value + ''); - } - values[prop] = value; - } - for(const prop in stylesCss)setStyle(el, stylesCss[prop], item[prop]); + moveTo(x2, y2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - */ defs() { - const svg = this._svg, defs = this._defs; - let el = defs.el, index = 0; - for(const id in defs.gradient){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateGradient(el, defs.gradient[id], index); - } - for(const id in defs.clipping){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateClipping(el, defs.clipping[id], index); - } - // clean-up - if (el) index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index); + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._append`Z`; + } } - /** - * Clear defs caches. - */ _clearDefs() { - const def = this._defs; - def.gradient = {}; - def.clipping = {}; - } -} -// mark ancestor chain with a dirty id -function dirtyParents(item, id) { - for(; item && item.dirty !== id; item = item.mark.group){ - item.dirty = id; - if (item.mark && item.mark.dirty !== id) item.mark.dirty = id; - else return; - } -} -// update gradient definitions -function updateGradient(el, grad, index) { - let i, n, stop; - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - let pt = domChild(el, index++, 'pattern', svgns); - setAttributes(pt, { - id: patternPrefix + grad.id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - pt = domChild(pt, 0, 'rect', svgns); - setAttributes(pt, { - width: 1, - height: 1, - fill: `url(${href()}#${grad.id})` - }); - el = domChild(el, index++, 'radialGradient', svgns); - setAttributes(el, { - id: grad.id, - fx: grad.x1, - fy: grad.y1, - fr: grad.r1, - cx: grad.x2, - cy: grad.y2, - r: grad.r2 - }); - } else { - el = domChild(el, index++, 'linearGradient', svgns); - setAttributes(el, { - id: grad.id, - x1: grad.x1, - x2: grad.x2, - y1: grad.y1, - y2: grad.y2 - }); + lineTo(x2, y2) { + this._append`L${this._x1 = +x2},${this._y1 = +y2}`; + } + quadraticCurveTo(x12, y12, x2, y2) { + this._append`Q${+x12},${+y12},${this._x1 = +x2},${this._y1 = +y2}`; + } + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + this._append`C${+x12},${+y12},${+x2},${+y2},${this._x1 = +x3},${this._y1 = +y3}`; + } + arcTo(x12, y12, x2, y2, r) { + x12 = +x12, y12 = +y12, x2 = +x2, y2 = +y2, r = +r; + if (r < 0) throw new Error(`negative radius: ${r}`); + let x02 = this._x1, y02 = this._y1, x21 = x2 - x12, y21 = y2 - y12, x01 = x02 - x12, y01 = y02 - y12, l01_2 = x01 * x01 + y01 * y01; + if (this._x1 === null) { + this._append`M${this._x1 = x12},${this._y1 = y12}`; + } else if (!(l01_2 > epsilon$4)) ; + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$4) || !r) { + this._append`L${this._x1 = x12},${this._y1 = y12}`; + } else { + let x20 = x2 - x02, y20 = y2 - y02, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; + if (Math.abs(t01 - 1) > epsilon$4) { + this._append`L${x12 + t01 * x01},${y12 + t01 * y01}`; + } + this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x12 + t21 * x21},${this._y1 = y12 + t21 * y21}`; + } } - for(i = 0, n = grad.stops.length; i < n; ++i){ - stop = domChild(el, i, 'stop', svgns); - stop.setAttribute('offset', grad.stops[i].offset); - stop.setAttribute('stop-color', grad.stops[i].color); + arc(x2, y2, r, a0, a1, ccw) { + x2 = +x2, y2 = +y2, r = +r, ccw = !!ccw; + if (r < 0) throw new Error(`negative radius: ${r}`); + let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x02 = x2 + dx, y02 = y2 + dy, cw2 = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; + if (this._x1 === null) { + this._append`M${x02},${y02}`; + } else if (Math.abs(this._x1 - x02) > epsilon$4 || Math.abs(this._y1 - y02) > epsilon$4) { + this._append`L${x02},${y02}`; + } + if (!r) return; + if (da < 0) da = da % tau$2 + tau$2; + if (da > tauEpsilon) { + this._append`A${r},${r},0,1,${cw2},${x2 - dx},${y2 - dy}A${r},${r},0,1,${cw2},${this._x1 = x02},${this._y1 = y02}`; + } else if (da > epsilon$4) { + this._append`A${r},${r},0,${+(da >= pi$2)},${cw2},${this._x1 = x2 + r * Math.cos(a1)},${this._y1 = y2 + r * Math.sin(a1)}`; + } } - domClear(el, i); - return index; -} -// update clipping path definitions -function updateClipping(el, clip, index) { - let mask; - el = domChild(el, index, 'clipPath', svgns); - el.setAttribute('id', clip.id); - if (clip.path) { - mask = domChild(el, 0, 'path', svgns); - mask.setAttribute('d', clip.path); - } else { - mask = domChild(el, 0, 'rect', svgns); - setAttributes(mask, { - x: 0, - y: 0, - width: clip.width, - height: clip.height - }); + rect(x2, y2, w2, h2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${w2 = +w2}v${+h2}h${-w2}Z`; } - domClear(el, 1); - return index + 1; -} -// Recursively process group contents. -function recurse(renderer, el, group, markTypes) { - // child 'g' element is second to last among children (path, g, path) - // other children here are foreground and background path elements - el = el.lastChild.previousSibling; - let prev, idx = 0; - visit(group, (item)=>{ - prev = renderer.mark(el, item, prev, markTypes); - ++idx; - }); - // remove any extraneous DOM elements - domClear(el, 1 + idx); -} -// Bind a scenegraph item to an SVG DOM element. -// Create new SVG elements as needed. -function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, svgns); - item._svg = node; - if (item.mark) { - node.__data__ = item; - node.__values__ = { - fill: 'default' - }; - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', svgns); - node.appendChild(bg); - bg.__data__ = item; - const cg = domCreate(doc, 'g', svgns); - node.appendChild(cg); - cg.__data__ = item; - const fg = domCreate(doc, 'path', svgns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = { - fill: 'default' - }; - } - } + toString() { + return this._; } - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - return node; -} -// check if two nodes are ordered siblings -function siblingCheck(node, sibling) { - return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same -} -// -- Set attributes & styles on SVG elements --- -let element = null, // temp var for current SVG element -values = null; // temp var for current values hash -// Extra configuration for certain mark types -const mark_extras = { - group (mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - // leave element null to prevent downstream styling - element = null; - } else // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); + }; + function path$3() { + return new Path$1(); + } + path$3.prototype = Path$1.prototype; + function withPath(shape2) { + let digits = 3; + shape2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) { + digits = null; + } else { + const d = Math.floor(_); + if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d; + } + return shape2; + }; + return () => new Path$1(digits); + } + function arcInnerRadius(d) { + return d.innerRadius; + } + function arcOuterRadius(d) { + return d.outerRadius; + } + function arcStartAngle(d) { + return d.startAngle; + } + function arcEndAngle(d) { + return d.endAngle; + } + function arcPadAngle(d) { + return d && d.padAngle; + } + function intersect$3(x02, y02, x12, y12, x2, y2, x3, y3) { + var x10 = x12 - x02, y10 = y12 - y02, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; + if (t * t < epsilon$5) return; + t = (x32 * (y02 - y2) - y32 * (x02 - x2)) / t; + return [x02 + t * x10, y02 + t * y10]; + } + function cornerTangents(x02, y02, x12, y12, r1, rc, cw2) { + var x01 = x02 - x12, y01 = y02 - y12, lo = (cw2 ? rc : -rc) / sqrt$3(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x02 + ox, y11 = y02 + oy, x10 = x12 + ox, y10 = y12 + oy, x002 = (x11 + x10) / 2, y002 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt$3(max$2(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d) / d2, cy0 = (-D2 * dx - dy * d) / d2, cx1 = (D2 * dy + dx * d) / d2, cy1 = (-D2 * dx + dy * d) / d2, dx0 = cx0 - x002, dy0 = cy0 - y002, dx1 = cx1 - x002, dy1 = cy1 - y002; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + return { + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r - 1), + y11: cy0 * (r1 / r - 1) + }; + } + function arc$2$1() { + var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant$3(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context2 = null, path2 = withPath(arc2); + function arc2() { + var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi$2, a1 = endAngle.apply(this, arguments) - halfPi$2, da = abs$2(a1 - a0), cw2 = a1 > a0; + if (!context2) context2 = buffer = path2(); + if (r1 < r0) r = r1, r1 = r0, r0 = r; + if (!(r1 > epsilon$5)) context2.moveTo(0, 0); + else if (da > tau$3 - epsilon$5) { + context2.moveTo(r1 * cos$2(a0), r1 * sin$2(a0)); + context2.arc(0, 0, r1, a0, a1, !cw2); + if (r0 > epsilon$5) { + context2.moveTo(r0 * cos$2(a1), r0 * sin$2(a1)); + context2.arc(0, 0, r0, a1, a0, cw2); + } + } else { + var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon$5 && (padRadius ? +padRadius.apply(this, arguments) : sqrt$3(r0 * r0 + r1 * r1)), rc = min$2(abs$2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t02, t12; + if (rp > epsilon$5) { + var p02 = asin$2(rp / r0 * sin$2(ap)), p1 = asin$2(rp / r1 * sin$2(ap)); + if ((da0 -= p02 * 2) > epsilon$5) p02 *= cw2 ? 1 : -1, a00 += p02, a10 -= p02; + else da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon$5) p1 *= cw2 ? 1 : -1, a01 += p1, a11 -= p1; + else da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + var x01 = r1 * cos$2(a01), y01 = r1 * sin$2(a01), x10 = r0 * cos$2(a10), y10 = r0 * sin$2(a10); + if (rc > epsilon$5) { + var x11 = r1 * cos$2(a11), y11 = r1 * sin$2(a11), x002 = r0 * cos$2(a00), y002 = r0 * sin$2(a00), oc; + if (da < pi$3) { + if (oc = intersect$3(x01, y01, x002, y002, x11, y11, x10, y10)) { + var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$3(ax * ax + ay * ay) * sqrt$3(bx * bx + by * by))) / 2), lc = sqrt$3(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = min$2(rc, (r0 - lc) / (kc - 1)); + rc1 = min$2(rc, (r1 - lc) / (kc + 1)); + } else { + rc0 = rc1 = 0; + } + } + } + if (!(da1 > epsilon$5)) context2.moveTo(x01, y01); + else if (rc1 > epsilon$5) { + t02 = cornerTangents(x002, y002, x01, y01, r1, rc1, cw2); + t12 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw2); + context2.moveTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc1 < rc) context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r1, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), !cw2); + context2.arc(t12.cx, t12.cy, rc1, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.moveTo(x01, y01), context2.arc(0, 0, r1, a01, a11, !cw2); + if (!(r0 > epsilon$5) || !(da0 > epsilon$5)) context2.lineTo(x10, y10); + else if (rc0 > epsilon$5) { + t02 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw2); + t12 = cornerTangents(x01, y01, x002, y002, r0, -rc0, cw2); + context2.lineTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc0 < rc) context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r0, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), cw2); + context2.arc(t12.cx, t12.cy, rc0, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.arc(0, 0, r0, a10, a00, cw2); + } + context2.closePath(); + if (buffer) return context2 = null, buffer + "" || null; + } + arc2.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$3 / 2; + return [cos$2(a2) * r, sin$2(a2) * r]; + }; + arc2.innerRadius = function(_) { + return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$3(+_), arc2) : innerRadius; + }; + arc2.outerRadius = function(_) { + return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$3(+_), arc2) : outerRadius; + }; + arc2.cornerRadius = function(_) { + return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$3(+_), arc2) : cornerRadius; + }; + arc2.padRadius = function(_) { + return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), arc2) : padRadius; + }; + arc2.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$3(+_), arc2) : startAngle; + }; + arc2.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$3(+_), arc2) : endAngle; + }; + arc2.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$3(+_), arc2) : padAngle; + }; + arc2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, arc2) : context2; + }; + return arc2; + } + function array$4(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function Linear$1(context2) { + this._context = context2; + } + Linear$1.prototype = { + areaStart: function() { + this._line = 0; }, - image (mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else setStyle(el, 'image-rendering', null); + areaEnd: function() { + this._line = NaN; }, - text (mdef, el, item) { - const tl = textLines(item); - let key, value, doc, lh; - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - value = tl.map((_)=>textValue(item, _)); - key = value.join('\n'); // content cache key - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i)=>{ - const ts = domCreate(doc, 'tspan', svgns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: + this._context.lineTo(x2, y2); + break; + } + } + }; + function curveLinear(context2) { + return new Linear$1(context2); + } + function x$3(p) { + return p[0]; + } + function y$3(p) { + return p[1]; + } + function line$2$1(x2, y2) { + var defined = constant$3(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(line2); + x2 = typeof x2 === "function" ? x2 : x2 === void 0 ? x$3 : constant$3(x2); + y2 = typeof y2 === "function" ? y2 : y2 === void 0 ? y$3 : constant$3(y2); + function line2(data2) { + var i, n = (data2 = array$4(data2)).length, d, defined0 = false, buffer; + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) output2.lineStart(); + else output2.lineEnd(); + } + if (defined0) output2.point(+x2(d, i, data2), +y2(d, i, data2)); + } + if (buffer) return output2 = null, buffer + "" || null; + } + line2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$3(+_), line2) : x2; + }; + line2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$3(+_), line2) : y2; + }; + line2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$3(!!_), line2) : defined; + }; + line2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), line2) : curve2; + }; + line2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), line2) : context2; + }; + return line2; + } + function area$2$1(x02, y02, y12) { + var x12 = null, defined = constant$3(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(area2); + x02 = typeof x02 === "function" ? x02 : x02 === void 0 ? x$3 : constant$3(+x02); + y02 = typeof y02 === "function" ? y02 : y02 === void 0 ? constant$3(0) : constant$3(+y02); + y12 = typeof y12 === "function" ? y12 : y12 === void 0 ? y$3 : constant$3(+y12); + function area2(data2) { + var i, j, k, n = (data2 = array$4(data2)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) { + j = i; + output2.areaStart(); + output2.lineStart(); + } else { + output2.lineEnd(); + output2.lineStart(); + for (k = i - 1; k >= j; --k) { + output2.point(x0z[k], y0z[k]); + } + output2.lineEnd(); + output2.areaEnd(); + } + } + if (defined0) { + x0z[i] = +x02(d, i, data2), y0z[i] = +y02(d, i, data2); + output2.point(x12 ? +x12(d, i, data2) : x0z[i], y12 ? +y12(d, i, data2) : y0z[i]); } - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } -}; -function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - // use appropriate method given namespace (ns) - if (ns) setAttributeNS(element, name, value, ns); - else setAttribute(element, name, value); - // note current value for future comparison - values[name] = value; -} -function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) el.style.removeProperty(name); - else el.style.setProperty(name, value + ''); - values[name] = value; - } -} -function setAttributes(el, attrs) { - for(const key in attrs)setAttribute(el, key, attrs[key]); -} -function setAttribute(el, name, value) { - if (value != null) // if value is provided, update DOM attribute - el.setAttribute(name, value); - else // else remove DOM attribute - el.removeAttribute(name); -} -function setAttributeNS(el, name, value, ns) { - if (value != null) // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - else // else remove DOM attribute - el.removeAttributeNS(ns, name); -} -function href() { - let loc; - return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; -} -class SVGStringRenderer extends Renderer { - constructor(loader){ - super(loader); - this._text = null; - this._defs = { - gradient: {}, - clipping: {} - }; + } + if (buffer) return output2 = null, buffer + "" || null; } - /** - * Returns the rendered SVG text string, - * or null if rendering has not yet occurred. - */ svg() { - return this._text; + function arealine() { + return line$2$1().defined(defined).curve(curve2).context(context2); } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - */ _render(scene) { - const m = markup(); - // svg tag - m.open('svg', (0, _vegaUtil.extend)({}, metadata, { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - })); - // background, if defined - const bg = this._bgcolor; - if (bg && bg !== 'transparent' && bg !== 'none') m.open('rect', { - width: this._width, - height: this._height, - fill: bg - }).close(); - // root content group - m.open('g', rootAttributes, { - transform: 'translate(' + this._origin + ')' - }); - this.mark(m, scene); - m.close(); // </g> - // defs - this.defs(m); - // get SVG text string - this._text = m.close() + ''; - return this; - } - /** - * Render a set of mark items. - * @param {object} m - The markup context. - * @param {object} scene - The mark parent to render. - */ mark(m, scene) { - const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ - ariaItemAttributes, - mdef.attr - ]; - // render opening group tag - m.open('g', { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip$1(this, scene, scene.group) : null - }, ariaMarkAttributes(scene), { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - }); - // render contained elements - const process = (item)=>{ - const href = this.href(item); - if (href) m.open('a', href); - m.open(tag, this.attr(scene, item, attrList, tag !== 'g' ? tag : null)); - if (tag === 'text') { - const tl = textLines(item); - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - const attrs = { - x: 0, - dy: lineHeight(item) - }; - for(let i = 0; i < tl.length; ++i)m.open('tspan', i ? attrs : null).text(textValue(item, tl[i])).close(); - } else // single-line text - m.text(textValue(item, tl)); - } else if (tag === 'g') { - const fore = item.strokeForeground, fill = item.fill, stroke = item.stroke; - if (fore && stroke) item.stroke = null; - m.open('path', this.attr(scene, item, mdef.background, 'bgrect')).close(); - // recurse for group content - m.open('g', this.attr(scene, item, mdef.content)); - visit(item, (scene)=>this.mark(m, scene)); - m.close(); - if (fore && stroke) { - if (fill) item.fill = null; - item.stroke = stroke; - m.open('path', this.attr(scene, item, mdef.foreground, 'bgrect')).close(); - if (fill) item.fill = fill; - } else m.open('path', this.attr(scene, item, mdef.foreground, 'bgfore')).close(); - } - m.close(); // </tag> - if (href) m.close(); // </a> - }; - if (mdef.nested) { - if (scene.items && scene.items.length) process(scene.items[0]); - } else visit(scene, process); - // render closing group tag - return m.close(); // </g> - } - /** - * Get href attributes for a hyperlinked mark item. - * @param {Item} item - The mark item. - */ href(item) { - const href = item.href; - let attr; - if (href) { - if (attr = this._hrefs && this._hrefs[href]) return attr; - else this.sanitizeURL(href).then((attr)=>{ - // rewrite to use xlink namespace - attr['xlink:href'] = attr.href; - attr.href = null; - (this._hrefs || (this._hrefs = {}))[href] = attr; - }); - } - return null; - } - /** - * Get an object of SVG attributes for a mark item. - * @param {object} scene - The mark parent. - * @param {Item} item - The mark item. - * @param {array|function} attrs - One or more attribute emitters. - * @param {string} tag - The tag being rendered. - */ attr(scene, item, attrs, tag) { - const object = {}, emit = (name, value, ns, prefixed)=>{ - object[prefixed || name] = value; - }; - // apply mark specific attributes - if (Array.isArray(attrs)) attrs.forEach((fn)=>fn(emit, item, this)); - else attrs(emit, item, this); - // apply style attributes - if (tag) style(object, item, scene, tag, this._defs); - return object; - } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - * @param {object} m - The markup context. - */ defs(m) { - const gradient = this._defs.gradient, clipping = this._defs.clipping, count = Object.keys(gradient).length + Object.keys(clipping).length; - if (count === 0) return; // nothing to do - m.open('defs'); - for(const id in gradient){ - const def = gradient[id], stops = def.stops; - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - m.open('pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - m.open('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }).close(); - m.close(); // </pattern> - m.open('radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else m.open('linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - for(let i = 0; i < stops.length; ++i)m.open('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }).close(); - m.close(); - } - for(const id in clipping){ - const def = clipping[id]; - m.open('clipPath', { - id: id - }); - if (def.path) m.open('path', { - d: def.path - }).close(); - else m.open('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }).close(); - m.close(); - } - m.close(); - } -} -// Helper function for attr for style presentation attributes -function style(s, item, scene, tag, defs) { - let styleList; - if (item == null) return s; - if (tag === 'bgrect' && scene.interactive === false) s['pointer-events'] = 'none'; - if (tag === 'bgfore') { - if (scene.interactive === false) s['pointer-events'] = 'none'; - s.display = 'none'; - if (item.fill !== null) return s; - } - if (tag === 'image' && item.smooth === false) styleList = [ - 'image-rendering: optimizeSpeed;', - 'image-rendering: pixelated;' - ]; - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - s['font-style'] = item.fontStyle; - s['font-variant'] = item.fontVariant; - s['font-weight'] = item.fontWeight; - } - for(const prop in stylesAttr){ - let value = item[prop]; - const name = stylesAttr[prop]; - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; - else if (value != null) { - if (isGradient(value)) value = gradientRef(value, defs.gradient, ''); - s[name] = value; - } - } - for(const prop in stylesCss){ - const value = item[prop]; - if (value != null) { - styleList = styleList || []; - styleList.push(`${stylesCss[prop]}: ${value};`); - } - } - if (styleList) s.style = styleList.join(' '); - return s; -} -/** - * @typedef {Object} HybridRendererOptions - * - * @property {string[]} [svgMarkTypes=['text']] - An array of SVG mark types to render - * in the SVG layer. All other mark types - * will be rendered in the Canvas layer. - * @property {boolean} [svgOnTop=true] - Flag to determine if SVG should be rendered on top. - * @property {boolean} [debug=false] - Flag to enable or disable debugging mode. When true, - * the top layer will be stacked below the bottom layer - * rather than overlaid on top. - */ /** @type {HybridRendererOptions} */ const OPTS = { - svgMarkTypes: [ - 'text' - ], - svgOnTop: true, - debug: false -}; -/** - * Configure the HybridRenderer - * - * @param {HybridRendererOptions} options - HybridRenderer configuration options. - */ function setHybridRendererOptions(options) { - OPTS['svgMarkTypes'] = options.svgMarkTypes ?? [ - 'text' - ]; - OPTS['svgOnTop'] = options.svgOnTop ?? true; - OPTS['debug'] = options.debug ?? false; -} -class HybridRenderer extends Renderer { - constructor(loader){ - super(loader); - this._svgRenderer = new SVGRenderer(loader); - this._canvasRenderer = new CanvasRenderer(loader); - } - /** - * Initialize a new HybridRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {HybridRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._root_el = domChild(el, 0, 'div'); - const bottomEl = domChild(this._root_el, 0, 'div'); - const topEl = domChild(this._root_el, 1, 'div'); - this._root_el.style.position = 'relative'; - // Set position absolute to overlay svg on top of canvas - if (!OPTS.debug) { - bottomEl.style.height = '100%'; - topEl.style.position = 'absolute'; - topEl.style.top = '0'; - topEl.style.left = '0'; - topEl.style.height = '100%'; - topEl.style.width = '100%'; - } - this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; - this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; - // pointer-events to none on SVG layer so that canvas gets all events - this._svgEl.style.pointerEvents = 'none'; - this._canvasRenderer.initialize(this._canvasEl, width, height, origin, scaleFactor); - this._svgRenderer.initialize(this._svgEl, width, height, origin, scaleFactor); - return super.initialize(el, width, height, origin, scaleFactor); - } - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (OPTS.svgMarkTypes.includes(item.mark.marktype)) this._svgRenderer.dirty(item); - else this._canvasRenderer.dirty(item); - return this; - } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - const allMarkTypes = markTypes ?? [ - 'arc', - 'area', - 'image', - 'line', - 'path', - 'rect', - 'rule', - 'shape', - 'symbol', - 'text', - 'trail' - ]; - const canvasMarkTypes = allMarkTypes.filter((m)=>!OPTS.svgMarkTypes.includes(m)); - this._svgRenderer.render(scene, OPTS.svgMarkTypes); - this._canvasRenderer.render(scene, canvasMarkTypes); - } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - this._svgRenderer.resize(width, height, origin, scaleFactor); - this._canvasRenderer.resize(width, height, origin, scaleFactor); - return this; - } - background(bgcolor) { - // Propagate background color to lower canvas renderer - if (OPTS.svgOnTop) this._canvasRenderer.background(bgcolor); - else this._svgRenderer.background(bgcolor); - return this; - } -} -class HybridHandler extends CanvasHandler { - constructor(loader, tooltip){ - super(loader, tooltip); - } - initialize(el, origin, obj) { - const canvas = domChild(domChild(el, 0, 'div'), OPTS.svgOnTop ? 0 : 1, 'div'); - return super.initialize(canvas, origin, obj); - } -} -const Canvas = 'canvas'; -const Hybrid = 'hybrid'; -const PNG = 'png'; -const SVG = 'svg'; -const None = 'none'; -const RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - Hybrid: Hybrid, - None: None -}; -const modules = {}; -modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler -}; -modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler -}; -modules[Hybrid] = { - renderer: HybridRenderer, - headless: HybridRenderer, - handler: HybridHandler -}; -modules[None] = {}; -function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else return modules[name]; -} -function intersect(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : (0, _vegaUtil.error)('Intersect scene must be mark node or group item.'); -} -function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, type = mark.marktype, n = items.length; - let i = 0; - if (type === 'group') for(; i < n; ++i)intersectGroup(items[i], box, filter, hits); - else for(const test = Marks[type].isect; i < n; ++i){ - const item = items[i]; - if (intersectItem(item, box, test)) hits.push(item); - } - } - return hits; -} -function visitMark(mark, box, filter) { - // process if bounds intersect and if - // (1) mark is a group mark (so we must recurse), or - // (2) mark is interactive and passes filter - return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark))); -} -function intersectGroup(group, box, filter, hits) { - // test intersect against group - // skip groups by default unless filter says otherwise - if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) hits.push(group); - // recursively test children marks - // translate box to group coordinate space - const marks = group.items, n = marks && marks.length; - if (n) { - const x = group.x || 0, y = group.y || 0; - box.translate(-x, -y); - for(let i = 0; i < n; ++i)intersectMark(marks[i], box, filter, hits); - box.translate(x, y); - } - return hits; -} -function intersectItem(item, box, test) { - // test bounds enclosure, bounds intersection, then detailed test - const bounds = item.bounds; - return box.encloses(bounds) || box.intersects(bounds) && test(item, box); -} -const clipBounds = new Bounds(); -function boundClip(mark) { - const clip = mark.clip; - if ((0, _vegaUtil.isFunction)(clip)) clip(boundContext(clipBounds.clear())); - else if (clip) clipBounds.set(0, 0, mark.group.width, mark.group.height); - else return; - mark.bounds.intersect(clipBounds); -} -const TOLERANCE = 1e-9; -function sceneEqual(a, b, key) { - return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : (0, _vegaUtil.isNumber)(a) && (0, _vegaUtil.isNumber)(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !(0, _vegaUtil.isObject)(a) && !(0, _vegaUtil.isObject)(b) ? a == b : objectEqual(a, b); -} -function pathEqual(a, b) { - return sceneEqual(parse(a), parse(b)); -} -function objectEqual(a, b) { - var ka = Object.keys(a), kb = Object.keys(b), key, i; - if (ka.length !== kb.length) return false; - ka.sort(); - kb.sort(); - for(i = ka.length - 1; i >= 0; i--){ - if (ka[i] != kb[i]) return false; - } - for(i = ka.length - 1; i >= 0; i--){ - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; - } - return typeof a === typeof b; -} -function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); -} - -},{"vega-util":"bApja","d3-shape":"8QPYO","d3-path":"cRa94","vega-canvas":"kPWfS","vega-loader":"gmbOr","vega-scale":"bEydG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8QPYO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "arc", ()=>(0, _arcJsDefault.default)); -parcelHelpers.export(exports, "area", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "line", ()=>(0, _lineJsDefault.default)); -parcelHelpers.export(exports, "pie", ()=>(0, _pieJsDefault.default)); -parcelHelpers.export(exports, "areaRadial", ()=>(0, _areaRadialJsDefault.default)) // Note: radialArea is deprecated! -; -parcelHelpers.export(exports, "radialArea", ()=>(0, _areaRadialJsDefault.default)); -parcelHelpers.export(exports, "lineRadial", ()=>(0, _lineRadialJsDefault.default)) // Note: radialLine is deprecated! -; -parcelHelpers.export(exports, "radialLine", ()=>(0, _lineRadialJsDefault.default)); -parcelHelpers.export(exports, "pointRadial", ()=>(0, _pointRadialJsDefault.default)); -parcelHelpers.export(exports, "link", ()=>(0, _linkJs.link)); -parcelHelpers.export(exports, "linkHorizontal", ()=>(0, _linkJs.linkHorizontal)); -parcelHelpers.export(exports, "linkVertical", ()=>(0, _linkJs.linkVertical)); -parcelHelpers.export(exports, "linkRadial", ()=>(0, _linkJs.linkRadial)); -parcelHelpers.export(exports, "symbol", ()=>(0, _symbolJsDefault.default)); -parcelHelpers.export(exports, "symbolsStroke", ()=>(0, _symbolJs.symbolsStroke)); -parcelHelpers.export(exports, "symbolsFill", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbols", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbolAsterisk", ()=>(0, _asteriskJsDefault.default)); -parcelHelpers.export(exports, "symbolCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "symbolCross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond", ()=>(0, _diamondJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond2", ()=>(0, _diamond2JsDefault.default)); -parcelHelpers.export(exports, "symbolPlus", ()=>(0, _plusJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare", ()=>(0, _squareJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare2", ()=>(0, _square2JsDefault.default)); -parcelHelpers.export(exports, "symbolStar", ()=>(0, _starJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle", ()=>(0, _triangleJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle2", ()=>(0, _triangle2JsDefault.default)); -parcelHelpers.export(exports, "symbolWye", ()=>(0, _wyeJsDefault.default)); -parcelHelpers.export(exports, "symbolTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "symbolX", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "curveBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "curveBasisOpen", ()=>(0, _basisOpenJsDefault.default)); -parcelHelpers.export(exports, "curveBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "curveBumpX", ()=>(0, _bumpJs.bumpX)); -parcelHelpers.export(exports, "curveBumpY", ()=>(0, _bumpJs.bumpY)); -parcelHelpers.export(exports, "curveBundle", ()=>(0, _bundleJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalClosed", ()=>(0, _cardinalClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalOpen", ()=>(0, _cardinalOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCardinal", ()=>(0, _cardinalJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomClosed", ()=>(0, _catmullRomClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomOpen", ()=>(0, _catmullRomOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRom", ()=>(0, _catmullRomJsDefault.default)); -parcelHelpers.export(exports, "curveLinearClosed", ()=>(0, _linearClosedJsDefault.default)); -parcelHelpers.export(exports, "curveLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "curveMonotoneX", ()=>(0, _monotoneJs.monotoneX)); -parcelHelpers.export(exports, "curveMonotoneY", ()=>(0, _monotoneJs.monotoneY)); -parcelHelpers.export(exports, "curveNatural", ()=>(0, _naturalJsDefault.default)); -parcelHelpers.export(exports, "curveStep", ()=>(0, _stepJsDefault.default)); -parcelHelpers.export(exports, "curveStepAfter", ()=>(0, _stepJs.stepAfter)); -parcelHelpers.export(exports, "curveStepBefore", ()=>(0, _stepJs.stepBefore)); -parcelHelpers.export(exports, "stack", ()=>(0, _stackJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetExpand", ()=>(0, _expandJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetNone", ()=>(0, _noneJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetSilhouette", ()=>(0, _silhouetteJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetWiggle", ()=>(0, _wiggleJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAppearance", ()=>(0, _appearanceJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAscending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderDescending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderInsideOut", ()=>(0, _insideOutJsDefault.default)); -parcelHelpers.export(exports, "stackOrderNone", ()=>(0, _noneJsDefault1.default)); -parcelHelpers.export(exports, "stackOrderReverse", ()=>(0, _reverseJsDefault.default)); -var _arcJs = require("./arc.js"); -var _arcJsDefault = parcelHelpers.interopDefault(_arcJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pieJs = require("./pie.js"); -var _pieJsDefault = parcelHelpers.interopDefault(_pieJs); -var _areaRadialJs = require("./areaRadial.js"); -var _areaRadialJsDefault = parcelHelpers.interopDefault(_areaRadialJs); -var _lineRadialJs = require("./lineRadial.js"); -var _lineRadialJsDefault = parcelHelpers.interopDefault(_lineRadialJs); -var _pointRadialJs = require("./pointRadial.js"); -var _pointRadialJsDefault = parcelHelpers.interopDefault(_pointRadialJs); -var _linkJs = require("./link.js"); -var _symbolJs = require("./symbol.js"); -var _symbolJsDefault = parcelHelpers.interopDefault(_symbolJs); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _basisClosedJs = require("./curve/basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _basisOpenJs = require("./curve/basisOpen.js"); -var _basisOpenJsDefault = parcelHelpers.interopDefault(_basisOpenJs); -var _basisJs = require("./curve/basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _bumpJs = require("./curve/bump.js"); -var _bundleJs = require("./curve/bundle.js"); -var _bundleJsDefault = parcelHelpers.interopDefault(_bundleJs); -var _cardinalClosedJs = require("./curve/cardinalClosed.js"); -var _cardinalClosedJsDefault = parcelHelpers.interopDefault(_cardinalClosedJs); -var _cardinalOpenJs = require("./curve/cardinalOpen.js"); -var _cardinalOpenJsDefault = parcelHelpers.interopDefault(_cardinalOpenJs); -var _cardinalJs = require("./curve/cardinal.js"); -var _cardinalJsDefault = parcelHelpers.interopDefault(_cardinalJs); -var _catmullRomClosedJs = require("./curve/catmullRomClosed.js"); -var _catmullRomClosedJsDefault = parcelHelpers.interopDefault(_catmullRomClosedJs); -var _catmullRomOpenJs = require("./curve/catmullRomOpen.js"); -var _catmullRomOpenJsDefault = parcelHelpers.interopDefault(_catmullRomOpenJs); -var _catmullRomJs = require("./curve/catmullRom.js"); -var _catmullRomJsDefault = parcelHelpers.interopDefault(_catmullRomJs); -var _linearClosedJs = require("./curve/linearClosed.js"); -var _linearClosedJsDefault = parcelHelpers.interopDefault(_linearClosedJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _monotoneJs = require("./curve/monotone.js"); -var _naturalJs = require("./curve/natural.js"); -var _naturalJsDefault = parcelHelpers.interopDefault(_naturalJs); -var _stepJs = require("./curve/step.js"); -var _stepJsDefault = parcelHelpers.interopDefault(_stepJs); -var _stackJs = require("./stack.js"); -var _stackJsDefault = parcelHelpers.interopDefault(_stackJs); -var _expandJs = require("./offset/expand.js"); -var _expandJsDefault = parcelHelpers.interopDefault(_expandJs); -var _divergingJs = require("./offset/diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _noneJs = require("./offset/none.js"); -var _noneJsDefault = parcelHelpers.interopDefault(_noneJs); -var _silhouetteJs = require("./offset/silhouette.js"); -var _silhouetteJsDefault = parcelHelpers.interopDefault(_silhouetteJs); -var _wiggleJs = require("./offset/wiggle.js"); -var _wiggleJsDefault = parcelHelpers.interopDefault(_wiggleJs); -var _appearanceJs = require("./order/appearance.js"); -var _appearanceJsDefault = parcelHelpers.interopDefault(_appearanceJs); -var _ascendingJs = require("./order/ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./order/descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _insideOutJs = require("./order/insideOut.js"); -var _insideOutJsDefault = parcelHelpers.interopDefault(_insideOutJs); -var _noneJs1 = require("./order/none.js"); -var _noneJsDefault1 = parcelHelpers.interopDefault(_noneJs1); -var _reverseJs = require("./order/reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); - -},{"./arc.js":"c3ptb","./area.js":"lblzF","./line.js":"jVTJi","./pie.js":false,"./areaRadial.js":false,"./lineRadial.js":false,"./pointRadial.js":false,"./link.js":false,"./symbol.js":"bcejp","./symbol/asterisk.js":false,"./symbol/circle.js":false,"./symbol/cross.js":false,"./symbol/diamond.js":false,"./symbol/diamond2.js":false,"./symbol/plus.js":false,"./symbol/square.js":false,"./symbol/square2.js":false,"./symbol/star.js":false,"./symbol/triangle.js":false,"./symbol/triangle2.js":false,"./symbol/wye.js":false,"./symbol/times.js":false,"./curve/basisClosed.js":"3uf9r","./curve/basisOpen.js":"4LPKP","./curve/basis.js":"gNfFM","./curve/bump.js":false,"./curve/bundle.js":"7Gw48","./curve/cardinalClosed.js":"e0Ty2","./curve/cardinalOpen.js":"4cTvH","./curve/cardinal.js":"i0afA","./curve/catmullRomClosed.js":"kfNnJ","./curve/catmullRomOpen.js":"amodp","./curve/catmullRom.js":"8d6GP","./curve/linearClosed.js":"gpcM0","./curve/linear.js":"huz8f","./curve/monotone.js":"kghkb","./curve/natural.js":"4f94Q","./curve/step.js":"l5kmS","./stack.js":false,"./offset/expand.js":false,"./offset/diverging.js":false,"./offset/none.js":false,"./offset/silhouette.js":false,"./offset/wiggle.js":false,"./order/appearance.js":false,"./order/ascending.js":false,"./order/descending.js":false,"./order/insideOut.js":false,"./order/none.js":false,"./order/reverse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c3ptb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = (0, _constantJsDefault.default)(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = (0, _pathJs.withPath)(arc); - function arc() { - var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - (0, _mathJs.halfPi), a1 = endAngle.apply(this, arguments) - (0, _mathJs.halfPi), da = (0, _mathJs.abs)(a1 - a0), cw = a1 > a0; - if (!context) context = buffer = path(); - // Ensure that the outer radius is always larger than the inner radius. - if (r1 < r0) r = r1, r1 = r0, r0 = r; - // Is it a point? - if (!(r1 > (0, _mathJs.epsilon))) context.moveTo(0, 0); - else if (da > (0, _mathJs.tau) - (0, _mathJs.epsilon)) { - context.moveTo(r1 * (0, _mathJs.cos)(a0), r1 * (0, _mathJs.sin)(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > (0, _mathJs.epsilon)) { - context.moveTo(r0 * (0, _mathJs.cos)(a1), r0 * (0, _mathJs.sin)(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } else { - var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > (0, _mathJs.epsilon) && (padRadius ? +padRadius.apply(this, arguments) : (0, _mathJs.sqrt)(r0 * r0 + r1 * r1)), rc = (0, _mathJs.min)((0, _mathJs.abs)(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; - // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - if (rp > (0, _mathJs.epsilon)) { - var p0 = (0, _mathJs.asin)(rp / r0 * (0, _mathJs.sin)(ap)), p1 = (0, _mathJs.asin)(rp / r1 * (0, _mathJs.sin)(ap)); - if ((da0 -= p0 * 2) > (0, _mathJs.epsilon)) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; - else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > (0, _mathJs.epsilon)) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; - else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - var x01 = r1 * (0, _mathJs.cos)(a01), y01 = r1 * (0, _mathJs.sin)(a01), x10 = r0 * (0, _mathJs.cos)(a10), y10 = r0 * (0, _mathJs.sin)(a10); - // Apply rounded corners? - if (rc > (0, _mathJs.epsilon)) { - var x11 = r1 * (0, _mathJs.cos)(a11), y11 = r1 * (0, _mathJs.sin)(a11), x00 = r0 * (0, _mathJs.cos)(a00), y00 = r0 * (0, _mathJs.sin)(a00), oc; - // Restrict the corner radius according to the sector angle. If this - // intersection fails, it’s probably because the arc is too small, so - // disable the corner radius entirely. - if (da < (0, _mathJs.pi)) { - if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) { - var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / (0, _mathJs.sin)((0, _mathJs.acos)((ax * bx + ay * by) / ((0, _mathJs.sqrt)(ax * ax + ay * ay) * (0, _mathJs.sqrt)(bx * bx + by * by))) / 2), lc = (0, _mathJs.sqrt)(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = (0, _mathJs.min)(rc, (r0 - lc) / (kc - 1)); - rc1 = (0, _mathJs.min)(rc, (r1 - lc) / (kc + 1)); - } else rc0 = rc1 = 0; - } - } - // Is the sector collapsed to a line? - if (!(da1 > (0, _mathJs.epsilon))) context.moveTo(x01, y01); - else if (rc1 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); - context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); - // Is there no inner ring, and it’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - if (!(r0 > (0, _mathJs.epsilon)) || !(da0 > (0, _mathJs.epsilon))) context.lineTo(x10, y10); - else if (rc0 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); - context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.arc(0, 0, r0, a10, a00, cw); - } - context.closePath(); - if (buffer) return context = null, buffer + "" || null; - } - arc.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - (0, _mathJs.pi) / 2; - return [ - (0, _mathJs.cos)(a) * r, - (0, _mathJs.sin)(a) * r - ]; - }; - arc.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : innerRadius; - }; - arc.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : outerRadius; - }; - arc.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : cornerRadius; - }; - arc.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padRadius; - }; - arc.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : startAngle; - }; - arc.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : endAngle; - }; - arc.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padAngle; - }; - arc.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, arc) : context; - }; - return arc; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _pathJs = require("./path.js"); -function arcInnerRadius(d) { - return d.innerRadius; -} -function arcOuterRadius(d) { - return d.outerRadius; -} -function arcStartAngle(d) { - return d.startAngle; -} -function arcEndAngle(d) { - return d.endAngle; -} -function arcPadAngle(d) { - return d && d.padAngle; // Note: optional! -} -function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { - var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; - if (t * t < (0, _mathJs.epsilon)) return; - t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; - return [ - x0 + t * x10, - y0 + t * y10 - ]; -} -// Compute perpendicular offset line of length rc. -// http://mathworld.wolfram.com/Circle-LineIntersection.html -function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { - var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / (0, _mathJs.sqrt)(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * (0, _mathJs.sqrt)((0, _mathJs.max)(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; - // Pick the closer of the two intersection points. - // TODO Is there a faster way to determine which intersection to use? - if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; - return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; -} - -},{"./constant.js":"12DQf","./math.js":"OHDSf","./path.js":"iSEDK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"12DQf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function constant() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"OHDSf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -const abs = Math.abs; -const atan2 = Math.atan2; -const cos = Math.cos; -const max = Math.max; -const min = Math.min; -const sin = Math.sin; -const sqrt = Math.sqrt; -const epsilon = 1e-12; -const pi = Math.PI; -const halfPi = pi / 2; -const tau = 2 * pi; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iSEDK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "withPath", ()=>withPath); -var _d3Path = require("d3-path"); -function withPath(shape) { - let digits = 3; - shape.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - return shape; - }; - return ()=>new (0, _d3Path.Path)(digits); -} - -},{"d3-path":"cRa94","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cRa94":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>(0, _pathJs.Path)); -parcelHelpers.export(exports, "path", ()=>(0, _pathJs.path)); -parcelHelpers.export(exports, "pathRound", ()=>(0, _pathJs.pathRound)); -var _pathJs = require("./path.js"); - -},{"./path.js":"6vvkL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6vvkL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>Path); -parcelHelpers.export(exports, "path", ()=>path); -parcelHelpers.export(exports, "pathRound", ()=>pathRound); -const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon; -function append(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - let d = Math.floor(digits); - if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`); - if (d > 15) return append; - const k = 10 ** d; - return function(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; + area2.x = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$3(+_), x12 = null, area2) : x02; }; -} -class Path { - constructor(digits){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - this._append = digits == null ? append : appendRound(digits); - } - moveTo(x, y) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._append`Z`; - } - } - lineTo(x, y) { - this._append`L${this._x1 = +x},${this._y1 = +y}`; - } - quadraticCurveTo(x1, y1, x, y) { - this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`; - } - bezierCurveTo(x1, y1, x2, y2, x, y) { - this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`; - } - arcTo(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; - // Is this path empty? Move to (x1,y1). - if (this._x1 === null) this._append`M${this._x1 = x1},${this._y1 = y1}`; - else if (!(l01_2 > epsilon)) ; - else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._append`L${this._x1 = x1},${this._y1 = y1}`; - else { - let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; - // If the start tangent is not coincident with (x0,y0), line to. - if (Math.abs(t01 - 1) > epsilon) this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`; - this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`; - } - } - arc(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; - // Is this path empty? Move to (x0,y0). - if (this._x1 === null) this._append`M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._append`L${x0},${y0}`; - // Is this arc empty? We’re done. - if (!r) return; - // Does the angle go the wrong way? Flip the direction. - if (da < 0) da = da % tau + tau; - // Is this a complete circle? Draw two arcs to complete the circle. - if (da > tauEpsilon) this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`; - else if (da > epsilon) this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`; - } - rect(x, y, w, h) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`; + area2.x0 = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$3(+_), area2) : x02; + }; + area2.x1 = function(_) { + return arguments.length ? (x12 = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), area2) : x12; + }; + area2.y = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$3(+_), y12 = null, area2) : y02; + }; + area2.y0 = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$3(+_), area2) : y02; + }; + area2.y1 = function(_) { + return arguments.length ? (y12 = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), area2) : y12; + }; + area2.lineX0 = area2.lineY0 = function() { + return arealine().x(x02).y(y02); + }; + area2.lineY1 = function() { + return arealine().x(x02).y(y12); + }; + area2.lineX1 = function() { + return arealine().x(x12).y(y02); + }; + area2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$3(!!_), area2) : defined; + }; + area2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), area2) : curve2; + }; + area2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), area2) : context2; + }; + return area2; + } + const circle = { + draw(context2, size2) { + const r = sqrt$3(size2 / pi$3); + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, tau$3); } - toString() { - return this._; - } -} -function path() { - return new Path; -} -// Allow instanceof d3.path -path.prototype = Path.prototype; -function pathRound(digits = 3) { - return new Path(+digits); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lblzF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x0, y0, y1) { - var x1 = null, defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(area); - x0 = typeof x0 === "function" ? x0 : x0 === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(+x0); - y0 = typeof y0 === "function" ? y0 : y0 === undefined ? (0, _constantJsDefault.default)(0) : (0, _constantJsDefault.default)(+y0); - y1 = typeof y1 === "function" ? y1 : y1 === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(+y1); - function area(data) { - var i, j, k, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for(k = i - 1; k >= j; --k)output.point(x0z[k], y0z[k]); - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - if (buffer) return output = null, buffer + "" || null; - } - function arealine() { - return (0, _lineJsDefault.default)().defined(defined).curve(curve).context(context); - } - area.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), x1 = null, area) : x0; - }; - area.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x0; - }; - area.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x1; - }; - area.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), y1 = null, area) : y0; - }; - area.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y0; - }; - area.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y1; - }; - area.lineX0 = area.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - area.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - area.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - area.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), area) : defined; - }; - area.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - area.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - return area; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"gwBAX","./constant.js":"12DQf","./curve/linear.js":"huz8f","./line.js":"jVTJi","./path.js":"iSEDK","./point.js":"1IQGj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gwBAX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -var slice = Array.prototype.slice; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"huz8f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Linear(context); - }); -function Linear(context) { - this._context = context; -} -Linear.prototype = { + }; + function Symbol$1(type2, size2) { + let context2 = null, path2 = withPath(symbol2); + type2 = typeof type2 === "function" ? type2 : constant$3(type2 || circle); + size2 = typeof size2 === "function" ? size2 : constant$3(size2 === void 0 ? 64 : +size2); + function symbol2() { + let buffer; + if (!context2) context2 = buffer = path2(); + type2.apply(this, arguments).draw(context2, +size2.apply(this, arguments)); + if (buffer) return context2 = null, buffer + "" || null; + } + symbol2.type = function(_) { + return arguments.length ? (type2 = typeof _ === "function" ? _ : constant$3(_), symbol2) : type2; + }; + symbol2.size = function(_) { + return arguments.length ? (size2 = typeof _ === "function" ? _ : constant$3(+_), symbol2) : size2; + }; + symbol2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, symbol2) : context2; + }; + return symbol2; + } + function noop$3() { + } + function point$5(that, x2, y2) { + that._context.bezierCurveTo( + (2 * that._x0 + that._x1) / 3, + (2 * that._y0 + that._y1) / 3, + (that._x0 + 2 * that._x1) / 3, + (that._y0 + 2 * that._y1) / 3, + (that._x0 + 4 * that._x1 + x2) / 6, + (that._y0 + 4 * that._y1 + y2) / 6 + ); + } + function Basis(context2) { + this._context = context2; + } + Basis.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._point = 0; + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; }, lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + switch (this._point) { + case 3: + point$5(this, this._x1, this._y1); + // falls through + case 2: + this._context.lineTo(this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - this._context.lineTo(x, y); - break; - } + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jVTJi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(line); - x = typeof x === "function" ? x : x === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(x); - y = typeof y === "function" ? y : y === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(y); - function line(data) { - var i, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer; - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart(); - else output.lineEnd(); - } - if (defined0) output.point(+x(d, i, data), +y(d, i, data)); - } - if (buffer) return output = null, buffer + "" || null; - } - line.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : x; - }; - line.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : y; - }; - line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), line) : defined; - }; - line.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - line.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - return line; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"gwBAX","./constant.js":"12DQf","./curve/linear.js":"huz8f","./path.js":"iSEDK","./point.js":"1IQGj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1IQGj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -function x(p) { - return p[0]; -} -function y(p) { - return p[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bcejp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symbolsFill", ()=>symbolsFill); -parcelHelpers.export(exports, "symbolsStroke", ()=>symbolsStroke); -parcelHelpers.export(exports, "default", ()=>Symbol); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _pathJs = require("./path.js"); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -const symbolsFill = [ - (0, _circleJsDefault.default), - (0, _crossJsDefault.default), - (0, _diamondJsDefault.default), - (0, _squareJsDefault.default), - (0, _starJsDefault.default), - (0, _triangleJsDefault.default), - (0, _wyeJsDefault.default) -]; -const symbolsStroke = [ - (0, _circleJsDefault.default), - (0, _plusJsDefault.default), - (0, _timesJsDefault.default), - (0, _triangle2JsDefault.default), - (0, _asteriskJsDefault.default), - (0, _square2JsDefault.default), - (0, _diamond2JsDefault.default) -]; -function Symbol(type, size) { - let context = null, path = (0, _pathJs.withPath)(symbol); - type = typeof type === "function" ? type : (0, _constantJsDefault.default)(type || (0, _circleJsDefault.default)); - size = typeof size === "function" ? size : (0, _constantJsDefault.default)(size === undefined ? 64 : +size); - function symbol() { - let buffer; - if (!context) context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), symbol) : type; - }; - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), symbol) : size; - }; - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - return symbol; -} - -},{"./constant.js":"12DQf","./path.js":"iSEDK","./symbol/asterisk.js":"kHR3A","./symbol/circle.js":"7RXTA","./symbol/cross.js":"4cmA2","./symbol/diamond.js":"1gK3j","./symbol/diamond2.js":"WsFhi","./symbol/plus.js":"a9FVq","./symbol/square.js":"fXRAH","./symbol/square2.js":"69bxi","./symbol/star.js":"8nJiq","./symbol/triangle.js":"bClaq","./symbol/triangle2.js":"8s1uD","./symbol/wye.js":"2D9bg","./symbol/times.js":"h0Zst","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kHR3A":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size + (0, _mathJs.min)(size / 28, 0.75)) * 0.59436; - const t = r / 2; - const u = t * sqrt3; - context.moveTo(0, r); - context.lineTo(0, -r); - context.moveTo(-u, -t); - context.lineTo(u, t); - context.moveTo(-u, t); - context.lineTo(u, -t); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7RXTA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / (0, _mathJs.pi)); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, (0, _mathJs.tau)); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4cmA2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / 5) / 2; - context.moveTo(-3 * r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, -3 * r); - context.lineTo(r, -3 * r); - context.lineTo(r, -r); - context.lineTo(3 * r, -r); - context.lineTo(3 * r, r); - context.lineTo(r, r); - context.lineTo(r, 3 * r); - context.lineTo(-r, 3 * r); - context.lineTo(-r, r); - context.lineTo(-3 * r, r); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1gK3j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const tan30 = (0, _mathJs.sqrt)(1 / 3); -const tan30_2 = tan30 * 2; -exports.default = { - draw (context, size) { - const y = (0, _mathJs.sqrt)(size / tan30_2); - const x = y * tan30; - context.moveTo(0, -y); - context.lineTo(x, 0); - context.lineTo(0, y); - context.lineTo(-x, 0); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"WsFhi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.62625; - context.moveTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.lineTo(-r, 0); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a9FVq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 7, 2)) * 0.87559; - context.moveTo(-r, 0); - context.lineTo(r, 0); - context.moveTo(0, r); - context.lineTo(0, -r); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fXRAH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const w = (0, _mathJs.sqrt)(size); - const x = -w / 2; - context.rect(x, x, w, w); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"69bxi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.4431; - context.moveTo(r, r); - context.lineTo(r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, r); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8nJiq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const ka = 0.89081309152928522810; -const kr = (0, _mathJs.sin)((0, _mathJs.pi) / 10) / (0, _mathJs.sin)(7 * (0, _mathJs.pi) / 10); -const kx = (0, _mathJs.sin)((0, _mathJs.tau) / 10) * kr; -const ky = -(0, _mathJs.cos)((0, _mathJs.tau) / 10) * kr; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size * ka); - const x = kx * r; - const y = ky * r; - context.moveTo(0, -r); - context.lineTo(x, y); - for(let i = 1; i < 5; ++i){ - const a = (0, _mathJs.tau) * i / 5; - const c = (0, _mathJs.cos)(a); - const s = (0, _mathJs.sin)(a); - context.lineTo(s * r, -c * r); - context.lineTo(c * x - s * y, s * x + c * y); - } - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bClaq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const y = -(0, _mathJs.sqrt)(size / (sqrt3 * 3)); - context.moveTo(0, y * 2); - context.lineTo(-sqrt3 * y, -y); - context.lineTo(sqrt3 * y, -y); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8s1uD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const s = (0, _mathJs.sqrt)(size) * 0.6824; - const t = s / 2; - const u = s * sqrt3 / 2; // cos(Math.PI / 6) - context.moveTo(0, -s); - context.lineTo(u, t); - context.lineTo(-u, t); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2D9bg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const c = -0.5; -const s = (0, _mathJs.sqrt)(3) / 2; -const k = 1 / (0, _mathJs.sqrt)(12); -const a = (k / 2 + 1) * 3; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / a); - const x0 = r / 2, y0 = r * k; - const x1 = x0, y1 = r * k + r; - const x2 = -x1, y2 = y1; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.lineTo(c * x0 - s * y0, s * x0 + c * y0); - context.lineTo(c * x1 - s * y1, s * x1 + c * y1); - context.lineTo(c * x2 - s * y2, s * x2 + c * y2); - context.lineTo(c * x0 + s * y0, c * y0 - s * x0); - context.lineTo(c * x1 + s * y1, c * y1 - s * x1); - context.lineTo(c * x2 + s * y2, c * y2 - s * x2); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h0Zst":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 6, 1.7)) * 0.6189; - context.moveTo(-r, -r); - context.lineTo(r, r); - context.moveTo(-r, r); - context.lineTo(r, -r); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3uf9r":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _basisJs = require("./basis.js"); -function BasisClosed(context) { - this._context = context; -} -BasisClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), + }; + function curveBasis(context2) { + return new Basis(context2); + } + function BasisClosed(context2) { + this._context = context2; + } + BasisClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 0; + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x2, this._y2); - this._context.closePath(); - break; - case 2: - this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); - this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); - this._context.closePath(); - break; - case 3: - this.point(this._x2, this._y2); - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - break; + switch (this._point) { + case 1: { + this._context.moveTo(this._x2, this._y2); + this._context.closePath(); + break; + } + case 2: { + this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); + this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x2, this._y2); + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + break; } + } }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x2 = x, this._y2 = y; - break; - case 1: - this._point = 2; - this._x3 = x, this._y3 = y; - break; - case 2: - this._point = 3; - this._x4 = x, this._y4 = y; - this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); - break; - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"../noop.js":"9n7oj","./basis.js":"gNfFM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9n7oj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() {}); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gNfFM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Basis", ()=>Basis); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Basis(context); - }); -function point(that, x, y) { - that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6); -} -function Basis(context) { - this._context = context; -} -Basis.prototype = { + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x2 = x2, this._y2 = y2; + break; + case 1: + this._point = 2; + this._x3 = x2, this._y3 = y2; + break; + case 2: + this._point = 3; + this._x4 = x2, this._y4 = y2; + this._context.moveTo((this._x0 + 4 * this._x1 + x2) / 6, (this._y0 + 4 * this._y1 + y2) / 6); + break; + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + } + }; + function curveBasisClosed(context2) { + return new BasisClosed(context2); + } + function BasisOpen(context2) { + this._context = context2; + } + BasisOpen.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 3: - point(this, this._x1, this._y1); // falls through - case 2: - this._context.lineTo(this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through - default: - point(this, x, y); - break; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + var x02 = (this._x0 + 4 * this._x1 + x2) / 6, y02 = (this._y0 + 4 * this._y1 + y2) / 6; + this._line ? this._context.lineTo(x02, y02) : this._context.moveTo(x02, y02); + break; + case 3: + this._point = 4; + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + } + }; + function curveBasisOpen(context2) { + return new BasisOpen(context2); + } + function Bundle(context2, beta) { + this._basis = new Basis(context2); + this._beta = beta; + } + Bundle.prototype = { + lineStart: function() { + this._x = []; + this._y = []; + this._basis.lineStart(); + }, + lineEnd: function() { + var x2 = this._x, y2 = this._y, j = x2.length - 1; + if (j > 0) { + var x02 = x2[0], y02 = y2[0], dx = x2[j] - x02, dy = y2[j] - y02, i = -1, t; + while (++i <= j) { + t = i / j; + this._basis.point( + this._beta * x2[i] + (1 - this._beta) * (x02 + t * dx), + this._beta * y2[i] + (1 - this._beta) * (y02 + t * dy) + ); } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; + } + this._x = this._y = null; + this._basis.lineEnd(); + }, + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4LPKP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisOpen(context); - }); -var _basisJs = require("./basis.js"); -function BasisOpen(context) { - this._context = context; -} -BasisOpen.prototype = { + }; + const curveBundle = (function custom2(beta) { + function bundle2(context2) { + return beta === 1 ? new Basis(context2) : new Bundle(context2, beta); + } + bundle2.beta = function(beta2) { + return custom2(+beta2); + }; + return bundle2; + })(0.85); + function point$4(that, x2, y2) { + that._context.bezierCurveTo( + that._x1 + that._k * (that._x2 - that._x0), + that._y1 + that._k * (that._y2 - that._y0), + that._x2 + that._k * (that._x1 - x2), + that._y2 + that._k * (that._y1 - y2), + that._x2, + that._y2 + ); + } + function Cardinal(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + Cardinal.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; }, lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + point$4(this, this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; - this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); - break; - case 3: - this._point = 4; // falls through - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"./basis.js":"gNfFM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Gw48":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _basisJs = require("./basis.js"); -function Bundle(context, beta) { - this._basis = new (0, _basisJs.Basis)(context); - this._beta = beta; -} -Bundle.prototype = { + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + this._x1 = x2, this._y1 = y2; + break; + case 2: + this._point = 3; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; + } + }; + const curveCardinal = (function custom2(tension) { + function cardinal(context2) { + return new Cardinal(context2, tension); + } + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function CardinalClosed(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + CardinalClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._point = 0; }, lineEnd: function() { - var x = this._x, y = this._y, j = x.length - 1; - if (j > 0) { - var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t; - while(++i <= j){ - t = i / j; - this._basis.point(this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)); - } + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; } - this._x = this._y = null; - this._basis.lineEnd(); + } }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -exports.default = function custom(beta) { - function bundle(context) { - return beta === 1 ? new (0, _basisJs.Basis)(context) : new Bundle(context, beta); - } - bundle.beta = function(beta) { - return custom(+beta); - }; - return bundle; -}(0.85); - -},{"./basis.js":"gNfFM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0Ty2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalClosed", ()=>CardinalClosed); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _cardinalJs = require("./cardinal.js"); -function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _cardinalJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalClosed(context, tension); + }; + const curveCardinalClosed = (function custom2(tension) { + function cardinal(context2) { + return new CardinalClosed(context2, tension); } - cardinal.tension = function(tension) { - return custom(+tension); + cardinal.tension = function(tension2) { + return custom2(+tension2); }; return cardinal; -}(0); - -},{"../noop.js":"9n7oj","./cardinal.js":"i0afA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i0afA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Cardinal", ()=>Cardinal); -function point(that, x, y) { - that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2); -} -function Cardinal(context, tension) { - this._context = context; + })(0); + function CardinalOpen(context2, tension) { + this._context = context2; this._k = (1 - tension) / 6; -} -Cardinal.prototype = { + } + CardinalOpen.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - point(this, this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - this._x1 = x, this._y1 = y; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new Cardinal(context, tension); + }; + const curveCardinalOpen = (function custom2(tension) { + function cardinal(context2) { + return new CardinalOpen(context2, tension); } - cardinal.tension = function(tension) { - return custom(+tension); + cardinal.tension = function(tension2) { + return custom2(+tension2); }; return cardinal; -}(0); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4cTvH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalOpen", ()=>CardinalOpen); -var _cardinalJs = require("./cardinal.js"); -function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalOpen.prototype = { + })(0); + function point$3(that, x2, y2) { + var x12 = that._x1, y12 = that._y1, x22 = that._x2, y22 = that._y2; + if (that._l01_a > epsilon$5) { + var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); + x12 = (x12 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; + y12 = (y12 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; + } + if (that._l23_a > epsilon$5) { + var b2 = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m2 = 3 * that._l23_a * (that._l23_a + that._l12_a); + x22 = (x22 * b2 + that._x1 * that._l23_2a - x2 * that._l12_2a) / m2; + y22 = (y22 * b2 + that._y1 * that._l23_2a - y2 * that._l12_2a) / m2; + } + that._context.bezierCurveTo(x12, y12, x22, y22, that._x2, that._y2); + } + function CatmullRom(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRom.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; + this._line = NaN; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _cardinalJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalOpen(context, tension); - } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"./cardinal.js":"i0afA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kfNnJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalClosedJs = require("./cardinalClosed.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + this.point(this._x2, this._y2); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + // falls through + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new (0, _cardinalClosedJs.CardinalClosed)(context, 0); + }; + const curveCatmullRom = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRom(context2, alpha) : new Cardinal(context2, 0); } - catmullRom.alpha = function(alpha) { - return custom(+alpha); + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); }; return catmullRom; -}(0.5); - -},{"./cardinalClosed.js":"e0Ty2","../noop.js":"9n7oj","./catmullRom.js":"8d6GP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8d6GP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -var _mathJs = require("../math.js"); -var _cardinalJs = require("./cardinal.js"); -function point(that, x, y) { - var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2; - if (that._l01_a > (0, _mathJs.epsilon)) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - if (that._l23_a > (0, _mathJs.epsilon)) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; - } - that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); -} -function CatmullRom(context, alpha) { - this._context = context; + })(0.5); + function CatmullRomClosed(context2, alpha) { + this._context = context2; this._alpha = alpha; -} -CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, + } + CatmullRomClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - this.point(this._x2, this._y2); - break; + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + } }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new (0, _cardinalJs.Cardinal)(context, 0); + }; + const curveCatmullRomClosed = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomClosed(context2, alpha) : new CardinalClosed(context2, 0); } - catmullRom.alpha = function(alpha) { - return custom(+alpha); + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); }; return catmullRom; -}(0.5); - -},{"../math.js":"OHDSf","./cardinal.js":"i0afA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"amodp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalOpenJs = require("./cardinalOpen.js"); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomOpen(context, alpha) { - this._context = context; + })(0.5); + function CatmullRomOpen(context2, alpha) { + this._context = context2; this._alpha = alpha; -} -CatmullRomOpen.prototype = { + } + CatmullRomOpen.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new (0, _cardinalOpenJs.CardinalOpen)(context, 0); + }; + const curveCatmullRomOpen = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomOpen(context2, alpha) : new CardinalOpen(context2, 0); } - catmullRom.alpha = function(alpha) { - return custom(+alpha); + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); }; return catmullRom; -}(0.5); - -},{"./cardinalOpen.js":"4cTvH","./catmullRom.js":"8d6GP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gpcM0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new LinearClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function LinearClosed(context) { - this._context = context; -} -LinearClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), + })(0.5); + function LinearClosed(context2) { + this._context = context2; + } + LinearClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, lineStart: function() { - this._point = 0; + this._point = 0; }, lineEnd: function() { - if (this._point) this._context.closePath(); + if (this._point) this._context.closePath(); }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y); - else this._point = 1, this._context.moveTo(x, y); - } -}; - -},{"../noop.js":"9n7oj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kghkb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "monotoneX", ()=>monotoneX); -parcelHelpers.export(exports, "monotoneY", ()=>monotoneY); -function sign(x) { - return x < 0 ? -1 : 1; -} -// Calculate the slopes of the tangents (Hermite-type interpolation) based on -// the following paper: Steffen, M. 1990. A Simple Method for Monotonic -// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. -// NOV(II), P. 443, 1990. -function slope3(that, x2, y2) { + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) this._context.lineTo(x2, y2); + else this._point = 1, this._context.moveTo(x2, y2); + } + }; + function curveLinearClosed(context2) { + return new LinearClosed(context2); + } + function sign$1(x2) { + return x2 < 0 ? -1 : 1; + } + function slope3(that, x2, y2) { var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; -} -// Calculate a one-sided slope. -function slope2(that, t) { - var h = that._x1 - that._x0; - return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; -} -// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations -// "you can express cubic Hermite interpolation in terms of cubic Bézier curves -// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". -function point(that, t0, t1) { - var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); -} -function MonotoneX(context) { - this._context = context; -} -MonotoneX.prototype = { + return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; + } + function slope2(that, t) { + var h2 = that._x1 - that._x0; + return h2 ? (3 * (that._y1 - that._y0) / h2 - t) / 2 : t; + } + function point$2(that, t02, t12) { + var x02 = that._x0, y02 = that._y0, x12 = that._x1, y12 = that._y1, dx = (x12 - x02) / 3; + that._context.bezierCurveTo(x02 + dx, y02 + dx * t02, x12 - dx, y12 - dx * t12, x12, y12); + } + function MonotoneX(context2) { + this._context = context2; + } + MonotoneX.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; - this._point = 0; + this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x1, this._y1); - break; - case 3: - point(this, this._t0, slope2(this, this._t0)); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - var t1 = NaN; - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - point(this, slope2(this, t1 = slope3(this, x, y)), t1); - break; - default: - point(this, this._t0, t1 = slope3(this, x, y)); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } -}; -function MonotoneY(context) { - this._context = new ReflectContext(context); -} -(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { - MonotoneX.prototype.point.call(this, y, x); -}; -function ReflectContext(context) { - this._context = context; -} -ReflectContext.prototype = { - moveTo: function(x, y) { - this._context.moveTo(y, x); + switch (this._point) { + case 2: + this._context.lineTo(this._x1, this._y1); + break; + case 3: + point$2(this, this._t0, slope2(this, this._t0)); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + var t12 = NaN; + x2 = +x2, y2 = +y2; + if (x2 === this._x1 && y2 === this._y1) return; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + point$2(this, slope2(this, t12 = slope3(this, x2, y2)), t12); + break; + default: + point$2(this, this._t0, t12 = slope3(this, x2, y2)); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + this._t0 = t12; + } + }; + function MonotoneY(context2) { + this._context = new ReflectContext(context2); + } + (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) { + MonotoneX.prototype.point.call(this, y2, x2); + }; + function ReflectContext(context2) { + this._context = context2; + } + ReflectContext.prototype = { + moveTo: function(x2, y2) { + this._context.moveTo(y2, x2); }, closePath: function() { - this._context.closePath(); + this._context.closePath(); }, - lineTo: function(x, y) { - this._context.lineTo(y, x); + lineTo: function(x2, y2) { + this._context.lineTo(y2, x2); }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._context.bezierCurveTo(y1, x1, y2, x2, y, x); - } -}; -function monotoneX(context) { - return new MonotoneX(context); -} -function monotoneY(context) { - return new MonotoneY(context); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4f94Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Natural(context); - }); -function Natural(context) { - this._context = context; -} -Natural.prototype = { + bezierCurveTo: function(x12, y12, x2, y2, x3, y3) { + this._context.bezierCurveTo(y12, x12, y2, x2, y3, x3); + } + }; + function monotoneX(context2) { + return new MonotoneX(context2); + } + function monotoneY(context2) { + return new MonotoneY(context2); + } + function Natural(context2) { + this._context = context2; + } + Natural.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x = []; - this._y = []; + this._x = []; + this._y = []; }, lineEnd: function() { - var x = this._x, y = this._y, n = x.length; - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - if (n === 2) this._context.lineTo(x[1], y[1]); - else { - var px = controlPoints(x), py = controlPoints(y); - for(var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1)this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); - } + var x2 = this._x, y2 = this._y, n = x2.length; + if (n) { + this._line ? this._context.lineTo(x2[0], y2[0]) : this._context.moveTo(x2[0], y2[0]); + if (n === 2) { + this._context.lineTo(x2[1], y2[1]); + } else { + var px2 = controlPoints(x2), py2 = controlPoints(y2); + for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { + this._context.bezierCurveTo(px2[0][i0], py2[0][i0], px2[1][i0], py2[1][i0], x2[i1], y2[i1]); + } } - if (this._line || this._line !== 0 && n === 1) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = null; + } + if (this._line || this._line !== 0 && n === 1) this._context.closePath(); + this._line = 1 - this._line; + this._x = this._y = null; }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -// See https://www.particleincell.com/2012/bezier-splines/ for derivation. -function controlPoints(x) { - var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - for(i = 1; i < n - 1; ++i)a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - for(i = 1; i < n; ++i)m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a[n - 1] = r[n - 1] / b[n - 1]; - for(i = n - 2; i >= 0; --i)a[i] = (r[i] - a[i + 1]) / b[i]; - b[n - 1] = (x[n] + a[n - 1]) / 2; - for(i = 0; i < n - 1; ++i)b[i] = 2 * x[i + 1] - a[i + 1]; - return [ - a, - b - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l5kmS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Step(context, 0.5); - }); -parcelHelpers.export(exports, "stepBefore", ()=>stepBefore); -parcelHelpers.export(exports, "stepAfter", ()=>stepAfter); -function Step(context, t) { - this._context = context; + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); + } + }; + function controlPoints(x2) { + var i, n = x2.length - 1, m2, a2 = new Array(n), b2 = new Array(n), r = new Array(n); + a2[0] = 0, b2[0] = 2, r[0] = x2[0] + 2 * x2[1]; + for (i = 1; i < n - 1; ++i) a2[i] = 1, b2[i] = 4, r[i] = 4 * x2[i] + 2 * x2[i + 1]; + a2[n - 1] = 2, b2[n - 1] = 7, r[n - 1] = 8 * x2[n - 1] + x2[n]; + for (i = 1; i < n; ++i) m2 = a2[i] / b2[i - 1], b2[i] -= m2, r[i] -= m2 * r[i - 1]; + a2[n - 1] = r[n - 1] / b2[n - 1]; + for (i = n - 2; i >= 0; --i) a2[i] = (r[i] - a2[i + 1]) / b2[i]; + b2[n - 1] = (x2[n] + a2[n - 1]) / 2; + for (i = 0; i < n - 1; ++i) b2[i] = 2 * x2[i + 1] - a2[i + 1]; + return [a2, b2]; + } + function curveNatural(context2) { + return new Natural(context2); + } + function Step(context2, t) { + this._context = context2; this._t = t; -} -Step.prototype = { + } + Step.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x = this._y = NaN; - this._point = 0; + this._x = this._y = NaN; + this._point = 0; }, lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; + if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - if (this._t <= 0) { - this._context.lineTo(this._x, y); - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y); - } - break; - } - this._x = x, this._y = y; - } -}; -function stepBefore(context) { - return new Step(context, 0); -} -function stepAfter(context) { - return new Step(context, 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kPWfS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "canvas", ()=>domCanvas); -parcelHelpers.export(exports, "domCanvas", ()=>domCanvas); -parcelHelpers.export(exports, "image", ()=>domImage); -function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - const c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: { + if (this._t <= 0) { + this._context.lineTo(this._x, y2); + this._context.lineTo(x2, y2); + } else { + var x12 = this._x * (1 - this._t) + x2 * this._t; + this._context.lineTo(x12, this._y); + this._context.lineTo(x12, y2); + } + break; } + } + this._x = x2, this._y = y2; } - return null; -} -const domImage = ()=>typeof Image !== 'undefined' ? Image : null; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bEydG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _d3Scale.scaleImplicit)); -parcelHelpers.export(exports, "Band", ()=>Band); -parcelHelpers.export(exports, "BinOrdinal", ()=>BinOrdinal); -parcelHelpers.export(exports, "DiscreteLegend", ()=>DiscreteLegend); -parcelHelpers.export(exports, "Diverging", ()=>Diverging); -parcelHelpers.export(exports, "GradientLegend", ()=>GradientLegend); -parcelHelpers.export(exports, "Identity", ()=>Identity); -parcelHelpers.export(exports, "Linear", ()=>Linear); -parcelHelpers.export(exports, "Log", ()=>Log); -parcelHelpers.export(exports, "Ordinal", ()=>Ordinal); -parcelHelpers.export(exports, "Point", ()=>Point); -parcelHelpers.export(exports, "Pow", ()=>Pow); -parcelHelpers.export(exports, "Quantile", ()=>Quantile); -parcelHelpers.export(exports, "Quantize", ()=>Quantize); -parcelHelpers.export(exports, "Sequential", ()=>Sequential); -parcelHelpers.export(exports, "Sqrt", ()=>Sqrt); -parcelHelpers.export(exports, "SymbolLegend", ()=>SymbolLegend); -parcelHelpers.export(exports, "Symlog", ()=>Symlog); -parcelHelpers.export(exports, "Threshold", ()=>Threshold); -parcelHelpers.export(exports, "Time", ()=>Time); -parcelHelpers.export(exports, "UTC", ()=>UTC); -parcelHelpers.export(exports, "bandSpace", ()=>bandSpace); -parcelHelpers.export(exports, "domainCaption", ()=>domainCaption); -parcelHelpers.export(exports, "interpolate", ()=>interpolate); -parcelHelpers.export(exports, "interpolateColors", ()=>interpolateColors); -parcelHelpers.export(exports, "interpolateRange", ()=>interpolateRange); -parcelHelpers.export(exports, "isContinuous", ()=>isContinuous); -parcelHelpers.export(exports, "isDiscrete", ()=>isDiscrete); -parcelHelpers.export(exports, "isDiscretizing", ()=>isDiscretizing); -parcelHelpers.export(exports, "isInterpolating", ()=>isInterpolating); -parcelHelpers.export(exports, "isLogarithmic", ()=>isLogarithmic); -parcelHelpers.export(exports, "isQuantile", ()=>isQuantile); -parcelHelpers.export(exports, "isRegisteredScale", ()=>isRegisteredScale); -parcelHelpers.export(exports, "isTemporal", ()=>isTemporal); -parcelHelpers.export(exports, "isValidScaleType", ()=>isValidScaleType); -parcelHelpers.export(exports, "labelFormat", ()=>labelFormat); -parcelHelpers.export(exports, "labelFraction", ()=>labelFraction); -parcelHelpers.export(exports, "labelValues", ()=>labelValues); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>quantizeInterpolator); -parcelHelpers.export(exports, "registerScale", ()=>registerScale); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleCopy", ()=>scaleCopy); -parcelHelpers.export(exports, "scaleFraction", ()=>scaleFraction); -parcelHelpers.export(exports, "scheme", ()=>scheme); -parcelHelpers.export(exports, "tickCount", ()=>tickCount); -parcelHelpers.export(exports, "tickFormat", ()=>tickFormat); -parcelHelpers.export(exports, "tickValues", ()=>tickValues); -parcelHelpers.export(exports, "validTicks", ()=>validTicks); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Scale = require("d3-scale"); -var _d3Interpolate = require("d3-interpolate"); -var _d3ScaleChromatic = require("d3-scale-chromatic"); -var _vegaTime = require("vega-time"); -function bandSpace(count, paddingInner, paddingOuter) { - const space = count - paddingInner + paddingOuter * 2; - return count ? space > 0 ? space : 1 : 0; -} -const Identity = 'identity'; -const Linear = 'linear'; -const Log = 'log'; -const Pow = 'pow'; -const Sqrt = 'sqrt'; -const Symlog = 'symlog'; -const Time = 'time'; -const UTC = 'utc'; -const Sequential = 'sequential'; -const Diverging = 'diverging'; -const Quantile = 'quantile'; -const Quantize = 'quantize'; -const Threshold = 'threshold'; -const Ordinal = 'ordinal'; -const Point = 'point'; -const Band = 'band'; -const BinOrdinal = 'bin-ordinal'; -// categories -const Continuous = 'continuous'; -const Discrete = 'discrete'; -const Discretizing = 'discretizing'; -const Interpolating = 'interpolating'; -const Temporal = 'temporal'; -function invertRange(scale) { - return function(_) { - let lo = _[0], hi = _[1], t; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; -} -function invertRangeExtent(scale) { - return function(_) { - const range = scale.range(); - let lo = _[0], hi = _[1], min = -1, max, t, i, n; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - for(i = 0, n = range.length; i < n; ++i)if (range[i] >= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - if (min < 0) return undefined; - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[1] - ]; - }; -} -function band() { - const scale = (0, _d3Scale.scaleOrdinal)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range; - let range$1 = [ - 0, - 1 - ], step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - const n = domain().length, reverse = range$1[1] < range$1[0], stop = range$1[1 - reverse], space = bandSpace(n, paddingInner, paddingOuter); - let start = range$1[reverse - 0]; - step = (stop - start) / (space || 1); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - const values = (0, _d3Array.range)(n).map((i)=>start + step * i); - return ordinalRange(reverse ? values.reverse() : values); - } - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else return domain(); - }; - scale.range = function(_) { - if (arguments.length) { - range$1 = [ - +_[0], - +_[1] - ]; - return rescale(); - } else return range$1.slice(); - }; - scale.rangeRound = function(_) { - range$1 = [ - +_[0], - +_[1] - ]; - round = true; - return rescale(); - }; - scale.bandwidth = function() { - return bandwidth; - }; - scale.step = function() { - return step; - }; - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else return round; - }; - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else return paddingInner; - }; - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingInner; - }; - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingOuter; - }; - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else return align; - }; - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - const reverse = range$1[1] < range$1[0], values = reverse ? ordinalRange().reverse() : ordinalRange(), n = values.length - 1; - let lo = +_[0], hi = +_[1], a, b, t; - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range$1[1 - reverse]) return; - // binary search to index into scale range - a = Math.max(0, (0, _d3Array.bisectRight)(values, lo) - 1); - b = lo === hi ? a : (0, _d3Array.bisectRight)(values, hi) - 1; - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return a > b ? undefined : domain().slice(a, b + 1); - }; - scale.invert = function(_) { - const value = scale.invertRange([ - _, - _ - ]); - return value ? value[0] : value; - }; - scale.copy = function() { - return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - return rescale(); -} -function pointish(scale) { - const copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band().paddingInner(1)); -} -var map = Array.prototype.map; -function numbers(_) { - return map.call(_, (0, _vegaUtil.toNumber)); -} -const slice = Array.prototype.slice; -function scaleBinOrdinal() { - let domain = [], range = []; - function scale(x) { - return x == null || x !== x ? undefined : range[((0, _d3Array.bisect)(domain, x) - 1) % range.length]; - } - scale.domain = function(_) { - if (arguments.length) { - domain = numbers(_); - return scale; - } else return domain.slice(); - }; - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else return range.slice(); - }; - scale.tickFormat = function(count, specifier) { - return (0, _d3Scale.tickFormat)(domain[0], (0, _vegaUtil.peek)(domain), count == null ? 10 : count, specifier); - }; - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - return scale; -} -/** Private scale registry: should not be exported */ const scales = new Map(); -const VEGA_SCALE = Symbol('vega_scale'); -function registerScale(scale) { - scale[VEGA_SCALE] = true; - return scale; -} -/** - * Return true if object was created by a constructor from the vega-scale `scale` function. - */ function isRegisteredScale(scale) { - return scale && scale[VEGA_SCALE] === true; -} -/** - * Augment scales with their type and needed inverse methods. - */ function create(type, constructor, metadata) { - const ctr = function scale() { - const s = constructor(); - if (!s.invertRange) s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined; - s.type = type; - return registerScale(s); - }; - ctr.metadata = (0, _vegaUtil.toSet)((0, _vegaUtil.array)(metadata)); - return ctr; -} -/** - * Registry function for adding and accessing scale constructor functions. - * The *type* argument is a String indicating the name of the scale type. - * - * If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found. - * If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name. - * The *metadata* argument provides additional information to guide appropriate use of scales within Vega. - * - * *metadata* can be either a string or string array. The valid string values are: - * - `"continuous"` - the scale is defined over a continuous-valued domain. - * - `"discrete"` - the scale is defined over a discrete domain and range. - * - `"discretizing"` - the scale discretizes a continuous domain to a discrete range. - * - `"interpolating"` - the scale range is defined using a color interpolator. - * - `"log"` - the scale performs a logarithmic transform of the continuous domain. - * - `"temporal"` - the scale domain is defined over date-time values. - */ function scale(type, scale, metadata) { - if (arguments.length > 1) { - scales.set(type, create(type, scale, metadata)); - return this; - } else return isValidScaleType(type) ? scales.get(type) : undefined; -} -// identity scale -scale(Identity, _d3Scale.scaleIdentity); -// continuous scales -scale(Linear, _d3Scale.scaleLinear, Continuous); -scale(Log, _d3Scale.scaleLog, [ - Continuous, - Log -]); -scale(Pow, _d3Scale.scalePow, Continuous); -scale(Sqrt, _d3Scale.scaleSqrt, Continuous); -scale(Symlog, _d3Scale.scaleSymlog, Continuous); -scale(Time, _d3Scale.scaleTime, [ - Continuous, - Temporal -]); -scale(UTC, _d3Scale.scaleUtc, [ - Continuous, - Temporal -]); -// sequential scales -scale(Sequential, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); // backwards compat -scale(`${Sequential}-${Linear}`, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Log}`, _d3Scale.scaleSequentialLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Sequential}-${Pow}`, _d3Scale.scaleSequentialPow, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Sqrt}`, _d3Scale.scaleSequentialSqrt, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Symlog}`, _d3Scale.scaleSequentialSymlog, [ - Continuous, - Interpolating -]); -// diverging scales -scale(`${Diverging}-${Linear}`, _d3Scale.scaleDiverging, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Log}`, _d3Scale.scaleDivergingLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Diverging}-${Pow}`, _d3Scale.scaleDivergingPow, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Sqrt}`, _d3Scale.scaleDivergingSqrt, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Symlog}`, _d3Scale.scaleDivergingSymlog, [ - Continuous, - Interpolating -]); -// discretizing scales -scale(Quantile, _d3Scale.scaleQuantile, [ - Discretizing, - Quantile -]); -scale(Quantize, _d3Scale.scaleQuantize, Discretizing); -scale(Threshold, _d3Scale.scaleThreshold, Discretizing); -// discrete scales -scale(BinOrdinal, scaleBinOrdinal, [ - Discrete, - Discretizing -]); -scale(Ordinal, _d3Scale.scaleOrdinal, Discrete); -scale(Band, band, Discrete); -scale(Point, point, Discrete); -function isValidScaleType(type) { - return scales.has(type); -} -function hasType(key, type) { - const s = scales.get(key); - return s && s.metadata[type]; -} -function isContinuous(key) { - return hasType(key, Continuous); -} -function isDiscrete(key) { - return hasType(key, Discrete); -} -function isDiscretizing(key) { - return hasType(key, Discretizing); -} -function isLogarithmic(key) { - return hasType(key, Log); -} -function isTemporal(key) { - return hasType(key, Temporal); -} -function isInterpolating(key) { - return hasType(key, Interpolating); -} -function isQuantile(key) { - return hasType(key, Quantile); -} -const scaleProps = [ - 'clamp', - 'base', - 'constant', - 'exponent' -]; -function interpolateRange(interpolator, range) { - const start = range[0], span = (0, _vegaUtil.peek)(range) - start; - return function(i) { - return interpolator(start + i * span); - }; -} -function interpolateColors(colors, type, gamma) { - return _d3Interpolate.piecewise(interpolate(type || 'rgb', gamma), colors); -} -function quantizeInterpolator(interpolator, count) { - const samples = new Array(count), n = count + 1; - for(let i = 0; i < count;)samples[i] = interpolator(++i / n); - return samples; -} -function scaleCopy(scale) { - const t = scale.type, s = scale.copy(); - s.type = t; - return s; -} -function scaleFraction(scale$1, min, max) { - const delta = max - min; - let i, t, s; - if (!delta || !Number.isFinite(delta)) return (0, _vegaUtil.constant)(0.5); - else { - i = (t = scale$1.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale(t)().domain([ - min, - max - ]).range([ - 0, - 1 - ]); - scaleProps.forEach((m)=>scale$1[m] ? s[m](scale$1[m]()) : 0); - return s; - } -} -function interpolate(type, gamma) { - const interp = _d3Interpolate[method(type)]; - return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp; -} -function method(type) { - return 'interpolate' + type.toLowerCase().split('-').map((s)=>s[0].toUpperCase() + s.slice(1)).join(''); -} -const continuous = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - cividis: '00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647', - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - turbo: '23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00', - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' -}; -const discrete = { - accent: (0, _d3ScaleChromatic.schemeAccent), - category10: (0, _d3ScaleChromatic.schemeCategory10), - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - dark2: (0, _d3ScaleChromatic.schemeDark2), - observable10: (0, _d3ScaleChromatic.schemeObservable10), - paired: (0, _d3ScaleChromatic.schemePaired), - pastel1: (0, _d3ScaleChromatic.schemePastel1), - pastel2: (0, _d3ScaleChromatic.schemePastel2), - set1: (0, _d3ScaleChromatic.schemeSet1), - set2: (0, _d3ScaleChromatic.schemeSet2), - set3: (0, _d3ScaleChromatic.schemeSet3), - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5' -}; -function colors(palette) { - if ((0, _vegaUtil.isArray)(palette)) return palette; - const n = palette.length / 6 | 0, c = new Array(n); - for(let i = 0; i < n;)c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; -} -function apply(_, f) { - for(const k in _)scheme(k, f(_[k])); -} -const schemes = {}; -apply(discrete, colors); -apply(continuous, (_)=>interpolateColors(colors(_))); -function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else return schemes[name]; -} -const SymbolLegend = 'symbol'; -const DiscreteLegend = 'discrete'; -const GradientLegend = 'gradient'; -const defaultFormatter = (value)=>(0, _vegaUtil.isArray)(value) ? value.map((v)=>String(v)) : String(value); -const ascending = (a, b)=>a[1] - b[1]; -const descending = (a, b)=>b[1] - a[1]; -/** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ function tickCount(scale, count, minStep) { - let step; - if ((0, _vegaUtil.isNumber)(count)) { - if (scale.bins) count = Math.max(count, scale.bins.length); - if (minStep != null) count = Math.min(count, Math.floor((0, _vegaUtil.span)(scale.domain()) / minStep || 1) + 1); - } - if ((0, _vegaUtil.isObject)(count)) { - step = count.step; - count = count.interval; - } - if ((0, _vegaUtil.isString)(count)) { - count = scale.type === Time ? (0, _vegaTime.timeInterval)(count) : scale.type == UTC ? (0, _vegaTime.utcInterval)(count) : (0, _vegaUtil.error)('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - return count; -} -/** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ function validTicks(scale, ticks, count) { - let range = scale.range(), lo = range[0], hi = (0, _vegaUtil.peek)(range), cmp = ascending; - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; + }; + function curveStep(context2) { + return new Step(context2, 0.5); + } + function stepBefore(context2) { + return new Step(context2, 0); + } + function stepAfter(context2) { + return new Step(context2, 1); + } + function domCanvas(w2, h2) { + if (typeof document !== "undefined" && document.createElement) { + const c2 = document.createElement("canvas"); + if (c2 && c2.getContext) { + c2.width = w2; + c2.height = h2; + return c2; + } } - lo = Math.floor(lo); - hi = Math.ceil(hi); - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map((v)=>[ - v, - scale(v) - ]).filter((_)=>lo <= _[1] && _[1] <= hi).sort(cmp).map((_)=>_[0]); - if (count > 0 && ticks.length > 1) { - const endpoints = [ - ticks[0], - (0, _vegaUtil.peek)(ticks) - ]; - while(ticks.length > count && ticks.length >= 3)ticks = ticks.filter((_, i)=>!(i % 2)); - if (ticks.length < 3) ticks = endpoints; - } - return ticks; -} -/** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins, count) : scale.ticks ? scale.ticks(count) : scale.domain(); -} -/** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ function tickFormat(locale, scale, count, specifier, formatType, noSkip) { - const type = scale.type; - let format = defaultFormatter; - if (type === Time || formatType === Time) format = locale.timeFormat(specifier); - else if (type === UTC || formatType === UTC) format = locale.utcFormat(specifier); - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) format = varfmt; - else { - const test = tickLog(scale, count, false); - format = (_)=>test(_) ? varfmt(_) : ''; - } - } else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } else if (specifier) format = locale.format(specifier); - return format; -} -function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), base = scale.base(), logb = Math.log(base), k = Math.max(1, base * count / ticks.length); - // apply d3-scale's log format filter criteria - const test = (d)=>{ - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - return values ? ticks.filter(test) : test; -} -const symbols = { - [Quantile]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' -}; -const formats = { - [Quantile]: 'quantiles', - [Quantize]: 'domain' -}; -function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : tickValues(scale, count); -} -function thresholdFormat(locale, scale, specifier) { - const _ = scale[formats[scale.type]](), n = _.length; - let d = n > 1 ? _[1] - _[0] : _[0], i; - for(i = 1; i < n; ++i)d = Math.min(d, _[i] - _[i - 1]); - // tickCount = 3 ticks times 10 for increased resolution - return locale.formatSpan(0, d, 30, specifier); -} -function thresholdValues(thresholds) { - const values = [ - -Infinity - ].concat(thresholds); - values.max = Infinity; - return values; -} -function binValues(bins) { - const values = bins.slice(0, -1); - values.max = (0, _vegaUtil.peek)(bins); - return values; -} -const isDiscreteRange = (scale)=>symbols[scale.type] || scale.bins; -function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) { - const format = formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat(locale, scale, count, specifier, formatType, noSkip); - return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format); -} -const formatRange = (format)=>(value, index, array)=>{ - const limit = get(array[index + 1], get(array.max, Infinity)), lo = formatValue(value, format), hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; -const get = (value, dflt)=>value != null ? value : dflt; -const formatDiscrete = (format)=>(value, index)=>index ? format(value) : null; -const formatPoint = (format)=>(value)=>format(value); -const formatValue = (value, format)=>Number.isFinite(value) ? format(value) : null; -function labelFraction(scale) { - const domain = scale.domain(), count = domain.length - 1; - let lo = +domain[0], hi = +(0, _vegaUtil.peek)(domain), span = hi - lo; - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - return (value)=>(value - lo) / span; -} -function format(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - // replace abbreviated time specifiers to improve screen reader experience - if ((0, _vegaUtil.isString)(specifier) && isTemporal(type)) specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true); -} -function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), fmt = format(locale, scale, opt.format, opt.formatType); - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } else if (isDiscrete(scale.type)) { - const d = scale.domain(), n = d.length, v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt((0, _vegaUtil.peek)(d))}`; - } -} - -},{"vega-util":"bApja","d3-array":"6IwJG","d3-scale":"9G9pz","d3-interpolate":"6gbPP","d3-scale-chromatic":"f3TcU","vega-time":"27kpp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9G9pz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleBand", ()=>(0, _bandJsDefault.default)); -parcelHelpers.export(exports, "scalePoint", ()=>(0, _bandJs.point)); -parcelHelpers.export(exports, "scaleIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "scaleLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "scaleLog", ()=>(0, _logJsDefault.default)); -parcelHelpers.export(exports, "scaleSymlog", ()=>(0, _symlogJsDefault.default)); -parcelHelpers.export(exports, "scaleOrdinal", ()=>(0, _ordinalJsDefault.default)); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _ordinalJs.implicit)); -parcelHelpers.export(exports, "scalePow", ()=>(0, _powJsDefault.default)); -parcelHelpers.export(exports, "scaleSqrt", ()=>(0, _powJs.sqrt)); -parcelHelpers.export(exports, "scaleRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "scaleThreshold", ()=>(0, _thresholdJsDefault.default)); -parcelHelpers.export(exports, "scaleTime", ()=>(0, _timeJsDefault.default)); -parcelHelpers.export(exports, "scaleUtc", ()=>(0, _utcTimeJsDefault.default)); -parcelHelpers.export(exports, "scaleSequential", ()=>(0, _sequentialJsDefault.default)); -parcelHelpers.export(exports, "scaleSequentialLog", ()=>(0, _sequentialJs.sequentialLog)); -parcelHelpers.export(exports, "scaleSequentialPow", ()=>(0, _sequentialJs.sequentialPow)); -parcelHelpers.export(exports, "scaleSequentialSqrt", ()=>(0, _sequentialJs.sequentialSqrt)); -parcelHelpers.export(exports, "scaleSequentialSymlog", ()=>(0, _sequentialJs.sequentialSymlog)); -parcelHelpers.export(exports, "scaleSequentialQuantile", ()=>(0, _sequentialQuantileJsDefault.default)); -parcelHelpers.export(exports, "scaleDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "scaleDivergingLog", ()=>(0, _divergingJs.divergingLog)); -parcelHelpers.export(exports, "scaleDivergingPow", ()=>(0, _divergingJs.divergingPow)); -parcelHelpers.export(exports, "scaleDivergingSqrt", ()=>(0, _divergingJs.divergingSqrt)); -parcelHelpers.export(exports, "scaleDivergingSymlog", ()=>(0, _divergingJs.divergingSymlog)); -parcelHelpers.export(exports, "tickFormat", ()=>(0, _tickFormatJsDefault.default)); -var _bandJs = require("./band.js"); -var _bandJsDefault = parcelHelpers.interopDefault(_bandJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _linearJs = require("./linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _logJs = require("./log.js"); -var _logJsDefault = parcelHelpers.interopDefault(_logJs); -var _symlogJs = require("./symlog.js"); -var _symlogJsDefault = parcelHelpers.interopDefault(_symlogJs); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -var _powJs = require("./pow.js"); -var _powJsDefault = parcelHelpers.interopDefault(_powJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _thresholdJs = require("./threshold.js"); -var _thresholdJsDefault = parcelHelpers.interopDefault(_thresholdJs); -var _timeJs = require("./time.js"); -var _timeJsDefault = parcelHelpers.interopDefault(_timeJs); -var _utcTimeJs = require("./utcTime.js"); -var _utcTimeJsDefault = parcelHelpers.interopDefault(_utcTimeJs); -var _sequentialJs = require("./sequential.js"); -var _sequentialJsDefault = parcelHelpers.interopDefault(_sequentialJs); -var _sequentialQuantileJs = require("./sequentialQuantile.js"); -var _sequentialQuantileJsDefault = parcelHelpers.interopDefault(_sequentialQuantileJs); -var _divergingJs = require("./diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); - -},{"./band.js":"6WWiS","./identity.js":"le9d2","./linear.js":"5CETT","./log.js":"2gcSE","./symlog.js":"iUUr7","./ordinal.js":"1j3zZ","./pow.js":"i4lyo","./radial.js":"5ODOz","./quantile.js":"aAURo","./quantize.js":"jjcn6","./threshold.js":"8ndX3","./time.js":"cjAqm","./utcTime.js":"cM5gE","./sequential.js":"f1sM1","./sequentialQuantile.js":"cSmYu","./diverging.js":"9Qcq3","./tickFormat.js":"dksn9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6WWiS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>band); -parcelHelpers.export(exports, "point", ()=>point); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -function band() { - var scale = (0, _ordinalJsDefault.default)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1; - step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); - var values = (0, _d3Array.range)(n).map(function(i) { - return start + step * i; - }); - return ordinalRange(reverse ? values.reverse() : values); - } - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.range = function(_) { - return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [ - r0, - r1 - ]; - }; - scale.rangeRound = function(_) { - return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale(); - }; - scale.bandwidth = function() { - return bandwidth; - }; - scale.step = function() { - return step; - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, rescale()) : round; - }; - scale.padding = function(_) { - return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner; - }; - scale.paddingInner = function(_) { - return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner; - }; - scale.paddingOuter = function(_) { - return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter; - }; - scale.align = function(_) { - return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; - }; - scale.copy = function() { - return band(domain(), [ - r0, - r1 - ]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - return (0, _initJs.initRange).apply(rescale(), arguments); -} -function pointish(scale) { - var copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - delete scale.paddingOuter; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band.apply(null, arguments).paddingInner(1)); -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","./ordinal.js":"1j3zZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kLKEv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initRange", ()=>initRange); -parcelHelpers.export(exports, "initInterpolator", ()=>initInterpolator); -function initRange(domain, range) { - switch(arguments.length){ - case 0: - break; - case 1: - this.range(domain); - break; - default: - this.range(range).domain(domain); - break; + return null; + } + const domImage = () => typeof Image !== "undefined" ? Image : null; + function initRange(domain2, range2) { + switch (arguments.length) { + case 0: + break; + case 1: + this.range(domain2); + break; + default: + this.range(range2).domain(domain2); + break; } return this; -} -function initInterpolator(domain, interpolator) { - switch(arguments.length){ - case 0: - break; - case 1: - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - default: - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; + } + function initInterpolator(domain2, interpolator) { + switch (arguments.length) { + case 0: + break; + case 1: { + if (typeof domain2 === "function") this.interpolator(domain2); + else this.range(domain2); + break; + } + default: { + this.domain(domain2); + if (typeof interpolator === "function") this.interpolator(interpolator); + else this.range(interpolator); + break; + } } return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1j3zZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "implicit", ()=>implicit); -parcelHelpers.export(exports, "default", ()=>ordinal); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -const implicit = Symbol("implicit"); -function ordinal() { - var index = new (0, _d3Array.InternMap)(), domain = [], range = [], unknown = implicit; - function scale(d) { - let i = index.get(d); - if (i === undefined) { - if (unknown !== implicit) return unknown; - index.set(d, i = domain.push(d) - 1); - } - return range[i % range.length]; - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new (0, _d3Array.InternMap)(); - for (const value of _){ - if (index.has(value)) continue; - index.set(value, domain.push(value) - 1); - } - return scale; - }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"le9d2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function identity(domain) { - var unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : x; - } - scale.invert = scale; - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), scale) : domain.slice(); + } + const implicit = Symbol("implicit"); + function ordinal() { + var index2 = new InternMap(), domain2 = [], range2 = [], unknown = implicit; + function scale2(d) { + let i = index2.get(d); + if (i === void 0) { + if (unknown !== implicit) return unknown; + index2.set(d, i = domain2.push(d) - 1); + } + return range2[i % range2.length]; + } + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = [], index2 = new InternMap(); + for (const value2 of _) { + if (index2.has(value2)) continue; + index2.set(value2, domain2.push(value2) - 1); + } + return scale2; }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), scale2) : range2.slice(); }; - scale.copy = function() { - return identity(domain).unknown(unknown); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; - domain = arguments.length ? Array.from(domain, (0, _numberJsDefault.default)) : [ - 0, - 1 - ]; - return (0, _linearJs.linearish)(scale); -} - -},{"./linear.js":"5CETT","./number.js":"bOzsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5CETT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "linearish", ()=>linearish); -parcelHelpers.export(exports, "default", ()=>linear); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); -function linearish(scale) { - var domain = scale.domain; - scale.ticks = function(count) { - var d = domain(); - return (0, _d3Array.ticks)(d[0], d[d.length - 1], count == null ? 10 : count); - }; - scale.tickFormat = function(count, specifier) { - var d = domain(); - return (0, _tickFormatJsDefault.default)(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - scale.nice = function(count) { - if (count == null) count = 10; - var d = domain(); - var i0 = 0; - var i1 = d.length - 1; - var start = d[i0]; - var stop = d[i1]; - var prestep; - var step; - var maxIter = 10; - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - while(maxIter-- > 0){ - step = (0, _d3Array.tickIncrement)(start, stop, count); - if (step === prestep) { - d[i0] = start; - d[i1] = stop; - return domain(d); - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } else break; - prestep = step; - } - return scale; - }; - return scale; -} -function linear() { - var scale = (0, _continuousJsDefault.default)(); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, linear()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return linearish(scale); -} - -},{"d3-array":"6IwJG","./continuous.js":"it8xE","./init.js":"kLKEv","./tickFormat.js":"dksn9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"it8xE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "transformer", ()=>transformer); -parcelHelpers.export(exports, "default", ()=>continuous); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var unit = [ - 0, - 1 -]; -function identity(x) { - return x; -} -function normalize(a, b) { - return (b -= a = +a) ? function(x) { - return (x - a) / b; - } : (0, _constantJsDefault.default)(isNaN(b) ? NaN : 0.5); -} -function clamper(a, b) { - var t; - if (a > b) t = a, a = b, b = t; - return function(x) { - return Math.max(a, Math.min(b, x)); - }; -} -// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. -function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { - return r0(d0(x)); - }; -} -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1; - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - while(++i < j){ - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - return function(x) { - var i = (0, _d3Array.bisect)(domain, x, 1, j) - 1; - return r[i](d[i](x)); - }; -} -function copy(source, target) { - return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); -} -function transformer() { - var domain = unit, range = unit, interpolate = (0, _d3Interpolate.interpolate), transform, untransform, unknown, clamp = identity, piecewise, output, input; - function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); - } - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), (0, _d3Interpolate.interpolateNumber))))(y))); - }; - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), rescale()) : domain.slice(); - }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = (0, _d3Interpolate.interpolateRound), rescale(); - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; + scale2.copy = function() { + return ordinal(domain2, range2).unknown(unknown); }; - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - return function(t, u) { - transform = t, untransform = u; - return rescale(); - }; -} -function continuous() { - return transformer()(identity, identity); -} - -},{"d3-array":"6IwJG","d3-interpolate":"6gbPP","./constant.js":"9JgB5","./number.js":"bOzsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6gbPP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolate", ()=>(0, _valueJsDefault.default)); -parcelHelpers.export(exports, "interpolateArray", ()=>(0, _arrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "interpolateDate", ()=>(0, _dateJsDefault.default)); -parcelHelpers.export(exports, "interpolateDiscrete", ()=>(0, _discreteJsDefault.default)); -parcelHelpers.export(exports, "interpolateHue", ()=>(0, _hueJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumber", ()=>(0, _numberJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumberArray", ()=>(0, _numberArrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateObject", ()=>(0, _objectJsDefault.default)); -parcelHelpers.export(exports, "interpolateRound", ()=>(0, _roundJsDefault.default)); -parcelHelpers.export(exports, "interpolateString", ()=>(0, _stringJsDefault.default)); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>(0, _indexJs.interpolateTransformCss)); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>(0, _indexJs.interpolateTransformSvg)); -parcelHelpers.export(exports, "interpolateZoom", ()=>(0, _zoomJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgb", ()=>(0, _rgbJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgbBasis", ()=>(0, _rgbJs.rgbBasis)); -parcelHelpers.export(exports, "interpolateRgbBasisClosed", ()=>(0, _rgbJs.rgbBasisClosed)); -parcelHelpers.export(exports, "interpolateHsl", ()=>(0, _hslJsDefault.default)); -parcelHelpers.export(exports, "interpolateHslLong", ()=>(0, _hslJs.hslLong)); -parcelHelpers.export(exports, "interpolateLab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "interpolateHcl", ()=>(0, _hclJsDefault.default)); -parcelHelpers.export(exports, "interpolateHclLong", ()=>(0, _hclJs.hclLong)); -parcelHelpers.export(exports, "interpolateCubehelix", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixLong", ()=>(0, _cubehelixJs.cubehelixLong)); -parcelHelpers.export(exports, "piecewise", ()=>(0, _piecewiseJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _discreteJs = require("./discrete.js"); -var _discreteJsDefault = parcelHelpers.interopDefault(_discreteJs); -var _hueJs = require("./hue.js"); -var _hueJsDefault = parcelHelpers.interopDefault(_hueJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _indexJs = require("./transform/index.js"); -var _zoomJs = require("./zoom.js"); -var _zoomJsDefault = parcelHelpers.interopDefault(_zoomJs); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _hslJs = require("./hsl.js"); -var _hslJsDefault = parcelHelpers.interopDefault(_hslJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _hclJs = require("./hcl.js"); -var _hclJsDefault = parcelHelpers.interopDefault(_hclJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _piecewiseJs = require("./piecewise.js"); -var _piecewiseJsDefault = parcelHelpers.interopDefault(_piecewiseJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); - -},{"./value.js":"j390F","./array.js":"ak2mg","./basis.js":"aODfz","./basisClosed.js":"iMwsl","./date.js":"5kKci","./discrete.js":"kwucC","./hue.js":"l0WHx","./number.js":"e4PyF","./numberArray.js":"erlaq","./object.js":"4rZkd","./round.js":"l8dm5","./string.js":"5Q7tf","./transform/index.js":"ccQ0p","./zoom.js":"hXWwx","./rgb.js":"bXjD7","./hsl.js":"2r5a3","./lab.js":"4EvaS","./hcl.js":"CZyDl","./cubehelix.js":"1wxKY","./piecewise.js":"dHOj6","./quantize.js":"7aRYJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j390F":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? (0, _constantJsDefault.default)(b) : (t === "number" ? (0, _numberJsDefault.default) : t === "string" ? (c = (0, _d3Color.color)(b)) ? (b = c, _rgbJsDefault.default) : (0, _stringJsDefault.default) : b instanceof (0, _d3Color.color) ? (0, _rgbJsDefault.default) : b instanceof Date ? (0, _dateJsDefault.default) : (0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : Array.isArray(b) ? (0, _arrayJs.genericArray) : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? (0, _objectJsDefault.default) : (0, _numberJsDefault.default))(a, b); - }); -var _d3Color = require("d3-color"); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _arrayJs = require("./array.js"); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); - -},{"d3-color":"7SCp9","./rgb.js":"bXjD7","./array.js":"ak2mg","./date.js":"5kKci","./number.js":"e4PyF","./object.js":"4rZkd","./string.js":"5Q7tf","./constant.js":"3lDJx","./numberArray.js":"erlaq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7SCp9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "color", ()=>(0, _colorJsDefault.default)); -parcelHelpers.export(exports, "rgb", ()=>(0, _colorJs.rgb)); -parcelHelpers.export(exports, "hsl", ()=>(0, _colorJs.hsl)); -parcelHelpers.export(exports, "lab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "hcl", ()=>(0, _labJs.hcl)); -parcelHelpers.export(exports, "lch", ()=>(0, _labJs.lch)); -parcelHelpers.export(exports, "gray", ()=>(0, _labJs.gray)); -parcelHelpers.export(exports, "cubehelix", ()=>(0, _cubehelixJsDefault.default)); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); - -},{"./color.js":"cJlE6","./lab.js":"3FaCQ","./cubehelix.js":"6YqvJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cJlE6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -parcelHelpers.export(exports, "darker", ()=>darker); -parcelHelpers.export(exports, "brighter", ()=>brighter); -parcelHelpers.export(exports, "default", ()=>color); -parcelHelpers.export(exports, "rgbConvert", ()=>rgbConvert); -parcelHelpers.export(exports, "rgb", ()=>rgb); -parcelHelpers.export(exports, "Rgb", ()=>Rgb); -parcelHelpers.export(exports, "hslConvert", ()=>hslConvert); -parcelHelpers.export(exports, "hsl", ()=>hsl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -function Color() {} -var darker = 0.7; -var brighter = 1 / darker; -var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); -var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 -}; -(0, _defineJsDefault.default)(Color, color, { - copy (channels) { - return Object.assign(new this.constructor, this, channels); + initRange.apply(scale2, arguments); + return scale2; + } + function define2(constructor, factory, prototype2) { + constructor.prototype = factory.prototype = prototype2; + prototype2.constructor = constructor; + } + function extend(parent, definition2) { + var prototype2 = Object.create(parent.prototype); + for (var key2 in definition2) prototype2[key2] = definition2[key2]; + return prototype2; + } + function Color$1() { + } + var darker = 0.7; + var brighter = 1 / darker; + var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + var named = { + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 + }; + define2(Color$1, color$2, { + copy(channels) { + return Object.assign(new this.constructor(), this, channels); }, - displayable () { - return this.rgb().displayable(); + displayable() { + return this.rgb().displayable(); }, hex: color_formatHex, + // Deprecated! Use color.formatHex. formatHex: color_formatHex, formatHex8: color_formatHex8, formatHsl: color_formatHsl, formatRgb: color_formatRgb, toString: color_formatRgb -}); -function color_formatHex() { + }); + function color_formatHex() { return this.rgb().formatHex(); -} -function color_formatHex8() { + } + function color_formatHex8() { return this.rgb().formatHex8(); -} -function color_formatHsl() { + } + function color_formatHsl() { return hslConvert(this).formatHsl(); -} -function color_formatRgb() { + } + function color_formatRgb() { return this.rgb().formatRgb(); -} -function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 - : null // invalid hex - ) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; -} -function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); -} -function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); -} -function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; + } + function color$2(format2) { + var m2, l; + format2 = (format2 + "").trim().toLowerCase(); + return (m2 = reHex.exec(format2)) ? (l = m2[1].length, m2 = parseInt(m2[1], 16), l === 6 ? rgbn(m2) : l === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; + } + function rgbn(n) { + return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); + } + function rgba(r, g, b2, a2) { + if (a2 <= 0) r = g = b2 = NaN; + return new Rgb(r, g, b2, a2); + } + function rgbConvert(o) { + if (!(o instanceof Color$1)) o = color$2(o); + if (!o) return new Rgb(); o = o.rgb(); return new Rgb(o.r, o.g, o.b, o.opacity); -} -function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} -function Rgb(r, g, b, opacity) { + } + function rgb$1(r, g, b2, opacity2) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b2, opacity2 == null ? 1 : opacity2); + } + function Rgb(r, g, b2, opacity2) { this.r = +r; this.g = +g; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Rgb, rgb, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + this.b = +b2; + this.opacity = +opacity2; + } + define2(Rgb, rgb$1, extend(Color$1, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, - rgb () { - return this; + rgb() { + return this; }, - clamp () { - return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); }, - displayable () { - return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; + displayable() { + return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); }, hex: rgb_formatHex, + // Deprecated! Use color.formatHex. formatHex: rgb_formatHex, formatHex8: rgb_formatHex8, formatRgb: rgb_formatRgb, toString: rgb_formatRgb -})); -function rgb_formatHex() { + })); + function rgb_formatHex() { return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; -} -function rgb_formatHex8() { + } + function rgb_formatHex8() { return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; -} -function rgb_formatRgb() { - const a = clampa(this.opacity); - return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; -} -function clampa(opacity) { - return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); -} -function clampi(value) { - return Math.max(0, Math.min(255, Math.round(value) || 0)); -} -function hex(value) { - value = clampi(value); - return (value < 16 ? "0" : "") + value.toString(16); -} -function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); -} -function hslConvert(o) { + } + function rgb_formatRgb() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`; + } + function clampa(opacity2) { + return isNaN(opacity2) ? 1 : Math.max(0, Math.min(1, opacity2)); + } + function clampi(value2) { + return Math.max(0, Math.min(255, Math.round(value2) || 0)); + } + function hex(value2) { + value2 = clampi(value2); + return (value2 < 16 ? "0" : "") + value2.toString(16); + } + function hsla(h2, s, l, a2) { + if (a2 <= 0) h2 = s = l = NaN; + else if (l <= 0 || l >= 1) h2 = s = NaN; + else if (s <= 0) h2 = NaN; + return new Hsl(h2, s, l, a2); + } + function hslConvert(o) { if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; + if (!(o instanceof Color$1)) o = color$2(o); + if (!o) return new Hsl(); if (o instanceof Hsl) return o; o = o.rgb(); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, min2 = Math.min(r, g, b2), max2 = Math.max(r, g, b2), h2 = NaN, s = max2 - min2, l = (max2 + min2) / 2; if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else s = l > 0 && l < 1 ? 0 : h; - return new Hsl(h, s, l, o.opacity); -} -function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} -function Hsl(h, s, l, opacity) { - this.h = +h; + if (r === max2) h2 = (g - b2) / s + (g < b2) * 6; + else if (g === max2) h2 = (b2 - r) / s + 2; + else h2 = (r - g) / s + 4; + s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2; + h2 *= 60; + } else { + s = l > 0 && l < 1 ? 0 : h2; + } + return new Hsl(h2, s, l, o.opacity); + } + function hsl$1(h2, s, l, opacity2) { + return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s, l, opacity2 == null ? 1 : opacity2); + } + function Hsl(h2, s, l, opacity2) { + this.h = +h2; this.s = +s; this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Hsl, hsl, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; - return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); + this.opacity = +opacity2; + } + define2(Hsl, hsl$1, extend(Color$1, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = this.h % 360 + (this.h < 0) * 360, s = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2), + hsl2rgb(h2, m1, m2), + hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2), + this.opacity + ); }, - clamp () { - return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); }, - displayable () { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); }, - formatHsl () { - const a = clampa(this.opacity); - return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; + formatHsl() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`; } -})); -function clamph(value) { - value = (value || 0) % 360; - return value < 0 ? value + 360 : value; -} -function clampt(value) { - return Math.max(0, Math.min(1, value || 0)); -} -/* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; -} - -},{"./define.js":"fa5me","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fa5me":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - }); -parcelHelpers.export(exports, "extend", ()=>extend); -function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for(var key in definition)prototype[key] = definition[key]; - return prototype; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3FaCQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gray", ()=>gray); -parcelHelpers.export(exports, "default", ()=>lab); -parcelHelpers.export(exports, "Lab", ()=>Lab); -parcelHelpers.export(exports, "lch", ()=>lch); -parcelHelpers.export(exports, "hcl", ()=>hcl); -parcelHelpers.export(exports, "Hcl", ()=>Hcl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -// https://observablehq.com/@mbostock/lab-and-rgb -const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; -function labConvert(o) { + })); + function clamph(value2) { + value2 = (value2 || 0) % 360; + return value2 < 0 ? value2 + 360 : value2; + } + function clampt(value2) { + return Math.max(0, Math.min(1, value2 || 0)); + } + function hsl2rgb(h2, m1, m2) { + return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255; + } + const radians$1 = Math.PI / 180; + const degrees$2 = 180 / Math.PI; + const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; + function labConvert(o) { if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); if (o instanceof Hcl) return hcl2lab(o); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b2 = rgb2lrgb(o.b), y2 = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b2) / Yn), x2, z; + if (r === g && g === b2) x2 = z = y2; else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); - } - return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); -} -function gray(l, opacity) { - return new Lab(l, 0, 0, opacity == null ? 1 : opacity); -} -function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} -function Lab(l, a, b, opacity) { + x2 = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b2) / Xn); + z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b2) / Zn); + } + return new Lab(116 * y2 - 16, 500 * (x2 - y2), 200 * (y2 - z), o.opacity); + } + function lab$1(l, a2, b2, opacity2) { + return arguments.length === 1 ? labConvert(l) : new Lab(l, a2, b2, opacity2 == null ? 1 : opacity2); + } + function Lab(l, a2, b2, opacity2) { this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Lab, lab, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker (k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb () { - var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = Zn * lab2xyz(z); - return new (0, _colorJs.Rgb)(lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity); + this.a = +a2; + this.b = +b2; + this.opacity = +opacity2; + } + define2(Lab, lab$1, extend(Color$1, { + brighter(k) { + return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + darker(k) { + return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + rgb() { + var y2 = (this.l + 16) / 116, x2 = isNaN(this.a) ? y2 : y2 + this.a / 500, z = isNaN(this.b) ? y2 : y2 - this.b / 200; + x2 = Xn * lab2xyz(x2); + y2 = Yn * lab2xyz(y2); + z = Zn * lab2xyz(z); + return new Rgb( + lrgb2rgb(3.1338561 * x2 - 1.6168667 * y2 - 0.4906146 * z), + lrgb2rgb(-0.9787684 * x2 + 1.9161415 * y2 + 0.033454 * z), + lrgb2rgb(0.0719453 * x2 - 0.2289914 * y2 + 1.4052427 * z), + this.opacity + ); } -})); -function xyz2lab(t) { + })); + function xyz2lab(t) { return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; -} -function lab2xyz(t) { + } + function lab2xyz(t) { return t > t1 ? t * t * t : t2 * (t - t0); -} -function lrgb2rgb(x) { - return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); -} -function hclConvert(o) { + } + function lrgb2rgb(x2) { + return 255 * (x2 <= 31308e-7 ? 12.92 * x2 : 1.055 * Math.pow(x2, 1 / 2.4) - 0.055); + } + function rgb2lrgb(x2) { + return (x2 /= 255) <= 0.04045 ? x2 / 12.92 : Math.pow((x2 + 0.055) / 1.055, 2.4); + } + function hclConvert(o) { if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); if (!(o instanceof Lab)) o = labConvert(o); if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = Math.atan2(o.b, o.a) * (0, _mathJs.degrees); - return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); -} -function lch(l, c, h, opacity) { - return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; + var h2 = Math.atan2(o.b, o.a) * degrees$2; + return new Hcl(h2 < 0 ? h2 + 360 : h2, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); + } + function hcl$1(h2, c2, l, opacity2) { + return arguments.length === 1 ? hclConvert(h2) : new Hcl(h2, c2, l, opacity2 == null ? 1 : opacity2); + } + function Hcl(h2, c2, l, opacity2) { + this.h = +h2; + this.c = +c2; this.l = +l; - this.opacity = +opacity; -} -function hcl2lab(o) { + this.opacity = +opacity2; + } + function hcl2lab(o) { if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * (0, _mathJs.radians); - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); -} -(0, _defineJsDefault.default)(Hcl, hcl, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); + var h2 = o.h * radians$1; + return new Lab(o.l, Math.cos(h2) * o.c, Math.sin(h2) * o.c, o.opacity); + } + define2(Hcl, hcl$1, extend(Color$1, { + brighter(k) { + return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); }, - darker (k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); + darker(k) { + return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); }, - rgb () { - return hcl2lab(this).rgb(); + rgb() { + return hcl2lab(this).rgb(); } -})); - -},{"./define.js":"fa5me","./color.js":"cJlE6","./math.js":"2h5K4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2h5K4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "degrees", ()=>degrees); -const radians = Math.PI / 180; -const degrees = 180 / Math.PI; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6YqvJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cubehelix); -parcelHelpers.export(exports, "Cubehelix", ()=>Cubehelix); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -var A = -0.14861, B = 1.78277, C = -0.29227, D = -0.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; -function cubehelixConvert(o) { + })); + var A = -0.14861, B$1 = 1.78277, C$1 = -0.29227, D$1 = -0.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C$1 - D$1 * A; + function cubehelixConvert(o) { if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * (0, _mathJs.degrees) - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); -} -function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} -function Cubehelix(h, s, l, opacity) { - this.h = +h; + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, l = (BC_DA * b2 + ED * r - EB * g) / (BC_DA + ED - EB), bl2 = b2 - l, k = (E * (g - l) - C$1 * bl2) / D$1, s = Math.sqrt(k * k + bl2 * bl2) / (E * l * (1 - l)), h2 = s ? Math.atan2(k, bl2) * degrees$2 - 120 : NaN; + return new Cubehelix(h2 < 0 ? h2 + 360 : h2, s, l, o.opacity); + } + function cubehelix$1(h2, s, l, opacity2) { + return arguments.length === 1 ? cubehelixConvert(h2) : new Cubehelix(h2, s, l, opacity2 == null ? 1 : opacity2); + } + function Cubehelix(h2, s, l, opacity2) { + this.h = +h2; this.s = +s; this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Cubehelix, cubehelix, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - k = k == null ? (0, _colorJs.brighter) : Math.pow((0, _colorJs.brighter), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? (0, _colorJs.darker) : Math.pow((0, _colorJs.darker), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = isNaN(this.h) ? 0 : (this.h + 120) * (0, _mathJs.radians), l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); - return new (0, _colorJs.Rgb)(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); - } -})); - -},{"./define.js":"fa5me","./color.js":"cJlE6","./math.js":"2h5K4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bXjD7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rgbBasis", ()=>rgbBasis); -parcelHelpers.export(exports, "rgbBasisClosed", ()=>rgbBasisClosed); -var _d3Color = require("d3-color"); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -exports.default = function rgbGamma(y) { - var color = (0, _colorJs.gamma)(y); - function rgb(start, end) { - var r = color((start = (0, _d3Color.rgb)(start)).r, (end = (0, _d3Color.rgb)(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; + this.opacity = +opacity2; + } + define2(Cubehelix, cubehelix$1, extend(Color$1, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = isNaN(this.h) ? 0 : (this.h + 120) * radians$1, l = +this.l, a2 = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh2 = Math.cos(h2), sinh2 = Math.sin(h2); + return new Rgb( + 255 * (l + a2 * (A * cosh2 + B$1 * sinh2)), + 255 * (l + a2 * (C$1 * cosh2 + D$1 * sinh2)), + 255 * (l + a2 * (E * cosh2)), + this.opacity + ); } - rgb.gamma = rgbGamma; - return rgb; -}(1); -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; - for(i = 0; i < n; ++i){ - color = (0, _d3Color.rgb)(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; + })); + function basis(t12, v0, v1, v2, v3) { + var t22 = t12 * t12, t32 = t22 * t12; + return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6; + } + function basis$1(values2) { + var n = values2.length - 1; + return function(t) { + var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values2[i], v2 = values2[i + 1], v0 = i > 0 ? values2[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values2[i + 2] : 2 * v2 - v1; + return basis((t - i / n) * n, v0, v1, v2, v3); }; -} -var rgbBasis = rgbSpline((0, _basisJsDefault.default)); -var rgbBasisClosed = rgbSpline((0, _basisClosedJsDefault.default)); - -},{"d3-color":"7SCp9","./basis.js":"aODfz","./basisClosed.js":"iMwsl","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aODfz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "basis", ()=>basis); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length - 1; - return function(t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - }); -function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = t2 * t1; - return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iMwsl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; - return (0, _basisJs.basis)((t - i / n) * n, v0, v1, v2, v3); - }; - }); -var _basisJs = require("./basis.js"); - -},{"./basis.js":"aODfz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VtCQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hue", ()=>hue); -parcelHelpers.export(exports, "gamma", ()=>gamma); -parcelHelpers.export(exports, "default", ()=>nogamma); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -function linear(a, d) { + } + function basisClosed(values2) { + var n = values2.length; return function(t) { - return a + t * d; - }; -} -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} -function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} -function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); - }; -} -function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} - -},{"./constant.js":"3lDJx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3lDJx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>()=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ak2mg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return ((0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : genericArray)(a, b); - }); -parcelHelpers.export(exports, "genericArray", ()=>genericArray); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -function genericArray(a, b) { - var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; - for(i = 0; i < na; ++i)x[i] = (0, _valueJsDefault.default)(a[i], b[i]); - for(; i < nb; ++i)c[i] = b[i]; + var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values2[(i + n - 1) % n], v1 = values2[i % n], v2 = values2[(i + 1) % n], v3 = values2[(i + 2) % n]; + return basis((t - i / n) * n, v0, v1, v2, v3); + }; + } + const constant$2 = (x2) => () => x2; + function linear$1(a2, d) { return function(t) { - for(i = 0; i < na; ++i)c[i] = x[i](t); - return c; - }; -} - -},{"./value.js":"j390F","./numberArray.js":"erlaq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erlaq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; - return function(t) { - for(i = 0; i < n; ++i)c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; - }); -parcelHelpers.export(exports, "isNumberArray", ()=>isNumberArray); -function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5kKci":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e4PyF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4rZkd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = {}, c = {}, k; - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - for(k in b)if (k in a) i[k] = (0, _valueJsDefault.default)(a[k], b[k]); - else c[k] = b[k]; - return function(t) { - for(k in i)c[k] = i[k](t); - return c; - }; - }); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); - -},{"./value.js":"j390F","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Q7tf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; // number interpolators - // Coerce inputs to strings. - a = a + "", b = b + ""; - // Interpolate pairs of numbers in a & b. - while((am = reA.exec(a)) && (bm = reB.exec(b))){ - if ((bs = bm.index) > bi) { - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { - s[++i] = null; - q.push({ - i: i, - x: (0, _numberJsDefault.default)(am, bm) - }); - } - bi = reB.lastIndex; - } - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - // Special optimization for only a single match. - // Otherwise, interpolate each of the numbers and rejoin the string. - return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) { - for(var i = 0, o; i < b; ++i)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); - }); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); -function zero(b) { - return function() { - return b; + return a2 + t * d; + }; + } + function exponential(a2, b2, y2) { + return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t) { + return Math.pow(a2 + t * b2, y2); + }; + } + function hue$1(a2, b2) { + var d = b2 - a2; + return d ? linear$1(a2, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$2(isNaN(a2) ? b2 : a2); + } + function gamma(y2) { + return (y2 = +y2) === 1 ? nogamma : function(a2, b2) { + return b2 - a2 ? exponential(a2, b2, y2) : constant$2(isNaN(a2) ? b2 : a2); + }; + } + function nogamma(a2, b2) { + var d = b2 - a2; + return d ? linear$1(a2, d) : constant$2(isNaN(a2) ? b2 : a2); + } + const rgb = (function rgbGamma(y2) { + var color2 = gamma(y2); + function rgb2(start, end) { + var r = color2((start = rgb$1(start)).r, (end = rgb$1(end)).r), g = color2(start.g, end.g), b2 = color2(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b2(t); + start.opacity = opacity2(t); + return start + ""; + }; + } + rgb2.gamma = rgbGamma; + return rgb2; + })(1); + function rgbSpline(spline) { + return function(colors2) { + var n = colors2.length, r = new Array(n), g = new Array(n), b2 = new Array(n), i, color2; + for (i = 0; i < n; ++i) { + color2 = rgb$1(colors2[i]); + r[i] = color2.r || 0; + g[i] = color2.g || 0; + b2[i] = color2.b || 0; + } + r = spline(r); + g = spline(g); + b2 = spline(b2); + color2.opacity = 1; + return function(t) { + color2.r = r(t); + color2.g = g(t); + color2.b = b2(t); + return color2 + ""; + }; }; -} -function one(b) { + } + var rgbBasis = rgbSpline(basis$1); + var rgbBasisClosed = rgbSpline(basisClosed); + function numberArray(a2, b2) { + if (!b2) b2 = []; + var n = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i; return function(t) { - return b(t) + ""; - }; -} - -},{"./number.js":"e4PyF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwucC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l0WHx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = (0, _colorJs.hue)(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; - }); -var _colorJs = require("./color.js"); - -},{"./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l8dm5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ccQ0p":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>interpolateTransformCss); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>interpolateTransformSvg); -var _numberJs = require("../number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _parseJs = require("./parse.js"); -function interpolateTransform(parse, pxComma, pxParen, degParen) { - function pop(s) { - return s.length ? s.pop() + " " : ""; - } - function translate(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb || yb) s.push("translate(" + xb + pxComma + yb + pxParen); - } - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; - else if (b - a > 180) a += 360; // shortest path - q.push({ - i: s.push(pop(s) + "rotate(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - } else if (b) s.push(pop(s) + "rotate(" + b + degParen); + for (i = 0; i < n; ++i) c2[i] = a2[i] * (1 - t) + b2[i] * t; + return c2; + }; + } + function isNumberArray(x2) { + return ArrayBuffer.isView(x2) && !(x2 instanceof DataView); + } + function array$3(a2, b2) { + return (isNumberArray(b2) ? numberArray : genericArray)(a2, b2); + } + function genericArray(a2, b2) { + var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i; + for (i = 0; i < na; ++i) x2[i] = interpolate$1(a2[i], b2[i]); + for (; i < nb; ++i) c2[i] = b2[i]; + return function(t) { + for (i = 0; i < na; ++i) c2[i] = x2[i](t); + return c2; + }; + } + function date$1(a2, b2) { + var d = /* @__PURE__ */ new Date(); + return a2 = +a2, b2 = +b2, function(t) { + return d.setTime(a2 * (1 - t) + b2 * t), d; + }; + } + function interpolateNumber(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return a2 * (1 - t) + b2 * t; + }; + } + function object(a2, b2) { + var i = {}, c2 = {}, k; + if (a2 === null || typeof a2 !== "object") a2 = {}; + if (b2 === null || typeof b2 !== "object") b2 = {}; + for (k in b2) { + if (k in a2) { + i[k] = interpolate$1(a2[k], b2[k]); + } else { + c2[k] = b2[k]; + } } - function skewX(a, b, s, q) { - if (a !== b) q.push({ - i: s.push(pop(s) + "skewX(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - else if (b) s.push(pop(s) + "skewX(" + b + degParen); - } - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb !== 1 || yb !== 1) s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - return function(a, b) { - var s = [], q = []; // number interpolators - a = parse(a), b = parse(b); - translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); - rotate(a.rotate, b.rotate, s, q); - skewX(a.skewX, b.skewX, s, q); - scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); - a = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while(++i < n)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; + return function(t) { + for (k in i) c2[k] = i[k](t); + return c2; }; -} -var interpolateTransformCss = interpolateTransform((0, _parseJs.parseCss), "px, ", "px)", "deg)"); -var interpolateTransformSvg = interpolateTransform((0, _parseJs.parseSvg), ", ", ")", ")"); - -},{"../number.js":"e4PyF","./parse.js":"fyjJk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fyjJk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/* eslint-disable no-undef */ parcelHelpers.export(exports, "parseCss", ()=>parseCss); -parcelHelpers.export(exports, "parseSvg", ()=>parseSvg); -var _decomposeJs = require("./decompose.js"); -var _decomposeJsDefault = parcelHelpers.interopDefault(_decomposeJs); -var svgNode; -function parseCss(value) { - const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + ""); - return m.isIdentity ? (0, _decomposeJs.identity) : (0, _decomposeJsDefault.default)(m.a, m.b, m.c, m.d, m.e, m.f); -} -function parseSvg(value) { - if (value == null) return 0, _decomposeJs.identity; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return 0, _decomposeJs.identity; - value = value.matrix; - return (0, _decomposeJsDefault.default)(value.a, value.b, value.c, value.d, value.e, value.f); -} - -},{"./decompose.js":"kD3Jv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kD3Jv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "default", ()=>function(a, b, c, d, e, f) { - var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b, a) * degrees, - skewX: Math.atan(skewX) * degrees, - scaleX: scaleX, - scaleY: scaleY - }; + } + var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); + function zero$1(b2) { + return function() { + return b2; + }; + } + function one$1(b2) { + return function(t) { + return b2(t) + ""; + }; + } + function string(a2, b2) { + var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; + a2 = a2 + "", b2 = b2 + ""; + while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) { + if ((bs = bm.index) > bi) { + bs = b2.slice(bi, bs); + if (s[i]) s[i] += bs; + else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { + if (s[i]) s[i] += bm; + else s[++i] = bm; + } else { + s[++i] = null; + q.push({ i, x: interpolateNumber(am, bm) }); + } + bi = reB.lastIndex; + } + if (bi < b2.length) { + bs = b2.slice(bi); + if (s[i]) s[i] += bs; + else s[++i] = bs; + } + return s.length < 2 ? q[0] ? one$1(q[0].x) : zero$1(b2) : (b2 = q.length, function(t) { + for (var i2 = 0, o; i2 < b2; ++i2) s[(o = q[i2]).i] = o.x(t); + return s.join(""); }); -var degrees = 180 / Math.PI; -var identity = { + } + function interpolate$1(a2, b2) { + var t = typeof b2, c2; + return b2 == null || t === "boolean" ? constant$2(b2) : (t === "number" ? interpolateNumber : t === "string" ? (c2 = color$2(b2)) ? (b2 = c2, rgb) : string : b2 instanceof color$2 ? rgb : b2 instanceof Date ? date$1 : isNumberArray(b2) ? numberArray : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object : interpolateNumber)(a2, b2); + } + function discrete$1(range2) { + var n = range2.length; + return function(t) { + return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; + }; + } + function hue(a2, b2) { + var i = hue$1(+a2, +b2); + return function(t) { + var x2 = i(t); + return x2 - 360 * Math.floor(x2 / 360); + }; + } + function interpolateRound(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return Math.round(a2 * (1 - t) + b2 * t); + }; + } + var degrees$1 = 180 / Math.PI; + var identity$4 = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hXWwx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var epsilon2 = 1e-12; -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} -exports.default = function zoomRho(rho, rho2, rho4) { - // p0 = [ux0, uy0, w0] - // p1 = [ux1, uy1, w1] - function zoom(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } else { - var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); - return [ - ux0 + u * dx, - uy0 + u * dy, - w0 * coshr0 / cosh(rho * s + r0) - ]; - }; - } - i.duration = S * 1000 * rho / Math.SQRT2; - return i; + }; + function decompose(a2, b2, c2, d, e, f) { + var scaleX, scaleY2, skewX; + if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX; + if (skewX = a2 * c2 + b2 * d) c2 -= a2 * skewX, d -= b2 * skewX; + if (scaleY2 = Math.sqrt(c2 * c2 + d * d)) c2 /= scaleY2, d /= scaleY2, skewX /= scaleY2; + if (a2 * d < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e, + translateY: f, + rotate: Math.atan2(b2, a2) * degrees$1, + skewX: Math.atan(skewX) * degrees$1, + scaleX, + scaleY: scaleY2 + }; + } + var svgNode; + function parseCss(value2) { + const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + ""); + return m2.isIdentity ? identity$4 : decompose(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f); + } + function parseSvg(value2) { + if (value2 == null) return identity$4; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value2); + if (!(value2 = svgNode.transform.baseVal.consolidate())) return identity$4; + value2 = value2.matrix; + return decompose(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f); + } + function interpolateTransform(parse2, pxComma, pxParen, degParen) { + function pop(s) { + return s.length ? s.pop() + " " : ""; + } + function translate2(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push("translate(", null, pxComma, null, pxParen); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb || yb) { + s.push("translate(" + xb + pxComma + yb + pxParen); + } } - zoom.rho = function(_) { - var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; - return zoomRho(_1, _2, _4); - }; - return zoom; -}(Math.SQRT2, 2, 4); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2r5a3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hslLong", ()=>hslLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hsl(hue) { - return function(start, end) { - var h = hue((start = (0, _d3Color.hsl)(start)).h, (end = (0, _d3Color.hsl)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; + function rotate2(a2, b2, s, q) { + if (a2 !== b2) { + if (a2 - b2 > 180) b2 += 360; + else if (b2 - a2 > 180) a2 += 360; + q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s.push(pop(s) + "rotate(" + b2 + degParen); + } + } + function skewX(a2, b2, s, q) { + if (a2 !== b2) { + q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s.push(pop(s) + "skewX(" + b2 + degParen); + } + } + function scale2(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push(pop(s) + "scale(", null, ",", null, ")"); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb !== 1 || yb !== 1) { + s.push(pop(s) + "scale(" + xb + "," + yb + ")"); + } + } + return function(a2, b2) { + var s = [], q = []; + a2 = parse2(a2), b2 = parse2(b2); + translate2(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s, q); + rotate2(a2.rotate, b2.rotate, s, q); + skewX(a2.skewX, b2.skewX, s, q); + scale2(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s, q); + a2 = b2 = null; + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; + } + var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); + var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + var epsilon2$1 = 1e-12; + function cosh(x2) { + return ((x2 = Math.exp(x2)) + 1 / x2) / 2; + } + function sinh(x2) { + return ((x2 = Math.exp(x2)) - 1 / x2) / 2; + } + function tanh(x2) { + return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1); + } + const zoom = (function zoomRho(rho, rho2, rho4) { + function zoom2(p02, p1) { + var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < epsilon2$1) { + S = Math.log(w1 / w0) / rho; + i = function(t) { + return [ + ux0 + t * dx, + uy0 + t * dy, + w0 * Math.exp(rho * t * S) + ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / rho; + i = function(t) { + var s = t * S, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); + return [ + ux0 + u2 * dx, + uy0 + u2 * dy, + w0 * coshr0 / cosh(rho * s + r0) + ]; }; + } + i.duration = S * 1e3 * rho / Math.SQRT2; + return i; + } + zoom2.rho = function(_) { + var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; + return zoomRho(_1, _2, _4); }; -} -exports.default = hsl((0, _colorJs.hue)); -var hslLong = hsl((0, _colorJsDefault.default)); - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4EvaS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>lab); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function lab(start, end) { - var l = (0, _colorJsDefault.default)((start = (0, _d3Color.lab)(start)).l, (end = (0, _d3Color.lab)(end)).l), a = (0, _colorJsDefault.default)(start.a, end.a), b = (0, _colorJsDefault.default)(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { + return zoom2; + })(Math.SQRT2, 2, 4); + function hsl(hue2) { + return function(start, end) { + var h2 = hue2((start = hsl$1(start)).h, (end = hsl$1(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.s = s(t); start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); + start.opacity = opacity2(t); return start + ""; + }; + }; + } + const hsl_default = hsl(hue$1); + var hslLong = hsl(nogamma); + function lab(start, end) { + var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l), a2 = nogamma(start.a, end.a), b2 = nogamma(start.b, end.b), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.l = l(t); + start.a = a2(t); + start.b = b2(t); + start.opacity = opacity2(t); + return start + ""; }; -} - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"CZyDl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hclLong", ()=>hclLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hcl(hue) { + } + function hcl(hue2) { return function(start, end) { - var h = hue((start = (0, _d3Color.hcl)(start)).h, (end = (0, _d3Color.hcl)(end)).h), c = (0, _colorJsDefault.default)(start.c, end.c), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); + var h2 = hue2((start = hcl$1(start)).h, (end = hcl$1(end)).h), c2 = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.c = c2(t); + start.l = l(t); + start.opacity = opacity2(t); + return start + ""; + }; + }; + } + const hcl_default = hcl(hue$1); + var hclLong = hcl(nogamma); + function cubehelix(hue2) { + return (function cubehelixGamma(y2) { + y2 = +y2; + function cubehelix2(start, end) { + var h2 = hue2((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity2 = nogamma(start.opacity, end.opacity); return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; + start.h = h2(t); + start.s = s(t); + start.l = l(Math.pow(t, y2)); + start.opacity = opacity2(t); + return start + ""; }; - }; -} -exports.default = hcl((0, _colorJs.hue)); -var hclLong = hcl((0, _colorJsDefault.default)); - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1wxKY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubehelixLong", ()=>cubehelixLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function cubehelix(hue) { - return function cubehelixGamma(y) { - y = +y; - function cubehelix(start, end) { - var h = hue((start = (0, _d3Color.cubehelix)(start)).h, (end = (0, _d3Color.cubehelix)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - cubehelix.gamma = cubehelixGamma; - return cubehelix; - }(1); -} -exports.default = cubehelix((0, _colorJs.hue)); -var cubehelixLong = cubehelix((0, _colorJsDefault.default)); - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dHOj6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>piecewise); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -function piecewise(interpolate, values) { - if (values === undefined) values = interpolate, interpolate = (0, _valueJsDefault.default); - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while(i < n)I[i] = interpolate(v, v = values[++i]); + } + cubehelix2.gamma = cubehelixGamma; + return cubehelix2; + })(1); + } + const cubehelix_default = cubehelix(hue$1); + var cubehelixLong = cubehelix(nogamma); + function piecewise(interpolate2, values2) { + if (values2 === void 0) values2 = interpolate2, interpolate2 = interpolate$1; + var i = 0, n = values2.length - 1, v = values2[0], I = new Array(n < 0 ? 0 : n); + while (i < n) I[i] = interpolate2(v, v = values2[++i]); return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; -} - -},{"./value.js":"j390F","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7aRYJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(interpolator, n) { - var samples = new Array(n); - for(var i = 0; i < n; ++i)samples[i] = interpolator(i / (n - 1)); - return samples; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9JgB5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constants); -function constants(x) { + var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); + return I[i2](t - i2); + }; + } + function quantize$2(interpolator, n) { + var samples = new Array(n); + for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + return samples; + } + const $$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + interpolate: interpolate$1, + interpolateArray: array$3, + interpolateBasis: basis$1, + interpolateBasisClosed: basisClosed, + interpolateCubehelix: cubehelix_default, + interpolateCubehelixLong: cubehelixLong, + interpolateDate: date$1, + interpolateDiscrete: discrete$1, + interpolateHcl: hcl_default, + interpolateHclLong: hclLong, + interpolateHsl: hsl_default, + interpolateHslLong: hslLong, + interpolateHue: hue, + interpolateLab: lab, + interpolateNumber, + interpolateNumberArray: numberArray, + interpolateObject: object, + interpolateRgb: rgb, + interpolateRgbBasis: rgbBasis, + interpolateRgbBasisClosed: rgbBasisClosed, + interpolateRound, + interpolateString: string, + interpolateTransformCss, + interpolateTransformSvg, + interpolateZoom: zoom, + piecewise, + quantize: quantize$2 + }, Symbol.toStringTag, { value: "Module" })); + function constants(x2) { return function() { - return x; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOzsY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -function number(x) { - return +x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dksn9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>tickFormat); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -function tickFormat(start, stop, count, specifier) { - var step = (0, _d3Array.tickStep)(start, stop, count), precision; - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ",f" : specifier); - switch(specifier.type){ - case "s": - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return (0, _d3Format.formatPrefix)(specifier, value); - case "": - case "e": - case "g": - case "p": - case "r": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionRound)(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - case "f": - case "%": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - return (0, _d3Format.format)(specifier); -} - -},{"d3-array":"6IwJG","d3-format":"8dYFL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2gcSE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loggish", ()=>loggish); -parcelHelpers.export(exports, "default", ()=>log); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformLog(x) { - return Math.log(x); -} -function transformExp(x) { - return Math.exp(x); -} -function transformLogn(x) { - return -Math.log(-x); -} -function transformExpn(x) { - return -Math.exp(-x); -} -function pow10(x) { - return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; -} -function powp(base) { - return base === 10 ? pow10 : base === Math.E ? Math.exp : (x)=>Math.pow(base, x); -} -function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x)=>Math.log(x) / base); -} -function reflect(f) { - return (x, k)=>-f(-x, k); -} -function loggish(transform) { - const scale = transform(transformLog, transformExp); - const domain = scale.domain; - let base = 10; - let logs; - let pows; - function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else transform(transformLog, transformExp); - return scale; - } - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.ticks = (count)=>{ - const d = domain(); - let u = d[0]; - let v = d[d.length - 1]; - const r = v < u; - if (r) [u, v] = [ - v, - u - ]; - let i = logs(u); - let j = logs(v); - let k; - let t; - const n = count == null ? 10 : +count; - let z = []; - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for(; i <= j; ++i)for(k = 1; k < base; ++k){ - t = i < 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - else for(; i <= j; ++i)for(k = base - 1; k >= 1; --k){ - t = i > 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - if (z.length * 2 < n) z = (0, _d3Array.ticks)(u, v, n); - } else z = (0, _d3Array.ticks)(i, j, Math.min(j - i, n)).map(pows); - return r ? z.reverse() : z; - }; - scale.tickFormat = (count, specifier)=>{ - if (count == null) count = 10; - if (specifier == null) specifier = base === 10 ? "s" : ","; - if (typeof specifier !== "function") { - if (!(base % 1) && (specifier = (0, _d3Format.formatSpecifier)(specifier)).precision == null) specifier.trim = true; - specifier = (0, _d3Format.format)(specifier); - } - if (count === Infinity) return specifier; - const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return (d)=>{ - let i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; + return x2; }; - scale.nice = ()=>{ - return domain((0, _niceJsDefault.default)(domain(), { - floor: (x)=>pows(Math.floor(logs(x))), - ceil: (x)=>pows(Math.ceil(logs(x))) - })); + } + function number$5(x2) { + return +x2; + } + var unit = [0, 1]; + function identity$3(x2) { + return x2; + } + function normalize$4(a2, b2) { + return (b2 -= a2 = +a2) ? function(x2) { + return (x2 - a2) / b2; + } : constants(isNaN(b2) ? NaN : 0.5); + } + function clamper(a2, b2) { + var t; + if (a2 > b2) t = a2, a2 = b2, b2 = t; + return function(x2) { + return Math.max(a2, Math.min(b2, x2)); }; - return scale; -} -function log() { - const scale = loggish((0, _continuousJs.transformer)()).domain([ - 1, - 10 - ]); - scale.copy = ()=>(0, _continuousJs.copy)(scale, log()).base(scale.base()); - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"6IwJG","d3-format":"8dYFL","./nice.js":"dC4tu","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dC4tu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - domain[i0] = interval.floor(x0); - domain[i1] = interval.ceil(x1); - return domain; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUUr7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symlogish", ()=>symlogish); -parcelHelpers.export(exports, "default", ()=>symlog); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformSymlog(c) { - return function(x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; -} -function transformSymexp(c) { - return function(x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; -} -function symlogish(transform) { - var c = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - return (0, _linearJs.linearish)(scale); -} -function symlog() { - var scale = symlogish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, symlog()).constant(scale.constant()); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"./linear.js":"5CETT","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i4lyo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "powish", ()=>powish); -parcelHelpers.export(exports, "default", ()=>pow); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformPow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; -} -function transformSqrt(x) { - return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x); -} -function transformSquare(x) { - return x < 0 ? -x * x : x * x; -} -function powish(transform) { - var scale = transform((0, _continuousJs.identity), (0, _continuousJs.identity)), exponent = 1; - function rescale() { - return exponent === 1 ? transform((0, _continuousJs.identity), (0, _continuousJs.identity)) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - return (0, _linearJs.linearish)(scale); -} -function pow() { - var scale = powish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, pow()).exponent(scale.exponent()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} -function sqrt() { - return pow.apply(null, arguments).exponent(0.5); -} - -},{"./linear.js":"5CETT","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ODOz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>radial); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function square(x) { - return Math.sign(x) * x * x; -} -function unsquare(x) { - return Math.sign(x) * Math.sqrt(Math.abs(x)); -} -function radial() { - var squared = (0, _continuousJsDefault.default)(), range = [ - 0, - 1 - ], round = false, unknown; - function scale(x) { - var y = unsquare(squared(x)); - return isNaN(y) ? unknown : round ? Math.round(y) : y; - } - scale.invert = function(y) { - return squared.invert(square(y)); - }; - scale.domain = function(_) { - return arguments.length ? (squared.domain(_), scale) : squared.domain(); - }; - scale.range = function(_) { - return arguments.length ? (squared.range((range = Array.from(_, (0, _numberJsDefault.default))).map(square)), scale) : range.slice(); - }; - scale.rangeRound = function(_) { - return scale.range(_).round(true); - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, scale) : round; - }; - scale.clamp = function(_) { - return arguments.length ? (squared.clamp(_), scale) : squared.clamp(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return radial(squared.domain(), range).round(round).clamp(squared.clamp()).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return (0, _linearJs.linearish)(scale); -} - -},{"./continuous.js":"it8xE","./init.js":"kLKEv","./linear.js":"5CETT","./number.js":"bOzsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aAURo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function quantile() { - var domain = [], range = [], thresholds = [], unknown; - function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while(++i < n)thresholds[i - 1] = (0, _d3Array.quantileSorted)(domain, i / n); - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : range[(0, _d3Array.bisect)(thresholds, x)]; - } - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : [ - i > 0 ? thresholds[i - 1] : domain[0], - i < thresholds.length ? thresholds[i] : domain[domain.length - 1] - ]; - }; - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return rescale(); + } + function bimap(domain2, range2, interpolate2) { + var d0 = domain2[0], d1 = domain2[1], r0 = range2[0], r1 = range2[1]; + if (d1 < d0) d0 = normalize$4(d1, d0), r0 = interpolate2(r1, r0); + else d0 = normalize$4(d0, d1), r0 = interpolate2(r0, r1); + return function(x2) { + return r0(d0(x2)); }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.quantiles = function() { - return thresholds.slice(); - }; - scale.copy = function() { - return quantile().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jjcn6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantize); -var _d3Array = require("d3-array"); -var _linearJs = require("./linear.js"); -var _initJs = require("./init.js"); -function quantize() { - var x0 = 0, x1 = 1, n = 1, domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; + } + function polymap(domain2, range2, interpolate2) { + var j = Math.min(domain2.length, range2.length) - 1, d = new Array(j), r = new Array(j), i = -1; + if (domain2[j] < domain2[0]) { + domain2 = domain2.slice().reverse(); + range2 = range2.slice().reverse(); } - function rescale() { - var i = -1; - domain = new Array(n); - while(++i < n)domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [ - x0, - x1 - ]; - }; - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : i < 1 ? [ - x0, - domain[0] - ] : i >= n ? [ - domain[n - 1], - x1 - ] : [ - domain[i - 1], - domain[i] - ]; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - scale.thresholds = function() { - return domain.slice(); - }; - scale.copy = function() { - return quantize().domain([ - x0, - x1 - ]).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply((0, _linearJs.linearish)(scale), arguments); -} - -},{"d3-array":"6IwJG","./linear.js":"5CETT","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8ndX3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>threshold); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function threshold() { - var domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown, n = 1; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; - } - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [ - domain[i - 1], - domain[i] - ]; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return threshold().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cjAqm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "calendar", ()=>calendar); -parcelHelpers.export(exports, "default", ()=>time); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -function date(t) { - return new Date(t); -} -function number(t) { - return t instanceof Date ? +t : +new Date(+t); -} -function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) { - var scale = (0, _continuousJsDefault.default)(), invert = scale.invert, domain = scale.domain; - var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y"); - function tickFormat(date) { - return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); - } - scale.invert = function(y) { - return new Date(invert(y)); - }; - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number)) : domain().map(date); - }; - scale.ticks = function(interval) { - var d = domain(); - return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval); - }; - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - scale.nice = function(interval) { - var d = domain(); - if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); - return interval ? domain((0, _niceJsDefault.default)(d, interval)) : scale; - }; - scale.copy = function() { - return (0, _continuousJs.copy)(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format)); - }; - return scale; -} -function time() { - return (0, _initJs.initRange).apply(calendar((0, _d3Time.timeTicks), (0, _d3Time.timeTickInterval), (0, _d3Time.timeYear), (0, _d3Time.timeMonth), (0, _d3Time.timeWeek), (0, _d3Time.timeDay), (0, _d3Time.timeHour), (0, _d3Time.timeMinute), (0, _d3Time.timeSecond), (0, _d3TimeFormat.timeFormat)).domain([ - new Date(2000, 0, 1), - new Date(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"8e7eR","d3-time-format":"242jH","./continuous.js":"it8xE","./init.js":"kLKEv","./nice.js":"dC4tu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cM5gE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>utcTime); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _timeJs = require("./time.js"); -var _initJs = require("./init.js"); -function utcTime() { - return (0, _initJs.initRange).apply((0, _timeJs.calendar)((0, _d3Time.utcTicks), (0, _d3Time.utcTickInterval), (0, _d3Time.utcYear), (0, _d3Time.utcMonth), (0, _d3Time.utcWeek), (0, _d3Time.utcDay), (0, _d3Time.utcHour), (0, _d3Time.utcMinute), (0, _d3Time.utcSecond), (0, _d3TimeFormat.utcFormat)).domain([ - Date.UTC(2000, 0, 1), - Date.UTC(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"8e7eR","d3-time-format":"242jH","./time.js":"cjAqm","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f1sM1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "default", ()=>sequential); -parcelHelpers.export(exports, "sequentialLog", ()=>sequentialLog); -parcelHelpers.export(exports, "sequentialSymlog", ()=>sequentialSymlog); -parcelHelpers.export(exports, "sequentialPow", ()=>sequentialPow); -parcelHelpers.export(exports, "sequentialSqrt", ()=>sequentialSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 1, t0, t1, k10, transform, interpolator = (0, _continuousJs.identity), clamp = false, unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [ - x0, - x1 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [ - interpolator(0), - interpolator(1) - ]; - }; + while (++i < j) { + d[i] = normalize$4(domain2[i], domain2[i + 1]); + r[i] = interpolate2(range2[i], range2[i + 1]); } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + return function(x2) { + var i2 = bisectRight$1(domain2, x2, 1, j) - 1; + return r[i2](d[i2](x2)); }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); - return scale; - }; -} -function copy(source, target) { - return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown()); -} -function sequential() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return copy(scale, sequential()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 1, - 10 - ]); - scale.copy = function() { - return copy(scale, sequentialLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSqrt() { - return sequentialPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"6gbPP","./continuous.js":"it8xE","./init.js":"kLKEv","./linear.js":"5CETT","./log.js":"2gcSE","./symlog.js":"iUUr7","./pow.js":"i4lyo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cSmYu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sequentialQuantile); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function sequentialQuantile() { - var domain = [], interpolator = (0, _continuousJs.identity); - function scale(x) { - if (x != null && !isNaN(x = +x)) return interpolator(((0, _d3Array.bisect)(domain, x, 1) - 1) / (domain.length - 1)); - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return scale; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - scale.range = function() { - return domain.map((d, i)=>interpolator(i / (domain.length - 1))); - }; - scale.quantiles = function(n) { - return Array.from({ - length: n + 1 - }, (_, i)=>(0, _d3Array.quantile)(domain, i / n)); - }; - scale.copy = function() { - return sequentialQuantile(interpolator).domain(domain); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} - -},{"d3-array":"6IwJG","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Qcq3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>diverging); -parcelHelpers.export(exports, "divergingLog", ()=>divergingLog); -parcelHelpers.export(exports, "divergingSymlog", ()=>divergingSymlog); -parcelHelpers.export(exports, "divergingPow", ()=>divergingPow); -parcelHelpers.export(exports, "divergingSqrt", ()=>divergingSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _sequentialJs = require("./sequential.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 0.5, x2 = 1, s = 1, t0, t1, t2, k10, k21, interpolator = (0, _continuousJs.identity), transform, clamp = false, unknown; - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [ - x0, - x1, - x2 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = (0, _d3Interpolate.piecewise)(interpolate, [ - r0, - r1, - r2 - ]), scale) : [ - interpolator(0), - interpolator(0.5), - interpolator(1) - ]; - }; + } + function copy$7(source2, target2) { + return target2.domain(source2.domain()).range(source2.range()).interpolate(source2.interpolate()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function transformer$3() { + var domain2 = unit, range2 = unit, interpolate2 = interpolate$1, transform2, untransform, unknown, clamp2 = identity$3, piecewise2, output2, input; + function rescale() { + var n = Math.min(domain2.length, range2.length); + if (clamp2 !== identity$3) clamp2 = clamper(domain2[0], domain2[n - 1]); + piecewise2 = n > 2 ? polymap : bimap; + output2 = input = null; + return scale2; } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : (output2 || (output2 = piecewise2(domain2.map(transform2), range2, interpolate2)))(transform2(clamp2(x2))); + } + scale2.invert = function(y2) { + return clamp2(untransform((input || (input = piecewise2(range2, domain2.map(transform2), interpolateNumber)))(y2))); }; - return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} -function diverging() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, diverging()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 0.1, - 1, - 10 - ]); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSqrt() { - return divergingPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"6gbPP","./continuous.js":"it8xE","./init.js":"kLKEv","./linear.js":"5CETT","./log.js":"2gcSE","./sequential.js":"f1sM1","./symlog.js":"iUUr7","./pow.js":"i4lyo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f3TcU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "schemeCategory10", ()=>(0, _category10JsDefault.default)); -parcelHelpers.export(exports, "schemeAccent", ()=>(0, _accentJsDefault.default)); -parcelHelpers.export(exports, "schemeDark2", ()=>(0, _dark2JsDefault.default)); -parcelHelpers.export(exports, "schemeObservable10", ()=>(0, _observable10JsDefault.default)); -parcelHelpers.export(exports, "schemePaired", ()=>(0, _pairedJsDefault.default)); -parcelHelpers.export(exports, "schemePastel1", ()=>(0, _pastel1JsDefault.default)); -parcelHelpers.export(exports, "schemePastel2", ()=>(0, _pastel2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet1", ()=>(0, _set1JsDefault.default)); -parcelHelpers.export(exports, "schemeSet2", ()=>(0, _set2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet3", ()=>(0, _set3JsDefault.default)); -parcelHelpers.export(exports, "schemeTableau10", ()=>(0, _tableau10JsDefault.default)); -parcelHelpers.export(exports, "interpolateBrBG", ()=>(0, _brBGJsDefault.default)); -parcelHelpers.export(exports, "schemeBrBG", ()=>(0, _brBGJs.scheme)); -parcelHelpers.export(exports, "interpolatePRGn", ()=>(0, _prgnJsDefault.default)); -parcelHelpers.export(exports, "schemePRGn", ()=>(0, _prgnJs.scheme)); -parcelHelpers.export(exports, "interpolatePiYG", ()=>(0, _piYGJsDefault.default)); -parcelHelpers.export(exports, "schemePiYG", ()=>(0, _piYGJs.scheme)); -parcelHelpers.export(exports, "interpolatePuOr", ()=>(0, _puOrJsDefault.default)); -parcelHelpers.export(exports, "schemePuOr", ()=>(0, _puOrJs.scheme)); -parcelHelpers.export(exports, "interpolateRdBu", ()=>(0, _rdBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdBu", ()=>(0, _rdBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdGy", ()=>(0, _rdGyJsDefault.default)); -parcelHelpers.export(exports, "schemeRdGy", ()=>(0, _rdGyJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlBu", ()=>(0, _rdYlBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlBu", ()=>(0, _rdYlBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlGn", ()=>(0, _rdYlGnJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlGn", ()=>(0, _rdYlGnJs.scheme)); -parcelHelpers.export(exports, "interpolateSpectral", ()=>(0, _spectralJsDefault.default)); -parcelHelpers.export(exports, "schemeSpectral", ()=>(0, _spectralJs.scheme)); -parcelHelpers.export(exports, "interpolateBuGn", ()=>(0, _buGnJsDefault.default)); -parcelHelpers.export(exports, "schemeBuGn", ()=>(0, _buGnJs.scheme)); -parcelHelpers.export(exports, "interpolateBuPu", ()=>(0, _buPuJsDefault.default)); -parcelHelpers.export(exports, "schemeBuPu", ()=>(0, _buPuJs.scheme)); -parcelHelpers.export(exports, "interpolateGnBu", ()=>(0, _gnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeGnBu", ()=>(0, _gnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateOrRd", ()=>(0, _orRdJsDefault.default)); -parcelHelpers.export(exports, "schemeOrRd", ()=>(0, _orRdJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBuGn", ()=>(0, _puBuGnJsDefault.default)); -parcelHelpers.export(exports, "schemePuBuGn", ()=>(0, _puBuGnJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBu", ()=>(0, _puBuJsDefault.default)); -parcelHelpers.export(exports, "schemePuBu", ()=>(0, _puBuJs.scheme)); -parcelHelpers.export(exports, "interpolatePuRd", ()=>(0, _puRdJsDefault.default)); -parcelHelpers.export(exports, "schemePuRd", ()=>(0, _puRdJs.scheme)); -parcelHelpers.export(exports, "interpolateRdPu", ()=>(0, _rdPuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdPu", ()=>(0, _rdPuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGnBu", ()=>(0, _ylGnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGnBu", ()=>(0, _ylGnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGn", ()=>(0, _ylGnJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGn", ()=>(0, _ylGnJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrBr", ()=>(0, _ylOrBrJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrBr", ()=>(0, _ylOrBrJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrRd", ()=>(0, _ylOrRdJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrRd", ()=>(0, _ylOrRdJs.scheme)); -parcelHelpers.export(exports, "interpolateBlues", ()=>(0, _bluesJsDefault.default)); -parcelHelpers.export(exports, "schemeBlues", ()=>(0, _bluesJs.scheme)); -parcelHelpers.export(exports, "interpolateGreens", ()=>(0, _greensJsDefault.default)); -parcelHelpers.export(exports, "schemeGreens", ()=>(0, _greensJs.scheme)); -parcelHelpers.export(exports, "interpolateGreys", ()=>(0, _greysJsDefault.default)); -parcelHelpers.export(exports, "schemeGreys", ()=>(0, _greysJs.scheme)); -parcelHelpers.export(exports, "interpolatePurples", ()=>(0, _purplesJsDefault.default)); -parcelHelpers.export(exports, "schemePurples", ()=>(0, _purplesJs.scheme)); -parcelHelpers.export(exports, "interpolateReds", ()=>(0, _redsJsDefault.default)); -parcelHelpers.export(exports, "schemeReds", ()=>(0, _redsJs.scheme)); -parcelHelpers.export(exports, "interpolateOranges", ()=>(0, _orangesJsDefault.default)); -parcelHelpers.export(exports, "schemeOranges", ()=>(0, _orangesJs.scheme)); -parcelHelpers.export(exports, "interpolateCividis", ()=>(0, _cividisJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixDefault", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateRainbow", ()=>(0, _rainbowJsDefault.default)); -parcelHelpers.export(exports, "interpolateWarm", ()=>(0, _rainbowJs.warm)); -parcelHelpers.export(exports, "interpolateCool", ()=>(0, _rainbowJs.cool)); -parcelHelpers.export(exports, "interpolateSinebow", ()=>(0, _sinebowJsDefault.default)); -parcelHelpers.export(exports, "interpolateTurbo", ()=>(0, _turboJsDefault.default)); -parcelHelpers.export(exports, "interpolateViridis", ()=>(0, _viridisJsDefault.default)); -parcelHelpers.export(exports, "interpolateMagma", ()=>(0, _viridisJs.magma)); -parcelHelpers.export(exports, "interpolateInferno", ()=>(0, _viridisJs.inferno)); -parcelHelpers.export(exports, "interpolatePlasma", ()=>(0, _viridisJs.plasma)); -var _category10Js = require("./categorical/category10.js"); -var _category10JsDefault = parcelHelpers.interopDefault(_category10Js); -var _accentJs = require("./categorical/Accent.js"); -var _accentJsDefault = parcelHelpers.interopDefault(_accentJs); -var _dark2Js = require("./categorical/Dark2.js"); -var _dark2JsDefault = parcelHelpers.interopDefault(_dark2Js); -var _observable10Js = require("./categorical/observable10.js"); -var _observable10JsDefault = parcelHelpers.interopDefault(_observable10Js); -var _pairedJs = require("./categorical/Paired.js"); -var _pairedJsDefault = parcelHelpers.interopDefault(_pairedJs); -var _pastel1Js = require("./categorical/Pastel1.js"); -var _pastel1JsDefault = parcelHelpers.interopDefault(_pastel1Js); -var _pastel2Js = require("./categorical/Pastel2.js"); -var _pastel2JsDefault = parcelHelpers.interopDefault(_pastel2Js); -var _set1Js = require("./categorical/Set1.js"); -var _set1JsDefault = parcelHelpers.interopDefault(_set1Js); -var _set2Js = require("./categorical/Set2.js"); -var _set2JsDefault = parcelHelpers.interopDefault(_set2Js); -var _set3Js = require("./categorical/Set3.js"); -var _set3JsDefault = parcelHelpers.interopDefault(_set3Js); -var _tableau10Js = require("./categorical/Tableau10.js"); -var _tableau10JsDefault = parcelHelpers.interopDefault(_tableau10Js); -var _brBGJs = require("./diverging/BrBG.js"); -var _brBGJsDefault = parcelHelpers.interopDefault(_brBGJs); -var _prgnJs = require("./diverging/PRGn.js"); -var _prgnJsDefault = parcelHelpers.interopDefault(_prgnJs); -var _piYGJs = require("./diverging/PiYG.js"); -var _piYGJsDefault = parcelHelpers.interopDefault(_piYGJs); -var _puOrJs = require("./diverging/PuOr.js"); -var _puOrJsDefault = parcelHelpers.interopDefault(_puOrJs); -var _rdBuJs = require("./diverging/RdBu.js"); -var _rdBuJsDefault = parcelHelpers.interopDefault(_rdBuJs); -var _rdGyJs = require("./diverging/RdGy.js"); -var _rdGyJsDefault = parcelHelpers.interopDefault(_rdGyJs); -var _rdYlBuJs = require("./diverging/RdYlBu.js"); -var _rdYlBuJsDefault = parcelHelpers.interopDefault(_rdYlBuJs); -var _rdYlGnJs = require("./diverging/RdYlGn.js"); -var _rdYlGnJsDefault = parcelHelpers.interopDefault(_rdYlGnJs); -var _spectralJs = require("./diverging/Spectral.js"); -var _spectralJsDefault = parcelHelpers.interopDefault(_spectralJs); -var _buGnJs = require("./sequential-multi/BuGn.js"); -var _buGnJsDefault = parcelHelpers.interopDefault(_buGnJs); -var _buPuJs = require("./sequential-multi/BuPu.js"); -var _buPuJsDefault = parcelHelpers.interopDefault(_buPuJs); -var _gnBuJs = require("./sequential-multi/GnBu.js"); -var _gnBuJsDefault = parcelHelpers.interopDefault(_gnBuJs); -var _orRdJs = require("./sequential-multi/OrRd.js"); -var _orRdJsDefault = parcelHelpers.interopDefault(_orRdJs); -var _puBuGnJs = require("./sequential-multi/PuBuGn.js"); -var _puBuGnJsDefault = parcelHelpers.interopDefault(_puBuGnJs); -var _puBuJs = require("./sequential-multi/PuBu.js"); -var _puBuJsDefault = parcelHelpers.interopDefault(_puBuJs); -var _puRdJs = require("./sequential-multi/PuRd.js"); -var _puRdJsDefault = parcelHelpers.interopDefault(_puRdJs); -var _rdPuJs = require("./sequential-multi/RdPu.js"); -var _rdPuJsDefault = parcelHelpers.interopDefault(_rdPuJs); -var _ylGnBuJs = require("./sequential-multi/YlGnBu.js"); -var _ylGnBuJsDefault = parcelHelpers.interopDefault(_ylGnBuJs); -var _ylGnJs = require("./sequential-multi/YlGn.js"); -var _ylGnJsDefault = parcelHelpers.interopDefault(_ylGnJs); -var _ylOrBrJs = require("./sequential-multi/YlOrBr.js"); -var _ylOrBrJsDefault = parcelHelpers.interopDefault(_ylOrBrJs); -var _ylOrRdJs = require("./sequential-multi/YlOrRd.js"); -var _ylOrRdJsDefault = parcelHelpers.interopDefault(_ylOrRdJs); -var _bluesJs = require("./sequential-single/Blues.js"); -var _bluesJsDefault = parcelHelpers.interopDefault(_bluesJs); -var _greensJs = require("./sequential-single/Greens.js"); -var _greensJsDefault = parcelHelpers.interopDefault(_greensJs); -var _greysJs = require("./sequential-single/Greys.js"); -var _greysJsDefault = parcelHelpers.interopDefault(_greysJs); -var _purplesJs = require("./sequential-single/Purples.js"); -var _purplesJsDefault = parcelHelpers.interopDefault(_purplesJs); -var _redsJs = require("./sequential-single/Reds.js"); -var _redsJsDefault = parcelHelpers.interopDefault(_redsJs); -var _orangesJs = require("./sequential-single/Oranges.js"); -var _orangesJsDefault = parcelHelpers.interopDefault(_orangesJs); -var _cividisJs = require("./sequential-multi/cividis.js"); -var _cividisJsDefault = parcelHelpers.interopDefault(_cividisJs); -var _cubehelixJs = require("./sequential-multi/cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _rainbowJs = require("./sequential-multi/rainbow.js"); -var _rainbowJsDefault = parcelHelpers.interopDefault(_rainbowJs); -var _sinebowJs = require("./sequential-multi/sinebow.js"); -var _sinebowJsDefault = parcelHelpers.interopDefault(_sinebowJs); -var _turboJs = require("./sequential-multi/turbo.js"); -var _turboJsDefault = parcelHelpers.interopDefault(_turboJs); -var _viridisJs = require("./sequential-multi/viridis.js"); -var _viridisJsDefault = parcelHelpers.interopDefault(_viridisJs); - -},{"./categorical/category10.js":"73dmt","./categorical/Accent.js":"354VI","./categorical/Dark2.js":"lRzjC","./categorical/observable10.js":"ji8JB","./categorical/Paired.js":"jDu6h","./categorical/Pastel1.js":"a9HVC","./categorical/Pastel2.js":"fqsx7","./categorical/Set1.js":"j2h0u","./categorical/Set2.js":"iGz31","./categorical/Set3.js":"Vc4dj","./categorical/Tableau10.js":false,"./diverging/BrBG.js":false,"./diverging/PRGn.js":false,"./diverging/PiYG.js":false,"./diverging/PuOr.js":false,"./diverging/RdBu.js":false,"./diverging/RdGy.js":false,"./diverging/RdYlBu.js":false,"./diverging/RdYlGn.js":false,"./diverging/Spectral.js":false,"./sequential-multi/BuGn.js":false,"./sequential-multi/BuPu.js":false,"./sequential-multi/GnBu.js":false,"./sequential-multi/OrRd.js":false,"./sequential-multi/PuBuGn.js":false,"./sequential-multi/PuBu.js":false,"./sequential-multi/PuRd.js":false,"./sequential-multi/RdPu.js":false,"./sequential-multi/YlGnBu.js":false,"./sequential-multi/YlGn.js":false,"./sequential-multi/YlOrBr.js":false,"./sequential-multi/YlOrRd.js":false,"./sequential-single/Blues.js":false,"./sequential-single/Greens.js":false,"./sequential-single/Greys.js":false,"./sequential-single/Purples.js":false,"./sequential-single/Reds.js":false,"./sequential-single/Oranges.js":false,"./sequential-multi/cividis.js":false,"./sequential-multi/cubehelix.js":false,"./sequential-multi/rainbow.js":false,"./sequential-multi/sinebow.js":false,"./sequential-multi/turbo.js":false,"./sequential-multi/viridis.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73dmt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eXXy7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specifier) { - var n = specifier.length / 6 | 0, colors = new Array(n), i = 0; - while(i < n)colors[i] = "#" + specifier.slice(i * 6, ++i * 6); - return colors; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"354VI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lRzjC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ji8JB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jDu6h":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a9HVC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fqsx7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2h0u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iGz31":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Vc4dj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fpesP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "axisticks", ()=>AxisTicks); -parcelHelpers.export(exports, "datajoin", ()=>DataJoin); -parcelHelpers.export(exports, "encode", ()=>Encode); -parcelHelpers.export(exports, "legendentries", ()=>LegendEntries); -parcelHelpers.export(exports, "linkpath", ()=>LinkPath); -parcelHelpers.export(exports, "pie", ()=>Pie); -parcelHelpers.export(exports, "scale", ()=>Scale); -parcelHelpers.export(exports, "sortitems", ()=>SortItems); -parcelHelpers.export(exports, "stack", ()=>Stack); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScale = require("vega-scale"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -/** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function AxisTicks(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(AxisTicks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), ticks = this.value, scale = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count = (0, _vegaScale.tickCount)(scale, tally, _.minstep), format = _.format || (0, _vegaScale.tickFormat)(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), values = _.values ? (0, _vegaScale.validTicks)(scale, _.values, count) : (0, _vegaScale.tickValues)(scale, count); - if (ticks) out.rem = ticks; - ticks = values.map((value, i)=>(0, _vegaDataflow.ingest)({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - })); - if (_.extra && ticks.length) // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push((0, _vegaDataflow.ingest)({ - index: -1, - extra: { - value: ticks[0].value - }, - label: '' - })); - out.source = ticks; - out.add = ticks; - this.value = ticks; - return out; - } -}); -/** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ function DataJoin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -function defaultItemCreate() { - return (0, _vegaDataflow.ingest)({}); -} -function newMap(key) { - const map = (0, _vegaUtil.fastmap)().test((t)=>t.exit); - map.lookup = (t)=>map.get(key(t)); - return map; -} -(0, _vegaUtil.inherits)(DataJoin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), item = _.item || defaultItemCreate, key = _.key || (0, _vegaDataflow.tupleid), map = this.value; - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if ((0, _vegaUtil.isArray)(out.encode)) out.encode = null; - if (map && (_.modified('key') || pulse.modified(key))) (0, _vegaUtil.error)('DataJoin does not support modified key function or fields.'); - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - let x = map.get(k); - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else out.mod.push(x); - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - x.datum = t; - x.exit = false; - }); - pulse.visit(pulse.MOD, (t)=>{ - const k = key(t), x = map.get(k); - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - pulse.visit(pulse.REM, (t)=>{ - const k = key(t), x = map.get(k); - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) df.runAfter(map.clean); - return out; - } -}); -/** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ function Encode(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Encode, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode = pulse.encode; - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if ((0, _vegaUtil.isArray)(encode)) { - if (out.changed() || encode.every((e)=>encoders[e])) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else return pulse.StopPropagation; - } - // marshall encoder functions - var reenter = encode === 'enter', update = encoders.update || (0, _vegaUtil.falsy), enter = encoders.enter || (0, _vegaUtil.falsy), exit = encoders.exit || (0, _vegaUtil.falsy), set = (encode && !reenter ? encoders[encode] : update) || (0, _vegaUtil.falsy); - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, (t)=>{ - enter(t, _); - update(t, _); - }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== (0, _vegaUtil.falsy) && set !== update) { - pulse.visit(pulse.ADD, (t)=>{ - set(t, _); - }); - out.modifies(set.output); - } - } - if (pulse.changed(pulse.REM) && exit !== (0, _vegaUtil.falsy)) { - pulse.visit(pulse.REM, (t)=>{ - exit(t, _); - }); - out.modifies(exit.output); - } - if (reenter || set !== (0, _vegaUtil.falsy)) { - const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, (t)=>{ - const mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else pulse.visit(flag, (t)=>{ - if (set(t, _) || fmod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(set.output); - } - return out.changed() ? out : pulse.StopPropagation; - } -}); -/** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function LegendEntries(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(LegendEntries, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value != null && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), items = this.value, type = _.type || (0, _vegaScale.SymbolLegend), scale = _.scale, limit = +_.limit, count = (0, _vegaScale.tickCount)(scale, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type === (0, _vegaScale.SymbolLegend), format = _.format || (0, _vegaScale.labelFormat)(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), values = _.values || (0, _vegaScale.labelValues)(scale, count), domain, fraction, size, offset, ellipsis; - if (items) out.rem = items; - if (type === (0, _vegaScale.SymbolLegend)) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else items = values; - if ((0, _vegaUtil.isFunction)(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) items = items.slice(1); - // compute size offset for legend entries - offset = items.reduce((max, value)=>Math.max(max, size(value, _)), 0); - } else size = (0, _vegaUtil.constant)(offset = size || 8); - items = items.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - })); - if (ellipsis) { - ellipsis = values[items.length]; - items.push((0, _vegaDataflow.ingest)({ - index: items.length, - label: `\u2026${values.length - items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } else if (type === (0, _vegaScale.GradientLegend)) { - domain = scale.domain(), fraction = (0, _vegaScale.scaleFraction)(scale, domain[0], (0, _vegaUtil.peek)(domain)); - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== (0, _vegaUtil.peek)(domain)) values = [ - domain[0], - (0, _vegaUtil.peek)(domain) - ]; - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - })); - } else { - size = values.length - 1; - fraction = (0, _vegaScale.labelFraction)(scale); - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index + 1]) - })); - } - out.source = items; - out.add = items; - this.value = items; - return out; - } -}); -const sourceX = (t)=>t.source.x; -const sourceY = (t)=>t.source.y; -const targetX = (t)=>t.target.x; -const targetY = (t)=>t.target.y; -/** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ function LinkPath(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sourceX', - 'type': 'field', - 'default': 'source.x' - }, - { - 'name': 'sourceY', - 'type': 'field', - 'default': 'source.y' - }, - { - 'name': 'targetX', - 'type': 'field', - 'default': 'target.x' - }, - { - 'name': 'targetY', - 'type': 'field', - 'default': 'target.y' - }, - { - 'name': 'orient', - 'type': 'enum', - 'default': 'vertical', - 'values': [ - 'horizontal', - 'vertical', - 'radial' - ] - }, - { - 'name': 'shape', - 'type': 'enum', - 'default': 'line', - 'values': [ - 'line', - 'arc', - 'curve', - 'diagonal', - 'orthogonal' - ] - }, - { - 'name': 'require', - 'type': 'signal' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(LinkPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx = _.targetX || targetX, ty = _.targetY || targetY, as = _.as || 'path', orient = _.orient || 'vertical', shape = _.shape || 'line', path = Paths.get(shape + '-' + orient) || Paths.get(shape); - if (!path) (0, _vegaUtil.error)('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : '')); - pulse.visit(pulse.SOURCE, (t)=>{ - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - return pulse.reflow(_.modified()).modifies(as); - } -}); -const line = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'L' + tx + ',' + ty; -const lineR = (sa, sr, ta, tr)=>line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const arc = (sx, sy, tx, ty)=>{ - var dx = tx - sx, dy = ty - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty; -}; -const arcR = (sa, sr, ta, tr)=>arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const curve = (sx, sy, tx, ty)=>{ - const dx = tx - sx, dy = ty - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty; -}; -const curveR = (sa, sr, ta, tr)=>curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const orthoX = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'V' + ty + 'H' + tx; -const orthoY = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'H' + tx + 'V' + ty; -const orthoR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts; -}; -const diagonalX = (sx, sy, tx, ty)=>{ - const m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty; -}; -const diagonalY = (sx, sy, tx, ty)=>{ - const m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty; -}; -const diagonalR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), mr = (sr + tr) / 2; - return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts; -}; -const Paths = (0, _vegaUtil.fastmap)({ - 'line': line, - 'line-radial': lineR, - 'arc': arc, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR -}); -/** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ function Pie(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Pie.Definition = { - 'type': 'Pie', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'startAngle', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'endAngle', - 'type': 'number', - 'default': 6.283185307179586 - }, - { - 'name': 'sort', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'startAngle', - 'endAngle' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Pie, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || [ - 'startAngle', - 'endAngle' - ], startAngle = as[0], endAngle = as[1], field = _.field || (0, _vegaUtil.one), start = _.startAngle || 0, stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, data = pulse.source, values = data.map(field), n = values.length, a = start, k = (stop - start) / (0, _d3Array.sum)(values), index = (0, _d3Array.range)(n), i, t, v; - if (_.sort) index.sort((a, b)=>values[a] - values[b]); - for(i = 0; i < n; ++i){ - v = values[index[i]]; - t = data[index[i]]; - t[startAngle] = a; - t[endAngle] = a += v * k; - } - this.value = values; - return pulse.reflow(_.modified()).modifies(as); - } -}); -const DEFAULT_COUNT = 5; -function includeZero(scale) { - const type = scale.type; - return !scale.bins && (type === (0, _vegaScale.Linear) || type === (0, _vegaScale.Pow) || type === (0, _vegaScale.Sqrt)); -} -function includePad(type) { - return (0, _vegaScale.isContinuous)(type) && type !== (0, _vegaScale.Sequential); -} -const SKIP = (0, _vegaUtil.toSet)([ - 'set', - 'modified', - 'clear', - 'type', - 'scheme', - 'schemeExtent', - 'schemeCount', - 'domain', - 'domainMin', - 'domainMid', - 'domainMax', - 'domainRaw', - 'domainImplicit', - 'nice', - 'zero', - 'bins', - 'range', - 'rangeStep', - 'round', - 'reverse', - 'interpolate', - 'interpolateGamma' -]); -/** - * Maintains a scale function mapping data values to visual channels. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Scale(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Scale, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, scale$1 = this.value, key = scaleKey(_); - if (!scale$1 || key !== scale$1.type) this.value = scale$1 = (0, _vegaScale.scale)(key)(); - for(key in _)if (!SKIP[key]) { - // padding is a scale property for band/point but not others - if (key === 'padding' && includePad(scale$1.type)) continue; - // invoke scale property setter, raise warning if not found - (0, _vegaUtil.isFunction)(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key); - } - configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df))); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function scaleKey(_) { - var t = _.type, d = '', n; - // backwards compatibility pre Vega 5. - if (t === (0, _vegaScale.Sequential)) return (0, _vegaScale.Sequential) + '-' + (0, _vegaScale.Linear); - if (isContinuousColor(_)) { - n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; - d = n === 2 ? (0, _vegaScale.Sequential) + '-' : n === 3 ? (0, _vegaScale.Diverging) + '-' : ''; + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), rescale()) : domain2.slice(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); + }; + scale2.rangeRound = function(_) { + return range2 = Array.from(_), interpolate2 = interpolateRound, rescale(); + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = _ ? true : identity$3, rescale()) : clamp2 !== identity$3; + }; + scale2.interpolate = function(_) { + return arguments.length ? (interpolate2 = _, rescale()) : interpolate2; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + return function(t, u2) { + transform2 = t, untransform = u2; + return rescale(); + }; + } + function continuous$1() { + return transformer$3()(identity$3, identity$3); + } + function tickFormat$1(start, stop2, count2, specifier) { + var step = tickStep(start, stop2, count2), precision; + specifier = formatSpecifier(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value2 = Math.max(Math.abs(start), Math.abs(stop2)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value2))) specifier.precision = precision; + return formatPrefix(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop2))))) specifier.precision = precision - (specifier.type === "e"); + break; + } + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; + break; + } } - return (d + t || (0, _vegaScale.Linear)).toLowerCase(); -} -function isContinuousColor(_) { - const t = _.type; - return (0, _vegaScale.isContinuous)(t) && t !== (0, _vegaScale.Time) && t !== (0, _vegaScale.UTC) && (_.scheme || _.range && _.range.length && _.range.every((0, _vegaUtil.isString))); -} -function configureDomain(scale, _, df) { - // check raw domain, if provided use that and exit early - const raw = rawDomain(scale, _.domainRaw, df); - if (raw > -1) return raw; - var domain = _.domain, type = scale.type, zero = _.zero || _.zero === undefined && includeZero(scale), n, mid; - if (!domain) return 0; - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = (domain = domain.slice()).length - 1 || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== (0, _vegaUtil.peek)(domain)) domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === (0, _vegaScale.Ordinal)) scale.unknown(_.domainImplicit ? (0, _vegaScale.scaleImplicit) : undefined); - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) scale.nice(_.nice !== true && (0, _vegaScale.tickCount)(scale, _.nice) || null); - // return the cardinality of the domain - return domain.length; -} -function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else return -1; -} -function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs((0, _vegaUtil.peek)(range) - range[0]), frac = span / (span - 2 * pad), d = type === (0, _vegaScale.Log) ? (0, _vegaUtil.zoomLog)(domain, null, frac) : type === (0, _vegaScale.Sqrt) ? (0, _vegaUtil.zoomPow)(domain, null, frac, 0.5) : type === (0, _vegaScale.Pow) ? (0, _vegaUtil.zoomPow)(domain, null, frac, exponent || 1) : type === (0, _vegaScale.Symlog) ? (0, _vegaUtil.zoomSymlog)(domain, null, frac, constant || 1) : (0, _vegaUtil.zoomLinear)(domain, null, frac); - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length - 1] = d[1]; - return domain; -} -function domainCheck(type, domain, df) { - if ((0, _vegaScale.isLogarithmic)(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce((s, v)=>s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); - if (s !== domain.length) df.warn('Log scale domain includes zero: ' + (0, _vegaUtil.stringValue)(domain)); - } - return domain; -} -function configureBins(scale, _, count) { - let bins = _.bins; - if (bins && !(0, _vegaUtil.isArray)(bins)) { - // generate bin boundary array - const domain = scale.domain(), lo = domain[0], hi = (0, _vegaUtil.peek)(domain), step = bins.step; - let start = bins.start == null ? lo : bins.start, stop = bins.stop == null ? hi : bins.stop; - if (!step) (0, _vegaUtil.error)('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = (0, _d3Array.range)(start, stop + step / 2, step); - } - if (bins) // assign bin boundaries to scale instance - scale.bins = bins; - else if (scale.bins) // no current bins, remove bins if previously set - delete scale.bins; - // special handling for bin-ordinal scales - if (scale.type === (0, _vegaScale.BinOrdinal)) { - if (!bins) // the domain specifies the bins - scale.bins = scale.domain(); - else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - // return domain cardinality - return count; -} -function configureRange(scale, _, count) { - var type = scale.type, round = _.round || false, range = _.range; - // if range step specified, calculate full range extent - if (_.rangeStep != null) range = configureRangeStep(type, _, count); - else if (_.scheme) { - range = configureScheme(type, _, count); - if ((0, _vegaUtil.isFunction)(range)) { - if (scale.interpolator) return scale.interpolator(range); - else (0, _vegaUtil.error)(`Scale type ${type} does not support interpolating color schemes.`); - } - } - // given a range array for an interpolating scale, convert to interpolator - if (range && (0, _vegaScale.isInterpolating)(type)) return scale.interpolator((0, _vegaScale.interpolateColors)(flip(range, _.reverse), _.interpolate, _.interpolateGamma)); - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) scale.interpolate((0, _vegaScale.interpolate)(_.interpolate, _.interpolateGamma)); - else if ((0, _vegaUtil.isFunction)(scale.round)) scale.round(round); - else if ((0, _vegaUtil.isFunction)(scale.rangeRound)) scale.interpolate(round ? (0, _d3Interpolate.interpolateRound) : (0, _d3Interpolate.interpolate)); - if (range) scale.range(flip(range, _.reverse)); -} -function configureRangeStep(type, _, count) { - if (type !== (0, _vegaScale.Band) && type !== (0, _vegaScale.Point)) (0, _vegaUtil.error)('Only band and point scales support rangeStep.'); - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type === (0, _vegaScale.Point) ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; - return [ - 0, - _.rangeStep * (0, _vegaScale.bandSpace)(count, inner, outer) - ]; -} -function configureScheme(type, _, count) { - var extent = _.schemeExtent, name, scheme$1; - if ((0, _vegaUtil.isArray)(_.scheme)) scheme$1 = (0, _vegaScale.interpolateColors)(_.scheme, _.interpolate, _.interpolateGamma); - else { - name = _.scheme.toLowerCase(); - scheme$1 = (0, _vegaScale.scheme)(name); - if (!scheme$1) (0, _vegaUtil.error)(`Unrecognized scheme name: ${_.scheme}`); - } - // determine size for potential discrete range - count = type === (0, _vegaScale.Threshold) ? count + 1 : type === (0, _vegaScale.BinOrdinal) ? count - 1 : type === (0, _vegaScale.Quantile) || type === (0, _vegaScale.Quantize) ? +_.schemeCount || DEFAULT_COUNT : count; - // adjust and/or quantize scheme as appropriate - return (0, _vegaScale.isInterpolating)(type) ? adjustScheme(scheme$1, extent, _.reverse) : (0, _vegaUtil.isFunction)(scheme$1) ? (0, _vegaScale.quantizeInterpolator)(adjustScheme(scheme$1, extent), count) : type === (0, _vegaScale.Ordinal) ? scheme$1 : scheme$1.slice(0, count); -} -function adjustScheme(scheme, extent, reverse) { - return (0, _vegaUtil.isFunction)(scheme) && (extent || reverse) ? (0, _vegaScale.interpolateRange)(scheme, flip(extent || [ - 0, - 1 - ], reverse)) : scheme; -} -function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; -} -/** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ function SortItems(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(SortItems, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum'); - if (mod) pulse.source.sort((0, _vegaDataflow.stableCompare)(_.sort)); - this.modified(mod); - return pulse; - } -}); -const Zero = 'zero', Center = 'center', Normalize = 'normalize', DefOutput = [ - 'y0', - 'y1' -]; -/** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ function Stack(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stack.Definition = { - 'type': 'Stack', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'offset', - 'type': 'enum', - 'default': Zero, - 'values': [ - Zero, - Center, - Normalize - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': DefOutput - } - ] -}; -(0, _vegaUtil.inherits)(Stack, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || DefOutput, y0 = as[0], y1 = as[1], sort = (0, _vegaDataflow.stableCompare)(_.sort), field = _.field || (0, _vegaUtil.one), stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max; - // partition, sum, and sort the stack groups - groups = partition(pulse.source, _.groupby, sort, field); - // compute stack layouts per group - for(i = 0, n = groups.length, max = groups.max; i < n; ++i)stack(groups[i], max, field, y0, y1); - return pulse.reflow(_.modified()).modifies(as); - } -}); -function stackCenter(group, max, field, y0, y1) { - var last = (max - group.sum) / 2, m = group.length, j = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last += Math.abs(field(t)); - } -} -function stackNormalize(group, max, field, y0, y1) { - var scale = 1 / group.sum, last = 0, m = group.length, j = 0, v = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last = scale * (v += Math.abs(field(t))); - } -} -function stackZero(group, max, field, y0, y1) { - var lastPos = 0, lastNeg = 0, m = group.length, j = 0, v, t; - for(; j < m; ++j){ - t = group[j]; - v = +field(t); - if (v < 0) { - t[y0] = lastNeg; - t[y1] = lastNeg += v; + return format$3(specifier); + } + function linearish(scale2) { + var domain2 = scale2.domain; + scale2.ticks = function(count2) { + var d = domain2(); + return ticks(d[0], d[d.length - 1], count2 == null ? 10 : count2); + }; + scale2.tickFormat = function(count2, specifier) { + var d = domain2(); + return tickFormat$1(d[0], d[d.length - 1], count2 == null ? 10 : count2, specifier); + }; + scale2.nice = function(count2) { + if (count2 == null) count2 = 10; + var d = domain2(); + var i0 = 0; + var i1 = d.length - 1; + var start = d[i0]; + var stop2 = d[i1]; + var prestep; + var step; + var maxIter = 10; + if (stop2 < start) { + step = start, start = stop2, stop2 = step; + step = i0, i0 = i1, i1 = step; + } + while (maxIter-- > 0) { + step = tickIncrement(start, stop2, count2); + if (step === prestep) { + d[i0] = start; + d[i1] = stop2; + return domain2(d); + } else if (step > 0) { + start = Math.floor(start / step) * step; + stop2 = Math.ceil(stop2 / step) * step; + } else if (step < 0) { + start = Math.ceil(start * step) / step; + stop2 = Math.floor(stop2 * step) / step; } else { - t[y0] = lastPos; - t[y1] = lastPos += v; - } - } -} -function partition(data, groupby, sort, field) { - var groups = [], get = (f)=>f(t), map, i, n, m, t, k, g, s, max; - // partition data points into stack groups - if (groupby == null) groups.push(data.slice()); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - groups.push(g); + break; } - g.push(t); - } - // compute sums of groups, sort groups as needed - for(k = 0, max = 0, m = groups.length; k < m; ++k){ - g = groups[k]; - for(i = 0, s = 0, n = g.length; i < n; ++i)s += Math.abs(field(g[i])); - g.sum = s; - if (s > max) max = s; - if (sort) g.sort(sort); + prestep = step; + } + return scale2; + }; + return scale2; + } + function linear() { + var scale2 = continuous$1(); + scale2.copy = function() { + return copy$7(scale2, linear()); + }; + initRange.apply(scale2, arguments); + return linearish(scale2); + } + function identity$2(domain2) { + var unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : x2; } - groups.max = max; - return groups; -} - -},{"vega-dataflow":"3NitK","vega-scale":"bEydG","vega-util":"bApja","d3-array":"6IwJG","d3-interpolate":"6gbPP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rF9B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "contour", ()=>Contour); -parcelHelpers.export(exports, "geojson", ()=>GeoJSON); -parcelHelpers.export(exports, "geopath", ()=>GeoPath); -parcelHelpers.export(exports, "geopoint", ()=>GeoPoint); -parcelHelpers.export(exports, "geoshape", ()=>GeoShape); -parcelHelpers.export(exports, "graticule", ()=>Graticule); -parcelHelpers.export(exports, "heatmap", ()=>Heatmap); -parcelHelpers.export(exports, "isocontour", ()=>Isocontour); -parcelHelpers.export(exports, "kde2d", ()=>KDE2D); -parcelHelpers.export(exports, "projection", ()=>Projection); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _vegaStatistics = require("vega-statistics"); -var _vegaProjection = require("vega-projection"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaCanvas = require("vega-canvas"); -function noop() {} -const cases = [ - [], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ], - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ], - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [] -]; -// Implementation adapted from d3/d3-contour. Thanks! -function contours() { - var dx = 1, dy = 1, smooth = smoothLinear; - function contours(values, tz) { - return tz.map((value)=>contour(values, value)); - } - // Accumulate, smooth contour rings, assign holes to exterior rings. - // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js - function contour(values, value) { - var polygons = [], holes = []; - isorings(values, value, (ring)=>{ - smooth(ring, values, value); - if (area(ring) > 0) polygons.push([ - ring - ]); - else holes.push(ring); - }); - holes.forEach((hole)=>{ - for(var i = 0, n = polygons.length, polygon; i < n; ++i)if (contains((polygon = polygons[i])[0], hole) !== -1) { - polygon.push(hole); - return; - } - }); - return { - type: 'MultiPolygon', - value: value, - coordinates: polygons - }; + scale2.invert = scale2; + scale2.domain = scale2.range = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), scale2) : domain2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return identity$2(domain2).unknown(unknown); + }; + domain2 = arguments.length ? Array.from(domain2, number$5) : [0, 1]; + return linearish(scale2); + } + function nice(domain2, interval2) { + domain2 = domain2.slice(); + var i0 = 0, i1 = domain2.length - 1, x02 = domain2[i0], x12 = domain2[i1], t; + if (x12 < x02) { + t = i0, i0 = i1, i1 = t; + t = x02, x02 = x12, x12 = t; + } + domain2[i0] = interval2.floor(x02); + domain2[i1] = interval2.ceil(x12); + return domain2; + } + function transformLog(x2) { + return Math.log(x2); + } + function transformExp(x2) { + return Math.exp(x2); + } + function transformLogn(x2) { + return -Math.log(-x2); + } + function transformExpn(x2) { + return -Math.exp(-x2); + } + function pow10(x2) { + return isFinite(x2) ? +("1e" + x2) : x2 < 0 ? 0 : x2; + } + function powp(base2) { + return base2 === 10 ? pow10 : base2 === Math.E ? Math.exp : (x2) => Math.pow(base2, x2); + } + function logp(base2) { + return base2 === Math.E ? Math.log : base2 === 10 && Math.log10 || base2 === 2 && Math.log2 || (base2 = Math.log(base2), (x2) => Math.log(x2) / base2); + } + function reflect(f) { + return (x2, k) => -f(-x2, k); + } + function loggish(transform2) { + const scale2 = transform2(transformLog, transformExp); + const domain2 = scale2.domain; + let base2 = 10; + let logs; + let pows; + function rescale() { + logs = logp(base2), pows = powp(base2); + if (domain2()[0] < 0) { + logs = reflect(logs), pows = reflect(pows); + transform2(transformLogn, transformExpn); + } else { + transform2(transformLog, transformExp); + } + return scale2; + } + scale2.base = function(_) { + return arguments.length ? (base2 = +_, rescale()) : base2; + }; + scale2.domain = function(_) { + return arguments.length ? (domain2(_), rescale()) : domain2(); + }; + scale2.ticks = (count2) => { + const d = domain2(); + let u2 = d[0]; + let v = d[d.length - 1]; + const r = v < u2; + if (r) [u2, v] = [v, u2]; + let i = logs(u2); + let j = logs(v); + let k; + let t; + const n = count2 == null ? 10 : +count2; + let z = []; + if (!(base2 % 1) && j - i < n) { + i = Math.floor(i), j = Math.ceil(j); + if (u2 > 0) for (; i <= j; ++i) { + for (k = 1; k < base2; ++k) { + t = i < 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z.push(t); + } + } + else for (; i <= j; ++i) { + for (k = base2 - 1; k >= 1; --k) { + t = i > 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z.push(t); + } + } + if (z.length * 2 < n) z = ticks(u2, v, n); + } else { + z = ticks(i, j, Math.min(j - i, n)).map(pows); + } + return r ? z.reverse() : z; + }; + scale2.tickFormat = (count2, specifier) => { + if (count2 == null) count2 = 10; + if (specifier == null) specifier = base2 === 10 ? "s" : ","; + if (typeof specifier !== "function") { + if (!(base2 % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true; + specifier = format$3(specifier); + } + if (count2 === Infinity) return specifier; + const k = Math.max(1, base2 * count2 / scale2.ticks().length); + return (d) => { + let i = d / pows(Math.round(logs(d))); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k ? specifier(d) : ""; + }; + }; + scale2.nice = () => { + return domain2(nice(domain2(), { + floor: (x2) => pows(Math.floor(logs(x2))), + ceil: (x2) => pows(Math.ceil(logs(x2))) + })); + }; + return scale2; + } + function log$2() { + const scale2 = loggish(transformer$3()).domain([1, 10]); + scale2.copy = () => copy$7(scale2, log$2()).base(scale2.base()); + initRange.apply(scale2, arguments); + return scale2; + } + function transformSymlog(c2) { + return function(x2) { + return Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); + }; + } + function transformSymexp(c2) { + return function(x2) { + return Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + }; + } + function symlogish(transform2) { + var c2 = 1, scale2 = transform2(transformSymlog(c2), transformSymexp(c2)); + scale2.constant = function(_) { + return arguments.length ? transform2(transformSymlog(c2 = +_), transformSymexp(c2)) : c2; + }; + return linearish(scale2); + } + function symlog() { + var scale2 = symlogish(transformer$3()); + scale2.copy = function() { + return copy$7(scale2, symlog()).constant(scale2.constant()); + }; + return initRange.apply(scale2, arguments); + } + function transformPow(exponent2) { + return function(x2) { + return x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); + }; + } + function transformSqrt(x2) { + return x2 < 0 ? -Math.sqrt(-x2) : Math.sqrt(x2); + } + function transformSquare(x2) { + return x2 < 0 ? -x2 * x2 : x2 * x2; + } + function powish(transform2) { + var scale2 = transform2(identity$3, identity$3), exponent2 = 1; + function rescale() { + return exponent2 === 1 ? transform2(identity$3, identity$3) : exponent2 === 0.5 ? transform2(transformSqrt, transformSquare) : transform2(transformPow(exponent2), transformPow(1 / exponent2)); } - // Marching squares with isolines stitched into rings. - // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = [], fragmentByEnd = [], x, y, t0, t1, t2, t3; - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - // General case for the intermediate rows. - while(++y < dy - 1){ - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - function stitch(line) { - var start = [ - line[0][0] + x, - line[0][1] + y - ], end = [ - line[1][0] + x, - line[1][1] + y - ], startIndex = index(start), endIndex = index(end), f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[f.start] = fragmentByEnd[g.end] = { - start: f.start, - end: g.end, - ring: f.ring.concat(g.ring) - }; - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[g.start] = fragmentByEnd[f.end] = { - start: g.start, - end: f.end, - ring: g.ring.concat(f.ring) - }; - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { - start: startIndex, - end: endIndex, - ring: [ - start, - end - ] - }; - } + scale2.exponent = function(_) { + return arguments.length ? (exponent2 = +_, rescale()) : exponent2; + }; + return linearish(scale2); + } + function pow$2() { + var scale2 = powish(transformer$3()); + scale2.copy = function() { + return copy$7(scale2, pow$2()).exponent(scale2.exponent()); + }; + initRange.apply(scale2, arguments); + return scale2; + } + function sqrt$2() { + return pow$2.apply(null, arguments).exponent(0.5); + } + function quantile() { + var domain2 = [], range2 = [], thresholds = [], unknown; + function rescale() { + var i = 0, n = Math.max(1, range2.length); + thresholds = new Array(n - 1); + while (++i < n) thresholds[i - 1] = quantileSorted(domain2, i / n); + return scale2; } - function index(point) { - return point[0] * 2 + point[1] * (dx + 1) * 4; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : range2[bisectRight$1(thresholds, x2)]; } - function smoothLinear(ring, values, value) { - ring.forEach((point)=>{ - var x = point[0], y = point[1], xt = x | 0, yt = y | 0, v0, v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : [ + i > 0 ? thresholds[i - 1] : domain2[0], + i < thresholds.length ? thresholds[i] : domain2[domain2.length - 1] + ]; + }; + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = []; + for (let d of _) if (d != null && !isNaN(d = +d)) domain2.push(d); + domain2.sort(ascending$1); + return rescale(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.quantiles = function() { + return thresholds.slice(); + }; + scale2.copy = function() { + return quantile().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + function quantize$1() { + var x02 = 0, x12 = 1, n = 1, domain2 = [0.5], range2 = [0, 1], unknown; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; } - contours.contour = contour; - contours.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, contours; - }; - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear; - }; - return contours; -} -function area(ring) { - var i = 0, n = ring.length, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while(++i < n)area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; -} -function contains(ring, hole) { - var i = -1, n = hole.length, c; - while(++i < n)if (c = ringContains(ring, hole[i])) return c; - return 0; -} -function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for(var i = 0, n = ring.length, j = n - 1; i < n; j = i++){ - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains; - } - return contains; -} -function segmentContains(a, b, c) { - var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} -function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; -} -function quantize(k, nice, zero) { - return function(values) { - var ex = (0, _vegaUtil.extent)(values), start = zero ? Math.min(ex[0], 0) : ex[0], stop = ex[1], span = stop - start, step = nice ? (0, _d3Array.tickStep)(start, stop, k) : span / (k + 1); - return (0, _d3Array.range)(start + step, stop, step); - }; -} -/** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ function Isocontour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'levels', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'zero', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'scale', - 'type': 'number', - 'expr': true - }, - { - 'name': 'translate', - 'type': 'number', - 'array': true, - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'default': 'contour' - } - ] -}; -(0, _vegaUtil.inherits)(Isocontour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, field = _.field || (0, _vegaUtil.identity), contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source, field, _), as = _.as === null ? null : _.as || 'contour', values = []; - source.forEach((t)=>{ - const grid = field(t); - // generate contour paths in GeoJSON format - const paths = contour.size([ - grid.width, - grid.height - ])(grid.values, (0, _vegaUtil.isArray)(tz) ? tz : tz(grid.values)); - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - // ingest; copy source data properties to output - paths.forEach((p)=>{ - values.push((0, _vegaDataflow.rederive)(t, (0, _vegaDataflow.ingest)(as != null ? { - [as]: p - } : p))); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; + function rescale() { + var i = -1; + domain2 = new Array(n); + while (++i < n) domain2[i] = ((i + 1) * x12 - (i - n) * x02) / (n + 1); + return scale2; } -}); -function levels(values, f, _) { - const q = quantize(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' ? q : q(values.map((t)=>(0, _d3Array.max)(f(t).values))); -} -function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, t = _.translate || grid.translate; - if ((0, _vegaUtil.isFunction)(s)) s = s(datum, _); - if ((0, _vegaUtil.isFunction)(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - const sx = ((0, _vegaUtil.isNumber)(s) ? s : s[0]) || 1, sy = ((0, _vegaUtil.isNumber)(s) ? s : s[1]) || 1, tx = t && t[0] || 0, ty = t && t[1] || 0; - paths.forEach(transform(grid, sx, sy, tx, ty)); -} -function transform(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, y1 = grid.y1 || 0, flip = sx * sy < 0; - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, x02 = +x02, x12 = +x12, rescale()) : [x02, x12]; + }; + scale2.range = function(_) { + return arguments.length ? (n = (range2 = Array.from(_)).length - 1, rescale()) : range2.slice(); + }; + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : i < 1 ? [x02, domain2[0]] : i >= n ? [domain2[n - 1], x12] : [domain2[i - 1], domain2[i]]; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : scale2; + }; + scale2.thresholds = function() { + return domain2.slice(); + }; + scale2.copy = function() { + return quantize$1().domain([x02, x12]).range(range2).unknown(unknown); + }; + return initRange.apply(linearish(scale2), arguments); + } + function threshold() { + var domain2 = [0.5], range2 = [0, 1], unknown, n = 1; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; } - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : domain2.slice(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : range2.slice(); + }; + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return [domain2[i - 1], domain2[i]]; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return threshold().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + function date(t) { + return new Date(t); + } + function number$4(t) { + return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t); + } + function calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2) { + var scale2 = continuous$1(), invert2 = scale2.invert, domain2 = scale2.domain; + var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear2 = format2("%Y"); + function tickFormat2(date2) { + return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week2(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2); } - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; + scale2.invert = function(y2) { + return new Date(invert2(y2)); + }; + scale2.domain = function(_) { + return arguments.length ? domain2(Array.from(_, number$4)) : domain2().map(date); + }; + scale2.ticks = function(interval2) { + var d = domain2(); + return ticks2(d[0], d[d.length - 1], interval2 == null ? 10 : interval2); + }; + scale2.tickFormat = function(count2, specifier) { + return specifier == null ? tickFormat2 : format2(specifier); + }; + scale2.nice = function(interval2) { + var d = domain2(); + if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval(d[0], d[d.length - 1], interval2 == null ? 10 : interval2); + return interval2 ? domain2(nice(d, interval2)) : scale2; + }; + scale2.copy = function() { + return copy$7(scale2, calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2)); + }; + return scale2; + } + function time$1() { + return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat$1).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); + } + function utcTime() { + return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat$1).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); + } + function transformer$2() { + var x02 = 0, x12 = 1, t02, t12, k10, transform2, interpolator = identity$3, clamp2 = false, unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : interpolator(k10 === 0 ? 0.5 : (x2 = (transform2(x2) - t02) * k10, clamp2 ? Math.max(0, Math.min(1, x2)) : x2)); } - return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02), scale2) : [x02, x12]; }; -} -function radius(bw, data, f) { - const v = bw >= 0 ? bw : (0, _vegaStatistics.bandwidthNRD)(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); -} -function number(_) { - return (0, _vegaUtil.isFunction)(_) ? _ : (0, _vegaUtil.constant)(+_); -} -// Implementation adapted from d3/d3-contour. Thanks! -function density2D() { - var x = (d)=>d[0], y = (d)=>d[1], weight = (0, _vegaUtil.one), bandwidth = [ - -1, - -1 - ], dx = 960, dy = 500, k = 2; // log2(cellSize) - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), values1 = new Float32Array(n * m); - let values = values0; - data.forEach((d)=>{ - const xi = ox + (+x(d) >> k), yi = oy + (+y(d) >> k); - if (xi >= 0 && xi < n && yi >= 0 && yi < m) values0[xi + yi * n] += +weight(d); - }); - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - // scale density estimates - // density in points per square pixel or probability density - const s = counts ? Math.pow(2, -2 * k) : 1 / (0, _d3Array.sum)(values); - for(let i = 0, sz = n * m; i < sz; ++i)values[i] *= s; - return { - values: values, - scale: 1 << k, - width: n, - height: m, - x1: ox, - y1: oy, - x2: ox + (dx >> k), - y2: oy + (dy >> k) - }; - } - density.x = function(_) { - return arguments.length ? (x = number(_), density) : x; - }; - density.y = function(_) { - return arguments.length ? (y = number(_), density) : y; - }; - density.weight = function(_) { - return arguments.length ? (weight = number(_), density) : weight; - }; - density.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, density; - }; - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) (0, _vegaUtil.error)('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = (0, _vegaUtil.array)(_); - if (_.length === 1) _ = [ - +_[0], - +_[0] - ]; - if (_.length !== 2) (0, _vegaUtil.error)('invalid bandwidth'); - return bandwidth = _, density; - }; - return density; -} -function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let j = 0; j < m; ++j)for(let i = 0, sr = 0; i < n + r; ++i){ - if (i < n) sr += source[i + j * n]; - if (i >= r) { - if (i >= w) sr -= source[i - w + j * n]; - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } -} -function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let i = 0; i < n; ++i)for(let j = 0, sr = 0; j < m + r; ++j){ - if (j < m) sr += source[i + j * n]; - if (j >= r) { - if (j >= w) sr -= source[i + (j - w) * n]; - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } -} -/** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array<number>} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ function KDE2D(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'grid' - } - ] -}; -const PARAMS = [ - 'x', - 'y', - 'weight', - 'size', - 'cellSize', - 'bandwidth' -]; -function params(obj, _) { - PARAMS.forEach((param)=>_[param] != null ? obj[param](_[param]) : 0); - return obj; -} -(0, _vegaUtil.inherits)(KDE2D, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), kde = params(density2D(), _), as = _.as || 'grid', values = []; - function set(t, vals) { - for(let i = 0; i < names.length; ++i)t[names[i]] = vals[i]; - return t; - } - // generate density raster grids - values = groups.map((g)=>(0, _vegaDataflow.ingest)(set({ - [as]: kde(g, _.counts) - }, g.dims))); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; - } -}); -function partition(data, groupby) { - var groups = [], get = (f)=>f(t), map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - g.push(t); - } - return groups; -} -/** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array<number>} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ function Contour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Contour.Definition = { - 'type': 'Contour', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'values', - 'type': 'number', - 'array': true - }, - { - 'name': 'x', - 'type': 'field' - }, - { - 'name': 'y', - 'type': 'field' - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number' - }, - { - 'name': 'count', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - } - ] -}; -(0, _vegaUtil.inherits)(Contour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values), size = _.size, grid, post; - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [ - grid.width, - grid.height - ]; - values = grid.values; - } - thresh = (0, _vegaUtil.isArray)(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map((0, _vegaDataflow.ingest)); - return out; - } -}); -const Feature = 'Feature'; -const FeatureCollection = 'FeatureCollection'; -const MultiPoint = 'MultiPoint'; -/** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ function GeoJSON(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'length': 2 - }, - { - 'name': 'geojson', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(GeoJSON, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var features = this._features, points = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && (0, _vegaUtil.identity), flag = pulse.ADD, mod; - mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(geojson)) || lon && pulse.modified((0, _vegaUtil.accessorFields)(lon)) || lat && pulse.modified((0, _vegaUtil.accessorFields)(lat)); - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = features = []; - this._points = points = []; - } - if (geojson) pulse.visit(flag, (t)=>features.push(geojson(t))); - if (lon && lat) { - pulse.visit(flag, (t)=>{ - var x = lon(t), y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) points.push([ - x, - y - ]); - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - this.value = { - type: FeatureCollection, - features: features - }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1; + return arguments.length ? ([r0, r1] = _, interpolator = interpolate2(r0, r1), scale2) : [interpolator(0), interpolator(1)]; + }; } -}); -/** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ function GeoPath(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(GeoPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), path = this.value, field = _.field || (0, _vegaUtil.identity), as = _.as || 'path', flag = out.SOURCE; - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = (0, _vegaProjection.getProjectionPath)(_.projection); - out.materialize().reflow(); - } else flag = field === (0, _vegaUtil.identity) || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD; - const prev = initPath(path, _.pointRadius); - out.visit(flag, (t)=>t[as] = path(field(t))); - path.pointRadius(prev); - return out.modifies(as); - } -}); -function initPath(path, pointRadius) { - const prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) path.pointRadius(pointRadius); - return prev; -} -/** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array<function(object): *>} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array<string>} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ function GeoPoint(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection', - 'required': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'x', - 'y' - ] - } - ] -}; -(0, _vegaUtil.inherits)(GeoPoint, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || [ - 'x', - 'y' - ], x = as[0], y = as[1], mod; - function set(t) { - const xy = proj([ - lon(t), - lat(t) - ]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - if (_.modified()) // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - return pulse.modifies(as); - } -}); -/** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ function GeoShape(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': { - 'modifies': true, - 'nomod': true - }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field', - 'default': 'datum' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'shape' - } - ] -}; -(0, _vegaUtil.inherits)(GeoShape, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), shape = this.value, as = _.as || 'shape', flag = out.ADD; - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator((0, _vegaProjection.getProjectionPath)(_.projection), _.field || (0, _vegaUtil.field)('datum'), _.pointRadius); - out.materialize().reflow(); - flag = out.SOURCE; - } - out.visit(flag, (t)=>t[as] = shape); - return out.modifies(as); - } -}); -function shapeGenerator(path, field, pointRadius) { - const shape = pointRadius == null ? (_)=>path(field(_)) : (_)=>{ - var prev = path.pointRadius(), value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = (_)=>{ - path.context(_); - return shape; - }; - return shape; -} -/** - * GeoJSON feature generator for creating graticules. - * @constructor - */ function Graticule(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.generator = (0, _d3Geo.geoGraticule)(); -} -Graticule.Definition = { - 'type': 'Graticule', - 'metadata': { - 'changes': true, - 'generates': true - }, - 'params': [ - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMajor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMinor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'step', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'stepMajor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 90, - 360 - ] - }, - { - 'name': 'stepMinor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 10, - 10 - ] - }, - { - 'name': 'precision', - 'type': 'number', - 'default': 2.5 - } - ] -}; -(0, _vegaUtil.inherits)(Graticule, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var src = this.value, gen = this.generator, t; - if (!src.length || _.modified()) { - for(const prop in _)if ((0, _vegaUtil.isFunction)(gen[prop])) gen[prop](_[prop]); - } - t = gen(); - if (src.length) pulse.mod.push((0, _vegaDataflow.replace)(src[0], t)); - else pulse.add.push((0, _vegaDataflow.ingest)(t)); - src[0] = t; - return pulse; - } -}); -/** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ function Heatmap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'color', - 'type': 'string', - 'expr': true - }, - { - 'name': 'opacity', - 'type': 'number', - 'expr': true - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'image' - } - ] -}; -(0, _vegaUtil.inherits)(Heatmap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.changed() && !_.modified()) return pulse.StopPropagation; - var source = pulse.materialize(pulse.SOURCE).source, shared = _.resolve === 'shared', field = _.field || (0, _vegaUtil.identity), opacity = opacity_(_.opacity, _), color = color_(_.color, _), as = _.as || 'image', obj = { - $x: 0, - $y: 0, - $value: 0, - $max: shared ? (0, _d3Array.max)(source.map((t)=>(0, _d3Array.max)(field(t).values))) : 0 - }; - source.forEach((t)=>{ - const v = field(t); - // build proxy data object - const o = (0, _vegaUtil.extend)({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = (0, _d3Array.max)(v.values || []); - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, color.dep ? color : (0, _vegaUtil.constant)(color(o)), opacity.dep ? opacity : (0, _vegaUtil.constant)(opacity(o))); - }); - return pulse.reflow(true).modifies(as); + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + return function(t) { + transform2 = t, t02 = t(x02), t12 = t(x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02); + return scale2; + }; + } + function copy$6(source2, target2) { + return target2.domain(source2.domain()).interpolator(source2.interpolator()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function sequential() { + var scale2 = linearish(transformer$2()(identity$3)); + scale2.copy = function() { + return copy$6(scale2, sequential()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialLog() { + var scale2 = loggish(transformer$2()).domain([1, 10]); + scale2.copy = function() { + return copy$6(scale2, sequentialLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSymlog() { + var scale2 = symlogish(transformer$2()); + scale2.copy = function() { + return copy$6(scale2, sequentialSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialPow() { + var scale2 = powish(transformer$2()); + scale2.copy = function() { + return copy$6(scale2, sequentialPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSqrt() { + return sequentialPow.apply(null, arguments).exponent(0.5); + } + function transformer$1() { + var x02 = 0, x12 = 0.5, x2 = 1, s = 1, t02, t12, t22, k10, k21, interpolator = identity$3, transform2, clamp2 = false, unknown; + function scale2(x3) { + return isNaN(x3 = +x3) ? unknown : (x3 = 0.5 + ((x3 = +transform2(x3)) - t12) * (s * x3 < s * t12 ? k10 : k21), interpolator(clamp2 ? Math.max(0, Math.min(1, x3)) : x3)); } -}); -// get image color function -function color_(color, _) { - let f; - if ((0, _vegaUtil.isFunction)(color)) { - f = (obj)=>(0, _d3Color.rgb)(color(obj, _)); - f.dep = dependency(color); - } else // default to mid-grey - f = (0, _vegaUtil.constant)((0, _d3Color.rgb)(color || '#888')); - return f; -} -// get image opacity function -function opacity_(opacity, _) { - let f; - if ((0, _vegaUtil.isFunction)(opacity)) { - f = (obj)=>opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) f = (0, _vegaUtil.constant)(opacity); - else { - // default to [0, max] opacity gradient - f = (obj)=>obj.$value / obj.$max || 0; - f.dep = true; + scale2.domain = function(_) { + return arguments.length ? ([x02, x12, x2] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), t22 = transform2(x2 = +x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s = t12 < t02 ? -1 : 1, scale2) : [x02, x12, x2]; + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1, r2; + return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate2, [r0, r1, r2]), scale2) : [interpolator(0), interpolator(0.5), interpolator(1)]; + }; } - return f; -} -// check if function depends on individual pixel data -function dependency(f) { - if (!(0, _vegaUtil.isFunction)(f)) return false; - const set = (0, _vegaUtil.toSet)((0, _vegaUtil.accessorFields)(f)); - return set.$x || set.$y || set.$value || set.$max; -} -// render raster grid to canvas -function toCanvas(grid, obj, color, opacity) { - const n = grid.width, m = grid.height, x1 = grid.x1 || 0, y1 = grid.y1 || 0, x2 = grid.x2 || n, y2 = grid.y2 || m, val = grid.values, value = val ? (i)=>val[i] : (0, _vegaUtil.zero), can = (0, _vegaCanvas.canvas)(x2 - x1, y2 - y1), ctx = can.getContext('2d'), img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), pix = img.data; - for(let j = y1, k = 0; j < y2; ++j){ - obj.$y = j - y1; - for(let i = x1, r = j * n; i < x2; ++i, k += 4){ - obj.$x = i - x1; - obj.$value = value(i + r); - const v = color(obj); - pix[k + 0] = v.r; - pix[k + 1] = v.g; - pix[k + 2] = v.b; - pix[k + 3] = ~~(255 * opacity(obj)); + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + return function(t) { + transform2 = t, t02 = t(x02), t12 = t(x12), t22 = t(x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s = t12 < t02 ? -1 : 1; + return scale2; + }; + } + function diverging() { + var scale2 = linearish(transformer$1()(identity$3)); + scale2.copy = function() { + return copy$6(scale2, diverging()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingLog() { + var scale2 = loggish(transformer$1()).domain([0.1, 1, 10]); + scale2.copy = function() { + return copy$6(scale2, divergingLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSymlog() { + var scale2 = symlogish(transformer$1()); + scale2.copy = function() { + return copy$6(scale2, divergingSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingPow() { + var scale2 = powish(transformer$1()); + scale2.copy = function() { + return copy$6(scale2, divergingPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSqrt() { + return divergingPow.apply(null, arguments).exponent(0.5); + } + function colors$1(specifier) { + var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0; + while (i < n) colors2[i] = "#" + specifier.slice(i * 6, ++i * 6); + return colors2; + } + const schemeCategory10 = colors$1("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); + const schemeAccent = colors$1("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); + const schemeDark2 = colors$1("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); + const schemeObservable10 = colors$1("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); + const schemePaired = colors$1("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); + const schemePastel1 = colors$1("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); + const schemePastel2 = colors$1("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); + const schemeSet1 = colors$1("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); + const schemeSet2 = colors$1("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); + const schemeSet3 = colors$1("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); + function bandSpace(count2, paddingInner, paddingOuter) { + const space = count2 - paddingInner + paddingOuter * 2; + return count2 ? space > 0 ? space : 1 : 0; + } + const Identity = "identity"; + const Linear = "linear"; + const Log$1 = "log"; + const Pow = "pow"; + const Sqrt = "sqrt"; + const Symlog = "symlog"; + const Time = "time"; + const UTC = "utc"; + const Sequential = "sequential"; + const Diverging = "diverging"; + const Quantile = "quantile"; + const Quantize = "quantize"; + const Threshold = "threshold"; + const Ordinal = "ordinal"; + const Point = "point"; + const Band$1 = "band"; + const BinOrdinal = "bin-ordinal"; + const Continuous = "continuous"; + const Discrete$1 = "discrete"; + const Discretizing = "discretizing"; + const Interpolating = "interpolating"; + const Temporal = "temporal"; + function invertRange(scale2) { + return function(_) { + let lo = _[0], hi = _[1], t; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + return [scale2.invert(lo), scale2.invert(hi)]; + }; + } + function invertRangeExtent(scale2) { + return function(_) { + const range2 = scale2.range(); + let lo = _[0], hi = _[1], min2 = -1, max2, t, i, n; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + for (i = 0, n = range2.length; i < n; ++i) { + if (range2[i] >= lo && range2[i] <= hi) { + if (min2 < 0) min2 = i; + max2 = i; } + } + if (min2 < 0) return void 0; + lo = scale2.invertExtent(range2[min2]); + hi = scale2.invertExtent(range2[max2]); + return [lo[0] === void 0 ? lo[1] : lo[0], hi[1] === void 0 ? hi[0] : hi[1]]; + }; + } + function band() { + const scale2 = ordinal().unknown(void 0), domain2 = scale2.domain, ordinalRange = scale2.range; + let range$12 = [0, 1], step, bandwidth2, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; + delete scale2.unknown; + function rescale() { + const n = domain2().length, reverse2 = range$12[1] < range$12[0], stop2 = range$12[1 - reverse2], space = bandSpace(n, paddingInner, paddingOuter); + let start = range$12[reverse2 - 0]; + step = (stop2 - start) / (space || 1); + if (round) { + step = Math.floor(step); + } + start += (stop2 - start - step * (n - paddingInner)) * align; + bandwidth2 = step * (1 - paddingInner); + if (round) { + start = Math.round(start); + bandwidth2 = Math.round(bandwidth2); + } + const values2 = range$3(n).map((i) => start + step * i); + return ordinalRange(reverse2 ? values2.reverse() : values2); } - ctx.putImageData(img, 0, 0); - return can; -} -/** - * Maintains a cartographic projection. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Projection(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Projection, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let proj = this.value; - if (!proj || _.modified('type')) { - this.value = proj = create(_.type); - (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_[prop] != null) set(proj, prop, _[prop]); - }); - } else (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_.modified(prop)) set(proj, prop, _[prop]); - }); - if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); - if (_.fit) fit(proj, _); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function fit(proj, _) { - const data = collectGeoJSON(_.fit); - _.extent ? proj.fitExtent(_.extent, data) : _.size && proj.fitSize(_.size, data); -} -function create(type) { - const constructor = (0, _vegaProjection.projection)((type || 'mercator').toLowerCase()); - if (!constructor) (0, _vegaUtil.error)('Unrecognized projection type: ' + type); - return constructor(); -} -function set(proj, key, value) { - if ((0, _vegaUtil.isFunction)(proj[key])) proj[key](value); -} -function collectGeoJSON(data) { - data = (0, _vegaUtil.array)(data); - return data.length === 1 ? data[0] : { - type: FeatureCollection, - features: data.reduce((a, f)=>a.concat(featurize(f)), []) + scale2.domain = function(_) { + if (arguments.length) { + domain2(_); + return rescale(); + } else { + return domain2(); + } }; -} -function featurize(f) { - return f.type === FeatureCollection ? f.features : (0, _vegaUtil.array)(f).filter((d)=>d != null).map((d)=>d.type === Feature ? d : { - type: Feature, - geometry: d - }); -} - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-array":"6IwJG","vega-statistics":"5ncfv","vega-projection":"4wv4C","d3-geo":"lY61T","d3-color":"7SCp9","vega-canvas":"kPWfS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4wv4C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getProjectionPath", ()=>getProjectionPath); -parcelHelpers.export(exports, "projection", ()=>projection); -parcelHelpers.export(exports, "projectionProperties", ()=>projectionProperties); -var _d3Geo = require("d3-geo"); -var _d3GeoProjection = require("d3-geo-projection"); -var _vegaScale = require("vega-scale"); -const defaultPath = (0, _d3Geo.geoPath)(); -const projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; -/** - * Augment projections with their type and a copy method. - */ function create(type, constructor) { - return function projection() { - const p = constructor(); - p.type = type; - p.path = (0, _d3Geo.geoPath)().projection(p); - p.copy = p.copy || function() { - const c = projection(); - projectionProperties.forEach((prop)=>{ - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - return (0, _vegaScale.registerScale)(p); + scale2.range = function(_) { + if (arguments.length) { + range$12 = [+_[0], +_[1]]; + return rescale(); + } else { + return range$12.slice(); + } + }; + scale2.rangeRound = function(_) { + range$12 = [+_[0], +_[1]]; + round = true; + return rescale(); + }; + scale2.bandwidth = function() { + return bandwidth2; + }; + scale2.step = function() { + return step; + }; + scale2.round = function(_) { + if (arguments.length) { + round = !!_; + return rescale(); + } else { + return round; + } + }; + scale2.padding = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + paddingInner = paddingOuter; + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingInner = function(_) { + if (arguments.length) { + paddingInner = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingOuter = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingOuter; + } + }; + scale2.align = function(_) { + if (arguments.length) { + align = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return align; + } + }; + scale2.invertRange = function(_) { + if (_[0] == null || _[1] == null) return; + const reverse2 = range$12[1] < range$12[0], values2 = reverse2 ? ordinalRange().reverse() : ordinalRange(), n = values2.length - 1; + let lo = +_[0], hi = +_[1], a2, b2, t; + if (lo !== lo || hi !== hi) return; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + if (hi < values2[0] || lo > range$12[1 - reverse2]) return; + a2 = Math.max(0, bisectRight$1(values2, lo) - 1); + b2 = lo === hi ? a2 : bisectRight$1(values2, hi) - 1; + if (lo - values2[a2] > bandwidth2 + 1e-10) ++a2; + if (reverse2) { + t = a2; + a2 = n - b2; + b2 = n - t; + } + return a2 > b2 ? void 0 : domain2().slice(a2, b2 + 1); + }; + scale2.invert = function(_) { + const value2 = scale2.invertRange([_, _]); + return value2 ? value2[0] : value2; + }; + scale2.copy = function() { + return band().domain(domain2()).range(range$12).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); + }; + return rescale(); + } + function pointish(scale2) { + const copy2 = scale2.copy; + scale2.padding = scale2.paddingOuter; + delete scale2.paddingInner; + scale2.copy = function() { + return pointish(copy2()); + }; + return scale2; + } + function point$1() { + return pointish(band().paddingInner(1)); + } + var map$1 = Array.prototype.map; + function numbers(_) { + return map$1.call(_, toNumber); + } + const slice$1 = Array.prototype.slice; + function scaleBinOrdinal() { + let domain2 = [], range2 = []; + function scale2(x2) { + return x2 == null || x2 !== x2 ? void 0 : range2[(bisectRight$1(domain2, x2) - 1) % range2.length]; + } + scale2.domain = function(_) { + if (arguments.length) { + domain2 = numbers(_); + return scale2; + } else { + return domain2.slice(); + } + }; + scale2.range = function(_) { + if (arguments.length) { + range2 = slice$1.call(_); + return scale2; + } else { + return range2.slice(); + } + }; + scale2.tickFormat = function(count2, specifier) { + return tickFormat$1(domain2[0], peek$1(domain2), count2 == null ? 10 : count2, specifier); + }; + scale2.copy = function() { + return scaleBinOrdinal().domain(scale2.domain()).range(scale2.range()); + }; + return scale2; + } + const scales = /* @__PURE__ */ new Map(); + const VEGA_SCALE = Symbol("vega_scale"); + function registerScale(scale2) { + scale2[VEGA_SCALE] = true; + return scale2; + } + function isRegisteredScale(scale2) { + return scale2 && scale2[VEGA_SCALE] === true; + } + function create$8(type2, constructor, metadata2) { + const ctr = function scale2() { + const s = constructor(); + if (!s.invertRange) { + s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : void 0; + } + s.type = type2; + return registerScale(s); }; -} -function projection(type, proj) { - if (!type || typeof type !== 'string') throw new Error('Projection type must be a name string.'); - type = type.toLowerCase(); + ctr.metadata = toSet(array$5(metadata2)); + return ctr; + } + function scale$6(type2, scale2, metadata2) { if (arguments.length > 1) { - projections[type] = create(type, proj); - return this; - } else return projections[type] || null; -} -function getProjectionPath(proj) { - return proj && proj.path || defaultPath; -} -const projections = { - // base d3-geo projection types - albers: (0, _d3Geo.geoAlbers), - albersusa: (0, _d3Geo.geoAlbersUsa), - azimuthalequalarea: (0, _d3Geo.geoAzimuthalEqualArea), - azimuthalequidistant: (0, _d3Geo.geoAzimuthalEquidistant), - conicconformal: (0, _d3Geo.geoConicConformal), - conicequalarea: (0, _d3Geo.geoConicEqualArea), - conicequidistant: (0, _d3Geo.geoConicEquidistant), - equalEarth: (0, _d3Geo.geoEqualEarth), - equirectangular: (0, _d3Geo.geoEquirectangular), - gnomonic: (0, _d3Geo.geoGnomonic), - identity: (0, _d3Geo.geoIdentity), - mercator: (0, _d3Geo.geoMercator), - mollweide: (0, _d3GeoProjection.geoMollweide), - naturalEarth1: (0, _d3Geo.geoNaturalEarth1), - orthographic: (0, _d3Geo.geoOrthographic), - stereographic: (0, _d3Geo.geoStereographic), - transversemercator: (0, _d3Geo.geoTransverseMercator) -}; -for(const key in projections)projection(key, projections[key]); - -},{"d3-geo":"lY61T","d3-geo-projection":"ixW8K","vega-scale":"bEydG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lY61T":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoArea", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "geoBounds", ()=>(0, _boundsJsDefault.default)); -parcelHelpers.export(exports, "geoCentroid", ()=>(0, _centroidJsDefault.default)); -parcelHelpers.export(exports, "geoCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "geoClipAntimeridian", ()=>(0, _antimeridianJsDefault.default)); -parcelHelpers.export(exports, "geoClipCircle", ()=>(0, _circleJsDefault1.default)); -parcelHelpers.export(exports, "geoClipExtent", ()=>(0, _extentJsDefault.default)) // DEPRECATED! Use d3.geoIdentity().clipExtent(…). -; -parcelHelpers.export(exports, "geoClipRectangle", ()=>(0, _rectangleJsDefault.default)); -parcelHelpers.export(exports, "geoContains", ()=>(0, _containsJsDefault.default)); -parcelHelpers.export(exports, "geoDistance", ()=>(0, _distanceJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule", ()=>(0, _graticuleJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule10", ()=>(0, _graticuleJs.graticule10)); -parcelHelpers.export(exports, "geoInterpolate", ()=>(0, _interpolateJsDefault.default)); -parcelHelpers.export(exports, "geoLength", ()=>(0, _lengthJsDefault.default)); -parcelHelpers.export(exports, "geoPath", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoAlbers", ()=>(0, _albersJsDefault.default)); -parcelHelpers.export(exports, "geoAlbersUsa", ()=>(0, _albersUsaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualArea", ()=>(0, _azimuthalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualAreaRaw", ()=>(0, _azimuthalEqualAreaJs.azimuthalEqualAreaRaw)); -parcelHelpers.export(exports, "geoAzimuthalEquidistant", ()=>(0, _azimuthalEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEquidistantRaw", ()=>(0, _azimuthalEquidistantJs.azimuthalEquidistantRaw)); -parcelHelpers.export(exports, "geoConicConformal", ()=>(0, _conicConformalJsDefault.default)); -parcelHelpers.export(exports, "geoConicConformalRaw", ()=>(0, _conicConformalJs.conicConformalRaw)); -parcelHelpers.export(exports, "geoConicEqualArea", ()=>(0, _conicEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoConicEqualAreaRaw", ()=>(0, _conicEqualAreaJs.conicEqualAreaRaw)); -parcelHelpers.export(exports, "geoConicEquidistant", ()=>(0, _conicEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoConicEquidistantRaw", ()=>(0, _conicEquidistantJs.conicEquidistantRaw)); -parcelHelpers.export(exports, "geoEqualEarth", ()=>(0, _equalEarthJsDefault.default)); -parcelHelpers.export(exports, "geoEqualEarthRaw", ()=>(0, _equalEarthJs.equalEarthRaw)); -parcelHelpers.export(exports, "geoEquirectangular", ()=>(0, _equirectangularJsDefault.default)); -parcelHelpers.export(exports, "geoEquirectangularRaw", ()=>(0, _equirectangularJs.equirectangularRaw)); -parcelHelpers.export(exports, "geoGnomonic", ()=>(0, _gnomonicJsDefault.default)); -parcelHelpers.export(exports, "geoGnomonicRaw", ()=>(0, _gnomonicJs.gnomonicRaw)); -parcelHelpers.export(exports, "geoIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "geoProjection", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoProjectionMutator", ()=>(0, _indexJs1.projectionMutator)); -parcelHelpers.export(exports, "geoMercator", ()=>(0, _mercatorJsDefault.default)); -parcelHelpers.export(exports, "geoMercatorRaw", ()=>(0, _mercatorJs.mercatorRaw)); -parcelHelpers.export(exports, "geoNaturalEarth1", ()=>(0, _naturalEarth1JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth1Raw", ()=>(0, _naturalEarth1Js.naturalEarth1Raw)); -parcelHelpers.export(exports, "geoOrthographic", ()=>(0, _orthographicJsDefault.default)); -parcelHelpers.export(exports, "geoOrthographicRaw", ()=>(0, _orthographicJs.orthographicRaw)); -parcelHelpers.export(exports, "geoStereographic", ()=>(0, _stereographicJsDefault.default)); -parcelHelpers.export(exports, "geoStereographicRaw", ()=>(0, _stereographicJs.stereographicRaw)); -parcelHelpers.export(exports, "geoTransverseMercator", ()=>(0, _transverseMercatorJsDefault.default)); -parcelHelpers.export(exports, "geoTransverseMercatorRaw", ()=>(0, _transverseMercatorJs.transverseMercatorRaw)); -parcelHelpers.export(exports, "geoRotation", ()=>(0, _rotationJsDefault.default)); -parcelHelpers.export(exports, "geoStream", ()=>(0, _streamJsDefault.default)); -parcelHelpers.export(exports, "geoTransform", ()=>(0, _transformJsDefault.default)); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _circleJs = require("./circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _antimeridianJs = require("./clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs1 = require("./clip/circle.js"); -var _circleJsDefault1 = parcelHelpers.interopDefault(_circleJs1); -var _extentJs = require("./clip/extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _rectangleJs = require("./clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _containsJs = require("./contains.js"); -var _containsJsDefault = parcelHelpers.interopDefault(_containsJs); -var _distanceJs = require("./distance.js"); -var _distanceJsDefault = parcelHelpers.interopDefault(_distanceJs); -var _graticuleJs = require("./graticule.js"); -var _graticuleJsDefault = parcelHelpers.interopDefault(_graticuleJs); -var _interpolateJs = require("./interpolate.js"); -var _interpolateJsDefault = parcelHelpers.interopDefault(_interpolateJs); -var _lengthJs = require("./length.js"); -var _lengthJsDefault = parcelHelpers.interopDefault(_lengthJs); -var _indexJs = require("./path/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _albersJs = require("./projection/albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _albersUsaJs = require("./projection/albersUsa.js"); -var _albersUsaJsDefault = parcelHelpers.interopDefault(_albersUsaJs); -var _azimuthalEqualAreaJs = require("./projection/azimuthalEqualArea.js"); -var _azimuthalEqualAreaJsDefault = parcelHelpers.interopDefault(_azimuthalEqualAreaJs); -var _azimuthalEquidistantJs = require("./projection/azimuthalEquidistant.js"); -var _azimuthalEquidistantJsDefault = parcelHelpers.interopDefault(_azimuthalEquidistantJs); -var _conicConformalJs = require("./projection/conicConformal.js"); -var _conicConformalJsDefault = parcelHelpers.interopDefault(_conicConformalJs); -var _conicEqualAreaJs = require("./projection/conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _conicEquidistantJs = require("./projection/conicEquidistant.js"); -var _conicEquidistantJsDefault = parcelHelpers.interopDefault(_conicEquidistantJs); -var _equalEarthJs = require("./projection/equalEarth.js"); -var _equalEarthJsDefault = parcelHelpers.interopDefault(_equalEarthJs); -var _equirectangularJs = require("./projection/equirectangular.js"); -var _equirectangularJsDefault = parcelHelpers.interopDefault(_equirectangularJs); -var _gnomonicJs = require("./projection/gnomonic.js"); -var _gnomonicJsDefault = parcelHelpers.interopDefault(_gnomonicJs); -var _identityJs = require("./projection/identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _indexJs1 = require("./projection/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _mercatorJs = require("./projection/mercator.js"); -var _mercatorJsDefault = parcelHelpers.interopDefault(_mercatorJs); -var _naturalEarth1Js = require("./projection/naturalEarth1.js"); -var _naturalEarth1JsDefault = parcelHelpers.interopDefault(_naturalEarth1Js); -var _orthographicJs = require("./projection/orthographic.js"); -var _orthographicJsDefault = parcelHelpers.interopDefault(_orthographicJs); -var _stereographicJs = require("./projection/stereographic.js"); -var _stereographicJsDefault = parcelHelpers.interopDefault(_stereographicJs); -var _transverseMercatorJs = require("./projection/transverseMercator.js"); -var _transverseMercatorJsDefault = parcelHelpers.interopDefault(_transverseMercatorJs); -var _rotationJs = require("./rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./area.js":"iajNA","./bounds.js":"9Dbky","./centroid.js":"kO6wx","./circle.js":false,"./clip/antimeridian.js":false,"./clip/circle.js":false,"./clip/extent.js":false,"./clip/rectangle.js":false,"./contains.js":false,"./distance.js":false,"./graticule.js":"arQrO","./interpolate.js":false,"./length.js":false,"./path/index.js":"gBtNJ","./projection/albers.js":"dSks5","./projection/albersUsa.js":"4lZJF","./projection/azimuthalEqualArea.js":"jbLs0","./projection/azimuthalEquidistant.js":"eAR2Q","./projection/conicConformal.js":"dhBsj","./projection/conicEqualArea.js":"17j9x","./projection/conicEquidistant.js":"6B358","./projection/equalEarth.js":"bMVhy","./projection/equirectangular.js":"4kEjS","./projection/gnomonic.js":"6bdgO","./projection/identity.js":"huYSV","./projection/index.js":"cd9OX","./projection/mercator.js":"iIGjZ","./projection/naturalEarth1.js":"4AzsZ","./projection/orthographic.js":"kjinQ","./projection/stereographic.js":"6ko7r","./projection/transverseMercator.js":"i6NVd","./rotation.js":false,"./stream.js":false,"./transform.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iajNA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "areaRingSum", ()=>areaRingSum); -parcelHelpers.export(exports, "areaStream", ()=>areaStream); -parcelHelpers.export(exports, "default", ()=>function(object) { - areaSum = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, areaStream); - return areaSum * 2; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var areaRingSum = new (0, _d3Array.Adder)(); -// hello? -var areaSum = new (0, _d3Array.Adder)(), lambda00, phi00, lambda0, cosPhi0, sinPhi0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaRingSum = new (0, _d3Array.Adder)(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? (0, _mathJs.tau) + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = (0, _noopJsDefault.default); - }, - sphere: function() { - areaSum.add((0, _mathJs.tau)); + scales.set(type2, create$8(type2, scale2, metadata2)); + return this; + } else { + return isValidScaleType(type2) ? scales.get(type2) : void 0; } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaRingEnd() { - areaPoint(lambda00, phi00); -} -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - lambda0 = lambda, cosPhi0 = (0, _mathJs.cos)(phi = phi / 2 + (0, _mathJs.quarterPi)), sinPhi0 = (0, _mathJs.sin)(phi); -} -function areaPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - phi = phi / 2 + (0, _mathJs.quarterPi); // half the angular distance from south pole - // Spherical excess E for a spherical triangle with vertices: south pole, - // previous point, current point. Uses a formula derived from Cagnoli’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = (0, _mathJs.cos)(phi), sinPhi = (0, _mathJs.sin)(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * (0, _mathJs.cos)(adLambda), v = k * sdLambda * (0, _mathJs.sin)(adLambda); - areaRingSum.add((0, _mathJs.atan2)(v, u)); - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} - -},{"d3-array":"6IwJG","./math.js":"74X19","./noop.js":"aXmaS","./stream.js":"9nFXd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"74X19":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "hypot", ()=>hypot); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "haversin", ()=>haversin); -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var ceil = Math.ceil; -var exp = Math.exp; -var floor = Math.floor; -var hypot = Math.hypot; -var log = Math.log; -var pow = Math.pow; -var sin = Math.sin; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sqrt = Math.sqrt; -var tan = Math.tan; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function haversin(x) { - return (x = sin(x / 2)) * x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aXmaS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>noop); -function noop() {} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9nFXd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object, stream) { - if (object && streamObjectType.hasOwnProperty(object.type)) streamObjectType[object.type](object, stream); - else streamGeometry(object, stream); - }); -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) streamGeometryType[geometry.type](geometry, stream); -} -var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while(++i < n)streamGeometry(features[i].geometry, stream); - } -}; -var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); - }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)object = coordinates[i], stream.point(object[0], object[1], object[2]); - }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamLine(coordinates[i], stream, 0); - }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamPolygon(coordinates[i], stream); - }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while(++i < n)streamGeometry(geometries[i], stream); + } + scale$6(Identity, identity$2); + scale$6(Linear, linear, Continuous); + scale$6(Log$1, log$2, [Continuous, Log$1]); + scale$6(Pow, pow$2, Continuous); + scale$6(Sqrt, sqrt$2, Continuous); + scale$6(Symlog, symlog, Continuous); + scale$6(Time, time$1, [Continuous, Temporal]); + scale$6(UTC, utcTime, [Continuous, Temporal]); + scale$6(Sequential, sequential, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Log$1}`, sequentialLog, [Continuous, Interpolating, Log$1]); + scale$6(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Linear}`, diverging, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Log$1}`, divergingLog, [Continuous, Interpolating, Log$1]); + scale$6(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); + scale$6(Quantile, quantile, [Discretizing, Quantile]); + scale$6(Quantize, quantize$1, Discretizing); + scale$6(Threshold, threshold, Discretizing); + scale$6(BinOrdinal, scaleBinOrdinal, [Discrete$1, Discretizing]); + scale$6(Ordinal, ordinal, Discrete$1); + scale$6(Band$1, band, Discrete$1); + scale$6(Point, point$1, Discrete$1); + function isValidScaleType(type2) { + return scales.has(type2); + } + function hasType(key2, type2) { + const s = scales.get(key2); + return s && s.metadata[type2]; + } + function isContinuous(key2) { + return hasType(key2, Continuous); + } + function isDiscrete(key2) { + return hasType(key2, Discrete$1); + } + function isDiscretizing(key2) { + return hasType(key2, Discretizing); + } + function isLogarithmic(key2) { + return hasType(key2, Log$1); + } + function isTemporal(key2) { + return hasType(key2, Temporal); + } + function isInterpolating(key2) { + return hasType(key2, Interpolating); + } + function isQuantile(key2) { + return hasType(key2, Quantile); + } + const scaleProps = ["clamp", "base", "constant", "exponent"]; + function interpolateRange(interpolator, range2) { + const start = range2[0], span2 = peek$1(range2) - start; + return function(i) { + return interpolator(start + i * span2); + }; + } + function interpolateColors(colors2, type2, gamma2) { + return piecewise(interpolate(type2 || "rgb", gamma2), colors2); + } + function quantizeInterpolator(interpolator, count2) { + const samples = new Array(count2), n = count2 + 1; + for (let i = 0; i < count2; ) samples[i] = interpolator(++i / n); + return samples; + } + function scaleFraction(scale$12, min2, max2) { + const delta = max2 - min2; + let i, t, s; + if (!delta || !Number.isFinite(delta)) { + return constant$5(0.5); + } else { + i = (t = scale$12.type).indexOf("-"); + t = i < 0 ? t : t.slice(i + 1); + s = scale$6(t)().domain([min2, max2]).range([0, 1]); + scaleProps.forEach((m2) => scale$12[m2] ? s[m2](scale$12[m2]()) : 0); + return s; } -}; -function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while(++i < n)coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} -function streamPolygon(coordinates, stream) { - var i = -1, n = coordinates.length; - stream.polygonStart(); - while(++i < n)streamLine(coordinates[i], stream, 1); - stream.polygonEnd(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Dbky":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(feature) { - var i, n, a, b, merged, deltaMax, delta; - phi1 = lambda1 = -(lambda0 = phi0 = Infinity); - ranges = []; - (0, _streamJsDefault.default)(feature, boundsStream); - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - // Then, merge any ranges that overlap. - for(i = 1, a = ranges[0], merged = [ - a - ]; i < n; ++i){ - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; - } else merged.push(a = b); - } - // Finally, find the largest gap between the merged ranges. - // The final bounding box will be the inverse of this gap. - for(deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i){ - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1]; - } - } - ranges = range = null; - return lambda0 === Infinity || phi0 === Infinity ? [ - [ - NaN, - NaN - ], - [ - NaN, - NaN - ] - ] : [ - [ - lambda0, - phi0 - ], - [ - lambda1, - phi1 - ] - ]; - }); -var _d3Array = require("d3-array"); -var _areaJs = require("./area.js"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var lambda0, phi0, lambda1, phi1, lambda2, lambda00, phi00, p0, deltaSum, ranges, range; -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum = new (0, _d3Array.Adder)(); - (0, _areaJs.areaStream).polygonStart(); - }, - polygonEnd: function() { - (0, _areaJs.areaStream).polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if ((0, _areaJs.areaRingSum) < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > (0, _mathJs.epsilon)) phi1 = 90; - else if (deltaSum < -(0, _mathJs.epsilon)) phi0 = -90; - range[0] = lambda0, range[1] = lambda1; - }, - sphere: function() { - lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } -}; -function boundsPoint(lambda, phi) { - ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; -} -function linePoint(lambda, phi) { - var p = (0, _cartesianJs.cartesian)([ - lambda * (0, _mathJs.radians), - phi * (0, _mathJs.radians) - ]); - if (p0) { - var normal = (0, _cartesianJs.cartesianCross)(p0, p), equatorial = [ - normal[1], - -normal[0], - 0 - ], inflection = (0, _cartesianJs.cartesianCross)(equatorial, normal); - (0, _cartesianJs.cartesianNormalizeInPlace)(inflection); - inflection = (0, _cartesianJs.spherical)(inflection); - var delta = lambda - lambda2, sign = delta > 0 ? 1 : -1, lambdai = inflection[0] * (0, _mathJs.degrees) * sign, phii, antimeridian = (0, _mathJs.abs)(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * (0, _mathJs.degrees); - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * (0, _mathJs.degrees); - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } else if (lambda1 >= lambda0) { - if (lambda < lambda0) lambda0 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } - } else ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; -} -function boundsLineStart() { - boundsStream.point = linePoint; -} -function boundsLineEnd() { - range[0] = lambda0, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add((0, _mathJs.abs)(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else lambda00 = lambda, phi00 = phi; - (0, _areaJs.areaStream).point(lambda, phi); - linePoint(lambda, phi); -} -function boundsRingStart() { - (0, _areaJs.areaStream).lineStart(); -} -function boundsRingEnd() { - boundsRingPoint(lambda00, phi00); - (0, _areaJs.areaStream).lineEnd(); - if ((0, _mathJs.abs)(deltaSum) > (0, _mathJs.epsilon)) lambda0 = -(lambda1 = 180); - range[0] = lambda0, range[1] = lambda1; - p0 = null; -} -// Finds the left-right distance between two longitudes. -// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want -// the distance between ±180° to be 360°. -function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; -} -function rangeCompare(a, b) { - return a[0] - b[0]; -} -function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; -} - -},{"d3-array":"6IwJG","./area.js":"iajNA","./cartesian.js":"i2DwM","./math.js":"74X19","./stream.js":"9nFXd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i2DwM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "spherical", ()=>spherical); -parcelHelpers.export(exports, "cartesian", ()=>cartesian); -parcelHelpers.export(exports, "cartesianDot", ()=>cartesianDot); -parcelHelpers.export(exports, "cartesianCross", ()=>cartesianCross); -// TODO return a -parcelHelpers.export(exports, "cartesianAddInPlace", ()=>cartesianAddInPlace); -parcelHelpers.export(exports, "cartesianScale", ()=>cartesianScale); -// TODO return d -parcelHelpers.export(exports, "cartesianNormalizeInPlace", ()=>cartesianNormalizeInPlace); -var _mathJs = require("./math.js"); -function spherical(cartesian) { - return [ - (0, _mathJs.atan2)(cartesian[1], cartesian[0]), - (0, _mathJs.asin)(cartesian[2]) - ]; -} -function cartesian(spherical) { - var lambda = spherical[0], phi = spherical[1], cosPhi = (0, _mathJs.cos)(phi); - return [ - cosPhi * (0, _mathJs.cos)(lambda), - cosPhi * (0, _mathJs.sin)(lambda), - (0, _mathJs.sin)(phi) - ]; -} -function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cartesianCross(a, b) { - return [ - a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0] - ]; -} -function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; -} -function cartesianScale(vector, k) { - return [ - vector[0] * k, - vector[1] * k, - vector[2] * k - ]; -} -function cartesianNormalizeInPlace(d) { - var l = (0, _mathJs.sqrt)(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} - -},{"./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kO6wx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object) { - W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0; - X2 = new (0, _d3Array.Adder)(); - Y2 = new (0, _d3Array.Adder)(); - Z2 = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, centroidStream); - var x = +X2, y = +Y2, z = +Z2, m = (0, _mathJs.hypot)(x, y, z); - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < (0, _mathJs.epsilon2)) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < (0, _mathJs.epsilon)) x = X0, y = Y0, z = Z0; - m = (0, _mathJs.hypot)(x, y, z); - // If the feature still has an undefined ccentroid, then return. - if (m < (0, _mathJs.epsilon2)) return [ - NaN, - NaN - ]; - } - return [ - (0, _mathJs.atan2)(y, x) * (0, _mathJs.degrees), - (0, _mathJs.asin)(z / m) * (0, _mathJs.degrees) - ]; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00, phi00, x0, y0, z0; // previous point -var centroidStream = { - sphere: (0, _noopJsDefault.default), - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; -// Arithmetic mean of Cartesian vectors. -function centroidPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - centroidPointCartesian(cosPhi * (0, _mathJs.cos)(lambda), cosPhi * (0, _mathJs.sin)(lambda), (0, _mathJs.sin)(phi)); -} -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} -function centroidLinePointFirst(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} -function centroidLinePoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), w = (0, _mathJs.atan2)((0, _mathJs.sqrt)((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, -// J. Applied Mechanics 42, 239 (1975). -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} -function centroidRingEnd() { - centroidRingPoint(lambda00, phi00); - centroidStream.point = centroidPoint; -} -function centroidRingPointFirst(lambda, phi) { - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - centroidStream.point = centroidRingPoint; - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidPointCartesian(x0, y0, z0); -} -function centroidRingPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = (0, _mathJs.hypot)(cx, cy, cz), w = (0, _mathJs.asin)(m), v = m && -w / m; // area weight multiplier - X2.add(v * cx); - Y2.add(v * cy); - Z2.add(v * cz); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -},{"d3-array":"6IwJG","./math.js":"74X19","./noop.js":"aXmaS","./stream.js":"9nFXd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPX3u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Generates a circle centered at [0°, 0°], with a given radius and precision. -parcelHelpers.export(exports, "circleStream", ()=>circleStream); -parcelHelpers.export(exports, "default", ()=>function() { - var center = (0, _constantJsDefault.default)([ - 0, - 0 - ]), radius = (0, _constantJsDefault.default)(90), precision = (0, _constantJsDefault.default)(2), ring, rotate, stream = { - point: point - }; - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= (0, _mathJs.degrees), x[1] *= (0, _mathJs.degrees); - } - function circle() { - var c = center.apply(this, arguments), r = radius.apply(this, arguments) * (0, _mathJs.radians), p = precision.apply(this, arguments) * (0, _mathJs.radians); - ring = []; - rotate = (0, _rotationJs.rotateRadians)(-c[0] * (0, _mathJs.radians), -c[1] * (0, _mathJs.radians), 0).invert; - circleStream(stream, r, p, 1); - c = { - type: "Polygon", - coordinates: [ - ring - ] - }; - ring = rotate = null; - return c; - } - circle.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - +_[0], - +_[1] - ]), circle) : center; - }; - circle.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : radius; - }; - circle.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : precision; - }; - return circle; - }); -var _cartesianJs = require("./cartesian.js"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _rotationJs = require("./rotation.js"); -function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = (0, _mathJs.cos)(radius), sinRadius = (0, _mathJs.sin)(radius), step = direction * delta; - if (t0 == null) { - t0 = radius + direction * (0, _mathJs.tau); - t1 = radius - step / 2; + } + function interpolate(type2, gamma2) { + const interp = $$1[method(type2)]; + return gamma2 != null && interp && interp.gamma ? interp.gamma(gamma2) : interp; + } + function method(type2) { + return "interpolate" + type2.toLowerCase().split("-").map((s) => s[0].toUpperCase() + s.slice(1)).join(""); + } + const continuous = { + blues: "cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90", + greens: "d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429", + greys: "e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e", + oranges: "fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303", + purples: "e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c", + reds: "fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13", + blueGreen: "d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429", + bluePurple: "ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71", + greenBlue: "d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1", + orangeRed: "fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403", + purpleBlue: "dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281", + purpleBlueGreen: "dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353", + purpleRed: "dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a", + redPurple: "fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174", + yellowGreen: "e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034", + yellowOrangeBrown: "feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204", + yellowOrangeRed: "fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225", + blueOrange: "134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07", + brownBlueGreen: "704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147", + purpleGreen: "5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29", + purpleOrange: "4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07", + redBlue: "8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85", + redGrey: "8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434", + yellowGreenBlue: "eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185", + redYellowBlue: "a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695", + redYellowGreen: "a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837", + pinkYellowGreen: "8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419", + spectral: "9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2", + viridis: "440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725", + magma: "0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf", + inferno: "0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4", + plasma: "0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921", + cividis: "00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647", + rainbow: "6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa", + sinebow: "ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040", + turbo: "23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00", + browns: "eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632", + tealBlues: "bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985", + teals: "bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667", + warmGreys: "dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e", + goldGreen: "f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36", + goldOrange: "f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26", + goldRed: "f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e", + lightGreyRed: "efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b", + lightGreyTeal: "e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc", + lightMulti: "e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c", + lightOrange: "f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b", + lightTealBlue: "e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988", + darkBlue: "3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff", + darkGold: "3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff", + darkGreen: "3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa", + darkMulti: "3737371f5287197d8c29a86995ce3fffe800ffffff", + darkRed: "3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c" + }; + const discrete = { + accent: schemeAccent, + category10: schemeCategory10, + category20: "1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5", + category20b: "393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6", + category20c: "3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9", + dark2: schemeDark2, + observable10: schemeObservable10, + paired: schemePaired, + pastel1: schemePastel1, + pastel2: schemePastel2, + set1: schemeSet1, + set2: schemeSet2, + set3: schemeSet3, + tableau10: "4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac", + tableau20: "4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5" + }; + function colors(palette) { + if (isArray(palette)) return palette; + const n = palette.length / 6 | 0, c2 = new Array(n); + for (let i = 0; i < n; ) { + c2[i] = "#" + palette.slice(i * 6, ++i * 6); + } + return c2; + } + function apply(_, f) { + for (const k in _) scheme(k, f(_[k])); + } + const schemes = {}; + apply(discrete, colors); + apply(continuous, (_) => interpolateColors(colors(_))); + function scheme(name, scheme2) { + name = name && name.toLowerCase(); + if (arguments.length > 1) { + schemes[name] = scheme2; + return this; } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * (0, _mathJs.tau); - } - for(var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step){ - point = (0, _cartesianJs.spherical)([ - cosRadius, - -sinRadius * (0, _mathJs.cos)(t), - -sinRadius * (0, _mathJs.sin)(t) - ]); - stream.point(point[0], point[1]); - } -} -// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. -function circleRadius(cosRadius, point) { - point = (0, _cartesianJs.cartesian)(point), point[0] -= cosRadius; - (0, _cartesianJs.cartesianNormalizeInPlace)(point); - var radius = (0, _mathJs.acos)(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + (0, _mathJs.tau) - (0, _mathJs.epsilon)) % (0, _mathJs.tau); -} - -},{"./cartesian.js":"i2DwM","./constant.js":"en6KO","./math.js":"74X19","./rotation.js":"8C7qH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"en6KO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8C7qH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rotateRadians", ()=>rotateRadians); -parcelHelpers.export(exports, "default", ()=>function(rotate) { - rotate = rotateRadians(rotate[0] * (0, _mathJs.radians), rotate[1] * (0, _mathJs.radians), rotate.length > 2 ? rotate[2] * (0, _mathJs.radians) : 0); - function forward(coordinates) { - coordinates = rotate(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - } - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - }; - return forward; - }); -var _composeJs = require("./compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _mathJs = require("./math.js"); -function rotationIdentity(lambda, phi) { - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; -} -rotationIdentity.invert = rotationIdentity; -function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= (0, _mathJs.tau)) ? deltaPhi || deltaGamma ? (0, _composeJsDefault.default)(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; -} -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - lambda += deltaLambda; - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; - }; -} -function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; -} -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = (0, _mathJs.cos)(deltaPhi), sinDeltaPhi = (0, _mathJs.sin)(deltaPhi), cosDeltaGamma = (0, _mathJs.cos)(deltaGamma), sinDeltaGamma = (0, _mathJs.sin)(deltaGamma); - function rotation(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaGamma + y * sinDeltaGamma) - ]; - } - rotation.invert = function(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - return rotation; -} - -},{"./compose.js":"hmaf3","./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hmaf3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kvVxQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -exports.default = (0, _indexJsDefault.default)(function() { - return true; -}, clipAntimeridianLine, clipAntimeridianInterpolate, [ - -(0, _mathJs.pi), - -(0, _mathJs.halfPi) -]); -// Takes a line and cuts into visible segments. Return values: 0 - there were -// intersections or the line was empty; 1 - no intersections; 2 - there were -// intersections, and the first and last segments should be rejoined. -function clipAntimeridianLine(stream) { - var lambda0 = NaN, phi0 = NaN, sign0 = NaN, clean; // no intersections - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi), delta = (0, _mathJs.abs)(lambda1 - lambda0); - if ((0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon)) { - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? (0, _mathJs.halfPi) : -(0, _mathJs.halfPi)); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= (0, _mathJs.pi)) { - if ((0, _mathJs.abs)(lambda0 - sign0) < (0, _mathJs.epsilon)) lambda0 -= sign0 * (0, _mathJs.epsilon); // handle degeneracies - if ((0, _mathJs.abs)(lambda1 - sign1) < (0, _mathJs.epsilon)) lambda1 -= sign1 * (0, _mathJs.epsilon); - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; -} -function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, cosPhi1, sinLambda0Lambda1 = (0, _mathJs.sin)(lambda0 - lambda1); - return (0, _mathJs.abs)(sinLambda0Lambda1) > (0, _mathJs.epsilon) ? (0, _mathJs.atan)(((0, _mathJs.sin)(phi0) * (cosPhi1 = (0, _mathJs.cos)(phi1)) * (0, _mathJs.sin)(lambda1) - (0, _mathJs.sin)(phi1) * (cosPhi0 = (0, _mathJs.cos)(phi0)) * (0, _mathJs.sin)(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2; -} -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * (0, _mathJs.halfPi); - stream.point(-(0, _mathJs.pi), phi); - stream.point(0, phi); - stream.point((0, _mathJs.pi), phi); - stream.point((0, _mathJs.pi), 0); - stream.point((0, _mathJs.pi), -phi); - stream.point(0, -phi); - stream.point(-(0, _mathJs.pi), -phi); - stream.point(-(0, _mathJs.pi), 0); - stream.point(-(0, _mathJs.pi), phi); - } else if ((0, _mathJs.abs)(from[0] - to[0]) > (0, _mathJs.epsilon)) { - var lambda = from[0] < to[0] ? (0, _mathJs.pi) : -(0, _mathJs.pi); - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else stream.point(to[0], to[1]); -} - -},{"./index.js":"gHqWc","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gHqWc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(pointVisible, clipLine, interpolate, start) { - return function(sink) { - var line = clipLine(sink), ringBuffer = (0, _bufferJsDefault.default)(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon, segments, ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = (0, _d3Array.merge)(segments); - var startInside = (0, _polygonContainsJsDefault.default)(polygon, start); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function() { - sink.polygonStart(); - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - sink.polygonEnd(); - } - }; - function point(lambda, phi) { - if (pointVisible(lambda, phi)) sink.point(lambda, phi); - } - function pointLine(lambda, phi) { - line.point(lambda, phi); - } - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - function pointRing(lambda, phi) { - ring.push([ - lambda, - phi - ]); - ringSink.point(lambda, phi); - } - function ringStart() { - ringSink.lineStart(); - ring = []; - } - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for(i = 0; i < m; ++i)sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(validSegment)); - } - return clip; - }; - }); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _mathJs = require("../math.js"); -var _polygonContainsJs = require("../polygonContains.js"); -var _polygonContainsJsDefault = parcelHelpers.interopDefault(_polygonContainsJs); -var _d3Array = require("d3-array"); -function validSegment(segment) { - return segment.length > 1; -} -// Intersections are sorted along the clip edge. For both antimeridian cutting -// and circle clipping, the same comparison is used. -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - a[1]) - ((b = b.x)[0] < 0 ? b[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - b[1]); -} - -},{"./buffer.js":"6d6VN","./rejoin.js":"6J55y","../math.js":"74X19","../polygonContains.js":"13VDK","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6d6VN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var lines = [], line; - return { - point: function(x, y, m) { - line.push([ - x, - y, - m - ]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: (0, _noopJsDefault.default), - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); - -},{"../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6J55y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A generalized polygon clipping algorithm: given a polygon that has been cut -// into its visible line segments, and rejoins the segments by interpolating -// along the clip edge. -parcelHelpers.export(exports, "default", ()=>function(segments, compareIntersection, startInside, interpolate, stream) { - var subject = [], clip = [], i, n; - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - if ((0, _pointEqualJsDefault.default)(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - for(i = 0; i < n; ++i)stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - // handle degenerate cases by moving the point - p1[0] += 2 * (0, _mathJs.epsilon); - } - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - if (!subject.length) return; - clip.sort(compareIntersection); - link(subject); - link(clip); - for(i = 0, n = clip.length; i < n; ++i)clip[i].e = startInside = !startInside; - var start = subject[0], points, point; - while(true){ - // Find first unvisited intersection. - var current = start, isSubject = true; - while(current.v)if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) for(i = 0, n = points.length; i < n; ++i)stream.point((point = points[i])[0], point[1]); - else interpolate(current.x, current.n.x, 1, stream); - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for(i = points.length - 1; i >= 0; --i)stream.point((point = points[i])[0], point[1]); - } else interpolate(current.x, current.p.x, -1, stream); - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - }while (!current.v); - stream.lineEnd(); - } - }); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _mathJs = require("../math.js"); -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = null; // next & previous -} -function link(array) { - if (!(n = array.length)) return; - var n, i = 0, a = array[0], b; - while(++i < n){ - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} - -},{"../pointEqual.js":"f0mBF","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f0mBF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return (0, _mathJs.abs)(a[0] - b[0]) < (0, _mathJs.epsilon) && (0, _mathJs.abs)(a[1] - b[1]) < (0, _mathJs.epsilon); - }); -var _mathJs = require("./math.js"); - -},{"./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"13VDK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(polygon, point) { - var lambda = longitude(point), phi = point[1], sinPhi = (0, _mathJs.sin)(phi), normal = [ - (0, _mathJs.sin)(lambda), - -(0, _mathJs.cos)(lambda), - 0 - ], angle = 0, winding = 0; - var sum = new (0, _d3Array.Adder)(); - if (sinPhi === 1) phi = (0, _mathJs.halfPi) + (0, _mathJs.epsilon); - else if (sinPhi === -1) phi = -(0, _mathJs.halfPi) - (0, _mathJs.epsilon); - for(var i = 0, n = polygon.length; i < n; ++i){ - if (!(m = (ring = polygon[i]).length)) continue; - var ring, m, point0 = ring[m - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + (0, _mathJs.quarterPi), sinPhi0 = (0, _mathJs.sin)(phi0), cosPhi0 = (0, _mathJs.cos)(phi0); - for(var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1){ - var point1 = ring[j], lambda1 = longitude(point1), phi1 = point1[1] / 2 + (0, _mathJs.quarterPi), sinPhi1 = (0, _mathJs.sin)(phi1), cosPhi1 = (0, _mathJs.cos)(phi1), delta = lambda1 - lambda0, sign = delta >= 0 ? 1 : -1, absDelta = sign * delta, antimeridian = absDelta > (0, _mathJs.pi), k = sinPhi0 * sinPhi1; - sum.add((0, _mathJs.atan2)(k * sign * (0, _mathJs.sin)(absDelta), cosPhi0 * cosPhi1 + k * (0, _mathJs.cos)(absDelta))); - angle += antimeridian ? delta + sign * (0, _mathJs.tau) : delta; - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = (0, _cartesianJs.cartesianCross)((0, _cartesianJs.cartesian)(point0), (0, _cartesianJs.cartesian)(point1)); - (0, _cartesianJs.cartesianNormalizeInPlace)(arc); - var intersection = (0, _cartesianJs.cartesianCross)(normal, arc); - (0, _cartesianJs.cartesianNormalizeInPlace)(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * (0, _mathJs.asin)(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) winding += antimeridian ^ delta >= 0 ? 1 : -1; - } - } - } - // First, determine whether the South pole is inside or outside: - // - // It is inside if: - // * the polygon winds around it in a clockwise direction. - // * the polygon does not (cumulatively) wind around it, but has a negative - // (counter-clockwise) area. - // - // Second, count the (signed) number of times a segment crosses a lambda - // from the point to the South pole. If it is zero, then the point is the - // same side as the South pole. - return (angle < -(0, _mathJs.epsilon) || angle < (0, _mathJs.epsilon) && sum < -(0, _mathJs.epsilon2)) ^ winding & 1; - }); -var _d3Array = require("d3-array"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -function longitude(point) { - return (0, _mathJs.abs)(point[0]) <= (0, _mathJs.pi) ? point[0] : (0, _mathJs.sign)(point[0]) * (((0, _mathJs.abs)(point[0]) + (0, _mathJs.pi)) % (0, _mathJs.tau) - (0, _mathJs.pi)); -} - -},{"d3-array":"6IwJG","./cartesian.js":"i2DwM","./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2PJ3I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var cr = (0, _mathJs.cos)(radius), delta = 2 * (0, _mathJs.radians), smallRadius = cr > 0, notHemisphere = (0, _mathJs.abs)(cr) > (0, _mathJs.epsilon); // TODO optimise for this common case - function interpolate(from, to, direction, stream) { - (0, _circleJs.circleStream)(stream, radius, delta, direction, from, to); - } - function visible(lambda, phi) { - return (0, _mathJs.cos)(lambda) * (0, _mathJs.cos)(phi) > cr; - } - // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // should be rejoined. - function clipLine(stream) { - var point0, c0, v0, v00, clean; // no intersections - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [ - lambda, - phi - ], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi)), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || (0, _pointEqualJsDefault.default)(point0, point2) || (0, _pointEqualJsDefault.default)(point1, point2)) point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - // If the codes for two points are different, or are both zero, - // and there this segment intersects with the small circle. - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - } else { - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - stream.lineStart(); - stream.point(t[0][0], t[0][1], 3); - } - } - } - if (v && (!point0 || !(0, _pointEqualJsDefault.default)(point0, point1))) stream.point(point1[0], point1[1]); - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = null; - }, - // Rejoin first and last segments if there were intersections and the first - // and last points were visible. - clean: function() { - return clean | (v00 && v0) << 1; - } - }; - } - // Intersects the great circle between a and b with the clip circle. - function intersect(a, b, two) { - var pa = (0, _cartesianJs.cartesian)(a), pb = (0, _cartesianJs.cartesian)(b); - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [ - 1, - 0, - 0 - ], n2 = (0, _cartesianJs.cartesianCross)(pa, pb), n2n2 = (0, _cartesianJs.cartesianDot)(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; - // Two polar points. - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = (0, _cartesianJs.cartesianCross)(n1, n2), A = (0, _cartesianJs.cartesianScale)(n1, c1), B = (0, _cartesianJs.cartesianScale)(n2, c2); - (0, _cartesianJs.cartesianAddInPlace)(A, B); - // Solve |p(t)|^2 = 1. - var u = n1xn2, w = (0, _cartesianJs.cartesianDot)(A, u), uu = (0, _cartesianJs.cartesianDot)(u, u), t2 = w * w - uu * ((0, _cartesianJs.cartesianDot)(A, A) - 1); - if (t2 < 0) return; - var t = (0, _mathJs.sqrt)(t2), q = (0, _cartesianJs.cartesianScale)(u, (-w - t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q, A); - q = (0, _cartesianJs.spherical)(q); - if (!two) return q; - // Two intersection points. - var lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1], z; - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - var delta = lambda1 - lambda0, polar = (0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon), meridian = polar || delta < (0, _mathJs.epsilon); - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - // Check that the first point is between a and b. - if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < ((0, _mathJs.abs)(q[0] - lambda0) < (0, _mathJs.epsilon) ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > (0, _mathJs.pi) ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = (0, _cartesianJs.cartesianScale)(u, (-w + t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q1, A); - return [ - q, - (0, _cartesianJs.spherical)(q1) - ]; - } - } - // Generates a 4-bit vector representing the location of a point relative to - // the small circle's bounding box. - function code(lambda, phi) { - var r = smallRadius ? radius : (0, _mathJs.pi) - radius, code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - return (0, _indexJsDefault.default)(visible, clipLine, interpolate, smallRadius ? [ - 0, - -radius - ] : [ - -(0, _mathJs.pi), - radius - (0, _mathJs.pi) - ]); - }); -var _cartesianJs = require("../cartesian.js"); -var _circleJs = require("../circle.js"); -var _mathJs = require("../math.js"); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); - -},{"../cartesian.js":"i2DwM","../circle.js":"lPX3u","../math.js":"74X19","../pointEqual.js":"f0mBF","./index.js":"gHqWc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9kmAt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>clipRectangle); -var _mathJs = require("../math.js"); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _d3Array = require("d3-array"); -var clipMax = 1e9, clipMin = -clipMax; -function clipRectangle(x0, y0, x1, y1) { - function visible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - else stream.point(to[0], to[1]); + return schemes[name]; } - function corner(p, direction) { - return (0, _mathJs.abs)(p[0] - x0) < (0, _mathJs.epsilon) ? direction > 0 ? 0 : 3 : (0, _mathJs.abs)(p[0] - x1) < (0, _mathJs.epsilon) ? direction > 0 ? 2 : 1 : (0, _mathJs.abs)(p[1] - y0) < (0, _mathJs.epsilon) ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon - } - function compareIntersection(a, b) { - return comparePoint(a.x, b.x); - } - function comparePoint(a, b) { - var ca = corner(a, 1), cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - return function(stream) { - var activeStream = stream, bufferStream = (0, _bufferJsDefault.default)(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; - var clipStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: polygonStart, - polygonEnd: polygonEnd - }; - function point(x, y) { - if (visible(x, y)) activeStream.point(x, y); - } - function polygonInside() { - var winding = 0; - for(var i = 0, n = polygon.length; i < n; ++i)for(var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j){ - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { - if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; - } else if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; - } - return winding; - } - // Buffer geometry within a polygon and then clip it en masse. - function polygonStart() { - activeStream = bufferStream, segments = [], polygon = [], clean = true; - } - function polygonEnd() { - var startInside = polygonInside(), cleanInside = clean && startInside, visible = (segments = (0, _d3Array.merge)(segments)).length; - if (cleanInside || visible) { - stream.polygonStart(); - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - if (visible) (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, stream); - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - // TODO rather than special-case polygons, simply handle them separately. - // Ideally, coincident intersection points should be jittered to avoid - // clipping issues. - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferStream.rejoin(); - segments.push(bufferStream.result()); - } - clipStream.point = point; - if (v_) activeStream.lineEnd(); - } - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([ - x, - y - ]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else if (v && v_) activeStream.point(x, y); - else { - var a = [ - x_ = Math.max(clipMin, Math.min(clipMax, x_)), - y_ = Math.max(clipMin, Math.min(clipMax, y_)) - ], b = [ - x = Math.max(clipMin, Math.min(clipMax, x)), - y = Math.max(clipMin, Math.min(clipMax, y)) - ]; - if ((0, _lineJsDefault.default)(a, b, x0, y0, x1, y1)) { - if (!v_) { - activeStream.lineStart(); - activeStream.point(a[0], a[1]); - } - activeStream.point(b[0], b[1]); - if (!v) activeStream.lineEnd(); - clean = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - x_ = x, y_ = y, v_ = v; - } - return clipStream; - }; -} - -},{"../math.js":"74X19","./buffer.js":"6d6VN","./line.js":"eNqzi","./rejoin.js":"6J55y","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eNqzi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b, x0, y0, x1, y1) { - var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"arQrO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>graticule); -parcelHelpers.export(exports, "graticule10", ()=>graticule10); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -function graticuleX(y0, y1, dy) { - var y = (0, _d3Array.range)(y0, y1 - (0, _mathJs.epsilon), dy).concat(y1); - return function(x) { - return y.map(function(y) { - return [ - x, - y - ]; - }); - }; -} -function graticuleY(x0, x1, dx) { - var x = (0, _d3Array.range)(x0, x1 - (0, _mathJs.epsilon), dx).concat(x1); - return function(y) { - return x.map(function(x) { - return [ - x, - y - ]; - }); - }; -} -function graticule() { - var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; + } + const SymbolLegend = "symbol"; + const DiscreteLegend = "discrete"; + const GradientLegend = "gradient"; + const defaultFormatter = (value2) => isArray(value2) ? value2.map((v) => String(v)) : String(value2); + const ascending = (a2, b2) => a2[1] - b2[1]; + const descending = (a2, b2) => b2[1] - a2[1]; + function tickCount(scale2, count2, minStep) { + let step; + if (isNumber$1(count2)) { + if (scale2.bins) { + count2 = Math.max(count2, scale2.bins.length); + } + if (minStep != null) { + count2 = Math.min(count2, Math.floor(span(scale2.domain()) / minStep || 1) + 1); + } } - function lines() { - return (0, _d3Array.range)((0, _mathJs.ceil)(X0 / DX) * DX, X1, DX).map(X).concat((0, _d3Array.range)((0, _mathJs.ceil)(Y0 / DY) * DY, Y1, DY).map(Y)).concat((0, _d3Array.range)((0, _mathJs.ceil)(x0 / dx) * dx, x1, dx).filter(function(x) { - return (0, _mathJs.abs)(x % DX) > (0, _mathJs.epsilon); - }).map(x)).concat((0, _d3Array.range)((0, _mathJs.ceil)(y0 / dy) * dy, y1, dy).filter(function(y) { - return (0, _mathJs.abs)(y % DY) > (0, _mathJs.epsilon); - }).map(y)); - } - graticule.lines = function() { - return lines().map(function(coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; + if (isObject$1(count2)) { + step = count2.step; + count2 = count2.interval; + } + if (isString(count2)) { + count2 = scale2.type === Time ? timeInterval(count2) : scale2.type == UTC ? utcInterval(count2) : error("Only time and utc scales accept interval strings."); + if (step) count2 = count2.every(step); + } + return count2; + } + function validTicks(scale2, ticks2, count2) { + let range2 = scale2.range(), lo = range2[0], hi = peek$1(range2), cmp = ascending; + if (lo > hi) { + range2 = hi; + hi = lo; + lo = range2; + cmp = descending; + } + lo = Math.floor(lo); + hi = Math.ceil(hi); + ticks2 = ticks2.map((v) => [v, scale2(v)]).filter((_) => lo <= _[1] && _[1] <= hi).sort(cmp).map((_) => _[0]); + if (count2 > 0 && ticks2.length > 1) { + const endpoints = [ticks2[0], peek$1(ticks2)]; + while (ticks2.length > count2 && ticks2.length >= 3) { + ticks2 = ticks2.filter((_, i) => !(i % 2)); + } + if (ticks2.length < 3) { + ticks2 = endpoints; + } + } + return ticks2; + } + function tickValues(scale2, count2) { + return scale2.bins ? validTicks(scale2, scale2.bins, count2) : scale2.ticks ? scale2.ticks(count2) : scale2.domain(); + } + function tickFormat(locale2, scale2, count2, specifier, formatType, noSkip) { + const type2 = scale2.type; + let format2 = defaultFormatter; + if (type2 === Time || formatType === Time) { + format2 = locale2.timeFormat(specifier); + } else if (type2 === UTC || formatType === UTC) { + format2 = locale2.utcFormat(specifier); + } else if (isLogarithmic(type2)) { + const varfmt = locale2.formatFloat(specifier); + if (noSkip || scale2.bins) { + format2 = varfmt; + } else { + const test2 = tickLog(scale2, count2, false); + format2 = (_) => test2(_) ? varfmt(_) : ""; + } + } else if (scale2.tickFormat) { + const d = scale2.domain(); + format2 = locale2.formatSpan(d[0], d[d.length - 1], count2, specifier); + } else if (specifier) { + format2 = locale2.format(specifier); + } + return format2; + } + function tickLog(scale2, count2, values2) { + const ticks2 = tickValues(scale2, count2), base2 = scale2.base(), logb = Math.log(base2), k = Math.max(1, base2 * count2 / ticks2.length); + const test2 = (d) => { + let i = d / Math.pow(base2, Math.round(Math.log(d) / logb)); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k; + }; + return values2 ? ticks2.filter(test2) : test2; + } + const symbols$1 = { + [Quantile]: "quantiles", + [Quantize]: "thresholds", + [Threshold]: "domain" + }; + const formats = { + [Quantile]: "quantiles", + [Quantize]: "domain" + }; + function labelValues(scale2, count2) { + return scale2.bins ? binValues(scale2.bins) : scale2.type === Log$1 ? tickLog(scale2, count2, true) : symbols$1[scale2.type] ? thresholdValues(scale2[symbols$1[scale2.type]]()) : tickValues(scale2, count2); + } + function thresholdFormat(locale2, scale2, specifier) { + const _ = scale2[formats[scale2.type]](), n = _.length; + let d = n > 1 ? _[1] - _[0] : _[0], i; + for (i = 1; i < n; ++i) { + d = Math.min(d, _[i] - _[i - 1]); + } + return locale2.formatSpan(0, d, 3 * 10, specifier); + } + function thresholdValues(thresholds) { + const values2 = [-Infinity].concat(thresholds); + values2.max = Infinity; + return values2; + } + function binValues(bins) { + const values2 = bins.slice(0, -1); + values2.max = peek$1(bins); + return values2; + } + const isDiscreteRange = (scale2) => symbols$1[scale2.type] || scale2.bins; + function labelFormat(locale2, scale2, count2, type2, specifier, formatType, noSkip) { + const format2 = formats[scale2.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale2, scale2, specifier) : tickFormat(locale2, scale2, count2, specifier, formatType, noSkip); + return type2 === SymbolLegend && isDiscreteRange(scale2) ? formatRange(format2) : type2 === DiscreteLegend ? formatDiscrete(format2) : formatPoint(format2); + } + const formatRange = (format2) => (value2, index2, array2) => { + const limit = get$3(array2[index2 + 1], get$3(array2.max, Infinity)), lo = formatValue$1(value2, format2), hi = formatValue$1(limit, format2); + return lo && hi ? lo + " – " + hi : hi ? "< " + hi : "≥ " + lo; + }; + const get$3 = (value2, dflt) => value2 != null ? value2 : dflt; + const formatDiscrete = (format2) => (value2, index2) => index2 ? format2(value2) : null; + const formatPoint = (format2) => (value2) => format2(value2); + const formatValue$1 = (value2, format2) => Number.isFinite(value2) ? format2(value2) : null; + function labelFraction(scale2) { + const domain2 = scale2.domain(), count2 = domain2.length - 1; + let lo = +domain2[0], hi = +peek$1(domain2), span2 = hi - lo; + if (scale2.type === Threshold) { + const adjust = count2 ? span2 / count2 : 0.1; + lo -= adjust; + hi += adjust; + span2 = hi - lo; + } + return (value2) => (value2 - lo) / span2; + } + function format$1(locale2, scale2, specifier, formatType) { + const type2 = formatType || scale2.type; + if (isString(specifier) && isTemporal(type2)) { + specifier = specifier.replace(/%a/g, "%A").replace(/%b/g, "%B"); + } + return !specifier && type2 === Time ? locale2.timeFormat("%A, %d %B %Y, %X") : !specifier && type2 === UTC ? locale2.utcFormat("%A, %d %B %Y, %X UTC") : labelFormat(locale2, scale2, 5, null, specifier, formatType, true); + } + function domainCaption(locale2, scale2, opt) { + opt = opt || {}; + const max2 = Math.max(3, opt.maxlen || 7), fmt = format$1(locale2, scale2, opt.format, opt.formatType); + if (isDiscretizing(scale2.type)) { + const v = labelValues(scale2).slice(1).map(fmt), n = v.length; + return `${n} boundar${n === 1 ? "y" : "ies"}: ${v.join(", ")}`; + } else if (isDiscrete(scale2.type)) { + const d = scale2.domain(), n = d.length, v = n > max2 ? d.slice(0, max2 - 2).map(fmt).join(", ") + ", ending with " + d.slice(-1).map(fmt) : d.map(fmt).join(", "); + return `${n} value${n === 1 ? "" : "s"}: ${v}`; + } else { + const d = scale2.domain(); + return `values from ${fmt(d[0])} to ${fmt(peek$1(d))}`; + } + } + let gradient_id = 0; + function resetSVGGradientId() { + gradient_id = 0; + } + const patternPrefix = "p_"; + function isGradient(value2) { + return value2 && value2.gradient; + } + function gradientRef(g, defs, base2) { + const type2 = g.gradient; + let id2 = g.id, prefix = type2 === "radial" ? patternPrefix : ""; + if (!id2) { + id2 = g.id = "gradient_" + gradient_id++; + if (type2 === "radial") { + g.x1 = get$2(g.x1, 0.5); + g.y1 = get$2(g.y1, 0.5); + g.r1 = get$2(g.r1, 0); + g.x2 = get$2(g.x2, 0.5); + g.y2 = get$2(g.y2, 0.5); + g.r2 = get$2(g.r2, 0.5); + prefix = patternPrefix; + } else { + g.x1 = get$2(g.x1, 0); + g.y1 = get$2(g.y1, 0); + g.x2 = get$2(g.x2, 1); + g.y2 = get$2(g.y2, 0); + } + } + defs[id2] = g; + return "url(" + (base2 || "") + "#" + prefix + id2 + ")"; + } + function get$2(val, def2) { + return val != null ? val : def2; + } + function Gradient$1(p02, p1) { + var stops = [], gradient2; + return gradient2 = { + gradient: "linear", + x1: p02 ? p02[0] : 0, + y1: p02 ? p02[1] : 0, + x2: p1 ? p1[0] : 1, + y2: p1 ? p1[1] : 0, + stops, + stop: function(offset2, color2) { + stops.push({ + offset: offset2, + color: color2 }); + return gradient2; + } }; - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) - ] - }; - }; - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - graticule.extentMajor = function(_) { - if (!arguments.length) return [ - [ - X0, - Y0 - ], - [ - X1, - Y1 - ] - ]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - graticule.extentMinor = function(_) { - if (!arguments.length) return [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - graticule.stepMajor = function(_) { - if (!arguments.length) return [ - DX, - DY - ]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - graticule.stepMinor = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - return graticule.extentMajor([ - [ - -180, - -90 + (0, _mathJs.epsilon) - ], - [ - 180, - 90 - (0, _mathJs.epsilon) - ] - ]).extentMinor([ - [ - -180, - -80 - (0, _mathJs.epsilon) - ], - [ - 180, - 80 + (0, _mathJs.epsilon) - ] - ]); -} -function graticule10() { - return graticule()(); -} - -},{"d3-array":"6IwJG","./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gBtNJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(projection, context) { - let digits = 3, pointRadius = 4.5, projectionStream, contextStream; - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - (0, _streamJsDefault.default)(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - path.area = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _areaJsDefault.default))); - return (0, _areaJsDefault.default).result(); - }; - path.measure = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _measureJsDefault.default))); - return (0, _measureJsDefault.default).result(); - }; - path.bounds = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _boundsJsDefault.default))); - return (0, _boundsJsDefault.default).result(); - }; - path.centroid = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _centroidJsDefault.default))); - return (0, _centroidJsDefault.default).result(); - }; - path.projection = function(_) { - if (!arguments.length) return projection; - projectionStream = _ == null ? (projection = null, _identityJsDefault.default) : (projection = _).stream; - return path; - }; - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new (0, _stringJsDefault.default)(digits)) : new (0, _contextJsDefault.default)(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - path.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - if (context === null) contextStream = new (0, _stringJsDefault.default)(digits); - return path; - }; - return path.projection(projection).digits(digits).context(context); - }); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _contextJs = require("./context.js"); -var _contextJsDefault = parcelHelpers.interopDefault(_contextJs); -var _measureJs = require("./measure.js"); -var _measureJsDefault = parcelHelpers.interopDefault(_measureJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); - -},{"../identity.js":"kub29","../stream.js":"9nFXd","./area.js":"5SF2U","./bounds.js":"bhNL9","./centroid.js":"lPOtc","./context.js":"fIlZ0","./measure.js":"iTRFv","./string.js":"gD9Wt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kub29":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5SF2U":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var areaSum = new (0, _d3Array.Adder)(), areaRingSum = new (0, _d3Array.Adder)(), x00, y00, x0, y0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; + } + const lookup$4 = { + "basis": { + curve: curveBasis }, - polygonEnd: function() { - areaStream.lineStart = areaStream.lineEnd = areaStream.point = (0, _noopJsDefault.default); - areaSum.add((0, _mathJs.abs)(areaRingSum)); - areaRingSum = new (0, _d3Array.Adder)(); + "basis-closed": { + curve: curveBasisClosed }, - result: function() { - var area = areaSum / 2; - areaSum = new (0, _d3Array.Adder)(); - return area; - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaPointFirst(x, y) { - areaStream.point = areaPoint; - x00 = x0 = x, y00 = y0 = y; -} -function areaPoint(x, y) { - areaRingSum.add(y0 * x - x0 * y); - x0 = x, y0 = y; -} -function areaRingEnd() { - areaPoint(x00, y00); -} -exports.default = areaStream; - -},{"d3-array":"6IwJG","../math.js":"74X19","../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bhNL9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var x0 = Infinity, y0 = x0, x1 = -x0, y1 = x1; -var boundsStream = { - point: boundsPoint, - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: (0, _noopJsDefault.default), - polygonEnd: (0, _noopJsDefault.default), - result: function() { - var bounds = [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x1 = y1 = -(y0 = x0 = Infinity); - return bounds; - } -}; -function boundsPoint(x, y) { - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; -} -exports.default = boundsStream; - -},{"../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPOtc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -// TODO Enforce positive area for exterior, negative area for interior? -var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00, y00, x0, y0; -var centroidStream = { - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; + "basis-open": { + curve: curveBasisOpen }, - polygonEnd: function() { - centroidStream.point = centroidPoint; - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; + "bundle": { + curve: curveBundle, + tension: "beta", + value: 0.85 }, - result: function() { - var centroid = Z2 ? [ - X2 / Z2, - Y2 / Z2 - ] : Z1 ? [ - X1 / Z1, - Y1 / Z1 - ] : Z0 ? [ - X0 / Z0, - Y0 / Z0 - ] : [ - NaN, - NaN - ]; - X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; - return centroid; - } -}; -function centroidPoint(x, y) { - X0 += x; - Y0 += y; - ++Z0; -} -function centroidLineStart() { - centroidStream.point = centroidPointFirstLine; -} -function centroidPointFirstLine(x, y) { - centroidStream.point = centroidPointLine; - centroidPoint(x0 = x, y0 = y); -} -function centroidPointLine(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - centroidPoint(x0 = x, y0 = y); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -function centroidRingStart() { - centroidStream.point = centroidPointFirstRing; -} -function centroidRingEnd() { - centroidPointRing(x00, y00); -} -function centroidPointFirstRing(x, y) { - centroidStream.point = centroidPointRing; - centroidPoint(x00 = x0 = x, y00 = y0 = y); -} -function centroidPointRing(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - z = y0 * x - x0 * y; - X2 += z * (x0 + x); - Y2 += z * (y0 + y); - Z2 += z * 3; - centroidPoint(x0 = x, y0 = y); -} -exports.default = centroidStream; - -},{"../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fIlZ0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>PathContext); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function PathContext(context) { - this._context = context; -} -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; + "cardinal": { + curve: curveCardinal, + tension: "tension", + value: 0 }, - polygonStart: function() { - this._line = 0; + "cardinal-open": { + curve: curveCardinalOpen, + tension: "tension", + value: 0 }, - polygonEnd: function() { - this._line = NaN; + "cardinal-closed": { + curve: curveCardinalClosed, + tension: "tension", + value: 0 }, - lineStart: function() { - this._point = 0; + "catmull-rom": { + curve: curveCatmullRom, + tension: "alpha", + value: 0.5 }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; + "catmull-rom-closed": { + curve: curveCatmullRomClosed, + tension: "alpha", + value: 0.5 }, - point: function(x, y) { - switch(this._point){ - case 0: - this._context.moveTo(x, y); - this._point = 1; - break; - case 1: - this._context.lineTo(x, y); - break; - default: - this._context.moveTo(x + this._radius, y); - this._context.arc(x, y, this._radius, 0, (0, _mathJs.tau)); - break; - } + "catmull-rom-open": { + curve: curveCatmullRomOpen, + tension: "alpha", + value: 0.5 }, - result: (0, _noopJsDefault.default) -}; - -},{"../math.js":"74X19","../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iTRFv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var lengthSum = new (0, _d3Array.Adder)(), lengthRing, x00, y00, x0, y0; -var lengthStream = { - point: (0, _noopJsDefault.default), - lineStart: function() { - lengthStream.point = lengthPointFirst; + "linear": { + curve: curveLinear }, - lineEnd: function() { - if (lengthRing) lengthPoint(x00, y00); - lengthStream.point = (0, _noopJsDefault.default); + "linear-closed": { + curve: curveLinearClosed }, - polygonStart: function() { - lengthRing = true; + "monotone": { + horizontal: monotoneY, + vertical: monotoneX }, - polygonEnd: function() { - lengthRing = null; + "natural": { + curve: curveNatural }, - result: function() { - var length = +lengthSum; - lengthSum = new (0, _d3Array.Adder)(); - return length; + "step": { + curve: curveStep + }, + "step-after": { + curve: stepAfter + }, + "step-before": { + curve: stepBefore } -}; -function lengthPointFirst(x, y) { - lengthStream.point = lengthPoint; - x00 = x0 = x, y00 = y0 = y; -} -function lengthPoint(x, y) { - x0 -= x, y0 -= y; - lengthSum.add((0, _mathJs.sqrt)(x0 * x0 + y0 * y0)); - x0 = x, y0 = y; -} -exports.default = lengthStream; - -},{"d3-array":"6IwJG","../math.js":"74X19","../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gD9Wt":[function(require,module,exports,__globalThis) { -// Simple caching for constant-radius points. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -let cacheDigits, cacheAppend, cacheRadius, cacheCircle; -class PathString { - constructor(digits){ - this._append = digits == null ? append : appendRound(digits); - this._radius = 4.5; - this._ = ""; + }; + function curves(type2, orientation, tension) { + var entry2 = has$1(lookup$4, type2) && lookup$4[type2], curve2 = null; + if (entry2) { + curve2 = entry2.curve || entry2[orientation || "vertical"]; + if (entry2.tension && tension != null) { + curve2 = curve2[entry2.tension](tension); + } } - pointRadius(_) { - this._radius = +_; - return this; + return curve2; + } + const paramCounts = { + m: 2, + l: 2, + h: 1, + v: 1, + z: 0, + c: 6, + s: 4, + q: 4, + t: 2, + a: 7 + }; + const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; + const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; + const spacePattern = /^((\s+,?\s*)|(,\s*))/; + const flagPattern = /^[01]/; + function parse$3(path2) { + const commands = []; + const matches = path2.match(commandPattern) || []; + matches.forEach((str) => { + let cmd = str[0]; + const type2 = cmd.toLowerCase(); + const paramCount = paramCounts[type2]; + const params2 = parseParams(type2, paramCount, str.slice(1).trim()); + const count2 = params2.length; + if (count2 < paramCount || count2 && count2 % paramCount !== 0) { + throw Error("Invalid SVG path, incorrect parameter count"); + } + commands.push([cmd, ...params2.slice(0, paramCount)]); + if (count2 === paramCount) { + return; + } + if (type2 === "m") { + cmd = cmd === "M" ? "L" : "l"; + } + for (let i = paramCount; i < count2; i += paramCount) { + commands.push([cmd, ...params2.slice(i, i + paramCount)]); + } + }); + return commands; + } + function parseParams(type2, paramCount, segment) { + const params2 = []; + for (let index2 = 0; paramCount && index2 < segment.length; ) { + for (let i = 0; i < paramCount; ++i) { + const pattern = type2 === "a" && (i === 3 || i === 4) ? flagPattern : numberPattern; + const match2 = segment.slice(index2).match(pattern); + if (match2 === null) { + throw Error("Invalid SVG path, incorrect parameter type"); + } + index2 += match2[0].length; + params2.push(+match2[0]); + const ws = segment.slice(index2).match(spacePattern); + if (ws !== null) { + index2 += ws[0].length; + } + } } - polygonStart() { - this._line = 0; + return params2; + } + const DegToRad = Math.PI / 180; + const Epsilon = 1e-14; + const HalfPi = Math.PI / 2; + const Tau = Math.PI * 2; + const HalfSqrt3 = Math.sqrt(3) / 2; + var segmentCache = {}; + var bezierCache = {}; + var join$1 = [].join; + function segments(x2, y2, rx, ry, large, sweep, rotateX2, ox, oy) { + const key2 = join$1.call(arguments); + if (segmentCache[key2]) { + return segmentCache[key2]; + } + const th = rotateX2 * DegToRad; + const sin_th = Math.sin(th); + const cos_th = Math.cos(th); + rx = Math.abs(rx); + ry = Math.abs(ry); + const px2 = cos_th * (ox - x2) * 0.5 + sin_th * (oy - y2) * 0.5; + const py2 = cos_th * (oy - y2) * 0.5 - sin_th * (ox - x2) * 0.5; + let pl = px2 * px2 / (rx * rx) + py2 * py2 / (ry * ry); + if (pl > 1) { + pl = Math.sqrt(pl); + rx *= pl; + ry *= pl; } - polygonEnd() { - this._line = NaN; + const a00 = cos_th / rx; + const a01 = sin_th / rx; + const a10 = -sin_th / ry; + const a11 = cos_th / ry; + const x02 = a00 * ox + a01 * oy; + const y02 = a10 * ox + a11 * oy; + const x12 = a00 * x2 + a01 * y2; + const y12 = a10 * x2 + a11 * y2; + const d = (x12 - x02) * (x12 - x02) + (y12 - y02) * (y12 - y02); + let sfactor_sq = 1 / d - 0.25; + if (sfactor_sq < 0) sfactor_sq = 0; + let sfactor = Math.sqrt(sfactor_sq); + if (sweep == large) sfactor = -sfactor; + const xc = 0.5 * (x02 + x12) - sfactor * (y12 - y02); + const yc = 0.5 * (y02 + y12) + sfactor * (x12 - x02); + const th0 = Math.atan2(y02 - yc, x02 - xc); + const th1 = Math.atan2(y12 - yc, x12 - xc); + let th_arc = th1 - th0; + if (th_arc < 0 && sweep === 1) { + th_arc += Tau; + } else if (th_arc > 0 && sweep === 0) { + th_arc -= Tau; } - lineStart() { - this._point = 0; + const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 1e-3))); + const result = []; + for (let i = 0; i < segs; ++i) { + const th2 = th0 + i * th_arc / segs; + const th3 = th0 + (i + 1) * th_arc / segs; + result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th]; } - lineEnd() { - if (this._line === 0) this._ += "Z"; - this._point = NaN; - } - point(x, y) { - switch(this._point){ - case 0: - this._append`M${x},${y}`; - this._point = 1; - break; - case 1: - this._append`L${x},${y}`; - break; - default: - this._append`M${x},${y}`; - if (this._radius !== cacheRadius || this._append !== cacheAppend) { - const r = this._radius; - const s = this._; - this._ = ""; // stash the old string so we can cache the circle path fragment - this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; - cacheRadius = r; - cacheAppend = this._append; - cacheCircle = this._; - this._ = s; - } - this._ += cacheCircle; - break; - } + return segmentCache[key2] = result; + } + function bezier(params2) { + const key2 = join$1.call(params2); + if (bezierCache[key2]) { + return bezierCache[key2]; } - result() { - const result = this._; - this._ = ""; - return result.length ? result : null; + var cx = params2[0], cy = params2[1], th0 = params2[2], th1 = params2[3], rx = params2[4], ry = params2[5], sin_th = params2[6], cos_th = params2[7]; + const a00 = cos_th * rx; + const a01 = -sin_th * ry; + const a10 = sin_th * rx; + const a11 = cos_th * ry; + const cos_th0 = Math.cos(th0); + const sin_th0 = Math.sin(th0); + const cos_th1 = Math.cos(th1); + const sin_th1 = Math.sin(th1); + const th_half = 0.5 * (th1 - th0); + const sin_th_h2 = Math.sin(th_half * 0.5); + const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); + const x12 = cx + cos_th0 - t * sin_th0; + const y12 = cy + sin_th0 + t * cos_th0; + const x3 = cx + cos_th1; + const y3 = cy + sin_th1; + const x2 = x3 + t * sin_th1; + const y2 = y3 - t * cos_th1; + return bezierCache[key2] = [a00 * x12 + a01 * y12, a10 * x12 + a11 * y12, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3]; + } + const temp = ["l", 0, 0, 0, 0, 0, 0, 0]; + function scale$1$1(current, sX, sY) { + const c2 = temp[0] = current[0]; + if (c2 === "a" || c2 === "A") { + temp[1] = sX * current[1]; + temp[2] = sY * current[2]; + temp[3] = current[3]; + temp[4] = current[4]; + temp[5] = current[5]; + temp[6] = sX * current[6]; + temp[7] = sY * current[7]; + } else if (c2 === "h" || c2 === "H") { + temp[1] = sX * current[1]; + } else if (c2 === "v" || c2 === "V") { + temp[1] = sY * current[1]; + } else { + for (var i = 1, n = current.length; i < n; ++i) { + temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; + } } -} -exports.default = PathString; -function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - const d = Math.floor(digits); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`); - if (d > 15) return append; - if (d !== cacheDigits) { - const k = 10 ** d; - cacheDigits = d; - cacheAppend = function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; - }; + return temp; + } + function pathRender(context2, path2, l, t, sX, sY) { + var current, previous = null, x2 = 0, y2 = 0, controlX = 0, controlY = 0, tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; + if (l == null) l = 0; + if (t == null) t = 0; + if (sX == null) sX = 1; + if (sY == null) sY = sX; + if (context2.beginPath) context2.beginPath(); + for (var i = 0, len2 = path2.length; i < len2; ++i) { + current = path2[i]; + if (sX !== 1 || sY !== 1) { + current = scale$1$1(current, sX, sY); + } + switch (current[0]) { + // first letter + case "l": + x2 += current[1]; + y2 += current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "L": + x2 = current[1]; + y2 = current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "h": + x2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "H": + x2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "v": + y2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "V": + y2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "m": + x2 += current[1]; + y2 += current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "M": + x2 = current[1]; + y2 = current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "c": + tempX = x2 + current[5]; + tempY = y2 + current[6]; + controlX = x2 + current[3]; + controlY = y2 + current[4]; + context2.bezierCurveTo( + x2 + current[1] + l, + // x1 + y2 + current[2] + t, + // y1 + controlX + l, + // x2 + controlY + t, + // y2 + tempX + l, + tempY + t + ); + x2 = tempX; + y2 = tempY; + break; + case "C": + x2 = current[5]; + y2 = current[6]; + controlX = current[3]; + controlY = current[4]; + context2.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x2 + l, y2 + t); + break; + case "s": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, x2 + current[1] + l, y2 + current[2] + t, tempX + l, tempY + t); + controlX = x2 + current[1]; + controlY = y2 + current[2]; + x2 = tempX; + y2 = tempY; + break; + case "S": + tempX = current[3]; + tempY = current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "q": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "Q": + tempX = current[3]; + tempY = current[4]; + context2.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "t": + tempX = x2 + current[1]; + tempY = y2 + current[2]; + if (previous[0].match(/[QqTt]/) === null) { + controlX = x2; + controlY = y2; + } else if (previous[0] === "t") { + controlX = 2 * x2 - tempControlX; + controlY = 2 * y2 - tempControlY; + } else if (previous[0] === "q") { + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + } + tempControlX = controlX; + tempControlY = controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + break; + case "T": + tempX = current[1]; + tempY = current[2]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "a": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x2 + l, current[7] + y2 + t]); + x2 += current[6]; + y2 += current[7]; + break; + case "A": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]); + x2 = current[6]; + y2 = current[7]; + break; + case "z": + case "Z": + x2 = anchorX; + y2 = anchorY; + context2.closePath(); + break; + } + previous = current; } - return cacheAppend; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dSks5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicEqualAreaJsDefault.default)().parallels([ - 29.5, - 45.5 - ]).scale(1070).translate([ - 480, - 250 - ]).rotate([ - 96, - 0 - ]).center([ - -0.6, - 38.7 - ]); - }); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); - -},{"./conicEqualArea.js":"17j9x","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"17j9x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEqualAreaRaw", ()=>conicEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEqualAreaRaw).scale(155.424).center([ - 0, - 33.6442 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -function conicEqualAreaRaw(y0, y1) { - var sy0 = (0, _mathJs.sin)(y0), n = (sy0 + (0, _mathJs.sin)(y1)) / 2; - // Are the parallels symmetrical around the Equator? - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return (0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)(y0); - var c = 1 + sy0 * (2 * n - sy0), r0 = (0, _mathJs.sqrt)(c) / n; - function project(x, y) { - var r = (0, _mathJs.sqrt)(c - 2 * n * (0, _mathJs.sin)(y)) / n; - return [ - r * (0, _mathJs.sin)(x *= n), - r0 - r * (0, _mathJs.cos)(x) - ]; - } - project.invert = function(x, y) { - var r0y = r0 - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(r0y)) * (0, _mathJs.sign)(r0y); - if (r0y * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(r0y); - return [ - l / n, - (0, _mathJs.asin)((c - (x * x + r0y * r0y) * n * n) / (2 * n)) - ]; - }; - return project; -} - -},{"../math.js":"74X19","./conic.js":"15g8N","./cylindricalEqualArea.js":"j13Gc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"15g8N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicProjection", ()=>conicProjection); -var _mathJs = require("../math.js"); -var _indexJs = require("./index.js"); -function conicProjection(projectAt) { - var phi0 = 0, phi1 = (0, _mathJs.pi) / 3, m = (0, _indexJs.projectionMutator)(projectAt), p = m(phi0, phi1); - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * (0, _mathJs.radians), phi1 = _[1] * (0, _mathJs.radians)) : [ - phi0 * (0, _mathJs.degrees), - phi1 * (0, _mathJs.degrees) - ]; - }; - return p; -} - -},{"../math.js":"74X19","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cd9OX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>projection); -parcelHelpers.export(exports, "projectionMutator", ()=>projectionMutator); -var _antimeridianJs = require("../clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs = require("../clip/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _composeJs = require("../compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _resampleJs = require("./resample.js"); -var _resampleJsDefault = parcelHelpers.interopDefault(_resampleJs); -var transformRadians = (0, _transformJs.transformer)({ - point: function(x, y) { - this.stream.point(x * (0, _mathJs.radians), y * (0, _mathJs.radians)); - } -}); -function transformRotate(rotate) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); + } + function drawArc(context2, x2, y2, coords) { + const seg = segments( + coords[5], + // end x + coords[6], + // end y + coords[0], + // radius x + coords[1], + // radius y + coords[3], + // large flag + coords[4], + // sweep flag + coords[2], + // rotation + x2, + y2 + ); + for (let i = 0; i < seg.length; ++i) { + const bez = bezier(seg[i]); + context2.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); + } + } + const Tan30 = 0.5773502691896257; + const builtins = { + "circle": { + draw: function(context2, size2) { + const r = Math.sqrt(size2) / 2; + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, Tau); + } + }, + "cross": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, s = r / 2.5; + context2.moveTo(-r, -s); + context2.lineTo(-r, s); + context2.lineTo(-s, s); + context2.lineTo(-s, r); + context2.lineTo(s, r); + context2.lineTo(s, s); + context2.lineTo(r, s); + context2.lineTo(r, -s); + context2.lineTo(s, -s); + context2.lineTo(s, -r); + context2.lineTo(-s, -r); + context2.lineTo(-s, -s); + context2.closePath(); + } + }, + "diamond": { + draw: function(context2, size2) { + const r = Math.sqrt(size2) / 2; + context2.moveTo(-r, 0); + context2.lineTo(0, -r); + context2.lineTo(r, 0); + context2.lineTo(0, r); + context2.closePath(); + } + }, + "square": { + draw: function(context2, size2) { + var w2 = Math.sqrt(size2), x2 = -w2 / 2; + context2.rect(x2, x2, w2, w2); + } + }, + "arrow": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, s = r / 7, t = r / 2.5, v = r / 8; + context2.moveTo(-s, r); + context2.lineTo(s, r); + context2.lineTo(s, -v); + context2.lineTo(t, -v); + context2.lineTo(0, -r); + context2.lineTo(-t, -v); + context2.lineTo(-s, -v); + context2.closePath(); + } + }, + "wedge": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30, b2 = r / 4; + context2.moveTo(0, -h2 - o); + context2.lineTo(-b2, h2 - o); + context2.lineTo(b2, h2 - o); + context2.closePath(); + } + }, + "triangle": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30; + context2.moveTo(0, -h2 - o); + context2.lineTo(-r, h2 - o); + context2.lineTo(r, h2 - o); + context2.closePath(); + } + }, + "triangle-up": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, -h2); + context2.lineTo(-r, h2); + context2.lineTo(r, h2); + context2.closePath(); + } + }, + "triangle-down": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, h2); + context2.lineTo(-r, -h2); + context2.lineTo(r, -h2); + context2.closePath(); + } + }, + "triangle-right": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(h2, 0); + context2.lineTo(-h2, -r); + context2.lineTo(-h2, r); + context2.closePath(); + } + }, + "triangle-left": { + draw: function(context2, size2) { + var r = Math.sqrt(size2) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(-h2, 0); + context2.lineTo(h2, -r); + context2.lineTo(h2, r); + context2.closePath(); + } + }, + "stroke": { + draw: function(context2, size2) { + const r = Math.sqrt(size2) / 2; + context2.moveTo(-r, 0); + context2.lineTo(r, 0); + } + } + }; + function symbols(_) { + return has$1(builtins, _) ? builtins[_] : customSymbol(_); + } + var custom = {}; + function customSymbol(path2) { + if (!has$1(custom, path2)) { + const parsed = parse$3(path2); + custom[path2] = { + draw: function(context2, size2) { + pathRender(context2, parsed, 0, 0, Math.sqrt(size2) / 2); } - }); -} -function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; - y *= sy; - return [ - dx + k * x, - dy - k * y - ]; - } - transform.invert = function(x, y) { - return [ - (x - dx) / k * sx, - (dy - y) / k * sy - ]; - }; - return transform; -} -function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); - var cosAlpha = (0, _mathJs.cos)(alpha), sinAlpha = (0, _mathJs.sin)(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform(x, y) { - x *= sx; - y *= sy; - return [ - a * x - b * y + dx, - dy - b * x - a * y - ]; - } - transform.invert = function(x, y) { - return [ - sx * (ai * x - bi * y + ci), - sy * (fi - bi * x - ai * y) - ]; - }; - return transform; -} -function projection(project) { - return projectionMutator(function() { - return project; - })(); -} -function projectionMutator(projectAt) { - var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = (0, _antimeridianJsDefault.default), x0 = null, y0, x1, y1, postclip = (0, _identityJsDefault.default), delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream; - function projection(point) { - return projectRotateTransform(point[0] * (0, _mathJs.radians), point[1] * (0, _mathJs.radians)); - } - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [ - point[0] * (0, _mathJs.degrees), - point[1] * (0, _mathJs.degrees) - ]; - } - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - projection.preclip = function(_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? (0, _circleJsDefault.default)(theta = _ * (0, _mathJs.radians)) : (theta = null, _antimeridianJsDefault.default), reset()) : theta * (0, _mathJs.degrees); - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [ - x, - y - ]; + }; + } + return custom[path2]; + } + const C = 0.448084975506; + function rectangleX(d) { + return d.x; + } + function rectangleY(d) { + return d.y; + } + function rectangleWidth(d) { + return d.width; + } + function rectangleHeight(d) { + return d.height; + } + function number$3(_) { + return typeof _ === "function" ? _ : () => +_; + } + function clamp(value2, min2, max2) { + return Math.max(min2, Math.min(value2, max2)); + } + function vg_rect() { + var x2 = rectangleX, y2 = rectangleY, width2 = rectangleWidth, height2 = rectangleHeight, crTL = number$3(0), crTR = crTL, crBL = crTL, crBR = crTL, context2 = null; + function rectangle2(_, x02, y02) { + var buffer, x12 = x02 != null ? x02 : +x2.call(this, _), y12 = y02 != null ? y02 : +y2.call(this, _), w2 = +width2.call(this, _), h2 = +height2.call(this, _), s = Math.min(w2, h2) / 2, tl2 = clamp(+crTL.call(this, _), 0, s), tr2 = clamp(+crTR.call(this, _), 0, s), bl2 = clamp(+crBL.call(this, _), 0, s), br2 = clamp(+crBR.call(this, _), 0, s); + if (!context2) context2 = buffer = path$3(); + if (tl2 <= 0 && tr2 <= 0 && bl2 <= 0 && br2 <= 0) { + context2.rect(x12, y12, w2, h2); + } else { + var x22 = x12 + w2, y22 = y12 + h2; + context2.moveTo(x12 + tl2, y12); + context2.lineTo(x22 - tr2, y12); + context2.bezierCurveTo(x22 - C * tr2, y12, x22, y12 + C * tr2, x22, y12 + tr2); + context2.lineTo(x22, y22 - br2); + context2.bezierCurveTo(x22, y22 - C * br2, x22 - C * br2, y22, x22 - br2, y22); + context2.lineTo(x12 + bl2, y22); + context2.bezierCurveTo(x12 + C * bl2, y22, x12, y22 - C * bl2, x12, y22 - bl2); + context2.lineTo(x12, y12 + tl2); + context2.bezierCurveTo(x12, y12 + C * tl2, x12 + C * tl2, y12, x12 + tl2, y12); + context2.closePath(); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } + } + rectangle2.x = function(_) { + if (arguments.length) { + x2 = number$3(_); + return rectangle2; + } else { + return x2; + } }; - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * (0, _mathJs.radians), phi = _[1] % 360 * (0, _mathJs.radians), recenter()) : [ - lambda * (0, _mathJs.degrees), - phi * (0, _mathJs.degrees) - ]; + rectangle2.y = function(_) { + if (arguments.length) { + y2 = number$3(_); + return rectangle2; + } else { + return y2; + } }; - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * (0, _mathJs.radians), deltaPhi = _[1] % 360 * (0, _mathJs.radians), deltaGamma = _.length > 2 ? _[2] % 360 * (0, _mathJs.radians) : 0, recenter()) : [ - deltaLambda * (0, _mathJs.degrees), - deltaPhi * (0, _mathJs.degrees), - deltaGamma * (0, _mathJs.degrees) - ]; + rectangle2.width = function(_) { + if (arguments.length) { + width2 = number$3(_); + return rectangle2; + } else { + return width2; + } }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), recenter()) : alpha * (0, _mathJs.degrees); + rectangle2.height = function(_) { + if (arguments.length) { + height2 = number$3(_); + return rectangle2; + } else { + return height2; + } }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; + rectangle2.cornerRadius = function(tl2, tr2, br2, bl2) { + if (arguments.length) { + crTL = number$3(tl2); + crTR = tr2 != null ? number$3(tr2) : crTL; + crBR = br2 != null ? number$3(br2) : crTL; + crBL = bl2 != null ? number$3(bl2) : crTR; + return rectangle2; + } else { + return crTL; + } }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; + rectangle2.context = function(_) { + if (arguments.length) { + context2 = _ == null ? null : _; + return rectangle2; + } else { + return context2; + } }; - projection.precision = function(_) { - return arguments.length ? (projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2 = _ * _), reset()) : (0, _mathJs.sqrt)(delta2); + return rectangle2; + } + function vg_trail() { + var x2, y2, size2, defined, context2 = null, ready, x12, y12, r1; + function point2(x22, y22, w2) { + const r2 = w2 / 2; + if (ready) { + var ux = y12 - y22, uy = x22 - x12; + if (ux || uy) { + var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); + context2.moveTo(x12 - rx, y12 - ry); + context2.lineTo(x22 - ux * r2, y22 - uy * r2); + context2.arc(x22, y22, r2, t - Math.PI, t); + context2.lineTo(x12 + rx, y12 + ry); + context2.arc(x12, y12, r1, t, t + Math.PI); + } else { + context2.arc(x22, y22, r2, 0, Tau); + } + context2.closePath(); + } else { + ready = 1; + } + x12 = x22; + y12 = y22; + r1 = r2; + } + function trail2(data2) { + var i, n = data2.length, d, defined0 = false, buffer; + if (context2 == null) context2 = buffer = path$3(); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) ready = 0; + } + if (defined0) point2(+x2(d, i, data2), +y2(d, i, data2), +size2(d, i, data2)); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } + } + trail2.x = function(_) { + if (arguments.length) { + x2 = _; + return trail2; + } else { + return x2; + } }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); + trail2.y = function(_) { + if (arguments.length) { + y2 = _; + return trail2; + } else { + return y2; + } }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); + trail2.size = function(_) { + if (arguments.length) { + size2 = _; + return trail2; + } else { + return size2; + } }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); + trail2.defined = function(_) { + if (arguments.length) { + defined = _; + return trail2; + } else { + return defined; + } }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); + trail2.context = function(_) { + if (arguments.length) { + if (_ == null) { + context2 = null; + } else { + context2 = _; + } + return trail2; + } else { + return context2; + } }; - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = (0, _rotationJs.rotateRadians)(deltaLambda, deltaPhi, deltaGamma); - projectTransform = (0, _composeJsDefault.default)(project, transform); - projectRotateTransform = (0, _composeJsDefault.default)(rotate, projectTransform); - projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2); - return reset(); + return trail2; + } + function value$1(a2, b2) { + return a2 != null ? a2 : b2; + } + const x$2 = (item) => item.x || 0, y$2 = (item) => item.y || 0, w = (item) => item.width || 0, h = (item) => item.height || 0, xw = (item) => (item.x || 0) + (item.width || 0), yh = (item) => (item.y || 0) + (item.height || 0), sa = (item) => item.startAngle || 0, ea = (item) => item.endAngle || 0, pa = (item) => item.padAngle || 0, ir = (item) => item.innerRadius || 0, or = (item) => item.outerRadius || 0, cr = (item) => item.cornerRadius || 0, tl = (item) => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item) => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item) => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item) => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item) => value$1(item.size, 64), ts = (item) => item.size || 1, def = (item) => !(item.defined === false), type = (item) => symbols(item.shape || "circle"); + const arcShape = arc$2$1().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = area$2$1().x(x$2).y1(y$2).y0(yh).defined(def), areahShape = area$2$1().y(y$2).x1(x$2).x0(xw).defined(def), lineShape = line$2$1().x(x$2).y(y$2).defined(def), rectShape = vg_rect().x(x$2).y(y$2).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = Symbol$1().type(type).size(sz), trailShape = vg_trail().x(x$2).y(y$2).defined(def).size(ts); + function hasCornerRadius(item) { + return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; + } + function arc$1(context2, item) { + return arcShape.context(context2)(item); + } + function area$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return (item.orient === "horizontal" ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function line$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return lineShape.curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function rectangle(context2, item, x2, y2) { + return rectShape.context(context2)(item, x2, y2); + } + function shape$1(context2, item) { + return (item.mark.shape || item.shape).context(context2)(item); + } + function symbol$1(context2, item) { + return symbolShape.context(context2)(item); + } + function trail$1(context2, items) { + return trailShape.context(context2)(items); + } + var clip_id = 1; + function resetSVGClipId() { + clip_id = 1; + } + function clip$1$1(renderer, item, size2) { + var clip2 = item.clip, defs = renderer._defs, id2 = item.clip_id || (item.clip_id = "clip" + clip_id++), c2 = defs.clipping[id2] || (defs.clipping[id2] = { + id: id2 + }); + if (isFunction(clip2)) { + c2.path = clip2(null); + } else if (hasCornerRadius(size2)) { + c2.path = rectangle(null, size2, 0, 0); + } else { + c2.width = size2.width || 0; + c2.height = size2.height || 0; } - function reset() { - cache = cacheStream = null; - return projection; + return "url(#" + id2 + ")"; + } + function Bounds(b2) { + this.clear(); + if (b2) this.union(b2); + } + Bounds.prototype = { + clone() { + return new Bounds(this); + }, + clear() { + this.x1 = +Number.MAX_VALUE; + this.y1 = +Number.MAX_VALUE; + this.x2 = -Number.MAX_VALUE; + this.y2 = -Number.MAX_VALUE; + return this; + }, + empty() { + return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; + }, + equals(b2) { + return this.x1 === b2.x1 && this.y1 === b2.y1 && this.x2 === b2.x2 && this.y2 === b2.y2; + }, + set(x12, y12, x2, y2) { + if (x2 < x12) { + this.x2 = x12; + this.x1 = x2; + } else { + this.x1 = x12; + this.x2 = x2; + } + if (y2 < y12) { + this.y2 = y12; + this.y1 = y2; + } else { + this.y1 = y12; + this.y2 = y2; + } + return this; + }, + add(x2, y2) { + if (x2 < this.x1) this.x1 = x2; + if (y2 < this.y1) this.y1 = y2; + if (x2 > this.x2) this.x2 = x2; + if (y2 > this.y2) this.y2 = y2; + return this; + }, + expand(d) { + this.x1 -= d; + this.y1 -= d; + this.x2 += d; + this.y2 += d; + return this; + }, + round() { + this.x1 = Math.floor(this.x1); + this.y1 = Math.floor(this.y1); + this.x2 = Math.ceil(this.x2); + this.y2 = Math.ceil(this.y2); + return this; + }, + scale(s) { + this.x1 *= s; + this.y1 *= s; + this.x2 *= s; + this.y2 *= s; + return this; + }, + translate(dx, dy) { + this.x1 += dx; + this.x2 += dx; + this.y1 += dy; + this.y2 += dy; + return this; + }, + rotate(angle2, x2, y2) { + const p = this.rotatedPoints(angle2, x2, y2); + return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); + }, + rotatedPoints(angle2, x2, y2) { + var { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = this, cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), cx = x2 - x2 * cos2 + y2 * sin2, cy = y2 - x2 * sin2 - y2 * cos2; + return [cos2 * x12 - sin2 * y12 + cx, sin2 * x12 + cos2 * y12 + cy, cos2 * x12 - sin2 * y22 + cx, sin2 * x12 + cos2 * y22 + cy, cos2 * x22 - sin2 * y12 + cx, sin2 * x22 + cos2 * y12 + cy, cos2 * x22 - sin2 * y22 + cx, sin2 * x22 + cos2 * y22 + cy]; + }, + union(b2) { + if (b2.x1 < this.x1) this.x1 = b2.x1; + if (b2.y1 < this.y1) this.y1 = b2.y1; + if (b2.x2 > this.x2) this.x2 = b2.x2; + if (b2.y2 > this.y2) this.y2 = b2.y2; + return this; + }, + intersect(b2) { + if (b2.x1 > this.x1) this.x1 = b2.x1; + if (b2.y1 > this.y1) this.y1 = b2.y1; + if (b2.x2 < this.x2) this.x2 = b2.x2; + if (b2.y2 < this.y2) this.y2 = b2.y2; + return this; + }, + encloses(b2) { + return b2 && this.x1 <= b2.x1 && this.x2 >= b2.x2 && this.y1 <= b2.y1 && this.y2 >= b2.y2; + }, + alignsWith(b2) { + return b2 && (this.x1 == b2.x1 || this.x2 == b2.x2 || this.y1 == b2.y1 || this.y2 == b2.y2); + }, + intersects(b2) { + return b2 && !(this.x2 < b2.x1 || this.x1 > b2.x2 || this.y2 < b2.y1 || this.y1 > b2.y2); + }, + contains(x2, y2) { + return !(x2 < this.x1 || x2 > this.x2 || y2 < this.y1 || y2 > this.y2); + }, + width() { + return this.x2 - this.x1; + }, + height() { + return this.y2 - this.y1; } - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; -} - -},{"../clip/antimeridian.js":"kvVxQ","../clip/circle.js":"2PJ3I","../clip/rectangle.js":"9kmAt","../compose.js":"hmaf3","../identity.js":"kub29","../math.js":"74X19","../rotation.js":"8C7qH","../transform.js":"9MXXE","./fit.js":"49j0j","./resample.js":"gWNAn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9MXXE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(methods) { + }; + function Item(mark) { + this.mark = mark; + this.bounds = this.bounds || new Bounds(); + } + function GroupItem(mark) { + Item.call(this, mark); + this.items = this.items || []; + } + inherits(GroupItem, Item); + class ResourceLoader { + constructor(customLoader) { + this._pending = 0; + this._loader = customLoader || loader(); + } + pending() { + return this._pending; + } + sanitizeURL(uri) { + const loader2 = this; + increment$1(loader2); + return loader2._loader.sanitize(uri, { + context: "href" + }).then((opt) => { + decrement(loader2); + return opt; + }).catch(() => { + decrement(loader2); + return null; + }); + } + loadImage(uri) { + const loader2 = this, Image2 = domImage(); + increment$1(loader2); + return loader2._loader.sanitize(uri, { + context: "image" + }).then((opt) => { + const url = opt.href; + if (!url || !Image2) throw { + url + }; + const img = new Image2(); + const cors = has$1(opt, "crossOrigin") ? opt.crossOrigin : "anonymous"; + if (cors != null) img.crossOrigin = cors; + img.onload = () => decrement(loader2); + img.onerror = () => decrement(loader2); + img.src = url; + return img; + }).catch((e) => { + decrement(loader2); return { - stream: transformer(methods) + complete: false, + width: 0, + height: 0, + src: e && e.url || "" }; - }); -parcelHelpers.export(exports, "transformer", ()=>transformer); -function transformer(methods) { - return function(stream) { - var s = new TransformStream; - for(var key in methods)s[key] = methods[key]; - s.stream = stream; - return s; - }; -} -function TransformStream() {} -TransformStream.prototype = { - constructor: TransformStream, - point: function(x, y) { - this.stream.point(x, y); - }, - sphere: function() { - this.stream.sphere(); - }, - lineStart: function() { - this.stream.lineStart(); - }, - lineEnd: function() { - this.stream.lineEnd(); - }, - polygonStart: function() { - this.stream.polygonStart(); - }, - polygonEnd: function() { - this.stream.polygonEnd(); - } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49j0j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fitExtent", ()=>fitExtent); -parcelHelpers.export(exports, "fitSize", ()=>fitSize); -parcelHelpers.export(exports, "fitWidth", ()=>fitWidth); -parcelHelpers.export(exports, "fitHeight", ()=>fitHeight); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _boundsJs = require("../path/bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -function fit(projection, fitBounds, object) { - var clip = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([ - 0, - 0 - ]); - if (clip != null) projection.clipExtent(null); - (0, _streamJsDefault.default)(object, projection.stream((0, _boundsJsDefault.default))); - fitBounds((0, _boundsJsDefault.default).result()); - if (clip != null) projection.clipExtent(clip); - return projection; -} -function fitExtent(projection, extent, object) { - return fit(projection, function(b) { - var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitSize(projection, size, object) { - return fitExtent(projection, [ - [ - 0, - 0 - ], - size - ], object); -} -function fitWidth(projection, width, object) { - return fit(projection, function(b) { - var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1]; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitHeight(projection, height, object) { - return fit(projection, function(b) { - var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} - -},{"../stream.js":"9nFXd","../path/bounds.js":"bhNL9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gWNAn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(project, delta2) { - return +delta2 ? resample(project, delta2) : resampleNone(project); - }); -var _cartesianJs = require("../cartesian.js"); -var _mathJs = require("../math.js"); -var _transformJs = require("../transform.js"); -var maxDepth = 16, cosMinDistance = (0, _mathJs.cos)(30 * (0, _mathJs.radians)); // cos(minimum angular distance) -function resampleNone(project) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); -} -function resample(project, delta2) { - function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = (0, _mathJs.sqrt)(a * a + b * b + c * c), phi2 = (0, _mathJs.asin)(c /= m), lambda2 = (0, _mathJs.abs)((0, _mathJs.abs)(c) - 1) < (0, _mathJs.epsilon) || (0, _mathJs.abs)(lambda0 - lambda1) < (0, _mathJs.epsilon) ? (lambda0 + lambda1) / 2 : (0, _mathJs.atan2)(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > delta2 // perpendicular projected distance - || (0, _mathJs.abs)((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } + }); + } + ready() { + const loader2 = this; + return new Promise((accept) => { + function poll(value2) { + if (!loader2.pending()) accept(value2); + else setTimeout(() => { + poll(true); + }, 10); + } + poll(false); + }); + } + } + function increment$1(loader2) { + loader2._pending += 1; + } + function decrement(loader2) { + loader2._pending -= 1; + } + function boundStroke(bounds2, item, miter) { + if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { + const sw = item.strokeWidth != null ? +item.strokeWidth : 1; + bounds2.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); + } + return bounds2; + } + function miterAdjustment(item, strokeWidth) { + return item.strokeJoin && item.strokeJoin !== "miter" ? 0 : strokeWidth; + } + const circleThreshold = Tau - 1e-8; + let bounds, lx, ly, rot, ma, mb, mc, md; + const add$2 = (x2, y2) => bounds.add(x2, y2); + const addL = (x2, y2) => add$2(lx = x2, ly = y2); + const addX = (x2) => add$2(x2, bounds.y1); + const addY = (y2) => add$2(bounds.x1, y2); + const px = (x2, y2) => ma * x2 + mc * y2; + const py = (x2, y2) => mb * x2 + md * y2; + const addp = (x2, y2) => add$2(px(x2, y2), py(x2, y2)); + const addpL = (x2, y2) => addL(px(x2, y2), py(x2, y2)); + function boundContext(_, deg) { + bounds = _; + if (deg) { + rot = deg * DegToRad; + ma = md = Math.cos(rot); + mb = Math.sin(rot); + mc = -mb; + } else { + ma = md = 1; + rot = mb = mc = 0; + } + return context$1; + } + const context$1 = { + beginPath() { + }, + closePath() { + }, + moveTo: addpL, + lineTo: addpL, + rect(x2, y2, w2, h2) { + if (rot) { + addp(x2 + w2, y2); + addp(x2 + w2, y2 + h2); + addp(x2, y2 + h2); + addpL(x2, y2); + } else { + add$2(x2 + w2, y2 + h2); + addL(x2, y2); + } + }, + quadraticCurveTo(x12, y12, x2, y2) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2); + quadExtrema(lx, px1, px2, addX); + quadExtrema(ly, py1, py2, addY); + addL(px2, py2); + }, + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); + cubicExtrema(lx, px1, px2, px3, addX); + cubicExtrema(ly, py1, py2, py3, addY); + addL(px3, py3); + }, + arc(cx, cy, r, sa2, ea2, ccw) { + sa2 += rot; + ea2 += rot; + lx = r * Math.cos(ea2) + cx; + ly = r * Math.sin(ea2) + cy; + if (Math.abs(ea2 - sa2) > circleThreshold) { + add$2(cx - r, cy - r); + add$2(cx + r, cy + r); + } else { + const update2 = (a2) => add$2(r * Math.cos(a2) + cx, r * Math.sin(a2) + cy); + let s, i; + update2(sa2); + update2(ea2); + if (ea2 !== sa2) { + sa2 = sa2 % Tau; + if (sa2 < 0) sa2 += Tau; + ea2 = ea2 % Tau; + if (ea2 < 0) ea2 += Tau; + if (ea2 < sa2) { + ccw = !ccw; + s = sa2; + sa2 = ea2; + ea2 = s; + } + if (ccw) { + ea2 -= Tau; + s = sa2 - sa2 % HalfPi; + for (i = 0; i < 4 && s > ea2; ++i, s -= HalfPi) update2(s); + } else { + s = sa2 - sa2 % HalfPi + HalfPi; + for (i = 0; i < 4 && s < ea2; ++i, s = s + HalfPi) update2(s); + } } + } } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, lambda0, x0, y0, a0, b0, c0; // previous point - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - stream.polygonStart(); - resampleStream.lineStart = ringStart; - }, - polygonEnd: function() { - stream.polygonEnd(); - resampleStream.lineStart = lineStart; - } - }; - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - function linePoint(lambda, phi) { - var c = (0, _cartesianJs.cartesian)([ - lambda, - phi - ]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - return resampleStream; - }; -} - -},{"../cartesian.js":"i2DwM","../math.js":"74X19","../transform.js":"9MXXE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j13Gc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cylindricalEqualAreaRaw", ()=>cylindricalEqualAreaRaw); -var _mathJs = require("../math.js"); -function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = (0, _mathJs.cos)(phi0); - function forward(lambda, phi) { - return [ - lambda * cosPhi0, - (0, _mathJs.sin)(phi) / cosPhi0 - ]; - } - forward.invert = function(x, y) { - return [ - x / cosPhi0, - (0, _mathJs.asin)(y * cosPhi0) - ]; + }; + function quadExtrema(x02, x12, x2, cb) { + const t = (x02 - x12) / (x02 + x2 - 2 * x12); + if (0 < t && t < 1) cb(x02 + (x12 - x02) * t); + } + function cubicExtrema(x02, x12, x2, x3, cb) { + const a2 = x3 - x02 + 3 * x12 - 3 * x2, b2 = x02 + x2 - 2 * x12, c2 = x02 - x12; + let t02 = 0, t12 = 0, r; + if (Math.abs(a2) > Epsilon) { + r = b2 * b2 + c2 * a2; + if (r >= 0) { + r = Math.sqrt(r); + t02 = (-b2 + r) / a2; + t12 = (-b2 - r) / a2; + } + } else { + t02 = 0.5 * c2 / b2; + } + if (0 < t02 && t02 < 1) cb(cubic(t02, x02, x12, x2, x3)); + if (0 < t12 && t12 < 1) cb(cubic(t12, x02, x12, x2, x3)); + } + function cubic(t, x02, x12, x2, x3) { + const s = 1 - t, s2 = s * s, t22 = t * t; + return s2 * s * x02 + 3 * s2 * t * x12 + 3 * s * t22 * x2 + t22 * t * x3; + } + var context$2 = (context$2 = domCanvas(1, 1)) ? context$2.getContext("2d") : null; + const b = new Bounds(); + function intersectPath(draw2) { + return function(item, brush) { + if (!context$2) return true; + draw2(context$2, item); + b.clear().union(item.bounds).intersect(brush).round(); + const { + x1: x12, + y1: y12, + x2, + y2 + } = b; + for (let y3 = y12; y3 <= y2; ++y3) { + for (let x3 = x12; x3 <= x2; ++x3) { + if (context$2.isPointInPath(x3, y3)) { + return true; + } + } + } + return false; }; - return forward; -} - -},{"../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4lZJF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A composite projection for the United States, configured by default for -// 960×500. The projection also works quite well at 960×600 if you change the -// scale to 1285 and adjust the translate accordingly. The set of standard -// parallels for each region comes from USGS, which is published here: -// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers -parcelHelpers.export(exports, "default", ()=>function() { - var cache, cacheStream, lower48 = (0, _albersJsDefault.default)(), lower48Point, alaska = (0, _conicEqualAreaJsDefault.default)().rotate([ - 154, - 0 - ]).center([ - -2, - 58.5 - ]).parallels([ - 55, - 65 - ]), alaskaPoint, hawaii = (0, _conicEqualAreaJsDefault.default)().rotate([ - 157, - 0 - ]).center([ - -3, - 19.9 - ]).parallels([ - 8, - 18 - ]), hawaiiPoint, point, pointStream = { - point: function(x, y) { - point = [ - x, - y - ]; - } - }; - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point); + } + function intersectPoint(item, box2) { + return box2.contains(item.x || 0, item.y || 0); + } + function intersectRect(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, w2 = item.width || 0, h2 = item.height || 0; + return box2.intersects(b.set(x2, y2, x2 + w2, y2 + h2)); + } + function intersectRule(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, x22 = item.x2 != null ? item.x2 : x2, y22 = item.y2 != null ? item.y2 : y2; + return intersectBoxLine(box2, x2, y2, x22, y22); + } + function intersectBoxLine(box2, x2, y2, u2, v) { + const { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = box2, dx = u2 - x2, dy = v - y2; + let t02 = 0, t12 = 1, p, q, r, e; + for (e = 0; e < 4; ++e) { + if (e === 0) { + p = -dx; + q = -(x12 - x2); + } + if (e === 1) { + p = dx; + q = x22 - x2; + } + if (e === 2) { + p = -dy; + q = -(y12 - y2); + } + if (e === 3) { + p = dy; + q = y22 - y2; + } + if (Math.abs(p) < 1e-10 && q < 0) return false; + r = q / p; + if (p < 0) { + if (r > t12) return false; + else if (r > t02) t02 = r; + } else if (p > 0) { + if (r < t02) return false; + else if (r < t12) t12 = r; + } + } + return true; + } + function blend(context2, item) { + context2.globalCompositeOperation = item.blend || "source-over"; + } + function value$2(value2, dflt) { + return value2 == null ? dflt : value2; + } + function addStops(gradient2, stops) { + const n = stops.length; + for (let i = 0; i < n; ++i) { + gradient2.addColorStop(stops[i].offset, stops[i].color); + } + return gradient2; + } + function gradient$1(context2, spec, bounds2) { + const w2 = bounds2.width(), h2 = bounds2.height(); + let gradient2; + if (spec.gradient === "radial") { + gradient2 = context2.createRadialGradient(bounds2.x1 + value$2(spec.x1, 0.5) * w2, bounds2.y1 + value$2(spec.y1, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r1, 0), bounds2.x1 + value$2(spec.x2, 0.5) * w2, bounds2.y1 + value$2(spec.y2, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r2, 0.5)); + } else { + const x12 = value$2(spec.x1, 0), y12 = value$2(spec.y1, 0), x2 = value$2(spec.x2, 1), y2 = value$2(spec.y2, 0); + if (x12 === x2 || y12 === y2 || w2 === h2) { + gradient2 = context2.createLinearGradient(bounds2.x1 + x12 * w2, bounds2.y1 + y12 * h2, bounds2.x1 + x2 * w2, bounds2.y1 + y2 * h2); + } else { + const image2 = domCanvas(Math.ceil(w2), Math.ceil(h2)), ictx = image2.getContext("2d"); + ictx.scale(w2, h2); + ictx.fillStyle = addStops(ictx.createLinearGradient(x12, y12, x2, y2), spec.stops); + ictx.fillRect(0, 0, w2, h2); + return context2.createPattern(image2, "no-repeat"); + } + } + return addStops(gradient2, spec.stops); + } + function color$1(context2, item, value2) { + return isGradient(value2) ? gradient$1(context2, value2, item.bounds) : value2; + } + function fill$1(context2, item, opacity2) { + opacity2 *= item.fillOpacity == null ? 1 : item.fillOpacity; + if (opacity2 > 0) { + context2.globalAlpha = opacity2; + context2.fillStyle = color$1(context2, item, item.fill); + return true; + } else { + return false; + } + } + var Empty = []; + function stroke(context2, item, opacity2) { + var lw = (lw = item.strokeWidth) != null ? lw : 1; + if (lw <= 0) return false; + opacity2 *= item.strokeOpacity == null ? 1 : item.strokeOpacity; + if (opacity2 > 0) { + context2.globalAlpha = opacity2; + context2.strokeStyle = color$1(context2, item, item.stroke); + context2.lineWidth = lw; + context2.lineCap = item.strokeCap || "butt"; + context2.lineJoin = item.strokeJoin || "miter"; + context2.miterLimit = item.strokeMiterLimit || 10; + if (context2.setLineDash) { + context2.setLineDash(item.strokeDash || Empty); + context2.lineDashOffset = item.strokeDashOffset || 0; + } + return true; + } else { + return false; + } + } + function compare$1(a2, b2) { + return a2.zindex - b2.zindex || a2.index - b2.index; + } + function zorder(scene) { + if (!scene.zdirty) return scene.zitems; + var items = scene.items, output2 = [], item, i, n; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + item.index = i; + if (item.zindex) output2.push(item); + } + scene.zdirty = false; + return scene.zitems = output2.sort(compare$1); + } + function visit(scene, visitor) { + var items = scene.items, i, n; + if (!items || !items.length) return; + const zitems = zorder(scene); + if (zitems && zitems.length) { + for (i = 0, n = items.length; i < n; ++i) { + if (!items[i].zindex) visitor(items[i]); + } + items = zitems; + } + for (i = 0, n = items.length; i < n; ++i) { + visitor(items[i]); + } + } + function pickVisit(scene, visitor) { + var items = scene.items, hit2, i; + if (!items || !items.length) return null; + const zitems = zorder(scene); + if (zitems && zitems.length) items = zitems; + for (i = items.length; --i >= 0; ) { + if (hit2 = visitor(items[i])) return hit2; + } + if (items === zitems) { + for (items = scene.items, i = items.length; --i >= 0; ) { + if (!items[i].zindex) { + if (hit2 = visitor(items[i])) return hit2; } - albersUsa.invert = function(coordinates) { - var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; - return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates); - }; - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([ - lower48.stream(cacheStream = stream), - alaska.stream(stream), - hawaii.stream(stream) - ]); - }; - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - albersUsa.scale = function(_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); - return albersUsa.translate(lower48.translate()); - }; - albersUsa.translate = function(_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([ - [ - x - 0.455 * k, - y - 0.238 * k - ], - [ - x + 0.455 * k, - y + 0.238 * k - ] - ]).stream(pointStream); - alaskaPoint = alaska.translate([ - x - 0.307 * k, - y + 0.201 * k - ]).clipExtent([ - [ - x - 0.425 * k + (0, _mathJs.epsilon), - y + 0.120 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.214 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - hawaiiPoint = hawaii.translate([ - x - 0.205 * k, - y + 0.212 * k - ]).clipExtent([ - [ - x - 0.214 * k + (0, _mathJs.epsilon), - y + 0.166 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.115 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - return reset(); - }; - albersUsa.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(albersUsa, extent, object); - }; - albersUsa.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(albersUsa, size, object); - }; - albersUsa.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(albersUsa, width, object); - }; - albersUsa.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(albersUsa, height, object); - }; - function reset() { - cache = cacheStream = null; - return albersUsa; + } + } + return null; + } + function drawAll(path2) { + return function(context2, scene, bounds2) { + visit(scene, (item) => { + if (!bounds2 || bounds2.intersects(item.bounds)) { + drawPath(path2, context2, item, item); } - return albersUsa.scale(1070); - }); -var _mathJs = require("../math.js"); -var _albersJs = require("./albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _fitJs = require("./fit.js"); -// The projections must have mutually exclusive clip regions on the sphere, -// as this will avoid emitting interleaving lines and polygons. -function multiplex(streams) { - var n = streams.length; + }); + }; + } + function drawOne(path2) { + return function(context2, scene, bounds2) { + if (scene.items.length && (!bounds2 || bounds2.intersects(scene.bounds))) { + drawPath(path2, context2, scene.items[0], scene.items); + } + }; + } + function drawPath(path2, context2, item, items) { + var opacity2 = item.opacity == null ? 1 : item.opacity; + if (opacity2 === 0) return; + if (path2(context2, items)) return; + blend(context2, item); + if (item.fill && fill$1(context2, item, opacity2)) { + context2.fill(); + } + if (item.stroke && stroke(context2, item, opacity2)) { + context2.stroke(); + } + } + function pick$1(test2) { + test2 = test2 || truthy; + return function(context2, scene, x2, y2, gx, gy) { + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return pickVisit(scene, (item) => { + const b2 = item.bounds; + if (b2 && !b2.contains(gx, gy) || !b2) return; + if (test2(context2, item, x2, y2, gx, gy)) return item; + }); + }; + } + function hitPath(path2, filled) { + return function(context2, o, x2, y2) { + var item = Array.isArray(o) ? o[0] : o, fill2 = filled == null ? item.fill : filled, stroke2 = item.stroke && context2.isPointInStroke, lw, lc; + if (stroke2) { + lw = item.strokeWidth; + lc = item.strokeCap; + context2.lineWidth = lw != null ? lw : 1; + context2.lineCap = lc != null ? lc : "butt"; + } + return path2(context2, o) ? false : fill2 && context2.isPointInPath(x2, y2) || stroke2 && context2.isPointInStroke(x2, y2); + }; + } + function pickPath(path2) { + return pick$1(hitPath(path2)); + } + function translate$2(x2, y2) { + return "translate(" + x2 + "," + y2 + ")"; + } + function rotate(a2) { + return "rotate(" + a2 + ")"; + } + function scale$5(scaleX, scaleY2) { + return "scale(" + scaleX + "," + scaleY2 + ")"; + } + function translateItem(item) { + return translate$2(item.x || 0, item.y || 0); + } + function rotateItem(item) { + return translate$2(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : ""); + } + function transformItem(item) { + return translate$2(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : "") + (item.scaleX || item.scaleY ? " " + scale$5(item.scaleX || 1, item.scaleY || 1) : ""); + } + function markItemPath(type2, shape2, isect) { + function attr2(emit2, item) { + emit2("transform", rotateItem(item)); + emit2("d", shape2(null, item)); + } + function bound2(bounds2, item) { + shape2(boundContext(bounds2, item.angle), item); + return boundStroke(bounds2, item).translate(item.x || 0, item.y || 0); + } + function draw2(context2, item) { + var x2 = item.x || 0, y2 = item.y || 0, a2 = item.angle || 0; + context2.translate(x2, y2); + if (a2) context2.rotate(a2 *= DegToRad); + context2.beginPath(); + shape2(context2, item); + if (a2) context2.rotate(-a2); + context2.translate(-x2, -y2); + } return { - point: function(x, y) { - var i = -1; - while(++i < n)streams[i].point(x, y); - }, - sphere: function() { - var i = -1; - while(++i < n)streams[i].sphere(); - }, - lineStart: function() { - var i = -1; - while(++i < n)streams[i].lineStart(); - }, - lineEnd: function() { - var i = -1; - while(++i < n)streams[i].lineEnd(); - }, - polygonStart: function() { - var i = -1; - while(++i < n)streams[i].polygonStart(); - }, - polygonEnd: function() { - var i = -1; - while(++i < n)streams[i].polygonEnd(); - } - }; -} - -},{"../math.js":"74X19","./albers.js":"dSks5","./conicEqualArea.js":"17j9x","./fit.js":"49j0j","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jbLs0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEqualAreaRaw", ()=>azimuthalEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEqualAreaRaw).scale(124.75).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEqualAreaRaw = (0, _azimuthalJs.azimuthalRaw)(function(cxcy) { - return (0, _mathJs.sqrt)(2 / (1 + cxcy)); -}); -azimuthalEqualAreaRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.asin)(z / 2); -}); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"boRUu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalRaw", ()=>azimuthalRaw); -parcelHelpers.export(exports, "azimuthalInvert", ()=>azimuthalInvert); -var _mathJs = require("../math.js"); -function azimuthalRaw(scale) { - return function(x, y) { - var cx = (0, _mathJs.cos)(x), cy = (0, _mathJs.cos)(y), k = scale(cx * cy); - if (k === Infinity) return [ - 2, - 0 - ]; - return [ - k * cy * (0, _mathJs.sin)(x), - k * (0, _mathJs.sin)(y) - ]; - }; -} -function azimuthalInvert(angle) { - return function(x, y) { - var z = (0, _mathJs.sqrt)(x * x + y * y), c = angle(z), sc = (0, _mathJs.sin)(c), cc = (0, _mathJs.cos)(c); - return [ - (0, _mathJs.atan2)(x * sc, z * cc), - (0, _mathJs.asin)(z && y * sc / z) - ]; - }; -} - -},{"../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eAR2Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEquidistantRaw", ()=>azimuthalEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEquidistantRaw).scale(79.4188).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEquidistantRaw = (0, _azimuthalJs.azimuthalRaw)(function(c) { - return (c = (0, _mathJs.acos)(c)) && c / (0, _mathJs.sin)(c); -}); -azimuthalEquidistantRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return z; -}); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dhBsj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicConformalRaw", ()=>conicConformalRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicConformalRaw).scale(109.5).parallels([ - 30, - 30 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _mercatorJs = require("./mercator.js"); -function tany(y) { - return (0, _mathJs.tan)(((0, _mathJs.halfPi) + y) / 2); -} -function conicConformalRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (0, _mathJs.log)(cy0 / (0, _mathJs.cos)(y1)) / (0, _mathJs.log)(tany(y1) / tany(y0)), f = cy0 * (0, _mathJs.pow)(tany(y0), n) / n; - if (!n) return 0, _mercatorJs.mercatorRaw; - function project(x, y) { - if (f > 0) { - if (y < -(0, _mathJs.halfPi) + (0, _mathJs.epsilon)) y = -(0, _mathJs.halfPi) + (0, _mathJs.epsilon); - } else if (y > (0, _mathJs.halfPi) - (0, _mathJs.epsilon)) y = (0, _mathJs.halfPi) - (0, _mathJs.epsilon); - var r = f / (0, _mathJs.pow)(tany(y), n); - return [ - r * (0, _mathJs.sin)(n * x), - f - r * (0, _mathJs.cos)(n * x) - ]; - } - project.invert = function(x, y) { - var fy = f - y, r = (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + fy * fy), l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(fy)) * (0, _mathJs.sign)(fy); - if (fy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(fy); - return [ - l / n, - 2 * (0, _mathJs.atan)((0, _mathJs.pow)(f / r, 1 / n)) - (0, _mathJs.halfPi) - ]; - }; - return project; -} - -},{"../math.js":"74X19","./conic.js":"15g8N","./mercator.js":"iIGjZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iIGjZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mercatorRaw", ()=>mercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return mercatorProjection(mercatorRaw).scale(961 / (0, _mathJs.tau)); - }); -parcelHelpers.export(exports, "mercatorProjection", ()=>mercatorProjection); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function mercatorRaw(lambda, phi) { - return [ - lambda, - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)) - ]; -} -mercatorRaw.invert = function(x, y) { - return [ - x, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(y)) - (0, _mathJs.halfPi) - ]; -}; -function mercatorProjection(project) { - var m = (0, _indexJsDefault.default)(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x0 = null, y0, x1, y1; // clip extent - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - m.clipExtent = function(_) { - return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; + type: type2, + tag: "path", + nested: false, + attr: attr2, + bound: bound2, + draw: drawAll(draw2), + pick: pickPath(draw2), + isect: isect || intersectPath(draw2) }; - function reclip() { - var k = (0, _mathJs.pi) * scale(), t = m((0, _rotationJsDefault.default)(m.rotate()).invert([ - 0, - 0 - ])); - return clipExtent(x0 == null ? [ - [ - t[0] - k, - t[1] - k - ], - [ - t[0] + k, - t[1] + k - ] - ] : project === mercatorRaw ? [ - [ - Math.max(t[0] - k, x0), - y0 - ], - [ - Math.min(t[0] + k, x1), - y1 - ] - ] : [ - [ - x0, - Math.max(t[1] - k, y0) - ], - [ - x1, - Math.min(t[1] + k, y1) - ] - ]); + } + var arc$2 = markItemPath("arc", arc$1); + function pickArea(a2, p) { + var v = a2[0].orient === "horizontal" ? p[1] : p[0], z = a2[0].orient === "horizontal" ? "y" : "x", i = a2.length, min2 = Infinity, hit2, d; + while (--i >= 0) { + if (a2[i].defined === false) continue; + d = Math.abs(a2[i][z] - v); + if (d < min2) { + min2 = d; + hit2 = a2[i]; + } } - return reclip(); -} - -},{"../math.js":"74X19","../rotation.js":"8C7qH","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6B358":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEquidistantRaw", ()=>conicEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEquidistantRaw).scale(131.154).center([ - 0, - 13.9389 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _equirectangularJs = require("./equirectangular.js"); -function conicEquidistantRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (cy0 - (0, _mathJs.cos)(y1)) / (y1 - y0), g = cy0 / n + y0; - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return 0, _equirectangularJs.equirectangularRaw; - function project(x, y) { - var gy = g - y, nx = n * x; - return [ - gy * (0, _mathJs.sin)(nx), - g - gy * (0, _mathJs.cos)(nx) - ]; - } - project.invert = function(x, y) { - var gy = g - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(gy)) * (0, _mathJs.sign)(gy); - if (gy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(gy); - return [ - l / n, - g - (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + gy * gy) - ]; - }; - return project; -} - -},{"../math.js":"74X19","./conic.js":"15g8N","./equirectangular.js":"4kEjS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4kEjS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equirectangularRaw", ()=>equirectangularRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equirectangularRaw).scale(152.63); + return hit2; + } + function pickLine(a2, p) { + var t = Math.pow(a2[0].strokeWidth || 1, 2), i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + if (dd < t) return a2[i]; + } + return null; + } + function pickTrail(a2, p) { + var i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + dx = a2[i].size || 1; + if (dd < dx * dx) return a2[i]; + } + return null; + } + function markMultiItemPath(type2, shape2, tip) { + function attr2(emit2, item) { + var items = item.mark.items; + if (items.length) emit2("d", shape2(null, items)); + } + function bound2(bounds2, mark) { + var items = mark.items; + if (items.length === 0) { + return bounds2; + } else { + shape2(boundContext(bounds2), items); + return boundStroke(bounds2, items[0]); + } + } + function draw2(context2, items) { + context2.beginPath(); + shape2(context2, items); + } + const hit2 = hitPath(draw2); + function pick2(context2, scene, x2, y2, gx, gy) { + var items = scene.items, b2 = scene.bounds; + if (!items || !items.length || b2 && !b2.contains(gx, gy)) { + return null; + } + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return hit2(context2, items, x2, y2) ? items[0] : null; + } + return { + type: type2, + tag: "path", + nested: true, + attr: attr2, + bound: bound2, + draw: drawOne(draw2), + pick: pick2, + isect: intersectPoint, + tip + }; + } + var area$2 = markMultiItemPath("area", area$1, pickArea); + function clip$2(context2, scene) { + var clip2 = scene.clip; + context2.save(); + if (isFunction(clip2)) { + context2.beginPath(); + clip2(context2); + context2.clip(); + } else { + clipGroup(context2, scene.group); + } + } + function clipGroup(context2, group2) { + context2.beginPath(); + hasCornerRadius(group2) ? rectangle(context2, group2, 0, 0) : context2.rect(0, 0, group2.width || 0, group2.height || 0); + context2.clip(); + } + function offset$1(item) { + const sw = value$2(item.strokeWidth, 1); + return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; + } + function attr$5(emit2, item) { + emit2("transform", translateItem(item)); + } + function emitRectangle(emit2, item) { + const off = offset$1(item); + emit2("d", rectangle(null, item, off, off)); + } + function background$1(emit2, item) { + emit2("class", "background"); + emit2("aria-hidden", true); + emitRectangle(emit2, item); + } + function foreground(emit2, item) { + emit2("class", "foreground"); + emit2("aria-hidden", true); + if (item.strokeForeground) { + emitRectangle(emit2, item); + } else { + emit2("d", ""); + } + } + function content(emit2, item, renderer) { + const url = item.clip ? clip$1$1(renderer, item, item) : null; + emit2("clip-path", url); + } + function bound$5(bounds2, group2) { + if (!group2.clip && group2.items) { + const items = group2.items, m2 = items.length; + for (let j = 0; j < m2; ++j) { + bounds2.union(items[j].bounds); + } + } + if ((group2.clip || group2.width || group2.height) && !group2.noBound) { + bounds2.add(0, 0).add(group2.width || 0, group2.height || 0); + } + boundStroke(bounds2, group2); + return bounds2.translate(group2.x || 0, group2.y || 0); + } + function rectanglePath(context2, group2, x2, y2) { + const off = offset$1(group2); + context2.beginPath(); + rectangle(context2, group2, (x2 || 0) + off, (y2 || 0) + off); + } + const hitBackground = hitPath(rectanglePath); + const hitForeground = hitPath(rectanglePath, false); + const hitCorner = hitPath(rectanglePath, true); + function draw$4(context2, scene, bounds2, markTypes) { + visit(scene, (group2) => { + const gx = group2.x || 0, gy = group2.y || 0, fore = group2.strokeForeground, opacity2 = group2.opacity == null ? 1 : group2.opacity; + if ((group2.stroke || group2.fill) && opacity2) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (group2.fill && fill$1(context2, group2, opacity2)) { + context2.fill(); + } + if (group2.stroke && !fore && stroke(context2, group2, opacity2)) { + context2.stroke(); + } + } + context2.save(); + context2.translate(gx, gy); + if (group2.clip) clipGroup(context2, group2); + if (bounds2) bounds2.translate(-gx, -gy); + visit(group2, (item) => { + if (item.marktype === "group" || markTypes == null || markTypes.includes(item.marktype)) { + this.draw(context2, item, bounds2, markTypes); + } + }); + if (bounds2) bounds2.translate(gx, gy); + context2.restore(); + if (fore && group2.stroke && opacity2) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (stroke(context2, group2, opacity2)) { + context2.stroke(); + } + } }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function equirectangularRaw(lambda, phi) { - return [ - lambda, - phi - ]; -} -equirectangularRaw.invert = equirectangularRaw; - -},{"./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bMVhy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equalEarthRaw", ()=>equalEarthRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equalEarthRaw).scale(177.158); + } + function pick(context2, scene, x2, y2, gx, gy) { + if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { + return null; + } + const cx = x2 * context2.pixelRatio, cy = y2 * context2.pixelRatio; + return pickVisit(scene, (group2) => { + let hit2, dx, dy; + const b2 = group2.bounds; + if (b2 && !b2.contains(gx, gy)) return; + dx = group2.x || 0; + dy = group2.y || 0; + const dw = dx + (group2.width || 0), dh = dy + (group2.height || 0), c2 = group2.clip; + if (c2 && (gx < dx || gx > dw || gy < dy || gy > dh)) return; + context2.save(); + context2.translate(dx, dy); + dx = gx - dx; + dy = gy - dy; + if (c2 && hasCornerRadius(group2) && !hitCorner(context2, group2, cx, cy)) { + context2.restore(); + return null; + } + const fore = group2.strokeForeground, ix = scene.interactive !== false; + if (ix && fore && group2.stroke && hitForeground(context2, group2, cx, cy)) { + context2.restore(); + return group2; + } + hit2 = pickVisit(group2, (mark) => pickMark(mark, dx, dy) ? this.pick(mark, x2, y2, dx, dy) : null); + if (!hit2 && ix && (group2.fill || !fore && group2.stroke) && hitBackground(context2, group2, cx, cy)) { + hit2 = group2; + } + context2.restore(); + return hit2 || null; }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -var A1 = 1.340264, A2 = -0.081106, A3 = 0.000893, A4 = 0.003796, M = (0, _mathJs.sqrt)(3) / 2, iterations = 12; -function equalEarthRaw(lambda, phi) { - var l = (0, _mathJs.asin)(M * (0, _mathJs.sin)(phi)), l2 = l * l, l6 = l2 * l2 * l2; - return [ - lambda * (0, _mathJs.cos)(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), - l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - ]; -} -equalEarthRaw.invert = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for(var i = 0, delta, fy, fpy; i < iterations; ++i){ - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if ((0, _mathJs.abs)(delta) < (0, _mathJs.epsilon2)) break; + } + function pickMark(mark, x2, y2) { + return (mark.interactive !== false || mark.marktype === "group") && mark.bounds && mark.bounds.contains(x2, y2); + } + var group$1 = { + type: "group", + tag: "g", + nested: false, + attr: attr$5, + bound: bound$5, + draw: draw$4, + pick, + isect: intersectRect, + content, + background: background$1, + foreground + }; + var metadata = { + "xmlns": "http://www.w3.org/2000/svg", + "xmlns:xlink": "http://www.w3.org/1999/xlink", + "version": "1.1" + }; + function getImage(item, renderer) { + var image2 = item.image; + if (!image2 || item.url && item.url !== image2.url) { + image2 = { + complete: false, + width: 0, + height: 0 + }; + renderer.loadImage(item.url).then((image3) => { + item.image = image3; + item.image.url = item.url; + }); } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / (0, _mathJs.cos)(l), - (0, _mathJs.asin)((0, _mathJs.sin)(l) / M) - ]; -}; - -},{"./index.js":"cd9OX","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6bdgO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gnomonicRaw", ()=>gnomonicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(gnomonicRaw).scale(144.049).clipAngle(60); + return image2; + } + function imageWidth(item, image2) { + return item.width != null ? item.width : !image2 || !image2.width ? 0 : item.aspect !== false && item.height ? item.height * image2.width / image2.height : image2.width; + } + function imageHeight(item, image2) { + return item.height != null ? item.height : !image2 || !image2.height ? 0 : item.aspect !== false && item.width ? item.width * image2.height / image2.width : image2.height; + } + function imageXOffset(align, w2) { + return align === "center" ? w2 / 2 : align === "right" ? w2 : 0; + } + function imageYOffset(baseline2, h2) { + return baseline2 === "middle" ? h2 / 2 : baseline2 === "bottom" ? h2 : 0; + } + function attr$4(emit2, item, renderer) { + const img = getImage(item, renderer), w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ""; + emit2("href", i, metadata["xmlns:xlink"], "xlink:href"); + emit2("transform", translate$2(x2, y2)); + emit2("width", w2); + emit2("height", h2); + emit2("preserveAspectRatio", item.aspect === false ? "none" : "xMidYMid"); + } + function bound$4(bounds2, item) { + const img = item.image, w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2); + return bounds2.set(x2, y2, x2 + w2, y2 + h2); + } + function draw$3(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + const img = getImage(item, this); + let w2 = imageWidth(item, img); + let h2 = imageHeight(item, img); + if (w2 === 0 || h2 === 0) return; + let x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), opacity2, ar0, ar1, t; + if (item.aspect !== false) { + ar0 = img.width / img.height; + ar1 = item.width / item.height; + if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { + if (ar1 < ar0) { + t = w2 / ar0; + y2 += (h2 - t) / 2; + h2 = t; + } else { + t = h2 * ar0; + x2 += (w2 - t) / 2; + w2 = t; + } + } + } + if (img.complete || img.toDataURL) { + blend(context2, item); + context2.globalAlpha = (opacity2 = item.opacity) != null ? opacity2 : 1; + context2.imageSmoothingEnabled = item.smooth !== false; + context2.drawImage(img, x2, y2, w2, h2); + } }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function gnomonicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -gnomonicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.atan)); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"huYSV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x0 = null, y0, x1, y1, kx = 1, ky = 1, transform = (0, _transformJs.transformer)({ - point: function(x, y) { - var p = projection([ - x, - y - ]); - this.stream.point(p[0], p[1]); - } - }), postclip = (0, _identityJsDefault.default), cache, cacheStream; - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - function projection(p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [ - x + tx, - y + ty - ]; - } - projection.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [ - x / kx, - y / ky - ]; - }; - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [ - tx, - ty - ]; - }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), sa = (0, _mathJs.sin)(alpha), ca = (0, _mathJs.cos)(alpha), reset()) : alpha * (0, _mathJs.degrees); - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); - }; - return projection; - }); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _mathJs = require("../math.js"); - -},{"../clip/rectangle.js":"9kmAt","../identity.js":"kub29","../transform.js":"9MXXE","./fit.js":"49j0j","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4AzsZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "naturalEarth1Raw", ()=>naturalEarth1Raw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(naturalEarth1Raw).scale(175.295); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; -} -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.045255 + phi4 * (-0.311325 + 0.259866 * phi2 - 0.005916 * 11 * phi4))); - }while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; -}; - -},{"./index.js":"cd9OX","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kjinQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orthographicRaw", ()=>orthographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(orthographicRaw).scale(249.5).clipAngle(90 + (0, _mathJs.epsilon)); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function orthographicRaw(x, y) { - return [ - (0, _mathJs.cos)(y) * (0, _mathJs.sin)(x), - (0, _mathJs.sin)(y) - ]; -} -orthographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.asin)); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6ko7r":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "stereographicRaw", ()=>stereographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(stereographicRaw).scale(250).clipAngle(142); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function stereographicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = 1 + (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -stereographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.atan)(z); -}); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i6NVd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "transverseMercatorRaw", ()=>transverseMercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - var m = (0, _mercatorJs.mercatorProjection)(transverseMercatorRaw), center = m.center, rotate = m.rotate; - m.center = function(_) { - return arguments.length ? center([ - -_[1], - _[0] - ]) : (_ = center(), [ - _[1], - -_[0] - ]); - }; - m.rotate = function(_) { - return arguments.length ? rotate([ - _[0], - _[1], - _.length > 2 ? _[2] + 90 : 90 - ]) : (_ = rotate(), [ - _[0], - _[1], - _[2] - 90 - ]); - }; - return rotate([ - 0, - 0, - 90 - ]).scale(159.155); + } + var image = { + type: "image", + tag: "image", + nested: false, + attr: attr$4, + bound: bound$4, + draw: draw$3, + pick: pick$1(), + isect: truthy, + // bounds check is sufficient + get: getImage, + xOffset: imageXOffset, + yOffset: imageYOffset + }; + var line$2 = markMultiItemPath("line", line$1, pickLine); + function attr$3(emit2, item) { + var sx = item.scaleX || 1, sy = item.scaleY || 1; + if (sx !== 1 || sy !== 1) { + emit2("vector-effect", "non-scaling-stroke"); + } + emit2("transform", transformItem(item)); + emit2("d", item.path); + } + function path$1(context2, item) { + var path2 = item.path; + if (path2 == null) return true; + var x2 = item.x || 0, y2 = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a2 = (item.angle || 0) * DegToRad, cache2 = item.pathCache; + if (!cache2 || cache2.path !== path2) { + (item.pathCache = cache2 = parse$3(path2)).path = path2; + } + if (a2 && context2.rotate && context2.translate) { + context2.translate(x2, y2); + context2.rotate(a2); + pathRender(context2, cache2, 0, 0, sx, sy); + context2.rotate(-a2); + context2.translate(-x2, -y2); + } else { + pathRender(context2, cache2, x2, y2, sx, sy); + } + } + function bound$3(bounds2, item) { + return path$1(boundContext(bounds2, item.angle), item) ? bounds2.set(0, 0, 0, 0) : boundStroke(bounds2, item, true); + } + var path$2 = { + type: "path", + tag: "path", + nested: false, + attr: attr$3, + bound: bound$3, + draw: drawAll(path$1), + pick: pickPath(path$1), + isect: intersectPath(path$1) + }; + function attr$2(emit2, item) { + emit2("d", rectangle(null, item)); + } + function bound$2(bounds2, item) { + var x2, y2; + return boundStroke(bounds2.set(x2 = item.x || 0, y2 = item.y || 0, x2 + item.width || 0, y2 + item.height || 0), item); + } + function draw$2(context2, item) { + context2.beginPath(); + rectangle(context2, item); + } + var rect = { + type: "rect", + tag: "path", + nested: false, + attr: attr$2, + bound: bound$2, + draw: drawAll(draw$2), + pick: pickPath(draw$2), + isect: intersectRect + }; + function attr$1(emit2, item) { + emit2("transform", translateItem(item)); + emit2("x2", item.x2 != null ? item.x2 - (item.x || 0) : 0); + emit2("y2", item.y2 != null ? item.y2 - (item.y || 0) : 0); + } + function bound$1(bounds2, item) { + var x12, y12; + return boundStroke(bounds2.set(x12 = item.x || 0, y12 = item.y || 0, item.x2 != null ? item.x2 : x12, item.y2 != null ? item.y2 : y12), item); + } + function path(context2, item, opacity2) { + var x12, y12, x2, y2; + if (item.stroke && stroke(context2, item, opacity2)) { + x12 = item.x || 0; + y12 = item.y || 0; + x2 = item.x2 != null ? item.x2 : x12; + y2 = item.y2 != null ? item.y2 : y12; + context2.beginPath(); + context2.moveTo(x12, y12); + context2.lineTo(x2, y2); + return true; + } + return false; + } + function draw$1(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + var opacity2 = item.opacity == null ? 1 : item.opacity; + if (opacity2 && path(context2, item, opacity2)) { + blend(context2, item); + context2.stroke(); + } }); -var _mathJs = require("../math.js"); -var _mercatorJs = require("./mercator.js"); -function transverseMercatorRaw(lambda, phi) { - return [ - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)), - -lambda - ]; -} -transverseMercatorRaw.invert = function(x, y) { - return [ - -y, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(x)) - (0, _mathJs.halfPi) - ]; -}; - -},{"../math.js":"74X19","./mercator.js":"iIGjZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ixW8K":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoAiry", ()=>(0, _airyJsDefault.default)); -parcelHelpers.export(exports, "geoAiryRaw", ()=>(0, _airyJs.airyRaw)); -parcelHelpers.export(exports, "geoAitoff", ()=>(0, _aitoffJsDefault.default)); -parcelHelpers.export(exports, "geoAitoffRaw", ()=>(0, _aitoffJs.aitoffRaw)); -parcelHelpers.export(exports, "geoArmadillo", ()=>(0, _armadilloJsDefault.default)); -parcelHelpers.export(exports, "geoArmadilloRaw", ()=>(0, _armadilloJs.armadilloRaw)); -parcelHelpers.export(exports, "geoAugust", ()=>(0, _augustJsDefault.default)); -parcelHelpers.export(exports, "geoAugustRaw", ()=>(0, _augustJs.augustRaw)); -parcelHelpers.export(exports, "geoBaker", ()=>(0, _bakerJsDefault.default)); -parcelHelpers.export(exports, "geoBakerRaw", ()=>(0, _bakerJs.bakerRaw)); -parcelHelpers.export(exports, "geoBerghaus", ()=>(0, _berghausJsDefault.default)); -parcelHelpers.export(exports, "geoBerghausRaw", ()=>(0, _berghausJs.berghausRaw)); -parcelHelpers.export(exports, "geoBertin1953", ()=>(0, _bertinJsDefault.default)); -parcelHelpers.export(exports, "geoBertin1953Raw", ()=>(0, _bertinJs.bertin1953Raw)); -parcelHelpers.export(exports, "geoBoggs", ()=>(0, _boggsJsDefault.default)); -parcelHelpers.export(exports, "geoBoggsRaw", ()=>(0, _boggsJs.boggsRaw)); -parcelHelpers.export(exports, "geoBonne", ()=>(0, _bonneJsDefault.default)); -parcelHelpers.export(exports, "geoBonneRaw", ()=>(0, _bonneJs.bonneRaw)); -parcelHelpers.export(exports, "geoBottomley", ()=>(0, _bottomleyJsDefault.default)); -parcelHelpers.export(exports, "geoBottomleyRaw", ()=>(0, _bottomleyJs.bottomleyRaw)); -parcelHelpers.export(exports, "geoBromley", ()=>(0, _bromleyJsDefault.default)); -parcelHelpers.export(exports, "geoBromleyRaw", ()=>(0, _bromleyJs.bromleyRaw)); -parcelHelpers.export(exports, "geoChamberlin", ()=>(0, _chamberlinJsDefault.default)); -parcelHelpers.export(exports, "geoChamberlinRaw", ()=>(0, _chamberlinJs.chamberlinRaw)); -parcelHelpers.export(exports, "geoChamberlinAfrica", ()=>(0, _chamberlinJs.chamberlinAfrica)); -parcelHelpers.export(exports, "geoCollignon", ()=>(0, _collignonJsDefault.default)); -parcelHelpers.export(exports, "geoCollignonRaw", ()=>(0, _collignonJs.collignonRaw)); -parcelHelpers.export(exports, "geoCraig", ()=>(0, _craigJsDefault.default)); -parcelHelpers.export(exports, "geoCraigRaw", ()=>(0, _craigJs.craigRaw)); -parcelHelpers.export(exports, "geoCraster", ()=>(0, _crasterJsDefault.default)); -parcelHelpers.export(exports, "geoCrasterRaw", ()=>(0, _crasterJs.crasterRaw)); -parcelHelpers.export(exports, "geoCylindricalEqualArea", ()=>(0, _cylindricalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalEqualAreaRaw", ()=>(0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)); -parcelHelpers.export(exports, "geoCylindricalStereographic", ()=>(0, _cylindricalStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalStereographicRaw", ()=>(0, _cylindricalStereographicJs.cylindricalStereographicRaw)); -parcelHelpers.export(exports, "geoEckert1", ()=>(0, _eckert1JsDefault.default)); -parcelHelpers.export(exports, "geoEckert1Raw", ()=>(0, _eckert1Js.eckert1Raw)); -parcelHelpers.export(exports, "geoEckert2", ()=>(0, _eckert2JsDefault.default)); -parcelHelpers.export(exports, "geoEckert2Raw", ()=>(0, _eckert2Js.eckert2Raw)); -parcelHelpers.export(exports, "geoEckert3", ()=>(0, _eckert3JsDefault.default)); -parcelHelpers.export(exports, "geoEckert3Raw", ()=>(0, _eckert3Js.eckert3Raw)); -parcelHelpers.export(exports, "geoEckert4", ()=>(0, _eckert4JsDefault.default)); -parcelHelpers.export(exports, "geoEckert4Raw", ()=>(0, _eckert4Js.eckert4Raw)); -parcelHelpers.export(exports, "geoEckert5", ()=>(0, _eckert5JsDefault.default)); -parcelHelpers.export(exports, "geoEckert5Raw", ()=>(0, _eckert5Js.eckert5Raw)); -parcelHelpers.export(exports, "geoEckert6", ()=>(0, _eckert6JsDefault.default)); -parcelHelpers.export(exports, "geoEckert6Raw", ()=>(0, _eckert6Js.eckert6Raw)); -parcelHelpers.export(exports, "geoEisenlohr", ()=>(0, _eisenlohrJsDefault.default)); -parcelHelpers.export(exports, "geoEisenlohrRaw", ()=>(0, _eisenlohrJs.eisenlohrRaw)); -parcelHelpers.export(exports, "geoFahey", ()=>(0, _faheyJsDefault.default)); -parcelHelpers.export(exports, "geoFaheyRaw", ()=>(0, _faheyJs.faheyRaw)); -parcelHelpers.export(exports, "geoFoucaut", ()=>(0, _foucautJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautRaw", ()=>(0, _foucautJs.foucautRaw)); -parcelHelpers.export(exports, "geoFoucautSinusoidal", ()=>(0, _foucautSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautSinusoidalRaw", ()=>(0, _foucautSinusoidalJs.foucautSinusoidalRaw)); -parcelHelpers.export(exports, "geoGilbert", ()=>(0, _gilbertJsDefault.default)); -parcelHelpers.export(exports, "geoGingery", ()=>(0, _gingeryJsDefault.default)); -parcelHelpers.export(exports, "geoGingeryRaw", ()=>(0, _gingeryJs.gingeryRaw)); -parcelHelpers.export(exports, "geoGinzburg4", ()=>(0, _ginzburg4JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg4Raw", ()=>(0, _ginzburg4Js.ginzburg4Raw)); -parcelHelpers.export(exports, "geoGinzburg5", ()=>(0, _ginzburg5JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg5Raw", ()=>(0, _ginzburg5Js.ginzburg5Raw)); -parcelHelpers.export(exports, "geoGinzburg6", ()=>(0, _ginzburg6JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg6Raw", ()=>(0, _ginzburg6Js.ginzburg6Raw)); -parcelHelpers.export(exports, "geoGinzburg8", ()=>(0, _ginzburg8JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg8Raw", ()=>(0, _ginzburg8Js.ginzburg8Raw)); -parcelHelpers.export(exports, "geoGinzburg9", ()=>(0, _ginzburg9JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg9Raw", ()=>(0, _ginzburg9Js.ginzburg9Raw)); -parcelHelpers.export(exports, "geoGringorten", ()=>(0, _gringortenJsDefault.default)); -parcelHelpers.export(exports, "geoGringortenRaw", ()=>(0, _gringortenJs.gringortenRaw)); -parcelHelpers.export(exports, "geoGuyou", ()=>(0, _guyouJsDefault.default)); -parcelHelpers.export(exports, "geoGuyouRaw", ()=>(0, _guyouJs.guyouRaw)); -parcelHelpers.export(exports, "geoHammer", ()=>(0, _hammerJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRaw", ()=>(0, _hammerJs.hammerRaw)); -parcelHelpers.export(exports, "geoHammerRetroazimuthal", ()=>(0, _hammerRetroazimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRetroazimuthalRaw", ()=>(0, _hammerRetroazimuthalJs.hammerRetroazimuthalRaw)); -parcelHelpers.export(exports, "geoHealpix", ()=>(0, _healpixJsDefault.default)); -parcelHelpers.export(exports, "geoHealpixRaw", ()=>(0, _healpixJs.healpixRaw)); -parcelHelpers.export(exports, "geoHill", ()=>(0, _hillJsDefault.default)); -parcelHelpers.export(exports, "geoHillRaw", ()=>(0, _hillJs.hillRaw)); -parcelHelpers.export(exports, "geoHomolosine", ()=>(0, _homolosineJsDefault.default)); -parcelHelpers.export(exports, "geoHomolosineRaw", ()=>(0, _homolosineJs.homolosineRaw)); -parcelHelpers.export(exports, "geoHufnagel", ()=>(0, _hufnagelJsDefault.default)); -parcelHelpers.export(exports, "geoHufnagelRaw", ()=>(0, _hufnagelJs.hufnagelRaw)); -parcelHelpers.export(exports, "geoHyperelliptical", ()=>(0, _hyperellipticalJsDefault.default)); -parcelHelpers.export(exports, "geoHyperellipticalRaw", ()=>(0, _hyperellipticalJs.hyperellipticalRaw)); -parcelHelpers.export(exports, "geoInterrupt", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedBoggs", ()=>(0, _boggsJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedHomolosine", ()=>(0, _homolosineJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedMollweide", ()=>(0, _mollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedMollweideHemispheres", ()=>(0, _mollweideHemispheresJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinuMollweide", ()=>(0, _sinuMollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinusoidal", ()=>(0, _sinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7", ()=>(0, _kavrayskiy7JsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7Raw", ()=>(0, _kavrayskiy7Js.kavrayskiy7Raw)); -parcelHelpers.export(exports, "geoLagrange", ()=>(0, _lagrangeJsDefault.default)); -parcelHelpers.export(exports, "geoLagrangeRaw", ()=>(0, _lagrangeJs.lagrangeRaw)); -parcelHelpers.export(exports, "geoLarrivee", ()=>(0, _larriveeJsDefault.default)); -parcelHelpers.export(exports, "geoLarriveeRaw", ()=>(0, _larriveeJs.larriveeRaw)); -parcelHelpers.export(exports, "geoLaskowski", ()=>(0, _laskowskiJsDefault.default)); -parcelHelpers.export(exports, "geoLaskowskiRaw", ()=>(0, _laskowskiJs.laskowskiRaw)); -parcelHelpers.export(exports, "geoLittrow", ()=>(0, _littrowJsDefault.default)); -parcelHelpers.export(exports, "geoLittrowRaw", ()=>(0, _littrowJs.littrowRaw)); -parcelHelpers.export(exports, "geoLoximuthal", ()=>(0, _loximuthalJsDefault.default)); -parcelHelpers.export(exports, "geoLoximuthalRaw", ()=>(0, _loximuthalJs.loximuthalRaw)); -parcelHelpers.export(exports, "geoMiller", ()=>(0, _millerJsDefault.default)); -parcelHelpers.export(exports, "geoMillerRaw", ()=>(0, _millerJs.millerRaw)); -parcelHelpers.export(exports, "geoModifiedStereographic", ()=>(0, _modifiedStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoModifiedStereographicRaw", ()=>(0, _modifiedStereographicJs.modifiedStereographicRaw)); -parcelHelpers.export(exports, "geoModifiedStereographicAlaska", ()=>(0, _modifiedStereographicJs.modifiedStereographicAlaska)); -parcelHelpers.export(exports, "geoModifiedStereographicGs48", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs48)); -parcelHelpers.export(exports, "geoModifiedStereographicGs50", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs50)); -parcelHelpers.export(exports, "geoModifiedStereographicMiller", ()=>(0, _modifiedStereographicJs.modifiedStereographicMiller)); -parcelHelpers.export(exports, "geoModifiedStereographicLee", ()=>(0, _modifiedStereographicJs.modifiedStereographicLee)); -parcelHelpers.export(exports, "geoMollweide", ()=>(0, _mollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoMollweideRaw", ()=>(0, _mollweideJs1.mollweideRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolic", ()=>(0, _mtFlatPolarParabolicJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolicRaw", ()=>(0, _mtFlatPolarParabolicJs.mtFlatPolarParabolicRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarQuartic", ()=>(0, _mtFlatPolarQuarticJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarQuarticRaw", ()=>(0, _mtFlatPolarQuarticJs.mtFlatPolarQuarticRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidal", ()=>(0, _mtFlatPolarSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidalRaw", ()=>(0, _mtFlatPolarSinusoidalJs.mtFlatPolarSinusoidalRaw)); -parcelHelpers.export(exports, "geoNaturalEarth2", ()=>(0, _naturalEarth2JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth2Raw", ()=>(0, _naturalEarth2Js.naturalEarth2Raw)); -parcelHelpers.export(exports, "geoNellHammer", ()=>(0, _nellHammerJsDefault.default)); -parcelHelpers.export(exports, "geoNellHammerRaw", ()=>(0, _nellHammerJs.nellHammerRaw)); -parcelHelpers.export(exports, "geoInterruptedQuarticAuthalic", ()=>(0, _quarticAuthalicJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosi", ()=>(0, _nicolosiJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosiRaw", ()=>(0, _nicolosiJs.nicolosiRaw)); -parcelHelpers.export(exports, "geoPatterson", ()=>(0, _pattersonJsDefault.default)); -parcelHelpers.export(exports, "geoPattersonRaw", ()=>(0, _pattersonJs.pattersonRaw)); -parcelHelpers.export(exports, "geoPolyconic", ()=>(0, _polyconicJsDefault.default)); -parcelHelpers.export(exports, "geoPolyconicRaw", ()=>(0, _polyconicJs.polyconicRaw)); -parcelHelpers.export(exports, "geoPolyhedral", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralButterfly", ()=>(0, _butterflyJsDefault.default)); -parcelHelpers.export(exports, "geoPolyhedralCollignon", ()=>(0, _collignonJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralWaterman", ()=>(0, _watermanJsDefault.default)); -parcelHelpers.export(exports, "geoProject", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "geoGringortenQuincuncial", ()=>(0, _gringortenJsDefault1.default)); -parcelHelpers.export(exports, "geoPeirceQuincuncial", ()=>(0, _peirceJsDefault.default)); -parcelHelpers.export(exports, "geoQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "geoQuincuncial", ()=>(0, _indexJsDefault3.default)); -parcelHelpers.export(exports, "geoRectangularPolyconic", ()=>(0, _rectangularPolyconicJsDefault.default)); -parcelHelpers.export(exports, "geoRectangularPolyconicRaw", ()=>(0, _rectangularPolyconicJs.rectangularPolyconicRaw)); -parcelHelpers.export(exports, "geoRobinson", ()=>(0, _robinsonJsDefault.default)); -parcelHelpers.export(exports, "geoRobinsonRaw", ()=>(0, _robinsonJs.robinsonRaw)); -parcelHelpers.export(exports, "geoSatellite", ()=>(0, _satelliteJsDefault.default)); -parcelHelpers.export(exports, "geoSatelliteRaw", ()=>(0, _satelliteJs.satelliteRaw)); -parcelHelpers.export(exports, "geoSinuMollweide", ()=>(0, _sinuMollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoSinuMollweideRaw", ()=>(0, _sinuMollweideJs1.sinuMollweideRaw)); -parcelHelpers.export(exports, "geoSinusoidal", ()=>(0, _sinusoidalJsDefault1.default)); -parcelHelpers.export(exports, "geoSinusoidalRaw", ()=>(0, _sinusoidalJs1.sinusoidalRaw)); -parcelHelpers.export(exports, "geoStitch", ()=>(0, _stitchJsDefault.default)); -parcelHelpers.export(exports, "geoTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "geoTimesRaw", ()=>(0, _timesJs.timesRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthal", ()=>(0, _twoPointAzimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalRaw", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalUsa", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalUsa)); -parcelHelpers.export(exports, "geoTwoPointEquidistant", ()=>(0, _twoPointEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointEquidistantRaw", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantRaw)); -parcelHelpers.export(exports, "geoTwoPointEquidistantUsa", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantUsa)); -parcelHelpers.export(exports, "geoVanDerGrinten", ()=>(0, _vanDerGrintenJsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrintenRaw", ()=>(0, _vanDerGrintenJs.vanDerGrintenRaw)); -parcelHelpers.export(exports, "geoVanDerGrinten2", ()=>(0, _vanDerGrinten2JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten2Raw", ()=>(0, _vanDerGrinten2Js.vanDerGrinten2Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten3", ()=>(0, _vanDerGrinten3JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten3Raw", ()=>(0, _vanDerGrinten3Js.vanDerGrinten3Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten4", ()=>(0, _vanDerGrinten4JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten4Raw", ()=>(0, _vanDerGrinten4Js.vanDerGrinten4Raw)); -parcelHelpers.export(exports, "geoWagner", ()=>(0, _wagnerJsDefault.default)); -parcelHelpers.export(exports, "geoWagner7", ()=>(0, _wagnerJs.wagner7)); -parcelHelpers.export(exports, "geoWagnerRaw", ()=>(0, _wagnerJs.wagnerRaw)); -parcelHelpers.export(exports, "geoWagner4", ()=>(0, _wagner4JsDefault.default)); -parcelHelpers.export(exports, "geoWagner4Raw", ()=>(0, _wagner4Js.wagner4Raw)); -parcelHelpers.export(exports, "geoWagner6", ()=>(0, _wagner6JsDefault.default)); -parcelHelpers.export(exports, "geoWagner6Raw", ()=>(0, _wagner6Js.wagner6Raw)); -parcelHelpers.export(exports, "geoWiechel", ()=>(0, _wiechelJsDefault.default)); -parcelHelpers.export(exports, "geoWiechelRaw", ()=>(0, _wiechelJs.wiechelRaw)); -parcelHelpers.export(exports, "geoWinkel3", ()=>(0, _winkel3JsDefault.default)); -parcelHelpers.export(exports, "geoWinkel3Raw", ()=>(0, _winkel3Js.winkel3Raw)); -var _airyJs = require("./airy.js"); -var _airyJsDefault = parcelHelpers.interopDefault(_airyJs); -var _aitoffJs = require("./aitoff.js"); -var _aitoffJsDefault = parcelHelpers.interopDefault(_aitoffJs); -var _armadilloJs = require("./armadillo.js"); -var _armadilloJsDefault = parcelHelpers.interopDefault(_armadilloJs); -var _augustJs = require("./august.js"); -var _augustJsDefault = parcelHelpers.interopDefault(_augustJs); -var _bakerJs = require("./baker.js"); -var _bakerJsDefault = parcelHelpers.interopDefault(_bakerJs); -var _berghausJs = require("./berghaus.js"); -var _berghausJsDefault = parcelHelpers.interopDefault(_berghausJs); -var _bertinJs = require("./bertin.js"); -var _bertinJsDefault = parcelHelpers.interopDefault(_bertinJs); -var _boggsJs = require("./boggs.js"); -var _boggsJsDefault = parcelHelpers.interopDefault(_boggsJs); -var _bonneJs = require("./bonne.js"); -var _bonneJsDefault = parcelHelpers.interopDefault(_bonneJs); -var _bottomleyJs = require("./bottomley.js"); -var _bottomleyJsDefault = parcelHelpers.interopDefault(_bottomleyJs); -var _bromleyJs = require("./bromley.js"); -var _bromleyJsDefault = parcelHelpers.interopDefault(_bromleyJs); -var _chamberlinJs = require("./chamberlin.js"); -var _chamberlinJsDefault = parcelHelpers.interopDefault(_chamberlinJs); -var _collignonJs = require("./collignon.js"); -var _collignonJsDefault = parcelHelpers.interopDefault(_collignonJs); -var _craigJs = require("./craig.js"); -var _craigJsDefault = parcelHelpers.interopDefault(_craigJs); -var _crasterJs = require("./craster.js"); -var _crasterJsDefault = parcelHelpers.interopDefault(_crasterJs); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -var _cylindricalEqualAreaJsDefault = parcelHelpers.interopDefault(_cylindricalEqualAreaJs); -var _cylindricalStereographicJs = require("./cylindricalStereographic.js"); -var _cylindricalStereographicJsDefault = parcelHelpers.interopDefault(_cylindricalStereographicJs); -var _eckert1Js = require("./eckert1.js"); -var _eckert1JsDefault = parcelHelpers.interopDefault(_eckert1Js); -var _eckert2Js = require("./eckert2.js"); -var _eckert2JsDefault = parcelHelpers.interopDefault(_eckert2Js); -var _eckert3Js = require("./eckert3.js"); -var _eckert3JsDefault = parcelHelpers.interopDefault(_eckert3Js); -var _eckert4Js = require("./eckert4.js"); -var _eckert4JsDefault = parcelHelpers.interopDefault(_eckert4Js); -var _eckert5Js = require("./eckert5.js"); -var _eckert5JsDefault = parcelHelpers.interopDefault(_eckert5Js); -var _eckert6Js = require("./eckert6.js"); -var _eckert6JsDefault = parcelHelpers.interopDefault(_eckert6Js); -var _eisenlohrJs = require("./eisenlohr.js"); -var _eisenlohrJsDefault = parcelHelpers.interopDefault(_eisenlohrJs); -var _faheyJs = require("./fahey.js"); -var _faheyJsDefault = parcelHelpers.interopDefault(_faheyJs); -var _foucautJs = require("./foucaut.js"); -var _foucautJsDefault = parcelHelpers.interopDefault(_foucautJs); -var _foucautSinusoidalJs = require("./foucautSinusoidal.js"); -var _foucautSinusoidalJsDefault = parcelHelpers.interopDefault(_foucautSinusoidalJs); -var _gilbertJs = require("./gilbert.js"); -var _gilbertJsDefault = parcelHelpers.interopDefault(_gilbertJs); -var _gingeryJs = require("./gingery.js"); -var _gingeryJsDefault = parcelHelpers.interopDefault(_gingeryJs); -var _ginzburg4Js = require("./ginzburg4.js"); -var _ginzburg4JsDefault = parcelHelpers.interopDefault(_ginzburg4Js); -var _ginzburg5Js = require("./ginzburg5.js"); -var _ginzburg5JsDefault = parcelHelpers.interopDefault(_ginzburg5Js); -var _ginzburg6Js = require("./ginzburg6.js"); -var _ginzburg6JsDefault = parcelHelpers.interopDefault(_ginzburg6Js); -var _ginzburg8Js = require("./ginzburg8.js"); -var _ginzburg8JsDefault = parcelHelpers.interopDefault(_ginzburg8Js); -var _ginzburg9Js = require("./ginzburg9.js"); -var _ginzburg9JsDefault = parcelHelpers.interopDefault(_ginzburg9Js); -var _gringortenJs = require("./gringorten.js"); -var _gringortenJsDefault = parcelHelpers.interopDefault(_gringortenJs); -var _guyouJs = require("./guyou.js"); -var _guyouJsDefault = parcelHelpers.interopDefault(_guyouJs); -var _hammerJs = require("./hammer.js"); -var _hammerJsDefault = parcelHelpers.interopDefault(_hammerJs); -var _hammerRetroazimuthalJs = require("./hammerRetroazimuthal.js"); -var _hammerRetroazimuthalJsDefault = parcelHelpers.interopDefault(_hammerRetroazimuthalJs); -var _healpixJs = require("./healpix.js"); -var _healpixJsDefault = parcelHelpers.interopDefault(_healpixJs); -var _hillJs = require("./hill.js"); -var _hillJsDefault = parcelHelpers.interopDefault(_hillJs); -var _homolosineJs = require("./homolosine.js"); -var _homolosineJsDefault = parcelHelpers.interopDefault(_homolosineJs); -var _hufnagelJs = require("./hufnagel.js"); -var _hufnagelJsDefault = parcelHelpers.interopDefault(_hufnagelJs); -var _hyperellipticalJs = require("./hyperelliptical.js"); -var _hyperellipticalJsDefault = parcelHelpers.interopDefault(_hyperellipticalJs); -var _indexJs = require("./interrupted/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _boggsJs1 = require("./interrupted/boggs.js"); -var _boggsJsDefault1 = parcelHelpers.interopDefault(_boggsJs1); -var _homolosineJs1 = require("./interrupted/homolosine.js"); -var _homolosineJsDefault1 = parcelHelpers.interopDefault(_homolosineJs1); -var _mollweideJs = require("./interrupted/mollweide.js"); -var _mollweideJsDefault = parcelHelpers.interopDefault(_mollweideJs); -var _mollweideHemispheresJs = require("./interrupted/mollweideHemispheres.js"); -var _mollweideHemispheresJsDefault = parcelHelpers.interopDefault(_mollweideHemispheresJs); -var _sinuMollweideJs = require("./interrupted/sinuMollweide.js"); -var _sinuMollweideJsDefault = parcelHelpers.interopDefault(_sinuMollweideJs); -var _sinusoidalJs = require("./interrupted/sinusoidal.js"); -var _sinusoidalJsDefault = parcelHelpers.interopDefault(_sinusoidalJs); -var _kavrayskiy7Js = require("./kavrayskiy7.js"); -var _kavrayskiy7JsDefault = parcelHelpers.interopDefault(_kavrayskiy7Js); -var _lagrangeJs = require("./lagrange.js"); -var _lagrangeJsDefault = parcelHelpers.interopDefault(_lagrangeJs); -var _larriveeJs = require("./larrivee.js"); -var _larriveeJsDefault = parcelHelpers.interopDefault(_larriveeJs); -var _laskowskiJs = require("./laskowski.js"); -var _laskowskiJsDefault = parcelHelpers.interopDefault(_laskowskiJs); -var _littrowJs = require("./littrow.js"); -var _littrowJsDefault = parcelHelpers.interopDefault(_littrowJs); -var _loximuthalJs = require("./loximuthal.js"); -var _loximuthalJsDefault = parcelHelpers.interopDefault(_loximuthalJs); -var _millerJs = require("./miller.js"); -var _millerJsDefault = parcelHelpers.interopDefault(_millerJs); -var _modifiedStereographicJs = require("./modifiedStereographic.js"); -var _modifiedStereographicJsDefault = parcelHelpers.interopDefault(_modifiedStereographicJs); -var _mollweideJs1 = require("./mollweide.js"); -var _mollweideJsDefault1 = parcelHelpers.interopDefault(_mollweideJs1); -var _mtFlatPolarParabolicJs = require("./mtFlatPolarParabolic.js"); -var _mtFlatPolarParabolicJsDefault = parcelHelpers.interopDefault(_mtFlatPolarParabolicJs); -var _mtFlatPolarQuarticJs = require("./mtFlatPolarQuartic.js"); -var _mtFlatPolarQuarticJsDefault = parcelHelpers.interopDefault(_mtFlatPolarQuarticJs); -var _mtFlatPolarSinusoidalJs = require("./mtFlatPolarSinusoidal.js"); -var _mtFlatPolarSinusoidalJsDefault = parcelHelpers.interopDefault(_mtFlatPolarSinusoidalJs); -var _naturalEarth2Js = require("./naturalEarth2.js"); -var _naturalEarth2JsDefault = parcelHelpers.interopDefault(_naturalEarth2Js); -var _nellHammerJs = require("./nellHammer.js"); -var _nellHammerJsDefault = parcelHelpers.interopDefault(_nellHammerJs); -var _quarticAuthalicJs = require("./interrupted/quarticAuthalic.js"); -var _quarticAuthalicJsDefault = parcelHelpers.interopDefault(_quarticAuthalicJs); -var _nicolosiJs = require("./nicolosi.js"); -var _nicolosiJsDefault = parcelHelpers.interopDefault(_nicolosiJs); -var _pattersonJs = require("./patterson.js"); -var _pattersonJsDefault = parcelHelpers.interopDefault(_pattersonJs); -var _polyconicJs = require("./polyconic.js"); -var _polyconicJsDefault = parcelHelpers.interopDefault(_polyconicJs); -var _indexJs1 = require("./polyhedral/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _butterflyJs = require("./polyhedral/butterfly.js"); -var _butterflyJsDefault = parcelHelpers.interopDefault(_butterflyJs); -var _collignonJs1 = require("./polyhedral/collignon.js"); -var _collignonJsDefault1 = parcelHelpers.interopDefault(_collignonJs1); -var _watermanJs = require("./polyhedral/waterman.js"); -var _watermanJsDefault = parcelHelpers.interopDefault(_watermanJs); -var _indexJs2 = require("./project/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _gringortenJs1 = require("./quincuncial/gringorten.js"); -var _gringortenJsDefault1 = parcelHelpers.interopDefault(_gringortenJs1); -var _peirceJs = require("./quincuncial/peirce.js"); -var _peirceJsDefault = parcelHelpers.interopDefault(_peirceJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _indexJs3 = require("./quincuncial/index.js"); -var _indexJsDefault3 = parcelHelpers.interopDefault(_indexJs3); -var _rectangularPolyconicJs = require("./rectangularPolyconic.js"); -var _rectangularPolyconicJsDefault = parcelHelpers.interopDefault(_rectangularPolyconicJs); -var _robinsonJs = require("./robinson.js"); -var _robinsonJsDefault = parcelHelpers.interopDefault(_robinsonJs); -var _satelliteJs = require("./satellite.js"); -var _satelliteJsDefault = parcelHelpers.interopDefault(_satelliteJs); -var _sinuMollweideJs1 = require("./sinuMollweide.js"); -var _sinuMollweideJsDefault1 = parcelHelpers.interopDefault(_sinuMollweideJs1); -var _sinusoidalJs1 = require("./sinusoidal.js"); -var _sinusoidalJsDefault1 = parcelHelpers.interopDefault(_sinusoidalJs1); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -var _timesJs = require("./times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _twoPointAzimuthalJs = require("./twoPointAzimuthal.js"); -var _twoPointAzimuthalJsDefault = parcelHelpers.interopDefault(_twoPointAzimuthalJs); -var _twoPointEquidistantJs = require("./twoPointEquidistant.js"); -var _twoPointEquidistantJsDefault = parcelHelpers.interopDefault(_twoPointEquidistantJs); -var _vanDerGrintenJs = require("./vanDerGrinten.js"); -var _vanDerGrintenJsDefault = parcelHelpers.interopDefault(_vanDerGrintenJs); -var _vanDerGrinten2Js = require("./vanDerGrinten2.js"); -var _vanDerGrinten2JsDefault = parcelHelpers.interopDefault(_vanDerGrinten2Js); -var _vanDerGrinten3Js = require("./vanDerGrinten3.js"); -var _vanDerGrinten3JsDefault = parcelHelpers.interopDefault(_vanDerGrinten3Js); -var _vanDerGrinten4Js = require("./vanDerGrinten4.js"); -var _vanDerGrinten4JsDefault = parcelHelpers.interopDefault(_vanDerGrinten4Js); -var _wagnerJs = require("./wagner.js"); -var _wagnerJsDefault = parcelHelpers.interopDefault(_wagnerJs); -var _wagner4Js = require("./wagner4.js"); -var _wagner4JsDefault = parcelHelpers.interopDefault(_wagner4Js); -var _wagner6Js = require("./wagner6.js"); -var _wagner6JsDefault = parcelHelpers.interopDefault(_wagner6Js); -var _wiechelJs = require("./wiechel.js"); -var _wiechelJsDefault = parcelHelpers.interopDefault(_wiechelJs); -var _winkel3Js = require("./winkel3.js"); -var _winkel3JsDefault = parcelHelpers.interopDefault(_winkel3Js); - -},{"./airy.js":false,"./aitoff.js":false,"./armadillo.js":false,"./august.js":false,"./baker.js":false,"./berghaus.js":false,"./bertin.js":false,"./boggs.js":false,"./bonne.js":false,"./bottomley.js":false,"./bromley.js":false,"./chamberlin.js":false,"./collignon.js":false,"./craig.js":false,"./craster.js":false,"./cylindricalEqualArea.js":false,"./cylindricalStereographic.js":false,"./eckert1.js":false,"./eckert2.js":false,"./eckert3.js":false,"./eckert4.js":false,"./eckert5.js":false,"./eckert6.js":false,"./eisenlohr.js":false,"./fahey.js":false,"./foucaut.js":false,"./foucautSinusoidal.js":false,"./gilbert.js":false,"./gingery.js":false,"./ginzburg4.js":false,"./ginzburg5.js":false,"./ginzburg6.js":false,"./ginzburg8.js":false,"./ginzburg9.js":false,"./gringorten.js":false,"./guyou.js":false,"./hammer.js":false,"./hammerRetroazimuthal.js":false,"./healpix.js":false,"./hill.js":false,"./homolosine.js":false,"./hufnagel.js":false,"./hyperelliptical.js":false,"./interrupted/index.js":false,"./interrupted/boggs.js":false,"./interrupted/homolosine.js":false,"./interrupted/mollweide.js":false,"./interrupted/mollweideHemispheres.js":false,"./interrupted/sinuMollweide.js":false,"./interrupted/sinusoidal.js":false,"./kavrayskiy7.js":false,"./lagrange.js":false,"./larrivee.js":false,"./laskowski.js":false,"./littrow.js":false,"./loximuthal.js":false,"./miller.js":false,"./modifiedStereographic.js":false,"./mollweide.js":"dkpmT","./mtFlatPolarParabolic.js":false,"./mtFlatPolarQuartic.js":false,"./mtFlatPolarSinusoidal.js":false,"./naturalEarth2.js":false,"./nellHammer.js":false,"./interrupted/quarticAuthalic.js":false,"./nicolosi.js":false,"./patterson.js":false,"./polyconic.js":false,"./polyhedral/index.js":false,"./polyhedral/butterfly.js":false,"./polyhedral/collignon.js":false,"./polyhedral/waterman.js":false,"./project/index.js":false,"./quincuncial/gringorten.js":false,"./quincuncial/peirce.js":false,"./quantize.js":false,"./quincuncial/index.js":false,"./rectangularPolyconic.js":false,"./robinson.js":false,"./satellite.js":false,"./sinuMollweide.js":false,"./sinusoidal.js":false,"./stitch.js":false,"./times.js":false,"./twoPointAzimuthal.js":false,"./twoPointEquidistant.js":false,"./vanDerGrinten.js":false,"./vanDerGrinten2.js":false,"./vanDerGrinten3.js":false,"./vanDerGrinten4.js":false,"./wagner.js":false,"./wagner4.js":false,"./wagner6.js":false,"./wiechel.js":false,"./winkel3.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dkpmT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mollweideBromleyTheta", ()=>mollweideBromleyTheta); -parcelHelpers.export(exports, "mollweideBromleyRaw", ()=>mollweideBromleyRaw); -parcelHelpers.export(exports, "mollweideRaw", ()=>mollweideRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _d3Geo.geoProjection)(mollweideRaw).scale(169.529); + } + function hit$1(context2, item, x2, y2) { + if (!context2.isPointInStroke) return false; + return path(context2, item, 1) && context2.isPointInStroke(x2, y2); + } + var rule$1 = { + type: "rule", + tag: "line", + nested: false, + attr: attr$1, + bound: bound$1, + draw: draw$1, + pick: pick$1(hit$1), + isect: intersectRule + }; + var shape = markItemPath("shape", shape$1); + var symbol = markItemPath("symbol", symbol$1, intersectPoint); + const widthCache = lruCache(); + var textMetrics = { + height: fontSize, + measureWidth, + estimateWidth, + width: estimateWidth, + canvas: useCanvas + }; + useCanvas(true); + function useCanvas(use2) { + textMetrics.width = use2 && context$2 ? measureWidth : estimateWidth; + } + function estimateWidth(item, text2) { + return _estimateWidth(textValue(item, text2), fontSize(item)); + } + function _estimateWidth(text2, currentFontHeight) { + return ~~(0.8 * text2.length * currentFontHeight); + } + function measureWidth(item, text2) { + return fontSize(item) <= 0 || !(text2 = textValue(item, text2)) ? 0 : _measureWidth(text2, font(item)); + } + function _measureWidth(text2, currentFont) { + const key2 = `(${currentFont}) ${text2}`; + let width2 = widthCache.get(key2); + if (width2 === void 0) { + context$2.font = currentFont; + width2 = context$2.measureText(text2).width; + widthCache.set(key2, width2); + } + return width2; + } + function fontSize(item) { + return item.fontSize != null ? +item.fontSize || 0 : 11; + } + function lineHeight(item) { + return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; + } + function lineArray(_) { + return isArray(_) ? _.length > 1 ? _ : _[0] : _; + } + function textLines(item) { + return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text); + } + function multiLineOffset(item) { + const tl2 = textLines(item); + return (isArray(tl2) ? tl2.length - 1 : 0) * lineHeight(item); + } + function textValue(item, line2) { + const text2 = line2 == null ? "" : (line2 + "").trim(); + return item.limit > 0 && text2.length ? truncate(item, text2) : text2; + } + function widthGetter(item) { + if (textMetrics.width === measureWidth) { + const currentFont = font(item); + return (text2) => _measureWidth(text2, currentFont); + } else if (textMetrics.width === estimateWidth) { + const currentFontHeight = fontSize(item); + return (text2) => _estimateWidth(text2, currentFontHeight); + } else { + return (text2) => textMetrics.width(item, text2); + } + } + function truncate(item, text2) { + var limit = +item.limit, width2 = widthGetter(item); + if (width2(text2) < limit) return text2; + var ellipsis = item.ellipsis || "…", rtl = item.dir === "rtl", lo = 0, hi = text2.length, mid; + limit -= width2(ellipsis); + if (rtl) { + while (lo < hi) { + mid = lo + hi >>> 1; + if (width2(text2.slice(mid)) > limit) lo = mid + 1; + else hi = mid; + } + return ellipsis + text2.slice(lo); + } else { + while (lo < hi) { + mid = 1 + (lo + hi >>> 1); + if (width2(text2.slice(0, mid)) < limit) lo = mid; + else hi = mid - 1; + } + return text2.slice(0, lo) + ellipsis; + } + } + function fontFamily(item, quote) { + var font2 = item.font; + return (quote && font2 ? String(font2).replace(/"/g, "'") : font2) || "sans-serif"; + } + function font(item, quote) { + return (item.fontStyle ? item.fontStyle + " " : "") + (item.fontVariant ? item.fontVariant + " " : "") + (item.fontWeight ? item.fontWeight + " " : "") + fontSize(item) + "px " + fontFamily(item, quote); + } + function offset$2(item) { + var baseline2 = item.baseline, h2 = fontSize(item); + return Math.round(baseline2 === "top" ? 0.79 * h2 : baseline2 === "middle" ? 0.3 * h2 : baseline2 === "bottom" ? -0.21 * h2 : baseline2 === "line-top" ? 0.29 * h2 + 0.5 * lineHeight(item) : baseline2 === "line-bottom" ? 0.29 * h2 - 0.5 * lineHeight(item) : 0); + } + const textAlign = { + "left": "start", + "center": "middle", + "right": "end" + }; + const tempBounds$1 = new Bounds(); + function anchorPoint(item) { + var x2 = item.x || 0, y2 = item.y || 0, r = item.radius || 0, t; + if (r) { + t = (item.theta || 0) - HalfPi; + x2 += r * Math.cos(t); + y2 += r * Math.sin(t); + } + tempBounds$1.x1 = x2; + tempBounds$1.y1 = y2; + return tempBounds$1; + } + function attr(emit2, item) { + var dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item), p = anchorPoint(item), x2 = p.x1, y2 = p.y1, a2 = item.angle || 0, t; + emit2("text-anchor", textAlign[item.align] || "start"); + if (a2) { + t = translate$2(x2, y2) + " " + rotate(a2); + if (dx || dy) t += " " + translate$2(dx, dy); + } else { + t = translate$2(x2 + dx, y2 + dy); + } + emit2("transform", t); + } + function bound(bounds2, item, mode) { + var h2 = textMetrics.height(item), a2 = item.align, p = anchorPoint(item), x2 = p.x1, y2 = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h2), tl2 = textLines(item), w2; + if (isArray(tl2)) { + h2 += lineHeight(item) * (tl2.length - 1); + w2 = tl2.reduce((w3, t) => Math.max(w3, textMetrics.width(item, t)), 0); + } else { + w2 = textMetrics.width(item, tl2); + } + if (a2 === "center") { + dx -= w2 / 2; + } else if (a2 === "right") { + dx -= w2; + } else ; + bounds2.set(dx += x2, dy += y2, dx + w2, dy + h2); + if (item.angle && !mode) { + bounds2.rotate(item.angle * DegToRad, x2, y2); + } else if (mode === 2) { + return bounds2.rotatedPoints(item.angle * DegToRad, x2, y2); + } + return bounds2; + } + function draw$5(context2, scene, bounds2) { + visit(scene, (item) => { + var opacity2 = item.opacity == null ? 1 : item.opacity, p, x2, y2, i, lh, tl2, str; + if (bounds2 && !bounds2.intersects(item.bounds) || // bounds check + opacity2 === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; + context2.font = font(item); + context2.textAlign = item.align || "left"; + p = anchorPoint(item); + x2 = p.x1, y2 = p.y1; + if (item.angle) { + context2.save(); + context2.translate(x2, y2); + context2.rotate(item.angle * DegToRad); + x2 = y2 = 0; + } + x2 += item.dx || 0; + y2 += (item.dy || 0) + offset$2(item); + tl2 = textLines(item); + blend(context2, item); + if (isArray(tl2)) { + lh = lineHeight(item); + for (i = 0; i < tl2.length; ++i) { + str = textValue(item, tl2[i]); + if (item.fill && fill$1(context2, item, opacity2)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity2)) { + context2.strokeText(str, x2, y2); + } + y2 += lh; + } + } else { + str = textValue(item, tl2); + if (item.fill && fill$1(context2, item, opacity2)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity2)) { + context2.strokeText(str, x2, y2); + } + } + if (item.angle) context2.restore(); }); -var _d3Geo = require("d3-geo"); -var _mathJs = require("./math.js"); -function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * (0, _mathJs.sin)(phi), i = 30, delta; - do phi -= delta = (phi + (0, _mathJs.sin)(phi) - cpsinPhi) / (1 + (0, _mathJs.cos)(phi)); - while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return phi / 2; -} -function mollweideBromleyRaw(cx, cy, cp) { - function forward(lambda, phi) { - return [ - cx * lambda * (0, _mathJs.cos)(phi = mollweideBromleyTheta(cp, phi)), - cy * (0, _mathJs.sin)(phi) - ]; - } - forward.invert = function(x, y) { - return y = (0, _mathJs.asin)(y / cy), [ - x / (cx * (0, _mathJs.cos)(y)), - (0, _mathJs.asin)((2 * y + (0, _mathJs.sin)(2 * y)) / cp) - ]; + } + function hit(context2, item, x2, y2, gx, gy) { + if (item.fontSize <= 0) return false; + if (!item.angle) return true; + var p = anchorPoint(item), ax = p.x1, ay = p.y1, b2 = bound(tempBounds$1, item, 1), a2 = -item.angle * DegToRad, cos2 = Math.cos(a2), sin2 = Math.sin(a2), px2 = cos2 * gx - sin2 * gy + (ax - cos2 * ax + sin2 * ay), py2 = sin2 * gx + cos2 * gy + (ay - sin2 * ax - cos2 * ay); + return b2.contains(px2, py2); + } + function intersectText(item, box2) { + const p = bound(tempBounds$1, item, 2); + return intersectBoxLine(box2, p[0], p[1], p[2], p[3]) || intersectBoxLine(box2, p[0], p[1], p[4], p[5]) || intersectBoxLine(box2, p[4], p[5], p[6], p[7]) || intersectBoxLine(box2, p[2], p[3], p[6], p[7]); + } + var text = { + type: "text", + tag: "text", + nested: false, + attr, + bound, + draw: draw$5, + pick: pick$1(hit), + isect: intersectText + }; + var trail = markMultiItemPath("trail", trail$1, pickTrail); + var Marks = { + arc: arc$2, + area: area$2, + group: group$1, + image, + line: line$2, + path: path$2, + rect, + rule: rule$1, + shape, + symbol, + text, + trail + }; + function boundItem$1(item, func, opt) { + var type2 = Marks[item.mark.marktype], bound2 = func || type2.bound; + if (type2.nested) item = item.mark; + return bound2(item.bounds || (item.bounds = new Bounds()), item, opt); + } + var DUMMY = { + mark: null + }; + function boundMark(mark, bounds2, opt) { + var type2 = Marks[mark.marktype], bound2 = type2.bound, items = mark.items, hasItems = items && items.length, i, n, item, b2; + if (type2.nested) { + if (hasItems) { + item = items[0]; + } else { + DUMMY.mark = mark; + item = DUMMY; + } + b2 = boundItem$1(item, bound2, opt); + bounds2 = bounds2 && bounds2.union(b2) || b2; + return bounds2; + } + bounds2 = bounds2 || mark.bounds && mark.bounds.clear() || new Bounds(); + if (hasItems) { + for (i = 0, n = items.length; i < n; ++i) { + bounds2.union(boundItem$1(items[i], bound2, opt)); + } + } + return mark.bounds = bounds2; + } + const keys$1 = [ + "marktype", + "name", + "role", + "interactive", + "clip", + "items", + "zindex", + "x", + "y", + "width", + "height", + "align", + "baseline", + // layout + "fill", + "fillOpacity", + "opacity", + "blend", + // fill + "stroke", + "strokeOpacity", + "strokeWidth", + "strokeCap", + // stroke + "strokeDash", + "strokeDashOffset", + // stroke dash + "strokeForeground", + "strokeOffset", + // group + "startAngle", + "endAngle", + "innerRadius", + "outerRadius", + // arc + "cornerRadius", + "padAngle", + // arc, rect + "cornerRadiusTopLeft", + "cornerRadiusTopRight", + // rect, group + "cornerRadiusBottomLeft", + "cornerRadiusBottomRight", + "interpolate", + "tension", + "orient", + "defined", + // area, line + "url", + "aspect", + "smooth", + // image + "path", + "scaleX", + "scaleY", + // path + "x2", + "y2", + // rule + "size", + "shape", + // symbol + "text", + "angle", + "theta", + "radius", + "dir", + "dx", + "dy", + // text + "ellipsis", + "limit", + "lineBreak", + "lineHeight", + "font", + "fontSize", + "fontWeight", + "fontStyle", + "fontVariant", + // font + "description", + "aria", + "ariaRole", + "ariaRoleDescription" + // aria + ]; + function sceneToJSON(scene, indent) { + return JSON.stringify(scene, keys$1, indent); + } + function sceneFromJSON(json2) { + const scene = typeof json2 === "string" ? JSON.parse(json2) : json2; + return initialize$1(scene); + } + function initialize$1(scene) { + var type2 = scene.marktype, items = scene.items, parent, i, n; + if (items) { + for (i = 0, n = items.length; i < n; ++i) { + parent = type2 ? "mark" : "group"; + items[i][parent] = scene; + if (items[i].zindex) items[i][parent].zdirty = true; + if ("group" === (type2 || parent)) initialize$1(items[i]); + } + } + if (type2) boundMark(scene); + return scene; + } + class Scenegraph { + constructor(scene) { + if (arguments.length) { + this.root = sceneFromJSON(scene); + } else { + this.root = createMark({ + marktype: "group", + name: "root", + role: "frame" + }); + this.root.items = [new GroupItem(this.root)]; + } + } + toJSON(indent) { + return sceneToJSON(this.root, indent || 0); + } + mark(markdef, group2, index2) { + group2 = group2 || this.root.items[0]; + const mark = createMark(markdef, group2); + group2.items[index2] = mark; + if (mark.zindex) mark.group.zdirty = true; + return mark; + } + } + function createMark(def2, group2) { + const mark = { + bounds: new Bounds(), + clip: !!def2.clip, + group: group2, + interactive: def2.interactive === false ? false : true, + items: [], + marktype: def2.marktype, + name: def2.name || void 0, + role: def2.role || void 0, + zindex: def2.zindex || 0 + }; + if (def2.aria != null) { + mark.aria = def2.aria; + } + if (def2.description) { + mark.description = def2.description; + } + return mark; + } + function domCreate(doc, tag, ns) { + if (!doc && typeof document !== "undefined" && document.createElement) { + doc = document; + } + return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; + } + function domFind(el, tag) { + tag = tag.toLowerCase(); + var nodes = el.childNodes, i = 0, n = nodes.length; + for (; i < n; ++i) if (nodes[i].tagName.toLowerCase() === tag) { + return nodes[i]; + } + } + function domChild(el, index2, tag, ns) { + var a2 = el.childNodes[index2], b2; + if (!a2 || a2.tagName.toLowerCase() !== tag.toLowerCase()) { + b2 = a2 || null; + a2 = domCreate(el.ownerDocument, tag, ns); + el.insertBefore(a2, b2); + } + return a2; + } + function domClear(el, index2) { + var nodes = el.childNodes, curr = nodes.length; + while (curr > index2) el.removeChild(nodes[--curr]); + return el; + } + function cssClass(mark) { + return "mark-" + mark.marktype + (mark.role ? " role-" + mark.role : "") + (mark.name ? " " + mark.name : ""); + } + function point(event2, el) { + const rect2 = el.getBoundingClientRect(); + return [event2.clientX - rect2.left - (el.clientLeft || 0), event2.clientY - rect2.top - (el.clientTop || 0)]; + } + function resolveItem(item, event2, el, origin) { + var mark = item && item.mark, mdef, p; + if (mark && (mdef = Marks[mark.marktype]).tip) { + p = point(event2, el); + p[0] -= origin[0]; + p[1] -= origin[1]; + while (item = item.mark.group) { + p[0] -= item.x || 0; + p[1] -= item.y || 0; + } + item = mdef.tip(mark.items, p); + } + return item; + } + class Handler { + /** + * Create a new Handler instance. + * @param {object} [customLoader] - Optional loader instance for + * href URL sanitization. If not specified, a standard loader + * instance will be generated. + * @param {function} [customTooltip] - Optional tooltip handler + * function for custom tooltip display. + * @constructor + */ + constructor(customLoader, customTooltip) { + this._active = null; + this._handlers = {}; + this._loader = customLoader || loader(); + this._tooltip = customTooltip || defaultTooltip$1; + } + /** + * Initialize a new Handler instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {object} [obj] - Optional context object that should serve as + * the "this" context for event callbacks. + * @return {Handler} - This handler instance. + */ + initialize(el, origin, obj2) { + this._el = el; + this._obj = obj2 || null; + return this.origin(origin); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the origin coordinates of the visualization. + */ + origin(origin) { + if (arguments.length) { + this._origin = origin || [0, 0]; + return this; + } else { + return this._origin.slice(); + } + } + /** + * Get / set the scenegraph root. + */ + scene(scene) { + if (!arguments.length) return this._scene; + this._scene = scene; + return this; + } + /** + * Add an event handler. Subclasses should override this method. + */ + on() { + } + /** + * Remove an event handler. Subclasses should override this method. + */ + off() { + } + /** + * Utility method for finding the array index of an event handler. + * @param {Array} h - An array of registered event handlers. + * @param {string} type - The event type. + * @param {function} handler - The event handler instance to find. + * @return {number} - The handler's array index or -1 if not registered. + */ + _handlerIndex(h2, type2, handler) { + for (let i = h2 ? h2.length : 0; --i >= 0; ) { + if (h2[i].type === type2 && (!handler || h2[i].handler === handler)) { + return i; + } + } + return -1; + } + /** + * Returns an array with registered event handlers. + * @param {string} [type] - The event type to query. Any annotations + * are ignored; for example, for the argument "click.foo", ".foo" will + * be ignored and the method returns all "click" handlers. If type is + * null or unspecified, this method returns handlers for all types. + * @return {Array} - A new array containing all registered event handlers. + */ + handlers(type2) { + const h2 = this._handlers, a2 = []; + if (type2) { + a2.push(...h2[this.eventName(type2)]); + } else { + for (const k in h2) { + a2.push(...h2[k]); + } + } + return a2; + } + /** + * Parses an event name string to return the specific event type. + * For example, given "click.foo" returns "click" + * @param {string} name - The input event type string. + * @return {string} - A string with the event type only. + */ + eventName(name) { + const i = name.indexOf("."); + return i < 0 ? name : name.slice(0, i); + } + /** + * Handle hyperlink navigation in response to an item.href value. + * @param {Event} event - The event triggering hyperlink navigation. + * @param {Item} item - The scenegraph item. + * @param {string} href - The URL to navigate to. + */ + handleHref(event2, item, href2) { + this._loader.sanitize(href2, { + context: "href" + }).then((opt) => { + const e = new MouseEvent(event2.type, event2), a2 = domCreate(null, "a"); + for (const name in opt) a2.setAttribute(name, opt[name]); + a2.dispatchEvent(e); + }).catch(() => { + }); + } + /** + * Handle tooltip display in response to an item.tooltip value. + * @param {Event} event - The event triggering tooltip display. + * @param {Item} item - The scenegraph item. + * @param {boolean} show - A boolean flag indicating whether + * to show or hide a tooltip for the given item. + */ + handleTooltip(event2, item, show) { + if (item && item.tooltip != null) { + item = resolveItem(item, event2, this.canvas(), this._origin); + const value2 = show && item && item.tooltip || null; + this._tooltip.call(this._obj, this, event2, item, value2); + } + } + /** + * Returns the size of a scenegraph item and its position relative + * to the viewport. + * @param {Item} item - The scenegraph item. + * @return {object} - A bounding box object (compatible with the + * DOMRect type) consisting of x, y, width, heigh, top, left, + * right, and bottom properties. + */ + getItemBoundingClientRect(item) { + const el = this.canvas(); + if (!el) return; + const rect2 = el.getBoundingClientRect(), origin = this._origin, bounds2 = item.bounds, width2 = bounds2.width(), height2 = bounds2.height(); + let x2 = bounds2.x1 + origin[0] + rect2.left, y2 = bounds2.y1 + origin[1] + rect2.top; + while (item.mark && (item = item.mark.group)) { + x2 += item.x || 0; + y2 += item.y || 0; + } + return { + x: x2, + y: y2, + width: width2, + height: height2, + left: x2, + top: y2, + right: x2 + width2, + bottom: y2 + height2 + }; + } + } + function defaultTooltip$1(handler, event2, item, value2) { + handler.element().setAttribute("title", value2 || ""); + } + class Renderer { + /** + * Create a new Renderer instance. + * @param {object} [loader] - Optional loader instance for + * image and href URL sanitization. If not specified, a + * standard loader instance will be generated. + * @constructor + */ + constructor(loader2) { + this._el = null; + this._bgcolor = null; + this._loader = new ResourceLoader(loader2); + } + /** + * Initialize a new Renderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._el = el; + return this.resize(width2, height2, origin, scaleFactor); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length === 0) return this._bgcolor; + this._bgcolor = bgcolor; + return this; + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + this._width = width2; + this._height = height2; + this._origin = origin || [0, 0]; + this._scale = scaleFactor || 1; + return this; + } + /** + * Report a dirty item whose bounds should be redrawn. + * This base class method does nothing. Subclasses that perform + * incremental should implement this method. + * @param {Item} item - The dirty item whose bounds should be redrawn. + */ + dirty() { + } + /** + * Render an input scenegraph, potentially with a set of dirty items. + * This method will perform an immediate rendering with available resources. + * The renderer may also need to perform image loading to perform a complete + * render. This process can lead to asynchronous re-rendering of the scene + * after this method returns. To receive notification when rendering is + * complete, use the renderAsync method instead. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Renderer} - This renderer instance. + */ + render(scene, markTypes) { + const r = this; + r._call = function() { + r._render(scene, markTypes); + }; + r._call(); + r._call = null; + return r; + } + /** + * Internal rendering method. Renderer subclasses should override this + * method to actually perform rendering. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render() { + } + /** + * Asynchronous rendering method. Similar to render, but returns a Promise + * that resolves when all rendering is completed. Sometimes a renderer must + * perform image loading to get a complete rendering. The returned + * Promise will not resolve until this process completes. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Promise} - A Promise that resolves when rendering is complete. + */ + renderAsync(scene, markTypes) { + const r = this.render(scene, markTypes); + return this._ready ? this._ready.then(() => r) : Promise.resolve(r); + } + /** + * Internal method for asynchronous resource loading. + * Proxies method calls to the ImageLoader, and tracks loading + * progress to invoke a re-render once complete. + * @param {string} method - The method name to invoke on the ImageLoader. + * @param {string} uri - The URI for the requested resource. + * @return {Promise} - A Promise that resolves to the requested resource. + */ + _load(method2, uri) { + var r = this, p = r._loader[method2](uri); + if (!r._ready) { + const call = r._call; + r._ready = r._loader.ready().then((redraw) => { + if (redraw) call(); + r._ready = null; + }); + } + return p; + } + /** + * Sanitize a URL to include as a hyperlink in the rendered scene. + * This method proxies a call to ImageLoader.sanitizeURL, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string to sanitize. + * @return {Promise} - A Promise that resolves to the sanitized URL. + */ + sanitizeURL(uri) { + return this._load("sanitizeURL", uri); + } + /** + * Requests an image to include in the rendered scene. + * This method proxies a call to ImageLoader.loadImage, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string of the image. + * @return {Promise} - A Promise that resolves to the loaded Image. + */ + loadImage(uri) { + return this._load("loadImage", uri); + } + } + const KeyDownEvent = "keydown"; + const KeyPressEvent = "keypress"; + const KeyUpEvent = "keyup"; + const DragEnterEvent = "dragenter"; + const DragLeaveEvent = "dragleave"; + const DragOverEvent = "dragover"; + const PointerDownEvent = "pointerdown"; + const PointerUpEvent = "pointerup"; + const PointerMoveEvent = "pointermove"; + const PointerOutEvent = "pointerout"; + const PointerOverEvent = "pointerover"; + const MouseDownEvent = "mousedown"; + const MouseUpEvent = "mouseup"; + const MouseMoveEvent = "mousemove"; + const MouseOutEvent = "mouseout"; + const MouseOverEvent = "mouseover"; + const ClickEvent = "click"; + const DoubleClickEvent = "dblclick"; + const WheelEvent = "wheel"; + const MouseWheelEvent = "mousewheel"; + const TouchStartEvent = "touchstart"; + const TouchMoveEvent = "touchmove"; + const TouchEndEvent = "touchend"; + const Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, PointerDownEvent, PointerUpEvent, PointerMoveEvent, PointerOutEvent, PointerOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent]; + const TooltipShowEvent = PointerMoveEvent; + const TooltipHideEvent = MouseOutEvent; + const HrefEvent = ClickEvent; + class CanvasHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + this._down = null; + this._touch = null; + this._first = true; + this._events = {}; + this.events = Events; + this.pointermove = move([PointerMoveEvent, MouseMoveEvent], [PointerOverEvent, MouseOverEvent], [PointerOutEvent, MouseOutEvent]); + this.dragover = move([DragOverEvent], [DragEnterEvent], [DragLeaveEvent]), this.pointerout = inactive([PointerOutEvent, MouseOutEvent]); + this.dragleave = inactive([DragLeaveEvent]); + } + initialize(el, origin, obj2) { + this._canvas = el && domFind(el, "canvas"); + [ClickEvent, MouseDownEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, DragLeaveEvent].forEach((type2) => eventListenerCheck(this, type2)); + return super.initialize(el, origin, obj2); + } + // return the backing canvas instance + canvas() { + return this._canvas; + } + // retrieve the current canvas context + context() { + return this._canvas.getContext("2d"); + } + // to keep old versions of firefox happy + DOMMouseScroll(evt) { + this.fire(MouseWheelEvent, evt); + } + pointerdown(evt) { + this._down = this._active; + this.fire(PointerDownEvent, evt); + } + mousedown(evt) { + this._down = this._active; + this.fire(MouseDownEvent, evt); + } + click(evt) { + if (this._down === this._active) { + this.fire(ClickEvent, evt); + this._down = null; + } + } + touchstart(evt) { + this._touch = this.pickEvent(evt.changedTouches[0]); + if (this._first) { + this._active = this._touch; + this._first = false; + } + this.fire(TouchStartEvent, evt, true); + } + touchmove(evt) { + this.fire(TouchMoveEvent, evt, true); + } + touchend(evt) { + this.fire(TouchEndEvent, evt, true); + this._touch = null; + } + // fire an event + fire(type2, evt, touch2) { + const a2 = touch2 ? this._touch : this._active, h2 = this._handlers[type2]; + evt.vegaType = type2; + if (type2 === HrefEvent && a2 && a2.href) { + this.handleHref(evt, a2, a2.href); + } else if (type2 === TooltipShowEvent || type2 === TooltipHideEvent) { + this.handleTooltip(evt, a2, type2 !== TooltipHideEvent); + } + if (h2) { + for (let i = 0, len2 = h2.length; i < len2; ++i) { + h2[i].handler.call(this._obj, evt, a2); + } + } + } + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + eventListenerCheck(this, type2); + (h2[name] || (h2[name] = [])).push({ + type: type2, + handler + }); + } + return this; + } + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + h2.splice(i, 1); + } + return this; + } + pickEvent(evt) { + const p = point(evt, this._canvas), o = this._origin; + return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); + } + // find the scenegraph item at the current pointer position + // x, y -- the absolute x, y pointer coordinates on the canvas element + // gx, gy -- the relative coordinates within the current group + pick(scene, x2, y2, gx, gy) { + const g = this.context(), mark = Marks[scene.marktype]; + return mark.pick.call(this, g, scene, x2, y2, gx, gy); + } + } + const eventBundle = (type2) => type2 === TouchStartEvent || type2 === TouchMoveEvent || type2 === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type2]; + function eventListenerCheck(handler, type2) { + eventBundle(type2).forEach((_) => addEventListener(handler, _)); + } + function addEventListener(handler, type2) { + const canvas = handler.canvas(); + if (canvas && !handler._events[type2]) { + handler._events[type2] = 1; + canvas.addEventListener(type2, handler[type2] ? (evt) => handler[type2](evt) : (evt) => handler.fire(type2, evt)); + } + } + function fireAll(handler, types, event2) { + types.forEach((type2) => handler.fire(type2, event2)); + } + function move(moveEvents, overEvents, outEvents) { + return function(evt) { + const a2 = this._active, p = this.pickEvent(evt); + if (p === a2) { + fireAll(this, moveEvents, evt); + } else { + if (!a2 || !a2.exit) { + fireAll(this, outEvents, evt); + } + this._active = p; + fireAll(this, overEvents, evt); + fireAll(this, moveEvents, evt); + } + }; + } + function inactive(types) { + return function(evt) { + fireAll(this, types, evt); + this._active = null; + }; + } + function devicePixelRatio$1() { + return typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1; + } + function resize(canvas, width2, height2, origin, scaleFactor, opt) { + const inDOM = typeof HTMLElement !== "undefined" && canvas instanceof HTMLElement && canvas.parentNode != null, context2 = canvas.getContext("2d"), ratio = inDOM ? devicePixelRatio$1() : scaleFactor; + canvas.width = width2 * ratio; + canvas.height = height2 * ratio; + for (const key2 in opt) { + context2[key2] = opt[key2]; + } + if (inDOM && ratio !== 1) { + canvas.style.width = width2 + "px"; + canvas.style.height = height2 + "px"; + } + context2.pixelRatio = ratio; + context2.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); + return canvas; + } + class CanvasRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._options = {}; + this._redraw = false; + this._dirty = new Bounds(); + this._tempb = new Bounds(); + } + initialize(el, width2, height2, origin, scaleFactor, options) { + this._options = options || {}; + this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); + if (el && this._canvas) { + domClear(el, 0).appendChild(this._canvas); + this._canvas.setAttribute("class", "marks"); + } + return super.initialize(el, width2, height2, origin, scaleFactor); + } + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._canvas) { + resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); + } else { + const ctx = this._options.externalContext; + if (!ctx) error("CanvasRenderer is missing a valid canvas or context"); + ctx.scale(this._scale, this._scale); + ctx.translate(this._origin[0], this._origin[1]); + } + this._redraw = true; + return this; + } + canvas() { + return this._canvas; + } + context() { + return this._options.externalContext || (this._canvas ? this._canvas.getContext("2d") : null); + } + dirty(item) { + const b2 = this._tempb.clear().union(item.bounds); + let g = item.mark.group; + while (g) { + b2.translate(g.x || 0, g.y || 0); + g = g.mark.group; + } + this._dirty.union(b2); + } + _render(scene, markTypes) { + const g = this.context(), o = this._origin, w2 = this._width, h2 = this._height, db = this._dirty, vb = viewBounds(o, w2, h2); + g.save(); + const b2 = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); + this.clear(-o[0], -o[1], w2, h2); + this.draw(g, scene, b2, markTypes); + g.restore(); + db.clear(); + return this; + } + draw(ctx, scene, bounds2, markTypes) { + if (scene.marktype !== "group" && markTypes != null && !markTypes.includes(scene.marktype)) { + return; + } + const mark = Marks[scene.marktype]; + if (scene.clip) clip$2(ctx, scene); + mark.draw.call(this, ctx, scene, bounds2, markTypes); + if (scene.clip) ctx.restore(); + } + clear(x2, y2, w2, h2) { + const opt = this._options, g = this.context(); + if (opt.type !== "pdf" && !opt.externalContext) { + g.clearRect(x2, y2, w2, h2); + } + if (this._bgcolor != null) { + g.fillStyle = this._bgcolor; + g.fillRect(x2, y2, w2, h2); + } + } + } + const viewBounds = (origin, width2, height2) => new Bounds().set(0, 0, width2, height2).translate(-origin[0], -origin[1]); + function clipToBounds(g, b2, origin) { + b2.expand(1).round(); + if (g.pixelRatio % 1) { + b2.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); + } + b2.translate(-(origin[0] % 1), -(origin[1] % 1)); + g.beginPath(); + g.rect(b2.x1, b2.y1, b2.width(), b2.height()); + g.clip(); + return b2; + } + class SVGHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + const h2 = this; + h2._hrefHandler = listener(h2, (evt, item) => { + if (item && item.href) h2.handleHref(evt, item, item.href); + }); + h2._tooltipHandler = listener(h2, (evt, item) => { + h2.handleTooltip(evt, item, evt.type !== TooltipHideEvent); + }); + } + initialize(el, origin, obj2) { + let svg = this._svg; + if (svg) { + svg.removeEventListener(HrefEvent, this._hrefHandler); + svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); + svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); + } + this._svg = svg = el && domFind(el, "svg"); + if (svg) { + svg.addEventListener(HrefEvent, this._hrefHandler); + svg.addEventListener(TooltipShowEvent, this._tooltipHandler); + svg.addEventListener(TooltipHideEvent, this._tooltipHandler); + } + return super.initialize(el, origin, obj2); + } + canvas() { + return this._svg; + } + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + const x2 = { + type: type2, + handler, + listener: listener(this, handler) + }; + (h2[name] || (h2[name] = [])).push(x2); + if (this._svg) { + this._svg.addEventListener(name, x2.listener); + } + } + return this; + } + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + if (this._svg) { + this._svg.removeEventListener(name, h2[i].listener); + } + h2.splice(i, 1); + } + return this; + } + } + const listener = (context2, handler) => (evt) => { + let item = evt.target.__data__; + item = Array.isArray(item) ? item[0] : item; + evt.vegaType = evt.type; + handler.call(context2._obj, evt, item); + }; + const ARIA_HIDDEN = "aria-hidden"; + const ARIA_LABEL = "aria-label"; + const ARIA_ROLE = "role"; + const ARIA_ROLEDESCRIPTION = "aria-roledescription"; + const GRAPHICS_OBJECT = "graphics-object"; + const GRAPHICS_SYMBOL = "graphics-symbol"; + const bundle = (role, roledesc, label2) => ({ + [ARIA_ROLE]: role, + [ARIA_ROLEDESCRIPTION]: roledesc, + [ARIA_LABEL]: label2 || void 0 + }); + const AriaIgnore = toSet(["axis-domain", "axis-grid", "axis-label", "axis-tick", "axis-title", "legend-band", "legend-entry", "legend-gradient", "legend-label", "legend-title", "legend-symbol", "title"]); + const AriaGuides = { + "axis": { + desc: "axis", + caption: axisCaption + }, + "legend": { + desc: "legend", + caption: legendCaption + }, + "title-text": { + desc: "title", + caption: (item) => `Title text '${titleCaption(item)}'` + }, + "title-subtitle": { + desc: "subtitle", + caption: (item) => `Subtitle text '${titleCaption(item)}'` + } + }; + const AriaEncode = { + ariaRole: ARIA_ROLE, + ariaRoleDescription: ARIA_ROLEDESCRIPTION, + description: ARIA_LABEL + }; + function ariaItemAttributes(emit2, item) { + const hide = item.aria === false; + emit2(ARIA_HIDDEN, hide || void 0); + if (hide || item.description == null) { + for (const prop in AriaEncode) { + emit2(AriaEncode[prop], void 0); + } + } else { + const type2 = item.mark.marktype; + emit2(ARIA_LABEL, item.description); + emit2(ARIA_ROLE, item.ariaRole || (type2 === "group" ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); + emit2(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type2} mark`); + } + } + function ariaMarkAttributes(mark) { + return mark.aria === false ? { + [ARIA_HIDDEN]: true + } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); + } + function ariaMark(mark) { + const type2 = mark.marktype; + const recurse2 = type2 === "group" || type2 === "text" || mark.items.some((_) => _.description != null && _.aria !== false); + return bundle(recurse2 ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type2} mark container`, mark.description); + } + function ariaGuide(mark, opt) { + try { + const item = mark.items[0], caption = opt.caption || (() => ""); + return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); + } catch (err) { + return null; + } + } + function titleCaption(item) { + return array$5(item.text).join(" "); + } + function axisCaption(item) { + const datum2 = item.datum, orient = item.orient, title = datum2.title ? extractTitle(item) : null, ctx = item.context, scale2 = ctx.scales[datum2.scale].value, locale2 = ctx.dataflow.locale(), type2 = scale2.type, xy = orient === "left" || orient === "right" ? "Y" : "X"; + return `${xy}-axis` + (title ? ` titled '${title}'` : "") + ` for a ${isDiscrete(type2) ? "discrete" : type2} scale with ${domainCaption(locale2, scale2, item)}`; + } + function legendCaption(item) { + const datum2 = item.datum, title = datum2.title ? extractTitle(item) : null, type2 = `${datum2.type || ""} legend`.trim(), scales2 = datum2.scales, props = Object.keys(scales2), ctx = item.context, scale2 = ctx.scales[scales2[props[0]]].value, locale2 = ctx.dataflow.locale(); + return capitalize(type2) + (title ? ` titled '${title}'` : "") + ` for ${channelCaption(props)} with ${domainCaption(locale2, scale2, item)}`; + } + function extractTitle(item) { + try { + return array$5(peek$1(item.items).items[0].text).join(" "); + } catch (err) { + return null; + } + } + function channelCaption(props) { + props = props.map((p) => p + (p === "fill" || p === "stroke" ? " color" : "")); + return props.length < 2 ? props[0] : props.slice(0, -1).join(", ") + " and " + peek$1(props); + } + function capitalize(s) { + return s.length ? s[0].toUpperCase() + s.slice(1) : s; + } + const innerText = (val) => (val + "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); + const attrText = (val) => innerText(val).replace(/"/g, """).replace(/\t/g, " ").replace(/\n/g, " ").replace(/\r/g, " "); + function markup() { + let buf = "", outer = "", inner = ""; + const stack = [], clear = () => outer = inner = "", push2 = (tag) => { + if (outer) { + buf += `${outer}>${inner}`; + clear(); + } + stack.push(tag); + }, attr2 = (name, value2) => { + if (value2 != null) outer += ` ${name}="${attrText(value2)}"`; + return m2; + }, m2 = { + open(tag, ...attrs) { + push2(tag); + outer = "<" + tag; + for (const set2 of attrs) { + for (const key2 in set2) attr2(key2, set2[key2]); + } + return m2; + }, + close() { + const tag = stack.pop(); + if (outer) { + buf += outer + (inner ? `>${inner}</${tag}>` : "/>"); + } else { + buf += `</${tag}>`; + } + clear(); + return m2; + }, + attr: attr2, + text: (t) => (inner += innerText(t), m2), + toString: () => buf + }; + return m2; + } + const serializeXML = (node) => _serialize(markup(), node) + ""; + function _serialize(m2, node) { + m2.open(node.tagName); + if (node.hasAttributes()) { + const attrs = node.attributes, n = attrs.length; + for (let i = 0; i < n; ++i) { + m2.attr(attrs[i].name, attrs[i].value); + } + } + if (node.hasChildNodes()) { + const children2 = node.childNodes; + for (const child of children2) { + child.nodeType === 3 ? m2.text(child.nodeValue) : _serialize(m2, child); + } + } + return m2.close(); + } + const stylesAttr = { + fill: "fill", + fillOpacity: "fill-opacity", + stroke: "stroke", + strokeOpacity: "stroke-opacity", + strokeWidth: "stroke-width", + strokeCap: "stroke-linecap", + strokeJoin: "stroke-linejoin", + strokeDash: "stroke-dasharray", + strokeDashOffset: "stroke-dashoffset", + strokeMiterLimit: "stroke-miterlimit", + opacity: "opacity" + }; + const stylesCss = { + blend: "mix-blend-mode" + }; + const rootAttributes = { + "fill": "none", + "stroke-miterlimit": 10 + }; + const RootIndex = 0, xmlns = "http://www.w3.org/2000/xmlns/", svgns = metadata.xmlns; + class SVGRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._dirtyID = 0; + this._dirty = []; + this._svg = null; + this._root = null; + this._defs = null; + } + /** + * Initialize a new SVGRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._defs = {}; + this._clearDefs(); + if (el) { + this._svg = domChild(el, 0, "svg", svgns); + this._svg.setAttributeNS(xmlns, "xmlns", svgns); + this._svg.setAttributeNS(xmlns, "xmlns:xlink", metadata["xmlns:xlink"]); + this._svg.setAttribute("version", metadata["version"]); + this._svg.setAttribute("class", "marks"); + domClear(el, 1); + this._root = domChild(this._svg, RootIndex, "g", svgns); + setAttributes(this._root, rootAttributes); + domClear(this._svg, RootIndex + 1); + } + this.background(this._bgcolor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length && this._svg) { + this._svg.style.setProperty("background-color", bgcolor); + } + return super.background(...arguments); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._svg) { + setAttributes(this._svg, { + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` + }); + this._root.setAttribute("transform", `translate(${this._origin})`); + } + this._dirty = []; + return this; + } + /** + * Returns the SVG element of the visualization. + * @return {DOMElement} - The SVG element. + */ + canvas() { + return this._svg; + } + /** + * Returns an SVG text string for the rendered content, + * or null if this renderer is currently headless. + */ + svg() { + const svg = this._svg, bg = this._bgcolor; + if (!svg) return null; + let node; + if (bg) { + svg.removeAttribute("style"); + node = domChild(svg, RootIndex, "rect", svgns); + setAttributes(node, { + width: this._width, + height: this._height, + fill: bg + }); + } + const text2 = serializeXML(svg); + if (bg) { + svg.removeChild(node); + this._svg.style.setProperty("background-color", bg); + } + return text2; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + if (this._dirtyCheck()) { + if (this._dirtyAll) this._clearDefs(); + this.mark(this._root, scene, void 0, markTypes); + domClear(this._root, 1); + } + this.defs(); + this._dirty = []; + ++this._dirtyID; + return this; + } + // -- Manage rendering of items marked as dirty -- + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (item.dirty !== this._dirtyID) { + item.dirty = this._dirtyID; + this._dirty.push(item); + } + } + /** + * Check if a mark item is considered dirty. + * @param {Item} item - The mark item. + */ + isDirty(item) { + return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; + } + /** + * Internal method to check dirty status and, if possible, + * make targetted updates without a full rendering pass. + */ + _dirtyCheck() { + this._dirtyAll = true; + const items = this._dirty; + if (!items.length || !this._dirtyID) return true; + const id2 = ++this._dirtyID; + let item, mark, type2, mdef, i, n, o; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + mark = item.mark; + if (mark.marktype !== type2) { + type2 = mark.marktype; + mdef = Marks[type2]; + } + if (mark.zdirty && mark.dirty !== id2) { + this._dirtyAll = false; + dirtyParents(item, id2); + mark.items.forEach((i2) => { + i2.dirty = id2; + }); + } + if (mark.zdirty) continue; + if (item.exit) { + if (mdef.nested && mark.items.length) { + o = mark.items[0]; + if (o._svg) this._update(mdef, o._svg, o); + } else if (item._svg) { + o = item._svg.parentNode; + if (o) o.removeChild(item._svg); + } + item._svg = null; + continue; + } + item = mdef.nested ? mark.items[0] : item; + if (item._update === id2) continue; + if (!item._svg || !item._svg.ownerSVGElement) { + this._dirtyAll = false; + dirtyParents(item, id2); + } else { + this._update(mdef, item._svg, item); + } + item._update = id2; + } + return !this._dirtyAll; + } + // -- Construct & maintain scenegraph to SVG mapping --- + /** + * Render a set of mark items. + * @param {SVGElement} el - The parent element in the SVG tree. + * @param {object} scene - The mark parent to render. + * @param {SVGElement} prev - The previous sibling in the SVG tree. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + mark(el, scene, prev, markTypes) { + if (!this.isDirty(scene)) { + return scene._svg; + } + const svg = this._svg, markType2 = scene.marktype, mdef = Marks[markType2], events2 = scene.interactive === false ? "none" : null, isGroup = mdef.tag === "g"; + const parent = bind$1(scene, el, prev, "g", svg); + if (markType2 !== "group" && markTypes != null && !markTypes.includes(markType2)) { + domClear(parent, 0); + return scene._svg; + } + parent.setAttribute("class", cssClass(scene)); + const aria = ariaMarkAttributes(scene); + for (const key2 in aria) setAttribute$1(parent, key2, aria[key2]); + if (!isGroup) { + setAttribute$1(parent, "pointer-events", events2); + } + setAttribute$1(parent, "clip-path", scene.clip ? clip$1$1(this, scene, scene.group) : null); + let sibling = null, i = 0; + const process = (item) => { + const dirty = this.isDirty(item), node = bind$1(item, parent, sibling, mdef.tag, svg); + if (dirty) { + this._update(mdef, node, item); + if (isGroup) recurse(this, node, item, markTypes); + } + sibling = node; + ++i; + }; + if (mdef.nested) { + if (scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + domClear(parent, i); + return parent; + } + /** + * Update the attributes of an SVG element for a mark item. + * @param {object} mdef - The mark definition object + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + _update(mdef, el, item) { + element$1 = el; + values = el.__values__; + ariaItemAttributes(emit, item); + mdef.attr(emit, item, this); + const extra = mark_extras[mdef.type]; + if (extra) extra.call(this, mdef, el, item); + if (element$1) this.style(element$1, item); + } + /** + * Update the presentation attributes of an SVG element for a mark item. + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + style(el, item) { + if (item == null) return; + for (const prop in stylesAttr) { + let value2 = prop === "font" ? fontFamily(item) : item[prop]; + if (value2 === values[prop]) continue; + const name = stylesAttr[prop]; + if (value2 == null) { + el.removeAttribute(name); + } else { + if (isGradient(value2)) { + value2 = gradientRef(value2, this._defs.gradient, href()); + } + el.setAttribute(name, value2 + ""); + } + values[prop] = value2; + } + for (const prop in stylesCss) { + setStyle(el, stylesCss[prop], item[prop]); + } + } + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + */ + defs() { + const svg = this._svg, defs = this._defs; + let el = defs.el, index2 = 0; + for (const id2 in defs.gradient) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateGradient(el, defs.gradient[id2], index2); + } + for (const id2 in defs.clipping) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateClipping(el, defs.clipping[id2], index2); + } + if (el) { + index2 === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index2); + } + } + /** + * Clear defs caches. + */ + _clearDefs() { + const def2 = this._defs; + def2.gradient = {}; + def2.clipping = {}; + } + } + function dirtyParents(item, id2) { + for (; item && item.dirty !== id2; item = item.mark.group) { + item.dirty = id2; + if (item.mark && item.mark.dirty !== id2) { + item.mark.dirty = id2; + } else return; + } + } + function updateGradient(el, grad, index2) { + let i, n, stop2; + if (grad.gradient === "radial") { + let pt = domChild(el, index2++, "pattern", svgns); + setAttributes(pt, { + id: patternPrefix + grad.id, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + pt = domChild(pt, 0, "rect", svgns); + setAttributes(pt, { + width: 1, + height: 1, + fill: `url(${href()}#${grad.id})` + }); + el = domChild(el, index2++, "radialGradient", svgns); + setAttributes(el, { + id: grad.id, + fx: grad.x1, + fy: grad.y1, + fr: grad.r1, + cx: grad.x2, + cy: grad.y2, + r: grad.r2 + }); + } else { + el = domChild(el, index2++, "linearGradient", svgns); + setAttributes(el, { + id: grad.id, + x1: grad.x1, + x2: grad.x2, + y1: grad.y1, + y2: grad.y2 + }); + } + for (i = 0, n = grad.stops.length; i < n; ++i) { + stop2 = domChild(el, i, "stop", svgns); + stop2.setAttribute("offset", grad.stops[i].offset); + stop2.setAttribute("stop-color", grad.stops[i].color); + } + domClear(el, i); + return index2; + } + function updateClipping(el, clip2, index2) { + let mask; + el = domChild(el, index2, "clipPath", svgns); + el.setAttribute("id", clip2.id); + if (clip2.path) { + mask = domChild(el, 0, "path", svgns); + mask.setAttribute("d", clip2.path); + } else { + mask = domChild(el, 0, "rect", svgns); + setAttributes(mask, { + x: 0, + y: 0, + width: clip2.width, + height: clip2.height + }); + } + domClear(el, 1); + return index2 + 1; + } + function recurse(renderer, el, group2, markTypes) { + el = el.lastChild.previousSibling; + let prev, idx = 0; + visit(group2, (item) => { + prev = renderer.mark(el, item, prev, markTypes); + ++idx; + }); + domClear(el, 1 + idx); + } + function bind$1(item, el, sibling, tag, svg) { + let node = item._svg, doc; + if (!node) { + doc = el.ownerDocument; + node = domCreate(doc, tag, svgns); + item._svg = node; + if (item.mark) { + node.__data__ = item; + node.__values__ = { + fill: "default" + }; + if (tag === "g") { + const bg = domCreate(doc, "path", svgns); + node.appendChild(bg); + bg.__data__ = item; + const cg = domCreate(doc, "g", svgns); + node.appendChild(cg); + cg.__data__ = item; + const fg = domCreate(doc, "path", svgns); + node.appendChild(fg); + fg.__data__ = item; + fg.__values__ = { + fill: "default" + }; + } + } + } + if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { + el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); + } + return node; + } + function siblingCheck(node, sibling) { + return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; + } + let element$1 = null, values = null; + const mark_extras = { + group(mdef, el, item) { + const fg = element$1 = el.childNodes[2]; + values = fg.__values__; + mdef.foreground(emit, item, this); + values = el.__values__; + element$1 = el.childNodes[1]; + mdef.content(emit, item, this); + const bg = element$1 = el.childNodes[0]; + mdef.background(emit, item, this); + const value2 = item.mark.interactive === false ? "none" : null; + if (value2 !== values.events) { + setAttribute$1(fg, "pointer-events", value2); + setAttribute$1(bg, "pointer-events", value2); + values.events = value2; + } + if (item.strokeForeground && item.stroke) { + const fill2 = item.fill; + setAttribute$1(fg, "display", null); + this.style(bg, item); + setAttribute$1(bg, "stroke", null); + if (fill2) item.fill = null; + values = fg.__values__; + this.style(fg, item); + if (fill2) item.fill = fill2; + element$1 = null; + } else { + setAttribute$1(fg, "display", "none"); + } + }, + image(mdef, el, item) { + if (item.smooth === false) { + setStyle(el, "image-rendering", "optimizeSpeed"); + setStyle(el, "image-rendering", "pixelated"); + } else { + setStyle(el, "image-rendering", null); + } + }, + text(mdef, el, item) { + const tl2 = textLines(item); + let key2, value2, doc, lh; + if (isArray(tl2)) { + value2 = tl2.map((_) => textValue(item, _)); + key2 = value2.join("\n"); + if (key2 !== values.text) { + domClear(el, 0); + doc = el.ownerDocument; + lh = lineHeight(item); + value2.forEach((t, i) => { + const ts2 = domCreate(doc, "tspan", svgns); + ts2.__data__ = item; + ts2.textContent = t; + if (i) { + ts2.setAttribute("x", 0); + ts2.setAttribute("dy", lh); + } + el.appendChild(ts2); + }); + values.text = key2; + } + } else { + value2 = textValue(item, tl2); + if (value2 !== values.text) { + el.textContent = value2; + values.text = value2; + } + } + setAttribute$1(el, "font-family", fontFamily(item)); + setAttribute$1(el, "font-size", fontSize(item) + "px"); + setAttribute$1(el, "font-style", item.fontStyle); + setAttribute$1(el, "font-variant", item.fontVariant); + setAttribute$1(el, "font-weight", item.fontWeight); + } + }; + function emit(name, value2, ns) { + if (value2 === values[name]) return; + if (ns) { + setAttributeNS(element$1, name, value2, ns); + } else { + setAttribute$1(element$1, name, value2); + } + values[name] = value2; + } + function setStyle(el, name, value2) { + if (value2 !== values[name]) { + if (value2 == null) { + el.style.removeProperty(name); + } else { + el.style.setProperty(name, value2 + ""); + } + values[name] = value2; + } + } + function setAttributes(el, attrs) { + for (const key2 in attrs) { + setAttribute$1(el, key2, attrs[key2]); + } + } + function setAttribute$1(el, name, value2) { + if (value2 != null) { + el.setAttribute(name, value2); + } else { + el.removeAttribute(name); + } + } + function setAttributeNS(el, name, value2, ns) { + if (value2 != null) { + el.setAttributeNS(ns, name, value2); + } else { + el.removeAttributeNS(ns, name); + } + } + function href() { + let loc; + return typeof window === "undefined" ? "" : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; + } + class SVGStringRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._text = null; + this._defs = { + gradient: {}, + clipping: {} + }; + } + /** + * Returns the rendered SVG text string, + * or null if rendering has not yet occurred. + */ + svg() { + return this._text; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + */ + _render(scene) { + const m2 = markup(); + m2.open("svg", extend$1({}, metadata, { + class: "marks", + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` + })); + const bg = this._bgcolor; + if (bg && bg !== "transparent" && bg !== "none") { + m2.open("rect", { + width: this._width, + height: this._height, + fill: bg + }).close(); + } + m2.open("g", rootAttributes, { + transform: "translate(" + this._origin + ")" + }); + this.mark(m2, scene); + m2.close(); + this.defs(m2); + this._text = m2.close() + ""; + return this; + } + /** + * Render a set of mark items. + * @param {object} m - The markup context. + * @param {object} scene - The mark parent to render. + */ + mark(m2, scene) { + const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ariaItemAttributes, mdef.attr]; + m2.open("g", { + "class": cssClass(scene), + "clip-path": scene.clip ? clip$1$1(this, scene, scene.group) : null + }, ariaMarkAttributes(scene), { + "pointer-events": tag !== "g" && scene.interactive === false ? "none" : null + }); + const process = (item) => { + const href2 = this.href(item); + if (href2) m2.open("a", href2); + m2.open(tag, this.attr(scene, item, attrList, tag !== "g" ? tag : null)); + if (tag === "text") { + const tl2 = textLines(item); + if (isArray(tl2)) { + const attrs = { + x: 0, + dy: lineHeight(item) + }; + for (let i = 0; i < tl2.length; ++i) { + m2.open("tspan", i ? attrs : null).text(textValue(item, tl2[i])).close(); + } + } else { + m2.text(textValue(item, tl2)); + } + } else if (tag === "g") { + const fore = item.strokeForeground, fill2 = item.fill, stroke2 = item.stroke; + if (fore && stroke2) { + item.stroke = null; + } + m2.open("path", this.attr(scene, item, mdef.background, "bgrect")).close(); + m2.open("g", this.attr(scene, item, mdef.content)); + visit(item, (scene2) => this.mark(m2, scene2)); + m2.close(); + if (fore && stroke2) { + if (fill2) item.fill = null; + item.stroke = stroke2; + m2.open("path", this.attr(scene, item, mdef.foreground, "bgrect")).close(); + if (fill2) item.fill = fill2; + } else { + m2.open("path", this.attr(scene, item, mdef.foreground, "bgfore")).close(); + } + } + m2.close(); + if (href2) m2.close(); + }; + if (mdef.nested) { + if (scene.items && scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + return m2.close(); + } + /** + * Get href attributes for a hyperlinked mark item. + * @param {Item} item - The mark item. + */ + href(item) { + const href2 = item.href; + let attr2; + if (href2) { + if (attr2 = this._hrefs && this._hrefs[href2]) { + return attr2; + } else { + this.sanitizeURL(href2).then((attr3) => { + attr3["xlink:href"] = attr3.href; + attr3.href = null; + (this._hrefs || (this._hrefs = {}))[href2] = attr3; + }); + } + } + return null; + } + /** + * Get an object of SVG attributes for a mark item. + * @param {object} scene - The mark parent. + * @param {Item} item - The mark item. + * @param {array|function} attrs - One or more attribute emitters. + * @param {string} tag - The tag being rendered. + */ + attr(scene, item, attrs, tag) { + const object2 = {}, emit2 = (name, value2, ns, prefixed) => { + object2[prefixed || name] = value2; + }; + if (Array.isArray(attrs)) { + attrs.forEach((fn2) => fn2(emit2, item, this)); + } else { + attrs(emit2, item, this); + } + if (tag) { + style(object2, item, scene, tag, this._defs); + } + return object2; + } + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + * @param {object} m - The markup context. + */ + defs(m2) { + const gradient2 = this._defs.gradient, clipping = this._defs.clipping, count2 = Object.keys(gradient2).length + Object.keys(clipping).length; + if (count2 === 0) return; + m2.open("defs"); + for (const id2 in gradient2) { + const def2 = gradient2[id2], stops = def2.stops; + if (def2.gradient === "radial") { + m2.open("pattern", { + id: patternPrefix + id2, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + m2.open("rect", { + width: "1", + height: "1", + fill: "url(#" + id2 + ")" + }).close(); + m2.close(); + m2.open("radialGradient", { + id: id2, + fx: def2.x1, + fy: def2.y1, + fr: def2.r1, + cx: def2.x2, + cy: def2.y2, + r: def2.r2 + }); + } else { + m2.open("linearGradient", { + id: id2, + x1: def2.x1, + x2: def2.x2, + y1: def2.y1, + y2: def2.y2 + }); + } + for (let i = 0; i < stops.length; ++i) { + m2.open("stop", { + offset: stops[i].offset, + "stop-color": stops[i].color + }).close(); + } + m2.close(); + } + for (const id2 in clipping) { + const def2 = clipping[id2]; + m2.open("clipPath", { + id: id2 + }); + if (def2.path) { + m2.open("path", { + d: def2.path + }).close(); + } else { + m2.open("rect", { + x: 0, + y: 0, + width: def2.width, + height: def2.height + }).close(); + } + m2.close(); + } + m2.close(); + } + } + function style(s, item, scene, tag, defs) { + let styleList; + if (item == null) return s; + if (tag === "bgrect" && scene.interactive === false) { + s["pointer-events"] = "none"; + } + if (tag === "bgfore") { + if (scene.interactive === false) { + s["pointer-events"] = "none"; + } + s.display = "none"; + if (item.fill !== null) return s; + } + if (tag === "image" && item.smooth === false) { + styleList = ["image-rendering: optimizeSpeed;", "image-rendering: pixelated;"]; + } + if (tag === "text") { + s["font-family"] = fontFamily(item); + s["font-size"] = fontSize(item) + "px"; + s["font-style"] = item.fontStyle; + s["font-variant"] = item.fontVariant; + s["font-weight"] = item.fontWeight; + } + for (const prop in stylesAttr) { + let value2 = item[prop]; + const name = stylesAttr[prop]; + if (value2 === "transparent" && (name === "fill" || name === "stroke")) ; + else if (value2 != null) { + if (isGradient(value2)) { + value2 = gradientRef(value2, defs.gradient, ""); + } + s[name] = value2; + } + } + for (const prop in stylesCss) { + const value2 = item[prop]; + if (value2 != null) { + styleList = styleList || []; + styleList.push(`${stylesCss[prop]}: ${value2};`); + } + } + if (styleList) { + s.style = styleList.join(" "); + } + return s; + } + const OPTS = { + svgMarkTypes: ["text"], + svgOnTop: true, + debug: false + }; + function setHybridRendererOptions(options) { + OPTS["svgMarkTypes"] = options.svgMarkTypes ?? ["text"]; + OPTS["svgOnTop"] = options.svgOnTop ?? true; + OPTS["debug"] = options.debug ?? false; + } + class HybridRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._svgRenderer = new SVGRenderer(loader2); + this._canvasRenderer = new CanvasRenderer(loader2); + } + /** + * Initialize a new HybridRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {HybridRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._root_el = domChild(el, 0, "div"); + const bottomEl = domChild(this._root_el, 0, "div"); + const topEl = domChild(this._root_el, 1, "div"); + this._root_el.style.position = "relative"; + if (!OPTS.debug) { + bottomEl.style.height = "100%"; + topEl.style.position = "absolute"; + topEl.style.top = "0"; + topEl.style.left = "0"; + topEl.style.height = "100%"; + topEl.style.width = "100%"; + } + this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; + this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; + this._svgEl.style.pointerEvents = "none"; + this._canvasRenderer.initialize(this._canvasEl, width2, height2, origin, scaleFactor); + this._svgRenderer.initialize(this._svgEl, width2, height2, origin, scaleFactor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (OPTS.svgMarkTypes.includes(item.mark.marktype)) { + this._svgRenderer.dirty(item); + } else { + this._canvasRenderer.dirty(item); + } + return this; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + const allMarkTypes = markTypes ?? ["arc", "area", "image", "line", "path", "rect", "rule", "shape", "symbol", "text", "trail"]; + const canvasMarkTypes = allMarkTypes.filter((m2) => !OPTS.svgMarkTypes.includes(m2)); + this._svgRenderer.render(scene, OPTS.svgMarkTypes); + this._canvasRenderer.render(scene, canvasMarkTypes); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + this._svgRenderer.resize(width2, height2, origin, scaleFactor); + this._canvasRenderer.resize(width2, height2, origin, scaleFactor); + return this; + } + background(bgcolor) { + if (OPTS.svgOnTop) { + this._canvasRenderer.background(bgcolor); + } else { + this._svgRenderer.background(bgcolor); + } + return this; + } + } + class HybridHandler extends CanvasHandler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + } + initialize(el, origin, obj2) { + const canvas = domChild(domChild(el, 0, "div"), OPTS.svgOnTop ? 0 : 1, "div"); + return super.initialize(canvas, origin, obj2); + } + } + const Canvas = "canvas"; + const Hybrid = "hybrid"; + const PNG = "png"; + const SVG = "svg"; + const None$1 = "none"; + const RenderType = { + Canvas, + PNG, + SVG, + Hybrid, + None: None$1 + }; + const modules = {}; + modules[Canvas] = modules[PNG] = { + renderer: CanvasRenderer, + headless: CanvasRenderer, + handler: CanvasHandler + }; + modules[SVG] = { + renderer: SVGRenderer, + headless: SVGStringRenderer, + handler: SVGHandler + }; + modules[Hybrid] = { + renderer: HybridRenderer, + headless: HybridRenderer, + handler: HybridHandler + }; + modules[None$1] = {}; + function renderModule(name, _) { + name = String(name || "").toLowerCase(); + if (arguments.length > 1) { + modules[name] = _; + return this; + } else { + return modules[name]; + } + } + function intersect$2(scene, bounds2, filter2) { + const hits = [], box2 = new Bounds().union(bounds2), type2 = scene.marktype; + return type2 ? intersectMark(scene, box2, filter2, hits) : type2 === "group" ? intersectGroup(scene, box2, filter2, hits) : error("Intersect scene must be mark node or group item."); + } + function intersectMark(mark, box2, filter2, hits) { + if (visitMark(mark, box2, filter2)) { + const items = mark.items, type2 = mark.marktype, n = items.length; + let i = 0; + if (type2 === "group") { + for (; i < n; ++i) { + intersectGroup(items[i], box2, filter2, hits); + } + } else { + for (const test2 = Marks[type2].isect; i < n; ++i) { + const item = items[i]; + if (intersectItem(item, box2, test2)) hits.push(item); + } + } + } + return hits; + } + function visitMark(mark, box2, filter2) { + return mark.bounds && box2.intersects(mark.bounds) && (mark.marktype === "group" || mark.interactive !== false && (!filter2 || filter2(mark))); + } + function intersectGroup(group2, box2, filter2, hits) { + if (filter2 && filter2(group2.mark) && intersectItem(group2, box2, Marks.group.isect)) { + hits.push(group2); + } + const marks = group2.items, n = marks && marks.length; + if (n) { + const x2 = group2.x || 0, y2 = group2.y || 0; + box2.translate(-x2, -y2); + for (let i = 0; i < n; ++i) { + intersectMark(marks[i], box2, filter2, hits); + } + box2.translate(x2, y2); + } + return hits; + } + function intersectItem(item, box2, test2) { + const bounds2 = item.bounds; + return box2.encloses(bounds2) || box2.intersects(bounds2) && test2(item, box2); + } + const clipBounds = new Bounds(); + function boundClip(mark) { + const clip2 = mark.clip; + if (isFunction(clip2)) { + clip2(boundContext(clipBounds.clear())); + } else if (clip2) { + clipBounds.set(0, 0, mark.group.width, mark.group.height); + } else return; + mark.bounds.intersect(clipBounds); + } + const TOLERANCE = 1e-9; + function sceneEqual(a2, b2, key2) { + return a2 === b2 ? true : key2 === "path" ? pathEqual(a2, b2) : a2 instanceof Date && b2 instanceof Date ? +a2 === +b2 : isNumber$1(a2) && isNumber$1(b2) ? Math.abs(a2 - b2) <= TOLERANCE : !a2 || !b2 || !isObject$1(a2) && !isObject$1(b2) ? a2 == b2 : objectEqual(a2, b2); + } + function pathEqual(a2, b2) { + return sceneEqual(parse$3(a2), parse$3(b2)); + } + function objectEqual(a2, b2) { + var ka = Object.keys(a2), kb = Object.keys(b2), key2, i; + if (ka.length !== kb.length) return false; + ka.sort(); + kb.sort(); + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) return false; + } + for (i = ka.length - 1; i >= 0; i--) { + key2 = ka[i]; + if (!sceneEqual(a2[key2], b2[key2], key2)) return false; + } + return typeof a2 === typeof b2; + } + function resetSVGDefIds() { + resetSVGClipId(); + resetSVGGradientId(); + } + const Top$1 = "top"; + const Left$1 = "left"; + const Right$1 = "right"; + const Bottom$1 = "bottom"; + const TopLeft = "top-left"; + const TopRight = "top-right"; + const BottomLeft = "bottom-left"; + const BottomRight = "bottom-right"; + const Start$1 = "start"; + const Middle$1 = "middle"; + const End$1 = "end"; + const X = "x"; + const Y = "y"; + const Group = "group"; + const AxisRole$1 = "axis"; + const TitleRole$1 = "title"; + const FrameRole$1 = "frame"; + const ScopeRole$1 = "scope"; + const LegendRole$1 = "legend"; + const RowHeader = "row-header"; + const RowFooter = "row-footer"; + const RowTitle = "row-title"; + const ColHeader = "column-header"; + const ColFooter = "column-footer"; + const ColTitle = "column-title"; + const Padding$1 = "padding"; + const Symbols$1 = "symbol"; + const Fit = "fit"; + const FitX = "fit-x"; + const FitY = "fit-y"; + const Pad = "pad"; + const None = "none"; + const All = "all"; + const Each = "each"; + const Flush = "flush"; + const Column = "column"; + const Row = "row"; + function Bound$1(params2) { + Transform.call(this, null, params2); + } + inherits(Bound$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow, mark = _.mark, type2 = mark.marktype, entry2 = Marks[type2], bound2 = entry2.bound; + let markBounds = mark.bounds, rebound; + if (entry2.nested) { + if (mark.items.length) view.dirty(mark.items[0]); + markBounds = boundItem(mark, bound2); + mark.items.forEach((item) => { + item.bounds.clear().union(markBounds); + }); + } else if (type2 === Group || _.modified()) { + pulse2.visit(pulse2.MOD, (item) => view.dirty(item)); + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(boundItem(item, bound2))); + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + pulse2.reflow(); + } + } else { + rebound = pulse2.changed(pulse2.REM); + pulse2.visit(pulse2.ADD, (item) => { + markBounds.union(boundItem(item, bound2)); + }); + pulse2.visit(pulse2.MOD, (item) => { + rebound = rebound || markBounds.alignsWith(item.bounds); + view.dirty(item); + markBounds.union(boundItem(item, bound2)); + }); + if (rebound) { + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(item.bounds)); + } + } + boundClip(mark); + return pulse2.modifies("bounds"); + } + }); + function boundItem(item, bound2, opt) { + return bound2(item.bounds.clear(), item, opt); + } + const COUNTER_NAME = ":vega_identifier:"; + function Identifier$1(params2) { + Transform.call(this, 0, params2); + } + Identifier$1.Definition = { + "type": "Identifier", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "as", + "type": "string", + "required": true + }] + }; + inherits(Identifier$1, Transform, { + transform(_, pulse2) { + const counter = getCounter(pulse2.dataflow), as = _.as; + let id2 = counter.value; + pulse2.visit(pulse2.ADD, (t) => t[as] = t[as] || ++id2); + counter.set(this.value = id2); + return pulse2; + } + }); + function getCounter(view) { + return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); + } + function Mark$1(params2) { + Transform.call(this, null, params2); + } + inherits(Mark$1, Transform, { + transform(_, pulse2) { + let mark = this.value; + if (!mark) { + mark = pulse2.dataflow.scenegraph().mark(_.markdef, lookup$1$1(_), _.index); + mark.group.context = _.context; + if (!_.context.group) _.context.group = mark.group; + mark.source = this.source; + mark.clip = _.clip; + mark.interactive = _.interactive; + this.value = mark; + } + const Init = mark.marktype === Group ? GroupItem : Item; + pulse2.visit(pulse2.ADD, (item) => Init.call(item, mark)); + if (_.modified("clip") || _.modified("interactive")) { + mark.clip = _.clip; + mark.interactive = !!_.interactive; + mark.zdirty = true; + pulse2.reflow(); + } + mark.items = pulse2.source; + return pulse2; + } + }); + function lookup$1$1(_) { + const g = _.groups, p = _.parent; + return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; + } + function Overlap$1(params2) { + Transform.call(this, null, params2); + } + const methods = { + parity: (items) => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1), + greedy: (items, sep) => { + let a2; + return items.filter((b2, i) => !i || !intersect$1(a2.bounds, b2.bounds, sep) ? (a2 = b2, 1) : b2.opacity = 0); + } + }; + const intersect$1 = (a2, b2, sep) => sep > Math.max(b2.x1 - a2.x2, a2.x1 - b2.x2, b2.y1 - a2.y2, a2.y1 - b2.y2); + const hasOverlap = (items, pad2) => { + for (var i = 1, n = items.length, a2 = items[0].bounds, b2; i < n; a2 = b2, ++i) { + if (intersect$1(a2, b2 = items[i].bounds, pad2)) return true; + } + }; + const hasBounds = (item) => { + const b2 = item.bounds; + return b2.width() > 1 && b2.height() > 1; + }; + const boundTest = (scale2, orient, tolerance) => { + var range2 = scale2.range(), b2 = new Bounds(); + if (orient === Top$1 || orient === Bottom$1) { + b2.set(range2[0], -Infinity, range2[1], Infinity); + } else { + b2.set(-Infinity, range2[0], Infinity, range2[1]); + } + b2.expand(tolerance || 1); + return (item) => b2.encloses(item.bounds); + }; + const reset = (source2) => { + source2.forEach((item) => item.opacity = 1); + return source2; + }; + const reflow = (pulse2, _) => pulse2.reflow(_.modified()).modifies("opacity"); + inherits(Overlap$1, Transform, { + transform(_, pulse2) { + const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; + let source2 = pulse2.materialize(pulse2.SOURCE).source, items, test2; + if (!source2 || !source2.length) return; + if (!_.method) { + if (_.modified("method")) { + reset(source2); + pulse2 = reflow(pulse2, _); + } + return pulse2; + } + source2 = source2.filter(hasBounds); + if (!source2.length) return; + if (_.sort) { + source2 = source2.slice().sort(_.sort); + } + items = reset(source2); + pulse2 = reflow(pulse2, _); + if (items.length >= 3 && hasOverlap(items, sep)) { + do { + items = reduce(items, sep); + } while (items.length >= 3 && hasOverlap(items, sep)); + if (items.length < 3 && !peek$1(source2).opacity) { + if (items.length > 1) peek$1(items).opacity = 0; + peek$1(source2).opacity = 1; + } + } + if (_.boundScale && _.boundTolerance >= 0) { + test2 = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); + source2.forEach((item) => { + if (!test2(item)) item.opacity = 0; + }); + } + const bounds2 = items[0].mark.bounds.clear(); + source2.forEach((item) => { + if (item.opacity) bounds2.union(item.bounds); + }); + return pulse2; + } + }); + function Render$1(params2) { + Transform.call(this, null, params2); + } + inherits(Render$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + pulse2.visit(pulse2.ALL, (item) => view.dirty(item)); + if (pulse2.fields && pulse2.fields["zindex"]) { + const item = pulse2.source && pulse2.source[0]; + if (item) item.mark.zdirty = true; + } + } + }); + const tempBounds = new Bounds(); + function set$6(item, property2, value2) { + return item[property2] === value2 ? 0 : (item[property2] = value2, 1); + } + function isYAxis(mark) { + var orient = mark.items[0].orient; + return orient === Left$1 || orient === Right$1; + } + function axisIndices(datum2) { + let index2 = +datum2.grid; + return [ + datum2.ticks ? index2++ : -1, + // ticks index + datum2.labels ? index2++ : -1, + // labels index + index2 + +datum2.domain + // title index + ]; + } + function axisLayout(view, axis, width2, height2) { + var item = axis.items[0], datum2 = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum2), range2 = item.range, offset2 = item.offset, position2 = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum2.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds2 = item.bounds, dl = title && multiLineOffset(title), x2 = 0, y2 = 0, i, s; + tempBounds.clear().union(bounds2); + bounds2.clear(); + if ((i = indices[0]) > -1) bounds2.union(item.items[i].bounds); + if ((i = indices[1]) > -1) bounds2.union(item.items[i].bounds); + switch (orient) { + case Top$1: + x2 = position2 || 0; + y2 = -offset2; + s = Math.max(minExtent, Math.min(maxExtent, -bounds2.y1)); + bounds2.add(0, -s).add(range2, 0); + if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds2); + break; + case Left$1: + x2 = -offset2; + y2 = position2 || 0; + s = Math.max(minExtent, Math.min(maxExtent, -bounds2.x1)); + bounds2.add(-s, 0).add(0, range2); + if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds2); + break; + case Right$1: + x2 = width2 + offset2; + y2 = position2 || 0; + s = Math.max(minExtent, Math.min(maxExtent, bounds2.x2)); + bounds2.add(0, 0).add(s, range2); + if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds2); + break; + case Bottom$1: + x2 = position2 || 0; + y2 = height2 + offset2; + s = Math.max(minExtent, Math.min(maxExtent, bounds2.y2)); + bounds2.add(0, 0).add(range2, s); + if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds2); + break; + default: + x2 = item.x; + y2 = item.y; + } + boundStroke(bounds2.translate(x2, y2), item); + if (set$6(item, "x", x2 + delta) | set$6(item, "y", y2 + delta)) { + item.bounds = tempBounds; + view.dirty(item); + item.bounds = bounds2; + view.dirty(item); + } + return item.mark.bounds.clear().union(bounds2); + } + function axisTitleLayout(view, title, offset2, pad2, dl, isYAxis2, sign2, bounds2) { + const b2 = title.bounds; + if (title.auto) { + const v = sign2 * (offset2 + dl + pad2); + let dx = 0, dy = 0; + view.dirty(title); + isYAxis2 ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); + title.mark.bounds.clear().union(b2.translate(-dx, -dy)); + view.dirty(title); + } + bounds2.union(b2); + } + const min$1 = (a2, b2) => Math.floor(Math.min(a2, b2)); + const max$1 = (a2, b2) => Math.ceil(Math.max(a2, b2)); + function gridLayoutGroups(group2) { + var groups = group2.items, n = groups.length, i = 0, mark, items; + const views = { + marks: [], + rowheaders: [], + rowfooters: [], + colheaders: [], + colfooters: [], + rowtitle: null, + coltitle: null + }; + for (; i < n; ++i) { + mark = groups[i]; + items = mark.items; + if (mark.marktype === Group) { + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + break; + case RowHeader: + views.rowheaders.push(...items); + break; + case RowFooter: + views.rowfooters.push(...items); + break; + case ColHeader: + views.colheaders.push(...items); + break; + case ColFooter: + views.colfooters.push(...items); + break; + case RowTitle: + views.rowtitle = items[0]; + break; + case ColTitle: + views.coltitle = items[0]; + break; + default: + views.marks.push(...items); + } + } + } + return views; + } + function bboxFlush(item) { + return new Bounds().set(0, 0, item.width || 0, item.height || 0); + } + function bboxFull(item) { + const b2 = item.bounds.clone(); + return b2.empty() ? b2.set(0, 0, 0, 0) : b2.translate(-(item.x || 0), -(item.y || 0)); + } + function get$1(opt, key2, d) { + const v = isObject$1(opt) ? opt[key2] : opt; + return v != null ? v : d !== void 0 ? d : 0; + } + function offsetValue$1(v) { + return v < 0 ? Math.ceil(-v) : 0; + } + function gridLayout(view, groups, opt) { + var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds2 = tempBounds.set(0, 0, 0, 0), alignCol = get$1(opt.align, Column), alignRow = get$1(opt.align, Row), padCol = get$1(opt.padding, Column), padRow = get$1(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m2, i, c2, r, b2, g, px2, py2, x2, y2, offset2; + for (i = 0; i < ncols; ++i) xExtent[i] = 0; + for (i = 0; i < nrows; ++i) yExtent[i] = 0; + for (i = 0; i < n; ++i) { + g = groups[i]; + b2 = boxes[i] = bbox(g); + g.x = g.x || 0; + dx[i] = 0; + g.y = g.y || 0; + dy[i] = 0; + c2 = i % ncols; + r = ~~(i / ncols); + xMax = Math.max(xMax, px2 = Math.ceil(b2.x2)); + yMax = Math.max(yMax, py2 = Math.ceil(b2.y2)); + xExtent[c2] = Math.max(xExtent[c2], px2); + yExtent[r] = Math.max(yExtent[r], py2); + xOffset[i] = padCol + offsetValue$1(b2.x1); + yOffset[i] = padRow + offsetValue$1(b2.y1); + if (dirty) view.dirty(groups[i]); + } + for (i = 0; i < n; ++i) { + if (i % ncols === 0) xOffset[i] = 0; + if (i < ncols) yOffset[i] = 0; + } + if (alignCol === Each) { + for (c2 = 1; c2 < ncols; ++c2) { + for (offset2 = 0, i = c2; i < n; i += ncols) { + if (offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = c2; i < n; i += ncols) { + xOffset[i] = offset2 + xExtent[c2 - 1]; + } + } + } else if (alignCol === All) { + for (offset2 = 0, i = 0; i < n; ++i) { + if (i % ncols && offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = 0; i < n; ++i) { + if (i % ncols) xOffset[i] = offset2 + xMax; + } + } else { + for (alignCol = false, c2 = 1; c2 < ncols; ++c2) { + for (i = c2; i < n; i += ncols) { + xOffset[i] += xExtent[c2 - 1]; + } + } + } + if (alignRow === Each) { + for (r = 1; r < nrows; ++r) { + for (offset2 = 0, i = r * ncols, m2 = i + ncols; i < m2; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; + } + for (i = r * ncols; i < m2; ++i) { + yOffset[i] = offset2 + yExtent[r - 1]; + } + } + } else if (alignRow === All) { + for (offset2 = 0, i = ncols; i < n; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; + } + for (i = ncols; i < n; ++i) { + yOffset[i] = offset2 + yMax; + } + } else { + for (alignRow = false, r = 1; r < nrows; ++r) { + for (i = r * ncols, m2 = i + ncols; i < m2; ++i) { + yOffset[i] += yExtent[r - 1]; + } + } + } + for (x2 = 0, i = 0; i < n; ++i) { + x2 = xOffset[i] + (i % ncols ? x2 : 0); + dx[i] += x2 - groups[i].x; + } + for (c2 = 0; c2 < ncols; ++c2) { + for (y2 = 0, i = c2; i < n; i += ncols) { + y2 += yOffset[i]; + dy[i] += y2 - groups[i].y; + } + } + if (alignCol && get$1(opt.center, Column) && nrows > 1) { + for (i = 0; i < n; ++i) { + b2 = alignCol === All ? xMax : xExtent[i % ncols]; + x2 = b2 - boxes[i].x2 - groups[i].x - dx[i]; + if (x2 > 0) dx[i] += x2 / 2; + } + } + if (alignRow && get$1(opt.center, Row) && ncols !== 1) { + for (i = 0; i < n; ++i) { + b2 = alignRow === All ? yMax : yExtent[~~(i / ncols)]; + y2 = b2 - boxes[i].y2 - groups[i].y - dy[i]; + if (y2 > 0) dy[i] += y2 / 2; + } + } + for (i = 0; i < n; ++i) { + bounds2.union(boxes[i].translate(dx[i], dy[i])); + } + x2 = get$1(opt.anchor, X); + y2 = get$1(opt.anchor, Y); + switch (get$1(opt.anchor, Column)) { + case End$1: + x2 -= bounds2.width(); + break; + case Middle$1: + x2 -= bounds2.width() / 2; + } + switch (get$1(opt.anchor, Row)) { + case End$1: + y2 -= bounds2.height(); + break; + case Middle$1: + y2 -= bounds2.height() / 2; + } + x2 = Math.round(x2); + y2 = Math.round(y2); + bounds2.clear(); + for (i = 0; i < n; ++i) { + groups[i].mark.bounds.clear(); + } + for (i = 0; i < n; ++i) { + g = groups[i]; + g.x += dx[i] += x2; + g.y += dy[i] += y2; + bounds2.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); + if (dirty) view.dirty(g); + } + return bounds2; + } + function trellisLayout(view, group2, opt) { + var views = gridLayoutGroups(group2), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x2, y2, x22, y22, anchor, band2, offset2; + const bounds2 = gridLayout(view, groups, opt); + if (bounds2.empty()) bounds2.set(0, 0, 0, 0); + if (views.rowheaders) { + band2 = get$1(opt.headerBand, Row, null); + x2 = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$1(off, "rowHeader"), min$1, 0, bbox, "x1", 0, ncols, 1, band2); + } + if (views.colheaders) { + band2 = get$1(opt.headerBand, Column, null); + y2 = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$1(off, "columnHeader"), min$1, 1, bbox, "y1", 0, 1, ncols, band2); + } + if (views.rowfooters) { + band2 = get$1(opt.footerBand, Row, null); + x22 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$1(off, "rowFooter"), max$1, 0, bbox, "x2", ncols - 1, ncols, 1, band2); + } + if (views.colfooters) { + band2 = get$1(opt.footerBand, Column, null); + y22 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$1(off, "columnFooter"), max$1, 1, bbox, "y2", cells - ncols, 1, ncols, band2); + } + if (views.rowtitle) { + anchor = get$1(opt.titleAnchor, Row); + offset2 = get$1(off, "rowTitle"); + offset2 = anchor === End$1 ? x22 + offset2 : x2 - offset2; + band2 = get$1(opt.titleBand, Row, 0.5); + layoutTitle(view, views.rowtitle, offset2, 0, bounds2, band2); + } + if (views.coltitle) { + anchor = get$1(opt.titleAnchor, Column); + offset2 = get$1(off, "columnTitle"); + offset2 = anchor === End$1 ? y22 + offset2 : y2 - offset2; + band2 = get$1(opt.titleBand, Column, 0.5); + layoutTitle(view, views.coltitle, offset2, 1, bounds2, band2); + } + } + function boundFlush(item, field2) { + return field2 === "x1" ? item.x || 0 : field2 === "y1" ? item.y || 0 : field2 === "x2" ? (item.x || 0) + (item.width || 0) : field2 === "y2" ? (item.y || 0) + (item.height || 0) : void 0; + } + function boundFull(item, field2) { + return item.bounds[field2]; + } + function layoutHeaders(view, headers, groups, ncols, limit, offset2, agg, isX2, bound2, bf, start, stride, back, band2) { + var n = groups.length, init2 = 0, edge = 0, i, j, k, m2, b2, h2, g, x2, y2; + if (!n) return init2; + for (i = start; i < n; i += stride) { + if (groups[i]) init2 = agg(init2, bound2(groups[i], bf)); + } + if (!headers.length) return init2; + if (headers.length > limit) { + view.warn("Grid headers exceed limit: " + limit); + headers = headers.slice(0, limit); + } + init2 += offset2; + for (j = 0, m2 = headers.length; j < m2; ++j) { + view.dirty(headers[j]); + headers[j].mark.bounds.clear(); + } + for (i = start, j = 0, m2 = headers.length; j < m2; ++j, i += stride) { + h2 = headers[j]; + b2 = h2.mark.bounds; + for (k = i; k >= 0 && (g = groups[k]) == null; k -= back) ; + if (isX2) { + x2 = band2 == null ? g.x : Math.round(g.bounds.x1 + band2 * g.bounds.width()); + y2 = init2; + } else { + x2 = init2; + y2 = band2 == null ? g.y : Math.round(g.bounds.y1 + band2 * g.bounds.height()); + } + b2.union(h2.bounds.translate(x2 - (h2.x || 0), y2 - (h2.y || 0))); + h2.x = x2; + h2.y = y2; + view.dirty(h2); + edge = agg(edge, b2[bf]); + } + return edge; + } + function layoutTitle(view, g, offset2, isX2, bounds2, band2) { + if (!g) return; + view.dirty(g); + var x2 = offset2, y2 = offset2; + isX2 ? x2 = Math.round(bounds2.x1 + band2 * bounds2.width()) : y2 = Math.round(bounds2.y1 + band2 * bounds2.height()); + g.bounds.translate(x2 - (g.x || 0), y2 - (g.y || 0)); + g.mark.bounds.clear().union(g.bounds); + g.x = x2; + g.y = y2; + view.dirty(g); + } + function lookup$3(config, orient) { + const opt = config[orient] || {}; + return (key2, d) => opt[key2] != null ? opt[key2] : config[key2] != null ? config[key2] : d; + } + function offsets(legends, value2) { + let max2 = -Infinity; + legends.forEach((item) => { + if (item.offset != null) max2 = Math.max(max2, item.offset); + }); + return max2 > -Infinity ? max2 : value2; + } + function legendParams(g, orient, config, xb, yb, w2, h2) { + const _ = lookup$3(config, orient), offset2 = offsets(g, _("offset", 0)), anchor = _("anchor", Start$1), mult2 = anchor === End$1 ? 1 : anchor === Middle$1 ? 0.5 : 0; + const p = { + align: Each, + bounds: _("bounds", Flush), + columns: _("direction") === "vertical" ? 1 : g.length, + padding: _("margin", 8), + center: _("center"), + nodirty: true + }; + switch (orient) { + case Left$1: + p.anchor = { + x: Math.floor(xb.x1) - offset2, + column: End$1, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor + }; + break; + case Right$1: + p.anchor = { + x: Math.ceil(xb.x2) + offset2, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor + }; + break; + case Top$1: + p.anchor = { + y: Math.floor(yb.y1) - offset2, + row: End$1, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case Bottom$1: + p.anchor = { + y: Math.ceil(yb.y2) + offset2, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case TopLeft: + p.anchor = { + x: offset2, + y: offset2 + }; + break; + case TopRight: + p.anchor = { + x: w2 - offset2, + y: offset2, + column: End$1 + }; + break; + case BottomLeft: + p.anchor = { + x: offset2, + y: h2 - offset2, + row: End$1 + }; + break; + case BottomRight: + p.anchor = { + x: w2 - offset2, + y: h2 - offset2, + column: End$1, + row: End$1 + }; + break; + } + return p; + } + function legendLayout(view, legend2) { + var item = legend2.items[0], datum2 = item.datum, orient = item.orient, bounds2 = item.bounds, x2 = item.x, y2 = item.y, w2, h2; + item._bounds ? item._bounds.clear().union(bounds2) : item._bounds = bounds2.clone(); + bounds2.clear(); + legendGroupLayout(view, item, item.items[0].items[0]); + bounds2 = legendBounds(item, bounds2); + w2 = 2 * item.padding; + h2 = 2 * item.padding; + if (!bounds2.empty()) { + w2 = Math.ceil(bounds2.width() + w2); + h2 = Math.ceil(bounds2.height() + h2); + } + if (datum2.type === Symbols$1) { + legendEntryLayout(item.items[0].items[0].items[0].items); + } + if (orient !== None) { + item.x = x2 = 0; + item.y = y2 = 0; + } + item.width = w2; + item.height = h2; + boundStroke(bounds2.set(x2, y2, x2 + w2, y2 + h2), item); + item.mark.bounds.clear().union(bounds2); + return item; + } + function legendBounds(item, b2) { + item.items.forEach((_) => b2.union(_.bounds)); + b2.x1 = item.padding; + b2.y1 = item.padding; + return b2; + } + function legendGroupLayout(view, item, entry2) { + var pad2 = item.padding, ex = pad2 - entry2.x, ey = pad2 - entry2.y; + if (!item.datum.title) { + if (ex || ey) translate$1(view, entry2, ex, ey); + } else { + var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx2 = pad2 - title.x, ty2 = pad2 - title.y; + switch (title.orient) { + case Left$1: + ex += Math.ceil(title.bounds.width()) + tpad; + break; + case Right$1: + case Bottom$1: + break; + default: + ey += title.bounds.height() + tpad; + } + if (ex || ey) translate$1(view, entry2, ex, ey); + switch (title.orient) { + case Left$1: + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Right$1: + tx2 += legendTitleOffset(item, entry2, title, End$1, 0, 0) + tpad; + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Bottom$1: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + ty2 += legendTitleOffset(item, entry2, title, End$1, -1, 0, 1) + tpad; + break; + default: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + } + if (tx2 || ty2) translate$1(view, title, tx2, ty2); + if ((tx2 = Math.round(title.bounds.x1 - pad2)) < 0) { + translate$1(view, entry2, -tx2, 0); + translate$1(view, title, -tx2, 0); + } + } + } + function legendTitleOffset(item, entry2, title, anchor, y2, lr, noBar) { + const grad = item.datum.type !== "symbol", vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry2.items[0] : entry2, s = e.bounds[y2 ? "y2" : "x2"] - item.padding, u2 = vgrad && lr ? s : 0, v = vgrad && lr ? 0 : s, o = y2 <= 0 ? 0 : multiLineOffset(title); + return Math.round(anchor === Start$1 ? u2 : anchor === End$1 ? v - o : 0.5 * (s - o)); + } + function translate$1(view, item, dx, dy) { + item.x += dx; + item.y += dy; + item.bounds.translate(dx, dy); + item.mark.bounds.translate(dx, dy); + view.dirty(item); + } + function legendEntryLayout(entries) { + const widths = entries.reduce((w2, g) => { + w2[g.column] = Math.max(g.bounds.x2 - g.x, w2[g.column] || 0); + return w2; + }, {}); + entries.forEach((g) => { + g.width = widths[g.column]; + g.height = g.bounds.y2 - g.y; + }); + } + function titleLayout(view, mark, width2, height2, viewBounds2) { + var group2 = mark.items[0], frame2 = group2.frame, orient = group2.orient, anchor = group2.anchor, offset2 = group2.offset, padding2 = group2.padding, title = group2.items[0].items[0], subtitle = group2.items[1] && group2.items[1].items[0], end = orient === Left$1 || orient === Right$1 ? height2 : width2, start = 0, x2 = 0, y2 = 0, sx = 0, sy = 0, pos; + if (frame2 !== Group) { + orient === Left$1 ? (start = viewBounds2.y2, end = viewBounds2.y1) : orient === Right$1 ? (start = viewBounds2.y1, end = viewBounds2.y2) : (start = viewBounds2.x1, end = viewBounds2.x2); + } else if (orient === Left$1) { + start = height2, end = 0; + } + pos = anchor === Start$1 ? start : anchor === End$1 ? end : (start + end) / 2; + if (subtitle && subtitle.text) { + switch (orient) { + case Top$1: + case Bottom$1: + sy = title.bounds.height() + padding2; + break; + case Left$1: + sx = title.bounds.width() + padding2; + break; + case Right$1: + sx = -title.bounds.width() - padding2; + break; + } + tempBounds.clear().union(subtitle.bounds); + tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); + if (set$6(subtitle, "x", sx) | set$6(subtitle, "y", sy)) { + view.dirty(subtitle); + subtitle.bounds.clear().union(tempBounds); + subtitle.mark.bounds.clear().union(tempBounds); + view.dirty(subtitle); + } + tempBounds.clear().union(subtitle.bounds); + } else { + tempBounds.clear(); + } + tempBounds.union(title.bounds); + switch (orient) { + case Top$1: + x2 = pos; + y2 = viewBounds2.y1 - tempBounds.height() - offset2; + break; + case Left$1: + x2 = viewBounds2.x1 - tempBounds.width() - offset2; + y2 = pos; + break; + case Right$1: + x2 = viewBounds2.x2 + tempBounds.width() + offset2; + y2 = pos; + break; + case Bottom$1: + x2 = pos; + y2 = viewBounds2.y2 + offset2; + break; + default: + x2 = group2.x; + y2 = group2.y; + } + if (set$6(group2, "x", x2) | set$6(group2, "y", y2)) { + tempBounds.translate(x2, y2); + view.dirty(group2); + group2.bounds.clear().union(tempBounds); + mark.bounds.clear().union(tempBounds); + view.dirty(group2); + } + return group2.bounds; + } + function ViewLayout$1(params2) { + Transform.call(this, null, params2); + } + inherits(ViewLayout$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + _.mark.items.forEach((group2) => { + if (_.layout) trellisLayout(view, group2, _.layout); + layoutGroup(view, group2, _); + }); + return shouldReflow(_.mark.group) ? pulse2.reflow() : pulse2; + } + }); + function shouldReflow(group2) { + return group2 && group2.mark.role !== "legend-entry"; + } + function layoutGroup(view, group2, _) { + var items = group2.items, width2 = Math.max(0, group2.width || 0), height2 = Math.max(0, group2.height || 0), viewBounds2 = new Bounds().set(0, 0, width2, height2), xBounds = viewBounds2.clone(), yBounds = viewBounds2.clone(), legends = [], title, mark, orient, b2, i, n; + for (i = 0, n = items.length; i < n; ++i) { + mark = items[i]; + switch (mark.role) { + case AxisRole$1: + b2 = isYAxis(mark) ? xBounds : yBounds; + b2.union(axisLayout(view, mark, width2, height2)); + break; + case TitleRole$1: + title = mark; + break; + case LegendRole$1: + legends.push(legendLayout(view, mark)); + break; + case FrameRole$1: + case ScopeRole$1: + case RowHeader: + case RowFooter: + case RowTitle: + case ColHeader: + case ColFooter: + case ColTitle: + xBounds.union(mark.bounds); + yBounds.union(mark.bounds); + break; + default: + viewBounds2.union(mark.bounds); + } + } + if (legends.length) { + const l = {}; + legends.forEach((item) => { + orient = item.orient || Right$1; + if (orient !== None) (l[orient] || (l[orient] = [])).push(item); + }); + for (const orient2 in l) { + const g = l[orient2]; + gridLayout(view, g, legendParams(g, orient2, _.legends, xBounds, yBounds, width2, height2)); + } + legends.forEach((item) => { + const b3 = item.bounds; + if (!b3.equals(item._bounds)) { + item.bounds = item._bounds; + view.dirty(item); + item.bounds = b3; + view.dirty(item); + } + if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) { + switch (item.orient) { + case Left$1: + case Right$1: + viewBounds2.add(b3.x1, 0).add(b3.x2, 0); + break; + case Top$1: + case Bottom$1: + viewBounds2.add(0, b3.y1).add(0, b3.y2); + } + } else { + viewBounds2.union(b3); + } + }); + } + viewBounds2.union(xBounds).union(yBounds); + if (title) { + viewBounds2.union(titleLayout(view, title, width2, height2, viewBounds2)); + } + if (group2.clip) { + viewBounds2.set(0, 0, group2.width || 0, group2.height || 0); + } + viewSizeLayout(view, group2, viewBounds2, _); + } + function viewSizeLayout(view, group2, viewBounds2, _) { + const auto = _.autosize || {}, type2 = auto.type; + if (view._autosize < 1 || !type2) return; + let viewWidth2 = view._width, viewHeight2 = view._height, width2 = Math.max(0, group2.width || 0), left = Math.max(0, Math.ceil(-viewBounds2.x1)), height2 = Math.max(0, group2.height || 0), top = Math.max(0, Math.ceil(-viewBounds2.y1)); + const right = Math.max(0, Math.ceil(viewBounds2.x2 - width2)), bottom = Math.max(0, Math.ceil(viewBounds2.y2 - height2)); + if (auto.contains === Padding$1) { + const padding2 = view.padding(); + viewWidth2 -= padding2.left + padding2.right; + viewHeight2 -= padding2.top + padding2.bottom; + } + if (type2 === None) { + left = 0; + top = 0; + width2 = viewWidth2; + height2 = viewHeight2; + } else if (type2 === Fit) { + width2 = Math.max(0, viewWidth2 - left - right); + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === FitX) { + width2 = Math.max(0, viewWidth2 - left - right); + viewHeight2 = height2 + top + bottom; + } else if (type2 === FitY) { + viewWidth2 = width2 + left + right; + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === Pad) { + viewWidth2 = width2 + left + right; + viewHeight2 = height2 + top + bottom; + } + view._resizeView(viewWidth2, viewHeight2, width2, height2, [left, top], auto.resize); + } + const vtx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + bound: Bound$1, + identifier: Identifier$1, + mark: Mark$1, + overlap: Overlap$1, + render: Render$1, + viewlayout: ViewLayout$1 + }, Symbol.toStringTag, { value: "Module" })); + function AxisTicks$1(params2) { + Transform.call(this, null, params2); + } + inherits(AxisTicks$1, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), ticks2 = this.value, scale2 = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count2 = tickCount(scale2, tally, _.minstep), format2 = _.format || tickFormat(locale2, scale2, count2, _.formatSpecifier, _.formatType, !!_.values), values2 = _.values ? validTicks(scale2, _.values, count2) : tickValues(scale2, count2); + if (ticks2) out.rem = ticks2; + ticks2 = values2.map((value2, i) => ingest$1({ + index: i / (values2.length - 1 || 1), + value: value2, + label: format2(value2) + })); + if (_.extra && ticks2.length) { + ticks2.push(ingest$1({ + index: -1, + extra: { + value: ticks2[0].value + }, + label: "" + })); + } + out.source = ticks2; + out.add = ticks2; + this.value = ticks2; + return out; + } + }); + function DataJoin$1(params2) { + Transform.call(this, null, params2); + } + function defaultItemCreate() { + return ingest$1({}); + } + function newMap(key2) { + const map2 = fastmap().test((t) => t.exit); + map2.lookup = (t) => map2.get(key2(t)); + return map2; + } + inherits(DataJoin$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), item = _.item || defaultItemCreate, key2 = _.key || tupleid, map2 = this.value; + if (isArray(out.encode)) { + out.encode = null; + } + if (map2 && (_.modified("key") || pulse2.modified(key2))) { + error("DataJoin does not support modified key function or fields."); + } + if (!map2) { + pulse2 = pulse2.addAll(); + this.value = map2 = newMap(key2); + } + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + let x2 = map2.get(k); + if (x2) { + if (x2.exit) { + map2.empty--; + out.add.push(x2); + } else { + out.mod.push(x2); + } + } else { + x2 = item(t); + map2.set(k, x2); + out.add.push(x2); + } + x2.datum = t; + x2.exit = false; + }); + pulse2.visit(pulse2.MOD, (t) => { + const k = key2(t), x2 = map2.get(k); + if (x2) { + x2.datum = t; + out.mod.push(x2); + } + }); + pulse2.visit(pulse2.REM, (t) => { + const k = key2(t), x2 = map2.get(k); + if (t === x2.datum && !x2.exit) { + out.rem.push(x2); + x2.exit = true; + ++map2.empty; + } + }); + if (pulse2.changed(pulse2.ADD_MOD)) out.modifies("datum"); + if (pulse2.clean() || _.clean && map2.empty > df.cleanThreshold) { + df.runAfter(map2.clean); + } + return out; + } + }); + function Encode$1(params2) { + Transform.call(this, null, params2); + } + inherits(Encode$1, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode2 = pulse2.encode; + if (isArray(encode2)) { + if (out.changed() || encode2.every((e) => encoders[e])) { + encode2 = encode2[0]; + out.encode = null; + } else { + return pulse2.StopPropagation; + } + } + var reenter = encode2 === "enter", update2 = encoders.update || falsy, enter = encoders.enter || falsy, exit = encoders.exit || falsy, set2 = (encode2 && !reenter ? encoders[encode2] : update2) || falsy; + if (pulse2.changed(pulse2.ADD)) { + pulse2.visit(pulse2.ADD, (t) => { + enter(t, _); + update2(t, _); + }); + out.modifies(enter.output); + out.modifies(update2.output); + if (set2 !== falsy && set2 !== update2) { + pulse2.visit(pulse2.ADD, (t) => { + set2(t, _); + }); + out.modifies(set2.output); + } + } + if (pulse2.changed(pulse2.REM) && exit !== falsy) { + pulse2.visit(pulse2.REM, (t) => { + exit(t, _); + }); + out.modifies(exit.output); + } + if (reenter || set2 !== falsy) { + const flag2 = pulse2.MOD | (_.modified() ? pulse2.REFLOW : 0); + if (reenter) { + pulse2.visit(flag2, (t) => { + const mod = enter(t, _) || fmod; + if (set2(t, _) || mod) out.mod.push(t); + }); + if (out.mod.length) out.modifies(enter.output); + } else { + pulse2.visit(flag2, (t) => { + if (set2(t, _) || fmod) out.mod.push(t); + }); + } + if (out.mod.length) out.modifies(set2.output); + } + return out.changed() ? out : pulse2.StopPropagation; + } + }); + function LegendEntries$1(params2) { + Transform.call(this, [], params2); + } + inherits(LegendEntries$1, Transform, { + transform(_, pulse2) { + if (this.value != null && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), items = this.value, type2 = _.type || SymbolLegend, scale2 = _.scale, limit = +_.limit, count2 = tickCount(scale2, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type2 === SymbolLegend, format2 = _.format || labelFormat(locale2, scale2, count2, type2, _.formatSpecifier, _.formatType, lskip), values2 = _.values || labelValues(scale2, count2), domain2, fraction, size2, offset2, ellipsis; + if (items) out.rem = items; + if (type2 === SymbolLegend) { + if (limit && values2.length > limit) { + pulse2.dataflow.warn("Symbol legend count exceeds limit, filtering items."); + items = values2.slice(0, limit - 1); + ellipsis = true; + } else { + items = values2; + } + if (isFunction(size2 = _.size)) { + if (!_.values && scale2(items[0]) === 0) { + items = items.slice(1); + } + offset2 = items.reduce((max2, value2) => Math.max(max2, size2(value2, _)), 0); + } else { + size2 = constant$5(offset2 = size2 || 8); + } + items = items.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, items), + value: value2, + offset: offset2, + size: size2(value2, _) + })); + if (ellipsis) { + ellipsis = values2[items.length]; + items.push(ingest$1({ + index: items.length, + label: `…${values2.length - items.length} entries`, + value: ellipsis, + offset: offset2, + size: size2(ellipsis, _) + })); + } + } else if (type2 === GradientLegend) { + domain2 = scale2.domain(), fraction = scaleFraction(scale2, domain2[0], peek$1(domain2)); + if (values2.length < 3 && !_.values && domain2[0] !== peek$1(domain2)) { + values2 = [domain2[0], peek$1(domain2)]; + } + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: fraction(value2) + })); + } else { + size2 = values2.length - 1; + fraction = labelFraction(scale2); + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: index2 ? fraction(value2) : 0, + perc2: index2 === size2 ? 1 : fraction(values2[index2 + 1]) + })); + } + out.source = items; + out.add = items; + this.value = items; + return out; + } + }); + const sourceX = (t) => t.source.x; + const sourceY = (t) => t.source.y; + const targetX = (t) => t.target.x; + const targetY = (t) => t.target.y; + function LinkPath(params2) { + Transform.call(this, {}, params2); + } + LinkPath.Definition = { + "type": "LinkPath", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "sourceX", + "type": "field", + "default": "source.x" + }, { + "name": "sourceY", + "type": "field", + "default": "source.y" + }, { + "name": "targetX", + "type": "field", + "default": "target.x" + }, { + "name": "targetY", + "type": "field", + "default": "target.y" + }, { + "name": "orient", + "type": "enum", + "default": "vertical", + "values": ["horizontal", "vertical", "radial"] + }, { + "name": "shape", + "type": "enum", + "default": "line", + "values": ["line", "arc", "curve", "diagonal", "orthogonal"] + }, { + "name": "require", + "type": "signal" + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(LinkPath, Transform, { + transform(_, pulse2) { + var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx2 = _.targetX || targetX, ty2 = _.targetY || targetY, as = _.as || "path", orient = _.orient || "vertical", shape2 = _.shape || "line", path2 = Paths.get(shape2 + "-" + orient) || Paths.get(shape2); + if (!path2) { + error("LinkPath unsupported type: " + _.shape + (_.orient ? "-" + _.orient : "")); + } + pulse2.visit(pulse2.SOURCE, (t) => { + t[as] = path2(sx(t), sy(t), tx2(t), ty2(t)); + }); + return pulse2.reflow(_.modified()).modifies(as); + } + }); + const line = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "L" + tx2 + "," + ty2; + const lineR = (sa2, sr, ta, tr2) => line(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const arc = (sx, sy, tx2, ty2) => { + var dx = tx2 - sx, dy = ty2 - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; + return "M" + sx + "," + sy + "A" + rr + "," + rr + " " + ra + " 0 1 " + tx2 + "," + ty2; + }; + const arcR = (sa2, sr, ta, tr2) => arc(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const curve = (sx, sy, tx2, ty2) => { + const dx = tx2 - sx, dy = ty2 - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); + return "M" + sx + "," + sy + "C" + (sx + ix) + "," + (sy + iy) + " " + (tx2 + iy) + "," + (ty2 - ix) + " " + tx2 + "," + ty2; + }; + const curveR = (sa2, sr, ta, tr2) => curve(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const orthoX = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "V" + ty2 + "H" + tx2; + const orthoY = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "H" + tx2 + "V" + ty2; + const orthoR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), sf = Math.abs(ta - sa2) > Math.PI ? ta <= sa2 : ta > sa2; + return "M" + sr * sc + "," + sr * ss + "A" + sr + "," + sr + " 0 0," + (sf ? 1 : 0) + " " + sr * tc + "," + sr * ts2 + "L" + tr2 * tc + "," + tr2 * ts2; + }; + const diagonalX = (sx, sy, tx2, ty2) => { + const m2 = (sx + tx2) / 2; + return "M" + sx + "," + sy + "C" + m2 + "," + sy + " " + m2 + "," + ty2 + " " + tx2 + "," + ty2; + }; + const diagonalY = (sx, sy, tx2, ty2) => { + const m2 = (sy + ty2) / 2; + return "M" + sx + "," + sy + "C" + sx + "," + m2 + " " + tx2 + "," + m2 + " " + tx2 + "," + ty2; + }; + const diagonalR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), mr = (sr + tr2) / 2; + return "M" + sr * sc + "," + sr * ss + "C" + mr * sc + "," + mr * ss + " " + mr * tc + "," + mr * ts2 + " " + tr2 * tc + "," + tr2 * ts2; + }; + const Paths = fastmap({ + "line": line, + "line-radial": lineR, + "arc": arc, + "arc-radial": arcR, + "curve": curve, + "curve-radial": curveR, + "orthogonal-horizontal": orthoX, + "orthogonal-vertical": orthoY, + "orthogonal-radial": orthoR, + "diagonal-horizontal": diagonalX, + "diagonal-vertical": diagonalY, + "diagonal-radial": diagonalR + }); + function Pie(params2) { + Transform.call(this, null, params2); + } + Pie.Definition = { + "type": "Pie", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "startAngle", + "type": "number", + "default": 0 + }, { + "name": "endAngle", + "type": "number", + "default": 6.283185307179586 + }, { + "name": "sort", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["startAngle", "endAngle"] + }] + }; + inherits(Pie, Transform, { + transform(_, pulse2) { + var as = _.as || ["startAngle", "endAngle"], startAngle = as[0], endAngle = as[1], field2 = _.field || one$2, start = _.startAngle || 0, stop2 = _.endAngle != null ? _.endAngle : 2 * Math.PI, data2 = pulse2.source, values2 = data2.map(field2), n = values2.length, a2 = start, k = (stop2 - start) / sum$1(values2), index2 = range$3(n), i, t, v; + if (_.sort) { + index2.sort((a3, b2) => values2[a3] - values2[b2]); + } + for (i = 0; i < n; ++i) { + v = values2[index2[i]]; + t = data2[index2[i]]; + t[startAngle] = a2; + t[endAngle] = a2 += v * k; + } + this.value = values2; + return pulse2.reflow(_.modified()).modifies(as); + } + }); + const DEFAULT_COUNT = 5; + function includeZero(scale2) { + const type2 = scale2.type; + return !scale2.bins && (type2 === Linear || type2 === Pow || type2 === Sqrt); + } + function includePad(type2) { + return isContinuous(type2) && type2 !== Sequential; + } + const SKIP$1 = toSet(["set", "modified", "clear", "type", "scheme", "schemeExtent", "schemeCount", "domain", "domainMin", "domainMid", "domainMax", "domainRaw", "domainImplicit", "nice", "zero", "bins", "range", "rangeStep", "round", "reverse", "interpolate", "interpolateGamma"]); + function Scale$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Scale$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, scale$12 = this.value, key2 = scaleKey(_); + if (!scale$12 || key2 !== scale$12.type) { + this.value = scale$12 = scale$6(key2)(); + } + for (key2 in _) if (!SKIP$1[key2]) { + if (key2 === "padding" && includePad(scale$12.type)) continue; + isFunction(scale$12[key2]) ? scale$12[key2](_[key2]) : df.warn("Unsupported scale property: " + key2); + } + configureRange(scale$12, _, configureBins(scale$12, _, configureDomain(scale$12, _, df))); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + } + }); + function scaleKey(_) { + var t = _.type, d = "", n; + if (t === Sequential) return Sequential + "-" + Linear; + if (isContinuousColor(_)) { + n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; + d = n === 2 ? Sequential + "-" : n === 3 ? Diverging + "-" : ""; + } + return (d + t || Linear).toLowerCase(); + } + function isContinuousColor(_) { + const t = _.type; + return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString)); + } + function configureDomain(scale2, _, df) { + const raw = rawDomain(scale2, _.domainRaw, df); + if (raw > -1) return raw; + var domain2 = _.domain, type2 = scale2.type, zero2 = _.zero || _.zero === void 0 && includeZero(scale2), n, mid; + if (!domain2) return 0; + if (zero2 || _.domainMin != null || _.domainMax != null || _.domainMid != null) { + n = (domain2 = domain2.slice()).length - 1 || 1; + if (zero2) { + if (domain2[0] > 0) domain2[0] = 0; + if (domain2[n] < 0) domain2[n] = 0; + } + if (_.domainMin != null) domain2[0] = _.domainMin; + if (_.domainMax != null) domain2[n] = _.domainMax; + if (_.domainMid != null) { + mid = _.domainMid; + const i = mid > domain2[n] ? n + 1 : mid < domain2[0] ? 0 : n; + if (i !== n) df.warn("Scale domainMid exceeds domain min or max.", mid); + domain2.splice(i, 0, mid); + } + } + if (includePad(type2) && _.padding && domain2[0] !== peek$1(domain2)) { + domain2 = padDomain(type2, domain2, _.range, _.padding, _.exponent, _.constant); + } + scale2.domain(domainCheck(type2, domain2, df)); + if (type2 === Ordinal) { + scale2.unknown(_.domainImplicit ? implicit : void 0); + } + if (_.nice && scale2.nice) { + scale2.nice(_.nice !== true && tickCount(scale2, _.nice) || null); + } + return domain2.length; + } + function rawDomain(scale2, raw, df) { + if (raw) { + scale2.domain(domainCheck(scale2.type, raw, df)); + return raw.length; + } else { + return -1; + } + } + function padDomain(type2, domain2, range2, pad2, exponent2, constant2) { + var span2 = Math.abs(peek$1(range2) - range2[0]), frac = span2 / (span2 - 2 * pad2), d = type2 === Log$1 ? zoomLog(domain2, null, frac) : type2 === Sqrt ? zoomPow(domain2, null, frac, 0.5) : type2 === Pow ? zoomPow(domain2, null, frac, exponent2 || 1) : type2 === Symlog ? zoomSymlog(domain2, null, frac, constant2 || 1) : zoomLinear(domain2, null, frac); + domain2 = domain2.slice(); + domain2[0] = d[0]; + domain2[domain2.length - 1] = d[1]; + return domain2; + } + function domainCheck(type2, domain2, df) { + if (isLogarithmic(type2)) { + var s = Math.abs(domain2.reduce((s2, v) => s2 + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); + if (s !== domain2.length) { + df.warn("Log scale domain includes zero: " + $(domain2)); + } + } + return domain2; + } + function configureBins(scale2, _, count2) { + let bins = _.bins; + if (bins && !isArray(bins)) { + const domain2 = scale2.domain(), lo = domain2[0], hi = peek$1(domain2), step = bins.step; + let start = bins.start == null ? lo : bins.start, stop2 = bins.stop == null ? hi : bins.stop; + if (!step) error("Scale bins parameter missing step property."); + if (start < lo) start = step * Math.ceil(lo / step); + if (stop2 > hi) stop2 = step * Math.floor(hi / step); + bins = range$3(start, stop2 + step / 2, step); + } + if (bins) { + scale2.bins = bins; + } else if (scale2.bins) { + delete scale2.bins; + } + if (scale2.type === BinOrdinal) { + if (!bins) { + scale2.bins = scale2.domain(); + } else if (!_.domain && !_.domainRaw) { + scale2.domain(bins); + count2 = bins.length; + } + } + return count2; + } + function configureRange(scale2, _, count2) { + var type2 = scale2.type, round = _.round || false, range2 = _.range; + if (_.rangeStep != null) { + range2 = configureRangeStep(type2, _, count2); + } else if (_.scheme) { + range2 = configureScheme(type2, _, count2); + if (isFunction(range2)) { + if (scale2.interpolator) { + return scale2.interpolator(range2); + } else { + error(`Scale type ${type2} does not support interpolating color schemes.`); + } + } + } + if (range2 && isInterpolating(type2)) { + return scale2.interpolator(interpolateColors(flip(range2, _.reverse), _.interpolate, _.interpolateGamma)); + } + if (range2 && _.interpolate && scale2.interpolate) { + scale2.interpolate(interpolate(_.interpolate, _.interpolateGamma)); + } else if (isFunction(scale2.round)) { + scale2.round(round); + } else if (isFunction(scale2.rangeRound)) { + scale2.interpolate(round ? interpolateRound : interpolate$1); + } + if (range2) scale2.range(flip(range2, _.reverse)); + } + function configureRangeStep(type2, _, count2) { + if (type2 !== Band$1 && type2 !== Point) { + error("Only band and point scales support rangeStep."); + } + var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type2 === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; + return [0, _.rangeStep * bandSpace(count2, inner, outer)]; + } + function configureScheme(type2, _, count2) { + var extent2 = _.schemeExtent, name, scheme$1; + if (isArray(_.scheme)) { + scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); + } else { + name = _.scheme.toLowerCase(); + scheme$1 = scheme(name); + if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`); + } + count2 = type2 === Threshold ? count2 + 1 : type2 === BinOrdinal ? count2 - 1 : type2 === Quantile || type2 === Quantize ? +_.schemeCount || DEFAULT_COUNT : count2; + return isInterpolating(type2) ? adjustScheme(scheme$1, extent2, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent2), count2) : type2 === Ordinal ? scheme$1 : scheme$1.slice(0, count2); + } + function adjustScheme(scheme2, extent2, reverse2) { + return isFunction(scheme2) && (extent2 || reverse2) ? interpolateRange(scheme2, flip(extent2 || [0, 1], reverse2)) : scheme2; + } + function flip(array2, reverse2) { + return reverse2 ? array2.slice().reverse() : array2; + } + function SortItems$1(params2) { + Transform.call(this, null, params2); + } + inherits(SortItems$1, Transform, { + transform(_, pulse2) { + const mod = _.modified("sort") || pulse2.changed(pulse2.ADD) || pulse2.modified(_.sort.fields) || pulse2.modified("datum"); + if (mod) pulse2.source.sort(stableCompare(_.sort)); + this.modified(mod); + return pulse2; + } + }); + const Zero = "zero", Center$1 = "center", Normalize = "normalize", DefOutput = ["y0", "y1"]; + function Stack$1(params2) { + Transform.call(this, null, params2); + } + Stack$1.Definition = { + "type": "Stack", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "sort", + "type": "compare" + }, { + "name": "offset", + "type": "enum", + "default": Zero, + "values": [Zero, Center$1, Normalize] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": DefOutput + }] + }; + inherits(Stack$1, Transform, { + transform(_, pulse2) { + var as = _.as || DefOutput, y02 = as[0], y12 = as[1], sort2 = stableCompare(_.sort), field2 = _.field || one$2, stack = _.offset === Center$1 ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max2; + groups = partition$3(pulse2.source, _.groupby, sort2, field2); + for (i = 0, n = groups.length, max2 = groups.max; i < n; ++i) { + stack(groups[i], max2, field2, y02, y12); + } + return pulse2.reflow(_.modified()).modifies(as); + } + }); + function stackCenter(group2, max2, field2, y02, y12) { + var last = (max2 - group2.sum) / 2, m2 = group2.length, j = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last += Math.abs(field2(t)); + } + } + function stackNormalize(group2, max2, field2, y02, y12) { + var scale2 = 1 / group2.sum, last = 0, m2 = group2.length, j = 0, v = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last = scale2 * (v += Math.abs(field2(t))); + } + } + function stackZero(group2, max2, field2, y02, y12) { + var lastPos = 0, lastNeg = 0, m2 = group2.length, j = 0, v, t; + for (; j < m2; ++j) { + t = group2[j]; + v = +field2(t); + if (v < 0) { + t[y02] = lastNeg; + t[y12] = lastNeg += v; + } else { + t[y02] = lastPos; + t[y12] = lastPos += v; + } + } + } + function partition$3(data2, groupby, sort2, field2) { + var groups = [], get2 = (f) => f(t), map2, i, n, m2, t, k, g, s, max2; + if (groupby == null) { + groups.push(data2.slice()); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + groups.push(g); + } + g.push(t); + } + } + for (k = 0, max2 = 0, m2 = groups.length; k < m2; ++k) { + g = groups[k]; + for (i = 0, s = 0, n = g.length; i < n; ++i) { + s += Math.abs(field2(g[i])); + } + g.sum = s; + if (s > max2) max2 = s; + if (sort2) g.sort(sort2); + } + groups.max = max2; + return groups; + } + const encode$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + axisticks: AxisTicks$1, + datajoin: DataJoin$1, + encode: Encode$1, + legendentries: LegendEntries$1, + linkpath: LinkPath, + pie: Pie, + scale: Scale$1, + sortitems: SortItems$1, + stack: Stack$1 + }, Symbol.toStringTag, { value: "Module" })); + var epsilon$3 = 1e-6; + var epsilon2 = 1e-12; + var pi$1 = Math.PI; + var halfPi$1 = pi$1 / 2; + var quarterPi = pi$1 / 4; + var tau$1 = pi$1 * 2; + var degrees = 180 / pi$1; + var radians = pi$1 / 180; + var abs$1 = Math.abs; + var atan = Math.atan; + var atan2 = Math.atan2; + var cos$1 = Math.cos; + var ceil = Math.ceil; + var exp = Math.exp; + var hypot = Math.hypot; + var log$1 = Math.log; + var pow$1 = Math.pow; + var sin$1 = Math.sin; + var sign = Math.sign || function(x2) { + return x2 > 0 ? 1 : x2 < 0 ? -1 : 0; + }; + var sqrt$1 = Math.sqrt; + var tan = Math.tan; + function acos(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$1 : Math.acos(x2); + } + function asin$1(x2) { + return x2 > 1 ? halfPi$1 : x2 < -1 ? -halfPi$1 : Math.asin(x2); + } + function noop$2() { + } + function streamGeometry(geometry, stream2) { + if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { + streamGeometryType[geometry.type](geometry, stream2); + } + } + var streamObjectType = { + Feature: function(object2, stream2) { + streamGeometry(object2.geometry, stream2); + }, + FeatureCollection: function(object2, stream2) { + var features = object2.features, i = -1, n = features.length; + while (++i < n) streamGeometry(features[i].geometry, stream2); + } + }; + var streamGeometryType = { + Sphere: function(object2, stream2) { + stream2.sphere(); + }, + Point: function(object2, stream2) { + object2 = object2.coordinates; + stream2.point(object2[0], object2[1], object2[2]); + }, + MultiPoint: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) object2 = coordinates[i], stream2.point(object2[0], object2[1], object2[2]); + }, + LineString: function(object2, stream2) { + streamLine(object2.coordinates, stream2, 0); + }, + MultiLineString: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamLine(coordinates[i], stream2, 0); + }, + Polygon: function(object2, stream2) { + streamPolygon(object2.coordinates, stream2); + }, + MultiPolygon: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamPolygon(coordinates[i], stream2); + }, + GeometryCollection: function(object2, stream2) { + var geometries = object2.geometries, i = -1, n = geometries.length; + while (++i < n) streamGeometry(geometries[i], stream2); + } + }; + function streamLine(coordinates, stream2, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + stream2.lineStart(); + while (++i < n) coordinate = coordinates[i], stream2.point(coordinate[0], coordinate[1], coordinate[2]); + stream2.lineEnd(); + } + function streamPolygon(coordinates, stream2) { + var i = -1, n = coordinates.length; + stream2.polygonStart(); + while (++i < n) streamLine(coordinates[i], stream2, 1); + stream2.polygonEnd(); + } + function geoStream(object2, stream2) { + if (object2 && streamObjectType.hasOwnProperty(object2.type)) { + streamObjectType[object2.type](object2, stream2); + } else { + streamGeometry(object2, stream2); + } + } + var areaRingSum$1 = new Adder(); + var areaSum$1 = new Adder(), lambda00$2, phi00$2, lambda0$1, cosPhi0, sinPhi0; + var areaStream$1 = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaRingSum$1 = new Adder(); + areaStream$1.lineStart = areaRingStart$1; + areaStream$1.lineEnd = areaRingEnd$1; + }, + polygonEnd: function() { + var areaRing = +areaRingSum$1; + areaSum$1.add(areaRing < 0 ? tau$1 + areaRing : areaRing); + this.lineStart = this.lineEnd = this.point = noop$2; + }, + sphere: function() { + areaSum$1.add(tau$1); + } + }; + function areaRingStart$1() { + areaStream$1.point = areaPointFirst$1; + } + function areaRingEnd$1() { + areaPoint$1(lambda00$2, phi00$2); + } + function areaPointFirst$1(lambda, phi2) { + areaStream$1.point = areaPoint$1; + lambda00$2 = lambda, phi00$2 = phi2; + lambda *= radians, phi2 *= radians; + lambda0$1 = lambda, cosPhi0 = cos$1(phi2 = phi2 / 2 + quarterPi), sinPhi0 = sin$1(phi2); + } + function areaPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + phi2 = phi2 / 2 + quarterPi; + var dLambda = lambda - lambda0$1, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos$1(phi2), sinPhi = sin$1(phi2), k = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k * cos$1(adLambda), v = k * sdLambda * sin$1(adLambda); + areaRingSum$1.add(atan2(v, u2)); + lambda0$1 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; + } + function geoArea$1(object2) { + areaSum$1 = new Adder(); + geoStream(object2, areaStream$1); + return areaSum$1 * 2; + } + function spherical(cartesian2) { + return [atan2(cartesian2[1], cartesian2[0]), asin$1(cartesian2[2])]; + } + function cartesian(spherical2) { + var lambda = spherical2[0], phi2 = spherical2[1], cosPhi = cos$1(phi2); + return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)]; + } + function cartesianDot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cartesianCross(a2, b2) { + return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]]; + } + function cartesianAddInPlace(a2, b2) { + a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2]; + } + function cartesianScale(vector, k) { + return [vector[0] * k, vector[1] * k, vector[2] * k]; + } + function cartesianNormalizeInPlace(d) { + var l = sqrt$1(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + d[0] /= l, d[1] /= l, d[2] /= l; + } + var lambda0, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, deltaSum, ranges, range$2; + var boundsStream$1 = { + point: boundsPoint$1, + lineStart: boundsLineStart, + lineEnd: boundsLineEnd, + polygonStart: function() { + boundsStream$1.point = boundsRingPoint; + boundsStream$1.lineStart = boundsRingStart; + boundsStream$1.lineEnd = boundsRingEnd; + deltaSum = new Adder(); + areaStream$1.polygonStart(); + }, + polygonEnd: function() { + areaStream$1.polygonEnd(); + boundsStream$1.point = boundsPoint$1; + boundsStream$1.lineStart = boundsLineStart; + boundsStream$1.lineEnd = boundsLineEnd; + if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); + else if (deltaSum > epsilon$3) phi1 = 90; + else if (deltaSum < -epsilon$3) phi0 = -90; + range$2[0] = lambda0, range$2[1] = lambda1; + }, + sphere: function() { + lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); + } + }; + function boundsPoint$1(lambda, phi2) { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + function linePoint(lambda, phi2) { + var p = cartesian([lambda * radians, phi2 * radians]); + if (p0) { + var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal); + cartesianNormalizeInPlace(inflection); + inflection = spherical(inflection); + var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs$1(delta) > 180; + if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = inflection[1] * degrees; + if (phii > phi1) phi1 = phii; + } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = -inflection[1] * degrees; + if (phii < phi0) phi0 = phii; + } else { + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + if (antimeridian) { + if (lambda < lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } + } else { + if (lambda1 >= lambda0) { + if (lambda < lambda0) lambda0 = lambda; + if (lambda > lambda1) lambda1 = lambda; + } else { + if (lambda > lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } + } + } + } else { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); + } + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + p0 = p, lambda2 = lambda; + } + function boundsLineStart() { + boundsStream$1.point = linePoint; + } + function boundsLineEnd() { + range$2[0] = lambda0, range$2[1] = lambda1; + boundsStream$1.point = boundsPoint$1; + p0 = null; + } + function boundsRingPoint(lambda, phi2) { + if (p0) { + var delta = lambda - lambda2; + deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); + } else { + lambda00$1 = lambda, phi00$1 = phi2; + } + areaStream$1.point(lambda, phi2); + linePoint(lambda, phi2); + } + function boundsRingStart() { + areaStream$1.lineStart(); + } + function boundsRingEnd() { + boundsRingPoint(lambda00$1, phi00$1); + areaStream$1.lineEnd(); + if (abs$1(deltaSum) > epsilon$3) lambda0 = -(lambda1 = 180); + range$2[0] = lambda0, range$2[1] = lambda1; + p0 = null; + } + function angle(lambda02, lambda12) { + return (lambda12 -= lambda02) < 0 ? lambda12 + 360 : lambda12; + } + function rangeCompare(a2, b2) { + return a2[0] - b2[0]; + } + function rangeContains(range2, x2) { + return range2[0] <= range2[1] ? range2[0] <= x2 && x2 <= range2[1] : x2 < range2[0] || range2[1] < x2; + } + function geoBounds$1(feature2) { + var i, n, a2, b2, merged, deltaMax, delta; + phi1 = lambda1 = -(lambda0 = phi0 = Infinity); + ranges = []; + geoStream(feature2, boundsStream$1); + if (n = ranges.length) { + ranges.sort(rangeCompare); + for (i = 1, a2 = ranges[0], merged = [a2]; i < n; ++i) { + b2 = ranges[i]; + if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) { + if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1]; + if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0]; + } else { + merged.push(a2 = b2); + } + } + for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a2 = merged[n]; i <= n; a2 = b2, ++i) { + b2 = merged[i]; + if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda0 = b2[0], lambda1 = a2[1]; + } + } + ranges = range$2 = null; + return lambda0 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]]; + } + var W0, W1, X0$1, Y0$1, Z0$1, X1$1, Y1$1, Z1$1, X2$1, Y2$1, Z2$1, lambda00, phi00, x0$4, y0$4, z0; + var centroidStream$1 = { + sphere: noop$2, + point: centroidPoint$1, + lineStart: centroidLineStart$1, + lineEnd: centroidLineEnd$1, + polygonStart: function() { + centroidStream$1.lineStart = centroidRingStart$1; + centroidStream$1.lineEnd = centroidRingEnd$1; + }, + polygonEnd: function() { + centroidStream$1.lineStart = centroidLineStart$1; + centroidStream$1.lineEnd = centroidLineEnd$1; + } + }; + function centroidPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)); + } + function centroidPointCartesian(x2, y2, z) { + ++W0; + X0$1 += (x2 - X0$1) / W0; + Y0$1 += (y2 - Y0$1) / W0; + Z0$1 += (z - Z0$1) / W0; + } + function centroidLineStart$1() { + centroidStream$1.point = centroidLinePointFirst; + } + function centroidLinePointFirst(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidStream$1.point = centroidLinePoint; + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLinePoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z = sin$1(phi2), w2 = atan2(sqrt$1((w2 = y0$4 * z - z0 * y2) * w2 + (w2 = z0 * x2 - x0$4 * z) * w2 + (w2 = x0$4 * y2 - y0$4 * x2) * w2), x0$4 * x2 + y0$4 * y2 + z0 * z); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLineEnd$1() { + centroidStream$1.point = centroidPoint$1; + } + function centroidRingStart$1() { + centroidStream$1.point = centroidRingPointFirst; + } + function centroidRingEnd$1() { + centroidRingPoint(lambda00, phi00); + centroidStream$1.point = centroidPoint$1; + } + function centroidRingPointFirst(lambda, phi2) { + lambda00 = lambda, phi00 = phi2; + lambda *= radians, phi2 *= radians; + centroidStream$1.point = centroidRingPoint; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidRingPoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z = sin$1(phi2), cx = y0$4 * z - z0 * y2, cy = z0 * x2 - x0$4 * z, cz = x0$4 * y2 - y0$4 * x2, m2 = hypot(cx, cy, cz), w2 = asin$1(m2), v = m2 && -w2 / m2; + X2$1.add(v * cx); + Y2$1.add(v * cy); + Z2$1.add(v * cz); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function geoCentroid$1(object2) { + W0 = W1 = X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = 0; + X2$1 = new Adder(); + Y2$1 = new Adder(); + Z2$1 = new Adder(); + geoStream(object2, centroidStream$1); + var x2 = +X2$1, y2 = +Y2$1, z = +Z2$1, m2 = hypot(x2, y2, z); + if (m2 < epsilon2) { + x2 = X1$1, y2 = Y1$1, z = Z1$1; + if (W1 < epsilon$3) x2 = X0$1, y2 = Y0$1, z = Z0$1; + m2 = hypot(x2, y2, z); + if (m2 < epsilon2) return [NaN, NaN]; + } + return [atan2(y2, x2) * degrees, asin$1(z / m2) * degrees]; + } + function compose(a2, b2) { + function compose2(x2, y2) { + return x2 = a2(x2, y2), b2(x2[0], x2[1]); + } + if (a2.invert && b2.invert) compose2.invert = function(x2, y2) { + return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]); + }; + return compose2; + } + function rotationIdentity(lambda, phi2) { + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + } + rotationIdentity.invert = rotationIdentity; + function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { + return (deltaLambda %= tau$1) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; + } + function forwardRotationLambda(deltaLambda) { + return function(lambda, phi2) { + lambda += deltaLambda; + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + }; + } + function rotationLambda(deltaLambda) { + var rotation2 = forwardRotationLambda(deltaLambda); + rotation2.invert = forwardRotationLambda(-deltaLambda); + return rotation2; + } + function rotationPhiGamma(deltaPhi, deltaGamma) { + var cosDeltaPhi = cos$1(deltaPhi), sinDeltaPhi = sin$1(deltaPhi), cosDeltaGamma = cos$1(deltaGamma), sinDeltaGamma = sin$1(deltaGamma); + function rotation2(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z = sin$1(phi2), k = z * cosDeltaPhi + x2 * sinDeltaPhi; + return [ + atan2(y2 * cosDeltaGamma - k * sinDeltaGamma, x2 * cosDeltaPhi - z * sinDeltaPhi), + asin$1(k * cosDeltaGamma + y2 * sinDeltaGamma) + ]; + } + rotation2.invert = function(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z = sin$1(phi2), k = z * cosDeltaGamma - y2 * sinDeltaGamma; + return [ + atan2(y2 * cosDeltaGamma + z * sinDeltaGamma, x2 * cosDeltaPhi + k * sinDeltaPhi), + asin$1(k * cosDeltaPhi - x2 * sinDeltaPhi) + ]; + }; + return rotation2; + } + function rotation(rotate2) { + rotate2 = rotateRadians(rotate2[0] * radians, rotate2[1] * radians, rotate2.length > 2 ? rotate2[2] * radians : 0); + function forward(coordinates) { + coordinates = rotate2(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate2.invert(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + }; + return forward; + } + function circleStream(stream2, radius2, delta, direction, t02, t12) { + if (!delta) return; + var cosRadius = cos$1(radius2), sinRadius = sin$1(radius2), step = direction * delta; + if (t02 == null) { + t02 = radius2 + direction * tau$1; + t12 = radius2 - step / 2; + } else { + t02 = circleRadius(cosRadius, t02); + t12 = circleRadius(cosRadius, t12); + if (direction > 0 ? t02 < t12 : t02 > t12) t02 += direction * tau$1; + } + for (var point2, t = t02; direction > 0 ? t > t12 : t < t12; t -= step) { + point2 = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]); + stream2.point(point2[0], point2[1]); + } + } + function circleRadius(cosRadius, point2) { + point2 = cartesian(point2), point2[0] -= cosRadius; + cartesianNormalizeInPlace(point2); + var radius2 = acos(-point2[1]); + return ((-point2[2] < 0 ? -radius2 : radius2) + tau$1 - epsilon$3) % tau$1; + } + function clipBuffer() { + var lines = [], line2; + return { + point: function(x2, y2, m2) { + line2.push([x2, y2, m2]); + }, + lineStart: function() { + lines.push(line2 = []); + }, + lineEnd: noop$2, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + }, + result: function() { + var result = lines; + lines = []; + line2 = null; + return result; + } + }; + } + function pointEqual(a2, b2) { + return abs$1(a2[0] - b2[0]) < epsilon$3 && abs$1(a2[1] - b2[1]) < epsilon$3; + } + function Intersection(point2, points2, other, entry2) { + this.x = point2; + this.z = points2; + this.o = other; + this.e = entry2; + this.v = false; + this.n = this.p = null; + } + function clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2) { + var subject = [], clip2 = [], i, n; + segments2.forEach(function(segment) { + if ((n2 = segment.length - 1) <= 0) return; + var n2, p02 = segment[0], p1 = segment[n2], x2; + if (pointEqual(p02, p1)) { + if (!p02[2] && !p1[2]) { + stream2.lineStart(); + for (i = 0; i < n2; ++i) stream2.point((p02 = segment[i])[0], p02[1]); + stream2.lineEnd(); + return; + } + p1[0] += 2 * epsilon$3; + } + subject.push(x2 = new Intersection(p02, segment, null, true)); + clip2.push(x2.o = new Intersection(p02, null, x2, false)); + subject.push(x2 = new Intersection(p1, segment, null, false)); + clip2.push(x2.o = new Intersection(p1, null, x2, true)); + }); + if (!subject.length) return; + clip2.sort(compareIntersection2); + link(subject); + link(clip2); + for (i = 0, n = clip2.length; i < n; ++i) { + clip2[i].e = startInside = !startInside; + } + var start = subject[0], points2, point2; + while (1) { + var current = start, isSubject = true; + while (current.v) if ((current = current.n) === start) return; + points2 = current.z; + stream2.lineStart(); + do { + current.v = current.o.v = true; + if (current.e) { + if (isSubject) { + for (i = 0, n = points2.length; i < n; ++i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.n.x, 1, stream2); + } + current = current.n; + } else { + if (isSubject) { + points2 = current.p.z; + for (i = points2.length - 1; i >= 0; --i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.p.x, -1, stream2); + } + current = current.p; + } + current = current.o; + points2 = current.z; + isSubject = !isSubject; + } while (!current.v); + stream2.lineEnd(); + } + } + function link(array2) { + if (!(n = array2.length)) return; + var n, i = 0, a2 = array2[0], b2; + while (++i < n) { + a2.n = b2 = array2[i]; + b2.p = a2; + a2 = b2; + } + a2.n = b2 = array2[0]; + b2.p = a2; + } + function longitude(point2) { + return abs$1(point2[0]) <= pi$1 ? point2[0] : sign(point2[0]) * ((abs$1(point2[0]) + pi$1) % tau$1 - pi$1); + } + function polygonContains(polygon, point2) { + var lambda = longitude(point2), phi2 = point2[1], sinPhi = sin$1(phi2), normal = [sin$1(lambda), -cos$1(lambda), 0], angle2 = 0, winding = 0; + var sum2 = new Adder(); + if (sinPhi === 1) phi2 = halfPi$1 + epsilon$3; + else if (sinPhi === -1) phi2 = -halfPi$1 - epsilon$3; + for (var i = 0, n = polygon.length; i < n; ++i) { + if (!(m2 = (ring = polygon[i]).length)) continue; + var ring, m2, point0 = ring[m2 - 1], lambda02 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi02 = sin$1(phi02), cosPhi02 = cos$1(phi02); + for (var j = 0; j < m2; ++j, lambda02 = lambda12, sinPhi02 = sinPhi1, cosPhi02 = cosPhi1, point0 = point1) { + var point1 = ring[j], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin$1(phi12), cosPhi1 = cos$1(phi12), delta = lambda12 - lambda02, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi$1, k = sinPhi02 * sinPhi1; + sum2.add(atan2(k * sign2 * sin$1(absDelta), cosPhi02 * cosPhi1 + k * cos$1(absDelta))); + angle2 += antimeridian ? delta + sign2 * tau$1 : delta; + if (antimeridian ^ lambda02 >= lambda ^ lambda12 >= lambda) { + var arc2 = cartesianCross(cartesian(point0), cartesian(point1)); + cartesianNormalizeInPlace(arc2); + var intersection2 = cartesianCross(normal, arc2); + cartesianNormalizeInPlace(intersection2); + var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection2[2]); + if (phi2 > phiArc || phi2 === phiArc && (arc2[0] || arc2[1])) { + winding += antimeridian ^ delta >= 0 ? 1 : -1; + } + } + } + } + return (angle2 < -epsilon$3 || angle2 < epsilon$3 && sum2 < -epsilon2) ^ winding & 1; + } + function clip$1(pointVisible, clipLine2, interpolate2, start) { + return function(sink) { + var line2 = clipLine2(sink), ringBuffer = clipBuffer(), ringSink = clipLine2(ringBuffer), polygonStarted = false, polygon, segments2, ring; + var clip2 = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + clip2.point = pointRing; + clip2.lineStart = ringStart; + clip2.lineEnd = ringEnd; + segments2 = []; + polygon = []; + }, + polygonEnd: function() { + clip2.point = point2; + clip2.lineStart = lineStart; + clip2.lineEnd = lineEnd; + segments2 = merge$2(segments2); + var startInside = polygonContains(polygon, start); + if (segments2.length) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + clipRejoin(segments2, compareIntersection, startInside, interpolate2, sink); + } else if (startInside) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + } + if (polygonStarted) sink.polygonEnd(), polygonStarted = false; + segments2 = polygon = null; + }, + sphere: function() { + sink.polygonStart(); + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + sink.polygonEnd(); + } + }; + function point2(lambda, phi2) { + if (pointVisible(lambda, phi2)) sink.point(lambda, phi2); + } + function pointLine(lambda, phi2) { + line2.point(lambda, phi2); + } + function lineStart() { + clip2.point = pointLine; + line2.lineStart(); + } + function lineEnd() { + clip2.point = point2; + line2.lineEnd(); + } + function pointRing(lambda, phi2) { + ring.push([lambda, phi2]); + ringSink.point(lambda, phi2); + } + function ringStart() { + ringSink.lineStart(); + ring = []; + } + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringSink.lineEnd(); + var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m2, segment, point3; + ring.pop(); + polygon.push(ring); + ring = null; + if (!n) return; + if (clean & 1) { + segment = ringSegments[0]; + if ((m2 = segment.length - 1) > 0) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + for (i = 0; i < m2; ++i) sink.point((point3 = segment[i])[0], point3[1]); + sink.lineEnd(); + } + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments2.push(ringSegments.filter(validSegment)); + } + return clip2; + }; + } + function validSegment(segment) { + return segment.length > 1; + } + function compareIntersection(a2, b2) { + return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi$1 - epsilon$3 : halfPi$1 - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi$1 - epsilon$3 : halfPi$1 - b2[1]); + } + const clipAntimeridian = clip$1( + function() { + return true; + }, + clipAntimeridianLine, + clipAntimeridianInterpolate, + [-pi$1, -halfPi$1] + ); + function clipAntimeridianLine(stream2) { + var lambda02 = NaN, phi02 = NaN, sign0 = NaN, clean; + return { + lineStart: function() { + stream2.lineStart(); + clean = 1; + }, + point: function(lambda12, phi12) { + var sign1 = lambda12 > 0 ? pi$1 : -pi$1, delta = abs$1(lambda12 - lambda02); + if (abs$1(delta - pi$1) < epsilon$3) { + stream2.point(lambda02, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi$1 : -halfPi$1); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + stream2.point(lambda12, phi02); + clean = 0; + } else if (sign0 !== sign1 && delta >= pi$1) { + if (abs$1(lambda02 - sign0) < epsilon$3) lambda02 -= sign0 * epsilon$3; + if (abs$1(lambda12 - sign1) < epsilon$3) lambda12 -= sign1 * epsilon$3; + phi02 = clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + clean = 0; + } + stream2.point(lambda02 = lambda12, phi02 = phi12); + sign0 = sign1; + }, + lineEnd: function() { + stream2.lineEnd(); + lambda02 = phi02 = NaN; + }, + clean: function() { + return 2 - clean; + } + }; + } + function clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12) { + var cosPhi02, cosPhi1, sinLambda0Lambda1 = sin$1(lambda02 - lambda12); + return abs$1(sinLambda0Lambda1) > epsilon$3 ? atan((sin$1(phi02) * (cosPhi1 = cos$1(phi12)) * sin$1(lambda12) - sin$1(phi12) * (cosPhi02 = cos$1(phi02)) * sin$1(lambda02)) / (cosPhi02 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2; + } + function clipAntimeridianInterpolate(from, to, direction, stream2) { + var phi2; + if (from == null) { + phi2 = direction * halfPi$1; + stream2.point(-pi$1, phi2); + stream2.point(0, phi2); + stream2.point(pi$1, phi2); + stream2.point(pi$1, 0); + stream2.point(pi$1, -phi2); + stream2.point(0, -phi2); + stream2.point(-pi$1, -phi2); + stream2.point(-pi$1, 0); + stream2.point(-pi$1, phi2); + } else if (abs$1(from[0] - to[0]) > epsilon$3) { + var lambda = from[0] < to[0] ? pi$1 : -pi$1; + phi2 = direction * lambda / 2; + stream2.point(-lambda, phi2); + stream2.point(0, phi2); + stream2.point(lambda, phi2); + } else { + stream2.point(to[0], to[1]); + } + } + function clipCircle(radius2) { + var cr2 = cos$1(radius2), delta = 2 * radians, smallRadius = cr2 > 0, notHemisphere = abs$1(cr2) > epsilon$3; + function interpolate2(from, to, direction, stream2) { + circleStream(stream2, radius2, delta, direction, from, to); + } + function visible(lambda, phi2) { + return cos$1(lambda) * cos$1(phi2) > cr2; + } + function clipLine2(stream2) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(lambda, phi2) { + var point1 = [lambda, phi2], point2, v = visible(lambda, phi2), c2 = smallRadius ? v ? 0 : code(lambda, phi2) : v ? code(lambda + (lambda < 0 ? pi$1 : -pi$1), phi2) : 0; + if (!point0 && (v00 = v0 = v)) stream2.lineStart(); + if (v !== v0) { + point2 = intersect2(point0, point1); + if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) + point1[2] = 1; + } + if (v !== v0) { + clean = 0; + if (v) { + stream2.lineStart(); + point2 = intersect2(point1, point0); + stream2.point(point2[0], point2[1]); + } else { + point2 = intersect2(point0, point1); + stream2.point(point2[0], point2[1], 2); + stream2.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c2 & c0) && (t = intersect2(point1, point0, true))) { + clean = 0; + if (smallRadius) { + stream2.lineStart(); + stream2.point(t[0][0], t[0][1]); + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + } else { + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(t[0][0], t[0][1], 3); + } + } + } + if (v && (!point0 || !pointEqual(point0, point1))) { + stream2.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c2; + }, + lineEnd: function() { + if (v0) stream2.lineEnd(); + point0 = null; + }, + // Rejoin first and last segments if there were intersections and the first + // and last points were visible. + clean: function() { + return clean | (v00 && v0) << 1; + } + }; + } + function intersect2(a2, b2, two) { + var pa2 = cartesian(a2), pb = cartesian(b2); + var n1 = [1, 0, 0], n2 = cartesianCross(pa2, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a2; + var c1 = cr2 * n2n2 / determinant, c2 = -cr2 * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A5 = cartesianScale(n1, c1), B2 = cartesianScale(n2, c2); + cartesianAddInPlace(A5, B2); + var u2 = n1xn2, w2 = cartesianDot(A5, u2), uu = cartesianDot(u2, u2), t22 = w2 * w2 - uu * (cartesianDot(A5, A5) - 1); + if (t22 < 0) return; + var t = sqrt$1(t22), q = cartesianScale(u2, (-w2 - t) / uu); + cartesianAddInPlace(q, A5); + q = spherical(q); + if (!two) return q; + var lambda02 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z; + if (lambda12 < lambda02) z = lambda02, lambda02 = lambda12, lambda12 = z; + var delta2 = lambda12 - lambda02, polar = abs$1(delta2 - pi$1) < epsilon$3, meridian = polar || delta2 < epsilon$3; + if (!polar && phi12 < phi02) z = phi02, phi02 = phi12, phi12 = z; + if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs$1(q[0] - lambda02) < epsilon$3 ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi$1 ^ (lambda02 <= q[0] && q[0] <= lambda12)) { + var q1 = cartesianScale(u2, (-w2 + t) / uu); + cartesianAddInPlace(q1, A5); + return [q, spherical(q1)]; + } + } + function code(lambda, phi2) { + var r = smallRadius ? radius2 : pi$1 - radius2, code2 = 0; + if (lambda < -r) code2 |= 1; + else if (lambda > r) code2 |= 2; + if (phi2 < -r) code2 |= 4; + else if (phi2 > r) code2 |= 8; + return code2; + } + return clip$1(visible, clipLine2, interpolate2, smallRadius ? [0, -radius2] : [-pi$1, radius2 - pi$1]); + } + function clipLine(a2, b2, x02, y02, x12, y12) { + var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r; + r = x02 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dx > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = x12 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dx > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + r = y02 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dy > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = y12 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dy > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + if (t02 > 0) a2[0] = ax + t02 * dx, a2[1] = ay + t02 * dy; + if (t12 < 1) b2[0] = ax + t12 * dx, b2[1] = ay + t12 * dy; + return true; + } + var clipMax = 1e9, clipMin = -clipMax; + function clipRectangle(x02, y02, x12, y12) { + function visible(x2, y2) { + return x02 <= x2 && x2 <= x12 && y02 <= y2 && y2 <= y12; + } + function interpolate2(from, to, direction, stream2) { + var a2 = 0, a1 = 0; + if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { + do + stream2.point(a2 === 0 || a2 === 3 ? x02 : x12, a2 > 1 ? y12 : y02); + while ((a2 = (a2 + direction + 4) % 4) !== a1); + } else { + stream2.point(to[0], to[1]); + } + } + function corner(p, direction) { + return abs$1(p[0] - x02) < epsilon$3 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x12) < epsilon$3 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y02) < epsilon$3 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; + } + function compareIntersection2(a2, b2) { + return comparePoint(a2.x, b2.x); + } + function comparePoint(a2, b2) { + var ca = corner(a2, 1), cb = corner(b2, 1); + return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[0]; + } + return function(stream2) { + var activeStream = stream2, bufferStream = clipBuffer(), segments2, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; + var clipStream = { + point: point2, + lineStart, + lineEnd, + polygonStart, + polygonEnd + }; + function point2(x2, y2) { + if (visible(x2, y2)) activeStream.point(x2, y2); + } + function polygonInside() { + var winding = 0; + for (var i = 0, n = polygon.length; i < n; ++i) { + for (var ring2 = polygon[i], j = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j < m2; ++j) { + a0 = b0, a1 = b1, point3 = ring2[j], b0 = point3[0], b1 = point3[1]; + if (a1 <= y12) { + if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x02 - a0)) ++winding; + } else { + if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x02 - a0)) --winding; + } + } + } + return winding; + } + function polygonStart() { + activeStream = bufferStream, segments2 = [], polygon = [], clean = true; + } + function polygonEnd() { + var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments2 = merge$2(segments2)).length; + if (cleanInside || visible2) { + stream2.polygonStart(); + if (cleanInside) { + stream2.lineStart(); + interpolate2(null, null, 1, stream2); + stream2.lineEnd(); + } + if (visible2) { + clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2); + } + stream2.polygonEnd(); + } + activeStream = stream2, segments2 = polygon = ring = null; + } + function lineStart() { + clipStream.point = linePoint2; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + function lineEnd() { + if (segments2) { + linePoint2(x__, y__); + if (v__ && v_) bufferStream.rejoin(); + segments2.push(bufferStream.result()); + } + clipStream.point = point2; + if (v_) activeStream.lineEnd(); + } + function linePoint2(x2, y2) { + var v = visible(x2, y2); + if (polygon) ring.push([x2, y2]); + if (first) { + x__ = x2, y__ = y2, v__ = v; + first = false; + if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + } + } else { + if (v && v_) activeStream.point(x2, y2); + else { + var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))]; + if (clipLine(a2, b2, x02, y02, x12, y12)) { + if (!v_) { + activeStream.lineStart(); + activeStream.point(a2[0], a2[1]); + } + activeStream.point(b2[0], b2[1]); + if (!v) activeStream.lineEnd(); + clean = false; + } else if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + clean = false; + } + } + } + x_ = x2, y_ = y2, v_ = v; + } + return clipStream; + }; + } + function graticuleX(y02, y12, dy) { + var y2 = range$3(y02, y12 - epsilon$3, dy).concat(y12); + return function(x2) { + return y2.map(function(y3) { + return [x2, y3]; + }); + }; + } + function graticuleY(x02, x12, dx) { + var x2 = range$3(x02, x12 - epsilon$3, dx).concat(x12); + return function(y2) { + return x2.map(function(x3) { + return [x3, y2]; + }); + }; + } + function graticule() { + var x12, x02, X12, X02, y12, y02, Y12, Y02, dx = 10, dy = dx, DX = 90, DY = 360, x2, y2, X3, Y3, precision = 2.5; + function graticule2() { + return { type: "MultiLineString", coordinates: lines() }; + } + function lines() { + return range$3(ceil(X02 / DX) * DX, X12, DX).map(X3).concat(range$3(ceil(Y02 / DY) * DY, Y12, DY).map(Y3)).concat(range$3(ceil(x02 / dx) * dx, x12, dx).filter(function(x3) { + return abs$1(x3 % DX) > epsilon$3; + }).map(x2)).concat(range$3(ceil(y02 / dy) * dy, y12, dy).filter(function(y3) { + return abs$1(y3 % DY) > epsilon$3; + }).map(y2)); + } + graticule2.lines = function() { + return lines().map(function(coordinates) { + return { type: "LineString", coordinates }; + }); + }; + graticule2.outline = function() { + return { + type: "Polygon", + coordinates: [ + X3(X02).concat( + Y3(Y12).slice(1), + X3(X12).reverse().slice(1), + Y3(Y02).reverse().slice(1) + ) + ] + }; + }; + graticule2.extent = function(_) { + if (!arguments.length) return graticule2.extentMinor(); + return graticule2.extentMajor(_).extentMinor(_); + }; + graticule2.extentMajor = function(_) { + if (!arguments.length) return [[X02, Y02], [X12, Y12]]; + X02 = +_[0][0], X12 = +_[1][0]; + Y02 = +_[0][1], Y12 = +_[1][1]; + if (X02 > X12) _ = X02, X02 = X12, X12 = _; + if (Y02 > Y12) _ = Y02, Y02 = Y12, Y12 = _; + return graticule2.precision(precision); + }; + graticule2.extentMinor = function(_) { + if (!arguments.length) return [[x02, y02], [x12, y12]]; + x02 = +_[0][0], x12 = +_[1][0]; + y02 = +_[0][1], y12 = +_[1][1]; + if (x02 > x12) _ = x02, x02 = x12, x12 = _; + if (y02 > y12) _ = y02, y02 = y12, y12 = _; + return graticule2.precision(precision); + }; + graticule2.step = function(_) { + if (!arguments.length) return graticule2.stepMinor(); + return graticule2.stepMajor(_).stepMinor(_); + }; + graticule2.stepMajor = function(_) { + if (!arguments.length) return [DX, DY]; + DX = +_[0], DY = +_[1]; + return graticule2; + }; + graticule2.stepMinor = function(_) { + if (!arguments.length) return [dx, dy]; + dx = +_[0], dy = +_[1]; + return graticule2; + }; + graticule2.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x2 = graticuleX(y02, y12, 90); + y2 = graticuleY(x02, x12, precision); + X3 = graticuleX(Y02, Y12, 90); + Y3 = graticuleY(X02, X12, precision); + return graticule2; + }; + return graticule2.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]); + } + const identity$1 = (x2) => x2; + var areaSum = new Adder(), areaRingSum = new Adder(), x00$2, y00$2, x0$3, y0$3; + var areaStream = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaStream.lineStart = areaRingStart; + areaStream.lineEnd = areaRingEnd; + }, + polygonEnd: function() { + areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$2; + areaSum.add(abs$1(areaRingSum)); + areaRingSum = new Adder(); + }, + result: function() { + var area2 = areaSum / 2; + areaSum = new Adder(); + return area2; + } + }; + function areaRingStart() { + areaStream.point = areaPointFirst; + } + function areaPointFirst(x2, y2) { + areaStream.point = areaPoint; + x00$2 = x0$3 = x2, y00$2 = y0$3 = y2; + } + function areaPoint(x2, y2) { + areaRingSum.add(y0$3 * x2 - x0$3 * y2); + x0$3 = x2, y0$3 = y2; + } + function areaRingEnd() { + areaPoint(x00$2, y00$2); + } + var x0$2 = Infinity, y0$2 = x0$2, x1 = -x0$2, y1 = x1; + var boundsStream = { + point: boundsPoint, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: noop$2, + polygonEnd: noop$2, + result: function() { + var bounds2 = [[x0$2, y0$2], [x1, y1]]; + x1 = y1 = -(y0$2 = x0$2 = Infinity); + return bounds2; + } + }; + function boundsPoint(x2, y2) { + if (x2 < x0$2) x0$2 = x2; + if (x2 > x1) x1 = x2; + if (y2 < y0$2) y0$2 = y2; + if (y2 > y1) y1 = y2; + } + var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00$1, y00$1, x0$1, y0$1; + var centroidStream = { + point: centroidPoint, + lineStart: centroidLineStart, + lineEnd: centroidLineEnd, + polygonStart: function() { + centroidStream.lineStart = centroidRingStart; + centroidStream.lineEnd = centroidRingEnd; + }, + polygonEnd: function() { + centroidStream.point = centroidPoint; + centroidStream.lineStart = centroidLineStart; + centroidStream.lineEnd = centroidLineEnd; + }, + result: function() { + var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN]; + X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; + return centroid; + } + }; + function centroidPoint(x2, y2) { + X0 += x2; + Y0 += y2; + ++Z0; + } + function centroidLineStart() { + centroidStream.point = centroidPointFirstLine; + } + function centroidPointFirstLine(x2, y2) { + centroidStream.point = centroidPointLine; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidPointLine(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z = sqrt$1(dx * dx + dy * dy); + X1 += z * (x0$1 + x2) / 2; + Y1 += z * (y0$1 + y2) / 2; + Z1 += z; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidLineEnd() { + centroidStream.point = centroidPoint; + } + function centroidRingStart() { + centroidStream.point = centroidPointFirstRing; + } + function centroidRingEnd() { + centroidPointRing(x00$1, y00$1); + } + function centroidPointFirstRing(x2, y2) { + centroidStream.point = centroidPointRing; + centroidPoint(x00$1 = x0$1 = x2, y00$1 = y0$1 = y2); + } + function centroidPointRing(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z = sqrt$1(dx * dx + dy * dy); + X1 += z * (x0$1 + x2) / 2; + Y1 += z * (y0$1 + y2) / 2; + Z1 += z; + z = y0$1 * x2 - x0$1 * y2; + X2 += z * (x0$1 + x2); + Y2 += z * (y0$1 + y2); + Z2 += z * 3; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function PathContext(context2) { + this._context = context2; + } + PathContext.prototype = { + _radius: 4.5, + pointRadius: function(_) { + return this._radius = _, this; + }, + polygonStart: function() { + this._line = 0; + }, + polygonEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line === 0) this._context.closePath(); + this._point = NaN; + }, + point: function(x2, y2) { + switch (this._point) { + case 0: { + this._context.moveTo(x2, y2); + this._point = 1; + break; + } + case 1: { + this._context.lineTo(x2, y2); + break; + } + default: { + this._context.moveTo(x2 + this._radius, y2); + this._context.arc(x2, y2, this._radius, 0, tau$1); + break; + } + } + }, + result: noop$2 + }; + var lengthSum = new Adder(), lengthRing, x00, y00, x0, y0; + var lengthStream = { + point: noop$2, + lineStart: function() { + lengthStream.point = lengthPointFirst; + }, + lineEnd: function() { + if (lengthRing) lengthPoint(x00, y00); + lengthStream.point = noop$2; + }, + polygonStart: function() { + lengthRing = true; + }, + polygonEnd: function() { + lengthRing = null; + }, + result: function() { + var length2 = +lengthSum; + lengthSum = new Adder(); + return length2; + } + }; + function lengthPointFirst(x2, y2) { + lengthStream.point = lengthPoint; + x00 = x0 = x2, y00 = y0 = y2; + } + function lengthPoint(x2, y2) { + x0 -= x2, y0 -= y2; + lengthSum.add(sqrt$1(x0 * x0 + y0 * y0)); + x0 = x2, y0 = y2; + } + let cacheDigits, cacheAppend, cacheRadius, cacheCircle; + class PathString { + constructor(digits) { + this._append = digits == null ? append : appendRound(digits); + this._radius = 4.5; + this._ = ""; + } + pointRadius(_) { + this._radius = +_; + return this; + } + polygonStart() { + this._line = 0; + } + polygonEnd() { + this._line = NaN; + } + lineStart() { + this._point = 0; + } + lineEnd() { + if (this._line === 0) this._ += "Z"; + this._point = NaN; + } + point(x2, y2) { + switch (this._point) { + case 0: { + this._append`M${x2},${y2}`; + this._point = 1; + break; + } + case 1: { + this._append`L${x2},${y2}`; + break; + } + default: { + this._append`M${x2},${y2}`; + if (this._radius !== cacheRadius || this._append !== cacheAppend) { + const r = this._radius; + const s = this._; + this._ = ""; + this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; + cacheRadius = r; + cacheAppend = this._append; + cacheCircle = this._; + this._ = s; + } + this._ += cacheCircle; + break; + } + } + } + result() { + const result = this._; + this._ = ""; + return result.length ? result : null; + } + } + function append(strings) { + let i = 1; + this._ += strings[0]; + for (const j = strings.length; i < j; ++i) { + this._ += arguments[i] + strings[i]; + } + } + function appendRound(digits) { + const d = Math.floor(digits); + if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`); + if (d > 15) return append; + if (d !== cacheDigits) { + const k = 10 ** d; + cacheDigits = d; + cacheAppend = function append2(strings) { + let i = 1; + this._ += strings[0]; + for (const j = strings.length; i < j; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings[i]; + } + }; + } + return cacheAppend; + } + function geoPath(projection2, context2) { + let digits = 3, pointRadius = 4.5, projectionStream, contextStream; + function path2(object2) { + if (object2) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + geoStream(object2, projectionStream(contextStream)); + } + return contextStream.result(); + } + path2.area = function(object2) { + geoStream(object2, projectionStream(areaStream)); + return areaStream.result(); + }; + path2.measure = function(object2) { + geoStream(object2, projectionStream(lengthStream)); + return lengthStream.result(); + }; + path2.bounds = function(object2) { + geoStream(object2, projectionStream(boundsStream)); + return boundsStream.result(); + }; + path2.centroid = function(object2) { + geoStream(object2, projectionStream(centroidStream)); + return centroidStream.result(); + }; + path2.projection = function(_) { + if (!arguments.length) return projection2; + projectionStream = _ == null ? (projection2 = null, identity$1) : (projection2 = _).stream; + return path2; + }; + path2.context = function(_) { + if (!arguments.length) return context2; + contextStream = _ == null ? (context2 = null, new PathString(digits)) : new PathContext(context2 = _); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return path2; + }; + path2.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path2; + }; + path2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) digits = null; + else { + const d = Math.floor(_); + if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d; + } + if (context2 === null) contextStream = new PathString(digits); + return path2; + }; + return path2.projection(projection2).digits(digits).context(context2); + } + function transformer(methods2) { + return function(stream2) { + var s = new TransformStream(); + for (var key2 in methods2) s[key2] = methods2[key2]; + s.stream = stream2; + return s; + }; + } + function TransformStream() { + } + TransformStream.prototype = { + constructor: TransformStream, + point: function(x2, y2) { + this.stream.point(x2, y2); + }, + sphere: function() { + this.stream.sphere(); + }, + lineStart: function() { + this.stream.lineStart(); + }, + lineEnd: function() { + this.stream.lineEnd(); + }, + polygonStart: function() { + this.stream.polygonStart(); + }, + polygonEnd: function() { + this.stream.polygonEnd(); + } + }; + function fit$1(projection2, fitBounds, object2) { + var clip2 = projection2.clipExtent && projection2.clipExtent(); + projection2.scale(150).translate([0, 0]); + if (clip2 != null) projection2.clipExtent(null); + geoStream(object2, projection2.stream(boundsStream)); + fitBounds(boundsStream.result()); + if (clip2 != null) projection2.clipExtent(clip2); + return projection2; + } + function fitExtent(projection2, extent2, object2) { + return fit$1(projection2, function(b2) { + var w2 = extent2[1][0] - extent2[0][0], h2 = extent2[1][1] - extent2[0][1], k = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent2[0][0] + (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = +extent2[0][1] + (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitSize(projection2, size2, object2) { + return fitExtent(projection2, [[0, 0], size2], object2); + } + function fitWidth(projection2, width2, object2) { + return fit$1(projection2, function(b2) { + var w2 = +width2, k = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = -k * b2[0][1]; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitHeight(projection2, height2, object2) { + return fit$1(projection2, function(b2) { + var h2 = +height2, k = h2 / (b2[1][1] - b2[0][1]), x2 = -k * b2[0][0], y2 = (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + var maxDepth = 16, cosMinDistance = cos$1(30 * radians); + function resample(project2, delta2) { + return +delta2 ? resample$1(project2, delta2) : resampleNone(project2); + } + function resampleNone(project2) { + return transformer({ + point: function(x2, y2) { + x2 = project2(x2, y2); + this.stream.point(x2[0], x2[1]); + } + }); + } + function resample$1(project2, delta2) { + function resampleLineTo(x02, y02, lambda02, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream2) { + var dx = x12 - x02, dy = y12 - y02, d2 = dx * dx + dy * dy; + if (d2 > 4 * delta2 && depth--) { + var a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt$1(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin$1(c2 /= m2), lambda22 = abs$1(abs$1(c2) - 1) < epsilon$3 || abs$1(lambda02 - lambda12) < epsilon$3 ? (lambda02 + lambda12) / 2 : atan2(b2, a2), p = project2(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > delta2 || abs$1((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream2); + stream2.point(x2, y2); + resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream2); + } + } + } + return function(stream2) { + var lambda002, x002, y002, a00, b00, c00, lambda02, x02, y02, a0, b0, c0; + var resampleStream = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + stream2.polygonStart(); + resampleStream.lineStart = ringStart; + }, + polygonEnd: function() { + stream2.polygonEnd(); + resampleStream.lineStart = lineStart; + } + }; + function point2(x2, y2) { + x2 = project2(x2, y2); + stream2.point(x2[0], x2[1]); + } + function lineStart() { + x02 = NaN; + resampleStream.point = linePoint2; + stream2.lineStart(); + } + function linePoint2(lambda, phi2) { + var c2 = cartesian([lambda, phi2]), p = project2(lambda, phi2); + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x02 = p[0], y02 = p[1], lambda02 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream2); + stream2.point(x02, y02); + } + function lineEnd() { + resampleStream.point = point2; + stream2.lineEnd(); + } + function ringStart() { + lineStart(); + resampleStream.point = ringPoint; + resampleStream.lineEnd = ringEnd; + } + function ringPoint(lambda, phi2) { + linePoint2(lambda002 = lambda, phi2), x002 = x02, y002 = y02, a00 = a0, b00 = b0, c00 = c0; + resampleStream.point = linePoint2; + } + function ringEnd() { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x002, y002, lambda002, a00, b00, c00, maxDepth, stream2); + resampleStream.lineEnd = lineEnd; + lineEnd(); + } + return resampleStream; + }; + } + var transformRadians = transformer({ + point: function(x2, y2) { + this.stream.point(x2 * radians, y2 * radians); + } + }); + function transformRotate(rotate2) { + return transformer({ + point: function(x2, y2) { + var r = rotate2(x2, y2); + return this.stream.point(r[0], r[1]); + } + }); + } + function scaleTranslate(k, dx, dy, sx, sy) { + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [dx + k * x2, dy - k * y2]; + } + transform2.invert = function(x2, y2) { + return [(x2 - dx) / k * sx, (dy - y2) / k * sy]; + }; + return transform2; + } + function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { + if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); + var cosAlpha = cos$1(alpha), sinAlpha = sin$1(alpha), a2 = cosAlpha * k, b2 = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2]; + } + transform2.invert = function(x2, y2) { + return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)]; + }; + return transform2; + } + function projection$1(project2) { + return projectionMutator(function() { + return project2; + })(); + } + function projectionMutator(projectAt) { + var project2, k = 150, x2 = 480, y2 = 250, lambda = 0, phi2 = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate2, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity$1, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache2, cacheStream; + function projection2(point2) { + return projectRotateTransform(point2[0] * radians, point2[1] * radians); + } + function invert2(point2) { + point2 = projectRotateTransform.invert(point2[0], point2[1]); + return point2 && [point2[0] * degrees, point2[1] * degrees]; + } + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transformRadians(transformRotate(rotate2)(preclip(projectResample(postclip(cacheStream = stream2))))); + }; + projection2.preclip = function(_) { + return arguments.length ? (preclip = _, theta = void 0, reset2()) : preclip; + }; + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; + }; + projection2.clipAngle = function(_) { + return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset2()) : theta * degrees; + }; + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity$1) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + projection2.scale = function(_) { + return arguments.length ? (k = +_, recenter()) : k; + }; + projection2.translate = function(_) { + return arguments.length ? (x2 = +_[0], y2 = +_[1], recenter()) : [x2, y2]; + }; + projection2.center = function(_) { + return arguments.length ? (lambda = _[0] % 360 * radians, phi2 = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi2 * degrees]; + }; + projection2.rotate = function(_) { + return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; + }; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; + }; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; + }; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; + }; + projection2.precision = function(_) { + return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset2()) : sqrt$1(delta2); + }; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); + }; + projection2.fitSize = function(size2, object2) { + return fitSize(projection2, size2, object2); + }; + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); + }; + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); + }; + function recenter() { + var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project2(lambda, phi2)), transform2 = scaleTranslateRotate(k, x2 - center[0], y2 - center[1], sx, sy, alpha); + rotate2 = rotateRadians(deltaLambda, deltaPhi, deltaGamma); + projectTransform = compose(project2, transform2); + projectRotateTransform = compose(rotate2, projectTransform); + projectResample = resample(projectTransform, delta2); + return reset2(); + } + function reset2() { + cache2 = cacheStream = null; + return projection2; + } + return function() { + project2 = projectAt.apply(this, arguments); + projection2.invert = project2.invert && invert2; + return recenter(); + }; + } + function conicProjection(projectAt) { + var phi02 = 0, phi12 = pi$1 / 3, m2 = projectionMutator(projectAt), p = m2(phi02, phi12); + p.parallels = function(_) { + return arguments.length ? m2(phi02 = _[0] * radians, phi12 = _[1] * radians) : [phi02 * degrees, phi12 * degrees]; + }; + return p; + } + function cylindricalEqualAreaRaw(phi02) { + var cosPhi02 = cos$1(phi02); + function forward(lambda, phi2) { + return [lambda * cosPhi02, sin$1(phi2) / cosPhi02]; + } + forward.invert = function(x2, y2) { + return [x2 / cosPhi02, asin$1(y2 * cosPhi02)]; + }; + return forward; + } + function conicEqualAreaRaw(y02, y12) { + var sy0 = sin$1(y02), n = (sy0 + sin$1(y12)) / 2; + if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y02); + var c2 = 1 + sy0 * (2 * n - sy0), r0 = sqrt$1(c2) / n; + function project2(x2, y2) { + var r = sqrt$1(c2 - 2 * n * sin$1(y2)) / n; + return [r * sin$1(x2 *= n), r0 - r * cos$1(x2)]; + } + project2.invert = function(x2, y2) { + var r0y = r0 - y2, l = atan2(x2, abs$1(r0y)) * sign(r0y); + if (r0y * n < 0) + l -= pi$1 * sign(x2) * sign(r0y); + return [l / n, asin$1((c2 - (x2 * x2 + r0y * r0y) * n * n) / (2 * n))]; + }; + return project2; + } + function geoConicEqualArea() { + return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); + } + function geoAlbers() { + return geoConicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]); + } + function multiplex(streams) { + var n = streams.length; + return { + point: function(x2, y2) { + var i = -1; + while (++i < n) streams[i].point(x2, y2); + }, + sphere: function() { + var i = -1; + while (++i < n) streams[i].sphere(); + }, + lineStart: function() { + var i = -1; + while (++i < n) streams[i].lineStart(); + }, + lineEnd: function() { + var i = -1; + while (++i < n) streams[i].lineEnd(); + }, + polygonStart: function() { + var i = -1; + while (++i < n) streams[i].polygonStart(); + }, + polygonEnd: function() { + var i = -1; + while (++i < n) streams[i].polygonEnd(); + } + }; + } + function geoAlbersUsa() { + var cache2, cacheStream, lower48 = geoAlbers(), lower48Point, alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point2, pointStream = { point: function(x2, y2) { + point2 = [x2, y2]; + } }; + function albersUsa(coordinates) { + var x2 = coordinates[0], y2 = coordinates[1]; + return point2 = null, (lower48Point.point(x2, y2), point2) || (alaskaPoint.point(x2, y2), point2) || (hawaiiPoint.point(x2, y2), point2); + } + albersUsa.invert = function(coordinates) { + var k = lower48.scale(), t = lower48.translate(), x2 = (coordinates[0] - t[0]) / k, y2 = (coordinates[1] - t[1]) / k; + return (y2 >= 0.12 && y2 < 0.234 && x2 >= -0.425 && x2 < -0.214 ? alaska : y2 >= 0.166 && y2 < 0.234 && x2 >= -0.214 && x2 < -0.115 ? hawaii : lower48).invert(coordinates); + }; + albersUsa.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = multiplex([lower48.stream(cacheStream = stream2), alaska.stream(stream2), hawaii.stream(stream2)]); + }; + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_), alaska.precision(_), hawaii.precision(_); + return reset2(); + }; + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x2 = +_[0], y2 = +_[1]; + lower48Point = lower48.translate(_).clipExtent([[x2 - 0.455 * k, y2 - 0.238 * k], [x2 + 0.455 * k, y2 + 0.238 * k]]).stream(pointStream); + alaskaPoint = alaska.translate([x2 - 0.307 * k, y2 + 0.201 * k]).clipExtent([[x2 - 0.425 * k + epsilon$3, y2 + 0.12 * k + epsilon$3], [x2 - 0.214 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + hawaiiPoint = hawaii.translate([x2 - 0.205 * k, y2 + 0.212 * k]).clipExtent([[x2 - 0.214 * k + epsilon$3, y2 + 0.166 * k + epsilon$3], [x2 - 0.115 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + return reset2(); + }; + albersUsa.fitExtent = function(extent2, object2) { + return fitExtent(albersUsa, extent2, object2); + }; + albersUsa.fitSize = function(size2, object2) { + return fitSize(albersUsa, size2, object2); + }; + albersUsa.fitWidth = function(width2, object2) { + return fitWidth(albersUsa, width2, object2); + }; + albersUsa.fitHeight = function(height2, object2) { + return fitHeight(albersUsa, height2, object2); + }; + function reset2() { + cache2 = cacheStream = null; + return albersUsa; + } + return albersUsa.scale(1070); + } + function azimuthalRaw(scale2) { + return function(x2, y2) { + var cx = cos$1(x2), cy = cos$1(y2), k = scale2(cx * cy); + if (k === Infinity) return [2, 0]; + return [ + k * cy * sin$1(x2), + k * sin$1(y2) + ]; + }; + } + function azimuthalInvert(angle2) { + return function(x2, y2) { + var z = sqrt$1(x2 * x2 + y2 * y2), c2 = angle2(z), sc = sin$1(c2), cc = cos$1(c2); + return [ + atan2(x2 * sc, z * cc), + asin$1(z && y2 * sc / z) + ]; + }; + } + var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { + return sqrt$1(2 / (1 + cxcy)); + }); + azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { + return 2 * asin$1(z / 2); + }); + function geoAzimuthalEqualArea() { + return projection$1(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); + } + var azimuthalEquidistantRaw = azimuthalRaw(function(c2) { + return (c2 = acos(c2)) && c2 / sin$1(c2); + }); + azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { + return z; + }); + function geoAzimuthalEquidistant() { + return projection$1(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); + } + function mercatorRaw(lambda, phi2) { + return [lambda, log$1(tan((halfPi$1 + phi2) / 2))]; + } + mercatorRaw.invert = function(x2, y2) { + return [x2, 2 * atan(exp(y2)) - halfPi$1]; + }; + function geoMercator() { + return mercatorProjection(mercatorRaw).scale(961 / tau$1); + } + function mercatorProjection(project2) { + var m2 = projection$1(project2), center = m2.center, scale2 = m2.scale, translate2 = m2.translate, clipExtent = m2.clipExtent, x02 = null, y02, x12, y12; + m2.scale = function(_) { + return arguments.length ? (scale2(_), reclip()) : scale2(); + }; + m2.translate = function(_) { + return arguments.length ? (translate2(_), reclip()) : translate2(); + }; + m2.center = function(_) { + return arguments.length ? (center(_), reclip()) : center(); + }; + m2.clipExtent = function(_) { + return arguments.length ? (_ == null ? x02 = y02 = x12 = y12 = null : (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + function reclip() { + var k = pi$1 * scale2(), t = m2(rotation(m2.rotate()).invert([0, 0])); + return clipExtent(x02 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project2 === mercatorRaw ? [[Math.max(t[0] - k, x02), y02], [Math.min(t[0] + k, x12), y12]] : [[x02, Math.max(t[1] - k, y02)], [x12, Math.min(t[1] + k, y12)]]); + } + return reclip(); + } + function tany(y2) { + return tan((halfPi$1 + y2) / 2); + } + function conicConformalRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : log$1(cy0 / cos$1(y12)) / log$1(tany(y12) / tany(y02)), f = cy0 * pow$1(tany(y02), n) / n; + if (!n) return mercatorRaw; + function project2(x2, y2) { + if (f > 0) { + if (y2 < -halfPi$1 + epsilon$3) y2 = -halfPi$1 + epsilon$3; + } else { + if (y2 > halfPi$1 - epsilon$3) y2 = halfPi$1 - epsilon$3; + } + var r = f / pow$1(tany(y2), n); + return [r * sin$1(n * x2), f - r * cos$1(n * x2)]; + } + project2.invert = function(x2, y2) { + var fy = f - y2, r = sign(n) * sqrt$1(x2 * x2 + fy * fy), l = atan2(x2, abs$1(fy)) * sign(fy); + if (fy * n < 0) + l -= pi$1 * sign(x2) * sign(fy); + return [l / n, 2 * atan(pow$1(f / r, 1 / n)) - halfPi$1]; + }; + return project2; + } + function geoConicConformal() { + return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); + } + function equirectangularRaw(lambda, phi2) { + return [lambda, phi2]; + } + equirectangularRaw.invert = equirectangularRaw; + function geoEquirectangular() { + return projection$1(equirectangularRaw).scale(152.63); + } + function conicEquidistantRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : (cy0 - cos$1(y12)) / (y12 - y02), g = cy0 / n + y02; + if (abs$1(n) < epsilon$3) return equirectangularRaw; + function project2(x2, y2) { + var gy = g - y2, nx = n * x2; + return [gy * sin$1(nx), g - gy * cos$1(nx)]; + } + project2.invert = function(x2, y2) { + var gy = g - y2, l = atan2(x2, abs$1(gy)) * sign(gy); + if (gy * n < 0) + l -= pi$1 * sign(x2) * sign(gy); + return [l / n, g - sign(n) * sqrt$1(x2 * x2 + gy * gy)]; + }; + return project2; + } + function geoConicEquidistant() { + return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); + } + var A1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt$1(3) / 2, iterations = 12; + function equalEarthRaw(lambda, phi2) { + var l = asin$1(M * sin$1(phi2)), l2 = l * l, l6 = l2 * l2 * l2; + return [ + lambda * cos$1(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), + l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) + ]; + } + equalEarthRaw.invert = function(x2, y2) { + var l = y2, l2 = l * l, l6 = l2 * l2 * l2; + for (var i = 0, delta, fy, fpy; i < iterations; ++i) { + fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y2; + fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); + l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; + if (abs$1(delta) < epsilon2) break; + } + return [ + M * x2 * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), + asin$1(sin$1(l) / M) + ]; + }; + function geoEqualEarth() { + return projection$1(equalEarthRaw).scale(177.158); + } + function gnomonicRaw(x2, y2) { + var cy = cos$1(y2), k = cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + gnomonicRaw.invert = azimuthalInvert(atan); + function geoGnomonic() { + return projection$1(gnomonicRaw).scale(144.049).clipAngle(60); + } + function geoIdentity() { + var k = 1, tx2 = 0, ty2 = 0, sx = 1, sy = 1, alpha = 0, ca, sa2, x02 = null, y02, x12, y12, kx = 1, ky = 1, transform2 = transformer({ + point: function(x2, y2) { + var p = projection2([x2, y2]); + this.stream.point(p[0], p[1]); + } + }), postclip = identity$1, cache2, cacheStream; + function reset2() { + kx = k * sx; + ky = k * sy; + cache2 = cacheStream = null; + return projection2; + } + function projection2(p) { + var x2 = p[0] * kx, y2 = p[1] * ky; + if (alpha) { + var t = y2 * ca - x2 * sa2; + x2 = x2 * ca + y2 * sa2; + y2 = t; + } + return [x2 + tx2, y2 + ty2]; + } + projection2.invert = function(p) { + var x2 = p[0] - tx2, y2 = p[1] - ty2; + if (alpha) { + var t = y2 * ca + x2 * sa2; + x2 = x2 * ca - y2 * sa2; + y2 = t; + } + return [x2 / kx, y2 / ky]; + }; + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transform2(postclip(cacheStream = stream2)); + }; + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; + }; + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity$1) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + projection2.scale = function(_) { + return arguments.length ? (k = +_, reset2()) : k; + }; + projection2.translate = function(_) { + return arguments.length ? (tx2 = +_[0], ty2 = +_[1], reset2()) : [tx2, ty2]; + }; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, sa2 = sin$1(alpha), ca = cos$1(alpha), reset2()) : alpha * degrees; + }; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, reset2()) : sx < 0; + }; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, reset2()) : sy < 0; + }; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); + }; + projection2.fitSize = function(size2, object2) { + return fitSize(projection2, size2, object2); + }; + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); + }; + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); + }; + return projection2; + } + function naturalEarth1Raw(lambda, phi2) { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; + return [ + lambda * (0.8707 - 0.131979 * phi22 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi22 - 1529e-6 * phi4))), + phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) + ]; + } + naturalEarth1Raw.invert = function(x2, y2) { + var phi2 = y2, i = 25, delta; + do { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; + phi2 -= delta = (phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) - y2) / (1.007226 + phi22 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi22 - 5916e-6 * 11 * phi4))); + } while (abs$1(delta) > epsilon$3 && --i > 0); + return [ + x2 / (0.8707 + (phi22 = phi2 * phi2) * (-0.131979 + phi22 * (-0.013791 + phi22 * phi22 * phi22 * (3971e-6 - 1529e-6 * phi22)))), + phi2 + ]; + }; + function geoNaturalEarth1() { + return projection$1(naturalEarth1Raw).scale(175.295); + } + function orthographicRaw(x2, y2) { + return [cos$1(y2) * sin$1(x2), sin$1(y2)]; + } + orthographicRaw.invert = azimuthalInvert(asin$1); + function geoOrthographic() { + return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3); + } + function stereographicRaw(x2, y2) { + var cy = cos$1(y2), k = 1 + cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + stereographicRaw.invert = azimuthalInvert(function(z) { + return 2 * atan(z); + }); + function geoStereographic() { + return projection$1(stereographicRaw).scale(250).clipAngle(142); + } + function transverseMercatorRaw(lambda, phi2) { + return [log$1(tan((halfPi$1 + phi2) / 2)), -lambda]; + } + transverseMercatorRaw.invert = function(x2, y2) { + return [-y2, 2 * atan(exp(x2)) - halfPi$1]; + }; + function geoTransverseMercator() { + var m2 = mercatorProjection(transverseMercatorRaw), center = m2.center, rotate2 = m2.rotate; + m2.center = function(_) { + return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); + }; + m2.rotate = function(_) { + return arguments.length ? rotate2([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate2(), [_[0], _[1], _[2] - 90]); + }; + return rotate2([0, 0, 90]).scale(159.155); + } + var abs = Math.abs; + var cos = Math.cos; + var sin = Math.sin; + var epsilon$2 = 1e-6; + var pi = Math.PI; + var halfPi = pi / 2; + var sqrt2 = sqrt(2); + function asin(x2) { + return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2); + } + function sqrt(x2) { + return x2 > 0 ? Math.sqrt(x2) : 0; + } + function mollweideBromleyTheta(cp, phi2) { + var cpsinPhi = cp * sin(phi2), i = 30, delta; + do + phi2 -= delta = (phi2 + sin(phi2) - cpsinPhi) / (1 + cos(phi2)); + while (abs(delta) > epsilon$2 && --i > 0); + return phi2 / 2; + } + function mollweideBromleyRaw(cx, cy, cp) { + function forward(lambda, phi2) { + return [cx * lambda * cos(phi2 = mollweideBromleyTheta(cp, phi2)), cy * sin(phi2)]; + } + forward.invert = function(x2, y2) { + return y2 = asin(y2 / cy), [x2 / (cx * cos(y2)), asin((2 * y2 + sin(2 * y2)) / cp)]; + }; + return forward; + } + var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); + function geoMollweide() { + return projection$1(mollweideRaw).scale(169.529); + } + const defaultPath = geoPath(); + const projectionProperties = [ + // standard properties in d3-geo + "clipAngle", + "clipExtent", + "scale", + "translate", + "center", + "rotate", + "parallels", + "precision", + "reflectX", + "reflectY", + // extended properties in d3-geo-projections + "coefficient", + "distance", + "fraction", + "lobes", + "parallel", + "radius", + "ratio", + "spacing", + "tilt" + ]; + function create$7(type2, constructor) { + return function projection2() { + const p = constructor(); + p.type = type2; + p.path = geoPath().projection(p); + p.copy = p.copy || function() { + const c2 = projection2(); + projectionProperties.forEach((prop) => { + if (p[prop]) c2[prop](p[prop]()); + }); + c2.path.pointRadius(p.path.pointRadius()); + return c2; + }; + return registerScale(p); + }; + } + function projection(type2, proj) { + if (!type2 || typeof type2 !== "string") { + throw new Error("Projection type must be a name string."); + } + type2 = type2.toLowerCase(); + if (arguments.length > 1) { + projections[type2] = create$7(type2, proj); + return this; + } else { + return projections[type2] || null; + } + } + function getProjectionPath(proj) { + return proj && proj.path || defaultPath; + } + const projections = { + // base d3-geo projection types + albers: geoAlbers, + albersusa: geoAlbersUsa, + azimuthalequalarea: geoAzimuthalEqualArea, + azimuthalequidistant: geoAzimuthalEquidistant, + conicconformal: geoConicConformal, + conicequalarea: geoConicEqualArea, + conicequidistant: geoConicEquidistant, + equalEarth: geoEqualEarth, + equirectangular: geoEquirectangular, + gnomonic: geoGnomonic, + identity: geoIdentity, + mercator: geoMercator, + mollweide: geoMollweide, + naturalEarth1: geoNaturalEarth1, + orthographic: geoOrthographic, + stereographic: geoStereographic, + transversemercator: geoTransverseMercator + }; + for (const key2 in projections) { + projection(key2, projections[key2]); + } + function noop$1() { + } + const cases = [[], [[[1, 1.5], [0.5, 1]]], [[[1.5, 1], [1, 1.5]]], [[[1.5, 1], [0.5, 1]]], [[[1, 0.5], [1.5, 1]]], [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]], [[[1, 0.5], [1, 1.5]]], [[[1, 0.5], [0.5, 1]]], [[[0.5, 1], [1, 0.5]]], [[[1, 1.5], [1, 0.5]]], [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]], [[[1.5, 1], [1, 0.5]]], [[[0.5, 1], [1.5, 1]]], [[[1, 1.5], [1.5, 1]]], [[[0.5, 1], [1, 1.5]]], []]; + function contours() { + var dx = 1, dy = 1, smooth = smoothLinear; + function contours2(values2, tz) { + return tz.map((value2) => contour(values2, value2)); + } + function contour(values2, value2) { + var polygons = [], holes = []; + isorings(values2, value2, (ring) => { + smooth(ring, values2, value2); + if (area(ring) > 0) polygons.push([ring]); + else holes.push(ring); + }); + holes.forEach((hole) => { + for (var i = 0, n = polygons.length, polygon; i < n; ++i) { + if (contains((polygon = polygons[i])[0], hole) !== -1) { + polygon.push(hole); + return; + } + } + }); + return { + type: "MultiPolygon", + value: value2, + coordinates: polygons + }; + } + function isorings(values2, value2, callback) { + var fragmentByStart = [], fragmentByEnd = [], x2, y2, t02, t12, t22, t32; + x2 = y2 = -1; + t12 = values2[0] >= value2; + cases[t12 << 1].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[x2 + 1] >= value2; + cases[t02 | t12 << 1].forEach(stitch2); + } + cases[t12 << 0].forEach(stitch2); + while (++y2 < dy - 1) { + x2 = -1; + t12 = values2[y2 * dx + dx] >= value2; + t22 = values2[y2 * dx] >= value2; + cases[t12 << 1 | t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[y2 * dx + dx + x2 + 1] >= value2; + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t02 | t12 << 1 | t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t12 | t22 << 3].forEach(stitch2); + } + x2 = -1; + t22 = values2[y2 * dx] >= value2; + cases[t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t22 << 3].forEach(stitch2); + function stitch2(line2) { + var start = [line2[0][0] + x2, line2[0][1] + y2], end = [line2[1][0] + x2, line2[1][1] + y2], startIndex = index2(start), endIndex = index2(end), f, g; + if (f = fragmentByEnd[startIndex]) { + if (g = fragmentByStart[endIndex]) { + delete fragmentByEnd[f.end]; + delete fragmentByStart[g.start]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[f.start] = fragmentByEnd[g.end] = { + start: f.start, + end: g.end, + ring: f.ring.concat(g.ring) + }; + } + } else { + delete fragmentByEnd[f.end]; + f.ring.push(end); + fragmentByEnd[f.end = endIndex] = f; + } + } else if (f = fragmentByStart[endIndex]) { + if (g = fragmentByEnd[startIndex]) { + delete fragmentByStart[f.start]; + delete fragmentByEnd[g.end]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[g.start] = fragmentByEnd[f.end] = { + start: g.start, + end: f.end, + ring: g.ring.concat(f.ring) + }; + } + } else { + delete fragmentByStart[f.start]; + f.ring.unshift(start); + fragmentByStart[f.start = startIndex] = f; + } + } else { + fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { + start: startIndex, + end: endIndex, + ring: [start, end] + }; + } + } + } + function index2(point2) { + return point2[0] * 2 + point2[1] * (dx + 1) * 4; + } + function smoothLinear(ring, values2, value2) { + ring.forEach((point2) => { + var x2 = point2[0], y2 = point2[1], xt = x2 | 0, yt = y2 | 0, v0, v1 = values2[yt * dx + xt]; + if (x2 > 0 && x2 < dx && xt === x2) { + v0 = values2[yt * dx + xt - 1]; + point2[0] = x2 + (value2 - v0) / (v1 - v0) - 0.5; + } + if (y2 > 0 && y2 < dy && yt === y2) { + v0 = values2[(yt - 1) * dx + xt]; + point2[1] = y2 + (value2 - v0) / (v1 - v0) - 0.5; + } + }); + } + contours2.contour = contour; + contours2.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, contours2; + }; + contours2.smooth = function(_) { + return arguments.length ? (smooth = _ ? smoothLinear : noop$1, contours2) : smooth === smoothLinear; + }; + return contours2; + } + function area(ring) { + var i = 0, n = ring.length, area2 = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; + while (++i < n) area2 += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; + return area2; + } + function contains(ring, hole) { + var i = -1, n = hole.length, c2; + while (++i < n) if (c2 = ringContains(ring, hole[i])) return c2; + return 0; + } + function ringContains(ring, point2) { + var x2 = point2[0], y2 = point2[1], contains2 = -1; + for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { + var pi2 = ring[i], xi = pi2[0], yi = pi2[1], pj = ring[j], xj = pj[0], yj = pj[1]; + if (segmentContains(pi2, pj, point2)) return 0; + if (yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi) contains2 = -contains2; + } + return contains2; + } + function segmentContains(a2, b2, c2) { + var i; + return collinear$1(a2, b2, c2) && within(a2[i = +(a2[0] === b2[0])], c2[i], b2[i]); + } + function collinear$1(a2, b2, c2) { + return (b2[0] - a2[0]) * (c2[1] - a2[1]) === (c2[0] - a2[0]) * (b2[1] - a2[1]); + } + function within(p, q, r) { + return p <= q && q <= r || r <= q && q <= p; + } + function quantize(k, nice2, zero2) { + return function(values2) { + var ex = extent(values2), start = zero2 ? Math.min(ex[0], 0) : ex[0], stop2 = ex[1], span2 = stop2 - start, step = nice2 ? tickStep(start, stop2, k) : span2 / (k + 1); + return range$3(start + step, stop2, step); + }; + } + function Isocontour(params2) { + Transform.call(this, null, params2); + } + Isocontour.Definition = { + "type": "Isocontour", + "metadata": { + "generates": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "levels", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "zero", + "type": "boolean", + "default": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }, { + "name": "scale", + "type": "number", + "expr": true + }, { + "name": "translate", + "type": "number", + "array": true, + "expr": true + }, { + "name": "as", + "type": "string", + "null": true, + "default": "contour" + }] + }; + inherits(Isocontour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, field2 = _.field || identity$7, contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source2, field2, _), as = _.as === null ? null : _.as || "contour", values2 = []; + source2.forEach((t) => { + const grid2 = field2(t); + const paths = contour.size([grid2.width, grid2.height])(grid2.values, isArray(tz) ? tz : tz(grid2.values)); + transformPaths(paths, grid2, t, _); + paths.forEach((p) => { + values2.push(rederive(t, ingest$1(as != null ? { + [as]: p + } : p))); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; + } + }); + function levels(values2, f, _) { + const q = quantize(_.levels || 10, _.nice, _.zero !== false); + return _.resolve !== "shared" ? q : q(values2.map((t) => max$3(f(t).values))); + } + function transformPaths(paths, grid2, datum2, _) { + let s = _.scale || grid2.scale, t = _.translate || grid2.translate; + if (isFunction(s)) s = s(datum2, _); + if (isFunction(t)) t = t(datum2, _); + if ((s === 1 || s == null) && !t) return; + const sx = (isNumber$1(s) ? s : s[0]) || 1, sy = (isNumber$1(s) ? s : s[1]) || 1, tx2 = t && t[0] || 0, ty2 = t && t[1] || 0; + paths.forEach(transform$1(grid2, sx, sy, tx2, ty2)); + } + function transform$1(grid2, sx, sy, tx2, ty2) { + const x12 = grid2.x1 || 0, y12 = grid2.y1 || 0, flip2 = sx * sy < 0; + function transformPolygon(coordinates) { + coordinates.forEach(transformRing); + } + function transformRing(coordinates) { + if (flip2) coordinates.reverse(); + coordinates.forEach(transformPoint); + } + function transformPoint(coordinates) { + coordinates[0] = (coordinates[0] - x12) * sx + tx2; + coordinates[1] = (coordinates[1] - y12) * sy + ty2; + } + return function(geometry) { + geometry.coordinates.forEach(transformPolygon); + return geometry; + }; + } + function radius(bw, data2, f) { + const v = bw >= 0 ? bw : estimateBandwidth(data2, f); + return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); + } + function number$2(_) { + return isFunction(_) ? _ : constant$5(+_); + } + function density2D() { + var x2 = (d) => d[0], y2 = (d) => d[1], weight = one$2, bandwidth2 = [-1, -1], dx = 960, dy = 500, k = 2; + function density2(data2, counts) { + const rx = radius(bandwidth2[0], data2, x2) >> k, ry = radius(bandwidth2[1], data2, y2) >> k, ox = rx ? rx + 2 : 0, oy = ry ? ry + 2 : 0, n = 2 * ox + (dx >> k), m2 = 2 * oy + (dy >> k), values0 = new Float32Array(n * m2), values1 = new Float32Array(n * m2); + let values2 = values0; + data2.forEach((d) => { + const xi = ox + (+x2(d) >> k), yi = oy + (+y2(d) >> k); + if (xi >= 0 && xi < n && yi >= 0 && yi < m2) { + values0[xi + yi * n] += +weight(d); + } + }); + if (rx > 0 && ry > 0) { + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + } else if (rx > 0) { + blurX(n, m2, values0, values1, rx); + blurX(n, m2, values1, values0, rx); + blurX(n, m2, values0, values1, rx); + values2 = values1; + } else if (ry > 0) { + blurY(n, m2, values0, values1, ry); + blurY(n, m2, values1, values0, ry); + blurY(n, m2, values0, values1, ry); + values2 = values1; + } + const s = counts ? Math.pow(2, -2 * k) : 1 / sum$1(values2); + for (let i = 0, sz2 = n * m2; i < sz2; ++i) values2[i] *= s; + return { + values: values2, + scale: 1 << k, + width: n, + height: m2, + x1: ox, + y1: oy, + x2: ox + (dx >> k), + y2: oy + (dy >> k) + }; + } + density2.x = function(_) { + return arguments.length ? (x2 = number$2(_), density2) : x2; + }; + density2.y = function(_) { + return arguments.length ? (y2 = number$2(_), density2) : y2; + }; + density2.weight = function(_) { + return arguments.length ? (weight = number$2(_), density2) : weight; + }; + density2.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = +_[0], _1 = +_[1]; + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, density2; + }; + density2.cellSize = function(_) { + if (!arguments.length) return 1 << k; + if (!((_ = +_) >= 1)) error("invalid cell size"); + k = Math.floor(Math.log(_) / Math.LN2); + return density2; + }; + density2.bandwidth = function(_) { + if (!arguments.length) return bandwidth2; + _ = array$5(_); + if (_.length === 1) _ = [+_[0], +_[0]]; + if (_.length !== 2) error("invalid bandwidth"); + return bandwidth2 = _, density2; + }; + return density2; + } + function blurX(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let j = 0; j < m2; ++j) { + for (let i = 0, sr = 0; i < n + r; ++i) { + if (i < n) { + sr += source2[i + j * n]; + } + if (i >= r) { + if (i >= w2) { + sr -= source2[i - w2 + j * n]; + } + target2[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w2 - i, w2); + } + } + } + } + function blurY(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let i = 0; i < n; ++i) { + for (let j = 0, sr = 0; j < m2 + r; ++j) { + if (j < m2) { + sr += source2[i + j * n]; + } + if (j >= r) { + if (j >= w2) { + sr -= source2[i + (j - w2) * n]; + } + target2[i + (j - r) * n] = sr / Math.min(j + 1, m2 - 1 + w2 - j, w2); + } + } + } + } + function KDE2D(params2) { + Transform.call(this, null, params2); + } + KDE2D.Definition = { + "type": "KDE2D", + "metadata": { + "generates": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "weight", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": "grid" + }] + }; + const PARAMS = ["x", "y", "weight", "size", "cellSize", "bandwidth"]; + function params(obj2, _) { + PARAMS.forEach((param2) => _[param2] != null ? obj2[param2](_[param2]) : 0); + return obj2; + } + inherits(KDE2D, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) return pulse2.StopPropagation; + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$2(source2, _.groupby), names = (_.groupby || []).map(accessorName), kde2 = params(density2D(), _), as = _.as || "grid", values2 = []; + function set2(t, vals) { + for (let i = 0; i < names.length; ++i) t[names[i]] = vals[i]; + return t; + } + values2 = groups.map((g) => ingest$1(set2({ + [as]: kde2(g, _.counts) + }, g.dims))); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; + } + }); + function partition$2(data2, groupby) { + var groups = [], get2 = (f) => f(t), map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); + } + g.push(t); + } + } + return groups; + } + function Contour(params2) { + Transform.call(this, null, params2); + } + Contour.Definition = { + "type": "Contour", + "metadata": { + "generates": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "values", + "type": "number", + "array": true + }, { + "name": "x", + "type": "field" + }, { + "name": "y", + "type": "field" + }, { + "name": "weight", + "type": "field" + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number" + }, { + "name": "count", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }] + }; + inherits(Contour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values2 = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values2), size2 = _.size, grid2, post; + if (!values2) { + values2 = pulse2.materialize(pulse2.SOURCE).source; + grid2 = params(density2D(), _)(values2, true); + post = transform$1(grid2, grid2.scale || 1, grid2.scale || 1, 0, 0); + size2 = [grid2.width, grid2.height]; + values2 = grid2.values; + } + thresh = isArray(thresh) ? thresh : thresh(values2); + values2 = contour.size(size2)(values2, thresh); + if (post) values2.forEach(post); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = (values2 || []).map(ingest$1); + return out; + } + }); + const Feature = "Feature"; + const FeatureCollection = "FeatureCollection"; + const MultiPoint = "MultiPoint"; + function GeoJSON(params2) { + Transform.call(this, null, params2); + } + GeoJSON.Definition = { + "type": "GeoJSON", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "length": 2 + }, { + "name": "geojson", + "type": "field" + }] + }; + inherits(GeoJSON, Transform, { + transform(_, pulse2) { + var features = this._features, points2 = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && identity$7, flag2 = pulse2.ADD, mod; + mod = _.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(geojson)) || lon && pulse2.modified(accessorFields(lon)) || lat && pulse2.modified(accessorFields(lat)); + if (!this.value || mod) { + flag2 = pulse2.SOURCE; + this._features = features = []; + this._points = points2 = []; + } + if (geojson) { + pulse2.visit(flag2, (t) => features.push(geojson(t))); + } + if (lon && lat) { + pulse2.visit(flag2, (t) => { + var x2 = lon(t), y2 = lat(t); + if (x2 != null && y2 != null && (x2 = +x2) === x2 && (y2 = +y2) === y2) { + points2.push([x2, y2]); + } + }); + features = features.concat({ + type: Feature, + geometry: { + type: MultiPoint, + coordinates: points2 + } + }); + } + this.value = { + type: FeatureCollection, + features + }; + } + }); + function GeoPath(params2) { + Transform.call(this, null, params2); + } + GeoPath.Definition = { + "type": "GeoPath", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(GeoPath, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), path2 = this.value, field2 = _.field || identity$7, as = _.as || "path", flag2 = out.SOURCE; + if (!path2 || _.modified()) { + this.value = path2 = getProjectionPath(_.projection); + out.materialize().reflow(); + } else { + flag2 = field2 === identity$7 || pulse2.modified(field2.fields) ? out.ADD_MOD : out.ADD; + } + const prev = initPath(path2, _.pointRadius); + out.visit(flag2, (t) => t[as] = path2(field2(t))); + path2.pointRadius(prev); + return out.modifies(as); + } + }); + function initPath(path2, pointRadius) { + const prev = path2.pointRadius(); + path2.context(null); + if (pointRadius != null) { + path2.pointRadius(pointRadius); + } + return prev; + } + function GeoPoint(params2) { + Transform.call(this, null, params2); + } + GeoPoint.Definition = { + "type": "GeoPoint", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "projection", + "type": "projection", + "required": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["x", "y"] + }] + }; + inherits(GeoPoint, Transform, { + transform(_, pulse2) { + var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || ["x", "y"], x2 = as[0], y2 = as[1], mod; + function set2(t) { + const xy = proj([lon(t), lat(t)]); + if (xy) { + t[x2] = xy[0]; + t[y2] = xy[1]; + } else { + t[x2] = void 0; + t[y2] = void 0; + } + } + if (_.modified()) { + pulse2 = pulse2.materialize().reflow(true).visit(pulse2.SOURCE, set2); + } else { + mod = pulse2.modified(lon.fields) || pulse2.modified(lat.fields); + pulse2.visit(mod ? pulse2.ADD_MOD : pulse2.ADD, set2); + } + return pulse2.modifies(as); + } + }); + function GeoShape(params2) { + Transform.call(this, null, params2); + } + GeoShape.Definition = { + "type": "GeoShape", + "metadata": { + "modifies": true, + "nomod": true + }, + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field", + "default": "datum" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "shape" + }] + }; + inherits(GeoShape, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), shape2 = this.value, as = _.as || "shape", flag2 = out.ADD; + if (!shape2 || _.modified()) { + this.value = shape2 = shapeGenerator(getProjectionPath(_.projection), _.field || field$1("datum"), _.pointRadius); + out.materialize().reflow(); + flag2 = out.SOURCE; + } + out.visit(flag2, (t) => t[as] = shape2); + return out.modifies(as); + } + }); + function shapeGenerator(path2, field2, pointRadius) { + const shape2 = pointRadius == null ? (_) => path2(field2(_)) : (_) => { + var prev = path2.pointRadius(), value2 = path2.pointRadius(pointRadius)(field2(_)); + path2.pointRadius(prev); + return value2; + }; + shape2.context = (_) => { + path2.context(_); + return shape2; + }; + return shape2; + } + function Graticule(params2) { + Transform.call(this, [], params2); + this.generator = graticule(); + } + Graticule.Definition = { + "type": "Graticule", + "metadata": { + "changes": true, + "generates": true + }, + "params": [{ + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMajor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMinor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "step", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "stepMajor", + "type": "number", + "array": true, + "length": 2, + "default": [90, 360] + }, { + "name": "stepMinor", + "type": "number", + "array": true, + "length": 2, + "default": [10, 10] + }, { + "name": "precision", + "type": "number", + "default": 2.5 + }] + }; + inherits(Graticule, Transform, { + transform(_, pulse2) { + var src = this.value, gen = this.generator, t; + if (!src.length || _.modified()) { + for (const prop in _) { + if (isFunction(gen[prop])) { + gen[prop](_[prop]); + } + } + } + t = gen(); + if (src.length) { + pulse2.mod.push(replace$1(src[0], t)); + } else { + pulse2.add.push(ingest$1(t)); + } + src[0] = t; + return pulse2; + } + }); + function Heatmap(params2) { + Transform.call(this, null, params2); + } + Heatmap.Definition = { + "type": "heatmap", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "color", + "type": "string", + "expr": true + }, { + "name": "opacity", + "type": "number", + "expr": true + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "as", + "type": "string", + "default": "image" + }] + }; + inherits(Heatmap, Transform, { + transform(_, pulse2) { + if (!pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var source2 = pulse2.materialize(pulse2.SOURCE).source, shared = _.resolve === "shared", field2 = _.field || identity$7, opacity2 = opacity_(_.opacity, _), color2 = color_(_.color, _), as = _.as || "image", obj2 = { + $x: 0, + $y: 0, + $value: 0, + $max: shared ? max$3(source2.map((t) => max$3(field2(t).values))) : 0 + }; + source2.forEach((t) => { + const v = field2(t); + const o = extend$1({}, t, obj2); + if (!shared) o.$max = max$3(v.values || []); + t[as] = toCanvas(v, o, color2.dep ? color2 : constant$5(color2(o)), opacity2.dep ? opacity2 : constant$5(opacity2(o))); + }); + return pulse2.reflow(true).modifies(as); + } + }); + function color_(color2, _) { + let f; + if (isFunction(color2)) { + f = (obj2) => rgb$1(color2(obj2, _)); + f.dep = dependency(color2); + } else { + f = constant$5(rgb$1(color2 || "#888")); + } + return f; + } + function opacity_(opacity2, _) { + let f; + if (isFunction(opacity2)) { + f = (obj2) => opacity2(obj2, _); + f.dep = dependency(opacity2); + } else if (opacity2) { + f = constant$5(opacity2); + } else { + f = (obj2) => obj2.$value / obj2.$max || 0; + f.dep = true; + } + return f; + } + function dependency(f) { + if (!isFunction(f)) return false; + const set2 = toSet(accessorFields(f)); + return set2.$x || set2.$y || set2.$value || set2.$max; + } + function toCanvas(grid2, obj2, color2, opacity2) { + const n = grid2.width, m2 = grid2.height, x12 = grid2.x1 || 0, y12 = grid2.y1 || 0, x2 = grid2.x2 || n, y2 = grid2.y2 || m2, val = grid2.values, value2 = val ? (i) => val[i] : zero$3, can = domCanvas(x2 - x12, y2 - y12), ctx = can.getContext("2d"), img = ctx.getImageData(0, 0, x2 - x12, y2 - y12), pix = img.data; + for (let j = y12, k = 0; j < y2; ++j) { + obj2.$y = j - y12; + for (let i = x12, r = j * n; i < x2; ++i, k += 4) { + obj2.$x = i - x12; + obj2.$value = value2(i + r); + const v = color2(obj2); + pix[k + 0] = v.r; + pix[k + 1] = v.g; + pix[k + 2] = v.b; + pix[k + 3] = ~~(255 * opacity2(obj2)); + } + } + ctx.putImageData(img, 0, 0); + return can; + } + function Projection$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Projection$1, Transform, { + transform(_, pulse2) { + let proj = this.value; + if (!proj || _.modified("type")) { + this.value = proj = create$6(_.type); + projectionProperties.forEach((prop) => { + if (_[prop] != null) set$5(proj, prop, _[prop]); + }); + } else { + projectionProperties.forEach((prop) => { + if (_.modified(prop)) set$5(proj, prop, _[prop]); + }); + } + if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); + if (_.fit) fit(proj, _); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + } + }); + function fit(proj, _) { + const data2 = collectGeoJSON(_.fit); + _.extent ? proj.fitExtent(_.extent, data2) : _.size ? proj.fitSize(_.size, data2) : 0; + } + function create$6(type2) { + const constructor = projection((type2 || "mercator").toLowerCase()); + if (!constructor) error("Unrecognized projection type: " + type2); + return constructor(); + } + function set$5(proj, key2, value2) { + if (isFunction(proj[key2])) proj[key2](value2); + } + function collectGeoJSON(data2) { + data2 = array$5(data2); + return data2.length === 1 ? data2[0] : { + type: FeatureCollection, + features: data2.reduce((a2, f) => a2.concat(featurize(f)), []) + }; + } + function featurize(f) { + return f.type === FeatureCollection ? f.features : array$5(f).filter((d) => d != null).map((d) => d.type === Feature ? d : { + type: Feature, + geometry: d + }); + } + const geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + contour: Contour, + geojson: GeoJSON, + geopath: GeoPath, + geopoint: GeoPoint, + geoshape: GeoShape, + graticule: Graticule, + heatmap: Heatmap, + isocontour: Isocontour, + kde2d: KDE2D, + projection: Projection$1 + }, Symbol.toStringTag, { value: "Module" })); + function forceCenter(x2, y2) { + var nodes, strength = 1; + if (x2 == null) x2 = 0; + if (y2 == null) y2 = 0; + function force2() { + var i, n = nodes.length, node, sx = 0, sy = 0; + for (i = 0; i < n; ++i) { + node = nodes[i], sx += node.x, sy += node.y; + } + for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) { + node = nodes[i], node.x -= sx, node.y -= sy; + } + } + force2.initialize = function(_) { + nodes = _; + }; + force2.x = function(_) { + return arguments.length ? (x2 = +_, force2) : x2; + }; + force2.y = function(_) { + return arguments.length ? (y2 = +_, force2) : y2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + return force2; + } + function tree_add(d) { + const x2 = +this._x.call(null, d), y2 = +this._y.call(null, d); + return add$1(this.cover(x2, y2), x2, y2, d); + } + function add$1(tree2, x2, y2, d) { + if (isNaN(x2) || isNaN(y2)) return tree2; + var parent, node = tree2._root, leaf = { data: d }, x02 = tree2._x0, y02 = tree2._y0, x12 = tree2._x1, y12 = tree2._y1, xm, ym, xp, yp, right, bottom, i, j; + if (!node) return tree2._root = leaf, tree2; + while (node.length) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree2; + } + xp = +tree2._x.call(null, node.data); + yp = +tree2._y.call(null, node.data); + if (x2 === xp && y2 === yp) return leaf.next = node, parent ? parent[i] = leaf : tree2._root = leaf, tree2; + do { + parent = parent ? parent[i] = new Array(4) : tree2._root = new Array(4); + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); + return parent[j] = node, parent[i] = leaf, tree2; + } + function addAll(data2) { + var d, i, n = data2.length, x2, y2, xz = new Array(n), yz = new Array(n), x02 = Infinity, y02 = Infinity, x12 = -Infinity, y12 = -Infinity; + for (i = 0; i < n; ++i) { + if (isNaN(x2 = +this._x.call(null, d = data2[i])) || isNaN(y2 = +this._y.call(null, d))) continue; + xz[i] = x2; + yz[i] = y2; + if (x2 < x02) x02 = x2; + if (x2 > x12) x12 = x2; + if (y2 < y02) y02 = y2; + if (y2 > y12) y12 = y2; + } + if (x02 > x12 || y02 > y12) return this; + this.cover(x02, y02).cover(x12, y12); + for (i = 0; i < n; ++i) { + add$1(this, xz[i], yz[i], data2[i]); + } + return this; + } + function tree_cover(x2, y2) { + if (isNaN(x2 = +x2) || isNaN(y2 = +y2)) return this; + var x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1; + if (isNaN(x02)) { + x12 = (x02 = Math.floor(x2)) + 1; + y12 = (y02 = Math.floor(y2)) + 1; + } else { + var z = x12 - x02 || 1, node = this._root, parent, i; + while (x02 > x2 || x2 >= x12 || y02 > y2 || y2 >= y12) { + i = (y2 < y02) << 1 | x2 < x02; + parent = new Array(4), parent[i] = node, node = parent, z *= 2; + switch (i) { + case 0: + x12 = x02 + z, y12 = y02 + z; + break; + case 1: + x02 = x12 - z, y12 = y02 + z; + break; + case 2: + x12 = x02 + z, y02 = y12 - z; + break; + case 3: + x02 = x12 - z, y02 = y12 - z; + break; + } + } + if (this._root && this._root.length) this._root = node; + } + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + return this; + } + function tree_data() { + var data2 = []; + this.visit(function(node) { + if (!node.length) do + data2.push(node.data); + while (node = node.next); + }); + return data2; + } + function tree_extent(_) { + return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]]; + } + function Quad$3(node, x02, y02, x12, y12) { + this.node = node; + this.x0 = x02; + this.y0 = y02; + this.x1 = x12; + this.y1 = y12; + } + function tree_find(x2, y2, radius2) { + var data2, x02 = this._x0, y02 = this._y0, x12, y12, x22, y22, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; + if (node) quads.push(new Quad$3(node, x02, y02, x3, y3)); + if (radius2 == null) radius2 = Infinity; + else { + x02 = x2 - radius2, y02 = y2 - radius2; + x3 = x2 + radius2, y3 = y2 + radius2; + radius2 *= radius2; + } + while (q = quads.pop()) { + if (!(node = q.node) || (x12 = q.x0) > x3 || (y12 = q.y0) > y3 || (x22 = q.x1) < x02 || (y22 = q.y1) < y02) continue; + if (node.length) { + var xm = (x12 + x22) / 2, ym = (y12 + y22) / 2; + quads.push( + new Quad$3(node[3], xm, ym, x22, y22), + new Quad$3(node[2], x12, ym, xm, y22), + new Quad$3(node[1], xm, y12, x22, ym), + new Quad$3(node[0], x12, y12, xm, ym) + ); + if (i = (y2 >= ym) << 1 | x2 >= xm) { + q = quads[quads.length - 1]; + quads[quads.length - 1] = quads[quads.length - 1 - i]; + quads[quads.length - 1 - i] = q; + } + } else { + var dx = x2 - +this._x.call(null, node.data), dy = y2 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; + if (d2 < radius2) { + var d = Math.sqrt(radius2 = d2); + x02 = x2 - d, y02 = y2 - d; + x3 = x2 + d, y3 = y2 + d; + data2 = node.data; + } + } + } + return data2; + } + function tree_remove(d) { + if (isNaN(x2 = +this._x.call(null, d)) || isNaN(y2 = +this._y.call(null, d))) return this; + var parent, node = this._root, retainer, previous, next, x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1, x2, y2, xm, ym, right, bottom, i, j; + if (!node) return this; + if (node.length) while (true) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (!(parent = node, node = node[i = bottom << 1 | right])) return this; + if (!node.length) break; + if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; + } + while (node.data !== d) if (!(previous = node, node = node.next)) return this; + if (next = node.next) delete node.next; + if (previous) return next ? previous.next = next : delete previous.next, this; + if (!parent) return this._root = next, this; + next ? parent[i] = next : delete parent[i]; + if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { + if (retainer) retainer[j] = node; + else this._root = node; + } + return this; + } + function removeAll(data2) { + for (var i = 0, n = data2.length; i < n; ++i) this.remove(data2[i]); + return this; + } + function tree_root() { + return this._root; + } + function tree_size() { + var size2 = 0; + this.visit(function(node) { + if (!node.length) do + ++size2; + while (node = node.next); + }); + return size2; + } + function tree_visit(callback) { + var quads = [], q, node = this._root, child, x02, y02, x12, y12; + if (node) quads.push(new Quad$3(node, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + if (!callback(node = q.node, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1) && node.length) { + var xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[3]) quads.push(new Quad$3(child, xm, ym, x12, y12)); + if (child = node[2]) quads.push(new Quad$3(child, x02, ym, xm, y12)); + if (child = node[1]) quads.push(new Quad$3(child, xm, y02, x12, ym)); + if (child = node[0]) quads.push(new Quad$3(child, x02, y02, xm, ym)); + } + } + return this; + } + function tree_visitAfter(callback) { + var quads = [], next = [], q; + if (this._root) quads.push(new Quad$3(this._root, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + var node = q.node; + if (node.length) { + var child, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1, xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[0]) quads.push(new Quad$3(child, x02, y02, xm, ym)); + if (child = node[1]) quads.push(new Quad$3(child, xm, y02, x12, ym)); + if (child = node[2]) quads.push(new Quad$3(child, x02, ym, xm, y12)); + if (child = node[3]) quads.push(new Quad$3(child, xm, ym, x12, y12)); + } + next.push(q); + } + while (q = next.pop()) { + callback(q.node, q.x0, q.y0, q.x1, q.y1); + } + return this; + } + function defaultX(d) { + return d[0]; + } + function tree_x(_) { + return arguments.length ? (this._x = _, this) : this._x; + } + function defaultY(d) { + return d[1]; + } + function tree_y(_) { + return arguments.length ? (this._y = _, this) : this._y; + } + function quadtree(nodes, x2, y2) { + var tree2 = new Quadtree(x2 == null ? defaultX : x2, y2 == null ? defaultY : y2, NaN, NaN, NaN, NaN); + return nodes == null ? tree2 : tree2.addAll(nodes); + } + function Quadtree(x2, y2, x02, y02, x12, y12) { + this._x = x2; + this._y = y2; + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + this._root = void 0; + } + function leaf_copy(leaf) { + var copy2 = { data: leaf.data }, next = copy2; + while (leaf = leaf.next) next = next.next = { data: leaf.data }; + return copy2; + } + var treeProto = quadtree.prototype = Quadtree.prototype; + treeProto.copy = function() { + var copy2 = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; + if (!node) return copy2; + if (!node.length) return copy2._root = leaf_copy(node), copy2; + nodes = [{ source: node, target: copy2._root = new Array(4) }]; + while (node = nodes.pop()) { + for (var i = 0; i < 4; ++i) { + if (child = node.source[i]) { + if (child.length) nodes.push({ source: child, target: node.target[i] = new Array(4) }); + else node.target[i] = leaf_copy(child); + } + } + } + return copy2; + }; + treeProto.add = tree_add; + treeProto.addAll = addAll; + treeProto.cover = tree_cover; + treeProto.data = tree_data; + treeProto.extent = tree_extent; + treeProto.find = tree_find; + treeProto.remove = tree_remove; + treeProto.removeAll = removeAll; + treeProto.root = tree_root; + treeProto.size = tree_size; + treeProto.visit = tree_visit; + treeProto.visitAfter = tree_visitAfter; + treeProto.x = tree_x; + treeProto.y = tree_y; + function constant$1(x2) { + return function() { + return x2; + }; + } + function jiggle(random2) { + return (random2() - 0.5) * 1e-6; + } + function x$1(d) { + return d.x + d.vx; + } + function y$1(d) { + return d.y + d.vy; + } + function forceCollide(radius2) { + var nodes, radii, random2, strength = 1, iterations2 = 1; + if (typeof radius2 !== "function") radius2 = constant$1(radius2 == null ? 1 : +radius2); + function force2() { + var i, n = nodes.length, tree2, node, xi, yi, ri, ri2; + for (var k = 0; k < iterations2; ++k) { + tree2 = quadtree(nodes, x$1, y$1).visitAfter(prepare2); + for (i = 0; i < n; ++i) { + node = nodes[i]; + ri = radii[node.index], ri2 = ri * ri; + xi = node.x + node.vx; + yi = node.y + node.vy; + tree2.visit(apply2); + } + } + function apply2(quad2, x02, y02, x12, y12) { + var data2 = quad2.data, rj = quad2.r, r = ri + rj; + if (data2) { + if (data2.index > node.index) { + var x2 = xi - data2.x - data2.vx, y2 = yi - data2.y - data2.vy, l = x2 * x2 + y2 * y2; + if (l < r * r) { + if (x2 === 0) x2 = jiggle(random2), l += x2 * x2; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + l = (r - (l = Math.sqrt(l))) / l * strength; + node.vx += (x2 *= l) * (r = (rj *= rj) / (ri2 + rj)); + node.vy += (y2 *= l) * r; + data2.vx -= x2 * (r = 1 - r); + data2.vy -= y2 * r; + } + } + return; + } + return x02 > xi + r || x12 < xi - r || y02 > yi + r || y12 < yi - r; + } + } + function prepare2(quad2) { + if (quad2.data) return quad2.r = radii[quad2.data.index]; + for (var i = quad2.r = 0; i < 4; ++i) { + if (quad2[i] && quad2[i].r > quad2.r) { + quad2.r = quad2[i].r; + } + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node; + radii = new Array(n); + for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius2(node, i, nodes); + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); + }; + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + force2.radius = function(_) { + return arguments.length ? (radius2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : radius2; + }; + return force2; + } + function index$1(d) { + return d.index; + } + function find$1(nodeById, nodeId) { + var node = nodeById.get(nodeId); + if (!node) throw new Error("node not found: " + nodeId); + return node; + } + function forceLink(links) { + var id2 = index$1, strength = defaultStrength, strengths, distance2 = constant$1(30), distances, nodes, count2, bias, random2, iterations2 = 1; + if (links == null) links = []; + function defaultStrength(link2) { + return 1 / Math.min(count2[link2.source.index], count2[link2.target.index]); + } + function force2(alpha) { + for (var k = 0, n = links.length; k < iterations2; ++k) { + for (var i = 0, link2, source2, target2, x2, y2, l, b2; i < n; ++i) { + link2 = links[i], source2 = link2.source, target2 = link2.target; + x2 = target2.x + target2.vx - source2.x - source2.vx || jiggle(random2); + y2 = target2.y + target2.vy - source2.y - source2.vy || jiggle(random2); + l = Math.sqrt(x2 * x2 + y2 * y2); + l = (l - distances[i]) / l * alpha * strengths[i]; + x2 *= l, y2 *= l; + target2.vx -= x2 * (b2 = bias[i]); + target2.vy -= y2 * b2; + source2.vx += x2 * (b2 = 1 - b2); + source2.vy += y2 * b2; + } + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, m2 = links.length, nodeById = new Map(nodes.map((d, i2) => [id2(d, i2, nodes), d])), link2; + for (i = 0, count2 = new Array(n); i < m2; ++i) { + link2 = links[i], link2.index = i; + if (typeof link2.source !== "object") link2.source = find$1(nodeById, link2.source); + if (typeof link2.target !== "object") link2.target = find$1(nodeById, link2.target); + count2[link2.source.index] = (count2[link2.source.index] || 0) + 1; + count2[link2.target.index] = (count2[link2.target.index] || 0) + 1; + } + for (i = 0, bias = new Array(m2); i < m2; ++i) { + link2 = links[i], bias[i] = count2[link2.source.index] / (count2[link2.source.index] + count2[link2.target.index]); + } + strengths = new Array(m2), initializeStrength(); + distances = new Array(m2), initializeDistance(); + } + function initializeStrength() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + strengths[i] = +strength(links[i], i, links); + } + } + function initializeDistance() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + distances[i] = +distance2(links[i], i, links); + } + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); + }; + force2.links = function(_) { + return arguments.length ? (links = _, initialize2(), force2) : links; + }; + force2.id = function(_) { + return arguments.length ? (id2 = _, force2) : id2; + }; + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force2) : strength; + }; + force2.distance = function(_) { + return arguments.length ? (distance2 = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force2) : distance2; + }; + return force2; + } + var noop = { value: () => { + } }; + function dispatch() { + for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { + if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); + _[t] = []; + } + return new Dispatch(_); + } + function Dispatch(_) { + this._ = _; + } + function parseTypenames(typenames, types) { + return typenames.trim().split(/^|\s+/).map(function(t) { + var name = "", i = t.indexOf("."); + if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); + return { type: t, name }; + }); + } + Dispatch.prototype = dispatch.prototype = { + constructor: Dispatch, + on: function(typename, callback) { + var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; + if (arguments.length < 2) { + while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; + return; + } + if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); + while (++i < n) { + if (t = (typename = T[i]).type) _[t] = set$4(_[t], typename.name, callback); + else if (callback == null) for (t in _) _[t] = set$4(_[t], typename.name, null); + } + return this; + }, + copy: function() { + var copy2 = {}, _ = this._; + for (var t in _) copy2[t] = _[t].slice(); + return new Dispatch(copy2); + }, + call: function(type2, that) { + if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + }, + apply: function(type2, that, args) { + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (var t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + } + }; + function get(type2, name) { + for (var i = 0, n = type2.length, c2; i < n; ++i) { + if ((c2 = type2[i]).name === name) { + return c2.value; + } + } + } + function set$4(type2, name, callback) { + for (var i = 0, n = type2.length; i < n; ++i) { + if (type2[i].name === name) { + type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1)); + break; + } + } + if (callback != null) type2.push({ name, value: callback }); + return type2; + } + var frame = 0, timeout = 0, interval$1 = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { + setTimeout(f, 17); + }; + function now() { + return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); + } + function clearNow() { + clockNow = 0; + } + function Timer$1() { + this._call = this._time = this._next = null; + } + Timer$1.prototype = timer$1.prototype = { + constructor: Timer$1, + restart: function(callback, delay, time2) { + if (typeof callback !== "function") throw new TypeError("callback is not a function"); + time2 = (time2 == null ? now() : +time2) + (delay == null ? 0 : +delay); + if (!this._next && taskTail !== this) { + if (taskTail) taskTail._next = this; + else taskHead = this; + taskTail = this; + } + this._call = callback; + this._time = time2; + sleep(); + }, + stop: function() { + if (this._call) { + this._call = null; + this._time = Infinity; + sleep(); + } + } + }; + function timer$1(callback, delay, time2) { + var t = new Timer$1(); + t.restart(callback, delay, time2); + return t; + } + function timerFlush() { + now(); + ++frame; + var t = taskHead, e; + while (t) { + if ((e = clockNow - t._time) >= 0) t._call.call(void 0, e); + t = t._next; + } + --frame; + } + function wake() { + clockNow = (clockLast = clock.now()) + clockSkew; + frame = timeout = 0; + try { + timerFlush(); + } finally { + frame = 0; + nap(); + clockNow = 0; + } + } + function poke() { + var now2 = clock.now(), delay = now2 - clockLast; + if (delay > pokeDelay) clockSkew -= delay, clockLast = now2; + } + function nap() { + var t02, t12 = taskHead, t22, time2 = Infinity; + while (t12) { + if (t12._call) { + if (time2 > t12._time) time2 = t12._time; + t02 = t12, t12 = t12._next; + } else { + t22 = t12._next, t12._next = null; + t12 = t02 ? t02._next = t22 : taskHead = t22; + } + } + taskTail = t02; + sleep(time2); + } + function sleep(time2) { + if (frame) return; + if (timeout) timeout = clearTimeout(timeout); + var delay = time2 - clockNow; + if (delay > 24) { + if (time2 < Infinity) timeout = setTimeout(wake, time2 - clock.now() - clockSkew); + if (interval$1) interval$1 = clearInterval(interval$1); + } else { + if (!interval$1) clockLast = clock.now(), interval$1 = setInterval(poke, pokeDelay); + frame = 1, setFrame(wake); + } + } + function interval(callback, delay, time2) { + var t = new Timer$1(), total = delay; + if (delay == null) return t.restart(callback, delay, time2), t; + t._restart = t.restart; + t.restart = function(callback2, delay2, time3) { + delay2 = +delay2, time3 = time3 == null ? now() : +time3; + t._restart(function tick(elapsed) { + elapsed += total; + t._restart(tick, total += delay2, time3); + callback2(elapsed); + }, delay2, time3); + }; + t.restart(callback, delay, time2); + return t; + } + const a$1 = 1664525; + const c$1 = 1013904223; + const m$1 = 4294967296; + function lcg$1() { + let s = 1; + return () => (s = (a$1 * s + c$1) % m$1) / m$1; + } + function x(d) { + return d.x; + } + function y(d) { + return d.y; + } + var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); + function forceSimulation(nodes) { + var simulation2, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = /* @__PURE__ */ new Map(), stepper = timer$1(step), event2 = dispatch("tick", "end"), random2 = lcg$1(); + if (nodes == null) nodes = []; + function step() { + tick(); + event2.call("tick", simulation2); + if (alpha < alphaMin) { + stepper.stop(); + event2.call("end", simulation2); + } + } + function tick(iterations2) { + var i, n = nodes.length, node; + if (iterations2 === void 0) iterations2 = 1; + for (var k = 0; k < iterations2; ++k) { + alpha += (alphaTarget - alpha) * alphaDecay; + forces.forEach(function(force2) { + force2(alpha); + }); + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (node.fx == null) node.x += node.vx *= velocityDecay; + else node.x = node.fx, node.vx = 0; + if (node.fy == null) node.y += node.vy *= velocityDecay; + else node.y = node.fy, node.vy = 0; + } + } + return simulation2; + } + function initializeNodes() { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.index = i; + if (node.fx != null) node.x = node.fx; + if (node.fy != null) node.y = node.fy; + if (isNaN(node.x) || isNaN(node.y)) { + var radius2 = initialRadius * Math.sqrt(0.5 + i), angle2 = i * initialAngle; + node.x = radius2 * Math.cos(angle2); + node.y = radius2 * Math.sin(angle2); + } + if (isNaN(node.vx) || isNaN(node.vy)) { + node.vx = node.vy = 0; + } + } + } + function initializeForce(force2) { + if (force2.initialize) force2.initialize(nodes, random2); + return force2; + } + initializeNodes(); + return simulation2 = { + tick, + restart: function() { + return stepper.restart(step), simulation2; + }, + stop: function() { + return stepper.stop(), simulation2; + }, + nodes: function(_) { + return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation2) : nodes; + }, + alpha: function(_) { + return arguments.length ? (alpha = +_, simulation2) : alpha; + }, + alphaMin: function(_) { + return arguments.length ? (alphaMin = +_, simulation2) : alphaMin; + }, + alphaDecay: function(_) { + return arguments.length ? (alphaDecay = +_, simulation2) : +alphaDecay; + }, + alphaTarget: function(_) { + return arguments.length ? (alphaTarget = +_, simulation2) : alphaTarget; + }, + velocityDecay: function(_) { + return arguments.length ? (velocityDecay = 1 - _, simulation2) : 1 - velocityDecay; + }, + randomSource: function(_) { + return arguments.length ? (random2 = _, forces.forEach(initializeForce), simulation2) : random2; + }, + force: function(name, _) { + return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation2) : forces.get(name); + }, + find: function(x2, y2, radius2) { + var i = 0, n = nodes.length, dx, dy, d2, node, closest; + if (radius2 == null) radius2 = Infinity; + else radius2 *= radius2; + for (i = 0; i < n; ++i) { + node = nodes[i]; + dx = x2 - node.x; + dy = y2 - node.y; + d2 = dx * dx + dy * dy; + if (d2 < radius2) closest = node, radius2 = d2; + } + return closest; + }, + on: function(name, _) { + return arguments.length > 1 ? (event2.on(name, _), simulation2) : event2.on(name); + } + }; + } + function forceManyBody() { + var nodes, node, random2, alpha, strength = constant$1(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; + function force2(_) { + var i, n = nodes.length, tree2 = quadtree(nodes, x, y).visitAfter(accumulate); + for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree2.visit(apply2); + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node2; + strengths = new Array(n); + for (i = 0; i < n; ++i) node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes); + } + function accumulate(quad2) { + var strength2 = 0, q, c2, weight = 0, x2, y2, i; + if (quad2.length) { + for (x2 = y2 = i = 0; i < 4; ++i) { + if ((q = quad2[i]) && (c2 = Math.abs(q.value))) { + strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y; + } + } + quad2.x = x2 / weight; + quad2.y = y2 / weight; + } else { + q = quad2; + q.x = q.data.x; + q.y = q.data.y; + do + strength2 += strengths[q.data.index]; + while (q = q.next); + } + quad2.value = strength2; + } + function apply2(quad2, x12, _, x2) { + if (!quad2.value) return true; + var x3 = quad2.x - node.x, y2 = quad2.y - node.y, w2 = x2 - x12, l = x3 * x3 + y2 * y2; + if (w2 * w2 / theta2 < l) { + if (l < distanceMax2) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + node.vx += x3 * quad2.value * alpha / l; + node.vy += y2 * quad2.value * alpha / l; + } + return true; + } else if (quad2.length || l >= distanceMax2) return; + if (quad2.data !== node || quad2.next) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + } + do + if (quad2.data !== node) { + w2 = strengths[quad2.data.index] * alpha / l; + node.vx += x3 * w2; + node.vy += y2 * w2; + } + while (quad2 = quad2.next); + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; + }; + force2.distanceMin = function(_) { + return arguments.length ? (distanceMin2 = _ * _, force2) : Math.sqrt(distanceMin2); + }; + force2.distanceMax = function(_) { + return arguments.length ? (distanceMax2 = _ * _, force2) : Math.sqrt(distanceMax2); + }; + force2.theta = function(_) { + return arguments.length ? (theta2 = _ * _, force2) : Math.sqrt(theta2); + }; + return force2; + } + function forceX(x2) { + var strength = constant$1(0.1), nodes, strengths, xz; + if (typeof x2 !== "function") x2 = constant$1(x2 == null ? 0 : +x2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + xz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(xz[i] = +x2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; + }; + force2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : x2; + }; + return force2; + } + function forceY(y2) { + var strength = constant$1(0.1), nodes, strengths, yz; + if (typeof y2 !== "function") y2 = constant$1(y2 == null ? 0 : +y2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + yz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(yz[i] = +y2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; + }; + force2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : y2; + }; + return force2; + } + const ForceMap = { + center: forceCenter, + collide: forceCollide, + nbody: forceManyBody, + link: forceLink, + x: forceX, + y: forceY + }; + const Forces = "forces", ForceParams = ["alpha", "alphaMin", "alphaTarget", "velocityDecay", "forces"], ForceConfig = ["static", "iterations"], ForceOutput = ["x", "y", "vx", "vy"]; + function Force(params2) { + Transform.call(this, null, params2); + } + Force.Definition = { + "type": "Force", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "static", + "type": "boolean", + "default": false + }, { + "name": "restart", + "type": "boolean", + "default": false + }, { + "name": "iterations", + "type": "number", + "default": 300 + }, { + "name": "alpha", + "type": "number", + "default": 1 + }, { + "name": "alphaMin", + "type": "number", + "default": 1e-3 + }, { + "name": "alphaTarget", + "type": "number", + "default": 0 + }, { + "name": "velocityDecay", + "type": "number", + "default": 0.4 + }, { + "name": "forces", + "type": "param", + "array": true, + "params": [{ + "key": { + "force": "center" + }, + "params": [{ + "name": "x", + "type": "number", + "default": 0 + }, { + "name": "y", + "type": "number", + "default": 0 + }] + }, { + "key": { + "force": "collide" + }, + "params": [{ + "name": "radius", + "type": "number", + "expr": true + }, { + "name": "strength", + "type": "number", + "default": 0.7 + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "nbody" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": -30, + "expr": true + }, { + "name": "theta", + "type": "number", + "default": 0.9 + }, { + "name": "distanceMin", + "type": "number", + "default": 1 + }, { + "name": "distanceMax", + "type": "number" + }] + }, { + "key": { + "force": "link" + }, + "params": [{ + "name": "links", + "type": "data" + }, { + "name": "id", + "type": "field" + }, { + "name": "distance", + "type": "number", + "default": 30, + "expr": true + }, { + "name": "strength", + "type": "number", + "expr": true + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "x" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "x", + "type": "field" + }] + }, { + "key": { + "force": "y" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "y", + "type": "field" + }] + }] + }, { + "name": "as", + "type": "string", + "array": true, + "modify": false, + "default": ForceOutput + }] + }; + inherits(Force, Transform, { + transform(_, pulse2) { + var sim = this.value, change2 = pulse2.changed(pulse2.ADD_REM), params2 = _.modified(ForceParams), iters = _.iterations || 300; + if (!sim) { + this.value = sim = simulation(pulse2.source, _); + sim.on("tick", rerun(pulse2.dataflow, this)); + if (!_.static) { + change2 = true; + sim.tick(); + } + pulse2.modifies("index"); + } else { + if (change2) { + pulse2.modifies("index"); + sim.nodes(pulse2.source); + } + if (params2 || pulse2.changed(pulse2.MOD)) { + setup(sim, _, 0, pulse2); + } + } + if (params2 || change2 || _.modified(ForceConfig) || pulse2.changed() && _.restart) { + sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); + if (_.static) { + for (sim.stop(); --iters >= 0; ) sim.tick(); + } else { + if (sim.stopped()) sim.restart(); + if (!change2) return pulse2.StopPropagation; + } + } + return this.finish(_, pulse2); + }, + finish(_, pulse2) { + const dataflow = pulse2.dataflow; + for (let args = this._argops, j = 0, m2 = args.length, arg; j < m2; ++j) { + arg = args[j]; + if (arg.name !== Forces || arg.op._argval.force !== "link") { + continue; + } + for (var ops2 = arg.op._argops, i = 0, n = ops2.length, op; i < n; ++i) { + if (ops2[i].name === "links" && (op = ops2[i].op.source)) { + dataflow.pulse(op, dataflow.changeset().reflow()); + break; + } + } + } + return pulse2.reflow(_.modified()).modifies(ForceOutput); + } + }); + function rerun(df, op) { + return () => df.touch(op).run(); + } + function simulation(nodes, _) { + const sim = forceSimulation(nodes), stop2 = sim.stop, restart = sim.restart; + let stopped = false; + sim.stopped = () => stopped; + sim.restart = () => (stopped = false, restart()); + sim.stop = () => (stopped = true, stop2()); + return setup(sim, _, true).on("end", () => stopped = true); + } + function setup(sim, _, init2, pulse2) { + var f = array$5(_.forces), i, n, p, name; + for (i = 0, n = ForceParams.length; i < n; ++i) { + p = ForceParams[i]; + if (p !== Forces && _.modified(p)) sim[p](_[p]); + } + for (i = 0, n = f.length; i < n; ++i) { + name = Forces + i; + p = init2 || _.modified(Forces, i) ? getForce(f[i]) : pulse2 && modified(f[i], pulse2) ? sim.force(name) : null; + if (p) sim.force(name, p); + } + for (n = sim.numForces || 0; i < n; ++i) { + sim.force(Forces + i, null); + } + sim.numForces = f.length; + return sim; + } + function modified(f, pulse2) { + var k, v; + for (k in f) { + if (isFunction(v = f[k]) && pulse2.modified(accessorFields(v))) return 1; + } + return 0; + } + function getForce(_) { + var f, p; + if (!has$1(ForceMap, _.force)) { + error("Unrecognized force: " + _.force); + } + f = ForceMap[_.force](); + for (p in _) { + if (isFunction(f[p])) setForceParam(f[p], _[p], _); + } + return f; + } + function setForceParam(f, v, _) { + f(isFunction(v) ? (d) => v(d, _) : v); + } + const force = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + force: Force + }, Symbol.toStringTag, { value: "Module" })); + function defaultSeparation$2(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function meanX(children2) { + return children2.reduce(meanXReduce, 0) / children2.length; + } + function meanXReduce(x2, c2) { + return x2 + c2.x; + } + function maxY(children2) { + return 1 + children2.reduce(maxYReduce, 0); + } + function maxYReduce(y2, c2) { + return Math.max(y2, c2.y); + } + function leafLeft(node) { + var children2; + while (children2 = node.children) node = children2[0]; + return node; + } + function leafRight(node) { + var children2; + while (children2 = node.children) node = children2[children2.length - 1]; + return node; + } + function cluster() { + var separation = defaultSeparation$2, dx = 1, dy = 1, nodeSize = false; + function cluster2(root) { + var previousNode, x2 = 0; + root.eachAfter(function(node) { + var children2 = node.children; + if (children2) { + node.x = meanX(children2); + node.y = maxY(children2); + } else { + node.x = previousNode ? x2 += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = leafLeft(root), right = leafRight(root), x02 = left.x - separation(left, right) / 2, x12 = right.x + separation(right, left) / 2; + return root.eachAfter(nodeSize ? function(node) { + node.x = (node.x - root.x) * dx; + node.y = (root.y - node.y) * dy; + } : function(node) { + node.x = (node.x - x02) / (x12 - x02) * dx; + node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; + }); + } + cluster2.separation = function(x2) { + return arguments.length ? (separation = x2, cluster2) : separation; + }; + cluster2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? null : [dx, dy]; + }; + cluster2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? [dx, dy] : null; + }; + return cluster2; + } + function count(node) { + var sum2 = 0, children2 = node.children, i = children2 && children2.length; + if (!i) sum2 = 1; + else while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + } + function node_count() { + return this.eachAfter(count); + } + function node_each(callback, that) { + let index2 = -1; + for (const node of this) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_eachBefore(callback, that) { + var node = this, nodes = [node], children2, i, index2 = -1; + while (node = nodes.pop()) { + callback.call(that, node, ++index2, this); + if (children2 = node.children) { + for (i = children2.length - 1; i >= 0; --i) { + nodes.push(children2[i]); + } + } + } + return this; + } + function node_eachAfter(callback, that) { + var node = this, nodes = [node], next = [], children2, i, n, index2 = -1; + while (node = nodes.pop()) { + next.push(node); + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + nodes.push(children2[i]); + } + } + } + while (node = next.pop()) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_find(callback, that) { + let index2 = -1; + for (const node of this) { + if (callback.call(that, node, ++index2, this)) { + return node; + } + } + } + function node_sum(value2) { + return this.eachAfter(function(node) { + var sum2 = +value2(node.data) || 0, children2 = node.children, i = children2 && children2.length; + while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + }); + } + function node_sort(compare2) { + return this.eachBefore(function(node) { + if (node.children) { + node.children.sort(compare2); + } + }); + } + function node_path(end) { + var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start]; + while (start !== ancestor) { + start = start.parent; + nodes.push(start); + } + var k = nodes.length; + while (end !== ancestor) { + nodes.splice(k, 0, end); + end = end.parent; + } + return nodes; + } + function leastCommonAncestor(a2, b2) { + if (a2 === b2) return a2; + var aNodes = a2.ancestors(), bNodes = b2.ancestors(), c2 = null; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + while (a2 === b2) { + c2 = a2; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + } + return c2; + } + function node_ancestors() { + var node = this, nodes = [node]; + while (node = node.parent) { + nodes.push(node); + } + return nodes; + } + function node_descendants() { + return Array.from(this); + } + function node_leaves() { + var leaves = []; + this.eachBefore(function(node) { + if (!node.children) { + leaves.push(node); + } + }); + return leaves; + } + function node_links() { + var root = this, links = []; + root.each(function(node) { + if (node !== root) { + links.push({ source: node.parent, target: node }); + } + }); + return links; + } + function* node_iterator() { + var node = this, current, next = [node], children2, i, n; + do { + current = next.reverse(), next = []; + while (node = current.pop()) { + yield node; + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + next.push(children2[i]); + } + } + } + } while (next.length); + } + function hierarchy(data2, children2) { + if (data2 instanceof Map) { + data2 = [void 0, data2]; + if (children2 === void 0) children2 = mapChildren; + } else if (children2 === void 0) { + children2 = objectChildren; + } + var root = new Node$2(data2), node, nodes = [root], child, childs, i, n; + while (node = nodes.pop()) { + if ((childs = children2(node.data)) && (n = (childs = Array.from(childs)).length)) { + node.children = childs; + for (i = n - 1; i >= 0; --i) { + nodes.push(child = childs[i] = new Node$2(childs[i])); + child.parent = node; + child.depth = node.depth + 1; + } + } + } + return root.eachBefore(computeHeight); + } + function node_copy() { + return hierarchy(this).eachBefore(copyData); + } + function objectChildren(d) { + return d.children; + } + function mapChildren(d) { + return Array.isArray(d) ? d[1] : null; + } + function copyData(node) { + if (node.data.value !== void 0) node.value = node.data.value; + node.data = node.data.data; + } + function computeHeight(node) { + var height2 = 0; + do + node.height = height2; + while ((node = node.parent) && node.height < ++height2); + } + function Node$2(data2) { + this.data = data2; + this.depth = this.height = 0; + this.parent = null; + } + Node$2.prototype = hierarchy.prototype = { + constructor: Node$2, + count: node_count, + each: node_each, + eachAfter: node_eachAfter, + eachBefore: node_eachBefore, + find: node_find, + sum: node_sum, + sort: node_sort, + path: node_path, + ancestors: node_ancestors, + descendants: node_descendants, + leaves: node_leaves, + links: node_links, + copy: node_copy, + [Symbol.iterator]: node_iterator + }; + function optional(f) { + return f == null ? null : required(f); + } + function required(f) { + if (typeof f !== "function") throw new Error(); + return f; + } + function constantZero() { + return 0; + } + function constant(x2) { + return function() { + return x2; + }; + } + const a = 1664525; + const c = 1013904223; + const m = 4294967296; + function lcg() { + let s = 1; + return () => (s = (a * s + c) % m) / m; + } + function array$2(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function shuffle(array2, random2) { + let m2 = array2.length, t, i; + while (m2) { + i = random2() * m2-- | 0; + t = array2[m2]; + array2[m2] = array2[i]; + array2[i] = t; + } + return array2; + } + function packEncloseRandom(circles, random2) { + var i = 0, n = (circles = shuffle(Array.from(circles), random2)).length, B2 = [], p, e; + while (i < n) { + p = circles[i]; + if (e && enclosesWeak(e, p)) ++i; + else e = encloseBasis(B2 = extendBasis(B2, p)), i = 0; + } + return e; + } + function extendBasis(B2, p) { + var i, j; + if (enclosesWeakAll(p, B2)) return [p]; + for (i = 0; i < B2.length; ++i) { + if (enclosesNot(p, B2[i]) && enclosesWeakAll(encloseBasis2(B2[i], p), B2)) { + return [B2[i], p]; + } + } + for (i = 0; i < B2.length - 1; ++i) { + for (j = i + 1; j < B2.length; ++j) { + if (enclosesNot(encloseBasis2(B2[i], B2[j]), p) && enclosesNot(encloseBasis2(B2[i], p), B2[j]) && enclosesNot(encloseBasis2(B2[j], p), B2[i]) && enclosesWeakAll(encloseBasis3(B2[i], B2[j], p), B2)) { + return [B2[i], B2[j], p]; + } + } + } + throw new Error(); + } + function enclosesNot(a2, b2) { + var dr = a2.r - b2.r, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr < 0 || dr * dr < dx * dx + dy * dy; + } + function enclosesWeak(a2, b2) { + var dr = a2.r - b2.r + Math.max(a2.r, b2.r, 1) * 1e-9, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function enclosesWeakAll(a2, B2) { + for (var i = 0; i < B2.length; ++i) { + if (!enclosesWeak(a2, B2[i])) { + return false; + } + } + return true; + } + function encloseBasis(B2) { + switch (B2.length) { + case 1: + return encloseBasis1(B2[0]); + case 2: + return encloseBasis2(B2[0], B2[1]); + case 3: + return encloseBasis3(B2[0], B2[1], B2[2]); + } + } + function encloseBasis1(a2) { + return { + x: a2.x, + y: a2.y, + r: a2.r + }; + } + function encloseBasis2(a2, b2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x21 = x2 - x12, y21 = y2 - y12, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); + return { + x: (x12 + x2 + x21 / l * r21) / 2, + y: (y12 + y2 + y21 / l * r21) / 2, + r: (l + r1 + r2) / 2 + }; + } + function encloseBasis3(a2, b2, c2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x3 = c2.x, y3 = c2.y, r3 = c2.r, a22 = x12 - x2, a3 = x12 - x3, b22 = y12 - y2, b3 = y12 - y3, c22 = r2 - r1, c3 = r3 - r1, d1 = x12 * x12 + y12 * y12 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b22 - a22 * b3, xa = (b22 * d3 - b3 * d2) / (ab * 2) - x12, xb = (b3 * c22 - b22 * c3) / ab, ya = (a3 * d2 - a22 * d3) / (ab * 2) - y12, yb = (a22 * c3 - a3 * c22) / ab, A5 = xb * xb + yb * yb - 1, B2 = 2 * (r1 + xa * xb + ya * yb), C3 = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A5) > 1e-6 ? (B2 + Math.sqrt(B2 * B2 - 4 * A5 * C3)) / (2 * A5) : C3 / B2); + return { + x: x12 + xa + xb * r, + y: y12 + ya + yb * r, + r + }; + } + function place(b2, a2, c2) { + var dx = b2.x - a2.x, x2, a22, dy = b2.y - a2.y, y2, b22, d2 = dx * dx + dy * dy; + if (d2) { + a22 = a2.r + c2.r, a22 *= a22; + b22 = b2.r + c2.r, b22 *= b22; + if (a22 > b22) { + x2 = (d2 + b22 - a22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, b22 / d2 - x2 * x2)); + c2.x = b2.x - x2 * dx - y2 * dy; + c2.y = b2.y - x2 * dy + y2 * dx; + } else { + x2 = (d2 + a22 - b22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, a22 / d2 - x2 * x2)); + c2.x = a2.x + x2 * dx - y2 * dy; + c2.y = a2.y + x2 * dy + y2 * dx; + } + } else { + c2.x = a2.x + c2.r; + c2.y = a2.y; + } + } + function intersects(a2, b2) { + var dr = a2.r + b2.r - 1e-6, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function score(node) { + var a2 = node._, b2 = node.next._, ab = a2.r + b2.r, dx = (a2.x * b2.r + b2.x * a2.r) / ab, dy = (a2.y * b2.r + b2.y * a2.r) / ab; + return dx * dx + dy * dy; + } + function Node$1(circle2) { + this._ = circle2; + this.next = null; + this.previous = null; + } + function packSiblingsRandom(circles, random2) { + if (!(n = (circles = array$2(circles)).length)) return 0; + var a2, b2, c2, n, aa, ca, i, j, k, sj, sk; + a2 = circles[0], a2.x = 0, a2.y = 0; + if (!(n > 1)) return a2.r; + b2 = circles[1], a2.x = -b2.r, b2.x = a2.r, b2.y = 0; + if (!(n > 2)) return a2.r + b2.r; + place(b2, a2, c2 = circles[2]); + a2 = new Node$1(a2), b2 = new Node$1(b2), c2 = new Node$1(c2); + a2.next = c2.previous = b2; + b2.next = a2.previous = c2; + c2.next = b2.previous = a2; + pack: for (i = 3; i < n; ++i) { + place(a2._, b2._, c2 = circles[i]), c2 = new Node$1(c2); + j = b2.next, k = a2.previous, sj = b2._.r, sk = a2._.r; + do { + if (sj <= sk) { + if (intersects(j._, c2._)) { + b2 = j, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sj += j._.r, j = j.next; + } else { + if (intersects(k._, c2._)) { + a2 = k, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sk += k._.r, k = k.previous; + } + } while (j !== k.next); + c2.previous = a2, c2.next = b2, a2.next = b2.previous = b2 = c2; + aa = score(a2); + while ((c2 = c2.next) !== b2) { + if ((ca = score(c2)) < aa) { + a2 = c2, aa = ca; + } + } + b2 = a2.next; + } + a2 = [b2._], c2 = b2; + while ((c2 = c2.next) !== b2) a2.push(c2._); + c2 = packEncloseRandom(a2, random2); + for (i = 0; i < n; ++i) a2 = circles[i], a2.x -= c2.x, a2.y -= c2.y; + return c2.r; + } + function defaultRadius(d) { + return Math.sqrt(d.value); + } + function pack() { + var radius2 = null, dx = 1, dy = 1, padding2 = constantZero; + function pack2(root) { + const random2 = lcg(); + root.x = dx / 2, root.y = dy / 2; + if (radius2) { + root.eachBefore(radiusLeaf(radius2)).eachAfter(packChildrenRandom(padding2, 0.5, random2)).eachBefore(translateChild(1)); + } else { + root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero, 1, random2)).eachAfter(packChildrenRandom(padding2, root.r / Math.min(dx, dy), random2)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); + } + return root; + } + pack2.radius = function(x2) { + return arguments.length ? (radius2 = optional(x2), pack2) : radius2; + }; + pack2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], pack2) : [dx, dy]; + }; + pack2.padding = function(x2) { + return arguments.length ? (padding2 = typeof x2 === "function" ? x2 : constant(+x2), pack2) : padding2; + }; + return pack2; + } + function radiusLeaf(radius2) { + return function(node) { + if (!node.children) { + node.r = Math.max(0, +radius2(node) || 0); + } + }; + } + function packChildrenRandom(padding2, k, random2) { + return function(node) { + if (children2 = node.children) { + var children2, i, n = children2.length, r = padding2(node) * k || 0, e; + if (r) for (i = 0; i < n; ++i) children2[i].r += r; + e = packSiblingsRandom(children2, random2); + if (r) for (i = 0; i < n; ++i) children2[i].r -= r; + node.r = e + r; + } + }; + } + function translateChild(k) { + return function(node) { + var parent = node.parent; + node.r *= k; + if (parent) { + node.x = parent.x + k * node.x; + node.y = parent.y + k * node.y; + } + }; + } + function roundNode(node) { + node.x0 = Math.round(node.x0); + node.y0 = Math.round(node.y0); + node.x1 = Math.round(node.x1); + node.y1 = Math.round(node.y1); + } + function treemapDice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x12 - x02) / parent.value; + while (++i < n) { + node = nodes[i], node.y0 = y02, node.y1 = y12; + node.x0 = x02, node.x1 = x02 += node.value * k; + } + } + function partition$1() { + var dx = 1, dy = 1, padding2 = 0, round = false; + function partition2(root) { + var n = root.height + 1; + root.x0 = root.y0 = padding2; + root.x1 = dx; + root.y1 = dy / n; + root.eachBefore(positionNode(dy, n)); + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(dy2, n) { + return function(node) { + if (node.children) { + treemapDice(node, node.x0, dy2 * (node.depth + 1) / n, node.x1, dy2 * (node.depth + 2) / n); + } + var x02 = node.x0, y02 = node.y0, x12 = node.x1 - padding2, y12 = node.y1 - padding2; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + }; + } + partition2.round = function(x2) { + return arguments.length ? (round = !!x2, partition2) : round; + }; + partition2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], partition2) : [dx, dy]; + }; + partition2.padding = function(x2) { + return arguments.length ? (padding2 = +x2, partition2) : padding2; + }; + return partition2; + } + var preroot = { depth: -1 }, ambiguous = {}, imputed = {}; + function defaultId(d) { + return d.id; + } + function defaultParentId(d) { + return d.parentId; + } + function stratify() { + var id2 = defaultId, parentId = defaultParentId, path2; + function stratify2(data2) { + var nodes = Array.from(data2), currentId = id2, currentParentId = parentId, n, d, i, root, parent, node, nodeId, nodeKey, nodeByKey = /* @__PURE__ */ new Map(); + if (path2 != null) { + const I = nodes.map((d2, i2) => normalize$3(path2(d2, i2, data2))); + const P = I.map(parentof); + const S = new Set(I).add(""); + for (const i2 of P) { + if (!S.has(i2)) { + S.add(i2); + I.push(i2); + P.push(parentof(i2)); + nodes.push(imputed); + } + } + currentId = (_, i2) => I[i2]; + currentParentId = (_, i2) => P[i2]; + } + for (i = 0, n = nodes.length; i < n; ++i) { + d = nodes[i], node = nodes[i] = new Node$2(d); + if ((nodeId = currentId(d, i, data2)) != null && (nodeId += "")) { + nodeKey = node.id = nodeId; + nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); + } + if ((nodeId = currentParentId(d, i, data2)) != null && (nodeId += "")) { + node.parent = nodeId; + } + } + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (nodeId = node.parent) { + parent = nodeByKey.get(nodeId); + if (!parent) throw new Error("missing: " + nodeId); + if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); + if (parent.children) parent.children.push(node); + else parent.children = [node]; + node.parent = parent; + } else { + if (root) throw new Error("multiple roots"); + root = node; + } + } + if (!root) throw new Error("no root"); + if (path2 != null) { + while (root.data === imputed && root.children.length === 1) { + root = root.children[0], --n; + } + for (let i2 = nodes.length - 1; i2 >= 0; --i2) { + node = nodes[i2]; + if (node.data !== imputed) break; + node.data = null; + } + } + root.parent = preroot; + root.eachBefore(function(node2) { + node2.depth = node2.parent.depth + 1; + --n; + }).eachBefore(computeHeight); + root.parent = null; + if (n > 0) throw new Error("cycle"); + return root; + } + stratify2.id = function(x2) { + return arguments.length ? (id2 = optional(x2), stratify2) : id2; + }; + stratify2.parentId = function(x2) { + return arguments.length ? (parentId = optional(x2), stratify2) : parentId; + }; + stratify2.path = function(x2) { + return arguments.length ? (path2 = optional(x2), stratify2) : path2; + }; + return stratify2; + } + function normalize$3(path2) { + path2 = `${path2}`; + let i = path2.length; + if (slash(path2, i - 1) && !slash(path2, i - 2)) path2 = path2.slice(0, -1); + return path2[0] === "/" ? path2 : `/${path2}`; + } + function parentof(path2) { + let i = path2.length; + if (i < 2) return ""; + while (--i > 1) if (slash(path2, i)) break; + return path2.slice(0, i); + } + function slash(path2, i) { + if (path2[i] === "/") { + let k = 0; + while (i > 0 && path2[--i] === "\\") ++k; + if ((k & 1) === 0) return true; + } + return false; + } + function defaultSeparation$1(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function nextLeft(v) { + var children2 = v.children; + return children2 ? children2[0] : v.t; + } + function nextRight(v) { + var children2 = v.children; + return children2 ? children2[children2.length - 1] : v.t; + } + function moveSubtree(wm, wp, shift) { + var change2 = shift / (wp.i - wm.i); + wp.c -= change2; + wp.s += shift; + wm.c += change2; + wp.z += shift; + wp.m += shift; + } + function executeShifts(v) { + var shift = 0, change2 = 0, children2 = v.children, i = children2.length, w2; + while (--i >= 0) { + w2 = children2[i]; + w2.z += shift; + w2.m += shift; + shift += w2.s + (change2 += w2.c); + } + } + function nextAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; + } + function TreeNode(node, i) { + this._ = node; + this.parent = null; + this.children = null; + this.A = null; + this.a = this; + this.z = 0; + this.m = 0; + this.c = 0; + this.s = 0; + this.t = null; + this.i = i; + } + TreeNode.prototype = Object.create(Node$2.prototype); + function treeRoot(root) { + var tree2 = new TreeNode(root, 0), node, nodes = [tree2], child, children2, i, n; + while (node = nodes.pop()) { + if (children2 = node._.children) { + node.children = new Array(n = children2.length); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new TreeNode(children2[i], i)); + child.parent = node; + } + } + } + (tree2.parent = new TreeNode(null, 0)).children = [tree2]; + return tree2; + } + function tree$1() { + var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null; + function tree2(root) { + var t = treeRoot(root); + t.eachAfter(firstWalk), t.parent.m = -t.z; + t.eachBefore(secondWalk); + if (nodeSize) root.eachBefore(sizeNode); + else { + var left = root, right = root, bottom = root; + root.eachBefore(function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; + }); + var s = left === right ? 1 : separation(left, right) / 2, tx2 = s - left.x, kx = dx / (right.x + s + tx2), ky = dy / (bottom.depth || 1); + root.eachBefore(function(node) { + node.x = (node.x + tx2) * kx; + node.y = node.depth * ky; + }); + } + return root; + } + function firstWalk(v) { + var children2 = v.children, siblings = v.parent.children, w2 = v.i ? siblings[v.i - 1] : null; + if (children2) { + executeShifts(v); + var midpoint = (children2[0].z + children2[children2.length - 1].z) / 2; + if (w2) { + v.z = w2.z + separation(v._, w2._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; + } + } else if (w2) { + v.z = w2.z + separation(v._, w2._); + } + v.parent.A = apportion(v, w2, v.parent.A || siblings[0]); + } + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + function apportion(v, w2, ancestor) { + if (w2) { + var vip = v, vop = v, vim = w2, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; + while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { + vom = nextLeft(vom); + vop = nextRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + moveSubtree(nextAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !nextRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !nextLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; + } + } + return ancestor; + } + function sizeNode(node) { + node.x *= dx; + node.y = node.depth * dy; + } + tree2.separation = function(x2) { + return arguments.length ? (separation = x2, tree2) : separation; + }; + tree2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? null : [dx, dy]; + }; + tree2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? [dx, dy] : null; + }; + return tree2; + } + function treemapSlice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y12 - y02) / parent.value; + while (++i < n) { + node = nodes[i], node.x0 = x02, node.x1 = x12; + node.y0 = y02, node.y1 = y02 += node.value * k; + } + } + var phi = (1 + Math.sqrt(5)) / 2; + function squarifyRatio(ratio, parent, x02, y02, x12, y12) { + var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value2 = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; + while (i0 < n) { + dx = x12 - x02, dy = y12 - y02; + do + sumValue = nodes[i1++].value; + while (!sumValue && i1 < n); + minValue = maxValue = sumValue; + alpha = Math.max(dy / dx, dx / dy) / (value2 * ratio); + beta = sumValue * sumValue * alpha; + minRatio = Math.max(maxValue / beta, beta / minValue); + for (; i1 < n; ++i1) { + sumValue += nodeValue = nodes[i1].value; + if (nodeValue < minValue) minValue = nodeValue; + if (nodeValue > maxValue) maxValue = nodeValue; + beta = sumValue * sumValue * alpha; + newRatio = Math.max(maxValue / beta, beta / minValue); + if (newRatio > minRatio) { + sumValue -= nodeValue; + break; + } + minRatio = newRatio; + } + rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) }); + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += dy * sumValue / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += dx * sumValue / value2 : x12, y12); + value2 -= sumValue, i0 = i1; + } + return rows; + } + const treemapSquarify = (function custom2(ratio) { + function squarify(parent, x02, y02, x12, y12) { + squarifyRatio(ratio, parent, x02, y02, x12, y12); + } + squarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return squarify; + })(phi); + function treemap$1() { + var tile = treemapSquarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero; + function treemap2(root) { + root.x0 = root.y0 = 0; + root.x1 = dx; + root.y1 = dy; + root.eachBefore(positionNode); + paddingStack = [0]; + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(node) { + var p = paddingStack[node.depth], x02 = node.x0 + p, y02 = node.y0 + p, x12 = node.x1 - p, y12 = node.y1 - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + if (node.children) { + p = paddingStack[node.depth + 1] = paddingInner(node) / 2; + x02 += paddingLeft(node) - p; + y02 += paddingTop(node) - p; + x12 -= paddingRight(node) - p; + y12 -= paddingBottom(node) - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + tile(node, x02, y02, x12, y12); + } + } + treemap2.round = function(x2) { + return arguments.length ? (round = !!x2, treemap2) : round; + }; + treemap2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], treemap2) : [dx, dy]; + }; + treemap2.tile = function(x2) { + return arguments.length ? (tile = required(x2), treemap2) : tile; + }; + treemap2.padding = function(x2) { + return arguments.length ? treemap2.paddingInner(x2).paddingOuter(x2) : treemap2.paddingInner(); + }; + treemap2.paddingInner = function(x2) { + return arguments.length ? (paddingInner = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingInner; + }; + treemap2.paddingOuter = function(x2) { + return arguments.length ? treemap2.paddingTop(x2).paddingRight(x2).paddingBottom(x2).paddingLeft(x2) : treemap2.paddingTop(); + }; + treemap2.paddingTop = function(x2) { + return arguments.length ? (paddingTop = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingTop; + }; + treemap2.paddingRight = function(x2) { + return arguments.length ? (paddingRight = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingRight; + }; + treemap2.paddingBottom = function(x2) { + return arguments.length ? (paddingBottom = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingBottom; + }; + treemap2.paddingLeft = function(x2) { + return arguments.length ? (paddingLeft = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingLeft; + }; + return treemap2; + } + function treemapBinary(parent, x02, y02, x12, y12) { + var nodes = parent.children, i, n = nodes.length, sum2, sums = new Array(n + 1); + for (sums[0] = sum2 = i = 0; i < n; ++i) { + sums[i + 1] = sum2 += nodes[i].value; + } + partition2(0, n, parent.value, x02, y02, x12, y12); + function partition2(i2, j, value2, x03, y03, x13, y13) { + if (i2 >= j - 1) { + var node = nodes[i2]; + node.x0 = x03, node.y0 = y03; + node.x1 = x13, node.y1 = y13; + return; + } + var valueOffset = sums[i2], valueTarget = value2 / 2 + valueOffset, k = i2 + 1, hi = j - 1; + while (k < hi) { + var mid = k + hi >>> 1; + if (sums[mid] < valueTarget) k = mid + 1; + else hi = mid; + } + if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i2 + 1 < k) --k; + var valueLeft = sums[k] - valueOffset, valueRight = value2 - valueLeft; + if (x13 - x03 > y13 - y03) { + var xk = value2 ? (x03 * valueRight + x13 * valueLeft) / value2 : x13; + partition2(i2, k, valueLeft, x03, y03, xk, y13); + partition2(k, j, valueRight, xk, y03, x13, y13); + } else { + var yk = value2 ? (y03 * valueRight + y13 * valueLeft) / value2 : y13; + partition2(i2, k, valueLeft, x03, y03, x13, yk); + partition2(k, j, valueRight, x03, yk, x13, y13); + } + } + } + function treemapSliceDice(parent, x02, y02, x12, y12) { + (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x02, y02, x12, y12); + } + const treemapResquarify = (function custom2(ratio) { + function resquarify(parent, x02, y02, x12, y12) { + if ((rows = parent._squarify) && rows.ratio === ratio) { + var rows, row, nodes, i, j = -1, n, m2 = rows.length, value2 = parent.value; + while (++j < m2) { + row = rows[j], nodes = row.children; + for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += (y12 - y02) * row.value / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += (x12 - x02) * row.value / value2 : x12, y12); + value2 -= row.value; + } + } else { + parent._squarify = rows = squarifyRatio(ratio, parent, x02, y02, x12, y12); + rows.ratio = ratio; + } + } + resquarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return resquarify; + })(phi); + function lookup$2(tree2, key2, filter2) { + const map2 = {}; + tree2.each((node) => { + const t = node.data; + if (filter2(t)) map2[key2(t)] = node; + }); + tree2.lookup = map2; + return tree2; + } + function Nest(params2) { + Transform.call(this, null, params2); + } + Nest.Definition = { + "type": "Nest", + "metadata": { + "treesource": true, + "changes": true + }, + "params": [{ + "name": "keys", + "type": "field", + "array": true + }, { + "name": "generate", + "type": "boolean" + }] + }; + const children$1 = (n) => n.values; + inherits(Nest, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Nest transform requires an upstream data source."); + } + var gen = _.generate, mod = _.modified(), out = pulse2.clone(), tree2 = this.value; + if (!tree2 || mod || pulse2.changed()) { + if (tree2) { + tree2.each((node) => { + if (node.children && isTuple(node.data)) { + out.rem.push(node.data); + } + }); + } + this.value = tree2 = hierarchy({ + values: array$5(_.keys).reduce((n, k) => { + n.key(k); + return n; + }, nest()).entries(out.source) + }, children$1); + if (gen) { + tree2.each((node) => { + if (node.children) { + node = ingest$1(node.data); + out.add.push(node); + out.source.push(node); + } + }); + } + lookup$2(tree2, tupleid, tupleid); + } + out.source.root = tree2; + return out; + } + }); + function nest() { + const keys2 = [], nest2 = { + entries: (array2) => entries(apply2(array2, 0), 0), + key: (d) => (keys2.push(d), nest2) + }; + function apply2(array2, depth) { + if (depth >= keys2.length) { + return array2; + } + const n = array2.length, key2 = keys2[depth++], valuesByKey = {}, result = {}; + let i = -1, keyValue, value2, values2; + while (++i < n) { + keyValue = key2(value2 = array2[i]) + ""; + if (values2 = valuesByKey[keyValue]) { + values2.push(value2); + } else { + valuesByKey[keyValue] = [value2]; + } + } + for (keyValue in valuesByKey) { + result[keyValue] = apply2(valuesByKey[keyValue], depth); + } + return result; + } + function entries(map2, depth) { + if (++depth > keys2.length) return map2; + const array2 = []; + for (const key2 in map2) { + array2.push({ + key: key2, + values: entries(map2[key2], depth) + }); + } + return array2; + } + return nest2; + } + function HierarchyLayout(params2) { + Transform.call(this, null, params2); + } + const defaultSeparation = (a2, b2) => a2.parent === b2.parent ? 1 : 2; + inherits(HierarchyLayout, Transform, { + transform(_, pulse2) { + if (!pulse2.source || !pulse2.source.root) { + error(this.constructor.name + " transform requires a backing tree data source."); + } + const layout = this.layout(_.method), fields = this.fields, root = pulse2.source.root, as = _.as || fields; + if (_.field) root.sum(_.field); + else root.count(); + if (_.sort) root.sort(stableCompare(_.sort, (d) => d.data)); + setParams(layout, this.params, _); + if (layout.separation) { + layout.separation(_.separation !== false ? defaultSeparation : one$2); + } + try { + this.value = layout(root); + } catch (err) { + error(err); + } + root.each((node) => setFields(node, fields, as)); + return pulse2.reflow(_.modified()).modifies(as).modifies("leaf"); + } + }); + function setParams(layout, params2, _) { + for (let p, i = 0, n = params2.length; i < n; ++i) { + p = params2[i]; + if (p in _) layout[p](_[p]); + } + } + function setFields(node, fields, as) { + const t = node.data, n = fields.length - 1; + for (let i = 0; i < n; ++i) { + t[as[i]] = node[fields[i]]; + } + t[as[n]] = node.children ? node.children.length : 0; + } + const Output$3 = ["x", "y", "r", "depth", "children"]; + function Pack(params2) { + HierarchyLayout.call(this, params2); + } + Pack.Definition = { + "type": "Pack", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "radius", + "type": "field", + "default": null + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$3.length, + "default": Output$3 + }] + }; + inherits(Pack, HierarchyLayout, { + layout: pack, + params: ["radius", "size", "padding"], + fields: Output$3 + }); + const Output$2 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Partition(params2) { + HierarchyLayout.call(this, params2); + } + Partition.Definition = { + "type": "Partition", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$2.length, + "default": Output$2 + }] + }; + inherits(Partition, HierarchyLayout, { + layout: partition$1, + params: ["size", "round", "padding"], + fields: Output$2 + }); + function Stratify(params2) { + Transform.call(this, null, params2); + } + Stratify.Definition = { + "type": "Stratify", + "metadata": { + "treesource": true + }, + "params": [{ + "name": "key", + "type": "field", + "required": true + }, { + "name": "parentKey", + "type": "field", + "required": true + }] + }; + inherits(Stratify, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Stratify transform requires an upstream data source."); + } + let tree2 = this.value; + const mod = _.modified(), out = pulse2.fork(pulse2.ALL).materialize(pulse2.SOURCE), run2 = !tree2 || mod || pulse2.changed(pulse2.ADD_REM) || pulse2.modified(_.key.fields) || pulse2.modified(_.parentKey.fields); + out.source = out.source.slice(); + if (run2) { + tree2 = out.source.length ? lookup$2(stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy) : lookup$2(stratify()([{}]), _.key, _.key); + } + out.source.root = this.value = tree2; + return out; + } + }); + const Layouts = { + tidy: tree$1, + cluster + }; + const Output$1$1 = ["x", "y", "depth", "children"]; + function Tree(params2) { + HierarchyLayout.call(this, params2); + } + Tree.Definition = { + "type": "Tree", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "tidy", + "values": ["tidy", "cluster"] + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "nodeSize", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "separation", + "type": "boolean", + "default": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$1$1.length, + "default": Output$1$1 + }] + }; + inherits(Tree, HierarchyLayout, { + /** + * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. + */ + layout(method2) { + const m2 = method2 || "tidy"; + if (has$1(Layouts, m2)) return Layouts[m2](); + else error("Unrecognized Tree layout method: " + m2); + }, + params: ["size", "nodeSize"], + fields: Output$1$1 + }); + function TreeLinks(params2) { + Transform.call(this, [], params2); + } + TreeLinks.Definition = { + "type": "TreeLinks", + "metadata": { + "tree": true, + "generates": true, + "changes": true + }, + "params": [] + }; + inherits(TreeLinks, Transform, { + transform(_, pulse2) { + const links = this.value, tree2 = pulse2.source && pulse2.source.root, out = pulse2.fork(pulse2.NO_SOURCE), lut = {}; + if (!tree2) error("TreeLinks transform requires a tree data source."); + if (pulse2.changed(pulse2.ADD_REM)) { + out.rem = links; + pulse2.visit(pulse2.SOURCE, (t) => lut[tupleid(t)] = 1); + tree2.each((node) => { + const t = node.data, p = node.parent && node.parent.data; + if (p && lut[tupleid(t)] && lut[tupleid(p)]) { + out.add.push(ingest$1({ + source: p, + target: t + })); + } + }); + this.value = out.add; + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => lut[tupleid(t)] = 1); + links.forEach((link2) => { + if (lut[tupleid(link2.source)] || lut[tupleid(link2.target)]) { + out.mod.push(link2); + } + }); + } + return out; + } + }); + const Tiles = { + binary: treemapBinary, + dice: treemapDice, + slice: treemapSlice, + slicedice: treemapSliceDice, + squarify: treemapSquarify, + resquarify: treemapResquarify + }; + const Output$4 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Treemap$1(params2) { + HierarchyLayout.call(this, params2); + } + Treemap$1.Definition = { + "type": "Treemap", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "squarify", + "values": ["squarify", "resquarify", "binary", "dice", "slice", "slicedice"] + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "paddingInner", + "type": "number", + "default": 0 + }, { + "name": "paddingOuter", + "type": "number", + "default": 0 + }, { + "name": "paddingTop", + "type": "number", + "default": 0 + }, { + "name": "paddingRight", + "type": "number", + "default": 0 + }, { + "name": "paddingBottom", + "type": "number", + "default": 0 + }, { + "name": "paddingLeft", + "type": "number", + "default": 0 + }, { + "name": "ratio", + "type": "number", + "default": 1.618033988749895 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$4.length, + "default": Output$4 + }] + }; + inherits(Treemap$1, HierarchyLayout, { + /** + * Treemap layout generator. Adds 'method' and 'ratio' parameters + * to configure the underlying tile method. + */ + layout() { + const x2 = treemap$1(); + x2.ratio = (_) => { + const t = x2.tile(); + if (t.ratio) x2.tile(t.ratio(_)); + }; + x2.method = (_) => { + if (has$1(Tiles, _)) x2.tile(Tiles[_]); + else error("Unrecognized Treemap layout method: " + _); + }; + return x2; + }, + params: ["method", "ratio", "size", "round", "padding", "paddingInner", "paddingOuter", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"], + fields: Output$4 + }); + const tree = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + nest: Nest, + pack: Pack, + partition: Partition, + stratify: Stratify, + tree: Tree, + treelinks: TreeLinks, + treemap: Treemap$1 + }, Symbol.toStringTag, { value: "Module" })); + const ALPHA_MASK = 4278190080; + function baseBitmaps($2, data2) { + const bitmap = $2.bitmap(); + (data2 || []).forEach((d) => bitmap.set($2(d.boundary[0]), $2(d.boundary[3]))); + return [bitmap, void 0]; + } + function markBitmaps($2, baseMark, avoidMarks, labelInside, isGroupArea) { + const width2 = $2.width, height2 = $2.height, border = labelInside || isGroupArea, context2 = domCanvas(width2, height2).getContext("2d"), baseMarkContext = domCanvas(width2, height2).getContext("2d"), strokeContext = border && domCanvas(width2, height2).getContext("2d"); + avoidMarks.forEach((items) => draw(context2, items, false)); + draw(baseMarkContext, baseMark, false); + if (border) { + draw(strokeContext, baseMark, true); + } + const buffer = getBuffer(context2, width2, height2), baseMarkBuffer = getBuffer(baseMarkContext, width2, height2), strokeBuffer = border && getBuffer(strokeContext, width2, height2), layer1 = $2.bitmap(), layer2 = border && $2.bitmap(); + let x2, y2, u2, v, index2, alpha, strokeAlpha, baseMarkAlpha; + for (y2 = 0; y2 < height2; ++y2) { + for (x2 = 0; x2 < width2; ++x2) { + index2 = y2 * width2 + x2; + alpha = buffer[index2] & ALPHA_MASK; + baseMarkAlpha = baseMarkBuffer[index2] & ALPHA_MASK; + strokeAlpha = border && strokeBuffer[index2] & ALPHA_MASK; + if (alpha || strokeAlpha || baseMarkAlpha) { + u2 = $2(x2); + v = $2(y2); + if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u2, v); + if (border && (alpha || strokeAlpha)) layer2.set(u2, v); + } + } + } + return [layer1, layer2]; + } + function getBuffer(context2, width2, height2) { + return new Uint32Array(context2.getImageData(0, 0, width2, height2).data.buffer); + } + function draw(context2, items, interior) { + if (!items.length) return; + const type2 = items[0].mark.marktype; + if (type2 === "group") { + items.forEach((group2) => { + group2.items.forEach((mark) => draw(context2, mark.items, interior)); + }); + } else { + Marks[type2].draw(context2, { + items: interior ? items.map(prepare) : items + }); + } + } + function prepare(source2) { + const item = rederive(source2, {}); + if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) { + return { + ...item, + strokeOpacity: 1, + stroke: "#000", + fillOpacity: 0 + }; + } + return item; + } + const DIV = 5, MOD = 31, SIZE = 32, RIGHT0 = new Uint32Array(SIZE + 1), RIGHT1 = new Uint32Array(SIZE + 1); + RIGHT1[0] = 0; + RIGHT0[0] = ~RIGHT1[0]; + for (let i = 1; i <= SIZE; ++i) { + RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; + RIGHT0[i] = ~RIGHT1[i]; + } + function Bitmap(w2, h2) { + const array2 = new Uint32Array(~~((w2 * h2 + SIZE) / SIZE)); + function _set(index2, mask) { + array2[index2] |= mask; + } + function _clear(index2, mask) { + array2[index2] &= mask; + } + return { + array: array2, + get: (x2, y2) => { + const index2 = y2 * w2 + x2; + return array2[index2 >>> DIV] & 1 << (index2 & MOD); + }, + set: (x2, y2) => { + const index2 = y2 * w2 + x2; + _set(index2 >>> DIV, 1 << (index2 & MOD)); + }, + clear: (x2, y2) => { + const index2 = y2 * w2 + x2; + _clear(index2 >>> DIV, ~(1 << (index2 & MOD))); + }, + getRange: (x2, y2, x22, y22) => { + let r = y22, start, end, indexStart, indexEnd; + for (; r >= y2; --r) { + start = r * w2 + x2; + end = r * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + if (array2[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) { + return true; + } + } else { + if (array2[indexStart] & RIGHT0[start & MOD]) return true; + if (array2[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; + for (let i = indexStart + 1; i < indexEnd; ++i) { + if (array2[i]) return true; + } + } + } + return false; + }, + setRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); + } else { + _set(indexStart, RIGHT0[start & MOD]); + _set(indexEnd, RIGHT1[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 4294967295); + } + } + }, + clearRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); + } else { + _clear(indexStart, RIGHT1[start & MOD]); + _clear(indexEnd, RIGHT0[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0); + } + } + }, + outOfBounds: (x2, y2, x22, y22) => x2 < 0 || y2 < 0 || y22 >= h2 || x22 >= w2 + }; + } + function scaler(width2, height2, padding2) { + const ratio = Math.max(1, Math.sqrt(width2 * height2 / 1e6)), w2 = ~~((width2 + 2 * padding2 + ratio) / ratio), h2 = ~~((height2 + 2 * padding2 + ratio) / ratio), scale2 = (_) => ~~((_ + padding2) / ratio); + scale2.invert = (_) => _ * ratio - padding2; + scale2.bitmap = () => Bitmap(w2, h2); + scale2.ratio = ratio; + scale2.padding = padding2; + scale2.width = width2; + scale2.height = height2; + return scale2; + } + function placeAreaLabelNaive($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height; + return function(d) { + const items = d.datum.datum.items[markIndex].items, n = items.length, textHeight = d.datum.fontSize, textWidth = textMetrics.width(d.datum, d.datum.text); + let maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + areaWidth = Math.abs(x2 - x12 + y2 - y12); + if (areaWidth >= maxAreaWidth) { + maxAreaWidth = areaWidth; + d.x = x3; + d.y = y3; + } + } + x3 = textWidth / 2; + y3 = textHeight / 2; + x12 = d.x - x3; + x2 = d.x + x3; + y12 = d.y - y3; + y2 = d.y + y3; + d.align = "center"; + if (x12 < 0 && x2 <= width2) { + d.align = "left"; + } else if (0 <= x12 && width2 < x2) { + d.align = "right"; + } + d.baseline = "middle"; + if (y12 < 0 && y2 <= height2) { + d.baseline = "top"; + } else if (0 <= y12 && height2 < y2) { + d.baseline = "bottom"; + } + return true; + }; + } + function outOfBounds(x2, y2, textWidth, textHeight, width2, height2) { + let r = textWidth / 2; + return x2 - r < 0 || x2 + r > width2 || y2 - (r = textHeight / 2) < 0 || y2 + r > height2; + } + function collision($2, x2, y2, textHeight, textWidth, h2, bm0, bm1) { + const w2 = textWidth * h2 / (textHeight * 2), x12 = $2(x2 - w2), x22 = $2(x2 + w2), y12 = $2(y2 - (h2 = h2 / 2)), y22 = $2(y2 + h2); + return bm0.outOfBounds(x12, y12, x22, y22) || bm0.getRange(x12, y12, x22, y22) || bm1 && bm1.getRange(x12, y12, x22, y22); + } + function placeAreaLabelReducedSearch($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1]; + function tryLabel(_x, _y, maxSize, textWidth, textHeight) { + const x2 = $2.invert(_x), y2 = $2.invert(_y); + let lo = maxSize, hi = height2, mid; + if (!outOfBounds(x2, y2, textWidth, textHeight, width2, height2) && !collision($2, x2, y2, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x2, y2, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x2, y2, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + return [x2, y2, lo, true]; + } + } + } + return function(d) { + const items = d.datum.datum.items[markIndex].items, n = items.length, textHeight = d.datum.fontSize, textWidth = textMetrics.width(d.datum, d.datum.text); + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + if (x12 > x2) { + swapTmp = x12; + x12 = x2; + x2 = swapTmp; + } + if (y12 > y2) { + swapTmp = y12; + y12 = y2; + y2 = swapTmp; + } + _x1 = $2(x12); + _x2 = $2(x2); + _xMid = ~~((_x1 + _x2) / 2); + _y1 = $2(y12); + _y2 = $2(y2); + _yMid = ~~((_y1 + _y2) / 2); + for (_x = _xMid; _x >= _x1; --_x) { + for (_y = _yMid; _y >= _y1; --_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d.x, d.y, maxSize, labelPlaced] = result; + } + } + } + for (_x = _xMid; _x <= _x2; ++_x) { + for (_y = _yMid; _y <= _y2; ++_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d.x, d.y, maxSize, labelPlaced] = result; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d.x = x3; + d.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d.x - x3), $2(d.y - y3), $2(d.x + x3), $2(d.y + y3)); + d.align = "center"; + d.baseline = "middle"; + return true; + } else { + return false; + } }; - return forward; -} -var mollweideRaw = mollweideBromleyRaw((0, _mathJs.sqrt2) / (0, _mathJs.halfPi), (0, _mathJs.sqrt2), (0, _mathJs.pi)); - -},{"d3-geo":"lY61T","./math.js":"lq3g8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lq3g8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "round", ()=>round); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "sqrt1_2", ()=>sqrt1_2); -parcelHelpers.export(exports, "sqrt2", ()=>sqrt2); -parcelHelpers.export(exports, "sqrtPi", ()=>sqrtPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "sinci", ()=>sinci); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tanh", ()=>tanh); -parcelHelpers.export(exports, "sinh", ()=>sinh); -parcelHelpers.export(exports, "cosh", ()=>cosh); -parcelHelpers.export(exports, "arsinh", ()=>arsinh); -parcelHelpers.export(exports, "arcosh", ()=>arcosh); -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var ceil = Math.ceil; -var cos = Math.cos; -var exp = Math.exp; -var floor = Math.floor; -var log = Math.log; -var max = Math.max; -var min = Math.min; -var pow = Math.pow; -var round = Math.round; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sin = Math.sin; -var tan = Math.tan; -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var sqrt1_2 = Math.SQRT1_2; -var sqrt2 = sqrt(2); -var sqrtPi = sqrt(pi); -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -function sinci(x) { - return x ? x / Math.sin(x) : 1; -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function sqrt(x) { - return x > 0 ? Math.sqrt(x) : 0; -} -function tanh(x) { - x = exp(2 * x); - return (x - 1) / (x + 1); -} -function sinh(x) { - return (exp(x) - exp(-x)) / 2; -} -function cosh(x) { - return (exp(x) + exp(-x)) / 2; -} -function arsinh(x) { - return log(x + sqrt(x * x + 1)); -} -function arcosh(x) { - return log(x + sqrt(x * x - 1)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4JCry":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "force", ()=>Force); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Force = require("d3-force"); -const ForceMap = { - center: (0, _d3Force.forceCenter), - collide: (0, _d3Force.forceCollide), - nbody: (0, _d3Force.forceManyBody), - link: (0, _d3Force.forceLink), - x: (0, _d3Force.forceX), - y: (0, _d3Force.forceY) -}; -const Forces = 'forces', ForceParams = [ - 'alpha', - 'alphaMin', - 'alphaTarget', - 'velocityDecay', - 'forces' -], ForceConfig = [ - 'static', - 'iterations' -], ForceOutput = [ - 'x', - 'y', - 'vx', - 'vy' -]; -/** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<object>} params.forces - The forces to apply. - */ function Force(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Force.Definition = { - 'type': 'Force', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'static', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'restart', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 300 - }, - { - 'name': 'alpha', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'alphaMin', - 'type': 'number', - 'default': 0.001 - }, - { - 'name': 'alphaTarget', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'velocityDecay', - 'type': 'number', - 'default': 0.4 - }, - { - 'name': 'forces', - 'type': 'param', - 'array': true, - 'params': [ - { - 'key': { - 'force': 'center' - }, - 'params': [ - { - 'name': 'x', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'y', - 'type': 'number', - 'default': 0 - } - ] - }, - { - 'key': { - 'force': 'collide' - }, - 'params': [ - { - 'name': 'radius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'default': 0.7 - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'nbody' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': -30, - 'expr': true - }, - { - 'name': 'theta', - 'type': 'number', - 'default': 0.9 - }, - { - 'name': 'distanceMin', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'distanceMax', - 'type': 'number' - } - ] - }, - { - 'key': { - 'force': 'link' - }, - 'params': [ - { - 'name': 'links', - 'type': 'data' - }, - { - 'name': 'id', - 'type': 'field' - }, - { - 'name': 'distance', - 'type': 'number', - 'default': 30, - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'expr': true - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'x' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'x', - 'type': 'field' - } - ] - }, - { - 'key': { - 'force': 'y' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'y', - 'type': 'field' - } - ] - } - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'modify': false, - 'default': ForceOutput - } - ] -}; -(0, _vegaUtil.inherits)(Force, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sim = this.value, change = pulse.changed(pulse.ADD_REM), params = _.modified(ForceParams), iters = _.iterations || 300; - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init + } + const X_DIR = [-1, -1, 1, 1]; + const Y_DIR = [-1, 1, -1, 1]; + function placeAreaLabelFloodFill($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], bm2 = $2.bitmap(); + return function(d) { + const items = d.datum.datum.items[markIndex].items, n = items.length, textHeight = d.datum.fontSize, textWidth = textMetrics.width(d.datum, d.datum.text), stack = []; + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, lo, hi, mid, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + stack.push([$2((x12 + x2) / 2), $2((y12 + y2) / 2)]); + while (stack.length) { + [_x, _y] = stack.pop(); + if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; + bm2.set(_x, _y); + for (let j = 0; j < 4; ++j) { + x3 = _x + X_DIR[j]; + y3 = _y + Y_DIR[j]; + if (!bm2.outOfBounds(x3, y3, x3, y3)) stack.push([x3, y3]); + } + x3 = $2.invert(_x); + y3 = $2.invert(_y); + lo = maxSize; + hi = height2; + if (!outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x3, y3, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + d.x = x3; + d.y = y3; + maxSize = lo; + labelPlaced = true; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d.x = x3; + d.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d.x - x3), $2(d.y - y3), $2(d.x + x3), $2(d.y + y3)); + d.align = "center"; + d.baseline = "middle"; + return true; + } else { + return false; + } + }; + } + const Aligns = ["right", "center", "left"], Baselines = ["bottom", "middle", "top"]; + function placeMarkLabel($2, bitmaps, anchors, offsets2) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets2.length; + return function(d) { + const boundary = d.boundary, textHeight = d.datum.fontSize; + if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width2 || boundary[3] > height2) { + return false; + } + let textWidth = d.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x12, x2, y12, y2, xc, yc, _x1, _x2, _y1, _y2; + for (let i = 0; i < n; ++i) { + dx = (anchors[i] & 3) - 1; + dy = (anchors[i] >>> 2 & 3) - 1; + isInside = dx === 0 && dy === 0 || offsets2[i] < 0; + sizeFactor = dx && dy ? Math.SQRT1_2 : 1; + insideFactor = offsets2[i] < 0 ? -1 : 1; + x12 = boundary[1 + dx] + offsets2[i] * dx * sizeFactor; + yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets2[i] * dy * sizeFactor; + y12 = yc - textHeight / 2; + y2 = yc + textHeight / 2; + _x1 = $2(x12); + _y1 = $2(y12); + _y2 = $2(y2); + if (!textWidth) { + if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x12, x12, y12, y2, boundary, isInside)) { + continue; + } else { + textWidth = textMetrics.width(d.datum, d.datum.text); + } + } + xc = x12 + insideFactor * textWidth * dx / 2; + x12 = xc - textWidth / 2; + x2 = xc + textWidth / 2; + _x1 = $2(x12); + _x2 = $2(x2); + if (test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside)) { + d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x12; + d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y12; + d.align = Aligns[dx * insideFactor + 1]; + d.baseline = Baselines[dy * insideFactor + 1]; + bm0.setRange(_x1, _y1, _x2, _y2); + return true; + } + } + return false; + }; + } + function test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside) { + return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); + } + const TOP = 0, MIDDLE = 4, BOTTOM = 8, LEFT = 0, CENTER = 1, RIGHT = 2; + const anchorCode = { + "top-left": TOP + LEFT, + "top": TOP + CENTER, + "top-right": TOP + RIGHT, + "left": MIDDLE + LEFT, + "middle": MIDDLE + CENTER, + "right": MIDDLE + RIGHT, + "bottom-left": BOTTOM + LEFT, + "bottom": BOTTOM + CENTER, + "bottom-right": BOTTOM + RIGHT + }; + const placeAreaLabel = { + "naive": placeAreaLabelNaive, + "reduced-search": placeAreaLabelReducedSearch, + "floodfill": placeAreaLabelFloodFill + }; + function labelLayout(texts, size2, compare2, offset2, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding2, method2) { + if (!texts.length) return texts; + const positions = Math.max(offset2.length, anchor.length), offsets2 = getOffsets(offset2, positions), anchors = getAnchors(anchor, positions), marktype = markType(texts[0].datum), grouptype = marktype === "group" && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === "area", boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding2 === null || padding2 === Infinity, isNaiveGroupArea = isGroupArea && method2 === "naive"; + let maxTextWidth = -1, maxTextHeight = -1; + const data2 = texts.map((d) => { + const textWidth = infPadding ? textMetrics.width(d, d.text) : void 0; + maxTextWidth = Math.max(maxTextWidth, textWidth); + maxTextHeight = Math.max(maxTextHeight, d.fontSize); + return { + datum: d, + opacity: 0, + x: void 0, + y: void 0, + align: void 0, + baseline: void 0, + boundary: boundary(d), + textWidth + }; + }); + padding2 = padding2 === null || padding2 === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset2) : padding2; + const $2 = scaler(size2[0], size2[1], padding2); + let bitmaps; + if (!isNaiveGroupArea) { + if (compare2) { + data2.sort((a2, b2) => compare2(a2.datum, b2.datum)); + } + let labelInside = false; + for (let i = 0; i < anchors.length && !labelInside; ++i) { + labelInside = anchors[i] === 5 || offsets2[i] < 0; + } + const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d) => d.datum); + bitmaps = avoidMarks.length || baseMark ? markBitmaps($2, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($2, avoidBaseMark && data2); + } + const place2 = isGroupArea ? placeAreaLabel[method2]($2, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($2, bitmaps, anchors, offsets2); + data2.forEach((d) => d.opacity = +place2(d)); + return data2; + } + function getOffsets(_, count2) { + const offsets2 = new Float64Array(count2), n = _.length; + for (let i = 0; i < n; ++i) offsets2[i] = _[i] || 0; + for (let i = n; i < count2; ++i) offsets2[i] = offsets2[n - 1]; + return offsets2; + } + function getAnchors(_, count2) { + const anchors = new Int8Array(count2), n = _.length; + for (let i = 0; i < n; ++i) anchors[i] |= anchorCode[_[i]]; + for (let i = n; i < count2; ++i) anchors[i] = anchors[n - 1]; + return anchors; + } + function markType(item) { + return item && item.mark && item.mark.marktype; + } + function markBoundary(marktype, grouptype, lineAnchor, markIndex) { + const xy = (d) => [d.x, d.x, d.x, d.y, d.y, d.y]; + if (!marktype) { + return xy; + } else if (marktype === "line" || marktype === "area") { + return (d) => xy(d.datum); + } else if (grouptype === "line") { + return (d) => { + const items = d.datum.items[markIndex].items; + return xy(items.length ? items[lineAnchor === "start" ? 0 : items.length - 1] : { + x: NaN, + y: NaN + }); + }; + } else { + return (d) => { + const b2 = d.datum.bounds; + return [b2.x1, (b2.x1 + b2.x2) / 2, b2.x2, b2.y1, (b2.y1 + b2.y2) / 2, b2.y2]; + }; + } + } + const Output$1 = ["x", "y", "opacity", "align", "baseline"]; + const Anchors = ["top-left", "left", "bottom-left", "top", "bottom", "top-right", "right", "bottom-right"]; + function Label$1(params2) { + Transform.call(this, null, params2); + } + Label$1.Definition = { + type: "Label", + metadata: { + modifies: true + }, + params: [{ + name: "size", + type: "number", + array: true, + length: 2, + required: true + }, { + name: "sort", + type: "compare" + }, { + name: "anchor", + type: "string", + array: true, + default: Anchors + }, { + name: "offset", + type: "number", + array: true, + default: [1] + }, { + name: "padding", + type: "number", + default: 0, + null: true + }, { + name: "lineAnchor", + type: "string", + values: ["start", "end"], + default: "end" + }, { + name: "markIndex", + type: "number", + default: 0 + }, { + name: "avoidBaseMark", + type: "boolean", + default: true + }, { + name: "avoidMarks", + type: "data", + array: true + }, { + name: "method", + type: "string", + default: "naive" + }, { + name: "as", + type: "string", + array: true, + length: Output$1.length, + default: Output$1 + }] + }; + inherits(Label$1, Transform, { + transform(_, pulse2) { + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || modp("sort"))) return; + if (!_.size || _.size.length !== 2) { + error("Size parameter should be specified as a [width, height] array."); + } + const as = _.as || Output$1; + labelLayout(pulse2.materialize(pulse2.SOURCE).source || [], _.size, _.sort, array$5(_.offset == null ? 1 : _.offset), array$5(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || "end", _.markIndex || 0, _.padding === void 0 ? 0 : _.padding, _.method || "naive").forEach((l) => { + const t = l.datum; + t[as[0]] = l.x; + t[as[1]] = l.y; + t[as[2]] = l.opacity; + t[as[3]] = l.align; + t[as[4]] = l.baseline; + }); + return pulse2.reflow(mod).modifies(as); + } + }); + const label = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + label: Label$1 + }, Symbol.toStringTag, { value: "Module" })); + function partition(data2, groupby) { + var groups = [], get2 = function(f) { + return f(t); + }, map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); + } + g.push(t); + } + } + return groups; + } + function Loess(params2) { + Transform.call(this, null, params2); + } + Loess.Definition = { + "type": "Loess", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "bandwidth", + "type": "number", + "default": 0.3 + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Loess, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), m2 = names.length, as = _.as || [accessorName(_.x), accessorName(_.y)], values2 = []; + groups.forEach((g) => { + loess(g, _.x, _.y, _.bandwidth || 0.3).forEach((p) => { + const t = {}; + for (let i = 0; i < m2; ++i) { + t[names[i]] = g.dims[i]; } - pulse.modifies('index'); + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const Methods = { + constant: constant$4, + linear: linear$2, + log: log$3, + exp: exp$1, + pow: pow$3, + quad, + poly + }; + const degreesOfFreedom = (method2, order) => method2 === "poly" ? order : method2 === "quad" ? 2 : 1; + function Regression(params2) { + Transform.call(this, null, params2); + } + Regression.Definition = { + "type": "Regression", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "string", + "default": "linear", + "values": Object.keys(Methods) + }, { + "name": "order", + "type": "number", + "default": 3 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "params", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Regression, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), method2 = _.method || "linear", order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method2, order), as = _.as || [accessorName(_.x), accessorName(_.y)], fit2 = Methods[method2], values2 = []; + let domain2 = _.extent; + if (!has$1(Methods, method2)) { + error("Invalid regression method: " + method2); + } + if (domain2 != null) { + if (method2 === "log" && domain2[0] <= 0) { + pulse2.dataflow.warn("Ignoring extent with values <= 0 for log regression."); + domain2 = null; + } + } + groups.forEach((g) => { + const n = g.length; + if (n <= dof) { + pulse2.dataflow.warn("Skipping regression with more parameters than data points."); + return; + } + const model = fit2(g, _.x, _.y, order); + if (_.params) { + values2.push(ingest$1({ + keys: g.dims, + coef: model.coef, + rSquared: model.rSquared + })); + return; + } + const dom = domain2 || extent(g, _.x), add2 = (p) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }; + if (method2 === "linear" || method2 === "constant") { + dom.forEach((x2) => add2([x2, model.predict(x2)])); + } else { + sampleCurve(model.predict, dom, 25, 200).forEach(add2); + } + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const reg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + loess: Loess, + regression: Regression + }, Symbol.toStringTag, { value: "Module" })); + const epsilon$1 = 11102230246251565e-32; + const splitter = 134217729; + const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1; + function sum(elen, e, flen, f, h2) { + let Q, Qnew, hh, bvirt; + let enow = e[0]; + let fnow = f[0]; + let eindex = 0; + let findex = 0; + if (fnow > enow === fnow > -enow) { + Q = enow; + enow = e[++eindex]; + } else { + Q = fnow; + fnow = f[++findex]; + } + let hindex = 0; + if (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = enow + Q; + hh = Q - (Qnew - enow); + enow = e[++eindex]; + } else { + Qnew = fnow + Q; + hh = Q - (Qnew - fnow); + fnow = f[++findex]; + } + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + while (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) setup(sim, _, 0, pulse); - } - // run simulation - if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - if (_.static) for(sim.stop(); --iters >= 0;)sim.tick(); - else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; } - return this.finish(_, pulse); - }, - finish (_, pulse) { - const dataflow = pulse.dataflow; - // inspect dependencies, touch link source data - for(let args = this._argops, j = 0, m = args.length, arg; j < m; ++j){ - arg = args[j]; - if (arg.name !== Forces || arg.op._argval.force !== 'link') continue; - for(var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i)if (ops[i].name === 'links' && (op = ops[i].op.source)) { - dataflow.pulse(op, dataflow.changeset().reflow()); - break; - } + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; } - // reflow all nodes - return pulse.reflow(_.modified()).modifies(ForceOutput); + } } -}); -function rerun(df, op) { - return ()=>df.touch(op).run(); -} -function simulation(nodes, _) { - const sim = (0, _d3Force.forceSimulation)(nodes), stop = sim.stop, restart = sim.restart; - let stopped = false; - sim.stopped = ()=>stopped; - sim.restart = ()=>(stopped = false, restart()); - sim.stop = ()=>(stopped = true, stop()); - return setup(sim, _, true).on('end', ()=>stopped = true); -} -function setup(sim, _, init, pulse) { - var f = (0, _vegaUtil.array)(_.forces), i, n, p, name; - for(i = 0, n = ForceParams.length; i < n; ++i){ - p = ForceParams[i]; - if (p !== Forces && _.modified(p)) sim[p](_[p]); - } - for(i = 0, n = f.length; i < n; ++i){ - name = Forces + i; - p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null; - if (p) sim.force(name, p); - } - for(n = sim.numForces || 0; i < n; ++i)sim.force(Forces + i, null); // remove - sim.numForces = f.length; - return sim; -} -function modified(f, pulse) { - var k, v; - for(k in f){ - if ((0, _vegaUtil.isFunction)(v = f[k]) && pulse.modified((0, _vegaUtil.accessorFields)(v))) return 1; + while (eindex < elen) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + while (findex < flen) { + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + if (Q !== 0 || hindex === 0) { + h2[hindex++] = Q; + } + return hindex; + } + function estimate(elen, e) { + let Q = e[0]; + for (let i = 1; i < elen; i++) Q += e[i]; + return Q; + } + function vec(n) { + return new Float64Array(n); + } + const ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1; + const ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1; + const ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1; + const B = vec(4); + const C1 = vec(8); + const C2 = vec(12); + const D = vec(16); + const u = vec(4); + function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { + let acxtail, acytail, bcxtail, bcytail; + let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3; + const acx = ax - cx; + const bcx = bx - cx; + const acy = ay - cy; + const bcy = by - cy; + s1 = acx * bcy; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcx; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + B[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + B[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + B[2] = _j - (u3 - bvirt) + (_i - bvirt); + B[3] = u3; + let det = estimate(4, B); + let errbound = ccwerrboundB * detsum; + if (det >= errbound || -det >= errbound) { + return det; + } + bvirt = ax - acx; + acxtail = ax - (acx + bvirt) + (bvirt - cx); + bvirt = bx - bcx; + bcxtail = bx - (bcx + bvirt) + (bvirt - cx); + bvirt = ay - acy; + acytail = ay - (acy + bvirt) + (bvirt - cy); + bvirt = by - bcy; + bcytail = by - (bcy + bvirt) + (bvirt - cy); + if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) { + return det; + } + errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); + det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); + if (det >= errbound || -det >= errbound) return det; + s1 = acxtail * bcy; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcx; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C1len = sum(4, B, 4, u, C1); + s1 = acx * bcytail; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcxtail; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C2len = sum(C1len, C1, 4, u, C2); + s1 = acxtail * bcytail; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcxtail; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const Dlen = sum(C2len, C2, 4, u, D); + return D[Dlen - 1]; + } + function orient2d(ax, ay, bx, by, cx, cy) { + const detleft = (ay - cy) * (bx - cx); + const detright = (ax - cx) * (by - cy); + const det = detleft - detright; + const detsum = Math.abs(detleft + detright); + if (Math.abs(det) >= ccwerrboundA * detsum) return det; + return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); + } + const EPSILON$1 = Math.pow(2, -52); + const EDGE_STACK = new Uint32Array(512); + class Delaunator { + static from(points2, getX = defaultGetX, getY = defaultGetY) { + const n = points2.length; + const coords = new Float64Array(n * 2); + for (let i = 0; i < n; i++) { + const p = points2[i]; + coords[2 * i] = getX(p); + coords[2 * i + 1] = getY(p); + } + return new Delaunator(coords); + } + constructor(coords) { + const n = coords.length >> 1; + if (n > 0 && typeof coords[0] !== "number") throw new Error("Expected coords to contain numbers."); + this.coords = coords; + const maxTriangles = Math.max(2 * n - 5, 0); + this._triangles = new Uint32Array(maxTriangles * 3); + this._halfedges = new Int32Array(maxTriangles * 3); + this._hashSize = Math.ceil(Math.sqrt(n)); + this._hullPrev = new Uint32Array(n); + this._hullNext = new Uint32Array(n); + this._hullTri = new Uint32Array(n); + this._hullHash = new Int32Array(this._hashSize); + this._ids = new Uint32Array(n); + this._dists = new Float64Array(n); + this.update(); } - return 0; -} -function getForce(_) { - var f, p; - if (!(0, _vegaUtil.hasOwnProperty)(ForceMap, _.force)) (0, _vegaUtil.error)('Unrecognized force: ' + _.force); - f = ForceMap[_.force](); - for(p in _)if ((0, _vegaUtil.isFunction)(f[p])) setForceParam(f[p], _[p], _); - return f; -} -function setForceParam(f, v, _) { - f((0, _vegaUtil.isFunction)(v) ? (d)=>v(d, _) : v); -} - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-force":"kTqQn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kTqQn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "forceCenter", ()=>(0, _centerJsDefault.default)); -parcelHelpers.export(exports, "forceCollide", ()=>(0, _collideJsDefault.default)); -parcelHelpers.export(exports, "forceLink", ()=>(0, _linkJsDefault.default)); -parcelHelpers.export(exports, "forceManyBody", ()=>(0, _manyBodyJsDefault.default)); -parcelHelpers.export(exports, "forceRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "forceSimulation", ()=>(0, _simulationJsDefault.default)); -parcelHelpers.export(exports, "forceX", ()=>(0, _xJsDefault.default)); -parcelHelpers.export(exports, "forceY", ()=>(0, _yJsDefault.default)); -var _centerJs = require("./center.js"); -var _centerJsDefault = parcelHelpers.interopDefault(_centerJs); -var _collideJs = require("./collide.js"); -var _collideJsDefault = parcelHelpers.interopDefault(_collideJs); -var _linkJs = require("./link.js"); -var _linkJsDefault = parcelHelpers.interopDefault(_linkJs); -var _manyBodyJs = require("./manyBody.js"); -var _manyBodyJsDefault = parcelHelpers.interopDefault(_manyBodyJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _simulationJs = require("./simulation.js"); -var _simulationJsDefault = parcelHelpers.interopDefault(_simulationJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); - -},{"./center.js":"cmuXj","./collide.js":"kAxiK","./link.js":"dpYez","./manyBody.js":"1XMYH","./radial.js":false,"./simulation.js":"k5O0L","./x.js":"byekK","./y.js":"eIzZp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cmuXj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var nodes, strength = 1; - if (x == null) x = 0; - if (y == null) y = 0; - function force() { - var i, n = nodes.length, node, sx = 0, sy = 0; - for(i = 0; i < n; ++i)node = nodes[i], sx += node.x, sy += node.y; - for(sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i)node = nodes[i], node.x -= sx, node.y -= sy; - } - force.initialize = function(_) { - nodes = _; - }; - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - return force; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kAxiK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var nodes, radii, random, strength = 1, iterations = 1; - if (typeof radius !== "function") radius = (0, _constantJsDefault.default)(radius == null ? 1 : +radius); - function force() { - var i, n = nodes.length, tree, node, xi, yi, ri, ri2; - for(var k = 0; k < iterations; ++k){ - tree = (0, _d3Quadtree.quadtree)(nodes, x, y).visitAfter(prepare); - for(i = 0; i < n; ++i){ - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, y = yi - data.y - data.vy, l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= y * r; - } - } - return; - } - return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; - } + update() { + const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; + const n = coords.length >> 1; + let minX = Infinity; + let minY = Infinity; + let maxX = -Infinity; + let maxY2 = -Infinity; + for (let i = 0; i < n; i++) { + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (x2 < minX) minX = x2; + if (y2 < minY) minY = y2; + if (x2 > maxX) maxX = x2; + if (y2 > maxY2) maxY2 = y2; + this._ids[i] = i; + } + const cx = (minX + maxX) / 2; + const cy = (minY + maxY2) / 2; + let i0, i1, i2; + for (let i = 0, minDist = Infinity; i < n; i++) { + const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); + if (d < minDist) { + i0 = i; + minDist = d; } - function prepare(quad) { - if (quad.data) return quad.r = radii[quad.data.index]; - for(var i = quad.r = 0; i < 4; ++i)if (quad[i] && quad[i].r > quad.r) quad.r = quad[i].r; + } + const i0x = coords[2 * i0]; + const i0y = coords[2 * i0 + 1]; + for (let i = 0, minDist = Infinity; i < n; i++) { + if (i === i0) continue; + const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); + if (d < minDist && d > 0) { + i1 = i; + minDist = d; } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], radii[node.index] = +radius(node, i, nodes); + } + let i1x = coords[2 * i1]; + let i1y = coords[2 * i1 + 1]; + let minRadius = Infinity; + for (let i = 0; i < n; i++) { + if (i === i0 || i === i1) continue; + const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); + if (r < minRadius) { + i2 = i; + minRadius = r; } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : radius; - }; - return force; - }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function x(d) { - return d.x + d.vx; -} -function y(d) { - return d.y + d.vy; -} - -},{"d3-quadtree":"37u8M","./constant.js":"gq4mo","./jiggle.js":"2qIlb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"37u8M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "quadtree", ()=>(0, _quadtreeJsDefault.default)); -var _quadtreeJs = require("./quadtree.js"); -var _quadtreeJsDefault = parcelHelpers.interopDefault(_quadtreeJs); - -},{"./quadtree.js":"3kHO8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3kHO8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quadtree); -var _addJs = require("./add.js"); -var _addJsDefault = parcelHelpers.interopDefault(_addJs); -var _coverJs = require("./cover.js"); -var _coverJsDefault = parcelHelpers.interopDefault(_coverJs); -var _dataJs = require("./data.js"); -var _dataJsDefault = parcelHelpers.interopDefault(_dataJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _removeJs = require("./remove.js"); -var _removeJsDefault = parcelHelpers.interopDefault(_removeJs); -var _rootJs = require("./root.js"); -var _rootJsDefault = parcelHelpers.interopDefault(_rootJs); -var _sizeJs = require("./size.js"); -var _sizeJsDefault = parcelHelpers.interopDefault(_sizeJs); -var _visitJs = require("./visit.js"); -var _visitJsDefault = parcelHelpers.interopDefault(_visitJs); -var _visitAfterJs = require("./visitAfter.js"); -var _visitAfterJsDefault = parcelHelpers.interopDefault(_visitAfterJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); -function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? (0, _xJs.defaultX) : x, y == null ? (0, _yJs.defaultY) : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; -} -function leaf_copy(leaf) { - var copy = { - data: leaf.data - }, next = copy; - while(leaf = leaf.next)next = next.next = { - data: leaf.data - }; - return copy; -} -var treeProto = quadtree.prototype = Quadtree.prototype; -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; - if (!node) return copy; - if (!node.length) return copy._root = leaf_copy(node), copy; - nodes = [ - { - source: node, - target: copy._root = new Array(4) + } + let i2x = coords[2 * i2]; + let i2y = coords[2 * i2 + 1]; + if (minRadius === Infinity) { + for (let i = 0; i < n; i++) { + this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; } - ]; - while(node = nodes.pop()){ - for(var i = 0; i < 4; ++i)if (child = node.source[i]) { - if (child.length) nodes.push({ - source: child, - target: node.target[i] = new Array(4) - }); - else node.target[i] = leaf_copy(child); - } - } - return copy; -}; -treeProto.add = (0, _addJsDefault.default); -treeProto.addAll = (0, _addJs.addAll); -treeProto.cover = (0, _coverJsDefault.default); -treeProto.data = (0, _dataJsDefault.default); -treeProto.extent = (0, _extentJsDefault.default); -treeProto.find = (0, _findJsDefault.default); -treeProto.remove = (0, _removeJsDefault.default); -treeProto.removeAll = (0, _removeJs.removeAll); -treeProto.root = (0, _rootJsDefault.default); -treeProto.size = (0, _sizeJsDefault.default); -treeProto.visit = (0, _visitJsDefault.default); -treeProto.visitAfter = (0, _visitAfterJsDefault.default); -treeProto.x = (0, _xJsDefault.default); -treeProto.y = (0, _yJsDefault.default); - -},{"./add.js":"5Rd7q","./cover.js":"bMVUj","./data.js":"8gCAF","./extent.js":"55OBQ","./find.js":"7wO3V","./remove.js":"aDV7k","./root.js":"i8Ybu","./size.js":"9DeOu","./visit.js":"4YvSz","./visitAfter.js":"fin30","./x.js":"39OFs","./y.js":"9VKON","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Rd7q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - const x = +this._x.call(null, d), y = +this._y.call(null, d); - return add(this.cover(x, y), x, y, d); - }); -parcelHelpers.export(exports, "addAll", ()=>addAll); -function add(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points - var parent, node = tree._root, leaf = { - data: d - }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return tree._root = leaf, tree; - // Find the existing leaf for the new point, or add it. - while(node.length){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - }while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); - return parent[j] = node, parent[i] = leaf, tree; -} -function addAll(data) { - var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity; - // Compute the points and their extent. - for(i = 0; i < n; ++i){ - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; - } - // If there were no (valid) points, abort. - if (x0 > x1 || y0 > y1) return this; - // Expand the tree to cover the new points. - this.cover(x0, y0).cover(x1, y1); - // Add the new points. - for(i = 0; i < n; ++i)add(this, xz[i], yz[i], data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bMVUj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1; - // If the quadtree has no extent, initialize them. - // Integer extent are necessary so that if we later double the extent, - // the existing quadrant boundaries don’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; + quicksort(this._ids, this._dists, 0, n - 1); + const hull = new Uint32Array(n); + let j = 0; + for (let i = 0, d0 = -Infinity; i < n; i++) { + const id2 = this._ids[i]; + const d = this._dists[id2]; + if (d > d0) { + hull[j++] = id2; + d0 = d; + } + } + this.hull = hull.subarray(0, j); + this.triangles = new Uint32Array(0); + this.halfedges = new Uint32Array(0); + return; + } + if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { + const i = i1; + const x2 = i1x; + const y2 = i1y; + i1 = i2; + i1x = i2x; + i1y = i2y; + i2 = i; + i2x = x2; + i2y = y2; + } + const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); + this._cx = center.x; + this._cy = center.y; + for (let i = 0; i < n; i++) { + this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); + } + quicksort(this._ids, this._dists, 0, n - 1); + this._hullStart = i0; + let hullSize = 3; + hullNext[i0] = hullPrev[i2] = i1; + hullNext[i1] = hullPrev[i0] = i2; + hullNext[i2] = hullPrev[i1] = i0; + hullTri[i0] = 0; + hullTri[i1] = 1; + hullTri[i2] = 2; + hullHash.fill(-1); + hullHash[this._hashKey(i0x, i0y)] = i0; + hullHash[this._hashKey(i1x, i1y)] = i1; + hullHash[this._hashKey(i2x, i2y)] = i2; + this.trianglesLen = 0; + this._addTriangle(i0, i1, i2, -1, -1, -1); + for (let k = 0, xp, yp; k < this._ids.length; k++) { + const i = this._ids[k]; + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (k > 0 && Math.abs(x2 - xp) <= EPSILON$1 && Math.abs(y2 - yp) <= EPSILON$1) continue; + xp = x2; + yp = y2; + if (i === i0 || i === i1 || i === i2) continue; + let start = 0; + for (let j = 0, key2 = this._hashKey(x2, y2); j < this._hashSize; j++) { + start = hullHash[(key2 + j) % this._hashSize]; + if (start !== -1 && start !== hullNext[start]) break; + } + start = hullPrev[start]; + let e = start, q; + while (q = hullNext[e], orient2d(x2, y2, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) { + e = q; + if (e === start) { + e = -1; + break; + } + } + if (e === -1) continue; + let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); + hullTri[i] = this._legalize(t + 2); + hullTri[e] = t; + hullSize++; + let n2 = hullNext[e]; + while (q = hullNext[n2], orient2d(x2, y2, coords[2 * n2], coords[2 * n2 + 1], coords[2 * q], coords[2 * q + 1]) < 0) { + t = this._addTriangle(n2, i, q, hullTri[i], -1, hullTri[n2]); + hullTri[i] = this._legalize(t + 2); + hullNext[n2] = n2; + hullSize--; + n2 = q; + } + if (e === start) { + while (q = hullPrev[e], orient2d(x2, y2, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) { + t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); + this._legalize(t + 2); + hullTri[q] = t; + hullNext[e] = e; + hullSize--; + e = q; + } + } + this._hullStart = hullPrev[i] = e; + hullNext[e] = hullPrev[n2] = i; + hullNext[i] = n2; + hullHash[this._hashKey(x2, y2)] = i; + hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; + } + this.hull = new Uint32Array(hullSize); + for (let i = 0, e = this._hullStart; i < hullSize; i++) { + this.hull[i] = e; + e = hullNext[e]; + } + this.triangles = this._triangles.subarray(0, this.trianglesLen); + this.halfedges = this._halfedges.subarray(0, this.trianglesLen); + } + _hashKey(x2, y2) { + return Math.floor(pseudoAngle(x2 - this._cx, y2 - this._cy) * this._hashSize) % this._hashSize; + } + _legalize(a2) { + const { _triangles: triangles, _halfedges: halfedges, coords } = this; + let i = 0; + let ar = 0; + while (true) { + const b2 = halfedges[a2]; + const a0 = a2 - a2 % 3; + ar = a0 + (a2 + 2) % 3; + if (b2 === -1) { + if (i === 0) break; + a2 = EDGE_STACK[--i]; + continue; + } + const b0 = b2 - b2 % 3; + const al = a0 + (a2 + 1) % 3; + const bl2 = b0 + (b2 + 2) % 3; + const p02 = triangles[ar]; + const pr = triangles[a2]; + const pl = triangles[al]; + const p1 = triangles[bl2]; + const illegal = inCircle( + coords[2 * p02], + coords[2 * p02 + 1], + coords[2 * pr], + coords[2 * pr + 1], + coords[2 * pl], + coords[2 * pl + 1], + coords[2 * p1], + coords[2 * p1 + 1] + ); + if (illegal) { + triangles[a2] = p1; + triangles[b2] = p02; + const hbl = halfedges[bl2]; + if (hbl === -1) { + let e = this._hullStart; + do { + if (this._hullTri[e] === bl2) { + this._hullTri[e] = a2; + break; + } + e = this._hullPrev[e]; + } while (e !== this._hullStart); + } + this._link(a2, hbl); + this._link(b2, halfedges[ar]); + this._link(ar, bl2); + const br2 = b0 + (b2 + 1) % 3; + if (i < EDGE_STACK.length) { + EDGE_STACK[i++] = br2; + } } else { - var z = x1 - x0 || 1, node = this._root, parent, i; - while(x0 > x || x >= x1 || y0 > y || y >= y1){ - i = (y < y0) << 1 | x < x0; - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch(i){ - case 0: - x1 = x0 + z, y1 = y0 + z; - break; - case 1: - x0 = x1 - z, y1 = y0 + z; - break; - case 2: - x1 = x0 + z, y0 = y1 - z; - break; - case 3: - x0 = x1 - z, y0 = y1 - z; - break; - } - } - if (this._root && this._root.length) this._root = node; - } - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8gCAF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); - while (node = node.next); - }); - return data; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55OBQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [ - [ - this._x0, - this._y0 - ], - [ - this._x1, - this._y1 - ] - ]; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wO3V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y, radius) { - var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; - if (node) quads.push(new (0, _quadJsDefault.default)(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - while(q = quads.pop()){ - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue; - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2; - quads.push(new (0, _quadJsDefault.default)(node[3], xm, ym, x2, y2), new (0, _quadJsDefault.default)(node[2], x1, ym, xm, y2), new (0, _quadJsDefault.default)(node[1], xm, y1, x2, ym), new (0, _quadJsDefault.default)(node[0], x1, y1, xm, ym)); - // Visit the closest quadrant first. - if (i = (y >= ym) << 1 | x >= xm) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } else { - var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } - } - return data; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"ij3wf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ij3wf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aDV7k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return this; - // Find the leaf node for the point. - // While descending, also retain the deepest parent with a non-removed sibling. - if (node.length) while(true){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; - } - // Find the point to remove. - while(node.data !== d)if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - // If there are multiple coincident points, remove just the point. - if (previous) return next ? previous.next = next : delete previous.next, this; - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; - } - return this; - }); -parcelHelpers.export(exports, "removeAll", ()=>removeAll); -function removeAll(data) { - for(var i = 0, n = data.length; i < n; ++i)this.remove(data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i8Ybu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this._root; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9DeOu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; - while (node = node.next); - }); - return size; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4YvSz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new (0, _quadJsDefault.default)(node, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop())if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); - } - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"ij3wf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fin30":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new (0, _quadJsDefault.default)(this._root, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop()){ - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - } - next.push(q); - } - while(q = next.pop())callback(q.node, q.x0, q.y0, q.x1, q.y1); - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"ij3wf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"39OFs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultX", ()=>defaultX); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._x = _, this) : this._x; - }); -function defaultX(d) { - return d[0]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VKON":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultY", ()=>defaultY); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._y = _, this) : this._y; - }); -function defaultY(d) { - return d[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gq4mo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2qIlb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(random) { - return (random() - 0.5) * 1e-6; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dpYez":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(links) { - var id = index, strength = defaultStrength, strengths, distance = (0, _constantJsDefault.default)(30), distances, nodes, count, bias, random, iterations = 1; - if (links == null) links = []; - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - function force(alpha) { - for(var k = 0, n = links.length; k < iterations; ++k)for(var i = 0, link, source, target, x, y, l, b; i < n; ++i){ - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || (0, _jiggleJsDefault.default)(random); - y = target.y + target.vy - source.y - source.vy || (0, _jiggleJsDefault.default)(random); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, m = links.length, nodeById = new Map(nodes.map((d, i)=>[ - id(d, i, nodes), - d - ])), link; - for(i = 0, count = new Array(n); i < m; ++i){ - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find(nodeById, link.source); - if (typeof link.target !== "object") link.target = find(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - for(i = 0, bias = new Array(m); i < m; ++i)link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - function initializeStrength() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)strengths[i] = +strength(links[i], i, links); - } - function initializeDistance() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)distances[i] = +distance(links[i], i, links); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeStrength(), force) : strength; - }; - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeDistance(), force) : distance; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function index(d) { - return d.index; -} -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("node not found: " + nodeId); - return node; -} - -},{"./constant.js":"gq4mo","./jiggle.js":"2qIlb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1XMYH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var nodes, node, random, alpha, strength = (0, _constantJsDefault.default)(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; - function force(_) { - var i, n = nodes.length, tree = (0, _d3Quadtree.quadtree)(nodes, (0, _simulationJs.x), (0, _simulationJs.y)).visitAfter(accumulate); - for(alpha = _, i = 0; i < n; ++i)node = nodes[i], tree.visit(apply); - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for(x = y = i = 0; i < 4; ++i)if ((q = quad[i]) && (c = Math.abs(q.value))) strength += q.value, weight += c, x += c * q.x, y += c * q.y; - quad.x = x / weight; - quad.y = y / weight; - } else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - quad.value = strength; - } - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - var x = quad.x - node.x, y = quad.y - node.y, w = x2 - x1, l = x * x + y * y; - // Apply the Barnes-Hut approximation if possible. - // Limit forces for very close nodes; randomize direction if coincident. - if (w * w / theta2 < l) { - if (l < distanceMax2) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } else if (quad.length || l >= distanceMax2) return; - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } - while (quad = quad.next); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - return force; - }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -var _simulationJs = require("./simulation.js"); - -},{"d3-quadtree":"37u8M","./constant.js":"gq4mo","./jiggle.js":"2qIlb","./simulation.js":"k5O0L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k5O0L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -parcelHelpers.export(exports, "default", ()=>function(nodes) { - var simulation, alpha = 1, alphaMin = 0.001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = (0, _d3Timer.timer)(step), event = (0, _d3Dispatch.dispatch)("tick", "end"), random = (0, _lcgJsDefault.default)(); - if (nodes == null) nodes = []; - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); - } + if (i === 0) break; + a2 = EDGE_STACK[--i]; } - function tick(iterations) { - var i, n = nodes.length, node; - if (iterations === undefined) iterations = 1; - for(var k = 0; k < iterations; ++k){ - alpha += (alphaTarget - alpha) * alphaDecay; - forces.forEach(function(force) { - force(alpha); - }); - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; - } - } - return simulation; - } - function initializeNodes() { - for(var i = 0, n = nodes.length, node; i < n; ++i){ - node = nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) node.vx = node.vy = 0; + } + return ar; + } + _link(a2, b2) { + this._halfedges[a2] = b2; + if (b2 !== -1) this._halfedges[b2] = a2; + } + // add a new triangle given vertex indices and adjacent half-edge ids + _addTriangle(i0, i1, i2, a2, b2, c2) { + const t = this.trianglesLen; + this._triangles[t] = i0; + this._triangles[t + 1] = i1; + this._triangles[t + 2] = i2; + this._link(t, a2); + this._link(t + 1, b2); + this._link(t + 2, c2); + this.trianglesLen += 3; + return t; + } + } + function pseudoAngle(dx, dy) { + const p = dx / (Math.abs(dx) + Math.abs(dy)); + return (dy > 0 ? 3 - p : 1 + p) / 4; + } + function dist(ax, ay, bx, by) { + const dx = ax - bx; + const dy = ay - by; + return dx * dx + dy * dy; + } + function inCircle(ax, ay, bx, by, cx, cy, px2, py2) { + const dx = ax - px2; + const dy = ay - py2; + const ex = bx - px2; + const ey = by - py2; + const fx = cx - px2; + const fy = cy - py2; + const ap = dx * dx + dy * dy; + const bp = ex * ex + ey * ey; + const cp = fx * fx + fy * fy; + return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; + } + function circumradius(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d = 0.5 / (dx * ey - dy * ex); + const x2 = (ey * bl2 - dy * cl) * d; + const y2 = (dx * cl - ex * bl2) * d; + return x2 * x2 + y2 * y2; + } + function circumcenter(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d = 0.5 / (dx * ey - dy * ex); + const x2 = ax + (ey * bl2 - dy * cl) * d; + const y2 = ay + (dx * cl - ex * bl2) * d; + return { x: x2, y: y2 }; + } + function quicksort(ids, dists, left, right) { + if (right - left <= 20) { + for (let i = left + 1; i <= right; i++) { + const temp2 = ids[i]; + const tempDist = dists[temp2]; + let j = i - 1; + while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; + ids[j + 1] = temp2; + } + } else { + const median2 = left + right >> 1; + let i = left + 1; + let j = right; + swap(ids, median2, i); + if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); + if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); + if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); + const temp2 = ids[i]; + const tempDist = dists[temp2]; + while (true) { + do + i++; + while (dists[ids[i]] < tempDist); + do + j--; + while (dists[ids[j]] > tempDist); + if (j < i) break; + swap(ids, i, j); + } + ids[left + 1] = ids[j]; + ids[j] = temp2; + if (right - i + 1 >= j - left) { + quicksort(ids, dists, i, right); + quicksort(ids, dists, left, j - 1); + } else { + quicksort(ids, dists, left, j - 1); + quicksort(ids, dists, i, right); + } + } + } + function swap(arr, i, j) { + const tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + } + function defaultGetX(p) { + return p[0]; + } + function defaultGetY(p) { + return p[1]; + } + const epsilon = 1e-6; + class Path { + constructor() { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + } + moveTo(x2, y2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; + } + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._ += "Z"; + } + } + lineTo(x2, y2) { + this._ += `L${this._x1 = +x2},${this._y1 = +y2}`; + } + arc(x2, y2, r) { + x2 = +x2, y2 = +y2, r = +r; + const x02 = x2 + r; + const y02 = y2; + if (r < 0) throw new Error("negative radius"); + if (this._x1 === null) this._ += `M${x02},${y02}`; + else if (Math.abs(this._x1 - x02) > epsilon || Math.abs(this._y1 - y02) > epsilon) this._ += "L" + x02 + "," + y02; + if (!r) return; + this._ += `A${r},${r},0,1,1,${x2 - r},${y2}A${r},${r},0,1,1,${this._x1 = x02},${this._y1 = y02}`; + } + rect(x2, y2, w2, h2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${+w2}v${+h2}h${-w2}Z`; + } + value() { + return this._ || null; + } + } + class Polygon { + constructor() { + this._ = []; + } + moveTo(x2, y2) { + this._.push([x2, y2]); + } + closePath() { + this._.push(this._[0].slice()); + } + lineTo(x2, y2) { + this._.push([x2, y2]); + } + value() { + return this._.length ? this._ : null; + } + } + let Voronoi$1 = class Voronoi { + constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { + if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); + this.delaunay = delaunay; + this._circumcenters = new Float64Array(delaunay.points.length * 2); + this.vectors = new Float64Array(delaunay.points.length * 2); + this.xmax = xmax, this.xmin = xmin; + this.ymax = ymax, this.ymin = ymin; + this._init(); + } + update() { + this.delaunay.update(); + this._init(); + return this; + } + _init() { + const { delaunay: { points: points2, hull, triangles }, vectors } = this; + let bx, by; + const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); + for (let i = 0, j = 0, n = triangles.length, x2, y2; i < n; i += 3, j += 2) { + const t12 = triangles[i] * 2; + const t22 = triangles[i + 1] * 2; + const t32 = triangles[i + 2] * 2; + const x13 = points2[t12]; + const y13 = points2[t12 + 1]; + const x22 = points2[t22]; + const y22 = points2[t22 + 1]; + const x3 = points2[t32]; + const y3 = points2[t32 + 1]; + const dx = x22 - x13; + const dy = y22 - y13; + const ex = x3 - x13; + const ey = y3 - y13; + const ab = (dx * ey - dy * ex) * 2; + if (Math.abs(ab) < 1e-9) { + if (bx === void 0) { + bx = by = 0; + for (const i2 of hull) bx += points2[i2 * 2], by += points2[i2 * 2 + 1]; + bx /= hull.length, by /= hull.length; + } + const a2 = 1e9 * Math.sign((bx - x13) * ey - (by - y13) * ex); + x2 = (x13 + x3) / 2 - a2 * ey; + y2 = (y13 + y3) / 2 + a2 * ex; + } else { + const d = 1 / ab; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + x2 = x13 + (ey * bl2 - dy * cl) * d; + y2 = y13 + (dx * cl - ex * bl2) * d; + } + circumcenters[j] = x2; + circumcenters[j + 1] = y2; + } + let h2 = hull[hull.length - 1]; + let p02, p1 = h2 * 4; + let x02, x12 = points2[2 * h2]; + let y02, y12 = points2[2 * h2 + 1]; + vectors.fill(0); + for (let i = 0; i < hull.length; ++i) { + h2 = hull[i]; + p02 = p1, x02 = x12, y02 = y12; + p1 = h2 * 4, x12 = points2[2 * h2], y12 = points2[2 * h2 + 1]; + vectors[p02 + 2] = vectors[p1] = y02 - y12; + vectors[p02 + 3] = vectors[p1 + 1] = x12 - x02; + } + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; + if (hull.length <= 1) return null; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = Math.floor(i / 3) * 2; + const tj = Math.floor(j / 3) * 2; + const xi = circumcenters[ti]; + const yi = circumcenters[ti + 1]; + const xj = circumcenters[tj]; + const yj = circumcenters[tj + 1]; + this._renderSegment(xi, yi, xj, yj, context2); + } + let h0, h1 = hull[hull.length - 1]; + for (let i = 0; i < hull.length; ++i) { + h0 = h1, h1 = hull[i]; + const t = Math.floor(inedges[h1] / 3) * 2; + const x2 = circumcenters[t]; + const y2 = circumcenters[t + 1]; + const v = h0 * 4; + const p = this._project(x2, y2, vectors[v + 2], vectors[v + 3]); + if (p) this._renderSegment(x2, y2, p[0], p[1], context2); + } + return buffer && buffer.value(); + } + renderBounds(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + context2.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); + return buffer && buffer.value(); + } + renderCell(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const points2 = this._clip(i); + if (points2 === null || !points2.length) return; + context2.moveTo(points2[0], points2[1]); + let n = points2.length; + while (points2[0] === points2[n - 2] && points2[1] === points2[n - 1] && n > 1) n -= 2; + for (let i2 = 2; i2 < n; i2 += 2) { + if (points2[i2] !== points2[i2 - 2] || points2[i2 + 1] !== points2[i2 - 1]) + context2.lineTo(points2[i2], points2[i2 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + *cellPolygons() { + const { delaunay: { points: points2 } } = this; + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const cell2 = this.cellPolygon(i); + if (cell2) cell2.index = i, yield cell2; + } + } + cellPolygon(i) { + const polygon = new Polygon(); + this.renderCell(i, polygon); + return polygon.value(); + } + _renderSegment(x02, y02, x12, y12, context2) { + let S; + const c0 = this._regioncode(x02, y02); + const c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + context2.moveTo(x02, y02); + context2.lineTo(x12, y12); + } else if (S = this._clipSegment(x02, y02, x12, y12, c0, c1)) { + context2.moveTo(S[0], S[1]); + context2.lineTo(S[2], S[3]); + } + } + contains(i, x2, y2) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return false; + return this.delaunay._step(i, x2, y2) === i; + } + *neighbors(i) { + const ci = this._clip(i); + if (ci) for (const j of this.delaunay.neighbors(i)) { + const cj = this._clip(j); + if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { + for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { + if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { + yield j; + break loop; } + } } - function initializeForce(force) { - if (force.initialize) force.initialize(nodes, random); - return force; + } + } + _cell(i) { + const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; + const e0 = inedges[i]; + if (e0 === -1) return null; + const points2 = []; + let e = e0; + do { + const t = Math.floor(e / 3); + points2.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + } while (e !== e0 && e !== -1); + return points2; + } + _clip(i) { + if (i === 0 && this.delaunay.hull.length === 1) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + const points2 = this._cell(i); + if (points2 === null) return null; + const { vectors: V } = this; + const v = i * 4; + return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points2, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points2)); + } + _clipFinite(i, points2) { + const n = points2.length; + let P = null; + let x02, y02, x12 = points2[n - 2], y12 = points2[n - 1]; + let c0, c1 = this._regioncode(x12, y12); + let e0, e1 = 0; + for (let j = 0; j < n; j += 2) { + x02 = x12, y02 = y12, x12 = points2[j], y12 = points2[j + 1]; + c0 = c1, c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + e0 = e1, e1 = 0; + if (P) P.push(x12, y12); + else P = [x12, y12]; + } else { + let S, sx0, sy0, sx1, sy1; + if (c0 === 0) { + if ((S = this._clipSegment(x02, y02, x12, y12, c0, c1)) === null) continue; + [sx0, sy0, sx1, sy1] = S; + } else { + if ((S = this._clipSegment(x12, y12, x02, y02, c1, c0)) === null) continue; + [sx1, sy1, sx0, sy0] = S; + e0 = e1, e1 = this._edgecode(sx0, sy0); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx0, sy0); + else P = [sx0, sy0]; + } + e0 = e1, e1 = this._edgecode(sx1, sy1); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx1, sy1); + else P = [sx1, sy1]; } - initializeNodes(); - return simulation = { - tick: tick, - restart: function() { - return stepper.restart(step), simulation; - }, - stop: function() { - return stepper.stop(), simulation; - }, - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes; - }, - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - randomSource: function(_) { - return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random; - }, - force: function(name, _) { - return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name); - }, - find: function(x, y, radius) { - var i = 0, n = nodes.length, dx, dy, d2, node, closest; - if (radius == null) radius = Infinity; - else radius *= radius; - for(i = 0; i < n; ++i){ - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - return closest; - }, - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; - }); -var _d3Dispatch = require("d3-dispatch"); -var _d3Timer = require("d3-timer"); -var _lcgJs = require("./lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function x(d) { - return d.x; -} -function y(d) { - return d.y; -} -var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); - -},{"d3-dispatch":"i7nsc","d3-timer":"d15bJ","./lcg.js":"3KZNV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i7nsc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dispatch", ()=>(0, _dispatchJsDefault.default)); -var _dispatchJs = require("./dispatch.js"); -var _dispatchJsDefault = parcelHelpers.interopDefault(_dispatchJs); - -},{"./dispatch.js":"6iBKi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iBKi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var noop = { - value: ()=>{} -}; -function dispatch() { - for(var i = 0, n = arguments.length, _ = {}, t; i < n; ++i){ - if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); - _[t] = []; + } + if (P) { + e0 = e1, e1 = this._edgecode(P[0], P[1]); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + return P; + } + _clipSegment(x02, y02, x12, y12, c0, c1) { + const flip2 = c0 < c1; + if (flip2) [x02, y02, x12, y12, c0, c1] = [x12, y12, x02, y02, c1, c0]; + while (true) { + if (c0 === 0 && c1 === 0) return flip2 ? [x12, y12, x02, y02] : [x02, y02, x12, y12]; + if (c0 & c1) return null; + let x2, y2, c2 = c0 || c1; + if (c2 & 8) x2 = x02 + (x12 - x02) * (this.ymax - y02) / (y12 - y02), y2 = this.ymax; + else if (c2 & 4) x2 = x02 + (x12 - x02) * (this.ymin - y02) / (y12 - y02), y2 = this.ymin; + else if (c2 & 2) y2 = y02 + (y12 - y02) * (this.xmax - x02) / (x12 - x02), x2 = this.xmax; + else y2 = y02 + (y12 - y02) * (this.xmin - x02) / (x12 - x02), x2 = this.xmin; + if (c0) x02 = x2, y02 = y2, c0 = this._regioncode(x02, y02); + else x12 = x2, y12 = y2, c1 = this._regioncode(x12, y12); + } } - return new Dispatch(_); -} -function Dispatch(_) { - this._ = _; -} -function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return { - type: t, - name: name - }; - }); -} -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; - // If no callback was specified, return the callback of the given type and name. - if (arguments.length < 2) { - while(++i < n)if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; - return; + _clipInfinite(i, points2, vx0, vy0, vxn, vyn) { + let P = Array.from(points2), p; + if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); + if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); + if (P = this._clipFinite(i, P)) { + for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { + c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); + if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; + } + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; + } + return P; + } + _edge(i, e0, e1, P, j) { + while (e0 !== e1) { + let x2, y2; + switch (e0) { + case 5: + e0 = 4; + continue; + // top-left + case 4: + e0 = 6, x2 = this.xmax, y2 = this.ymin; + break; + // top + case 6: + e0 = 2; + continue; + // top-right + case 2: + e0 = 10, x2 = this.xmax, y2 = this.ymax; + break; + // right + case 10: + e0 = 8; + continue; + // bottom-right + case 8: + e0 = 9, x2 = this.xmin, y2 = this.ymax; + break; + // bottom + case 9: + e0 = 1; + continue; + // bottom-left + case 1: + e0 = 5, x2 = this.xmin, y2 = this.ymin; + break; } - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while(++i < n){ - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for(t in _)_[t] = set(_[t], typename.name, null); + if ((P[j] !== x2 || P[j + 1] !== y2) && this.contains(i, x2, y2)) { + P.splice(j, 0, x2, y2), j += 2; } - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for(var t in _)copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for(var args = new Array(n), i = 0, n, t; i < n; ++i)args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(var t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - } -}; -function get(type, name) { - for(var i = 0, n = type.length, c; i < n; ++i){ - if ((c = type[i]).name === name) return c.value; - } -} -function set(type, name, callback) { - for(var i = 0, n = type.length; i < n; ++i)if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; + } + return j; + } + _project(x02, y02, vx, vy) { + let t = Infinity, c2, x2, y2; + if (vy < 0) { + if (y02 <= this.ymin) return null; + if ((c2 = (this.ymin - y02) / vy) < t) y2 = this.ymin, x2 = x02 + (t = c2) * vx; + } else if (vy > 0) { + if (y02 >= this.ymax) return null; + if ((c2 = (this.ymax - y02) / vy) < t) y2 = this.ymax, x2 = x02 + (t = c2) * vx; + } + if (vx > 0) { + if (x02 >= this.xmax) return null; + if ((c2 = (this.xmax - x02) / vx) < t) x2 = this.xmax, y2 = y02 + (t = c2) * vy; + } else if (vx < 0) { + if (x02 <= this.xmin) return null; + if ((c2 = (this.xmin - x02) / vx) < t) x2 = this.xmin, y2 = y02 + (t = c2) * vy; + } + return [x2, y2]; } - if (callback != null) type.push({ - name: name, - value: callback - }); - return type; -} -exports.default = dispatch; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d15bJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>(0, _timerJs.now)); -parcelHelpers.export(exports, "timer", ()=>(0, _timerJs.timer)); -parcelHelpers.export(exports, "timerFlush", ()=>(0, _timerJs.timerFlush)); -parcelHelpers.export(exports, "timeout", ()=>(0, _timeoutJsDefault.default)); -parcelHelpers.export(exports, "interval", ()=>(0, _intervalJsDefault.default)); -var _timerJs = require("./timer.js"); -var _timeoutJs = require("./timeout.js"); -var _timeoutJsDefault = parcelHelpers.interopDefault(_timeoutJs); -var _intervalJs = require("./interval.js"); -var _intervalJsDefault = parcelHelpers.interopDefault(_intervalJs); - -},{"./timer.js":"1Lfpo","./timeout.js":false,"./interval.js":"dgSlx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Lfpo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>now); -parcelHelpers.export(exports, "Timer", ()=>Timer); -parcelHelpers.export(exports, "timer", ()=>timer); -parcelHelpers.export(exports, "timerFlush", ()=>timerFlush); -var frame = 0, timeout = 0, interval = 0, pokeDelay = 1000, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { - setTimeout(f, 17); -}; -function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} -function clearNow() { - clockNow = 0; -} -function Timer() { - this._call = this._time = this._next = null; -} -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } + _edgecode(x2, y2) { + return (x2 === this.xmin ? 1 : x2 === this.xmax ? 2 : 0) | (y2 === this.ymin ? 4 : y2 === this.ymax ? 8 : 0); } -}; -function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; -} -function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while(t){ - if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e); - t = t._next; + _regioncode(x2, y2) { + return (x2 < this.xmin ? 1 : x2 > this.xmax ? 2 : 0) | (y2 < this.ymin ? 4 : y2 > this.ymax ? 8 : 0); } - --frame; -} -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally{ - frame = 0; - nap(); - clockNow = 0; - } -} -function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; -} -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while(t1)if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - taskTail = t0; - sleep(time); -} -function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dgSlx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, delay, time) { - var t = new (0, _timerJs.Timer), total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - t._restart = t.restart; - t.restart = function(callback, delay, time) { - delay = +delay, time = time == null ? (0, _timerJs.now)() : +time; - t._restart(function tick(elapsed) { - elapsed += total; - t._restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - }; - t.restart(callback, delay, time); - return t; - }); -var _timerJs = require("./timer.js"); - -},{"./timer.js":"1Lfpo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3KZNV":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"byekK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, xz; - if (typeof x !== "function") x = (0, _constantJsDefault.default)(x == null ? 0 : +x); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : x; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"gq4mo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eIzZp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(y) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, yz; - if (typeof y !== "function") y = (0, _constantJsDefault.default)(y == null ? 0 : +y); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : y; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"gq4mo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lserr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "nest", ()=>Nest); -parcelHelpers.export(exports, "pack", ()=>Pack); -parcelHelpers.export(exports, "partition", ()=>Partition); -parcelHelpers.export(exports, "stratify", ()=>Stratify); -parcelHelpers.export(exports, "tree", ()=>Tree); -parcelHelpers.export(exports, "treelinks", ()=>TreeLinks); -parcelHelpers.export(exports, "treemap", ()=>Treemap); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Hierarchy = require("d3-hierarchy"); -// Build lookup table mapping tuple keys to tree node instances -function lookup(tree, key, filter) { - const map = {}; - tree.each((node)=>{ - const t = node.data; - if (filter(t)) map[key(t)] = node; - }); - tree.lookup = map; - return tree; -} -/** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ function Nest(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Nest.Definition = { - 'type': 'Nest', - 'metadata': { - 'treesource': true, - 'changes': true - }, - 'params': [ - { - 'name': 'keys', - 'type': 'field', - 'array': true - }, - { - 'name': 'generate', - 'type': 'boolean' - } - ] -}; -const children = (n)=>n.values; -(0, _vegaUtil.inherits)(Nest, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Nest transform requires an upstream data source.'); - var gen = _.generate, mod = _.modified(), out = pulse.clone(), tree = this.value; - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) tree.each((node)=>{ - if (node.children && (0, _vegaDataflow.isTuple)(node.data)) out.rem.push(node.data); - }); - // generate new tree structure - this.value = tree = (0, _d3Hierarchy.hierarchy)({ - values: (0, _vegaUtil.array)(_.keys).reduce((n, k)=>{ - n.key(k); - return n; - }, nest()).entries(out.source) - }, children); - // collect nodes to add - if (gen) tree.each((node)=>{ - if (node.children) { - node = (0, _vegaDataflow.ingest)(node.data); - out.add.push(node); - out.source.push(node); - } - }); - // build lookup table - lookup(tree, (0, _vegaDataflow.tupleid), (0, _vegaDataflow.tupleid)); - } - out.source.root = tree; - return out; + _simplify(P) { + if (P && P.length > 4) { + for (let i = 0; i < P.length; i += 2) { + const j = (i + 2) % P.length, k = (i + 4) % P.length; + if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) { + P.splice(j, 2), i -= 2; + } + } + if (!P.length) P = null; + } + return P; } -}); -function nest() { - const keys = [], nest = { - entries: (array)=>entries(apply(array, 0), 0), - key: (d)=>(keys.push(d), nest) - }; - function apply(array, depth) { - if (depth >= keys.length) return array; - const n = array.length, key = keys[depth++], valuesByKey = {}, result = {}; - let i = -1, keyValue, value, values; - while(++i < n){ - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) values.push(value); - else valuesByKey[keyValue] = [ - value - ]; - } - for(keyValue in valuesByKey)result[keyValue] = apply(valuesByKey[keyValue], depth); - return result; + }; + const tau = 2 * Math.PI, pow = Math.pow; + function pointX(p) { + return p[0]; + } + function pointY(p) { + return p[1]; + } + function collinear(d) { + const { triangles, coords } = d; + for (let i = 0; i < triangles.length; i += 3) { + const a2 = 2 * triangles[i], b2 = 2 * triangles[i + 1], c2 = 2 * triangles[i + 2], cross2 = (coords[c2] - coords[a2]) * (coords[b2 + 1] - coords[a2 + 1]) - (coords[b2] - coords[a2]) * (coords[c2 + 1] - coords[a2 + 1]); + if (cross2 > 1e-10) return false; } - function entries(map, depth) { - if (++depth > keys.length) return map; - const array = []; - for(const key in map)array.push({ - key, - values: entries(map[key], depth) - }); - return array; - } - return nest; -} -/** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function HierarchyLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const defaultSeparation = (a, b)=>a.parent === b.parent ? 1 : 2; -(0, _vegaUtil.inherits)(HierarchyLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source || !pulse.source.root) (0, _vegaUtil.error)(this.constructor.name + ' transform requires a backing tree data source.'); - const layout = this.layout(_.method), fields = this.fields, root = pulse.source.root, as = _.as || fields; - if (_.field) root.sum(_.field); - else root.count(); - if (_.sort) root.sort((0, _vegaDataflow.stableCompare)(_.sort, (d)=>d.data)); - setParams(layout, this.params, _); - if (layout.separation) layout.separation(_.separation !== false ? defaultSeparation : (0, _vegaUtil.one)); - try { - this.value = layout(root); - } catch (err) { - (0, _vegaUtil.error)(err); - } - root.each((node)=>setFields(node, fields, as)); - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); + return true; + } + function jitter(x2, y2, r) { + return [x2 + Math.sin(x2 + y2) * r, y2 + Math.cos(x2 - y2) * r]; + } + class Delaunay { + static from(points2, fx = pointX, fy = pointY, that) { + return new Delaunay("length" in points2 ? flatArray(points2, fx, fy, that) : Float64Array.from(flatIterable(points2, fx, fy, that))); } -}); -function setParams(layout, params, _) { - for(let p, i = 0, n = params.length; i < n; ++i){ - p = params[i]; - if (p in _) layout[p](_[p]); + constructor(points2) { + this._delaunator = new Delaunator(points2); + this.inedges = new Int32Array(points2.length / 2); + this._hullIndex = new Int32Array(points2.length / 2); + this.points = this._delaunator.coords; + this._init(); } -} -function setFields(node, fields, as) { - const t = node.data, n = fields.length - 1; - for(let i = 0; i < n; ++i)t[as[i]] = node[fields[i]]; - t[as[n]] = node.children ? node.children.length : 0; -} -const Output$3 = [ - 'x', - 'y', - 'r', - 'depth', - 'children' -]; -/** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Pack(params) { - HierarchyLayout.call(this, params); -} -Pack.Definition = { - 'type': 'Pack', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'radius', - 'type': 'field', - 'default': null - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$3.length, - 'default': Output$3 - } - ] -}; -(0, _vegaUtil.inherits)(Pack, HierarchyLayout, { - layout: (0, _d3Hierarchy.pack), - params: [ - 'radius', - 'size', - 'padding' - ], - fields: Output$3 -}); -const Output$2 = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Partition(params) { - HierarchyLayout.call(this, params); -} -Partition.Definition = { - 'type': 'Partition', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$2.length, - 'default': Output$2 - } - ] -}; -(0, _vegaUtil.inherits)(Partition, HierarchyLayout, { - layout: (0, _d3Hierarchy.partition), - params: [ - 'size', - 'round', - 'padding' - ], - fields: Output$2 -}); -/** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ function Stratify(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stratify.Definition = { - 'type': 'Stratify', - 'metadata': { - 'treesource': true - }, - 'params': [ - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'parentKey', - 'type': 'field', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Stratify, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Stratify transform requires an upstream data source.'); - let tree = this.value; - const mod = _.modified(), out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), run = !tree || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); - // prevent upstream source pollution - out.source = out.source.slice(); - if (run) tree = out.source.length ? lookup((0, _d3Hierarchy.stratify)().id(_.key).parentId(_.parentKey)(out.source), _.key, (0, _vegaUtil.truthy)) : lookup((0, _d3Hierarchy.stratify)()([ - {} - ]), _.key, _.key); - out.source.root = this.value = tree; - return out; + update() { + this._delaunator.update(); + this._init(); + return this; } -}); -const Layouts = { - tidy: (0, _d3Hierarchy.tree), - cluster: (0, _d3Hierarchy.cluster) -}; -const Output$1 = [ - 'x', - 'y', - 'depth', - 'children' -]; -/** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Tree(params) { - HierarchyLayout.call(this, params); -} -Tree.Definition = { - 'type': 'Tree', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'tidy', - 'values': [ - 'tidy', - 'cluster' - ] - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'nodeSize', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'separation', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$1.length, - 'default': Output$1 - } - ] -}; -(0, _vegaUtil.inherits)(Tree, HierarchyLayout, { - /** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ layout (method) { - const m = method || 'tidy'; - if ((0, _vegaUtil.hasOwnProperty)(Layouts, m)) return Layouts[m](); - else (0, _vegaUtil.error)('Unrecognized Tree layout method: ' + m); - }, - params: [ - 'size', - 'nodeSize' - ], - fields: Output$1 -}); -/** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ function TreeLinks(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': { - 'tree': true, - 'generates': true, - 'changes': true - }, - 'params': [] -}; -(0, _vegaUtil.inherits)(TreeLinks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const links = this.value, tree = pulse.source && pulse.source.root, out = pulse.fork(pulse.NO_SOURCE), lut = {}; - if (!tree) (0, _vegaUtil.error)('TreeLinks transform requires a tree data source.'); - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; - // build lookup table of valid tuples - pulse.visit(pulse.SOURCE, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // generate links for all edges incident on valid tuples - tree.each((node)=>{ - const t = node.data, p = node.parent && node.parent.data; - if (p && lut[(0, _vegaDataflow.tupleid)(t)] && lut[(0, _vegaDataflow.tupleid)(p)]) out.add.push((0, _vegaDataflow.ingest)({ - source: p, - target: t - })); - }); - this.value = out.add; - } else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // gather links incident on modified tuples - links.forEach((link)=>{ - if (lut[(0, _vegaDataflow.tupleid)(link.source)] || lut[(0, _vegaDataflow.tupleid)(link.target)]) out.mod.push(link); - }); + _init() { + const d = this._delaunator, points2 = this.points; + if (d.hull && d.hull.length > 2 && collinear(d)) { + this.collinear = Int32Array.from({ length: points2.length / 2 }, (_, i) => i).sort((i, j) => points2[2 * i] - points2[2 * j] || points2[2 * i + 1] - points2[2 * j + 1]); + const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds2 = [points2[2 * e], points2[2 * e + 1], points2[2 * f], points2[2 * f + 1]], r = 1e-8 * Math.hypot(bounds2[3] - bounds2[1], bounds2[2] - bounds2[0]); + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const p = jitter(points2[2 * i], points2[2 * i + 1], r); + points2[2 * i] = p[0]; + points2[2 * i + 1] = p[1]; + } + this._delaunator = new Delaunator(points2); + } else { + delete this.collinear; + } + const halfedges = this.halfedges = this._delaunator.halfedges; + const hull = this.hull = this._delaunator.hull; + const triangles = this.triangles = this._delaunator.triangles; + const inedges = this.inedges.fill(-1); + const hullIndex = this._hullIndex.fill(-1); + for (let e = 0, n = halfedges.length; e < n; ++e) { + const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; + if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; + } + for (let i = 0, n = hull.length; i < n; ++i) { + hullIndex[hull[i]] = i; + } + if (hull.length <= 2 && hull.length > 0) { + this.triangles = new Int32Array(3).fill(-1); + this.halfedges = new Int32Array(3).fill(-1); + this.triangles[0] = hull[0]; + inedges[hull[0]] = 1; + if (hull.length === 2) { + inedges[hull[1]] = 0; + this.triangles[1] = hull[1]; + this.triangles[2] = hull[1]; } - return out; + } } -}); -const Tiles = { - binary: (0, _d3Hierarchy.treemapBinary), - dice: (0, _d3Hierarchy.treemapDice), - slice: (0, _d3Hierarchy.treemapSlice), - slicedice: (0, _d3Hierarchy.treemapSliceDice), - squarify: (0, _d3Hierarchy.treemapSquarify), - resquarify: (0, _d3Hierarchy.treemapResquarify) -}; -const Output = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Treemap(params) { - HierarchyLayout.call(this, params); -} -Treemap.Definition = { - 'type': 'Treemap', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'squarify', - 'values': [ - 'squarify', - 'resquarify', - 'binary', - 'dice', - 'slice', - 'slicedice' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingInner', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingOuter', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingTop', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingRight', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingBottom', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingLeft', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'ratio', - 'type': 'number', - 'default': 1.618033988749895 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output.length, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Treemap, HierarchyLayout, { - /** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ layout () { - const x = (0, _d3Hierarchy.treemap)(); - x.ratio = (_)=>{ - const t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - x.method = (_)=>{ - if ((0, _vegaUtil.hasOwnProperty)(Tiles, _)) x.tile(Tiles[_]); - else (0, _vegaUtil.error)('Unrecognized Treemap layout method: ' + _); - }; - return x; - }, - params: [ - 'method', - 'ratio', - 'size', - 'round', - 'padding', - 'paddingInner', - 'paddingOuter', - 'paddingTop', - 'paddingRight', - 'paddingBottom', - 'paddingLeft' - ], - fields: Output -}); - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-hierarchy":"4fr5p","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4fr5p":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cluster", ()=>(0, _clusterJsDefault.default)); -parcelHelpers.export(exports, "hierarchy", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "Node", ()=>(0, _indexJs.Node)); -parcelHelpers.export(exports, "pack", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "packSiblings", ()=>(0, _siblingsJsDefault.default)); -parcelHelpers.export(exports, "packEnclose", ()=>(0, _encloseJsDefault.default)); -parcelHelpers.export(exports, "partition", ()=>(0, _partitionJsDefault.default)); -parcelHelpers.export(exports, "stratify", ()=>(0, _stratifyJsDefault.default)); -parcelHelpers.export(exports, "tree", ()=>(0, _treeJsDefault.default)); -parcelHelpers.export(exports, "treemap", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "treemapBinary", ()=>(0, _binaryJsDefault.default)); -parcelHelpers.export(exports, "treemapDice", ()=>(0, _diceJsDefault.default)); -parcelHelpers.export(exports, "treemapSlice", ()=>(0, _sliceJsDefault.default)); -parcelHelpers.export(exports, "treemapSliceDice", ()=>(0, _sliceDiceJsDefault.default)); -parcelHelpers.export(exports, "treemapSquarify", ()=>(0, _squarifyJsDefault.default)); -parcelHelpers.export(exports, "treemapResquarify", ()=>(0, _resquarifyJsDefault.default)); -var _clusterJs = require("./cluster.js"); -var _clusterJsDefault = parcelHelpers.interopDefault(_clusterJs); -var _indexJs = require("./hierarchy/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _indexJs1 = require("./pack/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _siblingsJs = require("./pack/siblings.js"); -var _siblingsJsDefault = parcelHelpers.interopDefault(_siblingsJs); -var _encloseJs = require("./pack/enclose.js"); -var _encloseJsDefault = parcelHelpers.interopDefault(_encloseJs); -var _partitionJs = require("./partition.js"); -var _partitionJsDefault = parcelHelpers.interopDefault(_partitionJs); -var _stratifyJs = require("./stratify.js"); -var _stratifyJsDefault = parcelHelpers.interopDefault(_stratifyJs); -var _treeJs = require("./tree.js"); -var _treeJsDefault = parcelHelpers.interopDefault(_treeJs); -var _indexJs2 = require("./treemap/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _binaryJs = require("./treemap/binary.js"); -var _binaryJsDefault = parcelHelpers.interopDefault(_binaryJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./treemap/slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _sliceDiceJs = require("./treemap/sliceDice.js"); -var _sliceDiceJsDefault = parcelHelpers.interopDefault(_sliceDiceJs); -var _squarifyJs = require("./treemap/squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _resquarifyJs = require("./treemap/resquarify.js"); -var _resquarifyJsDefault = parcelHelpers.interopDefault(_resquarifyJs); - -},{"./cluster.js":"fviPU","./hierarchy/index.js":"jtgBj","./pack/index.js":"eQFOB","./pack/siblings.js":false,"./pack/enclose.js":false,"./partition.js":"hfHoW","./stratify.js":"1euRH","./tree.js":"5MDZW","./treemap/index.js":"ew6JB","./treemap/binary.js":"8vqlk","./treemap/dice.js":"c7pGx","./treemap/slice.js":"c9bya","./treemap/sliceDice.js":"fbNXv","./treemap/squarify.js":"dnoy6","./treemap/resquarify.js":"12ScZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fviPU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false; - function cluster(root) { - var previousNode, x = 0; - // First walk, computing the initial x & y values. - root.eachAfter(function(node) { - var children = node.children; - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - var left = leafLeft(root), right = leafRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; - // Second walk, normalizing x & y to the desired size. - return root.eachAfter(nodeSize ? function(node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); - } - cluster.separation = function(x) { - return arguments.length ? (separation = x, cluster) : separation; - }; - cluster.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : nodeSize ? null : [ - dx, - dy - ]; - }; - cluster.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : nodeSize ? [ - dx, - dy - ] : null; - }; - return cluster; - }); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -function meanX(children) { - return children.reduce(meanXReduce, 0) / children.length; -} -function meanXReduce(x, c) { - return x + c.x; -} -function maxY(children) { - return 1 + children.reduce(maxYReduce, 0); -} -function maxYReduce(y, c) { - return Math.max(y, c.y); -} -function leafLeft(node) { - var children; - while(children = node.children)node = children[0]; - return node; -} -function leafRight(node) { - var children; - while(children = node.children)node = children[children.length - 1]; - return node; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jtgBj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>hierarchy); -parcelHelpers.export(exports, "computeHeight", ()=>computeHeight); -parcelHelpers.export(exports, "Node", ()=>Node); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _eachJs = require("./each.js"); -var _eachJsDefault = parcelHelpers.interopDefault(_eachJs); -var _eachBeforeJs = require("./eachBefore.js"); -var _eachBeforeJsDefault = parcelHelpers.interopDefault(_eachBeforeJs); -var _eachAfterJs = require("./eachAfter.js"); -var _eachAfterJsDefault = parcelHelpers.interopDefault(_eachAfterJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _ancestorsJs = require("./ancestors.js"); -var _ancestorsJsDefault = parcelHelpers.interopDefault(_ancestorsJs); -var _descendantsJs = require("./descendants.js"); -var _descendantsJsDefault = parcelHelpers.interopDefault(_descendantsJs); -var _leavesJs = require("./leaves.js"); -var _leavesJsDefault = parcelHelpers.interopDefault(_leavesJs); -var _linksJs = require("./links.js"); -var _linksJsDefault = parcelHelpers.interopDefault(_linksJs); -var _iteratorJs = require("./iterator.js"); -var _iteratorJsDefault = parcelHelpers.interopDefault(_iteratorJs); -function hierarchy(data, children) { - if (data instanceof Map) { - data = [ - undefined, - data - ]; - if (children === undefined) children = mapChildren; - } else if (children === undefined) children = objectChildren; - var root = new Node(data), node, nodes = [ - root - ], child, childs, i, n; - while(node = nodes.pop())if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) { - node.children = childs; - for(i = n - 1; i >= 0; --i){ - nodes.push(child = childs[i] = new Node(childs[i])); - child.parent = node; - child.depth = node.depth + 1; - } + voronoi(bounds2) { + return new Voronoi$1(this, bounds2); } - return root.eachBefore(computeHeight); -} -function node_copy() { - return hierarchy(this).eachBefore(copyData); -} -function objectChildren(d) { - return d.children; -} -function mapChildren(d) { - return Array.isArray(d) ? d[1] : null; -} -function copyData(node) { - if (node.data.value !== undefined) node.value = node.data.value; - node.data = node.data.data; -} -function computeHeight(node) { - var height = 0; - do node.height = height; - while ((node = node.parent) && node.height < ++height); -} -function Node(data) { - this.data = data; - this.depth = this.height = 0; - this.parent = null; -} -Node.prototype = hierarchy.prototype = { - constructor: Node, - count: (0, _countJsDefault.default), - each: (0, _eachJsDefault.default), - eachAfter: (0, _eachAfterJsDefault.default), - eachBefore: (0, _eachBeforeJsDefault.default), - find: (0, _findJsDefault.default), - sum: (0, _sumJsDefault.default), - sort: (0, _sortJsDefault.default), - path: (0, _pathJsDefault.default), - ancestors: (0, _ancestorsJsDefault.default), - descendants: (0, _descendantsJsDefault.default), - leaves: (0, _leavesJsDefault.default), - links: (0, _linksJsDefault.default), - copy: node_copy, - [Symbol.iterator]: (0, _iteratorJsDefault.default) -}; - -},{"./count.js":"jNzMu","./each.js":"8q3O0","./eachBefore.js":"kBI99","./eachAfter.js":"goYvF","./find.js":"dotdr","./sum.js":"6wYAA","./sort.js":"ljhs0","./path.js":"ecIKT","./ancestors.js":"9BIjB","./descendants.js":"6MhHV","./leaves.js":"jpVT1","./links.js":"eJseT","./iterator.js":"aGwDK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jNzMu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this.eachAfter(count); - }); -function count(node) { - var sum = 0, children = node.children, i = children && children.length; - if (!i) sum = 1; - else while(--i >= 0)sum += children[i].value; - node.value = sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8q3O0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this)callback.call(that, node, ++index, this); - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBI99":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], children, i, index = -1; - while(node = nodes.pop()){ - callback.call(that, node, ++index, this); - if (children = node.children) for(i = children.length - 1; i >= 0; --i)nodes.push(children[i]); + *neighbors(i) { + const { inedges, hull, _hullIndex, halfedges, triangles, collinear: collinear2 } = this; + if (collinear2) { + const l = collinear2.indexOf(i); + if (l > 0) yield collinear2[l - 1]; + if (l < collinear2.length - 1) yield collinear2[l + 1]; + return; + } + const e0 = inedges[i]; + if (e0 === -1) return; + let e = e0, p02 = -1; + do { + yield p02 = triangles[e]; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) return; + e = halfedges[e]; + if (e === -1) { + const p = hull[(_hullIndex[i] + 1) % hull.length]; + if (p !== p02) yield p; + return; + } + } while (e !== e0); + } + find(x2, y2, i = 0) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return -1; + const i0 = i; + let c2; + while ((c2 = this._step(i, x2, y2)) >= 0 && c2 !== i && c2 !== i0) i = c2; + return c2; + } + _step(i, x2, y2) { + const { inedges, hull, _hullIndex, halfedges, triangles, points: points2 } = this; + if (inedges[i] === -1 || !points2.length) return (i + 1) % (points2.length >> 1); + let c2 = i; + let dc = pow(x2 - points2[i * 2], 2) + pow(y2 - points2[i * 2 + 1], 2); + const e0 = inedges[i]; + let e = e0; + do { + let t = triangles[e]; + const dt = pow(x2 - points2[t * 2], 2) + pow(y2 - points2[t * 2 + 1], 2); + if (dt < dc) dc = dt, c2 = t; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + if (e === -1) { + e = hull[(_hullIndex[i] + 1) % hull.length]; + if (e !== t) { + if (pow(x2 - points2[e * 2], 2) + pow(y2 - points2[e * 2 + 1], 2) < dc) return e; + } + break; + } + } while (e !== e0); + return c2; + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, halfedges, triangles } = this; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = triangles[i] * 2; + const tj = triangles[j] * 2; + context2.moveTo(points2[ti], points2[ti + 1]); + context2.lineTo(points2[tj], points2[tj + 1]); + } + this.renderHull(context2); + return buffer && buffer.value(); + } + renderPoints(context2, r) { + if (r === void 0 && (!context2 || typeof context2.moveTo !== "function")) r = context2, context2 = null; + r = r == void 0 ? 2 : +r; + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2 } = this; + for (let i = 0, n = points2.length; i < n; i += 2) { + const x2 = points2[i], y2 = points2[i + 1]; + context2.moveTo(x2 + r, y2); + context2.arc(x2, y2, r, 0, tau); + } + return buffer && buffer.value(); + } + renderHull(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { hull, points: points2 } = this; + const h2 = hull[0] * 2, n = hull.length; + context2.moveTo(points2[h2], points2[h2 + 1]); + for (let i = 1; i < n; ++i) { + const h3 = 2 * hull[i]; + context2.lineTo(points2[h3], points2[h3 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + hullPolygon() { + const polygon = new Polygon(); + this.renderHull(polygon); + return polygon.value(); + } + renderTriangle(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, triangles } = this; + const t02 = triangles[i *= 3] * 2; + const t12 = triangles[i + 1] * 2; + const t22 = triangles[i + 2] * 2; + context2.moveTo(points2[t02], points2[t02 + 1]); + context2.lineTo(points2[t12], points2[t12 + 1]); + context2.lineTo(points2[t22], points2[t22 + 1]); + context2.closePath(); + return buffer && buffer.value(); + } + *trianglePolygons() { + const { triangles } = this; + for (let i = 0, n = triangles.length / 3; i < n; ++i) { + yield this.trianglePolygon(i); + } + } + trianglePolygon(i) { + const polygon = new Polygon(); + this.renderTriangle(i, polygon); + return polygon.value(); + } + } + function flatArray(points2, fx, fy, that) { + const n = points2.length; + const array2 = new Float64Array(n * 2); + for (let i = 0; i < n; ++i) { + const p = points2[i]; + array2[i * 2] = fx.call(that, p, i, points2); + array2[i * 2 + 1] = fy.call(that, p, i, points2); + } + return array2; + } + function* flatIterable(points2, fx, fy, that) { + let i = 0; + for (const p of points2) { + yield fx.call(that, p, i, points2); + yield fy.call(that, p, i, points2); + ++i; + } + } + function Voronoi(params2) { + Transform.call(this, null, params2); + } + Voronoi.Definition = { + "type": "Voronoi", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "default": [[-1e5, -1e5], [1e5, 1e5]], + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; + inherits(Voronoi, Transform, { + transform(_, pulse2) { + const as = _.as || "path", data2 = pulse2.source; + if (!data2 || !data2.length) return pulse2; + let s = _.size; + s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent; + const voronoi2 = this.value = Delaunay.from(data2, _.x, _.y).voronoi(s); + for (let i = 0, n = data2.length; i < n; ++i) { + const polygon = voronoi2.cellPolygon(i); + data2[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; + } + return pulse2.reflow(_.modified()).modifies(as); + } + }); + function toPathString(p) { + const x2 = p[0][0], y2 = p[0][1]; + let n = p.length - 1; + for (; p[n][0] === x2 && p[n][1] === y2; --n) ; + return "M" + p.slice(0, n + 1).join("L") + "Z"; + } + function isPoint(p) { + return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; + } + const voronoi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + voronoi: Voronoi + }, Symbol.toStringTag, { value: "Module" })); + var cloudRadians = Math.PI / 180, cw = 1 << 11 >> 5, ch = 1 << 11; + function cloud() { + var size2 = [256, 256], text2, font2, fontSize2, fontStyle, fontWeight, rotate2, padding2, spiral = archimedeanSpiral, words = [], random2 = Math.random, cloud2 = {}; + cloud2.layout = function() { + var contextAndRatio = getContext2(domCanvas()), board = zeroArray((size2[0] >> 5) * size2[1]), bounds2 = null, n = words.length, i = -1, tags = [], data2 = words.map((d2) => ({ + text: text2(d2), + font: font2(d2), + style: fontStyle(d2), + weight: fontWeight(d2), + rotate: rotate2(d2), + size: ~~(fontSize2(d2) + 1e-14), + padding: padding2(d2), + xoff: 0, + yoff: 0, + x1: 0, + y1: 0, + x0: 0, + y0: 0, + hasText: false, + sprite: null, + datum: d2 + })).sort((a2, b2) => b2.size - a2.size); + while (++i < n) { + var d = data2[i]; + d.x = size2[0] * (random2() + 0.5) >> 1; + d.y = size2[1] * (random2() + 0.5) >> 1; + cloudSprite(contextAndRatio, d, data2, i); + if (d.hasText && place2(board, d, bounds2)) { + tags.push(d); + if (bounds2) cloudBounds(bounds2, d); + else bounds2 = [{ + x: d.x + d.x0, + y: d.y + d.y0 + }, { + x: d.x + d.x1, + y: d.y + d.y1 + }]; + d.x -= size2[0] >> 1; + d.y -= size2[1] >> 1; } - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"goYvF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], next = [], children, i, n, index = -1; - while(node = nodes.pop()){ - next.push(node); - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)nodes.push(children[i]); - } - while(node = next.pop())callback.call(that, node, ++index, this); - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dotdr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this){ - if (callback.call(that, node, ++index, this)) return node; + } + return tags; + }; + function getContext2(canvas) { + canvas.width = canvas.height = 1; + var ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2); + canvas.width = (cw << 5) / ratio; + canvas.height = ch / ratio; + var context2 = canvas.getContext("2d"); + context2.fillStyle = context2.strokeStyle = "red"; + context2.textAlign = "center"; + return { + context: context2, + ratio + }; + } + function place2(board, tag, bounds2) { + var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size2[0], size2[1]), s = spiral(size2), dt = random2() < 0.5 ? 1 : -1, t = -dt, dxdy, dx, dy; + while (dxdy = s(t += dt)) { + dx = ~~dxdy[0]; + dy = ~~dxdy[1]; + if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; + tag.x = startX + dx; + tag.y = startY + dy; + if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size2[0] || tag.y + tag.y1 > size2[1]) continue; + if (!bounds2 || !cloudCollide(tag, board, size2[0])) { + if (!bounds2 || collideRects(tag, bounds2)) { + var sprite = tag.sprite, w2 = tag.width >> 5, sw = size2[0] >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + board[x2 + i] |= last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0); + } + x2 += sw; + } + tag.sprite = null; + return true; + } } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6wYAA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, children = node.children, i = children && children.length; - while(--i >= 0)sum += children[i].value; - node.value = sum; - }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ljhs0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(compare) { - return this.eachBefore(function(node) { - if (node.children) node.children.sort(compare); - }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ecIKT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(end) { - var start = this, ancestor = leastCommonAncestor(start, end), nodes = [ - start - ]; - while(start !== ancestor){ - start = start.parent; - nodes.push(start); - } - var k = nodes.length; - while(end !== ancestor){ - nodes.splice(k, 0, end); - end = end.parent; - } - return nodes; - }); -function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null; - a = aNodes.pop(); - b = bNodes.pop(); - while(a === b){ - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - return c; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9BIjB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var node = this, nodes = [ - node - ]; - while(node = node.parent)nodes.push(node); - return nodes; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6MhHV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return Array.from(this); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jpVT1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) leaves.push(node); - }); - return leaves; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eJseT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) links.push({ - source: node.parent, - target: node - }); - }); - return links; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aGwDK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function*() { - var node = this, current, next = [ - node - ], children, i, n; - do { - current = next.reverse(), next = []; - while(node = current.pop()){ - yield node; - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)next.push(children[i]); - } - }while (next.length); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQFOB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var radius = null, dx = 1, dy = 1, padding = (0, _constantJs.constantZero); - function pack(root) { - const random = (0, _lcgJsDefault.default)(); - root.x = dx / 2, root.y = dy / 2; - if (radius) root.eachBefore(radiusLeaf(radius)).eachAfter(packChildrenRandom(padding, 0.5, random)).eachBefore(translateChild(1)); - else root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom((0, _constantJs.constantZero), 1, random)).eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); - return root; - } - pack.radius = function(x) { - return arguments.length ? (radius = (0, _accessorsJs.optional)(x), pack) : radius; - }; - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [ - dx, - dy - ]; - }; - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), pack) : padding; - }; - return pack; - }); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _siblingsJs = require("./siblings.js"); -function defaultRadius(d) { - return Math.sqrt(d.value); -} -function radiusLeaf(radius) { - return function(node) { - if (!node.children) node.r = Math.max(0, +radius(node) || 0); + } + return false; + } + cloud2.words = function(_) { + if (arguments.length) { + words = _; + return cloud2; + } else { + return words; + } + }; + cloud2.size = function(_) { + if (arguments.length) { + size2 = [+_[0], +_[1]]; + return cloud2; + } else { + return size2; + } + }; + cloud2.font = function(_) { + if (arguments.length) { + font2 = functor(_); + return cloud2; + } else { + return font2; + } + }; + cloud2.fontStyle = function(_) { + if (arguments.length) { + fontStyle = functor(_); + return cloud2; + } else { + return fontStyle; + } }; -} -function packChildrenRandom(padding, k, random) { - return function(node) { - if (children = node.children) { - var children, i, n = children.length, r = padding(node) * k || 0, e; - if (r) for(i = 0; i < n; ++i)children[i].r += r; - e = (0, _siblingsJs.packSiblingsRandom)(children, random); - if (r) for(i = 0; i < n; ++i)children[i].r -= r; - node.r = e + r; - } + cloud2.fontWeight = function(_) { + if (arguments.length) { + fontWeight = functor(_); + return cloud2; + } else { + return fontWeight; + } }; -} -function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; -} - -},{"../accessors.js":"i242w","../constant.js":"i6Ely","../lcg.js":"9jKig","./siblings.js":"8RhM7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i242w":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "optional", ()=>optional); -parcelHelpers.export(exports, "required", ()=>required); -function optional(f) { - return f == null ? null : required(f); -} -function required(f) { - if (typeof f !== "function") throw new Error; - return f; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i6Ely":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "constantZero", ()=>constantZero); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); -function constantZero() { - return 0; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9jKig":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8RhM7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "packSiblingsRandom", ()=>packSiblingsRandom); -parcelHelpers.export(exports, "default", ()=>function(circles) { - packSiblingsRandom(circles, (0, _lcgJsDefault.default)()); - return circles; - }); -var _arrayJs = require("../array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _encloseJs = require("./enclose.js"); -function place(b, a, c) { - var dx = b.x - a.x, x, a2, dy = b.y - a.y, y, b2, d2 = dx * dx + dy * dy; - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; - } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; + cloud2.rotate = function(_) { + if (arguments.length) { + rotate2 = functor(_); + return cloud2; + } else { + return rotate2; + } + }; + cloud2.text = function(_) { + if (arguments.length) { + text2 = functor(_); + return cloud2; + } else { + return text2; + } + }; + cloud2.spiral = function(_) { + if (arguments.length) { + spiral = spirals[_] || _; + return cloud2; + } else { + return spiral; + } + }; + cloud2.fontSize = function(_) { + if (arguments.length) { + fontSize2 = functor(_); + return cloud2; + } else { + return fontSize2; + } + }; + cloud2.padding = function(_) { + if (arguments.length) { + padding2 = functor(_); + return cloud2; + } else { + return padding2; + } + }; + cloud2.random = function(_) { + if (arguments.length) { + random2 = _; + return cloud2; + } else { + return random2; + } + }; + return cloud2; + } + function cloudSprite(contextAndRatio, d, data2, di) { + if (d.sprite) return; + var c2 = contextAndRatio.context, ratio = contextAndRatio.ratio; + c2.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); + var x2 = 0, y2 = 0, maxh = 0, n = data2.length, w2, w32, h2, i, j; + --di; + while (++di < n) { + d = data2[di]; + c2.save(); + c2.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font; + w2 = c2.measureText(d.text + "m").width * ratio; + h2 = d.size << 1; + if (d.rotate) { + var sr = Math.sin(d.rotate * cloudRadians), cr2 = Math.cos(d.rotate * cloudRadians), wcr = w2 * cr2, wsr = w2 * sr, hcr = h2 * cr2, hsr = h2 * sr; + w2 = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 31 >> 5 << 5; + h2 = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); + } else { + w2 = w2 + 31 >> 5 << 5; + } + if (h2 > maxh) maxh = h2; + if (x2 + w2 >= cw << 5) { + x2 = 0; + y2 += maxh; + maxh = 0; + } + if (y2 + h2 >= ch) break; + c2.translate((x2 + (w2 >> 1)) / ratio, (y2 + (h2 >> 1)) / ratio); + if (d.rotate) c2.rotate(d.rotate * cloudRadians); + c2.fillText(d.text, 0, 0); + if (d.padding) { + c2.lineWidth = 2 * d.padding; + c2.strokeText(d.text, 0, 0); + } + c2.restore(); + d.width = w2; + d.height = h2; + d.xoff = x2; + d.yoff = y2; + d.x1 = w2 >> 1; + d.y1 = h2 >> 1; + d.x0 = -d.x1; + d.y0 = -d.y1; + d.hasText = true; + x2 += w2; + } + var pixels = c2.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; + while (--di >= 0) { + d = data2[di]; + if (!d.hasText) continue; + w2 = d.width; + w32 = w2 >> 5; + h2 = d.y1 - d.y0; + for (i = 0; i < h2 * w32; i++) sprite[i] = 0; + x2 = d.xoff; + if (x2 == null) return; + y2 = d.yoff; + var seen = 0, seenRow = -1; + for (j = 0; j < h2; j++) { + for (i = 0; i < w2; i++) { + var k = w32 * j + (i >> 5), m2 = pixels[(y2 + j) * (cw << 5) + (x2 + i) << 2] ? 1 << 31 - i % 32 : 0; + sprite[k] |= m2; + seen |= m2; + } + if (seen) seenRow = j; + else { + d.y0++; + h2--; + j--; + y2++; } - } else { - c.x = a.x + c.r; - c.y = a.y; - } -} -function intersects(a, b) { - var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function score(node) { - var a = node._, b = node.next._, ab = a.r + b.r, dx = (a.x * b.r + b.x * a.r) / ab, dy = (a.y * b.r + b.y * a.r) / ab; - return dx * dx + dy * dy; -} -function Node(circle) { - this._ = circle; - this.next = null; - this.previous = null; -} -function packSiblingsRandom(circles, random) { - if (!(n = (circles = (0, _arrayJsDefault.default)(circles)).length)) return 0; - var a, b, c, n, aa, ca, i, j, k, sj, sk; - // Place the first circle. - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; - // Place the second circle. - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; - // Place the third circle. - place(b, a, c = circles[2]); - // Initialize the front-chain using the first three circles a, b and c. - a = new Node(a), b = new Node(b), c = new Node(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; - // Attempt to place each remaining circle… - pack: for(i = 3; i < n; ++i){ - place(a._, b._, c = circles[i]), c = new Node(c); - // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - do if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - while (j !== k.next); - // Success! Insert the new circle c between a and b. - c.previous = a, c.next = b, a.next = b.previous = b = c; - // Compute the new closest circle pair to the centroid. - aa = score(a); - while((c = c.next) !== b)if ((ca = score(c)) < aa) a = c, aa = ca; - b = a.next; - } - // Compute the enclosing circle of the front chain. - a = [ - b._ - ], c = b; - while((c = c.next) !== b)a.push(c._); - c = (0, _encloseJs.packEncloseRandom)(a, random); - // Translate the circles to put the enclosing circle around the origin. - for(i = 0; i < n; ++i)a = circles[i], a.x -= c.x, a.y -= c.y; - return c.r; -} - -},{"../array.js":"4vcaT","../lcg.js":"9jKig","./enclose.js":"gBh5f","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4vcaT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -parcelHelpers.export(exports, "shuffle", ()=>shuffle); -function shuffle(array, random) { - let m = array.length, t, i; - while(m){ - i = random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gBh5f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(circles) { - return packEncloseRandom(circles, (0, _lcgJsDefault.default)()); - }); -parcelHelpers.export(exports, "packEncloseRandom", ()=>packEncloseRandom); -var _arrayJs = require("../array.js"); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function packEncloseRandom(circles, random) { - var i = 0, n = (circles = (0, _arrayJs.shuffle)(Array.from(circles), random)).length, B = [], p, e; - while(i < n){ - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i; - else e = encloseBasis(B = extendBasis(B, p)), i = 0; + } + d.y1 = d.y0 + seenRow; + d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); } - return e; -} -function extendBasis(B, p) { - var i, j; - if (enclosesWeakAll(p, B)) return [ - p - ]; - // If we get here then B must have at least one element. - for(i = 0; i < B.length; ++i){ - if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) return [ - B[i], - p - ]; - } - // If we get here then B must have at least two elements. - for(i = 0; i < B.length - 1; ++i)for(j = i + 1; j < B.length; ++j){ - if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) return [ - B[i], - B[j], - p - ]; - } - // If we get here then something is very wrong. - throw new Error; -} -function enclosesNot(a, b) { - var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; -} -function enclosesWeak(a, b) { - var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function enclosesWeakAll(a, B) { - for(var i = 0; i < B.length; ++i){ - if (!enclosesWeak(a, B[i])) return false; + } + function cloudCollide(tag, board, sw) { + sw >>= 5; + var sprite = tag.sprite, w2 = tag.width >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + if ((last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0)) & board[x2 + i]) return true; + } + x2 += sw; } - return true; -} -function encloseBasis(B) { - switch(B.length){ + return false; + } + function cloudBounds(bounds2, d) { + var b0 = bounds2[0], b1 = bounds2[1]; + if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; + if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; + if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; + if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; + } + function collideRects(a2, b2) { + return a2.x + a2.x1 > b2[0].x && a2.x + a2.x0 < b2[1].x && a2.y + a2.y1 > b2[0].y && a2.y + a2.y0 < b2[1].y; + } + function archimedeanSpiral(size2) { + var e = size2[0] / size2[1]; + return function(t) { + return [e * (t *= 0.1) * Math.cos(t), t * Math.sin(t)]; + }; + } + function rectangularSpiral(size2) { + var dy = 4, dx = dy * size2[0] / size2[1], x2 = 0, y2 = 0; + return function(t) { + var sign2 = t < 0 ? -1 : 1; + switch (Math.sqrt(1 + 4 * sign2 * t) - sign2 & 3) { + case 0: + x2 += dx; + break; case 1: - return encloseBasis1(B[0]); + y2 += dy; + break; case 2: - return encloseBasis2(B[0], B[1]); - case 3: - return encloseBasis3(B[0], B[1], B[2]); + x2 -= dx; + break; + default: + y2 -= dy; + break; + } + return [x2, y2]; + }; + } + function zeroArray(n) { + var a2 = [], i = -1; + while (++i < n) a2[i] = 0; + return a2; + } + function functor(d) { + return typeof d === "function" ? d : function() { + return d; + }; + } + var spirals = { + archimedean: archimedeanSpiral, + rectangular: rectangularSpiral + }; + const Output = ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"]; + const Params$1 = ["text", "font", "rotate", "fontSize", "fontStyle", "fontWeight"]; + function Wordcloud(params2) { + Transform.call(this, cloud(), params2); + } + Wordcloud.Definition = { + "type": "Wordcloud", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "font", + "type": "string", + "expr": true, + "default": "sans-serif" + }, { + "name": "fontStyle", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontWeight", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontSize", + "type": "number", + "expr": true, + "default": 14 + }, { + "name": "fontSizeRange", + "type": "number", + "array": "nullable", + "default": [10, 50] + }, { + "name": "rotate", + "type": "number", + "expr": true, + "default": 0 + }, { + "name": "text", + "type": "field" + }, { + "name": "spiral", + "type": "string", + "values": ["archimedean", "rectangular"] + }, { + "name": "padding", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 7, + "default": Output + }] + }; + inherits(Wordcloud, Transform, { + transform(_, pulse2) { + if (_.size && !(_.size[0] && _.size[1])) { + error("Wordcloud size dimensions must be non-zero."); + } + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || Params$1.some(modp))) return; + const data2 = pulse2.materialize(pulse2.SOURCE).source, layout = this.value, as = _.as || Output; + let fontSize2 = _.fontSize || 14, range2; + isFunction(fontSize2) ? range2 = _.fontSizeRange : fontSize2 = constant$5(fontSize2); + if (range2) { + const fsize = fontSize2, sizeScale = scale$6("sqrt")().domain(extent(data2, fsize)).range(range2); + fontSize2 = (x2) => sizeScale(fsize(x2)); + } + data2.forEach((t) => { + t[as[0]] = NaN; + t[as[1]] = NaN; + t[as[3]] = 0; + }); + const words = layout.words(data2).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || "archimedean").rotate(_.rotate || 0).font(_.font || "sans-serif").fontStyle(_.fontStyle || "normal").fontWeight(_.fontWeight || "normal").fontSize(fontSize2).random(random).layout(); + const size2 = layout.size(), dx = size2[0] >> 1, dy = size2[1] >> 1, n = words.length; + for (let i = 0, w2, t; i < n; ++i) { + w2 = words[i]; + t = w2.datum; + t[as[0]] = w2.x + dx; + t[as[1]] = w2.y + dy; + t[as[2]] = w2.font; + t[as[3]] = w2.size; + t[as[4]] = w2.style; + t[as[5]] = w2.weight; + t[as[6]] = w2.rotate; + } + return pulse2.reflow(mod).modifies(as); } -} -function encloseBasis1(a) { + }); + const wordcloud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + wordcloud: Wordcloud + }, Symbol.toStringTag, { value: "Module" })); + const array8 = (n) => new Uint8Array(n); + const array16 = (n) => new Uint16Array(n); + const array32 = (n) => new Uint32Array(n); + function Bitmaps() { + let width2 = 8, data2 = [], seen = array32(0), curr = array$1(0, width2), prev = array$1(0, width2); return { - x: a.x, - y: a.y, - r: a.r + data: () => data2, + seen: () => seen = lengthen(seen, data2.length), + add(array2) { + for (let i = 0, j = data2.length, n = array2.length, t; i < n; ++i) { + t = array2[i]; + t._index = j++; + data2.push(t); + } + }, + remove(num, map2) { + const n = data2.length, copy2 = Array(n - num), reindex = data2; + let t, i, j; + for (i = 0; !map2[i] && i < n; ++i) { + copy2[i] = data2[i]; + reindex[i] = i; + } + for (j = i; i < n; ++i) { + t = data2[i]; + if (!map2[i]) { + reindex[i] = j; + curr[j] = curr[i]; + prev[j] = prev[i]; + copy2[j] = t; + t._index = j++; + } else { + reindex[i] = -1; + } + curr[i] = 0; + } + data2 = copy2; + return reindex; + }, + size: () => data2.length, + curr: () => curr, + prev: () => prev, + reset: (k) => prev[k] = curr[k], + all: () => width2 < 257 ? 255 : width2 < 65537 ? 65535 : 4294967295, + set(k, one2) { + curr[k] |= one2; + }, + clear(k, one2) { + curr[k] &= ~one2; + }, + resize(n, m2) { + const k = curr.length; + if (n > k || m2 > width2) { + width2 = Math.max(m2, width2); + curr = array$1(n, width2, curr); + prev = array$1(n, width2); + } + } }; -} -function encloseBasis2(a, b) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); + } + function lengthen(array2, length2, copy2) { + if (array2.length >= length2) return array2; + copy2 = copy2 || new array2.constructor(length2); + copy2.set(array2); + return copy2; + } + function array$1(n, m2, array2) { + const copy2 = (m2 < 257 ? array8 : m2 < 65537 ? array16 : array32)(n); + if (array2) copy2.set(array2); + return copy2; + } + function Dimension(index2, i, query) { + const bit = 1 << i; return { - x: (x1 + x2 + x21 / l * r21) / 2, - y: (y1 + y2 + y21 / l * r21) / 2, - r: (l + r1 + r2) / 2 + one: bit, + zero: ~bit, + range: query.slice(), + bisect: index2.bisect, + index: index2.index, + size: index2.size, + onAdd(added, curr) { + const dim = this, range2 = dim.bisect(dim.range, added.value), idx = added.index, lo = range2[0], hi = range2[1], n1 = idx.length; + let i2; + for (i2 = 0; i2 < lo; ++i2) curr[idx[i2]] |= bit; + for (i2 = hi; i2 < n1; ++i2) curr[idx[i2]] |= bit; + return dim; + } }; -} -function encloseBasis3(a, b, c) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c.x, y3 = c.y, r3 = c.r, a2 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c2 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a2 * b3, xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb = (b3 * c2 - b2 * c3) / ab, ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, yb = (a2 * c3 - a3 * c2) / ab, A = xb * xb + yb * yb - 1, B = 2 * (r1 + xa * xb + ya * yb), C = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B); - return { - x: x1 + xa + xb * r, - y: y1 + ya + yb * r, - r: r - }; -} - -},{"../array.js":"4vcaT","../lcg.js":"9jKig","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hfHoW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var dx = 1, dy = 1, padding = 0, round = false; - function partition(root) { - var n = root.height + 1; - root.x0 = root.y0 = padding; - root.x1 = dx; - root.y1 = dy / n; - root.eachBefore(positionNode(dy, n)); - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(dy, n) { - return function(node) { - if (node.children) (0, _diceJsDefault.default)(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n); - var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - partition.round = function(x) { - return arguments.length ? (round = !!x, partition) : round; - }; - partition.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [ - dx, - dy - ]; - }; - partition.padding = function(x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - return partition; - }); -var _roundJs = require("./treemap/round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); - -},{"./treemap/round.js":"9PNun","./treemap/dice.js":"c7pGx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9PNun":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c7pGx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value; - while(++i < n){ - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; + } + function SortedIndex() { + let index2 = array32(0), value2 = [], size2 = 0; + function insert2(key2, data2, base2) { + if (!data2.length) return []; + const n0 = size2, n1 = data2.length, addi = array32(n1); + let addv = Array(n1), oldv, oldi, i; + for (i = 0; i < n1; ++i) { + addv[i] = key2(data2[i]); + addi[i] = i; + } + addv = sort$1(addv, addi); + if (n0) { + oldv = value2; + oldi = index2; + value2 = Array(n0 + n1); + index2 = array32(n0 + n1); + merge$1(base2, oldv, oldi, n0, addv, addi, n1, value2, index2); + } else { + if (base2 > 0) for (i = 0; i < n1; ++i) { + addi[i] += base2; + } + value2 = addv; + index2 = addi; + } + size2 = n0 + n1; + return { + index: addi, + value: addv + }; + } + function remove2(num, map2) { + const n = size2; + let idx, i, j; + for (i = 0; !map2[index2[i]] && i < n; ++i) ; + for (j = i; i < n; ++i) { + if (!map2[idx = index2[i]]) { + index2[j] = idx; + value2[j] = value2[i]; + ++j; } + } + size2 = n - num; + } + function reindex(map2) { + for (let i = 0, n = size2; i < n; ++i) { + index2[i] = map2[index2[i]]; + } + } + function bisect2(range2, array2) { + let n; + if (array2) { + n = array2.length; + } else { + array2 = value2; + n = size2; + } + return [bisectLeft$1(array2, range2[0], 0, n), bisectRight$1(array2, range2[1], 0, n)]; + } + return { + insert: insert2, + remove: remove2, + bisect: bisect2, + reindex, + index: () => index2, + size: () => size2 + }; + } + function sort$1(values2, index2) { + values2.sort.call(index2, (a2, b2) => { + const x2 = values2[a2], y2 = values2[b2]; + return x2 < y2 ? -1 : x2 > y2 ? 1 : 0; }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1euRH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var id = defaultId, parentId = defaultParentId, path; - function stratify(data) { - var nodes = Array.from(data), currentId = id, currentParentId = parentId, n, d, i, root, parent, node, nodeId, nodeKey, nodeByKey = new Map; - if (path != null) { - const I = nodes.map((d, i)=>normalize(path(d, i, data))); - const P = I.map(parentof); - const S = new Set(I).add(""); - for (const i of P)if (!S.has(i)) { - S.add(i); - I.push(i); - P.push(parentof(i)); - nodes.push(imputed); - } - currentId = (_, i)=>I[i]; - currentParentId = (_, i)=>P[i]; - } - for(i = 0, n = nodes.length; i < n; ++i){ - d = nodes[i], node = nodes[i] = new (0, _indexJs.Node)(d); - if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) { - nodeKey = node.id = nodeId; - nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); - } - if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) node.parent = nodeId; - } - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (nodeId = node.parent) { - parent = nodeByKey.get(nodeId); - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node); - else parent.children = [ - node - ]; - node.parent = parent; - } else { - if (root) throw new Error("multiple roots"); - root = node; - } - } - if (!root) throw new Error("no root"); - // When imputing internal nodes, only introduce roots if needed. - // Then replace the imputed marker data with null. - if (path != null) { - while(root.data === imputed && root.children.length === 1)root = root.children[0], --n; - for(let i = nodes.length - 1; i >= 0; --i){ - node = nodes[i]; - if (node.data !== imputed) break; - node.data = null; - } - } - root.parent = preroot; - root.eachBefore(function(node) { - node.depth = node.parent.depth + 1; - --n; - }).eachBefore((0, _indexJs.computeHeight)); - root.parent = null; - if (n > 0) throw new Error("cycle"); - return root; - } - stratify.id = function(x) { - return arguments.length ? (id = (0, _accessorsJs.optional)(x), stratify) : id; - }; - stratify.parentId = function(x) { - return arguments.length ? (parentId = (0, _accessorsJs.optional)(x), stratify) : parentId; - }; - stratify.path = function(x) { - return arguments.length ? (path = (0, _accessorsJs.optional)(x), stratify) : path; - }; - return stratify; - }); -var _accessorsJs = require("./accessors.js"); -var _indexJs = require("./hierarchy/index.js"); -var preroot = { - depth: -1 -}, ambiguous = {}, imputed = {}; -function defaultId(d) { - return d.id; -} -function defaultParentId(d) { - return d.parentId; -} -// To normalize a path, we coerce to a string, strip the trailing slash if any -// (as long as the trailing slash is not immediately preceded by another slash), -// and add leading slash if missing. -function normalize(path) { - path = `${path}`; - let i = path.length; - if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1); - return path[0] === "/" ? path : `/${path}`; -} -// Walk backwards to find the first slash that is not the leading slash, e.g.: -// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased -// because the id of the root must be a truthy value.) -function parentof(path) { - let i = path.length; - if (i < 2) return ""; - while(--i > 1)if (slash(path, i)) break; - return path.slice(0, i); -} -// Slashes can be escaped; to determine whether a slash is a path delimiter, we -// count the number of preceding backslashes escaping the forward slash: an odd -// number indicates an escaped forward slash. -function slash(path, i) { - if (path[i] === "/") { - let k = 0; - while(i > 0 && path[--i] === "\\")++k; - if ((k & 1) === 0) return true; + return permute(values2, index2); + } + function merge$1(base2, value0, index0, n0, value1, index1, n1, value2, index2) { + let i0 = 0, i1 = 0, i; + for (i = 0; i0 < n0 && i1 < n1; ++i) { + if (value0[i0] < value1[i1]) { + value2[i] = value0[i0]; + index2[i] = index0[i0++]; + } else { + value2[i] = value1[i1]; + index2[i] = index1[i1++] + base2; + } } - return false; -} - -},{"./accessors.js":"i242w","./hierarchy/index.js":"jtgBj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5MDZW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null; - function tree(root) { - var t = treeRoot(root); - // Compute the layout using Buchheim et al.’s algorithm. - t.eachAfter(firstWalk), t.parent.m = -t.z; - t.eachBefore(secondWalk); - // If a fixed node size is specified, scale x and y. - if (nodeSize) root.eachBefore(sizeNode); - else { - var left = root, right = root, bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = node.depth * ky; - }); - } - return root; - } - // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is - // applied recursively to the children of v, as well as the function - // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the - // node v is placed to the midpoint of its outermost children. - function firstWalk(v) { - var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else v.z = midpoint; - } else if (w) v.z = w.z + separation(v._, w._); - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } - // Computes all real x-coordinates by summing up the modifiers recursively. - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += v.parent.m; - } - // The core of the algorithm. Here, a new subtree is combined with the - // previous subtrees. Threads are used to traverse the inside and outside - // contours of the left and right subtree up to the highest common level. The - // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the - // superscript o means outside and i means inside, the subscript - means left - // subtree and + means right subtree. For summing up the modifiers along the - // contour, we use respective variables si+, si-, so-, and so+. Whenever two - // nodes of the inside contours conflict, we compute the left one of the - // greatest uncommon ancestors using the function ANCESTOR and call MOVE - // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. - // Finally, we add a new thread (if necessary). - function apportion(v, w, ancestor) { - if (w) { - var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; - while(vim = nextRight(vim), vip = nextLeft(vip), vim && vip){ - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; + for (; i0 < n0; ++i0, ++i) { + value2[i] = value0[i0]; + index2[i] = index0[i0]; + } + for (; i1 < n1; ++i1, ++i) { + value2[i] = value1[i1]; + index2[i] = index1[i1] + base2; + } + } + function CrossFilter(params2) { + Transform.call(this, Bitmaps(), params2); + this._indices = null; + this._dims = null; + } + CrossFilter.Definition = { + "type": "CrossFilter", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "query", + "type": "array", + "array": true, + "required": true, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }] + }; + inherits(CrossFilter, Transform, { + transform(_, pulse2) { + if (!this._dims) { + return this.init(_, pulse2); + } else { + var init2 = _.modified("fields") || _.fields.some((f) => pulse2.modified(f.fields)); + return init2 ? this.reinit(_, pulse2) : this.eval(_, pulse2); + } + }, + init(_, pulse2) { + const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m2 = query.length; + let i = 0, key2, index2; + for (; i < m2; ++i) { + key2 = fields[i].fname; + index2 = indices[key2] || (indices[key2] = SortedIndex()); + dims.push(Dimension(index2, i, query[i])); + } + return this.eval(_, pulse2); + }, + reinit(_, pulse2) { + const output2 = pulse2.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output2.rem = output2.add, mod = output2.mod, m2 = query.length, adds = {}; + let add2, index2, key2, mods, remMap, modMap, i, n, f; + prev.set(curr); + if (pulse2.rem.length) { + remMap = this.remove(_, pulse2, output2); + } + if (pulse2.add.length) { + bits.add(pulse2.add); + } + if (pulse2.mod.length) { + modMap = {}; + for (mods = pulse2.mod, i = 0, n = mods.length; i < n; ++i) { + modMap[mods[i]._index] = 1; } - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; + } + for (i = 0; i < m2; ++i) { + f = fields[i]; + if (!dims[i] || _.modified("fields", i) || pulse2.modified(f.fields)) { + key2 = f.fname; + if (!(add2 = adds[key2])) { + indices[key2] = index2 = SortedIndex(); + adds[key2] = add2 = index2.insert(f, pulse2.source, 0); + } + dims[i] = Dimension(index2, i, query[i]).onAdd(add2, curr); } - tree.separation = function(x) { - return arguments.length ? (separation = x, tree) : separation; - }; - tree.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [ - dx, - dy - ]; - }; - tree.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : nodeSize ? [ - dx, - dy - ] : null; - }; - return tree; - }); -var _indexJs = require("./hierarchy/index.js"); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -// function radialSeparation(a, b) { -// return (a.parent === b.parent ? 1 : 2) / a.depth; -// } -// This function is used to traverse the left contour of a subtree (or -// subforest). It returns the successor of v on this contour. This successor is -// either given by the leftmost child of v or by the thread of v. The function -// returns null if and only if v is on the highest level of its subtree. -function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; -} -// This function works analogously to nextLeft. -function nextRight(v) { - var children = v.children; - return children ? children[children.length - 1] : v.t; -} -// Shifts the current subtree rooted at w+. This is done by increasing -// prelim(w+) and mod(w+) by shift. -function moveSubtree(wm, wp, shift) { - var change = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += shift; -} -// All other shifts, applied to the smaller subtrees between w- and w+, are -// performed by this function. To prepare the shifts, we have to adjust -// change(w+), shift(w+), and change(w-). -function executeShifts(v) { - var shift = 0, change = 0, children = v.children, i = children.length, w; - while(--i >= 0){ - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } -} -// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, -// returns the specified (default) ancestor. -function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; -} -function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - this.a = this; // ancestor - this.z = 0; // prelim - this.m = 0; // mod - this.c = 0; // change - this.s = 0; // shift - this.t = null; // thread - this.i = i; // number -} -TreeNode.prototype = Object.create((0, _indexJs.Node).prototype); -function treeRoot(root) { - var tree = new TreeNode(root, 0), node, nodes = [ - tree - ], child, children, i, n; - while(node = nodes.pop())if (children = node._.children) { - node.children = new Array(n = children.length); - for(i = n - 1; i >= 0; --i){ - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - (tree.parent = new TreeNode(null, 0)).children = [ - tree - ]; - return tree; -} - -},{"./hierarchy/index.js":"jtgBj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ew6JB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var tile = (0, _squarifyJsDefault.default), round = false, dx = 1, dy = 1, paddingStack = [ - 0 - ], paddingInner = (0, _constantJs.constantZero), paddingTop = (0, _constantJs.constantZero), paddingRight = (0, _constantJs.constantZero), paddingBottom = (0, _constantJs.constantZero), paddingLeft = (0, _constantJs.constantZero); - function treemap(root) { - root.x0 = root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [ - 0 - ]; - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(node) { - var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } + } + for (i = 0, n = bits.data().length; i < n; ++i) { + if (remMap[i]) { + continue; + } else if (prev[i] !== curr[i]) { + out.push(i); + } else if (modMap[i] && curr[i] !== all) { + mod.push(i); } - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [ - dx, - dy - ]; - }; - treemap.tile = function(x) { - return arguments.length ? (tile = (0, _accessorsJs.required)(x), treemap) : tile; - }; - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingInner; - }; - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingTop; - }; - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingRight; - }; - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingBottom; - }; - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingLeft; - }; - return treemap; - }); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _squarifyJs = require("./squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./round.js":"9PNun","./squarify.js":"dnoy6","../accessors.js":"i242w","../constant.js":"i6Ely","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dnoy6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "phi", ()=>phi); -parcelHelpers.export(exports, "squarifyRatio", ()=>squarifyRatio); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var phi = (1 + Math.sqrt(5)) / 2; -function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; - while(i0 < n){ - dx = x1 - x0, dy = y1 - y0; - // Find the next non-empty node. - do sumValue = nodes[i1++].value; - while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - // Keep adding nodes while the aspect ratio maintains or improves. - for(; i1 < n; ++i1){ - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { - sumValue -= nodeValue; - break; - } - minRatio = newRatio; + } + bits.mask = (1 << m2) - 1; + return output2; + }, + eval(_, pulse2) { + const output2 = pulse2.materialize().fork(), m2 = this._dims.length; + let mask = 0; + if (pulse2.rem.length) { + this.remove(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (_.modified("query") && !_.modified("fields")) { + mask |= this.update(_, pulse2, output2); + } + if (pulse2.add.length) { + this.insert(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (pulse2.mod.length) { + this.modify(pulse2, output2); + mask |= (1 << m2) - 1; + } + this.value.mask = mask; + return output2; + }, + insert(_, pulse2, output2) { + const tuples = pulse2.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output2.add, n = bits.size() + tuples.length, m2 = dims.length; + let k = bits.size(), j, key2, add2; + bits.resize(n, m2); + bits.add(tuples); + const curr = bits.curr(), prev = bits.prev(), all = bits.all(); + for (j = 0; j < m2; ++j) { + key2 = fields[j].fname; + add2 = adds[key2] || (adds[key2] = indices[key2].insert(fields[j], tuples, k)); + dims[j].onAdd(add2, curr); + } + for (; k < n; ++k) { + prev[k] = all; + if (curr[k] !== all) out.push(k); + } + }, + modify(pulse2, output2) { + const out = output2.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse2.mod; + let i, n, k; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + if (curr[k] !== all) out.push(k); + } + }, + remove(_, pulse2, output2) { + const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map2 = {}, out = output2.rem, tuples = pulse2.rem; + let i, n, k, f; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + map2[k] = 1; + prev[k] = f = curr[k]; + curr[k] = all; + if (f !== all) out.push(k); + } + for (k in indices) { + indices[k].remove(n, map2); + } + this.reindex(pulse2, n, map2); + return map2; + }, + // reindex filters and indices after propagation completes + reindex(pulse2, num, map2) { + const indices = this._indices, bits = this.value; + pulse2.runAfter(() => { + const indexMap = bits.remove(num, map2); + for (const key2 in indices) indices[key2].reindex(indexMap); + }); + }, + update(_, pulse2, output2) { + const dims = this._dims, query = _.query, stamp = pulse2.stamp, m2 = dims.length; + let mask = 0, i, q; + output2.filters = 0; + for (q = 0; q < m2; ++q) { + if (_.modified("query", q)) { + i = q; + ++mask; + } + } + if (mask === 1) { + mask = dims[i].one; + this.incrementOne(dims[i], query[i], output2.add, output2.rem); + } else { + for (q = 0, mask = 0; q < m2; ++q) { + if (!_.modified("query", q)) continue; + mask |= dims[q].one; + this.incrementAll(dims[q], query[q], stamp, output2.add); + output2.rem = output2.add; + } + } + return mask; + }, + incrementAll(dim, query, stamp, out) { + const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } + dim.range = query.slice(); + }, + incrementOne(dim, query, add2, rem2) { + const bits = this.value, curr = bits.curr(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); + } + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); } - // Position and record the row orientation. - rows.push(row = { - value: sumValue, - dice: dx < dy, - children: nodes.slice(i0, i1) + } + dim.range = query.slice(); + } + }); + function ResolveFilter(params2) { + Transform.call(this, null, params2); + } + ResolveFilter.Definition = { + "type": "ResolveFilter", + "metadata": {}, + "params": [{ + "name": "ignore", + "type": "number", + "required": true, + "description": "A bit mask indicating which filters to ignore." + }, { + "name": "filter", + "type": "object", + "required": true, + "description": "Per-tuple filter bitmaps from a CrossFilter transform." + }] + }; + inherits(ResolveFilter, Transform, { + transform(_, pulse2) { + const ignore = ~(_.ignore || 0), bitmap = _.filter, mask = bitmap.mask; + if ((mask & ignore) === 0) return pulse2.StopPropagation; + const output2 = pulse2.fork(pulse2.ALL), data2 = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k) => !(curr[k] & ignore) ? data2[k] : null; + output2.filter(output2.MOD, pass); + if (!(mask & mask - 1)) { + output2.filter(output2.ADD, pass); + output2.filter(output2.REM, (k) => (curr[k] & ignore) === mask ? data2[k] : null); + } else { + output2.filter(output2.ADD, (k) => { + const c2 = curr[k] & ignore, f = !c2 && c2 ^ prev[k] & ignore; + return f ? data2[k] : null; + }); + output2.filter(output2.REM, (k) => { + const c2 = curr[k] & ignore, f = c2 && !(c2 ^ (c2 ^ prev[k] & ignore)); + return f ? data2[k] : null; }); - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; + } + return output2.filter(output2.SOURCE, (t) => pass(t._index)); + } + }); + const xf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + crossfilter: CrossFilter, + resolvefilter: ResolveFilter + }, Symbol.toStringTag, { value: "Module" })); + const RawCode = "RawCode"; + const Literal = "Literal"; + const Property = "Property"; + const Identifier = "Identifier"; + const ArrayExpression = "ArrayExpression"; + const BinaryExpression = "BinaryExpression"; + const CallExpression = "CallExpression"; + const ConditionalExpression = "ConditionalExpression"; + const LogicalExpression = "LogicalExpression"; + const MemberExpression = "MemberExpression"; + const ObjectExpression = "ObjectExpression"; + const UnaryExpression = "UnaryExpression"; + function ASTNode(type2) { + this.type = type2; + } + ASTNode.prototype.visit = function(visitor) { + let c2, i, n; + if (visitor(this)) return 1; + for (c2 = children(this), i = 0, n = c2.length; i < n; ++i) { + if (c2[i].visit(visitor)) return 1; + } + }; + function children(node) { + switch (node.type) { + case ArrayExpression: + return node.elements; + case BinaryExpression: + case LogicalExpression: + return [node.left, node.right]; + case CallExpression: + return [node.callee].concat(node.arguments); + case ConditionalExpression: + return [node.test, node.consequent, node.alternate]; + case MemberExpression: + return [node.object, node.property]; + case ObjectExpression: + return node.properties; + case Property: + return [node.key, node.value]; + case UnaryExpression: + return [node.argument]; + case Identifier: + case Literal: + case RawCode: + default: + return []; + } + } + var TokenName, source, index, length$1, lookahead; + var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; + TokenName = {}; + TokenName[TokenBooleanLiteral] = "Boolean"; + TokenName[TokenEOF] = "<end>"; + TokenName[TokenIdentifier] = "Identifier"; + TokenName[TokenKeyword] = "Keyword"; + TokenName[TokenNullLiteral] = "Null"; + TokenName[TokenNumericLiteral] = "Numeric"; + TokenName[TokenPunctuator] = "Punctuator"; + TokenName[TokenStringLiteral] = "String"; + TokenName[TokenRegularExpression] = "RegularExpression"; + var SyntaxArrayExpression = "ArrayExpression", SyntaxBinaryExpression = "BinaryExpression", SyntaxCallExpression = "CallExpression", SyntaxConditionalExpression = "ConditionalExpression", SyntaxIdentifier = "Identifier", SyntaxLiteral = "Literal", SyntaxLogicalExpression = "LogicalExpression", SyntaxMemberExpression = "MemberExpression", SyntaxObjectExpression = "ObjectExpression", SyntaxProperty = "Property", SyntaxUnaryExpression = "UnaryExpression"; + var MessageUnexpectedToken = "Unexpected token %0", MessageUnexpectedNumber = "Unexpected number", MessageUnexpectedString = "Unexpected string", MessageUnexpectedIdentifier = "Unexpected identifier", MessageUnexpectedReserved = "Unexpected reserved word", MessageUnexpectedEOS = "Unexpected end of input", MessageInvalidRegExp = "Invalid regular expression", MessageUnterminatedRegExp = "Invalid regular expression: missing /", MessageStrictOctalLiteral = "Octal literals are not allowed in strict mode.", MessageStrictDuplicateProperty = "Duplicate data property in object literal not allowed in strict mode"; + var ILLEGAL$1 = "ILLEGAL", DISABLED = "Disabled."; + var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); + function assert(condition, message) { + if (!condition) { + throw new Error("ASSERT: " + message); + } + } + function isDecimalDigit(ch2) { + return ch2 >= 48 && ch2 <= 57; + } + function isHexDigit(ch2) { + return "0123456789abcdefABCDEF".includes(ch2); + } + function isOctalDigit(ch2) { + return "01234567".includes(ch2); + } + function isWhiteSpace(ch2) { + return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && [5760, 6158, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].includes(ch2); + } + function isLineTerminator(ch2) { + return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233; + } + function isIdentifierStart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch2)); + } + function isIdentifierPart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 >= 48 && ch2 <= 57 || // 0..9 + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch2)); + } + const keywords = { + "if": 1, + "in": 1, + "do": 1, + "var": 1, + "for": 1, + "new": 1, + "try": 1, + "let": 1, + "this": 1, + "else": 1, + "case": 1, + "void": 1, + "with": 1, + "enum": 1, + "while": 1, + "break": 1, + "catch": 1, + "throw": 1, + "const": 1, + "yield": 1, + "class": 1, + "super": 1, + "return": 1, + "typeof": 1, + "delete": 1, + "switch": 1, + "export": 1, + "import": 1, + "public": 1, + "static": 1, + "default": 1, + "finally": 1, + "extends": 1, + "package": 1, + "private": 1, + "function": 1, + "continue": 1, + "debugger": 1, + "interface": 1, + "protected": 1, + "instanceof": 1, + "implements": 1 + }; + function skipComment() { + while (index < length$1) { + const ch2 = source.charCodeAt(index); + if (isWhiteSpace(ch2) || isLineTerminator(ch2)) { + ++index; + } else { + break; + } + } + } + function scanHexEscape(prefix) { + var i, len2, ch2, code = 0; + len2 = prefix === "u" ? 4 : 2; + for (i = 0; i < len2; ++i) { + if (index < length$1 && isHexDigit(source[index])) { + ch2 = source[index++]; + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } } - return rows; -} -exports.default = function custom(ratio) { - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); + return String.fromCharCode(code); + } + function scanUnicodeCodePointEscape() { + var ch2, code, cu1, cu2; + ch2 = source[index]; + code = 0; + if (ch2 === "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - squarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - return squarify; -}(phi); - -},{"./dice.js":"c7pGx","./slice.js":"c9bya","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c9bya":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value; - while(++i < n){ - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8vqlk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1); - for(sums[0] = sum = i = 0; i < n; ++i)sums[i + 1] = sum += nodes[i].value; - partition(0, n, parent.value, x0, y0, x1, y1); - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - var valueOffset = sums[i], valueTarget = value / 2 + valueOffset, k = i + 1, hi = j - 1; - while(k < hi){ - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1; - else hi = mid; - } - if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i + 1 < k) --k; - var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft; - if (x1 - x0 > y1 - y0) { - var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } + while (index < length$1) { + ch2 = source[index++]; + if (!isHexDigit(ch2)) { + break; + } + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); + } + if (code > 1114111 || ch2 !== "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + if (code <= 65535) { + return String.fromCharCode(code); + } + cu1 = (code - 65536 >> 10) + 55296; + cu2 = (code - 65536 & 1023) + 56320; + return String.fromCharCode(cu1, cu2); + } + function getEscapedIdentifier() { + var ch2, id2; + ch2 = source.charCodeAt(index++); + id2 = String.fromCharCode(ch2); + if (ch2 === 92) { + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierStart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + id2 = ch2; + } + while (index < length$1) { + ch2 = source.charCodeAt(index); + if (!isIdentifierPart(ch2)) { + break; + } + ++index; + id2 += String.fromCharCode(ch2); + if (ch2 === 92) { + id2 = id2.substr(0, id2.length - 1); + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fbNXv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? (0, _sliceJsDefault.default) : (0, _diceJsDefault.default))(parent, x0, y0, x1, y1); - }); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); - -},{"./dice.js":"c7pGx","./slice.js":"c9bya","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"12ScZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _squarifyJs = require("./squarify.js"); -exports.default = function custom(ratio) { - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && rows.ratio === ratio) { - var rows, row, nodes, i, j = -1, n, m = rows.length, value = parent.value; - while(++j < m){ - row = rows[j], nodes = row.children; - for(i = row.value = 0, n = nodes.length; i < n; ++i)row.value += nodes[i].value; - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1); - value -= row.value; - } - } else { - parent._squarify = rows = (0, _squarifyJs.squarifyRatio)(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierPart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } + id2 += ch2; + } + } + return id2; + } + function getIdentifier() { + var start, ch2; + start = index++; + while (index < length$1) { + ch2 = source.charCodeAt(index); + if (ch2 === 92) { + index = start; + return getEscapedIdentifier(); + } + if (isIdentifierPart(ch2)) { + ++index; + } else { + break; + } + } + return source.slice(start, index); + } + function scanIdentifier() { + var start, id2, type2; + start = index; + id2 = source.charCodeAt(index) === 92 ? getEscapedIdentifier() : getIdentifier(); + if (id2.length === 1) { + type2 = TokenIdentifier; + } else if (keywords.hasOwnProperty(id2)) { + type2 = TokenKeyword; + } else if (id2 === "null") { + type2 = TokenNullLiteral; + } else if (id2 === "true" || id2 === "false") { + type2 = TokenBooleanLiteral; + } else { + type2 = TokenIdentifier; } - resquarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); + return { + type: type2, + value: id2, + start, + end: index }; - return resquarify; -}((0, _squarifyJs.phi)); - -},{"./dice.js":"c7pGx","./slice.js":"c9bya","./squarify.js":"dnoy6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lZyUZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "label", ()=>Label); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -// bit mask for getting first 2 bytes of alpha value -const ALPHA_MASK = 0xff000000; -function baseBitmaps($, data) { - const bitmap = $.bitmap(); - // when there is no base mark but data points are to be avoided - (data || []).forEach((d)=>bitmap.set($(d.boundary[0]), $(d.boundary[3]))); - return [ - bitmap, - undefined - ]; -} -function markBitmaps($, baseMark, avoidMarks, labelInside, isGroupArea) { - // create canvas - const width = $.width, height = $.height, border = labelInside || isGroupArea, context = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), baseMarkContext = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), strokeContext = border && (0, _vegaCanvas.canvas)(width, height).getContext('2d'); - // render all marks to be avoided into canvas - avoidMarks.forEach((items)=>draw(context, items, false)); - draw(baseMarkContext, baseMark, false); - if (border) draw(strokeContext, baseMark, true); - // get canvas buffer, create bitmaps - const buffer = getBuffer(context, width, height), baseMarkBuffer = getBuffer(baseMarkContext, width, height), strokeBuffer = border && getBuffer(strokeContext, width, height), layer1 = $.bitmap(), layer2 = border && $.bitmap(); - // populate bitmap layers - let x, y, u, v, index, alpha, strokeAlpha, baseMarkAlpha; - for(y = 0; y < height; ++y)for(x = 0; x < width; ++x){ - index = y * width + x; - alpha = buffer[index] & ALPHA_MASK; - baseMarkAlpha = baseMarkBuffer[index] & ALPHA_MASK; - strokeAlpha = border && strokeBuffer[index] & ALPHA_MASK; - if (alpha || strokeAlpha || baseMarkAlpha) { - u = $(x); - v = $(y); - if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u, v); // update interior bitmap - if (border && (alpha || strokeAlpha)) layer2.set(u, v); // update border bitmap + } + function scanPunctuator() { + var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; + switch (code) { + // Check for most common single-character punctuators. + case 46: + // . dot + case 40: + // ( open bracket + case 41: + // ) close bracket + case 59: + // ; semicolon + case 44: + // , comma + case 123: + // { open curly brace + case 125: + // } close curly brace + case 91: + // [ + case 93: + // ] + case 58: + // : + case 63: + // ? + case 126: + ++index; + return { + type: TokenPunctuator, + value: String.fromCharCode(code), + start, + end: index + }; + default: + code2 = source.charCodeAt(index + 1); + if (code2 === 61) { + switch (code) { + case 43: + // + + case 45: + // - + case 47: + // / + case 60: + // < + case 62: + // > + case 94: + // ^ + case 124: + // | + case 37: + // % + case 38: + // & + case 42: + index += 2; + return { + type: TokenPunctuator, + value: String.fromCharCode(code) + String.fromCharCode(code2), + start, + end: index + }; + case 33: + // ! + case 61: + index += 2; + if (source.charCodeAt(index) === 61) { + ++index; + } + return { + type: TokenPunctuator, + value: source.slice(start, index), + start, + end: index + }; + } } } - return [ - layer1, - layer2 - ]; -} -function getBuffer(context, width, height) { - return new Uint32Array(context.getImageData(0, 0, width, height).data.buffer); -} -function draw(context, items, interior) { - if (!items.length) return; - const type = items[0].mark.marktype; - if (type === 'group') items.forEach((group)=>{ - group.items.forEach((mark)=>draw(context, mark.items, interior)); - }); - else (0, _vegaScenegraph.Marks)[type].draw(context, { - items: interior ? items.map(prepare) : items - }); -} -/** - * Prepare item before drawing into canvas (setting stroke and opacity) - * @param {object} source item to be prepared - * @returns prepared item - */ function prepare(source) { - const item = (0, _vegaDataflow.rederive)(source, {}); - if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) return { - ...item, - strokeOpacity: 1, - stroke: '#000', - fillOpacity: 0 - }; - return item; -} -const DIV = 5, // bit shift from x, y index to bit vector array index -MOD = 31, // bit mask for index lookup within a bit vector -SIZE = 32, // individual bit vector size -RIGHT0 = new Uint32Array(SIZE + 1), // left-anchored bit vectors, full -> 0 -RIGHT1 = new Uint32Array(SIZE + 1); // right-anchored bit vectors, 0 -> full -RIGHT1[0] = 0; -RIGHT0[0] = ~RIGHT1[0]; -for(let i = 1; i <= SIZE; ++i){ - RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; - RIGHT0[i] = ~RIGHT1[i]; -} -function Bitmap(w, h) { - const array = new Uint32Array(~~((w * h + SIZE) / SIZE)); - function _set(index, mask) { - array[index] |= mask; + ch4 = source.substr(index, 4); + if (ch4 === ">>>=") { + index += 4; + return { + type: TokenPunctuator, + value: ch4, + start, + end: index + }; + } + ch3 = ch4.substr(0, 3); + if (ch3 === ">>>" || ch3 === "<<=" || ch3 === ">>=") { + index += 3; + return { + type: TokenPunctuator, + value: ch3, + start, + end: index + }; + } + ch2 = ch3.substr(0, 2); + if (ch1 === ch2[1] && "+-<>&|".includes(ch1) || ch2 === "=>") { + index += 2; + return { + type: TokenPunctuator, + value: ch2, + start, + end: index + }; + } + if (ch2 === "//") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - function _clear(index, mask) { - array[index] &= mask; + if ("<>=!+-*%&|^/".includes(ch1)) { + ++index; + return { + type: TokenPunctuator, + value: ch1, + start, + end: index + }; + } + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + function scanHexLiteral(start) { + let number2 = ""; + while (index < length$1) { + if (!isHexDigit(source[index])) { + break; + } + number2 += source[index++]; + } + if (number2.length === 0) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } return { - array: array, - get: (x, y)=>{ - const index = y * w + x; - return array[index >>> DIV] & 1 << (index & MOD); - }, - set: (x, y)=>{ - const index = y * w + x; - _set(index >>> DIV, 1 << (index & MOD)); - }, - clear: (x, y)=>{ - const index = y * w + x; - _clear(index >>> DIV, ~(1 << (index & MOD))); - }, - getRange: (x, y, x2, y2)=>{ - let r = y2, start, end, indexStart, indexEnd; - for(; r >= y; --r){ - start = r * w + x; - end = r * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) { - if (array[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) return true; - } else { - if (array[indexStart] & RIGHT0[start & MOD]) return true; - if (array[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; - for(let i = indexStart + 1; i < indexEnd; ++i){ - if (array[i]) return true; - } - } - } - return false; - }, - setRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); - else { - _set(indexStart, RIGHT0[start & MOD]); - _set(indexEnd, RIGHT1[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_set(i, 0xffffffff); - } - } - }, - clearRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); - else { - _clear(indexStart, RIGHT1[start & MOD]); - _clear(indexEnd, RIGHT0[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_clear(i, 0); - } - } - }, - outOfBounds: (x, y, x2, y2)=>x < 0 || y < 0 || y2 >= h || x2 >= w - }; -} -function scaler(width, height, padding) { - const ratio = Math.max(1, Math.sqrt(width * height / 1e6)), w = ~~((width + 2 * padding + ratio) / ratio), h = ~~((height + 2 * padding + ratio) / ratio), scale = (_)=>~~((_ + padding) / ratio); - scale.invert = (_)=>_ * ratio - padding; - scale.bitmap = ()=>Bitmap(w, h); - scale.ratio = ratio; - scale.padding = padding; - scale.width = width; - scale.height = height; - return scale; -} -function placeAreaLabelNaive($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height; - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxAreaWidth = 0, x1, x2, y1, y2, x, y, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - areaWidth = Math.abs(x2 - x1 + y2 - y1); - if (areaWidth >= maxAreaWidth) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - } - } - x = textWidth / 2; - y = textHeight / 2; - x1 = d.x - x; - x2 = d.x + x; - y1 = d.y - y; - y2 = d.y + y; - d.align = 'center'; - if (x1 < 0 && x2 <= width) d.align = 'left'; - else if (0 <= x1 && width < x2) d.align = 'right'; - d.baseline = 'middle'; - if (y1 < 0 && y2 <= height) d.baseline = 'top'; - else if (0 <= y1 && height < y2) d.baseline = 'bottom'; - return true; + type: TokenNumericLiteral, + value: parseInt("0x" + number2, 16), + start, + end: index }; -} -function outOfBounds(x, y, textWidth, textHeight, width, height) { - let r = textWidth / 2; - return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height; -} -function collision($, x, y, textHeight, textWidth, h, bm0, bm1) { - const w = textWidth * h / (textHeight * 2), x1 = $(x - w), x2 = $(x + w), y1 = $(y - (h = h / 2)), y2 = $(y + h); - return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2); -} -function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1]; // area outlines - function tryLabel(_x, _y, maxSize, textWidth, textHeight) { - const x = $.invert(_x), y = $.invert(_y); - let lo = maxSize, hi = height, mid; - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) return [ - x, - y, - lo, - true - ]; - } + } + function scanOctalLiteral(start) { + let number2 = "0" + source[index++]; + while (index < length$1) { + if (!isOctalDigit(source[index])) { + break; + } + number2 += source[index++]; } - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - if (x1 > x2) { - swapTmp = x1; - x1 = x2; - x2 = swapTmp; - } - if (y1 > y2) { - swapTmp = y1; - y1 = y2; - y2 = swapTmp; - } - _x1 = $(x1); - _x2 = $(x2); - _xMid = ~~((_x1 + _x2) / 2); - _y1 = $(y1); - _y2 = $(y2); - _yMid = ~~((_y1 + _y2) / 2); - // search along the line from mid point between the 2 border to lower border - for(_x = _xMid; _x >= _x1; --_x)for(_y = _yMid; _y >= _y1; --_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // search along the line from mid point between the 2 border to upper border - for(_x = _xMid; _x <= _x2; ++_x)for(_y = _yMid; _y <= _y2; ++_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } - } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; + if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + return { + type: TokenNumericLiteral, + value: parseInt(number2, 8), + octal: true, + start, + end: index }; -} -// pixel direction offsets for flood fill search -const X_DIR = [ - -1, - -1, - 1, - 1 -]; -const Y_DIR = [ - -1, - 1, - -1, - 1 -]; -function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1], // area outlines - bm2 = $.bitmap(); // flood-fill visitations - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text), // label height - stack = []; // flood fill stack - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, lo, hi, mid, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - // add scaled center point to stack - stack.push([ - $((x1 + x2) / 2), - $((y1 + y2) / 2) - ]); - // perform flood fill, visit points - while(stack.length){ - [_x, _y] = stack.pop(); - // exit if point already marked - if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; - // mark point in flood fill bitmap - // add search points for all (in bound) directions - bm2.set(_x, _y); - for(let j = 0; j < 4; ++j){ - x = _x + X_DIR[j]; - y = _y + Y_DIR[j]; - if (!bm2.outOfBounds(x, y, x, y)) stack.push([ - x, - y - ]); - } - // unscale point back to x, y space - x = $.invert(_x); - y = $.invert(_y); - lo = maxSize; - hi = height; // TODO: make this bound smaller - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) { - d.x = x; - d.y = y; - maxSize = lo; - labelPlaced = true; - } - } - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } + } + function scanNumericLiteral() { + var number2, start, ch2; + ch2 = source[index]; + assert(isDecimalDigit(ch2.charCodeAt(0)) || ch2 === ".", "Numeric literal must start with a decimal digit or a decimal point"); + start = index; + number2 = ""; + if (ch2 !== ".") { + number2 = source[index++]; + ch2 = source[index]; + if (number2 === "0") { + if (ch2 === "x" || ch2 === "X") { + ++index; + return scanHexLiteral(start); } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; - }; -} -const Aligns = [ - 'right', - 'center', - 'left' -], Baselines = [ - 'bottom', - 'middle', - 'top' -]; -function placeMarkLabel($, bitmaps, anchors, offsets) { - const width = $.width, height = $.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets.length; - return function(d) { - const boundary = d.boundary, textHeight = d.datum.fontSize; - // can not be placed if the mark is not visible in the graph bound - if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) return false; - let textWidth = d.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x1, x2, y1, y2, xc, yc, _x1, _x2, _y1, _y2; - // for each anchor and offset - for(let i = 0; i < n; ++i){ - dx = (anchors[i] & 0x3) - 1; - dy = (anchors[i] >>> 0x2 & 0x3) - 1; - isInside = dx === 0 && dy === 0 || offsets[i] < 0; - sizeFactor = dx && dy ? Math.SQRT1_2 : 1; - insideFactor = offsets[i] < 0 ? -1 : 1; - x1 = boundary[1 + dx] + offsets[i] * dx * sizeFactor; - yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets[i] * dy * sizeFactor; - y1 = yc - textHeight / 2; - y2 = yc + textHeight / 2; - _x1 = $(x1); - _y1 = $(y1); - _y2 = $(y2); - if (!textWidth) { - // to avoid finding width of text label, - if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) continue; - else // Otherwise, find the label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); - } - xc = x1 + insideFactor * textWidth * dx / 2; - x1 = xc - textWidth / 2; - x2 = xc + textWidth / 2; - _x1 = $(x1); - _x2 = $(x2); - if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) { - // place label if the position is placeable - d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1; - d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1; - d.align = Aligns[dx * insideFactor + 1]; - d.baseline = Baselines[dy * insideFactor + 1]; - bm0.setRange(_x1, _y1, _x2, _y2); - return true; - } + if (isOctalDigit(ch2)) { + return scanOctalLiteral(start); } - return false; - }; -} -// Test if a label with the given dimensions can be added without overlap -function test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) { - return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); -} -// 8-bit representation of anchors -const TOP = 0x0, MIDDLE = 0x4, BOTTOM = 0x8, LEFT = 0x0, CENTER = 0x1, RIGHT = 0x2; -// Mapping from text anchor to number representation -const anchorCode = { - 'top-left': TOP + LEFT, - 'top': TOP + CENTER, - 'top-right': TOP + RIGHT, - 'left': MIDDLE + LEFT, - 'middle': MIDDLE + CENTER, - 'right': MIDDLE + RIGHT, - 'bottom-left': BOTTOM + LEFT, - 'bottom': BOTTOM + CENTER, - 'bottom-right': BOTTOM + RIGHT -}; -const placeAreaLabel = { - 'naive': placeAreaLabelNaive, - 'reduced-search': placeAreaLabelReducedSearch, - 'floodfill': placeAreaLabelFloodFill -}; -function labelLayout(texts, size, compare, offset, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding, method) { - // early exit for empty data - if (!texts.length) return texts; - const positions = Math.max(offset.length, anchor.length), offsets = getOffsets(offset, positions), anchors = getAnchors(anchor, positions), marktype = markType(texts[0].datum), grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === 'area', boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding === null || padding === Infinity, isNaiveGroupArea = isGroupArea && method === 'naive'; - let maxTextWidth = -1, maxTextHeight = -1; - // prepare text mark data for placing - const data = texts.map((d)=>{ - const textWidth = infPadding ? (0, _vegaScenegraph.textMetrics).width(d, d.text) : undefined; - maxTextWidth = Math.max(maxTextWidth, textWidth); - maxTextHeight = Math.max(maxTextHeight, d.fontSize); - return { - datum: d, - opacity: 0, - x: undefined, - y: undefined, - align: undefined, - baseline: undefined, - boundary: boundary(d), - textWidth - }; - }); - padding = padding === null || padding === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset) : padding; - const $ = scaler(size[0], size[1], padding); - let bitmaps; - if (!isNaiveGroupArea) { - // sort labels in priority order, if comparator is provided - if (compare) data.sort((a, b)=>compare(a.datum, b.datum)); - // flag indicating if label can be placed inside its base mark - let labelInside = false; - for(let i = 0; i < anchors.length && !labelInside; ++i)// label inside if anchor is at center - // label inside if offset to be inside the mark bound - labelInside = anchors[i] === 0x5 || offsets[i] < 0; - // extract data information from base mark when base mark is to be avoided - // base mark is implicitly avoided if it is a group area - const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d)=>d.datum); - // generate bitmaps for layout calculation - bitmaps = avoidMarks.length || baseMark ? markBitmaps($, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data); - } - // generate label placement function - const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets); - // place all labels - data.forEach((d)=>d.opacity = +place(d)); - return data; -} -function getOffsets(_, count) { - const offsets = new Float64Array(count), n = _.length; - for(let i = 0; i < n; ++i)offsets[i] = _[i] || 0; - for(let i = n; i < count; ++i)offsets[i] = offsets[n - 1]; - return offsets; -} -function getAnchors(_, count) { - const anchors = new Int8Array(count), n = _.length; - for(let i = 0; i < n; ++i)anchors[i] |= anchorCode[_[i]]; - for(let i = n; i < count; ++i)anchors[i] = anchors[n - 1]; - return anchors; -} -function markType(item) { - return item && item.mark && item.mark.marktype; -} -/** - * Factory function for function for getting base mark boundary, depending - * on mark and group type. When mark type is undefined, line or area: boundary - * is the coordinate of each data point. When base mark is grouped line, - * boundary is either at the start or end of the line depending on the - * value of lineAnchor. Otherwise, use bounds of base mark. - */ function markBoundary(marktype, grouptype, lineAnchor, markIndex) { - const xy = (d)=>[ - d.x, - d.x, - d.x, - d.y, - d.y, - d.y - ]; - if (!marktype) return xy; // no reactive geometry - else if (marktype === 'line' || marktype === 'area') return (d)=>xy(d.datum); - else if (grouptype === 'line') return (d)=>{ - const items = d.datum.items[markIndex].items; - return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : { - x: NaN, - y: NaN - }); - }; - else return (d)=>{ - const b = d.datum.bounds; - return [ - b.x1, - (b.x1 + b.x2) / 2, - b.x2, - b.y1, - (b.y1 + b.y2) / 2, - b.y2 - ]; - }; -} -const Output = [ - 'x', - 'y', - 'opacity', - 'align', - 'baseline' -]; -const Anchors = [ - 'top-left', - 'left', - 'bottom-left', - 'top', - 'bottom', - 'top-right', - 'right', - 'bottom-right' -]; -/** - * Compute text label layout to annotate marks. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The size of the layout, provided as a [width, height] array. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting label data in priority order. - * @param {Array<string>} [params.anchor] - Label anchor points relative to the base mark bounding box. - * The available options are 'top-left', 'left', 'bottom-left', 'top', - * 'bottom', 'top-right', 'right', 'bottom-right', 'middle'. - * @param {Array<number>} [params.offset] - Label offsets (in pixels) from the base mark bounding box. - * This parameter is parallel to the list of anchor points. - * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size. - * If this parameter is null, a label may exceed the layout size without any boundary. - * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor - * position for labels. One of 'start' or 'end'. - * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating - * which mark within the group should be labeled. - * @param {Array<number>} [params.avoidMarks] - A list of additional mark names for which the label - * layout should avoid overlap. - * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid - * overlap with the underlying base mark being labeled. - * @param {string} [params.method='naive'] - For area make labels only, a method for - * place labels. One of 'naive', 'reduced-search', or 'floodfill'. - * @param {Array<string>} [params.as] - The output fields written by the transform. - * The default is ['x', 'y', 'opacity', 'align', 'baseline']. - */ function Label(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Label.Definition = { - type: 'Label', - metadata: { - modifies: true - }, - params: [ - { - name: 'size', - type: 'number', - array: true, - length: 2, - required: true - }, - { - name: 'sort', - type: 'compare' - }, - { - name: 'anchor', - type: 'string', - array: true, - default: Anchors - }, - { - name: 'offset', - type: 'number', - array: true, - default: [ - 1 - ] - }, - { - name: 'padding', - type: 'number', - default: 0, - null: true - }, - { - name: 'lineAnchor', - type: 'string', - values: [ - 'start', - 'end' - ], - default: 'end' - }, - { - name: 'markIndex', - type: 'number', - default: 0 - }, - { - name: 'avoidBaseMark', - type: 'boolean', - default: true - }, - { - name: 'avoidMarks', - type: 'data', - array: true - }, - { - name: 'method', - type: 'string', - default: 'naive' - }, - { - name: 'as', - type: 'string', - array: true, - length: Output.length, - default: Output - } - ] -}; -(0, _vegaUtil.inherits)(Label, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || modp('sort'))) return; - if (!_.size || _.size.length !== 2) (0, _vegaUtil.error)('Size parameter should be specified as a [width, height] array.'); - const as = _.as || Output; - // run label layout - labelLayout(pulse.materialize(pulse.SOURCE).source || [], _.size, _.sort, (0, _vegaUtil.array)(_.offset == null ? 1 : _.offset), (0, _vegaUtil.array)(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || 'end', _.markIndex || 0, _.padding === undefined ? 0 : _.padding, _.method || 'naive').forEach((l)=>{ - // write layout results to data stream - const t = l.datum; - t[as[0]] = l.x; - t[as[1]] = l.y; - t[as[2]] = l.opacity; - t[as[3]] = l.align; - t[as[4]] = l.baseline; - }); - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-scenegraph":"jattk","vega-canvas":"kPWfS","vega-dataflow":"3NitK","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"elv3U":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loess", ()=>Loess); -parcelHelpers.export(exports, "regression", ()=>Regression); -var _vegaStatistics = require("vega-statistics"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -function partition(data, groupby) { - var groups = [], get = function(f) { - return f(t); - }, map, i, n, t, k, g; - // partition data points into stack groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); + if (ch2 && isDecimalDigit(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - g.push(t); + } + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; } - return groups; -} -/** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ function Loess(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Loess.Definition = { - 'type': 'Loess', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0.3 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Loess, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), m = names.length, as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], values = []; - groups.forEach((g)=>{ - (0, _vegaStatistics.regressionLoess)(g, _.x, _.y, _.bandwidth || 0.3).forEach((p)=>{ - const t = {}; - for(let i = 0; i < m; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - return out; + if (ch2 === ".") { + number2 += source[index++]; + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; } -}); -const Methods = { - constant: (0, _vegaStatistics.regressionConstant), - linear: (0, _vegaStatistics.regressionLinear), - log: (0, _vegaStatistics.regressionLog), - exp: (0, _vegaStatistics.regressionExp), - pow: (0, _vegaStatistics.regressionPow), - quad: (0, _vegaStatistics.regressionQuad), - poly: (0, _vegaStatistics.regressionPoly) -}; -const degreesOfFreedom = (method, order)=>method === 'poly' ? order : method === 'quad' ? 2 : 1; -/** - * Compute regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {string} [params.method='linear'] - The regression method to apply. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<number>} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ function Regression(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Regression.Definition = { - 'type': 'Regression', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'linear', - 'values': Object.keys(Methods) - }, - { - 'name': 'order', - 'type': 'number', - 'default': 3 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'params', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Regression, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), method = _.method || 'linear', order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method, order), as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], fit = Methods[method], values = []; - let domain = _.extent; - if (!(0, _vegaUtil.hasOwnProperty)(Methods, method)) (0, _vegaUtil.error)('Invalid regression method: ' + method); - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - groups.forEach((g)=>{ - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; - } - const model = fit(g, _.x, _.y, order); - if (_.params) { - // if parameter vectors requested return those - values.push((0, _vegaDataflow.ingest)({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; - } - const dom = domain || (0, _vegaUtil.extent)(g, _.x), add = (p)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }; - if (method === 'linear' || method === 'constant') // for linear or constant regression we only need the end points - dom.forEach((x)=>add([ - x, - model.predict(x) - ])); - else // otherwise return trend line sample points - (0, _vegaStatistics.sampleCurve)(model.predict, dom, 25, 200).forEach(add); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + if (ch2 === "e" || ch2 === "E") { + number2 += source[index++]; + ch2 = source[index]; + if (ch2 === "+" || ch2 === "-") { + number2 += source[index++]; + } + if (isDecimalDigit(source.charCodeAt(index))) { + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; } - return out; + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } } -}); - -},{"vega-statistics":"5ncfv","vega-dataflow":"3NitK","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"96rkJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "voronoi", ()=>Voronoi); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Delaunay = require("d3-delaunay"); -function Voronoi(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Voronoi.Definition = { - 'type': 'Voronoi', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'default': [ - [ - -100000, - -100000 - ], - [ - 1e5, - 1e5 - ] - ], - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -const defaultExtent = [ - -100000, - -100000, - 1e5, - 1e5 -]; -(0, _vegaUtil.inherits)(Voronoi, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const as = _.as || 'path', data = pulse.source; - // nothing to do if no data - if (!data || !data.length) return pulse; - // configure and construct voronoi diagram - let s = _.size; - s = s ? [ - 0, - 0, - s[0], - s[1] - ] : (s = _.extent) ? [ - s[0][0], - s[0][1], - s[1][0], - s[1][1] - ] : defaultExtent; - const voronoi = this.value = (0, _d3Delaunay.Delaunay).from(data, _.x, _.y).voronoi(s); - // map polygons to paths - for(let i = 0, n = data.length; i < n; ++i){ - const polygon = voronoi.cellPolygon(i); - data[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; - } - return pulse.reflow(_.modified()).modifies(as); - } -}); -// suppress duplicated end point vertices -function toPathString(p) { - const x = p[0][0], y = p[0][1]; - let n = p.length - 1; - for(; p[n][0] === x && p[n][1] === y; --n); - return 'M' + p.slice(0, n + 1).join('L') + 'Z'; -} -function isPoint(p) { - return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; -} - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-delaunay":"9qKHu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9qKHu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Delaunay", ()=>(0, _delaunayJsDefault.default)); -parcelHelpers.export(exports, "Voronoi", ()=>(0, _voronoiJsDefault.default)); -var _delaunayJs = require("./delaunay.js"); -var _delaunayJsDefault = parcelHelpers.interopDefault(_delaunayJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); - -},{"./delaunay.js":"1eiyj","./voronoi.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1eiyj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _delaunator = require("delaunator"); -var _delaunatorDefault = parcelHelpers.interopDefault(_delaunator); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); -const tau = 2 * Math.PI, pow = Math.pow; -function pointX(p) { - return p[0]; -} -function pointY(p) { - return p[1]; -} -// A triangulation is collinear if all its triangles have a non-null area -function collinear(d) { - const { triangles, coords } = d; - for(let i = 0; i < triangles.length; i += 3){ - const a = 2 * triangles[i], b = 2 * triangles[i + 1], c = 2 * triangles[i + 2], cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - return true; -} -function jitter(x, y, r) { - return [ - x + Math.sin(x + y) * r, - y + Math.cos(x - y) * r - ]; -} -class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points){ - this._delaunator = new (0, _delaunatorDefault.default)(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); + return { + type: TokenNumericLiteral, + value: parseFloat(number2), + start, + end: index + }; + } + function scanStringLiteral() { + var str = "", quote, start, ch2, code, octal = false; + quote = source[index]; + assert(quote === "'" || quote === '"', "String literal must starts with a quote"); + start = index; + ++index; + while (index < length$1) { + ch2 = source[index++]; + if (ch2 === quote) { + quote = ""; + break; + } else if (ch2 === "\\") { + ch2 = source[index++]; + if (!ch2 || !isLineTerminator(ch2.charCodeAt(0))) { + switch (ch2) { + case "u": + case "x": + if (source[index] === "{") { + ++index; + str += scanUnicodeCodePointEscape(); + } else { + str += scanHexEscape(ch2); + } + break; + case "n": + str += "\n"; + break; + case "r": + str += "\r"; + break; + case "t": + str += " "; + break; + case "b": + str += "\b"; + break; + case "f": + str += "\f"; + break; + case "v": + str += "\v"; + break; + default: + if (isOctalDigit(ch2)) { + code = "01234567".indexOf(ch2); + if (code !== 0) { + octal = true; + } + if (index < length$1 && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + "01234567".indexOf(source[index++]); + if ("0123".includes(ch2) && index < length$1 && isOctalDigit(source[index])) { + code = code * 8 + "01234567".indexOf(source[index++]); + } + } + str += String.fromCharCode(code); + } else { + str += ch2; + } + break; + } + } else { + if (ch2 === "\r" && source[index] === "\n") { + ++index; + } + } + } else if (isLineTerminator(ch2.charCodeAt(0))) { + break; + } else { + str += ch2; + } } - update() { - this._delaunator.update(); - this._init(); - return this; + if (quote !== "") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - _init() { - const d = this._delaunator, points = this.points; - // check for collinear - if (d.hull && d.hull.length > 2 && collinear(d)) { - this.collinear = Int32Array.from({ - length: points.length / 2 - }, (_, i)=>i).sort((i, j)=>points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds = [ - points[2 * e], - points[2 * e + 1], - points[2 * f], - points[2 * f + 1] - ], r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for(let i = 0, n = points.length / 2; i < n; ++i){ - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new (0, _delaunatorDefault.default)(points); - } else delete this.collinear; - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for(let e = 0, n = halfedges.length; e < n; ++e){ - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for(let i = 0, n = hull.length; i < n; ++i)hullIndex[hull[i]] = i; - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - inedges[hull[0]] = 1; - if (hull.length === 2) { - inedges[hull[1]] = 0; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - } + return { + type: TokenStringLiteral, + value: str, + octal, + start, + end: index + }; + } + function testRegExp(pattern, flags) { + let tmp = pattern; + if (flags.includes("u")) { + tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1) => { + if (parseInt($1, 16) <= 1114111) { + return "x"; } + throwError({}, MessageInvalidRegExp); + }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"); } - voronoi(bounds) { - return new (0, _voronoiJsDefault.default)(this, bounds); + try { + new RegExp(tmp); + } catch (e) { + throwError({}, MessageInvalidRegExp); } - *neighbors(i) { - const { inedges, hull, _hullIndex, halfedges, triangles, collinear } = this; - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } + } + function scanRegExpBody() { + var ch2, str, classMarker, terminated, body; + ch2 = source[index]; + assert(ch2 === "/", "Regular expression literal must start with a slash"); + str = source[index++]; + classMarker = false; + terminated = false; + while (index < length$1) { + ch2 = source[index++]; + str += ch2; + if (ch2 === "\\") { + ch2 = source[index++]; + if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } + str += ch2; + } else if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } else if (classMarker) { + if (ch2 === "]") { + classMarker = false; + } + } else { + if (ch2 === "/") { + terminated = true; + break; + } else if (ch2 === "[") { + classMarker = true; } - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - }while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0)i = c; - return c; - } - _step(i, x, y) { - const { inedges, hull, _hullIndex, halfedges, triangles, points } = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - }while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, halfedges, triangles } = this; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r) { - if (r === undefined && (!context || typeof context.moveTo !== "function")) r = context, context = null; - r = r == undefined ? 2 : +r; - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points } = this; - for(let i = 0, n = points.length; i < n; i += 2){ - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { hull, points } = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for(let i = 1; i < n; ++i){ - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); + } } - hullPolygon() { - const polygon = new (0, _polygonJsDefault.default); - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, triangles } = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); + if (!terminated) { + throwError({}, MessageUnterminatedRegExp); } - *trianglePolygons() { - const { triangles } = this; - for(let i = 0, n = triangles.length / 3; i < n; ++i)yield this.trianglePolygon(i); + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; + } + function scanRegExpFlags() { + var ch2, str, flags; + str = ""; + flags = ""; + while (index < length$1) { + ch2 = source[index]; + if (!isIdentifierPart(ch2.charCodeAt(0))) { + break; + } + ++index; + if (ch2 === "\\" && index < length$1) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } else { + flags += ch2; + str += ch2; + } } - trianglePolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderTriangle(i, polygon); - return polygon.value(); - } -} -exports.default = Delaunay; -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for(let i = 0; i < n; ++i){ - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points){ - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; + if (flags.search(/[^gimuy]/g) >= 0) { + throwError({}, MessageInvalidRegExp, flags); } -} - -},{"delaunator":"auyGo","./path.js":"60Yfe","./polygon.js":"5nsXD","./voronoi.js":"a33Bo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"auyGo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _robustPredicates = require("robust-predicates"); -const EPSILON = Math.pow(2, -52); -const EDGE_STACK = new Uint32Array(512); -class Delaunator { - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - for(let i = 0; i < n; i++){ - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - return new Delaunator(coords); - } - constructor(coords){ - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - this.coords = coords; - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize); // angular edge hash - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); + return { + value: flags, + literal: str + }; + } + function scanRegExp() { + var start, body, flags, value2; + lookahead = null; + skipComment(); + start = index; + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value2 = testRegExp(body.value, flags.value); + return { + literal: body.literal + flags.literal, + value: value2, + regex: { + pattern: body.value, + flags: flags.value + }, + start, + end: index + }; + } + function isIdentifierName(token) { + return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; + } + function advance() { + skipComment(); + if (index >= length$1) { + return { + type: TokenEOF, + start: index, + end: index + }; } - update() { - const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; - const n = coords.length >> 1; - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - for(let i = 0; i < n; i++){ - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - let i0, i1, i2; - // pick a seed point close to the center - for(let i = 0, minDist = Infinity; i < n; i++){ - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - // find the point closest to the seed - for(let i = 0, minDist = Infinity; i < n; i++){ - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - let minRadius = Infinity; - // find the third point which forms the smallest circumcircle with the first two - for(let i = 0; i < n; i++){ - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for(let i = 0; i < n; i++)this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for(let i = 0, d0 = -Infinity; i < n; i++){ - const id = this._ids[i]; - const d = this._dists[id]; - if (d > d0) { - hull[j++] = id; - d0 = d; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - // swap the order of the seed points for counter-clockwise orientation - if ((0, _robustPredicates.orient2d)(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - for(let i = 0; i < n; i++)this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - for(let k = 0, xp, yp; k < this._ids.length; k++){ - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue; - xp = x; - yp = y; - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - // find a visible edge on the convex hull using edge hash - let start = 0; - for(let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++){ - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - start = hullPrev[start]; - let e = start, q; - while(q = hullNext[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0){ - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while(q = hullNext[n], (0, _robustPredicates.orient2d)(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0){ - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - // walk backward from the other side, adding more triangles and flipping - if (e === start) while(q = hullPrev[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0){ - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - this.hull = new Uint32Array(hullSize); - for(let i = 0, e = this._hullStart; i < hullSize; i++){ - this.hull[i] = e; - e = hullNext[e]; - } - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - _legalize(a) { - const { _triangles: triangles, _halfedges: halfedges, coords } = this; - let i = 0; - let ar = 0; - // recursion eliminated with a fixed-size stack - while(true){ - const b = halfedges[a]; - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - if (b === -1) { - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - const illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - const hbl = halfedges[bl]; - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - }while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - const br = b0 + (b + 1) % 3; - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) EDGE_STACK[i++] = br; - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - return ar; + const ch2 = source.charCodeAt(index); + if (isIdentifierStart(ch2)) { + return scanIdentifier(); } - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; + if (ch2 === 40 || ch2 === 41 || ch2 === 59) { + return scanPunctuator(); } - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - this.trianglesLen += 3; - return t; + if (ch2 === 39 || ch2 === 34) { + return scanStringLiteral(); } -} -exports.default = Delaunator; -// monotonically increases with real angle, but doesn't need expensive trigonometry -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; -} -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - return x * x + y * y; -} -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - return { - x, - y - }; -} -function quicksort(ids, dists, left, right) { - if (right - left <= 20) for(let i = left + 1; i <= right; i++){ - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while(j >= left && dists[ids[j]] > tempDist)ids[j + 1] = ids[j--]; - ids[j + 1] = temp; + if (ch2 === 46) { + if (isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); } - else { - const median = left + right >> 1; - let i = left + 1; - let j = right; - swap(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); - const temp = ids[i]; - const tempDist = dists[temp]; - while(true){ - do i++; - while (dists[ids[i]] < tempDist); - do j--; - while (dists[ids[j]] > tempDist); - if (j < i) break; - swap(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } + if (isDecimalDigit(ch2)) { + return scanNumericLiteral(); } -} -function swap(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} - -},{"robust-predicates":"KLZHK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"KLZHK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>(0, _orient2DJs.orient2d)); -parcelHelpers.export(exports, "orient2dfast", ()=>(0, _orient2DJs.orient2dfast)); -parcelHelpers.export(exports, "orient3d", ()=>(0, _orient3DJs.orient3d)); -parcelHelpers.export(exports, "orient3dfast", ()=>(0, _orient3DJs.orient3dfast)); -parcelHelpers.export(exports, "incircle", ()=>(0, _incircleJs.incircle)); -parcelHelpers.export(exports, "incirclefast", ()=>(0, _incircleJs.incirclefast)); -parcelHelpers.export(exports, "insphere", ()=>(0, _insphereJs.insphere)); -parcelHelpers.export(exports, "inspherefast", ()=>(0, _insphereJs.inspherefast)); -var _orient2DJs = require("./esm/orient2d.js"); -var _orient3DJs = require("./esm/orient3d.js"); -var _incircleJs = require("./esm/incircle.js"); -var _insphereJs = require("./esm/insphere.js"); - -},{"./esm/orient2d.js":"9dV6v","./esm/orient3d.js":"60Ijp","./esm/incircle.js":"eSgV9","./esm/insphere.js":"lKwEh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9dV6v":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>orient2d); -parcelHelpers.export(exports, "orient2dfast", ()=>orient2dfast); -var _utilJs = require("./util.js"); -const ccwerrboundA = (3 + 16 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundB = (2 + 12 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundC = (9 + 64 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const B = (0, _utilJs.vec)(4); -const C1 = (0, _utilJs.vec)(8); -const C2 = (0, _utilJs.vec)(12); -const D = (0, _utilJs.vec)(16); -const u = (0, _utilJs.vec)(4); -function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { - let acxtail, acytail, bcxtail, bcytail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const acx = ax - cx; - const bcx = bx - cx; - const acy = ay - cy; - const bcy = by - cy; - s1 = acx * bcy; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcx; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - B[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - B[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - B[2] = _j - (u3 - bvirt) + (_i - bvirt); - B[3] = u3; - let det = (0, _utilJs.estimate)(4, B); - let errbound = ccwerrboundB * detsum; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - acx; - acxtail = ax - (acx + bvirt) + (bvirt - cx); - bvirt = bx - bcx; - bcxtail = bx - (bcx + bvirt) + (bvirt - cx); - bvirt = ay - acy; - acytail = ay - (acy + bvirt) + (bvirt - cy); - bvirt = by - bcy; - bcytail = by - (bcy + bvirt) + (bvirt - cy); - if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) return det; - errbound = ccwerrboundC * detsum + (0, _utilJs.resulterrbound) * Math.abs(det); - det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); - if (det >= errbound || -det >= errbound) return det; - s1 = acxtail * bcy; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcx; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C1len = (0, _utilJs.sum)(4, B, 4, u, C1); - s1 = acx * bcytail; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcxtail; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C2len = (0, _utilJs.sum)(C1len, C1, 4, u, C2); - s1 = acxtail * bcytail; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcxtail; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const Dlen = (0, _utilJs.sum)(C2len, C2, 4, u, D); - return D[Dlen - 1]; -} -function orient2d(ax, ay, bx, by, cx, cy) { - const detleft = (ay - cy) * (bx - cx); - const detright = (ax - cx) * (by - cy); - const det = detleft - detright; - const detsum = Math.abs(detleft + detright); - if (Math.abs(det) >= ccwerrboundA * detsum) return det; - return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); -} -function orient2dfast(ax, ay, bx, by, cx, cy) { - return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy); -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3WWl7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "splitter", ()=>splitter); -parcelHelpers.export(exports, "resulterrbound", ()=>resulterrbound); -// fast_expansion_sum_zeroelim routine from oritinal code -parcelHelpers.export(exports, "sum", ()=>sum); -parcelHelpers.export(exports, "sum_three", ()=>sum_three); -// scale_expansion_zeroelim routine from oritinal code -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "negate", ()=>negate); -parcelHelpers.export(exports, "estimate", ()=>estimate); -parcelHelpers.export(exports, "vec", ()=>vec); -const epsilon = 1.1102230246251565e-16; -const splitter = 134217729; -const resulterrbound = (3 + 8 * epsilon) * epsilon; -function sum(elen, e, flen, f, h) { - let Q, Qnew, hh, bvirt; - let enow = e[0]; - let fnow = f[0]; - let eindex = 0; - let findex = 0; - if (fnow > enow === fnow > -enow) { - Q = enow; - enow = e[++eindex]; - } else { - Q = fnow; - fnow = f[++findex]; + return scanPunctuator(); + } + function lex() { + const token = lookahead; + index = token.end; + lookahead = advance(); + index = token.end; + return token; + } + function peek() { + const pos = index; + lookahead = advance(); + index = pos; + } + function finishArrayExpression(elements) { + const node = new ASTNode(SyntaxArrayExpression); + node.elements = elements; + return node; + } + function finishBinaryExpression(operator2, left, right) { + const node = new ASTNode(operator2 === "||" || operator2 === "&&" ? SyntaxLogicalExpression : SyntaxBinaryExpression); + node.operator = operator2; + node.left = left; + node.right = right; + return node; + } + function finishCallExpression(callee, args) { + const node = new ASTNode(SyntaxCallExpression); + node.callee = callee; + node.arguments = args; + return node; + } + function finishConditionalExpression(test2, consequent, alternate) { + const node = new ASTNode(SyntaxConditionalExpression); + node.test = test2; + node.consequent = consequent; + node.alternate = alternate; + return node; + } + function finishIdentifier(name) { + const node = new ASTNode(SyntaxIdentifier); + node.name = name; + return node; + } + function finishLiteral(token) { + const node = new ASTNode(SyntaxLiteral); + node.value = token.value; + node.raw = source.slice(token.start, token.end); + if (token.regex) { + if (node.raw === "//") { + node.raw = "/(?:)/"; + } + node.regex = token.regex; + } + return node; + } + function finishMemberExpression(accessor2, object2, property2) { + const node = new ASTNode(SyntaxMemberExpression); + node.computed = accessor2 === "["; + node.object = object2; + node.property = property2; + if (!node.computed) property2.member = true; + return node; + } + function finishObjectExpression(properties) { + const node = new ASTNode(SyntaxObjectExpression); + node.properties = properties; + return node; + } + function finishProperty(kind, key2, value2) { + const node = new ASTNode(SyntaxProperty); + node.key = key2; + node.value = value2; + node.kind = kind; + return node; + } + function finishUnaryExpression(operator2, argument) { + const node = new ASTNode(SyntaxUnaryExpression); + node.operator = operator2; + node.argument = argument; + node.prefix = true; + return node; + } + function throwError(token, messageFormat) { + var error2, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index2) => { + assert(index2 < args.length, "Message reference must be in range"); + return args[index2]; + }); + error2 = new Error(msg); + error2.index = index; + error2.description = msg; + throw error2; + } + function throwUnexpected(token) { + if (token.type === TokenEOF) { + throwError(token, MessageUnexpectedEOS); } - let hindex = 0; - if (eindex < elen && findex < flen) { - if (fnow > enow === fnow > -enow) { - Qnew = enow + Q; - hh = Q - (Qnew - enow); - enow = e[++eindex]; - } else { - Qnew = fnow + Q; - hh = Q - (Qnew - fnow); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; - while(eindex < elen && findex < flen){ - if (fnow > enow === fnow > -enow) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - } else { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; - } + if (token.type === TokenNumericLiteral) { + throwError(token, MessageUnexpectedNumber); } - while(eindex < elen){ - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + if (token.type === TokenStringLiteral) { + throwError(token, MessageUnexpectedString); } - while(findex < flen){ - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + if (token.type === TokenIdentifier) { + throwError(token, MessageUnexpectedIdentifier); } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function sum_three(alen, a, blen, b, clen, c, tmp, out) { - return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out); -} -function scale(elen, e, b, h) { - let Q, sum, hh, product1, product0; - let bvirt, c, ahi, alo, bhi, blo; - c = splitter * b; - bhi = c - (c - b); - blo = b - bhi; - let enow = e[0]; - Q = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo); - let hindex = 0; - if (hh !== 0) h[hindex++] = hh; - for(let i = 1; i < elen; i++){ - enow = e[i]; - product1 = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo); - sum = Q + product0; - bvirt = sum - Q; - hh = Q - (sum - bvirt) + (product0 - bvirt); - if (hh !== 0) h[hindex++] = hh; - Q = product1 + sum; - hh = sum - (Q - product1); - if (hh !== 0) h[hindex++] = hh; - } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function negate(elen, e) { - for(let i = 0; i < elen; i++)e[i] = -e[i]; - return elen; -} -function estimate(elen, e) { - let Q = e[0]; - for(let i = 1; i < elen; i++)Q += e[i]; - return Q; -} -function vec(n) { - return new Float64Array(n); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60Ijp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient3d", ()=>orient3d); -parcelHelpers.export(exports, "orient3dfast", ()=>orient3dfast); -var _utilJs = require("./util.js"); -const o3derrboundA = (7 + 56 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundB = (3 + 28 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundC = (26 + 288 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const at_b = (0, _utilJs.vec)(4); -const at_c = (0, _utilJs.vec)(4); -const bt_c = (0, _utilJs.vec)(4); -const bt_a = (0, _utilJs.vec)(4); -const ct_a = (0, _utilJs.vec)(4); -const ct_b = (0, _utilJs.vec)(4); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const u = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(8); -const _12 = (0, _utilJs.vec)(12); -let fin = (0, _utilJs.vec)(192); -let fin2 = (0, _utilJs.vec)(192); -function finadd(finlen, alen, a) { - finlen = (0, _utilJs.sum)(finlen, fin, alen, a, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function tailinit(xtail, ytail, ax, ay, bx, by, a, b) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3, negate; - if (xtail === 0) { - if (ytail === 0) { - a[0] = 0; - b[0] = 0; - return 1; - } else { - negate = -ytail; - s1 = negate * ax; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } - } else if (ytail === 0) { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - negate = -xtail; - s1 = negate * by; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } else { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ytail * ax; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - a[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - a[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - a[2] = _j - (u3 - bvirt) + (_i - bvirt); - a[3] = u3; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = xtail * by; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - b[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - b[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - b[2] = _j - (u3 - bvirt) + (_i - bvirt); - b[3] = u3; - return 4; - } -} -function tailadd(finlen, a, b, k, z) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, u3; - s1 = a * b; - c = (0, _utilJs.splitter) * a; - ahi = c - (c - a); - alo = a - ahi; - c = (0, _utilJs.splitter) * b; - bhi = c - (c - b); - blo = b - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - c = (0, _utilJs.splitter) * k; - bhi = c - (c - k); - blo = k - bhi; - _i = s0 * k; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * k; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - if (z !== 0) { - c = (0, _utilJs.splitter) * z; - bhi = c - (c - z); - blo = z - bhi; - _i = s0 * z; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * z; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - } - return finlen; -} -function orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail; - let adytail, bdytail, cdytail; - let adztail, bdztail, cdztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)(4, bc, adz, _8), _8, (0, _utilJs.scale)(4, ca, bdz, _8b), _8b, _16), _16, (0, _utilJs.scale)(4, ab, cdz, _8), _8, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = o3derrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - bvirt = az - adz; - adztail = az - (adz + bvirt) + (bvirt - dz); - bvirt = bz - bdz; - bdztail = bz - (bdz + bvirt) + (bvirt - dz); - bvirt = cz - cdz; - cdztail = cz - (cdz + bvirt) + (bvirt - dz); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0 && adztail === 0 && bdztail === 0 && cdztail === 0) return det; - errbound = o3derrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += adz * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + adztail * (bdx * cdy - bdy * cdx) + bdz * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + bdztail * (cdx * ady - cdy * adx) + cdz * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + cdztail * (adx * bdy - ady * bdx); - if (det >= errbound || -det >= errbound) return det; - const at_len = tailinit(adxtail, adytail, bdx, bdy, cdx, cdy, at_b, at_c); - const bt_len = tailinit(bdxtail, bdytail, cdx, cdy, adx, ady, bt_c, bt_a); - const ct_len = tailinit(cdxtail, cdytail, adx, ady, bdx, bdy, ct_a, ct_b); - const bctlen = (0, _utilJs.sum)(bt_len, bt_c, ct_len, ct_b, bct); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adz, _16), _16); - const catlen = (0, _utilJs.sum)(ct_len, ct_a, at_len, at_c, cat); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdz, _16), _16); - const abtlen = (0, _utilJs.sum)(at_len, at_b, bt_len, bt_a, abt); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdz, _16), _16); - if (adztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, bc, adztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adztail, _16), _16); - } - if (bdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ca, bdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdztail, _16), _16); - } - if (cdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ab, cdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdztail, _16), _16); - } - if (adxtail !== 0) { - if (bdytail !== 0) finlen = tailadd(finlen, adxtail, bdytail, cdz, cdztail); - if (cdytail !== 0) finlen = tailadd(finlen, -adxtail, cdytail, bdz, bdztail); - } - if (bdxtail !== 0) { - if (cdytail !== 0) finlen = tailadd(finlen, bdxtail, cdytail, adz, adztail); - if (adytail !== 0) finlen = tailadd(finlen, -bdxtail, adytail, cdz, cdztail); - } - if (cdxtail !== 0) { - if (adytail !== 0) finlen = tailadd(finlen, cdxtail, adytail, bdz, bdztail); - if (bdytail !== 0) finlen = tailadd(finlen, -cdxtail, bdytail, adz, adztail); - } - return fin[finlen - 1]; -} -function orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const det = adz * (bdxcdy - cdxbdy) + bdz * (cdxady - adxcdy) + cdz * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz); - const errbound = o3derrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent); -} -function orient3dfast(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - return adx * (bdy * cdz - bdz * cdy) + bdx * (cdy * adz - cdz * ady) + cdx * (ady * bdz - adz * bdy); -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eSgV9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "incircle", ()=>incircle); -parcelHelpers.export(exports, "incirclefast", ()=>incirclefast); -var _utilJs = require("./util.js"); -const iccerrboundA = (10 + 96 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundB = (4 + 48 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundC = (44 + 576 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const aa = (0, _utilJs.vec)(4); -const bb = (0, _utilJs.vec)(4); -const cc = (0, _utilJs.vec)(4); -const u = (0, _utilJs.vec)(4); -const v = (0, _utilJs.vec)(4); -const axtbc = (0, _utilJs.vec)(8); -const aytbc = (0, _utilJs.vec)(8); -const bxtca = (0, _utilJs.vec)(8); -const bytca = (0, _utilJs.vec)(8); -const cxtab = (0, _utilJs.vec)(8); -const cytab = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abtt = (0, _utilJs.vec)(4); -const bctt = (0, _utilJs.vec)(4); -const catt = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _16b = (0, _utilJs.vec)(16); -const _16c = (0, _utilJs.vec)(16); -const _32 = (0, _utilJs.vec)(32); -const _32b = (0, _utilJs.vec)(32); -const _48 = (0, _utilJs.vec)(48); -const _64 = (0, _utilJs.vec)(64); -let fin = (0, _utilJs.vec)(1152); -let fin2 = (0, _utilJs.vec)(1152); -function finadd(finlen, a, alen) { - finlen = (0, _utilJs.sum)(finlen, fin, a, alen, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail; - let axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen; - let abtlen, bctlen, catlen; - let abttlen, bcttlen, cattlen; - let n1, n0; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, bc, adx, _8), _8, adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bc, ady, _8), _8, ady, _16b), _16b, _32), _32, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdx, _8), _8, bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdy, _8), _8, bdy, _16b), _16b, _32b), _32b, _64), _64, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdx, _8), _8, cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdy, _8), _8, cdy, _16b), _16b, _32), _32, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = iccerrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0) return det; - errbound = iccerrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += (adx * adx + ady * ady) * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + 2 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx) + ((bdx * bdx + bdy * bdy) * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + 2 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) + ((cdx * cdx + cdy * cdy) * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + 2 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx)); - if (det >= errbound || -det >= errbound) return det; - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = adx * adx; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = ady * ady; - c = (0, _utilJs.splitter) * ady; - ahi = c - (c - ady); - alo = ady - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - aa[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - aa[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - aa[2] = _j - (u3 - bvirt) + (_i - bvirt); - aa[3] = u3; - } - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = bdx * bdx; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = bdy * bdy; - c = (0, _utilJs.splitter) * bdy; - ahi = c - (c - bdy); - alo = bdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - bb[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - bb[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - bb[2] = _j - (u3 - bvirt) + (_i - bvirt); - bb[3] = u3; - } - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = cdx * cdx; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = cdy * cdy; - c = (0, _utilJs.splitter) * cdy; - ahi = c - (c - cdy); - alo = cdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - cc[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - cc[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - cc[2] = _j - (u3 - bvirt) + (_i - bvirt); - cc[3] = u3; - } - if (adxtail !== 0) { - axtbclen = (0, _utilJs.scale)(4, bc, adxtail, axtbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(axtbclen, axtbc, 2 * adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adxtail, _8), _8, -cdy, _16c), _16c, _32, _48), _48); - } - if (adytail !== 0) { - aytbclen = (0, _utilJs.scale)(4, bc, adytail, aytbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(aytbclen, aytbc, 2 * ady, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adytail, _8), _8, cdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adytail, _8), _8, -bdx, _16c), _16c, _32, _48), _48); - } - if (bdxtail !== 0) { - bxtcalen = (0, _utilJs.scale)(4, ca, bdxtail, bxtca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bxtcalen, bxtca, 2 * bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdxtail, _8), _8, -ady, _16c), _16c, _32, _48), _48); - } - if (bdytail !== 0) { - bytcalen = (0, _utilJs.scale)(4, ca, bdytail, bytca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bytcalen, bytca, 2 * bdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdytail, _8), _8, adx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdytail, _8), _8, -cdx, _16c), _16c, _32, _48), _48); - } - if (cdxtail !== 0) { - cxtablen = (0, _utilJs.scale)(4, ab, cdxtail, cxtab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cxtablen, cxtab, 2 * cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, ady, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdxtail, _8), _8, -bdy, _16c), _16c, _32, _48), _48); - } - if (cdytail !== 0) { - cytablen = (0, _utilJs.scale)(4, ab, cdytail, cytab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cytablen, cytab, 2 * cdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdytail, _8), _8, bdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdytail, _8), _8, -adx, _16c), _16c, _32, _48), _48); - } - if (adxtail !== 0 || adytail !== 0) { - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = bdxtail * cdy; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * cdytail; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - s1 = cdxtail * -bdy; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * -bdy; - bhi = c - (c - -bdy); - blo = -bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * -bdytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * -bdytail; - bhi = c - (c - -bdytail); - blo = -bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - bctlen = (0, _utilJs.sum)(4, u, 4, v, bct); - s1 = bdxtail * cdytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdxtail * bdytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bctt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bctt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bctt[2] = _j - (u3 - bvirt) + (_i - bvirt); - bctt[3] = u3; - bcttlen = 4; - } else { - bct[0] = 0; - bctlen = 1; - bctt[0] = 0; - bcttlen = 1; - } - if (adxtail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(axtbclen, axtbc, adxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * adx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * adx, _16), _16, (0, _utilJs.scale)(len2, _8, adxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adxtail, _32), _32, _32b, _64), _64); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdytail, _16), _16); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, -adxtail, _8), _8, cdytail, _16), _16); - } - if (adytail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(aytbclen, aytbc, adytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * ady, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * ady, _16), _16, (0, _utilJs.scale)(len2, _8, adytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adytail, _32), _32, _32b, _64), _64); - } - } - if (bdxtail !== 0 || bdytail !== 0) { - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = cdxtail * ady; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * adytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -cdy; - n0 = -cdytail; - s1 = adxtail * n1; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * n0; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - catlen = (0, _utilJs.sum)(4, u, 4, v, cat); - s1 = cdxtail * adytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adxtail * cdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - catt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - catt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - catt[2] = _j - (u3 - bvirt) + (_i - bvirt); - catt[3] = u3; - cattlen = 4; - } else { - cat[0] = 0; - catlen = 1; - catt[0] = 0; - cattlen = 1; - } - if (bdxtail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bxtcalen, bxtca, bdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdx, _16), _16, (0, _utilJs.scale)(len2, _8, bdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdxtail, _32), _32, _32b, _64), _64); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdytail, _16), _16); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, -bdxtail, _8), _8, adytail, _16), _16); - } - if (bdytail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bytcalen, bytca, bdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdy, _16), _16, (0, _utilJs.scale)(len2, _8, bdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdytail, _32), _32, _32b, _64), _64); - } - } - if (cdxtail !== 0 || cdytail !== 0) { - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = adxtail * bdy; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * bdytail; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -ady; - n0 = -adytail; - s1 = bdxtail * n1; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * n0; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - abtlen = (0, _utilJs.sum)(4, u, 4, v, abt); - s1 = adxtail * bdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdxtail * adytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - abtt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - abtt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - abtt[2] = _j - (u3 - bvirt) + (_i - bvirt); - abtt[3] = u3; - abttlen = 4; - } else { - abt[0] = 0; - abtlen = 1; - abtt[0] = 0; - abttlen = 1; - } - if (cdxtail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cxtablen, cxtab, cdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdx, _16), _16, (0, _utilJs.scale)(len2, _8, cdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdxtail, _32), _32, _32b, _64), _64); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, adytail, _16), _16); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, -cdxtail, _8), _8, bdytail, _16), _16); - } - if (cdytail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cytablen, cytab, cdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdy, _16), _16, (0, _utilJs.scale)(len2, _8, cdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdytail, _32), _32, _32b, _64), _64); - } - } - return fin[finlen - 1]; -} -function incircle(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const alift = adx * adx + ady * ady; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const blift = bdx * bdx + bdy * bdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const clift = cdx * cdx + cdy * cdy; - const det = alift * (bdxcdy - cdxbdy) + blift * (cdxady - adxcdy) + clift * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * alift + (Math.abs(cdxady) + Math.abs(adxcdy)) * blift + (Math.abs(adxbdy) + Math.abs(bdxady)) * clift; - const errbound = iccerrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent); -} -function incirclefast(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const ady = ay - dy; - const bdx = bx - dx; - const bdy = by - dy; - const cdx = cx - dx; - const cdy = cy - dy; - const abdet = adx * bdy - bdx * ady; - const bcdet = bdx * cdy - cdx * bdy; - const cadet = cdx * ady - adx * cdy; - const alift = adx * adx + ady * ady; - const blift = bdx * bdx + bdy * bdy; - const clift = cdx * cdx + cdy * cdy; - return alift * bcdet + blift * cadet + clift * abdet; -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lKwEh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "insphere", ()=>insphere); -parcelHelpers.export(exports, "inspherefast", ()=>inspherefast); -var _utilJs = require("./util.js"); -const isperrboundA = (16 + 224 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundB = (5 + 72 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundC = (71 + 1408 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const ab = (0, _utilJs.vec)(4); -const bc = (0, _utilJs.vec)(4); -const cd = (0, _utilJs.vec)(4); -const de = (0, _utilJs.vec)(4); -const ea = (0, _utilJs.vec)(4); -const ac = (0, _utilJs.vec)(4); -const bd = (0, _utilJs.vec)(4); -const ce = (0, _utilJs.vec)(4); -const da = (0, _utilJs.vec)(4); -const eb = (0, _utilJs.vec)(4); -const abc = (0, _utilJs.vec)(24); -const bcd = (0, _utilJs.vec)(24); -const cde = (0, _utilJs.vec)(24); -const dea = (0, _utilJs.vec)(24); -const eab = (0, _utilJs.vec)(24); -const abd = (0, _utilJs.vec)(24); -const bce = (0, _utilJs.vec)(24); -const cda = (0, _utilJs.vec)(24); -const deb = (0, _utilJs.vec)(24); -const eac = (0, _utilJs.vec)(24); -const adet = (0, _utilJs.vec)(1152); -const bdet = (0, _utilJs.vec)(1152); -const cdet = (0, _utilJs.vec)(1152); -const ddet = (0, _utilJs.vec)(1152); -const edet = (0, _utilJs.vec)(1152); -const abdet = (0, _utilJs.vec)(2304); -const cddet = (0, _utilJs.vec)(2304); -const cdedet = (0, _utilJs.vec)(3456); -const deter = (0, _utilJs.vec)(5760); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _8c = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _24 = (0, _utilJs.vec)(24); -const _48 = (0, _utilJs.vec)(48); -const _48b = (0, _utilJs.vec)(48); -const _96 = (0, _utilJs.vec)(96); -const _192 = (0, _utilJs.vec)(192); -const _384x = (0, _utilJs.vec)(384); -const _384y = (0, _utilJs.vec)(384); -const _384z = (0, _utilJs.vec)(384); -const _768 = (0, _utilJs.vec)(768); -function sum_three_scale(a, b, c, az, bz, cz, out) { - return (0, _utilJs.sum_three)((0, _utilJs.scale)(4, a, az, _8), _8, (0, _utilJs.scale)(4, b, bz, _8b), _8b, (0, _utilJs.scale)(4, c, cz, _8c), _8c, _16, out); -} -function liftexact(alen, a, blen, b, clen, c, dlen, d, x, y, z, out) { - const len = (0, _utilJs.sum)((0, _utilJs.sum)(alen, a, blen, b, _48), _48, (0, _utilJs.negate)((0, _utilJs.sum)(clen, c, dlen, d, _48b), _48b), _48b, _96); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _96, x, _192), _192, x, _384x), _384x, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, y, _192), _192, y, _384y), _384y, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, z, _192), _192, z, _384z), _384z, _768, out); -} -function insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - s1 = ax * by; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ay; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - s1 = bx * cy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * by; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cx * dy; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * cy; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - cd[2] = _j - (u3 - bvirt) + (_i - bvirt); - cd[3] = u3; - s1 = dx * ey; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * dy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - de[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - de[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - de[2] = _j - (u3 - bvirt) + (_i - bvirt); - de[3] = u3; - s1 = ex * ay; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * ey; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ea[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ea[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ea[2] = _j - (u3 - bvirt) + (_i - bvirt); - ea[3] = u3; - s1 = ax * cy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * ay; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ac[2] = _j - (u3 - bvirt) + (_i - bvirt); - ac[3] = u3; - s1 = bx * dy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * by; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bd[2] = _j - (u3 - bvirt) + (_i - bvirt); - bd[3] = u3; - s1 = cx * ey; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * cy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ce[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ce[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ce[2] = _j - (u3 - bvirt) + (_i - bvirt); - ce[3] = u3; - s1 = dx * ay; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * dy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - da[2] = _j - (u3 - bvirt) + (_i - bvirt); - da[3] = u3; - s1 = ex * by; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ey; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - eb[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - eb[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - eb[2] = _j - (u3 - bvirt) + (_i - bvirt); - eb[3] = u3; - const abclen = sum_three_scale(ab, bc, ac, cz, az, -bz, abc); - const bcdlen = sum_three_scale(bc, cd, bd, dz, bz, -cz, bcd); - const cdelen = sum_three_scale(cd, de, ce, ez, cz, -dz, cde); - const dealen = sum_three_scale(de, ea, da, az, dz, -ez, dea); - const eablen = sum_three_scale(ea, ab, eb, bz, ez, -az, eab); - const abdlen = sum_three_scale(ab, bd, da, dz, az, bz, abd); - const bcelen = sum_three_scale(bc, ce, eb, ez, bz, cz, bce); - const cdalen = sum_three_scale(cd, da, ac, az, cz, dz, cda); - const deblen = sum_three_scale(de, eb, bd, bz, dz, ez, deb); - const eaclen = sum_three_scale(ea, ac, ce, cz, ez, az, eac); - const deterlen = (0, _utilJs.sum_three)(liftexact(cdelen, cde, bcelen, bce, deblen, deb, bcdlen, bcd, ax, ay, az, adet), adet, liftexact(dealen, dea, cdalen, cda, eaclen, eac, cdelen, cde, bx, by, bz, bdet), bdet, (0, _utilJs.sum_three)(liftexact(eablen, eab, deblen, deb, abdlen, abd, dealen, dea, cx, cy, cz, cdet), cdet, liftexact(abclen, abc, eaclen, eac, bcelen, bce, eablen, eab, dx, dy, dz, ddet), ddet, liftexact(bcdlen, bcd, abdlen, abd, cdalen, cda, abclen, abc, ex, ey, ez, edet), edet, cddet, cdedet), cdedet, abdet, deter); - return deter[deterlen - 1]; -} -const xdet = (0, _utilJs.vec)(96); -const ydet = (0, _utilJs.vec)(96); -const zdet = (0, _utilJs.vec)(96); -const fin = (0, _utilJs.vec)(1152); -function liftadapt(a, b, c, az, bz, cz, x, y, z, out) { - const len = sum_three_scale(a, b, c, az, bz, cz, _24); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _24, x, _48), _48, x, xdet), xdet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, y, _48), _48, y, ydet), ydet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, z, _48), _48, z, zdet), zdet, _192, out); -} -function insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent) { - let ab3, bc3, cd3, da3, ac3, bd3; - let aextail, bextail, cextail, dextail; - let aeytail, beytail, ceytail, deytail; - let aeztail, beztail, ceztail, deztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0; - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - s1 = aex * bey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bex * aey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - ab3 = _j + _i; - bvirt = ab3 - _j; - ab[2] = _j - (ab3 - bvirt) + (_i - bvirt); - ab[3] = ab3; - s1 = bex * cey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * bey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - bc3 = _j + _i; - bvirt = bc3 - _j; - bc[2] = _j - (bc3 - bvirt) + (_i - bvirt); - bc[3] = bc3; - s1 = cex * dey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * cey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - cd3 = _j + _i; - bvirt = cd3 - _j; - cd[2] = _j - (cd3 - bvirt) + (_i - bvirt); - cd[3] = cd3; - s1 = dex * aey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = aex * dey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - da3 = _j + _i; - bvirt = da3 - _j; - da[2] = _j - (da3 - bvirt) + (_i - bvirt); - da[3] = da3; - s1 = aex * cey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * aey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - ac3 = _j + _i; - bvirt = ac3 - _j; - ac[2] = _j - (ac3 - bvirt) + (_i - bvirt); - ac[3] = ac3; - s1 = bex * dey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * bey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - bd3 = _j + _i; - bvirt = bd3 - _j; - bd[2] = _j - (bd3 - bvirt) + (_i - bvirt); - bd[3] = bd3; - const finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(bc, cd, bd, dez, bez, -cez, aex, aey, aez, adet), adet), adet, liftadapt(cd, da, ac, aez, cez, dez, bex, bey, bez, bdet), bdet, abdet), abdet, (0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(da, ab, bd, bez, dez, aez, cex, cey, cez, cdet), cdet), cdet, liftadapt(ab, bc, ac, cez, aez, -bez, dex, dey, dez, ddet), ddet, cddet), cddet, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = isperrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - aex; - aextail = ax - (aex + bvirt) + (bvirt - ex); - bvirt = ay - aey; - aeytail = ay - (aey + bvirt) + (bvirt - ey); - bvirt = az - aez; - aeztail = az - (aez + bvirt) + (bvirt - ez); - bvirt = bx - bex; - bextail = bx - (bex + bvirt) + (bvirt - ex); - bvirt = by - bey; - beytail = by - (bey + bvirt) + (bvirt - ey); - bvirt = bz - bez; - beztail = bz - (bez + bvirt) + (bvirt - ez); - bvirt = cx - cex; - cextail = cx - (cex + bvirt) + (bvirt - ex); - bvirt = cy - cey; - ceytail = cy - (cey + bvirt) + (bvirt - ey); - bvirt = cz - cez; - ceztail = cz - (cez + bvirt) + (bvirt - ez); - bvirt = dx - dex; - dextail = dx - (dex + bvirt) + (bvirt - ex); - bvirt = dy - dey; - deytail = dy - (dey + bvirt) + (bvirt - ey); - bvirt = dz - dez; - deztail = dz - (dez + bvirt) + (bvirt - ez); - if (aextail === 0 && aeytail === 0 && aeztail === 0 && bextail === 0 && beytail === 0 && beztail === 0 && cextail === 0 && ceytail === 0 && ceztail === 0 && dextail === 0 && deytail === 0 && deztail === 0) return det; - errbound = isperrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - const abeps = aex * beytail + bey * aextail - (aey * bextail + bex * aeytail); - const bceps = bex * ceytail + cey * bextail - (bey * cextail + cex * beytail); - const cdeps = cex * deytail + dey * cextail - (cey * dextail + dex * ceytail); - const daeps = dex * aeytail + aey * dextail - (dey * aextail + aex * deytail); - const aceps = aex * ceytail + cey * aextail - (aey * cextail + cex * aeytail); - const bdeps = bex * deytail + dey * bextail - (bey * dextail + dex * beytail); - det += (bex * bex + bey * bey + bez * bez) * (cez * daeps + dez * aceps + aez * cdeps + (ceztail * da3 + deztail * ac3 + aeztail * cd3)) + (dex * dex + dey * dey + dez * dez) * (aez * bceps - bez * aceps + cez * abeps + (aeztail * bc3 - beztail * ac3 + ceztail * ab3)) - ((aex * aex + aey * aey + aez * aez) * (bez * cdeps - cez * bdeps + dez * bceps + (beztail * cd3 - ceztail * bd3 + deztail * bc3)) + (cex * cex + cey * cey + cez * cez) * (dez * abeps + aez * bdeps + bez * daeps + (deztail * ab3 + aeztail * bd3 + beztail * da3))) + 2 * ((bex * bextail + bey * beytail + bez * beztail) * (cez * da3 + dez * ac3 + aez * cd3) + (dex * dextail + dey * deytail + dez * deztail) * (aez * bc3 - bez * ac3 + cez * ab3) - ((aex * aextail + aey * aeytail + aez * aeztail) * (bez * cd3 - cez * bd3 + dez * bc3) + (cex * cextail + cey * ceytail + cez * ceztail) * (dez * ab3 + aez * bd3 + bez * da3))); - if (det >= errbound || -det >= errbound) return det; - return insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez); -} -function insphere(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - const aexbey = aex * bey; - const bexaey = bex * aey; - const ab = aexbey - bexaey; - const bexcey = bex * cey; - const cexbey = cex * bey; - const bc = bexcey - cexbey; - const cexdey = cex * dey; - const dexcey = dex * cey; - const cd = cexdey - dexcey; - const dexaey = dex * aey; - const aexdey = aex * dey; - const da = dexaey - aexdey; - const aexcey = aex * cey; - const cexaey = cex * aey; - const ac = aexcey - cexaey; - const bexdey = bex * dey; - const dexbey = dex * bey; - const bd = bexdey - dexbey; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - const det = clift * (dez * ab + aez * bd + bez * da) - dlift * (aez * bc - bez * ac + cez * ab) + (alift * (bez * cd - cez * bd + dez * bc) - blift * (cez * da + dez * ac + aez * cd)); - const aezplus = Math.abs(aez); - const bezplus = Math.abs(bez); - const cezplus = Math.abs(cez); - const dezplus = Math.abs(dez); - const aexbeyplus = Math.abs(aexbey) + Math.abs(bexaey); - const bexceyplus = Math.abs(bexcey) + Math.abs(cexbey); - const cexdeyplus = Math.abs(cexdey) + Math.abs(dexcey); - const dexaeyplus = Math.abs(dexaey) + Math.abs(aexdey); - const aexceyplus = Math.abs(aexcey) + Math.abs(cexaey); - const bexdeyplus = Math.abs(bexdey) + Math.abs(dexbey); - const permanent = (cexdeyplus * bezplus + bexdeyplus * cezplus + bexceyplus * dezplus) * alift + (dexaeyplus * cezplus + aexceyplus * dezplus + cexdeyplus * aezplus) * blift + (aexbeyplus * dezplus + bexdeyplus * aezplus + dexaeyplus * bezplus) * clift + (bexceyplus * aezplus + aexceyplus * bezplus + aexbeyplus * cezplus) * dlift; - const errbound = isperrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return -insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent); -} -function inspherefast(pax, pay, paz, pbx, pby, pbz, pcx, pcy, pcz, pdx, pdy, pdz, pex, pey, pez) { - const aex = pax - pex; - const bex = pbx - pex; - const cex = pcx - pex; - const dex = pdx - pex; - const aey = pay - pey; - const bey = pby - pey; - const cey = pcy - pey; - const dey = pdy - pey; - const aez = paz - pez; - const bez = pbz - pez; - const cez = pcz - pez; - const dez = pdz - pez; - const ab = aex * bey - bex * aey; - const bc = bex * cey - cex * bey; - const cd = cex * dey - dex * cey; - const da = dex * aey - aex * dey; - const ac = aex * cey - cex * aey; - const bd = bex * dey - dex * bey; - const abc = aez * bc - bez * ac + cez * ab; - const bcd = bez * cd - cez * bd + dez * bc; - const cda = cez * da + dez * ac + aez * cd; - const dab = dez * ab + aez * bd + bez * da; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - return clift * dab - dlift * abc + (alift * bcd - blift * cda); -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60Yfe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -const epsilon = 1e-6; -class Path { - constructor(){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; + if (token.type === TokenKeyword) { + throwError(token, MessageUnexpectedReserved); } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; + throwError(token, MessageUnexpectedToken, token.value); + } + function expect(value2) { + const token = lex(); + if (token.type !== TokenPunctuator || token.value !== value2) { + throwUnexpected(token); + } + } + function match(value2) { + return lookahead.type === TokenPunctuator && lookahead.value === value2; + } + function matchKeyword(keyword) { + return lookahead.type === TokenKeyword && lookahead.value === keyword; + } + function parseArrayInitialiser() { + const elements = []; + index = lookahead.start; + expect("["); + while (!match("]")) { + if (match(",")) { + lex(); + elements.push(null); + } else { + elements.push(parseConditionalExpression()); + if (!match("]")) { + expect(","); } + } } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; + lex(); + return finishArrayExpression(elements); + } + function parseObjectPropertyKey() { + index = lookahead.start; + const token = lex(); + if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { + if (token.octal) { + throwError(token, MessageStrictOctalLiteral); + } + return finishLiteral(token); } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; + return finishIdentifier(token.value); + } + function parseObjectProperty() { + var token, key2, id2, value2; + index = lookahead.start; + token = lookahead; + if (token.type === TokenIdentifier) { + id2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", id2, value2); } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; + if (token.type === TokenEOF || token.type === TokenPunctuator) { + throwUnexpected(token); + } else { + key2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", key2, value2); } - value() { - return this._ || null; - } -} -exports.default = Path; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5nsXD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -class Polygon { - constructor(){ - this._ = []; - } - moveTo(x, y) { - this._.push([ - x, - y - ]); + } + function parseObjectInitialiser() { + var properties = [], property2, name, key2, map2 = {}, toString2 = String; + index = lookahead.start; + expect("{"); + while (!match("}")) { + property2 = parseObjectProperty(); + if (property2.key.type === SyntaxIdentifier) { + name = property2.key.name; + } else { + name = toString2(property2.key.value); + } + key2 = "$" + name; + if (Object.prototype.hasOwnProperty.call(map2, key2)) { + throwError({}, MessageStrictDuplicateProperty); + } else { + map2[key2] = true; + } + properties.push(property2); + if (!match("}")) { + expect(","); + } } - closePath() { - this._.push(this._[0].slice()); + expect("}"); + return finishObjectExpression(properties); + } + function parseGroupExpression() { + expect("("); + const expr2 = parseExpression(); + expect(")"); + return expr2; + } + const legalKeywords = { + "if": 1 + }; + function parsePrimaryExpression() { + var type2, token, expr2; + if (match("(")) { + return parseGroupExpression(); } - lineTo(x, y) { - this._.push([ - x, - y - ]); + if (match("[")) { + return parseArrayInitialiser(); } - value() { - return this._.length ? this._ : null; - } -} -exports.default = Polygon; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a33Bo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [ - 0, - 0, - 960, - 500 - ]){ - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); + if (match("{")) { + return parseObjectInitialiser(); + } + type2 = lookahead.type; + index = lookahead.start; + if (type2 === TokenIdentifier || legalKeywords[lookahead.value]) { + expr2 = finishIdentifier(lex().value); + } else if (type2 === TokenStringLiteral || type2 === TokenNumericLiteral) { + if (lookahead.octal) { + throwError(lookahead, MessageStrictOctalLiteral); + } + expr2 = finishLiteral(lex()); + } else if (type2 === TokenKeyword) { + throw new Error(DISABLED); + } else if (type2 === TokenBooleanLiteral) { + token = lex(); + token.value = token.value === "true"; + expr2 = finishLiteral(token); + } else if (type2 === TokenNullLiteral) { + token = lex(); + token.value = null; + expr2 = finishLiteral(token); + } else if (match("/") || match("/=")) { + expr2 = finishLiteral(scanRegExp()); + peek(); + } else { + throwUnexpected(lex()); + } + return expr2; + } + function parseArguments() { + const args = []; + expect("("); + if (!match(")")) { + while (index < length$1) { + args.push(parseConditionalExpression()); + if (match(")")) { + break; + } + expect(","); + } } - update() { - this.delaunay.update(); - this._init(); - return this; + expect(")"); + return args; + } + function parseNonComputedProperty() { + index = lookahead.start; + const token = lex(); + if (!isIdentifierName(token)) { + throwUnexpected(token); } - _init() { - const { delaunay: { points, hull, triangles }, vectors } = this; - let bx, by; // lazily computed barycenter of the hull - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for(let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2){ - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const ab = (dx * ey - dy * ex) * 2; - if (Math.abs(ab) < 1e-9) { - // For a degenerate triangle, the circumcenter is at the infinity, in a - // direction orthogonal to the halfedge and away from the “center” of - // the diagram <bx, by>, defined as the hull’s barycenter. - if (bx === undefined) { - bx = by = 0; - for (const i of hull)bx += points[i * 2], by += points[i * 2 + 1]; - bx /= hull.length, by /= hull.length; - } - const a = 1e9 * Math.sign((bx - x1) * ey - (by - y1) * ex); - x = (x1 + x3) / 2 - a * ey; - y = (y1 + y3) / 2 + a * ex; - } else { - const d = 1 / ab; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for(let i = 0; i < hull.length; ++i){ - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; - if (hull.length <= 1) return null; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for(let i = 0; i < hull.length; ++i){ - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while(points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1)n -= 2; - for(let i = 2; i < n; i += 2)if (points[i] !== points[i - 2] || points[i + 1] !== points[i - 1]) context.lineTo(points[i], points[i + 1]); - context.closePath(); - return buffer && buffer.value(); + return finishIdentifier(token.value); + } + function parseNonComputedMember() { + expect("."); + return parseNonComputedProperty(); + } + function parseComputedMember() { + expect("["); + const expr2 = parseExpression(); + expect("]"); + return expr2; + } + function parseLeftHandSideExpressionAllowCall() { + var expr2, args, property2; + expr2 = parsePrimaryExpression(); + for (; ; ) { + if (match(".")) { + property2 = parseNonComputedMember(); + expr2 = finishMemberExpression(".", expr2, property2); + } else if (match("(")) { + args = parseArguments(); + expr2 = finishCallExpression(expr2, args); + } else if (match("[")) { + property2 = parseComputedMember(); + expr2 = finishMemberExpression("[", expr2, property2); + } else { + break; + } } - *cellPolygons() { - const { delaunay: { points } } = this; - for(let i = 0, n = points.length / 2; i < n; ++i){ - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; - } + return expr2; + } + function parsePostfixExpression() { + const expr2 = parseLeftHandSideExpressionAllowCall(); + if (lookahead.type === TokenPunctuator) { + if (match("++") || match("--")) { + throw new Error(DISABLED); + } } - cellPolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } + return expr2; + } + function parseUnaryExpression() { + var token, expr2; + if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { + expr2 = parsePostfixExpression(); + } else if (match("++") || match("--")) { + throw new Error(DISABLED); + } else if (match("+") || match("-") || match("~") || match("!")) { + token = lex(); + expr2 = parseUnaryExpression(); + expr2 = finishUnaryExpression(token.value, expr2); + } else if (matchKeyword("delete") || matchKeyword("void") || matchKeyword("typeof")) { + throw new Error(DISABLED); + } else { + expr2 = parsePostfixExpression(); } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; + return expr2; + } + function binaryPrecedence(token) { + let prec = 0; + if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { + return 0; } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)){ - const cj = this._clip(j); - // find the common edge - if (cj) loop: for(let ai = 0, li = ci.length; ai < li; ai += 2){ - for(let aj = 0, lj = cj.length; aj < lj; aj += 2)if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { - yield j; - break loop; - } - } - } + switch (token.value) { + case "||": + prec = 1; + break; + case "&&": + prec = 2; + break; + case "|": + prec = 3; + break; + case "^": + prec = 4; + break; + case "&": + prec = 5; + break; + case "==": + case "!=": + case "===": + case "!==": + prec = 6; + break; + case "<": + case ">": + case "<=": + case ">=": + case "instanceof": + case "in": + prec = 7; + break; + case "<<": + case ">>": + case ">>>": + prec = 8; + break; + case "+": + case "-": + prec = 9; + break; + case "*": + case "/": + case "%": + prec = 11; + break; } - _cell(i) { - const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - }while (e !== e0 && e !== -1); - return points; + return prec; + } + function parseBinaryExpression() { + var marker, markers, expr2, token, prec, stack, right, operator2, left, i; + marker = lookahead; + left = parseUnaryExpression(); + token = lookahead; + prec = binaryPrecedence(token); + if (prec === 0) { + return left; } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - const points = this._cell(i); - if (points === null) return null; - const { vectors: V } = this; - const v = i * 4; - return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points)); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1 = 0; - for(let j = 0; j < n; j += 2){ - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [ - x1, - y1 - ]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [ - sx0, - sy0 - ]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [ - sx1, - sy1 - ]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - // for more robustness, always consider the segment in the same order - const flip = c0 < c1; - if (flip) [x0, y0, x1, y1, c0, c1] = [ - x1, - y1, - x0, - y0, - c1, - c0 - ]; - while(true){ - if (c0 === 0 && c1 === 0) return flip ? [ - x1, - y1, - x0, - y0 - ] : [ - x0, - y0, - x1, - y1 - ]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 8) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 4) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 2) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) for(let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2){ - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) P = [ - this.xmin, - this.ymin, - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax - ]; - return P; + token.prec = prec; + lex(); + markers = [marker, lookahead]; + right = parseUnaryExpression(); + stack = [left, token, right]; + while ((prec = binaryPrecedence(lookahead)) > 0) { + while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { + right = stack.pop(); + operator2 = stack.pop().value; + left = stack.pop(); + markers.pop(); + expr2 = finishBinaryExpression(operator2, left, right); + stack.push(expr2); + } + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(lookahead); + expr2 = parseUnaryExpression(); + stack.push(expr2); } - _edge(i, e0, e1, P, j) { - while(e0 !== e1){ - let x, y; - switch(e0){ - case 5: - e0 = 4; - continue; // top-left - case 4: - e0 = 6, x = this.xmax, y = this.ymin; - break; // top - case 6: - e0 = 2; - continue; // top-right - case 2: - e0 = 10, x = this.xmax, y = this.ymax; - break; // right - case 10: - e0 = 8; - continue; // bottom-right - case 8: - e0 = 9, x = this.xmin, y = this.ymax; - break; // bottom - case 9: - e0 = 1; - continue; // bottom-left - case 1: - e0 = 5, x = this.xmin, y = this.ymin; - break; // left - } - // Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are - // undefined, the conditional statement will be executed. - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) P.splice(j, 0, x, y), j += 2; - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - return [ - x, - y - ]; - } - _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); - } - _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); + i = stack.length - 1; + expr2 = stack[i]; + markers.pop(); + while (i > 1) { + markers.pop(); + expr2 = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr2); + i -= 2; } - _simplify(P) { - if (P && P.length > 4) { - for(let i = 0; i < P.length; i += 2){ - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) P.splice(j, 2), i -= 2; - } - if (!P.length) P = null; - } - return P; - } -} -exports.default = Voronoi; - -},{"./path.js":"60Yfe","./polygon.js":"5nsXD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Z7Aq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "wordcloud", ()=>Wordcloud); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _vegaScale = require("vega-scale"); -var _vegaStatistics = require("vega-statistics"); -/* -Copyright (c) 2013, Jason Davies. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * The name Jason Davies may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ // Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ -// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf -var cloudRadians = Math.PI / 180, cw = 64, ch = 2048; -function cloud() { - var size = [ - 256, - 256 - ], text, font, fontSize, fontStyle, fontWeight, rotate, padding, spiral = archimedeanSpiral, words = [], random = Math.random, cloud = {}; - cloud.layout = function() { - var contextAndRatio = getContext((0, _vegaCanvas.canvas)()), board = zeroArray((size[0] >> 5) * size[1]), bounds = null, n = words.length, i = -1, tags = [], data = words.map((d)=>({ - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - })).sort((a, b)=>b.size - a.size); - while(++i < n){ - var d = data[i]; - d.x = size[0] * (random() + .5) >> 1; - d.y = size[1] * (random() + .5) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [ - { - x: d.x + d.x0, - y: d.y + d.y0 - }, - { - x: d.x + d.x1, - y: d.y + d.y1 - } - ]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - return tags; - }; - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - return { - context: context, - ratio: ratio - }; + return expr2; + } + function parseConditionalExpression() { + var expr2, consequent, alternate; + expr2 = parseBinaryExpression(); + if (match("?")) { + lex(); + consequent = parseConditionalExpression(); + expect(":"); + alternate = parseConditionalExpression(); + expr2 = finishConditionalExpression(expr2, consequent, alternate); + } + return expr2; + } + function parseExpression() { + const expr2 = parseConditionalExpression(); + if (match(",")) { + throw new Error(DISABLED); } - function place(board, tag, bounds) { - var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size[0], size[1]), s = spiral(size), dt = random() < .5 ? 1 : -1, t = -dt, dxdy, dx, dy; - while(dxdy = s(t += dt)){ - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - tag.x = startX + dx; - tag.y = startY + dy; - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, w = tag.width >> 5, sw = size[0] >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++)board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; + return expr2; + } + function parser$1(code) { + source = code; + index = 0; + length$1 = source.length; + lookahead = null; + peek(); + const expr2 = parseExpression(); + if (lookahead.type !== TokenEOF) { + throw new Error("Unexpect token after expression."); } - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else return words; - }; - cloud.size = function(_) { - if (arguments.length) { - size = [ - +_[0], - +_[1] - ]; - return cloud; - } else return size; - }; - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else return font; - }; - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else return fontStyle; - }; - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else return fontWeight; - }; - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else return rotate; - }; - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else return text; - }; - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else return spiral; - }; - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else return fontSize; - }; - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else return padding; - }; - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else return random; - }; - return cloud; -} -// Fetches a monochrome sprite bitmap for the specified text. -// Load in batches for speed. -function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, ratio = contextAndRatio.ratio; - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, y = 0, maxh = 0, n = data.length, w, w32, h, i, j; - --di; - while(++di < n){ - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), cr = Math.cos(d.rotate * cloudRadians), wcr = w * cr, wsr = w * sr, hcr = h * cr, hsr = h * sr; - w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else w = w + 0x1f >> 5 << 5; - if (h > maxh) maxh = h; - if (x + w >= cw << 5) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; - while(--di >= 0){ - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for(i = 0; i < h * w32; i++)sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, seenRow = -1; - for(j = 0; j < h; j++){ - for(i = 0; i < w; i++){ - var k = w32 * j + (i >> 5), m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); + return expr2; + } + var Constants$1 = { + NaN: "NaN", + E: "Math.E", + LN2: "Math.LN2", + LN10: "Math.LN10", + LOG2E: "Math.LOG2E", + LOG10E: "Math.LOG10E", + PI: "Math.PI", + SQRT1_2: "Math.SQRT1_2", + SQRT2: "Math.SQRT2", + MIN_VALUE: "Number.MIN_VALUE", + MAX_VALUE: "Number.MAX_VALUE" + }; + function Functions(codegen2) { + function fncall(name, args, cast, type2) { + let obj2 = codegen2(args[0]); + if (cast) { + obj2 = cast + "(" + obj2 + ")"; + if (cast.lastIndexOf("new ", 0) === 0) obj2 = "(" + obj2 + ")"; + } + return obj2 + "." + name + (type2 < 0 ? "" : type2 === 0 ? "()" : "(" + args.slice(1).map(codegen2).join(",") + ")"); } -} -// Use mask-based collision detection. -function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, w = tag.width >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++){ - if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true; - } - x += sw; + function fn2(name, cast, type2) { + return (args) => fncall(name, args, cast, type2); } - return false; -} -function cloudBounds(bounds, d) { - var b0 = bounds[0], b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; -} -function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; -} -function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [ - e * (t *= .1) * Math.cos(t), - t * Math.sin(t) - ]; - }; -} -function rectangularSpiral(size) { - var dy = 4, dx = dy * size[0] / size[1], x = 0, y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch(Math.sqrt(1 + 4 * sign * t) - sign & 3){ - case 0: - x += dx; - break; - case 1: - y += dy; - break; - case 2: - x -= dx; - break; - default: - y -= dy; - break; - } - return [ - x, - y - ]; - }; -} -// TODO reuse arrays? -function zeroArray(n) { - var a = [], i = -1; - while(++i < n)a[i] = 0; - return a; -} -function functor(d) { - return typeof d === 'function' ? d : function() { - return d; - }; -} -var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral -}; -const Output = [ - 'x', - 'y', - 'font', - 'fontSize', - 'fontStyle', - 'fontWeight', - 'angle' -]; -const Params = [ - 'text', - 'font', - 'rotate', - 'fontSize', - 'fontStyle', - 'fontWeight' -]; -function Wordcloud(params) { - (0, _vegaDataflow.Transform).call(this, cloud(), params); -} -Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'font', - 'type': 'string', - 'expr': true, - 'default': 'sans-serif' - }, - { - 'name': 'fontStyle', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontWeight', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontSize', - 'type': 'number', - 'expr': true, - 'default': 14 - }, - { - 'name': 'fontSizeRange', - 'type': 'number', - 'array': 'nullable', - 'default': [ - 10, - 50 - ] - }, - { - 'name': 'rotate', - 'type': 'number', - 'expr': true, - 'default': 0 - }, - { - 'name': 'text', - 'type': 'field' - }, - { - 'name': 'spiral', - 'type': 'string', - 'values': [ - 'archimedean', - 'rectangular' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 7, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Wordcloud, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) (0, _vegaUtil.error)('Wordcloud size dimensions must be non-zero.'); - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return; - const data = pulse.materialize(pulse.SOURCE).source, layout = this.value, as = _.as || Output; - let fontSize = _.fontSize || 14, range; - (0, _vegaUtil.isFunction)(fontSize) ? range = _.fontSizeRange : fontSize = (0, _vegaUtil.constant)(fontSize); - // create font size scaling function as needed - if (range) { - const fsize = fontSize, sizeScale = (0, _vegaScale.scale)('sqrt')().domain((0, _vegaUtil.extent)(data, fsize)).range(range); - fontSize = (x)=>sizeScale(fsize(x)); - } - data.forEach((t)=>{ - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - // configure layout - const words = layout.words(data).text(_.text).size(_.size || [ - 500, - 500 - ]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random((0, _vegaStatistics.random)).layout(); - const size = layout.size(), dx = size[0] >> 1, dy = size[1] >> 1, n = words.length; - for(let i = 0, w, t; i < n; ++i){ - w = words[i]; - t = w.datum; - t[as[0]] = w.x + dx; - t[as[1]] = w.y + dy; - t[as[2]] = w.font; - t[as[3]] = w.size; - t[as[4]] = w.style; - t[as[5]] = w.weight; - t[as[6]] = w.rotate; - } - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-canvas":"kPWfS","vega-dataflow":"3NitK","vega-util":"bApja","vega-scale":"bEydG","vega-statistics":"5ncfv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8iEZv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "crossfilter", ()=>CrossFilter); -parcelHelpers.export(exports, "resolvefilter", ()=>ResolveFilter); -var _d3Array = require("d3-array"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -const array8 = (n)=>new Uint8Array(n); -const array16 = (n)=>new Uint16Array(n); -const array32 = (n)=>new Uint32Array(n); -/** - * Maintains CrossFilter state. - */ function Bitmaps() { - let width = 8, data = [], seen = array32(0), curr = array(0, width), prev = array(0, width); + const DATE2 = "new Date", STRING = "String", REGEXP = "RegExp"; return { - data: ()=>data, - seen: ()=>seen = lengthen(seen, data.length), - add (array) { - for(let i = 0, j = data.length, n = array.length, t; i < n; ++i){ - t = array[i]; - t._index = j++; - data.push(t); - } - }, - remove (num, map) { - // map: index -> boolean (true => remove) - const n = data.length, copy = Array(n - num), reindex = data; // reuse old data array for index map - let t, i, j; - // seek forward to first removal - for(i = 0; !map[i] && i < n; ++i){ - copy[i] = data[i]; - reindex[i] = i; - } - // condense arrays - for(j = i; i < n; ++i){ - t = data[i]; - if (!map[i]) { - reindex[i] = j; - curr[j] = curr[i]; - prev[j] = prev[i]; - copy[j] = t; - t._index = j++; - } else reindex[i] = -1; - curr[i] = 0; // clear unused bits - } - data = copy; - return reindex; - }, - size: ()=>data.length, - curr: ()=>curr, - prev: ()=>prev, - reset: (k)=>prev[k] = curr[k], - all: ()=>width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff, - set (k, one) { - curr[k] |= one; - }, - clear (k, one) { - curr[k] &= ~one; - }, - resize (n, m) { - const k = curr.length; - if (n > k || m > width) { - width = Math.max(m, width); - curr = array(n, width, curr); - prev = array(n, width); - } - } + // MATH functions + isNaN: "Number.isNaN", + isFinite: "Number.isFinite", + abs: "Math.abs", + acos: "Math.acos", + asin: "Math.asin", + atan: "Math.atan", + atan2: "Math.atan2", + ceil: "Math.ceil", + cos: "Math.cos", + exp: "Math.exp", + floor: "Math.floor", + hypot: "Math.hypot", + log: "Math.log", + max: "Math.max", + min: "Math.min", + pow: "Math.pow", + random: "Math.random", + round: "Math.round", + sin: "Math.sin", + sqrt: "Math.sqrt", + tan: "Math.tan", + clamp: function(args) { + if (args.length < 3) error("Missing arguments to clamp function."); + if (args.length > 3) error("Too many arguments to clamp function."); + const a2 = args.map(codegen2); + return "Math.max(" + a2[1] + ", Math.min(" + a2[2] + "," + a2[0] + "))"; + }, + // DATE functions + now: "Date.now", + utc: "Date.UTC", + datetime: DATE2, + date: fn2("getDate", DATE2, 0), + day: fn2("getDay", DATE2, 0), + year: fn2("getFullYear", DATE2, 0), + month: fn2("getMonth", DATE2, 0), + hours: fn2("getHours", DATE2, 0), + minutes: fn2("getMinutes", DATE2, 0), + seconds: fn2("getSeconds", DATE2, 0), + milliseconds: fn2("getMilliseconds", DATE2, 0), + time: fn2("getTime", DATE2, 0), + timezoneoffset: fn2("getTimezoneOffset", DATE2, 0), + utcdate: fn2("getUTCDate", DATE2, 0), + utcday: fn2("getUTCDay", DATE2, 0), + utcyear: fn2("getUTCFullYear", DATE2, 0), + utcmonth: fn2("getUTCMonth", DATE2, 0), + utchours: fn2("getUTCHours", DATE2, 0), + utcminutes: fn2("getUTCMinutes", DATE2, 0), + utcseconds: fn2("getUTCSeconds", DATE2, 0), + utcmilliseconds: fn2("getUTCMilliseconds", DATE2, 0), + // sequence functions + length: fn2("length", null, -1), + // STRING functions + parseFloat: "parseFloat", + parseInt: "parseInt", + upper: fn2("toUpperCase", STRING, 0), + lower: fn2("toLowerCase", STRING, 0), + substring: fn2("substring", STRING), + split: fn2("split", STRING), + trim: fn2("trim", STRING, 0), + // base64 encode/decode + btoa: "btoa", + atob: "atob", + // REGEXP functions + regexp: REGEXP, + test: fn2("test", REGEXP), + // Control Flow functions + if: function(args) { + if (args.length < 3) error("Missing arguments to if function."); + if (args.length > 3) error("Too many arguments to if function."); + const a2 = args.map(codegen2); + return "(" + a2[0] + "?" + a2[1] + ":" + a2[2] + ")"; + } }; -} -function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; -} -function array(n, m, array) { - const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; -} -function Dimension(index, i, query) { - const bit = 1 << i; - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - onAdd (added, curr) { - const dim = this, range = dim.bisect(dim.range, added.value), idx = added.index, lo = range[0], hi = range[1], n1 = idx.length; - let i; - for(i = 0; i < lo; ++i)curr[idx[i]] |= bit; - for(i = hi; i < n1; ++i)curr[idx[i]] |= bit; - return dim; - } - }; -} -/** - * Maintains a list of values, sorted by key. - */ function SortedIndex() { - let index = array32(0), value = [], size = 0; - function insert(key, data, base) { - if (!data.length) return []; - const n0 = size, n1 = data.length, addi = array32(n1); - let addv = Array(n1), oldv, oldi, i; - for(i = 0; i < n1; ++i){ - addv[i] = key(data[i]); - addi[i] = i; - } - addv = sort(addv, addi); - if (n0) { - oldv = value; - oldi = index; - value = Array(n0 + n1); - index = array32(n0 + n1); - merge(base, oldv, oldi, n0, addv, addi, n1, value, index); - } else { - if (base > 0) for(i = 0; i < n1; ++i)addi[i] += base; - value = addv; - index = addi; - } - size = n0 + n1; - return { - index: addi, - value: addv - }; - } - function remove(num, map) { - // map: index -> remove - const n = size; - let idx, i, j; - // seek forward to first removal - for(i = 0; !map[index[i]] && i < n; ++i); - // condense index and value arrays - for(j = i; i < n; ++i)if (!map[idx = index[i]]) { - index[j] = idx; - value[j] = value[i]; - ++j; - } - size = n - num; - } - function reindex(map) { - for(let i = 0, n = size; i < n; ++i)index[i] = map[index[i]]; - } - function bisect(range, array) { - let n; - if (array) n = array.length; - else { - array = value; - n = size; - } - return [ - (0, _d3Array.bisectLeft)(array, range[0], 0, n), - (0, _d3Array.bisectRight)(array, range[1], 0, n) - ]; + } + function stripQuotes(s) { + const n = s && s.length - 1; + return n && (s[0] === '"' && s[n] === '"' || s[0] === "'" && s[n] === "'") ? s.slice(1, -1) : s; + } + function codegen(opt) { + opt = opt || {}; + const allowed = opt.allowed ? toSet(opt.allowed) : {}, forbidden = opt.forbidden ? toSet(opt.forbidden) : {}, constants2 = opt.constants || Constants$1, functions = (opt.functions || Functions)(visit2), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = isFunction(globalvar) ? globalvar : (id2) => `${globalvar}["${id2}"]`; + /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + let globals = {}, fields = {}, memberDepth = 0; + function visit2(ast) { + if (isString(ast)) return ast; + const generator = Generators[ast.type]; + if (generator == null) error("Unsupported type: " + ast.type); + return generator(ast); } - return { - insert: insert, - remove: remove, - bisect: bisect, - reindex: reindex, - index: ()=>index, - size: ()=>size - }; -} -function sort(values, index) { - values.sort.call(index, (a, b)=>{ - const x = values[a], y = values[b]; - return x < y ? -1 : x > y ? 1 : 0; - }); - return (0, _d3Array.permute)(values, index); -} -function merge(base, value0, index0, n0, value1, index1, n1, value, index) { - let i0 = 0, i1 = 0, i; - for(i = 0; i0 < n0 && i1 < n1; ++i)if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - for(; i0 < n0; ++i0, ++i){ - value[i] = value0[i0]; - index[i] = index0[i0]; - } - for(; i1 < n1; ++i1, ++i){ - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } -} -/** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ function CrossFilter(params) { - (0, _vegaDataflow.Transform).call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; -} -CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'query', - 'type': 'array', - 'array': true, - 'required': true, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - } - ] -}; -(0, _vegaUtil.inherits)(CrossFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!this._dims) return this.init(_, pulse); - else { - var init = _.modified('fields') || _.fields.some((f)=>pulse.modified(f.fields)); - return init ? this.reinit(_, pulse) : this.eval(_, pulse); - } - }, - init (_, pulse) { - const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m = query.length; - let i = 0, key, index; - // instantiate indices and dimensions - for(; i < m; ++i){ - key = fields[i].fname; - index = indices[key] || (indices[key] = SortedIndex()); - dims.push(Dimension(index, i, query[i])); - } - return this.eval(_, pulse); - }, - reinit (_, pulse) { - const output = pulse.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output.rem = output.add, mod = output.mod, m = query.length, adds = {}; - let add, index, key, mods, remMap, modMap, i, n, f; - // set prev to current state - prev.set(curr); - // if pulse has remove tuples, process them first - if (pulse.rem.length) remMap = this.remove(_, pulse, output); - // if pulse has added tuples, add them to state - if (pulse.add.length) bits.add(pulse.add); - // if pulse has modified tuples, create an index map - if (pulse.mod.length) { - modMap = {}; - for(mods = pulse.mod, i = 0, n = mods.length; i < n; ++i)modMap[mods[i]._index] = 1; - } - // re-initialize indices as needed, update curr bitmap - for(i = 0; i < m; ++i){ - f = fields[i]; - if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) { - key = f.fname; - if (!(add = adds[key])) { - indices[key] = index = SortedIndex(); - adds[key] = add = index.insert(f, pulse.source, 0); - } - dims[i] = Dimension(index, i, query[i]).onAdd(add, curr); - } - } - // visit each tuple - // if filter state changed, push index to add/rem - // else if in mod and passes a filter, push index to mod - for(i = 0, n = bits.data().length; i < n; ++i){ - if (remMap[i]) continue; - else if (prev[i] !== curr[i]) // add if state changed - out.push(i); - else if (modMap[i] && curr[i] !== all) // otherwise, pass mods through - mod.push(i); - } - bits.mask = (1 << m) - 1; - return output; - }, - eval (_, pulse) { - const output = pulse.materialize().fork(), m = this._dims.length; - let mask = 0; - if (pulse.rem.length) { - this.remove(_, pulse, output); - mask |= (1 << m) - 1; - } - if (_.modified('query') && !_.modified('fields')) mask |= this.update(_, pulse, output); - if (pulse.add.length) { - this.insert(_, pulse, output); - mask |= (1 << m) - 1; - } - if (pulse.mod.length) { - this.modify(pulse, output); - mask |= (1 << m) - 1; - } - this.value.mask = mask; - return output; - }, - insert (_, pulse, output) { - const tuples = pulse.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output.add, n = bits.size() + tuples.length, m = dims.length; - let k = bits.size(), j, key, add; - // resize bitmaps and add tuples as needed - bits.resize(n, m); - bits.add(tuples); - const curr = bits.curr(), prev = bits.prev(), all = bits.all(); - // add to dimensional indices - for(j = 0; j < m; ++j){ - key = fields[j].fname; - add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k)); - dims[j].onAdd(add, curr); - } - // set previous filters, output if passes at least one filter - for(; k < n; ++k){ - prev[k] = all; - if (curr[k] !== all) out.push(k); - } - }, - modify (pulse, output) { - const out = output.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse.mod; - let i, n, k; - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - if (curr[k] !== all) out.push(k); - } - }, - remove (_, pulse, output) { - const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map = {}, out = output.rem, tuples = pulse.rem; - let i, n, k, f; - // process tuples, output if passes at least one filter - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - map[k] = 1; // build index map - prev[k] = f = curr[k]; - curr[k] = all; - if (f !== all) out.push(k); - } - // remove from dimensional indices - for(k in indices)indices[k].remove(n, map); - this.reindex(pulse, n, map); - return map; - }, - // reindex filters and indices after propagation completes - reindex (pulse, num, map) { - const indices = this._indices, bits = this.value; - pulse.runAfter(()=>{ - const indexMap = bits.remove(num, map); - for(const key in indices)indices[key].reindex(indexMap); - }); - }, - update (_, pulse, output) { - const dims = this._dims, query = _.query, stamp = pulse.stamp, m = dims.length; - let mask = 0, i, q; - // survey how many queries have changed - output.filters = 0; - for(q = 0; q < m; ++q)if (_.modified('query', q)) { - i = q; - ++mask; - } - if (mask === 1) { - // only one query changed, use more efficient update - mask = dims[i].one; - this.incrementOne(dims[i], query[i], output.add, output.rem); - } else // multiple queries changed, perform full record keeping - for(q = 0, mask = 0; q < m; ++q){ - if (!_.modified('query', q)) continue; - mask |= dims[q].one; - this.incrementAll(dims[q], query[q], stamp, output.add); - output.rem = output.add; // duplicate add/rem for downstream resolve - } - return mask; - }, - incrementAll (dim, query, stamp, out) { - const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - dim.range = query.slice(); - }, - incrementOne (dim, query, add, rem) { - const bits = this.value, curr = bits.curr(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - dim.range = query.slice(); - } -}); -/** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ function ResolveFilter(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'ignore', - 'type': 'number', - 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' - }, - { - 'name': 'filter', - 'type': 'object', - 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' - } - ] -}; -(0, _vegaUtil.inherits)(ResolveFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, mask = bitmap.mask; - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - const output = pulse.fork(pulse.ALL), data = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k)=>!(curr[k] & ignore) ? data[k] : null; - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - if (!(mask & mask - 1)) { - // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, (k)=>(curr[k] & ignore) === mask ? data[k] : null); + const Generators = { + Literal: (n) => n.raw, + Identifier: (n) => { + const id2 = n.name; + if (memberDepth > 0) { + return id2; + } else if (has$1(forbidden, id2)) { + return error("Illegal identifier: " + id2); + } else if (has$1(constants2, id2)) { + return constants2[id2]; + } else if (has$1(allowed, id2)) { + return id2; } else { - // multiple filters changed - output.filter(output.ADD, (k)=>{ - const c = curr[k] & ignore, f = !c && c ^ prev[k] & ignore; - return f ? data[k] : null; - }); - output.filter(output.REM, (k)=>{ - const c = curr[k] & ignore, f = c && !(c ^ (c ^ prev[k] & ignore)); - return f ? data[k] : null; - }); - } - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, (t)=>pass(t._index)); - } -}); - -},{"d3-array":"6IwJG","vega-dataflow":"3NitK","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cGC2i":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "View", ()=>View); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _d3Array = require("d3-array"); -var _vegaFunctions = require("vega-functions"); -var _vegaRuntime = require("vega-runtime"); -var _d3Timer = require("d3-timer"); -var _vegaFormat = require("vega-format"); -// initialize aria role and label attributes -function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } -} -// update aria-label if we have a DOM container element -function ariaLabel(el, desc) { - if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc); -} -function background(view) { - // respond to background signal - view.add(null, (_)=>{ - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { - bg: view._signals.background - }); -} -const Default = 'default'; -function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - // evaluate cursor on each pointermove event - view.on(view.events('view', 'pointermove'), cursor, (_, event)=>{ - const value = cursor.value, user = value ? (0, _vegaUtil.isString)(value) ? value : value.user : Default, item = event.item && event.item.cursor || null; - return value && user === value.user && item == value.item ? value : { - user: user, - item: item - }; - }); - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, item = this.value; - if (!(0, _vegaUtil.isString)(user)) { - item = user.item; - user = user.user; - } - setCursor(view, user && user !== Default ? user : item || user); - return item; - }, { - cursor: cursor - }); -} -function setCursor(view, cursor) { - const el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container(); - if (el) return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor; -} -function dataref(view, name) { - var data = view._runtime.data; - if (!(0, _vegaUtil.hasOwnProperty)(data, name)) (0, _vegaUtil.error)('Unrecognized data set: ' + name); - return data[name]; -} -function data(name, values) { - return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, (0, _vegaDataflow.changeset)().remove((0, _vegaUtil.truthy)).insert(values)); -} -function change(name, changes) { - if (!(0, _vegaDataflow.isChangeSet)(changes)) (0, _vegaUtil.error)('Second argument to changes must be a changeset.'); - const dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); -} -function insert(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().insert(_)); -} -function remove(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().remove(_)); -} -function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); -} -function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); -} -function offset(view) { - var padding = view.padding(), origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; -} -function resizeRenderer(view) { - var origin = offset(view), w = width(view), h = height(view); - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - view._resizeListeners.forEach((handler)=>{ - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); -} -/** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ function eventExtend(view, event, item) { - var r = view._renderer, el = r && r.canvas(), p, e, translate; - if (el) { - translate = offset(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = (0, _vegaScenegraph.point)(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; -} -function extension(view, item, point) { - const itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null; - function group(name) { - var g = itemGroup, i; - if (name) { - for(i = item; i; i = i.mark.group)if (i.mark.name === name) { - g = i; - break; - } + globals[id2] = 1; + return outputGlobal(id2); } - return g && g.mark && g.mark.interactive ? g : {}; - } - function xy(item) { - if (!item) return point; - if ((0, _vegaUtil.isString)(item)) item = group(item); - const p = point.slice(); - while(item){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; + }, + MemberExpression: (n) => { + const d = !n.computed, o = visit2(n.object); + if (d) memberDepth += 1; + const p = visit2(n.property); + if (o === fieldvar) { + fields[stripQuotes(p)] = 1; + } + if (d) memberDepth -= 1; + return o + (d ? "." + p : "[" + p + "]"); + }, + CallExpression: (n) => { + if (n.callee.type !== "Identifier") { + error("Illegal callee type: " + n.callee.type); } - return p; - } - return { - view: (0, _vegaUtil.constant)(view), - item: (0, _vegaUtil.constant)(item || {}), - group: group, - xy: xy, - x: (item)=>xy(item)[0], - y: (item)=>xy(item)[1] - }; -} -const VIEW = 'view', TIMER = 'timer', WINDOW = 'window', NO_TRAP = { - trap: false -}; -/** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ function initializeEventConfig(config) { - const events = (0, _vegaUtil.extend)({ - defaults: {} - }, config); - const unpack = (obj, keys)=>{ - keys.forEach((k)=>{ - if ((0, _vegaUtil.isArray)(obj[k])) obj[k] = (0, _vegaUtil.toSet)(obj[k]); - }); + const callee = n.callee.name, args = n.arguments, fn2 = has$1(functions, callee) && functions[callee]; + if (!fn2) error("Unrecognized function: " + callee); + return isFunction(fn2) ? fn2(args) : fn2 + "(" + args.map(visit2).join(",") + ")"; + }, + ArrayExpression: (n) => "[" + n.elements.map(visit2).join(",") + "]", + BinaryExpression: (n) => "(" + visit2(n.left) + " " + n.operator + " " + visit2(n.right) + ")", + UnaryExpression: (n) => "(" + n.operator + visit2(n.argument) + ")", + ConditionalExpression: (n) => "(" + visit2(n.test) + "?" + visit2(n.consequent) + ":" + visit2(n.alternate) + ")", + LogicalExpression: (n) => "(" + visit2(n.left) + n.operator + visit2(n.right) + ")", + ObjectExpression: (n) => { + for (const prop of n.properties) { + const keyName = prop.key.name; + if (DisallowedObjectProperties.has(keyName)) { + error("Illegal property: " + keyName); + } + } + return "{" + n.properties.map(visit2).join(",") + "}"; + }, + Property: (n) => { + memberDepth += 1; + const k = visit2(n.key); + memberDepth -= 1; + return k + ":" + visit2(n.value); + } }; - unpack(events.defaults, [ - 'prevent', - 'allow' - ]); - unpack(events, [ - 'view', - 'window', - 'selector' - ]); - return events; -} -function trackEventListener(view, sources, type, handler) { - view._eventListeners.push({ - type: type, - sources: (0, _vegaUtil.array)(sources), - handler: handler - }); -} -function prevent(view, type) { - var def = view._eventConfig.defaults, prevent = def.prevent, allow = def.allow; - return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault(); -} -function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - if (rule === false || (0, _vegaUtil.isObject)(rule) && !rule[type]) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; + function codegen2(ast) { + const result = { + code: visit2(ast), + globals: Object.keys(globals), + fields: Object.keys(fields) + }; + globals = {}; + fields = {}; + return result; + } + codegen2.functions = functions; + codegen2.constants = constants2; + return codegen2; + } + const SELECTION_GETTER = Symbol("vega_selection_getter"); + function getter(f) { + if (!f.getter || !f.getter[SELECTION_GETTER]) { + f.getter = field$1(f.field); + f.getter[SELECTION_GETTER] = true; } - return true; -} -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ function events(source, type, filter) { - var view = this, s = new (0, _vegaDataflow.EventStream)(filter), send = function(e, item) { - view.runAsync(null, ()=>{ - if (source === VIEW && prevent(view, type)) e.preventDefault(); - s.receive(eventExtend(view, e, item)); - }); - }, sources; - if (source === TIMER) { - if (permit(view, 'timer', type)) view.timer(send, type); - } else if (source === VIEW) { - if (permit(view, 'view', type)) // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') sources = [ - window - ]; - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) sources = Array.from(document.querySelectorAll(source)); - } - if (!sources) view.warn('Can not resolve event source: ' + source); - else { - for(var i = 0, n = sources.length; i < n; ++i)sources[i].addEventListener(type, send); - trackEventListener(view, sources, type, send); + return f.getter; + } + const Intersect = "intersect"; + const Union = "union"; + const VlMulti = "vlMulti"; + const VlPoint = "vlPoint"; + const Or = "or"; + const And = "and"; + const SelectionId = "_vgsid_"; + const $selectionId = field$1(SelectionId); + const TYPE_ENUM = "E", TYPE_RANGE_INC = "R", TYPE_RANGE_EXC = "R-E", TYPE_RANGE_LE = "R-LE", TYPE_RANGE_RE = "R-RE", TYPE_PRED_LT = "E-LT", TYPE_PRED_LTE = "E-LTE", TYPE_PRED_GT = "E-GT", TYPE_PRED_GTE = "E-GTE", TYPE_PRED_VALID = "E-VALID", TYPE_PRED_ONE_OF = "E-ONE", UNIT_INDEX = "index:unit"; + function testPoint(datum2, entry2) { + var fields = entry2.fields, values2 = entry2.values, n = fields.length, i = 0, dval, f; + for (; i < n; ++i) { + f = fields[i]; + dval = getter(f)(datum2); + if (isDate$1(dval)) dval = toNumber(dval); + if (isDate$1(values2[i])) values2[i] = toNumber(values2[i]); + if (isArray(values2[i]) && isDate$1(values2[i][0])) values2[i] = values2[i].map(toNumber); + if (f.type === TYPE_ENUM) { + if (isArray(values2[i]) ? !values2[i].includes(dval) : dval !== values2[i]) { + return false; + } + } else { + if (f.type === TYPE_RANGE_INC) { + if (!inrange(dval, values2[i])) return false; + } else if (f.type === TYPE_RANGE_RE) { + if (!inrange(dval, values2[i], true, false)) return false; + } else if (f.type === TYPE_RANGE_EXC) { + if (!inrange(dval, values2[i], false, false)) return false; + } else if (f.type === TYPE_RANGE_LE) { + if (!inrange(dval, values2[i], false, true)) return false; + } else if (f.type === TYPE_PRED_LT) { + if (dval >= values2[i]) return false; + } else if (f.type === TYPE_PRED_LTE) { + if (dval > values2[i]) return false; + } else if (f.type === TYPE_PRED_GT) { + if (dval <= values2[i]) return false; + } else if (f.type === TYPE_PRED_GTE) { + if (dval < values2[i]) return false; + } else if (f.type === TYPE_PRED_VALID) { + if (dval === null || isNaN(dval)) return false; + } else if (f.type === TYPE_PRED_ONE_OF) { + if (values2[i].indexOf(dval) === -1) return false; } + } } - return s; -} -function itemFilter(event) { - return event.item; -} -function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; -} -function invoke(name) { - return function(_, event) { - return event.vega.view().changeset().encode(event.item, name); - }; -} -function hover(hoverSet, leaveSet) { - hoverSet = [ - hoverSet || 'hover' - ]; - leaveSet = [ - leaveSet || 'update', - hoverSet[0] - ]; - // invoke hover set upon pointerover - this.on(this.events('view', 'pointerover', itemFilter), markTarget, invoke(hoverSet)); - // invoke leave set upon pointerout - this.on(this.events('view', 'pointerout', itemFilter), markTarget, invoke(leaveSet)); - return this; -} -/** - * Finalize a View instance that is being removed. - * Cancel any running timers. - * Remove all external event listeners. - * Remove any currently displayed tooltip. - */ function finalize() { - var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m, e, h, t; - n = timers.length; - while(--n >= 0)timers[n].stop(); - n = listeners.length; - while(--n >= 0){ - e = listeners[n]; - m = e.sources.length; - while(--m >= 0)e.sources[m].removeEventListener(e.type, e.handler); - } - if (tooltip) tooltip.call(this, this._handler, null, null, null); - // turn off all registered handlers - n = handlers.length; - while(--n >= 0){ - t = handlers[n].type; - h = handlers[n].handler; - this._handler.off(t, h); + return true; + } + function selectionTest(name, datum2, op) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, n = entries.length, i = 0, entry2, miss, count2, unit2, b2; + for (; i < n; ++i) { + entry2 = entries[i]; + if (unitIdx && intersect2) { + miss = miss || {}; + count2 = miss[unit2 = entry2.unit] || 0; + if (count2 === -1) continue; + b2 = testPoint(datum2, entry2); + miss[unit2] = b2 ? -1 : ++count2; + if (b2 && unitIdx.size === 1) return true; + if (!b2 && count2 === unitIdx.get(unit2).count) return false; + } else { + b2 = testPoint(datum2, entry2); + if (intersect2 ^ b2) return b2; + } } - return this; -} -function element(tag, attr, text) { - const el = document.createElement(tag); - for(const key in attr)el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; -} -const BindClass = 'vega-bind', NameClass = 'vega-bind-name', RadioClass = 'vega-bind-radio'; -/** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ function bind(view, el, binding) { - if (!el) return; - const param = binding.param; - let bind = binding.state; - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: (value)=>{ - if (value != view.signal(param.signal)) view.runAsync(null, ()=>{ - bind.source = true; - view.signal(param.signal, value); - }); - } - }; - if (param.debounce) bind.update = (0, _vegaUtil.debounce)(param.debounce, bind.update); + return n && intersect2; + } + const bisect = bisector($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; + function selectionIdTest(name, datum2, op) { + const data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, value2 = $selectionId(datum2), index2 = bisectLeft(entries, value2); + if (index2 === entries.length) return false; + if ($selectionId(entries[index2]) !== value2) return false; + if (unitIdx && intersect2) { + if (unitIdx.size === 1) return true; + if (bisectRight(entries, value2) - index2 < unitIdx.size) return false; } - const create = param.input == null && param.element ? target : generate; - create(bind, el, param, view); - if (!bind.active) { - view.on(view._signals[param.signal], null, ()=>{ - bind.source ? bind.source = false : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - return bind; -} -/** - * Bind the signal to an external EventTarget. - */ function target(bind, node, param, view) { - const type = param.event || 'input'; - const handler = ()=>bind.update(node.value); - // initialize signal value to external input value - view.signal(param.signal, node.value); - // listen for changes on the element - node.addEventListener(type, handler); - // register with view, so we can remove it upon finalization - trackEventListener(view, node, type, handler); - // propagate change to element - bind.set = (value)=>{ - node.value = value; - node.dispatchEvent(event(type)); - }; -} -function event(type) { - return typeof Event !== 'undefined' ? new Event(type) : { - type - }; -} -/** - * Generate an HTML input form element and bind it to a signal. - */ function generate(bind, el, param, view) { - const value = view.signal(param.signal); - const div = element('div', { - 'class': BindClass - }); - const wrapper = param.input === 'radio' ? div : div.appendChild(element('label')); - wrapper.appendChild(element('span', { - 'class': NameClass - }, param.name || param.signal)); - el.appendChild(div); - let input = form; - switch(param.input){ - case 'checkbox': - input = checkbox; - break; - case 'select': - input = select; - break; - case 'radio': - input = radio; - break; - case 'range': - input = range; - break; + return true; + } + function selectionTuples(array2, base2) { + if (!isArray(array2)) { + error("First argument to selectionTuples must be an array."); } - input(bind, wrapper, param, value); -} -/** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ function form(bind, el, param, value) { - const node = element('input'); - for(const key in param)if (key !== 'signal' && key !== 'element') node.setAttribute(key === 'input' ? 'type' : key, param[key]); - node.setAttribute('name', param.signal); - node.value = value; - el.appendChild(node); - node.addEventListener('input', ()=>bind.update(node.value)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.value = value; -} -/** - * Generates a checkbox input element. - */ function checkbox(bind, el, param, value) { - const attr = { - type: 'checkbox', - name: param.signal - }; - if (value) attr.checked = true; - const node = element('input', attr); - el.appendChild(node); - node.addEventListener('change', ()=>bind.update(node.checked)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.checked = !!value || null; -} -/** - * Generates a selection list input element. - */ function select(bind, el, param, value) { - const node = element('select', { - name: param.signal - }), labels = param.labels || []; - param.options.forEach((option, i)=>{ - const attr = { - value: option - }; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element('option', attr, (labels[i] || option) + '')); - }); - el.appendChild(node); - node.addEventListener('change', ()=>{ - bind.update(param.options[node.selectedIndex]); - }); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - for(let i = 0, n = param.options.length; i < n; ++i)if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; - return; - } - }; -} -/** - * Generates a radio button group. - */ function radio(bind, el, param, value) { - const group = element('span', { - 'class': RadioClass - }), labels = param.labels || []; - el.appendChild(group); - bind.elements = param.options.map((option, i)=>{ - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - const input = element('input', attr); - input.addEventListener('change', ()=>bind.update(option)); - const label = element('label', {}, (labels[i] || option) + ''); - label.prepend(input); - group.appendChild(label); - return input; - }); - bind.set = (value)=>{ - const nodes = bind.elements, n = nodes.length; - for(let i = 0; i < n; ++i)if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - }; -} -/** - * Generates a slider input element. - */ function range(bind, el, param, value) { - value = value !== undefined ? value : (+param.max + +param.min) / 2; - const max = param.max != null ? param.max : Math.max(100, +value) || 100, min = param.min || Math.min(0, max, +value) || 0, step = param.step || (0, _d3Array.tickStep)(min, max, 100); - const node = element('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - const span = element('span', {}, +value); - el.appendChild(node); - el.appendChild(span); - const update = ()=>{ - span.textContent = node.value; - bind.update(+node.value); - }; - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - node.value = value; - span.textContent = value; - }; -} -function valuesEqual(a, b) { - return a === b || a + '' === b + ''; -} -function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); -} -function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; -} -function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); - // transfer event handlers - if (prevHandler) prevHandler.handlers().forEach((h)=>{ - handler.on(h.type, h.handler); - }); - return handler; -} -function initialize(el, elBind) { - const view = this, type = view._renderType, config = view._eventConfig.bind, module = (0, _vegaScenegraph.renderModule)(type); - // containing dom element - el = view._el = el ? lookup(view, el, true) : null; - // initialize aria attributes - initializeAria(view); - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || (0, _vegaScenegraph.CanvasHandler), Renderer = el ? module.renderer : module.headless; - // initialize renderer and input handler - view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? view._elBind = lookup(view, elBind, true) : el.appendChild(element('form', { - 'class': 'vega-bindings' - })); - view._bind.forEach((_)=>{ - if (_.param.element && config !== 'container') _.element = lookup(view, _.param.element, !!_.param.input); - }); - view._bind.forEach((_)=>{ - bind(view, _.element || elBind, _); - }); + if (!isObject$1(base2)) { + error("Second argument to selectionTuples must be an object."); } - return view; -} -function lookup(view, el, clear) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; + return array2.map((x2) => extend$1(base2.fields ? { + values: base2.fields.map((f) => getter(f)(x2.datum)) + } : { + [SelectionId]: $selectionId(x2.datum) + }, base2)); + } + function selectionResolve(name, op, isMulti, vl5) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], resolved = {}, multiRes = {}, types = {}, entry2, fields, values2, unit2, field2, value2, res, resUnit, type2, union2, n = entries.length, i = 0, j, m2; + for (; i < n; ++i) { + entry2 = entries[i]; + unit2 = entry2.unit; + fields = entry2.fields; + values2 = entry2.values; + if (fields && values2) { + for (j = 0, m2 = fields.length; j < m2; ++j) { + field2 = fields[j]; + res = resolved[field2.field] || (resolved[field2.field] = {}); + resUnit = res[unit2] || (res[unit2] = []); + types[field2.field] = type2 = field2.type.charAt(0); + union2 = ops[`${type2}_union`]; + res[unit2] = union2(resUnit, array$5(values2[j])); + } + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push(array$5(values2).reduce((obj2, curr, j2) => (obj2[fields[j2].field] = curr, obj2), {})); + } + } else { + field2 = SelectionId; + value2 = $selectionId(entry2); + res = resolved[field2] || (resolved[field2] = {}); + resUnit = res[unit2] || (res[unit2] = []); + resUnit.push(value2); + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push({ + [SelectionId]: value2 + }); } + } } - if (el && clear) try { - el.textContent = ''; - } catch (e) { - el = null; - view.error(e); + op = op || Union; + if (resolved[SelectionId]) { + resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); + } else { + Object.keys(resolved).forEach((field3) => { + resolved[field3] = Object.keys(resolved[field3]).map((unit3) => resolved[field3][unit3]).reduce((acc, curr) => acc === void 0 ? curr : ops[`${types[field3]}_${op}`](acc, curr)); + }); } - return el; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ - }); -function padding(_) { - return (0, _vegaUtil.isObject)(_) ? { - top: number(_.top), - bottom: number(_.bottom), - left: number(_.left), - right: number(_.right) - } : paddingObject(number(_)); -} -/** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ async function renderHeadless(view, type, scaleFactor, opt) { - const module = (0, _vegaScenegraph.renderModule)(type), ctr = module && module.headless; - if (!ctr) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); -} -/** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ async function renderToImageURL(type, scaleFactor) { - if (type !== (0, _vegaScenegraph.RenderType).Canvas && type !== (0, _vegaScenegraph.RenderType).SVG && type !== (0, _vegaScenegraph.RenderType).PNG) (0, _vegaUtil.error)('Unrecognized image type: ' + type); - const r = await renderHeadless(this, type, scaleFactor); - return type === (0, _vegaScenegraph.RenderType).SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png'); -} -function toBlobURL(data, mime) { - const blob = new Blob([ - data - ], { - type: mime - }); - return window.URL.createObjectURL(blob); -} -/** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).Canvas, scaleFactor, opt); - return r.canvas(); -} -/** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).SVG, scaleFactor); - return r.svg(); -} -function runtime(view, spec, expr) { - return (0, _vegaRuntime.context)(view, (0, _vegaDataflow.transforms), (0, _vegaFunctions.functionContext), expr).parse(spec); -} -function scale(name) { - var scales = this._runtime.scales; - if (!(0, _vegaUtil.hasOwnProperty)(scales, name)) (0, _vegaUtil.error)('Unrecognized scale or projection: ' + name); - return scales[name].value; -} -var Width = 'width', Height = 'height', Padding = 'padding', Skip = { - skip: true -}; -function viewWidth(view, width) { - var a = view.autosize(), p = view.padding(); - return width - (a && a.contains === Padding ? p.left + p.right : 0); -} -function viewHeight(view, height) { - var a = view.autosize(), p = view.padding(); - return height - (a && a.contains === Padding ? p.top + p.bottom : 0); -} -function initializeResize(view) { - var s = view._signals, w = s[Width], h = s[Height], p = s[Padding]; - function resetSize() { - view._autosize = view._resize = 1; + entries = Object.keys(multiRes); + if (isMulti && entries.length) { + const key2 = vl5 ? VlPoint : VlMulti; + resolved[key2] = op === Union ? { + [Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), []) + } : { + [And]: entries.map((k) => ({ + [Or]: multiRes[k] + })) + }; } - // respond to width signal - view._resizeWidth = view.add(null, (_)=>{ - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, { - size: w - }); - // respond to height signal - view._resizeHeight = view.add(null, (_)=>{ - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, { - size: h - }); - // respond to padding signal - const resizePadding = view.add(null, resetSize, { - pad: p - }); - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; -} -function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter((view)=>{ - let rerun = 0; - // reset autosize flag - view._autosize = 0; - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter((v)=>v.resize()); - }, false, 1); -} -/** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ function getState(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); -} -function dataTest(name, data) { - return data.modified && (0, _vegaUtil.isArray)(data.input.value) && !name.startsWith('_:vega:_'); -} -function signalTest(name, op) { - return !(name === 'parent' || op instanceof (0, _vegaDataflow.transforms).proxy); -} -/** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ function setState(state) { - this.runAsync(null, (v)=>{ - v._trigger = false; - v._runtime.setState(state); - }, (v)=>{ - v._trigger = true; - }); - return this; -} -function timer(callback, delay) { - function tick(elapsed) { - callback({ - timestamp: Date.now(), - elapsed: elapsed - }); + return resolved; + } + var ops = { + [`${SelectionId}_union`]: union, + [`${SelectionId}_intersect`]: intersection, + E_union: function(base2, value2) { + if (!base2.length) return value2; + var i = 0, n = value2.length; + for (; i < n; ++i) if (!base2.includes(value2[i])) base2.push(value2[i]); + return base2; + }, + E_intersect: function(base2, value2) { + return !base2.length ? value2 : base2.filter((v) => value2.includes(v)); + }, + R_union: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (base2[0] > lo) base2[0] = lo; + if (base2[1] < hi) base2[1] = hi; + return base2; + }, + R_intersect: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (hi < base2[0] || base2[1] < lo) { + return []; + } else { + if (base2[0] < lo) base2[0] = lo; + if (base2[1] > hi) base2[1] = hi; + } + return base2; } - this._timers.push((0, _d3Timer.interval)(tick, delay)); -} -function defaultTooltip(handler, event, item, value) { - const el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); -} -function formatTooltip(value) { - return value == null ? '' : (0, _vegaUtil.isArray)(value) ? formatArray(value) : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? formatObject(value) : value + ''; -} -function formatObject(obj) { - return Object.keys(obj).map((key)=>{ - const v = obj[key]; - return key + ': ' + ((0, _vegaUtil.isArray)(v) ? formatArray(v) : formatValue(v)); - }).join('\n'); -} -function formatArray(value) { - return '[' + value.map(formatValue).join(', ') + ']'; -} -function formatValue(value) { - return (0, _vegaUtil.isArray)(value) ? '[\u2026]' : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? '{\u2026}' : value; -} -function watchPixelRatio() { - // based on https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes - if (this.renderer() === 'canvas' && this._renderer._canvas) { - let remove = null; - const updatePixelRatio = ()=>{ - if (remove != null) remove(); - const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); - media.addEventListener('change', updatePixelRatio); - remove = ()=>{ - media.removeEventListener('change', updatePixelRatio); - }; - this._renderer._canvas.getContext('2d').pixelRatio = window.devicePixelRatio || 1; - this._redraw = true; - this._resize = 1; - this.resize().runAsync(); - }; - updatePixelRatio(); - } -} -/** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ function View(spec, options) { - const view = this; - options = options || {}; - (0, _vegaDataflow.Dataflow).call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = (0, _vegaUtil.extend)({}, spec.locale, options.locale); - view.locale((0, _vegaFormat.locale)(loc.number, loc.time)); + }; + const DataPrefix$1 = ":", IndexPrefix$1 = "@"; + function selectionVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to selection functions must be a string literal."); + const data2 = args[0].value, op = args.length >= 2 && peek$1(args).value, field2 = "unit", indexName = IndexPrefix$1 + field2, dataName = DataPrefix$1 + data2; + if (op === Intersect && !has$1(params2, indexName)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); } - view._el = null; - view._elBind = null; - view._renderType = options.renderer || (0, _vegaScenegraph.RenderType).Canvas; - view._scenegraph = new (0, _vegaScenegraph.Scenegraph)(); - const root = view._scenegraph.root; - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip, view._redraw = true; - view._handler = new (0, _vegaScenegraph.CanvasHandler)().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map((_)=>({ - state: null, - param: (0, _vegaUtil.extend)({}, _) - })); - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [ - 0, - 0 - ]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - // initialize background color - background(view); - // initialize cursor - cursor(view); - // initialize view description - view.description(spec.description); - // initialize hover proessing, if requested - if (options.hover) view.hover(); - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); - if (options.watchPixelRatio) view._watchPixelRatio(); -} -function lookupSignal(view, name) { - return (0, _vegaUtil.hasOwnProperty)(view._signals, name) ? view._signals[name] : (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); -} -function findOperatorHandler(op, handler) { - const h = (op._targets || []).filter((op)=>op._update && op._update.handler === handler); - return h.length ? h[0] : null; -} -function addOperatorListener(view, name, op, handler) { - let h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, ()=>handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); + if (!has$1(params2, dataName)) { + params2[dataName] = scope.getData(data2).tuplesRef(); } - return view; -} -function removeOperatorListener(view, op, handler) { - const h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; -} -(0, _vegaUtil.inherits)(View, (0, _vegaDataflow.Dataflow), { - // -- DATAFLOW / RENDERING ---- - async evaluate (encode, prerun, postrun) { - // evaluate dataflow and prerun - await (0, _vegaDataflow.Dataflow).prototype.evaluate.call(this, encode, prerun); - // render as needed - if (this._redraw || this._resize) try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - // evaluate postrun - if (postrun) (0, _vegaDataflow.asyncCallback)(this, postrun); - return this; - }, - dirty (item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }, - // -- GET / SET ---- - description (text) { - if (arguments.length) { - const desc = text != null ? text + '' : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; - }, - container () { - return this._el; - }, - scenegraph () { - return this._scenegraph; - }, - origin () { - return this._origin.slice(); - }, - signal (name, value, options) { - const op = lookupSignal(this, name); - return arguments.length === 1 ? op.value : this.update(op, value, options); - }, - width (_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }, - height (_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }, - padding (_) { - return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding')); - }, - autosize (_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }, - background (_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }, - renderer (type) { - if (!arguments.length) return this._renderType; - if (!(0, _vegaScenegraph.renderModule)(type)) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; - }, - tooltip (handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; - }, - loader (loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - (0, _vegaDataflow.Dataflow).prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; - }, - resize () { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); - }, - _resetRenderer () { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }, - // -- SIZING ---- - _resizeView: resizeView, - // -- EVENT HANDLING ---- - addEventListener (type, handler, options) { - let callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; - }, - removeEventListener (type, handler) { - var handlers = this._handler.handlers(type), i = handlers.length, h, t; - // search registered handlers, remove if match found - while(--i >= 0){ - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } - } - return this; - }, - addResizeListener (handler) { - const l = this._resizeListeners; - if (!l.includes(handler)) // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - return this; - }, - removeResizeListener (handler) { - var l = this._resizeListeners, i = l.indexOf(handler); - if (i >= 0) l.splice(i, 1); - return this; - }, - addSignalListener (name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }, - removeSignalListener (name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }, - addDataListener (name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }, - removeDataListener (name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); - }, - globalCursor (_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else return this._globalCursor; - }, - preventDefault (_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else return this._preventDefault; - }, - timer, - events, - finalize, - hover, - // -- DATA ---- - data, - change, - insert, - remove, - // -- SCALES -- - scale, - // -- INITIALIZATION ---- - initialize, - // -- HEADLESS RENDERING ---- - toImageURL: renderToImageURL, - toCanvas: renderToCanvas, - toSVG: renderToSVG, - // -- SAVE / RESTORE STATE ---- - getState, - setState, - // RE-RENDER ON ZOOM - _watchPixelRatio: watchPixelRatio -}); - -},{"vega-util":"bApja","vega-dataflow":"3NitK","vega-scenegraph":"jattk","d3-array":"6IwJG","vega-functions":"iuqsd","vega-runtime":"k7ppL","d3-timer":"d15bJ","vega-format":"47kOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iuqsd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataPrefix", ()=>DataPrefix); -parcelHelpers.export(exports, "IndexPrefix", ()=>IndexPrefix); -parcelHelpers.export(exports, "ScalePrefix", ()=>ScalePrefix); -parcelHelpers.export(exports, "SignalPrefix", ()=>SignalPrefix); -parcelHelpers.export(exports, "bandspace", ()=>bandspace); -parcelHelpers.export(exports, "bandwidth", ()=>bandwidth); -parcelHelpers.export(exports, "codeGenerator", ()=>codeGenerator); -parcelHelpers.export(exports, "codegenParams", ()=>codegenParams); -parcelHelpers.export(exports, "containerSize", ()=>containerSize); -parcelHelpers.export(exports, "contrast", ()=>contrast); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "data", ()=>data); -parcelHelpers.export(exports, "dataVisitor", ()=>dataVisitor); -parcelHelpers.export(exports, "dayAbbrevFormat", ()=>dayAbbrevFormat); -parcelHelpers.export(exports, "dayFormat", ()=>dayFormat); -parcelHelpers.export(exports, "debug", ()=>debug); -parcelHelpers.export(exports, "domain", ()=>domain); -parcelHelpers.export(exports, "encode", ()=>encode); -parcelHelpers.export(exports, "expressionFunction", ()=>expressionFunction); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "functionContext", ()=>functionContext); -parcelHelpers.export(exports, "geoArea", ()=>geoArea); -parcelHelpers.export(exports, "geoBounds", ()=>geoBounds); -parcelHelpers.export(exports, "geoCentroid", ()=>geoCentroid); -parcelHelpers.export(exports, "geoScale", ()=>geoScale); -parcelHelpers.export(exports, "geoShape", ()=>geoShape); -parcelHelpers.export(exports, "inScope", ()=>inScope); -parcelHelpers.export(exports, "indata", ()=>indata); -parcelHelpers.export(exports, "indataVisitor", ()=>indataVisitor); -parcelHelpers.export(exports, "indexof", ()=>indexof); -parcelHelpers.export(exports, "info", ()=>info); -parcelHelpers.export(exports, "invert", ()=>invert); -parcelHelpers.export(exports, "join", ()=>join); -parcelHelpers.export(exports, "lastindexof", ()=>lastindexof); -parcelHelpers.export(exports, "luminance", ()=>luminance); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "modify", ()=>modify); -parcelHelpers.export(exports, "monthAbbrevFormat", ()=>monthAbbrevFormat); -parcelHelpers.export(exports, "monthFormat", ()=>monthFormat); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -parcelHelpers.export(exports, "pathShape", ()=>pathShape); -parcelHelpers.export(exports, "pinchAngle", ()=>pinchAngle); -parcelHelpers.export(exports, "pinchDistance", ()=>pinchDistance); -parcelHelpers.export(exports, "pluck", ()=>pluck); -parcelHelpers.export(exports, "range", ()=>range); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "reverse", ()=>reverse); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleGradient", ()=>scaleGradient); -parcelHelpers.export(exports, "scaleVisitor", ()=>scaleVisitor); -parcelHelpers.export(exports, "screen", ()=>screen); -parcelHelpers.export(exports, "setdata", ()=>setdata); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "sort", ()=>sort); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "treeAncestors", ()=>treeAncestors); -parcelHelpers.export(exports, "treePath", ()=>treePath); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "warn", ()=>warn); -parcelHelpers.export(exports, "windowSize", ()=>windowSize); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -var _vegaScale = require("vega-scale"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaSelections = require("vega-selections"); -var _vegaStatistics = require("vega-statistics"); -var _vegaTime = require("vega-time"); -var _d3Array = require("d3-array"); -function data(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; -} -function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; -} -function setdata(name, tuples) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input; - df.pulse(input, df.changeset().remove((0, _vegaUtil.truthy)).insert(tuples)); + } + function data$2(name) { + const data2 = this.context.data[name]; + return data2 ? data2.values.value : []; + } + function indata(name, field2, value2) { + const index2 = this.context.data[name]["index:" + field2], entry2 = index2 ? index2.value.get(value2) : void 0; + return entry2 ? entry2.count : entry2; + } + function setdata(name, tuples) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input; + df.pulse(input, df.changeset().remove(truthy).insert(tuples)); return 1; -} -function encode(item, name, retval) { + } + function encode(item, name, retval) { if (item) { - const df = this.context.dataflow, target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; -} -const wrap = (method)=>function(value, spec) { - const locale = this.context.dataflow.locale(); - return value === null ? 'null' : locale[method](spec)(value); - }; -const format = wrap('format'); -const timeFormat = wrap('timeFormat'); -const utcFormat = wrap('utcFormat'); -const timeParse = wrap('timeParse'); -const utcParse = wrap('utcParse'); -const dateObj = new Date(2000, 0, 1); -function time(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); + const df = this.context.dataflow, target2 = item.mark.source; + df.pulse(target2, df.changeset().encode(item, name)); + } + return retval !== void 0 ? retval : item; + } + const wrap = (method2) => function(value2, spec) { + const locale2 = this.context.dataflow.locale(); + return value2 === null ? "null" : locale2[method2](spec)(value2); + }; + const format = wrap("format"); + const timeFormat = wrap("timeFormat"); + const utcFormat = wrap("utcFormat"); + const timeParse = wrap("timeParse"); + const utcParse = wrap("utcParse"); + const dateObj = new Date(2e3, 0, 1); + function time(month, day, specifier) { + if (!Number.isInteger(month) || !Number.isInteger(day)) return ""; + dateObj.setYear(2e3); dateObj.setMonth(month); dateObj.setDate(day); return timeFormat.call(this, dateObj, specifier); -} -function monthFormat(month) { - return time.call(this, month, 1, '%B'); -} -function monthAbbrevFormat(month) { - return time.call(this, month, 1, '%b'); -} -function dayFormat(day) { - return time.call(this, 0, 2 + day, '%A'); -} -function dayAbbrevFormat(day) { - return time.call(this, 0, 2 + day, '%a'); -} -const DataPrefix = ':'; -const IndexPrefix = '@'; -const ScalePrefix = '%'; -const SignalPrefix = '$'; -function dataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to data functions must be a string literal.'); - const data = args[0].value, dataName = DataPrefix + data; - if (!(0, _vegaUtil.hasOwnProperty)(dataName, params)) try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } -} -function indataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to indata must be a string literal.'); - if (args[1].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('Second argument to indata must be a string literal.'); - const data = args[0].value, field = args[1].value, indexName = IndexPrefix + field; - if (!(0, _vegaUtil.hasOwnProperty)(indexName, params)) params[indexName] = scope.getData(data).indataRef(scope, field); -} -function scaleVisitor(name, args, scope, params) { - if (args[0].type === (0, _vegaExpression.Literal)) // add scale dependency - addScaleDependency(scope, params, args[0].value); - else // indirect scale lookup; add all scales as parameters - for(name in scope.scales)addScaleDependency(scope, params, name); -} -function addScaleDependency(scope, params, name) { + } + function monthFormat(month) { + return time.call(this, month, 1, "%B"); + } + function monthAbbrevFormat(month) { + return time.call(this, month, 1, "%b"); + } + function dayFormat(day) { + return time.call(this, 0, 2 + day, "%A"); + } + function dayAbbrevFormat(day) { + return time.call(this, 0, 2 + day, "%a"); + } + const DataPrefix = ":"; + const IndexPrefix = "@"; + const ScalePrefix = "%"; + const SignalPrefix = "$"; + function dataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) { + error("First argument to data functions must be a string literal."); + } + const data2 = args[0].value, dataName = DataPrefix + data2; + if (!has$1(dataName, params2)) { + try { + params2[dataName] = scope.getData(data2).tuplesRef(); + } catch (err) { + } + } + } + function indataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to indata must be a string literal."); + if (args[1].type !== Literal) error("Second argument to indata must be a string literal."); + const data2 = args[0].value, field2 = args[1].value, indexName = IndexPrefix + field2; + if (!has$1(indexName, params2)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); + } + } + function scaleVisitor(name, args, scope, params2) { + if (args[0].type === Literal) { + addScaleDependency(scope, params2, args[0].value); + } else { + for (name in scope.scales) { + addScaleDependency(scope, params2, name); + } + } + } + function addScaleDependency(scope, params2, name) { const scaleName = ScalePrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, scaleName)) try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } -} -/** - * Name must be a string. Return undefined if the scale is not registered. - */ function getScale(name, ctx) { - if ((0, _vegaUtil.isString)(name)) { - const maybeScale = ctx.scales[name]; - return maybeScale && (0, _vegaScale.isRegisteredScale)(maybeScale.value) ? maybeScale.value : undefined; - } - return undefined; -} -function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = (s)=>s && s.bandwidth ? s.bandwidth() : 0; - // register AST visitors for internal scale functions + if (!has$1(params2, scaleName)) { + try { + params2[scaleName] = scope.scaleRef(name); + } catch (err) { + } + } + } + function getScale(nameOrFunction, ctx) { + if (isString(nameOrFunction)) { + const maybeScale = ctx.scales[nameOrFunction]; + return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : void 0; + } else if (isFunction(nameOrFunction)) { + return isRegisteredScale(nameOrFunction) ? nameOrFunction : void 0; + } + return void 0; + } + function internalScaleFunctions(codegen2, fnctx, visitors) { + fnctx.__bandwidth = (s) => s && s.bandwidth ? s.bandwidth() : 0; visitors._bandwidth = scaleVisitor; visitors._range = scaleVisitor; visitors._scale = scaleVisitor; - // resolve scale reference directly to the signal hash argument - const ref = (arg)=>'_[' + (arg.type === (0, _vegaExpression.Literal) ? (0, _vegaUtil.stringValue)(ScalePrefix + arg.value) : (0, _vegaUtil.stringValue)(ScalePrefix) + '+' + codegen(arg)) + ']'; - // define and return internal scale function code generators - // these internal functions are called by mark encoders + const ref2 = (arg) => "_[" + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + "+" + codegen2(arg)) + "]"; return { - _bandwidth: (args)=>`this.__bandwidth(${ref(args[0])})`, - _range: (args)=>`${ref(args[0])}.range()`, - _scale: (args)=>`${ref(args[0])}(${codegen(args[1])})` - }; -} -function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else // projection undefined, use global method + _bandwidth: (args) => `this.__bandwidth(${ref2(args[0])})`, + _range: (args) => `${ref2(args[0])}.range()`, + _scale: (args) => `${ref2(args[0])}(${codegen2(args[1])})` + }; + } + function geoMethod(methodName, globalMethod) { + return function(projection2, geojson, group2) { + if (projection2) { + const p = getScale(projection2, (group2 || this).context); + return p && p.path[methodName](geojson); + } else { return globalMethod(geojson); + } }; -} -const geoArea = geoMethod('area', (0, _d3Geo.geoArea)); -const geoBounds = geoMethod('bounds', (0, _d3Geo.geoBounds)); -const geoCentroid = geoMethod('centroid', (0, _d3Geo.geoCentroid)); -function geoScale(projection, group) { - const p = getScale(projection, (group || this).context); + } + const geoArea = geoMethod("area", geoArea$1); + const geoBounds = geoMethod("bounds", geoBounds$1); + const geoCentroid = geoMethod("centroid", geoCentroid$1); + function geoScale(projection2, group2) { + const p = getScale(projection2, (group2 || this).context); return p && p.scale(); -} -function inScope(item) { - const group = this.context.group; - let value = false; - if (group) while(item){ - if (item === group) { - value = true; - break; - } - item = item.mark.group; + } + function inScope(item) { + const group2 = this.context.group; + let value2 = false; + if (group2) while (item) { + if (item === group2) { + value2 = true; + break; + } + item = item.mark.group; } - return value; -} -function log(df, method, args) { + return value2; + } + function log(df, method2, args) { try { - df[method].apply(df, [ - 'EXPRESSION' - ].concat([].slice.call(args))); + df[method2].apply(df, ["EXPRESSION"].concat([].slice.call(args))); } catch (err) { - df.warn(err); + df.warn(err); } return args[args.length - 1]; -} -function warn() { - return log(this.context.dataflow, 'warn', arguments); -} -function info() { - return log(this.context.dataflow, 'info', arguments); -} -function debug() { - return log(this.context.dataflow, 'debug', arguments); -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef -function channel_luminance_value(channelValue) { + } + function warn() { + return log(this.context.dataflow, "warn", arguments); + } + function info() { + return log(this.context.dataflow, "info", arguments); + } + function debug() { + return log(this.context.dataflow, "debug", arguments); + } + function channel_luminance_value(channelValue) { const val = channelValue / 255; - if (val <= 0.03928) return val / 12.92; + if (val <= 0.03928) { + return val / 12.92; + } return Math.pow((val + 0.055) / 1.055, 2.4); -} -function luminance(color) { - const c = (0, _d3Color.rgb)(color), r = channel_luminance_value(c.r), g = channel_luminance_value(c.g), b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef -function contrast(color1, color2) { + } + function luminance(color2) { + const c2 = rgb$1(color2), r = channel_luminance_value(c2.r), g = channel_luminance_value(c2.g), b2 = channel_luminance_value(c2.b); + return 0.2126 * r + 0.7152 * g + 0.0722 * b2; + } + function contrast(color1, color2) { const lum1 = luminance(color1), lum2 = luminance(color2), lumL = Math.max(lum1, lum2), lumD = Math.min(lum1, lum2); return (lumL + 0.05) / (lumD + 0.05); -} -function merge() { + } + function merge() { const args = [].slice.call(arguments); args.unshift({}); - return (0, _vegaUtil.extend)(...args); -} -function equal(a, b) { - return a === b || a !== a && b !== b ? true : (0, _vegaUtil.isArray)(a) ? (0, _vegaUtil.isArray)(b) && a.length === b.length ? equalArray(a, b) : false : (0, _vegaUtil.isObject)(a) && (0, _vegaUtil.isObject)(b) ? equalObject(a, b) : false; -} -function equalArray(a, b) { - for(let i = 0, n = a.length; i < n; ++i){ - if (!equal(a[i], b[i])) return false; + return extend$1(...args); + } + function equal(a2, b2) { + return a2 === b2 || a2 !== a2 && b2 !== b2 ? true : isArray(a2) ? isArray(b2) && a2.length === b2.length ? equalArray(a2, b2) : false : isObject$1(a2) && isObject$1(b2) ? equalObject(a2, b2) : false; + } + function equalArray(a2, b2) { + for (let i = 0, n = a2.length; i < n; ++i) { + if (!equal(a2[i], b2[i])) return false; } return true; -} -function equalObject(a, b) { - for(const key in a){ - if (!equal(a[key], b[key])) return false; + } + function equalObject(a2, b2) { + for (const key2 in a2) { + if (!equal(a2[key2], b2[key2])) return false; } return true; -} -function removePredicate(props) { - return (_)=>equalObject(props, _); -} -function modify(name, insert, remove, toggle, modify, values) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input, stamp = df.stamp(); - let changes = data.changes, predicate, key; - if (df._trigger === false || !(input.value.length || insert || toggle)) // nothing to do! - return 0; + } + function removePredicate(props) { + return (_) => equalObject(props, _); + } + function modify(name, insert2, remove2, toggle, modify2, values2) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input, stamp = df.stamp(); + let changes = data2.changes, predicate, key2; + if (df._trigger === false || !(input.value.length || insert2 || toggle)) { + return 0; + } if (!changes || changes.stamp < stamp) { - data.changes = changes = df.changeset(); - changes.stamp = stamp; - df.runAfter(()=>{ - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - if (remove) { - predicate = remove === true ? (0, _vegaUtil.truthy) : (0, _vegaUtil.isArray)(remove) || (0, _vegaDataflow.isTuple)(remove) ? remove : removePredicate(remove); - changes.remove(predicate); + data2.changes = changes = df.changeset(); + changes.stamp = stamp; + df.runAfter(() => { + data2.modified = true; + df.pulse(input, changes).run(); + }, true, 1); + } + if (remove2) { + predicate = remove2 === true ? truthy : isArray(remove2) || isTuple(remove2) ? remove2 : removePredicate(remove2); + changes.remove(predicate); + } + if (insert2) { + changes.insert(insert2); } - if (insert) changes.insert(insert); if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) changes.remove(predicate); - else changes.insert(toggle); + predicate = removePredicate(toggle); + if (input.value.some(predicate)) { + changes.remove(predicate); + } else { + changes.insert(toggle); + } + } + if (modify2) { + for (key2 in values2) { + changes.modify(modify2, key2, values2[key2]); + } } - if (modify) for(key in values)changes.modify(modify, key, values[key]); return 1; -} -function pinchDistance(event) { - const t = event.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; + } + function pinchDistance(event2) { + const t = event2.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; return Math.hypot(dx, dy); -} -function pinchAngle(event) { - const t = event.touches; + } + function pinchAngle(event2) { + const t = event2.touches; return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); -} -// memoize accessor functions -const accessors = {}; -function pluck(data, name) { - const accessor = accessors[name] || (accessors[name] = (0, _vegaUtil.field)(name)); - return (0, _vegaUtil.isArray)(data) ? data.map(accessor) : accessor(data); -} -function array(seq) { - return (0, _vegaUtil.isArray)(seq) || ArrayBuffer.isView(seq) ? seq : null; -} -function sequence(seq) { - return array(seq) || ((0, _vegaUtil.isString)(seq) ? seq : null); -} -function join(seq) { - for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; + } + const accessors = {}; + function pluck(data2, name) { + const accessor2 = accessors[name] || (accessors[name] = field$1(name)); + return isArray(data2) ? data2.map(accessor2) : accessor2(data2); + } + function array(seq) { + return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null; + } + function sequence(seq) { + return array(seq) || (isString(seq) ? seq : null); + } + function join(seq, ...args) { return array(seq).join(...args); -} -function indexof(seq) { - for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)args[_key2 - 1] = arguments[_key2]; + } + function indexof(seq, ...args) { return sequence(seq).indexOf(...args); -} -function lastindexof(seq) { - for(var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)args[_key3 - 1] = arguments[_key3]; + } + function lastindexof(seq, ...args) { return sequence(seq).lastIndexOf(...args); -} -function slice(seq) { - for(var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++)args[_key4 - 1] = arguments[_key4]; + } + function slice(seq, ...args) { return sequence(seq).slice(...args); -} -function replace(str, pattern, repl) { - if ((0, _vegaUtil.isFunction)(repl)) (0, _vegaUtil.error)('Function argument passed to replace.'); - if (!(0, _vegaUtil.isString)(pattern) && !(0, _vegaUtil.isRegExp)(pattern)) (0, _vegaUtil.error)('Please pass a string or RegExp argument to replace.'); + } + function replace(str, pattern, repl) { + if (isFunction(repl)) error("Function argument passed to replace."); + if (!isString(pattern) && !isRegExp(pattern)) error("Please pass a string or RegExp argument to replace."); return String(str).replace(pattern, repl); -} -function reverse(seq) { + } + function reverse(seq) { return array(seq).slice().reverse(); -} -function sort(seq) { - return array(seq).slice().sort((0, _vegaUtil.ascending)); -} -function bandspace(count, paddingInner, paddingOuter) { - return (0, _vegaScale.bandSpace)(count || 0, paddingInner || 0, paddingOuter || 0); -} -function bandwidth(name, group) { - const s = getScale(name, (group || this).context); + } + function sort(seq) { + return array(seq).slice().sort(ascending$2); + } + function bandspace(count2, paddingInner, paddingOuter) { + return bandSpace(count2 || 0, paddingInner || 0, paddingOuter || 0); + } + function bandwidth(name, group2) { + const s = getScale(name, (group2 || this).context); return s && s.bandwidth ? s.bandwidth() : 0; -} -function copy(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; -} -function domain(name, group) { - const s = getScale(name, (group || this).context); + } + function copy$5(name, group2) { + const s = getScale(name, (group2 || this).context); + return s ? s.copy() : void 0; + } + function domain(name, group2) { + const s = getScale(name, (group2 || this).context); return s ? s.domain() : []; -} -function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined : (0, _vegaUtil.isArray)(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range); -} -function range(name, group) { - const s = getScale(name, (group || this).context); + } + function invert$2(name, range2, group2) { + const s = getScale(name, (group2 || this).context); + return !s ? void 0 : isArray(range2) ? (s.invertRange || s.invert)(range2) : (s.invert || s.invertExtent)(range2); + } + function range$1(name, group2) { + const s = getScale(name, (group2 || this).context); return s && s.range ? s.range() : []; -} -function scale(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; -} -/** - * Passing a function is only used for for testing. - * Outside of tests, the first argument should be a string. - */ function scaleGradient(scaleOrFunction, p0, p1, count, group) { - let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction; - const gradient = (0, _vegaScenegraph.Gradient)(p0, p1); - let stops = scale.domain(), min = stops[0], max = (0, _vegaUtil.peek)(stops), fraction = (0, _vegaUtil.identity); - if (!(max - min)) // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator ? (0, _vegaScale.scale)('sequential')().interpolator(scale.interpolator()) : (0, _vegaScale.scale)('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([ - min = 0, - max = 1 - ]); - else fraction = (0, _vegaScale.scaleFraction)(scale, min, max); - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== (0, _vegaUtil.peek)(stops)) stops.push(max); - } - stops.forEach((_)=>gradient.stop(fraction(_), scale(_))); - return gradient; -} -function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; -} -function pathShape(path) { + } + function scale$4(name, value2, group2) { + const s = getScale(name, (group2 || this).context); + return s ? s(value2) : void 0; + } + function scaleGradient(scale2, p02, p1, count2, group2) { + scale2 = getScale(scale2, (group2 || this).context); + const gradient2 = Gradient$1(p02, p1); + let stops = scale2.domain(), min2 = stops[0], max2 = peek$1(stops), fraction = identity$7; + if (!(max2 - min2)) { + scale2 = (scale2.interpolator ? scale$6("sequential")().interpolator(scale2.interpolator()) : scale$6("linear")().interpolate(scale2.interpolate()).range(scale2.range())).domain([min2 = 0, max2 = 1]); + } else { + fraction = scaleFraction(scale2, min2, max2); + } + if (scale2.ticks) { + stops = scale2.ticks(+count2 || 15); + if (min2 !== stops[0]) stops.unshift(min2); + if (max2 !== peek$1(stops)) stops.push(max2); + } + stops.forEach((_) => gradient2.stop(fraction(_), scale2(_))); + return gradient2; + } + function geoShape(projection2, geojson, group2) { + const p = getScale(projection2, (group2 || this).context); + return function(context2) { + return p ? p.path.context(context2)(geojson) : ""; + }; + } + function pathShape(path2) { let p = null; - return function(context) { - return context ? (0, _vegaScenegraph.pathRender)(context, p = p || (0, _vegaScenegraph.pathParse)(path)) : path; - }; -} -const datum = (d)=>d.data; -function treeNodes(name, context) { - const tree = data.call(context, name); - return tree.root && tree.root.lookup || {}; -} -function treePath(name, source, target) { - const nodes = treeNodes(name, this), s = nodes[source], t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; -} -function treeAncestors(name, node) { + return function(context2) { + return context2 ? pathRender(context2, p = p || parse$3(path2)) : path2; + }; + } + const datum = (d) => d.data; + function treeNodes(name, context2) { + const tree2 = data$2.call(context2, name); + return tree2.root && tree2.root.lookup || {}; + } + function treePath(name, source2, target2) { + const nodes = treeNodes(name, this), s = nodes[source2], t = nodes[target2]; + return s && t ? s.path(t).map(datum) : void 0; + } + function treeAncestors(name, node) { const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; -} -const _window = ()=>typeof window !== 'undefined' && window || null; -function screen() { - const w = _window(); - return w ? w.screen : {}; -} -function windowSize() { - const w = _window(); - return w ? [ - w.innerWidth, - w.innerHeight - ] : [ - undefined, - undefined - ]; -} -function containerSize() { + return n ? n.ancestors().map(datum) : void 0; + } + const _window = () => typeof window !== "undefined" && window || null; + function screen() { + const w2 = _window(); + return w2 ? w2.screen : {}; + } + function windowSize() { + const w2 = _window(); + return w2 ? [w2.innerWidth, w2.innerHeight] : [void 0, void 0]; + } + function containerSize() { const view = this.context.dataflow, el = view.container && view.container(); - return el ? [ - el.clientWidth, - el.clientHeight - ] : [ - undefined, - undefined - ]; -} -function intersect(b, opt, group) { - if (!b) return []; - const [u, v] = b, box = new (0, _vegaScenegraph.Bounds)().set(u[0], u[1], v[0], v[1]), scene = group || this.context.dataflow.scenegraph().root; - return (0, _vegaScenegraph.intersect)(scene, box, filter(opt)); -} -function filter(opt) { + return el ? [el.clientWidth, el.clientHeight] : [void 0, void 0]; + } + function intersect(b2, opt, group2) { + if (!b2) return []; + const [u2, v] = b2, box2 = new Bounds().set(u2[0], u2[1], v[0], v[1]), scene = group2 || this.context.dataflow.scenegraph().root; + return intersect$2(scene, box2, filter(opt)); + } + function filter(opt) { let p = null; if (opt) { - const types = (0, _vegaUtil.array)(opt.marktype), names = (0, _vegaUtil.array)(opt.markname); - p = (_)=>(!types.length || types.some((t)=>_.marktype === t)) && (!names.length || names.some((s)=>_.name === s)); + const types = array$5(opt.marktype), names = array$5(opt.markname); + p = (_) => (!types.length || types.some((t) => _.marktype === t)) && (!names.length || names.some((s) => _.name === s)); } return p; -} -/** - * Appends a new point to the lasso - * - * @param {*} lasso the lasso in pixel space - * @param {*} x the x coordinate in pixel space - * @param {*} y the y coordinate in pixel space - * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point - * @returns a new array containing the lasso with the new point - */ function lassoAppend(lasso, x, y) { - let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5; - lasso = (0, _vegaUtil.array)(lasso); + } + function lassoAppend(lasso, x2, y2, minDist = 5) { + lasso = array$5(lasso); const last = lasso[lasso.length - 1]; - // Add point to lasso if its the first point or distance to last point exceed minDist - return last === undefined || Math.hypot(last[0] - x, last[1] - y) > minDist ? [ - ...lasso, - [ - x, - y - ] - ] : lasso; -} -/** - * Generates a svg path command which draws a lasso - * - * @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...] - * @returns the svg path command that draws the lasso - */ function lassoPath(lasso) { - return (0, _vegaUtil.array)(lasso).reduce((svg, _ref, i)=>{ - let [x, y] = _ref; - return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `; - }, ''); -} -/** - * Inverts the lasso from pixel space to an array of vega scenegraph tuples - * - * @param {*} data the dataset - * @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...] - * @param {*} unit the unit where the lasso is defined - * - * @returns an array of vega scenegraph tuples - */ function intersectLasso(markname, pixelLasso, unit) { - const { x, y, mark } = unit; - const bb = new (0, _vegaScenegraph.Bounds)().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); - // Get bounding box around lasso - for (const [px, py] of pixelLasso){ - if (px < bb.x1) bb.x1 = px; - if (px > bb.x2) bb.x2 = px; - if (py < bb.y1) bb.y1 = py; - if (py > bb.y2) bb.y2 = py; - } - // Translate bb against unit coordinates - bb.translate(x, y); - const intersection = intersect([ - [ - bb.x1, - bb.y1 - ], - [ - bb.x2, - bb.y2 - ] - ], markname, mark); - // Check every point against the lasso - return intersection.filter((tuple)=>pointInPolygon(tuple.x, tuple.y, pixelLasso)); -} -/** - * Performs a test if a point is inside a polygon based on the idea from - * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html - * - * This method will not need the same start/end point since it wraps around the edges of the array - * - * @param {*} test a point to test against - * @param {*} polygon a polygon in the form [[x,y], [x,y], ...] - * @returns true if the point lies inside the polygon, false otherwise - */ function pointInPolygon(testx, testy, polygon) { + return last === void 0 || Math.hypot(last[0] - x2, last[1] - y2) > minDist ? [...lasso, [x2, y2]] : lasso; + } + function lassoPath(lasso) { + return array$5(lasso).reduce((svg, [x2, y2], i) => { + return svg += i == 0 ? `M ${x2},${y2} ` : i === lasso.length - 1 ? " Z" : `L ${x2},${y2} `; + }, ""); + } + function intersectLasso(markname, pixelLasso, unit2) { + const { + x: x2, + y: y2, + mark + } = unit2; + const bb = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); + for (const [px2, py2] of pixelLasso) { + if (px2 < bb.x1) bb.x1 = px2; + if (px2 > bb.x2) bb.x2 = px2; + if (py2 < bb.y1) bb.y1 = py2; + if (py2 > bb.y2) bb.y2 = py2; + } + bb.translate(x2, y2); + const intersection2 = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark); + return intersection2.filter((tuple) => pointInPolygon(tuple.x, tuple.y, pixelLasso)); + } + function pointInPolygon(testx, testy, polygon) { let intersections = 0; - for(let i = 0, j = polygon.length - 1; i < polygon.length; j = i++){ - const [prevX, prevY] = polygon[j]; - const [x, y] = polygon[i]; - // count intersections - if (y > testy != prevY > testy && testx < (prevX - x) * (testy - y) / (prevY - y) + x) intersections++; + for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { + const [prevX, prevY] = polygon[j]; + const [x2, y2] = polygon[i]; + if (y2 > testy != prevY > testy && testx < (prevX - x2) * (testy - y2) / (prevY - y2) + x2) { + intersections++; + } } - // point is in polygon if intersection count is odd return intersections & 1; -} -// Expression function context object -const functionContext = { - random () { - return (0, _vegaStatistics.random)(); - }, - cumulativeNormal: // override default - (0, _vegaStatistics.cumulativeNormal), - cumulativeLogNormal: (0, _vegaStatistics.cumulativeLogNormal), - cumulativeUniform: (0, _vegaStatistics.cumulativeUniform), - densityNormal: (0, _vegaStatistics.densityNormal), - densityLogNormal: (0, _vegaStatistics.densityLogNormal), - densityUniform: (0, _vegaStatistics.densityUniform), - quantileNormal: (0, _vegaStatistics.quantileNormal), - quantileLogNormal: (0, _vegaStatistics.quantileLogNormal), - quantileUniform: (0, _vegaStatistics.quantileUniform), - sampleNormal: (0, _vegaStatistics.sampleNormal), - sampleLogNormal: (0, _vegaStatistics.sampleLogNormal), - sampleUniform: (0, _vegaStatistics.sampleUniform), - isArray: (0, _vegaUtil.isArray), - isBoolean: (0, _vegaUtil.isBoolean), - isDate: (0, _vegaUtil.isDate), - isDefined (_) { - return _ !== undefined; - }, - isNumber: (0, _vegaUtil.isNumber), - isObject: (0, _vegaUtil.isObject), - isRegExp: (0, _vegaUtil.isRegExp), - isString: (0, _vegaUtil.isString), - isTuple: (0, _vegaDataflow.isTuple), - isValid (_) { - return _ != null && _ === _; - }, - toBoolean: (0, _vegaUtil.toBoolean), - toDate (_) { - return (0, _vegaUtil.toDate)(_); + } + const functionContext = { + random() { + return random(); + }, + // override default + cumulativeNormal, + cumulativeLogNormal, + cumulativeUniform, + densityNormal, + densityLogNormal, + densityUniform, + quantileNormal, + quantileLogNormal, + quantileUniform, + sampleNormal, + sampleLogNormal, + sampleUniform, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isDefined(_) { + return _ !== void 0; + }, + isNumber: isNumber$1, + isObject: isObject$1, + isRegExp, + isString, + isTuple, + isValid(_) { + return _ != null && _ === _; + }, + toBoolean, + toDate(_) { + return toDate(_); }, - toNumber: // suppress extra arguments - (0, _vegaUtil.toNumber), - toString: (0, _vegaUtil.toString), + // suppress extra arguments + toNumber, + toString, indexof, join, lastindexof, @@ -42118,52 +28231,52 @@ const functionContext = { reverse, sort, slice, - flush: (0, _vegaUtil.flush), - lerp: (0, _vegaUtil.lerp), + flush, + lerp: lerp$1, merge, - pad: (0, _vegaUtil.pad), - peek: (0, _vegaUtil.peek), + pad: pad$2, + peek: peek$1, pluck, - span: (0, _vegaUtil.span), - inrange: (0, _vegaUtil.inrange), - truncate: (0, _vegaUtil.truncate), - rgb: (0, _d3Color.rgb), - lab: (0, _d3Color.lab), - hcl: (0, _d3Color.hcl), - hsl: (0, _d3Color.hsl), + span, + inrange, + truncate: truncate$1, + rgb: rgb$1, + lab: lab$1, + hcl: hcl$1, + hsl: hsl$1, luminance, contrast, - sequence: (0, _d3Array.range), + sequence: range$3, format, utcFormat, utcParse, - utcOffset: (0, _vegaTime.utcOffset), - utcSequence: (0, _vegaTime.utcSequence), + utcOffset, + utcSequence, timeFormat, timeParse, - timeOffset: (0, _vegaTime.timeOffset), - timeSequence: (0, _vegaTime.timeSequence), - timeUnitSpecifier: (0, _vegaTime.timeUnitSpecifier), + timeOffset, + timeSequence, + timeUnitSpecifier, monthFormat, monthAbbrevFormat, dayFormat, dayAbbrevFormat, - quarter: (0, _vegaUtil.quarter), - utcquarter: (0, _vegaUtil.utcquarter), - week: (0, _vegaTime.week), - utcweek: (0, _vegaTime.utcweek), - dayofyear: (0, _vegaTime.dayofyear), - utcdayofyear: (0, _vegaTime.utcdayofyear), + quarter, + utcquarter, + week, + utcweek, + dayofyear, + utcdayofyear, warn, info, debug, - extent (_) { - return (0, _vegaUtil.extent)(_); + extent(_) { + return extent(_); }, // suppress extra arguments inScope, intersect, - clampRange: (0, _vegaUtil.clampRange), + clampRange, pinchDistance, pinchAngle, screen, @@ -42172,4932 +28285,4330 @@ const functionContext = { bandspace, setdata, pathShape, - panLinear: (0, _vegaUtil.panLinear), - panLog: (0, _vegaUtil.panLog), - panPow: (0, _vegaUtil.panPow), - panSymlog: (0, _vegaUtil.panSymlog), - zoomLinear: (0, _vegaUtil.zoomLinear), - zoomLog: (0, _vegaUtil.zoomLog), - zoomPow: (0, _vegaUtil.zoomPow), - zoomSymlog: (0, _vegaUtil.zoomSymlog), + panLinear, + panLog, + panPow, + panSymlog, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog, encode, modify, lassoAppend, lassoPath, intersectLasso -}; -const eventFunctions = [ - 'view', - 'item', - 'group', - 'xy', - 'x', - 'y' -], // event functions -eventPrefix = 'event.vega.', // event function prefix -thisPrefix = 'this.', // function context prefix -astVisitors = {}; // AST visitors for dependency analysis -// export code generator parameters -const codegenParams = { - forbidden: [ - '_' - ], - allowed: [ - 'datum', - 'event', - 'item' - ], - fieldvar: 'datum', - globalvar: (id)=>`_[${(0, _vegaUtil.stringValue)(SignalPrefix + id)}]`, + }; + const eventFunctions = ["view", "item", "group", "xy", "x", "y"], eventPrefix = "event.vega.", thisPrefix = "this.", astVisitors = {}; + const codegenParams = { + forbidden: ["_"], + allowed: ["datum", "event", "item"], + fieldvar: "datum", + globalvar: (id2) => `_[${$(SignalPrefix + id2)}]`, functions: buildFunctions, - constants: (0, _vegaExpression.constants), + constants: Constants$1, visitors: astVisitors -}; -// export code generator -const codeGenerator = (0, _vegaExpression.codegenExpression)(codegenParams); -// Build expression function registry -function buildFunctions(codegen) { - const fn = (0, _vegaExpression.functions)(codegen); - eventFunctions.forEach((name)=>fn[name] = eventPrefix + name); - for(const name in functionContext)fn[name] = thisPrefix + name; - (0, _vegaUtil.extend)(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; -} -// Register an expression function -function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) return functionContext[name]; - // register with the functionContext - functionContext[name] = fn; - // if there is an astVisitor register that, too + }; + const codeGenerator = codegen(codegenParams); + function buildFunctions(codegen2) { + const fn2 = Functions(codegen2); + eventFunctions.forEach((name) => fn2[name] = eventPrefix + name); + for (const name in functionContext) { + fn2[name] = thisPrefix + name; + } + extend$1(fn2, internalScaleFunctions(codegen2, functionContext, astVisitors)); + return fn2; + } + function expressionFunction(name, fn2, visitor) { + if (arguments.length === 1) { + return functionContext[name]; + } + functionContext[name] = fn2; if (visitor) astVisitors[name] = visitor; - // if the code generator has already been initialized, - // we need to also register the function with it if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; return this; -} -// register expression functions with ast visitors -expressionFunction('bandwidth', bandwidth, scaleVisitor); -expressionFunction('copy', copy, scaleVisitor); -expressionFunction('domain', domain, scaleVisitor); -expressionFunction('range', range, scaleVisitor); -expressionFunction('invert', invert, scaleVisitor); -expressionFunction('scale', scale, scaleVisitor); -expressionFunction('gradient', scaleGradient, scaleVisitor); -expressionFunction('geoArea', geoArea, scaleVisitor); -expressionFunction('geoBounds', geoBounds, scaleVisitor); -expressionFunction('geoCentroid', geoCentroid, scaleVisitor); -expressionFunction('geoShape', geoShape, scaleVisitor); -expressionFunction('geoScale', geoScale, scaleVisitor); -expressionFunction('indata', indata, indataVisitor); -expressionFunction('data', data, dataVisitor); -expressionFunction('treePath', treePath, dataVisitor); -expressionFunction('treeAncestors', treeAncestors, dataVisitor); -// register Vega-Lite selection functions -expressionFunction('vlSelectionTest', (0, _vegaSelections.selectionTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionIdTest', (0, _vegaSelections.selectionIdTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionResolve', (0, _vegaSelections.selectionResolve), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionTuples', (0, _vegaSelections.selectionTuples)); -function parser(expr, scope) { - const params = {}; - // parse the expression to an abstract syntax tree (ast) + } + expressionFunction("bandwidth", bandwidth, scaleVisitor); + expressionFunction("copy", copy$5, scaleVisitor); + expressionFunction("domain", domain, scaleVisitor); + expressionFunction("range", range$1, scaleVisitor); + expressionFunction("invert", invert$2, scaleVisitor); + expressionFunction("scale", scale$4, scaleVisitor); + expressionFunction("gradient", scaleGradient, scaleVisitor); + expressionFunction("geoArea", geoArea, scaleVisitor); + expressionFunction("geoBounds", geoBounds, scaleVisitor); + expressionFunction("geoCentroid", geoCentroid, scaleVisitor); + expressionFunction("geoShape", geoShape, scaleVisitor); + expressionFunction("geoScale", geoScale, scaleVisitor); + expressionFunction("indata", indata, indataVisitor); + expressionFunction("data", data$2, dataVisitor); + expressionFunction("treePath", treePath, dataVisitor); + expressionFunction("treeAncestors", treeAncestors, dataVisitor); + expressionFunction("vlSelectionTest", selectionTest, selectionVisitor); + expressionFunction("vlSelectionIdTest", selectionIdTest, selectionVisitor); + expressionFunction("vlSelectionResolve", selectionResolve, selectionVisitor); + expressionFunction("vlSelectionTuples", selectionTuples); + function parser(expr2, scope) { + const params2 = {}; let ast; try { - expr = (0, _vegaUtil.isString)(expr) ? expr : (0, _vegaUtil.stringValue)(expr) + ''; - ast = (0, _vegaExpression.parseExpression)(expr); + expr2 = isString(expr2) ? expr2 : $(expr2) + ""; + ast = parser$1(expr2); } catch (err) { - (0, _vegaUtil.error)('Expression parse error: ' + expr); + error("Expression parse error: " + expr2); + } + ast.visit((node) => { + if (node.type !== CallExpression) return; + const name = node.callee.name, visit2 = codegenParams.visitors[name]; + if (visit2) visit2(name, node.arguments, scope, params2); + }); + const gen = codeGenerator(ast); + gen.globals.forEach((name) => { + const signalName = SignalPrefix + name; + if (!has$1(params2, signalName) && scope.getSignal(name)) { + params2[signalName] = scope.signalRef(name); + } + }); + return { + $expr: extend$1({ + code: gen.code + }, scope.options.ast ? { + ast + } : null), + $fields: gen.fields, + $params: params2 + }; + } + function parse$2(spec) { + const ctx = this, operators = spec.operators || []; + if (spec.background) { + ctx.background = spec.background; + } + if (spec.eventConfig) { + ctx.eventConfig = spec.eventConfig; + } + if (spec.locale) { + ctx.locale = spec.locale; + } + operators.forEach((entry2) => ctx.parseOperator(entry2)); + operators.forEach((entry2) => ctx.parseOperatorParameters(entry2)); + (spec.streams || []).forEach((entry2) => ctx.parseStream(entry2)); + (spec.updates || []).forEach((entry2) => ctx.parseUpdate(entry2)); + return ctx.resolve(); + } + const Skip$2 = toSet(["rule"]), Swap = toSet(["group", "image", "rect"]); + function adjustSpatial(encode2, marktype) { + let code = ""; + if (Skip$2[marktype]) return code; + if (encode2.x2) { + if (encode2.x) { + if (Swap[marktype]) { + code += "if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"; + } + code += "o.width=o.x2-o.x;"; + } else { + code += "o.x=o.x2-(o.width||0);"; + } + } + if (encode2.xc) { + code += "o.x=o.xc-(o.width||0)/2;"; + } + if (encode2.y2) { + if (encode2.y) { + if (Swap[marktype]) { + code += "if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"; + } + code += "o.height=o.y2-o.y;"; + } else { + code += "o.y=o.y2-(o.height||0);"; + } + } + if (encode2.yc) { + code += "o.y=o.yc-(o.height||0)/2;"; + } + return code; + } + function canonicalType(type2) { + return (type2 + "").toLowerCase(); + } + function isOperator(type2) { + return canonicalType(type2) === "operator"; + } + function isCollect(type2) { + return canonicalType(type2) === "collect"; + } + function expression(ctx, args, code) { + if (!code.endsWith(";")) { + code = "return(" + code + ");"; + } + const fn2 = Function(...args.concat(code)); + return ctx && ctx.functions ? fn2.bind(ctx.functions) : fn2; + } + function _compare(u2, v, lt, gt) { + return `((u = ${u2}) < (v = ${v}) || u == null) && v != null ? ${lt} + : (u > v || v == null) && u != null ? ${gt} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} + : v !== v && u === u ? ${gt} : `; + } + var expressionCodegen = { + /** + * Parse an expression used to update an operator value. + */ + operator: (ctx, expr2) => expression(ctx, ["_"], expr2.code), + /** + * Parse an expression provided as an operator parameter value. + */ + parameter: (ctx, expr2) => expression(ctx, ["datum", "_"], expr2.code), + /** + * Parse an expression applied to an event stream. + */ + event: (ctx, expr2) => expression(ctx, ["event"], expr2.code), + /** + * Parse an expression used to handle an event-driven operator update. + */ + handler: (ctx, expr2) => { + const code = `var datum=event.item&&event.item.datum;return ${expr2.code};`; + return expression(ctx, ["_", "event"], code); + }, + /** + * Parse an expression that performs visual encoding. + */ + encode: (ctx, encode2) => { + const { + marktype, + channels + } = encode2; + let code = "var o=item,datum=o.datum,m=0,$;"; + for (const name in channels) { + const o = "o[" + $(name) + "]"; + code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; + } + code += adjustSpatial(channels, marktype); + code += "return m;"; + return expression(ctx, ["item", "_"], code); + }, + /** + * Optimized code generators for access and comparison. + */ + codegen: { + get(path2) { + const ref2 = `[${path2.map($).join("][")}]`; + const get2 = Function("_", `return _${ref2};`); + get2.path = ref2; + return get2; + }, + comparator(fields, orders) { + let t; + const map2 = (f, i) => { + const o = orders[i]; + let u2, v; + if (f.path) { + u2 = `a${f.path}`; + v = `b${f.path}`; + } else { + (t = t || {})["f" + i] = f; + u2 = `this.f${i}(a)`; + v = `this.f${i}(b)`; + } + return _compare(u2, v, -o, o); + }; + const fn2 = Function("a", "b", "var u, v; return " + fields.map(map2).join("") + "0;"); + return t ? fn2.bind(t) : fn2; + } + } + }; + function parseOperator(spec) { + const ctx = this; + if (isOperator(spec.type) || !spec.type) { + ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); + } else { + ctx.transform(spec, spec.type); + } + } + function parseOperatorParameters(spec) { + const ctx = this; + if (spec.params) { + const op = ctx.get(spec.id); + if (!op) error("Invalid operator id: " + spec.id); + ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); + } + } + function parseParameters$1(spec, params2) { + params2 = params2 || {}; + const ctx = this; + for (const key2 in spec) { + const value2 = spec[key2]; + params2[key2] = isArray(value2) ? value2.map((v) => parseParameter$2(v, ctx, params2)) : parseParameter$2(value2, ctx, params2); + } + return params2; + } + function parseParameter$2(spec, ctx, params2) { + if (!spec || !isObject$1(spec)) return spec; + for (let i = 0, n = PARSERS.length, p; i < n; ++i) { + p = PARSERS[i]; + if (has$1(spec, p.key)) { + return p.parse(spec, ctx, params2); + } + } + return spec; + } + var PARSERS = [{ + key: "$ref", + parse: getOperator + }, { + key: "$key", + parse: getKey + }, { + key: "$expr", + parse: getExpression + }, { + key: "$field", + parse: getField + }, { + key: "$encode", + parse: getEncode + }, { + key: "$compare", + parse: getCompare + }, { + key: "$context", + parse: getContext + }, { + key: "$subflow", + parse: getSubflow + }, { + key: "$tupleid", + parse: getTupleId + }]; + function getOperator(_, ctx) { + return ctx.get(_.$ref) || error("Operator not defined: " + _.$ref); + } + function getExpression(_, ctx, params2) { + if (_.$params) { + ctx.parseParameters(_.$params, params2); + } + const k = "e:" + _.$expr.code; + return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields)); + } + function getKey(_, ctx) { + const k = "k:" + _.$key + "_" + !!_.$flat; + return ctx.fn[k] || (ctx.fn[k] = key$2(_.$key, _.$flat, ctx.expr.codegen)); + } + function getField(_, ctx) { + if (!_.$field) return null; + const k = "f:" + _.$field + "_" + _.$name; + return ctx.fn[k] || (ctx.fn[k] = field$1(_.$field, _.$name, ctx.expr.codegen)); + } + function getCompare(_, ctx) { + const k = "c:" + _.$compare + "_" + _.$order, c2 = array$5(_.$compare).map((_2) => _2 && _2.$tupleid ? tupleid : _2); + return ctx.fn[k] || (ctx.fn[k] = compare$2(c2, _.$order, ctx.expr.codegen)); + } + function getEncode(_, ctx) { + const spec = _.$encode, encode2 = {}; + for (const name in spec) { + const enc = spec[name]; + encode2[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); + encode2[name].output = enc.$output; + } + return encode2; + } + function getContext(_, ctx) { + return ctx; + } + function getSubflow(_, ctx) { + const spec = _.$subflow; + return function(dataflow, key2, parent) { + const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; + if (p) p.set(parent); + op.detachSubflow = () => ctx.detach(subctx); + return op; + }; + } + function getTupleId() { + return tupleid; + } + function parseStream$2(spec) { + var ctx = this, filter2 = spec.filter != null ? ctx.eventExpression(spec.filter) : void 0, stream2 = spec.stream != null ? ctx.get(spec.stream) : void 0, args; + if (spec.source) { + stream2 = ctx.events(spec.source, spec.type, filter2); + } else if (spec.merge) { + args = spec.merge.map((_) => ctx.get(_)); + stream2 = args[0].merge.apply(args[0], args.slice(1)); + } + if (spec.between) { + args = spec.between.map((_) => ctx.get(_)); + stream2 = stream2.between(args[0], args[1]); + } + if (spec.filter) { + stream2 = stream2.filter(filter2); + } + if (spec.throttle != null) { + stream2 = stream2.throttle(+spec.throttle); + } + if (spec.debounce != null) { + stream2 = stream2.debounce(+spec.debounce); + } + if (stream2 == null) { + error("Invalid stream definition: " + JSON.stringify(spec)); + } + if (spec.consume) stream2.consume(true); + ctx.stream(spec, stream2); + } + function parseUpdate$1(spec) { + var ctx = this, srcid = isObject$1(srcid = spec.source) ? srcid.$ref : srcid, source2 = ctx.get(srcid), target2 = null, update2 = spec.update, params2 = void 0; + if (!source2) error("Source not defined: " + spec.source); + target2 = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); + if (update2 && update2.$expr) { + if (update2.$params) { + params2 = ctx.parseParameters(update2.$params); + } + update2 = ctx.handlerExpression(update2.$expr); + } + ctx.update(spec, source2, target2, update2, params2); + } + const SKIP = { + skip: true + }; + function getState$1(options) { + var ctx = this, state = {}; + if (options.signals) { + var signals = state.signals = {}; + Object.keys(ctx.signals).forEach((key2) => { + const op = ctx.signals[key2]; + if (options.signals(key2, op)) { + signals[key2] = op.value; + } + }); + } + if (options.data) { + var data2 = state.data = {}; + Object.keys(ctx.data).forEach((key2) => { + const dataset = ctx.data[key2]; + if (options.data(key2, dataset)) { + data2[key2] = dataset.input.value; + } + }); + } + if (ctx.subcontext && options.recurse !== false) { + state.subcontext = ctx.subcontext.map((ctx2) => ctx2.getState(options)); + } + return state; + } + function setState$1(state) { + var ctx = this, df = ctx.dataflow, data2 = state.data, signals = state.signals; + Object.keys(signals || {}).forEach((key2) => { + df.update(ctx.signals[key2], signals[key2], SKIP); + }); + Object.keys(data2 || {}).forEach((key2) => { + df.pulse(ctx.data[key2].input, df.changeset().remove(truthy).insert(data2[key2])); + }); + (state.subcontext || []).forEach((substate, i) => { + const subctx = ctx.subcontext[i]; + if (subctx) subctx.setState(substate); + }); + } + function context(df, transforms2, functions, expr2) { + return new Context(df, transforms2, functions, expr2); + } + function Context(df, transforms2, functions, expr2) { + this.dataflow = df; + this.transforms = transforms2; + this.events = df.events.bind(df); + this.expr = expr2 || expressionCodegen, this.signals = {}; + this.scales = {}; + this.nodes = {}; + this.data = {}; + this.fn = {}; + if (functions) { + this.functions = Object.create(functions); + this.functions.context = this; + } + } + function Subcontext(ctx) { + this.dataflow = ctx.dataflow; + this.transforms = ctx.transforms; + this.events = ctx.events; + this.expr = ctx.expr; + this.signals = Object.create(ctx.signals); + this.scales = Object.create(ctx.scales); + this.nodes = Object.create(ctx.nodes); + this.data = Object.create(ctx.data); + this.fn = Object.create(ctx.fn); + if (ctx.functions) { + this.functions = Object.create(ctx.functions); + this.functions.context = this; + } + } + Context.prototype = Subcontext.prototype = { + fork() { + const ctx = new Subcontext(this); + (this.subcontext || (this.subcontext = [])).push(ctx); + return ctx; + }, + detach(ctx) { + this.subcontext = this.subcontext.filter((c2) => c2 !== ctx); + const keys2 = Object.keys(ctx.nodes); + for (const key2 of keys2) ctx.nodes[key2]._targets = null; + for (const key2 of keys2) ctx.nodes[key2].detach(); + ctx.nodes = null; + }, + get(id2) { + return this.nodes[id2]; + }, + set(id2, node) { + return this.nodes[id2] = node; + }, + add(spec, op) { + const ctx = this, df = ctx.dataflow, data2 = spec.value; + ctx.set(spec.id, op); + if (isCollect(spec.type) && data2) { + if (data2.$ingest) { + df.ingest(op, data2.$ingest, data2.$format); + } else if (data2.$request) { + df.preload(op, data2.$request, data2.$format); + } else { + df.pulse(op, df.changeset().insert(data2)); + } + } + if (spec.root) { + ctx.root = op; + } + if (spec.parent) { + let p = ctx.get(spec.parent.$ref); + if (p) { + df.connect(p, [op]); + op.targets().add(p); + } else { + (ctx.unresolved = ctx.unresolved || []).push(() => { + p = ctx.get(spec.parent.$ref); + df.connect(p, [op]); + op.targets().add(p); + }); + } + } + if (spec.signal) { + ctx.signals[spec.signal] = op; + } + if (spec.scale) { + ctx.scales[spec.scale] = op; + } + if (spec.data) { + for (const name in spec.data) { + const data3 = ctx.data[name] || (ctx.data[name] = {}); + spec.data[name].forEach((role) => data3[role] = op); + } + } + }, + resolve() { + (this.unresolved || []).forEach((fn2) => fn2()); + delete this.unresolved; + return this; + }, + operator(spec, update2) { + this.add(spec, this.dataflow.add(spec.value, update2)); + }, + transform(spec, type2) { + this.add(spec, this.dataflow.add(this.transforms[canonicalType(type2)])); + }, + stream(spec, stream2) { + this.set(spec.id, stream2); + }, + update(spec, stream2, target2, update2, params2) { + this.dataflow.on(stream2, target2, update2, params2, spec.options); + }, + // expression parsing + operatorExpression(expr2) { + return this.expr.operator(this, expr2); + }, + parameterExpression(expr2) { + return this.expr.parameter(this, expr2); + }, + eventExpression(expr2) { + return this.expr.event(this, expr2); + }, + handlerExpression(expr2) { + return this.expr.handler(this, expr2); + }, + encodeExpression(encode2) { + return this.expr.encode(this, encode2); + }, + // parse methods + parse: parse$2, + parseOperator, + parseOperatorParameters, + parseParameters: parseParameters$1, + parseStream: parseStream$2, + parseUpdate: parseUpdate$1, + // state methods + getState: getState$1, + setState: setState$1 + }; + function initializeAria(view) { + const el = view.container(); + if (el) { + el.setAttribute("role", "graphics-document"); + el.setAttribute("aria-roleDescription", "visualization"); + ariaLabel(el, view.description()); } - // analyze ast function calls for dependencies - ast.visit((node)=>{ - if (node.type !== (0, _vegaExpression.CallExpression)) return; - const name = node.callee.name, visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); + } + function ariaLabel(el, desc) { + if (el) desc == null ? el.removeAttribute("aria-label") : el.setAttribute("aria-label", desc); + } + function background(view) { + view.add(null, (_) => { + view._background = _.bg; + view._resize = 1; + return _.bg; + }, { + bg: view._signals.background }); - // perform code generation - const gen = codeGenerator(ast); - // collect signal dependencies - gen.globals.forEach((name)=>{ - const signalName = SignalPrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, signalName) && scope.getSignal(name)) params[signalName] = scope.signalRef(name); + } + const Default = "default"; + function cursor(view) { + const cursor2 = view._signals.cursor || (view._signals.cursor = view.add({ + user: Default, + item: null + })); + view.on(view.events("view", "pointermove"), cursor2, (_, event2) => { + const value2 = cursor2.value, user = value2 ? isString(value2) ? value2 : value2.user : Default, item = event2.item && event2.item.cursor || null; + return value2 && user === value2.user && item == value2.item ? value2 : { + user, + item + }; }); - // return generated expression code and dependencies - return { - $expr: (0, _vegaUtil.extend)({ - code: gen.code - }, scope.options.ast ? { - ast - } : null), - $fields: gen.fields, - $params: params - }; -} - -},{"vega-util":"bApja","vega-expression":"2l1no","vega-scale":"bEydG","d3-geo":"lY61T","d3-color":"7SCp9","vega-dataflow":"3NitK","vega-scenegraph":"jattk","vega-selections":"674qo","vega-statistics":"5ncfv","vega-time":"27kpp","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2l1no":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ASTNode", ()=>ASTNode); -parcelHelpers.export(exports, "ArrayExpression", ()=>ArrayExpression); -parcelHelpers.export(exports, "BinaryExpression", ()=>BinaryExpression); -parcelHelpers.export(exports, "CallExpression", ()=>CallExpression); -parcelHelpers.export(exports, "ConditionalExpression", ()=>ConditionalExpression); -parcelHelpers.export(exports, "Identifier", ()=>Identifier); -parcelHelpers.export(exports, "Literal", ()=>Literal); -parcelHelpers.export(exports, "LogicalExpression", ()=>LogicalExpression); -parcelHelpers.export(exports, "MemberExpression", ()=>MemberExpression); -parcelHelpers.export(exports, "ObjectExpression", ()=>ObjectExpression); -parcelHelpers.export(exports, "Property", ()=>Property); -parcelHelpers.export(exports, "RawCode", ()=>RawCode); -parcelHelpers.export(exports, "UnaryExpression", ()=>UnaryExpression); -parcelHelpers.export(exports, "codegenExpression", ()=>codegen); -parcelHelpers.export(exports, "constants", ()=>Constants); -parcelHelpers.export(exports, "functions", ()=>Functions); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -var _vegaUtil = require("vega-util"); -const RawCode = 'RawCode'; -const Literal = 'Literal'; -const Property = 'Property'; -const Identifier = 'Identifier'; -const ArrayExpression = 'ArrayExpression'; -const BinaryExpression = 'BinaryExpression'; -const CallExpression = 'CallExpression'; -const ConditionalExpression = 'ConditionalExpression'; -const LogicalExpression = 'LogicalExpression'; -const MemberExpression = 'MemberExpression'; -const ObjectExpression = 'ObjectExpression'; -const UnaryExpression = 'UnaryExpression'; -function ASTNode(type) { - this.type = type; -} -ASTNode.prototype.visit = function(visitor) { - let c, i, n; - if (visitor(this)) return 1; - for(c = children(this), i = 0, n = c.length; i < n; ++i){ - if (c[i].visit(visitor)) return 1; - } -}; -function children(node) { - switch(node.type){ - case ArrayExpression: - return node.elements; - case BinaryExpression: - case LogicalExpression: - return [ - node.left, - node.right - ]; - case CallExpression: - return [ - node.callee - ].concat(node.arguments); - case ConditionalExpression: - return [ - node.test, - node.consequent, - node.alternate - ]; - case MemberExpression: - return [ - node.object, - node.property - ]; - case ObjectExpression: - return node.properties; - case Property: - return [ - node.key, - node.value - ]; - case UnaryExpression: - return [ - node.argument - ]; - case Identifier: - case Literal: - case RawCode: - default: - return []; - } -} -/* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - - Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com> - Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> - Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com> - Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> - Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> - Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ var TokenName, source, index, length, lookahead; -var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; -TokenName = {}; -TokenName[TokenBooleanLiteral] = 'Boolean'; -TokenName[TokenEOF] = '<end>'; -TokenName[TokenIdentifier] = 'Identifier'; -TokenName[TokenKeyword] = 'Keyword'; -TokenName[TokenNullLiteral] = 'Null'; -TokenName[TokenNumericLiteral] = 'Numeric'; -TokenName[TokenPunctuator] = 'Punctuator'; -TokenName[TokenStringLiteral] = 'String'; -TokenName[TokenRegularExpression] = 'RegularExpression'; -var SyntaxArrayExpression = 'ArrayExpression', SyntaxBinaryExpression = 'BinaryExpression', SyntaxCallExpression = 'CallExpression', SyntaxConditionalExpression = 'ConditionalExpression', SyntaxIdentifier = 'Identifier', SyntaxLiteral = 'Literal', SyntaxLogicalExpression = 'LogicalExpression', SyntaxMemberExpression = 'MemberExpression', SyntaxObjectExpression = 'ObjectExpression', SyntaxProperty = 'Property', SyntaxUnaryExpression = 'UnaryExpression'; -// Error messages should be identical to V8. -var MessageUnexpectedToken = 'Unexpected token %0', MessageUnexpectedNumber = 'Unexpected number', MessageUnexpectedString = 'Unexpected string', MessageUnexpectedIdentifier = 'Unexpected identifier', MessageUnexpectedReserved = 'Unexpected reserved word', MessageUnexpectedEOS = 'Unexpected end of input', MessageInvalidRegExp = 'Invalid regular expression', MessageUnterminatedRegExp = 'Invalid regular expression: missing /', MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; -var ILLEGAL = 'ILLEGAL', DISABLED = 'Disabled.'; -// See also tools/generate-unicode-regex.py. -var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), // eslint-disable-next-line no-misleading-character-class -RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); -// Ensure the condition is true, otherwise throw an error. -// This is only to have a better contract semantic, i.e. another safety net -// to catch a logic error. The condition shall be fulfilled in normal case. -// Do NOT use this to enforce a certain condition on any user input. -function assert(condition, message) { - /* istanbul ignore next */ if (!condition) throw new Error('ASSERT: ' + message); -} -function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 -} -function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.includes(ch); -} -function isOctalDigit(ch) { - return '01234567'.includes(ch); -} -// 7.2 White Space -function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [ - 0x1680, - 0x180E, - 0x2000, - 0x2001, - 0x2002, - 0x2003, - 0x2004, - 0x2005, - 0x2006, - 0x2007, - 0x2008, - 0x2009, - 0x200A, - 0x202F, - 0x205F, - 0x3000, - 0xFEFF - ].includes(ch); -} -// 7.3 Line Terminators -function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; -} -// 7.6 Identifier Names and Identifiers -function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); -} -function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); -} -// 7.6.1.1 Keywords -const keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 -}; -function skipComment() { - while(index < length){ - const ch = source.charCodeAt(index); - if (isWhiteSpace(ch) || isLineTerminator(ch)) ++index; - else break; - } -} -function scanHexEscape(prefix) { - var i, len, ch, code = 0; - len = prefix === 'u' ? 4 : 2; - for(i = 0; i < len; ++i)if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else throwError({}, MessageUnexpectedToken, ILLEGAL); - return String.fromCharCode(code); -} -function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source[index]; - code = 0; - // At least, one hex digit is required. - if (ch === '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - while(index < length){ - ch = source[index++]; - if (!isHexDigit(ch)) break; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - if (code > 0x10FFFF || ch !== '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - // UTF-16 Encoding - if (code <= 0xFFFF) return String.fromCharCode(code); - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); -} -function getEscapedIdentifier() { - var ch, id; - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id = ch; + view.add(null, function(_) { + let user = _.cursor, item = this.value; + if (!isString(user)) { + item = user.item; + user = user.user; + } + setCursor(view, user && user !== Default ? user : item || user); + return item; + }, { + cursor: cursor2 + }); + } + function setCursor(view, cursor2) { + const el = view.globalCursor() ? typeof document !== "undefined" && document.body : view.container(); + if (el) { + return cursor2 == null ? el.style.removeProperty("cursor") : el.style.cursor = cursor2; } - while(index < length){ - ch = source.charCodeAt(index); - if (!isIdentifierPart(ch)) break; - ++index; - id += String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id += ch; - } + } + function dataref(view, name) { + var data2 = view._runtime.data; + if (!has$1(data2, name)) { + error("Unrecognized data set: " + name); } - return id; -} -function getIdentifier() { - var start, ch; - start = index++; - while(index < length){ - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); + return data2[name]; + } + function data$1(name, values2) { + return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values2)); + } + function change(name, changes) { + if (!isChangeSet(changes)) { + error("Second argument to changes must be a changeset."); + } + const dataset = dataref(this, name); + dataset.modified = true; + return this.pulse(dataset.input, changes); + } + function insert(name, _) { + return change.call(this, name, changeset().insert(_)); + } + function remove(name, _) { + return change.call(this, name, changeset().remove(_)); + } + function width(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewWidth + padding2.left + padding2.right); + } + function height(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewHeight + padding2.top + padding2.bottom); + } + function offset(view) { + var padding2 = view.padding(), origin = view._origin; + return [padding2.left + origin[0], padding2.top + origin[1]]; + } + function resizeRenderer(view) { + var origin = offset(view), w2 = width(view), h2 = height(view); + view._renderer.background(view.background()); + view._renderer.resize(w2, h2, origin); + view._handler.origin(origin); + view._resizeListeners.forEach((handler) => { + try { + handler(w2, h2); + } catch (error2) { + view.error(error2); + } + }); + } + function eventExtend(view, event2, item) { + var r = view._renderer, el = r && r.canvas(), p, e, translate2; + if (el) { + translate2 = offset(view); + e = event2.changedTouches ? event2.changedTouches[0] : event2; + p = point(e, el); + p[0] -= translate2[0]; + p[1] -= translate2[1]; + } + event2.dataflow = view; + event2.item = item; + event2.vega = extension(view, item, p); + return event2; + } + function extension(view, item, point2) { + const itemGroup = item ? item.mark.marktype === "group" ? item : item.mark.group : null; + function group2(name) { + var g = itemGroup, i; + if (name) for (i = item; i; i = i.mark.group) { + if (i.mark.name === name) { + g = i; + break; } - if (isIdentifierPart(ch)) ++index; - else break; + } + return g && g.mark && g.mark.interactive ? g : {}; + } + function xy(item2) { + if (!item2) return point2; + if (isString(item2)) item2 = group2(item2); + const p = point2.slice(); + while (item2) { + p[0] -= item2.x || 0; + p[1] -= item2.y || 0; + item2 = item2.mark && item2.mark.group; + } + return p; } - return source.slice(start, index); -} -function scanIdentifier() { - var start, id, type; - start = index; - // Backslash (U+005C) starts an escaped character. - id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) type = TokenIdentifier; - else if (keywords.hasOwnProperty(id)) // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - else if (id === 'null') type = TokenNullLiteral; - else if (id === 'true' || id === 'false') type = TokenBooleanLiteral; - else type = TokenIdentifier; return { - type: type, - value: id, - start: start, - end: index + view: constant$5(view), + item: constant$5(item || {}), + group: group2, + xy, + x: (item2) => xy(item2)[0], + y: (item2) => xy(item2)[1] }; -} -// 7.7 Punctuators -function scanPunctuator() { - var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; - switch(code){ - // Check for most common single-character punctuators. - case 0x2E: - case 0x28: - case 0x29: - case 0x3B: - case 0x2C: - case 0x7B: - case 0x7D: - case 0x5B: - case 0x5D: - case 0x3A: - case 0x3F: - case 0x7E: - // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - default: - code2 = source.charCodeAt(index + 1); - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) switch(code){ - case 0x2B: - case 0x2D: - case 0x2F: - case 0x3C: - case 0x3E: - case 0x5E: - case 0x7C: - case 0x25: - case 0x26: - case 0x2A: - // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - case 0x21: - case 0x3D: - // = - index += 2; - // !== and === - if (source.charCodeAt(index) === 0x3D) ++index; - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - // 4-character punctuator: >>>= - ch4 = source.substr(index, 4); - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - // 3-character punctuators: === !== >>> <<= >>= - ch3 = ch4.substr(0, 3); - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - if (ch1 === ch2[1] && '+-<>&|'.includes(ch1) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; + } + const VIEW$1 = "view", TIMER = "timer", WINDOW = "window", NO_TRAP = { + trap: false + }; + function initializeEventConfig(config) { + const events2 = extend$1({ + defaults: {} + }, config); + const unpack = (obj2, keys2) => { + keys2.forEach((k) => { + if (isArray(obj2[k])) obj2[k] = toSet(obj2[k]); + }); + }; + unpack(events2.defaults, ["prevent", "allow"]); + unpack(events2, ["view", "window", "selector"]); + return events2; + } + function trackEventListener(view, sources, type2, handler) { + view._eventListeners.push({ + type: type2, + sources: array$5(sources), + handler + }); + } + function prevent(view, type2) { + var def2 = view._eventConfig.defaults, prevent2 = def2.prevent, allow = def2.allow; + return prevent2 === false || allow === true ? false : prevent2 === true || allow === false ? true : prevent2 ? prevent2[type2] : allow ? !allow[type2] : view.preventDefault(); + } + function permit(view, key2, type2) { + const rule2 = view._eventConfig && view._eventConfig[key2]; + if (rule2 === false || isObject$1(rule2) && !rule2[type2]) { + view.warn(`Blocked ${key2} ${type2} event listener.`); + return false; } - if (ch2 === '//') throwError({}, MessageUnexpectedToken, ILLEGAL); - // 1-character punctuators: < > = ! + - * % & | ^ / - if ('<>=!+-*%&|^/'.includes(ch1)) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; + return true; + } + function events(source2, type2, filter2) { + var view = this, s = new EventStream(filter2), send = function(e, item) { + view.runAsync(null, () => { + if (source2 === VIEW$1 && prevent(view, type2)) { + e.preventDefault(); + } + s.receive(eventExtend(view, e, item)); + }); + }, sources; + if (source2 === TIMER) { + if (permit(view, "timer", type2)) { + view.timer(send, type2); + } + } else if (source2 === VIEW$1) { + if (permit(view, "view", type2)) { + view.addEventListener(type2, send, NO_TRAP); + } + } else { + if (source2 === WINDOW) { + if (permit(view, "window", type2) && typeof window !== "undefined") { + sources = [window]; + } + } else if (typeof document !== "undefined") { + if (permit(view, "selector", type2)) { + sources = Array.from(document.querySelectorAll(source2)); + } + } + if (!sources) { + view.warn("Can not resolve event source: " + source2); + } else { + for (var i = 0, n = sources.length; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + trackEventListener(view, sources, type2, send); + } } - throwError({}, MessageUnexpectedToken, ILLEGAL); -} -// 7.8.3 Numeric Literals -function scanHexLiteral(start) { - let number = ''; - while(index < length){ - if (!isHexDigit(source[index])) break; - number += source[index++]; - } - if (number.length === 0) throwError({}, MessageUnexpectedToken, ILLEGAL); - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index + return s; + } + function itemFilter(event2) { + return event2.item; + } + function markTarget(event2) { + return event2.item.mark.source; + } + function invoke(name) { + return function(_, event2) { + return event2.vega.view().changeset().encode(event2.item, name); }; -} -function scanOctalLiteral(start) { - let number = '0' + source[index++]; - while(index < length){ - if (!isOctalDigit(source[index])) break; - number += source[index++]; + } + function hover(hoverSet, leaveSet) { + hoverSet = [hoverSet || "hover"]; + leaveSet = [leaveSet || "update", hoverSet[0]]; + this.on(this.events("view", "pointerover", itemFilter), markTarget, invoke(hoverSet)); + this.on(this.events("view", "pointerout", itemFilter), markTarget, invoke(leaveSet)); + return this; + } + function finalize() { + var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m2, e, h2, t; + n = timers.length; + while (--n >= 0) { + timers[n].stop(); } - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; -} -function scanNumericLiteral() { - var number, start, ch; - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) return scanOctalLiteral(start); - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - } - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === '.') { - number += source[index++]; - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === 'e' || ch === 'E') { - number += source[index++]; - ch = source[index]; - if (ch === '+' || ch === '-') number += source[index++]; - if (isDecimalDigit(source.charCodeAt(index))) while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - else throwError({}, MessageUnexpectedToken, ILLEGAL); - } - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; -} -// 7.8.4 String Literals -function scanStringLiteral() { - var str = '', quote, start, ch, code, octal = false; - quote = source[index]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index; - ++index; - while(index < length){ - ch = source[index++]; - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) switch(ch){ - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else str += scanHexEscape(ch); - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - // \0 is not octal escape sequence - if (code !== 0) octal = true; - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.includes(ch) && index < length && isOctalDigit(source[index])) code = code * 8 + '01234567'.indexOf(source[index++]); - } - str += String.fromCharCode(code); - } else str += ch; - break; - } - else if (ch === '\r' && source[index] === '\n') ++index; - } else if (isLineTerminator(ch.charCodeAt(0))) break; - else str += ch; + n = listeners.length; + while (--n >= 0) { + e = listeners[n]; + m2 = e.sources.length; + while (--m2 >= 0) { + e.sources[m2].removeEventListener(e.type, e.handler); + } } - if (quote !== '') throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index - }; -} -function testRegExp(pattern, flags) { - let tmp = pattern; - if (flags.includes('u')) // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1)=>{ - if (parseInt($1, 16) <= 0x10FFFF) return 'x'; - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); + if (tooltip) { + tooltip.call(this, this._handler, null, null, null); } - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; + n = handlers.length; + while (--n >= 0) { + t = handlers[n].type; + h2 = handlers[n].handler; + this._handler.off(t, h2); } -} -function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - classMarker = false; - terminated = false; - while(index < length){ - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - else if (classMarker) { - if (ch === ']') classMarker = false; - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') classMarker = true; + return this; + } + function element(tag, attr2, text2) { + const el = document.createElement(tag); + for (const key2 in attr2) el.setAttribute(key2, attr2[key2]); + if (text2 != null) el.textContent = text2; + return el; + } + const BindClass = "vega-bind", NameClass = "vega-bind-name", RadioClass = "vega-bind-radio"; + function bind(view, el, binding) { + if (!el) return; + const param2 = binding.param; + let bind2 = binding.state; + if (!bind2) { + bind2 = binding.state = { + elements: null, + active: false, + set: null, + update: (value2) => { + if (value2 != view.signal(param2.signal)) { + view.runAsync(null, () => { + bind2.source = true; + view.signal(param2.signal, value2); + }); + } } + }; + if (param2.debounce) { + bind2.update = debounce$1(param2.debounce, bind2.update); + } } - if (!terminated) throwError({}, MessageUnterminatedRegExp); - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; -} -function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - while(index < length){ - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) break; - ++index; - if (ch === '\\' && index < length) throwError({}, MessageUnexpectedToken, ILLEGAL); - else { - flags += ch; - str += ch; - } + const create2 = param2.input == null && param2.element ? target : generate; + create2(bind2, el, param2, view); + if (!bind2.active) { + view.on(view._signals[param2.signal], null, () => { + bind2.source ? bind2.source = false : bind2.set(view.signal(param2.signal)); + }); + bind2.active = true; } - if (flags.search(/[^gimuy]/g) >= 0) throwError({}, MessageInvalidRegExp, flags); - return { - value: flags, - literal: str - }; -} -function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index + return bind2; + } + function target(bind2, node, param2, view) { + const type2 = param2.event || "input"; + const handler = () => bind2.update(node.value); + view.signal(param2.signal, node.value); + node.addEventListener(type2, handler); + trackEventListener(view, node, type2, handler); + bind2.set = (value2) => { + node.value = value2; + node.dispatchEvent(event(type2)); }; -} -function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; -} -function advance() { - skipComment(); - if (index >= length) return { - type: TokenEOF, - start: index, - end: index + } + function event(type2) { + return typeof Event !== "undefined" ? new Event(type2) : { + type: type2 }; - const ch = source.charCodeAt(index); - if (isIdentifierStart(ch)) return scanIdentifier(); - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) return scanPunctuator(); - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) return scanStringLiteral(); - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) return scanNumericLiteral(); - return scanPunctuator(); - } - if (isDecimalDigit(ch)) return scanNumericLiteral(); - return scanPunctuator(); -} -function lex() { - const token = lookahead; - index = token.end; - lookahead = advance(); - index = token.end; - return token; -} -function peek() { - const pos = index; - lookahead = advance(); - index = pos; -} -function finishArrayExpression(elements) { - const node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; -} -function finishBinaryExpression(operator, left, right) { - const node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; -} -function finishCallExpression(callee, args) { - const node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; -} -function finishConditionalExpression(test, consequent, alternate) { - const node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; -} -function finishIdentifier(name) { - const node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; -} -function finishLiteral(token) { - const node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') node.raw = '/(?:)/'; - node.regex = token.regex; + } + function generate(bind2, el, param2, view) { + const value2 = view.signal(param2.signal); + const div = element("div", { + "class": BindClass + }); + const wrapper = param2.input === "radio" ? div : div.appendChild(element("label")); + wrapper.appendChild(element("span", { + "class": NameClass + }, param2.name || param2.signal)); + el.appendChild(div); + let input = form; + switch (param2.input) { + case "checkbox": + input = checkbox; + break; + case "select": + input = select; + break; + case "radio": + input = radio; + break; + case "range": + input = range; + break; } - return node; -} -function finishMemberExpression(accessor, object, property) { - const node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; -} -function finishObjectExpression(properties) { - const node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; -} -function finishProperty(kind, key, value) { - const node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; -} -function finishUnaryExpression(operator, argument) { - const node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; -} -// Throw an exception -function throwError(token, messageFormat) { - var error, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index)=>{ - assert(index < args.length, 'Message reference must be in range'); - return args[index]; - }); - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; -} -// Throw an exception because of the token. -function throwUnexpected(token) { - if (token.type === TokenEOF) throwError(token, MessageUnexpectedEOS); - if (token.type === TokenNumericLiteral) throwError(token, MessageUnexpectedNumber); - if (token.type === TokenStringLiteral) throwError(token, MessageUnexpectedString); - if (token.type === TokenIdentifier) throwError(token, MessageUnexpectedIdentifier); - if (token.type === TokenKeyword) throwError(token, MessageUnexpectedReserved); - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); -} -// Expect the next token to match the specified punctuator. -// If not, an exception will be thrown. -function expect(value) { - const token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) throwUnexpected(token); -} -// Return true if the next token matches the specified punctuator. -function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; -} -// Return true if the next token matches the specified keyword -function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; -} -// 11.1.4 Array Initialiser -function parseArrayInitialiser() { - const elements = []; - index = lookahead.start; - expect('['); - while(!match(']'))if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - if (!match(']')) expect(','); + input(bind2, wrapper, param2, value2); + } + function form(bind2, el, param2, value2) { + const node = element("input"); + for (const key2 in param2) { + if (key2 !== "signal" && key2 !== "element") { + node.setAttribute(key2 === "input" ? "type" : key2, param2[key2]); + } } - lex(); - return finishArrayExpression(elements); -} -// 11.1.5 Object Initialiser -function parseObjectPropertyKey() { - index = lookahead.start; - const token = lex(); - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) throwError(token, MessageStrictOctalLiteral); - return finishLiteral(token); + node.setAttribute("name", param2.signal); + node.value = value2; + el.appendChild(node); + node.addEventListener("input", () => bind2.update(node.value)); + bind2.elements = [node]; + bind2.set = (value3) => node.value = value3; + } + function checkbox(bind2, el, param2, value2) { + const attr2 = { + type: "checkbox", + name: param2.signal + }; + if (value2) attr2.checked = true; + const node = element("input", attr2); + el.appendChild(node); + node.addEventListener("change", () => bind2.update(node.checked)); + bind2.elements = [node]; + bind2.set = (value3) => node.checked = !!value3 || null; + } + function select(bind2, el, param2, value2) { + const node = element("select", { + name: param2.signal + }), labels = param2.labels || []; + param2.options.forEach((option, i) => { + const attr2 = { + value: option + }; + if (valuesEqual(option, value2)) attr2.selected = true; + node.appendChild(element("option", attr2, (labels[i] || option) + "")); + }); + el.appendChild(node); + node.addEventListener("change", () => { + bind2.update(param2.options[node.selectedIndex]); + }); + bind2.elements = [node]; + bind2.set = (value3) => { + for (let i = 0, n = param2.options.length; i < n; ++i) { + if (valuesEqual(param2.options[i], value3)) { + node.selectedIndex = i; + return; + } + } + }; + } + function radio(bind2, el, param2, value2) { + const group2 = element("span", { + "class": RadioClass + }), labels = param2.labels || []; + el.appendChild(group2); + bind2.elements = param2.options.map((option, i) => { + const attr2 = { + type: "radio", + name: param2.signal, + value: option + }; + if (valuesEqual(option, value2)) attr2.checked = true; + const input = element("input", attr2); + input.addEventListener("change", () => bind2.update(option)); + const label2 = element("label", {}, (labels[i] || option) + ""); + label2.prepend(input); + group2.appendChild(label2); + return input; + }); + bind2.set = (value3) => { + const nodes = bind2.elements, n = nodes.length; + for (let i = 0; i < n; ++i) { + if (valuesEqual(nodes[i].value, value3)) nodes[i].checked = true; + } + }; + } + function range(bind2, el, param2, value2) { + value2 = value2 !== void 0 ? value2 : (+param2.max + +param2.min) / 2; + const max2 = param2.max != null ? param2.max : Math.max(100, +value2) || 100, min2 = param2.min || Math.min(0, max2, +value2) || 0, step = param2.step || tickStep(min2, max2, 100); + const node = element("input", { + type: "range", + name: param2.signal, + min: min2, + max: max2, + step + }); + node.value = value2; + const span2 = element("span", {}, +value2); + el.appendChild(node); + el.appendChild(span2); + const update2 = () => { + span2.textContent = node.value; + bind2.update(+node.value); + }; + node.addEventListener("input", update2); + node.addEventListener("change", update2); + bind2.elements = [node]; + bind2.set = (value3) => { + node.value = value3; + span2.textContent = value3; + }; + } + function valuesEqual(a2, b2) { + return a2 === b2 || a2 + "" === b2 + ""; + } + function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { + r = r || new constructor(view.loader()); + return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); + } + function trap(view, fn2) { + return !fn2 ? null : function() { + try { + fn2.apply(this, arguments); + } catch (error2) { + view.error(error2); + } + }; + } + function initializeHandler(view, prevHandler, el, constructor) { + const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); + if (prevHandler) { + prevHandler.handlers().forEach((h2) => { + handler.on(h2.type, h2.handler); + }); } - return finishIdentifier(token.value); -} -function parseObjectProperty() { - var token, key, id, value; - index = lookahead.start; - token = lookahead; - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); + return handler; + } + function initialize(el, elBind) { + const view = this, type2 = view._renderType, config = view._eventConfig.bind, module = renderModule(type2); + el = view._el = el ? lookup$1(view, el, true) : null; + initializeAria(view); + if (!module) view.error("Unrecognized renderer type: " + type2); + const Handler2 = module.handler || CanvasHandler, Renderer2 = el ? module.renderer : module.headless; + view._renderer = !Renderer2 ? null : initializeRenderer(view, view._renderer, el, Renderer2); + view._handler = initializeHandler(view, view._handler, el, Handler2); + view._redraw = true; + if (el && config !== "none") { + elBind = elBind ? view._elBind = lookup$1(view, elBind, true) : el.appendChild(element("form", { + "class": "vega-bindings" + })); + view._bind.forEach((_) => { + if (_.param.element && config !== "container") { + _.element = lookup$1(view, _.param.element, !!_.param.input); + } + }); + view._bind.forEach((_) => { + bind(view, _.element || elBind, _); + }); } - if (token.type === TokenEOF || token.type === TokenPunctuator) throwUnexpected(token); - else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } -} -function parseObjectInitialiser() { - var properties = [], property, name, key, map = {}, toString = String; - index = lookahead.start; - expect('{'); - while(!match('}')){ - property = parseObjectProperty(); - if (property.key.type === SyntaxIdentifier) name = property.key.name; - else name = toString(property.key.value); - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) throwError({}, MessageStrictDuplicateProperty); - else map[key] = true; - properties.push(property); - if (!match('}')) expect(','); - } - expect('}'); - return finishObjectExpression(properties); -} -// 11.1.6 The Grouping Operator -function parseGroupExpression() { - expect('('); - const expr = parseExpression(); - expect(')'); - return expr; -} -// 11.1 Primary Expressions -const legalKeywords = { - 'if': 1 -}; -function parsePrimaryExpression() { - var type, token, expr; - if (match('(')) return parseGroupExpression(); - if (match('[')) return parseArrayInitialiser(); - if (match('{')) return parseObjectInitialiser(); - type = lookahead.type; - index = lookahead.start; - if (type === TokenIdentifier || legalKeywords[lookahead.value]) expr = finishIdentifier(lex().value); - else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) throwError(lookahead, MessageStrictOctalLiteral); - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) throw new Error(DISABLED); - else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else throwUnexpected(lex()); - return expr; -} -// 11.2 Left-Hand-Side Expressions -function parseArguments() { - const args = []; - expect('('); - if (!match(')')) while(index < length){ - args.push(parseConditionalExpression()); - if (match(')')) break; - expect(','); + return view; + } + function lookup$1(view, el, clear) { + if (typeof el === "string") { + if (typeof document !== "undefined") { + el = document.querySelector(el); + if (!el) { + view.error("Signal bind element not found: " + el); + return null; + } + } else { + view.error("DOM document instance not found."); + return null; + } } - expect(')'); - return args; -} -function parseNonComputedProperty() { - index = lookahead.start; - const token = lex(); - if (!isIdentifierName(token)) throwUnexpected(token); - return finishIdentifier(token.value); -} -function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); -} -function parseComputedMember() { - expect('['); - const expr = parseExpression(); - expect(']'); - return expr; -} -function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - for(;;){ - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else break; - } - return expr; -} -// 11.3 Postfix Expressions -function parsePostfixExpression() { - const expr = parseLeftHandSideExpressionAllowCall(); - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) throw new Error(DISABLED); - } - return expr; -} -// 11.4 Unary Operators -function parseUnaryExpression() { - var token, expr; - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) expr = parsePostfixExpression(); - else if (match('++') || match('--')) throw new Error(DISABLED); - else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) throw new Error(DISABLED); - else expr = parsePostfixExpression(); - return expr; -} -function binaryPrecedence(token) { - let prec = 0; - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) return 0; - switch(token.value){ - case '||': - prec = 1; - break; - case '&&': - prec = 2; - break; - case '|': - prec = 3; - break; - case '^': - prec = 4; - break; - case '&': - prec = 5; - break; - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - case '+': - case '-': - prec = 9; - break; - case '*': - case '/': - case '%': - prec = 11; - break; + if (el && clear) { + try { + el.textContent = ""; + } catch (e) { + el = null; + view.error(e); + } } - return prec; -} -// 11.5 Multiplicative Operators -// 11.6 Additive Operators -// 11.7 Bitwise Shift Operators -// 11.8 Relational Operators -// 11.9 Equality Operators -// 11.10 Binary Bitwise Operators -// 11.11 Binary Logical Operators -function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) return left; - token.prec = prec; - lex(); - markers = [ - marker, - lookahead - ]; - right = parseUnaryExpression(); - stack = [ - left, - token, - right - ]; - while((prec = binaryPrecedence(lookahead)) > 0){ - // Reduce: make a binary expression from the three topmost entries. - while(stack.length > 2 && prec <= stack[stack.length - 2].prec){ - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while(i > 1){ - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - return expr; -} -// 11.12 Conditional Operator -function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - return expr; -} -// 11.14 Comma Operator -function parseExpression() { - const expr = parseConditionalExpression(); - if (match(',')) throw new Error(DISABLED); // no sequence expressions - return expr; -} -function parser(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - peek(); - const expr = parseExpression(); - if (lookahead.type !== TokenEOF) throw new Error('Unexpect token after expression.'); - return expr; -} -var Constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' -}; -function Functions(codegen) { - function fncall(name, args, cast, type) { - let obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')'); - } - function fn(name, cast, type) { - return (args)=>fncall(name, args, cast, type); - } - const DATE = 'new Date', STRING = 'String', REGEXP = 'RegExp'; - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - hypot: 'Math.hypot', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - clamp: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to clamp function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to clamp function.'); - const a = args.map(codegen); - return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))'; - }, - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - // sequence functions - length: fn('length', null, -1), - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - trim: fn('trim', STRING, 0), - // base64 encode/decode - btoa: 'btoa', - atob: 'atob', - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - // Control Flow functions - if: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to if function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to if function.'); - const a = args.map(codegen); - return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')'; - } - }; -} -function stripQuotes(s) { - const n = s && s.length - 1; - return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s; -} -function codegen(opt) { - opt = opt || {}; - const allowed = opt.allowed ? (0, _vegaUtil.toSet)(opt.allowed) : {}, forbidden = opt.forbidden ? (0, _vegaUtil.toSet)(opt.forbidden) : {}, constants = opt.constants || Constants, functions = (opt.functions || Functions)(visit), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = (0, _vegaUtil.isFunction)(globalvar) ? globalvar : (id)=>`${globalvar}["${id}"]`; - let globals = {}, fields = {}, memberDepth = 0; - function visit(ast) { - if ((0, _vegaUtil.isString)(ast)) return ast; - const generator = Generators[ast.type]; - if (generator == null) (0, _vegaUtil.error)('Unsupported type: ' + ast.type); - return generator(ast); + return el; + } + const number$1 = (_) => +_ || 0; + const paddingObject$1 = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function padding(_) { + return isObject$1(_) ? { + top: number$1(_.top), + bottom: number$1(_.bottom), + left: number$1(_.left), + right: number$1(_.right) + } : paddingObject$1(number$1(_)); + } + async function renderHeadless(view, type2, scaleFactor, opt) { + const module = renderModule(type2), ctr = module && module.headless; + if (!ctr) error("Unrecognized renderer type: " + type2); + await view.runAsync(); + return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); + } + async function renderToImageURL(type2, scaleFactor) { + if (type2 !== RenderType.Canvas && type2 !== RenderType.SVG && type2 !== RenderType.PNG) { + error("Unrecognized image type: " + type2); } - const Generators = { - Literal: (n)=>n.raw, - Identifier: (n)=>{ - const id = n.name; - if (memberDepth > 0) return id; - else if ((0, _vegaUtil.hasOwnProperty)(forbidden, id)) return (0, _vegaUtil.error)('Illegal identifier: ' + id); - else if ((0, _vegaUtil.hasOwnProperty)(constants, id)) return constants[id]; - else if ((0, _vegaUtil.hasOwnProperty)(allowed, id)) return id; - else { - globals[id] = 1; - return outputGlobal(id); - } - }, - MemberExpression: (n)=>{ - const d = !n.computed, o = visit(n.object); - if (d) memberDepth += 1; - const p = visit(n.property); - if (o === fieldvar) // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - if (d) memberDepth -= 1; - return o + (d ? '.' + p : '[' + p + ']'); - }, - CallExpression: (n)=>{ - if (n.callee.type !== 'Identifier') (0, _vegaUtil.error)('Illegal callee type: ' + n.callee.type); - const callee = n.callee.name, args = n.arguments, fn = (0, _vegaUtil.hasOwnProperty)(functions, callee) && functions[callee]; - if (!fn) (0, _vegaUtil.error)('Unrecognized function: ' + callee); - return (0, _vegaUtil.isFunction)(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')'; - }, - ArrayExpression: (n)=>'[' + n.elements.map(visit).join(',') + ']', - BinaryExpression: (n)=>'(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')', - UnaryExpression: (n)=>'(' + n.operator + visit(n.argument) + ')', - ConditionalExpression: (n)=>'(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')', - LogicalExpression: (n)=>'(' + visit(n.left) + n.operator + visit(n.right) + ')', - ObjectExpression: (n)=>'{' + n.properties.map(visit).join(',') + '}', - Property: (n)=>{ - memberDepth += 1; - const k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - function codegen(ast) { - const result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; + const r = await renderHeadless(this, type2, scaleFactor); + return type2 === RenderType.SVG ? toBlobURL(r.svg(), "image/svg+xml") : r.canvas().toDataURL("image/png"); + } + function toBlobURL(data2, mime) { + const blob = new Blob([data2], { + type: mime + }); + return window.URL.createObjectURL(blob); + } + async function renderToCanvas(scaleFactor, opt) { + const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); + return r.canvas(); + } + async function renderToSVG(scaleFactor) { + const r = await renderHeadless(this, RenderType.SVG, scaleFactor); + return r.svg(); + } + function runtime(view, spec, expr2) { + return context(view, transforms, functionContext, expr2).parse(spec); + } + function scale$3(name) { + var scales2 = this._runtime.scales; + if (!has$1(scales2, name)) { + error("Unrecognized scale or projection: " + name); } - codegen.functions = functions; - codegen.constants = constants; - return codegen; -} - -},{"vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"674qo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "selectionIdTest", ()=>selectionIdTest); -parcelHelpers.export(exports, "selectionResolve", ()=>selectionResolve); -parcelHelpers.export(exports, "selectionTest", ()=>selectionTest); -parcelHelpers.export(exports, "selectionTuples", ()=>selectionTuples); -parcelHelpers.export(exports, "selectionVisitor", ()=>selectionVisitor); -var _d3Array = require("d3-array"); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -// Registers vega-util field accessors to protect against XSS attacks -const SELECTION_GETTER = Symbol('vega_selection_getter'); -function getter(f) { - if (!f.getter || !f.getter[SELECTION_GETTER]) { - f.getter = (0, _vegaUtil.field)(f.field); - f.getter[SELECTION_GETTER] = true; + return scales2[name].value; + } + var Width = "width", Height = "height", Padding = "padding", Skip$1 = { + skip: true + }; + function viewWidth(view, width2) { + var a2 = view.autosize(), p = view.padding(); + return width2 - (a2 && a2.contains === Padding ? p.left + p.right : 0); + } + function viewHeight(view, height2) { + var a2 = view.autosize(), p = view.padding(); + return height2 - (a2 && a2.contains === Padding ? p.top + p.bottom : 0); + } + function initializeResize(view) { + var s = view._signals, w2 = s[Width], h2 = s[Height], p = s[Padding]; + function resetSize() { + view._autosize = view._resize = 1; } - return f.getter; -} -const Intersect = 'intersect'; -const Union = 'union'; -const VlMulti = 'vlMulti'; -const VlPoint = 'vlPoint'; -const Or = 'or'; -const And = 'and'; -const SelectionId = '_vgsid_'; -const $selectionId = (0, _vegaUtil.field)(SelectionId); -const TYPE_ENUM = 'E', TYPE_RANGE_INC = 'R', TYPE_RANGE_EXC = 'R-E', TYPE_RANGE_LE = 'R-LE', TYPE_RANGE_RE = 'R-RE', TYPE_PRED_LT = 'E-LT', TYPE_PRED_LTE = 'E-LTE', TYPE_PRED_GT = 'E-GT', TYPE_PRED_GTE = 'E-GTE', TYPE_PRED_VALID = 'E-VALID', TYPE_PRED_ONE_OF = 'E-ONE', UNIT_INDEX = 'index:unit'; -// TODO: revisit date coercion? -function testPoint(datum, entry) { - var fields = entry.fields, values = entry.values, n = fields.length, i = 0, dval, f; - for(; i < n; ++i){ - f = fields[i]; - dval = getter(f)(datum); - if ((0, _vegaUtil.isDate)(dval)) dval = (0, _vegaUtil.toNumber)(dval); - if ((0, _vegaUtil.isDate)(values[i])) values[i] = (0, _vegaUtil.toNumber)(values[i]); - if ((0, _vegaUtil.isArray)(values[i]) && (0, _vegaUtil.isDate)(values[i][0])) values[i] = values[i].map((0, _vegaUtil.toNumber)); - if (f.type === TYPE_ENUM) { - // Enumerated fields can either specify individual values (single/multi selections) - // or an array of values (interval selections). - if ((0, _vegaUtil.isArray)(values[i]) ? !values[i].includes(dval) : dval !== values[i]) return false; - } else { - if (f.type === TYPE_RANGE_INC) { - if (!(0, _vegaUtil.inrange)(dval, values[i])) return false; - } else if (f.type === TYPE_RANGE_RE) { - // Discrete selection of bins test within the range [bin_start, bin_end). - if (!(0, _vegaUtil.inrange)(dval, values[i], true, false)) return false; - } else if (f.type === TYPE_RANGE_EXC) { - // 'R-E'/'R-LE' included for completeness. - if (!(0, _vegaUtil.inrange)(dval, values[i], false, false)) return false; - } else if (f.type === TYPE_RANGE_LE) { - if (!(0, _vegaUtil.inrange)(dval, values[i], false, true)) return false; - } else if (f.type === TYPE_PRED_LT) { - if (dval >= values[i]) return false; - } else if (f.type === TYPE_PRED_LTE) { - if (dval > values[i]) return false; - } else if (f.type === TYPE_PRED_GT) { - if (dval <= values[i]) return false; - } else if (f.type === TYPE_PRED_GTE) { - if (dval < values[i]) return false; - } else if (f.type === TYPE_PRED_VALID) { - if (dval === null || isNaN(dval)) return false; - } else if (f.type === TYPE_PRED_ONE_OF) { - if (values[i].indexOf(dval) === -1) return false; - } - } + view._resizeWidth = view.add(null, (_) => { + view._width = _.size; + view._viewWidth = viewWidth(view, _.size); + resetSize(); + }, { + size: w2 + }); + view._resizeHeight = view.add(null, (_) => { + view._height = _.size; + view._viewHeight = viewHeight(view, _.size); + resetSize(); + }, { + size: h2 + }); + const resizePadding = view.add(null, resetSize, { + pad: p + }); + view._resizeWidth.rank = w2.rank + 1; + view._resizeHeight.rank = h2.rank + 1; + resizePadding.rank = p.rank + 1; + } + function resizeView(viewWidth2, viewHeight2, width2, height2, origin, auto) { + this.runAfter((view) => { + let rerun2 = 0; + view._autosize = 0; + if (view.width() !== width2) { + rerun2 = 1; + view.signal(Width, width2, Skip$1); + view._resizeWidth.skip(true); + } + if (view.height() !== height2) { + rerun2 = 1; + view.signal(Height, height2, Skip$1); + view._resizeHeight.skip(true); + } + if (view._viewWidth !== viewWidth2) { + view._resize = 1; + view._viewWidth = viewWidth2; + } + if (view._viewHeight !== viewHeight2) { + view._resize = 1; + view._viewHeight = viewHeight2; + } + if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { + view._resize = 1; + view._origin = origin; + } + if (rerun2) view.run("enter"); + if (auto) view.runAfter((v) => v.resize()); + }, false, 1); + } + function getState(options) { + return this._runtime.getState(options || { + data: dataTest, + signals: signalTest, + recurse: true + }); + } + function dataTest(name, data2) { + return data2.modified && isArray(data2.input.value) && !name.startsWith("_:vega:_"); + } + function signalTest(name, op) { + return !(name === "parent" || op instanceof transforms.proxy); + } + function setState(state) { + this.runAsync(null, (v) => { + v._trigger = false; + v._runtime.setState(state); + }, (v) => { + v._trigger = true; + }); + return this; + } + function timer(callback, delay) { + function tick(elapsed) { + callback({ + timestamp: Date.now(), + elapsed + }); } - return true; -} -/** - * Tests if a tuple is contained within an interactive selection. - * @param {string} name - The name of the data set representing the selection. - * Tuples in the dataset are of the form - * {unit: string, fields: array<fielddef>, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ function selectionTest(name, datum, op) { - var data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, n = entries.length, i = 0, entry, miss, count, unit, b; - for(; i < n; ++i){ - entry = entries[i]; - if (unitIdx && intersect) { - // multi selections union within the same unit and intersect across units. - miss = miss || {}; - count = miss[unit = entry.unit] || 0; - // if we've already matched this unit, skip. - if (count === -1) continue; - b = testPoint(datum, entry); - miss[unit] = b ? -1 : ++count; - // if we match and there are no other units return true - // if we've missed against all tuples in this unit return false - if (b && unitIdx.size === 1) return true; - if (!b && count === unitIdx.get(unit).count) return false; - } else { - b = testPoint(datum, entry); - // if we find a miss and we do require intersection return false - // if we find a match and we don't require intersection return true - if (intersect ^ b) return b; - } - } - // if intersecting and we made it here, then we saw no misses - // if not intersecting, then we saw no matches - // if no active selections, return false - return n && intersect; -} -const bisect = (0, _d3Array.bisector)($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; -function selectionIdTest(name, datum, op) { - const data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, value = $selectionId(datum), index = bisectLeft(entries, value); - if (index === entries.length) return false; - if ($selectionId(entries[index]) !== value) return false; - if (unitIdx && intersect) { - if (unitIdx.size === 1) return true; - if (bisectRight(entries, value) - index < unitIdx.size) return false; + this._timers.push(interval(tick, delay)); + } + function defaultTooltip(handler, event2, item, value2) { + const el = handler.element(); + if (el) el.setAttribute("title", formatTooltip(value2)); + } + function formatTooltip(value2) { + return value2 == null ? "" : isArray(value2) ? formatArray(value2) : isObject$1(value2) && !isDate$1(value2) ? formatObject(value2) : value2 + ""; + } + function formatObject(obj2) { + return Object.keys(obj2).map((key2) => { + const v = obj2[key2]; + return key2 + ": " + (isArray(v) ? formatArray(v) : formatValue(v)); + }).join("\n"); + } + function formatArray(value2) { + return "[" + value2.map(formatValue).join(", ") + "]"; + } + function formatValue(value2) { + return isArray(value2) ? "[…]" : isObject$1(value2) && !isDate$1(value2) ? "{…}" : value2; + } + function watchPixelRatio() { + if (this.renderer() === "canvas" && this._renderer._canvas) { + let remove2 = null; + const updatePixelRatio = () => { + if (remove2 != null) { + remove2(); + } + const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); + media.addEventListener("change", updatePixelRatio); + remove2 = () => { + media.removeEventListener("change", updatePixelRatio); + }; + this._renderer._canvas.getContext("2d").pixelRatio = window.devicePixelRatio || 1; + this._redraw = true; + this._resize = 1; + this.resize().runAsync(); + }; + updatePixelRatio(); } - return true; -} -/** - * Maps an array of scene graph items to an array of selection tuples. - * @param {string} name - The name of the dataset representing the selection. - * @param {string} base - The base object that generated tuples extend. - * - * @returns {array} An array of selection entries for the given unit. - */ function selectionTuples(array, base) { - return array.map((x)=>(0, _vegaUtil.extend)(base.fields ? { - values: base.fields.map((f)=>getter(f)(x.datum)) - } : { - [SelectionId]: $selectionId(x.datum) - }, base)); -} -/** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @param {boolean} isMulti - Identifies a "multi" selection to perform more - * expensive resolution computation. - * @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point" - * selections, and thus the resolved tuple should reflect this name. - * This parameter allows us to reflect this change without triggering - * a major version bump for Vega. - * @returns {object} An object of selected fields and values. - */ function selectionResolve(name, op, isMulti, vl5) { - var data = this.context.data[name], entries = data ? data.values.value : [], resolved = {}, multiRes = {}, types = {}, entry, fields, values, unit, field, value, res, resUnit, type, union, n = entries.length, i = 0, j, m; - // First union all entries within the same unit. - for(; i < n; ++i){ - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - if (fields && values) { - // Intentional selection stores - for(j = 0, m = fields.length; j < m; ++j){ - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[`${type}_union`]; - res[unit] = union(resUnit, (0, _vegaUtil.array)(values[j])); - } - // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push((0, _vegaUtil.array)(values).reduce((obj, curr, j)=>(obj[fields[j].field] = curr, obj), {})); - } - } else { - // Short circuit extensional selectionId stores which hold sorted IDs unique to each unit. - field = SelectionId; - value = $selectionId(entry); - res = resolved[field] || (resolved[field] = {}); - resUnit = res[unit] || (res[unit] = []); - resUnit.push(value); - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push({ - [SelectionId]: value - }); - } - } + } + function View$1(spec, options) { + const view = this; + options = options || {}; + Dataflow.call(view); + if (options.loader) view.loader(options.loader); + if (options.logger) view.logger(options.logger); + if (options.logLevel != null) view.logLevel(options.logLevel); + if (options.locale || spec.locale) { + const loc = extend$1({}, spec.locale, options.locale); + view.locale(locale(loc.number, loc.time)); } - // Then resolve fields across units as per the op. - op = op || Union; - if (resolved[SelectionId]) resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); - else Object.keys(resolved).forEach((field)=>{ - resolved[field] = Object.keys(resolved[field]).map((unit)=>resolved[field][unit]).reduce((acc, curr)=>acc === undefined ? curr : ops[`${types[field]}_${op}`](acc, curr)); - }); - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - const key = vl5 ? VlPoint : VlMulti; - resolved[key] = op === Union ? { - [Or]: entries.reduce((acc, k)=>(acc.push(...multiRes[k]), acc), []) - } : { - [And]: entries.map((k)=>({ - [Or]: multiRes[k] - })) - }; + view._el = null; + view._elBind = null; + view._renderType = options.renderer || RenderType.Canvas; + view._scenegraph = new Scenegraph(); + const root = view._scenegraph.root; + view._renderer = null; + view._tooltip = options.tooltip || defaultTooltip, view._redraw = true; + view._handler = new CanvasHandler().scene(root); + view._globalCursor = false; + view._preventDefault = false; + view._timers = []; + view._eventListeners = []; + view._resizeListeners = []; + view._eventConfig = initializeEventConfig(spec.eventConfig); + view.globalCursor(view._eventConfig.globalCursor); + const ctx = runtime(view, spec, options.expr); + view._runtime = ctx; + view._signals = ctx.signals; + view._bind = (spec.bindings || []).map((_) => ({ + state: null, + param: extend$1({}, _) + })); + if (ctx.root) ctx.root.set(root); + root.source = ctx.data.root.input; + view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); + view._width = view.width(); + view._height = view.height(); + view._viewWidth = viewWidth(view, view._width); + view._viewHeight = viewHeight(view, view._height); + view._origin = [0, 0]; + view._resize = 0; + view._autosize = 1; + initializeResize(view); + background(view); + cursor(view); + view.description(spec.description); + if (options.hover) view.hover(); + if (options.container) view.initialize(options.container, options.bind); + if (options.watchPixelRatio) view._watchPixelRatio(); + } + function lookupSignal(view, name) { + return has$1(view._signals, name) ? view._signals[name] : error("Unrecognized signal name: " + $(name)); + } + function findOperatorHandler(op, handler) { + const h2 = (op._targets || []).filter((op2) => op2._update && op2._update.handler === handler); + return h2.length ? h2[0] : null; + } + function addOperatorListener(view, name, op, handler) { + let h2 = findOperatorHandler(op, handler); + if (!h2) { + h2 = trap(view, () => handler(name, op.value)); + h2.handler = handler; + view.on(op, null, h2); } - return resolved; -} -var ops = { - [`${SelectionId}_union`]: (0, _d3Array.union), - [`${SelectionId}_intersect`]: (0, _d3Array.intersection), - E_union: function(base, value) { - if (!base.length) return value; - var i = 0, n = value.length; - for(; i < n; ++i)if (!base.includes(value[i])) base.push(value[i]); - return base; - }, - E_intersect: function(base, value) { - return !base.length ? value : base.filter((v)=>value.includes(v)); - }, - R_union: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; + return view; + } + function removeOperatorListener(view, op, handler) { + const h2 = findOperatorHandler(op, handler); + if (h2) op._targets.remove(h2); + return view; + } + inherits(View$1, Dataflow, { + // -- DATAFLOW / RENDERING ---- + async evaluate(encode2, prerun, postrun) { + await Dataflow.prototype.evaluate.call(this, encode2, prerun); + if (this._redraw || this._resize) { + try { + if (this._renderer) { + if (this._resize) { + this._resize = 0; + resizeRenderer(this); + } + await this._renderer.renderAsync(this._scenegraph.root); + } + this._redraw = false; + } catch (e) { + this.error(e); + } + } + if (postrun) asyncCallback(this, postrun); + return this; }, - R_intersect: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (hi < base[0] || base[1] < lo) return []; - else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } -}; -const DataPrefix = ':', IndexPrefix = '@'; -function selectionVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to selection functions must be a string literal.'); - const data = args[0].value, op = args.length >= 2 && (0, _vegaUtil.peek)(args).value, field = 'unit', indexName = IndexPrefix + field, dataName = DataPrefix + data; - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !(0, _vegaUtil.hasOwnProperty)(params, indexName)) params[indexName] = scope.getData(data).indataRef(scope, field); - // eslint-disable-next-line no-prototype-builtins - if (!(0, _vegaUtil.hasOwnProperty)(params, dataName)) params[dataName] = scope.getData(data).tuplesRef(); -} - -},{"d3-array":"6IwJG","vega-util":"bApja","vega-expression":"2l1no","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k7ppL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "context", ()=>context); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -/** - * Parse a serialized dataflow specification. - */ function parse(spec) { - const ctx = this, operators = spec.operators || []; - // parse background - if (spec.background) ctx.background = spec.background; - // parse event configuration - if (spec.eventConfig) ctx.eventConfig = spec.eventConfig; - // parse locale configuration - if (spec.locale) ctx.locale = spec.locale; - // parse operators - operators.forEach((entry)=>ctx.parseOperator(entry)); - // parse operator parameters - operators.forEach((entry)=>ctx.parseOperatorParameters(entry)); - // parse streams - (spec.streams || []).forEach((entry)=>ctx.parseStream(entry)); - // parse updates - (spec.updates || []).forEach((entry)=>ctx.parseUpdate(entry)); - return ctx.resolve(); -} -const Skip = (0, _vegaUtil.toSet)([ - 'rule' -]), Swap = (0, _vegaUtil.toSet)([ - 'group', - 'image', - 'rect' -]); -function adjustSpatial(encode, marktype) { - let code = ''; - if (Skip[marktype]) return code; - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - code += 'o.width=o.x2-o.x;'; - } else code += 'o.x=o.x2-(o.width||0);'; - } - if (encode.xc) code += 'o.x=o.xc-(o.width||0)/2;'; - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - code += 'o.height=o.y2-o.y;'; - } else code += 'o.y=o.y2-(o.height||0);'; - } - if (encode.yc) code += 'o.y=o.yc-(o.height||0)/2;'; - return code; -} -function canonicalType(type) { - return (type + '').toLowerCase(); -} -function isOperator(type) { - return canonicalType(type) === 'operator'; -} -function isCollect(type) { - return canonicalType(type) === 'collect'; -} -function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (!code.endsWith(';')) code = 'return(' + code + ');'; - const fn = Function(...args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; -} -// generate code for comparing a single field -function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; -} -var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ operator: (ctx, expr)=>expression(ctx, [ - '_' - ], expr.code), - /** - * Parse an expression provided as an operator parameter value. - */ parameter: (ctx, expr)=>expression(ctx, [ - 'datum', - '_' - ], expr.code), - /** - * Parse an expression applied to an event stream. - */ event: (ctx, expr)=>expression(ctx, [ - 'event' - ], expr.code), - /** - * Parse an expression used to handle an event-driven operator update. - */ handler: (ctx, expr)=>{ - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, [ - '_', - 'event' - ], code); + dirty(item) { + this._redraw = true; + this._renderer && this._renderer.dirty(item); }, - /** - * Parse an expression that performs visual encoding. - */ encode: (ctx, encode)=>{ - const { marktype, channels } = encode; - let code = 'var o=item,datum=o.datum,m=0,$;'; - for(const name in channels){ - const o = 'o[' + (0, _vegaUtil.stringValue)(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - return expression(ctx, [ - 'item', - '_' - ], code); + // -- GET / SET ---- + description(text2) { + if (arguments.length) { + const desc = text2 != null ? text2 + "" : null; + if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); + return this; + } + return this._desc; }, - /** - * Optimized code generators for access and comparison. - */ codegen: { - get (path) { - const ref = `[${path.map((0, _vegaUtil.stringValue)).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator (fields, orders) { - let t; - const map = (f, i)=>{ - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f' + i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; - } - } -}; -/** - * Parse a dataflow operator. - */ function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); - else ctx.transform(spec, spec.type); -} -/** - * Parse and assign operator parameters. - */ function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) (0, _vegaUtil.error)('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); - } -} -/** - * Parse a set of operator parameters. - */ function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - for(const key in spec){ - const value = spec[key]; - params[key] = (0, _vegaUtil.isArray)(value) ? value.map((v)=>parseParameter(v, ctx, params)) : parseParameter(value, ctx, params); - } - return params; -} -/** - * Parse a single parameter. - */ function parseParameter(spec, ctx, params) { - if (!spec || !(0, _vegaUtil.isObject)(spec)) return spec; - for(let i = 0, n = PARSERS.length, p; i < n; ++i){ - p = PARSERS[i]; - if ((0, _vegaUtil.hasOwnProperty)(spec, p.key)) return p.parse(spec, ctx, params); - } - return spec; -} -/** Reference parsers. */ var PARSERS = [ - { - key: '$ref', - parse: getOperator + container() { + return this._el; }, - { - key: '$key', - parse: getKey + scenegraph() { + return this._scenegraph; }, - { - key: '$expr', - parse: getExpression + origin() { + return this._origin.slice(); }, - { - key: '$field', - parse: getField + signal(name, value2, options) { + const op = lookupSignal(this, name); + return arguments.length === 1 ? op.value : this.update(op, value2, options); }, - { - key: '$encode', - parse: getEncode + width(_) { + return arguments.length ? this.signal("width", _) : this.signal("width"); }, - { - key: '$compare', - parse: getCompare + height(_) { + return arguments.length ? this.signal("height", _) : this.signal("height"); }, - { - key: '$context', - parse: getContext + padding(_) { + return arguments.length ? this.signal("padding", padding(_)) : padding(this.signal("padding")); }, - { - key: '$subflow', - parse: getSubflow + autosize(_) { + return arguments.length ? this.signal("autosize", _) : this.signal("autosize"); }, - { - key: '$tupleid', - parse: getTupleId - } -]; -/** - * Resolve an operator reference. - */ function getOperator(_, ctx) { - return ctx.get(_.$ref) || (0, _vegaUtil.error)('Operator not defined: ' + _.$ref); -} -/** - * Resolve an expression reference. - */ function getExpression(_, ctx, params) { - if (_.$params) // parse expression parameters - ctx.parseParameters(_.$params, params); - const k = 'e:' + _.$expr.code; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.accessor)(ctx.parameterExpression(_.$expr), _.$fields)); -} -/** - * Resolve a key accessor reference. - */ function getKey(_, ctx) { - const k = 'k:' + _.$key + '_' + !!_.$flat; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.key)(_.$key, _.$flat, ctx.expr.codegen)); -} -/** - * Resolve a field accessor reference. - */ function getField(_, ctx) { - if (!_.$field) return null; - const k = 'f:' + _.$field + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.field)(_.$field, _.$name, ctx.expr.codegen)); -} -/** - * Resolve a comparator function reference. - */ function getCompare(_, ctx) { - // As of Vega 5.5.3, $tupleid sort is no longer used. - // Keep here for now for backwards compatibility. - const k = 'c:' + _.$compare + '_' + _.$order, c = (0, _vegaUtil.array)(_.$compare).map((_)=>_ && _.$tupleid ? (0, _vegaDataflow.tupleid) : _); - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.compare)(c, _.$order, ctx.expr.codegen)); -} -/** - * Resolve an encode operator reference. - */ function getEncode(_, ctx) { - const spec = _.$encode, encode = {}; - for(const name in spec){ - const enc = spec[name]; - encode[name] = (0, _vegaUtil.accessor)(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; -} -/** - * Resolve a context reference. - */ function getContext(_, ctx) { - return ctx; -} -/** - * Resolve a recursive subflow specification. - */ function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = ()=>ctx.detach(subctx); - return op; - }; -} -/** - * Resolve a tuple id reference. - */ function getTupleId() { - return 0, _vegaDataflow.tupleid; -} -/** - * Parse an event stream specification. - */ function parseStream(spec) { - var ctx = this, filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, stream = spec.stream != null ? ctx.get(spec.stream) : undefined, args; - if (spec.source) stream = ctx.events(spec.source, spec.type, filter); - else if (spec.merge) { - args = spec.merge.map((_)=>ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); - } - if (spec.between) { - args = spec.between.map((_)=>ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - if (spec.filter) stream = stream.filter(filter); - if (spec.throttle != null) stream = stream.throttle(+spec.throttle); - if (spec.debounce != null) stream = stream.debounce(+spec.debounce); - if (stream == null) (0, _vegaUtil.error)('Invalid stream definition: ' + JSON.stringify(spec)); - if (spec.consume) stream.consume(true); - ctx.stream(spec, stream); -} -/** - * Parse an event-driven operator update. - */ function parseUpdate(spec) { - var ctx = this, srcid = (0, _vegaUtil.isObject)(srcid = spec.source) ? srcid.$ref : srcid, source = ctx.get(srcid), target = null, update = spec.update, params = undefined; - if (!source) (0, _vegaUtil.error)('Source not defined: ' + spec.source); - target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); - if (update && update.$expr) { - if (update.$params) params = ctx.parseParameters(update.$params); - update = ctx.handlerExpression(update.$expr); - } - ctx.update(spec, source, target, update, params); -} -const SKIP = { - skip: true -}; -function getState(options) { - var ctx = this, state = {}; - if (options.signals) { - var signals = state.signals = {}; - Object.keys(ctx.signals).forEach((key)=>{ - const op = ctx.signals[key]; - if (options.signals(key, op)) signals[key] = op.value; - }); - } - if (options.data) { - var data = state.data = {}; - Object.keys(ctx.data).forEach((key)=>{ - const dataset = ctx.data[key]; - if (options.data(key, dataset)) data[key] = dataset.input.value; - }); - } - if (ctx.subcontext && options.recurse !== false) state.subcontext = ctx.subcontext.map((ctx)=>ctx.getState(options)); - return state; -} -function setState(state) { - var ctx = this, df = ctx.dataflow, data = state.data, signals = state.signals; - Object.keys(signals || {}).forEach((key)=>{ - df.update(ctx.signals[key], signals[key], SKIP); - }); - Object.keys(data || {}).forEach((key)=>{ - df.pulse(ctx.data[key].input, df.changeset().remove((0, _vegaUtil.truthy)).insert(data[key])); - }); - (state.subcontext || []).forEach((substate, i)=>{ - const subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); -} -/** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ function context(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); -} -function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; - } -} -function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } -} -Context.prototype = Subcontext.prototype = { - fork () { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; + background(_) { + return arguments.length ? this.signal("background", _) : this.signal("background"); }, - detach (ctx) { - this.subcontext = this.subcontext.filter((c)=>c !== ctx); - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys)ctx.nodes[key]._targets = null; - for (const key of keys)ctx.nodes[key].detach(); - ctx.nodes = null; + renderer(type2) { + if (!arguments.length) return this._renderType; + if (!renderModule(type2)) error("Unrecognized renderer type: " + type2); + if (type2 !== this._renderType) { + this._renderType = type2; + this._resetRenderer(); + } + return this; }, - get (id) { - return this.nodes[id]; + tooltip(handler) { + if (!arguments.length) return this._tooltip; + if (handler !== this._tooltip) { + this._tooltip = handler; + this._resetRenderer(); + } + return this; }, - set (id, node) { - return this.nodes[id] = node; + loader(loader2) { + if (!arguments.length) return this._loader; + if (loader2 !== this._loader) { + Dataflow.prototype.loader.call(this, loader2); + this._resetRenderer(); + } + return this; }, - add (spec, op) { - const ctx = this, df = ctx.dataflow, data = spec.value; - ctx.set(spec.id, op); - if (isCollect(spec.type) && data) { - if (data.$ingest) df.ingest(op, data.$ingest, data.$format); - else if (data.$request) df.preload(op, data.$request, data.$format); - else df.pulse(op, df.changeset().insert(data)); - } - if (spec.root) ctx.root = op; - if (spec.parent) { - let p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [ - op - ]); - op.targets().add(p); - } else (ctx.unresolved = ctx.unresolved || []).push(()=>{ - p = ctx.get(spec.parent.$ref); - df.connect(p, [ - op - ]); - op.targets().add(p); - }); - } - if (spec.signal) ctx.signals[spec.signal] = op; - if (spec.scale) ctx.scales[spec.scale] = op; - if (spec.data) for(const name in spec.data){ - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach((role)=>data[role] = op); - } + resize() { + this._autosize = 1; + return this.touch(lookupSignal(this, "autosize")); }, - resolve () { - (this.unresolved || []).forEach((fn)=>fn()); - delete this.unresolved; - return this; + _resetRenderer() { + if (this._renderer) { + this._renderer = null; + this.initialize(this._el, this._elBind); + } }, - operator (spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); + // -- SIZING ---- + _resizeView: resizeView, + // -- EVENT HANDLING ---- + addEventListener(type2, handler, options) { + let callback = handler; + if (!(options && options.trap === false)) { + callback = trap(this, handler); + callback.raw = handler; + } + this._handler.on(type2, callback); + return this; + }, + removeEventListener(type2, handler) { + var handlers = this._handler.handlers(type2), i = handlers.length, h2, t; + while (--i >= 0) { + t = handlers[i].type; + h2 = handlers[i].handler; + if (type2 === t && (handler === h2 || handler === h2.raw)) { + this._handler.off(t, h2); + break; + } + } + return this; }, - transform (spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); + addResizeListener(handler) { + const l = this._resizeListeners; + if (!l.includes(handler)) { + l.push(handler); + } + return this; }, - stream (spec, stream) { - this.set(spec.id, stream); + removeResizeListener(handler) { + var l = this._resizeListeners, i = l.indexOf(handler); + if (i >= 0) { + l.splice(i, 1); + } + return this; }, - update (spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); + addSignalListener(name, handler) { + return addOperatorListener(this, name, lookupSignal(this, name), handler); }, - // expression parsing - operatorExpression (expr) { - return this.expr.operator(this, expr); + removeSignalListener(name, handler) { + return removeOperatorListener(this, lookupSignal(this, name), handler); }, - parameterExpression (expr) { - return this.expr.parameter(this, expr); + addDataListener(name, handler) { + return addOperatorListener(this, name, dataref(this, name).values, handler); }, - eventExpression (expr) { - return this.expr.event(this, expr); + removeDataListener(name, handler) { + return removeOperatorListener(this, dataref(this, name).values, handler); }, - handlerExpression (expr) { - return this.expr.handler(this, expr); + globalCursor(_) { + if (arguments.length) { + if (this._globalCursor !== !!_) { + const prev = setCursor(this, null); + this._globalCursor = !!_; + if (prev) setCursor(this, prev); + } + return this; + } else { + return this._globalCursor; + } }, - encodeExpression (encode) { - return this.expr.encode(this, encode); + preventDefault(_) { + if (arguments.length) { + this._preventDefault = _; + return this; + } else { + return this._preventDefault; + } }, - // parse methods - parse, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - // state methods + timer, + events, + finalize, + hover, + // -- DATA ---- + data: data$1, + change, + insert, + remove, + // -- SCALES -- + scale: scale$3, + // -- INITIALIZATION ---- + initialize, + // -- HEADLESS RENDERING ---- + toImageURL: renderToImageURL, + toCanvas: renderToCanvas, + toSVG: renderToSVG, + // -- SAVE / RESTORE STATE ---- getState, - setState -}; - -},{"vega-util":"bApja","vega-dataflow":"3NitK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hsy9Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisDomainRole", ()=>AxisDomainRole); -parcelHelpers.export(exports, "AxisGridRole", ()=>AxisGridRole); -parcelHelpers.export(exports, "AxisLabelRole", ()=>AxisLabelRole); -parcelHelpers.export(exports, "AxisRole", ()=>AxisRole); -parcelHelpers.export(exports, "AxisTickRole", ()=>AxisTickRole); -parcelHelpers.export(exports, "AxisTitleRole", ()=>AxisTitleRole); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -parcelHelpers.export(exports, "FrameRole", ()=>FrameRole); -parcelHelpers.export(exports, "LegendEntryRole", ()=>LegendEntryRole); -parcelHelpers.export(exports, "LegendLabelRole", ()=>LegendLabelRole); -parcelHelpers.export(exports, "LegendRole", ()=>LegendRole); -parcelHelpers.export(exports, "LegendSymbolRole", ()=>LegendSymbolRole); -parcelHelpers.export(exports, "LegendTitleRole", ()=>LegendTitleRole); -parcelHelpers.export(exports, "MarkRole", ()=>MarkRole); -parcelHelpers.export(exports, "Scope", ()=>Scope); -parcelHelpers.export(exports, "ScopeRole", ()=>ScopeRole); -parcelHelpers.export(exports, "config", ()=>defaults); -parcelHelpers.export(exports, "parse", ()=>parse); -parcelHelpers.export(exports, "signal", ()=>parseSignal); -parcelHelpers.export(exports, "signalUpdates", ()=>parseSignalUpdates); -parcelHelpers.export(exports, "stream", ()=>parseStream); -var _vegaUtil = require("vega-util"); -var _vegaFunctions = require("vega-functions"); -var _vegaEventSelector = require("vega-event-selector"); -var _vegaScale = require("vega-scale"); -var _vegaDataflow = require("vega-dataflow"); -function parseAutosize(spec) { - return (0, _vegaUtil.isObject)(spec) ? spec : { - type: spec || 'pad' - }; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ + setState, + // RE-RENDER ON ZOOM + _watchPixelRatio: watchPixelRatio + }); + const VIEW = "view", LBRACK = "[", RBRACK = "]", LBRACE = "{", RBRACE = "}", COLON = ":", COMMA = ",", NAME = "@", GT = ">", ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { + "*": 1, + arc: 1, + area: 1, + group: 1, + image: 1, + line: 1, + path: 1, + rect: 1, + rule: 1, + shape: 1, + symbol: 1, + text: 1, + trail: 1 + }; + let DEFAULT_SOURCE, MARKS; + function eventSelector(selector, source2, marks) { + DEFAULT_SOURCE = source2 || VIEW; + MARKS = marks || DEFAULT_MARKS; + return parseMerge(selector.trim()).map(parseSelector); + } + function isMarkType(type2) { + return MARKS[type2]; + } + function find(s, i, endChar, pushChar, popChar) { + const n = s.length; + let count2 = 0, c2; + for (; i < n; ++i) { + c2 = s[i]; + if (!count2 && c2 === endChar) return i; + else if (popChar && popChar.includes(c2)) --count2; + else if (pushChar && pushChar.includes(c2)) ++count2; + } + return i; + } + function parseMerge(s) { + const output2 = [], n = s.length; + let start = 0, i = 0; + while (i < n) { + i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); + output2.push(s.substring(start, i).trim()); + start = ++i; + } + if (output2.length === 0) { + throw "Empty event selector: " + s; + } + return output2; + } + function parseSelector(s) { + return s[0] === "[" ? parseBetween(s) : parseStream$1(s); + } + function parseBetween(s) { + const n = s.length; + let i = 1, b2; + i = find(s, i, RBRACK, LBRACK, RBRACK); + if (i === n) { + throw "Empty between selector: " + s; + } + b2 = parseMerge(s.substring(1, i)); + if (b2.length !== 2) { + throw "Between selector must have two elements: " + s; + } + s = s.slice(i + 1).trim(); + if (s[0] !== GT) { + throw "Expected '>' after between selector: " + s; + } + b2 = b2.map(parseSelector); + const stream2 = parseSelector(s.slice(1).trim()); + if (stream2.between) { + return { + between: b2, + stream: stream2 + }; + } else { + stream2.between = b2; + } + return stream2; + } + function parseStream$1(s) { + const stream2 = { + source: DEFAULT_SOURCE + }, source2 = []; + let throttle = [0, 0], markname = 0, start = 0, n = s.length, i = 0, j, filter2; + if (s[n - 1] === RBRACE) { + i = s.lastIndexOf(LBRACE); + if (i >= 0) { + try { + throttle = parseThrottle(s.substring(i + 1, n - 1)); + } catch (e) { + throw "Invalid throttle specification: " + s; + } + s = s.slice(0, i).trim(); + n = s.length; + } else throw "Unmatched right brace: " + s; + i = 0; + } + if (!n) throw s; + if (s[0] === NAME) markname = ++i; + j = find(s, i, COLON); + if (j < n) { + source2.push(s.substring(start, j).trim()); + start = i = ++j; + } + i = find(s, i, LBRACK); + if (i === n) { + source2.push(s.substring(start, n).trim()); + } else { + source2.push(s.substring(start, i).trim()); + filter2 = []; + start = ++i; + if (start === n) throw "Unmatched left bracket: " + s; + } + while (i < n) { + i = find(s, i, RBRACK); + if (i === n) throw "Unmatched left bracket: " + s; + filter2.push(s.substring(start, i).trim()); + if (i < n - 1 && s[++i] !== LBRACK) throw "Expected left bracket: " + s; + start = ++i; + } + if (!(n = source2.length) || ILLEGAL.test(source2[n - 1])) { + throw "Invalid event selector: " + s; + } + if (n > 1) { + stream2.type = source2[1]; + if (markname) { + stream2.markname = source2[0].slice(1); + } else if (isMarkType(source2[0])) { + stream2.marktype = source2[0]; + } else { + stream2.source = source2[0]; + } + } else { + stream2.type = source2[0]; + } + if (stream2.type.slice(-1) === "!") { + stream2.consume = true; + stream2.type = stream2.type.slice(0, -1); + } + if (filter2 != null) stream2.filter = filter2; + if (throttle[0]) stream2.throttle = throttle[0]; + if (throttle[1]) stream2.debounce = throttle[1]; + return stream2; + } + function parseThrottle(s) { + const a2 = s.split(COMMA); + if (!s.length || a2.length > 2) throw s; + return a2.map((_) => { + const x2 = +_; + if (x2 !== x2) throw s; + return x2; }); -function parsePadding(spec) { - return !(0, _vegaUtil.isObject)(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { - top: number(spec.top), - bottom: number(spec.bottom), - left: number(spec.left), - right: number(spec.right) - }; -} -const encoder = (_)=>(0, _vegaUtil.isObject)(_) && !(0, _vegaUtil.isArray)(_) ? (0, _vegaUtil.extend)({}, _) : { - value: _ - }; -function addEncode(object, name, value, set) { - if (value != null) { - const isEncoder = (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isArray)(value) || (0, _vegaUtil.isArray)(value) && value.length && (0, _vegaUtil.isObject)(value[0]); - // Always assign signal to update, even if the signal is from the enter block - if (isEncoder) object.update[name] = value; - else object[set || 'enter'][name] = { - value: value + } + function parseAutosize(spec) { + return isObject$1(spec) ? spec : { + type: spec || "pad" + }; + } + const number = (_) => +_ || 0; + const paddingObject = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function parsePadding(spec) { + return !isObject$1(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { + top: number(spec.top), + bottom: number(spec.bottom), + left: number(spec.left), + right: number(spec.right) + }; + } + const encoder = (_) => isObject$1(_) && !isArray(_) ? extend$1({}, _) : { + value: _ + }; + function addEncode(object2, name, value2, set2) { + if (value2 != null) { + const isEncoder = isObject$1(value2) && !isArray(value2) || isArray(value2) && value2.length && isObject$1(value2[0]); + if (isEncoder) { + object2.update[name] = value2; + } else { + object2[set2 || "enter"][name] = { + value: value2 }; - return 1; - } else return 0; -} -function addEncoders(object, enter, update) { - for(const name in enter)addEncode(object, name, enter[name]); - for(const name in update)addEncode(object, name, update[name], 'update'); -} -function extendEncode(encode, extra, skip) { - for(const name in extra){ - if (skip && (0, _vegaUtil.hasOwnProperty)(skip, name)) continue; - encode[name] = (0, _vegaUtil.extend)(encode[name] || {}, extra[name]); - } - return encode; -} -function has(key, encode) { - return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]); -} -const MarkRole = 'mark'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const AxisRole = 'axis'; -const AxisDomainRole = 'axis-domain'; -const AxisGridRole = 'axis-grid'; -const AxisLabelRole = 'axis-label'; -const AxisTickRole = 'axis-tick'; -const AxisTitleRole = 'axis-title'; -const LegendRole = 'legend'; -const LegendBandRole = 'legend-band'; -const LegendEntryRole = 'legend-entry'; -const LegendGradientRole = 'legend-gradient'; -const LegendLabelRole = 'legend-label'; -const LegendSymbolRole = 'legend-symbol'; -const LegendTitleRole = 'legend-title'; -const TitleRole = 'title'; -const TitleTextRole = 'title-text'; -const TitleSubtitleRole = 'title-subtitle'; -function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) applyDefault(defaults, key, config[key]); - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) role = null; - // resolve mark config - props = role === FrameRole ? config.group : role === MarkRole ? (0, _vegaUtil.extend)({}, config.mark, config[type]) : null; - for(key in props){ - // do not apply defaults if relevant fields are defined - skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode)); - if (!skip) applyDefault(defaults, key, props[key]); - } - // resolve styles, apply with increasing precedence - (0, _vegaUtil.array)(style).forEach((name)=>{ - const props = config.style && config.style[name]; - for(const key in props)if (!has(key, encode)) applyDefault(defaults, key, props[key]); + } + return 1; + } else { + return 0; + } + } + function addEncoders(object2, enter, update2) { + for (const name in enter) { + addEncode(object2, name, enter[name]); + } + for (const name in update2) { + addEncode(object2, name, update2[name], "update"); + } + } + function extendEncode(encode2, extra, skip) { + for (const name in extra) { + if (skip && has$1(skip, name)) continue; + encode2[name] = extend$1(encode2[name] || {}, extra[name]); + } + return encode2; + } + function has(key2, encode2) { + return encode2 && (encode2.enter && encode2.enter[key2] || encode2.update && encode2.update[key2]); + } + const MarkRole = "mark"; + const FrameRole = "frame"; + const ScopeRole = "scope"; + const AxisRole = "axis"; + const AxisDomainRole = "axis-domain"; + const AxisGridRole = "axis-grid"; + const AxisLabelRole = "axis-label"; + const AxisTickRole = "axis-tick"; + const AxisTitleRole = "axis-title"; + const LegendRole = "legend"; + const LegendBandRole = "legend-band"; + const LegendEntryRole = "legend-entry"; + const LegendGradientRole = "legend-gradient"; + const LegendLabelRole = "legend-label"; + const LegendSymbolRole = "legend-symbol"; + const LegendTitleRole = "legend-title"; + const TitleRole = "title"; + const TitleTextRole = "title-text"; + const TitleSubtitleRole = "title-subtitle"; + function applyDefaults(encode2, type2, role, style2, config) { + const defaults2 = {}, enter = {}; + let update2, key2, skip, props; + key2 = "lineBreak"; + if (type2 === "text" && config[key2] != null && !has(key2, encode2)) { + applyDefault(defaults2, key2, config[key2]); + } + if (role == "legend" || String(role).startsWith("axis")) { + role = null; + } + props = role === FrameRole ? config.group : role === MarkRole ? extend$1({}, config.mark, config[type2]) : null; + for (key2 in props) { + skip = has(key2, encode2) || (key2 === "fill" || key2 === "stroke") && (has("fill", encode2) || has("stroke", encode2)); + if (!skip) applyDefault(defaults2, key2, props[key2]); + } + array$5(style2).forEach((name) => { + const props2 = config.style && config.style[name]; + for (const key3 in props2) { + if (!has(key3, encode2)) { + applyDefault(defaults2, key3, props2[key3]); + } + } }); - encode = (0, _vegaUtil.extend)({}, encode); // defensive copy - for(key in defaults){ - props = defaults[key]; - if (props.signal) (update = update || {})[key] = props; - else enter[key] = props; - } - encode.enter = (0, _vegaUtil.extend)(enter, encode.enter); - if (update) encode.update = (0, _vegaUtil.extend)(update, encode.update); - return encode; -} -function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal ? { - signal: value.signal + encode2 = extend$1({}, encode2); + for (key2 in defaults2) { + props = defaults2[key2]; + if (props.signal) { + (update2 = update2 || {})[key2] = props; + } else { + enter[key2] = props; + } + } + encode2.enter = extend$1(enter, encode2.enter); + if (update2) encode2.update = extend$1(update2, encode2.update); + return encode2; + } + function applyDefault(defaults2, key2, value2) { + defaults2[key2] = value2 && value2.signal ? { + signal: value2.signal } : { - value: value - }; -} -const scaleRef = (scale)=>(0, _vegaUtil.isString)(scale) ? (0, _vegaUtil.stringValue)(scale) : scale.signal ? `(${scale.signal})` : field(scale); -function entry$1(enc) { - if (enc.gradient != null) return gradient(enc); - let value = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? (0, _vegaUtil.stringValue)(enc.value) : undefined; - if (enc.scale != null) value = scale(enc, value); - if (value === undefined) value = null; - if (enc.exponent != null) value = `pow(${value},${property(enc.exponent)})`; - if (enc.mult != null) value += `*${property(enc.mult)}`; - if (enc.offset != null) value += `+${property(enc.offset)}`; - if (enc.round) value = `round(${value})`; - return value; -} -const _color = (type, x, y, z)=>`(${type}(${[ - x, - y, - z - ].map(entry$1).join(',')})+'')`; -function color(enc) { - return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null; -} -function gradient(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [ - enc.start, - enc.stop, - enc.count - ].map((_)=>_ == null ? null : (0, _vegaUtil.stringValue)(_)); - // trim null inputs from the end - while(args.length && (0, _vegaUtil.peek)(args) == null)args.pop(); + value: value2 + }; + } + const scaleRef = (scale2) => isString(scale2) ? $(scale2) : scale2.signal ? `(${scale2.signal})` : field(scale2); + function entry$1(enc) { + if (enc.gradient != null) { + return gradient(enc); + } + let value2 = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== void 0 ? $(enc.value) : void 0; + if (enc.scale != null) { + value2 = scale$2(enc, value2); + } + if (value2 === void 0) { + value2 = null; + } + if (enc.exponent != null) { + value2 = `pow(${value2},${property(enc.exponent)})`; + } + if (enc.mult != null) { + value2 += `*${property(enc.mult)}`; + } + if (enc.offset != null) { + value2 += `+${property(enc.offset)}`; + } + if (enc.round) { + value2 = `round(${value2})`; + } + return value2; + } + const _color = (type2, x2, y2, z) => `(${type2}(${[x2, y2, z].map(entry$1).join(",")})+'')`; + function color(enc) { + return enc.c ? _color("hcl", enc.h, enc.c, enc.l) : enc.h || enc.s ? _color("hsl", enc.h, enc.s, enc.l) : enc.l || enc.a ? _color("lab", enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color("rgb", enc.r, enc.g, enc.b) : null; + } + function gradient(enc) { + const args = [enc.start, enc.stop, enc.count].map((_) => _ == null ? null : $(_)); + while (args.length && peek$1(args) == null) args.pop(); args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; -} -function property(property) { - return (0, _vegaUtil.isObject)(property) ? '(' + entry$1(property) + ')' : property; -} -function field(ref) { - return resolveField((0, _vegaUtil.isObject)(ref) ? ref : { - datum: ref + return `gradient(${args.join(",")})`; + } + function property(property2) { + return isObject$1(property2) ? "(" + entry$1(property2) + ")" : property2; + } + function field(ref2) { + return resolveField(isObject$1(ref2) ? ref2 : { + datum: ref2 }); -} -function resolveField(ref) { - let object, level, field; - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - while(level-- > 0)object += '.mark.group'; - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else field = ref.group; - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else (0, _vegaUtil.error)('Invalid field reference: ' + (0, _vegaUtil.stringValue)(ref)); - if (!ref.signal) field = (0, _vegaUtil.isString)(field) ? (0, _vegaUtil.splitAccessPath)(field).map((0, _vegaUtil.stringValue)).join('][') : resolveField(field); - return object + '[' + field + ']'; -} -function scale(enc, value) { - const scale = scaleRef(enc.scale); - if (enc.range != null) // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - if (enc.band) { - value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + property(enc.band)); - if (enc.extra) // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - if (value == null) value = '0'; - } - return value; -} -function rule(enc) { - let code = ''; - enc.forEach((rule)=>{ - const value = entry$1(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; + } + function resolveField(ref2) { + let object2, level, field2; + if (ref2.signal) { + object2 = "datum"; + field2 = ref2.signal; + } else if (ref2.group || ref2.parent) { + level = Math.max(1, ref2.level || 1); + object2 = "item"; + while (level-- > 0) { + object2 += ".mark.group"; + } + if (ref2.parent) { + field2 = ref2.parent; + object2 += ".datum"; + } else { + field2 = ref2.group; + } + } else if (ref2.datum) { + object2 = "datum"; + field2 = ref2.datum; + } else { + error("Invalid field reference: " + $(ref2)); + } + if (!ref2.signal) { + field2 = isString(field2) ? splitAccessPath(field2).map($).join("][") : resolveField(field2); + } + return object2 + "[" + field2 + "]"; + } + function scale$2(enc, value2) { + const scale2 = scaleRef(enc.scale); + if (enc.range != null) { + value2 = `lerp(_range(${scale2}), ${+enc.range})`; + } else { + if (value2 !== void 0) value2 = `_scale(${scale2}, ${value2})`; + if (enc.band) { + value2 = (value2 ? value2 + "+" : "") + `_bandwidth(${scale2})` + (+enc.band === 1 ? "" : "*" + property(enc.band)); + if (enc.extra) { + value2 = `(datum.extra ? _scale(${scale2}, datum.extra.value) : ${value2})`; + } + } + if (value2 == null) value2 = "0"; + } + return value2; + } + function rule(enc) { + let code = ""; + enc.forEach((rule2) => { + const value2 = entry$1(rule2); + code += rule2.test ? `(${rule2.test})?${value2}:` : value2; }); - // if no else clause, terminate with null (#1366) - if ((0, _vegaUtil.peek)(code) === ':') code += 'null'; + if (peek$1(code) === ":") { + code += "null"; + } return code; -} -function parseEncode(encode, type, role, style, scope, params) { + } + function parseEncode(encode2, type2, role, style2, scope, params2) { const enc = {}; - params = params || {}; - params.encoders = { - $encode: enc - }; - encode = applyDefaults(encode, type, role, style, scope.config); - for(const key in encode)enc[key] = parseBlock(encode[key], type, params, scope); - return params; -} -function parseBlock(block, marktype, params, scope) { + params2 = params2 || {}; + params2.encoders = { + $encode: enc + }; + encode2 = applyDefaults(encode2, type2, role, style2, scope.config); + for (const key2 in encode2) { + enc[key2] = parseBlock(encode2[key2], type2, params2, scope); + } + return params2; + } + function parseBlock(block, marktype, params2, scope) { const channels = {}, fields = {}; - for(const name in block)if (block[name] != null) // skip any null entries - channels[name] = parse$1(expr(block[name]), scope, params, fields); + for (const name in block) { + if (block[name] != null) { + channels[name] = parse$1(expr(block[name]), scope, params2, fields); + } + } return { - $expr: { - marktype, - channels - }, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; -} -function expr(enc) { - return (0, _vegaUtil.isArray)(enc) ? rule(enc) : entry$1(enc); -} -function parse$1(code, scope, params, fields) { - const expr = (0, _vegaFunctions.parseExpression)(code, scope); - expr.$fields.forEach((name)=>fields[name] = 1); - (0, _vegaUtil.extend)(params, expr.$params); - return expr.$expr; -} -const OUTER = 'outer', OUTER_INVALID = [ - 'value', - 'update', - 'init', - 'react', - 'bind' -]; -function outerError(prefix, name) { - (0, _vegaUtil.error)(prefix + ' for "outer" push: ' + (0, _vegaUtil.stringValue)(name)); -} -function parseSignal(signal, scope) { + $expr: { + marktype, + channels + }, + $fields: Object.keys(fields), + $output: Object.keys(block) + }; + } + function expr(enc) { + return isArray(enc) ? rule(enc) : entry$1(enc); + } + function parse$1(code, scope, params2, fields) { + const expr2 = parser(code, scope); + expr2.$fields.forEach((name) => fields[name] = 1); + extend$1(params2, expr2.$params); + return expr2.$expr; + } + const OUTER = "outer", OUTER_INVALID = ["value", "update", "init", "react", "bind"]; + function outerError(prefix, name) { + error(prefix + ' for "outer" push: ' + $(name)); + } + function parseSignal(signal, scope) { const name = signal.name; if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach((prop)=>{ - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); + if (!scope.signals[name]) outerError("No prior signal definition", name); + OUTER_INVALID.forEach((prop) => { + if (signal[prop] !== void 0) outerError("Invalid property ", prop); + }); } else { - // define a new signal in the current scope - const op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); + const op = scope.addSignal(name, signal.value); + if (signal.react === false) op.react = false; + if (signal.bind) scope.addBinding(name, signal.bind); } -} -function Entry(type, value, params, parent) { + } + function Entry(type2, value2, params2, parent) { this.id = -1; - this.type = type; - this.value = value; - this.params = params; + this.type = type2; + this.value = value2; + this.params = params2; if (parent) this.parent = parent; -} -function entry(type, value, params, parent) { - return new Entry(type, value, params, parent); -} -function operator(value, params) { - return entry('operator', value, params); -} -// ----- -function ref(op) { - const ref = { - $ref: op.id - }; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; -} -function fieldRef$1(field, name) { + } + function entry(type2, value2, params2, parent) { + return new Entry(type2, value2, params2, parent); + } + function operator(value2, params2) { + return entry("operator", value2, params2); + } + function ref(op) { + const ref2 = { + $ref: op.id + }; + if (op.id < 0) (op.refs = op.refs || []).push(ref2); + return ref2; + } + function fieldRef$1(field2, name) { return name ? { - $field: field, - $name: name + $field: field2, + $name: name } : { - $field: field + $field: field2 }; -} -const keyFieldRef = fieldRef$1('key'); -function compareRef(fields, orders) { + } + const keyFieldRef = fieldRef$1("key"); + function compareRef(fields, orders) { return { - $compare: fields, - $order: orders - }; -} -function keyRef(fields, flat) { - const ref = { - $key: fields - }; - if (flat) ref.$flat = true; - return ref; -} -// ----- -const Ascending = 'ascending'; -const Descending = 'descending'; -function sortKey(sort) { - return !(0, _vegaUtil.isObject)(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field); -} -function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || ''); -} -// ----- -const Scope$1 = 'scope'; -const View = 'view'; -function isSignal(_) { + $compare: fields, + $order: orders + }; + } + function keyRef(fields, flat) { + const ref2 = { + $key: fields + }; + if (flat) ref2.$flat = true; + return ref2; + } + const Ascending = "ascending"; + const Descending = "descending"; + function sortKey(sort2) { + return !isObject$1(sort2) ? "" : (sort2.order === Descending ? "-" : "+") + aggrField(sort2.op, sort2.field); + } + function aggrField(op, field2) { + return (op && op.signal ? "$" + op.signal : op || "") + (op && field2 ? "_" : "") + (field2 && field2.signal ? "$" + field2.signal : field2 || ""); + } + const Scope$1 = "scope"; + const View = "view"; + function isSignal(_) { return _ && _.signal; -} -function isExpr$1(_) { + } + function isExpr$1(_) { return _ && _.expr; -} -function hasSignal(_) { + } + function hasSignal(_) { if (isSignal(_)) return true; - if ((0, _vegaUtil.isObject)(_)) for(const key in _){ - if (hasSignal(_[key])) return true; + if (isObject$1(_)) for (const key2 in _) { + if (hasSignal(_[key2])) return true; } return false; -} -function value(specValue, defaultValue) { + } + function value(specValue, defaultValue) { return specValue != null ? specValue : defaultValue; -} -function deref(v) { + } + function deref(v) { return v && v.signal || v; -} -const Timer = 'timer'; -function parseStream(stream, scope) { - const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : (0, _vegaUtil.error)('Invalid stream specification: ' + (0, _vegaUtil.stringValue)(stream)); - return method(stream, scope); -} -function eventSource(source) { - return source === Scope$1 ? View : source || View; -} -function mergeStream(stream, scope) { - const list = stream.merge.map((s)=>parseStream(s, scope)), entry = streamParameters({ - merge: list - }, stream, scope); - return scope.addStream(entry).id; -} -function nestedStream(stream, scope) { - const id = parseStream(stream.stream, scope), entry = streamParameters({ - stream: id - }, stream, scope); - return scope.addStream(entry).id; -} -function eventStream(stream, scope) { - let id; - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = { - between: stream.between, - filter: stream.filter - }; - } else id = scope.event(eventSource(stream.source), stream.type); - const entry = streamParameters({ - stream: id - }, stream, scope); - return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id; -} -function streamParameters(entry, stream, scope) { - let param = stream.between; - if (param) { - if (param.length !== 2) (0, _vegaUtil.error)('Stream "between" parameter must have 2 entries: ' + (0, _vegaUtil.stringValue)(stream)); - entry.between = [ - parseStream(param[0], scope), - parseStream(param[1], scope) - ]; - } - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - if (stream.source === Scope$1) // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - if (param.length) entry.filter = (0, _vegaFunctions.parseExpression)('(' + param.join(')&&(') + ')', scope).$expr; - if ((param = stream.throttle) != null) entry.throttle = +param; - if ((param = stream.debounce) != null) entry.debounce = +param; - if (stream.consume) entry.consume = true; - return entry; -} -function filterMark(type, name, role) { - const item = 'event.item'; - return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); -} -// bypass expression parser for internal operator references -const OP_VALUE_EXPR = { - code: '_.$value', + } + const Timer = "timer"; + function parseStream(stream2, scope) { + const method2 = stream2.merge ? mergeStream : stream2.stream ? nestedStream : stream2.type ? eventStream : error("Invalid stream specification: " + $(stream2)); + return method2(stream2, scope); + } + function eventSource(source2) { + return source2 === Scope$1 ? View : source2 || View; + } + function mergeStream(stream2, scope) { + const list = stream2.merge.map((s) => parseStream(s, scope)), entry2 = streamParameters({ + merge: list + }, stream2, scope); + return scope.addStream(entry2).id; + } + function nestedStream(stream2, scope) { + const id2 = parseStream(stream2.stream, scope), entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return scope.addStream(entry2).id; + } + function eventStream(stream2, scope) { + let id2; + if (stream2.type === Timer) { + id2 = scope.event(Timer, stream2.throttle); + stream2 = { + between: stream2.between, + filter: stream2.filter + }; + } else { + id2 = scope.event(eventSource(stream2.source), stream2.type); + } + const entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return Object.keys(entry2).length === 1 ? id2 : scope.addStream(entry2).id; + } + function streamParameters(entry2, stream2, scope) { + let param2 = stream2.between; + if (param2) { + if (param2.length !== 2) { + error('Stream "between" parameter must have 2 entries: ' + $(stream2)); + } + entry2.between = [parseStream(param2[0], scope), parseStream(param2[1], scope)]; + } + param2 = stream2.filter ? [].concat(stream2.filter) : []; + if (stream2.marktype || stream2.markname || stream2.markrole) { + param2.push(filterMark(stream2.marktype, stream2.markname, stream2.markrole)); + } + if (stream2.source === Scope$1) { + param2.push("inScope(event.item)"); + } + if (param2.length) { + entry2.filter = parser("(" + param2.join(")&&(") + ")", scope).$expr; + } + if ((param2 = stream2.throttle) != null) { + entry2.throttle = +param2; + } + if ((param2 = stream2.debounce) != null) { + entry2.debounce = +param2; + } + if (stream2.consume) { + entry2.consume = true; + } + return entry2; + } + function filterMark(type2, name, role) { + const item = "event.item"; + return item + (type2 && type2 !== "*" ? "&&" + item + ".mark.marktype==='" + type2 + "'" : "") + (role ? "&&" + item + ".mark.role==='" + role + "'" : "") + (name ? "&&" + item + ".mark.name==='" + name + "'" : ""); + } + const OP_VALUE_EXPR = { + code: "_.$value", ast: { - type: 'Identifier', - value: 'value' - } -}; -function parseUpdate(spec, scope, target) { - const encode = spec.encode, entry = { - target: target - }; - let events = spec.events, update = spec.update, sources = []; - if (!events) (0, _vegaUtil.error)('Signal update missing events specification.'); - // interpret as an event selector string - if ((0, _vegaUtil.isString)(events)) events = (0, _vegaEventSelector.parseSelector)(events, scope.isSubscope() ? Scope$1 : View); - // separate event streams from signal updates - events = (0, _vegaUtil.array)(events).filter((s)=>s.signal || s.scale ? (sources.push(s), 0) : 1); - // merge internal operator listeners - if (sources.length > 1) sources = [ - mergeSources(sources) - ]; - // merge event streams, include as source - if (events.length) sources.push(events.length > 1 ? { - merge: events - } : events[0]); - if (encode != null) { - if (update) (0, _vegaUtil.error)('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + (0, _vegaUtil.stringValue)(encode) + ')'; - } - // resolve update value - entry.update = (0, _vegaUtil.isString)(update) ? (0, _vegaFunctions.parseExpression)(update, scope) : update.expr != null ? (0, _vegaFunctions.parseExpression)(update.expr, scope) : update.value != null ? update.value : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: { - $value: scope.signalRef(update.signal) - } - } : (0, _vegaUtil.error)('Invalid signal update specification.'); - if (spec.force) entry.options = { + type: "Identifier", + value: "value" + } + }; + function parseUpdate(spec, scope, target2) { + const encode2 = spec.encode, entry2 = { + target: target2 + }; + let events2 = spec.events, update2 = spec.update, sources = []; + if (!events2) { + error("Signal update missing events specification."); + } + if (isString(events2)) { + events2 = eventSelector(events2, scope.isSubscope() ? Scope$1 : View); + } + events2 = array$5(events2).filter((s) => s.signal || s.scale ? (sources.push(s), 0) : 1); + if (sources.length > 1) { + sources = [mergeSources(sources)]; + } + if (events2.length) { + sources.push(events2.length > 1 ? { + merge: events2 + } : events2[0]); + } + if (encode2 != null) { + if (update2) error("Signal encode and update are mutually exclusive."); + update2 = "encode(item()," + $(encode2) + ")"; + } + entry2.update = isString(update2) ? parser(update2, scope) : update2.expr != null ? parser(update2.expr, scope) : update2.value != null ? update2.value : update2.signal != null ? { + $expr: OP_VALUE_EXPR, + $params: { + $value: scope.signalRef(update2.signal) + } + } : error("Invalid signal update specification."); + if (spec.force) { + entry2.options = { force: true - }; - sources.forEach((source)=>scope.addUpdate((0, _vegaUtil.extend)(streamSource(source, scope), entry))); -} -function streamSource(stream, scope) { + }; + } + sources.forEach((source2) => scope.addUpdate(extend$1(streamSource(source2, scope), entry2))); + } + function streamSource(stream2, scope) { return { - source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream(stream, scope) + source: stream2.signal ? scope.signalRef(stream2.signal) : stream2.scale ? scope.scaleRef(stream2.scale) : parseStream(stream2, scope) }; -} -function mergeSources(sources) { + } + function mergeSources(sources) { return { - signal: '[' + sources.map((s)=>s.scale ? 'scale("' + s.scale + '")' : s.signal) + ']' + signal: "[" + sources.map((s) => s.scale ? 'scale("' + s.scale + '")' : s.signal) + "]" }; -} -function parseSignalUpdates(signal, scope) { + } + function parseSignalUpdates(signal, scope) { const op = scope.getSignal(signal.name); - let expr = signal.update; + let expr2 = signal.update; if (signal.init) { - if (expr) (0, _vegaUtil.error)('Signals can not include both init and update expressions.'); - else { - expr = signal.init; - op.initonly = true; - } - } - if (expr) { - expr = (0, _vegaFunctions.parseExpression)(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - if (signal.on) signal.on.forEach((_)=>parseUpdate(_, scope, op.id)); -} -const transform = (name)=>(params, value, parent)=>entry(name, value, params || undefined, parent); -const Aggregate = transform('aggregate'); -const AxisTicks = transform('axisticks'); -const Bound = transform('bound'); -const Collect = transform('collect'); -const Compare = transform('compare'); -const DataJoin = transform('datajoin'); -const Encode = transform('encode'); -const Expression = transform('expression'); -const Facet = transform('facet'); -const Field = transform('field'); -const Key = transform('key'); -const LegendEntries = transform('legendentries'); -const Load = transform('load'); -const Mark = transform('mark'); -const MultiExtent = transform('multiextent'); -const MultiValues = transform('multivalues'); -const Overlap = transform('overlap'); -const Params = transform('params'); -const PreFacet = transform('prefacet'); -const Projection = transform('projection'); -const Proxy = transform('proxy'); -const Relay = transform('relay'); -const Render = transform('render'); -const Scale = transform('scale'); -const Sieve = transform('sieve'); -const SortItems = transform('sortitems'); -const ViewLayout = transform('viewlayout'); -const Values = transform('values'); -let FIELD_REF_ID = 0; -const MULTIDOMAIN_SORT_OPS = { - min: 'min', - max: 'max', - count: 'sum' -}; -function initScale(spec, scope) { - const type = spec.type || 'linear'; - if (!(0, _vegaScale.isValidScaleType)(type)) (0, _vegaUtil.error)('Unrecognized scale type: ' + (0, _vegaUtil.stringValue)(type)); + if (expr2) { + error("Signals can not include both init and update expressions."); + } else { + expr2 = signal.init; + op.initonly = true; + } + } + if (expr2) { + expr2 = parser(expr2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + if (signal.on) { + signal.on.forEach((_) => parseUpdate(_, scope, op.id)); + } + } + const transform = (name) => (params2, value2, parent) => entry(name, value2, params2 || void 0, parent); + const Aggregate = transform("aggregate"); + const AxisTicks = transform("axisticks"); + const Bound = transform("bound"); + const Collect = transform("collect"); + const Compare = transform("compare"); + const DataJoin = transform("datajoin"); + const Encode = transform("encode"); + const Expression = transform("expression"); + const Facet = transform("facet"); + const Field = transform("field"); + const Key = transform("key"); + const LegendEntries = transform("legendentries"); + const Load = transform("load"); + const Mark = transform("mark"); + const MultiExtent = transform("multiextent"); + const MultiValues = transform("multivalues"); + const Overlap = transform("overlap"); + const Params = transform("params"); + const PreFacet = transform("prefacet"); + const Projection = transform("projection"); + const Proxy = transform("proxy"); + const Relay = transform("relay"); + const Render = transform("render"); + const Scale = transform("scale"); + const Sieve = transform("sieve"); + const SortItems = transform("sortitems"); + const ViewLayout = transform("viewlayout"); + const Values = transform("values"); + let FIELD_REF_ID = 0; + const MULTIDOMAIN_SORT_OPS = { + min: "min", + max: "max", + count: "sum" + }; + function initScale(spec, scope) { + const type2 = spec.type || "linear"; + if (!isValidScaleType(type2)) { + error("Unrecognized scale type: " + $(type2)); + } scope.addScale(spec.name, { - type, - domain: undefined + type: type2, + domain: void 0 }); -} -function parseScale(spec, scope) { - const params = scope.getScale(spec.name).params; - let key; - params.domain = parseScaleDomain(spec.domain, spec, scope); - if (spec.range != null) params.range = parseScaleRange(spec, scope, params); - if (spec.interpolate != null) parseScaleInterpolate(spec.interpolate, params); - if (spec.nice != null) params.nice = parseScaleNice(spec.nice, scope); - if (spec.bins != null) params.bins = parseScaleBins(spec.bins, scope); - for(key in spec){ - if ((0, _vegaUtil.hasOwnProperty)(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } -} -function parseLiteral(v, scope) { - return !(0, _vegaUtil.isObject)(v) ? v : v.signal ? scope.signalRef(v.signal) : (0, _vegaUtil.error)('Unsupported object: ' + (0, _vegaUtil.stringValue)(v)); -} -function parseArray(v, scope) { - return v.signal ? scope.signalRef(v.signal) : v.map((v)=>parseLiteral(v, scope)); -} -function dataLookupError(name) { - (0, _vegaUtil.error)('Can not find data set: ' + (0, _vegaUtil.stringValue)(name)); -} -// -- SCALE DOMAIN ---- -function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) (0, _vegaUtil.error)('No scale domain defined for domainMin/domainMax to override.'); - return; // default domain - } - return domain.signal ? scope.signalRef(domain.signal) : ((0, _vegaUtil.isArray)(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope); -} -function explicitDomain(domain, spec, scope) { - return domain.map((v)=>parseLiteral(v, scope)); -} -function singularDomain(domain, spec, scope) { - const data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - return (0, _vegaScale.isDiscrete)(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : (0, _vegaScale.isQuantile)(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field); -} -function multipleDomain(domain, spec, scope) { - const data = domain.data, fields = domain.fields.reduce((dom, d)=>{ - d = (0, _vegaUtil.isString)(d) ? { - data: data, - field: d - } : (0, _vegaUtil.isArray)(d) || d.signal ? fieldRef(d, scope) : d; - dom.push(d); - return dom; + } + function parseScale(spec, scope) { + const params2 = scope.getScale(spec.name).params; + let key2; + params2.domain = parseScaleDomain(spec.domain, spec, scope); + if (spec.range != null) { + params2.range = parseScaleRange(spec, scope, params2); + } + if (spec.interpolate != null) { + parseScaleInterpolate(spec.interpolate, params2); + } + if (spec.nice != null) { + params2.nice = parseScaleNice(spec.nice, scope); + } + if (spec.bins != null) { + params2.bins = parseScaleBins(spec.bins, scope); + } + for (key2 in spec) { + if (has$1(params2, key2) || key2 === "name") continue; + params2[key2] = parseLiteral(spec[key2], scope); + } + } + function parseLiteral(v, scope) { + return !isObject$1(v) ? v : v.signal ? scope.signalRef(v.signal) : error("Unsupported object: " + $(v)); + } + function parseArray(v, scope) { + return v.signal ? scope.signalRef(v.signal) : v.map((v2) => parseLiteral(v2, scope)); + } + function dataLookupError(name) { + error("Can not find data set: " + $(name)); + } + function parseScaleDomain(domain2, spec, scope) { + if (!domain2) { + if (spec.domainMin != null || spec.domainMax != null) { + error("No scale domain defined for domainMin/domainMax to override."); + } + return; + } + return domain2.signal ? scope.signalRef(domain2.signal) : (isArray(domain2) ? explicitDomain : domain2.fields ? multipleDomain : singularDomain)(domain2, spec, scope); + } + function explicitDomain(domain2, spec, scope) { + return domain2.map((v) => parseLiteral(v, scope)); + } + function singularDomain(domain2, spec, scope) { + const data2 = scope.getData(domain2.data); + if (!data2) dataLookupError(domain2.data); + return isDiscrete(spec.type) ? data2.valuesRef(scope, domain2.field, parseSort(domain2.sort, false)) : isQuantile(spec.type) ? data2.domainRef(scope, domain2.field) : data2.extentRef(scope, domain2.field); + } + function multipleDomain(domain2, spec, scope) { + const data2 = domain2.data, fields = domain2.fields.reduce((dom, d) => { + d = isString(d) ? { + data: data2, + field: d + } : isArray(d) || d.signal ? fieldRef(d, scope) : d; + dom.push(d); + return dom; }, []); - return ((0, _vegaScale.isDiscrete)(spec.type) ? ordinalMultipleDomain : (0, _vegaScale.isQuantile)(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields); -} -function fieldRef(data, scope) { - const name = '_:vega:_' + FIELD_REF_ID++, coll = Collect({}); - if ((0, _vegaUtil.isArray)(data)) coll.value = { - $ingest: data - }; - else if (data.signal) { - const code = 'setdata(' + (0, _vegaUtil.stringValue)(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [ - coll, - Sieve({}) - ]); + return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain2, scope, fields); + } + function fieldRef(data2, scope) { + const name = "_:vega:_" + FIELD_REF_ID++, coll = Collect({}); + if (isArray(data2)) { + coll.value = { + $ingest: data2 + }; + } else if (data2.signal) { + const code = "setdata(" + $(name) + "," + data2.signal + ")"; + coll.params.input = scope.signalRef(code); + } + scope.addDataPipeline(name, [coll, Sieve({})]); return { - data: name, - field: 'data' - }; -} -function ordinalMultipleDomain(domain, scope, fields) { - const sort = parseSort(domain.sort, true); - let a, v; - // get value counts for each domain field - const counts = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); + data: name, + field: "data" + }; + } + function ordinalMultipleDomain(domain2, scope, fields) { + const sort2 = parseSort(domain2.sort, true); + let a2, v; + const counts = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.countsRef(scope, f.field, sort2); }); - // aggregate the results from each domain field const p = { - groupby: keyFieldRef, - pulse: counts - }; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [ - MULTIDOMAIN_SORT_OPS[a] - ]; - p.fields = [ - scope.fieldRef(v) - ]; - p.as = [ - v - ]; - } - a = scope.add(Aggregate(p)); - // collect aggregate output - const c = scope.add(Collect({ - pulse: ref(a) + groupby: keyFieldRef, + pulse: counts + }; + if (sort2) { + a2 = sort2.op || "count"; + v = sort2.field ? aggrField(a2, sort2.field) : "count"; + p.ops = [MULTIDOMAIN_SORT_OPS[a2]]; + p.fields = [scope.fieldRef(v)]; + p.as = [v]; + } + a2 = scope.add(Aggregate(p)); + const c2 = scope.add(Collect({ + pulse: ref(a2) })); - // extract values for combined domain v = scope.add(Values({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) + field: keyFieldRef, + sort: scope.sortRef(sort2), + pulse: ref(c2) })); return ref(v); -} -function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if ((0, _vegaUtil.isObject)(sort)) sort.field = 'key'; - else sort = { - field: 'key' - }; - } else if (!sort.field && sort.op !== 'count') (0, _vegaUtil.error)('No field provided for sort aggregate op: ' + sort.op); - else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) (0, _vegaUtil.error)('Multiple domain scales can not be sorted using ' + sort.op); - } - } - return sort; -} -function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - const values = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); + } + function parseSort(sort2, multidomain) { + if (sort2) { + if (!sort2.field && !sort2.op) { + if (isObject$1(sort2)) sort2.field = "key"; + else sort2 = { + field: "key" + }; + } else if (!sort2.field && sort2.op !== "count") { + error("No field provided for sort aggregate op: " + sort2.op); + } else if (multidomain && sort2.field) { + if (sort2.op && !MULTIDOMAIN_SORT_OPS[sort2.op]) { + error("Multiple domain scales can not be sorted using " + sort2.op); + } + } + } + return sort2; + } + function quantileMultipleDomain(domain2, scope, fields) { + const values2 = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.domainRef(scope, f.field); }); - // combine value arrays return ref(scope.add(MultiValues({ - values: values + values: values2 }))); -} -function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - const extents = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); + } + function numericMultipleDomain(domain2, scope, fields) { + const extents = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.extentRef(scope, f.field); }); - // combine extents return ref(scope.add(MultiExtent({ - extents: extents + extents }))); -} -// -- SCALE BINS ----- -function parseScaleBins(v, scope) { - return v.signal || (0, _vegaUtil.isArray)(v) ? parseArray(v, scope) : scope.objectProperty(v); -} -// -- SCALE NICE ----- -function parseScaleNice(nice, scope) { - return nice.signal ? scope.signalRef(nice.signal) : (0, _vegaUtil.isObject)(nice) ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } : parseLiteral(nice); -} -// -- SCALE INTERPOLATION ----- -function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) params.interpolateGamma = parseLiteral(interpolate.gamma); -} -// -- SCALE RANGE ----- -function parseScaleRange(spec, scope, params) { + } + function parseScaleBins(v, scope) { + return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v); + } + function parseScaleNice(nice2, scope) { + return nice2.signal ? scope.signalRef(nice2.signal) : isObject$1(nice2) ? { + interval: parseLiteral(nice2.interval), + step: parseLiteral(nice2.step) + } : parseLiteral(nice2); + } + function parseScaleInterpolate(interpolate2, params2) { + params2.interpolate = parseLiteral(interpolate2.type || interpolate2); + if (interpolate2.gamma != null) { + params2.interpolateGamma = parseLiteral(interpolate2.gamma); + } + } + function parseScaleRange(spec, scope, params2) { const config = scope.config.range; - let range = spec.range; - if (range.signal) return scope.signalRef(range.signal); - else if ((0, _vegaUtil.isString)(range)) { - if (config && (0, _vegaUtil.hasOwnProperty)(config, range)) { - spec = (0, _vegaUtil.extend)({}, spec, { - range: config[range] - }); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') range = [ - 0, - { - signal: 'width' - } - ]; - else if (range === 'height') range = (0, _vegaScale.isDiscrete)(spec.type) ? [ - 0, - { - signal: 'height' - } - ] : [ - { - signal: 'height' - }, - 0 - ]; - else (0, _vegaUtil.error)('Unrecognized scale range value: ' + (0, _vegaUtil.stringValue)(range)); - } else if (range.scheme) { - params.scheme = (0, _vegaUtil.isArray)(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if ((0, _vegaScale.isDiscrete)(spec.type) && !(0, _vegaUtil.isArray)(range)) return parseScaleDomain(range, spec, scope); - else if (!(0, _vegaUtil.isArray)(range)) (0, _vegaUtil.error)('Unsupported range type: ' + (0, _vegaUtil.stringValue)(range)); - return range.map((v)=>((0, _vegaUtil.isArray)(v) ? parseArray : parseLiteral)(v, scope)); -} -function parseProjection(proj, scope) { - const config = scope.config.projection || {}, params = {}; - for(const name in proj){ - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } - // apply projection defaults from config - for(const name in config)if (params[name] == null) params[name] = parseParameter$1(config[name], name, scope); - scope.addProjection(proj.name, params); -} -function parseParameter$1(_, name, scope) { - return (0, _vegaUtil.isArray)(_) ? _.map((_)=>parseParameter$1(_, name, scope)) : !(0, _vegaUtil.isObject)(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : (0, _vegaUtil.error)('Unsupported parameter object: ' + (0, _vegaUtil.stringValue)(_)); -} -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const Center = 'center'; -const Vertical = 'vertical'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const Index = 'index'; -const Label = 'label'; -const Offset = 'offset'; -const Perc = 'perc'; -const Perc2 = 'perc2'; -const Value = 'value'; -const GuideLabelStyle = 'guide-label'; -const GuideTitleStyle = 'guide-title'; -const GroupTitleStyle = 'group-title'; -const GroupSubtitleStyle = 'group-subtitle'; -/** All values of LegendType */ const Symbols = 'symbol'; -const Gradient = 'gradient'; -const Discrete = 'discrete'; -const Size = 'size'; -const Shape = 'shape'; -const Fill = 'fill'; -const Stroke = 'stroke'; -const StrokeWidth = 'strokeWidth'; -const StrokeDash = 'strokeDash'; -const Opacity = 'opacity'; -// Encoding channels supported by legends -// In priority order of 'canonical' scale -const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity -]; -const Skip = { + let range2 = spec.range; + if (range2.signal) { + return scope.signalRef(range2.signal); + } else if (isString(range2)) { + if (config && has$1(config, range2)) { + spec = extend$1({}, spec, { + range: config[range2] + }); + return parseScaleRange(spec, scope, params2); + } else if (range2 === "width") { + range2 = [0, { + signal: "width" + }]; + } else if (range2 === "height") { + range2 = isDiscrete(spec.type) ? [0, { + signal: "height" + }] : [{ + signal: "height" + }, 0]; + } else { + error("Unrecognized scale range value: " + $(range2)); + } + } else if (range2.scheme) { + params2.scheme = isArray(range2.scheme) ? parseArray(range2.scheme, scope) : parseLiteral(range2.scheme, scope); + if (range2.extent) params2.schemeExtent = parseArray(range2.extent, scope); + if (range2.count) params2.schemeCount = parseLiteral(range2.count, scope); + return; + } else if (range2.step) { + params2.rangeStep = parseLiteral(range2.step, scope); + return; + } else if (isDiscrete(spec.type) && !isArray(range2)) { + return parseScaleDomain(range2, spec, scope); + } else if (!isArray(range2)) { + error("Unsupported range type: " + $(range2)); + } + return range2.map((v) => (isArray(v) ? parseArray : parseLiteral)(v, scope)); + } + function parseProjection(proj, scope) { + const config = scope.config.projection || {}, params2 = {}; + for (const name in proj) { + if (name === "name") continue; + params2[name] = parseParameter$1(proj[name], name, scope); + } + for (const name in config) { + if (params2[name] == null) { + params2[name] = parseParameter$1(config[name], name, scope); + } + } + scope.addProjection(proj.name, params2); + } + function parseParameter$1(_, name, scope) { + return isArray(_) ? _.map((_2) => parseParameter$1(_2, name, scope)) : !isObject$1(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === "fit" ? _ : error("Unsupported parameter object: " + $(_)); + } + const Top = "top"; + const Left = "left"; + const Right = "right"; + const Bottom = "bottom"; + const Center = "center"; + const Vertical = "vertical"; + const Start = "start"; + const Middle = "middle"; + const End = "end"; + const Index = "index"; + const Label = "label"; + const Offset = "offset"; + const Perc = "perc"; + const Perc2 = "perc2"; + const Value = "value"; + const GuideLabelStyle = "guide-label"; + const GuideTitleStyle = "guide-title"; + const GroupTitleStyle = "group-title"; + const GroupSubtitleStyle = "group-subtitle"; + const Symbols = "symbol"; + const Gradient = "gradient"; + const Discrete = "discrete"; + const Size = "size"; + const Shape = "shape"; + const Fill = "fill"; + const Stroke = "stroke"; + const StrokeWidth = "strokeWidth"; + const StrokeDash = "strokeDash"; + const Opacity = "opacity"; + const LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity]; + const Skip = { name: 1, style: 1, interactive: 1 -}; -const zero = { + }; + const zero = { value: 0 -}; -const one = { + }; + const one = { value: 1 -}; -const GroupMark = 'group'; -const RectMark = 'rect'; -const RuleMark = 'rule'; -const SymbolMark = 'symbol'; -const TextMark = 'text'; -function guideGroup(mark) { + }; + const GroupMark = "group"; + const RectMark = "rect"; + const RuleMark = "rule"; + const SymbolMark = "symbol"; + const TextMark = "text"; + function guideGroup(mark) { mark.type = GroupMark; mark.interactive = mark.interactive || false; return mark; -} -function lookup(spec, config) { - const _ = (name, dflt)=>value(spec[name], value(config[name], dflt)); - _.isVertical = (s)=>Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); - _.gradientLength = ()=>value(spec.gradientLength, config.gradientLength || config.gradientWidth); - _.gradientThickness = ()=>value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); - _.entryColumns = ()=>value(spec.columns, value(config.columns, +_.isVertical(true))); + } + function lookup(spec, config) { + const _ = (name, dflt) => value(spec[name], value(config[name], dflt)); + _.isVertical = (s) => Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); + _.gradientLength = () => value(spec.gradientLength, config.gradientLength || config.gradientWidth); + _.gradientThickness = () => value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); + _.entryColumns = () => value(spec.columns, value(config.columns, +_.isVertical(true))); return _; -} -function getEncoding(name, encode) { - const v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]); + } + function getEncoding(name, encode2) { + const v = encode2 && (encode2.update && encode2.update[name] || encode2.enter && encode2.enter[name]); return v && v.signal ? v : v ? v.value : null; -} -function getStyle(name, scope, style) { - const s = scope.config.style[style]; + } + function getStyle(name, scope, style2) { + const s = scope.config.style[style2]; return s && s[name]; -} -function anchorExpr(s, e, m) { - return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`; -} -const alignExpr$1 = anchorExpr((0, _vegaUtil.stringValue)(Left), (0, _vegaUtil.stringValue)(Right), (0, _vegaUtil.stringValue)(Center)); -function tickBand(_) { - const v = _('tickBand'); - let offset = _('tickOffset'), band, extra; + } + function anchorExpr(s, e, m2) { + return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m2}`; + } + const alignExpr$1 = anchorExpr($(Left), $(Right), $(Center)); + function tickBand(_) { + const v = _("tickBand"); + let offset2 = _("tickOffset"), band2, extra; if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); + band2 = _("bandPosition"); + extra = _("tickExtra"); } else if (v.signal) { - // if signal, augment code to interpret values - band = { - signal: `(${v.signal}) === 'extent' ? 1 : 0.5` - }; - extra = { - signal: `(${v.signal}) === 'extent'` - }; - if (!(0, _vegaUtil.isObject)(offset)) offset = { - signal: `(${v.signal}) === 'extent' ? 0 : ${offset}` + band2 = { + signal: `(${v.signal}) === 'extent' ? 1 : 0.5` + }; + extra = { + signal: `(${v.signal}) === 'extent'` + }; + if (!isObject$1(offset2)) { + offset2 = { + signal: `(${v.signal}) === 'extent' ? 0 : ${offset2}` }; - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; + } + } else if (v === "extent") { + band2 = 1; + extra = true; + offset2 = 0; } else { - band = 0.5; - extra = false; + band2 = 0.5; + extra = false; } return { - extra, - band, - offset - }; -} -function extendOffset(value, offset) { - return !offset ? value : !value ? offset : !(0, _vegaUtil.isObject)(value) ? { - value, - offset - } : Object.assign({}, value, { - offset: extendOffset(value.offset, offset) + extra, + band: band2, + offset: offset2 + }; + } + function extendOffset(value2, offset2) { + return !offset2 ? value2 : !value2 ? offset2 : !isObject$1(value2) ? { + value: value2, + offset: offset2 + } : Object.assign({}, value2, { + offset: extendOffset(value2.offset, offset2) }); -} -function guideMark(mark, extras) { + } + function guideMark(mark, extras) { if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip); - } else mark.interactive = false; + mark.name = extras.name; + mark.style = extras.style || mark.style; + mark.interactive = !!extras.interactive; + mark.encode = extendEncode(mark.encode, extras, Skip); + } else { + mark.interactive = false; + } return mark; -} -function legendGradient(spec, scale, config, userEncode) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let enter, start, stop, width, height; + } + function legendGradient(spec, scale2, config, userEncode) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let enter, start, stop2, width2, height2; if (vertical) { - start = [ - 0, - 1 - ]; - stop = [ - 0, - 0 - ]; - width = thickness; - height = length; + start = [0, 1]; + stop2 = [0, 0]; + width2 = thickness; + height2 = length2; } else { - start = [ - 0, - 0 - ]; - stop = [ - 1, - 0 - ]; - width = length; - height = thickness; - } - const encode = { - enter: enter = { - opacity: zero, - x: zero, - y: zero, - width: encoder(width), - height: encoder(height) - }, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one, - fill: { - gradient: scale, - start: start, - stop: stop - } - }), - exit: { - opacity: zero + start = [0, 0]; + stop2 = [1, 0]; + width2 = length2; + height2 = thickness; + } + const encode2 = { + enter: enter = { + opacity: zero, + x: zero, + y: zero, + width: encoder(width2), + height: encoder(height2) + }, + update: extend$1({}, enter, { + opacity: one, + fill: { + gradient: scale2, + start, + stop: stop2 } + }), + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode + type: RectMark, + role: LegendGradientRole, + encode: encode2 }, userEncode); -} -function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let u, v, uu, vv, adjust = ''; - vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); + } + function legendGradientDiscrete(spec, scale2, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let u2, v, uu, vv, adjust = ""; + vertical ? (u2 = "y", uu = "y2", v = "x", vv = "width", adjust = "1-") : (u2 = "x", uu = "x2", v = "y", vv = "height"); const enter = { - opacity: zero, - fill: { - scale: scale, - field: Value - } + opacity: zero, + fill: { + scale: scale2, + field: Value + } }; - enter[u] = { - signal: adjust + 'datum.' + Perc, - mult: length + enter[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 }; enter[v] = zero; enter[uu] = { - signal: adjust + 'datum.' + Perc2, - mult: length + signal: adjust + "datum." + Perc2, + mult: length2 }; enter[vv] = encoder(thickness); - const encode = { - enter: enter, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one - }), - exit: { - opacity: zero - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + const encode2 = { + enter, + update: extend$1({}, enter, { + opacity: one + }), + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode + type: RectMark, + role: LegendBandRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; -function legendGradientLabels(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length = _.gradientLength(); - let overlap = _('labelOverlap'), enter, update, u, v, adjust = ''; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one, - text: { - field: Label - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value(spec.labelLimit, config.gradientLabelLimit) + } + const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; + function legendGradientLabels(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length2 = _.gradientLength(); + let overlap = _("labelOverlap"), enter, update2, u2, v, adjust = ""; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one, + text: { + field: Label + } + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: value(spec.labelLimit, config.gradientLabelLimit) }); if (vertical) { - enter.align = { - value: 'left' - }; - enter.baseline = update.baseline = { - signal: baselineExpr - }; - u = 'y'; - v = 'x'; - adjust = '1-'; + enter.align = { + value: "left" + }; + enter.baseline = update2.baseline = { + signal: baselineExpr + }; + u2 = "y"; + v = "x"; + adjust = "1-"; } else { - enter.align = update.align = { - signal: alignExpr - }; - enter.baseline = { - value: 'top' - }; - u = 'x'; - v = 'y'; - } - enter[u] = update[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = update[v] = thickness; + enter.align = update2.align = { + signal: alignExpr + }; + enter.baseline = { + value: "top" + }; + u2 = "x"; + v = "y"; + } + enter[u2] = update2[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 + }; + enter[v] = update2[v] = thickness; thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0; overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - // type, role, style, key, dataRef, encode, extras + separation: _("labelSeparation"), + method: overlap, + order: "datum." + Index + } : void 0; return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -// userEncode is top-level, includes entries, symbols, labels -function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - const _ = lookup(spec, config), entries = userEncode.entries, interactive = !!(entries && entries.interactive), name = entries ? entries.name : undefined, height = _('clipHeight'), symbolOffset = _('symbolOffset'), valueRef = { - data: 'value' - }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height ? encoder(height) : { - field: Size - }, index = `datum.${Index}`, ncols = `max(1, ${columns})`; - let encode, enter, update, nrows, sort; + } + function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { + const _ = lookup(spec, config), entries = userEncode.entries, interactive2 = !!(entries && entries.interactive), name = entries ? entries.name : void 0, height2 = _("clipHeight"), symbolOffset = _("symbolOffset"), valueRef = { + data: "value" + }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height2 ? encoder(height2) : { + field: Size + }, index2 = `datum.${Index}`, ncols = `max(1, ${columns})`; + let encode2, enter, update2, nrows, sort2; yEncode.mult = 0.5; - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - mult: 0.5, - offset: symbolOffset - }, - y: yEncode - }, - update: update = { - opacity: one, - x: enter.x, - y: enter.y + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + mult: 0.5, + offset: symbolOffset }, - exit: { - opacity: zero - } + y: yEncode + }, + update: update2 = { + opacity: one, + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } }; let baseFill = null, baseStroke = null; if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') + baseFill = config.symbolBaseFillColor; + baseStroke = config.symbolBaseStrokeColor; + } + addEncoders(encode2, { + fill: _("symbolFillColor", baseFill), + shape: _("symbolType"), + size: _("symbolSize"), + stroke: _("symbolStrokeColor", baseStroke), + strokeDash: _("symbolDash"), + strokeDashOffset: _("symbolDashOffset"), + strokeWidth: _("symbolStrokeWidth") }, { - // update - opacity: _('symbolOpacity') + // update + opacity: _("symbolOpacity") }); - LegendScales.forEach((scale)=>{ - if (spec[scale]) update[scale] = enter[scale] = { - scale: spec[scale], - field: Value + LegendScales.forEach((scale2) => { + if (spec[scale2]) { + update2[scale2] = enter[scale2] = { + scale: spec[scale2], + field: Value }; + } }); - const symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode + const symbols2 = guideMark({ + type: SymbolMark, + role: LegendSymbolRole, + key: Value, + from: valueRef, + clip: height2 ? true : void 0, + encode: encode2 }, userEncode.symbols); - // -- LEGEND LABELS -- const labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - offset: labelOffset - }, - y: yEncode + labelOffset.offset = _("labelOffset"); + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + offset: labelOffset }, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y + y: yEncode + }, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + align: _("labelAlign"), + baseline: _("labelBaseline"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: _("labelLimit") }); const labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: valueRef, + encode: encode2 }, userEncode.labels); - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: { - value: !height - }, - // ignore width/height in bounds calc - width: zero, - height: height ? encoder(height) : zero, - opacity: zero - }, - exit: { - opacity: zero + encode2 = { + enter: { + noBound: { + value: !height2 + }, + // ignore width/height in bounds calc + width: zero, + height: height2 ? encoder(height2) : zero, + opacity: zero + }, + exit: { + opacity: zero + }, + update: update2 = { + opacity: one, + row: { + signal: null }, - update: update = { - opacity: one, - row: { - signal: null - }, - column: { - signal: null - } + column: { + signal: null } + } }; - // annotate and sort groups to ensure correct ordering if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = { - field: [ - 'row', - index - ] - }; + nrows = `ceil(item.mark.items.length / ${ncols})`; + update2.row.signal = `${index2}%${nrows}`; + update2.column.signal = `floor(${index2} / ${nrows})`; + sort2 = { + field: ["row", index2] + }; } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = { - field: index - }; + update2.row.signal = `floor(${index2} / ${ncols})`; + update2.column.signal = `${index2} % ${ncols}`; + sort2 = { + field: index2 + }; } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - // facet legend entries into sub-groups + update2.column.signal = `(${columns})?${update2.column.signal}:${index2}`; dataRef = { - facet: { - data: dataRef, - name: 'value', - groupby: Index - } + facet: { + data: dataRef, + name: "value", + groupby: Index + } }; return guideGroup({ - role: ScopeRole, - from: dataRef, - encode: extendEncode(encode, entries, Skip), - marks: [ - symbols, - labels - ], - name, - interactive, - sort + role: ScopeRole, + from: dataRef, + encode: extendEncode(encode2, entries, Skip), + marks: [symbols2, labels], + name, + interactive: interactive2, + sort: sort2 }); -} -function legendSymbolLayout(spec, config) { + } + function legendSymbolLayout(spec, config) { const _ = lookup(spec, config); - // layout parameters for legend entries return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } + align: _("gridAlign"), + columns: _.entryColumns(), + center: { + row: true, + column: false + }, + padding: { + row: _("rowPadding"), + column: _("columnPadding") + } }; -} -// expression logic for align, anchor, angle, and baseline calculation -const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; -function legendTitle(spec, config, userEncode, dataRef) { + } + const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; + function legendTitle(spec, config, userEncode, dataRef) { const _ = lookup(spec, config); - const encode = { - enter: { - opacity: zero - }, - update: { - opacity: one, - x: { - field: { - group: 'padding' - } - }, - y: { - field: { - group: 'padding' - } - } - }, - exit: { - opacity: zero + const encode2 = { + enter: { + opacity: zero + }, + update: { + opacity: one, + x: { + field: { + group: "padding" + } + }, + y: { + field: { + group: "padding" + } } + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: { - signal: exprAnchor - }, - angle: { - signal: exprAngle - }, - align: { - signal: exprAlign - }, - baseline: { - signal: exprBaseline - }, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + addEncoders(encode2, { + orient: _("titleOrient"), + _anchor: _("titleAnchor"), + anchor: { + signal: exprAnchor + }, + angle: { + signal: exprAngle + }, + align: { + signal: exprAlign + }, + baseline: { + signal: exprBaseline + }, + text: spec.title, + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - baseline: _('titleBaseline') + // require update + align: _("titleAlign"), + baseline: _("titleBaseline") }); return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: LegendTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function clip(clip, scope) { - let expr; - if ((0, _vegaUtil.isObject)(clip)) { - if (clip.signal) expr = clip.signal; - else if (clip.path) expr = 'pathShape(' + param(clip.path) + ')'; - else if (clip.sphere) expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - return expr ? scope.signalRef(expr) : !!clip; -} -function param(value) { - return (0, _vegaUtil.isObject)(value) && value.signal ? value.signal : (0, _vegaUtil.stringValue)(value); -} -function getRole(spec) { - const role = spec.role || ''; - return role.startsWith('axis') || role.startsWith('legend') || role.startsWith('title') ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; -} -function definition(spec) { + } + function clip(clip2, scope) { + let expr2; + if (isObject$1(clip2)) { + if (clip2.signal) { + expr2 = clip2.signal; + } else if (clip2.path) { + expr2 = "pathShape(" + param(clip2.path) + ")"; + } else if (clip2.sphere) { + expr2 = "geoShape(" + param(clip2.sphere) + ', {type: "Sphere"})'; + } + } + return expr2 ? scope.signalRef(expr2) : !!clip2; + } + function param(value2) { + return isObject$1(value2) && value2.signal ? value2.signal : $(value2); + } + function getRole(spec) { + const role = spec.role || ""; + return role.startsWith("axis") || role.startsWith("legend") || role.startsWith("title") ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; + } + function definition(spec) { return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; -} -function interactive(spec, scope) { + marktype: spec.type, + name: spec.name || void 0, + role: spec.role || getRole(spec), + zindex: +spec.zindex || void 0, + aria: spec.aria, + description: spec.description + }; + } + function interactive(spec, scope) { return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true; -} -/** - * Parse a data transform specification. - */ function parseTransform(spec, scope) { - const def = (0, _vegaDataflow.definition)(spec.type); - if (!def) (0, _vegaUtil.error)('Unrecognized transform type: ' + (0, _vegaUtil.stringValue)(spec.type)); - const t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope)); + } + function parseTransform(spec, scope) { + const def2 = definition$1(spec.type); + if (!def2) error("Unrecognized transform type: " + $(spec.type)); + const t = entry(def2.type.toLowerCase(), null, parseParameters(def2, spec, scope)); if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; + t.metadata = def2.metadata || {}; return t; -} -/** - * Parse all parameters of a data transform. - */ function parseParameters(def, spec, scope) { - const params = {}, n = def.params.length; - for(let i = 0; i < n; ++i){ - const pdef = def.params[i]; - params[pdef.name] = parseParameter(pdef, spec, scope); - } - return params; -} -/** - * Parse a data transform parameter. - */ function parseParameter(def, spec, scope) { - const type = def.type, value = spec[def.name]; - if (type === 'index') return parseIndexParameter(def, spec, scope); - else if (value === undefined) { - if (def.required) (0, _vegaUtil.error)('Missing required ' + (0, _vegaUtil.stringValue)(spec.type) + ' parameter: ' + (0, _vegaUtil.stringValue)(def.name)); - return; - } else if (type === 'param') return parseSubParameters(def, spec, scope); - else if (type === 'projection') return scope.projectionRef(spec[def.name]); - return def.array && !isSignal(value) ? value.map((v)=>parameterValue(def, v, scope)) : parameterValue(def, value, scope); -} -/** - * Parse a single parameter value. - */ function parameterValue(def, value, scope) { - const type = def.type; - if (isSignal(value)) return isExpr(type) ? (0, _vegaUtil.error)('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal); - else { - const expr = def.expr || isField(type); - return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : isExpr(type) ? (0, _vegaFunctions.parseExpression)(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value; - } -} -/** - * Parse parameter for accessing an index of another data set. - */ function parseIndexParameter(def, spec, scope) { - if (!(0, _vegaUtil.isString)(spec.from)) (0, _vegaUtil.error)('Lookup "from" parameter must be a string literal.'); + } + function parseParameters(def2, spec, scope) { + const params2 = {}, n = def2.params.length; + for (let i = 0; i < n; ++i) { + const pdef = def2.params[i]; + params2[pdef.name] = parseParameter(pdef, spec, scope); + } + return params2; + } + function parseParameter(def2, spec, scope) { + const type2 = def2.type, value2 = spec[def2.name]; + if (type2 === "index") { + return parseIndexParameter(def2, spec, scope); + } else if (value2 === void 0) { + if (def2.required) { + error("Missing required " + $(spec.type) + " parameter: " + $(def2.name)); + } + return; + } else if (type2 === "param") { + return parseSubParameters(def2, spec, scope); + } else if (type2 === "projection") { + return scope.projectionRef(spec[def2.name]); + } + return def2.array && !isSignal(value2) ? value2.map((v) => parameterValue(def2, v, scope)) : parameterValue(def2, value2, scope); + } + function parameterValue(def2, value2, scope) { + const type2 = def2.type; + if (isSignal(value2)) { + return isExpr(type2) ? error("Expression references can not be signals.") : isField(type2) ? scope.fieldRef(value2) : isCompare(type2) ? scope.compareRef(value2) : scope.signalRef(value2.signal); + } else { + const expr2 = def2.expr || isField(type2); + return expr2 && outerExpr(value2) ? scope.exprRef(value2.expr, value2.as) : expr2 && outerField(value2) ? fieldRef$1(value2.field, value2.as) : isExpr(type2) ? parser(value2, scope) : isData(type2) ? ref(scope.getData(value2).values) : isField(type2) ? fieldRef$1(value2) : isCompare(type2) ? scope.compareRef(value2) : value2; + } + } + function parseIndexParameter(def2, spec, scope) { + if (!isString(spec.from)) { + error('Lookup "from" parameter must be a string literal.'); + } return scope.getData(spec.from).lookupRef(scope, spec.key); -} -/** - * Parse a parameter that contains one or more sub-parameter objects. - */ function parseSubParameters(def, spec, scope) { - const value = spec[def.name]; - if (def.array) { - if (!(0, _vegaUtil.isArray)(value)) // signals not allowed! - (0, _vegaUtil.error)('Expected an array of sub-parameters. Instead: ' + (0, _vegaUtil.stringValue)(value)); - return value.map((v)=>parseSubParameter(def, v, scope)); - } else return parseSubParameter(def, value, scope); -} -/** - * Parse a sub-parameter object. - */ function parseSubParameter(def, value, scope) { - const n = def.params.length; + } + function parseSubParameters(def2, spec, scope) { + const value2 = spec[def2.name]; + if (def2.array) { + if (!isArray(value2)) { + error("Expected an array of sub-parameters. Instead: " + $(value2)); + } + return value2.map((v) => parseSubParameter(def2, v, scope)); + } else { + return parseSubParameter(def2, value2, scope); + } + } + function parseSubParameter(def2, value2, scope) { + const n = def2.params.length; let pdef; - // loop over defs to find matching key - for(let i = 0; i < n; ++i){ - pdef = def.params[i]; - for(const k in pdef.key)if (pdef.key[k] !== value[k]) { - pdef = null; - break; + for (let i = 0; i < n; ++i) { + pdef = def2.params[i]; + for (const k in pdef.key) { + if (pdef.key[k] !== value2[k]) { + pdef = null; + break; } - if (pdef) break; - } - // raise error if matching key not found - if (!pdef) (0, _vegaUtil.error)('Unsupported parameter: ' + (0, _vegaUtil.stringValue)(value)); - // parse params, create Params transform, return ref - const params = (0, _vegaUtil.extend)(parseParameters(pdef, value, scope), pdef.key); - return ref(scope.add(Params(params))); -} -// -- Utilities ----- -const outerExpr = (_)=>_ && _.expr; -const outerField = (_)=>_ && _.field; -const isData = (_)=>_ === 'data'; -const isExpr = (_)=>_ === 'expr'; -const isField = (_)=>_ === 'field'; -const isCompare = (_)=>_ === 'compare'; -function parseData$1(from, group, scope) { - let facet, key, op, dataRef, parent; - // if no source data, generate singleton datum - if (!from) dataRef = ref(scope.add(Collect(null, [ - {} - ]))); - else if (facet = from.facet) { - if (!group) (0, _vegaUtil.error)('Only group marks can be faceted.'); - // use pre-faceted source data, if available - if (facet.field != null) dataRef = parent = getDataRef(facet, scope); - else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform((0, _vegaUtil.extend)({ - type: 'aggregate', - groupby: (0, _vegaUtil.array)(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else parent = ref(scope.getData(from.data).aggregate); - key = scope.keyRef(facet.groupby, true); - } - } - // if not yet defined, get source data reference - if (!dataRef) dataRef = getDataRef(from, scope); + } + if (pdef) break; + } + if (!pdef) error("Unsupported parameter: " + $(value2)); + const params2 = extend$1(parseParameters(pdef, value2, scope), pdef.key); + return ref(scope.add(Params(params2))); + } + const outerExpr = (_) => _ && _.expr; + const outerField = (_) => _ && _.field; + const isData = (_) => _ === "data"; + const isExpr = (_) => _ === "expr"; + const isField = (_) => _ === "field"; + const isCompare = (_) => _ === "compare"; + function parseData$1(from, group2, scope) { + let facet, key2, op, dataRef, parent; + if (!from) { + dataRef = ref(scope.add(Collect(null, [{}]))); + } else if (facet = from.facet) { + if (!group2) error("Only group marks can be faceted."); + if (facet.field != null) { + dataRef = parent = getDataRef(facet, scope); + } else { + if (!from.data) { + op = parseTransform(extend$1({ + type: "aggregate", + groupby: array$5(facet.groupby) + }, facet.aggregate), scope); + op.params.key = scope.keyRef(facet.groupby); + op.params.pulse = getDataRef(facet, scope); + dataRef = parent = ref(scope.add(op)); + } else { + parent = ref(scope.getData(from.data).aggregate); + } + key2 = scope.keyRef(facet.groupby, true); + } + } + if (!dataRef) { + dataRef = getDataRef(from, scope); + } return { - key: key, - pulse: dataRef, - parent: parent + key: key2, + pulse: dataRef, + parent }; -} -function getDataRef(from, scope) { + } + function getDataRef(from, scope) { return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output); -} -function DataScope(scope, input, output, values, aggr) { - this.scope = scope; // parent scope object - this.input = input; // first operator in pipeline (tuple input) - this.output = output; // last operator in pipeline (tuple output) - this.values = values; // operator for accessing tuples (but not tuple flow) - // last aggregate in transform pipeline + } + function DataScope$1(scope, input, output2, values2, aggr) { + this.scope = scope; + this.input = input; + this.output = output2; + this.values = values2; this.aggregate = aggr; - // lookup table of field indices this.index = {}; -} -DataScope.fromEntries = function(scope, entries) { - const n = entries.length, values = entries[n - 1], output = entries[n - 2]; + } + DataScope$1.fromEntries = function(scope, entries) { + const n = entries.length, values2 = entries[n - 1], output2 = entries[n - 2]; let input = entries[0], aggr = null, i = 1; - if (input && input.type === 'load') input = entries[1]; - // add operator entries to this scope, wire up pulse chain + if (input && input.type === "load") { + input = entries[1]; + } scope.add(entries[0]); - for(; i < n; ++i){ - entries[i].params.pulse = ref(entries[i - 1]); - scope.add(entries[i]); - if (entries[i].type === 'aggregate') aggr = entries[i]; - } - return new DataScope(scope, input, output, values, aggr); -}; -function fieldKey(field) { - return (0, _vegaUtil.isString)(field) ? field : null; -} -function addSortField(scope, p, sort) { - const as = aggrField(sort.op, sort.field); + for (; i < n; ++i) { + entries[i].params.pulse = ref(entries[i - 1]); + scope.add(entries[i]); + if (entries[i].type === "aggregate") aggr = entries[i]; + } + return new DataScope$1(scope, input, output2, values2, aggr); + }; + function fieldKey(field2) { + return isString(field2) ? field2 : null; + } + function addSortField(scope, p, sort2) { + const as = aggrField(sort2.op, sort2.field); let s; - if (p.ops) for(let i = 0, n = p.as.length; i < n; ++i){ + if (p.ops) { + for (let i = 0, n = p.as.length; i < n; ++i) { if (p.as[i] === as) return; + } + } else { + p.ops = ["count"]; + p.fields = [null]; + p.as = ["count"]; } - else { - p.ops = [ - 'count' - ]; - p.fields = [ - null - ]; - p.as = [ - 'count' - ]; - } - if (sort.op) { - p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op); - p.fields.push(scope.fieldRef(sort.field)); - p.as.push(as); - } -} -function cache(scope, ds, name, optype, field, counts, index) { - const cache = ds[name] || (ds[name] = {}), sort = sortKey(counts); - let k = fieldKey(field), v, op; + if (sort2.op) { + p.ops.push((s = sort2.op.signal) ? scope.signalRef(s) : sort2.op); + p.fields.push(scope.fieldRef(sort2.field)); + p.as.push(as); + } + } + function cache(scope, ds, name, optype, field2, counts, index2) { + const cache2 = ds[name] || (ds[name] = {}), sort2 = sortKey(counts); + let k = fieldKey(field2), v, op; if (k != null) { - scope = ds.scope; - k = k + (sort ? '|' + sort : ''); - v = cache[k]; + scope = ds.scope; + k = k + (sort2 ? "|" + sort2 : ""); + v = cache2[k]; } if (!v) { - const params = counts ? { - field: keyFieldRef, - pulse: ds.countsRef(scope, field, counts) - } : { - field: scope.fieldRef(field), - pulse: ref(ds.output) - }; - if (sort) params.sort = scope.sortRef(counts); - op = scope.add(entry(optype, undefined, params)); - if (index) ds.index[field] = op; - v = ref(op); - if (k != null) cache[k] = v; + const params2 = counts ? { + field: keyFieldRef, + pulse: ds.countsRef(scope, field2, counts) + } : { + field: scope.fieldRef(field2), + pulse: ref(ds.output) + }; + if (sort2) params2.sort = scope.sortRef(counts); + op = scope.add(entry(optype, void 0, params2)); + if (index2) ds.index[field2] = op; + v = ref(op); + if (k != null) cache2[k] = v; } return v; -} -DataScope.prototype = { - countsRef (scope, field, sort) { - const ds = this, cache = ds.counts || (ds.counts = {}), k = fieldKey(field); - let v, a, p; - if (k != null) { - scope = ds.scope; - v = cache[k]; - } - if (!v) { - p = { - groupby: scope.fieldRef(field, 'key'), - pulse: ref(ds.output) - }; - if (sort && sort.field) addSortField(scope, p, sort); - a = scope.add(Aggregate(p)); - v = scope.add(Collect({ - pulse: ref(a) - })); - v = { - agg: a, - ref: ref(v) - }; - if (k != null) cache[k] = v; - } else if (sort && sort.field) addSortField(scope, v.agg.params, sort); - return v.ref; + } + DataScope$1.prototype = { + countsRef(scope, field2, sort2) { + const ds = this, cache2 = ds.counts || (ds.counts = {}), k = fieldKey(field2); + let v, a2, p; + if (k != null) { + scope = ds.scope; + v = cache2[k]; + } + if (!v) { + p = { + groupby: scope.fieldRef(field2, "key"), + pulse: ref(ds.output) + }; + if (sort2 && sort2.field) addSortField(scope, p, sort2); + a2 = scope.add(Aggregate(p)); + v = scope.add(Collect({ + pulse: ref(a2) + })); + v = { + agg: a2, + ref: ref(v) + }; + if (k != null) cache2[k] = v; + } else if (sort2 && sort2.field) { + addSortField(scope, v.agg.params, sort2); + } + return v.ref; }, - tuplesRef () { - return ref(this.values); + tuplesRef() { + return ref(this.values); }, - extentRef (scope, field) { - return cache(scope, this, 'extent', 'extent', field, false); + extentRef(scope, field2) { + return cache(scope, this, "extent", "extent", field2, false); }, - domainRef (scope, field) { - return cache(scope, this, 'domain', 'values', field, false); + domainRef(scope, field2) { + return cache(scope, this, "domain", "values", field2, false); }, - valuesRef (scope, field, sort) { - return cache(scope, this, 'vals', 'values', field, sort || true); + valuesRef(scope, field2, sort2) { + return cache(scope, this, "vals", "values", field2, sort2 || true); }, - lookupRef (scope, field) { - return cache(scope, this, 'lookup', 'tupleindex', field, false); + lookupRef(scope, field2) { + return cache(scope, this, "lookup", "tupleindex", field2, false); }, - indataRef (scope, field) { - return cache(scope, this, 'indata', 'tupleindex', field, true, true); + indataRef(scope, field2) { + return cache(scope, this, "indata", "tupleindex", field2, true, true); } -}; -function parseFacet(spec, scope, group) { - const facet = spec.from.facet, name = facet.name, data = getDataRef(facet, scope); + }; + function parseFacet(spec, scope, group2) { + const facet = spec.from.facet, name = facet.name, data2 = getDataRef(facet, scope); let op; - if (!facet.name) (0, _vegaUtil.error)('Facet must have a name: ' + (0, _vegaUtil.stringValue)(facet)); - if (!facet.data) (0, _vegaUtil.error)('Facet must reference a data set: ' + (0, _vegaUtil.stringValue)(facet)); - if (facet.field) op = scope.add(PreFacet({ + if (!facet.name) { + error("Facet must have a name: " + $(facet)); + } + if (!facet.data) { + error("Facet must reference a data set: " + $(facet)); + } + if (facet.field) { + op = scope.add(PreFacet({ field: scope.fieldRef(facet.field), - pulse: data - })); - else if (facet.groupby) op = scope.add(Facet({ + pulse: data2 + })); + } else if (facet.groupby) { + op = scope.add(Facet({ key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - else (0, _vegaUtil.error)('Facet must specify groupby or field: ' + (0, _vegaUtil.stringValue)(facet)); - // initialize facet subscope - const subscope = scope.fork(), source = subscope.add(Collect()), values = subscope.add(Sieve({ - pulse: ref(source) + group: ref(scope.proxy(group2.parent)), + pulse: data2 + })); + } else { + error("Facet must specify groupby or field: " + $(facet)); + } + const subscope = scope.fork(), source2 = subscope.add(Collect()), values2 = subscope.add(Sieve({ + pulse: ref(source2) })); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); - // parse faceted subflow + subscope.addData(name, new DataScope$1(subscope, source2, source2, values2)); + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() + $subflow: subscope.parse(spec).toRuntime() }; -} -function parseSubflow(spec, scope, input) { + } + function parseSubflow(spec, scope, input) { const op = scope.add(PreFacet({ - pulse: input.pulse + pulse: input.pulse })), subscope = scope.fork(); subscope.add(Sieve()); - subscope.addSignal('parent', null); - // parse group mark subflow + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} -function parseTrigger(spec, scope, name) { - const remove = spec.remove, insert = spec.insert, toggle = spec.toggle, modify = spec.modify, values = spec.values, op = scope.add(operator()); - const update = 'if(' + spec.trigger + ',modify("' + name + '",' + [ - insert, - remove, - toggle, - modify, - values - ].map((_)=>_ == null ? 'null' : _).join(',') + '),0)'; - const expr = (0, _vegaFunctions.parseExpression)(update, scope); - op.update = expr.$expr; - op.params = expr.$params; -} -function parseMark(spec, scope) { - const role = getRole(spec), group = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; - let layout = spec.layout || role === ScopeRole || role === FrameRole, ops, op, store, enc, name, layoutRef, boundRef; + $subflow: subscope.parse(spec).toRuntime() + }; + } + function parseTrigger(spec, scope, name) { + const remove2 = spec.remove, insert2 = spec.insert, toggle = spec.toggle, modify2 = spec.modify, values2 = spec.values, op = scope.add(operator()); + const update2 = "if(" + spec.trigger + ',modify("' + name + '",' + [insert2, remove2, toggle, modify2, values2].map((_) => _ == null ? "null" : _).join(",") + "),0)"; + const expr2 = parser(update2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + function parseMark(spec, scope) { + const role = getRole(spec), group2 = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; + let layout = spec.layout || role === ScopeRole || role === FrameRole, ops2, op, store, enc, name, layoutRef, boundRef; const nested = role === MarkRole || layout || facet; - // resolve input data - const input = parseData$1(spec.from, group, scope); - // data join to map tuples to visual items + const input = parseData$1(spec.from, group2, scope); op = scope.add(DataJoin({ - key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined), - pulse: input.pulse, - clean: !group + key: input.key || (spec.key ? fieldRef$1(spec.key) : void 0), + pulse: input.pulse, + clean: !group2 })); const joinRef = ref(op); - // collect visual items op = store = scope.add(Collect({ - pulse: joinRef + pulse: joinRef })); - // connect visual items to scenegraph op = scope.add(Mark({ - markdef: definition(spec), - interactive: interactive(spec.interactive, scope), - clip: clip(spec.clip, scope), - context: { - $context: true - }, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) + markdef: definition(spec), + interactive: interactive(spec.interactive, scope), + clip: clip(spec.clip, scope), + context: { + $context: true + }, + groups: scope.lookup(), + parent: scope.signals.parent ? scope.signalRef("parent") : null, + index: scope.markpath(), + pulse: ref(op) })); const markRef = ref(op); - // add visual encoders op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, { - mod: false, - pulse: markRef + mod: false, + pulse: markRef }))); - // monitor parent marks to propagate changes op.params.parent = scope.encode(); - // add post-encoding transforms, if defined - if (spec.transform) spec.transform.forEach((_)=>{ - const tx = parseTransform(_, scope), md = tx.metadata; - if (md.generates || md.changes) (0, _vegaUtil.error)('Mark transforms should not generate new data.'); - if (!md.nomod) enc.params.mod = true; // update encode mod handling - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - // if item sort specified, perform post-encoding - if (spec.sort) op = scope.add(SortItems({ + if (spec.transform) { + spec.transform.forEach((_) => { + const tx2 = parseTransform(_, scope), md2 = tx2.metadata; + if (md2.generates || md2.changes) { + error("Mark transforms should not generate new data."); + } + if (!md2.nomod) enc.params.mod = true; + tx2.params.pulse = ref(op); + scope.add(op = tx2); + }); + } + if (spec.sort) { + op = scope.add(SortItems({ sort: scope.compareRef(spec.sort), pulse: ref(op) - })); - const encodeRef = ref(op); - // add view layout operator if needed - if (facet || layout) { - layout = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); + })); } - // compute bounding boxes - const bound = scope.add(Bound({ + const encodeRef = ref(op); + if (facet || layout) { + layout = scope.add(ViewLayout({ + layout: scope.objectProperty(spec.layout), + legends: scope.legends, mark: markRef, - pulse: layoutRef || encodeRef + pulse: encodeRef + })); + layoutRef = ref(layout); + } + const bound2 = scope.add(Bound({ + mark: markRef, + pulse: layoutRef || encodeRef })); - boundRef = ref(bound); - // if group mark, recurse to parse nested content - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { - ops = scope.operators; - ops.pop(); - if (layout) ops.pop(); - } - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - scope.popState(); - if (nested) { - if (layout) ops.push(layout); - ops.push(bound); - } - } - // if requested, add overlap removal transform - if (overlap) boundRef = parseOverlap(overlap, boundRef, scope); - // render / sieve items + boundRef = ref(bound2); + if (group2) { + if (nested) { + ops2 = scope.operators; + ops2.pop(); + if (layout) ops2.pop(); + } + scope.pushState(encodeRef, layoutRef || boundRef, joinRef); + facet ? parseFacet(spec, scope, input) : nested ? parseSubflow(spec, scope, input) : scope.parse(spec); + scope.popState(); + if (nested) { + if (layout) ops2.push(layout); + ops2.push(bound2); + } + } + if (overlap) { + boundRef = parseOverlap(overlap, boundRef, scope); + } const render = scope.add(Render({ - pulse: boundRef + pulse: boundRef })), sieve = scope.add(Sieve({ - pulse: ref(render) - }, undefined, scope.parent())); - // if mark is named, make accessible as reactive geometry - // add trigger updates if defined + pulse: ref(render) + }, void 0, scope.parent())); if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach((on)=>{ - if (on.insert || on.remove || on.toggle) (0, _vegaUtil.error)('Marks only support modify triggers.'); - parseTrigger(on, scope, name); - }); + name = spec.name; + scope.addData(name, new DataScope$1(scope, store, render, sieve)); + if (spec.on) spec.on.forEach((on2) => { + if (on2.insert || on2.remove || on2.toggle) { + error("Marks only support modify triggers."); + } + parseTrigger(on2, scope, name); + }); } -} -function parseOverlap(overlap, source, scope) { - const method = overlap.method, bound = overlap.bound, sep = overlap.separation; - const params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - if (overlap.order) params.sort = scope.compareRef({ + } + function parseOverlap(overlap, source2, scope) { + const method2 = overlap.method, bound2 = overlap.bound, sep = overlap.separation; + const params2 = { + separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, + method: isSignal(method2) ? scope.signalRef(method2.signal) : method2, + pulse: source2 + }; + if (overlap.order) { + params2.sort = scope.compareRef({ field: overlap.order - }); - if (bound) { - const tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - return ref(scope.add(Overlap(params))); -} -function parseLegend(spec, scope) { - const config = scope.config.legend, encode = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode.legend || {}, name = legendEncode.name || undefined, interactive = legendEncode.interactive, style = legendEncode.style, scales = {}; - let scale = 0, entryLayout, params, children; - // resolve scales and 'canonical' scale name - LegendScales.forEach((s)=>spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0); - if (!scale) (0, _vegaUtil.error)('Missing valid scale for legend.'); - // resolve legend type (symbol, gradient, or discrete gradient) - const type = legendType(spec, scope.scaleType(scale)); - // single-element data source for legend group - const datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - const dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // encoding properties for legend entry sub-group + }); + } + if (bound2) { + const tol = bound2.tolerance; + params2.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; + params2.boundScale = scope.scaleRef(bound2.scale); + params2.boundOrient = bound2.orient; + } + return ref(scope.add(Overlap(params2))); + } + function parseLegend(spec, scope) { + const config = scope.config.legend, encode2 = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode2.legend || {}, name = legendEncode.name || void 0, interactive2 = legendEncode.interactive, style2 = legendEncode.style, scales2 = {}; + let scale2 = 0, entryLayout, params2, children2; + LegendScales.forEach((s) => spec[s] ? (scales2[s] = spec[s], scale2 = scale2 || spec[s]) : 0); + if (!scale2) error("Missing valid scale for legend."); + const type2 = legendType(spec, scope.scaleType(scale2)); + const datum2 = { + title: spec.title != null, + scales: scales2, + type: type2, + vgrad: type2 !== "symbol" && _.isVertical() + }; + const dataRef = ref(scope.add(Collect(null, [datum2]))); const entryEncode = { - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } + enter: { + x: { + value: 0 + }, + y: { + value: 0 } + } }; - // data source for legend values - const entryRef = ref(scope.add(LegendEntries(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + const entryRef = ref(scope.add(LegendEntries(params2 = { + type: type2, + scale: scope.scaleRef(scale2), + count: scope.objectProperty(_("tickCount")), + limit: scope.property(_("symbolLimit")), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // continuous gradient legend - if (type === Gradient) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); - } else if (type === Discrete) children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - // include legend title if defined - if (datum.title) children.push(legendTitle(spec, config, encode.title, dataRef)); - // parse legend specification + if (type2 === Gradient) { + children2 = [legendGradient(spec, scale2, config, encode2.gradient), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + params2.count = params2.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); + } else if (type2 === Discrete) { + children2 = [legendGradientDiscrete(spec, scale2, config, encode2.gradient, entryRef), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + } else { + entryLayout = legendSymbolLayout(spec, config); + children2 = [legendSymbolGroups(spec, config, encode2, entryRef, deref(entryLayout.columns))]; + params2.size = sizeExpression(spec, scope, children2[0].marks); + } + children2 = [guideGroup({ + role: LegendEntryRole, + from: dataRef, + encode: entryEncode, + marks: children2, + layout: entryLayout, + interactive: interactive2 + })]; + if (datum2.title) { + children2.push(legendTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: LegendRole, - from: dataRef, - encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: LegendRole, + from: dataRef, + encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function legendType(spec, scaleType) { - let type = spec.type || Symbols; - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) type = (0, _vegaScale.isContinuous)(scaleType) ? Gradient : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Symbols; - return type !== Gradient ? type : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Gradient; -} -function scaleCount(spec) { - return LegendScales.reduce((count, type)=>count + (spec[type] ? 1 : 0), 0); -} -function buildLegendEncode(_, spec, config) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; -} -function sizeExpression(spec, scope, marks) { - const size = deref(getChannel('size', spec, marks)), strokeWidth = deref(getChannel('strokeWidth', spec, marks)), fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - return (0, _vegaFunctions.parseExpression)(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope); -} -function getChannel(name, spec, marks) { + } + function legendType(spec, scaleType) { + let type2 = spec.type || Symbols; + if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { + type2 = isContinuous(scaleType) ? Gradient : isDiscretizing(scaleType) ? Discrete : Symbols; + } + return type2 !== Gradient ? type2 : isDiscretizing(scaleType) ? Discrete : Gradient; + } + function scaleCount(spec) { + return LegendScales.reduce((count2, type2) => count2 + (spec[type2] ? 1 : 0), 0); + } + function buildLegendEncode(_, spec, config) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset"), + padding: _("padding"), + titlePadding: _("titlePadding"), + cornerRadius: _("cornerRadius"), + fill: _("fillColor"), + stroke: _("strokeColor"), + strokeWidth: config.strokeWidth, + strokeDash: config.strokeDash, + x: _("legendX"), + y: _("legendY"), + // accessibility support + format: spec.format, + formatType: spec.formatType + }); + return encode2; + } + function sizeExpression(spec, scope, marks) { + const size2 = deref(getChannel("size", spec, marks)), strokeWidth = deref(getChannel("strokeWidth", spec, marks)), fontSize2 = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); + return parser(`max(ceil(sqrt(${size2})+${strokeWidth}),${fontSize2})`, scope); + } + function getChannel(name, spec, marks) { return spec[name] ? `scale("${spec[name]}",datum)` : getEncoding(name, marks[0].encode); -} -function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); -} -const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; -function parseTitle(spec, scope) { - spec = (0, _vegaUtil.isString)(spec) ? { - text: spec + } + function getFontSize(encode2, scope, style2) { + return getEncoding("fontSize", encode2) || getStyle("fontSize", scope, style2); + } + const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; + function parseTitle(spec, scope) { + spec = isString(spec) ? { + text: spec } : spec; - const _ = lookup(spec, scope.config.title), encode = spec.encode || {}, userEncode = encode.group || {}, name = userEncode.name || undefined, interactive = userEncode.interactive, style = userEncode.style, children = []; - // single-element data source for group title - const datum = {}, dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - // include subtitle text - if (spec.subtitle) children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - // parse title specification + const _ = lookup(spec, scope.config.title), encode2 = spec.encode || {}, userEncode = encode2.group || {}, name = userEncode.name || void 0, interactive2 = userEncode.interactive, style2 = userEncode.style, children2 = []; + const datum2 = {}, dataRef = ref(scope.add(Collect(null, [datum2]))); + children2.push(buildTitle(spec, _, titleEncode(spec), dataRef)); + if (spec.subtitle) { + children2.push(buildSubTitle(spec, _, encode2.subtitle, dataRef)); + } return parseMark(guideGroup({ - role: TitleRole, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: TitleRole, + from: dataRef, + encode: groupEncode(_, userEncode), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -// provide backwards-compatibility for title custom encode; -// the top-level encode block has been *deprecated*. -function titleEncode(spec) { - const encode = spec.encode; - return encode && encode.title || (0, _vegaUtil.extend)({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); -} -function groupEncode(_, userEncode) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: { - signal: alignExpr$1 - }, - angle: { - signal: angleExpr - }, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') + } + function titleEncode(spec) { + const encode2 = spec.encode; + return encode2 && encode2.title || extend$1({ + name: spec.name, + interactive: spec.interactive, + style: spec.style + }, encode2); + } + function groupEncode(_, userEncode) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + anchor: _("anchor"), + align: { + signal: alignExpr$1 + }, + angle: { + signal: angleExpr + }, + limit: _("limit"), + frame: _("frame"), + offset: _("offset") || 0, + padding: _("subtitlePadding") }); - return extendEncode(encode, userEncode, Skip); -} -function buildTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.text, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + return extendEncode(encode2, userEncode, Skip); + } + function buildTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.text, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("color"), + font: _("font"), + fontSize: _("fontSize"), + fontStyle: _("fontStyle"), + fontWeight: _("fontWeight"), + lineHeight: _("lineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleTextRole, + style: GroupTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function buildSubTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.subtitle, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + } + function buildSubTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.subtitle, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("subtitleColor"), + font: _("subtitleFont"), + fontSize: _("subtitleFontSize"), + fontStyle: _("subtitleFontStyle"), + fontWeight: _("subtitleFontWeight"), + lineHeight: _("subtitleLineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleSubtitleRole, + style: GroupSubtitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function parseData(data, scope) { - const transforms = []; - if (data.transform) data.transform.forEach((tx)=>{ - transforms.push(parseTransform(tx, scope)); - }); - if (data.on) data.on.forEach((on)=>{ - parseTrigger(on, scope, data.name); - }); - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); -} -/** - * Analyze a data pipeline, add needed operators. - */ function analyze(data, scope, ops) { - const output = []; - let source = null, modify = false, generate = false, upstream, i, n, t, m; - if (data.values) { - // hard-wired input data set - if (isSignal(data.values) || hasSignal(data.format)) { - // if either values is signal or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format + } + function parseData(data2, scope) { + const transforms2 = []; + if (data2.transform) { + data2.transform.forEach((tx2) => { + transforms2.push(parseTransform(tx2, scope)); + }); + } + if (data2.on) { + data2.on.forEach((on2) => { + parseTrigger(on2, scope, data2.name); + }); + } + scope.addDataPipeline(data2.name, analyze(data2, scope, transforms2)); + } + function analyze(data2, scope, ops2) { + const output2 = []; + let source2 = null, modify2 = false, generate2 = false, upstream, i, n, t, m2; + if (data2.values) { + if (isSignal(data2.values) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $ingest: data2.values, + $format: data2.format })); - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format + } + } else if (data2.url) { + if (hasSignal(data2.url) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $request: data2.url, + $format: data2.format })); - } else if (data.source) { - // derives from one or more other data sets - source = upstream = (0, _vegaUtil.array)(data.source).map((d)=>ref(scope.getData(d).output)); - output.push(null); // populate later - } - // scan data transforms, add collectors as needed - for(i = 0, n = ops.length; i < n; ++i){ - t = ops[i]; - m = t.metadata; - if (!source && !m.source) output.push(source = collect()); - output.push(t); - if (m.generates) generate = true; - if (m.modifies && !generate) modify = true; - if (m.source) source = t; - else if (m.changes) source = null; + } + } else if (data2.source) { + source2 = upstream = array$5(data2.source).map((d) => ref(scope.getData(d).output)); + output2.push(null); + } + for (i = 0, n = ops2.length; i < n; ++i) { + t = ops2[i]; + m2 = t.metadata; + if (!source2 && !m2.source) { + output2.push(source2 = collect()); + } + output2.push(t); + if (m2.generates) generate2 = true; + if (m2.modifies && !generate2) modify2 = true; + if (m2.source) source2 = t; + else if (m2.changes) source2 = null; } if (upstream) { - n = upstream.length - 1; - output[0] = Relay({ - derive: modify, - pulse: n ? upstream : upstream[0] - }); - if (modify || n) // collect derived and multi-pulse tuples - output.splice(1, 0, collect()); - } - if (!source) output.push(collect()); - output.push(Sieve({})); - return output; -} -function collect(values) { - const s = Collect({}, values); + n = upstream.length - 1; + output2[0] = Relay({ + derive: modify2, + pulse: n ? upstream : upstream[0] + }); + if (modify2 || n) { + output2.splice(1, 0, collect()); + } + } + if (!source2) output2.push(collect()); + output2.push(Sieve({})); + return output2; + } + function collect(values2) { + const s = Collect({}, values2); s.metadata = { - source: true + source: true }; return s; -} -function load(scope, data) { + } + function load(scope, data2) { return Load({ - url: data.url ? scope.property(data.url) : undefined, - async: data.async ? scope.property(data.async) : undefined, - values: data.values ? scope.property(data.values) : undefined, - format: scope.objectProperty(data.format) - }); -} -const isX = (orient)=>orient === Bottom || orient === Top; -// get sign coefficient based on axis orient -const getSign = (orient, a, b)=>isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left || orient === Top ? a : b; -// condition on axis x-direction -const ifX = (orient, a, b)=>isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; -// condition on axis y-direction -const ifY = (orient, a, b)=>isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a; -const ifTop = (orient, a, b)=>isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top ? { - value: a - } : { - value: b - }; -const ifRight = (orient, a, b)=>isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right ? { - value: a - } : { - value: b - }; -const ifXEnc = ($orient, a, b)=>ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b); -const ifYEnc = ($orient, a, b)=>ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b); -const ifLeftTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b); -const ifTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Top}'`, a, b); -const ifRightExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Right}'`, a, b); -const ifEnc = (test, a, b)=>{ - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? a.signal || (0, _vegaUtil.stringValue)(a.value) : null; - b = b ? b.signal || (0, _vegaUtil.stringValue)(b.value) : null; - return { - signal: `${test} ? (${a}) : (${b})` - }; - } else // otherwise generate rule set - return [ - (0, _vegaUtil.extend)({ - test - }, a) - ].concat(b || []); -}; -const isSimple = (enc)=>enc == null || Object.keys(enc).length === 1; -const ifExpr = (test, a, b)=>({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` - }); -const ifOrient = ($orient, t, b, l, r)=>({ - signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') + '(null)' + url: data2.url ? scope.property(data2.url) : void 0, + async: data2.async ? scope.property(data2.async) : void 0, + values: data2.values ? scope.property(data2.values) : void 0, + format: scope.objectProperty(data2.format) }); -const toExpr = (v)=>isSignal(v) ? v.signal : v == null ? null : (0, _vegaUtil.stringValue)(v); -const mult = (sign, value)=>value === 0 ? 0 : isSignal(sign) ? { - signal: `(${sign.signal}) * ${value}` - } : { - value: sign * value - }; -const patch = (value, base)=>{ - const s = value.signal; - return s && s.endsWith('(null)') ? { - signal: s.slice(0, -6) + base.signal - } : value; -}; -function fallback(prop, config, axisConfig, style) { + } + const isX = (orient) => orient === Bottom || orient === Top; + const getSign = (orient, a2, b2) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a2, b2) : orient === Left || orient === Top ? a2 : b2; + const ifX = (orient, a2, b2) => isSignal(orient) ? ifXEnc(orient.signal, a2, b2) : isX(orient) ? a2 : b2; + const ifY = (orient, a2, b2) => isSignal(orient) ? ifYEnc(orient.signal, a2, b2) : isX(orient) ? b2 : a2; + const ifTop = (orient, a2, b2) => isSignal(orient) ? ifTopExpr(orient.signal, a2, b2) : orient === Top ? { + value: a2 + } : { + value: b2 + }; + const ifRight = (orient, a2, b2) => isSignal(orient) ? ifRightExpr(orient.signal, a2, b2) : orient === Right ? { + value: a2 + } : { + value: b2 + }; + const ifXEnc = ($orient, a2, b2) => ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a2, b2); + const ifYEnc = ($orient, a2, b2) => ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a2, b2); + const ifLeftTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a2, b2); + const ifTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Top}'`, a2, b2); + const ifRightExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Right}'`, a2, b2); + const ifEnc = (test2, a2, b2) => { + a2 = a2 != null ? encoder(a2) : a2; + b2 = b2 != null ? encoder(b2) : b2; + if (isSimple(a2) && isSimple(b2)) { + a2 = a2 ? a2.signal || $(a2.value) : null; + b2 = b2 ? b2.signal || $(b2.value) : null; + return { + signal: `${test2} ? (${a2}) : (${b2})` + }; + } else { + return [extend$1({ + test: test2 + }, a2)].concat(b2 || []); + } + }; + const isSimple = (enc) => enc == null || Object.keys(enc).length === 1; + const ifExpr = (test2, a2, b2) => ({ + signal: `${test2} ? (${toExpr(a2)}) : (${toExpr(b2)})` + }); + const ifOrient = ($orient, t, b2, l, r) => ({ + signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : "") + (b2 != null ? `${$orient} === '${Bottom}' ? (${toExpr(b2)}) : ` : "") + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : "") + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : "") + "(null)" + }); + const toExpr = (v) => isSignal(v) ? v.signal : v == null ? null : $(v); + const mult = (sign2, value2) => value2 === 0 ? 0 : isSignal(sign2) ? { + signal: `(${sign2.signal}) * ${value2}` + } : { + value: sign2 * value2 + }; + const patch = (value2, base2) => { + const s = value2.signal; + return s && s.endsWith("(null)") ? { + signal: s.slice(0, -6) + base2.signal + } : value2; + }; + function fallback(prop, config, axisConfig2, style2) { let styleProp; - if (config && (0, _vegaUtil.hasOwnProperty)(config, prop)) return config[prop]; - else if ((0, _vegaUtil.hasOwnProperty)(axisConfig, prop)) return axisConfig[prop]; - else if (prop.startsWith('title')) { - switch(prop){ - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } else if (prop.startsWith('label')) { - switch(prop){ - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; + if (config && has$1(config, prop)) { + return config[prop]; + } else if (has$1(axisConfig2, prop)) { + return axisConfig2[prop]; + } else if (prop.startsWith("title")) { + switch (prop) { + case "titleColor": + styleProp = "fill"; + break; + case "titleFont": + case "titleFontSize": + case "titleFontWeight": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideTitleStyle][styleProp]; + } else if (prop.startsWith("label")) { + switch (prop) { + case "labelColor": + styleProp = "fill"; + break; + case "labelFont": + case "labelFontSize": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideLabelStyle][styleProp]; } return null; -} -function keys(objects) { - const map = {}; - for (const obj of objects){ - if (!obj) continue; - for(const key in obj)map[key] = 1; - } - return Object.keys(map); -} -function axisConfig(spec, scope) { - var config = scope.config, style = config.style, axis = config.axis, band = scope.scaleType(spec.scale) === 'band' && config.axisBand, orient = spec.orient, xy, or, key; + } + function keys(objects) { + const map2 = {}; + for (const obj2 of objects) { + if (!obj2) continue; + for (const key2 in obj2) map2[key2] = 1; + } + return Object.keys(map2); + } + function axisConfig(spec, scope) { + var config = scope.config, style2 = config.style, axis = config.axis, band2 = scope.scaleType(spec.scale) === "band" && config.axisBand, orient = spec.orient, xy, or2, key2; if (isSignal(orient)) { - const xyKeys = keys([ - config.axisX, - config.axisY - ]), orientKeys = keys([ - config.axisTop, - config.axisBottom, - config.axisLeft, - config.axisRight - ]); - xy = {}; - for (key of xyKeys)xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style)); - or = {}; - for (key of orientKeys)or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style)); + const xyKeys = keys([config.axisX, config.axisY]), orientKeys = keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]); + xy = {}; + for (key2 of xyKeys) { + xy[key2] = ifX(orient, fallback(key2, config.axisX, axis, style2), fallback(key2, config.axisY, axis, style2)); + } + or2 = {}; + for (key2 of orientKeys) { + or2[key2] = ifOrient(orient.signal, fallback(key2, config.axisTop, axis, style2), fallback(key2, config.axisBottom, axis, style2), fallback(key2, config.axisLeft, axis, style2), fallback(key2, config.axisRight, axis, style2)); + } } else { - xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; + xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; + or2 = config["axis" + orient[0].toUpperCase() + orient.slice(1)]; } - const result = xy || or || band ? (0, _vegaUtil.extend)({}, axis, xy, or, band) : axis; + const result = xy || or2 || band2 ? extend$1({}, axis, xy, or2, band2) : axis; return result; -} -function axisDomain(spec, config, userEncode, dataRef) { + } + function axisDomain(spec, config, userEncode, dataRef) { const _ = lookup(spec, config), orient = spec.orient; - let enter, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: { - opacity: zero - } + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') + addEncoders(encode2, { + stroke: _("domainColor"), + strokeCap: _("domainCap"), + strokeDash: _("domainDash"), + strokeDashOffset: _("domainDashOffset"), + strokeWidth: _("domainWidth"), + strokeOpacity: _("domainOpacity") }); const pos0 = position(spec, 0); const pos1 = position(spec, 1); - enter.x = update.x = ifX(orient, pos0, zero); - enter.x2 = update.x2 = ifX(orient, pos1); - enter.y = update.y = ifY(orient, pos0, zero); - enter.y2 = update.y2 = ifY(orient, pos1); + enter.x = update2.x = ifX(orient, pos0, zero); + enter.x2 = update2.x2 = ifX(orient, pos1); + enter.y = update2.y = ifY(orient, pos0, zero); + enter.y2 = update2.y2 = ifY(orient, pos1); return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode + type: RuleMark, + role: AxisDomainRole, + from: dataRef, + encode: encode2 }, userEncode); -} -function position(spec, pos) { + } + function position(spec, pos) { return { - scale: spec.scale, - range: pos - }; -} -function axisGrid(spec, config, userEncode, dataRef, band) { - const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign = getSign(orient, 1, -1), offset = offsetValue(spec.offset, sign); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero - } + scale: spec.scale, + range: pos + }; + } + function axisGrid(spec, config, userEncode, dataRef, band2) { + const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign2 = getSign(orient, 1, -1), offset2 = offsetValue(spec.offset, sign2); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') + addEncoders(encode2, { + stroke: _("gridColor"), + strokeCap: _("gridCap"), + strokeDash: _("gridDash"), + strokeDashOffset: _("gridDashOffset"), + strokeOpacity: _("gridOpacity"), + strokeWidth: _("gridWidth") }); const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - const sz = ifX(orient, { - signal: 'height' + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + const sz2 = ifX(orient, { + signal: "height" }, { - signal: 'width' + signal: "width" }); const gridStart = vscale ? { - scale: vscale, - range: 0, - mult: sign, - offset: offset + scale: vscale, + range: 0, + mult: sign2, + offset: offset2 } : { - value: 0, - offset: offset + value: 0, + offset: offset2 }; const gridEnd = vscale ? { - scale: vscale, - range: 1, - mult: sign, - offset: offset - } : (0, _vegaUtil.extend)(sz, { - mult: sign, - offset: offset - }); - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); + scale: vscale, + range: 1, + mult: sign2, + offset: offset2 + } : extend$1(sz2, { + mult: sign2, + offset: offset2 + }); + enter.x = update2.x = ifX(orient, tickPos, gridStart); + enter.y = update2.y = ifY(orient, tickPos, gridStart); + enter.x2 = update2.x2 = ifY(orient, gridEnd); + enter.y2 = update2.y2 = ifX(orient, gridEnd); exit.x = ifX(orient, tickPos); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisGridRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function offsetValue(offset, sign) { - if (sign === 1) ; - else if (!(0, _vegaUtil.isObject)(offset)) offset = isSignal(sign) ? { - signal: `(${sign.signal}) * (${offset || 0})` - } : sign * (offset || 0); - else { - let entry = offset = (0, _vegaUtil.extend)({}, offset); - while(entry.mult != null)if (!(0, _vegaUtil.isObject)(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? { - signal: `(${entry.mult}) * (${sign.signal})` - } : entry.mult * sign; - return offset; - } else entry = entry.mult = (0, _vegaUtil.extend)({}, entry.mult); - entry.mult = sign; - } - return offset; -} -function axisTicks(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero + } + function offsetValue(offset2, sign2) { + if (sign2 === 1) ; + else if (!isObject$1(offset2)) { + offset2 = isSignal(sign2) ? { + signal: `(${sign2.signal}) * (${offset2 || 0})` + } : sign2 * (offset2 || 0); + } else { + let entry2 = offset2 = extend$1({}, offset2); + while (entry2.mult != null) { + if (!isObject$1(entry2.mult)) { + entry2.mult = isSignal(sign2) ? { + signal: `(${entry2.mult}) * (${sign2.signal})` + } : entry2.mult * sign2; + return offset2; + } else { + entry2 = entry2.mult = extend$1({}, entry2.mult); } + } + entry2.mult = sign2; + } + return offset2; + } + function axisTicks(spec, config, userEncode, dataRef, size2, band2) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') + addEncoders(encode2, { + stroke: _("tickColor"), + strokeCap: _("tickCap"), + strokeDash: _("tickDash"), + strokeDashOffset: _("tickDashOffset"), + strokeOpacity: _("tickOpacity"), + strokeWidth: _("tickWidth") }); - const tickSize = encoder(size); - tickSize.mult = sign; + const tickSize = encoder(size2); + tickSize.mult = sign2; const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - update.y = enter.y = ifX(orient, zero, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + update2.y = enter.y = ifX(orient, zero, tickPos); + update2.y2 = enter.y2 = ifX(orient, tickSize); exit.x = ifX(orient, tickPos); - update.x = enter.x = ifY(orient, zero, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); + update2.x = enter.x = ifY(orient, zero, tickPos); + update2.x2 = enter.x2 = ifY(orient, tickSize); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisTickRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function flushExpr(scale, threshold, a, b, c) { + } + function flushExpr(scale2, threshold2, a2, b2, c2) { return { - signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')' - }; -} -function axisLabels(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, scale = spec.scale, sign = getSign(orient, -1, 1), flush = deref(_('labelFlush')), flushOffset = deref(_('labelFlushOffset')), labelAlign = _('labelAlign'), labelBaseline = _('labelBaseline'); - let flushOn = flush === 0 || !!flush, update; - const tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; + signal: 'flush(range("' + scale2 + '"), scale("' + scale2 + '", datum.value), ' + threshold2 + "," + a2 + "," + b2 + "," + c2 + ")" + }; + } + function axisLabels(spec, config, userEncode, dataRef, size2, band2) { + const _ = lookup(spec, config), orient = spec.orient, scale2 = spec.scale, sign2 = getSign(orient, -1, 1), flush2 = deref(_("labelFlush")), flushOffset = deref(_("labelFlushOffset")), labelAlign = _("labelAlign"), labelBaseline = _("labelBaseline"); + let flushOn = flush2 === 0 || !!flush2, update2; + const tickSize = encoder(size2); + tickSize.mult = sign2; + tickSize.offset = encoder(_("labelPadding") || 0); + tickSize.offset.mult = sign2; const tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - const align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : { - value: 'center' - }, ifRight(orient, 'left', 'right')); - const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : { - value: 'middle' - }); - const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); + scale: scale2, + field: Value, + band: 0.5, + offset: extendOffset(band2.offset, _("labelOffset")) + }; + const align = ifX(orient, flushOn ? flushExpr(scale2, flush2, '"left"', '"right"', '"center"') : { + value: "center" + }, ifRight(orient, "left", "right")); + const baseline2 = ifX(orient, ifTop(orient, "bottom", "top"), flushOn ? flushExpr(scale2, flush2, '"top"', '"bottom"', '"middle"') : { + value: "middle" + }); + const offsetExpr = flushExpr(scale2, flush2, `-(${flushOffset})`, flushOffset, 0); flushOn = flushOn && flushOffset; const enter = { - opacity: zero, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - const encode = { - enter: enter, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y, - align, - baseline + opacity: zero, + x: ifX(orient, tickPos, tickSize), + y: ifY(orient, tickPos, tickSize) + }; + const encode2 = { + enter, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero, - x: enter.x, - y: enter.y - } + x: enter.x, + y: enter.y, + align, + baseline: baseline2 + }, + exit: { + opacity: zero, + x: enter.x, + y: enter.y + } }; - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') + addEncoders(encode2, { + dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, + dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null + }); + addEncoders(encode2, { + angle: _("labelAngle"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontWeight: _("labelFontWeight"), + fontStyle: _("labelFontStyle"), + limit: _("labelLimit"), + lineHeight: _("labelLineHeight") }, { - align: labelAlign, - baseline: labelBaseline - }); - const bound = _('labelBound'); - let overlap = _('labelOverlap'); - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? { - scale, - orient, - tolerance: bound - } : null - } : undefined; - if (update.align !== align) update.align = patch(update.align, align); - if (update.baseline !== baseline) update.baseline = patch(update.baseline, baseline); + align: labelAlign, + baseline: labelBaseline + }); + const bound2 = _("labelBound"); + let overlap = _("labelOverlap"); + overlap = overlap || bound2 ? { + separation: _("labelSeparation"), + method: overlap, + order: "datum.index", + bound: bound2 ? { + scale: scale2, + orient, + tolerance: bound2 + } : null + } : void 0; + if (update2.align !== align) { + update2.align = patch(update2.align, align); + } + if (update2.baseline !== baseline2) { + update2.baseline = patch(update2.baseline, baseline2); + } return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: AxisLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -function axisTitle(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, update; - const encode = { - enter: enter = { - opacity: zero, - anchor: encoder(_('titleAnchor', null)), - align: { - signal: alignExpr$1 - } - }, - update: update = (0, _vegaUtil.extend)({}, enter, { - opacity: one, - text: encoder(spec.title) - }), - exit: { - opacity: zero + } + function axisTitle(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero, + anchor: encoder(_("titleAnchor", null)), + align: { + signal: alignExpr$1 } + }, + update: update2 = extend$1({}, enter, { + opacity: one, + text: encoder(spec.title) + }), + exit: { + opacity: zero + } }; const titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` + signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` }; - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero, mult(sign, 90)); + update2.x = ifX(orient, titlePos); + update2.y = ifY(orient, titlePos); + enter.angle = ifX(orient, zero, mult(sign2, 90)); enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), { - value: Bottom - }); - update.angle = enter.angle; - update.baseline = enter.baseline; - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + value: Bottom + }); + update2.angle = enter.angle; + update2.baseline = enter.baseline; + addEncoders(encode2, { + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); + // require update + align: _("titleAlign"), + angle: _("titleAngle"), + baseline: _("titleBaseline") + }); + autoLayout(_, orient, encode2, userEncode); + encode2.update.align = patch(encode2.update.align, enter.align); + encode2.update.angle = patch(encode2.update.angle, enter.angle); + encode2.update.baseline = patch(encode2.update.baseline, enter.baseline); return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: AxisTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim)=>value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false; - const autoY = auto(_('titleX'), 'x'), autoX = auto(_('titleY'), 'y'); - encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); -} -function parseAxis(spec, scope) { - const config = axisConfig(spec, scope), encode = spec.encode || {}, axisEncode = encode.axis || {}, name = axisEncode.name || undefined, interactive = axisEncode.interactive, style = axisEncode.style, _ = lookup(spec, config), band = tickBand(_); - // single-element data source for axis group - const datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - const dataRef = ref(scope.add(Collect({}, [ - datum - ]))); - // data source for axis ticks + } + function autoLayout(_, orient, encode2, userEncode) { + const auto = (value2, dim) => value2 != null ? (encode2.update[dim] = patch(encoder(value2), encode2.update[dim]), false) : !has(dim, userEncode) ? true : false; + const autoY = auto(_("titleX"), "x"), autoX = auto(_("titleY"), "y"); + encode2.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); + } + function parseAxis(spec, scope) { + const config = axisConfig(spec, scope), encode2 = spec.encode || {}, axisEncode = encode2.axis || {}, name = axisEncode.name || void 0, interactive2 = axisEncode.interactive, style2 = axisEncode.style, _ = lookup(spec, config), band2 = tickBand(_); + const datum2 = { + scale: spec.scale, + ticks: !!_("ticks"), + labels: !!_("labels"), + grid: !!_("grid"), + domain: !!_("domain"), + title: spec.title != null + }; + const dataRef = ref(scope.add(Collect({}, [datum2]))); const ticksRef = ref(scope.add(AxisTicks({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + scale: scope.scaleRef(spec.scale), + extra: scope.property(band2.extra), + count: scope.objectProperty(spec.tickCount), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // generate axis marks - const children = []; - let size; - // include axis gridlines if requested - if (datum.grid) children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - // include axis domain path if requested - if (datum.domain) children.push(axisDomain(spec, config, encode.domain, dataRef)); - // include axis title if defined - if (datum.title) children.push(axisTitle(spec, config, encode.title, dataRef)); - // parse axis specification + const children2 = []; + let size2; + if (datum2.grid) { + children2.push(axisGrid(spec, config, encode2.grid, ticksRef, band2)); + } + if (datum2.ticks) { + size2 = _("tickSize"); + children2.push(axisTicks(spec, config, encode2.ticks, ticksRef, size2, band2)); + } + if (datum2.labels) { + size2 = datum2.ticks ? size2 : 0; + children2.push(axisLabels(spec, config, encode2.labels, ticksRef, size2, band2)); + } + if (datum2.domain) { + children2.push(axisDomain(spec, config, encode2.domain, dataRef)); + } + if (datum2.title) { + children2.push(axisTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: AxisRole, - from: dataRef, - encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: AxisRole, + from: dataRef, + encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function buildAxisEncode(_, spec) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: { - signal: `abs(span(range("${spec.scale}")))` - }, - translate: _('translate'), - // accessibility support - format: spec.format, - formatType: spec.formatType + } + function buildAxisEncode(_, spec) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset") || 0, + position: value(spec.position, 0), + titlePadding: _("titlePadding"), + minExtent: _("minExtent"), + maxExtent: _("maxExtent"), + range: { + signal: `abs(span(range("${spec.scale}")))` + }, + translate: _("translate"), + // accessibility support + format: spec.format, + formatType: spec.formatType }); - return encode; -} -function parseScope(spec, scope, preprocessed) { - const signals = (0, _vegaUtil.array)(spec.signals), scales = (0, _vegaUtil.array)(spec.scales); - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach((_)=>parseSignal(_, scope)); - // parse cartographic projection definitions - (0, _vegaUtil.array)(spec.projections).forEach((_)=>parseProjection(_, scope)); - // initialize scale references - scales.forEach((_)=>initScale(_, scope)); - // parse data sources - (0, _vegaUtil.array)(spec.data).forEach((_)=>parseData(_, scope)); - // parse scale definitions - scales.forEach((_)=>parseScale(_, scope)); - // parse signal updates - (preprocessed || signals).forEach((_)=>parseSignalUpdates(_, scope)); - // parse axis definitions - (0, _vegaUtil.array)(spec.axes).forEach((_)=>parseAxis(_, scope)); - // parse mark definitions - (0, _vegaUtil.array)(spec.marks).forEach((_)=>parseMark(_, scope)); - // parse legend definitions - (0, _vegaUtil.array)(spec.legends).forEach((_)=>parseLegend(_, scope)); - // parse title, if defined + return encode2; + } + function parseScope(spec, scope, preprocessed) { + const signals = array$5(spec.signals), scales2 = array$5(spec.scales); + if (!preprocessed) signals.forEach((_) => parseSignal(_, scope)); + array$5(spec.projections).forEach((_) => parseProjection(_, scope)); + scales2.forEach((_) => initScale(_, scope)); + array$5(spec.data).forEach((_) => parseData(_, scope)); + scales2.forEach((_) => parseScale(_, scope)); + (preprocessed || signals).forEach((_) => parseSignalUpdates(_, scope)); + array$5(spec.axes).forEach((_) => parseAxis(_, scope)); + array$5(spec.marks).forEach((_) => parseMark(_, scope)); + array$5(spec.legends).forEach((_) => parseLegend(_, scope)); if (spec.title) parseTitle(spec.title, scope); - // parse collected lambda (anonymous) expressions scope.parseLambdas(); return scope; -} -const rootEncode = (spec)=>extendEncode({ - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - }, - update: { - width: { - signal: 'width' - }, - height: { - signal: 'height' - } - } - }, spec); -function parseView(spec, scope) { + } + const rootEncode = (spec) => extendEncode({ + enter: { + x: { + value: 0 + }, + y: { + value: 0 + } + }, + update: { + width: { + signal: "width" + }, + height: { + signal: "height" + } + } + }, spec); + function parseView(spec, scope) { const config = scope.config; - // add scenegraph root const root = ref(scope.root = scope.add(operator())); - // parse top-level signal definitions const signals = collectSignals(spec, config); - signals.forEach((_)=>parseSignal(_, scope)); - // assign description, event, legend, and locale configuration + signals.forEach((_) => parseSignal(_, scope)); scope.description = spec.description || config.description; scope.eventConfig = config.events; scope.legends = scope.objectProperty(config.legend && config.legend.layout); scope.locale = config.locale; - // store root group item const input = scope.add(Collect()); - // encode root group item - const encode = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { - pulse: ref(input) + const encode2 = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { + pulse: ref(input) }))); - // perform view layout const parent = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) + layout: scope.objectProperty(spec.layout), + legends: scope.legends, + autosize: scope.signalRef("autosize"), + mark: root, + pulse: ref(encode2) })); scope.operators.pop(); - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); + scope.pushState(ref(encode2), ref(parent), null); parseScope(spec, scope, signals); scope.operators.push(parent); - // bound / render / sieve root item let op = scope.add(Bound({ - mark: root, - pulse: ref(parent) + mark: root, + pulse: ref(parent) })); op = scope.add(Render({ - pulse: ref(op) + pulse: ref(op) })); op = scope.add(Sieve({ - pulse: ref(op) + pulse: ref(op) })); - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); + scope.addData("root", new DataScope$1(scope, input, input, op)); return scope; -} -function signalObject(name, value) { - return value && value.signal ? { - name, - update: value.signal + } + function signalObject(name, value2) { + return value2 && value2.signal ? { + name, + update: value2.signal } : { - name, - value - }; -} -/** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ function collectSignals(spec, config) { - const _ = (name)=>value(spec[name], config[name]), signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], pre = signals.reduce((p, s)=>(p[s.name] = s, p), {}), map = {}; - // add spec signal array - (0, _vegaUtil.array)(spec.signals).forEach((s)=>{ - if ((0, _vegaUtil.hasOwnProperty)(pre, s.name)) // merge if built-in signal - s = (0, _vegaUtil.extend)(pre[s.name], s); - else // otherwise add to signal list + name, + value: value2 + }; + } + function collectSignals(spec, config) { + const _ = (name) => value(spec[name], config[name]), signals = [signalObject("background", _("background")), signalObject("autosize", parseAutosize(_("autosize"))), signalObject("padding", parsePadding(_("padding"))), signalObject("width", _("width") || 0), signalObject("height", _("height") || 0)], pre = signals.reduce((p, s) => (p[s.name] = s, p), {}), map2 = {}; + array$5(spec.signals).forEach((s) => { + if (has$1(pre, s.name)) { + s = extend$1(pre[s.name], s); + } else { signals.push(s); - map[s.name] = s; + } + map2[s.name] = s; }); - // add config signal array - (0, _vegaUtil.array)(config.signals).forEach((s)=>{ - if (!(0, _vegaUtil.hasOwnProperty)(map, s.name) && !(0, _vegaUtil.hasOwnProperty)(pre, s.name)) // add to signal list if not already defined + array$5(config.signals).forEach((s) => { + if (!has$1(map2, s.name) && !has$1(pre, s.name)) { signals.push(s); + } }); return signals; -} -function Scope(config, options) { + } + function Scope(config, options) { this.config = config || {}; this.options = options || {}; this.bindings = []; @@ -47114,15 +32625,13 @@ function Scope(config, options) { this.locale = null; this._id = 0; this._subid = 0; - this._nextsub = [ - 0 - ]; + this._nextsub = [0]; this._parent = []; this._encode = []; this._lookup = []; this._markpath = []; -} -function Subscope(scope) { + } + function Subscope(scope) { this.config = scope.config; this.options = scope.options; this.legends = scope.legends; @@ -47142,8165 +32651,5775 @@ function Subscope(scope) { this._encode = scope._encode.slice(); this._lookup = scope._lookup.slice(); this._markpath = scope._markpath; -} -Scope.prototype = Subscope.prototype = { - parse (spec) { - return parseScope(spec, this); - }, - fork () { - return new Subscope(this); - }, - isSubscope () { - return this._subid > 0; - }, - toRuntime () { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; - }, - id () { - return (this._subid ? this._subid + ':' : 0) + this._id++; - }, - add (op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach((ref)=>{ - ref.$ref = op.id; - }); - op.refs = null; - } - return op; + } + Scope.prototype = Subscope.prototype = { + parse(spec) { + return parseScope(spec, this); + }, + fork() { + return new Subscope(this); + }, + isSubscope() { + return this._subid > 0; + }, + toRuntime() { + this.finish(); + return { + description: this.description, + operators: this.operators, + streams: this.streams, + updates: this.updates, + bindings: this.bindings, + eventConfig: this.eventConfig, + locale: this.locale + }; + }, + id() { + return (this._subid ? this._subid + ":" : 0) + this._id++; + }, + add(op) { + this.operators.push(op); + op.id = this.id(); + if (op.refs) { + op.refs.forEach((ref2) => { + ref2.$ref = op.id; + }); + op.refs = null; + } + return op; }, - proxy (op) { - const vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy({ - value: vref - })); + proxy(op) { + const vref = op instanceof Entry ? ref(op) : op; + return this.add(Proxy({ + value: vref + })); }, - addStream (stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; + addStream(stream2) { + this.streams.push(stream2); + stream2.id = this.id(); + return stream2; }, - addUpdate (update) { - this.updates.push(update); - return update; + addUpdate(update2) { + this.updates.push(update2); + return update2; }, // Apply metadata - finish () { - let name, ds; - // annotate root - if (this.root) this.root.root = true; - // annotate signals - for(name in this.signals)this.signals[name].signal = name; - // annotate scales - for(name in this.scales)this.scales[name].scale = name; - // annotate data sets - function annotate(op, name, type) { - let data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } + finish() { + let name, ds; + if (this.root) this.root.root = true; + for (name in this.signals) { + this.signals[name].signal = name; + } + for (name in this.scales) { + this.scales[name].scale = name; + } + function annotate(op, name2, type2) { + let data2, list; + if (op) { + data2 = op.data || (op.data = {}); + list = data2[name2] || (data2[name2] = []); + list.push(type2); } - for(name in this.data){ - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for(const field in ds.index)annotate(ds.index[field], name, 'index:' + field); + } + for (name in this.data) { + ds = this.data[name]; + annotate(ds.input, name, "input"); + annotate(ds.output, name, "output"); + annotate(ds.values, name, "values"); + for (const field2 in ds.index) { + annotate(ds.index[field2], name, "index:" + field2); } - return this; + } + return this; }, // ---- - pushState (encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve({ - pulse: encode - })))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); - }, - popState () { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); - }, - parent () { - return (0, _vegaUtil.peek)(this._parent); - }, - encode () { - return (0, _vegaUtil.peek)(this._encode); - }, - lookup () { - return (0, _vegaUtil.peek)(this._lookup); + pushState(encode2, parent, lookup2) { + this._encode.push(ref(this.add(Sieve({ + pulse: encode2 + })))); + this._parent.push(parent); + this._lookup.push(lookup2 ? ref(this.proxy(lookup2)) : null); + this._markpath.push(-1); }, - markpath () { - const p = this._markpath; - return ++p[p.length - 1]; + popState() { + this._encode.pop(); + this._parent.pop(); + this._lookup.pop(); + this._markpath.pop(); }, - // ---- - fieldRef (field, name) { - if ((0, _vegaUtil.isString)(field)) return fieldRef$1(field, name); - if (!field.signal) (0, _vegaUtil.error)('Unsupported field reference: ' + (0, _vegaUtil.stringValue)(field)); - const s = field.signal; - let f = this.field[s]; - if (!f) { - const params = { - name: this.signalRef(s) - }; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field(params))); - } - return f; + parent() { + return peek$1(this._parent); }, - compareRef (cmp) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; - const fields = (0, _vegaUtil.array)(cmp.field).map(check), orders = (0, _vegaUtil.array)(cmp.order).map(check); - return signal ? ref(this.add(Compare({ - fields: fields, - orders: orders - }))) : compareRef(fields, orders); + encode() { + return peek$1(this._encode); }, - keyRef (fields, flat) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; - const sig = this.signals; - fields = (0, _vegaUtil.array)(fields).map(check); - return signal ? ref(this.add(Key({ - fields: fields, - flat: flat - }))) : keyRef(fields, flat); + lookup() { + return peek$1(this._lookup); }, - sortRef (sort) { - if (!sort) return sort; - // including id ensures stable sorting - const a = aggrField(sort.op, sort.field), o = sort.order || Ascending; - return o.signal ? ref(this.add(Compare({ - fields: a, - orders: this.signalRef(o.signal) - }))) : compareRef(a, o); + markpath() { + const p = this._markpath; + return ++p[p.length - 1]; }, // ---- - event (source, type) { - const key = source + ':' + type; - if (!this.events[key]) { - const id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; + fieldRef(field2, name) { + if (isString(field2)) return fieldRef$1(field2, name); + if (!field2.signal) { + error("Unsupported field reference: " + $(field2)); + } + const s = field2.signal; + let f = this.field[s]; + if (!f) { + const params2 = { + name: this.signalRef(s) + }; + if (name) params2.as = name; + this.field[s] = f = ref(this.add(Field(params2))); + } + return f; + }, + compareRef(cmp) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; + const fields = array$5(cmp.field).map(check), orders = array$5(cmp.order).map(check); + return signal ? ref(this.add(Compare({ + fields, + orders + }))) : compareRef(fields, orders); + }, + keyRef(fields, flat) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; + const sig = this.signals; + fields = array$5(fields).map(check); + return signal ? ref(this.add(Key({ + fields, + flat + }))) : keyRef(fields, flat); + }, + sortRef(sort2) { + if (!sort2) return sort2; + const a2 = aggrField(sort2.op, sort2.field), o = sort2.order || Ascending; + return o.signal ? ref(this.add(Compare({ + fields: a2, + orders: this.signalRef(o.signal) + }))) : compareRef(a2, o); }, // ---- - hasOwnSignal (name) { - return (0, _vegaUtil.hasOwnProperty)(this.signals, name); + event(source2, type2) { + const key2 = source2 + ":" + type2; + if (!this.events[key2]) { + const id2 = this.id(); + this.streams.push({ + id: id2, + source: source2, + type: type2 + }); + this.events[key2] = id2; + } + return this.events[key2]; }, - addSignal (name, value) { - if (this.hasOwnSignal(name)) (0, _vegaUtil.error)('Duplicate signal name: ' + (0, _vegaUtil.stringValue)(name)); - const op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; + // ---- + hasOwnSignal(name) { + return has$1(this.signals, name); }, - getSignal (name) { - if (!this.signals[name]) (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); - return this.signals[name]; + addSignal(name, value2) { + if (this.hasOwnSignal(name)) { + error("Duplicate signal name: " + $(name)); + } + const op = value2 instanceof Entry ? value2 : this.add(operator(value2)); + return this.signals[name] = op; }, - signalRef (s) { - if (this.signals[s]) return ref(this.signals[s]); - else if (!(0, _vegaUtil.hasOwnProperty)(this.lambdas, s)) this.lambdas[s] = this.add(operator(null)); - return ref(this.lambdas[s]); + getSignal(name) { + if (!this.signals[name]) { + error("Unrecognized signal name: " + $(name)); + } + return this.signals[name]; }, - parseLambdas () { - const code = Object.keys(this.lambdas); - for(let i = 0, n = code.length; i < n; ++i){ - const s = code[i], e = (0, _vegaFunctions.parseExpression)(s, this), op = this.lambdas[s]; - op.params = e.$params; - op.update = e.$expr; - } + signalRef(s) { + if (this.signals[s]) { + return ref(this.signals[s]); + } else if (!has$1(this.lambdas, s)) { + this.lambdas[s] = this.add(operator(null)); + } + return ref(this.lambdas[s]); + }, + parseLambdas() { + const code = Object.keys(this.lambdas); + for (let i = 0, n = code.length; i < n; ++i) { + const s = code[i], e = parser(s, this), op = this.lambdas[s]; + op.params = e.$params; + op.update = e.$expr; + } }, - property (spec) { - return spec && spec.signal ? this.signalRef(spec.signal) : spec; + property(spec) { + return spec && spec.signal ? this.signalRef(spec.signal) : spec; }, - objectProperty (spec) { - return !spec || !(0, _vegaUtil.isObject)(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); + objectProperty(spec) { + return !spec || !isObject$1(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); }, - exprRef (code, name) { - const params = { - expr: (0, _vegaFunctions.parseExpression)(code, this) - }; - if (name) params.expr.$name = name; - return ref(this.add(Expression(params))); + exprRef(code, name) { + const params2 = { + expr: parser(code, this) + }; + if (name) params2.expr.$name = name; + return ref(this.add(Expression(params2))); }, - addBinding (name, bind) { - if (!this.bindings) (0, _vegaUtil.error)('Nested signals do not support binding: ' + (0, _vegaUtil.stringValue)(name)); - this.bindings.push((0, _vegaUtil.extend)({ - signal: name - }, bind)); + addBinding(name, bind2) { + if (!this.bindings) { + error("Nested signals do not support binding: " + $(name)); + } + this.bindings.push(extend$1({ + signal: name + }, bind2)); }, // ---- - addScaleProj (name, transform) { - if ((0, _vegaUtil.hasOwnProperty)(this.scales, name)) (0, _vegaUtil.error)('Duplicate scale or projection name: ' + (0, _vegaUtil.stringValue)(name)); - this.scales[name] = this.add(transform); + addScaleProj(name, transform2) { + if (has$1(this.scales, name)) { + error("Duplicate scale or projection name: " + $(name)); + } + this.scales[name] = this.add(transform2); }, - addScale (name, params) { - this.addScaleProj(name, Scale(params)); + addScale(name, params2) { + this.addScaleProj(name, Scale(params2)); }, - addProjection (name, params) { - this.addScaleProj(name, Projection(params)); + addProjection(name, params2) { + this.addScaleProj(name, Projection(params2)); }, - getScale (name) { - if (!this.scales[name]) (0, _vegaUtil.error)('Unrecognized scale name: ' + (0, _vegaUtil.stringValue)(name)); - return this.scales[name]; + getScale(name) { + if (!this.scales[name]) { + error("Unrecognized scale name: " + $(name)); + } + return this.scales[name]; }, - scaleRef (name) { - return ref(this.getScale(name)); + scaleRef(name) { + return ref(this.getScale(name)); }, - scaleType (name) { - return this.getScale(name).params.type; + scaleType(name) { + return this.getScale(name).params.type; }, - projectionRef (name) { - return this.scaleRef(name); + projectionRef(name) { + return this.scaleRef(name); }, - projectionType (name) { - return this.scaleType(name); + projectionType(name) { + return this.scaleType(name); }, // ---- - addData (name, dataScope) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name] = dataScope; + addData(name, dataScope) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.data[name] = dataScope; }, - getData (name) { - if (!this.data[name]) (0, _vegaUtil.error)('Undefined data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name]; + getData(name) { + if (!this.data[name]) { + error("Undefined data set name: " + $(name)); + } + return this.data[name]; }, - addDataPipeline (name, entries) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.addData(name, DataScope.fromEntries(this, entries)); - } -}; -function propertyLambda(spec) { - return ((0, _vegaUtil.isArray)(spec) ? arrayLambda : objectLambda)(spec); -} -function arrayLambda(array) { - const n = array.length; - let code = '['; - for(let i = 0; i < n; ++i){ - const value = array[i]; - code += (i > 0 ? ',' : '') + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + ']'; -} -function objectLambda(obj) { - let code = '{', i = 0, key, value; - for(key in obj){ - value = obj[key]; - code += (++i > 1 ? ',' : '') + (0, _vegaUtil.stringValue)(key) + ':' + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + '}'; -} -/** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ function defaults() { - const defaultFont = 'sans-serif', defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = '#4c78a8', black = '#000', gray = '#888', lightGray = '#ddd'; + addDataPipeline(name, entries) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.addData(name, DataScope$1.fromEntries(this, entries)); + } + }; + function propertyLambda(spec) { + return (isArray(spec) ? arrayLambda : objectLambda)(spec); + } + function arrayLambda(array2) { + const n = array2.length; + let code = "["; + for (let i = 0; i < n; ++i) { + const value2 = array2[i]; + code += (i > 0 ? "," : "") + (isObject$1(value2) ? value2.signal || propertyLambda(value2) : $(value2)); + } + return code + "]"; + } + function objectLambda(obj2) { + let code = "{", i = 0, key2, value2; + for (key2 in obj2) { + value2 = obj2[key2]; + code += (++i > 1 ? "," : "") + $(key2) + ":" + (isObject$1(value2) ? value2.signal || propertyLambda(value2) : $(value2)); + } + return code + "}"; + } + function defaults$1() { + const defaultFont = "sans-serif", defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = "#4c78a8", black = "#000", gray = "#888", lightGray = "#ddd"; return { - // default visualization description - description: 'Vega visualization', - // default padding around visualization + // default visualization description + description: "Vega visualization", + // default padding around visualization + padding: 0, + // default for automatic sizing; options: 'none', 'pad', 'fit' + // or provide an object (e.g., {'type': 'pad', 'resize': true}) + autosize: "pad", + // default view background color + // covers the entire view component + background: null, + // default event handling configuration + // preventDefault for view-sourced event types except 'wheel' + events: { + defaults: { + allow: ["wheel"] + } + }, + // defaults for top-level group marks + // accepts mark properties (fill, stroke, etc) + // covers the data rectangle within group width/height + group: null, + // defaults for basic mark types + // each subset accepts mark properties (fill, stroke, etc) + mark: null, + arc: { + fill: defaultColor + }, + area: { + fill: defaultColor + }, + image: null, + line: { + stroke: defaultColor, + strokeWidth: defaultStrokeWidth + }, + path: { + stroke: defaultColor + }, + rect: { + fill: defaultColor + }, + rule: { + stroke: black + }, + shape: { + stroke: defaultColor + }, + symbol: { + fill: defaultColor, + size: 64 + }, + text: { + fill: black, + font: defaultFont, + fontSize: 11 + }, + trail: { + fill: defaultColor, + size: defaultStrokeWidth + }, + // style definitions + style: { + // axis & legend labels + "guide-label": { + fill: black, + font: defaultFont, + fontSize: 10 + }, + // axis & legend titles + "guide-title": { + fill: black, + font: defaultFont, + fontSize: 11, + fontWeight: "bold" + }, + // headers, including chart title + "group-title": { + fill: black, + font: defaultFont, + fontSize: 13, + fontWeight: "bold" + }, + // chart subtitle + "group-subtitle": { + fill: black, + font: defaultFont, + fontSize: 12 + }, + // defaults for styled point marks in Vega-Lite + point: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "circle" + }, + circle: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth + }, + square: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "square" + }, + // defaults for styled group marks in Vega-Lite + cell: { + fill: "transparent", + stroke: lightGray + }, + view: { + fill: "transparent" + } + }, + // defaults for title + title: { + orient: "top", + anchor: "middle", + offset: 4, + subtitlePadding: 3 + }, + // defaults for axes + axis: { + minExtent: 0, + maxExtent: 200, + bandPosition: 0.5, + domain: true, + domainWidth: 1, + domainColor: gray, + grid: false, + gridWidth: 1, + gridColor: lightGray, + labels: true, + labelAngle: 0, + labelLimit: 180, + labelOffset: 0, + labelPadding: 2, + ticks: true, + tickColor: gray, + tickOffset: 0, + tickRound: true, + tickSize: 5, + tickWidth: 1, + titlePadding: 4 + }, + // correction for centering bias + axisBand: { + tickOffset: -0.5 + }, + // defaults for cartographic projection + projection: { + type: "mercator" + }, + // defaults for legends + legend: { + orient: "right", padding: 0, - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - // default view background color - // covers the entire view component - background: null, - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: { - allow: [ - 'wheel' - ] - } - }, - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - }, - view: { - fill: 'transparent' - } - }, - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 + gridAlign: "each", + columnPadding: 10, + rowPadding: 2, + symbolDirection: "vertical", + gradientDirection: "vertical", + gradientLength: 200, + gradientThickness: 16, + gradientStrokeColor: lightGray, + gradientStrokeWidth: 0, + gradientLabelOffset: 2, + labelAlign: "left", + labelBaseline: "middle", + labelLimit: 160, + labelOffset: 4, + labelOverlap: true, + symbolLimit: 30, + symbolType: "circle", + symbolSize: 100, + symbolOffset: 0, + symbolStrokeWidth: 1.5, + symbolBaseFillColor: "transparent", + symbolBaseStrokeColor: gray, + titleLimit: 180, + titleOrient: "top", + titlePadding: 5, + layout: { + offset: 18, + direction: "horizontal", + left: { + direction: "vertical" + }, + right: { + direction: "vertical" + } + } + }, + // defaults for scale ranges + range: { + category: { + scheme: "tableau10" }, - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 + ordinal: { + scheme: "blues" }, - // correction for centering bias - axisBand: { - tickOffset: -0.5 + heatmap: { + scheme: "yellowgreenblue" }, - // defaults for cartographic projection - projection: { - type: 'mercator' + ramp: { + scheme: "blues" }, - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { - direction: 'vertical' - }, - right: { - direction: 'vertical' - } - } + diverging: { + scheme: "blueorange", + extent: [1, 0] }, - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [ - 1, - 0 - ] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } + symbol: ["circle", "square", "triangle-up", "cross", "diamond", "triangle-right", "triangle-down", "triangle-left"] + } }; -} -function parse(spec, config, options) { - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)('Input Vega specification must be an object.'); - config = (0, _vegaUtil.mergeConfig)(defaults(), config, spec.config); - return parseView(spec, new Scope(config, options)).toRuntime(); -} - -},{"vega-util":"bApja","vega-functions":"iuqsd","vega-event-selector":"gXMNx","vega-scale":"bEydG","vega-dataflow":"3NitK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gXMNx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "parseSelector", ()=>eventSelector); -const VIEW = 'view', LBRACK = '[', RBRACK = ']', LBRACE = '{', RBRACE = '}', COLON = ':', COMMA = ',', NAME = '@', GT = '>', ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 -}; -let DEFAULT_SOURCE, MARKS; -/** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ function eventSelector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); -} -function isMarkType(type) { - return MARKS[type]; -} -function find(s, i, endChar, pushChar, popChar) { - const n = s.length; - let count = 0, c; - for(; i < n; ++i){ - c = s[i]; - if (!count && c === endChar) return i; - else if (popChar && popChar.indexOf(c) >= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; -} -function parseMerge(s) { - const output = [], n = s.length; - let start = 0, i = 0; - while(i < n){ - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - if (output.length === 0) throw 'Empty event selector: ' + s; - return output; -} -function parseSelector(s) { - return s[0] === '[' ? parseBetween(s) : parseStream(s); -} -function parseBetween(s) { - const n = s.length; - let i = 1, b; - i = find(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) throw 'Empty between selector: ' + s; - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) throw 'Between selector must have two elements: ' + s; - s = s.slice(i + 1).trim(); - if (s[0] !== GT) throw 'Expected \'>\' after between selector: ' + s; - b = b.map(parseSelector); - const stream = parseSelector(s.slice(1).trim()); - if (stream.between) return { - between: b, - stream: stream - }; - else stream.between = b; - return stream; -} -function parseStream(s) { - const stream = { - source: DEFAULT_SOURCE - }, source = []; - let throttle = [ - 0, - 0 - ], markname = 0, start = 0, n = s.length, i = 0, j, filter; - // extract throttle from end - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - if (!n) throw s; - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - // extract first part of multi-part stream selector - j = find(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; + } + function parse(spec, config, options) { + if (!isObject$1(spec)) { + error("Input Vega specification must be an object."); } - // extract remaining part of stream selector - i = find(s, i, LBRACK); - if (i === n) source.push(s.substring(start, n).trim()); - else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - // extract filters - while(i < n){ - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - // marshall event stream specification - if (!(n = source.length) || ILLEGAL.test(source[n - 1])) throw 'Invalid event selector: ' + s; - if (n > 1) { - stream.type = source[1]; - if (markname) stream.markname = source[0].slice(1); - else if (isMarkType(source[0])) stream.marktype = source[0]; - else stream.source = source[0]; - } else stream.type = source[0]; - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; -} -function parseThrottle(s) { - const a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map((_)=>{ - const x = +_; - if (x !== x) throw s; - return x; - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4UlE2":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "colorSchemes", ()=>(0, _colorSchemes.colorSchemes)); -parcelHelpers.export(exports, "constants", ()=>_constants); -parcelHelpers.export(exports, "searchExpression", ()=>_searchExpression); -parcelHelpers.export(exports, "specs", ()=>_sanddanceSpecs); -parcelHelpers.export(exports, "types", ()=>_types); -parcelHelpers.export(exports, "use", ()=>use); -parcelHelpers.export(exports, "util", ()=>_util); -parcelHelpers.export(exports, "VegaMorphCharts", ()=>_vegaMorphcharts); -parcelHelpers.export(exports, "Viewer", ()=>(0, _viewer.Viewer)); -var _constants = require("./constants"); -var _searchExpression = require("@msrvida/search-expression"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _types = require("./types"); -var _util = require("./util"); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _colorSchemes = require("./colorSchemes"); -var _viewer = require("./viewer"); -var _version = require("./version"); -const use = (0, _vegaMorphcharts.use); - -},{"./constants":"bKPI3","@msrvida/search-expression":"epS5r","@msrvida/sanddance-specs":"jgrWB","./types":"lMykT","./util":"lwXkM","@msrvida/vega-morphcharts":"lOTjG","./colorSchemes":"5zZMK","./viewer":"8xwlr","./version":"ewaNZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bKPI3":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorScaleNone", ()=>(0, _sanddanceSpecs.ColorScaleNone)); -parcelHelpers.export(exports, "FieldNames", ()=>(0, _sanddanceSpecs.FieldNames)); -parcelHelpers.export(exports, "ScaleNames", ()=>(0, _sanddanceSpecs.ScaleNames)); -parcelHelpers.export(exports, "SignalNames", ()=>(0, _sanddanceSpecs.SignalNames)); -parcelHelpers.export(exports, "GL_ORDINAL", ()=>GL_ORDINAL); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -const GL_ORDINAL = 'GL_ORDINAL'; - -},{"@msrvida/sanddance-specs":"jgrWB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jgrWB":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _build = require("./build"); -parcelHelpers.exportAll(_build, exports); -var _constants = require("./constants"); -parcelHelpers.exportAll(_constants, exports); -var _inference = require("./inference"); -parcelHelpers.exportAll(_inference, exports); -var _interfaces = require("./interfaces"); -parcelHelpers.exportAll(_interfaces, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./build":"8Bfjz","./constants":"8P82N","./inference":"5WPaz","./interfaces":"6XfrQ","./types":"iZowJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Bfjz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "build", ()=>build); -var _charts = require("./charts"); -var _inference = require("./inference"); -var _specBuilder = require("./specBuilder"); -function build(specContext, currData) { - const { specColumns } = specContext; - const columns = [ - specColumns.color, - specColumns.facet, - specColumns.facetV, - specColumns.group, - specColumns.size, - specColumns.sort, - specColumns.x, - specColumns.y, - specColumns.z - ]; - (0, _inference.inferAll)(columns, currData); - const specBuilderProps = (0, _charts.getSpecBuilderPropsForChart)(specContext); - const specBuilder = new (0, _specBuilder.SpecBuilder)(specBuilderProps, specContext); - let specResult; - if (specBuilder) { - try { - const errors = specBuilder.validate(); - if (errors.length) specResult = { - errors, - specCapabilities: specBuilderProps.specCapabilities, - vegaSpec: null - }; - else specResult = specBuilder.build(); - } catch (e) { - specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [ - e.stack - ] - }; - } - if (!specResult.errors) { - const data0 = specResult.vegaSpec.data[0]; - data0.values = currData; - } - } else specResult = { - specCapabilities: null, - vegaSpec: null, - errors: [ - `could not build spec for ${specContext.insight.chart}` - ] - }; - return specResult; -} - -},{"./charts":"3Kscd","./inference":"5WPaz","./specBuilder":"j86BQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Kscd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSpecBuilderPropsForChart", ()=>getSpecBuilderPropsForChart); -var _barchartH = require("./barchartH"); -var _barchartHDefault = parcelHelpers.interopDefault(_barchartH); -var _barchartV = require("./barchartV"); -var _barchartVDefault = parcelHelpers.interopDefault(_barchartV); -var _density = require("./density"); -var _densityDefault = parcelHelpers.interopDefault(_density); -var _grid = require("./grid"); -var _gridDefault = parcelHelpers.interopDefault(_grid); -var _scatterplot = require("./scatterplot"); -var _scatterplotDefault = parcelHelpers.interopDefault(_scatterplot); -var _stacks = require("./stacks"); -var _stacksDefault = parcelHelpers.interopDefault(_stacks); -var _strips = require("./strips"); -var _stripsDefault = parcelHelpers.interopDefault(_strips); -var _treemap = require("./treemap"); -var _treemapDefault = parcelHelpers.interopDefault(_treemap); -var _facetLayout = require("../facetLayout"); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -const map = { - barchart: (0, _barchartVDefault.default), - barchartH: (0, _barchartHDefault.default), - barchartV: (0, _barchartVDefault.default), - density: (0, _densityDefault.default), - grid: (0, _gridDefault.default), - scatterplot: (0, _scatterplotDefault.default), - stacks: (0, _stacksDefault.default), - strips: (0, _stripsDefault.default), - treemap: (0, _treemapDefault.default) -}; -function getSpecBuilderPropsForChart(specContext) { - const { insight, specColumns, specViewOptions } = specContext; - const fn = map[insight.chart]; - if (fn) { - const props = fn(specContext); - if (insight.columns.facet) { - const discreteFacetColumn = { - column: specColumns.facet, - defaultBins: (0, _defaults.defaultBins), - maxbins: (0, _defaults.maxbins), - maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, - maxbinsSignalName: (0, _constants.SignalNames).FacetBins - }; - const discreteFacetVColumn = { - column: specColumns.facetV, - defaultBins: (0, _defaults.defaultBins), - maxbins: (0, _defaults.maxbins), - maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, - maxbinsSignalName: (0, _constants.SignalNames).FacetVBins - }; - const { facetLayout, layoutPair } = (0, _facetLayout.getFacetLayout)(insight.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); - props.layouts.unshift(layoutPair); - props.facetLayout = facetLayout; - props.collapseFacetAxes = specViewOptions.collapseFacetAxes; - } - return props; - } -} - -},{"./barchartH":"ibs2v","./barchartV":"h9u8o","./density":"jBnsu","./grid":"2qdKS","./scatterplot":"bFEhN","./stacks":"ebWbD","./strips":"6YNud","./treemap":"cYQ9h","../facetLayout":"1hBLq","../constants":"8P82N","../defaults":"8thYZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ibs2v":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes - }; - const x = { - title: null - }; - const axisScales = { - x, - y: { - title: (_a = specColumns.y) === null || _a === void 0 ? void 0 : _a.name - }, - z: { - title: (_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.name - } - }; - const layouts = [ - { - layoutType: 'Band', - props: bandProps - } - ]; - const { totalStyle, view } = insight; - if (totalStyle === 'sum-strip-percent') { - x.aggregate = 'percent'; - x.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: 'left', - globalAggregateMaxExtentSignal: 'aggMaxExtent', - globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: 'AggregateContainer', - props: aggProps - }); - switch(totalStyle){ - case 'sum-treemap': - { - x.aggregate = 'sum'; - x.title = language.sum; - const treemapProps = { - corner: 'top-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - x.aggregate = 'sum'; - x.title = language.sum; - const stripProps = { - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - x.aggregate = 'count'; - x.title = language.count; - const stripProps = { - sortOrder: 'ascending', - orientation: 'horizontal', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - x.aggregate = 'count'; - x.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'down-right', - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: 'y', - binnable: true, - axisSelection: ((_c = specColumns.y) === null || _c === void 0 ? void 0 : _c.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'z', - axisSelection: ((_d = specColumns.z) === null || _d === void 0 ? void 0 : _d.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"8P82N","../defaults":"8thYZ","../size":"1LqID","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8P82N":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FieldNames", ()=>FieldNames); -parcelHelpers.export(exports, "ScaleNames", ()=>ScaleNames); -parcelHelpers.export(exports, "SignalNames", ()=>SignalNames); -parcelHelpers.export(exports, "Other", ()=>Other); -parcelHelpers.export(exports, "ColorScaleNone", ()=>ColorScaleNone); -const FieldNames = { - Active: '__SandDance__Active', - Collapsed: '__SandDance__Collapsed', - Contains: '__SandDance__Contains', - Count: '__SandDance__Count', - Sum: '__SandDance__Sum', - SumOfCount: '__SandDance__CountSum', - SumOfSum: '__SandDance__SumSum', - Selected: '__SandDance__Selected', - First: '__SandDance__First', - Last: '__SandDance__Last', - Top: '__SandDance__Top', - TopColor: '__SandDance__TopColor', - TopIndex: '__SandDance__TopIndex', - PowerBISelectionId: '__SandDance__PowerBISelectionId', - FacetSearch: '__SandDance__FacetSearch', - FacetTitle: '__SandDance__FacetTitle', - Ordinal: '__SandDance__Ordinal', - WrapCol: '__SandDance__WrapCol', - WrapRow: '__SandDance__WrapRow', - Value: '__SandDance__Value', - OffsetX: '__SandDance__X', - OffsetY: '__SandDance__Y', - OffsetHeight: '__SandDance__H', - OffsetWidth: '__SandDance__W' -}; -const ScaleNames = { - Color: 'scale_color', - X: 'scale_x', - Y: 'scale_y', - Z: 'scale_z' -}; -const SignalNames = { - ViewportWidth: 'ViewportWidth', - ViewportHeight: 'ViewportHeight', - MinCellWidth: 'MinCellWidth', - MinCellHeight: 'MinCellHeight', - PlotOffsetLeft: 'PlotOffsetLeft', - PlotOffsetTop: 'PlotOffsetTop', - PlotOffsetBottom: 'PlotOffsetBottom', - PlotOffsetRight: 'PlotOffsetRight', - PlotHeightIn: 'PlotHeightIn', - PlotWidthIn: 'PlotWidthIn', - PlotHeightOut: 'PlotHeightOut', - PlotWidthOut: 'PlotWidthOut', - ColorBinCount: 'RoleColor_BinCountSignal', - ColorReverse: 'RoleColor_ReverseSignal', - FacetAxesAdjustX: 'RoleFacet_AxesAdjustSignalX', - FacetAxesAdjustY: 'RoleFacet_AxesAdjustSignalY', - FacetBins: 'RoleFacet_BinsSignal', - FacetVBins: 'RoleFacetV_BinsSignal', - FacetPaddingTop: 'FacetPaddingTop', - FacetPaddingBottom: 'FacetPaddingBottom', - FacetPaddingLeft: 'FacetPaddingLeft', - MarkOpacity: 'Mark_OpacitySignal', - PointScale: 'Chart_PointScaleSignal', - TextAngleX: 'Text_AngleXSignal', - TextAngleY: 'Text_AngleYSignal', - TextScale: 'Text_ScaleSignal', - TextSize: 'Text_SizeSignal', - TextTitleSize: 'Text_TitleSizeSignal', - TreeMapMethod: 'Chart_TreeMapMethodSignal', - XBins: 'RoleX_BinsSignal', - YBins: 'RoleY_BinsSignal', - ZHeight: 'RoleZ_HeightSignal', - ZGrounded: 'RoleZ_Grounded', - ZProportion: 'RoleZ_ProportionSignal' -}; -const Other = '__Other'; -const ColorScaleNone = 'none'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8thYZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ //TODO move these to options -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultBins", ()=>defaultBins); -parcelHelpers.export(exports, "maxbins", ()=>maxbins); -parcelHelpers.export(exports, "minBarBandWidth", ()=>minBarBandWidth); -parcelHelpers.export(exports, "minFacetWidth", ()=>minFacetWidth); -parcelHelpers.export(exports, "minFacetHeight", ()=>minFacetHeight); -parcelHelpers.export(exports, "facetPaddingLeft", ()=>facetPaddingLeft); -parcelHelpers.export(exports, "facetPaddingTop", ()=>facetPaddingTop); -parcelHelpers.export(exports, "facetPaddingBottom", ()=>facetPaddingBottom); -parcelHelpers.export(exports, "facetPaddingRight", ()=>facetPaddingRight); -parcelHelpers.export(exports, "axesLabelLimit", ()=>axesLabelLimit); -parcelHelpers.export(exports, "axesTitleLimit", ()=>axesTitleLimit); -parcelHelpers.export(exports, "axesTitlePaddingX", ()=>axesTitlePaddingX); -parcelHelpers.export(exports, "axesTitlePaddingY", ()=>axesTitlePaddingY); -parcelHelpers.export(exports, "axesTitlePaddingFacetX", ()=>axesTitlePaddingFacetX); -parcelHelpers.export(exports, "axesTitlePaddingFacetY", ()=>axesTitlePaddingFacetY); -parcelHelpers.export(exports, "axesOffsetX", ()=>axesOffsetX); -parcelHelpers.export(exports, "axesOffsetY", ()=>axesOffsetY); -parcelHelpers.export(exports, "scatterSizedMin", ()=>scatterSizedMin); -parcelHelpers.export(exports, "scatterSizedDiv", ()=>scatterSizedDiv); -parcelHelpers.export(exports, "debounce", ()=>debounce); -const defaultBins = 10; -const maxbins = 100; -const minBarBandWidth = 15; -const minFacetWidth = 140; -const minFacetHeight = 180; -const facetPaddingLeft = 40; -const facetPaddingTop = 40; -const facetPaddingBottom = 40; -const facetPaddingRight = 40; -const axesLabelLimit = 100; -const axesTitleLimit = 100; -const axesTitlePaddingX = 30; -const axesTitlePaddingY = 60; -const axesTitlePaddingFacetX = 69; -const axesTitlePaddingFacetY = 92; -const axesOffsetX = 120; -const axesOffsetY = 120; -const scatterSizedMin = 10; -const scatterSizedDiv = 20; -const debounce = 250; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1LqID":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "allowNoneForSize", ()=>allowNoneForSize); -function allowNoneForSize(specContext) { - switch(specContext.insight.totalStyle){ - case 'sum-strip': - case 'sum-strip-percent': - case 'sum-treemap': - return false; - default: - //if totalStyle is blank, count is assumed - return true; + config = mergeConfig(defaults$1(), config, spec.config); + return parseView(spec, new Scope(config, options)).toRuntime(); + } + var version$1 = "6.2.0"; + extend$1(transforms, tx, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf); + const version = version$1; + const vega$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Bounds, + CanvasHandler, + CanvasRenderer, + DATE, + DAY, + DAYOFYEAR, + Dataflow, + Debug, + DisallowedObjectProperties, + Error: Error$1, + EventStream, + Gradient: Gradient$1, + GroupItem, + HOURS, + Handler, + HybridHandler, + HybridRenderer, + Info, + Item, + MILLISECONDS, + MINUTES, + MONTH, + Marks, + MultiPulse, + None: None$2, + Operator, + Parameters, + Pulse, + QUARTER, + RenderType, + Renderer, + ResourceLoader, + SECONDS, + SVGHandler, + SVGRenderer, + SVGStringRenderer, + Scenegraph, + TIME_UNITS, + Transform, + View: View$1, + WEEK, + Warn, + YEAR, + accessor, + accessorFields, + accessorName, + array: array$5, + ascending: ascending$2, + bandwidthNRD: estimateBandwidth, + bin, + bootstrapCI, + boundClip, + boundContext, + boundItem: boundItem$1, + boundMark, + boundStroke, + changeset, + clampRange, + codegenExpression: codegen, + compare: compare$2, + constant: constant$5, + cumulativeLogNormal, + cumulativeNormal, + cumulativeUniform, + dayofyear, + debounce: debounce$1, + defaultLocale, + definition: definition$1, + densityLogNormal, + densityNormal, + densityUniform, + domChild, + domClear, + domCreate, + domFind, + dotbin, + error, + expressionFunction, + extend: extend$1, + extent, + extentIndex, + falsy, + fastmap, + field: field$1, + flush, + font, + fontFamily, + fontSize, + format: format$2, + formatLocale: numberFormatDefaultLocale, + formats: formats$1, + hasOwnProperty: has$1, + id, + identity: identity$7, + inferType, + inferTypes, + ingest: ingest$1, + inherits, + inrange, + interpolate, + interpolateColors, + interpolateRange, + intersect: intersect$2, + intersectBoxLine, + intersectPath, + intersectPoint, + intersectRule, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isFunction, + isIterable, + isNumber: isNumber$1, + isObject: isObject$1, + isRegExp, + isString, + isTuple, + key: key$2, + lerp: lerp$1, + lineHeight, + loader, + locale, + logger, + lruCache, + markup, + merge: merge$3, + mergeConfig, + multiLineOffset, + one: one$2, + pad: pad$2, + panLinear, + panLog, + panPow, + panSymlog, + parse, + parseExpression: parser$1, + parseSelector: eventSelector, + path: path$3, + pathCurves: curves, + pathEqual, + pathParse: parse$3, + pathRectangle: vg_rect, + pathRender, + pathSymbols: symbols, + pathTrail: vg_trail, + peek: peek$1, + point, + projection, + quantileLogNormal, + quantileNormal, + quantileUniform, + quantiles, + quantizeInterpolator, + quarter, + quartiles, + get random() { + return random; + }, + randomInteger: integer, + randomKDE: kde, + randomLCG: lcg$2, + randomLogNormal: lognormal, + randomMixture: mixture$1, + randomNormal: gaussian, + randomUniform: uniform, + read, + regressionConstant: constant$4, + regressionExp: exp$1, + regressionLinear: linear$2, + regressionLoess: loess, + regressionLog: log$3, + regressionPoly: poly, + regressionPow: pow$3, + regressionQuad: quad, + renderModule, + repeat, + resetDefaultLocale, + resetSVGDefIds, + responseType, + runtimeContext: context, + sampleCurve, + sampleLogNormal, + sampleNormal, + sampleUniform, + scale: scale$6, + sceneEqual, + sceneFromJSON, + scenePickVisit: pickVisit, + sceneToJSON, + sceneVisit: visit, + sceneZOrder: zorder, + scheme, + serializeXML, + setHybridRendererOptions, + setRandom, + span, + splitAccessPath, + stringValue: $, + textMetrics, + timeBin: bin$1, + timeFloor, + timeFormatLocale: timeFormatDefaultLocale, + timeInterval, + timeOffset, + timeSequence, + timeUnitSpecifier, + timeUnits, + toBoolean, + toDate, + toNumber, + toSet, + toString, + transform: transform$2, + transforms, + truncate: truncate$1, + truthy, + tupleid, + typeParsers, + utcFloor, + utcInterval, + utcOffset, + utcSequence, + utcdayofyear, + utcquarter, + utcweek, + version, + visitArray, + week, + writeConfig, + zero: zero$3, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog + }, Symbol.toStringTag, { value: "Module" })); + const FieldNames = { + Active: "__SandDance__Active", + Collapsed: "__SandDance__Collapsed", + Contains: "__SandDance__Contains", + Count: "__SandDance__Count", + Sum: "__SandDance__Sum", + SumOfCount: "__SandDance__CountSum", + SumOfSum: "__SandDance__SumSum", + Selected: "__SandDance__Selected", + First: "__SandDance__First", + Last: "__SandDance__Last", + Top: "__SandDance__Top", + TopColor: "__SandDance__TopColor", + TopIndex: "__SandDance__TopIndex", + PowerBISelectionId: "__SandDance__PowerBISelectionId", + FacetSearch: "__SandDance__FacetSearch", + FacetTitle: "__SandDance__FacetTitle", + Ordinal: "__SandDance__Ordinal", + WrapCol: "__SandDance__WrapCol", + WrapRow: "__SandDance__WrapRow", + Value: "__SandDance__Value", + OffsetX: "__SandDance__X", + OffsetY: "__SandDance__Y", + OffsetHeight: "__SandDance__H", + OffsetWidth: "__SandDance__W" + }; + const ScaleNames = { + Color: "scale_color" + }; + const SignalNames = { + ViewportWidth: "ViewportWidth", + ViewportHeight: "ViewportHeight", + MinCellWidth: "MinCellWidth", + MinCellHeight: "MinCellHeight", + PlotOffsetLeft: "PlotOffsetLeft", + PlotOffsetTop: "PlotOffsetTop", + PlotOffsetBottom: "PlotOffsetBottom", + PlotOffsetRight: "PlotOffsetRight", + PlotHeightIn: "PlotHeightIn", + PlotWidthIn: "PlotWidthIn", + PlotHeightOut: "PlotHeightOut", + PlotWidthOut: "PlotWidthOut", + ColorBinCount: "RoleColor_BinCountSignal", + ColorReverse: "RoleColor_ReverseSignal", + FacetAxesAdjustX: "RoleFacet_AxesAdjustSignalX", + FacetAxesAdjustY: "RoleFacet_AxesAdjustSignalY", + FacetBins: "RoleFacet_BinsSignal", + FacetVBins: "RoleFacetV_BinsSignal", + FacetPaddingTop: "FacetPaddingTop", + FacetPaddingBottom: "FacetPaddingBottom", + FacetPaddingLeft: "FacetPaddingLeft", + MarkOpacity: "Mark_OpacitySignal", + PointScale: "Chart_PointScaleSignal", + TextAngleX: "Text_AngleXSignal", + TextAngleY: "Text_AngleYSignal", + TextScale: "Text_ScaleSignal", + TextSize: "Text_SizeSignal", + TextTitleSize: "Text_TitleSizeSignal", + TreeMapMethod: "Chart_TreeMapMethodSignal", + XBins: "RoleX_BinsSignal", + YBins: "RoleY_BinsSignal", + ZHeight: "RoleZ_HeightSignal", + ZGrounded: "RoleZ_Grounded", + ZProportion: "RoleZ_ProportionSignal" + }; + const Other = "__Other"; + const ColorScaleNone = "none"; + const defaultBins = 10; + const maxbins = 100; + const minBarBandWidth = 15; + const minFacetWidth = 140; + const minFacetHeight = 180; + const facetPaddingLeft = 40; + const facetPaddingTop = 40; + const facetPaddingBottom = 40; + const facetPaddingRight = 40; + const axesLabelLimit = 100; + const axesTitleLimit = 100; + const axesTitlePaddingX = 30; + const axesTitlePaddingY = 60; + const axesTitlePaddingFacetX = 69; + const axesTitlePaddingFacetY = 92; + const axesOffsetX = 120; + const axesOffsetY = 120; + const scatterSizedDiv = 20; + const debounce = 250; + function allowNoneForSize(specContext) { + switch (specContext.insight.totalStyle) { + case "sum-strip": + case "sum-strip-percent": + case "sum-treemap": + return false; + default: + return true; } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h9u8o":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b; - const { insight, specColumns, specViewOptions } = specContext; - const { language } = specViewOptions; - const showAxes = !insight.hideAxes; - const bandProps = { - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes - }; - const y = { - title: null - }; - const axisScales = { - x: { - title: specColumns.x && specColumns.x.name - }, - y, - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = [ - { - layoutType: 'Band', - props: bandProps - } - ]; - const { totalStyle, view } = insight; - if (totalStyle === 'sum-strip-percent') { - y.aggregate = 'percent'; - y.title = language.percent; - const stripProps = { - addPercentageScale: true, - sortOrder: 'descending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - } else { - const aggProps = { - niceScale: true, - dock: 'bottom', - globalAggregateMaxExtentSignal: 'aggMaxExtent', - globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled', - sumBy: specColumns.size, - showAxes - }; - layouts.push({ - layoutType: 'AggregateContainer', - props: aggProps - }); - switch(totalStyle){ - case 'sum-treemap': - { - y.aggregate = 'sum'; - y.title = language.sum; - const treemapProps = { - corner: 'bottom-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - y.aggregate = 'sum'; - y.title = language.sum; - const stripProps = { - sortOrder: 'descending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - y.aggregate = 'count'; - y.title = language.count; - const stripProps = { - sortOrder: 'descending', - orientation: 'vertical', - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - y.aggregate = 'count'; - y.title = language.count; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-up', - z: specColumns.z, - maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, - maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, - showAxes, - view - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - } - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: true, - percentage: true, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'z', - axisSelection: ((_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"8P82N","../defaults":"8thYZ","../size":"1LqID","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jBnsu":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { - title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name - }, - y: { - title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name - }, - z: { - title: (_c = specColumns.z) === null || _c === void 0 ? void 0 : _c.name - } - }; - const backgroundImage = ((_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.quantitative) && ((_f = insight.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.top, - min: backgroundImage.extents.bottom - } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.right, - min: backgroundImage.extents.left - } - }; - const aggProps = { - onBuild: null, - aggregation: null, - sumBy: specColumns.size - }; - const layouts = [ - { - layoutType: 'Band', - props: vBandProps - }, - { - layoutType: 'Band', - props: hBandProps - }, - { - layoutType: 'AggregateSquare', - props: aggProps - } - ]; - const { totalStyle, view } = insight; - switch(totalStyle){ - case 'sum-treemap': - { - aggProps.aggregation = 'sum'; - const treemapProps = { - corner: 'bottom-left', - size: specColumns.size, - treeMapMethod: specViewOptions.language.treeMapMethod, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Treemap', - props: treemapProps - }); - break; - } - case 'sum-strip': - { - aggProps.aggregation = 'sum'; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - size: specColumns.size, - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - case 'count-strip': - { - aggProps.aggregation = 'count'; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', - sort: specColumns.sort, - z: specColumns.z, - showAxes, - view - }; - layouts.push({ - layoutType: 'Strip', - props: stripProps - }); - break; - } - default: - { - aggProps.aggregation = 'count'; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-down', - z: specColumns.z, - maxGroupedUnits: null, - maxGroupedFillSize: null, - showAxes, - view - }; - aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled)=>{ - squareProps.maxGroupedUnits = aggMaxExtent; - squareProps.maxGroupedFillSize = aggMaxExtentScaled; - }; - layouts.push({ - layoutType: 'Square', - props: squareProps - }); - break; - } - } - return { - axisScales, - layouts, - specCapabilities: { - backgroundImage: true, - countsAndSums: true, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'y', - binnable: true, - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'z', - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'size', - allowNone: (0, _size.allowNoneForSize), - excludeCategoric: true, - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _size = require("../size"); - -},{"../constants":"8P82N","../defaults":"8thYZ","../size":"1LqID","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2qdKS":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns } = specContext; - const { view } = insight; - const squareProps = { - sortBy: specColumns.sort, - fillDirection: 'right-down', + } + function barchartH(specContext) { + var _a, _b, _c, _d; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight2.hideAxes; + const bandProps = { + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes + }; + const x2 = { title: null }; + const axisScales = { + x: x2, + y: { title: (_a = specColumns.y) === null || _a === void 0 ? void 0 : _a.name }, + z: { title: (_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight2; + if (totalStyle === "sum-strip-percent") { + x2.aggregate = "percent"; + x2.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "ascending", + orientation: "horizontal", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "left", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + x2.aggregate = "sum"; + x2.title = language.sum; + const treemapProps = { + corner: "top-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, z: specColumns.z, - collapseYHeight: true, - showAxes: !insight.hideAxes, + showAxes, view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - return { - axisScales, - layouts: [ - { - layoutType: 'Square', - props: squareProps - } - ], - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"8P82N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bFEhN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const { insight, specColumns, specViewOptions } = specContext; - const backgroundImageExtents = ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative) && ((_c = insight.backgroundImage) === null || _c === void 0 ? void 0 : _c.extents); - const scatterProps = { - x: specColumns.x, - y: specColumns.y, - z: specColumns.z, + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + x2.aggregate = "sum"; + x2.title = language.sum; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", size: specColumns.size, - scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, - zGrounded: specViewOptions.language.zGrounded, - backgroundImageExtents, - showAxes: !(backgroundImageExtents || insight.hideAxes), - view: insight.view - }; - const axisScales = { - x: { - title: (_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.name - }, - y: { - title: (_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.name - }, - z: { - title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name - } - }; - return { - axisScales, - layouts: [ - { - layoutType: 'Scatter', - props: scatterProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: 'x', - axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact' - }, - { - role: 'y', - axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? 'range' : 'exact' - }, - { - role: 'z', - axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: false - }, - { - role: 'color', - allowNone: true - }, - { - role: 'size', - excludeCategoric: true, - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ], - signals: [ - (0, _constants.SignalNames).PointScale, - (0, _constants.SignalNames).ZGrounded - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"8P82N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ebWbD":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a, _b, _c, _d, _e, _f, _g; - const { insight, specColumns, specViewOptions } = specContext; - const axisScales = { - x: { - title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name - }, - y: { - title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name - }, - z: { - title: specViewOptions.language.count - } - }; - const backgroundImage = ((_c = specColumns.x) === null || _c === void 0 ? void 0 : _c.quantitative) && ((_d = specColumns.y) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = insight.backgroundImage) === null || _e === void 0 ? void 0 : _e.extents) && insight.backgroundImage; - const showAxes = !(backgroundImage || insight.hideAxes); - const hBandProps = { - excludeEncodingRuleMap: true, - orientation: 'horizontal', - groupby: { - column: specColumns.y, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).YBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.top, - min: backgroundImage.extents.bottom - } - }; - const vBandProps = { - excludeEncodingRuleMap: true, - orientation: 'vertical', - groupby: { - column: specColumns.x, - defaultBins: (0, _defaults.defaultBins), - maxbinsSignalName: (0, _constants.SignalNames).XBins, - maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, - maxbins: (0, _defaults.maxbins) - }, - minBandWidth: (0, _defaults.minBarBandWidth), - showAxes, - outerSignalExtents: backgroundImage && { - max: backgroundImage.extents.right, - min: backgroundImage.extents.left - } - }; - const stackProps = { sort: specColumns.sort, - showAxes - }; - return { - axisScales, - customZScale: true, - layouts: [ - { - layoutType: 'Band', - props: vBandProps - }, - { - layoutType: 'Band', - props: hBandProps - }, - { - layoutType: 'Stack', - props: stackProps - } - ], - specCapabilities: { - backgroundImage: true, - countsAndSums: false, - roles: [ - { - role: 'x', - binnable: true, - axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).XBins - ] - }, - { - role: 'y', - binnable: true, - axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? 'range' : 'exact', - axisSelectionBetweenTicks: true, - signals: [ - (0, _constants.SignalNames).YBins - ] - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _defaults = require("../defaults"); -var _constants = require("../constants"); - -},{"../defaults":"8thYZ","../constants":"8P82N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6YNud":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns } = specContext; - const { view } = insight; - const stripProps = { - sortOrder: 'ascending', - orientation: 'vertical', + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + x2.aggregate = "count"; + x2.title = language.count; + const stripProps = { + sortOrder: "ascending", + orientation: "horizontal", size: specColumns.size, sort: specColumns.sort, z: specColumns.z, - showAxes: !insight.hideAxes, + showAxes, view - }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } - }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: specColumns.size ? 'sum' : 'count' - }; - const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; - const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; - const props = { - dock: 'top', - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: 'AggregateContainer', - props - }); - } - layouts.push({ - layoutType: 'Strip', + }; + layouts.push({ + layoutType: "Strip", props: stripProps - }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'size', - allowNone: true, - excludeCategoric: true - }, - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'sort', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ] - } - }; - }); -var _constants = require("../constants"); - -},{"../constants":"8P82N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cYQ9h":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specContext) { - var _a; - const { insight, specColumns, specViewOptions } = specContext; - const { view } = insight; - const treemapProps = { - corner: 'top-left', - group: specColumns.group, + }); + break; + } + default: { + x2.aggregate = "count"; + x2.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "down-right", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, + view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; + } + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "y", + binnable: true, + axisSelection: ((_c = specColumns.y) === null || _c === void 0 ? void 0 : _c.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_d = specColumns.z) === null || _d === void 0 ? void 0 : _d.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function barchartV(specContext) { + var _a, _b; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const { language } = specViewOptions; + const showAxes = !insight2.hideAxes; + const bandProps = { + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes + }; + const y2 = { title: null }; + const axisScales = { + x: { title: specColumns.x && specColumns.x.name }, + y: y2, + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = [{ + layoutType: "Band", + props: bandProps + }]; + const { totalStyle, view } = insight2; + if (totalStyle === "sum-strip-percent") { + y2.aggregate = "percent"; + y2.title = language.percent; + const stripProps = { + addPercentageScale: true, + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + } else { + const aggProps = { + niceScale: true, + dock: "bottom", + globalAggregateMaxExtentSignal: "aggMaxExtent", + globalAggregateMaxExtentScaledSignal: "aggMaxExtentScaled", + sumBy: specColumns.size, + showAxes + }; + layouts.push({ + layoutType: "AggregateContainer", + props: aggProps + }); + switch (totalStyle) { + case "sum-treemap": { + y2.aggregate = "sum"; + y2.title = language.sum; + const treemapProps = { + corner: "bottom-left", size: specColumns.size, treeMapMethod: specViewOptions.language.treeMapMethod, z: specColumns.z, - showAxes: !insight.hideAxes, + showAxes, + view + }; + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + y2.aggregate = "sum"; + y2.title = language.sum; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + case "count-strip": { + y2.aggregate = "count"; + y2.title = language.count; + const stripProps = { + sortOrder: "descending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + default: { + y2.aggregate = "count"; + y2.title = language.count; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-up", + z: specColumns.z, + maxGroupedUnits: aggProps.globalAggregateMaxExtentSignal, + maxGroupedFillSize: aggProps.globalAggregateMaxExtentScaledSignal, + showAxes, view + }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; + } + } + } + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: true, + percentage: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "z", + axisSelection: ((_b = specColumns.z) === null || _b === void 0 ? void 0 : _b.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function density(specContext) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name }, + y: { title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name }, + z: { title: (_c = specColumns.z) === null || _c === void 0 ? void 0 : _c.name } + }; + const backgroundImage = ((_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.quantitative) && ((_f = insight2.backgroundImage) === null || _f === void 0 ? void 0 : _f.extents) && insight2.backgroundImage; + const showAxes = !(backgroundImage || insight2.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } + }; + const aggProps = { + onBuild: null, + aggregation: null, + sumBy: specColumns.size + }; + const layouts = [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "AggregateSquare", + props: aggProps + } + ]; + const { totalStyle, view } = insight2; + switch (totalStyle) { + case "sum-treemap": { + aggProps.aggregation = "sum"; + const treemapProps = { + corner: "bottom-left", + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes, + view }; - const axisScales = { - z: { - title: specColumns.z && specColumns.z.name - } + layouts.push({ + layoutType: "Treemap", + props: treemapProps + }); + break; + } + case "sum-strip": { + aggProps.aggregation = "sum"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view }; - const layouts = []; - if (specColumns.facet) { - axisScales.y = { - title: null, - aggregate: 'sum' - }; - const globalAggregateMaxExtentScaledSignal = 'globalAggregateMaxExtentScaledSignal'; - const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal'; - const props = { - dock: 'top', - niceScale: false, - globalAggregateMaxExtentScaledSignal, - globalAggregateMaxExtentSignal, - sumBy: specColumns.size, - showAxes: false - }; - layouts.push({ - layoutType: 'AggregateContainer', - props - }); - } layouts.push({ - layoutType: 'Treemap', - props: treemapProps + layoutType: "Strip", + props: stripProps }); - return { - axisScales, - layouts, - specCapabilities: { - countsAndSums: false, - roles: [ - { - role: 'size', - excludeCategoric: true - }, - { - role: 'group', - allowNone: true - }, - { - role: 'z', - axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? 'range' : 'exact', - allowNone: true, - disabled: view === '2d' - }, - { - role: 'color', - allowNone: true - }, - { - role: 'facet', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetBins - ] - }, - { - role: 'facetV', - allowNone: true, - signals: [ - (0, _constants.SignalNames).FacetVBins - ] - } - ], - signals: [ - (0, _constants.SignalNames).TreeMapMethod - ] - } + break; + } + case "count-strip": { + aggProps.aggregation = "count"; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + sort: specColumns.sort, + z: specColumns.z, + showAxes, + view + }; + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + break; + } + default: { + aggProps.aggregation = "count"; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + maxGroupedUnits: null, + maxGroupedFillSize: null, + showAxes, + view + }; + aggProps.onBuild = (aggMaxExtent, aggMaxExtentScaled) => { + squareProps.maxGroupedUnits = aggMaxExtent; + squareProps.maxGroupedFillSize = aggMaxExtentScaled; }; + layouts.push({ + layoutType: "Square", + props: squareProps + }); + break; + } + } + return { + axisScales, + layouts, + specCapabilities: { + backgroundImage: true, + countsAndSums: true, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "size", + allowNone: allowNoneForSize, + excludeCategoric: true, + signals: [SignalNames.TreeMapMethod] + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function grid(specContext) { + var _a; + const { insight: insight2, specColumns } = specContext; + const { view } = insight2; + const squareProps = { + sortBy: specColumns.sort, + fillDirection: "right-down", + z: specColumns.z, + collapseYHeight: true, + showAxes: !insight2.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + return { + axisScales, + layouts: [ + { + layoutType: "Square", + props: squareProps + } + ], + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "z", + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function scatterplot(specContext) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const backgroundImageExtents = ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative) && ((_c = insight2.backgroundImage) === null || _c === void 0 ? void 0 : _c.extents); + const scatterProps = { + x: specColumns.x, + y: specColumns.y, + z: specColumns.z, + size: specColumns.size, + scatterPointScaleDisplay: specViewOptions.language.scatterPointScale, + zGrounded: specViewOptions.language.zGrounded, + backgroundImageExtents, + showAxes: !(backgroundImageExtents || insight2.hideAxes), + view: insight2.view + }; + const axisScales = { + x: { title: (_d = specColumns.x) === null || _d === void 0 ? void 0 : _d.name }, + y: { title: (_e = specColumns.y) === null || _e === void 0 ? void 0 : _e.name }, + z: { title: (_f = specColumns.z) === null || _f === void 0 ? void 0 : _f.name } + }; + return { + axisScales, + layouts: [ + { + layoutType: "Scatter", + props: scatterProps + } + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + axisSelection: ((_g = specColumns.x) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact" + }, + { + role: "y", + axisSelection: ((_h = specColumns.y) === null || _h === void 0 ? void 0 : _h.quantitative) ? "range" : "exact" + }, + { + role: "z", + axisSelection: ((_j = specColumns.z) === null || _j === void 0 ? void 0 : _j.quantitative) ? "range" : "exact", + allowNone: true, + disabled: false + }, + { + role: "color", + allowNone: true + }, + { + role: "size", + excludeCategoric: true, + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.PointScale, SignalNames.ZGrounded] + } + }; + } + function stacks(specContext) { + var _a, _b, _c, _d, _e, _f, _g; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const axisScales = { + x: { title: (_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.name }, + y: { title: (_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.name }, + z: { title: specViewOptions.language.count } + }; + const backgroundImage = ((_c = specColumns.x) === null || _c === void 0 ? void 0 : _c.quantitative) && ((_d = specColumns.y) === null || _d === void 0 ? void 0 : _d.quantitative) && ((_e = insight2.backgroundImage) === null || _e === void 0 ? void 0 : _e.extents) && insight2.backgroundImage; + const showAxes = !(backgroundImage || insight2.hideAxes); + const hBandProps = { + excludeEncodingRuleMap: true, + orientation: "horizontal", + groupby: { + column: specColumns.y, + defaultBins, + maxbinsSignalName: SignalNames.YBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.YMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.top, min: backgroundImage.extents.bottom } + }; + const vBandProps = { + excludeEncodingRuleMap: true, + orientation: "vertical", + groupby: { + column: specColumns.x, + defaultBins, + maxbinsSignalName: SignalNames.XBins, + maxbinsSignalDisplayName: specContext.specViewOptions.language.XMaxBins, + maxbins + }, + minBandWidth: minBarBandWidth, + showAxes, + outerSignalExtents: backgroundImage && { max: backgroundImage.extents.right, min: backgroundImage.extents.left } + }; + const stackProps = { + sort: specColumns.sort, + showAxes + }; + return { + axisScales, + customZScale: true, + layouts: [ + { + layoutType: "Band", + props: vBandProps + }, + { + layoutType: "Band", + props: hBandProps + }, + { + layoutType: "Stack", + props: stackProps + } + ], + specCapabilities: { + backgroundImage: true, + countsAndSums: false, + roles: [ + { + role: "x", + binnable: true, + axisSelection: ((_f = specColumns.x) === null || _f === void 0 ? void 0 : _f.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.XBins] + }, + { + role: "y", + binnable: true, + axisSelection: ((_g = specColumns.y) === null || _g === void 0 ? void 0 : _g.quantitative) ? "range" : "exact", + axisSelectionBetweenTicks: true, + signals: [SignalNames.YBins] + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function strips(specContext) { + var _a; + const { insight: insight2, specColumns } = specContext; + const { view } = insight2; + const stripProps = { + sortOrder: "ascending", + orientation: "vertical", + size: specColumns.size, + sort: specColumns.sort, + z: specColumns.z, + showAxes: !insight2.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: specColumns.size ? "sum" : "count" + }; + const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; + const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); + } + layouts.push({ + layoutType: "Strip", + props: stripProps + }); + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + allowNone: true, + //size by none is a count + excludeCategoric: true + }, + { + role: "z", + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "sort", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ] + } + }; + } + function treemap(specContext) { + var _a; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const { view } = insight2; + const treemapProps = { + corner: "top-left", + group: specColumns.group, + size: specColumns.size, + treeMapMethod: specViewOptions.language.treeMapMethod, + z: specColumns.z, + showAxes: !insight2.hideAxes, + view + }; + const axisScales = { + z: { title: specColumns.z && specColumns.z.name } + }; + const layouts = []; + if (specColumns.facet) { + axisScales.y = { + title: null, + aggregate: "sum" + }; + const globalAggregateMaxExtentScaledSignal = "globalAggregateMaxExtentScaledSignal"; + const globalAggregateMaxExtentSignal = "globalAggregateMaxExtentSignal"; + const props = { + dock: "top", + niceScale: false, + globalAggregateMaxExtentScaledSignal, + globalAggregateMaxExtentSignal, + sumBy: specColumns.size, + showAxes: false + }; + layouts.push({ + layoutType: "AggregateContainer", + props + }); + } + layouts.push({ + layoutType: "Treemap", + props: treemapProps }); -var _constants = require("../constants"); - -},{"../constants":"8P82N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1hBLq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getFacetLayout", ()=>getFacetLayout); -var _defaults = require("./defaults"); -function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { + return { + axisScales, + layouts, + specCapabilities: { + countsAndSums: false, + roles: [ + { + role: "size", + excludeCategoric: true + }, + { + role: "group", + allowNone: true + }, + { + role: "z", + axisSelection: ((_a = specColumns.z) === null || _a === void 0 ? void 0 : _a.quantitative) ? "range" : "exact", + allowNone: true, + disabled: view === "2d" + }, + { + role: "color", + allowNone: true + }, + { + role: "facet", + allowNone: true, + signals: [SignalNames.FacetBins] + }, + { + role: "facetV", + allowNone: true, + signals: [SignalNames.FacetVBins] + } + ], + signals: [SignalNames.TreeMapMethod] + } + }; + } + function getFacetLayout(facetStyle, facetColumn, facetVColumn, axisTextColor) { let layoutPair; const groupby = facetColumn; const plotPadding = { - x: 0, - y: 0 + x: 0, + y: 0 }; let facetPadding; - switch(facetStyle){ - case 'cross': - { - const props = { - axisTextColor, - colRowTitles: true, - groupbyX: groupby, - groupbyY: facetVColumn - }; - layoutPair = { - layoutType: 'Cross', - props - }; - facetPadding = { - bottom: (0, _defaults.facetPaddingBottom), - left: (0, _defaults.facetPaddingLeft), - top: 0 - }; - plotPadding.y = (0, _defaults.facetPaddingTop); - plotPadding.x = (0, _defaults.facetPaddingRight); - break; - } - case 'wrap': - default: - { - const props = { - axisTextColor, - cellTitles: true, - groupby - }; - layoutPair = { - layoutType: 'Wrap', - props - }; - facetPadding = { - bottom: (0, _defaults.facetPaddingBottom), - left: (0, _defaults.facetPaddingLeft), - top: (0, _defaults.facetPaddingTop) - }; - break; - } + switch (facetStyle) { + case "cross": { + const props = { + axisTextColor, + colRowTitles: true, + groupbyX: groupby, + groupbyY: facetVColumn + }; + layoutPair = { + layoutType: "Cross", + props + }; + facetPadding = { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: 0 + }; + plotPadding.y = facetPaddingTop; + plotPadding.x = facetPaddingRight; + break; + } + case "wrap": + default: { + const props = { + axisTextColor, + cellTitles: true, + groupby + }; + layoutPair = { + layoutType: "Wrap", + props + }; + facetPadding = { + bottom: facetPaddingBottom, + left: facetPaddingLeft, + top: facetPaddingTop + }; + break; + } } const facetLayout = { - facetPadding, - plotPadding + facetPadding, + plotPadding }; return { - layoutPair, - facetLayout - }; -} - -},{"./defaults":"8thYZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5WPaz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnsFromData", ()=>(0, _dataInference.getColumnsFromData)); -parcelHelpers.export(exports, "getStats", ()=>(0, _dataInference.getStats)); -parcelHelpers.export(exports, "inferAll", ()=>(0, _dataInference.inferAll)); -/** - * Get columns associated with each Insight role. - * @param insight Insight to specify column roles. - * @param columns Array of Columns inferred from the data. - */ parcelHelpers.export(exports, "getSpecColumns", ()=>getSpecColumns); -var _dataInference = require("@msrvida/data-inference"); -function getSpecColumns(insight, columns) { - function getColumnByName(name) { - return columns.filter((c)=>c.name === name)[0]; + layoutPair, + facetLayout + }; + } + const map = { + barchart: barchartV, + barchartH, + barchartV, + density, + grid, + scatterplot, + stacks, + strips, + treemap + }; + function getSpecBuilderPropsForChart(specContext) { + const { insight: insight2, specColumns, specViewOptions } = specContext; + const fn2 = map[insight2.chart]; + if (fn2) { + const props = fn2(specContext); + if (insight2.columns.facet) { + const discreteFacetColumn = { + column: specColumns.facet, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetMaxBins, + maxbinsSignalName: SignalNames.FacetBins + }; + const discreteFacetVColumn = { + column: specColumns.facetV, + defaultBins, + maxbins, + maxbinsSignalDisplayName: specViewOptions.language.FacetVMaxBins, + maxbinsSignalName: SignalNames.FacetVBins + }; + const { facetLayout, layoutPair } = getFacetLayout(insight2.facetStyle, discreteFacetColumn, discreteFacetVColumn, specViewOptions.colors.axisText); + props.layouts.unshift(layoutPair); + props.facetLayout = facetLayout; + props.collapseFacetAxes = specViewOptions.collapseFacetAxes; + } + return props; } - return { - color: getColumnByName(insight.columns && insight.columns.color), - facet: getColumnByName(insight.columns && insight.columns.facet), - facetV: getColumnByName(insight.columns && insight.columns.facetV), - group: getColumnByName(insight.columns && insight.columns.group), - size: getColumnByName(insight.columns && insight.columns.size), - sort: getColumnByName(insight.columns && insight.columns.sort), - uid: getColumnByName(insight.columns && insight.columns.uid), - x: getColumnByName(insight.columns && insight.columns.x), - y: getColumnByName(insight.columns && insight.columns.y), - z: getColumnByName(insight.columns && insight.columns.z) - }; -} - -},{"@msrvida/data-inference":"hkVQr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hkVQr":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _color = require("./color"); -parcelHelpers.exportAll(_color, exports); -var _inference = require("./inference"); -parcelHelpers.exportAll(_inference, exports); -var _numeric = require("./numeric"); -parcelHelpers.exportAll(_numeric, exports); -var _stats = require("./stats"); -parcelHelpers.exportAll(_stats, exports); -var _summary = require("./summary"); -parcelHelpers.exportAll(_summary, exports); - -},{"./color":"2q81Z","./inference":"lppVM","./numeric":"f5ULV","./stats":"66d7u","./summary":"bilAy","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2q81Z":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isColor", ()=>isColor); -parcelHelpers.export(exports, "checkIsColorData", ()=>checkIsColorData); -var _d3Color = require("d3-color"); -function isColor(cssColorSpecifier) { - return !!(0, _d3Color.color)(cssColorSpecifier); -} -function checkIsColorData(data, column) { + } + function isColor(cssColorSpecifier) { + return !!color$2(cssColorSpecifier); + } + function checkIsColorData(data2, column) { if (!column.stats.hasColorData) { - column.isColorData = false; - return; + column.isColorData = false; + return; } - for(let i = 0; i < data.length; i++)if (!isColor(data[i][column.name])) { + for (let i = 0; i < data2.length; i++) { + if (!isColor(data2[i][column.name])) { column.isColorData = false; return; + } } column.isColorData = true; -} - -},{"d3-color":"7SCp9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lppVM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Derive column metadata from the data array. - * @param data Array of data objects. - */ parcelHelpers.export(exports, "getColumnsFromData", ()=>getColumnsFromData); -/** - * Populate columns with type inferences and stats. - * @param columns Array of columns. - * @param data Array of data objects. - */ parcelHelpers.export(exports, "inferAll", ()=>inferAll); -var _color = require("./color"); -var _numeric = require("./numeric"); -var _stats = require("./stats"); -function getColumnsFromData(inferTypesFn, data, columnTypes) { - const sample = data[0]; - const fields = sample ? Object.keys(sample) : []; - const inferences = Object.assign(Object.assign({}, inferTypesFn(data, fields)), columnTypes); - const columns = fields.map((name)=>{ - const column = { - name, - type: inferences[name] - }; - return column; - }); - inferAll(columns, data); - return columns; -} -function inferAll(columns, data) { - columns.forEach((column)=>{ - if (column) { - if (typeof column.quantitative !== 'boolean') column.quantitative = (0, _numeric.isQuantitative)(column); - if (!column.stats) column.stats = (0, _stats.getStats)(data, column); - // hex codes, ex. #003300, are parsed as dates - if ((column.type === 'date' || column.type === 'string') && typeof column.isColorData !== 'boolean') (0, _color.checkIsColorData)(data, column); - } - }); -} - -},{"./color":"2q81Z","./numeric":"f5ULV","./stats":"66d7u","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f5ULV":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isQuantitative", ()=>isQuantitative); -parcelHelpers.export(exports, "detectNegative", ()=>detectNegative); -parcelHelpers.export(exports, "detectSequentialColumn", ()=>detectSequentialColumn); -function isQuantitative(column) { - return column.type === 'number' || column.type === 'integer'; -} -function detectNegative(columnName, data) { - for(let i = 1; i < data.length; i++){ - const value = columnName == null ? data[i] : data[i][columnName]; - if (value < 0) return true; + } + function isQuantitative(column) { + return column.type === "number" || column.type === "integer"; + } + function detectNegative(columnName, data2) { + for (let i = 1; i < data2.length; i++) { + const value2 = columnName == null ? data2[i] : data2[i][columnName]; + if (value2 < 0) + return true; } return false; -} -function detectSequentialColumn(columnName, data) { - if (data.length < 2) return false; - for(let i = 1; i < data.length; i++){ - const curr = columnName == null ? data[i] : data[i][columnName]; - const prev = columnName == null ? data[i - 1] : data[i - 1][columnName]; - if (curr !== prev + 1) return false; + } + function detectSequentialColumn(columnName, data2) { + if (data2.length < 2) + return false; + for (let i = 1; i < data2.length; i++) { + const curr = columnName == null ? data2[i] : data2[i][columnName]; + const prev = columnName == null ? data2[i - 1] : data2[i - 1][columnName]; + if (curr !== prev + 1) + return false; } return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"66d7u":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getStats", ()=>getStats); -var _color = require("./color"); -var _numeric = require("./numeric"); -function getStats(data, ...args) { + } + function getStats(data2, ...args) { let columnName; let columnType; let columnQuantitative; let distinctValuesCallback; if (args.length <= 2) { - const column = args[0]; - columnName = column.name; - columnType = column.type; - columnQuantitative = column.quantitative; - distinctValuesCallback = args[1]; + const column = args[0]; + columnName = column.name; + columnType = column.type; + columnQuantitative = column.quantitative; + distinctValuesCallback = args[1]; } else { - columnName = args[0]; - columnType = args[1]; - columnQuantitative = args[2]; - distinctValuesCallback = args[3]; + columnName = args[0]; + columnType = args[1]; + columnQuantitative = args[2]; + distinctValuesCallback = args[3]; } const distinctMap = {}; const stats = { - nonNull: 0, - distinctValueCount: null, - max: null, - mean: null, - min: null - }; - const columnIsString = columnType === 'string'; - let sum = 0; - for(let i = 0; i < data.length; i++){ - const row = data[i]; - const value = columnName == null ? row : row[columnName]; - if (columnIsString) { - if (value !== '') stats.nonNull++; - } else if (value != null) stats.nonNull++; - const num = +value; - distinctMap[value] = true; - if (!isNaN(num)) { - if (stats.max === null || num > stats.max) stats.max = num; - if (stats.min === null || num < stats.min) stats.min = num; - sum += num; - } - // hex codes, ex. #003300, are parsed as dates - if ((columnType === 'date' || columnIsString) && !stats.hasColorData && (0, _color.isColor)(value)) stats.hasColorData = true; + nonNull: 0, + distinctValueCount: null, + max: null, + mean: null, + min: null + }; + const columnIsString = columnType === "string"; + let sum2 = 0; + for (let i = 0; i < data2.length; i++) { + const row = data2[i]; + const value2 = columnName == null ? row : row[columnName]; + if (columnIsString) { + if (value2 !== "") { + stats.nonNull++; + } + } else if (value2 != null) { + stats.nonNull++; + } + const num = +value2; + distinctMap[value2] = true; + if (!isNaN(num)) { + if (stats.max === null || num > stats.max) { + stats.max = num; + } + if (stats.min === null || num < stats.min) { + stats.min = num; + } + sum2 += num; + } + if ((columnType === "date" || columnIsString) && !stats.hasColorData && isColor(value2)) { + stats.hasColorData = true; + } } if (columnQuantitative) { - stats.mean = data.length > 0 && sum / data.length; - stats.hasNegative = (0, _numeric.detectNegative)(columnName, data); - if (columnType === 'integer') stats.isSequential = (0, _numeric.detectSequentialColumn)(columnName, data); + stats.mean = data2.length > 0 && sum2 / data2.length; + stats.hasNegative = detectNegative(columnName, data2); + if (columnType === "integer") { + stats.isSequential = detectSequentialColumn(columnName, data2); + } } const distinctValues = Object.keys(distinctMap); if (distinctValuesCallback) { - distinctValues.sort(); - distinctValuesCallback(distinctValues); + distinctValues.sort(); + distinctValuesCallback(distinctValues); } stats.distinctValueCount = distinctValues.length; return stats; -} - -},{"./color":"2q81Z","./numeric":"f5ULV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bilAy":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "pandasSimulation", ()=>pandasSimulation); -class Table { - constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = 'right'){ - this.columns = columns; - this.rows = rows; - this.maxWidth = maxWidth; - this.underlineHeaders = underlineHeaders; - this.align = align; - // Calculate maximum width for each column - this.columnWidths = this.columns.map((col, idx)=>Math.max(col.length, ...this.rows.map((row)=>{ - var _a; - return ((_a = row[idx]) === null || _a === void 0 ? void 0 : _a.length) || 0; - }))); + } + function getColumnsFromData(inferTypesFn, data2, columnTypes) { + const sample = data2[0]; + const fields = sample ? Object.keys(sample) : []; + const inferences = Object.assign(Object.assign({}, inferTypesFn(data2, fields)), columnTypes); + const columns = fields.map((name) => { + const column = { + name, + type: inferences[name] + }; + return column; + }); + inferAll(columns, data2); + return columns; + } + function inferAll(columns, data2) { + columns.forEach((column) => { + if (column) { + if (typeof column.quantitative !== "boolean") { + column.quantitative = isQuantitative(column); + } + if (!column.stats) { + column.stats = getStats(data2, column); + } + if ((column.type === "date" || column.type === "string") && typeof column.isColorData !== "boolean") { + checkIsColorData(data2, column); + } + } + }); + } + let Table$2 = class Table { + constructor(columns, rows, maxWidth = 80, underlineHeaders = false, align = "right") { + this.columns = columns; + this.rows = rows; + this.maxWidth = maxWidth; + this.underlineHeaders = underlineHeaders; + this.align = align; + this.columnWidths = this.columns.map((col, idx) => Math.max(col.length, ...this.rows.map((row) => { + var _a; + return ((_a = row[idx]) === null || _a === void 0 ? void 0 : _a.length) || 0; + }))); } createSpaces(num) { - return ' '.repeat(num); + return " ".repeat(num); } groupColumns() { - let cumulativeWidth = 0; - const columnGroups = []; - let currentGroup = []; - this.columns.forEach((col, idx)=>{ - const columnSpace = this.columnWidths[idx] + 1; // account for one space between columns - if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { - columnGroups.push(currentGroup); - cumulativeWidth = columnSpace; - currentGroup = [ - col - ]; - } else { - cumulativeWidth += columnSpace; - currentGroup.push(col); - } - }); - if (currentGroup.length > 0) columnGroups.push(currentGroup); - return columnGroups; + let cumulativeWidth = 0; + const columnGroups = []; + let currentGroup = []; + this.columns.forEach((col, idx) => { + const columnSpace = this.columnWidths[idx] + 1; + if (cumulativeWidth + columnSpace > this.maxWidth && currentGroup.length > 0) { + columnGroups.push(currentGroup); + cumulativeWidth = columnSpace; + currentGroup = [col]; + } else { + cumulativeWidth += columnSpace; + currentGroup.push(col); + } + }); + if (currentGroup.length > 0) { + columnGroups.push(currentGroup); + } + return columnGroups; } - formatRow(row, group) { - return group.map((col)=>{ - const idx = this.columns.indexOf(col); - const cellValue = row[idx] == null ? '' : row[idx].toString(); - return this.align === 'right' ? cellValue.padStart(this.columnWidths[idx], ' ') : cellValue.padEnd(this.columnWidths[idx], ' '); - }).join(this.createSpaces(1)); + formatRow(row, group2) { + return group2.map((col) => { + const idx = this.columns.indexOf(col); + const cellValue = row[idx] == null ? "" : row[idx].toString(); + return this.align === "right" ? cellValue.padStart(this.columnWidths[idx], " ") : cellValue.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); } - formatHeader(group) { - return group.map((col)=>{ - const idx = this.columns.indexOf(col); - return this.align === 'right' ? col.padStart(this.columnWidths[idx], ' ') : col.padEnd(this.columnWidths[idx], ' '); - }).join(this.createSpaces(1)); + formatHeader(group2) { + return group2.map((col) => { + const idx = this.columns.indexOf(col); + return this.align === "right" ? col.padStart(this.columnWidths[idx], " ") : col.padEnd(this.columnWidths[idx], " "); + }).join(this.createSpaces(1)); } - underlineHeader(group) { - return group.map((col)=>'-'.repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); + underlineHeader(group2) { + return group2.map((col) => "-".repeat(this.columnWidths[this.columns.indexOf(col)])).join(this.createSpaces(1)); } render() { - const output = []; - const columnGroups = this.groupColumns(); - columnGroups.forEach((group, groupIndex)=>{ - const headerRow = this.formatHeader(group); - let section = headerRow + (groupIndex < columnGroups.length - 1 ? ' \\' : '') + '\n'; - if (this.underlineHeaders) section += this.underlineHeader(group) + '\n'; - this.rows.forEach((row)=>{ - section += this.formatRow(row, group) + '\n'; - }); - output.push(section); - if (groupIndex < columnGroups.length - 1) output.push('\n'); - }); - return output.join(''); - } -} -var pandasSimulation; -(function(pandasSimulation) { - // Mapping TypeScript types to Python-like dtypes - const typeMapping = { - boolean: 'bool', - number: 'float64', - date: 'datetime64[ns]', - string: 'object', - integer: 'int64' - }; - function head(columns, data, maxWidth = 80) { - const numRows = 5; // Number of rows as in `head(5)` from pandas - const top = data.slice(0, numRows); // Get the top `numRows` rows - // Create a "fake" row number column - const rowNumbers = Array.from({ - length: numRows - }, (_, i)=>(i + 1).toString()); - // Extract column names and rows for the table - const columnNames = [ - '' - ].concat(columns.map((col)=>col.name)); - const rows = top.map((row, i)=>[ - rowNumbers[i] - ].concat(columns.map((col)=>{ - var _a; - return ((_a = row[col.name]) === null || _a === void 0 ? void 0 : _a.toString()) || ''; - }))); - // Create and render the table with right alignment - const table = new Table(columnNames, rows, maxWidth, false, 'right'); // Right alignment - return table.render(); - } - pandasSimulation.head = head; - function info(columns, data, maxWidth = 80) { - const numRows = data.length; - const output = []; - // Summary header - output.push('<class \'pandas.core.frame.DataFrame\'>'); - output.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); - output.push(`Data columns (total ${columns.length} columns):\n`); - // Column headers and details - const columnHeaders = [ - '#', - 'Column', - 'Non-Null Count', - 'Dtype' - ]; - const rows = columns.map((col, idx)=>{ - const nonNullCount = col.stats.nonNull.toString(); - const dtype = typeMapping[col.type] || 'unknown'; - return [ - idx.toString(), - col.name, - `${nonNullCount} non-null`, - dtype - ]; - }); - // Create and render the table with left alignment and header underline - const table = new Table(columnHeaders, rows, maxWidth, true, 'left'); // Left alignment - output.push(table.render()); - // Memory usage estimation - const memoryUsage = columns.reduce((total, col)=>{ - var _a; - const exampleValue = (_a = data.find((row)=>row[col.name] != null)) === null || _a === void 0 ? void 0 : _a[col.name]; - if (exampleValue == null) return total; - const size = new Blob([ - exampleValue.toString() - ]).size; - return total + size * numRows; - }, 0); - output.push(`\ndtypes: ${columns.filter((col)=>col.type === 'number').length} float64, ` + `${columns.filter((col)=>col.type === 'integer').length} int64, ` + `${columns.filter((col)=>col.type === 'string').length} object`); - output.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); - return output.join('\n'); - } - pandasSimulation.info = info; -})(pandasSimulation || (pandasSimulation = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j86BQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SpecBuilder", ()=>SpecBuilder); -var _axes = require("./axes"); -var _color = require("./color"); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -var _facetTitle = require("./facetTitle"); -var _fill = require("./fill"); -var _globalScope = require("./globalScope"); -var _scope = require("./scope"); -var _signals = require("./signals"); -var _index = require("./layouts/index"); -var _image = require("./image"); -class SpecBuilder { - constructor(props, specContext){ - this.props = props; - this.specContext = specContext; - this.globalSignals = { - facetAxesAdjustX: { - name: (0, _constants.SignalNames).FacetAxesAdjustX, - update: props.facetLayout && props.collapseFacetAxes ? (0, _defaults.facetPaddingLeft).toString() : '0' - }, - facetAxesAdjustY: { - name: (0, _constants.SignalNames).FacetAxesAdjustY, - update: props.facetLayout && props.collapseFacetAxes ? (0, _defaults.facetPaddingBottom).toString() : '0' - }, - minCellWidth: { - name: (0, _constants.SignalNames).MinCellWidth, - update: `${0, _defaults.minFacetWidth}` - }, - minCellHeight: { - name: (0, _constants.SignalNames).MinCellHeight, - update: `${0, _defaults.minFacetHeight}` - }, - plotOffsetLeft: { - name: (0, _constants.SignalNames).PlotOffsetLeft, - update: '0' - }, - plotOffsetTop: { - name: (0, _constants.SignalNames).PlotOffsetTop, - update: '0' - }, - plotOffsetBottom: { - name: (0, _constants.SignalNames).PlotOffsetBottom, - update: '0' - }, - plotOffsetRight: { - name: (0, _constants.SignalNames).PlotOffsetRight, - update: '0' - }, - plotHeightOut: { - name: (0, _constants.SignalNames).PlotHeightOut, - update: (0, _constants.SignalNames).PlotHeightIn - }, - plotWidthOut: { - name: (0, _constants.SignalNames).PlotWidthOut, - update: (0, _constants.SignalNames).PlotWidthIn - } - }; - } - validate() { - const { specContext } = this; - const { specCapabilities } = this.props; - const { roles } = specCapabilities; - const required = roles.filter((r)=>{ - switch(typeof r.allowNone){ - case 'boolean': - return !r.allowNone; - case 'undefined': - return true; - case 'function': - return !r.allowNone(specContext); - } - }); - const numeric = roles.filter((r)=>r.excludeCategoric); - const errors = required.map((r)=>{ - if (specContext.specColumns[r.role]) return null; - else return `Field ${r.role} is required.`; - }).concat(numeric.map((r)=>{ - if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) return `Field ${r.role} must be quantitative.`; - else return null; - })).filter(Boolean); - const { backgroundImage } = specContext.insight; - if (backgroundImage && !backgroundImage.extents) errors.push('BackgroundImage must have extents.'); - return errors; - } - build() { - var _a, _b; - const { globalSignals, specContext } = this; - const { facetLayout, specCapabilities } = this.props; - const { insight, specColumns, specViewOptions } = specContext; - const dataName = 'data_source'; - const { vegaSpec, groupMark } = this.initSpec(dataName); - const { topColorField, colorDataName } = (0, _color.addColor)({ - scope: vegaSpec, - dataName, - specContext, - scaleName: (0, _constants.ScaleNames).Color, - legendDataName: 'data_legend', - topLookupName: 'data_topcolorlookup', - colorReverseSignalName: (0, _constants.SignalNames).ColorReverse - }); - const globalScope = new (0, _globalScope.GlobalScope)({ - dataName: colorDataName, - markGroup: groupMark, - scope: vegaSpec, - signals: globalSignals - }); - if (facetLayout) { - (0, _scope.addSignals)(vegaSpec, { - name: (0, _constants.SignalNames).FacetPaddingBottom, - update: `${facetLayout.facetPadding.bottom}` - }, { - name: (0, _constants.SignalNames).FacetPaddingLeft, - update: `${facetLayout.facetPadding.left}` - }, { - name: (0, _constants.SignalNames).FacetPaddingTop, - update: `${facetLayout.facetPadding.top}` - }); - globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; - globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; - } - const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope)=>{ - if (facetLayout && i === 0) globalScope.zSize = innerScope.offsets.h; + const output2 = []; + const columnGroups = this.groupColumns(); + columnGroups.forEach((group2, groupIndex) => { + const headerRow = this.formatHeader(group2); + let section = headerRow + (groupIndex < columnGroups.length - 1 ? " \\" : "") + "\n"; + if (this.underlineHeaders) { + section += this.underlineHeader(group2) + "\n"; + } + this.rows.forEach((row) => { + section += this.formatRow(row, group2) + "\n"; }); - if (specResult) return specResult; - if (allGlobalScales.length > 0) { - const plotHeightOut = globalSignals.plotHeightOut.name; - const plotWidthOut = globalSignals.plotWidthOut.name; - const colTitleScale = { - type: 'linear', - name: 'scale_facet_col_title', - domain: [ - 0, - 1 - ], - range: [ - 0, - { - signal: plotWidthOut - } - ] - }; - const rowTitleScale = { - type: 'linear', - name: 'scale_facet_row_title', - domain: [ - 0, - 1 - ], - range: [ - { - signal: plotHeightOut - }, - 0 - ] - }; - const facetScope = facetLayout ? firstScope : null; - const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; - //TODO if capability and numeric x,y - if (insight.backgroundImage && specCapabilities.backgroundImage && ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative)) { - //backgroundGroup.encode.update.fill = { value: 'pink' } - if (!backgroundGroup.marks) backgroundGroup.marks = []; - const imageMark = (0, _image.getImageMark)(insight.backgroundImage, allGlobalScales); - backgroundGroup.marks.unshift(imageMark); - } - const axesScopes = facetLayout ? (0, _facetTitle.addFacetAxesGroupMarks)({ - globalScope: globalScope.scope, - plotScope: groupMark, - facetScope, - colTitleScale, - rowTitleScale, - colSeqName: 'data_FacetCellColTitles', - rowSeqName: 'data_FacetCellRowTitles' - }) : { - main: [ - { - scope: groupMark, - lines: true, - labels: true, - title: true - } - ] - }; - (0, _axes.addGlobalAxes)({ - globalScope, - allGlobalScales, - axisScales: this.props.axisScales, - plotOffsetSignals: { - x: globalSignals.plotOffsetLeft, - y: globalSignals.plotOffsetBottom - }, - axesOffsets: { - x: (0, _defaults.axesOffsetX), - y: (0, _defaults.axesOffsetY) - }, - axesTitlePadding: facetLayout ? { - x: (0, _defaults.axesTitlePaddingFacetX), - y: (0, _defaults.axesTitlePaddingFacetY) - } : { - x: (0, _defaults.axesTitlePaddingX), - y: (0, _defaults.axesTitlePaddingY) - }, - labelBaseline: { - x: 'top', - y: 'middle' - }, - specColumns, - specViewOptions, - axesScopes, - hideZAxis: !!facetLayout, - view: insight.view - }); - } - //add mark to the final scope - if (finalScope.mark) { - const { update } = finalScope.mark.encode; - const outputDataName = 'output'; - finalScope.mark.from.data = outputDataName; - (0, _scope.addData)(globalScope.markGroup, { - name: outputDataName, - source: globalScope.markDataName, - transform: [ - { - type: 'formula', - expr: finalScope.offsets.x, - as: (0, _constants.FieldNames).OffsetX - }, - { - type: 'formula', - expr: finalScope.offsets.y, - as: (0, _constants.FieldNames).OffsetY - } - ] - }); - update.x = { - field: (0, _constants.FieldNames).OffsetX - }; - update.y = { - field: (0, _constants.FieldNames).OffsetY - }; - allEncodingRules.forEach((map)=>{ - for(const key in map)if (update[key]) { - const arrIn = map[key]; - if (!Array.isArray(update[key])) { - const value = update[key]; - const arrOut = []; - update[key] = arrOut; - arrIn.forEach((rule)=>arrOut.push(rule)); - arrOut.push(value); - } else { - const arrOut = update[key]; - arrIn.forEach((rule)=>arrOut.unshift(rule)); - } - } - }); - update.fill = (0, _fill.fill)(specContext, topColorField, (0, _constants.ScaleNames).Color); - update.opacity = (0, _fill.opacity)(specContext); + output2.push(section); + if (groupIndex < columnGroups.length - 1) { + output2.push("\n"); } - return { - specCapabilities, - vegaSpec - }; + }); + return output2.join(""); } - initSpec(dataName) { - const { globalSignals } = this; - const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; - const { specContext } = this; - const { insight } = specContext; - const groupMark = { - type: 'group', - //style: 'cell', - encode: { - update: { - x: { - signal: `${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).FacetAxesAdjustX}` - }, - y: { - signal: (0, _constants.SignalNames).PlotOffsetTop - }, - height: { - signal: `${(0, _constants.SignalNames).PlotHeightOut} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - width: { - signal: `${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).FacetAxesAdjustX}` - } - } - } - }; - const inputDataname = 'input'; - const vegaSpec = { - $schema: 'https://vega.github.io/schema/vega/v5.json', - //style: 'cell', - data: [ - { - name: inputDataname - }, - { - name: dataName, - source: inputDataname, - transform: [] - } - ], - marks: [ - groupMark - ], - signals: (0, _signals.textSignals)(specContext, (0, _constants.SignalNames).ViewportHeight).concat([ - minCellWidth, - minCellHeight, - { - name: (0, _constants.SignalNames).ViewportHeight, - update: `max(${(0, _constants.SignalNames).MinCellHeight}, ${insight.size.height})` - }, - { - name: (0, _constants.SignalNames).ViewportWidth, - update: `max(${(0, _constants.SignalNames).MinCellWidth}, ${insight.size.width})` - }, - plotOffsetLeft, - plotOffsetTop, - plotOffsetBottom, - plotOffsetRight, - facetAxesAdjustX, - facetAxesAdjustY, - { - name: (0, _constants.SignalNames).PlotHeightIn, - update: `${(0, _constants.SignalNames).ViewportHeight} - ${(0, _constants.SignalNames).PlotOffsetBottom} + ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - { - name: (0, _constants.SignalNames).PlotWidthIn, - update: `${(0, _constants.SignalNames).ViewportWidth} - ${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).PlotOffsetRight}` - }, - plotHeightOut, - plotWidthOut, - { - name: 'height', - update: `${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).PlotHeightOut} + ${(0, _constants.SignalNames).PlotOffsetBottom} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - { - name: 'width', - update: `${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).PlotOffsetLeft} + ${(0, _constants.SignalNames).PlotOffsetRight}` - } - ]) - }; - return { - vegaSpec, - groupMark - }; + }; + var pandasSimulation; + (function(pandasSimulation2) { + const typeMapping = { + boolean: "bool", + number: "float64", + // Assuming 'number' is used for floating-point numbers + date: "datetime64[ns]", + string: "object", + integer: "int64" + }; + function head(columns, data2, maxWidth = 80) { + const numRows = 5; + const top = data2.slice(0, numRows); + const rowNumbers = Array.from({ length: numRows }, (_, i) => (i + 1).toString()); + const columnNames = [""].concat(columns.map((col) => col.name)); + const rows = top.map((row, i) => [rowNumbers[i]].concat(columns.map((col) => { + var _a; + return ((_a = row[col.name]) === null || _a === void 0 ? void 0 : _a.toString()) || ""; + }))); + const table = new Table$2(columnNames, rows, maxWidth, false, "right"); + return table.render(); + } + pandasSimulation2.head = head; + function info2(columns, data2, maxWidth = 80) { + const numRows = data2.length; + const output2 = []; + output2.push("<class 'pandas.core.frame.DataFrame'>"); + output2.push(`Index: ${numRows} entries, 0 to ${numRows - 1}`); + output2.push(`Data columns (total ${columns.length} columns): +`); + const columnHeaders = ["#", "Column", "Non-Null Count", "Dtype"]; + const rows = columns.map((col, idx) => { + const nonNullCount = col.stats.nonNull.toString(); + const dtype = typeMapping[col.type] || "unknown"; + return [idx.toString(), col.name, `${nonNullCount} non-null`, dtype]; + }); + const table = new Table$2(columnHeaders, rows, maxWidth, true, "left"); + output2.push(table.render()); + const memoryUsage = columns.reduce((total, col) => { + var _a; + const exampleValue = (_a = data2.find((row) => row[col.name] != null)) === null || _a === void 0 ? void 0 : _a[col.name]; + if (exampleValue == null) + return total; + const size2 = new Blob([exampleValue.toString()]).size; + return total + size2 * numRows; + }, 0); + output2.push(` +dtypes: ${columns.filter((col) => col.type === "number").length} float64, ${columns.filter((col) => col.type === "integer").length} int64, ${columns.filter((col) => col.type === "string").length} object`); + output2.push(`memory usage: ${(memoryUsage / 1024).toFixed(1)} KB`); + return output2.join("\n"); + } + pandasSimulation2.info = info2; + })(pandasSimulation || (pandasSimulation = {})); + function getSpecColumns(insight2, columns) { + function getColumnByName(name) { + return columns.filter((c2) => c2.name === name)[0]; } - iterateLayouts(globalScope, onLayoutBuild) { - let specResult; - let parentScope = { - sizeSignals: globalScope.sizeSignals, - offsets: globalScope.offsets - }; - let firstScope; - let childScope; - const groupings = []; - const { layouts, specCapabilities } = this.props; - const allGlobalScales = []; - const allEncodingRules = []; - for(let i = 0; i < layouts.length; i++){ - if (!parentScope) continue; - const buildProps = { - globalScope, - parentScope, - axesScales: this.props.axisScales, - groupings, - id: i - }; - const layout = this.createLayout(layouts[i], buildProps); - try { - childScope = layout.build(); - childScope.id = i; - const groupby = layout.getGrouping(); - if (groupby) groupings.push({ - id: i, - groupby, - fieldOps: [ - { - field: null, - op: 'count', - as: (0, _constants.FieldNames).Count - } - ] - }); - const sumOp = layout.getAggregateSumOp(); - if (sumOp) groupings[groupings.length - 1].fieldOps.push(sumOp); - onLayoutBuild(i, childScope); - } catch (e) { - specResult = { - errors: [ - e.stack - ], - specCapabilities, - vegaSpec: null - }; - break; - } - if (childScope && childScope.globalScales) allGlobalScales.push(childScope.globalScales); - if (childScope.encodingRuleMap) allEncodingRules.push(childScope.encodingRuleMap); - if (i === 0) firstScope = childScope; - parentScope = childScope; - } - return { - firstScope, - finalScope: parentScope, - specResult, - allGlobalScales, - allEncodingRules - }; + return { + color: getColumnByName(insight2.columns && insight2.columns.color), + facet: getColumnByName(insight2.columns && insight2.columns.facet), + facetV: getColumnByName(insight2.columns && insight2.columns.facetV), + group: getColumnByName(insight2.columns && insight2.columns.group), + size: getColumnByName(insight2.columns && insight2.columns.size), + sort: getColumnByName(insight2.columns && insight2.columns.sort), + uid: getColumnByName(insight2.columns && insight2.columns.uid), + x: getColumnByName(insight2.columns && insight2.columns.x), + y: getColumnByName(insight2.columns && insight2.columns.y), + z: getColumnByName(insight2.columns && insight2.columns.z) + }; + } + function addAxes(scope, ...axes) { + if (!axes || !axes.length) + return; + if (!scope.axes) + scope.axes = []; + scope.axes.push(...axes.filter(Boolean)); + } + function addData(scope, ...datas) { + if (!datas || !datas.length) + return; + if (!scope.data) + scope.data = []; + scope.data.push(...datas.filter(Boolean)); + } + function addMarks(scope, ...marks) { + if (!marks || !marks.length) + return; + if (!scope.marks) + scope.marks = []; + scope.marks.push(...marks.filter(Boolean)); + } + function addScales(scope, ...scales2) { + if (!scales2 || !scales2.length) + return; + if (!scope.scales) + scope.scales = []; + scope.scales.push(...scales2.filter(Boolean)); + } + function addSignals(scope, ...signals) { + if (!signals || !signals.length) + return; + if (!scope.signals) + scope.signals = []; + scope.signals.push(...signals.filter(Boolean)); + } + function addTransforms(data2, ...transforms2) { + if (!transforms2 || !transforms2.length) + return; + if (!data2.transform) + data2.transform = []; + data2.transform.push(...transforms2.filter(Boolean)); + } + function getDataByName(data2, dataName) { + for (let i = 0; i < data2.length; i++) { + if (data2[i].name === dataName) + return { data: data2[i], index: i }; } - createLayout(layoutPair, buildProps) { - const { layoutType, props } = layoutPair; - const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); - const layoutClass = (0, _index.layoutClasses)[layoutType]; - const layout = new layoutClass(layoutBuildProps); - layout.id = buildProps.id; - return layout; - } -} - -},{"./axes":"4bgau","./color":"eysPc","./constants":"8P82N","./defaults":"8thYZ","./facetTitle":"4A66v","./fill":"kzMLL","./globalScope":"eSDVh","./scope":"9Kdkb","./signals":"9zG5R","./layouts/index":"4OSVM","./image":"bBG3O","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4bgau":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addGlobalAxes", ()=>addGlobalAxes); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -var _scope = require("./scope"); -function addGlobalAxes(props) { + } + function getGroupBy(groupings) { + const groupby = groupings.map((g) => g.groupby); + return groupby.reduce((acc, val) => acc.concat(val), []); + } + function addOffsets(...offsets2) { + return offsets2.filter(Boolean).join(" + "); + } + function addGlobalAxes(props) { const { axesOffsets, axisScales, axesScopes, axesTitlePadding, allGlobalScales, globalScope, labelBaseline, plotOffsetSignals, specColumns, specViewOptions } = props; const { scope } = globalScope; - allGlobalScales.forEach((globalScales)=>{ - const { scales } = globalScales; - for(const xyz in scales){ - const _scales = scales[xyz]; - if (_scales) { - (0, _scope.addScales)(scope, ..._scales); - let { showAxes } = globalScales; - let zindex = undefined; - if (xyz === 'z') { - showAxes = false; - if (props.view === '3d' && specViewOptions.zAxisOptions && !props.hideZAxis) { - if (specViewOptions.zAxisOptions.showZAxis) { - showAxes = true; - zindex = specViewOptions.zAxisOptions.zIndex; - } - } - } - if (showAxes && axisScales) { - const axisScale = axisScales[xyz]; - if (axisScale) { - const lineColor = specViewOptions.colors.axisLine; - const horizontal = xyz === 'x'; - const column = specColumns[xyz] || { - quantitative: true - }; - const title = axisScale.title; - const props = { - title, - horizontal, - column, - specViewOptions, - lineColor, - titlePadding: axesTitlePadding[xyz], - labelBaseline: labelBaseline[xyz], - zindex - }; - axesScopes['main'].forEach((a)=>(0, _scope.addAxes)(a.scope, createAxis(Object.assign(Object.assign({}, props), { - scale: a.scale || _scales[0], - showTitle: a.title, - showLabels: a.labels, - showLines: a.lines - })))); - if (axesScopes[xyz]) axesScopes[xyz].forEach((a)=>(0, _scope.addAxes)(a.scope, createAxis(Object.assign(Object.assign({}, props), { - scale: a.scale || _scales[0], - showTitle: a.title, - showLabels: a.labels, - showLines: a.lines - })))); - if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { - const plotOffsetSignal = plotOffsetSignals[xyz]; - plotOffsetSignal.update = `${axesOffsets[xyz]}`; - } - } - } - } + allGlobalScales.forEach((globalScales) => { + const { scales: scales2 } = globalScales; + for (const xyz in scales2) { + const _scales = scales2[xyz]; + if (_scales) { + addScales(scope, ..._scales); + let { showAxes } = globalScales; + let zindex = void 0; + if (xyz === "z") { + showAxes = false; + if (props.view === "3d" && specViewOptions.zAxisOptions && !props.hideZAxis) { + if (specViewOptions.zAxisOptions.showZAxis) { + showAxes = true; + zindex = specViewOptions.zAxisOptions.zIndex; + } + } + } + if (showAxes && axisScales) { + const axisScale = axisScales[xyz]; + if (axisScale) { + const lineColor = specViewOptions.colors.axisLine; + const horizontal = xyz === "x"; + const column = specColumns[xyz] || { quantitative: true }; + const title = axisScale.title; + const props2 = { + title, + horizontal, + column, + specViewOptions, + lineColor, + titlePadding: axesTitlePadding[xyz], + labelBaseline: labelBaseline[xyz], + zindex + }; + axesScopes["main"].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); + if (axesScopes[xyz]) { + axesScopes[xyz].forEach((a2) => addAxes(a2.scope, createAxis(Object.assign(Object.assign({}, props2), { scale: a2.scale || _scales[0], showTitle: a2.title, showLabels: a2.labels, showLines: a2.lines })))); + } + if (plotOffsetSignals[xyz] && axesOffsets[xyz]) { + const plotOffsetSignal = plotOffsetSignals[xyz]; + plotOffsetSignal.update = `${axesOffsets[xyz]}`; + } + } + } } + } }); -} -function createAxis(props) { - const { column, horizontal, labelBaseline, lineColor, scale, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; - const axis = Object.assign(Object.assign(Object.assign(Object.assign({ - zindex, - scale: scale.name, - orient: horizontal ? 'bottom' : 'left', - domain: showLines, - ticks: showLines - }, showLines && { - domainColor: lineColor, - tickColor: lineColor, - tickSize: specViewOptions.tickSize + } + function createAxis(props) { + const { column, horizontal, labelBaseline, lineColor, scale: scale2, showLabels, showTitle, showLines, specViewOptions, title, titlePadding, zindex } = props; + const axis = Object.assign(Object.assign(Object.assign(Object.assign({ zindex, scale: scale2.name, orient: horizontal ? "bottom" : "left", domain: showLines, ticks: showLines }, showLines && { + domainColor: lineColor, + tickColor: lineColor, + tickSize: specViewOptions.tickSize }), showTitle && { - title, - titleAlign: horizontal ? 'left' : 'right', - titleAngle: { - signal: horizontal ? (0, _constants.SignalNames).TextAngleX : (0, _constants.SignalNames).TextAngleY - }, - titleColor: specViewOptions.colors.axisText, - titleFontSize: { - signal: (0, _constants.SignalNames).TextTitleSize - }, - titleLimit: (0, _defaults.axesTitleLimit), - titlePadding - }), { - labels: showLabels - }), showLabels && { - labelAlign: horizontal ? 'left' : 'right', - labelBaseline, - labelAngle: { - signal: horizontal ? (0, _constants.SignalNames).TextAngleX : (0, _constants.SignalNames).TextAngleY - }, - labelColor: specViewOptions.colors.axisText, - labelFontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - labelLimit: (0, _defaults.axesLabelLimit) + title, + titleAlign: horizontal ? "left" : "right", + titleAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY + }, + titleColor: specViewOptions.colors.axisText, + titleFontSize: { + signal: SignalNames.TextTitleSize + }, + titleLimit: axesTitleLimit, + titlePadding + }), { labels: showLabels }), showLabels && { + labelAlign: horizontal ? "left" : "right", + labelBaseline, + labelAngle: { + signal: horizontal ? SignalNames.TextAngleX : SignalNames.TextAngleY + }, + labelColor: specViewOptions.colors.axisText, + labelFontSize: { + signal: SignalNames.TextSize + }, + labelLimit: axesLabelLimit }); - if (column.quantitative) axis.format = '~r'; - return axis; -} - -},{"./constants":"8P82N","./defaults":"8thYZ","./scope":"9Kdkb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Kdkb":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addAxes", ()=>addAxes); -parcelHelpers.export(exports, "addData", ()=>addData); -parcelHelpers.export(exports, "addMarks", ()=>addMarks); -parcelHelpers.export(exports, "addScales", ()=>addScales); -parcelHelpers.export(exports, "addSignals", ()=>addSignals); -parcelHelpers.export(exports, "addTransforms", ()=>addTransforms); -parcelHelpers.export(exports, "getDataByName", ()=>getDataByName); -parcelHelpers.export(exports, "getGroupBy", ()=>getGroupBy); -parcelHelpers.export(exports, "addOffsets", ()=>addOffsets); -function addAxes(scope, ...axes) { - if (!axes || !axes.length) return; - if (!scope.axes) scope.axes = []; - scope.axes.push(...axes.filter(Boolean)); -} -function addData(scope, ...datas) { - if (!datas || !datas.length) return; - if (!scope.data) scope.data = []; - scope.data.push(...datas.filter(Boolean)); -} -function addMarks(scope, ...marks) { - if (!marks || !marks.length) return; - if (!scope.marks) scope.marks = []; - scope.marks.push(...marks.filter(Boolean)); -} -function addScales(scope, ...scales) { - if (!scales || !scales.length) return; - if (!scope.scales) scope.scales = []; - scope.scales.push(...scales.filter(Boolean)); -} -function addSignals(scope, ...signals) { - if (!signals || !signals.length) return; - if (!scope.signals) scope.signals = []; - scope.signals.push(...signals.filter(Boolean)); -} -function addTransforms(data, ...transforms) { - if (!transforms || !transforms.length) return; - if (!data.transform) data.transform = []; - data.transform.push(...transforms.filter(Boolean)); -} -function getDataByName(data, dataName) { - for(let i = 0; i < data.length; i++){ - if (data[i].name === dataName) return { - data: data[i], - index: i - }; - } -} -function getGroupBy(groupings) { - const groupby = groupings.map((g)=>g.groupby); - return groupby.reduce((acc, val)=>acc.concat(val), []); -} -function addOffsets(...offsets) { - return offsets.filter(Boolean).join(' + '); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eysPc":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addColor", ()=>addColor); -var _scope = require("./scope"); -var _scales = require("./scales"); -var _signals = require("./signals"); -var _constants = require("./constants"); -var _legends = require("./legends"); -var _top = require("./top"); -function addColor(props) { - const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; - let colorDataName = dataName; - const { insight, specColumns, specViewOptions } = specContext; - const legends = (0, _legends.getLegends)(specContext, scaleName); - if (legends) scope.legends = legends; - const categoricalColor = specColumns.color && !specColumns.color.quantitative; - if (categoricalColor) { - (0, _scope.addData)(scope, ...(0, _top.topLookup)(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, (0, _constants.FieldNames).TopColor, (0, _constants.FieldNames).TopIndex)); - colorDataName = legendDataName; - } - if (specColumns.color && !specColumns.color.isColorData && !insight.directColor) { - if (specColumns.color.quantitative) (0, _scope.addScales)(scope, (0, _scales.binnableColorScale)(scaleName, insight.colorBin, dataName, specColumns.color.name, insight.scheme)); - else (0, _scope.addScales)(scope, { - name: scaleName, - type: 'ordinal', - domain: { - data: colorDataName, - field: (0, _constants.FieldNames).TopColor, - sort: true - }, - range: { - scheme: insight.scheme || (0, _constants.ColorScaleNone) - }, - reverse: { - signal: colorReverseSignalName - } - }); + if (column.quantitative) { + axis.format = "~r"; } - (0, _scope.addSignals)(scope, (0, _signals.colorBinCountSignal)(specContext), (0, _signals.colorReverseSignal)(specContext)); - return { - topColorField: (0, _constants.FieldNames).TopColor, - colorDataName - }; -} - -},{"./scope":"9Kdkb","./scales":"8P0Pa","./signals":"9zG5R","./constants":"8P82N","./legends":"6gOcN","./top":"dPeEK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8P0Pa":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "linearScale", ()=>linearScale); -parcelHelpers.export(exports, "pointScale", ()=>pointScale); -parcelHelpers.export(exports, "binnableColorScale", ()=>binnableColorScale); -var _constants = require("./constants"); -var _expr = require("./expr"); -function linearScale(scaleName, domain, range, reverse, zero, nice = true) { - const scale = { - name: scaleName, - type: 'linear', - range, - round: true, - reverse, - domain, - zero, - nice - }; - return scale; -} -function pointScale(scaleName, data, range, field, reverse) { - const scale = { - name: scaleName, - type: 'point', - range, - domain: { - data, - field: (0, _expr.safeFieldName)(field), - sort: true - }, - padding: 0.5 - }; - if (reverse !== undefined) scale.reverse = reverse; - return scale; -} -function binnableColorScale(scaleName, colorBin, data, field, scheme) { - scheme = scheme || (0, _constants.ColorScaleNone); - const domain = { - data, - field: (0, _expr.safeFieldName)(field) - }; - const range = { - scheme - }; - const reverse = { - signal: (0, _constants.SignalNames).ColorReverse - }; - if (colorBin !== 'continuous') range.count = { - signal: (0, _constants.SignalNames).ColorBinCount + return axis; + } + function safeFieldName(field2) { + return field2.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"').replace(/\./g, "\\.").replace(/\[/g, "\\[").replace(/\]/g, "\\]"); + } + function exprSafeFieldName(field2) { + return field2.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ""); + } + function linearScale(scaleName, domain2, range2, reverse2, zero2, nice2 = true) { + const scale2 = { + name: scaleName, + type: "linear", + range: range2, + round: true, + reverse: reverse2, + domain: domain2, + zero: zero2, + nice: nice2 + }; + return scale2; + } + function pointScale(scaleName, data2, range2, field2, reverse2) { + const scale2 = { + name: scaleName, + type: "point", + range: range2, + domain: { + data: data2, + field: safeFieldName(field2), + sort: true + }, + padding: 0.5 }; - switch(colorBin){ - case 'continuous': - { - const sequentialScale = { - name: scaleName, - type: 'linear', - domain, - range, - reverse - }; - return sequentialScale; - } - case 'quantile': - { - const quantileScale = { - name: scaleName, - type: 'quantile', - domain, - range, - reverse - }; - return quantileScale; - } - default: - { - const quantizeScale = { - name: scaleName, - type: 'quantize', - domain, - range, - reverse - }; - return quantizeScale; - } + if (reverse2 !== void 0) { + scale2.reverse = reverse2; } -} - -},{"./constants":"8P82N","./expr":"xWMIR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"xWMIR":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * Make sure that the field name is accessible via Vega's Field type - * https://vega.github.io/vega/docs/types/#Field - * examples: "source.x", "target['x']", "[my.field]" - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "safeFieldName", ()=>safeFieldName); -/** - * Make sure the field name is usable in a Vega expression - */ parcelHelpers.export(exports, "exprSafeFieldName", ()=>exprSafeFieldName); -function safeFieldName(field) { - return field.replace(/\\/g, '\\\\') //escape backslashes - .replace(/'/g, '\\\'') //escape single quotes - .replace(/"/g, '\\"') //escape double quotes - .replace(/\./g, '\\.') //escape periods - .replace(/\[/g, '\\[') //escape left square brackets - .replace(/\]/g, '\\]') //escape right square brackets - ; -} -function exprSafeFieldName(field) { - //remove whitespace, period, accessors and logical modifiers - return field.replace(/[.,:;+=\-/<>{}|~!@#$%^*[\]`'"()?\s\\]/g, ''); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9zG5R":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultZProportion", ()=>defaultZProportion); -parcelHelpers.export(exports, "textSignals", ()=>textSignals); -parcelHelpers.export(exports, "colorBinCountSignal", ()=>colorBinCountSignal); -parcelHelpers.export(exports, "colorReverseSignal", ()=>colorReverseSignal); -parcelHelpers.export(exports, "modifySignal", ()=>modifySignal); -var _constants = require("./constants"); -var _defaults = require("./defaults"); -const defaultZProportion = 0.6; -function textSignals(context, heightSignal) { - const { specViewOptions } = context; + return scale2; + } + function binnableColorScale(scaleName, colorBin, data2, field2, scheme2) { + scheme2 = scheme2 || ColorScaleNone; + const domain2 = { + data: data2, + field: safeFieldName(field2) + }; + const range2 = { + scheme: scheme2 + }; + const reverse2 = { signal: SignalNames.ColorReverse }; + if (colorBin !== "continuous") { + range2.count = { signal: SignalNames.ColorBinCount }; + } + switch (colorBin) { + case "continuous": { + const sequentialScale = { + name: scaleName, + type: "linear", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return sequentialScale; + } + case "quantile": { + const quantileScale = { + name: scaleName, + type: "quantile", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return quantileScale; + } + default: { + const quantizeScale = { + name: scaleName, + type: "quantize", + domain: domain2, + range: range2, + reverse: reverse2 + }; + return quantizeScale; + } + } + } + const defaultZProportion = 0.6; + function textSignals(context2, heightSignal) { + const { specViewOptions } = context2; const signals = [ - { - name: (0, _constants.SignalNames).ZProportion, - value: defaultZProportion, - bind: { - name: specViewOptions.language.zScaleProportion, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.1, - max: 2, - step: 0.1 - } - }, - { - name: (0, _constants.SignalNames).ZHeight, - update: `${heightSignal} * ${(0, _constants.SignalNames).ZProportion}` - }, - { - name: (0, _constants.SignalNames).TextScale, - value: 1.2, - bind: { - name: specViewOptions.language.textScaleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.5, - max: 2, - step: 0.1 - } - }, - { - name: (0, _constants.SignalNames).TextSize, - update: `${(0, _constants.SignalNames).TextScale} * 10` - }, - { - name: (0, _constants.SignalNames).TextTitleSize, - update: `${(0, _constants.SignalNames).TextScale} * 15` - }, - { - name: (0, _constants.SignalNames).TextAngleX, - value: 30, - bind: { - name: specViewOptions.language.xAxisTextAngleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0, - max: 90, - step: 1 - } - }, - { - name: (0, _constants.SignalNames).TextAngleY, - value: 0, - bind: { - name: specViewOptions.language.yAxisTextAngleSignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: -90, - max: 0, - step: 1 - } - }, - { - name: (0, _constants.SignalNames).MarkOpacity, - value: 1, - bind: { - name: specViewOptions.language.markOpacitySignal, - debounce: (0, _defaults.debounce), - input: 'range', - min: 0.1, - max: 1, - step: 0.05 - } + { + name: SignalNames.ZProportion, + value: defaultZProportion, + bind: { + name: specViewOptions.language.zScaleProportion, + debounce, + input: "range", + min: 0.1, + max: 2, + step: 0.1 + } + }, + { + name: SignalNames.ZHeight, + update: `${heightSignal} * ${SignalNames.ZProportion}` + }, + { + name: SignalNames.TextScale, + value: 1.2, + bind: { + name: specViewOptions.language.textScaleSignal, + debounce, + input: "range", + min: 0.5, + max: 2, + step: 0.1 + } + }, + { + name: SignalNames.TextSize, + update: `${SignalNames.TextScale} * 10` + }, + { + name: SignalNames.TextTitleSize, + update: `${SignalNames.TextScale} * 15` + }, + { + name: SignalNames.TextAngleX, + value: 30, + bind: { + name: specViewOptions.language.xAxisTextAngleSignal, + debounce, + input: "range", + min: 0, + max: 90, + step: 1 + } + }, + { + name: SignalNames.TextAngleY, + value: 0, + bind: { + name: specViewOptions.language.yAxisTextAngleSignal, + debounce, + input: "range", + min: -90, + max: 0, + step: 1 } + }, + { + name: SignalNames.MarkOpacity, + value: 1, + bind: { + name: specViewOptions.language.markOpacitySignal, + debounce, + input: "range", + min: 0.1, + max: 1, + step: 0.05 + } + } ]; return signals; -} -function colorBinCountSignal(context) { - const { specViewOptions } = context; + } + function colorBinCountSignal(context2) { + const { specViewOptions } = context2; const signal = { - name: (0, _constants.SignalNames).ColorBinCount, - value: 7, - bind: { - name: specViewOptions.language.colorBinCount, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: specViewOptions.maxLegends + 1, - step: 1 - } + name: SignalNames.ColorBinCount, + value: 7, + bind: { + name: specViewOptions.language.colorBinCount, + debounce, + input: "range", + min: 1, + max: specViewOptions.maxLegends + 1, + step: 1 + } }; return signal; -} -function colorReverseSignal(context) { - const { specViewOptions } = context; + } + function colorReverseSignal(context2) { + const { specViewOptions } = context2; const signal = { - name: (0, _constants.SignalNames).ColorReverse, - value: false, - bind: { - name: specViewOptions.language.colorReverse, - input: 'checkbox' - } + name: SignalNames.ColorReverse, + value: false, + bind: { + name: specViewOptions.language.colorReverse, + input: "checkbox" + } }; return signal; -} -function modifySignal(s, fn, update) { - s.update = `${fn}((${s.update}), (${update}))`; -} - -},{"./constants":"8P82N","./defaults":"8thYZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6gOcN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getLegends", ()=>getLegends); -function legend(column, fill) { - const legend = { - orient: 'none', - title: column.name, - fill, - encode: { - symbols: { - update: { - shape: { - value: 'square' - } - } - } + } + function modifySignal(s, fn2, update2) { + s.update = `${fn2}((${s.update}), (${update2}))`; + } + function legend(column, fill2) { + const legend2 = { + orient: "none", + title: column.name, + fill: fill2, + encode: { + symbols: { + update: { + shape: { + value: "square" + } + } } + } }; if (column.quantitative) { - legend.type = 'symbol'; - legend.format = '~r'; - } - return legend; -} -function getLegends(context, fill) { - const { specColumns, insight } = context; - if (specColumns.color && !insight.hideLegend && !insight.directColor && !specColumns.color.isColorData) return [ - legend(specColumns.color, fill) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dPeEK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "topLookup", ()=>topLookup); -var _constants = require("./constants"); -var _expr = require("./expr"); -function topLookup(column, count, source, legend, lookupName, fieldName, indexName) { - const data = [ - { - name: lookupName, - source, - transform: [ - { - type: 'aggregate', - groupby: [ - (0, _expr.safeFieldName)(column.name) - ] - }, - { - type: 'window', - ops: [ - 'count' - ], - as: [ - indexName - ] - }, - { - type: 'filter', - expr: `datum[${JSON.stringify(indexName)}] <= ${count}` - } - ] - }, - { - name: legend, - source, - transform: [ - { - type: 'lookup', - from: lookupName, - key: (0, _expr.safeFieldName)(column.name), - fields: [ - column.name - ].map((0, _expr.safeFieldName)), - values: [ - column.name - ].map((0, _expr.safeFieldName)), - as: [ - fieldName - ] - }, - { - type: 'formula', - expr: `datum[${JSON.stringify(fieldName)}] == null ? '${(0, _constants.Other)}' : datum[${JSON.stringify(fieldName)}]`, - as: fieldName - } - ] - } + legend2.type = "symbol"; + legend2.format = "~r"; + } + return legend2; + } + function getLegends(context2, fill2) { + const { specColumns, insight: insight2 } = context2; + if (specColumns.color && !insight2.hideLegend && !insight2.directColor && !specColumns.color.isColorData) { + return [legend(specColumns.color, fill2)]; + } + } + function topLookup(column, count2, source2, legend2, lookupName, fieldName, indexName) { + const data2 = [ + { + name: lookupName, + source: source2, + transform: [ + { + type: "aggregate", + groupby: [safeFieldName(column.name)] + }, + { + type: "window", + ops: ["count"], + as: [indexName] + }, + { + type: "filter", + expr: `datum[${JSON.stringify(indexName)}] <= ${count2}` + } + ] + }, + { + name: legend2, + source: source2, + transform: [ + { + type: "lookup", + from: lookupName, + key: safeFieldName(column.name), + fields: [column.name].map(safeFieldName), + values: [column.name].map(safeFieldName), + as: [fieldName] + }, + { + type: "formula", + expr: `datum[${JSON.stringify(fieldName)}] == null ? '${Other}' : datum[${JSON.stringify(fieldName)}]`, + as: fieldName + } + ] + } ]; - return data; -} - -},{"./constants":"8P82N","./expr":"xWMIR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4A66v":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addFacetColRowTitles", ()=>addFacetColRowTitles); -parcelHelpers.export(exports, "addFacetCellTitles", ()=>addFacetCellTitles); -parcelHelpers.export(exports, "addFacetAxesGroupMarks", ()=>addFacetAxesGroupMarks); -parcelHelpers.export(exports, "facetRowHeaderFooter", ()=>facetRowHeaderFooter); -parcelHelpers.export(exports, "facetColumnHeaderFooter", ()=>facetColumnHeaderFooter); -var _scope = require("./scope"); -var _constants = require("./constants"); -function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { - const titleSignal = `parent[${JSON.stringify((0, _constants.FieldNames).FacetTitle)}]`; - const index = `datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1`; - const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index); - const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index); - (0, _scope.addMarks)(globalScope, col.header, row.footer); - (0, _scope.addMarks)(col.header, { - type: 'text', - encode: { - enter: { - align: { - value: 'center' - }, - baseline: { - value: 'middle' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - x: { - signal: `${sizeSignals.layoutWidth} / 2` - }, - limit: { - signal: sizeSignals.layoutWidth - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - text: { - signal: titleSignal - } - } + return data2; + } + function addColor(props) { + const { colorReverseSignalName, dataName, scope, legendDataName, scaleName, specContext, topLookupName } = props; + let colorDataName = dataName; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const legends = getLegends(specContext, scaleName); + if (legends) { + scope.legends = legends; + } + const categoricalColor = specColumns.color && !specColumns.color.quantitative; + if (categoricalColor) { + addData(scope, ...topLookup(specColumns.color, specViewOptions.maxLegends, dataName, legendDataName, topLookupName, FieldNames.TopColor, FieldNames.TopIndex)); + colorDataName = legendDataName; + } + if (specColumns.color && !specColumns.color.isColorData && !insight2.directColor) { + if (specColumns.color.quantitative) { + addScales(scope, binnableColorScale(scaleName, insight2.colorBin, dataName, specColumns.color.name, insight2.scheme)); + } else { + addScales(scope, { + name: scaleName, + type: "ordinal", + domain: { + data: colorDataName, + field: FieldNames.TopColor, + sort: true + }, + range: { + scheme: insight2.scheme || ColorScaleNone + }, + reverse: { signal: colorReverseSignalName } + }); + } + } + addSignals(scope, colorBinCountSignal(specContext), colorReverseSignal(specContext)); + return { topColorField: FieldNames.TopColor, colorDataName }; + } + function addFacetColRowTitles(globalScope, colTitleSource, rowTitleSource, sizeSignals, axisTextColor) { + const titleSignal = `parent[${JSON.stringify(FieldNames.FacetTitle)}]`; + const index2 = `datum[${JSON.stringify(FieldNames.Ordinal)}] - 1`; + const col = facetColumnHeaderFooter(colTitleSource.dataName, sizeSignals, index2); + const row = facetRowHeaderFooter(rowTitleSource.dataName, sizeSignals, index2); + addMarks(globalScope, col.header, row.footer); + addMarks(col.header, { + type: "text", + encode: { + enter: { + align: { + value: "center" + }, + baseline: { + value: "middle" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + x: { + signal: `${sizeSignals.layoutWidth} / 2` + }, + limit: { + signal: sizeSignals.layoutWidth + }, + fontSize: { + signal: SignalNames.TextSize + }, + text: { + signal: titleSignal + } } + } }); - (0, _scope.addMarks)(row.footer, { - type: 'text', - encode: { - enter: { - align: { - value: 'left' - }, - baseline: { - value: 'middle' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - y: { - signal: `${sizeSignals.layoutHeight} / 2` - }, - limit: { - signal: (0, _constants.SignalNames).PlotOffsetRight - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - text: { - signal: titleSignal - } - } + addMarks(row.footer, { + type: "text", + encode: { + enter: { + align: { + value: "left" + }, + baseline: { + value: "middle" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + y: { + signal: `${sizeSignals.layoutHeight} / 2` + }, + limit: { + signal: SignalNames.PlotOffsetRight + }, + fontSize: { + signal: SignalNames.TextSize + }, + text: { + signal: titleSignal + } } + } }); -} -function addFacetCellTitles(scope, sizeSignals, axisTextColor) { - (0, _scope.addMarks)(scope, { - type: 'text', - encode: { - enter: { - align: { - value: 'center' - }, - baseline: { - value: 'bottom' - }, - fill: { - value: axisTextColor - } - }, - update: { - metaData: { - signal: `{search: parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}]}` - }, - x: { - signal: `(${sizeSignals.layoutWidth}) / 2` - }, - text: { - signal: `parent[${JSON.stringify((0, _constants.FieldNames).FacetTitle)}]` - }, - fontSize: { - signal: (0, _constants.SignalNames).TextSize - }, - limit: { - signal: sizeSignals.layoutWidth - }, - y: { - signal: `-${(0, _constants.SignalNames).FacetPaddingTop} / 2` - } - } + } + function addFacetCellTitles(scope, sizeSignals, axisTextColor) { + addMarks(scope, { + type: "text", + encode: { + enter: { + align: { + value: "center" + }, + baseline: { + value: "bottom" + }, + fill: { + value: axisTextColor + } + }, + update: { + metaData: { + signal: `{search: parent[${JSON.stringify(FieldNames.FacetSearch)}]}` + }, + x: { + signal: `(${sizeSignals.layoutWidth}) / 2` + }, + text: { + signal: `parent[${JSON.stringify(FieldNames.FacetTitle)}]` + }, + fontSize: { + signal: SignalNames.TextSize + }, + limit: { + signal: sizeSignals.layoutWidth + }, + y: { + signal: `-${SignalNames.FacetPaddingTop} / 2` + } } + } }); -} -function addFacetAxesGroupMarks(props) { + } + function addFacetAxesGroupMarks(props) { const { colSeqName, colTitleScale, globalScope, facetScope, plotScope, rowSeqName, rowTitleScale } = props; const { sizeSignals } = facetScope; const colSequence = createSequence(colSeqName, sizeSignals.colCount); const rowSequence = createSequence(rowSeqName, sizeSignals.rowCount); - const index = 'datum.data'; - const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index); - const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index); - (0, _scope.addData)(globalScope, colSequence, rowSequence); - (0, _scope.addMarks)(globalScope, col.footer, row.header); - (0, _scope.addScales)(globalScope, colTitleScale, rowTitleScale); - const map = { - main: [ - { - scope: facetScope.facetScope, - lines: true, - labels: false, - title: false - } - ], - x: [ - { - scope: col.footer, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: colTitleScale, - lines: false, - labels: false, - title: true - } - ], - y: [ - { - scope: row.header, - lines: true, - labels: true, - title: false - }, - { - scope: plotScope, - scale: rowTitleScale, - lines: false, - labels: false, - title: true - } - ] + const index2 = "datum.data"; + const col = facetColumnHeaderFooter(colSeqName, sizeSignals, index2); + const row = facetRowHeaderFooter(rowSeqName, sizeSignals, index2); + addData(globalScope, colSequence, rowSequence); + addMarks(globalScope, col.footer, row.header); + addScales(globalScope, colTitleScale, rowTitleScale); + const map2 = { + main: [ + { + scope: facetScope.facetScope, + lines: true, + labels: false, + title: false + } + ], + x: [ + { + scope: col.footer, + lines: true, + labels: true, + title: false + }, + { + scope: plotScope, + scale: colTitleScale, + lines: false, + labels: false, + title: true + } + ], + y: [ + { + scope: row.header, + lines: true, + labels: true, + title: false + }, + { + scope: plotScope, + scale: rowTitleScale, + lines: false, + labels: false, + title: true + } + ] }; - return map; -} -function facetRowHeaderFooter(data, sizeSignals, index) { - const rowFn = (xSignal)=>{ - return { - type: 'group', - from: { - data + return map2; + } + function facetRowHeaderFooter(data2, sizeSignals, index2) { + const rowFn = (xSignal) => { + return { + type: "group", + from: { data: data2 }, + encode: { + update: { + x: { signal: xSignal }, + y: { + signal: `${SignalNames.PlotOffsetTop} + ${SignalNames.FacetPaddingTop} + (${index2}) * (${sizeSignals.layoutHeight} + ${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})` }, - encode: { - update: { - x: { - signal: xSignal - }, - y: { - signal: `${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).FacetPaddingTop} + (${index}) * (${sizeSignals.layoutHeight} + ${(0, _constants.SignalNames).FacetPaddingTop} + ${(0, _constants.SignalNames).FacetPaddingBottom})` - }, - height: { - signal: sizeSignals.layoutHeight - } - } - } - }; - }; - const header = rowFn((0, _constants.SignalNames).PlotOffsetLeft); - const footer = rowFn(`${(0, _constants.SignalNames).PlotOffsetLeft} + ${(0, _constants.SignalNames).PlotWidthOut} + ${(0, _constants.SignalNames).PlotOffsetRight} / 2`); - return { - header, - footer + height: { signal: sizeSignals.layoutHeight } + } + } + }; }; -} -function facetColumnHeaderFooter(data, sizeSignals, index) { - const colFn = (ySignal)=>{ - return { - type: 'group', - from: { - data + const header = rowFn(SignalNames.PlotOffsetLeft); + const footer = rowFn(`${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetRight} / 2`); + return { header, footer }; + } + function facetColumnHeaderFooter(data2, sizeSignals, index2) { + const colFn = (ySignal) => { + return { + type: "group", + from: { data: data2 }, + encode: { + update: { + x: { + signal: `(${index2}) * (${sizeSignals.layoutWidth} + ${SignalNames.FacetPaddingLeft}) + ${SignalNames.FacetPaddingLeft} + ${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, - encode: { - update: { - x: { - signal: `(${index}) * (${sizeSignals.layoutWidth} + ${(0, _constants.SignalNames).FacetPaddingLeft}) + ${(0, _constants.SignalNames).FacetPaddingLeft} + ${(0, _constants.SignalNames).PlotOffsetLeft} - ${(0, _constants.SignalNames).FacetAxesAdjustX}` - }, - y: { - signal: `${ySignal} - ${(0, _constants.SignalNames).FacetAxesAdjustY}` - }, - width: { - signal: sizeSignals.layoutWidth - } - } - } - }; - }; - //create group marks based on data sequences - const header = colFn(`${(0, _constants.SignalNames).PlotOffsetTop} / 2`); - const footer = colFn(`${(0, _constants.SignalNames).PlotOffsetTop} + ${(0, _constants.SignalNames).PlotHeightOut}`); - return { - header, - footer + y: { signal: `${ySignal} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: sizeSignals.layoutWidth } + } + } + }; }; -} -function createSequence(dataName, countSignal) { + const header = colFn(`${SignalNames.PlotOffsetTop} / 2`); + const footer = colFn(`${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut}`); + return { header, footer }; + } + function createSequence(dataName, countSignal) { return { - name: dataName, - transform: [ - { - type: 'sequence', - start: 0, - stop: { - signal: countSignal - } - } - ] + name: dataName, + transform: [ + { + type: "sequence", + start: 0, + stop: { + signal: countSignal + } + } + ] }; -} - -},{"./scope":"9Kdkb","./constants":"8P82N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kzMLL":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fill", ()=>fill); -parcelHelpers.export(exports, "opacity", ()=>opacity); -var _constants = require("./constants"); -var _expr = require("./expr"); -function fill(context, colorFieldName, scale) { - const { specColumns, insight, specViewOptions } = context; + } + function fill(context2, colorFieldName, scale2) { + const { specColumns, insight: insight2, specViewOptions } = context2; const colorColumn = specColumns.color; - return colorColumn ? colorColumn.isColorData || insight.directColor ? { - field: (0, _expr.safeFieldName)(colorColumn.name) + return colorColumn ? colorColumn.isColorData || insight2.directColor ? { + field: safeFieldName(colorColumn.name) } : { - scale, - field: colorColumn.quantitative ? (0, _expr.safeFieldName)(colorColumn.name) : colorFieldName + scale: scale2, + field: colorColumn.quantitative ? safeFieldName(colorColumn.name) : colorFieldName } : { - value: specViewOptions.colors.defaultCube + value: specViewOptions.colors.defaultCube }; -} -function opacity(context) { + } + function opacity(context2) { const result = { - signal: (0, _constants.SignalNames).MarkOpacity + signal: SignalNames.MarkOpacity }; return result; -} - -},{"./constants":"8P82N","./expr":"xWMIR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eSDVh":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GlobalScope", ()=>GlobalScope); -var _constants = require("./constants"); -var _scope = require("./scope"); -class GlobalScope { - constructor(props){ - const { dataName, markGroup, scope, signals } = props; - this.scope = scope; - this._markGroup = markGroup; - this.signals = signals; - this.data = (0, _scope.getDataByName)(scope.data, dataName).data; - this._markDataName = dataName; - this.offsets = { - x: '0', - y: '0', - h: (0, _constants.SignalNames).PlotHeightIn, - w: (0, _constants.SignalNames).PlotWidthIn - }; - this.sizeSignals = { - layoutHeight: (0, _constants.SignalNames).PlotHeightIn, - layoutWidth: (0, _constants.SignalNames).PlotWidthIn - }; - this.zSize = (0, _constants.SignalNames).PlotHeightIn; + } + class GlobalScope { + constructor(props) { + const { dataName, markGroup, scope, signals } = props; + this.scope = scope; + this._markGroup = markGroup; + this.signals = signals; + this.data = getDataByName(scope.data, dataName).data; + this._markDataName = dataName; + this.offsets = { + x: "0", + y: "0", + h: SignalNames.PlotHeightIn, + w: SignalNames.PlotWidthIn + }; + this.sizeSignals = { + layoutHeight: SignalNames.PlotHeightIn, + layoutWidth: SignalNames.PlotWidthIn + }; + this.zSize = SignalNames.PlotHeightIn; } get markDataName() { - return this._markDataName; + return this._markDataName; } setMarkDataName(markDataName) { - this._markDataName = markDataName; + this._markDataName = markDataName; } get markGroup() { - return this._markGroup; + return this._markGroup; } setMarkGroup(markGroup) { - this._markGroup = markGroup; - } -} - -},{"./constants":"8P82N","./scope":"9Kdkb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4OSVM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "layoutClasses", ()=>layoutClasses); -var _aggregateContainer = require("./aggregateContainer"); -var _aggregateSquare = require("./aggregateSquare"); -var _band = require("./band"); -var _cross = require("./cross"); -var _scatter = require("./scatter"); -var _square = require("./square"); -var _stack = require("./stack"); -var _strip = require("./strip"); -var _treemap = require("./treemap"); -var _wrap = require("./wrap"); -const layoutClasses = { - AggregateContainer: (0, _aggregateContainer.AggregateContainer), - AggregateSquare: (0, _aggregateSquare.AggregateSquare), - Band: (0, _band.Band), - Cross: (0, _cross.Cross), - Scatter: (0, _scatter.Scatter), - Square: (0, _square.Square), - Stack: (0, _stack.Stack), - Strip: (0, _strip.Strip), - Treemap: (0, _treemap.Treemap), - Wrap: (0, _wrap.Wrap) -}; - -},{"./aggregateContainer":"8Yu0M","./aggregateSquare":"kJF3u","./band":"6oniE","./cross":"hh3d5","./scatter":"hte1S","./square":"fGQ0R","./stack":"jCLht","./strip":"cbfP5","./treemap":"gPQ1J","./wrap":"3WV33","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Yu0M":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AggregateContainer", ()=>AggregateContainer); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class AggregateContainer extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const a = this.aggregation = this.getAggregation(); - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a}_extent`, - scale: `scale_${p}`, - extentData: `data_${p}_extent`, - offsets: `data_${p}_offsets` - }; - } - getAggregateSumOp() { - if (this.aggregation === 'sum') { - const fieldOp = { - field: (0, _expr.safeFieldName)(this.props.sumBy.name), - op: 'sum', - as: (0, _constants.FieldNames).Sum - }; - return fieldOp; - } - } - build() { - const { aggregation, names, props } = this; - const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; - (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), { - as: [ - names.aggregateField - ] - }), { - type: 'extent', - field: (0, _expr.safeFieldName)(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - (0, _scope.addSignals)(globalScope.scope, { - name: props.globalAggregateMaxExtentSignal, - update: `${names.globalAggregateExtentSignal}[1]` - }); - const horizontal = dock === 'left'; - const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; - const offsets = { - x: parentScope.offsets.x, - y: (0, _scope.addOffsets)(parentScope.offsets.y, dock === 'bottom' ? groupScaled : ''), - h: horizontal ? parentScope.offsets.h : dock === 'top' ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, - w: horizontal ? groupScaled : parentScope.offsets.w - }; - const scale = { - type: 'linear', - name: names.scale, - domain: [ - 0, - { - signal: props.globalAggregateMaxExtentSignal - } - ], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ], - nice: niceScale, - zero: true, - reverse: dock === 'top' - }; - const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; - (0, _scope.addSignals)(globalScope.scope, { - name: props.globalAggregateMaxExtentScaledSignal, - update: dock === 'bottom' ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue - }); - return { - offsets, - sizeSignals: horizontal ? { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: null - } : { - layoutHeight: null, - layoutWidth: parentScope.sizeSignals.layoutWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? [ - scale - ] : undefined, - y: horizontal ? undefined : [ - scale - ] - } - }, - encodingRuleMap: horizontal ? { - x: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.x - } - ], - width: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } : { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: dock === 'top' ? parentScope.offsets.y : (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.offsets.h) - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: 'joinaggregate', - groupby: groupby.map((0, _expr.safeFieldName)), - ops: [ - aggregation - ] - }; - if (aggregation === 'sum') trans.fields = [ - this.props.sumBy.name - ].map((0, _expr.safeFieldName)); - return trans; - } - getAggregation() { - const { props } = this; - let s; - if (props.dock === 'left') s = props.axesScales.x; - else s = props.axesScales.y; - switch(s.aggregate){ - case 'sum': - return 'sum'; - default: - return 'count'; - } - } -} - -},{"./layout":"3cZzz","../constants":"8P82N","../expr":"xWMIR","../scope":"9Kdkb","../selection":"S5407","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3cZzz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Layout", ()=>Layout); -class Layout { - constructor(props){ - this.props = props; - this.id = props.id; - } - getGrouping() { - return null; - } - getAggregateSumOp() { - return null; - } - build() { - throw 'Not implemented'; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"S5407":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "testForCollapseSelection", ()=>testForCollapseSelection); -var _constants = require("./constants"); -function testForCollapseSelection() { - return `datum.${(0, _constants.FieldNames).Collapsed}`; -} - -},{"./constants":"8P82N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kJF3u":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AggregateSquare", ()=>AggregateSquare); -var _layout = require("./layout"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class AggregateSquare extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const a = this.props.aggregation; - const p = this.prefix = `agg_${this.id}`; - this.names = { - barCount: `${p}_count`, - aggregateField: `${p}_aggregate_value`, - globalAggregateExtentSignal: `${p}_${a}_extent`, - extentData: `data_${p}_extent` - }; - } - build() { - const { names, props } = this; - const { aggregation, globalScope, groupings, onBuild, parentScope } = props; - const { sizeSignals } = parentScope; - (0, _scope.addTransforms)(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, (0, _scope.getGroupBy)(groupings))), { - as: [ - names.aggregateField - ] - }), { - type: 'extent', - field: (0, _expr.safeFieldName)(names.aggregateField), - signal: names.globalAggregateExtentSignal - }); - const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; - const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; - const squareMaxArea = `(${[ - squareMaxSide, - squareMaxSide - ].join(' * ')})`; - const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; - const squareArea = `(${[ - squareMaxArea, - shrinkRatio - ].join(' * ')})`; - const squareSide = `sqrt(${squareArea})`; - const localAggregateMaxExtentScaled = squareSide; - onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), - h: squareSide, - w: squareSide - }; - return { - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: offsets.y - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; - } - getTransforms(aggregation, groupby) { - const trans = { - type: 'joinaggregate', - groupby: groupby.map((0, _expr.safeFieldName)), - ops: [ - aggregation - ] - }; - if (aggregation === 'sum') trans.fields = [ - this.props.sumBy.name - ].map((0, _expr.safeFieldName)); - return trans; - } -} - -},{"./layout":"3cZzz","../expr":"xWMIR","../scope":"9Kdkb","../selection":"S5407","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6oniE":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bandScaleLinearSuffix", ()=>bandScaleLinearSuffix); -parcelHelpers.export(exports, "Band", ()=>Band); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _signals = require("../signals"); -var _scales = require("../scales"); -const bandScaleLinearSuffix = '_linear'; -class Band extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `band_${this.id}`; - this.names = { - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - bandWidth: `${p}_bandwidth`, - accumulative: `${p}_accumulative` - }; - this.bin = (0, _bin.binnable)(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); - } - getGrouping() { - return this.bin.fields; - } - build() { - const { bin, names, props } = this; - const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; - const binField = bin.fields[0]; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - } - //TODO don't add this, use existing dataset - (0, _scope.addData)(globalScope.scope, { - name: names.accumulative, - source: bin.fullScaleDataname, - transform: [ - { - type: 'aggregate', - groupby: this.getGrouping().map((0, _expr.safeFieldName)), - ops: [ - 'count' - ] - } - ] - }); - const horizontal = orientation === 'horizontal'; - const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; - (0, _signals.modifySignal)(minCellSignal, 'max', `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); - (0, _scope.addSignals)(globalScope.scope, { - name: names.bandWidth, - update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` - }); - const scale = this.getScale(bin, horizontal); - if (props.outerSignalExtents && bin.native === false) //add a linear scale for use by background image - (0, _scope.addScales)(globalScope.scope, (0, _scales.linearScale)(scale.name + bandScaleLinearSuffix, { - signal: bin.extentSignal - }, scale.range, scale.reverse, false, false)); - let encodingRuleMap; - if (!props.excludeEncodingRuleMap) encodingRuleMap = horizontal ? { - x: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.x - } - ], - width: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } : { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.offsets.h) - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - }; - return { - offsets: this.getOffset(horizontal, binField), - sizeSignals: horizontal ? { - layoutHeight: names.bandWidth, - layoutWidth: parentScope.sizeSignals.layoutWidth - } : { - layoutHeight: parentScope.sizeSignals.layoutHeight, - layoutWidth: names.bandWidth - }, - globalScales: { - showAxes, - scales: { - x: horizontal ? undefined : [ - scale - ], - y: horizontal ? [ - scale - ] : undefined - } - }, - encodingRuleMap - }; - } - getOffset(horizontal, binField) { - const { names, props } = this; - const { parentScope } = props; - return { - x: (0, _scope.addOffsets)(parentScope.offsets.x, horizontal ? '' : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ''), - h: horizontal ? names.bandWidth : parentScope.offsets.h, - w: horizontal ? parentScope.offsets.w : names.bandWidth - }; - } - getScale(bin, horizontal) { - const { names } = this; - const { parentScope } = this.props; - const binField = (0, _expr.safeFieldName)(bin.fields[0]); - let bandScale; - if (horizontal) bandScale = { - type: 'band', - name: names.yScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutHeight - } - ], - padding: 0.1, - domain: { - data: bin.domainDataName, - field: binField, - sort: true - }, - reverse: true - }; - else bandScale = { - type: 'band', - name: names.xScale, - range: [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ], - padding: 0.1, - domain: { - data: bin.domainDataName, - field: binField, - sort: true - } - }; - return bandScale; - } -} - -},{"./layout":"3cZzz","../bin":"dWsCV","../expr":"xWMIR","../scope":"9Kdkb","../selection":"S5407","../signals":"9zG5R","../scales":"8P0Pa","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dWsCV":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "binnable", ()=>binnable); -parcelHelpers.export(exports, "outerExtentSignal", ()=>outerExtentSignal); -parcelHelpers.export(exports, "shouldBeIntegralBinStep", ()=>shouldBeIntegralBinStep); -var _constants = require("./constants"); -var _expr = require("./expr"); -var _defaults = require("./defaults"); -var _transforms = require("./transforms"); -function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { - const { column, defaultBins, maxbins, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; - if (column.quantitative) { - const field = `${prefix}_bin_${(0, _expr.exprSafeFieldName)(column.name)}`; - const fieldEnd = `${field}_end`; - const binSignal = `${field}_bins`; - const dataExtentSignal = `${field}_bin_extent`; - const dataExtentSpanSignal = `${field}_bin_extent_span`; - const outerSignal = `${field}_outer_extent`; - domainDataName = `${field}_sequence`; //override the data name - const extentTransform = (0, _transforms.dataExtent)(column, dataExtentSignal); - let imageSignal; - if (outerSignalExtents) imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); - const maxbinsSignal = { - name: maxbinsSignalName, - value: defaultBins, - bind: { - name: maxbinsSignalDisplayName, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: maxbins, - step: 1 - } - }; - const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; - const binTransform = { - type: 'bin', - field: (0, _expr.safeFieldName)(column.name), - as: [ - field, - fieldEnd - ], - signal: binSignal, - extent: { - signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` - }, - minstep: shouldBeIntegralBinStep(column) ? 1 : 0, - maxbins: { - signal: maxbinsSignalName - } - }; - const dataSequence = { - name: domainDataName, - transform: [ - { - type: 'sequence', - start: { - signal: `${binSignal}.start` - }, - stop: { - signal: `${binSignal}.stop` - }, - step: { - signal: `${binSignal}.step` - } - }, - { - type: 'formula', - expr: 'datum.data', - as: field - }, - { - type: 'formula', - expr: `datum.data + ${binSignal}.step`, - as: fieldEnd - }, - { - type: 'window', - ops: [ - 'row_number' - ], - as: [ - (0, _constants.FieldNames).Ordinal - ] - }, - { - type: 'formula', - expr: `datum.data === ${binSignal}.start`, - as: (0, _constants.FieldNames).First - }, - { - type: 'formula', - expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, - as: (0, _constants.FieldNames).Last - }, - { - // when there is only one bin, use only first sequence element - type: 'filter', - expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify((0, _constants.FieldNames).First)}] : true` - } - ] - }; - const signals = [ - maxbinsSignal, - { - name: dataExtentSpanSignal, - update: `${extentSignal}[1] - ${extentSignal}[0]` - } - ]; - if (imageSignal) signals.push(imageSignal); - const augmentBinnable = { - discreteColumn, - native: false, - transforms: [ - extentTransform, - binTransform - ], - fields: [ - field, - fieldEnd - ], - binSignal, - extentSignal, - dataSequence, - domainDataName, - signals, - fullScaleDataname: dataSequence.name - }; - return augmentBinnable; - } else { - const nativeBinnable = { - discreteColumn, - native: true, - fields: [ - column.name - ], - domainDataName, - fullScaleDataname: domainDataName - }; - return nativeBinnable; + this._markGroup = markGroup; } -} -function outerExtentSignal(name, min, max, dataExtent) { - return { - name, - update: `[min(${min}, ${dataExtent}[0]), max(${max}, ${dataExtent}[1])]` - }; -} -function shouldBeIntegralBinStep(column) { - //prevent Vega from showing ".5" steps between integer scale values - return column.quantitative && column.type === 'integer' && column.stats.max - column.stats.min <= 7; -} - -},{"./constants":"8P82N","./expr":"xWMIR","./defaults":"8thYZ","./transforms":"lTOHZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lTOHZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dataExtent", ()=>dataExtent); -var _expr = require("./expr"); -function dataExtent(column, signal) { - return { - type: 'extent', - field: (0, _expr.safeFieldName)(column.name), - signal - }; -} - -},{"./expr":"xWMIR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hh3d5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cross", ()=>Cross); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _constants = require("../constants"); -var _facetSearch = require("../facetSearch"); -var _facetTitle = require("../facetTitle"); -var _ordinal = require("../ordinal"); -var _scope = require("../scope"); -var _signals = require("../signals"); -class Cross extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `cross_${this.id}`; - this.binX = (0, _bin.binnable)(`${p}_x`, props.globalScope.data.name, props.groupbyX); - this.binY = (0, _bin.binnable)(`${p}_y`, props.globalScope.data.name, props.groupbyY); - this.names = { - facetDataName: `data_${p}_facet`, - searchUnion: `data_${p}_search`, - dimScale: `scale_${p}`, - dimCount: `${p}_count`, - dimCategorical: `data_${p}_cat`, - dimCellSize: `${p}_cell_size`, - dimCellSizeCalc: `${p}_cell_calc` - }; + } + class Layout { + constructor(props) { + this.props = props; + this.id = props.id; } getGrouping() { - return this.binX.fields.concat(this.binY.fields); + return null; + } + getAggregateSumOp() { + return null; } build() { - const { binX, binY, names, prefix, props } = this; - const { axisTextColor, colRowTitles, globalScope, parentScope } = props; - const titles = { - x: { - dataName: null, - quantitative: null - }, - y: { - dataName: null, - quantitative: null - } - }; - const dx = { - dim: 'x', - bin: binX, - sortOrder: 'ascending', - size: parentScope.sizeSignals.layoutWidth, - layout: parentScope.sizeSignals.layoutWidth, - min: globalScope.signals.minCellWidth.name, - out: globalScope.signals.plotWidthOut, - offset: (0, _constants.SignalNames).FacetPaddingLeft, - padding: (0, _constants.SignalNames).FacetPaddingLeft, - dataOut: null, - scaleName: null, - position: null - }; - const dy = { - dim: 'y', - bin: binY, - sortOrder: 'ascending', - size: parentScope.sizeSignals.layoutHeight, - layout: parentScope.sizeSignals.layoutHeight, - min: globalScope.signals.minCellHeight.name, - out: globalScope.signals.plotHeightOut, - offset: (0, _constants.SignalNames).FacetPaddingTop, - padding: `(${(0, _constants.SignalNames).FacetPaddingTop} + ${(0, _constants.SignalNames).FacetPaddingBottom})`, - dataOut: null, - scaleName: null, - position: null - }; - const dimensions = [ - dx, - dy - ]; - dimensions.forEach((d)=>{ - const { bin, dim, padding, sortOrder } = d; - let data; - let dataName; - let countSignal; - let scale; - const titleSource = titles[dim]; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - (0, _scope.addTransforms)(bin.dataSequence, { - type: 'formula', - expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, - as: (0, _constants.FieldNames).Contains - }); - data = bin.dataSequence; - dataName = bin.dataSequence.name; - countSignal = `length(data(${JSON.stringify(dataName)}))`; - scale = (0, _ordinal.ordinalScale)(dataName, `${names.dimScale}_${dim}`, bin.fields); - titleSource.dataName = bin.dataSequence.name; - } else { - dataName = globalScope.markDataName; - const ord = (0, _ordinal.createOrdinals)(dataName, `${prefix}_${dim}`, bin.fields, sortOrder); - data = ord.data; - (0, _scope.addData)(globalScope.scope, ord.data); - countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; - scale = ord.scale; - titleSource.dataName = ord.data.name; - } - titleSource.quantitative = bin.discreteColumn.column.quantitative; - d.dataOut = data; - d.scaleName = scale.name; - (0, _scope.addTransforms)(data, { - type: 'formula', - expr: (0, _facetSearch.serializeAsVegaExpression)(bin, (0, _constants.FieldNames).First, (0, _constants.FieldNames).Last), - as: (0, _constants.FieldNames).FacetSearch - }, { - type: 'formula', - expr: (0, _facetSearch.displayBin)(bin), - as: (0, _constants.FieldNames).FacetTitle - }); - (0, _scope.addScales)(globalScope.scope, scale); - const count = `${names.dimCount}_${dim}`; - const calc = `${names.dimCellSizeCalc}_${dim}`; - const size = `${names.dimCellSize}_${dim}`; - (0, _scope.addSignals)(globalScope.scope, { - name: count, - update: countSignal - }); - (0, _scope.addSignals)(globalScope.scope, { - name: calc, - update: `${d.layout} / ${count}` - }, { - name: size, - update: `max(${d.min}, (${calc} - ${padding}))` - }); - (0, _signals.modifySignal)(d.out, 'max', `((${size} + ${padding}) * ${count})`); - d.position = this.dimensionOffset(d); - }); - const groupRow = { - type: 'group', - encode: { - update: { - y: { - signal: dy.position - } - } - }, - from: { - data: dy.dataOut.name - }, - data: [ - { - name: names.searchUnion, - source: dx.dataOut.name, - transform: [ - { - type: 'formula', - expr: `[datum[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}], merge(parent[${JSON.stringify((0, _constants.FieldNames).FacetSearch)}], { clause: '&&'})]`, - as: (0, _constants.FieldNames).FacetSearch - } - ] - } - ] - }; - const groupCol = { - style: 'cell', - name: prefix, - type: 'group', - encode: { - update: { - height: { - signal: `${names.dimCellSize}_y` - }, - width: { - signal: `${names.dimCellSize}_x` - }, - x: { - signal: dx.position - } - } - }, - from: { - data: names.searchUnion - } - }; - (0, _scope.addMarks)(globalScope.markGroup, groupRow); - (0, _scope.addMarks)(groupRow, groupCol); - const offsets = { - x: this.dimensionOffset(dx), - y: this.dimensionOffset(dy), - h: `${names.dimCellSize}_y`, - w: `${names.dimCellSize}_x` - }; - const sizeSignals = { - layoutHeight: `${names.dimCellSize}_y`, - layoutWidth: `${names.dimCellSize}_x`, - colCount: `${names.dimCount}_x`, - rowCount: `${names.dimCount}_y` - }; - if (colRowTitles) (0, _facetTitle.addFacetColRowTitles)(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); - return { - facetScope: groupCol, - offsets, - sizeSignals, - titles + throw "Not implemented"; + } + } + function testForCollapseSelection() { + return `datum.${FieldNames.Collapsed}`; + } + class AggregateContainer extends Layout { + constructor(props) { + super(props); + this.props = props; + const a2 = this.aggregation = this.getAggregation(); + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a2}_extent`, + scale: `scale_${p}`, + extentData: `data_${p}_extent`, + offsets: `data_${p}_offsets` + }; + } + getAggregateSumOp() { + if (this.aggregation === "sum") { + const fieldOp = { + field: safeFieldName(this.props.sumBy.name), + op: "sum", + as: FieldNames.Sum }; + return fieldOp; + } } - dimensionOffset(d) { - const { names } = this; - return `${d.offset} + (scale(${JSON.stringify(d.scaleName)}, datum[${JSON.stringify(d.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d.dim} + ${d.padding})`; - } -} - -},{"./layout":"3cZzz","../bin":"dWsCV","../constants":"8P82N","../facetSearch":"ekgr6","../facetTitle":"4A66v","../ordinal":"fMJz6","../scope":"9Kdkb","../signals":"9zG5R","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ekgr6":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "displayBin", ()=>displayBin); -parcelHelpers.export(exports, "serializeAsVegaExpression", ()=>serializeAsVegaExpression); -function displayBin(bin) { - const val = (index)=>`datum[${JSON.stringify(bin.fields[index])}]`; - return bin.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); -} -function obj(nameValues, clause) { - if (clause) nameValues = [ - clause, - ...nameValues - ]; - return `{${nameValues.join()}}`; -} -function serializeAsVegaExpression(bin, firstFieldName, lastFieldName, clause) { - if (bin.discreteColumn.column.quantitative) { - const low = [ - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'>=\'', - `value:datum[${JSON.stringify(bin.fields[0])}]` - ]; - const high = [ - 'clause:\'&&\'', - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'<\'', - `value:datum[${JSON.stringify(bin.fields[1])}]` - ]; - return obj([ - `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]` - ], clause); - } else { - const exact = [ - `name:${JSON.stringify(bin.discreteColumn.column.name)}`, - 'operator:\'==\'', - `value:datum[${JSON.stringify(bin.fields[0])}]` - ]; - return obj([ - `expressions:[${obj(exact)}]` - ], clause); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fMJz6":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createOrdinals", ()=>createOrdinals); -parcelHelpers.export(exports, "ordinalScale", ()=>ordinalScale); -var _constants = require("./constants"); -var _expr = require("./expr"); -function createOrdinals(source, prefix, binFields, sortOrder) { - const _binFields = binFields.map((0, _expr.safeFieldName)); - const dataName = `${prefix}_bin_order`; - const data = { - name: dataName, - source, + build() { + const { aggregation, names, props } = this; + const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentSignal, + update: `${names.globalAggregateExtentSignal}[1]` + }); + const horizontal = dock === "left"; + const groupScaled = `scale(${JSON.stringify(names.scale)}, datum[${JSON.stringify(names.aggregateField)}])`; + const offsets2 = { + x: parentScope.offsets.x, + y: addOffsets(parentScope.offsets.y, dock === "bottom" ? groupScaled : ""), + h: horizontal ? parentScope.offsets.h : dock === "top" ? groupScaled : `${parentScope.offsets.h} - ${groupScaled}`, + w: horizontal ? groupScaled : parentScope.offsets.w + }; + const scale2 = { + type: "linear", + name: names.scale, + domain: [ + 0, + { + signal: props.globalAggregateMaxExtentSignal + } + ], + range: horizontal ? [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ] : [ + { + signal: parentScope.sizeSignals.layoutHeight + }, + 0 + ], + nice: niceScale, + zero: true, + reverse: dock === "top" + }; + const globalAggregateMaxExtentScaledValue = `scale(${JSON.stringify(names.scale)}, ${props.globalAggregateMaxExtentSignal})`; + addSignals(globalScope.scope, { + name: props.globalAggregateMaxExtentScaledSignal, + update: dock === "bottom" ? `${parentScope.sizeSignals.layoutHeight} - ${globalAggregateMaxExtentScaledValue}` : globalAggregateMaxExtentScaledValue + }); + return { + offsets: offsets2, + sizeSignals: horizontal ? { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: null + } : { + layoutHeight: null, + layoutWidth: parentScope.sizeSignals.layoutWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? [scale2] : void 0, + y: horizontal ? void 0 : [scale2] + } + }, + encodingRuleMap: horizontal ? { + x: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.x + }], + width: [{ + test: testForCollapseSelection(), + value: 0 + }] + } : { + y: [{ + test: testForCollapseSelection(), + signal: dock === "top" ? parentScope.offsets.y : addOffsets(parentScope.offsets.y, parentScope.offsets.h) + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; + } + getAggregation() { + const { props } = this; + let s; + if (props.dock === "left") { + s = props.axesScales.x; + } else { + s = props.axesScales.y; + } + switch (s.aggregate) { + case "sum": + return "sum"; + default: + return "count"; + } + } + } + class AggregateSquare extends Layout { + constructor(props) { + super(props); + this.props = props; + const a2 = this.props.aggregation; + const p = this.prefix = `agg_${this.id}`; + this.names = { + barCount: `${p}_count`, + aggregateField: `${p}_aggregate_value`, + globalAggregateExtentSignal: `${p}_${a2}_extent`, + extentData: `data_${p}_extent` + }; + } + build() { + const { names, props } = this; + const { aggregation, globalScope, groupings, onBuild, parentScope } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, Object.assign(Object.assign({}, this.getTransforms(aggregation, getGroupBy(groupings))), { as: [names.aggregateField] }), { + type: "extent", + field: safeFieldName(names.aggregateField), + signal: names.globalAggregateExtentSignal + }); + const localAggregateMaxExtent = `datum[${JSON.stringify(names.aggregateField)}]`; + const squareMaxSide = `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))`; + const squareMaxArea = `(${[squareMaxSide, squareMaxSide].join(" * ")})`; + const shrinkRatio = `((${localAggregateMaxExtent}) / (${names.globalAggregateExtentSignal}[1]))`; + const squareArea = `(${[squareMaxArea, shrinkRatio].join(" * ")})`; + const squareSide = `sqrt(${squareArea})`; + const localAggregateMaxExtentScaled = squareSide; + onBuild && onBuild(localAggregateMaxExtent, localAggregateMaxExtentScaled); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, `(${parentScope.offsets.w} - ${squareSide}) / 2`), + y: addOffsets(parentScope.offsets.y, `(${parentScope.offsets.h} - ${squareSide}) / 2`), + h: squareSide, + w: squareSide + }; + return { + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: offsets2.y + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; + } + getTransforms(aggregation, groupby) { + const trans = { + type: "joinaggregate", + groupby: groupby.map(safeFieldName), + ops: [aggregation] + }; + if (aggregation === "sum") { + trans.fields = [this.props.sumBy.name].map(safeFieldName); + } + return trans; + } + } + function dataExtent(column, signal) { + return { + type: "extent", + field: safeFieldName(column.name), + signal + }; + } + function binnable(prefix, domainDataName, discreteColumn, outerSignalExtents) { + const { column, defaultBins: defaultBins2, maxbins: maxbins2, maxbinsSignalDisplayName, maxbinsSignalName } = discreteColumn; + if (column.quantitative) { + const field2 = `${prefix}_bin_${exprSafeFieldName(column.name)}`; + const fieldEnd = `${field2}_end`; + const binSignal = `${field2}_bins`; + const dataExtentSignal = `${field2}_bin_extent`; + const dataExtentSpanSignal = `${field2}_bin_extent_span`; + const outerSignal = `${field2}_outer_extent`; + domainDataName = `${field2}_sequence`; + const extentTransform = dataExtent(column, dataExtentSignal); + let imageSignal; + if (outerSignalExtents) { + imageSignal = outerExtentSignal(outerSignal, outerSignalExtents.min, outerSignalExtents.max, dataExtentSignal); + } + const maxbinsSignal = { + name: maxbinsSignalName, + value: defaultBins2, + bind: { + name: maxbinsSignalDisplayName, + debounce, + input: "range", + min: 1, + max: maxbins2, + step: 1 + } + }; + const extentSignal = (imageSignal === null || imageSignal === void 0 ? void 0 : imageSignal.name) || dataExtentSignal; + const binTransform = { + type: "bin", + field: safeFieldName(column.name), + as: [ + field2, + fieldEnd + ], + signal: binSignal, + extent: { + signal: `[${extentSignal}[0], ${extentSignal}[1] + 1e-11]` + //add a tiny bit to the upper extent to force the extra bin - https://github.com/vega/vega/issues/2899 + }, + minstep: shouldBeIntegralBinStep(column) ? 1 : 0, + maxbins: { + signal: maxbinsSignalName + } + }; + const dataSequence = { + name: domainDataName, transform: [ - { - type: 'aggregate', - groupby: _binFields + { + type: "sequence", + start: { + signal: `${binSignal}.start` }, - { - type: 'collect', - sort: { - field: _binFields, - order: _binFields.map((f)=>sortOrder) - } + stop: { + signal: `${binSignal}.stop` }, - { - type: 'window', - ops: [ - 'row_number' - ], - as: [ - (0, _constants.FieldNames).Ordinal - ] - } + step: { + signal: `${binSignal}.step` + } + }, + { + type: "formula", + expr: "datum.data", + as: field2 + }, + { + type: "formula", + expr: `datum.data + ${binSignal}.step`, + as: fieldEnd + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.start`, + as: FieldNames.First + }, + { + type: "formula", + expr: `datum.data === ${binSignal}.stop - ${binSignal}.step`, + as: FieldNames.Last + }, + { + // when there is only one bin, use only first sequence element + type: "filter", + expr: `${dataExtentSpanSignal} === 0 ? datum[${JSON.stringify(FieldNames.First)}] : true` + } ] - }; + }; + const signals = [ + maxbinsSignal, + { + name: dataExtentSpanSignal, + update: `${extentSignal}[1] - ${extentSignal}[0]` + } + ]; + if (imageSignal) { + signals.push(imageSignal); + } + const augmentBinnable = { + discreteColumn, + native: false, + transforms: [extentTransform, binTransform], + fields: [field2, fieldEnd], + binSignal, + extentSignal, + dataSequence, + domainDataName, + signals, + fullScaleDataname: dataSequence.name + }; + return augmentBinnable; + } else { + const nativeBinnable = { + discreteColumn, + native: true, + fields: [column.name], + domainDataName, + fullScaleDataname: domainDataName + }; + return nativeBinnable; + } + } + function outerExtentSignal(name, min2, max2, dataExtent2) { return { - data, - scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) + name, + update: `[min(${min2}, ${dataExtent2}[0]), max(${max2}, ${dataExtent2}[1])]` }; -} -function ordinalScale(dataName, scaleName, binFields) { - return { - type: 'ordinal', - name: scaleName, - domain: { - data: dataName, - field: (0, _expr.safeFieldName)(binFields[0]) - }, - range: { - data: dataName, - field: (0, _constants.FieldNames).Ordinal - } - }; -} - -},{"./constants":"8P82N","./expr":"xWMIR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hte1S":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scatter", ()=>Scatter); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _defaults = require("../defaults"); -var _expr = require("../expr"); -var _scales = require("../scales"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _transforms = require("../transforms"); -var _bin = require("../bin"); -class Scatter extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `scatter_${this.id}`; - this.names = { - aggregateData: `data_${p}_aggregate`, - markData: `data_${p}_mark`, - xDataExtent: `${p}_xDataExtent`, - yDataExtent: `${p}_yDataExtent`, - xExtent: `${p}_xExtent`, - yExtent: `${p}_yExtent`, - sizeExtent: `${p}_sizeExtent`, - sizeRange: `${p}_sizeRange`, - sizeScale: `${p}_sizeScale`, - xScale: `scale_${p}_x`, - yScale: `scale_${p}_y`, - zScale: `scale_${p}_z` - }; + } + function shouldBeIntegralBinStep(column) { + return column.quantitative && (column.type === "integer" && column.stats.max - column.stats.min <= 7); + } + const bandScaleLinearSuffix = "_linear"; + class Band extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `band_${this.id}`; + this.names = { + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + bandWidth: `${p}_bandwidth`, + accumulative: `${p}_accumulative` + }; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby, props.outerSignalExtents); + } + getGrouping() { + return this.bin.fields; } build() { - const { names, prefix, props } = this; - const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size, view, x, y, z, zGrounded } = props; - const qsize = size && size.quantitative && size; - (0, _scope.addSignals)(globalScope.scope, { - name: (0, _constants.SignalNames).PointScale, - value: 5, - bind: { - name: scatterPointScaleDisplay, - debounce: (0, _defaults.debounce), - input: 'range', - min: 1, - max: 10, - step: 0.1 - } - }, { - name: (0, _constants.SignalNames).ZGrounded, - value: false, - bind: { - name: zGrounded, - input: 'checkbox' - } - }); - if (backgroundImageExtents) { - (0, _scope.addTransforms)(globalScope.data, (0, _transforms.dataExtent)(x, names.xDataExtent), (0, _transforms.dataExtent)(y, names.yDataExtent)); - const xSignal = (0, _bin.outerExtentSignal)(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); - const ySignal = (0, _bin.outerExtentSignal)(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); - (0, _scope.addSignals)(globalScope.scope, xSignal, ySignal); - } - if (qsize) { - (0, _scope.addTransforms)(globalScope.data, { - type: 'extent', - field: (0, _expr.safeFieldName)(qsize.name), - signal: names.sizeExtent - }); - (0, _scope.addScales)(globalScope.scope, { - name: names.sizeScale, - type: 'pow', - exponent: 0.5, - domain: [ - 0, - { - signal: `${names.sizeExtent}[1]` - } - ], - range: [ - 0, - { - signal: names.sizeRange - } - ] - }); - (0, _scope.addSignals)(globalScope.scope, { - name: names.sizeRange, - update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${(0, _defaults.scatterSizedDiv)}` - }); - } - (0, _scope.addData)(globalScope.scope, { - name: names.markData, - source: globalScope.markDataName, - transform: [ - x, - y, - z - ].map((c)=>{ - if (!c || !c.quantitative) return; - const t = { - type: 'filter', - expr: `isValid(datum[${JSON.stringify(c.name)}])` - }; - return t; - }).filter(Boolean) - }); - globalScope.setMarkDataName(names.markData); - const globalScales = { - showAxes, - scales: {} - }; - const zValue = z ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z.name)}])` : null; - const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${(0, _constants.SignalNames).PointScale}` : (0, _constants.SignalNames).PointScale; - const update = Object.assign({ - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: sizeValueSignal - } - ], - width: { - signal: sizeValueSignal - } - }, z && { - z: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: `${(0, _constants.SignalNames).ZGrounded} ? 0 : ${zValue}` - } - ], - zindex: [ - { - signal: `${(0, _constants.SignalNames).ZGrounded} ? 0 : ${zValue}` - } - ], - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - { - signal: view === '3d' ? `${(0, _constants.SignalNames).ZGrounded} ? ${zValue} : ${sizeValueSignal}` : '0' - } - ] - }); - const columnSignals = [ - { - column: x, - xyz: 'x', - scaleName: names.xScale, - domain: backgroundImageExtents ? { - signal: names.xExtent - } : { - data: globalScope.data.name, - field: (0, _expr.safeFieldName)(x.name) - }, - reverse: false, - signal: parentScope.sizeSignals.layoutWidth - }, + const { bin: bin2, names, props } = this; + const { globalScope, minBandWidth, orientation, parentScope, showAxes } = props; + const binField = bin2.fields[0]; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + } + addData(globalScope.scope, { + name: names.accumulative, + source: bin2.fullScaleDataname, + transform: [ + { + type: "aggregate", + groupby: this.getGrouping().map(safeFieldName), + ops: ["count"] + } + ] + }); + const horizontal = orientation === "horizontal"; + const minCellSignal = horizontal ? globalScope.signals.minCellHeight : globalScope.signals.minCellWidth; + modifySignal(minCellSignal, "max", `length(data(${JSON.stringify(names.accumulative)})) * ${minBandWidth}`); + addSignals(globalScope.scope, { + name: names.bandWidth, + update: `bandwidth(${JSON.stringify(horizontal ? names.yScale : names.xScale)})` + }); + const scale2 = this.getScale(bin2, horizontal); + if (props.outerSignalExtents && bin2.native === false) { + addScales(globalScope.scope, linearScale(scale2.name + bandScaleLinearSuffix, { signal: bin2.extentSignal }, scale2.range, scale2.reverse, false, false)); + } + let encodingRuleMap; + if (!props.excludeEncodingRuleMap) { + encodingRuleMap = horizontal ? { + x: [ { - column: y, - xyz: 'y', - scaleName: names.yScale, - domain: backgroundImageExtents ? { - signal: names.yExtent - } : { - data: globalScope.data.name, - field: (0, _expr.safeFieldName)(y.name) - }, - reverse: true, - signal: parentScope.sizeSignals.layoutHeight - }, + test: testForCollapseSelection(), + signal: parentScope.offsets.x + } + ], + width: [ { - column: z, - xyz: 'z', - scaleName: names.zScale, - domain: { - data: globalScope.data.name, - field: z ? (0, _expr.safeFieldName)(z.name) : null - }, - reverse: false, - signal: view === '3d' ? `(${globalScope.zSize}) * ${(0, _constants.SignalNames).ZProportion}` : `10 * ${(0, _constants.SignalNames).ZProportion}` + test: testForCollapseSelection(), + value: 0 } - ]; - columnSignals.forEach((cs)=>{ - const { column, domain, reverse, scaleName, signal, xyz } = cs; - if (!column) return; - let scale; - if (column.quantitative) { - scale = (0, _scales.linearScale)(scaleName, domain, [ - 0, - { - signal - } - ], reverse, false, showAxes); - if ((0, _bin.shouldBeIntegralBinStep)(column)) scale.bins = { - step: 1 - }; - } else scale = (0, _scales.pointScale)(scaleName, globalScope.data.name, [ - 0, - { - signal - } - ], column.name, reverse); - globalScales.scales[xyz] = [ - scale - ]; - }); - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update + ] + } : { + y: [ + { + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.offsets.h) } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - return { - offsets: { - x: (0, _scope.addOffsets)(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x.name)}])`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y.name)}]) - ${sizeValueSignal}`), - h: sizeValueSignal, - w: sizeValueSignal - }, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - globalScales, - mark, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: (0, _scope.addOffsets)(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) - } - ] + ], + height: [ + { + test: testForCollapseSelection(), + value: 0 } + ] }; + } + return { + offsets: this.getOffset(horizontal, binField), + sizeSignals: horizontal ? { + layoutHeight: names.bandWidth, + layoutWidth: parentScope.sizeSignals.layoutWidth + } : { + layoutHeight: parentScope.sizeSignals.layoutHeight, + layoutWidth: names.bandWidth + }, + globalScales: { + showAxes, + scales: { + x: horizontal ? void 0 : [scale2], + y: horizontal ? [scale2] : void 0 + } + }, + encodingRuleMap + }; } -} - -},{"./layout":"3cZzz","../constants":"8P82N","../defaults":"8thYZ","../expr":"xWMIR","../scales":"8P0Pa","../scope":"9Kdkb","../selection":"S5407","../transforms":"lTOHZ","../bin":"dWsCV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fGQ0R":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Square", ()=>Square); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Square extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `square_${this.id}`; - this.names = { - bandWidth: this.getBandWidth(), - maxGroupField: `${p}_max_group`, - maxGroupSignal: `${p}_max_grouping`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - zScale: `scale_${p}_z` - }; - } - build() { - const { names, prefix, props } = this; - const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - (0, _scope.addTransforms)(globalScope.data, Object.assign({ - type: 'stack', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - as: [ - names.stack0, - names.stack1 - ] - }, sortBy && { - sort: { - field: (0, _expr.safeFieldName)(sortBy.name), - order: 'ascending' - } - })); - const { gap, levelSize, size, squaresPerBand } = this.addSignals(); - const heightSignal = { - signal: fillDirection === 'down-right' ? size : levelSize - }; - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update: Object.assign({ - height: collapseYHeight ? [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - heightSignal - ] : heightSignal, - width: { - signal: fillDirection === 'down-right' ? levelSize : size - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - const { tx, ty } = this.transformXY(gap, levelSize, squaresPerBand); - return Object.assign(Object.assign(Object.assign({}, z && { - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - } - }), { - offsets: { - x: (0, _scope.addOffsets)(parentScope.offsets.x, tx.expr), - y: (0, _scope.addOffsets)(parentScope.offsets.y, ty.expr), - h: size, - w: size - }, - mark, - sizeSignals: { - layoutHeight: size, - layoutWidth: size - } - }), collapseYHeight && { - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.y - } - ] + getOffset(horizontal, binField) { + const { names, props } = this; + const { parentScope } = props; + return { + x: addOffsets(parentScope.offsets.x, horizontal ? "" : `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(binField)}])`), + y: addOffsets(parentScope.offsets.y, horizontal ? `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(binField)}])` : ""), + h: horizontal ? names.bandWidth : parentScope.offsets.h, + w: horizontal ? parentScope.offsets.w : names.bandWidth + }; + } + getScale(bin2, horizontal) { + const { names } = this; + const { parentScope } = this.props; + const binField = safeFieldName(bin2.fields[0]); + let bandScale; + if (horizontal) { + bandScale = { + type: "band", + name: names.yScale, + range: [ + 0, + { + signal: parentScope.sizeSignals.layoutHeight } - }); - } - getBandWidth() { - const { offsets } = this.props.parentScope; - switch(this.props.fillDirection){ - case 'down-right': - return offsets.h; - default: - return offsets.w; - } - } - addSignals() { - const { names, props } = this; - const { fillDirection, globalScope, groupings, parentScope } = props; - let { maxGroupedFillSize, maxGroupedUnits } = props; - if (!maxGroupedUnits) { - if (groupings) { - (0, _scope.addTransforms)(globalScope.data, { - type: 'joinaggregate', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - ops: [ - 'count' - ], - as: [ - names.maxGroupField - ] - }, { - type: 'extent', - field: names.maxGroupField, - signal: names.maxGroupSignal - }); - maxGroupedUnits = `(${names.maxGroupSignal}[1])`; - } else maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; - } - if (!maxGroupedFillSize) maxGroupedFillSize = fillDirection === 'down-right' ? parentScope.offsets.w : parentScope.offsets.h; - const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; - const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; - const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; - const size = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; - const levels = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; - const levelSize = `(((${maxGroupedFillSize}) / ${levels}) - ${gap})`; - return { - gap, - levelSize, - size, - squaresPerBand - }; - } - transformXY(gap, levelSize, squaresPerBand) { - const { names, prefix } = this; - const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; - const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; - const { fillDirection, parentScope } = this.props; - const tx = { - type: 'formula', - expr: null, - as: `${prefix}_${(0, _constants.FieldNames).OffsetX}` - }; - const ty = { - type: 'formula', - expr: null, - as: `${prefix}_${(0, _constants.FieldNames).OffsetY}` - }; - switch(fillDirection){ - case 'down-right': - tx.expr = `${level} * (${levelSize} + ${gap})`; - ty.expr = compartment; - break; - case 'right-up': - tx.expr = compartment; - ty.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; - break; - case 'right-down': - default: - tx.expr = compartment; - ty.expr = `${level} * (${levelSize} + ${gap})`; - break; - } - return { - tx, - ty - }; - } -} - -},{"./layout":"3cZzz","../constants":"8P82N","../expr":"xWMIR","../scope":"9Kdkb","../selection":"S5407","../zBase":"584Nq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"584Nq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addZScale", ()=>addZScale); -var _constants = require("./constants"); -var _scales = require("./scales"); -var _expr = require("./expr"); -function addZScale(z, zSize, dataName, zScaleName) { - if (z) { - const zRange = [ + ], + padding: 0.1, + domain: { + data: bin2.domainDataName, + field: binField, + sort: true + }, + reverse: true + }; + } else { + bandScale = { + type: "band", + name: names.xScale, + range: [ 0, { - signal: `(${zSize}) * ${(0, _constants.SignalNames).ZProportion}` + signal: parentScope.sizeSignals.layoutWidth } - ]; - const scale = z.quantitative ? (0, _scales.linearScale)(zScaleName, { - data: dataName, - field: (0, _expr.safeFieldName)(z.name) - }, zRange, false, true) : (0, _scales.pointScale)(zScaleName, dataName, zRange, z.name, false); - return scale; - } -} - -},{"./constants":"8P82N","./scales":"8P0Pa","./expr":"xWMIR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jCLht":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Stack", ()=>Stack); -var _layout = require("./layout"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -class Stack extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `stack_${this.id}`; - this.names = { - cube: `${p}_cube`, - globalDataName: `data_${p}_count`, - globalExtent: `${p}_global_extent`, - levelDataName: `data_${p}_level`, - count: `${p}_count`, - stack0: `${p}_stack0`, - stack1: `${p}_stack1`, - sequence: `data_${p}_sequence`, - sides: `${p}_sides`, - size: `${p}_size`, - squared: `${p}_squared`, - maxCount: `${p}_maxCount`, - maxLevels: `${p}_maxLevels`, - zScale: `${p}_zScale` + ], + padding: 0.1, + domain: { + data: bin2.domainDataName, + field: binField, + sort: true + } }; + } + return bandScale; } - build() { - const { names, props } = this; - const { globalScope, groupings, parentScope, showAxes, sort } = props; - const { sizeSignals } = parentScope; - (0, _scope.addTransforms)(globalScope.data, { - type: 'joinaggregate', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - ops: [ - 'count' - ], - as: [ - names.count - ] - }, { - type: 'extent', - field: names.count, - signal: names.globalExtent - }, Object.assign({ - type: 'stack', - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)), - as: [ - names.stack0, - names.stack1 - ] - }, sort && { - sort: { - field: (0, _expr.safeFieldName)(sort.name), - order: 'ascending' - } - })); - (0, _scope.addData)(globalScope.scope, { - name: names.sequence, - transform: [ - { - type: 'sequence', - start: 1, - stop: { - signal: `sqrt(${names.globalExtent}[1])` - } - }, - { - type: 'formula', - expr: 'datum.data * datum.data', - as: 'squared' - }, - { - type: 'formula', - expr: `ceil(${names.globalExtent}[1] / datum.squared)`, - as: 'maxlevels' - }, - { - type: 'formula', - expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, - as: 'side' - }, - { - type: 'formula', - expr: 'datum.side * datum.maxlevels + datum.maxlevels - 1', - as: 'sidecubeheight' - }, - { - type: 'formula', - expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, - as: 'heightmatch' - }, - { - type: 'collect', - sort: { - field: 'heightmatch', - order: 'ascending' - } - }, - { - type: 'window', - ops: [ - 'row_number' - ] - }, - { - type: 'filter', - expr: 'datum.row_number === 1' - } - ] - }); - (0, _scope.addSignals)(globalScope.scope, { - name: names.size, - update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` - }, { - name: names.squared, - update: `data('${names.sequence}')[0].squared` - }, { - name: names.sides, - update: `sqrt(${names.squared})` - }, { - name: names.cube, - update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` + } + function displayBin(bin2) { + const val = (index2) => `datum[${JSON.stringify(bin2.fields[index2])}]`; + return bin2.discreteColumn.column.quantitative ? `format(${val(0)}, '~r') + ' - ' + format(${val(1)}, '~r')` : val(0); + } + function obj(nameValues, clause) { + return `{${nameValues.join()}}`; + } + function serializeAsVegaExpression(bin2, firstFieldName, lastFieldName, clause) { + if (bin2.discreteColumn.column.quantitative) { + const low = [ + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'>='", + `value:datum[${JSON.stringify(bin2.fields[0])}]` + ]; + const high = [ + "clause:'&&'", + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'<'", + `value:datum[${JSON.stringify(bin2.fields[1])}]` + ]; + return obj([ + `expressions:[ datum[${JSON.stringify(firstFieldName)}] ? null : ${obj(low)}, datum[${JSON.stringify(lastFieldName)}] ? null : ${obj(high)}]` + ]); + } else { + const exact = [ + `name:${JSON.stringify(bin2.discreteColumn.column.name)}`, + "operator:'=='", + `value:datum[${JSON.stringify(bin2.fields[0])}]` + ]; + return obj([ + `expressions:[${obj(exact)}]` + ]); + } + } + function createOrdinals(source2, prefix, binFields, sortOrder) { + const _binFields = binFields.map(safeFieldName); + const dataName = `${prefix}_bin_order`; + const data2 = { + name: dataName, + source: source2, + transform: [ + { + type: "aggregate", + groupby: _binFields + }, + { + type: "collect", + sort: { + field: _binFields, + order: _binFields.map((f) => sortOrder) + } + }, + { + type: "window", + ops: ["row_number"], + as: [FieldNames.Ordinal] + } + ] + }; + return { + data: data2, + scale: ordinalScale(dataName, `scale_${prefix}_order`, binFields) + }; + } + function ordinalScale(dataName, scaleName, binFields) { + return { + type: "ordinal", + name: scaleName, + domain: { + data: dataName, + field: safeFieldName(binFields[0]) + }, + range: { + data: dataName, + field: FieldNames.Ordinal + } + }; + } + class Cross extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `cross_${this.id}`; + this.binX = binnable(`${p}_x`, props.globalScope.data.name, props.groupbyX); + this.binY = binnable(`${p}_y`, props.globalScope.data.name, props.groupbyY); + this.names = { + facetDataName: `data_${p}_facet`, + searchUnion: `data_${p}_search`, + dimScale: `scale_${p}`, + dimCount: `${p}_count`, + dimCategorical: `data_${p}_cat`, + dimCellSize: `${p}_cell_size`, + dimCellSizeCalc: `${p}_cell_calc` + }; + } + getGrouping() { + return this.binX.fields.concat(this.binY.fields); + } + build() { + const { binX, binY, names, prefix, props } = this; + const { axisTextColor, colRowTitles, globalScope, parentScope } = props; + const titles = { x: { dataName: null, quantitative: null }, y: { dataName: null, quantitative: null } }; + const dx = { + dim: "x", + bin: binX, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutWidth, + layout: parentScope.sizeSignals.layoutWidth, + min: globalScope.signals.minCellWidth.name, + out: globalScope.signals.plotWidthOut, + offset: SignalNames.FacetPaddingLeft, + padding: SignalNames.FacetPaddingLeft, + dataOut: null, + scaleName: null, + position: null + }; + const dy = { + dim: "y", + bin: binY, + sortOrder: "ascending", + size: parentScope.sizeSignals.layoutHeight, + layout: parentScope.sizeSignals.layoutHeight, + min: globalScope.signals.minCellHeight.name, + out: globalScope.signals.plotHeightOut, + offset: SignalNames.FacetPaddingTop, + padding: `(${SignalNames.FacetPaddingTop} + ${SignalNames.FacetPaddingBottom})`, + dataOut: null, + scaleName: null, + position: null + }; + const dimensions = [dx, dy]; + dimensions.forEach((d) => { + const { bin: bin2, dim, padding: padding2, sortOrder } = d; + let data2; + let dataName; + let countSignal; + let scale2; + const titleSource = titles[dim]; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + addTransforms(bin2.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.markDataName)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, + as: FieldNames.Contains + }); + data2 = bin2.dataSequence; + dataName = bin2.dataSequence.name; + countSignal = `length(data(${JSON.stringify(dataName)}))`; + scale2 = ordinalScale(dataName, `${names.dimScale}_${dim}`, bin2.fields); + titleSource.dataName = bin2.dataSequence.name; + } else { + dataName = globalScope.markDataName; + const ord = createOrdinals(dataName, `${prefix}_${dim}`, bin2.fields, sortOrder); + data2 = ord.data; + addData(globalScope.scope, ord.data); + countSignal = `length(data(${JSON.stringify(ord.data.name)}))`; + scale2 = ord.scale; + titleSource.dataName = ord.data.name; + } + titleSource.quantitative = bin2.discreteColumn.column.quantitative; + d.dataOut = data2; + d.scaleName = scale2.name; + addTransforms(data2, { + type: "formula", + expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch }, { - name: names.maxLevels, - update: `data('${names.sequence}')[0].maxlevels` + type: "formula", + expr: displayBin(bin2), + as: FieldNames.FacetTitle + }); + addScales(globalScope.scope, scale2); + const count2 = `${names.dimCount}_${dim}`; + const calc = `${names.dimCellSizeCalc}_${dim}`; + const size2 = `${names.dimCellSize}_${dim}`; + addSignals(globalScope.scope, { name: count2, update: countSignal }); + addSignals(globalScope.scope, { + name: calc, + update: `${d.layout} / ${count2}` }, { - name: names.maxCount, - update: `${names.maxLevels} * ${names.squared}` + name: size2, + update: `max(${d.min}, (${calc} - ${padding2}))` }); - const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; - const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; - const cubeX = `(${layerOrdinal} % ${names.sides})`; - const cubeY = `floor(${layerOrdinal} / ${names.sides})`; - const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; - const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), - y: (0, _scope.addOffsets)(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), - h: names.size, - w: names.size - }; - const mark = { - type: 'rect', - from: { - data: this.names.levelDataName - }, - encode: { - update: { - z: { - signal: `${zLevel} * (${names.cube} + 1)` - }, - height: { - signal: names.cube - }, - width: { - signal: names.cube - }, - depth: { - signal: names.cube - } - } + modifySignal(d.out, "max", `((${size2} + ${padding2}) * ${count2})`); + d.position = this.dimensionOffset(d); + }); + const groupRow = { + type: "group", + encode: { + update: { + y: { + signal: dy.position } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - const zScale = { - type: 'linear', - name: names.zScale, - domain: [ - 0, - { - signal: names.maxCount - } - ], - range: [ - 0, - { - signal: `${names.maxLevels} * (${names.cube} + 1) - 1` - } - ], - nice: false - }; - return { - offsets, - mark, - sizeSignals: { - layoutHeight: names.size, - layoutWidth: names.size + } + }, + from: { + data: dy.dataOut.name + }, + data: [ + { + name: names.searchUnion, + source: dx.dataOut.name, + transform: [ + { + type: "formula", + expr: `[datum[${JSON.stringify(FieldNames.FacetSearch)}], merge(parent[${JSON.stringify(FieldNames.FacetSearch)}], { clause: '&&'})]`, + as: FieldNames.FacetSearch + } + ] + } + ] + }; + const groupCol = { + style: "cell", + name: prefix, + type: "group", + encode: { + update: { + height: { + signal: `${names.dimCellSize}_y` }, - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } + width: { + signal: `${names.dimCellSize}_x` }, - encodingRuleMap: { - y: [ - { - test: (0, _selection.testForCollapseSelection)(), - signal: parentScope.offsets.y - } - ], - z: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ], - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ], - height: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - } - ] - } - }; + x: { + signal: dx.position + } + } + }, + from: { + data: names.searchUnion + } + }; + addMarks(globalScope.markGroup, groupRow); + addMarks(groupRow, groupCol); + const offsets2 = { + x: this.dimensionOffset(dx), + y: this.dimensionOffset(dy), + h: `${names.dimCellSize}_y`, + w: `${names.dimCellSize}_x` + }; + const sizeSignals = { + layoutHeight: `${names.dimCellSize}_y`, + layoutWidth: `${names.dimCellSize}_x`, + colCount: `${names.dimCount}_x`, + rowCount: `${names.dimCount}_y` + }; + if (colRowTitles) { + addFacetColRowTitles(globalScope.scope, titles.x, titles.y, sizeSignals, axisTextColor); + } + return { + facetScope: groupCol, + offsets: offsets2, + sizeSignals, + titles + }; } -} - -},{"./layout":"3cZzz","../expr":"xWMIR","../scope":"9Kdkb","../selection":"S5407","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cbfP5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Strip", ()=>Strip); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Strip extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `strip_${this.id}`; - this.names = { - firstField: `${p}${(0, _constants.FieldNames).First}`, - lastField: `${p}${(0, _constants.FieldNames).Last}`, - valueField: `${p}${(0, _constants.FieldNames).Value}`, - scale: `scale_${p}`, - zScale: `scale_${p}_z` - }; + dimensionOffset(d) { + const { names } = this; + return `${d.offset} + (scale(${JSON.stringify(d.scaleName)}, datum[${JSON.stringify(d.bin.fields[0])}]) - 1) * (${names.dimCellSize}_${d.dim} + ${d.padding})`; + } + } + let Scatter$1 = class Scatter extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `scatter_${this.id}`; + this.names = { + aggregateData: `data_${p}_aggregate`, + markData: `data_${p}_mark`, + xDataExtent: `${p}_xDataExtent`, + yDataExtent: `${p}_yDataExtent`, + xExtent: `${p}_xExtent`, + yExtent: `${p}_yExtent`, + sizeExtent: `${p}_sizeExtent`, + sizeRange: `${p}_sizeRange`, + sizeScale: `${p}_sizeScale`, + xScale: `scale_${p}_x`, + yScale: `scale_${p}_y`, + zScale: `scale_${p}_z` + }; } build() { - const { names, prefix, props } = this; - const { addPercentageScale, globalScope, groupings, orientation, showAxes, size, sort, sortOrder, parentScope, view, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - const horizontal = orientation === 'horizontal'; - const transform = []; - if (sort) transform.push({ - type: 'collect', - sort: { - field: (0, _expr.safeFieldName)(sort.name), - order: sortOrder - } + const { names, prefix, props } = this; + const { backgroundImageExtents, globalScope, parentScope, scatterPointScaleDisplay, showAxes, size: size2, view, x: x2, y: y2, z, zGrounded } = props; + const qsize = size2 && size2.quantitative && size2; + addSignals(globalScope.scope, { + name: SignalNames.PointScale, + value: 5, + bind: { + name: scatterPointScaleDisplay, + debounce, + input: "range", + min: 1, + max: 10, + step: 0.1 + } + }, { + name: SignalNames.ZGrounded, + value: false, + bind: { + name: zGrounded, + input: "checkbox" + } + }); + if (backgroundImageExtents) { + addTransforms(globalScope.data, dataExtent(x2, names.xDataExtent), dataExtent(y2, names.yDataExtent)); + const xSignal = outerExtentSignal(names.xExtent, backgroundImageExtents.left, backgroundImageExtents.right, names.xDataExtent); + const ySignal = outerExtentSignal(names.yExtent, backgroundImageExtents.bottom, backgroundImageExtents.top, names.yDataExtent); + addSignals(globalScope.scope, xSignal, ySignal); + } + if (qsize) { + addTransforms(globalScope.data, { + type: "extent", + field: safeFieldName(qsize.name), + signal: names.sizeExtent }); - let stackField; - if (size) { - stackField = size.name; - transform.push({ - type: 'filter', - expr: `datum[${JSON.stringify(size.name)}] > 0` - }); + addScales(globalScope.scope, { + name: names.sizeScale, + type: "pow", + exponent: 0.5, + domain: [0, { signal: `${names.sizeExtent}[1]` }], + range: [0, { signal: names.sizeRange }] + }); + addSignals(globalScope.scope, { + name: names.sizeRange, + update: `min(${parentScope.sizeSignals.layoutHeight}, ${parentScope.sizeSignals.layoutWidth}) / ${scatterSizedDiv}` + }); + } + addData(globalScope.scope, { + name: names.markData, + source: globalScope.markDataName, + transform: [x2, y2, z].map((c2) => { + if (!c2 || !c2.quantitative) + return; + const t = { + type: "filter", + expr: `isValid(datum[${JSON.stringify(c2.name)}])` + }; + return t; + }).filter(Boolean) + }); + globalScope.setMarkDataName(names.markData); + const globalScales = { showAxes, scales: {} }; + const zValue = z ? `scale(${JSON.stringify(names.zScale)}, datum[${JSON.stringify(z.name)}])` : null; + const sizeValueSignal = qsize ? `scale(${JSON.stringify(names.sizeScale)}, datum[${JSON.stringify(qsize.name)}]) * ${SignalNames.PointScale}` : SignalNames.PointScale; + const update2 = Object.assign({ height: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: sizeValueSignal + } + ], width: { + signal: sizeValueSignal + } }, z && { + z: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` + } + ], + zindex: [ + { + signal: `${SignalNames.ZGrounded} ? 0 : ${zValue}` + } + ], + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + { + signal: view === "3d" ? `${SignalNames.ZGrounded} ? ${zValue} : ${sizeValueSignal}` : "0" + } + ] + }); + const columnSignals = [ + { + column: x2, + xyz: "x", + scaleName: names.xScale, + domain: backgroundImageExtents ? { + signal: names.xExtent + } : { + data: globalScope.data.name, + field: safeFieldName(x2.name) + }, + reverse: false, + signal: parentScope.sizeSignals.layoutWidth + }, + { + column: y2, + xyz: "y", + scaleName: names.yScale, + domain: backgroundImageExtents ? { + signal: names.yExtent + } : { + data: globalScope.data.name, + field: safeFieldName(y2.name) + }, + reverse: true, + signal: parentScope.sizeSignals.layoutHeight + }, + { + column: z, + xyz: "z", + scaleName: names.zScale, + domain: { + data: globalScope.data.name, + field: z ? safeFieldName(z.name) : null + }, + reverse: false, + signal: view === "3d" ? `(${globalScope.zSize}) * ${SignalNames.ZProportion}` : `10 * ${SignalNames.ZProportion}` + } + ]; + columnSignals.forEach((cs) => { + const { column, domain: domain2, reverse: reverse2, scaleName, signal, xyz } = cs; + if (!column) + return; + let scale2; + if (column.quantitative) { + scale2 = linearScale(scaleName, domain2, [0, { signal }], reverse2, false, showAxes); + if (shouldBeIntegralBinStep(column)) { + scale2.bins = { step: 1 }; + } } else { - stackField = names.valueField; - transform.push({ - type: 'formula', - expr: '1', - as: stackField - }); + scale2 = pointScale(scaleName, globalScope.data.name, [0, { signal }], column.name, reverse2); } - const stackTransform = { - type: 'stack', - field: (0, _expr.safeFieldName)(stackField), - offset: 'normalize', - as: [ - names.firstField, - names.lastField - ] - }; - if (groupings.length) stackTransform.groupby = (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)); - transform.push(stackTransform); - (0, _scope.addTransforms)(globalScope.data, ...transform); - const span = [ - names.lastField, - names.firstField - ].map((f)=>`datum[${JSON.stringify(f)}]`).join(' - '); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ''), - y: (0, _scope.addOffsets)(parentScope.offsets.y, horizontal ? '' : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), - h: horizontal ? parentScope.offsets.h : `(${span}) * (${parentScope.offsets.h})`, - w: horizontal ? `(${span}) * (${parentScope.offsets.w})` : parentScope.offsets.w - }; - const mark = { - name: prefix, - type: 'rect', - from: { - data: globalScope.markDataName - }, - encode: { - update: Object.assign({ - height: { - signal: offsets.h - }, - width: { - signal: offsets.w - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(globalScope.markGroup, mark); - let percentageScale; - if (addPercentageScale) percentageScale = [ + globalScales.scales[xyz] = [scale2]; + }); + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { update: update2 } + }; + addMarks(globalScope.markGroup, mark); + return { + offsets: { + x: addOffsets(parentScope.offsets.x, `scale(${JSON.stringify(names.xScale)}, datum[${JSON.stringify(x2.name)}])`), + y: addOffsets(parentScope.offsets.y, `scale(${JSON.stringify(names.yScale)}, datum[${JSON.stringify(y2.name)}]) - ${sizeValueSignal}`), + h: sizeValueSignal, + w: sizeValueSignal + }, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + globalScales, + mark, + encodingRuleMap: { + y: [ { - type: 'linear', - name: names.scale, - domain: [ - 0, - 100 - ], - range: horizontal ? [ - 0, - { - signal: parentScope.sizeSignals.layoutWidth - } - ] : [ - { - signal: parentScope.sizeSignals.layoutHeight - }, - 0 - ] + test: testForCollapseSelection(), + signal: addOffsets(parentScope.offsets.y, parentScope.sizeSignals.layoutHeight) } - ]; - return { - globalScales: { - showAxes, - scales: { - x: horizontal ? percentageScale : undefined, - y: horizontal ? undefined : percentageScale, - z: zScale && [ - zScale - ] - } - }, - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null - }, - mark - }; + ] + } + }; } -} - -},{"./layout":"3cZzz","../constants":"8P82N","../expr":"xWMIR","../scope":"9Kdkb","../selection":"S5407","../zBase":"584Nq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gPQ1J":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Treemap", ()=>Treemap); -var _layout = require("./layout"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _scope = require("../scope"); -var _selection = require("../selection"); -var _zBase = require("../zBase"); -class Treemap extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `treemap_${this.id}`; - this.names = { - dataName: `data_${p}`, - dataHeightWidth: `data_${p}_hw`, - dataExtents: `data_${p}_extents`, - dataFacet: `data_${p}_facet`, - dataFacetMark: `data_${p}_facetMark`, - fieldChildren: `${p}_children`, - fieldDepth: `${p}_depth`, - fieldX0: `${p}_x0`, - fieldX1: `${p}_x1`, - fieldY0: `${p}_y0`, - fieldY1: `${p}_y1`, - fieldHeight: `${p}_h`, - fieldWidth: `${p}_w`, - heightExtent: `${p}_heightExtent`, - widthExtent: `${p}_widthExtent`, - zScale: `scale_${p}_z` - }; + }; + function addZScale(z, zSize, dataName, zScaleName) { + if (z) { + const zRange = [0, { signal: `(${zSize}) * ${SignalNames.ZProportion}` }]; + const scale2 = z.quantitative ? linearScale(zScaleName, { + data: dataName, + field: safeFieldName(z.name) + }, zRange, false, true) : pointScale(zScaleName, dataName, zRange, z.name, false); + return scale2; + } + } + class Square extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `square_${this.id}`; + this.names = { + bandWidth: this.getBandWidth(), + maxGroupField: `${p}_max_group`, + maxGroupSignal: `${p}_max_grouping`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + zScale: `scale_${p}_z` + }; } build() { - const { names, props } = this; - const { globalScope, parentScope, showAxes, treeMapMethod, z } = props; - const zScale = (0, _zBase.addZScale)(z, globalScope.zSize, globalScope.data.name, names.zScale); - const offsets = { - x: (0, _scope.addOffsets)(parentScope.offsets.x, fn(names.fieldX0)), - y: (0, _scope.addOffsets)(parentScope.offsets.y, fn(names.fieldY0)), - h: subtract(names.fieldY1, names.fieldY0), - w: subtract(names.fieldX1, names.fieldX0) - }; - const mark = this.transformedMark(offsets); - (0, _scope.addSignals)(globalScope.scope, { - name: (0, _constants.SignalNames).TreeMapMethod, - value: 'squarify', - bind: { - name: treeMapMethod, - input: 'select', - options: [ - 'squarify', - 'binary' - ] - } - }); - return Object.assign(Object.assign({}, z && { - globalScales: { - showAxes, - scales: { - z: [ - zScale - ] - } - } - }), { - mark, - offsets, - sizeSignals: { - layoutHeight: null, - layoutWidth: null + const { names, prefix, props } = this; + const { fillDirection, globalScope, groupings, parentScope, collapseYHeight, showAxes, sortBy, view, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + addTransforms(globalScope.data, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sortBy && { + sort: { + field: safeFieldName(sortBy.name), + order: "ascending" + } + })); + const { gap, levelSize, size: size2, squaresPerBand } = this.addSignals(); + const heightSignal = { + signal: fillDirection === "down-right" ? size2 : levelSize + }; + const mark = { + name: prefix, + type: "rect", + from: { + data: globalScope.markDataName + }, + encode: { + update: Object.assign({ height: collapseYHeight ? [ + { + test: testForCollapseSelection(), + value: 0 + }, + heightSignal + ] : heightSignal, width: { + signal: fillDirection === "down-right" ? levelSize : size2 + } }, z && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z.name) + } : { + value: 0 + } + ] + }) + } + }; + addMarks(globalScope.markGroup, mark); + const { tx: tx2, ty: ty2 } = this.transformXY(gap, levelSize, squaresPerBand); + return Object.assign(Object.assign(Object.assign({}, z && { + globalScales: { + showAxes, + scales: { + z: [zScale] + } + } + }), { offsets: { + x: addOffsets(parentScope.offsets.x, tx2.expr), + y: addOffsets(parentScope.offsets.y, ty2.expr), + h: size2, + w: size2 + }, mark, sizeSignals: { + layoutHeight: size2, + layoutWidth: size2 + } }), collapseYHeight && { + encodingRuleMap: { + y: [ + { + test: testForCollapseSelection(), + signal: parentScope.offsets.y } - }); + ] + } + }); } - transformedMark(offsets) { - const { names, props } = this; - const { globalScope, groupings, parentScope } = props; - if (groupings.length) { - //treemap transform can't have it's boundary size grouped, so we need to facet the data. - (0, _scope.addData)(globalScope.scope, { - name: names.dataHeightWidth, - source: globalScope.markDataName, - transform: [ - { - type: 'formula', - expr: parentScope.offsets.h, - as: names.fieldHeight - }, - { - type: 'formula', - expr: parentScope.offsets.w, - as: names.fieldWidth - } - ] - }); - const treemapData = { - name: names.dataFacetMark, - source: names.dataFacet - }; - const facets = { - type: 'group', - from: { - facet: { - name: names.dataFacet, - data: names.dataHeightWidth, - groupby: (0, _scope.getGroupBy)(groupings).map((0, _expr.safeFieldName)) - } - }, - data: [ - { - name: names.dataExtents, - source: names.dataFacet, - transform: [ - { - type: 'extent', - field: names.fieldHeight, - signal: names.heightExtent - }, - { - type: 'extent', - field: names.fieldWidth, - signal: names.widthExtent - } - ] - }, - treemapData - ] - }; - globalScope.setMarkDataName(names.dataFacetMark); - (0, _scope.addMarks)(globalScope.markGroup, facets); - //assign new markgroup after adding mark to original group - globalScope.setMarkGroup(facets); - this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); - return this.addMark(offsets, facets, globalScope.markDataName); + getBandWidth() { + const { offsets: offsets2 } = this.props.parentScope; + switch (this.props.fillDirection) { + case "down-right": + return offsets2.h; + default: + return offsets2.w; + } + } + addSignals() { + const { names, props } = this; + const { fillDirection, globalScope, groupings, parentScope } = props; + let { maxGroupedFillSize, maxGroupedUnits } = props; + if (!maxGroupedUnits) { + if (groupings) { + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.maxGroupField] + }, { + type: "extent", + field: names.maxGroupField, + signal: names.maxGroupSignal + }); + maxGroupedUnits = `(${names.maxGroupSignal}[1])`; } else { - this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); - return this.addMark(offsets, globalScope.markGroup, globalScope.markDataName); - } - } - addMark(offsets, markParent, markDataName) { - const { names, prefix, props } = this; - const { view, z } = props; - const mark = { - name: prefix, - type: 'rect', - from: { - data: markDataName - }, - encode: { - update: Object.assign({ - width: { - signal: offsets.w - }, - height: { - signal: offsets.h - } - }, z && { - z: { - value: 0 - }, - depth: [ - { - test: (0, _selection.testForCollapseSelection)(), - value: 0 - }, - view === '3d' ? { - scale: names.zScale, - field: (0, _expr.safeFieldName)(z.name) - } : { - value: 0 - } - ] - }) - } - }; - (0, _scope.addMarks)(markParent, mark); - return mark; + maxGroupedUnits = `length(data(${JSON.stringify(globalScope.data.name)}))`; + } + } + if (!maxGroupedFillSize) { + maxGroupedFillSize = fillDirection === "down-right" ? parentScope.offsets.w : parentScope.offsets.h; + } + const aspect = `((${names.bandWidth}) / (${maxGroupedFillSize}))`; + const squaresPerBand = `ceil(sqrt(${maxGroupedUnits} * ${aspect}))`; + const gap = `min(0.1 * ((${names.bandWidth}) / (${squaresPerBand} - 1)), 1)`; + const size2 = `(((${names.bandWidth}) / ${squaresPerBand}) - ${gap})`; + const levels2 = `ceil(${maxGroupedUnits} / ${squaresPerBand})`; + const levelSize = `(((${maxGroupedFillSize}) / ${levels2}) - ${gap})`; + return { gap, levelSize, size: size2, squaresPerBand }; } - treemapTransform(treemapData, widthSignal, heightSignal) { - const { names, props } = this; - const { group, size } = props; - (0, _scope.addTransforms)(treemapData, { - type: 'filter', - expr: `datum[${JSON.stringify(size.name)}] > 0` - }, { - type: 'nest', - keys: [ - group && group.name || '__NONE__' - ] - }, { - type: 'treemap', - field: (0, _expr.safeFieldName)(size.name), + transformXY(gap, levelSize, squaresPerBand) { + const { names, prefix } = this; + const compartment = `(${names.bandWidth}) / ${squaresPerBand} * ((datum[${JSON.stringify(names.stack0)}]) % ${squaresPerBand})`; + const level = `floor((datum[${JSON.stringify(names.stack0)}]) / ${squaresPerBand})`; + const { fillDirection, parentScope } = this.props; + const tx2 = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetX}` + }; + const ty2 = { + type: "formula", + expr: null, + as: `${prefix}_${FieldNames.OffsetY}` + }; + switch (fillDirection) { + case "down-right": { + tx2.expr = `${level} * (${levelSize} + ${gap})`; + ty2.expr = compartment; + break; + } + case "right-up": { + tx2.expr = compartment; + ty2.expr = `${parentScope.offsets.h} - ${levelSize} - ${level} * (${levelSize} + ${gap})`; + break; + } + case "right-down": + default: { + tx2.expr = compartment; + ty2.expr = `${level} * (${levelSize} + ${gap})`; + break; + } + } + return { tx: tx2, ty: ty2 }; + } + } + class Stack extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `stack_${this.id}`; + this.names = { + cube: `${p}_cube`, + globalDataName: `data_${p}_count`, + globalExtent: `${p}_global_extent`, + levelDataName: `data_${p}_level`, + count: `${p}_count`, + stack0: `${p}_stack0`, + stack1: `${p}_stack1`, + sequence: `data_${p}_sequence`, + sides: `${p}_sides`, + size: `${p}_size`, + squared: `${p}_squared`, + maxCount: `${p}_maxCount`, + maxLevels: `${p}_maxLevels`, + zScale: `${p}_zScale` + }; + } + build() { + const { names, props } = this; + const { globalScope, groupings, parentScope, showAxes, sort: sort2 } = props; + const { sizeSignals } = parentScope; + addTransforms(globalScope.data, { + type: "joinaggregate", + groupby: getGroupBy(groupings).map(safeFieldName), + ops: ["count"], + as: [names.count] + }, { + type: "extent", + field: names.count, + signal: names.globalExtent + }, Object.assign({ type: "stack", groupby: getGroupBy(groupings).map(safeFieldName), as: [names.stack0, names.stack1] }, sort2 && { + sort: { + field: safeFieldName(sort2.name), + order: "ascending" + } + })); + addData(globalScope.scope, { + name: names.sequence, + transform: [ + { + type: "sequence", + start: 1, + stop: { + signal: `sqrt(${names.globalExtent}[1])` + } + }, + { + type: "formula", + expr: "datum.data * datum.data", + as: "squared" + }, + { + type: "formula", + expr: `ceil(${names.globalExtent}[1] / datum.squared)`, + as: "maxlevels" + }, + { + type: "formula", + expr: `(${names.size} - (datum.data - 1) * datum.data) / datum.data`, + as: "side" + }, + { + type: "formula", + expr: "datum.side * datum.maxlevels + datum.maxlevels - 1", + as: "sidecubeheight" + }, + { + type: "formula", + expr: `abs(${globalScope.zSize} - datum.sidecubeheight)`, + as: "heightmatch" + }, + { + type: "collect", sort: { - field: 'value', - order: 'descending' + field: "heightmatch", + order: "ascending" + } + }, + { + type: "window", + ops: ["row_number"] + }, + { + type: "filter", + expr: "datum.row_number === 1" + } + ] + }); + addSignals(globalScope.scope, { + name: names.size, + update: `min((${sizeSignals.layoutHeight}), (${sizeSignals.layoutWidth}))` + }, { + name: names.squared, + update: `data('${names.sequence}')[0].squared` + }, { + name: names.sides, + update: `sqrt(${names.squared})` + }, { + name: names.cube, + update: `(${names.size} - (${names.sides} - 1)) / ${names.sides}` + }, { + name: names.maxLevels, + update: `data('${names.sequence}')[0].maxlevels` + }, { + name: names.maxCount, + update: `${names.maxLevels} * ${names.squared}` + }); + const zLevel = `floor(datum[${JSON.stringify(names.stack0)}] / ${names.squared})`; + const layerOrdinal = `(datum[${JSON.stringify(names.stack0)}] % ${names.squared})`; + const cubeX = `(${layerOrdinal} % ${names.sides})`; + const cubeY = `floor(${layerOrdinal} / ${names.sides})`; + const groupX = `(${sizeSignals.layoutWidth} - ${names.size}) / 2`; + const groupY = `(${sizeSignals.layoutHeight} - ${names.size}) / 2`; + const offsets2 = { + x: addOffsets(parentScope.offsets.x, groupX, `${cubeX} * (${names.cube} + 1)`), + y: addOffsets(parentScope.offsets.y, groupY, `${cubeY} * (${names.cube} + 1)`), + h: names.size, + w: names.size + }; + const mark = { + type: "rect", + from: { data: this.names.levelDataName }, + encode: { + update: { + z: { + signal: `${zLevel} * (${names.cube} + 1)` }, - round: true, - method: { - signal: (0, _constants.SignalNames).TreeMapMethod + height: { + signal: names.cube }, - paddingInner: 1, - paddingOuter: 0, - size: [ - { - signal: widthSignal - }, - { - signal: heightSignal - } - ], - as: [ - names.fieldX0, - names.fieldY0, - names.fieldX1, - names.fieldY1, - names.fieldDepth, - names.fieldChildren - ] - }); - } -} -function fn(n) { - return `datum[${JSON.stringify(n)}]`; -} -function subtract(...fields) { - return fields.map((n)=>fn(n)).join(' - '); -} - -},{"./layout":"3cZzz","../constants":"8P82N","../expr":"xWMIR","../scope":"9Kdkb","../selection":"S5407","../zBase":"584Nq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3WV33":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Wrap", ()=>Wrap); -var _layout = require("./layout"); -var _bin = require("../bin"); -var _constants = require("../constants"); -var _expr = require("../expr"); -var _facetSearch = require("../facetSearch"); -var _facetTitle = require("../facetTitle"); -var _ordinal = require("../ordinal"); -var _scope = require("../scope"); -var _signals = require("../signals"); -class Wrap extends (0, _layout.Layout) { - constructor(props){ - super(props); - this.props = props; - const p = this.prefix = `wrap_${this.id}`; - this.bin = (0, _bin.binnable)(this.prefix, props.globalScope.data.name, props.groupby); - this.names = { - outputData: `data_${p}_out`, - rowColumnDataName: `data_${p}_row_col`, - cellHeight: `${p}_cellHeight`, - cellWidth: `${p}_cellWidth`, - fits: `${p}_fits`, - target: `${p}_target`, - minArea: `${p}_minArea`, - aspect: `${p}_aspect`, - minAspect: `${p}_minAspect`, - idealAspect: `${p}_idealAspect`, - dataLength: `${p}_dataLength`, - rxc0: `${p}_rxc0`, - rxc1: `${p}_rxc1`, - rxc2: `${p}_rxc2`, - rxc: `${p}_rxc`, - growColCount: `${p}_growColCount`, - growCellWidth: `${p}_growCellWidth`, - fitsArea: `${p}_fitsArea`, - colCount: `${p}_colCount` - }; + width: { + signal: names.cube + }, + depth: { + signal: names.cube + } + } + } + }; + addMarks(globalScope.markGroup, mark); + const zScale = { + type: "linear", + name: names.zScale, + domain: [ + 0, + { + signal: names.maxCount + } + ], + range: [ + 0, + { + signal: `${names.maxLevels} * (${names.cube} + 1) - 1` + } + ], + nice: false + }; + return { + offsets: offsets2, + mark, + sizeSignals: { + layoutHeight: names.size, + layoutWidth: names.size + }, + globalScales: { + showAxes, + scales: { + z: [zScale] + } + }, + encodingRuleMap: { + y: [{ + test: testForCollapseSelection(), + signal: parentScope.offsets.y + }], + z: [{ + test: testForCollapseSelection(), + value: 0 + }], + depth: [{ + test: testForCollapseSelection(), + value: 0 + }], + height: [{ + test: testForCollapseSelection(), + value: 0 + }] + } + }; } - getGrouping() { - return this.bin.fields; + } + class Strip extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `strip_${this.id}`; + this.names = { + firstField: `${p}${FieldNames.First}`, + lastField: `${p}${FieldNames.Last}`, + valueField: `${p}${FieldNames.Value}`, + scale: `scale_${p}`, + zScale: `scale_${p}_z` + }; } build() { - const { bin, names, prefix, props } = this; - const { axisTextColor, cellTitles, globalScope, parentScope } = props; - let ordinalBinData; - if (bin.native === false) { - (0, _scope.addSignals)(globalScope.scope, ...bin.signals); - (0, _scope.addTransforms)(globalScope.data, ...bin.transforms); - (0, _scope.addData)(globalScope.scope, bin.dataSequence); - (0, _scope.addTransforms)(bin.dataSequence, { - type: 'formula', - expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin.fields[0])}, datum[${JSON.stringify(bin.fields[0])}])`, - as: (0, _constants.FieldNames).Contains - }); - ordinalBinData = bin.dataSequence.name; - } else { - const ord = (0, _ordinal.createOrdinals)(globalScope.data.name, prefix, bin.fields, 'ascending'); - (0, _scope.addData)(globalScope.scope, ord.data); - ordinalBinData = ord.data.name; - } - (0, _scope.addData)(globalScope.scope, { - name: names.rxc0, - transform: [ - { - type: 'sequence', - start: 1, - stop: { - signal: `ceil(sqrt(${names.dataLength})) + 1` - } - }, - { - type: 'formula', - expr: `ceil(${names.dataLength} / datum.data)`, - as: 'complement' - } - ] - }, { - name: names.rxc1, - source: names.rxc0, - transform: [ - { - type: 'project', - fields: [ - 'data' - ], - as: [ - 'cols' - ] - } - ] - }, { - name: names.rxc2, - source: names.rxc0, - transform: [ - { - type: 'project', - fields: [ - 'complement' - ], - as: [ - 'cols' - ] - } - ] - }, { - name: names.rxc, - source: [ - names.rxc1, - names.rxc2 - ], - transform: [ - { - type: 'formula', - expr: `ceil(${names.dataLength} / datum.cols)`, - as: 'rows' - }, - { - type: 'formula', - expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, - as: 'cellw' - }, - { - type: 'formula', - expr: `datum.cols === 1 ? max(datum.cellw, ${(0, _constants.SignalNames).MinCellWidth}) : datum.cellw`, - as: 'cellw' - }, - { - type: 'formula', - expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, - as: 'cellh' - }, - { - type: 'formula', - expr: `datum.rows === 1 ? max(datum.cellh, ${(0, _constants.SignalNames).MinCellHeight}) : datum.cellh`, - as: 'cellh' - }, - { - type: 'formula', - expr: `(datum.cellw >= ${(0, _constants.SignalNames).MinCellWidth} && datum.cellh >= ${(0, _constants.SignalNames).MinCellHeight})`, - as: 'meetsmin' - }, - { - type: 'filter', - expr: 'datum.meetsmin' - }, - { - type: 'formula', - expr: 'datum.cellw / datum.cellh', - as: names.aspect - }, - { - type: 'formula', - expr: `abs(datum.${names.aspect} - ${names.target})`, - as: names.idealAspect - }, - { - type: 'formula', - expr: `${names.dataLength} / (datum.cols * datum.rows)`, - as: 'coverage' - }, - { - type: 'collect', - sort: { - field: [ - names.idealAspect, - 'coverage' - ], - order: [ - 'ascending', - 'descending' - ] - } - } - ] - }, { - name: names.rowColumnDataName, - source: ordinalBinData, - transform: [ - { - type: 'formula', - expr: `floor((datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1) / ${names.colCount})`, - as: (0, _constants.FieldNames).WrapRow - }, - { - type: 'formula', - expr: `(datum[${JSON.stringify((0, _constants.FieldNames).Ordinal)}] - 1) % ${names.colCount}`, - as: (0, _constants.FieldNames).WrapCol - }, - { - type: 'formula', - expr: (0, _facetSearch.serializeAsVegaExpression)(bin, (0, _constants.FieldNames).First, (0, _constants.FieldNames).Last), - as: (0, _constants.FieldNames).FacetSearch - }, - { - type: 'formula', - expr: (0, _facetSearch.displayBin)(bin), - as: (0, _constants.FieldNames).FacetTitle - } - ] + const { names, prefix, props } = this; + const { addPercentageScale, globalScope, groupings, orientation, showAxes, size: size2, sort: sort2, sortOrder, parentScope, view, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + const horizontal = orientation === "horizontal"; + const transform2 = []; + if (sort2) { + transform2.push({ + type: "collect", + sort: { + field: safeFieldName(sort2.name), + order: sortOrder + } }); - const dataOut = { - name: names.outputData, - source: globalScope.data.name, - transform: [ - { - type: 'lookup', - from: names.rowColumnDataName, - key: (0, _expr.safeFieldName)(bin.fields[0]), - fields: [ - bin.fields[0] - ].map((0, _expr.safeFieldName)), - values: [ - (0, _constants.FieldNames).WrapRow, - (0, _constants.FieldNames).WrapCol - ] - } - ] - }; - (0, _scope.addData)(globalScope.scope, dataOut); - globalScope.setMarkDataName(names.outputData); - (0, _scope.addSignals)(globalScope.scope, { - name: names.minAspect, - update: `${(0, _constants.SignalNames).MinCellWidth} / ${(0, _constants.SignalNames).MinCellHeight}` - }, { - name: names.target, - update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}` - }, { - name: names.minArea, - update: `${(0, _constants.SignalNames).MinCellWidth}*${(0, _constants.SignalNames).MinCellHeight}` - }, { - name: names.aspect, - update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` - }, { - name: names.dataLength, - update: `data(${JSON.stringify(ordinalBinData)}).length` - }, { - name: names.growColCount, - update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${(0, _constants.SignalNames).MinCellWidth}), 1)` - }, { - name: names.growCellWidth, - update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` - }, { - name: names.fitsArea, - update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` - }, { - name: names.fits, - update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` - }, { - name: names.colCount, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` - }, { - name: names.cellWidth, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` - }, { - name: names.cellHeight, - update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${(0, _constants.SignalNames).MinCellHeight}` + } + let stackField; + if (size2) { + stackField = size2.name; + transform2.push({ + type: "filter", + expr: `datum[${JSON.stringify(size2.name)}] > 0` }); - (0, _signals.modifySignal)(globalScope.signals.plotHeightOut, 'max', `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); - (0, _signals.modifySignal)(globalScope.signals.plotWidthOut, 'max', `(${names.cellWidth} * ${names.colCount})`); - const signalH = [ - names.cellHeight, - (0, _constants.SignalNames).FacetPaddingTop, - (0, _constants.SignalNames).FacetPaddingBottom - ].join(' - '); - const signalW = [ - names.cellWidth, - (0, _constants.SignalNames).FacetPaddingLeft - ].join(' - '); - const signalX = (0, _scope.addOffsets)(parentScope.offsets.x, `datum[${JSON.stringify((0, _constants.FieldNames).WrapCol)}] * ${names.cellWidth}`, (0, _constants.SignalNames).FacetPaddingLeft); - const signalY = (0, _scope.addOffsets)(parentScope.offsets.y, `datum[${JSON.stringify((0, _constants.FieldNames).WrapRow)}] * ${names.cellHeight}`, (0, _constants.SignalNames).FacetPaddingTop); - const update = { - height: { - signal: signalH - }, - width: { - signal: signalW + } else { + stackField = names.valueField; + transform2.push({ + type: "formula", + expr: "1", + as: stackField + }); + } + const stackTransform = { + type: "stack", + field: safeFieldName(stackField), + offset: "normalize", + as: [names.firstField, names.lastField] + }; + if (groupings.length) { + stackTransform.groupby = getGroupBy(groupings).map(safeFieldName); + } + transform2.push(stackTransform); + addTransforms(globalScope.data, ...transform2); + const span2 = [names.lastField, names.firstField].map((f) => `datum[${JSON.stringify(f)}]`).join(" - "); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, horizontal ? `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.w})` : ""), + y: addOffsets(parentScope.offsets.y, horizontal ? "" : `datum[${JSON.stringify(names.firstField)}] * (${parentScope.offsets.h})`), + h: horizontal ? parentScope.offsets.h : `(${span2}) * (${parentScope.offsets.h})`, + w: horizontal ? `(${span2}) * (${parentScope.offsets.w})` : parentScope.offsets.w + }; + const mark = { + name: prefix, + type: "rect", + from: { data: globalScope.markDataName }, + encode: { + update: Object.assign({ height: { + signal: offsets2.h + }, width: { + signal: offsets2.w + } }, z && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z.name) + } : { + value: 0 + } + ] + }) + } + }; + addMarks(globalScope.markGroup, mark); + let percentageScale; + if (addPercentageScale) { + percentageScale = [{ + type: "linear", + name: names.scale, + domain: [0, 100], + range: horizontal ? [ + 0, + { + signal: parentScope.sizeSignals.layoutWidth + } + ] : [ + { + signal: parentScope.sizeSignals.layoutHeight }, - x: { - signal: signalX + 0 + ] + }]; + } + return { + globalScales: { + showAxes, + scales: { + x: horizontal ? percentageScale : void 0, + y: horizontal ? void 0 : percentageScale, + z: zScale && [zScale] + } + }, + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + }, + mark + }; + } + } + class Treemap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `treemap_${this.id}`; + this.names = { + dataName: `data_${p}`, + dataHeightWidth: `data_${p}_hw`, + dataExtents: `data_${p}_extents`, + dataFacet: `data_${p}_facet`, + dataFacetMark: `data_${p}_facetMark`, + fieldChildren: `${p}_children`, + fieldDepth: `${p}_depth`, + fieldX0: `${p}_x0`, + fieldX1: `${p}_x1`, + fieldY0: `${p}_y0`, + fieldY1: `${p}_y1`, + fieldHeight: `${p}_h`, + fieldWidth: `${p}_w`, + heightExtent: `${p}_heightExtent`, + widthExtent: `${p}_widthExtent`, + zScale: `scale_${p}_z` + }; + } + build() { + const { names, props } = this; + const { globalScope, parentScope, showAxes, treeMapMethod, z } = props; + const zScale = addZScale(z, globalScope.zSize, globalScope.data.name, names.zScale); + const offsets2 = { + x: addOffsets(parentScope.offsets.x, fn(names.fieldX0)), + y: addOffsets(parentScope.offsets.y, fn(names.fieldY0)), + h: subtract$1(names.fieldY1, names.fieldY0), + w: subtract$1(names.fieldX1, names.fieldX0) + }; + const mark = this.transformedMark(offsets2); + addSignals(globalScope.scope, { + name: SignalNames.TreeMapMethod, + value: "squarify", + bind: { + name: treeMapMethod, + input: "select", + options: [ + "squarify", + "binary" + ] + } + }); + return Object.assign(Object.assign({}, z && { + globalScales: { + showAxes, + scales: { + z: [zScale] + } + } + }), { + mark, + offsets: offsets2, + sizeSignals: { + layoutHeight: null, + layoutWidth: null + } + }); + } + transformedMark(offsets2) { + const { names, props } = this; + const { globalScope, groupings, parentScope } = props; + if (groupings.length) { + addData(globalScope.scope, { + name: names.dataHeightWidth, + source: globalScope.markDataName, + transform: [ + { + type: "formula", + expr: parentScope.offsets.h, + as: names.fieldHeight }, - y: { - signal: signalY + { + type: "formula", + expr: parentScope.offsets.w, + as: names.fieldWidth } - }; - const offsets = { - x: signalX, - y: signalY, - h: signalH, - w: signalW - }; - const group = { - style: 'cell', - name: prefix, - type: 'group', - from: { - data: names.rowColumnDataName + ] + }); + const treemapData = { + name: names.dataFacetMark, + source: names.dataFacet + }; + const facets = { + type: "group", + from: { + facet: { + name: names.dataFacet, + data: names.dataHeightWidth, + groupby: getGroupBy(groupings).map(safeFieldName) + } + }, + data: [ + { + name: names.dataExtents, + source: names.dataFacet, + transform: [ + { + type: "extent", + field: names.fieldHeight, + signal: names.heightExtent + }, + { + type: "extent", + field: names.fieldWidth, + signal: names.widthExtent + } + ] }, - encode: { - update - } - }; - (0, _scope.addMarks)(globalScope.markGroup, group); - const sizeSignals = { - layoutHeight: `(${names.cellHeight} - ${(0, _constants.SignalNames).FacetPaddingTop} - ${(0, _constants.SignalNames).FacetPaddingBottom})`, - layoutWidth: `(${names.cellWidth} - ${(0, _constants.SignalNames).FacetPaddingLeft})`, - colCount: names.colCount, - rowCount: `ceil(${names.dataLength} / ${names.colCount})` - }; - if (cellTitles) (0, _facetTitle.addFacetCellTitles)(group, sizeSignals, axisTextColor); - return { - facetScope: group, - sizeSignals, - offsets - }; + treemapData + ] + }; + globalScope.setMarkDataName(names.dataFacetMark); + addMarks(globalScope.markGroup, facets); + globalScope.setMarkGroup(facets); + this.treemapTransform(treemapData, `${names.widthExtent}[0]`, `${names.heightExtent}[0]`); + return this.addMark(offsets2, facets, globalScope.markDataName); + } else { + this.treemapTransform(globalScope.data, parentScope.offsets.w, parentScope.offsets.h); + return this.addMark(offsets2, globalScope.markGroup, globalScope.markDataName); + } } -} - -},{"./layout":"3cZzz","../bin":"dWsCV","../constants":"8P82N","../expr":"xWMIR","../facetSearch":"ekgr6","../facetTitle":"4A66v","../ordinal":"fMJz6","../scope":"9Kdkb","../signals":"9zG5R","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bBG3O":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getImageMark", ()=>getImageMark); -var _band = require("./layouts/band"); -function getImageMark(backgroundImage, allGlobalScales) { - const xScale = allGlobalScales.filter((s)=>s.scales.x)[0].scales.x[0]; - const yScale = allGlobalScales.filter((s)=>s.scales.y)[0].scales.y[0]; - const [xScaleName, yScaleName] = [ - xScale, - yScale - ].map((s)=>s.name + (xScale.type === 'band' ? (0, _band.bandScaleLinearSuffix) : '')); - return { - type: 'image', + addMark(offsets2, markParent, markDataName) { + const { names, prefix, props } = this; + const { view, z } = props; + const mark = { + name: prefix, + type: "rect", + from: { data: markDataName }, encode: { - update: { - url: { - value: backgroundImage.url - }, - aspect: { - value: false - }, - baseline: { - value: 'bottom' - }, - height: { - signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) - }, - y: { - signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) - }, - width: { - signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) - }, - x: { - signal: getScaledValue(xScaleName, backgroundImage.extents.left) - } - } + update: Object.assign({ width: { + signal: offsets2.w + }, height: { + signal: offsets2.h + } }, z && { + z: { value: 0 }, + depth: [ + { + test: testForCollapseSelection(), + value: 0 + }, + view === "3d" ? { + scale: names.zScale, + field: safeFieldName(z.name) + } : { + value: 0 + } + ] + }) } - }; -} -function getScaledSpan(scaleName, low, high) { - return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; -} -function getScaledValue(scaleName, value) { - return `scale('${scaleName}', ${value})`; -} - -},{"./layouts/band":"6oniE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6XfrQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iZowJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"epS5r":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _compare = require("./compare"); -parcelHelpers.exportAll(_compare, exports); -var _exec = require("./exec"); -parcelHelpers.exportAll(_exec, exports); -var _group = require("./group"); -parcelHelpers.exportAll(_group, exports); -var _invert = require("./invert"); -parcelHelpers.exportAll(_invert, exports); -var _narrow = require("./narrow"); -parcelHelpers.exportAll(_narrow, exports); -var _types = require("./types"); -parcelHelpers.exportAll(_types, exports); - -},{"./compare":"02NZb","./exec":"55tVQ","./group":"hnSxg","./invert":"1C30Z","./narrow":"8Cjqz","./types":"2s9pC","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"02NZb":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "compareExpression", ()=>compareExpression); -parcelHelpers.export(exports, "compareGroup", ()=>compareGroup); -parcelHelpers.export(exports, "compare", ()=>compare); -parcelHelpers.export(exports, "startsWith", ()=>startsWith); -var _group = require("./group"); -const expressionKeys = Object.keys({ - clause: null, - name: null, - operator: null, - value: null -}); -function compareExpression(a, b) { - if (a && b) for(let k = 0; k < expressionKeys.length; k++){ - const key = expressionKeys[k]; - if (a[key] != b[key]) return false; + }; + addMarks(markParent, mark); + return mark; } - else return !a && !b; - return true; -} -const groupKeys = Object.keys({ - clause: null -}); -function compareGroup(a, b) { - for(let k = 0; k < groupKeys.length; k++){ - const key = groupKeys[k]; - if (a[key] != b[key]) return false; - } - if (!a.expressions && !b.expressions) return true; - if (!a.expressions || !b.expressions) return false; - if (a.expressions.length != b.expressions.length) return false; - for(let i = 0; i < a.expressions.length; i++){ - if (!compareExpression(a.expressions[i], b.expressions[i])) return false; + treemapTransform(treemapData, widthSignal, heightSignal) { + const { names, props } = this; + const { group: group2, size: size2 } = props; + addTransforms(treemapData, { + type: "filter", + expr: `datum[${JSON.stringify(size2.name)}] > 0` + }, { + type: "nest", + keys: [group2 && group2.name || "__NONE__"] + }, { + type: "treemap", + field: safeFieldName(size2.name), + sort: { field: "value", order: "descending" }, + round: true, + method: { signal: SignalNames.TreeMapMethod }, + paddingInner: 1, + paddingOuter: 0, + size: [ + { signal: widthSignal }, + { signal: heightSignal } + ], + as: [ + names.fieldX0, + names.fieldY0, + names.fieldX1, + names.fieldY1, + names.fieldDepth, + names.fieldChildren + ] + }); } - return true; -} -function compare(a, b) { - if (a == b) return true; - if (!a || !b) return false; - const arrs = [ - a, - b - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [arrA, arrB] = arrs; - if (arrA.length != arrB.length) return false; - for(let i = 0; i < arrA.length; i++){ - if (!compareGroup(arrA[i], arrB[i])) return false; + } + function fn(n) { + return `datum[${JSON.stringify(n)}]`; + } + function subtract$1(...fields) { + return fields.map((n) => fn(n)).join(" - "); + } + class Wrap extends Layout { + constructor(props) { + super(props); + this.props = props; + const p = this.prefix = `wrap_${this.id}`; + this.bin = binnable(this.prefix, props.globalScope.data.name, props.groupby); + this.names = { + outputData: `data_${p}_out`, + rowColumnDataName: `data_${p}_row_col`, + cellHeight: `${p}_cellHeight`, + cellWidth: `${p}_cellWidth`, + fits: `${p}_fits`, + target: `${p}_target`, + minArea: `${p}_minArea`, + aspect: `${p}_aspect`, + minAspect: `${p}_minAspect`, + idealAspect: `${p}_idealAspect`, + dataLength: `${p}_dataLength`, + rxc0: `${p}_rxc0`, + rxc1: `${p}_rxc1`, + rxc2: `${p}_rxc2`, + rxc: `${p}_rxc`, + growColCount: `${p}_growColCount`, + growCellWidth: `${p}_growCellWidth`, + fitsArea: `${p}_fitsArea`, + colCount: `${p}_colCount` + }; } - return true; -} -function startsWith(whole, part) { - if (!part) return true; - const arrs = [ - whole, - part - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [wholeArray, partArray] = arrs; - if (partArray.length > wholeArray.length) return false; - for(let i = 0; i < partArray.length; i++){ - if (!compareGroup(wholeArray[i], partArray[i])) return false; + getGrouping() { + return this.bin.fields; } - return true; -} - -},{"./group":"hnSxg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hnSxg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isSearchExpressionGroup", ()=>isSearchExpressionGroup); -parcelHelpers.export(exports, "createGroupFromExpression", ()=>createGroupFromExpression); -parcelHelpers.export(exports, "ensureSearchExpressionGroupArray", ()=>ensureSearchExpressionGroupArray); -function isSearchExpressionGroup(search) { - if (!search) return false; - return !!search.expressions; -} -function createGroupFromExpression(input) { - const output = { - expressions: [ - input + build() { + const { bin: bin2, names, prefix, props } = this; + const { axisTextColor, cellTitles, globalScope, parentScope } = props; + let ordinalBinData; + if (bin2.native === false) { + addSignals(globalScope.scope, ...bin2.signals); + addTransforms(globalScope.data, ...bin2.transforms); + addData(globalScope.scope, bin2.dataSequence); + addTransforms(bin2.dataSequence, { + type: "formula", + expr: `indata(${JSON.stringify(globalScope.data.name)}, ${JSON.stringify(bin2.fields[0])}, datum[${JSON.stringify(bin2.fields[0])}])`, + as: FieldNames.Contains + }); + ordinalBinData = bin2.dataSequence.name; + } else { + const ord = createOrdinals(globalScope.data.name, prefix, bin2.fields, "ascending"); + addData(globalScope.scope, ord.data); + ordinalBinData = ord.data.name; + } + addData(globalScope.scope, { + name: names.rxc0, + transform: [ + { + type: "sequence", + start: 1, + stop: { + signal: `ceil(sqrt(${names.dataLength})) + 1` + } + }, + { + type: "formula", + expr: `ceil(${names.dataLength} / datum.data)`, + as: "complement" + } ] - }; - return output; -} -function ensureSearchExpressionGroupArray(search) { - if (Array.isArray(search)) return [ - ...search - ]; - else if (isSearchExpressionGroup(search)) return [ - search - ]; - else return [ - createGroupFromExpression(search) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55tVQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Exec", ()=>Exec); -var _group = require("./group"); -function valueToBoolean(value) { - if (typeof value === 'string') switch(value.toLowerCase()){ - case 'true': - return true; - case 'false': - return false; - } - return !!value; -} -function valueToString(value) { - if (value == null) return ''; - switch(typeof value){ - case 'string': - return value; - case 'boolean': - case 'number': - return value.toString(); - } - return ''; -} -function isStringOperation(ex) { - switch(ex.operator){ - case 'contains': - case '!contains': - case 'starts': - case '!starts': - return true; + }, { + name: names.rxc1, + source: names.rxc0, + transform: [ + { + type: "project", + fields: ["data"], + as: ["cols"] + } + ] + }, { + name: names.rxc2, + source: names.rxc0, + transform: [ + { + type: "project", + fields: ["complement"], + as: ["cols"] + } + ] + }, { + name: names.rxc, + source: [names.rxc1, names.rxc2], + transform: [ + { + type: "formula", + expr: `ceil(${names.dataLength} / datum.cols)`, + as: "rows" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutWidth} / datum.cols`, + as: "cellw" + }, + { + type: "formula", + expr: `datum.cols === 1 ? max(datum.cellw, ${SignalNames.MinCellWidth}) : datum.cellw`, + as: "cellw" + }, + { + type: "formula", + expr: `${parentScope.sizeSignals.layoutHeight} / datum.rows`, + as: "cellh" + }, + { + type: "formula", + expr: `datum.rows === 1 ? max(datum.cellh, ${SignalNames.MinCellHeight}) : datum.cellh`, + as: "cellh" + }, + { + type: "formula", + expr: `(datum.cellw >= ${SignalNames.MinCellWidth} && datum.cellh >= ${SignalNames.MinCellHeight})`, + as: "meetsmin" + }, + { + type: "filter", + expr: "datum.meetsmin" + }, + { + type: "formula", + expr: "datum.cellw / datum.cellh", + as: names.aspect + }, + { + type: "formula", + expr: `abs(datum.${names.aspect} - ${names.target})`, + as: names.idealAspect + }, + { + type: "formula", + expr: `${names.dataLength} / (datum.cols * datum.rows)`, + as: "coverage" + }, + { + type: "collect", + sort: { + field: [names.idealAspect, "coverage"], + order: ["ascending", "descending"] + } + } + ] + }, { + name: names.rowColumnDataName, + source: ordinalBinData, + transform: [ + { + type: "formula", + expr: `floor((datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) / ${names.colCount})`, + as: FieldNames.WrapRow + }, + { + type: "formula", + expr: `(datum[${JSON.stringify(FieldNames.Ordinal)}] - 1) % ${names.colCount}`, + as: FieldNames.WrapCol + }, + { + type: "formula", + expr: serializeAsVegaExpression(bin2, FieldNames.First, FieldNames.Last), + as: FieldNames.FacetSearch + }, + { + type: "formula", + expr: displayBin(bin2), + as: FieldNames.FacetTitle + } + ] + }); + const dataOut = { + name: names.outputData, + source: globalScope.data.name, + transform: [ + { + type: "lookup", + from: names.rowColumnDataName, + key: safeFieldName(bin2.fields[0]), + fields: [bin2.fields[0]].map(safeFieldName), + values: [FieldNames.WrapRow, FieldNames.WrapCol] + } + ] + }; + addData(globalScope.scope, dataOut); + globalScope.setMarkDataName(names.outputData); + addSignals(globalScope.scope, { + name: names.minAspect, + update: `${SignalNames.MinCellWidth} / ${SignalNames.MinCellHeight}` + }, { + name: names.target, + update: `${names.minAspect} === 1 ? ${1.2} : ${names.minAspect}` + }, { + name: names.minArea, + update: `${SignalNames.MinCellWidth}*${SignalNames.MinCellHeight}` + }, { + name: names.aspect, + update: `${parentScope.sizeSignals.layoutWidth} / ${parentScope.sizeSignals.layoutHeight}` + }, { + name: names.dataLength, + update: `data(${JSON.stringify(ordinalBinData)}).length` + }, { + name: names.growColCount, + update: `max(floor(${parentScope.sizeSignals.layoutWidth} / ${SignalNames.MinCellWidth}), 1)` + }, { + name: names.growCellWidth, + update: `${parentScope.sizeSignals.layoutWidth} / ${names.growColCount}` + }, { + name: names.fitsArea, + update: `((${names.dataLength} * ${names.minArea}) <= (${parentScope.sizeSignals.layoutWidth} * ${parentScope.sizeSignals.layoutHeight}))` + }, { + name: names.fits, + update: `${names.fitsArea} && length(data(${JSON.stringify(names.rxc)})) > 0` + }, { + name: names.colCount, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cols : ${names.growColCount}` + }, { + name: names.cellWidth, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellw : ${names.growCellWidth}` + }, { + name: names.cellHeight, + update: `${names.fits} ? data(${JSON.stringify(names.rxc)})[0].cellh : ${SignalNames.MinCellHeight}` + }); + modifySignal(globalScope.signals.plotHeightOut, "max", `(${names.cellHeight} * ceil(${names.dataLength} / ${names.colCount}))`); + modifySignal(globalScope.signals.plotWidthOut, "max", `(${names.cellWidth} * ${names.colCount})`); + const signalH = [names.cellHeight, SignalNames.FacetPaddingTop, SignalNames.FacetPaddingBottom].join(" - "); + const signalW = [names.cellWidth, SignalNames.FacetPaddingLeft].join(" - "); + const signalX = addOffsets(parentScope.offsets.x, `datum[${JSON.stringify(FieldNames.WrapCol)}] * ${names.cellWidth}`, SignalNames.FacetPaddingLeft); + const signalY = addOffsets(parentScope.offsets.y, `datum[${JSON.stringify(FieldNames.WrapRow)}] * ${names.cellHeight}`, SignalNames.FacetPaddingTop); + const update2 = { + height: { + signal: signalH + }, + width: { + signal: signalW + }, + x: { + signal: signalX + }, + y: { + signal: signalY + } + }; + const offsets2 = { + x: signalX, + y: signalY, + h: signalH, + w: signalW + }; + const group2 = { + style: "cell", + name: prefix, + type: "group", + from: { + data: names.rowColumnDataName + }, + encode: { update: update2 } + }; + addMarks(globalScope.markGroup, group2); + const sizeSignals = { + layoutHeight: `(${names.cellHeight} - ${SignalNames.FacetPaddingTop} - ${SignalNames.FacetPaddingBottom})`, + layoutWidth: `(${names.cellWidth} - ${SignalNames.FacetPaddingLeft})`, + colCount: names.colCount, + rowCount: `ceil(${names.dataLength} / ${names.colCount})` + }; + if (cellTitles) { + addFacetCellTitles(group2, sizeSignals, axisTextColor); + } + return { + facetScope: group2, + sizeSignals, + offsets: offsets2 + }; } - return false; -} -function isnullorEmpty(value) { - if (value == null) return true; //double equal sign to also catch undefined - if (typeof value === 'string' && value.length === 0) return true; - return false; -} -class Exec { - constructor(search, columns){ - this.columns = columns; - this.groups = (0, _group.ensureSearchExpressionGroupArray)(search).map((g)=>{ - const expressions = g.expressions.filter(Boolean); - expressions.forEach((ex)=>{ - ex.column = this.getColumn(ex.name); - ex.valueBool = valueToBoolean(ex.value); - ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); - ex.stringOperation = isStringOperation(ex); - }); - const group = Object.assign(Object.assign({}, g), { - expressions - }); - return group; - }); + } + const layoutClasses = { + AggregateContainer, + AggregateSquare, + Band, + Cross, + Scatter: Scatter$1, + Square, + Stack, + Strip, + Treemap, + Wrap + }; + function getImageMark(backgroundImage, allGlobalScales) { + const xScale = allGlobalScales.filter((s) => s.scales.x)[0].scales.x[0]; + const yScale = allGlobalScales.filter((s) => s.scales.y)[0].scales.y[0]; + const [xScaleName, yScaleName] = [xScale, yScale].map((s) => s.name + (xScale.type === "band" ? bandScaleLinearSuffix : "")); + return { + type: "image", + encode: { + update: { + url: { + value: backgroundImage.url + }, + aspect: { + value: false + }, + baseline: { + value: "bottom" + }, + height: { + signal: getScaledSpan(yScaleName, backgroundImage.extents.bottom, backgroundImage.extents.top) + }, + y: { + signal: getScaledValue(yScaleName, backgroundImage.extents.bottom) + }, + width: { + signal: getScaledSpan(xScaleName, backgroundImage.extents.right, backgroundImage.extents.left) + }, + x: { + signal: getScaledValue(xScaleName, backgroundImage.extents.left) + } + } + } + }; + } + function getScaledSpan(scaleName, low, high) { + return `abs(scale('${scaleName}', ${low}) - scale('${scaleName}', ${high}))`; + } + function getScaledValue(scaleName, value2) { + return `scale('${scaleName}', ${value2})`; + } + class SpecBuilder { + constructor(props, specContext) { + this.props = props; + this.specContext = specContext; + this.globalSignals = { + facetAxesAdjustX: { name: SignalNames.FacetAxesAdjustX, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingLeft.toString() : "0" }, + facetAxesAdjustY: { name: SignalNames.FacetAxesAdjustY, update: props.facetLayout && props.collapseFacetAxes ? facetPaddingBottom.toString() : "0" }, + minCellWidth: { + name: SignalNames.MinCellWidth, + update: `${minFacetWidth}` + }, + minCellHeight: { name: SignalNames.MinCellHeight, update: `${minFacetHeight}` }, + plotOffsetLeft: { name: SignalNames.PlotOffsetLeft, update: "0" }, + plotOffsetTop: { name: SignalNames.PlotOffsetTop, update: "0" }, + plotOffsetBottom: { name: SignalNames.PlotOffsetBottom, update: "0" }, + plotOffsetRight: { name: SignalNames.PlotOffsetRight, update: "0" }, + plotHeightOut: { name: SignalNames.PlotHeightOut, update: SignalNames.PlotHeightIn }, + plotWidthOut: { name: SignalNames.PlotWidthOut, update: SignalNames.PlotWidthIn } + }; } - getColumn(name) { - for(let i = 0; i < this.columns.length; i++){ - if (this.columns[i].name == name) return this.columns[i]; - } - } - runExpressionOnColumn(datum, ex) { - const actualDataValue = datum[ex.name]; - if (ex.operator === 'isnullorEmpty') return isnullorEmpty(actualDataValue); - else if (ex.operator === '!isnullorEmpty') return !isnullorEmpty(actualDataValue); - let dataValue = actualDataValue; - let expressionValue = ex.value; - if (ex.column) { - if (ex.column.type === 'string' || ex.stringOperation) { - dataValue = valueToString(actualDataValue).toLocaleLowerCase(); - expressionValue = ex.valueLow; - } else if (ex.column.type === 'boolean') { - dataValue = valueToBoolean(actualDataValue); - expressionValue = ex.valueBool; - } else if (ex.column.quantitative) { - dataValue = +actualDataValue; - expressionValue = +ex.value; - } + validate() { + const { specContext } = this; + const { specCapabilities } = this.props; + const { roles } = specCapabilities; + const required2 = roles.filter((r) => { + switch (typeof r.allowNone) { + case "boolean": + return !r.allowNone; + case "undefined": + return true; + case "function": + return !r.allowNone(specContext); } - switch(ex.operator){ - case '!=': - return dataValue != expressionValue; - case '<': - return dataValue < expressionValue; - case '<=': - return dataValue <= expressionValue; - case '==': - return dataValue == expressionValue; - case '>': - return dataValue > expressionValue; - case '>=': - return dataValue >= expressionValue; - case 'contains': - return dataValue.indexOf(expressionValue) >= 0; - case '!contains': - return dataValue.indexOf(expressionValue) < 0; - case 'starts': - return dataValue.indexOf(expressionValue) == 0; - case '!starts': - return dataValue.indexOf(expressionValue) !== 0; - } - } - runExpression(datum, ex) { - if (ex.name == null) { - //run on all columns - const group = { - expressions: this.columns.map((column, i)=>{ - const ex2 = Object.assign(Object.assign({}, ex), { - column, - name: column.name - }); - if (i) ex2.clause = '||'; - return ex2; - }) - }; - return this.runGroup(datum, group); - } else return this.runExpressionOnColumn(datum, ex); - } - runGroup(datum, group) { - let accumulator = this.runExpression(datum, group.expressions[0]); - for(let i = 1; i < group.expressions.length; i++){ - const ex = group.expressions[i]; - switch(ex.clause){ - case '&&': - accumulator = accumulator && this.runExpression(datum, ex); - break; - case '||': - accumulator = accumulator || this.runExpression(datum, ex); - break; - } + }); + const numeric = roles.filter((r) => r.excludeCategoric); + const errors = required2.map((r) => { + if (specContext.specColumns[r.role]) { + return null; + } else { + return `Field ${r.role} is required.`; } - return accumulator; - } - run(datum) { - let accumulator = this.runGroup(datum, this.groups[0]); - for(let i = 1; i < this.groups.length; i++){ - const group = this.groups[i]; - switch(group.clause){ - case '&&': - accumulator = accumulator && this.runGroup(datum, group); - break; - case '||': - accumulator = accumulator || this.runGroup(datum, group); - break; - } + }).concat(numeric.map((r) => { + if (specContext.specColumns[r.role] && !specContext.specColumns[r.role].quantitative) { + return `Field ${r.role} must be quantitative.`; + } else { + return null; } - return accumulator; - } -} - -},{"./group":"hnSxg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1C30Z":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "invert", ()=>invert); -var _group = require("./group"); -function invertSearchExpressionGroup(input) { - //this only works if all expressions in this group have the same clause - const output = { - expressions: input.expressions.map(invertSearchExpression) - }; - if (input.clause) output.clause = invertedClauses[input.clause]; - return output; -} -const invertedOperators = { - '!=': '==', - '==': '!=', - '<': '>=', - '>=': '<', - '<=': '>', - '>': '<=', - '!contains': 'contains', - 'contains': '!contains', - '!isnullorEmpty': 'isnullorEmpty', - 'isnullorEmpty': '!isnullorEmpty', - '!starts': 'starts', - 'starts': '!starts' -}; -const invertedClauses = { - '&&': '||', - '||': '&&' -}; -function invertSearchExpression(input) { - const operator = invertedOperators[input.operator]; - const output = Object.assign(Object.assign({}, input), { - operator - }); - if (input.clause) output.clause = invertedClauses[input.clause]; - return output; -} -function invert(search) { - if (Array.isArray(search)) return search.map(invertSearchExpressionGroup); - else if ((0, _group.isSearchExpressionGroup)(search)) return invertSearchExpressionGroup(search); - else return invertSearchExpression(search); -} - -},{"./group":"hnSxg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8Cjqz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "narrow", ()=>narrow); -var _group = require("./group"); -function narrow(a, b) { - if (!a) return b; - const arrs = [ - a, - b - ].map((0, _group.ensureSearchExpressionGroupArray)); - const [arrA, arrB] = arrs; - arrB[0].clause = '&&'; - return arrA.concat(arrB); -} - -},{"./group":"hnSxg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2s9pC":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lMykT":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lwXkM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getColumnsFromData", ()=>(0, _sanddanceSpecs.getColumnsFromData)); -parcelHelpers.export(exports, "getStats", ()=>(0, _sanddanceSpecs.getStats)); -parcelHelpers.export(exports, "inferAll", ()=>(0, _sanddanceSpecs.inferAll)); -parcelHelpers.export(exports, "getPresenterStyle", ()=>(0, _defaults.getPresenterStyle)); -parcelHelpers.export(exports, "isInternalFieldName", ()=>isInternalFieldName); -var _constants = require("./constants"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _defaults = require("./defaults"); -function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { - if (includeVegaMorphChartsFields) { - if (columnName === (0, _constants.GL_ORDINAL)) return true; - } - for(const f in 0, _constants.FieldNames){ - if (columnName === (0, _constants.FieldNames)[f]) return true; + })).filter(Boolean); + const { backgroundImage } = specContext.insight; + if (backgroundImage && !backgroundImage.extents) { + errors.push("BackgroundImage must have extents."); + } + return errors; } - return false; -} - -},{"./constants":"bKPI3","@msrvida/sanddance-specs":"jgrWB","./defaults":"Bp4lx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Bp4lx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultViewerOptions", ()=>defaultViewerOptions); -parcelHelpers.export(exports, "getPresenterStyle", ()=>getPresenterStyle); -parcelHelpers.export(exports, "cssPrefix", ()=>cssPrefix); -parcelHelpers.export(exports, "dualColorSchemeColors", ()=>dualColorSchemeColors); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -const { defaultPresenterStyle } = _vegaMorphcharts.defaults; -const defaultViewerOptions = { - colors: { - activeCube: 'purple', - defaultCube: _vegaMorphcharts.util.colorToString(defaultPresenterStyle.defaultCubeColor), - hoveredCube: _vegaMorphcharts.util.colorToString(defaultPresenterStyle.highlightColor), - selectedCube: 'yellow', - axisSelectHighlight: _vegaMorphcharts.util.colorToString([ - 128, - 128, - 128, - 128 - ]), - axisLine: '#000', - axisText: '#000', - gridLine: '#CCC', - backgroundColor: '#FFF' - }, - language: { - headers: { - chart: 'Chart', - details: 'Details', - legend: 'Legend', - selection: 'Select & Filter' - }, - bing: 'bing', - newColorMap: 'remap color to filtered items', - oldColorMap: 'keep same colors', - deselect: 'deselect', - exclude: 'exclude', - isolate: 'isolate', - legendOther: 'other', - nextDetail: '>', - previousDetail: '<', - reset: 'reset', - colorBinCount: 'Color bin count', - colorReverse: 'Color reverse', - count: 'Count', - percent: 'Percent', - sum: 'Sum', - scatterPointScale: 'Point scale', - FacetMaxBins: 'Facet max bins', - FacetVMaxBins: 'Cross facet max bins', - XMaxBins: 'X axis max bins', - YMaxBins: 'Y axis max bins', - XGridSize: 'X grid size', - YGridSize: 'Y grid size', - InnerPaddingSize: 'Inner padding size', - OuterPaddingSize: 'Outer padding size', - treeMapMethod: 'Treemap layout', - facetColumns: 'Facet columns', - facetRows: 'Facet rows', - markOpacitySignal: 'Mark opacity', - textScaleSignal: 'Text scale', - xAxisTextAngleSignal: 'X axis text angle', - yAxisTextAngleSignal: 'Y axis text angle', - zGrounded: 'Z grounded', - zScaleProportion: 'Z scale proportion to Y', - selectionCount: (count)=>`${count} items selected` - }, - maxLegends: 19, - onError: (errors)=>{ - //console.log(`UnitVisViewer errors: ${errors.join('\n')}`); - }, - filterRenderingTimerPadding: 200, - selectionPolygonZ: -1, - tickSize: 10 -}; -function getPresenterStyle(options) { - const style = { - cssPrefix, - fontFamily: options.fontFamily, - defaultCubeColor: _vegaMorphcharts.util.colorFromString(options.colors.defaultCube) - }; - if (options.colors.hoveredCube) style.highlightColor = _vegaMorphcharts.util.colorFromString(options.colors.hoveredCube); - //if (options.lightSettings) { - // style.lightSettings = options.lightSettings; - //} - return style; -} -const cssPrefix = 'sanddance-'; -const dualColorSchemeColors = { - black: '#212121', - gray: '#D2D2D2', - blue: '#0060F0', - green: '#00C000', - orange: '#FF9900', - red: '#E00000' -}; - -},{"@msrvida/vega-morphcharts":"lOTjG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lOTjG":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>(0, _base.base)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "Presenter", ()=>(0, _presenter.Presenter)); -parcelHelpers.export(exports, "ViewGl", ()=>(0, _viewGl.ViewGl)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "controls", ()=>_controls); -parcelHelpers.export(exports, "defaults", ()=>_defaults); -parcelHelpers.export(exports, "types", ()=>_types); -parcelHelpers.export(exports, "util", ()=>_util); -var _controls = require("./exports/controls"); -var _types = require("./exports/types"); -var _util = require("./exports/util"); -var _defaults = require("./defaults"); -var _base = require("./base"); -var _presenter = require("./presenter"); -var _viewGl = require("./vega-classes/viewGl"); -var _enums = require("./enums"); -parcelHelpers.exportAll(_enums, exports); -var _version = require("./version"); - -},{"./exports/controls":"lDyXE","./exports/types":"faegL","./exports/util":"4xUmx","./defaults":"c3DaF","./base":"bxBcY","./presenter":"3NoKz","./vega-classes/viewGl":"98mkQ","./enums":"dvKuu","./version":"fBSq8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lDyXE":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize variables for documentation -parcelHelpers.export(exports, "Table", ()=>(0, _controls.Table)); -var _controls = require("../controls"); - -},{"../controls":"mTToq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"mTToq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -var _tsxCreateElement = require("tsx-create-element"); -const KeyCodes = { - ENTER: 'Enter' -}; -const Table = (props)=>{ - return (0, _tsxCreateElement.createElement)("table", { - className: props.className - }, props.children, props.rows.map((row, i)=>(0, _tsxCreateElement.createElement)("tr", { - className: props.rowClassName || '', - onClick: (e)=>props.onRowClick && props.onRowClick(e, i), - tabIndex: props.onRowClick ? 0 : -1, - onKeyUp: (e)=>{ - if (e.key === KeyCodes.ENTER && props.onRowClick) props.onRowClick(e, i); + build() { + var _a, _b; + const { globalSignals, specContext } = this; + const { facetLayout, specCapabilities } = this.props; + const { insight: insight2, specColumns, specViewOptions } = specContext; + const dataName = "data_source"; + const { vegaSpec, groupMark } = this.initSpec(dataName); + const { topColorField, colorDataName } = addColor({ + scope: vegaSpec, + dataName, + specContext, + scaleName: ScaleNames.Color, + legendDataName: "data_legend", + topLookupName: "data_topcolorlookup", + colorReverseSignalName: SignalNames.ColorReverse + }); + const globalScope = new GlobalScope({ + dataName: colorDataName, + markGroup: groupMark, + scope: vegaSpec, + signals: globalSignals + }); + if (facetLayout) { + addSignals(vegaSpec, { + name: SignalNames.FacetPaddingBottom, + update: `${facetLayout.facetPadding.bottom}` + }, { + name: SignalNames.FacetPaddingLeft, + update: `${facetLayout.facetPadding.left}` + }, { + name: SignalNames.FacetPaddingTop, + update: `${facetLayout.facetPadding.top}` + }); + globalSignals.plotOffsetTop.update = `${facetLayout.plotPadding.y}`; + globalSignals.plotOffsetRight.update = `${facetLayout.plotPadding.x}`; + } + const { firstScope, finalScope, specResult, allGlobalScales, allEncodingRules } = this.iterateLayouts(globalScope, (i, innerScope) => { + if (facetLayout && i === 0) { + globalScope.zSize = innerScope.offsets.h; + } + }); + if (specResult) { + return specResult; + } + if (allGlobalScales.length > 0) { + const plotHeightOut = globalSignals.plotHeightOut.name; + const plotWidthOut = globalSignals.plotWidthOut.name; + const colTitleScale = { + type: "linear", + name: "scale_facet_col_title", + domain: [0, 1], + range: [0, { signal: plotWidthOut }] + }; + const rowTitleScale = { + type: "linear", + name: "scale_facet_row_title", + domain: [0, 1], + range: [{ signal: plotHeightOut }, 0] + }; + const facetScope = facetLayout ? firstScope : null; + const backgroundGroup = facetLayout ? facetScope.facetScope : groupMark; + if (insight2.backgroundImage && specCapabilities.backgroundImage && ((_a = specColumns.x) === null || _a === void 0 ? void 0 : _a.quantitative) && ((_b = specColumns.y) === null || _b === void 0 ? void 0 : _b.quantitative)) { + if (!backgroundGroup.marks) { + backgroundGroup.marks = []; + } + const imageMark = getImageMark(insight2.backgroundImage, allGlobalScales); + backgroundGroup.marks.unshift(imageMark); + } + const axesScopes = facetLayout ? addFacetAxesGroupMarks({ + globalScope: globalScope.scope, + plotScope: groupMark, + facetScope, + colTitleScale, + rowTitleScale, + colSeqName: "data_FacetCellColTitles", + rowSeqName: "data_FacetCellRowTitles" + }) : { + main: [{ + scope: groupMark, + lines: true, + labels: true, + title: true + }] + }; + addGlobalAxes({ + globalScope, + allGlobalScales, + axisScales: this.props.axisScales, + plotOffsetSignals: { x: globalSignals.plotOffsetLeft, y: globalSignals.plotOffsetBottom }, + axesOffsets: { x: axesOffsetX, y: axesOffsetY }, + axesTitlePadding: facetLayout ? { x: axesTitlePaddingFacetX, y: axesTitlePaddingFacetY } : { x: axesTitlePaddingX, y: axesTitlePaddingY }, + labelBaseline: { x: "top", y: "middle" }, + specColumns, + specViewOptions, + axesScopes, + hideZAxis: !!facetLayout, + view: insight2.view + }); + } + if (finalScope.mark) { + const { update: update2 } = finalScope.mark.encode; + const outputDataName = "output"; + finalScope.mark.from.data = outputDataName; + addData(globalScope.markGroup, { + name: outputDataName, + source: globalScope.markDataName, + transform: [ + { + type: "formula", + expr: finalScope.offsets.x, + as: FieldNames.OffsetX + }, + { + type: "formula", + expr: finalScope.offsets.y, + as: FieldNames.OffsetY } - }, row.cells.map((cell, i)=>(0, _tsxCreateElement.createElement)("td", { - className: cell.className || '', - title: cell.title || '' - }, cell.content))))); -}; - -},{"tsx-create-element":"9w9U8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9w9U8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createElement", ()=>createElement); -parcelHelpers.export(exports, "addChild", ()=>addChild); -parcelHelpers.export(exports, "mount", ()=>mount); -parcelHelpers.export(exports, "findElementByChildPositions", ()=>findElementByChildPositions); -parcelHelpers.export(exports, "focusActiveElement", ()=>focusActiveElement); -parcelHelpers.export(exports, "setActiveElement", ()=>setActiveElement); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>getActiveElementInfo); -var _htmlTags = require("html-tags"); -var _svgTags = require("svg-tags"); -const htmlTagArray = _htmlTags.default || _htmlTags; -const svgTagArray = _svgTags.default || _svgTags; -/** - * Decamelizes a string with/without a custom separator (hyphen by default). - * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript - * - * @param str String in camelcase - * @param separator Separator for the new decamelized string. - */ function decamelize(str, separator = '-') { - return str.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2').replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2').toLowerCase(); -} -function createElement(tag, attrs, ...children) { - if (typeof tag === 'function') { - const fn = tag; - const props = attrs; - props.children = children; - return fn(props); - } else { - const ns = tagNamespace(tag); - const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); - const map = attrs; - let ref; - for(let name in map)if (name && map.hasOwnProperty(name)) { - let value = map[name]; - if (name === 'className' && value !== void 0) setAttribute(el, ns, 'class', value.toString()); - else if (name === 'disabled' && !value) ; - else if (value === null || value === undefined) continue; - else if (value === true) setAttribute(el, ns, name, name); - else if (typeof value === 'function') { - if (name === 'ref') ref = value; - else el[name.toLowerCase()] = value; - } else if (typeof value === 'object') setAttribute(el, ns, name, flatten(value)); - else setAttribute(el, ns, name, value.toString()); - } - if (children && children.length > 0) appendChildren(el, children); - if (ref) ref(el); - return el; - } -} -function setAttribute(el, ns, name, value) { - if (ns) el.setAttributeNS(null, name, value); - else el.setAttribute(name, value); -} -function flatten(o) { - const arr = []; - for(let prop in o)arr.push(`${decamelize(prop, '-')}:${o[prop]}`); - return arr.join(';'); -} -function addChild(parentElement, child) { - if (child === null || child === undefined || typeof child === "boolean") return; - else if (Array.isArray(child)) appendChildren(parentElement, child); - else if (isElement(child)) parentElement.appendChild(child); - else parentElement.appendChild(document.createTextNode(child.toString())); -} -function appendChildren(parentElement, children) { - children.forEach((child)=>addChild(parentElement, child)); -} -function isElement(el) { - //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType - return !!el.nodeType; -} -function mount(element, container) { - container.innerHTML = ''; - if (element) addChild(container, element); -} -function findElementByChildPositions(childPositions, container) { - let element = container || document.body; - let childPosition; - while(element && childPositions.length){ - childPosition = childPositions.shift(); - element = element.children.item(childPosition); - } - if (element) return element; -} -function focusActiveElement(element, activeElementInfo) { - element.focus(); - element.scrollTop = activeElementInfo.scrollTop; - const input = element; - if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); -} -function setActiveElement(activeElementInfo, container) { - if (activeElementInfo) { - const element = findElementByChildPositions(activeElementInfo.childPositions, container); - if (element) focusActiveElement(element, activeElementInfo); - } -} -function getActiveElementInfo(container) { - let element = document.activeElement; - const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element; - const activeElementInfo = { - childPositions: [], - scrollTop, - selectionDirection, - selectionEnd, - selectionStart - }; - while(element && element !== document.body && element !== container){ - activeElementInfo.childPositions.unshift(getChildPosition(element)); - element = element.parentElement; - } - if ((element === document.body || element === container) && activeElementInfo.childPositions.length) return activeElementInfo; -} -function getChildPosition(element) { - let childPosition = 0; - while(element = element.previousElementSibling)childPosition++; - return childPosition; -} -function tagNamespace(tag) { - //issue: this won't disambiguate certain tags which exist in both svg and html: <a>, <title> ... - if (tag === 'svg' || svgTagArray.indexOf(tag) >= 0 && !(htmlTagArray.indexOf(tag) >= 0)) return "http://www.w3.org/2000/svg"; -} - -},{"html-tags":"2VCdh","svg-tags":"gZvs0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2VCdh":[function(require,module,exports,__globalThis) { -'use strict'; -module.exports = require("6c9bf1ded7f8a5a1"); - -},{"6c9bf1ded7f8a5a1":"gXRj7"}],"gXRj7":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"abbr\",\"address\",\"area\",\"article\",\"aside\",\"audio\",\"b\",\"base\",\"bdi\",\"bdo\",\"blockquote\",\"body\",\"br\",\"button\",\"canvas\",\"caption\",\"cite\",\"code\",\"col\",\"colgroup\",\"data\",\"datalist\",\"dd\",\"del\",\"details\",\"dfn\",\"dialog\",\"div\",\"dl\",\"dt\",\"em\",\"embed\",\"fieldset\",\"figcaption\",\"figure\",\"footer\",\"form\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"header\",\"hgroup\",\"hr\",\"html\",\"i\",\"iframe\",\"img\",\"input\",\"ins\",\"kbd\",\"keygen\",\"label\",\"legend\",\"li\",\"link\",\"main\",\"map\",\"mark\",\"math\",\"menu\",\"menuitem\",\"meta\",\"meter\",\"nav\",\"noscript\",\"object\",\"ol\",\"optgroup\",\"option\",\"output\",\"p\",\"param\",\"picture\",\"pre\",\"progress\",\"q\",\"rb\",\"rp\",\"rt\",\"rtc\",\"ruby\",\"s\",\"samp\",\"script\",\"section\",\"select\",\"slot\",\"small\",\"source\",\"span\",\"strong\",\"style\",\"sub\",\"summary\",\"sup\",\"svg\",\"table\",\"tbody\",\"td\",\"template\",\"textarea\",\"tfoot\",\"th\",\"thead\",\"time\",\"title\",\"tr\",\"track\",\"u\",\"ul\",\"var\",\"video\",\"wbr\"]"); - -},{}],"gZvs0":[function(require,module,exports,__globalThis) { -module.exports = require("8c03a2b8d2417863"); - -},{"8c03a2b8d2417863":"1rF1l"}],"1rF1l":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"altGlyph\",\"altGlyphDef\",\"altGlyphItem\",\"animate\",\"animateColor\",\"animateMotion\",\"animateTransform\",\"circle\",\"clipPath\",\"color-profile\",\"cursor\",\"defs\",\"desc\",\"ellipse\",\"feBlend\",\"feColorMatrix\",\"feComponentTransfer\",\"feComposite\",\"feConvolveMatrix\",\"feDiffuseLighting\",\"feDisplacementMap\",\"feDistantLight\",\"feFlood\",\"feFuncA\",\"feFuncB\",\"feFuncG\",\"feFuncR\",\"feGaussianBlur\",\"feImage\",\"feMerge\",\"feMergeNode\",\"feMorphology\",\"feOffset\",\"fePointLight\",\"feSpecularLighting\",\"feSpotLight\",\"feTile\",\"feTurbulence\",\"filter\",\"font\",\"font-face\",\"font-face-format\",\"font-face-name\",\"font-face-src\",\"font-face-uri\",\"foreignObject\",\"g\",\"glyph\",\"glyphRef\",\"hkern\",\"image\",\"line\",\"linearGradient\",\"marker\",\"mask\",\"metadata\",\"missing-glyph\",\"mpath\",\"path\",\"pattern\",\"polygon\",\"polyline\",\"radialGradient\",\"rect\",\"script\",\"set\",\"stop\",\"style\",\"svg\",\"switch\",\"symbol\",\"text\",\"textPath\",\"title\",\"tref\",\"tspan\",\"use\",\"view\",\"vkern\"]"); - -},{}],"faegL":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize interfaces for documentation -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _interfaces.MorphChartsCore)); -var _interfaces = require("../interfaces"); - -},{"../interfaces":"eYe6N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eYe6N":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _morphcharts.Core)); -var _morphcharts = require("morphcharts"); - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lF8Ji":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Core", ()=>(0, _mainJs.Core)); -parcelHelpers.export(exports, "ModelView", ()=>(0, _mainJs.ModelView)); -parcelHelpers.export(exports, "SingleTouchAction", ()=>(0, _mainJs.SingleTouchAction)); -parcelHelpers.export(exports, "UnitType", ()=>(0, _mainJs.UnitType)); -parcelHelpers.export(exports, "Theme", ()=>(0, _mainJs.Theme)); -parcelHelpers.export(exports, "PickType", ()=>(0, _mainJs.PickType)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _mainJs.SelectionMode)); -parcelHelpers.export(exports, "HighlightMode", ()=>(0, _mainJs.HighlightMode)); -parcelHelpers.export(exports, "FilterMode", ()=>(0, _mainJs.FilterMode)); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>(0, _mainJs.AxesTextOrientation)); -parcelHelpers.export(exports, "Orientation", ()=>(0, _mainJs.Orientation)); -parcelHelpers.export(exports, "StereoMode", ()=>(0, _mainJs.StereoMode)); -parcelHelpers.export(exports, "RenderMode", ()=>(0, _mainJs.RenderMode)); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>(0, _mainJs.HorizontalAlignment)); -parcelHelpers.export(exports, "VerticalAlignment", ()=>(0, _mainJs.VerticalAlignment)); -parcelHelpers.export(exports, "LogLevel", ()=>(0, _mainJs.LogLevel)); -parcelHelpers.export(exports, "AxesVisibility", ()=>(0, _mainJs.AxesVisibility)); -parcelHelpers.export(exports, "Edge2D", ()=>(0, _mainJs.Edge2D)); -parcelHelpers.export(exports, "Edge3D", ()=>(0, _mainJs.Edge3D)); -parcelHelpers.export(exports, "Face2D", ()=>(0, _mainJs.Face2D)); -parcelHelpers.export(exports, "Face3D", ()=>(0, _mainJs.Face3D)); -parcelHelpers.export(exports, "PaletteName", ()=>(0, _paletteJs.PaletteName)); -parcelHelpers.export(exports, "PaletteResources", ()=>(0, _paletteJs.PaletteResources)); -parcelHelpers.export(exports, "PaletteType", ()=>(0, _paletteJs.PaletteType)); -parcelHelpers.export(exports, "Config", ()=>(0, _configJs.Config)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -parcelHelpers.export(exports, "Colors", ()=>(0, _colorsJs.Colors)); -parcelHelpers.export(exports, "Font", ()=>(0, _fontJs.Font)); -parcelHelpers.export(exports, "FontRasterizer", ()=>(0, _fontJs.FontRasterizer)); -parcelHelpers.export(exports, "FontAtlas", ()=>(0, _fontJs.FontAtlas)); -parcelHelpers.export(exports, "Map", ()=>(0, _mapJs.Map)); -parcelHelpers.export(exports, "MapRasterizer", ()=>(0, _mapJs.MapRasterizer)); -parcelHelpers.export(exports, "MapAtlas", ()=>(0, _mapJs.MapAtlas)); -parcelHelpers.export(exports, "Icons", ()=>(0, _iconsJs.Icons)); -parcelHelpers.export(exports, "IconsRasterizer", ()=>(0, _iconsJs.IconsRasterizer)); -parcelHelpers.export(exports, "IconsAtlas", ()=>(0, _iconsJs.IconsAtlas)); -parcelHelpers.export(exports, "Components", ()=>_indexJs); -parcelHelpers.export(exports, "Axes", ()=>_indexJs1); -parcelHelpers.export(exports, "Helpers", ()=>_indexJs2); -parcelHelpers.export(exports, "Layouts", ()=>_indexJs3); -parcelHelpers.export(exports, "Input", ()=>_indexJs4); -parcelHelpers.export(exports, "Providers", ()=>_indexJs5); -parcelHelpers.export(exports, "Meshes", ()=>_indexJs6); -parcelHelpers.export(exports, "Renderers", ()=>_indexJs7); -parcelHelpers.export(exports, "Tables", ()=>_indexJs8); -parcelHelpers.export(exports, "Cameras", ()=>_indexJs9); -var _mainJs = require("./main.js"); -var _paletteJs = require("./palette.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _colorsJs = require("./colors.js"); -var _fontJs = require("./font.js"); -var _mapJs = require("./map.js"); -var _iconsJs = require("./icons.js"); -var _indexJs = require("./components/index.js"); -var _indexJs1 = require("./components/axes/index.js"); -var _indexJs2 = require("./helpers/index.js"); -var _indexJs3 = require("./layouts/index.js"); -var _indexJs4 = require("./input/index.js"); -var _indexJs5 = require("./providers/index.js"); -var _indexJs6 = require("./meshes/index.js"); -var _indexJs7 = require("./renderers/index.js"); -var _indexJs8 = require("./tables/index.js"); -var _indexJs9 = require("./cameras/index.js"); - -},{"./main.js":"b6Xbk","./palette.js":"a14oj","./config.js":"fYehi","./constants.js":"dHTsY","./colors.js":"8FW7c","./font.js":"fn4YW","./map.js":"edWrj","./icons.js":"6zd9W","./components/index.js":"9pN13","./components/axes/index.js":"k6xxB","./helpers/index.js":"1IX9R","./layouts/index.js":"7e7Mi","./input/index.js":"eCWft","./providers/index.js":"azoZM","./meshes/index.js":"lHwiA","./renderers/index.js":"aAH73","./tables/index.js":"kKGRB","./cameras/index.js":"faZ4P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b6Xbk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ModelView", ()=>ModelView); -parcelHelpers.export(exports, "Core", ()=>Core); -parcelHelpers.export(exports, "CameraMode", ()=>CameraMode); -parcelHelpers.export(exports, "StereoMode", ()=>StereoMode); -parcelHelpers.export(exports, "SelectionMode", ()=>SelectionMode); -parcelHelpers.export(exports, "FilterMode", ()=>FilterMode); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>HorizontalAlignment); -parcelHelpers.export(exports, "VerticalAlignment", ()=>VerticalAlignment); -parcelHelpers.export(exports, "TextAlignment", ()=>TextAlignment); -parcelHelpers.export(exports, "Orientation", ()=>Orientation); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>AxesTextOrientation); -parcelHelpers.export(exports, "AxesVisibility", ()=>AxesVisibility); -parcelHelpers.export(exports, "PickType", ()=>PickType); -parcelHelpers.export(exports, "Theme", ()=>Theme); -parcelHelpers.export(exports, "HighlightMode", ()=>HighlightMode); -parcelHelpers.export(exports, "UnitType", ()=>UnitType); -parcelHelpers.export(exports, "SingleTouchAction", ()=>SingleTouchAction); -parcelHelpers.export(exports, "MouseWheelAction", ()=>MouseWheelAction); -parcelHelpers.export(exports, "LogLevel", ()=>LogLevel); -parcelHelpers.export(exports, "Edge2D", ()=>Edge2D); -parcelHelpers.export(exports, "Face2D", ()=>Face2D); -parcelHelpers.export(exports, "Edge3D", ()=>Edge3D); -parcelHelpers.export(exports, "Face3D", ()=>Face3D); -parcelHelpers.export(exports, "HexOrientation", ()=>HexOrientation); -parcelHelpers.export(exports, "RenderMode", ()=>RenderMode); -var _glMatrix = require("gl-matrix"); -var _altazimuthJs = require("./cameras/altazimuth.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _debugJs = require("./debug.js"); -var _fpsJs = require("./fps.js"); -var _angleJs = require("./helpers/angle.js"); -var _paletteJs = require("./palette.js"); -var _controllerJs = require("./components/controller.js"); -var _matrixJs = require("./helpers/matrix.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _fontJs = require("./font.js"); -var _vertexJs = require("./vertex.js"); -var _managerJs = require("./input/manager.js"); -var _logJs = require("./log.js"); -var _mathJs = require("./helpers/math.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); + ] }); + update2.x = { + field: FieldNames.OffsetX + }; + update2.y = { + field: FieldNames.OffsetY + }; + allEncodingRules.forEach((map2) => { + for (const key2 in map2) { + if (update2[key2]) { + const arrIn = map2[key2]; + if (!Array.isArray(update2[key2])) { + const value2 = update2[key2]; + const arrOut = []; + update2[key2] = arrOut; + arrIn.forEach((rule2) => arrOut.push(rule2)); + arrOut.push(value2); + } else { + const arrOut = update2[key2]; + arrIn.forEach((rule2) => arrOut.unshift(rule2)); + } + } + } + }); + update2.fill = fill(specContext, topColorField, ScaleNames.Color); + update2.opacity = opacity(); + } + return { + specCapabilities, + vegaSpec + }; } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } + initSpec(dataName) { + const { globalSignals } = this; + const { facetAxesAdjustX, facetAxesAdjustY, minCellWidth, minCellHeight, plotOffsetLeft, plotOffsetBottom, plotOffsetTop, plotOffsetRight, plotHeightOut, plotWidthOut } = globalSignals; + const { specContext } = this; + const { insight: insight2 } = specContext; + const groupMark = { + type: "group", + //style: 'cell', + encode: { + update: { + x: { signal: `${SignalNames.PlotOffsetLeft} - ${SignalNames.FacetAxesAdjustX}` }, + y: { signal: SignalNames.PlotOffsetTop }, + height: { signal: `${SignalNames.PlotHeightOut} - ${SignalNames.FacetAxesAdjustY}` }, + width: { signal: `${SignalNames.PlotWidthOut} + ${SignalNames.FacetAxesAdjustX}` } + } + } + }; + const inputDataname = "input"; + const vegaSpec = { + $schema: "https://vega.github.io/schema/vega/v5.json", + //style: 'cell', + data: [{ name: inputDataname }, { name: dataName, source: inputDataname, transform: [] }], + marks: [groupMark], + signals: textSignals(specContext, SignalNames.ViewportHeight).concat([ + minCellWidth, + minCellHeight, + { + name: SignalNames.ViewportHeight, + update: `max(${SignalNames.MinCellHeight}, ${insight2.size.height})` + }, + { + name: SignalNames.ViewportWidth, + update: `max(${SignalNames.MinCellWidth}, ${insight2.size.width})` + }, + plotOffsetLeft, + plotOffsetTop, + plotOffsetBottom, + plotOffsetRight, + facetAxesAdjustX, + facetAxesAdjustY, + { + name: SignalNames.PlotHeightIn, + update: `${SignalNames.ViewportHeight} - ${SignalNames.PlotOffsetBottom} + ${SignalNames.FacetAxesAdjustY}` + }, + { + name: SignalNames.PlotWidthIn, + update: `${SignalNames.ViewportWidth} - ${SignalNames.PlotOffsetLeft} - ${SignalNames.PlotOffsetRight}` + }, + plotHeightOut, + plotWidthOut, + { + name: "height", + update: `${SignalNames.PlotOffsetTop} + ${SignalNames.PlotHeightOut} + ${SignalNames.PlotOffsetBottom} - ${SignalNames.FacetAxesAdjustY}` + }, + { + name: "width", + update: `${SignalNames.PlotWidthOut} + ${SignalNames.PlotOffsetLeft} + ${SignalNames.PlotOffsetRight}` + } + ]) + }; + return { vegaSpec, groupMark }; + } + iterateLayouts(globalScope, onLayoutBuild) { + let specResult; + let parentScope = { + sizeSignals: globalScope.sizeSignals, + offsets: globalScope.offsets + }; + let firstScope; + let childScope; + const groupings = []; + const { layouts, specCapabilities } = this.props; + const allGlobalScales = []; + const allEncodingRules = []; + for (let i = 0; i < layouts.length; i++) { + if (!parentScope) + continue; + const buildProps = { + globalScope, + parentScope, + axesScales: this.props.axisScales, + groupings, + id: i + }; + const layout = this.createLayout(layouts[i], buildProps); + try { + childScope = layout.build(); + childScope.id = i; + const groupby = layout.getGrouping(); + if (groupby) { + groupings.push({ + id: i, + groupby, + fieldOps: [ + { field: null, op: "count", as: FieldNames.Count } + ] + }); + } + const sumOp = layout.getAggregateSumOp(); + if (sumOp) { + groupings[groupings.length - 1].fieldOps.push(sumOp); + } + onLayoutBuild(i, childScope); + } catch (e) { + specResult = { + errors: [e.stack], + specCapabilities, + vegaSpec: null + }; + break; } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + if (childScope && childScope.globalScales) { + allGlobalScales.push(childScope.globalScales); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + if (childScope.encodingRuleMap) { + allEncodingRules.push(childScope.encodingRuleMap); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class ModelView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - this.manipulationOrigin = (0, _glMatrix.vec3).create(); - this.rotation = (0, _glMatrix.quat).create(); - (0, _glMatrix.vec3).set(this.position, 0, 0, -core.config.modelDistance); - this.scale = core.config.modelSize; - } -} -class Core { - get container() { - return this._container; - } - get started() { - return this._started; - } - get debugText() { - return this._debugText; - } - get log() { - return this._log; - } - get totalFrames() { - return this._fps.totalFrames; - } - get camera() { - return this._camera; - } - set camera(value) { - this._camera = value; - } - getModelRotation(value) { - (0, _glMatrix.quat).copy(value, this._modelRotation); - } - setModelRotation(value, isSmooth) { - (0, _glMatrix.quat).copy(this._modelRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - getModelScale() { - return this._modelScale[0]; + if (i === 0) { + firstScope = childScope; + } + parentScope = childScope; + } + return { firstScope, finalScope: parentScope, specResult, allGlobalScales, allEncodingRules }; } - setModelScale(value, isSmooth) { - (0, _glMatrix.vec3).set(this._modelScale, value, value, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); + createLayout(layoutPair, buildProps) { + const { layoutType, props } = layoutPair; + const layoutBuildProps = Object.assign(Object.assign({}, props), buildProps); + const layoutClass = layoutClasses[layoutType]; + const layout = new layoutClass(layoutBuildProps); + layout.id = buildProps.id; + return layout; } - getModelManipulationOrigin(value) { - (0, _glMatrix.vec3).copy(value, this._modelManipulationOrigin); + } + function build(specContext, currData) { + const { specColumns } = specContext; + const columns = [ + specColumns.color, + specColumns.facet, + specColumns.facetV, + specColumns.group, + specColumns.size, + specColumns.sort, + specColumns.x, + specColumns.y, + specColumns.z + ]; + inferAll(columns, currData); + const specBuilderProps = getSpecBuilderPropsForChart(specContext); + const specBuilder = new SpecBuilder(specBuilderProps, specContext); + let specResult; + if (specBuilder) { + try { + const errors = specBuilder.validate(); + if (errors.length) { + specResult = { + errors, + specCapabilities: specBuilderProps.specCapabilities, + vegaSpec: null + }; + } else { + specResult = specBuilder.build(); + } + } catch (e) { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [e.stack] + }; + } + if (!specResult.errors) { + const data0 = specResult.vegaSpec.data[0]; + data0.values = currData; + } + } else { + specResult = { + specCapabilities: null, + vegaSpec: null, + errors: [`could not build spec for ${specContext.insight.chart}`] + }; } - setModelManipulationOrigin(value) { - this._updateManipulationOrigin(value); + return specResult; + } + const GL_ORDINAL = "GL_ORDINAL"; + function isSearchExpressionGroup(search) { + if (!search) { + return false; } - getModelPosition(value) { - (0, _glMatrix.vec3).copy(value, this._modelPosition); + return !!search.expressions; + } + function createGroupFromExpression(input) { + const output2 = { + expressions: [input] + }; + return output2; + } + function ensureSearchExpressionGroupArray(search) { + if (Array.isArray(search)) { + return [...search]; + } else if (isSearchExpressionGroup(search)) { + return [search]; + } else { + return [createGroupFromExpression(search)]; } - setModelPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._modelPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); + } + const expressionKeys = Object.keys({ + clause: null, + name: null, + operator: null, + value: null + }); + function compareExpression(a2, b2) { + if (a2 && b2) { + for (let k = 0; k < expressionKeys.length; k++) { + const key2 = expressionKeys[k]; + if (a2[key2] != b2[key2]) + return false; + } + } else { + return !a2 && !b2; } - get webXRSession() { - return this._webXRSession; + return true; + } + const groupKeys = Object.keys({ + clause: null + }); + function compareGroup(a2, b2) { + for (let k = 0; k < groupKeys.length; k++) { + const key2 = groupKeys[k]; + if (a2[key2] != b2[key2]) + return false; } - get renderer() { - return this._renderer; + if (!a2.expressions && !b2.expressions) + return true; + if (!a2.expressions || !b2.expressions) + return false; + if (a2.expressions.length != b2.expressions.length) + return false; + for (let i = 0; i < a2.expressions.length; i++) { + if (!compareExpression(a2.expressions[i], b2.expressions[i])) + return false; } - set renderer(renderer) { - if (this._renderer == renderer) return; - if (this._renderer) { - this.stop(); - this._renderer.remove(); - } - if (!renderer.isInitialized) renderer.initialize(this); - if (this._renderer) { - renderer.transitionTime = this._renderer.transitionTime; - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const previousTransitionBuffer = this._renderer.transitionBuffers[i]; - const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); - transitionBuffer.copyFrom(previousTransitionBuffer); - renderer.transitionBuffers.push(transitionBuffer); - } - const currentAxes = this._renderer.currentAxes; - if (currentAxes) { - renderer.currentAxes = []; - for(let i = 0; i < currentAxes.length; i++){ - const axesVisual = currentAxes[i]; - const axes = axesVisual.axes; - if (axes instanceof (0, _cartesian3DJs.Cartesian3dAxes)) { - const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); - renderer.currentAxes.push(cartesian3dAxesVisual); - } else if (axes instanceof (0, _cartesian2DJs.Cartesian2dAxes)) renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); - } - } - const labelSets = this._renderer.labelSets; - if (labelSets) { - renderer.labelSets = []; - for(let i = 0; i < labelSets.length; i++)renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); - } - const images = this._renderer.images; - if (images) { - renderer.images = []; - for(let i = 0; i < images.length; i++)renderer.images.push(renderer.createImageVisual(images[i].image)); - } - const fonts = this._renderer.fonts; - if (fonts) for(const key in fonts){ - const font = fonts[key].font; - renderer.fonts[font.name] = renderer.createFontVisual(font); - } - } else renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); - if (this._renderer) this._renderer.finalize(); - this._renderer = renderer; - this._fps.reset(); - this.start(); + return true; + } + function compare(a2, b2) { + if (a2 == b2) + return true; + if (!a2 || !b2) + return false; + const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); + const [arrA, arrB] = arrs; + if (arrA.length != arrB.length) + return false; + for (let i = 0; i < arrA.length; i++) { + if (!compareGroup(arrA[i], arrB[i])) + return false; } - get font() { - return this._font; + return true; + } + function valueToBoolean(value2) { + if (typeof value2 === "string") { + switch (value2.toLowerCase()) { + case "true": + return true; + case "false": + return false; + } } - get paletteResources() { - return this._paletteResources; + return !!value2; + } + function valueToString(value2) { + if (value2 == null) { + return ""; + } + switch (typeof value2) { + case "string": + return value2; + case "boolean": + case "number": + return value2.toString(); + } + return ""; + } + function isStringOperation(ex) { + switch (ex.operator) { + case "contains": + case "!contains": + case "starts": + case "!starts": + return true; } - get config() { - return this._config; + return false; + } + function isnullorEmpty(value2) { + if (value2 == null) + return true; + if (typeof value2 === "string" && value2.length === 0) + return true; + return false; + } + class Exec { + constructor(search, columns) { + this.columns = columns; + this.groups = ensureSearchExpressionGroupArray(search).map((g) => { + const expressions = g.expressions.filter(Boolean); + expressions.forEach((ex) => { + ex.column = this.getColumn(ex.name); + ex.valueBool = valueToBoolean(ex.value); + ex.valueLow = valueToString(ex.value).toLocaleLowerCase(); + ex.stringOperation = isStringOperation(ex); + }); + const group2 = Object.assign(Object.assign({}, g), { expressions }); + return group2; + }); } - get inputManager() { - return this._inputManager; - } - constructor(options){ - (0, _glMatrix.glMatrix).setMatrixArrayType(Array); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat4 = (0, _glMatrix.mat4).create(); - this._container = options && options.container ? options.container : document.body; - this._config = new (0, _configJs.Config)(this); - this._log = new (0, _logJs.Log)(this); - this._debugText = new (0, _debugJs.DebugText)(); - this._inputManager = options && options.useInputManager === false ? null : new (0, _managerJs.Manager)(this); - const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { - fontAtlas: new (0, _fontJs.FontAtlas)(256, 512), - fontSize: 24, - border: 3, - fontFamily: "\"segoe ui semibold\", sans-serif", - fontWeight: "normal", - fontStyle: "normal", - baseline: "alphabetic", - maxDistance: 8, - edgeValue: 0xc0 - }; - const fontRasterizer = new (0, _fontJs.FontRasterizer)(this, fontRasterizerOptions); - this._font = fontRasterizer.font; - this._paletteResources = new (0, _paletteJs.PaletteResources)(); - this._previousTime = 0; - this._fps = new (0, _fpsJs.Fps)(this); - this._modelMMatrix = (0, _glMatrix.mat4).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelRotation = (0, _glMatrix.quat).create(); - this._modelScale = (0, _glMatrix.vec3).create(); - this._smoothedModelPosition = (0, _glMatrix.vec3).create(); - this._smoothedModelRotation = (0, _glMatrix.quat).create(); - this._smoothedModelScale = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._camera = new (0, _altazimuthJs.AltAzimuthCamera)(this); - this.resetModel(false); + getColumn(name) { + for (let i = 0; i < this.columns.length; i++) { + if (this.columns[i].name == name) { + return this.columns[i]; + } + } } - getView(view) { - this.getModelPosition(view.position); - this.getModelRotation(view.rotation); - view.scale = this.getModelScale(); + runExpressionOnColumn(datum2, ex) { + const actualDataValue = datum2[ex.name]; + if (ex.operator === "isnullorEmpty") { + return isnullorEmpty(actualDataValue); + } else if (ex.operator === "!isnullorEmpty") { + return !isnullorEmpty(actualDataValue); + } + let dataValue = actualDataValue; + let expressionValue = ex.value; + if (ex.column) { + if (ex.column.type === "string" || ex.stringOperation) { + dataValue = valueToString(actualDataValue).toLocaleLowerCase(); + expressionValue = ex.valueLow; + } else if (ex.column.type === "boolean") { + dataValue = valueToBoolean(actualDataValue); + expressionValue = ex.valueBool; + } else if (ex.column.quantitative) { + dataValue = +actualDataValue; + expressionValue = +ex.value; + } + } + switch (ex.operator) { + case "!=": + return dataValue != expressionValue; + case "<": + return dataValue < expressionValue; + case "<=": + return dataValue <= expressionValue; + case "==": + return dataValue == expressionValue; + case ">": + return dataValue > expressionValue; + case ">=": + return dataValue >= expressionValue; + case "contains": + return dataValue.indexOf(expressionValue) >= 0; + case "!contains": + return dataValue.indexOf(expressionValue) < 0; + case "starts": + return dataValue.indexOf(expressionValue) == 0; + case "!starts": + return dataValue.indexOf(expressionValue) !== 0; + } } - setView(view, isSmooth) { - this.setModelPosition(view.position, isSmooth); - this.setModelRotation(view.rotation, isSmooth); - this.setModelScale(view.scale, isSmooth); + runExpression(datum2, ex) { + if (ex.name == null) { + const group2 = { + expressions: this.columns.map((column, i) => { + const ex2 = Object.assign(Object.assign({}, ex), { column, name: column.name }); + if (i) { + ex2.clause = "||"; + } + return ex2; + }) + }; + return this.runGroup(datum2, group2); + } else { + return this.runExpressionOnColumn(datum2, ex); + } } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setModelPosition(this._vec3, false); - (0, _glMatrix.quat).slerp(this._quat, from.rotation, to.rotation, time); - this.setModelRotation(this._quat, false); - this.setModelScale((0, _mathJs.MathHelper).lerp(from.scale, to.scale, time), false); + runGroup(datum2, group2) { + let accumulator = this.runExpression(datum2, group2.expressions[0]); + for (let i = 1; i < group2.expressions.length; i++) { + const ex = group2.expressions[i]; + switch (ex.clause) { + case "&&": + accumulator = accumulator && this.runExpression(datum2, ex); + break; + case "||": + accumulator = accumulator || this.runExpression(datum2, ex); + break; + } + } + return accumulator; + } + run(datum2) { + let accumulator = this.runGroup(datum2, this.groups[0]); + for (let i = 1; i < this.groups.length; i++) { + const group2 = this.groups[i]; + switch (group2.clause) { + case "&&": + accumulator = accumulator && this.runGroup(datum2, group2); + break; + case "||": + accumulator = accumulator || this.runGroup(datum2, group2); + break; + } + } + return accumulator; } - resetModel(isSmooth) { - (0, _glMatrix.vec3).set(this._modelPosition, 0, 0, -this._config.modelDistance); - (0, _glMatrix.vec3).set(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); - (0, _glMatrix.quat).set(this._modelRotation, 0, 0, 0, 1); - if (!isSmooth) this._syncSmooth(); + } + function invertSearchExpressionGroup(input) { + const output2 = { + expressions: input.expressions.map(invertSearchExpression) + }; + if (input.clause) { + output2.clause = invertedClauses[input.clause]; } - resetManipulationOrigin() { - if (!(0, _glMatrix.vec3).exactEquals(this._modelManipulationOrigin, (0, _constantsJs.Constants).VECTOR3_ZERO)) this._updateManipulationOrigin((0, _constantsJs.Constants).VECTOR3_ZERO); + return output2; + } + const invertedOperators = { + "!=": "==", + "==": "!=", + "<": ">=", + ">=": "<", + "<=": ">", + ">": "<=", + "!contains": "contains", + "contains": "!contains", + "!isnullorEmpty": "isnullorEmpty", + "isnullorEmpty": "!isnullorEmpty", + "!starts": "starts", + "starts": "!starts" + }; + const invertedClauses = { + "&&": "||", + "||": "&&" + }; + function invertSearchExpression(input) { + const operator2 = invertedOperators[input.operator]; + const output2 = Object.assign(Object.assign({}, input), { operator: operator2 }); + if (input.clause) { + output2.clause = invertedClauses[input.clause]; } - reset(isSmooth) { - this.resetModel(isSmooth); - this.resetManipulationOrigin(); - this._camera.reset(isSmooth); + return output2; + } + function invert$1(search) { + if (Array.isArray(search)) { + return search.map(invertSearchExpressionGroup); + } else if (isSearchExpressionGroup(search)) { + return invertSearchExpressionGroup(search); + } else { + return invertSearchExpression(search); } - start() { - if (!this._started && this._renderer) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - this._started = true; - this._log.write(LogLevel.info, "render loop started"); - if (this.startCallback) this.startCallback(); - } + } + function narrow(a2, b2) { + if (!a2) { + return b2; } - stop() { - if (this._started) { - this._started = false; - if (this._windowAnimationFrame != null) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - this._log.write(LogLevel.info, "render loop stopped"); + const arrs = [a2, b2].map(ensureSearchExpressionGroupArray); + const [arrA, arrB] = arrs; + arrB[0].clause = "&&"; + return arrA.concat(arrB); + } + const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + function decamelize(str, separator = "-") { + return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2").toLowerCase(); + } + function createElement(tag, attrs, ...children2) { + if (typeof tag === "function") { + const fn2 = tag; + let props = attrs; + if (props === null || props === void 0) { + props = { children: children2 }; + } else { + props.children = children2; + } + return fn2(props); + } else { + const ns = tag === "svg" ? SVG_NAMESPACE : null; + const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); + const map2 = attrs; + let ref2; + for (let name in map2) { + if (name && map2.hasOwnProperty(name)) { + let value2 = map2[name]; + if (name === "className" && value2 !== void 0) { + setAttribute(el, ns, "class", value2.toString()); + } else if (name === "disabled" && !value2) ; + else if (value2 === null || value2 === void 0) { + continue; + } else if (value2 === true) { + setAttribute(el, ns, name, name); + } else if (typeof value2 === "function") { + if (name === "ref") { + ref2 = value2; + } else { + el[name.toLowerCase()] = value2; } - if (this.stopCallback) this.stopCallback(); + } else if (typeof value2 === "object") { + setAttribute(el, ns, name, flatten(value2)); + } else { + setAttribute(el, ns, name, value2.toString()); + } } + } + if (children2 && children2.length > 0) { + appendChildren(el, children2); + } + if (ref2) { + ref2(el); + } + return el; } - checkWebXRSupport() { - const xrSystem = navigator.xr; - if (xrSystem) xrSystem.isSessionSupported("immersive-vr").then((supported)=>{ - if (supported) { - this._log.write(LogLevel.info, "WebXR supported"); - if (this.webXRSupportedCallback) this.webXRSupportedCallback(); - } - }); + } + function setAttribute(el, ns, name, value2) { + if (ns) { + el.setAttributeNS(null, name, value2); + } else { + el.setAttribute(name, value2); } - requestWebXRSession() { - if (this._webXRSession) this._webXRSession.end(); - else navigator.xr.requestSession("immersive-vr").then((session)=>this._webXRSessionStarted(session)); + } + function flatten(o) { + const arr = []; + for (let prop in o) + arr.push(`${decamelize(prop, "-")}:${o[prop]}`); + return arr.join(";"); + } + function isInsideForeignObject(element2) { + let current = element2; + while (current) { + if (current.tagName.toLowerCase() === "foreignobject") { + return true; + } + current = current.parentElement; } - _webXRSessionStarted(session) { - if (this.webXRSessionStartedCallback) this.webXRSessionStartedCallback(); - this._webXRSession = session; - session.onend = ()=>this._webXRSessionEnded(); - this._renderer.initializeWebXR(session).then(()=>{ - if (this._windowAnimationFrame) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - } - session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - }); - session.oninputsourceschange = (event)=>this._webXRInputSourcesChanged(event); + return false; + } + function recreateWithSvgNamespace(element2) { + const svgElement = document.createElementNS(SVG_NAMESPACE, element2.tagName.toLowerCase()); + for (let i = 0; i < element2.attributes.length; i++) { + const attr2 = element2.attributes[i]; + svgElement.setAttributeNS(null, attr2.name, attr2.value); + } + const eventProperties = [ + "onclick", + "onmousedown", + "onmouseup", + "onmouseover", + "onmouseout", + "onmousemove", + "onkeydown", + "onkeyup", + "onkeypress", + "onfocus", + "onblur" + ]; + for (const prop of eventProperties) { + if (element2[prop]) { + svgElement[prop] = element2[prop]; + } } - _webXRSessionEnded() { - if (this.webXRSessionEndedCallback) this.webXRSessionEndedCallback(); - this._webXRSession = null; - this._renderer.controllers.length = 0; - this.start(); - } - _webXRInputSourcesChanged(event) { - if (event.added.length > 0) { - const added = event.added[0]; - if (added.targetRayMode == "tracked-pointer") { - const profiles = added.profiles; - const handedness = added.handedness; - if (this.webXRInputSourceRequestCallback) this.webXRInputSourceRequestCallback(profiles, handedness, (response)=>{ - const options = { - profiles: profiles, - handedness: handedness, - obj: response.obj, - texture: response.texture - }; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - }, (e)=>{ - this._log.write(LogLevel.error, e); - }); - else { - const options = {}; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - } - } - } - if (event.removed.length > 0) this.renderer.controllers.length = 0; + for (let i = 0; i < element2.childNodes.length; i++) { + const child = element2.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) { + svgElement.appendChild(recreateWithSvgNamespace(child)); + } else { + svgElement.appendChild(child.cloneNode(true)); + } } - _tick(currentTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - let elapsedTime = currentTime - this._previousTime; - this._previousTime = currentTime; - if (elapsedTime > 0) { - this.update(elapsedTime, xrFrame); - yield this.render(elapsedTime, xrFrame); - } - if (xrFrame) xrFrame.session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - else if (this._started) this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - }); + return svgElement; + } + function addChild(parentElement, child) { + if (child === null || child === void 0 || typeof child === "boolean") { + return; + } else if (Array.isArray(child)) { + appendChildren(parentElement, child); + } else if (isElement(child)) { + const childEl = child; + if (parentElement.namespaceURI === SVG_NAMESPACE && childEl.namespaceURI !== SVG_NAMESPACE && childEl.tagName.toLowerCase() !== "foreignobject" && !isInsideForeignObject(parentElement)) { + const recreated = recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } else { + parentElement.appendChild(childEl); + } + } else { + parentElement.appendChild(document.createTextNode(child.toString())); } - update(elapsedTime, xrFrame) { - this._renderer.setSize(elapsedTime); - if (this.updateCallback) this.updateCallback(elapsedTime, xrFrame); - if (this._config.isDebugVisible) this._debugText.clear(); - this._fps.update(elapsedTime); - if (this._inputManager) { - this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; - this._inputManager.update(elapsedTime, xrFrame); - } - let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); - amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); - amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); - this._renderer.mMatrix = this._modelMMatrix; - if (this._config.isDebugVisible) { - this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); - this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); - this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); - this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); - this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); - this._debugText.addLine(`cam fov ${Math.round((0, _angleJs.AngleHelper).radiansToDegrees(this._config.fov))}`); - this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); - } - if (!xrFrame) { - this._camera.width = this._renderer.width; - this._camera.height = this._renderer.height; - this._camera.modelMMatrix = this._modelMMatrix; - this._camera.modelPosition = this._smoothedModelPosition; - this._camera.modelRotation = this._smoothedModelRotation; - this._camera.modelScale = this._smoothedModelScale; - this._camera.modelManipulationOrigin = this._modelManipulationOrigin; - this._camera.update(elapsedTime); - this._renderer.vMatrices = this._camera.vMatrices; - this._renderer.mvMatrices = this._camera.mvMatrices; - this._renderer.pMatrices = this._camera.pMatrices; - this._renderer.inverseVMatrices = this._camera.inverseVMatrices; - this._renderer.inversePMatrices = this._camera.inversePMatrices; - } - this._renderer.prepare(xrFrame); - if (!xrFrame && this._config.stereoMode == StereoMode.none) this._renderer.pickPMatrix = this._camera.pMatrices[0]; - else { - const fov = (0, _matrixJs.MatrixHelper).fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); - (0, _glMatrix.mat4).perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); - this._renderer.pickPMatrix = this._mat4; - } - if (this._renderer.isInitialized) this._renderer.update(elapsedTime); + } + function appendChildren(parentElement, children2) { + children2.forEach((child) => addChild(parentElement, child)); + } + function isElement(el) { + return !!el.nodeType; + } + function mount(element2, container) { + container.innerHTML = ""; + if (element2) { + addChild(container, element2); } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - this._fps.render(); - if (this._renderer.isInitialized) { - yield this._renderer.render(elapsedTime, xrFrame); - if (this.afterRenderCallback) this.afterRenderCallback(); - } - }); + } + function findElementByChildPositions(childPositions, container) { + let element2 = container || document.body; + let childPosition; + while (element2 && childPositions.length) { + childPosition = childPositions.shift(); + element2 = element2.children.item(childPosition); } - _syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); - (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - _updateManipulationOrigin(position) { - this._log.write(LogLevel.info, `manipulation origin ${position[0].toFixed(3)},${position[1].toFixed(3)},${position[2].toFixed(3)}`); - this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).copy(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).transformMat4(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); - (0, _glMatrix.vec3).subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - if (this.manipulationOriginChangedCallback) { - const result = { - x: position[0], - y: position[1], - z: position[2] - }; - this.manipulationOriginChangedCallback(result); - } - } - pickLasso(x0, y0, x1, y1, pickType) { - const inverseMMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).invert(inverseMMatrix, this._modelMMatrix); - const sets = []; - const nearPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const farPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const directions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._camera.unproject(nearPositions[0], x0, y1, -1); - this._camera.unproject(farPositions[0], x0, y1, 1); - this._camera.unproject(nearPositions[1], x1, y1, -1); - this._camera.unproject(farPositions[1], x1, y1, 1); - this._camera.unproject(nearPositions[2], x1, y0, -1); - this._camera.unproject(farPositions[2], x1, y0, 1); - this._camera.unproject(nearPositions[3], x0, y0, -1); - this._camera.unproject(farPositions[3], x0, y0, 1); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).transformMat4(nearPositions[i], nearPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).transformMat4(farPositions[i], farPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).subtract(directions[i], farPositions[i], nearPositions[i]); - (0, _glMatrix.vec3).normalize(directions[i], directions[i]); - } - const normals = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const d = []; - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).cross(normals[i], directions[(i + 1) % 4], directions[i]); - (0, _glMatrix.vec3).normalize(normals[i], normals[i]); - d.push(-(0, _glMatrix.vec3).dot(normals[i], nearPositions[i])); - } - if (pickType == PickType.data) { - const translation = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const transitionBuffer = this._renderer.transitionBuffers[i]; - const set = new Set(); - if (transitionBuffer.isVisible) { - const start = window.performance.now(); - const currentBuffer = transitionBuffer.currentBuffer; - const lookup = currentBuffer.lookup; - for(let j = 0; j < currentBuffer.length; j++){ - const id = currentBuffer.ids[j]; - const index = lookup[id]; - if (index != null) { - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, index, translation); - let isInside = true; - for(let k = 0; k < 4; k++){ - let distance = (0, _glMatrix.vec3).dot(normals[k], translation); - distance += d[k]; - if (distance < 0) { - isInside = false; - break; - } - } - if (isInside) set.add(id); - } - } - if (set.size > 0) this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set.size} ${Math.round(window.performance.now() - start)}ms`); - } - sets.push(set); - } - } - return sets; + if (element2) { + return element2; } -} -const CameraMode = { - orbit: "orbit", - altAzimuth: "altAzimuth" -}; -const StereoMode = { - none: "none", - split: "split", - anaglyph: "anaglyph", - left: "left", - right: "right" -}; -const SelectionMode = { - new: "new", - add: "add", - subtract: "subtract", - intersect: "intersect" -}; -const FilterMode = { - isolate: "isolate", - exclude: "exclude" -}; -const HorizontalAlignment = { - left: "left", - center: "center", - right: "right" -}; -const VerticalAlignment = { - top: "top", - center: "center", - bottom: "bottom" -}; -const TextAlignment = { - left: "left", - center: "center", - right: "right" -}; -const Orientation = { - horizontal: "horizontal", - vertical: "vertical" -}; -const AxesTextOrientation = { - parallel: "parallel", - perpendicular: "perpendicular" -}; -const AxesVisibility = { - none: "none", - current: "current", - previous: "previous" -}; -const PickType = { - none: 0, - data: 1, - label: 2, - axesDivision: 3, - axesTitle: 4, - axesLabel: 5, - axesHeading: 6 -}; -const Theme = { - dark: "dark", - light: "light" -}; -const HighlightMode = { - luminance: "luminance", - color: "color" -}; -const UnitType = { - block: "block", - blockSdf: "blockSdf", - boxFrameSdf: "boxFrameSdf", - sphere: "sphere", - sphereSdf: "sphereSdf", - cylinder: "cylinder", - cylinderSdf: "cylinderSdf", - hexPrism: "hexPrism", - hexPrismSdf: "hexPrismSdf", - sdf: "sdf", - disk: "disk", - ringSdf: "ringSdf" -}; -const SingleTouchAction = { - none: "none", - translate: "translate", - rotate: "rotate", - lasso: "lasso" -}; -const MouseWheelAction = { - none: "none", - zoom: "zoom", - rotateY: "rotateY" -}; -const LogLevel = { - trace: 0, - debug: 1, - info: 2, - warn: 3, - error: 4 -}; -const Edge2D = { - top: 0, - right: 1, - bottom: 2, - left: 3 -}; -const Face2D = { - front: 0, - back: 1 -}; -const Edge3D = { - topFront: 0, - topRight: 1, - topBack: 2, - topLeft: 3, - bottomFront: 4, - bottomRight: 5, - bottomBack: 6, - bottomLeft: 7, - frontRight: 8, - backRight: 9, - backLeft: 10, - frontLeft: 11 -}; -const Face3D = { - top: 0, - right: 1, - bottom: 2, - left: 3, - front: 4, - back: 5 -}; -const HexOrientation = { - pointyTop: "pointyTop", - flatTop: "flatTop" -}; -const RenderMode = { - color: "color", - hdr: "hdr", - depth: "depth", - normal: "normal", - segment: "segment", - edge: "edge" -}; - -},{"gl-matrix":"erHGu","./cameras/altazimuth.js":"48TUG","./config.js":"fYehi","./constants.js":"dHTsY","./debug.js":"lwhbM","./fps.js":"kh2PX","./helpers/angle.js":"hBXkO","./palette.js":"a14oj","./components/controller.js":"3tuGu","./helpers/matrix.js":"ffHCZ","./components/axes/cartesian3d.js":"fmvJ2","./components/axes/cartesian2d.js":"lhcyD","./font.js":"fn4YW","./vertex.js":"8lW8V","./input/manager.js":"kM2vK","./log.js":"dneJo","./helpers/math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erHGu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "glMatrix", ()=>_commonJs); -parcelHelpers.export(exports, "mat2", ()=>_mat2Js); -parcelHelpers.export(exports, "mat2d", ()=>_mat2DJs); -parcelHelpers.export(exports, "mat3", ()=>_mat3Js); -parcelHelpers.export(exports, "mat4", ()=>_mat4Js); -parcelHelpers.export(exports, "quat", ()=>_quatJs); -parcelHelpers.export(exports, "quat2", ()=>_quat2Js); -parcelHelpers.export(exports, "vec2", ()=>_vec2Js); -parcelHelpers.export(exports, "vec3", ()=>_vec3Js); -parcelHelpers.export(exports, "vec4", ()=>_vec4Js); -var _commonJs = require("./common.js"); -var _mat2Js = require("./mat2.js"); -var _mat2DJs = require("./mat2d.js"); -var _mat3Js = require("./mat3.js"); -var _mat4Js = require("./mat4.js"); -var _quatJs = require("./quat.js"); -var _quat2Js = require("./quat2.js"); -var _vec2Js = require("./vec2.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); - -},{"./common.js":"Li4u6","./mat2.js":false,"./mat2d.js":false,"./mat3.js":"5XUpE","./mat4.js":"jn7Bp","./quat.js":"khTmL","./quat2.js":false,"./vec2.js":"ceSVb","./vec3.js":"cAIcX","./vec4.js":"czCsm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Li4u6":[function(require,module,exports,__globalThis) { -/** - * Common utilities - * @module glMatrix - */ // Configuration Constants -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "EPSILON", ()=>EPSILON); -parcelHelpers.export(exports, "ARRAY_TYPE", ()=>ARRAY_TYPE); -parcelHelpers.export(exports, "RANDOM", ()=>RANDOM); -/** - * Sets the type of array used when creating new vectors and matrices - * - * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array - */ parcelHelpers.export(exports, "setMatrixArrayType", ()=>setMatrixArrayType); -/** - * Convert Degree To Radian - * - * @param {Number} a Angle in Degrees - */ parcelHelpers.export(exports, "toRadian", ()=>toRadian); -/** - * Tests whether or not the arguments have approximately the same value, within an absolute - * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less - * than or equal to 1.0, and a relative tolerance is used for larger values) - * - * @param {Number} a The first number to test. - * @param {Number} b The second number to test. - * @returns {Boolean} True if the numbers are approximately equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -var EPSILON = 0.000001; -var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; -var RANDOM = Math.random; -function setMatrixArrayType(type) { - ARRAY_TYPE = type; -} -var degree = Math.PI / 180; -function toRadian(a) { - return a * degree; -} -function equals(a, b) { - return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b)); -} -if (!Math.hypot) Math.hypot = function() { - var y = 0, i = arguments.length; - while(i--)y += arguments[i] * arguments[i]; - return Math.sqrt(y); -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5XUpE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3x3 Matrix - * @module mat3 - */ /** - * Creates a new identity mat3 - * - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param {mat3} out the receiving 3x3 matrix - * @param {ReadonlyMat4} a the source 4x4 matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromMat4", ()=>fromMat4); -/** - * Creates a new mat3 initialized with values from an existing matrix - * - * @param {ReadonlyMat3} a matrix to clone - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat3 to another - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat3 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} A new mat3 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat3 to the given values - * - * @param {mat3} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat3 to the identity matrix - * - * @param {mat3} out the receiving matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat3 - * - * @param {ReadonlyMat3} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat3 by the given vector - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to translate - * @param {ReadonlyVec2} v vector to translate by - * @returns {mat3} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Rotates a mat3 by the given angle - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Scales the mat3 by the dimensions in the given vec2 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {ReadonlyVec2} v the vec2 to scale the matrix by - * @returns {mat3} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.translate(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Translation vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a given angle - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.rotate(dest, dest, rad); - * - * @param {mat3} out mat3 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.scale(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Scaling vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Copies the values from a mat2d into a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat2d} a the matrix to copy - * @returns {mat3} out - **/ parcelHelpers.export(exports, "fromMat2d", ()=>fromMat2d); -/** - * Calculates a 3x3 matrix from the given quaternion - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "normalFromMat4", ()=>normalFromMat4); -/** - * Generates a 2D projection matrix with the given bounds - * - * @param {mat3} out mat3 frustum matrix will be written into - * @param {number} width Width of your gl context - * @param {number} height Height of gl context - * @returns {mat3} out - */ parcelHelpers.export(exports, "projection", ()=>projection); -/** - * Returns a string representation of a mat3 - * - * @param {ReadonlyMat3} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat3 - * - * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat3's after multiplying each element of the second operand by a scalar value. - * - * @param {mat3} out the receiving vector - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(9); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; + } + function focusActiveElement(element2, activeElementInfo) { + element2.focus(); + element2.scrollTop = activeElementInfo.scrollTop; + const input = element2; + if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) { + input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); + } + } + function setActiveElement(activeElementInfo, container) { + if (activeElementInfo) { + const element2 = findElementByChildPositions(activeElementInfo.childPositions, container); + if (element2) { + focusActiveElement(element2, activeElementInfo); + } + } + } + function getActiveElementInfo(container) { + let element2 = document.activeElement; + const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element2; + const activeElementInfo = { + childPositions: [], + scrollTop, + selectionDirection, + selectionEnd, + selectionStart + }; + while (element2 && element2 !== document.body && element2 !== container) { + activeElementInfo.childPositions.unshift(getChildPosition(element2)); + element2 = element2.parentElement; + } + if ((element2 === document.body || element2 === container) && activeElementInfo.childPositions.length) + return activeElementInfo; + } + function getChildPosition(element2) { + let childPosition = 0; + while (element2 = element2.previousElementSibling) + childPosition++; + return childPosition; + } + const KeyCodes = { + ENTER: "Enter" + }; + const Table$1 = (props) => { + return createElement( + "table", + { className: props.className }, + props.children, + props.rows.map((row, i) => createElement("tr", { className: props.rowClassName || "", onClick: (e) => props.onRowClick && props.onRowClick(e, i), tabIndex: props.onRowClick ? 0 : -1, onKeyUp: (e) => { + if (e.key === KeyCodes.ENTER && props.onRowClick) { + props.onRowClick(e, i); + } + } }, row.cells.map((cell2, i2) => createElement("td", { className: cell2.className || "", title: cell2.title || "" }, cell2.content)))) + ); + }; + const controls = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Table: Table$1 + }, Symbol.toStringTag, { value: "Module" })); + var EPSILON = 1e-6; + var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + function setMatrixArrayType(type2) { + ARRAY_TYPE = type2; + } + function create$5() { + var out = new ARRAY_TYPE(9); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; } out[0] = 1; out[4] = 1; out[8] = 1; return out; -} -function fromMat4(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; + } + function fromMat4(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[4]; + out[4] = a2[5]; + out[5] = a2[6]; + out[6] = a2[8]; + out[7] = a2[9]; + out[8] = a2[10]; return out; -} -function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) { + } + function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { + var out = new ARRAY_TYPE(9); out[0] = m00; out[1] = m01; out[2] = m02; @@ -55311,884 +38430,75 @@ function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) { out[7] = m21; out[8] = m22; return out; -} -function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a12 = a[5]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a01; - out[5] = a[7]; - out[6] = a02; - out[7] = a12; - } else { - out[0] = a[0]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a[1]; - out[4] = a[4]; - out[5] = a[7]; - out[6] = a[2]; - out[7] = a[5]; - out[8] = a[8]; - } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b01 = a22 * a11 - a12 * a21; - var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21; - if (!det) return null; - det = 1.0 / det; - out[0] = b01 * det; - out[1] = (-a22 * a01 + a02 * a21) * det; - out[2] = (a12 * a01 - a02 * a11) * det; - out[3] = b11 * det; - out[4] = (a22 * a00 - a02 * a20) * det; - out[5] = (-a12 * a00 + a02 * a10) * det; - out[6] = b21 * det; - out[7] = (-a21 * a00 + a01 * a20) * det; - out[8] = (a11 * a00 - a01 * a10) * det; - return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - out[0] = a11 * a22 - a12 * a21; - out[1] = a02 * a21 - a01 * a22; - out[2] = a01 * a12 - a02 * a11; - out[3] = a12 * a20 - a10 * a22; - out[4] = a00 * a22 - a02 * a20; - out[5] = a02 * a10 - a00 * a12; - out[6] = a10 * a21 - a11 * a20; - out[7] = a01 * a20 - a00 * a21; - out[8] = a00 * a11 - a01 * a10; - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b00 = b[0], b01 = b[1], b02 = b[2]; - var b10 = b[3], b11 = b[4], b12 = b[5]; - var b20 = b[6], b21 = b[7], b22 = b[8]; - out[0] = b00 * a00 + b01 * a10 + b02 * a20; - out[1] = b00 * a01 + b01 * a11 + b02 * a21; - out[2] = b00 * a02 + b01 * a12 + b02 * a22; - out[3] = b10 * a00 + b11 * a10 + b12 * a20; - out[4] = b10 * a01 + b11 * a11 + b12 * a21; - out[5] = b10 * a02 + b11 * a12 + b12 * a22; - out[6] = b20 * a00 + b21 * a10 + b22 * a20; - out[7] = b20 * a01 + b21 * a11 + b22 * a21; - out[8] = b20 * a02 + b21 * a12 + b22 * a22; - return out; -} -function translate(out, a, v) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], x = v[0], y = v[1]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a10; - out[4] = a11; - out[5] = a12; - out[6] = x * a00 + y * a10 + a20; - out[7] = x * a01 + y * a11 + a21; - out[8] = x * a02 + y * a12 + a22; - return out; -} -function rotate(out, a, rad) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], s = Math.sin(rad), c = Math.cos(rad); - out[0] = c * a00 + s * a10; - out[1] = c * a01 + s * a11; - out[2] = c * a02 + s * a12; - out[3] = c * a10 - s * a00; - out[4] = c * a11 - s * a01; - out[5] = c * a12 - s * a02; - out[6] = a20; - out[7] = a21; - out[8] = a22; - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1]; - out[0] = x * a[0]; - out[1] = x * a[1]; - out[2] = x * a[2]; - out[3] = y * a[3]; - out[4] = y * a[4]; - out[5] = y * a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = v[0]; - out[7] = v[1]; - out[8] = 1; - return out; -} -function fromRotation(out, rad) { - var s = Math.sin(rad), c = Math.cos(rad); - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = -s; - out[4] = c; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = v[1]; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromMat2d(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = 0; - out[3] = a[2]; - out[4] = a[3]; - out[5] = 0; - out[6] = a[4]; - out[7] = a[5]; - out[8] = 1; - return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromQuat$1(out, q) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z * x22; + var zy = z * y22; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; out[0] = 1 - yy - zz; out[3] = yx - wz; out[6] = zx + wy; - out[1] = yx + wz; - out[4] = 1 - xx - zz; - out[7] = zy - wx; - out[2] = zx - wy; - out[5] = zy + wx; - out[8] = 1 - xx - yy; - return out; -} -function normalFromMat4(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - return out; -} -function projection(out, width, height) { - out[0] = 2 / width; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = -2 / height; - out[5] = 0; - out[6] = -1; - out[7] = 1; - out[8] = 1; - return out; -} -function str(a) { - return "mat3(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7], a8 = a[8]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jn7Bp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied. - * @module mat4 - */ /** - * Creates a new identity mat4 - * - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new mat4 initialized with values from an existing matrix - * - * @param {ReadonlyMat4} a matrix to clone - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat4 to another - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat4 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} A new mat4 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat4 to the given values - * - * @param {mat4} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat4 to the identity matrix - * - * @param {mat4} out the receiving matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat4 - * - * @param {ReadonlyMat4} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat4s - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat4 by the given vector - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to translate - * @param {ReadonlyVec3} v vector to translate by - * @returns {mat4} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Scales the mat4 by the dimensions in the given vec3 not using vectorization - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {ReadonlyVec3} v the vec3 to scale the matrix by - * @returns {mat4} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Rotates a mat4 by the given angle around the given axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Rotates a matrix by the given angle around the X axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a matrix by the given angle around the Y axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a matrix by the given angle around the Z axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.scale(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Creates a matrix from a given angle around a given axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotate(dest, dest, rad, axis); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from the given angle around the X axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateX(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromXRotation", ()=>fromXRotation); -/** - * Creates a matrix from the given angle around the Y axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateY(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromYRotation", ()=>fromYRotation); -/** - * Creates a matrix from the given angle around the Z axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateZ(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromZRotation", ()=>fromZRotation); -/** - * Creates a matrix from a quaternion rotation and vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslation", ()=>fromRotationTranslation); -/** - * Creates a new mat4 from a dual quat. - * - * @param {mat4} out Matrix - * @param {ReadonlyQuat2} a Dual Quaternion - * @returns {mat4} mat4 receiving operation result - */ parcelHelpers.export(exports, "fromQuat2", ()=>fromQuat2); -/** - * Returns the translation vector component of a transformation - * matrix. If a matrix is built with fromRotationTranslation, - * the returned vector will be the same as the translation vector - * originally supplied. - * @param {vec3} out Vector to receive translation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getTranslation", ()=>getTranslation); -/** - * Returns the scaling factor component of a transformation - * matrix. If a matrix is built with fromRotationTranslationScale - * with a normalized Quaternion paramter, the returned vector will be - * the same as the scaling vector - * originally supplied. - * @param {vec3} out Vector to receive scaling factor component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getScaling", ()=>getScaling); -/** - * Returns a quaternion representing the rotational component - * of a transformation matrix. If a matrix is built with - * fromRotationTranslation, the returned quaternion will be the - * same as the quaternion originally supplied. - * @param {quat} out Quaternion to receive the rotation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {quat} out - */ parcelHelpers.export(exports, "getRotation", ()=>getRotation); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScale", ()=>fromRotationTranslationScale); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @param {ReadonlyVec3} o The origin vector around which to scale and rotate - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScaleOrigin", ()=>fromRotationTranslationScaleOrigin); -/** - * Calculates a 4x4 matrix from the given quaternion - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Generates a frustum matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Number} left Left bound of the frustum - * @param {Number} right Right bound of the frustum - * @param {Number} bottom Bottom bound of the frustum - * @param {Number} top Top bound of the frustum - * @param {Number} near Near bound of the frustum - * @param {Number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "frustum", ()=>frustum); -/** - * Generates a perspective projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveNO", ()=>perspectiveNO); -parcelHelpers.export(exports, "perspective", ()=>perspective); -/** - * Generates a perspective projection matrix suitable for WebGPU with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveZO", ()=>perspectiveZO); -/** - * Generates a perspective projection matrix with the given field of view. - * This is primarily useful for generating projection matrices to be used - * with the still experiemental WebVR API. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveFromFieldOfView", ()=>perspectiveFromFieldOfView); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoNO", ()=>orthoNO); -parcelHelpers.export(exports, "ortho", ()=>ortho); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoZO", ()=>orthoZO); -/** - * Generates a look-at matrix with the given eye position, focal point, and up axis. - * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "lookAt", ()=>lookAt); -/** - * Generates a matrix that makes something look at something else. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "targetTo", ()=>targetTo); -/** - * Returns a string representation of a mat4 - * - * @param {ReadonlyMat4} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat4 - * - * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat4's - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat4's after multiplying each element of the second operand by a scalar value. - * - * @param {mat4} out the receiving vector - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(16); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; + } + function create$4() { + var out = new ARRAY_TYPE(16); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; } out[0] = 1; out[5] = 1; out[10] = 1; out[15] = 1; return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; + } + function copy$4(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + out[4] = a2[4]; + out[5] = a2[5]; + out[6] = a2[6]; + out[7] = a2[7]; + out[8] = a2[8]; + out[9] = a2[9]; + out[10] = a2[10]; + out[11] = a2[11]; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; return out; -} -function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + } + function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + var out = new ARRAY_TYPE(16); out[0] = m00; out[1] = m01; out[2] = m02; @@ -56206,8 +38516,8 @@ function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m3 out[14] = m32; out[15] = m33; return out; -} -function identity(out) { + } + function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; @@ -56225,50 +38535,12 @@ function identity(out) { out[14] = 0; out[15] = 1; return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a03 = a[3]; - var a12 = a[6], a13 = a[7]; - var a23 = a[11]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a01; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a02; - out[9] = a12; - out[11] = a[14]; - out[12] = a03; - out[13] = a13; - out[14] = a23; - } else { - out[0] = a[0]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a[1]; - out[5] = a[5]; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a[2]; - out[9] = a[6]; - out[10] = a[10]; - out[11] = a[14]; - out[12] = a[3]; - out[13] = a[7]; - out[14] = a[11]; - out[15] = a[15]; - } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + } + function invert(out, a2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; var b00 = a00 * a11 - a01 * a10; var b01 = a00 * a12 - a02 * a10; var b02 = a00 * a13 - a03 * a10; @@ -56280,10 +38552,12 @@ function invert(out, a) { var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant + var b11 = a22 * a33 - a23 * a32; var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; + if (!det) { + return null; + } + det = 1 / det; out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; @@ -56301,323 +38575,106 @@ function invert(out, a) { out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); - out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); - out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); - out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); - out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); - out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); - out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); - out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + } + function multiply$2(out, a2, b2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3]; + out[0] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[4]; + b1 = b2[5]; + b22 = b2[6]; + b3 = b2[7]; + out[4] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[8]; + b1 = b2[9]; + b22 = b2[10]; + b3 = b2[11]; + out[8] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[12]; + b1 = b2[13]; + b22 = b2[14]; + b3 = b2[15]; + out[12] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; return out; -} -function translate(out, a, v) { - var x = v[0], y = v[1], z = v[2]; + } + function translate(out, a2, v) { + var x2 = v[0], y2 = v[1], z = v[2]; var a00, a01, a02, a03; var a10, a11, a12, a13; var a20, a21, a22, a23; - if (a === out) { - out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + if (a2 === out) { + out[12] = a2[0] * x2 + a2[4] * y2 + a2[8] * z + a2[12]; + out[13] = a2[1] * x2 + a2[5] * y2 + a2[9] * z + a2[13]; + out[14] = a2[2] * x2 + a2[6] * y2 + a2[10] * z + a2[14]; + out[15] = a2[3] * x2 + a2[7] * y2 + a2[11] * z + a2[15]; } else { - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a03; - out[4] = a10; - out[5] = a11; - out[6] = a12; - out[7] = a13; - out[8] = a20; - out[9] = a21; - out[10] = a22; - out[11] = a23; - out[12] = a00 * x + a10 * y + a20 * z + a[12]; - out[13] = a01 * x + a11 * y + a21 * z + a[13]; - out[14] = a02 * x + a12 * y + a22 * z + a[14]; - out[15] = a03 * x + a13 * y + a23 * z + a[15]; - } - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - out[0] = a[0] * x; - out[1] = a[1] * x; - out[2] = a[2] * x; - out[3] = a[3] * x; - out[4] = a[4] * y; - out[5] = a[5] * y; - out[6] = a[6] * y; - out[7] = a[7] * y; - out[8] = a[8] * z; - out[9] = a[9] * z; - out[10] = a[10] * z; - out[11] = a[11] * z; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function rotate(out, a, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - var b00, b01, b02; - var b10, b11, b12; - var b20, b21, b22; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; // Construct the elements of the rotation matrix - b00 = x * x * t + c; - b01 = y * x * t + z * s; - b02 = z * x * t - y * s; - b10 = x * y * t - z * s; - b11 = y * y * t + c; - b12 = z * y * t + x * s; - b20 = x * z * t + y * s; - b21 = y * z * t - x * s; - b22 = z * z * t + c; // Perform rotation-specific matrix multiplication - out[0] = a00 * b00 + a10 * b01 + a20 * b02; - out[1] = a01 * b00 + a11 * b01 + a21 * b02; - out[2] = a02 * b00 + a12 * b01 + a22 * b02; - out[3] = a03 * b00 + a13 * b01 + a23 * b02; - out[4] = a00 * b10 + a10 * b11 + a20 * b12; - out[5] = a01 * b10 + a11 * b11 + a21 * b12; - out[6] = a02 * b10 + a12 * b11 + a22 * b12; - out[7] = a03 * b10 + a13 * b11 + a23 * b12; - out[8] = a00 * b20 + a10 * b21 + a20 * b22; - out[9] = a01 * b20 + a11 * b21 + a21 * b22; - out[10] = a02 * b20 + a12 * b21 + a22 * b22; - out[11] = a03 * b20 + a13 * b21 + a23 * b22; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; + a00 = a2[0]; + a01 = a2[1]; + a02 = a2[2]; + a03 = a2[3]; + a10 = a2[4]; + a11 = a2[5]; + a12 = a2[6]; + a13 = a2[7]; + a20 = a2[8]; + a21 = a2[9]; + a22 = a2[10]; + a23 = a2[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x2 + a10 * y2 + a20 * z + a2[12]; + out[13] = a01 * x2 + a11 * y2 + a21 * z + a2[13]; + out[14] = a02 * x2 + a12 * y2 + a22 * z + a2[14]; + out[15] = a03 * x2 + a13 * y2 + a23 * z + a2[15]; } return out; -} -function rotateX(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[4] = a10 * c + a20 * s; - out[5] = a11 * c + a21 * s; - out[6] = a12 * c + a22 * s; - out[7] = a13 * c + a23 * s; - out[8] = a20 * c - a10 * s; - out[9] = a21 * c - a11 * s; - out[10] = a22 * c - a12 * s; - out[11] = a23 * c - a13 * s; - return out; -} -function rotateY(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c - a20 * s; - out[1] = a01 * c - a21 * s; - out[2] = a02 * c - a22 * s; - out[3] = a03 * c - a23 * s; - out[8] = a00 * s + a20 * c; - out[9] = a01 * s + a21 * c; - out[10] = a02 * s + a22 * c; - out[11] = a03 * s + a23 * c; - return out; -} -function rotateZ(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c + a10 * s; - out[1] = a01 * c + a11 * s; - out[2] = a02 * c + a12 * s; - out[3] = a03 * c + a13 * s; - out[4] = a10 * c - a00 * s; - out[5] = a11 * c - a01 * s; - out[6] = a12 * c - a02 * s; - out[7] = a13 * c - a03 * s; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; + } + function scale$1(out, a2, v) { + var x2 = v[0], y2 = v[1], z = v[2]; + out[0] = a2[0] * x2; + out[1] = a2[1] * x2; + out[2] = a2[2] * x2; + out[3] = a2[3] * x2; + out[4] = a2[4] * y2; + out[5] = a2[5] * y2; + out[6] = a2[6] * y2; + out[7] = a2[7] * y2; + out[8] = a2[8] * z; + out[9] = a2[9] * z; + out[10] = a2[10] * z; + out[11] = a2[11] * z; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; return out; -} -function fromScaling(out, v) { + } + function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; out[2] = 0; @@ -56635,232 +38692,24 @@ function fromScaling(out, v) { out[14] = 0; out[15] = 1; return out; -} -function fromRotation(out, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; // Perform rotation-specific matrix multiplication - out[0] = x * x * t + c; - out[1] = y * x * t + z * s; - out[2] = z * x * t - y * s; - out[3] = 0; - out[4] = x * y * t - z * s; - out[5] = y * y * t + c; - out[6] = z * y * t + x * s; - out[7] = 0; - out[8] = x * z * t + y * s; - out[9] = y * z * t - x * s; - out[10] = z * z * t + c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromXRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = c; - out[6] = s; - out[7] = 0; - out[8] = 0; - out[9] = -s; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromYRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = 0; - out[2] = -s; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = s; - out[9] = 0; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromZRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = 0; - out[4] = -s; - out[5] = c; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotationTranslation(out, q, v) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromQuat2(out, a) { - var translation = new _commonJs.ARRAY_TYPE(3); - var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7]; - var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense - if (magnitude > 0) { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; - } else { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; - } - fromRotationTranslation(out, a, translation); - return out; -} -function getTranslation(out, mat) { - out[0] = mat[12]; - out[1] = mat[13]; - out[2] = mat[14]; - return out; -} -function getScaling(out, mat) { - var m11 = mat[0]; - var m12 = mat[1]; - var m13 = mat[2]; - var m21 = mat[4]; - var m22 = mat[5]; - var m23 = mat[6]; - var m31 = mat[8]; - var m32 = mat[9]; - var m33 = mat[10]; - out[0] = Math.hypot(m11, m12, m13); - out[1] = Math.hypot(m21, m22, m23); - out[2] = Math.hypot(m31, m32, m33); - return out; -} -function getRotation(out, mat) { - var scaling = new _commonJs.ARRAY_TYPE(3); - getScaling(scaling, mat); - var is1 = 1 / scaling[0]; - var is2 = 1 / scaling[1]; - var is3 = 1 / scaling[2]; - var sm11 = mat[0] * is1; - var sm12 = mat[1] * is2; - var sm13 = mat[2] * is3; - var sm21 = mat[4] * is1; - var sm22 = mat[5] * is2; - var sm23 = mat[6] * is3; - var sm31 = mat[8] * is1; - var sm32 = mat[9] * is2; - var sm33 = mat[10] * is3; - var trace = sm11 + sm22 + sm33; - var S = 0; - if (trace > 0) { - S = Math.sqrt(trace + 1.0) * 2; - out[3] = 0.25 * S; - out[0] = (sm23 - sm32) / S; - out[1] = (sm31 - sm13) / S; - out[2] = (sm12 - sm21) / S; - } else if (sm11 > sm22 && sm11 > sm33) { - S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; - out[3] = (sm23 - sm32) / S; - out[0] = 0.25 * S; - out[1] = (sm12 + sm21) / S; - out[2] = (sm31 + sm13) / S; - } else if (sm22 > sm33) { - S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; - out[3] = (sm31 - sm13) / S; - out[0] = (sm12 + sm21) / S; - out[1] = 0.25 * S; - out[2] = (sm23 + sm32) / S; - } else { - S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; - out[3] = (sm12 - sm21) / S; - out[0] = (sm31 + sm13) / S; - out[1] = (sm23 + sm32) / S; - out[2] = 0.25 * S; - } - return out; -} -function fromRotationTranslationScale(out, q, v, s) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromRotationTranslationScale(out, q, v, s) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z2; + var yy = y2 * y22; + var yz = y2 * z2; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; var sx = s[0]; var sy = s[1]; - var sz = s[2]; + var sz2 = s[2]; out[0] = (1 - (yy + zz)) * sx; out[1] = (xy + wz) * sx; out[2] = (xz - wy) * sx; @@ -56869,34 +38718,33 @@ function fromRotationTranslationScale(out, q, v, s) { out[5] = (1 - (xx + zz)) * sy; out[6] = (yz + wx) * sy; out[7] = 0; - out[8] = (xz + wy) * sz; - out[9] = (yz - wx) * sz; - out[10] = (1 - (xx + yy)) * sz; + out[8] = (xz + wy) * sz2; + out[9] = (yz - wx) * sz2; + out[10] = (1 - (xx + yy)) * sz2; out[11] = 0; out[12] = v[0]; out[13] = v[1]; out[14] = v[2]; out[15] = 1; return out; -} -function fromRotationTranslationScaleOrigin(out, q, v, s, o) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromRotationTranslationScaleOrigin(out, q, v, s, o) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z2; + var yy = y2 * y22; + var yz = y2 * z2; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; var sx = s[0]; var sy = s[1]; - var sz = s[2]; + var sz2 = s[2]; var ox = o[0]; var oy = o[1]; var oz = o[2]; @@ -56906,9 +38754,9 @@ function fromRotationTranslationScaleOrigin(out, q, v, s, o) { var out4 = (xy - wz) * sy; var out5 = (1 - (xx + zz)) * sy; var out6 = (yz + wx) * sy; - var out8 = (xz + wy) * sz; - var out9 = (yz - wx) * sz; - var out10 = (1 - (xx + yy)) * sz; + var out8 = (xz + wy) * sz2; + var out9 = (yz - wx) * sz2; + var out10 = (1 - (xx + yy)) * sz2; out[0] = out0; out[1] = out1; out[2] = out2; @@ -56926,21 +38774,21 @@ function fromRotationTranslationScaleOrigin(out, q, v, s, o) { out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); out[15] = 1; return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromQuat(out, q) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z * x22; + var zy = z * y22; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; out[0] = 1 - yy - zz; out[1] = yx + wz; out[2] = zx - wy; @@ -56958,8 +38806,8 @@ function fromQuat(out, q) { out[14] = 0; out[15] = 1; return out; -} -function frustum(out, left, right, bottom, top, near, far) { + } + function frustum(out, left, right, bottom, top, near, far) { var rl = 1 / (right - left); var tb = 1 / (top - bottom); var nf = 1 / (near - far); @@ -56980,36 +38828,9 @@ function frustum(out, left, right, bottom, top, near, far) { out[14] = far * near * 2 * nf; out[15] = 0; return out; -} -function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = (far + near) * nf; - out[14] = 2 * far * near * nf; - } else { - out[10] = -1; - out[14] = -2 * near; - } - return out; -} -var perspective = perspectiveNO; -function perspectiveZO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; + } + function perspectiveNO(out, fovy, aspect, near, far) { + var f = 1 / Math.tan(fovy / 2); out[0] = f / aspect; out[1] = 0; out[2] = 0; @@ -57025,87 +38846,18 @@ function perspectiveZO(out, fovy, aspect, near, far) { out[13] = 0; out[15] = 0; if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = far * nf; - out[14] = far * near * nf; + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; } else { - out[10] = -1; - out[14] = -near; + out[10] = -1; + out[14] = -2 * near; } return out; -} -function perspectiveFromFieldOfView(out, fov, near, far) { - var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0); - var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0); - var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0); - var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0); - var xScale = 2.0 / (leftTan + rightTan); - var yScale = 2.0 / (upTan + downTan); - out[0] = xScale; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - out[4] = 0.0; - out[5] = yScale; - out[6] = 0.0; - out[7] = 0.0; - out[8] = -((leftTan - rightTan) * xScale * 0.5); - out[9] = (upTan - downTan) * yScale * 0.5; - out[10] = far / (near - far); - out[11] = -1; - out[12] = 0.0; - out[13] = 0.0; - out[14] = far * near / (near - far); - out[15] = 0.0; - return out; -} -function orthoNO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - return out; -} -var ortho = orthoNO; -function orthoZO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = near * nf; - out[15] = 1; - return out; -} -function lookAt(out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; + } + var perspective = perspectiveNO; + function lookAt(out, eye, center, up) { + var x02, x12, x2, y02, y12, y2, z02, z1, z2, len2; var eyex = eye[0]; var eyey = eye[1]; var eyez = eye[2]; @@ -57115,402 +38867,378 @@ function lookAt(out, eye, center, up) { var centerx = center[0]; var centery = center[1]; var centerz = center[2]; - if (Math.abs(eyex - centerx) < _commonJs.EPSILON && Math.abs(eyey - centery) < _commonJs.EPSILON && Math.abs(eyez - centerz) < _commonJs.EPSILON) return identity(out); - z0 = eyex - centerx; + if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) { + return identity(out); + } + z02 = eyex - centerx; z1 = eyey - centery; z2 = eyez - centerz; - len = 1 / Math.hypot(z0, z1, z2); - z0 *= len; - z1 *= len; - z2 *= len; - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len = Math.hypot(x0, x1, x2); - if (!len) { - x0 = 0; - x1 = 0; - x2 = 0; + len2 = 1 / Math.sqrt(z02 * z02 + z1 * z1 + z2 * z2); + z02 *= len2; + z1 *= len2; + z2 *= len2; + x02 = upy * z2 - upz * z1; + x12 = upz * z02 - upx * z2; + x2 = upx * z1 - upy * z02; + len2 = Math.sqrt(x02 * x02 + x12 * x12 + x2 * x2); + if (!len2) { + x02 = 0; + x12 = 0; + x2 = 0; } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - len = Math.hypot(y0, y1, y2); - if (!len) { - y0 = 0; - y1 = 0; - y2 = 0; + len2 = 1 / len2; + x02 *= len2; + x12 *= len2; + x2 *= len2; + } + y02 = z1 * x2 - z2 * x12; + y12 = z2 * x02 - z02 * x2; + y2 = z02 * x12 - z1 * x02; + len2 = Math.sqrt(y02 * y02 + y12 * y12 + y2 * y2); + if (!len2) { + y02 = 0; + y12 = 0; + y2 = 0; } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - out[0] = x0; - out[1] = y0; - out[2] = z0; + len2 = 1 / len2; + y02 *= len2; + y12 *= len2; + y2 *= len2; + } + out[0] = x02; + out[1] = y02; + out[2] = z02; out[3] = 0; - out[4] = x1; - out[5] = y1; + out[4] = x12; + out[5] = y12; out[6] = z1; out[7] = 0; out[8] = x2; out[9] = y2; out[10] = z2; out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[12] = -(x02 * eyex + x12 * eyey + x2 * eyez); + out[13] = -(y02 * eyex + y12 * eyey + y2 * eyez); + out[14] = -(z02 * eyex + z1 * eyey + z2 * eyez); out[15] = 1; return out; -} -function targetTo(out, eye, target, up) { - var eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2]; - var z0 = eyex - target[0], z1 = eyey - target[1], z2 = eyez - target[2]; - var len = z0 * z0 + z1 * z1 + z2 * z2; - if (len > 0) { - len = 1 / Math.sqrt(len); - z0 *= len; - z1 *= len; - z2 *= len; - } - var x0 = upy * z2 - upz * z1, x1 = upz * z0 - upx * z2, x2 = upx * z1 - upy * z0; - len = x0 * x0 + x1 * x1 + x2 * x2; - if (len > 0) { - len = 1 / Math.sqrt(len); - x0 *= len; - x1 *= len; - x2 *= len; - } - out[0] = x0; - out[1] = x1; - out[2] = x2; - out[3] = 0; - out[4] = z1 * x2 - z2 * x1; - out[5] = z2 * x0 - z0 * x2; - out[6] = z0 * x1 - z1 * x0; - out[7] = 0; - out[8] = z0; - out[9] = z1; - out[10] = z2; - out[11] = 0; - out[12] = eyex; - out[13] = eyey; - out[14] = eyez; - out[15] = 1; + } + var mul = multiply$2; + function create$3() { + var out = new ARRAY_TYPE(3); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + return out; + } + function clone$4(a2) { + var out = new ARRAY_TYPE(3); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function length(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z * z); + } + function fromValues$3(x2, y2, z) { + var out = new ARRAY_TYPE(3); + out[0] = x2; + out[1] = y2; + out[2] = z; + return out; + } + function copy$3(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function set$3(out, x2, y2, z) { + out[0] = x2; + out[1] = y2; + out[2] = z; + return out; + } + function add(out, a2, b2) { + out[0] = a2[0] + b2[0]; + out[1] = a2[1] + b2[1]; + out[2] = a2[2] + b2[2]; + return out; + } + function subtract(out, a2, b2) { + out[0] = a2[0] - b2[0]; + out[1] = a2[1] - b2[1]; + out[2] = a2[2] - b2[2]; + return out; + } + function multiply$1(out, a2, b2) { + out[0] = a2[0] * b2[0]; + out[1] = a2[1] * b2[1]; + out[2] = a2[2] * b2[2]; + return out; + } + function min(out, a2, b2) { + out[0] = Math.min(a2[0], b2[0]); + out[1] = Math.min(a2[1], b2[1]); + out[2] = Math.min(a2[2], b2[2]); + return out; + } + function max(out, a2, b2) { + out[0] = Math.max(a2[0], b2[0]); + out[1] = Math.max(a2[1], b2[1]); + out[2] = Math.max(a2[2], b2[2]); + return out; + } + function scale(out, a2, b2) { + out[0] = a2[0] * b2; + out[1] = a2[1] * b2; + out[2] = a2[2] * b2; + return out; + } + function scaleAndAdd(out, a2, b2, scale2) { + out[0] = a2[0] + b2[0] * scale2; + out[1] = a2[1] + b2[1] * scale2; + out[2] = a2[2] + b2[2] * scale2; + return out; + } + function distance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z = b2[2] - a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z * z); + } + function squaredDistance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z = b2[2] - a2[2]; + return x2 * x2 + y2 * y2 + z * z; + } + function squaredLength(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + return x2 * x2 + y2 * y2 + z * z; + } + function negate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + return out; + } + function normalize$2(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + var len2 = x2 * x2 + y2 * y2 + z * z; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = a2[0] * len2; + out[1] = a2[1] * len2; + out[2] = a2[2] * len2; + return out; + } + function dot$1(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cross(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2]; + var bx = b2[0], by = b2[1], bz = b2[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + function lerp(out, a2, b2, t) { + var ax = a2[0]; + var ay = a2[1]; + var az = a2[2]; + out[0] = ax + t * (b2[0] - ax); + out[1] = ay + t * (b2[1] - ay); + out[2] = az + t * (b2[2] - az); + return out; + } + function transformMat4$2(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z = a2[2]; + var w2 = m2[3] * x2 + m2[7] * y2 + m2[11] * z + m2[15]; + w2 = w2 || 1; + out[0] = (m2[0] * x2 + m2[4] * y2 + m2[8] * z + m2[12]) / w2; + out[1] = (m2[1] * x2 + m2[5] * y2 + m2[9] * z + m2[13]) / w2; + out[2] = (m2[2] * x2 + m2[6] * y2 + m2[10] * z + m2[14]) / w2; + return out; + } + function transformMat3(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z = a2[2]; + out[0] = x2 * m2[0] + y2 * m2[3] + z * m2[6]; + out[1] = x2 * m2[1] + y2 * m2[4] + z * m2[7]; + out[2] = x2 * m2[2] + y2 * m2[5] + z * m2[8]; + return out; + } + function transformQuat(out, a2, q) { + var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; + var vx = a2[0], vy = a2[1], vz = a2[2]; + var tx2 = qy * vz - qz * vy; + var ty2 = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + tx2 = tx2 + tx2; + ty2 = ty2 + ty2; + tz = tz + tz; + out[0] = vx + qw * tx2 + qy * tz - qz * ty2; + out[1] = vy + qw * ty2 + qz * tx2 - qx * tz; + out[2] = vz + qw * tz + qx * ty2 - qy * tx2; + return out; + } + function exactEquals$1(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2]; + } + function equals$2(a2, b2) { + var a0 = a2[0], a1 = a2[1], a22 = a2[2]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b22) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b22)); + } + var len = length; + (function() { + var vec2 = create$3(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 3; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + } + return a2; + }; + })(); + function create$2() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + } + return out; + } + function clone$3(a2) { + var out = new ARRAY_TYPE(4); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; return out; -} -function str(a) { - return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - out[9] = a[9] + b[9]; - out[10] = a[10] + b[10]; - out[11] = a[11] + b[11]; - out[12] = a[12] + b[12]; - out[13] = a[13] + b[13]; - out[14] = a[14] + b[14]; - out[15] = a[15] + b[15]; + } + function fromValues$2(x2, y2, z, w2) { + var out = new ARRAY_TYPE(4); + out[0] = x2; + out[1] = y2; + out[2] = z; + out[3] = w2; return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - out[9] = a[9] - b[9]; - out[10] = a[10] - b[10]; - out[11] = a[11] - b[11]; - out[12] = a[12] - b[12]; - out[13] = a[13] - b[13]; - out[14] = a[14] - b[14]; - out[15] = a[15] - b[15]; + } + function copy$2(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - out[9] = a[9] * b; - out[10] = a[10] * b; - out[11] = a[11] * b; - out[12] = a[12] * b; - out[13] = a[13] * b; - out[14] = a[14] * b; - out[15] = a[15] * b; + } + function set$2(out, x2, y2, z, w2) { + out[0] = x2; + out[1] = y2; + out[2] = z; + out[3] = w2; return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; - out[9] = a[9] + b[9] * scale; - out[10] = a[10] + b[10] * scale; - out[11] = a[11] + b[11] * scale; - out[12] = a[12] + b[12] * scale; - out[13] = a[13] + b[13] * scale; - out[14] = a[14] + b[14] * scale; - out[15] = a[15] + b[15] * scale; + } + function normalize$1(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + var w2 = a2[3]; + var len2 = x2 * x2 + y2 * y2 + z * z + w2 * w2; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = x2 * len2; + out[1] = y2 * len2; + out[2] = z * len2; + out[3] = w2 * len2; return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7]; - var a8 = a[8], a9 = a[9], a10 = a[10], a11 = a[11]; - var a12 = a[12], a13 = a[13], a14 = a[14], a15 = a[15]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - var b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7]; - var b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11]; - var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"khTmL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Quaternion - * @module quat - */ /** - * Creates a new identity quat - * - * @returns {quat} a new quaternion - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Set a quat to the identity quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Sets a quat from the given angle and rotation axis, - * then returns it. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyVec3} axis the axis around which to rotate - * @param {Number} rad the angle in radians - * @returns {quat} out - **/ parcelHelpers.export(exports, "setAxisAngle", ()=>setAxisAngle); -/** - * Gets the rotation axis and angle for a given - * quaternion. If a quaternion is created with - * setAxisAngle, this method will return the same - * values as providied in the original parameter list - * OR functionally equivalent values. - * Example: The quaternion formed by axis [0, 0, 1] and - * angle -90 is the same as the quaternion formed by - * [0, 0, 1] and 270. This method favors the latter. - * @param {vec3} out_axis Vector receiving the axis of rotation - * @param {ReadonlyQuat} q Quaternion to be decomposed - * @return {Number} Angle, in radians, of the rotation - */ parcelHelpers.export(exports, "getAxisAngle", ()=>getAxisAngle); -/** - * Gets the angular distance between two unit quaternions - * - * @param {ReadonlyQuat} a Origin unit quaternion - * @param {ReadonlyQuat} b Destination unit quaternion - * @return {Number} Angle, in radians, between the two quaternions - */ parcelHelpers.export(exports, "getAngle", ()=>getAngle); -/** - * Multiplies two quat's - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @returns {quat} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Rotates a quaternion by the given angle about the X axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a quaternion by the given angle about the Y axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a quaternion by the given angle about the Z axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Calculates the W component of a quat from the X, Y, and Z components. - * Assumes that quaternion is 1 unit in length. - * Any existing W component will be ignored. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate W component of - * @returns {quat} out - */ parcelHelpers.export(exports, "calculateW", ()=>calculateW); -/** - * Calculate the exponential of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "exp", ()=>exp); -/** - * Calculate the natural logarithm of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "ln", ()=>ln); -/** - * Calculate the scalar power of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @param {Number} b amount to scale the quaternion by - * @returns {quat} out - */ parcelHelpers.export(exports, "pow", ()=>pow); -/** - * Performs a spherical linear interpolation between two quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {quat} out - */ parcelHelpers.export(exports, "slerp", ()=>slerp); -/** - * Generates a random unit quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Calculates the inverse of a quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate inverse of - * @returns {quat} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate conjugate of - * @returns {quat} out - */ parcelHelpers.export(exports, "conjugate", ()=>conjugate); -/** - * Creates a quaternion from the given 3x3 rotation matrix. - * - * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyMat3} m rotation matrix - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromMat3", ()=>fromMat3); -/** - * Creates a quaternion from the given euler angle x, y, z. - * - * @param {quat} out the receiving quaternion - * @param {x} Angle to rotate around X axis in degrees. - * @param {y} Angle to rotate around Y axis in degrees. - * @param {z} Angle to rotate around Z axis in degrees. - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromEuler", ()=>fromEuler); -/** - * Returns a string representation of a quatenion - * - * @param {ReadonlyQuat} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "fromValues", ()=>fromValues); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "set", ()=>set); -parcelHelpers.export(exports, "add", ()=>add); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "dot", ()=>dot); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "length", ()=>length); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "normalize", ()=>normalize); -parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "rotationTo", ()=>rotationTo); -parcelHelpers.export(exports, "sqlerp", ()=>sqlerp); -parcelHelpers.export(exports, "setAxes", ()=>setAxes); -var _commonJs = require("./common.js"); -var _mat3Js = require("./mat3.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - out[3] = 1; + } + function dot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2] + a2[3] * b2[3]; + } + function transformMat4$1(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z = a2[2], w2 = a2[3]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[8] * z + m2[12] * w2; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[9] * z + m2[13] * w2; + out[2] = m2[2] * x2 + m2[6] * y2 + m2[10] * z + m2[14] * w2; + out[3] = m2[3] * x2 + m2[7] * y2 + m2[11] * z + m2[15] * w2; return out; -} -function identity(out) { - out[0] = 0; - out[1] = 0; - out[2] = 0; + } + function exactEquals(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2] && a2[3] === b2[3]; + } + (function() { + var vec2 = create$2(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 4; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + vec2[3] = a2[i + 3]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + a2[i + 3] = vec2[3]; + } + return a2; + }; + })(); + function create$1() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } out[3] = 1; return out; -} -function setAxisAngle(out, axis, rad) { + } + function setAxisAngle(out, axis, rad) { rad = rad * 0.5; var s = Math.sin(rad); out[0] = s * axis[0]; @@ -57518,4910 +39246,1597 @@ function setAxisAngle(out, axis, rad) { out[2] = s * axis[2]; out[3] = Math.cos(rad); return out; -} -function getAxisAngle(out_axis, q) { - var rad = Math.acos(q[3]) * 2.0; - var s = Math.sin(rad / 2.0); - if (s > _commonJs.EPSILON) { - out_axis[0] = q[0] / s; - out_axis[1] = q[1] / s; - out_axis[2] = q[2] / s; - } else { - // If s is zero, return any axis (no rotation - axis does not matter) - out_axis[0] = 1; - out_axis[1] = 0; - out_axis[2] = 0; - } - return rad; -} -function getAngle(a, b) { - var dotproduct = dot(a, b); - return Math.acos(2 * dotproduct * dotproduct - 1); -} -function multiply(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; + } + function multiply(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; out[0] = ax * bw + aw * bx + ay * bz - az * by; out[1] = ay * bw + aw * by + az * bx - ax * bz; out[2] = az * bw + aw * bz + ax * by - ay * bx; out[3] = aw * bw - ax * bx - ay * by - az * bz; return out; -} -function rotateX(out, a, rad) { + } + function rotateX(out, a2, rad) { rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; var bx = Math.sin(rad), bw = Math.cos(rad); out[0] = ax * bw + aw * bx; out[1] = ay * bw + az * bx; out[2] = az * bw - ay * bx; out[3] = aw * bw - ax * bx; return out; -} -function rotateY(out, a, rad) { + } + function rotateY(out, a2, rad) { rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; var by = Math.sin(rad), bw = Math.cos(rad); out[0] = ax * bw - az * by; out[1] = ay * bw + aw * by; out[2] = az * bw + ax * by; out[3] = aw * bw - ay * by; return out; -} -function rotateZ(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bz = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + ay * bz; - out[1] = ay * bw - ax * bz; - out[2] = az * bw + aw * bz; - out[3] = aw * bw - az * bz; - return out; -} -function calculateW(out, a) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); - return out; -} -function exp(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var et = Math.exp(w); - var s = r > 0 ? et * Math.sin(r) / r : 0; - out[0] = x * s; - out[1] = y * s; - out[2] = z * s; - out[3] = et * Math.cos(r); - return out; -} -function ln(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var t = r > 0 ? Math.atan2(r, w) / r : 0; - out[0] = x * t; - out[1] = y * t; - out[2] = z * t; - out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); - return out; -} -function pow(out, a, b) { - ln(out, a); - scale(out, out, b); - exp(out, out); - return out; -} -function slerp(out, a, b, t) { - // benchmarks: - // http://jsperf.com/quaternion-slerp-implementations - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - var omega, cosom, sinom, scale0, scale1; // calc cosine - cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) - if (cosom < 0.0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } // calculate coefficients - if (1.0 - cosom > _commonJs.EPSILON) { - // standard case (slerp) - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; + } + function slerp(out, a2, b2, t) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; + var omega, cosom, sinom, scale0, scale1; + cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > EPSILON) { + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; } else { - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - scale0 = 1.0 - t; - scale1 = t; - } // calculate final values + scale0 = 1 - t; + scale1 = t; + } out[0] = scale0 * ax + scale1 * bx; out[1] = scale0 * ay + scale1 * by; out[2] = scale0 * az + scale1 * bz; out[3] = scale0 * aw + scale1 * bw; return out; -} -function random(out) { - // Implementation of http://planning.cs.uiuc.edu/node198.html - // TODO: Calling random 3 times is probably not the fastest solution - var u1 = _commonJs.RANDOM(); - var u2 = _commonJs.RANDOM(); - var u3 = _commonJs.RANDOM(); - var sqrt1MinusU1 = Math.sqrt(1 - u1); - var sqrtU1 = Math.sqrt(u1); - out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); - out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); - out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); - out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); - return out; -} -function invert(out, a) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - out[0] = -a0 * invDot; - out[1] = -a1 * invDot; - out[2] = -a2 * invDot; - out[3] = a3 * invDot; - return out; -} -function conjugate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a[3]; + } + function conjugate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + out[3] = a2[3]; return out; -} -function fromMat3(out, m) { - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var fTrace = m[0] + m[4] + m[8]; + } + function fromMat3(out, m2) { + var fTrace = m2[0] + m2[4] + m2[8]; var fRoot; - if (fTrace > 0.0) { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w - out[3] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; // 1/(4w) - out[0] = (m[5] - m[7]) * fRoot; - out[1] = (m[6] - m[2]) * fRoot; - out[2] = (m[1] - m[3]) * fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m2[5] - m2[7]) * fRoot; + out[1] = (m2[6] - m2[2]) * fRoot; + out[2] = (m2[1] - m2[3]) * fRoot; } else { - // |w| <= 1/2 - var i = 0; - if (m[4] > m[0]) i = 1; - if (m[8] > m[i * 3 + i]) i = 2; - var j = (i + 1) % 3; - var k = (i + 2) % 3; - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; - out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + var i = 0; + if (m2[4] > m2[0]) i = 1; + if (m2[8] > m2[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m2[i * 3 + i] - m2[j * 3 + j] - m2[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m2[j * 3 + k] - m2[k * 3 + j]) * fRoot; + out[j] = (m2[j * 3 + i] + m2[i * 3 + j]) * fRoot; + out[k] = (m2[k * 3 + i] + m2[i * 3 + k]) * fRoot; } return out; -} -function fromEuler(out, x, y, z) { - var halfToRad = 0.5 * Math.PI / 180.0; - x *= halfToRad; - y *= halfToRad; - z *= halfToRad; - var sx = Math.sin(x); - var cx = Math.cos(x); - var sy = Math.sin(y); - var cy = Math.cos(y); - var sz = Math.sin(z); - var cz = Math.cos(z); - out[0] = sx * cy * cz - cx * sy * sz; - out[1] = cx * sy * cz + sx * cy * sz; - out[2] = cx * cy * sz - sx * sy * cz; - out[3] = cx * cy * cz + sx * sy * sz; - return out; -} -function str(a) { - return "quat(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -var clone = _vec4Js.clone; -var fromValues = _vec4Js.fromValues; -var copy = _vec4Js.copy; -var set = _vec4Js.set; -var add = _vec4Js.add; -var mul = multiply; -var scale = _vec4Js.scale; -var dot = _vec4Js.dot; -var lerp = _vec4Js.lerp; -var length = _vec4Js.length; -var len = length; -var squaredLength = _vec4Js.squaredLength; -var sqrLen = squaredLength; -var normalize = _vec4Js.normalize; -var exactEquals = _vec4Js.exactEquals; -var equals = _vec4Js.equals; -var rotationTo = function() { - var tmpvec3 = _vec3Js.create(); - var xUnitVec3 = _vec3Js.fromValues(1, 0, 0); - var yUnitVec3 = _vec3Js.fromValues(0, 1, 0); - return function(out, a, b) { - var dot = _vec3Js.dot(a, b); - if (dot < -0.999999) { - _vec3Js.cross(tmpvec3, xUnitVec3, a); - if (_vec3Js.len(tmpvec3) < 0.000001) _vec3Js.cross(tmpvec3, yUnitVec3, a); - _vec3Js.normalize(tmpvec3, tmpvec3); - setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; - } else { - _vec3Js.cross(tmpvec3, a, b); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot; - return normalize(out, out); - } - }; -}(); -var sqlerp = function() { - var temp1 = create(); - var temp2 = create(); - return function(out, a, b, c, d, t) { - slerp(temp1, a, d, t); - slerp(temp2, b, c, t); - slerp(out, temp1, temp2, 2 * t * (1 - t)); + } + var clone$2 = clone$3; + var fromValues$1 = fromValues$2; + var copy$1 = copy$2; + var set$1 = set$2; + var normalize = normalize$1; + function equals$1(a2, b2) { + return Math.abs(dot(a2, b2)) >= 1 - EPSILON; + } + var rotationTo = (function() { + var tmpvec3 = create$3(); + var xUnitVec3 = fromValues$3(1, 0, 0); + var yUnitVec3 = fromValues$3(0, 1, 0); + return function(out, a2, b2) { + var dot2 = dot$1(a2, b2); + if (dot2 < -0.999999) { + cross(tmpvec3, xUnitVec3, a2); + if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2); + normalize$2(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); return out; - }; -}(); -var setAxes = function() { - var matr = _mat3Js.create(); - return function(out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - return normalize(out, fromMat3(out, matr)); - }; -}(); - -},{"./common.js":"Li4u6","./mat3.js":"5XUpE","./vec3.js":"cAIcX","./vec4.js":"czCsm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cAIcX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3 Dimensional Vector - * @module vec3 - */ /** - * Creates a new, empty vec3 - * - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec3 initialized with values from an existing vector - * - * @param {ReadonlyVec3} a vector to clone - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Calculates the length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Creates a new vec3 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec3 to another - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the source vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec3 to the given values - * - * @param {vec3} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to ceil - * @returns {vec3} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to floor - * @returns {vec3} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to round - * @returns {vec3} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec3 by a scalar number - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec3} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec3} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the squared length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to negate - * @returns {vec3} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to invert - * @returns {vec3} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to normalize - * @returns {vec3} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Performs a hermite interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "hermite", ()=>hermite); -/** - * Performs a bezier interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "bezier", ()=>bezier); -/** - * Generates a random vector with the given scale - * - * @param {vec3} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec3} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec3 with a mat3. - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat3} m the 3x3 matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec3 with a quat - * Can also be used for dual quaternions. (Multiply it with the real part) - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Rotate a 3D vector around the x-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotate a 3D vector around the y-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotate a 3D vector around the z-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Get the angle between two 3D vectors - * @param {ReadonlyVec3} a The first operand - * @param {ReadonlyVec3} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec3 to zero - * - * @param {vec3} out the receiving vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec3} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(3); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return Math.hypot(x, y, z); -} -function fromValues(x, y, z) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function set(out, x, y, z) { - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return Math.hypot(x, y, z); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return x * x + y * y + z * z; -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return x * x + y * y + z * z; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var len = x * x + y * y + z * z; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cross(out, a, b) { - var ax = a[0], ay = a[1], az = a[2]; - var bx = b[0], by = b[1], bz = b[2]; - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - return out; -} -function hermite(out, a, b, c, d, t) { - var factorTimes2 = t * t; - var factor1 = factorTimes2 * (2 * t - 3) + 1; - var factor2 = factorTimes2 * (t - 2) + t; - var factor3 = factorTimes2 * (t - 1); - var factor4 = factorTimes2 * (3 - 2 * t); - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function bezier(out, a, b, c, d, t) { - var inverseFactor = 1 - t; - var inverseFactorTimesTwo = inverseFactor * inverseFactor; - var factorTimes2 = t * t; - var factor1 = inverseFactorTimesTwo * inverseFactor; - var factor2 = 3 * t * inverseFactorTimesTwo; - var factor3 = 3 * factorTimes2 * inverseFactor; - var factor4 = factorTimes2 * t; - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - var z = _commonJs.RANDOM() * 2.0 - 1.0; - var zScale = Math.sqrt(1.0 - z * z) * scale; - out[0] = Math.cos(r) * zScale; - out[1] = Math.sin(r) * zScale; - out[2] = z * scale; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - var w = m[3] * x + m[7] * y + m[11] * z + m[15]; - w = w || 1.0; - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x * m[0] + y * m[3] + z * m[6]; - out[1] = x * m[1] + y * m[4] + z * m[7]; - out[2] = x * m[2] + y * m[5] + z * m[8]; - return out; -} -function transformQuat(out, a, q) { - // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; - var x = a[0], y = a[1], z = a[2]; // var qvec = [qx, qy, qz]; - // var uv = vec3.cross([], qvec, a); - var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); - var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; // vec3.scale(uuv, uuv, 2); - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; - return out; -} -function rotateX(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateY(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateZ(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function angle(a, b) { - var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b) / mag; - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - return out; -} -function str(a) { - return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2]; - var b0 = b[0], b1 = b[1], b2 = b[2]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 3; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - } - return a; - }; -}(); - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"czCsm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4 Dimensional Vector - * @module vec4 - */ /** - * Creates a new, empty vec4 - * - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec4 initialized with values from an existing vector - * - * @param {ReadonlyVec4} a vector to clone - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec4 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec4 to another - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the source vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec4 to the given values - * - * @param {vec4} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to ceil - * @returns {vec4} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to floor - * @returns {vec4} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to round - * @returns {vec4} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec4 by a scalar number - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec4} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec4's after scaling the second operand by a scalar value - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec4} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to negate - * @returns {vec4} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to invert - * @returns {vec4} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to normalize - * @returns {vec4} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Returns the cross-product of three vectors in a 4-dimensional space - * - * @param {ReadonlyVec4} result the receiving vector - * @param {ReadonlyVec4} U the first vector - * @param {ReadonlyVec4} V the second vector - * @param {ReadonlyVec4} W the third vector - * @returns {vec4} result - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec4} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec4} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec4} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec4 with a mat4. - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec4 with a quat - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Set the components of a vec4 to zero - * - * @param {vec4} out the receiving vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec4} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { + } else if (dot2 > 0.999999) { out[0] = 0; out[1] = 0; out[2] = 0; - out[3] = 0; - } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function fromValues(x, y, z, w) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function set(out, x, y, z, w) { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - out[3] = a[3] * b[3]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - out[3] = a[3] / b[3]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - out[3] = Math.ceil(a[3]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - out[3] = Math.floor(a[3]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - out[3] = Math.min(a[3], b[3]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - out[3] = Math.max(a[3], b[3]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - out[3] = Math.round(a[3]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return Math.hypot(x, y, z, w); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return x * x + y * y + z * z + w * w; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return Math.hypot(x, y, z, w); -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return x * x + y * y + z * z + w * w; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = -a[3]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - out[3] = 1.0 / a[3]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - var len = x * x + y * y + z * z + w * w; - if (len > 0) len = 1 / Math.sqrt(len); - out[0] = x * len; - out[1] = y * len; - out[2] = z * len; - out[3] = w * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; -} -function cross(out, u, v, w) { - var A = v[0] * w[1] - v[1] * w[0], B = v[0] * w[2] - v[2] * w[0], C = v[0] * w[3] - v[3] * w[0], D = v[1] * w[2] - v[2] * w[1], E = v[1] * w[3] - v[3] * w[1], F = v[2] * w[3] - v[3] * w[2]; - var G = u[0]; - var H = u[1]; - var I = u[2]; - var J = u[3]; - out[0] = H * F - I * E + J * D; - out[1] = -(G * F) + I * C - J * B; - out[2] = G * E - H * C + J * A; - out[3] = -(G * D) + H * B - I * A; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - var aw = a[3]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - out[3] = aw + t * (b[3] - aw); - return out; -} -function random(out, scale) { - scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a - // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. - // http://projecteuclid.org/euclid.aoms/1177692644; - var v1, v2, v3, v4; - var s1, s2; - do { - v1 = _commonJs.RANDOM() * 2 - 1; - v2 = _commonJs.RANDOM() * 2 - 1; - s1 = v1 * v1 + v2 * v2; - }while (s1 >= 1); - do { - v3 = _commonJs.RANDOM() * 2 - 1; - v4 = _commonJs.RANDOM() * 2 - 1; - s2 = v3 * v3 + v4 * v4; - }while (s2 >= 1); - var d = Math.sqrt((1 - s1) / s2); - out[0] = scale * v1; - out[1] = scale * v2; - out[2] = scale * v3 * d; - out[3] = scale * v4 * d; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return out; -} -function transformQuat(out, a, q) { - var x = a[0], y = a[1], z = a[2]; - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; - out[3] = a[3]; - return out; -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - return out; -} -function str(a) { - return "vec4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 4; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - vec[3] = a[i + 3]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - a[i + 3] = vec[3]; - } - return a; - }; -}(); - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ceSVb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 2 Dimensional Vector - * @module vec2 - */ /** - * Creates a new, empty vec2 - * - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec2 initialized with values from an existing vector - * - * @param {ReadonlyVec2} a vector to clone - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec2 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec2 to another - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the source vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec2 to the given values - * - * @param {vec2} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to ceil - * @returns {vec2} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to floor - * @returns {vec2} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to round - * @returns {vec2} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec2 by a scalar number - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec2} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec2's after scaling the second operand by a scalar value - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec2} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to negate - * @returns {vec2} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to invert - * @returns {vec2} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to normalize - * @returns {vec2} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec2's - * Note that the cross product must by definition produce a 3D vector - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec2} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec2} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec2} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec2 with a mat2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2", ()=>transformMat2); -/** - * Transforms the vec2 with a mat2d - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2d} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2d", ()=>transformMat2d); -/** - * Transforms the vec2 with a mat3 - * 3rd vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat3} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec2 with a mat4 - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Rotate a 2D vector - * @param {vec2} out The receiving vec2 - * @param {ReadonlyVec2} a The vec2 point to rotate - * @param {ReadonlyVec2} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec2} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Get the angle between two 2D vectors - * @param {ReadonlyVec2} a The first operand - * @param {ReadonlyVec2} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec2 to zero - * - * @param {vec2} out the receiving vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec2} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(2); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; + out[3] = 1; + return out; + } else { + cross(tmpvec3, a2, b2); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot2; + return normalize(out, out); + } + }; + })(); + (function() { + var temp1 = create$1(); + var temp2 = create$1(); + return function(out, a2, b2, c2, d, t) { + slerp(temp1, a2, d, t); + slerp(temp2, b2, c2, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + })(); + (function() { + var matr = create$5(); + return function(out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize(out, fromMat3(out, matr)); + }; + })(); + function create() { + var out = new ARRAY_TYPE(2); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; } return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function fromValues(x, y) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = x; - out[1] = y; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function set(out, x, y) { - out[0] = x; - out[1] = y; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return Math.hypot(x, y); -} -function squaredDistance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return x * x + y * y; -} -function length(a) { - var x = a[0], y = a[1]; - return Math.hypot(x, y); -} -function squaredLength(a) { - var x = a[0], y = a[1]; - return x * x + y * y; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - return out; -} -function normalize(out, a) { - var x = a[0], y = a[1]; - var len = x * x + y * y; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1]; -} -function cross(out, a, b) { - var z = a[0] * b[1] - a[1] * b[0]; - out[0] = out[1] = 0; - out[2] = z; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0], ay = a[1]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - out[0] = Math.cos(r) * scale; - out[1] = Math.sin(r) * scale; - return out; -} -function transformMat2(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y; - out[1] = m[1] * x + m[3] * y; - return out; -} -function transformMat2d(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y + m[4]; - out[1] = m[1] * x + m[3] * y + m[5]; + } + function clone$1(a2) { + var out = new ARRAY_TYPE(2); + out[0] = a2[0]; + out[1] = a2[1]; return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[3] * y + m[6]; - out[1] = m[1] * x + m[4] * y + m[7]; + } + function fromValues(x2, y2) { + var out = new ARRAY_TYPE(2); + out[0] = x2; + out[1] = y2; return out; -} -function transformMat4(out, a, m) { - var x = a[0]; - var y = a[1]; - out[0] = m[0] * x + m[4] * y + m[12]; - out[1] = m[1] * x + m[5] * y + m[13]; + } + function copy(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; return out; -} -function rotate(out, a, b, rad) { - //Translate point to the origin - var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); //perform rotation and translate to correct position - out[0] = p0 * cosC - p1 * sinC + b[0]; - out[1] = p0 * sinC + p1 * cosC + b[1]; + } + function set(out, x2, y2) { + out[0] = x2; + out[1] = y2; return out; -} -function angle(a, b) { - var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], // mag is the product of the magnitudes of a and b - mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), // mag &&.. short circuits if mag == 0 - cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; + } + function transformMat4(out, a2, m2) { + var x2 = a2[0]; + var y2 = a2[1]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[12]; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[13]; return out; -} -function str(a) { - return "vec2(" + a[0] + ", " + a[1] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1]; - var b0 = b[0], b1 = b[1]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)); -} -var len = length; -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 2; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - } - return a; - }; -}(); - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"48TUG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>AltAzimuthCameraView); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>AltAzimuthCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _cameraJs = require("./camera.js"); -class AltAzimuthCameraView extends (0, _cameraJs.CameraView) { - constructor(core){ - super(core); - this.fov = core.config.fov; - this.altitude = 0; - this.azimuth = 0; - } -} -class AltAzimuthCamera extends (0, _cameraJs.CameraBase) { - getView(view) { - super.getView(view); - view.altitude = this.altitude; - view.azimuth = this.azimuth; - view.fov = this._core.config.fov; - } - setView(view, isSmooth) { - super.setView(view, isSmooth); - this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); - this._core.config.fov = view.fov; - } - lerpView(from, to, time) { - super.lerpView(from, to, time); - this.setAltAzimuth((0, _mathJs.MathHelper).lerp(from.altitude, to.altitude, time), (0, _mathJs.MathHelper).lerp(from.azimuth, to.azimuth, time), false); - this._core.config.fov = (0, _mathJs.MathHelper).lerp(from.fov, to.fov, time); - } - update(elapsedTime) { - super.update(elapsedTime); - if (this._core.config.isDebugVisible) { - const altitude = (0, _angleJs.AngleHelper).radiansToDegrees(this.altitude); - const azimuth = (0, _angleJs.AngleHelper).radiansToDegrees(this.azimuth); - this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); - this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); - } - } - get altitude() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITY, this._up, this._right); + } + function equals(a2, b2) { + var a0 = a2[0], a1 = a2[1]; + var b0 = b2[0], b1 = b2[1]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + (function() { + var vec2 = create(); + return function(a2, stride, offset2, count2, fn2, arg) { + var i, l; + if (!stride) { + stride = 2; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + fn2(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + } + return a2; + }; + })(); + class Constants { + } + Constants.TWO_PI = 6.283185307179586; + Constants.PI = 3.141592653589793; + Constants.PI_OVER_TWO = 1.5707963267948966; + Constants.PI_OVER_THREE = 1.0471975511965976; + Constants.PI_OVER_FOUR = 0.7853981633974483; + Constants.PI_OVER_SIX = 0.5235987755982988; + Constants.LOG_2 = 0.6931471805599453; + Constants.RADIANS_PER_DEGREE = 0.017453292519943295; + Constants.DEGREES_PER_RADIAN = 57.29577951308232; + Constants.ROOT_TWO = 1.4142135623730951; + Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; + Constants.ROOT_THREE = 1.7320508075688772; + Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; + Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; + Constants.VECTOR2_ZERO = fromValues(0, 0); + Constants.VECTOR2_ONE = fromValues(1, 1); + Constants.VECTOR2_UNITX = fromValues(1, 0); + Constants.VECTOR2_UNITY = fromValues(0, 1); + Constants.VECTOR3_ZERO = fromValues$3(0, 0, 0); + Constants.VECTOR3_ONE = fromValues$3(1, 1, 1); + Constants.VECTOR3_UNITX = fromValues$3(1, 0, 0); + Constants.VECTOR3_UNITY = fromValues$3(0, 1, 0); + Constants.VECTOR3_UNITZ = fromValues$3(0, 0, 1); + Constants.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); + Constants.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); + Constants.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); + Constants.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); + Constants.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); + Constants.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); + Constants.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); + Constants.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); + Constants.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); + Constants.MAT3_IDENTITY = create$5(); + Constants.MAT4_IDENTITY = create$4(); + Constants.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + Constants.QUAT_IDENTITY = create$1(); + Constants.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); + Constants.MILLISECONDS_PER_DAY = 864e5; + class MathHelper { + static simpleLinearRegression(points2) { + const n = points2.length; + let sumX = 0; + let sumY = 0; + let sumXY = 0; + let sumXX = 0; + for (let i = 0; i < n; i++) { + sumX += points2[i].x; + sumY += points2[i].y; + sumXY += points2[i].x * points2[i].y; + sumXX += points2[i].x * points2[i].x; + } + const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); + const yIntercept = (sumY - slope * sumX) / n; + return { slope, yIntercept }; } - get azimuth() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITX, this._right, this._up); + static clamp(value2, min2, max2) { + return Math.max(Math.min(value2, max2), min2); } - setAltAzimuth(altitude, azimuth, isSmooth) { - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, altitude); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, azimuth); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - if (!isSmooth) this.syncSmooth(); + static lerp(value1, value2, amount) { + return value1 + (value2 - value1) * amount; } - rotate(translationDelta) { - const length = Math.min(this.width, this.height); - let angle = translationDelta[1] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - angle = translationDelta[0] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/angle.js":"hBXkO","../helpers/math.js":"6Lv1i","./camera.js":"1KLf3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dHTsY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -var _glMatrix = require("gl-matrix"); -class Constants { -} -Constants.TWO_PI = 6.283185307179586; -Constants.PI = 3.141592653589793; -Constants.PI_OVER_TWO = 1.5707963267948966; -Constants.PI_OVER_THREE = 1.0471975511965976; -Constants.PI_OVER_FOUR = 0.7853981633974483; -Constants.PI_OVER_SIX = 0.5235987755982988; -Constants.LOG_2 = 0.6931471805599453; -Constants.RADIANS_PER_DEGREE = 0.017453292519943295; -Constants.DEGREES_PER_RADIAN = 57.29577951308232; -Constants.ROOT_TWO = 1.4142135623730951; -Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; -Constants.ROOT_THREE = 1.7320508075688772; -Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; -Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; -Constants.VECTOR2_ZERO = (0, _glMatrix.vec2).fromValues(0, 0); -Constants.VECTOR2_ONE = (0, _glMatrix.vec2).fromValues(1, 1); -Constants.VECTOR2_UNITX = (0, _glMatrix.vec2).fromValues(1, 0); -Constants.VECTOR2_UNITY = (0, _glMatrix.vec2).fromValues(0, 1); -Constants.VECTOR3_ZERO = (0, _glMatrix.vec3).fromValues(0, 0, 0); -Constants.VECTOR3_ONE = (0, _glMatrix.vec3).fromValues(1, 1, 1); -Constants.VECTOR3_UNITX = (0, _glMatrix.vec3).fromValues(1, 0, 0); -Constants.VECTOR3_UNITY = (0, _glMatrix.vec3).fromValues(0, 1, 0); -Constants.VECTOR3_UNITZ = (0, _glMatrix.vec3).fromValues(0, 0, 1); -Constants.VECTOR3_REFLECTX = (0, _glMatrix.vec3).fromValues(1, -1, -1); -Constants.VECTOR3_REFLECTY = (0, _glMatrix.vec3).fromValues(-1, 1, -1); -Constants.VECTOR3_REFLECTZ = (0, _glMatrix.vec3).fromValues(-1, -1, 1); -Constants.VECTOR4_ZERO = (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); -Constants.VECTOR4_ONE = (0, _glMatrix.vec4).fromValues(1, 1, 1, 1); -Constants.VECTOR4_UNITX = (0, _glMatrix.vec4).fromValues(1, 0, 0, 0); -Constants.VECTOR4_UNITY = (0, _glMatrix.vec4).fromValues(0, 1, 0, 0); -Constants.VECTOR4_UNITZ = (0, _glMatrix.vec4).fromValues(0, 0, 1, 0); -Constants.VECTOR4_UNITW = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); -Constants.MAT3_IDENTITY = (0, _glMatrix.mat3).create(); -Constants.MAT4_IDENTITY = (0, _glMatrix.mat4).create(); -Constants.MAT4_ROTATION_MINUS_90 = (0, _glMatrix.mat4).fromValues(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); -Constants.QUAT_IDENTITY = (0, _glMatrix.quat).create(); -Constants.QUAT_ROTATEX_PLUS_90 = (0, _glMatrix.quat).fromValues(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEX_MINUS_90 = (0, _glMatrix.quat).fromValues(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_PLUS_90 = (0, _glMatrix.quat).fromValues(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_MINUS_90 = (0, _glMatrix.quat).fromValues(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_PLUS_90 = (0, _glMatrix.quat).fromValues(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_MINUS_90 = (0, _glMatrix.quat).fromValues(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.MILLISECONDS_PER_DAY = 86400000; - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hBXkO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>AngleHelper); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("./math.js"); -var _constantsJs = require("../constants.js"); -class AngleHelper { - static degreesToRadians(degrees) { - return degrees * (0, _constantsJs.Constants).RADIANS_PER_DEGREE; - } - static radiansToDegrees(radians) { - return radians * (0, _constantsJs.Constants).DEGREES_PER_RADIAN; - } - static wrapAngle(angle) { - if (angle > (0, _constantsJs.Constants).PI) angle = angle - (0, _constantsJs.Constants).TWO_PI; - else if (angle < -(0, _constantsJs.Constants).PI) angle += (0, _constantsJs.Constants).TWO_PI; - return angle; - } - static sphericalToCartesian(altitude, longitude, latitude, result) { - latitude = AngleHelper.degreesToRadians(latitude); - longitude = AngleHelper.degreesToRadians(longitude); - const scale = Math.cos(latitude); - result[0] = altitude * scale * Math.sin(longitude); - result[1] = altitude * Math.sin(latitude); - result[2] = altitude * scale * Math.cos(longitude); - } - static cartesianToSpherical(x, y, z, result) { - result[0] = Math.atan2(x, z); - result[1] = Math.asin(y); + static normalize(value2, min2, max2, from = 0, to = 1) { + return max2 - min2 == 0 ? 0 : Math.max(Math.min((to - from) * (value2 - min2) / (max2 - min2) + from, to), from); } - static angleBetweenVectors(from, to) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - return Math.acos(dot); - } + static splitExponent(value2, result) { + let exponent2 = Math.round(Math.log10(Math.abs(value2))); + let coefficient = value2 / Math.pow(10, exponent2); + if (coefficient < 1) { + coefficient *= 10; + exponent2--; + } + result[0] = coefficient; + result[1] = exponent2; } - static signedAngleBetweenVectors(from, to, up) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - let angle = Math.acos(dot); - (0, _glMatrix.vec3).cross(AngleHelper._vec3, from, to); - if ((0, _glMatrix.vec3).dot(AngleHelper._vec3, up) < 0) angle = -angle; - return angle; - } - } -} -AngleHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","./math.js":"6Lv1i","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6Lv1i":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MathHelper", ()=>MathHelper); -parcelHelpers.export(exports, "PseudoRandom", ()=>PseudoRandom); -class MathHelper { - static simpleLinearRegression(points) { - const n = points.length; - let sumX = 0; - let sumY = 0; - let sumXY = 0; - let sumXX = 0; - for(let i = 0; i < n; i++){ - sumX += points[i].x; - sumY += points[i].y; - sumXY += points[i].x * points[i].y; - sumXX += points[i].x * points[i].x; - } - const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); - const yIntercept = (sumY - slope * sumX) / n; - return { - slope, - yIntercept - }; + static combineExponent(mantissa, exponent2) { + return mantissa * Math.pow(10, exponent2); } - static clamp(value, min, max) { - return Math.max(Math.min(value, max), min); + static isPowerOf2(value2) { + return (value2 & value2 - 1) == 0; } - static lerp(value1, value2, amount) { - return value1 + (value2 - value1) * amount; + } + class PseudoRandom { + constructor(seed) { + this._seed = seed % 2147483647; + if (this._seed <= 0) + this._seed += 2147483646; } - static normalize(value, min, max, from = 0, to = 1) { - return max - min == 0 ? 0 : Math.max(Math.min((to - from) * (value - min) / (max - min) + from, to), from); + next() { + return this._seed = this._seed * 16807 % 2147483647; } - static splitExponent(value, result) { - let exponent = Math.round(Math.log10(Math.abs(value))); - let coefficient = value / Math.pow(10, exponent); - if (coefficient < 1) { - coefficient *= 10; - exponent--; - } - result[0] = coefficient; - result[1] = exponent; + nextFloat() { + return (this.next() - 1) / 2147483646; } - static combineExponent(mantissa, exponent) { - return mantissa * Math.pow(10, exponent); + nextInteger(min2, max2) { + return Math.floor(this.nextFloat() * (max2 - min2 + 1) + min2); } - static isPowerOf2(value) { - return (value & value - 1) == 0; + } + class AngleHelper { + static degreesToRadians(degrees2) { + return degrees2 * Constants.RADIANS_PER_DEGREE; + } + static radiansToDegrees(radians2) { + return radians2 * Constants.DEGREES_PER_RADIAN; + } + static wrapAngle(angle2) { + if (angle2 > Constants.PI) + angle2 = angle2 - Constants.TWO_PI; + else if (angle2 < -Constants.PI) + angle2 += Constants.TWO_PI; + return angle2; + } + static sphericalToCartesian(altitude, longitude2, latitude, result) { + latitude = AngleHelper.degreesToRadians(latitude); + longitude2 = AngleHelper.degreesToRadians(longitude2); + const scale2 = Math.cos(latitude); + result[0] = altitude * scale2 * Math.sin(longitude2); + result[1] = altitude * Math.sin(latitude); + result[2] = altitude * scale2 * Math.cos(longitude2); + } + static cartesianToSpherical(x2, y2, z, result) { + result[0] = Math.atan2(x2, z); + result[1] = Math.asin(y2); } -} -class PseudoRandom { - constructor(seed){ - this._seed = seed % 2147483647; - if (this._seed <= 0) this._seed += 2147483646; + static angleBetweenVectors(from, to) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + return Math.acos(dot2); + } } - next() { - return this._seed = this._seed * 16807 % 2147483647; + static signedAngleBetweenVectors(from, to, up) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + let angle2 = Math.acos(dot2); + cross(AngleHelper._vec3, from, to); + if (dot$1(AngleHelper._vec3, up) < 0) { + angle2 = -angle2; + } + return angle2; + } } - nextFloat() { - return (this.next() - 1) / 2147483646; - } - nextInteger(min, max) { - return Math.floor(this.nextFloat() * (max - min + 1) + min); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1KLf3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraView", ()=>CameraView); -parcelHelpers.export(exports, "CameraBase", ()=>CameraBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _constantsJs = require("../constants.js"); -class CameraView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - } -} -class CameraBase { + } + AngleHelper._vec3 = create$3(); + class CameraBase { getView(view) { - this.getPosition(view.position); + this.getPosition(view.position); } setView(view, isSmooth) { - this.setPosition(view.position, isSmooth); + this.setPosition(view.position, isSmooth); } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setPosition(this._vec3, false); + lerpView(from, to, time2) { + lerp(this._vec3, from.position, to.position, time2); + this.setPosition(this._vec3, false); } get vMatrices() { - return this._vMatrices; + return this._vMatrices; } get inverseVMatrices() { - return this._inverseVMatrices; + return this._inverseVMatrices; } get mvMatrices() { - return this._mvMatrices; + return this._mvMatrices; } get pMatrices() { - return this._pMatrices; + return this._pMatrices; } get inversePMatrices() { - return this._inversePMatrices; + return this._inversePMatrices; } get pickVMatrix() { - return this._pickVMatrix; + return this._pickVMatrix; } get rMatrix() { - return this._mat3; - } - getOrbit(value) { - (0, _glMatrix.quat).copy(value, this._orbitRotation); - } - setOrbit(value, isSmooth) { - (0, _glMatrix.quat).copy(this._orbitRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, value); - } - getPosition(value) { - (0, _glMatrix.vec3).copy(value, this._cameraPosition); - } - setPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, value); - } - constructor(core){ - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this.modelPosition = (0, _glMatrix.vec3).create(); - this.modelScale = (0, _glMatrix.vec3).create(); - this.modelRotation = (0, _glMatrix.quat).create(); - this._orbitRotation = (0, _glMatrix.quat).create(); - this._orbitDirection = (0, _glMatrix.quat).create(); - this._smoothedOrbitRotation = (0, _glMatrix.quat).create(); - this._smoothedCameraPosition = (0, _glMatrix.vec3).create(); - this._smoothedCameraRotation = (0, _glMatrix.quat).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.quat).create(); - this._combinedPosition = (0, _glMatrix.vec3).create(); - this._combinedRotation = (0, _glMatrix.quat).create(); - this._leftToRightEye = (0, _glMatrix.vec3).create(); - this._pickVMatrix = (0, _glMatrix.mat4).create(); - this._eyePositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._vMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._pMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inverseVMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inversePMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; + return this._mat3; + } + getOrbit(value2) { + copy$1(value2, this._orbitRotation); + } + setOrbit(value2, isSmooth) { + copy$1(this._orbitRotation, value2); + if (!isSmooth) { + copy$1(this._smoothedOrbitRotation, value2); + } + } + getPosition(value2) { + copy$3(value2, this._cameraPosition); + } + setPosition(value2, isSmooth) { + copy$3(this._cameraPosition, value2); + if (!isSmooth) { + copy$3(this._smoothedCameraPosition, value2); + } + } + constructor(core) { + this._core = core; + this._vec3 = create$3(); + this._quat = create$1(); + this._mat3 = create$5(); + this._right = create$3(); + this._up = create$3(); + this._forward = create$3(); + this._modelManipulationOrigin = create$3(); + this.modelPosition = create$3(); + this.modelScale = create$3(); + this.modelRotation = create$1(); + this._orbitRotation = create$1(); + this._orbitDirection = create$1(); + this._smoothedOrbitRotation = create$1(); + this._smoothedCameraPosition = create$3(); + this._smoothedCameraRotation = create$1(); + this._cameraPosition = create$3(); + this._cameraRotation = create$1(); + this._combinedPosition = create$3(); + this._combinedRotation = create$1(); + this._leftToRightEye = create$3(); + this._pickVMatrix = create$4(); + this._eyePositions = [create$3(), create$3()]; + this._vMatrices = [create$4(), create$4()]; + this._mvMatrices = [create$4(), create$4()]; + this._pMatrices = [create$4(), create$4()]; + this._inverseVMatrices = [create$4(), create$4()]; + this._inversePMatrices = [create$4(), create$4()]; } reset(isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.quat).copy(this._cameraRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).copy(this._orbitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (!isSmooth) this.syncSmooth(); + copy$3(this._cameraPosition, Constants.VECTOR3_ZERO); + copy$1(this._cameraRotation, Constants.QUAT_IDENTITY); + copy$1(this._orbitRotation, Constants.QUAT_IDENTITY); + if (!isSmooth) { + this.syncSmooth(); + } } update(elapsedTime) { - let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); - amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); - (0, _glMatrix.quat).slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); - const epsilon = 0.000001; - let x; - let y; - let z; - let w; - x = this._smoothedCameraPosition[0] - this._cameraPosition[0]; - y = this._smoothedCameraPosition[1] - this._cameraPosition[1]; - z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - x = this._smoothedCameraRotation[0] - this._cameraRotation[0]; - y = this._smoothedCameraRotation[1] - this._cameraRotation[1]; - z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; - w = this._smoothedCameraRotation[3] - this._cameraRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - x = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; - y = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; - z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; - w = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); - (0, _glMatrix.quat).normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); - (0, _glMatrix.quat).normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); - (0, _glMatrix.quat).conjugate(this._orbitDirection, this._smoothedOrbitRotation); - (0, _glMatrix.vec3).transformMat4(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); - (0, _glMatrix.vec3).transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); - (0, _glMatrix.vec3).add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); - (0, _glMatrix.quat).multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); - (0, _glMatrix.mat3).fromQuat(this._mat3, this._combinedRotation); - this._right[0] = this._mat3[0]; - this._right[1] = this._mat3[1]; - this._right[2] = this._mat3[2]; - this._up[0] = this._mat3[3]; - this._up[1] = this._mat3[4]; - this._up[2] = this._mat3[5]; - this._forward[0] = this._mat3[6]; - this._forward[1] = this._mat3[7]; - this._forward[2] = this._mat3[8]; - const view = this._vMatrices[0]; - view[0] = this._right[0]; - view[1] = this._up[0]; - view[2] = this._forward[0]; - view[4] = this._right[1]; - view[5] = this._up[1]; - view[6] = this._forward[1]; - view[8] = this._right[2]; - view[9] = this._up[2]; - view[10] = this._forward[2]; - view[12] = -(0, _glMatrix.vec3).dot(this._right, this._combinedPosition); - view[13] = -(0, _glMatrix.vec3).dot(this._up, this._combinedPosition); - view[14] = -(0, _glMatrix.vec3).dot(this._forward, this._combinedPosition); - const aspectRatio = this.width / this.height; - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).none) { - if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - const left = -aspectRatio * top; - const right = aspectRatio * top; - const width = right - left; - const height = top - bottom; - const tileWidth = width / this._core.config.tilesX; - const tileHeight = height / this._core.config.tilesY; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); - } else (0, _glMatrix.mat4).perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this.vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this.pMatrices[0]); + let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); + lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); + amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); + slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); + slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); + const epsilon3 = 1e-6; + let x2; + let y2; + let z; + let w2; + x2 = this._smoothedCameraPosition[0] - this._cameraPosition[0]; + y2 = this._smoothedCameraPosition[1] - this._cameraPosition[1]; + z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z) < epsilon3) { + copy$3(this._smoothedCameraPosition, this._cameraPosition); + } + x2 = this._smoothedCameraRotation[0] - this._cameraRotation[0]; + y2 = this._smoothedCameraRotation[1] - this._cameraRotation[1]; + z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; + w2 = this._smoothedCameraRotation[3] - this._cameraRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$1(this._smoothedCameraRotation, this._cameraRotation); + } + x2 = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; + y2 = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; + z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; + w2 = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$1(this._smoothedOrbitRotation, this._orbitRotation); + } + normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); + normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); + conjugate(this._orbitDirection, this._smoothedOrbitRotation); + transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); + subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); + transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); + add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); + multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); + fromQuat$1(this._mat3, this._combinedRotation); + this._right[0] = this._mat3[0]; + this._right[1] = this._mat3[1]; + this._right[2] = this._mat3[2]; + this._up[0] = this._mat3[3]; + this._up[1] = this._mat3[4]; + this._up[2] = this._mat3[5]; + this._forward[0] = this._mat3[6]; + this._forward[1] = this._mat3[7]; + this._forward[2] = this._mat3[8]; + const view = this._vMatrices[0]; + view[0] = this._right[0]; + view[1] = this._up[0]; + view[2] = this._forward[0]; + view[4] = this._right[1]; + view[5] = this._up[1]; + view[6] = this._forward[1]; + view[8] = this._right[2]; + view[9] = this._up[2]; + view[10] = this._forward[2]; + view[12] = -dot$1(this._right, this._combinedPosition); + view[13] = -dot$1(this._up, this._combinedPosition); + view[14] = -dot$1(this._forward, this._combinedPosition); + const aspectRatio = this.width / this.height; + if (this._core.config.stereoMode == StereoMode.none) { + if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + const left = -aspectRatio * top; + const right = aspectRatio * top; + const width2 = right - left; + const height2 = top - bottom; + const tileWidth = width2 / this._core.config.tilesX; + const tileHeight = height2 / this._core.config.tilesY; + frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); } else { - (0, _glMatrix.vec3).cross(this._leftToRightEye, this._forward, this._up); - (0, _glMatrix.vec3).normalize(this._leftToRightEye, this._leftToRightEye); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); - this._vMatrices[0][12] += this._core.config.ipd * 0.5; - (0, _glMatrix.mat4).copy(this._vMatrices[1], this._vMatrices[0]); - this._vMatrices[1][12] -= this._core.config.ipd; - const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - let left = -aspectRatio * top + frustumShift; - let right = aspectRatio * top + frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - left = -aspectRatio * top - frustumShift; - right = aspectRatio * top - frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).multiply(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this._vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this._pMatrices[0]); - (0, _glMatrix.mat4).copy(this._inverseVMatrices[1], this._inverseVMatrices[0]); - this._inverseVMatrices[1][12] += this._core.config.ipd; - (0, _glMatrix.mat4).invert(this._inversePMatrices[1], this._pMatrices[1]); - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); - } + perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); + } + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + invert(this._inverseVMatrices[0], this.vMatrices[0]); + invert(this._inversePMatrices[0], this.pMatrices[0]); + } else { + cross(this._leftToRightEye, this._forward, this._up); + normalize$2(this._leftToRightEye, this._leftToRightEye); + scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); + scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); + this._vMatrices[0][12] += this._core.config.ipd * 0.5; + copy$4(this._vMatrices[1], this._vMatrices[0]); + this._vMatrices[1][12] -= this._core.config.ipd; + const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + let left = -aspectRatio * top + frustumShift; + let right = aspectRatio * top + frustumShift; + frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + left = -aspectRatio * top - frustumShift; + right = aspectRatio * top - frustumShift; + frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); + invert(this._inverseVMatrices[0], this._vMatrices[0]); + invert(this._inversePMatrices[0], this._pMatrices[0]); + copy$4(this._inverseVMatrices[1], this._inverseVMatrices[0]); + this._inverseVMatrices[1][12] += this._core.config.ipd; + invert(this._inversePMatrices[1], this._pMatrices[1]); + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } + } + _zoom(direction, distance2) { + scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance2); + } + rotate(translationDelta) { + } + zoom(zoomDelta, x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + normalize$2(this._vec3, this._vec3); + const distance$1 = zoomDelta * distance(this._combinedPosition, this.modelPosition); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + this._zoom(this._vec3, distance$1); } - _zoom(direction, distance) { - (0, _glMatrix.vec3).scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance); + _twist(axis, angle2) { } - rotate(translationDelta) {} - zoom(zoomDelta, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - const distance = zoomDelta * (0, _glMatrix.vec3).distance(this._combinedPosition, this.modelPosition); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._zoom(this._vec3, distance); + twist(angle2, x2, y2) { } - _twist(axis, angle) {} - twist(angle, x, y) {} - updatePickVMatrix(x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.mat4).lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); + updatePickVMatrix(x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); } syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); + copy$3(this._smoothedCameraPosition, this._cameraPosition); + copy$1(this._smoothedCameraRotation, this._cameraRotation); + copy$1(this._smoothedOrbitRotation, this._orbitRotation); } updateModelManipulationOrigin(from, to) { - const a = (0, _glMatrix.vec3).create(); - const b = (0, _glMatrix.vec3).create(); - const c = (0, _glMatrix.vec3).create(); - const d = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformMat4(a, from, this.modelMMatrix); - (0, _glMatrix.vec3).transformMat4(b, to, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(a, this._cameraPosition, a); - (0, _glMatrix.vec3).subtract(b, this._cameraPosition, b); - (0, _glMatrix.vec3).transformQuat(c, a, this._orbitDirection); - (0, _glMatrix.vec3).transformQuat(d, b, this._orbitDirection); - (0, _glMatrix.vec3).subtract(c, c, a); - (0, _glMatrix.vec3).subtract(d, d, b); - (0, _glMatrix.vec3).subtract(this._vec3, c, d); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).add(this._cameraPosition, this._cameraPosition, this._vec3); - (0, _glMatrix.vec3).add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); - } - unproject(position, x, y, z) { - (0, _glMatrix.vec3).set(position, 2 * x / this.width - 1, 1 - 2 * y / this.height, z); - (0, _glMatrix.vec3).transformMat4(position, position, this._inversePMatrices[0]); - (0, _glMatrix.vec3).transformMat4(position, position, this._inverseVMatrices[0]); + const a2 = create$3(); + const b2 = create$3(); + const c2 = create$3(); + const d = create$3(); + transformMat4$2(a2, from, this.modelMMatrix); + transformMat4$2(b2, to, this.modelMMatrix); + subtract(a2, this._cameraPosition, a2); + subtract(b2, this._cameraPosition, b2); + transformQuat(c2, a2, this._orbitDirection); + transformQuat(d, b2, this._orbitDirection); + subtract(c2, c2, a2); + subtract(d, d, b2); + subtract(this._vec3, c2, d); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + add(this._cameraPosition, this._cameraPosition, this._vec3); + add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); + } + unproject(position2, x2, y2, z) { + set$3(position2, 2 * x2 / this.width - 1, 1 - 2 * y2 / this.height, z); + transformMat4$2(position2, position2, this._inversePMatrices[0]); + transformMat4$2(position2, position2, this._inverseVMatrices[0]); } translate(translationDelta) { - const distance = (0, _glMatrix.vec3).distance(this.modelPosition, this._combinedPosition); - const height = 2 * Math.tan(this._core.config.fov / 2) * distance / this.height; - (0, _glMatrix.vec3).set(this._vec3, height * translationDelta[0], -height * translationDelta[1], 0); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).subtract(this._cameraPosition, this._cameraPosition, this._vec3); - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fYehi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _mainJs = require("./main.js"); -var _angleJs = require("./helpers/angle.js"); -class Config { - constructor(core){ - this.reset(); + const distance$1 = distance(this.modelPosition, this._combinedPosition); + const height2 = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; + set$3(this._vec3, height2 * translationDelta[0], -height2 * translationDelta[1], 0); + transformQuat(this._vec3, this._vec3, this._combinedRotation); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + subtract(this._cameraPosition, this._cameraPosition, this._vec3); + } + } + class AltAzimuthCamera extends CameraBase { + getView(view) { + super.getView(view); + view.altitude = this.altitude; + view.azimuth = this.azimuth; + view.fov = this._core.config.fov; + } + setView(view, isSmooth) { + super.setView(view, isSmooth); + this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); + this._core.config.fov = view.fov; + } + lerpView(from, to, time2) { + super.lerpView(from, to, time2); + this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time2), MathHelper.lerp(from.azimuth, to.azimuth, time2), false); + this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time2); + } + update(elapsedTime) { + super.update(elapsedTime); + if (this._core.config.isDebugVisible) { + const altitude = AngleHelper.radiansToDegrees(this.altitude); + const azimuth = AngleHelper.radiansToDegrees(this.azimuth); + this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); + this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + } + } + get altitude() { + transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITY, this._up, this._right); + } + get azimuth() { + transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITX, this._right, this._up); + } + setAltAzimuth(altitude, azimuth, isSmooth) { + setAxisAngle(this._quat, Constants.VECTOR3_UNITX, altitude); + multiply(this._orbitRotation, this._quat, Constants.QUAT_IDENTITY); + setAxisAngle(this._quat, Constants.VECTOR3_UNITY, azimuth); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + if (!isSmooth) { + this.syncSmooth(); + } + } + rotate(translationDelta) { + const length2 = Math.min(this.width, this.height); + let angle2 = translationDelta[1] * Constants.PI / length2; + setAxisAngle(this._quat, Constants.VECTOR3_UNITX, angle2); + multiply(this._orbitRotation, this._quat, this._orbitRotation); + angle2 = translationDelta[0] * Constants.PI / length2; + setAxisAngle(this._quat, Constants.VECTOR3_UNITY, angle2); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + } + } + let Config$2 = class Config { + constructor(core) { + this.reset(); } reset() { - this.isDebugVisible = false; - this.logLevel = (0, _mainJs.LogLevel).warn; - this.shaderPath = "shaders"; - this.fontPath = "fonts"; - this.modelDistance = 0.5; - this.modelSize = 0.25; - this.stereoMode = (0, _mainJs.StereoMode).none; - this.ipd = 0.06; - this.screenDistance = 0.5; - this.fov = (0, _angleJs.AngleHelper).degreesToRadians(30); - this.nearPlane = 0.01; - this.farPlane = 100; - this.pickWidth = 512; - this.pickHeight = 512; - this.pickHoldDelay = 1000; - this.pickSelectDelay = 100; - this.resizeMinimumDelay = 250; - this.rotationSmoothing = 0.02; - this.positionSmoothing = 0.02; - this.focusSmoothing = 0.01; - this.scaleSmoothing = 0.02; - this.mouseWheelZoomScale = -0.002; - this.mouseWheelRotationScale = -0.002; - this.dragToleranceSquared = 100; - this.manipulatorMinRelativeDistanceSquared = 100; - this.isMultiTouchEnabled = true; - this.isMultiTouchZoomEnabled = true; - this.isMultiTouchTwistEnabled = true; - this.isMultiTouchRotateEnabled = true; - this.isMultiTouchTranslateEnabled = true; - this.multiTouchZoomScale = 1; - this.cameraMinDistance = 0.1; - this.cameraMaxDistance = 10; - this.xrControllerRayColor = (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5); - this.xrControllerProfile = "windows-mixed-reality"; - this.xrControllerHandedness = "right"; - this.paletteColor = new Uint8Array([ - 0x80, - 0x80, - 0x80, - 0 - ]); - this.textColor = (0, _glMatrix.vec3).create(); - this.textHoverColor = (0, _glMatrix.vec3).create(); - this.textBorderColor = (0, _glMatrix.vec3).create(); - this.textBorderWidth = 0x18 / 0xff; - this.identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - this.axesTextLabelMaxGlyphs = 32; - this.axesTextColor = (0, _glMatrix.vec3).create(); - this.axesTextBorderColor = (0, _glMatrix.vec3).create(); - this.axesTextHoverColor = (0, _glMatrix.vec3).create(); - this.axesTextLabelMajorSize = 0.03; - this.axesTextLabelMinorSize = 0.02; - this.axesTextTitleMaxGlyphs = 127; - this.axesTextTitleSize = 0.05; - this.axesTextHeadingMaxGlyphs = 128; - this.axesTextHeadingSize = 0.075; - this.axesTextTitleLineHeight = 1.5; - this.axesTextHeadingLineHeight = 1.5; - this.axesTextLabelLineHeight = 1.5; - this.axesGridMajorThickness = 0.0002; - this.axesGridMinorThickness = 0.0001; - this.axesGridZeroThickness = 0.002; - this.axesGridPickDivisionHeight = 0.025; - this.axesGridBackgroundColor = (0, _glMatrix.vec3).create(); - this.axesGridHighlightColor = (0, _glMatrix.vec3).create(); - this.axesGridMinorColor = (0, _glMatrix.vec3).create(); - this.axesGridMajorColor = (0, _glMatrix.vec3).create(); - this.axesGridZeroColor = (0, _glMatrix.vec3).create(); - this.axesGridDefaultDivisions = 10; - this.keyTitleMaxGlyphs = 64; - this.keyLabelMaxGlyphs = 64; - this.selectionColor = (0, _glMatrix.vec3).create(); - this.hoverColor = (0, _glMatrix.vec3).create(); - this.activeColor = (0, _glMatrix.vec3).create(); - this.highlightMode = (0, _mainJs.HighlightMode).color; - this.lassoThickness = 4; - this.lassoDashWidth = 2; - this.lassoColor = (0, _glMatrix.vec3).create(); - this.minCubifiedTreeMapSlice = 0.01; - this.sdfBuffer = 0xc0; - this.sdfBorder = 0x0; - this.forceDirectIsEnabled = false; - this.forceDirectAttraction = 1; - this.forceDirectRepulsion = 1; - this.forceDirectGravity = 1; - this.forceDirectInterval = 0.1; - this.forceDirectMaxDistance = 0.1; - this.forceDirectTheta = 1; - this.forceDirectIterationsPerLayout = 1; - this.forceDirectEdgeWeightPower = 1; - this.forceDirectLockX = false; - this.forceDirectLockY = false; - this.forceDirectLockZ = false; - this.transitionDuration = 400; - this.transitionStaggering = 100; - this.transitionView = true; - this.isTransitionPickingEnabled = false; - this.backgroundColor = (0, _glMatrix.vec4).create(); - this.theme = (0, _mainJs.Theme).light; - this.renderMode = (0, _mainJs.RenderMode).color; - this.tilesX = 1; - this.tilesY = 1; - this.tileOffsetX = 0; - this.tileOffsetY = 0; + this.isDebugVisible = false; + this.logLevel = LogLevel.warn; + this.shaderPath = "shaders"; + this.fontPath = "fonts"; + this.modelDistance = 0.5; + this.modelSize = 0.25; + this.stereoMode = StereoMode.none; + this.ipd = 0.06; + this.screenDistance = 0.5; + this.fov = AngleHelper.degreesToRadians(30); + this.nearPlane = 0.01; + this.farPlane = 100; + this.pickWidth = 512; + this.pickHeight = 512; + this.pickHoldDelay = 1e3; + this.pickSelectDelay = 100; + this.resizeMinimumDelay = 250; + this.rotationSmoothing = 0.02; + this.positionSmoothing = 0.02; + this.focusSmoothing = 0.01; + this.scaleSmoothing = 0.02; + this.mouseWheelZoomScale = -2e-3; + this.mouseWheelRotationScale = -2e-3; + this.dragToleranceSquared = 100; + this.manipulatorMinRelativeDistanceSquared = 100; + this.isMultiTouchEnabled = true; + this.isMultiTouchZoomEnabled = true; + this.isMultiTouchTwistEnabled = true; + this.isMultiTouchRotateEnabled = true; + this.isMultiTouchTranslateEnabled = true; + this.multiTouchZoomScale = 1; + this.cameraMinDistance = 0.1; + this.cameraMaxDistance = 10; + this.xrControllerRayColor = fromValues$3(0.5, 0.5, 0.5); + this.xrControllerProfile = "windows-mixed-reality"; + this.xrControllerHandedness = "right"; + this.paletteColor = new Uint8Array([128, 128, 128, 0]); + this.textColor = create$3(); + this.textHoverColor = create$3(); + this.textBorderColor = create$3(); + this.textBorderWidth = 24 / 255; + this.identityRotation = Constants.VECTOR3_UNITY; + this.axesTextLabelMaxGlyphs = 32; + this.axesTextColor = create$3(); + this.axesTextBorderColor = create$3(); + this.axesTextHoverColor = create$3(); + this.axesTextLabelMajorSize = 0.03; + this.axesTextLabelMinorSize = 0.02; + this.axesTextTitleMaxGlyphs = 127; + this.axesTextTitleSize = 0.05; + this.axesTextHeadingMaxGlyphs = 128; + this.axesTextHeadingSize = 0.075; + this.axesTextTitleLineHeight = 1.5; + this.axesTextHeadingLineHeight = 1.5; + this.axesTextLabelLineHeight = 1.5; + this.axesGridMajorThickness = 2e-4; + this.axesGridMinorThickness = 1e-4; + this.axesGridZeroThickness = 2e-3; + this.axesGridPickDivisionHeight = 0.025; + this.axesGridBackgroundColor = create$3(); + this.axesGridHighlightColor = create$3(); + this.axesGridMinorColor = create$3(); + this.axesGridMajorColor = create$3(); + this.axesGridZeroColor = create$3(); + this.axesGridDefaultDivisions = 10; + this.keyTitleMaxGlyphs = 64; + this.keyLabelMaxGlyphs = 64; + this.selectionColor = create$3(); + this.hoverColor = create$3(); + this.activeColor = create$3(); + this.highlightMode = HighlightMode.color; + this.lassoThickness = 4; + this.lassoDashWidth = 2; + this.lassoColor = create$3(); + this.minCubifiedTreeMapSlice = 0.01; + this.sdfBuffer = 192; + this.sdfBorder = 0; + this.forceDirectIsEnabled = false; + this.forceDirectAttraction = 1; + this.forceDirectRepulsion = 1; + this.forceDirectGravity = 1; + this.forceDirectInterval = 0.1; + this.forceDirectMaxDistance = 0.1; + this.forceDirectTheta = 1; + this.forceDirectIterationsPerLayout = 1; + this.forceDirectEdgeWeightPower = 1; + this.forceDirectLockX = false; + this.forceDirectLockY = false; + this.forceDirectLockZ = false; + this.transitionDuration = 400; + this.transitionStaggering = 100; + this.transitionView = true; + this.isTransitionPickingEnabled = false; + this.backgroundColor = create$2(); + this.theme = Theme.light; + this.ambientColor = create$3(); + this.renderMode = RenderMode.color; + this.tilesX = 1; + this.tilesY = 1; + this.tileOffsetX = 0; + this.tileOffsetY = 0; } get theme() { - return this._theme; - } - set theme(value) { - if (this._theme != value) { - this._theme = value; - switch(value){ - case (0, _mainJs.Theme).dark: - (0, _glMatrix.vec4).set(this.backgroundColor, 0, 0, 0, 1); - (0, _glMatrix.vec3).set(this.textColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.textHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.04, 0.04, 0.04); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.05, 0.05, 0.05); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.05, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.9, 0.9, 0.9); - break; - case (0, _mainJs.Theme).light: - (0, _glMatrix.vec4).set(this.backgroundColor, 1, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.textHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.textBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.925, 0.925, 0.925); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.8, 0.8, 0.8); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.7, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.1, 0.1, 0.1); - break; - } - if (this.themeChangedCallback) this.themeChangedCallback(this._theme); - } - } -} - -},{"gl-matrix":"erHGu","./constants.js":"dHTsY","./main.js":"b6Xbk","./helpers/angle.js":"hBXkO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lwhbM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugText", ()=>DebugText); -class DebugText { + return this._theme; + } + set theme(value2) { + if (this._theme != value2) { + this._theme = value2; + switch (value2) { + case Theme.dark: + set$2(this.backgroundColor, 0, 0, 0, 1); + set$3(this.textColor, 0.9, 0.9, 0.9); + set$3(this.textHoverColor, 1, 1, 1); + set$3(this.textBorderColor, 0, 0, 0); + set$3(this.axesTextColor, 0.9, 0.9, 0.9); + set$3(this.axesTextBorderColor, 0, 0, 0); + set$3(this.axesTextHoverColor, 1, 1, 1); + set$3(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); + set$3(this.axesGridHighlightColor, 0.04, 0.04, 0.04); + set$3(this.axesGridMinorColor, 0.05, 0.05, 0.05); + set$3(this.axesGridMajorColor, 0.1, 0.1, 0.1); + set$3(this.axesGridZeroColor, 0.05, 0.1, 0.1); + set$3(this.selectionColor, 1, 1, 0); + set$3(this.hoverColor, 1, 0, 1); + set$3(this.activeColor, 0, 1, 1); + set$3(this.lassoColor, 0.9, 0.9, 0.9); + break; + case Theme.light: + set$2(this.backgroundColor, 1, 1, 1, 1); + set$3(this.textColor, 0, 0, 0); + set$3(this.textHoverColor, 0.1, 0.1, 0.1); + set$3(this.textBorderColor, 1, 1, 1); + set$3(this.axesTextColor, 0, 0, 0); + set$3(this.axesTextBorderColor, 1, 1, 1); + set$3(this.axesTextHoverColor, 0.1, 0.1, 0.1); + set$3(this.axesGridBackgroundColor, 1, 1, 1); + set$3(this.axesGridHighlightColor, 0.925, 0.925, 0.925); + set$3(this.axesGridMinorColor, 0.9, 0.9, 0.9); + set$3(this.axesGridMajorColor, 0.8, 0.8, 0.8); + set$3(this.axesGridZeroColor, 0.7, 0.9, 0.9); + set$3(this.selectionColor, 1, 1, 0); + set$3(this.hoverColor, 1, 0, 1); + set$3(this.activeColor, 0, 1, 1); + set$3(this.lassoColor, 0.1, 0.1, 0.1); + break; + } + if (this.themeChangedCallback) { + this.themeChangedCallback(this._theme); + } + } + } + }; + class DebugText { get text() { - return this._text; + return this._text; } - constructor(){ - this.clear(); + constructor() { + this.clear(); } clear() { - this._text = ""; - } - addLine(value) { - this._text += value + "\n"; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kh2PX":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fps", ()=>Fps); -class Fps { + this._text = ""; + } + addLine(value2) { + this._text += value2 + "\n"; + } + } + class Fps { get frameCounter() { - return this._frameCounter; + return this._frameCounter; } get totalFrames() { - return this._totalFrames; + return this._totalFrames; } - constructor(core){ - this._core = core; - this._totalFrames = 0; - this.reset(); + constructor(core) { + this._core = core; + this._totalFrames = 0; + this.reset(); } update(elapsedTime) { - this._elapsedTime += elapsedTime; - if (this._elapsedTime > 1000) { - this._elapsedTime -= 1000; - this._fps = this._frameCounter; - this._frameCounter = 0; - } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`fps ${this._fps}`); + this._elapsedTime += elapsedTime; + if (this._elapsedTime > 1e3) { + this._elapsedTime -= 1e3; + this._fps = this._frameCounter; + this._frameCounter = 0; + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`fps ${this._fps}`); + } } render() { - this._frameCounter++; - this._totalFrames++; + this._frameCounter++; + this._totalFrames++; } reset() { - this._fps = 0; - this._frameCounter = 0; - this._elapsedTime = 0; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a14oj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteType", ()=>PaletteType); -parcelHelpers.export(exports, "PaletteName", ()=>PaletteName); -parcelHelpers.export(exports, "PaletteResources", ()=>PaletteResources); -parcelHelpers.export(exports, "PaletteBase", ()=>PaletteBase); -parcelHelpers.export(exports, "Palette", ()=>Palette); -const PaletteType = { + this._fps = 0; + this._frameCounter = 0; + this._elapsedTime = 0; + } + } + const PaletteType = { sequentialsinglehue: "sequentialsinglehue", sequentialmultihue: "sequentialmultihue", diverging: "diverging", qualitative: "qualitative" -}; -const PaletteName = { - blues: "blues", - greens: "greens", - greys: "greys", - oranges: "oranges", - purples: "purples", - reds: "reds", - viridis: "viridis", - inferno: "inferno", - magma: "magma", - plasma: "plasma", - bluegreen: "bluegreen", - bluepurple: "bluepurple", - greenblue: "greenblue", - orangered: "orangered", - purpleblue: "purpleblue", - purplebluegreen: "purplebluegreen", - purplered: "purplered", - redpurple: "redpurple", - yellowgreen: "yellowgreen", - yellowgreenblue: "yellowgreenblue", - yelloworangebrown: "yelloworangebrown", - yelloworangered: "yelloworangered", - brownbluegreen: "brownbluegreen", - pinkyellowgreen: "pinkyellowgreen", - purplegreen: "purplegreen", - purpleorange: "purpleorange", - redblue: "redblue", - redgrey: "redgrey", - redyellowblue: "redyellowblue", - redyellowgreen: "redyellowgreen", - spectral: "spectral", - accent: "accent", - dark2: "dark2", - paired: "paired", - pastel1: "pastel1", - pastel2: "pastel2", - set1: "set1", - set2: "set2", - set3: "set3" -}; -class PaletteResources { - constructor(){ - this.palettes = { - "blues": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 251, - 255, - 222, - 235, - 247, - 198, - 219, - 239, - 158, - 202, - 225, - 107, - 174, - 214, - 66, - 146, - 198, - 33, - 113, - 181, - 8, - 81, - 156, - 8, - 48, - 107 - ]) - }, - "greens": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 252, - 245, - 229, - 245, - 224, - 199, - 233, - 192, - 161, - 217, - 155, - 116, - 196, - 118, - 65, - 171, - 93, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "greys": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 255, - 255, - 240, - 240, - 240, - 217, - 217, - 217, - 189, - 189, - 189, - 150, - 150, - 150, - 115, - 115, - 115, - 82, - 82, - 82, - 37, - 37, - 37, - 0, - 0, - 0 - ]) - }, - "oranges": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 235, - 254, - 230, - 206, - 253, - 208, - 162, - 253, - 174, - 107, - 253, - 141, - 60, - 241, - 105, - 19, - 217, - 72, - 1, - 166, - 54, - 3, - 127, - 39, - 4 - ]) - }, - "purples": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 252, - 251, - 253, - 239, - 237, - 245, - 218, - 218, - 235, - 188, - 189, - 220, - 158, - 154, - 200, - 128, - 125, - 186, - 106, - 81, - 163, - 84, - 39, - 143, - 63, - 0, - 125 - ]) - }, - "reds": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 240, - 254, - 224, - 210, - 252, - 187, - 161, - 252, - 146, - 114, - 251, - 106, - 74, - 239, - 59, - 44, - 203, - 24, - 29, - 165, - 15, - 21, - 103, - 0, - 13 - ]) - }, - "viridis": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x48, - 0x25, - 0x75, - 0x41, - 0x44, - 0x87, - 0x35, - 0x60, - 0x8d, - 0x2a, - 0x78, - 0x8e, - 0x21, - 0x91, - 0x8d, - 0x22, - 0xa8, - 0x84, - 0x43, - 0xbf, - 0x71, - 0x7a, - 0xd1, - 0x51, - 0xbc, - 0xdf, - 0x27 - ]) - }, - "inferno": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x17, - 0x0c, - 0x3b, - 0x42, - 0x0a, - 0x68, - 0x6b, - 0x17, - 0x6e, - 0x93, - 0x26, - 0x67, - 0xbb, - 0x37, - 0x55, - 0xdd, - 0x51, - 0x3a, - 0xf3, - 0x77, - 0x1a, - 0xfc, - 0xa5, - 0x0a, - 0xf6, - 0xd6, - 0x45 - ]) - }, - "magma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x15, - 0x0e, - 0x37, - 0x3b, - 0x0f, - 0x70, - 0x65, - 0x1a, - 0x80, - 0x8c, - 0x29, - 0x81, - 0xb6, - 0x37, - 0x7a, - 0xde, - 0x49, - 0x68, - 0xf7, - 0x6f, - 0x5c, - 0xfe, - 0x9f, - 0x6d, - 0xfe, - 0xce, - 0x91 - ]) - }, - "plasma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x42, - 0x03, - 0x9d, - 0x6a, - 0x00, - 0xa8, - 0x90, - 0x0d, - 0xa4, - 0xb1, - 0x2a, - 0x90, - 0xcb, - 0x47, - 0x79, - 0xe1, - 0x64, - 0x62, - 0xf2, - 0x83, - 0x4c, - 0xfc, - 0xa6, - 0x36, - 0xfc, - 0xce, - 0x25 - ]) - }, - "bluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 229, - 245, - 249, - 204, - 236, - 230, - 153, - 216, - 201, - 102, - 194, - 164, - 65, - 174, - 118, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "bluepurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 224, - 236, - 244, - 191, - 211, - 230, - 158, - 188, - 218, - 140, - 150, - 198, - 140, - 107, - 177, - 136, - 65, - 157, - 129, - 15, - 124, - 77, - 0, - 75 - ]) - }, - "greenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 240, - 224, - 243, - 219, - 204, - 235, - 197, - 168, - 221, - 181, - 123, - 204, - 196, - 78, - 179, - 211, - 43, - 140, - 190, - 8, - 104, - 172, - 8, - 64, - 129 - ]) - }, - "orangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 236, - 254, - 232, - 200, - 253, - 212, - 158, - 253, - 187, - 132, - 252, - 141, - 89, - 239, - 101, - 72, - 215, - 48, - 31, - 179, - 0, - 0, - 127, - 0, - 0 - ]) - }, - "purpleblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 231, - 242, - 208, - 209, - 230, - 166, - 189, - 219, - 116, - 169, - 207, - 54, - 144, - 192, - 5, - 112, - 176, - 4, - 90, - 141, - 2, - 56, - 88 - ]) - }, - "purplebluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 226, - 240, - 208, - 209, - 230, - 166, - 189, - 219, - 103, - 169, - 207, - 54, - 144, - 192, - 2, - 129, - 138, - 1, - 108, - 89, - 1, - 70, - 54 - ]) - }, - "purplered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 244, - 249, - 231, - 225, - 239, - 212, - 185, - 218, - 201, - 148, - 199, - 223, - 101, - 176, - 231, - 41, - 138, - 206, - 18, - 86, - 152, - 0, - 67, - 103, - 0, - 31 - ]) - }, - "redpurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 243, - 253, - 224, - 221, - 252, - 197, - 192, - 250, - 159, - 181, - 247, - 104, - 161, - 221, - 52, - 151, - 174, - 1, - 126, - 122, - 1, - 119, - 73, - 0, - 106 - ]) - }, - "yellowgreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 247, - 252, - 185, - 217, - 240, - 163, - 173, - 221, - 142, - 120, - 198, - 121, - 65, - 171, - 93, - 35, - 132, - 67, - 0, - 104, - 55, - 0, - 69, - 41 - ]) - }, - "yellowgreenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 217, - 237, - 248, - 177, - 199, - 233, - 180, - 127, - 205, - 187, - 65, - 182, - 196, - 29, - 145, - 192, - 34, - 94, - 168, - 37, - 52, - 148, - 8, - 29, - 88 - ]) - }, - "yelloworangebrown": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 255, - 247, - 188, - 254, - 227, - 145, - 254, - 196, - 79, - 254, - 153, - 41, - 236, - 112, - 20, - 204, - 76, - 2, - 153, - 52, - 4, - 102, - 37, - 6 - ]) - }, - "yelloworangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 204, - 255, - 237, - 160, - 254, - 217, - 118, - 254, - 178, - 76, - 253, - 141, - 60, - 252, - 78, - 42, - 227, - 26, - 28, - 189, - 0, - 38, - 128, - 0, - 38 - ]) - }, - "brownbluegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 84, - 48, - 5, - 140, - 81, - 10, - 191, - 129, - 45, - 223, - 194, - 125, - 246, - 232, - 195, - 245, - 245, - 245, - 199, - 234, - 229, - 128, - 205, - 193, - 53, - 151, - 143, - 1, - 102, - 94, - 0, - 60, - 48 - ]) - }, - "pinkyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 142, - 1, - 82, - 197, - 27, - 125, - 222, - 119, - 174, - 241, - 182, - 218, - 253, - 224, - 239, - 247, - 247, - 247, - 230, - 245, - 208, - 184, - 225, - 134, - 127, - 188, - 65, - 77, - 146, - 33, - 39, - 100, - 25 - ]) - }, - "purplegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 64, - 0, - 75, - 118, - 42, - 131, - 153, - 112, - 171, - 194, - 165, - 207, - 231, - 212, - 232, - 247, - 247, - 247, - 217, - 240, - 211, - 166, - 219, - 160, - 90, - 174, - 97, - 27, - 120, - 55, - 0, - 68, - 27 - ]) - }, - "purpleorange": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 127, - 59, - 8, - 179, - 88, - 6, - 224, - 130, - 20, - 253, - 184, - 99, - 254, - 224, - 182, - 247, - 247, - 247, - 216, - 218, - 235, - 178, - 171, - 210, - 128, - 115, - 172, - 84, - 39, - 136, - 45, - 0, - 75 - ]) - }, - "redblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 247, - 247, - 247, - 209, - 229, - 240, - 146, - 197, - 222, - 67, - 147, - 195, - 33, - 102, - 172, - 5, - 48, - 97 - ]) - }, - "redgrey": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 255, - 255, - 255, - 224, - 224, - 224, - 186, - 186, - 186, - 135, - 135, - 135, - 77, - 77, - 77, - 26, - 26, - 26 - ]) - }, - "redyellowblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 144, - 255, - 255, - 191, - 224, - 243, - 248, - 171, - 217, - 233, - 116, - 173, - 209, - 69, - 117, - 180, - 49, - 54, - 149 - ]) - }, - "redyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 217, - 239, - 139, - 166, - 217, - 106, - 102, - 189, - 99, - 26, - 152, - 80, - 0, - 104, - 55 - ]) - }, - "spectral": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 158, - 1, - 66, - 213, - 62, - 79, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 230, - 245, - 152, - 171, - 221, - 164, - 102, - 194, - 165, - 50, - 136, - 189, - 94, - 79, - 162 - ]) - }, - "accent": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 127, - 201, - 127, - 190, - 174, - 212, - 253, - 192, - 134, - 255, - 255, - 153, - 56, - 108, - 176, - 240, - 2, - 127, - 191, - 91, - 23, - 102, - 102, - 102 - ]) - }, - "dark2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 27, - 158, - 119, - 217, - 95, - 2, - 117, - 112, - 179, - 231, - 41, - 138, - 102, - 166, - 30, - 230, - 171, - 2, - 166, - 118, - 29, - 102, - 102, - 102 - ]) - }, - "paired": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 166, - 206, - 227, - 31, - 120, - 180, - 178, - 223, - 138, - 51, - 160, - 44, - 251, - 154, - 153, - 227, - 26, - 28, - 253, - 191, - 111, - 255, - 127, - 0, - 202, - 178, - 214, - 106, - 61, - 154, - 255, - 255, - 153, - 177, - 89, - 40 - ]) - }, - "pastel1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 251, - 180, - 174, - 179, - 205, - 227, - 204, - 235, - 197, - 222, - 203, - 228, - 254, - 217, - 166, - 255, - 255, - 204, - 229, - 216, - 189, - 253, - 218, - 236, - 242, - 242, - 242 - ]) - }, - "pastel2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 179, - 226, - 205, - 253, - 205, - 172, - 203, - 213, - 232, - 244, - 202, - 228, - 230, - 245, - 201, - 255, - 242, - 174, - 241, - 226, - 204, - 204, - 204, - 204 - ]) - }, - "set1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 228, - 26, - 28, - 55, - 126, - 184, - 77, - 175, - 74, - 152, - 78, - 163, - 255, - 127, - 0, - 255, - 255, - 51, - 166, - 86, - 40, - 247, - 129, - 191, - 153, - 153, - 153 - ]) - }, - "set2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 102, - 194, - 165, - 252, - 141, - 98, - 141, - 160, - 203, - 231, - 138, - 195, - 166, - 216, - 84, - 255, - 217, - 47, - 229, - 196, - 148, - 179, - 179, - 179 - ]) - }, - "set3": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 141, - 211, - 199, - 255, - 255, - 179, - 190, - 186, - 218, - 251, - 128, - 114, - 128, - 177, - 211, - 253, - 180, - 98, - 179, - 222, - 105, - 252, - 205, - 229, - 217, - 217, - 217, - 188, - 128, - 189, - 204, - 235, - 197, - 255, - 237, - 111 - ]) - } - }; + }; + class PaletteResources { + constructor() { + this.palettes = { + "blues": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 251, 255, 222, 235, 247, 198, 219, 239, 158, 202, 225, 107, 174, 214, 66, 146, 198, 33, 113, 181, 8, 81, 156, 8, 48, 107]) }, + "greens": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 252, 245, 229, 245, 224, 199, 233, 192, 161, 217, 155, 116, 196, 118, 65, 171, 93, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "greys": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 255, 255, 240, 240, 240, 217, 217, 217, 189, 189, 189, 150, 150, 150, 115, 115, 115, 82, 82, 82, 37, 37, 37, 0, 0, 0]) }, + "oranges": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 235, 254, 230, 206, 253, 208, 162, 253, 174, 107, 253, 141, 60, 241, 105, 19, 217, 72, 1, 166, 54, 3, 127, 39, 4]) }, + "purples": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([252, 251, 253, 239, 237, 245, 218, 218, 235, 188, 189, 220, 158, 154, 200, 128, 125, 186, 106, 81, 163, 84, 39, 143, 63, 0, 125]) }, + "reds": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 240, 254, 224, 210, 252, 187, 161, 252, 146, 114, 251, 106, 74, 239, 59, 44, 203, 24, 29, 165, 15, 21, 103, 0, 13]) }, + "viridis": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([72, 37, 117, 65, 68, 135, 53, 96, 141, 42, 120, 142, 33, 145, 141, 34, 168, 132, 67, 191, 113, 122, 209, 81, 188, 223, 39]) }, + "inferno": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([23, 12, 59, 66, 10, 104, 107, 23, 110, 147, 38, 103, 187, 55, 85, 221, 81, 58, 243, 119, 26, 252, 165, 10, 246, 214, 69]) }, + "magma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([21, 14, 55, 59, 15, 112, 101, 26, 128, 140, 41, 129, 182, 55, 122, 222, 73, 104, 247, 111, 92, 254, 159, 109, 254, 206, 145]) }, + "plasma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([66, 3, 157, 106, 0, 168, 144, 13, 164, 177, 42, 144, 203, 71, 121, 225, 100, 98, 242, 131, 76, 252, 166, 54, 252, 206, 37]) }, + "bluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 229, 245, 249, 204, 236, 230, 153, 216, 201, 102, 194, 164, 65, 174, 118, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "bluepurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 224, 236, 244, 191, 211, 230, 158, 188, 218, 140, 150, 198, 140, 107, 177, 136, 65, 157, 129, 15, 124, 77, 0, 75]) }, + "greenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 240, 224, 243, 219, 204, 235, 197, 168, 221, 181, 123, 204, 196, 78, 179, 211, 43, 140, 190, 8, 104, 172, 8, 64, 129]) }, + "orangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 236, 254, 232, 200, 253, 212, 158, 253, 187, 132, 252, 141, 89, 239, 101, 72, 215, 48, 31, 179, 0, 0, 127, 0, 0]) }, + "purpleblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 231, 242, 208, 209, 230, 166, 189, 219, 116, 169, 207, 54, 144, 192, 5, 112, 176, 4, 90, 141, 2, 56, 88]) }, + "purplebluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 226, 240, 208, 209, 230, 166, 189, 219, 103, 169, 207, 54, 144, 192, 2, 129, 138, 1, 108, 89, 1, 70, 54]) }, + "purplered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 244, 249, 231, 225, 239, 212, 185, 218, 201, 148, 199, 223, 101, 176, 231, 41, 138, 206, 18, 86, 152, 0, 67, 103, 0, 31]) }, + "redpurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 243, 253, 224, 221, 252, 197, 192, 250, 159, 181, 247, 104, 161, 221, 52, 151, 174, 1, 126, 122, 1, 119, 73, 0, 106]) }, + "yellowgreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 247, 252, 185, 217, 240, 163, 173, 221, 142, 120, 198, 121, 65, 171, 93, 35, 132, 67, 0, 104, 55, 0, 69, 41]) }, + "yellowgreenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 217, 237, 248, 177, 199, 233, 180, 127, 205, 187, 65, 182, 196, 29, 145, 192, 34, 94, 168, 37, 52, 148, 8, 29, 88]) }, + "yelloworangebrown": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 255, 247, 188, 254, 227, 145, 254, 196, 79, 254, 153, 41, 236, 112, 20, 204, 76, 2, 153, 52, 4, 102, 37, 6]) }, + "yelloworangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 204, 255, 237, 160, 254, 217, 118, 254, 178, 76, 253, 141, 60, 252, 78, 42, 227, 26, 28, 189, 0, 38, 128, 0, 38]) }, + "brownbluegreen": { type: PaletteType.diverging, colors: new Uint8Array([84, 48, 5, 140, 81, 10, 191, 129, 45, 223, 194, 125, 246, 232, 195, 245, 245, 245, 199, 234, 229, 128, 205, 193, 53, 151, 143, 1, 102, 94, 0, 60, 48]) }, + "pinkyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([142, 1, 82, 197, 27, 125, 222, 119, 174, 241, 182, 218, 253, 224, 239, 247, 247, 247, 230, 245, 208, 184, 225, 134, 127, 188, 65, 77, 146, 33, 39, 100, 25]) }, + "purplegreen": { type: PaletteType.diverging, colors: new Uint8Array([64, 0, 75, 118, 42, 131, 153, 112, 171, 194, 165, 207, 231, 212, 232, 247, 247, 247, 217, 240, 211, 166, 219, 160, 90, 174, 97, 27, 120, 55, 0, 68, 27]) }, + "purpleorange": { type: PaletteType.diverging, colors: new Uint8Array([127, 59, 8, 179, 88, 6, 224, 130, 20, 253, 184, 99, 254, 224, 182, 247, 247, 247, 216, 218, 235, 178, 171, 210, 128, 115, 172, 84, 39, 136, 45, 0, 75]) }, + "redblue": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 247, 247, 247, 209, 229, 240, 146, 197, 222, 67, 147, 195, 33, 102, 172, 5, 48, 97]) }, + "redgrey": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 255, 255, 255, 224, 224, 224, 186, 186, 186, 135, 135, 135, 77, 77, 77, 26, 26, 26]) }, + "redyellowblue": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 144, 255, 255, 191, 224, 243, 248, 171, 217, 233, 116, 173, 209, 69, 117, 180, 49, 54, 149]) }, + "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, + "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, + "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, + "category10": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 255, 127, 14, 44, 160, 44, 214, 39, 40, 148, 103, 189, 140, 86, 75, 227, 119, 194, 127, 127, 127, 188, 189, 34, 23, 190, 207]) }, + "category20": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 174, 199, 232, 255, 127, 14, 255, 187, 120, 44, 160, 44, 152, 223, 138, 214, 39, 40, 255, 152, 150, 148, 103, 189, 197, 176, 213, 140, 86, 75, 196, 156, 148, 227, 119, 194, 247, 182, 210, 127, 127, 127, 199, 199, 199, 188, 189, 34, 219, 219, 141, 23, 190, 207, 158, 218, 229]) }, + "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, + "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, + "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, + "pastel2": { type: PaletteType.qualitative, colors: new Uint8Array([179, 226, 205, 253, 205, 172, 203, 213, 232, 244, 202, 228, 230, 245, 201, 255, 242, 174, 241, 226, 204, 204, 204, 204]) }, + "set1": { type: PaletteType.qualitative, colors: new Uint8Array([228, 26, 28, 55, 126, 184, 77, 175, 74, 152, 78, 163, 255, 127, 0, 255, 255, 51, 166, 86, 40, 247, 129, 191, 153, 153, 153]) }, + "set2": { type: PaletteType.qualitative, colors: new Uint8Array([102, 194, 165, 252, 141, 98, 141, 160, 203, 231, 138, 195, 166, 216, 84, 255, 217, 47, 229, 196, 148, 179, 179, 179]) }, + "set3": { type: PaletteType.qualitative, colors: new Uint8Array([141, 211, 199, 255, 255, 179, 190, 186, 218, 251, 128, 114, 128, 177, 211, 253, 180, 98, 179, 222, 105, 252, 205, 229, 217, 217, 217, 188, 128, 189, 204, 235, 197, 255, 237, 111]) } + }; } -} -class PaletteBase { + } + class PaletteBase { get colors() { - return this._colors; + return this._colors; } - set colors(value) { - if (this._colors != value) { - this._colors = value; - this._changed = true; - } + set colors(value2) { + if (this._colors != value2) { + this._colors = value2; + this._changed = true; + } } - constructor(){ - this._colors = null; + constructor() { + this._colors = null; } copyFrom(palette) { - if (palette.colors) this.colors = new Uint8Array(palette.colors); - else this.colors = null; - } - update() {} -} -class Palette extends PaletteBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3tuGu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -parcelHelpers.export(exports, "Controller", ()=>Controller); -var _mainJs = require("../main.js"); -var _objJs = require("../helpers/obj.js"); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class ControllerVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(controller){ - this.controller = controller; - } -} -class Controller { - get isInitialized() { - return this._isInitialized; - } - get mMatrix() { - return this._mMatrix; - } - get indexCount() { - return this._indexCount; + if (palette.colors) { + this.colors = new Uint8Array(palette.colors); + } else { + this.colors = null; + } } - get vertices() { - return this._vertices; + update() { } - get indices() { - return this._indices; + } + let Palette$2 = class Palette extends PaletteBase { + }; + class PositionVertex { + static getPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + set$3(value2, buffer[offset2], buffer[offset2 + 1], buffer[offset2 + 2]); } - get texture() { - return this._texture; + static setPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + buffer[offset2] = value2[0]; + buffer[offset2 + 1] = value2[1]; + buffer[offset2 + 2] = value2[2]; } - get rayMMatrix() { - return this._rayMMatrix; + } + PositionVertex.SIZE = 3; + PositionVertex.SIZE_BYTES = 12; + class PositionColorVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set$3(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255); + } + static setColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); } - get rayIndexCount() { - return this._rayIndexCount; + } + PositionColorVertex.SIZE_BYTES = 16; + PositionColorVertex.POSITION_OFFSET_BYTES = 0; + PositionColorVertex.COLOR_OFFSET_BYTES = 12; + class PositionTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - get rayVertices() { - return this._rayVertices; + } + PositionTextureVertex.SIZE_BYTES = 16; + PositionTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; + class PositionTexturePickVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$2(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); } - get rayIndices() { - return this._rayIndices; + } + PositionTexturePickVertex.SIZE_BYTES = 20; + PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; + PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; + PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; + class PositionNormalTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$3(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - constructor(core, options){ - this._cubeObj = `o Cube -v 1.000000 -1.000000 -1.000000 -v 1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 -0.999999 -v 0.999999 1.000000 1.000001 -v -1.000000 1.000000 1.000000 -v -1.000000 1.000000 -1.000000 -vt 1.000000 0.333333 -vt 1.000000 0.666667 -vt 0.666667 0.666667 -vt 0.666667 0.333333 -vt 0.666667 0.000000 -vt 0.000000 0.333333 -vt 0.000000 0.000000 -vt 0.333333 0.000000 -vt 0.333333 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.666667 -vt 0.333333 0.333333 -vt 0.333333 0.666667 -vt 1.000000 0.000000 -vn 0.000000 -1.000000 0.000000 -vn 0.000000 1.000000 0.000000 -vn 1.000000 0.000000 0.000000 -vn -0.000000 0.000000 1.000000 -vn -1.000000 -0.000000 -0.000000 -vn 0.000000 0.000000 -1.000000 -s off -f 2/1/1 3/2/1 4/3/1 -f 8/1/2 7/4/2 6/5/2 -f 5/6/3 6/7/3 2/8/3 -f 6/8/4 7/5/4 3/4/4 -f 3/9/5 7/10/5 8/11/5 -f 1/12/6 4/13/6 8/11/6 -f 1/4/1 2/1/1 4/3/1 -f 5/14/2 8/1/2 6/5/2 -f 1/12/3 5/6/3 2/8/3 -f 2/12/4 6/8/4 3/4/4 -f 4/13/5 3/9/5 8/11/5 -f 5/6/6 1/12/6 8/11/6`; - this._core = core; - this._obj = options.obj; - this._texture = options.texture || new ImageData(new Uint8ClampedArray([ - 0, - 0, - 0, - 255 - ]), 1, 1); + } + PositionNormalTextureVertex.SIZE_BYTES = 20; + PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; + PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; + class PickGridVertex { + static getTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$3(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$2(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + set$2(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535, bufferView.getUint16(offset2 + 4, true) / 65535, bufferView.getUint16(offset2 + 6, true) / 65535); + } + static setBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + bufferView.setUint16(offset2 + 4, value2[2] * 65535, true); + bufferView.setUint16(offset2 + 6, value2[3] * 65535, true); } - initialize() { - const _vec3 = (0, _glMatrix.vec3).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - const objMesh = new (0, _objJs.ObjHelper)(this._core).read(this._obj || this._cubeObj); - if (!this._obj) { - this.useRayPose = true; - const modelThickness = 0.02; - const modelLength = 0.1; - (0, _glMatrix.vec3).set(_vec3, modelThickness, modelThickness, modelLength); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, 1); - (0, _glMatrix.mat4).translate(this._mMatrix, this._mMatrix, _vec3); - } - this._vertices = objMesh.vertices; - this._indices = objMesh.indices; - this._indexCount = objMesh.indexCount; - this._rayMMatrix = (0, _glMatrix.mat4).create(); - const rayVertices = (0, _cubeJs.Cube).POSITIONS; - this._rayVertices = new ArrayBuffer((0, _vertexJs.PositionColorVertex).SIZE_BYTES * rayVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const rayVerticesView = new DataView(this._rayVertices); - const rayIndices = (0, _cubeJs.Cube).INDICES; - this._rayIndices = new Uint16Array(rayIndices); - const rayVertexCount = rayVertices.length / (0, _vertexJs.PositionVertex).SIZE; - this._rayIndexCount = rayIndices.length; - for(let i = 0; i < rayVertexCount; i++){ - (0, _glMatrix.vec3).set(_vec3, rayVertices[i * (0, _vertexJs.PositionVertex).SIZE], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _vertexJs.PositionColorVertex).setPosition(rayVerticesView, i, _vec3); - (0, _vertexJs.PositionColorVertex).setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); - } - const rayThickness = 0.0025; - const rayLength = 10; - (0, _glMatrix.vec3).set(_vec3, rayThickness, rayThickness, rayLength); - (0, _glMatrix.mat4).fromScaling(this._rayMMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, -0.5); - (0, _glMatrix.mat4).translate(this._rayMMatrix, this._rayMMatrix, _vec3); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "controller initialized"); - } - update(elapsedTime) {} -} - -},{"../main.js":"b6Xbk","../helpers/obj.js":"bfvOU","gl-matrix":"erHGu","../meshes/cube.js":"dYecn","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bfvOU":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ObjMesh", ()=>ObjMesh); -parcelHelpers.export(exports, "ObjHelper", ()=>ObjHelper); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class ObjMesh { -} -class ObjHelper { - constructor(core){ - this._core = core; - } - read(data) { - const start = window.performance.now(); - const indices = []; - const positions = []; - const normals = []; - const texCoords = []; - const meshes = []; - const indexOffsets = []; - const indexCounts = []; - const faceLookup = {}; - const lines = data.split("\n"); - let faceCount = 0; - for(let i = 0; i < lines.length; i++){ - const parts = lines[i].trim().split(" "); - if (parts.length > 0) switch(parts[0]){ - case "o": - meshes.push(parts[1]); - indexOffsets.push(indices.length); - break; - case "v": - positions.push(parseFloat(parts[1])); - positions.push(parseFloat(parts[2])); - positions.push(parseFloat(parts[3])); - break; - case "vt": - texCoords.push(parseFloat(parts[1])); - texCoords.push(parseFloat(parts[2])); - break; - case "vn": - normals.push(parseFloat(parts[1])); - normals.push(parseFloat(parts[2])); - normals.push(parseFloat(parts[3])); - break; - case "f": - for(let i = 0; i < parts.length - 1; i++){ - const part = parts[i + 1]; - if (faceLookup[part] == undefined) faceLookup[part] = faceCount++; - indices.push(faceLookup[part]); - } - break; - case "usemtl": - case "mtllib": - default: - break; - } - } - for(let i = 0; i < meshes.length - 1; i++)indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); - indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * Object.keys(faceLookup).length); - const dataView = new DataView(vertices); - let minX = Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let minZ = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - let maxZ = -Number.MAX_VALUE; - const faces = Object.keys(faceLookup); - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - let hasTexCoords, hasNormals; - if (faces.length > 0) { - const faceParts = faces[0].split("/"); - hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); - hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); - } - for(let i = 0; i < faces.length; i++){ - const faceParts = faces[i].split("/"); - let index = (parseInt(faceParts[0]) - 1) * 3; - const x = positions[index]; - const y = positions[index + 1]; - const z = positions[index + 2]; - (0, _glMatrix.vec3).set(_vec3, x, y, z); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(dataView, i, _vec3); - minX = Math.min(x, minX); - minY = Math.min(y, minY); - minZ = Math.min(z, minZ); - maxX = Math.max(x, maxX); - maxY = Math.max(y, maxY); - maxZ = Math.max(z, maxZ); - if (hasNormals) { - index = (parseInt(faceParts[2]) - 1) * 3; - (0, _glMatrix.vec3).set(_vec3, normals[index], normals[index + 1], normals[index + 2]); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(dataView, i, _vec3); - } - if (hasTexCoords) { - index = (parseInt(faceParts[1]) - 1) * 2; - (0, _glMatrix.vec2).set(_vec2, texCoords[index], texCoords[index + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(dataView, i, _vec2); - } - } - const originX = (minX + maxX) / 2; - const originY = (minY + maxY) / 2; - const originZ = (minZ + maxZ) / 2; - const objMesh = new ObjMesh(); - objMesh.vertices = vertices; - objMesh.indices = new Uint16Array(indices); - objMesh.meshes = meshes; - objMesh.indexOffsets = indexOffsets; - objMesh.indexCounts = indexCounts; - objMesh.indexCount = indices.length; - objMesh.minX = minX; - objMesh.minY = minY; - objMesh.minZ = minZ; - objMesh.maxX = maxX; - objMesh.maxY = maxY; - objMesh.maxZ = maxZ; - objMesh.originX = originX; - objMesh.originY = originY; - objMesh.originZ = originZ; - this._core.log.write((0, _mainJs.LogLevel).info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); - return objMesh; - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8lW8V":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PositionVertex", ()=>PositionVertex); -parcelHelpers.export(exports, "PositionColorVertex", ()=>PositionColorVertex); -parcelHelpers.export(exports, "PositionTextureVertex", ()=>PositionTextureVertex); -parcelHelpers.export(exports, "PositionTexturePickVertex", ()=>PositionTexturePickVertex); -parcelHelpers.export(exports, "PositionNormalVertex", ()=>PositionNormalVertex); -parcelHelpers.export(exports, "PositionNormalColorVertex", ()=>PositionNormalColorVertex); -parcelHelpers.export(exports, "PositionNormalTextureVertex", ()=>PositionNormalTextureVertex); -parcelHelpers.export(exports, "PickGridVertex", ()=>PickGridVertex); -parcelHelpers.export(exports, "UnitVertex", ()=>UnitVertex); -var _glMatrix = require("gl-matrix"); -class PositionVertex { - static getPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - (0, _glMatrix.vec3).set(value, buffer[offset], buffer[offset + 1], buffer[offset + 2]); - } - static setPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - buffer[offset] = value[0]; - buffer[offset + 1] = value[1]; - buffer[offset + 2] = value[2]; - } -} -PositionVertex.SIZE = 3; -PositionVertex.SIZE_BYTES = 12; -class PositionColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionColorVertex.SIZE_BYTES = 16; -PositionColorVertex.POSITION_OFFSET_BYTES = 0; -PositionColorVertex.COLOR_OFFSET_BYTES = 12; -class PositionTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionTextureVertex.SIZE_BYTES = 16; -PositionTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; -class PositionTexturePickVertex { - static getPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } -} -PositionTexturePickVertex.SIZE_BYTES = 20; -PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; -PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; -PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; -class PositionNormalVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } -} -PositionNormalVertex.SIZE_BYTES = 16; -PositionNormalVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalVertex.NORMAL_OFFSET_BYTES = 12; -class PositionNormalColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionNormalColorVertex.SIZE_BYTES = 20; -PositionNormalColorVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalColorVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalColorVertex.COLOR_OFFSET_BYTES = 16; -class PositionNormalTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionNormalTextureVertex.SIZE_BYTES = 20; -PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; -class PickGridVertex { - static getTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF, bufferView.getUint16(offset + 4, true) / 0xFFFF, bufferView.getUint16(offset + 6, true) / 0xFFFF); - } - static setBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - bufferView.setUint16(offset + 4, value[2] * 0xFFFF, true); - bufferView.setUint16(offset + 6, value[3] * 0xFFFF, true); - } -} -PickGridVertex.SIZE_BYTES = 32; -PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; -PickGridVertex.NORMAL_OFFSET_BYTES = 12; -PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; -PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; -PickGridVertex.BOUNDS_OFFSET_BYTES = 24; -class UnitVertex { - static getIdHover(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, true); - } - static setIdHover(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, value, true); + } + PickGridVertex.SIZE_BYTES = 32; + PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; + PickGridVertex.NORMAL_OFFSET_BYTES = 12; + PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; + PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; + PickGridVertex.BOUNDS_OFFSET_BYTES = 24; + class UnitVertex { + static getIdHover(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, true); + } + static setIdHover(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, value2, true); } static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); } - static getTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + static getTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - static setTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + static setTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); } - static getColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF); + static getColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255); } - static setColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); + static setColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); } static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; - toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); - toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); } - static getOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true)); + static getOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + set(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true)); } - static setOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); + static setOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); } static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); } - static getScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + static getScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - static setScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + static setScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + set$1(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + set$1(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getSelected(bufferView, index) { - return bufferView.getInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES) / 0x7F; - } - static setSelected(bufferView, index, value) { - bufferView.setInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES, value * 0x7F); + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$2(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getSelected(bufferView, index2) { + return bufferView.getInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES) / 127; + } + static setSelected(bufferView, index2, value2) { + bufferView.setInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES, value2 * 127); } static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); + toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); } - static getRounding(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, true); + static getRounding(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, true); } - static setRounding(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, value, true); + static setRounding(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, value2, true); } static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); } - static getParameter1(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, true); + static getParameter1(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, true); } - static setParameter1(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, value, true); + static setParameter1(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, value2, true); } static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); } - static getParameter2(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, true); + static getParameter2(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, true); } - static setParameter2(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, value, true); + static setParameter2(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, value2, true); } static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); } - static getMaterial(bufferView, index) { - return bufferView.getUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES); + static getMaterial(bufferView, index2) { + return bufferView.getUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES); } - static setMaterial(bufferView, index, value) { - bufferView.setUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES, value); + static setMaterial(bufferView, index2, value2) { + bufferView.setUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES, value2); } static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); + toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); } - static getTexture(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES); + static getTexture(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES); } - static setTexture(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES, value); + static setTexture(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES, value2); } static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); } - static getSdfBuffer(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES); + static getSdfBuffer(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES); } - static setSdfBuffer(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES, value); + static setSdfBuffer(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES, value2); } static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); } - static getSdfBorder(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES); + static getSdfBorder(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES); } - static setSdfBorder(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES, value); + static setSdfBorder(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES, value2); } static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); - } -} -UnitVertex.SIZE_BYTES = 92; -UnitVertex.ID_HOVER_OFFSET_BYTES = 0; -UnitVertex.ID_COLOR_OFFSET_BYTES = 4; -UnitVertex.ORDER_OFFSET_BYTES = 8; -UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; -UnitVertex.SELECTED_OFFSET_BYTES = 80; -UnitVertex.TRANSLATION_OFFSET_BYTES = 16; -UnitVertex.COLOR_OFFSET_BYTES = 28; -UnitVertex.MATERIAL_OFFSET_BYTES = 30; -UnitVertex.SCALE_OFFSET_BYTES = 32; -UnitVertex.ROUNDING_OFFSET_BYTES = 44; -UnitVertex.ROTATION_OFFSET_BYTES = 48; -UnitVertex.TEXCOORD_OFFSET_BYTES = 64; -UnitVertex.TEXTURE_OFFSET_BYTES = 81; -UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; -UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; -UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; -UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dYecn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class Cube { -} -Cube.POSITIONS = new Float32Array([ + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); + } + static getMatId(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES, value2); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint16(offset2) / 255; + value2[1] = bufferView.getUint16(offset2 + 2) / 255; + value2[2] = bufferView.getUint16(offset2 + 4) / 255; + } + static setMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 255); + bufferView.setUint16(offset2 + 2, value2[1] * 255); + bufferView.setUint16(offset2 + 4, value2[2] * 255); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatFuzz(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatGloss(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, value2, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value2, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint8(offset2) / 255; + value2[1] = bufferView.getUint8(offset2 + 1) / 255; + value2[2] = bufferView.getUint8(offset2 + 2) / 255; + value2[3] = bufferView.getUint8(offset2 + 3) / 255; + } + static setSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); + } + } + UnitVertex.SIZE_BYTES = 120; + UnitVertex.ID_HOVER_OFFSET_BYTES = 0; + UnitVertex.ID_COLOR_OFFSET_BYTES = 4; + UnitVertex.ORDER_OFFSET_BYTES = 8; + UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; + UnitVertex.SELECTED_OFFSET_BYTES = 80; + UnitVertex.TRANSLATION_OFFSET_BYTES = 16; + UnitVertex.COLOR_OFFSET_BYTES = 28; + UnitVertex.MATERIAL_OFFSET_BYTES = 30; + UnitVertex.SCALE_OFFSET_BYTES = 32; + UnitVertex.ROUNDING_OFFSET_BYTES = 44; + UnitVertex.ROTATION_OFFSET_BYTES = 48; + UnitVertex.TEXCOORD_OFFSET_BYTES = 64; + UnitVertex.TEXTURE_OFFSET_BYTES = 81; + UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; + UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; + UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; + UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; + UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; + UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; + UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; + UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; + UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; + UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; + UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; + class ObjMesh { + } + class ObjHelper { + constructor(core) { + this._core = core; + } + read(data2) { + const start = window.performance.now(); + const indices = []; + const positions = []; + const normals = []; + const texCoords = []; + const meshes = []; + const indexOffsets = []; + const indexCounts = []; + const faceLookup = {}; + const lines = data2.split("\n"); + let faceCount = 0; + for (let i = 0; i < lines.length; i++) { + const parts = lines[i].trim().split(" "); + if (parts.length > 0) { + switch (parts[0]) { + case "o": + meshes.push(parts[1]); + indexOffsets.push(indices.length); + break; + case "v": + positions.push(parseFloat(parts[1])); + positions.push(parseFloat(parts[2])); + positions.push(parseFloat(parts[3])); + break; + case "vt": + texCoords.push(parseFloat(parts[1])); + texCoords.push(parseFloat(parts[2])); + break; + case "vn": + normals.push(parseFloat(parts[1])); + normals.push(parseFloat(parts[2])); + normals.push(parseFloat(parts[3])); + break; + case "f": + for (let i2 = 0; i2 < parts.length - 1; i2++) { + const part = parts[i2 + 1]; + if (faceLookup[part] == void 0) { + faceLookup[part] = faceCount++; + } + indices.push(faceLookup[part]); + } + break; + } + } + } + for (let i = 0; i < meshes.length - 1; i++) { + indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); + } + indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); + const dataView = new DataView(vertices); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let minZ2 = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY2 = -Number.MAX_VALUE; + let maxZ = -Number.MAX_VALUE; + const faces = Object.keys(faceLookup); + const _vec2 = create(); + const _vec3 = create$3(); + let hasTexCoords, hasNormals; + if (faces.length > 0) { + const faceParts = faces[0].split("/"); + hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); + hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); + } + for (let i = 0; i < faces.length; i++) { + const faceParts = faces[i].split("/"); + let index2 = (parseInt(faceParts[0]) - 1) * 3; + const x2 = positions[index2]; + const y2 = positions[index2 + 1]; + const z = positions[index2 + 2]; + set$3(_vec3, x2, y2, z); + PositionNormalTextureVertex.setPosition(dataView, i, _vec3); + minX = Math.min(x2, minX); + minY = Math.min(y2, minY); + minZ2 = Math.min(z, minZ2); + maxX = Math.max(x2, maxX); + maxY2 = Math.max(y2, maxY2); + maxZ = Math.max(z, maxZ); + if (hasNormals) { + index2 = (parseInt(faceParts[2]) - 1) * 3; + set$3(_vec3, normals[index2], normals[index2 + 1], normals[index2 + 2]); + PositionNormalTextureVertex.setNormal(dataView, i, _vec3); + } + if (hasTexCoords) { + index2 = (parseInt(faceParts[1]) - 1) * 2; + set(_vec2, texCoords[index2], texCoords[index2 + 1]); + PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); + } + } + const originX = (minX + maxX) / 2; + const originY = (minY + maxY2) / 2; + const originZ = (minZ2 + maxZ) / 2; + const objMesh = new ObjMesh(); + objMesh.vertices = vertices; + objMesh.indices = new Uint16Array(indices); + objMesh.meshes = meshes; + objMesh.indexOffsets = indexOffsets; + objMesh.indexCounts = indexCounts; + objMesh.indexCount = indices.length; + objMesh.minX = minX; + objMesh.minY = minY; + objMesh.minZ = minZ2; + objMesh.maxX = maxX; + objMesh.maxY = maxY2; + objMesh.maxZ = maxZ; + objMesh.originX = originX; + objMesh.originY = originY; + objMesh.originZ = originZ; + this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); + return objMesh; + } + } + class Cube { + } + Cube.POSITIONS = new Float32Array([ -0.5, 0.5, 0.5, @@ -62446,192 +40861,90 @@ Cube.POSITIONS = new Float32Array([ -0.5, -0.5, -0.5 -]); -Cube.INDICES = new Uint16Array([ - 5, - 4, - 1, - 0, - 3, - 4, - 7, - 5, - 6, - 1, - 2, - 3, - 6, - 7 -]); -Cube.CUBE_MAP_INDICES = new Uint16Array([ - 2, - 3, - 1, - 0, - 4, - 3, - 7, - 2, - 6, - 1, - 5, - 4, - 6, - 7 -]); -Cube.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Cube.FACE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0.0, 0.5, 0.0), - (0, _glMatrix.vec3).fromValues(0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, -0.5, 0.0), - (0, _glMatrix.vec3).fromValues(-0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, 0.5), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, -0.5) -]; -Cube.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, -1, 0, 1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, -1, 0, 1, 0, 1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, 1, 0, -1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, 1, 0, 1, 0, -1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Cube.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, 0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0.5) -]; -Cube.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; -Cube.EDGE_CORNERS = [ - [ - 0, - 1 - ], - [ - 1, - 5 - ], - [ - 4, - 5 - ], - [ - 0, - 4 - ], - [ - 2, - 3 - ], - [ - 2, - 6 - ], - [ - 6, - 7 - ], - [ - 3, - 7 - ], - [ - 1, - 2 - ], - [ - 5, - 6 - ], - [ - 4, - 7 - ], - [ - 0, - 3 - ] -]; -Cube.EDGE_FACES = [ - [ - 0, - 4 - ], - [ - 0, - 1 - ], - [ - 0, - 5 - ], - [ - 0, - 3 - ], - [ - 2, - 4 - ], - [ - 2, - 1 - ], - [ - 2, - 5 - ], - [ - 2, - 3 - ], - [ - 1, - 4 - ], - [ - 1, - 5 - ], - [ - 3, - 5 - ], - [ - 3, - 4 - ] -]; -Cube.EDGE_AXIS = [ + ]); + Cube.INDICES = new Uint16Array([5, 4, 1, 0, 3, 4, 7, 5, 6, 1, 2, 3, 6, 7]); + Cube.CUBE_MAP_INDICES = new Uint16Array([2, 3, 1, 0, 4, 3, 7, 2, 6, 1, 5, 4, 6, 7]); + Cube.FACE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Cube.FACE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0), + fromValues$3(0, 0, 0.5), + fromValues$3(0, 0, -0.5) + ]; + Cube.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), + fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), + fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), + fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Cube.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0.5), + fromValues$3(0.5, 0.5, 0), + fromValues$3(0, 0.5, -0.5), + fromValues$3(-0.5, 0.5, 0), + fromValues$3(0, -0.5, 0.5), + fromValues$3(0.5, -0.5, 0), + fromValues$3(0, -0.5, -0.5), + fromValues$3(-0.5, -0.5, 0), + fromValues$3(0.5, 0, 0.5), + fromValues$3(0.5, 0, -0.5), + fromValues$3(-0.5, 0, -0.5), + fromValues$3(-0.5, 0, 0.5) + ]; + Cube.EDGE_NORMALS = [ + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO) + ]; + Cube.EDGE_CORNERS = [ + [0, 1], + [1, 5], + [4, 5], + [0, 4], + [2, 3], + [2, 6], + [6, 7], + [3, 7], + [1, 2], + [5, 6], + [4, 7], + [0, 3] + ]; + Cube.EDGE_FACES = [ + [0, 4], + [0, 1], + [0, 5], + [0, 3], + [2, 4], + [2, 1], + [2, 5], + [2, 3], + [1, 4], + [1, 5], + [3, 5], + [3, 4] + ]; + Cube.EDGE_AXIS = [ 0, 2, 0, @@ -62644,1537 +40957,366 @@ Cube.EDGE_AXIS = [ 1, 1, 1 -]; -Cube.AXIS_EDGES = [ - [ - 0, - 2, - 4, - 6 - ], - [ - 8, - 9, - 10, - 11 - ], - [ - 1, - 3, - 5, - 7 - ] -]; -Cube.AXIS_FACES = [ - [ - 1, - 3 - ], - [ - 0, - 2 - ], - [ - 4, - 5 - ] -]; -Cube.OPPOSITE_FACES = [ + ]; + Cube.AXIS_EDGES = [ + [0, 2, 4, 6], + [8, 9, 10, 11], + [1, 3, 5, 7] + ]; + Cube.AXIS_FACES = [ + [1, 3], + [0, 2], + [4, 5] + ]; + Cube.OPPOSITE_FACES = [ 2, 3, 0, 1, 5, 4 -]; -Cube.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Cube.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ffHCZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MatrixHelper", ()=>MatrixHelper); -class MatrixHelper { - static fieldOfViewFromProjectionMatrix(p) { - return 2 * Math.atan(1 / p[5]); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fmvJ2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>Cartesian3dAxesHelper); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>Cartesian3dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _cubeJs = require("../../meshes/cube.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian3dAxesHelper { - static create(core, options) { - const cartesian3dAxes = new Cartesian3dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const minValueZ = options.minValueZ === undefined ? 0 : options.minValueZ; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const maxValueZ = options.maxValueZ === undefined ? 1 : options.maxValueZ; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian3dAxes.minBoundsX = minBoundsX; - cartesian3dAxes.minBoundsY = minBoundsY; - cartesian3dAxes.minBoundsZ = minBoundsZ; - cartesian3dAxes.maxBoundsX = maxBoundsX; - cartesian3dAxes.maxBoundsY = maxBoundsY; - cartesian3dAxes.maxBoundsZ = maxBoundsZ; - cartesian3dAxes.scalingX = scaling; - cartesian3dAxes.scalingY = scaling; - cartesian3dAxes.scalingZ = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, Math.max(maxBoundsY - minBoundsY, maxBoundsZ - minBoundsZ)); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY, - options.divisionsZ == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsZ - minBoundsZ) / maxLength), 1) : options.divisionsZ - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY, - options.minorGridlinesZ == undefined ? 2 : options.minorGridlinesZ - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY, - options.labelMajorSizeZ === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeZ - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY, - options.labelMinorSizeZ === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeZ - ]; - cartesian3dAxes.isDiscreteX = options.isDiscreteX; - cartesian3dAxes.isDiscreteY = options.isDiscreteY; - cartesian3dAxes.isDiscreteZ = options.isDiscreteZ; - cartesian3dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY, - options.isDivisionPickingEnabledZ - ]; - const isLabelPickingEnabledArray = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY, - options.isLabelPickingEnabledZ - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY, - options.reverseZ - ]; - const labelsArray = [ - options.labelsX, - options.labelsY, - options.labelsZ - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY, - options.labelOrientationZ - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const areTicksVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY, - options.arePickDivisionsVisibleZ - ]; - const minValueArray = [ - minValueX, - minValueY, - minValueZ - ]; - const maxValueArray = [ - maxValueX, - maxValueY, - maxValueZ - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY, - options.isDiscreteZ - ]; - const titleArray = [ - options.titleX, - options.titleY, - options.titleZ - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY, - options.titleSizeZ - ]; - const headingArray = [ - options.headingX, - options.headingY, - options.headingZ - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY, - options.headingSizeZ - ]; - for(let axisId = 0; axisId < 3; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian3dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian3dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian3dAxes.setLabels(axisId, discreteAxis.labels); - cartesian3dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian3dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian3dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian3dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian3dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabels(axisId, continuousAxis.labels); - cartesian3dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian3dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian3dAxes.setLabelSizes(axisId, labelSizes); - cartesian3dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian3dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian3dAxes.setTitle(axisId, titleArray[axisId]); - cartesian3dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian3dAxes.setHeading(axisId, headingArray[axisId]); - cartesian3dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian3dAxes.arePickDivisionsVisible[axisId] = areTicksVisibleArray[axisId] === undefined ? true : areTicksVisibleArray[axisId]; - cartesian3dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian3dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabledArray[axisId]; - cartesian3dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian3dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian3dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian3dAxes; - } -} -class Cartesian3dAxes extends (0, _axesJs.AxesBase) { - get size() { - return this._size; - } - get isDiscreteX() { - return this._isDiscrete[0]; - } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } - } - get isDiscreteY() { - return this._isDiscrete[1]; - } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } - } - get isDiscreteZ() { - return this._isDiscrete[2]; - } - set isDiscreteZ(value) { - if (value != this._isDiscrete[2]) { - this._isDiscrete[2] = value; - this._hasChanged = true; - } - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } - } - get maxBoundsX() { - return this._maxBoundsX; - } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } - } - get minBoundsY() { - return this._minBoundsY; - } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } - } - get maxBoundsY() { - return this._maxBoundsY; - } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } - } - get minBoundsZ() { - return this._minBoundsZ; - } - set minBoundsZ(value) { - if (value != this._minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } - } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value) { - if (value != this._minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; - } - getIsForwardFace(index) { - return this._isForwardFace[index]; - } - get textVertices() { - return this._textVertices; - } - get textIndices() { - return this._textIndices; - } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; - } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } - } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } - } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } - } - getLabelOrientation(index) { - return this._orientations[index]; - } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } - } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; - } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; - } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; - } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } - } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } - } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; - } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; - } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; - } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } - } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } - } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; - } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; - } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; - } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; - } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; - } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; - } - get gridVertices() { - return this._gridVertices; - } - get gridIndices() { - return this._gridIndices; - } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; - } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; - } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; - } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; - } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; - } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; - } - getGridTicksScale(index) { - return this._gridTicksScales[index]; - } - getGridFaceZero(index) { - return this._gridFaceZeros[index]; - } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; - } - getGridFaceMinorGridlines(index) { - return this._gridFaceMinorGridlines[index]; + ]; + Cube.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0) + ]; + Cube.EDGE_FORWARDS = [ + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO) + ]; + let ControllerVisual$1 = class ControllerVisual { + render(elapsedTime, xrFrame) { } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + update(elapsedTime) { } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + constructor(controller) { + this.controller = controller; } - get scalingX() { - return this._scalingX; + }; + class Controller { + get isInitialized() { + return this._isInitialized; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + get mMatrix() { + return this._mMatrix; } - get scalingY() { - return this._scalingY; + get indexCount() { + return this._indexCount; } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } + get vertices() { + return this._vertices; } - get scalingZ() { - return this._scalingZ; + get indices() { + return this._indices; } - set scalingZ(value) { - if (value != this._scalingZ) { - this._scalingZ = value; - this._hasChanged = true; - } + get texture() { + return this._texture; } - get offsetX() { - return this._offset[12]; + get rayMMatrix() { + return this._rayMMatrix; } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; + get rayIndexCount() { + return this._rayIndexCount; } - get offsetY() { - return this._offset[13]; + get rayVertices() { + return this._rayVertices; } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; + get rayIndices() { + return this._rayIndices; } - get offsetZ() { - return this._offset[14]; - } - set offsetZ(value) { - if (value != this._offset[14]) this._offset[14] = value; - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._minBoundsZ = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._maxBoundsZ = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 6; i++)this._isForwardFace.push(false); - for(let i = 0; i < 12; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 12; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 3; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 3; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 3; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 12; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 6; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = []; - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = []; - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 3; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridFaceZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridFaceMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - } - for(let i = 0; i < 6; i++){ - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 12; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _cubeJs.Cube).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _cubeJs.Cube).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _cubeJs.Cube).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIVES[i], (0, _cubeJs.Cube).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null, - null - ]; - this._toValues = [ - null, - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false, - false - ]; - this.isAxisReversed = [ - false, - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._scalingZ = 1; - this._offset = (0, _glMatrix.mat4).create(); + constructor(core, options) { + this._cubeObj = `o Cube +v 1.000000 -1.000000 -1.000000 +v 1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 -1.000000 +v 1.000000 1.000000 -0.999999 +v 0.999999 1.000000 1.000001 +v -1.000000 1.000000 1.000000 +v -1.000000 1.000000 -1.000000 +vt 1.000000 0.333333 +vt 1.000000 0.666667 +vt 0.666667 0.666667 +vt 0.666667 0.333333 +vt 0.666667 0.000000 +vt 0.000000 0.333333 +vt 0.000000 0.000000 +vt 0.333333 0.000000 +vt 0.333333 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.666667 +vt 0.333333 0.333333 +vt 0.333333 0.666667 +vt 1.000000 0.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn -0.000000 0.000000 1.000000 +vn -1.000000 -0.000000 -0.000000 +vn 0.000000 0.000000 -1.000000 +s off +f 2/1/1 3/2/1 4/3/1 +f 8/1/2 7/4/2 6/5/2 +f 5/6/3 6/7/3 2/8/3 +f 6/8/4 7/5/4 3/4/4 +f 3/9/5 7/10/5 8/11/5 +f 1/12/6 4/13/6 8/11/6 +f 1/4/1 2/1/1 4/3/1 +f 5/14/2 8/1/2 6/5/2 +f 1/12/3 5/6/3 2/8/3 +f 2/12/4 6/8/4 3/4/4 +f 4/13/5 3/9/5 8/11/5 +f 5/6/6 1/12/6 8/11/6`; + this._core = core; + this._obj = options.obj; + this._texture = options.texture || new ImageData(new Uint8ClampedArray([0, 0, 0, 255]), 1, 1); } initialize() { - this._isInitialized = true; + const _vec3 = create$3(); + this._mMatrix = create$4(); + const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); + if (!this._obj) { + this.useRayPose = true; + const modelThickness = 0.02; + const modelLength = 0.1; + set$3(_vec3, modelThickness, modelThickness, modelLength); + fromScaling(this._mMatrix, _vec3); + set$3(_vec3, 0, 0, 1); + translate(this._mMatrix, this._mMatrix, _vec3); + } + this._vertices = objMesh.vertices; + this._indices = objMesh.indices; + this._indexCount = objMesh.indexCount; + this._rayMMatrix = create$4(); + const rayVertices = Cube.POSITIONS; + this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); + const rayVerticesView = new DataView(this._rayVertices); + const rayIndices = Cube.INDICES; + this._rayIndices = new Uint16Array(rayIndices); + const rayVertexCount = rayVertices.length / PositionVertex.SIZE; + this._rayIndexCount = rayIndices.length; + for (let i = 0; i < rayVertexCount; i++) { + set$3(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); + PositionColorVertex.setPosition(rayVerticesView, i, _vec3); + PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); + } + const rayThickness = 25e-4; + const rayLength = 10; + set$3(_vec3, rayThickness, rayThickness, rayLength); + fromScaling(this._rayMMatrix, _vec3); + set$3(_vec3, 0, 0, -0.5); + translate(this._rayMMatrix, this._rayMMatrix, _vec3); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "controller initialized"); } update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._size[2] *= this._scalingZ / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); - } - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 6; faceId++){ - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).FACE_POSITIONS[faceId], this._size); - (0, _glMatrix.vec3).transformMat4(this._forward, this._vec3, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 12; edgeId++){ - const faceIds = (0, _cubeJs.Cube).EDGE_FACES[edgeId]; - const forward1 = this._isForwardFace[faceIds[0]]; - const forward2 = this._isForwardFace[faceIds[1]]; - const outsideEdge = forward1 != forward2; - this._isOutsideEdge[edgeId] = outsideEdge; - if (outsideEdge) this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _cubeJs.Cube).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 3; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - for(let axisId = 0; axisId < 3; axisId++)if (this.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - (0, _glMatrix.vec2).set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - if (this._size[axisId] > 0) (0, _glMatrix.mat4).translate(gridFaceMMatrix, gridFaceMMatrix, (0, _cubeJs.Cube).FACE_POSITIONS[faceId]); - } - } - } - for(let axisId = 0; axisId < 3; axisId++)for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId]) { - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); - } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); - } - } - } } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; + } + class MatrixHelper { + static fieldOfViewFromProjectionMatrix(p) { + return 2 * Math.atan(1 / p[5]); } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; + } + class AxesVisual { + render(elapsedTime, xrFrame) { } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; - } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 3; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); - } - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 3; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } + update(elapsedTime) { } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; + constructor(axes) { + this.axes = axes; } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../main.js":"b6Xbk","./axes.js":"4X9HQ","../../meshes/quad.js":"6dxCM","../../meshes/cube.js":"dYecn","../../vertex.js":"8lW8V","../../helpers/axes.js":"ihirw","../../helpers/text.js":"keNgB","../../helpers/pick.js":"fOypM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4X9HQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisual", ()=>AxesVisual); -parcelHelpers.export(exports, "AxesBase", ()=>AxesBase); -var _glMatrix = require("gl-matrix"); -class AxesVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(axes){ - this.axes = axes; - } -} -class AxesBase { + } + class AxesBase { get isInitialized() { - return this._isInitialized; - } - set vMatrix(value) { - this._vMatrix = value; - } - pickGrid(id) { - const offset = id * 3; - return { - divisionX: this._pickGrid[offset] - 1, - divisionY: this._pickGrid[offset + 1] - 1, - divisionZ: this._pickGrid[offset + 2] - 1 - }; + return this._isInitialized; + } + set vMatrix(value2) { + this._vMatrix = value2; + } + pickGrid(id2) { + const offset2 = id2 * 3; + return { + divisionX: this._pickGrid[offset2] - 1, + divisionY: this._pickGrid[offset2 + 1] - 1, + divisionZ: this._pickGrid[offset2 + 2] - 1 + }; + } + pickTitle(id2) { + return { axis: this._pickTitle[id2] }; + } + pickLabel(id2) { + const offset2 = id2 * 2; + return { + axis: this._pickLabel[offset2], + label: this._pickLabel[offset2 + 1] + }; + } + pickHeading(id2) { + return { axis: this._pickHeading[id2] }; + } + getFromValues(index2) { + return this._fromValues[index2]; + } + setFromValues(index2, value2) { + if (this._fromValues[index2] != value2) { + this._fromValues[index2] = value2; + this._hasChanged = true; + } } - pickTitle(id) { - return { - axis: this._pickTitle[id] - }; + getToValues(index2) { + return this._toValues[index2]; } - pickLabel(id) { - const offset = id * 2; - return { - axis: this._pickLabel[offset], - label: this._pickLabel[offset + 1] - }; + setToValues(index2, value2) { + if (this._toValues[index2] != value2) { + this._toValues[index2] = value2; + this._hasChanged = true; + } } - pickHeading(id) { - return { - axis: this._pickHeading[id] - }; + get font() { + return this._font; } - getFromValues(index) { - return this._fromValues[index]; + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } - setFromValues(index, value) { - if (this._fromValues[index] != value) { - this._fromValues[index] = value; - this._hasChanged = true; - } + get gridPickDivisionHeight() { + return this._gridPickDivisionHeight; } - getToValues(index) { - return this._toValues[index]; + set gridPickDivisionHeight(value2) { + if (this._gridPickDivisionHeight != value2) { + this._gridPickDivisionHeight = value2; + this._hasChanged = true; + } } - setToValues(index, value) { - if (this._toValues[index] != value) { - this._toValues[index] = value; - this._hasChanged = true; - } + constructor(core) { + this._core = core; + this._mMatrix = create$4(); + this._mvMatrix = create$4(); + this._textMetric = { maxTop: 0, width: 0, maxHeight: 0 }; + this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; + this.textBorderWidth = core.config.textBorderWidth; + this.gamma = 0; + this.gridMajorThickness = core.config.axesGridMajorThickness; + this.gridMinorThickness = core.config.axesGridMinorThickness; + this.gridZeroThickness = core.config.axesGridZeroThickness; + this._font = core.font; + this.isGridPickingEnabled = false; } - get font() { - return this._font; + update(elapsedTime) { } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } + } + let Quad$2 = class Quad { + static positions(transform2) { + const positions = new Float32Array(12); + const position2 = create$3(); + for (let i = 0; i < 4; i++) { + set$3(position2, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); + transformMat4$2(position2, position2, transform2); + positions[i * 3] = position2[0]; + positions[i * 3 + 1] = position2[1]; + positions[i * 3 + 2] = position2[2]; + } + return positions; + } + static textured(transform2, texTransform = Constants.MAT4_IDENTITY) { + const positions = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$3(); + const texCoord = create(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$3(position2, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionTextureVertex.setPosition(verticesView, i, position2); + PositionTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + static normalTextured(transform2, texTransform = Constants.MAT4_IDENTITY) { + const positions = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$3(); + const texCoord = create(); + const normal3 = create$3(); + const normal4 = create$2(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$3(position2, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionNormalTextureVertex.setPosition(verticesView, i, position2); + set$2(normal4, 0, 0, 1, 0); + transformMat4$1(normal4, normal4, transform2); + set$3(normal3, normal4[0], normal4[1], normal4[2]); + normalize$2(normal3, normal3); + PositionNormalTextureVertex.setNormal(verticesView, i, normal3); + PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; } - get gridPickDivisionHeight() { - return this._gridPickDivisionHeight; - } - set gridPickDivisionHeight(value) { - if (this._gridPickDivisionHeight != value) { - this._gridPickDivisionHeight = value; - this._hasChanged = true; - } - } - constructor(core){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._mvMatrix = (0, _glMatrix.mat4).create(); - this._textMetric = { - maxTop: 0, - width: 0, - maxHeight: 0 - }; - this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; - this.textBorderWidth = core.config.textBorderWidth; - this.gamma = 0; - this.gridMajorThickness = core.config.axesGridMajorThickness; - this.gridMinorThickness = core.config.axesGridMinorThickness; - this.gridZeroThickness = core.config.axesGridZeroThickness; - this._font = core.font; - this.isGridPickingEnabled = false; - } - update(elapsedTime) {} -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6dxCM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -parcelHelpers.export(exports, "Grid", ()=>Grid); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -class Quad { - static positions(transform) { - const positions = new Float32Array(12); - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).set(position, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - positions[i * 3] = position[0]; - positions[i * 3 + 1] = position[1]; - positions[i * 3 + 2] = position[2]; - } - return positions; - } - static textured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - static normalTextured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal3 = (0, _glMatrix.vec3).create(); - const normal4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _glMatrix.vec4).set(normal4, 0.0, 0.0, 1.0, 0.0); - (0, _glMatrix.vec4).transformMat4(normal4, normal4, transform); - (0, _glMatrix.vec3).set(normal3, normal4[0], normal4[1], normal4[2]); - (0, _glMatrix.vec3).normalize(normal3, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } -} -Quad.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Quad.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0) -]; -Quad.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0) -]; -Quad.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Quad.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, 0, -1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.AXIS_EDGES = [ - [ - 0, - 2 - ], - [ - 1, - 3 - ] -]; -Quad.POSITIONS = new Float32Array([ + }; + Quad$2.FACE_NORMALS = [ + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$2.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Quad$2.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0) + ]; + Quad$2.EDGE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0) + ]; + Quad$2.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0) + ]; + Quad$2.EDGE_FORWARDS = [ + fromValues$3(0, 0, -1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$2.AXIS_EDGES = [ + [0, 2], + [1, 3] + ]; + Quad$2.POSITIONS = new Float32Array([ -0.5, 0.5, 0, @@ -64187,23958 +41329,13855 @@ Quad.POSITIONS = new Float32Array([ 0.5, -0.5, 0 -]); -Quad.INDICES = new Uint16Array([ - 0, - 2, - 1, - 1, - 2, - 3 -]); -Quad.TEX_COORDS = new Float32Array([ - 0, - 1, - 1, - 1, - 0, - 0, - 1, - 0 -]); -class Grid { - static positions(cols, rows, transform) { - const vertices = new Float32Array((cols + 1) * (rows + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec3).set(position, col / cols - 0.5, 0.5 - row / rows, 0); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - return vertices; - } - static indices(cols, rows) { - const indices = new Uint16Array(cols * rows * 6); - let index = 0; - for(let row = 0; row < rows; row++)for(let col = 0; col < cols; col++){ - indices[index++] = col + row * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1) + 1; - } - return indices; - } - static textured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static normalTextured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, index, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static _texCoords(cols, rows, transform) { - const texCoords = new Float32Array((cols + 1) * (rows + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec2).set(texCoord, col / cols, 1 - row / rows); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ihirw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisHelper", ()=>AxisHelper); -class AxisHelper { - static continuous(options) { - const labels = []; - const positions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - for(let i = 0; i <= options.divisions; i++){ - positions.push(options.divisions == 0 ? 0.5 : i / options.divisions); - const value = options.divisions == 0 ? (options.min + options.max) / 2 : options.min + i * (options.max - options.min) / options.divisions; - labels.push(label(value)); - if (i == 0) fromValues.push(options.min); - else if (i < options.divisions) { - toValues.push(value); - fromValues.push(value); - } - } - toValues.push(options.max); - return { - labels: labels, - positions: positions, - fromValues: fromValues, - toValues: toValues - }; - } - static discrete(options) { - const divisions = options.maxDivisions !== undefined ? Math.min(options.divisions, options.maxDivisions) : options.divisions; - const divisionStep = 1 / options.divisions; - const labelStep = 1 / divisions; - const valueStep = (options.max - options.min + 1) / options.divisions; - let nextDivision, toValue, nextPosition; - const labels = []; - const labelPositions = []; - const tickPositions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - const fromToLabel = options.fromToLabel || ((fromValue, toValue)=>{ - return `${label(fromValue)}-${label(toValue)}`; - }); - for(let i = 0; i < divisions; i++){ - const division = Math.round(i * labelStep / divisionStep); - const tickPosition = division / options.divisions; - const fromValue = options.min + Math.ceil(division * valueStep); - if (i == divisions - 1) { - nextDivision = divisions; - nextPosition = 1; - toValue = options.max; - } else { - nextDivision = Math.round((i + 1) * labelStep / divisionStep); - nextPosition = nextDivision / options.divisions; - toValue = options.min + Math.ceil(nextDivision * valueStep) - 1; - } - labelPositions.push((tickPosition + nextPosition) / 2); - labels.push(fromValue == toValue ? label(fromValue) : fromToLabel(fromValue, toValue)); - fromValues.push(fromValue); - toValues.push(toValue); - tickPositions.push(tickPosition); + ]); + Quad$2.INDICES = new Uint16Array([0, 2, 1, 1, 2, 3]); + Quad$2.TEX_COORDS = new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]); + class TextHelper { + static truncate(text2, length2) { + return text2.length > length2 ? `${text2.substr(0, length2 - 1)}…` : text2; + } + static measure(font2, text2, size2) { + size2.width = 0; + let maxDescent = 0; + for (const char of text2) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; } - tickPositions.push(1); - return { - labels: labels, - labelPositions: labelPositions, - tickPositions: tickPositions, - fromValues: fromValues, - toValues: toValues - }; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"keNgB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextHelper", ()=>TextHelper); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -class TextHelper { - static truncate(text, length) { - return text.length > length ? `${text.substr(0, length - 1)}\u{2026}` : text; - } - static measure(font, text, size) { - size.width = 0; - let maxDescent = 0; - for (const char of text){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - size.width += glyph.advance; - size.maxTop = Math.max(glyph.top, size.maxTop); - maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + size2.width += glyph.advance; + size2.maxTop = Math.max(glyph.top, size2.maxTop); + maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + } + size2.maxHeight = size2.maxTop + maxDescent; + } + static wrap(font2, text2, maxWidth) { + const lines = []; + let width2 = 0; + let start = 0; + let lastBreakingChar = -1; + let widthAfterLastBreakingChar = 0; + for (let i = 0; i < text2.length; i++) { + let char = text2.charAt(i); + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + width2 += glyph.advance; + if (char == " " || char == "-") { + widthAfterLastBreakingChar = width2; + lastBreakingChar = i; + } + if (width2 > maxWidth) { + if (lastBreakingChar == -1) { + lines.push(text2.substring(start, i)); + start = i; + width2 += glyph.advance; + } else { + lines.push(text2.substring(start, lastBreakingChar)); + start = lastBreakingChar + 1; + width2 -= widthAfterLastBreakingChar; + widthAfterLastBreakingChar = 0; + lastBreakingChar = -1; + } } - size.maxHeight = size.maxTop + maxDescent; + } + lines.push(text2.substring(start, text2.length)); + return lines; } - static wrap(font, text, maxWidth) { - const lines = []; - let width = 0; - let start = 0; - let lastBreakingChar = -1; - let widthAfterLastBreakingChar = 0; - for(let i = 0; i < text.length; i++){ - let char = text.charAt(i); - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - width += glyph.advance; - if (char == " " || char == "-") { - widthAfterLastBreakingChar = width; - lastBreakingChar = i; - } - if (width > maxWidth) { - if (lastBreakingChar == -1) { - lines.push(text.substring(start, i)); - start = i; - width += glyph.advance; - } else { - lines.push(text.substring(start, lastBreakingChar)); - start = lastBreakingChar + 1; - width -= widthAfterLastBreakingChar; - widthAfterLastBreakingChar = 0; - lastBreakingChar = -1; - } - } - } - lines.push(text.substring(start, text.length)); - return lines; + static addString(font2, text2, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + for (const char of text2) { + this.addGlyph(font2, char, vertices, indices, index2++, position2, scale2, offset2, rotation2, idColor); + } } - static addString(font, text, vertices, indices, index, position, scale, offset, rotation, idColor) { - for (const char of text)this.addGlyph(font, char, vertices, indices, index++, position, scale, offset, rotation, idColor); + static addGlyph(font2, char, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + const vertexOffset = index2 * 4; + const width2 = glyph.width * scale2; + const height2 = glyph.height * scale2; + const top = glyph.top * scale2; + const border = font2.border * scale2; + const x02 = offset2[0] - border; + const x12 = offset2[0] + width2 + border; + const y02 = offset2[1] + top + border; + const y12 = offset2[1] + top - height2 - border; + const z02 = offset2[2]; + set$3(this._topLeft, x02, y02, z02); + set$3(this._topRight, x12, y02, z02); + set$3(this._bottomLeft, x02, y12, z02); + set$3(this._bottomRight, x12, y12, z02); + if (rotation2) { + transformQuat(this._topLeft, this._topLeft, rotation2); + transformQuat(this._topRight, this._topRight, rotation2); + transformQuat(this._bottomLeft, this._bottomLeft, rotation2); + transformQuat(this._bottomRight, this._bottomRight, rotation2); + } + add(this._vec3, this._topLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); + add(this._vec3, this._topRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); + add(this._vec3, this._bottomLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); + add(this._vec3, this._bottomRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); + set(this._vec2, glyph.u0, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); + set(this._vec2, glyph.u1, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); + set(this._vec2, glyph.u0, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); + set(this._vec2, glyph.u1, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); + offset2[0] += glyph.advance * scale2; + const indexTemplate = Quad$2.INDICES; + const indexOffset = index2 * 6; + for (let i = 0; i < 6; i++) { + indices[indexOffset + i] = indexTemplate[i] + vertexOffset; + } } - static addGlyph(font, char, vertices, indices, index, position, scale, offset, rotation, idColor) { - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const vertexOffset = index * 4; - const width = glyph.width * scale; - const height = glyph.height * scale; - const top = glyph.top * scale; - const border = font.border * scale; - const x0 = offset[0] - border; - const x1 = offset[0] + width + border; - const y0 = offset[1] + top + border; - const y1 = offset[1] + top - height - border; - const z0 = offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (rotation) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, rotation); - } - (0, _glMatrix.vec3).add(this._vec3, this._topLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._topRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 1, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 2, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 3, this._vec3); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 1, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 2, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 3, this._vec2); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 1, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 2, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 3, idColor); - offset[0] += glyph.advance * scale; - const indexTemplate = (0, _quadJs.Quad).INDICES; - const indexOffset = index * 6; - for(let i = 0; i < 6; i++)indices[indexOffset + i] = indexTemplate[i] + vertexOffset; - } -} -TextHelper._vec2 = (0, _glMatrix.vec2).create(); -TextHelper._vec3 = (0, _glMatrix.vec3).create(); -TextHelper._topLeft = (0, _glMatrix.vec3).create(); -TextHelper._topRight = (0, _glMatrix.vec3).create(); -TextHelper._bottomLeft = (0, _glMatrix.vec3).create(); -TextHelper._bottomRight = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","../vertex.js":"8lW8V","../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fOypM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickHelper", ()=>PickHelper); -class PickHelper { + } + TextHelper._vec2 = create(); + TextHelper._vec3 = create$3(); + TextHelper._topLeft = create$3(); + TextHelper._topRight = create$3(); + TextHelper._bottomLeft = create$3(); + TextHelper._bottomRight = create$3(); + class PickHelper { static nextPickId() { - return this._pickId++; - } - static encodeNumber(number, type, color) { - const encoded = number | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16); - } - static encodeVec3(vec3, type, color) { - const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeVec3(color, axes) { - axes[0] = color[0]; - axes[1] = color[1]; - axes[2] = color[2]; - } - static encodeType(type) { - return type << 24; - } - static decodeType(color) { - return color[3]; - } - static float32ToVec4(number, color) { - color[0] = ((number & 0xFF) >>> 0) / 0xFF; - color[1] = ((number & 0xFF00) >>> 8) / 0xFF; - color[2] = ((number & 0xFF0000) >>> 16) / 0xFF; - color[3] = ((number & 0xFF000000) >>> 24) / 0xFF; - } - static uint8ArrayToNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16) + (color[3] << 24); - } -} -PickHelper._pickId = 1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lhcyD":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>Cartesian2dAxesHelper); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>Cartesian2dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian2dAxesHelper { - static create(core, options) { - const cartesian2dAxes = new Cartesian2dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian2dAxes.minBoundsX = minBoundsX; - cartesian2dAxes.minBoundsY = minBoundsY; - cartesian2dAxes.maxBoundsX = maxBoundsX; - cartesian2dAxes.maxBoundsY = maxBoundsY; - cartesian2dAxes.scalingX = scaling; - cartesian2dAxes.scalingY = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, maxBoundsY - minBoundsY); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY - ]; - cartesian2dAxes.isDiscreteX = options.isDiscreteX; - cartesian2dAxes.isDiscreteY = options.isDiscreteY; - cartesian2dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY - ]; - const isLabelPickingEnabled = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY - ]; - const labelsArray = [ - options.labelsX, - options.labelsY - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const arePickDivisionsVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY - ]; - const minValueArray = [ - minValueX, - minValueY - ]; - const maxValueArray = [ - maxValueX, - maxValueY - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY - ]; - const titleArray = [ - options.titleX, - options.titleY - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY - ]; - const headingArray = [ - options.headingX, - options.headingY - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY - ]; - for(let axisId = 0; axisId < 2; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian2dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian2dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian2dAxes.setLabels(axisId, discreteAxis.labels); - cartesian2dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian2dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian2dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian2dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian2dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabels(axisId, continuousAxis.labels); - cartesian2dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian2dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian2dAxes.setLabelSizes(axisId, labelSizes); - cartesian2dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian2dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian2dAxes.setTitle(axisId, titleArray[axisId]); - cartesian2dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian2dAxes.setHeading(axisId, headingArray[axisId]); - cartesian2dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian2dAxes.arePickDivisionsVisible[axisId] = arePickDivisionsVisibleArray[axisId] === undefined ? true : arePickDivisionsVisibleArray[axisId]; - cartesian2dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian2dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabled[axisId]; - cartesian2dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian2dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian2dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian2dAxes; - } -} -class Cartesian2dAxes extends (0, _axesJs.AxesBase) { + return this._pickId++; + } + static encodeNumber(number2, type2, color2) { + const encoded = number2 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16); + } + static encodeVec3(vec3, type2, color2) { + const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeVec3(color2, axes) { + axes[0] = color2[0]; + axes[1] = color2[1]; + axes[2] = color2[2]; + } + static encodeType(type2) { + return type2 << 24; + } + static decodeType(color2) { + return color2[3]; + } + static float32ToVec4(number2, color2) { + color2[0] = ((number2 & 255) >>> 0) / 255; + color2[1] = ((number2 & 65280) >>> 8) / 255; + color2[2] = ((number2 & 16711680) >>> 16) / 255; + color2[3] = ((number2 & 4278190080) >>> 24) / 255; + } + static uint8ArrayToNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16) + (color2[3] << 24); + } + } + PickHelper._pickId = 1; + class Cartesian3dAxes extends AxesBase { get size() { - return this._size; + return this._size; } get isDiscreteX() { - return this._isDiscrete[0]; + return this._isDiscrete[0]; } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } get isDiscreteY() { - return this._isDiscrete[1]; + return this._isDiscrete[1]; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } + } + get isDiscreteZ() { + return this._isDiscrete[2]; + } + set isDiscreteZ(value2) { + if (value2 != this._isDiscrete[2]) { + this._isDiscrete[2] = value2; + this._hasChanged = true; + } } get minBoundsX() { - return this._minBoundsX; + return this._minBoundsX; } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } get maxBoundsX() { - return this._maxBoundsX; + return this._maxBoundsX; } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } get minBoundsY() { - return this._minBoundsY; + return this._minBoundsY; } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } get maxBoundsY() { - return this._maxBoundsY; + return this._maxBoundsY; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } + } + get minBoundsZ() { + return this._minBoundsZ; + } + set minBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._minBoundsZ = value2; + this._hasChanged = true; + } + } + get maxBoundsZ() { + return this._maxBoundsZ; } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; + set maxBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - getIsForwardFace(index) { - return this._isForwardFace[index]; + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; + } + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } get textVertices() { - return this._textVertices; + return this._textVertices; } get textIndices() { - return this._textIndices; + return this._textIndices; } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } - getLabelOrientation(index) { - return this._orientations[index]; + getLabelOrientation(index2) { + return this._orientations[index2]; } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } get gridVertices() { - return this._gridVertices; + return this._gridVertices; } get gridIndices() { - return this._gridIndices; + return this._gridIndices; } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; } - getGridTicksScale(index) { - return this._gridTicksScales[index]; + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; + getGridFaceZero(index2) { + return this._gridFaceZeros[index2]; } - get gridFaceZero() { - return this._gridFaceZeros; + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; } - get gridFaceMinorGridlines() { - return this._gridFaceMinorGridlines; + getGridFaceMinorGridlines(index2) { + return this._gridFaceMinorGridlines[index2]; } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } } get scalingX() { - return this._scalingX; + return this._scalingX; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } } get scalingY() { - return this._scalingY; + return this._scalingY; } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } + } + get scalingZ() { + return this._scalingZ; + } + set scalingZ(value2) { + if (value2 != this._scalingZ) { + this._scalingZ = value2; + this._hasChanged = true; + } } get offsetX() { - return this._offset[12]; + return this._offset[12]; } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } } get offsetY() { - return this._offset[13]; - } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; - } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._rMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromQuat(this._rMatrix, value); - } - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 2; i++)this._isForwardFace.push(false); - for(let i = 0; i < 4; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 4; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 2; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 2; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 2; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 4; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 2; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = (0, _glMatrix.vec2).create(); - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = (0, _glMatrix.vec2).create(); - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 2; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 4; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _quadJs.Quad).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _quadJs.Quad).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _quadJs.Quad).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _quadJs.Quad).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _quadJs.Quad).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _quadJs.Quad).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _quadJs.Quad).EDGE_POSITIVES[i], (0, _quadJs.Quad).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null - ]; - this._toValues = [ - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false - ]; - this.isAxisReversed = [ - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._offset = (0, _glMatrix.mat4).create(); + return this._offset[13]; + } + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } + } + get offsetZ() { + return this._offset[14]; + } + set offsetZ(value2) { + if (value2 != this._offset[14]) { + this._offset[14] = value2; + } + } + constructor(core) { + super(core); + this._size = create$3(); + this._translation = create$3(); + this._normal = create$3(); + this._forward = create$3(); + this._right = create$3(); + this._up = create$3(); + this._texCoord = create(); + this._bounds = create$2(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mat3 = create$5(); + this._isDiscrete = [false, false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._minBoundsZ = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._maxBoundsZ = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 6; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 12; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$3(); + this._textPosition = create$3(); + this._distances = []; + for (let i = 0; i < 12; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 3; i++) { + this._maxLabelSize.push(create()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._labelMMatrices.push(create$4()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 3; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._titleMMatrices.push(create$4()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 3; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._headingMMatrices.push(create$4()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$3(); + this._edgePositive = create$3(); + this._edgeNormal = create$3(); + this._edgeNormalTemp = create$3(); + this._edgePositiveTemp = create$3(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 12; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$3()); + this._edgeHorizontalUp.push(create$3()); + this._edgeHorizontalForward.push(create$3()); + this._edgeVerticalRight.push(create$3()); + this._edgeVerticalUp.push(create$3()); + this._edgeVerticalForward.push(create$3()); + } + this.isFaceVisible = []; + for (let i = 0; i < 6; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$3(); + this._gridTicksZeros = []; + this._gridFaceZeros = []; + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = []; + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$3(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 3; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create()); + this._gridFaceZeros.push(create()); + this._gridTicksMinorGridlines.push(create()); + this._gridFaceMinorGridlines.push(create()); + this._gridTicksScales.push(create$3()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + } + for (let i = 0; i < 6; i++) { + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$4()); + } + for (let i = 0; i < 12; i++) { + this._gridTicksMMatrices.push(create$4()); + this._gridTicksRotations.push(create$4()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Cube.EDGE_POSITIVES[i][0]; + _mat4[1] = Cube.EDGE_POSITIVES[i][1]; + _mat4[2] = Cube.EDGE_POSITIVES[i][2]; + _mat4[4] = Cube.EDGE_NORMALS[i][0]; + _mat4[5] = Cube.EDGE_NORMALS[i][1]; + _mat4[6] = Cube.EDGE_NORMALS[i][2]; + cross(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null, null]; + this._toValues = [null, null, null]; + this.isDivisionPickingEnabled = [false, false, false]; + this.isLabelPickingEnabled = [false, false, false]; + this.isTitlePickingEnabled = [false, false, false]; + this.isHeadingPickingEnabled = [false, false, false]; + this.isAxisReversed = [false, false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._scalingZ = 1; + this._offset = create$4(); } initialize() { - this._isInitialized = true; + this._isInitialized = true; } update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); - const maxBounds = Math.max(this._size[0], this._size[1]); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); - } - if (this._rMatrix) { - (0, _glMatrix.mat4).mul(this._mMatrix, this.mMatrix, this._rMatrix); - (0, _glMatrix.mat4).mul(this._mMatrix, this._mMatrix, this._offset); - } else (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 2; faceId++){ - (0, _glMatrix.vec3).transformMat4(this._forward, (0, _constantsJs.Constants).VECTOR3_ZERO, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 4; edgeId++){ - this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _quadJs.Quad).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 2; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - (0, _glMatrix.vec2).set(this._gridFaceZeros, this.zero[0], this.zero[1]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); - for(let faceId = 0; faceId < 2; faceId++)if (this._isForwardFace[faceId]) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); + const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._size[2] *= this._scalingZ / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); + } + multiply$2(this._mMatrix, this.mMatrix, this._offset); + this._mvMatrix = create$4(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 6; faceId++) { + multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); + transformMat4$2(this._forward, this._vec3, this._mvMatrix); + transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 12; edgeId++) { + const faceIds = Cube.EDGE_FACES[edgeId]; + const forward1 = this._isForwardFace[faceIds[0]]; + const forward2 = this._isForwardFace[faceIds[1]]; + const outsideEdge = forward1 != forward2; + this._isOutsideEdge[edgeId] = outsideEdge; + if (outsideEdge) { + this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; + } + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + translate(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); + } + scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } + } + } + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); + set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (this._isForwardFace[faceId]) { const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - } - for(let axisId = 0; axisId < 2; axisId++)for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); - } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); - } + scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + if (this._size[axisId] > 0) { + translate(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); + } + } + } + } + } + for (let axisId = 0; axisId < 3; axisId++) { + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId]) { + multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$2(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross(this._right, Constants.VECTOR3_UNITY, this._forward); + normalize$2(this._right, this._right); + cross(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); + copy$3(this._edgeNormalTemp, this._edgeNormal); + copy$3(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$3(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$3(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$3(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$3(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } + } + } } + } } _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; - } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; - } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { const right = this._edgeHorizontalRight[edgeId]; const up = this._edgeHorizontalUp[edgeId]; const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; - } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 2; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - const axisId = 2; - this._gridFaceScale[axisId] = 1; - for(let faceId = 0; faceId < 2; faceId++)offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); - } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 2; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } - } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../main.js":"b6Xbk","./axes.js":"4X9HQ","../../meshes/quad.js":"6dxCM","../../vertex.js":"8lW8V","../../helpers/axes.js":"ihirw","../../helpers/text.js":"keNgB","../../helpers/pick.js":"fOypM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fn4YW":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Glyph", ()=>Glyph); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -parcelHelpers.export(exports, "Font", ()=>Font); -parcelHelpers.export(exports, "FontAtlas", ()=>FontAtlas); -parcelHelpers.export(exports, "FontRasterizer", ()=>FontRasterizer); -parcelHelpers.export(exports, "GlyphRasterizer", ()=>GlyphRasterizer); -var _mainJs = require("./main.js"); -class Glyph { - toJSON() { - return { - key: this.key, - char: this.char, - width: this.width, - height: this.height, - top: this.top, - left: this.left, - advance: this.advance, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; - } -} -class FontVisual { - update() {} - constructor(font){ - this.font = font; - } -} -class Font { - get atlas() { - return this._rasterizer.fontAtlas; - } - get count() { - return this._chars.size; - } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._chars = new Set(); - this._previousSize = 0; - this.glyphs = {}; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; } - addGlyph(char) { - if (!this._chars.has(char)) { - this._chars.add(char); - this._rasterizer.draw(char); - this._hasChanged = true; - } + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); - this._previousSize = this._chars.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } + _updateHeading(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; + } + _updateGrids(size2) { + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId = 0; axisId < 3; axisId++) { + const width2 = size2[axisId]; + set$3(this._gridTicksScales[axisId], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset2); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } + this._gridFaceScale[axisId] = size2[axisId] == 0 ? 1 : size2[axisId]; + } } - toJSON() { - const glyphs = []; - for(let key in this.glyphs){ - const glyph = this.glyphs[key]; - glyphs.push(glyph.toJSON()); + _updateText(size2) { + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 3; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } } - return { - name: this.name, - size: this.size, - border: this.border, - glyphs: glyphs, - edgeValue: this.edgeValue - }; - } -} -class FontAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class FontRasterizer { - get font() { - return this._font; - } - get fontAtlas() { - return this._fontAtlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontAtlas = options.fontAtlas; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._font = new Font(core, this); - this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); - this._font.size = this._fontSize; - this._font.border = this._border; - this._font.edgeValue = this._edgeValue; - const glyphRasterizerOptions = { - baseline: this._baseline, - border: this._border, - edgeValue: this._edgeValue, - fontFamily: this._fontFamily, - fontSize: this._fontSize, - fontStyle: this._fontStyle, - fontWeight: this._fontWeight, - maxDistance: this._maxDistance - }; - this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const glyph = this._glyphRasterizer.draw(char); - const texWidth = glyph.width + 2 * this._border; - const texHeight = glyph.height + 2 * this._border; - const width = this._fontAtlas.imageData.width; - const height = this._fontAtlas.imageData.height; - if (this._fontAtlas.x + texWidth > width) this._fontAtlas.x = 0; - let y = 0; - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)y = Math.max(y, this._fontAtlas.top[x]); - if (y + texHeight > height) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._font.name} height overflow`); - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)this._fontAtlas.top[x] = y + texHeight; - glyph.u0 = this._fontAtlas.x / width; - glyph.v0 = y / height; - glyph.u1 = (this._fontAtlas.x + texWidth) / width; - glyph.v1 = (y + texHeight) / height; - this._font.glyphs[char] = glyph; - for(let i = 0; i < glyph.distances.length; i++){ - const distance = glyph.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._fontAtlas.x + dataX + (y + dataY) * width) * 4; - this._fontAtlas.imageData.data[offset + 0] = distance; - this._fontAtlas.imageData.data[offset + 1] = distance; - this._fontAtlas.imageData.data[offset + 2] = distance; - this._fontAtlas.imageData.data[offset + 3] = 0xff; - } - this._fontAtlas.x += texWidth; - } -} -class GlyphRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._size = this._fontSize + this._border * 2; - this._size += this._border * 2; - this._gridOuter = new Float64Array(this._size * this._size); - this._gridInner = new Float64Array(this._size * this._size); - this._f = new Float64Array(this._size); - this._z = new Float64Array(this._size + 1); - this._v = new Uint16Array(this._size); - const canvas = document.createElement("canvas"); - canvas.width = canvas.height = this._size; - this._context = canvas.getContext("2d", { - willReadFrequently: true - }); - this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; - this._context.textBaseline = this._baseline; - this._context.textAlign = "left"; - this._context.fillStyle = "black"; - this._core.log.write((0, _mainJs.LogLevel).info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const textMetrics = this._context.measureText(char); - const glyphLeft = 0; - const glyphTop = Math.floor(textMetrics.actualBoundingBoxAscent); - let glyphWidth = Math.ceil(textMetrics.actualBoundingBoxRight); - let glyphHeight = Math.ceil(textMetrics.actualBoundingBoxAscent) + Math.ceil(textMetrics.actualBoundingBoxDescent); - glyphWidth = Math.min(this._size - this._border, glyphWidth); - glyphHeight = Math.min(this._size - this._border, glyphHeight); - const width = glyphWidth + 2 * this._border; - const height = glyphHeight + 2 * this._border; - const length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const glyph = new Glyph(); - glyph.char = char; - glyph.key = char.codePointAt(0); - glyph.distances = distances; - glyph.gradientsX = gradientsX; - glyph.gradientsY = gradientsY; - glyph.pixels = pixels; - glyph.width = glyphWidth; - glyph.height = glyphHeight; - glyph.top = glyphTop; - glyph.left = glyphLeft; - glyph.advance = textMetrics.width; - if (glyphWidth == 0 || glyphHeight == 0) return glyph; - this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); - this._context.fillText(char, this._border, this._border + glyphTop); - const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < glyphHeight; y++)for(let x = 0; x < glyphWidth; x++){ - const a = imgData.data[4 * (y * glyphWidth + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - pixels[j] = 0xff; - } - } + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); } - return glyph; - } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kM2vK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manager", ()=>Manager); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _animationJs = require("../helpers/animation.js"); -var _constantsJs = require("../constants.js"); -var _keyboardJs = require("./keyboard.js"); -class Manager { - constructor(core){ - this._manipulators = {}; - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._manipulationProcessor = new (0, _manipulationprocessorJs.ManipulationProcessor)(core); - this._manipulators = {}; - this._pointers = new (0, _pointersJs.Pointers)(core, this._manipulators); - this._pointers.initialize(core.container); - this._mouseWheel = new (0, _mousewheelJs.MouseWheel)(core); - this._mouseWheel.initialize(core.container); - this._keyboard = new (0, _keyboardJs.Keyboard)(core); - this._keyboard.initialize(core.container); - this.isPickingEnabled = true; - this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; - this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; - this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; - this.pickHoldDelay = this._core.config.pickHoldDelay; - this.pickSelectDelay = this._core.config.pickSelectDelay; - const rightButton = 2; - this.singleTouchAction = (manipulator)=>{ - if (manipulator.type == "mouse" && manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _mainJs.SingleTouchAction).translate; - else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton) return (0, _mainJs.SingleTouchAction).lasso; - else return (0, _mainJs.SingleTouchAction).rotate; - }; - this.mouseWheelAction = (keyboard)=>{ - if (this._keyboard.isKeyDown("Control")) return (0, _mainJs.MouseWheelAction).rotateY; - else return (0, _mainJs.MouseWheelAction).zoom; - }; - this.lassoPickType = (0, _mainJs.PickType).data; - this._thumbstickX = 0; - this._previousControllerButtonPressed = [ - false, - false, - false, - false - ]; - this._quat0 = (0, _glMatrix.quat).create(); - this._quat1 = (0, _glMatrix.quat).create(); - } - update(elapsedTime, xrFrame) { - if (xrFrame) { - const inputSources = this._core.webXRSession.inputSources; - if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { - const inputSource = inputSources[0]; - const controllerVisual = this._core.renderer.controllers[0]; - if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { - const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); - if (gripPose) controllerVisual.mMatrix = gripPose.transform.matrix; - const gamepad = inputSource.gamepad; - this._core.renderer.isPickingEnabled = false; - const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); - if (rayPose) { - controllerVisual.rayMMatrix = rayPose.transform.matrix; - if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { - this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; - this._core.renderer.isPickingEnabled = true; - } - } - const threshold = 0.2; - const dampening = Math.min(0.015 * elapsedTime, 1); - this._thumbstickX = (0, _animationJs.AnimationHelper).damp(this._thumbstickX, gamepad.axes[2], threshold, dampening); - if (this._thumbstickX != 0) { - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); - this._core.getModelRotation(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat0, this._quat1); - this._core.setModelRotation(this._quat1, true); - } - if (gamepad.buttons[2].pressed) { - if (!this._previousControllerButtonPressed[2]) { - this._previousControllerButtonPressed[2] = true; - if (this.controllerButtonPressedCallback) this.controllerButtonPressedCallback(2); - } - } else this._previousControllerButtonPressed[2] = false; - } - } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._labels[axisId]) { + const width2 = size2[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; } else { - const camera = this._core.camera; - this._manipulationProcessor.update(elapsedTime, this._manipulators); - this._pointers.update(elapsedTime); - this._mouseWheel.update(elapsedTime); - this._keyboard.update(elapsedTime); - if (this._mouseWheel.delta != 0) switch(this.mouseWheelAction(this._keyboard)){ - case (0, _mainJs.MouseWheelAction).zoom: - if (this._pointers.hoverX, this._pointers.hoverY) camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); - break; - case (0, _mainJs.MouseWheelAction).rotateY: - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); - camera.getOrbit(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat1, this._quat0); - camera.setOrbit(this._quat1, true); - break; - } - const count = this._manipulationProcessor.count; - if (count == 0) { - if (this._isLassoPicking) { - this._isLassoPicking = false; - this._core.renderer.isLassoPicking = false; - const x0 = Math.min(this._lassoX0, this._lassoX1); - const y0 = Math.min(this._lassoY0, this._lassoY1); - const x1 = Math.max(this._lassoX0, this._lassoX1); - const y1 = Math.max(this._lassoY0, this._lassoY1); - if (x1 - x0 > 0 && y1 - y0 > 0) { - const sets = this._core.pickLasso(x0, y0, x1, y1, this.lassoPickType); - const result = { - x0: x0, - y0: y0, - x1: x1, - y1: y1, - pickType: this.lassoPickType, - ids: sets, - manipulator: this._manipulator - }; - this.pickLassoCallback(result); - } - } - } else if (count == 1) { - const translationDelta = this._manipulationProcessor.translationDelta; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - const manipulators = this._manipulationProcessor.manipulators; - for(const key in manipulators){ - const manipulator = manipulators[key]; - switch(this.singleTouchAction(manipulator)){ - case (0, _mainJs.SingleTouchAction).rotate: - camera.rotate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).translate: - camera.translate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).lasso: - if (this.pickLassoCallback) { - if (!this._isLassoPicking) { - this._isLassoPicking = true; - this._core.renderer.isLassoPicking = true; - this._lassoX0 = manipulator.position[0]; - this._lassoY0 = manipulator.position[1]; - } - this._lassoX1 = manipulator.position[0]; - this._lassoY1 = manipulator.position[1]; - this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); - this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); - } - break; - } - break; - } - } - } else { - const translationDelta = this._manipulationProcessor.translationDelta; - const camera = this._core.camera; - if (translationDelta[0] != 0 || translationDelta[1] != 0) camera.translate(translationDelta); - if (this._manipulationProcessor.scaleDelta != 0) { - const distance = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; - camera.zoom(distance, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this._manipulationProcessor.twistDelta != 0) camera.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { - const camera = this._core.camera; - const renderer = this._core.renderer; - if (renderer.isCapturingPickImage) { - camera.updatePickVMatrix(renderer.width / 2, renderer.height / 2); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - this._pickedTime = 0; - } else if (this._pointers.hoverId > -1) { - const pickingX = this._pointers.hoverX; - const pickingY = this._pointers.hoverY; - camera.updatePickVMatrix(pickingX, pickingY); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - if (this._pickedId != renderer.pickedId) { - this._pickedId = renderer.pickedId; - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 1) { - this._pickedTime += elapsedTime; - for(const key in this._manipulators){ - this._manipulator = this._manipulators[key]; - break; - } - } - if (this._pickedTime > 0) switch(renderer.pickedType){ - case (0, _mainJs.PickType).data: - if (this._pickedTime > this.pickHoldDelay) { - renderer.getVertexPosition(this._vec3, this._pickedId); - this._core.setModelManipulationOrigin(this._vec3); - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.transitionBuffers.length; i++){ - const transitionBuffer = renderer.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - transitionBuffer: i, - id: id, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked id ${result.id}, transition buffer ${i}`); - if (this.pickItemCallback) this.pickItemCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).label: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.labelSets.length; i++){ - const labelSet = renderer.labelSets[i].label; - const id = labelSet.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - label: id, - set: i, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, set ${result.set}`); - if (this.pickLabelSetCallback) this.pickLabelSetCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesDivision: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickGridLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickGrid(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); - if (this.pickAxesGridCallback) this.pickAxesGridCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesTitle: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickTitleLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickTitle(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked title ${result.axis}, axes ${result.axes}`); - if (this.pickAxesTitleCallback) this.pickAxesTitleCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesLabel: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickLabelLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickLabel(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); - if (this.pickAxesLabelCallback) this.pickAxesLabelCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesHeading: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickHeadingLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickHeading(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked heading ${result.axis}, axes ${result.axes}`); - if (this.pickAxesHeadingCallback) this.pickAxesHeadingCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - } - } else { - renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } else { - this._core.renderer.isPickingEnabled = false; - this._pickedTime = 0; - } - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); - this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); - } - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","./manipulationprocessor.js":"elobQ","./mousewheel.js":"gBsJR","./pointers.js":"deD7J","../helpers/animation.js":"gfPT1","../constants.js":"dHTsY","./keyboard.js":"5tZWK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"elobQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>ManipulationProcessor); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("../helpers/math.js"); -var _angleJs = require("../helpers/angle.js"); -class ManipulationProcessor { - get manipulators() { - return this._manipulators; - } - get count() { - return this._count; - } - get isDragging() { - return this._isDragging; - } - constructor(core){ - this._core = core; - this._count = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._previousCentroid = (0, _glMatrix.vec3).create(); - this._relativePositionToCentroid = (0, _glMatrix.vec3).create(); - this._directionToCentroid = (0, _glMatrix.vec3).create(); - this._previousDirectionToCentroid = (0, _glMatrix.vec3).create(); - this._manipulators = {}; - this._removedManipulators = []; - this.cumulativeTranslation = (0, _glMatrix.vec3).create(); - this.translationDelta = (0, _glMatrix.vec3).create(); - this.centroid = (0, _glMatrix.vec3).create(); - this.maxScale = Number.MAX_VALUE; - this.twistAxis = (0, _glMatrix.vec3).fromValues(0, 0, 1); - this.initialize(); - } - update(elapsedTime, manipulators) { - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (!manipulators[manipulator.id]) { - if (this.removeManipulator) this.removeManipulator(manipulator); - this._removedManipulators.push(manipulator.id); - } - } - if (this._removedManipulators.length > 0) { - for(let i = 0; i < this._removedManipulators.length; i++){ - delete this._manipulators[this._removedManipulators[i]]; - this._count--; - } - this._removedManipulators = []; - } - for(const key in manipulators){ - const manipulator = manipulators[key]; - if (!this._manipulators[manipulator.id]) { - if (!this.addManipulator || this.addManipulator(manipulator)) { - (0, _glMatrix.vec3).copy(manipulator.initialPosition, manipulator.position); - this._manipulators[manipulator.id] = manipulator; - this._count++; - } - } + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; } - (0, _glMatrix.vec3).set(this.translationDelta, 0, 0, 0); - this.scaleDelta = 0; - this.twistDelta = 0; - if (this._count > 0) { - if (this._previousCount > 0) { - if (this.prepareManipulation) this.prepareManipulation(); - this._process(); - if (this.processManipulation) this.processManipulation(elapsedTime); - } else { - this.initialize(); - if (this.beginManipulation) this.beginManipulation(); - } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._titles[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; } else { - if (this._previousCount > 0) { - if (this.endManipulation) this.endManipulation(); - } - } - this._isDragging = this._count == 1 && (0, _glMatrix.vec3).squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; - this._previousCount = this._count; - } - initialize() { - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - (0, _glMatrix.vec3).set(this.cumulativeTranslation, 0, 0, 0); - this.cumulativeScale = 1; - this.cumulativeTwist = 0; - } - _process() { - if (this._previousCount > 0) { - let persisted = 0; - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) persisted++; - } - const removed = this._previousCount - persisted; - if (persisted > 0) { - if (removed > 0) (0, _glMatrix.vec3).copy(this._centroid, this._previousCentroid); - else { - (0, _glMatrix.vec3).set(this._centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) (0, _glMatrix.vec3).add(this._centroid, this._centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this._centroid, this._centroid, 1 / persisted); - } - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) { - manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, (0, _glMatrix.vec3).squaredDistance(manipulator.position, manipulator.initialPosition)); - (0, _glMatrix.vec3).add(this.translationDelta, this.translationDelta, manipulator.position); - (0, _glMatrix.vec3).subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); - (0, _glMatrix.vec3).subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); - const distanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(this._relativePositionToCentroid); - if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) this.scaleDelta += 1; - else { - const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); - const previousDistanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(manipulator.previousPositionRelativeToCentroid); - const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); - this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; - (0, _glMatrix.vec3).scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); - (0, _glMatrix.vec3).scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); - this.twistDelta += (0, _angleJs.AngleHelper).signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); - } - } - } - (0, _glMatrix.vec3).scale(this.translationDelta, this.translationDelta, 1 / persisted); - (0, _glMatrix.vec3).add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); - this.scaleDelta /= persisted; - this.cumulativeScale = (0, _mathJs.MathHelper).clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); - this.scaleDelta -= 1; - this.twistDelta /= persisted; - this.cumulativeTwist += this.twistDelta; - } - } - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).add(this.centroid, this.centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this.centroid, this.centroid, 1 / this._count); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); - } - (0, _glMatrix.vec3).copy(this._previousCentroid, this.centroid); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - manipulator.isPersisted = true; - (0, _glMatrix.vec3).copy(manipulator.previousPosition, manipulator.position); - (0, _glMatrix.vec3).copy(manipulator.previousRotationAxis, manipulator.rotationAxis); - (0, _glMatrix.vec3).copy(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); - } - } -} - -},{"gl-matrix":"erHGu","../helpers/math.js":"6Lv1i","../helpers/angle.js":"hBXkO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gBsJR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MouseWheel", ()=>MouseWheel); -class MouseWheel { - constructor(core){ - this._core = core; - this._previousTotal = 0; - this.total = 0; - } - initialize(element) { - element.addEventListener("wheel", (e)=>{ - e.preventDefault(); - const wheelEvent = e; - this.total += wheelEvent.deltaY; - }, { - passive: false - }); - } - update(elapsedTime) { - const total = this.total; - this.delta = total - this._previousTotal; - this._previousTotal = total; - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"deD7J":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Pointers", ()=>Pointers); -var _manipulatorJs = require("../input/manipulator.js"); -class Pointers { - get hoverX() { - return this._hoverX; - } - get hoverY() { - return this._hoverY; - } - get hoverId() { - return this._hoverId; - } - constructor(core, manipulators){ - this._core = core; - this._manipulators = manipulators; - } - initialize(element) { - this._element = element; - element.addEventListener("pointerdown", (e)=>this._handlePointerDown(e), { - passive: true - }); - element.addEventListener("pointermove", (e)=>this._handlePointerMove(e), { - passive: true - }); - element.addEventListener("pointerup", (e)=>this._handlePointerUp(e), { - passive: true - }); - element.addEventListener("pointercancel", (e)=>this._handlePointerCancel(e), { - passive: true - }); - element.addEventListener("pointerleave", (e)=>this._handlePointerLeave(e), { - passive: true - }); - element.addEventListener("pointerout", (e)=>this._handlePointerOut(e), { - passive: true - }); - } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); - this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); - } - } - _handlePointerDown(e) { - this._element.focus(); - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const manipulator = new (0, _manipulatorJs.Manipulator)(); - const id = e.pointerId; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - manipulator.id = id; - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.type = e.pointerType; - manipulator.button = e.button; - manipulator.shiftKey = e.shiftKey; - manipulator.ctrlKey = e.ctrlKey; - manipulator.altKey = e.altKey; - manipulator.event = e; - this._manipulators[id] = manipulator; - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - } - _handlePointerMove(e) { - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - const id = e.pointerId; - const manipulator = this._manipulators[id]; - if (manipulator) { - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.event = e; - } - switch(e.pointerType){ - case "mouse": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - break; - case "pen": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - this._tiltX = e.tiltX; - this._tiltY = e.tiltY; - this._twist = e.twist; - break; - } - } - _handlePointerUp(e) { - const manipulator = this._manipulators[e.pointerId]; - if (manipulator) manipulator.event = e; - this._remove(e.pointerId); - } - _handlePointerCancel(e) { - this._remove(e.pointerId); - } - _handlePointerLeave(e) { - this._resetHover(); - this._remove(e.pointerId); - } - _handlePointerOut(e) { - this._resetHover(); - this._remove(e.pointerId); - } - _resetHover() { - this._hoverId = null; - this._hoverX = null; - this._hoverY = null; - } - _remove(pointerId) { - const manipulator = this._manipulators[pointerId]; - if (manipulator) delete this._manipulators[pointerId]; - } -} - -},{"../input/manipulator.js":"gniz0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gniz0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manipulator", ()=>Manipulator); -var _glMatrix = require("gl-matrix"); -class Manipulator { - constructor(){ - this.pickedIndex = 0; - this.maxTranslationSquared = 0; - this.initialPosition = (0, _glMatrix.vec3).create(); - this.position = (0, _glMatrix.vec3).create(); - this.previousPosition = (0, _glMatrix.vec3).create(); - this.holdOrigin = (0, _glMatrix.vec3).create(); - this.positionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.previousPositionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.rotationAxis = (0, _glMatrix.vec3).create(); - this.previousRotationAxis = (0, _glMatrix.vec3).create(); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfPT1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationHelper", ()=>AnimationHelper); -var _mathJs = require("./math.js"); -class AnimationHelper { - static smoothStep(value) { - return value * value * (3 - 2 * value); - } - static damp(value, target, threshold, dampening) { - if (Math.abs(target) < threshold) return (0, _mathJs.MathHelper).lerp(value, 0, dampening); - else return (0, _mathJs.MathHelper).lerp(value, target, dampening); - } -} - -},{"./math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5tZWK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>Keyboard); -class Keyboard { - constructor(core){ - this._core = core; - this._pressedKeys = new Set(); - this._previousPressedKeys = new Set(); - } - initialize(element) { - element.addEventListener("keydown", (e)=>{ - this._handleKeyDown(e); - }, false); - element.addEventListener("keyup", (e)=>{ - this._handleKeyUp(e); - }, false); - } - update(elapsedTime) { - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); - } - isKeyDown(key) { - return this._pressedKeys.has(key); - } - wasKeyReleased(key) { - if (this._pressedKeys.has(key)) { - if (!this._previousPressedKeys.has(key)) { - this._previousPressedKeys.add(key); - return true; - } - } else this._previousPressedKeys.delete(key); - return false; - } - _handleKeyDown(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (!this._pressedKeys.has(key)) this._pressedKeys.add(key); - } - _handleKeyUp(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (this._pressedKeys.has(key)) this._pressedKeys.delete(key); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dneJo":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Log", ()=>Log); -var _mainJs = require("./main.js"); -class Log { - constructor(core){ - this._core = core; - } - write(level, value) { - if (level >= this._core.config.logLevel) switch(level){ - case (0, _mainJs.LogLevel).trace: - console.trace(value); - break; - case (0, _mainJs.LogLevel).debug: - console.debug(value); - break; - case (0, _mainJs.LogLevel).info: - console.info(value); - break; - case (0, _mainJs.LogLevel).warn: - console.warn(value); - break; - case (0, _mainJs.LogLevel).error: - console.error(value); - break; + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._headings[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } } -} - -},{"./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8FW7c":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Colors", ()=>Colors); -var _glMatrix = require("gl-matrix"); -class Colors { -} -Colors.MediumVioletRed = (0, _glMatrix.vec3).fromValues(0xc7, 0x15, 0x85); -Colors.DeepPink = (0, _glMatrix.vec3).fromValues(0xff, 0x14, 0x93); -Colors.PaleVioletRed = (0, _glMatrix.vec3).fromValues(0xdb, 0x70, 0x93); -Colors.HotPink = (0, _glMatrix.vec3).fromValues(0xff, 0x69, 0xb4); -Colors.LightPink = (0, _glMatrix.vec3).fromValues(0xff, 0xb6, 0xc1); -Colors.Pink = (0, _glMatrix.vec3).fromValues(0xff, 0xc0, 0xcb); -Colors.DarkRed = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x00); -Colors.Red = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0x00); -Colors.Firebrick = (0, _glMatrix.vec3).fromValues(0xb2, 0x22, 0x22); -Colors.Crimson = (0, _glMatrix.vec3).fromValues(0xdc, 0x14, 0x3c); -Colors.IndianRed = (0, _glMatrix.vec3).fromValues(0xcd, 0x5c, 0x5c); -Colors.LightCoral = (0, _glMatrix.vec3).fromValues(0xf0, 0x80, 0x80); -Colors.Salmon = (0, _glMatrix.vec3).fromValues(0xfa, 0x80, 0x72); -Colors.DarkSalmon = (0, _glMatrix.vec3).fromValues(0xe9, 0x96, 0x7a); -Colors.LightSalmon = (0, _glMatrix.vec3).fromValues(0xff, 0xa0, 0x7a); -Colors.OrangeRed = (0, _glMatrix.vec3).fromValues(0xff, 0x45, 0x00); -Colors.Tomato = (0, _glMatrix.vec3).fromValues(0xff, 0x63, 0x47); -Colors.DarkOrange = (0, _glMatrix.vec3).fromValues(0xff, 0x8c, 0x00); -Colors.Coral = (0, _glMatrix.vec3).fromValues(0xff, 0x7f, 0x50); -Colors.Orange = (0, _glMatrix.vec3).fromValues(0xff, 0xa5, 0x00); -Colors.DarkKhaki = (0, _glMatrix.vec3).fromValues(0xbd, 0xb7, 0x6b); -Colors.Gold = (0, _glMatrix.vec3).fromValues(0xff, 0xd7, 0x00); -Colors.Khaki = (0, _glMatrix.vec3).fromValues(0xf0, 0xe6, 0x8c); -Colors.PeachPuff = (0, _glMatrix.vec3).fromValues(0xff, 0xda, 0xb9); -Colors.Yellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0x00); -Colors.PaleGoldenrod = (0, _glMatrix.vec3).fromValues(0xee, 0xe8, 0xaa); -Colors.Moccasin = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xb5); -Colors.PapayaWhip = (0, _glMatrix.vec3).fromValues(0xff, 0xef, 0xd5); -Colors.LightGoldenrodYellow = (0, _glMatrix.vec3).fromValues(0xfa, 0xfa, 0xd2); -Colors.LemonChiffon = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xcd); -Colors.LightYellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xe0); -Colors.Maroon = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x00); -Colors.Brown = (0, _glMatrix.vec3).fromValues(0xa5, 0x2a, 0x2a); -Colors.SaddleBrown = (0, _glMatrix.vec3).fromValues(0x8b, 0x45, 0x13); -Colors.Sienna = (0, _glMatrix.vec3).fromValues(0xa0, 0x52, 0x2d); -Colors.Chocolate = (0, _glMatrix.vec3).fromValues(0xd2, 0x69, 0x1e); -Colors.DarkGoldenrod = (0, _glMatrix.vec3).fromValues(0xb8, 0x86, 0x0b); -Colors.Peru = (0, _glMatrix.vec3).fromValues(0xcd, 0x85, 0x3f); -Colors.RosyBrown = (0, _glMatrix.vec3).fromValues(0xbc, 0x8f, 0x8f); -Colors.Goldenrod = (0, _glMatrix.vec3).fromValues(0xda, 0xa5, 0x20); -Colors.SandyBrown = (0, _glMatrix.vec3).fromValues(0xf4, 0xa4, 0x60); -Colors.Tan = (0, _glMatrix.vec3).fromValues(0xd2, 0xb4, 0x8c); -Colors.Burlywood = (0, _glMatrix.vec3).fromValues(0xde, 0xb8, 0x87); -Colors.Wheat = (0, _glMatrix.vec3).fromValues(0xf5, 0xde, 0xb3); -Colors.NavajoWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xde, 0xad); -Colors.Bisque = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xc4); -Colors.BlanchedAlmond = (0, _glMatrix.vec3).fromValues(0xff, 0xeb, 0xcd); -Colors.Cornsilk = (0, _glMatrix.vec3).fromValues(0xff, 0xf8, 0xdc); -Colors.DarkGreen = (0, _glMatrix.vec3).fromValues(0x00, 0x64, 0x00); -Colors.Green = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x00); -Colors.DarkOliveGreen = (0, _glMatrix.vec3).fromValues(0x55, 0x6b, 0x2f); -Colors.ForestGreen = (0, _glMatrix.vec3).fromValues(0x22, 0x8b, 0x22); -Colors.SeaGreen = (0, _glMatrix.vec3).fromValues(0x2e, 0x8b, 0x57); -Colors.Olive = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x00); -Colors.OliveDrab = (0, _glMatrix.vec3).fromValues(0x6b, 0x8e, 0x23); -Colors.MediumSeaGreen = (0, _glMatrix.vec3).fromValues(0x3c, 0xb3, 0x71); -Colors.LimeGreen = (0, _glMatrix.vec3).fromValues(0x32, 0xcd, 0x32); -Colors.Lime = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x00); -Colors.SpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x7f); -Colors.MediumSpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xfa, 0x9a); -Colors.DarkSeaGreen = (0, _glMatrix.vec3).fromValues(0x8f, 0xbc, 0x8f); -Colors.MediumAquamarine = (0, _glMatrix.vec3).fromValues(0x66, 0xcd, 0xaa); -Colors.YellowGreen = (0, _glMatrix.vec3).fromValues(0x9a, 0xcd, 0x32); -Colors.LawnGreen = (0, _glMatrix.vec3).fromValues(0x7c, 0xfc, 0x00); -Colors.Chartreuse = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0x00); -Colors.LightGreen = (0, _glMatrix.vec3).fromValues(0x90, 0xee, 0x90); -Colors.GreenYellow = (0, _glMatrix.vec3).fromValues(0xad, 0xff, 0x2f); -Colors.PaleGreen = (0, _glMatrix.vec3).fromValues(0x98, 0xfb, 0x98); -Colors.Teal = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x80); -Colors.DarkCyan = (0, _glMatrix.vec3).fromValues(0x00, 0x8b, 0x8b); -Colors.LightSeaGreen = (0, _glMatrix.vec3).fromValues(0x20, 0xb2, 0xaa); -Colors.CadetBlue = (0, _glMatrix.vec3).fromValues(0x5f, 0x9e, 0xa0); -Colors.DarkTurquoise = (0, _glMatrix.vec3).fromValues(0x00, 0xce, 0xd1); -Colors.MediumTurquoise = (0, _glMatrix.vec3).fromValues(0x48, 0xd1, 0xcc); -Colors.Turquoise = (0, _glMatrix.vec3).fromValues(0x40, 0xe0, 0xd0); -Colors.Aqua = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Cyan = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Aquamarine = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0xd4); -Colors.PaleTurquoise = (0, _glMatrix.vec3).fromValues(0xaf, 0xee, 0xee); -Colors.LightCyan = (0, _glMatrix.vec3).fromValues(0xe0, 0xff, 0xff); -Colors.Navy = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x80); -Colors.DarkBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x8b); -Colors.MediumBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xcd); -Colors.Blue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xff); -Colors.MidnightBlue = (0, _glMatrix.vec3).fromValues(0x19, 0x19, 0x70); -Colors.RoyalBlue = (0, _glMatrix.vec3).fromValues(0x41, 0x69, 0xe1); -Colors.SteelBlue = (0, _glMatrix.vec3).fromValues(0x46, 0x82, 0xb4); -Colors.DodgerBlue = (0, _glMatrix.vec3).fromValues(0x1e, 0x90, 0xff); -Colors.DeepSkyBlue = (0, _glMatrix.vec3).fromValues(0x00, 0xbf, 0xff); -Colors.CornflowerBlue = (0, _glMatrix.vec3).fromValues(0x64, 0x95, 0xed); -Colors.SkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xeb); -Colors.LightSkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xfa); -Colors.LightSteelBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xc4, 0xde); -Colors.LightBlue = (0, _glMatrix.vec3).fromValues(0xad, 0xd8, 0xe6); -Colors.PowderBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xe0, 0xe6); -Colors.Indigo = (0, _glMatrix.vec3).fromValues(0x4b, 0x00, 0x82); -Colors.Purple = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x80); -Colors.DarkMagenta = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x8b); -Colors.DarkViolet = (0, _glMatrix.vec3).fromValues(0x94, 0x00, 0xd3); -Colors.DarkSlateBlue = (0, _glMatrix.vec3).fromValues(0x48, 0x3d, 0x8b); -Colors.BlueViolet = (0, _glMatrix.vec3).fromValues(0x8a, 0x2b, 0xe2); -Colors.DarkOrchid = (0, _glMatrix.vec3).fromValues(0x99, 0x32, 0xcc); -Colors.Fuchsia = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.Magenta = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.SlateBlue = (0, _glMatrix.vec3).fromValues(0x6a, 0x5a, 0xcd); -Colors.MediumSlateBlue = (0, _glMatrix.vec3).fromValues(0x7b, 0x68, 0xee); -Colors.MediumOrchid = (0, _glMatrix.vec3).fromValues(0xba, 0x55, 0xd3); -Colors.MediumPurple = (0, _glMatrix.vec3).fromValues(0x93, 0x70, 0xdb); -Colors.Orchid = (0, _glMatrix.vec3).fromValues(0xda, 0x70, 0xd6); -Colors.Violet = (0, _glMatrix.vec3).fromValues(0xee, 0x82, 0xee); -Colors.Plum = (0, _glMatrix.vec3).fromValues(0xdd, 0xa0, 0xdd); -Colors.Thistle = (0, _glMatrix.vec3).fromValues(0xd8, 0xbf, 0xd8); -Colors.Lavender = (0, _glMatrix.vec3).fromValues(0xe6, 0xe6, 0xfa); -Colors.MistyRose = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xe1); -Colors.AntiqueWhite = (0, _glMatrix.vec3).fromValues(0xfa, 0xeb, 0xd7); -Colors.Linen = (0, _glMatrix.vec3).fromValues(0xfa, 0xf0, 0xe6); -Colors.Beige = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xdc); -Colors.WhiteSmoke = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xf5); -Colors.LavenderBlush = (0, _glMatrix.vec3).fromValues(0xff, 0xf0, 0xf5); -Colors.OldLace = (0, _glMatrix.vec3).fromValues(0xfd, 0xf5, 0xe6); -Colors.AliceBlue = (0, _glMatrix.vec3).fromValues(0xf0, 0xf8, 0xff); -Colors.Seashell = (0, _glMatrix.vec3).fromValues(0xff, 0xf5, 0xee); -Colors.GhostWhite = (0, _glMatrix.vec3).fromValues(0xf8, 0xf8, 0xff); -Colors.Honeydew = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xf0); -Colors.FloralWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xf0); -Colors.Azure = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xff); -Colors.MintCream = (0, _glMatrix.vec3).fromValues(0xf5, 0xff, 0xfa); -Colors.Snow = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xfa); -Colors.Ivory = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xf0); -Colors.White = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xff); -Colors.Black = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x00); -Colors.DarkSlateGray = (0, _glMatrix.vec3).fromValues(0x2f, 0x4f, 0x4f); -Colors.DimGray = (0, _glMatrix.vec3).fromValues(0x69, 0x69, 0x69); -Colors.SlateGray = (0, _glMatrix.vec3).fromValues(0x70, 0x80, 0x90); -Colors.Gray = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x80); -Colors.LightSlateGray = (0, _glMatrix.vec3).fromValues(0x77, 0x88, 0x99); -Colors.DarkGray = (0, _glMatrix.vec3).fromValues(0xa9, 0xa9, 0xa9); -Colors.Silver = (0, _glMatrix.vec3).fromValues(0xc0, 0xc0, 0xc0); -Colors.LightGray = (0, _glMatrix.vec3).fromValues(0xd3, 0xd3, 0xd3); -Colors.Gainsboro = (0, _glMatrix.vec3).fromValues(0xdc, 0xdc, 0xdc); -Colors.Copper = (0, _glMatrix.vec3).fromValues(0xb8, 0x73, 0x33); -Colors.Bronze = (0, _glMatrix.vec3).fromValues(0xcd, 0x7f, 0x32); -Colors.Steel = (0, _glMatrix.vec3).fromValues(0xce, 0xd2, 0xd7); -Colors.Platinum = (0, _glMatrix.vec3).fromValues(0xe5, 0xe4, 0xe2); -Colors.Gunmetal = (0, _glMatrix.vec3).fromValues(0x5c, 0x5d, 0x5b); -Colors.Titanium = (0, _glMatrix.vec3).fromValues(0x87, 0x86, 0x81); -Colors.RoseGold = (0, _glMatrix.vec3).fromValues(0xcb, 0xa3, 0xb2); -Colors.AquaGlass = (0, _glMatrix.vec3).fromValues(0xd2, 0xe8, 0xdf); -Colors.BlueGlass = (0, _glMatrix.vec3).fromValues(0xc7, 0xe3, 0xe1); - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"edWrj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MapItem", ()=>MapItem); -parcelHelpers.export(exports, "MapVisual", ()=>MapVisual); -parcelHelpers.export(exports, "Map", ()=>Map); -parcelHelpers.export(exports, "MapAtlas", ()=>MapAtlas); -parcelHelpers.export(exports, "MapRasterizer", ()=>MapRasterizer); -parcelHelpers.export(exports, "GeoJSONRasterizer", ()=>GeoJSONRasterizer); -var _mapJs = require("./helpers/map.js"); -var _mainJs = require("./main.js"); -class MapItem { - toJSON() { - return { - key: this.key, - scale: this.scale, - minLat: this.minLat, - maxLat: this.maxLat, - minLon: this.minLon, - maxLon: this.maxLon, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; - } -} -class MapVisual { - update() {} - constructor(map){ - this.map = map; - } -} -class Map { - get atlas() { - return this._rasterizer.atlas; - } - get count() { - return this._keys.size; - } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; - } - add(key) { - if (!this._keys.has(key)) { - if (this._rasterizer.draw(key) !== null) { - this._keys.add(key); - this._hasChanged = true; + _updateLeftToRightAxisLabels(axisId, size2, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (position2 - 0.5) * size2, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (position2 - 0.5) * size2, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } - } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size2, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (0.5 - position2) * size2, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (0.5 - position2) * size2, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; + } + break; } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; } - toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$3(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions[position2 + 1] - 0.5 : positions[position2] - 0.5; + const right = isAxisReversed ? 1 - positions[position2] - 0.5 : positions[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; } - return { - key: this.key, - items: items - }; + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$3(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$3(); + negate(this._normal, Cube.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } -} -class MapAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class MapRasterizer { - get map() { - return this._map; + } + class Cartesian2dAxes extends AxesBase { + get size() { + return this._size; } - get atlas() { - return this._atlas; + get isDiscreteX() { + return this._isDiscrete[0]; } - get scale() { - return this._scale; - } - set scale(value) { - this._scale = value; - this._geoJSONRasterizer.scale = value; - } - get geoJSON() { - return this._geoJSON; - } - set geoJSON(value) { - this._geoJSON = value; - this._geoJSONRasterizer.geoJSON = value; - } - get property() { - return this._property; - } - set property(value) { - this._property = value; - this._geoJSONRasterizer.property = value; - } - get mapProjection() { - return this._mapProjection; - } - set mapProjection(value) { - this._mapProjection = value; - this._geoJSONRasterizer.mapProjection = value; - } - get scaleFactor() { - return this._scaleFactor; - } - set scaleFactor(value) { - this._scaleFactor = value; - this._geoJSONRasterizer.scaleFactor = this._scaleFactor; - } - get minLongitude() { - return this._minLogitude; - } - set minLongitude(value) { - this._minLogitude = value; - this._geoJSONRasterizer.minLongitude = this._minLogitude; - } - get maxLongitude() { - return this._maxLongitude; - } - set maxLongitude(value) { - this._maxLongitude = value; - this._geoJSONRasterizer.maxLongitude = this._maxLongitude; - } - get minLatitude() { - return this._minLatitude; - } - set minLatitude(value) { - this._minLatitude = value; - this._geoJSONRasterizer.minLatitude = this._minLatitude; - } - get maxLatitude() { - return this._maxLatitude; - } - set maxLatitude(value) { - this._maxLatitude = value; - this._geoJSONRasterizer.maxLatitude = this._maxLatitude; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._mapProjection = options.mapProjection; - this._map = new Map(core, this); - this._map.key = this._key; - const geoJSONRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance, - geoJSON: this._geoJSON, - scale: this._scale, - property: this._property, - mapProjection: this._mapProjection - }; - this._geoJSONRasterizer = new GeoJSONRasterizer(core, geoJSONRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `map rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key) { - const item = this._geoJSONRasterizer.draw(key); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._map.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._map.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; - } - this._atlas.x += texWidth; - } - return item; + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } -} -class GeoJSONRasterizer { - get scale() { - return this._scale; + get isDiscreteY() { + return this._isDiscrete[1]; } - set scale(value) { - this._scale = value; + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } } - get geoJSON() { - return this._geoJSON; + get minBoundsX() { + return this._minBoundsX; } - set geoJSON(value) { - this._geoJSON = value; + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - get property() { - return this._property; + get maxBoundsX() { + return this._maxBoundsX; } - set property(value) { - this._property = value; + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - get mapProjection() { - return this._mapProjection; + get minBoundsY() { + return this._minBoundsY; } - set mapProjection(value) { - this._mapProjection = value; + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - get scaleFactor() { - return this._scaleFactor; + get maxBoundsY() { + return this._maxBoundsY; } - set scaleFactor(value) { - this._scaleFactor = value; + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - get minLongitude() { - return this._minLongitude; + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; } - set minLongitude(value) { - this._minLongitude = value; + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } - get maxLongitude() { - return this._maxLongitude; + get textVertices() { + return this._textVertices; } - set maxLongitude(value) { - this._maxLongitude = value; + get textIndices() { + return this._textIndices; } - get minLatitude() { - return this._minLatitude; + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - set minLatitude(value) { - this._minLatitude = value; + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } - get maxLatitude() { - return this._maxLatitude; + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } - set maxLatitude(value) { - this._maxLatitude = value; + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._mapProjection = options.mapProjection; - this._lonLat = [ - 0, - 0 - ]; - this._geoJSONHelper = new (0, _mapJs.GeoJSONHelper)(); - this._core.log.write((0, _mainJs.LogLevel).info, `geoJSON rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key) { - let feature = this._geoJSONHelper.feature(this._geoJSON, this._property, key); - if (feature) { - let geometry = feature.geometry; - const clip = { - minLon: this._minLongitude, - maxLon: this._maxLongitude, - minLat: this._minLatitude, - maxLat: this._maxLatitude - }; - const bounds = this._geoJSONHelper.bounds(geometry, clip, this._mapProjection); - if (bounds) { - let minX = bounds.minX; - let maxX = bounds.maxX; - let minY = bounds.minY; - let maxY = bounds.maxY; - let sizeX = bounds.maxX - bounds.minX; - let sizeY = bounds.maxY - bounds.minY; - if (sizeX > 0 && sizeY > 0) { - const scale = this._scale * this._scaleFactor; - sizeX = Math.ceil(sizeX * scale); - sizeY = Math.ceil(sizeY * scale); - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new MapItem(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - item.minLon = minX; - item.maxLon = maxX; - item.minLat = minY; - item.maxLat = maxY; - item.scale = this._scaleFactor; - ctx.clearRect(this._border, this._border, sizeX, sizeY); - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.coordinates.length; k++){ - const inner = polygon.coordinates[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.length; k++){ - const inner = polygon[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - } - break; - } - const imgData = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return item; - } - } - } - if (!feature) this._core.log.write((0, _mainJs.LogLevel).warn, `geoJSON rasterizer ${key} not found`); - return null; + getLabelOrientation(index2) { + return this._orientations[index2]; } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./helpers/map.js":"luVrT","./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"luVrT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MercatorHelper", ()=>MercatorHelper); -parcelHelpers.export(exports, "AlbersHelper", ()=>AlbersHelper); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>GeoJSONHelper); -var _mathJs = require("./math.js"); -var _angleJs = require("./angle.js"); -var _constantsJs = require("../constants.js"); -class MercatorHelper { - constructor(){ - this.minLatitude = -85.05112878; - this.maxLatitude = 85.05112878; - this.minLongitude = -180; - this.maxLongitude = 180; - this.minX = -1; - this.minY = -1; - this.maxX = 1; - this.maxY = 1; - } - project(longitude, latitude, xy) { - const x = longitude / 180; - latitude = (0, _mathJs.MathHelper).clamp(latitude, this.minLatitude, this.maxLatitude); - latitude = (0, _angleJs.AngleHelper).degreesToRadians(latitude); - const sinLatitude = Math.sin(latitude); - let y = Math.log((1 + sinLatitude) / (1 - sinLatitude)) / 2; - y = (0, _mathJs.MathHelper).clamp(y / Math.PI, this.minY, this.maxY); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const longitude = x * 180; - y *= Math.PI; - let latitude = (0, _constantsJs.Constants).PI_OVER_TWO - 2 * Math.atan(Math.exp(-y)); - latitude = (0, _angleJs.AngleHelper).radiansToDegrees(latitude); - lonLat[0] = longitude; - lonLat[1] = latitude; - } -} -class AlbersHelper { - constructor(){ - this._phi1 = 29.5; - this._phi2 = 45.5; - this._lat0 = 37.5; - this._lon0 = -96; - } - get standardParallel1() { - return this._phi1; - } - set standardParallel1(value) { - this._phi1 = value; - } - get standardParallel2() { - return this._phi2; - } - set standardParallel2(value) { - this._phi2 = value; - } - get latitudeOfOrigin() { - return this._lat0; - } - set latitudeOfOrigin(value) { - this._lat0 = value; - } - get centralMeridian() { - return this._lon0; - } - set centralMeridian(value) { - this._lon0 = value; - } - project(lon, lat, xy) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - lat = (0, _angleJs.AngleHelper).degreesToRadians(lat); - lon = (0, _angleJs.AngleHelper).degreesToRadians(lon); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - const theta = n * (lon - lon0); - const p = Math.sqrt(C - 2 * n * Math.sin(lat)) / n; - const x = p * Math.sin(theta); - const y = p0 - p * Math.cos(theta); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - let theta = Math.atan(x / Math.abs(p0 - y) * Math.sign(p0 - y)); - if ((p0 - y) * n < 0) theta -= Math.PI * Math.sign(x) * Math.sign(p0 - y); - const p = Math.sqrt(x * x + Math.pow(p0 - y, 2)); - const lon = lon0 + theta / n; - const lat = Math.asin((C - p * p * n * n) / (2 * n)); - lonLat[0] = (0, _angleJs.AngleHelper).radiansToDegrees(lon); - lonLat[1] = (0, _angleJs.AngleHelper).radiansToDegrees(lat); - } -} -class GeoJSONHelper { - constructor(){ - this._lonLat = [ - 0, - 0 - ]; + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - feature(geoJSON, property, key) { - for(let i = 0; i < geoJSON.features.length; i++){ - let feature = geoJSON.features[i]; - if (feature.properties[property] == key) return feature; - } - return null; + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - bounds(geometry, clip, projection) { - let minX = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } - } - break; - } - if (minX == Number.MAX_VALUE) { - minX = 0; - maxX = 0; - minY = 0; - maxY = 0; - } - return { - minX: minX, - maxX: maxX, - minY: minY, - maxY: maxY - }; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } -} - -},{"./math.js":"6Lv1i","./angle.js":"hBXkO","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6zd9W":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Icon", ()=>Icon); -parcelHelpers.export(exports, "IconsVisual", ()=>IconsVisual); -parcelHelpers.export(exports, "Icons", ()=>Icons); -parcelHelpers.export(exports, "IconsAtlas", ()=>IconsAtlas); -parcelHelpers.export(exports, "IconsRasterizer", ()=>IconsRasterizer); -parcelHelpers.export(exports, "IconRasterizer", ()=>IconRasterizer); -var _mainJs = require("./main.js"); -class Icon { - toJSON() { - return { - key: this.key, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } -} -class IconsVisual { - update() {} - constructor(icons){ - this.icons = icons; + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } -} -class Icons { - get atlas() { - return this._rasterizer.atlas; + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } - get count() { - return this._keys.size; + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; } - add(key, imgData) { - if (!this._keys.has(key)) { - this._keys.add(key); - this._rasterizer.draw(key, imgData); - } + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); - } - return { - key: this.key, - items: items - }; + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } -} -class IconsAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class IconsRasterizer { - get icons() { - return this._icons; + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - get atlas() { - return this._atlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._icons = new Icons(core, this); - this._icons.key = this._key; - const iconRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance - }; - this._iconRasterizer = new IconRasterizer(core, iconRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `icons rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData) { - const item = this._iconRasterizer.draw(key, imgData); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._icons.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._icons.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; - } - this._atlas.x += texWidth; - } - } -} -class IconRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._core.log.write((0, _mainJs.LogLevel).info, `icon rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData0) { - const sizeX = imgData0.width; - const sizeY = imgData0.height; - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new Icon(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - ctx.clearRect(this._border, this._border, sizeX, sizeY); - ctx.putImageData(imgData0, this._border, this._border); - const imgData1 = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData1.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return item; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9pN13":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Controller", ()=>(0, _controllerJs.Controller)); -parcelHelpers.export(exports, "ControllerVisual", ()=>(0, _controllerJs.ControllerVisual)); -parcelHelpers.export(exports, "Label", ()=>(0, _labelsJs.Label)); -parcelHelpers.export(exports, "LabelVisual", ()=>(0, _labelsJs.LabelVisual)); -parcelHelpers.export(exports, "LabelSet", ()=>(0, _labelsJs.LabelSet)); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>(0, _labelsJs.TransitionLabelSet)); -parcelHelpers.export(exports, "LabelSetVisual", ()=>(0, _labelsJs.LabelSetVisual)); -parcelHelpers.export(exports, "ImageVisual", ()=>(0, _imageJs.ImageVisual)); -parcelHelpers.export(exports, "ImageQuad", ()=>(0, _imageJs.ImageQuad)); -parcelHelpers.export(exports, "ImageSphere", ()=>(0, _imageJs.ImageSphere)); -parcelHelpers.export(exports, "NominalKey", ()=>(0, _keysJs.NominalKey)); -var _controllerJs = require("./controller.js"); -var _labelsJs = require("./labels.js"); -var _imageJs = require("./image.js"); -var _keysJs = require("./keys.js"); - -},{"./controller.js":"3tuGu","./labels.js":"dXJPK","./image.js":"eexvE","./keys.js":"6qIGL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dXJPK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -parcelHelpers.export(exports, "LabelBase", ()=>LabelBase); -parcelHelpers.export(exports, "Label", ()=>Label); -parcelHelpers.export(exports, "LabelSet", ()=>LabelSet); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>TransitionLabelSet); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -var _pickJs = require("../helpers/pick.js"); -var _mathJs = require("../helpers/math.js"); -class LabelVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(label){ - this.label = label; - } -} -class LabelSetVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(labelSet){ - this.label = labelSet; - } -} -class LabelBase { - get material() { - return this._material; + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - get vertices() { - return this._vertices; + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } - get verticesView() { - return this._verticesView; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } - get indices() { - return this._indices; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } - get indexCount() { - return this._indexCount; + get gridVertices() { + return this._gridVertices; } - get isInitialized() { - return this._isInitialized; + get gridIndices() { + return this._gridIndices; } - get mMatrix() { - return this._mMatrix; + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - get scale() { - return this._scale; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } - set scale(value) { - if (this._scale != value) { - this._scale = value; - this._hasChanged = true; - } + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - get font() { - return this._font; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; } - get rotation() { - return this._rotation; + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._hasChanged = true; - } + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; } - set reverseX(value) { - if (this._reverseX != value) { - this._reverseX = value; - this._hasChanged = true; - } + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; } - set reverseY(value) { - if (this._reverseY != value) { - this._reverseY = value; - this._hasChanged = true; - } + get gridFaceZero() { + return this._gridFaceZeros; } - set reverseZ(value) { - if (this._reverseZ != value) { - this._reverseZ = value; - this._hasChanged = true; - } + get gridFaceMinorGridlines() { + return this._gridFaceMinorGridlines; } - get horizontalAlignment() { - return this._horizontalAlignment; + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; } - set horizontalAlignment(value) { - if (this._horizontalAlignment != value) { - this._horizontalAlignment = value; - this._hasChanged = true; - } + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } } - get verticalAlignment() { - return this._verticalAlignment; + get scalingX() { + return this._scalingX; } - set verticalAlignment(value) { - if (this._verticalAlignment != value) { - this._verticalAlignment = value; - this._hasChanged = true; - } + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } + } + get scalingY() { + return this._scalingY; + } + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } } get offsetX() { - return this._offsetX; + return this._offset[12]; } - set offsetX(value) { - if (this._offsetX != value) { - this._offsetX = value; - this._hasChanged = true; - } + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } } get offsetY() { - return this._offsetY; + return this._offset[13]; } - set offsetY(value) { - if (this._offsetY != value) { - this._offsetY = value; - this._hasChanged = true; - } + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } } - get offsetZ() { - return this._offsetZ; + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._rMatrix = create$4(); + fromQuat(this._rMatrix, value2); + } } - set offsetZ(value) { - if (this._offsetZ != value) { - this._offsetZ = value; - this._hasChanged = true; - } + constructor(core) { + super(core); + this._size = create$3(); + this._translation = create$3(); + this._normal = create$3(); + this._forward = create$3(); + this._right = create$3(); + this._up = create$3(); + this._texCoord = create(); + this._bounds = create$2(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mat3 = create$5(); + this._isDiscrete = [false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 2; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 4; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$3(); + this._textPosition = create$3(); + this._distances = []; + for (let i = 0; i < 4; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 2; i++) { + this._maxLabelSize.push(create()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._labelMMatrices.push(create$4()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 2; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._titleMMatrices.push(create$4()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 2; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._headingMMatrices.push(create$4()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$3(); + this._edgePositive = create$3(); + this._edgeNormal = create$3(); + this._edgeNormalTemp = create$3(); + this._edgePositiveTemp = create$3(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 4; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$3()); + this._edgeHorizontalUp.push(create$3()); + this._edgeHorizontalForward.push(create$3()); + this._edgeVerticalRight.push(create$3()); + this._edgeVerticalUp.push(create$3()); + this._edgeVerticalForward.push(create$3()); + } + this.isFaceVisible = []; + for (let i = 0; i < 2; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$3(); + this._gridTicksZeros = []; + this._gridFaceZeros = create(); + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = create(); + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$3(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 2; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create()); + this._gridTicksMinorGridlines.push(create()); + this._gridTicksScales.push(create$3()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$4()); + } + for (let i = 0; i < 4; i++) { + this._gridTicksMMatrices.push(create$4()); + this._gridTicksRotations.push(create$4()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Quad$2.EDGE_POSITIVES[i][0]; + _mat4[1] = Quad$2.EDGE_POSITIVES[i][1]; + _mat4[2] = Quad$2.EDGE_POSITIVES[i][2]; + _mat4[4] = Quad$2.EDGE_NORMALS[i][0]; + _mat4[5] = Quad$2.EDGE_NORMALS[i][1]; + _mat4[6] = Quad$2.EDGE_NORMALS[i][2]; + cross(this._vec3, Quad$2.EDGE_POSITIVES[i], Quad$2.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null]; + this._toValues = [null, null]; + this.isDivisionPickingEnabled = [false, false]; + this.isLabelPickingEnabled = [false, false]; + this.isTitlePickingEnabled = [false, false]; + this.isHeadingPickingEnabled = [false, false]; + this.isAxisReversed = [false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._offset = create$4(); } - get maxGlyphTop() { - return this._maxGlyphTop; + initialize() { + this._isInitialized = true; } - set maxGlyphTop(value) { - if (this._maxGlyphTop != value) { - this._maxGlyphTop = value; - this._hasChanged = true; + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); + const maxBounds = Math.max(this._size[0], this._size[1]); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); + } + if (this._rMatrix) { + mul(this._mMatrix, this.mMatrix, this._rMatrix); + mul(this._mMatrix, this._mMatrix, this._offset); + } else { + multiply$2(this._mMatrix, this.mMatrix, this._offset); + } + this._mvMatrix = create$4(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 2; faceId++) { + transformMat4$2(this._forward, Constants.VECTOR3_ZERO, this._mvMatrix); + transformMat3(this._normal, Quad$2.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 4; edgeId++) { + this._isForwardEdge[edgeId] = dot$1(Quad$2.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 2; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + translate(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); + } + scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } + } + } + } + set(this._gridFaceZeros, this.zero[0], this.zero[1]); + set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); + for (let faceId = 0; faceId < 2; faceId++) { + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + } + } + for (let axisId = 0; axisId < 2; axisId++) { + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + multiply$1(this._edgePosition, Quad$2.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$2(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross(this._right, Constants.VECTOR3_UNITY, this._forward); + normalize$2(this._right, this._right); + cross(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Quad$2.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Quad$2.EDGE_POSITIVES[edgeId], this._mat3); + copy$3(this._edgeNormalTemp, this._edgeNormal); + copy$3(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$3(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$3(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$3(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$3(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } + } } + } } - get maxGlyphHeight() { - return this._maxGlyphHeight; - } - set maxGlyphHeight(value) { - if (this._maxGlyphHeight != value) { - this._maxGlyphHeight = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._offset = (0, _glMatrix.vec3).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - this._indexCount = 0; - this._maxGlyphs = options.maxGlyphs; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this.scale = options.scale ? options.scale : 1; - this.offsetX = options.offsetX ? options.offsetX : 0; - this.offsetY = options.offsetY ? options.offsetY : 0; - this.offsetZ = options.offsetZ ? options.offsetZ : 0; - this.reverseX = options.reverseX; - this.reverseY = options.reverseY; - this.reverseZ = options.reverseZ; - this.rotation = options.rotation; - this.maxGlyphTop = options.maxGlyphTop; - this.horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - this.verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - this._material = options.material; - this.borderWidth = core.config.textBorderWidth; - this.gamma = 0; + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * this._maxGlyphs * 4); - this._verticesView = new DataView(this._vertices); - this._indices = new Uint32Array(this._maxGlyphs * 6); - this._isInitialized = true; + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } - update(elapsedTime) {} -} -class Label extends LabelBase { - get textAlignment() { - return this._textAlignment; + _updateHeading(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; + } + _updateGrids(size2) { + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId2 = 0; axisId2 < 2; axisId2++) { + const width2 = size2[axisId2]; + set$3(this._gridTicksScales[axisId2], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId2, this._gridVerticesView, this._gridIndices, offset2); + this._gridFaceScale[axisId2] = size2[axisId2] == 0 ? 1 : size2[axisId2]; + } + const axisId = 2; + this._gridFaceScale[axisId] = 1; + for (let faceId = 0; faceId < 2; faceId++) { + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } } - set textAlignment(value) { - if (this._textAlignment != value) { - this._textAlignment = value; - this._hasChanged = true; + _updateText(size2) { + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 2; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } } - } - get text() { - return this._text; - } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); } + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._labels[axisId]) { + const width2 = size2[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._titles[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._headings[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } } - constructor(core, options){ - super(core, options); - this._font = options.font || core.font; - this._text = options.text; - this._textAlignment = options.textAlignment === undefined ? (0, _mainJs.TextAlignment).left : options.textAlignment; - } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - if (!this._text) { - this._indexCount = 0; - this.width = 0; - this.height = 0; + _updateLeftToRightAxisLabels(axisId, size2, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (position2 - 0.5) * size2, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; } else { - const widths = []; - const truncated = []; - let maxWidth = 0; - let maxGlyphHeight = 0; - let maxGlyphTop = 0; - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - widths.push(this._textMetric.width); - maxWidth = Math.max(this._textMetric.width, maxWidth); - maxGlyphHeight = Math.max(this._textMetric.maxHeight, maxGlyphHeight); - maxGlyphTop = Math.max(this._textMetric.maxTop, maxGlyphTop); - glyphs += text.length; - truncated.push(text); - if (glyphs >= this._maxGlyphs) break; - } - if (this._maxGlyphHeight) maxGlyphHeight = this._maxGlyphHeight; - if (this._maxGlyphTop) maxGlyphTop = this._maxGlyphTop; - const lineHeight = this._font.size; - const height = truncated.length * lineHeight; - switch(this._horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._originX = this._offsetX + maxWidth / 2; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._originX = this._offsetX; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._originX = this._offsetX - maxWidth / 2; - break; - } - switch(this._verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._originY = this._offsetY - height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._originY = this._offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._originY = this._offsetY + height / 2; - break; - } - glyphs = 0; - for(let i = 0; i < truncated.length; i++){ - switch(this._textAlignment){ - case (0, _mainJs.TextAlignment).left: - this._offset[0] = this._originX - maxWidth / 2; - break; - case (0, _mainJs.TextAlignment).center: - this._offset[0] = this._originX - widths[i] / 2; - break; - case (0, _mainJs.TextAlignment).right: - this._offset[0] = this._originX + maxWidth / 2 - widths[i]; - break; - } - this._offset[1] = this._originY + height / 2 - i * lineHeight - lineHeight / 2 - maxGlyphTop / 2; - const pickingId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickingId, (0, _mainJs.PickType).label, this._vec4); - const text = truncated[i]; - if (text.length > 0) { - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, (0, _constantsJs.Constants).VECTOR3_ZERO, 1, this._offset, null, this._vec4); - glyphs += text.length; - } - } - const scaling = this._scale / this._font.size; - this.width = maxWidth * scaling; - this.height = height * scaling; - this._indexCount = glyphs * 6; - (0, _glMatrix.vec3).set(this._vec3, scaling, scaling, scaling); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, this._vec3); - if (this.hasChangedCallback) this.hasChangedCallback(); + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (position2 - 0.5) * size2, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size2, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (0.5 - position2) * size2, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (0.5 - position2) * size2, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; + } + break; + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; } -} -class LabelSet extends LabelBase { - get materials() { - return this._materials; - } - get minBoundsX() { - return this._minBoundsX; - } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$3(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions[position2 + 1] - 0.5 : positions[position2] - 0.5; + const right = isAxisReversed ? 1 - positions[position2] - 0.5 : positions[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; } + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$3(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$3(); + negate(this._normal, Quad$2.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } - get minBoundsY() { - return this._minBoundsY; + } + class Glyph { + toJSON() { + return { + key: this.key, + char: this.char, + width: this.width, + height: this.height, + top: this.top, + left: this.left, + advance: this.advance, + u0: this.u0, + v0: this.v0, + u1: this.u1, + v1: this.v1 + }; } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; - } + } + let FontVisual$2 = class FontVisual { + update() { } - get minBoundsZ() { - return this._minBoundsZ; + constructor(font2) { + this.font = font2; } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } + }; + class Font { + get atlas() { + return this._rasterizer.fontAtlas; } - get maxBoundsX() { - return this._maxBoundsX; + get count() { + return this._chars.size; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + constructor(core, rasterizer) { + this._core = core; + this._rasterizer = rasterizer; + this._chars = /* @__PURE__ */ new Set(); + this._previousSize = 0; + this.glyphs = {}; } - get maxBoundsY() { - return this._maxBoundsY; + addGlyph(char) { + if (!this._chars.has(char)) { + this._chars.add(char); + this._rasterizer.draw(char); + this._hasChanged = true; + } } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; + update() { + if (this._hasChanged) { + this._hasChanged = false; + this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); + this._previousSize = this._chars.size; + if (this.hasChangedCallback) { + this.hasChangedCallback(); } + } } - get maxBoundsZ() { - return this._maxBoundsZ; + toJSON() { + const glyphs = []; + for (let key2 in this.glyphs) { + const glyph = this.glyphs[key2]; + glyphs.push(glyph.toJSON()); + } + return { + name: this.name, + size: this.size, + border: this.border, + glyphs, + edgeValue: this.edgeValue + }; } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + } + class FontAtlas { + constructor(width2, height2) { + const canvas = document.createElement("canvas"); + canvas.width = width2; + canvas.height = height2; + const context2 = canvas.getContext("2d"); + context2.clearRect(0, 0, width2, height2); + this.imageData = context2.getImageData(0, 0, width2, height2); + this.x = 0; + this.top = new Uint16Array(width2); } - get positionsX() { - return this._positionsX; + } + class FontRasterizer { + get font() { + return this._font; } - set positionsX(value) { - if (this._positionsX != value) { - this._positionsX = value; - this._hasChanged = true; - } + get fontAtlas() { + return this._fontAtlas; + } + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontAtlas = options.fontAtlas; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._font = new Font(core, this); + this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); + this._font.size = this._fontSize; + this._font.border = this._border; + this._font.edgeValue = this._edgeValue; + const glyphRasterizerOptions = { + baseline: this._baseline, + border: this._border, + edgeValue: this._edgeValue, + fontFamily: this._fontFamily, + fontSize: this._fontSize, + fontStyle: this._fontStyle, + fontWeight: this._fontWeight, + maxDistance: this._maxDistance + }; + this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); + this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); } - get positionsY() { - return this._positionsY; + draw(char) { + const glyph = this._glyphRasterizer.draw(char); + const texWidth = glyph.width + 2 * this._border; + const texHeight = glyph.height + 2 * this._border; + const width2 = this._fontAtlas.imageData.width; + const height2 = this._fontAtlas.imageData.height; + if (this._fontAtlas.x + texWidth > width2) { + this._fontAtlas.x = 0; + } + let y2 = 0; + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + y2 = Math.max(y2, this._fontAtlas.top[x2]); + } + if (y2 + texHeight > height2) { + this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); + } + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + this._fontAtlas.top[x2] = y2 + texHeight; + } + glyph.u0 = this._fontAtlas.x / width2; + glyph.v0 = y2 / height2; + glyph.u1 = (this._fontAtlas.x + texWidth) / width2; + glyph.v1 = (y2 + texHeight) / height2; + this._font.glyphs[char] = glyph; + for (let i = 0; i < glyph.distances.length; i++) { + const distance2 = glyph.distances[i]; + const dataX = i % texWidth; + const dataY = Math.floor(i / texWidth); + const offset2 = (this._fontAtlas.x + dataX + (y2 + dataY) * width2) * 4; + this._fontAtlas.imageData.data[offset2 + 0] = distance2; + this._fontAtlas.imageData.data[offset2 + 1] = distance2; + this._fontAtlas.imageData.data[offset2 + 2] = distance2; + this._fontAtlas.imageData.data[offset2 + 3] = 255; + } + this._fontAtlas.x += texWidth; + } + } + class GlyphRasterizer { + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._size = this._fontSize + this._border * 2; + this._size += this._border * 2; + this._gridOuter = new Float64Array(this._size * this._size); + this._gridInner = new Float64Array(this._size * this._size); + this._f = new Float64Array(this._size); + this._z = new Float64Array(this._size + 1); + this._v = new Uint16Array(this._size); + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = this._size; + this._context = canvas.getContext("2d", { willReadFrequently: true }); + this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; + this._context.textBaseline = this._baseline; + this._context.textAlign = "left"; + this._context.fillStyle = "black"; + this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); } - set positionsY(value) { - if (this._positionsY != value) { - this._positionsY = value; - this._hasChanged = true; + draw(char) { + const textMetrics2 = this._context.measureText(char); + const glyphLeft = 0; + const glyphTop = Math.floor(textMetrics2.actualBoundingBoxAscent); + let glyphWidth = Math.ceil(textMetrics2.actualBoundingBoxRight); + let glyphHeight = Math.ceil(textMetrics2.actualBoundingBoxAscent) + Math.ceil(textMetrics2.actualBoundingBoxDescent); + glyphWidth = Math.min(this._size - this._border, glyphWidth); + glyphHeight = Math.min(this._size - this._border, glyphHeight); + const width2 = glyphWidth + 2 * this._border; + const height2 = glyphHeight + 2 * this._border; + const length2 = width2 * height2; + const distances = new Uint8ClampedArray(length2); + const gradientsX = new Uint8ClampedArray(length2); + const gradientsY = new Uint8ClampedArray(length2); + const pixels = new Uint8ClampedArray(length2); + const glyph = new Glyph(); + glyph.char = char; + glyph.key = char.codePointAt(0); + glyph.distances = distances; + glyph.gradientsX = gradientsX; + glyph.gradientsY = gradientsY; + glyph.pixels = pixels; + glyph.width = glyphWidth; + glyph.height = glyphHeight; + glyph.top = glyphTop; + glyph.left = glyphLeft; + glyph.advance = textMetrics2.width; + if (glyphWidth == 0 || glyphHeight == 0) { + return glyph; + } + this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); + this._context.fillText(char, this._border, this._border + glyphTop); + const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); + for (let i = 0; i < length2; i++) { + this._gridOuter[i] = Number.MAX_VALUE; + this._gridInner[i] = 0; + } + for (let y2 = 0; y2 < glyphHeight; y2++) { + for (let x2 = 0; x2 < glyphWidth; x2++) { + const a2 = imgData.data[4 * (y2 * glyphWidth + x2) + 3] / 255; + if (a2 > 0) { + const j = (y2 + this._border) * width2 + x2 + this._border; + if (a2 == 1) { + this._gridOuter[j] = 0; + this._gridInner[j] = Number.MAX_VALUE; + } else { + const d = 0.5 - a2; + this._gridOuter[j] = d > 0 ? d * d : 0; + this._gridInner[j] = d < 0 ? d * d : 0; + pixels[j] = 255; + } + } + } + } + this._edt(this._gridOuter, 0, 0, width2, height2, width2, this._f, this._v, this._z); + this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width2, this._f, this._v, this._z); + const distances2 = new Float32Array(length2); + for (let i = 0; i < length2; i++) { + const distance2 = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); + distances[i] = Math.round(this._edgeValue - distance2 * 255 / this._maxDistance); + distances2[i] = distance2; + } + for (let i = 0; i < length2; i++) { + const x2 = i % width2; + const y2 = Math.floor(i / width2); + const d = distances2[i]; + const sign2 = d < 0 ? -1 : 1; + const x02 = x2 > 0 ? distances2[i - 1] : Number.MAX_VALUE; + const x12 = x2 < width2 - 1 ? distances2[i + 1] : Number.MAX_VALUE; + const y02 = y2 > 0 ? distances2[i - width2] : Number.MAX_VALUE; + const y12 = y2 < height2 - 1 ? distances2[i + width2] : Number.MAX_VALUE; + let gradientX = sign2 * x02 < sign2 * x12 ? d - x02 : x12 - d; + let gradientY = sign2 * y02 < sign2 * y12 ? y02 - d : d - y12; + gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 255); + gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 255); + } + return glyph; + } + _edt(data2, x02, y02, width2, height2, gridSize, f, v, z) { + for (let x2 = x02; x2 < x02 + width2; x2++) + this._edt1d(data2, y02 * gridSize + x2, gridSize, height2, f, v, z); + for (let y2 = y02; y2 < y02 + height2; y2++) + this._edt1d(data2, y2 * gridSize + x02, 1, width2, f, v, z); + } + _edt1d(grid2, offset2, stride, n, f, v, z) { + v[0] = 0; + z[0] = -Number.MAX_VALUE; + z[1] = Number.MAX_VALUE; + f[0] = grid2[offset2]; + for (let q = 1, k = 0, s = 0; q < n; q++) { + f[q] = grid2[offset2 + q * stride]; + const q2 = q * q; + do { + const r = v[k]; + s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; + } while (s <= z[k] && --k > -1); + k++; + v[k] = q; + z[k] = s; + z[k + 1] = Number.MAX_VALUE; + } + for (let q = 0, k = 0; q < n; q++) { + while (z[k + 1] < q) { + k++; } + const r = v[k]; + const qr = q - r; + grid2[offset2 + q * stride] = f[r] + qr * qr; + } } - get positionsZ() { - return this._positionsZ; + } + class ManipulationProcessor { + get manipulators() { + return this._manipulators; } - set positionsZ(value) { - if (this._positionsZ != value) { - this._positionsZ = value; - this._hasChanged = true; - } + get count() { + return this._count; } - get positionScalingX() { - return this._positionScalingX; + get isDragging() { + return this._isDragging; + } + constructor(core) { + this._core = core; + this._count = 0; + this._centroid = create$3(); + this._previousCentroid = create$3(); + this._relativePositionToCentroid = create$3(); + this._directionToCentroid = create$3(); + this._previousDirectionToCentroid = create$3(); + this._manipulators = {}; + this._removedManipulators = []; + this.cumulativeTranslation = create$3(); + this.translationDelta = create$3(); + this.centroid = create$3(); + this.maxScale = Number.MAX_VALUE; + this.twistAxis = fromValues$3(0, 0, 1); + this.initialize(); } - set positionScalingX(value) { - if (this._positionScalingX != value) { - this._positionScalingX = value; - this._hasChanged = true; + update(elapsedTime, manipulators) { + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (!manipulators[manipulator.id]) { + if (this.removeManipulator) { + this.removeManipulator(manipulator); + } + this._removedManipulators.push(manipulator.id); + } + } + if (this._removedManipulators.length > 0) { + for (let i = 0; i < this._removedManipulators.length; i++) { + delete this._manipulators[this._removedManipulators[i]]; + this._count--; + } + this._removedManipulators = []; + } + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + if (!this._manipulators[manipulator.id]) { + if (!this.addManipulator || this.addManipulator(manipulator)) { + copy$3(manipulator.initialPosition, manipulator.position); + this._manipulators[manipulator.id] = manipulator; + this._count++; + } + } + } + set$3(this.translationDelta, 0, 0, 0); + this.scaleDelta = 0; + this.twistDelta = 0; + if (this._count > 0) { + if (this._previousCount > 0) { + if (this.prepareManipulation) { + this.prepareManipulation(); + } + this._process(); + if (this.processManipulation) { + this.processManipulation(elapsedTime); + } + } else { + this.initialize(); + if (this.beginManipulation) { + this.beginManipulation(); + } + } + } else { + if (this._previousCount > 0) { + if (this.endManipulation) { + this.endManipulation(); + } } + } + this._isDragging = this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; + this._previousCount = this._count; } - get positionScalingY() { - return this._positionScalingY; + initialize() { + set$3(this.centroid, 0, 0, 0); + set$3(this.cumulativeTranslation, 0, 0, 0); + this.cumulativeScale = 1; + this.cumulativeTwist = 0; } - set positionScalingY(value) { - if (this._positionScalingY != value) { - this._positionScalingY = value; - this._hasChanged = true; + _process() { + if (this._previousCount > 0) { + let persisted = 0; + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + persisted++; + } + } + const removed = this._previousCount - persisted; + if (persisted > 0) { + if (removed > 0) { + copy$3(this._centroid, this._previousCentroid); + } else { + set$3(this._centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + add(this._centroid, this._centroid, manipulator.position); + } + } + scale(this._centroid, this._centroid, 1 / persisted); + } + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); + add(this.translationDelta, this.translationDelta, manipulator.position); + subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); + subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); + const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); + if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) { + this.scaleDelta += 1; + } else { + const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); + const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); + const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); + this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; + scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); + scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); + this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); + } + } + } + scale(this.translationDelta, this.translationDelta, 1 / persisted); + add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); + this.scaleDelta /= persisted; + this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); + this.scaleDelta -= 1; + this.twistDelta /= persisted; + this.cumulativeTwist += this.twistDelta; } + } + set$3(this.centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + add(this.centroid, this.centroid, manipulator.position); + } + scale(this.centroid, this.centroid, 1 / this._count); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); + } + copy$3(this._previousCentroid, this.centroid); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + manipulator.isPersisted = true; + copy$3(manipulator.previousPosition, manipulator.position); + copy$3(manipulator.previousRotationAxis, manipulator.rotationAxis); + copy$3(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); + } } - get positionScalingZ() { - return this._positionScalingZ; + } + class MouseWheel { + constructor(core) { + this._core = core; + this._previousTotal = 0; + this.total = 0; + } + initialize(element2) { + element2.addEventListener("wheel", (e) => { + e.preventDefault(); + const wheelEvent = e; + this.total += wheelEvent.deltaY; + }, { passive: false }); } - set positionScalingZ(value) { - if (this._positionScalingZ != value) { - this._positionScalingZ = value; - this._hasChanged = true; - } + update(elapsedTime) { + const total = this.total; + this.delta = total - this._previousTotal; + this._previousTotal = total; + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); + } } - get rotations() { - return this._rotations; + } + class Manipulator { + constructor() { + this.pickedIndex = 0; + this.maxTranslationSquared = 0; + this.initialPosition = create$3(); + this.position = create$3(); + this.previousPosition = create$3(); + this.holdOrigin = create$3(); + this.positionRelativeToCentroid = create$3(); + this.previousPositionRelativeToCentroid = create$3(); + this.rotationAxis = create$3(); + this.previousRotationAxis = create$3(); } - set rotations(value) { - if (this._rotations != value) { - this._rotations = value; - this._hasChanged = true; - } + } + class Pointers { + get hoverX() { + return this._hoverX; } - get offsetsX() { - return this._offsetsX; + get hoverY() { + return this._hoverY; } - set offsetsX(value) { - if (this._offsetsX != value) { - this._offsetsX = value; - this._hasChanged = true; - } + get hoverId() { + return this._hoverId; } - get offsetsY() { - return this._offsetsY; + constructor(core, manipulators) { + this._core = core; + this._manipulators = manipulators; } - set offsetsY(value) { - if (this._offsetsY != value) { - this._offsetsY = value; - this._hasChanged = true; - } + initialize(element2) { + this._element = element2; + element2.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); + element2.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); + element2.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); + element2.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); + element2.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); + element2.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); } - get offsetsZ() { - return this._offsetsZ; + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); + this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); + } } - set offsetsZ(value) { - if (this._offsetsZ != value) { - this._offsetsZ = value; - this._hasChanged = true; - } + _handlePointerDown(e) { + this._element.focus(); + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const manipulator = new Manipulator(); + const id2 = e.pointerId; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + manipulator.id = id2; + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.type = e.pointerType; + manipulator.button = e.button; + manipulator.shiftKey = e.shiftKey; + manipulator.ctrlKey = e.ctrlKey; + manipulator.altKey = e.altKey; + manipulator.event = e; + this._manipulators[id2] = manipulator; + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; } - get offsetScalingX() { - return this._offsetScalingX; + _handlePointerMove(e) { + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + const id2 = e.pointerId; + const manipulator = this._manipulators[id2]; + if (manipulator) { + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.event = e; + } + switch (e.pointerType) { + case "mouse": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + break; + case "pen": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + this._tiltX = e.tiltX; + this._tiltY = e.tiltY; + this._twist = e.twist; + break; + } } - set offsetScalingX(value) { - if (this._offsetScalingX != value) { - this._offsetScalingX = value; - this._hasChanged = true; - } + _handlePointerUp(e) { + const manipulator = this._manipulators[e.pointerId]; + if (manipulator) { + manipulator.event = e; + } + this._remove(e.pointerId); } - get offsetScalingY() { - return this._offsetScalingY; + _handlePointerCancel(e) { + this._remove(e.pointerId); } - set offsetScalingY(value) { - if (this._offsetScalingY != value) { - this._offsetScalingY = value; - this._hasChanged = true; - } + _handlePointerLeave(e) { + this._resetHover(); + this._remove(e.pointerId); } - get offsetScalingZ() { - return this._offsetScalingZ; + _handlePointerOut(e) { + this._resetHover(); + this._remove(e.pointerId); } - set offsetScalingZ(value) { - if (this._offsetScalingZ != value) { - this._offsetScalingZ = value; - this._hasChanged = true; - } + _resetHover() { + this._hoverId = null; + this._hoverX = null; + this._hoverY = null; } - get text() { - return this._text; + _remove(pointerId) { + const manipulator = this._manipulators[pointerId]; + if (manipulator) { + delete this._manipulators[pointerId]; + } } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; - } + } + class AnimationHelper { + static smoothStep(value2) { + return value2 * value2 * (3 - 2 * value2); + } + static damp(value2, target2, threshold2, dampening) { + if (Math.abs(target2) < threshold2) { + return MathHelper.lerp(value2, 0, dampening); + } else { + return MathHelper.lerp(value2, target2, dampening); + } } - get horizontalAlignments() { - return this._horizontalAlignments; + } + class Keyboard { + constructor(core) { + this._core = core; + this._pressedKeys = /* @__PURE__ */ new Set(); + this._previousPressedKeys = /* @__PURE__ */ new Set(); + } + initialize(element2) { + element2.addEventListener("keydown", (e) => { + this._handleKeyDown(e); + }, false); + element2.addEventListener("keyup", (e) => { + this._handleKeyUp(e); + }, false); } - set horizontalAlignments(value) { - if (this._horizontalAlignments != value) { - this._horizontalAlignments = value; - this._hasChanged = true; - } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + } } - get verticalAlignments() { - return this._verticalAlignments; + isKeyDown(key2) { + return this._pressedKeys.has(key2); } - set verticalAlignments(value) { - if (this._verticalAlignments != value) { - this._verticalAlignments = value; - this._hasChanged = true; + wasKeyReleased(key2) { + if (this._pressedKeys.has(key2)) { + if (!this._previousPressedKeys.has(key2)) { + this._previousPressedKeys.add(key2); + return true; } + } else { + this._previousPressedKeys.delete(key2); + } + return false; } - get scales() { - return this._scales; + _handleKeyDown(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (!this._pressedKeys.has(key2)) { + this._pressedKeys.add(key2); + } } - set scales(value) { - if (this._scales != value) { - this._scales = value; - this._hasChanged = true; - } + _handleKeyUp(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (this._pressedKeys.has(key2)) { + this._pressedKeys.delete(key2); + } } - get scalesScaling() { - return this._scalesScaling; - } - set scalesScaling(value) { - if (this._scalesScaling != value) { - this._scalesScaling = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._quat = (0, _glMatrix.quat).create(); - this._materials = options.materials; - this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - this._font = options.font || core.font; - this.text = options.text; - this.positionsX = options.positionsX; - this.positionsY = options.positionsY; - this.positionsZ = options.positionsZ; - this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - this.rotations = options.rotations; - this.offsetsX = options.offsetsX; - this.offsetsY = options.offsetsY; - this.offsetsZ = options.offsetsZ; - this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - if (options.horizontalAlignments) this.horizontalAlignments = options.horizontalAlignments; - if (options.verticalAlignments) this.verticalAlignments = options.verticalAlignments; - if (options.scales) this.scales = options.scales; - this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; + } + class Manager { + constructor(core) { + this._manipulators = {}; + this._core = core; + this._vec3 = create$3(); + this._manipulationProcessor = new ManipulationProcessor(core); + this._manipulators = {}; + this._pointers = new Pointers(core, this._manipulators); + this._pointers.initialize(core.container); + this._mouseWheel = new MouseWheel(core); + this._mouseWheel.initialize(core.container); + this._keyboard = new Keyboard(core); + this._keyboard.initialize(core.container); + this.isPickingEnabled = true; + this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; + this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; + this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; + this.pickHoldDelay = this._core.config.pickHoldDelay; + this.pickSelectDelay = this._core.config.pickSelectDelay; + const rightButton2 = 2; + this.singleTouchAction = (manipulator) => { + if (manipulator.type == "mouse" && manipulator.button == rightButton2 || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.translate; + } else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton2) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.rotate; + } + }; + this.mouseWheelAction = (keyboard) => { + if (this._keyboard.isKeyDown("Control")) { + return MouseWheelAction.rotateY; + } else { + return MouseWheelAction.zoom; + } + }; + this.lassoPickType = PickType.data; + this._thumbstickX = 0; + this._previousControllerButtonPressed = [false, false, false, false]; + this._quat0 = create$1(); + this._quat1 = create$1(); } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.pickIdLookup = {}; - if (!this._text) this._indexCount = 0; - else { - const start = window.performance.now(); - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; - const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; - const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; - if (this._rotation) (0, _glMatrix.quat).set(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; - const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; - const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - const scale = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const lineHeight = this._font.size * scale; - const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale; - const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = offsetX - width; - break; + update(elapsedTime, xrFrame) { + if (xrFrame) { + const inputSources = this._core.webXRSession.inputSources; + if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { + const inputSource = inputSources[0]; + const controllerVisual = this._core.renderer.controllers[0]; + if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { + const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); + if (gripPose) { + controllerVisual.mMatrix = gripPose.transform.matrix; + } + const gamepad = inputSource.gamepad; + this._core.renderer.isPickingEnabled = false; + const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); + if (rayPose) { + controllerVisual.rayMMatrix = rayPose.transform.matrix; + if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { + this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; + this._core.renderer.isPickingEnabled = true; + } + } + const threshold2 = 0.2; + const dampening = Math.min(0.015 * elapsedTime, 1); + this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold2, dampening); + if (this._thumbstickX != 0) { + setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); + this._core.getModelRotation(this._quat1); + multiply(this._quat1, this._quat0, this._quat1); + this._core.setModelRotation(this._quat1, true); + } + if (gamepad.buttons[2].pressed) { + if (!this._previousControllerButtonPressed[2]) { + this._previousControllerButtonPressed[2] = true; + if (this.controllerButtonPressedCallback) { + this.controllerButtonPressedCallback(2); + } + } + } else { + this._previousControllerButtonPressed[2] = false; + } + } + } + } else { + const camera = this._core.camera; + this._manipulationProcessor.update(elapsedTime, this._manipulators); + this._pointers.update(elapsedTime); + this._mouseWheel.update(elapsedTime); + this._keyboard.update(elapsedTime); + if (this._mouseWheel.delta != 0) { + switch (this.mouseWheelAction(this._keyboard)) { + case MouseWheelAction.zoom: + if (this._pointers.hoverX, this._pointers.hoverY) { + camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); + } + break; + case MouseWheelAction.rotateY: + setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); + camera.getOrbit(this._quat1); + multiply(this._quat1, this._quat1, this._quat0); + camera.setOrbit(this._quat1, true); + break; + } + } + const count2 = this._manipulationProcessor.count; + if (count2 == 0) { + if (this._isLassoPicking) { + this._isLassoPicking = false; + this._core.renderer.isLassoPicking = false; + const x02 = Math.min(this._lassoX0, this._lassoX1); + const y02 = Math.min(this._lassoY0, this._lassoY1); + const x12 = Math.max(this._lassoX0, this._lassoX1); + const y12 = Math.max(this._lassoY0, this._lassoY1); + if (x12 - x02 > 0 && y12 - y02 > 0) { + const sets = this._core.pickLasso(x02, y02, x12, y12, this.lassoPickType); + const result = { + x0: x02, + y0: y02, + x1: x12, + y1: y12, + pickType: this.lassoPickType, + ids: sets, + manipulator: this._manipulator + }; + this.pickLassoCallback(result); + } + } + } else if (count2 == 1) { + const translationDelta = this._manipulationProcessor.translationDelta; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + const manipulators = this._manipulationProcessor.manipulators; + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + switch (this.singleTouchAction(manipulator)) { + case SingleTouchAction.rotate: + camera.rotate(translationDelta); + break; + case SingleTouchAction.translate: + camera.translate(translationDelta); + break; + case SingleTouchAction.lasso: + if (this.pickLassoCallback) { + if (!this._isLassoPicking) { + this._isLassoPicking = true; + this._core.renderer.isLassoPicking = true; + this._lassoX0 = manipulator.position[0]; + this._lassoY0 = manipulator.position[1]; } - const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = offsetY + lineHeight / 2; - break; + this._lassoX1 = manipulator.position[0]; + this._lassoY1 = manipulator.position[1]; + this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); + this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); + } + break; + } + break; + } + } + } else { + const translationDelta = this._manipulationProcessor.translationDelta; + const camera2 = this._core.camera; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + camera2.translate(translationDelta); + } + if (this._manipulationProcessor.scaleDelta != 0) { + const distance2 = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; + camera2.zoom(distance2, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + if (this._manipulationProcessor.twistDelta != 0) { + camera2.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + } + if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { + const camera2 = this._core.camera; + const renderer = this._core.renderer; + if (renderer.isCapturingPickImage) { + camera2.updatePickVMatrix(renderer.width / 2, renderer.height / 2); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + this._pickedTime = 0; + } else if (this._pointers.hoverId > -1) { + const pickingX = this._pointers.hoverX; + const pickingY = this._pointers.hoverY; + camera2.updatePickVMatrix(pickingX, pickingY); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + if (this._pickedId != renderer.pickedId) { + this._pickedId = renderer.pickedId; + this._pickedTime = 0; + } else { + if (this._manipulationProcessor.count == 1) { + this._pickedTime += elapsedTime; + for (const key2 in this._manipulators) { + this._manipulator = this._manipulators[key2]; + break; + } + } + } + if (this._pickedTime > 0) { + switch (renderer.pickedType) { + case PickType.data: + if (this._pickedTime > this.pickHoldDelay) { + renderer.getVertexPosition(this._vec3, this._pickedId); + this._core.setModelManipulationOrigin(this._vec3); + this._pickedTime = 0; + } else if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.transitionBuffers.length; i++) { + const transitionBuffer = renderer.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + transitionBuffer: i, + id: id2, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); + if (this.pickItemCallback) { + this.pickItemCallback(result); + } + break; + } + } } - this._offset[1] -= maxGlyphTop / 2; - this._offset[2] = offsetZ; - let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; - let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; - let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; - if (this._reverseX) positionX = this.minBoundsX + this.maxBoundsX - positionX; - if (this._reverseY) positionY = this.minBoundsY + this.maxBoundsY - positionY; - if (this._reverseZ) positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; - (0, _glMatrix.vec3).set(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); - if (this._rotations) (0, _glMatrix.quat).set(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = i; - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, this._vec3, scale, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); - glyphs += text.length; - if (glyphs >= this._maxGlyphs) { - glyphs = this._maxGlyphs; - break; + this._pickedTime = 0; + } + break; + case PickType.label: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.labelSets.length; i++) { + const labelSet = renderer.labelSets[i].label; + const id2 = labelSet.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + label: id2, + set: i, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); + if (this.pickLabelSetCallback) { + this.pickLabelSetCallback(result); + } + break; + } + } } - } - this._indexCount = glyphs * 6; - this._core.log.write((0, _mainJs.LogLevel).info, `label set updated ${Math.round(window.performance.now() - start)}ms`); - if (this.hasChangedCallback) this.hasChangedCallback(); - } + this._pickedTime = 0; + } + break; + case PickType.axesDivision: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickGridLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickGrid(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); + if (this.pickAxesGridCallback) { + this.pickAxesGridCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesTitle: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickTitleLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickTitle(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); + if (this.pickAxesTitleCallback) { + this.pickAxesTitleCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesLabel: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickLabelLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickLabel(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); + if (this.pickAxesLabelCallback) { + this.pickAxesLabelCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesHeading: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickHeadingLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickHeading(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); + if (this.pickAxesHeadingCallback) { + this.pickAxesHeadingCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + } + } + } else { + renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } else { + this._core.renderer.isPickingEnabled = false; + this._pickedTime = 0; } + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); + this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); + } } -} -class TransitionLabelSet { - constructor(core){ - this._core = core; - this._vec2 = (0, _glMatrix.vec2).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._quat = (0, _glMatrix.quat).create(); - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this._topLeft = (0, _glMatrix.vec3).create(); - this._topRight = (0, _glMatrix.vec3).create(); - this._bottomLeft = (0, _glMatrix.vec3).create(); - this._bottomRight = (0, _glMatrix.vec3).create(); - this._offset = (0, _glMatrix.vec3).create(); - } - update(buffer, labelIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.text.length : options.count; - const dataView = buffer.dataView; - const minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - const minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - const minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - const maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - const maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - const maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - const positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - const positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - const positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - const offsetX = options.offsetX ? options.offsetX : 0; - const offsetY = options.offsetY ? options.offsetY : 0; - const offsetZ = options.offsetZ ? options.offsetZ : 0; - const offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - const offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - const offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const scale = options.scale ? options.scale : 1; - const scalesScaling = options.scalesScaling ? options.scalesScaling : 1; - const font = options.font || this._core.font; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const modelSizeX = maxBoundsX - minBoundsX; - const modelSizeY = maxBoundsY - minBoundsY; - const modelSizeZ = maxBoundsZ - minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (minBoundsX + maxBoundsX) / 2; - const modelOriginY = (minBoundsY + maxBoundsY) / 2; - const modelOriginZ = (minBoundsZ + maxBoundsZ) / 2; - if (options.rotation) { - this._quat[0] = options.rotation[0]; - this._quat[1] = options.rotation[1]; - this._quat[2] = options.rotation[2]; - this._quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(this._quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - this.pickIdLookup = {}; - for(let i = 0; i < count; i++){ - const labelIndex = labelIds[i + offset]; - const _offsetX = (options.offsetsX ? options.offsetsX[labelIndex] / 2 : offsetX) * boundsScaling * offsetScalingX; - const _offsetY = (options.offsetsY ? options.offsetsY[labelIndex] / 2 : offsetY) * boundsScaling * offsetScalingY; - const _offsetZ = (options.offsetsZ ? options.offsetsZ[labelIndex] / 2 : offsetZ) * boundsScaling * offsetScalingZ; - const label = options.text[labelIndex]; - const _scale = (options.scales ? options.scales[labelIndex] * scalesScaling : scale) * boundsScaling / font.size; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width * _scale; - const lineHeight = font.size * _scale; - const _maxGlyphTop = (options.maxGlyphTop ? options.maxGlyphTop : this._textMetric.maxTop) * _scale; - const _horizontalAlignment = options.horizontalAlignments ? options.horizontalAlignments[labelIndex] : horizontalAlignment; - switch(_horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = _offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = _offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = _offsetX - width; - break; - } - const _verticalAlignment = options.verticalAlignments ? options.verticalAlignments[labelIndex] : verticalAlignment; - switch(_verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = _offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = _offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = _offsetY + lineHeight / 2; - break; - } - this._offset[1] -= _maxGlyphTop / 2; - this._offset[2] = _offsetZ; - let positionX = options.positionsX ? options.positionsX[labelIndex] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[labelIndex] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[labelIndex] * positionScalingZ : 0; - if (options.reverseX) positionX = minBoundsX + maxBoundsX - positionX; - if (options.reverseY) positionY = minBoundsY + maxBoundsY - positionY; - if (options.reverseZ) positionZ = minBoundsZ + maxBoundsZ - positionZ; - positionX = (positionX - modelOriginX) * boundsScaling; - positionY = (positionY - modelOriginY) * boundsScaling; - positionZ = (positionZ - modelOriginZ) * boundsScaling; - if (options.rotations) (0, _glMatrix.quat).set(this._quat, options.rotations[labelIndex * 4], options.rotations[labelIndex * 4 + 1], options.rotations[labelIndex * 4 + 2], options.rotations[labelIndex * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = labelIndex; - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[labelIndex], minOrder, maxOrder, 0, 1); - this._vec2[0] = orderReverse ? 1 - order : order; - } else this._vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) this._vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[labelIndex], minStaggerOrder, maxStaggerOrder, 0, 1); - this._vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else this._vec2[1] = count == 1 ? 0 : i / (count - 1); - let glyphIndex = options.glyphOffsets[labelIndex]; - for (const char of label){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const width = glyph.width * _scale; - const height = glyph.height * _scale; - const top = glyph.top * _scale; - const border = font.border * _scale; - const x0 = this._offset[0] - border; - const x1 = this._offset[0] + width + border; - const y0 = this._offset[1] + top + border; - const y1 = this._offset[1] + top - height - border; - const z0 = this._offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (options.rotation || options.rotations) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, this._quat); - } - (0, _vertexJs.UnitVertex).setRotation(dataView, glyphIndex, this._quat); - this._vec3[0] = positionX + (this._topLeft[0] + this._bottomRight[0]) / 2; - this._vec3[1] = positionY + (this._topLeft[1] + this._bottomRight[1]) / 2; - this._vec3[2] = positionZ + (this._topLeft[2] + this._bottomRight[2]) / 2; - (0, _vertexJs.UnitVertex).setTranslation(dataView, glyphIndex, this._vec3); - this._vec3[0] = Math.abs(x1 - x0); - this._vec3[1] = Math.abs(y1 - y0); - this._vec3[2] = 0.001; - (0, _vertexJs.UnitVertex).setScale(dataView, glyphIndex, this._vec3); - this._vec4[0] = glyph.u0; - this._vec4[1] = glyph.v0; - this._vec4[2] = glyph.u1; - this._vec4[3] = glyph.v1; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, glyphIndex, this._vec4); - (0, _vertexJs.UnitVertex).setIdHover(dataView, glyphIndex, options.hover ? options.hover[labelIndex] : labelIndex); - (0, _vertexJs.UnitVertex).setOrder(dataView, glyphIndex, this._vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, glyphIndex, options.material ? options.material : options.materials ? options.materials[labelIndex] : 0); - (0, _vertexJs.UnitVertex).setTexture(dataView, glyphIndex, 1); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, glyphIndex, this._core.config.sdfBuffer); - this._offset[0] += glyph.advance * _scale; - glyphIndex++; - } + } + class Log { + constructor(core) { + this._core = core; + } + write(level, value2) { + if (level >= this._core.config.logLevel) { + switch (level) { + case LogLevel.trace: + console.trace(value2); + break; + case LogLevel.debug: + console.debug(value2); + break; + case LogLevel.info: + console.info(value2); + break; + case LogLevel.warn: + console.warn(value2); + break; + case LogLevel.error: + console.error(value2); + break; } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../helpers/text.js":"keNgB","../constants.js":"dHTsY","../vertex.js":"8lW8V","../helpers/pick.js":"fOypM","../helpers/math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eexvE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -parcelHelpers.export(exports, "ImageBase", ()=>ImageBase); -parcelHelpers.export(exports, "ImageQuad", ()=>ImageQuad); -parcelHelpers.export(exports, "ImageSphere", ()=>ImageSphere); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -var _sphereJs = require("../meshes/sphere.js"); -var _constantsJs = require("../constants.js"); -class ImageVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(image){ - this.image = image; - } -} -class ImageBase { - get material() { - return this._material; + } } - get vertices() { - return this._vertices; + } + var __awaiter$4 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - get indices() { - return this._indices; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Core { + get container() { + return this._container; } - get indexCount() { - return this._indexCount; + get started() { + return this._started; } - get isInitialized() { - return this._isInitialized; + get debugText() { + return this._debugText; } - get mMatrix() { - return this._mMatrix; + get log() { + return this._log; } - get imageData() { - return this._imageData; + get totalFrames() { + return this._fps.totalFrames; } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._hasChanged = true; - } + get camera() { + return this._camera; } - get rotation() { - return this._rotation; + set camera(value2) { + this._camera = value2; } - set rotation(value) { - if (!(0, _glMatrix.quat).equals(this._rotation, value)) { - (0, _glMatrix.quat).copy(this._rotation, value); - this._hasChanged = true; - } + getModelRotation(value2) { + copy$1(value2, this._modelRotation); } - get position() { - return this._position; + setModelRotation(value2, isSmooth) { + copy$1(this._modelRotation, value2); + if (!isSmooth) { + copy$1(this._smoothedModelRotation, this._modelRotation); + } } - set position(value) { - if (!(0, _glMatrix.vec3).equals(this._position, value)) { - (0, _glMatrix.vec3).copy(this._position, value); - this._hasChanged = true; - } + getModelScale() { + return this._modelScale[0]; } - get texCoord0() { - return this._texCoord0; + setModelScale(value2, isSmooth) { + set$3(this._modelScale, value2, value2, value2); + if (!isSmooth) { + copy$3(this._smoothedModelScale, this._modelScale); + } } - set texCoord0(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord0, value)) { - (0, _glMatrix.vec2).copy(this._texCoord0, value); - this._hasChanged = true; - } + getModelManipulationOrigin(value2) { + copy$3(value2, this._modelManipulationOrigin); } - get texCoord1() { - return this._texCoord1; + setModelManipulationOrigin(value2) { + this._updateManipulationOrigin(value2); } - set texCoord1(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord1, value)) { - (0, _glMatrix.vec2).copy(this._texCoord1, value); - this._hasChanged = true; - } + getModelPosition(value2) { + copy$3(value2, this._modelPosition); } - get minBoundsX() { - return this._minBoundsX; + setModelPosition(value2, isSmooth) { + copy$3(this._modelPosition, value2); + if (!isSmooth) { + copy$3(this._smoothedModelPosition, this._modelPosition); + } } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; - } + get webXRSession() { + return this._webXRSession; } - get minBoundsY() { - return this._minBoundsY; + get renderer() { + return this._renderer; } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; - } + set renderer(renderer) { + if (this._renderer == renderer) { + return; + } + if (this._renderer) { + this.stop(); + this._renderer.remove(); + } + if (!renderer.isInitialized) { + renderer.initialize(this); + } + if (this._renderer) { + renderer.transitionTime = this._renderer.transitionTime; + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const previousTransitionBuffer = this._renderer.transitionBuffers[i]; + const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); + transitionBuffer.copyFrom(previousTransitionBuffer); + renderer.transitionBuffers.push(transitionBuffer); + } + const currentAxes = this._renderer.currentAxes; + if (currentAxes) { + renderer.currentAxes = []; + for (let i = 0; i < currentAxes.length; i++) { + const axesVisual = currentAxes[i]; + const axes = axesVisual.axes; + if (axes instanceof Cartesian3dAxes) { + const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); + renderer.currentAxes.push(cartesian3dAxesVisual); + } else if (axes instanceof Cartesian2dAxes) { + renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); + } + } + } + const labelSets = this._renderer.labelSets; + if (labelSets) { + renderer.labelSets = []; + for (let i = 0; i < labelSets.length; i++) { + renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); + } + } + const images = this._renderer.images; + if (images) { + renderer.images = []; + for (let i = 0; i < images.length; i++) { + renderer.images.push(renderer.createImageVisual(images[i].image)); + } + } + const fonts = this._renderer.fonts; + if (fonts) { + for (const key2 in fonts) { + const font2 = fonts[key2].font; + renderer.fonts[font2.name] = renderer.createFontVisual(font2); + } + } + } else { + renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); + } + if (this._renderer) { + this._renderer.finalize(); + } + this._renderer = renderer; + this._fps.reset(); + this.start(); } - get minBoundsZ() { - return this._minBoundsZ; + get font() { + return this._font; } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } + get paletteResources() { + return this._paletteResources; } - get maxBoundsX() { - return this._maxBoundsX; + get config() { + return this._config; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + get inputManager() { + return this._inputManager; + } + constructor(options) { + setMatrixArrayType(Array); + this._vec3 = create$3(); + this._quat = create$1(); + this._mat4 = create$4(); + this._container = options && options.container ? options.container : document.body; + this._config = new Config$2(this); + this._log = new Log(this); + this._debugText = new DebugText(); + this._inputManager = options && options.useInputManager === false ? null : new Manager(this); + const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { + fontAtlas: new FontAtlas(256, 512), + fontSize: 24, + border: 3, + fontFamily: '"segoe ui semibold", sans-serif', + fontWeight: "normal", + fontStyle: "normal", + baseline: "alphabetic", + maxDistance: 8, + edgeValue: 192 + }; + const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); + this._font = fontRasterizer.font; + this._paletteResources = new PaletteResources(); + this._previousTime = 0; + this._fps = new Fps(this); + this._modelMMatrix = create$4(); + this._modelPosition = create$3(); + this._modelRotation = create$1(); + this._modelScale = create$3(); + this._smoothedModelPosition = create$3(); + this._smoothedModelRotation = create$1(); + this._smoothedModelScale = create$3(); + this._modelManipulationOrigin = create$3(); + this._camera = new AltAzimuthCamera(this); + this.resetModel(false); } - get maxBoundsY() { - return this._maxBoundsY; + getView(view) { + this.getModelPosition(view.position); + this.getModelRotation(view.rotation); + view.scale = this.getModelScale(); } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } + setView(view, isSmooth) { + this.setModelPosition(view.position, isSmooth); + this.setModelRotation(view.rotation, isSmooth); + this.setModelScale(view.scale, isSmooth); } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._origin = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._scale = (0, _glMatrix.vec3).create(); - this._transform = (0, _glMatrix.mat4).create(); - this._imageData = options.imageData; - this._minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - this._minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - this._minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - this._maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - this._maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - this._maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - this._position = options.position ? (0, _glMatrix.vec3).clone(options.position) : (0, _glMatrix.vec3).create(); - this._rotation = options.rotation ? (0, _glMatrix.quat).clone(options.rotation) : (0, _glMatrix.quat).create(); - this._texCoord0 = options.texCoord0 ? (0, _glMatrix.vec2).clone(options.texCoord0) : (0, _glMatrix.vec2).fromValues(0, 0); - this._texCoord1 = options.texCoord1 ? (0, _glMatrix.vec2).clone(options.texCoord1) : (0, _glMatrix.vec2).fromValues(1, 1); - this._material = options.material === undefined ? -1 : options.material; - this._hasChanged = true; + lerpView(from, to, time2) { + lerp(this._vec3, from.position, to.position, time2); + this.setModelPosition(this._vec3, false); + slerp(this._quat, from.rotation, to.rotation, time2); + this.setModelRotation(this._quat, false); + this.setModelScale(MathHelper.lerp(from.scale, to.scale, time2), false); } -} -class ImageQuad extends ImageBase { - get width() { - return this._width; + resetModel(isSmooth) { + set$3(this._modelPosition, 0, 0, -this._config.modelDistance); + set$3(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); + set$1(this._modelRotation, 0, 0, 0, 1); + if (!isSmooth) { + this._syncSmooth(); + } } - set width(value) { - if (this._width != value) { - this._width = value; - this._hasChanged = true; - } + resetManipulationOrigin() { + if (!exactEquals$1(this._modelManipulationOrigin, Constants.VECTOR3_ZERO)) { + this._updateManipulationOrigin(Constants.VECTOR3_ZERO); + } } - get height() { - return this._height; + reset(isSmooth) { + this.resetModel(isSmooth); + this.resetManipulationOrigin(); + this._camera.reset(isSmooth); } - set height(value) { - if (this._height != value) { - this._height = value; - this._hasChanged = true; + start() { + if (!this._started && this._renderer) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + this._started = true; + this._log.write(LogLevel.info, "render loop started"); + if (this.startCallback) { + this.startCallback(); } + } } - constructor(core, options){ - super(core, options); - this._width = options.width === undefined ? 1 : options.width; - this._height = options.height === undefined ? 1 : options.height; - this._texTransform = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).translate(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(0, 1, 0)); - (0, _glMatrix.mat4).scale(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(1, -1, 1)); + stop() { + if (this._started) { + this._started = false; + if (this._windowAnimationFrame != null) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + this._log.write(LogLevel.info, "render loop stopped"); + } + if (this.stopCallback) { + this.stopCallback(); + } + } } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * 4); - this._indices = (0, _quadJs.Quad).INDICES; - this._indexCount = this._indices.length; - this._isInitialized = true; + checkWebXRSupport() { + const xrSystem = navigator.xr; + if (xrSystem) { + xrSystem.isSessionSupported("immersive-vr").then((supported) => { + if (supported) { + this._log.write(LogLevel.info, "WebXR supported"); + if (this.webXRSupportedCallback) { + this.webXRSupportedCallback(); + } + } + }); + } } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(this._translation, this._position, this._origin); - (0, _glMatrix.vec3).scale(this._translation, this._translation, boundsScaling); - (0, _glMatrix.vec3).set(this._scale, this._width, this._height, 1); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); - this._verticesView = (0, _quadJs.Quad).normalTextured(this._transform, this._texTransform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} -class ImageSphere extends ImageBase { - get radius() { - return this._radius; - } - set radius(value) { - if (this._radius != value) { - this._radius = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._radius = options.radius === undefined ? 0.5 : options.radius; - this._slices = options.slices === undefined ? 72 : options.slices; - this._stacks = options.stacks === undefined ? 36 : options.stacks; + requestWebXRSession() { + if (this._webXRSession) { + this._webXRSession.end(); + } else { + navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); + } } - initialize() { - this._sphere = new (0, _sphereJs.Sphere)(this._core); - this._vertices = this._sphere.normalTextured(this._slices, this._stacks, (0, _constantsJs.Constants).MAT4_IDENTITY).buffer; - this._indices = this._sphere.indices(this._slices, this._stacks); - this._indexCount = this._indices.length; - this._isInitialized = true; + _webXRSessionStarted(session) { + if (this.webXRSessionStartedCallback) { + this.webXRSessionStartedCallback(); + } + this._webXRSession = session; + session.onend = () => this._webXRSessionEnded(); + this._renderer.initializeWebXR(session).then(() => { + if (this._windowAnimationFrame) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + } + session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + }); + session.oninputsourceschange = (event2) => this._webXRInputSourcesChanged(event2); } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).set(this._scale, this._radius, this._radius, this._radius); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._transform, this._rotation, this._position, this._scale, this._origin); - this._verticesView = this._sphere.normalTextured(this._slices, this._stacks, this._transform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"erHGu","../vertex.js":"8lW8V","../meshes/quad.js":"6dxCM","../meshes/sphere.js":"2nvcG","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2nvcG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sphere", ()=>Sphere); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _vertexJs = require("../vertex.js"); -class Sphere { - constructor(core){} - positions(slices, stacks, transform) { - const vertices = new Float32Array((slices + 1) * (stacks + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++){ - const latitude = 90 - 180 * stack / stacks; - for(let slice = 0; slice <= slices; slice++){ - const longitude = 360 * slice / slices - 180; - (0, _angleJs.AngleHelper).sphericalToCartesian(1, longitude, latitude, position); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - } - return vertices; - } - indices(slices, stacks) { - const indices = new Uint16Array(slices * stacks * 6); - let index = 0; - for(let stack = 0; stack < stacks; stack++){ - const top = stack * (slices + 1); - const bottom = (stack + 1) * (slices + 1); - for(let slice = 0; slice < slices; slice++){ - if (stack != 0) { - indices[index++] = top + slice; - indices[index++] = bottom + slice; - indices[index++] = top + slice + 1; - } - if (stack != stacks - 1) { - indices[index++] = top + slice + 1; - indices[index++] = bottom + slice; - indices[index++] = bottom + slice + 1; - } - } + _webXRSessionEnded() { + if (this.webXRSessionEndedCallback) { + this.webXRSessionEndedCallback(); + } + this._webXRSession = null; + this._renderer.controllers.length = 0; + this.start(); + } + _webXRInputSourcesChanged(event2) { + if (event2.added.length > 0) { + const added = event2.added[0]; + if (added.targetRayMode == "tracked-pointer") { + const profiles = added.profiles; + const handedness = added.handedness; + if (this.webXRInputSourceRequestCallback) { + this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { + const options = { + profiles, + handedness, + obj: response.obj, + texture: response.texture + }; + const controller = new Controller(this, options); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + }, (e) => { + this._log.write(LogLevel.error, e); + }); + } else { + const options = {}; + const controller = new Controller(this, options); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + } } - return indices; - } - textured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - normalTextured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal = (0, _glMatrix.vec3).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - (0, _glMatrix.vec3).set(normal, position[0] - transform[12], position[1] - transform[13], position[2] - transform[14]); - (0, _glMatrix.vec3).normalize(normal, normal); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal); - } - return verticesView; - } - _texCoords(slices, stacks, transform) { - const texCoords = new Float32Array((slices + 1) * (stacks + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++)for(let slice = 0; slice <= slices; slice++){ - (0, _glMatrix.vec2).set(texCoord, slice / slices, stack / stacks); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/angle.js":"hBXkO","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6qIGL":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyVisual", ()=>KeyVisual); -parcelHelpers.export(exports, "KeyBase", ()=>KeyBase); -parcelHelpers.export(exports, "NominalKey", ()=>NominalKey); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _scatterJs = require("../layouts/scatter.js"); -var _mathJs = require("../helpers/math.js"); -var _labelsJs = require("./labels.js"); -class KeyVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(key){ - this.key = key; - } -} -class KeyBase { - get isInitialized() { - return this._isInitialized; - } - get minBoundsX() { - return this._minBoundsX; + } + if (event2.removed.length > 0) { + this.renderer.controllers.length = 0; + } } - set minBoundsX(value) { - if (value != this.minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; + _tick(currentTime, xrFrame) { + return __awaiter$4(this, void 0, void 0, function* () { + let elapsedTime = currentTime - this._previousTime; + this._previousTime = currentTime; + if (elapsedTime > 0) { + this.update(elapsedTime, xrFrame); + yield this.render(elapsedTime, xrFrame); + } + if (xrFrame) { + xrFrame.session.requestAnimationFrame((currentTime2, xrframe) => this._tick(currentTime2, xrframe)); + } else if (this._started) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime2) => this._tick(currentTime2)); } + }); } - get maxBoundsX() { - return this._maxBoundsX; + update(elapsedTime, xrFrame) { + this._renderer.setSize(elapsedTime); + if (this.updateCallback) { + this.updateCallback(elapsedTime, xrFrame); + } + if (this._config.isDebugVisible) { + this._debugText.clear(); + } + this._fps.update(elapsedTime); + if (this._inputManager) { + this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; + this._inputManager.update(elapsedTime, xrFrame); + } + let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); + lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); + amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); + slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); + amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); + lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); + fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); + this._renderer.mMatrix = this._modelMMatrix; + if (this._config.isDebugVisible) { + this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); + this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); + this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); + this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); + this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); + this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); + this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); + } + if (!xrFrame) { + this._camera.width = this._renderer.width; + this._camera.height = this._renderer.height; + this._camera.modelMMatrix = this._modelMMatrix; + this._camera.modelPosition = this._smoothedModelPosition; + this._camera.modelRotation = this._smoothedModelRotation; + this._camera.modelScale = this._smoothedModelScale; + this._camera.modelManipulationOrigin = this._modelManipulationOrigin; + this._camera.update(elapsedTime); + this._renderer.vMatrices = this._camera.vMatrices; + this._renderer.mvMatrices = this._camera.mvMatrices; + this._renderer.pMatrices = this._camera.pMatrices; + this._renderer.inverseVMatrices = this._camera.inverseVMatrices; + this._renderer.inversePMatrices = this._camera.inversePMatrices; + } + this._renderer.prepare(xrFrame); + if (!xrFrame && this._config.stereoMode == StereoMode.none) { + this._renderer.pickPMatrix = this._camera.pMatrices[0]; + } else { + const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); + perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); + this._renderer.pickPMatrix = this._mat4; + } + if (this._renderer.isInitialized) { + this._renderer.update(elapsedTime); + } } - set maxBoundsX(value) { - if (value != this.minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; + render(elapsedTime, xrFrame) { + return __awaiter$4(this, void 0, void 0, function* () { + this._fps.render(); + if (this._renderer.isInitialized) { + yield this._renderer.render(elapsedTime, xrFrame); + if (this.afterRenderCallback) { + this.afterRenderCallback(); + } } + }); } - get minBoundsY() { - return this._minBoundsY; + _syncSmooth() { + copy$3(this._smoothedModelPosition, this._modelPosition); + copy$3(this._smoothedModelScale, this._modelScale); + copy$1(this._smoothedModelRotation, this._modelRotation); + } + _updateManipulationOrigin(position2) { + this._log.write(LogLevel.info, `manipulation origin ${position2[0].toFixed(3)},${position2[1].toFixed(3)},${position2[2].toFixed(3)}`); + this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position2); + copy$3(this._modelManipulationOrigin, position2); + transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); + subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); + copy$3(this._smoothedModelPosition, this._modelPosition); + if (this.manipulationOriginChangedCallback) { + const result = { + x: position2[0], + y: position2[1], + z: position2[2] + }; + this.manipulationOriginChangedCallback(result); + } } - set minBoundsY(value) { - if (value != this.minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; + pickLasso(x02, y02, x12, y12, pickType) { + const inverseMMatrix = create$4(); + invert(inverseMMatrix, this._modelMMatrix); + const sets = []; + const nearPositions = [create$3(), create$3(), create$3(), create$3()]; + const farPositions = [create$3(), create$3(), create$3(), create$3()]; + const directions = [create$3(), create$3(), create$3(), create$3()]; + this._camera.unproject(nearPositions[0], x02, y12, -1); + this._camera.unproject(farPositions[0], x02, y12, 1); + this._camera.unproject(nearPositions[1], x12, y12, -1); + this._camera.unproject(farPositions[1], x12, y12, 1); + this._camera.unproject(nearPositions[2], x12, y02, -1); + this._camera.unproject(farPositions[2], x12, y02, 1); + this._camera.unproject(nearPositions[3], x02, y02, -1); + this._camera.unproject(farPositions[3], x02, y02, 1); + for (let i = 0; i < 4; i++) { + transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); + transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); + subtract(directions[i], farPositions[i], nearPositions[i]); + normalize$2(directions[i], directions[i]); + } + const normals = [create$3(), create$3(), create$3(), create$3()]; + const d = []; + for (let i = 0; i < 4; i++) { + cross(normals[i], directions[(i + 1) % 4], directions[i]); + normalize$2(normals[i], normals[i]); + d.push(-dot$1(normals[i], nearPositions[i])); + } + if (pickType == PickType.data) { + const translation = create$3(); + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const transitionBuffer = this._renderer.transitionBuffers[i]; + const set2 = /* @__PURE__ */ new Set(); + if (transitionBuffer.isVisible) { + const start = window.performance.now(); + const currentBuffer = transitionBuffer.currentBuffer; + const lookup2 = currentBuffer.lookup; + for (let j = 0; j < currentBuffer.length; j++) { + const id2 = currentBuffer.ids[j]; + const index2 = lookup2[id2]; + if (index2 != null) { + UnitVertex.getTranslation(currentBuffer.dataView, index2, translation); + let isInside = true; + for (let k = 0; k < 4; k++) { + let distance2 = dot$1(normals[k], translation); + distance2 += d[k]; + if (distance2 < 0) { + isInside = false; + break; + } + } + if (isInside) { + set2.add(id2); + } + } + } + if (set2.size > 0) { + this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set2.size} ${Math.round(window.performance.now() - start)}ms`); + } + } + sets.push(set2); } + } + return sets; } - get maxBoundsY() { - return this._maxBoundsY; + } + const StereoMode = { + none: "none", + split: "split", + anaglyph: "anaglyph", + left: "left", + right: "right" + }; + const HorizontalAlignment = { + left: "left", + center: "center", + right: "right" + }; + const VerticalAlignment = { + top: "top", + center: "center", + bottom: "bottom" + }; + const AxesTextOrientation = { + parallel: "parallel", + perpendicular: "perpendicular" + }; + const AxesVisibility = { + none: "none", + current: "current", + previous: "previous" + }; + const PickType = { + none: 0, + data: 1, + label: 2, + axesDivision: 3, + axesTitle: 4, + axesLabel: 5, + axesHeading: 6 + }; + const Theme = { + dark: "dark", + light: "light" + }; + const HighlightMode = { + luminance: "luminance", + color: "color" + }; + const UnitType = { + block: "block", + blockSdf: "blockSdf", + sphere: "sphere", + sphereSdf: "sphereSdf", + cylinder: "cylinder", + cylinderSdf: "cylinderSdf", + hexPrism: "hexPrism", + hexPrismSdf: "hexPrismSdf", + sdf: "sdf", + disk: "disk", + ringSdf: "ringSdf" + }; + const SingleTouchAction = { + translate: "translate", + rotate: "rotate", + lasso: "lasso" + }; + const MouseWheelAction = { + zoom: "zoom", + rotateY: "rotateY" + }; + const LogLevel = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4 + }; + const Edge3D = { + topFront: 0, + topRight: 1, + topBack: 2, + bottomRight: 5, + frontRight: 8, + backRight: 9 + }; + const RenderMode = { + color: "color" + }; + let LabelSetVisual$2 = class LabelSetVisual { + render(elapsedTime, xrFrame) { } - set maxBoundsY(value) { - if (value != this.minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + update(elapsedTime) { } - get minBoundsZ() { - return this._minBoundsZ; + constructor(labelSet) { + this.label = labelSet; } - set minBoundsZ(value) { - if (value != this.minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } + }; + class LabelBase { + get material() { + return this._material; } - get maxBoundsZ() { - return this._maxBoundsZ; + get vertices() { + return this._vertices; } - set maxBoundsZ(value) { - if (value != this.minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + get verticesView() { + return this._verticesView; } - get unitType() { - return this._unitType; + get indices() { + return this._indices; } - set unitType(value) { - if (this._unitType != value) { - this._unitType = value; - this._hasChanged = true; - } + get indexCount() { + return this._indexCount; } - get palette() { - return this._palette; + get isInitialized() { + return this._isInitialized; } - set palette(value) { - if (this._palette != value) { - this._palette = value; - this._hasChanged = true; - } + get mMatrix() { + return this._mMatrix; } - get materials() { - return this._materials; + get materialType() { + return this._materialType; } - set materials(value) { - if (this._materials != value) { - this._materials = value; - this._hasChanged = true; - } + get materialColor() { + return this._materialColor; } - get sizesX() { - return this._sizesX; + get materialFuzz() { + return this._materialFuzz; } - set sizesX(value) { - if (this._sizesX != value) { - this._sizesX = value; - this._hasChanged = true; - } + get materialGloss() { + return this._materialGloss; } - get sizesY() { - return this._sizesY; + get segmentColor() { + return this._segmentColor; } - set sizesY(value) { - if (this._sizesY != value) { - this._sizesY = value; - this._hasChanged = true; - } + get scale() { + return this._scale; } - get sizesZ() { - return this._sizesZ; + set scale(value2) { + if (this._scale != value2) { + this._scale = value2; + this._hasChanged = true; + } } - set sizesZ(value) { - if (this._sizesZ != value) { - this._sizesZ = value; - this._hasChanged = true; - } + get font() { + return this._font; } - get spacing() { - return this._spacing; + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } - set spacing(value) { - if (this._spacing != value) { - this._spacing = value; - this._hasChanged = true; - } + get rotation() { + return this._rotation; } - get textVertices() { - return this._textVertices; + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._hasChanged = true; + } } - get textIndices() { - return this._textIndices; + set reverseX(value2) { + if (this._reverseX != value2) { + this._reverseX = value2; + this._hasChanged = true; + } } - get labelMMatrix() { - return this._labelMMatrix; + set reverseY(value2) { + if (this._reverseY != value2) { + this._reverseY = value2; + this._hasChanged = true; + } } - set labelPositions(value) { - if (this._labelPositions != value) { - this._labelPositions = value; - this._hasChanged = true; - } + set reverseZ(value2) { + if (this._reverseZ != value2) { + this._reverseZ = value2; + this._hasChanged = true; + } } - set labels(value) { - if (this._labels != value) { - this._labels = value; - this._hasChanged = true; - } + get horizontalAlignment() { + return this._horizontalAlignment; } - set labelSize(value) { - if (this._labelSize != value) { - this._labelSize = value; - this._hasChanged = true; - } + set horizontalAlignment(value2) { + if (this._horizontalAlignment != value2) { + this._horizontalAlignment = value2; + this._hasChanged = true; + } } - get labelOrientation() { - return this._orientation; + get verticalAlignment() { + return this._verticalAlignment; } - set labelOrientation(value) { - if (this._orientation != value) { - this._orientation = value; - this._hasChanged = true; - } + set verticalAlignment(value2) { + if (this._verticalAlignment != value2) { + this._verticalAlignment = value2; + this._hasChanged = true; + } } - get titleIndexCount() { - return this._titleIndexCount; + get offsetX() { + return this._offsetX; } - get titleIndexOffset() { - return this._titleIndexOffset; + set offsetX(value2) { + if (this._offsetX != value2) { + this._offsetX = value2; + this._hasChanged = true; + } } - get titleMMatrix() { - return this._titleMMatrix; + get offsetY() { + return this._offsetY; } - set title(value) { - if (this._title != value) { - this._title = value; - this._hasChanged = true; - } + set offsetY(value2) { + if (this._offsetY != value2) { + this._offsetY = value2; + this._hasChanged = true; + } } - set titleSize(value) { - if (this._titleSize != value) { - this._titleSize = value; - this._hasChanged = true; - } + get offsetZ() { + return this._offsetZ; } - constructor(core, options){ - this._core = core; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; + set offsetZ(value2) { + if (this._offsetZ != value2) { + this._offsetZ = value2; + this._hasChanged = true; + } } - initialize() { - this._isInitialized = true; + get maxGlyphTop() { + return this._maxGlyphTop; } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._size[0], this._size[1]), this._size[2]); - (0, _glMatrix.vec3).scale(this._size, this._size, 1 / maxBounds); - this._update(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `key updated ${Math.round(window.performance.now() - start)}ms`); - } - } + set maxGlyphTop(value2) { + if (this._maxGlyphTop != value2) { + this._maxGlyphTop = value2; + this._hasChanged = true; + } } - _update(size) {} -} -class NominalKey extends KeyBase { - constructor(core, options){ - super(core, options); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 0 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 0 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 0 : options.maxBoundsZ; - const positionX = options.positionX === undefined ? 0 : options.positionX; - const positionY = options.positionY === undefined ? 0 : options.positionY; - const positionZ = options.positionZ === undefined ? 0 : options.positionZ; - const sizeX = options.sizeX === undefined ? 1 : options.sizeX; - const sizeY = options.sizeY === undefined ? 1 : options.sizeY; - const sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - const spacing = options.spacing === undefined ? 1 : options.spacing; - const labelScale = options.labelScale === undefined ? 1 : options.labelScale; - const labelMaxGlyphs = options.labelMaxGlyphs === undefined ? this._core.config.keyLabelMaxGlyphs : options.labelMaxGlyphs; - const titleScale = options.titleScale === undefined ? 1 : options.titleScale; - const titleMaxGlyphs = options.titleMaxGlyphs === undefined ? this._core.config.keyTitleMaxGlyphs : options.titleMaxGlyphs; - const font = options.font ? options.font : this._core.font; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const orientation = options.orientation === undefined ? (0, _mainJs.Orientation).horizontal : options.orientation; - const labelPosition = options.labelPosition === undefined ? (0, _mainJs.Edge2D).right : options.labelPosition; - const labelOrientation = options.labelOrientation === undefined ? (0, _mainJs.Orientation).horizontal : options.labelOrientation; - const rotation = (0, _glMatrix.quat).create(); - let count = options.values.length; - const ids = new Uint32Array(count); - let minValue = Number.MAX_VALUE; - let maxValue = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - ids[i] = i; - const value = options.values[i]; - minValue = Math.min(minValue, value); - maxValue = Math.max(maxValue, value); - } - const materialIds = new Uint32Array(count); - for(let i = 0; i < count; i++)materialIds[i] = (0, _mathJs.MathHelper).normalize(options.values[i], minValue, maxValue, 0, options.palette.length / 4 - 1); - let glyphCount = 0; - let totalLabelWidth = 0; - let maxLabelWidth = 0; - for(let i = 0; i < count; i++){ - const label = (0, _textJs.TextHelper).truncate(options.labels[i], labelMaxGlyphs); - glyphCount += label.length; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width; - totalLabelWidth += width; - maxLabelWidth = Math.max(width, maxLabelWidth); - } - let titleWidth = 0; - let title; - if (options.title) { - title = (0, _textJs.TextHelper).truncate(options.title, titleMaxGlyphs); - glyphCount += title.length; - (0, _textJs.TextHelper).measure(font, title, this._textMetric); - titleWidth = this._textMetric.width; - } - let width; - let height; - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - case (0, _mainJs.Orientation).vertical: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - } - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - width = Math.max(sizeX * count + spacing * (count - 1) + totalLabelWidth, titleWidth); - height = sizeY; - if (options.title) height += titleScale; - break; - case (0, _mainJs.Orientation).vertical: - width = Math.max(sizeX + labelScale / 2 + maxLabelWidth, titleWidth); - height = sizeY * count + spacing * (count - 1); - if (options.title) height += titleScale; - break; - } - let originX = positionX; - let originY = positionY; - let originZ = positionZ; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).center: - break; - case (0, _mainJs.HorizontalAlignment).left: - originX += width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - originX -= width / 2; - break; - } - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).bottom: - originY += height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - break; - case (0, _mainJs.VerticalAlignment).top: - originY -= height / 2; - break; - } - const positionsX = new Float64Array(count); - const positionsY = new Float64Array(count); - const positionsZ = new Float64Array(count); - for(let i = 0; i < count; i++){ - positionsX[i] = originX - width / 2 + sizeX / 2; - positionsY[i] = originY + height / 2 - i * (sizeY + spacing); - positionsZ[i] = originZ + sizeZ / 2; - } - const scatter = new (0, _scatterJs.Scatter)(this._core); - const scatterLayoutOptions = { - positionsX: positionsX, - positionsY: positionsY, - positionsZ: positionsZ - }; - scatter.layout(this._transitionBuffer.currentBuffer, ids, scatterLayoutOptions); - const scatterVertexOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - colors: options.values, - minColor: minValue, - maxColor: maxValue, - sizeScalingX: sizeX, - sizeScalingY: sizeY, - sizeScalingZ: sizeZ, - materials: materialIds - }; - scatter.update(this._transitionBuffer.currentBuffer, ids, scatterVertexOptions); - const labelSetOptions = { - text: options.labels, - maxGlyphs: glyphCount, - scale: labelScale, - font: font - }; - const labelSet = new (0, _labelsJs.LabelSet)(this._core, labelSetOptions); - if (options.title) count++; - const labelPositionsX = new Float64Array(count); - const labelPositionsY = new Float64Array(count); - const labelPositionsZ = new Float64Array(count); - for(let i = 0; i < (options.title ? count - 1 : count); i++){ - labelPositionsX[i] = originX - width / 2 + sizeX + labelScale / 2; - labelPositionsY[i] = positionsY[i]; - labelPositionsZ[i] = originZ; - } - options.title; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - labelSet.positionsX = positionsX; - labelSet.positionsY = positionsY; - labelSet.positionsZ = positionsZ; - labelSet.rotation = new Float64Array([ - rotation[0], - rotation[1], - rotation[2], - rotation[3] - ]); - labelSet.horizontalAlignment = (0, _mainJs.HorizontalAlignment).left; - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../helpers/text.js":"keNgB","../layouts/scatter.js":"kIsBP","../helpers/math.js":"6Lv1i","./labels.js":"dXJPK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kIsBP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scatter", ()=>Scatter); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Scatter extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[id] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get maxGlyphHeight() { + return this._maxGlyphHeight; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const sizesX = options.sizes ? options.sizes : options.sizesX; - const sizesY = options.sizes ? options.sizes : options.sizesY; - const sizesZ = options.sizes ? options.sizes : options.sizesZ; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - if (options.rotation) { - _quat[0] = options.rotation[0]; - _quat[1] = options.rotation[1]; - _quat[2] = options.rotation[2]; - _quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id]) : 1) * sizeScalingX, minSize) * this._boundsScaling; - _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id]) : 1) * sizeScalingY, minSize) * this._boundsScaling; - _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - if (options.rotations) { - _quat[0] = options.rotations[id * 4]; - _quat[1] = options.rotations[id * 4 + 1]; - _quat[2] = options.rotations[id * 4 + 2]; - _quat[3] = options.rotations[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - } else (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setParameter1(dataView, index, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id] : 0); - (0, _vertexJs.UnitVertex).setParameter2(dataView, index, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id] : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ijsq1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LayoutBase", ()=>LayoutBase); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _boundsJs = require("../helpers/bounds.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class LayoutBase { - get facetScaling() { - return this._facetScaling; + set maxGlyphHeight(value2) { + if (this._maxGlyphHeight != value2) { + this._maxGlyphHeight = value2; + this._hasChanged = true; + } } - offsetX(facetCoordX) { - return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; + constructor(core, options) { + this._core = core; + this._offset = create$3(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mMatrix = create$4(); + this._indexCount = 0; + this._maxGlyphs = options.maxGlyphs; + this._textMetric = { width: 0, maxHeight: 0, maxTop: 0 }; + this.scale = options.scale ? options.scale : 1; + this.offsetX = options.offsetX ? options.offsetX : 0; + this.offsetY = options.offsetY ? options.offsetY : 0; + this.offsetZ = options.offsetZ ? options.offsetZ : 0; + this.reverseX = options.reverseX; + this.reverseY = options.reverseY; + this.reverseZ = options.reverseZ; + this.rotation = options.rotation; + this.maxGlyphTop = options.maxGlyphTop; + this.horizontalAlignment = options.horizontalAlignment === void 0 ? HorizontalAlignment.center : options.horizontalAlignment; + this.verticalAlignment = options.verticalAlignment === void 0 ? VerticalAlignment.center : options.verticalAlignment; + this._material = options.material; + this.borderWidth = core.config.textBorderWidth; + this.gamma = 0; + this._materialType = options.materialType || 0; + this._materialColor = options.materialColor || core.config.textColor; + this._materialFuzz = options.materialFuzz || 0; + this._materialGloss = options.materialGloss || 0; + this._segmentColor = options.segmentColor; } - offsetY(facetCoordY) { - return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; + initialize() { + this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); + this._verticesView = new DataView(this._vertices); + this._indices = new Uint32Array(this._maxGlyphs * 6); + this._isInitialized = true; } - offsetZ(facetCoordZ) { - return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; - } - constructor(core){ - this._core = core; - this.modelOriginX = 0; - this.modelOriginY = 0; - this.modelOriginZ = 0; - this.minModelBoundsX = 0; - this.minModelBoundsY = 0; - this.minModelBoundsZ = 0; - this.maxModelBoundsX = 0; - this.maxModelBoundsY = 0; - this.maxModelBoundsZ = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._facetSpacingX = 0; - this._facetSpacingY = 0; - this._facetSpacingZ = 0; - this._facetSizeX = 0; - this._facetSizeY = 0; - this._facetSizeZ = 0; - this._facetsX = 1; - this._facetsY = 1; - this._facetsZ = 1; + update(elapsedTime) { } - _updateModelBounds(options) { - this.minModelBoundsX = options.minBoundsX === undefined ? this.minLayoutBoundsX : options.minBoundsX; - this.minModelBoundsY = options.minBoundsY === undefined ? this.minLayoutBoundsY : options.minBoundsY; - this.minModelBoundsZ = options.minBoundsZ === undefined ? this.minLayoutBoundsZ : options.minBoundsZ; - this.maxModelBoundsX = options.maxBoundsX === undefined ? this.maxLayoutBoundsX : options.maxBoundsX; - this.maxModelBoundsY = options.maxBoundsY === undefined ? this.maxLayoutBoundsY : options.maxBoundsY; - this.maxModelBoundsZ = options.maxBoundsZ === undefined ? this.maxLayoutBoundsZ : options.maxBoundsZ; - this._isFacetted = options.facetsX !== undefined && options.facetsX > 1 && options.facetCoordsX != null || options.facetsY !== undefined && options.facetsY > 1 && options.facetCoordsY != null || options.facetsZ !== undefined && options.facetsZ > 1 && options.facetCoordsZ != null; - this._facetSpacingX = options.facetSpacingX === undefined ? 0 : options.facetSpacingX; - this._facetSpacingY = options.facetSpacingY === undefined ? 0 : options.facetSpacingY; - this._facetSpacingZ = options.facetSpacingZ === undefined ? 0 : options.facetSpacingZ; - let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._facetSizeX = modelSizeX; - this._facetSizeY = modelSizeY; - this._facetSizeZ = modelSizeZ; - this._facetsX = options.facetCoordsX ? options.facetsX : 1; - this._facetsY = options.facetCoordsY ? options.facetsY : 1; - this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; - this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; - this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; - this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; - this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); - this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); - this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); - this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; - this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; - this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; - modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; - this._facetScaling = maxBounds / this._maxBounds; + } + class LabelSet extends LabelBase { + get materials() { + return this._materials; } - resetCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = undefined; - this.minCumulativeLayoutBoundsY = undefined; - this.minCumulativeLayoutBoundsZ = undefined; - this.maxCumulativeLayoutBoundsX = undefined; - this.maxCumulativeLayoutBoundsY = undefined; - this.maxCumulativeLayoutBoundsZ = undefined; + get materialTypes() { + return this._materialTypes; } - _updateCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === undefined ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); - this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === undefined ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); - this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === undefined ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); - this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === undefined ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); - this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === undefined ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); - this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === undefined ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); + get materialColors() { + return this._materialColors; } - unitToModelSize(unitSize) { - return unitSize / this._boundsScaling; + get materialFuzzes() { + return this._materialFuzzes; } - unitToModelPositionX(unitPositionX) { - return this.unitToModelSize(unitPositionX) + this.modelOriginX; + get materialGlosses() { + return this._materialGlosses; } - unitToModelPositionY(unitPositionY) { - return this.unitToModelSize(unitPositionY) + this.modelOriginY; + get segmentColors() { + return this._segmentColors; } - unitToModelPositionZ(unitPositionZ) { - return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; + get minBoundsX() { + return this._minBoundsX; } - unitToModelPosition(unitPosition, modelPosition) { - modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); - modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); - modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - modelToUnitSize(modelSize) { - return modelSize * this._boundsScaling; + get minBoundsY() { + return this._minBoundsY; } - modelToUnitPositionX(modelPositionX) { - return (modelPositionX - this.modelOriginX) * this._boundsScaling; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - modelToUnitPositionY(modelPositionY) { - return (modelPositionY - this.modelOriginY) * this._boundsScaling; + get minBoundsZ() { + return this._minBoundsZ; } - modelToUnitPositionZ(modelPositionZ) { - return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - modelToUnitPosition(modelPosition, unitPosition) { - unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); - unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); - unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); - } - inclusiveUnitBounds(buffer, ids, unitType, offset, count, minBounds, maxBounds) { - (0, _glMatrix.vec3).set(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const unitScale = (0, _glMatrix.vec3).create(); - const unitRotation = (0, _glMatrix.quat).create(); - const unitTranslation = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - const dataView = buffer.dataView; - let minBounds0; - let maxBounds0; - let minBounds1; - let maxBounds1; - switch(unitType){ - case (0, _mainJs.UnitType).sphere: - case (0, _mainJs.UnitType).sphereSdf: - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const radius = unitScale[0] / 2; - minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius); - minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius); - minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius); - maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius); - maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius); - maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius); - } - break; - case (0, _mainJs.UnitType).hexPrism: - case (0, _mainJs.UnitType).hexPrismSdf: - case (0, _mainJs.UnitType).block: - case (0, _mainJs.UnitType).blockSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - minBounds1 = (0, _glMatrix.vec3).create(); - maxBounds1 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; - minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; - minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; - maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; - maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; - maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; - (0, _boundsJs.BoundsHelper).rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds1); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds1); - } - break; - case (0, _mainJs.UnitType).cylinder: - case (0, _mainJs.UnitType).cylinderSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - const pa = (0, _glMatrix.vec3).create(); - const pb = (0, _glMatrix.vec3).create(); - const identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - let ca; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const length = unitScale[1]; - const radius = Math.max(unitScale[0], unitScale[2]); - if (length != 0 && radius != 0) { - if ((0, _glMatrix.quat).equals(unitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY)) ca = identityRotation; - else { - ca = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca, identityRotation, unitRotation); - } - (0, _glMatrix.vec3).scaleAndAdd(pa, unitTranslation, ca, -length * 0.5); - (0, _glMatrix.vec3).scaleAndAdd(pb, unitTranslation, ca, length * 0.5); - (0, _boundsJs.BoundsHelper).cylinder(pa, pb, radius, minBounds0, maxBounds0); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds0); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds0); - } - } - break; - } + get maxBoundsX() { + return this._maxBoundsX; } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/bounds.js":"lo93N","../main.js":"b6Xbk","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lo93N":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BoundsHelper", ()=>BoundsHelper); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -class BoundsHelper { - static rotateBounds(minBounds, maxBounds, rotation, rotatedMinBounds, rotatedMaxBounds, offset) { - const sizeX = maxBounds[0] - minBounds[0]; - const sizeY = maxBounds[1] - minBounds[1]; - const sizeZ = maxBounds[2] - minBounds[2]; - const min = rotatedMinBounds; - const max = rotatedMaxBounds; - (0, _glMatrix.vec3).set(min, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(max, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const vertices = (0, _cubeJs.Cube).POSITIONS; - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).add(position, position, offset); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).subtract(position, position, offset); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).add(position, minBounds, maxBounds); - (0, _glMatrix.vec3).scale(position, position, 0.5); - (0, _glMatrix.vec3).add(min, min, position); - (0, _glMatrix.vec3).add(max, max, position); - } - static cylinder(pa, pb, radius, minBounds, maxBounds) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - minBounds[0] = Math.min(pa[0] - ex, pb[0] - ex); - minBounds[1] = Math.min(pa[1] - ey, pb[1] - ey); - minBounds[2] = Math.min(pa[2] - ez, pb[2] - ez); - maxBounds[0] = Math.max(pa[0] + ex, pb[0] + ex); - maxBounds[1] = Math.max(pa[1] + ey, pb[1] + ey); - maxBounds[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"erHGu","../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k6xxB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesBase", ()=>(0, _axesJs.AxesBase)); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>(0, _cartesian2DJs.Cartesian2dAxes)); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>(0, _cartesian2DJs.Cartesian2dAxesHelper)); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>(0, _cartesian3DJs.Cartesian3dAxes)); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>(0, _cartesian3DJs.Cartesian3dAxesHelper)); -var _axesJs = require("./axes.js"); -var _cartesian2DJs = require("./cartesian2d.js"); -var _cartesian3DJs = require("./cartesian3d.js"); - -},{"./axes.js":"4X9HQ","./cartesian2d.js":"lhcyD","./cartesian3d.js":"fmvJ2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1IX9R":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>(0, _angleJs.AngleHelper)); -parcelHelpers.export(exports, "AnimationHelper", ()=>(0, _animationJs.AnimationHelper)); -parcelHelpers.export(exports, "ArrayHelper", ()=>(0, _arrayJs.ArrayHelper)); -parcelHelpers.export(exports, "AxisHelper", ()=>(0, _axesJs.AxisHelper)); -parcelHelpers.export(exports, "Base64Helper", ()=>(0, _base64Js.Base64Helper)); -parcelHelpers.export(exports, "BinHelper", ()=>(0, _binJs.BinHelper)); -parcelHelpers.export(exports, "ColorHelper", ()=>(0, _colorJs.ColorHelper)); -parcelHelpers.export(exports, "CsvHelper", ()=>(0, _csvJs.CsvHelper)); -parcelHelpers.export(exports, "FacetHelper", ()=>(0, _facetJs.FacetHelper)); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>(0, _forcedirectJs.ForceDirectHelper)); -parcelHelpers.export(exports, "HexHelper", ()=>(0, _hexJs.HexHelper)); -parcelHelpers.export(exports, "HexBinHelper", ()=>(0, _hexbinJs.HexBinHelper)); -parcelHelpers.export(exports, "LineHelper", ()=>(0, _lineJs.LineHelper)); -parcelHelpers.export(exports, "MathHelper", ()=>(0, _mathJs.MathHelper)); -parcelHelpers.export(exports, "PseudoRandom", ()=>(0, _mathJs.PseudoRandom)); -parcelHelpers.export(exports, "MatrixHelper", ()=>(0, _matrixJs.MatrixHelper)); -parcelHelpers.export(exports, "MercatorHelper", ()=>(0, _mapJs.MercatorHelper)); -parcelHelpers.export(exports, "AlbersHelper", ()=>(0, _mapJs.AlbersHelper)); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>(0, _mapJs.GeoJSONHelper)); -parcelHelpers.export(exports, "OctTreeHelper", ()=>(0, _octtreeJs.OctTreeHelper)); -parcelHelpers.export(exports, "PaletteHelper", ()=>(0, _paletteJs.PaletteHelper)); -parcelHelpers.export(exports, "PathHelper", ()=>(0, _pathJs.PathHelper)); -parcelHelpers.export(exports, "PickHelper", ()=>(0, _pickJs.PickHelper)); -parcelHelpers.export(exports, "TableHelper", ()=>(0, _tableJs.TableHelper)); -parcelHelpers.export(exports, "TextHelper", ()=>(0, _textJs.TextHelper)); -parcelHelpers.export(exports, "TextureHelper", ()=>(0, _textureJs.TextureHelper)); -parcelHelpers.export(exports, "TreeHelper", ()=>(0, _treeJs.TreeHelper)); -parcelHelpers.export(exports, "SetHelper", ()=>(0, _setJs.SetHelper)); -parcelHelpers.export(exports, "SdfHelper", ()=>(0, _sdfJs.SdfHelper)); -parcelHelpers.export(exports, "VectorHelper", ()=>(0, _vectorJs.VectorHelper)); -var _angleJs = require("./angle.js"); -var _animationJs = require("./animation.js"); -var _arrayJs = require("./array.js"); -var _axesJs = require("./axes.js"); -var _base64Js = require("./base64.js"); -var _binJs = require("./bin.js"); -var _colorJs = require("./color.js"); -var _csvJs = require("./csv.js"); -var _facetJs = require("./facet.js"); -var _forcedirectJs = require("./forcedirect.js"); -var _hexJs = require("./hex.js"); -var _hexbinJs = require("./hexbin.js"); -var _lineJs = require("./line.js"); -var _mathJs = require("./math.js"); -var _matrixJs = require("./matrix.js"); -var _mapJs = require("./map.js"); -var _octtreeJs = require("./octtree.js"); -var _paletteJs = require("./palette.js"); -var _pathJs = require("./path.js"); -var _pickJs = require("./pick.js"); -var _tableJs = require("./table.js"); -var _textJs = require("./text.js"); -var _textureJs = require("./texture.js"); -var _treeJs = require("./tree.js"); -var _setJs = require("./set.js"); -var _sdfJs = require("./sdf.js"); -var _vectorJs = require("./vector.js"); - -},{"./angle.js":"hBXkO","./animation.js":"gfPT1","./array.js":"4HTFI","./axes.js":"ihirw","./base64.js":"jPxDT","./bin.js":"6iYuz","./color.js":"e6MgZ","./csv.js":"aipXV","./facet.js":"lCGoH","./forcedirect.js":"aTxJq","./hex.js":"7e5Gl","./hexbin.js":"6aPHf","./line.js":"fJDGL","./math.js":"6Lv1i","./matrix.js":"ffHCZ","./map.js":"luVrT","./octtree.js":"hnmkG","./palette.js":"60qny","./path.js":"ekXmH","./pick.js":"fOypM","./table.js":"fZzMq","./text.js":"keNgB","./texture.js":"kVjwp","./tree.js":"6KTQh","./set.js":"hTJIH","./sdf.js":"cvuqr","./vector.js":"fLgIj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4HTFI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ArrayHelper", ()=>ArrayHelper); -class ArrayHelper { - static minIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) { - index = ~index; - index = Math.max(0, index); - } else while(index > 0 && orderedValues[index - 1] == value)index--; - return index; - } - static maxIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) index = ~index - 1; - else { - while(index < length - 1 && orderedValues[index + 1] == value)index++; - index = Math.min(length, index); - } - return index; - } - static binarySearch(array, index, length, value) { - let low = index; - let high = index + length - 1; - while(low <= high){ - const mid = low + (high - low >> 1); - if (array[mid] == value) return mid; - if (array[mid] <= value) low = mid + 1; - else high = mid - 1; - } - return ~low; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jPxDT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Base64Helper", ()=>Base64Helper); -class Base64Helper { - uint6ToB64(nUint6) { - return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65; - } - base64EncArr(aBytes) { - let nMod3 = 2; - let sB64Enc = ""; - let nLen = aBytes.byteLength; - let nUint24 = 0; - for(let nIdx = 0; nIdx < nLen; nIdx++){ - nMod3 = nIdx % 3; - if (nIdx > 0 && nIdx * 4 / 3 % 76 === 0) sB64Enc += "\r\n"; - nUint24 |= aBytes.getUint8(nIdx) << (16 >>> nMod3 & 24); - if (nMod3 === 2 || aBytes.byteLength - nIdx === 1) { - sB64Enc += String.fromCharCode(this.uint6ToB64(nUint24 >>> 18 & 63), this.uint6ToB64(nUint24 >>> 12 & 63), this.uint6ToB64(nUint24 >>> 6 & 63), this.uint6ToB64(nUint24 & 63)); - nUint24 = 0; - } - } - return sB64Enc.substring(0, sB64Enc.length - 2 + nMod3) + (nMod3 === 2 ? "" : nMod3 === 1 ? "=" : "=="); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iYuz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BinHelper", ()=>BinHelper); -class BinHelper { - static quantile(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const itemsPerBin = count / options.bins; - let bin = 0; - if (options.froms && options.tos) { - const firstId = options.ids[offset]; - options.froms[0] = options.values[firstId]; - } - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - if (i > Math.floor(itemsPerBin * (bin + 1))) { - bin++; - if (options.froms && options.tos) { - options.tos[bin - 1] = options.values[id]; - const nextId = options.ids[i + offset + 1]; - options.froms[bin] = options.values[nextId]; - } - } - options.binIds[id] = bin; - } - if (options.froms && options.tos) { - const lastId = options.ids[count - 1 + offset]; - options.tos[options.bins - 1] = options.values[lastId]; - } - return Math.floor(itemsPerBin); - } - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const counts = options.counts ? options.counts : new Float64Array(options.bins); - let minValue = options.minValue; - let maxValue = options.maxValue; - if (options.isDiscrete || maxValue == minValue) { - minValue -= 0.5; - maxValue += 0.5; - } - const binSize = (maxValue - minValue) / options.bins; - let maxCount = 0; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - const value = options.values[id]; - const binId = Math.max(Math.min(Math.floor((value - minValue) / binSize), options.bins - 1), 0); - options.binIds[id] = binId; - counts[binId]++; - maxCount = Math.max(counts[binId], maxCount); - } - if (options.froms && options.tos) { - for(let i = 0; i < options.bins; i++)if (options.isDiscrete || maxValue == minValue) { - options.froms[i] = Math.ceil(minValue + binSize * i); - options.tos[i] = Math.floor(minValue + binSize * (i + 1)); - } else { - options.froms[i] = minValue + binSize * i; - options.tos[i] = minValue + binSize * (i + 1); - } - } - return maxCount; - } - static maxBins(minValue, maxValue, isDiscrete, maxBins) { - if (isDiscrete) return Math.min(maxValue - minValue + 1, maxBins); - else return maxBins; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e6MgZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorHelper", ()=>ColorHelper); -var _glMatrix = require("gl-matrix"); -class ColorHelper { - static luminance(rgb) { - return rgb[0] * ColorHelper.LUMINANCE[0] + rgb[1] * ColorHelper.LUMINANCE[1] + rgb[2] * ColorHelper.LUMINANCE[2]; - } - static rgbToHex(r, g, b) { - const r2 = `0${Math.round(r * 255).toString(16)}`; - const g2 = `0${Math.round(g * 255).toString(16)}`; - const b2 = `0${Math.round(b * 255).toString(16)}`; - return `#${r2.substr(r2.length - 2, 2)}${g2.substr(g2.length - 2, 2)}${b2.substr(b2.length - 2, 2)}`; - } - static rgbToHsv(r, g, b, hsv) { - let h, s, v, delta; - const min = Math.min(Math.min(r, g), b); - const max = Math.max(Math.max(r, g), b); - delta = max - min; - v = max; - if (delta == 0) { - h = -1; - if (max == 0) s = -1; - else s = 0; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - s = delta / max; - if (r == max) h = (g - b) / delta; - else if (g == max) h = 2 + (b - r) / delta; - else h = 4 + (r - g) / delta; - h *= 60; - if (h < 0) h += 360; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - static hsvToRgb(h, s, v, rgb) { - let sextant, r, g, b; - if (s == 0) { - r = g = b = v; - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } - let frac, p, q, t; - h %= 360; - h /= 60; - sextant = Math.floor(h); - frac = h - sextant; - p = v * (1 - s); - q = v * (1 - s * frac); - t = v * (1 - s * (1 - frac)); - switch(sextant){ - case 0: - r = v; - g = t; - b = p; - break; - case 1: - r = q; - g = v; - b = p; - break; - case 2: - r = p; - g = v; - b = t; - break; - case 3: - r = p; - g = q; - b = v; - break; - case 4: - r = t; - g = p; - b = v; - break; - default: - r = v; - g = p; - b = q; - break; - } - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } -} -ColorHelper.LUMINANCE = (0, _glMatrix.vec3).fromValues(0.2126, 0.7152, 0.0722); - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aipXV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CsvHelper", ()=>CsvHelper); -var _mainJs = require("../main.js"); -class CsvHelper { - constructor(core){ - this.QUOTE = '"'; - this.DELIMETER = ','; - this.LINE_BREAKS = [ - '\n', - '\r' - ]; - this._core = core; - } - readline(text, row) { - return this.read(text, row, 1)[0]; - } - read(text, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const rows = []; - let rowBuffer = []; - let row = 0; - let columnBuffer = ""; - let quoted = false; - for(let i = 0; i < text.length; i++){ - const char = text.charAt(i); - if (char == this.QUOTE) { - if (text.charAt(i + 1) == this.QUOTE) { - i++; - columnBuffer += this.QUOTE; - } else quoted = !quoted; - } else if (quoted) columnBuffer += char; - else { - if (char == this.DELIMETER) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - } else if (this.LINE_BREAKS.indexOf(char) > -1) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - while(this.LINE_BREAKS.indexOf(text.charAt(i + 1)) > -1)i++; - if (row++ >= firstRow) rows.push(rowBuffer); - rowBuffer = []; - if (rows.length == maxRows) break; - } else columnBuffer += char; - } - } - if (columnBuffer != "") rowBuffer.push(columnBuffer); - if (rowBuffer.length > 0) rows.push(rowBuffer); - if (maxRows > 1) this._core.log.write((0, _mainJs.LogLevel).info, `csv ${rows.length} rows ${Math.round(window.performance.now() - start)}ms`); - return rows; - } - writeLine(data) { - let text = ""; - for(let i = 0; i < data.length; i++){ - let column = data[i]; - if (column) { - const quotes = column.indexOf(this.DELIMETER) > -1 || column.indexOf(this.QUOTE) > -1; - column = column.replace(/"/g, '""'); - if (quotes) column = `${this.QUOTE}${column}${this.QUOTE}`; - } - text += column; - if (i < data.length - 1) text += this.DELIMETER; - } - return text; - } - writeAsJavaScriptArray(headings, data) { - let text = "[["; - for (let column of headings)text += `"${column}",`; - text = text.slice(0, -1); - text += "]\n"; - let row; - for(let i = 0; i < data.length; i++){ - const line = data[i]; - row = "["; - for(let j = 0; j < line.length; j++){ - const column = line[j]; - row += `"${column.replace(/"/g, '\\"')}",`; - } - row = row.slice(0, -1); - row += "],\n"; - text += row; - } - text += "];"; - return text; - } -} - -},{"../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lCGoH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FacetHelper", ()=>FacetHelper); -var _mainJs = require("../main.js"); -class FacetHelper { - constructor(core){ - this._core = core; - } - split1d(ids, facetsX, valuesX, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, undefined, undefined, valuesX, null, null, orderedIds, facetIds, offsets, counts); - } - split2d(ids, facetsX, facetsY, valuesX, valuesY, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, facetsY, undefined, valuesX, valuesY, null, orderedIds, facetIds, offsets, counts); - } - split3d(ids, facetsX, facetsY, facetsZ, valuesX, valuesY, valuesZ, orderedIds, facetIds, offsets, counts) { - if (valuesX && facetIds.length != valuesX.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesX"); - if (valuesY && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - if (valuesZ && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - const start = window.performance.now(); - if (facetsX === undefined) facetsX = 1; - if (facetsY === undefined) facetsY = 1; - if (facetsZ === undefined) facetsZ = 1; - const maxFacetId = facetsX * facetsY * facetsZ - 1; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const valueX = valuesX ? valuesX[id] : 0; - const valueY = valuesY ? valuesY[id] : 0; - const valueZ = valuesZ ? valuesZ[id] : 0; - const facetId = valueX + valueY * facetsX + valueZ * facetsX * facetsZ; - facetIds[id] = facetId; - if (facetId > maxFacetId) this._core.log.write((0, _mainJs.LogLevel).warn, "facet overflow"); - counts[facetId]++; - } - let offset = 0; - for(let i = 0; i < offsets.length; i++){ - const count = counts[i]; - offsets[i] = offset; - offset += count; - } - const tempOffsets = new Uint32Array(offsets); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const facetId = facetIds[id]; - offset = tempOffsets[facetId]++; - orderedIds[offset] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet split ${Math.round(window.performance.now() - start)}ms`); - } - wrap1d(ids, values, columns, coordsX, coordsY) { - const start = window.performance.now(); - let rows = 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const value = values[id]; - coordsX[id] = value % columns; - const row = Math.floor(value / columns); - coordsY[id] = row; - rows = Math.max(row, rows); - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet wrap ${Math.round(window.performance.now() - start)}ms`); - return rows + 1; + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } -} - -},{"../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aTxJq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>ForceDirectHelper); -var _octtreeJs = require("./octtree.js"); -class ForceDirectHelper { - set gravity(value) { - this._gravity = value; - } - get gravity() { - return this._gravity; - } - set attraction(value) { - this._attraction = value; - } - get attraction() { - return this._attraction; - } - set repulsion(value) { - this._repulsion = value; - } - get repulsion() { - return this._repulsion; - } - set interval(value) { - this._interval = value; - } - get interval() { - return this._interval; - } - set maxDistance(value) { - this._maxDistance = value; - } - get maxDistance() { - return this._maxDistance; - } - set iterationsPerLayout(value) { - this._iteractionsPerLayout = value; - } - get iterationsPerLayout() { - return this._iteractionsPerLayout; - } - set edgeWeightPower(value) { - this._edgeWeightPower = value; - } - get edgeWeightPower() { - return this._edgeWeightPower; - } - set theta(value) { - this._theta = value; - } - get theta() { - return this._theta; - } - get iterations() { - return this._totalIterations; - } - get totalRepulsion() { - return this._totalRepulsion; - } - get nodePositionsX() { - return this._nodePositionsX; - } - get nodePositionsY() { - return this._nodePositionsY; - } - get nodePositionsZ() { - return this._nodePositionsZ; - } - get lockX() { - return this._lockX; - } - set lockX(value) { - this._lockX = value; - } - get lockY() { - return this._lockY; - } - set lockY(value) { - this._lockY = value; - } - get lockZ() { - return this._lockZ; - } - set lockZ(value) { - this._lockZ = value; - } - constructor(options){ - this._forcesX = new Float64Array(options.nodeIds.length); - this._forcesY = new Float64Array(options.nodeIds.length); - this._forcesZ = new Float64Array(options.nodeIds.length); - this._totalIterations = 0; - this._totalRepulsion = 0; - this._repulsion = options.repulsion || 1; - this._attraction = options.attraction || 1; - this._gravity = options.gravity || 1; - this._interval = options.interval || 1; - this._maxDistance = options.maxDistance || 1; - this._iteractionsPerLayout = options.iterationsPerLayout || 1; - this._theta = options.theta || 1; - this._nodeIds = options.nodeIds; - this._nodePositionsX = options.nodePositionsX; - this._nodePositionsY = options.nodePositionsY; - this._nodePositionsZ = options.nodePositionsZ; - this._nodeWeights = options.nodeWeights || new Float64Array(this._nodeIds.length).fill(1); - this._edgeIds = options.edgeIds; - this._edgeFromIds = options.edgeFromIds; - this._edgeToIds = options.edgeToIds; - this._edgeWeights = options.edgeWeights || new Float64Array(this._edgeIds.length).fill(1); - this._edgeWeightPower = options.edgeWeightPower || 1; + get maxBoundsY() { + return this._maxBoundsY; } - layout() { - this._minBoundsX = Number.MAX_VALUE; - this._minBoundsY = Number.MAX_VALUE; - this._minBoundsZ = Number.MAX_VALUE; - this._maxBoundsX = -Number.MAX_VALUE; - this._maxBoundsY = -Number.MAX_VALUE; - this._maxBoundsZ = -Number.MAX_VALUE; - for(let i = 0; i < this._nodeIds.length; i++){ - this._minBoundsX = Math.min(this._minBoundsX, this._nodePositionsX[i]); - this._minBoundsY = Math.min(this._minBoundsY, this._nodePositionsY[i]); - this._minBoundsZ = Math.min(this._minBoundsZ, this._nodePositionsZ[i]); - this._maxBoundsX = Math.max(this._maxBoundsX, this._nodePositionsX[i]); - this._maxBoundsY = Math.max(this._maxBoundsY, this._nodePositionsY[i]); - this._maxBoundsZ = Math.max(this._maxBoundsZ, this._nodePositionsZ[i]); - } - for(let iteration = 0; iteration < this._iteractionsPerLayout; iteration++){ - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forcesX[id] = 0; - this._forcesY[id] = 0; - this._forcesZ[id] = 0; - } - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - let dx = this._nodePositionsX[id]; - let dy = this._nodePositionsY[id]; - let dz = this._nodePositionsZ[id]; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -this._nodeWeights[id] * this._gravity; - this._forcesX[id] += magnitude * dx; - this._forcesY[id] += magnitude * dy; - this._forcesZ[id] += magnitude * dz; - } - } - for(let i = 0; i < this._edgeIds.length; i++){ - const id = this._edgeIds[i]; - const fromId = this._edgeFromIds[id]; - const toId = this._edgeToIds[id]; - const x1 = this._nodePositionsX[fromId]; - const y1 = this._nodePositionsY[fromId]; - const z1 = this._nodePositionsZ[fromId]; - const x2 = this._nodePositionsX[toId]; - const y2 = this._nodePositionsY[toId]; - const z2 = this._nodePositionsZ[toId]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -distance * this._attraction * Math.pow(this._edgeWeights[id], this._edgeWeightPower); - this._forcesX[fromId] += magnitude * dx; - this._forcesY[fromId] += magnitude * dy; - this._forcesZ[fromId] += magnitude * dz; - this._forcesX[toId] -= magnitude * dx; - this._forcesY[toId] -= magnitude * dy; - this._forcesZ[toId] -= magnitude * dz; - } - } - const minBounds = Math.min(Math.min(this._minBoundsX, this._minBoundsY), this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._maxBoundsX, this._maxBoundsY), this._maxBoundsZ); - const size = maxBounds - minBounds; - const maxLevel = 10; - const minBoundsX = minBounds; - const minBoundsY = minBounds; - const minBoundsZ = minBounds; - const maxBoundsX = maxBounds; - const maxBoundsY = maxBounds; - const maxBoundsZ = maxBounds; - const octTreeOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - maxLevel: maxLevel, - ids: this._nodeIds, - positionsX: this._nodePositionsX, - positionsY: this._nodePositionsY, - positionsZ: this._nodePositionsZ, - masses: this._nodeWeights - }; - const octTree = new (0, _octtreeJs.OctTreeHelper)(octTreeOptions); - this._totalRepulsion = 0; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forceX = 0; - this._forceY = 0; - this._forceZ = 0; - this.calculateRepulsion(octTree.root, id); - this._forcesX[id] += this._forceX; - this._forcesY[id] += this._forceY; - this._forcesZ[id] += this._forceZ; - this._totalRepulsion += Math.sqrt(this._forceX * this._forceX + this._forceY * this._forceY + this._forceZ * this._forceZ); - } - const timeSquared = this._interval * this._interval; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - const mass = this._nodeWeights[id]; - const ax = this._forcesX[id] / mass; - const ay = this._forcesY[id] / mass; - const az = this._forcesZ[id] / mass; - let dx = ax * timeSquared / 2; - let dy = ay * timeSquared / 2; - let dz = az * timeSquared / 2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - const distance = Math.sqrt(distanceSquared); - if (distance > this._maxDistance * size) { - dx *= this._maxDistance * size / distance; - dy *= this._maxDistance * size / distance; - dz *= this._maxDistance * size / distance; - } - if (!this._lockX) this._nodePositionsX[id] += dx; - if (!this._lockY) this._nodePositionsY[id] += dy; - if (!this._lockZ) this._nodePositionsZ[id] += dz; - } - } - if (this.layoutCallback) this.layoutCallback(); - } - calculateRepulsion(parent, id1) { - const x1 = this._nodePositionsX[id1]; - const y1 = this._nodePositionsY[id1]; - const z1 = this._nodePositionsZ[id1]; - for(let k = 0; k < parent.children.length; k++){ - const child = parent.children[k]; - if (!child.children) for(let i = 0; i < child.ids.length; i++){ - const id2 = child.ids[i]; - if (id1 != id2) { - const x2 = this._nodePositionsX[id2]; - const y2 = this._nodePositionsY[id2]; - const z2 = this._nodePositionsZ[id2]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - let distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = this._repulsion * this._nodeWeights[id1] * this._nodeWeights[id2] / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } - } - } - else { - let dx = x1 - child.centerOfMassX; - let dy = y1 - child.centerOfMassY; - let dz = z1 - child.centerOfMassZ; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const width = child.maxBoundsX - child.minBoundsX; - if (width / distance < this._theta) { - const magnitude = this._repulsion * this._nodeWeights[id1] * child.mass / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } else this.calculateRepulsion(child, id1); - } - } - } + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } -} - -},{"./octtree.js":"hnmkG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hnmkG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OctTreeNode", ()=>OctTreeNode); -parcelHelpers.export(exports, "OctTreeHelper", ()=>OctTreeHelper); -class OctTreeNode { -} -class OctTreeHelper { - constructor(options){ - this._ids = options.ids; - this._positionsX = options.positionsX; - this._positionsY = options.positionsY; - this._positionsZ = options.positionsZ; - this._masses = options.masses; - this._maxLevel = options.maxLevel; - this.root = new OctTreeNode(); - this.root.minBoundsX = options.minBoundsX; - this.root.minBoundsY = options.minBoundsY; - this.root.minBoundsZ = options.minBoundsZ; - this.root.maxBoundsX = options.maxBoundsX; - this.root.maxBoundsY = options.maxBoundsY; - this.root.maxBoundsZ = options.maxBoundsZ; - this.root.level = 0; - this.root.octKey = ""; - this._buildTree(this.root, this._ids); - } - _buildTree(parent, ids) { - const centerX = (parent.minBoundsX + parent.maxBoundsX) / 2; - const centerY = (parent.minBoundsY + parent.maxBoundsY) / 2; - const centerZ = (parent.minBoundsZ + parent.maxBoundsZ) / 2; - const minBoundsX = []; - const minBoundsY = []; - const minBoundsZ = []; - const maxBoundsX = []; - const maxBoundsY = []; - const maxBoundsZ = []; - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - const masses = new Float64Array(8); - const centerOfMassesX = new Float64Array(8); - const centerOfMassesY = new Float64Array(8); - const centerOfMassesZ = new Float64Array(8); - const buckets = [ - [], - [], - [], - [], - [], - [], - [], - [] - ]; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const x = this._positionsX[index]; - const y = this._positionsY[index]; - const z = this._positionsZ[index]; - const mass = this._masses[index]; - for(let j = 0; j < 8; j++)if (minBoundsX[j] <= x && maxBoundsX[j] >= x && minBoundsY[j] <= y && maxBoundsY[j] >= y && minBoundsZ[j] <= z && maxBoundsZ[j] >= z) { - buckets[j].push(index); - masses[j] += mass; - centerOfMassesX[j] += x * mass; - centerOfMassesY[j] += y * mass; - centerOfMassesZ[j] += z * mass; - break; - } - } - parent.children = []; - for(let i = 0; i < 8; i++)if (buckets[i].length > 0) { - const child = new OctTreeNode(); - child.minBoundsX = minBoundsX[i]; - child.minBoundsY = minBoundsY[i]; - child.minBoundsZ = minBoundsZ[i]; - child.maxBoundsX = maxBoundsX[i]; - child.maxBoundsY = maxBoundsY[i]; - child.maxBoundsZ = maxBoundsZ[i]; - child.mass = masses[i]; - child.centerOfMassX = centerOfMassesX[i] / masses[i]; - child.centerOfMassY = centerOfMassesY[i] / masses[i]; - child.centerOfMassZ = centerOfMassesZ[i] / masses[i]; - child.level = parent.level + 1; - child.octKey += i.toString(); - child.parent = parent; - child.ids = new Uint32Array(buckets[i]); - parent.children.push(child); - if (child.ids.length > 1 && child.level < this._maxLevel) this._buildTree(child, child.ids); - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7e5Gl":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexHelper", ()=>HexHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _angleJs = require("./angle.js"); -class HexHelper { - static width(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return (0, _constantsJs.Constants).ROOT_THREE * size; - else return 2 * size; - } - static height(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return 2 * size; - else return (0, _constantsJs.Constants).ROOT_THREE * size; - } - static pointyHexCorner(center, size, i, position) { - const angle = (0, _angleJs.AngleHelper).degreesToRadians(60 * i - 30); - position[0] = center[0] + size * Math.cos(angle); - position[1] = center[1] + size * Math.sin(angle); - } - static cubeToAxial(cube, hex) { - hex[0] = cube[0]; - hex[1] = cube[2]; - } - static axialToCube(hex, cube) { - const x = hex[0]; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static cubeToOddr(cube, hex) { - const col = cube[0] + (cube[2] - (cube[2] & 1)) / 2; - const row = cube[2]; - hex[0] = col; - hex[1] = row; - } - static oddrToCube(hex, cube) { - const x = hex[0] - (hex[1] - (hex[1] & 1)) / 2; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static pointyHexToPixel(hex, size, point) { - point[0] = size * ((0, _constantsJs.Constants).ROOT_THREE * hex[0] + (0, _constantsJs.Constants).ROOT_THREE / 2 * hex[1]); - point[1] = size * (1.5 * hex[1]); - } - static pixelToPointyHex(point, size, hex) { - hex[0] = ((0, _constantsJs.Constants).ROOT_THREE / 3 * point[0] - 1 / 3 * point[1]) / size; - hex[1] = 2 / 3 * point[1] / size; - this.hexRound(hex, hex); - } - static hexRound(hex, hexRound) { - const cube = this._vec3; - this.axialToCube(hex, cube); - this.cubeRound(cube, cube); - this.cubeToAxial(cube, hexRound); - } - static cubeRound(cube, cubeRound) { - let rx = Math.round(cube[0]); - let ry = Math.round(cube[1]); - let rz = Math.round(cube[2]); - const x_diff = Math.abs(rx - cube[0]); - const y_diff = Math.abs(ry - cube[1]); - const z_diff = Math.abs(rz - cube[2]); - if (x_diff > y_diff && x_diff > z_diff) rx = -ry - rz; - else if (y_diff > z_diff) ry = -rx - rz; - else rz = -rx - ry; - cubeRound[0] = rx; - cubeRound[1] = ry; - cubeRound[2] = rz; - } -} -HexHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../main.js":"b6Xbk","./angle.js":"hBXkO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6aPHf":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexBinHelper", ()=>HexBinHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _hexJs = require("./hex.js"); -class HexBinHelper { - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const width = (options.maxValueX - options.minValueX) / options.binsX; - const minValueX = options.minValueX - width / 2; - const binsX = options.binsX + 1; - const size = width / (0, _constantsJs.Constants).ROOT_THREE; - const height = 2 * size; - const heightBetweenCenters = 3 * height / 4; - const binsY = Math.ceil((options.maxValueY - options.minValueY) / heightBetweenCenters) + 1; - const minValueY = options.minValueY; - const minQ = -Math.floor(binsY / 2); - const maxBins = (binsX - minQ) * binsY; - const binCounts = new Float64Array(maxBins); - const binLookup = new Uint32Array(maxBins); - const point = (0, _glMatrix.vec2).create(); - const hex = (0, _glMatrix.vec2).create(); - let nonEmptyBins = 0; - let minCount = Number.MAX_VALUE; - let maxCount = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - point[0] = options.valuesX[id] - minValueX; - point[1] = options.valuesY[id] - minValueY; - (0, _hexJs.HexHelper).pixelToPointyHex(point, size, hex); - const q = hex[0] - minQ; - const r = hex[1]; - const binId = q + r * (binsX - minQ); - if (binCounts[binId] == 0) { - binLookup[binId] = nonEmptyBins; - nonEmptyBins++; - } - binCounts[binId]++; - options.binIds[id] = binId; - minCount = Math.min(minCount, binCounts[binId]); - maxCount = Math.max(maxCount, binCounts[binId]); - } - const positionsX = new Float64Array(nonEmptyBins); - const positionsY = new Float64Array(nonEmptyBins); - const counts = new Uint32Array(nonEmptyBins); - const lookup = {}; - for(let i = 0; i < maxBins; i++){ - const count = binCounts[i]; - if (count > 0) { - const index = binLookup[i]; - lookup[i] = index; - counts[index] = count; - const q = i % (binsX - minQ); - const r = Math.floor(i / (binsX - minQ)); - hex[0] = q + minQ; - hex[1] = r; - (0, _hexJs.HexHelper).pointyHexToPixel(hex, size, point); - positionsX[index] = point[0] + minValueX; - positionsY[index] = point[1] + minValueY; - } - } - const result = { - binIds: options.binIds, - positionsX: positionsX, - positionsY: positionsY, - counts: counts, - minCount: minCount, - maxCount: maxCount, - orientation: (0, _mainJs.HexOrientation).pointyTop, - size: size, - lookup: lookup, - binsY: binsY - }; - return result; + get maxBoundsZ() { + return this._maxBoundsZ; } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../main.js":"b6Xbk","./hex.js":"7e5Gl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fJDGL":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LineHelper", ()=>LineHelper); -var _mainJs = require("../main.js"); -class LineHelper { - constructor(core){ - this._core = core; - } - connect(orderedIds, series, toIds, offset = 0, count = orderedIds.length) { - const start = window.performance.now(); - const lines = new Set(); - const lookup = {}; - for(let i = offset; i < count; i++){ - const id = orderedIds[i + offset]; - const value = series[id]; - const fromId = lookup[value]; - if (fromId != null) { - toIds[fromId] = id; - lines.add(value); - } - lookup[value] = id; - toIds[id] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `${lines.size} lines connected ${Math.round(window.performance.now() - start)}ms`); - return lines.size; - } -} - -},{"../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60qny":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteHelper", ()=>PaletteHelper); -var _glMatrix = require("gl-matrix"); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -class PaletteHelper { - static resample(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < divisionsOut; i++){ - const positionOut = (i + 0.5) / divisionsOut; - const positionIn = positionOut * (divisionsIn - 1); - const stepIn = Math.floor(positionIn); - const fractIn = positionIn - stepIn; - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3], colorsIn[(stepIn + 1) * 3], fractIn); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 1], colorsIn[(stepIn + 1) * 3 + 1], fractIn); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 2], colorsIn[(stepIn + 1) * 3 + 2], fractIn); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static truncate(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < Math.min(divisionsIn, divisionsOut); i++){ - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = colorsIn[i * 3]; - colorsOut[j * 4 + 1] = colorsIn[i * 3 + 1]; - colorsOut[j * 4 + 2] = colorsIn[i * 3 + 2]; - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static resampleStops(stops, divisions, reverse) { - const colorsOut = new Uint8Array(divisions * 4); - let from = 0; - let to = 0; - for(let i = 0; i < divisions; i++){ - const positionOut = (i + 0.5) / divisions; - while(stops[from].position < positionOut && from < stops.length - 1)from++; - from = Math.max(from - 1, 0); - to = Math.min(from + 1, stops.length - 1); - const fromStop = stops[from]; - const toStop = stops[to]; - const fract = from == to ? 0 : (positionOut - fromStop.position) / (toStop.position - fromStop.position); - const j = reverse ? divisions - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(fromStop.r, toStop.r, fract); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(fromStop.g, toStop.g, fract); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(fromStop.b, toStop.b, fract); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static lerpRgb(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - colors[i * 4] = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - colors[i * 4 + 1] = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - colors[i * 4 + 2] = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - colors[i * 4 + 3] = 0xff; - } - return colors; - } - static lerpHsv(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - const h = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - const s = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - const v = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - (0, _colorJs.ColorHelper).hsvToRgb(h, s, v, PaletteHelper._rgb); - colors[i * 4] = PaletteHelper._rgb[0] * 0xff; - colors[i * 4 + 1] = PaletteHelper._rgb[1] * 0xff; - colors[i * 4 + 2] = PaletteHelper._rgb[2] * 0xff; - colors[i * 4 + 3] = 0xff; - } - return colors; - } -} -PaletteHelper._rgb = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","./color.js":"e6MgZ","./math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ekXmH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PathHelper", ()=>PathHelper); -class PathHelper { - static getFilenameWithoutExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1) return path; - else { - const start = path.lastIndexOf('/') == -1 ? 0 : path.lastIndexOf('/') + 1; - return path.substring(start, dot); - } + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - static getExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1 || dot == path.length - 1) return null; - else return path.substring(dot + 1, path.length); + get positionsX() { + return this._positionsX; } - static getFilename(path) { - if (path.lastIndexOf('/') == -1) return path; - else { - const start = path.lastIndexOf('/') + 1; - return path.substring(start, path.length); - } + set positionsX(value2) { + if (this._positionsX != value2) { + this._positionsX = value2; + this._hasChanged = true; + } } - static getPath(path) { - if (path.lastIndexOf('/') == -1) return ""; - else return path.substring(0, path.lastIndexOf('/')); + get positionsY() { + return this._positionsY; } - static combine(first, second) { - const seperator = first.lastIndexOf('/') == first.length - 1; - if (second.indexOf('/') == 0) { - if (seperator) return first.substring(0, first.length - 1) + second; - else return first + second; - } else { - if (seperator) return first + second; - else return first + '/' + second; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fZzMq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TableHelper", ()=>TableHelper); -var _mainJs = require("../main.js"); -var _tableJs = require("../tables/table.js"); -class TableHelper { - constructor(core){ - this._core = core; - } - compatibleTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const types = []; - const integers = []; - let values = data[firstRow]; - let parsedFloat, parsedDate; - for(let i = 0; i < values.length; i++){ - const value = values[i]; - parsedFloat = Number(value); - parsedDate = Date.parse(value); - let integer = false; - let type; - if (!isNaN(parsedFloat)) { - type = (0, _tableJs.ColumnType).float; - integer = Number.isSafeInteger(parsedFloat); - } else if (!isNaN(parsedDate)) type = (0, _tableJs.ColumnType).date; - else type = (0, _tableJs.ColumnType).string; - types.push(type); - integers.push(integer); - } - for(let i = firstRow + 1; i < Math.min(data.length, firstRow + maxRows); i++){ - values = data[i]; - for(let j = 0; j < values.length; j++)if (types[j] != (0, _tableJs.ColumnType).string) { - const value = values[j]; - parsedFloat = Number(value); - if (types[j] == (0, _tableJs.ColumnType).float) { - if (isNaN(parsedFloat)) { - types[j] = (0, _tableJs.ColumnType).string; - integers[j] = false; - } else if (integers[j]) integers[j] = Number.isSafeInteger(parsedFloat); - } else if (types[j] == (0, _tableJs.ColumnType).date) { - parsedDate = Date.parse(value); - if (isNaN(parsedDate)) types[j] = (0, _tableJs.ColumnType).string; - } - } - } - const compatibleTypes = []; - for(let i = 0; i < types.length; i++){ - let compatible = types[i] | (0, _tableJs.ColumnType).string; - if (integers[i]) compatible |= (0, _tableJs.ColumnType).integer; - compatibleTypes.push(compatible); - } - this._core.log.write((0, _mainJs.LogLevel).info, `compatible types ${Math.round(window.performance.now() - start)}ms`); - return compatibleTypes; - } - inferTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const columnTypes = []; - const compatibleTypes = this.compatibleTypes(data, firstRow, maxRows); - for(let i = 0; i < compatibleTypes.length; i++){ - let columnType; - const compatibleType = compatibleTypes[i]; - if (compatibleType & (0, _tableJs.ColumnType).integer) columnType = (0, _tableJs.ColumnType).integer; - else if (compatibleType & (0, _tableJs.ColumnType).float) columnType = (0, _tableJs.ColumnType).float; - else if (compatibleType & (0, _tableJs.ColumnType).date) columnType = (0, _tableJs.ColumnType).date; - else columnType = (0, _tableJs.ColumnType).string; - columnTypes.push(columnType); - } - return columnTypes; - } - convertToObject(table) { - const headings = table.headings; - const jsonObject = []; - for(let i = 0; i < table.all.ids.length; i++){ - const row = {}; - for(let j = 0; j < headings.length; j++){ - const column = headings[j]; - const value = table.all.columnValues(j)[i]; - switch(table.getColumnType(j)){ - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - row[column] = value; - break; - case (0, _tableJs.ColumnType).string: - case (0, _tableJs.ColumnType).date: - default: - row[column] = table.data[i][j]; - break; - } - jsonObject.push(row); - } - } - return jsonObject; - } -} - -},{"../main.js":"b6Xbk","../tables/table.js":"cNpSp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cNpSp":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -parcelHelpers.export(exports, "ColumnType", ()=>ColumnType); -var _filterJs = require("./filter.js"); -class Table { - get data() { - return this._data; - } - get headings() { - return this._headings; - } - get all() { - return this._all; + set positionsY(value2) { + if (this._positionsY != value2) { + this._positionsY = value2; + this._hasChanged = true; + } } - get isInitialized() { - return this._isInitialized; + get positionsZ() { + return this._positionsZ; } - get filter() { - return this._filter; + set positionsZ(value2) { + if (this._positionsZ != value2) { + this._positionsZ = value2; + this._hasChanged = true; + } } - set filter(value) { - if (this._filter !== value) { - this._filter = value; - if (this.filterChangedCallback) this.filterChangedCallback(); - } + get positionScalingX() { + return this._positionScalingX; } - getColumnType(column) { - return this._columnTypes[column]; + set positionScalingX(value2) { + if (this._positionScalingX != value2) { + this._positionScalingX = value2; + this._hasChanged = true; + } } - isColumnDiscrete(column) { - return (this._columnTypes[column] & ColumnType.discrete) > 0; + get positionScalingY() { + return this._positionScalingY; } - isColumnNumeric(column) { - return (this._columnTypes[column] & ColumnType.numeric) > 0; + set positionScalingY(value2) { + if (this._positionScalingY != value2) { + this._positionScalingY = value2; + this._hasChanged = true; + } } - isColumnContinuous(column) { - return (this._columnTypes[column] & ColumnType.continuous) > 0; + get positionScalingZ() { + return this._positionScalingZ; } - constructor(core, headings, data, columnTypes){ - this._core = core; - this._headings = headings; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = Array(columnTypes.length).fill(null); - const indices = new Uint32Array(data.length); - for(let i = 0; i < indices.length; i++)indices[i] = i; - this._all = new (0, _filterJs.Filter)(core, indices, data, headings, columnTypes, this._numericValues); - this._isInitialized = true; + set positionScalingZ(value2) { + if (this._positionScalingZ != value2) { + this._positionScalingZ = value2; + this._hasChanged = true; + } } - createFilter(ids) { - return new (0, _filterJs.Filter)(this._core, ids, this._data, this._headings, this._columnTypes, this._numericValues); + get rotations() { + return this._rotations; } -} -const ColumnType = { - none: 0, - float: 1, - integer: 2, - string: 4, - date: 8, - continuous: 9, - discrete: 6, - numeric: 11 -}; - -},{"./filter.js":"h4ise","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h4ise":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Filter", ()=>Filter); -var _mainJs = require("../main.js"); -var _tableJs = require("./table.js"); -class Filter { - get ids() { - return this._ids; - } - constructor(core, ids, data, headings, columnTypes, numericValues){ - this._core = core; - this._ids = ids; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = numericValues; - this._stringValues = Array(columnTypes.length).fill(null); - this._hasMinMaxValues = Array(columnTypes.length).fill(false); - this._minValues = Array(columnTypes.length).fill(0); - this._maxValues = Array(columnTypes.length).fill(0); - this._distinctStrings = Array(columnTypes.length).fill(null); - this._orderedIds = Array(columnTypes.length).fill(null); - this._orderedValues = Array(columnTypes.length).fill(null); - } - columnValues(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) return this._createStringValues(column); - else return this._createNumericValues(column); - } - minValue(column) { - this._createMinMaxValues(column); - return this._minValues[column]; - } - maxValue(column) { - this._createMinMaxValues(column); - return this._maxValues[column]; - } - distinctStrings(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - return this._distinctStrings[column]; - } else return null; - } - toJSON(ids, columns) { - const rows = []; - for(let i = 0; i < ids.length; i++){ - const rowIndex = ids[i]; - const row = []; - for(let j = 0; j < columns.length; j++){ - const columnIndex = columns[j]; - switch(this._columnTypes[columnIndex]){ - case (0, _tableJs.ColumnType).date: - case (0, _tableJs.ColumnType).string: - row.push(this._data[rowIndex][columnIndex]); - break; - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - const numericValues = this._createNumericValues(columnIndex); - row.push(numericValues[rowIndex]); - break; - } - } - rows.push(row); - } - return JSON.stringify(rows); + set rotations(value2) { + if (this._rotations != value2) { + this._rotations = value2; + this._hasChanged = true; + } } - orderedIds(column) { - if (!this._orderedIds[column]) { - const start = window.performance.now(); - const orderedIds = new Uint32Array(this._ids); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - orderedIds.sort(function(a, b) { - return values[a] - values[b]; - }); - this._orderedIds[column] = orderedIds; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered ids ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedIds[column]; + get offsetsX() { + return this._offsetsX; } - orderedValues(column) { - if (!this._orderedValues[column]) { - const start = window.performance.now(); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - const orderedIds = this.orderedIds(column); - const orderedValues = new Float64Array(this._ids.length); - for(let i = 0; i < this._ids.length; i++)orderedValues[i] = values[orderedIds[i]]; - this._orderedValues[column] = orderedValues; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered values ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedValues[column]; - } - distinctStringsOrdered(ids, column, stringValues) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - const distinctStrings = []; - const distinctStringValues = {}; - const set = new Set(); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const string = this._data[id][column]; - let value; - if (!set.has(string)) { - distinctStrings.push(string); - value = set.size; - distinctStringValues[string] = value; - set.add(string); - } else value = distinctStringValues[string]; - stringValues[id] = value; - } - return distinctStrings; - } else return null; - } - _createMinMaxValues(column) { - if (!this._hasMinMaxValues[column]) { - const type = this._columnTypes[column]; - let min, max; - if (type == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - min = 0; - max = this._distinctStrings[column].length - 1; - } else { - const numericValues = this._createNumericValues(column); - min = Number.MAX_VALUE; - max = -Number.MAX_VALUE; - for(let i = 0; i < this._ids.length; i++){ - const id = this._ids[i]; - const value = numericValues[id]; - min = Math.min(min, value); - max = Math.max(max, value); - } - } - this._minValues[column] = min; - this._maxValues[column] = max; - this._hasMinMaxValues[column] = true; - } - } - _createNumericValues(column) { - if (!this._numericValues[column]) { - const numericValues = new Float64Array(this._data.length); - const type = this._columnTypes[column]; - if (type == (0, _tableJs.ColumnType).float) for(let i = 0; i < this._data.length; i++){ - const value = parseFloat(this._data[i][column]); - numericValues[i] = value; - } - else if (type == (0, _tableJs.ColumnType).integer) for(let i = 0; i < this._data.length; i++){ - const value = parseInt(this._data[i][column]); - numericValues[i] = value; - } - else if (type == (0, _tableJs.ColumnType).date) for(let i = 0; i < this._data.length; i++){ - const value = Date.parse(this._data[i][column]); - numericValues[i] = value; - } - this._numericValues[column] = numericValues; - } - return this._numericValues[column]; - } - _createStringValues(column) { - if (!this._stringValues[column]) { - this._stringValues[column] = new Float64Array(this._data.length); - this._distinctStrings[column] = this.distinctStringsOrdered(this._ids, column, this._stringValues[column]); - this._minValues[column] = 0; - this._maxValues[column] = this._distinctStrings[column].length - 1; - this._hasMinMaxValues[column] = true; - } - return this._stringValues[column]; - } -} - -},{"../main.js":"b6Xbk","./table.js":"cNpSp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kVjwp":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureHelper", ()=>TextureHelper); -var _mathJs = require("./math.js"); -class TextureHelper { - static create(gl, width, height, format, type, filter, bytes, internalFormat = format) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, bytes); - return texture; - } - static fromImage(gl, image, mipmaps, filter) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - if (mipmaps && (0, _mathJs.MathHelper).isPowerOf2(image.width) && (0, _mathJs.MathHelper).isPowerOf2(image.height)) gl.generateMipmap(gl.TEXTURE_2D); - else { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - } - gl.bindTexture(gl.TEXTURE_2D, null); - return texture; + set offsetsX(value2) { + if (this._offsetsX != value2) { + this._offsetsX = value2; + this._hasChanged = true; + } } - static cubemapFromImages(gl, images) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); - const targets = [ - gl.TEXTURE_CUBE_MAP_POSITIVE_X, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X, - gl.TEXTURE_CUBE_MAP_POSITIVE_Y, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, - gl.TEXTURE_CUBE_MAP_POSITIVE_Z, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Z - ]; - for(let i = 0; i < 6; i++){ - gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - } - gl.generateMipmap(gl.TEXTURE_CUBE_MAP); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); - return texture; - } -} - -},{"./math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6KTQh":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TreeHelper", ()=>TreeHelper); -class TreeHelper { - static parentChildren(ids, parentIds, childIds) { - const rootIds = []; - const degrees = new Uint32Array(ids.length); - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const parentId = parentIds[index]; - const childId = childIds[index]; - indices[childId] = index; - if (children[parentId] === undefined) { - children[parentId] = []; - degrees[index] = 1; - } - if (parentId < 0 || parentId == childId) rootIds.push(parentId); - else { - children[parentId].push(childId); - degrees[index]++; - } - } - return { - rootIds: rootIds, - indices: indices, - children: children, - degrees: degrees - }; + get offsetsY() { + return this._offsetsY; } - static tree(rootId, indices, children, positions, widths, descendents) { - let nextId = 0; - const idsArray = []; - let maxDescendents = 0; - const buildTree = (parentId)=>{ - const index = indices[parentId]; - idsArray.push(index); - const childIds = children[parentId]; - if (childIds !== undefined) { - const start = nextId; - let total = 0; - for(let i = 0; i < childIds.length; i++){ - buildTree(childIds[i]); - total += descendents[indices[childIds[i]]] + 1; - } - const end = nextId - 1; - positions[index] = (start + end) / 2; - descendents[index] = total; - maxDescendents = Math.max(maxDescendents, total); - widths[index] = end - start + 1; - } else { - widths[index] = 1; - positions[index] = nextId++; - } - }; - buildTree(rootId); - const maxPosition = nextId - 1; - return { - ids: new Uint32Array(idsArray), - maxDescendents: maxDescendents, - maxPosition: maxPosition - }; + set offsetsY(value2) { + if (this._offsetsY != value2) { + this._offsetsY = value2; + this._hasChanged = true; + } } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hTJIH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SetHelper", ()=>SetHelper); -class SetHelper { - static new(a, b) { - a.clear(); - for (let item of b)a.add(item); - } - static union(a, b) { - for (let item of b)a.add(item); - } - static intersection(a, b) { - const c = new Set(b); - for (let item of a)if (!c.has(item)) a.delete(item); - for (let item of b)if (!a.has(item)) a.delete(item); - } - static symmetricDifference(a, b) { - for (let item of b)if (a.has(item)) a.delete(item); - else a.add(item); - } - static difference(a, b) { - for (let item of b)a.delete(item); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cvuqr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfHelper", ()=>SdfHelper); -class SdfHelper { - static _circle(px, py, r) { - return Math.sqrt(px * px + py * py) - r; - } - static _box(px, py, bx, by) { - const dx0 = Math.abs(px) - bx; - const dy0 = Math.abs(py) - by; - const dx1 = Math.max(dx0, 0); - const dy1 = Math.max(dy0, 0); - return Math.sqrt(dx1 * dx1 + dy1 * dy1) + Math.min(Math.max(dx0, dy0), 0); - } - static _create(width, height, edge, sdf) { - const pixels = new Uint8ClampedArray(width * height * 4); - for(let y = 0; y < height; y++)for(let x = 0; x < width; x++){ - const d = edge - sdf(x - width / 2, y - height / 2); - const offset = (x + y * height) * 4; - pixels[offset] = d; - pixels[offset + 1] = d; - pixels[offset + 2] = d; - pixels[offset + 3] = 0xff; - } - return new ImageData(pixels, width, height); - } - static circle(imageWidth, imageHeight, radius, edgeValue) { - const sdf = (x, y)=>this._circle(x, y, radius); - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } - static box(imageWidth, imageHeight, boxWidth, boxHeight, edgeValue, rounding = 0) { - const sdf = (x, y)=>this._box(x, y, boxWidth - rounding, boxHeight - rounding) - rounding; - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fLgIj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VectorHelper", ()=>VectorHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class VectorHelper { - static orthonormalBasis(n, b1, b2) { - if (n[0] > 0.9) (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITY); - else (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITX); - (0, _glMatrix.vec3).scaleAndAdd(b1, b1, n, -(0, _glMatrix.vec3).dot(b1, n)); - (0, _glMatrix.vec3).normalize(b1, b1); - (0, _glMatrix.vec3).cross(b2, n, b1); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7e7Mi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>(0, _barJs.Bar)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Line", ()=>(0, _lineJs.Line)); -parcelHelpers.export(exports, "Tree", ()=>(0, _treeJs.Tree)); -parcelHelpers.export(exports, "PythagorasTree", ()=>(0, _treeJs.PythagorasTree)); -parcelHelpers.export(exports, "Scatter", ()=>(0, _scatterJs.Scatter)); -parcelHelpers.export(exports, "Sheet", ()=>(0, _sheetJs.Sheet)); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>(0, _treemapJs.SquarifiedTreeMap)); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>(0, _treemapJs.CubifiedTreeMap)); -parcelHelpers.export(exports, "Stack", ()=>(0, _stackJs.Stack)); -parcelHelpers.export(exports, "StackTreeMap", ()=>(0, _stackJs.StackTreeMap)); -var _barJs = require("./bar.js"); -var _cubeJs = require("./cube.js"); -var _lineJs = require("./line.js"); -var _treeJs = require("./tree.js"); -var _scatterJs = require("./scatter.js"); -var _sheetJs = require("./sheet.js"); -var _treemapJs = require("./treemap.js"); -var _stackJs = require("./stack.js"); - -},{"./bar.js":"coa76","./cube.js":"fwMCO","./line.js":"2wx47","./tree.js":"8yKY2","./scatter.js":"kIsBP","./sheet.js":"aH4Zb","./treemap.js":"gDhOz","./stack.js":"9D8OK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"coa76":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>Bar); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Bar extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const heightScaling = options.heightScaling === undefined ? 1 : options.heightScaling; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const paddingX = options.paddingX == undefined ? 0 : options.paddingX * positionScalingX; - const paddingZ = options.paddingZ == undefined ? 0 : options.paddingZ * positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - let positionX, positionY, positionZ; - let sizeX, sizeY, sizeZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(options.heights ? options.heights[id] * heightScaling : heightScaling, minHeight); - positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - positionY = height / 2; - positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - sizeX = (options.sizeX === undefined ? options.sizesX ? options.sizesX[id] : 1 : options.sizeX) * positionScalingX; - sizeY = Math.abs(height); - sizeZ = (options.sizeZ === undefined ? options.sizesZ ? options.sizesZ[id] : 1 : options.sizeZ) * positionScalingZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX - sizeX / 2); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY - sizeY / 2); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ - sizeZ / 2); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX + sizeX / 2); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY + sizeY / 2); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ + sizeZ / 2); - this._sizes[index * 3] = Math.max(sizeX - paddingX, 0); - this._sizes[index * 3 + 1] = sizeY; - this._sizes[index * 3 + 2] = Math.max(sizeZ - paddingZ, 0); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get offsetsZ() { + return this._offsetsZ; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fwMCO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Cube extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + set offsetsZ(value2) { + if (this._offsetsZ != value2) { + this._offsetsZ = value2; + this._hasChanged = true; + } } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.cbrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / (side * side)); - const z = Math.floor((i - y * side * side) / side); - const x = i - y * side * side - z * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = z; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, z); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get offsetScalingX() { + return this._offsetScalingX; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - _vec2[0] = color; - _vec2[1] = color; - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2wx47":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Line", ()=>Line); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Line extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const offsetScaling = options.offsetScaling === undefined ? 1 : options.offsetScaling; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - this._rotations = new Float32Array(buffer.length * 4); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const direction = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; - let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; - let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; - let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; - let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; - let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; - if (fromId == toId) { - this._sizes[index * 3] = 0; - this._sizes[index * 3 + 1] = 0; - this._sizes[index * 3 + 2] = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - } else { - direction[0] = toPositionX - fromPositionX; - direction[1] = toPositionY - fromPositionY; - direction[2] = toPositionZ - fromPositionZ; - let length = (0, _glMatrix.vec3).length(direction); - (0, _glMatrix.vec3).scale(direction, direction, 1 / length); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, direction); - this._rotations[index * 4] = _quat[0]; - this._rotations[index * 4 + 1] = _quat[1]; - this._rotations[index * 4 + 2] = _quat[2]; - this._rotations[index * 4 + 3] = _quat[3]; - if (options.offsets) { - const fromOffset = options.offsets[fromId] * offsetScaling / 2; - const toOffset = options.offsets[toId] * offsetScaling / 2; - toPositionX -= direction[0] * toOffset; - toPositionY -= direction[1] * toOffset; - toPositionZ -= direction[2] * toOffset; - fromPositionX += direction[0] * fromOffset; - fromPositionY += direction[1] * fromOffset; - fromPositionZ += direction[2] * fromOffset; - length = Math.max(length - toOffset - fromOffset, minSize); - } - this._sizes[index * 3 + 1] = Math.max(length * sizeScalingY, minSize); - if (options.lineSizes) { - this._sizes[index * 3] = Math.max(options.lineSizes[id] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.lineSizes[id] * sizeScalingZ, minSize); - } else if (options.endSizes) { - this._sizes[index * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); - } else { - this._sizes[index * 3] = sizeScalingX; - this._sizes[index * 3 + 2] = sizeScalingZ; - } - } - _vec3[0] = (fromPositionX + toPositionX) / 2; - _vec3[1] = (fromPositionY + toPositionY) / 2; - _vec3[2] = (fromPositionZ + toPositionZ) / 2; - this._positions[index * 3] = _vec3[0]; - this._positions[index * 3 + 1] = _vec3[1]; - this._positions[index * 3 + 2] = _vec3[2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + set offsetScalingX(value2) { + if (this._offsetScalingX != value2) { + this._offsetScalingX = value2; + this._hasChanged = true; + } } - update(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const endMinColor = options.endMinColor === undefined ? 0 : options.endMinColor; - const endMaxColor = options.endMaxColor === undefined ? 1 : options.endMaxColor; - const lineMinColor = options.lineMinColor === undefined ? 0 : options.lineMinColor; - const lineMaxColor = options.lineMaxColor === undefined ? 1 : options.lineMaxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - let size; - if (options.endColors) { - size = 1 / (endMaxColor - endMinColor + 1); - const fromColor = (0, _mathJs.MathHelper).normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - const toColor = (0, _mathJs.MathHelper).normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, fromColor, toColor); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else if (options.lineColors) { - size = 1 / (lineMaxColor - lineMinColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.lineColors[id], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8yKY2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PythagorasTree", ()=>PythagorasTree); -parcelHelpers.export(exports, "Tree", ()=>Tree); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class PythagorasTree extends (0, _layoutJs.LayoutBase) { - get levels() { - return this._levels; - } - get maxLevel() { - return this._maxLevel; - } - get volumes() { - return this._volumes; - } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentTranslation = (0, _glMatrix.vec3).create(); - this._parentScale = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - } - static calculateTotalVertices(level) { - return (2 << level) - 1; - } - static calculateMaxLevel(vertices) { - return Math.ceil(Math.log2(vertices + 1)) - 1; + get offsetScalingY() { + return this._offsetScalingY; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const scalingX = options.scalingX === undefined ? 1 : options.scalingX; - const scalingY = options.scalingY === undefined ? 1 : options.scalingY; - const scalingZ = options.scalingZ === undefined ? 1 : options.scalingZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._levels = new Uint32Array(buffer.length); - this._volumes = new Float64Array(buffer.length); - } - this._maxLevel = PythagorasTree.calculateMaxLevel(ids.length); - const lookup = buffer.lookup; - const id = ids[0]; - const index = lookup[id]; - this._levels[index] = 0; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3] = scalingX; - this._sizes[index * 3 + 1] = scalingY; - this._sizes[index * 3 + 2] = scalingZ; - this._volumes[index] = scalingX * scalingY * scalingZ; - this._count = 1; - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(index, ids, lookup, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); + set offsetScalingY(value2) { + if (this._offsetScalingY != value2) { + this._offsetScalingY = value2; + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; + get offsetScalingZ() { + return this._offsetScalingZ; + } + set offsetScalingZ(value2) { + if (this._offsetScalingZ != value2) { + this._offsetScalingZ = value2; + this._hasChanged = true; + } + } + get text() { + return this._text; + } + set text(value2) { + if (this._text != value2) { + this._text = value2; + this._hasChanged = true; + } + } + get horizontalAlignments() { + return this._horizontalAlignments; + } + set horizontalAlignments(value2) { + if (this._horizontalAlignments != value2) { + this._horizontalAlignments = value2; + this._hasChanged = true; + } + } + get verticalAlignments() { + return this._verticalAlignments; + } + set verticalAlignments(value2) { + if (this._verticalAlignments != value2) { + this._verticalAlignments = value2; + this._hasChanged = true; + } + } + get scales() { + return this._scales; + } + set scales(value2) { + if (this._scales != value2) { + this._scales = value2; + this._hasChanged = true; + } + } + get scalesScaling() { + return this._scalesScaling; + } + set scalesScaling(value2) { + if (this._scalesScaling != value2) { + this._scalesScaling = value2; + this._hasChanged = true; + } + } + constructor(core, options) { + super(core, options); + this._quat = create$1(); + this._materials = options.materials; + this._materialType = options.materialType; + this._materialColor = options.materialColors ? null : options.materialColor || core.config.textColor; + this._materialColors = options.materialColors; + this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; + this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; + this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; + this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; + this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; + this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; + this._font = options.font || core.font; + this.text = options.text; + this.positionsX = options.positionsX; + this.positionsY = options.positionsY; + this.positionsZ = options.positionsZ; + this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; + this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; + this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; + this.rotations = options.rotations; + this.offsetsX = options.offsetsX; + this.offsetsY = options.offsetsY; + this.offsetsZ = options.offsetsZ; + this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; + this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; + this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; + if (options.horizontalAlignments) + this.horizontalAlignments = options.horizontalAlignments; + if (options.verticalAlignments) + this.verticalAlignments = options.verticalAlignments; + if (options.scales) + this.scales = options.scales; + this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; + } + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.pickIdLookup = {}; + if (!this._text) { + this._indexCount = 0; + } else { + const start = window.performance.now(); + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; + const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; + const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; + if (this._rotation) { + set$1(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); + } + let glyphs = 0; + for (let i = 0; i < this._text.length; i++) { + const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; + const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; + const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; + const text2 = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); + const scale2 = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const lineHeight2 = this._font.size * scale2; + const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale2; + const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; + switch (horizontalAlignment) { + case HorizontalAlignment.left: + this._offset[0] = offsetX; + break; + case HorizontalAlignment.center: + this._offset[0] = offsetX - width2 / 2; + break; + case HorizontalAlignment.right: + this._offset[0] = offsetX - width2; + break; } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentIndex, ids, lookup, pseudoRandom) { - const parentLevel = this._levels[parentIndex]; - if (parentLevel < this._maxLevel && this._count < ids.length) { - let angle = this._angle + (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - this._parentTranslation[0] = this._positions[parentIndex * 3]; - this._parentTranslation[1] = this._positions[parentIndex * 3 + 1]; - this._parentTranslation[2] = this._positions[parentIndex * 3 + 2]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - this._parentScale[0] = this._sizes[parentIndex * 3]; - this._parentScale[1] = this._sizes[parentIndex * 3 + 1]; - this._parentScale[2] = this._sizes[parentIndex * 3 + 2]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - const childId1 = ids[this._count++]; - const childIndex1 = lookup[childId1]; - let cos = Math.cos(angle); - this._sizes[childIndex1 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex1 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex1 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex1 * 4] = this._childRotation[0]; - this._rotations[childIndex1 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex1 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex1 * 4 + 3] = this._childRotation[3]; - const halfparentScaleX = this._parentScale[0] * 0.5; - const halfparentScaleY = this._parentScale[1] * 0.5; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos + this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos + this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos + this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY - this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY - this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY - this._parentRight[2] * halfparentScaleX; - this._positions[childIndex1 * 3] = childTranslationX; - this._positions[childIndex1 * 3 + 1] = childTranslationY; - this._positions[childIndex1 * 3 + 2] = childTranslationZ; - this._levels[childIndex1] = parentLevel + 1; - this._volumes[childIndex1] = this._sizes[childIndex1 * 3] * this._sizes[childIndex1 * 3 + 1] * this._sizes[childIndex1 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (this._count < ids.length) { - const childId2 = ids[this._count++]; - const childIndex2 = lookup[childId2]; - cos = Math.cos((0, _constantsJs.Constants).PI_OVER_TWO - angle); - this._sizes[childIndex2 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex2 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex2 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle - (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex2 * 4] = this._childRotation[0]; - this._rotations[childIndex2 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex2 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex2 * 4 + 3] = this._childRotation[3]; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos - this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos - this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos - this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY + this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY + this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY + this._parentRight[2] * halfparentScaleX; - this._positions[childIndex2 * 3] = childTranslationX; - this._positions[childIndex2 * 3 + 1] = childTranslationY; - this._positions[childIndex2 * 3 + 2] = childTranslationZ; - this._levels[childIndex2] = parentLevel + 1; - this._volumes[childIndex2] = this._sizes[childIndex2 * 3] * this._sizes[childIndex2 * 3 + 1] * this._sizes[childIndex2 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - this._branch(childIndex1, ids, lookup, pseudoRandom); - this._branch(childIndex2, ids, lookup, pseudoRandom); + const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; + switch (verticalAlignment) { + case VerticalAlignment.top: + this._offset[1] = offsetY - lineHeight2 / 2; + break; + case VerticalAlignment.center: + this._offset[1] = offsetY; + break; + case VerticalAlignment.bottom: + this._offset[1] = offsetY + lineHeight2 / 2; + break; } + this._offset[1] -= maxGlyphTop / 2; + this._offset[2] = offsetZ; + let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; + let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; + let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; + if (this._reverseX) { + positionX = this.minBoundsX + this.maxBoundsX - positionX; + } + if (this._reverseY) { + positionY = this.minBoundsY + this.maxBoundsY - positionY; + } + if (this._reverseZ) { + positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; + } + set$3(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); + if (this._rotations) { + set$1(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.label, this._vec4); + this.pickIdLookup[pickId] = i; + TextHelper.addString(this._font, text2, this._verticesView, this._indices, glyphs, this._vec3, scale2, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); + glyphs += text2.length; + if (glyphs >= this._maxGlyphs) { + glyphs = this._maxGlyphs; + break; + } + } + this._indexCount = glyphs * 6; + this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } } + } } -} -class Tree extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; + } + let ImageVisual$2 = class ImageVisual { + render(elapsedTime, xrFrame) { } - getPositionY(index) { - return this._positions[index * 3 + 1]; + update(elapsedTime) { } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + constructor(image2) { + this.image = image2; } - getSizeX(index) { - return this._sizes[index * 3]; + }; + class ImageBase { + get material() { + return this._material; } - getSizeY(index) { - return this._sizes[index * 3 + 1]; + get vertices() { + return this._vertices; } - getSizeZ(index) { - return this._sizes[index * 3 + 2]; + get indices() { + return this._indices; } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); + get indexCount() { + return this._indexCount; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const rootId = options.rootId; - this._sizeX = options.sizeX === undefined ? 1 : options.sizeX; - this._sizeY = options.sizeY === undefined ? 1 : options.sizeY; - this._sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._lengthScaling = options.lengthScaling === undefined ? 1 : options.lengthScaling; - this._thicknessScaling = options.thicknessScaling === undefined ? 1 : options.thicknessScaling; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - this._randomSplit = options.randomSplit === undefined ? 0 : options.randomSplit; - this._randomLengthScaling = options.randomLengthScaling === undefined ? 0 : options.randomLengthScaling; - this._randomThicknessScaling = options.randomThicknessScaling === undefined ? 0 : options.randomThicknessScaling; - this._minLength = options.minLength === undefined ? 0 : options.minLength; - this._minThickness = options.minThickness === undefined ? 0 : options.minThickness; - this._lengthScalings = options.lengthScalings; - this._thicknessScalings = options.thicknessScalings; - this._splitAngles = options.splitAngles; - this._angles = options.angles; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._parentRights = new Float64Array(buffer.length * 3); - this._parentUps = new Float64Array(buffer.length * 3); - this._parentForwards = new Float64Array(buffer.length * 3); - this._parentTwists = new Float64Array(buffer.length * 4); - } - const lookup = buffer.lookup; - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - const parentId = options.parentIds[index]; - const childId = options.childIds[index]; - indices[childId] = index; - if (childId === rootId) children[rootId] = []; - else { - if (children[parentId] === undefined) children[parentId] = []; - children[parentId].push(childId); - } - } - const index = indices[rootId]; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3 + 1] = this._sizeY; - this._sizes[index * 3] = this._sizeX; - this._sizes[index * 3 + 2] = this._sizeZ; - if (this._lengthScalings) { - this._lengthScaling = this._lengthScalings[index]; - this._sizes[index * 3 + 1] *= this._lengthScaling; - } - if (this._thicknessScalings) { - this._thicknessScaling = this._thicknessScalings[index]; - this._sizes[index * 3] *= this._thicknessScaling; - this._sizes[index * 3 + 2] *= this._thicknessScaling; - } - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(rootId, indices, children, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); + get isInitialized() { + return this._isInitialized; } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentId, indices, children, pseudoRandom) { - const childIds = children[parentId]; - const parentIndex = indices[parentId]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - this._parentUps[parentIndex * 3] = this._parentUp[0]; - this._parentUps[parentIndex * 3 + 1] = this._parentUp[1]; - this._parentUps[parentIndex * 3 + 2] = this._parentUp[2]; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - this._parentTwists[parentIndex * 4] = this._parentTwist[0]; - this._parentTwists[parentIndex * 4 + 1] = this._parentTwist[1]; - this._parentTwists[parentIndex * 4 + 2] = this._parentTwist[2]; - this._parentTwists[parentIndex * 4 + 3] = this._parentTwist[3]; - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - this._parentRights[parentIndex * 3] = this._parentRight[0]; - this._parentRights[parentIndex * 3 + 1] = this._parentRight[1]; - this._parentRights[parentIndex * 3 + 2] = this._parentRight[2]; - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - this._parentForwards[parentIndex * 3] = this._parentForward[0]; - this._parentForwards[parentIndex * 3 + 1] = this._parentForward[1]; - this._parentForwards[parentIndex * 3 + 2] = this._parentForward[2]; - for(let i = 0; i < childIds.length; i++){ - const childId = childIds[i]; - const childIndex = indices[childId]; - const parentScaleX = this._sizes[parentIndex * 3]; - const parentScaleY = this._sizes[parentIndex * 3 + 1]; - const parentScaleZ = this._sizes[parentIndex * 3 + 2]; - this._parentUp[0] = this._parentUps[parentIndex * 3]; - this._parentUp[1] = this._parentUps[parentIndex * 3 + 1]; - this._parentUp[2] = this._parentUps[parentIndex * 3 + 2]; - this._parentTwist[0] = this._parentTwists[parentIndex * 4]; - this._parentTwist[1] = this._parentTwists[parentIndex * 4 + 1]; - this._parentTwist[2] = this._parentTwists[parentIndex * 4 + 2]; - this._parentTwist[3] = this._parentTwists[parentIndex * 4 + 3]; - if (this._lengthScalings) { - const lengthScale = this._lengthScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(this._sizeY * lengthScale, this._minLength); - } else { - const lengthScale = this._lengthScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(parentScaleY * lengthScale, this._minLength); - } - if (this._thicknessScalings) { - const thicknessScale = this._thicknessScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(this._sizeX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(this._sizeZ * thicknessScale, this._minThickness); - } else { - const thicknessScale = this._thicknessScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(parentScaleX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(parentScaleZ * thicknessScale, this._minThickness); - } - let split; - if (this._splitAngles) split = this._splitAngles[childIndex]; - else split = (0, _constantsJs.Constants).TWO_PI * i / childIds.length; - split += (pseudoRandom.nextFloat() * 2 - 1) * this._randomSplit; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, split); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - let angle; - if (this._angles) angle = this._angles[childIndex]; - else angle = this._angle; - angle += (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._childRotation, this._quat); - this._rotations[childIndex * 4] = this._childRotation[0]; - this._rotations[childIndex * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex * 4 + 3] = this._childRotation[3]; - const halfParentScaleY = parentScaleY * 0.5; - const halfChildScaleY = this._sizes[childIndex * 3 + 1] * 0.5; - (0, _glMatrix.vec3).transformQuat(this._vec3, (0, _constantsJs.Constants).VECTOR3_UNITY, this._childRotation); - const childTranslationX = this._positions[parentIndex * 3] + this._parentUp[0] * halfParentScaleY + this._vec3[0] * halfChildScaleY; - const childTranslationY = this._positions[parentIndex * 3 + 1] + this._parentUp[1] * halfParentScaleY + this._vec3[1] * halfChildScaleY; - const childTranslationZ = this._positions[parentIndex * 3 + 2] + this._parentUp[2] * halfParentScaleY + this._vec3[2] * halfChildScaleY; - this._positions[childIndex * 3] = childTranslationX; - this._positions[childIndex * 3 + 1] = childTranslationY; - this._positions[childIndex * 3 + 2] = childTranslationZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (children[childId]) this._branch(childId, indices, children, pseudoRandom); - } - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/angle.js":"hBXkO","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aH4Zb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sheet", ()=>Sheet); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Sheet extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + get mMatrix() { + return this._mMatrix; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.sqrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / side); - const x = i - y * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = 0; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get imageData() { + return this._imageData; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gDhOz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>SquarifiedTreeMap); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>CubifiedTreeMap); -parcelHelpers.export(exports, "TreeMapHelper", ()=>TreeMapHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class SquarifiedTreeMap extends (0, _layoutJs.LayoutBase) { - get positionsX() { - return this._positionsX; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._hasChanged = true; + } } - get positionsY() { - return this._positionsY; + get rotation() { + return this._rotation; } - get sizesX() { - return this._sizesX; + set rotation(value2) { + if (!equals$1(this._rotation, value2)) { + copy$1(this._rotation, value2); + this._hasChanged = true; + } } - get sizesY() { - return this._sizesY; + get position() { + return this._position; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const size = options.size == undefined ? 1 : options.size; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } else if (size <= 0) return; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - } - TreeMapHelper.squarifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, sizeX, sizeY, buffer.lookup); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + set position(value2) { + if (!equals$2(this._position, value2)) { + copy$3(this._position, value2); + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const heights = options.heights; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - let maxHeight; - if (heights) { - maxHeight = 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - maxHeight = Math.max(heights[id], maxHeight); - } - } else maxHeight = 1; - const heightScaling = (this.maxLayoutBoundsZ - this.minLayoutBoundsZ) / maxHeight; - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(heights ? heights[id] * heightScaling : heightScaling, minHeight); - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this.minLayoutBoundsZ + height / 2; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = height * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class CubifiedTreeMap extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - const sizeZ = this.maxLayoutBoundsZ - this.minLayoutBoundsZ; - const minHeight = this._core.config.minCubifiedTreeMapSlice / sizeY; - const side = Math.sqrt(sizeX * sizeZ); - const total = options.sizes ? TreeMapHelper.totalSize(ids, options.sizes, offset, offset + count - 1) : count; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - } - TreeMapHelper.cubifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, this.minLayoutBoundsZ, sizeX, sizeY, sizeZ, side, total, minHeight, isTopToBottom, buffer.lookup); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get texCoord0() { + return this._texCoord0; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TreeMapHelper { - static squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - if (from > to) return; - if (to - from < 2) { - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup); - return; - } - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - const a = sizes ? sizes[ids[to]] / totalSize : 1 / totalSize; - let b = a; - let mid = to; - if (width < height) { - while(mid > from){ - const aspect = TreeMapHelper._aspect(height, width, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(height, width, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width, height * b, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x, y + height * b, width, height * (1 - b), lookup); - } else { - while(mid > from){ - const aspect = TreeMapHelper._aspect(width, height, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(width, height, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width * b, height, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x + width * b, y, width * (1 - b), height, lookup); - } - } - static totalSize(ids, sizes, from, to) { - let size = 0; - for(let i = from; i <= to; i++)size += sizes[ids[i]]; - return size; - } - static _sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - let a = 0; - for(let i = to; i >= from; i--){ - const id = ids[i]; - const index = lookup[id]; - const b = sizes ? sizes[id] / totalSize : 1 / totalSize; - if (width > height) { - sizesY[index] = height; - sizesX[index] = width * b; - positionsY[index] = y + height / 2; - positionsX[index] = x + width * a + width * b / 2; - } else { - sizesX[index] = width; - sizesY[index] = height * b; - positionsX[index] = x + width / 2; - positionsY[index] = y + height * a + height * b / 2; - } - a += b; - } - } - static _aspect(big, small, a, b) { - const x = big * b / (small * a / b); - if (x < 1) return 1 / x; - return x; - } - static cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, to, x, y, z, width, height, depth, side, total, minHeight, isTopToBottom, lookup) { - if (from > to) return; - let sliceHeight = 0; - let sliceTotal = 0; - let previousAspect = 0; - let mid = to; - while(mid >= from){ - const itemSize = sizes ? sizes[ids[mid]] : 1; - sliceTotal += itemSize; - sliceHeight = height * sliceTotal / total; - const remainingHeight = height - sliceHeight; - if (remainingHeight < minHeight) { - mid = from; - const totalSize = sizes ? this.totalSize(ids, sizes, mid, to) : to - from + 1; - sliceHeight = height * totalSize / total; - break; - } - const itemSide = Math.sqrt(itemSize / sliceTotal) * side; - const aspect = itemSide > sliceHeight ? sliceHeight / itemSide : itemSide / sliceHeight; - if (aspect < previousAspect || mid == from) break; - previousAspect = aspect; - mid--; - } - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsZ, sizesX, sizesZ, mid, to, x, z, width, depth, lookup); - for(let j = mid; j <= to; j++){ - const id = ids[j]; - const index = lookup[id]; - sizesY[index] = Math.max(sliceHeight, 0.01); - positionsY[index] = isTopToBottom ? positionsY[index] = y + sliceHeight / 2 : y + height - sliceHeight / 2; - } - TreeMapHelper.cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, mid - 1, x, isTopToBottom ? y + sliceHeight : y, z, width, height - sliceHeight, depth, side, total - sliceTotal, minHeight, isTopToBottom, lookup); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9D8OK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "StackBase", ()=>StackBase); -parcelHelpers.export(exports, "Stack", ()=>Stack); -parcelHelpers.export(exports, "StackTreeMap", ()=>StackTreeMap); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _vertexJs = require("../vertex.js"); -var _treemapJs = require("./treemap.js"); -var _layoutJs = require("./layout.js"); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -class StackBase extends (0, _layoutJs.LayoutBase) { - get maxCount() { - return this._maxCount; - } - get levels() { - return this._levels; - } - get binCounts() { - return this._binCounts; - } - getPositionX(index) { - return this._positionsX[index]; - } - getPositionY(index) { - return this._positionsY[index]; - } - getPositionZ(index) { - return this._positionsZ[index]; - } -} -class Stack extends StackBase { - get maxLevel() { - return this._maxLevel; + set texCoord0(value2) { + if (!equals(this._texCoord0, value2)) { + copy(this._texCoord0, value2); + this._hasChanged = true; + } } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - this._maxLevel = 0; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - this._height = options.height == undefined ? 1 : options.height; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._levels = new Uint32Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinLevel = 0; - let positionX, positionY, positionZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - const binCount = this._binCounts[binId]; - const level = Math.floor(binCount / sizeX / sizeZ); - this._levels[index] = level; - const levelCount = binCount - level * sizeX * sizeZ; - const itemZ = Math.floor(levelCount / sizeX); - const itemX = levelCount - itemZ * sizeX; - positionX = spacingX / 2 + binIdX * (sizeX + spacingX) + itemX + 0.5; - positionY = this._height * (level + 0.5); - positionZ = spacingZ / 2 + binIdZ * (sizeZ + spacingZ) + itemZ + 0.5; - this._positionsX[index] = positionX; - this._positionsY[index] = positionY; - this._positionsZ[index] = positionZ; - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - maxBinLevel = Math.max(maxBinLevel, level); - } - this._maxLevel = maxBinLevel + 1; - this._maxCount = maxBinCount; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = this._maxLevel * this._height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get texCoord1() { + return this._texCoord1; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 - padding : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (this._height - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class StackTreeMap extends StackBase { - get maxTotal() { - return this._maxTotal; - } - get binGroupIds() { - return this._binGroupIds; - } - getSizeX(index) { - return this._sizesX[index]; - } - getSizeY(index) { - return this._sizesY[index]; - } - getSizeZ(index) { - return this._sizesZ[index]; + set texCoord1(value2) { + if (!equals(this._texCoord1, value2)) { + copy(this._texCoord1, value2); + this._hasChanged = true; + } } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const isNormalized = options.isNormalized === undefined ? false : options.isNormalized; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const maxHeight = options.maxHeight === undefined ? 0 : options.maxHeight; - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - this._binIds = new Uint32Array(buffer.length); - this._binGroupIds = new Float64Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - this._binTotals = new Float64Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinTotal = 0; - let height; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - this._binIds[index] = binId; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - this._binTotals[binId] += options.sizes ? options.sizes[id] : 1; - maxBinTotal = Math.max(maxBinTotal, this._binTotals[binId]); - } - if (maxHeight - minHeight > 0) height = maxHeight - minHeight; - else height = Math.ceil(maxBinCount / sizeX / sizeZ); - if (!this._orderedIds || this._orderedIds.length < buffer.length) this._orderedIds = new Uint32Array(buffer.length); - let ids2; - if (options.groupIds || options.sizes) { - if (count == ids.length) this._ids = new Uint32Array(ids); - else { - this._ids = new Uint32Array(count); - for(let i = 0; i < count; i++)this._ids[i] = ids[offset + i]; - } - if (options.groupIds && options.sizes) { - this._ids.sort(function(a, b) { - return options.groupIds[a] == options.groupIds[b] ? options.sizes[a] - options.sizes[b] : options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.groupIds) { - this._ids.sort(function(a, b) { - return options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.sizes) { - this._ids.sort(function(a, b) { - return options.sizes[a] - options.sizes[b]; - }); - ids2 = this._ids; - } - } else ids2 = ids; - const binOffsets = new Uint32Array(this._binCounts.length); - let binOffset = 0; - for(let i = 0; i < this._binCounts.length; i++){ - const binCount = this._binCounts[i]; - binOffsets[i] = binOffset; - binOffset += binCount; - } - for(let i = 0; i < count; i++){ - const id = ids2[i]; - const index = lookup[id]; - const binId = this._binIds[index]; - binOffset = binOffsets[binId]++; - this._orderedIds[binOffset + offset] = id; - } - const minSliceHeight = this._core.config.minCubifiedTreeMapSlice * height; - const side = Math.sqrt(sizeX * sizeZ); - let from = offset; - let isLastInGroup = false; - let isLastInBin = false; - let groupCount = 0; - let groupTotal = 0; - let positionY = 0; - for(let i = 0; i < count; i++){ - const id = this._orderedIds[i + offset]; - const index = lookup[id]; - groupCount++; - groupTotal += options.sizes ? options.sizes[id] : 1; - const binId = this._binIds[index]; - const groupId = options.groupIds ? options.groupIds[id] : 0; - if (i == count - 1) { - isLastInBin = true; - isLastInGroup = true; - } else { - const nextId = this._orderedIds[i + 1 + offset]; - const nextIndex = lookup[nextId]; - const nextBinId = this._binIds[nextIndex]; - const nextGroupId = options.groupIds ? options.groupIds[nextId] : 0; - isLastInBin = binId != nextBinId; - isLastInGroup = groupId != nextGroupId; - } - if (isLastInBin || isLastInGroup) { - const mid = i + offset; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - let groupValue, binValue; - if (options.sizes) { - groupValue = groupTotal; - binValue = isNormalized ? this._binTotals[binId] : maxBinTotal; - } else { - groupValue = groupCount; - binValue = isNormalized ? this._binCounts[binId] : maxBinCount; - } - const groupHeight = height * groupValue / binValue; - if (sizeZ == 1) { - const positionX = spacingX / 2 + binIdX * (sizeX + spacingX); - (0, _treemapJs.TreeMapHelper).squarifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, from, mid, positionX, positionY, sizeX, groupHeight, lookup); - const isRightToLeft = true; - for(let i = from; i <= mid; i++){ - const id = this._orderedIds[i]; - const index = lookup[id]; - this._sizesZ[index] = sizeZ; - this._positionsZ[index] = (binIdZ + 0.5) * (sizeZ + spacingZ); - if (isRightToLeft) this._positionsX[index] = positionX + sizeX - this._positionsX[index] + positionX; - if (!isTopToBottom) this._positionsY[index] = positionY + groupHeight - this._positionsY[index] + positionY; - } - } else (0, _treemapJs.TreeMapHelper).cubifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, from, mid, spacingX / 2 + binIdX * (sizeX + spacingX), positionY, spacingZ / 2 + binIdZ * (sizeZ + spacingZ), sizeX, groupHeight, sizeZ, side, groupValue, minSliceHeight, isTopToBottom, lookup); - if (isLastInGroup) { - isLastInGroup = false; - positionY += groupHeight; - } - if (isLastInBin) { - isLastInBin = false; - positionY = 0; - } - groupCount = 0; - groupTotal = 0; - from = mid + 1; - } - } - this._maxCount = maxBinCount; - this._maxTotal = maxBinTotal; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get minBoundsX() { + return this._minBoundsX; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../vertex.js":"8lW8V","./treemap.js":"gDhOz","./layout.js":"ijsq1","gl-matrix":"erHGu","../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eCWft":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>(0, _keyboardJs.Keyboard)); -parcelHelpers.export(exports, "MouseWheel", ()=>(0, _mousewheelJs.MouseWheel)); -parcelHelpers.export(exports, "Pointers", ()=>(0, _pointersJs.Pointers)); -parcelHelpers.export(exports, "Manipulator", ()=>(0, _manipulatorJs.Manipulator)); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>(0, _manipulationprocessorJs.ManipulationProcessor)); -parcelHelpers.export(exports, "Manager", ()=>(0, _managerJs.Manager)); -var _keyboardJs = require("./keyboard.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _manipulatorJs = require("./manipulator.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _managerJs = require("./manager.js"); - -},{"./keyboard.js":"5tZWK","./mousewheel.js":"gBsJR","./pointers.js":"deD7J","./manipulator.js":"gniz0","./manipulationprocessor.js":"elobQ","./manager.js":"kM2vK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"azoZM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>(0, _fileJs.LocalFile)); -parcelHelpers.export(exports, "XmlHttp", ()=>(0, _xmlHttpJs.XmlHttp)); -var _fileJs = require("./file.js"); -var _xmlHttpJs = require("./xmlHttp.js"); - -},{"./file.js":"alzEA","./xmlHttp.js":"eqQpi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"alzEA":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>LocalFile); -class LocalFile { - constructor(core){} - loadText(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - completed(text); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsText(file); - } - loadImage(file, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - image.src = text; - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsDataURL(file); + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - loadArrayBuffer(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const arrayBuffer = event.target.result; - completed(arrayBuffer); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsArrayBuffer(file); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eqQpi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "XmlHttp", ()=>XmlHttp); -class XmlHttp { - constructor(core){} - loadText(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.responseText); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } - loadImage(url, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - image.src = url; - } - loadArrayBuffer(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.responseType = "arraybuffer"; - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.response); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lHwiA":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>(0, _quadJs.Quad)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Sphere", ()=>(0, _sphereJs.Sphere)); -var _quadJs = require("./quad.js"); -var _cubeJs = require("./cube.js"); -var _sphereJs = require("./sphere.js"); - -},{"./quad.js":"6dxCM","./cube.js":"dYecn","./sphere.js":"2nvcG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aAH73":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererBase", ()=>(0, _rendererJs.RendererBase)); -parcelHelpers.export(exports, "Basic", ()=>_indexJs); -parcelHelpers.export(exports, "Advanced", ()=>_indexJs1); -parcelHelpers.export(exports, "RayTraceWebGPU", ()=>_indexJs2); -var _rendererJs = require("./renderer.js"); -var _indexJs = require("./basic/index.js"); -var _indexJs1 = require("./advanced/index.js"); -var _indexJs2 = require("./raytracewebgpu/index.js"); - -},{"./renderer.js":"as6Zc","./basic/index.js":"fkg7Y","./advanced/index.js":"lu1e0","./raytracewebgpu/index.js":"j817I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"as6Zc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererConfig", ()=>RendererConfig); -parcelHelpers.export(exports, "RendererBase", ()=>RendererBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _axesJs = require("../components/axes/axes.js"); -var _bufferJs = require("../buffer.js"); -var _vertexJs = require("../vertex.js"); -var _labelsJs = require("../components/labels.js"); -var _debugJs = require("../components/debug.js"); -var _controllerJs = require("../components/controller.js"); -var _imageJs = require("../components/image.js"); -var _fontJs = require("../font.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + get minBoundsY() { + return this._minBoundsY; } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class RendererConfig { - reset() {} -} -class RendererBase { - get isInitialized() { - return this._isInitialized; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - get config() { - return this._config; + get minBoundsZ() { + return this._minBoundsZ; } - get devicePixelRatio() { - return this._devicePixelRatio; + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - get width() { - return this._canvas.width; + get maxBoundsX() { + return this._maxBoundsX; } - set width(value) { - this._options.width = value; + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - get height() { - return this._canvas.height; + get maxBoundsY() { + return this._maxBoundsY; } - set height(value) { - this._options.height = value; + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - get webXRReferenceSpace() { - return this._webXRReferenceSpace; + get maxBoundsZ() { + return this._maxBoundsZ; } - get pickedType() { - return this._pickedType; + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - get pickedId() { - return this._pickedId; + constructor(core, options) { + this._core = core; + this._mMatrix = create$4(); + this._origin = create$3(); + this._translation = create$3(); + this._scale = create$3(); + this._transform = create$4(); + this._imageData = options.imageData; + this._minBoundsX = options.minBoundsX === void 0 ? 0 : options.minBoundsX; + this._minBoundsY = options.minBoundsY === void 0 ? 0 : options.minBoundsY; + this._minBoundsZ = options.minBoundsZ === void 0 ? 0 : options.minBoundsZ; + this._maxBoundsX = options.maxBoundsX === void 0 ? 1 : options.maxBoundsX; + this._maxBoundsY = options.maxBoundsY === void 0 ? 1 : options.maxBoundsY; + this._maxBoundsZ = options.maxBoundsZ === void 0 ? 1 : options.maxBoundsZ; + this._position = options.position ? clone$4(options.position) : create$3(); + this._rotation = options.rotation ? clone$2(options.rotation) : create$1(); + this._texCoord0 = options.texCoord0 ? clone$1(options.texCoord0) : fromValues(0, 0); + this._texCoord1 = options.texCoord1 ? clone$1(options.texCoord1) : fromValues(1, 1); + this._material = options.material === void 0 ? -1 : options.material; + this._hasChanged = true; } - get isCapturingPickImage() { - return this._isCapturingPickImage; + } + class ImageQuad extends ImageBase { + get width() { + return this._width; } - capturePickImage() { - this._isCapturingPickImage = true; + set width(value2) { + if (this._width != value2) { + this._width = value2; + this._hasChanged = true; + } } - get backgroundColor() { - return this._backgroundColor; + get height() { + return this._height; } - set backgroundColor(value) { - if (!(0, _glMatrix.vec4).exactEquals(value, this._backgroundColor)) this._backgroundColor = value; + set height(value2) { + if (this._height != value2) { + this._height = value2; + this._hasChanged = true; + } } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + constructor(core, options) { + super(core, options); + this._width = options.width === void 0 ? 1 : options.width; + this._height = options.height === void 0 ? 1 : options.height; + this._texTransform = create$4(); + translate(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); + scale$1(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + initialize() { + this._vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); + this._indices = Quad$2.INDICES; + this._indexCount = this._indices.length; + this._isInitialized = true; } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + set$3(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); + subtract(this._translation, this._position, this._origin); + scale(this._translation, this._translation, boundsScaling); + set$3(this._scale, this._width, this._height, 1); + scale(this._scale, this._scale, boundsScaling); + fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); + this._verticesView = Quad$2.normalTextured(this._transform, this._texTransform); + this._vertices = this._verticesView.buffer; + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + } } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + } + class BoundsHelper { + static rotateBounds(minBounds, maxBounds, rotation2, rotatedMinBounds, rotatedMaxBounds, offset2) { + const sizeX = maxBounds[0] - minBounds[0]; + const sizeY = maxBounds[1] - minBounds[1]; + const sizeZ = maxBounds[2] - minBounds[2]; + const min$12 = rotatedMinBounds; + const max$12 = rotatedMaxBounds; + set$3(min$12, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$3(max$12, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const vertices = Cube.POSITIONS; + const position2 = create$3(); + for (let i = 0; i < 8; i++) { + set$3(position2, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); + add(position2, position2, offset2); + transformQuat(position2, position2, rotation2); + subtract(position2, position2, offset2); + min(min$12, min$12, position2); + max(max$12, max$12, position2); + } + add(position2, minBounds, maxBounds); + scale(position2, position2, 0.5); + add(min$12, min$12, position2); + add(max$12, max$12, position2); + } + static cylinder(pa2, pb, radius2, minBounds, maxBounds) { + const a2 = create$3(); + subtract(a2, pb, pa2); + const aa = dot$1(a2, a2); + const ex = radius2 * Math.sqrt(1 - a2[0] * a2[0] / aa); + const ey = radius2 * Math.sqrt(1 - a2[1] * a2[1] / aa); + const ez = radius2 * Math.sqrt(1 - a2[2] * a2[2] / aa); + minBounds[0] = Math.min(pa2[0] - ex, pb[0] - ex); + minBounds[1] = Math.min(pa2[1] - ey, pb[1] - ey); + minBounds[2] = Math.min(pa2[2] - ez, pb[2] - ez); + maxBounds[0] = Math.max(pa2[0] + ex, pb[0] + ex); + maxBounds[1] = Math.max(pa2[1] + ey, pb[1] + ey); + maxBounds[2] = Math.max(pa2[2] + ez, pb[2] + ez); } - swapAxes() { - this._isAxes1Current = !this._isAxes1Current; + } + class LayoutBase { + get facetScaling() { + return this._facetScaling; } - createCartesian2dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + offsetX(facetCoordX) { + return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; } - createCartesian3dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + offsetY(facetCoordY) { + return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; } - _createDebugAxesVisual(debugAxes) { - return null; + offsetZ(facetCoordZ) { + return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; + } + constructor(core) { + this._core = core; + this.modelOriginX = 0; + this.modelOriginY = 0; + this.modelOriginZ = 0; + this.minModelBoundsX = 0; + this.minModelBoundsY = 0; + this.minModelBoundsZ = 0; + this.maxModelBoundsX = 0; + this.maxModelBoundsY = 0; + this.maxModelBoundsZ = 0; + this.minLayoutBoundsX = 0; + this.minLayoutBoundsY = 0; + this.minLayoutBoundsZ = 0; + this.maxLayoutBoundsX = 0; + this.maxLayoutBoundsY = 0; + this.maxLayoutBoundsZ = 0; + this._facetSpacingX = 0; + this._facetSpacingY = 0; + this._facetSpacingZ = 0; + this._facetSizeX = 0; + this._facetSizeY = 0; + this._facetSizeZ = 0; + this._facetsX = 1; + this._facetsY = 1; + this._facetsZ = 1; } - createLabelSetVisual(labelSet) { - return new (0, _labelsJs.LabelSetVisual)(labelSet); + _updateModelBounds(options) { + this.minModelBoundsX = options.minBoundsX === void 0 ? this.minLayoutBoundsX : options.minBoundsX; + this.minModelBoundsY = options.minBoundsY === void 0 ? this.minLayoutBoundsY : options.minBoundsY; + this.minModelBoundsZ = options.minBoundsZ === void 0 ? this.minLayoutBoundsZ : options.minBoundsZ; + this.maxModelBoundsX = options.maxBoundsX === void 0 ? this.maxLayoutBoundsX : options.maxBoundsX; + this.maxModelBoundsY = options.maxBoundsY === void 0 ? this.maxLayoutBoundsY : options.maxBoundsY; + this.maxModelBoundsZ = options.maxBoundsZ === void 0 ? this.maxLayoutBoundsZ : options.maxBoundsZ; + this._isFacetted = options.facetsX !== void 0 && options.facetsX > 1 && options.facetCoordsX != null || options.facetsY !== void 0 && options.facetsY > 1 && options.facetCoordsY != null || options.facetsZ !== void 0 && options.facetsZ > 1 && options.facetCoordsZ != null; + this._facetSpacingX = options.facetSpacingX === void 0 ? 0 : options.facetSpacingX; + this._facetSpacingY = options.facetSpacingY === void 0 ? 0 : options.facetSpacingY; + this._facetSpacingZ = options.facetSpacingZ === void 0 ? 0 : options.facetSpacingZ; + let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._facetSizeX = modelSizeX; + this._facetSizeY = modelSizeY; + this._facetSizeZ = modelSizeZ; + this._facetsX = options.facetCoordsX ? options.facetsX : 1; + this._facetsY = options.facetCoordsY ? options.facetsY : 1; + this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; + this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; + this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; + this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; + this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); + this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); + this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); + this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; + this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; + this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; + modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; + this._facetScaling = maxBounds / this._maxBounds; } - createControllerVisual(controller) { - return new (0, _controllerJs.ControllerVisual)(controller); + resetCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = void 0; + this.minCumulativeLayoutBoundsY = void 0; + this.minCumulativeLayoutBoundsZ = void 0; + this.maxCumulativeLayoutBoundsX = void 0; + this.maxCumulativeLayoutBoundsY = void 0; + this.maxCumulativeLayoutBoundsZ = void 0; } - createTransitionBuffer(ids) { - return new (0, _bufferJs.TransitionBuffer)(this._core, ids); + _updateCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === void 0 ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); + this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === void 0 ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); + this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === void 0 ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); + this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === void 0 ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); + this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === void 0 ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); + this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === void 0 ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); } - createImageVisual(image) { - return new (0, _imageJs.ImageVisual)(image); + unitToModelSize(unitSize) { + return unitSize / this._boundsScaling; } - createFontVisual(font) { - return new (0, _fontJs.FontVisual)(font); + unitToModelPositionX(unitPositionX) { + return this.unitToModelSize(unitPositionX) + this.modelOriginX; } - constructor(options){ - this._options = options; - this.fonts = {}; + unitToModelPositionY(unitPositionY) { + return this.unitToModelSize(unitPositionY) + this.modelOriginY; } - get isWebXRSupported() { - return false; + unitToModelPositionZ(unitPositionZ) { + return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; } - initialize(core) { - this._core = core; - this._canvas = document.createElement("canvas"); - const contextmenu = this._options && this._options.contextmenu; - if (!contextmenu) this._canvas.addEventListener("contextmenu", (e)=>{ - e.preventDefault(); - }); - this._canvas.tabIndex = this._core.container.tabIndex; - this._canvas.style.display = "block"; - this._canvas.style.touchAction = "none"; - this._core.container.appendChild(this._canvas); - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this.pickPMatrix = (0, _glMatrix.mat4).create(); - this.axesVisibility = (0, _mainJs.AxesVisibility).current; - this._debugAxes = new (0, _debugJs.DebugAxes)(); - this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); - this.transitionTime = 1; - this.transitionBuffers = []; - this.areLabelsVisible = true; - this.labelSets = []; - this.controllers = []; - this.areImagesVisible = true; - this.images = []; - this._viewports = [ - new DOMRect(), - new DOMRect() - ]; - this.isPickingEnabled = false; - this._pickedType = (0, _mainJs.PickType).none; - this._pickedId = 0; - this._lassoMMatrix = (0, _glMatrix.mat4).create(); - this._lassoThickness = (0, _glMatrix.vec2).create(); - this._resizeMinimumDelay = -1; - this._previousResizeWidth = -1; - this._previousResizeHeight = -1; + unitToModelPosition(unitPosition, modelPosition) { + modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); + modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); + modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); } - remove() { - this._core.container.removeChild(this._canvas); + modelToUnitSize(modelSize) { + return modelSize * this._boundsScaling; } - finalize() { - this._isInitialized = false; + modelToUnitPositionX(modelPositionX) { + return (modelPositionX - this.modelOriginX) * this._boundsScaling; } - setSize(elapsedTime) { - if (this._options && this._options.width && this._options.height) { - this._devicePixelRatio = 1; - this._resizeWidth = this._options.width; - this._resizeHeight = this._options.height; - } else { - this._devicePixelRatio = window.devicePixelRatio || 1; - this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; - this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; - } - if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { - this._previousResizeWidth = this._resizeWidth; - this._previousResizeHeight = this._resizeHeight; - this._isResizing = true; - this._resizeElapsedTime = elapsedTime; - } - if (this._isResizing) { - if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { - this._isResizing = false; - this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; - this._resize(this._resizeWidth, this._resizeHeight); - } else this._resizeElapsedTime += elapsedTime; - } - } - _resize(width, height) { - this._canvas.style.width = `${Math.floor(width / this._devicePixelRatio)}px`; - this._canvas.style.height = `${Math.floor(height / this._devicePixelRatio)}px`; - width = Math.floor(width); - height = Math.floor(height); - this._canvas.width = width; - this._canvas.height = height; + modelToUnitPositionY(modelPositionY) { + return (modelPositionY - this.modelOriginY) * this._boundsScaling; } - update(elapsedTime) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousPalette; - const current = transitionBuffer.currentPalette; - if (previous) previous.update(); - if (current) current.update(); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousAtlas; - const current = transitionBuffer.currentAtlas; - if (previous) previous.update(); - if (current) current.update(); - } - } - if (this._core.config.isDebugVisible) { - if (this._debugAxesVisual) { - this._debugAxesVisual.mMatrix = this.mMatrix; - this._debugAxesVisual.vMatrices = this.vMatrices; - this._debugAxesVisual.pMatrices = this.pMatrices; - this._debugAxesVisual.viewports = this._viewports; - this._debugAxesVisual.viewportOffset = this._viewportOffset; - this._debugAxesVisual.viewportCount = this._viewportCount; - } + modelToUnitPositionZ(modelPositionZ) { + return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + } + modelToUnitPosition(modelPosition, unitPosition) { + unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); + unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); + unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); + } + inclusiveUnitBounds(buffer, ids, unitType, offset2, count2, minBounds, maxBounds) { + set$3(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$3(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const unitScale = create$3(); + const unitRotation = create$1(); + const unitTranslation = create$3(); + const lookup2 = buffer.lookup; + const dataView = buffer.dataView; + let minBounds0; + let maxBounds0; + let minBounds1; + let maxBounds1; + switch (unitType) { + case UnitType.sphere: + case UnitType.sphereSdf: + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getScale(dataView, index2, unitScale); + const radius2 = unitScale[0] / 2; + minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius2); + minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius2); + minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius2); + maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius2); + maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius2); + maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius2); + } + break; + case UnitType.hexPrism: + case UnitType.hexPrismSdf: + case UnitType.block: + case UnitType.blockSdf: + minBounds0 = create$3(); + maxBounds0 = create$3(); + minBounds1 = create$3(); + maxBounds1 = create$3(); + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; + minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; + minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; + maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; + maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; + maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; + BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants.VECTOR3_ZERO); + min(minBounds, minBounds, minBounds1); + max(maxBounds, maxBounds, maxBounds1); + } + break; + case UnitType.cylinder: + case UnitType.cylinderSdf: + minBounds0 = create$3(); + maxBounds0 = create$3(); + const pa2 = create$3(); + const pb = create$3(); + const identityRotation = Constants.VECTOR3_UNITY; + let ca; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + const length2 = unitScale[1]; + const radius2 = Math.max(unitScale[0], unitScale[2]); + if (length2 != 0 && radius2 != 0) { + if (equals$1(unitRotation, Constants.QUAT_IDENTITY)) { + ca = identityRotation; + } else { + ca = create$3(); + transformQuat(ca, identityRotation, unitRotation); + } + scaleAndAdd(pa2, unitTranslation, ca, -length2 * 0.5); + scaleAndAdd(pb, unitTranslation, ca, length2 * 0.5); + BoundsHelper.cylinder(pa2, pb, radius2, minBounds0, maxBounds0); + min(minBounds, minBounds, minBounds0); + max(maxBounds, maxBounds, maxBounds0); + } + } + break; + } + } + } + class Scatter extends LayoutBase { + layout(buffer, ids, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const positionScalingX = options.positionScalingX === void 0 ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === void 0 ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === void 0 ? 1 : options.positionScalingZ; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = options.positionsX ? options.positionsX[id2] * positionScalingX : 0; + let positionY = options.positionsY ? options.positionsY[id2] * positionScalingY : 0; + let positionZ = options.positionsZ ? options.positionsZ[id2] * positionScalingZ : 0; + this._positions[index2 * 3] = positionX; + this._positions[index2 * 3 + 1] = positionY; + this._positions[index2 * 3 + 2] = positionZ; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create(); + const _vec3 = create$3(); + const _vec4 = create$2(); + const _quat = create$1(); + const sizeScalingX = options.sizeScaling === void 0 ? options.sizeScalingX === void 0 ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === void 0 ? options.sizeScalingY === void 0 ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === void 0 ? options.sizeScalingZ === void 0 ? 1 : options.sizeScalingZ : options.sizeScaling; + const sizesX = options.sizes ? options.sizes : options.sizesX; + const sizesY = options.sizes ? options.sizes : options.sizesY; + const sizesZ = options.sizes ? options.sizes : options.sizesZ; + const minSize = options.minSize === void 0 ? 0 : options.minSize; + const minColor = options.minColor === void 0 ? 0 : options.minColor; + const maxColor = options.maxColor === void 0 ? 1 : options.maxColor; + const minOrder = options.minOrder === void 0 ? 0 : options.minOrder; + const maxOrder = options.maxOrder === void 0 ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === void 0 ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === void 0 ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === void 0 ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === void 0 ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === void 0 ? false : options.reverseX; + const reverseY = options.reverseY === void 0 ? false : options.reverseY; + const reverseZ = options.reverseZ === void 0 ? false : options.reverseZ; + this._updateModelBounds(options); + if (options.rotation) { + _quat[0] = options.rotation[0]; + _quat[1] = options.rotation[1]; + _quat[2] = options.rotation[2]; + _quat[3] = options.rotation[3]; + } else { + rotationTo(_quat, this._core.config.identityRotation, Constants.VECTOR3_UNITY); + } + if (options.texCoord) { + _vec4[0] = options.texCoord[0]; + _vec4[1] = options.texCoord[1]; + _vec4[2] = options.texCoord[2]; + _vec4[3] = options.texCoord[3]; + } + const lookup2 = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options.facetCoordsX ? options.facetCoordsX[id2] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id2] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id2]) : 1) * sizeScalingX, minSize) * this._boundsScaling; + _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id2]) : 1) * sizeScalingY, minSize) * this._boundsScaling; + _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id2]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + if (options.rotations) { + _quat[0] = options.rotations[id2 * 4]; + _quat[1] = options.rotations[id2 * 4 + 1]; + _quat[2] = options.rotations[id2 * 4 + 2]; + _quat[3] = options.rotations[id2 * 4 + 3]; + UnitVertex.setRotation(dataView, index2, _quat); + } else { + UnitVertex.setRotation(dataView, index2, _quat); + } + if (options.colors) { + const size2 = 1 / (maxColor - minColor + 1); + const color2 = MathHelper.normalize(options.colors[id2], minColor, maxColor, size2 / 2, 1 - size2 / 2); + if (options.colors1) { + const color1 = MathHelper.normalize(options.colors1[id2], minColor, maxColor, size2 / 2, 1 - size2 / 2); + set(_vec2, color2, color1); + } else { + set(_vec2, color2, color2); + } + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants.VECTOR2_ONE); } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - this.labelSets[i].label.update(elapsedTime); - labelSetVisual.mMatrix = this.mMatrix; - labelSetVisual.vMatrices = this.vMatrices; - labelSetVisual.pMatrices = this.pMatrices; - labelSetVisual.isPickingEnabled = this.isPickingEnabled; - labelSetVisual.pickPMatrix = this.pickPMatrix; - labelSetVisual.pickVMatrix = this.pickVMatrix; - labelSetVisual.viewports = this._viewports; - labelSetVisual.viewportOffset = this._viewportOffset; - labelSetVisual.viewportCount = this._viewportCount; - labelSetVisual.update(elapsedTime); - } + UnitVertex.setIdHover(dataView, index2, options.hover ? options.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options.selected.has(id2) ? 1 : -1 : 0); + if (options.order !== void 0) { + const order = MathHelper.normalize(options.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual && imageVisual.isVisible) { - const image = this.images[i].image; - image.update(elapsedTime); - imageVisual.mMatrix = this.mMatrix; - imageVisual.vMatrices = this.vMatrices; - imageVisual.pMatrices = this.pMatrices; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.pickPMatrix = this.pickPMatrix; - imageVisual.pickVMatrix = this.pickVMatrix; - imageVisual.viewports = this._viewports; - imageVisual.viewportOffset = this._viewportOffset; - imageVisual.viewportCount = this._viewportCount; - imageVisual.update(elapsedTime); - } + if (options.staggerOrder !== void 0) { + _vec2[1] = options.staggerOrder; + } else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options.material ? options.material : options.materials ? options.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setParameter1(dataView, index2, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id2] : 0); + UnitVertex.setParameter2(dataView, index2, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id2] : 0); + UnitVertex.setSdfBuffer(dataView, index2, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id2] : this._core.config.sdfBorder); + if (options.texCoords) { + _vec4[0] = options.texCoords[id2 * 4]; + _vec4[1] = options.texCoords[id2 * 4 + 1]; + _vec4[2] = options.texCoords[id2 * 4 + 2]; + _vec4[3] = options.texCoords[id2 * 4 + 3]; + UnitVertex.setTexCoord(dataView, index2, _vec4); + } else { + UnitVertex.setTexCoord(dataView, index2, _vec4); + } + UnitVertex.setMatId(dataView, index2, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id2 * 3], options.materialColors[id2 * 3 + 1], options.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id2 * 4], options.segmentColors[id2 * 4 + 1], options.segmentColors[id2 * 4 + 2], options.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + } + fromValues$3(0.2126, 0.7152, 0.0722); + create$3(); + create$3(); + class PathHelper { + static getFilenameWithoutExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") == -1 ? 0 : path2.lastIndexOf("/") + 1; + return path2.substring(start, dot2); + } + } + static getExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1 || dot2 == path2.length - 1) { + return null; + } else { + return path2.substring(dot2 + 1, path2.length); + } + } + static getFilename(path2) { + if (path2.lastIndexOf("/") == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") + 1; + return path2.substring(start, path2.length); + } + } + static getPath(path2) { + if (path2.lastIndexOf("/") == -1) { + return ""; + } else { + return path2.substring(0, path2.lastIndexOf("/")); + } + } + static combine(first, second2) { + const seperator = first.lastIndexOf("/") == first.length - 1; + if (second2.indexOf("/") == 0) { + if (seperator) { + return first.substring(0, first.length - 1) + second2; + } else { + return first + second2; } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - const controller = this.controllers[i].controller; - controller.update(elapsedTime); - controllerVisual.vMatrices = this.vMatrices; - controllerVisual.inverseVMatrices = this.vMatrices; - controllerVisual.pMatrices = this.pMatrices; - controllerVisual.viewports = this._viewports; - controllerVisual.viewportOffset = this._viewportOffset; - controllerVisual.viewportCount = this._viewportCount; - controllerVisual.update(elapsedTime); - } + } else { + if (seperator) { + return first + second2; + } else { + return first + "/" + second2; } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - const axes = axesVisual.axes; - axes.mMatrix = this.mMatrix; - axes.vMatrix = this.vMatrices[0]; - axes.update(elapsedTime); - axesVisual.vMatrices = this.vMatrices; - axesVisual.pMatrices = this.pMatrices; - axesVisual.isPickingEnabled = this.isPickingEnabled; - axesVisual.pickPMatrix = this.pickPMatrix; - axesVisual.pickVMatrix = this.pickVMatrix; - axesVisual.viewports = this._viewports; - axesVisual.viewportOffset = this._viewportOffset; - axesVisual.viewportCount = this._viewportCount; - axesVisual.update(elapsedTime); - } + } + } + } + class TextureHelper { + static create(gl, width2, height2, format2, type2, filter2, bytes, internalFormat = format2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width2, height2, 0, format2, type2, bytes); + return texture; + } + static fromImage(gl, image2, mipmaps, filter2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image2); + if (mipmaps && MathHelper.isPowerOf2(image2.width) && MathHelper.isPowerOf2(image2.height)) + gl.generateMipmap(gl.TEXTURE_2D); + else { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + } + gl.bindTexture(gl.TEXTURE_2D, null); + return texture; + } + static cubemapFromImages(gl, images) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + const targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (let i = 0; i < 6; i++) { + gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + return texture; + } + } + class Line extends LayoutBase { + layout(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const positionScalingX = options.positionScalingX === void 0 ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === void 0 ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === void 0 ? 1 : options.positionScalingZ; + const sizeScalingX = options.sizeScaling === void 0 ? options.sizeScalingX === void 0 ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === void 0 ? options.sizeScalingY === void 0 ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === void 0 ? options.sizeScalingZ === void 0 ? 1 : options.sizeScalingZ : options.sizeScaling; + const minSize = options.minSize === void 0 ? 0 : options.minSize; + const offsetScaling = options.offsetScaling === void 0 ? 1 : options.offsetScaling; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + this._sizes = new Float32Array(buffer.length * 3); + this._rotations = new Float32Array(buffer.length * 4); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const _vec3 = create$3(); + const _quat = create$1(); + const direction = create$3(); + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; + let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; + let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; + let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; + let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; + let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; + if (fromId == toId) { + this._sizes[index2 * 3] = 0; + this._sizes[index2 * 3 + 1] = 0; + this._sizes[index2 * 3 + 2] = 0; + this._rotations[index2 * 4] = 0; + this._rotations[index2 * 4 + 1] = 0; + this._rotations[index2 * 4 + 2] = 0; + this._rotations[index2 * 4 + 3] = 1; + } else { + direction[0] = toPositionX - fromPositionX; + direction[1] = toPositionY - fromPositionY; + direction[2] = toPositionZ - fromPositionZ; + let length$12 = length(direction); + scale(direction, direction, 1 / length$12); + rotationTo(_quat, this._core.config.identityRotation, direction); + this._rotations[index2 * 4] = _quat[0]; + this._rotations[index2 * 4 + 1] = _quat[1]; + this._rotations[index2 * 4 + 2] = _quat[2]; + this._rotations[index2 * 4 + 3] = _quat[3]; + if (options.offsets) { + const fromOffset = options.offsets[fromId] * offsetScaling / 2; + const toOffset = options.offsets[toId] * offsetScaling / 2; + toPositionX -= direction[0] * toOffset; + toPositionY -= direction[1] * toOffset; + toPositionZ -= direction[2] * toOffset; + fromPositionX += direction[0] * fromOffset; + fromPositionY += direction[1] * fromOffset; + fromPositionZ += direction[2] * fromOffset; + length$12 = Math.max(length$12 - toOffset - fromOffset, minSize); + } + this._sizes[index2 * 3 + 1] = Math.max(length$12 * sizeScalingY, minSize); + if (options.lineSizes) { + this._sizes[index2 * 3] = Math.max(options.lineSizes[id2] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options.lineSizes[id2] * sizeScalingZ, minSize); + } else if (options.endSizes) { + this._sizes[index2 * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); + } else { + this._sizes[index2 * 3] = sizeScalingX; + this._sizes[index2 * 3 + 2] = sizeScalingZ; + } + } + _vec3[0] = (fromPositionX + toPositionX) / 2; + _vec3[1] = (fromPositionY + toPositionY) / 2; + _vec3[2] = (fromPositionZ + toPositionZ) / 2; + this._positions[index2 * 3] = _vec3[0]; + this._positions[index2 * 3 + 1] = _vec3[1]; + this._positions[index2 * 3 + 2] = _vec3[2]; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + update(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create(); + const _vec3 = create$3(); + const _quat = create$1(); + const endMinColor = options.endMinColor === void 0 ? 0 : options.endMinColor; + const endMaxColor = options.endMaxColor === void 0 ? 1 : options.endMaxColor; + const lineMinColor = options.lineMinColor === void 0 ? 0 : options.lineMinColor; + const lineMaxColor = options.lineMaxColor === void 0 ? 1 : options.lineMaxColor; + const minOrder = options.minOrder === void 0 ? 0 : options.minOrder; + const maxOrder = options.maxOrder === void 0 ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === void 0 ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === void 0 ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === void 0 ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === void 0 ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === void 0 ? false : options.reverseX; + const reverseY = options.reverseY === void 0 ? false : options.reverseY; + const reverseZ = options.reverseZ === void 0 ? false : options.reverseZ; + this._updateModelBounds(options); + const lookup2 = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options.facetCoordsX ? options.facetCoordsX[id2] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id2] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = this._sizes[index2 * 3] * this._boundsScaling; + _vec3[1] = this._sizes[index2 * 3 + 1] * this._boundsScaling; + _vec3[2] = this._sizes[index2 * 3 + 2] * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + _quat[0] = this._rotations[index2 * 4]; + _quat[1] = this._rotations[index2 * 4 + 1]; + _quat[2] = this._rotations[index2 * 4 + 2]; + _quat[3] = this._rotations[index2 * 4 + 3]; + if (reverseX) { + _quat[1] = -_quat[1]; + _quat[2] = -_quat[2]; + } + if (reverseY) { + _quat[0] = -_quat[0]; + _quat[2] = -_quat[2]; + } + if (reverseZ) { + _quat[0] = -_quat[0]; + _quat[1] = -_quat[1]; + } + UnitVertex.setRotation(dataView, index2, _quat); + let size2; + if (options.endColors) { + size2 = 1 / (endMaxColor - endMinColor + 1); + const fromColor = MathHelper.normalize(options.endColors[fromId], endMinColor, endMaxColor, size2 / 2, 1 - size2 / 2); + const toColor = MathHelper.normalize(options.endColors[toId], endMinColor, endMaxColor, size2 / 2, 1 - size2 / 2); + set(_vec2, fromColor, toColor); + UnitVertex.setColor(dataView, index2, _vec2); + } else if (options.lineColors) { + size2 = 1 / (lineMaxColor - lineMinColor + 1); + const color2 = MathHelper.normalize(options.lineColors[id2], lineMinColor, lineMaxColor, size2 / 2, 1 - size2 / 2); + set(_vec2, color2, color2); + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants.VECTOR2_ONE); } - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - const font = fontVisual.font; - font.update(); - fontVisual.update(); - } - } - getVertexPosition(position, pickedId) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[pickedId]; - if (id > -1) { - const index = transitionBuffer.currentBuffer.lookup[id]; - const dataView = transitionBuffer.currentBuffer.dataView; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, position); - break; - } + UnitVertex.setIdHover(dataView, index2, options.hover ? options.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options.selected.has(id2) ? 1 : -1 : 0); + if (options.order !== void 0) { + const order = MathHelper.normalize(options.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); } + if (options.staggerOrder !== void 0) { + _vec2[1] = options.staggerOrder; + } else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options.material ? options.material : options.materials ? options.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setSdfBuffer(dataView, index2, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id2] : this._core.config.sdfBorder); + UnitVertex.setMatId(dataView, index2, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id2 * 3], options.materialColors[id2 * 3 + 1], options.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id2 * 4], options.segmentColors[id2 * 4 + 1], options.segmentColors[id2 * 4 + 2], options.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() {}); + } + class AtlasBase { + get imageData() { + return this._imageData; } - prepare(xrFrame) {} - initializeWebXR(session) { - return null; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._changed = true; + } } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../components/axes/axes.js":"4X9HQ","../buffer.js":"8oaJi","../vertex.js":"8lW8V","../components/labels.js":"dXJPK","../components/debug.js":"1WLrb","../components/controller.js":"3tuGu","../components/image.js":"eexvE","../font.js":"fn4YW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8oaJi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BufferBase", ()=>BufferBase); -parcelHelpers.export(exports, "TransitionBufferBase", ()=>TransitionBufferBase); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _paletteJs = require("./palette.js"); -var _vertexJs = require("./vertex.js"); -var _pickJs = require("./helpers/pick.js"); -var _mainJs = require("./main.js"); -var _atlasJs = require("./atlas.js"); -class BufferBase { + constructor() { + this._imageData = null; + } + copyFrom(atlas) { + if (atlas.imageData) { + this._imageData = atlas.imageData; + this._changed = true; + } else { + this.imageData = null; + } + } + update() { + } + } + let Atlas$2 = class Atlas extends AtlasBase { + }; + class BufferBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get ids() { - return this._ids; + return this._ids; } get dataView() { - return this._dataView; + return this._dataView; } get vertices() { - return this._vertices; + return this._vertices; } get lookup() { - return this._lookup; + return this._lookup; } get length() { - return this._length; + return this._length; } get selected() { - return this._selected; - } - constructor(core, ids){ - this._core = core; - this._ids = ids; - this._length = ids.length; - this._vertices = new ArrayBuffer(this._length * (0, _vertexJs.UnitVertex).SIZE_BYTES); - this._dataView = new DataView(this._vertices); - this._selected = new Set(); - this.from = 0; - this.to = 1; - this.unitType = (0, _mainJs.UnitType).block; - this._lookup = {}; - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - this._lookup[id] = i; - (0, _vertexJs.UnitVertex).setRotation(this._dataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } + return this._selected; + } + constructor(core, ids) { + this._core = core; + this._ids = ids; + this._length = ids.length; + this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); + this._dataView = new DataView(this._vertices); + this._selected = /* @__PURE__ */ new Set(); + this.from = 0; + this.to = 1; + this.unitType = UnitType.block; + this._lookup = {}; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + this._lookup[id2] = i; + UnitVertex.setRotation(this._dataView, i, Constants.QUAT_IDENTITY); + } } createShared() { - const buffer = Object.create(this); - buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); - buffer._dataView = new DataView(buffer._vertices); - return buffer; + const buffer = Object.create(this); + buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); + buffer._dataView = new DataView(buffer._vertices); + return buffer; } copyFrom(buffer) { - const start = window.performance.now(); - const fromDataView = buffer.dataView; - const toDataView = this._dataView; - const lookup = buffer.lookup; - for(let i = 0; i < this._length; i++){ - const index = lookup[this._ids[i]]; - if (index != null) { - (0, _vertexJs.UnitVertex).copyIdHover(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTranslation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyScale(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRotation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyColor(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySelected(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyMaterial(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRounding(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyOrder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexCoord(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexture(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBuffer(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBorder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter1(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter2(fromDataView, index, toDataView, i); - } else (0, _vertexJs.UnitVertex).setRotation(toDataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } - this.unitType = buffer.unitType; - this._selected = buffer.selected; - this._core.log.write((0, _mainJs.LogLevel).info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - update() {} + const start = window.performance.now(); + const fromDataView = buffer.dataView; + const toDataView = this._dataView; + const lookup2 = buffer.lookup; + for (let i = 0; i < this._length; i++) { + const index2 = lookup2[this._ids[i]]; + if (index2 != null) { + UnitVertex.copyIdHover(fromDataView, index2, toDataView, i); + UnitVertex.copyTranslation(fromDataView, index2, toDataView, i); + UnitVertex.copyScale(fromDataView, index2, toDataView, i); + UnitVertex.copyRotation(fromDataView, index2, toDataView, i); + UnitVertex.copyColor(fromDataView, index2, toDataView, i); + UnitVertex.copySelected(fromDataView, index2, toDataView, i); + UnitVertex.copyMaterial(fromDataView, index2, toDataView, i); + UnitVertex.copyRounding(fromDataView, index2, toDataView, i); + UnitVertex.copyOrder(fromDataView, index2, toDataView, i); + UnitVertex.copyTexCoord(fromDataView, index2, toDataView, i); + UnitVertex.copyTexture(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBuffer(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBorder(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter1(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter2(fromDataView, index2, toDataView, i); + UnitVertex.copyMatId(fromDataView, index2, toDataView, i); + UnitVertex.copyMatColor(fromDataView, index2, toDataView, i); + UnitVertex.copyMatFuzz(fromDataView, index2, toDataView, i); + UnitVertex.copyMatRefractiveIndex(fromDataView, index2, toDataView, i); + UnitVertex.copyMatGloss(fromDataView, index2, toDataView, i); + UnitVertex.copyMatDensity(fromDataView, index2, toDataView, i); + UnitVertex.copySegColor(fromDataView, index2, toDataView, i); + } else { + UnitVertex.setRotation(toDataView, i, Constants.QUAT_IDENTITY); + } + } + this.unitType = buffer.unitType; + this._selected = buffer.selected; + this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + update() { + } updateSelection(options) { - const start = window.performance.now(); - const ids = options && options.ids ? options.ids : this._ids; - const offset = options && options.offset !== undefined ? options.offset : 0; - const count = options && options.count !== undefined ? options.count : ids.length; - const selection = this._selected.size > 0; - const dataView = this._dataView; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = this._lookup[id]; - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? this._selected.has(id) ? 1 : -1 : 0); - } - this.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer update selection ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TransitionBufferBase { + const start = window.performance.now(); + const ids = options && options.ids ? options.ids : this._ids; + const offset2 = options && options.offset !== void 0 ? options.offset : 0; + const count2 = options && options.count !== void 0 ? options.count : ids.length; + const selection = this._selected.size > 0; + const dataView = this._dataView; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = this._lookup[id2]; + UnitVertex.setSelected(dataView, index2, selection ? this._selected.has(id2) ? 1 : -1 : 0); + } + this.update(); + this._core.log.write(LogLevel.info, `buffer update selection ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + } + class TransitionBufferBase { get pickIdLookup() { - return this._pickIdLookup; + return this._pickIdLookup; } get currentBuffer() { - return this._isBuffer1Current ? this._buffer1 : this._buffer2; + return this._isBuffer1Current ? this._buffer1 : this._buffer2; } get previousBuffer() { - return this._isBuffer1Current ? this._buffer2 : this._buffer1; + return this._isBuffer1Current ? this._buffer2 : this._buffer1; } get currentPalette() { - return this._isBuffer1Current ? this._palette1 : this._palette2; + return this._isBuffer1Current ? this._palette1 : this._palette2; } get previousPalette() { - return this._isBuffer1Current ? this._palette2 : this._palette1; + return this._isBuffer1Current ? this._palette2 : this._palette1; } get currentAtlas() { - return this._isBuffer1Current ? this._atlas1 : this._atlas2; + return this._isBuffer1Current ? this._atlas1 : this._atlas2; } get previousAtlas() { - return this._isBuffer1Current ? this._atlas2 : this._atlas1; + return this._isBuffer1Current ? this._atlas2 : this._atlas1; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get length() { - return this._length; - } - constructor(core, ids, bufferType, paletteType, atlasType){ - this.bufferType = bufferType; - this.paletteType = paletteType; - this.atlasType = atlasType; - this._core = core; - this._length = ids.length; - this.id = TransitionBufferBase._id++; - this.isVisible = true; - this.transitionTime = 1; - this.activeId = -1; - const start = window.performance.now(); - this._buffer1 = new bufferType(core, ids); - this._buffer2 = this._buffer1.createShared(); - this._palette1 = new paletteType(); - this._palette2 = new paletteType(); - this._atlas1 = new atlasType(); - this._atlas2 = new atlasType(); - this.isPickingEnabled = true; - this._pickIdLookup = {}; - const dataView1 = this._buffer1.dataView; - const dataView2 = this._buffer2.dataView; - const _vec4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - this._pickIdLookup[pickId] = id; - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).data, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView1, i, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView2, i, _vec4); - } - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); + return this._length; + } + constructor(core, ids, bufferType, paletteType, atlasType) { + this.bufferType = bufferType; + this.paletteType = paletteType; + this.atlasType = atlasType; + this._core = core; + this._length = ids.length; + this.id = TransitionBufferBase._id++; + this.isVisible = true; + this.transitionTime = 1; + this.activeId = -1; + const start = window.performance.now(); + this._buffer1 = new bufferType(core, ids); + this._buffer2 = this._buffer1.createShared(); + this._palette1 = new paletteType(); + this._palette2 = new paletteType(); + this._atlas1 = new atlasType(); + this._atlas2 = new atlasType(); + this.isPickingEnabled = true; + this._pickIdLookup = {}; + const dataView1 = this._buffer1.dataView; + const dataView2 = this._buffer2.dataView; + const _vec4 = create$2(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + const pickId = PickHelper.nextPickId(); + this._pickIdLookup[pickId] = id2; + PickHelper.encodeNumber(pickId, PickType.data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; + UnitVertex.setIdColor(dataView1, i, _vec4); + UnitVertex.setIdColor(dataView2, i, _vec4); + } + this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); } swap() { - this._isBuffer1Current = !this._isBuffer1Current; + this._isBuffer1Current = !this._isBuffer1Current; } copyFrom(transitionBuffer) { - const start = window.performance.now(); - this.key = transitionBuffer.key; - this.isVisible = transitionBuffer.isVisible; - this.transitionTime = transitionBuffer.transitionTime; - this.isPickingEnabled = transitionBuffer.isPickingEnabled; - this.unitType = transitionBuffer.unitType; - this.activeId = transitionBuffer.activeId; - this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); - this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); - this.currentBuffer.update(); - this.previousBuffer.update(); - this.currentPalette.copyFrom(transitionBuffer.currentPalette); - this.previousPalette.copyFrom(transitionBuffer.previousPalette); - this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); - this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } -} -TransitionBufferBase._id = 1; -class Buffer extends BufferBase { - constructor(core, ids){ - super(core, ids); - } -} -class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - } -} - -},{"gl-matrix":"erHGu","./constants.js":"dHTsY","./palette.js":"a14oj","./vertex.js":"8lW8V","./helpers/pick.js":"fOypM","./main.js":"b6Xbk","./atlas.js":"huG9l","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"huG9l":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AtlasBase", ()=>AtlasBase); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -class AtlasBase { - get imageData() { - return this._imageData; + const start = window.performance.now(); + this.key = transitionBuffer.key; + this.isVisible = transitionBuffer.isVisible; + this.transitionTime = transitionBuffer.transitionTime; + this.isPickingEnabled = transitionBuffer.isPickingEnabled; + this.unitType = transitionBuffer.unitType; + this.activeId = transitionBuffer.activeId; + this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); + this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); + this.currentBuffer.update(); + this.previousBuffer.update(); + this.currentPalette.copyFrom(transitionBuffer.currentPalette); + this.previousPalette.copyFrom(transitionBuffer.previousPalette); + this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); + this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); + this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._changed = true; - } + } + TransitionBufferBase._id = 1; + let Buffer$3 = class Buffer extends BufferBase { + constructor(core, ids) { + super(core, ids); } - constructor(){ - this._imageData = null; + }; + let TransitionBuffer$2 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$3, Palette$2, Atlas$2); } - copyFrom(atlas) { - if (atlas.imageData) { - this._imageData = atlas.imageData; - this._changed = true; - } else this.imageData = null; - } - update() {} -} -class Atlas extends AtlasBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1WLrb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxes", ()=>DebugAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class DebugAxes { + }; + class DebugAxes { get vertices() { - return this._vertices; + return this._vertices; } get indices() { - return this._indices; + return this._indices; } get indexCount() { - return this._indexCount; + return this._indexCount; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } initialize() { - let vertexOffset = 0; - let indexOffset = 0; - const axisVertices = (0, _cubeJs.Cube).POSITIONS; - const axisIndices = (0, _cubeJs.Cube).INDICES; - this._vertices = new ArrayBuffer(3 * (0, _vertexJs.PositionColorVertex).SIZE_BYTES * axisVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const verticesView = new DataView(this._vertices); - this._indices = new Uint16Array(3 * axisIndices.length + 4); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - const transform = (0, _glMatrix.mat4).create(); - const length = 1; - const width = 0.01; - transform[0] = length; - transform[5] = width; - transform[10] = width; - transform[12] = 0.5; - transform[13] = 0; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITX, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = length; - transform[10] = width; - transform[12] = 0; - transform[13] = 0.5; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITY, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = width; - transform[10] = length; - transform[12] = 0; - transform[13] = 0; - transform[14] = 0.5; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITZ, transform, vertexOffset, indexOffset); - this._indexCount = this._indices.length; - this._isInitialized = true; + let vertexOffset = 0; + let indexOffset = 0; + const axisVertices = Cube.POSITIONS; + const axisIndices2 = Cube.INDICES; + this._vertices = new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); + const verticesView = new DataView(this._vertices); + this._indices = new Uint16Array(3 * axisIndices2.length + 4); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + const transform2 = create$4(); + const length2 = 1; + const width2 = 0.01; + transform2[0] = length2; + transform2[5] = width2; + transform2[10] = width2; + transform2[12] = 0.5; + transform2[13] = 0; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants.VECTOR3_UNITX, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = length2; + transform2[10] = width2; + transform2[12] = 0; + transform2[13] = 0.5; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants.VECTOR3_UNITY, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = width2; + transform2[10] = length2; + transform2[12] = 0; + transform2[13] = 0; + transform2[14] = 0.5; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants.VECTOR3_UNITZ, transform2, vertexOffset, indexOffset); + this._indexCount = this._indices.length; + this._isInitialized = true; } - update(elapsedTime) {} - _createAxis(axisVertices, axisIndices, verticesView, indices, color, transform, vertexOffset, indexOffset) { - const position = (0, _glMatrix.vec3).create(); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - for(let i = 0; i < vertexCount; i++){ - (0, _glMatrix.vec3).set(position, axisVertices[i * (0, _vertexJs.PositionVertex).SIZE], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionColorVertex).setPosition(verticesView, vertexOffset + i, position); - (0, _vertexJs.PositionColorVertex).setColor(verticesView, vertexOffset + i, color); - } - for(let i = 0; i < indexCount; i++)indices[indexOffset + i] = axisIndices[i] + vertexOffset; - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../meshes/cube.js":"dYecn","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fkg7Y":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"hUucd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hUucd":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _colorJs = require("./shaders/color.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _modelJs = require("./shaders/model.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unithexprismJs = require("./shaders/unithexprism.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _anaglyphJs = require("./shaders/anaglyph.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _pickJs = require("../../helpers/pick.js"); -var _debugJs = require("./components/debug.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _controllerJs = require("./components/controller.js"); -var _imageJs = require("./components/image.js"); -var _vertexJs = require("../../vertex.js"); -var _labelsJs = require("./components/labels.js"); -var _fontJs = require("./font.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + update(elapsedTime) { } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + _createAxis(axisVertices, axisIndices2, verticesView, indices, color2, transform2, vertexOffset, indexOffset) { + const position2 = create$3(); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + for (let i = 0; i < vertexCount; i++) { + set$3(position2, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); + transformMat4$2(position2, position2, transform2); + PositionColorVertex.setPosition(verticesView, vertexOffset + i, position2); + PositionColorVertex.setColor(verticesView, vertexOffset + i, color2); + } + for (let i = 0; i < indexCount; i++) { + indices[indexOffset + i] = axisIndices2[i] + vertexOffset; + } + } + } + var __awaiter$3 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get shaderResources() { - return this._shaderResources; + }; + class RendererConfig { + reset() { } - get colorShader() { - return this._colorShader; + } + class RendererBase { + get isInitialized() { + return this._isInitialized; } - get textureShader() { - return this._textureShader; + get config() { + return this._config; } - get lassoShader() { - return this._lassoShader; + get devicePixelRatio() { + return this._devicePixelRatio; } - get modelShader() { - return this._modelShader; + get width() { + return this._canvas.width; } - get sdfTextShader() { - return this._sdfTextShader; + set width(value2) { + this._options.width = value2; } - get gridShader() { - return this._gridShader; + get height() { + return this._canvas.height; } - get blockShader() { - return this._blockShader; + set height(value2) { + this._options.height = value2; } - get sphereShader() { - return this._sphereShader; + get webXRReferenceSpace() { + return this._webXRReferenceSpace; } - get cyclinderShader() { - return this._cylinderShader; + get pickedType() { + return this._pickedType; } - get hexPrismShader() { - return this._hexPrismShader; + get pickedId() { + return this._pickedId; } - get sdfShader() { - return this._sdfShader; + get isCapturingPickImage() { + return this._isCapturingPickImage; } - get anaglyphShader() { - return this._anaglyphShader; + capturePickImage() { + this._isCapturingPickImage = true; } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + get backgroundColor() { + return this._backgroundColor; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set backgroundColor(value2) { + if (!exactEquals(value2, this._backgroundColor)) { + this._backgroundColor = value2; + } } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + get ambientColor() { + return this._ambientColor; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set ambientColor(value2) { + if (!exactEquals$1(value2, this._ambientColor)) { + this._ambientColor = value2; + } } - get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._directionToCamera = (0, _glMatrix.vec3).create(); - this._directionToLight = (0, _glMatrix.vec3).create(); - this._halfAngle = (0, _glMatrix.vec3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this.depthEnabled = true; + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } - get isWebXRSupported() { - return true; + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; } - initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._colorShader = new (0, _colorJs.Color)(this._core, this); - this._textureShader = new (0, _textureJs.Texture)(this._core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(this._core, this); - this._modelShader = new (0, _modelJs.Model)(this._core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(this._core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(this._core, this); - this._anaglyphShader = new (0, _anaglyphJs.Anaglyph)(this._core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(this._core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(this._core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(this._core, this); - this._hexPrismShader = new (0, _unithexprismJs.UnitHexPrism)(this._core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(this._core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - this._isInitialized = false; - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); - this._isInitialized = true; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._shaderResources.initializeContext(this._gl); - this._colorShader.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._modelShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._anaglyphShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._hexPrismShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._debugAxesVisual.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - this._anaglyphTextures = [ - null, - null - ]; - this.anaglyphFramebuffers = [ - null, - null - ]; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - for(let i = 0; i < this.controllers.length; i++)this.controllers[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - for(let i = 0; i < 2; i++){ - const texture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width, height); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._anaglyphTextures[i] = texture; - this.anaglyphFramebuffers[i] = framebuffer; - } - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + swapAxes() { + this._isAxes1Current = !this._isAxes1Current; } - _createContext(canvas) { - const antialias = this._options ? this._options.antialias === undefined ? true : this._options.antialias : true; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - return canvas.getContext("webgl", { - stencil: true, - alpha: true, - antialias: antialias, - preserveDrawingBuffer: preserveDrawingBuffer - }); + createCartesian2dAxesVisual(axes) { + return new AxesVisual(axes); } - initializeWebXR(session) { - const promise = new Promise((resolve, reject)=>{ - this._gl.makeXRCompatible().then(()=>{ - session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, this._gl), - depthNear: this._core.config.nearPlane, - depthFar: this._core.config.farPlane - }); - session.requestReferenceSpace('local').then((refSpace)=>{ - this._webXRReferenceSpace = refSpace; - resolve(); - }); - }); - }); - return promise; + createCartesian3dAxesVisual(axes) { + return new AxesVisual(axes); } - prepare(xrFrame) { - if (xrFrame) { - const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); - if (pose) { - const glLayer = xrFrame.session.renderState.baseLayer; - for(let i = 0; i < pose.views.length; i++){ - const view = pose.views[i]; - this.vMatrices[i] = view.transform.inverse.matrix; - this.inverseVMatrices[i] = view.transform.matrix; - (0, _glMatrix.mat4).multiply(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); - this.mvMatrices[i] = this._mvMatrices[i]; - this.pMatrices[i] = view.projectionMatrix; - const viewport = glLayer.getViewport(view); - this._viewports[i].x = viewport.x; - this._viewports[i].y = viewport.y; - this._viewports[i].width = viewport.width; - this._viewports[i].height = viewport.height; - this._framebuffers[i] = glLayer.framebuffer; - } - } - this._viewportOffset = 0; - this._viewportCount = 2; - } else { - let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - this._framebuffers[1] = null; - break; - case (0, _mainJs.StereoMode).anaglyph: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = this.anaglyphFramebuffers[0]; - this._framebuffers[1] = this.anaglyphFramebuffers[1]; - break; - case (0, _mainJs.StereoMode).split: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = this._canvas.width / 2; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = null; - this._framebuffers[1] = null; - break; - } - } + _createDebugAxesVisual(debugAxes) { + return null; } - createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; + createLabelSetVisual(labelSet) { + return new LabelSetVisual$2(labelSet); } createControllerVisual(controller) { - const visual = new (0, _controllerJs.ControllerVisual)(this._core, this, controller); - visual.initializeContext(this._gl); - return visual; + return new ControllerVisual$1(controller); } - createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + createTransitionBuffer(ids) { + return new TransitionBuffer$2(this._core, ids); } - createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + createImageVisual(image2) { + return new ImageVisual$2(image2); } - _createDebugAxesVisual(debugAxes) { - return new (0, _debugJs.DebugAxesVisual)(this._core, this, debugAxes); + createFontVisual(font2) { + return new FontVisual$2(font2); } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); + constructor(options) { + this._options = options; + this.fonts = {}; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; + get isWebXRSupported() { + return false; } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; + initialize(core) { + this._core = core; + this._canvas = document.createElement("canvas"); + const contextmenu = this._options && this._options.contextmenu; + if (!contextmenu) { + this._canvas.addEventListener("contextmenu", (e) => { + e.preventDefault(); + }); + } + this._canvas.tabIndex = this._core.container.tabIndex; + this._canvas.style.display = "block"; + this._canvas.style.touchAction = "none"; + this._core.container.appendChild(this._canvas); + this._mvMatrices = [create$4(), create$4()]; + this.pickPMatrix = create$4(); + this.axesVisibility = AxesVisibility.current; + this._debugAxes = new DebugAxes(); + this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); + this.transitionTime = 1; + this.transitionBuffers = []; + this.areLabelsVisible = true; + this.labelSets = []; + this.controllers = []; + this.areImagesVisible = true; + this.images = []; + this._viewports = [new DOMRect(), new DOMRect()]; + this.isPickingEnabled = false; + this._pickedType = PickType.none; + this._pickedId = 0; + this._lassoMMatrix = create$4(); + this._lassoThickness = create(); + this._resizeMinimumDelay = -1; + this._previousResizeWidth = -1; + this._previousResizeHeight = -1; } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; + remove() { + this._core.container.removeChild(this._canvas); } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); + finalize() { + this._isInitialized = false; } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - if (this.depthEnabled) this._gl.enable(this._gl.DEPTH_TEST); - else this._gl.disable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); - if (xrFrame) { - const glLayer = xrFrame.session.renderState.baseLayer; - this._shaderResources.bindFramebuffer(glLayer.framebuffer); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph) { - for(let i = 0; i < 2; i++){ - this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else { - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - if (this._core.config.isDebugVisible) { - this._debugAxesVisual.framebuffers = this._framebuffers; - this._debugAxesVisual.render(elapsedTime, xrFrame); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.framebuffers = this._framebuffers; - axesVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(xrFrame, transitionBuffer); - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.framebuffers = this._framebuffers; - labelSetVisual.render(elapsedTime, xrFrame); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.framebuffers = this._framebuffers; - imageVisual.pickFramebuffer = this._pickFrameBuffer; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - controllerVisual.isRayVisible = this.isPickingEnabled; - controllerVisual.framebuffers = this._framebuffers; - controllerVisual.render(elapsedTime, xrFrame); - } - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - if (this._isCapturingPickImage && this.capturePickImageCallback) { - this._isCapturingPickImage = false; - const data = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); - this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data); - for(let i = 0; i < data.length / 4; i++)if (data[i * 4 + 3] == (0, _mainJs.PickType).data) data[i * 4 + 3] = 255; - else { - data[i * 4] = 0; - data[i * 4 + 1] = 0; - data[i * 4 + 2] = 0; - data[i * 4 + 3] = 0; - } - const length = this._core.config.pickWidth * this._core.config.pickHeight * 4; - const row = this._core.config.pickWidth * 4; - const end = (this._core.config.pickHeight - 1) * row; - const flipped = new Uint8ClampedArray(length); - for(let i = 0; i < length; i += row)flipped.set(data.subarray(i, i + row), end - i); - this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); - } - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { - this._shaderResources.bindFramebuffer(null); - this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); - this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; - this._anaglyphShader.indexBuffer = this._quad.indexBuffer; - this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; - this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; - this._anaglyphShader.prepare(); - this._anaglyphShader.viewport = this._viewports[0]; - this._anaglyphShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - }); + setSize(elapsedTime) { + if (this._options && this._options.width && this._options.height) { + this._devicePixelRatio = 1; + this._resizeWidth = this._options.width; + this._resizeHeight = this._options.height; + } else { + this._devicePixelRatio = window.devicePixelRatio || 1; + this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; + this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; + } + if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { + this._previousResizeWidth = this._resizeWidth; + this._previousResizeHeight = this._resizeHeight; + this._isResizing = true; + this._resizeElapsedTime = elapsedTime; + } + if (this._isResizing) { + if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { + this._isResizing = false; + this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; + this._resize(this._resizeWidth, this._resizeHeight); + } else { + this._resizeElapsedTime += elapsedTime; + } + } } - _renderTransitionBuffer(xrFrame, transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf || unitType == (0, _mainJs.UnitType).ringSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = 0; - this._blockShader.rangeMax = transitionBuffer.length - 1; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.selectedColor = this._core.config.selectionColor; - this._blockShader.hoverColor = this._core.config.hoverColor; - this._blockShader.activeColor = this._core.config.activeColor; - this._blockShader.highlightMode = this._core.config.highlightMode; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.ambient = this._config.ambient; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._blockShader.directionToLight = this._directionToLight; - this._blockShader.halfAngle = this._halfAngle; - } else { - this._blockShader.directionToLight = this._config.directionToLight; - this._blockShader.halfAngle = this._config.halfAngle; - } - this._blockShader.vMatrix = vMatrix; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf || unitType == (0, _mainJs.UnitType).disk)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = 0; - this._sphereShader.rangeMax = transitionBuffer.length - 1; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.selectedColor = this._core.config.selectionColor; - this._sphereShader.hoverColor = this._core.config.hoverColor; - this._sphereShader.activeColor = this._core.config.activeColor; - this._sphereShader.highlightMode = this._core.config.highlightMode; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.ambient = this._config.ambient; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sphereShader.directionToLight = this._directionToLight; - this._sphereShader.halfAngle = this._halfAngle; - } else { - this._sphereShader.directionToLight = this._config.directionToLight; - this._sphereShader.halfAngle = this._config.halfAngle; - } - this._sphereShader.vMatrix = vMatrix; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = 0; - this._cylinderShader.rangeMax = transitionBuffer.length - 1; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.selectedColor = this._core.config.selectionColor; - this._cylinderShader.hoverColor = this._core.config.hoverColor; - this._cylinderShader.activeColor = this._core.config.activeColor; - this._cylinderShader.highlightMode = this._core.config.highlightMode; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.ambient = this._config.ambient; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._cylinderShader.directionToLight = this._directionToLight; - this._cylinderShader.halfAngle = this._halfAngle; - } else { - this._cylinderShader.directionToLight = this._config.directionToLight; - this._cylinderShader.halfAngle = this._config.halfAngle; - } - this._cylinderShader.vMatrix = vMatrix; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._hexPrismShader.isInitialized && (unitType == (0, _mainJs.UnitType).hexPrism || unitType == (0, _mainJs.UnitType).hexPrismSdf)) { - this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; - this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._hexPrismShader.prepare(); - this._hexPrismShader.mMatrix = this.mMatrix; - this._hexPrismShader.time = this.transitionTime; - this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._hexPrismShader.rangeMin = 0; - this._hexPrismShader.rangeMax = transitionBuffer.length - 1; - this._hexPrismShader.hover = hoverId; - this._hexPrismShader.active = activeId; - this._hexPrismShader.selectedColor = this._core.config.selectionColor; - this._hexPrismShader.hoverColor = this._core.config.hoverColor; - this._hexPrismShader.activeColor = this._core.config.activeColor; - this._hexPrismShader.highlightMode = this._core.config.highlightMode; - this._hexPrismShader.specularPower = this._config.specularPower; - this._hexPrismShader.specularIntensity = this._config.specularIntensity; - this._hexPrismShader.ambient = this._config.ambient; - this._hexPrismShader.apply(); - this._hexPrismShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._hexPrismShader.directionToLight = this._directionToLight; - this._hexPrismShader.halfAngle = this._halfAngle; - } else { - this._hexPrismShader.directionToLight = this._config.directionToLight; - this._hexPrismShader.halfAngle = this._config.halfAngle; - } - this._hexPrismShader.vMatrix = vMatrix; - this._hexPrismShader.pMatrix = this.pMatrices[viewport]; - this._hexPrismShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._hexPrismShader.isPickShader = true; - this._hexPrismShader.pMatrix = this.pickPMatrix; - this._hexPrismShader.vMatrix = this.pickVMatrix; - this._hexPrismShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = 0; - this._sdfShader.rangeMax = transitionBuffer.length - 1; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.selectedColor = this._core.config.selectionColor; - this._sdfShader.hoverColor = this._core.config.hoverColor; - this._sdfShader.activeColor = this._core.config.activeColor; - this._sdfShader.highlightMode = this._core.config.highlightMode; - this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 0xff; - this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.ambient = this._config.ambient; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sdfShader.directionToLight = this._directionToLight; - this._sdfShader.halfAngle = this._halfAngle; - } else { - this._sdfShader.directionToLight = this._config.directionToLight; - this._sdfShader.halfAngle = this._config.halfAngle; - } - this._sdfShader.vMatrix = vMatrix; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } + _resize(width2, height2) { + this._canvas.style.width = `${Math.floor(width2 / this._devicePixelRatio)}px`; + this._canvas.style.height = `${Math.floor(height2 / this._devicePixelRatio)}px`; + width2 = Math.floor(width2); + height2 = Math.floor(height2); + this._canvas.width = width2; + this._canvas.height = height2; + } + update(elapsedTime) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousPalette; + const current = transitionBuffer.currentPalette; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousAtlas; + const current = transitionBuffer.currentAtlas; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + if (this._core.config.isDebugVisible) { + if (this._debugAxesVisual) { + this._debugAxesVisual.mMatrix = this.mMatrix; + this._debugAxesVisual.vMatrices = this.vMatrices; + this._debugAxesVisual.pMatrices = this.pMatrices; + this._debugAxesVisual.viewports = this._viewports; + this._debugAxesVisual.viewportOffset = this._viewportOffset; + this._debugAxesVisual.viewportCount = this._viewportCount; + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + this.labelSets[i].label.update(elapsedTime); + labelSetVisual.mMatrix = this.mMatrix; + labelSetVisual.vMatrices = this.vMatrices; + labelSetVisual.pMatrices = this.pMatrices; + labelSetVisual.isPickingEnabled = this.isPickingEnabled; + labelSetVisual.pickPMatrix = this.pickPMatrix; + labelSetVisual.pickVMatrix = this.pickVMatrix; + labelSetVisual.viewports = this._viewports; + labelSetVisual.viewportOffset = this._viewportOffset; + labelSetVisual.viewportCount = this._viewportCount; + labelSetVisual.update(elapsedTime); + } + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual && imageVisual.isVisible) { + const image2 = this.images[i].image; + image2.update(elapsedTime); + imageVisual.mMatrix = this.mMatrix; + imageVisual.vMatrices = this.vMatrices; + imageVisual.pMatrices = this.pMatrices; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.pickPMatrix = this.pickPMatrix; + imageVisual.pickVMatrix = this.pickVMatrix; + imageVisual.viewports = this._viewports; + imageVisual.viewportOffset = this._viewportOffset; + imageVisual.viewportCount = this._viewportCount; + imageVisual.update(elapsedTime); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + const controller = this.controllers[i].controller; + controller.update(elapsedTime); + controllerVisual.vMatrices = this.vMatrices; + controllerVisual.inverseVMatrices = this.vMatrices; + controllerVisual.pMatrices = this.pMatrices; + controllerVisual.viewports = this._viewports; + controllerVisual.viewportOffset = this._viewportOffset; + controllerVisual.viewportCount = this._viewportCount; + controllerVisual.update(elapsedTime); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + const axes = axesVisual.axes; + axes.mMatrix = this.mMatrix; + axes.vMatrix = this.vMatrices[0]; + axes.update(elapsedTime); + axesVisual.vMatrices = this.vMatrices; + axesVisual.pMatrices = this.pMatrices; + axesVisual.isPickingEnabled = this.isPickingEnabled; + axesVisual.pickPMatrix = this.pickPMatrix; + axesVisual.pickVMatrix = this.pickVMatrix; + axesVisual.viewports = this._viewports; + axesVisual.viewportOffset = this._viewportOffset; + axesVisual.viewportCount = this._viewportCount; + axesVisual.update(elapsedTime); + } } + } + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + const font2 = fontVisual.font; + font2.update(); + fontVisual.update(); + } } -} - -},{"gl-matrix":"erHGu","../../main.js":"b6Xbk","../renderer.js":"as6Zc","./components/quad.js":"jADik","./buffer.js":"jvMAm","./config.js":"j6xuo","./shaders/shader.js":"iHdfn","./shaders/color.js":"4deoj","./shaders/texture.js":"3kACR","./shaders/lasso.js":"84GaR","./shaders/model.js":"d1jaI","./shaders/sdftext.js":"fArBv","./shaders/pickgrid.js":"kon45","./shaders/unitblock.js":"hyLH6","./shaders/unitsphere.js":"dcUFE","./shaders/unitcylinder.js":"5MykT","./shaders/unithexprism.js":"1Gq4W","./shaders/unitsdf.js":"Ooz78","./shaders/anaglyph.js":"3ENS2","../../helpers/texture.js":"kVjwp","../../helpers/pick.js":"fOypM","./components/debug.js":"fy6nY","./components/axes/cartesian2d.js":"ePDNv","./components/axes/cartesian3d.js":"eoEim","./components/controller.js":"kScGF","./components/image.js":"43dVw","../../vertex.js":"8lW8V","./components/labels.js":"5z3WR","./font.js":"fn1Fc","./components/lasso.js":"jU67t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jADik":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { - get isInitialized() { - return this._isInitialized; + getVertexPosition(position2, pickedId) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[pickedId]; + if (id2 > -1) { + const index2 = transitionBuffer.currentBuffer.lookup[id2]; + const dataView = transitionBuffer.currentBuffer.dataView; + UnitVertex.getTranslation(dataView, index2, position2); + break; + } + } } - get vertexBuffer() { - return this._vertexBuffer; + render(elapsedTime, xrFrame) { + return __awaiter$3(this, void 0, void 0, function* () { + }); } - get indexBuffer() { - return this._indexBuffer; + prepare(xrFrame) { } - get indexCount() { - return this._indexCount; + initializeWebXR(session) { + return null; } - initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + } + let Quad$1 = class Quad { + get isInitialized() { + return this._isInitialized; } -} - -},{"gl-matrix":"erHGu","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jvMAm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { get vertexBuffer() { - return this._vertexBuffer; - } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + return this._vertexBuffer; } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } + get indexBuffer() { + return this._indexBuffer; } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + get indexCount() { + return this._indexCount; } initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$4(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"../../buffer.js":"8oaJi","../../main.js":"b6Xbk","./atlas.js":"hIdlm","./palette.js":"a6WOR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hIdlm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + }; + let Atlas$1 = class Atlas extends AtlasBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../atlas.js":"huG9l","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a6WOR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } + } + }; + let Palette$1 = class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../palette.js":"a14oj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j6xuo":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } + } + }; + let Buffer$2 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update() { + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + } + }; + let TransitionBuffer$1 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$2, Palette$1, Atlas$1); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + }; + let Config$1 = class Config extends RendererConfig { + constructor() { + super(); + this.reset(); } reset() { - this.specularIntensity = 0.15; - this.specularPower = 150; - this.lightPosition = (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0); - this.ambient = 0.01; - const _quat1 = (0, _glMatrix.quat).create(); - const _quat2 = (0, _glMatrix.quat).create(); - let angle = (0, _angleJs.AngleHelper).degreesToRadians(15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat1, _quat2); - angle = (0, _angleJs.AngleHelper).degreesToRadians(-15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat2, _quat1); - this.directionToLight = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(this.directionToLight, (0, _constantsJs.Constants).VECTOR3_UNITZ, _quat2); - this.halfAngle = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(this.halfAngle, (0, _constantsJs.Constants).VECTOR3_UNITZ, this.directionToLight); - (0, _glMatrix.vec3).normalize(this.halfAngle, this.halfAngle); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../helpers/angle.js":"hBXkO","../renderer.js":"as6Zc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iHdfn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.specularIntensity = 0.15; + this.specularPower = 150; + this.lightPosition = fromValues$3(-0.5, 0.5, 0); + this.ambient = 0.01; + const _quat1 = create$1(); + const _quat2 = create$1(); + let angle2 = AngleHelper.degreesToRadians(15); + setAxisAngle(_quat1, Constants.VECTOR3_UNITX, angle2); + multiply(_quat2, _quat1, _quat2); + angle2 = AngleHelper.degreesToRadians(-15); + setAxisAngle(_quat1, Constants.VECTOR3_UNITY, angle2); + multiply(_quat2, _quat2, _quat1); + this.directionToLight = create$3(); + transformQuat(this.directionToLight, Constants.VECTOR3_UNITZ, _quat2); + this.halfAngle = create$3(); + add(this.halfAngle, Constants.VECTOR3_UNITZ, this.directionToLight); + normalize$2(this.halfAngle, this.halfAngle); + this.isFxaaEnabled = false; + } + }; + let Resources$1 = class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); - this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); - this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); - this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "anaglyph.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n", - "color.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); + this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); + this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); + this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + }; + Resources$1.glsl = { + "anaglyph.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n', + "color.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n', "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", - "lasso.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "model.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "model.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n', "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", - "pickgrid.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n", + "pickgrid.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n', "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n", + "sdftext.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n', "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n", - "unitblock.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitcylinder.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unithexprism.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unithexprism.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n", - "unitsdf.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitsphere.vertex.fx": "#version 100\n#include \"common.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n', + "unitblock.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitcylinder.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unithexprism.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unithexprism.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n', + "unitsdf.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitsphere.vertex.fx": '#version 100\n#include "common.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + let ShaderBase$1 = class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); + } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); } + if (this._haveTexturesChanged) { + this.updateTextures(); + } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources$1.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"ekXmH","../../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4deoj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Color extends (0, _shaderJs.ShaderBase) { + }; + class Color extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._colorAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._colorAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3kACR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + } + let Texture$1 = class Texture extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"84GaR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let Lasso$3 = class Lasso extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d1jaI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Model", ()=>Model); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Model extends (0, _shaderJs.ShaderBase) { + }; + class Model extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); } applyView() { - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fArBv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let SdfText$1 = class SdfText extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kon45":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let PickGrid$1 = class PickGrid extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hyLH6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eEo4k":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -var _mainJs = require("../../../main.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + }; + let UnitShader$1 = class UnitShader extends ShaderBase$1 { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); - this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); - this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); - this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); + this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); + this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); + this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); } _updateCurrentBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); } _updatePreviousBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform1f(this._ambientUniform, this.ambient); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._activeColorUniform, this.activeColor); - this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == (0, _mainJs.HighlightMode).luminance ? 0.0 : 1.0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform1f(this._ambientUniform, this.ambient); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._activeColorUniform, this.activeColor); + this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0 : 1); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); } updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"iHdfn","../../../meshes/cube.js":"dYecn","../../../vertex.js":"8lW8V","../../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dcUFE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); + } + }; + let UnitBlock$1 = class UnitBlock extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + let UnitSphere$1 = class UnitSphere extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5MykT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + }; + let UnitCylinder$1 = class UnitCylinder extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Gq4W":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitHexPrism", ()=>UnitHexPrism); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitHexPrism extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + class UnitHexPrism extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Ooz78":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + } + let UnitSdf$1 = class UnitSdf extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); - this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); + this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ENS2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Anaglyph", ()=>Anaglyph); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Anaglyph extends (0, _shaderJs.ShaderBase) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); + } + }; + class Anaglyph extends ShaderBase$1 { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fy6nY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxesVisual", ()=>DebugAxesVisual); -class DebugAxesVisual { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + } + } + class DebugAxesVisual { get isInitialized() { - return this._isInitialized && this._main.colorShader.isInitialized; + return this._isInitialized && this._main.colorShader.isInitialized; } - constructor(core, main, debugAxes){ - this._main = main; - this._debugAxes = debugAxes; - this.isVisible = true; + constructor(core, main, debugAxes) { + this._main = main; + this._debugAxes = debugAxes; + this.isVisible = true; } initializeContext(gl) { - if (!this._debugAxes.isInitialized) this._debugAxes.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._debugAxes.isInitialized) { + this._debugAxes.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const colorShader = this._main.colorShader; - const shaderResources = this._main.shaderResources; - colorShader.vertexBuffer = this._vertexBuffer; - colorShader.indexBuffer = this._indexBuffer; - colorShader.prepare(); - colorShader.mMatrix = this.mMatrix; - colorShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - colorShader.vMatrix = this.vMatrices[viewport]; - colorShader.pMatrix = this.pMatrices[viewport]; - colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + if (this.isInitialized) { + const colorShader = this._main.colorShader; + const shaderResources = this._main.shaderResources; + colorShader.vertexBuffer = this._vertexBuffer; + colorShader.indexBuffer = this._indexBuffer; + colorShader.prepare(); + colorShader.mMatrix = this.mMatrix; + colorShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + colorShader.vMatrix = this.vMatrices[viewport]; + colorShader.pMatrix = this.pMatrices[viewport]; + colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); } + } } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ePDNv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { + } + let AxesVisualBase$1 = class AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized; + } + get axes() { + return this._axes; + } + constructor(core) { + this._core = core; + this.isVisible = true; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + this._gl = gl; + } + update(elapsedTime) { + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { + } + _renderText() { + } + }; + let Cartesian2dVisual$1 = class Cartesian2dVisual extends AxesVisualBase$1 { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); - } - this._gl.enable(this._gl.CULL_FACE); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } } + } + this._gl.disable(this._gl.CULL_FACE); + const size2 = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size2[axisId2]; + const height2 = size2[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"71uct","../../../../main.js":"b6Xbk","../../../../constants.js":"dHTsY","../../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"71uct":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { - get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; - } - constructor(core){ - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - update(elapsedTime) {} - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eoEim":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { + }; + let Cartesian3dVisual$1 = class Cartesian3dVisual extends AxesVisualBase$1 { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } + } + this._gl.disable(this._gl.CULL_FACE); + const size2 = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size2[axisId2]; + const height2 = size2[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"71uct","../../../../main.js":"b6Xbk","../../../../constants.js":"dHTsY","../../../../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kScGF":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -var _constantsJs = require("../../../constants.js"); -class ControllerVisual { + }; + class ControllerVisual { get isInitialized() { - return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; + return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; } get controller() { - return this._controller; - } - constructor(core, main, controller){ - this._core = core; - this._main = main; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._controller = controller; - this._modelShader = main.modelShader; - this._colorShader = main.colorShader; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.rayMMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._controller; + } + constructor(core, main, controller) { + this._core = core; + this._main = main; + this._mMatrix = create$4(); + this._vec3 = create$3(); + this._controller = controller; + this._modelShader = main.modelShader; + this._colorShader = main.colorShader; + this.mMatrix = create$4(); + this.rayMMatrix = create$4(); + this.isVisible = true; } initializeContext(gl) { - if (!this._controller.isInitialized) this._controller.initialize(); - this._initialize(gl); + if (!this._controller.isInitialized) { + this._controller.initialize(); + } + this._initialize(gl); } _initialize(gl) { - this._gl = gl; - this.modelTexture = (0, _textureJs.TextureHelper).fromImage(gl, this._controller.texture, false, gl.LINEAR); - this._modelVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); - this._modelIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); - this._rayVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); - this._rayIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); - this._isInitialized = true; + this._gl = gl; + this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); + this._modelVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); + this._modelIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); + this._rayVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); + this._rayIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._modelShader.vertexBuffer = this._modelVertexBuffer; - this._modelShader.indexBuffer = this._modelIndexBuffer; - this._modelShader.texture2D = this.modelTexture; - this._modelShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); - this._modelShader.mMatrix = this._mMatrix; - this._modelShader.specularPower = 10; - this._modelShader.specularIntensity = 0.01; - this._modelShader.apply(); - this._modelShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._modelShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.halfAngle = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.vMatrix = this.vMatrices[viewport]; - this._modelShader.pMatrix = this.pMatrices[viewport]; - this._modelShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isRayVisible) { - this._colorShader.vertexBuffer = this._rayVertexBuffer; - this._colorShader.indexBuffer = this._rayIndexBuffer; - this._colorShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); - this._colorShader.mMatrix = this._mMatrix; - this._colorShader.apply(); - this._colorShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._colorShader.vMatrix = this.vMatrices[viewport]; - this._colorShader.pMatrix = this.pMatrices[viewport]; - this._colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); - } - } + if (this.isInitialized) { + this._modelShader.vertexBuffer = this._modelVertexBuffer; + this._modelShader.indexBuffer = this._modelIndexBuffer; + this._modelShader.texture2D = this.modelTexture; + this._modelShader.prepare(); + multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); + this._modelShader.mMatrix = this._mMatrix; + this._modelShader.specularPower = 10; + this._modelShader.specularIntensity = 0.01; + this._modelShader.apply(); + this._modelShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._modelShader.directionToLight = Constants.VECTOR3_UNITZ; + this._modelShader.halfAngle = Constants.VECTOR3_UNITZ; + this._modelShader.vMatrix = this.vMatrices[viewport]; + this._modelShader.pMatrix = this.pMatrices[viewport]; + this._modelShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isRayVisible) { + this._colorShader.vertexBuffer = this._rayVertexBuffer; + this._colorShader.indexBuffer = this._rayIndexBuffer; + this._colorShader.prepare(); + multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); + this._colorShader.mMatrix = this._mMatrix; + this._colorShader.apply(); + this._colorShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._colorShader.vMatrix = this.vMatrices[viewport]; + this._colorShader.pMatrix = this.pMatrices[viewport]; + this._colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); + } } + } } -} - -},{"gl-matrix":"erHGu","../../../helpers/texture.js":"kVjwp","../../../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"43dVw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { + } + let ImageVisual$1 = class ImageVisual { get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; + return this._isInitialized && this._main.textureShader.isInitialized; } get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._image; + } + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$4(); + this.isVisible = true; } initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - const shaderResources = this._main.shaderResources; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.isPickShader = false; - textureShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - textureShader.isPickShader = true; - textureShader.vMatrix = this.pickVMatrix; - textureShader.pMatrix = this.pickPMatrix; - textureShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + if (this.isInitialized) { + const textureShader = this._main.textureShader; + const shaderResources = this._main.shaderResources; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.isPickShader = false; + textureShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + textureShader.isPickShader = true; + textureShader.vMatrix = this.pickVMatrix; + textureShader.pMatrix = this.pickPMatrix; + textureShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); } + } } -} - -},{"gl-matrix":"erHGu","../../../helpers/texture.js":"kVjwp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5z3WR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { + }; + let LabelVisualBase$1 = class LabelVisualBase { get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; + } + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$4(); + this.mMatrix = create$4(); + this.isVisible = true; } initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - } + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } } + } } -} -class LabelVisual extends LabelVisualBase { + }; + let LabelVisual$1 = class LabelVisual extends LabelVisualBase$1 { get label() { - return this._label; + return this._label; } - set text(value) { - this._label.text = value; + set text(value2) { + this._label.text = value2; } get text() { - return this._label.text; + return this._label.text; } - constructor(core, main, label){ - super(core, main, label); + constructor(core, main, label2) { + super(core, main, label2); } -} -class LabelSetVisual extends LabelVisualBase { + }; + let LabelSetVisual$1 = class LabelSetVisual extends LabelVisualBase$1 { get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fn1Fc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { + return this._label; + } + constructor(core, main, label2) { + super(core, main, label2); + } + }; + let FontVisual$1 = class FontVisual { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get font() { - return this._font; + return this._font; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } } update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"kVjwp","../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jU67t":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + }; + let Lasso$2 = class Lasso { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"../../../constants.js":"dHTsY","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lu1e0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"gfDfg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfDfg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _backgroundJs = require("./shaders/background.js"); -var _ssaoJs = require("./shaders/ssao.js"); -var _boxJs = require("./shaders/box.js"); -var _deferredJs = require("./shaders/deferred.js"); -var _combineJs = require("./shaders/combine.js"); -var _dofblurJs = require("./shaders/dofblur.js"); -var _downsampleJs = require("./shaders/downsample.js"); -var _gaussianJs = require("./shaders/gaussian.js"); -var _dofcombineJs = require("./shaders/dofcombine.js"); -var _fxaaJs = require("./shaders/fxaa.js"); -var _brightJs = require("./shaders/bright.js"); -var _angleJs = require("../../helpers/angle.js"); -var _pickJs = require("../../helpers/pick.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _fontJs = require("./font.js"); -var _mathJs = require("./../../helpers/math.js"); -var _constantsJs = require("../../constants.js"); -var _vertexJs = require("../../vertex.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _labelsJs = require("./components/labels.js"); -var _imageJs = require("./components/image.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + }; + var __awaiter$2 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { + }; + let Main$1 = class Main extends RendererBase { get shaderResources() { - return this._shaderResources; + return this._shaderResources; + } + get colorShader() { + return this._colorShader; } get textureShader() { - return this._textureShader; + return this._textureShader; } get lassoShader() { - return this._lassoShader; + return this._lassoShader; + } + get modelShader() { + return this._modelShader; } get sdfTextShader() { - return this._sdfTextShader; + return this._sdfTextShader; } get gridShader() { - return this._gridShader; + return this._gridShader; } get blockShader() { - return this._blockShader; + return this._blockShader; } get sphereShader() { - return this._sphereShader; + return this._sphereShader; } get cyclinderShader() { - return this._cylinderShader; + return this._cylinderShader; + } + get hexPrismShader() { + return this._hexPrismShader; } get sdfShader() { - return this._sdfShader; + return this._sdfShader; + } + get anaglyphShader() { + return this._anaglyphShader; } get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._position = (0, _glMatrix.vec3).create(); - this._direction = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.mat3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._shadowVMatrix = (0, _glMatrix.mat4).create(); - this._shadowPMatrix = (0, _glMatrix.mat4).create(); + return this._config; + } + constructor(options) { + super(options); + this._config = new Config$1(); + this._quad = new Quad$1(); + this._lasso = new Lasso$2(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$2(); + this._mat3 = create$5(); + this._directionToCamera = create$3(); + this._directionToLight = create$3(); + this._halfAngle = create$3(); + this._cameraPosition = create$3(); + this._modelPosition = create$3(); + this.depthEnabled = true; } get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + return this._createContext(document.createElement("canvas")) !== null; + } + get isWebXRSupported() { + return true; } initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._textureShader = new (0, _textureJs.Texture)(core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(core, this); - this._backgroundShader = new (0, _backgroundJs.Background)(core, this); - this._ssaoShader = new (0, _ssaoJs.Ssao)(core, this); - this._boxShader = new (0, _boxJs.Box)(core, this); - this._deferredShader = new (0, _deferredJs.Deferred)(core, this); - this._combineShader = new (0, _combineJs.Combine)(core, this); - this._dofBlurShader = new (0, _dofblurJs.DofBlur)(core, this); - this._downsampleShader = new (0, _downsampleJs.Downsample)(core, this); - this._gaussianShader = new (0, _gaussianJs.Gaussian)(core, this); - this._dofCombineShader = new (0, _dofcombineJs.DofCombine)(core, this); - this._fxaaShader = new (0, _fxaaJs.Fxaa)(core, this); - this._brightPassShader = new (0, _brightJs.Bright)(core, this); + super.initialize(core); + this._shaderResources = new Resources$1(); + this._colorShader = new Color(this._core, this); + this._textureShader = new Texture$1(this._core, this); + this._lassoShader = new Lasso$3(this._core, this); + this._modelShader = new Model(this._core, this); + this._sdfTextShader = new SdfText$1(this._core, this); + this._gridShader = new PickGrid$1(this._core, this); + this._anaglyphShader = new Anaglyph(this._core, this); + this._blockShader = new UnitBlock$1(this._core, this); + this._sphereShader = new UnitSphere$1(this._core, this); + this._cylinderShader = new UnitCylinder$1(this._core, this); + this._hexPrismShader = new UnitHexPrism(this._core, this); + this._sdfShader = new UnitSdf$1(this._core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + this._isInitialized = false; + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); this._isInitialized = true; + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; } _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); - const random = new (0, _mathJs.PseudoRandom)(0); - const _vec3 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._config.ssaoKernelSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - _vec3[2] = random.nextFloat(); - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - (0, _glMatrix.vec3).scale(_vec3, _vec3, random.nextFloat()); - let scale = i / this._config.ssaoKernelSize; - scale = (0, _mathJs.MathHelper).lerp(0.1, 1, scale * scale); - (0, _glMatrix.vec3).scale(_vec3, _vec3, scale); - this._ssaoSampleKernel[i * 3] = _vec3[0]; - this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; - this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; - } - const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); - _vec3[2] = 0; - for(let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - noise[i * 4] = _vec3[0]; - noise[i * 4 + 1] = _vec3[1]; - } - this._ssaoNoiseTexture = this._gl.createTexture(); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); - this._ssaoWidth = -1; - this._ssaoHeight = -1; - this._shadowWidth = -1; - this._shadowHeight = -1; - this._shaderResources.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._backgroundShader.initializeContext(this._gl); - this._ssaoShader.initializeContext(this._gl); - this._boxShader.initializeContext(this._gl); - this._deferredShader.initializeContext(this._gl); - this._combineShader.initializeContext(this._gl); - this._dofBlurShader.initializeContext(this._gl); - this._downsampleShader.initializeContext(this._gl); - this._gaussianShader.initializeContext(this._gl); - this._dofCombineShader.initializeContext(this._gl); - this._fxaaShader.initializeContext(this._gl); - this._brightPassShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._shaderResources.initializeContext(this._gl); + this._colorShader.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._modelShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._anaglyphShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._hexPrismShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._debugAxesVisual.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + this._anaglyphTextures = [null, null]; + this.anaglyphFramebuffers = [null, null]; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + for (let i = 0; i < this.controllers.length; i++) { + this.controllers[i].initializeContext(this._gl); + } + } + _resize(width2, height2) { + super._resize(width2, height2); + for (let i = 0; i < 2; i++) { + const texture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); const renderBuffer = this._gl.createRenderbuffer(); this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width2, height2); const framebuffer = this._gl.createFramebuffer(); this._shaderResources.bindFramebuffer(framebuffer); this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - this._positionTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); - this._colorTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._normalTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._geometryFrameBuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width, height); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._gl.drawBuffers([ - this._gl.COLOR_ATTACHMENT0, - this._gl.COLOR_ATTACHMENT1, - this._gl.COLOR_ATTACHMENT2 - ]); - this._postProcessTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); - this._postProcessTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); - this._postProcessDofTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); - this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); - const widthHalf = Math.round(width / 2); - const heightHalf = Math.round(height / 2); - this._postProcessHalfTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); - this._postProcessHalfTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - this._postProcessQuarterTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); - this._postProcessQuarterTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - this._postProcessEighthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); - this._postProcessEighthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); - const widthSixteenth = Math.round(widthEighth / 2); - const hgeightSixteenth = Math.round(heightEighth / 2); - this._postProcessSixteenthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); - this._postProcessSixteenthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + this._anaglyphTextures[i] = texture; + this.anaglyphFramebuffers[i] = framebuffer; + } + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); } _createContext(canvas) { - let supported = false; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - const options = { - stencil: true, - alpha: false, - antialias: false, - preserveDrawingBuffer: preserveDrawingBuffer - }; - const gl = canvas.getContext("webgl2", options); - if (gl) { - const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); - if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { - const texture = (0, _textureJs1.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); - const framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); - if (status == gl.FRAMEBUFFER_COMPLETE) supported = true; - gl.bindTexture(gl.TEXTURE_2D, null); - } - } - return supported ? gl : null; - } - prepare() { - let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - break; - } - } - createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; - } - createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; - } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); - } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; - } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; - } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; - } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); - } - update(elapsedTime) { - super.update(elapsedTime); - if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { - this._shadowWidth = this._config.shadowWidth; - this._shadowHeight = this._config.shadowHeight; - this._shadowColorTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - this._shadowDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._shadowFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); - } - if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { - this._ssaoWidth = this._config.ssaoWidth; - this._ssaoHeight = this._config.ssaoHeight; - this._ssaoTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); - this._ssaoTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); - } - if (this._config.isDofEnabled && this._config.dofAutoFocus) { - this._core.getModelManipulationOrigin(this._modelManipulationOrigin); - this._core.getModelPosition(this._modelPosition); - (0, _glMatrix.vec3).add(this._position, this._modelManipulationOrigin, this._modelPosition); - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.vec3).subtract(this._position, this._position, this._cameraPosition); - const distance = -this._position[2]; - const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); - this._config.dofFocusDistance = (0, _mathJs.MathHelper).lerp(this._config.dofFocusDistance, distance, amount); - } + const antialias = this._options ? this._options.antialias === void 0 ? true : this._options.antialias : true; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + return canvas.getContext("webgl", { + stencil: true, + alpha: true, + antialias, + preserveDrawingBuffer + }); } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - this._gl.enable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.cullFace(this._gl.BACK); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); - if (this.config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.clear(this._gl.DEPTH_BUFFER_BIT); - (0, _glMatrix.mat4).perspective(this._shadowPMatrix, (0, _angleJs.AngleHelper).degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, this.inverseVMatrices[0]); - (0, _glMatrix.vec3).transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); - (0, _glMatrix.vec3).add(this._position, this._position, this._modelPosition); - (0, _glMatrix.mat4).lookAt(this._shadowVMatrix, this._position, this._modelPosition, (0, _constantsJs.Constants).VECTOR3_UNITY); - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(transitionBuffer); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.geometryFramebuffer = this._geometryFrameBuffer; - axesVisual.render(elapsedTime); - } - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; - labelSetVisual.render(elapsedTime); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.geometryFramebuffer = this._geometryFrameBuffer; - imageVisual.render(elapsedTime); - } - } - if (this._backgroundShader.isInitialized) { - this._backgroundShader.prepare(); - this._backgroundShader.color = (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._backgroundShader.apply(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._gl.bindVertexArray(null); - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { - const viewport = this._viewportOffset; - this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } + initializeWebXR(session) { + const promise = new Promise((resolve2, reject) => { + this._gl.makeXRCompatible().then(() => { + session.updateRenderState({ + baseLayer: new XRWebGLLayer(session, this._gl), + depthNear: this._core.config.nearPlane, + depthFar: this._core.config.farPlane + }); + session.requestReferenceSpace("local").then((refSpace) => { + this._webXRReferenceSpace = refSpace; + resolve2(); + }); }); + }); + return promise; } - _renderTransitionBuffer(transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = currentBuffer.from; - this._blockShader.rangeMax = currentBuffer.to; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._blockShader.vMatrix = this.vMatrices[viewport]; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = true; - this._blockShader.vMatrix = this._shadowVMatrix; - this._blockShader.pMatrix = this._shadowPMatrix; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.isShadowMap = false; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = currentBuffer.from; - this._sphereShader.rangeMax = currentBuffer.to; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sphereShader.vMatrix = this.vMatrices[viewport]; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = true; - this._sphereShader.vMatrix = this._shadowVMatrix; - this._sphereShader.pMatrix = this._shadowPMatrix; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.isShadowMap = false; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = currentBuffer.from; - this._cylinderShader.rangeMax = currentBuffer.to; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._cylinderShader.vMatrix = this.vMatrices[viewport]; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = true; - this._cylinderShader.vMatrix = this._shadowVMatrix; - this._cylinderShader.pMatrix = this._shadowPMatrix; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.isShadowMap = false; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = currentBuffer.from; - this._sdfShader.rangeMax = currentBuffer.to; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sdfShader.vMatrix = this.vMatrices[viewport]; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = true; - this._sdfShader.vMatrix = this._shadowVMatrix; - this._sdfShader.pMatrix = this._shadowPMatrix; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.isShadowMap = false; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } + prepare(xrFrame) { + if (xrFrame) { + const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); + if (pose) { + const glLayer = xrFrame.session.renderState.baseLayer; + for (let i = 0; i < pose.views.length; i++) { + const view = pose.views[i]; + this.vMatrices[i] = view.transform.inverse.matrix; + this.inverseVMatrices[i] = view.transform.matrix; + multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); + this.mvMatrices[i] = this._mvMatrices[i]; + this.pMatrices[i] = view.projectionMatrix; + const viewport = glLayer.getViewport(view); + this._viewports[i].x = viewport.x; + this._viewports[i].y = viewport.y; + this._viewports[i].width = viewport.width; + this._viewports[i].height = viewport.height; + this._framebuffers[i] = glLayer.framebuffer; + } + } + this._viewportOffset = 0; + this._viewportCount = 2; + } else { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + this._framebuffers[1] = null; + break; + case StereoMode.anaglyph: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = this.anaglyphFramebuffers[0]; + this._framebuffers[1] = this.anaglyphFramebuffers[1]; + break; + case StereoMode.split: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = this._canvas.width / 2; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = null; + this._framebuffers[1] = null; + break; } + } } - _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { - if (this._deferredShader.isInitialized) { - this._gl.disable(this._gl.DEPTH_TEST); - let ssaoTexture; - if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { - this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); - ssaoTexture = this._ssaoTexture1; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); - this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; - this._ssaoShader.indexBuffer = this._quad.indexBuffer; - this._ssaoShader.texture2D1 = this._positionTexture; - this._ssaoShader.texture2D2 = this._normalTexture; - this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; - this._ssaoShader.prepare(); - this._ssaoShader.pMatrix = pMatrix; - this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; - this._ssaoShader.ssaoRadius = this._config.ssaoRadius; - this._ssaoShader.ssaoPower = this._config.ssaoPower; - this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; - this._ssaoShader.left = 0; - this._ssaoShader.top = 0; - this._ssaoShader.width = this._config.ssaoWidth; - this._ssaoShader.height = this._config.ssaoHeight; - this._ssaoShader.apply(); - this._ssaoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { - ssaoTexture = this._ssaoTexture2; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); - this._boxShader.vertexBuffer = this._quad.vertexBuffer; - this._boxShader.indexBuffer = this._quad.indexBuffer; - this._boxShader.texture2D = this._ssaoTexture1; - this._boxShader.prepare(); - this._boxShader.left = 0; - this._boxShader.top = 0; - this._boxShader.width = this._config.ssaoWidth; - this._boxShader.height = this._config.ssaoHeight; - this._boxShader.apply(); - this._boxShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); - let postProcessFrameBuffer = this._postProcessFrameBuffer1; - this._shaderResources.bindFramebuffer(postProcessFrameBuffer); - this._deferredShader.vertexBuffer = this._quad.vertexBuffer; - this._deferredShader.indexBuffer = this._quad.indexBuffer; - this._deferredShader.texture2D1 = this._positionTexture; - this._deferredShader.texture2D2 = this._colorTexture; - this._deferredShader.texture2D3 = this._normalTexture; - this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; - this._deferredShader.texture2D5 = this._shadowDepthTexture; - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); - this._deferredShader.prepare(); - this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; - this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; - this._deferredShader.inverseVMatrix = inverseVMatrix; - this._deferredShader.shadowVMatrix = this._shadowVMatrix; - this._deferredShader.shadowPMatrix = this._shadowPMatrix; - this._deferredShader.vMatrix = vMatrix; - this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; - this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; - this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, vMatrix); - (0, _glMatrix.vec3).set(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).normalize(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); - (0, _glMatrix.vec3).subtract(this._direction, this._cameraPosition, this._position); - (0, _glMatrix.vec3).normalize(this._direction, this._direction); - (0, _glMatrix.vec3).add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); - (0, _glMatrix.vec3).normalize(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); - this._deferredShader.left = viewport.left; - this._deferredShader.top = viewport.top; - this._deferredShader.width = viewport.width; - this._deferredShader.height = viewport.height; - this._deferredShader.shadowMapWidth = this._config.shadowWidth; - this._deferredShader.shadowMapHeight = this._config.shadowHeight; - this._deferredShader.ambientIntensity = this._config.ambientIntensity; - this._deferredShader.materialIntensity = this._config.materialIntensity; - this._deferredShader.specularPower = this._config.specularPower; - this._deferredShader.specularIntensity = this._config.specularIntensity; - this._deferredShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - const widthHalf = Math.round(viewport.width / 2); - const heightHalf = Math.round(viewport.height / 2); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - const widthSixteenth = Math.round(widthEighth / 2); - const heightSixteenth = Math.round(heightEighth / 2); - if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; - this._dofBlurShader.indexBuffer = this._quad.indexBuffer; - this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofBlurShader.texture2D2 = this._positionTexture; - this._dofBlurShader.prepare(); - this._dofBlurShader.focusDepth = this._config.dofFocusDistance; - this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; - this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; - this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; - this._dofBlurShader.left = viewport.left; - this._dofBlurShader.top = viewport.top; - this._dofBlurShader.width = viewport.width; - this._dofBlurShader.height = viewport.height; - this._dofBlurShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; - this._dofCombineShader.indexBuffer = this._quad.indexBuffer; - this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofCombineShader.texture2D2 = this._postProcessDofTexture; - this._dofCombineShader.prepare(); - this._dofCombineShader.focusDepth = this._config.dofFocusDistance; - this._dofCombineShader.left = viewport.left; - this._dofCombineShader.top = viewport.top; - this._dofCombineShader.width = viewport.width; - this._dofCombineShader.height = viewport.height; - this._dofCombineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthHalf; - this._brightPassShader.height = heightHalf; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessHalfTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthQuarter; - this._brightPassShader.height = heightQuarter; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessQuarterTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthEighth; - this._brightPassShader.height = heightEighth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessEighthTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthSixteenth; - this._brightPassShader.height = heightSixteenth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessHalfTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthHalf; - this._gaussianShader.height = heightHalf; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessHalfTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessQuarterTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthQuarter; - this._gaussianShader.height = heightQuarter; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessQuarterTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessEighthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthEighth; - this._gaussianShader.height = heightEighth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessEighthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthSixteenth; - this._gaussianShader.height = heightSixteenth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer$1(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createControllerVisual(controller) { + const visual = new ControllerVisual(this._core, this, controller); + visual.initializeContext(this._gl); + return visual; + } + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + _createDebugAxesVisual(debugAxes) { + return new DebugAxesVisual(this._core, this, debugAxes); + } + _createLabelVisual(label2) { + return new LabelVisual$1(this._core, this, label2); + } + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual$1(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; + } + createImageVisual(image2) { + const visual = new ImageVisual$1(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; + } + createFontVisual(font2) { + const visual = new FontVisual$1(this._core, font2); + visual.initializeContext(this._gl); + return visual; + } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); + } + render(elapsedTime, xrFrame) { + return __awaiter$2(this, void 0, void 0, function* () { + if (this.depthEnabled) { + this._gl.enable(this._gl.DEPTH_TEST); + } else { + this._gl.disable(this._gl.DEPTH_TEST); + } + this._gl.enable(this._gl.CULL_FACE); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); + if (xrFrame) { + const glLayer = xrFrame.session.renderState.baseLayer; + this._shaderResources.bindFramebuffer(glLayer.framebuffer); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else if (this._core.config.stereoMode == StereoMode.anaglyph) { + for (let i = 0; i < 2; i++) { + this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else { + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + if (this._core.config.isDebugVisible) { + this._debugAxesVisual.framebuffers = this._framebuffers; + this._debugAxesVisual.render(elapsedTime, xrFrame); + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.framebuffers = this._framebuffers; + axesVisual.render(elapsedTime, xrFrame); } - if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; - this._fxaaShader.indexBuffer = this._quad.indexBuffer; - this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._fxaaShader.prepare(); - this._fxaaShader.left = viewport.left; - this._fxaaShader.top = viewport.top; - this._fxaaShader.width = viewport.width; - this._fxaaShader.height = viewport.height; - this._fxaaShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(xrFrame, transitionBuffer); + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.framebuffers = this._framebuffers; + labelSetVisual.render(elapsedTime, xrFrame); } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.framebuffers = this._framebuffers; + imageVisual.pickFramebuffer = this._pickFrameBuffer; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.render(elapsedTime, xrFrame); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + controllerVisual.isRayVisible = this.isPickingEnabled; + controllerVisual.framebuffers = this._framebuffers; + controllerVisual.render(elapsedTime, xrFrame); + } + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$2(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + if (this._isCapturingPickImage && this.capturePickImageCallback) { + this._isCapturingPickImage = false; + const data2 = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); + this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data2); + for (let i = 0; i < data2.length / 4; i++) { + if (data2[i * 4 + 3] == PickType.data) { + data2[i * 4 + 3] = 255; + } else { + data2[i * 4] = 0; + data2[i * 4 + 1] = 0; + data2[i * 4 + 2] = 0; + data2[i * 4 + 3] = 0; + } + } + const length2 = this._core.config.pickWidth * this._core.config.pickHeight * 4; + const row = this._core.config.pickWidth * 4; + const end = (this._core.config.pickHeight - 1) * row; + const flipped = new Uint8ClampedArray(length2); + for (let i = 0; i < length2; i += row) { + flipped.set(data2.subarray(i, i + row), end - i); + } + this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); + } + } else { + set$2(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._combineShader.vertexBuffer = this._quad.vertexBuffer; - this._combineShader.indexBuffer = this._quad.indexBuffer; - this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - if (this._config.isBloomEnabled) { - this._combineShader.texture2D2 = this._postProcessHalfTexture1; - this._combineShader.texture2D3 = this._postProcessQuarterTexture1; - this._combineShader.texture2D4 = this._postProcessEighthTexture1; - this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; - } else { - this._combineShader.texture2D2 = null; - this._combineShader.texture2D3 = null; - this._combineShader.texture2D4 = null; - this._combineShader.texture2D5 = null; - } - this._combineShader.prepare(); - this._combineShader.viewport = viewport; - this._combineShader.intensity = this._config.bloomIntensity; - this._combineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { + this._shaderResources.bindFramebuffer(null); + this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); + this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; + this._anaglyphShader.indexBuffer = this._quad.indexBuffer; + this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; + this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; + this._anaglyphShader.prepare(); + this._anaglyphShader.viewport = this._viewports[0]; + this._anaglyphShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + }); + } + _renderTransitionBuffer(xrFrame, transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = 0; + this._blockShader.rangeMax = transitionBuffer.length - 1; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.selectedColor = this._core.config.selectionColor; + this._blockShader.hoverColor = this._core.config.hoverColor; + this._blockShader.activeColor = this._core.config.activeColor; + this._blockShader.highlightMode = this._core.config.highlightMode; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.ambient = this._config.ambient; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._blockShader.directionToLight = this._directionToLight; + this._blockShader.halfAngle = this._halfAngle; + } else { + this._blockShader.directionToLight = this._config.directionToLight; + this._blockShader.halfAngle = this._config.halfAngle; + } + this._blockShader.vMatrix = vMatrix; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = 0; + this._sphereShader.rangeMax = transitionBuffer.length - 1; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.selectedColor = this._core.config.selectionColor; + this._sphereShader.hoverColor = this._core.config.hoverColor; + this._sphereShader.activeColor = this._core.config.activeColor; + this._sphereShader.highlightMode = this._core.config.highlightMode; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.ambient = this._config.ambient; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sphereShader.directionToLight = this._directionToLight; + this._sphereShader.halfAngle = this._halfAngle; + } else { + this._sphereShader.directionToLight = this._config.directionToLight; + this._sphereShader.halfAngle = this._config.halfAngle; + } + this._sphereShader.vMatrix = vMatrix; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = 0; + this._cylinderShader.rangeMax = transitionBuffer.length - 1; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.selectedColor = this._core.config.selectionColor; + this._cylinderShader.hoverColor = this._core.config.hoverColor; + this._cylinderShader.activeColor = this._core.config.activeColor; + this._cylinderShader.highlightMode = this._core.config.highlightMode; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.ambient = this._config.ambient; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._cylinderShader.directionToLight = this._directionToLight; + this._cylinderShader.halfAngle = this._halfAngle; + } else { + this._cylinderShader.directionToLight = this._config.directionToLight; + this._cylinderShader.halfAngle = this._config.halfAngle; + } + this._cylinderShader.vMatrix = vMatrix; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { + this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; + this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._hexPrismShader.prepare(); + this._hexPrismShader.mMatrix = this.mMatrix; + this._hexPrismShader.time = this.transitionTime; + this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._hexPrismShader.rangeMin = 0; + this._hexPrismShader.rangeMax = transitionBuffer.length - 1; + this._hexPrismShader.hover = hoverId; + this._hexPrismShader.active = activeId; + this._hexPrismShader.selectedColor = this._core.config.selectionColor; + this._hexPrismShader.hoverColor = this._core.config.hoverColor; + this._hexPrismShader.activeColor = this._core.config.activeColor; + this._hexPrismShader.highlightMode = this._core.config.highlightMode; + this._hexPrismShader.specularPower = this._config.specularPower; + this._hexPrismShader.specularIntensity = this._config.specularIntensity; + this._hexPrismShader.ambient = this._config.ambient; + this._hexPrismShader.apply(); + this._hexPrismShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._hexPrismShader.directionToLight = this._directionToLight; + this._hexPrismShader.halfAngle = this._halfAngle; + } else { + this._hexPrismShader.directionToLight = this._config.directionToLight; + this._hexPrismShader.halfAngle = this._config.halfAngle; + } + this._hexPrismShader.vMatrix = vMatrix; + this._hexPrismShader.pMatrix = this.pMatrices[viewport]; + this._hexPrismShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._hexPrismShader.isPickShader = true; + this._hexPrismShader.pMatrix = this.pickPMatrix; + this._hexPrismShader.vMatrix = this.pickVMatrix; + this._hexPrismShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = 0; + this._sdfShader.rangeMax = transitionBuffer.length - 1; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.selectedColor = this._core.config.selectionColor; + this._sdfShader.hoverColor = this._core.config.hoverColor; + this._sdfShader.activeColor = this._core.config.activeColor; + this._sdfShader.highlightMode = this._core.config.highlightMode; + this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 255; + this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.ambient = this._config.ambient; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sdfShader.directionToLight = this._directionToLight; + this._sdfShader.halfAngle = this._halfAngle; + } else { + this._sdfShader.directionToLight = this._config.directionToLight; + this._sdfShader.halfAngle = this._config.halfAngle; + } + this._sdfShader.vMatrix = vMatrix; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } + } } -} - -},{"gl-matrix":"erHGu","../../main.js":"b6Xbk","../renderer.js":"as6Zc","./components/quad.js":"jnURY","./buffer.js":"ehf4a","./config.js":"cAS6R","./shaders/shader.js":"67Z4f","./shaders/texture.js":"gN1DJ","./shaders/lasso.js":"9ZGAb","./shaders/sdftext.js":"eGxSt","./shaders/pickgrid.js":"cWCAC","./shaders/unitblock.js":"4WGJz","./shaders/unitsphere.js":"3msJ8","./shaders/unitcylinder.js":"fTtgI","./shaders/unitsdf.js":"kAjIu","./shaders/background.js":"6itVY","./shaders/ssao.js":"ju7sc","./shaders/box.js":"3yIW6","./shaders/deferred.js":"dbxlx","./shaders/combine.js":"d4boX","./shaders/dofblur.js":"c0jpv","./shaders/downsample.js":"3sWXu","./shaders/gaussian.js":"g5wih","./shaders/dofcombine.js":"dE6Xe","./shaders/fxaa.js":"7EIbd","./shaders/bright.js":"3CyrI","../../helpers/angle.js":"hBXkO","../../helpers/pick.js":"fOypM","./components/axes/cartesian2d.js":"diZyK","./components/axes/cartesian3d.js":"24qTq","./font.js":"IvK0g","./../../helpers/math.js":"6Lv1i","../../constants.js":"dHTsY","../../vertex.js":"8lW8V","../../helpers/texture.js":"kVjwp","./components/labels.js":"bPD4j","./components/image.js":"7hNgE","./components/lasso.js":"7afcI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jnURY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { + }; + class Quad { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$4(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"gl-matrix":"erHGu","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ehf4a":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - get vertexBuffer() { - return this._vertexBuffer; + } + class Atlas extends AtlasBase { + get texture() { + return this._texture; } - constructor(core, ids){ - super(core, ids); + get defaultTexture() { + return this._defaultTexture; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } } -} - -},{"../../buffer.js":"8oaJi","../../main.js":"b6Xbk","./atlas.js":"6e5ov","./palette.js":"bgpEk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6e5ov":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + } + class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../atlas.js":"huG9l","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bgpEk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { - get texture() { - return this._texture; + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } } - get defaultTexture() { - return this._defaultTexture; + } + let Buffer$1 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + constructor(core, ids) { + super(core, ids); + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../palette.js":"a14oj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cAS6R":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { + }; + class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$1, Palette, Atlas); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + } + class Config extends RendererConfig { get keyLightAltitude() { - return this._keyLightAltitude; + return this._keyLightAltitude; } - set keyLightAltitude(value) { - this._keyLightAltitude = value; - this._updateLights(); + set keyLightAltitude(value2) { + this._keyLightAltitude = value2; + this._updateLights(); } get keyLightAzimuth() { - return this._keyLightAzimuth; + return this._keyLightAzimuth; } - set keyLightAzimuth(value) { - this._keyLightAzimuth = value; - this._updateLights(); + set keyLightAzimuth(value2) { + this._keyLightAzimuth = value2; + this._updateLights(); } get keyLightDistance() { - return this._keyLightDistance; + return this._keyLightDistance; } - set keyLightDistance(value) { - this._keyLightDistance = value; - this._updateLights(); + set keyLightDistance(value2) { + this._keyLightDistance = value2; + this._updateLights(); } get fillLight1Altitude() { - return this._fillLight1Altitude; + return this._fillLight1Altitude; } - set fillLight1Altitude(value) { - this._fillLight1Altitude = value; - this._updateLights(); + set fillLight1Altitude(value2) { + this._fillLight1Altitude = value2; + this._updateLights(); } get fillLight1Azimuth() { - return this._fillLight1Azimuth; + return this._fillLight1Azimuth; } - set fillLight1Azimuth(value) { - this._fillLight1Azimuth = value; - this._updateLights(); + set fillLight1Azimuth(value2) { + this._fillLight1Azimuth = value2; + this._updateLights(); } get fillLight2Altitude() { - return this._fillLight2Altitude; + return this._fillLight2Altitude; } - set fillLight2Altitude(value) { - this._fillLight2Altitude = value; - this._updateLights(); + set fillLight2Altitude(value2) { + this._fillLight2Altitude = value2; + this._updateLights(); } get fillLight2Azimuth() { - return this._fillLight2Azimuth; + return this._fillLight2Azimuth; } - set fillLight2Azimuth(value) { - this._fillLight2Azimuth = value; - this._updateLights(); + set fillLight2Azimuth(value2) { + this._fillLight2Azimuth = value2; + this._updateLights(); } - constructor(){ - super(); - this._rotation = (0, _glMatrix.quat).create(); - this.keyLightPosition = (0, _glMatrix.vec3).create(); - this.fillLight1Position = (0, _glMatrix.vec3).create(); - this.fillLight2Position = (0, _glMatrix.vec3).create(); - this.reset(); + constructor() { + super(); + this._rotation = create$1(); + this.keyLightPosition = create$3(); + this.fillLight1Position = create$3(); + this.fillLight2Position = create$3(); + this.reset(); } _updateLights() { - this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); - this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); - this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); + this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); + this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); + this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); } - _updateLight(altitude, azimuth, distance, position) { - (0, _glMatrix.quat).rotateY(this._rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, (0, _angleJs.AngleHelper).degreesToRadians(azimuth)); - (0, _glMatrix.quat).rotateX(this._rotation, this._rotation, (0, _angleJs.AngleHelper).degreesToRadians(-altitude)); - (0, _glMatrix.vec3).transformQuat(position, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._rotation); - (0, _glMatrix.vec3).scale(position, position, distance); + _updateLight(altitude, azimuth, distance2, position2) { + rotateY(this._rotation, Constants.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); + rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); + transformQuat(position2, Constants.VECTOR3_UNITZ, this._rotation); + scale(position2, position2, distance2); } reset() { - this.isSsaoEnabled = true; - this.ssaoWidth = 1024; - this.ssaoHeight = 1024; - this.ssaoBlurEnabled = true; - this.ssaoKernelSize = 8; - this.ssaoNoiseSize = 4; - this.ssaoRadius = 0.02; - this.ssaoPower = 1; - this.isShadowEnabled = true; - this.shadowWidth = 1024; - this.shadowHeight = 1024; - this.isDofEnabled = false; - this.dofAutoFocus = true; - this.dofFocusDistance = 0.5; - this.dofFocusRange = 0.5; - this.dofMaxBackgroundBlur = 0.75; - this.isBloomEnabled = false; - this.bloomIntensity = 2; - this.specularIntensity = 0.15; - this.specularPower = 150; - this.ambientIntensity = 0.1; - this.materialIntensity = 0.5; - this.keyLightIntensity = 1.5; - this.fillLight1Intensity = 0.25; - this.fillLight2Intensity = 0.25; - this._keyLightAltitude = 30; - this._keyLightAzimuth = -45; - this._keyLightDistance = 1; - this._fillLight1Altitude = 30; - this._fillLight1Azimuth = 45; - this._fillLight2Altitude = 30; - this._fillLight2Azimuth = -135; - this._updateLights(); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../helpers/angle.js":"hBXkO","../renderer.js":"as6Zc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"67Z4f":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.isSsaoEnabled = true; + this.ssaoWidth = 1024; + this.ssaoHeight = 1024; + this.ssaoBlurEnabled = true; + this.ssaoKernelSize = 8; + this.ssaoNoiseSize = 4; + this.ssaoRadius = 0.02; + this.ssaoPower = 1; + this.isShadowEnabled = true; + this.shadowWidth = 1024; + this.shadowHeight = 1024; + this.isDofEnabled = false; + this.dofAutoFocus = true; + this.dofFocusDistance = 0.5; + this.dofFocusRange = 0.5; + this.dofMaxBackgroundBlur = 0.75; + this.isBloomEnabled = false; + this.bloomIntensity = 2; + this.specularIntensity = 0.15; + this.specularPower = 150; + this.ambientIntensity = 0.1; + this.materialIntensity = 0.5; + this.keyLightIntensity = 1.5; + this.fillLight1Intensity = 0.25; + this.fillLight2Intensity = 0.25; + this._keyLightAltitude = 30; + this._keyLightAzimuth = -45; + this._keyLightDistance = 1; + this._fillLight1Altitude = 30; + this._fillLight1Azimuth = 45; + this._fillLight2Altitude = 30; + this._fillLight2Azimuth = -135; + this._updateLights(); + this.isFxaaEnabled = false; + } + } + class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.OES_texture_float = gl.getExtension("OES_texture_float"); - this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "background.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.OES_texture_float = gl.getExtension("OES_texture_float"); + this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + } + Resources.glsl = { + "background.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n', "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", - "deferred.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n", + "deferred.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n', "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", - "fxaa.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n", + "fxaa.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n', "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", - "lasso.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "pickgrid.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n", + "pickgrid.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n', "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", - "texture.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n", + "texture.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n', "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitblock.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitcylinder.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n", - "unitsdf.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitsphere.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitblock.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitcylinder.vertex.fx": '#version 300 es\n#include "common.include.fx"\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n', + "unitsdf.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitsphere.vertex.fx": '#version 300 es\n#include "common.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.x+rd.x*h)<size.x ) t = h;\n}\n}\n{\nfloat a = dd.z + dd.x;\nfloat b = od.z + od.x;\nfloat c = oo.z + oo.x - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.y+rd.y*h)<size.y ) t = h;\n}\n}\n{\nfloat a = dd.x + dd.y;\nfloat b = od.x + od.y;\nfloat c = oo.x + oo.y - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.z+rd.z*h)<size.z ) t = h;\n}\n}\nif( t>1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); + } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); } + if (this._haveTexturesChanged) { + this.updateTextures(); + } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"ekXmH","../../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gN1DJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + } + class Texture extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ZGAb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let Lasso$1 = class Lasso extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eGxSt":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + }; + class SdfText extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cWCAC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class PickGrid extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4WGJz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5XXeS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + } + class UnitShader extends ShaderBase { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); } _updateCurrentBuffer() { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); } _updatePreviousBuffer() { - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); } updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._translationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); - this._gl.vertexAttribDivisor(this._scaleAttribute, 0); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); - this._gl.vertexAttribDivisor(this._colorAttribute, 0); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); - this._gl.vertexAttribDivisor(this._selectedAttribute, 0); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); - this._gl.vertexAttribDivisor(this._orderAttribute, 0); - this._gl.vertexAttribDivisor(this._idAttribute, 0); - this._gl.vertexAttribDivisor(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"67Z4f","../../../meshes/cube.js":"dYecn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3msJ8":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._translationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); + this._gl.vertexAttribDivisor(this._scaleAttribute, 0); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); + this._gl.vertexAttribDivisor(this._colorAttribute, 0); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); + this._gl.vertexAttribDivisor(this._selectedAttribute, 0); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); + this._gl.vertexAttribDivisor(this._orderAttribute, 0); + this._gl.vertexAttribDivisor(this._idAttribute, 0); + this._gl.vertexAttribDivisor(this._idColorAttribute, 0); + } + } + class UnitBlock extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSphere extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fTtgI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + } + class UnitCylinder extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kAjIu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSdf extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6itVY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Background", ()=>Background); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _quadJs = require("../components/quad.js"); -class Background extends (0, _shaderJs.ShaderBase) { - constructor(core, main){ - super(core, main); - this._quad = new (0, _quadJs.Quad)(); + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); + } + } + class Background extends ShaderBase { + constructor(core, main) { + super(core, main); + this._quad = new Quad(); } initializeContext(gl) { - super.initializeContext(gl); - this._quad.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + this._quad.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._isInitialized = true; - this._vao = gl.createVertexArray(); - gl.bindVertexArray(this._vao); - gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); - gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - gl.enableVertexAttribArray(this._positionAttribute); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); - gl.bindVertexArray(null); + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._isInitialized = true; + this._vao = gl.createVertexArray(); + gl.bindVertexArray(this._vao); + gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); + gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + gl.enableVertexAttribArray(this._positionAttribute); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); + gl.bindVertexArray(null); } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._colorUniform, this.color); } updateBuffers() { - super.updateBuffers(); - this._gl.bindVertexArray(this._vao); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","../components/quad.js":"jnURY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ju7sc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ssao", ()=>Ssao); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Ssao extends (0, _shaderJs.ShaderBase) { + super.updateBuffers(); + this._gl.bindVertexArray(this._vao); + } + } + class Ssao extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); - this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); - this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); - this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); + this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); + this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); + this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); - this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); - this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); - this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); + this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); + this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); + this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); } applyView() { - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3yIW6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Box", ()=>Box); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Box extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + class Box extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dbxlx":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Deferred", ()=>Deferred); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _glMatrix = require("gl-matrix"); -class Deferred extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Deferred extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } - constructor(core, main){ - super(core, main); - this.directionToKeyLight = (0, _glMatrix.vec3).create(); - this.directionToFillLight1 = (0, _glMatrix.vec3).create(); - this.directionToFillLight2 = (0, _glMatrix.vec3).create(); - this.keyLightHalfAngle = (0, _glMatrix.vec3).create(); + constructor(core, main) { + super(core, main); + this.directionToKeyLight = create$3(); + this.directionToFillLight1 = create$3(); + this.directionToFillLight2 = create$3(); + this.keyLightHalfAngle = create$3(); } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); - this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); - this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); - this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); - this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); - this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); - this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); - this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); - this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); - this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); - this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); - this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); - this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); + this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); + this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); + this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); + this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); + this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); + this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); + this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); + this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); + this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); + this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); + this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); + this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); - this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); - this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); - this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); - this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); - this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); - this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); - this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); - this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); - this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); - this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); - this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); - this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); + this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); + this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); + this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); + this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); + this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); + this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); + this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); + this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); + this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); + this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); + this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); + this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); + this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d4boX":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Combine", ()=>Combine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Combine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class Combine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1f(this._intensityUniform, this.intensity); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1f(this._intensityUniform, this.intensity); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c0jpv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofBlur", ()=>DofBlur); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofBlur extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class DofBlur extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); - this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); - this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); + this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); + this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); - this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); - this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); + this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); + this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3sWXu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Downsample", ()=>Downsample); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Downsample extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + } + } + class Downsample extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g5wih":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Gaussian", ()=>Gaussian); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Gaussian extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Gaussian extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dE6Xe":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofCombine", ()=>DofCombine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofCombine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class DofCombine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._apertureUniform, this.aperture); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._apertureUniform, this.aperture); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7EIbd":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fxaa", ()=>Fxaa); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Fxaa extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + class Fxaa extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3CyrI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bright", ()=>Bright); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Bright extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Bright extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"diZyK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized; } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + get axes() { + return this._axes; } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); + constructor(core) { + this._core = core; + this.isVisible = true; } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); + initializeContext(gl) { + this._gl = gl; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } } - _renderText() { - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } } _renderGrid() { - const gridShader = this._main.gridShader; - const axes = this._axes; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); - } - this._gl.enable(this._gl.CULL_FACE); } - _renderGridTicks(axisId, edgeId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderText() { } - _renderGridFace(faceId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"gLQPI","../../../../main.js":"b6Xbk","../../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gLQPI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { + } + class Cartesian2dVisual extends AxesVisualBase { get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; - } - constructor(core){ - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - update(elapsedTime) {} - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"24qTq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const gridShader = this._main.gridShader; + const axes = this._axes; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } + } + this._gl.disable(this._gl.CULL_FACE); + const size2 = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size2[axisId2]; + const height2 = size2[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"gLQPI","../../../../main.js":"b6Xbk","../../../../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"IvK0g":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { + } + class Cartesian3dVisual extends AxesVisualBase { get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"kVjwp","../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bPD4j":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { - get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } - initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); shader.applyModel(); shader.isPickShader = false; - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } -} -class LabelVisual extends LabelVisualBase { - get label() { - return this._label; - } - set text(value) { - this._label.text = value; - } - get text() { - return this._label.text; - } - constructor(core, main, label){ - super(core, main, label); - } -} -class LabelSetVisual extends LabelVisualBase { - get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7hNgE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { - get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; - } - get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; - } - initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } - } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.apply(); - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { const viewport = i + this.viewportOffset; this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } -} - -},{"gl-matrix":"erHGu","../../../helpers/texture.js":"kVjwp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7afcI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { - get isInitialized() { - return this._isInitialized; - } - get vertexBuffer() { - return this._vertexBuffer; - } - get indexBuffer() { - return this._indexBuffer; - } - get indexCount() { - return this._indexCount; - } - initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } -} - -},{"../../../constants.js":"dHTsY","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j817I":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -parcelHelpers.export(exports, "Material", ()=>(0, _materialJs.Material)); -parcelHelpers.export(exports, "MetalMaterial", ()=>(0, _materialJs.MetalMaterial)); -parcelHelpers.export(exports, "GlossyMaterial", ()=>(0, _materialJs.GlossyMaterial)); -parcelHelpers.export(exports, "VarnishMaterial", ()=>(0, _materialJs.VarnishMaterial)); -parcelHelpers.export(exports, "LambertianMaterial", ()=>(0, _materialJs.LambertianMaterial)); -parcelHelpers.export(exports, "DielectricMaterial", ()=>(0, _materialJs.DielectricMaterial)); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>(0, _materialJs.DiffuseLightMaterial)); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>(0, _materialJs.IsotropicMaterial)); -parcelHelpers.export(exports, "Texture", ()=>(0, _textureJs.Texture)); -parcelHelpers.export(exports, "SolidColorTexture", ()=>(0, _textureJs.SolidColorTexture)); -parcelHelpers.export(exports, "ImageTexture", ()=>(0, _textureJs.ImageTexture)); -parcelHelpers.export(exports, "CheckerTexture", ()=>(0, _textureJs.CheckerTexture)); -parcelHelpers.export(exports, "GridTexture", ()=>(0, _textureJs.GridTexture)); -parcelHelpers.export(exports, "Light", ()=>(0, _lightJs.Light)); -parcelHelpers.export(exports, "SphereLight", ()=>(0, _lightJs.SphereLight)); -parcelHelpers.export(exports, "RectLight", ()=>(0, _lightJs.RectLight)); -parcelHelpers.export(exports, "Ground", ()=>(0, _groundJs.Ground)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -var _mainJs = require("./main.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _groundJs = require("./ground.js"); -var _constantsJs = require("./constants.js"); - -},{"./main.js":"dV6n9","./material.js":"ewL2a","./texture.js":"f9eG4","./light.js":"inb41","./ground.js":"b3WSb","./constants.js":"lFJgO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dV6n9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _mainJs = require("../../main.js"); -var _configJs = require("./config.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _raytraceJs = require("./shaders/raytrace.js"); -var _fullscreenquadJs = require("./shaders/fullscreenquad.js"); -var _bvhJs = require("./bvh.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _fontJs = require("./font.js"); -var _imageJs = require("./image.js"); -var _labelsJs = require("./labels.js"); -var _bufferJs = require("./buffer.js"); -var _constantsJs1 = require("./constants.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + } } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + } + } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + this._gl.disable(this._gl.CULL_FACE); + const size2 = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size2[axisId2]; + const height2 = size2[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get frameCount() { - return this._frameCount; - } - get duration() { - return this._duration; - } - get config() { - return this._config; - } - set lights(value) { - if (value != this._lights) { - this._lights = value; - this._haveLightsChanged = true; - this._frameCount = 0; - } - } - get lights() { - return this._lights; - } - restart() { - this._frameCount = 0; - this._core.start(); - } - constructor(options){ - super(options); - (0, _glMatrix.glMatrix).setMatrixArrayType(Float32Array); - this._config = new (0, _configJs.Config)(); - this._frameCount = 0; - this._duration = 0; - this._position = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._manipulationOrigin = (0, _glMatrix.vec3).create(); - this._backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); - } - initialize(core) { - super.initialize(core); - this._hittables = []; - this._lightBuffer = null; - this._worldCreated = false; - this._initializeAPI().then(()=>{ - this._initializeResources(); - }); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _initializeAPI() { - return __awaiter(this, void 0, void 0, function*() { - try { - const start = window.performance.now(); - const gpu = navigator.gpu; - this._presentationFormat = gpu.getPreferredCanvasFormat(); - this._adapter = yield gpu.requestAdapter(); - const gpuDeviceDescriptor = { - requiredLimits: { - maxStorageBufferBindingSize: 134217728, - maxComputeWorkgroupsPerDimension: 256 - } - }; - this._device = yield this._adapter.requestDevice(gpuDeviceDescriptor); - this._queue = this._device.queue; - this._context = this._canvas.getContext("webgpu"); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU API initialized ${Math.round(window.performance.now() - start)}ms`); - } catch (e) { - this._core.log.write((0, _mainJs.LogLevel).error, e); - return false; - } - return true; - }); + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _initializeResources() { - const start = window.performance.now(); - const canvasConfig = { - device: this._device, - format: this._presentationFormat, - alphaMode: "premultiplied" - }; - this._context.configure(canvasConfig); - const computeUniformBufferDescriptor = { - label: "Compute uniform buffer", - size: (0, _raytraceJs.ComputeUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._computeUniformBuffer = this._device.createBuffer(computeUniformBufferDescriptor); - this._computeUniformBufferData = new (0, _raytraceJs.ComputeUniformBufferData)(); - const depthMinMaxBufferDescriptor = { - label: "Depth min max buffer", - size: 8, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - this._depthMinMaxBuffer = this._device.createBuffer(depthMinMaxBufferDescriptor); - const depthMinMaxBufferResultDescriptor = { - label: "Depth min max result buffer", - size: 8, - usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ - }; - this._depthMinMaxResultBuffer = this._device.createBuffer(depthMinMaxBufferResultDescriptor); - const fullscreenQuadUniformBufferDescriptor = { - label: "Full screen quad uniform buffer", - size: (0, _fullscreenquadJs.FullscreenQuadUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._fullscreenQuadUniformBuffer = this._device.createBuffer(fullscreenQuadUniformBufferDescriptor); - this._fullscreenQuadUniformBufferData = new (0, _fullscreenquadJs.FullscreenQuadUniformBufferData)(); - this._sampler = this._device.createSampler({ - label: "Sampler", - magFilter: "linear", - minFilter: "linear" - }); - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(this._device); - fontVisual.update(); - } - for(let i = 0; i < this.images.length; i++){ - const image = this.images[i]; - image.initializeContext(this._device); - image.update(); - } - const textureSize = { - width: 1, - height: 1 - }; - const textureDescriptor = { - label: "Placeholder texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._texture = this._device.createTexture(textureDescriptor); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU resources initialized ${Math.round(window.performance.now() - start)}ms`); - this._isInitialized = true; + } + class FontVisual { + get isInitialized() { + return this._isInitialized; } - get isSupported() { - return navigator.gpu !== undefined; - } - _createWorld() { - return __awaiter(this, void 0, void 0, function*() { - const start = performance.now(); - this._hittables = this._getHittables(); - if (this._hittables.length == 0) return; - const bvhAccel = new (0, _bvhJs.BVHAccel)(this._core, this._hittables, this._config.maxPrimsInNode, (0, _bvhJs.SplitMethod).sah); - const hittables = bvhAccel.orderedPrimitives; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const atlas = transitionBuffer.currentAtlas; - if (atlas.imageData) { - const imageData = atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - yield createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - label: "Atlas texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._atlasTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this._atlasTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `atlas texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - break; - } - } - } - const materials = []; - const materialIds = []; - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - const material = hittable.material; - let materialId; - let found; - for(let j = 0; j < materials.length; j++)if (materials[j] === material) { - found = true; - materialId = j; - break; - } - if (!found) { - materialId = materials.length; - materials.push(material); - } - materialIds.push(materialId); - } - const textures = []; - const textureIds = []; - for(let i = 0; i < materials.length; i++){ - const material = materials[i]; - const texture = material.texture; - if (texture) { - let textureId; - let found; - for(let j = 0; j < textures.length; j++)if (textures[j] === texture) { - found = true; - textureId = j; - break; - } - if (!found) { - textureId = textures.length; - textures.push(texture); - if (texture instanceof (0, _textureJs.ImageTexture)) { - const imageData = texture.image; - if (imageData) { - let start = performance.now(); - const imageDataLinear = new ImageData(imageData.width, imageData.height); - for(let i = 0; i < imageData.data.length; i++)imageDataLinear.data[i] = Math.pow(imageData.data[i] / 0xff, 2.2) * 0xff; - this._core.log.write((0, _mainJs.LogLevel).info, `image inverse gamma ${Math.round(window.performance.now() - start)}ms`); - start = window.performance.now(); - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageDataLinear).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._backgroundTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap, - flipY: true - }; - const imageCopyTextureTagged = { - texture: this._backgroundTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `background image updated ${Math.round(window.performance.now() - start)}ms`); - }); - } - } - } - textureIds.push(textureId); - } else textureIds.push(0); - } - const textureBufferSizeBytes = textures.length * (0, _textureJs.TextureBufferData).SIZE * 4; - const textureBufferDescriptor = { - label: "Texture buffer", - size: textureBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._textureBuffer = this._device.createBuffer(textureBufferDescriptor); - this._textureBufferData = new (0, _textureJs.TextureBufferData)(textures.length); - for(let i = 0; i < textures.length; i++)textures[i].toBuffer(this._textureBufferData, i); - const materialBufferSizeBytes = materials.length * (0, _materialJs.MaterialBufferData).SIZE * 4; - const materialBufferDescriptor = { - label: "Material buffer", - size: materialBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._materialBuffer = this._device.createBuffer(materialBufferDescriptor); - this._materialBufferData = new (0, _materialJs.MaterialBufferData)(materials.length); - for(let i = 0; i < materials.length; i++)materials[i].toBuffer(this._materialBufferData, i, textureIds[i]); - const hittableBufferSizeBytes = hittables.length * (0, _hittableJs.HittableBufferData).SIZE * 4; - const hittableBufferDescriptor = { - label: "Hittable buffer", - size: hittableBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._hittableBuffer = this._device.createBuffer(hittableBufferDescriptor); - this._hittableBufferData = new (0, _hittableJs.HittableBufferData)(hittables.length); - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - hittable.toBuffer(this._hittableBufferData, i, materialIds[i]); - } - const linearBVHNodes = bvhAccel.nodes; - const linearBVHNodeBufferSizeBytes = linearBVHNodes.length * (0, _bvhJs.LinearBVHNodeBufferData).SIZE * 4; - const linearBVHNodeBufferDescriptor = { - label: "Linear BVH node buffer", - size: linearBVHNodeBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._linearBVHNodeBuffer = this._device.createBuffer(linearBVHNodeBufferDescriptor); - this._linearBVHNodeBufferData = new (0, _bvhJs.LinearBVHNodeBufferData)(linearBVHNodes.length); - for(let i = 0; i < linearBVHNodes.length; i++)linearBVHNodes[i].toBuffer(this._linearBVHNodeBufferData, i); - this._device.queue.writeBuffer(this._hittableBuffer, 0, this._hittableBufferData.buffer, this._hittableBufferData.byteOffset, this._hittableBufferData.byteLength); - this._device.queue.writeBuffer(this._materialBuffer, 0, this._materialBufferData.buffer, this._materialBufferData.byteOffset, this._materialBufferData.byteLength); - this._device.queue.writeBuffer(this._textureBuffer, 0, this._textureBufferData.buffer, this._textureBufferData.byteOffset, this._textureBufferData.byteLength); - this._device.queue.writeBuffer(this._linearBVHNodeBuffer, 0, this._linearBVHNodeBufferData.buffer, this._linearBVHNodeBufferData.byteOffset, this._linearBVHNodeBufferData.byteLength); - this._core.log.write((0, _mainJs.LogLevel).info, `create world ${Math.round(window.performance.now() - start)}ms`); - }); + get font() { + return this._font; } - _createLights() { - if (!this._lights || this._lights.length == 0) return; - const modelScale = this._core.getModelScale(); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - if (!this._lightBuffer) { - const lightBufferSizeBytes = this._lights.length * (0, _lightJs.LightBufferData).SIZE * 4; - const lightBufferDescriptor = { - label: "Light buffer", - size: lightBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._lightBuffer = this._device.createBuffer(lightBufferDescriptor); - this._lightBufferData = new (0, _lightJs.LightBufferData)(this._lights.length); - } - for(let i = 0; i < this._lights.length; i++){ - const light = this._lights[i]; - let lightCopy; - if (light instanceof (0, _lightJs.RectLight)) lightCopy = new (0, _lightJs.RectLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - rotation: (0, _glMatrix.quat).clone(light.rotation), - size: (0, _glMatrix.vec2).fromValues(light.size[0] * modelScale, light.size[1] * modelScale) - }); - else if (light instanceof (0, _lightJs.SphereLight)) lightCopy = new (0, _lightJs.SphereLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - radius: light.radius * modelScale - }); - (0, _glMatrix.vec3).scale(lightCopy.center, lightCopy.center, modelScale); - (0, _glMatrix.vec3).add(lightCopy.center, lightCopy.center, this._modelPosition); - lightCopy.toBuffer(this._lightBufferData, i); - } - this._device.queue.writeBuffer(this._lightBuffer, 0, this._lightBufferData.buffer, this._lightBufferData.byteOffset, this._lightBufferData.byteLength); - this._areLightsInitialized = true; - } - standardLighting(lights) { - lights || (lights = this._config.standardLightingOptions()); - const rectLights = []; - for(let i = 0; i < lights.length; i++){ - const light = lights[i]; - const center = (0, _glMatrix.vec3).create(); - const rotation = (0, _glMatrix.quat).create(); - const azimuth = (0, _angleJs.AngleHelper).degreesToRadians(light.azimuth); - const altitude = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, azimuth); - (0, _glMatrix.quat).rotateX(rotation, rotation, altitude); - (0, _glMatrix.vec3).transformQuat(center, (0, _constantsJs.Constants).VECTOR3_UNITZ, rotation); - (0, _glMatrix.vec3).scale(center, center, light.distance); - const yaw = (0, _angleJs.AngleHelper).degreesToRadians(light.yaw); - const pitch = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, yaw); - (0, _glMatrix.quat).rotateX(rotation, rotation, pitch); - rectLights.push(new (0, _lightJs.RectLight)({ - center: center, - rotation: rotation, - size: light.size, - color: light.color - })); - } - return rectLights; + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; } - _getHittables() { - const hittables = []; - let minY = Number.MAX_VALUE; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible && transitionBuffer.hittables && transitionBuffer.hittables.length > 0) { - minY = Math.min(minY, transitionBuffer.minY); - for(let j = 0; j < transitionBuffer.hittables.length; j++)hittables.push(transitionBuffer.hittables[j]); - } - } - if (this.labelSets && this.labelSets.length > 0) for(let i = 0; i < this.labelSets.length; i++){ - const labelSet = this.labelSets[i]; - if (labelSet.hittables) for(let j = 0; j < labelSet.hittables.length; j++)hittables.push(labelSet.hittables[j]); - } - if (this.images && this.images.length > 0) { - for(let i = 0; i < this.images.length; i++)if (this.images[i].hittable) { - const hittable = this.images[i].hittable; - hittables.push(hittable); - minY = Math.min(hittable.bounds.min[1], minY); - } - } - if (this.ground) { - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - const groundSize = (0, _glMatrix.vec2).create(); - const groundPosition = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec2).scale(groundSize, this.ground.size || this._config.groundSize, modelScale); - if (this.ground.position) (0, _glMatrix.vec3).scale(groundPosition, this.ground.position, modelScale); - else (0, _glMatrix.vec3).set(groundPosition, 0, minY - (0, _constantsJs1.Constants).SHADOW_OFFSET, 0); - const options = { - size0: groundSize, - size1: groundSize, - center0: groundPosition, - center1: groundPosition, - time0: 1, - time1: 1, - texCoord0: (0, _glMatrix.vec2).fromValues(0, 0), - texCoord1: (0, _glMatrix.vec2).fromValues(1, 1), - material: this.ground.material || this.config.defaultMaterial - }; - (0, _glMatrix.vec3).add(options.center0, options.center0, modelPosition); - hittables.push(new (0, _hittableJs.HittableXzRect)(options)); - } - return hittables; + initializeContext(gl) { + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + } + class LabelVisualBase { + get isInitialized() { + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$4(); + this.mMatrix = create$4(); + this.isVisible = true; } - createTransitionBuffer(ids) { - const transitionBuffer = new (0, _bufferJs.TransitionBuffer)(this._core, this, ids); - transitionBuffer.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return transitionBuffer; - } - _resizeBackings() { - const width = this.width; - const height = this.height; - const colorChannels = 3; - const outputColorBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * colorChannels; - const outputColorBufferDescriptor = { - label: "Output color buffer", - size: outputColorBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputColorBuffer = this._device.createBuffer(outputColorBufferDescriptor); - const outputNormalDepthBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * 4; - const outputDepthBufferDescriptor = { - label: "Output normal depth buffer", - size: outputNormalDepthBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputNormalDepthBuffer = this._device.createBuffer(outputDepthBufferDescriptor); - const computeShaderModuleDescriptor = { - code: (0, _raytraceJs.ComputeShaderWgsl) - }; - const computeModule = this._device.createShaderModule(computeShaderModuleDescriptor); - const computeBindGroupLayoutDescriptor = { - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 1, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "uniform" - } - }, - { - binding: 2, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 3, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 4, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 5, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 6, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 7, - visibility: GPUShaderStage.COMPUTE, - sampler: { - type: "filtering" - } - }, - { - binding: 8, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 9, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 10, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const computeBindGroupLayout = this._device.createBindGroupLayout(computeBindGroupLayoutDescriptor); - const computeBindGroupDescriptor = { - label: "Compute bind group descriptor", - layout: computeBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 1, - resource: { - buffer: this._computeUniformBuffer - } - }, - { - binding: 2, - resource: { - buffer: this._hittableBuffer - } - }, - { - binding: 3, - resource: { - buffer: this._materialBuffer - } - }, - { - binding: 4, - resource: { - buffer: this._textureBuffer - } - }, - { - binding: 5, - resource: { - buffer: this._lightBuffer - } - }, - { - binding: 6, - resource: { - buffer: this._linearBVHNodeBuffer - } - }, - { - binding: 7, - resource: this._sampler - }, - { - binding: 8, - resource: (this.fonts[this._core.font.name].texture || this._texture).createView() - }, - { - binding: 9, - resource: (this._backgroundTexture || this._texture).createView() - }, - { - binding: 10, - resource: (this._atlasTexture || this._texture).createView() - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._computeBindGroup = this._device.createBindGroup(computeBindGroupDescriptor); - const computePipelineLayoutDescriptor = { - label: "Compute pipeline layout descriptor", - bindGroupLayouts: [ - computeBindGroupLayout - ] - }; - const computePipelineLayout = this._device.createPipelineLayout(computePipelineLayoutDescriptor); - const compute = { - module: computeModule, - entryPoint: "main" - }; - const computePipelineDescriptor = { - label: "Compute pipeline descriptor", - layout: computePipelineLayout, - compute: compute - }; - this._computePipeline = this._device.createComputePipeline(computePipelineDescriptor); - const computeDepthNormal = { - module: computeModule, - entryPoint: "depthNormal" - }; - const computeDepthNormalPipelineDescriptor = { - label: "Depth normal pipeline descriptor", - layout: computePipelineLayout, - compute: computeDepthNormal - }; - this._computeDepthNormalPipeline = this._device.createComputePipeline(computeDepthNormalPipelineDescriptor); - const computeSegment = { - module: computeModule, - entryPoint: "segment" - }; - const computeSegmentPipelineDescriptor = { - label: "Segment pipeline descriptor", - layout: computePipelineLayout, - compute: computeSegment - }; - this._computeSegmentPipeline = this._device.createComputePipeline(computeSegmentPipelineDescriptor); - const clearBindGroupLayoutDescriptor = { - label: "Clear bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const clearBindGroupLayout = this._device.createBindGroupLayout(clearBindGroupLayoutDescriptor); - const clearBindGroupDescriptor = { - label: "Clear bind group descriptor", - layout: clearBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._clearBindGroup = this._device.createBindGroup(clearBindGroupDescriptor); - const clearPipelineLayoutDescriptor = { - label: "Clear pipeline layout descriptor", - bindGroupLayouts: [ - clearBindGroupLayout - ] - }; - const clearPipelineLayout = this._device.createPipelineLayout(clearPipelineLayoutDescriptor); - const clear = { - module: computeModule, - entryPoint: "clear" - }; - const clearPipelineDescriptor = { - label: "Clear pipeline descriptor", - layout: clearPipelineLayout, - compute: clear - }; - this._clearPipeline = this._device.createComputePipeline(clearPipelineDescriptor); - const fullscreenQuadShaderDescriptor = { - label: "Fullscreen quad shader descriptor", - code: (0, _fullscreenquadJs.FullscreenQuadWgsl) - }; - const fullscreenQuadModule = this._device.createShaderModule(fullscreenQuadShaderDescriptor); - const fullscreenQuadBindGroupLayoutDescriptor = { - label: "Fullscreen quad bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "uniform" - } - }, - { - binding: 1, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 2, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - } - ] - }; - const fullscreenQuadBindGroupLayout = this._device.createBindGroupLayout(fullscreenQuadBindGroupLayoutDescriptor); - const fullscreenQuadPipelineLayoutDescriptor = { - label: "Fullscreen quad pipeline layout descriptor", - bindGroupLayouts: [ - fullscreenQuadBindGroupLayout - ] - }; - const fullscreenQuadPipelineLayout = this._device.createPipelineLayout(fullscreenQuadPipelineLayoutDescriptor); - const vertex = { - module: fullscreenQuadModule, - entryPoint: "vert_main" - }; - const primitive = { - topology: "triangle-list" - }; - const colorState = { - format: this._presentationFormat - }; - const fragment = { - module: fullscreenQuadModule, - entryPoint: "frag_main", - targets: [ - colorState - ] - }; - const fullscreenQuadPiplelineDescriptor = { - label: "Fullscreen quad pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragment, - primitive: primitive - }; - this._fullscreenQuadPipeline = this._device.createRenderPipeline(fullscreenQuadPiplelineDescriptor); - const fullscreenQuadBindGroupDescriptor = { - label: "Fullscreen quad bind group descriptor", - layout: fullscreenQuadBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: this._fullscreenQuadUniformBuffer - } - }, - { - binding: 1, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 2, - resource: { - buffer: outputNormalDepthBuffer - } - } - ] - }; - this._fullscreenQuadBindGroup = this._device.createBindGroup(fullscreenQuadBindGroupDescriptor); - const fragmentHdr = { - module: fullscreenQuadModule, - entryPoint: "frag_main_hdr", - targets: [ - colorState - ] - }; - const fullscreenQuadHdrPiplelineDescriptor = { - label: "Fullscreen quad HDR pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentHdr, - primitive: primitive - }; - this._fullscreenQuadHdrPipeline = this._device.createRenderPipeline(fullscreenQuadHdrPiplelineDescriptor); - const fragmentDepth = { - module: fullscreenQuadModule, - entryPoint: "frag_depth", - targets: [ - colorState - ] - }; - const fullscreenQuadDepthPiplelineDescriptor = { - label: "Fullscreen quad depth pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentDepth, - primitive: primitive - }; - this._fullscreenQuadDepthPipeline = this._device.createRenderPipeline(fullscreenQuadDepthPiplelineDescriptor); - const fragmentNormal = { - module: fullscreenQuadModule, - entryPoint: "frag_normal", - targets: [ - colorState - ] - }; - const fullscreenQuadNormalPiplelineDescriptor = { - label: "Fullscreen quad normal pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentNormal, - primitive: primitive - }; - this._fullscreenQuadNormalPipeline = this._device.createRenderPipeline(fullscreenQuadNormalPiplelineDescriptor); - const fragmentEdge = { - module: fullscreenQuadModule, - entryPoint: "frag_edge", - targets: [ - colorState - ] - }; - const fullscreenQuadEdgePiplelineDescriptor = { - label: "Fullscreen quad edge pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentEdge, - primitive: primitive - }; - this._fullscreenQuadEdgePipeline = this._device.createRenderPipeline(fullscreenQuadEdgePiplelineDescriptor); - const fragmentSegment = { - module: fullscreenQuadModule, - entryPoint: "frag_segment", - targets: [ - colorState - ] - }; - const fullscreenQuadSegmentPiplelineDescriptor = { - label: "Fullscreen quad segment pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentSegment, - primitive: primitive - }; - this._fullscreenQuadSegmentPipeline = this._device.createRenderPipeline(fullscreenQuadSegmentPiplelineDescriptor); - this._computeUniformBufferData.setWidth(width); - this._computeUniformBufferData.setHeight(height); - this._fullscreenQuadUniformBufferData.setWidth(width); - this._fullscreenQuadUniformBufferData.setHeight(height); - this._computeUniformBufferData.setTime0(0); - this._computeUniformBufferData.setTime1(1); - this._computeDispatchCount = Math.min(Math.ceil(width * height / 256), this._device.limits.maxComputeWorkgroupsPerDimension); - this._frameCount = 0; - this._core.log.write((0, _mainJs.LogLevel).info, "backings resized"); + initializeContext(gl) { + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - super.update(elapsedTime); - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const time0 = this._core.renderer.transitionTime; - const time1 = Math.min(time0 + this._config.shutterSpeed, 1); - transitionBuffer.time0 = time0; - transitionBuffer.time1 = time1; - transitionBuffer.duration = this._core.config.transitionDuration; - transitionBuffer.stagger = this._core.config.transitionStaggering; - transitionBuffer.update(); - } - } - if (this._haveLightsChanged || !this._lightBuffer) { - this._haveLightsChanged = false; - this._createLights(); - } - if (this._hasWorldChanged) { - this._hasWorldChanged = false; - this._createWorld().then(()=>{ - if (this._hittables.length > 0) { - this._resizeBackings(); - this._worldCreated = true; - } - }); + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`frm tot ${this._frameCount}`); + } } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - if (!this._worldCreated || !this._areLightsInitialized || this._hittables.length == 0) return; - const epsilon = 0.000001; - if (Math.abs(this._computeUniformBufferData.getFieldOfView() - this._core.config.fov) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setFieldOfView(this._core.config.fov); - } - if (Math.abs(this._computeUniformBufferData.getAperture() - this._config.aperture) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setAperture(this._config.aperture); - } - const m = this.inverseVMatrices[0]; - this._computeUniformBufferData.getPosition(this._position); - this._computeUniformBufferData.getRight(this._right); - this._computeUniformBufferData.getUp(this._up); - this._computeUniformBufferData.getForward(this._forward); - if (Math.abs(this._position[0] - m[12]) > epsilon || Math.abs(this._position[1] - m[13]) > epsilon || Math.abs(this._position[2] - m[14]) > epsilon || Math.abs(this._right[0] - m[0]) > epsilon || Math.abs(this._right[1] - m[1]) > epsilon || Math.abs(this._right[2] - m[2]) > epsilon || Math.abs(this._up[0] - m[4]) > epsilon || Math.abs(this._up[1] - m[5]) > epsilon || Math.abs(this._up[2] - m[6]) > epsilon || Math.abs(this._forward[0] - m[8]) > epsilon || Math.abs(this._forward[1] - m[9]) > epsilon || Math.abs(this._forward[2] - m[10]) > epsilon) { - this._frameCount = 0; - (0, _glMatrix.vec3).set(this._position, m[12], m[13], m[14]); - (0, _glMatrix.vec3).set(this._right, m[0], m[1], m[2]); - (0, _glMatrix.vec3).set(this._up, m[4], m[5], m[6]); - (0, _glMatrix.vec3).set(this._forward, m[8], m[9], m[10]); - this._computeUniformBufferData.setPosition(this._position); - this._computeUniformBufferData.setRight(this._right); - this._computeUniformBufferData.setUp(this._up); - this._computeUniformBufferData.setForward(this._forward); - this._core.getModelPosition(this._modelPosition); - this._core.getModelManipulationOrigin(this._manipulationOrigin); - (0, _glMatrix.vec3).add(this._modelPosition, this._modelPosition, this._manipulationOrigin); - this._computeUniformBufferData.setLookAt(this._modelPosition); - } - this._computeUniformBufferData.getBackgroundColor(this._backgroundColor); - if (!(0, _glMatrix.vec4).equals(this._backgroundColor, this._config.backgroundColor)) { - this._frameCount = 0; - this._computeUniformBufferData.setBackgroundColor(this._config.backgroundColor); - } - this._tilesX = this._computeUniformBufferData.getTilesX(); - this._tilesY = this._computeUniformBufferData.getTilesY(); - this._tileOffsetX = this._computeUniformBufferData.getTileOffsetX(); - this._tileOffsetY = this._computeUniformBufferData.getTileOffsetY(); - if (this._tilesX != this._core.config.tilesX || this._tilesY != this._core.config.tilesY || this._tileOffsetX != this._core.config.tileOffsetX || this._tileOffsetY != this._core.config.tileOffsetY) { - this._frameCount = 0; - this._computeUniformBufferData.setTilesX(this._core.config.tilesX); - this._computeUniformBufferData.setTilesY(this._core.config.tilesY); - this._computeUniformBufferData.setTileOffsetX(this._core.config.tileOffsetX); - this._computeUniformBufferData.setTileOffsetY(this._core.config.tileOffsetY); - } - const clear = this._frameCount == 0; - if (clear) { - this._duration = 0; - this._startTime = performance.now(); - } - if (this._frameCount >= this._config.maxSamplesPerPixel) { - this._core.stop(); - return; - } - const raysPerFrame = this._config.raysPerFrame; - this._computeUniformBufferData.setRaysPerFrame(raysPerFrame); - this._computeUniformBufferData.setSeed(this._core.totalFrames * raysPerFrame); - this._device.queue.writeBuffer(this._computeUniformBuffer, 0, this._computeUniformBufferData.buffer, this._computeUniformBufferData.byteOffset, this._computeUniformBufferData.byteLength); - this._frameCount += raysPerFrame; - this._fullscreenQuadUniformBufferData.setSamplesPerPixel(this._frameCount); - this._fullscreenQuadUniformBufferData.setExposure(this._config.exposure); - this._fullscreenQuadUniformBufferData.setMinDepth(this._config.minDepth); - this._fullscreenQuadUniformBufferData.setMaxDepth(this._config.maxDepth); - this._fullscreenQuadUniformBufferData.setEdgeDepth(this._config.edgeDepth); - this._fullscreenQuadUniformBufferData.setEdgeNormal(this._config.edgeNormal); - this._device.queue.writeBuffer(this._fullscreenQuadUniformBuffer, 0, this._fullscreenQuadUniformBufferData.buffer, this._fullscreenQuadUniformBufferData.byteOffset, this._fullscreenQuadUniformBufferData.byteLength); - yield this._encodeCommands(clear); - this._duration = performance.now() - this._startTime; - }); + } + class LabelVisual extends LabelVisualBase { + get label() { + return this._label; } - clear() { - this._frameCount = 0; - } - _encodeCommands(clear) { - return __awaiter(this, void 0, void 0, function*() { - const commandEncoder = this._device.createCommandEncoder(); - const computePassEncoder = commandEncoder.beginComputePass(); - if (clear) { - computePassEncoder.setPipeline(this._clearPipeline); - computePassEncoder.setBindGroup(0, this._clearBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - } - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - case (0, _mainJs.RenderMode).hdr: - computePassEncoder.setPipeline(this._computePipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - case (0, _mainJs.RenderMode).depth: - case (0, _mainJs.RenderMode).normal: - computePassEncoder.setPipeline(this._computeDepthNormalPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - commandEncoder.copyBufferToBuffer(this._depthMinMaxBuffer, 0, this._depthMinMaxResultBuffer, 0, this._depthMinMaxResultBuffer.size); - if (this._config.autoDepth) { - yield this._depthMinMaxResultBuffer.mapAsync(GPUMapMode.READ); - const depthMinMax = new Uint32Array(this._depthMinMaxResultBuffer.getMappedRange()); - const depthMin = depthMinMax[0] / 1000; - const depthMax = depthMinMax[1] / 1000; - if (this._config.minDepth != depthMin || this._config.maxDepth != depthMax) console.log('depthMinMax', depthMin, depthMax); - this._config.minDepth = depthMin; - this._config.maxDepth = depthMax; - this._depthMinMaxResultBuffer.unmap(); - } - break; - case (0, _mainJs.RenderMode).edge: - case (0, _mainJs.RenderMode).segment: - computePassEncoder.setPipeline(this._computeSegmentPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - } - const colorAttachment = { - view: this._context.getCurrentTexture().createView(), - clearValue: { - r: 0.0, - g: 0.0, - b: 0.0, - a: 0.0 - }, - loadOp: "clear", - storeOp: "store" - }; - const fullscreenQuadRenderPassDescriptor = { - colorAttachments: [ - colorAttachment - ] - }; - const renderPassEncoder = commandEncoder.beginRenderPass(fullscreenQuadRenderPassDescriptor); - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - renderPassEncoder.setPipeline(this._fullscreenQuadPipeline); - break; - case (0, _mainJs.RenderMode).hdr: - renderPassEncoder.setPipeline(this._fullscreenQuadHdrPipeline); - break; - case (0, _mainJs.RenderMode).depth: - renderPassEncoder.setPipeline(this._fullscreenQuadDepthPipeline); - break; - case (0, _mainJs.RenderMode).normal: - renderPassEncoder.setPipeline(this._fullscreenQuadNormalPipeline); - break; - case (0, _mainJs.RenderMode).edge: - renderPassEncoder.setPipeline(this._fullscreenQuadEdgePipeline); - break; - case (0, _mainJs.RenderMode).segment: - renderPassEncoder.setPipeline(this._fullscreenQuadSegmentPipeline); - break; - } - renderPassEncoder.setBindGroup(0, this._fullscreenQuadBindGroup); - renderPassEncoder.draw(6, 1, 0, 0); - renderPassEncoder.end(); - this._queue.submit([ - commandEncoder.finish() - ]); - }); + set text(value2) { + this._label.text = value2; } - _resize(width, height) { - super._resize(width, height); - if (this._isInitialized && this._hittables.length > 0) { - this._resizeBackings(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); - } - } -} - -},{"gl-matrix":"erHGu","../renderer.js":"as6Zc","../../main.js":"b6Xbk","./config.js":"hBC5n","./hittable.js":"a4kPP","./material.js":"ewL2a","./shaders/raytrace.js":"KHqJX","./shaders/fullscreenquad.js":"iaEI5","./bvh.js":"gC34F","./texture.js":"f9eG4","./light.js":"inb41","../../constants.js":"dHTsY","../../helpers/angle.js":"hBXkO","./font.js":"5qz1r","./image.js":"ebXJi","./labels.js":"1pTTV","./buffer.js":"3l2Pt","./constants.js":"lFJgO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hBC5n":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); - } - standardLightingOptions(options) { - const azimuthOffset = options && options.azimuthOffset ? options.azimuthOffset : this.lightingAzimuthOffset; - const altitude = options && options.altitude ? options.altitude : this.lightingAltitude; - const size = options && options.size ? options.size : this.lightingSize; - const distance = options && options.distance ? options.distance : this.lightingDistance; - return [ - { - azimuth: -45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(10, 10, 10) - }, - { - azimuth: 45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: 45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }, - { - azimuth: -135 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -135 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - } - ]; + get text() { + return this._label.text; } - reset() { - this.aperture = 0; - this.exposure = 1; - this.maxSamplesPerPixel = 10000; - this.shutterSpeed = 0; - this.raysPerFrame = 1; - this.maxPrimsInNode = 1; - this.defaultMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5) - }) - }); - this.defaultTextMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }) - }); - this.groundSize = (0, _glMatrix.vec2).fromValues(10, 10); - this.backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); - this.lightingAzimuthOffset = 0; - this.lightingAltitude = 30; - this.lightingSize = 0.5; - this.lightingDistance = 1.5; - this.autoDepth = true; - this.minDepth = 1; - this.maxDepth = 10; - this.edgeDepth = 0.01; - this.edgeNormal = 0.025; - } -} - -},{"gl-matrix":"erHGu","../renderer.js":"as6Zc","./material.js":"ewL2a","./texture.js":"f9eG4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewL2a":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MaterialType", ()=>MaterialType); -parcelHelpers.export(exports, "MaterialBufferData", ()=>MaterialBufferData); -parcelHelpers.export(exports, "Material", ()=>Material); -parcelHelpers.export(exports, "LambertianMaterial", ()=>LambertianMaterial); -parcelHelpers.export(exports, "MetalMaterial", ()=>MetalMaterial); -parcelHelpers.export(exports, "DielectricMaterial", ()=>DielectricMaterial); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>DiffuseLightMaterial); -parcelHelpers.export(exports, "GlossyMaterial", ()=>GlossyMaterial); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>IsotropicMaterial); -parcelHelpers.export(exports, "VarnishMaterial", ()=>VarnishMaterial); -var _glMatrix = require("gl-matrix"); -const MaterialType = { - lambertian: 0, - metal: 1, - dielectric: 2, - glossy: 3, - diffuseLight: 4, - isotropic: 5, - varnish: 6 -}; -class MaterialBufferData extends Float32Array { - constructor(count){ - super(count * MaterialBufferData.SIZE); - this.TYPE_OFFSET = 0; - this.FUZZ_OFFSET = 1; - this.REFRACTIVE_INDEX_OFFSET = 2; - this.TEXTURE_ID_OFFSET = 3; - this.COLOR_OFFSET = 4; - this.GLOSSINESS_OFFSET = 7; - this.ID_COLOR_OFFSET = 8; - this.DENSITY_OFFSET = 12; - } - getType(index) { - return this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getFuzz(index) { - return this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET]; - } - setFuzz(index, value) { - this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET] = value; - } - getRefractiveIndex(index) { - return this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET]; - } - setRefractiveIndex(index, value) { - this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET] = value; - } - getTextureId(index) { - return this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET]; - } - setTextureId(index, value) { - this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET] = value; - } - getColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getGlossiness(index) { - return this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET]; - } - setGlossiness(index, value) { - this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET] = value; - } - getDensity(index) { - return this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET]; - } - setDensity(index, value) { - this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET] = value; - } - getIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -MaterialBufferData.SIZE = 16; -class Material { - get texture() { - return this._texture; - } - get idColor() { - return this._idColor; - } - constructor(options){ - this._idColor = options.idColor || (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); - } - toBuffer(buffer, index, textureId) {} -} -class LambertianMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.lambertian); - buffer.setIdColor(index, this.idColor); - buffer.setTextureId(index, textureId); - } -} -class MetalMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.metal); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setTextureId(index, textureId); - } -} -class DielectricMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - this.density = options && options.density !== undefined ? options.density : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.dielectric); - buffer.setIdColor(index, this.idColor); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setColor(index, (0, _glMatrix.vec3).fromValues(-Math.log(this.color[0]) * this.density, -Math.log(this.color[1]) * this.density, -Math.log(this.color[2]) * this.density)); - } -} -class DiffuseLightMaterial extends Material { - constructor(options){ - super(options); - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.diffuseLight); - buffer.setIdColor(index, this.idColor); - buffer.setColor(index, this.color); - } -} -class GlossyMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.glossy); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setTextureId(index, textureId); - } -} -class IsotropicMaterial extends Material { - constructor(options){ - super(options); - this.density = options.density; - this.color = options.color; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.isotropic); - buffer.setIdColor(index, this.idColor); - buffer.setDensity(index, this.density); - buffer.setColor(index, this.color); - } -} -class VarnishMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.varnish); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f9eG4":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureType", ()=>TextureType); -parcelHelpers.export(exports, "TextureBufferData", ()=>TextureBufferData); -parcelHelpers.export(exports, "Texture", ()=>Texture); -parcelHelpers.export(exports, "SolidColorTexture", ()=>SolidColorTexture); -parcelHelpers.export(exports, "ImageTexture", ()=>ImageTexture); -parcelHelpers.export(exports, "CheckerTexture", ()=>CheckerTexture); -parcelHelpers.export(exports, "GridTexture", ()=>GridTexture); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -const TextureType = { - none: 0, - solidColor: 1, - image: 2, - sdfText: 3, - checker: 4, - grid: 5 -}; -class TextureBufferData extends Float32Array { - constructor(count){ - super(count * TextureBufferData.SIZE); - this.COLOR0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.COLOR1_OFFSET = 4; - this.SIZE0_OFFSET = 8; - this.SIZE1_OFFSET = 12; - this.CLIP_OFFSET = 16; - this.OFFSET_OFFSET = 20; - } - getType(index) { - return this[TextureBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[TextureBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); - } - setOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - } -} -TextureBufferData.SIZE = 24; -class Texture { -} -class SolidColorTexture extends Texture { - constructor(options){ - super(); - this.color = options.color; - this.borderColor = options.borderColor || (0, _constantsJs.Constants).VECTOR3_ONE; - this._color = (0, _glMatrix.vec3).fromValues(Math.pow(this.color[0], 2.2), Math.pow(this.color[1], 2.2), Math.pow(this.color[2], 2.2)); - this._borderColor = (0, _glMatrix.vec3).fromValues(Math.pow(this.borderColor[0], 2.2), Math.pow(this.borderColor[1], 2.2), Math.pow(this.borderColor[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.solidColor); - buffer.setColor0(index, this._color); - buffer.setColor1(index, this._borderColor); - } -} -class ImageTexture extends Texture { - constructor(options){ - super(); - this.image = options.image; - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.image); - } -} -class CheckerTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.checker); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], 0, 0)); - buffer.setOffset(index, this.offset); - } -} -class GridTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.minorSize = options.minorSize; - this.thickness = options.thickness; - this.minorThickness = options.minorThickness; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this.clip = options.clip || (0, _glMatrix.vec4).fromValues(0, 0, 1, 1); - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.grid); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], this.minorSize[0], this.minorSize[1])); - buffer.setSize1(index, (0, _glMatrix.vec4).fromValues(this.thickness[0], this.thickness[1], this.minorThickness[0], this.minorThickness[1])); - buffer.setOffset(index, this.offset); - buffer.setClip(index, this.clip); - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a4kPP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HittableType", ()=>HittableType); -parcelHelpers.export(exports, "HittableBufferData", ()=>HittableBufferData); -parcelHelpers.export(exports, "Hittable", ()=>Hittable); -parcelHelpers.export(exports, "HittableSphere", ()=>HittableSphere); -parcelHelpers.export(exports, "HittableXyDisk", ()=>HittableXyDisk); -parcelHelpers.export(exports, "HittableRotatedXyDisk", ()=>HittableRotatedXyDisk); -parcelHelpers.export(exports, "HittableRingSdf", ()=>HittableRingSdf); -parcelHelpers.export(exports, "HittableRotatedRingSdf", ()=>HittableRotatedRingSdf); -parcelHelpers.export(exports, "HittableBox", ()=>HittableBox); -parcelHelpers.export(exports, "HittableBoxSdf", ()=>HittableBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBoxSdf", ()=>HittableRotatedBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBox", ()=>HittableRotatedBox); -parcelHelpers.export(exports, "HittableCylinder", ()=>HittableCylinder); -parcelHelpers.export(exports, "HittableCylinderSdf", ()=>HittableCylinderSdf); -parcelHelpers.export(exports, "HittableHexPrism", ()=>HittableHexPrism); -parcelHelpers.export(exports, "HittableHexPrismSdf", ()=>HittableHexPrismSdf); -parcelHelpers.export(exports, "HittableRect", ()=>HittableRect); -parcelHelpers.export(exports, "HittableXyRect", ()=>HittableXyRect); -parcelHelpers.export(exports, "HittableXzRect", ()=>HittableXzRect); -parcelHelpers.export(exports, "HittableYzRect", ()=>HittableYzRect); -parcelHelpers.export(exports, "HittableFontXyRect", ()=>HittableFontXyRect); -parcelHelpers.export(exports, "HittableSdfXyRect", ()=>HittableSdfXyRect); -parcelHelpers.export(exports, "HittableRotatedXyRect", ()=>HittableRotatedXyRect); -parcelHelpers.export(exports, "HittableRotatedFontXyRect", ()=>HittableRotatedFontXyRect); -parcelHelpers.export(exports, "HittableRotatedSdfXyRect", ()=>HittableRotatedSdfXyRect); -parcelHelpers.export(exports, "HittableConstantMedium", ()=>HittableConstantMedium); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _boundsJs = require("../../helpers/bounds.js"); -var _aabbJs = require("./aabb.js"); -const HittableType = { - sphere: 0, - box: 1, - cylinder: 2, - hexPrism: 3, - rotatedBox: 4, - xyRect: 5, - xzRect: 6, - yzRect: 7, - rotatedXyRect: 8, - fontXyRect: 9, - rotatedFontXyRect: 10, - boxSdf: 11, - cylinderSdf: 12, - hexPrismSdf: 13, - constantMedium: 14, - sdfXyRect: 15, - rotatedSdfXyRect: 16, - rotatedBoxSdf: 17, - xYDisk: 18, - rotatedXyDisk: 19, - ringSdf: 20, - rotatedRingSdf: 21 -}; -class HittableBufferData extends Float32Array { - constructor(count){ - super(count * HittableBufferData.SIZE); - this.CENTER0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.SIZE0_OFFSET = 4; - this.MATERIAL_ID_OFFSET = 7; - this.ROTATION0_OFFSET = 8; - this.ROTATION1_OFFSET = 12; - this.TEXCOORD0_OFFSET = 16; - this.TEXCOORD1_OFFSET = 18; - this.CENTER1_OFFSET = 20; - this.ROUNDING_OFFSET = 23; - this.SIZE1_OFFSET = 24; - this.BOUNDARY_TYPE_OFFSET = 27; - this.TIME0_OFFSET = 28; - this.TIME1_OFFSET = 29; - this.TEX_ID_OFFSET = 30; - this.SDF_BUFFER_OFFSET = 31; - this.SDF_BORDER_OFFSET = 32; - this.PARAMETER_1_OFFSET = 33; - this.PARAMETER_2_OFFSET = 34; - } - getType(index) { - return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[HittableBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getTime0(index) { - return this[HittableBufferData.SIZE * index + this.TIME0_OFFSET]; - } - setTime0(index, value) { - this[HittableBufferData.SIZE * index + this.TIME0_OFFSET] = value; - } - getTime1(index) { - return this[HittableBufferData.SIZE * index + this.TIME1_OFFSET]; - } - setTime1(index, value) { - this[HittableBufferData.SIZE * index + this.TIME1_OFFSET] = value; - } - getSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getMaterialId(index) { - return this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET]; - } - setMaterialId(index, value) { - this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET] = value; - } - getRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + constructor(core, main, label2) { + super(core, main, label2); + } + } + class LabelSetVisual extends LabelVisualBase { + get label() { + return this._label; } - setTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + constructor(core, main, label2) { + super(core, main, label2); } - getTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + } + class ImageVisual { + get isInitialized() { + return this._isInitialized && this._main.textureShader.isInitialized; } - setTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + get image() { + return this._image; } - getRounding(index) { - return this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET]; + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$4(); + this.isVisible = true; } - setRounding(index, value) { - this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET] = value; + initializeContext(gl) { + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } - getParameter1(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET]; + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } } - setParameter1(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET] = value; + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.apply(); + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } } - getParameter2(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET]; + } + class Lasso { + get isInitialized() { + return this._isInitialized; } - setParameter2(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET] = value; + get vertexBuffer() { + return this._vertexBuffer; } - getBoundaryType(index) { - return this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET]; + get indexBuffer() { + return this._indexBuffer; } - setBoundaryType(index, value) { - this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET] = value; + get indexCount() { + return this._indexCount; } - getTexId(index) { - return this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET]; + initializeContext(gl) { + const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } - setTexId(index, value) { - this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET] = value; + } + var __awaiter$1 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - getSdfBuffer(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET]; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Main extends RendererBase { + get shaderResources() { + return this._shaderResources; } - setSdfBuffer(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET] = value; + get textureShader() { + return this._textureShader; } - getSdfBorder(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET]; + get lassoShader() { + return this._lassoShader; } - setSdfBorder(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; + get sdfTextShader() { + return this._sdfTextShader; } -} -HittableBufferData.SIZE = 36; -class Hittable { - get center0() { - return this._center0; + get gridShader() { + return this._gridShader; } - get center1() { - return this._center1; + get blockShader() { + return this._blockShader; } - get time0() { - return this._time0; + get sphereShader() { + return this._sphereShader; } - get time1() { - return this._time1; + get cyclinderShader() { + return this._cylinderShader; } - get material() { - return this._material; - } - set material(material) { - this._material = material; - } - get bounds() { - return this._bounds; - } - get offset0() { - return this._offset0; - } - get offset1() { - return this._offset1; - } - constructor(options){ - this._center0 = options.center0; - this._center1 = options.center1; - this._time0 = options.time0; - this._time1 = options.time1; - this._material = options.material; - this._bounds = new (0, _aabbJs.AABB)(); - this._offset0 = (0, _glMatrix.vec3).create(); - this._offset1 = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index, materialId) { - buffer.setCenter0(index, this._center0); - buffer.setCenter1(index, this._center1); - buffer.setTime0(index, this._time0); - buffer.setTime1(index, this._time1); - buffer.setMaterialId(index, materialId); - } -} -class HittableSphere extends Hittable { - get radius() { - return this._radius; - } - constructor(options){ - super(options); - this._radius = options.radius; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._radius, this._center1[1] - this._radius); - max[1] = Math.max(this._center0[1] + this._radius, this._center1[1] + this._radius); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.sphere); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._radius, this._radius)); - } -} -class HittableXyDisk extends Hittable { - get texCoord0() { - return this._texCoord0; + get sdfShader() { + return this._sdfShader; } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._radius0 = options.radius0; - this._radius1 = options.radius1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius0, this._center1[0] - this._radius1); - max[0] = Math.max(this._center0[0] + this._radius0, this._center1[0] + this._radius1); - min[1] = Math.min(this._center0[1] - this._radius0, this._center1[1] - this._radius1); - max[1] = Math.max(this._center0[1] + this._radius0, this._center1[1] + this._radius1); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xYDisk); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius0, this._radius0, this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius1, this._radius1, this._thickness)); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableRotatedXyDisk extends HittableXyDisk { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyDisk); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRingSdf extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - this._angle = options.angle0; - this._innerRadius = options.innerRadius0; - this._rounding = options.rounding; - const outerRadius = this._size0[0]; - const innerRadius = this._size0[1]; - const extrudedThicknesses = this._size0[2]; - const min = this._bounds.min; - const max = this._bounds.max; - max[1] = this._center0[1] + outerRadius; - const sinAngle = Math.sin(this._angle); - const cosAngle = Math.cos(this._angle); - if (this._angle < (0, _constantsJs.Constants).PI_OVER_TWO) { - min[0] = this.center0[0] - sinAngle * outerRadius; - max[0] = this.center0[0] + sinAngle * outerRadius; - min[1] = this.center0[1] + cosAngle * innerRadius; - } else { - min[0] = this._center0[0] - outerRadius; - max[0] = this._center0[0] + outerRadius; - min[1] = this._center0[1] + cosAngle * outerRadius; - } - min[2] = this._center0[2] - extrudedThicknesses; - max[2] = this._center0[2] + extrudedThicknesses; - this.offset0[0] = (min[0] + max[0]) / 2 - this._center0[0]; - this.offset0[1] = (min[1] + max[1]) / 2 - this._center0[1]; - this.offset0[2] = (min[2] + max[2]) / 2 - this._center0[2]; - this.offset1[0] = (min[0] + max[0]) / 2 - this._center1[0]; - this.offset1[1] = (min[1] + max[1]) / 2 - this._center1[1]; - this.offset1[2] = (min[2] + max[2]) / 2 - this._center1[2]; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.ringSdf); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - buffer.setParameter1(index, this._angle); - buffer.setParameter2(index, this._innerRadius); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedRingSdf extends HittableRingSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedRingSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableBox extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._size0[2], this._center1[2] - this._size1[2]); - max[2] = Math.max(this._center0[2] + this._size0[2], this._center1[2] + this._size1[2]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.box); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - } -} -class HittableBoxSdf extends HittableBox { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.boxSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedBoxSdf extends HittableBoxSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBoxSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedBox extends HittableBox { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBox); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinder extends Hittable { - get radius() { - return this._radius; + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - this._rotation0 = options.rotation0 || (0, _constantsJs.Constants).QUAT_IDENTITY; - this._rotation1 = options.rotation1 || (0, _constantsJs.Constants).QUAT_IDENTITY; - if (this._rotation0[3] * this._rotation1[3] == 1) { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._height, this._center1[1] - this._height); - max[1] = Math.max(this._center0[1] + this._height, this._center1[1] + this._height); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } else { - const ca0 = (0, _glMatrix.vec3).create(); - const pa0 = (0, _glMatrix.vec3).create(); - const pb0 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation0); - (0, _glMatrix.vec3).scaleAndAdd(pa0, this._center0, ca0, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb0, this._center0, ca0, this._height); - const ca1 = (0, _glMatrix.vec3).create(); - const pa1 = (0, _glMatrix.vec3).create(); - const pb1 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca1, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation1); - (0, _glMatrix.vec3).scaleAndAdd(pa1, this._center1, ca1, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb1, this._center1, ca1, this._height); - this._bounds.fromCylinder(pa0, pb0, this._radius); - const bounds = new (0, _aabbJs.AABB)(); - bounds.fromCylinder(pa1, pb1, this._radius); - const min0 = this._bounds.min; - const max0 = this._bounds.max; - const min1 = bounds.min; - const max1 = bounds.max; - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - } - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinder); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinderSdf extends HittableCylinder { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinderSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableHexPrism extends Hittable { - get radius() { - return this._radius; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = this._center0[0] - this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - max[0] = this._center0[0] + this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - min[1] = this._center0[1] - this._height; - max[1] = this._center0[1] + this._height; - min[2] = this._center0[2] - this._radius; - max[2] = this._center0[2] + this._radius; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrism); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO, this._height, this._radius)); - } -} -class HittableHexPrismSdf extends HittableHexPrism { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrismSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRect extends Hittable { - get texCoord0() { - return this._texCoord0; + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._size0 = options.size0; - this._size1 = options.size1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - this._setBounds(); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableXyRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xyRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._size0[1], this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._size1[1], this._thickness)); - } -} -class HittableXzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._thickness, this._center1[1] - this._thickness); - max[1] = Math.max(this._center0[1] + this._thickness, this._center1[1] + this._thickness); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._thickness, this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._thickness, this._size1[1])); - } -} -class HittableYzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._thickness, this._center1[0] - this._thickness); - max[0] = Math.max(this._center0[0] + this._thickness, this._center1[0] + this._thickness); - min[1] = Math.min(this._center0[1] - this._size0[0], this._center1[1] - this._size1[0]); - max[1] = Math.max(this._center0[1] + this._size0[0], this._center1[1] + this._size1[0]); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.yzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size0[0], this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size1[0], this._size1[1])); - } -} -class HittableFontXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.fontXyRect); - } -} -class HittableSdfXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.sdfXyRect); - } -} -class HittableRotatedXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyRect); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedFontXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.rotatedFontXyRect); - } -} -class HittableRotatedSdfXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.rotatedSdfXyRect); - } -} -class HittableConstantMedium extends Hittable { - get boundary() { - return this._boundary; - } - constructor(options){ - super(options); - this._boundary = options.boundary; - this._bounds = this._boundary.bounds; - } - toBuffer(buffer, index, materialId) { - this._boundary.toBuffer(buffer, index, materialId); - buffer.setBoundaryType(index, buffer.getType(index)); - buffer.setType(index, HittableType.constantMedium); - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../helpers/bounds.js":"lo93N","./aabb.js":"3Gscs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Gscs":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AABB", ()=>AABB); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../../meshes/cube.js"); -class AABB { - get min() { - return this._min; - } - get max() { - return this._max; - } - constructor(){ - this._min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - this._max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - } - centroid(centroid) { - centroid[0] = (this._min[0] + this._max[0]) / 2; - centroid[1] = (this._min[1] + this._max[1]) / 2; - centroid[2] = (this._min[2] + this._max[2]) / 2; - } - size(size) { - size[0] = this._max[0] - this._min[0]; - size[1] = this._max[1] - this._min[1]; - size[2] = this._max[2] - this._min[2]; - } - offset(point, normalized) { - normalized[0] = (point[0] - this._min[0]) / (this._max[0] - this._min[0]); - normalized[1] = (point[1] - this._min[1]) / (this._max[1] - this._min[1]); - normalized[2] = (point[2] - this._min[2]) / (this._max[2] - this._min[2]); - } - unionBounds(bounds) { - (0, _glMatrix.vec3).min(this._min, this._min, bounds.min); - (0, _glMatrix.vec3).max(this._max, this._max, bounds.max); - } - unionPoint(point) { - (0, _glMatrix.vec3).min(this._min, this._min, point); - (0, _glMatrix.vec3).max(this._max, this._max, point); - } - maximumExtent() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - if (dx > dy && dx > dz) return 0; - else if (dy > dz) return 1; - return 2; - } - surfaceArea() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - return 2 * (dx * dy + dx * dz + dy * dz); - } - rotate(rotation) { - const sizeX = this._max[0] - this._min[0]; - const sizeY = this._max[1] - this._min[1]; - const sizeZ = this._max[2] - this._min[2]; - const min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - const max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const position = (0, _glMatrix.vec3).create(); - const vertices = (0, _cubeJs.Cube).POSITIONS; - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).copy(this._min, min); - (0, _glMatrix.vec3).copy(this._max, max); - } - fromCylinder(pa, pb, radius) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - this._min[0] = Math.min(pa[0] - ex, pb[0] - ex); - this._min[1] = Math.min(pa[1] - ey, pb[1] - ey); - this._min[2] = Math.min(pa[2] - ez, pb[2] - ez); - this._max[0] = Math.max(pa[0] + ex, pb[0] + ex); - this._max[1] = Math.max(pa[1] + ey, pb[1] + ey); - this._max[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"erHGu","../../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"KHqJX":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ComputeShaderWgsl", ()=>ComputeShaderWgsl); -parcelHelpers.export(exports, "ComputeUniformBufferData", ()=>ComputeUniformBufferData); -var _glMatrix = require("gl-matrix"); -const ComputeShaderWgsl = ` -const PI = 3.1415926535897932385f; -const TWO_PI = 6.2831853071795864769f; -const ROOT_THREE_OVER_TWO = 0.86602540378443864676f; - -struct ColorBuffer { - values: array<f32>, -} - -// (normal.x, normal.y, normal.z, depth) -struct NormalDepthBuffer { - values: array<f32>, -} - -// Min, max -// TODO: Convert to atomic add with uint -struct DepthMinMaxBuffer { - values: array<atomic<u32>>, -} - -struct Ray { - origin: vec3<f32>, - direction: vec3<f32>, - time: f32, -} - -struct HitRecord { - normal: vec3<f32>, - t: f32, - frontFace: bool, - materialId: u32, - uv: vec2<f32>, - id: u32, - previousId: u32, - position: vec3<f32>, - previousPosition: vec3<f32>, - isAbsorbing: bool, - previousIsAbsorbing: bool, - absorption: vec3<f32>, - previousAbsorption: vec3<f32>, - sdfBorder: bool, -} - -struct Camera { - origin: vec3<f32>, - lowerLeftCorner: vec3<f32>, - horizontal: vec3<f32>, - vertical: vec3<f32>, - lookAt: vec3<f32>, - u: vec3<f32>, - v: vec3<f32>, - w: vec3<f32>, - aspectRatio: f32, - viewportWidth: f32, - viewportHeight: f32, - fov: f32, - aperture: f32, - time0: f32, - time1: f32, -} - - // offest align size -struct Uniforms { // ------------------------------ - position: vec3<f32>, // 0 16 12 - width: f32, // 12 4 4 - right: vec3<f32>, // 16 16 12 - height: f32, // 28 4 4 - up: vec3<f32>, // 32 16 12 - seed: f32, // 44 4 4 - forward: vec3<f32>, // 48 16 12 - fov: f32, // 60 4 4 - lookAt: vec3<f32>, // 64 16 12 - aperture: f32, // 76 4 4 - backgroundColor: vec3<f32>, // 80 16 12 - time0: f32, // 92 4 4 - time1: f32, // 96 4 4 - tilesX : f32, // 100 4 4 - tilesY : f32, // 104 4 4 - tileOffsetX : f32, // 108 4 4 - tileOffsetY : f32, // 112 4 4 - raysPerFrame : f32, // 116 4 4 - // padding 120 4 8 - // ------------------------------ - // 16 128 -} - -// id type -// ---------------- -// 0 none -// 1 solidColor -// 2 image -// 3 sdfText -// 4 checker -// 5 grid - // offest align size stride -struct Texture { // --------------------------------------- - color0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - color1: vec3<f32>, // 16 12 12 - // padding 28 12 12 - size0: vec4<f32>, // 32 16 16 - size1: vec4<f32>, // 48 16 16 - clip: vec4<f32>, // 64 16 16 - offset: vec2<f32>, // 80 8 8 -} // --------------------------------------- - // 16 88 96 - -// id type -// --------------- -// 0 lambertian -// 1 metal -// 2 dielectric -// 3 diffuse light -// 4 glossy -// 5 isotropic -// 6 varnitsh - // offest align size stride -struct Material { // --------------------------------------- - typeId: f32, // 0 4 4 - fuzz: f32, // 4 4 4 - refractiveIndex: f32, // 8 4 4 - textureId: f32, // 12 4 4 - color: vec3<f32>, // 16 16 12 - glossiness: f32, // 28 4 4 - idColor: vec4<f32>, // 32 16 16 - density: f32, // 48 4 4 - // --------------------------------------- -} // 16 52 64 - -// id type -// ---------------- -// 0 distant -// 1 sphere -// 2 rect -// 3 disk -// 4 cylinder -// 5 dome - // offest align size stride -struct Light { // --------------------------------------- - rotation: vec4<f32>, // 0 16 16 - center: vec3<f32>, // 16 16 12 - typeId: f32, // 28 4 4 - size: vec3<f32>, // 32 16 12 - // padding 44 4 4 - color: vec3<f32>, // 48 16 12 -} // --------------------------------------- - // 16 60 64 - -// id type -// ---------------- -// 0 sphere -// 1 box -// 2 cylinder -// 3 hexPrism -// 4 rotatedBox -// 5 xyRect -// 6 xzRect -// 7 yzRect -// 8 rotatedXyRect -// 9 fontXyRect -// 10 rotatedFontXyRect -// 11 boxSdf -// 12 cylinderSdf -// 13 hexPrismSdf -// 14 constantMedium -// 15 sdfXyRect -// 16 rotatedSdfXyRect -// 17 rotatedBoxSdf -// 18 xyDisk -// 19 rotatedXyDisk -// 20 ringSdf -// 21 rotatedRingSdf - // offest align size stride -struct Hittable { // --------------------------------------- - center0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - size0: vec3<f32>, // 16 16 12 - materialId: f32, // 28 4 4 - rotation0: vec4<f32>, // 32 16 16 - rotation1: vec4<f32>, // 48 16 16 - texCoord0: vec2<f32>, // 64 8 8 - texCoord1: vec2<f32>, // 72 8 8 - center1: vec3<f32>, // 80 16 12 - rounding: f32, // 92 4 4 - size1: vec3<f32>, // 96 16 12 - boundaryTypeId: f32, // 108 4 4 - time0: f32, // 112 4 4 - time1: f32, // 116 4 4 - texId: f32, // 120 4 4 - sdfBuffer: f32, // 124 4 4 - sdfBorder: f32, // 128 4 4 - parameter1: f32, // 132 4 4 - parameter2: f32, // 136 4 4 - // padding 140 4 4 -} // --------------------------------------- - // 16 144 144 - - // offest align size stride -struct LinearBVHNode { // --------------------------------------- - center: vec3<f32>, // 0 16 12 - primitivesOffset: f32, // 12 4 4 - size: vec3<f32>, // 16 16 12 - secondChildOffset: f32, // 28 4 4 - nPrimitives: f32, // 32 4 4 - axis: f32, // 36 4 4 -} // --------------------------------------- - // 16 40 48 - -struct HittableBuffer { - hittables: array<Hittable>, -} - -struct MaterialBuffer { - materials: array<Material>, -} - -struct TextureBuffer { - textures: array<Texture>, -} - -struct LightBuffer { - lights: array<Light>, -} - -struct LinearBVHNodeBuffer { - nodes: array<LinearBVHNode>, -} - -// Schlick's approximation for reflectance -fn reflectance(cos: f32, refractiveIndex: f32) -> f32 { - var r = (1f - refractiveIndex) / (1f + refractiveIndex); - r = r * r; - return r + (1f - r) * pow(1f - cos, 5f); -} - -fn refraction(uv: vec3<f32>, n: vec3<f32>, etaiOverEtat: f32) -> vec3<f32> { - let cosTheta = min(dot(-uv, n), 1f); - let rOutPerp = etaiOverEtat * (uv + cosTheta * n); - let rOutParallel = -sqrt(abs(1f - dot(rOutPerp, rOutPerp))) * n; - return rOutPerp + rOutParallel; -} - -fn getCamera(uniforms: Uniforms) -> Camera { - var camera: Camera; - camera.aperture = uniforms.aperture; - camera.aspectRatio = uniforms.width / uniforms.height; - camera.fov = uniforms.fov; - camera.viewportHeight = 2f * tan(camera.fov / 2f); - camera.viewportWidth = camera.aspectRatio * camera.viewportHeight; - camera.origin = uniforms.position; - camera.lookAt = uniforms.lookAt; - camera.u = uniforms.right; - camera.v = uniforms.up; - camera.w = uniforms.forward; - let focusDistance = dot(camera.w, camera.origin - camera.lookAt); - camera.horizontal = camera.u * camera.viewportWidth * focusDistance; - camera.vertical = camera.v * camera.viewportHeight * focusDistance; - camera.lowerLeftCorner = camera.origin - camera.horizontal / 2f + camera.vertical / 2f - camera.w * focusDistance; - camera.time0 = uniforms.time0; - camera.time1 = uniforms.time1; - return camera; -} - -fn getCameraRay(camera: Camera, seed: ptr<function, u32>, texCoord: vec2<f32>) -> Ray { - // Depth of field - let rd = camera.aperture * randomInUnitDisk(seed); - let offset = camera.u * rd.x + camera.v * rd.y; - - var ray: Ray; - ray.origin = camera.origin + offset; - ray.direction = normalize(camera.lowerLeftCorner + texCoord.x * camera.horizontal - texCoord.y * camera.vertical - camera.origin - offset); - ray.time = camera.time0 + random(seed) * (camera.time1 - camera.time0); - return ray; -} - -fn degreesToRadians(degrees: f32) -> f32 { - return degrees * PI / 180f; -} - -// See https://www.reedbeta.com/blog/hash-functions-for-gpu-rendering/ -fn random(seed: ptr<function, u32>) -> f32 { - var random = ((*seed >> ((*seed >> 28u) + 4u)) ^ *seed) * 277803737u; - random = (random >> 22u) ^ random; - *seed = *seed * 747796405u + 2891336453u; - return f32(random) / 4294967295f; // [0,1] -} - -fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { - var p: vec2<f32>; - loop { - p = 2f * vec2<f32>(random(seed), random(seed)) - vec2<f32>(1f, 1f); - if (dot(p, p) <= 1f) { break; } + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - return p; -} - -// fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { -// let t = TWO_PI * random(seed); -// let r = sqrt(random(seed)); -// return r * vec2<f32>(cos(t), sin(t)); -// } - -fn randomInUnitSphere(seed: ptr<function, u32>) -> vec3<f32> { - var p: vec3<f32>; - loop { - p = 2f * vec3<f32>(random(seed), random(seed), random(seed)) - vec3<f32>(1f, 1f, 1f); - if (dot(p, p) <= 1f) { break; } + get config() { + return this._config; + } + constructor(options) { + super(options); + this._config = new Config(); + this._quad = new Quad(); + this._lasso = new Lasso(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$2(); + this._position = create$3(); + this._direction = create$3(); + this._cameraRotation = create$5(); + this._cameraPosition = create$3(); + this._modelPosition = create$3(); + this._modelManipulationOrigin = create$3(); + this._shadowVMatrix = create$4(); + this._shadowPMatrix = create$4(); } - return p; -} - -fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { - return normalize(randomInUnitSphere(seed)); -} - -// fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { -// let theta = TWO_PI * random(seed); // [0,2Pi] -// let phi = acos(2f * random(seed) - 1f); // [-1,1] -// return vec3<f32>(sin(phi) * cos(theta), sin(phi) * sin(theta), cos(phi)); -// } - -fn rayAt(ray: Ray, t: f32) -> vec3<f32> { - return ray.origin + ray.direction * t; -} - -fn setFaceNormal(ray: Ray, outwardNormal: vec3<f32>, hitRecord: ptr<function, HitRecord>) { - (*hitRecord).frontFace = dot(ray.direction, outwardNormal) < 0f; - (*hitRecord).normal = select(-outwardNormal, outwardNormal, (*hitRecord).frontFace); -} - -// fn hitWorld(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { -// var hitAnything = false; -// var closestSoFar = tMax; -// let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; -// var tempHitRecord: HitRecord; -// for (var i: u32 = 0u; i < arrayLength(&hittableBuffer.hittables); i = i + 1u) { -// if (hit(i, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { -// hitAnything = true; -// closestSoFar = tempHitRecord.t; -// tempHitRecord.materialId = u32(hittableBuffer.hittables[i].materialId); -// *hitRecord = tempHitRecord; -// } -// } -// return hitAnything; -// } - -fn hitBVH(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - var hitAnything = false; - var closestSoFar = tMax; - let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; - var tempHitRecord: HitRecord; - var toVisitOffset = 0u; - var currentNodeIndex = 0u; - var nodesToVisit: array<u32, 64>; - loop { - let node = &linearBVHNodeBuffer.nodes[currentNodeIndex]; - // Check ray against BVH node - if (intersectBox((*node).center, (*node).size, ray, invDir, tMin, closestSoFar)) { - let nPrimitives = u32((*node).nPrimitives); - if (nPrimitives > 0u) { - let primitiveOffset = u32((*node).primitivesOffset); - for (var i: u32 = 0u; i < nPrimitives; i = i + 1u) { - let id = primitiveOffset + i; - if (hit(id, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { - hitAnything = true; - closestSoFar = tempHitRecord.t; - tempHitRecord.materialId = u32(hittableBuffer.hittables[id].materialId); - tempHitRecord.id = id; - } - } - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; - } - else { - // Put far BVH node on nodesToVisit stack, advance to near node - if (ray.direction[u32((*node).axis)] < 0f) { - nodesToVisit[toVisitOffset] = currentNodeIndex + 1u; - currentNodeIndex = u32((*node).secondChildOffset); - } else { - nodesToVisit[toVisitOffset] = u32((*node).secondChildOffset); - currentNodeIndex = currentNodeIndex + 1u; - } - toVisitOffset = toVisitOffset + 1u; - } - } - else { - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; - } + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; } - if (hitAnything) { - tempHitRecord.previousId = (*hitRecord).id; - tempHitRecord.previousPosition = (*hitRecord).position; - tempHitRecord.previousIsAbsorbing = (*hitRecord).isAbsorbing; - tempHitRecord.previousAbsorption = (*hitRecord).absorption; - *hitRecord = tempHitRecord; - return true; - }; - return false; -} - -fn hit(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - switch u32(hittableBuffer.hittables[id].typeId) { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 5u: { - return hitXyRect(id, ray, tMin, tMax, hitRecord); - } - case 6u: { - return hitXzRect(id, ray, tMin, tMax, hitRecord); - } - // case 7u: { - // return hitYzRect(hittable, ray, tMin, tMax, hitRecord); - // } - case 8u: { - return hitRotatedXyRect(id, ray, tMin, tMax, hitRecord); - } - case 9u: { - return hitFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 10u: { - return hitRotatedFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources(); + this._textureShader = new Texture(core, this); + this._lassoShader = new Lasso$1(core, this); + this._sdfTextShader = new SdfText(core, this); + this._gridShader = new PickGrid(core, this); + this._blockShader = new UnitBlock(core, this); + this._sphereShader = new UnitSphere(core, this); + this._cylinderShader = new UnitCylinder(core, this); + this._sdfShader = new UnitSdf(core, this); + this._backgroundShader = new Background(core, this); + this._ssaoShader = new Ssao(core, this); + this._boxShader = new Box(core, this); + this._deferredShader = new Deferred(core, this); + this._combineShader = new Combine(core, this); + this._dofBlurShader = new DofBlur(core, this); + this._downsampleShader = new Downsample(core, this); + this._gaussianShader = new Gaussian(core, this); + this._dofCombineShader = new DofCombine(core, this); + this._fxaaShader = new Fxaa(core, this); + this._brightPassShader = new Bright(core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; + } + _initializeContext(gl) { + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); + const random2 = new PseudoRandom(0); + const _vec3 = create$3(); + for (let i = 0; i < this._config.ssaoKernelSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + _vec3[2] = random2.nextFloat(); + normalize$2(_vec3, _vec3); + scale(_vec3, _vec3, random2.nextFloat()); + let scale$12 = i / this._config.ssaoKernelSize; + scale$12 = MathHelper.lerp(0.1, 1, scale$12 * scale$12); + scale(_vec3, _vec3, scale$12); + this._ssaoSampleKernel[i * 3] = _vec3[0]; + this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; + this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; + } + const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); + _vec3[2] = 0; + for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + normalize$2(_vec3, _vec3); + noise[i * 4] = _vec3[0]; + noise[i * 4 + 1] = _vec3[1]; + } + this._ssaoNoiseTexture = this._gl.createTexture(); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); + this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); + this._ssaoWidth = -1; + this._ssaoHeight = -1; + this._shadowWidth = -1; + this._shadowHeight = -1; + this._shaderResources.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._backgroundShader.initializeContext(this._gl); + this._ssaoShader.initializeContext(this._gl); + this._boxShader.initializeContext(this._gl); + this._deferredShader.initializeContext(this._gl); + this._combineShader.initializeContext(this._gl); + this._dofBlurShader.initializeContext(this._gl); + this._downsampleShader.initializeContext(this._gl); + this._gaussianShader.initializeContext(this._gl); + this._dofCombineShader.initializeContext(this._gl); + this._fxaaShader.initializeContext(this._gl); + this._brightPassShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); } - case 14u: { - return hitConstantMedium(id, ray, invDir, tMin, tMax, hitRecord, seed); + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + } + _resize(width2, height2) { + super._resize(width2, height2); + this._positionTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); + this._colorTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._normalTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._geometryFrameBuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width2, height2); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._gl.drawBuffers([this._gl.COLOR_ATTACHMENT0, this._gl.COLOR_ATTACHMENT1, this._gl.COLOR_ATTACHMENT2]); + this._postProcessTexture1 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessDepthTexture = TextureHelper.create(this._gl, width2, height2, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); + this._postProcessTexture2 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); + this._postProcessDofTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); + this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); + const widthHalf = Math.round(width2 / 2); + const heightHalf = Math.round(height2 / 2); + this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); + this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); + this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); + this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); + const widthSixteenth = Math.round(widthEighth / 2); + const hgeightSixteenth = Math.round(heightEighth / 2); + this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); + this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); + } + _createContext(canvas) { + let supported = false; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + const options = { + stencil: true, + alpha: false, + antialias: false, + preserveDrawingBuffer + }; + const gl = canvas.getContext("webgl2", options); + if (gl) { + const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); + if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { + const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); + const framebuffer = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + if (status == gl.FRAMEBUFFER_COMPLETE) { + supported = true; + } + gl.bindTexture(gl.TEXTURE_2D, null); } - case 15u: { - return hitSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); + } + return supported ? gl : null; + } + prepare() { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + break; + } + } + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + _createLabelVisual(label2) { + return new LabelVisual(this._core, this, label2); + } + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; + } + createImageVisual(image2) { + const visual = new ImageVisual(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; + } + createFontVisual(font2) { + const visual = new FontVisual(this._core, font2); + visual.initializeContext(this._gl); + return visual; + } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); + } + update(elapsedTime) { + super.update(elapsedTime); + if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { + this._shadowWidth = this._config.shadowWidth; + this._shadowHeight = this._config.shadowHeight; + this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._shadowFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); + this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); + } + if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { + this._ssaoWidth = this._config.ssaoWidth; + this._ssaoHeight = this._config.ssaoHeight; + this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); + this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); + this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); + } + if (this._config.isDofEnabled && this._config.dofAutoFocus) { + this._core.getModelManipulationOrigin(this._modelManipulationOrigin); + this._core.getModelPosition(this._modelPosition); + add(this._position, this._modelManipulationOrigin, this._modelPosition); + this._core.camera.getPosition(this._cameraPosition); + subtract(this._position, this._position, this._cameraPosition); + const distance2 = -this._position[2]; + const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); + this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance2, amount); + } + } + render(elapsedTime) { + return __awaiter$1(this, void 0, void 0, function* () { + this._gl.enable(this._gl.DEPTH_TEST); + this._gl.enable(this._gl.CULL_FACE); + this._gl.cullFace(this._gl.BACK); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); } - case 16u: { - return hitRotatedSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); + if (this.config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.clear(this._gl.DEPTH_BUFFER_BIT); + perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + fromMat4(this._cameraRotation, this.inverseVMatrices[0]); + transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); + add(this._position, this._position, this._modelPosition); + lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants.VECTOR3_UNITY); + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(transitionBuffer); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.geometryFramebuffer = this._geometryFrameBuffer; + axesVisual.render(elapsedTime); + } + } } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; + labelSetVisual.render(elapsedTime); + } + } } - case 18u: { - return hitXyDisk(id, ray, tMin, tMax, hitRecord); + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.geometryFramebuffer = this._geometryFrameBuffer; + imageVisual.render(elapsedTime); + } + } + } + if (this._backgroundShader.isInitialized) { + this._backgroundShader.prepare(); + this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._backgroundShader.apply(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._gl.bindVertexArray(null); + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$2(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + } else { + set$2(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { + const viewport = this._viewportOffset; + this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } } - case 19u: { - return hitRotatedXyDisk(id, ray, tMin, tMax, hitRecord); + }); + } + _renderTransitionBuffer(transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = currentBuffer.from; + this._blockShader.rangeMax = currentBuffer.to; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._blockShader.vMatrix = this.vMatrices[viewport]; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = true; + this._blockShader.vMatrix = this._shadowVMatrix; + this._blockShader.pMatrix = this._shadowPMatrix; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.isShadowMap = false; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = currentBuffer.from; + this._sphereShader.rangeMax = currentBuffer.to; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sphereShader.vMatrix = this.vMatrices[viewport]; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = true; + this._sphereShader.vMatrix = this._shadowVMatrix; + this._sphereShader.pMatrix = this._shadowPMatrix; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.isShadowMap = false; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = currentBuffer.from; + this._cylinderShader.rangeMax = currentBuffer.to; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._cylinderShader.vMatrix = this.vMatrices[viewport]; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = true; + this._cylinderShader.vMatrix = this._shadowVMatrix; + this._cylinderShader.pMatrix = this._shadowPMatrix; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.isShadowMap = false; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = currentBuffer.from; + this._sdfShader.rangeMax = currentBuffer.to; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sdfShader.vMatrix = this.vMatrices[viewport]; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = true; + this._sdfShader.vMatrix = this._shadowVMatrix; + this._sdfShader.pMatrix = this._shadowPMatrix; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.isShadowMap = false; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); + } + } + _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { + if (this._deferredShader.isInitialized) { + this._gl.disable(this._gl.DEPTH_TEST); + let ssaoTexture; + if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { + this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); + ssaoTexture = this._ssaoTexture1; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); + this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; + this._ssaoShader.indexBuffer = this._quad.indexBuffer; + this._ssaoShader.texture2D1 = this._positionTexture; + this._ssaoShader.texture2D2 = this._normalTexture; + this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; + this._ssaoShader.prepare(); + this._ssaoShader.pMatrix = pMatrix; + this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; + this._ssaoShader.ssaoRadius = this._config.ssaoRadius; + this._ssaoShader.ssaoPower = this._config.ssaoPower; + this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; + this._ssaoShader.left = 0; + this._ssaoShader.top = 0; + this._ssaoShader.width = this._config.ssaoWidth; + this._ssaoShader.height = this._config.ssaoHeight; + this._ssaoShader.apply(); + this._ssaoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { + ssaoTexture = this._ssaoTexture2; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); + this._boxShader.vertexBuffer = this._quad.vertexBuffer; + this._boxShader.indexBuffer = this._quad.indexBuffer; + this._boxShader.texture2D = this._ssaoTexture1; + this._boxShader.prepare(); + this._boxShader.left = 0; + this._boxShader.top = 0; + this._boxShader.width = this._config.ssaoWidth; + this._boxShader.height = this._config.ssaoHeight; + this._boxShader.apply(); + this._boxShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); + let postProcessFrameBuffer = this._postProcessFrameBuffer1; + this._shaderResources.bindFramebuffer(postProcessFrameBuffer); + this._deferredShader.vertexBuffer = this._quad.vertexBuffer; + this._deferredShader.indexBuffer = this._quad.indexBuffer; + this._deferredShader.texture2D1 = this._positionTexture; + this._deferredShader.texture2D2 = this._colorTexture; + this._deferredShader.texture2D3 = this._normalTexture; + this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; + this._deferredShader.texture2D5 = this._shadowDepthTexture; + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); + this._deferredShader.prepare(); + this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; + this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; + this._deferredShader.inverseVMatrix = inverseVMatrix; + this._deferredShader.shadowVMatrix = this._shadowVMatrix; + this._deferredShader.shadowPMatrix = this._shadowPMatrix; + this._deferredShader.vMatrix = vMatrix; + this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; + this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; + this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; + this._core.camera.getPosition(this._cameraPosition); + fromMat4(this._cameraRotation, vMatrix); + set$3(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + normalize$2(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); + subtract(this._direction, this._cameraPosition, this._position); + normalize$2(this._direction, this._direction); + add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); + normalize$2(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); + copy$3(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); + copy$3(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); + this._deferredShader.left = viewport.left; + this._deferredShader.top = viewport.top; + this._deferredShader.width = viewport.width; + this._deferredShader.height = viewport.height; + this._deferredShader.shadowMapWidth = this._config.shadowWidth; + this._deferredShader.shadowMapHeight = this._config.shadowHeight; + this._deferredShader.ambientIntensity = this._config.ambientIntensity; + this._deferredShader.materialIntensity = this._config.materialIntensity; + this._deferredShader.specularPower = this._config.specularPower; + this._deferredShader.specularIntensity = this._config.specularIntensity; + this._deferredShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + const widthHalf = Math.round(viewport.width / 2); + const heightHalf = Math.round(viewport.height / 2); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + const widthSixteenth = Math.round(widthEighth / 2); + const heightSixteenth = Math.round(heightEighth / 2); + if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; + this._dofBlurShader.indexBuffer = this._quad.indexBuffer; + this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofBlurShader.texture2D2 = this._positionTexture; + this._dofBlurShader.prepare(); + this._dofBlurShader.focusDepth = this._config.dofFocusDistance; + this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; + this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; + this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; + this._dofBlurShader.left = viewport.left; + this._dofBlurShader.top = viewport.top; + this._dofBlurShader.width = viewport.width; + this._dofBlurShader.height = viewport.height; + this._dofBlurShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; + this._dofCombineShader.indexBuffer = this._quad.indexBuffer; + this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofCombineShader.texture2D2 = this._postProcessDofTexture; + this._dofCombineShader.prepare(); + this._dofCombineShader.focusDepth = this._config.dofFocusDistance; + this._dofCombineShader.left = viewport.left; + this._dofCombineShader.top = viewport.top; + this._dofCombineShader.width = viewport.width; + this._dofCombineShader.height = viewport.height; + this._dofCombineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthHalf; + this._brightPassShader.height = heightHalf; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessHalfTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthQuarter; + this._brightPassShader.height = heightQuarter; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessQuarterTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthEighth; + this._brightPassShader.height = heightEighth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessEighthTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthSixteenth; + this._brightPassShader.height = heightSixteenth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessHalfTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthHalf; + this._gaussianShader.height = heightHalf; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessHalfTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessQuarterTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthQuarter; + this._gaussianShader.height = heightQuarter; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessQuarterTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessEighthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthEighth; + this._gaussianShader.height = heightEighth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessEighthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthSixteenth; + this._gaussianShader.height = heightSixteenth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; + this._fxaaShader.indexBuffer = this._quad.indexBuffer; + this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._fxaaShader.prepare(); + this._fxaaShader.left = viewport.left; + this._fxaaShader.top = viewport.top; + this._fxaaShader.width = viewport.width; + this._fxaaShader.height = viewport.height; + this._fxaaShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._combineShader.vertexBuffer = this._quad.vertexBuffer; + this._combineShader.indexBuffer = this._quad.indexBuffer; + this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + if (this._config.isBloomEnabled) { + this._combineShader.texture2D2 = this._postProcessHalfTexture1; + this._combineShader.texture2D3 = this._postProcessQuarterTexture1; + this._combineShader.texture2D4 = this._postProcessEighthTexture1; + this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; + } else { + this._combineShader.texture2D2 = null; + this._combineShader.texture2D3 = null; + this._combineShader.texture2D4 = null; + this._combineShader.texture2D5 = null; + } + this._combineShader.prepare(); + this._combineShader.viewport = viewport; + this._combineShader.intensity = this._config.bloomIntensity; + this._combineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }); + class MaterialBufferData extends Float32Array { + constructor(count2) { + super(count2 * MaterialBufferData.SIZE); + this.TYPE_OFFSET = 0 / 4; + this.FUZZ_OFFSET = 4 / 4; + this.REFRACTIVE_INDEX_OFFSET = 8 / 4; + this.TEXTURE_ID_OFFSET = 12 / 4; + this.COLOR_OFFSET = 16 / 4; + this.GLOSSINESS_OFFSET = 28 / 4; + this.ID_COLOR_OFFSET = 32 / 4; + this.DENSITY_OFFSET = 48 / 4; } -} - -fn intersectBox(center: vec3<f32>, size: vec3<f32>, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32) -> bool { - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t0 = -n - k; - let t1 = -n + k; - let tNear = max(max(t0.x, t0.y), t0.z); - let tFar = min(min(t1.x, t1.y), t1.z); - if (tNear > tFar) { return false; } - return tNear < tMax && tFar > 0f; // Must return true when inside box, even if closestSoFar is closer than far box intersection -} - -fn hitConstantMedium(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let constantMedium = &hittableBuffer.hittables[id]; - let boundaryTypeId = u32((*constantMedium).boundaryTypeId); - var tempHitRecord1: HitRecord; - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, -100f, 100f, &tempHitRecord1)) { return false; } - var tempHitRecord2: HitRecord; - // When raymarching narrow grazing angles, adding SHADOW_OFFSET is < epsilon from surface, so hit function returns tN not tF, hence distanceInsideBoundary is incorrect - // Add larger distance to t - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, tempHitRecord1.t + 0.001f, 100f, &tempHitRecord2)) { return false; } - if (tempHitRecord1.t < tMin) { tempHitRecord1.t = tMin; } - if (tempHitRecord2.t > tMax) { tempHitRecord2.t = tMax; } - if (tempHitRecord1.t >= tempHitRecord2.t) { - return false; + getType(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET]; } - tempHitRecord1.t = max(tempHitRecord1.t, 0f); - let distanceInsideBoundary = tempHitRecord2.t - tempHitRecord1.t; - let negativeInverseDensity = -1f / materialBuffer.materials[u32((*constantMedium).materialId)].density; - let hitDistance = negativeInverseDensity * log(random(seed)); - if (hitDistance > distanceInsideBoundary) { return false; } - let t = tempHitRecord1.t + hitDistance; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - return true; -} - -fn hitConstantMediumBoundary(id: u32, boundaryTypeId: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - switch boundaryTypeId { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); - } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); - } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); - } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); - } - } -} - -fn hitSphere(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let sphere = &hittableBuffer.hittables[id]; - let radius = (*sphere).size0.x; - let time = min(max((ray.time - (*sphere).time0) / ((*sphere).time1 - (*sphere).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*sphere).center0 + time * ((*sphere).center1 - (*sphere).center0); - let oc = ray.origin - center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - h = sqrt(h); - - // Find the nearest root in range - var root = -b - h; - if (root < tMin || root > tMax) { - root = -b + h; - if (root < tMin || root > tMax) { return false; } - } - - // (*hitRecord).t = root; - // (*hitRecord).position = rayAt(ray, root); - // let outwardNormal = ((*hitRecord).position - center) / radius; - // setFaceNormal(ray, outwardNormal, hitRecord); - - // Reduce precision error in t by ensuring hit position is on sphere surface - let outwardNormal = normalize(ray.origin + ray.direction * root - center); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + outwardNormal * radius; // Use outward normal with internal reflection - (*hitRecord).t = root; // I should also re-calculate t, but this would involve another normalization. t is only used to check closest hit, so only important with overlapping geometry - - // UV - let phi = atan2(outwardNormal.x, outwardNormal.z); // [-pi,pi] - let theta = asin(outwardNormal.y); // [-pi/2, pi/2] - (*hitRecord).uv = vec2<f32>(phi / TWO_PI + 0.5f, theta / PI + 0.5f); // [0,1] - return true; -} - -fn hitBox(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let box = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*box).time0) / ((*box).time1 - (*box).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*box).center0 + time * ((*box).center1 - (*box).center0); - let size = (*box).size0 + time * ((*box).size1 - (*box).size0); - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t1 = -n - k; - let t2 = -n + k; - let tNear = max(max(t1.x, t1.y), t1.z); - let tFar = min(min(t2.x, t2.y), t2.z); - // if (tFar <= tNear) { return false; } - if (tNear > tFar || tFar < 0f) { return false; } - - // Find nearest root in range - var outwardNormal: vec3<f32>; - var root = tNear; - if (root < tMin || root > tMax) { - root = tFar; - if (root < tMin || root > tMax) { return false; } - outwardNormal = sign(ray.direction) * step(t2.xyz, t2.yzx) * step(t2.xyz, t2.zxy); + setType(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; } - else { - outwardNormal = -sign(ray.direction) * step(t1.yzx, t1.xyz) * step(t1.zxy, t1.xyz); + getFuzz(index2) { + return this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET]; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedBox(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBox = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBox).time0) / ((*rotatedBox).time1 - (*rotatedBox).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBox).center0 + time * ((*rotatedBox).center1 - (*rotatedBox).center0); - let rotation = slerpQuat((*rotatedBox).rotation0, (*rotatedBox).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let rotatedInvDir = vec3<f32>(1f, 1f, 1f) / rotatedRay.direction; - let hit = hitBox(id, rotatedRay, rotatedInvDir, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setFuzz(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET] = value2; } - return false; -} - -fn hitXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyDisk = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyDisk).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let radius = (*xyDisk).size0.x; - if (dot(p, p) > radius * radius) { return false; } // dot(p, p) is squared distance from disk center to intersection point - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / radius + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyDisk).texCoord0; - let texCoord1 = (*xyDisk).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyDisk = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyDisk).center0; - let time = min(max((ray.time - (*rotatedXyDisk).time0) / ((*rotatedXyDisk).time1 - (*rotatedXyDisk).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyDisk).center0 + time * ((*rotatedXyDisk).center1 - (*rotatedXyDisk).center0); - let rotation = slerpQuat((*rotatedXyDisk).rotation0, (*rotatedXyDisk).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyDisk(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getRefractiveIndex(index2) { + return this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET]; } - return false; -} - -fn hitXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyRect).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setRefractiveIndex(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET] = value2; } - return false; -} - -fn hitXzRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xzRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xzRect).center0; - - // Distance to plane, t - let t = -oc.y / ray.direction.y; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xzRect).size0; - if (abs(p.x) > size.x || abs(p.z) > size.z) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xz / size.xz + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xzRect).texCoord0; - let texCoord1 = (*xzRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 1f, 0f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -// fn hitYzRect(yzRect: Hittable, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { -// let oc = ray.origin - yzRect.center0; - -// // Distance to plane, t -// let t = -oc.x / ray.direction.x; - -// // If direction == 0, t = +/- infinity, which always returns false -// if (t < tMin || t > tMax) { return false; } - -// // Intersection point in model space -// let p = oc + t * ray.direction; - -// // Bounds -// if (abs(p.y) > yzRect.size0.y || abs(p.z) > yzRect.size0.z) { return false; } - -// // Texture coords -// var uv = vec2<f32>(0.5 * p.yz / yzRect.size0.yz + vec2<f32>(0.5f, 0.5f)); -// uv = yzRect.texCoord0 + uv * (yzRect.texCoord1 - yzRect.texCoord0); - -// (*hitRecord).uv = uv; -// (*hitRecord).t = t; -// (*hitRecord).position = rayAt(ray, t); -// let outwardNormal = vec3<f32>(1f, 0f, 0f); -// setFaceNormal(ray, outwardNormal, hitRecord); -// return true; -// } - -// TODO: Share hit function with XyRect -fn hitFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - let r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - if (r < buffer) { return false; } - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitFontXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getTextureId(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET]; } - return false; -} - -// TODO: Share hit function with FontXyRect, specifying texture -fn hitSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - // let size = (*xyRect).size0; - let size = (*xyRect).size0 + time * ((*xyRect).size1 - (*xyRect).size0); - if (abs(p.x) > (*xyRect).size0.x || abs(p.y) > (*xyRect).size0.y) { return false; } - - // Zero-thickness transparency - // TODO: Pre-multiplied alpha - // if (random(seed) > 0.5f) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - // let r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; - var r: f32; - if ((*xyRect).texId == 0f) { - r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; + setTextureId(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET] = value2; } - else { - r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - } - if (r < buffer) { return false; } - - // sdfBorder - let border = xyRect.sdfBorder / 0xff; - (*hitRecord).sdfBorder = r - buffer < border; - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitSdfXyRect(id, rotatedRay, tMin, tMax, hitRecord, seed); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getGlossiness(index2) { + return this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET]; + } + setGlossiness(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET] = value2; + } + getDensity(index2) { + return this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET]; + } + setDensity(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET] = value2; + } + getIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + } + MaterialBufferData.SIZE = 64 / 4; + class TextureBufferData extends Float32Array { + constructor(count2) { + super(count2 * TextureBufferData.SIZE); + this.COLOR0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.COLOR1_OFFSET = 16 / 4; + this.SIZE0_OFFSET = 32 / 4; + this.SIZE1_OFFSET = 48 / 4; + this.CLIP_OFFSET = 64 / 4; + this.OFFSET_OFFSET = 80 / 4; + } + getType(index2) { + return this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + set(value2, this[offset2], this[offset2 + 1]); + } + setOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + } + } + TextureBufferData.SIZE = 96 / 4; + class HittableBufferData extends Float32Array { + constructor(count2) { + super(count2 * HittableBufferData.SIZE); + this.CENTER0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.SIZE0_OFFSET = 16 / 4; + this.MATERIAL_ID_OFFSET = 28 / 4; + this.ROTATION0_OFFSET = 32 / 4; + this.ROTATION1_OFFSET = 48 / 4; + this.TEXCOORD0_OFFSET = 64 / 4; + this.TEXCOORD1_OFFSET = 72 / 4; + this.CENTER1_OFFSET = 80 / 4; + this.ROUNDING_OFFSET = 92 / 4; + this.SIZE1_OFFSET = 96 / 4; + this.BOUNDARY_TYPE_OFFSET = 108 / 4; + this.TIME0_OFFSET = 112 / 4; + this.TIME1_OFFSET = 116 / 4; + this.TEX_ID_OFFSET = 120 / 4; + this.SDF_BUFFER_OFFSET = 124 / 4; + this.SDF_BORDER_OFFSET = 128 / 4; + this.PARAMETER_1_OFFSET = 132 / 4; + this.PARAMETER_2_OFFSET = 136 / 4; + this.MATERIAL_FUZZ_OFFSET = 140 / 4; + this.MATERIAL_GLOSS_OFFSET = 144 / 4; + this.MATERIAL_DENSITY_OFFSET = 148 / 4; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; + this.MATERIAL_COLOR_OFFSET = 160 / 4; + this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; + this.SEGMENT_COLOR_OFFSET = 176 / 4; + this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; + this.TEXTURE_ID_OFFSET = 196 / 4; + } + getType(index2) { + return this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getTime0(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET]; + } + setTime0(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET] = value2; + } + getTime1(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET]; + } + setTime1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET] = value2; + } + getSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + set$1(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + set$1(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + set(value2, this[offset2], this[offset2 + 1]); + } + setTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + } + getTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + set(value2, this[offset2], this[offset2 + 1]); + } + setTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + } + getRounding(index2) { + return this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET]; + } + setRounding(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET] = value2; + } + getParameter1(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET]; + } + setParameter1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET] = value2; + } + getParameter2(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET]; + } + setParameter2(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET] = value2; + } + getBoundaryType(index2) { + return this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET]; + } + setBoundaryType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET] = value2; + } + getTexId(index2) { + return this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET]; + } + setTexId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET] = value2; + } + getSdfBuffer(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET]; + } + setSdfBuffer(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET] = value2; + } + getSdfBorder(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET]; } - return false; -} - -fn rotateQuat(v: vec3<f32>, q: vec4<f32>) -> vec3<f32> { - return v + 2f * cross(q.xyz, cross(q.xyz, v) + q.w * v); -} - -fn slerpQuat(q0: vec4<f32>, q1: vec4<f32>, t: f32) -> vec4<f32> { - var cosom = dot(q0, q1); - var q2 = q1; - if (cosom < 0f) { - cosom = -cosom; - q2 = -q2; - } - var s0: f32; - var s1: f32; - if (1f - cosom > 0.000001f) { - // SLERP - let omega = acos(cosom); - let sinom = sin(omega); - s0 = sin((1f - t) * omega) / sinom; - s1 = sin(t * omega) / sinom; - } - else { - // Quaternions close enough for LERP - s0 = 1f - t; - s1 = t; - } - return s0 * q0 + s1 * q2; -} - -fn conjugate(q: vec4<f32>) -> vec4<f32> { - return vec4<f32>(-q.x, -q.y, -q.z, q.w); -} - -fn hitCylinder(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinder = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinder).time0) / ((*cylinder).time1 - (*cylinder).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinder).center0 + time * ((*cylinder).center1 - (*cylinder).center0); - let size = (*cylinder).size0 + time * ((*cylinder).size1 - (*cylinder).size0); - let rotation = slerpQuat((*cylinder).rotation0, (*cylinder).rotation1, time); - let ra = size.x; // Radius - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let oc = ray.origin - center; - let card = dot(ca, ray.direction); - let caoc = dot(ca, oc); - let a = 1f - card * card; - let b = dot(oc, ray.direction) - caoc * card; - let c = dot(oc, oc) - caoc * caoc - ra * ra; - var h = b * b - a * c; - if (h < 0f) { return false; } - h = sqrt(h); - let br0 = (-b - h) / a; - let br1 = (-b + h) / a; - - // Body - let ch = size.y; // Half-height - let y0 = caoc + br0 * card; - let y1 = caoc + br1 * card; - let bt0 = select(10000000f, br0, abs(y0) < ch); - let bt1 = select(-10000000f, br1, abs(y1) < ch); - - // Caps - let sy0 = sign(y0); - let sy1 = sign(y1); - let cr0 = (sy0 * ch - caoc) / card; - let cr1 = (sy1 * ch - caoc) / card; - let ct0 = select(10000000f, cr0, abs(b + a * cr0) < h); - let ct1 = select(-10000000f, cr1, abs(b + a * cr1) < h); - - // Find the nearest root in range - let tN = min(bt0, ct0); - let tF = max(bt1, ct1); - var root = tN; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - } - - // Normal - var outwardNormal: vec3<f32>; - if (root == bt0 || root == bt1) { - let y = select(y1, y0, root == bt0); - // outwardNormal = (oc + root * ray.direction - ca * y) / ra; - - // Reduce precision error in t by ensuring hit position is on cylinder surface - outwardNormal = normalize(oc + root * ray.direction - ca * y); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + ca * y + outwardNormal * ra; // Use outward normal with internal reflection - (*hitRecord).t = root; + setSdfBorder(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET] = value2; } - else { - let sy = select(sy1, sy0, root == ct0); - outwardNormal = ca * sy; - - // TODO: Reduce precision error - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = rayAt(ray, root); - (*hitRecord).t = root; - } - - // setFaceNormal(ray, outwardNormal, hitRecord); - // (*hitRecord).position = rayAt(ray, root); - // (*hitRecord).t = root; - return true; -} - -fn hitHexPrism(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrism = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*hexPrism).time0) / ((*hexPrism).time1 - (*hexPrism).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrism).center0 + time * ((*hexPrism).center1 - (*hexPrism).center0); - let oc = ray.origin - center; - let size = (*hexPrism).size0; - let ra = size.x; // Distance from center to edge - let he = size.y; // Half-height - let rd = ray.direction; - - // Normals - let n1 = vec3<f32>(1f, 0f, 0f); - let n2 = vec3<f32>(0.5f, 0f, ROOT_THREE_OVER_TWO); - let n3 = vec3<f32>(-0.5f, 0f, ROOT_THREE_OVER_TWO); - let n4 = vec3<f32>(0f, 1f, 0f); - - // Slabs intersections - var t1 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n1)) / dot(rd, n1), 1f); - var t2 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n2)) / dot(rd, n2), 1f); - var t3 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n3)) / dot(rd, n3), 1f); - var t4 = vec3<f32>((vec2<f32>(he, -he) - dot(oc, n4)) / dot(rd, n4), 1f); - - // Inetsection selection - if (t1.y < t1.x) { t1 = vec3<f32>(t1.yx, -1f); } - if (t2.y < t2.x) { t2 = vec3<f32>(t2.yx, -1f); } - if (t3.y < t3.x) { t3 = vec3<f32>(t3.yx, -1f); } - if (t4.y < t4.x) { t4 = vec3<f32>(t4.yx, -1f); } - - var tN = vec4<f32>(t1.x, t1.z * n1); - if (t2.x > tN.x) { tN = vec4<f32>(t2.x, t2.z * n2); } - if (t3.x > tN.x) { tN = vec4<f32>(t3.x, t3.z * n3); } - if (t4.x > tN.x) { tN = vec4<f32>(t4.x, t4.z * n4); } - - let tF = min(min(t1.y,t2.y),min(t3.y,t4.y)); - - if (tN.x > tF || tF < 0f) { return false; } - - // Find the nearest root in range - var outwardNormal: vec3<f32>; - var root = tN.x; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - - // Normal - if (root == t1.y) { outwardNormal = -t1.z * n1; } - else if (root == t2.y) { outwardNormal = -t2.z * n2; } - else if (root == t3.y) { outwardNormal = -t3.z * n3; } - else if (root == t4.y) { outwardNormal = -t4.z * n4; } + getMaterialTypeId(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET]; } - else { - outwardNormal = tN.yzw; + setMaterialTypeId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET] = value2; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { - let q = abs(p) - b; - return length(max(q, vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y, q.z)), 0f) - r; -} - -// Box frame -// fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { -// let s = abs(p) - b; -// // let e = b.y / 3f; -// let e = 0.0002f; -// let q = abs(s + e) - e; -// return min(min( -// length(max(vec3<f32>(s.x, q.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(s.x, max(q.y,q.z)), 0f), -// length(max(vec3<f32>(q.x, s.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(s.y,q.z)), 0f)), -// length(max(vec3<f32>(q.x, q.y, s.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y,s.z)), 0f)); -// } - -fn hitBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let boxSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*boxSdf).rounding; - // let size = (*boxSdf).size0 - r; - let time = min(max((ray.time - (*boxSdf).time0) / ((*boxSdf).time1 - (*boxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*boxSdf).center0 + time * ((*boxSdf).center1 - (*boxSdf).center0); - // TODO: r0, r1 - let size = (*boxSdf).size0 + time * ((*boxSdf).size1 - (*boxSdf).size0) - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapBoxSdf(oc, size, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapBoxSdf(oc + k.xyy * h, size, r) + - k.yyx * mapBoxSdf(oc + k.yyx * h, size, r) + - k.yxy * mapBoxSdf(oc + k.yxy * h, size, r) + - k.xxx * mapBoxSdf(oc + k.xxx * h, size, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getMaterialFuzz(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET]; } - return false; -} - -fn hitRotatedBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBoxSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBoxSdf).time0) / ((*rotatedBoxSdf).time1 - (*rotatedBoxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBoxSdf).center0 + time * ((*rotatedBoxSdf).center1 - (*rotatedBoxSdf).center0); - let rotation = slerpQuat((*rotatedBoxSdf).rotation0, (*rotatedBoxSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitBoxSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setMaterialFuzz(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET] = value2; } - return false; -} - -fn mapCylinderSdf(p: vec3<f32>, a: vec3<f32>, b: vec3<f32>, r0: f32, r1: f32) -> f32 { - let ba: vec3<f32> = b - a; - let pa: vec3<f32> = p - a; - let baba: f32 = dot(ba, ba); - let paba: f32 = dot(pa, ba); - let x: f32 = length(pa * baba - ba * paba) - r0 * baba; - let y: f32 = abs(paba - baba * 0.5f) - baba * 0.5f; - let x2: f32 = x * x; - let y2: f32 = y * y * baba; - // let d: f32 = (max(x, y) < 0f) ? -min(x2, y2) : (((x > 0f) ? x2 : 0f) + ((y > 0f) ? y2 : 0f)); - let d: f32 = select(select(0f, x2, x > 0f) + select(0f, y2, y > 0f), -min(x2, y2), max(x, y) < 0f); - return sign(d) * sqrt(abs(d)) / baba - r1; -} - -fn hitCylinderSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinderSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinderSdf).time0) / ((*cylinderSdf).time1 - (*cylinderSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinderSdf).center0 + time * ((*cylinderSdf).center1 - (*cylinderSdf).center0); - let size = (*cylinderSdf).size0 + time * ((*cylinderSdf).size1 - (*cylinderSdf).size0); - let rotation = slerpQuat((*cylinderSdf).rotation0, (*cylinderSdf).rotation1, time); - var t = tMin; - let r1 = (*cylinderSdf).rounding; - let r0 = size.x - r1; - let h0 = size.y - r1; - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let pa = ca * h0; - let pb = -pa; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapCylinderSdf(oc, pa, pb, r0, r1)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapCylinderSdf(oc + k.xyy * h, pa, pb, r0, r1) + - k.yyx * mapCylinderSdf(oc + k.yyx * h, pa, pb, r0, r1) + - k.yxy * mapCylinderSdf(oc + k.yxy * h, pa, pb, r0, r1) + - k.xxx * mapCylinderSdf(oc + k.xxx * h, pa, pb, r0, r1)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getMaterialDensity(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET]; } - return false; -} - -fn mapHexPrismSdf(p: vec3<f32>, hx: f32, hy: f32, r: f32) -> f32 { - let k = vec3<f32>(-0.8660254, 0.5, 0.57735); // (-sqrt(3)/2 or sin(60), 0.5, sqrt(3)/3 or tan(30)) - var p0 = abs(p.zxy); - let p1 = p0.xy - 2f * min(dot(k.xy, p0.xy), 0f) * k.xy; - let d = vec2<f32>(length(p1.xy - vec2(clamp(p1.x, -k.z * hx, k.z * hx), hx)) * sign(p1.y - hx), p0.z - hy); - return min(max(d.x, d.y), 0f) + length(max(d, vec2<f32>(0f, 0f))) - r; -} - -fn hitHexPrismSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrismSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*hexPrismSdf).rounding; - let size = (*hexPrismSdf).size0; - let time = min(max((ray.time - (*hexPrismSdf).time0) / ((*hexPrismSdf).time1 - (*hexPrismSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrismSdf).center0 + time * ((*hexPrismSdf).center1 - (*hexPrismSdf).center0); - let hx = size.x - r; - let hy = size.y - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapHexPrismSdf(oc, hx, hy, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // Replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapHexPrismSdf(oc + k.xyy * h, hx, hy, r) + - k.yyx * mapHexPrismSdf(oc + k.yyx * h, hx, hy, r) + - k.yxy * mapHexPrismSdf(oc + k.yxy * h, hx, hy, r) + - k.xxx * mapHexPrismSdf(oc + k.xxx * h, hx, hy, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + setMaterialDensity(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET] = value2; } - return false; -} - -fn mapRingSdf(p: vec3<f32>, n: vec2<f32>, r: f32, th: f32, h: f32, rounding: f32) -> f32 { - let px = abs(p.x); - // expand result of mat2x2(n.x,n.y,-n.y,n.x)*p; - // let p2 = vec2<f32>(n.x * px + n.y * p.y, -n.y * px + n.x * p.y); - // Column-major instead of row-major - let p2 = vec2<f32>(n.x * px - n.y * p.y, n.y * px + n.x * p.y); - let d = max(abs(length(p2) - r) - th * 0.5f, length(vec2<f32>(p2.x, max(0f, abs(r - p2.y) - th * 0.5f))) * sign(p2.x)); - - // Extrude - let w = vec2<f32>(d, abs(p.z) - h); - return min(max(w.x, w.y), 0f) + length(max(w, vec2<f32>(0f, 0f))) - rounding; -} - -fn hitRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let ringSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let size = (*ringSdf).size0; - let center = (*ringSdf).center0; - let rounding = (*ringSdf).rounding; - let outerr = size.x; - let innerr = size.y; - // Reduce angle such that inner radius arc reduces by rounding - var angle = (*ringSdf).parameter1; - angle -= angle * rounding / innerr * PI * 2; - let cs = vec2<f32>(cos(angle), sin(angle)); - let r = (outerr + innerr) * 0.5f; - let th = (outerr - innerr) - rounding; - let e = size.z - rounding; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapRingSdf(oc, cs, r, th, e, rounding)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.00001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapRingSdf(oc + k.xyy * h, cs, r, th, e, rounding) + - k.yyx * mapRingSdf(oc + k.yyx * h, cs, r, th, e, rounding) + - k.yxy * mapRingSdf(oc + k.yxy * h, cs, r, th, e, rounding) + - k.xxx * mapRingSdf(oc + k.xxx * h, cs, r, th, e, rounding)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getMaterialGloss(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET]; } - return false; -} - -fn hitRotatedRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedRingSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedRingSdf).time0) / ((*rotatedRingSdf).time1 - (*rotatedRingSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedRingSdf).center0 + time * ((*rotatedRingSdf).center1 - (*rotatedRingSdf).center0); - let rotation = slerpQuat((*rotatedRingSdf).rotation0, (*rotatedRingSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitRingSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setMaterialGloss(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET] = value2; } - return false; -} - -fn hitLights(ray: Ray) -> vec3<f32> { - var hit: bool; - for (var i: u32 = 0u; i < arrayLength(&lightBuffer.lights); i = i + 1u) { - // let light = lightBuffer.lights[i]; - switch u32(lightBuffer.lights[i].typeId) { - default: { - hit = hitSphereLight(i, ray); - } - case 2u: { - hit = hitRectLight(i, ray); - } - } - if (hit) { - return lightBuffer.lights[i].color; - } - } - - // Background color - // return vec3<f32>(0f, 0f, 0f); - // return vec3<f32>(1f, 1f, 1f); - return uniforms.backgroundColor; - - // TODO: Dome light - // let t = 0.5f * (ray.direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return background; -} - -fn hitSphereLight(id: u32, ray: Ray) -> bool { - let sphere = &lightBuffer.lights[id]; - let radius = (*sphere).size.x; - let oc = ray.origin - (*sphere).center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - return b < 0f; // Ensure ray towards light -} - -fn hitRectLight(id: u32, ray: Ray) -> bool { - let rotatedXyRect = &lightBuffer.lights[id]; - let center = (*rotatedXyRect).center; - let rotation = (*rotatedXyRect).rotation; - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - if (dot(rotatedRay.direction, vec3<f32>(0f, 0f, 1f)) < 0f) { return false; } // Directional light - let oc = rotatedRay.origin - center; - let t = -oc.z / rotatedRay.direction.z; - if (t < 0f) { return false; } - let p = oc + t * rotatedRay.direction; - if (abs(p.x) > (*rotatedXyRect).size.x || abs(p.y) > (*rotatedXyRect).size.y) { return false; } - return true; -} - -fn nearZero(v: vec3<f32>) -> bool { - return max(max(abs(v.x), abs(v.y)), abs(v.z)) < 0.00000001f; // 1e-8 -} - -fn scatterLambertian(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let scatterDirection = hitRecord.normal + randomUnitVector(seed); - - // Catch degenerate scatter direction - (*ray).direction = select(normalize(scatterDirection), hitRecord.normal, nearZero(scatterDirection)); - - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - return true; -} - -fn scatterMetal(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + materialBuffer.materials[hitRecord.materialId].fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; -} - -fn scatterGlossy(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Specular - let material = &materialBuffer.materials[hitRecord.materialId]; - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - if (reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + (*material).fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; + getMaterialRefractiveIndex(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; } - else { - // Lambertian - return scatterLambertian(ray, hitRecord, attenuation, seed); - } -} - -fn scatterDielectric(ray: ptr<function, Ray>, hitRecord: ptr<function, HitRecord>, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let material = &materialBuffer.materials[(*hitRecord).materialId]; - let refractiveIndex = (*material).refractiveIndex; - // TODO: If still inside another material, use its refractive index - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, (*hitRecord).frontFace); - let cosTheta = min(dot(-(*ray).direction, (*hitRecord).normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - // if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - if (cannotRefract || reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = reflect((*ray).direction, (*hitRecord).normal); + setMaterialRefractiveIndex(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value2; } - else { - (*ray).direction = refraction((*ray).direction, (*hitRecord).normal, refractionRatio); - } - (*ray).origin = (*hitRecord).position; - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); - - // Did the ray enter/stay inside? - (*attenuation) = vec3<f32>(1f, 1f, 1f); - // if (dot((*ray).direction, (*hitRecord).normal) < 0f) { - if (dot((*ray).direction, select(-(*hitRecord).normal, (*hitRecord).normal, (*hitRecord).frontFace)) < 0f) { - (*hitRecord).isAbsorbing = true; - (*hitRecord).absorption = (*material).color; - - // If already inside another absorbing dielectric, add to absorption - if ((*hitRecord).previousIsAbsorbing && (*hitRecord).id != (*hitRecord).previousId) { - (*hitRecord).absorption = (*hitRecord).absorption + (*hitRecord).previousAbsorption; - } + getMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; } - return true; -} - -fn scatterIsotropic(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = randomUnitVector(seed); - (*ray).origin = hitRecord.position; - (*attenuation) = materialBuffer.materials[hitRecord.materialId].color; - return true; -} - -fn scatterVarnish(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Front-face only (no internal reflection or refraction) - let material = &materialBuffer.materials[hitRecord.materialId]; - if (hitRecord.frontFace && (*material).glossiness > random(seed)) { - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - (*ray).direction = reflect((*ray).direction, hitRecord.normal); - } - else { - // Refraction improves definition at edges and deepens color on faces - (*ray).direction = refraction((*ray).direction, hitRecord.normal, refractionRatio); - } - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); + setMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - // Pass-through - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - return true; -} - -fn textureValue(hitRecord: HitRecord) -> vec3<f32> { - let textureId = materialBuffer.materials[hitRecord.materialId].textureId; - let texture = &textureBuffer.textures[u32(textureId)]; - switch u32((*texture).typeId) { - // No texture - default: { - return vec3<f32>(); - } - // Solid color - case 1u: { - if (hitRecord.sdfBorder) { - return (*texture).color1; - } - else { - return (*texture).color0; - } - - // Debug uv - // return vec3<f32>(hitRecord.uv, 0f); - } - // Image - case 2u: { - // Sample in linear space - return textureSampleLevel(backgroundTexture, linearSampler, hitRecord.uv, 0f).rgb; - // return vec3(hitRecord.uv.x, hitRecord.uv.y, 0f); - } - // Checker - case 4u: { - let q = trunc((hitRecord.uv + (*texture).offset) / (*texture).size0.xy); - return select((*texture).color0, (*texture).color1, (q.x + q.y) % 2f > 0f); - } - // Grid - case 5u: { - let size0 = (*texture).size0; - let size1 = (*texture).size1; - let clip = (*texture).clip; - if (hitRecord.uv.x < clip.x || hitRecord.uv.y < clip.y || hitRecord.uv.x > clip.z || hitRecord.uv.y > clip.w) { - return (*texture).color1; - } - let uv = hitRecord.uv + (*texture).offset; - var d = uv / size0.xy; - d = abs(d - round(d)) * size0.xy; - if (d.x < size1.x || d.y < size1.y) { - return (*texture).color0; - } - else { - d = uv / size0.zw; - d = abs(d - round(d)) * size0.zw; - if (d.x < size1.z || d.y < size1.w) { - return (*texture).color0; - } - return (*texture).color1; - } - } + getSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; + value2[3] = this[offset2 + 3]; } -} - -fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { - let maxDepth = 16u; // TODO: Pass as uniform - var depth = 0u; - // var result: Color; - var color = vec3<f32>(1f, 1f, 1f); - var attenuation = vec3<f32>(1f, 1f, 1f); - var emitted = vec3<f32>(0f, 0f, 0f); - var hitRecord: HitRecord; - hitRecord.id = 4294967295; // -1 as u32 - var scatter: bool; - loop { - // if (hitWorld(*ray, 0.00001f, 100f, &hitRecord, seed)) { - if (hitBVH(*ray, 0.00001f, 100f, &hitRecord, seed)) { - // Debug normal, depth - // First hit - // if (depth == 0u) { - // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - // // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f) - // // result.depth = 1f / hitRecord.t; - // result.depth = -1f / dot(hitRecord.position - (*ray).origin, uniforms.forward); - // } - // return result; - - // Depth - depth = depth + 1u; - if (depth == maxDepth) { - // Exceeded bounce limit, no more light is gathered - // result.color = vec3<f32>(0f, 0f, 0f); - // return result; - return vec3<f32>(0f, 0f, 0f); - } - - // Bounce - // If last hit was travelling INTO a dielectric, use last hit position to calculate distance - // and apply Beer's law to attenuate the light. Modify the dielectric scattering function to - // recrord travelling INTO a dielectric based on hitRecord normal and ray direction. - // Reset this flag each time here. - if (hitRecord.previousIsAbsorbing) { - // Beer's law - let d = distance(hitRecord.previousPosition, hitRecord.position); - color = color * exp(-d * hitRecord.previousAbsorption); - } - // Reset absorption - hitRecord.isAbsorbing = false; - hitRecord.absorption = vec3<f32>(0f, 0f, 0f); - switch u32(materialBuffer.materials[hitRecord.materialId].typeId) { - default: { - scatter = false; - } - case 0u: { - scatter = scatterLambertian(ray, hitRecord, &attenuation, seed); - } - case 1u: { - scatter = scatterMetal(ray, hitRecord, &attenuation, seed); - } - case 2u: { - scatter = scatterDielectric(ray, &hitRecord, &attenuation, seed); - } - case 3u: { - scatter = scatterGlossy(ray, hitRecord, &attenuation, seed); - } - case 4u: { - // Diffuse light - scatter = false; - emitted = materialBuffer.materials[hitRecord.materialId].color; - } - case 5u: { - scatter = scatterIsotropic(ray, hitRecord, &attenuation, seed); - } - case 6u: { - scatter = scatterVarnish(ray, hitRecord, &attenuation, seed); - } - } - - if (scatter) { - // Attenuate - color = color * attenuation; - } - else { - // Emit - // result.color = color * emitted; - // return result; - return color * emitted; - } - } - else { - // return color; - - // No hits - if (depth > 0u) { // Hide lights, background - return hitLights(*ray) * color; - // result.color = hitLights(*ray) * color; - // return result; - } - else { - // return vec3<f32>(0f, 0f, 0f); - return uniforms.backgroundColor; - // result.color = uniforms.backgroundColor; - // return result; - } - - // Background - // let t = 0.5f * ((*ray).direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return color * background; - } - } -} - -// TODO: Try writing color directly using var outputTexture : texture_storage_2d<rgb32f,read_write>; -// textureStore(outputTexture, uv, vec3<f32>(1f, 1f, 1f)); -@group(0) @binding(0) var<storage, read_write> outputColorBuffer: ColorBuffer; -@group(0) @binding(1) var<uniform> uniforms: Uniforms; -@group(0) @binding(2) var<storage, read> hittableBuffer: HittableBuffer; -@group(0) @binding(3) var<storage, read> materialBuffer: MaterialBuffer; -@group(0) @binding(4) var<storage, read> textureBuffer: TextureBuffer; -@group(0) @binding(5) var<storage, read> lightBuffer: LightBuffer; -@group(0) @binding(6) var<storage, read> linearBVHNodeBuffer: LinearBVHNodeBuffer; -@group(0) @binding(7) var linearSampler: sampler; -@group(0) @binding(8) var fontTexture: texture_2d<f32>; -@group(0) @binding(9) var backgroundTexture: texture_2d<f32>; -@group(0) @binding(10) var atlasTexture: texture_2d<f32>; -@group(0) @binding(11) var<storage, read_write> outputNormalDepthBuffer: NormalDepthBuffer; -@group(0) @binding(12) var<storage, read_write> depthMinMaxBuffer: DepthMinMaxBuffer; - -// TODO: Move lighting to seperate bind group so I can update it independently - -@compute @workgroup_size(256, 1, 1) -fn clear(@builtin(global_invocation_id) globalId : vec3<u32>) { - var index = globalId.x * 3u; - outputColorBuffer.values[index] = 0f; - outputColorBuffer.values[index + 1u] = 0f; - outputColorBuffer.values[index + 2u] = 0f; - index = globalId.x * 4u; - outputNormalDepthBuffer.values[index] = 0f; // Normal x - outputNormalDepthBuffer.values[index + 1u] = 0f; // Normal y - outputNormalDepthBuffer.values[index + 2u] = 0f; // Normal z - outputNormalDepthBuffer.values[index + 3u] = 0f; // Depth - atomicStore(&depthMinMaxBuffer.values[0], 4294967295u); - atomicStore(&depthMinMaxBuffer.values[1], 0u); -} - -@compute @workgroup_size(256, 1, 1) -fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var normal = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - depth = -1f / dot(hitRecord.position - ray.origin, uniforms.forward); - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = normal.x; - outputNormalDepthBuffer.values[index + 1u] = normal.y; - outputNormalDepthBuffer.values[index + 2u] = normal.z; - outputNormalDepthBuffer.values[index + 3u] = depth; - - // Min, max depth - // When depth is 0, it means no hit, so ignore - if (depth > 0f) { - atomicMin(&depthMinMaxBuffer.values[0], u32(depth * 1000f)); - } - atomicMax(&depthMinMaxBuffer.values[1], u32(depth * 1000f)); -} - -@compute @workgroup_size(256, 1, 1) -fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var color = vec4<f32>(1f, 1f, 1f, 0f); - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - // color = materialBuffer.materials[hitRecord.materialId].idColor; - let id = f32(hitRecord.id & 255u) / 255f; - color.x = id; - color.y = id; - color.z = id; - // let color3 = textureValue(hitRecord); - // color.x = color3.x; - // color.y = color3.y; - // color.z = color3.z; - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = color.x; - outputNormalDepthBuffer.values[index + 1u] = color.y; - outputNormalDepthBuffer.values[index + 2u] = color.z; - outputNormalDepthBuffer.values[index + 3u] = 1f; -} - -// @builtin(local_invocation_id) localId : vec3<u32>, -// @builtin(num_workgroups) numWorkgroups : vec3<u32>, -// @builtin(workgroup_id) workgroupId : vec3<u32> -// TODO: Use workgroup dimensions xy to get position directly froem globalId -// Then store using textureStore -// Check within bounds due to overdispatching - -@compute @workgroup_size(256, 1, 1) -fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // TODO: Is additional noise when tiling due to sdf iterations (try non-sdf), texel offsets, (size - 1) issues, overdispatching? - - // Tex coords [0,1] - // let id = f32(globalId.x); - // TODO: Divide by (imageSize.x - 1) - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Frame seed - var frameSeed = u32(uniforms.seed); - let raysPerFrame = u32(uniforms.raysPerFrame); - var color = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var normal = vec3<f32>(0f, 0f, 0f); - var seed: u32; - - for (var i = 0u; i < raysPerFrame; i = i + 1u) { - // Random number generator - // See https://nelari.us/post/weekend_raytracing_with_wgpu_1/#implement-a-random-number-generator - // fn initRng(pixel: vec2<u32>, resolution: vec2<u32>, frame: u32) -> u32 { - // // Adapted from https://github.com/boksajak/referencePT - // let seed = dot(pixel, vec2<u32>(1u, resolution.x)) ^ jenkinsHash(frame); - // return jenkinsHash(seed); - // } - // - // fn jenkinsHash(input: u32) -> u32 { - // var x = input; - // x += x << 10u; - // x ^= x >> 6u; - // x += x << 3u; - // x ^= x >> 11u; - // x += x << 15u; - // return x; - // } - // TODO: Consider switching to u32 for uniforms and use vec3<u32> arithmetic - seed = u32(tilePixelY * tileSize.x + tilePixelX) + frameSeed * u32(tileSize.x * tileSize.y); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord) + vec2<f32>(random(&seed), random(&seed)) / imageSize; - - // Ray - var ray = getCameraRay(camera, &seed, samplePos); - - // Color [0,1] - // let color = result.color; - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(1f, 1f, 1f)); - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - color += clamp(rayColor(&ray, &seed), vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - - // Depth - // let depth = 1f / rayColor(&ray, &seed).depth; - // color = vec3<f32>(depth, depth, depth); - // depth += result.depth; - - // Normal - // normal += result.normal; - - // Next frame - frameSeed = frameSeed + 1u; - } - let index = globalId.x * 3u; - outputColorBuffer.values[index + 0u] = outputColorBuffer.values[index + 0u] + color.x; - outputColorBuffer.values[index + 1u] = outputColorBuffer.values[index + 1u] + color.y; - outputColorBuffer.values[index + 2u] = outputColorBuffer.values[index + 2u] + color.z; - // outputDepthBuffer.values[globalId.x] = outputDepthBuffer.values[globalId.x] + depth; - // outputNormalBuffer.values[index + 0u] = outputNormalBuffer.values[index + 0u] + normal.x; - // outputNormalBuffer.values[index + 1u] = outputNormalBuffer.values[index + 1u] + normal.y; - // outputNormalBuffer.values[index + 2u] = outputNormalBuffer.values[index + 2u] + normal.z; -}`; -class ComputeUniformBufferData extends Float32Array { - constructor(){ - super(ComputeUniformBufferData.SIZE); - this.POSITION_OFFSET = 0; - this.WIDTH_OFFSET = 3; - this.RIGHT_OFFSET = 4; - this.HEIGHT_OFFSET = 7; - this.UP_OFFSET = 8; - this.SEED_OFFSET = 11; - this.FORWARD_OFFSET = 12; - this.FOV_OFFSET = 15; - this.LOOKAT_OFFSET = 16; - this.APERTURE_OFFSET = 19; - this.BACKGROUND_COLOR_OFFSET = 20; - this.TIME0_OFFSET = 23; - this.TIME1_OFFSET = 24; - this.TILES_X = 25; - this.TILES_Y = 26; - this.TILE_OFFSET_X = 27; - this.TILE_OFFSET_Y = 28; - this.RAYS_PER_FRAME_OFFSET = 29; + setSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + } + HittableBufferData.SIZE = 208 / 4; + class ComputeUniformBufferData extends Float32Array { + constructor() { + super(ComputeUniformBufferData.SIZE); + this.POSITION_OFFSET = 0 / 4; + this.WIDTH_OFFSET = 12 / 4; + this.RIGHT_OFFSET = 16 / 4; + this.HEIGHT_OFFSET = 28 / 4; + this.UP_OFFSET = 32 / 4; + this.SEED_OFFSET = 44 / 4; + this.FORWARD_OFFSET = 48 / 4; + this.FOV_OFFSET = 60 / 4; + this.BACKGROUND_COLOR_OFFSET = 64 / 4; + this.TIME0_OFFSET = 76 / 4; + this.AMBIENT_COLOR_OFFSET = 80 / 4; + this.TIME1_OFFSET = 92 / 4; + this.TILES_X = 96 / 4; + this.TILES_Y = 100 / 4; + this.TILE_OFFSET_X = 104 / 4; + this.TILE_OFFSET_Y = 108 / 4; + this.LOOKAT_OFFSET = 112 / 4; + this.APERTURE_OFFSET = 124 / 4; + this.FOCUS_DISTANCE_OFFSET = 128 / 4; + this.RAYS_PER_FRAME_OFFSET = 132 / 4; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value2) { + this[this.FOCUS_DISTANCE_OFFSET] = value2; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSeed() { - return this[this.SEED_OFFSET]; + return this[this.SEED_OFFSET]; } - setSeed(value) { - this[this.SEED_OFFSET] = value; + setSeed(value2) { + this[this.SEED_OFFSET] = value2; } getRaysPerFrame() { - return this[this.RAYS_PER_FRAME_OFFSET]; + return this[this.RAYS_PER_FRAME_OFFSET]; } - setRaysPerFrame(value) { - this[this.RAYS_PER_FRAME_OFFSET] = value; + setRaysPerFrame(value2) { + this[this.RAYS_PER_FRAME_OFFSET] = value2; } getFieldOfView() { - return this[this.FOV_OFFSET]; + return this[this.FOV_OFFSET]; } - setFieldOfView(value) { - this[this.FOV_OFFSET] = value; + setFieldOfView(value2) { + this[this.FOV_OFFSET] = value2; } getAperture() { - return this[this.APERTURE_OFFSET]; + return this[this.APERTURE_OFFSET]; } - setAperture(value) { - this[this.APERTURE_OFFSET] = value; + setAperture(value2) { + this[this.APERTURE_OFFSET] = value2; } - getPosition(value) { - (0, _glMatrix.vec3).set(value, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); + getPosition(value2) { + set$3(value2, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); } - setPosition(value) { - this[this.POSITION_OFFSET] = value[0]; - this[this.POSITION_OFFSET + 1] = value[1]; - this[this.POSITION_OFFSET + 2] = value[2]; + setPosition(value2) { + this[this.POSITION_OFFSET] = value2[0]; + this[this.POSITION_OFFSET + 1] = value2[1]; + this[this.POSITION_OFFSET + 2] = value2[2]; } - getRight(value) { - (0, _glMatrix.vec3).set(value, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); + getRight(value2) { + set$3(value2, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); } - setRight(value) { - this[this.RIGHT_OFFSET] = value[0]; - this[this.RIGHT_OFFSET + 1] = value[1]; - this[this.RIGHT_OFFSET + 2] = value[2]; + setRight(value2) { + this[this.RIGHT_OFFSET] = value2[0]; + this[this.RIGHT_OFFSET + 1] = value2[1]; + this[this.RIGHT_OFFSET + 2] = value2[2]; } - getUp(value) { - (0, _glMatrix.vec3).set(value, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); + getUp(value2) { + set$3(value2, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); } - setUp(value) { - this[this.UP_OFFSET] = value[0]; - this[this.UP_OFFSET + 1] = value[1]; - this[this.UP_OFFSET + 2] = value[2]; + setUp(value2) { + this[this.UP_OFFSET] = value2[0]; + this[this.UP_OFFSET + 1] = value2[1]; + this[this.UP_OFFSET + 2] = value2[2]; } - getForward(value) { - (0, _glMatrix.vec3).set(value, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); + getForward(value2) { + set$3(value2, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); } - setForward(value) { - this[this.FORWARD_OFFSET] = value[0]; - this[this.FORWARD_OFFSET + 1] = value[1]; - this[this.FORWARD_OFFSET + 2] = value[2]; + setForward(value2) { + this[this.FORWARD_OFFSET] = value2[0]; + this[this.FORWARD_OFFSET + 1] = value2[1]; + this[this.FORWARD_OFFSET + 2] = value2[2]; } - getLookAt(value) { - (0, _glMatrix.vec3).set(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + getBackgroundColor(value2) { + set$2(value2, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); } - setLookAt(value) { - this[this.LOOKAT_OFFSET] = value[0]; - this[this.LOOKAT_OFFSET + 1] = value[1]; - this[this.LOOKAT_OFFSET + 2] = value[2]; + setBackgroundColor(value2) { + this[this.BACKGROUND_COLOR_OFFSET] = value2[0]; + this[this.BACKGROUND_COLOR_OFFSET + 1] = value2[1]; + this[this.BACKGROUND_COLOR_OFFSET + 2] = value2[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value2[3]; } - getBackgroundColor(value) { - (0, _glMatrix.vec4).set(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], 1); + getAmbientColor(value2) { + set$3(value2, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); } - setBackgroundColor(value) { - this[this.BACKGROUND_COLOR_OFFSET] = value[0]; - this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; - this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + setAmbientColor(value2) { + this[this.AMBIENT_COLOR_OFFSET] = value2[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value2[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value2[2]; } getTime0() { - return this[this.TIME0_OFFSET]; + return this[this.TIME0_OFFSET]; } - setTime0(value) { - this[this.TIME0_OFFSET] = value; + setTime0(value2) { + this[this.TIME0_OFFSET] = value2; } getTime1() { - return this[this.TIME1_OFFSET]; + return this[this.TIME1_OFFSET]; } - setTime1(value) { - this[this.TIME1_OFFSET] = value; + setTime1(value2) { + this[this.TIME1_OFFSET] = value2; } getTilesX() { - return this[this.TILES_X]; + return this[this.TILES_X]; } - setTilesX(value) { - this[this.TILES_X] = value; + setTilesX(value2) { + this[this.TILES_X] = value2; } getTilesY() { - return this[this.TILES_Y]; + return this[this.TILES_Y]; } - setTilesY(value) { - this[this.TILES_Y] = value; + setTilesY(value2) { + this[this.TILES_Y] = value2; } getTileOffsetX() { - return this[this.TILE_OFFSET_X]; + return this[this.TILE_OFFSET_X]; } - setTileOffsetX(value) { - this[this.TILE_OFFSET_X] = value; + setTileOffsetX(value2) { + this[this.TILE_OFFSET_X] = value2; } getTileOffsetY() { - return this[this.TILE_OFFSET_Y]; - } - setTileOffsetY(value) { - this[this.TILE_OFFSET_Y] = value; - } -} -ComputeUniformBufferData.SIZE = 32; - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iaEI5":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FullscreenQuadWgsl", ()=>FullscreenQuadWgsl); -parcelHelpers.export(exports, "FullscreenQuadUniformBufferData", ()=>FullscreenQuadUniformBufferData); -const FullscreenQuadWgsl = ` -const GAMMA = vec3<f32>(0.45454545f); // 1 / 2.2 - -struct ColorData { - data : array<f32>, -} - -struct NormalDepthData { - data : array<f32>, -} - - // offest align size -struct Uniforms { // ------------------------------ - width: f32, // 0 4 4 - height: f32, // 4 4 4 - samplesPerPixel: f32, // 8 4 4 - exposure: f32, // 12 4 4 - minDepth: f32, // 16 4 4 - maxDepth: f32, // 20 4 4 - normalEdge: f32, // 24 4 4 - depthEdge: f32, // 28 4 4 -} // ------------------------------ - // 4 32 - -@group(0) @binding(0) var<uniform> uniforms : Uniforms; -@group(0) @binding(1) var<storage, read> colorBuffer : ColorData; -@group(0) @binding(2) var<storage, read> normalDepthBuffer : NormalDepthData; - -struct VertexOutput { - @builtin(position) Position : vec4<f32>, -}; - -@vertex -fn vert_main(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { - var pos = array<vec2<f32>, 6>( - vec2<f32>( 1f, 1f), - vec2<f32>( 1f, -1f), - vec2<f32>(-1f, -1f), - vec2<f32>( 1f, 1f), - vec2<f32>(-1f, -1f), - vec2<f32>(-1f, 1f)); - var output : VertexOutput; - output.Position = vec4<f32>(pos[vertexIndex], 0f, 1f); - return output; -} - -@fragment -fn frag_main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - // [0,1] - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -} - -@fragment -fn frag_depth(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - let depth = normalDepthBuffer.data[index + 3u]; - let minDepth = uniforms.minDepth; - let maxDepth = uniforms.maxDepth; - if (minDepth == maxDepth) { - // Raw, unnormalized depth - return vec4<f32>(vec3<f32>(depth, depth, depth), 1f); + return this[this.TILE_OFFSET_Y]; } - else { - // Normalize depth - var normalizedDepth = (depth - minDepth) / (maxDepth - minDepth); - return vec4<f32>(normalizedDepth, normalizedDepth, normalizedDepth, 1f); - } -} - -@fragment -fn frag_normal(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -// @fragment -// fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { -// let x = floor(coord.x); -// let y = floor(coord.y); -// let index = u32(x + y * uniforms.width) * 4u; - -// // Prevent edge detection at screen edges -// if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } - -// // Normal derivatives -// let p = vec3<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u]); -// let px = vec3<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u]); -// let py = vec3<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u]); -// let dpdx = px - p; -// let dpdy = py - p; -// let fwidth = abs(dpdx) + abs(dpdy); - -// // Depth derivatives -// let d = normalDepthBuffer.data[index + 3u]; -// let dx = normalDepthBuffer.data[index + 7u]; -// let dy = normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]; -// let ddpx = dx - d; -// let ddpy = dy - d; - -// // Normalize depth -// // let minDepth = uniforms.minDepth; -// // let maxDepth = uniforms.maxDepth; -// // let nd = (d - minDepth) / (maxDepth - minDepth); -// // let ndx = (dx - minDepth) / (maxDepth - minDepth); -// // let ndy = (dy - minDepth) / (maxDepth - minDepth); -// // let ddpx = ndx - nd; -// // let ddpy = ndy - nd; - -// let dfwidth = abs(ddpx) + abs(ddpy); - -// // Output white when magnitude of dpdx over a threshold -// let depthEdge = uniforms.depthEdge; -// let normalEdge = uniforms.normalEdge; -// if (dot(fwidth, fwidth) > normalEdge || dfwidth > depthEdge) { -// return vec4<f32>(1f, 1f, 1f, 1f); -// } else { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } -// } - -@fragment -fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - - // Prevent edge detection at screen edges - if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { - return vec4<f32>(0f, 0f, 0f, 1f); - } - - // Segment derivatives - let p = vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], normalDepthBuffer.data[index + 3u]); - let px = vec4<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u], normalDepthBuffer.data[index + 7u]); - let py = vec4<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]); - let dpdx = px - p; - let dpdy = py - p; - let fwidth = abs(dpdx) + abs(dpdy); - - // Output white when magnitude of dpdx over a threshold - if (dot(fwidth, fwidth) > 0f) { - return vec4<f32>(1f, 1f, 1f, 1f); - } else { - return vec4<f32>(0f, 0f, 0f, 1f); - // return p; - } -} - -@fragment -fn frag_segment(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -@fragment -fn frag_main_hdr(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - - // Simple tone-mapping from HDR to LDR - // if (uniforms.exposure > 0f) { - // color = color * uniforms.exposure; - // color = color / (color + vec3<f32>(1f, 1f, 1f)); - // } - - color = color * uniforms.exposure; - // ACES - // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ - let a = 2.51f; - let b = 0.03f; - let c = 2.43f; - let d = 0.59f; - let e = 0.14f; - color = (color * (a * color + b)) / (color * (c * color + d) + e); - - // See https://bruop.github.io/tonemapping/ - // See https://www.shadertoy.com/view/WdjSW3 - - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -}`; -class FullscreenQuadUniformBufferData extends Float32Array { - constructor(){ - super(FullscreenQuadUniformBufferData.SIZE); - this.WIDTH_OFFSET = 0; - this.HEIGHT_OFFSET = 1; - this.SPP_OFFSET = 2; - this.EXPOSURE_OFFSET = 3; - this.MIN_DEPTH_OFFSET = 4; - this.MAX_DEPTH_OFFSET = 5; - this.EDGE_NORMAL_OFFSET = 6; - this.EDGE_DEPTH_OFFSET = 7; + setTileOffsetY(value2) { + this[this.TILE_OFFSET_Y] = value2; + } + getLookAt(value2) { + set$3(value2, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value2) { + this[this.LOOKAT_OFFSET] = value2[0]; + this[this.LOOKAT_OFFSET + 1] = value2[1]; + this[this.LOOKAT_OFFSET + 2] = value2[2]; + } + } + ComputeUniformBufferData.SIZE = 144 / 4; + class FullscreenQuadUniformBufferData extends Float32Array { + constructor() { + super(FullscreenQuadUniformBufferData.SIZE); + this.WIDTH_OFFSET = 0 / 4; + this.HEIGHT_OFFSET = 4 / 4; + this.SPP_OFFSET = 8 / 4; + this.EXPOSURE_OFFSET = 12 / 4; + this.MIN_DEPTH_OFFSET = 16 / 4; + this.MAX_DEPTH_OFFSET = 20 / 4; + this.EDGE_NORMAL_OFFSET = 24 / 4; + this.EDGE_DEPTH_OFFSET = 28 / 4; + this.EDGE_FOREGROUND_OFFSET = 32 / 4; + this.EDGE_BACKGROUND_OFFSET = 48 / 4; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSamplesPerPixel() { - return this[this.SPP_OFFSET]; + return this[this.SPP_OFFSET]; } - setSamplesPerPixel(value) { - this[this.SPP_OFFSET] = value; + setSamplesPerPixel(value2) { + this[this.SPP_OFFSET] = value2; } getExposure() { - return this[this.EXPOSURE_OFFSET]; + return this[this.EXPOSURE_OFFSET]; } - setExposure(value) { - this[this.EXPOSURE_OFFSET] = value; + setExposure(value2) { + this[this.EXPOSURE_OFFSET] = value2; } getMinDepth() { - return this[this.MIN_DEPTH_OFFSET]; + return this[this.MIN_DEPTH_OFFSET]; } - setMinDepth(value) { - this[this.MIN_DEPTH_OFFSET] = value; + setMinDepth(value2) { + this[this.MIN_DEPTH_OFFSET] = value2; } getMaxDepth() { - return this[this.MAX_DEPTH_OFFSET]; + return this[this.MAX_DEPTH_OFFSET]; } - setMaxDepth(value) { - this[this.MAX_DEPTH_OFFSET] = value; + setMaxDepth(value2) { + this[this.MAX_DEPTH_OFFSET] = value2; } getEdgeDepth() { - return this[this.EDGE_DEPTH_OFFSET]; + return this[this.EDGE_DEPTH_OFFSET]; } - setEdgeDepth(value) { - this[this.EDGE_DEPTH_OFFSET] = value; + setEdgeDepth(value2) { + this[this.EDGE_DEPTH_OFFSET] = value2; } getEdgeNormal() { - return this[this.EDGE_NORMAL_OFFSET]; - } - setEdgeNormal(value) { - this[this.EDGE_NORMAL_OFFSET] = value; - } -} -FullscreenQuadUniformBufferData.SIZE = 8; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gC34F":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SplitMethod", ()=>SplitMethod); -parcelHelpers.export(exports, "LinearBVHNode", ()=>LinearBVHNode); -parcelHelpers.export(exports, "BVHAccel", ()=>BVHAccel); -parcelHelpers.export(exports, "LinearBVHNodeBufferData", ()=>LinearBVHNodeBufferData); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _aabbJs = require("./aabb.js"); -const SplitMethod = { - middle: "middle", - equalCounts: "equalCounts", - sah: "sah" -}; -class BVHPrimitiveInfo { - get primitiveNumber() { - return this._primitiveNumber; - } - get bounds() { - return this._bounds; - } - get centroid() { - return this._centroid; - } - constructor(primitiveNumber, bounds){ - this._primitiveNumber = primitiveNumber; - this._bounds = bounds; - this._centroid = (0, _glMatrix.vec3).create(); - bounds.centroid(this._centroid); - } -} -class BVHBuildNode { - get bounds() { - return this._bounds; - } - get left() { - return this._left; - } - get right() { - return this._right; - } - get splitAxis() { - return this._splitAxis; - } - get firstPrimOffset() { - return this._firstPrimOffset; - } - get nPrimitives() { - return this._nPrimitives; - } - get start() { - return this._start; - } - get end() { - return this._end; - } - constructor(start, end){ - this._start = start; - this._end = end; - } - initLeaf(first, n, bounds) { - this._firstPrimOffset = first; - this._nPrimitives = n; - this._bounds = bounds; - this._left = null; - this._right = null; - } - initInterior(axis, left, right) { - this._left = left; - this._right = right; - this._bounds = new (0, _aabbJs.AABB)(); - this._bounds.unionBounds(this._left.bounds); - this._bounds.unionBounds(this._right.bounds); - this._splitAxis = axis; - this._nPrimitives = 0; - } -} -class LinearBVHNode { - constructor(){ - this.bounds = new (0, _aabbJs.AABB)(); - this.primitivesOffset = 0; - this.secondChildOffset = 0; - this.nPrimitives = 0; - this.axis = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._size = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index) { - this.bounds.centroid(this._centroid); - buffer.setCenter(index, this._centroid); - this.bounds.size(this._size); - (0, _glMatrix.vec3).scale(this._size, this._size, 0.5); - buffer.setSize(index, this._size); - buffer.setPrimitivesOffset(index, this.primitivesOffset); - buffer.setSecondChildOffset(index, this.secondChildOffset); - buffer.setNPrimitives(index, this.nPrimitives); - buffer.setAxis(index, this.axis); - } -} -class BVHAccel { - get orderedPrimitives() { - return this._orderedPrimitives; - } - get nodes() { - return this._nodes; - } - constructor(core, primitives, maxPrimsInNode, splitMethod){ - this._core = core; - if (!primitives || primitives.length == 0) return; - let start = performance.now(); - this._maxPrimsInNode = maxPrimsInNode; - this._splitMethod = splitMethod; - this._primitives = primitives; - this._normalized = (0, _glMatrix.vec3).create(); - this._primitiveInfo = []; - for(let i = 0; i < primitives.length; i++)this._primitiveInfo.push(new BVHPrimitiveInfo(i, primitives[i].bounds)); - this._totalNodes = 0; - this._orderedPrimitives = []; - const root = this._recursiveBuild(0, primitives.length); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh ${this._totalNodes} nodes split ${this._splitMethod} ${Math.round(window.performance.now() - start)}ms`); - start = performance.now(); - this._nodes = []; - for(let i = 0; i < this._totalNodes; i++)this._nodes.push(new LinearBVHNode()); - this._offset = 0; - this._flattenBVHTree(root); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh flattened ${Math.round(window.performance.now() - start)}ms`); - } - _recursiveBuild(start, end) { - const node = new BVHBuildNode(start, end - 1); - this._totalNodes++; - const bounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)bounds.unionBounds(this._primitiveInfo[i].bounds); - const nPrimitives = end - start; - if (nPrimitives == 1) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - const centroidBounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)centroidBounds.unionPoint(this._primitiveInfo[i].centroid); - const dim = centroidBounds.maximumExtent(); - let mid = Math.floor((start + end) / 2); - if (centroidBounds.max[dim] == centroidBounds.min[dim]) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - switch(this._splitMethod){ - case SplitMethod.middle: - break; - case SplitMethod.equalCounts: - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - break; - case SplitMethod.sah: - default: - if (nPrimitives <= 4) { - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - } else { - const nBuckets = 12; - const buckets = []; - for(let i = 0; i < nBuckets; i++)buckets.push({ - count: 0, - bounds: new (0, _aabbJs.AABB)() - }); - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - buckets[b].count++; - buckets[b].bounds.unionBounds(this._primitiveInfo[i].bounds); - } - const cost = []; - for(let i = 0; i < nBuckets - 1; i++){ - const b0 = new (0, _aabbJs.AABB)(); - const b1 = new (0, _aabbJs.AABB)(); - let count0 = 0; - let count1 = 0; - for(let j = 0; j <= i; j++){ - b0.unionBounds(buckets[j].bounds); - count0 += buckets[j].count; - } - for(let j = i + 1; j < nBuckets; j++){ - b1.unionBounds(buckets[j].bounds); - count1 += buckets[j].count; - } - cost.push(0.125 + (count0 * b0.surfaceArea() + count1 * b1.surfaceArea()) / bounds.surfaceArea()); - } - let minCost = cost[0]; - let minCostSplitBucket = 0; - for(let i = 1; i < nBuckets - 1; i++)if (cost[i] < minCost) { - minCost = cost[i]; - minCostSplitBucket = i; - } - const leafCost = nPrimitives; - if (nPrimitives > this._maxPrimsInNode || minCost < leafCost) { - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - if (b > minCostSplitBucket) { - mid = i; - break; - } - } - } else { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } - } - break; - } - node.initInterior(dim, this._recursiveBuild(start, mid), this._recursiveBuild(mid, end)); - } - } - return node; - } - _flattenBVHTree(node) { - const linearNode = this._nodes[this._offset]; - linearNode.bounds = node.bounds; - const myOffset = this._offset++; - if (node.nPrimitives > 0) { - linearNode.primitivesOffset = node.firstPrimOffset; - linearNode.nPrimitives = node.nPrimitives; - } else { - linearNode.axis = node.splitAxis; - linearNode.nPrimitives = 0; - this._flattenBVHTree(node.left); - linearNode.secondChildOffset = this._flattenBVHTree(node.right); - } - return myOffset; - } -} -class LinearBVHNodeBufferData extends Float32Array { - constructor(count){ - super(count * LinearBVHNodeBufferData.SIZE); - this.CENTER_OFFSET = 0; - this.SIZE_OFFSET = 4; - this.PRIMITIVES_OFFSET_OFFSET = 3; - this.SECOND_CHILD_OFFSET_OFFSET = 7; - this.N_PRIMITIVES_OFFSET = 8; - this.AXIS_OFFSET = 9; - } - getCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getPrimitivesOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET]; - } - setPrimitivesOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET] = value; - } - getSecondChildOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET]; - } - setSecondChildOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET] = value; - } - getNPrimitives(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET]; - } - setNPrimitives(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET] = value; - } - getAxis(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET]; - } - setAxis(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET] = value; - } -} -LinearBVHNodeBufferData.SIZE = 12; - -},{"gl-matrix":"erHGu","../../main.js":"b6Xbk","./aabb.js":"3Gscs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"inb41":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LightType", ()=>LightType); -parcelHelpers.export(exports, "LightBufferData", ()=>LightBufferData); -parcelHelpers.export(exports, "Light", ()=>Light); -parcelHelpers.export(exports, "SphereLight", ()=>SphereLight); -parcelHelpers.export(exports, "RectLight", ()=>RectLight); -var _glMatrix = require("gl-matrix"); -const LightType = { - distant: 0, - sphere: 1, - rect: 2, - disc: 3, - cylinder: 4, - dome: 5 -}; -class LightBufferData extends Float32Array { - constructor(count){ - super(count * LightBufferData.SIZE); - this.ROTATION_OFFSET = 0; - this.CENTER_OFFSET = 4; - this.TYPE_OFFSET = 7; - this.SIZE_OFFSET = 8; - this.COLOR_OFFSET = 12; - } - getType(index) { - return this[LightBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[LightBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -LightBufferData.SIZE = 16; -class Light { - constructor(options){ - this.color = options.color; - this.center = options.center; - } - toBuffer(buffer, index) { - buffer.setCenter(index, this.center); - buffer.setColor(index, this.color); - } -} -class SphereLight extends Light { - constructor(options){ - super(options); - this.radius = options.radius / 2; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.sphere); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.radius, this.radius, this.radius)); - } -} -class RectLight extends Light { - constructor(options){ - super(options); - this._thickness = 0.00001; - this.size = options.size; - this.rotation = options.rotation; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.rect); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.size[0], this.size[1], this._thickness)); - buffer.setRotation(index, this.rotation); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5qz1r":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _mainJs = require("../../main.js"); -class FontVisual { - get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; + return this[this.EDGE_NORMAL_OFFSET]; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeNormal(value2) { + this[this.EDGE_NORMAL_OFFSET] = value2; } - initializeContext(device) { - this._device = device; - this._hasChanged = true; - this._isInitialized = true; + getEdgeForeground(value2) { + set$2(value2, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - const imageData = this._font.atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this.texture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this.texture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - } + setEdgeForeground(value2) { + this[this.EDGE_FOREGROUND_OFFSET] = value2[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value2[3]; } -} - -},{"../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ebXJi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _imageJs = require("../../components/image.js"); -var _hittableJs = require("./hittable.js"); -class ImageVisual { - get isInitialized() { - return this._isInitialized; + getEdgeBackground(value2) { + set$2(value2, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); } - get image() { - return this._image; - } - render(elapsedTime) {} - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this.isVisible = true; - image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeBackground(value2) { + this[this.EDGE_BACKGROUND_OFFSET] = value2[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value2[3]; } - initializeContext(device) { - if (!this._image.isInitialized) this._image.initialize(); - this._hasChanged = true; - this._isInitialized = true; + } + FullscreenQuadUniformBufferData.SIZE = 64 / 4; + class LinearBVHNodeBufferData extends Float32Array { + constructor(count2) { + super(count2 * LinearBVHNodeBufferData.SIZE); + this.CENTER_OFFSET = 0 / 4; + this.SIZE_OFFSET = 16 / 4; + this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; + this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; + this.N_PRIMITIVES_OFFSET = 32 / 4; + this.AXIS_OFFSET = 36 / 4; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const material = this._image.material == -1 ? this._main.config.defaultMaterial : this._main.materials[this._image.material]; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - const modelSizeX = this._image.maxBoundsX - this._image.minBoundsX; - const modelSizeY = this._image.maxBoundsY - this._image.minBoundsY; - const modelSizeZ = this._image.maxBoundsZ - this._image.minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - if (this._image instanceof (0, _imageJs.ImageQuad)) { - const imageQuad = this._image; - const position = (0, _glMatrix.vec3).fromValues((imageQuad.minBoundsX + imageQuad.maxBoundsX) / 2, (imageQuad.minBoundsY + imageQuad.maxBoundsY) / 2, (imageQuad.minBoundsZ + imageQuad.maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(position, imageQuad.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableRotatedXyRectOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - size1: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - material: material, - texCoord0: imageQuad.texCoord0, - texCoord1: imageQuad.texCoord1, - rotation0: imageQuad.rotation, - rotation1: imageQuad.rotation - }; - this.hittable = new (0, _hittableJs.HittableRotatedXyRect)(hittableRotatedXyRectOptions); - } else if (this._image instanceof (0, _imageJs.ImageSphere)) { - const imageSphere = this._image; - const position = imageSphere.position; - (0, _glMatrix.vec3).subtract(position, imageSphere.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableSphereOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - radius: imageSphere.radius * boundsScaling, - material: material - }; - this.hittable = new (0, _hittableJs.HittableSphere)(hittableSphereOptions); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"erHGu","../../components/image.js":"eexvE","./hittable.js":"a4kPP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1pTTV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -class LabelSetVisual { - get isInitialized() { - return this._isInitialized; + getCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - get label() { - return this._labelSet; - } - render(elapsedTime) {} - constructor(core, main, labelSet){ - this._core = core; - this._main = main; - this._labelSet = labelSet; - this.isVisible = true; - labelSet.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - if (!this._labelSet.isInitialized) this._labelSet.initialize(); - if (this._labelSet.text && this._labelSet.text.length > 0) this._hasChanged = true; - this._isInitialized = true; + setCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const glpyhRotation = (0, _glMatrix.quat).create(); - const glyphInvRotation = (0, _glMatrix.quat).create(); - const position0 = (0, _glMatrix.vec3).create(); - const position1 = (0, _glMatrix.vec3).create(); - const dataView = this._labelSet.verticesView; - const labelCount = this._labelSet.text.length; - let glyphIndex = 0; - for(let i = 0; i < labelCount; i++){ - const material = this._labelSet.material !== undefined ? this._main.materials[this._labelSet.material] : this._labelSet.materials ? this._main.materials[this._labelSet.materials[i]] : this._main.config.defaultTextMaterial; - const glyphCount = this._labelSet.text[i].length; - for(let j = 0; j < glyphCount; j++){ - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 2, position0); - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 1, position1); - (0, _glMatrix.vec3).scale(position0, position0, modelScale); - (0, _glMatrix.vec3).scale(position1, position1, modelScale); - (0, _glMatrix.vec3).transformQuat(position0, position0, modelRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, modelRotation); - (0, _glMatrix.vec3).add(position0, position0, modelPosition); - (0, _glMatrix.vec3).add(position1, position1, modelPosition); - const centroid = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(centroid, position0, position1); - (0, _glMatrix.vec3).scale(centroid, centroid, 0.5); - if (this._labelSet.rotation) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotation[0], this._labelSet.rotation[1], this._labelSet.rotation[2], this._labelSet.rotation[3]); - else if (this._labelSet.rotations) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotations[i * 4], this._labelSet.rotations[i * 4 + 1], this._labelSet.rotations[i * 4 + 2], this._labelSet.rotations[i * 4 + 3]); - else (0, _glMatrix.quat).identity(glpyhRotation); - const rotation = (0, _glMatrix.quat).clone(glpyhRotation); - (0, _glMatrix.quat).multiply(rotation, modelRotation, rotation); - (0, _glMatrix.quat).conjugate(glyphInvRotation, rotation); - (0, _glMatrix.vec3).subtract(position0, position0, centroid); - (0, _glMatrix.vec3).subtract(position1, position1, centroid); - (0, _glMatrix.vec3).transformQuat(position0, position0, glyphInvRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, glyphInvRotation); - (0, _glMatrix.vec3).add(position0, position0, centroid); - (0, _glMatrix.vec3).add(position1, position1, centroid); - const texCoord0 = (0, _glMatrix.vec2).create(); - const texCoord1 = (0, _glMatrix.vec2).create(); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 2, texCoord0); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 1, texCoord1); - const hittableFontOptions = { - center0: centroid, - center1: centroid, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - size1: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - material: material, - texCoord0: texCoord0, - texCoord1: texCoord1, - rotation0: rotation, - rotation1: rotation, - sdfBuffer: this._core.config.sdfBuffer - }; - const hittable = new (0, _hittableJs.HittableRotatedFontXyRect)(hittableFontOptions); - this.hittables.push(hittable); - glyphIndex++; - } - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"erHGu","../../vertex.js":"8lW8V","./hittable.js":"a4kPP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3l2Pt":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _atlasJs = require("../../atlas.js"); -var _bufferJs = require("../../buffer.js"); -var _indexJs = require("../../index.js"); -var _mainJs = require("../../main.js"); -var _paletteJs = require("../../palette.js"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _mathJs = require("../../helpers/math.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - constructor(core, ids){ - super(core, ids); - this._isInitialized = true; + getSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - update() { - if (this._isInitialized) { - if (this.hasChangedCallback) this.hasChangedCallback(); - } + setSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - get time0() { - return this._time0; + getPrimitivesOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET]; } - set time0(value) { - if (this._time0 != value) { - this._time0 = value; - this._hasChanged = true; - } + setPrimitivesOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET] = value2; } - get time1() { - return this._time1; + getSecondChildOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET]; } - set time1(value) { - if (this._time1 != value) { - this._time1 = value; - this._hasChanged = true; - } + setSecondChildOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET] = value2; } - get duration() { - return this._duration; + getNPrimitives(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET]; } - set duration(value) { - if (this._duration != value) { - this._duration = value; - this._hasChanged = true; - } + setNPrimitives(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET] = value2; } - get stagger() { - return this.stagger; + getAxis(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET]; } - set stagger(value) { - if (this._stagger != value) { - this._stagger = value; - this._hasChanged = true; - } + setAxis(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET] = value2; } - constructor(core, main, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - this._main = main; - this._time0 = 0; - this._time1 = 1; - this._buffer1.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._buffer2.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._isInitialized = true; + } + LinearBVHNodeBufferData.SIZE = 48 / 4; + class LightBufferData extends Float32Array { + constructor(count2) { + super(count2 * LightBufferData.SIZE); + this.ROTATION_OFFSET = 0 / 4; + this.CENTER_OFFSET = 16 / 4; + this.TYPE_OFFSET = 28 / 4; + this.SIZE_OFFSET = 32 / 4; + this.COLOR_OFFSET = 48 / 4; + } + getType(index2) { + return this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + set$1(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - this.minY = Number.MAX_VALUE; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const previousBuffer = this.previousBuffer; - const currentBuffer = this.currentBuffer; - const currentUnitTranslation = (0, _glMatrix.vec3).create(); - const previousUnitTranslation = (0, _glMatrix.vec3).create(); - const currentUnitScale = (0, _glMatrix.vec3).create(); - const previousUnitScale = (0, _glMatrix.vec3).create(); - const currentUnitRotation = (0, _glMatrix.quat).create(); - const previousUnitRotation = (0, _glMatrix.quat).create(); - const unitOrder = (0, _glMatrix.vec2).create(); - const transitionDuration = this._duration / (this._duration + this._stagger); - for(let j = 0; j < currentBuffer.ids.length; j++){ - (0, _vertexJs.UnitVertex).getOrder(currentBuffer.dataView, j, unitOrder); - const startTime = unitOrder[1] * (1 - transitionDuration); - const animation0 = (0, _mathJs.MathHelper).clamp((this._time0 - startTime) / transitionDuration, 0, 1); - const animation1 = (0, _mathJs.MathHelper).clamp((this._time1 - startTime) / transitionDuration, 0, 1); - const unitScale0 = (0, _glMatrix.vec3).create(); - const unitScale1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getScale(currentBuffer.dataView, j, currentUnitScale); - (0, _vertexJs.UnitVertex).getScale(previousBuffer.dataView, j, previousUnitScale); - (0, _glMatrix.vec3).lerp(unitScale0, previousUnitScale, currentUnitScale, animation0); - (0, _glMatrix.vec3).lerp(unitScale1, previousUnitScale, currentUnitScale, animation1); - const unitTranslation0 = (0, _glMatrix.vec3).create(); - const unitTranslation1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, j, currentUnitTranslation); - (0, _vertexJs.UnitVertex).getTranslation(previousBuffer.dataView, j, previousUnitTranslation); - (0, _glMatrix.vec3).lerp(unitTranslation0, previousUnitTranslation, currentUnitTranslation, animation0); - (0, _glMatrix.vec3).lerp(unitTranslation1, previousUnitTranslation, currentUnitTranslation, animation1); - const unitRotation0 = (0, _glMatrix.quat).create(); - const unitRotation1 = (0, _glMatrix.quat).create(); - (0, _vertexJs.UnitVertex).getRotation(currentBuffer.dataView, j, currentUnitRotation); - (0, _vertexJs.UnitVertex).getRotation(previousBuffer.dataView, j, previousUnitRotation); - (0, _glMatrix.quat).slerp(unitRotation0, previousUnitRotation, currentUnitRotation, animation0); - (0, _glMatrix.quat).slerp(unitRotation1, previousUnitRotation, currentUnitRotation, animation1); - (0, _glMatrix.quat).multiply(unitRotation0, modelRotation, unitRotation0); - (0, _glMatrix.quat).multiply(unitRotation1, modelRotation, unitRotation1); - (0, _glMatrix.vec3).scale(unitTranslation0, unitTranslation0, modelScale); - (0, _glMatrix.vec3).scale(unitTranslation1, unitTranslation1, modelScale); - (0, _glMatrix.vec3).transformQuat(unitTranslation0, unitTranslation0, modelRotation); - (0, _glMatrix.vec3).transformQuat(unitTranslation1, unitTranslation1, modelRotation); - (0, _glMatrix.vec3).add(unitTranslation0, unitTranslation0, modelPosition); - (0, _glMatrix.vec3).add(unitTranslation1, unitTranslation1, modelPosition); - (0, _glMatrix.vec3).scale(unitScale0, unitScale0, modelScale / 2); - (0, _glMatrix.vec3).scale(unitScale1, unitScale1, modelScale / 2); - unitScale0[0] = Math.max(unitScale0[0], 0.00001); - unitScale0[1] = Math.max(unitScale0[1], 0.00001); - unitScale0[2] = Math.max(unitScale0[2], 0.00001); - unitScale1[0] = Math.max(unitScale1[0], 0.00001); - unitScale1[1] = Math.max(unitScale1[1], 0.00001); - unitScale1[2] = Math.max(unitScale1[2], 0.00001); - const endTime = startTime + transitionDuration; - const time0 = Math.min(Math.max((startTime - this._time0) / (this._time1 - this.time0), 0), 1); - const time1 = Math.min(Math.max((endTime - this._time0) / (this._time1 - this.time0), 0), 1); - const materialId = (0, _vertexJs.UnitVertex).getMaterial(currentBuffer.dataView, j); - const material = this._main.materials && this._main.materials.length > materialId ? this._main.materials[materialId] : this._main.config.defaultMaterial; - let hittable; - let unitTexCoord; - switch(currentBuffer.unitType){ - case (0, _indexJs.UnitType).sphere: - case (0, _indexJs.UnitType).sphereSdf: - hittable = new (0, _hittableJs.HittableSphere)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - material: material - }); - break; - case (0, _indexJs.UnitType).disk: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - else hittable = new (0, _hittableJs.HittableRotatedXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - break; - case (0, _indexJs.UnitType).block: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).sdf: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - const texId = (0, _vertexJs.UnitVertex).getTexture(currentBuffer.dataView, j); - const sdfBuffer = (0, _vertexJs.UnitVertex).getSdfBuffer(currentBuffer.dataView, j); - const sdfBorder = (0, _vertexJs.UnitVertex).getSdfBorder(currentBuffer.dataView, j); - const options = { - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: (0, _glMatrix.vec2).fromValues(unitScale0[0], unitScale0[1]), - size1: (0, _glMatrix.vec2).fromValues(unitScale1[0], unitScale1[1]), - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]), - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texId: texId, - sdfBuffer: sdfBuffer, - sdfBorder: sdfBorder - }; - hittable = unitRotation1[3] == 1 ? new (0, _hittableJs.HittableSdfXyRect)(options) : new (0, _hittableJs.HittableRotatedSdfXyRect)(options); - break; - case (0, _indexJs.UnitType).blockSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).ringSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).cylinder: - hittable = new (0, _hittableJs.HittableCylinder)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).cylinderSdf: - hittable = new (0, _hittableJs.HittableCylinderSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).hexPrism: - hittable = new (0, _hittableJs.HittableHexPrism)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - material: material - }); - break; - case (0, _indexJs.UnitType).hexPrismSdf: - hittable = new (0, _hittableJs.HittableHexPrismSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material - }); - break; - } - if (hittable.material instanceof (0, _materialJs.IsotropicMaterial)) this.hittables.push(new (0, _hittableJs.HittableConstantMedium)({ - boundary: hittable, - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - material: hittable.material - })); - else this.hittables.push(hittable); - this.minY = Math.min(hittable.bounds.min[1], this.minY); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} - -},{"gl-matrix":"erHGu","../../atlas.js":"huG9l","../../buffer.js":"8oaJi","../../index.js":"lF8Ji","../../main.js":"b6Xbk","../../palette.js":"a14oj","../../vertex.js":"8lW8V","./hittable.js":"a4kPP","./material.js":"ewL2a","../../helpers/math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lFJgO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -class Constants { -} -Constants.SHADOW_OFFSET = 0.001; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b3WSb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ground", ()=>Ground); -class Ground { - constructor(options){ - if (options) { - this.position = options.position; - this.size = options.size; - this.material = options.material; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kKGRB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>(0, _tableJs.Table)); -parcelHelpers.export(exports, "ColumnType", ()=>(0, _tableJs.ColumnType)); -parcelHelpers.export(exports, "Filter", ()=>(0, _filterJs.Filter)); -var _tableJs = require("./table.js"); -var _filterJs = require("./filter.js"); - -},{"./table.js":"cNpSp","./filter.js":"h4ise","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"faZ4P":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraBase", ()=>(0, _cameraJs.CameraBase)); -parcelHelpers.export(exports, "CameraView", ()=>(0, _cameraJs.CameraView)); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>(0, _altazimuthJs.AltAzimuthCamera)); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>(0, _altazimuthJs.AltAzimuthCameraView)); -parcelHelpers.export(exports, "OrbitCamera", ()=>(0, _orbitJs.OrbitCamera)); -var _cameraJs = require("./camera.js"); -var _altazimuthJs = require("./altazimuth.js"); -var _orbitJs = require("./orbit.js"); - -},{"./camera.js":"1KLf3","./altazimuth.js":"48TUG","./orbit.js":"5oTkB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5oTkB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OrbitCamera", ()=>OrbitCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cameraJs = require("./camera.js"); -class OrbitCamera extends (0, _cameraJs.CameraBase) { - getTwist(value) { - (0, _glMatrix.quat).copy(value, this._cameraRotation); - } - setTwist(value, isSmooth) { - (0, _glMatrix.quat).copy(this._cameraRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, value); - } - twist(angle, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._twist(this._vec3, angle); - } - _twist(axis, angle) { - (0, _glMatrix.quat).setAxisAngle(this._quat, axis, angle); - (0, _glMatrix.quat).multiply(this._cameraRotation, this._quat, this._cameraRotation); + } + LightBufferData.SIZE = 64 / 4; + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - rotate(translationDelta) { - (0, _glMatrix.vec3).set(this._vec3, translationDelta[1], translationDelta[0], 0); - const length = (0, _glMatrix.vec3).length(this._vec3); - const angle = length * (0, _constantsJs.Constants).PI / Math.min(this.width, this.height); - (0, _glMatrix.vec3).scale(this._vec3, this._vec3, 1 / length); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._vec3, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","./camera.js":"1KLf3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4xUmx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize for documentation -parcelHelpers.export(exports, "addDiv", ()=>(0, _htmlHelpers.addDiv)); -parcelHelpers.export(exports, "addEl", ()=>(0, _htmlHelpers.addEl)); -parcelHelpers.export(exports, "allTruthy", ()=>(0, _array.allTruthy)); -parcelHelpers.export(exports, "clone", ()=>(0, _clone.clone)); -parcelHelpers.export(exports, "colorFromString", ()=>(0, _color.colorFromString)); -parcelHelpers.export(exports, "colorIsEqual", ()=>(0, _color.colorIsEqual)); -parcelHelpers.export(exports, "colorToString", ()=>(0, _color.colorToString)); -parcelHelpers.export(exports, "concat", ()=>(0, _array.concat)); -parcelHelpers.export(exports, "createElement", ()=>(0, _tsxCreateElement.createElement)); -parcelHelpers.export(exports, "deepMerge", ()=>(0, _clone.deepMerge)); -parcelHelpers.export(exports, "desaturate", ()=>(0, _color.desaturate)); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>(0, _tsxCreateElement.getActiveElementInfo)); -parcelHelpers.export(exports, "mount", ()=>(0, _tsxCreateElement.mount)); -parcelHelpers.export(exports, "outerSize", ()=>(0, _htmlHelpers.outerSize)); -parcelHelpers.export(exports, "push", ()=>(0, _array.push)); -parcelHelpers.export(exports, "setActiveElement", ()=>(0, _tsxCreateElement.setActiveElement)); -var _array = require("../array"); -var _htmlHelpers = require("../htmlHelpers"); -var _clone = require("../clone"); -var _color = require("../color"); -var _tsxCreateElement = require("tsx-create-element"); - -},{"../array":"0536B","../htmlHelpers":"2Ooqn","../clone":"9OkEI","../color":"gRfIg","tsx-create-element":"9w9U8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0536B":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "concat", ()=>concat); -/** - * Returns array with items which are truthy. - * @param args array or arrays to concat into a single array. - */ parcelHelpers.export(exports, "allTruthy", ()=>allTruthy); -/** - * Add an array to an existing array in place. - * @param arr Array to append to. - * @param items Arrof of items to append. - */ parcelHelpers.export(exports, "push", ()=>push); -function concat(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []); -} -function allTruthy(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []).filter(Boolean); -} -function push(arr, items) { + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }); + function concat(...args) { + return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []); + } + function allTruthy(...args) { + return args.reduce((p, c2) => c2 ? p.concat(c2) : p, []).filter(Boolean); + } + function push$1(arr, items) { arr.push.apply(arr, items); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Ooqn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * Create a new element as a child of another element. - * @param tagName Tag name of the new tag to create. - * @param parentElement Reference of the element to append to. - * @returns new HTMLElement. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addEl", ()=>addEl); -/** - * Create a new div HTMLElement as a child of another element. - * @param parentElement Reference of the element to append to. - * @param className Optional css class name to apply to the div. - */ parcelHelpers.export(exports, "addDiv", ()=>addDiv); -/** - * Measure the outer height and width of an HTMLElement, including margin, padding and border. - * @param el HTML Element to measure. - */ parcelHelpers.export(exports, "outerSize", ()=>outerSize); -function addEl(tagName, parentElement) { + } + function addEl(tagName, parentElement) { const el = document.createElement(tagName); parentElement.appendChild(el); return el; -} -function addDiv(parentElement, className) { - const div = addEl('div', parentElement); - if (className) div.className = className; + } + function addDiv(parentElement, className2) { + const div = addEl("div", parentElement); + if (className2) { + div.className = className2; + } return div; -} -function outerSize(el) { + } + function outerSize$1(el) { const cs = getComputedStyle(el); - const height = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); - const width = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); - return { - height, - width - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9OkEI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "deepMerge", ()=>deepMerge); -var _deepmerge = require("deepmerge"); -var _isPlainObject = require("is-plain-object"); -const deepmerge = _deepmerge.default || _deepmerge; -function clone(objectToClone) { - if (!objectToClone) return objectToClone; - return deepmerge.all([ - objectToClone - ]); -} -const dontMerge = (destination, source)=>source; -function deepMerge(...objectsToMerge) { - const objects = objectsToMerge.filter(Boolean); - return deepmerge.all(objects, { - arrayMerge: dontMerge, - isMergeableObject: (0, _isPlainObject.isPlainObject) - }); -} - -},{"deepmerge":"f8559","is-plain-object":"j1mOX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8559":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var isMergeableObject = function isMergeableObject(value) { - return isNonNullObject(value) && !isSpecial(value); -}; -function isNonNullObject(value) { - return !!value && typeof value === 'object'; -} -function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value); -} -// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 -var canUseSymbol = typeof Symbol === 'function' && Symbol.for; -var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; -function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE; -} -function emptyTarget(val) { + const height2 = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); + const width2 = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); + return { height: height2, width: width2 }; + } + var isMergeableObject = function isMergeableObject2(value2) { + return isNonNullObject(value2) && !isSpecial(value2); + }; + function isNonNullObject(value2) { + return !!value2 && typeof value2 === "object"; + } + function isSpecial(value2) { + var stringValue = Object.prototype.toString.call(value2); + return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value2); + } + var canUseSymbol = typeof Symbol === "function" && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103; + function isReactElement(value2) { + return value2.$$typeof === REACT_ELEMENT_TYPE; + } + function emptyTarget(val) { return Array.isArray(val) ? [] : {}; -} -function cloneUnlessOtherwiseSpecified(value, options) { - return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; -} -function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options); + } + function cloneUnlessOtherwiseSpecified(value2, options) { + return options.clone !== false && options.isMergeableObject(value2) ? deepmerge$1(emptyTarget(value2), value2, options) : value2; + } + function defaultArrayMerge(target2, source2, options) { + return target2.concat(source2).map(function(element2) { + return cloneUnlessOtherwiseSpecified(element2, options); }); -} -function mergeObject(target, source, options) { + } + function mergeObject(target2, source2, options) { var destination = {}; - if (options.isMergeableObject(target)) Object.keys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - Object.keys(source).forEach(function(key) { - if (!options.isMergeableObject(source[key]) || !target[key]) destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); - else destination[key] = deepmerge(target[key], source[key], options); + if (options.isMergeableObject(target2)) { + Object.keys(target2).forEach(function(key2) { + destination[key2] = cloneUnlessOtherwiseSpecified(target2[key2], options); + }); + } + Object.keys(source2).forEach(function(key2) { + if (!options.isMergeableObject(source2[key2]) || !target2[key2]) { + destination[key2] = cloneUnlessOtherwiseSpecified(source2[key2], options); + } else { + destination[key2] = deepmerge$1(target2[key2], source2[key2], options); + } }); return destination; -} -function deepmerge(target, source, options) { + } + function deepmerge$1(target2, source2, options) { options = options || {}; options.arrayMerge = options.arrayMerge || defaultArrayMerge; options.isMergeableObject = options.isMergeableObject || isMergeableObject; - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); + var sourceIsArray = Array.isArray(source2); + var targetIsArray = Array.isArray(target2); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - if (!sourceAndTargetTypesMatch) return cloneUnlessOtherwiseSpecified(source, options); - else if (sourceIsArray) return options.arrayMerge(target, source, options); - else return mergeObject(target, source, options); -} -deepmerge.all = function deepmergeAll(array, options) { - if (!Array.isArray(array)) throw new Error('first argument should be an array'); - return array.reduce(function(prev, next) { - return deepmerge(prev, next, options); + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source2, options); + } else if (sourceIsArray) { + return options.arrayMerge(target2, source2, options); + } else { + return mergeObject(target2, source2, options); + } + } + deepmerge$1.all = function deepmergeAll(array2, options) { + if (!Array.isArray(array2)) { + throw new Error("first argument should be an array"); + } + return array2.reduce(function(prev, next) { + return deepmerge$1(prev, next, options); }, {}); -}; -var deepmerge_1 = deepmerge; -exports.default = deepmerge_1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j1mOX":[function(require,module,exports,__globalThis) { -/*! - * is-plain-object <https://github.com/jonschlinkert/is-plain-object> - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isPlainObject", ()=>isPlainObject); -function isObject(o) { - return Object.prototype.toString.call(o) === '[object Object]'; -} -function isPlainObject(o) { + }; + var deepmerge_1 = deepmerge$1; + const _deepmerge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: deepmerge_1 + }, Symbol.toStringTag, { value: "Module" })); + function isObject(o) { + return Object.prototype.toString.call(o) === "[object Object]"; + } + function isPlainObject(o) { var ctor, prot; if (isObject(o) === false) return false; - // If has modified constructor ctor = o.constructor; - if (ctor === undefined) return true; - // If has modified prototype + if (ctor === void 0) return true; prot = ctor.prototype; if (isObject(prot) === false) return false; - // If constructor does not have an Object-specific method - if (prot.hasOwnProperty('isPrototypeOf') === false) return false; - // Most likely a plain Object + if (prot.hasOwnProperty("isPrototypeOf") === false) { + return false; + } return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gRfIg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Compares 2 colors to see if they are equal. - * @param a RGBAColor to compare - * @param b RGBAColor to compare - * @returns True if colors are equal. - */ parcelHelpers.export(exports, "colorIsEqual", ()=>colorIsEqual); -/** - * Convert a CSS color string to a Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.). - * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. - */ parcelHelpers.export(exports, "colorFromString", ()=>colorFromString); -/** - * Convert a Deck.gl color to a CSS rgba() string. - * @param color A Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.) - */ parcelHelpers.export(exports, "colorToString", ()=>colorToString); -parcelHelpers.export(exports, "desaturate", ()=>desaturate); -var _d3Color = require("d3-color"); -function rgbToDeckglColor(c) { - return [ - c.r, - c.g, - c.b, - c.opacity * 255 - ]; -} -function colorIsEqual(a, b) { - if (a.length !== b.length) return false; - for(let i = 0; i < a.length; i++){ - if (a[i] !== b[i]) return false; + } + const deepmerge = deepmerge_1 || _deepmerge; + function clone(objectToClone) { + if (!objectToClone) + return objectToClone; + return deepmerge.all([objectToClone]); + } + const dontMerge = (destination, source2) => source2; + function deepMerge(...objectsToMerge) { + const objects = objectsToMerge.filter(Boolean); + return deepmerge.all(objects, { arrayMerge: dontMerge, isMergeableObject: isPlainObject }); + } + function rgbToDeckglColor(c2) { + return [c2.r, c2.g, c2.b, c2.opacity * 255]; + } + function colorIsEqual(a2, b2) { + if (a2.length !== b2.length) + return false; + for (let i = 0; i < a2.length; i++) { + if (a2[i] !== b2[i]) + return false; } return true; -} -function colorFromString(cssColorSpecifier) { + } + function colorFromString(cssColorSpecifier) { if (cssColorSpecifier) { - const dc = (0, _d3Color.color)(cssColorSpecifier); - if (dc) { - const c = dc.rgb(); - return rgbToDeckglColor(c); - } + const dc = color$2(cssColorSpecifier); + if (dc) { + const c2 = dc.rgb(); + return rgbToDeckglColor(c2); + } } -} -function colorToString(color) { - const c = [ - ...color - ]; - if (c.length > 3) c[3] /= 255; - return `rgba(${c.join(',')})`; -} -function desaturate(color, value) { - const rgb = (0, _d3Color.rgb)(color[0], color[1], color[2], color[3] / 255); - const hslColor = (0, _d3Color.hsl)(rgb); - hslColor.s = value; - const c = hslColor.rgb(); - return rgbToDeckglColor(c); -} - -},{"d3-color":"7SCp9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c3DaF":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "minHeight", ()=>minHeight); -parcelHelpers.export(exports, "minWidth", ()=>minWidth); -parcelHelpers.export(exports, "defaultPresenterStyle", ()=>defaultPresenterStyle); -parcelHelpers.export(exports, "defaultPresenterConfig", ()=>defaultPresenterConfig); -parcelHelpers.export(exports, "createStage", ()=>createStage); -parcelHelpers.export(exports, "groupStrokeWidth", ()=>groupStrokeWidth); -parcelHelpers.export(exports, "lineZ", ()=>lineZ); -parcelHelpers.export(exports, "defaultView", ()=>defaultView); -parcelHelpers.export(exports, "minZ", ()=>minZ); -parcelHelpers.export(exports, "min3dDepth", ()=>min3dDepth); -parcelHelpers.export(exports, "minPixelSize", ()=>minPixelSize); -parcelHelpers.export(exports, "defaultOnAxisItem", ()=>defaultOnAxisItem); -var _color = require("./color"); -const minHeight = '100px'; -const minWidth = '100px'; -const defaultPresenterStyle = { - cssPrefix: 'vega-morphcharts-', - defaultCubeColor: [ - 128, - 128, - 128, - 255 - ], - highlightColor: [ - 0, - 0, - 0, - 255 - ] -}; -const defaultPresenterConfig = { - onCubeClick: (e, cube)=>{}, - onCubeHover: (e, cube)=>{}, + } + function colorToString(color2) { + const c2 = [...color2]; + if (c2.length > 3) { + c2[3] /= 255; + } + return `rgba(${c2.join(",")})`; + } + function desaturate(color2, value2) { + const rgb2 = rgb$1(color2[0], color2[1], color2[2], color2[3] / 255); + const hslColor = hsl$1(rgb2); + hslColor.s = value2; + const c2 = hslColor.rgb(); + return rgbToDeckglColor(c2); + } + const util = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + addDiv, + addEl, + allTruthy, + clone, + colorFromString, + colorIsEqual, + colorToString, + concat, + createElement, + deepMerge, + desaturate, + getActiveElementInfo, + mount, + outerSize: outerSize$1, + push: push$1, + setActiveElement + }, Symbol.toStringTag, { value: "Module" })); + const minHeight = "100px"; + const minWidth = "100px"; + const defaultPresenterStyle$1 = { + cssPrefix: "vega-morphcharts-", + defaultCubeColor: [128, 128, 128, 255], + highlightColor: [0, 0, 0, 255] + }; + const defaultPresenterConfig = { + onCubeClick: (e, cube) => { + }, + onCubeHover: (e, cube) => { + }, transitionDurations: { - position: 600, - stagger: 600, - view: 600 + position: 600, + stagger: 600, + view: 600 }, renderer: { - advanced: false, - advancedOptions: {}, - basicOptions: { - antialias: true - } + advanced: false, + advancedOptions: {}, + basicOptions: { + antialias: true + } } -}; -function createStage(view) { + }; + function createStage(view) { const stage = { - view, - cubeData: [], - pathData: [], - axes: { - x: [], - y: [], - z: [] - }, - gridLines: [], - textData: [], - legend: { - rows: {} - }, - facets: [] + view, + cubeData: [], + pathData: [], + axes: { + x: [], + y: [], + z: [] + }, + gridLines: [], + textData: [], + legend: { + rows: {} + }, + facets: [] }; return stage; -} -const groupStrokeWidth = 1; -const lineZ = 0; -const defaultView = '2d'; -const minZ = 0.5; -const min3dDepth = 0.05; -const minPixelSize = 0.5; -const zAxisEncodeColor = [ - 7, - 7, - 7, - 255 -]; -const zAxisOutColor = [ - 0, - 0, - 0, - 255 -]; -function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { - if ((0, _color.colorIsEqual)(stageItem.color, zAxisEncodeColor)) { - stageItem.color = zAxisOutColor; - if (currAxis.axisRole !== 'z') { - const previousAxisRole = removeCurrentAxes(stage, currAxis); - if (previousAxisRole) { - currAxis.axisRole = 'z'; - stage.axes.z.push(currAxis); - } + } + const groupStrokeWidth = 1; + const lineZ = 0; + const defaultView$1 = "2d"; + const minZ = 0.5; + const min3dDepth = 0.05; + const minPixelSize = 0.5; + const zAxisEncodeColor = [7, 7, 7, 255]; + const zAxisOutColor = [0, 0, 0, 255]; + function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { + if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { + stageItem.color = zAxisOutColor; + if (currAxis.axisRole !== "z") { + const previousAxisRole = removeCurrentAxes(stage, currAxis); + if (previousAxisRole) { + currAxis.axisRole = "z"; + stage.axes.z.push(currAxis); + } + } + } + } + function removeCurrentAxes(stage, currAxis) { + for (const axisRole in stage.axes) { + const axes = stage.axes[axisRole]; + for (let i = 0; i < axes.length; i++) { + if (axes[i] === currAxis) { + axes.splice(i, 1); + return axisRole; } + } } -} -function removeCurrentAxes(stage, currAxis) { - //find the current axis, remove it from parent - for(const axisRole in stage.axes){ - const axes = stage.axes[axisRole]; - for(let i = 0; i < axes.length; i++)if (axes[i] === currAxis) { - axes.splice(i, 1); - return axisRole; - } - } -} - -},{"./color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bxBcY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param vega Vega library. - */ parcelHelpers.export(exports, "use", ()=>use); -const vega = { + } + const defaults = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + createStage, + defaultOnAxisItem, + defaultPresenterConfig, + defaultPresenterStyle: defaultPresenterStyle$1, + defaultView: defaultView$1, + groupStrokeWidth, + lineZ, + min3dDepth, + minHeight, + minPixelSize, + minWidth, + minZ + }, Symbol.toStringTag, { value: "Module" })); + const vega = { CanvasHandler: null, inferType: null, inferTypes: null, @@ -88151,4232 +55190,3697 @@ const vega = { scheme: null, truncate: null, View: null -}; -const base = { + }; + const base = { vega -}; -function use(vega) { - base.vega = vega; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3NoKz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Class which presents a Stage of chart data using MorphCharts to render. - */ parcelHelpers.export(exports, "Presenter", ()=>Presenter); -var _clone = require("./clone"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -var _legend = require("./legend"); -var _panel = require("./panel"); -var _patchedCubeArray = require("./patchedCubeArray"); -var _stagers = require("./stagers"); -var _tsxCreateElement = require("tsx-create-element"); -var _morphcharts = require("./morphcharts"); -class Presenter { - /** - * Get the previously rendered Stage object. - */ get stage() { - return this._last.stage; - } - /** - * Get the current View camera type. - */ get view() { - return this._last.view; - } - /** - * Instantiate a new Presenter. - * @param el Parent HTMLElement to present within. - * @param style Optional PresenterStyle styling options. - */ constructor(el, style){ - this.el = el; - this.style = (0, _clone.deepMerge)((0, _defaults.defaultPresenterStyle), style); - (0, _panel.initializePanel)(this); - this._last = { - view: null, - height: null, - width: null, - cubeCount: null, - stage: null - }; - } - /** - * Cancels any pending animation, calling animationCanceled() on original queue. - */ animationCancel() { - if (this.animationTimer) { - clearTimeout(this.animationTimer); - this.animationTimer = null; - if (this.logger) this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || 'handler'}`); - if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) this.queuedAnimationOptions.animationCanceled.call(null); - } - } - /** - * Stops the current animation and queues a new animation. - * @param handler Function to invoke when timeout is complete. - * @param timeout Length of time to wait before invoking the handler. - * @param options Optional QueuedAnimationOptions object. - */ animationQueue(handler, timeout, options) { - if (this.logger) this.logger(`queueing animation ${options && options.waitingLabel || 'waiting'}...(${timeout})`); - this.animationCancel(); - this.animationTimer = setTimeout(()=>{ - if (this.logger) this.logger(`queueing animation ${options && options.handlerLabel || 'handler'}...`); - handler(); - }, timeout); - } - /** - * Retrieve a sub-element of the rendered output. - * @param type PresenterElement type of the HTMLElement to retrieve. - */ getElement(type) { - const elements = this.el.getElementsByClassName((0, _panel.className)(type, this)); - if (elements && elements.length) return elements[0]; - } - /** - * Present the Vega Scene, or Stage object using Morphcharts. - * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. - * @param height Height of the rendering area. - * @param width Width of the rendering area. - * @param config Optional presentation configuration object. - */ present(sceneOrStage, height, width, config) { - this.animationCancel(); - const scene = sceneOrStage; - let stage; - const options = { - maxOrdinal: 0, - currAxis: null, - defaultCubeColor: this.style.defaultCubeColor, - assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (()=>options.maxOrdinal++), - modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : (0, _defaults.defaultOnAxisItem), - zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex - }; - //determine if this is a vega scene - if (scene.marktype) { - stage = (0, _defaults.createStage)(scene.view); - (0, _stagers.sceneToStage)(options, stage, scene); - } else stage = sceneOrStage; - const c = (0, _clone.deepMerge)((0, _defaults.defaultPresenterConfig), config); - if (!this.morphchartsref) { - this._morphChartsOptions = { - container: this.getElement((0, _enums.PresenterElement).gl), - pickGridCallback: c.axisPickGridCallback, - onCubeHover: (e, ordinal)=>{ - c.onCubeHover(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCubeClick: (e, ordinal)=>{ - c.onCubeClick(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, - onLasso: config === null || config === void 0 ? void 0 : config.onLasso - }; - this.morphchartsref = (0, _morphcharts.init)(this._morphChartsOptions, c.renderer || (0, _defaults.defaultPresenterConfig).renderer); - } - let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); - if (options.maxOrdinal) { - cubeCount = Math.max(cubeCount, options.maxOrdinal); - const empty = { - isEmpty: true - }; - stage.cubeData = (0, _patchedCubeArray.patchCubeArray)(cubeCount, empty, stage.cubeData); - } - config.preLayer && config.preLayer(stage); - this.morphChartsRenderResult = (0, _morphcharts.morphChartsRender)(this.morphchartsref, this._last.stage, stage, height, width, config && config.preStage, config && config.morphChartsColors, c); - delete stage.cubeData; - delete stage.redraw; - this._last = { - cubeCount, - height, - width, - stage, - view: stage.view - }; - const a = (0, _tsxCreateElement.getActiveElementInfo)(); - (0, _tsxCreateElement.mount)((0, _legend.LegendView)({ - legend: stage.legend, - onClick: config && config.onLegendClick - }), this.getElement((0, _enums.PresenterElement).legend)); - (0, _tsxCreateElement.setActiveElement)(a); - if (config && config.onPresent) config.onPresent(); - } - canvasToDataURL() { - return new Promise((resolve, reject)=>{ - this.morphchartsref.core.afterRenderCallback = ()=>{ - this.morphchartsref.core.afterRenderCallback = null; - const canvas = this.getElement((0, _enums.PresenterElement).gl).getElementsByTagName('canvas')[0]; - const png = canvas.toDataURL('image/png'); - resolve(png); - }; - }); - } - configColors(mcColors) { - (0, _morphcharts.colorConfig)(this.morphchartsref, mcColors); - } - /** - * Home the camera to the last initial position. - */ homeCamera() { - var _a; - (_a = this.morphchartsref) === null || _a === void 0 || _a.reset(); - } - /** - * Show guidelines of rendering height/width and center of OrbitView. - */ showGuides() { - this.getElement((0, _enums.PresenterElement).gl).classList.add('show-center'); - //TODO Morphcharts gridlines - } - finalize() { - this.animationCancel(); - if (this.morphchartsref) this.morphchartsref.core.stop(); - if (this.el) this.el.innerHTML = ''; - this._last = null; - this.morphchartsref = null; - this.el = null; - this.logger = null; - this.queuedAnimationOptions = null; - } -} - -},{"./clone":"9OkEI","./defaults":"c3DaF","./enums":"dvKuu","./legend":"8NtN9","./panel":"3DB3l","./patchedCubeArray":"aGmmw","./stagers":"iwkC9","tsx-create-element":"9w9U8","./morphcharts":"1zeZZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dvKuu":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * HTML elements outputted by the presenter. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PresenterElement", ()=>PresenterElement); -var PresenterElement; -(function(PresenterElement) { - PresenterElement[PresenterElement["root"] = 0] = "root"; - PresenterElement[PresenterElement["gl"] = 1] = "gl"; - PresenterElement[PresenterElement["panel"] = 2] = "panel"; - PresenterElement[PresenterElement["legend"] = 3] = "legend"; - PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls"; -})(PresenterElement || (PresenterElement = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8NtN9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LegendView", ()=>LegendView); -var _tsxCreateElement = require("tsx-create-element"); -var _controls = require("./controls"); -const LegendView = (props)=>{ + }; + function use$1(vega2) { + base.vega = vega2; + } + var PresenterElement; + (function(PresenterElement2) { + PresenterElement2[PresenterElement2["root"] = 0] = "root"; + PresenterElement2[PresenterElement2["gl"] = 1] = "gl"; + PresenterElement2[PresenterElement2["panel"] = 2] = "panel"; + PresenterElement2[PresenterElement2["legend"] = 3] = "legend"; + PresenterElement2[PresenterElement2["vegaControls"] = 4] = "vegaControls"; + })(PresenterElement || (PresenterElement = {})); + const LegendView = (props) => { const rows = []; - const addRow = (row, i)=>{ - const fn = symbolMap[row.symbol.shape]; - let jsx; - if (fn) jsx = fn(row.symbol); - else jsx = (0, _tsxCreateElement.createElement)("span", null, "x"); - rows.push({ - cells: [ - { - className: 'symbol', - content: jsx - }, - { - className: 'label', - content: row.label, - title: row.label - } - ] - }); + const addRow = (row, i) => { + const fn2 = symbolMap[row.symbol.shape]; + let jsx; + if (fn2) { + jsx = fn2(row.symbol); + } else { + jsx = createElement("span", null, "x"); + } + rows.push({ + cells: [ + { className: "symbol", content: jsx }, + { className: "label", content: row.label, title: row.label } + ] + }); }; - const sorted = Object.keys(props.legend.rows).sort((a, b)=>+a - +b); - sorted.forEach((i)=>addRow(props.legend.rows[i], +i)); - if (sorted.length) return (0, _tsxCreateElement.createElement)((0, _controls.Table), { - rows: rows, - rowClassName: "legend-row", - onRowClick: (e, i)=>props.onClick(e, props.legend, i) - }, props.legend.title !== void 0 && (0, _tsxCreateElement.createElement)("tr", { - onClick: (e)=>props.onClick(e, props.legend, null) - }, (0, _tsxCreateElement.createElement)("th", { - colSpan: 2 - }, props.legend.title))); -}; -const symbolMap = { - square: function(symbol) { - return (0, _tsxCreateElement.createElement)("div", { - style: { - height: `${symbol.bounds.y2 - symbol.bounds.y1}px`, - width: `${symbol.bounds.x2 - symbol.bounds.x1}px`, - backgroundColor: symbol.fill, - borderColor: symbol.fill - } - }); + const sorted = Object.keys(props.legend.rows).sort((a2, b2) => +a2 - +b2); + sorted.forEach((i) => addRow(props.legend.rows[i])); + if (sorted.length) { + return createElement(Table$1, { rows, rowClassName: "legend-row", onRowClick: (e, i) => props.onClick(e, props.legend, i) }, props.legend.title !== void 0 && createElement( + "tr", + { onClick: (e) => props.onClick(e, props.legend, null) }, + createElement("th", { colSpan: 2 }, props.legend.title) + )); } -}; - -},{"tsx-create-element":"9w9U8","./controls":"mTToq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3DB3l":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializePanel", ()=>initializePanel); -parcelHelpers.export(exports, "className", ()=>className); -var _tsxCreateElement = require("tsx-create-element"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -function initializePanel(presenter) { - const rootDiv = (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).root, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).gl, presenter), - style: { - minHeight: (0, _defaults.minHeight), - minWidth: (0, _defaults.minWidth) - } - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).panel, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).vegaControls, presenter) - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).legend, presenter) - }))); - (0, _tsxCreateElement.mount)(rootDiv, presenter.el); -} -function className(type, presenter) { - return `${presenter.style.cssPrefix}${(0, _enums.PresenterElement)[type]}`; -} - -},{"tsx-create-element":"9w9U8","./defaults":"c3DaF","./enums":"dvKuu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aGmmw":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "patchCubeArray", ()=>patchCubeArray); -function patchCubeArray(allocatedSize, empty, cubes) { + }; + const symbolMap = { + square: function(symbol2) { + return createElement("div", { style: { + height: `${symbol2.bounds.y2 - symbol2.bounds.y1}px`, + width: `${symbol2.bounds.x2 - symbol2.bounds.x1}px`, + backgroundColor: symbol2.fill, + borderColor: symbol2.fill + } }); + } + }; + function initializePanel(presenter) { + const rootDiv = createElement( + "div", + { className: className(PresenterElement.root, presenter) }, + createElement("div", { className: className(PresenterElement.gl, presenter), style: { minHeight, minWidth } }), + createElement( + "div", + { className: className(PresenterElement.panel, presenter) }, + createElement("div", { className: className(PresenterElement.vegaControls, presenter) }), + createElement("div", { className: className(PresenterElement.legend, presenter) }) + ) + ); + mount(rootDiv, presenter.el); + } + function className(type2, presenter) { + return `${presenter.style.cssPrefix}${PresenterElement[type2]}`; + } + function patchCubeArray(allocatedSize, empty, cubes) { const patched = new Array(allocatedSize); patched.fill(empty); - cubes.forEach((cube)=>patched[cube.ordinal] = cube); + cubes.forEach((cube) => patched[cube.ordinal] = cube); return patched; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iwkC9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sceneToStage", ()=>sceneToStage); -var _legend = require("./marks/legend"); -var _legendDefault = parcelHelpers.interopDefault(_legend); -var _image = require("./marks/image"); -var _imageDefault = parcelHelpers.interopDefault(_image); -var _rect = require("./marks/rect"); -var _rectDefault = parcelHelpers.interopDefault(_rect); -var _rule = require("./marks/rule"); -var _ruleDefault = parcelHelpers.interopDefault(_rule); -var _line = require("./marks/line"); -var _lineDefault = parcelHelpers.interopDefault(_line); -var _text = require("./marks/text"); -var _textDefault = parcelHelpers.interopDefault(_text); -var _base = require("./base"); -var _color = require("./color"); -var _defaults = require("./defaults"); -var _interfaces = require("./marks/interfaces"); -function getAxisGroupType(item, options) { - const axisItem = item; - const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; - if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== undefined) return (0, _interfaces.GroupType).zAxis; - switch(axisItem.orient){ - case 'bottom': - case 'top': - return (0, _interfaces.GroupType).xAxis; - case 'left': - case 'right': - return (0, _interfaces.GroupType).yAxis; - } -} -function convertGroupRole(item, options) { - if (item.mark.role === 'legend') return (0, _interfaces.GroupType).legend; - if (item.mark.role === 'axis') { - const groupType = getAxisGroupType(item, options); - if (groupType !== undefined) return groupType; - } -} -const group = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(g) { - const gx = g.x || 0, gy = g.y || 0; - if (g.context && g.context.background && !stage.backgroundColor) stage.backgroundColor = (0, _color.colorFromString)(g.context.background); - if (g.stroke) { - const facetRect = { - datum: g.datum, - lines: (0, _rule.box)(gx + x, gy + y, g.height, g.width, g.stroke, (0, _defaults.groupStrokeWidth)) - }; - stage.facets.push(facetRect); - } - groupType = convertGroupRole(g, options) || groupType; - setCurrentAxis(options, stage, groupType); - // draw group contents - (0, _base.base).vega.sceneVisit(g, function(item) { - mainStager(options, stage, item, gx + x, gy + y, groupType); - }); - }); -}; -function setCurrentAxis(options, stage, groupType) { - let axisRole; - switch(groupType){ - case (0, _interfaces.GroupType).xAxis: - axisRole = 'x'; - break; - case (0, _interfaces.GroupType).yAxis: - axisRole = 'y'; - break; - case (0, _interfaces.GroupType).zAxis: - axisRole = 'z'; - break; - default: - return; - } - options.currAxis = { - axisRole, - domain: null, - tickText: [], - ticks: [] - }; - stage.axes[axisRole].push(options.currAxis); -} -const markStagers = { - group, - legend: (0, _legendDefault.default), - image: (0, _imageDefault.default), - rect: (0, _rectDefault.default), - rule: (0, _ruleDefault.default), - line: (0, _lineDefault.default), - text: (0, _textDefault.default) -}; -const mainStager = (options, stage, scene, x, y, groupType)=>{ - if (scene.marktype !== 'group' && groupType === (0, _interfaces.GroupType).legend) (0, _legendDefault.default)(options, stage, scene, x, y, groupType); - else { - const markStager = markStagers[scene.marktype]; - if (markStager) markStager(options, stage, scene, x, y, groupType); + } + const legendMap = { + "legend-title": function(legend2, textItem) { + legend2.title = textItem.text; + }, + "legend-symbol": function(legend2, symbol2) { + const { bounds: bounds2, fill: fill2, shape: shape2 } = symbol2; + const legendRowSymbol = { bounds: bounds2, fill: fill2, shape: shape2 }; + const i = symbol2.datum.index; + legend2.rows[i] = legend2.rows[i] || {}; + legend2.rows[i].symbol = legendRowSymbol; + }, + "legend-label": function(legend2, label2) { + const i = label2.datum.index; + legend2.rows[i] = legend2.rows[i] || {}; + const row = legend2.rows[i]; + row.label = label2.text; + row.value = label2.datum.value; } -}; -function sceneToStage(options, stage, scene) { - mainStager(options, stage, scene, 0, 0, null); - sortAxis(stage.axes.x, 0); - sortAxis(stage.axes.y, 1); - sortAxis(stage.axes.z, 1); -} -function sortAxis(axes, dim) { - axes.forEach((axis)=>{ - if (axis.domain) orderDomain(axis.domain, dim); - axis.ticks.sort((a, b)=>a.sourcePosition[dim] - b.sourcePosition[dim]); - axis.tickText.sort((a, b)=>a.position[dim] - b.position[dim]); - }); -} -function orderDomain(domain, dim) { - if (domain.sourcePosition[dim] > domain.targetPosition[dim]) { - const temp = domain.targetPosition; - domain.targetPosition = domain.sourcePosition; - domain.sourcePosition = temp; - } -} - -},{"./marks/legend":"4ew4D","./marks/image":"7l9CM","./marks/rect":"3v8BK","./marks/rule":"gXjfm","./marks/line":"eSo5o","./marks/text":"2EWWv","./base":"bxBcY","./color":"gRfIg","./defaults":"c3DaF","./marks/interfaces":"S4mDt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4ew4D":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const legendMap = { - 'legend-title': function(legend, textItem) { - legend.title = textItem.text; - }, - 'legend-symbol': function(legend, symbol) { - const { bounds, fill, shape } = symbol; - //this object is safe for serialization - const legendRowSymbol = { - bounds, - fill, - shape - }; - const i = symbol.datum.index; - legend.rows[i] = legend.rows[i] || {}; - legend.rows[i].symbol = legendRowSymbol; - }, - 'legend-label': function(legend, label) { - const i = label.datum.index; - legend.rows[i] = legend.rows[i] || {}; - const row = legend.rows[i]; - row.label = label.text; - row.value = label.datum.value; - } -}; -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const fn = legendMap[item.mark.role]; - if (fn) fn(stage.legend, item); + }; + const markStager$5 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const fn2 = legendMap[item.mark.role]; + if (fn2) { + fn2(stage.legend, item); + } }); -}; -exports.default = markStager; - -},{"../base":"bxBcY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7l9CM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const { bounds, height, url, width } = item; - let { x1, x2, y1, y2 } = bounds; - x1 += x; - x2 += x; - y1 += y; - y2 += y; - if (!stage.backgroundImages) stage.backgroundImages = []; - stage.backgroundImages.push({ - bounds: { - x1, - x2, - y1, - y2 - }, - height, - url, - width - }); + }; + const markStager$4 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const { bounds: bounds2, height: height2, url, width: width2 } = item; + let { x1: x12, x2: x22, y1: y12, y2: y22 } = bounds2; + x12 += x2; + x22 += x2; + y12 += y2; + y22 += y2; + if (!stage.backgroundImages) { + stage.backgroundImages = []; + } + stage.backgroundImages.push({ bounds: { x1: x12, x2: x22, y1: y12, y2: y22 }, height: height2, url, width: width2 }); }); -}; -exports.default = markStager; - -},{"../base":"bxBcY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3v8BK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const noZ = item.z === undefined; - const z = noZ ? 0 : (item.z || 0) + (0, _defaults.minZ); - const depth = (noZ ? 0 : item.depth || 0) + (0, _defaults.min3dDepth); - //change direction of y from SVG to GL - const ty = -1; - const ordinal = options.assignCubeOrdinal(item.datum); - if (ordinal > options.maxOrdinal) options.maxOrdinal = ordinal; - if (ordinal === undefined) ; - else { - const cube = { - ordinal, - size: [ - item.width, - item.height, - depth - ], - position: [ - x + (+item.x || 0), - ty * (y + (+item.y || 0)) - +item.height, - z - ], - color: (0, _color.colorFromString)(item.fill) || options.defaultCubeColor || [ - 128, - 128, - 128, - 128 - ] - }; - cube.color[3] = item.opacity === undefined ? 255 : 255 * item.opacity; - stage.cubeData.push(cube); - } + }; + const markStager$3 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const noZ = item.z === void 0; + const z = noZ ? 0 : (item.z || 0) + minZ; + const depth = (noZ ? 0 : item.depth || 0) + min3dDepth; + const ty2 = -1; + const ordinal2 = options.assignCubeOrdinal(item.datum); + if (ordinal2 > options.maxOrdinal) { + options.maxOrdinal = ordinal2; + } + if (ordinal2 === void 0) ; + else { + const cube = { + ordinal: ordinal2, + size: [item.width, item.height, depth], + position: [x2 + (+item.x || 0), ty2 * (y2 + (+item.y || 0)) - +item.height, z], + color: colorFromString(item.fill) || options.defaultCubeColor || [128, 128, 128, 128] + }; + cube.color[3] = item.opacity === void 0 ? 255 : 255 * item.opacity; + stage.cubeData.push(cube); + } }); -}; -exports.default = markStager; - -},{"../base":"bxBcY","../color":"gRfIg","../defaults":"c3DaF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gXjfm":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "box", ()=>box); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const x1 = item.x || 0; - const y1 = item.y || 0; - const x2 = item.x2 != null ? item.x2 : x1; - const y2 = item.y2 != null ? item.y2 : y1; - const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth); - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, lineItem, stage, currAxis); - if (item.mark.role === 'axis-tick') currAxis.ticks.push(lineItem); - else if (item.mark.role === 'axis-domain') currAxis.domain = lineItem; - else stage.gridLines.push(lineItem); + }; + const markStager$2 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const x12 = item.x || 0; + const y12 = item.y || 0; + const x22 = item.x2 != null ? item.x2 : x12; + const y22 = item.y2 != null ? item.y2 : y12; + const lineItem = styledLine(x12 + x2, y12 + y2, x22 + x2, y22 + y2, item.stroke, item.strokeWidth); + const { currAxis } = options; + if (options.modifyAxis) { + options.modifyAxis(item, lineItem, stage, currAxis); + } + if (item.mark.role === "axis-tick") { + currAxis.ticks.push(lineItem); + } else if (item.mark.role === "axis-domain") { + currAxis.domain = lineItem; + } else { + stage.gridLines.push(lineItem); + } }); -}; -function styledLine(x1, y1, x2, y2, stroke, strokeWidth) { - const line = { - sourcePosition: [ - x1, - -y1, - (0, _defaults.lineZ) - ], - targetPosition: [ - x2, - -y2, - (0, _defaults.lineZ) - ], - color: (0, _color.colorFromString)(stroke), - strokeWidth: strokeWidth - }; - return line; -} -function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) { + }; + function styledLine(x12, y12, x2, y2, stroke2, strokeWidth) { + const line2 = { + sourcePosition: [x12, -y12, lineZ], + //-1 = change direction of y from SVG to GL + targetPosition: [x2, -y2, lineZ], + color: colorFromString(stroke2), + strokeWidth + }; + return line2; + } + function box(gx, gy, height2, width2, stroke2, strokeWidth, diagonals = false) { const lines = [ - styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), - styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), - styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), - styledLine(gx, gy + height, gx, gy, stroke, strokeWidth) + styledLine(gx, gy, gx + width2, gy, stroke2, strokeWidth), + styledLine(gx + width2, gy, gx + width2, gy + height2, stroke2, strokeWidth), + styledLine(gx + width2, gy + height2, gx, gy + height2, stroke2, strokeWidth), + styledLine(gx, gy + height2, gx, gy, stroke2, strokeWidth) ]; if (diagonals) { - lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth)); - lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth)); + lines.push(styledLine(gx, gy, gx + width2, gy + height2, stroke2, strokeWidth)); + lines.push(styledLine(gx, gy + height2, gx + width2, gy, stroke2, strokeWidth)); } return lines; -} -exports.default = markStager; - -},{"../base":"bxBcY","../color":"gRfIg","../defaults":"c3DaF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eSo5o":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _color = require("../color"); -//change direction of y from SVG to GL -const ty = -1; -const markStager = (options, stage, scene, x, y, groupType)=>{ - const g = Object.assign({ - opacity: 1, - strokeOpacity: 1, - strokeWidth: 1 - }, scene.items[0]); - const path = { - strokeWidth: g.strokeWidth, - strokeColor: (0, _color.colorFromString)(g.stroke), - positions: scene.items.map((it)=>[ - it.x, - ty * it.y, - it.z || 0 - ]) - }; - path.strokeColor[3] *= g.strokeOpacity; - path.strokeColor[3] *= g.opacity; - stage.pathData.push(path); -}; -exports.default = markStager; - -},{"../color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2EWWv":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ // import { AlignmentBaseline, TextAnchor } from '@deck.gl/layers/text-layer/text-layer'; -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - //change direction of y from SVG to GL - const ty = -1; - (0, _base.base).vega.sceneVisit(scene, function(item) { - if (!item.text) return; - const size = item.fontSize; - //const alignmentBaseline = convertBaseline(item.baseline); - //const yOffset = alignmentBaseline === 'top' ? item.fontSize / 2 : 0; //fixup to get tick text correct - const yOffset = 0; - const textItem = { - color: (0, _color.colorFromString)(item.fill), - text: item.limit === undefined ? item.text : (0, _base.base).vega.truncate(item.text, item.limit, 'right', item.ellipsis || '...'), - position: [ - x + (item.x || 0), - ty * (y + (item.y || 0) + yOffset), - 0 - ], - size, - angle: convertAngle(item.angle), - //textAnchor: convertAlignment(item.align), - //alignmentBaseline, - metaData: item.metaData - }; - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, textItem, stage, currAxis); - if (item.mark.role === 'axis-label') { - const tickText = textItem; - tickText.value = item.datum.value; - currAxis.tickText.push(tickText); - } else if (item.mark.role === 'axis-title') currAxis.title = textItem; - else stage.textData.push(textItem); + } + const ty = -1; + const markStager$1 = (options, stage, scene, x2, y2, groupType) => { + const g = Object.assign({ opacity: 1, strokeOpacity: 1, strokeWidth: 1 }, scene.items[0]); + const path2 = { + strokeWidth: g.strokeWidth, + strokeColor: colorFromString(g.stroke), + positions: scene.items.map((it) => [ + it.x, + ty * it.y, + it.z || 0 + ]) + }; + path2.strokeColor[3] *= g.strokeOpacity; + path2.strokeColor[3] *= g.opacity; + stage.pathData.push(path2); + }; + const markStager = (options, stage, scene, x2, y2, groupType) => { + const ty2 = -1; + base.vega.sceneVisit(scene, function(item) { + if (!item.text) + return; + const size2 = item.fontSize; + const yOffset = 0; + const textItem = { + color: colorFromString(item.fill), + text: item.limit === void 0 ? item.text : base.vega.truncate(item.text, item.limit, "right", item.ellipsis || "..."), + //use dots instead of unicode ellipsis for + position: [x2 + (item.x || 0), ty2 * (y2 + (item.y || 0) + yOffset), 0], + size: size2, + angle: convertAngle(item.angle), + //textAnchor: convertAlignment(item.align), + //alignmentBaseline, + metaData: item.metaData + }; + const { currAxis } = options; + if (options.modifyAxis) { + options.modifyAxis(item, textItem, stage, currAxis); + } + if (item.mark.role === "axis-label") { + const tickText = textItem; + tickText.value = item.datum.value; + currAxis.tickText.push(tickText); + } else if (item.mark.role === "axis-title") { + currAxis.title = textItem; + } else { + stage.textData.push(textItem); + } }); -}; -function convertAngle(vegaTextAngle) { - if (vegaTextAngle && !isNaN(vegaTextAngle)) return 360 - vegaTextAngle; + }; + function convertAngle(vegaTextAngle) { + if (vegaTextAngle && !isNaN(vegaTextAngle)) { + return 360 - vegaTextAngle; + } return 0; -} -// function convertAlignment(textAlign: SceneTextAlign): TextAnchor { -// switch (textAlign) { -// case 'center': return 'middle'; -// case 'left': return 'start'; -// case 'right': return 'end'; -// } -// return 'start'; -// } -// function convertBaseline(baseline: SceneTextBaseline): AlignmentBaseline { -// switch (baseline) { -// case 'middle': return 'center'; -// } -// return baseline || 'bottom'; -// } -exports.default = markStager; - -},{"../base":"bxBcY","../color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"S4mDt":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GroupType", ()=>GroupType); -var GroupType; -(function(GroupType) { - GroupType[GroupType["none"] = 0] = "none"; - GroupType[GroupType["legend"] = 1] = "legend"; - GroupType[GroupType["xAxis"] = 2] = "xAxis"; - GroupType[GroupType["yAxis"] = 3] = "yAxis"; - GroupType[GroupType["zAxis"] = 4] = "zAxis"; -})(GroupType || (GroupType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1zeZZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _render = require("./render"); -parcelHelpers.exportAll(_render, exports); -var _color = require("./color"); -parcelHelpers.exportAll(_color, exports); -var _init = require("./init"); -parcelHelpers.exportAll(_init, exports); - -},{"./render":"bOMKd","./color":"cLUpV","./init":"gSXAZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOMKd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "morphChartsRender", ()=>morphChartsRender); -var _axes = require("./axes"); -var _bounds = require("./bounds"); -var _cubes = require("./cubes"); -var _lines = require("./lines"); -var _text = require("./text"); -var _image = require("./image"); -var _defaults = require("../defaults"); -var _color = require("./color"); -var _defaults1 = require("./defaults"); -var _camera = require("./camera"); -function morphChartsRender(ref, prevStage, stage, height, width, preStage, colors, config) { - const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults1.cameraDefaults); - const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref; - let transistion2dOnly = false; - let cameraTo; - let holdCamera; - if (config.camera === 'hold') holdCamera = true; - else cameraTo = config.camera; - if (prevStage && prevStage.view !== stage.view) { - modelTransitioner.shouldTransition = !holdCamera; - if (stage.view === '2d') { - modelTransitioner.qRotation.from = qModelRotation3d; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.from = qModelRotation2d; - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - } else { - modelTransitioner.shouldTransition = false; - if (stage.view === '2d') { - transistion2dOnly = true; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } + } + var GroupType; + (function(GroupType2) { + GroupType2[GroupType2["none"] = 0] = "none"; + GroupType2[GroupType2["legend"] = 1] = "legend"; + GroupType2[GroupType2["xAxis"] = 2] = "xAxis"; + GroupType2[GroupType2["yAxis"] = 3] = "yAxis"; + GroupType2[GroupType2["zAxis"] = 4] = "zAxis"; + })(GroupType || (GroupType = {})); + function getAxisGroupType(item, options) { + const axisItem = item; + const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; + if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== void 0) { + return GroupType.zAxis; } - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - if (!prevStage) { - core.setModelRotation(modelTransitioner.qRotation.to, false); - core.camera.setOrbit(cameraTransitioner.qRotation.to, false); - core.camera.setPosition(cameraTransitioner.vPosition.to, false); - } else if (!holdCamera) cameraTransitioner.begin(); - positionTransitioner.begin(); - if (modelTransitioner.shouldTransition) modelTransitioner.begin(); - const props = { - ref, - stage, - height, - width, - config - }; - const cubeLayer = (0, _cubes.createCubeLayer)(props); - const lineLayer = (0, _lines.createLineLayer)(props); - const textLayer = (0, _text.createTextLayer)(props); - const { backgroundImages } = stage; - let contentBounds = (0, _bounds.outerBounds)((0, _bounds.outerBounds)(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), (0, _bounds.outerBounds)(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); - backgroundImages === null || backgroundImages === void 0 || backgroundImages.forEach((backgroundImage)=>{ - contentBounds = (0, _bounds.outerBounds)(contentBounds, convertBounds(backgroundImage.bounds)); - }); - props.bounds = contentBounds; - core.renderer.previousAxes = core.renderer.currentAxes; - const axesLayer = (0, _axes.createAxesLayer)(props); - core.config.transitionStaggering = config.transitionDurations.stagger; - core.config.transitionDuration = config.transitionDurations.position; - let bounds; - if (axesLayer && axesLayer.bounds) bounds = axesLayer.bounds; - else bounds = contentBounds; - ref.setMorphChartsRendererOptions(config.renderer); - if (preStage) preStage(stage, cubeLayer); - //add images - core.renderer.images = []; - if (backgroundImages) { - const addImage = (imageBounds, imageData)=>{ - const imageWidth = imageBounds.maxBoundsX - imageBounds.minBoundsX; - const imageHeight = imageBounds.maxBoundsY - imageBounds.minBoundsY; - const position = [ - imageBounds.minBoundsX + imageWidth / 2, - imageBounds.minBoundsY + imageHeight / 2, - 0 - ]; - const imageQuad = (0, _image.createImageQuad)(core, imageData, contentBounds, position, imageWidth, imageHeight); - const imageVisual = core.renderer.createImageVisual(imageQuad); - core.renderer.images.push(imageVisual); + switch (axisItem.orient) { + case "bottom": + case "top": + return GroupType.xAxis; + case "left": + case "right": + return GroupType.yAxis; + } + } + function convertGroupRole(item, options) { + if (item.mark.role === "legend") + return GroupType.legend; + if (item.mark.role === "axis") { + const groupType = getAxisGroupType(item, options); + if (groupType !== void 0) { + return groupType; + } + } + } + const group = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(g) { + const gx = g.x || 0, gy = g.y || 0; + if (g.context && g.context.background && !stage.backgroundColor) { + stage.backgroundColor = colorFromString(g.context.background); + } + if (g.stroke) { + const facetRect = { + datum: g.datum, + lines: box(gx + x2, gy + y2, g.height, g.width, g.stroke, groupStrokeWidth) }; - const imageDataCache = {}; - backgroundImages.forEach((backgroundImage)=>{ - const imageBounds = convertBounds(backgroundImage.bounds); - const imageData = imageDataCache[backgroundImage.url]; - if (imageData) addImage(imageBounds, imageData); - else (0, _image.getImageData)(backgroundImage.url).then((imageData)=>{ - imageDataCache[backgroundImage.url] = imageData; - addImage(imageBounds, imageData); - }); - }); + stage.facets.push(facetRect); + } + groupType = convertGroupRole(g, options) || groupType; + setCurrentAxis(options, stage, groupType); + base.vega.sceneVisit(g, function(item) { + mainStager(options, stage, item, gx + x2, gy + y2, groupType); + }); + }); + }; + function setCurrentAxis(options, stage, groupType) { + let axisRole; + switch (groupType) { + case GroupType.xAxis: + axisRole = "x"; + break; + case GroupType.yAxis: + axisRole = "y"; + break; + case GroupType.zAxis: + axisRole = "z"; + break; + default: + return; } - //Now call update on each layout - layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds, ref.layerStagger); - (0, _camera.applyCameraCallbacks)(ref, config, stage.view, transistion2dOnly); - core.renderer.transitionTime = 0; // Set renderer transition time for this render pass to prevent rendering target buffer for single frame - (0, _color.colorConfig)(ref, colors); - return { - bounds, - getCubeLayer: ()=>cubeLayer, - update: (layerSelection)=>layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, ref.layerStagger), - activate: (id)=>core.renderer.transitionBuffers[0].activeId = id, - moveCamera: (camera)=>{ - if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - cameraTransitioner.move(camera.position, camera.rotation); - } - }, - setTransitionTimeAxesVisibility: ()=>{ - (0, _camera.setTransitionTimeAxesVisibility)(transistion2dOnly, core); - } + options.currAxis = { + axisRole, + domain: null, + tickText: [], + ticks: [] }; -} -function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, layerStagger) { - const layerItems = [ - { - layer: cubeLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes - }, - { - layer: lineLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines - }, - { - layer: textLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts - } + stage.axes[axisRole].push(options.currAxis); + } + const markStagers = { + group, + legend: markStager$5, + image: markStager$4, + rect: markStager$3, + rule: markStager$2, + line: markStager$1, + text: markStager + }; + const mainStager = (options, stage, scene, x2, y2, groupType) => { + if (scene.marktype !== "group" && groupType === GroupType.legend) { + markStager$5(options, stage, scene); + } else { + const markStager2 = markStagers[scene.marktype]; + if (markStager2) { + markStager2(options, stage, scene, x2, y2, groupType); + } + } + }; + function sceneToStage(options, stage, scene) { + mainStager(options, stage, scene, 0, 0, null); + sortAxis(stage.axes.x, 0); + sortAxis(stage.axes.y, 1); + sortAxis(stage.axes.z, 1); + } + function sortAxis(axes, dim) { + axes.forEach((axis) => { + if (axis.domain) + orderDomain(axis.domain, dim); + axis.ticks.sort((a2, b2) => a2.sourcePosition[dim] - b2.sourcePosition[dim]); + axis.tickText.sort((a2, b2) => a2.position[dim] - b2.position[dim]); + }); + } + function orderDomain(domain2, dim) { + if (domain2.sourcePosition[dim] > domain2.targetPosition[dim]) { + const temp2 = domain2.targetPosition; + domain2.targetPosition = domain2.sourcePosition; + domain2.sourcePosition = temp2; + } + } + function outerBounds(b1, b2) { + if (!b1 && !b2) + return; + if (!b1) + return b2; + if (!b2) + return b1; + const minProps = [ + "minBoundsX", + "minBoundsY", + "minBoundsZ" ]; - layerItems.forEach((layerItem)=>{ - var _a; - return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds, layerItem.selection, layerItem.stagger); + const maxProps = [ + "maxBoundsX", + "maxBoundsY", + "maxBoundsZ" + ]; + const result = {}; + minProps.forEach((p) => result[p] = notNull(Math.min, b1[p], b2[p])); + maxProps.forEach((p) => result[p] = notNull(Math.max, b1[p], b2[p])); + return result; + } + function notNull(fn2, v1, v2) { + if (v1 == null && v2 == null) + return null; + if (v1 == null) + return v2; + if (v2 == null) + return v1; + return fn2(v1, v2); + } + function increment(b2, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { + return outerBounds(b2, { + minBoundsX, + minBoundsY, + minBoundsZ, + maxBoundsX, + maxBoundsY, + maxBoundsZ }); -} -function convertBounds(bounds) { - if (!bounds) return; - return { - minBoundsX: bounds.x1, - maxBoundsX: bounds.x2, - minBoundsY: -bounds.y2, - maxBoundsY: -bounds.y1, - minBoundsZ: (0, _defaults.minZ), - maxBoundsZ: (0, _defaults.minZ) - }; -} - -},{"./axes":"fQgAd","./bounds":"jYVLQ","./cubes":"fl32M","./lines":"3egUA","./text":"6GPxW","./image":"cic5g","../defaults":"c3DaF","./color":"cLUpV","./defaults":"e8nEW","./camera":"fuwxM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fQgAd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createAxesLayer", ()=>createAxesLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -const createAxesLayer = (props)=>{ - const { config, height, ref, stage } = props; - const { core } = ref; + } + const createAxesLayer = (props) => { + const { config, height: height2, ref: ref2, stage } = props; + const { core } = ref2; const { renderer } = core; - const { x, y, z } = stage.axes; - const xyz = [ - ...x, - ...y, - ...z - ]; + const { x: x2, y: y2, z } = stage.axes; + const xyz = [...x2, ...y2, ...z]; renderer.currentAxes = []; if (!xyz.length) { - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - return; + renderer.axesVisibility = AxesVisibility.none; + return; } - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + renderer.axesVisibility = AxesVisibility.current; const correlation = new AxesCorrelation(stage, 3); const { axesSets, labels } = correlation; - const grid = correlation.getGrid(); - if (grid.byColumn[0]) { - grid.byColumn[0].forEach((row)=>{ - row.axesSet.showFacetTitleY = true; - }); - grid.byRow[0].forEach((col)=>{ - col.axesSet.showFacetTitleX = true; - }); + const grid2 = correlation.getGrid(); + if (grid2.byColumn[0]) { + grid2.byColumn[0].forEach((row) => { + row.axesSet.showFacetTitleY = true; + }); + grid2.byRow[0].forEach((col) => { + col.axesSet.showFacetTitleX = true; + }); } - if (grid.rows > 1) { - const { byRow } = grid; - byRow[0].forEach(({ axesSet }, col)=>{ - if (!axesSet.y) { - if (byRow[1][col].axesSet) { - //move x up - byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; - byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; - delete axesSet.x; - } - } - }); + if (grid2.rows > 1) { + const { byRow } = grid2; + byRow[0].forEach(({ axesSet }, col) => { + if (!axesSet.y) { + if (byRow[1][col].axesSet) { + byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; + byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; + delete axesSet.x; + } + } + }); } - let bounds; + let bounds2; const allAxesSetBounds = []; let anyZ = false; - for(let i = 0; i < axesSets.length; i++)if (axesSets[i].z) { + for (let i = 0; i < axesSets.length; i++) { + if (axesSets[i].z) { anyZ = true; break; + } } - const is3d = stage.view === '3d' && anyZ; - axesSets.forEach((axesSet)=>{ - if (!axesSet.x && !axesSet.y) return; - const axesSetBounds = { - axesSet, - maxBoundsX: null, - maxBoundsY: null, - maxBoundsZ: null, - minBoundsX: null, - minBoundsY: null, - minBoundsZ: null - }; - if (is3d) { - const zBounds = getDomainBounds(1, axesSet.z); - axesSetBounds.minBoundsZ = -zBounds.maxBounds; - axesSetBounds.maxBoundsZ = -zBounds.minBounds; - } - const yBounds = getDomainBounds(1, axesSet.y); - axesSetBounds.minBoundsY = yBounds.minBounds; - axesSetBounds.maxBoundsY = yBounds.maxBounds; - axesSetBounds.y = yBounds.minBounds; - axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; - const xBounds = getDomainBounds(0, axesSet.x); - axesSetBounds.minBoundsX = xBounds.minBounds; - axesSetBounds.maxBoundsX = xBounds.maxBounds; - axesSetBounds.x = xBounds.minBounds; - axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; - allAxesSetBounds.push(axesSetBounds); - bounds = (0, _bounds.outerBounds)(bounds, axesSetBounds); - }); - const facetLabelX = labels.filter((label)=>label.axisRole === 'x')[0]; - const facetLabelY = labels.filter((label)=>label.axisRole === 'y')[0]; - core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator })=>{ - const axesSet = axesSets[axes]; - let a; - let f; - switch(axis){ - case 0: - a = axesSet.x; - f = facetLabelX; - break; - case 1: - a = axesSet.y; - f = facetLabelY; - break; - case 2: - a = axesSet.z; - break; + const is3d = stage.view === "3d" && anyZ; + axesSets.forEach((axesSet) => { + if (!axesSet.x && !axesSet.y) + return; + const axesSetBounds = { + axesSet, + maxBoundsX: null, + maxBoundsY: null, + maxBoundsZ: null, + minBoundsX: null, + minBoundsY: null, + minBoundsZ: null + }; + if (is3d) { + const zBounds = getDomainBounds(1, axesSet.z); + axesSetBounds.minBoundsZ = -zBounds.maxBounds; + axesSetBounds.maxBoundsZ = -zBounds.minBounds; + } + const yBounds = getDomainBounds(1, axesSet.y); + axesSetBounds.minBoundsY = yBounds.minBounds; + axesSetBounds.maxBoundsY = yBounds.maxBounds; + axesSetBounds.y = yBounds.minBounds; + axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; + const xBounds = getDomainBounds(0, axesSet.x); + axesSetBounds.minBoundsX = xBounds.minBounds; + axesSetBounds.maxBoundsX = xBounds.maxBounds; + axesSetBounds.x = xBounds.minBounds; + axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; + allAxesSetBounds.push(axesSetBounds); + bounds2 = outerBounds(bounds2, axesSetBounds); + }); + const facetLabelX = labels.filter((label2) => label2.axisRole === "x")[0]; + const facetLabelY = labels.filter((label2) => label2.axisRole === "y")[0]; + core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { + const axesSet = axesSets[axes]; + let a2; + let f; + switch (axis) { + case 0: { + a2 = axesSet.x; + f = facetLabelX; + break; + } + case 1: { + a2 = axesSet.y; + f = facetLabelY; + break; + } + case 2: { + a2 = axesSet.z; + break; } - if (a) config.onTextClick(manipulator.event, a.title || f.title); - }; - allAxesSetBounds.forEach((axesSetBounds)=>{ - const { axesSet } = axesSetBounds; - if (!axesSet.x && !axesSet.y) return; - const cartesian = new (is3d ? (0, _morphcharts.Axes).Cartesian3dAxes : (0, _morphcharts.Axes).Cartesian2dAxes)(core); - cartesian.isDivisionPickingEnabled = [ - false, - false, - false - ]; - cartesian.arePickDivisionsVisible = [ - false, - false, - false - ]; - cartesian.isLabelPickingEnabled = [ - false, - false, - false - ]; - cartesian.isTitlePickingEnabled = [ - false, - false, - false - ]; - cartesian.isGridPickingEnabled = false; - cartesian.isHeadingPickingEnabled = [ - false, - false, - false - ]; - createAxes(cartesian, 0, 0, axesSet.x, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleX && facetLabelX); - createAxes(cartesian, 1, 1, axesSet.y, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleY && facetLabelY); - if (is3d) createAxes(cartesian, 1, 2, axesSet.z, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props); - configCartesianAxes(is3d, bounds, cartesian); - const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds; - const w = maxBoundsX - minBoundsX; - const h = maxBoundsY - minBoundsY; - cartesian.scalingX = axesSetBounds.w / w; - cartesian.scalingY = axesSetBounds.h / h; - cartesian.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w - 0.5; - cartesian.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h - 0.5; - const aspect = h / w; - if (aspect > 1) cartesian.offsetX /= aspect; - else cartesian.offsetY *= aspect; - const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian) : renderer.createCartesian2dAxesVisual(cartesian); - renderer.currentAxes.push(axes); - props.config.onAxesComplete && props.config.onAxesComplete(cartesian); + } + if (a2) { + config.onTextClick(manipulator.event, a2.title || f.title); + } + }; + allAxesSetBounds.forEach((axesSetBounds) => { + const { axesSet } = axesSetBounds; + if (!axesSet.x && !axesSet.y) + return; + const cartesian2 = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); + cartesian2.isDivisionPickingEnabled = [false, false, false]; + cartesian2.arePickDivisionsVisible = [false, false, false]; + cartesian2.isLabelPickingEnabled = [false, false, false]; + cartesian2.isTitlePickingEnabled = [false, false, false]; + cartesian2.isGridPickingEnabled = false; + cartesian2.isHeadingPickingEnabled = [false, false, false]; + createAxes(cartesian2, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleX && facetLabelX); + createAxes(cartesian2, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleY && facetLabelY); + if (is3d) { + createAxes(cartesian2, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height2, props); + } + configCartesianAxes(is3d, bounds2, cartesian2); + const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds2; + const w2 = maxBoundsX - minBoundsX; + const h2 = maxBoundsY - minBoundsY; + cartesian2.scalingX = axesSetBounds.w / w2; + cartesian2.scalingY = axesSetBounds.h / h2; + cartesian2.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w2 - 0.5; + cartesian2.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h2 - 0.5; + const aspect = h2 / w2; + if (aspect > 1) { + cartesian2.offsetX /= aspect; + } else { + cartesian2.offsetY *= aspect; + } + const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian2) : renderer.createCartesian2dAxesVisual(cartesian2); + renderer.currentAxes.push(axes); + props.config.onAxesComplete && props.config.onAxesComplete(cartesian2); }); - return { - bounds - }; -}; -const nullDomain = { - sourcePosition: [ - 0, - 0, - 0 - ], - targetPosition: [ - 0, - 0, - 0 - ] -}; -class AxesCorrelation { - constructor(stage, dimensions){ - this.dimensions = dimensions; - const { x, y, z } = stage.axes; - this.axesSets = []; - this.labels = []; - [ - x, - y, - z - ].forEach((axes)=>{ - axes.forEach((axis)=>{ - if (this.axesSets.length === 0) this.initialize(axis); - else this.correlate(axis); - }); + return { bounds: bounds2 }; + }; + const nullDomain = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0] + }; + class AxesCorrelation { + constructor(stage, dimensions) { + this.dimensions = dimensions; + const { x: x2, y: y2, z } = stage.axes; + this.axesSets = []; + this.labels = []; + [x2, y2, z].forEach((axes) => { + axes.forEach((axis) => { + if (this.axesSets.length === 0) { + this.initialize(axis); + } else { + this.correlate(axis); + } }); + }); } getGrid() { - const mapCols = {}; - const mapRows = {}; - this.axesSets.forEach((axesSet)=>{ - var _a; - const domain = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; - if (!domain) return; - const col = domain.sourcePosition[0].toString(); - const row = domain.sourcePosition[1].toString(); - if (!mapCols[col]) mapCols[col] = {}; - mapCols[col][row] = axesSet; - mapRows[row] = null; - }); - const colKeys = Object.keys(mapCols).sort((a, b)=>+a - +b); - const rowKeys = Object.keys(mapRows).sort((a, b)=>+a - +b); - return { - cols: colKeys.length, - rows: rowKeys.length, - byColumn: colKeys.map((colKey)=>rowKeys.map((rowKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })), - byRow: rowKeys.map((rowKey)=>colKeys.map((colKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })) - }; + const mapCols = {}; + const mapRows = {}; + this.axesSets.forEach((axesSet) => { + var _a; + const domain2 = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; + if (!domain2) + return; + const col = domain2.sourcePosition[0].toString(); + const row = domain2.sourcePosition[1].toString(); + if (!mapCols[col]) { + mapCols[col] = {}; + } + mapCols[col][row] = axesSet; + mapRows[row] = null; + }); + const colKeys = Object.keys(mapCols).sort((a2, b2) => +a2 - +b2); + const rowKeys = Object.keys(mapRows).sort((a2, b2) => +a2 - +b2); + return { + cols: colKeys.length, + rows: rowKeys.length, + byColumn: colKeys.map((colKey) => rowKeys.map((rowKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })), + byRow: rowKeys.map((rowKey) => colKeys.map((colKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })) + }; } initialize(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - const axesSet = {}; - axesSet[axis.axisRole] = axis; - this.axesSets.push(axesSet); + if (!axis.domain) { + this.labels.push(axis); + return; + } + const axesSet = {}; + axesSet[axis.axisRole] = axis; + this.axesSets.push(axesSet); } correlate(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - for(let i = 0; i < this.axesSets.length; i++){ - const axesSet = this.axesSets[i]; - for(const axisRole in axesSet){ - const test = axesSet[axisRole]; - if (this.matchDomains(axis.domain, test.domain)) { - //prefer the axes with titles - if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) axesSet[axis.axisRole] = axis; - return; - } + if (!axis.domain) { + this.labels.push(axis); + return; + } + for (let i = 0; i < this.axesSets.length; i++) { + const axesSet = this.axesSets[i]; + for (const axisRole in axesSet) { + const test2 = axesSet[axisRole]; + if (this.matchDomains(axis.domain, test2.domain)) { + if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) { + axesSet[axis.axisRole] = axis; } + return; + } } - this.initialize(axis); - } - matchDomains(a, b) { - if (this.matchPoint(a.sourcePosition, b.sourcePosition)) return true; - if (this.matchPoint(a.sourcePosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.sourcePosition)) return true; - return false; + } + this.initialize(axis); } - matchPoint(a, b) { - for(let i = 0; i < this.dimensions; i++){ - if (a[i] !== b[i]) return false; - } + matchDomains(a2, b2) { + if (this.matchPoint(a2.sourcePosition, b2.sourcePosition)) + return true; + if (this.matchPoint(a2.sourcePosition, b2.targetPosition)) return true; + if (this.matchPoint(a2.targetPosition, b2.targetPosition)) + return true; + if (this.matchPoint(a2.targetPosition, b2.sourcePosition)) + return true; + return false; + } + matchPoint(a2, b2) { + for (let i = 0; i < this.dimensions; i++) { + if (a2[i] !== b2[i]) + return false; + } + return true; } -} -function createAxes(cartesian, dim2d, dim3d, axis, orientation, height, props, facetLabel) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain, dim2d, height); - if (axis.axisRole === 'z') { - tickPositions.forEach((t, i)=>tickPositions[i] = 1 - t); - textPos.forEach((t, i)=>textPos[i] = 1 - t); - tickText.reverse(); - tickPositions.reverse(); - textPos.reverse(); - } - cartesian.setTickPositions(dim3d, tickPositions); - cartesian.zero[dim3d] = 0; //TODO get any "zero" gridline position from vega - cartesian.setLabelPositions(dim3d, textPos); - cartesian.setLabels(dim3d, tickText); - cartesian.setLabelSizes(dim3d, textSize); + } + function createAxes(cartesian2, dim2d, dim3d, axis, orientation, height2, props, facetLabel) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain2, dim2d, height2); + if (axis.axisRole === "z") { + tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); + textPos.forEach((t, i) => textPos[i] = 1 - t); + tickText.reverse(); + tickPositions.reverse(); + textPos.reverse(); + } + cartesian2.setTickPositions(dim3d, tickPositions); + cartesian2.zero[dim3d] = 0; + cartesian2.setLabelPositions(dim3d, textPos); + cartesian2.setLabels(dim3d, tickText); + cartesian2.setLabelSizes(dim3d, textSize); const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); if (title === null || title === void 0 ? void 0 : title.text) { - cartesian.setTitle(dim3d, title.text); - cartesian.setTitleSize(dim3d, title.size / height); + cartesian2.setTitle(dim3d, title.text); + cartesian2.setTitleSize(dim3d, title.size / height2); } - cartesian.setLabelOrientation(dim3d, orientation); - props.config.onAxisConfig && props.config.onAxisConfig(cartesian, dim3d, axis); + cartesian2.setLabelOrientation(dim3d, orientation); + props.config.onAxisConfig && props.config.onAxisConfig(cartesian2, dim3d, axis); return { - tickText - }; -} -function configCartesianAxes(is3d, bounds, cartesian) { - if (is3d) cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topBack] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).backRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).bottomRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).frontRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topFront] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topRight] = false; - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - cartesian.minBoundsX = minBoundsX; - cartesian.maxBoundsX = maxBoundsX; - cartesian.minBoundsY = minBoundsY; - cartesian.maxBoundsY = maxBoundsY; + tickText + }; + } + function configCartesianAxes(is3d, bounds2, cartesian2) { + if (is3d) { + cartesian2.isEdgeVisible[Edge3D.topBack] = false; + } + cartesian2.isEdgeVisible[Edge3D.backRight] = false; + cartesian2.isEdgeVisible[Edge3D.bottomRight] = false; + cartesian2.isEdgeVisible[Edge3D.frontRight] = false; + cartesian2.isEdgeVisible[Edge3D.topFront] = false; + cartesian2.isEdgeVisible[Edge3D.topRight] = false; + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; + cartesian2.minBoundsX = minBoundsX; + cartesian2.maxBoundsX = maxBoundsX; + cartesian2.minBoundsY = minBoundsY; + cartesian2.maxBoundsY = maxBoundsY; if (is3d) { - cartesian.minBoundsZ = minBoundsZ; - cartesian.maxBoundsZ = maxBoundsZ; - } -} -function getDomainBounds(dim2d, axis) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const minBounds = domain.sourcePosition[dim2d]; - const maxBounds = domain.targetPosition[dim2d]; + cartesian2.minBoundsZ = minBoundsZ; + cartesian2.maxBoundsZ = maxBoundsZ; + } + } + function getDomainBounds(dim2d, axis) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const minBounds = domain2.sourcePosition[dim2d]; + const maxBounds = domain2.targetPosition[dim2d]; return { - maxBounds, - minBounds - }; -} -function convertAxis(axis, domain, dim, height) { - const start = domain.sourcePosition[dim]; - const span = domain.targetPosition[dim] - start; - const tickPositions = axis ? axis.ticks.map((t)=>(t.sourcePosition[dim] - start) / span) : []; - const tickText = axis ? axis.tickText.map((t)=>t.text) : []; - const textPos = axis ? axis.tickText.map((t)=>(t.position[dim] - start) / span) : []; - const textSize = axis ? axis.tickText.map((t)=>t.size / height) : []; + maxBounds, + minBounds + }; + } + function convertAxis(axis, domain2, dim, height2) { + const start = domain2.sourcePosition[dim]; + const span2 = domain2.targetPosition[dim] - start; + const tickPositions = axis ? axis.ticks.map((t) => (t.sourcePosition[dim] - start) / span2) : []; + const tickText = axis ? axis.tickText.map((t) => t.text) : []; + const textPos = axis ? axis.tickText.map((t) => (t.position[dim] - start) / span2) : []; + const textSize = axis ? axis.tickText.map((t) => t.size / height2) : []; if (tickPositions.length) { - if (tickPositions[0] !== 0) tickPositions[0] = 0; - if (tickPositions[tickPositions.length - 1] !== 1) tickPositions[tickPositions.length - 1] = 1; + if (tickPositions[0] !== 0) { + tickPositions[0] = 0; + } + if (tickPositions[tickPositions.length - 1] !== 1) { + tickPositions[tickPositions.length - 1] = 1; + } } return { - tickPositions, - tickText, - textPos, - textSize - }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jYVLQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "outerBounds", ()=>outerBounds); -parcelHelpers.export(exports, "increment", ()=>increment); -function outerBounds(b1, b2) { - if (!b1 && !b2) return; - if (!b1) return b2; - if (!b2) return b1; - const minProps = [ - 'minBoundsX', - 'minBoundsY', - 'minBoundsZ' - ]; - const maxProps = [ - 'maxBoundsX', - 'maxBoundsY', - 'maxBoundsZ' - ]; - const result = {}; - minProps.forEach((p)=>result[p] = notNull(Math.min, b1[p], b2[p])); - maxProps.forEach((p)=>result[p] = notNull(Math.max, b1[p], b2[p])); - return result; -} -function notNull(fn, v1, v2) { - if (v1 == null && v2 == null) return null; - if (v1 == null) return v2; - if (v2 == null) return v1; - return fn(v1, v2); -} -function increment(b, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { - return outerBounds(b, { - minBoundsX, - minBoundsY, - minBoundsZ, - maxBoundsX, - maxBoundsY, - maxBoundsZ - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fl32M":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createCubeLayer", ()=>createCubeLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'cube'; -const createCubeLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const scatter = new (0, _morphcharts.Layouts).Scatter(core); - const { ids, colors, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds, maxColor, palette } = convert(stage); - if (!ids.length) return; + tickPositions, + tickText, + textPos, + textSize + }; + } + class ColorMap { + constructor(quant = 5) { + this.quant = quant; + this.colorMap = {}; + this.colorArray = []; + } + getColorKey(rgbaColor) { + const color2 = rgbaColor.slice(0, 3).map((e) => Math.floor(e / this.quant) * this.quant); + color2[3] = rgbaColor[3]; + return JSON.stringify(color2); + } + registerColor(rgbaColor) { + const colorKey = this.getColorKey(rgbaColor); + if (!this.colorMap[colorKey]) { + this.colorMap[colorKey] = { + index: this.colorArray.length, + rgbaColor + }; + this.colorArray.push(rgbaColor); + } + return this.colorMap[colorKey].index; + } + getPalette() { + return { + palette: new Uint8Array(this.colorArray.flat()), + maxColor: this.colorArray.length - 1 + }; + } + } + function convert$3(newColor) { + const c2 = colorFromString(newColor).slice(0, 3); + return c2.map((v) => v / 255); + } + function colorConfig(ref2, colors2) { + if (!colors2) + return; + const { config } = ref2.core; + config.activeColor = convert$3(colors2.activeItemColor); + config.backgroundColor = new Float32Array(convert$3(colors2.backgroundColor)); + config.textColor = convert$3(colors2.textColor); + config.textBorderColor = convert$3(colors2.textBorderColor); + config.axesTextColor = convert$3(colors2.axesTextLabelColor); + config.axesGridBackgroundColor = convert$3(colors2.axesGridBackgroundColor); + config.axesGridHighlightColor = convert$3(colors2.axesGridHighlightColor); + config.axesGridMinorColor = convert$3(colors2.axesGridMinorColor); + config.axesGridMajorColor = convert$3(colors2.axesGridMajorColor); + config.axesGridZeroColor = convert$3(colors2.axesGridZeroColor); + ref2.core.renderer["_theme"] = null; + } + const key$1 = "cube"; + const createCubeLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const scatter = new Scatter(core); + const { ids, colors: colors2, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds: bounds2, maxColor, palette } = convert$2(stage); + if (!ids.length) + return; const { renderer } = core; - let cubeTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let cubeTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$1); if (!cubeTransitionBuffer) { - cubeTransitionBuffer = renderer.createTransitionBuffer(ids); - cubeTransitionBuffer.key = key; - renderer.transitionBuffers.push(cubeTransitionBuffer); - } else cubeTransitionBuffer.swap(); + cubeTransitionBuffer = renderer.createTransitionBuffer(ids); + cubeTransitionBuffer.key = key$1; + renderer.transitionBuffers.push(cubeTransitionBuffer); + } else { + cubeTransitionBuffer.swap(); + } scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { - positionsX, - positionsY, - positionsZ + positionsX, + positionsY, + positionsZ }); const layer = { - positionsX, - positionsY, - positionsZ, - update: (newBounds, selected, stagger)=>{ - const { colors, maxColor, minColor, palette } = layer.unitColorMap; - // reference off of core.renderer to get the actual buffer - const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - currCubeTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).block; - currCubeTransitionBuffer.currentPalette.colors = palette; - let options = Object.assign({ - selected, - colors, - minColor, - maxColor, - sizesX, - sizesY, - sizesZ - }, newBounds); - if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { - const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; - options = Object.assign(Object.assign({}, options), { - maxStaggerOrder, - minStaggerOrder, - staggerOrders - }); - } - scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); - }, - bounds, - unitColorMap: { - colors, - ids, - minColor: 0, - maxColor, - palette - } + positionsX, + positionsY, + positionsZ, + update: (newBounds, selected, stagger) => { + const { colors: colors3, maxColor: maxColor2, minColor, palette: palette2 } = layer.unitColorMap; + const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$1); + currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; + currCubeTransitionBuffer.currentPalette.colors = palette2; + let options = Object.assign({ + selected, + colors: colors3, + minColor, + maxColor: maxColor2, + sizesX, + sizesY, + sizesZ + }, newBounds); + if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { + const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; + options = Object.assign(Object.assign({}, options), { + maxStaggerOrder, + minStaggerOrder, + staggerOrders + }); + } + scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); + }, + bounds: bounds2, + unitColorMap: { + colors: colors2, + ids, + minColor: 0, + maxColor, + palette + } }; return layer; -}; -function convert(stage) { + }; + function convert$2(stage) { const { cubeData } = stage; - const { length } = cubeData; + const { length: length2 } = cubeData; const ids = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizesX = new Float64Array(length); - const sizesY = new Float64Array(length); - const sizesZ = new Float64Array(length); - let bounds; - const colorMap = new (0, _color.ColorMap)(); - cubeData.forEach((cube, i)=>{ - ids.push(i); - if (cube.isEmpty) { - positionsX[i] = 0; - positionsY[i] = 0; - positionsZ[i] = 0; - sizesX[i] = 0; - sizesY[i] = 0; - sizesZ[i] = 0; - colors[i] = 0; - } else { - //ids.push(cube.ordinal); - positionsX[i] = cube.position[0] + cube.size[0] * 0.5; - positionsY[i] = cube.position[1] + cube.size[1] * 0.5; - positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; - sizesX[i] = cube.size[0]; - sizesY[i] = cube.size[1]; - sizesZ[i] = cube.size[2]; - bounds = (0, _bounds.increment)(bounds, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); - colors[i] = colorMap.registerColor(cube.color); - } + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizesX = new Float64Array(length2); + const sizesY = new Float64Array(length2); + const sizesZ = new Float64Array(length2); + let bounds2; + const colorMap = new ColorMap(); + cubeData.forEach((cube, i) => { + ids.push(i); + if (cube.isEmpty) { + positionsX[i] = 0; + positionsY[i] = 0; + positionsZ[i] = 0; + sizesX[i] = 0; + sizesY[i] = 0; + sizesZ[i] = 0; + colors2[i] = 0; + } else { + positionsX[i] = cube.position[0] + cube.size[0] * 0.5; + positionsY[i] = cube.position[1] + cube.size[1] * 0.5; + positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; + sizesX[i] = cube.size[0]; + sizesY[i] = cube.size[1]; + sizesZ[i] = cube.size[2]; + bounds2 = increment(bounds2, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); + colors2[i] = colorMap.registerColor(cube.color); + } }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizesX, - sizesY, - sizesZ, - bounds, - maxColor, - palette + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizesX, + sizesY, + sizesZ, + bounds: bounds2, + maxColor, + palette }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","./color":"cLUpV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cLUpV":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorMap", ()=>ColorMap); -parcelHelpers.export(exports, "colorConfig", ()=>colorConfig); -var _color = require("../color"); -class ColorMap { - constructor(quant = 5){ - this.quant = quant; - this.colorMap = {}; - this.colorArray = []; - } - getColorKey(rgbaColor) { - const color = rgbaColor.slice(0, 3).map((e)=>Math.floor(e / this.quant) * this.quant); - color[3] = rgbaColor[3]; //retain alpha - return JSON.stringify(color); - } - registerColor(rgbaColor) { - const colorKey = this.getColorKey(rgbaColor); - if (!this.colorMap[colorKey]) { - this.colorMap[colorKey] = { - index: this.colorArray.length, - rgbaColor - }; - this.colorArray.push(rgbaColor); - } - return this.colorMap[colorKey].index; - } - getPalette() { - return { - palette: new Uint8Array(this.colorArray.flat()), - maxColor: this.colorArray.length - 1 - }; - } -} -function convert(newColor) { - const c = (0, _color.colorFromString)(newColor).slice(0, 3); - return c.map((v)=>v / 255); -} -function colorConfig(ref, colors) { - if (!colors) return; - const { config } = ref.core; - config.activeColor = convert(colors.activeItemColor); - config.backgroundColor = new Float32Array(convert(colors.backgroundColor)); - config.textColor = convert(colors.textColor); - config.textBorderColor = convert(colors.textBorderColor); - config.axesTextColor = convert(colors.axesTextLabelColor); - config.axesGridBackgroundColor = convert(colors.axesGridBackgroundColor); - config.axesGridHighlightColor = convert(colors.axesGridHighlightColor); - config.axesGridMinorColor = convert(colors.axesGridMinorColor); - config.axesGridMajorColor = convert(colors.axesGridMajorColor); - config.axesGridZeroColor = convert(colors.axesGridZeroColor); - //TODO fix this - hack to reset the background color - ref.core.renderer['_theme'] = null; -} - -},{"../color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3egUA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createLineLayer", ()=>createLineLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'line'; -const createLineLayer = (props)=>{ - const { height, ref, stage, width } = props; - const { core } = ref; - const lines = new (0, _morphcharts.Layouts).Line(core); - const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert(stage, height, width); - if (!ids.length) return; + } + const key = "line"; + const createLineLayer = (props) => { + const { height: height2, ref: ref2, stage } = props; + const { core } = ref2; + const lines = new Line(core); + const { ids, fromIds, toIds, lineColors, lineSizes, bounds: bounds2, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert$1(stage, height2); + if (!ids.length) + return; const { renderer } = core; - let lineTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let lineTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key); if (!lineTransitionBuffer) { - lineTransitionBuffer = renderer.createTransitionBuffer(ids); - lineTransitionBuffer.key = key; - renderer.transitionBuffers.push(lineTransitionBuffer); - } else lineTransitionBuffer.swap(); + lineTransitionBuffer = renderer.createTransitionBuffer(ids); + lineTransitionBuffer.key = key; + renderer.transitionBuffers.push(lineTransitionBuffer); + } else { + lineTransitionBuffer.swap(); + } lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { - positionsX, - positionsY, - positionsZ, - lineSizes, - sizeScaling: 1 + positionsX, + positionsY, + positionsZ, + lineSizes, + sizeScaling: 1 }); let options = { - lineColors, - lineMinColor: 0, - lineMaxColor + lineColors, + lineMinColor: 0, + lineMaxColor }; - // Unit type - lineTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).cylinder; + lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; lineTransitionBuffer.currentPalette.colors = palette; return { - update: (newBounds)=>{ - options = Object.assign(Object.assign({}, options), newBounds); - // reference off of core.renderer to get the actual buffer - const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); - }, - bounds, - unitColorMap: { - ids, - colors: lineColors, - minColor: 0, - maxColor: lineMaxColor, - palette - } + update: (newBounds) => { + options = Object.assign(Object.assign({}, options), newBounds); + const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key); + lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); + }, + bounds: bounds2, + unitColorMap: { + ids, + colors: lineColors, + minColor: 0, + maxColor: lineMaxColor, + palette + } }; -}; -function convert(stage, height, width) { + }; + function convert$1(stage, height2, width2) { const { pathData } = stage; const positions = []; const lines = []; - const colorMap = new (0, _color.ColorMap)(); - pathData.forEach((path)=>{ - const color = colorMap.registerColor(path.strokeColor); - let from = positions.length; - positions.push(path.positions[0]); - for(let i = 1; i < path.positions.length; i++){ - const to = positions.length; - positions.push(path.positions[i]); - lines.push({ - id: lines.length, - from, - to, - color, - size: path.strokeWidth - }); - from = to; - } + const colorMap = new ColorMap(); + pathData.forEach((path2) => { + const color2 = colorMap.registerColor(path2.strokeColor); + let from = positions.length; + positions.push(path2.positions[0]); + for (let i = 1; i < path2.positions.length; i++) { + const to = positions.length; + positions.push(path2.positions[i]); + lines.push({ + id: lines.length, + from, + to, + color: color2, + size: path2.strokeWidth + }); + from = to; + } }); const ids = new Uint32Array(lines.length); const fromIds = new Uint32Array(lines.length); const toIds = new Uint32Array(lines.length); const lineColors = new Float64Array(lines.length); const lineSizes = new Float64Array(lines.length); - lines.forEach((line, i)=>{ - ids[i] = i; - fromIds[i] = line.from; - toIds[i] = line.to; - lineColors[i] = line.color; - lineSizes[i] = line.size; + lines.forEach((line2, i) => { + ids[i] = i; + fromIds[i] = line2.from; + toIds[i] = line2.to; + lineColors[i] = line2.color; + lineSizes[i] = line2.size; }); const positionsX = new Float64Array(positions.length); const positionsY = new Float64Array(positions.length); const positionsZ = new Float64Array(positions.length); - let bounds; - positions.forEach((p, i)=>{ - positionsX[i] = p[0]; - positionsY[i] = p[1] + height; - positionsZ[i] = p[2]; - bounds = (0, _bounds.increment)(bounds, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); + let bounds2; + positions.forEach((p, i) => { + positionsX[i] = p[0]; + positionsY[i] = p[1] + height2; + positionsZ[i] = p[2]; + bounds2 = increment(bounds2, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); }); const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); return { - ids, - fromIds, - toIds, - lineColors, - lineSizes, - bounds, - positionsX, - positionsY, - positionsZ, - lineMaxColor, - palette + ids, + fromIds, + toIds, + lineColors, + lineSizes, + bounds: bounds2, + positionsX, + positionsY, + positionsZ, + lineMaxColor, + palette }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","./color":"cLUpV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6GPxW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createTextLayer", ()=>createTextLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const createTextLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const { positionsX, positionsY, positionsZ, sizes, bounds, maxGlyphs, text } = convert(stage); - if (text.length === 0) { - core.renderer.labelSets = []; - return; + } + const createTextLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const { positionsX, positionsY, positionsZ, sizes, bounds: bounds2, maxGlyphs, text: text2 } = convert(stage); + if (text2.length === 0) { + core.renderer.labelSets = []; + return; } const options = { - text, - maxGlyphs, - scales: sizes + text: text2, + maxGlyphs, + scales: sizes }; - const labelSet = new (0, _morphcharts.Components).LabelSet(core, options); + const labelSet = new LabelSet(core, options); labelSet.positionsX = positionsX; labelSet.positionsY = positionsY; labelSet.positionsZ = positionsZ; - labelSet.horizontalAlignment = (0, _morphcharts.HorizontalAlignment).center; - labelSet.verticalAlignment = (0, _morphcharts.VerticalAlignment).center; + labelSet.horizontalAlignment = HorizontalAlignment.center; + labelSet.verticalAlignment = VerticalAlignment.center; const layer = { - update: (bounds)=>{ - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - }, - bounds + update: (bounds3) => { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds3; + labelSet.minBoundsX = minBoundsX; + labelSet.minBoundsY = minBoundsY; + labelSet.minBoundsZ = minBoundsZ; + labelSet.maxBoundsX = maxBoundsX; + labelSet.maxBoundsY = maxBoundsY; + labelSet.maxBoundsZ = maxBoundsZ; + }, + bounds: bounds2 }; const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); - core.renderer.labelSets = [ - labelSetVisual - ]; + core.renderer.labelSets = [labelSetVisual]; return layer; -}; -function convert(stage) { + }; + function convert(stage) { const { textData } = stage; - const { length } = textData; + const { length: length2 } = textData; const ids = []; - const text = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizes = new Float64Array(length); - let bounds; + const text2 = []; + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizes = new Float64Array(length2); + let bounds2; let maxGlyphs = 0; - const colorMap = new (0, _color.ColorMap)(); - textData.forEach((t, i)=>{ - ids.push(i); - text.push(t.text); - maxGlyphs += t.text.length; - positionsX[i] = t.position[0]; - positionsY[i] = t.position[1]; - positionsZ[i] = t.position[2]; - sizes[i] = 1.5 * t.size; //scale similar to axes - bounds = (0, _bounds.increment)(bounds, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); - colors[i] = colorMap.registerColor(t.color); + const colorMap = new ColorMap(); + textData.forEach((t, i) => { + ids.push(i); + text2.push(t.text); + maxGlyphs += t.text.length; + positionsX[i] = t.position[0]; + positionsY[i] = t.position[1]; + positionsZ[i] = t.position[2]; + sizes[i] = 1.5 * t.size; + bounds2 = increment(bounds2, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); + colors2[i] = colorMap.registerColor(t.color); }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizes, - bounds, - maxColor, - maxGlyphs, - palette, - text - }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","./color":"cLUpV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cic5g":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getImageData", ()=>getImageData); -parcelHelpers.export(exports, "createImageQuad", ()=>createImageQuad); -var _morphcharts = require("morphcharts"); -function getImageData(url) { - return new Promise((resolve, reject)=>{ - const imageElement = document.createElement('img'); - imageElement.onload = ()=>{ - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - const { height, width } = imageElement; - canvas.width = width; - canvas.height = height; - ctx.drawImage(imageElement, 0, 0); - resolve(ctx.getImageData(0, 0, width, height)); - }; - imageElement.src = url; + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizes, + bounds: bounds2, + maxColor, + maxGlyphs, + palette, + text: text2 + }; + } + function getImageData(url) { + return new Promise((resolve2, reject) => { + const imageElement = document.createElement("img"); + imageElement.onload = () => { + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext("2d"); + const { height: height2, width: width2 } = imageElement; + canvas.width = width2; + canvas.height = height2; + ctx.drawImage(imageElement, 0, 0); + resolve2(ctx.getImageData(0, 0, width2, height2)); + }; + imageElement.src = url; }); -} -function createImageQuad(core, imageData, bounds, position, width, height) { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + } + function createImageQuad(core, imageData, bounds2, position2, width2, height2) { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; const imageOptions = { - imageData, - position, - height, - width, - minBoundsX, - maxBoundsX, - minBoundsZ, - maxBoundsZ, - minBoundsY, - maxBoundsY - }; - return new (0, _morphcharts.Components).ImageQuad(core, imageOptions); -} - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e8nEW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cameraDefaults", ()=>cameraDefaults); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -function createCameraDefaults() { - const qModelRotation2d = (0, _glMatrix.quat).create(); - const qModelRotation3d = (0, _morphcharts.Constants).QUAT_ROTATEX_MINUS_90; - const qCameraRotation2d = (0, _glMatrix.quat).create(); - const qCameraRotation3d = (0, _glMatrix.quat).create(); - const qAngle = (0, _glMatrix.quat).create(); - const vCameraPosition = (0, _glMatrix.vec3).create(); - // Altitude (pitch around local right axis) - (0, _glMatrix.quat).setAxisAngle(qCameraRotation3d, (0, _morphcharts.Constants).VECTOR3_UNITX, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(30)); - // Azimuth (yaw around global up axis) - (0, _glMatrix.quat).setAxisAngle(qAngle, (0, _morphcharts.Constants).VECTOR3_UNITY, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(-25)); - (0, _glMatrix.quat).multiply(qCameraRotation3d, qCameraRotation3d, qAngle); + imageData, + position: position2, + height: height2, + width: width2, + minBoundsX, + maxBoundsX, + minBoundsZ, + maxBoundsZ, + minBoundsY, + maxBoundsY + }; + return new ImageQuad(core, imageOptions); + } + function createCameraDefaults() { + const qModelRotation2d2 = create$1(); + const qModelRotation3d2 = Constants.QUAT_ROTATEX_MINUS_90; + const qCameraRotation2d2 = create$1(); + const qCameraRotation3d2 = create$1(); + const qAngle = create$1(); + const vCameraPosition2 = create$3(); + setAxisAngle(qCameraRotation3d2, Constants.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); + setAxisAngle(qAngle, Constants.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); + multiply(qCameraRotation3d2, qCameraRotation3d2, qAngle); return { - qModelRotation2d, - qModelRotation3d, - qCameraRotation2d, - qCameraRotation3d, - vCameraPosition - }; -} -const cameraDefaults = createCameraDefaults(); - -},{"gl-matrix":"erHGu","morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fuwxM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applyCameraCallbacks", ()=>applyCameraCallbacks); -parcelHelpers.export(exports, "setTransitionTimeAxesVisibility", ()=>setTransitionTimeAxesVisibility); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -var _defaults = require("./defaults"); -const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults.cameraDefaults); -function applyCameraCallbacks(ref, lastPresenterConfig, lastView, transistion2dOnly) { - const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref; - ref.reset = ()=>{ - core.reset(true); - if (lastView === '3d') { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = qCameraRotation3d; - cameraTransitioner.vPosition.to = vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = qCameraRotation2d; - cameraTransitioner.vPosition.to = vCameraPosition; - } - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); - core.setModelRotation(modelTransitioner.qRotation.current, true); - core.camera.setOrbit(cameraTransitioner.qRotation.to, true); - core.camera.setPosition(cameraTransitioner.vPosition.to, true); - }; - const cam = (t)=>{ - (0, _glMatrix.quat).slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); - (0, _glMatrix.vec3).lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); - core.camera.setOrbit(cameraTransitioner.qRotation.current, false); - core.camera.setPosition(cameraTransitioner.vPosition.current, false); - // disable picking during transitions, as the performance degradation could reduce the framerate - core.inputManager.isPickingEnabled = false; - }; - core.updateCallback = (elapsedTime)=>{ - const { transitionDurations } = lastPresenterConfig; - if (positionTransitioner.isTransitioning) { - const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); - core.renderer.transitionTime = t; - setTransitionTimeAxesVisibility(transistion2dOnly, core); - } else core.inputManager.isPickingEnabled = true; - if (modelTransitioner.isTransitioning) { - const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); - if (modelTransitioner.shouldTransition) { - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); - core.setModelRotation(modelTransitioner.qRotation.current, false); - } - cam(tm); - } - if (cameraTransitioner.isTransitioning) { - const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); - cam(t); + qModelRotation2d: qModelRotation2d2, + qModelRotation3d: qModelRotation3d2, + qCameraRotation2d: qCameraRotation2d2, + qCameraRotation3d: qCameraRotation3d2, + vCameraPosition: vCameraPosition2 + }; + } + const cameraDefaults = createCameraDefaults(); + const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + function applyCameraCallbacks(ref2, lastPresenterConfig, lastView, transistion2dOnly) { + const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref2; + ref2.reset = () => { + core.reset(true); + if (lastView === "3d") { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = qCameraRotation3d; + cameraTransitioner.vPosition.to = vCameraPosition; + } else { + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = qCameraRotation2d; + cameraTransitioner.vPosition.to = vCameraPosition; + } + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); + core.setModelRotation(modelTransitioner.qRotation.current, true); + core.camera.setOrbit(cameraTransitioner.qRotation.to, true); + core.camera.setPosition(cameraTransitioner.vPosition.to, true); + }; + const cam = (t) => { + slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); + lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); + core.camera.setOrbit(cameraTransitioner.qRotation.current, false); + core.camera.setPosition(cameraTransitioner.vPosition.current, false); + core.inputManager.isPickingEnabled = false; + }; + core.updateCallback = (elapsedTime) => { + const { transitionDurations } = lastPresenterConfig; + if (positionTransitioner.isTransitioning) { + const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); + core.renderer.transitionTime = t; + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } else { + core.inputManager.isPickingEnabled = true; + } + if (modelTransitioner.isTransitioning) { + const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); + if (modelTransitioner.shouldTransition) { + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); + core.setModelRotation(modelTransitioner.qRotation.current, false); } + cam(tm); + } + if (cameraTransitioner.isTransitioning) { + const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); + cam(t); + } }; -} -function setTransitionTimeAxesVisibility(transistion2dOnly, core) { + } + function setTransitionTimeAxesVisibility(transistion2dOnly, core) { const t = core.renderer.transitionTime; if (transistion2dOnly) { - if (t < 0.5) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + if (t < 0.5) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else { + core.renderer.axesVisibility = AxesVisibility.current; + } } else { - if (t <= 0.01) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else if (t >= 0.99) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - } -} - -},{"gl-matrix":"erHGu","morphcharts":"lF8Ji","./defaults":"e8nEW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gSXAZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "init", ()=>init); -var _morphcharts = require("morphcharts"); -var _renderer = require("./renderer"); -var _canvas = require("./canvas"); -var _transition = require("../transition"); -function init(options, mcRendererOptions) { - const { container } = options; - const core = new (0, _morphcharts.Core)({ - container + if (t <= 0.01) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else if (t >= 0.99) { + core.renderer.axesVisibility = AxesVisibility.current; + } else { + core.renderer.axesVisibility = AxesVisibility.none; + } + } + } + function morphChartsRender(ref2, prevStage, stage, height2, width2, preStage, colors2, config) { + const { qCameraRotation2d: qCameraRotation2d2, qCameraRotation3d: qCameraRotation3d2, qModelRotation2d: qModelRotation2d2, qModelRotation3d: qModelRotation3d2, vCameraPosition: vCameraPosition2 } = cameraDefaults; + const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref2; + let transistion2dOnly = false; + let cameraTo; + let holdCamera; + if (config.camera === "hold") { + holdCamera = true; + } else { + cameraTo = config.camera; + } + if (prevStage && prevStage.view !== stage.view) { + modelTransitioner.shouldTransition = !holdCamera; + if (stage.view === "2d") { + modelTransitioner.qRotation.from = qModelRotation3d2; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.from = qModelRotation2d2; + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } + } else { + modelTransitioner.shouldTransition = false; + if (stage.view === "2d") { + transistion2dOnly = true; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } + } + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + if (!prevStage) { + core.setModelRotation(modelTransitioner.qRotation.to, false); + core.camera.setOrbit(cameraTransitioner.qRotation.to, false); + core.camera.setPosition(cameraTransitioner.vPosition.to, false); + } else if (!holdCamera) { + cameraTransitioner.begin(); + } + positionTransitioner.begin(); + if (modelTransitioner.shouldTransition) { + modelTransitioner.begin(); + } + const props = { ref: ref2, stage, height: height2, config }; + const cubeLayer = createCubeLayer(props); + const lineLayer = createLineLayer(props); + const textLayer = createTextLayer(props); + const { backgroundImages } = stage; + let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); + backgroundImages === null || backgroundImages === void 0 ? void 0 : backgroundImages.forEach((backgroundImage) => { + contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); }); - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - core.config.pickSelectDelay = 50; - const cameraTransitioner = new (0, _transition.CameraTransitioner)(); - const modelTransitioner = new (0, _transition.ModelTransitioner)(); - const positionTransitioner = new (0, _transition.Transitioner)(); - positionTransitioner.ended = ()=>{ - core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - }; - const ref = { - supportedRenders: { - advanced: (0, _renderer.rendererEnabled)(true), - basic: (0, _renderer.rendererEnabled)(false) - }, - reset: null, - cameraTransitioner, - modelTransitioner, - positionTransitioner, - core, - setMorphChartsRendererOptions (mcRendererOptions) { - if ((0, _renderer.shouldChangeRenderer)(ref.lastMorphChartsRendererOptions, mcRendererOptions)) { - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - } else if (mcRendererOptions.advanced) //same renderer, poke the config - (0, _renderer.setRendererOptions)(core.renderer, mcRendererOptions); - ref.lastMorphChartsRendererOptions = mcRendererOptions; - }, - lastMorphChartsRendererOptions: mcRendererOptions, - layerStagger: {} - }; - return ref; -} - -},{"morphcharts":"lF8Ji","./renderer":"hCMuN","./canvas":"baSAp","../transition":"aaeTK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hCMuN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shouldChangeRenderer", ()=>shouldChangeRenderer); -parcelHelpers.export(exports, "getRenderer", ()=>getRenderer); -parcelHelpers.export(exports, "setRendererOptions", ()=>setRendererOptions); -parcelHelpers.export(exports, "rendererEnabled", ()=>rendererEnabled); -var _morphcharts = require("morphcharts"); -function shouldChangeRenderer(prev, next) { + props.bounds = contentBounds; + core.renderer.previousAxes = core.renderer.currentAxes; + const axesLayer = createAxesLayer(props); + core.config.transitionStaggering = config.transitionDurations.stagger; + core.config.transitionDuration = config.transitionDurations.position; + let bounds2; + if (axesLayer && axesLayer.bounds) { + bounds2 = axesLayer.bounds; + } else { + bounds2 = contentBounds; + } + ref2.setMorphChartsRendererOptions(config.renderer); + if (preStage) { + preStage(stage, cubeLayer); + } + core.renderer.images = []; + if (backgroundImages) { + const addImage = (imageBounds, imageData) => { + const imageWidth2 = imageBounds.maxBoundsX - imageBounds.minBoundsX; + const imageHeight2 = imageBounds.maxBoundsY - imageBounds.minBoundsY; + const position2 = [imageBounds.minBoundsX + imageWidth2 / 2, imageBounds.minBoundsY + imageHeight2 / 2, 0]; + const imageQuad = createImageQuad(core, imageData, contentBounds, position2, imageWidth2, imageHeight2); + const imageVisual = core.renderer.createImageVisual(imageQuad); + core.renderer.images.push(imageVisual); + }; + const imageDataCache = {}; + backgroundImages.forEach((backgroundImage) => { + const imageBounds = convertBounds(backgroundImage.bounds); + const imageData = imageDataCache[backgroundImage.url]; + if (imageData) { + addImage(imageBounds, imageData); + } else { + getImageData(backgroundImage.url).then((imageData2) => { + imageDataCache[backgroundImage.url] = imageData2; + addImage(imageBounds, imageData2); + }); + } + }); + } + layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds2, ref2.layerStagger); + applyCameraCallbacks(ref2, config, stage.view, transistion2dOnly); + core.renderer.transitionTime = 0; + colorConfig(ref2, colors2); + return { + bounds: bounds2, + getCubeLayer: () => cubeLayer, + update: (layerSelection) => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, ref2.layerStagger), + activate: (id2) => core.renderer.transitionBuffers[0].activeId = id2, + moveCamera: (camera) => { + if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + cameraTransitioner.move(camera.position, camera.rotation); + } + }, + setTransitionTimeAxesVisibility: () => { + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } + }; + } + function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, layerStagger) { + const layerItems = [ + { + layer: cubeLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes + }, + { + layer: lineLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines + }, + { + layer: textLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts + } + ]; + layerItems.forEach((layerItem) => { + var _a; + return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds2, layerItem.selection, layerItem.stagger); + }); + } + function convertBounds(bounds2) { + if (!bounds2) + return; + return { + minBoundsX: bounds2.x1, + maxBoundsX: bounds2.x2, + minBoundsY: -bounds2.y2, + maxBoundsY: -bounds2.y1, + minBoundsZ: minZ, + maxBoundsZ: minZ + }; + } + function shouldChangeRenderer(prev, next) { var _a, _b; - if (!prev || !next) return true; - if (prev.advanced !== next.advanced) return true; - if (!prev.advanced) return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); -} -function getRenderer(mcRendererOptions, core) { + if (!prev || !next) + return true; + if (prev.advanced !== next.advanced) + return true; + if (!prev.advanced) { + return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); + } + } + function getRenderer(mcRendererOptions, core) { const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); + const r = advanced ? new Main() : new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); core.renderer = r; setRendererOptions(r, mcRendererOptions); return r; -} -function setRendererOptions(renderer, mcRendererOptions) { + } + function setRendererOptions(renderer, mcRendererOptions) { const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; - if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) for(const key in o)renderer.config[key] = o[key]; -} -function rendererEnabled(advanced) { - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(); + if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) { + for (const key2 in o) { + renderer.config[key2] = o[key2]; + } + } + } + function rendererEnabled(advanced) { + const r = advanced ? new Main() : new Main$1(); return r.isSupported; -} - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"baSAp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "listenCanvasEvents", ()=>listenCanvasEvents); -var _morphcharts = require("morphcharts"); -const rightButton = 2; -function listenCanvasEvents(core, options) { + } + const rightButton = 2; + function listenCanvasEvents(core, options) { const { container, pickGridCallback } = options; const { inputManager } = core; - if (options.onLasso) inputManager.pickLassoCallback = (result)=>{ + if (options.onLasso) { + inputManager.pickLassoCallback = (result) => { options.onLasso(result.ids[0], result.manipulator.event); + }; + } + inputManager.singleTouchAction = (manipulator) => { + if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.rotate; + } else if (manipulator.altKey) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.translate; + } }; - inputManager.singleTouchAction = (manipulator)=>{ - if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _morphcharts.SingleTouchAction).rotate; - else if (manipulator.altKey) return (0, _morphcharts.SingleTouchAction).lasso; - else return (0, _morphcharts.SingleTouchAction).translate; - }; - inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator })=>{ - clearClickTimeout(); - const { altKey, button, shiftKey } = manipulator; - const me = { - altKey, - shiftKey, - button - }; - const e = me; - pickGridCallback([ - divisionX, - divisionY, - divisionZ - ], e); - }; - const canvas = container.getElementsByTagName('canvas')[0]; + inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { + clearClickTimeout(); + const { altKey, button, shiftKey } = manipulator; + const me = { altKey, shiftKey, button }; + const e = me; + pickGridCallback([divisionX, divisionY, divisionZ], e); + }; + const canvas = container.getElementsByTagName("canvas")[0]; let pickedId; - const hover = (e)=>{ - if (core.renderer.pickedId !== pickedId) { - pickedId = core.renderer.pickedId; - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeHover(e, ordinal); - } + const hover2 = (e) => { + if (core.renderer.pickedId !== pickedId) { + pickedId = core.renderer.pickedId; + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeHover(e, ordinal2); + } }; - canvas.addEventListener('mousemove', (e)=>{ - clearClickTimeout(); - if (mousedown) options.onCubeHover(e, null); - hover(e); + canvas.addEventListener("mousemove", (e) => { + clearClickTimeout(); + if (mousedown) { + options.onCubeHover(e, null); + } + hover2(e); }); - canvas.addEventListener('mouseout', hover); - canvas.addEventListener('mouseover', hover); + canvas.addEventListener("mouseout", hover2); + canvas.addEventListener("mouseover", hover2); let mousedown; - canvas.addEventListener('mousedown', ()=>{ - mousedown = true; + canvas.addEventListener("mousedown", () => { + mousedown = true; + }); + canvas.addEventListener("mouseup", (e) => { + mousedown = false; + }); + let canvasClickTimeout; + const clearClickTimeout = () => { + clearTimeout(canvasClickTimeout); + canvasClickTimeout = null; + }; + canvas.addEventListener("click", (e) => { + canvasClickTimeout = setTimeout(() => { + options.onCanvasClick(e); + }, 50); }); - canvas.addEventListener('mouseup', (e)=>{ - mousedown = false; + inputManager.pickItemCallback = ({ manipulator }) => { + clearClickTimeout(); + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeClick(manipulator.event, ordinal2); + }; + } + function cubicInOut(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; + } + function easing(t) { + if (t === 0 || t === 1) + return t; + return cubicInOut(t); + } + class Transitioner { + constructor() { + this.isTransitioning = false; + } + begin() { + this.isTransitioning = true; + this.time = 0; + } + elapse(elapsedTime, totalTime, ease = false) { + this.time += elapsedTime; + if (this.time >= totalTime) { + this.isTransitioning = false; + this.time = totalTime; + this.ended && this.ended(); + } + const t = this.time / totalTime; + return ease ? easing(t) : t; + } + } + class CameraTransitioner extends Transitioner { + constructor() { + super(); + this.qRotation = { + from: create$1(), + to: null, + current: create$1() + }; + this.vPosition = { + from: create$3(), + to: null, + current: create$3() + }; + } + move(position2, rotation2) { + this.begin(); + this.qRotation.to = rotation2; + this.vPosition.to = position2; + } + } + class ModelTransitioner extends Transitioner { + constructor() { + super(); + this.shouldTransition = false; + this.qRotation = { + from: null, + to: null, + current: create$1() + }; + } + } + function init(options, mcRendererOptions) { + const { container } = options; + const core = new Core({ container }); + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options); + core.config.pickSelectDelay = 50; + const cameraTransitioner = new CameraTransitioner(); + const modelTransitioner = new ModelTransitioner(); + const positionTransitioner = new Transitioner(); + positionTransitioner.ended = () => { + core.renderer.axesVisibility = AxesVisibility.current; + }; + const ref2 = { + supportedRenders: { + advanced: rendererEnabled(true), + basic: rendererEnabled(false) + }, + reset: null, + cameraTransitioner, + modelTransitioner, + positionTransitioner, + core, + setMorphChartsRendererOptions(mcRendererOptions2) { + if (shouldChangeRenderer(ref2.lastMorphChartsRendererOptions, mcRendererOptions2)) { + getRenderer(mcRendererOptions2, core); + listenCanvasEvents(core, options); + } else { + if (mcRendererOptions2.advanced) { + setRendererOptions(core.renderer, mcRendererOptions2); + } + } + ref2.lastMorphChartsRendererOptions = mcRendererOptions2; + }, + lastMorphChartsRendererOptions: mcRendererOptions, + layerStagger: {} + }; + return ref2; + } + class Presenter { + /** + * Get the previously rendered Stage object. + */ + get stage() { + return this._last.stage; + } + /** + * Get the current View camera type. + */ + get view() { + return this._last.view; + } + /** + * Instantiate a new Presenter. + * @param el Parent HTMLElement to present within. + * @param style Optional PresenterStyle styling options. + */ + constructor(el, style2) { + this.el = el; + this.style = deepMerge(defaultPresenterStyle$1, style2); + initializePanel(this); + this._last = { view: null, height: null, width: null, cubeCount: null, stage: null }; + } + /** + * Cancels any pending animation, calling animationCanceled() on original queue. + */ + animationCancel() { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + if (this.logger) { + this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || "handler"}`); + } + if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) { + this.queuedAnimationOptions.animationCanceled.call(null); + } + } + } + /** + * Stops the current animation and queues a new animation. + * @param handler Function to invoke when timeout is complete. + * @param timeout Length of time to wait before invoking the handler. + * @param options Optional QueuedAnimationOptions object. + */ + animationQueue(handler, timeout2, options) { + if (this.logger) { + this.logger(`queueing animation ${options && options.waitingLabel || "waiting"}...(${timeout2})`); + } + this.animationCancel(); + this.animationTimer = setTimeout(() => { + if (this.logger) { + this.logger(`queueing animation ${options && options.handlerLabel || "handler"}...`); + } + handler(); + }, timeout2); + } + /** + * Retrieve a sub-element of the rendered output. + * @param type PresenterElement type of the HTMLElement to retrieve. + */ + getElement(type2) { + const elements = this.el.getElementsByClassName(className(type2, this)); + if (elements && elements.length) { + return elements[0]; + } + } + /** + * Present the Vega Scene, or Stage object using Morphcharts. + * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. + * @param height Height of the rendering area. + * @param width Width of the rendering area. + * @param config Optional presentation configuration object. + */ + present(sceneOrStage, height2, width2, config) { + this.animationCancel(); + const scene = sceneOrStage; + let stage; + const options = { + maxOrdinal: 0, + currAxis: null, + defaultCubeColor: this.style.defaultCubeColor, + assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (() => options.maxOrdinal++), + modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, + zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex + }; + if (scene.marktype) { + stage = createStage(scene.view); + sceneToStage(options, stage, scene); + } else { + stage = sceneOrStage; + } + const c2 = deepMerge(defaultPresenterConfig, config); + if (!this.morphchartsref) { + this._morphChartsOptions = { + container: this.getElement(PresenterElement.gl), + pickGridCallback: c2.axisPickGridCallback, + onCubeHover: (e, ordinal2) => { + c2.onCubeHover(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCubeClick: (e, ordinal2) => { + c2.onCubeClick(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, + onLasso: config === null || config === void 0 ? void 0 : config.onLasso + }; + this.morphchartsref = init(this._morphChartsOptions, c2.renderer || defaultPresenterConfig.renderer); + } + let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); + if (options.maxOrdinal) { + cubeCount = Math.max(cubeCount, options.maxOrdinal); + const empty = { + isEmpty: true + }; + stage.cubeData = patchCubeArray(cubeCount, empty, stage.cubeData); + } + config.preLayer && config.preLayer(stage); + this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height2, width2, config && config.preStage, config && config.morphChartsColors, c2); + delete stage.cubeData; + delete stage.redraw; + this._last = { + cubeCount, + height: height2, + width: width2, + stage, + view: stage.view + }; + const a2 = getActiveElementInfo(); + mount(LegendView({ legend: stage.legend, onClick: config && config.onLegendClick }), this.getElement(PresenterElement.legend)); + setActiveElement(a2); + if (config && config.onPresent) { + config.onPresent(); + } + } + canvasToDataURL() { + return new Promise((resolve2, reject) => { + this.morphchartsref.core.afterRenderCallback = () => { + this.morphchartsref.core.afterRenderCallback = null; + const canvas = this.getElement(PresenterElement.gl).getElementsByTagName("canvas")[0]; + const png = canvas.toDataURL("image/png"); + resolve2(png); + }; + }); + } + configColors(mcColors) { + colorConfig(this.morphchartsref, mcColors); + } + /** + * Home the camera to the last initial position. + */ + homeCamera() { + var _a; + (_a = this.morphchartsref) === null || _a === void 0 ? void 0 : _a.reset(); + } + /** + * Show guidelines of rendering height/width and center of OrbitView. + */ + showGuides() { + this.getElement(PresenterElement.gl).classList.add("show-center"); + } + finalize() { + this.animationCancel(); + if (this.morphchartsref) + this.morphchartsref.core.stop(); + if (this.el) + this.el.innerHTML = ""; + this._last = null; + this.morphchartsref = null; + this.el = null; + this.logger = null; + this.queuedAnimationOptions = null; + } + } + function _RendererGl(loader2) { + class RendererGlInternal extends base.vega.Renderer { + initialize(el, width2, height2, origin) { + this.height = height2; + this.width = width2; + return super.initialize(el, width2, height2, origin); + } + resize(width2, height2, origin) { + super.resize(width2, height2, origin); + this.origin = origin; + this.height = height2; + this.width = width2; + return this; + } + _render(scene, items) { + const scene3d = scene; + scene3d.view = this.getView(); + this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); + return this; + } + } + const instance = new RendererGlInternal(loader2); + return instance; + } + const RendererGl = _RendererGl; + let registered = false; + function _ViewGl(runtime2, config) { + class ViewGlInternal extends base.vega.View { + constructor(runtime3, config2 = {}) { + super(runtime3, config2); + this.config = config2; + this.presenter = config2.presenter; + config2.presenterConfig = config2.presenterConfig || {}; + config2.presenterConfig.redraw = () => { + this._redraw = true; + this.run(); + }; + } + renderer(...args) { + if (args && args.length) { + const renderer = args[0]; + if (renderer === "morphcharts" && !registered) { + base.vega.renderModule("morphcharts", { handler: base.vega.CanvasHandler, renderer: RendererGl }); + registered = true; + } + return super.renderer(renderer); + } else { + return super.renderer(); + } + } + initialize(el) { + if (!this.presenter) { + this.presenter = new Presenter(el); + } + super.initialize(this.presenter.getElement(PresenterElement.vegaControls)); + const renderer = this._renderer; + renderer.presenterConfig = this.config.presenterConfig; + renderer.presenter = this.presenter; + renderer.getView = this.config && this.config.getView || (() => this.presenter.view || defaultView$1); + return this; + } + error(e) { + if (this.presenter.logger) { + this.presenter.logger(e); + } + } + } + const instance = new ViewGlInternal(runtime2, config); + return instance; + } + const ViewGl = _ViewGl; + const { defaultPresenterStyle } = defaults; + const defaultViewerOptions = { + colors: { + activeCube: "purple", + defaultCube: colorToString(defaultPresenterStyle.defaultCubeColor), + hoveredCube: colorToString(defaultPresenterStyle.highlightColor), + selectedCube: "yellow", + axisSelectHighlight: colorToString([128, 128, 128, 128]), + axisLine: "#000", + axisText: "#000", + gridLine: "#CCC", + backgroundColor: "#FFF" + }, + language: { + headers: { + chart: "Chart", + details: "Details", + legend: "Legend", + selection: "Select & Filter" + }, + bing: "bing", + newColorMap: "remap color to filtered items", + oldColorMap: "keep same colors", + deselect: "deselect", + exclude: "exclude", + isolate: "isolate", + legendOther: "other", + nextDetail: ">", + previousDetail: "<", + reset: "reset", + colorBinCount: "Color bin count", + colorReverse: "Color reverse", + count: "Count", + percent: "Percent", + sum: "Sum", + scatterPointScale: "Point scale", + FacetMaxBins: "Facet max bins", + FacetVMaxBins: "Cross facet max bins", + XMaxBins: "X axis max bins", + YMaxBins: "Y axis max bins", + XGridSize: "X grid size", + YGridSize: "Y grid size", + InnerPaddingSize: "Inner padding size", + OuterPaddingSize: "Outer padding size", + treeMapMethod: "Treemap layout", + facetColumns: "Facet columns", + facetRows: "Facet rows", + markOpacitySignal: "Mark opacity", + textScaleSignal: "Text scale", + xAxisTextAngleSignal: "X axis text angle", + yAxisTextAngleSignal: "Y axis text angle", + zGrounded: "Z grounded", + zScaleProportion: "Z scale proportion to Y", + selectionCount: (count2) => `${count2} items selected` + }, + maxLegends: 19, + //20 would be "other" + onError: (errors) => { + }, + filterRenderingTimerPadding: 200, + selectionPolygonZ: -1, + tickSize: 10 + }; + function getPresenterStyle(options) { + const style2 = { + cssPrefix, + fontFamily: options.fontFamily, + defaultCubeColor: colorFromString(options.colors.defaultCube) + }; + if (options.colors.hoveredCube) { + style2.highlightColor = colorFromString(options.colors.hoveredCube); + } + return style2; + } + const cssPrefix = "sanddance-"; + const dualColorSchemeColors = { + black: "#212121", + gray: "#D2D2D2", + blue: "#0060F0", + green: "#00C000", + orange: "#FF9900", + red: "#E00000" + }; + function isInternalFieldName(columnName, includeVegaMorphChartsFields = false) { + if (includeVegaMorphChartsFields) { + if (columnName === GL_ORDINAL) + return true; + } + for (const f in FieldNames) { + if (columnName === FieldNames[f]) + return true; + } + return false; + } + const dualPairs = [ + [dualColorSchemeColors.black, dualColorSchemeColors.gray], + [dualColorSchemeColors.red, dualColorSchemeColors.green], + [dualColorSchemeColors.red, dualColorSchemeColors.blue], + [dualColorSchemeColors.black, dualColorSchemeColors.red], + [dualColorSchemeColors.black, dualColorSchemeColors.orange], + [dualColorSchemeColors.black, dualColorSchemeColors.green] + ]; + const colorSchemes = [ + { + scheme: ColorScaleNone, + colors: [defaultViewerOptions.colors.defaultCube] + } + ]; + createDualColorSchemes(); + function registerColorSchemes(vega2) { + colorSchemes.forEach((cs) => { + if (cs.colors.length === 1) { + vega2.scheme(cs.scheme, (x2) => cs.colors[0]); + } else { + vega2.scheme(cs.scheme, cs.colors); + } }); - let canvasClickTimeout; - const clearClickTimeout = ()=>{ - clearTimeout(canvasClickTimeout); - canvasClickTimeout = null; - }; - canvas.addEventListener('click', (e)=>{ - canvasClickTimeout = setTimeout(()=>{ - options.onCanvasClick(e); - }, 50); + } + function createPair(names, colors2) { + const scheme2 = `dual_${names[0]}${names[1]}`; + colorSchemes.push({ scheme: scheme2, colors: colors2 }); + } + function createDualColorSchemes() { + dualPairs.forEach((colors2) => { + const names = colors2.map((color2) => { + for (const key2 in dualColorSchemeColors) + if (color2 === dualColorSchemeColors[key2]) + return key2; + }); + createPair(names, colors2); + createPair([...names].reverse(), [...colors2].reverse()); }); - inputManager.pickItemCallback = ({ manipulator })=>{ - clearClickTimeout(); - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeClick(manipulator.event, ordinal); - }; -} - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aaeTK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Transitioner", ()=>Transitioner); -parcelHelpers.export(exports, "CameraTransitioner", ()=>CameraTransitioner); -parcelHelpers.export(exports, "ModelTransitioner", ()=>ModelTransitioner); -var _glMatrix = require("gl-matrix"); -var _easing = require("./easing"); -class Transitioner { - constructor(){ - this.isTransitioning = false; + } + var DataLayoutChange; + (function(DataLayoutChange2) { + DataLayoutChange2[DataLayoutChange2["same"] = 0] = "same"; + DataLayoutChange2[DataLayoutChange2["reset"] = 1] = "reset"; + DataLayoutChange2[DataLayoutChange2["refine"] = 2] = "refine"; + })(DataLayoutChange || (DataLayoutChange = {})); + class Animator { + constructor(dataScope, props) { + this.dataScope = dataScope; + this.props = props; } - begin() { - this.isTransitioning = true; - this.time = 0; + select(search) { + return new Promise((resolve2, reject) => { + this.dataScope.select(search); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } - elapse(elapsedTime, totalTime, ease = false) { - this.time += elapsedTime; - if (this.time >= totalTime) { - this.isTransitioning = false; - this.time = totalTime; - this.ended && this.ended(); - } - const t = this.time / totalTime; - return ease ? (0, _easing.easing)(t) : t; - } -} -class CameraTransitioner extends Transitioner { - constructor(){ - super(); - this.qRotation = { - from: (0, _glMatrix.quat).create(), - to: null, - current: (0, _glMatrix.quat).create() - }; - this.vPosition = { - from: (0, _glMatrix.vec3).create(), - to: null, - current: (0, _glMatrix.vec3).create() - }; + deselect() { + return new Promise((resolve2, reject) => { + this.dataScope.deselect(); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } - move(position, rotation) { - this.begin(); - this.qRotation.to = rotation; - this.vPosition.to = position; - } -} -class ModelTransitioner extends Transitioner { - constructor(){ - super(); - this.shouldTransition = false; - this.qRotation = { - from: null, - to: null, - current: (0, _glMatrix.quat).create() - }; + filter(search, keepData, collapseData, rebase) { + if (rebase) { + this.dataScope.collapse(false, keepData); + } + this.dataScope.collapse(true, collapseData); + return new Promise((resolve2, reject) => { + this.props.onAnimateDataChange(DataLayoutChange.refine, "before refine", "refine").then(() => { + this.dataScope.deselect(); + this.dataScope.setFilteredData(keepData); + this.props.onDataChanged(DataLayoutChange.refine, search); + resolve2(); + }).catch(reject); + }); } -} - -},{"gl-matrix":"erHGu","./easing":"4dfzi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4dfzi":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easing", ()=>easing); -var _d3Ease = require("d3-ease"); -function easing(t) { - if (t === 0 || t === 1) return t; - return (0, _d3Ease.easeCubicInOut)(t); -} - -},{"d3-ease":"johm3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"johm3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easeLinear", ()=>(0, _linearJs.linear)); -parcelHelpers.export(exports, "easeQuad", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeQuadIn", ()=>(0, _quadJs.quadIn)); -parcelHelpers.export(exports, "easeQuadOut", ()=>(0, _quadJs.quadOut)); -parcelHelpers.export(exports, "easeQuadInOut", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeCubic", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easeCubicIn", ()=>(0, _cubicJs.cubicIn)); -parcelHelpers.export(exports, "easeCubicOut", ()=>(0, _cubicJs.cubicOut)); -parcelHelpers.export(exports, "easeCubicInOut", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easePoly", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easePolyIn", ()=>(0, _polyJs.polyIn)); -parcelHelpers.export(exports, "easePolyOut", ()=>(0, _polyJs.polyOut)); -parcelHelpers.export(exports, "easePolyInOut", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easeSin", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeSinIn", ()=>(0, _sinJs.sinIn)); -parcelHelpers.export(exports, "easeSinOut", ()=>(0, _sinJs.sinOut)); -parcelHelpers.export(exports, "easeSinInOut", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeExp", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeExpIn", ()=>(0, _expJs.expIn)); -parcelHelpers.export(exports, "easeExpOut", ()=>(0, _expJs.expOut)); -parcelHelpers.export(exports, "easeExpInOut", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeCircle", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeCircleIn", ()=>(0, _circleJs.circleIn)); -parcelHelpers.export(exports, "easeCircleOut", ()=>(0, _circleJs.circleOut)); -parcelHelpers.export(exports, "easeCircleInOut", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeBounce", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceIn", ()=>(0, _bounceJs.bounceIn)); -parcelHelpers.export(exports, "easeBounceOut", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceInOut", ()=>(0, _bounceJs.bounceInOut)); -parcelHelpers.export(exports, "easeBack", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeBackIn", ()=>(0, _backJs.backIn)); -parcelHelpers.export(exports, "easeBackOut", ()=>(0, _backJs.backOut)); -parcelHelpers.export(exports, "easeBackInOut", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeElastic", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticIn", ()=>(0, _elasticJs.elasticIn)); -parcelHelpers.export(exports, "easeElasticOut", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticInOut", ()=>(0, _elasticJs.elasticInOut)); -var _linearJs = require("./linear.js"); -var _quadJs = require("./quad.js"); -var _cubicJs = require("./cubic.js"); -var _polyJs = require("./poly.js"); -var _sinJs = require("./sin.js"); -var _expJs = require("./exp.js"); -var _circleJs = require("./circle.js"); -var _bounceJs = require("./bounce.js"); -var _backJs = require("./back.js"); -var _elasticJs = require("./elastic.js"); - -},{"./linear.js":false,"./quad.js":false,"./cubic.js":"4Bdab","./poly.js":false,"./sin.js":false,"./exp.js":false,"./circle.js":false,"./bounce.js":false,"./back.js":false,"./elastic.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Bdab":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubicIn", ()=>cubicIn); -parcelHelpers.export(exports, "cubicOut", ()=>cubicOut); -parcelHelpers.export(exports, "cubicInOut", ()=>cubicInOut); -function cubicIn(t) { - return t * t * t; -} -function cubicOut(t) { - return --t * t * t + 1; -} -function cubicInOut(t) { - return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"98mkQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ViewGl", ()=>ViewGl); -var _base = require("../base"); -var _defaults = require("../defaults"); -var _presenter = require("../presenter"); -var _enums = require("../enums"); -var _rendererGl = require("./rendererGl"); -let registered = false; -//dynamic superclass lets us create a subclass at execution phase instead of declaration phase. -//This allows us to retrieve vega.View from either UMD or ES6 consumers of this class. -//pass in the SuperClass, which should be a vega.View -function _ViewGl(runtime, config) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class ViewGlInternal extends (0, _base.base).vega.View { - constructor(runtime, config = {}){ - super(runtime, config); - this.config = config; - this.presenter = config.presenter; - config.presenterConfig = config.presenterConfig || {}; - config.presenterConfig.redraw = ()=>{ - this._redraw = true; //use Vega View private member _redraw - this.run(); - }; - } - renderer(...args) { - if (args && args.length) { - const renderer = args[0]; - if (renderer === 'morphcharts' && !registered) { - (0, _base.base).vega.renderModule('morphcharts', { - handler: (0, _base.base).vega.CanvasHandler, - renderer: (0, _rendererGl.RendererGl) - }); - registered = true; - } - return super.renderer(renderer); - } else return super.renderer(); - } - initialize(el) { - if (!this.presenter) this.presenter = new (0, _presenter.Presenter)(el); - super.initialize(this.presenter.getElement((0, _enums.PresenterElement).vegaControls)); - const renderer = this._renderer; - renderer.presenterConfig = this.config.presenterConfig; - renderer.presenter = this.presenter; - renderer.getView = this.config && this.config.getView || (()=>this.presenter.view || (0, _defaults.defaultView)); - return this; - } - error(e) { - if (this.presenter.logger) this.presenter.logger(e); + reset() { + return new Promise((resolve2, reject) => { + this.dataScope.deselect(); + let time2; + if (!this.dataScope.hasFilteredData()) { + time2 = 0; + } else { + this.dataScope.setFilteredData(null); } + this.props.onAnimateDataChange(DataLayoutChange.reset, "before reset", "reset", time2).then(() => { + this.dataScope.collapse(false); + this.props.onDataChanged(DataLayoutChange.reset); + resolve2(); + }).catch(reject); + }); } - const instance = new ViewGlInternal(runtime, config); - return instance; -} -const ViewGl = _ViewGl; - -},{"../base":"bxBcY","../defaults":"c3DaF","../presenter":"3NoKz","../enums":"dvKuu","./rendererGl":"7K3we","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7K3we":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererGl", ()=>RendererGl); -var _base = require("../base"); -//pass in the SuperClass, which should be a vega.View -function _RendererGl(loader) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class RendererGlInternal extends (0, _base.base).vega.Renderer { - initialize(el, width, height, origin) { - this.height = height; - this.width = width; - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin); - } - resize(width, height, origin) { - super.resize(width, height, origin); - this.origin = origin; - this.height = height; - this.width = width; - //rteturn this for vega - return this; - } - _render(scene, items) { - const scene3d = scene; - scene3d.view = this.getView(); - this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); - //return this for vega - return this; - } - } - const instance = new RendererGlInternal(loader); - return instance; -} -const RendererGl = _RendererGl; - -},{"../base":"bxBcY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fBSq8":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '1.0.6'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5zZMK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "colorSchemes", ()=>colorSchemes); -parcelHelpers.export(exports, "registerColorSchemes", ()=>registerColorSchemes); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _defaults = require("./defaults"); -const dualPairs = [ - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).gray - ], - [ - (0, _defaults.dualColorSchemeColors).red, - (0, _defaults.dualColorSchemeColors).green - ], - [ - (0, _defaults.dualColorSchemeColors).red, - (0, _defaults.dualColorSchemeColors).blue - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).red - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).orange - ], - [ - (0, _defaults.dualColorSchemeColors).black, - (0, _defaults.dualColorSchemeColors).green - ] -]; -const colorSchemes = [ - { - scheme: (0, _sanddanceSpecs.ColorScaleNone), - colors: [ - (0, _defaults.defaultViewerOptions).colors.defaultCube - ] + activate(datum2) { + return new Promise((resolve2, reject) => { + this.dataScope.activate(datum2); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } -]; -createDualColorSchemes(); -function registerColorSchemes(vega) { - colorSchemes.forEach((cs)=>{ - if (cs.colors.length === 1) vega.scheme(cs.scheme, (x)=>cs.colors[0]); - else vega.scheme(cs.scheme, cs.colors); - }); -} -function createPair(names, colors) { - const scheme = `dual_${names[0]}${names[1]}`; - colorSchemes.push({ - scheme, - colors - }); -} -function createDualColorSchemes() { - dualPairs.forEach((colors)=>{ - const names = colors.map((color)=>{ - for(const key in 0, _defaults.dualColorSchemeColors)if (color === (0, _defaults.dualColorSchemeColors)[key]) return key; - }); - createPair(names, colors); - createPair([ - ...names - ].reverse(), [ - ...colors - ].reverse()); - }); -} - -},{"@msrvida/sanddance-specs":"jgrWB","./defaults":"Bp4lx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8xwlr":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Component to view a SandDance data visualization. - */ parcelHelpers.export(exports, "Viewer", ()=>Viewer); -var _animator = require("./animator"); -var _axisSelection = require("./axisSelection"); -var _colorCubes = require("./colorCubes"); -var _colorSchemes = require("./colorSchemes"); -var _constants = require("./constants"); -var _dataScope = require("./dataScope"); -var _defaults = require("./defaults"); -var _details = require("./details"); -var _headers = require("./headers"); -var _legend = require("./legend"); -var _ordinal = require("./ordinal"); -var _search = require("./search"); -var _signals = require("./signals"); -var _tooltip = require("./tooltip"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _searchExpression = require("@msrvida/search-expression"); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _characterSet = require("./characterSet"); -var _transition = require("./transition"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + deactivate() { + return new Promise((resolve2, reject) => { + this.dataScope.deactivate(); + this.props.onDataChanged(DataLayoutChange.same); + resolve2(); + }); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function notNice(niceValue) { + return (niceValue + "").replace(/[\s,]/g, ""); + } + function tickValue(axis, i) { + const tick = axis.tickText[i]; + let value2; + if (tick) { + value2 = axis.tickText[i].value; + } + return { tick, value: value2 }; + } + function selectNullOrEmpty(column) { + const searchExpression = { + name: column.name, + operator: "isnullorEmpty" + }; + return searchExpression; + } + function selectExact(column, value2) { + if (value2 == null) { + return selectNullOrEmpty(column); + } + const searchExpression = { + name: column.name, + operator: "==", + value: value2 + }; + return searchExpression; + } + function selectNone(column, values2) { + const expressions = values2.map((value2, i) => { + const searchExpression = { + name: column.name, + operator: "!=", + value: value2 + }; + if (i) { + searchExpression.clause = "&&"; + } + return searchExpression; }); -}; -const { defaultView } = _vegaMorphcharts.defaults; -const zAxisZindex = 1010; -let didRegisterColorSchemes = false; -class Viewer { - /** - * Instantiate a new Viewer. - * @param element Parent HTMLElement to present within. - * @param options Optional viewer options object. - */ constructor(element, options){ - this.element = element; - this.options = _vegaMorphcharts.util.deepMerge((0, _defaults.defaultViewerOptions), options); - this.presenter = new _vegaMorphcharts.Presenter(element, (0, _defaults.getPresenterStyle)(this.options)); - //this.presenter.logger = console.log; - this._characterSet = new (0, _characterSet.CharacterSet)(); - this._dataScope = new (0, _dataScope.DataScope)(); - this._animator = new (0, _animator.Animator)(this._dataScope, { - onDataChanged: this.onDataChanged.bind(this), - onAnimateDataChange: this.onAnimateDataChange.bind(this) - }); - this._details = new (0, _details.Details)(this.presenter.getElement(_vegaMorphcharts.PresenterElement.panel), this.options.language, this._animator, this._dataScope, (remap)=>{ - this.currentColorContext = ~~remap; - this.renderSameLayout(); - }, ()=>this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); - this.insight = {}; + const searchExpressionGroup = { + expressions + }; + return searchExpressionGroup; + } + function selectExactAxis(axis, column, i) { + const result = tickValue(axis, i); + if (result.tick) { + return selectExact(column, result.value); } - changeColorContexts(colorContexts) { - this.colorContexts = colorContexts; - this.currentColorContext = 0; - this.options.onColorContextChange && this.options.onColorContextChange(); + } + function selectBetween(column, lowValue, highValue, lowOperator = ">=", highOperator = "<") { + const expressions = []; + if (lowValue !== void 0) { + expressions.push({ + name: column.name, + operator: lowOperator, + value: lowValue + }); } - applyLegendColorContext(colorContext) { - const a = _vegaMorphcharts.util.getActiveElementInfo(); - _vegaMorphcharts.util.mount(colorContext.legendElement, this.presenter.getElement(_vegaMorphcharts.PresenterElement.legend)); - _vegaMorphcharts.util.setActiveElement(a); - this.presenter.stage.legend = colorContext.legend; + if (highValue !== void 0) { + expressions.push({ + name: column.name, + operator: highOperator, + value: highValue + }); } - onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time) { - var _a; - if (time === undefined) { - const transitionDurations = ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) || _vegaMorphcharts.defaults.defaultPresenterConfig.transitionDurations; - time = transitionDurations.position + transitionDurations.stagger; - } - return new Promise((resolve, reject)=>{ - let innerPromise; - if (dataChange === (0, _animator.DataLayoutChange).refine) { - const oldColorContext = this.colorContexts[this.currentColorContext]; - innerPromise = new Promise((innerResolve)=>{ - this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, cubeLayer)=>{ - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - cubeLayer.unitColorMap = oldColorContext.colorMap; - if (this.options.onStage) this.options.onStage(stage); - } - })).then(()=>{ - //apply old legend - this.applyLegendColorContext(oldColorContext); - innerResolve(); - }); - }); - } else innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, colorMapper)=>{ - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - this.overrideAxisLabels(stage); - if (this.options.onStage) this.options.onStage(stage); - } - })); - innerPromise.then(()=>{ - this.presenter.animationQueue(resolve, time, { - waitingLabel, - handlerLabel, - animationCanceled: reject - }); - }); - }); + if (expressions.length > 1) { + expressions[1].clause = "&&"; } - onDataChanged(dataLayout, filter) { - return __awaiter(this, void 0, void 0, function*() { - switch(dataLayout){ - case (0, _animator.DataLayoutChange).same: - { - const hasSelectedData = this._dataScope.hasSelectedData(); - const hasActive = !!this._dataScope.active; - if (hasSelectedData || hasActive) this.presenter.morphChartsRenderResult.update({ - cubes: this.convertSearchToSet() - }); - else this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - break; - } - case (0, _animator.DataLayoutChange).refine: - { - //save cube colors - const oldColorContext = this.colorContexts[this.currentColorContext]; - let colorMap; - this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - preStage: (stage, cubeLayer)=>{ - //save off the spec colors - colorMap = cubeLayer.unitColorMap; - cubeLayer.unitColorMap = oldColorContext.colorMap; - this.preStage(stage, cubeLayer); - }, - onPresent: ()=>{ - //save new legend - const newColorContext = { - colorMap, - legend: _vegaMorphcharts.util.clone(this.presenter.stage.legend), - legendElement: this.presenter.getElement(_vegaMorphcharts.PresenterElement.legend).children[0] - }; - //apply old legend - this.applyLegendColorContext(oldColorContext); - this.changeColorContexts([ - oldColorContext, - newColorContext - ]); - this.onPresent(); - } - })); - //narrow the filter only if it is different - if (!_searchExpression.compare(this.insight.filter, filter)) this.insight.filter = _searchExpression.narrow(this.insight.filter, filter); - if (this.options.onDataFilter) this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); - break; - } - case (0, _animator.DataLayoutChange).reset: - { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - this.changeColorContexts([ - colorContext - ]); - this.presenter.morphChartsRenderResult.update({ - cubes: null - }); - yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { - onPresent: ()=>{ - //color needs to change instantly - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.onPresent(); - } - })); - delete this.insight.filter; - if (this.options.onDataFilter) this.options.onDataFilter(null, null); - break; - } - } - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); - } - }); + const searchExpressionGroup = { + expressions + }; + return searchExpressionGroup; + } + function selectBetweenAxis(axis, column, i) { + const low = tickValue(axis, i); + const high = tickValue(axis, i + 1); + return selectBetween(column, low.value, high.value); + } + const dimToRole = { + 0: "x", + 1: "y", + 2: "z" + }; + const roleToDim = { + x: 0, + y: 1, + z: 1 + }; + class AxisSelection { + constructor(specCapabilities, columns, stage) { + this.specCapabilities = specCapabilities; + this.columns = columns; + this.stage = stage; } - convertSearchToSet() { - if (this._dataScope.selection) { - const s = new Set(); - let found = false; - this._dataScope.selection.included.forEach((o, i)=>{ - s.add(o[0, _constants.GL_ORDINAL]); - found = true; + convert(divisions) { + const searchRoles = []; + divisions.forEach((division, i) => { + const role = dimToRole[i]; + const axes = this.stage.axes[role]; + const axis = axes.filter((axis2) => axis2.tickText.length)[0]; + if (axis) { + const capabilities = this.specCapabilities.roles.filter((r) => r.role === role)[0]; + const column = this.columns[role]; + if (division >= 0 && (capabilities === null || capabilities === void 0 ? void 0 : capabilities.axisSelection)) { + searchRoles.push({ + axis, + role, + capabilities, + column, + division }); - if (!found) s.add(-1); - return s; + } + } + }); + switch (searchRoles.length) { + case 0: { + return null; } + case 1: { + return this.getSearchFromSearchRole(searchRoles[0]); + } + default: { + const roles = searchRoles.map((searchRole) => this.getSearchFromSearchRole(searchRole)); + roles.forEach((role, i) => { + if (i === 0) + return; + role.clause = "&&"; + }); + return roles; + } + } } - convertSetToSearch(s) { - const search = { - expressions: [] - }; - s.forEach((value)=>{ - search.expressions.push({ - name: (0, _constants.GL_ORDINAL), - operator: '==', - value, - clause: '||' - }); - }); - return search; + getSearchFromSearchRole(searchRole) { + const getSearch = searchRole.capabilities.axisSelection === "exact" ? (a2, c2, i) => ({ expressions: [selectExactAxis(a2, c2, i)] }) : selectBetweenAxis; + const { axis, column, division } = searchRole; + return getSearch(axis, column, division); } - getSpecColumnsWithFilteredStats() { - if (!this._dataScope.hasFilteredData()) return this._specColumns; - const roles = [ - 'color', - 'facet', - 'group', - 'size', - 'sort', - 'sum', - 'x', - 'y', - 'z' - ]; - const specColumns = Object.assign({}, this._specColumns); - roles.forEach((r)=>{ - if (specColumns[r]) { - const column = Object.assign({}, specColumns[r]); - column.stats = this.getColumnStats(column); - specColumns[r] = column; - } - }); - return specColumns; + } + function moveTicksBetween(axes) { + axes.forEach((axis) => { + if (axis.ticks.length === 0) + return; + const dim = roleToDim[axis.axisRole]; + const { color: color2 } = axis.ticks[0]; + const newLine = (value2) => { + const line2 = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0], + color: color2 + }; + line2.sourcePosition[dim] = value2; + return line2; + }; + const newTicks = []; + newTicks.push(newLine(axis.domain.sourcePosition[dim])); + for (let i = 1; i < axis.ticks.length; i++) { + newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); + } + newTicks.push(newLine(axis.domain.targetPosition[dim])); + axis.ticks = newTicks; + }); + } + function populateColorContext(colorContext, presenter) { + if (!colorContext.colorMap) { + colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; } - renderNewLayout(signalValues, presenterConfig, view) { - return __awaiter(this, void 0, void 0, function*() { - const currData = this._dataScope.currentData(); - const context = { - specColumns: this.getSpecColumnsWithFilteredStats(), - insight: this.insight, - specViewOptions: Object.assign(Object.assign({}, this.options), { - zAxisOptions: { - showZAxis: true, - zIndex: zAxisZindex - }, - collapseFacetAxes: true - }) - }; - const specResult = (0, _sanddanceSpecs.build)(context, currData); - if (!specResult.errors) { - const uiValues = (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec); - (0, _signals.applySignalValues)(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); - (0, _signals.unbindSignalUI)(specResult.vegaSpec); - this.vegaSpec = specResult.vegaSpec; - this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); - this.specCapabilities = specResult.specCapabilities; - const config = this.createConfig(presenterConfig); - this._lastPresenterConfig = config.presenterConfig; - if (view) config.getView = ()=>view; - if (!didRegisterColorSchemes) { - (0, _colorSchemes.registerColorSchemes)(_vegaMorphcharts.base.vega); - didRegisterColorSchemes = true; - } - try { - if (this.vegaViewGl) this.vegaViewGl.finalize(); - const runtime = _vegaMorphcharts.base.vega.parse(this.vegaSpec); - this.vegaViewGl = new _vegaMorphcharts.ViewGl(runtime, config).renderer('morphcharts').initialize(this.element); - yield this.vegaViewGl.runAsync(); - const handler = (n, v)=>{ - this._characterSet.resetCharacterSet(true); - }; - this.vegaSpec.signals.forEach((s)=>{ - this.vegaViewGl.addSignalListener(s.name, handler); - }); - //capture new color color contexts via signals - this.configForSignalCapture(config.presenterConfig); - } catch (e) { - specResult.errors = [ - e.message - ]; - } - if (!specResult.errors) (0, _headers.ensureHeaders)(this.presenter, this.options.language.headers); - } - if (specResult.errors) { - if (this.options.onError) this.options.onError(specResult.errors); - else if (this.presenter.logger) this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join('\n')}`); - } - return specResult; - }); + colorContext.legend = clone(presenter.stage.legend); + colorContext.legendElement = presenter.getElement(PresenterElement.legend).children[0]; + } + class DataScope { + constructor() { + this.filteredColumnsStats = {}; } - /** - * Render the same layout with new options. - * @param newViewerOptions New options object. - */ renderSameLayout(newViewerOptions) { - const colorContext = this.colorContexts[this.currentColorContext]; - this.applyLegendColorContext(colorContext); - if (newViewerOptions) { - if (newViewerOptions.colors) { - //set theme colors PresenterConfig - const mcColors = this.getMorphChartsColors(); - this.presenter.configColors(mcColors); - this._lastPresenterConfig.morphChartsColors = mcColors; - } - this.options = _vegaMorphcharts.util.deepMerge(this.options, newViewerOptions); + setData(data2, columns) { + const differentData = this.data !== data2; + if (differentData) { + if (this.data) { + this.deselect(); } - this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; - this.presenter.morphChartsRenderResult.update({ - cubes: this.convertSearchToSet() - }); + this.data = data2; + this.columns = columns; + this.filteredData = null; + this.filteredColumnsStats = {}; + } + return differentData; } - getView(view) { - if (view === undefined) { - if (this.presenter.view === null) return defaultView; - else return this.presenter.view; - } else return view; + setFilteredData(filteredData) { + this.filteredData = filteredData; + this.filteredColumnsStats = {}; } - transformData(values, transform) { - try { - const runtime = _vegaMorphcharts.base.vega.parse({ - $schema: 'https://vega.github.io/schema/vega/v4.json', - data: [ - { - name: 'source', - values, - transform - } - ] - }); - new _vegaMorphcharts.ViewGl(runtime).run(); - } catch (e) { - // continue regardless of error + getColumns(columnTypes) { + if (!this.columns) { + this.columns = getColumnsFromData(base.vega.inferTypes, this.data, columnTypes); + } + return this.columns; + } + getFilteredColumnStats(columnName) { + if (!this.filteredColumnsStats[columnName]) { + this.filteredColumnsStats[columnName] = getStats(this.filteredData, this.columns.filter((c2) => c2.name === columnName)[0]); + } + return this.filteredColumnsStats[columnName]; + } + currentData() { + return this.filteredData || this.data; + } + select(search) { + this.deselect(); + if (search) { + this.selection = this.createUserSelection(search, true, false); + if (this.selection.included.length) { + this.activate(this.selection.included[0]); } - return values; + } } - /** - * Render data into a visualization. - * @param insightSetup InsightSetup object to create a visualization rendering. - * @param data Array of data objects. - * @param renderOptions Optional RenderOptions object. - */ render(insightSetup_1, data_1) { - return __awaiter(this, arguments, void 0, function*(insightSetup, data, renderOptions = {}) { - const { insight, setup } = insightSetup; - let result; - //see if refine expression has changed - if (!_searchExpression.compare(insight.filter, this.insight.filter)) { - const transitionDurations = (setup === null || setup === void 0 ? void 0 : setup.transitionDurations) || _vegaMorphcharts.defaults.defaultPresenterConfig.transitionDurations; - const renderTime = transitionDurations.position + transitionDurations.stagger; - const allowAsyncRenderTime = renderTime + this.options.filterRenderingTimerPadding; - if (insight.filter) { - //refining - result = yield this._render(insightSetup, data, renderOptions, true); - this.presenter.animationQueue(()=>{ - this.filter(insight.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); - }, allowAsyncRenderTime, { - waitingLabel: 'layout before refine', - handlerLabel: 'refine after layout' - }); - } else { - //not refining - this._dataScope.setFilteredData(null); - result = yield this._render(insightSetup, data, renderOptions, true); - this.presenter.animationQueue(()=>{ - this.reset(); - }, allowAsyncRenderTime, { - waitingLabel: 'layout before reset', - handlerLabel: 'reset after layout' - }); - } - } else result = yield this._render(insightSetup, data, renderOptions, false); - return result; - }); + createUserSelection(search, assign, rebase) { + const exec = new Exec(search, this.getColumns()); + const s = { + search, + included: [], + excluded: [] + }; + const data2 = rebase ? this.data : this.currentData(); + data2.forEach((datum2) => { + if (exec.run(datum2)) { + if (assign) { + datum2[FieldNames.Selected] = true; + } + s.included.push(datum2); + } else { + s.excluded.push(datum2); + } + }); + return s; } - shouldViewstateTransition(newInsight, oldInsight) { - if (!oldInsight.columns) return false; - if (oldInsight.chart !== newInsight.chart) return true; - if (oldInsight.size.height !== newInsight.size.height) return true; - if (oldInsight.size.width !== newInsight.size.width) return true; - if (oldInsight.columns.facet !== newInsight.columns.facet) return true; - return false; + deselect() { + this.deactivate(); + this.data.forEach((datum2) => { + delete datum2[FieldNames.Selected]; + }); + this.selection = null; } - configForSignalCapture(presenterConfig) { - const colorContext = { - colorMap: null, - legend: null, - legendElement: null - }; - //now be ready to capture color changing signals - presenterConfig.preStage = (stage, cubeLayer)=>{ - if (this._shouldSaveColorContext()) //save off the colors from Vega layout - colorContext.colorMap = cubeLayer.unitColorMap; - this.preStage(stage, cubeLayer); - }; - presenterConfig.onPresent = ()=>{ - if (this._shouldSaveColorContext()) { - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.changeColorContexts([ - colorContext - ]); - this._dataScope.deselect(); - } - this.onPresent(); - }; + hasFilteredData() { + return !!this.filteredData; } - onPresent() { - var _a; - if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transition) (0, _transition.assignTransitionStagger)(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); - this.options.onPresent && this.options.onPresent(); - } - _render(insightSetup, data, renderOptions, forceNewCharacterSet) { - return __awaiter(this, void 0, void 0, function*() { - const { insight, setup } = insightSetup; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (this._dataScope.setData(data, renderOptions.columns)) //apply transform to the data - this.transformData(data, insight.transform); - this._specColumns = (0, _sanddanceSpecs.getSpecColumns)(insight, this._dataScope.getColumns(renderOptions.columnTypes)); - const ordinalMap = (0, _ordinal.assignOrdinals)(this._specColumns, data, renderOptions.ordinalMap); - this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight); - this.insight = _vegaMorphcharts.util.clone(insight); - this.setup = setup; - this._shouldSaveColorContext = ()=>!renderOptions.initialColorContext; - const colorContext = renderOptions.initialColorContext || { - colorMap: null, - legend: null, - legendElement: null - }; - const specResult = yield this.renderNewLayout(insight.signalValues, Object.assign(Object.assign({}, setup || {}), { - preStage: (stage, cubeLayer)=>{ - if (this._shouldSaveColorContext()) //save off the colors from Vega layout - colorContext.colorMap = cubeLayer.unitColorMap; - else //apply passed colorContext - cubeLayer.unitColorMap = colorContext.colorMap; - //if items are selected, repaint - const hasSelectedData = !!this._dataScope.hasSelectedData(); - //const hasActive = !!this._dataScope.active; - hasSelectedData || this._dataScope.active; - this.preStage(stage, cubeLayer); - }, - onPresent: ()=>{ - if (this._shouldSaveColorContext()) { - (0, _colorCubes.populateColorContext)(colorContext, this.presenter); - this.changeColorContexts([ - colorContext - ]); - } else //apply passed colorContext - this.applyLegendColorContext(colorContext); - this.onPresent(); - }, - shouldViewstateTransition: ()=>this.shouldViewstateTransition(insight, this.insight) - }), this.getView(insight.view)); - //future signal changes should save the color context - this._shouldSaveColorContext = ()=>!renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); - this._details.render(); - const result = { - ordinalMap, - specResult - }; - return result; - }); + hasSelectedData() { + return !!this.selection; } - overrideAxisLabels(stage) { - // if (this._specColumns.x && this._specColumns.x.type === 'date') { - // stage.axes.x.forEach(axis => makeDateRange( - // axis.tickText, - // this.getColumnStats(this._specColumns.x) - // )); - // } - // if (this._specColumns.y && this._specColumns.y.type === 'date') { - // stage.axes.y.forEach(axis => makeDateRange( - // axis.tickText, - // this.getColumnStats(this._specColumns.y) - // )); - // } + collapse(collapsed, data2 = this.data) { + data2.forEach((datum2) => { + datum2[FieldNames.Collapsed] = collapsed; + }); + this.isCollapsed = collapsed; } - preLayer(stage) { - //convert ticks - let axisRole; - for(axisRole in stage.axes){ - const capability = this.specCapabilities.roles.filter((r)=>r.role === axisRole)[0]; - if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === 'exact')) (0, _axisSelection.moveTicksBetween)(stage.axes[axisRole]); - } + activate(datum2) { + this.deactivate(); + datum2[FieldNames.Active] = true; + this.active = datum2; } - preStage(stage, cubeLayer) { - this.overrideAxisLabels(stage); - this._axisSelection = new (0, _axisSelection.AxisSelection)(this.specCapabilities, this._specColumns, stage); - (0, _legend.finalizeLegend)(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); - if (this.options.onStage) this.options.onStage(stage); + deactivate() { + if (this.active) { + delete this.active[FieldNames.Active]; + } + this.active = null; } - onCubeClick(e, cube) { - this.options.onCubeClick && this.options.onCubeClick(e, cube); - const hasSelectedData = this._dataScope.hasSelectedData(); - if (hasSelectedData && this._dataScope.selection.included.length > 1) { - //if active is within selection, keep the selection and activate the one. - const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); - if (indexWithinSelection.index >= 0) { - this.activate(indexWithinSelection.datum); - this._details.populate(this._dataScope.selection, indexWithinSelection.index); - if (this.options.onSelectionChanged) { - const sel = this.getSelection(); - this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); - } - return; - } + ordinalIndexWithinSelection(ordinal2) { + if (this.selection) { + for (let i = 0; i < this.selection.included.length; i++) { + const datum2 = this.selection.included[i]; + if (datum2[GL_ORDINAL] === ordinal2) { + return { datum: datum2, index: i }; + } } - if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][0, _constants.GL_ORDINAL] === cube.ordinal) { - this.deselect(); - return; - } - const search = { - name: (0, _constants.GL_ORDINAL), - operator: '==', - value: cube.ordinal - }; - this.select(search); + } + return { datum: null, index: -1 }; } - onCubeHover(event, cube) { - var _a, _b; - if (this._tooltip) { - this._tooltip.destroy(); - this._tooltip = null; - } - if (!cube) return; - const currentData = this._dataScope.currentData(); - const index = (0, _ordinal.getDataIndexOfCube)(cube, currentData); - if (index >= 0) { - const dataItem = (0, _tooltip.cleanDataItem)(((_a = this.options.tooltipOptions) === null || _a === void 0 ? void 0 : _a.prepareDataItem(currentData[index])) || currentData[index]); - const tooltipCreateOptions = { - dataItem, - event - }; - if ((_b = this.options.tooltipOptions) === null || _b === void 0 ? void 0 : _b.create) this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); - else this._tooltip = new (0, _tooltip.Tooltip)(Object.assign(Object.assign({}, tooltipCreateOptions), { - cssPrefix: this.presenter.style.cssPrefix - })); - } + finalize() { + this.data = null; + this.filteredData = null; + this.filteredColumnsStats = null; + if (this.selection) { + this.selection.excluded = null; + this.selection.included = null; + this.selection = null; + } } - onTextHover(e, t) { - //return true if highlight color is different - if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) return false; - return !_vegaMorphcharts.util.colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); + } + var Action; + (function(Action2) { + Action2[Action2["deselect"] = 0] = "deselect"; + Action2[Action2["isolate"] = 1] = "isolate"; + Action2[Action2["exclude"] = 2] = "exclude"; + Action2[Action2["reset"] = 3] = "reset"; + Action2[Action2["next"] = 4] = "next"; + Action2[Action2["previous"] = 5] = "previous"; + })(Action || (Action = {})); + class Details { + constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps) { + this.language = language; + this.animator = animator; + this.dataScope = dataScope; + this.colorMapHandler = colorMapHandler; + this.hasColorMaps = hasColorMaps; + this.element = addDiv(parentElement, `${cssPrefix}unitControls`); + this.clear(); } - getMorphChartsColors() { - const { colors } = this.options; - return { - activeItemColor: colors.activeCube, - axesGridBackgroundColor: colors.backgroundColor, - axesGridHighlightColor: colors.axisSelectHighlight, - axesGridMajorColor: colors.gridLine, - axesGridMinorColor: colors.gridLine, - axesGridZeroColor: colors.gridLine, - axesTextHeadingColor: colors.axisText, - axesTextLabelColor: colors.axisText, - axesTextTitleColor: colors.axisText, - backgroundColor: colors.backgroundColor, - textBorderColor: colors.backgroundColor, - textColor: colors.axisText - }; + finalize() { + if (this.element) + this.element.innerHTML = ""; + this.dataScope = null; + this.element = null; } - createConfig(c) { - var _a; - const { getTextColor, getTextHighlightColor, onTextClick } = this.options; - const defaultPresenterConfig = { - morphChartsColors: this.getMorphChartsColors(), - zAxisZindex, - getCharacterSet: (stage)=>this._characterSet.getCharacterSet(stage), - getTextColor, - getTextHighlightColor, - onTextClick: (e, t)=>{ - if (t.metaData && t.metaData.search) { - //used by facets to select the facet - const search = (0, _search.getSearchGroupFromVegaValue)(t.metaData.search); - if (this.options.onAxisClick) this.options.onAxisClick(e, search); - else this.select(search); - } - if (onTextClick) onTextClick(e, t); - }, - onCubeClick: this.onCubeClick.bind(this), - onCubeHover: this.onCubeHover.bind(this), - onTextHover: this.onTextHover.bind(this), - preLayer: this.preLayer.bind(this), - preStage: this.preStage.bind(this), - onPresent: this.onPresent.bind(this), - onAxisConfig: (cartesian, dim3d, axis)=>{ - if (!axis) return; - const role = this.specCapabilities.roles.filter((r)=>r.role === axis.axisRole)[0]; - if (role === null || role === void 0 ? void 0 : role.axisSelection) { - cartesian.isDivisionPickingEnabled[dim3d] = true; - cartesian.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; - cartesian.isLabelPickingEnabled[dim3d] = true; - cartesian.isTitlePickingEnabled[dim3d] = true; - cartesian.isHeadingPickingEnabled[dim3d] = true; - cartesian.isGridPickingEnabled = false; - } - }, - onAxesComplete: (cartesian)=>{}, - axisPickGridCallback: (divisions, e)=>{ - const search = this._axisSelection.convert(divisions); - if (this.options.onAxisClick) this.options.onAxisClick(e, search); //TODO change onAxisClick to accept Search - else this.select(search); - }, - onLayerClick: (e)=>{ - this.options.onCanvasClick && this.options.onCanvasClick(e); - this.deselect(); - }, - onLegendClick: (e, legend, clickedIndex)=>{ - const legendRow = clickedIndex !== null && legend.rows[clickedIndex]; - if (legendRow) { - if (this.options.onLegendRowClick) this.options.onLegendRowClick(e, legendRow); - else this.select(legendRow.search); - } else if (this.options.onLegendHeaderClick) //header clicked - this.options.onLegendHeaderClick(e); - }, - onSceneRectAssignCubeOrdinal: (datum)=>{ - //TODO see if datum is a facet selection rect - return datum[0, _constants.GL_ORDINAL]; - }, - onTargetViewState: (h, w)=>{ - const { height, width } = this.insight.size; - let newViewStateTarget; - if (this.options.onNewViewStateTarget) newViewStateTarget = this.options.onNewViewStateTarget(); - return { - height, - width, - newViewStateTarget - }; - }, - layerSelection: { - cubes: this.convertSearchToSet() - }, - preserveDrawingBuffer: this.options.preserveDrawingBuffer - }; - if (!this.options.disableLasso) defaultPresenterConfig.onLasso = (ids, e)=>{ - this.deselect(); - const search = this.convertSetToSearch(ids); - this.select(search); - }; - if (this.options.onBeforeCreateLayers) defaultPresenterConfig.preLayer = (stage)=>{ - this.preLayer(stage); - this.options.onBeforeCreateLayers(stage, this.specCapabilities); - }; - const config = { - presenter: this.presenter, - presenterConfig: Object.assign(defaultPresenterConfig, c) - }; - if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) config.presenterConfig.transitionDurations = this.setup.transitionDurations; - return config; + clear() { + this.state = { + userSelection: null, + index: -1, + remapColor: false + }; + this.render(); } - /** - * Filter the data and animate. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. - */ filter(search, rebase = false) { - const u = this._dataScope.createUserSelection(search, false, rebase); - return new Promise((resolve, reject)=>{ - this._animator.filter(search, u.included, u.excluded, rebase).then(()=>{ - this._details.clear(); - this._details.clearSelection(); - this._details.populate(this._dataScope.selection); - resolve(); - }); - }); + clearSelection() { + this.state.userSelection = null; + this.state.index = -1; + this.render(); + } + populate(userSelection, index2 = 0) { + this.state.userSelection = userSelection; + this.state.index = index2; + this.render(); + } + selectByNameValue(columnName, value2) { + const search = { + name: columnName, + operator: "==", + value: value2 + }; + this.clearSelection(); + this.animator.select(search); + this.populate(this.dataScope.selection); } - /** - * Remove any filtration and animate. - */ reset() { - return new Promise((resolve, reject)=>{ - this._animator.reset().then(()=>{ - this._details.clear(); - this._details.clearSelection(); - resolve(); - }); - }); + remapChanged(remap) { + this.state.remapColor = remap; + this.colorMapHandler(remap); + this.render(); + } + handleAction(action) { + let p; + const u2 = this.state.userSelection; + switch (action) { + case Action.deselect: { + this.clearSelection(); + p = this.animator.deselect(); + break; + } + case Action.exclude: { + this.clearSelection(); + p = this.animator.filter(invert$1(u2.search), u2.excluded, u2.included, false); + this.state.remapColor = false; + break; + } + case Action.isolate: { + this.clearSelection(); + p = this.animator.filter(u2.search, u2.included, u2.excluded, false); + this.state.remapColor = false; + break; + } + case Action.reset: { + this.clear(); + p = this.animator.reset(); + break; + } + default: { + switch (action) { + case Action.previous: { + this.state.index--; + if (this.state.index < 0) { + this.state.index = this.state.userSelection.included.length - 1; + } + break; + } + case Action.next: { + this.state.index++; + if (this.state.index >= this.state.userSelection.included.length) { + this.state.index = 0; + } + break; + } + } + this.render(); + p = this.animator.activate(this.state.userSelection.included[this.state.index]); + } + } + p.then(() => this.render()); } - /** - * Select cubes by a filter expression. - * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ - */ select(search) { - return new Promise((resolve, reject)=>{ - this._animator.select(search).then(()=>{ - this._details.populate(this._dataScope.selection); - resolve(); - }); - }); + render() { + const hasRefinedData = this.dataScope.hasFilteredData(); + const renderProps = { + language: this.language, + actionHandler: (action) => this.handleAction(action), + selectionHandler: (columnName, value2) => this.selectByNameValue(columnName, value2), + count: this.state.userSelection && this.state.userSelection.included.length, + hasRefinedData, + item: this.state.userSelection && this.state.userSelection.included[this.state.index], + remapColorHandler: (remap) => this.remapChanged(remap), + hasColorMaps: this.hasColorMaps() && hasRefinedData, + remapColor: this.state.remapColor + }; + const a2 = getActiveElementInfo(); + mount(renderDetails(renderProps), this.element); + setActiveElement(a2); } - /** - * Removes any selection. - */ deselect() { - return new Promise((resolve, reject)=>{ - this._animator.deselect().then(()=>{ - this._details.clearSelection(); - resolve(); - }); - }); + } + const renderDetails = (props) => { + const controlButtons = [ + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.deselect) }, props.language.deselect), + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.isolate) }, props.language.isolate), + createElement("button", { disabled: !props.item, onClick: (e) => props.actionHandler(Action.exclude) }, props.language.exclude) + ]; + const colorMapping = createElement( + "div", + null, + createElement("button", { disabled: props.remapColor, onClick: (e) => props.remapColorHandler(true) }, props.language.newColorMap), + createElement("button", { disabled: !props.remapColor, onClick: (e) => props.remapColorHandler(false) }, props.language.oldColorMap) + ); + const singleItem = props.count === 1; + const scrollButtons = [ + createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.previous) }, props.language.previousDetail), + createElement("button", { disabled: singleItem, onClick: (e) => props.actionHandler(Action.next) }, props.language.nextDetail), + createElement( + "span", + null, + " ", + props.language.selectionCount(props.count) + ) + ]; + const rows = []; + for (const prop in props.item) { + if (prop === GL_ORDINAL) { + continue; + } + if (isInternalFieldName(prop)) { + continue; + } + rows.push({ + cells: [ + { content: prop }, + { content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) } + ] + }); } - /** - * Gets the current selection. - */ getSelection() { - if (!this._dataScope) return null; - const selectionState = { - search: this._dataScope.selection && this._dataScope.selection.search || null, - selectedData: this._dataScope.selection && this._dataScope.selection.included || null, - active: this._dataScope.active - }; - return selectionState; + return createElement( + "div", + null, + props.hasColorMaps && colorMapping, + createElement("h4", null, props.language.headers.selection), + createElement( + "div", + { className: `${cssPrefix}selection` }, + controlButtons, + createElement("button", { disabled: !props.hasRefinedData, onClick: (e) => props.actionHandler(Action.reset) }, "reset") + ), + props.item && createElement("h4", null, props.language.headers.details), + createElement( + "div", + null, + createElement("div", { className: `${cssPrefix}details-scroll` }, props.item && scrollButtons), + createElement("div", { className: `${cssPrefix}details` }, props.item && createElement(Table$1, { rows })) + ) + ); + }; + function linkSelect(language, columnName, value2, selectionHandler) { + return createElement( + "span", + null, + createElement("a", { href: "#", onClick: (e) => selectionHandler(columnName, value2) }, value2), + isNaN(value2) ? [" ", createElement("a", { className: "bing-search", href: `https://www.bing.com/search?q=${encodeURIComponent(value2)}`, target: "_blank" }, language.bing)] : "" + ); + } + function ensureHeaders(presenter, headers) { + const vegaControls = presenter.getElement(PresenterElement.vegaControls); + conditionalHeader(!!vegaControls.querySelectorAll(".vega-bindings > *").length, vegaControls, headers.chart); + const legend2 = presenter.getElement(PresenterElement.legend); + conditionalHeader(!!legend2.children.length, legend2, headers.legend); + } + function conditionalHeader(condition, element2, header) { + const existing = existingHeader(element2, header); + if (condition && !existing) { + addHeader(element2, header); } - /** - * Set one data row to the active state. - */ activate(datum) { - return new Promise((resolve, reject)=>{ - this._animator.activate(datum).then(()=>{ - this.presenter.morphChartsRenderResult.activate(datum[0, _constants.GL_ORDINAL]); - this._details.render(); - resolve(); - }); - }); + if (!condition && existing) { + existing.remove(); } - /** - * Deactivate item. - */ deActivate() { - return new Promise((resolve, reject)=>{ - if (this._dataScope && this._dataScope.active) this._animator.deactivate().then(()=>{ - this.presenter.morphChartsRenderResult.activate(-1); - this._details.render(); - resolve(); - }); - else resolve(); - }); + } + function addHeader(element2, header) { + const h2 = document.createElement("h4"); + h2.innerHTML = header; + element2.insertAdjacentElement("beforebegin", h2); + } + function existingHeader(element2, header) { + const { previousElementSibling } = element2; + if (previousElementSibling && previousElementSibling.innerHTML === header) { + return previousElementSibling; } - /** - * Gets the current camera. - * @param transitionFinal Optional flag to get camera destination when transition completes. - */ getCamera(transitionFinal = false) { - var _a, _b, _c, _d, _e, _f, _g; - let position = [ - 0, - 0, - 0 - ]; - let rotation = [ - 0, - 0, - 0, - 0 - ]; - if (transitionFinal) { - position = Array.from((_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.cameraTransitioner.vPosition.to); - rotation = Array.from((_d = (_c = this.presenter) === null || _c === void 0 ? void 0 : _c.morphchartsref) === null || _d === void 0 ? void 0 : _d.cameraTransitioner.qRotation.to); + } + function legendRange(colorBinType, column, legend2, clickedIndex) { + if (column.quantitative) { + return selectQuantitative(colorBinType, column, legend2, clickedIndex); + } else { + return selectCategorical(column, legend2, clickedIndex); + } + } + function selectCategorical(column, legend2, clickedIndex) { + const value2 = legend2.rows[clickedIndex].value; + if (value2 === Other) { + const values2 = []; + for (const i in legend2.rows) { + if (+i !== clickedIndex) { + values2.push(legend2.rows[i].value); + } + } + return selectNone(column, values2); + } else { + return { expressions: [selectExact(column, legend2.rows[clickedIndex].value)] }; + } + } + function selectQuantitative(colorBinType, column, legend2, clickedIndex) { + const keys2 = Object.keys(legend2.rows).map((key2) => +key2).sort((a2, b2) => +a2 - +b2); + let lowValue; + let lowOperator; + let highValue; + let highOperator; + const rowText = legend2.rows[clickedIndex].label; + switch (colorBinType) { + case "continuous": { + lowValue = rowText; + if (clickedIndex < keys2.length - 1) { + highValue = legend2.rows[clickedIndex + 1].value; + } + break; + } + default: { + if (rowText.indexOf("null") > 0) { + const ex = { + expressions: [selectNullOrEmpty(column)] + }; + return ex; + } + const dash = rowText.indexOf("–"); + if (dash > 0) { + lowValue = rowText.substr(0, dash); + highValue = rowText.substr(dash + 1); } else { - const camera = (_g = (_f = (_e = this.presenter) === null || _e === void 0 ? void 0 : _e.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; - if (camera) { - camera.getPosition(position); - camera.getOrbit(rotation); + if (rowText.indexOf("<") >= 0) { + highValue = rowText.substring(2); + } else { + if (rowText.indexOf("≥") >= 0) { + lowValue = rowText.substring(2); } + } } - return { - position, - rotation, - captureSize: this.insight.size - }; + } } - /** - * Sets the current camera. - * @param camera Camera to set. - */ setCamera(camera) { - var _a, _b; - if (camera) (_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphChartsRenderResult) === null || _b === void 0 || _b.moveCamera(camera); + if (lowValue) + lowValue = notNice(lowValue); + if (highValue) + highValue = notNice(highValue); + if (lowValue === highValue) { + return { expressions: [selectExact(column, lowValue)] }; + } else { + return selectBetween(column, lowValue, highValue, lowOperator, highOperator); } - /** - * Gets the current insight with signal values. - */ getInsight() { - const insight = Object.assign({}, this.insight); - insight.signalValues = this.getSignalValues(); - return insight; + } + function finalizeLegend(colorBinType, colorColumn, legend2, language) { + const rowTexts = []; + for (const i in legend2.rows) { + const row = legend2.rows[i]; + row.search = legendRange(colorBinType, colorColumn, legend2, +i); + if (row.value === Other) { + row.label = language.legendOther; + } else { + rowTexts.push(row.value); + } } - /** - * Gets column stats from current data (filtered or all). - * @param column Column to get stats for. - */ getColumnStats(column) { - return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; + } + function assignOrdinals(columns, data2, ordinalMap) { + const uCol = columns.uid && columns.uid.name; + if (ordinalMap) { + data2.forEach((d, i) => { + const key2 = uCol ? d[uCol] : i; + d[GL_ORDINAL] = ordinalMap[key2]; + }); + } else { + ordinalMap = {}; + data2.forEach((d, i) => { + d[GL_ORDINAL] = i; + const uColValue = uCol ? d[uCol] : i; + ordinalMap[uColValue] = i; + }); } - /** - * Gets current signal values. - */ getSignalValues() { - return (0, _signals.extractSignalValuesFromView)(this.vegaViewGl, this.vegaSpec); + return ordinalMap; + } + function getDataIndexOfCube(cube, data2) { + const len2 = data2.length; + for (let i = 0; i < len2; i++) { + if (data2[i][GL_ORDINAL] === cube.ordinal) { + return i; + } } - assignTransitionStagger(transition) { - (0, _transition.assignTransitionStagger)(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + } + const { push } = util; + function getSearchGroupFromVegaValue(search) { + let group2; + const vegaSearch = search; + if (Array.isArray(vegaSearch)) { + group2 = { expressions: [] }; + vegaSearch.forEach((g) => { + const clonedExpressions = clone(g.expressions).filter(Boolean); + clonedExpressions[0].clause = "&&"; + push(group2.expressions, clonedExpressions); + }); + } else { + group2 = vegaSearch ? { expressions: vegaSearch.expressions.filter(Boolean) } : null; } - finalize() { - if (this._dataScope) this._dataScope.finalize(); - if (this._details) this._details.finalize(); - if (this._tooltip) this._tooltip.destroy(); - if (this.vegaViewGl) this.vegaViewGl.finalize(); - if (this.presenter) this.presenter.finalize(); - if (this.element) this.element.innerHTML = ''; - this.colorContexts = null; - this.element = null; - this.options = null; - this.presenter = null; - this.vegaSpec = null; - this.vegaViewGl = null; - this._animator = null; - this._dataScope = null; - this._details = null; - this._tooltip = null; + return group2; + } + function applySignalValues(sv, b2) { + if (!sv || !b2 || !b2.signals || !b2.signals.length) + return; + for (const key2 in sv) { + const value2 = sv[key2]; + const signalB = b2.signals.filter((signal) => signal.name === key2)[0]; + if (signalB && signalB.bind) { + signalB.value = value2; + } } -} -/** - * Default Viewer options. - */ Viewer.defaultViewerOptions = (0, _defaults.defaultViewerOptions); - -},{"./animator":"1AXDr","./axisSelection":"jfEq7","./colorCubes":"cZTFw","./colorSchemes":"5zZMK","./constants":"bKPI3","./dataScope":"jQzU5","./defaults":"Bp4lx","./details":"2e4Oi","./headers":"dlPiK","./legend":"9vqr8","./ordinal":"8SgLB","./search":"afgIb","./signals":"9hKiW","./tooltip":"f5HuJ","@msrvida/sanddance-specs":"jgrWB","@msrvida/search-expression":"epS5r","@msrvida/vega-morphcharts":"lOTjG","./characterSet":"g92YB","./transition":"ld56A","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1AXDr":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataLayoutChange", ()=>DataLayoutChange); -parcelHelpers.export(exports, "Animator", ()=>Animator); -var DataLayoutChange; -(function(DataLayoutChange) { - DataLayoutChange[DataLayoutChange["same"] = 0] = "same"; - DataLayoutChange[DataLayoutChange["reset"] = 1] = "reset"; - DataLayoutChange[DataLayoutChange["refine"] = 2] = "refine"; -})(DataLayoutChange || (DataLayoutChange = {})); -class Animator { - constructor(dataScope, props){ - this.dataScope = dataScope; - this.props = props; + } + function extractSignalValuesFromView(view, spec) { + if (!view || !spec || !spec.signals || !spec.signals.length) + return; + const result = {}; + spec.signals.forEach((signalA) => { + if (signalA.bind) { + try { + result[signalA.name] = view.signal(signalA.name); + } catch (e) { + } + } + }); + return result; + } + const hideSignalUI = [ + SignalNames.MarkOpacity, + SignalNames.TextAngleX, + SignalNames.TextAngleY + ]; + function unbindSignalUI(spec) { + spec.signals.forEach((signal) => { + if (hideSignalUI.indexOf(signal.name) >= 0) { + delete signal.bind; + } + }); + } + const { outerSize } = util; + const { Table } = controls; + class Tooltip { + constructor(props) { + this.props = props; + const renderProps = { + cssPrefix: props.cssPrefix, + rows: getRows(props.dataItem) + }; + this.finalizeHandler = () => this.destroy(); + this.element = renderTooltip(renderProps); + if (this.element) { + this.element.style.position = "absolute"; + this.child = this.element.firstChild; + document.body.appendChild(this.element); + let m2 = outerSize(this.child); + while (m2.height > document.documentElement.clientHeight) { + const tr2 = this.child.querySelector("tr:last-child"); + if (tr2) { + tr2.parentElement.removeChild(tr2); + } else { + break; + } + m2 = outerSize(this.child); + } + let position2; + const te = props.event; + if (te.touches) { + position2 = te[0]; + } else { + const pme = props.event; + position2 = pme; + } + if (position2.clientX + m2.width >= document.documentElement.clientWidth) { + this.child.style.right = "0"; + } + let moveTop = true; + if (position2.clientY + m2.height >= document.documentElement.clientHeight) { + if (position2.clientY - m2.height > 0) { + this.child.style.bottom = "0"; + } else { + moveTop = false; + } + } + if (moveTop) { + this.element.style.top = `${position2.clientY}px`; + } + this.element.style.left = `${position2.clientX}px`; + this.child.addEventListener("mouseenter", this.finalizeHandler); + this.child.addEventListener("mousemove", this.finalizeHandler); + this.child.addEventListener("mouseover", this.finalizeHandler); + } } - select(search) { - return new Promise((resolve, reject)=>{ - this.dataScope.select(search); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + destroy() { + this.child.removeEventListener("mouseenter", this.finalizeHandler); + this.child.removeEventListener("mousemove", this.finalizeHandler); + this.child.removeEventListener("mouseover", this.finalizeHandler); + if (this.element) { + document.body.removeChild(this.element); + } + this.element = null; } - deselect() { - return new Promise((resolve, reject)=>{ - this.dataScope.deselect(); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + } + function cleanDataItem(item) { + const ret = {}; + for (const columnName in item) { + if (columnName === GL_ORDINAL) { + continue; + } + if (isInternalFieldName(columnName)) { + continue; + } + ret[columnName] = item[columnName]; } - filter(search, keepData, collapseData, rebase) { - if (rebase) this.dataScope.collapse(false, keepData); - this.dataScope.collapse(true, collapseData); - return new Promise((resolve, reject)=>{ - this.props.onAnimateDataChange(DataLayoutChange.refine, 'before refine', 'refine').then(()=>{ - this.dataScope.deselect(); - this.dataScope.setFilteredData(keepData); - this.props.onDataChanged(DataLayoutChange.refine, search); - resolve(); - }).catch(reject); - }); + return ret; + } + function getRows(item) { + const rows = []; + for (const columnName in item) { + const value2 = item[columnName]; + let content2; + switch (value2) { + case null: + content2 = createElement("i", null, "null"); + break; + case void 0: + content2 = createElement("i", null, "undefined"); + break; + default: + content2 = value2.toString(); + } + rows.push({ + cells: [ + { content: columnName + ":" }, + { content: content2 } + ] + }); } - reset() { - return new Promise((resolve, reject)=>{ - this.dataScope.deselect(); - let time; - if (!this.dataScope.hasFilteredData()) time = 0; - else this.dataScope.setFilteredData(null); - this.props.onAnimateDataChange(DataLayoutChange.reset, 'before reset', 'reset', time).then(()=>{ - this.dataScope.collapse(false); - this.props.onDataChanged(DataLayoutChange.reset); - resolve(); - }).catch(reject); - }); + return rows; + } + const renderTooltip = (props) => { + return props.rows.length === 0 ? null : createElement("div", { className: `${props.cssPrefix}tooltip` }, Table({ rows: props.rows })); + }; + class CharacterSet { + resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { + if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) { + this.chars = void 0; + } } - activate(datum) { - return new Promise((resolve, reject)=>{ - this.dataScope.activate(datum); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); + getCharacterSet(stage) { + if (!this.chars) { + const map2 = {}; + const addText = (text2) => { + Array.from(text2).forEach((char) => { + map2[char] = true; + }); + }; + stage.textData.forEach((t) => addText(t.text)); + const { x: x2, y: y2 } = stage.axes; + [x2, y2].forEach((axes) => { + axes.forEach((axis) => { + if (axis.tickText) + axis.tickText.forEach((t) => addText(t.text)); + if (axis.title) + addText(axis.title.text); + }); }); + this.chars = Object.keys(map2); + } + return this.chars; } - deactivate() { - return new Promise((resolve, reject)=>{ - this.dataScope.deactivate(); - this.props.onDataChanged(DataLayoutChange.same); - resolve(); - }); + } + function needsNewCharacterSet(oldInsight, newInsight) { + if (!oldInsight) + return true; + if (!newInsight) + return true; + if (oldInsight.chart !== newInsight.chart) + return true; + if (oldInsight.facetStyle !== newInsight.facetStyle) + return true; + if (oldInsight.totalStyle !== newInsight.totalStyle) + return true; + if (oldInsight.hideAxes !== newInsight.hideAxes) + return true; + if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) + return true; + if (differentObjectValues(oldInsight.size, newInsight.size)) + return true; + const oldColumns = oldInsight.columns; + const newColumns = newInsight.columns; + if (oldColumns.facet !== newColumns.facet) + return true; + if (oldColumns.facetV !== newColumns.facetV) + return true; + if (oldColumns.x !== newColumns.x) + return true; + if (oldColumns.y !== newColumns.y) + return true; + if (oldColumns.z !== newColumns.z) + return true; + return false; + } + function differentObjectValues(a2, b2) { + if (!a2 && !b2) + return false; + if (!a2 || !b2) + return true; + const keys2 = Object.keys(b2); + for (let i = 0; i < keys2.length; i++) { + const key2 = keys2[i]; + const ta = typeof a2; + const tb = typeof b2; + if (ta !== tb) + return true; + if (ta === "object") { + return differentObjectValues(a2[key2], b2[key2]); + } else { + if (a2[key2] !== b2[key2]) + return true; + } } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jfEq7":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisSelection", ()=>AxisSelection); -parcelHelpers.export(exports, "moveTicksBetween", ()=>moveTicksBetween); -var _expression = require("./expression"); -const dimToRole = { - 0: 'x', - 1: 'y', - 2: 'z' -}; -const roleToDim = { - x: 0, - y: 1, - z: 1 -}; -class AxisSelection { - constructor(specCapabilities, columns, stage){ - this.specCapabilities = specCapabilities; - this.columns = columns; - this.stage = stage; + return false; + } + function assignTransitionStagger(transition, currentData, selection, presenter) { + const { layerStagger } = presenter.morphchartsref; + const { morphChartsRenderResult } = presenter; + const cubelayer = morphChartsRenderResult.getCubeLayer(); + const range2 = transition.reverse ? [1, 0] : [0, 1]; + if (!transition || transition.type === "ordinal" && !transition.reverse) { + delete layerStagger.cubes; + } else { + const staggerOrders = new Float64Array(cubelayer.positionsX.length); + switch (transition.type) { + case "ordinal": { + const scale2 = linear(range2).domain([0, currentData.length]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(i); + }); + break; + } + case "column": { + if (transition.column.quantitative) { + const values2 = new Float64Array(currentData.length); + currentData.forEach((datum2, i) => { + values2[i] = datum2[transition.column.name]; + }); + const stats = getStats(currentData, transition.column); + const scale2 = linear(range2).domain([stats.min, stats.max]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(values2[i]); + }); + } else { + const strings = new Array(currentData.length); + currentData.forEach((datum2, i) => { + strings[i] = datum2[transition.column.name]; + }); + getStats(currentData, transition.column, (distictValues) => { + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + const index2 = distictValues.indexOf(strings[i]); + const staggerOrder = index2 / distictValues.length; + staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; + }); + }); + } + break; + } + case "position": { + const dimensions = { + x: cubelayer.positionsX, + y: cubelayer.positionsY, + z: cubelayer.positionsZ + }; + const positions = dimensions[transition.dimension]; + const values2 = new Float64Array(currentData.length); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + values2[i] = positions[glOrdinal]; + }); + const stats = getStats(values2, null, "number", true); + const scale2 = linear(range2).domain([stats.min, stats.max]); + currentData.forEach((datum2, i) => { + const glOrdinal = datum2[GL_ORDINAL]; + staggerOrders[glOrdinal] = scale2(values2[i]); + }); + break; + } + } + layerStagger.cubes = { staggerOrders, maxStaggerOrder: 1, minStaggerOrder: 0 }; } - convert(divisions) { - const searchRoles = []; - divisions.forEach((division, i)=>{ - const role = dimToRole[i]; - const axes = this.stage.axes[role]; - //all axes in a faceted chart should be the same - const axis = axes.filter((axis)=>axis.tickText.length)[0]; - if (axis) { - const capabilities = this.specCapabilities.roles.filter((r)=>r.role === role)[0]; - const column = this.columns[role]; - if (division >= 0 && (capabilities === null || capabilities === void 0 ? void 0 : capabilities.axisSelection)) searchRoles.push({ - axis, - role, - capabilities, - column, - division - }); + cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); + } + var __awaiter = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + const { defaultView } = defaults; + const zAxisZindex = 1010; + let didRegisterColorSchemes = false; + class Viewer { + /** + * Instantiate a new Viewer. + * @param element Parent HTMLElement to present within. + * @param options Optional viewer options object. + */ + constructor(element2, options) { + this.element = element2; + this.options = deepMerge(defaultViewerOptions, options); + this.presenter = new Presenter(element2, getPresenterStyle(this.options)); + this._characterSet = new CharacterSet(); + this._dataScope = new DataScope(); + this._animator = new Animator(this._dataScope, { + onDataChanged: this.onDataChanged.bind(this), + onAnimateDataChange: this.onAnimateDataChange.bind(this) + }); + this._details = new Details(this.presenter.getElement(PresenterElement.panel), this.options.language, this._animator, this._dataScope, (remap) => { + this.currentColorContext = ~~remap; + this.renderSameLayout(); + }, () => this.insight && this.insight.columns && !!this.insight.columns.color && this.colorContexts && this.colorContexts.length > 1); + this.insight = {}; + } + changeColorContexts(colorContexts) { + this.colorContexts = colorContexts; + this.currentColorContext = 0; + this.options.onColorContextChange && this.options.onColorContextChange(); + } + applyLegendColorContext(colorContext) { + const a2 = getActiveElementInfo(); + mount(colorContext.legendElement, this.presenter.getElement(PresenterElement.legend)); + setActiveElement(a2); + this.presenter.stage.legend = colorContext.legend; + } + onAnimateDataChange(dataChange, waitingLabel, handlerLabel, time2) { + var _a; + if (time2 === void 0) { + const transitionDurations = ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) || defaultPresenterConfig.transitionDurations; + time2 = transitionDurations.position + transitionDurations.stagger; + } + return new Promise((resolve2, reject) => { + let innerPromise; + if (dataChange === DataLayoutChange.refine) { + const oldColorContext = this.colorContexts[this.currentColorContext]; + innerPromise = new Promise((innerResolve) => { + this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + cubeLayer.unitColorMap = oldColorContext.colorMap; + if (this.options.onStage) { + this.options.onStage(stage); + } + } })).then(() => { + this.applyLegendColorContext(oldColorContext); + innerResolve(); + }); + }); + } else { + innerPromise = this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, colorMapper) => { + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + this.overrideAxisLabels(stage); + if (this.options.onStage) { + this.options.onStage(stage); } - }); - switch(searchRoles.length){ - case 0: - return null; - case 1: - return this.getSearchFromSearchRole(searchRoles[0]); - default: - { - const roles = searchRoles.map((searchRole)=>this.getSearchFromSearchRole(searchRole)); - roles.forEach((role, i)=>{ - if (i === 0) return; - role.clause = '&&'; - }); - return roles; - } + } })); } + innerPromise.then(() => { + this.presenter.animationQueue(resolve2, time2, { waitingLabel, handlerLabel, animationCanceled: reject }); + }); + }); } - getSearchFromSearchRole(searchRole) { - const getSearch = searchRole.capabilities.axisSelection === 'exact' ? (a, c, i)=>({ - expressions: [ - (0, _expression.selectExactAxis)(a, c, i) - ] - }) : (0, _expression.selectBetweenAxis); - const { axis, column, division } = searchRole; - return getSearch(axis, column, division); - } -} -function moveTicksBetween(axes) { - axes.forEach((axis)=>{ - if (axis.ticks.length === 0) return; - const dim = roleToDim[axis.axisRole]; - const { color } = axis.ticks[0]; - const newLine = (value)=>{ - const line = { - sourcePosition: [ - 0, - 0, - 0 - ], - targetPosition: [ - 0, - 0, - 0 - ], - color + onDataChanged(dataLayout, filter2) { + return __awaiter(this, void 0, void 0, function* () { + switch (dataLayout) { + case DataLayoutChange.same: { + const hasSelectedData = this._dataScope.hasSelectedData(); + const hasActive = !!this._dataScope.active; + if (hasSelectedData || hasActive) { + this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); + } else { + this.presenter.morphChartsRenderResult.update({ cubes: null }); + } + break; + } + case DataLayoutChange.refine: { + const oldColorContext = this.colorContexts[this.currentColorContext]; + let colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { preStage: (stage, cubeLayer) => { + colorMap = cubeLayer.unitColorMap; + cubeLayer.unitColorMap = oldColorContext.colorMap; + this.preStage(stage, cubeLayer); + }, onPresent: () => { + const newColorContext = { + colorMap, + legend: clone(this.presenter.stage.legend), + legendElement: this.presenter.getElement(PresenterElement.legend).children[0] + }; + this.applyLegendColorContext(oldColorContext); + this.changeColorContexts([oldColorContext, newColorContext]); + this.onPresent(); + } })); + if (!compare(this.insight.filter, filter2)) { + this.insight.filter = narrow(this.insight.filter, filter2); + } + if (this.options.onDataFilter) { + this.options.onDataFilter(this.insight.filter, this._dataScope.currentData()); + } + break; + } + case DataLayoutChange.reset: { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null }; - line.sourcePosition[dim] = value; - return line; - }; - const newTicks = []; - newTicks.push(newLine(axis.domain.sourcePosition[dim])); - for(let i = 1; i < axis.ticks.length; i++)newTicks.push(newLine((axis.ticks[i].sourcePosition[dim] + axis.ticks[i - 1].sourcePosition[dim]) / 2)); - newTicks.push(newLine(axis.domain.targetPosition[dim])); - axis.ticks = newTicks; - }); -} - -},{"./expression":"6N86I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6N86I":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "notNice", ()=>notNice); -parcelHelpers.export(exports, "selectNullOrEmpty", ()=>selectNullOrEmpty); -parcelHelpers.export(exports, "selectExact", ()=>selectExact); -parcelHelpers.export(exports, "selectNone", ()=>selectNone); -parcelHelpers.export(exports, "selectExactAxis", ()=>selectExactAxis); -parcelHelpers.export(exports, "selectBetween", ()=>selectBetween); -parcelHelpers.export(exports, "selectBetweenAxis", ()=>selectBetweenAxis); -function notNice(niceValue) { - //convert "nice" numbers to numeric value - return (niceValue + '').replace(/[\s,]/g, ''); -} -function tickValue(axis, i) { - const tick = axis.tickText[i]; - let value; - if (tick) value = axis.tickText[i].value; - return { - tick, - value - }; -} -function selectNullOrEmpty(column) { - const searchExpression = { - name: column.name, - operator: 'isnullorEmpty' - }; - return searchExpression; -} -function selectExact(column, value) { - if (value == null) return selectNullOrEmpty(column); - const searchExpression = { - name: column.name, - operator: '==', - value - }; - return searchExpression; -} -function selectNone(column, values) { - const expressions = values.map((value, i)=>{ - const searchExpression = { - name: column.name, - operator: '!=', - value - }; - if (i) searchExpression.clause = '&&'; - return searchExpression; - }); - const searchExpressionGroup = { - expressions - }; - return searchExpressionGroup; -} -function selectExactAxis(axis, column, i) { - const result = tickValue(axis, i); - if (result.tick) return selectExact(column, result.value); -} -function selectBetween(column, lowValue, highValue, lowOperator = '>=', highOperator = '<') { - const expressions = []; - if (lowValue !== undefined) expressions.push({ - name: column.name, - operator: lowOperator, - value: lowValue - }); - if (highValue !== undefined) expressions.push({ - name: column.name, - operator: highOperator, - value: highValue - }); - if (expressions.length > 1) expressions[1].clause = '&&'; - const searchExpressionGroup = { - expressions - }; - return searchExpressionGroup; -} -function selectBetweenAxis(axis, column, i) { - const low = tickValue(axis, i); - const high = tickValue(axis, i + 1); - return selectBetween(column, low.value, high.value); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cZTFw":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "populateColorContext", ()=>populateColorContext); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -function populateColorContext(colorContext, presenter) { - if (!colorContext.colorMap) colorContext.colorMap = presenter.morphChartsRenderResult.getCubeLayer().unitColorMap; - colorContext.legend = _vegaMorphcharts.util.clone(presenter.stage.legend); - colorContext.legendElement = presenter.getElement(_vegaMorphcharts.PresenterElement.legend).children[0]; -} - -},{"@msrvida/vega-morphcharts":"lOTjG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jQzU5":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _searchExpression = require("@msrvida/search-expression"); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _constants = require("./constants"); -class DataScope { - constructor(){ - this.filteredColumnsStats = {}; + this.changeColorContexts([colorContext]); + this.presenter.morphChartsRenderResult.update({ cubes: null }); + yield this.renderNewLayout({}, Object.assign(Object.assign({}, this.setup || {}), { onPresent: () => { + populateColorContext(colorContext, this.presenter); + this.onPresent(); + } })); + delete this.insight.filter; + if (this.options.onDataFilter) { + this.options.onDataFilter(null, null); + } + break; + } + } + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel && sel.search || null, 0, sel && sel.selectedData || null); + } + }); } - setData(data, columns) { - const differentData = this.data !== data; - if (differentData) { - if (this.data) //clean up things we added to old data - this.deselect(); - this.data = data; - this.columns = columns; - this.filteredData = null; - this.filteredColumnsStats = {}; + convertSearchToSet() { + if (this._dataScope.selection) { + const s = /* @__PURE__ */ new Set(); + let found = false; + this._dataScope.selection.included.forEach((o, i) => { + s.add(o[GL_ORDINAL]); + found = true; + }); + if (!found) { + s.add(-1); } - return differentData; + return s; + } } - setFilteredData(filteredData) { - this.filteredData = filteredData; - this.filteredColumnsStats = {}; + convertSetToSearch(s) { + const search = { + expressions: [] + }; + s.forEach((value2) => { + search.expressions.push({ + name: GL_ORDINAL, + operator: "==", + value: value2, + clause: "||" + }); + }); + return search; } - getColumns(columnTypes) { - if (!this.columns) this.columns = (0, _sanddanceSpecs.getColumnsFromData)(_vegaMorphcharts.base.vega.inferTypes, this.data, columnTypes); - return this.columns; + getSpecColumnsWithFilteredStats() { + if (!this._dataScope.hasFilteredData()) { + return this._specColumns; + } + const roles = ["color", "facet", "group", "size", "sort", "sum", "x", "y", "z"]; + const specColumns = Object.assign({}, this._specColumns); + roles.forEach((r) => { + if (specColumns[r]) { + const column = Object.assign({}, specColumns[r]); + column.stats = this.getColumnStats(column); + specColumns[r] = column; + } + }); + return specColumns; } - getFilteredColumnStats(columnName) { - if (!this.filteredColumnsStats[columnName]) this.filteredColumnsStats[columnName] = (0, _sanddanceSpecs.getStats)(this.filteredData, this.columns.filter((c)=>c.name === columnName)[0]); - return this.filteredColumnsStats[columnName]; + renderNewLayout(signalValues, presenterConfig, view) { + return __awaiter(this, void 0, void 0, function* () { + const currData = this._dataScope.currentData(); + const context2 = { + specColumns: this.getSpecColumnsWithFilteredStats(), + insight: this.insight, + specViewOptions: Object.assign(Object.assign({}, this.options), { zAxisOptions: { + showZAxis: true, + zIndex: zAxisZindex + }, collapseFacetAxes: true }) + }; + const specResult = build(context2, currData); + if (!specResult.errors) { + const uiValues = extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); + applySignalValues(Object.assign(Object.assign({}, uiValues), signalValues), specResult.vegaSpec); + unbindSignalUI(specResult.vegaSpec); + this.vegaSpec = specResult.vegaSpec; + this.options.onVegaSpec && this.options.onVegaSpec(this.vegaSpec); + this.specCapabilities = specResult.specCapabilities; + const config = this.createConfig(presenterConfig); + this._lastPresenterConfig = config.presenterConfig; + if (view) { + config.getView = () => view; + } + if (!didRegisterColorSchemes) { + registerColorSchemes(base.vega); + didRegisterColorSchemes = true; + } + try { + if (this.vegaViewGl) { + this.vegaViewGl.finalize(); + } + const runtime2 = base.vega.parse(this.vegaSpec); + this.vegaViewGl = new ViewGl(runtime2, config).renderer("morphcharts").initialize(this.element); + yield this.vegaViewGl.runAsync(); + const handler = (n, v) => { + this._characterSet.resetCharacterSet(true); + }; + this.vegaSpec.signals.forEach((s) => { + this.vegaViewGl.addSignalListener(s.name, handler); + }); + this.configForSignalCapture(config.presenterConfig); + } catch (e) { + specResult.errors = [e.message]; + } + if (!specResult.errors) { + ensureHeaders(this.presenter, this.options.language.headers); + } + } + if (specResult.errors) { + if (this.options.onError) { + this.options.onError(specResult.errors); + } else if (this.presenter.logger) { + this.presenter.logger(`errors rendering Vega spec:${specResult.errors.join("\n")}`); + } + } + return specResult; + }); } - currentData() { - return this.filteredData || this.data; + /** + * Render the same layout with new options. + * @param newViewerOptions New options object. + */ + renderSameLayout(newViewerOptions) { + const colorContext = this.colorContexts[this.currentColorContext]; + this.applyLegendColorContext(colorContext); + if (newViewerOptions) { + if (newViewerOptions.colors) { + const mcColors = this.getMorphChartsColors(); + this.presenter.configColors(mcColors); + this._lastPresenterConfig.morphChartsColors = mcColors; + } + this.options = deepMerge(this.options, newViewerOptions); + } + this.presenter.morphChartsRenderResult.getCubeLayer().unitColorMap = colorContext.colorMap; + this.presenter.morphChartsRenderResult.update({ cubes: this.convertSearchToSet() }); } - select(search) { - this.deselect(); - if (search) { - this.selection = this.createUserSelection(search, true, false); - if (this.selection.included.length) this.activate(this.selection.included[0]); + getView(view) { + if (view === void 0) { + if (this.presenter.view === null) { + return defaultView; + } else { + return this.presenter.view; } + } else { + return view; + } } - createUserSelection(search, assign, rebase) { - const exec = new (0, _searchExpression.Exec)(search, this.getColumns()); - const s = { - search, - included: [], - excluded: [] - }; - const data = rebase ? this.data : this.currentData(); - data.forEach((datum)=>{ - if (exec.run(datum)) { - if (assign) datum[(0, _sanddanceSpecs.FieldNames).Selected] = true; - s.included.push(datum); - } else s.excluded.push(datum); + transformData(values2, transform2) { + try { + const runtime2 = base.vega.parse({ + $schema: "https://vega.github.io/schema/vega/v4.json", + data: [{ + name: "source", + values: values2, + transform: transform2 + }] }); - return s; + new ViewGl(runtime2).run(); + } catch (e) { + } + return values2; } - deselect() { - this.deactivate(); - this.data.forEach((datum)=>{ - delete datum[(0, _sanddanceSpecs.FieldNames).Selected]; - }); - this.selection = null; + /** + * Render data into a visualization. + * @param insightSetup InsightSetup object to create a visualization rendering. + * @param data Array of data objects. + * @param renderOptions Optional RenderOptions object. + */ + render(insightSetup_1, data_1) { + return __awaiter(this, arguments, void 0, function* (insightSetup, data2, renderOptions = {}) { + const { insight: insight2, setup: setup2 } = insightSetup; + let result; + if (!compare(insight2.filter, this.insight.filter)) { + const transitionDurations = (setup2 === null || setup2 === void 0 ? void 0 : setup2.transitionDurations) || defaultPresenterConfig.transitionDurations; + const renderTime = transitionDurations.position + transitionDurations.stagger; + const allowAsyncRenderTime = renderTime + this.options.filterRenderingTimerPadding; + if (insight2.filter) { + result = yield this._render(insightSetup, data2, renderOptions, true); + this.presenter.animationQueue(() => { + this.filter(insight2.filter, renderOptions.rebaseFilter && renderOptions.rebaseFilter()); + }, allowAsyncRenderTime, { waitingLabel: "layout before refine", handlerLabel: "refine after layout" }); + } else { + this._dataScope.setFilteredData(null); + result = yield this._render(insightSetup, data2, renderOptions, true); + this.presenter.animationQueue(() => { + this.reset(); + }, allowAsyncRenderTime, { waitingLabel: "layout before reset", handlerLabel: "reset after layout" }); + } + } else { + result = yield this._render(insightSetup, data2, renderOptions, false); + } + return result; + }); } - hasFilteredData() { - return !!this.filteredData; + shouldViewstateTransition(newInsight, oldInsight) { + if (!oldInsight.columns) + return false; + if (oldInsight.chart !== newInsight.chart) + return true; + if (oldInsight.size.height !== newInsight.size.height) + return true; + if (oldInsight.size.width !== newInsight.size.width) + return true; + if (oldInsight.columns.facet !== newInsight.columns.facet) + return true; + return false; } - hasSelectedData() { - return !!this.selection; + configForSignalCapture(presenterConfig) { + const colorContext = { + colorMap: null, + legend: null, + legendElement: null + }; + presenterConfig.preStage = (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) { + colorContext.colorMap = cubeLayer.unitColorMap; + } + this.preStage(stage, cubeLayer); + }; + presenterConfig.onPresent = () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + this._dataScope.deselect(); + } + this.onPresent(); + }; } - collapse(collapsed, data = this.data) { - data.forEach((datum)=>{ - datum[(0, _sanddanceSpecs.FieldNames).Collapsed] = collapsed; - }); - this.isCollapsed = collapsed; + onPresent() { + var _a; + if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transition) { + assignTransitionStagger(this.setup.transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); + } + this.options.onPresent && this.options.onPresent(); } - activate(datum) { - this.deactivate(); - datum[(0, _sanddanceSpecs.FieldNames).Active] = true; - this.active = datum; + _render(insightSetup, data2, renderOptions, forceNewCharacterSet) { + return __awaiter(this, void 0, void 0, function* () { + const { insight: insight2, setup: setup2 } = insightSetup; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (this._dataScope.setData(data2, renderOptions.columns)) { + this.transformData(data2, insight2.transform); + } + this._specColumns = getSpecColumns(insight2, this._dataScope.getColumns(renderOptions.columnTypes)); + const ordinalMap = assignOrdinals(this._specColumns, data2, renderOptions.ordinalMap); + this._characterSet.resetCharacterSet(forceNewCharacterSet, this.insight, insight2); + this.insight = clone(insight2); + this.setup = setup2; + this._shouldSaveColorContext = () => !renderOptions.initialColorContext; + const colorContext = renderOptions.initialColorContext || { + colorMap: null, + legend: null, + legendElement: null + }; + const specResult = yield this.renderNewLayout(insight2.signalValues, Object.assign(Object.assign({}, setup2 || {}), { preStage: (stage, cubeLayer) => { + if (this._shouldSaveColorContext()) { + colorContext.colorMap = cubeLayer.unitColorMap; + } else { + cubeLayer.unitColorMap = colorContext.colorMap; + } + const hasSelectedData = !!this._dataScope.hasSelectedData(); + if (hasSelectedData || this._dataScope.active) ; + this.preStage(stage, cubeLayer); + }, onPresent: () => { + if (this._shouldSaveColorContext()) { + populateColorContext(colorContext, this.presenter); + this.changeColorContexts([colorContext]); + } else { + this.applyLegendColorContext(colorContext); + } + this.onPresent(); + }, shouldViewstateTransition: () => this.shouldViewstateTransition(insight2, this.insight) }), this.getView(insight2.view)); + this._shouldSaveColorContext = () => !renderOptions.discardColorContextUpdates || !renderOptions.discardColorContextUpdates(); + this._details.render(); + const result = { ordinalMap, specResult }; + return result; + }); } - deactivate() { - if (this.active) delete this.active[(0, _sanddanceSpecs.FieldNames).Active]; - this.active = null; - } - ordinalIndexWithinSelection(ordinal) { - if (this.selection) for(let i = 0; i < this.selection.included.length; i++){ - const datum = this.selection.included[i]; - if (datum[0, _constants.GL_ORDINAL] === ordinal) return { - datum, - index: i - }; + overrideAxisLabels(stage) { + } + preLayer(stage) { + let axisRole; + for (axisRole in stage.axes) { + const capability = this.specCapabilities.roles.filter((r) => r.role === axisRole)[0]; + if (capability && (capability.axisSelectionBetweenTicks || capability.axisSelection === "exact")) { + moveTicksBetween(stage.axes[axisRole]); } - return { - datum: null, - index: -1 - }; + } } - finalize() { - this.data = null; - this.filteredData = null; - this.filteredColumnsStats = null; - if (this.selection) { - this.selection.excluded = null; - this.selection.included = null; - this.selection = null; - } - } -} - -},{"@msrvida/vega-morphcharts":"lOTjG","@msrvida/search-expression":"epS5r","@msrvida/sanddance-specs":"jgrWB","./constants":"bKPI3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2e4Oi":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Details", ()=>Details); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _defaults = require("./defaults"); -var _constants = require("./constants"); -var _searchExpression = require("@msrvida/search-expression"); -var _util = require("./util"); -var Action; -(function(Action) { - Action[Action["deselect"] = 0] = "deselect"; - Action[Action["isolate"] = 1] = "isolate"; - Action[Action["exclude"] = 2] = "exclude"; - Action[Action["reset"] = 3] = "reset"; - Action[Action["next"] = 4] = "next"; - Action[Action["previous"] = 5] = "previous"; -})(Action || (Action = {})); -class Details { - constructor(parentElement, language, animator, dataScope, colorMapHandler, hasColorMaps){ - this.language = language; - this.animator = animator; - this.dataScope = dataScope; - this.colorMapHandler = colorMapHandler; - this.hasColorMaps = hasColorMaps; - this.element = (0, _vegaMorphcharts.util).addDiv(parentElement, `${(0, _defaults.cssPrefix)}unitControls`); - this.clear(); + preStage(stage, cubeLayer) { + this.overrideAxisLabels(stage); + this._axisSelection = new AxisSelection(this.specCapabilities, this._specColumns, stage); + finalizeLegend(this.insight.colorBin, this._specColumns.color, stage.legend, this.options.language); + if (this.options.onStage) { + this.options.onStage(stage); + } } - finalize() { - if (this.element) this.element.innerHTML = ''; - this.dataScope = null; - this.element = null; + onCubeClick(e, cube) { + this.options.onCubeClick && this.options.onCubeClick(e, cube); + const hasSelectedData = this._dataScope.hasSelectedData(); + if (hasSelectedData && this._dataScope.selection.included.length > 1) { + const indexWithinSelection = this._dataScope.ordinalIndexWithinSelection(cube.ordinal); + if (indexWithinSelection.index >= 0) { + this.activate(indexWithinSelection.datum); + this._details.populate(this._dataScope.selection, indexWithinSelection.index); + if (this.options.onSelectionChanged) { + const sel = this.getSelection(); + this.options.onSelectionChanged(sel.search, indexWithinSelection.index, sel.selectedData); + } + return; + } + } + if (hasSelectedData && this._dataScope.selection.included.length === 1 && this._dataScope.selection.included[0][GL_ORDINAL] === cube.ordinal) { + this.deselect(); + return; + } + const search = { + name: GL_ORDINAL, + operator: "==", + value: cube.ordinal + }; + this.select(search); + } + onCubeHover(event2, cube) { + var _a, _b; + if (this._tooltip) { + this._tooltip.destroy(); + this._tooltip = null; + } + if (!cube) { + return; + } + const currentData = this._dataScope.currentData(); + const index2 = getDataIndexOfCube(cube, currentData); + if (index2 >= 0) { + const dataItem = cleanDataItem(((_a = this.options.tooltipOptions) === null || _a === void 0 ? void 0 : _a.prepareDataItem(currentData[index2])) || currentData[index2]); + const tooltipCreateOptions = { + dataItem, + event: event2 + }; + if ((_b = this.options.tooltipOptions) === null || _b === void 0 ? void 0 : _b.create) { + this._tooltip = this.options.tooltipOptions.create(tooltipCreateOptions); + } else { + this._tooltip = new Tooltip(Object.assign(Object.assign({}, tooltipCreateOptions), { cssPrefix: this.presenter.style.cssPrefix })); + } + } } - clear() { - this.state = { - userSelection: null, - index: -1, - remapColor: false - }; - this.render(); + onTextHover(e, t) { + if (!t || !this.options.getTextColor || !this.options.getTextHighlightColor) + return false; + return !colorIsEqual(this.options.getTextColor(t), this.options.getTextHighlightColor(t)); } - clearSelection() { - this.state.userSelection = null; - this.state.index = -1; - this.render(); - } - populate(userSelection, index = 0) { - this.state.userSelection = userSelection; - this.state.index = index; - this.render(); - } - selectByNameValue(columnName, value) { - const search = { - name: columnName, - operator: '==', - value + getMorphChartsColors() { + const { colors: colors2 } = this.options; + return { + activeItemColor: colors2.activeCube, + axesGridBackgroundColor: colors2.backgroundColor, + axesGridHighlightColor: colors2.axisSelectHighlight, + axesGridMajorColor: colors2.gridLine, + axesGridMinorColor: colors2.gridLine, + axesGridZeroColor: colors2.gridLine, + axesTextHeadingColor: colors2.axisText, + axesTextLabelColor: colors2.axisText, + axesTextTitleColor: colors2.axisText, + backgroundColor: colors2.backgroundColor, + textBorderColor: colors2.backgroundColor, + textColor: colors2.axisText + }; + } + createConfig(c2) { + var _a; + const { getTextColor, getTextHighlightColor, onTextClick } = this.options; + const defaultPresenterConfig2 = { + morphChartsColors: this.getMorphChartsColors(), + zAxisZindex, + getCharacterSet: (stage) => this._characterSet.getCharacterSet(stage), + getTextColor, + getTextHighlightColor, + onTextClick: (e, t) => { + if (t.metaData && t.metaData.search) { + const search = getSearchGroupFromVegaValue(t.metaData.search); + if (this.options.onAxisClick) { + this.options.onAxisClick(e, search); + } else { + this.select(search); + } + } + if (onTextClick) { + onTextClick(e, t); + } + }, + onCubeClick: this.onCubeClick.bind(this), + onCubeHover: this.onCubeHover.bind(this), + onTextHover: this.onTextHover.bind(this), + preLayer: this.preLayer.bind(this), + preStage: this.preStage.bind(this), + onPresent: this.onPresent.bind(this), + onAxisConfig: (cartesian2, dim3d, axis) => { + if (!axis) + return; + const role = this.specCapabilities.roles.filter((r) => r.role === axis.axisRole)[0]; + if (role === null || role === void 0 ? void 0 : role.axisSelection) { + cartesian2.isDivisionPickingEnabled[dim3d] = true; + cartesian2.arePickDivisionsVisible[dim3d] = axis.tickText.length > 0; + cartesian2.isLabelPickingEnabled[dim3d] = true; + cartesian2.isTitlePickingEnabled[dim3d] = true; + cartesian2.isHeadingPickingEnabled[dim3d] = true; + cartesian2.isGridPickingEnabled = false; + } + }, + onAxesComplete: (cartesian2) => { + }, + axisPickGridCallback: (divisions, e) => { + const search = this._axisSelection.convert(divisions); + if (this.options.onAxisClick) { + this.options.onAxisClick(e, search); + } else { + this.select(search); + } + }, + onLayerClick: (e) => { + this.options.onCanvasClick && this.options.onCanvasClick(e); + this.deselect(); + }, + onLegendClick: (e, legend2, clickedIndex) => { + const legendRow = clickedIndex !== null && legend2.rows[clickedIndex]; + if (legendRow) { + if (this.options.onLegendRowClick) { + this.options.onLegendRowClick(e, legendRow); + } else { + this.select(legendRow.search); + } + } else if (this.options.onLegendHeaderClick) { + this.options.onLegendHeaderClick(e); + } + }, + onSceneRectAssignCubeOrdinal: (datum2) => { + return datum2[GL_ORDINAL]; + }, + onTargetViewState: (h2, w2) => { + const { height: height2, width: width2 } = this.insight.size; + let newViewStateTarget; + if (this.options.onNewViewStateTarget) { + newViewStateTarget = this.options.onNewViewStateTarget(); + } + return { height: height2, width: width2, newViewStateTarget }; + }, + layerSelection: { + cubes: this.convertSearchToSet() + }, + preserveDrawingBuffer: this.options.preserveDrawingBuffer + }; + if (!this.options.disableLasso) { + defaultPresenterConfig2.onLasso = (ids, e) => { + this.deselect(); + const search = this.convertSetToSearch(ids); + this.select(search); + }; + } + if (this.options.onBeforeCreateLayers) { + defaultPresenterConfig2.preLayer = (stage) => { + this.preLayer(stage); + this.options.onBeforeCreateLayers(stage, this.specCapabilities); }; - this.clearSelection(); - this.animator.select(search); - this.populate(this.dataScope.selection); + } + const config = { + presenter: this.presenter, + presenterConfig: Object.assign(defaultPresenterConfig2, c2) + }; + if ((_a = this.setup) === null || _a === void 0 ? void 0 : _a.transitionDurations) { + config.presenterConfig.transitionDurations = this.setup.transitionDurations; + } + return config; } - remapChanged(remap) { - this.state.remapColor = remap; - this.colorMapHandler(remap); - this.render(); + /** + * Filter the data and animate. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + * @param rebase Optional flag to apply to entire dataset. A false value will apply the filter upon any existing filter. + */ + filter(search, rebase = false) { + const u2 = this._dataScope.createUserSelection(search, false, rebase); + return new Promise((resolve2, reject) => { + this._animator.filter(search, u2.included, u2.excluded, rebase).then(() => { + this._details.clear(); + this._details.clearSelection(); + this._details.populate(this._dataScope.selection); + resolve2(); + }); + }); } - handleAction(action) { - let p; - const u = this.state.userSelection; - switch(action){ - case Action.deselect: - this.clearSelection(); - p = this.animator.deselect(); - break; - case Action.exclude: - this.clearSelection(); - p = this.animator.filter((0, _searchExpression.invert)(u.search), u.excluded, u.included, false); - this.state.remapColor = false; - break; - case Action.isolate: - this.clearSelection(); - p = this.animator.filter(u.search, u.included, u.excluded, false); - this.state.remapColor = false; - break; - case Action.reset: - this.clear(); - p = this.animator.reset(); - break; - default: - switch(action){ - case Action.previous: - this.state.index--; - if (this.state.index < 0) this.state.index = this.state.userSelection.included.length - 1; - break; - case Action.next: - this.state.index++; - if (this.state.index >= this.state.userSelection.included.length) this.state.index = 0; - break; - } - this.render(); - p = this.animator.activate(this.state.userSelection.included[this.state.index]); - } - p.then(()=>this.render()); + /** + * Remove any filtration and animate. + */ + reset() { + return new Promise((resolve2, reject) => { + this._animator.reset().then(() => { + this._details.clear(); + this._details.clearSelection(); + resolve2(); + }); + }); } - render() { - const hasRefinedData = this.dataScope.hasFilteredData(); - const renderProps = { - language: this.language, - actionHandler: (action)=>this.handleAction(action), - selectionHandler: (columnName, value)=>this.selectByNameValue(columnName, value), - count: this.state.userSelection && this.state.userSelection.included.length, - hasRefinedData, - item: this.state.userSelection && this.state.userSelection.included[this.state.index], - remapColorHandler: (remap)=>this.remapChanged(remap), - hasColorMaps: this.hasColorMaps() && hasRefinedData, - remapColor: this.state.remapColor - }; - const a = _vegaMorphcharts.util.getActiveElementInfo(); - _vegaMorphcharts.util.mount(renderDetails(renderProps), this.element); - _vegaMorphcharts.util.setActiveElement(a); + /** + * Select cubes by a filter expression. + * @param search Filter expression, see https://vega.github.io/vega/docs/expressions/ + */ + select(search) { + return new Promise((resolve2, reject) => { + this._animator.select(search).then(() => { + this._details.populate(this._dataScope.selection); + resolve2(); + }); + }); } -} -const renderDetails = (props)=>{ - const controlButtons = [ - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.deselect) - }, props.language.deselect), - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.isolate) - }, props.language.isolate), - _vegaMorphcharts.util.createElement("button", { - disabled: !props.item, - onClick: (e)=>props.actionHandler(Action.exclude) - }, props.language.exclude) - ]; - const colorMapping = _vegaMorphcharts.util.createElement("div", null, _vegaMorphcharts.util.createElement("button", { - disabled: props.remapColor, - onClick: (e)=>props.remapColorHandler(true) - }, props.language.newColorMap), _vegaMorphcharts.util.createElement("button", { - disabled: !props.remapColor, - onClick: (e)=>props.remapColorHandler(false) - }, props.language.oldColorMap)); - const singleItem = props.count === 1; - const scrollButtons = [ - _vegaMorphcharts.util.createElement("button", { - disabled: singleItem, - onClick: (e)=>props.actionHandler(Action.previous) - }, props.language.previousDetail), - _vegaMorphcharts.util.createElement("button", { - disabled: singleItem, - onClick: (e)=>props.actionHandler(Action.next) - }, props.language.nextDetail), - _vegaMorphcharts.util.createElement("span", null, " ", props.language.selectionCount(props.count)) - ]; - const rows = []; - for(const prop in props.item){ - if (prop === (0, _constants.GL_ORDINAL)) continue; - if ((0, _util.isInternalFieldName)(prop)) continue; - rows.push({ - cells: [ - { - content: prop - }, - { - content: linkSelect(props.language, prop, props.item[prop], props.selectionHandler) - } - ] + /** + * Removes any selection. + */ + deselect() { + return new Promise((resolve2, reject) => { + this._animator.deselect().then(() => { + this._details.clearSelection(); + resolve2(); }); + }); } - return _vegaMorphcharts.util.createElement("div", null, props.hasColorMaps && colorMapping, _vegaMorphcharts.util.createElement("h4", null, props.language.headers.selection), _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}selection` - }, controlButtons, _vegaMorphcharts.util.createElement("button", { - disabled: !props.hasRefinedData, - onClick: (e)=>props.actionHandler(Action.reset) - }, "reset")), props.item && _vegaMorphcharts.util.createElement("h4", null, props.language.headers.details), _vegaMorphcharts.util.createElement("div", null, _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}details-scroll` - }, props.item && scrollButtons), _vegaMorphcharts.util.createElement("div", { - className: `${(0, _defaults.cssPrefix)}details` - }, props.item && _vegaMorphcharts.util.createElement((0, _vegaMorphcharts.controls).Table, { - rows: rows - })))); -}; -function linkSelect(language, columnName, value, selectionHandler) { - return _vegaMorphcharts.util.createElement("span", null, _vegaMorphcharts.util.createElement("a", { - href: "#", - onClick: (e)=>selectionHandler(columnName, value) - }, value), isNaN(value) ? [ - ' ', - _vegaMorphcharts.util.createElement("a", { - className: "bing-search", - href: `https://www.bing.com/search?q=${encodeURIComponent(value)}`, - target: "_blank" - }, language.bing) - ] : ''); -} - -},{"@msrvida/vega-morphcharts":"lOTjG","./defaults":"Bp4lx","./constants":"bKPI3","@msrvida/search-expression":"epS5r","./util":"lwXkM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dlPiK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ensureHeaders", ()=>ensureHeaders); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -function ensureHeaders(presenter, headers) { - const vegaControls = presenter.getElement((0, _vegaMorphcharts.PresenterElement).vegaControls); - conditionalHeader(!!vegaControls.querySelectorAll('.vega-bindings > *').length, vegaControls, headers.chart); - const legend = presenter.getElement((0, _vegaMorphcharts.PresenterElement).legend); - conditionalHeader(!!legend.children.length, legend, headers.legend); -} -function conditionalHeader(condition, element, header) { - const existing = existingHeader(element, header); - if (condition && !existing) addHeader(element, header); - if (!condition && existing) existing.remove(); -} -function addHeader(element, header) { - const h = document.createElement('h4'); - h.innerHTML = header; - element.insertAdjacentElement('beforebegin', h); -} -function existingHeader(element, header) { - const { previousElementSibling } = element; - if (previousElementSibling && previousElementSibling.innerHTML === header) return previousElementSibling; -} - -},{"@msrvida/vega-morphcharts":"lOTjG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9vqr8":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "finalizeLegend", ()=>finalizeLegend); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _expression = require("./expression"); -function legendRange(colorBinType, column, legend, clickedIndex) { - if (column.quantitative) return selectQuantitative(colorBinType, column, legend, clickedIndex); - else return selectCategorical(column, legend, clickedIndex); -} -function selectCategorical(column, legend, clickedIndex) { - const value = legend.rows[clickedIndex].value; - if (value === (0, _sanddanceSpecs.Other)) { - const values = []; - for(const i in legend.rows)if (+i !== clickedIndex) values.push(legend.rows[i].value); - return (0, _expression.selectNone)(column, values); - } else //select equal - return { - expressions: [ - (0, _expression.selectExact)(column, legend.rows[clickedIndex].value) - ] - }; -} -function selectQuantitative(colorBinType, column, legend, clickedIndex) { - const keys = Object.keys(legend.rows).map((key)=>+key).sort((a, b)=>+a - +b); - let lowValue; - let lowOperator; - let highValue; - let highOperator; - const rowText = legend.rows[clickedIndex].label; - switch(colorBinType){ - case 'continuous': - lowValue = rowText; - if (clickedIndex < keys.length - 1) highValue = legend.rows[clickedIndex + 1].value; - break; - default: - { - if (rowText.indexOf('null') > 0) { - const ex = { - expressions: [ - (0, _expression.selectNullOrEmpty)(column) - ] - }; - return ex; - } - const dash = rowText.indexOf("\u2013"); //this is not the common dash character! - if (dash > 0) { - //bug in Vega for quantize? - //lowOperator = '>'; - //highOperator = '<='; - lowValue = rowText.substr(0, dash); - highValue = rowText.substr(dash + 1); - } else { - if (rowText.indexOf('<') >= 0) highValue = rowText.substring(2); - else if (rowText.indexOf("\u2265") >= 0) lowValue = rowText.substring(2); - } - } + /** + * Gets the current selection. + */ + getSelection() { + if (!this._dataScope) + return null; + const selectionState = { + search: this._dataScope.selection && this._dataScope.selection.search || null, + selectedData: this._dataScope.selection && this._dataScope.selection.included || null, + active: this._dataScope.active + }; + return selectionState; } - if (lowValue) lowValue = (0, _expression.notNice)(lowValue); - if (highValue) highValue = (0, _expression.notNice)(highValue); - if (lowValue === highValue) return { - expressions: [ - (0, _expression.selectExact)(column, lowValue) - ] - }; - else return (0, _expression.selectBetween)(column, lowValue, highValue, lowOperator, highOperator); -} -function finalizeLegend(colorBinType, colorColumn, legend, language) { - const rowTexts = []; - for(const i in legend.rows){ - const row = legend.rows[i]; - row.search = legendRange(colorBinType, colorColumn, legend, +i); - if (row.value === (0, _sanddanceSpecs.Other)) row.label = language.legendOther; - else rowTexts.push(row.value); - } -} - -},{"@msrvida/sanddance-specs":"jgrWB","./expression":"6N86I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8SgLB":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assignOrdinals", ()=>assignOrdinals); -parcelHelpers.export(exports, "getDataIndexOfCube", ()=>getDataIndexOfCube); -var _constants = require("./constants"); -function assignOrdinals(columns, data, ordinalMap) { - const uCol = columns.uid && columns.uid.name; - if (ordinalMap) data.forEach((d, i)=>{ - const key = uCol ? d[uCol] : i; - d[0, _constants.GL_ORDINAL] = ordinalMap[key]; - }); - else { - ordinalMap = {}; - data.forEach((d, i)=>{ - d[0, _constants.GL_ORDINAL] = i; - const uColValue = uCol ? d[uCol] : i; - ordinalMap[uColValue] = i; + /** + * Set one data row to the active state. + */ + activate(datum2) { + return new Promise((resolve2, reject) => { + this._animator.activate(datum2).then(() => { + this.presenter.morphChartsRenderResult.activate(datum2[GL_ORDINAL]); + this._details.render(); + resolve2(); }); + }); } - return ordinalMap; -} -function getDataIndexOfCube(cube, data) { - const len = data.length; - for(let i = 0; i < len; i++){ - if (data[i][0, _constants.GL_ORDINAL] === cube.ordinal) return i; - } -} - -},{"./constants":"bKPI3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"afgIb":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getSearchGroupFromVegaValue", ()=>getSearchGroupFromVegaValue); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _array = require("./array"); -function getSearchGroupFromVegaValue(search) { - let group; - const vegaSearch = search; - if (Array.isArray(vegaSearch)) { - //flatten into one group - group = { - expressions: [] - }; - vegaSearch.forEach((g)=>{ - const clonedExpressions = _vegaMorphcharts.util.clone(g.expressions).filter(Boolean); - clonedExpressions[0].clause = '&&'; - (0, _array.push)(group.expressions, clonedExpressions); - }); - } else group = vegaSearch ? { - expressions: vegaSearch.expressions.filter(Boolean) - } : null; - return group; -} - -},{"@msrvida/vega-morphcharts":"lOTjG","./array":"aVKH0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aVKH0":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "allTruthy", ()=>allTruthy); -parcelHelpers.export(exports, "concat", ()=>concat); -parcelHelpers.export(exports, "push", ()=>push); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -const { allTruthy, concat, push } = (0, _vegaMorphcharts.util); - -},{"@msrvida/vega-morphcharts":"lOTjG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9hKiW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applySignalValues", ()=>applySignalValues); -parcelHelpers.export(exports, "extractSignalValuesFromView", ()=>extractSignalValuesFromView); -parcelHelpers.export(exports, "unbindSignalUI", ()=>unbindSignalUI); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -function applySignalValues(sv, b) { - if (!sv || !b || !b.signals || !b.signals.length) return; - for(const key in sv){ - const value = sv[key]; - const signalB = b.signals.filter((signal)=>signal.name === key)[0]; - if (signalB && signalB.bind) signalB.value = value; - } -} -function extractSignalValuesFromView(view, spec) { - if (!view || !spec || !spec.signals || !spec.signals.length) return; - const result = {}; - spec.signals.forEach((signalA)=>{ - //bound to a UI control - if (signalA.bind) try { - result[signalA.name] = view.signal(signalA.name); - } catch (e) { - // continue regardless of error + /** + * Deactivate item. + */ + deActivate() { + return new Promise((resolve2, reject) => { + if (this._dataScope && this._dataScope.active) { + this._animator.deactivate().then(() => { + this.presenter.morphChartsRenderResult.activate(-1); + this._details.render(); + resolve2(); + }); + } else { + resolve2(); } - }); - return result; -} -//signals not capable of handling with MorphCharts -const hideSignalUI = [ - (0, _sanddanceSpecs.SignalNames).MarkOpacity, - (0, _sanddanceSpecs.SignalNames).TextAngleX, - (0, _sanddanceSpecs.SignalNames).TextAngleY -]; -function unbindSignalUI(spec) { - spec.signals.forEach((signal)=>{ - if (hideSignalUI.indexOf(signal.name) >= 0) delete signal.bind; - }); -} - -},{"@msrvida/sanddance-specs":"jgrWB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f5HuJ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Tooltip", ()=>Tooltip); -parcelHelpers.export(exports, "cleanDataItem", ()=>cleanDataItem); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -var _constants = require("./constants"); -var _util = require("./util"); -const { outerSize } = _vegaMorphcharts.util; -const { Table } = _vegaMorphcharts.controls; -class Tooltip { - constructor(props){ - this.props = props; - const renderProps = { - cssPrefix: props.cssPrefix, - rows: getRows(props.dataItem) - }; - this.finalizeHandler = ()=>this.destroy(); - this.element = renderTooltip(renderProps); - if (this.element) { - this.element.style.position = 'absolute'; - this.child = this.element.firstChild; - document.body.appendChild(this.element); - //measure and move as necessary - let m = outerSize(this.child); - while(m.height > document.documentElement.clientHeight){ - const tr = this.child.querySelector('tr:last-child'); - if (tr) tr.parentElement.removeChild(tr); - else break; - m = outerSize(this.child); - } - let position; - const te = props.event; - if (te.touches) position = te[0]; - else { - const pme = props.event; - position = pme; - } - if (position.clientX + m.width >= document.documentElement.clientWidth) this.child.style.right = '0'; - let moveTop = true; - if (position.clientY + m.height >= document.documentElement.clientHeight) { - if (position.clientY - m.height > 0) this.child.style.bottom = '0'; - else moveTop = false; - } - if (moveTop) this.element.style.top = `${position.clientY}px`; - this.element.style.left = `${position.clientX}px`; - this.child.addEventListener('mouseenter', this.finalizeHandler); - this.child.addEventListener('mousemove', this.finalizeHandler); - this.child.addEventListener('mouseover', this.finalizeHandler); + }); + } + /** + * Gets the current camera. + * @param transitionFinal Optional flag to get camera destination when transition completes. + */ + getCamera(transitionFinal = false) { + var _a, _b, _c, _d, _e, _f, _g; + let position2 = [0, 0, 0]; + let rotation2 = [0, 0, 0, 0]; + if (transitionFinal) { + position2 = Array.from((_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphchartsref) === null || _b === void 0 ? void 0 : _b.cameraTransitioner.vPosition.to); + rotation2 = Array.from((_d = (_c = this.presenter) === null || _c === void 0 ? void 0 : _c.morphchartsref) === null || _d === void 0 ? void 0 : _d.cameraTransitioner.qRotation.to); + } else { + const camera = (_g = (_f = (_e = this.presenter) === null || _e === void 0 ? void 0 : _e.morphchartsref) === null || _f === void 0 ? void 0 : _f.core) === null || _g === void 0 ? void 0 : _g.camera; + if (camera) { + camera.getPosition(position2); + camera.getOrbit(rotation2); } + } + return { position: position2, rotation: rotation2, captureSize: this.insight.size }; } - destroy() { - this.child.removeEventListener('mouseenter', this.finalizeHandler); - this.child.removeEventListener('mousemove', this.finalizeHandler); - this.child.removeEventListener('mouseover', this.finalizeHandler); - if (this.element) document.body.removeChild(this.element); - this.element = null; - } -} -function cleanDataItem(item) { - const ret = {}; - for(const columnName in item){ - if (columnName === (0, _constants.GL_ORDINAL)) continue; - if ((0, _util.isInternalFieldName)(columnName)) continue; - ret[columnName] = item[columnName]; + /** + * Sets the current camera. + * @param camera Camera to set. + */ + setCamera(camera) { + var _a, _b; + if (camera) { + (_b = (_a = this.presenter) === null || _a === void 0 ? void 0 : _a.morphChartsRenderResult) === null || _b === void 0 ? void 0 : _b.moveCamera(camera); + } } - return ret; -} -function getRows(item) { - const rows = []; - for(const columnName in item){ - const value = item[columnName]; - let content; - switch(value){ - case null: - content = _vegaMorphcharts.util.createElement("i", null, "null"); - break; - case undefined: - content = _vegaMorphcharts.util.createElement("i", null, "undefined"); - break; - default: - content = value.toString(); - } - //} - rows.push({ - cells: [ - { - content: columnName + ':' - }, - { - content - } - ] - }); + /** + * Gets the current insight with signal values. + */ + getInsight() { + const insight2 = Object.assign({}, this.insight); + insight2.signalValues = this.getSignalValues(); + return insight2; } - return rows; -} -const renderTooltip = (props)=>{ - return props.rows.length === 0 ? null : _vegaMorphcharts.util.createElement("div", { - className: `${props.cssPrefix}tooltip` - }, Table({ - rows: props.rows - })); -}; - -},{"@msrvida/vega-morphcharts":"lOTjG","./constants":"bKPI3","./util":"lwXkM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g92YB":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CharacterSet", ()=>CharacterSet); -class CharacterSet { - resetCharacterSet(forceNewCharacterSet, oldInsight, newInsight) { - if (forceNewCharacterSet || needsNewCharacterSet(oldInsight, newInsight)) this.chars = undefined; + /** + * Gets column stats from current data (filtered or all). + * @param column Column to get stats for. + */ + getColumnStats(column) { + return this._dataScope.hasFilteredData() ? this._dataScope.getFilteredColumnStats(column.name) : column.stats; } - getCharacterSet(stage) { - if (!this.chars) { - const map = {}; - const addText = (text)=>{ - Array.from(text).forEach((char)=>{ - map[char] = true; - }); - }; - stage.textData.forEach((t)=>addText(t.text)); - const { x, y } = stage.axes; - [ - x, - y - ].forEach((axes)=>{ - axes.forEach((axis)=>{ - if (axis.tickText) axis.tickText.forEach((t)=>addText(t.text)); - if (axis.title) addText(axis.title.text); - }); - }); - this.chars = Object.keys(map); - } - return this.chars; - } -} -function needsNewCharacterSet(oldInsight, newInsight) { - if (!oldInsight) return true; - if (!newInsight) return true; - if (oldInsight.chart !== newInsight.chart) return true; - if (oldInsight.facetStyle !== newInsight.facetStyle) return true; - if (oldInsight.totalStyle !== newInsight.totalStyle) return true; - if (oldInsight.hideAxes !== newInsight.hideAxes) return true; - if (differentObjectValues(oldInsight.signalValues, newInsight.signalValues)) return true; - if (differentObjectValues(oldInsight.size, newInsight.size)) return true; - const oldColumns = oldInsight.columns; - const newColumns = newInsight.columns; - if (oldColumns.facet !== newColumns.facet) return true; - if (oldColumns.facetV !== newColumns.facetV) return true; - if (oldColumns.x !== newColumns.x) return true; - if (oldColumns.y !== newColumns.y) return true; - if (oldColumns.z !== newColumns.z) return true; - return false; -} -function differentObjectValues(a, b) { - if (!a && !b) return false; - if (!a || !b) return true; - const keys = Object.keys(b); - for(let i = 0; i < keys.length; i++){ - const key = keys[i]; - const ta = typeof a; - const tb = typeof b; - if (ta !== tb) return true; - if (ta === 'object') return differentObjectValues(a[key], b[key]); - else { - if (a[key] !== b[key]) return true; - } + /** + * Gets current signal values. + */ + getSignalValues() { + return extractSignalValuesFromView(this.vegaViewGl, this.vegaSpec); } - return false; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ld56A":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "assignTransitionStagger", ()=>assignTransitionStagger); -var _sanddanceSpecs = require("@msrvida/sanddance-specs"); -var _d3Scale = require("d3-scale"); -var _constants = require("./constants"); -function assignTransitionStagger(transition, currentData, selection, presenter) { - const { layerStagger } = presenter.morphchartsref; - const { morphChartsRenderResult } = presenter; - const cubelayer = morphChartsRenderResult.getCubeLayer(); - const range = transition.reverse ? [ - 1, - 0 - ] : [ - 0, - 1 - ]; - if (!transition || transition.type === 'ordinal' && !transition.reverse) delete layerStagger.cubes; - else { - const staggerOrders = new Float64Array(cubelayer.positionsX.length); - switch(transition.type){ - case 'ordinal': - { - //reverse ordinal - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - 0, - currentData.length - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(i); - }); - break; - } - case 'column': - if (transition.column.quantitative) { - const values = new Float64Array(currentData.length); - currentData.forEach((datum, i)=>{ - values[i] = datum[transition.column.name]; - }); - const stats = (0, _sanddanceSpecs.getStats)(currentData, transition.column); - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - stats.min, - stats.max - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(values[i]); - }); - } else { - const strings = new Array(currentData.length); - currentData.forEach((datum, i)=>{ - strings[i] = datum[transition.column.name]; - }); - (0, _sanddanceSpecs.getStats)(currentData, transition.column, (distictValues)=>{ - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - const index = distictValues.indexOf(strings[i]); - const staggerOrder = index / distictValues.length; - staggerOrders[glOrdinal] = transition.reverse ? 1 - staggerOrder : staggerOrder; - }); - }); - } - break; - case 'position': - { - const dimensions = { - x: cubelayer.positionsX, - y: cubelayer.positionsY, - z: cubelayer.positionsZ - }; - const positions = dimensions[transition.dimension]; - const values = new Float64Array(currentData.length); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - values[i] = positions[glOrdinal]; - }); - const stats = (0, _sanddanceSpecs.getStats)(values, null, 'number', true); - const scale = (0, _d3Scale.scaleLinear)(range).domain([ - stats.min, - stats.max - ]); - currentData.forEach((datum, i)=>{ - const glOrdinal = datum[0, _constants.GL_ORDINAL]; - staggerOrders[glOrdinal] = scale(values[i]); - }); - break; - } - } - layerStagger.cubes = { - staggerOrders, - maxStaggerOrder: 1, - minStaggerOrder: 0 - }; + assignTransitionStagger(transition) { + assignTransitionStagger(transition, this._dataScope.currentData(), this.convertSearchToSet(), this.presenter); } - cubelayer.update(morphChartsRenderResult.bounds, selection, layerStagger.cubes); -} - -},{"@msrvida/sanddance-specs":"jgrWB","d3-scale":"9G9pz","./constants":"bKPI3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewaNZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '4.0.6'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}]},["adfDD"], "adfDD", "parcelRequirec6f8", {}) - + finalize() { + if (this._dataScope) + this._dataScope.finalize(); + if (this._details) + this._details.finalize(); + if (this._tooltip) + this._tooltip.destroy(); + if (this.vegaViewGl) + this.vegaViewGl.finalize(); + if (this.presenter) + this.presenter.finalize(); + if (this.element) + this.element.innerHTML = ""; + this.colorContexts = null; + this.element = null; + this.options = null; + this.presenter = null; + this.vegaSpec = null; + this.vegaViewGl = null; + this._animator = null; + this._dataScope = null; + this._details = null; + this._tooltip = null; + } + } + Viewer.defaultViewerOptions = defaultViewerOptions; + const use = use$1; + const data = []; + const size = 100; + for (let x2 = 0; x2 < size; x2++) { + for (let y2 = 0; y2 < size; y2++) { + const id2 = x2 * y2; + const z = Math.random() * size * (x2 % 10) * (y2 % 10); + const w2 = Math.random() * size; + data.push({ id: id2, x: x2, y: y2, z, w: w2 }); + } + } + use(vega$1); + const viewer = new Viewer(document.getElementById("vis")); + const insight = { + columns: { + color: "z", + uid: "id", + x: "x", + y: "y", + z: "z" + }, + scheme: "blues", + size: { height: 500, width: 500 }, + chart: "scatterplot", + view: "3d" + }; + viewer.render({ insight }, data); +})); diff --git a/docs/tests/v4/es6/js/vega-morphcharts-test-es6.js b/docs/tests/v4/es6/js/vega-morphcharts-test-es6.js index 1c77ab8c5..f96daddfe 100644 --- a/docs/tests/v4/es6/js/vega-morphcharts-test-es6.js +++ b/docs/tests/v4/es6/js/vega-morphcharts-test-es6.js @@ -1,47129 +1,32614 @@ -// modules are defined as an array -// [ module function, map of requires ] -// -// map of requires is short require name -> numeric require -// -// anything defined in a previous bundle is accessed via the -// orig method which is the require for previous bundles - -(function ( - modules, - entry, - mainEntry, - parcelRequireName, - externals, - distDir, - publicUrl, - devServer -) { - /* eslint-disable no-undef */ - var globalObject = - typeof globalThis !== 'undefined' - ? globalThis - : typeof self !== 'undefined' - ? self - : typeof window !== 'undefined' - ? window - : typeof global !== 'undefined' - ? global - : {}; - /* eslint-enable no-undef */ - - // Save the require from previous bundle to this closure if any - var previousRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - - var importMap = previousRequire.i || {}; - var cache = previousRequire.cache || {}; - // Do not use `require` to prevent Webpack from trying to bundle this call - var nodeRequire = - typeof module !== 'undefined' && - typeof module.require === 'function' && - module.require.bind(module); - - function newRequire(name, jumped) { - if (!cache[name]) { - if (!modules[name]) { - if (externals[name]) { - return externals[name]; - } - // if we cannot find the module within our internal map or - // cache jump to the current global require ie. the last bundle - // that was added to the page. - var currentRequire = - typeof globalObject[parcelRequireName] === 'function' && - globalObject[parcelRequireName]; - if (!jumped && currentRequire) { - return currentRequire(name, true); - } - - // If there are other bundles on this page the require from the - // previous one is saved to 'previousRequire'. Repeat this as - // many times as there are bundles until the module is found or - // we exhaust the require chain. - if (previousRequire) { - return previousRequire(name, true); - } - - // Try the node require function if it exists. - if (nodeRequire && typeof name === 'string') { - return nodeRequire(name); - } - - var err = new Error("Cannot find module '" + name + "'"); - err.code = 'MODULE_NOT_FOUND'; - throw err; - } - - localRequire.resolve = resolve; - localRequire.cache = {}; - - var module = (cache[name] = new newRequire.Module(name)); - - modules[name][0].call( - module.exports, - localRequire, - module, - module.exports, - globalObject - ); - } - - return cache[name].exports; - - function localRequire(x) { - var res = localRequire.resolve(x); - return res === false ? {} : newRequire(res); - } - - function resolve(x) { - var id = modules[name][1][x]; - return id != null ? id : x; - } - } - - function Module(moduleName) { - this.id = moduleName; - this.bundle = newRequire; - this.require = nodeRequire; - this.exports = {}; - } - - newRequire.isParcelRequire = true; - newRequire.Module = Module; - newRequire.modules = modules; - newRequire.cache = cache; - newRequire.parent = previousRequire; - newRequire.distDir = distDir; - newRequire.publicUrl = publicUrl; - newRequire.devServer = devServer; - newRequire.i = importMap; - newRequire.register = function (id, exports) { - modules[id] = [ - function (require, module) { - module.exports = exports; - }, - {}, - ]; - }; - - // Only insert newRequire.load when it is actually used. - // The code in this file is linted against ES5, so dynamic import is not allowed. - // INSERT_LOAD_HERE - - Object.defineProperty(newRequire, 'root', { - get: function () { - return globalObject[parcelRequireName]; - }, - }); - - globalObject[parcelRequireName] = newRequire; - - for (var i = 0; i < entry.length; i++) { - newRequire(entry[i]); - } - - if (mainEntry) { - // Expose entry point to Node, AMD or browser globals - // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js - var mainExports = newRequire(mainEntry); - - // CommonJS - if (typeof exports === 'object' && typeof module !== 'undefined') { - module.exports = mainExports; - - // RequireJS - } else if (typeof define === 'function' && define.amd) { - define(function () { - return mainExports; - }); - } - } -})({"1dxDQ":[function(require,module,exports,__globalThis) { -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. -var _vega = require("vega"); -var _vegaMorphcharts = require("@msrvida/vega-morphcharts"); -_vegaMorphcharts.use(_vega); -class SpecRenderer { - constructor(){ - this.viewType = '2d'; - this.spec = null; - this.view = null; - const json = localStorage.getItem('spec'); - if (json) this.getTextArea().value = json; - } - toggleView() { - if (this.viewType === '3d') this.viewType = '2d'; - else this.viewType = '3d'; - this.getText(); - } - getTextArea() { - return document.getElementsByTagName('textarea')[0]; - } - getText() { - const textarea = this.getTextArea(); - const text = textarea.value; - const errorDiv = document.getElementById('error'); - const splitRight = document.getElementById('vis'); - try { - const spec = JSON.parse(text); - splitRight.style.opacity = '1'; - errorDiv.style.display = 'none'; - this.update(spec, text); - } catch (e) { - errorDiv.innerText = e; - errorDiv.style.display = ''; - splitRight.style.opacity = '0.1'; - } - } - update(spec, json) { - // stash the view - this.view; - const runtime = _vega.parse(spec); - //save in local storage - localStorage.setItem('spec', json); - this.view = new _vegaMorphcharts.ViewGl(runtime, { - getView: ()=>{ - return this.viewType; - }, - presenterConfig: { - onTargetViewState: (height, width)=>{ - return { - height, - width, - newViewStateTarget: false - }; - } - } - }).renderer('morphcharts').initialize(document.querySelector('#vis')); - this.view.run(); - } -} -const specRenderer = new SpecRenderer(); -window['vegaTest'] = { - vega: _vega, - specRenderer -}; - -},{"vega":"2BRQe","@msrvida/vega-morphcharts":"lOTjG"}],"2BRQe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>(0, _vegaDataflow.Dataflow)); -parcelHelpers.export(exports, "EventStream", ()=>(0, _vegaDataflow.EventStream)); -parcelHelpers.export(exports, "MultiPulse", ()=>(0, _vegaDataflow.MultiPulse)); -parcelHelpers.export(exports, "Operator", ()=>(0, _vegaDataflow.Operator)); -parcelHelpers.export(exports, "Parameters", ()=>(0, _vegaDataflow.Parameters)); -parcelHelpers.export(exports, "Pulse", ()=>(0, _vegaDataflow.Pulse)); -parcelHelpers.export(exports, "Transform", ()=>(0, _vegaDataflow.Transform)); -parcelHelpers.export(exports, "changeset", ()=>(0, _vegaDataflow.changeset)); -parcelHelpers.export(exports, "definition", ()=>(0, _vegaDataflow.definition)); -parcelHelpers.export(exports, "ingest", ()=>(0, _vegaDataflow.ingest)); -parcelHelpers.export(exports, "isTuple", ()=>(0, _vegaDataflow.isTuple)); -parcelHelpers.export(exports, "transform", ()=>(0, _vegaDataflow.transform)); -parcelHelpers.export(exports, "transforms", ()=>(0, _vegaDataflow.transforms)); -parcelHelpers.export(exports, "tupleid", ()=>(0, _vegaDataflow.tupleid)); -parcelHelpers.export(exports, "interpolate", ()=>(0, _vegaScale.interpolate)); -parcelHelpers.export(exports, "interpolateColors", ()=>(0, _vegaScale.interpolateColors)); -parcelHelpers.export(exports, "interpolateRange", ()=>(0, _vegaScale.interpolateRange)); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>(0, _vegaScale.quantizeInterpolator)); -parcelHelpers.export(exports, "scale", ()=>(0, _vegaScale.scale)); -parcelHelpers.export(exports, "scheme", ()=>(0, _vegaScale.scheme)); -parcelHelpers.export(exports, "projection", ()=>(0, _vegaProjection.projection)); -parcelHelpers.export(exports, "View", ()=>(0, _vegaView.View)); -parcelHelpers.export(exports, "defaultLocale", ()=>(0, _vegaFormat.defaultLocale)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _vegaFormat.numberFormatDefaultLocale)); -parcelHelpers.export(exports, "locale", ()=>(0, _vegaFormat.locale)); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>(0, _vegaFormat.resetDefaultLocale)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _vegaFormat.timeFormatDefaultLocale)); -parcelHelpers.export(exports, "expressionFunction", ()=>(0, _vegaFunctions.expressionFunction)); -parcelHelpers.export(exports, "parse", ()=>(0, _vegaParser.parse)); -parcelHelpers.export(exports, "runtimeContext", ()=>(0, _vegaRuntime.context)); -parcelHelpers.export(exports, "codegenExpression", ()=>(0, _vegaExpression.codegenExpression)); -parcelHelpers.export(exports, "parseExpression", ()=>(0, _vegaExpression.parseExpression)); -parcelHelpers.export(exports, "parseSelector", ()=>(0, _vegaEventSelector.parseSelector)); -parcelHelpers.export(exports, "version", ()=>version); -var _vegaUtil = require("vega-util"); -parcelHelpers.exportAll(_vegaUtil, exports); -var _vegaDataflow = require("vega-dataflow"); -var _vegaTransforms = require("vega-transforms"); -var _vegaViewTransforms = require("vega-view-transforms"); -var _vegaEncode = require("vega-encode"); -var _vegaGeo = require("vega-geo"); -var _vegaForce = require("vega-force"); -var _vegaHierarchy = require("vega-hierarchy"); -var _vegaLabel = require("vega-label"); -var _vegaRegression = require("vega-regression"); -var _vegaVoronoi = require("vega-voronoi"); -var _vegaWordcloud = require("vega-wordcloud"); -var _vegaCrossfilter = require("vega-crossfilter"); -var _vegaStatistics = require("vega-statistics"); -parcelHelpers.exportAll(_vegaStatistics, exports); -var _vegaTime = require("vega-time"); -parcelHelpers.exportAll(_vegaTime, exports); -var _vegaLoader = require("vega-loader"); -parcelHelpers.exportAll(_vegaLoader, exports); -var _vegaScenegraph = require("vega-scenegraph"); -parcelHelpers.exportAll(_vegaScenegraph, exports); -var _vegaScale = require("vega-scale"); -var _vegaProjection = require("vega-projection"); -var _vegaView = require("vega-view"); -var _vegaFormat = require("vega-format"); -var _vegaFunctions = require("vega-functions"); -var _vegaParser = require("vega-parser"); -var _vegaRuntime = require("vega-runtime"); -var _vegaExpression = require("vega-expression"); -var _vegaEventSelector = require("vega-event-selector"); -var version = "5.32.0"; -// -- Transforms ----- -(0, _vegaUtil.extend)((0, _vegaDataflow.transforms), _vegaTransforms, _vegaViewTransforms, _vegaEncode, _vegaGeo, _vegaForce, _vegaLabel, _vegaHierarchy, _vegaRegression, _vegaVoronoi, _vegaWordcloud, _vegaCrossfilter); - -},{"vega-util":"bApja","vega-dataflow":"3NitK","vega-transforms":"gA9mK","vega-view-transforms":"i63Ad","vega-encode":"fpesP","vega-geo":"3rF9B","vega-force":"4JCry","vega-hierarchy":"lserr","vega-label":"lZyUZ","vega-regression":"elv3U","vega-voronoi":"96rkJ","vega-wordcloud":"7Z7Aq","vega-crossfilter":"8iEZv","vega-statistics":"5ncfv","vega-time":"27kpp","vega-loader":"gmbOr","vega-scenegraph":"jattk","vega-scale":"bEydG","vega-projection":"4wv4C","vega-view":"cGC2i","vega-format":"47kOt","vega-functions":"iuqsd","vega-parser":"hsy9Z","vega-runtime":"k7ppL","vega-expression":"2l1no","vega-event-selector":"gXMNx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bApja":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Debug", ()=>Debug); -parcelHelpers.export(exports, "Error", ()=>Error$1); -parcelHelpers.export(exports, "Info", ()=>Info); -parcelHelpers.export(exports, "None", ()=>None); -parcelHelpers.export(exports, "Warn", ()=>Warn); -parcelHelpers.export(exports, "accessor", ()=>accessor); -parcelHelpers.export(exports, "accessorFields", ()=>accessorFields); -parcelHelpers.export(exports, "accessorName", ()=>accessorName); -parcelHelpers.export(exports, "array", ()=>array); -parcelHelpers.export(exports, "ascending", ()=>ascending); -parcelHelpers.export(exports, "clampRange", ()=>clampRange); -parcelHelpers.export(exports, "compare", ()=>compare); -parcelHelpers.export(exports, "constant", ()=>constant); -parcelHelpers.export(exports, "debounce", ()=>debounce); -parcelHelpers.export(exports, "error", ()=>error); -parcelHelpers.export(exports, "extend", ()=>extend); -parcelHelpers.export(exports, "extent", ()=>extent); -parcelHelpers.export(exports, "extentIndex", ()=>extentIndex); -parcelHelpers.export(exports, "falsy", ()=>falsy); -parcelHelpers.export(exports, "fastmap", ()=>fastmap); -parcelHelpers.export(exports, "field", ()=>field); -parcelHelpers.export(exports, "flush", ()=>flush); -parcelHelpers.export(exports, "hasOwnProperty", ()=>has); -parcelHelpers.export(exports, "id", ()=>id); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "inherits", ()=>inherits); -parcelHelpers.export(exports, "inrange", ()=>inrange); -parcelHelpers.export(exports, "isArray", ()=>isArray); -parcelHelpers.export(exports, "isBoolean", ()=>isBoolean); -parcelHelpers.export(exports, "isDate", ()=>isDate); -parcelHelpers.export(exports, "isFunction", ()=>isFunction); -parcelHelpers.export(exports, "isIterable", ()=>isIterable); -parcelHelpers.export(exports, "isNumber", ()=>isNumber); -parcelHelpers.export(exports, "isObject", ()=>isObject); -parcelHelpers.export(exports, "isRegExp", ()=>isRegExp); -parcelHelpers.export(exports, "isString", ()=>isString); -parcelHelpers.export(exports, "key", ()=>key); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "logger", ()=>logger); -parcelHelpers.export(exports, "lruCache", ()=>lruCache); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "mergeConfig", ()=>mergeConfig); -parcelHelpers.export(exports, "one", ()=>one); -parcelHelpers.export(exports, "pad", ()=>pad); -parcelHelpers.export(exports, "panLinear", ()=>panLinear); -parcelHelpers.export(exports, "panLog", ()=>panLog); -parcelHelpers.export(exports, "panPow", ()=>panPow); -parcelHelpers.export(exports, "panSymlog", ()=>panSymlog); -parcelHelpers.export(exports, "peek", ()=>peek); -parcelHelpers.export(exports, "quarter", ()=>quarter); -parcelHelpers.export(exports, "repeat", ()=>repeat); -parcelHelpers.export(exports, "span", ()=>span); -parcelHelpers.export(exports, "splitAccessPath", ()=>splitAccessPath); -parcelHelpers.export(exports, "stringValue", ()=>$); -parcelHelpers.export(exports, "toBoolean", ()=>toBoolean); -parcelHelpers.export(exports, "toDate", ()=>toDate); -parcelHelpers.export(exports, "toNumber", ()=>toNumber); -parcelHelpers.export(exports, "toSet", ()=>toSet); -parcelHelpers.export(exports, "toString", ()=>toString); -parcelHelpers.export(exports, "truncate", ()=>truncate); -parcelHelpers.export(exports, "truthy", ()=>truthy); -parcelHelpers.export(exports, "utcquarter", ()=>utcquarter); -parcelHelpers.export(exports, "visitArray", ()=>visitArray); -parcelHelpers.export(exports, "writeConfig", ()=>writeConfig); -parcelHelpers.export(exports, "zero", ()=>zero); -parcelHelpers.export(exports, "zoomLinear", ()=>zoomLinear); -parcelHelpers.export(exports, "zoomLog", ()=>zoomLog); -parcelHelpers.export(exports, "zoomPow", ()=>zoomPow); -parcelHelpers.export(exports, "zoomSymlog", ()=>zoomSymlog); -function accessor(fn, fields, name) { +(function(factory) { + typeof define === "function" && define.amd ? define(factory) : factory(); +})((function() { + "use strict"; + function accessor(fn, fields, name) { fn.fields = fields || []; fn.fname = name; return fn; -} -function accessorName(fn) { + } + function accessorName(fn) { return fn == null ? null : fn.fname; -} -function accessorFields(fn) { + } + function accessorFields(fn) { return fn == null ? null : fn.fields; -} -function getter(path) { - return path.length === 1 ? get1(path[0]) : getN(path); -} -const get1 = (field)=>function(obj) { - return obj[field]; - }; -const getN = (path)=>{ - const len = path.length; + } + function getter$1(path2) { + return path2.length === 1 ? get1(path2[0]) : getN(path2); + } + const get1 = (field2) => function(obj) { + return obj[field2]; + }; + const getN = (path2) => { + const len2 = path2.length; return function(obj) { - for(let i = 0; i < len; ++i)obj = obj[path[i]]; - return obj; + for (let i = 0; i < len2; ++i) { + obj = obj[path2[i]]; + } + return obj; }; -}; -function error(message) { + }; + function error(message) { throw Error(message); -} -function splitAccessPath(p) { - const path = [], n = p.length; - let q = null, b = 0, s = '', i, j, c; - p = p + ''; + } + function splitAccessPath(p) { + const path2 = [], n = p.length; + let q = null, b2 = 0, s = "", i, j, c2; + p = p + ""; function push() { - path.push(s + p.substring(i, j)); - s = ''; + path2.push(s + p.substring(i, j)); + s = ""; + i = j + 1; + } + for (i = j = 0; j < n; ++j) { + c2 = p[j]; + if (c2 === "\\") { + s += p.substring(i, j++); + i = j; + } else if (c2 === q) { + push(); + q = null; + b2 = -1; + } else if (q) { + continue; + } else if (i === b2 && c2 === '"') { + i = j + 1; + q = c2; + } else if (i === b2 && c2 === "'") { i = j + 1; + q = c2; + } else if (c2 === "." && !b2) { + if (j > i) { + push(); + } else { + i = j + 1; + } + } else if (c2 === "[") { + if (j > i) push(); + b2 = i = j + 1; + } else if (c2 === "]") { + if (!b2) error("Access path missing open bracket: " + p); + if (b2 > 0) push(); + b2 = 0; + i = j + 1; + } } - for(i = j = 0; j < n; ++j){ - c = p[j]; - if (c === '\\') { - s += p.substring(i, j++); - i = j; - } else if (c === q) { - push(); - q = null; - b = -1; - } else if (q) continue; - else if (i === b && c === '"') { - i = j + 1; - q = c; - } else if (i === b && c === "'") { - i = j + 1; - q = c; - } else if (c === '.' && !b) { - if (j > i) push(); - else i = j + 1; - } else if (c === '[') { - if (j > i) push(); - b = i = j + 1; - } else if (c === ']') { - if (!b) error('Access path missing open bracket: ' + p); - if (b > 0) push(); - b = 0; - i = j + 1; - } - } - if (b) error('Access path missing closing bracket: ' + p); - if (q) error('Access path missing closing quote: ' + p); + if (b2) error("Access path missing closing bracket: " + p); + if (q) error("Access path missing closing quote: " + p); if (j > i) { - j++; - push(); + j++; + push(); } - return path; -} -function field(field, name, opt) { - const path = splitAccessPath(field); - field = path.length === 1 ? path[0] : field; - return accessor((opt && opt.get || getter)(path), [ - field - ], name || field); -} -const id = field('id'); -const identity = accessor((_)=>_, [], 'identity'); -const zero = accessor(()=>0, [], 'zero'); -const one = accessor(()=>1, [], 'one'); -const truthy = accessor(()=>true, [], 'true'); -const falsy = accessor(()=>false, [], 'false'); -function log$1(method, level, input) { - const args = [ - level - ].concat([].slice.call(input)); - console[method].apply(console, args); // eslint-disable-line no-console -} -const None = 0; -const Error$1 = 1; -const Warn = 2; -const Info = 3; -const Debug = 4; -function logger(_, method) { - let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1; - let level = _ || None; + return path2; + } + function field$1(field2, name, opt) { + const path2 = splitAccessPath(field2); + field2 = path2.length === 1 ? path2[0] : field2; + return accessor((opt && opt.get || getter$1)(path2), [field2], name || field2); + } + const id = field$1("id"); + const identity$7 = accessor((_) => _, [], "identity"); + const zero$3 = accessor(() => 0, [], "zero"); + const one$2 = accessor(() => 1, [], "one"); + const truthy = accessor(() => true, [], "true"); + const falsy = accessor(() => false, [], "false"); + const DisallowedObjectProperties = /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + function log$1$1(method2, level, input) { + const args = [level].concat([].slice.call(input)); + console[method2].apply(console, args); + } + const None$2 = 0; + const Error$1 = 1; + const Warn = 2; + const Info = 3; + const Debug = 4; + function logger(_, method2, handler = log$1$1) { + let level = _ || None$2; return { - level (_) { - if (arguments.length) { - level = +_; - return this; - } else return level; - }, - error () { - if (level >= Error$1) handler(method || 'error', 'ERROR', arguments); - return this; - }, - warn () { - if (level >= Warn) handler(method || 'warn', 'WARN', arguments); - return this; - }, - info () { - if (level >= Info) handler(method || 'log', 'INFO', arguments); - return this; - }, - debug () { - if (level >= Debug) handler(method || 'log', 'DEBUG', arguments); - return this; + level(_2) { + if (arguments.length) { + level = +_2; + return this; + } else { + return level; } + }, + error() { + if (level >= Error$1) handler(method2 || "error", "ERROR", arguments); + return this; + }, + warn() { + if (level >= Warn) handler(method2 || "warn", "WARN", arguments); + return this; + }, + info() { + if (level >= Info) handler(method2 || "log", "INFO", arguments); + return this; + }, + debug() { + if (level >= Debug) handler(method2 || "log", "DEBUG", arguments); + return this; + } }; -} -var isArray = Array.isArray; -function isObject(_) { + } + var isArray = Array.isArray; + function isObject$1(_) { return _ === Object(_); -} -const isLegalKey = (key)=>key !== '__proto__'; -function mergeConfig() { - for(var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++)configs[_key] = arguments[_key]; - return configs.reduce((out, source)=>{ - for(const key in source)if (key === 'signals') // for signals, we merge the signals arrays - // source signals take precedence over - // existing signals with the same name - out.signals = mergeNamed(out.signals, source.signals); - else { - // otherwise, merge objects subject to recursion constraints - // for legend block, recurse for the layout entry only - // for style block, recurse for all properties - // otherwise, no recursion: objects overwrite, no merging - const r = key === 'legend' ? { - layout: 1 - } : key === 'style' ? true : null; - writeConfig(out, key, source[key], r); + } + const isLegalKey = (key2) => key2 !== "__proto__"; + function mergeConfig(...configs) { + return configs.reduce((out, source2) => { + for (const key2 in source2) { + if (key2 === "signals") { + out.signals = mergeNamed(out.signals, source2.signals); + } else { + const r = key2 === "legend" ? { + layout: 1 + } : key2 === "style" ? true : null; + writeConfig(out, key2, source2[key2], r); } - return out; + } + return out; }, {}); -} -function writeConfig(output, key, value, recurse) { - if (!isLegalKey(key)) return; + } + function writeConfig(output2, key2, value2, recurse2) { + if (!isLegalKey(key2)) return; let k, o; - if (isObject(value) && !isArray(value)) { - o = isObject(output[key]) ? output[key] : output[key] = {}; - for(k in value){ - if (recurse && (recurse === true || recurse[k])) writeConfig(o, k, value[k]); - else if (isLegalKey(k)) o[k] = value[k]; - } - } else output[key] = value; -} -function mergeNamed(a, b) { - if (a == null) return b; - const map = {}, out = []; - function add(_) { - if (!map[_.name]) { - map[_.name] = 1; - out.push(_); - } - } - b.forEach(add); - a.forEach(add); + if (isObject$1(value2) && !isArray(value2)) { + o = isObject$1(output2[key2]) ? output2[key2] : output2[key2] = {}; + for (k in value2) { + if (recurse2 && (recurse2 === true || recurse2[k])) { + writeConfig(o, k, value2[k]); + } else if (isLegalKey(k)) { + o[k] = value2[k]; + } + } + } else { + output2[key2] = value2; + } + } + function mergeNamed(a2, b2) { + if (a2 == null) return b2; + const map2 = {}, out = []; + function add2(_) { + if (!map2[_.name]) { + map2[_.name] = 1; + out.push(_); + } + } + b2.forEach(add2); + a2.forEach(add2); return out; -} -function peek(array) { - return array[array.length - 1]; -} -function toNumber(_) { - return _ == null || _ === '' ? null : +_; -} -const exp = (sign)=>(x)=>sign * Math.exp(x); -const log = (sign)=>(x)=>Math.log(sign * x); -const symlog = (c)=>(x)=>Math.sign(x) * Math.log1p(Math.abs(x / c)); -const symexp = (c)=>(x)=>Math.sign(x) * Math.expm1(Math.abs(x)) * c; -const pow = (exponent)=>(x)=>x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); -function pan(domain, delta, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), dd = (d1 - d0) * delta; - return [ - ground(d0 - dd), - ground(d1 - dd) - ]; -} -function panLinear(domain, delta) { - return pan(domain, delta, toNumber, identity); -} -function panLog(domain, delta) { - var sign = Math.sign(domain[0]); - return pan(domain, delta, log(sign), exp(sign)); -} -function panPow(domain, delta, exponent) { - return pan(domain, delta, pow(exponent), pow(1 / exponent)); -} -function panSymlog(domain, delta, constant) { - return pan(domain, delta, symlog(constant), symexp(constant)); -} -function zoom(domain, anchor, scale, lift, ground) { - const d0 = lift(domain[0]), d1 = lift(peek(domain)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; - return [ - ground(da + (d0 - da) * scale), - ground(da + (d1 - da) * scale) - ]; -} -function zoomLinear(domain, anchor, scale) { - return zoom(domain, anchor, scale, toNumber, identity); -} -function zoomLog(domain, anchor, scale) { - const sign = Math.sign(domain[0]); - return zoom(domain, anchor, scale, log(sign), exp(sign)); -} -function zoomPow(domain, anchor, scale, exponent) { - return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent)); -} -function zoomSymlog(domain, anchor, scale, constant) { - return zoom(domain, anchor, scale, symlog(constant), symexp(constant)); -} -function quarter(date) { - return 1 + ~~(new Date(date).getMonth() / 3); -} -function utcquarter(date) { - return 1 + ~~(new Date(date).getUTCMonth() / 3); -} -function array(_) { - return _ != null ? isArray(_) ? _ : [ - _ - ] : []; -} -/** - * Span-preserving range clamp. If the span of the input range is less - * than (max - min) and an endpoint exceeds either the min or max value, - * the range is translated such that the span is preserved and one - * endpoint touches the boundary of the min/max range. - * If the span exceeds (max - min), the range [min, max] is returned. - */ function clampRange(range, min, max) { - let lo = range[0], hi = range[1], span; + } + function peek$1(array2) { + return array2[array2.length - 1]; + } + function toNumber(_) { + return _ == null || _ === "" ? null : +_; + } + const exp$2 = (sign2) => (x2) => sign2 * Math.exp(x2); + const log$4 = (sign2) => (x2) => Math.log(sign2 * x2); + const symlog$1 = (c2) => (x2) => Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); + const symexp = (c2) => (x2) => Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + const pow$4 = (exponent2) => (x2) => x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); + function pan(domain2, delta, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), dd = (d1 - d0) * delta; + return [ground(d0 - dd), ground(d1 - dd)]; + } + function panLinear(domain2, delta) { + return pan(domain2, delta, toNumber, identity$7); + } + function panLog(domain2, delta) { + var sign2 = Math.sign(domain2[0]); + return pan(domain2, delta, log$4(sign2), exp$2(sign2)); + } + function panPow(domain2, delta, exponent2) { + return pan(domain2, delta, pow$4(exponent2), pow$4(1 / exponent2)); + } + function panSymlog(domain2, delta, constant2) { + return pan(domain2, delta, symlog$1(constant2), symexp(constant2)); + } + function zoom$1(domain2, anchor, scale2, lift, ground) { + const d0 = lift(domain2[0]), d1 = lift(peek$1(domain2)), da = anchor != null ? lift(anchor) : (d0 + d1) / 2; + return [ground(da + (d0 - da) * scale2), ground(da + (d1 - da) * scale2)]; + } + function zoomLinear(domain2, anchor, scale2) { + return zoom$1(domain2, anchor, scale2, toNumber, identity$7); + } + function zoomLog(domain2, anchor, scale2) { + const sign2 = Math.sign(domain2[0]); + return zoom$1(domain2, anchor, scale2, log$4(sign2), exp$2(sign2)); + } + function zoomPow(domain2, anchor, scale2, exponent2) { + return zoom$1(domain2, anchor, scale2, pow$4(exponent2), pow$4(1 / exponent2)); + } + function zoomSymlog(domain2, anchor, scale2, constant2) { + return zoom$1(domain2, anchor, scale2, symlog$1(constant2), symexp(constant2)); + } + function quarter(date2) { + return 1 + ~~(new Date(date2).getMonth() / 3); + } + function utcquarter(date2) { + return 1 + ~~(new Date(date2).getUTCMonth() / 3); + } + function array$5(_) { + return _ != null ? isArray(_) ? _ : [_] : []; + } + function clampRange(range2, min2, max2) { + let lo = range2[0], hi = range2[1], span2; if (hi < lo) { - span = hi; - hi = lo; - lo = span; - } - span = hi - lo; - return span >= max - min ? [ - min, - max - ] : [ - lo = Math.min(Math.max(lo, min), max - span), - lo + span - ]; -} -function isFunction(_) { - return typeof _ === 'function'; -} -const DESCENDING = 'descending'; -function compare(fields, orders, opt) { + span2 = hi; + hi = lo; + lo = span2; + } + span2 = hi - lo; + return span2 >= max2 - min2 ? [min2, max2] : [lo = Math.min(Math.max(lo, min2), max2 - span2), lo + span2]; + } + function isFunction(_) { + return typeof _ === "function"; + } + const DESCENDING = "descending"; + function compare$1(fields, orders, opt) { opt = opt || {}; - orders = array(orders) || []; - const ord = [], get = [], fmap = {}, gen = opt.comparator || comparator; - array(fields).forEach((f, i)=>{ - if (f == null) return; - ord.push(orders[i] === DESCENDING ? -1 : 1); - get.push(f = isFunction(f) ? f : field(f, null, opt)); - (accessorFields(f) || []).forEach((_)=>fmap[_] = 1); - }); - return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap)); -} -const ascending = (u, v)=>(u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0; -const comparator = (fields, orders)=>fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); -const compare1 = (field, order)=>function(a, b) { - return ascending(field(a), field(b)) * order; - }; -const compareN = (fields, orders, n)=>{ - orders.push(0); // pad zero for convenient lookup - return function(a, b) { - let f, c = 0, i = -1; - while(c === 0 && ++i < n){ - f = fields[i]; - c = ascending(f(a), f(b)); - } - return c * orders[i]; - }; -}; -function constant(_) { - return isFunction(_) ? _ : ()=>_; -} -function debounce(delay, handler) { + orders = array$5(orders) || []; + const ord = [], get2 = [], fmap = {}, gen = opt.comparator || comparator; + array$5(fields).forEach((f, i) => { + if (f == null) return; + ord.push(orders[i] === DESCENDING ? -1 : 1); + get2.push(f = isFunction(f) ? f : field$1(f, null, opt)); + (accessorFields(f) || []).forEach((_) => fmap[_] = 1); + }); + return get2.length === 0 ? null : accessor(gen(get2, ord), Object.keys(fmap)); + } + const ascending$2 = (u2, v) => (u2 < v || u2 == null) && v != null ? -1 : (u2 > v || v == null) && u2 != null ? 1 : (v = v instanceof Date ? +v : v, u2 = u2 instanceof Date ? +u2 : u2) !== u2 && v === v ? -1 : v !== v && u2 === u2 ? 1 : 0; + const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length); + const compare1 = (field2, order) => function(a2, b2) { + return ascending$2(field2(a2), field2(b2)) * order; + }; + const compareN = (fields, orders, n) => { + orders.push(0); + return function(a2, b2) { + let f, c2 = 0, i = -1; + while (c2 === 0 && ++i < n) { + f = fields[i]; + c2 = ascending$2(f(a2), f(b2)); + } + return c2 * orders[i]; + }; + }; + function constant$5(_) { + return isFunction(_) ? _ : () => _; + } + function debounce(delay, handler) { let tid; - return (e)=>{ - if (tid) clearTimeout(tid); - tid = setTimeout(()=>(handler(e), tid = null), delay); + return (e) => { + if (tid) clearTimeout(tid); + tid = setTimeout(() => (handler(e), tid = null), delay); }; -} -function extend(_) { - for(let x, k, i = 1, len = arguments.length; i < len; ++i){ - x = arguments[i]; - for(k in x)_[k] = x[k]; + } + function extend$1(_) { + for (let x2, k, i = 1, len2 = arguments.length; i < len2; ++i) { + x2 = arguments[i]; + for (k in x2) { + _[k] = x2[k]; + } } return _; -} -/** - * Return an array with minimum and maximum values, in the - * form [min, max]. Ignores null, undefined, and NaN values. - */ function extent(array, f) { - let i = 0, n, v, min, max; - if (array && (n = array.length)) { - if (f == null) { - // find first valid value - for(v = array[i]; i < n && (v == null || v !== v); v = array[++i]); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = array[i]; - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } - } else { - // find first valid value - for(v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i])); - min = max = v; - // visit all other values - for(; i < n; ++i){ - v = f(array[i]); - // skip null/undefined; NaN will fail all comparisons - if (v != null) { - if (v < min) min = v; - if (v > max) max = v; - } - } + } + function extent(array2, f) { + let i = 0, n, v, min2, max2; + if (array2 && (n = array2.length)) { + if (f == null) { + for (v = array2[i]; i < n && (v == null || v !== v); v = array2[++i]) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = array2[i]; + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } + } + } else { + for (v = f(array2[i]); i < n && (v == null || v !== v); v = f(array2[++i])) ; + min2 = max2 = v; + for (; i < n; ++i) { + v = f(array2[i]); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + } } + } } - return [ - min, - max - ]; -} -function extentIndex(array, f) { - const n = array.length; - let i = -1, a, b, c, u, v; + return [min2, max2]; + } + function extentIndex(array2, f) { + const n = array2.length; + let i = -1, a2, b2, c2, u2, v; if (f == null) { - while(++i < n){ - b = array[i]; - if (b != null && b >= b) { - a = c = b; - break; - } + while (++i < n) { + b2 = array2[i]; + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = array[i]; - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = array2[i]; + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } } + } } else { - while(++i < n){ - b = f(array[i], i, array); - if (b != null && b >= b) { - a = c = b; - break; - } + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null && b2 >= b2) { + a2 = c2 = b2; + break; } - if (i === n) return [ - -1, - -1 - ]; - u = v = i; - while(++i < n){ - b = f(array[i], i, array); - if (b != null) { - if (a > b) { - a = b; - u = i; - } - if (c < b) { - c = b; - v = i; - } - } + } + if (i === n) return [-1, -1]; + u2 = v = i; + while (++i < n) { + b2 = f(array2[i], i, array2); + if (b2 != null) { + if (a2 > b2) { + a2 = b2; + u2 = i; + } + if (c2 < b2) { + c2 = b2; + v = i; + } } + } } - return [ - u, - v - ]; -} -function has(object, property) { - return Object.hasOwn(object, property); -} -const NULL = {}; -function fastmap(input) { - let obj = {}, test; - function has$1(key) { - return has(obj, key) && obj[key] !== NULL; - } - const map = { - size: 0, - empty: 0, - object: obj, - has: has$1, - get (key) { - return has$1(key) ? obj[key] : undefined; - }, - set (key, value) { - if (!has$1(key)) { - ++map.size; - if (obj[key] === NULL) --map.empty; - } - obj[key] = value; - return this; - }, - delete (key) { - if (has$1(key)) { - --map.size; - ++map.empty; - obj[key] = NULL; - } - return this; - }, - clear () { - map.size = map.empty = 0; - map.object = obj = {}; - }, - test (_) { - if (arguments.length) { - test = _; - return map; - } else return test; - }, - clean () { - const next = {}; - let size = 0; - for(const key in obj){ - const value = obj[key]; - if (value !== NULL && (!test || !test(value))) { - next[key] = value; - ++size; - } - } - map.size = size; - map.empty = 0; - map.object = obj = next; + return [u2, v]; + } + function has$1(object2, property2) { + return Object.hasOwn(object2, property2); + } + const NULL = {}; + function fastmap(input) { + let obj = {}, test2; + function has$1$1(key2) { + return has$1(obj, key2) && obj[key2] !== NULL; + } + const map2 = { + size: 0, + empty: 0, + object: obj, + has: has$1$1, + get(key2) { + return has$1$1(key2) ? obj[key2] : void 0; + }, + set(key2, value2) { + if (!has$1$1(key2)) { + ++map2.size; + if (obj[key2] === NULL) --map2.empty; + } + obj[key2] = value2; + return this; + }, + delete(key2) { + if (has$1$1(key2)) { + --map2.size; + ++map2.empty; + obj[key2] = NULL; + } + return this; + }, + clear() { + map2.size = map2.empty = 0; + map2.object = obj = {}; + }, + test(_) { + if (arguments.length) { + test2 = _; + return map2; + } else { + return test2; } + }, + clean() { + const next = {}; + let size = 0; + for (const key2 in obj) { + const value2 = obj[key2]; + if (value2 !== NULL && (!test2 || !test2(value2))) { + next[key2] = value2; + ++size; + } + } + map2.size = size; + map2.empty = 0; + map2.object = obj = next; + } }; - if (input) Object.keys(input).forEach((key)=>{ - map.set(key, input[key]); + if (input) Object.keys(input).forEach((key2) => { + map2.set(key2, input[key2]); }); - return map; -} -function flush(range, value, threshold, left, right, center) { - if (!threshold && threshold !== 0) return center; - const t = +threshold; - let a = range[0], b = peek(range), l; - // swap endpoints if range is reversed - if (b < a) { - l = a; - a = b; - b = l; - } - // compare value to endpoints - l = Math.abs(value - a); - const r = Math.abs(b - value); - // adjust if value is within threshold distance of endpoint + return map2; + } + function flush(range2, value2, threshold2, left, right, center) { + if (!threshold2 && threshold2 !== 0) return center; + const t = +threshold2; + let a2 = range2[0], b2 = peek$1(range2), l; + if (b2 < a2) { + l = a2; + a2 = b2; + b2 = l; + } + l = Math.abs(value2 - a2); + const r = Math.abs(b2 - value2); return l < r && l <= t ? left : r <= t ? right : center; -} -function inherits(child, parent, members) { + } + function inherits(child, parent, members) { const proto = child.prototype = Object.create(parent.prototype); - Object.defineProperty(proto, 'constructor', { - value: child, - writable: true, - enumerable: true, - configurable: true + Object.defineProperty(proto, "constructor", { + value: child, + writable: true, + enumerable: true, + configurable: true }); - return extend(proto, members); -} -/** - * Predicate that returns true if the value lies within the span - * of the given range. The left and right flags control the use - * of inclusive (true) or exclusive (false) comparisons. - */ function inrange(value, range, left, right) { - let r0 = range[0], r1 = range[range.length - 1], t; + return extend$1(proto, members); + } + function inrange(value2, range2, left, right) { + let r0 = range2[0], r1 = range2[range2.length - 1], t; if (r0 > r1) { - t = r0; - r0 = r1; - r1 = t; - } - left = left === undefined || left; - right = right === undefined || right; - return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1); -} -function isBoolean(_) { - return typeof _ === 'boolean'; -} -function isDate(_) { - return Object.prototype.toString.call(_) === '[object Date]'; -} -function isIterable(_) { + t = r0; + r0 = r1; + r1 = t; + } + left = left === void 0 || left; + right = right === void 0 || right; + return (left ? r0 <= value2 : r0 < value2) && (right ? value2 <= r1 : value2 < r1); + } + function isBoolean$1(_) { + return typeof _ === "boolean"; + } + function isDate$1(_) { + return Object.prototype.toString.call(_) === "[object Date]"; + } + function isIterable(_) { return _ && isFunction(_[Symbol.iterator]); -} -function isNumber(_) { - return typeof _ === 'number'; -} -function isRegExp(_) { - return Object.prototype.toString.call(_) === '[object RegExp]'; -} -function isString(_) { - return typeof _ === 'string'; -} -function key(fields, flat, opt) { - if (fields) fields = flat ? array(fields).map((f)=>f.replace(/\\(.)/g, '$1')) : array(fields); - const len = fields && fields.length, gen = opt && opt.get || getter, map = (f)=>gen(flat ? [ - f - ] : splitAccessPath(f)); + } + function isNumber$1(_) { + return typeof _ === "number"; + } + function isRegExp(_) { + return Object.prototype.toString.call(_) === "[object RegExp]"; + } + function isString(_) { + return typeof _ === "string"; + } + function key$2(fields, flat, opt) { + if (fields) { + fields = flat ? array$5(fields).map((f) => f.replace(/\\(.)/g, "$1")) : array$5(fields); + } + const len2 = fields && fields.length, gen = opt && opt.get || getter$1, map2 = (f) => gen(flat ? [f] : splitAccessPath(f)); let fn; - if (!len) fn = function() { - return ''; - }; - else if (len === 1) { - const get = map(fields[0]); - fn = function(_) { - return '' + get(_); - }; + if (!len2) { + fn = function() { + return ""; + }; + } else if (len2 === 1) { + const get2 = map2(fields[0]); + fn = function(_) { + return "" + get2(_); + }; } else { - const get = fields.map(map); - fn = function(_) { - let s = '' + get[0](_), i = 0; - while(++i < len)s += '|' + get[i](_); - return s; - }; + const get2 = fields.map(map2); + fn = function(_) { + let s = "" + get2[0](_), i = 0; + while (++i < len2) s += "|" + get2[i](_); + return s; + }; } - return accessor(fn, fields, 'key'); -} -function lerp(array, frac) { - const lo = array[0], hi = peek(array), f = +frac; + return accessor(fn, fields, "key"); + } + function lerp$1(array2, frac) { + const lo = array2[0], hi = peek$1(array2), f = +frac; return !f ? lo : f === 1 ? hi : lo + f * (hi - lo); -} -const DEFAULT_MAX_SIZE = 10000; -// adapted from https://github.com/dominictarr/hashlru/ (MIT License) -function lruCache(maxsize) { + } + const DEFAULT_MAX_SIZE = 1e4; + function lruCache(maxsize) { maxsize = +maxsize || DEFAULT_MAX_SIZE; let curr, prev, size; - const clear = ()=>{ + const clear = () => { + curr = {}; + prev = {}; + size = 0; + }; + const update2 = (key2, value2) => { + if (++size > maxsize) { + prev = curr; curr = {}; - prev = {}; - size = 0; - }; - const update = (key, value)=>{ - if (++size > maxsize) { - prev = curr; - curr = {}; - size = 1; - } - return curr[key] = value; + size = 1; + } + return curr[key2] = value2; }; clear(); return { - clear, - has: (key)=>has(curr, key) || has(prev, key), - get: (key)=>has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined, - set: (key, value)=>has(curr, key) ? curr[key] = value : update(key, value) + clear, + has: (key2) => has$1(curr, key2) || has$1(prev, key2), + get: (key2) => has$1(curr, key2) ? curr[key2] : has$1(prev, key2) ? update2(key2, prev[key2]) : void 0, + set: (key2, value2) => has$1(curr, key2) ? curr[key2] = value2 : update2(key2, value2) }; -} -function merge(compare, array0, array1, output) { + } + function merge$3(compare2, array0, array1, output2) { const n0 = array0.length, n1 = array1.length; if (!n1) return array0; if (!n0) return array1; - const merged = output || new array0.constructor(n0 + n1); + const merged = output2 || new array0.constructor(n0 + n1); let i0 = 0, i1 = 0, i = 0; - for(; i0 < n0 && i1 < n1; ++i)merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; - for(; i0 < n0; ++i0, ++i)merged[i] = array0[i0]; - for(; i1 < n1; ++i1, ++i)merged[i] = array1[i1]; + for (; i0 < n0 && i1 < n1; ++i) { + merged[i] = compare2(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++]; + } + for (; i0 < n0; ++i0, ++i) { + merged[i] = array0[i0]; + } + for (; i1 < n1; ++i1, ++i) { + merged[i] = array1[i1]; + } return merged; -} -function repeat(str, reps) { - let s = ''; - while(--reps >= 0)s += str; + } + function repeat(str, reps) { + let s = ""; + while (--reps >= 0) s += str; return s; -} -function pad(str, length, padchar, align) { - const c = padchar || ' ', s = str + '', n = length - s.length; - return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n); -} -/** - * Return the numerical span of an array: the difference between - * the last and first values. - */ function span(array) { - return array && peek(array) - array[0] || 0; -} -function $(x) { - return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings. - // See http://timelessrepo.com/json-isnt-a-javascript-subset - JSON.stringify(x).replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') : x; -} -function toBoolean(_) { - return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_; -} -const defaultParser = (_)=>isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_); -function toDate(_, parser) { - parser = parser || defaultParser; - return _ == null || _ === '' ? null : parser(_); -} -function toString(_) { - return _ == null || _ === '' ? null : _ + ''; -} -function toSet(_) { + } + function pad$2(str, length2, padchar, align) { + const c2 = padchar || " ", s = str + "", n = length2 - s.length; + return n <= 0 ? s : align === "left" ? repeat(c2, n) + s : align === "center" ? repeat(c2, ~~(n / 2)) + s + repeat(c2, Math.ceil(n / 2)) : s + repeat(c2, n); + } + function span(array2) { + return array2 && peek$1(array2) - array2[0] || 0; + } + function $(x2) { + return isArray(x2) ? `[${x2.map((v) => v === null ? "null" : $(v))}]` : isObject$1(x2) || isString(x2) ? ( + // Output valid JSON and JS source strings. + // See https://github.com/judofyr/timeless/blob/master/posts/json-isnt-a-javascript-subset.md + JSON.stringify(x2).replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029") + ) : x2; + } + function toBoolean(_) { + return _ == null || _ === "" ? null : !_ || _ === "false" || _ === "0" ? false : !!_; + } + const defaultParser = (_) => isNumber$1(_) ? _ : isDate$1(_) ? _ : Date.parse(_); + function toDate(_, parser2) { + parser2 = parser2 || defaultParser; + return _ == null || _ === "" ? null : parser2(_); + } + function toString(_) { + return _ == null || _ === "" ? null : _ + ""; + } + function toSet(_) { const s = {}, n = _.length; - for(let i = 0; i < n; ++i)s[_[i]] = true; + for (let i = 0; i < n; ++i) s[_[i]] = true; return s; -} -function truncate(str, length, align, ellipsis) { - const e = ellipsis != null ? ellipsis : '\u2026', s = str + '', n = s.length, l = Math.max(0, length - e.length); - return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; -} -function visitArray(array, filter, visitor) { - if (array) { - if (filter) { - const n = array.length; - for(let i = 0; i < n; ++i){ - const t = filter(array[i]); - if (t) visitor(t, i, array); - } - } else array.forEach(visitor); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j7FRh":[function(require,module,exports,__globalThis) { -exports.interopDefault = function(a) { - return a && a.__esModule ? a : { - default: a - }; -}; -exports.defineInteropFlag = function(a) { - Object.defineProperty(a, '__esModule', { - value: true - }); -}; -exports.exportAll = function(source, dest) { - Object.keys(source).forEach(function(key) { - if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return; - Object.defineProperty(dest, key, { - enumerable: true, - get: function() { - return source[key]; - } - }); - }); - return dest; -}; -exports.export = function(dest, destName, get) { - Object.defineProperty(dest, destName, { - enumerable: true, - get: get - }); -}; - -},{}],"3NitK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Dataflow", ()=>Dataflow); -parcelHelpers.export(exports, "EventStream", ()=>EventStream); -parcelHelpers.export(exports, "MultiPulse", ()=>MultiPulse); -parcelHelpers.export(exports, "Operator", ()=>Operator); -parcelHelpers.export(exports, "Parameters", ()=>Parameters); -parcelHelpers.export(exports, "Pulse", ()=>Pulse); -parcelHelpers.export(exports, "Transform", ()=>Transform); -parcelHelpers.export(exports, "UniqueList", ()=>UniqueList); -parcelHelpers.export(exports, "asyncCallback", ()=>asyncCallback); -parcelHelpers.export(exports, "changeset", ()=>changeset); -parcelHelpers.export(exports, "definition", ()=>definition); -parcelHelpers.export(exports, "derive", ()=>derive); -parcelHelpers.export(exports, "ingest", ()=>ingest$1); -parcelHelpers.export(exports, "isChangeSet", ()=>isChangeSet); -parcelHelpers.export(exports, "isTuple", ()=>isTuple); -parcelHelpers.export(exports, "rederive", ()=>rederive); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "stableCompare", ()=>stableCompare); -parcelHelpers.export(exports, "transform", ()=>transform); -parcelHelpers.export(exports, "transforms", ()=>transforms); -parcelHelpers.export(exports, "tupleid", ()=>tupleid); -var _vegaUtil = require("vega-util"); -var _vegaLoader = require("vega-loader"); -var _vegaFormat = require("vega-format"); -function UniqueList(idFunc) { - const $ = idFunc || (0, _vegaUtil.identity), list = [], ids = {}; - list.add = (_)=>{ - const id = $(_); - if (!ids[id]) { - ids[id] = 1; - list.push(_); - } - return list; - }; - list.remove = (_)=>{ - const id = $(_); - if (ids[id]) { - ids[id] = 0; - const idx = list.indexOf(_); - if (idx >= 0) list.splice(idx, 1); - } - return list; - }; - return list; -} -/** - * Invoke and await a potentially async callback function. If - * an error occurs, trap it and route to Dataflow.error. - * @param {Dataflow} df - The dataflow instance - * @param {function} callback - A callback function to invoke - * and then await. The dataflow will be passed as the single - * argument to the function. - */ async function asyncCallback(df, callback) { - try { - await callback(df); - } catch (err) { - df.error(err); - } -} -const TUPLE_ID_KEY = Symbol('vega_id'); -let TUPLE_ID = 1; -/** - * Checks if an input value is a registered tuple. - * @param {*} t - The value to check. - * @return {boolean} True if the input is a tuple, false otherwise. - */ function isTuple(t) { - return !!(t && tupleid(t)); -} -/** - * Returns the id of a tuple. - * @param {object} t - The input tuple. - * @return {*} the tuple id. - */ function tupleid(t) { - return t[TUPLE_ID_KEY]; -} -/** - * Sets the id of a tuple. - * @param {object} t - The input tuple. - * @param {*} id - The id value to set. - * @return {object} the input tuple. - */ function setid(t, id) { - t[TUPLE_ID_KEY] = id; - return t; -} -/** - * Ingest an object or value as a data tuple. - * If the input value is an object, an id field will be added to it. For - * efficiency, the input object is modified directly. A copy is not made. - * If the input value is a literal, it will be wrapped in a new object - * instance, with the value accessible as the 'data' property. - * @param datum - The value to ingest. - * @return {object} The ingested data tuple. - */ function ingest$1(datum) { - const t = datum === Object(datum) ? datum : { - data: datum + } + function truncate$1(str, length2, align, ellipsis) { + const e = ellipsis != null ? ellipsis : "…", s = str + "", n = s.length, l = Math.max(0, length2 - e.length); + return n <= length2 ? s : align === "left" ? e + s.slice(n - l) : align === "center" ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e; + } + function visitArray(array2, filter2, visitor) { + if (array2) { + if (filter2) { + const n = array2.length; + for (let i = 0; i < n; ++i) { + const t = filter2(array2[i]); + if (t) visitor(t, i, array2); + } + } else { + array2.forEach(visitor); + } + } + } + var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; + function objectConverter(columns) { + return new Function("d", "return {" + columns.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + '] || ""'; + }).join(",") + "}"); + } + function customConverter(columns, f) { + var object2 = objectConverter(columns); + return function(row, i) { + return f(object2(row), i, columns); }; - return tupleid(t) ? t : setid(t, TUPLE_ID++); -} -/** - * Given a source tuple, return a derived copy. - * @param {object} t - The source tuple. - * @return {object} The derived tuple. - */ function derive(t) { - return rederive(t, ingest$1({})); -} -/** - * Rederive a derived tuple by copying values from the source tuple. - * @param {object} t - The source tuple. - * @param {object} d - The derived tuple. - * @return {object} The derived tuple. - */ function rederive(t, d) { - for(const k in t)d[k] = t[k]; - return d; -} -/** - * Replace an existing tuple with a new tuple. - * @param {object} t - The existing data tuple. - * @param {object} d - The new tuple that replaces the old. - * @return {object} The new tuple. - */ function replace(t, d) { - return setid(d, tupleid(t)); -} -/** - * Generate an augmented comparator function that provides stable - * sorting by tuple id when the given comparator produces ties. - * @param {function} cmp - The comparator to augment. - * @param {function} [f] - Optional tuple accessor function. - * @return {function} An augmented comparator function. - */ function stableCompare(cmp, f) { - return !cmp ? null : f ? (a, b)=>cmp(a, b) || tupleid(f(a)) - tupleid(f(b)) : (a, b)=>cmp(a, b) || tupleid(a) - tupleid(b); -} -function isChangeSet(v) { - return v && v.constructor === changeset; -} -function changeset() { - const add = [], // insert tuples - rem = [], // remove tuples - mod = [], // modify tuples - remp = [], // remove by predicate - modp = []; // modify by predicate - let clean = null, reflow = false; - return { - constructor: changeset, - insert (t) { - const d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)add.push(d[i]); - return this; - }, - remove (t) { - const a = (0, _vegaUtil.isFunction)(t) ? remp : rem, d = (0, _vegaUtil.array)(t), n = d.length; - for(let i = 0; i < n; ++i)a.push(d[i]); - return this; - }, - modify (t, field, value) { - const m = { - field: field, - value: (0, _vegaUtil.constant)(value) - }; - if ((0, _vegaUtil.isFunction)(t)) { - m.filter = t; - modp.push(m); - } else { - m.tuple = t; - mod.push(m); - } - return this; - }, - encode (t, set) { - if ((0, _vegaUtil.isFunction)(t)) modp.push({ - filter: t, - field: set - }); - else mod.push({ - tuple: t, - field: set - }); - return this; - }, - clean (value) { - clean = value; - return this; - }, - reflow () { - reflow = true; - return this; - }, - pulse (pulse, tuples) { - const cur = {}, out = {}; - let i, n, m, f, t, id; - // build lookup table of current tuples - for(i = 0, n = tuples.length; i < n; ++i)cur[tupleid(tuples[i])] = 1; - // process individual tuples to remove - for(i = 0, n = rem.length; i < n; ++i){ - t = rem[i]; - cur[tupleid(t)] = -1; - } - // process predicate-based removals - for(i = 0, n = remp.length; i < n; ++i){ - f = remp[i]; - tuples.forEach((t)=>{ - if (f(t)) cur[tupleid(t)] = -1; - }); - } - // process all add tuples - for(i = 0, n = add.length; i < n; ++i){ - t = add[i]; - id = tupleid(t); - if (cur[id]) // tuple already resides in dataset - // if flagged for both add and remove, cancel - cur[id] = 1; - else // tuple does not reside in dataset, add - pulse.add.push(ingest$1(add[i])); - } - // populate pulse rem list - for(i = 0, n = tuples.length; i < n; ++i){ - t = tuples[i]; - if (cur[tupleid(t)] < 0) pulse.rem.push(t); - } - // modify helper method - function modify(t, f, v) { - if (v) t[f] = v(t); - else pulse.encode = f; - if (!reflow) out[tupleid(t)] = t; - } - // process individual tuples to modify - for(i = 0, n = mod.length; i < n; ++i){ - m = mod[i]; - t = m.tuple; - f = m.field; - id = cur[tupleid(t)]; - if (id > 0) { - modify(t, f, m.value); - pulse.modifies(f); - } - } - // process predicate-based modifications - for(i = 0, n = modp.length; i < n; ++i){ - m = modp[i]; - f = m.filter; - tuples.forEach((t)=>{ - if (f(t) && cur[tupleid(t)] > 0) modify(t, m.field, m.value); - }); - pulse.modifies(m.field); - } - // upon reflow request, populate mod with all non-removed tuples - // otherwise, populate mod with modified tuples only - if (reflow) pulse.mod = rem.length || remp.length ? tuples.filter((t)=>cur[tupleid(t)] > 0) : tuples.slice(); - else for(id in out)pulse.mod.push(out[id]); - // set pulse garbage collection request - if (clean || clean == null && (rem.length || remp.length)) pulse.clean(true); - return pulse; - } - }; -} -const CACHE = '_:mod:_'; -/** - * Hash that tracks modifications to assigned values. - * Callers *must* use the set method to update values. - */ function Parameters() { - Object.defineProperty(this, CACHE, { - writable: true, - value: {} - }); -} -Parameters.prototype = { - /** - * Set a parameter value. If the parameter value changes, the parameter - * will be recorded as modified. - * @param {string} name - The parameter name. - * @param {number} index - The index into an array-value parameter. Ignored if - * the argument is undefined, null or less than zero. - * @param {*} value - The parameter value to set. - * @param {boolean} [force=false] - If true, records the parameter as modified - * even if the value is unchanged. - * @return {Parameters} - This parameter object. - */ set (name, index, value, force) { - const o = this, v = o[name], mod = o[CACHE]; - if (index != null && index >= 0) { - if (v[index] !== value || force) { - v[index] = value; - mod[index + ':' + name] = -1; - mod[name] = -1; - } - } else if (v !== value || force) { - o[name] = value; - mod[name] = (0, _vegaUtil.isArray)(value) ? 1 + value.length : -1; - } - return o; - }, - /** - * Tests if one or more parameters has been modified. If invoked with no - * arguments, returns true if any parameter value has changed. If the first - * argument is array, returns trues if any parameter name in the array has - * changed. Otherwise, tests if the given name and optional array index has - * changed. - * @param {string} name - The parameter name to test. - * @param {number} [index=undefined] - The parameter array index to test. - * @return {boolean} - Returns true if a queried parameter was modified. - */ modified (name, index) { - const mod = this[CACHE]; - if (!arguments.length) { - for(const k in mod){ - if (mod[k]) return true; - } - return false; - } else if ((0, _vegaUtil.isArray)(name)) { - for(let k = 0; k < name.length; ++k){ - if (mod[name[k]]) return true; - } - return false; + } + function inferColumns(rows) { + var columnSet = /* @__PURE__ */ Object.create(null), columns = []; + rows.forEach(function(row) { + for (var column in row) { + if (!(column in columnSet)) { + columns.push(columnSet[column] = column); } - return index != null && index >= 0 ? index + 1 < mod[name] || !!mod[index + ':' + name] : !!mod[name]; - }, - /** - * Clears the modification records. After calling this method, - * all parameters are considered unmodified. - */ clear () { - this[CACHE] = {}; - return this; + } + }); + return columns; + } + function pad$1(value2, width2) { + var s = value2 + "", length2 = s.length; + return length2 < width2 ? new Array(width2 - length2 + 1).join(0) + s : s; + } + function formatYear$1(year) { + return year < 0 ? "-" + pad$1(-year, 6) : year > 9999 ? "+" + pad$1(year, 6) : pad$1(year, 4); + } + function formatDate(date2) { + var hours = date2.getUTCHours(), minutes = date2.getUTCMinutes(), seconds = date2.getUTCSeconds(), milliseconds = date2.getUTCMilliseconds(); + return isNaN(date2) ? "Invalid Date" : formatYear$1(date2.getUTCFullYear()) + "-" + pad$1(date2.getUTCMonth() + 1, 2) + "-" + pad$1(date2.getUTCDate(), 2) + (milliseconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "." + pad$1(milliseconds, 3) + "Z" : seconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "Z" : minutes || hours ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + "Z" : ""); + } + function dsvFormat(delimiter) { + var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); + function parse2(text2, f) { + var convert2, columns, rows = parseRows(text2, function(row, i) { + if (convert2) return convert2(row, i - 1); + columns = row, convert2 = f ? customConverter(row, f) : objectConverter(row); + }); + rows.columns = columns || []; + return rows; + } + function parseRows(text2, f) { + var rows = [], N = text2.length, I = 0, n = 0, t, eof = N <= 0, eol = false; + if (text2.charCodeAt(N - 1) === NEWLINE) --N; + if (text2.charCodeAt(N - 1) === RETURN) --N; + function token() { + if (eof) return EOF; + if (eol) return eol = false, EOL; + var i, j = I, c2; + if (text2.charCodeAt(j) === QUOTE) { + while (I++ < N && text2.charCodeAt(I) !== QUOTE || text2.charCodeAt(++I) === QUOTE) ; + if ((i = I) >= N) eof = true; + else if ((c2 = text2.charCodeAt(I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } + return text2.slice(j + 1, i - 1).replace(/""/g, '"'); + } + while (I < N) { + if ((c2 = text2.charCodeAt(i = I++)) === NEWLINE) eol = true; + else if (c2 === RETURN) { + eol = true; + if (text2.charCodeAt(I) === NEWLINE) ++I; + } else if (c2 !== DELIMITER) continue; + return text2.slice(j, i); + } + return eof = true, text2.slice(j, N); + } + while ((t = token()) !== EOF) { + var row = []; + while (t !== EOL && t !== EOF) row.push(t), t = token(); + if (f && (row = f(row, n++)) == null) continue; + rows.push(row); + } + return rows; } -}; -let OP_ID = 0; -const PULSE = 'pulse', NO_PARAMS = new Parameters(); -// Boolean Flags -const SKIP$1 = 1, MODIFIED = 2; -/** - * An Operator is a processing node in a dataflow graph. - * Each operator stores a value and an optional value update function. - * Operators can accept a hash of named parameters. Parameter values can - * either be direct (JavaScript literals, arrays, objects) or indirect - * (other operators whose values will be pulled dynamically). Operators - * included as parameters will have this operator added as a dependency. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {function(object, Pulse)} [update] - An update function. Upon - * evaluation of this operator, the update function will be invoked and the - * return value will be used as the new value of this operator. - * @param {object} [params] - The parameters for this operator. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @see parameters - */ function Operator(init, update, params, react) { - this.id = ++OP_ID; - this.value = init; - this.stamp = -1; - this.rank = -1; - this.qrank = -1; - this.flags = 0; - if (update) this._update = update; - if (params) this.parameters(params, react); -} -function flag(bit) { - return function(state) { - const f = this.flags; - if (arguments.length === 0) return !!(f & bit); - this.flags = state ? f | bit : f & ~bit; - return this; - }; -} -Operator.prototype = { - /** - * Returns a list of target operators dependent on this operator. - * If this list does not exist, it is created and then returned. - * @return {UniqueList} - */ targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); - }, - /** - * Sets the value of this operator. - * @param {*} value - the value to set. - * @return {Number} Returns 1 if the operator value has changed - * according to strict equality, returns 0 otherwise. - */ set (value) { - if (this.value !== value) { - this.value = value; - return 1; - } else return 0; - }, - /** - * Indicates that operator evaluation should be skipped on the next pulse. - * This operator will still propagate incoming pulses, but its update function - * will not be invoked. The skip flag is reset after every pulse, so calling - * this method will affect processing of the next pulse only. - */ skip: flag(SKIP$1), - /** - * Indicates that this operator's value has been modified on its most recent - * pulse. Normally modification is checked via strict equality; however, in - * some cases it is more efficient to update the internal state of an object. - * In those cases, the modified flag can be used to trigger propagation. Once - * set, the modification flag persists across pulses until unset. The flag can - * be used with the last timestamp to test if a modification is recent. - */ modified: flag(MODIFIED), - /** - * Sets the parameters for this operator. The parameter values are analyzed for - * operator instances. If found, this operator will be added as a dependency - * of the parameterizing operator. Operator values are dynamically marshalled - * from each operator parameter prior to evaluation. If a parameter value is - * an array, the array will also be searched for Operator instances. However, - * the search does not recurse into sub-arrays or object properties. - * @param {object} params - A hash of operator parameters. - * @param {boolean} [react=true] - A flag indicating if this operator should - * automatically update (react) when parameter values change. In other words, - * this flag determines if the operator registers itself as a listener on - * any upstream operators included in the parameters. - * @param {boolean} [initonly=false] - A flag indicating if this operator - * should calculate an update only upon its initial evaluation, then - * deregister dependencies and suppress all future update invocations. - * @return {Operator[]} - An array of upstream dependencies. - */ parameters (params, react, initonly) { - react = react !== false; - const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; - let name, value, n, i; - const add = (name, index, value)=>{ - if (value instanceof Operator) { - if (value !== this) { - if (react) value.targets().add(this); - deps.push(value); - } - argops.push({ - op: value, - name: name, - index: index - }); - } else argval.set(name, index, value); - }; - for(name in params){ - value = params[name]; - if (name === PULSE) { - (0, _vegaUtil.array)(value).forEach((op)=>{ - if (!(op instanceof Operator)) (0, _vegaUtil.error)('Pulse parameters must be operator instances.'); - else if (op !== this) { - op.targets().add(this); - deps.push(op); - } - }); - this.source = value; - } else if ((0, _vegaUtil.isArray)(value)) { - argval.set(name, -1, Array(n = value.length)); - for(i = 0; i < n; ++i)add(name, i, value[i]); - } else add(name, -1, value); - } - this.marshall().clear(); // initialize values - if (initonly) argops.initonly = true; - return deps; - }, - /** - * Internal method for marshalling parameter values. - * Visits each operator dependency to pull the latest value. - * @return {Parameters} A Parameters object to pass to the update function. - */ marshall (stamp) { - const argval = this._argval || NO_PARAMS, argops = this._argops; - let item, i, op, mod; - if (argops) { - const n = argops.length; - for(i = 0; i < n; ++i){ - item = argops[i]; - op = item.op; - mod = op.modified() && op.stamp === stamp; - argval.set(item.name, item.index, op.value, mod); - } - if (argops.initonly) { - for(i = 0; i < n; ++i){ - item = argops[i]; - item.op.targets().remove(this); - } - this._argops = null; - this._update = null; - } - } - return argval; - }, - /** - * Detach this operator from the dataflow. - * Unregisters listeners on upstream dependencies. - */ detach () { - const argops = this._argops; - let i, n, item, op; - if (argops) for(i = 0, n = argops.length; i < n; ++i){ - item = argops[i]; - op = item.op; - if (op._targets) op._targets.remove(this); - } - // remove references to the source and pulse object, - // if present, to prevent memory leaks of old data. - this.pulse = null; - this.source = null; - }, - /** - * Delegate method to perform operator processing. - * Subclasses can override this method to perform custom processing. - * By default, it marshalls parameters and calls the update function - * if that function is defined. If the update function does not - * change the operator value then StopPropagation is returned. - * If no update function is defined, this method does nothing. - * @param {Pulse} pulse - the current dataflow pulse. - * @return The output pulse or StopPropagation. A falsy return value - * (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const update = this._update; - if (update) { - const params = this.marshall(pulse.stamp), v = update.call(this, params, pulse); - params.clear(); - if (v !== this.value) this.value = v; - else if (!this.modified()) return pulse.StopPropagation; - } - }, - /** - * Run this operator for the current pulse. If this operator has already - * been run at (or after) the pulse timestamp, returns StopPropagation. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) { - this.skip(false); - rv = 0; - } else rv = this.evaluate(pulse); - return this.pulse = rv || pulse; - } -}; -/** - * Add an operator to the dataflow graph. This function accepts a - * variety of input argument types. The basic signature supports an - * initial value, update function and parameters. If the first parameter - * is an Operator instance, it will be added directly. If it is a - * constructor for an Operator subclass, a new instance will be instantiated. - * Otherwise, if the first parameter is a function instance, it will be used - * as the update function and a null initial value is assumed. - * @param {*} init - One of: the operator to add, the initial value of - * the operator, an operator class to instantiate, or an update function. - * @param {function} [update] - The operator update function. - * @param {object} [params] - The operator parameters. - * @param {boolean} [react=true] - Flag indicating if this operator should - * listen for changes to upstream operators included as parameters. - * @return {Operator} - The added operator. - */ function add(init, update, params, react) { - let shift = 1, op; - if (init instanceof Operator) op = init; - else if (init && init.prototype instanceof Operator) op = new init(); - else if ((0, _vegaUtil.isFunction)(init)) op = new Operator(null, init); - else { - shift = 0; - op = new Operator(init, update); + function preformatBody(rows, columns) { + return rows.map(function(row) { + return columns.map(function(column) { + return formatValue2(row[column]); + }).join(delimiter); + }); } - this.rank(op); - if (shift) { - react = params; - params = update; + function format2(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return [columns.map(formatValue2).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); } - if (params) this.connect(op, op.parameters(params, react)); - this.touch(op); - return op; -} -/** - * Connect a target operator as a dependent of source operators. - * If necessary, this method will rerank the target operator and its - * dependents to ensure propagation proceeds in a topologically sorted order. - * @param {Operator} target - The target operator. - * @param {Array<Operator>} - The source operators that should propagate - * to the target operator. - */ function connect(target, sources) { - const targetRank = target.rank, n = sources.length; - for(let i = 0; i < n; ++i)if (targetRank < sources[i].rank) { - this.rerank(target); - return; + function formatBody(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return preformatBody(rows, columns).join("\n"); } -} -let STREAM_ID = 0; -/** - * Models an event stream. - * @constructor - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @param {function(Object)} [receive] - Event callback function to invoke - * upon receipt of a new event. Use to override standard event processing. - */ function EventStream(filter, apply, receive) { - this.id = ++STREAM_ID; - this.value = null; - if (receive) this.receive = receive; - if (filter) this._filter = filter; - if (apply) this._apply = apply; -} -/** - * Creates a new event stream instance with the provided - * (optional) filter, apply and receive functions. - * @param {function(Object, number): boolean} [filter] - Filter predicate. - * Events pass through when truthy, events are suppressed when falsy. - * @param {function(Object): *} [apply] - Applied to input events to produce - * new event values. - * @see EventStream - */ function stream(filter, apply, receive) { - return new EventStream(filter, apply, receive); -} -EventStream.prototype = { - _filter: (0, _vegaUtil.truthy), - _apply: (0, _vegaUtil.identity), - targets () { - return this._targets || (this._targets = UniqueList((0, _vegaUtil.id))); - }, - consume (_) { - if (!arguments.length) return !!this._consume; - this._consume = !!_; - return this; - }, - receive (evt) { - if (this._filter(evt)) { - const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; - for(let i = 0; i < n; ++i)trg[i].receive(val); - if (this._consume) { - evt.preventDefault(); - evt.stopPropagation(); - } - } - }, - filter (filter) { - const s = stream(filter); - this.targets().add(s); - return s; - }, - apply (apply) { - const s = stream(null, apply); - this.targets().add(s); - return s; - }, - merge () { - const s = stream(); - this.targets().add(s); - for(let i = 0, n = arguments.length; i < n; ++i)arguments[i].targets().add(s); - return s; - }, - throttle (pause) { - let t = -1; - return this.filter(()=>{ - const now = Date.now(); - if (now - t > pause) { - t = now; - return 1; - } else return 0; - }); - }, - debounce (delay) { - const s = stream(); - this.targets().add(stream(null, null, (0, _vegaUtil.debounce)(delay, (e)=>{ - const df = e.dataflow; - s.receive(e); - if (df && df.run) df.run(); - }))); - return s; - }, - between (a, b) { - let active = false; - a.targets().add(stream(null, null, ()=>active = true)); - b.targets().add(stream(null, null, ()=>active = false)); - return this.filter(()=>active); - }, - detach () { - // ensures compatibility with operators (#2753) - // remove references to other streams and filter functions that may - // be bound to subcontexts that need to be garbage collected. - this._filter = (0, _vegaUtil.truthy); - this._targets = null; - } -}; -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. The input must - * support the addEventListener method. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @param {function(object): *} [apply] - Event application function. - * If provided, this function will be invoked and the result will be - * used as the downstream event value. - * @return {EventStream} - */ function events(source, type, filter, apply) { - const df = this, s = stream(filter, apply), send = function(e) { - e.dataflow = df; - try { - s.receive(e); - } catch (error) { - df.error(error); - } finally{ - df.run(); - } - }; - let sources; - if (typeof source === 'string' && typeof document !== 'undefined') sources = document.querySelectorAll(source); - else sources = (0, _vegaUtil.array)(source); - const n = sources.length; - for(let i = 0; i < n; ++i)sources[i].addEventListener(type, send); - return s; -} -function parse(data, format) { - const locale = this.locale(); - return (0, _vegaLoader.read)(data, format, locale.timeParse, locale.utcParse); -} -/** - * Ingests new data into the dataflow. First parses the data using the - * vega-loader read method, then pulses a changeset to the target operator. - * @param {Operator} target - The Operator to target with ingested data, - * typically a Collect transform instance. - * @param {*} data - The input data, prior to parsing. For JSON this may - * be a string or an object. For CSV, TSV, etc should be a string. - * @param {object} format - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @returns {Dataflow} - */ function ingest(target, data, format) { - data = this.parse(data, format); - return this.pulse(target, this.changeset().insert(data)); -} -/** - * Request data from an external source, parse it, and return a Promise. - * @param {string} url - The URL from which to load the data. This string - * is passed to the vega-loader load method. - * @param {object} [format] - The data format description for parsing - * loaded data. This object is passed to the vega-loader read method. - * @return {Promise} A Promise that resolves upon completion of the request. - * The resolved object contains the following properties: - * - data: an array of parsed data (or null upon error) - * - status: a code for success (0), load fail (-1), or parse fail (-2) - */ async function request(url, format) { - const df = this; - let status = 0, data; - try { - data = await df.loader().load(url, { - context: 'dataflow', - response: (0, _vegaLoader.responseType)(format && format.type) - }); - try { - data = df.parse(data, format); - } catch (err) { - status = -2; - df.warn('Data ingestion failed', url, err); - } - } catch (err) { - status = -1; - df.warn('Loading failed', url, err); + function formatRows(rows) { + return rows.map(formatRow).join("\n"); + } + function formatRow(row) { + return row.map(formatValue2).join(delimiter); + } + function formatValue2(value2) { + return value2 == null ? "" : value2 instanceof Date ? formatDate(value2) : reFormat.test(value2 += "") ? '"' + value2.replace(/"/g, '""') + '"' : value2; } return { - data, - status + parse: parse2, + parseRows, + format: format2, + formatBody, + formatRows, + formatRow, + formatValue: formatValue2 }; -} -async function preload(target, url, format) { - const df = this, pending = df._pending || loadPending(df); - pending.requests += 1; - const res = await df.request(url, format); - df.pulse(target, df.changeset().remove((0, _vegaUtil.truthy)).insert(res.data || [])); - pending.done(); - return res; -} -function loadPending(df) { - let accept; - const pending = new Promise((a)=>accept = a); - pending.requests = 0; - pending.done = ()=>{ - if (--pending.requests === 0) { - df._pending = null; - accept(df); - } + } + function identity$6(x2) { + return x2; + } + function transform$3(transform2) { + if (transform2 == null) return identity$6; + var x02, y02, kx = transform2.scale[0], ky = transform2.scale[1], dx = transform2.translate[0], dy = transform2.translate[1]; + return function(input, i) { + if (!i) x02 = y02 = 0; + var j = 2, n = input.length, output2 = new Array(n); + output2[0] = (x02 += input[0]) * kx + dx; + output2[1] = (y02 += input[1]) * ky + dy; + while (j < n) output2[j] = input[j], ++j; + return output2; }; - return df._pending = pending; -} -const SKIP = { - skip: true -}; -/** - * Perform operator updates in response to events. Applies an - * update function to compute a new operator value. If the update function - * returns a {@link ChangeSet}, the operator will be pulsed with those tuple - * changes. Otherwise, the operator value will be updated to the return value. - * @param {EventStream|Operator} source - The event source to react to. - * This argument can be either an EventStream or an Operator. - * @param {Operator|function(object):Operator} target - The operator to update. - * This argument can either be an Operator instance or (if the source - * argument is an EventStream), a function that accepts an event object as - * input and returns an Operator to target. - * @param {function(Parameters,Event): *} [update] - Optional update function - * to compute the new operator value, or a literal value to set. Update - * functions expect to receive a parameter object and event as arguments. - * This function can either return a new operator value or (if the source - * argument is an EventStream) a {@link ChangeSet} instance to pulse - * the target operator with tuple changes. - * @param {object} [params] - The update function parameters. - * @param {object} [options] - Additional options hash. If not overridden, - * updated operators will be skipped by default. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @return {Dataflow} - */ function on(source, target, update, params, options) { - const fn = source instanceof Operator ? onOperator : onStream; - fn(this, source, target, update, params, options); - return this; -} -function onStream(df, stream, target, update, params, options) { - const opt = (0, _vegaUtil.extend)({}, options, SKIP); - let func, op; - if (!(0, _vegaUtil.isFunction)(target)) target = (0, _vegaUtil.constant)(target); - if (update === undefined) func = (e)=>df.touch(target(e)); - else if ((0, _vegaUtil.isFunction)(update)) { - op = new Operator(null, update, params, false); - func = (e)=>{ - op.evaluate(e); - const t = target(e), v = op.value; - isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); - }; - } else func = (e)=>df.update(target(e), update, opt); - stream.apply(func); -} -function onOperator(df, source, target, update, params, options) { - if (update === undefined) source.targets().add(target); - else { - const opt = options || {}, op = new Operator(null, updater(target, update), params, false); - op.modified(opt.force); - op.rank = source.rank; // immediately follow source - source.targets().add(op); // add dependency - if (target) { - op.skip(true); // skip first invocation - op.value = target.value; // initialize value - op.targets().add(target); // chain dependencies - df.connect(target, [ - op - ]); // rerank as needed, #1672 - } - } -} -function updater(target, update) { - update = (0, _vegaUtil.isFunction)(update) ? update : (0, _vegaUtil.constant)(update); - return target ? function(_, pulse) { - const value = update(_, pulse); - if (!target.skip()) target.skip(value !== this.value).value = value; - return value; - } : update; -} -/** - * Assigns a rank to an operator. Ranks are assigned in increasing order - * by incrementing an internal rank counter. - * @param {Operator} op - The operator to assign a rank. - */ function rank(op) { - op.rank = ++this._rank; -} -/** - * Re-ranks an operator and all downstream target dependencies. This - * is necessary when upstream dependencies of higher rank are added to - * a target operator. - * @param {Operator} op - The operator to re-rank. - */ function rerank(op) { - const queue = [ - op - ]; - let cur, list, i; - while(queue.length){ - this.rank(cur = queue.pop()); - if (list = cur._targets) for(i = list.length; --i >= 0;){ - queue.push(cur = list[i]); - if (cur === op) (0, _vegaUtil.error)('Cycle detected in dataflow graph.'); - } - } -} -/** - * Sentinel value indicating pulse propagation should stop. - */ const StopPropagation = {}; -// Pulse visit type flags -const ADD = 1, REM = 2, MOD = 4, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD, ALL = ADD | REM | MOD, REFLOW = 8, SOURCE = 16, NO_SOURCE = 32, NO_FIELDS = 64; -/** - * A Pulse enables inter-operator communication during a run of the - * dataflow graph. In addition to the current timestamp, a pulse may also - * contain a change-set of added, removed or modified data tuples, as well as - * a pointer to a full backing data source. Tuple change sets may not - * be fully materialized; for example, to prevent needless array creation - * a change set may include larger arrays and corresponding filter functions. - * The pulse provides a {@link visit} method to enable proper and efficient - * iteration over requested data tuples. - * - * In addition, each pulse can track modification flags for data tuple fields. - * Responsible transform operators should call the {@link modifies} method to - * indicate changes to data fields. The {@link modified} method enables - * querying of this modification state. - * - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The current propagation timestamp. - * @param {string} [encode] - An optional encoding set name, which is then - * accessible as Pulse.encode. Operators can respond to (or ignore) this - * setting as appropriate. This parameter can be used in conjunction with - * the Encode transform in the vega-encode module. - */ function Pulse(dataflow, stamp, encode) { - this.dataflow = dataflow; - this.stamp = stamp == null ? -1 : stamp; - this.add = []; - this.rem = []; - this.mod = []; - this.fields = null; - this.encode = encode || null; -} -function materialize(data, filter) { - const out = []; - (0, _vegaUtil.visitArray)(data, filter, (_)=>out.push(_)); - return out; -} -function filter(pulse, flags) { - const map = {}; - pulse.visit(flags, (t)=>{ - map[tupleid(t)] = 1; + } + function reverse$1(array2, n) { + var t, j = array2.length, i = j - n; + while (i < --j) t = array2[i], array2[i++] = array2[j], array2[j] = t; + } + function feature(topology, o) { + if (typeof o === "string") o = topology.objects[o]; + return o.type === "GeometryCollection" ? { type: "FeatureCollection", features: o.geometries.map(function(o2) { + return feature$1(topology, o2); + }) } : feature$1(topology, o); + } + function feature$1(topology, o) { + var id2 = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object$1(topology, o); + return id2 == null && bbox == null ? { type: "Feature", properties, geometry } : bbox == null ? { type: "Feature", id: id2, properties, geometry } : { type: "Feature", id: id2, bbox, properties, geometry }; + } + function object$1(topology, o) { + var transformPoint = transform$3(topology.transform), arcs = topology.arcs; + function arc2(i, points2) { + if (points2.length) points2.pop(); + for (var a2 = arcs[i < 0 ? ~i : i], k = 0, n = a2.length; k < n; ++k) { + points2.push(transformPoint(a2[k], k)); + } + if (i < 0) reverse$1(points2, n); + } + function point2(p) { + return transformPoint(p); + } + function line2(arcs2) { + var points2 = []; + for (var i = 0, n = arcs2.length; i < n; ++i) arc2(arcs2[i], points2); + if (points2.length < 2) points2.push(points2[0]); + return points2; + } + function ring(arcs2) { + var points2 = line2(arcs2); + while (points2.length < 4) points2.push(points2[0]); + return points2; + } + function polygon(arcs2) { + return arcs2.map(ring); + } + function geometry(o2) { + var type2 = o2.type, coordinates; + switch (type2) { + case "GeometryCollection": + return { type: type2, geometries: o2.geometries.map(geometry) }; + case "Point": + coordinates = point2(o2.coordinates); + break; + case "MultiPoint": + coordinates = o2.coordinates.map(point2); + break; + case "LineString": + coordinates = line2(o2.arcs); + break; + case "MultiLineString": + coordinates = o2.arcs.map(line2); + break; + case "Polygon": + coordinates = polygon(o2.arcs); + break; + case "MultiPolygon": + coordinates = o2.arcs.map(polygon); + break; + default: + return null; + } + return { type: type2, coordinates }; + } + return geometry(o); + } + function stitch(topology, arcs) { + var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; + arcs.forEach(function(i, j) { + var arc2 = topology.arcs[i < 0 ? ~i : i], t; + if (arc2.length < 3 && !arc2[1][0] && !arc2[1][1]) { + t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; + } }); - return (t)=>map[tupleid(t)] ? null : t; -} -function addFilter(a, b) { - return a ? (t, i)=>a(t, i) && b(t, i) : b; -} -Pulse.prototype = { - /** - * Sentinel value indicating pulse propagation should stop. - */ StopPropagation, - /** - * Boolean flag indicating ADD (added) tuples. - */ ADD, - /** - * Boolean flag indicating REM (removed) tuples. - */ REM, - /** - * Boolean flag indicating MOD (modified) tuples. - */ MOD, - /** - * Boolean flag indicating ADD (added) and REM (removed) tuples. - */ ADD_REM, - /** - * Boolean flag indicating ADD (added) and MOD (modified) tuples. - */ ADD_MOD, - /** - * Boolean flag indicating ADD, REM and MOD tuples. - */ ALL, - /** - * Boolean flag indicating all tuples in a data source - * except for the ADD, REM and MOD tuples. - */ REFLOW, - /** - * Boolean flag indicating a 'pass-through' to a - * backing data source, ignoring ADD, REM and MOD tuples. - */ SOURCE, - /** - * Boolean flag indicating that source data should be - * suppressed when creating a forked pulse. - */ NO_SOURCE, - /** - * Boolean flag indicating that field modifications should be - * suppressed when creating a forked pulse. - */ NO_FIELDS, - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. - * @return {Pulse} - The forked pulse instance. - * @see init - */ fork (flags) { - return new Pulse(this.dataflow).init(this, flags); - }, - /** - * Creates a copy of this pulse with new materialized array - * instances for the ADD, REM, MOD, and SOURCE arrays. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - The cloned pulse instance. - * @see init - */ clone () { - const p = this.fork(ALL); - p.add = p.add.slice(); - p.rem = p.rem.slice(); - p.mod = p.mod.slice(); - if (p.source) p.source = p.source.slice(); - return p.materialize(ALL | SOURCE); - }, - /** - * Returns a pulse that adds all tuples from a backing source. This is - * useful for cases where operators are added to a dataflow after an - * upstream data pipeline has already been processed, ensuring that - * new operators can observe all tuples within a stream. - * @return {Pulse} - A pulse instance with all source tuples included - * in the add array. If the current pulse already has all source - * tuples in its add array, it is returned directly. If the current - * pulse does not have a backing source, it is returned directly. - */ addAll () { - let p = this; - const reuse = !p.source || p.add === p.rem // special case for indexed set (e.g., crossfilter) - || !p.rem.length && p.source.length === p.add.length; - if (reuse) return p; - else { - p = new Pulse(this.dataflow).init(this); - p.add = p.source; - p.rem = []; // new operators can ignore rem #2769 - return p; - } - }, - /** - * Initialize this pulse based on the values of another pulse. This method - * is used internally by {@link fork} to initialize a new forked tuple. - * The dataflow, time stamp and field modification values are copied over. - * By default, new empty ADD, REM and MOD arrays are created. - * @param {Pulse} src - The source pulse to copy from. - * @param {number} flags - Integer of boolean flags indicating which (if any) - * tuple arrays should be copied to the new pulse. The supported flag values - * are ADD, REM and MOD. Array references are copied directly: new array - * instances are not created. By default, source data arrays are copied - * to the new pulse. Use the NO_SOURCE flag to enforce a null source. - * @return {Pulse} - Returns this Pulse instance. - */ init (src, flags) { - const p = this; - p.stamp = src.stamp; - p.encode = src.encode; - if (src.fields && !(flags & NO_FIELDS)) p.fields = src.fields; - if (flags & ADD) { - p.addF = src.addF; - p.add = src.add; - } else { - p.addF = null; - p.add = []; - } - if (flags & REM) { - p.remF = src.remF; - p.rem = src.rem; - } else { - p.remF = null; - p.rem = []; - } - if (flags & MOD) { - p.modF = src.modF; - p.mod = src.mod; + arcs.forEach(function(i) { + var e = ends(i), start = e[0], end = e[1], f, g; + if (f = fragmentByEnd[start]) { + delete fragmentByEnd[f.end]; + f.push(i); + f.end = end; + if (g = fragmentByStart[end]) { + delete fragmentByStart[g.start]; + var fg = g === f ? f : f.concat(g); + fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; } else { - p.modF = null; - p.mod = []; + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } - if (flags & NO_SOURCE) { - p.srcF = null; - p.source = null; + } else if (f = fragmentByStart[end]) { + delete fragmentByStart[f.start]; + f.unshift(i); + f.start = start; + if (g = fragmentByEnd[start]) { + delete fragmentByEnd[g.end]; + var gf = g === f ? f : g.concat(f); + fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; } else { - p.srcF = src.srcF; - p.source = src.source; - if (src.cleans) p.cleans = src.cleans; - } - return p; - }, - /** - * Schedules a function to run after pulse propagation completes. - * @param {function} func - The function to run. - */ runAfter (func) { - this.dataflow.runAfter(func); - }, - /** - * Indicates if tuples have been added, removed or modified. - * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. - * Defaults to ALL, returning true if any tuple type has changed. - * @return {boolean} - Returns true if one or more queried tuple types have - * changed, false otherwise. - */ changed (flags) { - const f = flags || ALL; - return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length; - }, - /** - * Forces a "reflow" of tuple values, such that all tuples in the backing - * source are added to the MOD set, unless already present in the ADD set. - * @param {boolean} [fork=false] - If true, returns a forked copy of this - * pulse, and invokes reflow on that derived pulse. - * @return {Pulse} - The reflowed pulse instance. - */ reflow (fork) { - if (fork) return this.fork(ALL).reflow(); - const len = this.add.length, src = this.source && this.source.length; - if (src && src !== len) { - this.mod = this.source; - if (len) this.filter(MOD, filter(this, ADD)); + fragmentByStart[f.start] = fragmentByEnd[f.end] = f; } - return this; - }, - /** - * Get/set metadata to pulse requesting garbage collection - * to reclaim currently unused resources. - */ clean (value) { - if (arguments.length) { - this.cleans = !!value; - return this; - } else return this.cleans; - }, - /** - * Marks one or more data field names as modified to assist dependency - * tracking and incremental processing by transform operators. - * @param {string|Array<string>} _ - The field(s) to mark as modified. - * @return {Pulse} - This pulse instance. - */ modifies (_) { - const hash = this.fields || (this.fields = {}); - if ((0, _vegaUtil.isArray)(_)) _.forEach((f)=>hash[f] = true); - else hash[_] = true; - return this; - }, - /** - * Checks if one or more data fields have been modified during this pulse - * propagation timestamp. - * @param {string|Array<string>} _ - The field(s) to check for modified. - * @param {boolean} nomod - If true, will check the modified flag even if - * no mod tuples exist. If false (default), mod tuples must be present. - * @return {boolean} - Returns true if any of the provided fields has been - * marked as modified, false otherwise. - */ modified (_, nomod) { - const fields = this.fields; - return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; - }, - /** - * Adds a filter function to one more tuple sets. Filters are applied to - * backing tuple arrays, to determine the actual set of tuples considered - * added, removed or modified. They can be used to delay materialization of - * a tuple set in order to avoid expensive array copies. In addition, the - * filter functions can serve as value transformers: unlike standard predicate - * function (which return boolean values), Pulse filters should return the - * actual tuple value to process. If a tuple set is already filtered, the - * new filter function will be appended into a conjuntive ('and') query. - * @param {number} flags - Flags indicating the tuple set(s) to filter. - * @param {function(*):object} filter - Filter function that will be applied - * to the tuple set array, and should return a data tuple if the value - * should be included in the tuple set, and falsy (or null) otherwise. - * @return {Pulse} - Returns this pulse instance. - */ filter (flags, filter) { - const p = this; - if (flags & ADD) p.addF = addFilter(p.addF, filter); - if (flags & REM) p.remF = addFilter(p.remF, filter); - if (flags & MOD) p.modF = addFilter(p.modF, filter); - if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter); - return p; - }, - /** - * Materialize one or more tuple sets in this pulse. If the tuple set(s) have - * a registered filter function, it will be applied and the tuple set(s) will - * be replaced with materialized tuple arrays. - * @param {number} flags - Flags indicating the tuple set(s) to materialize. - * @return {Pulse} - Returns this pulse instance. - */ materialize (flags) { - flags = flags || ALL; - const p = this; - if (flags & ADD && p.addF) { - p.add = materialize(p.add, p.addF); - p.addF = null; - } - if (flags & REM && p.remF) { - p.rem = materialize(p.rem, p.remF); - p.remF = null; - } - if (flags & MOD && p.modF) { - p.mod = materialize(p.mod, p.modF); - p.modF = null; - } - if (flags & SOURCE && p.srcF) { - p.source = p.source.filter(p.srcF); - p.srcF = null; + } else { + f = [i]; + fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; + } + }); + function ends(i) { + var arc2 = topology.arcs[i < 0 ? ~i : i], p02 = arc2[0], p1; + if (topology.transform) p1 = [0, 0], arc2.forEach(function(dp) { + p1[0] += dp[0], p1[1] += dp[1]; + }); + else p1 = arc2[arc2.length - 1]; + return i < 0 ? [p1, p02] : [p02, p1]; + } + function flush2(fragmentByEnd2, fragmentByStart2) { + for (var k in fragmentByEnd2) { + var f = fragmentByEnd2[k]; + delete fragmentByStart2[f.start]; + delete f.start; + delete f.end; + f.forEach(function(i) { + stitchedArcs[i < 0 ? ~i : i] = 1; + }); + fragments.push(f); + } + } + flush2(fragmentByEnd, fragmentByStart); + flush2(fragmentByStart, fragmentByEnd); + arcs.forEach(function(i) { + if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); + }); + return fragments; + } + function mesh(topology) { + return object$1(topology, meshArcs.apply(this, arguments)); + } + function meshArcs(topology, object2, filter2) { + var arcs, i, n; + if (arguments.length > 1) arcs = extractArcs(topology, object2, filter2); + else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i; + return { type: "MultiLineString", arcs: stitch(topology, arcs) }; + } + function extractArcs(topology, object2, filter2) { + var arcs = [], geomsByArc = [], geom; + function extract0(i) { + var j = i < 0 ? ~i : i; + (geomsByArc[j] || (geomsByArc[j] = [])).push({ i, g: geom }); + } + function extract1(arcs2) { + arcs2.forEach(extract0); + } + function extract2(arcs2) { + arcs2.forEach(extract1); + } + function extract3(arcs2) { + arcs2.forEach(extract2); + } + function geometry(o) { + switch (geom = o, o.type) { + case "GeometryCollection": + o.geometries.forEach(geometry); + break; + case "LineString": + extract1(o.arcs); + break; + case "MultiLineString": + case "Polygon": + extract2(o.arcs); + break; + case "MultiPolygon": + extract3(o.arcs); + break; + } + } + geometry(object2); + geomsByArc.forEach(filter2 == null ? function(geoms) { + arcs.push(geoms[0].i); + } : function(geoms) { + if (filter2(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); + }); + return arcs; + } + function ascending$1(a2, b2) { + return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN; + } + function descending$1(a2, b2) { + return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN; + } + function bisector(f) { + let compare12, compare2, delta; + if (f.length !== 2) { + compare12 = ascending$1; + compare2 = (d, x2) => ascending$1(f(d), x2); + delta = (d, x2) => f(d) - x2; + } else { + compare12 = f === ascending$1 || f === descending$1 ? f : zero$2; + compare2 = f; + delta = f; + } + function left(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) < 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + function right(a2, x2, lo = 0, hi = a2.length) { + if (lo < hi) { + if (compare12(x2, x2) !== 0) return hi; + do { + const mid = lo + hi >>> 1; + if (compare2(a2[mid], x2) <= 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); + } + return lo; + } + function center(a2, x2, lo = 0, hi = a2.length) { + const i = left(a2, x2, lo, hi - 1); + return i > lo && delta(a2[i - 1], x2) > -delta(a2[i], x2) ? i - 1 : i; + } + return { left, center, right }; + } + function zero$2() { + return 0; + } + function number$6(x2) { + return x2 === null ? NaN : +x2; + } + function* numbers$2(values2, valueof) { + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + yield value2; } - return p; - }, - /** - * Visit one or more tuple sets in this pulse. - * @param {number} flags - Flags indicating the tuple set(s) to visit. - * Legal values are ADD, REM, MOD and SOURCE (if a backing data source - * has been set). - * @param {function(object):*} - Visitor function invoked per-tuple. - * @return {Pulse} - Returns this pulse instance. - */ visit (flags, visitor) { - const p = this, v = visitor; - if (flags & SOURCE) { - (0, _vegaUtil.visitArray)(p.source, p.srcF, v); - return p; - } - if (flags & ADD) (0, _vegaUtil.visitArray)(p.add, p.addF, v); - if (flags & REM) (0, _vegaUtil.visitArray)(p.rem, p.remF, v); - if (flags & MOD) (0, _vegaUtil.visitArray)(p.mod, p.modF, v); - const src = p.source; - if (flags & REFLOW && src) { - const sum = p.add.length + p.mod.length; - if (sum === src.length) ; - else if (sum) (0, _vegaUtil.visitArray)(src, filter(p, ADD_MOD), v); - else // if no add/rem/mod tuples, visit source - (0, _vegaUtil.visitArray)(src, p.srcF, v); + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + yield value2; } - return p; + } } -}; -/** - * Represents a set of multiple pulses. Used as input for operators - * that accept multiple pulses at a time. Contained pulses are - * accessible via the public "pulses" array property. This pulse doe - * not carry added, removed or modified tuples directly. However, - * the visit method can be used to traverse all such tuples contained - * in sub-pulses with a timestamp matching this parent multi-pulse. - * @constructor - * @param {Dataflow} dataflow - The backing dataflow instance. - * @param {number} stamp - The timestamp. - * @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse. - */ function MultiPulse(dataflow, stamp, pulses, encode) { - const p = this; - let c = 0; - this.dataflow = dataflow; - this.stamp = stamp; - this.fields = null; - this.encode = encode || null; - this.pulses = pulses; - for (const pulse of pulses){ - if (pulse.stamp !== stamp) continue; - if (pulse.fields) { - const hash = p.fields || (p.fields = {}); - for(const f in pulse.fields)hash[f] = 1; - } - if (pulse.changed(p.ADD)) c |= p.ADD; - if (pulse.changed(p.REM)) c |= p.REM; - if (pulse.changed(p.MOD)) c |= p.MOD; - } - this.changes = c; -} -(0, _vegaUtil.inherits)(MultiPulse, Pulse, { - /** - * Creates a new pulse based on the values of this pulse. - * The dataflow, time stamp and field modification values are copied over. - * @return {Pulse} - */ fork (flags) { - const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); - if (flags !== undefined) { - if (flags & p.ADD) this.visit(p.ADD, (t)=>p.add.push(t)); - if (flags & p.REM) this.visit(p.REM, (t)=>p.rem.push(t)); - if (flags & p.MOD) this.visit(p.MOD, (t)=>p.mod.push(t)); + } + const ascendingBisect = bisector(ascending$1); + const bisectRight$1 = ascendingBisect.right; + const bisectLeft$1 = ascendingBisect.left; + bisector(number$6).center; + function variance(values2, valueof) { + let count2 = 0; + let delta; + let mean2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); } - return p; - }, - changed (flags) { - return this.changes & flags; - }, - modified (_) { - const p = this, fields = p.fields; - return !(fields && p.changes & p.MOD) ? 0 : (0, _vegaUtil.isArray)(_) ? _.some((f)=>fields[f]) : fields[_]; - }, - filter () { - (0, _vegaUtil.error)('MultiPulse does not support filtering.'); - }, - materialize () { - (0, _vegaUtil.error)('MultiPulse does not support materialization.'); - }, - visit (flags, visitor) { - const p = this, pulses = p.pulses, n = pulses.length; - let i = 0; - if (flags & p.SOURCE) for(; i < n; ++i)pulses[i].visit(flags, visitor); - else { - for(; i < n; ++i)if (pulses[i].stamp === p.stamp) pulses[i].visit(flags, visitor); + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + delta = value2 - mean2; + mean2 += delta / ++count2; + sum2 += delta * (value2 - mean2); } - return p; + } } -}); -/* eslint-disable require-atomic-updates */ /** - * Evaluates the dataflow and returns a Promise that resolves when pulse - * propagation completes. This method will increment the current timestamp - * and process all updated, pulsed and touched operators. When invoked for - * the first time, all registered operators will be processed. This method - * should not be invoked by third-party clients, use {@link runAsync} or - * {@link run} instead. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function evaluate(encode, prerun, postrun) { - const df = this, async = []; - // if the pulse value is set, this is a re-entrant call - if (df._pulse) return reentrant(df); - // wait for pending datasets to load - if (df._pending) await df._pending; - // invoke prerun function, if provided - if (prerun) await asyncCallback(df, prerun); - // exit early if there are no updates - if (!df._touched.length) { - df.debug('Dataflow invoked, but nothing to do.'); - return df; + if (count2 > 1) return sum2 / (count2 - 1); + } + function deviation(values2, valueof) { + const v = variance(values2, valueof); + return v ? Math.sqrt(v) : v; + } + class Adder { + constructor() { + this._partials = new Float64Array(32); + this._n = 0; + } + add(x2) { + const p = this._partials; + let i = 0; + for (let j = 0; j < this._n && j < 32; j++) { + const y2 = p[j], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2); + if (lo) p[i++] = lo; + x2 = hi; + } + p[i] = x2; + this._n = i + 1; + return this; } - // increment timestamp clock - const stamp = ++df._clock; - // set the current pulse - df._pulse = new Pulse(df, stamp, encode); - // initialize priority queue, reset touched operators - df._touched.forEach((op)=>df._enqueue(op, true)); - df._touched = UniqueList((0, _vegaUtil.id)); - let count = 0, op, next, error; - try { - while(df._heap.size() > 0){ - // dequeue operator with highest priority - op = df._heap.pop(); - // re-queue if rank changed - if (op.rank !== op.qrank) { - df._enqueue(op, true); - continue; - } - // otherwise, evaluate the operator - next = op.run(df._getPulse(op, encode)); - if (next.then) // await if operator returns a promise directly - next = await next; - else if (next.async) { - // queue parallel asynchronous execution - async.push(next.async); - next = StopPropagation; - } - // propagate evaluation, enqueue dependent operators - if (next !== StopPropagation) { - if (op._targets) op._targets.forEach((op)=>df._enqueue(op)); - } - // increment visit counter - ++count; + valueOf() { + const p = this._partials; + let n = this._n, x2, y2, lo, hi = 0; + if (n > 0) { + hi = p[--n]; + while (n > 0) { + x2 = hi; + y2 = p[--n]; + hi = x2 + y2; + lo = y2 - (hi - x2); + if (lo) break; + } + if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { + y2 = lo * 2; + x2 = hi + y2; + if (y2 == x2 - hi) hi = x2; } - } catch (err) { - df._heap.clear(); - error = err; + } + return hi; } - // reset pulse map - df._input = {}; - df._pulse = null; - df.debug(`Pulse ${stamp}: ${count} operators`); - if (error) { - df._postrun = []; - df.error(error); + } + class InternMap extends Map { + constructor(entries, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (entries != null) for (const [key3, value2] of entries) this.set(key3, value2); } - // invoke callbacks queued via runAfter - if (df._postrun.length) { - const pr = df._postrun.sort((a, b)=>b.priority - a.priority); - df._postrun = []; - for(let i = 0; i < pr.length; ++i)await asyncCallback(df, pr[i].callback); + get(key2) { + return super.get(intern_get(this, key2)); } - // invoke postrun function, if provided - if (postrun) await asyncCallback(df, postrun); - // handle non-blocking asynchronous callbacks - if (async.length) Promise.all(async).then((cb)=>df.runAsync(null, ()=>{ - cb.forEach((f)=>{ - try { - f(df); - } catch (err) { - df.error(err); - } - }); - })); - return df; -} -/** - * Queues dataflow evaluation to run once any other queued evaluations have - * completed and returns a Promise that resolves when the queued pulse - * propagation completes. If provided, a callback function will be invoked - * immediately before evaluation commences. This method will ensure a - * separate evaluation is invoked for each time it is called. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode package. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Promise} - A promise that resolves to this dataflow after - * evaluation completes. - */ async function runAsync(encode, prerun, postrun) { - // await previously queued functions - while(this._running)await this._running; - // run dataflow, manage running promise - const clear = ()=>this._running = null; - (this._running = this.evaluate(encode, prerun, postrun)).then(clear, clear); - return this._running; -} -/** - * Requests dataflow evaluation and the immediately returns this dataflow - * instance. If there are pending data loading or other asynchronous - * operations, the dataflow will evaluate asynchronously after this method - * has been invoked. To track when dataflow evaluation completes, use the - * {@link runAsync} method instead. This method will raise an error if - * invoked while the dataflow is already in the midst of evaluation. - * @param {string} [encode] - The name of an encoding set to invoke during - * propagation. This value is added to generated Pulse instances; - * operators can then respond to (or ignore) this setting as appropriate. - * This parameter can be used in conjunction with the Encode transform in - * the vega-encode module. - * @param {function} [prerun] - An optional callback function to invoke - * immediately before dataflow evaluation commences. - * @param {function} [postrun] - An optional callback function to invoke - * after dataflow evaluation completes. The callback will be invoked - * after those registered via {@link runAfter}. - * @return {Dataflow} - This dataflow instance. - */ function run(encode, prerun, postrun) { - return this._pulse ? reentrant(this) : (this.evaluate(encode, prerun, postrun), this); -} -/** - * Schedules a callback function to be invoked after the current pulse - * propagation completes. If no propagation is currently occurring, - * the function is invoked immediately. Callbacks scheduled via runAfter - * are invoked immediately upon completion of the current cycle, before - * any request queued via runAsync. This method is primarily intended for - * internal use. Third-party callers using runAfter to schedule a callback - * that invokes {@link run} or {@link runAsync} should not use this method, - * but instead use {@link runAsync} with prerun or postrun arguments. - * @param {function(Dataflow)} callback - The callback function to run. - * The callback will be invoked with this Dataflow instance as its - * sole argument. - * @param {boolean} enqueue - A boolean flag indicating that the - * callback should be queued up to run after the next propagation - * cycle, suppressing immediate invocation when propagation is not - * currently occurring. - * @param {number} [priority] - A priority value used to sort registered - * callbacks to determine execution order. This argument is intended - * for internal Vega use only. - */ function runAfter(callback, enqueue, priority) { - if (this._pulse || enqueue) // pulse propagation is currently running, queue to run after - this._postrun.push({ - priority: priority || 0, - callback: callback - }); - else // pulse propagation already complete, invoke immediately - try { - callback(this); - } catch (err) { - this.error(err); + has(key2) { + return super.has(intern_get(this, key2)); } -} -/** - * Raise an error for re-entrant dataflow evaluation. - */ function reentrant(df) { - df.error('Dataflow already running. Use runAsync() to chain invocations.'); - return df; -} -/** - * Enqueue an operator into the priority queue for evaluation. The operator - * will be enqueued if it has no registered pulse for the current cycle, or if - * the force argument is true. Upon enqueue, this method also sets the - * operator's qrank to the current rank value. - * @param {Operator} op - The operator to enqueue. - * @param {boolean} [force] - A flag indicating if the operator should be - * forceably added to the queue, even if it has already been previously - * enqueued during the current pulse propagation. This is useful when the - * dataflow graph is dynamically modified and the operator rank changes. - */ function enqueue(op, force) { - const q = op.stamp < this._clock; - if (q) op.stamp = this._clock; - if (q || force) { - op.qrank = op.rank; - this._heap.push(op); - } -} -/** - * Provide a correct pulse for evaluating an operator. If the operator has an - * explicit source operator, we will try to pull the pulse(s) from it. - * If there is an array of source operators, we build a multi-pulse. - * Otherwise, we return a current pulse with correct source data. - * If the pulse is the pulse map has an explicit target set, we use that. - * Else if the pulse on the upstream source operator is current, we use that. - * Else we use the pulse from the pulse map, but copy the source tuple array. - * @param {Operator} op - The operator for which to get an input pulse. - * @param {string} [encode] - An (optional) encoding set name with which to - * annotate the returned pulse. See {@link run} for more information. - */ function getPulse(op, encode) { - const s = op.source, stamp = this._clock; - return s && (0, _vegaUtil.isArray)(s) ? new MultiPulse(this, stamp, s.map((_)=>_.pulse), encode) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); -} -function singlePulse(p, s) { - if (s && s.stamp === p.stamp) return s; - p = p.fork(); - if (s && s !== StopPropagation) p.source = s.source; - return p; -} -const NO_OPT = { - skip: false, - force: false -}; -/** - * Touches an operator, scheduling it to be evaluated. If invoked outside of - * a pulse propagation, the operator will be evaluated the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the operator - * will be queued for evaluation if and only if the operator has not yet been - * evaluated on the current propagation timestamp. - * @param {Operator} op - The operator to touch. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function touch(op, options) { - const opt = options || NO_OPT; - if (this._pulse) // if in midst of propagation, add to priority queue - this._enqueue(op); - else // otherwise, queue for next propagation - this._touched.add(op); - if (opt.skip) op.skip(true); - return this; -} -/** - * Updates the value of the given operator. - * @param {Operator} op - The operator to update. - * @param {*} value - The value to set. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.force] - If true, the operator will - * be re-evaluated even if its value has not changed. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function update(op, value, options) { - const opt = options || NO_OPT; - if (op.set(value) || opt.force) this.touch(op, opt); - return this; -} -/** - * Pulses an operator with a changeset of tuples. If invoked outside of - * a pulse propagation, the pulse will be applied the next time this - * dataflow is run. If invoked in the midst of pulse propagation, the pulse - * will be added to the set of active pulses and will be applied if and - * only if the target operator has not yet been evaluated on the current - * propagation timestamp. - * @param {Operator} op - The operator to pulse. - * @param {ChangeSet} value - The tuple changeset to apply. - * @param {object} [options] - Additional options hash. - * @param {boolean} [options.skip] - If true, the operator will - * be skipped: it will not be evaluated, but its dependents will be. - * @return {Dataflow} - */ function pulse(op, changeset, options) { - this.touch(op, options || NO_OPT); - const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; - p.target = op; - this._input[op.id] = changeset.pulse(p, t); - return this; -} -function Heap(cmp) { - let nodes = []; - return { - clear: ()=>nodes = [], - size: ()=>nodes.length, - peek: ()=>nodes[0], - push: (x)=>{ - nodes.push(x); - return siftdown(nodes, 0, nodes.length - 1, cmp); - }, - pop: ()=>{ - const last = nodes.pop(); - let item; - if (nodes.length) { - item = nodes[0]; - nodes[0] = last; - siftup(nodes, 0, cmp); - } else item = last; - return item; - } - }; -} -function siftdown(array, start, idx, cmp) { - let parent, pidx; - const item = array[idx]; - while(idx > start){ - pidx = idx - 1 >> 1; - parent = array[pidx]; - if (cmp(item, parent) < 0) { - array[idx] = parent; - idx = pidx; - continue; - } - break; + set(key2, value2) { + return super.set(intern_set(this, key2), value2); } - return array[idx] = item; -} -function siftup(array, idx, cmp) { - const start = idx, end = array.length, item = array[idx]; - let cidx = (idx << 1) + 1, ridx; - while(cidx < end){ - ridx = cidx + 1; - if (ridx < end && cmp(array[cidx], array[ridx]) >= 0) cidx = ridx; - array[idx] = array[cidx]; - idx = cidx; - cidx = (idx << 1) + 1; - } - array[idx] = item; - return siftdown(array, start, idx, cmp); -} -/** - * A dataflow graph for reactive processing of data streams. - * @constructor - */ function Dataflow() { - this.logger((0, _vegaUtil.logger)()); - this.logLevel((0, _vegaUtil.Error)); - this._clock = 0; - this._rank = 0; - this._locale = (0, _vegaFormat.defaultLocale)(); - try { - this._loader = (0, _vegaLoader.loader)(); - } catch (e) { - // do nothing if loader module is unavailable + delete(key2) { + return super.delete(intern_delete(this, key2)); } - this._touched = UniqueList((0, _vegaUtil.id)); - this._input = {}; - this._pulse = null; - this._heap = Heap((a, b)=>a.qrank - b.qrank); - this._postrun = []; -} -function logMethod(method) { - return function() { - return this._log[method].apply(this, arguments); - }; -} -Dataflow.prototype = { - /** - * The current timestamp of this dataflow. This value reflects the - * timestamp of the previous dataflow run. The dataflow is initialized - * with a stamp value of 0. The initial run of the dataflow will have - * a timestap of 1, and so on. This value will match the - * {@link Pulse.stamp} property. - * @return {number} - The current timestamp value. - */ stamp () { - return this._clock; - }, - /** - * Gets or sets the loader instance to use for data file loading. A - * loader object must provide a "load" method for loading files and a - * "sanitize" method for checking URL/filename validity. Both methods - * should accept a URI and options hash as arguments, and return a Promise - * that resolves to the loaded file contents (load) or a hash containing - * sanitized URI data with the sanitized url assigned to the "href" property - * (sanitize). - * @param {object} _ - The loader instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current loader instance. Otherwise returns this Dataflow instance. - */ loader (_) { - if (arguments.length) { - this._loader = _; - return this; - } else return this._loader; - }, - /** - * Gets or sets the locale instance to use for formatting and parsing - * string values. The locale object should be provided by the - * vega-format library, and include methods such as format, timeFormat, - * utcFormat, timeParse, and utcParse. - * @param {object} _ - The locale instance to use. - * @return {object|Dataflow} - If no arguments are provided, returns - * the current locale instance. Otherwise returns this Dataflow instance. - */ locale (_) { - if (arguments.length) { - this._locale = _; - return this; - } else return this._locale; - }, - /** - * Get or set the logger instance used to log messages. If no arguments are - * provided, returns the current logger instance. Otherwise, sets the logger - * and return this Dataflow instance. Provided loggers must support the full - * API of logger objects generated by the vega-util logger method. Note that - * by default the log level of the new logger will be used; use the logLevel - * method to adjust the log level as needed. - */ logger (logger) { - if (arguments.length) { - this._log = logger; - return this; - } else return this._log; - }, - /** - * Logs an error message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit error messages. - */ error: logMethod('error'), - /** - * Logs a warning message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit warning messages. - */ warn: logMethod('warn'), - /** - * Logs a information message. By default, logged messages are written to - * console output. The message will only be logged if the current log level is - * high enough to permit information messages. - */ info: logMethod('info'), - /** - * Logs a debug message. By default, logged messages are written to console - * output. The message will only be logged if the current log level is high - * enough to permit debug messages. - */ debug: logMethod('debug'), - /** - * Get or set the current log level. If an argument is provided, it - * will be used as the new log level. - * @param {number} [level] - Should be one of None, Warn, Info - * @return {number} - The current log level. - */ logLevel: logMethod('level'), - /** - * Empty entry threshold for garbage cleaning. Map data structures will - * perform cleaning once the number of empty entries exceeds this value. - */ cleanThreshold: 1e4, - // OPERATOR REGISTRATION - add, - connect, - rank, - rerank, - // OPERATOR UPDATES - pulse, - touch, - update, - changeset, - // DATA LOADING - ingest, - parse, - preload, - request, - // EVENT HANDLING - events, - on, - // PULSE PROPAGATION - evaluate, - run, - runAsync, - runAfter, - _enqueue: enqueue, - _getPulse: getPulse -}; -/** - * Abstract class for operators that process data tuples. - * Subclasses must provide a {@link transform} method for operator processing. - * @constructor - * @param {*} [init] - The initial value for this operator. - * @param {object} [params] - The parameters for this operator. - * @param {Operator} [source] - The operator from which to receive pulses. - */ function Transform(init, params) { - Operator.call(this, init, null, params); -} -(0, _vegaUtil.inherits)(Transform, Operator, { - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Internally, this method calls {@link evaluate} to perform processing. - * If {@link evaluate} returns a falsy value, the input pulse is returned. - * This method should NOT be overridden, instead overrride {@link evaluate}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return the output pulse for this operator (or StopPropagation) - */ run (pulse) { - if (pulse.stamp < this.stamp) return pulse.StopPropagation; - let rv; - if (this.skip()) this.skip(false); - else rv = this.evaluate(pulse); - rv = rv || pulse; - if (rv.then) rv = rv.then((_)=>this.pulse = _); - else if (rv !== pulse.StopPropagation) this.pulse = rv; - return rv; - }, - /** - * Overrides {@link Operator.evaluate} for transform operators. - * Marshalls parameter values and then invokes {@link transform}. - * @param {Pulse} pulse - the current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - value (including undefined) will let the input pulse pass through. - */ evaluate (pulse) { - const params = this.marshall(pulse.stamp), out = this.transform(params, pulse); - params.clear(); - return out; - }, - /** - * Process incoming pulses. - * Subclasses should override this method to implement transforms. - * @param {Parameters} _ - The operator parameter values. - * @param {Pulse} pulse - The current dataflow pulse. - * @return {Pulse} The output pulse (or StopPropagation). A falsy return - * value (including undefined) will let the input pulse pass through. - */ transform () {} -}); -const transforms = {}; -function definition(type) { - const t = transform(type); - return t && t.Definition || null; -} -function transform(type) { - type = type && type.toLowerCase(); - return (0, _vegaUtil.hasOwnProperty)(transforms, type) ? transforms[type] : null; -} - -},{"vega-util":"bApja","vega-loader":"gmbOr","vega-format":"47kOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gmbOr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formats", ()=>formats); -parcelHelpers.export(exports, "inferType", ()=>inferType); -parcelHelpers.export(exports, "inferTypes", ()=>inferTypes); -parcelHelpers.export(exports, "loader", ()=>loader); -parcelHelpers.export(exports, "read", ()=>read); -parcelHelpers.export(exports, "responseType", ()=>responseType); -parcelHelpers.export(exports, "typeParsers", ()=>typeParsers); -var _vegaUtil = require("vega-util"); -var _d3Dsv = require("d3-dsv"); -var _topojsonClient = require("topojson-client"); -var _vegaFormat = require("vega-format"); -var Buffer = require("d2bd1b4e1a5e867b").Buffer; -// Matches absolute URLs with optional protocol -// https://... file://... //... -const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; -// Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// -const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape -const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex -// Special treatment in node.js for the file: protocol -const fileProtocol = 'file://'; -/** - * Factory for a loader constructor that provides methods for requesting - * files from either the network or disk, and for sanitizing request URIs. - * @param {function} fetch - The Fetch API for HTTP network requests. - * If null or undefined, HTTP loading will be disabled. - * @param {object} fs - The file system interface for file loading. - * If null or undefined, local file loading will be disabled. - * @return {function} A loader constructor with the following signature: - * param {object} [options] - Optional default loading options to use. - * return {object} - A new loader instance. - */ function loaderFactory(fetch1, fs) { - return (options)=>({ - options: options || {}, - sanitize: sanitize, - load: load, - fileAccess: false, - file: fileLoader(fs), - http: httpLoader(fetch1) - }); -} -/** - * Load an external resource, typically either from the web or from the local - * filesystem. This function uses {@link sanitize} to first sanitize the uri, - * then calls either {@link http} (for web requests) or {@link file} (for - * filesystem loading). - * @param {string} uri - The resource indicator (e.g., URL or filename). - * @param {object} [options] - Optional loading options. These options will - * override any existing default options. - * @return {Promise} - A promise that resolves to the loaded content. - */ async function load(uri, options) { - const opt = await this.sanitize(uri, options), url = opt.href; - return opt.localFile ? this.file(url) : this.http(url, options); -} -/** - * URI sanitizer function. - * @param {string} uri - The uri (url or filename) to check. - * @param {object} options - An options hash. - * @return {Promise} - A promise that resolves to an object containing - * sanitized uri data, or rejects it the input uri is deemed invalid. - * The properties of the resolved object are assumed to be - * valid attributes for an HTML 'a' tag. The sanitized uri *must* be - * provided by the 'href' property of the returned object. - */ async function sanitize(uri, options) { - options = (0, _vegaUtil.extend)({}, this.options, options); - const fileAccess = this.fileAccess, result = { - href: null - }; - let isFile, loadFile, base; - const isAllowed = allowed_re.test(uri.replace(whitespace_re, '')); - if (uri == null || typeof uri !== 'string' || !isAllowed) (0, _vegaUtil.error)('Sanitize failure, invalid URI: ' + (0, _vegaUtil.stringValue)(uri)); - const hasProtocol = protocol_re.test(uri); - // if relative url (no protocol/host), prepend baseURL - if ((base = options.baseURL) && !hasProtocol) { - // Ensure that there is a slash between the baseURL (e.g. hostname) and url - if (!uri.startsWith('/') && !base.endsWith('/')) uri = '/' + uri; - uri = base + uri; - } - // should we load from file system? - loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess; - if (isFile) // strip file protocol - uri = uri.slice(fileProtocol.length); - else if (uri.startsWith('//')) { - if (options.defaultProtocol === 'file') { - // if is file, strip protocol and set loadFile flag - uri = uri.slice(2); - loadFile = true; - } else // if relative protocol (starts with '//'), prepend default protocol - uri = (options.defaultProtocol || 'http') + ':' + uri; - } - // set non-enumerable mode flag to indicate local file load - Object.defineProperty(result, 'localFile', { - value: !!loadFile - }); - // set uri - result.href = uri; - // set default result target, if specified - if (options.target) result.target = options.target + ''; - // set default result rel, if specified (#1542) - if (options.rel) result.rel = options.rel + ''; - // provide control over cross-origin image handling (#2238) - // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image - if (options.context === 'image' && options.crossOrigin) result.crossOrigin = options.crossOrigin + ''; - // return - return result; -} -/** - * File system loader factory. - * @param {object} fs - The file system interface. - * @return {function} - A file loader with the following signature: - * param {string} filename - The file system path to load. - * param {string} filename - The file system path to load. - * return {Promise} A promise that resolves to the file contents. - */ function fileLoader(fs) { - return fs ? (filename)=>new Promise((accept, reject)=>{ - fs.readFile(filename, (error, data)=>{ - if (error) reject(error); - else accept(data); - }); - }) : fileReject; -} -/** - * Default file system loader that simply rejects. - */ async function fileReject() { - (0, _vegaUtil.error)('No file system access.'); -} -/** - * HTTP request handler factory. - * @param {function} fetch - The Fetch API method. - * @return {function} - An http loader with the following signature: - * param {string} url - The url to request. - * param {object} options - An options hash. - * return {Promise} - A promise that resolves to the file contents. - */ function httpLoader(fetch1) { - return fetch1 ? async function(url, options) { - const opt = (0, _vegaUtil.extend)({}, this.options.http, options), type = options && options.response, response = await fetch1(url, opt); - return !response.ok ? (0, _vegaUtil.error)(response.status + '' + response.statusText) : (0, _vegaUtil.isFunction)(response[type]) ? response[type]() : response.text(); - } : httpReject; -} -/** - * Default http request handler that simply rejects. - */ async function httpReject() { - (0, _vegaUtil.error)('No HTTP fetch method available.'); -} -const isValid = (_)=>_ != null && _ === _; -const isBoolean = (_)=>_ === 'true' || _ === 'false' || _ === true || _ === false; -const isDate = (_)=>!Number.isNaN(Date.parse(_)); -const isNumber = (_)=>!Number.isNaN(+_) && !(_ instanceof Date); -const isInteger = (_)=>isNumber(_) && Number.isInteger(+_); -const typeParsers = { - boolean: (0, _vegaUtil.toBoolean), - integer: (0, _vegaUtil.toNumber), - number: (0, _vegaUtil.toNumber), - date: (0, _vegaUtil.toDate), - string: (0, _vegaUtil.toString), - unknown: (0, _vegaUtil.identity) -}; -const typeTests = [ - isBoolean, - isInteger, - isNumber, - isDate -]; -const typeList = [ - 'boolean', - 'integer', - 'number', - 'date' -]; -function inferType(values, field) { - if (!values || !values.length) return 'unknown'; - const n = values.length, m = typeTests.length, a = typeTests.map((_, i)=>i + 1); - for(let i = 0, t = 0, j, value; i < n; ++i){ - value = field ? values[i][field] : values[i]; - for(j = 0; j < m; ++j)if (a[j] && isValid(value) && !typeTests[j](value)) { - a[j] = 0; - ++t; - if (t === typeTests.length) return 'string'; - } - } - return typeList[a.reduce((u, v)=>u === 0 ? v : u, 0) - 1]; -} -function inferTypes(data, fields) { - return fields.reduce((types, field)=>{ - types[field] = inferType(data, field); - return types; - }, {}); -} -function delimitedFormat(delimiter) { - const parse = function(data, format) { - const delim = { - delimiter: delimiter - }; - return dsv(data, format ? (0, _vegaUtil.extend)(format, delim) : delim); - }; - parse.responseType = 'text'; - return parse; -} -function dsv(data, format) { - if (format.header) data = format.header.map((0, _vegaUtil.stringValue)).join(format.delimiter) + '\n' + data; - return (0, _d3Dsv.dsvFormat)(format.delimiter).parse(data + ''); -} -dsv.responseType = 'text'; -function isBuffer(_) { - return typeof Buffer === 'function' && (0, _vegaUtil.isFunction)(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; -} -function json(data, format) { - const prop = format && format.property ? (0, _vegaUtil.field)(format.property) : (0, _vegaUtil.identity); - return (0, _vegaUtil.isObject)(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data)); -} -json.responseType = 'json'; -function parseJSON(data, format) { - if (!(0, _vegaUtil.isArray)(data) && (0, _vegaUtil.isIterable)(data)) data = [ - ...data - ]; - return format && format.copy ? JSON.parse(JSON.stringify(data)) : data; -} -const filters = { - interior: (a, b)=>a !== b, - exterior: (a, b)=>a === b -}; -function topojson(data, format) { - let method, object, property, filter; - data = json(data, format); - if (format && format.feature) { - method = (0, _topojsonClient.feature); - property = format.feature; - } else if (format && format.mesh) { - method = (0, _topojsonClient.mesh); - property = format.mesh; - filter = filters[format.filter]; - } else (0, _vegaUtil.error)('Missing TopoJSON feature or mesh parameter.'); - object = (object = data.objects[property]) ? method(data, object, filter) : (0, _vegaUtil.error)('Invalid TopoJSON object: ' + property); - return object && object.features || [ - object - ]; -} -topojson.responseType = 'json'; -const format = { - dsv: dsv, - csv: delimitedFormat(','), - tsv: delimitedFormat('\t'), - json: json, - topojson: topojson -}; -function formats(name, reader) { - if (arguments.length > 1) { - format[name] = reader; - return this; - } else return (0, _vegaUtil.hasOwnProperty)(format, name) ? format[name] : null; -} -function responseType(type) { - const f = formats(type); - return f && f.responseType || 'text'; -} -function read(data, schema, timeParser, utcParser) { - schema = schema || {}; - const reader = formats(schema.type || 'json'); - if (!reader) (0, _vegaUtil.error)('Unknown data format type: ' + schema.type); - data = reader(data, schema); - if (schema.parse) parse(data, schema.parse, timeParser, utcParser); - if ((0, _vegaUtil.hasOwnProperty)(data, 'columns')) delete data.columns; - return data; -} -function parse(data, types, timeParser, utcParser) { - if (!data.length) return; // early exit for empty data - const locale = (0, _vegaFormat.timeFormatDefaultLocale)(); - timeParser = timeParser || locale.timeParse; - utcParser = utcParser || locale.utcParse; - let fields = data.columns || Object.keys(data[0]), datum, field, i, j, n, m; - if (types === 'auto') types = inferTypes(data, fields); - fields = Object.keys(types); - const parsers = fields.map((field)=>{ - const type = types[field]; - let parts, pattern; - if (type && (type.startsWith('date:') || type.startsWith('utc:'))) { - parts = type.split(/:(.+)?/, 2); // split on first : - pattern = parts[1]; - if (pattern[0] === '\'' && pattern[pattern.length - 1] === '\'' || pattern[0] === '"' && pattern[pattern.length - 1] === '"') pattern = pattern.slice(1, -1); - const parse = parts[0] === 'utc' ? utcParser : timeParser; - return parse(pattern); - } - if (!typeParsers[type]) throw Error('Illegal format pattern: ' + field + ':' + type); - return typeParsers[type]; - }); - for(i = 0, n = data.length, m = fields.length; i < n; ++i){ - datum = data[i]; - for(j = 0; j < m; ++j){ - field = fields[j]; - datum[field] = parsers[j](datum[field]); - } - } -} -const loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API -null // no file system access -); - -},{"d2bd1b4e1a5e867b":"6tQNr","vega-util":"bApja","d3-dsv":"70Sp2","topojson-client":"aKIOa","vega-format":"47kOt","buffer":"9AXxu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6tQNr":[function(require,module,exports,__globalThis) { -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh <https://feross.org> - * @license MIT - */ /* eslint-disable no-proto */ 'use strict'; -const base64 = require("9c62938f1dccc73c"); -const ieee754 = require("aceacb6a4531a9d2"); -const customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null; -exports.Buffer = Buffer; -exports.SlowBuffer = SlowBuffer; -exports.INSPECT_MAX_BYTES = 50; -const K_MAX_LENGTH = 0x7fffffff; -exports.kMaxLength = K_MAX_LENGTH; -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); -function typedArraySupport() { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1); - const proto = { - foo: function() { - return 42; - } - }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; + } + class InternSet extends Set { + constructor(values2, key2 = keyof) { + super(); + Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key2 } }); + if (values2 != null) for (const value2 of values2) this.add(value2); } -} -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.buffer; - } -}); -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.byteOffset; - } -}); -function createBuffer(length) { - if (length > K_MAX_LENGTH) throw new RangeError('The value "' + length + '" is invalid for option "size"'); - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ function Buffer(arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') throw new TypeError('The "string" argument must be of type string. Received type number'); - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); -} -Buffer.poolSize = 8192 // not used by this implementation -; -function from(value, encodingOrOffset, length) { - if (typeof value === 'string') return fromString(value, encodingOrOffset); - if (ArrayBuffer.isView(value)) return fromArrayView(value); - if (value == null) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof value === 'number') throw new TypeError('The "value" argument must not be of type number. Received type number'); - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); -} -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ Buffer.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); -}; -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); -Object.setPrototypeOf(Buffer, Uint8Array); -function assertSize(size) { - if (typeof size !== 'number') throw new TypeError('"size" argument must be of type number'); - else if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); -} -function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) return createBuffer(size); - if (fill !== undefined) // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - return createBuffer(size); -} -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ Buffer.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); -}; -function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); -} -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ Buffer.allocUnsafe = function(size) { - return allocUnsafe(size); -}; -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ Buffer.allocUnsafeSlow = function(size) { - return allocUnsafe(size); -}; -function fromString(string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'; - if (!Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual); - return buf; -} -function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for(let i = 0; i < length; i += 1)buf[i] = array[i] & 255; - return buf; -} -function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); -} -function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); - let buf; - if (byteOffset === undefined && length === undefined) buf = new Uint8Array(array); - else if (length === undefined) buf = new Uint8Array(array, byteOffset); - else buf = new Uint8Array(array, byteOffset, length); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -function fromObject(obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) return buf; - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) return createBuffer(0); - return fromArrayLike(obj); - } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) return fromArrayLike(obj.data); -} -function checked(length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + ' bytes'); - return length | 0; -} -function SlowBuffer(length) { - if (+length != length) length = 0; - return Buffer.alloc(+length); -} -Buffer.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false - ; -}; -Buffer.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - if (a === b) return 0; - let x = a.length; - let y = b.length; - for(let i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; + has(value2) { + return super.has(intern_get(this, value2)); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -Buffer.isEncoding = function isEncoding(encoding) { - switch(String(encoding).toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true; - default: - return false; - } -}; -Buffer.concat = function concat(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); - if (list.length === 0) return Buffer.alloc(0); - let i; - if (length === undefined) { - length = 0; - for(i = 0; i < list.length; ++i)length += list[i].length; - } - const buffer = Buffer.allocUnsafe(length); - let pos = 0; - for(i = 0; i < list.length; ++i){ - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf); - buf.copy(buffer, pos); - } else Uint8Array.prototype.set.call(buffer, buf, pos); - } else if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); - else buf.copy(buffer, pos); - pos += buf.length; - } - return buffer; -}; -function byteLength(string, encoding) { - if (Buffer.isBuffer(string)) return string.length; - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if (typeof string !== 'string') throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - // Use a for loop to avoid recursion - let loweredCase = false; - for(;;)switch(encoding){ - case 'ascii': - case 'latin1': - case 'binary': - return len; - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2; - case 'hex': - return len >>> 1; - case 'base64': - return base64ToBytes(string).length; - default: - if (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - ; - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } -} -Buffer.byteLength = byteLength; -function slowToString(encoding, start, end) { - let loweredCase = false; - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) start = 0; - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) return ''; - if (end === undefined || end > this.length) end = this.length; - if (end <= 0) return ''; - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0; - start >>>= 0; - if (end <= start) return ''; - if (!encoding) encoding = 'utf8'; - while(true)switch(encoding){ - case 'hex': - return hexSlice(this, start, end); - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end); - case 'ascii': - return asciiSlice(this, start, end); - case 'latin1': - case 'binary': - return latin1Slice(this, start, end); - case 'base64': - return base64Slice(this, start, end); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = (encoding + '').toLowerCase(); - loweredCase = true; - } -} -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true; -function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; -} -Buffer.prototype.swap16 = function swap16() { - const len = this.length; - if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits'); - for(let i = 0; i < len; i += 2)swap(this, i, i + 1); - return this; -}; -Buffer.prototype.swap32 = function swap32() { - const len = this.length; - if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits'); - for(let i = 0; i < len; i += 4){ - swap(this, i, i + 3); - swap(this, i + 1, i + 2); + add(value2) { + return super.add(intern_set(this, value2)); } - return this; -}; -Buffer.prototype.swap64 = function swap64() { - const len = this.length; - if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits'); - for(let i = 0; i < len; i += 8){ - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); + delete(value2) { + return super.delete(intern_delete(this, value2)); } - return this; -}; -Buffer.prototype.toString = function toString() { - const length = this.length; - if (length === 0) return ''; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); -}; -Buffer.prototype.toLocaleString = Buffer.prototype.toString; -Buffer.prototype.equals = function equals(b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); - if (this === b) return true; - return Buffer.compare(this, b) === 0; -}; -Buffer.prototype.inspect = function inspect() { - let str = ''; - const max = exports.INSPECT_MAX_BYTES; - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); - if (this.length > max) str += ' ... '; - return '<Buffer ' + str + '>'; -}; -if (customInspectSymbol) Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; -Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) target = Buffer.from(target, target.offset, target.byteLength); - if (!Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (start === undefined) start = 0; - if (end === undefined) end = target ? target.length : 0; - if (thisStart === undefined) thisStart = 0; - if (thisEnd === undefined) thisEnd = this.length; - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError('out of range index'); - if (thisStart >= thisEnd && start >= end) return 0; - if (thisStart >= thisEnd) return -1; - if (start >= end) return 1; - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for(let i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; + } + function intern_get({ _intern, _key }, value2) { + const key2 = _key(value2); + return _intern.has(key2) ? _intern.get(key2) : value2; + } + function intern_set({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) return _intern.get(key2); + _intern.set(key2, value2); + return value2; + } + function intern_delete({ _intern, _key }, value2) { + const key2 = _key(value2); + if (_intern.has(key2)) { + value2 = _intern.get(key2); + _intern.delete(key2); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1; - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff; - else if (byteOffset < -2147483648) byteOffset = -2147483648; - byteOffset = +byteOffset // Coerce to Number. - ; - if (numberIsNaN(byteOffset)) // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : buffer.length - 1; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - else byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - // Normalize val - if (typeof val === 'string') val = Buffer.from(val, encoding); - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) return -1; - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - ; - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - return arrayIndexOf(buffer, [ - val - ], byteOffset, encoding, dir); - } - throw new TypeError('val must be string, number or Buffer'); -} -function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase(); - if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) return -1; - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i) { - if (indexSize === 1) return buf[i]; - else return buf.readUInt16BE(i * indexSize); - } - let i; - if (dir) { - let foundIndex = -1; - for(i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; + return value2; + } + function keyof(value2) { + return value2 !== null && typeof value2 === "object" ? value2.valueOf() : value2; + } + function permute(source2, keys2) { + return Array.from(keys2, (key2) => source2[key2]); + } + function compareDefined(compare2 = ascending$1) { + if (compare2 === ascending$1) return ascendingDefined; + if (typeof compare2 !== "function") throw new TypeError("compare is not a function"); + return (a2, b2) => { + const x2 = compare2(a2, b2); + if (x2 || x2 === 0) return x2; + return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0); + }; + } + function ascendingDefined(a2, b2) { + return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0); + } + const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); + function tickSpec(start, stop2, count2) { + const step = (stop2 - start) / Math.max(0, count2), power = Math.floor(Math.log10(step)), error2 = step / Math.pow(10, power), factor = error2 >= e10 ? 10 : error2 >= e5 ? 5 : error2 >= e2 ? 2 : 1; + let i1, i2, inc; + if (power < 0) { + inc = Math.pow(10, -power) / factor; + i1 = Math.round(start * inc); + i2 = Math.round(stop2 * inc); + if (i1 / inc < start) ++i1; + if (i2 / inc > stop2) --i2; + inc = -inc; + } else { + inc = Math.pow(10, power) * factor; + i1 = Math.round(start / inc); + i2 = Math.round(stop2 / inc); + if (i1 * inc < start) ++i1; + if (i2 * inc > stop2) --i2; + } + if (i2 < i1 && 0.5 <= count2 && count2 < 2) return tickSpec(start, stop2, count2 * 2); + return [i1, i2, inc]; + } + function ticks(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + if (!(count2 > 0)) return []; + if (start === stop2) return [start]; + const reverse2 = stop2 < start, [i1, i2, inc] = reverse2 ? tickSpec(stop2, start, count2) : tickSpec(start, stop2, count2); + if (!(i2 >= i1)) return []; + const n = i2 - i1 + 1, ticks2 = new Array(n); + if (reverse2) { + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc; + } else { + if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc; + else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc; + } + return ticks2; + } + function tickIncrement(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + return tickSpec(start, stop2, count2)[2]; + } + function tickStep(start, stop2, count2) { + stop2 = +stop2, start = +start, count2 = +count2; + const reverse2 = stop2 < start, inc = reverse2 ? tickIncrement(stop2, start, count2) : tickIncrement(start, stop2, count2); + return (reverse2 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + } + function max$3(values2, valueof) { + let max2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; } + } } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for(i = byteOffset; i >= 0; i--){ - let found = true; - for(let j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - if (found) return i; + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (max2 < value2 || max2 === void 0 && value2 >= value2)) { + max2 = value2; } + } } - return -1; -} -Buffer.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; -}; -Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); -}; -Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); -}; -function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) length = remaining; - else { - length = Number(length); - if (length > remaining) length = remaining; - } - const strLen = string.length; - if (length > strLen / 2) length = strLen / 2; - let i; - for(i = 0; i < length; ++i){ - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; + return max2; + } + function min$3(values2, valueof) { + let min2; + if (valueof === void 0) { + for (const value2 of values2) { + if (value2 != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (min2 > value2 || min2 === void 0 && value2 >= value2)) { + min2 = value2; + } + } } - return i; -} -function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); -} -function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); -} -function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); -} -function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); -} -Buffer.prototype.write = function write(string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8'; - length = this.length; - offset = 0; - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset; - length = this.length; - offset = 0; - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === undefined) encoding = 'utf8'; - } else { - encoding = length; - length = undefined; - } - } else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); - const remaining = this.length - offset; - if (length === undefined || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError('Attempt to write outside buffer bounds'); - if (!encoding) encoding = 'utf8'; - let loweredCase = false; - for(;;)switch(encoding){ - case 'hex': - return hexWrite(this, string, offset, length); - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length); - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; + return min2; + } + function quickselect(array2, k, left = 0, right = Infinity, compare2) { + k = Math.floor(k); + left = Math.floor(Math.max(0, left)); + right = Math.floor(Math.min(array2.length - 1, right)); + if (!(left <= k && k <= right)) return array2; + compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2); + while (right > left) { + if (right - left > 600) { + const n = right - left + 1; + const m2 = k - left + 1; + const z = Math.log(n); + const s = 0.5 * Math.exp(2 * z / 3); + const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m2 - n / 2 < 0 ? -1 : 1); + const newLeft = Math.max(left, Math.floor(k - m2 * s / n + sd)); + const newRight = Math.min(right, Math.floor(k + (n - m2) * s / n + sd)); + quickselect(array2, k, newLeft, newRight, compare2); + } + const t = array2[k]; + let i = left; + let j = right; + swap$1(array2, left, k); + if (compare2(array2[right], t) > 0) swap$1(array2, left, right); + while (i < j) { + swap$1(array2, i, j), ++i, --j; + while (compare2(array2[i], t) < 0) ++i; + while (compare2(array2[j], t) > 0) --j; + } + if (compare2(array2[left], t) === 0) swap$1(array2, left, j); + else ++j, swap$1(array2, j, right); + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; } -}; -Buffer.prototype.toJSON = function toJSON() { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - }; -}; -function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) return base64.fromByteArray(buf); - else return base64.fromByteArray(buf.slice(start, end)); -} -function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while(i < end){ - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch(bytesPerSequence){ - case 1: - if (firstByte < 0x80) codePoint = firstByte; - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; - if (tempCodePoint > 0x7F) codePoint = tempCodePoint; - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) codePoint = tempCodePoint; - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) codePoint = tempCodePoint; - } - } + return array2; + } + function swap$1(array2, i, j) { + const t = array2[i]; + array2[i] = array2[j]; + array2[j] = t; + } + function quantile$1(values2, p, valueof) { + values2 = Float64Array.from(numbers$2(values2, valueof)); + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return min$3(values2); + if (p >= 1) return max$3(values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$3(quickselect(values2, i0).subarray(0, i0 + 1)), value1 = min$3(values2.subarray(i0 + 1)); + return value0 + (value1 - value0) * (i - i0); + } + function quantileSorted(values2, p, valueof = number$6) { + if (!(n = values2.length) || isNaN(p = +p)) return; + if (p <= 0 || n < 2) return +valueof(values2[0], 0, values2); + if (p >= 1) return +valueof(values2[n - 1], n - 1, values2); + var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values2[i0], i0, values2), value1 = +valueof(values2[i0 + 1], i0 + 1, values2); + return value0 + (value1 - value0) * (i - i0); + } + function mean(values2, valueof) { + let count2 = 0; + let sum2 = 0; + if (valueof === void 0) { + for (let value2 of values2) { + if (value2 != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; } - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD; - bytesPerSequence = 1; - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000; - res.push(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | codePoint & 0x3FF; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); -} -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000; -function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - ; - // Decode in chunks to avoid "call stack size exceeded". - let res = ''; - let i = 0; - while(i < len)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - return res; -} -function asciiSlice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i] & 0x7F); - return ret; -} -function latin1Slice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); - return ret; -} -function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ''; - for(let i = start; i < end; ++i)out += hexSliceLookupTable[buf[i]]; - return out; -} -function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ''; - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for(let i = 0; i < bytes.length - 1; i += 2)res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - return res; -} -Buffer.prototype.slice = function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === undefined ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) start = len; - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) end = len; - if (end < start) end = start; - const newBuf = this.subarray(start, end); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype); - return newBuf; -}; -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); -} -Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - return val; -}; -Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset + --byteLength]; - let mul = 1; - while(byteLength > 0 && (mul *= 0x100))val += this[offset + --byteLength] * mul; - return val; -}; -Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; -}; -Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; -}; -Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; -}; -Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; -}; -Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); -}; -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const lo = first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 256 + this[++offset] * 2 ** 16 + last * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); -}); -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); -}); -Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let i = byteLength; - let mul = 1; - let val = this[offset + --i]; - while(i > 0 && (mul *= 0x100))val += this[offset + --i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 0x80)) return this[offset]; - return (0xff - this[offset] + 1) * -1; -}; -Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; -}; -Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; -}; -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = this[offset + 4] + this[offset + 5] * 256 + this[offset + 6] * 2 ** 16 + (last << 24 // Overflow - ); - return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); -}); -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last); -}); -Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); -}; -Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); -}; -Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); -}; -Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); -}; -function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError('Index out of range'); -} -Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let i = byteLength - 1; - let mul = 1; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; -} -function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; -} -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + } else { + let index2 = -1; + for (let value2 of values2) { + if ((value2 = valueof(value2, ++index2, values2)) != null && (value2 = +value2) >= value2) { + ++count2, sum2 += value2; + } + } } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - let i = byteLength - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128); - if (value < 0) value = 0xff + value + 1; - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; -}; -Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - if (value < 0) value = 0xffffffff + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); -} -function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; -} -Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); -}; -function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; -} -Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); -}; -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - // Copy 0 bytes; we're done - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - // Fatal error conditions - if (targetStart < 0) throw new RangeError('targetStart out of bounds'); - if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); - if (end < 0) throw new RangeError('sourceEnd out of bounds'); - // Are we oob? - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) end = target.length - targetStart + start; - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end); - else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); - return len; -}; -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill(val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === 'string') { - encoding = end; - end = this.length; - } - if (encoding !== undefined && typeof encoding !== 'string') throw new TypeError('encoding must be a string'); - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === 'utf8' && code < 128 || encoding === 'latin1') // Fast path: If `val` fits into a single byte, use that numeric value. - val = code; - } - } else if (typeof val === 'number') val = val & 255; - else if (typeof val === 'boolean') val = Number(val); - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) throw new RangeError('Out of range index'); - if (end <= start) return this; - start = start >>> 0; - end = end === undefined ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === 'number') for(i = start; i < end; ++i)this[i] = val; - else { - const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding); - const len = bytes.length; - if (len === 0) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; + if (count2) return sum2 / count2; + } + function median(values2, valueof) { + return quantile$1(values2, 0.5, valueof); + } + function* flatten$1(arrays) { + for (const array2 of arrays) { + yield* array2; } - return this; -}; -// CUSTOM ERRORS -// ============= -// Simplified versions from Node, changed for Buffer-only usage -const errors = {}; -function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor(){ - super(); - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]`; - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - ; - // Reset the name to the actual name. - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }); + } + function merge$2(arrays) { + return Array.from(flatten$1(arrays)); + } + function range$3(start, stop2, step) { + start = +start, stop2 = +stop2, step = (n = arguments.length) < 2 ? (stop2 = start, start = 0, 1) : n < 3 ? 1 : +step; + var i = -1, n = Math.max(0, Math.ceil((stop2 - start) / step)) | 0, range2 = new Array(n); + while (++i < n) { + range2[i] = start + i * step; + } + return range2; + } + function sum$1(values2, valueof) { + let sum2 = 0; + { + for (let value2 of values2) { + if (value2 = +value2) { + sum2 += value2; } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; -} -E('ERR_BUFFER_OUT_OF_BOUNDS', function(name) { - if (name) return `${name} is outside of buffer bounds`; - return 'Attempt to access memory outside buffer bounds'; -}, RangeError); -E('ERR_INVALID_ARG_TYPE', function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; -}, TypeError); -E('ERR_OUT_OF_RANGE', function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) received = addNumericalSeparator(String(input)); - else if (typeof input === 'bigint') { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) received = addNumericalSeparator(received); - received += 'n'; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; -}, RangeError); -function addNumericalSeparator(val) { - let res = ''; - let i = val.length; - const start = val[0] === '-' ? 1 : 0; - for(; i >= start + 4; i -= 3)res = `_${val.slice(i - 3, i)}${res}`; - return `${val.slice(0, i)}${res}`; -} -// CHECK FUNCTIONS -// =============== -function checkBounds(buf, offset, byteLength) { - validateNumber(offset, 'offset'); - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) boundsError(offset, buf.length - (byteLength + 1)); -} -function checkIntBI(value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : ''; - let range; - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; - else range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}`; - } else range = `>= ${min}${n} and <= ${max}${n}`; - throw new errors.ERR_OUT_OF_RANGE('value', range, value); - } - checkBounds(buf, offset, byteLength); -} -function validateNumber(value, name) { - if (typeof value !== 'number') throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value); -} -function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value); - } - if (length < 0) throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', `>= ${type ? 1 : 0} and <= ${length}`, value); -} -// HELPER FUNCTIONS -// ================ -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; -function base64clean(str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0]; - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, ''); - // Node converts strings with length < 2 to '' - if (str.length < 2) return ''; - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while(str.length % 4 !== 0)str = str + '='; - return str; -} -function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for(let i = 0; i < length; ++i){ - codePoint = string.charCodeAt(i); - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - // valid lead - leadSurrogate = codePoint; - continue; - } - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - leadSurrogate = codePoint; - continue; - } - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; - } else if (leadSurrogate) // valid bmp char, but last char was a lead - { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - } - leadSurrogate = null; - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break; - bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break; - bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break; - bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else throw new Error('Invalid code point'); - } - return bytes; -} -function asciiToBytes(str) { - const byteArray = []; - for(let i = 0; i < str.length; ++i)// Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF); - return byteArray; -} -function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for(let i = 0; i < str.length; ++i){ - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; -} -function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); -} -function blitBuffer(src, dst, offset, length) { - let i; - for(i = 0; i < length; ++i){ - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; + } } - return i; -} -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; -} -function numberIsNaN(obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare - ; -} -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = function() { - const alphabet = '0123456789abcdef'; - const table = new Array(256); - for(let i = 0; i < 16; ++i){ - const i16 = i * 16; - for(let j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; - } - return table; -}(); -// Return not function with Error if BigInt not supported -function defineBigIntMethod(fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn; -} -function BufferBigIntNotDefined() { - throw new Error('BigInt not supported'); -} - -},{"9c62938f1dccc73c":"7jAMi","aceacb6a4531a9d2":"hITcF"}],"7jAMi":[function(require,module,exports,__globalThis) { -'use strict'; -exports.byteLength = byteLength; -exports.toByteArray = toByteArray; -exports.fromByteArray = fromByteArray; -var lookup = []; -var revLookup = []; -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -for(var i = 0, len = code.length; i < len; ++i){ - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; -} -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62; -revLookup['_'.charCodeAt(0)] = 63; -function getLens(b64) { - var len = b64.length; - if (len % 4 > 0) throw new Error('Invalid string. Length must be a multiple of 4'); - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('='); - if (validLen === -1) validLen = len; - var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; + return sum2; + } + function intersection(values2, ...others) { + values2 = new InternSet(values2); + others = others.map(set$8); + out: for (const value2 of values2) { + for (const other of others) { + if (!other.has(value2)) { + values2.delete(value2); + continue out; + } + } + } + return values2; + } + function set$8(values2) { + return values2 instanceof InternSet ? values2 : new InternSet(values2); + } + function union(...others) { + const set2 = new InternSet(); + for (const other of others) { + for (const o of other) { + set2.add(o); + } + } + return set2; + } + function formatDecimal(x2) { + return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); + } + function formatDecimalParts(x2, p) { + if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; + var i, coefficient = x2.slice(0, i); return [ - validLen, - placeHoldersLen + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x2.slice(i + 1) ]; -} -// base64 is 4/3 + up to two characters of the original data -function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i; - for(i = 0; i < len; i += 4){ - tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[curByte++] = tmp >> 16 & 0xFF; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - return arr; -} -function tripletToBase64(num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; -} -function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for(var i = start; i < end; i += 3){ - tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); - output.push(tripletToBase64(tmp)); - } - return output.join(''); -} -function fromByteArray(uint8) { - var tmp; - var len = uint8.length; - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - ; - var parts = []; - var maxChunkLength = 16383 // must be multiple of 3 - ; - // go through the array every three bytes, we'll deal with trailing stuff later - for(var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1]; - parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); - } - return parts.join(''); -} - -},{}],"hITcF":[function(require,module,exports,__globalThis) { -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ exports.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for(; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for(; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - if (e === 0) e = 1 - eBias; - else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity; - else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; -exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) value += rt / c; - else value += rt * Math.pow(2, 1 - eBias); - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; + } + function exponent(x2) { + return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN; + } + function formatGroup(grouping, thousands) { + return function(value2, width2) { + var i = value2.length, t = [], j = 0, g = grouping[0], length2 = 0; + while (i > 0 && g > 0) { + if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); + t.push(value2.substring(i -= g, i + g)); + if ((length2 += g + 1) > width2) break; + g = grouping[j = (j + 1) % grouping.length]; + } + return t.reverse().join(thousands); + }; + } + function formatNumerals(numerals) { + return function(value2) { + return value2.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } + var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; + function formatSpecifier(specifier) { + if (!(match2 = re.exec(specifier))) throw new Error("invalid format: " + specifier); + var match2; + return new FormatSpecifier({ + fill: match2[1], + align: match2[2], + sign: match2[3], + symbol: match2[4], + zero: match2[5], + width: match2[6], + comma: match2[7], + precision: match2[8] && match2[8].slice(1), + trim: match2[9], + type: match2[10] + }); + } + formatSpecifier.prototype = FormatSpecifier.prototype; + function FormatSpecifier(specifier) { + this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; + this.align = specifier.align === void 0 ? ">" : specifier.align + ""; + this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; + this.zero = !!specifier.zero; + this.width = specifier.width === void 0 ? void 0 : +specifier.width; + this.comma = !!specifier.comma; + this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; + this.trim = !!specifier.trim; + this.type = specifier.type === void 0 ? "" : specifier.type + ""; + } + FormatSpecifier.prototype.toString = function() { + return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; + }; + function formatTrim(s) { + out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s[i]) { + case ".": + i0 = i1 = i; + break; + case "0": + if (i0 === 0) i0 = i; + i1 = i; + break; + default: + if (!+s[i]) break out; + if (i0 > 0) i0 = 0; + break; + } + } + return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; + } + var prefixExponent; + function formatPrefixAuto(x2, p) { + var d = formatDecimalParts(x2, p); + if (!d) return x2 + ""; + var coefficient = d[0], exponent2 = d[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; + return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x2, Math.max(0, p + i - 1))[0]; + } + function formatRounded(x2, p) { + var d = formatDecimalParts(x2, p); + if (!d) return x2 + ""; + var coefficient = d[0], exponent2 = d[1]; + return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); + } + const formatTypes = { + "%": (x2, p) => (x2 * 100).toFixed(p), + "b": (x2) => Math.round(x2).toString(2), + "c": (x2) => x2 + "", + "d": formatDecimal, + "e": (x2, p) => x2.toExponential(p), + "f": (x2, p) => x2.toFixed(p), + "g": (x2, p) => x2.toPrecision(p), + "o": (x2) => Math.round(x2).toString(8), + "p": (x2, p) => formatRounded(x2 * 100, p), + "r": formatRounded, + "s": formatPrefixAuto, + "X": (x2) => Math.round(x2).toString(16).toUpperCase(), + "x": (x2) => Math.round(x2).toString(16) + }; + function identity$5(x2) { + return x2; + } + var map$1 = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; + function formatLocale$1(locale2) { + var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$5 : formatGroup(map$1.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$5 : formatNumerals(map$1.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "−" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; + function newFormat(specifier) { + specifier = formatSpecifier(specifier); + var fill2 = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol2 = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type2 = specifier.type; + if (type2 === "n") comma = true, type2 = "g"; + else if (!formatTypes[type2]) precision === void 0 && (precision = 12), trim = true, type2 = "g"; + if (zero2 || fill2 === "0" && align === "=") zero2 = true, fill2 = "0", align = "="; + var prefix = symbol2 === "$" ? currencyPrefix : symbol2 === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol2 === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; + var formatType = formatTypes[type2], maybeSuffix = /[defgprs%]/.test(type2); + precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); + function format2(value2) { + var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; + if (type2 === "c") { + valueSuffix = formatType(value2) + valueSuffix; + value2 = ""; } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for(; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for(; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - buffer[offset + i - d] |= s * 128; -}; - -},{}],"70Sp2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dsvFormat", ()=>(0, _dsvJsDefault.default)); -parcelHelpers.export(exports, "csvParse", ()=>(0, _csvJs.csvParse)); -parcelHelpers.export(exports, "csvParseRows", ()=>(0, _csvJs.csvParseRows)); -parcelHelpers.export(exports, "csvFormat", ()=>(0, _csvJs.csvFormat)); -parcelHelpers.export(exports, "csvFormatBody", ()=>(0, _csvJs.csvFormatBody)); -parcelHelpers.export(exports, "csvFormatRows", ()=>(0, _csvJs.csvFormatRows)); -parcelHelpers.export(exports, "csvFormatRow", ()=>(0, _csvJs.csvFormatRow)); -parcelHelpers.export(exports, "csvFormatValue", ()=>(0, _csvJs.csvFormatValue)); -parcelHelpers.export(exports, "tsvParse", ()=>(0, _tsvJs.tsvParse)); -parcelHelpers.export(exports, "tsvParseRows", ()=>(0, _tsvJs.tsvParseRows)); -parcelHelpers.export(exports, "tsvFormat", ()=>(0, _tsvJs.tsvFormat)); -parcelHelpers.export(exports, "tsvFormatBody", ()=>(0, _tsvJs.tsvFormatBody)); -parcelHelpers.export(exports, "tsvFormatRows", ()=>(0, _tsvJs.tsvFormatRows)); -parcelHelpers.export(exports, "tsvFormatRow", ()=>(0, _tsvJs.tsvFormatRow)); -parcelHelpers.export(exports, "tsvFormatValue", ()=>(0, _tsvJs.tsvFormatValue)); -parcelHelpers.export(exports, "autoType", ()=>(0, _autoTypeJsDefault.default)); -var _dsvJs = require("./dsv.js"); -var _dsvJsDefault = parcelHelpers.interopDefault(_dsvJs); -var _csvJs = require("./csv.js"); -var _tsvJs = require("./tsv.js"); -var _autoTypeJs = require("./autoType.js"); -var _autoTypeJsDefault = parcelHelpers.interopDefault(_autoTypeJs); - -},{"./dsv.js":"fRZim","./csv.js":false,"./tsv.js":false,"./autoType.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fRZim":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(delimiter) { - var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0); - function parse(text, f) { - var convert, columns, rows = parseRows(text, function(row, i) { - if (convert) return convert(row, i - 1); - columns = row, convert = f ? customConverter(row, f) : objectConverter(row); - }); - rows.columns = columns || []; - return rows; - } - function parseRows(text, f) { - var rows = [], N = text.length, I = 0, n = 0, t, eof = N <= 0, eol = false; // current token followed by EOL? - // Strip the trailing newline. - if (text.charCodeAt(N - 1) === NEWLINE) --N; - if (text.charCodeAt(N - 1) === RETURN) --N; - function token() { - if (eof) return EOF; - if (eol) return eol = false, EOL; - // Unescape quotes. - var i, j = I, c; - if (text.charCodeAt(j) === QUOTE) { - while(I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); - if ((i = I) >= N) eof = true; - else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } - return text.slice(j + 1, i - 1).replace(/""/g, "\""); - } - // Find next delimiter or newline. - while(I < N){ - if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true; - else if (c === RETURN) { - eol = true; - if (text.charCodeAt(I) === NEWLINE) ++I; - } else if (c !== DELIMITER) continue; - return text.slice(j, i); - } - // Return last token before EOF. - return eof = true, text.slice(j, N); - } - while((t = token()) !== EOF){ - var row = []; - while(t !== EOL && t !== EOF)row.push(t), t = token(); - if (f && (row = f(row, n++)) == null) continue; - rows.push(row); + value2 = +value2; + var valueNegative = value2 < 0 || 1 / value2 < 0; + value2 = isNaN(value2) ? nan : formatType(Math.abs(value2), precision); + if (trim) value2 = formatTrim(value2); + if (valueNegative && +value2 === 0 && sign2 !== "+") valueNegative = false; + valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; + valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); + if (maybeSuffix) { + i = -1, n = value2.length; + while (++i < n) { + if (c2 = value2.charCodeAt(i), 48 > c2 || c2 > 57) { + valueSuffix = (c2 === 46 ? decimal + value2.slice(i + 1) : value2.slice(i)) + valueSuffix; + value2 = value2.slice(0, i); + break; + } } - return rows; - } - function preformatBody(rows, columns) { - return rows.map(function(row) { - return columns.map(function(column) { - return formatValue(row[column]); - }).join(delimiter); - }); + } } - function format(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return [ - columns.map(formatValue).join(delimiter) - ].concat(preformatBody(rows, columns)).join("\n"); - } - function formatBody(rows, columns) { - if (columns == null) columns = inferColumns(rows); - return preformatBody(rows, columns).join("\n"); - } - function formatRows(rows) { - return rows.map(formatRow).join("\n"); - } - function formatRow(row) { - return row.map(formatValue).join(delimiter); - } - function formatValue(value) { - return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; + if (comma && !zero2) value2 = group2(value2, Infinity); + var length2 = valuePrefix.length + value2.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) : ""; + if (comma && zero2) value2 = group2(padding2 + value2, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; + switch (align) { + case "<": + value2 = valuePrefix + value2 + valueSuffix + padding2; + break; + case "=": + value2 = valuePrefix + padding2 + value2 + valueSuffix; + break; + case "^": + value2 = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value2 + valueSuffix + padding2.slice(length2); + break; + default: + value2 = padding2 + valuePrefix + value2 + valueSuffix; + break; } - return { - parse: parse, - parseRows: parseRows, - format: format, - formatBody: formatBody, - formatRows: formatRows, - formatRow: formatRow, - formatValue: formatValue - }; - }); -var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; -function objectConverter(columns) { - return new Function("d", "return {" + columns.map(function(name, i) { - return JSON.stringify(name) + ": d[" + i + "] || \"\""; - }).join(",") + "}"); -} -function customConverter(columns, f) { - var object = objectConverter(columns); - return function(row, i) { - return f(object(row), i, columns); + return numerals(value2); + } + format2.toString = function() { + return specifier + ""; + }; + return format2; + } + function formatPrefix2(specifier, value2) { + var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value2) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; + return function(value3) { + return f(k * value3) + prefix; + }; + } + return { + format: newFormat, + formatPrefix: formatPrefix2 }; -} -// Compute unique columns in order of discovery. -function inferColumns(rows) { - var columnSet = Object.create(null), columns = []; - rows.forEach(function(row) { - for(var column in row)if (!(column in columnSet)) columns.push(columnSet[column] = column); - }); - return columns; -} -function pad(value, width) { - var s = value + "", length = s.length; - return length < width ? new Array(width - length + 1).join(0) + s : s; -} -function formatYear(year) { - return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); -} -function formatDate(date) { - var hours = date.getUTCHours(), minutes = date.getUTCMinutes(), seconds = date.getUTCSeconds(), milliseconds = date.getUTCMilliseconds(); - return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear(), 4) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aKIOa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bbox", ()=>(0, _bboxJsDefault.default)); -parcelHelpers.export(exports, "feature", ()=>(0, _featureJsDefault.default)); -parcelHelpers.export(exports, "mesh", ()=>(0, _meshJsDefault.default)); -parcelHelpers.export(exports, "meshArcs", ()=>(0, _meshJs.meshArcs)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "mergeArcs", ()=>(0, _mergeJs.mergeArcs)); -parcelHelpers.export(exports, "neighbors", ()=>(0, _neighborsJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "transform", ()=>(0, _transformJsDefault.default)); -parcelHelpers.export(exports, "untransform", ()=>(0, _untransformJsDefault.default)); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _featureJs = require("./feature.js"); -var _featureJsDefault = parcelHelpers.interopDefault(_featureJs); -var _meshJs = require("./mesh.js"); -var _meshJsDefault = parcelHelpers.interopDefault(_meshJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _neighborsJs = require("./neighbors.js"); -var _neighborsJsDefault = parcelHelpers.interopDefault(_neighborsJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"e3LWp","./feature.js":"6K0pm","./mesh.js":"k2dDp","./merge.js":"7l4hb","./neighbors.js":"9d2MJ","./quantize.js":"kXipT","./transform.js":"ToH0M","./untransform.js":"6T4yq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e3LWp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - var t = (0, _transformJsDefault.default)(topology.transform), key, x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0; - function bboxPoint(p) { - p = t(p); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - function bboxGeometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(bboxGeometry); - break; - case "Point": - bboxPoint(o.coordinates); - break; - case "MultiPoint": - o.coordinates.forEach(bboxPoint); - break; - } + } + var locale$2; + var format$3; + var formatPrefix; + defaultLocale$2({ + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); + function defaultLocale$2(definition2) { + locale$2 = formatLocale$1(definition2); + format$3 = locale$2.format; + formatPrefix = locale$2.formatPrefix; + return locale$2; + } + function precisionFixed(step) { + return Math.max(0, -exponent(Math.abs(step))); + } + function precisionPrefix(step, value2) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value2) / 3))) * 3 - exponent(Math.abs(step))); + } + function precisionRound(step, max2) { + step = Math.abs(step), max2 = Math.abs(max2) - step; + return Math.max(0, exponent(max2) - exponent(step)) + 1; + } + const t0$2 = /* @__PURE__ */ new Date(), t1$1 = /* @__PURE__ */ new Date(); + function timeInterval$1(floori, offseti, count2, field2) { + function interval2(date2) { + return floori(date2 = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+date2)), date2; + } + interval2.floor = (date2) => { + return floori(date2 = /* @__PURE__ */ new Date(+date2)), date2; + }; + interval2.ceil = (date2) => { + return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2; + }; + interval2.round = (date2) => { + const d0 = interval2(date2), d1 = interval2.ceil(date2); + return date2 - d0 < d1 - date2 ? d0 : d1; + }; + interval2.offset = (date2, step) => { + return offseti(date2 = /* @__PURE__ */ new Date(+date2), step == null ? 1 : Math.floor(step)), date2; + }; + interval2.range = (start, stop2, step) => { + const range2 = []; + start = interval2.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop2) || !(step > 0)) return range2; + let previous; + do + range2.push(previous = /* @__PURE__ */ new Date(+start)), offseti(start, step), floori(start); + while (previous < start && start < stop2); + return range2; + }; + interval2.filter = (test2) => { + return timeInterval$1((date2) => { + if (date2 >= date2) while (floori(date2), !test2(date2)) date2.setTime(date2 - 1); + }, (date2, step) => { + if (date2 >= date2) { + if (step < 0) while (++step <= 0) { + while (offseti(date2, -1), !test2(date2)) { + } + } + else while (--step >= 0) { + while (offseti(date2, 1), !test2(date2)) { + } + } } - topology.arcs.forEach(function(arc) { - var i = -1, n = arc.length, p; - while(++i < n){ - p = t(arc[i], i); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - }); - for(key in topology.objects)bboxGeometry(topology.objects[key]); - return [ - x0, - y0, - x1, - y1 - ]; + }); + }; + if (count2) { + interval2.count = (start, end) => { + t0$2.setTime(+start), t1$1.setTime(+end); + floori(t0$2), floori(t1$1); + return Math.floor(count2(t0$2, t1$1)); + }; + interval2.every = (step) => { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field2 ? (d) => field2(d) % step === 0 : (d) => interval2.count(0, d) % step === 0); + }; + } + return interval2; + } + const millisecond = timeInterval$1(() => { + }, (date2, step) => { + date2.setTime(+date2 + step); + }, (start, end) => { + return end - start; + }); + millisecond.every = (k) => { + k = Math.floor(k); + if (!isFinite(k) || !(k > 0)) return null; + if (!(k > 1)) return millisecond; + return timeInterval$1((date2) => { + date2.setTime(Math.floor(date2 / k) * k); + }, (date2, step) => { + date2.setTime(+date2 + step * k); + }, (start, end) => { + return (end - start) / k; }); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./transform.js":"ToH0M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ToH0M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - while(j < n)output[j] = input[j], ++j; - return output; - }; + }; + millisecond.range; + const durationSecond$1 = 1e3; + const durationMinute$1 = durationSecond$1 * 60; + const durationHour$1 = durationMinute$1 * 60; + const durationDay$1 = durationHour$1 * 24; + const durationWeek$1 = durationDay$1 * 7; + const durationMonth$1 = durationDay$1 * 30; + const durationYear$1 = durationDay$1 * 365; + const second = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds()); + }, (date2, step) => { + date2.setTime(+date2 + step * durationSecond$1); + }, (start, end) => { + return (end - start) / durationSecond$1; + }, (date2) => { + return date2.getUTCSeconds(); + }); + second.range; + const timeMinute = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getMinutes(); + }); + timeMinute.range; + const utcMinute = timeInterval$1((date2) => { + date2.setUTCSeconds(0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationMinute$1); + }, (start, end) => { + return (end - start) / durationMinute$1; + }, (date2) => { + return date2.getUTCMinutes(); + }); + utcMinute.range; + const timeHour = timeInterval$1((date2) => { + date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond$1 - date2.getMinutes() * durationMinute$1); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getHours(); + }); + timeHour.range; + const utcHour = timeInterval$1((date2) => { + date2.setUTCMinutes(0, 0, 0); + }, (date2, step) => { + date2.setTime(+date2 + step * durationHour$1); + }, (start, end) => { + return (end - start) / durationHour$1; + }, (date2) => { + return date2.getUTCHours(); + }); + utcHour.range; + const timeDay = timeInterval$1( + (date2) => date2.setHours(0, 0, 0, 0), + (date2, step) => date2.setDate(date2.getDate() + step), + (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, + (date2) => date2.getDate() - 1 + ); + timeDay.range; + const utcDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return date2.getUTCDate() - 1; + }); + utcDay.range; + const unixDay = timeInterval$1((date2) => { + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step); + }, (start, end) => { + return (end - start) / durationDay$1; + }, (date2) => { + return Math.floor(date2 / durationDay$1); + }); + unixDay.range; + function timeWeekday(i) { + return timeInterval$1((date2) => { + date2.setDate(date2.getDate() - (date2.getDay() + 7 - i) % 7); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setDate(date2.getDate() + step * 7); + }, (start, end) => { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1; }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"dZ2Lk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dZ2Lk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; + } + const timeSunday = timeWeekday(0); + const timeMonday = timeWeekday(1); + const timeTuesday = timeWeekday(2); + const timeWednesday = timeWeekday(3); + const timeThursday = timeWeekday(4); + const timeFriday = timeWeekday(5); + const timeSaturday = timeWeekday(6); + timeSunday.range; + timeMonday.range; + timeTuesday.range; + timeWednesday.range; + timeThursday.range; + timeFriday.range; + timeSaturday.range; + function utcWeekday(i) { + return timeInterval$1((date2) => { + date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i) % 7); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCDate(date2.getUTCDate() + step * 7); + }, (start, end) => { + return (end - start) / durationWeek$1; }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6K0pm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function(o) { - return feature(topology, o); - }) - } : feature(topology, o); + } + const utcSunday = utcWeekday(0); + const utcMonday = utcWeekday(1); + const utcTuesday = utcWeekday(2); + const utcWednesday = utcWeekday(3); + const utcThursday = utcWeekday(4); + const utcFriday = utcWeekday(5); + const utcSaturday = utcWeekday(6); + utcSunday.range; + utcMonday.range; + utcTuesday.range; + utcWednesday.range; + utcThursday.range; + utcFriday.range; + utcSaturday.range; + const timeMonth = timeInterval$1((date2) => { + date2.setDate(1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setMonth(date2.getMonth() + step); + }, (start, end) => { + return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; + }, (date2) => { + return date2.getMonth(); + }); + timeMonth.range; + const utcMonth = timeInterval$1((date2) => { + date2.setUTCDate(1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCMonth(date2.getUTCMonth() + step); + }, (start, end) => { + return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; + }, (date2) => { + return date2.getUTCMonth(); + }); + utcMonth.range; + const timeYear = timeInterval$1((date2) => { + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step); + }, (start, end) => { + return end.getFullYear() - start.getFullYear(); + }, (date2) => { + return date2.getFullYear(); + }); + timeYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setFullYear(Math.floor(date2.getFullYear() / k) * k); + date2.setMonth(0, 1); + date2.setHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setFullYear(date2.getFullYear() + step * k); }); -parcelHelpers.export(exports, "object", ()=>object); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); -function feature(topology, o) { - var id = o.id, bbox = o.bbox, properties = o.properties == null ? {} : o.properties, geometry = object(topology, o); - return id == null && bbox == null ? { - type: "Feature", - properties: properties, - geometry: geometry - } : bbox == null ? { - type: "Feature", - id: id, - properties: properties, - geometry: geometry - } : { - type: "Feature", - id: id, - bbox: bbox, - properties: properties, - geometry: geometry - }; -} -function object(topology, o) { - var transformPoint = (0, _transformJsDefault.default)(topology.transform), arcs = topology.arcs; - function arc(i, points) { - if (points.length) points.pop(); - for(var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k)points.push(transformPoint(a[k], k)); - if (i < 0) (0, _reverseJsDefault.default)(points, n); - } - function point(p) { - return transformPoint(p); - } - function line(arcs) { - var points = []; - for(var i = 0, n = arcs.length; i < n; ++i)arc(arcs[i], points); - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - return points; - } - function ring(arcs) { - var points = line(arcs); - while(points.length < 4)points.push(points[0]); // This may happen if an arc has only two points. - return points; - } - function polygon(arcs) { - return arcs.map(ring); - } - function geometry(o) { - var type = o.type, coordinates; - switch(type){ - case "GeometryCollection": - return { - type: type, - geometries: o.geometries.map(geometry) - }; - case "Point": - coordinates = point(o.coordinates); - break; - case "MultiPoint": - coordinates = o.coordinates.map(point); - break; - case "LineString": - coordinates = line(o.arcs); - break; - case "MultiLineString": - coordinates = o.arcs.map(line); - break; - case "Polygon": - coordinates = polygon(o.arcs); - break; - case "MultiPolygon": - coordinates = o.arcs.map(polygon); - break; - default: - return null; - } - return { - type: type, - coordinates: coordinates - }; - } - return geometry(o); -} - -},{"./reverse.js":"7nB9v","./transform.js":"ToH0M","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7nB9v":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(array, n) { - var t, j = array.length, i = j - n; - while(i < --j)t = array[i], array[i++] = array[j], array[j] = t; + }; + timeYear.range; + const utcYear = timeInterval$1((date2) => { + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step); + }, (start, end) => { + return end.getUTCFullYear() - start.getUTCFullYear(); + }, (date2) => { + return date2.getUTCFullYear(); + }); + utcYear.every = (k) => { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval$1((date2) => { + date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k) * k); + date2.setUTCMonth(0, 1); + date2.setUTCHours(0, 0, 0, 0); + }, (date2, step) => { + date2.setUTCFullYear(date2.getUTCFullYear() + step * k); }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k2dDp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, meshArcs.apply(this, arguments)); + }; + utcYear.range; + function ticker(year, month, week2, day, hour, minute) { + const tickIntervals = [ + [second, 1, durationSecond$1], + [second, 5, 5 * durationSecond$1], + [second, 15, 15 * durationSecond$1], + [second, 30, 30 * durationSecond$1], + [minute, 1, durationMinute$1], + [minute, 5, 5 * durationMinute$1], + [minute, 15, 15 * durationMinute$1], + [minute, 30, 30 * durationMinute$1], + [hour, 1, durationHour$1], + [hour, 3, 3 * durationHour$1], + [hour, 6, 6 * durationHour$1], + [hour, 12, 12 * durationHour$1], + [day, 1, durationDay$1], + [day, 2, 2 * durationDay$1], + [week2, 1, durationWeek$1], + [month, 1, durationMonth$1], + [month, 3, 3 * durationMonth$1], + [year, 1, durationYear$1] + ]; + function ticks2(start, stop2, count2) { + const reverse2 = stop2 < start; + if (reverse2) [start, stop2] = [stop2, start]; + const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval(start, stop2, count2); + const ticks3 = interval2 ? interval2.range(start, +stop2 + 1) : []; + return reverse2 ? ticks3.reverse() : ticks3; + } + function tickInterval(start, stop2, count2) { + const target2 = Math.abs(stop2 - start) / count2; + const i = bisector(([, , step2]) => step2).right(tickIntervals, target2); + if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop2 / durationYear$1, count2)); + if (i === 0) return millisecond.every(Math.max(tickStep(start, stop2, count2), 1)); + const [t, step] = tickIntervals[target2 / tickIntervals[i - 1][2] < tickIntervals[i][2] / target2 ? i - 1 : i]; + return t.every(step); + } + return [ticks2, tickInterval]; + } + const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute); + const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute); + const YEAR = "year"; + const QUARTER = "quarter"; + const MONTH = "month"; + const WEEK = "week"; + const DATE = "date"; + const DAY = "day"; + const DAYOFYEAR = "dayofyear"; + const HOURS = "hours"; + const MINUTES = "minutes"; + const SECONDS = "seconds"; + const MILLISECONDS = "milliseconds"; + const TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS]; + const UNITS = TIME_UNITS.reduce((o, u2, i) => (o[u2] = 1 + i, o), {}); + function timeUnits(units) { + const u2 = array$5(units).slice(), m2 = {}; + if (!u2.length) error("Missing time unit."); + u2.forEach((unit2) => { + if (has$1(UNITS, unit2)) { + m2[unit2] = 1; + } else { + error(`Invalid time unit: ${unit2}.`); + } }); -parcelHelpers.export(exports, "meshArcs", ()=>meshArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter); - else for(i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i)arcs[i] = i; - return { - type: "MultiLineString", - arcs: (0, _stitchJsDefault.default)(topology, arcs) - }; -} -function extractArcs(topology, object, filter) { - var arcs = [], geomsByArc = [], geom; - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({ - i: i, - g: geom - }); + const numTypes = (m2[WEEK] || m2[DAY] ? 1 : 0) + (m2[QUARTER] || m2[MONTH] || m2[DATE] ? 1 : 0) + (m2[DAYOFYEAR] ? 1 : 0); + if (numTypes > 1) { + error(`Incompatible time units: ${units}`); } - function extract1(arcs) { - arcs.forEach(extract0); - } - function extract2(arcs) { - arcs.forEach(extract1); + u2.sort((a2, b2) => UNITS[a2] - UNITS[b2]); + return u2; + } + const defaultSpecifiers = { + [YEAR]: "%Y ", + [QUARTER]: "Q%q ", + [MONTH]: "%b ", + [DATE]: "%d ", + [WEEK]: "W%U ", + [DAY]: "%a ", + [DAYOFYEAR]: "%j ", + [HOURS]: "%H:00", + [MINUTES]: "00:%M", + [SECONDS]: ":%S", + [MILLISECONDS]: ".%L", + [`${YEAR}-${MONTH}`]: "%Y-%m ", + [`${YEAR}-${MONTH}-${DATE}`]: "%Y-%m-%d ", + [`${HOURS}-${MINUTES}`]: "%H:%M" + }; + function timeUnitSpecifier(units, specifiers) { + const s = extend$1({}, defaultSpecifiers, specifiers), u2 = timeUnits(units), n = u2.length; + let fmt = "", start = 0, end, key2; + for (start = 0; start < n; ) { + for (end = u2.length; end > start; --end) { + key2 = u2.slice(start, end).join("-"); + if (s[key2] != null) { + fmt += s[key2]; + start = end; + break; + } + } } - function extract3(arcs) { - arcs.forEach(extract2); + return fmt.trim(); + } + const t0$1 = /* @__PURE__ */ new Date(); + function localYear(y2) { + t0$1.setFullYear(y2); + t0$1.setMonth(0); + t0$1.setDate(1); + t0$1.setHours(0, 0, 0, 0); + return t0$1; + } + function dayofyear(d) { + return localDayOfYear(new Date(d)); + } + function week(d) { + return localWeekNum(new Date(d)); + } + function localDayOfYear(d) { + return timeDay.count(localYear(d.getFullYear()) - 1, d); + } + function localWeekNum(d) { + return timeSunday.count(localYear(d.getFullYear()) - 1, d); + } + function localFirst(y2) { + return localYear(y2).getDay(); + } + function localDate$1(y2, m2, d, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(-1, m2, d, H, M2, S, L); + date2.setFullYear(y2); + return date2; } - function geometry(o) { - switch(geom = o, o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "LineString": - extract1(o.arcs); - break; - case "MultiLineString": - case "Polygon": - extract2(o.arcs); - break; - case "MultiPolygon": - extract3(o.arcs); - break; - } + return new Date(y2, m2, d, H, M2, S, L); + } + function utcdayofyear(d) { + return utcDayOfYear(new Date(d)); + } + function utcweek(d) { + return utcWeekNum(new Date(d)); + } + function utcDayOfYear(d) { + const y2 = Date.UTC(d.getUTCFullYear(), 0, 1); + return utcDay.count(y2 - 1, d); + } + function utcWeekNum(d) { + const y2 = Date.UTC(d.getUTCFullYear(), 0, 1); + return utcSunday.count(y2 - 1, d); + } + function utcFirst(y2) { + t0$1.setTime(Date.UTC(y2, 0, 1)); + return t0$1.getUTCDay(); + } + function utcDate$1(y2, m2, d, H, M2, S, L) { + if (0 <= y2 && y2 < 100) { + const date2 = new Date(Date.UTC(-1, m2, d, H, M2, S, L)); + date2.setUTCFullYear(d.y); + return date2; } - geometry(object); - geomsByArc.forEach(filter == null ? function(geoms) { - arcs.push(geoms[0].i); - } : function(geoms) { - if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); - }); - return arcs; -} - -},{"./feature.js":"6K0pm","./stitch.js":"26mb3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"26mb3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, arcs) { - var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1; - // Stitch empty arcs first, since they may be subsumed by other arcs. - arcs.forEach(function(i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], t; - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - }); - arcs.forEach(function(i) { - var e = ends(i), start = e[0], end = e[1], f, g; - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } else { - f = [ - i - ]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1; - if (topology.transform) p1 = [ - 0, - 0 - ], arc.forEach(function(dp) { - p1[0] += dp[0], p1[1] += dp[1]; - }); - else p1 = arc[arc.length - 1]; - return i < 0 ? [ - p1, - p0 - ] : [ - p0, - p1 - ]; - } - function flush(fragmentByEnd, fragmentByStart) { - for(var k in fragmentByEnd){ - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function(i) { - stitchedArcs[i < 0 ? ~i : i] = 1; - }); - fragments.push(f); - } - } - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function(i) { - if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([ - i - ]); - }); - return fragments; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7l4hb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology) { - return (0, _featureJs.object)(topology, mergeArcs.apply(this, arguments)); - }); -parcelHelpers.export(exports, "mergeArcs", ()=>mergeArcs); -var _featureJs = require("./feature.js"); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -function planarRingArea(ring) { - var i = -1, n = ring.length, a, b = ring[n - 1], area = 0; - while(++i < n)a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - return Math.abs(area); // Note: doubled area! -} -function mergeArcs(topology, objects) { - var polygonsByArc = {}, polygons = [], groups = []; - objects.forEach(geometry); - function geometry(o) { - switch(o.type){ - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - case "Polygon": - extract(o.arcs); - break; - case "MultiPolygon": - o.arcs.forEach(extract); - break; - } + return new Date(Date.UTC(y2, m2, d, H, M2, S, L)); + } + function floor(units, step, get2, inv, newDate2) { + const s = step || 1, b2 = peek$1(units), _ = (unit2, p, key2) => { + key2 = key2 || unit2; + return getUnit(get2[key2], inv[key2], unit2 === b2 && s, p); + }; + const t = /* @__PURE__ */ new Date(), u2 = toSet(units), y2 = u2[YEAR] ? _(YEAR) : constant$5(2012), m2 = u2[MONTH] ? _(MONTH) : u2[QUARTER] ? _(QUARTER) : zero$3, d = u2[WEEK] && u2[DAY] ? _(DAY, 1, WEEK + DAY) : u2[WEEK] ? _(WEEK, 1) : u2[DAY] ? _(DAY, 1) : u2[DATE] ? _(DATE, 1) : u2[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one$2, H = u2[HOURS] ? _(HOURS) : zero$3, M2 = u2[MINUTES] ? _(MINUTES) : zero$3, S = u2[SECONDS] ? _(SECONDS) : zero$3, L = u2[MILLISECONDS] ? _(MILLISECONDS) : zero$3; + return function(v) { + t.setTime(+v); + const year = y2(t); + return newDate2(year, m2(t), d(t, year), H(t), M2(t), S(t), L(t)); + }; + } + function getUnit(f, inv, step, phase) { + const u2 = step <= 1 ? f : phase ? (d, y2) => phase + step * Math.floor((f(d, y2) - phase) / step) : (d, y2) => step * Math.floor(f(d, y2) / step); + return inv ? (d, y2) => inv(u2(d, y2), y2) : u2; + } + function weekday(week2, day, firstDay) { + return day + week2 * 7 - (firstDay + 6) % 7; + } + const localGet = { + [YEAR]: (d) => d.getFullYear(), + [QUARTER]: (d) => Math.floor(d.getMonth() / 3), + [MONTH]: (d) => d.getMonth(), + [DATE]: (d) => d.getDate(), + [HOURS]: (d) => d.getHours(), + [MINUTES]: (d) => d.getMinutes(), + [SECONDS]: (d) => d.getSeconds(), + [MILLISECONDS]: (d) => d.getMilliseconds(), + [DAYOFYEAR]: (d) => localDayOfYear(d), + [WEEK]: (d) => localWeekNum(d), + [WEEK + DAY]: (d, y2) => weekday(localWeekNum(d), d.getDay(), localFirst(y2)), + [DAY]: (d, y2) => weekday(1, d.getDay(), localFirst(y2)) + }; + const localInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, localFirst(y2)) + }; + function timeFloor(units, step) { + return floor(units, step || 1, localGet, localInv, localDate$1); + } + const utcGet = { + [YEAR]: (d) => d.getUTCFullYear(), + [QUARTER]: (d) => Math.floor(d.getUTCMonth() / 3), + [MONTH]: (d) => d.getUTCMonth(), + [DATE]: (d) => d.getUTCDate(), + [HOURS]: (d) => d.getUTCHours(), + [MINUTES]: (d) => d.getUTCMinutes(), + [SECONDS]: (d) => d.getUTCSeconds(), + [MILLISECONDS]: (d) => d.getUTCMilliseconds(), + [DAYOFYEAR]: (d) => utcDayOfYear(d), + [WEEK]: (d) => utcWeekNum(d), + [DAY]: (d, y2) => weekday(1, d.getUTCDay(), utcFirst(y2)), + [WEEK + DAY]: (d, y2) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y2)) + }; + const utcInv = { + [QUARTER]: (q) => 3 * q, + [WEEK]: (w2, y2) => weekday(w2, 0, utcFirst(y2)) + }; + function utcFloor(units, step) { + return floor(units, step || 1, utcGet, utcInv, utcDate$1); + } + const timeIntervals = { + [YEAR]: timeYear, + [QUARTER]: timeMonth.every(3), + [MONTH]: timeMonth, + [WEEK]: timeSunday, + [DATE]: timeDay, + [DAY]: timeDay, + [DAYOFYEAR]: timeDay, + [HOURS]: timeHour, + [MINUTES]: timeMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + const utcIntervals = { + [YEAR]: utcYear, + [QUARTER]: utcMonth.every(3), + [MONTH]: utcMonth, + [WEEK]: utcSunday, + [DATE]: utcDay, + [DAY]: utcDay, + [DAYOFYEAR]: utcDay, + [HOURS]: utcHour, + [MINUTES]: utcMinute, + [SECONDS]: second, + [MILLISECONDS]: millisecond + }; + function timeInterval(unit2) { + return timeIntervals[unit2]; + } + function utcInterval(unit2) { + return utcIntervals[unit2]; + } + function offset$3(ival, date2, step) { + return ival ? ival.offset(date2, step) : void 0; + } + function timeOffset(unit2, date2, step) { + return offset$3(timeInterval(unit2), date2, step); + } + function utcOffset(unit2, date2, step) { + return offset$3(utcInterval(unit2), date2, step); + } + function sequence$1(ival, start, stop2, step) { + return ival ? ival.range(start, stop2, step) : void 0; + } + function timeSequence(unit2, start, stop2, step) { + return sequence$1(timeInterval(unit2), start, stop2, step); + } + function utcSequence(unit2, start, stop2, step) { + return sequence$1(utcInterval(unit2), start, stop2, step); + } + const durationSecond = 1e3, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; + const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [YEAR, WEEK], Month = [YEAR, MONTH], Year = [YEAR]; + const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]]; + function bin$1(opt) { + const ext = opt.extent, max2 = opt.maxbins || 40, target2 = Math.abs(span(ext)) / max2; + let i = bisector((i2) => i2[2]).right(intervals, target2), units, step; + if (i === intervals.length) { + units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max2); + } else if (i) { + i = intervals[target2 / intervals[i - 1][2] < intervals[i][2] / target2 ? i - 1 : i]; + units = i[0]; + step = i[1]; + } else { + units = Milli; + step = Math.max(tickStep(ext[0], ext[1], max2), 1); } - function extract(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); - } - function area(ring) { - return planarRingArea((0, _featureJs.object)(topology, { - type: "Polygon", - arcs: [ - ring - ] - }).coordinates[0]); - } - polygons.forEach(function(polygon) { - if (!polygon._) { - var group = [], neighbors = [ - polygon - ]; - polygon._ = 1; - groups.push(group); - while(polygon = neighbors.pop()){ - group.push(polygon); - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - polygons.forEach(function(polygon) { - delete polygon._; - }); return { - type: "MultiPolygon", - arcs: groups.map(function(polygons) { - var arcs = [], n; - // Extract the exterior (unique) arcs. - polygons.forEach(function(polygon) { - polygon.forEach(function(ring) { - ring.forEach(function(arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) arcs.push(arc); - }); - }); - }); - // Stitch the arcs into one or more rings. - arcs = (0, _stitchJsDefault.default)(topology, arcs); - // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - if ((n = arcs.length) > 1) { - for(var i = 1, k = area(arcs[0]), ki, t; i < n; ++i)if ((ki = area(arcs[i])) > k) t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - return arcs; - }).filter(function(arcs) { - return arcs.length > 0; - }) - }; -} - -},{"./feature.js":"6K0pm","./stitch.js":"26mb3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9d2MJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(objects) { - var indexesByArc = {}, neighbors = objects.map(function() { - return []; - }); - function line(arcs, i) { - arcs.forEach(function(a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i); - else indexesByArc[a] = [ - i - ]; - }); - } - function polygon(arcs, i) { - arcs.forEach(function(arc) { - line(arc, i); - }); - } - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function(o) { - geometry(o, i); - }); - else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function(arcs, i) { - arcs.forEach(function(arc) { - polygon(arc, i); - }); - } - }; - objects.forEach(geometry); - for(var i in indexesByArc){ - for(var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j)for(var k = j + 1; k < m; ++k){ - var ij = indexes[j], ik = indexes[k], n; - if ((n = neighbors[ij])[i = (0, _bisectJsDefault.default)(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = (0, _bisectJsDefault.default)(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - return neighbors; - }); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); - -},{"./bisect.js":"lbTH3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lbTH3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, x) { - var lo = 0, hi = a.length; - while(lo < hi){ - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1; - else hi = mid; - } - return lo; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kXipT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(topology, transform) { - if (topology.transform) throw new Error("already quantized"); - if (!transform || !transform.scale) { - if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be \u22652"); - box = topology.bbox || (0, _bboxJsDefault.default)(topology); - var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n; - transform = { - scale: [ - x1 - x0 ? (x1 - x0) / (n - 1) : 1, - y1 - y0 ? (y1 - y0) / (n - 1) : 1 - ], - translate: [ - x0, - y0 - ] - }; - } else box = topology.bbox; - var t = (0, _untransformJsDefault.default)(transform), box, key, inputs = topology.objects, outputs = {}; - function quantizePoint(point) { - return t(point); - } - function quantizeGeometry(input) { - var output; - switch(input.type){ - case "GeometryCollection": - output = { - type: "GeometryCollection", - geometries: input.geometries.map(quantizeGeometry) - }; - break; - case "Point": - output = { - type: "Point", - coordinates: quantizePoint(input.coordinates) - }; - break; - case "MultiPoint": - output = { - type: "MultiPoint", - coordinates: input.coordinates.map(quantizePoint) - }; - break; - default: - return input; - } - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; - } - function quantizeArc(input) { - var i = 0, j = 1, n = input.length, p, output = new Array(n); // pessimistic - output[0] = t(input[0], 0); - while(++i < n)if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; // non-coincident points - if (j === 1) output[j++] = [ - 0, - 0 - ]; // an arc must have at least two points - output.length = j; - return output; - } - for(key in inputs)outputs[key] = quantizeGeometry(inputs[key]); - return { - type: "Topology", - bbox: box, - transform: transform, - objects: outputs, - arcs: topology.arcs.map(quantizeArc) - }; - }); -var _bboxJs = require("./bbox.js"); -var _bboxJsDefault = parcelHelpers.interopDefault(_bboxJs); -var _untransformJs = require("./untransform.js"); -var _untransformJsDefault = parcelHelpers.interopDefault(_untransformJs); - -},{"./bbox.js":"e3LWp","./untransform.js":"6T4yq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6T4yq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(transform) { - if (transform == null) return 0, _identityJsDefault.default; - var x0, y0, kx = transform.scale[0], ky = transform.scale[1], dx = transform.translate[0], dy = transform.translate[1]; - return function(input, i) { - if (!i) x0 = y0 = 0; - var j = 2, n = input.length, output = new Array(n), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky); - output[0] = x1 - x0, x0 = x1; - output[1] = y1 - y0, y0 = y1; - while(j < n)output[j] = input[j], ++j; - return output; - }; - }); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); - -},{"./identity.js":"dZ2Lk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"47kOt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultLocale", ()=>defaultLocale); -parcelHelpers.export(exports, "locale", ()=>locale); -parcelHelpers.export(exports, "numberFormatDefaultLocale", ()=>numberFormatDefaultLocale); -parcelHelpers.export(exports, "numberFormatLocale", ()=>numberFormatLocale); -parcelHelpers.export(exports, "resetDefaultLocale", ()=>resetDefaultLocale); -parcelHelpers.export(exports, "resetNumberFormatDefaultLocale", ()=>resetNumberFormatDefaultLocale); -parcelHelpers.export(exports, "resetTimeFormatDefaultLocale", ()=>resetTimeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>timeFormatDefaultLocale); -parcelHelpers.export(exports, "timeFormatLocale", ()=>timeFormatLocale); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _vegaTime = require("vega-time"); -var _vegaUtil = require("vega-util"); -var _d3TimeFormat = require("d3-time-format"); -function memoize(method) { - const cache = {}; - return (spec)=>cache[spec] || (cache[spec] = method(spec)); -} -function trimZeroes(numberFormat, decimalChar) { - return (x)=>{ - const str = numberFormat(x), dec = str.indexOf(decimalChar); - if (dec < 0) return str; - let idx = rightmostDigit(str, dec); - const end = idx < str.length ? str.slice(idx) : ''; - while(--idx > dec)if (str[idx] !== '0') { - ++idx; - break; - } - return str.slice(0, idx) + end; + units, + step }; -} -function rightmostDigit(str, dec) { - let i = str.lastIndexOf('e'), c; - if (i > 0) return i; - for(i = str.length; --i > dec;){ - c = str.charCodeAt(i); - if (c >= 48 && c <= 57) return i + 1; // is digit + } + function localDate(d) { + if (0 <= d.y && d.y < 100) { + var date2 = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); + date2.setFullYear(d.y); + return date2; } -} -function numberLocale(locale) { - const format = memoize(locale.format), formatPrefix = locale.formatPrefix; - return { - format, - formatPrefix, - formatFloat (spec) { - const s = (0, _d3Format.formatSpecifier)(spec || ','); - if (s.precision == null) { - s.precision = 12; - switch(s.type){ - case '%': - s.precision -= 2; - break; - case 'e': - s.precision -= 1; - break; - } - return trimZeroes(format(s), // number format - format('.1f')(1)[1] // decimal point character - ); - } else return format(s); - }, - formatSpan (start, stop, count, specifier) { - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ',f' : specifier); - const step = (0, _d3Array.tickStep)(start, stop, count), value = Math.max(Math.abs(start), Math.abs(stop)); - let precision; - if (specifier.precision == null) switch(specifier.type){ - case 's': - if (!isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return formatPrefix(specifier, value); - case '': - case 'e': - case 'g': - case 'p': - case 'r': - if (!isNaN(precision = (0, _d3Format.precisionRound)(step, value))) specifier.precision = precision - (specifier.type === 'e'); - break; - case 'f': - case '%': - if (!isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === '%') * 2; - break; - } - return format(specifier); - } + return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); + } + function utcDate(d) { + if (0 <= d.y && d.y < 100) { + var date2 = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); + date2.setUTCFullYear(d.y); + return date2; + } + return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); + } + function newDate(y2, m2, d) { + return { y: y2, m: m2, d, H: 0, M: 0, S: 0, L: 0 }; + } + function formatLocale(locale2) { + var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths; + var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); + var formats2 = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "f": formatMicroseconds, + "g": formatYearISO, + "G": formatFullYearISO, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "q": formatQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatSeconds, + "u": formatWeekdayNumberMonday, + "U": formatWeekNumberSunday, + "V": formatWeekNumberISO, + "w": formatWeekdayNumberSunday, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent }; -} -let defaultNumberLocale; -resetNumberFormatDefaultLocale(); -function resetNumberFormatDefaultLocale() { - return defaultNumberLocale = numberLocale({ - format: (0, _d3Format.format), - formatPrefix: (0, _d3Format.formatPrefix) - }); -} -function numberFormatLocale(definition) { - return numberLocale((0, _d3Format.formatLocale)(definition)); -} -function numberFormatDefaultLocale(definition) { - return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale; -} -function timeMultiFormat(format, interval, spec) { - spec = spec || {}; - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)(`Invalid time multi-format specifier: ${spec}`); - const second = interval((0, _vegaTime.SECONDS)), minute = interval((0, _vegaTime.MINUTES)), hour = interval((0, _vegaTime.HOURS)), day = interval((0, _vegaTime.DATE)), week = interval((0, _vegaTime.WEEK)), month = interval((0, _vegaTime.MONTH)), quarter = interval((0, _vegaTime.QUARTER)), year = interval((0, _vegaTime.YEAR)), L = format(spec[0, _vegaTime.MILLISECONDS] || '.%L'), S = format(spec[0, _vegaTime.SECONDS] || ':%S'), M = format(spec[0, _vegaTime.MINUTES] || '%I:%M'), H = format(spec[0, _vegaTime.HOURS] || '%I %p'), d = format(spec[0, _vegaTime.DATE] || spec[0, _vegaTime.DAY] || '%a %d'), w = format(spec[0, _vegaTime.WEEK] || '%b %d'), m = format(spec[0, _vegaTime.MONTH] || '%B'), q = format(spec[0, _vegaTime.QUARTER] || '%B'), y = format(spec[0, _vegaTime.YEAR] || '%Y'); - return (date)=>(second(date) < date ? L : minute(date) < date ? S : hour(date) < date ? M : day(date) < date ? H : month(date) < date ? week(date) < date ? d : w : year(date) < date ? quarter(date) < date ? m : q : y)(date); -} -function timeLocale(locale) { - const timeFormat = memoize(locale.format), utcFormat = memoize(locale.utcFormat); - return { - timeFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? timeFormat(spec) : timeMultiFormat(timeFormat, (0, _vegaTime.timeInterval), spec), - utcFormat: (spec)=>(0, _vegaUtil.isString)(spec) ? utcFormat(spec) : timeMultiFormat(utcFormat, (0, _vegaTime.utcInterval), spec), - timeParse: memoize(locale.parse), - utcParse: memoize(locale.utcParse) - }; -} -let defaultTimeLocale; -resetTimeFormatDefaultLocale(); -function resetTimeFormatDefaultLocale() { - return defaultTimeLocale = timeLocale({ - format: (0, _d3TimeFormat.timeFormat), - parse: (0, _d3TimeFormat.timeParse), - utcFormat: (0, _d3TimeFormat.utcFormat), - utcParse: (0, _d3TimeFormat.utcParse) - }); -} -function timeFormatLocale(definition) { - return timeLocale((0, _d3TimeFormat.timeFormatLocale)(definition)); -} -function timeFormatDefaultLocale(definition) { - return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale; -} -const createLocale = (number, time)=>(0, _vegaUtil.extend)({}, number, time); -function locale(numberSpec, timeSpec) { - const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); - const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); - return createLocale(number, time); -} -function defaultLocale(numberSpec, timeSpec) { - const args = arguments.length; - if (args && args !== 2) (0, _vegaUtil.error)('defaultLocale expects either zero or two arguments.'); - return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); -} -function resetDefaultLocale() { - resetNumberFormatDefaultLocale(); - resetTimeFormatDefaultLocale(); - return defaultLocale(); -} - -},{"d3-array":"6IwJG","d3-format":"8dYFL","vega-time":"27kpp","vega-util":"bApja","d3-time-format":"242jH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6IwJG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisect", ()=>(0, _bisectJsDefault.default)); -parcelHelpers.export(exports, "bisectRight", ()=>(0, _bisectJs.bisectRight)); -parcelHelpers.export(exports, "bisectLeft", ()=>(0, _bisectJs.bisectLeft)); -parcelHelpers.export(exports, "bisectCenter", ()=>(0, _bisectJs.bisectCenter)); -parcelHelpers.export(exports, "ascending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "bisector", ()=>(0, _bisectorJsDefault.default)); -parcelHelpers.export(exports, "blur", ()=>(0, _blurJs.blur)); -parcelHelpers.export(exports, "blur2", ()=>(0, _blurJs.blur2)); -parcelHelpers.export(exports, "blurImage", ()=>(0, _blurJs.blurImage)); -parcelHelpers.export(exports, "count", ()=>(0, _countJsDefault.default)); -parcelHelpers.export(exports, "cross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "cumsum", ()=>(0, _cumsumJsDefault.default)); -parcelHelpers.export(exports, "descending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "deviation", ()=>(0, _deviationJsDefault.default)); -parcelHelpers.export(exports, "extent", ()=>(0, _extentJsDefault.default)); -parcelHelpers.export(exports, "Adder", ()=>(0, _fsumJs.Adder)); -parcelHelpers.export(exports, "fsum", ()=>(0, _fsumJs.fsum)); -parcelHelpers.export(exports, "fcumsum", ()=>(0, _fsumJs.fcumsum)); -parcelHelpers.export(exports, "group", ()=>(0, _groupJsDefault.default)); -parcelHelpers.export(exports, "flatGroup", ()=>(0, _groupJs.flatGroup)); -parcelHelpers.export(exports, "flatRollup", ()=>(0, _groupJs.flatRollup)); -parcelHelpers.export(exports, "groups", ()=>(0, _groupJs.groups)); -parcelHelpers.export(exports, "index", ()=>(0, _groupJs.index)); -parcelHelpers.export(exports, "indexes", ()=>(0, _groupJs.indexes)); -parcelHelpers.export(exports, "rollup", ()=>(0, _groupJs.rollup)); -parcelHelpers.export(exports, "rollups", ()=>(0, _groupJs.rollups)); -parcelHelpers.export(exports, "groupSort", ()=>(0, _groupSortJsDefault.default)); -parcelHelpers.export(exports, "bin", ()=>(0, _binJsDefault.default)) // Deprecated; use bin. -; -parcelHelpers.export(exports, "histogram", ()=>(0, _binJsDefault.default)); -parcelHelpers.export(exports, "thresholdFreedmanDiaconis", ()=>(0, _freedmanDiaconisJsDefault.default)); -parcelHelpers.export(exports, "thresholdScott", ()=>(0, _scottJsDefault.default)); -parcelHelpers.export(exports, "thresholdSturges", ()=>(0, _sturgesJsDefault.default)); -parcelHelpers.export(exports, "max", ()=>(0, _maxJsDefault.default)); -parcelHelpers.export(exports, "maxIndex", ()=>(0, _maxIndexJsDefault.default)); -parcelHelpers.export(exports, "mean", ()=>(0, _meanJsDefault.default)); -parcelHelpers.export(exports, "median", ()=>(0, _medianJsDefault.default)); -parcelHelpers.export(exports, "medianIndex", ()=>(0, _medianJs.medianIndex)); -parcelHelpers.export(exports, "merge", ()=>(0, _mergeJsDefault.default)); -parcelHelpers.export(exports, "min", ()=>(0, _minJsDefault.default)); -parcelHelpers.export(exports, "minIndex", ()=>(0, _minIndexJsDefault.default)); -parcelHelpers.export(exports, "mode", ()=>(0, _modeJsDefault.default)); -parcelHelpers.export(exports, "nice", ()=>(0, _niceJsDefault.default)); -parcelHelpers.export(exports, "pairs", ()=>(0, _pairsJsDefault.default)); -parcelHelpers.export(exports, "permute", ()=>(0, _permuteJsDefault.default)); -parcelHelpers.export(exports, "quantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "quantileIndex", ()=>(0, _quantileJs.quantileIndex)); -parcelHelpers.export(exports, "quantileSorted", ()=>(0, _quantileJs.quantileSorted)); -parcelHelpers.export(exports, "quickselect", ()=>(0, _quickselectJsDefault.default)); -parcelHelpers.export(exports, "range", ()=>(0, _rangeJsDefault.default)); -parcelHelpers.export(exports, "rank", ()=>(0, _rankJsDefault.default)); -parcelHelpers.export(exports, "least", ()=>(0, _leastJsDefault.default)); -parcelHelpers.export(exports, "leastIndex", ()=>(0, _leastIndexJsDefault.default)); -parcelHelpers.export(exports, "greatest", ()=>(0, _greatestJsDefault.default)); -parcelHelpers.export(exports, "greatestIndex", ()=>(0, _greatestIndexJsDefault.default)); -parcelHelpers.export(exports, "scan", ()=>(0, _scanJsDefault.default)) // Deprecated; use leastIndex. -; -parcelHelpers.export(exports, "shuffle", ()=>(0, _shuffleJsDefault.default)); -parcelHelpers.export(exports, "shuffler", ()=>(0, _shuffleJs.shuffler)); -parcelHelpers.export(exports, "sum", ()=>(0, _sumJsDefault.default)); -parcelHelpers.export(exports, "ticks", ()=>(0, _ticksJsDefault.default)); -parcelHelpers.export(exports, "tickIncrement", ()=>(0, _ticksJs.tickIncrement)); -parcelHelpers.export(exports, "tickStep", ()=>(0, _ticksJs.tickStep)); -parcelHelpers.export(exports, "transpose", ()=>(0, _transposeJsDefault.default)); -parcelHelpers.export(exports, "variance", ()=>(0, _varianceJsDefault.default)); -parcelHelpers.export(exports, "zip", ()=>(0, _zipJsDefault.default)); -parcelHelpers.export(exports, "every", ()=>(0, _everyJsDefault.default)); -parcelHelpers.export(exports, "some", ()=>(0, _someJsDefault.default)); -parcelHelpers.export(exports, "filter", ()=>(0, _filterJsDefault.default)); -parcelHelpers.export(exports, "map", ()=>(0, _mapJsDefault.default)); -parcelHelpers.export(exports, "reduce", ()=>(0, _reduceJsDefault.default)); -parcelHelpers.export(exports, "reverse", ()=>(0, _reverseJsDefault.default)); -parcelHelpers.export(exports, "sort", ()=>(0, _sortJsDefault.default)); -parcelHelpers.export(exports, "difference", ()=>(0, _differenceJsDefault.default)); -parcelHelpers.export(exports, "disjoint", ()=>(0, _disjointJsDefault.default)); -parcelHelpers.export(exports, "intersection", ()=>(0, _intersectionJsDefault.default)); -parcelHelpers.export(exports, "subset", ()=>(0, _subsetJsDefault.default)); -parcelHelpers.export(exports, "superset", ()=>(0, _supersetJsDefault.default)); -parcelHelpers.export(exports, "union", ()=>(0, _unionJsDefault.default)); -parcelHelpers.export(exports, "InternMap", ()=>(0, _internmap.InternMap)); -parcelHelpers.export(exports, "InternSet", ()=>(0, _internmap.InternSet)); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _blurJs = require("./blur.js"); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _crossJs = require("./cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _cumsumJs = require("./cumsum.js"); -var _cumsumJsDefault = parcelHelpers.interopDefault(_cumsumJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _deviationJs = require("./deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _fsumJs = require("./fsum.js"); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _groupSortJs = require("./groupSort.js"); -var _groupSortJsDefault = parcelHelpers.interopDefault(_groupSortJs); -var _binJs = require("./bin.js"); -var _binJsDefault = parcelHelpers.interopDefault(_binJs); -var _freedmanDiaconisJs = require("./threshold/freedmanDiaconis.js"); -var _freedmanDiaconisJsDefault = parcelHelpers.interopDefault(_freedmanDiaconisJs); -var _scottJs = require("./threshold/scott.js"); -var _scottJsDefault = parcelHelpers.interopDefault(_scottJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _meanJs = require("./mean.js"); -var _meanJsDefault = parcelHelpers.interopDefault(_meanJs); -var _medianJs = require("./median.js"); -var _medianJsDefault = parcelHelpers.interopDefault(_medianJs); -var _mergeJs = require("./merge.js"); -var _mergeJsDefault = parcelHelpers.interopDefault(_mergeJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _modeJs = require("./mode.js"); -var _modeJsDefault = parcelHelpers.interopDefault(_modeJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _pairsJs = require("./pairs.js"); -var _pairsJsDefault = parcelHelpers.interopDefault(_pairsJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _rangeJs = require("./range.js"); -var _rangeJsDefault = parcelHelpers.interopDefault(_rangeJs); -var _rankJs = require("./rank.js"); -var _rankJsDefault = parcelHelpers.interopDefault(_rankJs); -var _leastJs = require("./least.js"); -var _leastJsDefault = parcelHelpers.interopDefault(_leastJs); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -var _greatestIndexJs = require("./greatestIndex.js"); -var _greatestIndexJsDefault = parcelHelpers.interopDefault(_greatestIndexJs); -var _scanJs = require("./scan.js"); -var _scanJsDefault = parcelHelpers.interopDefault(_scanJs); -var _shuffleJs = require("./shuffle.js"); -var _shuffleJsDefault = parcelHelpers.interopDefault(_shuffleJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -var _zipJs = require("./zip.js"); -var _zipJsDefault = parcelHelpers.interopDefault(_zipJs); -var _everyJs = require("./every.js"); -var _everyJsDefault = parcelHelpers.interopDefault(_everyJs); -var _someJs = require("./some.js"); -var _someJsDefault = parcelHelpers.interopDefault(_someJs); -var _filterJs = require("./filter.js"); -var _filterJsDefault = parcelHelpers.interopDefault(_filterJs); -var _mapJs = require("./map.js"); -var _mapJsDefault = parcelHelpers.interopDefault(_mapJs); -var _reduceJs = require("./reduce.js"); -var _reduceJsDefault = parcelHelpers.interopDefault(_reduceJs); -var _reverseJs = require("./reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _differenceJs = require("./difference.js"); -var _differenceJsDefault = parcelHelpers.interopDefault(_differenceJs); -var _disjointJs = require("./disjoint.js"); -var _disjointJsDefault = parcelHelpers.interopDefault(_disjointJs); -var _intersectionJs = require("./intersection.js"); -var _intersectionJsDefault = parcelHelpers.interopDefault(_intersectionJs); -var _subsetJs = require("./subset.js"); -var _subsetJsDefault = parcelHelpers.interopDefault(_subsetJs); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -var _unionJs = require("./union.js"); -var _unionJsDefault = parcelHelpers.interopDefault(_unionJs); -var _internmap = require("internmap"); - -},{"./bisect.js":"iJojn","./ascending.js":"60o1Z","./bisector.js":"k5JwJ","./blur.js":"dJz57","./count.js":"hAOxG","./cross.js":"5Mx0K","./cumsum.js":"izk5G","./descending.js":"kIC2x","./deviation.js":"euifj","./extent.js":"2l7Ul","./fsum.js":"g7Aa0","./group.js":"gDEW5","./groupSort.js":"6XFT5","./bin.js":"k5qBC","./threshold/freedmanDiaconis.js":"7zq9L","./threshold/scott.js":"84aHL","./threshold/sturges.js":"20cg0","./max.js":"5fCPh","./maxIndex.js":"fm7WL","./mean.js":"8HbAa","./median.js":"ai1Kc","./merge.js":"d56l7","./min.js":"h0RAg","./minIndex.js":"3rpRW","./mode.js":"0gW2M","./nice.js":"lCn8Q","./pairs.js":"jCTEB","./permute.js":"3ydIg","./quantile.js":"49cDh","./quickselect.js":"doA4Q","./range.js":"7QVPN","./rank.js":"7wNFQ","./least.js":"blduW","./leastIndex.js":"9lwr3","./greatest.js":"c4GrS","./greatestIndex.js":"9hgwE","./scan.js":"6EUfu","./shuffle.js":"gPIAO","./sum.js":"hdZOC","./ticks.js":"71MAh","./transpose.js":"iwW5c","./variance.js":"gba1Y","./zip.js":"jZBBF","./every.js":"38T8N","./some.js":"8z051","./filter.js":"lgrhD","./map.js":"dbY4R","./reduce.js":"1uy4z","./reverse.js":"8g01M","./sort.js":"bV3FZ","./difference.js":"bwetK","./disjoint.js":"ilJ5C","./intersection.js":"gohoZ","./subset.js":"f9sTm","./superset.js":"9my10","./union.js":"66hcN","internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iJojn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bisectRight", ()=>bisectRight); -parcelHelpers.export(exports, "bisectLeft", ()=>bisectLeft); -parcelHelpers.export(exports, "bisectCenter", ()=>bisectCenter); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _bisectorJs = require("./bisector.js"); -var _bisectorJsDefault = parcelHelpers.interopDefault(_bisectorJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -const ascendingBisect = (0, _bisectorJsDefault.default)((0, _ascendingJsDefault.default)); -const bisectRight = ascendingBisect.right; -const bisectLeft = ascendingBisect.left; -const bisectCenter = (0, _bisectorJsDefault.default)((0, _numberJsDefault.default)).center; -exports.default = bisectRight; - -},{"./ascending.js":"60o1Z","./bisector.js":"k5JwJ","./number.js":"gcMRK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60o1Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ascending); -function ascending(a, b) { - return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k5JwJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bisector); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -function bisector(f) { - let compare1, compare2, delta; - // If an accessor is specified, promote it to a comparator. In this case we - // can test whether the search value is (self-) comparable. We can’t do this - // for a comparator (except for specific, known comparators) because we can’t - // tell if the comparator is symmetric, and an asymmetric comparator can’t be - // used to test whether a single value is comparable. - if (f.length !== 2) { - compare1 = (0, _ascendingJsDefault.default); - compare2 = (d, x)=>(0, _ascendingJsDefault.default)(f(d), x); - delta = (d, x)=>f(d) - x; - } else { - compare1 = f === (0, _ascendingJsDefault.default) || f === (0, _descendingJsDefault.default) ? f : zero; - compare2 = f; - delta = f; + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "f": formatUTCMicroseconds, + "g": formatUTCYearISO, + "G": formatUTCFullYearISO, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "q": formatUTCQuarter, + "Q": formatUnixTimestamp, + "s": formatUnixTimestampSeconds, + "S": formatUTCSeconds, + "u": formatUTCWeekdayNumberMonday, + "U": formatUTCWeekNumberSunday, + "V": formatUTCWeekNumberISO, + "w": formatUTCWeekdayNumberSunday, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "f": parseMicroseconds, + "g": parseYear, + "G": parseFullYear, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "q": parseQuarter, + "Q": parseUnixTimestamp, + "s": parseUnixTimestampSeconds, + "S": parseSeconds, + "u": parseWeekdayNumberMonday, + "U": parseWeekNumberSunday, + "V": parseWeekNumberISO, + "w": parseWeekdayNumberSunday, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + formats2.x = newFormat(locale_date, formats2); + formats2.X = newFormat(locale_time, formats2); + formats2.c = newFormat(locale_dateTime, formats2); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + function newFormat(specifier, formats3) { + return function(date2) { + var string2 = [], i = -1, j = 0, n = specifier.length, c2, pad2, format2; + if (!(date2 instanceof Date)) date2 = /* @__PURE__ */ new Date(+date2); + while (++i < n) { + if (specifier.charCodeAt(i) === 37) { + string2.push(specifier.slice(j, i)); + if ((pad2 = pads[c2 = specifier.charAt(++i)]) != null) c2 = specifier.charAt(++i); + else pad2 = c2 === "e" ? " " : "0"; + if (format2 = formats3[c2]) c2 = format2(date2, pad2); + string2.push(c2); + j = i + 1; + } + } + string2.push(specifier.slice(j, i)); + return string2.join(""); + }; } - function left(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) < 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); + function newParse(specifier, Z) { + return function(string2) { + var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string2 += "", 0), week2, day; + if (i != string2.length) return null; + if ("Q" in d) return new Date(d.Q); + if ("s" in d) return new Date(d.s * 1e3 + ("L" in d ? d.L : 0)); + if (Z && !("Z" in d)) d.Z = 0; + if ("p" in d) d.H = d.H % 12 + d.p * 12; + if (d.m === void 0) d.m = "q" in d ? d.q : 0; + if ("V" in d) { + if (d.V < 1 || d.V > 53) return null; + if (!("w" in d)) d.w = 1; + if ("Z" in d) { + week2 = utcDate(newDate(d.y, 0, 1)), day = week2.getUTCDay(); + week2 = day > 4 || day === 0 ? utcMonday.ceil(week2) : utcMonday(week2); + week2 = utcDay.offset(week2, (d.V - 1) * 7); + d.y = week2.getUTCFullYear(); + d.m = week2.getUTCMonth(); + d.d = week2.getUTCDate() + (d.w + 6) % 7; + } else { + week2 = localDate(newDate(d.y, 0, 1)), day = week2.getDay(); + week2 = day > 4 || day === 0 ? timeMonday.ceil(week2) : timeMonday(week2); + week2 = timeDay.offset(week2, (d.V - 1) * 7); + d.y = week2.getFullYear(); + d.m = week2.getMonth(); + d.d = week2.getDate() + (d.w + 6) % 7; + } + } else if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; + day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); + d.m = 0; + d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; + } + if ("Z" in d) { + d.H += d.Z / 100 | 0; + d.M += d.Z % 100; + return utcDate(d); + } + return localDate(d); + }; + } + function parseSpecifier(d, specifier, string2, j) { + var i = 0, n = specifier.length, m2 = string2.length, c2, parse2; + while (i < n) { + if (j >= m2) return -1; + c2 = specifier.charCodeAt(i++); + if (c2 === 37) { + c2 = specifier.charAt(i++); + parse2 = parses[c2 in pads ? specifier.charAt(i++) : c2]; + if (!parse2 || (j = parse2(d, string2, j)) < 0) return -1; + } else if (c2 != string2.charCodeAt(j++)) { + return -1; } - return lo; + } + return j; } - function right(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = lo + hi >>> 1; - if (compare2(a[mid], x) <= 0) lo = mid + 1; - else hi = mid; - }while (lo < hi); - } - return lo; + function parsePeriod(d, string2, i) { + var n = periodRe.exec(string2.slice(i)); + return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - function center(a, x, lo = 0, hi = a.length) { - const i = left(a, x, lo, hi - 1); - return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; + function parseShortWeekday(d, string2, i) { + var n = shortWeekdayRe.exec(string2.slice(i)); + return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - return { - left, - center, - right - }; -} -function zero() { - return 0; -} - -},{"./ascending.js":"60o1Z","./descending.js":"kIC2x","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kIC2x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>descending); -function descending(a, b) { - return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gcMRK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -parcelHelpers.export(exports, "numbers", ()=>numbers); -function number(x) { - return x === null ? NaN : +x; -} -function* numbers(values, valueof) { - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) yield value; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dJz57":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "blur", ()=>blur); -parcelHelpers.export(exports, "blur2", ()=>blur2); -parcelHelpers.export(exports, "blurImage", ()=>blurImage); -function blur(values, r) { - if (!((r = +r) >= 0)) throw new RangeError("invalid r"); - let length = values.length; - if (!((length = Math.floor(length)) >= 0)) throw new RangeError("invalid length"); - if (!length || !r) return values; - const blur = blurf(r); - const temp = values.slice(); - blur(values, temp, 0, length, 1); - blur(temp, values, 0, length, 1); - blur(values, temp, 0, length, 1); - return values; -} -const blur2 = Blur2(blurf); -const blurImage = Blur2(blurfImage); -function Blur2(blur) { - return function(data, rx, ry = rx) { - if (!((rx = +rx) >= 0)) throw new RangeError("invalid rx"); - if (!((ry = +ry) >= 0)) throw new RangeError("invalid ry"); - let { data: values, width, height } = data; - if (!((width = Math.floor(width)) >= 0)) throw new RangeError("invalid width"); - if (!((height = Math.floor(height !== undefined ? height : values.length / width)) >= 0)) throw new RangeError("invalid height"); - if (!width || !height || !rx && !ry) return data; - const blurx = rx && blur(rx); - const blury = ry && blur(ry); - const temp = values.slice(); - if (blurx && blury) { - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } else if (blurx) { - blurh(blurx, values, temp, width, height); - blurh(blurx, temp, values, width, height); - blurh(blurx, values, temp, width, height); - } else if (blury) { - blurv(blury, values, temp, width, height); - blurv(blury, temp, values, width, height); - blurv(blury, values, temp, width, height); - } - return data; - }; -} -function blurh(blur, T, S, w, h) { - for(let y = 0, n = w * h; y < n;)blur(T, S, y, y += w, 1); -} -function blurv(blur, T, S, w, h) { - for(let x = 0, n = w * h; x < w; ++x)blur(T, S, x, x + n, w); -} -function blurfImage(radius) { - const blur = blurf(radius); - return (T, S, start, stop, step)=>{ - start <<= 2, stop <<= 2, step <<= 2; - blur(T, S, start + 0, stop + 0, step); - blur(T, S, start + 1, stop + 1, step); - blur(T, S, start + 2, stop + 2, step); - blur(T, S, start + 3, stop + 3, step); - }; -} -// Given a target array T, a source array S, sets each value T[i] to the average -// of {S[i - r], …, S[i], …, S[i + r]}, where r = ⌊radius⌋, start <= i < stop, -// for each i, i + step, i + 2 * step, etc., and where S[j] is clamped between -// S[start] (inclusive) and S[stop] (exclusive). If the given radius is not an -// integer, S[i - r - 1] and S[i + r + 1] are added to the sum, each weighted -// according to r - ⌊radius⌋. -function blurf(radius) { - const radius0 = Math.floor(radius); - if (radius0 === radius) return bluri(radius); - const t = radius - radius0; - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius0 * S[start]; - const s0 = step * radius0; - const s1 = s0 + step; - for(let i = start, j = start + s0; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s0)]; - T[i] = (sum + t * (S[Math.max(start, i - s1)] + S[Math.min(stop, i + s1)])) / w; - sum -= S[Math.max(start, i - s0)]; - } - }; -} -// Like blurf, but optimized for integer radius. -function bluri(radius) { - const w = 2 * radius + 1; - return (T, S, start, stop, step)=>{ - if (!((stop -= step) >= start)) return; // inclusive stop - let sum = radius * S[start]; - const s = step * radius; - for(let i = start, j = start + s; i < j; i += step)sum += S[Math.min(stop, i)]; - for(let i = start, j = stop; i <= j; i += step){ - sum += S[Math.min(stop, i + s)]; - T[i] = sum / w; - sum -= S[Math.max(start, i - s)]; - } - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hAOxG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>count); -function count(values, valueof) { - let count = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count; - } - return count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Mx0K":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cross); -function length(array) { - return array.length | 0; -} -function empty(length) { - return !(length > 0); -} -function arrayify(values) { - return typeof values !== "object" || "length" in values ? values : Array.from(values); -} -function reducer(reduce) { - return (values)=>reduce(...values); -} -function cross(...values) { - const reduce = typeof values[values.length - 1] === "function" && reducer(values.pop()); - values = values.map(arrayify); - const lengths = values.map(length); - const j = values.length - 1; - const index = new Array(j + 1).fill(0); - const product = []; - if (j < 0 || lengths.some(empty)) return product; - while(true){ - product.push(index.map((j, i)=>values[i][j])); - let i = j; - while(++index[i] === lengths[i]){ - if (i === 0) return reduce ? product.map(reduce) : product; - index[i--] = 0; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"izk5G":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cumsum); -function cumsum(values, valueof) { - var sum = 0, index = 0; - return Float64Array.from(values, valueof === undefined ? (v)=>sum += +v || 0 : (v)=>sum += +valueof(v, index++, values) || 0); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"euifj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>deviation); -var _varianceJs = require("./variance.js"); -var _varianceJsDefault = parcelHelpers.interopDefault(_varianceJs); -function deviation(values, valueof) { - const v = (0, _varianceJsDefault.default)(values, valueof); - return v ? Math.sqrt(v) : v; -} - -},{"./variance.js":"gba1Y","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gba1Y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>variance); -function variance(values, valueof) { - let count = 0; - let delta; - let mean = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) { - delta = value - mean; - mean += delta / ++count; - sum += delta * (value - mean); - } - } - if (count > 1) return sum / (count - 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2l7Ul":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>extent); -function extent(values, valueof) { - let min; - let max; - if (valueof === undefined) { - for (const value of values)if (value != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null) { - if (min === undefined) { - if (value >= value) min = max = value; - } else { - if (min > value) min = value; - if (max < value) max = value; - } - } + function parseWeekday(d, string2, i) { + var n = weekdayRe.exec(string2.slice(i)); + return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - return [ - min, - max - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g7Aa0":[function(require,module,exports,__globalThis) { -// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423 -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Adder", ()=>Adder); -parcelHelpers.export(exports, "fsum", ()=>fsum); -parcelHelpers.export(exports, "fcumsum", ()=>fcumsum); -class Adder { - constructor(){ - this._partials = new Float64Array(32); - this._n = 0; - } - add(x) { - const p = this._partials; - let i = 0; - for(let j = 0; j < this._n && j < 32; j++){ - const y = p[j], hi = x + y, lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x); - if (lo) p[i++] = lo; - x = hi; - } - p[i] = x; - this._n = i + 1; - return this; + function parseShortMonth(d, string2, i) { + var n = shortMonthRe.exec(string2.slice(i)); + return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } - valueOf() { - const p = this._partials; - let n = this._n, x, y, lo, hi = 0; - if (n > 0) { - hi = p[--n]; - while(n > 0){ - x = hi; - y = p[--n]; - hi = x + y; - lo = y - (hi - x); - if (lo) break; - } - if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { - y = lo * 2; - x = hi + y; - if (y == x - hi) hi = x; - } - } - return hi; + function parseMonth(d, string2, i) { + var n = monthRe.exec(string2.slice(i)); + return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } -} -function fsum(values, valueof) { - const adder = new Adder(); - if (valueof === undefined) { - for (let value of values)if (value = +value) adder.add(value); - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) adder.add(value); - } - return +adder; -} -function fcumsum(values, valueof) { - const adder = new Adder(); - let index = -1; - return Float64Array.from(values, valueof === undefined ? (v)=>adder.add(+v || 0) : (v)=>adder.add(+valueof(v, ++index, values) || 0)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gDEW5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>group); -parcelHelpers.export(exports, "groups", ()=>groups); -parcelHelpers.export(exports, "flatGroup", ()=>flatGroup); -parcelHelpers.export(exports, "flatRollup", ()=>flatRollup); -parcelHelpers.export(exports, "rollup", ()=>rollup); -parcelHelpers.export(exports, "rollups", ()=>rollups); -parcelHelpers.export(exports, "index", ()=>index); -parcelHelpers.export(exports, "indexes", ()=>indexes); -var _internmap = require("internmap"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -function group(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), (0, _identityJsDefault.default), keys); -} -function groups(values, ...keys) { - return nest(values, Array.from, (0, _identityJsDefault.default), keys); -} -function flatten(groups, keys) { - for(let i = 1, n = keys.length; i < n; ++i)groups = groups.flatMap((g)=>g.pop().map(([key, value])=>[ - ...g, - key, - value - ])); - return groups; -} -function flatGroup(values, ...keys) { - return flatten(groups(values, ...keys), keys); -} -function flatRollup(values, reduce, ...keys) { - return flatten(rollups(values, reduce, ...keys), keys); -} -function rollup(values, reduce, ...keys) { - return nest(values, (0, _identityJsDefault.default), reduce, keys); -} -function rollups(values, reduce, ...keys) { - return nest(values, Array.from, reduce, keys); -} -function index(values, ...keys) { - return nest(values, (0, _identityJsDefault.default), unique, keys); -} -function indexes(values, ...keys) { - return nest(values, Array.from, unique, keys); -} -function unique(values) { - if (values.length !== 1) throw new Error("duplicate key"); - return values[0]; -} -function nest(values, map, reduce, keys) { - return function regroup(values, i) { - if (i >= keys.length) return reduce(values); - const groups = new (0, _internmap.InternMap)(); - const keyof = keys[i++]; - let index = -1; - for (const value of values){ - const key = keyof(value, ++index, values); - const group = groups.get(key); - if (group) group.push(value); - else groups.set(key, [ - value - ]); - } - for (const [key, values] of groups)groups.set(key, regroup(values, i)); - return map(groups); - }(values, 0); -} - -},{"internmap":"3ULAv","./identity.js":"eyTHz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ULAv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "InternMap", ()=>InternMap); -parcelHelpers.export(exports, "InternSet", ()=>InternSet); -class InternMap extends Map { - constructor(entries, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (entries != null) for (const [key, value] of entries)this.set(key, value); - } - get(key) { - return super.get(intern_get(this, key)); - } - has(key) { - return super.has(intern_get(this, key)); - } - set(key, value) { - return super.set(intern_set(this, key), value); - } - delete(key) { - return super.delete(intern_delete(this, key)); - } -} -class InternSet extends Set { - constructor(values, key = keyof){ - super(); - Object.defineProperties(this, { - _intern: { - value: new Map() - }, - _key: { - value: key - } - }); - if (values != null) for (const value of values)this.add(value); - } - has(value) { - return super.has(intern_get(this, value)); - } - add(value) { - return super.add(intern_set(this, value)); - } - delete(value) { - return super.delete(intern_delete(this, value)); - } -} -function intern_get({ _intern, _key }, value) { - const key = _key(value); - return _intern.has(key) ? _intern.get(key) : value; -} -function intern_set({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) return _intern.get(key); - _intern.set(key, value); - return value; -} -function intern_delete({ _intern, _key }, value) { - const key = _key(value); - if (_intern.has(key)) { - value = _intern.get(key); - _intern.delete(key); - } - return value; -} -function keyof(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eyTHz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -function identity(x) { - return x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6XFT5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>groupSort); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _groupJs = require("./group.js"); -var _groupJsDefault = parcelHelpers.interopDefault(_groupJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -function groupSort(values, reduce, key) { - return (reduce.length !== 2 ? (0, _sortJsDefault.default)((0, _groupJs.rollup)(values, reduce, key), ([ak, av], [bk, bv])=>(0, _ascendingJsDefault.default)(av, bv) || (0, _ascendingJsDefault.default)(ak, bk)) : (0, _sortJsDefault.default)((0, _groupJsDefault.default)(values, key), ([ak, av], [bk, bv])=>reduce(av, bv) || (0, _ascendingJsDefault.default)(ak, bk))).map(([key])=>key); -} - -},{"./ascending.js":"60o1Z","./group.js":"gDEW5","./sort.js":"bV3FZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bV3FZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sort); -parcelHelpers.export(exports, "compareDefined", ()=>compareDefined); -parcelHelpers.export(exports, "ascendingDefined", ()=>ascendingDefined); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _permuteJs = require("./permute.js"); -var _permuteJsDefault = parcelHelpers.interopDefault(_permuteJs); -function sort(values, ...F) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - values = Array.from(values); - let [f] = F; - if (f && f.length !== 2 || F.length > 1) { - const index = Uint32Array.from(values, (d, i)=>i); - if (F.length > 1) { - F = F.map((f)=>values.map(f)); - index.sort((i, j)=>{ - for (const f of F){ - const c = ascendingDefined(f[i], f[j]); - if (c) return c; - } - }); - } else { - f = values.map(f); - index.sort((i, j)=>ascendingDefined(f[i], f[j])); - } - return (0, _permuteJsDefault.default)(values, index); - } - return values.sort(compareDefined(f)); -} -function compareDefined(compare = (0, _ascendingJsDefault.default)) { - if (compare === (0, _ascendingJsDefault.default)) return ascendingDefined; - if (typeof compare !== "function") throw new TypeError("compare is not a function"); - return (a, b)=>{ - const x = compare(a, b); - if (x || x === 0) return x; - return (compare(b, b) === 0) - (compare(a, a) === 0); - }; -} -function ascendingDefined(a, b) { - return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0); -} - -},{"./ascending.js":"60o1Z","./permute.js":"3ydIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ydIg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>permute); -function permute(source, keys) { - return Array.from(keys, (key)=>source[key]); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k5qBC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>bin); -var _arrayJs = require("./array.js"); -var _bisectJs = require("./bisect.js"); -var _bisectJsDefault = parcelHelpers.interopDefault(_bisectJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _ticksJs = require("./ticks.js"); -var _ticksJsDefault = parcelHelpers.interopDefault(_ticksJs); -var _sturgesJs = require("./threshold/sturges.js"); -var _sturgesJsDefault = parcelHelpers.interopDefault(_sturgesJs); -function bin() { - var value = (0, _identityJsDefault.default), domain = (0, _extentJsDefault.default), threshold = (0, _sturgesJsDefault.default); - function histogram(data) { - if (!Array.isArray(data)) data = Array.from(data); - var i, n = data.length, x, step, values = new Array(n); - for(i = 0; i < n; ++i)values[i] = value(data[i], i, data); - var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1); - // Convert number of thresholds into uniform thresholds, and nice the - // default domain accordingly. - if (!Array.isArray(tz)) { - const max = x1, tn = +tz; - if (domain === (0, _extentJsDefault.default)) [x0, x1] = (0, _niceJsDefault.default)(x0, x1, tn); - tz = (0, _ticksJsDefault.default)(x0, x1, tn); - // If the domain is aligned with the first tick (which it will by - // default), then we can use quantization rather than bisection to bin - // values, which is substantially faster. - if (tz[0] <= x0) step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - // If the last threshold is coincident with the domain’s upper bound, the - // last bin will be zero-width. If the default domain is used, and this - // last threshold is coincident with the maximum input value, we can - // extend the niced upper bound by one tick to ensure uniform bin widths; - // otherwise, we simply remove the last threshold. Note that we don’t - // coerce values or the domain to numbers, and thus must be careful to - // compare order (>=) rather than strict equality (===)! - if (tz[tz.length - 1] >= x1) { - if (max >= x1 && domain === (0, _extentJsDefault.default)) { - const step = (0, _ticksJs.tickIncrement)(x0, x1, tn); - if (isFinite(step)) { - if (step > 0) x1 = (Math.floor(x1 / step) + 1) * step; - else if (step < 0) x1 = (Math.ceil(x1 * -step) + 1) / -step; - } - } else tz.pop(); - } - } - // Remove any thresholds outside the domain. - // Be careful not to mutate an array owned by the user! - var m = tz.length, a = 0, b = m; - while(tz[a] <= x0)++a; - while(tz[b - 1] > x1)--b; - if (a || b < m) tz = tz.slice(a, b), m = b - a; - var bins = new Array(m + 1), bin; - // Initialize bins. - for(i = 0; i <= m; ++i){ - bin = bins[i] = []; - bin.x0 = i > 0 ? tz[i - 1] : x0; - bin.x1 = i < m ? tz[i] : x1; - } - // Assign data to bins by value, ignoring any outside the domain. - if (isFinite(step)) { - if (step > 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]); - } else if (step < 0) { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) { - const j = Math.floor((x0 - x) * step); - bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); // handle off-by-one due to rounding - } - } - } else { - for(i = 0; i < n; ++i)if ((x = values[i]) != null && x0 <= x && x <= x1) bins[(0, _bisectJsDefault.default)(tz, x, 0, m)].push(data[i]); - } - return bins; - } - histogram.value = function(_) { - return arguments.length ? (value = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), histogram) : value; - }; - histogram.domain = function(_) { - return arguments.length ? (domain = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - _[0], - _[1] - ]), histogram) : domain; - }; - histogram.thresholds = function(_) { - return arguments.length ? (threshold = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(Array.isArray(_) ? (0, _arrayJs.slice).call(_) : _), histogram) : threshold; - }; - return histogram; -} - -},{"./array.js":"kI9nk","./bisect.js":"iJojn","./constant.js":"aOeVu","./extent.js":"2l7Ul","./identity.js":"eyTHz","./nice.js":"lCn8Q","./ticks.js":"71MAh","./threshold/sturges.js":"20cg0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kI9nk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "map", ()=>map); -var array = Array.prototype; -var slice = array.slice; -var map = array.map; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aOeVu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constant); -function constant(x) { - return ()=>x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lCn8Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -var _ticksJs = require("./ticks.js"); -function nice(start, stop, count) { - let prestep; - while(true){ - const step = (0, _ticksJs.tickIncrement)(start, stop, count); - if (step === prestep || step === 0 || !isFinite(step)) return [ - start, - stop - ]; - else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } - prestep = step; - } -} - -},{"./ticks.js":"71MAh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"71MAh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>ticks); -parcelHelpers.export(exports, "tickIncrement", ()=>tickIncrement); -parcelHelpers.export(exports, "tickStep", ()=>tickStep); -const e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); -function tickSpec(start, stop, count) { - const step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log10(step)), error = step / Math.pow(10, power), factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; - let i1, i2, inc; - if (power < 0) { - inc = Math.pow(10, -power) / factor; - i1 = Math.round(start * inc); - i2 = Math.round(stop * inc); - if (i1 / inc < start) ++i1; - if (i2 / inc > stop) --i2; - inc = -inc; - } else { - inc = Math.pow(10, power) * factor; - i1 = Math.round(start / inc); - i2 = Math.round(stop / inc); - if (i1 * inc < start) ++i1; - if (i2 * inc > stop) --i2; - } - if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2); - return [ - i1, - i2, - inc - ]; -} -function ticks(start, stop, count) { - stop = +stop, start = +start, count = +count; - if (!(count > 0)) return []; - if (start === stop) return [ - start - ]; - const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count); - if (!(i2 >= i1)) return []; - const n = i2 - i1 + 1, ticks = new Array(n); - if (reverse) { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i2 - i) * inc; - } else { - if (inc < 0) for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) / -inc; - else for(let i = 0; i < n; ++i)ticks[i] = (i1 + i) * inc; - } - return ticks; -} -function tickIncrement(start, stop, count) { - stop = +stop, start = +start, count = +count; - return tickSpec(start, stop, count)[2]; -} -function tickStep(start, stop, count) { - stop = +stop, start = +start, count = +count; - const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count); - return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"20cg0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdSturges); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -function thresholdSturges(values) { - return Math.max(1, Math.ceil(Math.log((0, _countJsDefault.default)(values)) / Math.LN2) + 1); -} - -},{"../count.js":"hAOxG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7zq9L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdFreedmanDiaconis); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _quantileJs = require("../quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function thresholdFreedmanDiaconis(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _quantileJsDefault.default)(values, 0.75) - (0, _quantileJsDefault.default)(values, 0.25); - return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1; -} - -},{"../count.js":"hAOxG","../quantile.js":"49cDh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49cDh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -parcelHelpers.export(exports, "quantileSorted", ()=>quantileSorted); -parcelHelpers.export(exports, "quantileIndex", ()=>quantileIndex); -var _maxJs = require("./max.js"); -var _maxJsDefault = parcelHelpers.interopDefault(_maxJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -var _quickselectJs = require("./quickselect.js"); -var _quickselectJsDefault = parcelHelpers.interopDefault(_quickselectJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _sortJs = require("./sort.js"); -var _greatestJs = require("./greatest.js"); -var _greatestJsDefault = parcelHelpers.interopDefault(_greatestJs); -function quantile(values, p, valueof) { - values = Float64Array.from((0, _numberJs.numbers)(values, valueof)); - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return (0, _minJsDefault.default)(values); - if (p >= 1) return (0, _maxJsDefault.default)(values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = (0, _maxJsDefault.default)((0, _quickselectJsDefault.default)(values, i0).subarray(0, i0 + 1)), value1 = (0, _minJsDefault.default)(values.subarray(i0 + 1)); - return value0 + (value1 - value0) * (i - i0); -} -function quantileSorted(values, p, valueof = (0, _numberJsDefault.default)) { - if (!(n = values.length) || isNaN(p = +p)) return; - if (p <= 0 || n < 2) return +valueof(values[0], 0, values); - if (p >= 1) return +valueof(values[n - 1], n - 1, values); - var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); - return value0 + (value1 - value0) * (i - i0); -} -function quantileIndex(values, p, valueof = (0, _numberJsDefault.default)) { - if (isNaN(p = +p)) return; - numbers = Float64Array.from(values, (_, i)=>(0, _numberJsDefault.default)(valueof(values[i], i, values))); - if (p <= 0) return (0, _minIndexJsDefault.default)(numbers); - if (p >= 1) return (0, _maxIndexJsDefault.default)(numbers); - var numbers, index = Uint32Array.from(values, (_, i)=>i), j = numbers.length - 1, i = Math.floor(j * p); - (0, _quickselectJsDefault.default)(index, i, 0, j, (i, j)=>(0, _sortJs.ascendingDefined)(numbers[i], numbers[j])); - i = (0, _greatestJsDefault.default)(index.subarray(0, i + 1), (i)=>numbers[i]); - return i >= 0 ? i : -1; -} - -},{"./max.js":"5fCPh","./maxIndex.js":"fm7WL","./min.js":"h0RAg","./minIndex.js":"3rpRW","./quickselect.js":"doA4Q","./number.js":"gcMRK","./sort.js":"bV3FZ","./greatest.js":"c4GrS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5fCPh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>max); -function max(values, valueof) { - let max; - if (valueof === undefined) { - for (const value of values)if (value != null && (max < value || max === undefined && value >= value)) max = value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value; - } - return max; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fm7WL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>maxIndex); -function maxIndex(values, valueof) { - let max; - let maxIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; - } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (max < value || max === undefined && value >= value)) max = value, maxIndex = index; - } - return maxIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h0RAg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>min); -function min(values, valueof) { - let min; - if (valueof === undefined) { - for (const value of values)if (value != null && (min > value || min === undefined && value >= value)) min = value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value; - } - return min; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rpRW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>minIndex); -function minIndex(values, valueof) { - let min; - let minIndex = -1; - let index = -1; - if (valueof === undefined) for (const value of values){ - ++index; - if (value != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; - } - else { - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (min > value || min === undefined && value >= value)) min = value, minIndex = index; - } - return minIndex; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"doA4Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quickselect); -var _sortJs = require("./sort.js"); -function quickselect(array, k, left = 0, right = Infinity, compare) { - k = Math.floor(k); - left = Math.floor(Math.max(0, left)); - right = Math.floor(Math.min(array.length - 1, right)); - if (!(left <= k && k <= right)) return array; - compare = compare === undefined ? (0, _sortJs.ascendingDefined) : (0, _sortJs.compareDefined)(compare); - while(right > left){ - if (right - left > 600) { - const n = right - left + 1; - const m = k - left + 1; - const z = Math.log(n); - const s = 0.5 * Math.exp(2 * z / 3); - const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); - const newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); - const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); - quickselect(array, k, newLeft, newRight, compare); - } - const t = array[k]; - let i = left; - let j = right; - swap(array, left, k); - if (compare(array[right], t) > 0) swap(array, left, right); - while(i < j){ - swap(array, i, j), ++i, --j; - while(compare(array[i], t) < 0)++i; - while(compare(array[j], t) > 0)--j; - } - if (compare(array[left], t) === 0) swap(array, left, j); - else ++j, swap(array, j, right); - if (j <= k) left = j + 1; - if (k <= j) right = j - 1; - } - return array; -} -function swap(array, i, j) { - const t = array[i]; - array[i] = array[j]; - array[j] = t; -} - -},{"./sort.js":"bV3FZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c4GrS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatest); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function greatest(values, compare = (0, _ascendingJsDefault.default)) { - let max; - let defined = false; - if (compare.length === 1) { - let maxValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, maxValue) > 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - max = element; - maxValue = value; - defined = true; - } - } - } else { - for (const value of values)if (defined ? compare(value, max) > 0 : compare(value, value) === 0) { - max = value; - defined = true; - } - } - return max; -} - -},{"./ascending.js":"60o1Z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"84aHL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>thresholdScott); -var _countJs = require("../count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _deviationJs = require("../deviation.js"); -var _deviationJsDefault = parcelHelpers.interopDefault(_deviationJs); -function thresholdScott(values, min, max) { - const c = (0, _countJsDefault.default)(values), d = (0, _deviationJsDefault.default)(values); - return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1; -} - -},{"../count.js":"hAOxG","../deviation.js":"euifj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8HbAa":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mean); -function mean(values, valueof) { - let count = 0; - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value != null && (value = +value) >= value) ++count, sum += value; - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) ++count, sum += value; - } - if (count) return sum / count; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ai1Kc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>median); -parcelHelpers.export(exports, "medianIndex", ()=>medianIndex); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -function median(values, valueof) { - return (0, _quantileJsDefault.default)(values, 0.5, valueof); -} -function medianIndex(values, valueof) { - return (0, _quantileJs.quantileIndex)(values, 0.5, valueof); -} - -},{"./quantile.js":"49cDh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d56l7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>merge); -function* flatten(arrays) { - for (const array of arrays)yield* array; -} -function merge(arrays) { - return Array.from(flatten(arrays)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0gW2M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>mode); -var _internmap = require("internmap"); -function mode(values, valueof) { - const counts = new (0, _internmap.InternMap)(); - if (valueof === undefined) { - for (let value of values)if (value != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } else { - let index = -1; - for (let value of values)if ((value = valueof(value, ++index, values)) != null && value >= value) counts.set(value, (counts.get(value) || 0) + 1); - } - let modeValue; - let modeCount = 0; - for (const [value, count] of counts)if (count > modeCount) { - modeCount = count; - modeValue = value; - } - return modeValue; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jCTEB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>pairs); -parcelHelpers.export(exports, "pair", ()=>pair); -function pairs(values, pairof = pair) { - const pairs1 = []; - let previous; - let first = false; - for (const value of values){ - if (first) pairs1.push(pairof(previous, value)); - previous = value; - first = true; - } - return pairs1; -} -function pair(a, b) { - return [ - a, - b - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7QVPN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>range); -function range(start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range = new Array(n); - while(++i < n)range[i] = start + i * step; - return range; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wNFQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>rank); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _sortJs = require("./sort.js"); -function rank(values, valueof = (0, _ascendingJsDefault.default)) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - let V = Array.from(values); - const R = new Float64Array(V.length); - if (valueof.length !== 2) V = V.map(valueof), valueof = (0, _ascendingJsDefault.default); - const compareIndex = (i, j)=>valueof(V[i], V[j]); - let k, r; - values = Uint32Array.from(V, (_, i)=>i); - // Risky chaining due to Safari 14 https://github.com/d3/d3-array/issues/123 - values.sort(valueof === (0, _ascendingJsDefault.default) ? (i, j)=>(0, _sortJs.ascendingDefined)(V[i], V[j]) : (0, _sortJs.compareDefined)(compareIndex)); - values.forEach((j, i)=>{ - const c = compareIndex(j, k === undefined ? j : k); - if (c >= 0) { - if (k === undefined || c > 0) k = j, r = i; - R[j] = r; - } else R[j] = NaN; - }); - return R; -} - -},{"./ascending.js":"60o1Z","./sort.js":"bV3FZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"blduW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>least); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -function least(values, compare = (0, _ascendingJsDefault.default)) { - let min; - let defined = false; - if (compare.length === 1) { - let minValue; - for (const element of values){ - const value = compare(element); - if (defined ? (0, _ascendingJsDefault.default)(value, minValue) < 0 : (0, _ascendingJsDefault.default)(value, value) === 0) { - min = element; - minValue = value; - defined = true; - } - } - } else { - for (const value of values)if (defined ? compare(value, min) < 0 : compare(value, value) === 0) { - min = value; - defined = true; - } - } - return min; -} - -},{"./ascending.js":"60o1Z","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9lwr3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>leastIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _minIndexJs = require("./minIndex.js"); -var _minIndexJsDefault = parcelHelpers.interopDefault(_minIndexJs); -function leastIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _minIndexJsDefault.default)(values, compare); - let minValue; - let min = -1; - let index = -1; - for (const value of values){ - ++index; - if (min < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { - minValue = value; - min = index; - } - } - return min; -} - -},{"./ascending.js":"60o1Z","./minIndex.js":"3rpRW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9hgwE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>greatestIndex); -var _ascendingJs = require("./ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _maxIndexJs = require("./maxIndex.js"); -var _maxIndexJsDefault = parcelHelpers.interopDefault(_maxIndexJs); -function greatestIndex(values, compare = (0, _ascendingJsDefault.default)) { - if (compare.length === 1) return (0, _maxIndexJsDefault.default)(values, compare); - let maxValue; - let max = -1; - let index = -1; - for (const value of values){ - ++index; - if (max < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { - maxValue = value; - max = index; - } - } - return max; -} - -},{"./ascending.js":"60o1Z","./maxIndex.js":"fm7WL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6EUfu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>scan); -var _leastIndexJs = require("./leastIndex.js"); -var _leastIndexJsDefault = parcelHelpers.interopDefault(_leastIndexJs); -function scan(values, compare) { - const index = (0, _leastIndexJsDefault.default)(values, compare); - return index < 0 ? undefined : index; -} - -},{"./leastIndex.js":"9lwr3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gPIAO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shuffler", ()=>shuffler); -exports.default = shuffler(Math.random); -function shuffler(random) { - return function shuffle(array, i0 = 0, i1 = array.length) { - let m = i1 - (i0 = +i0); - while(m){ - const i = random() * m-- | 0, t = array[m + i0]; - array[m + i0] = array[i + i0]; - array[i + i0] = t; - } - return array; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hdZOC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sum); -function sum(values, valueof) { - let sum = 0; - if (valueof === undefined) { - for (let value of values)if (value = +value) sum += value; - } else { - let index = -1; - for (let value of values)if (value = +valueof(value, ++index, values)) sum += value; - } - return sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iwW5c":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>transpose); -var _minJs = require("./min.js"); -var _minJsDefault = parcelHelpers.interopDefault(_minJs); -function transpose(matrix) { - if (!(n = matrix.length)) return []; - for(var i = -1, m = (0, _minJsDefault.default)(matrix, length), transpose = new Array(m); ++i < m;)for(var j = -1, n, row = transpose[i] = new Array(n); ++j < n;)row[j] = matrix[j][i]; - return transpose; -} -function length(d) { - return d.length; -} - -},{"./min.js":"h0RAg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jZBBF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>zip); -var _transposeJs = require("./transpose.js"); -var _transposeJsDefault = parcelHelpers.interopDefault(_transposeJs); -function zip() { - return (0, _transposeJsDefault.default)(arguments); -} - -},{"./transpose.js":"iwW5c","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"38T8N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>every); -function every(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (!test(value, ++index, values)) return false; - } - return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8z051":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>some); -function some(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - let index = -1; - for (const value of values){ - if (test(value, ++index, values)) return true; - } - return false; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lgrhD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>filter); -function filter(values, test) { - if (typeof test !== "function") throw new TypeError("test is not a function"); - const array = []; - let index = -1; - for (const value of values)if (test(value, ++index, values)) array.push(value); - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dbY4R":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>map); -function map(values, mapper) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - if (typeof mapper !== "function") throw new TypeError("mapper is not a function"); - return Array.from(values, (value, index)=>mapper(value, index, values)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1uy4z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reduce); -function reduce(values, reducer, value) { - if (typeof reducer !== "function") throw new TypeError("reducer is not a function"); - const iterator = values[Symbol.iterator](); - let done, next, index = -1; - if (arguments.length < 3) { - ({ done, value } = iterator.next()); - if (done) return; - ++index; - } - while({ done, value: next } = iterator.next(), !done)value = reducer(value, next, ++index, values); - return value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8g01M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>reverse); -function reverse(values) { - if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); - return Array.from(values).reverse(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bwetK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>difference); -var _internmap = require("internmap"); -function difference(values, ...others) { - values = new (0, _internmap.InternSet)(values); - for (const other of others)for (const value of other)values.delete(value); - return values; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ilJ5C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>disjoint); -var _internmap = require("internmap"); -function disjoint(values, other) { - const iterator = other[Symbol.iterator](), set = new (0, _internmap.InternSet)(); - for (const v of values){ - if (set.has(v)) return false; - let value, done; - while({ value, done } = iterator.next()){ - if (done) break; - if (Object.is(v, value)) return false; - set.add(value); - } - } - return true; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gohoZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>intersection); -var _internmap = require("internmap"); -function intersection(values, ...others) { - values = new (0, _internmap.InternSet)(values); - others = others.map(set); - out: for (const value of values){ - for (const other of others)if (!other.has(value)) { - values.delete(value); - continue out; - } - } - return values; -} -function set(values) { - return values instanceof (0, _internmap.InternSet) ? values : new (0, _internmap.InternSet)(values); -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f9sTm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>subset); -var _supersetJs = require("./superset.js"); -var _supersetJsDefault = parcelHelpers.interopDefault(_supersetJs); -function subset(values, other) { - return (0, _supersetJsDefault.default)(other, values); -} - -},{"./superset.js":"9my10","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9my10":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>superset); -function superset(values, other) { - const iterator = values[Symbol.iterator](), set = new Set(); - for (const o of other){ - const io = intern(o); - if (set.has(io)) continue; - let value, done; - while({ value, done } = iterator.next()){ - if (done) return false; - const ivalue = intern(value); - set.add(ivalue); - if (Object.is(io, ivalue)) break; - } - } - return true; -} -function intern(value) { - return value !== null && typeof value === "object" ? value.valueOf() : value; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"66hcN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>union); -var _internmap = require("internmap"); -function union(...others) { - const set = new (0, _internmap.InternSet)(); - for (const other of others)for (const o of other)set.add(o); - return set; -} - -},{"internmap":"3ULAv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8dYFL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "formatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "format", ()=>(0, _defaultLocaleJs.format)); -parcelHelpers.export(exports, "formatPrefix", ()=>(0, _defaultLocaleJs.formatPrefix)); -parcelHelpers.export(exports, "formatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "formatSpecifier", ()=>(0, _formatSpecifierJsDefault.default)); -parcelHelpers.export(exports, "FormatSpecifier", ()=>(0, _formatSpecifierJs.FormatSpecifier)); -parcelHelpers.export(exports, "precisionFixed", ()=>(0, _precisionFixedJsDefault.default)); -parcelHelpers.export(exports, "precisionPrefix", ()=>(0, _precisionPrefixJsDefault.default)); -parcelHelpers.export(exports, "precisionRound", ()=>(0, _precisionRoundJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _precisionFixedJs = require("./precisionFixed.js"); -var _precisionFixedJsDefault = parcelHelpers.interopDefault(_precisionFixedJs); -var _precisionPrefixJs = require("./precisionPrefix.js"); -var _precisionPrefixJsDefault = parcelHelpers.interopDefault(_precisionPrefixJs); -var _precisionRoundJs = require("./precisionRound.js"); -var _precisionRoundJsDefault = parcelHelpers.interopDefault(_precisionRoundJs); - -},{"./defaultLocale.js":"1ffdx","./locale.js":"dwvYJ","./formatSpecifier.js":"bIdqX","./precisionFixed.js":"8IQWL","./precisionPrefix.js":"iTn3h","./precisionRound.js":"kzQd5","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1ffdx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "formatPrefix", ()=>formatPrefix); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var format; -var formatPrefix; -defaultLocale({ - thousands: ",", - grouping: [ - 3 - ], - currency: [ - "$", - "" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - format = locale.format; - formatPrefix = locale.formatPrefix; - return locale; -} - -},{"./locale.js":"dwvYJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dwvYJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? (0, _identityJsDefault.default) : (0, _formatGroupJsDefault.default)(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", decimal = locale.decimal === undefined ? "." : locale.decimal + "", numerals = locale.numerals === undefined ? (0, _identityJsDefault.default) : (0, _formatNumeralsJsDefault.default)(map.call(locale.numerals, String)), percent = locale.percent === undefined ? "%" : locale.percent + "", minus = locale.minus === undefined ? "\u2212" : locale.minus + "", nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - function newFormat(specifier) { - specifier = (0, _formatSpecifierJsDefault.default)(specifier); - var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type; - // The "n" type is an alias for ",g". - if (type === "n") comma = true, type = "g"; - else if (!(0, _formatTypesJsDefault.default)[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - // If zero fill is specified, padding goes after sign and before digits. - if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "="; - // Compute the prefix and suffix. - // For SI-prefix, the suffix is lazily computed. - var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - // What format function should we use? - // Is this an integer type? - // Can this type generate exponential notation? - var formatType = (0, _formatTypesJsDefault.default)[type], maybeSuffix = /[defgprs%]/.test(type); - // Set the default precision if not specified, - // or clamp the specified precision to the supported range. - // For significant precision, it must be in [1, 21]. - // For fixed precision, it must be in [0, 20]. - precision = precision === undefined ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); - function format(value) { - var valuePrefix = prefix, valueSuffix = suffix, i, n, c; - if (type === "c") { - valueSuffix = formatType(value) + valueSuffix; - value = ""; - } else { - value = +value; - // Determine the sign. -0 is not less than 0, but 1 / -0 is! - var valueNegative = value < 0 || 1 / value < 0; - // Perform the initial formatting. - value = isNaN(value) ? nan : formatType(Math.abs(value), precision); - // Trim insignificant zeros. - if (trim) value = (0, _formatTrimJsDefault.default)(value); - // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. - if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; - // Compute the prefix and suffix. - valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; - valueSuffix = (type === "s" ? prefixes[8 + (0, _formatPrefixAutoJs.prefixExponent) / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); - // Break the formatted value into the integer “value” part that can be - // grouped, and fractional or exponential “suffix” part that is not. - if (maybeSuffix) { - i = -1, n = value.length; - while(++i < n)if (c = value.charCodeAt(i), 48 > c || c > 57) { - valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; - value = value.slice(0, i); - break; - } - } - } - // If the fill character is not "0", grouping is applied before padding. - if (comma && !zero) value = group(value, Infinity); - // Compute the padding. - var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : ""; - // If the fill character is "0", grouping is applied after padding. - if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; - // Reconstruct the final output based on the desired alignment. - switch(align){ - case "<": - value = valuePrefix + value + valueSuffix + padding; - break; - case "=": - value = valuePrefix + padding + value + valueSuffix; - break; - case "^": - value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); - break; - default: - value = padding + valuePrefix + value + valueSuffix; - break; - } - return numerals(value); - } - format.toString = function() { - return specifier + ""; - }; - return format; - } - function formatPrefix(specifier, value) { - var f = newFormat((specifier = (0, _formatSpecifierJsDefault.default)(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3, k = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; - return function(value) { - return f(k * value) + prefix; - }; - } - return { - format: newFormat, - formatPrefix: formatPrefix - }; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); -var _formatGroupJs = require("./formatGroup.js"); -var _formatGroupJsDefault = parcelHelpers.interopDefault(_formatGroupJs); -var _formatNumeralsJs = require("./formatNumerals.js"); -var _formatNumeralsJsDefault = parcelHelpers.interopDefault(_formatNumeralsJs); -var _formatSpecifierJs = require("./formatSpecifier.js"); -var _formatSpecifierJsDefault = parcelHelpers.interopDefault(_formatSpecifierJs); -var _formatTrimJs = require("./formatTrim.js"); -var _formatTrimJsDefault = parcelHelpers.interopDefault(_formatTrimJs); -var _formatTypesJs = require("./formatTypes.js"); -var _formatTypesJsDefault = parcelHelpers.interopDefault(_formatTypesJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var map = Array.prototype.map, prefixes = [ - "y", - "z", - "a", - "f", - "p", - "n", - "\xb5", - "m", - "", - "k", - "M", - "G", - "T", - "P", - "E", - "Z", - "Y" -]; - -},{"./exponent.js":"iqnEO","./formatGroup.js":"d3NPN","./formatNumerals.js":"32lVM","./formatSpecifier.js":"bIdqX","./formatTrim.js":"1v59S","./formatTypes.js":"eJoM5","./formatPrefixAuto.js":"5DQGQ","./identity.js":"5utPE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iqnEO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x = (0, _formatDecimalJs.formatDecimalParts)(Math.abs(x)), x ? x[1] : NaN; - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"8WhgD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8WhgD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10); - }); -// Computes the decimal coefficient and exponent of the specified number x with -// significant digits p, where x is positive and p is in [1, 21] or undefined. -// For example, formatDecimalParts(1.23) returns ["123", 0]. -parcelHelpers.export(exports, "formatDecimalParts", ()=>formatDecimalParts); -function formatDecimalParts(x, p) { - if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity - var i, coefficient = x.slice(0, i); - // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ - // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). - return [ - coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, - +x.slice(i + 1) - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d3NPN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(grouping, thousands) { - return function(value, width) { - var i = value.length, t = [], j = 0, g = grouping[0], length = 0; - while(i > 0 && g > 0){ - if (length + g + 1 > width) g = Math.max(1, width - length); - t.push(value.substring(i -= g, i + g)); - if ((length += g + 1) > width) break; - g = grouping[j = (j + 1) % grouping.length]; - } - return t.reverse().join(thousands); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"32lVM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(numerals) { - return function(value) { - return value.replace(/[0-9]/g, function(i) { - return numerals[+i]; - }); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bIdqX":[function(require,module,exports,__globalThis) { -// [[fill]align][sign][symbol][0][width][,][.precision][~][type] -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatSpecifier); -parcelHelpers.export(exports, "FormatSpecifier", ()=>FormatSpecifier); -var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; -function formatSpecifier(specifier) { - if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); - var match; - return new FormatSpecifier({ - fill: match[1], - align: match[2], - sign: match[3], - symbol: match[4], - zero: match[5], - width: match[6], - comma: match[7], - precision: match[8] && match[8].slice(1), - trim: match[9], - type: match[10] - }); -} -formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof -function FormatSpecifier(specifier) { - this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; - this.align = specifier.align === undefined ? ">" : specifier.align + ""; - this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; - this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; - this.zero = !!specifier.zero; - this.width = specifier.width === undefined ? undefined : +specifier.width; - this.comma = !!specifier.comma; - this.precision = specifier.precision === undefined ? undefined : +specifier.precision; - this.trim = !!specifier.trim; - this.type = specifier.type === undefined ? "" : specifier.type + ""; -} -FormatSpecifier.prototype.toString = function() { - return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1v59S":[function(require,module,exports,__globalThis) { -// Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(s) { - out: for(var n = s.length, i = 1, i0 = -1, i1; i < n; ++i)switch(s[i]){ - case ".": - i0 = i1 = i; - break; - case "0": - if (i0 === 0) i0 = i; - i1 = i; - break; - default: - if (!+s[i]) break out; - if (i0 > 0) i0 = 0; - break; - } - return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eJoM5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _formatDecimalJs = require("./formatDecimal.js"); -var _formatDecimalJsDefault = parcelHelpers.interopDefault(_formatDecimalJs); -var _formatPrefixAutoJs = require("./formatPrefixAuto.js"); -var _formatPrefixAutoJsDefault = parcelHelpers.interopDefault(_formatPrefixAutoJs); -var _formatRoundedJs = require("./formatRounded.js"); -var _formatRoundedJsDefault = parcelHelpers.interopDefault(_formatRoundedJs); -exports.default = { - "%": (x, p)=>(x * 100).toFixed(p), - "b": (x)=>Math.round(x).toString(2), - "c": (x)=>x + "", - "d": (0, _formatDecimalJsDefault.default), - "e": (x, p)=>x.toExponential(p), - "f": (x, p)=>x.toFixed(p), - "g": (x, p)=>x.toPrecision(p), - "o": (x)=>Math.round(x).toString(8), - "p": (x, p)=>(0, _formatRoundedJsDefault.default)(x * 100, p), - "r": (0, _formatRoundedJsDefault.default), - "s": (0, _formatPrefixAutoJsDefault.default), - "X": (x)=>Math.round(x).toString(16).toUpperCase(), - "x": (x)=>Math.round(x).toString(16) -}; - -},{"./formatDecimal.js":"8WhgD","./formatPrefixAuto.js":"5DQGQ","./formatRounded.js":"dJog3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5DQGQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "prefixExponent", ()=>prefixExponent); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length; - return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + (0, _formatDecimalJs.formatDecimalParts)(x, Math.max(0, p + i - 1))[0]; // less than 1y! - }); -var _formatDecimalJs = require("./formatDecimal.js"); -var prefixExponent; - -},{"./formatDecimal.js":"8WhgD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dJog3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, p) { - var d = (0, _formatDecimalJs.formatDecimalParts)(x, p); - if (!d) return x + ""; - var coefficient = d[0], exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); - }); -var _formatDecimalJs = require("./formatDecimal.js"); - -},{"./formatDecimal.js":"8WhgD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5utPE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return x; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8IQWL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step) { - return Math.max(0, -(0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"iqnEO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iTn3h":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, value) { - return Math.max(0, Math.max(-8, Math.min(8, Math.floor((0, _exponentJsDefault.default)(value) / 3))) * 3 - (0, _exponentJsDefault.default)(Math.abs(step))); - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"iqnEO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kzQd5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(step, max) { - step = Math.abs(step), max = Math.abs(max) - step; - return Math.max(0, (0, _exponentJsDefault.default)(max) - (0, _exponentJsDefault.default)(step)) + 1; - }); -var _exponentJs = require("./exponent.js"); -var _exponentJsDefault = parcelHelpers.interopDefault(_exponentJs); - -},{"./exponent.js":"iqnEO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"27kpp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DATE", ()=>DATE); -parcelHelpers.export(exports, "DAY", ()=>DAY); -parcelHelpers.export(exports, "DAYOFYEAR", ()=>DAYOFYEAR); -parcelHelpers.export(exports, "HOURS", ()=>HOURS); -parcelHelpers.export(exports, "MILLISECONDS", ()=>MILLISECONDS); -parcelHelpers.export(exports, "MINUTES", ()=>MINUTES); -parcelHelpers.export(exports, "MONTH", ()=>MONTH); -parcelHelpers.export(exports, "QUARTER", ()=>QUARTER); -parcelHelpers.export(exports, "SECONDS", ()=>SECONDS); -parcelHelpers.export(exports, "TIME_UNITS", ()=>TIME_UNITS); -parcelHelpers.export(exports, "WEEK", ()=>WEEK); -parcelHelpers.export(exports, "YEAR", ()=>YEAR); -parcelHelpers.export(exports, "dayofyear", ()=>dayofyear); -parcelHelpers.export(exports, "timeBin", ()=>bin); -parcelHelpers.export(exports, "timeFloor", ()=>timeFloor); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -parcelHelpers.export(exports, "timeOffset", ()=>timeOffset); -parcelHelpers.export(exports, "timeSequence", ()=>timeSequence); -parcelHelpers.export(exports, "timeUnitSpecifier", ()=>timeUnitSpecifier); -parcelHelpers.export(exports, "timeUnits", ()=>timeUnits); -parcelHelpers.export(exports, "utcFloor", ()=>utcFloor); -parcelHelpers.export(exports, "utcInterval", ()=>utcInterval); -parcelHelpers.export(exports, "utcOffset", ()=>utcOffset); -parcelHelpers.export(exports, "utcSequence", ()=>utcSequence); -parcelHelpers.export(exports, "utcdayofyear", ()=>utcdayofyear); -parcelHelpers.export(exports, "utcweek", ()=>utcweek); -parcelHelpers.export(exports, "week", ()=>week); -var _vegaUtil = require("vega-util"); -var _d3Time = require("d3-time"); -var _d3Array = require("d3-array"); -const YEAR = 'year'; -const QUARTER = 'quarter'; -const MONTH = 'month'; -const WEEK = 'week'; -const DATE = 'date'; -const DAY = 'day'; -const DAYOFYEAR = 'dayofyear'; -const HOURS = 'hours'; -const MINUTES = 'minutes'; -const SECONDS = 'seconds'; -const MILLISECONDS = 'milliseconds'; -const TIME_UNITS = [ - YEAR, - QUARTER, - MONTH, - WEEK, - DATE, - DAY, - DAYOFYEAR, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -]; -const UNITS = TIME_UNITS.reduce((o, u, i)=>(o[u] = 1 + i, o), {}); -function timeUnits(units) { - const u = (0, _vegaUtil.array)(units).slice(), m = {}; - // check validity - if (!u.length) (0, _vegaUtil.error)('Missing time unit.'); - u.forEach((unit)=>{ - if ((0, _vegaUtil.hasOwnProperty)(UNITS, unit)) m[unit] = 1; - else (0, _vegaUtil.error)(`Invalid time unit: ${unit}.`); - }); - const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0); - if (numTypes > 1) (0, _vegaUtil.error)(`Incompatible time units: ${units}`); - // ensure proper sort order - u.sort((a, b)=>UNITS[a] - UNITS[b]); - return u; -} -const defaultSpecifiers = { - [YEAR]: '%Y ', - [QUARTER]: 'Q%q ', - [MONTH]: '%b ', - [DATE]: '%d ', - [WEEK]: 'W%U ', - [DAY]: '%a ', - [DAYOFYEAR]: '%j ', - [HOURS]: '%H:00', - [MINUTES]: '00:%M', - [SECONDS]: ':%S', - [MILLISECONDS]: '.%L', - [`${YEAR}-${MONTH}`]: '%Y-%m ', - [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ', - [`${HOURS}-${MINUTES}`]: '%H:%M' -}; -function timeUnitSpecifier(units, specifiers) { - const s = (0, _vegaUtil.extend)({}, defaultSpecifiers, specifiers), u = timeUnits(units), n = u.length; - let fmt = '', start = 0, end, key; - for(start = 0; start < n;)for(end = u.length; end > start; --end){ - key = u.slice(start, end).join('-'); - if (s[key] != null) { - fmt += s[key]; - start = end; - break; - } - } - return fmt.trim(); -} -const t0 = new Date(); -function localYear(y) { - t0.setFullYear(y); - t0.setMonth(0); - t0.setDate(1); - t0.setHours(0, 0, 0, 0); - return t0; -} -function dayofyear(d) { - return localDayOfYear(new Date(d)); -} -function week(d) { - return localWeekNum(new Date(d)); -} -function localDayOfYear(d) { - return (0, _d3Time.timeDay).count(localYear(d.getFullYear()) - 1, d); -} -function localWeekNum(d) { - return (0, _d3Time.timeWeek).count(localYear(d.getFullYear()) - 1, d); -} -function localFirst(y) { - return localYear(y).getDay(); -} -function localDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(-1, m, d, H, M, S, L); - date.setFullYear(y); - return date; - } - return new Date(y, m, d, H, M, S, L); -} -function utcdayofyear(d) { - return utcDayOfYear(new Date(d)); -} -function utcweek(d) { - return utcWeekNum(new Date(d)); -} -function utcDayOfYear(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcDay).count(y - 1, d); -} -function utcWeekNum(d) { - const y = Date.UTC(d.getUTCFullYear(), 0, 1); - return (0, _d3Time.utcWeek).count(y - 1, d); -} -function utcFirst(y) { - t0.setTime(Date.UTC(y, 0, 1)); - return t0.getUTCDay(); -} -function utcDate(y, m, d, H, M, S, L) { - if (0 <= y && y < 100) { - const date = new Date(Date.UTC(-1, m, d, H, M, S, L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(y, m, d, H, M, S, L)); -} -function floor(units, step, get, inv, newDate) { - const s = step || 1, b = (0, _vegaUtil.peek)(units), _ = (unit, p, key)=>{ - key = key || unit; - return getUnit(get[key], inv[key], unit === b && s, p); - }; - const t = new Date(), u = (0, _vegaUtil.toSet)(units), y = u[YEAR] ? _(YEAR) : (0, _vegaUtil.constant)(2012), m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : (0, _vegaUtil.zero), d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : (0, _vegaUtil.one), H = u[HOURS] ? _(HOURS) : (0, _vegaUtil.zero), M = u[MINUTES] ? _(MINUTES) : (0, _vegaUtil.zero), S = u[SECONDS] ? _(SECONDS) : (0, _vegaUtil.zero), L = u[MILLISECONDS] ? _(MILLISECONDS) : (0, _vegaUtil.zero); - return function(v) { - t.setTime(+v); - const year = y(t); - return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t)); - }; -} -function getUnit(f, inv, step, phase) { - const u = step <= 1 ? f : phase ? (d, y)=>phase + step * Math.floor((f(d, y) - phase) / step) : (d, y)=>step * Math.floor(f(d, y) / step); - return inv ? (d, y)=>inv(u(d, y), y) : u; -} -// returns the day of the year based on week number, day of week, -// and the day of the week for the first day of the year -function weekday(week, day, firstDay) { - return day + week * 7 - (firstDay + 6) % 7; -} -// -- LOCAL TIME -- -const localGet = { - [YEAR]: (d)=>d.getFullYear(), - [QUARTER]: (d)=>Math.floor(d.getMonth() / 3), - [MONTH]: (d)=>d.getMonth(), - [DATE]: (d)=>d.getDate(), - [HOURS]: (d)=>d.getHours(), - [MINUTES]: (d)=>d.getMinutes(), - [SECONDS]: (d)=>d.getSeconds(), - [MILLISECONDS]: (d)=>d.getMilliseconds(), - [DAYOFYEAR]: (d)=>localDayOfYear(d), - [WEEK]: (d)=>localWeekNum(d), - [WEEK + DAY]: (d, y)=>weekday(localWeekNum(d), d.getDay(), localFirst(y)), - [DAY]: (d, y)=>weekday(1, d.getDay(), localFirst(y)) -}; -const localInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, localFirst(y)) -}; -function timeFloor(units, step) { - return floor(units, step || 1, localGet, localInv, localDate); -} -// -- UTC TIME -- -const utcGet = { - [YEAR]: (d)=>d.getUTCFullYear(), - [QUARTER]: (d)=>Math.floor(d.getUTCMonth() / 3), - [MONTH]: (d)=>d.getUTCMonth(), - [DATE]: (d)=>d.getUTCDate(), - [HOURS]: (d)=>d.getUTCHours(), - [MINUTES]: (d)=>d.getUTCMinutes(), - [SECONDS]: (d)=>d.getUTCSeconds(), - [MILLISECONDS]: (d)=>d.getUTCMilliseconds(), - [DAYOFYEAR]: (d)=>utcDayOfYear(d), - [WEEK]: (d)=>utcWeekNum(d), - [DAY]: (d, y)=>weekday(1, d.getUTCDay(), utcFirst(y)), - [WEEK + DAY]: (d, y)=>weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y)) -}; -const utcInv = { - [QUARTER]: (q)=>3 * q, - [WEEK]: (w, y)=>weekday(w, 0, utcFirst(y)) -}; -function utcFloor(units, step) { - return floor(units, step || 1, utcGet, utcInv, utcDate); -} -const timeIntervals = { - [YEAR]: (0, _d3Time.timeYear), - [QUARTER]: (0, _d3Time.timeMonth).every(3), - [MONTH]: (0, _d3Time.timeMonth), - [WEEK]: (0, _d3Time.timeWeek), - [DATE]: (0, _d3Time.timeDay), - [DAY]: (0, _d3Time.timeDay), - [DAYOFYEAR]: (0, _d3Time.timeDay), - [HOURS]: (0, _d3Time.timeHour), - [MINUTES]: (0, _d3Time.timeMinute), - [SECONDS]: (0, _d3Time.timeSecond), - [MILLISECONDS]: (0, _d3Time.timeMillisecond) -}; -const utcIntervals = { - [YEAR]: (0, _d3Time.utcYear), - [QUARTER]: (0, _d3Time.utcMonth).every(3), - [MONTH]: (0, _d3Time.utcMonth), - [WEEK]: (0, _d3Time.utcWeek), - [DATE]: (0, _d3Time.utcDay), - [DAY]: (0, _d3Time.utcDay), - [DAYOFYEAR]: (0, _d3Time.utcDay), - [HOURS]: (0, _d3Time.utcHour), - [MINUTES]: (0, _d3Time.utcMinute), - [SECONDS]: (0, _d3Time.utcSecond), - [MILLISECONDS]: (0, _d3Time.utcMillisecond) -}; -function timeInterval(unit) { - return timeIntervals[unit]; -} -function utcInterval(unit) { - return utcIntervals[unit]; -} -function offset(ival, date, step) { - return ival ? ival.offset(date, step) : undefined; -} -function timeOffset(unit, date, step) { - return offset(timeInterval(unit), date, step); -} -function utcOffset(unit, date, step) { - return offset(utcInterval(unit), date, step); -} -function sequence(ival, start, stop, step) { - return ival ? ival.range(start, stop, step) : undefined; -} -function timeSequence(unit, start, stop, step) { - return sequence(timeInterval(unit), start, stop, step); -} -function utcSequence(unit, start, stop, step) { - return sequence(utcInterval(unit), start, stop, step); -} -const durationSecond = 1000, durationMinute = durationSecond * 60, durationHour = durationMinute * 60, durationDay = durationHour * 24, durationWeek = durationDay * 7, durationMonth = durationDay * 30, durationYear = durationDay * 365; -const Milli = [ - YEAR, - MONTH, - DATE, - HOURS, - MINUTES, - SECONDS, - MILLISECONDS -], Seconds = Milli.slice(0, -1), Minutes = Seconds.slice(0, -1), Hours = Minutes.slice(0, -1), Day = Hours.slice(0, -1), Week = [ - YEAR, - WEEK -], Month = [ - YEAR, - MONTH -], Year = [ - YEAR -]; -const intervals = [ - [ - Seconds, - 1, - durationSecond - ], - [ - Seconds, - 5, - 5 * durationSecond - ], - [ - Seconds, - 15, - 15 * durationSecond - ], - [ - Seconds, - 30, - 30 * durationSecond - ], - [ - Minutes, - 1, - durationMinute - ], - [ - Minutes, - 5, - 5 * durationMinute - ], - [ - Minutes, - 15, - 15 * durationMinute - ], - [ - Minutes, - 30, - 30 * durationMinute - ], - [ - Hours, - 1, - durationHour - ], - [ - Hours, - 3, - 3 * durationHour - ], - [ - Hours, - 6, - 6 * durationHour - ], - [ - Hours, - 12, - 12 * durationHour - ], - [ - Day, - 1, - durationDay - ], - [ - Week, - 1, - durationWeek - ], - [ - Month, - 1, - durationMonth - ], - [ - Month, - 3, - 3 * durationMonth - ], - [ - Year, - 1, - durationYear - ] -]; -function bin(opt) { - const ext = opt.extent, max = opt.maxbins || 40, target = Math.abs((0, _vegaUtil.span)(ext)) / max; - let i = (0, _d3Array.bisector)((i)=>i[2]).right(intervals, target), units, step; - if (i === intervals.length) units = Year, step = (0, _d3Array.tickStep)(ext[0] / durationYear, ext[1] / durationYear, max); - else if (i) { - i = intervals[target / intervals[i - 1][2] < intervals[i][2] / target ? i - 1 : i]; - units = i[0]; - step = i[1]; - } else { - units = Milli; - step = Math.max((0, _d3Array.tickStep)(ext[0], ext[1], max), 1); - } - return { - units, - step - }; -} - -},{"vega-util":"bApja","d3-time":"8e7eR","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8e7eR":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>(0, _intervalJs.timeInterval)); -parcelHelpers.export(exports, "utcMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "utcMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "timeMillisecond", ()=>(0, _millisecondJs.millisecond)); -parcelHelpers.export(exports, "timeMilliseconds", ()=>(0, _millisecondJs.milliseconds)); -parcelHelpers.export(exports, "utcSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "utcSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeSecond", ()=>(0, _secondJs.second)); -parcelHelpers.export(exports, "timeSeconds", ()=>(0, _secondJs.seconds)); -parcelHelpers.export(exports, "timeMinute", ()=>(0, _minuteJs.timeMinute)); -parcelHelpers.export(exports, "timeMinutes", ()=>(0, _minuteJs.timeMinutes)); -parcelHelpers.export(exports, "utcMinute", ()=>(0, _minuteJs.utcMinute)); -parcelHelpers.export(exports, "utcMinutes", ()=>(0, _minuteJs.utcMinutes)); -parcelHelpers.export(exports, "timeHour", ()=>(0, _hourJs.timeHour)); -parcelHelpers.export(exports, "timeHours", ()=>(0, _hourJs.timeHours)); -parcelHelpers.export(exports, "utcHour", ()=>(0, _hourJs.utcHour)); -parcelHelpers.export(exports, "utcHours", ()=>(0, _hourJs.utcHours)); -parcelHelpers.export(exports, "timeDay", ()=>(0, _dayJs.timeDay)); -parcelHelpers.export(exports, "timeDays", ()=>(0, _dayJs.timeDays)); -parcelHelpers.export(exports, "utcDay", ()=>(0, _dayJs.utcDay)); -parcelHelpers.export(exports, "utcDays", ()=>(0, _dayJs.utcDays)); -parcelHelpers.export(exports, "unixDay", ()=>(0, _dayJs.unixDay)); -parcelHelpers.export(exports, "unixDays", ()=>(0, _dayJs.unixDays)); -parcelHelpers.export(exports, "timeWeek", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeWeeks", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeSunday", ()=>(0, _weekJs.timeSunday)); -parcelHelpers.export(exports, "timeSundays", ()=>(0, _weekJs.timeSundays)); -parcelHelpers.export(exports, "timeMonday", ()=>(0, _weekJs.timeMonday)); -parcelHelpers.export(exports, "timeMondays", ()=>(0, _weekJs.timeMondays)); -parcelHelpers.export(exports, "timeTuesday", ()=>(0, _weekJs.timeTuesday)); -parcelHelpers.export(exports, "timeTuesdays", ()=>(0, _weekJs.timeTuesdays)); -parcelHelpers.export(exports, "timeWednesday", ()=>(0, _weekJs.timeWednesday)); -parcelHelpers.export(exports, "timeWednesdays", ()=>(0, _weekJs.timeWednesdays)); -parcelHelpers.export(exports, "timeThursday", ()=>(0, _weekJs.timeThursday)); -parcelHelpers.export(exports, "timeThursdays", ()=>(0, _weekJs.timeThursdays)); -parcelHelpers.export(exports, "timeFriday", ()=>(0, _weekJs.timeFriday)); -parcelHelpers.export(exports, "timeFridays", ()=>(0, _weekJs.timeFridays)); -parcelHelpers.export(exports, "timeSaturday", ()=>(0, _weekJs.timeSaturday)); -parcelHelpers.export(exports, "timeSaturdays", ()=>(0, _weekJs.timeSaturdays)); -parcelHelpers.export(exports, "utcWeek", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcWeeks", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcSunday", ()=>(0, _weekJs.utcSunday)); -parcelHelpers.export(exports, "utcSundays", ()=>(0, _weekJs.utcSundays)); -parcelHelpers.export(exports, "utcMonday", ()=>(0, _weekJs.utcMonday)); -parcelHelpers.export(exports, "utcMondays", ()=>(0, _weekJs.utcMondays)); -parcelHelpers.export(exports, "utcTuesday", ()=>(0, _weekJs.utcTuesday)); -parcelHelpers.export(exports, "utcTuesdays", ()=>(0, _weekJs.utcTuesdays)); -parcelHelpers.export(exports, "utcWednesday", ()=>(0, _weekJs.utcWednesday)); -parcelHelpers.export(exports, "utcWednesdays", ()=>(0, _weekJs.utcWednesdays)); -parcelHelpers.export(exports, "utcThursday", ()=>(0, _weekJs.utcThursday)); -parcelHelpers.export(exports, "utcThursdays", ()=>(0, _weekJs.utcThursdays)); -parcelHelpers.export(exports, "utcFriday", ()=>(0, _weekJs.utcFriday)); -parcelHelpers.export(exports, "utcFridays", ()=>(0, _weekJs.utcFridays)); -parcelHelpers.export(exports, "utcSaturday", ()=>(0, _weekJs.utcSaturday)); -parcelHelpers.export(exports, "utcSaturdays", ()=>(0, _weekJs.utcSaturdays)); -parcelHelpers.export(exports, "timeMonth", ()=>(0, _monthJs.timeMonth)); -parcelHelpers.export(exports, "timeMonths", ()=>(0, _monthJs.timeMonths)); -parcelHelpers.export(exports, "utcMonth", ()=>(0, _monthJs.utcMonth)); -parcelHelpers.export(exports, "utcMonths", ()=>(0, _monthJs.utcMonths)); -parcelHelpers.export(exports, "timeYear", ()=>(0, _yearJs.timeYear)); -parcelHelpers.export(exports, "timeYears", ()=>(0, _yearJs.timeYears)); -parcelHelpers.export(exports, "utcYear", ()=>(0, _yearJs.utcYear)); -parcelHelpers.export(exports, "utcYears", ()=>(0, _yearJs.utcYears)); -parcelHelpers.export(exports, "utcTicks", ()=>(0, _ticksJs.utcTicks)); -parcelHelpers.export(exports, "utcTickInterval", ()=>(0, _ticksJs.utcTickInterval)); -parcelHelpers.export(exports, "timeTicks", ()=>(0, _ticksJs.timeTicks)); -parcelHelpers.export(exports, "timeTickInterval", ()=>(0, _ticksJs.timeTickInterval)); -var _intervalJs = require("./interval.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -var _ticksJs = require("./ticks.js"); - -},{"./interval.js":false,"./millisecond.js":"1aEMD","./second.js":"22XHb","./minute.js":"6j7Ml","./hour.js":"llDoC","./day.js":"ewpwG","./week.js":"gpqk4","./month.js":"gnhQl","./year.js":"flVyx","./ticks.js":"hqlJr","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l16eQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeInterval", ()=>timeInterval); -const t0 = new Date, t1 = new Date; -function timeInterval(floori, offseti, count, field) { - function interval(date) { - return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date; - } - interval.floor = (date)=>{ - return floori(date = new Date(+date)), date; - }; - interval.ceil = (date)=>{ - return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; - }; - interval.round = (date)=>{ - const d0 = interval(date), d1 = interval.ceil(date); - return date - d0 < d1 - date ? d0 : d1; - }; - interval.offset = (date, step)=>{ - return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; - }; - interval.range = (start, stop, step)=>{ - const range = []; - start = interval.ceil(start); - step = step == null ? 1 : Math.floor(step); - if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date - let previous; - do range.push(previous = new Date(+start)), offseti(start, step), floori(start); - while (previous < start && start < stop); - return range; - }; - interval.filter = (test)=>{ - return timeInterval((date)=>{ - if (date >= date) while(floori(date), !test(date))date.setTime(date - 1); - }, (date, step)=>{ - if (date >= date) { - if (step < 0) while(++step <= 0){ - while(offseti(date, -1), !test(date)); // eslint-disable-line no-empty - } - else while(--step >= 0){ - while(offseti(date, 1), !test(date)); // eslint-disable-line no-empty - } - } - }); - }; - if (count) { - interval.count = (start, end)=>{ - t0.setTime(+start), t1.setTime(+end); - floori(t0), floori(t1); - return Math.floor(count(t0, t1)); - }; - interval.every = (step)=>{ - step = Math.floor(step); - return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? (d)=>field(d) % step === 0 : (d)=>interval.count(0, d) % step === 0); - }; - } - return interval; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1aEMD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "millisecond", ()=>millisecond); -parcelHelpers.export(exports, "milliseconds", ()=>milliseconds); -var _intervalJs = require("./interval.js"); -const millisecond = (0, _intervalJs.timeInterval)(()=>{ -// noop -}, (date, step)=>{ - date.setTime(+date + step); -}, (start, end)=>{ - return end - start; -}); -// An optimized implementation for this simple case. -millisecond.every = (k)=>{ - k = Math.floor(k); - if (!isFinite(k) || !(k > 0)) return null; - if (!(k > 1)) return millisecond; - return (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(Math.floor(date / k) * k); - }, (date, step)=>{ - date.setTime(+date + step * k); - }, (start, end)=>{ - return (end - start) / k; - }); -}; -const milliseconds = millisecond.range; - -},{"./interval.js":"l16eQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"22XHb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "second", ()=>second); -parcelHelpers.export(exports, "seconds", ()=>seconds); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const second = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds()); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationSecond)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationSecond); -}, (date)=>{ - return date.getUTCSeconds(); -}); -const seconds = second.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1XXl6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "durationSecond", ()=>durationSecond); -parcelHelpers.export(exports, "durationMinute", ()=>durationMinute); -parcelHelpers.export(exports, "durationHour", ()=>durationHour); -parcelHelpers.export(exports, "durationDay", ()=>durationDay); -parcelHelpers.export(exports, "durationWeek", ()=>durationWeek); -parcelHelpers.export(exports, "durationMonth", ()=>durationMonth); -parcelHelpers.export(exports, "durationYear", ()=>durationYear); -const durationSecond = 1000; -const durationMinute = durationSecond * 60; -const durationHour = durationMinute * 60; -const durationDay = durationHour * 24; -const durationWeek = durationDay * 7; -const durationMonth = durationDay * 30; -const durationYear = durationDay * 365; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6j7Ml":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMinute", ()=>timeMinute); -parcelHelpers.export(exports, "timeMinutes", ()=>timeMinutes); -parcelHelpers.export(exports, "utcMinute", ()=>utcMinute); -parcelHelpers.export(exports, "utcMinutes", ()=>utcMinutes); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getMinutes(); -}); -const timeMinutes = timeMinute.range; -const utcMinute = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCSeconds(0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationMinute)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationMinute); -}, (date)=>{ - return date.getUTCMinutes(); -}); -const utcMinutes = utcMinute.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"llDoC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeHour", ()=>timeHour); -parcelHelpers.export(exports, "timeHours", ()=>timeHours); -parcelHelpers.export(exports, "utcHour", ()=>utcHour); -parcelHelpers.export(exports, "utcHours", ()=>utcHours); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setTime(date - date.getMilliseconds() - date.getSeconds() * (0, _durationJs.durationSecond) - date.getMinutes() * (0, _durationJs.durationMinute)); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getHours(); -}); -const timeHours = timeHour.range; -const utcHour = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMinutes(0, 0, 0); -}, (date, step)=>{ - date.setTime(+date + step * (0, _durationJs.durationHour)); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationHour); -}, (date)=>{ - return date.getUTCHours(); -}); -const utcHours = utcHour.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewpwG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeDay", ()=>timeDay); -parcelHelpers.export(exports, "timeDays", ()=>timeDays); -parcelHelpers.export(exports, "utcDay", ()=>utcDay); -parcelHelpers.export(exports, "utcDays", ()=>utcDays); -parcelHelpers.export(exports, "unixDay", ()=>unixDay); -parcelHelpers.export(exports, "unixDays", ()=>unixDays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -const timeDay = (0, _intervalJs.timeInterval)((date)=>date.setHours(0, 0, 0, 0), (date, step)=>date.setDate(date.getDate() + step), (start, end)=>(end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationDay), (date)=>date.getDate() - 1); -const timeDays = timeDay.range; -const utcDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return date.getUTCDate() - 1; -}); -const utcDays = utcDay.range; -const unixDay = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step); -}, (start, end)=>{ - return (end - start) / (0, _durationJs.durationDay); -}, (date)=>{ - return Math.floor(date / (0, _durationJs.durationDay)); -}); -const unixDays = unixDay.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gpqk4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeSunday", ()=>timeSunday); -parcelHelpers.export(exports, "timeMonday", ()=>timeMonday); -parcelHelpers.export(exports, "timeTuesday", ()=>timeTuesday); -parcelHelpers.export(exports, "timeWednesday", ()=>timeWednesday); -parcelHelpers.export(exports, "timeThursday", ()=>timeThursday); -parcelHelpers.export(exports, "timeFriday", ()=>timeFriday); -parcelHelpers.export(exports, "timeSaturday", ()=>timeSaturday); -parcelHelpers.export(exports, "timeSundays", ()=>timeSundays); -parcelHelpers.export(exports, "timeMondays", ()=>timeMondays); -parcelHelpers.export(exports, "timeTuesdays", ()=>timeTuesdays); -parcelHelpers.export(exports, "timeWednesdays", ()=>timeWednesdays); -parcelHelpers.export(exports, "timeThursdays", ()=>timeThursdays); -parcelHelpers.export(exports, "timeFridays", ()=>timeFridays); -parcelHelpers.export(exports, "timeSaturdays", ()=>timeSaturdays); -parcelHelpers.export(exports, "utcSunday", ()=>utcSunday); -parcelHelpers.export(exports, "utcMonday", ()=>utcMonday); -parcelHelpers.export(exports, "utcTuesday", ()=>utcTuesday); -parcelHelpers.export(exports, "utcWednesday", ()=>utcWednesday); -parcelHelpers.export(exports, "utcThursday", ()=>utcThursday); -parcelHelpers.export(exports, "utcFriday", ()=>utcFriday); -parcelHelpers.export(exports, "utcSaturday", ()=>utcSaturday); -parcelHelpers.export(exports, "utcSundays", ()=>utcSundays); -parcelHelpers.export(exports, "utcMondays", ()=>utcMondays); -parcelHelpers.export(exports, "utcTuesdays", ()=>utcTuesdays); -parcelHelpers.export(exports, "utcWednesdays", ()=>utcWednesdays); -parcelHelpers.export(exports, "utcThursdays", ()=>utcThursdays); -parcelHelpers.export(exports, "utcFridays", ()=>utcFridays); -parcelHelpers.export(exports, "utcSaturdays", ()=>utcSaturdays); -var _intervalJs = require("./interval.js"); -var _durationJs = require("./duration.js"); -function timeWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setDate(date.getDate() + step * 7); - }, (start, end)=>{ - return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * (0, _durationJs.durationMinute)) / (0, _durationJs.durationWeek); - }); -} -const timeSunday = timeWeekday(0); -const timeMonday = timeWeekday(1); -const timeTuesday = timeWeekday(2); -const timeWednesday = timeWeekday(3); -const timeThursday = timeWeekday(4); -const timeFriday = timeWeekday(5); -const timeSaturday = timeWeekday(6); -const timeSundays = timeSunday.range; -const timeMondays = timeMonday.range; -const timeTuesdays = timeTuesday.range; -const timeWednesdays = timeWednesday.range; -const timeThursdays = timeThursday.range; -const timeFridays = timeFriday.range; -const timeSaturdays = timeSaturday.range; -function utcWeekday(i) { - return (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCDate(date.getUTCDate() + step * 7); - }, (start, end)=>{ - return (end - start) / (0, _durationJs.durationWeek); - }); -} -const utcSunday = utcWeekday(0); -const utcMonday = utcWeekday(1); -const utcTuesday = utcWeekday(2); -const utcWednesday = utcWeekday(3); -const utcThursday = utcWeekday(4); -const utcFriday = utcWeekday(5); -const utcSaturday = utcWeekday(6); -const utcSundays = utcSunday.range; -const utcMondays = utcMonday.range; -const utcTuesdays = utcTuesday.range; -const utcWednesdays = utcWednesday.range; -const utcThursdays = utcThursday.range; -const utcFridays = utcFriday.range; -const utcSaturdays = utcSaturday.range; - -},{"./interval.js":"l16eQ","./duration.js":"1XXl6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gnhQl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeMonth", ()=>timeMonth); -parcelHelpers.export(exports, "timeMonths", ()=>timeMonths); -parcelHelpers.export(exports, "utcMonth", ()=>utcMonth); -parcelHelpers.export(exports, "utcMonths", ()=>utcMonths); -var _intervalJs = require("./interval.js"); -const timeMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setDate(1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setMonth(date.getMonth() + step); -}, (start, end)=>{ - return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; -}, (date)=>{ - return date.getMonth(); -}); -const timeMonths = timeMonth.range; -const utcMonth = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCDate(1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCMonth(date.getUTCMonth() + step); -}, (start, end)=>{ - return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; -}, (date)=>{ - return date.getUTCMonth(); -}); -const utcMonths = utcMonth.range; - -},{"./interval.js":"l16eQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"flVyx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeYear", ()=>timeYear); -parcelHelpers.export(exports, "timeYears", ()=>timeYears); -parcelHelpers.export(exports, "utcYear", ()=>utcYear); -parcelHelpers.export(exports, "utcYears", ()=>utcYears); -var _intervalJs = require("./interval.js"); -const timeYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setFullYear(date.getFullYear() + step); -}, (start, end)=>{ - return end.getFullYear() - start.getFullYear(); -}, (date)=>{ - return date.getFullYear(); -}); -// An optimized implementation for this simple case. -timeYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setFullYear(Math.floor(date.getFullYear() / k) * k); - date.setMonth(0, 1); - date.setHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setFullYear(date.getFullYear() + step * k); - }); -}; -const timeYears = timeYear.range; -const utcYear = (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); -}, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step); -}, (start, end)=>{ - return end.getUTCFullYear() - start.getUTCFullYear(); -}, (date)=>{ - return date.getUTCFullYear(); -}); -// An optimized implementation for this simple case. -utcYear.every = (k)=>{ - return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : (0, _intervalJs.timeInterval)((date)=>{ - date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); - date.setUTCMonth(0, 1); - date.setUTCHours(0, 0, 0, 0); - }, (date, step)=>{ - date.setUTCFullYear(date.getUTCFullYear() + step * k); - }); -}; -const utcYears = utcYear.range; - -},{"./interval.js":"l16eQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hqlJr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "utcTicks", ()=>utcTicks); -parcelHelpers.export(exports, "utcTickInterval", ()=>utcTickInterval); -parcelHelpers.export(exports, "timeTicks", ()=>timeTicks); -parcelHelpers.export(exports, "timeTickInterval", ()=>timeTickInterval); -var _d3Array = require("d3-array"); -var _durationJs = require("./duration.js"); -var _millisecondJs = require("./millisecond.js"); -var _secondJs = require("./second.js"); -var _minuteJs = require("./minute.js"); -var _hourJs = require("./hour.js"); -var _dayJs = require("./day.js"); -var _weekJs = require("./week.js"); -var _monthJs = require("./month.js"); -var _yearJs = require("./year.js"); -function ticker(year, month, week, day, hour, minute) { - const tickIntervals = [ - [ - (0, _secondJs.second), - 1, - (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 5, - 5 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 15, - 15 * (0, _durationJs.durationSecond) - ], - [ - (0, _secondJs.second), - 30, - 30 * (0, _durationJs.durationSecond) - ], - [ - minute, - 1, - (0, _durationJs.durationMinute) - ], - [ - minute, - 5, - 5 * (0, _durationJs.durationMinute) - ], - [ - minute, - 15, - 15 * (0, _durationJs.durationMinute) - ], - [ - minute, - 30, - 30 * (0, _durationJs.durationMinute) - ], - [ - hour, - 1, - (0, _durationJs.durationHour) - ], - [ - hour, - 3, - 3 * (0, _durationJs.durationHour) - ], - [ - hour, - 6, - 6 * (0, _durationJs.durationHour) - ], - [ - hour, - 12, - 12 * (0, _durationJs.durationHour) - ], - [ - day, - 1, - (0, _durationJs.durationDay) - ], - [ - day, - 2, - 2 * (0, _durationJs.durationDay) - ], - [ - week, - 1, - (0, _durationJs.durationWeek) - ], - [ - month, - 1, - (0, _durationJs.durationMonth) - ], - [ - month, - 3, - 3 * (0, _durationJs.durationMonth) - ], - [ - year, - 1, - (0, _durationJs.durationYear) - ] - ]; - function ticks(start, stop, count) { - const reverse = stop < start; - if (reverse) [start, stop] = [ - stop, - start - ]; - const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count); - const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop - return reverse ? ticks.reverse() : ticks; - } - function tickInterval(start, stop, count) { - const target = Math.abs(stop - start) / count; - const i = (0, _d3Array.bisector)(([, , step])=>step).right(tickIntervals, target); - if (i === tickIntervals.length) return year.every((0, _d3Array.tickStep)(start / (0, _durationJs.durationYear), stop / (0, _durationJs.durationYear), count)); - if (i === 0) return (0, _millisecondJs.millisecond).every(Math.max((0, _d3Array.tickStep)(start, stop, count), 1)); - const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; - return t.every(step); - } - return [ - ticks, - tickInterval - ]; -} -const [utcTicks, utcTickInterval] = ticker((0, _yearJs.utcYear), (0, _monthJs.utcMonth), (0, _weekJs.utcSunday), (0, _dayJs.unixDay), (0, _hourJs.utcHour), (0, _minuteJs.utcMinute)); -const [timeTicks, timeTickInterval] = ticker((0, _yearJs.timeYear), (0, _monthJs.timeMonth), (0, _weekJs.timeSunday), (0, _dayJs.timeDay), (0, _hourJs.timeHour), (0, _minuteJs.timeMinute)); - -},{"d3-array":"6IwJG","./duration.js":"1XXl6","./millisecond.js":"1aEMD","./second.js":"22XHb","./minute.js":"6j7Ml","./hour.js":"llDoC","./day.js":"ewpwG","./week.js":"gpqk4","./month.js":"gnhQl","./year.js":"flVyx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"242jH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormatDefaultLocale", ()=>(0, _defaultLocaleJsDefault.default)); -parcelHelpers.export(exports, "timeFormat", ()=>(0, _defaultLocaleJs.timeFormat)); -parcelHelpers.export(exports, "timeParse", ()=>(0, _defaultLocaleJs.timeParse)); -parcelHelpers.export(exports, "utcFormat", ()=>(0, _defaultLocaleJs.utcFormat)); -parcelHelpers.export(exports, "utcParse", ()=>(0, _defaultLocaleJs.utcParse)); -parcelHelpers.export(exports, "timeFormatLocale", ()=>(0, _localeJsDefault.default)); -parcelHelpers.export(exports, "isoFormat", ()=>(0, _isoFormatJsDefault.default)); -parcelHelpers.export(exports, "isoParse", ()=>(0, _isoParseJsDefault.default)); -var _defaultLocaleJs = require("./defaultLocale.js"); -var _defaultLocaleJsDefault = parcelHelpers.interopDefault(_defaultLocaleJs); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var _isoFormatJs = require("./isoFormat.js"); -var _isoFormatJsDefault = parcelHelpers.interopDefault(_isoFormatJs); -var _isoParseJs = require("./isoParse.js"); -var _isoParseJsDefault = parcelHelpers.interopDefault(_isoParseJs); - -},{"./defaultLocale.js":"hRBbX","./locale.js":"iUewg","./isoFormat.js":false,"./isoParse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hRBbX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "default", ()=>defaultLocale); -var _localeJs = require("./locale.js"); -var _localeJsDefault = parcelHelpers.interopDefault(_localeJs); -var locale; -var timeFormat; -var timeParse; -var utcFormat; -var utcParse; -defaultLocale({ - dateTime: "%x, %X", - date: "%-m/%-d/%Y", - time: "%-I:%M:%S %p", - periods: [ - "AM", - "PM" - ], - days: [ - "Sunday", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday" - ], - shortDays: [ - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat" - ], - months: [ - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" - ], - shortMonths: [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ] -}); -function defaultLocale(definition) { - locale = (0, _localeJsDefault.default)(definition); - timeFormat = locale.format; - timeParse = locale.parse; - utcFormat = locale.utcFormat; - utcParse = locale.utcParse; - return locale; -} - -},{"./locale.js":"iUewg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUewg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>formatLocale); -var _d3Time = require("d3-time"); -function localDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); - date.setFullYear(d.y); - return date; - } - return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); -} -function utcDate(d) { - if (0 <= d.y && d.y < 100) { - var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); - date.setUTCFullYear(d.y); - return date; - } - return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); -} -function newDate(y, m, d) { - return { - y: y, - m: m, - d: d, - H: 0, - M: 0, - S: 0, - L: 0 - }; -} -function formatLocale(locale) { - var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths; - var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); - var formats = { - "a": formatShortWeekday, - "A": formatWeekday, - "b": formatShortMonth, - "B": formatMonth, - "c": null, - "d": formatDayOfMonth, - "e": formatDayOfMonth, - "f": formatMicroseconds, - "g": formatYearISO, - "G": formatFullYearISO, - "H": formatHour24, - "I": formatHour12, - "j": formatDayOfYear, - "L": formatMilliseconds, - "m": formatMonthNumber, - "M": formatMinutes, - "p": formatPeriod, - "q": formatQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatSeconds, - "u": formatWeekdayNumberMonday, - "U": formatWeekNumberSunday, - "V": formatWeekNumberISO, - "w": formatWeekdayNumberSunday, - "W": formatWeekNumberMonday, - "x": null, - "X": null, - "y": formatYear, - "Y": formatFullYear, - "Z": formatZone, - "%": formatLiteralPercent - }; - var utcFormats = { - "a": formatUTCShortWeekday, - "A": formatUTCWeekday, - "b": formatUTCShortMonth, - "B": formatUTCMonth, - "c": null, - "d": formatUTCDayOfMonth, - "e": formatUTCDayOfMonth, - "f": formatUTCMicroseconds, - "g": formatUTCYearISO, - "G": formatUTCFullYearISO, - "H": formatUTCHour24, - "I": formatUTCHour12, - "j": formatUTCDayOfYear, - "L": formatUTCMilliseconds, - "m": formatUTCMonthNumber, - "M": formatUTCMinutes, - "p": formatUTCPeriod, - "q": formatUTCQuarter, - "Q": formatUnixTimestamp, - "s": formatUnixTimestampSeconds, - "S": formatUTCSeconds, - "u": formatUTCWeekdayNumberMonday, - "U": formatUTCWeekNumberSunday, - "V": formatUTCWeekNumberISO, - "w": formatUTCWeekdayNumberSunday, - "W": formatUTCWeekNumberMonday, - "x": null, - "X": null, - "y": formatUTCYear, - "Y": formatUTCFullYear, - "Z": formatUTCZone, - "%": formatLiteralPercent - }; - var parses = { - "a": parseShortWeekday, - "A": parseWeekday, - "b": parseShortMonth, - "B": parseMonth, - "c": parseLocaleDateTime, - "d": parseDayOfMonth, - "e": parseDayOfMonth, - "f": parseMicroseconds, - "g": parseYear, - "G": parseFullYear, - "H": parseHour24, - "I": parseHour24, - "j": parseDayOfYear, - "L": parseMilliseconds, - "m": parseMonthNumber, - "M": parseMinutes, - "p": parsePeriod, - "q": parseQuarter, - "Q": parseUnixTimestamp, - "s": parseUnixTimestampSeconds, - "S": parseSeconds, - "u": parseWeekdayNumberMonday, - "U": parseWeekNumberSunday, - "V": parseWeekNumberISO, - "w": parseWeekdayNumberSunday, - "W": parseWeekNumberMonday, - "x": parseLocaleDate, - "X": parseLocaleTime, - "y": parseYear, - "Y": parseFullYear, - "Z": parseZone, - "%": parseLiteralPercent - }; - // These recursive directive definitions must be deferred. - formats.x = newFormat(locale_date, formats); - formats.X = newFormat(locale_time, formats); - formats.c = newFormat(locale_dateTime, formats); - utcFormats.x = newFormat(locale_date, utcFormats); - utcFormats.X = newFormat(locale_time, utcFormats); - utcFormats.c = newFormat(locale_dateTime, utcFormats); - function newFormat(specifier, formats) { - return function(date) { - var string = [], i = -1, j = 0, n = specifier.length, c, pad, format; - if (!(date instanceof Date)) date = new Date(+date); - while(++i < n)if (specifier.charCodeAt(i) === 37) { - string.push(specifier.slice(j, i)); - if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); - else pad = c === "e" ? " " : "0"; - if (format = formats[c]) c = format(date, pad); - string.push(c); - j = i + 1; - } - string.push(specifier.slice(j, i)); - return string.join(""); - }; - } - function newParse(specifier, Z) { - return function(string) { - var d = newDate(1900, undefined, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day; - if (i != string.length) return null; - // If a UNIX timestamp is specified, return it. - if ("Q" in d) return new Date(d.Q); - if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); - // If this is utcParse, never use the local timezone. - if (Z && !("Z" in d)) d.Z = 0; - // The am-pm flag is 0 for AM, and 1 for PM. - if ("p" in d) d.H = d.H % 12 + d.p * 12; - // If the month was not specified, inherit from the quarter. - if (d.m === undefined) d.m = "q" in d ? d.q : 0; - // Convert day-of-week and week-of-year to day-of-year. - if ("V" in d) { - if (d.V < 1 || d.V > 53) return null; - if (!("w" in d)) d.w = 1; - if ("Z" in d) { - week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay(); - week = day > 4 || day === 0 ? (0, _d3Time.utcMonday).ceil(week) : (0, _d3Time.utcMonday)(week); - week = (0, _d3Time.utcDay).offset(week, (d.V - 1) * 7); - d.y = week.getUTCFullYear(); - d.m = week.getUTCMonth(); - d.d = week.getUTCDate() + (d.w + 6) % 7; - } else { - week = localDate(newDate(d.y, 0, 1)), day = week.getDay(); - week = day > 4 || day === 0 ? (0, _d3Time.timeMonday).ceil(week) : (0, _d3Time.timeMonday)(week); - week = (0, _d3Time.timeDay).offset(week, (d.V - 1) * 7); - d.y = week.getFullYear(); - d.m = week.getMonth(); - d.d = week.getDate() + (d.w + 6) % 7; - } - } else if ("W" in d || "U" in d) { - if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; - day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); - d.m = 0; - d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7; - } - // If a time zone is specified, all fields are interpreted as UTC and then - // offset according to the specified time zone. - if ("Z" in d) { - d.H += d.Z / 100 | 0; - d.M += d.Z % 100; - return utcDate(d); - } - // Otherwise, all fields are in local time. - return localDate(d); - }; - } - function parseSpecifier(d, specifier, string, j) { - var i = 0, n = specifier.length, m = string.length, c, parse; - while(i < n){ - if (j >= m) return -1; - c = specifier.charCodeAt(i++); - if (c === 37) { - c = specifier.charAt(i++); - parse = parses[c in pads ? specifier.charAt(i++) : c]; - if (!parse || (j = parse(d, string, j)) < 0) return -1; - } else if (c != string.charCodeAt(j++)) return -1; - } - return j; - } - function parsePeriod(d, string, i) { - var n = periodRe.exec(string.slice(i)); - return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + function parseLocaleDateTime(d, string2, i) { + return parseSpecifier(d, locale_dateTime, string2, i); } - function parseShortWeekday(d, string, i) { - var n = shortWeekdayRe.exec(string.slice(i)); - return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; + function parseLocaleDate(d, string2, i) { + return parseSpecifier(d, locale_date, string2, i); } - function parseWeekday(d, string, i) { - var n = weekdayRe.exec(string.slice(i)); - return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseShortMonth(d, string, i) { - var n = shortMonthRe.exec(string.slice(i)); - return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseMonth(d, string, i) { - var n = monthRe.exec(string.slice(i)); - return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; - } - function parseLocaleDateTime(d, string, i) { - return parseSpecifier(d, locale_dateTime, string, i); - } - function parseLocaleDate(d, string, i) { - return parseSpecifier(d, locale_date, string, i); - } - function parseLocaleTime(d, string, i) { - return parseSpecifier(d, locale_time, string, i); + function parseLocaleTime(d, string2, i) { + return parseSpecifier(d, locale_time, string2, i); } function formatShortWeekday(d) { - return locale_shortWeekdays[d.getDay()]; + return locale_shortWeekdays[d.getDay()]; } function formatWeekday(d) { - return locale_weekdays[d.getDay()]; + return locale_weekdays[d.getDay()]; } function formatShortMonth(d) { - return locale_shortMonths[d.getMonth()]; + return locale_shortMonths[d.getMonth()]; } function formatMonth(d) { - return locale_months[d.getMonth()]; + return locale_months[d.getMonth()]; } function formatPeriod(d) { - return locale_periods[+(d.getHours() >= 12)]; + return locale_periods[+(d.getHours() >= 12)]; } function formatQuarter(d) { - return 1 + ~~(d.getMonth() / 3); + return 1 + ~~(d.getMonth() / 3); } function formatUTCShortWeekday(d) { - return locale_shortWeekdays[d.getUTCDay()]; + return locale_shortWeekdays[d.getUTCDay()]; } function formatUTCWeekday(d) { - return locale_weekdays[d.getUTCDay()]; + return locale_weekdays[d.getUTCDay()]; } function formatUTCShortMonth(d) { - return locale_shortMonths[d.getUTCMonth()]; + return locale_shortMonths[d.getUTCMonth()]; } function formatUTCMonth(d) { - return locale_months[d.getUTCMonth()]; + return locale_months[d.getUTCMonth()]; } function formatUTCPeriod(d) { - return locale_periods[+(d.getUTCHours() >= 12)]; + return locale_periods[+(d.getUTCHours() >= 12)]; } function formatUTCQuarter(d) { - return 1 + ~~(d.getUTCMonth() / 3); + return 1 + ~~(d.getUTCMonth() / 3); } return { - format: function(specifier) { - var f = newFormat(specifier += "", formats); - f.toString = function() { - return specifier; - }; - return f; - }, - parse: function(specifier) { - var p = newParse(specifier += "", false); - p.toString = function() { - return specifier; - }; - return p; - }, - utcFormat: function(specifier) { - var f = newFormat(specifier += "", utcFormats); - f.toString = function() { - return specifier; - }; - return f; - }, - utcParse: function(specifier) { - var p = newParse(specifier += "", true); - p.toString = function() { - return specifier; - }; - return p; - } - }; -} -var pads = { - "-": "", - "_": " ", - "0": "0" -}, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; -function pad(value, fill, width) { - var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length; - return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); -} -function requote(s) { + format: function(specifier) { + var f = newFormat(specifier += "", formats2); + f.toString = function() { + return specifier; + }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", false); + p.toString = function() { + return specifier; + }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { + return specifier; + }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier += "", true); + p.toString = function() { + return specifier; + }; + return p; + } + }; + } + var pads = { "-": "", "_": " ", "0": "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; + function pad(value2, fill2, width2) { + var sign2 = value2 < 0 ? "-" : "", string2 = (sign2 ? -value2 : value2) + "", length2 = string2.length; + return sign2 + (length2 < width2 ? new Array(width2 - length2 + 1).join(fill2) + string2 : string2); + } + function requote(s) { return s.replace(requoteRe, "\\$&"); -} -function formatRe(names) { + } + function formatRe(names) { return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); -} -function formatLookup(names) { - return new Map(names.map((name, i)=>[ - name.toLowerCase(), - i - ])); -} -function parseWeekdayNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); + } + function formatLookup(names) { + return new Map(names.map((name, i) => [name.toLowerCase(), i])); + } + function parseWeekdayNumberSunday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); return n ? (d.w = +n[0], i + n[0].length) : -1; -} -function parseWeekdayNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); + } + function parseWeekdayNumberMonday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); return n ? (d.u = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberSunday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseWeekNumberSunday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.U = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberISO(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseWeekNumberISO(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.V = +n[0], i + n[0].length) : -1; -} -function parseWeekNumberMonday(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseWeekNumberMonday(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.W = +n[0], i + n[0].length) : -1; -} -function parseFullYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 4)); + } + function parseFullYear(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 4)); return n ? (d.y = +n[0], i + n[0].length) : -1; -} -function parseYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); - return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; -} -function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); + } + function parseYear(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); + return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; + } + function parseZone(d, string2, i) { + var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string2.slice(i, i + 6)); return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; -} -function parseQuarter(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 1)); + } + function parseQuarter(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 1)); return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; -} -function parseMonthNumber(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseMonthNumber(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.m = n[0] - 1, i + n[0].length) : -1; -} -function parseDayOfMonth(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseDayOfMonth(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.d = +n[0], i + n[0].length) : -1; -} -function parseDayOfYear(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); + } + function parseDayOfYear(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; -} -function parseHour24(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseHour24(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.H = +n[0], i + n[0].length) : -1; -} -function parseMinutes(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseMinutes(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.M = +n[0], i + n[0].length) : -1; -} -function parseSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 2)); + } + function parseSeconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 2)); return n ? (d.S = +n[0], i + n[0].length) : -1; -} -function parseMilliseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 3)); + } + function parseMilliseconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 3)); return n ? (d.L = +n[0], i + n[0].length) : -1; -} -function parseMicroseconds(d, string, i) { - var n = numberRe.exec(string.slice(i, i + 6)); - return n ? (d.L = Math.floor(n[0] / 1000), i + n[0].length) : -1; -} -function parseLiteralPercent(d, string, i) { - var n = percentRe.exec(string.slice(i, i + 1)); + } + function parseMicroseconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i, i + 6)); + return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; + } + function parseLiteralPercent(d, string2, i) { + var n = percentRe.exec(string2.slice(i, i + 1)); return n ? i + n[0].length : -1; -} -function parseUnixTimestamp(d, string, i) { - var n = numberRe.exec(string.slice(i)); + } + function parseUnixTimestamp(d, string2, i) { + var n = numberRe.exec(string2.slice(i)); return n ? (d.Q = +n[0], i + n[0].length) : -1; -} -function parseUnixTimestampSeconds(d, string, i) { - var n = numberRe.exec(string.slice(i)); + } + function parseUnixTimestampSeconds(d, string2, i) { + var n = numberRe.exec(string2.slice(i)); return n ? (d.s = +n[0], i + n[0].length) : -1; -} -function formatDayOfMonth(d, p) { + } + function formatDayOfMonth(d, p) { return pad(d.getDate(), p, 2); -} -function formatHour24(d, p) { + } + function formatHour24(d, p) { return pad(d.getHours(), p, 2); -} -function formatHour12(d, p) { + } + function formatHour12(d, p) { return pad(d.getHours() % 12 || 12, p, 2); -} -function formatDayOfYear(d, p) { - return pad(1 + (0, _d3Time.timeDay).count((0, _d3Time.timeYear)(d), d), p, 3); -} -function formatMilliseconds(d, p) { + } + function formatDayOfYear(d, p) { + return pad(1 + timeDay.count(timeYear(d), d), p, 3); + } + function formatMilliseconds(d, p) { return pad(d.getMilliseconds(), p, 3); -} -function formatMicroseconds(d, p) { + } + function formatMicroseconds(d, p) { return formatMilliseconds(d, p) + "000"; -} -function formatMonthNumber(d, p) { + } + function formatMonthNumber(d, p) { return pad(d.getMonth() + 1, p, 2); -} -function formatMinutes(d, p) { + } + function formatMinutes(d, p) { return pad(d.getMinutes(), p, 2); -} -function formatSeconds(d, p) { + } + function formatSeconds(d, p) { return pad(d.getSeconds(), p, 2); -} -function formatWeekdayNumberMonday(d) { + } + function formatWeekdayNumberMonday(d) { var day = d.getDay(); return day === 0 ? 7 : day; -} -function formatWeekNumberSunday(d, p) { - return pad((0, _d3Time.timeSunday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function dISO(d) { + } + function formatWeekNumberSunday(d, p) { + return pad(timeSunday.count(timeYear(d) - 1, d), p, 2); + } + function dISO(d) { var day = d.getDay(); - return day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); -} -function formatWeekNumberISO(d, p) { + return day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); + } + function formatWeekNumberISO(d, p) { d = dISO(d); - return pad((0, _d3Time.timeThursday).count((0, _d3Time.timeYear)(d), d) + ((0, _d3Time.timeYear)(d).getDay() === 4), p, 2); -} -function formatWeekdayNumberSunday(d) { + return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); + } + function formatWeekdayNumberSunday(d) { return d.getDay(); -} -function formatWeekNumberMonday(d, p) { - return pad((0, _d3Time.timeMonday).count((0, _d3Time.timeYear)(d) - 1, d), p, 2); -} -function formatYear(d, p) { - return pad(d.getFullYear() % 100, p, 2); -} -function formatYearISO(d, p) { + } + function formatWeekNumberMonday(d, p) { + return pad(timeMonday.count(timeYear(d) - 1, d), p, 2); + } + function formatYear(d, p) { + return pad(d.getFullYear() % 100, p, 2); + } + function formatYearISO(d, p) { d = dISO(d); return pad(d.getFullYear() % 100, p, 2); -} -function formatFullYear(d, p) { - return pad(d.getFullYear() % 10000, p, 4); -} -function formatFullYearISO(d, p) { + } + function formatFullYear(d, p) { + return pad(d.getFullYear() % 1e4, p, 4); + } + function formatFullYearISO(d, p) { var day = d.getDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.timeThursday)(d) : (0, _d3Time.timeThursday).ceil(d); - return pad(d.getFullYear() % 10000, p, 4); -} -function formatZone(d) { + d = day >= 4 || day === 0 ? timeThursday(d) : timeThursday.ceil(d); + return pad(d.getFullYear() % 1e4, p, 4); + } + function formatZone(d) { var z = d.getTimezoneOffset(); return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); -} -function formatUTCDayOfMonth(d, p) { + } + function formatUTCDayOfMonth(d, p) { return pad(d.getUTCDate(), p, 2); -} -function formatUTCHour24(d, p) { + } + function formatUTCHour24(d, p) { return pad(d.getUTCHours(), p, 2); -} -function formatUTCHour12(d, p) { + } + function formatUTCHour12(d, p) { return pad(d.getUTCHours() % 12 || 12, p, 2); -} -function formatUTCDayOfYear(d, p) { - return pad(1 + (0, _d3Time.utcDay).count((0, _d3Time.utcYear)(d), d), p, 3); -} -function formatUTCMilliseconds(d, p) { + } + function formatUTCDayOfYear(d, p) { + return pad(1 + utcDay.count(utcYear(d), d), p, 3); + } + function formatUTCMilliseconds(d, p) { return pad(d.getUTCMilliseconds(), p, 3); -} -function formatUTCMicroseconds(d, p) { + } + function formatUTCMicroseconds(d, p) { return formatUTCMilliseconds(d, p) + "000"; -} -function formatUTCMonthNumber(d, p) { + } + function formatUTCMonthNumber(d, p) { return pad(d.getUTCMonth() + 1, p, 2); -} -function formatUTCMinutes(d, p) { + } + function formatUTCMinutes(d, p) { return pad(d.getUTCMinutes(), p, 2); -} -function formatUTCSeconds(d, p) { + } + function formatUTCSeconds(d, p) { return pad(d.getUTCSeconds(), p, 2); -} -function formatUTCWeekdayNumberMonday(d) { + } + function formatUTCWeekdayNumberMonday(d) { var dow = d.getUTCDay(); return dow === 0 ? 7 : dow; -} -function formatUTCWeekNumberSunday(d, p) { - return pad((0, _d3Time.utcSunday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function UTCdISO(d) { + } + function formatUTCWeekNumberSunday(d, p) { + return pad(utcSunday.count(utcYear(d) - 1, d), p, 2); + } + function UTCdISO(d) { var day = d.getUTCDay(); - return day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); -} -function formatUTCWeekNumberISO(d, p) { + return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); + } + function formatUTCWeekNumberISO(d, p) { d = UTCdISO(d); - return pad((0, _d3Time.utcThursday).count((0, _d3Time.utcYear)(d), d) + ((0, _d3Time.utcYear)(d).getUTCDay() === 4), p, 2); -} -function formatUTCWeekdayNumberSunday(d) { + return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); + } + function formatUTCWeekdayNumberSunday(d) { return d.getUTCDay(); -} -function formatUTCWeekNumberMonday(d, p) { - return pad((0, _d3Time.utcMonday).count((0, _d3Time.utcYear)(d) - 1, d), p, 2); -} -function formatUTCYear(d, p) { + } + function formatUTCWeekNumberMonday(d, p) { + return pad(utcMonday.count(utcYear(d) - 1, d), p, 2); + } + function formatUTCYear(d, p) { return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCYearISO(d, p) { + } + function formatUTCYearISO(d, p) { d = UTCdISO(d); return pad(d.getUTCFullYear() % 100, p, 2); -} -function formatUTCFullYear(d, p) { - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCFullYearISO(d, p) { + } + function formatUTCFullYear(d, p) { + return pad(d.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCFullYearISO(d, p) { var day = d.getUTCDay(); - d = day >= 4 || day === 0 ? (0, _d3Time.utcThursday)(d) : (0, _d3Time.utcThursday).ceil(d); - return pad(d.getUTCFullYear() % 10000, p, 4); -} -function formatUTCZone() { + d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d); + return pad(d.getUTCFullYear() % 1e4, p, 4); + } + function formatUTCZone() { return "+0000"; -} -function formatLiteralPercent() { + } + function formatLiteralPercent() { return "%"; -} -function formatUnixTimestamp(d) { + } + function formatUnixTimestamp(d) { return +d; -} -function formatUnixTimestampSeconds(d) { - return Math.floor(+d / 1000); -} - -},{"d3-time":"8e7eR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9AXxu":[function(require,module,exports,__globalThis) { -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh <https://feross.org> - * @license MIT - */ /* eslint-disable no-proto */ 'use strict'; -const base64 = require("9c62938f1dccc73c"); -const ieee754 = require("aceacb6a4531a9d2"); -const customInspectSymbol = typeof Symbol === 'function' && typeof Symbol['for'] === 'function' // eslint-disable-line dot-notation - ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null; -exports.Buffer = Buffer; -exports.SlowBuffer = SlowBuffer; -exports.INSPECT_MAX_BYTES = 50; -const K_MAX_LENGTH = 0x7fffffff; -exports.kMaxLength = K_MAX_LENGTH; -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && typeof console.error === 'function') console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); -function typedArraySupport() { - // Can typed array instances can be augmented? - try { - const arr = new Uint8Array(1); - const proto = { - foo: function() { - return 42; - } - }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return arr.foo() === 42; - } catch (e) { - return false; - } -} -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.buffer; - } -}); -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return undefined; - return this.byteOffset; - } -}); -function createBuffer(length) { - if (length > K_MAX_LENGTH) throw new RangeError('The value "' + length + '" is invalid for option "size"'); - // Return an augmented `Uint8Array` instance - const buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ function Buffer(arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') throw new TypeError('The "string" argument must be of type string. Received type number'); - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); -} -Buffer.poolSize = 8192 // not used by this implementation -; -function from(value, encodingOrOffset, length) { - if (typeof value === 'string') return fromString(value, encodingOrOffset); - if (ArrayBuffer.isView(value)) return fromArrayView(value); - if (value == null) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof SharedArrayBuffer !== 'undefined' && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if (typeof value === 'number') throw new TypeError('The "value" argument must not be of type number. Received type number'); - const valueOf = value.valueOf && value.valueOf(); - if (valueOf != null && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); - const b = fromObject(value); - if (b) return b; - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === 'function') return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); -} -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ Buffer.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); -}; -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); -Object.setPrototypeOf(Buffer, Uint8Array); -function assertSize(size) { - if (typeof size !== 'number') throw new TypeError('"size" argument must be of type number'); - else if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); -} -function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) return createBuffer(size); - if (fill !== undefined) // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return typeof encoding === 'string' ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - return createBuffer(size); -} -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ Buffer.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); -}; -function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : checked(size) | 0); -} -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ Buffer.allocUnsafe = function(size) { - return allocUnsafe(size); -}; -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ Buffer.allocUnsafeSlow = function(size) { - return allocUnsafe(size); -}; -function fromString(string, encoding) { - if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'; - if (!Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - const length = byteLength(string, encoding) | 0; - let buf = createBuffer(length); - const actual = buf.write(string, encoding); - if (actual !== length) // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual); - return buf; -} -function fromArrayLike(array) { - const length = array.length < 0 ? 0 : checked(array.length) | 0; - const buf = createBuffer(length); - for(let i = 0; i < length; i += 1)buf[i] = array[i] & 255; - return buf; -} -function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - const copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); -} -function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); - let buf; - if (byteOffset === undefined && length === undefined) buf = new Uint8Array(array); - else if (length === undefined) buf = new Uint8Array(array, byteOffset); - else buf = new Uint8Array(array, byteOffset, length); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; -} -function fromObject(obj) { - if (Buffer.isBuffer(obj)) { - const len = checked(obj.length) | 0; - const buf = createBuffer(len); - if (buf.length === 0) return buf; - obj.copy(buf, 0, 0, len); - return buf; - } - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) return createBuffer(0); - return fromArrayLike(obj); - } - if (obj.type === 'Buffer' && Array.isArray(obj.data)) return fromArrayLike(obj.data); -} -function checked(length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + ' bytes'); - return length | 0; -} -function SlowBuffer(length) { - if (+length != length) length = 0; - return Buffer.alloc(+length); -} -Buffer.isBuffer = function isBuffer(b) { - return b != null && b._isBuffer === true && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false - ; -}; -Buffer.compare = function compare(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - if (a === b) return 0; - let x = a.length; - let y = b.length; - for(let i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; + } + function formatUnixTimestampSeconds(d) { + return Math.floor(+d / 1e3); + } + var locale$1; + var timeFormat$1; + var timeParse$1; + var utcFormat$1; + var utcParse$1; + defaultLocale$1({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + }); + function defaultLocale$1(definition2) { + locale$1 = formatLocale(definition2); + timeFormat$1 = locale$1.format; + timeParse$1 = locale$1.parse; + utcFormat$1 = locale$1.utcFormat; + utcParse$1 = locale$1.utcParse; + return locale$1; + } + function memoize(method2) { + const cache2 = {}; + return (spec) => cache2[spec] || (cache2[spec] = method2(spec)); + } + function trimZeroes(numberFormat, decimalChar) { + return (x2) => { + const str = numberFormat(x2), dec = str.indexOf(decimalChar); + if (dec < 0) return str; + let idx = rightmostDigit(str, dec); + const end = idx < str.length ? str.slice(idx) : ""; + while (--idx > dec) if (str[idx] !== "0") { + ++idx; break; + } + return str.slice(0, idx) + end; + }; + } + function rightmostDigit(str, dec) { + let i = str.lastIndexOf("e"), c2; + if (i > 0) return i; + for (i = str.length; --i > dec; ) { + c2 = str.charCodeAt(i); + if (c2 >= 48 && c2 <= 57) return i + 1; } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -Buffer.isEncoding = function isEncoding(encoding) { - switch(String(encoding).toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true; - default: - return false; - } -}; -Buffer.concat = function concat(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); - if (list.length === 0) return Buffer.alloc(0); - let i; - if (length === undefined) { - length = 0; - for(i = 0; i < list.length; ++i)length += list[i].length; - } - const buffer = Buffer.allocUnsafe(length); - let pos = 0; - for(i = 0; i < list.length; ++i){ - let buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) { - if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf); - buf.copy(buffer, pos); - } else Uint8Array.prototype.set.call(buffer, buf, pos); - } else if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers'); - else buf.copy(buffer, pos); - pos += buf.length; - } - return buffer; -}; -function byteLength(string, encoding) { - if (Buffer.isBuffer(string)) return string.length; - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if (typeof string !== 'string') throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - const len = string.length; - const mustMatch = arguments.length > 2 && arguments[2] === true; - if (!mustMatch && len === 0) return 0; - // Use a for loop to avoid recursion - let loweredCase = false; - for(;;)switch(encoding){ - case 'ascii': - case 'latin1': - case 'binary': - return len; - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2; - case 'hex': - return len >>> 1; - case 'base64': - return base64ToBytes(string).length; - default: - if (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - ; - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } -} -Buffer.byteLength = byteLength; -function slowToString(encoding, start, end) { - let loweredCase = false; - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) start = 0; - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) return ''; - if (end === undefined || end > this.length) end = this.length; - if (end <= 0) return ''; - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0; - start >>>= 0; - if (end <= start) return ''; - if (!encoding) encoding = 'utf8'; - while(true)switch(encoding){ - case 'hex': - return hexSlice(this, start, end); - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end); - case 'ascii': - return asciiSlice(this, start, end); - case 'latin1': - case 'binary': - return latin1Slice(this, start, end); - case 'base64': - return base64Slice(this, start, end); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = (encoding + '').toLowerCase(); - loweredCase = true; - } -} -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true; -function swap(b, n, m) { - const i = b[n]; - b[n] = b[m]; - b[m] = i; -} -Buffer.prototype.swap16 = function swap16() { - const len = this.length; - if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits'); - for(let i = 0; i < len; i += 2)swap(this, i, i + 1); - return this; -}; -Buffer.prototype.swap32 = function swap32() { - const len = this.length; - if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits'); - for(let i = 0; i < len; i += 4){ - swap(this, i, i + 3); - swap(this, i + 1, i + 2); + } + function numberLocale(locale2) { + const format2 = memoize(locale2.format), formatPrefix2 = locale2.formatPrefix; + return { + format: format2, + formatPrefix: formatPrefix2, + formatFloat(spec) { + const s = formatSpecifier(spec || ","); + if (s.precision == null) { + s.precision = 12; + switch (s.type) { + case "%": + s.precision -= 2; + break; + case "e": + s.precision -= 1; + break; + } + return trimZeroes( + format2(s), + // number format + format2(".1f")(1)[1] + // decimal point character + ); + } else { + return format2(s); + } + }, + formatSpan(start, stop2, count2, specifier) { + specifier = formatSpecifier(specifier == null ? ",f" : specifier); + const step = tickStep(start, stop2, count2), value2 = Math.max(Math.abs(start), Math.abs(stop2)); + let precision; + if (specifier.precision == null) { + switch (specifier.type) { + case "s": { + if (!isNaN(precision = precisionPrefix(step, value2))) { + specifier.precision = precision; + } + return formatPrefix2(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (!isNaN(precision = precisionRound(step, value2))) { + specifier.precision = precision - (specifier.type === "e"); + } + break; + } + case "f": + case "%": { + if (!isNaN(precision = precisionFixed(step))) { + specifier.precision = precision - (specifier.type === "%") * 2; + } + break; + } + } + } + return format2(specifier); + } + }; + } + let defaultNumberLocale; + resetNumberFormatDefaultLocale(); + function resetNumberFormatDefaultLocale() { + return defaultNumberLocale = numberLocale({ + format: format$3, + formatPrefix + }); + } + function numberFormatLocale(definition2) { + return numberLocale(formatLocale$1(definition2)); + } + function numberFormatDefaultLocale(definition2) { + return arguments.length ? defaultNumberLocale = numberFormatLocale(definition2) : defaultNumberLocale; + } + function timeMultiFormat(format2, interval2, spec) { + spec = spec || {}; + if (!isObject$1(spec)) { + error(`Invalid time multi-format specifier: ${spec}`); } - return this; -}; -Buffer.prototype.swap64 = function swap64() { - const len = this.length; - if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits'); - for(let i = 0; i < len; i += 8){ - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); + const second2 = interval2(SECONDS), minute = interval2(MINUTES), hour = interval2(HOURS), day = interval2(DATE), week2 = interval2(WEEK), month = interval2(MONTH), quarter2 = interval2(QUARTER), year = interval2(YEAR), L = format2(spec[MILLISECONDS] || ".%L"), S = format2(spec[SECONDS] || ":%S"), M2 = format2(spec[MINUTES] || "%I:%M"), H = format2(spec[HOURS] || "%I %p"), d = format2(spec[DATE] || spec[DAY] || "%a %d"), w2 = format2(spec[WEEK] || "%b %d"), m2 = format2(spec[MONTH] || "%B"), q = format2(spec[QUARTER] || "%B"), y2 = format2(spec[YEAR] || "%Y"); + return (date2) => (second2(date2) < date2 ? L : minute(date2) < date2 ? S : hour(date2) < date2 ? M2 : day(date2) < date2 ? H : month(date2) < date2 ? week2(date2) < date2 ? d : w2 : year(date2) < date2 ? quarter2(date2) < date2 ? m2 : q : y2)(date2); + } + function timeLocale(locale2) { + const timeFormat2 = memoize(locale2.format), utcFormat2 = memoize(locale2.utcFormat); + return { + timeFormat: (spec) => isString(spec) ? timeFormat2(spec) : timeMultiFormat(timeFormat2, timeInterval, spec), + utcFormat: (spec) => isString(spec) ? utcFormat2(spec) : timeMultiFormat(utcFormat2, utcInterval, spec), + timeParse: memoize(locale2.parse), + utcParse: memoize(locale2.utcParse) + }; + } + let defaultTimeLocale; + resetTimeFormatDefaultLocale(); + function resetTimeFormatDefaultLocale() { + return defaultTimeLocale = timeLocale({ + format: timeFormat$1, + parse: timeParse$1, + utcFormat: utcFormat$1, + utcParse: utcParse$1 + }); + } + function timeFormatLocale(definition2) { + return timeLocale(formatLocale(definition2)); + } + function timeFormatDefaultLocale(definition2) { + return arguments.length ? defaultTimeLocale = timeFormatLocale(definition2) : defaultTimeLocale; + } + const createLocale = (number2, time2) => extend$1({}, number2, time2); + function locale(numberSpec, timeSpec) { + const number2 = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale(); + const time2 = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale(); + return createLocale(number2, time2); + } + function defaultLocale(numberSpec, timeSpec) { + const args = arguments.length; + if (args && args !== 2) { + error("defaultLocale expects either zero or two arguments."); } - return this; -}; -Buffer.prototype.toString = function toString() { - const length = this.length; - if (length === 0) return ''; - if (arguments.length === 0) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); -}; -Buffer.prototype.toLocaleString = Buffer.prototype.toString; -Buffer.prototype.equals = function equals(b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); - if (this === b) return true; - return Buffer.compare(this, b) === 0; -}; -Buffer.prototype.inspect = function inspect() { - let str = ''; - const max = exports.INSPECT_MAX_BYTES; - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); - if (this.length > max) str += ' ... '; - return '<Buffer ' + str + '>'; -}; -if (customInspectSymbol) Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; -Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) target = Buffer.from(target, target.offset, target.byteLength); - if (!Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (start === undefined) start = 0; - if (end === undefined) end = target ? target.length : 0; - if (thisStart === undefined) thisStart = 0; - if (thisEnd === undefined) thisEnd = this.length; - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError('out of range index'); - if (thisStart >= thisEnd && start >= end) return 0; - if (thisStart >= thisEnd) return -1; - if (start >= end) return 1; - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - let x = thisEnd - thisStart; - let y = end - start; - const len = Math.min(x, y); - const thisCopy = this.slice(thisStart, thisEnd); - const targetCopy = target.slice(start, end); - for(let i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; + return args ? createLocale(numberFormatDefaultLocale(numberSpec), timeFormatDefaultLocale(timeSpec)) : createLocale(numberFormatDefaultLocale(), timeFormatDefaultLocale()); + } + function resetDefaultLocale() { + resetNumberFormatDefaultLocale(); + resetTimeFormatDefaultLocale(); + return defaultLocale(); + } + const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; + const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; + const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; + const fileProtocol = "file://"; + function loaderFactory(fs) { + return (options) => ({ + options: options || {}, + sanitize, + load: load$1, + fileAccess: false, + file: fileLoader(), + http: httpLoader + }); + } + async function load$1(uri, options) { + const opt = await this.sanitize(uri, options), url = opt.href; + return opt.localFile ? this.file(url) : this.http(url, options?.http); + } + async function sanitize(uri, options) { + options = extend$1({}, this.options, options); + const fileAccess = this.fileAccess, result = { + href: null + }; + let isFile, loadFile, base2; + const isAllowed = allowed_re.test(uri.replace(whitespace_re, "")); + if (uri == null || typeof uri !== "string" || !isAllowed) { + error("Sanitize failure, invalid URI: " + $(uri)); } - if (x < y) return -1; - if (y < x) return 1; - return 0; -}; -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1; - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff; - else if (byteOffset < -2147483648) byteOffset = -2147483648; - byteOffset = +byteOffset // Coerce to Number. - ; - if (numberIsNaN(byteOffset)) // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : buffer.length - 1; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - else byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (dir) byteOffset = 0; - else return -1; - } - // Normalize val - if (typeof val === 'string') val = Buffer.from(val, encoding); - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) return -1; - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - ; - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - else return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - return arrayIndexOf(buffer, [ - val - ], byteOffset, encoding, dir); - } - throw new TypeError('val must be string, number or Buffer'); -} -function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - let indexSize = 1; - let arrLength = arr.length; - let valLength = val.length; - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase(); - if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) return -1; - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i) { - if (indexSize === 1) return buf[i]; - else return buf.readUInt16BE(i * indexSize); - } - let i; - if (dir) { - let foundIndex = -1; - for(i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (foundIndex !== -1) i -= i - foundIndex; - foundIndex = -1; - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for(i = byteOffset; i >= 0; i--){ - let found = true; - for(let j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - if (found) return i; - } + const hasProtocol = protocol_re.test(uri); + if ((base2 = options.baseURL) && !hasProtocol) { + if (!uri.startsWith("/") && !base2.endsWith("/")) { + uri = "/" + uri; + } + uri = base2 + uri; + } + loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === "file" || options.mode !== "http" && !hasProtocol && fileAccess; + if (isFile) { + uri = uri.slice(fileProtocol.length); + } else if (uri.startsWith("//")) { + if (options.defaultProtocol === "file") { + uri = uri.slice(2); + loadFile = true; + } else { + uri = (options.defaultProtocol || "http") + ":" + uri; + } } - return -1; -} -Buffer.prototype.includes = function includes(val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1; -}; -Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); -}; -Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); -}; -function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - const remaining = buf.length - offset; - if (!length) length = remaining; - else { - length = Number(length); - if (length > remaining) length = remaining; + Object.defineProperty(result, "localFile", { + value: !!loadFile + }); + result.href = uri; + if (options.target) { + result.target = options.target + ""; } - const strLen = string.length; - if (length > strLen / 2) length = strLen / 2; - let i; - for(i = 0; i < length; ++i){ - const parsed = parseInt(string.substr(i * 2, 2), 16); - if (numberIsNaN(parsed)) return i; - buf[offset + i] = parsed; + if (options.rel) { + result.rel = options.rel + ""; } - return i; -} -function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); -} -function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); -} -function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); -} -function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); -} -Buffer.prototype.write = function write(string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8'; - length = this.length; - offset = 0; - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset; - length = this.length; - offset = 0; - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0; - if (isFinite(length)) { - length = length >>> 0; - if (encoding === undefined) encoding = 'utf8'; - } else { - encoding = length; - length = undefined; - } - } else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); - const remaining = this.length - offset; - if (length === undefined || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError('Attempt to write outside buffer bounds'); - if (!encoding) encoding = 'utf8'; - let loweredCase = false; - for(;;)switch(encoding){ - case 'hex': - return hexWrite(this, string, offset, length); - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length); - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; + if (options.context === "image" && options.crossOrigin) { + result.crossOrigin = options.crossOrigin + ""; } -}; -Buffer.prototype.toJSON = function toJSON() { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - }; -}; -function base64Slice(buf, start, end) { - if (start === 0 && end === buf.length) return base64.fromByteArray(buf); - else return base64.fromByteArray(buf.slice(start, end)); -} -function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - const res = []; - let i = start; - while(i < end){ - const firstByte = buf[i]; - let codePoint = null; - let bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; - if (i + bytesPerSequence <= end) { - let secondByte, thirdByte, fourthByte, tempCodePoint; - switch(bytesPerSequence){ - case 1: - if (firstByte < 0x80) codePoint = firstByte; - break; - case 2: - secondByte = buf[i + 1]; - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; - if (tempCodePoint > 0x7F) codePoint = tempCodePoint; - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) codePoint = tempCodePoint; - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) codePoint = tempCodePoint; - } - } + return result; + } + function fileLoader(fs) { + return fileReject; + } + async function fileReject() { + error("No file system access."); + } + async function httpLoader(url, options) { + const opt = extend$1({}, this.options.http, options), type2 = options && options.response, response = await fetch(url, opt); + return !response.ok ? error(response.status + "" + response.statusText) : isFunction(response[type2]) ? response[type2]() : response.text(); + } + const isValid = (_) => _ != null && _ === _; + const isBoolean = (_) => _ === "true" || _ === "false" || _ === true || _ === false; + const isDate = (_) => !Number.isNaN(Date.parse(_)); + const isNumber = (_) => !Number.isNaN(+_) && !(_ instanceof Date); + const isInteger = (_) => isNumber(_) && Number.isInteger(+_); + const typeParsers = { + boolean: toBoolean, + integer: toNumber, + number: toNumber, + date: toDate, + string: toString, + unknown: identity$7 + }; + const typeTests = [isBoolean, isInteger, isNumber, isDate]; + const typeList = ["boolean", "integer", "number", "date"]; + function inferType(values2, field2) { + if (!values2 || !values2.length) return "unknown"; + const n = values2.length, m2 = typeTests.length, a2 = typeTests.map((_, i) => i + 1); + for (let i = 0, t = 0, j, value2; i < n; ++i) { + value2 = field2 ? values2[i][field2] : values2[i]; + for (j = 0; j < m2; ++j) { + if (a2[j] && isValid(value2) && !typeTests[j](value2)) { + a2[j] = 0; + ++t; + if (t === typeTests.length) return "string"; } - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD; - bytesPerSequence = 1; - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000; - res.push(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | codePoint & 0x3FF; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); -} -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -const MAX_ARGUMENTS_LENGTH = 0x1000; -function decodeCodePointsArray(codePoints) { - const len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - ; - // Decode in chunks to avoid "call stack size exceeded". - let res = ''; - let i = 0; - while(i < len)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - return res; -} -function asciiSlice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i] & 0x7F); - return ret; -} -function latin1Slice(buf, start, end) { - let ret = ''; - end = Math.min(buf.length, end); - for(let i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); - return ret; -} -function hexSlice(buf, start, end) { - const len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - let out = ''; - for(let i = start; i < end; ++i)out += hexSliceLookupTable[buf[i]]; - return out; -} -function utf16leSlice(buf, start, end) { - const bytes = buf.slice(start, end); - let res = ''; - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for(let i = 0; i < bytes.length - 1; i += 2)res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); - return res; -} -Buffer.prototype.slice = function slice(start, end) { - const len = this.length; - start = ~~start; - end = end === undefined ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) start = len; - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) end = len; - if (end < start) end = start; - const newBuf = this.subarray(start, end); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype); - return newBuf; -}; -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); -} -Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - return val; -}; -Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset + --byteLength]; - let mul = 1; - while(byteLength > 0 && (mul *= 0x100))val += this[offset + --byteLength] * mul; - return val; -}; -Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; -}; -Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; -}; -Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; -}; -Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; -}; -Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); -}; -Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const lo = first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24; - const hi = this[++offset] + this[++offset] * 256 + this[++offset] * 2 ** 16 + last * 2 ** 24; - return BigInt(lo) + (BigInt(hi) << BigInt(32)); -}); -Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last; - return (BigInt(hi) << BigInt(32)) + BigInt(lo); -}); -Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let val = this[offset]; - let mul = 1; - let i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - let i = byteLength; - let mul = 1; - let val = this[offset + --i]; - while(i > 0 && (mul *= 0x100))val += this[offset + --i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; -}; -Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(this[offset] & 0x80)) return this[offset]; - return (0xff - this[offset] + 1) * -1; -}; -Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset] | this[offset + 1] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 2, this.length); - const val = this[offset + 1] | this[offset] << 8; - return val & 0x8000 ? val | 0xFFFF0000 : val; -}; -Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; -}; -Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; -}; -Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = this[offset + 4] + this[offset + 5] * 256 + this[offset + 6] * 2 ** 16 + (last << 24 // Overflow - ); - return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 256 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24); -}); -Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) { - offset = offset >>> 0; - validateNumber(offset, 'offset'); - const first = this[offset]; - const last = this[offset + 7]; - if (first === undefined || last === undefined) boundsError(offset, this.length - 8); - const val = (first << 24) + // Overflow - this[++offset] * 2 ** 16 + this[++offset] * 256 + this[++offset]; - return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 256 + last); -}); -Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); -}; -Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); -}; -Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); -}; -Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { - offset = offset >>> 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); -}; -function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError('Index out of range'); -} -Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let mul = 1; - let i = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - byteLength = byteLength >>> 0; - if (!noAssert) { - const maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - let i = byteLength - 1; - let mul = 1; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; -}; -Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -function wrtBigUInt64LE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - lo = lo >> 8; - buf[offset++] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - hi = hi >> 8; - buf[offset++] = hi; - return offset; -} -function wrtBigUInt64BE(buf, value, offset, min, max) { - checkIntBI(value, min, max, buf, offset, 7); - let lo = Number(value & BigInt(0xffffffff)); - buf[offset + 7] = lo; - lo = lo >> 8; - buf[offset + 6] = lo; - lo = lo >> 8; - buf[offset + 5] = lo; - lo = lo >> 8; - buf[offset + 4] = lo; - let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)); - buf[offset + 3] = hi; - hi = hi >> 8; - buf[offset + 2] = hi; - hi = hi >> 8; - buf[offset + 1] = hi; - hi = hi >> 8; - buf[offset] = hi; - return offset + 8; -} -Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')); -}); -Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); + } } - let i = 0; - let mul = 1; - let sub = 0; - this[offset] = value & 0xFF; - while(++i < byteLength && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) { - const limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - let i = byteLength - 1; - let mul = 1; - let sub = 0; - this[offset + i] = value & 0xFF; - while(--i >= 0 && (mul *= 0x100)){ - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; -}; -Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128); - if (value < 0) value = 0xff + value + 1; - this[offset] = value & 0xff; - return offset + 1; -}; -Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - return offset + 2; -}; -Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value >>> 8; - this[offset + 1] = value & 0xff; - return offset + 2; -}; -Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - this[offset] = value & 0xff; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; -}; -Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - if (value < 0) value = 0xffffffff + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = value & 0xff; - return offset + 4; -}; -Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) { - return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) { - return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')); -}); -function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); -} -function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; -} -Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); -}; -function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset = offset >>> 0; - if (!noAssert) checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; -} -Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); -}; -Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); -}; -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); - if (!start) start = 0; - if (!end && end !== 0) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - // Copy 0 bytes; we're done - if (end === start) return 0; - if (target.length === 0 || this.length === 0) return 0; - // Fatal error conditions - if (targetStart < 0) throw new RangeError('targetStart out of bounds'); - if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); - if (end < 0) throw new RangeError('sourceEnd out of bounds'); - // Are we oob? - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) end = target.length - targetStart + start; - const len = end - start; - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end); - else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); - return len; -}; -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill(val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start; - start = 0; - end = this.length; - } else if (typeof end === 'string') { - encoding = end; - end = this.length; - } - if (encoding !== undefined && typeof encoding !== 'string') throw new TypeError('encoding must be a string'); - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - if (val.length === 1) { - const code = val.charCodeAt(0); - if (encoding === 'utf8' && code < 128 || encoding === 'latin1') // Fast path: If `val` fits into a single byte, use that numeric value. - val = code; - } - } else if (typeof val === 'number') val = val & 255; - else if (typeof val === 'boolean') val = Number(val); - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) throw new RangeError('Out of range index'); - if (end <= start) return this; - start = start >>> 0; - end = end === undefined ? this.length : end >>> 0; - if (!val) val = 0; - let i; - if (typeof val === 'number') for(i = start; i < end; ++i)this[i] = val; - else { - const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding); - const len = bytes.length; - if (len === 0) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; + return typeList[a2.reduce((u2, v) => u2 === 0 ? v : u2, 0) - 1]; + } + function inferTypes(data2, fields) { + return fields.reduce((types, field2) => { + types[field2] = inferType(data2, field2); + return types; + }, {}); + } + function delimitedFormat(delimiter) { + const parse2 = function(data2, format2) { + const delim = { + delimiter + }; + return dsv(data2, format2 ? extend$1(format2, delim) : delim); + }; + parse2.responseType = "text"; + return parse2; + } + function dsv(data2, format2) { + if (format2.header) { + data2 = format2.header.map($).join(format2.delimiter) + "\n" + data2; } - return this; -}; -// CUSTOM ERRORS -// ============= -// Simplified versions from Node, changed for Buffer-only usage -const errors = {}; -function E(sym, getMessage, Base) { - errors[sym] = class NodeError extends Base { - constructor(){ - super(); - Object.defineProperty(this, 'message', { - value: getMessage.apply(this, arguments), - writable: true, - configurable: true - }); - // Add the error code to the name to include it in the stack trace. - this.name = `${this.name} [${sym}]`; - // Access the stack to generate the error message including the error code - // from the name. - this.stack // eslint-disable-line no-unused-expressions - ; - // Reset the name to the actual name. - delete this.name; - } - get code() { - return sym; - } - set code(value) { - Object.defineProperty(this, 'code', { - configurable: true, - enumerable: true, - value, - writable: true - }); - } - toString() { - return `${this.name} [${sym}]: ${this.message}`; - } - }; -} -E('ERR_BUFFER_OUT_OF_BOUNDS', function(name) { - if (name) return `${name} is outside of buffer bounds`; - return 'Attempt to access memory outside buffer bounds'; -}, RangeError); -E('ERR_INVALID_ARG_TYPE', function(name, actual) { - return `The "${name}" argument must be of type number. Received type ${typeof actual}`; -}, TypeError); -E('ERR_OUT_OF_RANGE', function(str, range, input) { - let msg = `The value of "${str}" is out of range.`; - let received = input; - if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) received = addNumericalSeparator(String(input)); - else if (typeof input === 'bigint') { - received = String(input); - if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) received = addNumericalSeparator(received); - received += 'n'; - } - msg += ` It must be ${range}. Received ${received}`; - return msg; -}, RangeError); -function addNumericalSeparator(val) { - let res = ''; - let i = val.length; - const start = val[0] === '-' ? 1 : 0; - for(; i >= start + 4; i -= 3)res = `_${val.slice(i - 3, i)}${res}`; - return `${val.slice(0, i)}${res}`; -} -// CHECK FUNCTIONS -// =============== -function checkBounds(buf, offset, byteLength) { - validateNumber(offset, 'offset'); - if (buf[offset] === undefined || buf[offset + byteLength] === undefined) boundsError(offset, buf.length - (byteLength + 1)); -} -function checkIntBI(value, min, max, buf, offset, byteLength) { - if (value > max || value < min) { - const n = typeof min === 'bigint' ? 'n' : ''; - let range; - if (byteLength > 3) { - if (min === 0 || min === BigInt(0)) range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`; - else range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}`; - } else range = `>= ${min}${n} and <= ${max}${n}`; - throw new errors.ERR_OUT_OF_RANGE('value', range, value); - } - checkBounds(buf, offset, byteLength); -} -function validateNumber(value, name) { - if (typeof value !== 'number') throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value); -} -function boundsError(value, length, type) { - if (Math.floor(value) !== value) { - validateNumber(value, type); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value); - } - if (length < 0) throw new errors.ERR_BUFFER_OUT_OF_BOUNDS(); - throw new errors.ERR_OUT_OF_RANGE(type || 'offset', `>= ${type ? 1 : 0} and <= ${length}`, value); -} -// HELPER FUNCTIONS -// ================ -const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; -function base64clean(str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0]; - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, ''); - // Node converts strings with length < 2 to '' - if (str.length < 2) return ''; - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while(str.length % 4 !== 0)str = str + '='; - return str; -} -function utf8ToBytes(string, units) { - units = units || Infinity; - let codePoint; - const length = string.length; - let leadSurrogate = null; - const bytes = []; - for(let i = 0; i < length; ++i){ - codePoint = string.charCodeAt(i); - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - // valid lead - leadSurrogate = codePoint; - continue; - } - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - leadSurrogate = codePoint; - continue; - } - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; - } else if (leadSurrogate) // valid bmp char, but last char was a lead - { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - } - leadSurrogate = null; - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break; - bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break; - bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break; - bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); - } else throw new Error('Invalid code point'); - } - return bytes; -} -function asciiToBytes(str) { - const byteArray = []; - for(let i = 0; i < str.length; ++i)// Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF); - return byteArray; -} -function utf16leToBytes(str, units) { - let c, hi, lo; - const byteArray = []; - for(let i = 0; i < str.length; ++i){ - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; -} -function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); -} -function blitBuffer(src, dst, offset, length) { - let i; - for(i = 0; i < length; ++i){ - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; + return dsvFormat(format2.delimiter).parse(data2 + ""); + } + dsv.responseType = "text"; + function isBuffer(_) { + return typeof Buffer === "function" && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false; + } + function json(data2, format2) { + const prop = format2 && format2.property ? field$1(format2.property) : identity$7; + return isObject$1(data2) && !isBuffer(data2) ? parseJSON(prop(data2), format2) : prop(JSON.parse(data2)); + } + json.responseType = "json"; + function parseJSON(data2, format2) { + if (!isArray(data2) && isIterable(data2)) { + data2 = [...data2]; } - return i; -} -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance(obj, type) { - return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; -} -function numberIsNaN(obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare - ; -} -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -const hexSliceLookupTable = function() { - const alphabet = '0123456789abcdef'; - const table = new Array(256); - for(let i = 0; i < 16; ++i){ - const i16 = i * 16; - for(let j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; - } - return table; -}(); -// Return not function with Error if BigInt not supported -function defineBigIntMethod(fn) { - return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn; -} -function BufferBigIntNotDefined() { - throw new Error('BigInt not supported'); -} - -},{"9c62938f1dccc73c":"yVC7r","aceacb6a4531a9d2":"6kJAR"}],"yVC7r":[function(require,module,exports,__globalThis) { -'use strict'; -exports.byteLength = byteLength; -exports.toByteArray = toByteArray; -exports.fromByteArray = fromByteArray; -var lookup = []; -var revLookup = []; -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -for(var i = 0, len = code.length; i < len; ++i){ - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; -} -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62; -revLookup['_'.charCodeAt(0)] = 63; -function getLens(b64) { - var len = b64.length; - if (len % 4 > 0) throw new Error('Invalid string. Length must be a multiple of 4'); - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('='); - if (validLen === -1) validLen = len; - var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; - return [ - validLen, - placeHoldersLen - ]; -} -// base64 is 4/3 + up to two characters of the original data -function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; -} -function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i; - for(i = 0; i < len; i += 4){ - tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[curByte++] = tmp >> 16 & 0xFF; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[curByte++] = tmp & 0xFF; - } - if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = tmp & 0xFF; - } - return arr; -} -function tripletToBase64(num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; -} -function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for(var i = start; i < end; i += 3){ - tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); - output.push(tripletToBase64(tmp)); - } - return output.join(''); -} -function fromByteArray(uint8) { - var tmp; - var len = uint8.length; - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - ; - var parts = []; - var maxChunkLength = 16383 // must be multiple of 3 - ; - // go through the array every three bytes, we'll deal with trailing stuff later - for(var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1]; - parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); - } - return parts.join(''); -} - -},{}],"6kJAR":[function(require,module,exports,__globalThis) { -/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ exports.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for(; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for(; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - if (e === 0) e = 1 - eBias; - else if (e === eMax) return m ? NaN : (s ? -1 : 1) * Infinity; - else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; -exports.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = nBytes * 8 - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; + return format2 && format2.copy ? JSON.parse(JSON.stringify(data2)) : data2; + } + const filters = { + interior: (a2, b2) => a2 !== b2, + exterior: (a2, b2) => a2 === b2 + }; + function topojson(data2, format2) { + let method2, object2, property2, filter2; + data2 = json(data2, format2); + if (format2 && format2.feature) { + method2 = feature; + property2 = format2.feature; + } else if (format2 && format2.mesh) { + method2 = mesh; + property2 = format2.mesh; + filter2 = filters[format2.filter]; + } else { + error("Missing TopoJSON feature or mesh parameter."); + } + object2 = (object2 = data2.objects[property2]) ? method2(data2, object2, filter2) : error("Invalid TopoJSON object: " + property2); + return object2 && object2.features || [object2]; + } + topojson.responseType = "json"; + const format$2 = { + dsv, + csv: delimitedFormat(","), + tsv: delimitedFormat(" "), + json, + topojson + }; + function formats$1(name, reader) { + if (arguments.length > 1) { + format$2[name] = reader; + return this; } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) value += rt / c; - else value += rt * Math.pow(2, 1 - eBias); - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; + return has$1(format$2, name) ? format$2[name] : null; + } + } + function responseType(type2) { + const f = formats$1(type2); + return f && f.responseType || "text"; + } + function read(data2, schema, timeParser, utcParser) { + schema = schema || {}; + const reader = formats$1(schema.type || "json"); + if (!reader) error("Unknown data format type: " + schema.type); + data2 = reader(data2, schema); + if (schema.parse) parse$6(data2, schema.parse, timeParser, utcParser); + if (has$1(data2, "columns")) delete data2.columns; + return data2; + } + function parse$6(data2, types, timeParser, utcParser) { + if (!data2.length) return; + const locale2 = timeFormatDefaultLocale(); + timeParser = timeParser || locale2.timeParse; + utcParser = utcParser || locale2.utcParse; + let fields = data2.columns || Object.keys(data2[0]), datum2, field2, i, j, n, m2; + if (types === "auto") types = inferTypes(data2, fields); + fields = Object.keys(types); + const parsers = fields.map((field3) => { + const type2 = types[field3]; + let parts, pattern; + if (type2 && (type2.startsWith("date:") || type2.startsWith("utc:"))) { + parts = type2.split(/:(.+)?/, 2); + pattern = parts[1]; + if (pattern[0] === "'" && pattern[pattern.length - 1] === "'" || pattern[0] === '"' && pattern[pattern.length - 1] === '"') { + pattern = pattern.slice(1, -1); + } + const parse2 = parts[0] === "utc" ? utcParser : timeParser; + return parse2(pattern); + } + if (!typeParsers[type2]) { + throw Error("Illegal format pattern: " + field3 + ":" + type2); + } + return typeParsers[type2]; + }); + for (i = 0, n = data2.length, m2 = fields.length; i < n; ++i) { + datum2 = data2[i]; + for (j = 0; j < m2; ++j) { + field2 = fields[j]; + datum2[field2] = parsers[j](datum2[field2]); + } + } + } + const loader = loaderFactory(); + function UniqueList(idFunc) { + const $2 = idFunc || identity$7, list = [], ids = {}; + list.add = (_) => { + const id2 = $2(_); + if (!ids[id2]) { + ids[id2] = 1; + list.push(_); + } + return list; + }; + list.remove = (_) => { + const id2 = $2(_); + if (ids[id2]) { + ids[id2] = 0; + const idx = list.indexOf(_); + if (idx >= 0) list.splice(idx, 1); + } + return list; + }; + return list; + } + async function asyncCallback(df, callback) { + try { + await callback(df); + } catch (err) { + df.error(err); + } + } + const TUPLE_ID_KEY = Symbol("vega_id"); + let TUPLE_ID = 1; + function isTuple(t) { + return !!(t && tupleid(t)); + } + function tupleid(t) { + return t[TUPLE_ID_KEY]; + } + function setid(t, id2) { + t[TUPLE_ID_KEY] = id2; + return t; + } + function ingest$1(datum2) { + const t = datum2 === Object(datum2) ? datum2 : { + data: datum2 + }; + return tupleid(t) ? t : setid(t, TUPLE_ID++); + } + function derive(t) { + return rederive(t, ingest$1({})); + } + function rederive(t, d) { + for (const k in t) d[k] = t[k]; + return d; + } + function replace$1(t, d) { + return setid(d, tupleid(t)); + } + function stableCompare(cmp, f) { + return !cmp ? null : f ? (a2, b2) => cmp(a2, b2) || tupleid(f(a2)) - tupleid(f(b2)) : (a2, b2) => cmp(a2, b2) || tupleid(a2) - tupleid(b2); + } + function isChangeSet(v) { + return v && v.constructor === changeset; + } + function changeset() { + const add2 = [], rem2 = [], mod = [], remp = [], modp = []; + let clean = null, reflow2 = false; + return { + constructor: changeset, + insert(t) { + const d = array$5(t), n = d.length; + for (let i = 0; i < n; ++i) add2.push(d[i]); + return this; + }, + remove(t) { + const a2 = isFunction(t) ? remp : rem2, d = array$5(t), n = d.length; + for (let i = 0; i < n; ++i) a2.push(d[i]); + return this; + }, + modify(t, field2, value2) { + const m2 = { + field: field2, + value: constant$5(value2) + }; + if (isFunction(t)) { + m2.filter = t; + modp.push(m2); } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for(; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for(; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - buffer[offset + i - d] |= s * 128; -}; - -},{}],"gA9mK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "aggregate", ()=>Aggregate); -parcelHelpers.export(exports, "bin", ()=>Bin); -parcelHelpers.export(exports, "collect", ()=>Collect); -parcelHelpers.export(exports, "compare", ()=>Compare); -parcelHelpers.export(exports, "countpattern", ()=>CountPattern); -parcelHelpers.export(exports, "cross", ()=>Cross); -parcelHelpers.export(exports, "density", ()=>Density); -parcelHelpers.export(exports, "dotbin", ()=>DotBin); -parcelHelpers.export(exports, "expression", ()=>Expression); -parcelHelpers.export(exports, "extent", ()=>Extent); -parcelHelpers.export(exports, "facet", ()=>Facet); -parcelHelpers.export(exports, "field", ()=>Field); -parcelHelpers.export(exports, "filter", ()=>Filter); -parcelHelpers.export(exports, "flatten", ()=>Flatten); -parcelHelpers.export(exports, "fold", ()=>Fold); -parcelHelpers.export(exports, "formula", ()=>Formula); -parcelHelpers.export(exports, "generate", ()=>Generate); -parcelHelpers.export(exports, "impute", ()=>Impute); -parcelHelpers.export(exports, "joinaggregate", ()=>JoinAggregate); -parcelHelpers.export(exports, "kde", ()=>KDE); -parcelHelpers.export(exports, "key", ()=>Key); -parcelHelpers.export(exports, "load", ()=>Load); -parcelHelpers.export(exports, "lookup", ()=>Lookup); -parcelHelpers.export(exports, "multiextent", ()=>MultiExtent); -parcelHelpers.export(exports, "multivalues", ()=>MultiValues); -parcelHelpers.export(exports, "params", ()=>Params); -parcelHelpers.export(exports, "pivot", ()=>Pivot); -parcelHelpers.export(exports, "prefacet", ()=>PreFacet); -parcelHelpers.export(exports, "project", ()=>Project); -parcelHelpers.export(exports, "proxy", ()=>Proxy); -parcelHelpers.export(exports, "quantile", ()=>Quantile); -parcelHelpers.export(exports, "relay", ()=>Relay); -parcelHelpers.export(exports, "sample", ()=>Sample); -parcelHelpers.export(exports, "sequence", ()=>Sequence); -parcelHelpers.export(exports, "sieve", ()=>Sieve); -parcelHelpers.export(exports, "subflow", ()=>Subflow); -parcelHelpers.export(exports, "timeunit", ()=>TimeUnit); -parcelHelpers.export(exports, "tupleindex", ()=>TupleIndex); -parcelHelpers.export(exports, "values", ()=>Values); -parcelHelpers.export(exports, "window", ()=>Window); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaStatistics = require("vega-statistics"); -var _d3Array = require("d3-array"); -var _vegaTime = require("vega-time"); -function multikey(f) { - return (x)=>{ - const n = f.length; - let i = 1, k = String(f[0](x)); - for(; i < n; ++i)k += '|' + f[i](x); - return k; - }; -} -function groupkey(fields) { - return !fields || !fields.length ? function() { - return ''; - } : fields.length === 1 ? fields[0] : multikey(fields); -} -function measureName(op, field, as) { - return as || op + (!field ? '' : '_' + field); -} -const noop = ()=>{}; -const base_op = { - init: noop, - add: noop, - rem: noop, - idx: 0 -}; -const AggregateOps = { - values: { - init: (m)=>m.cell.store = true, - value: (m)=>m.cell.data.values(), - idx: -1 + m2.tuple = t; + mod.push(m2); + } + return this; + }, + encode(t, set2) { + if (isFunction(t)) modp.push({ + filter: t, + field: set2 + }); + else mod.push({ + tuple: t, + field: set2 + }); + return this; + }, + clean(value2) { + clean = value2; + return this; + }, + reflow() { + reflow2 = true; + return this; + }, + pulse(pulse2, tuples) { + const cur = {}, out = {}; + let i, n, m2, f, t, id2; + for (i = 0, n = tuples.length; i < n; ++i) { + cur[tupleid(tuples[i])] = 1; + } + for (i = 0, n = rem2.length; i < n; ++i) { + t = rem2[i]; + cur[tupleid(t)] = -1; + } + for (i = 0, n = remp.length; i < n; ++i) { + f = remp[i]; + tuples.forEach((t4) => { + if (f(t4)) cur[tupleid(t4)] = -1; + }); + } + for (i = 0, n = add2.length; i < n; ++i) { + t = add2[i]; + id2 = tupleid(t); + if (cur[id2]) { + cur[id2] = 1; + } else { + pulse2.add.push(ingest$1(add2[i])); + } + } + for (i = 0, n = tuples.length; i < n; ++i) { + t = tuples[i]; + if (cur[tupleid(t)] < 0) pulse2.rem.push(t); + } + function modify2(t4, f2, v) { + if (v) { + t4[f2] = v(t4); + } else { + pulse2.encode = f2; + } + if (!reflow2) out[tupleid(t4)] = t4; + } + for (i = 0, n = mod.length; i < n; ++i) { + m2 = mod[i]; + t = m2.tuple; + f = m2.field; + id2 = cur[tupleid(t)]; + if (id2 > 0) { + modify2(t, f, m2.value); + pulse2.modifies(f); + } + } + for (i = 0, n = modp.length; i < n; ++i) { + m2 = modp[i]; + f = m2.filter; + tuples.forEach((t4) => { + if (f(t4) && cur[tupleid(t4)] > 0) { + modify2(t4, m2.field, m2.value); + } + }); + pulse2.modifies(m2.field); + } + if (reflow2) { + pulse2.mod = rem2.length || remp.length ? tuples.filter((t4) => cur[tupleid(t4)] > 0) : tuples.slice(); + } else { + for (id2 in out) pulse2.mod.push(out[id2]); + } + if (clean || clean == null && (rem2.length || remp.length)) { + pulse2.clean(true); + } + return pulse2; + } + }; + } + const CACHE = "_:mod:_"; + function Parameters() { + Object.defineProperty(this, CACHE, { + writable: true, + value: {} + }); + } + Parameters.prototype = { + /** + * Set a parameter value. If the parameter value changes, the parameter + * will be recorded as modified. + * @param {string} name - The parameter name. + * @param {number} index - The index into an array-value parameter. Ignored if + * the argument is undefined, null or less than zero. + * @param {*} value - The parameter value to set. + * @param {boolean} [force=false] - If true, records the parameter as modified + * even if the value is unchanged. + * @return {Parameters} - This parameter object. + */ + set(name, index2, value2, force2) { + const o = this, v = o[name], mod = o[CACHE]; + if (index2 != null && index2 >= 0) { + if (v[index2] !== value2 || force2) { + v[index2] = value2; + mod[index2 + ":" + name] = -1; + mod[name] = -1; + } + } else if (v !== value2 || force2) { + o[name] = value2; + mod[name] = isArray(value2) ? 1 + value2.length : -1; + } + return o; }, - count: { - value: (m)=>m.cell.num + /** + * Tests if one or more parameters has been modified. If invoked with no + * arguments, returns true if any parameter value has changed. If the first + * argument is array, returns trues if any parameter name in the array has + * changed. Otherwise, tests if the given name and optional array index has + * changed. + * @param {string} name - The parameter name to test. + * @param {number} [index=undefined] - The parameter array index to test. + * @return {boolean} - Returns true if a queried parameter was modified. + */ + modified(name, index2) { + const mod = this[CACHE]; + if (!arguments.length) { + for (const k in mod) { + if (mod[k]) return true; + } + return false; + } else if (isArray(name)) { + for (let k = 0; k < name.length; ++k) { + if (mod[name[k]]) return true; + } + return false; + } + return index2 != null && index2 >= 0 ? index2 + 1 < mod[name] || !!mod[index2 + ":" + name] : !!mod[name]; }, - __count__: { - value: (m)=>m.missing + m.valid + /** + * Clears the modification records. After calling this method, + * all parameters are considered unmodified. + */ + clear() { + this[CACHE] = {}; + return this; + } + }; + let OP_ID = 0; + const PULSE = "pulse", NO_PARAMS = new Parameters(); + const SKIP$1$1 = 1, MODIFIED = 2; + function Operator(init2, update2, params2, react) { + this.id = ++OP_ID; + this.value = init2; + this.stamp = -1; + this.rank = -1; + this.qrank = -1; + this.flags = 0; + if (update2) { + this._update = update2; + } + if (params2) this.parameters(params2, react); + } + function flag(bit) { + return function(state) { + const f = this.flags; + if (arguments.length === 0) return !!(f & bit); + this.flags = state ? f | bit : f & ~bit; + return this; + }; + } + Operator.prototype = { + /** + * Returns a list of target operators dependent on this operator. + * If this list does not exist, it is created and then returned. + * @return {UniqueList} + */ + targets() { + return this._targets || (this._targets = UniqueList(id)); }, - missing: { - value: (m)=>m.missing + /** + * Sets the value of this operator. + * @param {*} value - the value to set. + * @return {Number} Returns 1 if the operator value has changed + * according to strict equality, returns 0 otherwise. + */ + set(value2) { + if (this.value !== value2) { + this.value = value2; + return 1; + } else { + return 0; + } }, - valid: { - value: (m)=>m.valid + /** + * Indicates that operator evaluation should be skipped on the next pulse. + * This operator will still propagate incoming pulses, but its update function + * will not be invoked. The skip flag is reset after every pulse, so calling + * this method will affect processing of the next pulse only. + */ + skip: flag(SKIP$1$1), + /** + * Indicates that this operator's value has been modified on its most recent + * pulse. Normally modification is checked via strict equality; however, in + * some cases it is more efficient to update the internal state of an object. + * In those cases, the modified flag can be used to trigger propagation. Once + * set, the modification flag persists across pulses until unset. The flag can + * be used with the last timestamp to test if a modification is recent. + */ + modified: flag(MODIFIED), + /** + * Sets the parameters for this operator. The parameter values are analyzed for + * operator instances. If found, this operator will be added as a dependency + * of the parameterizing operator. Operator values are dynamically marshalled + * from each operator parameter prior to evaluation. If a parameter value is + * an array, the array will also be searched for Operator instances. However, + * the search does not recurse into sub-arrays or object properties. + * @param {object} params - A hash of operator parameters. + * @param {boolean} [react=true] - A flag indicating if this operator should + * automatically update (react) when parameter values change. In other words, + * this flag determines if the operator registers itself as a listener on + * any upstream operators included in the parameters. + * @param {boolean} [initonly=false] - A flag indicating if this operator + * should calculate an update only upon its initial evaluation, then + * deregister dependencies and suppress all future update invocations. + * @return {Operator[]} - An array of upstream dependencies. + */ + parameters(params2, react, initonly) { + react = react !== false; + const argval = this._argval = this._argval || new Parameters(), argops = this._argops = this._argops || [], deps = []; + let name, value2, n, i; + const add2 = (name2, index2, value3) => { + if (value3 instanceof Operator) { + if (value3 !== this) { + if (react) value3.targets().add(this); + deps.push(value3); + } + argops.push({ + op: value3, + name: name2, + index: index2 + }); + } else { + argval.set(name2, index2, value3); + } + }; + for (name in params2) { + value2 = params2[name]; + if (name === PULSE) { + array$5(value2).forEach((op) => { + if (!(op instanceof Operator)) { + error("Pulse parameters must be operator instances."); + } else if (op !== this) { + op.targets().add(this); + deps.push(op); + } + }); + this.source = value2; + } else if (isArray(value2)) { + argval.set(name, -1, Array(n = value2.length)); + for (i = 0; i < n; ++i) add2(name, i, value2[i]); + } else { + add2(name, -1, value2); + } + } + this.marshall().clear(); + if (initonly) argops.initonly = true; + return deps; }, - sum: { - init: (m)=>m.sum = 0, - value: (m)=>m.valid ? m.sum : undefined, - add: (m, v)=>m.sum += +v, - rem: (m, v)=>m.sum -= v + /** + * Internal method for marshalling parameter values. + * Visits each operator dependency to pull the latest value. + * @return {Parameters} A Parameters object to pass to the update function. + */ + marshall(stamp) { + const argval = this._argval || NO_PARAMS, argops = this._argops; + let item, i, op, mod; + if (argops) { + const n = argops.length; + for (i = 0; i < n; ++i) { + item = argops[i]; + op = item.op; + mod = op.modified() && op.stamp === stamp; + argval.set(item.name, item.index, op.value, mod); + } + if (argops.initonly) { + for (i = 0; i < n; ++i) { + item = argops[i]; + item.op.targets().remove(this); + } + this._argops = null; + this._update = null; + } + } + return argval; }, - product: { - init: (m)=>m.product = 1, - value: (m)=>m.valid ? m.product : undefined, - add: (m, v)=>m.product *= v, - rem: (m, v)=>m.product /= v + /** + * Detach this operator from the dataflow. + * Unregisters listeners on upstream dependencies. + */ + detach() { + const argops = this._argops; + let i, n, item, op; + if (argops) { + for (i = 0, n = argops.length; i < n; ++i) { + item = argops[i]; + op = item.op; + if (op._targets) { + op._targets.remove(this); + } + } + } + this.pulse = null; + this.source = null; }, - mean: { - init: (m)=>m.mean = 0, - value: (m)=>m.valid ? m.mean : undefined, - add: (m, v)=>(m.mean_d = v - m.mean, m.mean += m.mean_d / m.valid), - rem: (m, v)=>(m.mean_d = v - m.mean, m.mean -= m.valid ? m.mean_d / m.valid : m.mean) + /** + * Delegate method to perform operator processing. + * Subclasses can override this method to perform custom processing. + * By default, it marshalls parameters and calls the update function + * if that function is defined. If the update function does not + * change the operator value then StopPropagation is returned. + * If no update function is defined, this method does nothing. + * @param {Pulse} pulse - the current dataflow pulse. + * @return The output pulse or StopPropagation. A falsy return value + * (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const update2 = this._update; + if (update2) { + const params2 = this.marshall(pulse2.stamp), v = update2.call(this, params2, pulse2); + params2.clear(); + if (v !== this.value) { + this.value = v; + } else if (!this.modified()) { + return pulse2.StopPropagation; + } + } }, - average: { - value: (m)=>m.valid ? m.mean : undefined, - req: [ - 'mean' - ], - idx: 1 + /** + * Run this operator for the current pulse. If this operator has already + * been run at (or after) the pulse timestamp, returns StopPropagation. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + rv = 0; + } else { + rv = this.evaluate(pulse2); + } + return this.pulse = rv || pulse2; + } + }; + function add$4(init2, update2, params2, react) { + let shift = 1, op; + if (init2 instanceof Operator) { + op = init2; + } else if (init2 && init2.prototype instanceof Operator) { + op = new init2(); + } else if (isFunction(init2)) { + op = new Operator(null, init2); + } else { + shift = 0; + op = new Operator(init2, update2); + } + this.rank(op); + if (shift) { + react = params2; + params2 = update2; + } + if (params2) this.connect(op, op.parameters(params2, react)); + this.touch(op); + return op; + } + function connect(target2, sources) { + const targetRank = target2.rank, n = sources.length; + for (let i = 0; i < n; ++i) { + if (targetRank < sources[i].rank) { + this.rerank(target2); + return; + } + } + } + let STREAM_ID = 0; + function EventStream(filter2, apply2, receive) { + this.id = ++STREAM_ID; + this.value = null; + if (receive) this.receive = receive; + if (filter2) this._filter = filter2; + if (apply2) this._apply = apply2; + } + function stream(filter2, apply2, receive) { + return new EventStream(filter2, apply2, receive); + } + EventStream.prototype = { + _filter: truthy, + _apply: identity$7, + targets() { + return this._targets || (this._targets = UniqueList(id)); + }, + consume(_) { + if (!arguments.length) return !!this._consume; + this._consume = !!_; + return this; + }, + receive(evt) { + if (this._filter(evt)) { + const val = this.value = this._apply(evt), trg = this._targets, n = trg ? trg.length : 0; + for (let i = 0; i < n; ++i) trg[i].receive(val); + if (this._consume) { + evt.preventDefault(); + evt.stopPropagation(); + } + } }, - variance: { - init: (m)=>m.dev = 0, - value: (m)=>m.valid > 1 ? m.dev / (m.valid - 1) : undefined, - add: (m, v)=>m.dev += m.mean_d * (v - m.mean), - rem: (m, v)=>m.dev -= m.mean_d * (v - m.mean), - req: [ - 'mean' - ], - idx: 1 + filter(filter2) { + const s = stream(filter2); + this.targets().add(s); + return s; + }, + apply(apply2) { + const s = stream(null, apply2); + this.targets().add(s); + return s; + }, + merge() { + const s = stream(); + this.targets().add(s); + for (let i = 0, n = arguments.length; i < n; ++i) { + arguments[i].targets().add(s); + } + return s; + }, + throttle(pause) { + let t = -1; + return this.filter(() => { + const now2 = Date.now(); + if (now2 - t > pause) { + t = now2; + return 1; + } else { + return 0; + } + }); }, - variancep: { - value: (m)=>m.valid > 1 ? m.dev / m.valid : undefined, - req: [ - 'variance' - ], - idx: 2 + debounce(delay) { + const s = stream(); + this.targets().add(stream(null, null, debounce(delay, (e) => { + const df = e.dataflow; + s.receive(e); + if (df && df.run) df.run(); + }))); + return s; + }, + between(a2, b2) { + let active = false; + a2.targets().add(stream(null, null, () => active = true)); + b2.targets().add(stream(null, null, () => active = false)); + return this.filter(() => active); + }, + detach() { + this._filter = truthy; + this._targets = null; + } + }; + function events$1(source2, type2, filter2, apply2) { + const df = this, s = stream(filter2, apply2), send = function(e) { + e.dataflow = df; + try { + s.receive(e); + } catch (error2) { + df.error(error2); + } finally { + df.run(); + } + }; + let sources; + if (typeof source2 === "string" && typeof document !== "undefined") { + sources = document.querySelectorAll(source2); + } else { + sources = array$5(source2); + } + const n = sources.length; + for (let i = 0; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + return s; + } + function parse$5(data2, format2) { + const locale2 = this.locale(); + return read(data2, format2, locale2.timeParse, locale2.utcParse); + } + function ingest(target2, data2, format2) { + data2 = this.parse(data2, format2); + return this.pulse(target2, this.changeset().insert(data2)); + } + async function request(url, format2) { + const df = this; + let status = 0, data2; + try { + data2 = await df.loader().load(url, { + context: "dataflow", + response: responseType(format2 && format2.type) + }); + try { + data2 = df.parse(data2, format2); + } catch (err) { + status = -2; + df.warn("Data ingestion failed", url, err); + } + } catch (err) { + status = -1; + df.warn("Loading failed", url, err); + } + return { + data: data2, + status + }; + } + async function preload(target2, url, format2) { + const df = this, pending = df._pending || loadPending(df); + pending.requests += 1; + const res = await df.request(url, format2); + df.pulse(target2, df.changeset().remove(truthy).insert(res.data || [])); + pending.done(); + return res; + } + function loadPending(df) { + let accept; + const pending = new Promise((a2) => accept = a2); + pending.requests = 0; + pending.done = () => { + if (--pending.requests === 0) { + df._pending = null; + accept(df); + } + }; + return df._pending = pending; + } + const SKIP$2 = { + skip: true + }; + function on(source2, target2, update2, params2, options) { + const fn = source2 instanceof Operator ? onOperator : onStream; + fn(this, source2, target2, update2, params2, options); + return this; + } + function onStream(df, stream2, target2, update2, params2, options) { + const opt = extend$1({}, options, SKIP$2); + let func, op; + if (!isFunction(target2)) target2 = constant$5(target2); + if (update2 === void 0) { + func = (e) => df.touch(target2(e)); + } else if (isFunction(update2)) { + op = new Operator(null, update2, params2, false); + func = (e) => { + op.evaluate(e); + const t = target2(e), v = op.value; + isChangeSet(v) ? df.pulse(t, v, options) : df.update(t, v, opt); + }; + } else { + func = (e) => df.update(target2(e), update2, opt); + } + stream2.apply(func); + } + function onOperator(df, source2, target2, update2, params2, options) { + if (update2 === void 0) { + source2.targets().add(target2); + } else { + const opt = options || {}, op = new Operator(null, updater(target2, update2), params2, false); + op.modified(opt.force); + op.rank = source2.rank; + source2.targets().add(op); + if (target2) { + op.skip(true); + op.value = target2.value; + op.targets().add(target2); + df.connect(target2, [op]); + } + } + } + function updater(target2, update2) { + update2 = isFunction(update2) ? update2 : constant$5(update2); + return target2 ? function(_, pulse2) { + const value2 = update2(_, pulse2); + if (!target2.skip()) { + target2.skip(value2 !== this.value).value = value2; + } + return value2; + } : update2; + } + function rank(op) { + op.rank = ++this._rank; + } + function rerank(op) { + const queue = [op]; + let cur, list, i; + while (queue.length) { + this.rank(cur = queue.pop()); + if (list = cur._targets) { + for (i = list.length; --i >= 0; ) { + queue.push(cur = list[i]); + if (cur === op) error("Cycle detected in dataflow graph."); + } + } + } + } + const StopPropagation = {}; + const ADD = 1 << 0, REM = 1 << 1, MOD$1 = 1 << 2, ADD_REM = ADD | REM, ADD_MOD = ADD | MOD$1, ALL = ADD | REM | MOD$1, REFLOW = 1 << 3, SOURCE = 1 << 4, NO_SOURCE = 1 << 5, NO_FIELDS = 1 << 6; + function Pulse(dataflow, stamp, encode2) { + this.dataflow = dataflow; + this.stamp = stamp == null ? -1 : stamp; + this.add = []; + this.rem = []; + this.mod = []; + this.fields = null; + this.encode = encode2 || null; + } + function materialize(data2, filter2) { + const out = []; + visitArray(data2, filter2, (_) => out.push(_)); + return out; + } + function filter$1(pulse2, flags) { + const map2 = {}; + pulse2.visit(flags, (t) => { + map2[tupleid(t)] = 1; + }); + return (t) => map2[tupleid(t)] ? null : t; + } + function addFilter(a2, b2) { + return a2 ? (t, i) => a2(t, i) && b2(t, i) : b2; + } + Pulse.prototype = { + /** + * Sentinel value indicating pulse propagation should stop. + */ + StopPropagation, + /** + * Boolean flag indicating ADD (added) tuples. + */ + ADD, + /** + * Boolean flag indicating REM (removed) tuples. + */ + REM, + /** + * Boolean flag indicating MOD (modified) tuples. + */ + MOD: MOD$1, + /** + * Boolean flag indicating ADD (added) and REM (removed) tuples. + */ + ADD_REM, + /** + * Boolean flag indicating ADD (added) and MOD (modified) tuples. + */ + ADD_MOD, + /** + * Boolean flag indicating ADD, REM and MOD tuples. + */ + ALL, + /** + * Boolean flag indicating all tuples in a data source + * except for the ADD, REM and MOD tuples. + */ + REFLOW, + /** + * Boolean flag indicating a 'pass-through' to a + * backing data source, ignoring ADD, REM and MOD tuples. + */ + SOURCE, + /** + * Boolean flag indicating that source data should be + * suppressed when creating a forked pulse. + */ + NO_SOURCE, + /** + * Boolean flag indicating that field modifications should be + * suppressed when creating a forked pulse. + */ + NO_FIELDS, + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. + * @return {Pulse} - The forked pulse instance. + * @see init + */ + fork(flags) { + return new Pulse(this.dataflow).init(this, flags); }, - stdev: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid - 1)) : undefined, - req: [ - 'variance' - ], - idx: 2 + /** + * Creates a copy of this pulse with new materialized array + * instances for the ADD, REM, MOD, and SOURCE arrays. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} - The cloned pulse instance. + * @see init + */ + clone() { + const p = this.fork(ALL); + p.add = p.add.slice(); + p.rem = p.rem.slice(); + p.mod = p.mod.slice(); + if (p.source) p.source = p.source.slice(); + return p.materialize(ALL | SOURCE); }, - stdevp: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / m.valid) : undefined, - req: [ - 'variance' - ], - idx: 2 + /** + * Returns a pulse that adds all tuples from a backing source. This is + * useful for cases where operators are added to a dataflow after an + * upstream data pipeline has already been processed, ensuring that + * new operators can observe all tuples within a stream. + * @return {Pulse} - A pulse instance with all source tuples included + * in the add array. If the current pulse already has all source + * tuples in its add array, it is returned directly. If the current + * pulse does not have a backing source, it is returned directly. + */ + addAll() { + let p = this; + const reuse = !p.source || p.add === p.rem || !p.rem.length && p.source.length === p.add.length; + if (reuse) { + return p; + } else { + p = new Pulse(this.dataflow).init(this); + p.add = p.source; + p.rem = []; + return p; + } }, - stderr: { - value: (m)=>m.valid > 1 ? Math.sqrt(m.dev / (m.valid * (m.valid - 1))) : undefined, - req: [ - 'variance' - ], - idx: 2 + /** + * Initialize this pulse based on the values of another pulse. This method + * is used internally by {@link fork} to initialize a new forked tuple. + * The dataflow, time stamp and field modification values are copied over. + * By default, new empty ADD, REM and MOD arrays are created. + * @param {Pulse} src - The source pulse to copy from. + * @param {number} flags - Integer of boolean flags indicating which (if any) + * tuple arrays should be copied to the new pulse. The supported flag values + * are ADD, REM and MOD. Array references are copied directly: new array + * instances are not created. By default, source data arrays are copied + * to the new pulse. Use the NO_SOURCE flag to enforce a null source. + * @return {Pulse} - Returns this Pulse instance. + */ + init(src, flags) { + const p = this; + p.stamp = src.stamp; + p.encode = src.encode; + if (src.fields && !(flags & NO_FIELDS)) { + p.fields = src.fields; + } + if (flags & ADD) { + p.addF = src.addF; + p.add = src.add; + } else { + p.addF = null; + p.add = []; + } + if (flags & REM) { + p.remF = src.remF; + p.rem = src.rem; + } else { + p.remF = null; + p.rem = []; + } + if (flags & MOD$1) { + p.modF = src.modF; + p.mod = src.mod; + } else { + p.modF = null; + p.mod = []; + } + if (flags & NO_SOURCE) { + p.srcF = null; + p.source = null; + } else { + p.srcF = src.srcF; + p.source = src.source; + if (src.cleans) p.cleans = src.cleans; + } + return p; }, - distinct: { - value: (m)=>m.cell.data.distinct(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Schedules a function to run after pulse propagation completes. + * @param {function} func - The function to run. + */ + runAfter(func) { + this.dataflow.runAfter(func); }, - ci0: { - value: (m)=>m.cell.data.ci0(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Indicates if tuples have been added, removed or modified. + * @param {number} [flags] - The tuple types (ADD, REM or MOD) to query. + * Defaults to ALL, returning true if any tuple type has changed. + * @return {boolean} - Returns true if one or more queried tuple types have + * changed, false otherwise. + */ + changed(flags) { + const f = flags || ALL; + return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD$1 && this.mod.length; }, - ci1: { - value: (m)=>m.cell.data.ci1(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Forces a "reflow" of tuple values, such that all tuples in the backing + * source are added to the MOD set, unless already present in the ADD set. + * @param {boolean} [fork=false] - If true, returns a forked copy of this + * pulse, and invokes reflow on that derived pulse. + * @return {Pulse} - The reflowed pulse instance. + */ + reflow(fork) { + if (fork) return this.fork(ALL).reflow(); + const len2 = this.add.length, src = this.source && this.source.length; + if (src && src !== len2) { + this.mod = this.source; + if (len2) this.filter(MOD$1, filter$1(this, ADD)); + } + return this; }, - median: { - value: (m)=>m.cell.data.q2(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Get/set metadata to pulse requesting garbage collection + * to reclaim currently unused resources. + */ + clean(value2) { + if (arguments.length) { + this.cleans = !!value2; + return this; + } else { + return this.cleans; + } }, - q1: { - value: (m)=>m.cell.data.q1(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Marks one or more data field names as modified to assist dependency + * tracking and incremental processing by transform operators. + * @param {string|Array<string>} _ - The field(s) to mark as modified. + * @return {Pulse} - This pulse instance. + */ + modifies(_) { + const hash = this.fields || (this.fields = {}); + if (isArray(_)) { + _.forEach((f) => hash[f] = true); + } else { + hash[_] = true; + } + return this; }, - q3: { - value: (m)=>m.cell.data.q3(m.get), - req: [ - 'values' - ], - idx: 3 + /** + * Checks if one or more data fields have been modified during this pulse + * propagation timestamp. + * @param {string|Array<string>} _ - The field(s) to check for modified. + * @param {boolean} nomod - If true, will check the modified flag even if + * no mod tuples exist. If false (default), mod tuples must be present. + * @return {boolean} - Returns true if any of the provided fields has been + * marked as modified, false otherwise. + */ + modified(_, nomod) { + const fields = this.fields; + return !((nomod || this.mod.length) && fields) ? false : !arguments.length ? !!fields : isArray(_) ? _.some((f) => fields[f]) : fields[_]; }, - min: { - init: (m)=>m.min = undefined, - value: (m)=>m.min = Number.isNaN(m.min) ? m.cell.data.min(m.get) : m.min, - add: (m, v)=>{ - if (v < m.min || m.min === undefined) m.min = v; - }, - rem: (m, v)=>{ - if (v <= m.min) m.min = NaN; - }, - req: [ - 'values' - ], - idx: 4 + /** + * Adds a filter function to one more tuple sets. Filters are applied to + * backing tuple arrays, to determine the actual set of tuples considered + * added, removed or modified. They can be used to delay materialization of + * a tuple set in order to avoid expensive array copies. In addition, the + * filter functions can serve as value transformers: unlike standard predicate + * function (which return boolean values), Pulse filters should return the + * actual tuple value to process. If a tuple set is already filtered, the + * new filter function will be appended into a conjuntive ('and') query. + * @param {number} flags - Flags indicating the tuple set(s) to filter. + * @param {function(*):object} filter - Filter function that will be applied + * to the tuple set array, and should return a data tuple if the value + * should be included in the tuple set, and falsy (or null) otherwise. + * @return {Pulse} - Returns this pulse instance. + */ + filter(flags, filter2) { + const p = this; + if (flags & ADD) p.addF = addFilter(p.addF, filter2); + if (flags & REM) p.remF = addFilter(p.remF, filter2); + if (flags & MOD$1) p.modF = addFilter(p.modF, filter2); + if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter2); + return p; }, - max: { - init: (m)=>m.max = undefined, - value: (m)=>m.max = Number.isNaN(m.max) ? m.cell.data.max(m.get) : m.max, - add: (m, v)=>{ - if (v > m.max || m.max === undefined) m.max = v; - }, - rem: (m, v)=>{ - if (v >= m.max) m.max = NaN; - }, - req: [ - 'values' - ], - idx: 4 + /** + * Materialize one or more tuple sets in this pulse. If the tuple set(s) have + * a registered filter function, it will be applied and the tuple set(s) will + * be replaced with materialized tuple arrays. + * @param {number} flags - Flags indicating the tuple set(s) to materialize. + * @return {Pulse} - Returns this pulse instance. + */ + materialize(flags) { + flags = flags || ALL; + const p = this; + if (flags & ADD && p.addF) { + p.add = materialize(p.add, p.addF); + p.addF = null; + } + if (flags & REM && p.remF) { + p.rem = materialize(p.rem, p.remF); + p.remF = null; + } + if (flags & MOD$1 && p.modF) { + p.mod = materialize(p.mod, p.modF); + p.modF = null; + } + if (flags & SOURCE && p.srcF) { + p.source = p.source.filter(p.srcF); + p.srcF = null; + } + return p; }, - argmin: { - init: (m)=>m.argmin = undefined, - value: (m)=>m.argmin || m.cell.data.argmin(m.get), - add: (m, v, t)=>{ - if (v < m.min) m.argmin = t; - }, - rem: (m, v)=>{ - if (v <= m.min) m.argmin = undefined; - }, - req: [ - 'min', - 'values' - ], - idx: 3 + /** + * Visit one or more tuple sets in this pulse. + * @param {number} flags - Flags indicating the tuple set(s) to visit. + * Legal values are ADD, REM, MOD and SOURCE (if a backing data source + * has been set). + * @param {function(object):*} - Visitor function invoked per-tuple. + * @return {Pulse} - Returns this pulse instance. + */ + visit(flags, visitor) { + const p = this, v = visitor; + if (flags & SOURCE) { + visitArray(p.source, p.srcF, v); + return p; + } + if (flags & ADD) visitArray(p.add, p.addF, v); + if (flags & REM) visitArray(p.rem, p.remF, v); + if (flags & MOD$1) visitArray(p.mod, p.modF, v); + const src = p.source; + if (flags & REFLOW && src) { + const sum2 = p.add.length + p.mod.length; + if (sum2 === src.length) ; + else if (sum2) { + visitArray(src, filter$1(p, ADD_MOD), v); + } else { + visitArray(src, p.srcF, v); + } + } + return p; + } + }; + function MultiPulse(dataflow, stamp, pulses, encode2) { + const p = this; + let c2 = 0; + this.dataflow = dataflow; + this.stamp = stamp; + this.fields = null; + this.encode = encode2 || null; + this.pulses = pulses; + for (const pulse2 of pulses) { + if (pulse2.stamp !== stamp) continue; + if (pulse2.fields) { + const hash = p.fields || (p.fields = {}); + for (const f in pulse2.fields) { + hash[f] = 1; + } + } + if (pulse2.changed(p.ADD)) c2 |= p.ADD; + if (pulse2.changed(p.REM)) c2 |= p.REM; + if (pulse2.changed(p.MOD)) c2 |= p.MOD; + } + this.changes = c2; + } + inherits(MultiPulse, Pulse, { + /** + * Creates a new pulse based on the values of this pulse. + * The dataflow, time stamp and field modification values are copied over. + * @return {Pulse} + */ + fork(flags) { + const p = new Pulse(this.dataflow).init(this, flags & this.NO_FIELDS); + if (flags !== void 0) { + if (flags & p.ADD) this.visit(p.ADD, (t) => p.add.push(t)); + if (flags & p.REM) this.visit(p.REM, (t) => p.rem.push(t)); + if (flags & p.MOD) this.visit(p.MOD, (t) => p.mod.push(t)); + } + return p; }, - argmax: { - init: (m)=>m.argmax = undefined, - value: (m)=>m.argmax || m.cell.data.argmax(m.get), - add: (m, v, t)=>{ - if (v > m.max) m.argmax = t; - }, - rem: (m, v)=>{ - if (v >= m.max) m.argmax = undefined; - }, - req: [ - 'max', - 'values' - ], - idx: 3 + changed(flags) { + return this.changes & flags; }, - exponential: { - init: (m, r)=>{ - m.exp = 0; - m.exp_r = r; - }, - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) / (1 - m.exp_r ** m.valid) : undefined, - add: (m, v)=>m.exp = m.exp_r * m.exp + v, - rem: (m, v)=>m.exp = (m.exp - v / m.exp_r ** (m.valid - 1)) / m.exp_r + modified(_) { + const p = this, fields = p.fields; + return !(fields && p.changes & p.MOD) ? 0 : isArray(_) ? _.some((f) => fields[f]) : fields[_]; }, - exponentialb: { - value: (m)=>m.valid ? m.exp * (1 - m.exp_r) : undefined, - req: [ - 'exponential' - ], - idx: 1 - } -}; -const ValidAggregateOps = Object.keys(AggregateOps).filter((d)=>d !== '__count__'); -function measure(key, value) { - return (out, aggregate_param)=>(0, _vegaUtil.extend)({ - name: key, - aggregate_param: aggregate_param, - out: out || key - }, base_op, value); -} -[ - ...ValidAggregateOps, - '__count__' -].forEach((key)=>{ - AggregateOps[key] = measure(key, AggregateOps[key]); -}); -function createMeasure(op, param, name) { - return AggregateOps[op](name, param); -} -function compareIndex(a, b) { - return a.idx - b.idx; -} -function resolve(agg) { - const map = {}; - agg.forEach((a)=>map[a.name] = a); - const getreqs = (a)=>{ - if (!a.req) return; - a.req.forEach((key)=>{ - if (!map[key]) getreqs(map[key] = AggregateOps[key]()); - }); - }; - agg.forEach(getreqs); - return Object.values(map).sort(compareIndex); -} -function init() { - this.valid = 0; - this.missing = 0; - this._ops.forEach((op)=>op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); -} -function add(v, t) { - if (v == null || v === '') { - ++this.missing; - return; + filter() { + error("MultiPulse does not support filtering."); + }, + materialize() { + error("MultiPulse does not support materialization."); + }, + visit(flags, visitor) { + const p = this, pulses = p.pulses, n = pulses.length; + let i = 0; + if (flags & p.SOURCE) { + for (; i < n; ++i) { + pulses[i].visit(flags, visitor); + } + } else { + for (; i < n; ++i) { + if (pulses[i].stamp === p.stamp) { + pulses[i].visit(flags, visitor); + } + } + } + return p; } - if (v !== v) return; - ++this.valid; - this._ops.forEach((op)=>op.add(this, v, t)); -} -function rem(v, t) { - if (v == null || v === '') { - --this.missing; - return; + }); + async function evaluate(encode2, prerun, postrun) { + const df = this, async = []; + if (df._pulse) return reentrant(df); + if (df._pending) await df._pending; + if (prerun) await asyncCallback(df, prerun); + if (!df._touched.length) { + df.debug("Dataflow invoked, but nothing to do."); + return df; } - if (v !== v) return; - --this.valid; - this._ops.forEach((op)=>op.rem(this, v, t)); -} -function set(t) { - this._out.forEach((op)=>t[op.out] = op.value(this)); - return t; -} -function compileMeasures(agg, field) { - const get = field || (0, _vegaUtil.identity), ops = resolve(agg), out = agg.slice().sort(compareIndex); - function ctr(cell) { - this._ops = ops; - this._out = out; - this.cell = cell; - this.init(); - } - ctr.prototype.init = init; - ctr.prototype.add = add; - ctr.prototype.rem = rem; - ctr.prototype.set = set; - ctr.prototype.get = get; - ctr.fields = agg.map((op)=>op.out); - return ctr; -} -function TupleStore(key) { - this._key = key ? (0, _vegaUtil.field)(key) : (0, _vegaDataflow.tupleid); - this.reset(); -} -const prototype$1 = TupleStore.prototype; -prototype$1.reset = function() { - this._add = []; - this._rem = []; - this._ext = null; - this._get = null; - this._q = null; -}; -prototype$1.add = function(v) { - this._add.push(v); -}; -prototype$1.rem = function(v) { - this._rem.push(v); -}; -prototype$1.values = function() { - this._get = null; - if (this._rem.length === 0) return this._add; - const a = this._add, r = this._rem, k = this._key, n = a.length, m = r.length, x = Array(n - m), map = {}; - let i, j, v; - // use unique key field to clear removed values - for(i = 0; i < m; ++i)map[k(r[i])] = 1; - for(i = 0, j = 0; i < n; ++i)if (map[k(v = a[i])]) map[k(v)] = 0; - else x[j++] = v; - this._rem = []; - return this._add = x; -}; -// memoizing statistics methods -prototype$1.distinct = function(get) { - const v = this.values(), map = {}; - let n = v.length, count = 0, s; - while(--n >= 0){ - s = get(v[n]) + ''; - if (!(0, _vegaUtil.hasOwnProperty)(map, s)) { - map[s] = 1; - ++count; - } - } - return count; -}; -prototype$1.extent = function(get) { - if (this._get !== get || !this._ext) { - const v = this.values(), i = (0, _vegaUtil.extentIndex)(v, get); - this._ext = [ - v[i[0]], - v[i[1]] - ]; - this._get = get; + const stamp = ++df._clock; + df._pulse = new Pulse(df, stamp, encode2); + df._touched.forEach((op2) => df._enqueue(op2, true)); + df._touched = UniqueList(id); + let count2 = 0, op, next, error2; + try { + while (df._heap.size() > 0) { + op = df._heap.pop(); + if (op.rank !== op.qrank) { + df._enqueue(op, true); + continue; + } + next = op.run(df._getPulse(op, encode2)); + if (next.then) { + next = await next; + } else if (next.async) { + async.push(next.async); + next = StopPropagation; + } + if (next !== StopPropagation) { + if (op._targets) op._targets.forEach((op2) => df._enqueue(op2)); + } + ++count2; + } + } catch (err) { + df._heap.clear(); + error2 = err; } - return this._ext; -}; -prototype$1.argmin = function(get) { - return this.extent(get)[0] || {}; -}; -prototype$1.argmax = function(get) { - return this.extent(get)[1] || {}; -}; -prototype$1.min = function(get) { - const m = this.extent(get)[0]; - return m != null ? get(m) : undefined; -}; -prototype$1.max = function(get) { - const m = this.extent(get)[1]; - return m != null ? get(m) : undefined; -}; -prototype$1.quartile = function(get) { - if (this._get !== get || !this._q) { - this._q = (0, _vegaStatistics.quartiles)(this.values(), get); - this._get = get; + df._input = {}; + df._pulse = null; + df.debug(`Pulse ${stamp}: ${count2} operators`); + if (error2) { + df._postrun = []; + df.error(error2); } - return this._q; -}; -prototype$1.q1 = function(get) { - return this.quartile(get)[0]; -}; -prototype$1.q2 = function(get) { - return this.quartile(get)[1]; -}; -prototype$1.q3 = function(get) { - return this.quartile(get)[2]; -}; -prototype$1.ci = function(get) { - if (this._get !== get || !this._ci) { - this._ci = (0, _vegaStatistics.bootstrapCI)(this.values(), 1000, 0.05, get); - this._get = get; + if (df._postrun.length) { + const pr = df._postrun.sort((a2, b2) => b2.priority - a2.priority); + df._postrun = []; + for (let i = 0; i < pr.length; ++i) { + await asyncCallback(df, pr[i].callback); + } } - return this._ci; -}; -prototype$1.ci0 = function(get) { - return this.ci(get)[0]; -}; -prototype$1.ci1 = function(get) { - return this.ci(get)[1]; -}; -/** - * Group-by aggregation operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<function(object): *>} [params.fields] - An array of accessors to aggregate. - * @param {Array<string>} [params.ops] - An array of strings indicating aggregation operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameters for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for aggregated values. - * @param {boolean} [params.cross=false] - A flag indicating that the full - * cross-product of groupby values should be generated, including empty cells. - * If true, the drop parameter is ignored and empty cells are retained. - * @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed. - */ function Aggregate(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this._adds = []; // array of added output tuples - this._mods = []; // array of modified output tuples - this._alen = 0; // number of active added tuples - this._mlen = 0; // number of active modified tuples - this._drop = true; // should empty aggregation cells be removed - this._cross = false; // produce full cross-product of group-by values - this._dims = []; // group-by dimension accessors - this._dnames = []; // group-by dimension names - this._measures = []; // collection of aggregation monoids - this._countOnly = false; // flag indicating only count aggregation - this._counts = null; // collection of count fields - this._prev = null; // previous aggregation cells - this._inputs = null; // array of dependent input tuple field names - this._outputs = null; // array of output tuple field names -} -Aggregate.Definition = { - 'type': 'Aggregate', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'drop', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'cross', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Aggregate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const aggr = this, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), mod = _.modified(); - aggr.stamp = out.stamp; - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - aggr._prev = aggr.value; - aggr.value = mod ? aggr.init(_) : Object.create(null); - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - aggr.value = aggr.value || aggr.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // Indicate output fields and return aggregate tuples. - out.modifies(aggr._outputs); - // Should empty cells be dropped? - aggr._drop = _.drop !== false; - // If domain cross-product requested, generate empty cells as needed - // and ensure that empty cells are not dropped - if (_.cross && aggr._dims.length > 1) { - aggr._drop = false; - aggr.cross(); - } - if (pulse.clean() && aggr._drop) out.clean(true).runAfter(()=>this.clean()); - return aggr.changes(out); - }, - cross () { - const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(()=>({})), n = dims.length; - // collect all group-by domain values - function collect(cells) { - let key, i, t, v; - for(key in cells){ - t = cells[key].tuple; - for(i = 0; i < n; ++i)vals[i][v = t[dims[i]]] = v; - } - } - collect(aggr._prev); - collect(curr); - // iterate over key cross-product, create cells as needed - function generate(base, tuple, index) { - const name = dims[index], v = vals[index++]; - for(const k in v){ - const key = base ? base + '|' + k : k; - tuple[name] = v[k]; - if (index < n) generate(key, tuple, index); - else if (!curr[key]) aggr.cell(key, tuple); - } - } - generate('', {}, 0); - }, - init (_) { - // initialize input and output fields - const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; - function inputVisit(get) { - const fields = (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(get)), n = fields.length; - let i = 0, f; - for(; i < n; ++i)if (!inputMap[f = fields[i]]) { - inputMap[f] = 1; - inputs.push(f); - } - } - // initialize group-by dimensions - this._dims = (0, _vegaUtil.array)(_.groupby); - this._dnames = this._dims.map((d)=>{ - const dname = (0, _vegaUtil.accessorName)(d); - inputVisit(d); - outputs.push(dname); - return dname; + if (postrun) await asyncCallback(df, postrun); + if (async.length) { + Promise.all(async).then((cb) => df.runAsync(null, () => { + cb.forEach((f) => { + try { + f(df); + } catch (err) { + df.error(err); + } }); - this.cellkey = _.key ? _.key : groupkey(this._dims); - // initialize aggregate measures - this._countOnly = true; - this._counts = []; - this._measures = []; - const fields = _.fields || [ - null - ], ops = _.ops || [ - 'count' - ], aggregate_params = _.aggregate_params || [ - null - ], as = _.as || [], n = fields.length, map = {}; - let field, op, aggregate_param, m, mname, outname, i; - if (n !== ops.length) (0, _vegaUtil.error)('Unmatched number of fields and aggregate ops.'); - for(i = 0; i < n; ++i){ - field = fields[i]; - op = ops[i]; - aggregate_param = aggregate_params[i] || null; - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - mname = (0, _vegaUtil.accessorName)(field); - outname = measureName(op, mname, as[i]); - outputs.push(outname); - if (op === 'count') { - this._counts.push(outname); - continue; - } - m = map[mname]; - if (!m) { - inputVisit(field); - m = map[mname] = []; - m.field = field; - this._measures.push(m); - } - if (op !== 'count') this._countOnly = false; - m.push(createMeasure(op, aggregate_param, outname)); - } - this._measures = this._measures.map((m)=>compileMeasures(m, m.field)); - return Object.create(null); // aggregation cells (this.value) - }, - // -- Cell Management ----- - cellkey: groupkey(), - cell (key, t) { - let cell = this.value[key]; - if (!cell) { - cell = this.value[key] = this.newcell(key, t); - this._adds[this._alen++] = cell; - } else if (cell.num === 0 && this._drop && cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._adds[this._alen++] = cell; - } else if (cell.stamp < this.stamp) { - cell.stamp = this.stamp; - this._mods[this._mlen++] = cell; - } - return cell; - }, - newcell (key, t) { - const cell = { - key: key, - num: 0, - agg: null, - tuple: this.newtuple(t, this._prev && this._prev[key]), - stamp: this.stamp, - store: false - }; - if (!this._countOnly) { - const measures = this._measures, n = measures.length; - cell.agg = Array(n); - for(let i = 0; i < n; ++i)cell.agg[i] = new measures[i](cell); - } - if (cell.store) cell.data = new TupleStore(); - return cell; - }, - newtuple (t, p) { - const names = this._dnames, dims = this._dims, n = dims.length, x = {}; - for(let i = 0; i < n; ++i)x[names[i]] = dims[i](t); - return p ? (0, _vegaDataflow.replace)(p.tuple, x) : (0, _vegaDataflow.ingest)(x); - }, - clean () { - const cells = this.value; - for(const key in cells)if (cells[key].num === 0) delete cells[key]; - }, - // -- Process Tuples ----- - add (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num += 1; - if (this._countOnly) return; - if (cell.store) cell.data.add(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].add(agg[i].get(t), t); - }, - rem (t) { - const key = this.cellkey(t), cell = this.cell(key, t); - cell.num -= 1; - if (this._countOnly) return; - if (cell.store) cell.data.rem(t); - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].rem(agg[i].get(t), t); - }, - celltuple (cell) { - const tuple = cell.tuple, counts = this._counts; - // consolidate stored values - if (cell.store) cell.data.values(); - // update tuple properties - for(let i = 0, n = counts.length; i < n; ++i)tuple[counts[i]] = cell.num; - if (!this._countOnly) { - const agg = cell.agg; - for(let i = 0, n = agg.length; i < n; ++i)agg[i].set(tuple); - } - return tuple; - }, - changes (out) { - const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add = out.add, rem = out.rem, mod = out.mod; - let cell, key, i, n; - if (prev) for(key in prev){ - cell = prev[key]; - if (!drop || cell.num) rem.push(cell.tuple); - } - for(i = 0, n = this._alen; i < n; ++i){ - add.push(this.celltuple(adds[i])); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - cell = mods[i]; - (cell.num === 0 && drop ? rem : mod).push(this.celltuple(cell)); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - this._prev = null; - return out; + })); } -}); -// epsilon bias to offset floating point error (#1737) -const EPSILON$1 = 1e-14; -/** - * Generates a binning function for discretizing data. - * @constructor - * @param {object} params - The parameters for this operator. The - * provided values should be valid options for the {@link bin} function. - * @param {function(object): *} params.field - The data field to bin. - */ function Bin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Bin.Definition = { - 'type': 'Bin', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'anchor', - 'type': 'number' - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 20 - }, - { - 'name': 'base', - 'type': 'number', - 'default': 10 - }, - { - 'name': 'divide', - 'type': 'number', - 'array': true, - 'default': [ - 5, - 2 - ] - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'span', - 'type': 'number' - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'steps', - 'type': 'number', - 'array': true - }, - { - 'name': 'minstep', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'name', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'bin0', - 'bin1' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Bin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const band = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || [ - 'bin0', - 'bin1' - ], b0 = as[0], b1 = as[1]; - let flag; - if (_.modified()) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - } else flag = pulse.modified((0, _vegaUtil.accessorFields)(_.field)) ? pulse.ADD_MOD : pulse.ADD; - pulse.visit(flag, band ? (t)=>{ - const v = bins(t); - // minimum bin value (inclusive) - t[b0] = v; - // maximum bin value (exclusive) - // use convoluted math for better floating point agreement - // see https://github.com/vega/vega/issues/830 - // infinite values propagate through this formula! #2227 - t[b1] = v == null ? null : start + step * (1 + (v - start) / step); - } : (t)=>t[b0] = bins(t)); - return pulse.modifies(band ? as : b0); - }, - _bins (_) { - if (this.value && !_.modified()) return this.value; - const field = _.field, bins = (0, _vegaStatistics.bin)(_), step = bins.step; - let start = bins.start, stop = start + Math.ceil((bins.stop - start) / step) * step, a, d; - if ((a = _.anchor) != null) { - d = a - (start + step * Math.floor((a - start) / step)); - start += d; - stop += d; - } - const f = function(t) { - let v = (0, _vegaUtil.toNumber)(field(t)); - return v == null ? null : v < start ? -Infinity : v > stop ? Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step)); - }; - f.start = start; - f.stop = bins.stop; - f.step = step; - return this.value = (0, _vegaUtil.accessor)(f, (0, _vegaUtil.accessorFields)(field), _.name || 'bin_' + (0, _vegaUtil.accessorName)(field)); - } -}); -function SortedList(idFunc, source, input) { - const $ = idFunc; - let data = source || [], add = input || [], rem = {}, cnt = 0; - return { - add: (t)=>add.push(t), - remove: (t)=>rem[$(t)] = ++cnt, - size: ()=>data.length, - data: (compare, resort)=>{ - if (cnt) { - data = data.filter((t)=>!rem[$(t)]); - rem = {}; - cnt = 0; - } - if (resort && compare) data.sort(compare); - if (add.length) { - data = compare ? (0, _vegaUtil.merge)(compare, data, add.sort(compare)) : data.concat(add); - add = []; - } - return data; - } - }; -} -/** - * Collects all data tuples that pass through this operator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for additionally sorting the collected tuples. - */ function Collect(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Collect.Definition = { - 'type': 'Collect', - 'metadata': { - 'source': true - }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - } - ] -}; -(0, _vegaUtil.inherits)(Collect, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), list = SortedList((0, _vegaDataflow.tupleid), this.value, out.materialize(out.ADD).add), sort = _.sort, mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields)); - out.visit(out.REM, list.remove); - this.modified(mod); - this.value = out.source = list.data((0, _vegaDataflow.stableCompare)(sort), mod); - // propagate tree root if defined - if (pulse.source && pulse.source.root) this.value.root = pulse.source.root; - return out; + return df; + } + async function runAsync(encode2, prerun, postrun) { + while (this._running) await this._running; + const clear = () => this._running = null; + (this._running = this.evaluate(encode2, prerun, postrun)).then(clear, clear); + return this._running; + } + function run(encode2, prerun, postrun) { + return this._pulse ? reentrant(this) : (this.evaluate(encode2, prerun, postrun), this); + } + function runAfter(callback, enqueue2, priority) { + if (this._pulse || enqueue2) { + this._postrun.push({ + priority: priority || 0, + callback + }); + } else { + try { + callback(this); + } catch (err) { + this.error(err); + } } -}); -/** - * Generates a comparator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string|function>} params.fields - The fields to compare. - * @param {Array<string>} [params.orders] - The sort orders. - * Each entry should be one of "ascending" (default) or "descending". - */ function Compare(params) { - (0, _vegaDataflow.Operator).call(this, null, update$5, params); -} -(0, _vegaUtil.inherits)(Compare, (0, _vegaDataflow.Operator)); -function update$5(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.compare)(_.fields, _.orders); -} -/** - * Count regexp-defined pattern occurrences in a text field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the text field. - * @param {string} [params.pattern] - RegExp string defining the text pattern. - * @param {string} [params.case] - One of 'lower', 'upper' or null (mixed) case. - * @param {string} [params.stopwords] - RegExp string of words to ignore. - */ function CountPattern(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -CountPattern.Definition = { - 'type': 'CountPattern', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'case', - 'type': 'enum', - 'values': [ - 'upper', - 'lower', - 'mixed' - ], - 'default': 'mixed' - }, - { - 'name': 'pattern', - 'type': 'string', - 'default': '[\\w"]+' - }, - { - 'name': 'stopwords', - 'type': 'string', - 'default': '' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'text', - 'count' - ] - } - ] -}; -function tokenize(text, tcase, match) { - switch(tcase){ - case 'upper': - text = text.toUpperCase(); - break; - case 'lower': - text = text.toLowerCase(); - break; + } + function reentrant(df) { + df.error("Dataflow already running. Use runAsync() to chain invocations."); + return df; + } + function enqueue(op, force2) { + const q = op.stamp < this._clock; + if (q) op.stamp = this._clock; + if (q || force2) { + op.qrank = op.rank; + this._heap.push(op); } - return text.match(match); -} -(0, _vegaUtil.inherits)(CountPattern, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const process = (update)=>(tuple)=>{ - var tokens = tokenize(get(tuple), _.case, match) || [], t; - for(var i = 0, n = tokens.length; i < n; ++i)if (!stop.test(t = tokens[i])) update(t); - }; - const init = this._parameterCheck(_, pulse), counts = this._counts, match = this._match, stop = this._stop, get = _.field, as = _.as || [ - 'text', - 'count' - ], add = process((t)=>counts[t] = 1 + (counts[t] || 0)), rem = process((t)=>counts[t] -= 1); - if (init) pulse.visit(pulse.SOURCE, add); - else { - pulse.visit(pulse.ADD, add); - pulse.visit(pulse.REM, rem); - } - return this._finish(pulse, as); // generate output tuples - }, - _parameterCheck (_, pulse) { - let init = false; - if (_.modified('stopwords') || !this._stop) { - this._stop = new RegExp('^' + (_.stopwords || '') + '$', 'i'); - init = true; - } - if (_.modified('pattern') || !this._match) { - this._match = new RegExp(_.pattern || '[\\w\']+', 'g'); - init = true; - } - if (_.modified('field') || pulse.modified(_.field.fields)) init = true; - if (init) this._counts = {}; - return init; - }, - _finish (pulse, as) { - const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text = as[0], count = as[1], out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - let w, t, c; - for(w in counts){ - t = tuples[w]; - c = counts[w] || 0; - if (!t && c) { - tuples[w] = t = (0, _vegaDataflow.ingest)({}); - t[text] = w; - t[count] = c; - out.add.push(t); - } else if (c === 0) { - if (t) out.rem.push(t); - counts[w] = null; - tuples[w] = null; - } else if (t[count] !== c) { - t[count] = c; - out.mod.push(t); - } - } - return out.modifies(as); - } -}); -/** - * Perform a cross-product of a tuple stream with itself. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object):boolean} [params.filter] - An optional filter - * function for selectively including tuples in the cross product. - * @param {Array<string>} [params.as] - The names of the output fields. - */ function Cross(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Cross.Definition = { - 'type': 'Cross', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'filter', - 'type': 'expr' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'a', - 'b' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Cross, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), as = _.as || [ - 'a', - 'b' - ], a = as[0], b = as[1], reset = !this.value || pulse.changed(pulse.ADD_REM) || _.modified('as') || _.modified('filter'); - let data = this.value; - if (reset) { - if (data) out.rem = data; - data = pulse.materialize(pulse.SOURCE).source; - out.add = this.value = cross(data, a, b, _.filter || (0, _vegaUtil.truthy)); - } else out.mod = data; - out.source = this.value; - return out.modifies(as); - } -}); -function cross(input, a, b, filter) { - var data = [], t = {}, n = input.length, i = 0, j, left; - for(; i < n; ++i){ - t[a] = left = input[i]; - for(j = 0; j < n; ++j){ - t[b] = input[j]; - if (filter(t)) { - data.push((0, _vegaDataflow.ingest)(t)); - t = {}; - t[a] = left; - } - } + } + function getPulse(op, encode2) { + const s = op.source, stamp = this._clock; + return s && isArray(s) ? new MultiPulse(this, stamp, s.map((_) => _.pulse), encode2) : this._input[op.id] || singlePulse(this._pulse, s && s.pulse); + } + function singlePulse(p, s) { + if (s && s.stamp === p.stamp) { + return s; } - return data; -} -const Distributions = { - kde: (0, _vegaStatistics.randomKDE), - mixture: (0, _vegaStatistics.randomMixture), - normal: (0, _vegaStatistics.randomNormal), - lognormal: (0, _vegaStatistics.randomLogNormal), - uniform: (0, _vegaStatistics.randomUniform) -}; -const DISTRIBUTIONS = 'distributions', FUNCTION = 'function', FIELD = 'field'; -/** - * Parse a parameter object for a probability distribution. - * @param {object} def - The distribution parameter object. - * @param {function():Array<object>} - A method for requesting - * source data. Used for distributions (such as KDE) that - * require sample data points. This method will only be - * invoked if the 'from' parameter for a target data source - * is not provided. Typically this method returns backing - * source data for a Pulse object. - * @return {object} - The output distribution object. - */ function parse(def, data) { - const func = def[FUNCTION]; - if (!(0, _vegaUtil.hasOwnProperty)(Distributions, func)) (0, _vegaUtil.error)('Unknown distribution function: ' + func); - const d = Distributions[func](); - for(const name in def){ - // if data field, extract values - if (name === FIELD) d.data((def.from || data()).map(def[name])); - else if (name === DISTRIBUTIONS) d[name](def[name].map((_)=>parse(_, data))); - else if (typeof d[name] === FUNCTION) d[name](def[name]); + p = p.fork(); + if (s && s !== StopPropagation) { + p.source = s.source; } - return d; -} -/** - * Grid sample points for a probability density. Given a distribution and - * a sampling extent, will generate points suitable for plotting either - * PDF (probability density function) or CDF (cumulative distribution - * function) curves. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.distribution - The probability distribution. This - * is an object parameter dependent on the distribution type. - * @param {string} [params.method='pdf'] - The distribution method to sample. - * One of 'pdf' or 'cdf'. - * @param {Array<number>} [params.extent] - The [min, max] extent over which - * to sample the distribution. This argument is required in most cases, but - * can be omitted if the distribution (e.g., 'kde') supports a 'data' method - * that returns numerical sample points from which the extent can be deduced. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function Density(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const distributions = [ - { - 'key': { - 'function': 'normal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'function': 'lognormal' - }, - 'params': [ - { - 'name': 'mean', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'stdev', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'function': 'uniform' - }, - 'params': [ - { - 'name': 'min', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'max', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'function': 'kde' - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'from', - 'type': 'data' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - } - ] + return p; + } + const NO_OPT = { + skip: false, + force: false + }; + function touch(op, options) { + const opt = options || NO_OPT; + if (this._pulse) { + this._enqueue(op); + } else { + this._touched.add(op); } -]; -const mixture = { - 'key': { - 'function': 'mixture' - }, - 'params': [ - { - 'name': 'distributions', - 'type': 'param', - 'array': true, - 'params': distributions - }, - { - 'name': 'weights', - 'type': 'number', - 'array': true - } - ] -}; -Density.Definition = { - 'type': 'Density', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'pdf', - 'values': [ - 'pdf', - 'cdf' - ] - }, - { - 'name': 'distribution', - 'type': 'param', - 'params': distributions.concat(mixture) - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Density, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const dist = parse(_.distribution, source(pulse)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - let method = _.method || 'pdf'; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (!_.extent && !dist.data) (0, _vegaUtil.error)('Missing density extent parameter.'); - method = dist[method]; - const as = _.as || [ - 'value', - 'density' - ], domain = _.extent || (0, _vegaUtil.extent)(dist.data()), values = (0, _vegaStatistics.sampleCurve)(method, domain, minsteps, maxsteps).map((v)=>{ - const tuple = {}; - tuple[as[0]] = v[0]; - tuple[as[1]] = v[1]; - return (0, _vegaDataflow.ingest)(tuple); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - } - return out; + if (opt.skip) op.skip(true); + return this; + } + function update$6(op, value2, options) { + const opt = options || NO_OPT; + if (op.set(value2) || opt.force) { + this.touch(op, opt); } -}); -function source(pulse) { - return ()=>pulse.materialize(pulse.SOURCE).source; -} -// use either provided alias or accessor field name -function fieldNames(fields, as) { - if (!fields) return null; - return fields.map((f, i)=>as[i] || (0, _vegaUtil.accessorName)(f)); -} -function partition$1(data, groupby, field) { - const groups = [], get = (f)=>f(t); - let map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data.map(field)); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); + return this; + } + function pulse(op, changeset2, options) { + this.touch(op, options || NO_OPT); + const p = new Pulse(this, this._clock + (this._pulse ? 0 : 1)), t = op.pulse && op.pulse.source || []; + p.target = op; + this._input[op.id] = changeset2.pulse(p, t); + return this; + } + function Heap(cmp) { + let nodes = []; + return { + clear: () => nodes = [], + size: () => nodes.length, + peek: () => nodes[0], + push: (x2) => { + nodes.push(x2); + return siftdown(nodes, 0, nodes.length - 1, cmp); + }, + pop: () => { + const last = nodes.pop(); + let item; + if (nodes.length) { + item = nodes[0]; + nodes[0] = last; + siftup(nodes, 0, cmp); + } else { + item = last; } - g.push(field(t)); + return item; + } + }; + } + function siftdown(array2, start, idx, cmp) { + let parent, pidx; + const item = array2[idx]; + while (idx > start) { + pidx = idx - 1 >> 1; + parent = array2[pidx]; + if (cmp(item, parent) < 0) { + array2[idx] = parent; + idx = pidx; + continue; + } + break; } - return groups; -} -const Output = 'bin'; -/** - * Dot density binning for dot plot construction. - * Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. - * https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to bin. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.step] - The step size (bin width) within which dots should be - * stacked. Defaults to 1/30 of the extent of the data *field*. - * @param {boolean} [params.smooth=false] - A boolean flag indicating if dot density - * stacks should be smoothed to reduce variance. - */ function DotBin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -DotBin.Definition = { - 'type': 'DotBin', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'step', - 'type': 'number' - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': Output - } - ] -}; -const autostep = (data, field)=>(0, _vegaUtil.span)((0, _vegaUtil.extent)(data, field)) / 30; -(0, _vegaUtil.inherits)(DotBin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !(_.modified() || pulse.changed())) return pulse; // early exit - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(pulse.source, _.groupby, (0, _vegaUtil.identity)), smooth = _.smooth || false, field = _.field, step = _.step || autostep(source, field), sort = (0, _vegaDataflow.stableCompare)((a, b)=>field(a) - field(b)), as = _.as || Output, n = groups.length; - // compute dotplot bins per group - let min = Infinity, max = -Infinity, i = 0, j; - for(; i < n; ++i){ - const g = groups[i].sort(sort); - j = -1; - for (const v of (0, _vegaStatistics.dotbin)(g, step, smooth, field)){ - if (v < min) min = v; - if (v > max) max = v; - g[++j][as] = v; - } - } - this.value = { - start: min, - stop: max, - step: step - }; - return pulse.reflow(true).modifies(as); - } -}); -/** - * Wraps an expression function with access to external parameters. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function} params.expr - The expression function. The - * function should accept both a datum and a parameter object. - * This operator's value will be a new function that wraps the - * expression function with access to this operator's parameters. - */ function Expression(params) { - (0, _vegaDataflow.Operator).call(this, null, update$4, params); - this.modified(true); -} -(0, _vegaUtil.inherits)(Expression, (0, _vegaDataflow.Operator)); -function update$4(_) { - const expr = _.expr; - return this.value && !_.modified('expr') ? this.value : (0, _vegaUtil.accessor)((datum)=>expr(datum, _), (0, _vegaUtil.accessorFields)(expr), (0, _vegaUtil.accessorName)(expr)); -} -/** - * Computes extents (min/max) for a data field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field over which to compute extends. - */ function Extent(params) { - (0, _vegaDataflow.Transform).call(this, [ - undefined, - undefined - ], params); -} -Extent.Definition = { - 'type': 'Extent', - 'metadata': {}, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Extent, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const extent = this.value, field = _.field, mod = pulse.changed() || pulse.modified(field.fields) || _.modified('field'); - let min = extent[0], max = extent[1]; - if (mod || min == null) { - min = Infinity; - max = -Infinity; - } - pulse.visit(mod ? pulse.SOURCE : pulse.ADD, (t)=>{ - const v = (0, _vegaUtil.toNumber)(field(t)); - if (v != null) { - // NaNs will fail all comparisons! - if (v < min) min = v; - if (v > max) max = v; - } - }); - if (!Number.isFinite(min) || !Number.isFinite(max)) { - let name = (0, _vegaUtil.accessorName)(field); - if (name) name = ` for field "${name}"`; - pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`); - min = max = undefined; - } - this.value = [ - min, - max - ]; - } -}); -/** - * Provides a bridge between a parent transform and a target subflow that - * consumes only a subset of the tuples that pass through the parent. - * @constructor - * @param {Pulse} pulse - A pulse to use as the value of this operator. - * @param {Transform} parent - The parent transform (typically a Facet instance). - */ function Subflow(pulse, parent) { - (0, _vegaDataflow.Operator).call(this, pulse); - this.parent = parent; - this.count = 0; -} -(0, _vegaUtil.inherits)(Subflow, (0, _vegaDataflow.Operator), { + return array2[idx] = item; + } + function siftup(array2, idx, cmp) { + const start = idx, end = array2.length, item = array2[idx]; + let cidx = (idx << 1) + 1, ridx; + while (cidx < end) { + ridx = cidx + 1; + if (ridx < end && cmp(array2[cidx], array2[ridx]) >= 0) { + cidx = ridx; + } + array2[idx] = array2[cidx]; + idx = cidx; + cidx = (idx << 1) + 1; + } + array2[idx] = item; + return siftdown(array2, start, idx, cmp); + } + function Dataflow() { + this.logger(logger()); + this.logLevel(Error$1); + this._clock = 0; + this._rank = 0; + this._locale = defaultLocale(); + try { + this._loader = loader(); + } catch (e) { + } + this._touched = UniqueList(id); + this._input = {}; + this._pulse = null; + this._heap = Heap((a2, b2) => a2.qrank - b2.qrank); + this._postrun = []; + } + function logMethod(method2) { + return function() { + return this._log[method2].apply(this, arguments); + }; + } + Dataflow.prototype = { /** - * Routes pulses from this subflow to a target transform. - * @param {Transform} target - A transform that receives the subflow of tuples. - */ connect (target) { - this.detachSubflow = target.detachSubflow; - this.targets().add(target); - return target.source = this; + * The current timestamp of this dataflow. This value reflects the + * timestamp of the previous dataflow run. The dataflow is initialized + * with a stamp value of 0. The initial run of the dataflow will have + * a timestap of 1, and so on. This value will match the + * {@link Pulse.stamp} property. + * @return {number} - The current timestamp value. + */ + stamp() { + return this._clock; }, /** - * Add an 'add' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being added. - */ add (t) { - this.count += 1; - this.value.add.push(t); + * Gets or sets the loader instance to use for data file loading. A + * loader object must provide a "load" method for loading files and a + * "sanitize" method for checking URL/filename validity. Both methods + * should accept a URI and options hash as arguments, and return a Promise + * that resolves to the loaded file contents (load) or a hash containing + * sanitized URI data with the sanitized url assigned to the "href" property + * (sanitize). + * @param {object} _ - The loader instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current loader instance. Otherwise returns this Dataflow instance. + */ + loader(_) { + if (arguments.length) { + this._loader = _; + return this; + } else { + return this._loader; + } }, /** - * Add a 'rem' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being removed. - */ rem (t) { - this.count -= 1; - this.value.rem.push(t); + * Gets or sets the locale instance to use for formatting and parsing + * string values. The locale object should be provided by the + * vega-format library, and include methods such as format, timeFormat, + * utcFormat, timeParse, and utcParse. + * @param {object} _ - The locale instance to use. + * @return {object|Dataflow} - If no arguments are provided, returns + * the current locale instance. Otherwise returns this Dataflow instance. + */ + locale(_) { + if (arguments.length) { + this._locale = _; + return this; + } else { + return this._locale; + } }, /** - * Add a 'mod' tuple to the subflow pulse. - * @param {Tuple} t - The tuple being modified. - */ mod (t) { - this.value.mod.push(t); + * Get or set the logger instance used to log messages. If no arguments are + * provided, returns the current logger instance. Otherwise, sets the logger + * and return this Dataflow instance. Provided loggers must support the full + * API of logger objects generated by the vega-util logger method. Note that + * by default the log level of the new logger will be used; use the logLevel + * method to adjust the log level as needed. + */ + logger(logger2) { + if (arguments.length) { + this._log = logger2; + return this; + } else { + return this._log; + } }, /** - * Re-initialize this operator's pulse value. - * @param {Pulse} pulse - The pulse to copy from. - * @see Pulse.init - */ init (pulse) { - this.value.init(pulse, pulse.NO_SOURCE); - }, + * Logs an error message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit error messages. + */ + error: logMethod("error"), /** - * Evaluate this operator. This method overrides the - * default behavior to simply return the contained pulse value. - * @return {Pulse} - */ evaluate () { - // assert: this.value.stamp === pulse.stamp - return this.value; - } -}); -/** - * Facets a dataflow into a set of subflows based on a key. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): *} params.key - The key field to facet by. - */ function Facet(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._keys = (0, _vegaUtil.fastmap)(); // cache previously calculated key values - // keep track of active subflows, use as targets array for listeners - // this allows us to limit propagation to only updated subflows - const a = this._targets = []; - a.active = 0; - a.forEach = (f)=>{ - for(let i = 0, n = a.active; i < n; ++i)f(a[i], i, a); - }; -} -(0, _vegaUtil.inherits)(Facet, (0, _vegaDataflow.Transform), { - activate (flow) { - this._targets[this._targets.active++] = flow; - }, - // parent argument provided by PreFacet subclass - subflow (key, flow, pulse, parent) { - const flows = this.value; - let sf = (0, _vegaUtil.hasOwnProperty)(flows, key) && flows[key], df, p; - if (!sf) { - p = parent || (p = this._group[key]) && p.tuple; - df = pulse.dataflow; - sf = new Subflow(pulse.fork(pulse.NO_SOURCE), this); - df.add(sf).connect(flow(df, key, p)); - flows[key] = sf; - this.activate(sf); - } else if (sf.value.stamp < pulse.stamp) { - sf.init(pulse); - this.activate(sf); - } - return sf; - }, - clean () { - const flows = this.value; - let detached = 0; - for(const key in flows)if (flows[key].count === 0) { - const detach = flows[key].detachSubflow; - if (detach) detach(); - delete flows[key]; - ++detached; - } - // remove inactive targets from the active targets array - if (detached) { - const active = this._targets.filter((sf)=>sf && sf.count > 0); - this.initTargets(active); - } - }, - initTargets (act) { - const a = this._targets, n = a.length, m = act ? act.length : 0; - let i = 0; - for(; i < m; ++i)a[i] = act[i]; - for(; i < n && a[i] != null; ++i)a[i] = null; // ensure old flows can be garbage collected - a.active = m; - }, - transform (_, pulse) { - const df = pulse.dataflow, key = _.key, flow = _.subflow, cache = this._keys, rekey = _.modified('key'), subflow = (key)=>this.subflow(key, flow, pulse); - this._group = _.group || {}; - this.initTargets(); // reset list of active subflows - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k = cache.get(id); - if (k !== undefined) { - cache.delete(id); - subflow(k).rem(t); - } - }); - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - cache.set((0, _vegaDataflow.tupleid)(t), k); - subflow(k).add(t); - }); - if (rekey || pulse.modified(key.fields)) pulse.visit(pulse.MOD, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 === k1) subflow(k1).mod(t); - else { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - else if (pulse.changed(pulse.MOD)) pulse.visit(pulse.MOD, (t)=>{ - subflow(cache.get((0, _vegaDataflow.tupleid)(t))).mod(t); - }); - if (rekey) pulse.visit(pulse.REFLOW, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t), k0 = cache.get(id), k1 = key(t); - if (k0 !== k1) { - cache.set(id, k1); - subflow(k0).rem(t); - subflow(k1).add(t); - } - }); - if (pulse.clean()) df.runAfter(()=>{ - this.clean(); - cache.clean(); - }); - else if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return pulse; - } -}); -/** - * Generates one or more field accessor functions. - * If the 'name' parameter is an array, an array of field accessors - * will be created and the 'as' parameter will be ignored. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.name - The field name(s) to access. - * @param {string} params.as - The accessor function name. - */ function Field(params) { - (0, _vegaDataflow.Operator).call(this, null, update$3, params); -} -(0, _vegaUtil.inherits)(Field, (0, _vegaDataflow.Operator)); -function update$3(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.isArray)(_.name) ? (0, _vegaUtil.array)(_.name).map((f)=>(0, _vegaUtil.field)(f)) : (0, _vegaUtil.field)(_.name, _.as); -} -/** - * Filters data tuples according to a predicate function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The predicate expression function - * that determines a tuple's filter status. Truthy values pass the filter. - */ function Filter(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -Filter.Definition = { - 'type': 'Filter', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Filter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, cache = this.value, // cache ids of filtered tuples - output = pulse.fork(), add = output.add, rem = output.rem, mod = output.mod, test = _.expr; - let isMod = true; - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (!cache.has(id)) rem.push(t); - else cache.delete(id); - }); - pulse.visit(pulse.ADD, (t)=>{ - if (test(t, _)) add.push(t); - else cache.set((0, _vegaDataflow.tupleid)(t), 1); - }); - function revisit(t) { - const id = (0, _vegaDataflow.tupleid)(t), b = test(t, _), s = cache.get(id); - if (b && s) { - cache.delete(id); - add.push(t); - } else if (!b && !s) { - cache.set(id, 1); - rem.push(t); - } else if (isMod && b && !s) mod.push(t); - } - pulse.visit(pulse.MOD, revisit); - if (_.modified()) { - isMod = false; - pulse.visit(pulse.REFLOW, revisit); - } - if (cache.empty > df.cleanThreshold) df.runAfter(cache.clean); - return output; - } -}); -/** - * Flattens array-typed field values into new data objects. - * If multiple fields are specified, they are treated as parallel arrays, - * with output values included for each matching index (or null if missing). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of field - * accessors for the tuple fields that should be flattened. - * @param {string} [params.index] - Optional output field name for index - * value. If unspecified, no index field is included in the output. - * @param {Array<string>} [params.as] - Output field names for flattened - * array fields. Any unspecified fields will use the field name provided - * by the fields accessors. - */ function Flatten(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Flatten.Definition = { - 'type': 'Flatten', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'index', - 'type': 'string' - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Flatten, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index = _.index || null, m = as.length; - // remove any previous results - out.rem = this.value; - // generate flattened tuples - pulse.visit(pulse.SOURCE, (t)=>{ - const arrays = fields.map((f)=>f(t)), maxlen = arrays.reduce((l, a)=>Math.max(l, a.length), 0); - let i = 0, j, d, v; - for(; i < maxlen; ++i){ - d = (0, _vegaDataflow.derive)(t); - for(j = 0; j < m; ++j)d[as[j]] = (v = arrays[j][i]) == null ? null : v; - if (index) d[index] = i; - out.add.push(d); - } - }); - this.value = out.source = out.add; - if (index) out.modifies(index); - return out.modifies(as); - } -}); -/** - * Folds one more tuple fields into multiple tuples in which the field - * name and values are available under new 'key' and 'value' fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.fields - An array of field accessors - * for the tuple fields that should be folded. - * @param {Array<string>} [params.as] - Output field names for folded key - * and value fields, defaults to ['key', 'value']. - */ function Fold(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Fold.Definition = { - 'type': 'Fold', - 'metadata': { - 'generates': true + * Logs a warning message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit warning messages. + */ + warn: logMethod("warn"), + /** + * Logs a information message. By default, logged messages are written to + * console output. The message will only be logged if the current log level is + * high enough to permit information messages. + */ + info: logMethod("info"), + /** + * Logs a debug message. By default, logged messages are written to console + * output. The message will only be logged if the current log level is high + * enough to permit debug messages. + */ + debug: logMethod("debug"), + /** + * Get or set the current log level. If an argument is provided, it + * will be used as the new log level. + * @param {number} [level] - Should be one of None, Warn, Info + * @return {number} - The current log level. + */ + logLevel: logMethod("level"), + /** + * Empty entry threshold for garbage cleaning. Map data structures will + * perform cleaning once the number of empty entries exceeds this value. + */ + cleanThreshold: 1e4, + // OPERATOR REGISTRATION + add: add$4, + connect, + rank, + rerank, + // OPERATOR UPDATES + pulse, + touch, + update: update$6, + changeset, + // DATA LOADING + ingest, + parse: parse$5, + preload, + request, + // EVENT HANDLING + events: events$1, + on, + // PULSE PROPAGATION + evaluate, + run, + runAsync, + runAfter, + _enqueue: enqueue, + _getPulse: getPulse + }; + function Transform(init2, params2) { + Operator.call(this, init2, null, params2); + } + inherits(Transform, Operator, { + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Internally, this method calls {@link evaluate} to perform processing. + * If {@link evaluate} returns a falsy value, the input pulse is returned. + * This method should NOT be overridden, instead overrride {@link evaluate}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return the output pulse for this operator (or StopPropagation) + */ + run(pulse2) { + if (pulse2.stamp < this.stamp) return pulse2.StopPropagation; + let rv; + if (this.skip()) { + this.skip(false); + } else { + rv = this.evaluate(pulse2); + } + rv = rv || pulse2; + if (rv.then) { + rv = rv.then((_) => this.pulse = _); + } else if (rv !== pulse2.StopPropagation) { + this.pulse = rv; + } + return rv; }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'key', - 'value' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Fold, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, fnames = fields.map((0, _vegaUtil.accessorName)), as = _.as || [ - 'key', - 'value' - ], k = as[0], v = as[1], n = fields.length; - out.rem = this.value; - pulse.visit(pulse.SOURCE, (t)=>{ - for(let i = 0, d; i < n; ++i){ - d = (0, _vegaDataflow.derive)(t); - d[k] = fnames[i]; - d[v] = fields[i](t); - out.add.push(d); - } - }); - this.value = out.source = out.add; - return out.modifies(as); - } -}); -/** - * Invokes a function for each data tuple and saves the results as a new field. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.expr - The formula function to invoke for each tuple. - * @param {string} params.as - The field name under which to save the result. - * @param {boolean} [params.initonly=false] - If true, the formula is applied to - * added tuples only, and does not update in response to modifications. - */ function Formula(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Formula.Definition = { - 'type': 'Formula', - 'metadata': { - 'modifies': true + /** + * Overrides {@link Operator.evaluate} for transform operators. + * Marshalls parameter values and then invokes {@link transform}. + * @param {Pulse} pulse - the current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + value (including undefined) will let the input pulse pass through. + */ + evaluate(pulse2) { + const params2 = this.marshall(pulse2.stamp), out = this.transform(params2, pulse2); + params2.clear(); + return out; }, - 'params': [ - { - 'name': 'expr', - 'type': 'expr', - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'required': true - }, - { - 'name': 'initonly', - 'type': 'boolean' - } - ] -}; -(0, _vegaUtil.inherits)(Formula, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const func = _.expr, as = _.as, mod = _.modified(), flag = _.initonly ? pulse.ADD : mod ? pulse.SOURCE : pulse.modified(func.fields) || pulse.modified(as) ? pulse.ADD_MOD : pulse.ADD; - if (mod) // parameters updated, need to reflow - pulse = pulse.materialize().reflow(true); - if (!_.initonly) pulse.modifies(as); - return pulse.visit(flag, (t)=>t[as] = func(t, _)); - } -}); -/** - * Generates data tuples using a provided generator function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Parameters): object} params.generator - A tuple generator - * function. This function is given the operator parameters as input. - * Changes to any additional parameters will not trigger re-calculation - * of previously generated tuples. Only future tuples are affected. - * @param {number} params.size - The number of tuples to produce. - */ function Generate(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(Generate, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.ALL), gen = _.generator; - let data = this.value, num = _.size - data.length, add, rem, t; - if (num > 0) { - // need more tuples, generate and add - for(add = []; --num >= 0;){ - add.push(t = (0, _vegaDataflow.ingest)(gen(_))); - data.push(t); - } - out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add; - } else { - // need fewer tuples, remove - rem = data.slice(0, -num); - out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem) : rem; - data = data.slice(-num); - } - out.source = this.value = data; - return out; + /** + * Process incoming pulses. + * Subclasses should override this method to implement transforms. + * @param {Parameters} _ - The operator parameter values. + * @param {Pulse} pulse - The current dataflow pulse. + * @return {Pulse} The output pulse (or StopPropagation). A falsy return + * value (including undefined) will let the input pulse pass through. + */ + transform() { } -}); -const Methods = { - value: 'value', - median: (0, _d3Array.median), - mean: (0, _d3Array.mean), - min: (0, _d3Array.min), - max: (0, _d3Array.max) -}; -const Empty = []; -/** - * Impute missing values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to impute. - * @param {Array<function(object): *>} [params.groupby] - An array of - * accessors to determine series within which to perform imputation. - * @param {function(object): *} params.key - An accessor for a key value. - * Each key value should be unique within a group. New tuples will be - * imputed for any key values that are not found within a group. - * @param {Array<*>} [params.keyvals] - Optional array of required key - * values. New tuples will be imputed for any key values that are not - * found within a group. In addition, these values will be automatically - * augmented with the key values observed in the input data. - * @param {string} [method='value'] - The imputation method to use. One of - * 'value', 'mean', 'median', 'max', 'min'. - * @param {*} [value=0] - The constant value to use for imputation - * when using method 'value'. - */ function Impute(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -Impute.Definition = { - 'type': 'Impute', - 'metadata': { - 'changes': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'keyvals', - 'array': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'value', - 'values': [ - 'value', - 'mean', - 'median', - 'max', - 'min' - ] - }, - { - 'name': 'value', - 'default': 0 - } - ] -}; -function getValue(_) { - var m = _.method || Methods.value, v; - if (Methods[m] == null) (0, _vegaUtil.error)('Unrecognized imputation method: ' + m); - else if (m === Methods.value) { - v = _.value !== undefined ? _.value : 0; - return ()=>v; - } else return Methods[m]; -} -function getField(_) { - const f = _.field; - return (t)=>t ? f(t) : NaN; -} -(0, _vegaUtil.inherits)(Impute, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), impute = getValue(_), field = getField(_), fName = (0, _vegaUtil.accessorName)(_.field), kName = (0, _vegaUtil.accessorName)(_.key), gNames = (_.groupby || []).map((0, _vegaUtil.accessorName)), groups = partition(pulse.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m = groups.domain.length, group, value, gVals, kVal, g, i, j, l, n, t; - for(g = 0, l = groups.length; g < l; ++g){ - group = groups[g]; - gVals = group.values; - value = NaN; - // add tuples for missing values - for(j = 0; j < m; ++j){ - if (group[j] != null) continue; - kVal = groups.domain[j]; - t = { - _impute: true - }; - for(i = 0, n = gVals.length; i < n; ++i)t[gNames[i]] = gVals[i]; - t[kName] = kVal; - t[fName] = Number.isNaN(value) ? value = impute(group, field) : value; - curr.push((0, _vegaDataflow.ingest)(t)); - } + }); + const transforms = {}; + function definition$1(type2) { + const t = transform$2(type2); + return t && t.Definition || null; + } + function transform$2(type2) { + type2 = type2 && type2.toLowerCase(); + return has$1(transforms, type2) ? transforms[type2] : null; + } + function* numbers$1(values2, valueof) { + if (valueof == null) { + for (let value2 of values2) { + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; } - // update pulse with imputed tuples - if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); - if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); - this.value = curr; - return out; - } -}); -function partition(data, groupby, key, keyvals) { - var get = (f)=>f(t), groups = [], domain = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group, i, j, k, n, t; - domain.forEach((k, i)=>kMap[k] = i + 1); - for(i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = key(t); - j = kMap[k] || (kMap[k] = domain.push(k)); - gKey = (gVals = groupby ? groupby.map(get) : Empty) + ''; - if (!(group = gMap[gKey])) { - group = gMap[gKey] = []; - groups.push(group); - group.values = gVals; - } - group[j - 1] = t; - } - groups.domain = domain; - return groups; -} -/** - * Extend input tuples with aggregate values. - * Calcuates aggregate values and joins them with the input stream. - * @constructor - */ function JoinAggregate(params) { - Aggregate.call(this, params); -} -JoinAggregate.Definition = { - 'type': 'JoinAggregate', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidAggregateOps - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(JoinAggregate, Aggregate, { - transform (_, pulse) { - const aggr = this, mod = _.modified(); - let cells; - // process all input tuples to calculate aggregates - if (aggr.value && (mod || pulse.modified(aggr._inputs, true))) { - cells = aggr.value = mod ? aggr.init(_) : {}; - pulse.visit(pulse.SOURCE, (t)=>aggr.add(t)); - } else { - cells = aggr.value = aggr.value || this.init(_); - pulse.visit(pulse.REM, (t)=>aggr.rem(t)); - pulse.visit(pulse.ADD, (t)=>aggr.add(t)); - } - // update aggregation cells - aggr.changes(); - // write aggregate values to input tuples - pulse.visit(pulse.SOURCE, (t)=>{ - (0, _vegaUtil.extend)(t, cells[aggr.cellkey(t)].tuple); - }); - return pulse.reflow(mod).modifies(this._outputs); - }, - changes () { - const adds = this._adds, mods = this._mods; - let i, n; - for(i = 0, n = this._alen; i < n; ++i){ - this.celltuple(adds[i]); - adds[i] = null; // for garbage collection - } - for(i = 0, n = this._mlen; i < n; ++i){ - this.celltuple(mods[i]); - mods[i] = null; // for garbage collection - } - this._alen = this._mlen = 0; // reset list of active cells - } -}); -/** - * Compute kernel density estimates (KDE) for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {function(object): *} params.field - An accessor for the data field - * to estimate. - * @param {number} [params.bandwidth=0] - The KDE kernel bandwidth. - * If zero or unspecified, the bandwidth is automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.cumulative=false] - A boolean flag indicating if a - * density (false) or cumulative distribution (true) should be generated. - * @param {Array<number>} [params.extent] - The domain extent over which to - * plot the density. If unspecified, the [min, max] data extent is used. - * @param {string} [params.resolve='independent'] - Indicates how parameters for - * multiple densities should be resolved. If "independent" (the default), each - * density may have its own domain extent and dynamic number of curve sample - * steps. If "shared", the KDE transform will ensure that all densities are - * defined over a shared domain and curve steps, enabling stacking. - * @param {number} [params.minsteps=25] - The minimum number of curve samples - * for plotting the density. - * @param {number} [params.maxsteps=200] - The maximum number of curve samples - * for plotting the density. - * @param {number} [params.steps] - The exact number of curve samples for - * plotting the density. If specified, overrides both minsteps and maxsteps - * to set an exact number of uniform samples. Useful in conjunction with - * a fixed extent to ensure consistent sample points for stacked densities. - */ function KDE(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE.Definition = { - 'type': 'KDE', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'cumulative', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'steps', - 'type': 'number' - }, - { - 'name': 'minsteps', - 'type': 'number', - 'default': 25 - }, - { - 'name': 'maxsteps', - 'type': 'number', - 'default': 200 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'value', - 'density' - ] - } - ] -}; -(0, _vegaUtil.inherits)(KDE, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), bandwidth = _.bandwidth, method = _.cumulative ? 'cdf' : 'pdf', as = _.as || [ - 'value', - 'density' - ], values = []; - let domain = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; - if (method !== 'pdf' && method !== 'cdf') (0, _vegaUtil.error)('Invalid density method: ' + method); - if (_.resolve === 'shared') { - if (!domain) domain = (0, _vegaUtil.extent)(source, _.field); - minsteps = maxsteps = _.steps || maxsteps; - } - groups.forEach((g)=>{ - const density = (0, _vegaStatistics.randomKDE)(g, bandwidth)[method], scale = _.counts ? g.length : 1, local = domain || (0, _vegaUtil.extent)(g); - (0, _vegaStatistics.sampleCurve)(density, local, minsteps, maxsteps).forEach((v)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = v[0]; - t[as[1]] = v[1] * scale; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + } + } else { + let index2 = -1; + for (let value2 of values2) { + value2 = valueof(value2, ++index2, values2); + if (value2 != null && value2 !== "" && (value2 = +value2) >= value2) { + yield value2; } - return out; + } } -}); -/** - * Generates a key function. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<string>} params.fields - The field name(s) for the key function. - * @param {boolean} params.flat - A boolean flag indicating if the field names - * should be treated as flat property names, side-stepping nested field - * lookups normally indicated by dot or bracket notation. - */ function Key(params) { - (0, _vegaDataflow.Operator).call(this, null, update$2, params); -} -(0, _vegaUtil.inherits)(Key, (0, _vegaDataflow.Operator)); -function update$2(_) { - return this.value && !_.modified() ? this.value : (0, _vegaUtil.key)(_.fields, _.flat); -} -/** - * Load and parse data from an external source. Marshalls parameter - * values and then invokes the Dataflow request method. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.url - The URL to load from. - * @param {object} params.format - The data format options. - */ function Load(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this._pending = null; -} -(0, _vegaUtil.inherits)(Load, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow; - if (this._pending) // update state and return pulse - return output(this, pulse, this._pending); - if (stop(_)) return pulse.StopPropagation; - if (_.values) // parse and ingest values, return output pulse - return output(this, pulse, df.parse(_.values, _.format)); - else if (_.async) { - // return promise for non-blocking async loading - const p = df.request(_.url, _.format).then((res)=>{ - this._pending = (0, _vegaUtil.array)(res.data); - return (df)=>df.touch(this); - }); - return { - async: p - }; - } else // return promise for synchronous loading - return df.request(_.url, _.format).then((res)=>output(this, pulse, (0, _vegaUtil.array)(res.data))); - } -}); -function stop(_) { - return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format')); -} -function output(op, pulse, data) { - data.forEach((0, _vegaDataflow.ingest)); - const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE); - out.rem = op.value; - op.value = out.source = out.add = data; - op._pending = null; - if (out.rem.length) out.clean(true); - return out; -} -/** - * Extend tuples by joining them with values from a lookup table. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Map} params.index - The lookup table map. - * @param {Array<function(object): *} params.fields - The fields to lookup. - * @param {Array<string>} params.as - Output field names for each lookup value. - * @param {*} [params.default] - A default value to use if lookup fails. - */ function Lookup(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -Lookup.Definition = { - 'type': 'Lookup', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'index', - 'type': 'index', - 'params': [ - { - 'name': 'from', - 'type': 'data', - 'required': true - }, - { - 'name': 'key', - 'type': 'field', - 'required': true - } - ] - }, - { - 'name': 'values', - 'type': 'field', - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - }, - { - 'name': 'default', - 'default': null - } - ] -}; -(0, _vegaUtil.inherits)(Lookup, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const keys = _.fields, index = _.index, values = _.values, defaultValue = _.default == null ? null : _.default, reset = _.modified(), n = keys.length; - let flag = reset ? pulse.SOURCE : pulse.ADD, out = pulse, as = _.as, set, m, mods; - if (values) { - m = values.length; - if (n > 1 && !as) (0, _vegaUtil.error)('Multi-field lookup requires explicit "as" parameter.'); - if (as && as.length !== n * m) (0, _vegaUtil.error)('The "as" parameter has too few output field names.'); - as = as || values.map((0, _vegaUtil.accessorName)); - set = function(t) { - for(var i = 0, k = 0, j, v; i < n; ++i){ - v = index.get(keys[i](t)); - if (v == null) for(j = 0; j < m; ++j, ++k)t[as[k]] = defaultValue; - else for(j = 0; j < m; ++j, ++k)t[as[k]] = values[j](v); - } - }; - } else { - if (!as) (0, _vegaUtil.error)('Missing output field names.'); - set = function(t) { - for(var i = 0, v; i < n; ++i){ - v = index.get(keys[i](t)); - t[as[i]] = v == null ? defaultValue : v; - } - }; - } - if (reset) out = pulse.reflow(true); - else { - mods = keys.some((k)=>pulse.modified(k.fields)); - flag |= mods ? pulse.MOD : 0; - } - pulse.visit(flag, set); - return out.modifies(as); - } -}); -/** - * Computes global min/max extents over a collection of extents. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<number>>} params.extents - The input extents. - */ function MultiExtent(params) { - (0, _vegaDataflow.Operator).call(this, null, update$1, params); -} -(0, _vegaUtil.inherits)(MultiExtent, (0, _vegaDataflow.Operator)); -function update$1(_) { - if (this.value && !_.modified()) return this.value; - const ext = _.extents, n = ext.length; - let min = Infinity, max = -Infinity, i, e; - for(i = 0; i < n; ++i){ - e = ext[i]; - if (e[0] < min) min = e[0]; - if (e[1] > max) max = e[1]; + } + function quantiles(array2, p, f) { + const values2 = Float64Array.from(numbers$1(array2, f)); + values2.sort(ascending$1); + return p.map((_) => quantileSorted(values2, _)); + } + function quartiles(array2, f) { + return quantiles(array2, [0.25, 0.5, 0.75], f); + } + function estimateBandwidth(array2, f) { + const n = array2.length, d = deviation(array2, f), q = quartiles(array2, f), h2 = (q[2] - q[0]) / 1.34, v = Math.min(d, h2) || d || Math.abs(q[0]) || 1; + return 1.06 * v * Math.pow(n, -0.2); + } + function bin(_) { + const maxb = _.maxbins || 20, base2 = _.base || 10, logb = Math.log(base2), div = _.divide || [5, 2]; + let min2 = _.extent[0], max2 = _.extent[1], step, level, minstep, v, i, n; + const span2 = _.span || max2 - min2 || Math.abs(min2) || 1; + if (_.step) { + step = _.step; + } else if (_.steps) { + v = span2 / maxb; + for (i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i) ; + step = _.steps[Math.max(0, i - 1)]; + } else { + level = Math.ceil(Math.log(maxb) / logb); + minstep = _.minstep || 0; + step = Math.max(minstep, Math.pow(base2, Math.round(Math.log(span2) / logb) - level)); + while (Math.ceil(span2 / step) > maxb) { + step *= base2; + } + for (i = 0, n = div.length; i < n; ++i) { + v = step / div[i]; + if (v >= minstep && span2 / v <= maxb) step = v; + } + } + v = Math.log(step); + const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base2, -precision - 1); + if (_.nice || _.nice === void 0) { + v = Math.floor(min2 / step + eps) * step; + min2 = min2 < v ? v - step : v; + max2 = Math.ceil(max2 / step) * step; } - return [ - min, - max - ]; -} -/** - * Merge a collection of value arrays. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<Array<*>>} params.values - The input value arrrays. - */ function MultiValues(params) { - (0, _vegaDataflow.Operator).call(this, null, update, params); -} -(0, _vegaUtil.inherits)(MultiValues, (0, _vegaDataflow.Operator)); -function update(_) { - return this.value && !_.modified() ? this.value : _.values.reduce((data, _)=>data.concat(_), []); -} -/** - * Operator whose value is simply its parameter hash. This operator is - * useful for enabling reactive updates to values of nested objects. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Params(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Params, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.modified(_.modified()); - this.value = _; - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples - } -}); -/** - * Aggregate and pivot selected field values to become new fields. - * This operator is useful to construction cross-tabulations. - * @constructor - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. These fields act just like groupby fields of an Aggregate transform. - * @param {function(object): *} params.field - The field to pivot on. The unique - * values of this field become new field names in the output stream. - * @param {function(object): *} params.value - The field to populate pivoted fields. - * The aggregate values of this field become the values of the new pivoted fields. - * @param {string} [params.op] - The aggregation operation for the value field, - * applied per cell in the output stream. The default is "sum". - * @param {number} [params.limit] - An optional parameter indicating the maximum - * number of pivoted fields to generate. The pivoted field names are sorted in - * ascending order prior to enforcing the limit. - */ function Pivot(params) { - Aggregate.call(this, params); -} -Pivot.Definition = { - 'type': 'Pivot', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'value', - 'type': 'field', - 'required': true - }, - { - 'name': 'op', - 'type': 'enum', - 'values': ValidAggregateOps, - 'default': 'sum' - }, - { - 'name': 'limit', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'key', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(Pivot, Aggregate, { - _transform: Aggregate.prototype.transform, - transform (_, pulse) { - return this._transform(aggregateParams(_, pulse), pulse); - } -}); -// Shoehorn a pivot transform into an aggregate transform! -// First collect all unique pivot field values. -// Then generate aggregate fields for each output pivot field. -function aggregateParams(_, pulse) { - const key = _.field, value = _.value, op = (_.op === 'count' ? '__count__' : _.op) || 'sum', fields = (0, _vegaUtil.accessorFields)(key).concat((0, _vegaUtil.accessorFields)(value)), keys = pivotKeys(key, _.limit || 0, pulse); - // if data stream content changes, pivot fields may change - // flag parameter modification to ensure re-initialization - if (pulse.changed()) _.set('__pivot__', null, null, true); return { - key: _.key, - groupby: _.groupby, - ops: keys.map(()=>op), - fields: keys.map((k)=>get(k, key, value, fields)), - as: keys.map((k)=>k + ''), - modified: _.modified.bind(_) - }; -} -// Generate aggregate field accessor. -// Output NaN for non-existent values; aggregator will ignore! -function get(k, key, value, fields) { - return (0, _vegaUtil.accessor)((d)=>key(d) === k ? value(d) : NaN, fields, k + ''); -} -// Collect (and optionally limit) all unique pivot values. -function pivotKeys(key, limit, pulse) { - const map = {}, list = []; - pulse.visit(pulse.SOURCE, (t)=>{ - const k = key(t); - if (!map[k]) { - map[k] = 1; - list.push(k); + start: min2, + stop: max2 === min2 ? min2 + step : max2, + step + }; + } + var random = Math.random; + function setRandom(r) { + random = r; + } + function bootstrapCI(array2, samples, alpha, f) { + if (!array2.length) return [void 0, void 0]; + const values2 = Float64Array.from(numbers$1(array2, f)), n = values2.length, m2 = samples; + let a2, i, j, mu; + for (j = 0, mu = Array(m2); j < m2; ++j) { + for (a2 = 0, i = 0; i < n; ++i) { + a2 += values2[~~(random() * n)]; + } + mu[j] = a2 / n; + } + mu.sort(ascending$1); + return [quantile$1(mu, alpha / 2), quantile$1(mu, 1 - alpha / 2)]; + } + function dotbin(array2, step, smooth, f) { + f = f || ((_) => _); + const n = array2.length, v = new Float64Array(n); + let i = 0, j = 1, a2 = f(array2[0]), b2 = a2, w2 = a2 + step, x2; + for (; j < n; ++j) { + x2 = f(array2[j]); + if (x2 >= w2) { + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + w2 = x2 + step; + a2 = x2; + } + b2 = x2; + } + b2 = (a2 + b2) / 2; + for (; i < j; ++i) v[i] = b2; + return smooth ? smoothing(v, step + step / 4) : v; + } + function smoothing(v, thresh) { + const n = v.length; + let a2 = 0, b2 = 1, c2, d; + while (v[a2] === v[b2]) ++b2; + while (b2 < n) { + c2 = b2 + 1; + while (v[b2] === v[c2]) ++c2; + if (v[b2] - v[b2 - 1] < thresh) { + d = b2 + (a2 + c2 - b2 - b2 >> 1); + while (d < b2) v[d++] = v[b2]; + while (d > b2) v[d--] = v[a2]; + } + a2 = b2; + b2 = c2; + } + return v; + } + function lcg$2(seed) { + return function() { + seed = (1103515245 * seed + 12345) % 2147483647; + return seed / 2147483647; + }; + } + function integer(min2, max2) { + if (max2 == null) { + max2 = min2; + min2 = 0; + } + let a2, b2, d; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + d = b2 - a2; + return dist2; + } else { + return a2; } - }); - list.sort((0, _vegaUtil.ascending)); - return limit ? list.slice(0, limit) : list; -} -/** - * Partitions pre-faceted data into tuple subflows. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(Dataflow, string): Operator} params.subflow - A function - * that generates a subflow of operators and returns its root operator. - * @param {function(object): Array<object>} params.field - The field - * accessor for an array of subflow tuple objects. - */ function PreFacet(params) { - Facet.call(this, params); -} -(0, _vegaUtil.inherits)(PreFacet, Facet, { - transform (_, pulse) { - const flow = _.subflow, field = _.field, subflow = (t)=>this.subflow((0, _vegaDataflow.tupleid)(t), flow, pulse, t); - if (_.modified('field') || field && pulse.modified((0, _vegaUtil.accessorFields)(field))) (0, _vegaUtil.error)('PreFacet does not support field modification.'); - this.initTargets(); // reset list of active subflows - if (field) { - pulse.visit(pulse.MOD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.mod(_)); - }); - pulse.visit(pulse.ADD, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.add((0, _vegaDataflow.ingest)(_))); - }); - pulse.visit(pulse.REM, (t)=>{ - const sf = subflow(t); - field(t).forEach((_)=>sf.rem(_)); - }); + }, + max(_) { + if (arguments.length) { + b2 = _ || 0; + d = b2 - a2; + return dist2; } else { - pulse.visit(pulse.MOD, (t)=>subflow(t).mod(t)); - pulse.visit(pulse.ADD, (t)=>subflow(t).add(t)); - pulse.visit(pulse.REM, (t)=>subflow(t).rem(t)); - } - if (pulse.clean()) pulse.runAfter(()=>this.clean()); - return pulse; - } -}); -/** - * Performs a relational projection, copying selected fields from source - * tuples to a new set of derived tuples. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *} params.fields - The fields to project, - * as an array of field accessors. If unspecified, all fields will be - * copied with names unchanged. - * @param {Array<string>} [params.as] - Output field names for each projected - * field. Any unspecified fields will use the field name provided by - * the field accessor. - */ function Project(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Project.Definition = { - 'type': 'Project', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Project, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive = fields ? (s, t)=>project(s, t, fields, as) : (0, _vegaDataflow.rederive); - let lut; - if (this.value) lut = this.value; - else { - pulse = pulse.addAll(); - lut = this.value = {}; + return b2; } - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = derive(t, (0, _vegaDataflow.ingest)({})); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - out.mod.push(derive(t, lut[(0, _vegaDataflow.tupleid)(t)])); - }); - return out; + }, + sample() { + return a2 + Math.floor(d * random()); + }, + pdf(x2) { + return x2 === Math.floor(x2) && x2 >= a2 && x2 < b2 ? 1 / d : 0; + }, + cdf(x2) { + const v = Math.floor(x2); + return v < a2 ? 0 : v >= b2 ? 1 : (v - a2 + 1) / d; + }, + icdf(p) { + return p >= 0 && p <= 1 ? a2 - 1 + Math.floor(p * d) : NaN; + } + }; + return dist2.min(min2).max(max2); + } + const SQRT2PI = Math.sqrt(2 * Math.PI); + const SQRT2 = Math.SQRT2; + let nextSample = NaN; + function sampleNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + let x2 = 0, y2 = 0, rds, c2; + if (nextSample === nextSample) { + x2 = nextSample; + nextSample = NaN; + } else { + do { + x2 = random() * 2 - 1; + y2 = random() * 2 - 1; + rds = x2 * x2 + y2 * y2; + } while (rds === 0 || rds > 1); + c2 = Math.sqrt(-2 * Math.log(rds) / rds); + x2 *= c2; + nextSample = y2 * c2; + } + return mean2 + x2 * stdev; + } + function densityNormal(value2, mean2, stdev) { + stdev = stdev == null ? 1 : stdev; + const z = (value2 - (mean2 || 0)) / stdev; + return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); + } + function cumulativeNormal(value2, mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z = (value2 - mean2) / stdev, Z = Math.abs(z); + let cd; + if (Z > 37) { + cd = 0; + } else { + const exp2 = Math.exp(-Z * Z / 2); + let sum2; + if (Z < 7.07106781186547) { + sum2 = 0.0352624965998911 * Z + 0.700383064443688; + sum2 = sum2 * Z + 6.37396220353165; + sum2 = sum2 * Z + 33.912866078383; + sum2 = sum2 * Z + 112.079291497871; + sum2 = sum2 * Z + 221.213596169931; + sum2 = sum2 * Z + 220.206867912376; + cd = exp2 * sum2; + sum2 = 0.0883883476483184 * Z + 1.75566716318264; + sum2 = sum2 * Z + 16.064177579207; + sum2 = sum2 * Z + 86.7807322029461; + sum2 = sum2 * Z + 296.564248779674; + sum2 = sum2 * Z + 637.333633378831; + sum2 = sum2 * Z + 793.826512519948; + sum2 = sum2 * Z + 440.413735824752; + cd = cd / sum2; + } else { + sum2 = Z + 0.65; + sum2 = Z + 4 / sum2; + sum2 = Z + 3 / sum2; + sum2 = Z + 2 / sum2; + sum2 = Z + 1 / sum2; + cd = exp2 / sum2 / 2.506628274631; + } } -}); -function project(s, t, fields, as) { - for(let i = 0, n = fields.length; i < n; ++i)t[as[i]] = fields[i](s); - return t; -} -/** - * Proxy the value of another operator as a pure signal value. - * Ensures no tuples are propagated. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {*} params.value - The value to proxy, becomes the value of this operator. - */ function Proxy(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Proxy, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = _.value; - return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Generates sample quantile values from an input data stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - An accessor for the data field - * over which to calculate quantile values. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {Array<number>} [params.probs] - An array of probabilities in - * the range (0, 1) for which to compute quantile values. If not specified, - * the *step* parameter will be used. - * @param {Array<number>} [params.step=0.01] - A probability step size for - * sampling quantile values. All values from one-half the step size up to - * 1 (exclusive) will be sampled. This parameter is only used if the - * *quantiles* parameter is not provided. - */ function Quantile(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Quantile.Definition = { - 'type': 'Quantile', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'probs', - 'type': 'number', - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 0.01 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'default': [ - 'prob', - 'value' - ] - } - ] -}; -const EPSILON = 1e-14; -(0, _vegaUtil.inherits)(Quantile, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), as = _.as || [ - 'prob', - 'value' - ]; - if (this.value && !_.modified() && !pulse.changed()) { - out.source = this.value; - return out; - } - const source = pulse.materialize(pulse.SOURCE).source, groups = partition$1(source, _.groupby, _.field), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), values = [], step = _.step || 0.01, p = _.probs || (0, _d3Array.range)(step / 2, 1 - EPSILON, step), n = p.length; - groups.forEach((g)=>{ - const q = (0, _vegaStatistics.quantiles)(g, p); - for(let i = 0; i < n; ++i){ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[i]; - t[as[1]] = q[i]; - values.push((0, _vegaDataflow.ingest)(t)); - } - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; - return out; + return z > 0 ? 1 - cd : cd; + } + function quantileNormal(p, mean2, stdev) { + if (p < 0 || p > 1) return NaN; + return (mean2 || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); + } + function erfinv(x2) { + let w2 = -Math.log((1 - x2) * (1 + x2)), p; + if (w2 < 6.25) { + w2 -= 3.125; + p = -364441206401782e-35; + p = -16850591381820166e-35 + p * w2; + p = 128584807152564e-32 + p * w2; + p = 11157877678025181e-33 + p * w2; + p = -1333171662854621e-31 + p * w2; + p = 20972767875968562e-33 + p * w2; + p = 6637638134358324e-30 + p * w2; + p = -4054566272975207e-29 + p * w2; + p = -8151934197605472e-29 + p * w2; + p = 26335093153082323e-28 + p * w2; + p = -12975133253453532e-27 + p * w2; + p = -5415412054294628e-26 + p * w2; + p = 10512122733215323e-25 + p * w2; + p = -4112633980346984e-24 + p * w2; + p = -29070369957882005e-24 + p * w2; + p = 42347877827932404e-23 + p * w2; + p = -13654692000834679e-22 + p * w2; + p = -13882523362786469e-21 + p * w2; + p = 18673420803405714e-20 + p * w2; + p = -740702534166267e-18 + p * w2; + p = -0.006033670871430149 + p * w2; + p = 0.24015818242558962 + p * w2; + p = 1.6536545626831027 + p * w2; + } else if (w2 < 16) { + w2 = Math.sqrt(w2) - 3.25; + p = 22137376921775787e-25; + p = 9075656193888539e-23 + p * w2; + p = -27517406297064545e-23 + p * w2; + p = 18239629214389228e-24 + p * w2; + p = 15027403968909828e-22 + p * w2; + p = -4013867526981546e-21 + p * w2; + p = 29234449089955446e-22 + p * w2; + p = 12475304481671779e-21 + p * w2; + p = -47318229009055734e-21 + p * w2; + p = 6828485145957318e-20 + p * w2; + p = 24031110387097894e-21 + p * w2; + p = -3550375203628475e-19 + p * w2; + p = 9532893797373805e-19 + p * w2; + p = -0.0016882755560235047 + p * w2; + p = 0.002491442096107851 + p * w2; + p = -0.003751208507569241 + p * w2; + p = 0.005370914553590064 + p * w2; + p = 1.0052589676941592 + p * w2; + p = 3.0838856104922208 + p * w2; + } else if (Number.isFinite(w2)) { + w2 = Math.sqrt(w2) - 5; + p = -27109920616438573e-27; + p = -2555641816996525e-25 + p * w2; + p = 15076572693500548e-25 + p * w2; + p = -3789465440126737e-24 + p * w2; + p = 761570120807834e-23 + p * w2; + p = -1496002662714924e-23 + p * w2; + p = 2914795345090108e-23 + p * w2; + p = -6771199775845234e-23 + p * w2; + p = 22900482228026655e-23 + p * w2; + p = -99298272942317e-20 + p * w2; + p = 4526062597223154e-21 + p * w2; + p = -1968177810553167e-20 + p * w2; + p = 7599527703001776e-20 + p * w2; + p = -21503011930044477e-20 + p * w2; + p = -13871931833623122e-20 + p * w2; + p = 1.0103004648645344 + p * w2; + p = 4.849906401408584 + p * w2; + } else { + p = Infinity; } -}); -/** - * Relays a data stream between data processing pipelines. - * If the derive parameter is set, this transform will create derived - * copies of observed tuples. This provides derived data streams in which - * modifications to the tuples do not pollute an upstream data source. - * @param {object} params - The parameters for this operator. - * @param {number} [params.derive=false] - Boolean flag indicating if - * the transform should make derived copies of incoming tuples. - * @constructor - */ function Relay(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Relay, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let out, lut; - if (this.value) lut = this.value; - else { - out = pulse = pulse.addAll(); - lut = this.value = {}; - } - if (_.derive) { - out = pulse.fork(pulse.NO_SOURCE); - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - out.rem.push(lut[id]); - lut[id] = null; - }); - pulse.visit(pulse.ADD, (t)=>{ - const dt = (0, _vegaDataflow.derive)(t); - lut[(0, _vegaDataflow.tupleid)(t)] = dt; - out.add.push(dt); - }); - pulse.visit(pulse.MOD, (t)=>{ - const dt = lut[(0, _vegaDataflow.tupleid)(t)]; - for(const k in t){ - dt[k] = t[k]; - // down stream writes may overwrite re-derived tuples - // conservatively mark all source fields as modified - out.modifies(k); - } - out.mod.push(dt); - }); + return p * x2; + } + function gaussian(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; + } else { + return mu; } - return out; - } -}); -/** - * Samples tuples passing through this operator. - * Uses reservoir sampling to maintain a representative sample. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} [params.size=1000] - The maximum number of samples. - */ function Sample(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.count = 0; -} -Sample.Definition = { - 'type': 'Sample', - 'metadata': {}, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'default': 1000 - } - ] -}; -(0, _vegaUtil.inherits)(Sample, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE), mod = _.modified('size'), num = _.size, map = this.value.reduce((m, t)=>(m[(0, _vegaDataflow.tupleid)(t)] = 1, m), {}); - let res = this.value, cnt = this.count, cap = 0; - // sample reservoir update function - function update(t) { - let p, idx; - if (res.length < num) res.push(t); - else { - idx = ~~((cnt + 1) * (0, _vegaStatistics.random)()); - if (idx < res.length && idx >= cap) { - p = res[idx]; - if (map[(0, _vegaDataflow.tupleid)(p)]) out.rem.push(p); // eviction - res[idx] = t; - } - } - ++cnt; - } - if (pulse.rem.length) { - // find all tuples that should be removed, add to output - pulse.visit(pulse.REM, (t)=>{ - const id = (0, _vegaDataflow.tupleid)(t); - if (map[id]) { - map[id] = -1; - out.rem.push(t); - } - --cnt; - }); - // filter removed tuples out of the sample reservoir - res = res.filter((t)=>map[(0, _vegaDataflow.tupleid)(t)] !== -1); - } - if ((pulse.rem.length || mod) && res.length < num && pulse.source) { - // replenish sample if backing data source is available - cap = cnt = res.length; - pulse.visit(pulse.SOURCE, (t)=>{ - // update, but skip previously sampled tuples - if (!map[(0, _vegaDataflow.tupleid)(t)]) update(t); - }); - cap = -1; + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; } - if (mod && res.length > num) { - const n = res.length - num; - for(let i = 0; i < n; ++i){ - map[(0, _vegaDataflow.tupleid)(res[i])] = -1; - out.rem.push(res[i]); - } - res = res.slice(n); + }, + sample: () => sampleNormal(mu, sigma), + pdf: (value2) => densityNormal(value2, mu, sigma), + cdf: (value2) => cumulativeNormal(value2, mu, sigma), + icdf: (p) => quantileNormal(p, mu, sigma) + }; + return dist2.mean(mean2).stdev(stdev); + } + function kde(support, bandwidth2) { + const kernel = gaussian(); + let n = 0; + const dist2 = { + data(_) { + if (arguments.length) { + support = _; + n = _ ? _.length : 0; + return dist2.bandwidth(bandwidth2); + } else { + return support; } - if (pulse.mod.length) // propagate modified tuples in the sample reservoir - pulse.visit(pulse.MOD, (t)=>{ - if (map[(0, _vegaDataflow.tupleid)(t)]) out.mod.push(t); - }); - if (pulse.add.length) // update sample reservoir - pulse.visit(pulse.ADD, update); - if (pulse.add.length || cap < 0) // output newly added tuples - out.add = res.filter((t)=>!map[(0, _vegaDataflow.tupleid)(t)]); - this.count = cnt; - this.value = out.source = res; - return out; - } -}); -/** - * Generates data tuples for a specified sequence range of numbers. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {number} params.start - The first number in the sequence. - * @param {number} params.stop - The last number (exclusive) in the sequence. - * @param {number} [params.step=1] - The step size between numbers in the sequence. - */ function Sequence(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Sequence.Definition = { - 'type': 'Sequence', - 'metadata': { - 'generates': true, - 'changes': true - }, - 'params': [ - { - 'name': 'start', - 'type': 'number', - 'required': true - }, - { - 'name': 'stop', - 'type': 'number', - 'required': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'data' - } - ] -}; -(0, _vegaUtil.inherits)(Sequence, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return; - const out = pulse.materialize().fork(pulse.MOD), as = _.as || 'data'; - out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem; - this.value = (0, _d3Array.range)(_.start, _.stop, _.step || 1).map((v)=>{ - const t = {}; - t[as] = v; - return (0, _vegaDataflow.ingest)(t); - }); - out.add = pulse.add.concat(this.value); - return out; + }, + bandwidth(_) { + if (!arguments.length) return bandwidth2; + bandwidth2 = _; + if (!bandwidth2 && support) bandwidth2 = estimateBandwidth(support); + return dist2; + }, + sample() { + return support[~~(random() * n)] + bandwidth2 * kernel.sample(); + }, + pdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.pdf((x2 - support[i]) / bandwidth2); + } + return y2 / bandwidth2 / n; + }, + cdf(x2) { + let y2 = 0, i = 0; + for (; i < n; ++i) { + y2 += kernel.cdf((x2 - support[i]) / bandwidth2); + } + return y2 / n; + }, + icdf() { + throw Error("KDE icdf not supported."); + } + }; + return dist2.data(support); + } + function sampleLogNormal(mean2, stdev) { + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + return Math.exp(mean2 + sampleNormal() * stdev); + } + function densityLogNormal(value2, mean2, stdev) { + if (value2 <= 0) return 0; + mean2 = mean2 || 0; + stdev = stdev == null ? 1 : stdev; + const z = (Math.log(value2) - mean2) / stdev; + return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value2); + } + function cumulativeLogNormal(value2, mean2, stdev) { + return cumulativeNormal(Math.log(value2), mean2, stdev); + } + function quantileLogNormal(p, mean2, stdev) { + return Math.exp(quantileNormal(p, mean2, stdev)); + } + function lognormal(mean2, stdev) { + let mu, sigma; + const dist2 = { + mean(_) { + if (arguments.length) { + mu = _ || 0; + return dist2; + } else { + return mu; + } + }, + stdev(_) { + if (arguments.length) { + sigma = _ == null ? 1 : _; + return dist2; + } else { + return sigma; + } + }, + sample: () => sampleLogNormal(mu, sigma), + pdf: (value2) => densityLogNormal(value2, mu, sigma), + cdf: (value2) => cumulativeLogNormal(value2, mu, sigma), + icdf: (p) => quantileLogNormal(p, mu, sigma) + }; + return dist2.mean(mean2).stdev(stdev); + } + function mixture$1(dists, weights) { + let m2 = 0, w2; + function normalize2(x2) { + const w3 = []; + let sum2 = 0, i; + for (i = 0; i < m2; ++i) { + sum2 += w3[i] = x2[i] == null ? 1 : +x2[i]; + } + for (i = 0; i < m2; ++i) { + w3[i] /= sum2; + } + return w3; } -}); -/** - * Propagates a new pulse without any tuples so long as the input - * pulse contains some added, removed or modified tuples. - * @param {object} params - The parameters for this operator. - * @constructor - */ function Sieve(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Sieve, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.value = pulse.source; - return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation; - } -}); -/** - * Discretize dates to specific time units. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The data field containing date/time values. - */ function TimeUnit(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const OUTPUT = [ - 'unit0', - 'unit1' -]; -TimeUnit.Definition = { - 'type': 'TimeUnit', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field', - 'required': true - }, - { - 'name': 'interval', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'units', - 'type': 'enum', - 'values': (0, _vegaTime.TIME_UNITS), - 'array': true - }, - { - 'name': 'step', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'maxbins', - 'type': 'number', - 'default': 40 - }, - { - 'name': 'extent', - 'type': 'date', - 'array': true - }, - { - 'name': 'timezone', - 'type': 'enum', - 'default': 'local', - 'values': [ - 'local', - 'utc' - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': OUTPUT - } - ] -}; -(0, _vegaUtil.inherits)(TimeUnit, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const field = _.field, band = _.interval !== false, utc = _.timezone === 'utc', floor = this._floor(_, pulse), offset = (utc ? (0, _vegaTime.utcInterval) : (0, _vegaTime.timeInterval))(floor.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor.step; - let min = floor.start || Infinity, max = floor.stop || -Infinity, flag = pulse.ADD; - if (_.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(field))) { - pulse = pulse.reflow(true); - flag = pulse.SOURCE; - min = Infinity; - max = -Infinity; - } - pulse.visit(flag, (t)=>{ - const v = field(t); - let a, b; - if (v == null) { - t[u0] = null; - if (band) t[u1] = null; - } else { - t[u0] = a = b = floor(v); - if (band) t[u1] = b = offset(a, step); - if (a < min) min = a; - if (b > max) max = b; - } - }); - floor.start = min; - floor.stop = max; - return pulse.modifies(band ? as : u0); - }, - _floor (_, pulse) { - const utc = _.timezone === 'utc'; - // get parameters - const { units, step } = _.units ? { - units: _.units, - step: _.step || 1 - } : (0, _vegaTime.timeBin)({ - extent: _.extent || (0, _vegaUtil.extent)(pulse.materialize(pulse.SOURCE).source, _.field), - maxbins: _.maxbins - }); - // check / standardize time units - const tunits = (0, _vegaTime.timeUnits)(units), prev = this.value || {}, floor = (utc ? (0, _vegaTime.utcFloor) : (0, _vegaTime.timeFloor))(tunits, step); - floor.unit = (0, _vegaUtil.peek)(tunits); - floor.units = tunits; - floor.step = step; - floor.start = prev.start; - floor.stop = prev.stop; - return this.value = floor; - } -}); -/** - * An index that maps from unique, string-coerced, field values to tuples. - * Assumes that the field serves as a unique key with no duplicate values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The field accessor to index. - */ function TupleIndex(params) { - (0, _vegaDataflow.Transform).call(this, (0, _vegaUtil.fastmap)(), params); -} -(0, _vegaUtil.inherits)(TupleIndex, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const df = pulse.dataflow, field = _.field, index = this.value, set = (t)=>index.set(field(t), t); - let mod = true; - if (_.modified('field') || pulse.modified(field.fields)) { - index.clear(); - pulse.visit(pulse.SOURCE, set); - } else if (pulse.changed()) { - pulse.visit(pulse.REM, (t)=>index.delete(field(t))); - pulse.visit(pulse.ADD, set); - } else mod = false; - this.modified(mod); - if (index.empty > df.cleanThreshold) df.runAfter(index.clean); - return pulse.fork(); - } -}); -/** - * Extracts an array of values. Assumes the source data has already been - * reduced as needed (e.g., by an upstream Aggregate transform). - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The domain field to extract. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting the values. The comparator will be - * applied to backing tuples prior to value extraction. - */ function Values(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Values, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields); - if (run) this.value = (_.sort ? pulse.source.slice().sort((0, _vegaDataflow.stableCompare)(_.sort)) : pulse.source).map(_.field); - } -}); -function WindowOp(op, field, param, as) { - const fn = WindowOps[op](field, param); - return { - init: fn.init || (0, _vegaUtil.zero), - update: function(w, t) { - t[as] = fn.next(w); + const dist2 = { + weights(_) { + if (arguments.length) { + w2 = normalize2(weights = _ || []); + return dist2; + } + return weights; + }, + distributions(_) { + if (arguments.length) { + if (_) { + m2 = _.length; + dists = _; + } else { + m2 = 0; + dists = []; + } + return dist2.weights(weights); + } + return dists; + }, + sample() { + const r = random(); + let d = dists[m2 - 1], v = w2[0], i = 0; + for (; i < m2 - 1; v += w2[++i]) { + if (r < v) { + d = dists[i]; + break; + } + } + return d.sample(); + }, + pdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].pdf(x2); + } + return p; + }, + cdf(x2) { + let p = 0, i = 0; + for (; i < m2; ++i) { + p += w2[i] * dists[i].cdf(x2); } + return p; + }, + icdf() { + throw Error("Mixture icdf not supported."); + } }; -} -const WindowOps = { - row_number: function() { - return { - next: (w)=>w.index + 1 - }; - }, - rank: function() { - let rank; - return { - init: ()=>rank = 1, - next: (w)=>{ - const i = w.index, data = w.data; - return i && w.compare(data[i - 1], data[i]) ? rank = i + 1 : rank; - } - }; - }, - dense_rank: function() { - let drank; - return { - init: ()=>drank = 1, - next: (w)=>{ - const i = w.index, d = w.data; - return i && w.compare(d[i - 1], d[i]) ? ++drank : drank; - } - }; - }, - percent_rank: function() { - const rank = WindowOps.rank(), next = rank.next; - return { - init: rank.init, - next: (w)=>(next(w) - 1) / (w.data.length - 1) - }; - }, - cume_dist: function() { - let cume; - return { - init: ()=>cume = 0, - next: (w)=>{ - const d = w.data, c = w.compare; - let i = w.index; - if (cume < i) { - while(i + 1 < d.length && !c(d[i], d[i + 1]))++i; - cume = i; - } - return (1 + cume) / d.length; - } - }; - }, - ntile: function(field, num) { - num = +num; - if (!(num > 0)) (0, _vegaUtil.error)('ntile num must be greater than zero.'); - const cume = WindowOps.cume_dist(), next = cume.next; - return { - init: cume.init, - next: (w)=>Math.ceil(num * next(w)) - }; - }, - lag: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index - offset; - return i >= 0 ? field(w.data[i]) : null; - } - }; - }, - lead: function(field, offset) { - offset = +offset || 1; - return { - next: (w)=>{ - const i = w.index + offset, d = w.data; - return i < d.length ? field(d[i]) : null; - } - }; - }, - first_value: function(field) { - return { - next: (w)=>field(w.data[w.i0]) - }; - }, - last_value: function(field) { - return { - next: (w)=>field(w.data[w.i1 - 1]) - }; - }, - nth_value: function(field, nth) { - nth = +nth; - if (!(nth > 0)) (0, _vegaUtil.error)('nth_value nth must be greater than zero.'); - return { - next: (w)=>{ - const i = w.i0 + (nth - 1); - return i < w.i1 ? field(w.data[i]) : null; - } - }; - }, - prev_value: function(field) { - let prev; - return { - init: ()=>prev = null, - next: (w)=>{ - const v = field(w.data[w.index]); - return v != null ? prev = v : prev; - } - }; - }, - next_value: function(field) { - let v, i; - return { - init: ()=>(v = null, i = -1), - next: (w)=>{ - const d = w.data; - return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]); - } - }; + return dist2.distributions(dists).weights(weights); + } + function sampleUniform(min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; } -}; -function find(field, data, index) { - for(let n = data.length; index < n; ++index){ - const v = field(data[index]); - if (v != null) return index; + return min2 + (max2 - min2) * random(); + } + function densityUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; } - return -1; -} -const ValidWindowOps = Object.keys(WindowOps); -function WindowState(_) { - const ops = (0, _vegaUtil.array)(_.ops), fields = (0, _vegaUtil.array)(_.fields), params = (0, _vegaUtil.array)(_.params), aggregate_params = (0, _vegaUtil.array)(_.aggregate_params), as = (0, _vegaUtil.array)(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map = {}, counts = [], measures = []; - let countOnly = true; - function visitInputs(f) { - (0, _vegaUtil.array)((0, _vegaUtil.accessorFields)(f)).forEach((_)=>inputs[_] = 1); + return value2 >= min2 && value2 <= max2 ? 1 / (max2 - min2) : 0; + } + function cumulativeUniform(value2, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; } - visitInputs(_.sort); - ops.forEach((op, i)=>{ - const field = fields[i], param = params[i], aggregate_param = aggregate_params[i] || null, mname = (0, _vegaUtil.accessorName)(field), name = measureName(op, mname, as[i]); - visitInputs(field); - outputs.push(name); - // Window operation - if ((0, _vegaUtil.hasOwnProperty)(WindowOps, op)) windows.push(WindowOp(op, field, param, name)); - else { - if (field == null && op !== 'count') (0, _vegaUtil.error)('Null aggregate field specified.'); - if (op === 'count') { - counts.push(name); - return; - } - countOnly = false; - let m = map[mname]; - if (!m) { - m = map[mname] = []; - m.field = field; - measures.push(m); - } - m.push(createMeasure(op, aggregate_param, name)); + return value2 < min2 ? 0 : value2 > max2 ? 1 : (value2 - min2) / (max2 - min2); + } + function quantileUniform(p, min2, max2) { + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return p >= 0 && p <= 1 ? min2 + p * (max2 - min2) : NaN; + } + function uniform(min2, max2) { + let a2, b2; + const dist2 = { + min(_) { + if (arguments.length) { + a2 = _ || 0; + return dist2; + } else { + return a2; } - }); - if (counts.length || measures.length) this.cell = cell(measures, counts, countOnly); - this.inputs = Object.keys(inputs); -} -const prototype = WindowState.prototype; -prototype.init = function() { - this.windows.forEach((_)=>_.init()); - if (this.cell) this.cell.init(); -}; -prototype.update = function(w, t) { - const cell = this.cell, wind = this.windows, data = w.data, m = wind && wind.length; - let j; - if (cell) { - for(j = w.p0; j < w.i0; ++j)cell.rem(data[j]); - for(j = w.p1; j < w.i1; ++j)cell.add(data[j]); - cell.set(t); - } - for(j = 0; j < m; ++j)wind[j].update(w, t); -}; -function cell(measures, counts, countOnly) { - measures = measures.map((m)=>compileMeasures(m, m.field)); - const cell = { - num: 0, - agg: null, - store: false, - count: counts - }; - if (!countOnly) { - var n = measures.length, a = cell.agg = Array(n), i = 0; - for(; i < n; ++i)a[i] = new measures[i](cell); - } - if (cell.store) var store = cell.data = new TupleStore(); - cell.add = function(t) { - cell.num += 1; - if (countOnly) return; - if (store) store.add(t); - for(let i = 0; i < n; ++i)a[i].add(a[i].get(t), t); - }; - cell.rem = function(t) { - cell.num -= 1; - if (countOnly) return; - if (store) store.rem(t); - for(let i = 0; i < n; ++i)a[i].rem(a[i].get(t), t); - }; - cell.set = function(t) { - let i, n; - // consolidate stored values - if (store) store.values(); - // update tuple properties - for(i = 0, n = counts.length; i < n; ++i)t[counts[i]] = cell.num; - if (!countOnly) for(i = 0, n = a.length; i < n; ++i)a[i].set(t); - }; - cell.init = function() { - cell.num = 0; - if (store) store.reset(); - for(let i = 0; i < n; ++i)a[i].init(); - }; - return cell; -} -/** - * Perform window calculations and write results to the input stream. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator function for sorting tuples within a window. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors by which to partition tuples into separate windows. - * @param {Array<string>} params.ops - An array of strings indicating window operations to perform. - * @param {Array<function(object): *>} [params.fields] - An array of accessors - * for data fields to use as inputs to window operations. - * @param {Array<*>} [params.params] - An array of parameter values for window operations. - * @param {Array<number>} [params.aggregate_params] - An optional array of parameter values for aggregation operations. - * @param {Array<string>} [params.as] - An array of output field names for window operations. - * @param {Array<number>} [params.frame] - Window frame definition as two-element array. - * @param {boolean} [params.ignorePeers=false] - If true, base window frame boundaries on row - * number alone, ignoring peers with identical sort values. If false (default), - * the window boundaries will be adjusted to include peer values. - */ function Window(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); - this._mlen = 0; - this._mods = []; -} -Window.Definition = { - 'type': 'Window', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'ops', - 'type': 'enum', - 'array': true, - 'values': ValidWindowOps.concat(ValidAggregateOps) - }, - { - 'name': 'params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'aggregate_params', - 'type': 'number', - 'null': true, - 'array': true - }, - { - 'name': 'fields', - 'type': 'field', - 'null': true, - 'array': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'array': true - }, - { - 'name': 'frame', - 'type': 'number', - 'null': true, - 'array': true, - 'length': 2, - 'default': [ - null, - 0 - ] - }, - { - 'name': 'ignorePeers', - 'type': 'boolean', - 'default': false - } - ] -}; -(0, _vegaUtil.inherits)(Window, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - this.stamp = pulse.stamp; - const mod = _.modified(), cmp = (0, _vegaDataflow.stableCompare)(_.sort), key = groupkey(_.groupby), group = (t)=>this.group(key(t)); - // initialize window state - let state = this.state; - if (!state || mod) state = this.state = new WindowState(_); - // partition input tuples - if (mod || pulse.modified(state.inputs)) { - this.value = {}; - pulse.visit(pulse.SOURCE, (t)=>group(t).add(t)); + }, + max(_) { + if (arguments.length) { + b2 = _ == null ? 1 : _; + return dist2; } else { - pulse.visit(pulse.REM, (t)=>group(t).remove(t)); - pulse.visit(pulse.ADD, (t)=>group(t).add(t)); - } - // perform window calculations for each modified partition - for(let i = 0, n = this._mlen; i < n; ++i)processPartition(this._mods[i], state, cmp, _); - this._mlen = 0; - this._mods = []; - // TODO don't reflow everything? - return pulse.reflow(mod).modifies(state.outputs); - }, - group (key) { - let group = this.value[key]; - if (!group) { - group = this.value[key] = SortedList((0, _vegaDataflow.tupleid)); - group.stamp = -1; - } - if (group.stamp < this.stamp) { - group.stamp = this.stamp; - this._mods[this._mlen++] = group; - } - return group; - } -}); -function processPartition(list, state, cmp, _) { - const sort = _.sort, range = sort && !_.ignorePeers, frame = _.frame || [ - null, - 0 - ], data = list.data(cmp), // use cmp for stable sort - n = data.length, b = range ? (0, _d3Array.bisector)(sort) : null, w = { - i0: 0, - i1: 0, - p0: 0, - p1: 0, - index: 0, - data: data, - compare: sort || (0, _vegaUtil.constant)(-1) + return b2; + } + }, + sample: () => sampleUniform(a2, b2), + pdf: (value2) => densityUniform(value2, a2, b2), + cdf: (value2) => cumulativeUniform(value2, a2, b2), + icdf: (p) => quantileUniform(p, a2, b2) }; - state.init(); - for(let i = 0; i < n; ++i){ - setWindow(w, frame, i, n); - if (range) adjustRange(w, b); - state.update(w, data[i]); - } -} -function setWindow(w, f, i, n) { - w.p0 = w.i0; - w.p1 = w.i1; - w.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); - w.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); - w.index = i; -} -// if frame type is 'range', adjust window for peer values -function adjustRange(w, bisect) { - const r0 = w.i0, r1 = w.i1 - 1, c = w.compare, d = w.data, n = d.length - 1; - if (r0 > 0 && !c(d[r0], d[r0 - 1])) w.i0 = bisect.left(d, d[r0]); - if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]); -} - -},{"vega-util":"bApja","vega-dataflow":"3NitK","vega-statistics":"5ncfv","d3-array":"6IwJG","vega-time":"27kpp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ncfv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bandwidthNRD", ()=>estimateBandwidth); -parcelHelpers.export(exports, "bin", ()=>bin); -parcelHelpers.export(exports, "bootstrapCI", ()=>bootstrapCI); -parcelHelpers.export(exports, "cumulativeLogNormal", ()=>cumulativeLogNormal); -parcelHelpers.export(exports, "cumulativeNormal", ()=>cumulativeNormal); -parcelHelpers.export(exports, "cumulativeUniform", ()=>cumulativeUniform); -parcelHelpers.export(exports, "densityLogNormal", ()=>densityLogNormal); -parcelHelpers.export(exports, "densityNormal", ()=>densityNormal); -parcelHelpers.export(exports, "densityUniform", ()=>densityUniform); -parcelHelpers.export(exports, "dotbin", ()=>dotbin); -parcelHelpers.export(exports, "quantileLogNormal", ()=>quantileLogNormal); -parcelHelpers.export(exports, "quantileNormal", ()=>quantileNormal); -parcelHelpers.export(exports, "quantileUniform", ()=>quantileUniform); -parcelHelpers.export(exports, "quantiles", ()=>quantiles); -parcelHelpers.export(exports, "quartiles", ()=>quartiles); -parcelHelpers.export(exports, "random", ()=>random); -parcelHelpers.export(exports, "randomInteger", ()=>integer); -parcelHelpers.export(exports, "randomKDE", ()=>kde); -parcelHelpers.export(exports, "randomLCG", ()=>lcg); -parcelHelpers.export(exports, "randomLogNormal", ()=>lognormal); -parcelHelpers.export(exports, "randomMixture", ()=>mixture); -parcelHelpers.export(exports, "randomNormal", ()=>gaussian); -parcelHelpers.export(exports, "randomUniform", ()=>uniform); -parcelHelpers.export(exports, "regressionConstant", ()=>constant); -parcelHelpers.export(exports, "regressionExp", ()=>exp); -parcelHelpers.export(exports, "regressionLinear", ()=>linear); -parcelHelpers.export(exports, "regressionLoess", ()=>loess); -parcelHelpers.export(exports, "regressionLog", ()=>log); -parcelHelpers.export(exports, "regressionPoly", ()=>poly); -parcelHelpers.export(exports, "regressionPow", ()=>pow); -parcelHelpers.export(exports, "regressionQuad", ()=>quad); -parcelHelpers.export(exports, "sampleCurve", ()=>sampleCurve); -parcelHelpers.export(exports, "sampleLogNormal", ()=>sampleLogNormal); -parcelHelpers.export(exports, "sampleNormal", ()=>sampleNormal); -parcelHelpers.export(exports, "sampleUniform", ()=>sampleUniform); -parcelHelpers.export(exports, "setRandom", ()=>setRandom); -var _d3Array = require("d3-array"); -function* numbers(values, valueof) { - if (valueof == null) { - for (let value of values)if (value != null && value !== '' && (value = +value) >= value) yield value; - } else { - let index = -1; - for (let value of values){ - value = valueof(value, ++index, values); - if (value != null && value !== '' && (value = +value) >= value) yield value; - } - } -} -function quantiles(array, p, f) { - const values = Float64Array.from(numbers(array, f)); - // don't depend on return value from typed array sort call - // protects against undefined sort results in Safari (vega/vega-lite#4964) - values.sort((0, _d3Array.ascending)); - return p.map((_)=>(0, _d3Array.quantileSorted)(values, _)); -} -function quartiles(array, f) { - return quantiles(array, [ - 0.25, - 0.50, - 0.75 - ], f); -} -// Scott, D. W. (1992) Multivariate Density Estimation: -// Theory, Practice, and Visualization. Wiley. -function estimateBandwidth(array, f) { - const n = array.length, d = (0, _d3Array.deviation)(array, f), q = quartiles(array, f), h = (q[2] - q[0]) / 1.34, v = Math.min(d, h) || d || Math.abs(q[0]) || 1; - return 1.06 * v * Math.pow(n, -0.2); -} -function bin(_) { - // determine range - const maxb = _.maxbins || 20, base = _.base || 10, logb = Math.log(base), div = _.divide || [ - 5, - 2 - ]; - let min = _.extent[0], max = _.extent[1], step, level, minstep, v, i, n; - const span = _.span || max - min || Math.abs(min) || 1; - if (_.step) // if step size is explicitly given, use that - step = _.step; - else if (_.steps) { - // if provided, limit choice to acceptable step sizes - v = span / maxb; - for(i = 0, n = _.steps.length; i < n && _.steps[i] < v; ++i); - step = _.steps[Math.max(0, i - 1)]; - } else { - // else use span to determine step size - level = Math.ceil(Math.log(maxb) / logb); - minstep = _.minstep || 0; - step = Math.max(minstep, Math.pow(base, Math.round(Math.log(span) / logb) - level)); - // increase step size if too many bins - while(Math.ceil(span / step) > maxb)step *= base; - // decrease step size if allowed - for(i = 0, n = div.length; i < n; ++i){ - v = step / div[i]; - if (v >= minstep && span / v <= maxb) step = v; - } - } - // update precision, min and max - v = Math.log(step); - const precision = v >= 0 ? 0 : ~~(-v / logb) + 1, eps = Math.pow(base, -precision - 1); - if (_.nice || _.nice === undefined) { - v = Math.floor(min / step + eps) * step; - min = min < v ? v - step : v; - max = Math.ceil(max / step) * step; + if (max2 == null) { + max2 = min2 == null ? 1 : min2; + min2 = 0; + } + return dist2.min(min2).max(max2); + } + function constant$4(data2, x2, y2) { + let mean2 = 0, n = 0; + for (const d of data2) { + const val = y2(d); + if (x2(d) == null || val == null || isNaN(val)) continue; + mean2 += (val - mean2) / ++n; } return { - start: min, - stop: max === min ? min + step : max, - step: step + coef: [mean2], + predict: () => mean2, + rSquared: 0 }; -} -var random = Math.random; -function setRandom(r) { - random = r; -} -function bootstrapCI(array, samples, alpha, f) { - if (!array.length) return [ - undefined, - undefined - ]; - const values = Float64Array.from(numbers(array, f)), n = values.length, m = samples; - let a, i, j, mu; - for(j = 0, mu = Array(m); j < m; ++j){ - for(a = 0, i = 0; i < n; ++i)a += values[~~(random() * n)]; - mu[j] = a / n; + } + function ols(uX, uY, uXY, uX2) { + const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; + return [intercept, slope]; + } + function points(data2, x2, y2, sort2) { + data2 = data2.filter((d2) => { + let u2 = x2(d2), v = y2(d2); + return u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v; + }); + if (sort2) { + data2.sort((a2, b2) => x2(a2) - x2(b2)); } - mu.sort((0, _d3Array.ascending)); - return [ - (0, _d3Array.quantile)(mu, alpha / 2), - (0, _d3Array.quantile)(mu, 1 - alpha / 2) - ]; -} -// Dot density binning for dot plot construction. -// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999. -// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf -function dotbin(array, step, smooth, f) { - f = f || ((_)=>_); - const n = array.length, v = new Float64Array(n); - let i = 0, j = 1, a = f(array[0]), b = a, w = a + step, x; - for(; j < n; ++j){ - x = f(array[j]); - if (x >= w) { - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - w = x + step; - a = x; - } - b = x; - } - b = (a + b) / 2; - for(; i < j; ++i)v[i] = b; - return smooth ? smoothing(v, step + step / 4) : v; -} -// perform smoothing to reduce variance -// swap points between "adjacent" stacks -// Wilkinson defines adjacent as within step/4 units -function smoothing(v, thresh) { - const n = v.length; - let a = 0, b = 1, c, d; - // get left stack - while(v[a] === v[b])++b; - while(b < n){ - // get right stack - c = b + 1; - while(v[b] === v[c])++c; - // are stacks adjacent? - // if so, compare sizes and swap as needed - if (v[b] - v[b - 1] < thresh) { - d = b + (a + c - b - b >> 1); - while(d < b)v[d++] = v[b]; - while(d > b)v[d--] = v[a]; - } - // update left stack indices - a = b; - b = c; + const n = data2.length, X3 = new Float64Array(n), Y3 = new Float64Array(n); + let i = 0, ux = 0, uy = 0, xv, yv, d; + for (d of data2) { + X3[i] = xv = +x2(d); + Y3[i] = yv = +y2(d); + ++i; + ux += (xv - ux) / i; + uy += (yv - uy) / i; + } + for (i = 0; i < n; ++i) { + X3[i] -= ux; + Y3[i] -= uy; + } + return [X3, Y3, ux, uy]; + } + function visitPoints(data2, x2, y2, callback) { + let i = -1, u2, v; + for (const d of data2) { + u2 = x2(d); + v = y2(d); + if (u2 != null && (u2 = +u2) >= u2 && v != null && (v = +v) >= v) { + callback(u2, v, ++i); + } } - return v; -} -function lcg(seed) { - // Random numbers using a Linear Congruential Generator with seed value - // Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator - return function() { - seed = (1103515245 * seed + 12345) % 2147483647; - return seed / 2147483647; - }; -} -function integer(min, max) { - if (max == null) { - max = min; - min = 0; - } - let a, b, d; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - d = b - a; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ || 0; - d = b - a; - return dist; - } else return b; - }, - sample () { - return a + Math.floor(d * random()); - }, - pdf (x) { - return x === Math.floor(x) && x >= a && x < b ? 1 / d : 0; - }, - cdf (x) { - const v = Math.floor(x); - return v < a ? 0 : v >= b ? 1 : (v - a + 1) / d; - }, - icdf (p) { - return p >= 0 && p <= 1 ? a - 1 + Math.floor(p * d) : NaN; + } + function rSquared(data2, x2, y2, uY, predict) { + let SSE = 0, SST = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const sse = dy - predict(dx), sst = dy - uY; + SSE += sse * sse; + SST += sst * sst; + }); + return 1 - SSE / SST; + } + function linear$2(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * x3; + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) + }; + } + function log$3(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + ++n; + dx = Math.log(dx); + X3 += (dx - X3) / n; + Y3 += (dy - Y3) / n; + XY += (dx * dy - XY) / n; + X22 += (dx * dx - X22) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] + coef[1] * Math.log(x3); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, Y3, predict) + }; + } + function exp$1(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2); + let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly2, xy; + visitPoints(data2, x2, y2, (_, dy) => { + dx = xv[n++]; + ly2 = Math.log(dy); + xy = dx * dy; + YL += (dy * ly2 - YL) / n; + XY += (xy - XY) / n; + XYL += (xy * ly2 - XYL) / n; + X2Y += (dx * xy - X2Y) / n; + }); + const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x3) => Math.exp(c0 + c1 * (x3 - ux)); + return { + coef: [Math.exp(c0 - c1 * ux), c1], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) + }; + } + function pow$3(data2, x2, y2) { + let X3 = 0, Y3 = 0, XY = 0, X22 = 0, YS = 0, n = 0; + visitPoints(data2, x2, y2, (dx, dy) => { + const lx2 = Math.log(dx), ly2 = Math.log(dy); + ++n; + X3 += (lx2 - X3) / n; + Y3 += (ly2 - Y3) / n; + XY += (lx2 * ly2 - XY) / n; + X22 += (lx2 * lx2 - X22) / n; + YS += (dy - YS) / n; + }); + const coef = ols(X3, Y3, XY, X22), predict = (x3) => coef[0] * Math.pow(x3, coef[1]); + coef[0] = Math.exp(coef[0]); + return { + coef, + predict, + rSquared: rSquared(data2, x2, y2, YS, predict) + }; + } + function quad(data2, x2, y2) { + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length; + let X22 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x22; + for (i = 0; i < n; ) { + dx = xv[i]; + dy = yv[i++]; + x22 = dx * dx; + X22 += (x22 - X22) / i; + X3 += (x22 * dx - X3) / i; + X4 += (x22 * x22 - X4) / i; + XY += (dx * dy - XY) / i; + X2Y += (x22 * dy - X2Y) / i; + } + const X2X2 = X4 - X22 * X22, d = X22 * X2X2 - X3 * X3, a2 = (X2Y * X22 - XY * X3) / d, b2 = (XY * X2X2 - X2Y * X3) / d, c2 = -a2 * X22, predict = (x3) => { + x3 = x3 - ux; + return a2 * x3 * x3 + b2 * x3 + c2 + uy; + }; + return { + coef: [c2 - b2 * ux + a2 * ux * ux + uy, b2 - 2 * a2 * ux, a2], + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) + }; + } + function poly(data2, x2, y2, order) { + if (order === 0) return constant$4(data2, x2, y2); + if (order === 1) return linear$2(data2, x2, y2); + if (order === 2) return quad(data2, x2, y2); + const [xv, yv, ux, uy] = points(data2, x2, y2), n = xv.length, lhs = [], rhs = [], k = order + 1; + let i, j, l, v, c2; + for (i = 0; i < k; ++i) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i) * yv[l]; + } + lhs.push(v); + c2 = new Float64Array(k); + for (j = 0; j < k; ++j) { + for (l = 0, v = 0; l < n; ++l) { + v += Math.pow(xv[l], i + j); } + c2[j] = v; + } + rhs.push(c2); + } + rhs.push(lhs); + const coef = gaussianElimination(rhs), predict = (x3) => { + x3 -= ux; + let y3 = uy + coef[0] + coef[1] * x3 + coef[2] * x3 * x3; + for (i = 3; i < k; ++i) y3 += coef[i] * Math.pow(x3, i); + return y3; }; - return dist.min(min).max(max); -} -const SQRT2PI = Math.sqrt(2 * Math.PI); -const SQRT2 = Math.SQRT2; -let nextSample = NaN; -function sampleNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - let x = 0, y = 0, rds, c; - if (nextSample === nextSample) { - x = nextSample; - nextSample = NaN; - } else { - do { - x = random() * 2 - 1; - y = random() * 2 - 1; - rds = x * x + y * y; - }while (rds === 0 || rds > 1); - c = Math.sqrt(-2 * Math.log(rds) / rds); // Box-Muller transform - x *= c; - nextSample = y * c; - } - return mean + x * stdev; -} -function densityNormal(value, mean, stdev) { - stdev = stdev == null ? 1 : stdev; - const z = (value - (mean || 0)) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI); -} -// Approximation from West (2009) -// Better Approximations to Cumulative Normal Functions -function cumulativeNormal(value, mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (value - mean) / stdev, Z = Math.abs(z); - let cd; - if (Z > 37) cd = 0; - else { - const exp = Math.exp(-Z * Z / 2); - let sum; - if (Z < 7.07106781186547) { - sum = 3.52624965998911e-02 * Z + 0.700383064443688; - sum = sum * Z + 6.37396220353165; - sum = sum * Z + 33.912866078383; - sum = sum * Z + 112.079291497871; - sum = sum * Z + 221.213596169931; - sum = sum * Z + 220.206867912376; - cd = exp * sum; - sum = 8.83883476483184e-02 * Z + 1.75566716318264; - sum = sum * Z + 16.064177579207; - sum = sum * Z + 86.7807322029461; - sum = sum * Z + 296.564248779674; - sum = sum * Z + 637.333633378831; - sum = sum * Z + 793.826512519948; - sum = sum * Z + 440.413735824752; - cd = cd / sum; - } else { - sum = Z + 0.65; - sum = Z + 4 / sum; - sum = Z + 3 / sum; - sum = Z + 2 / sum; - sum = Z + 1 / sum; - cd = exp / sum / 2.506628274631; - } - } - return z > 0 ? 1 - cd : cd; -} -// Approximation of Probit function using inverse error function. -function quantileNormal(p, mean, stdev) { - if (p < 0 || p > 1) return NaN; - return (mean || 0) + (stdev == null ? 1 : stdev) * SQRT2 * erfinv(2 * p - 1); -} -// Approximate inverse error function. Implementation from "Approximating -// the erfinv function" by Mike Giles, GPU Computing Gems, volume 2, 2010. -// Ported from Apache Commons Math, http://www.apache.org/licenses/LICENSE-2.0 -function erfinv(x) { - // beware that the logarithm argument must be - // commputed as (1.0 - x) * (1.0 + x), - // it must NOT be simplified as 1.0 - x * x as this - // would induce rounding errors near the boundaries +/-1 - let w = -Math.log((1 - x) * (1 + x)), p; - if (w < 6.25) { - w -= 3.125; - p = -0.00000000000000000000364441206401782; - p = -0.00000000000000000016850591381820166 + p * w; - p = 1.2858480715256400167e-18 + p * w; - p = 1.115787767802518096e-17 + p * w; - p = -0.0000000000000001333171662854621 + p * w; - p = 2.0972767875968561637e-17 + p * w; - p = 6.6376381343583238325e-15 + p * w; - p = -0.00000000000004054566272975207 + p * w; - p = -0.00000000000008151934197605472 + p * w; - p = 2.6335093153082322977e-12 + p * w; - p = -0.000000000012975133253453532 + p * w; - p = -0.00000000005415412054294628 + p * w; - p = 1.051212273321532285e-09 + p * w; - p = -0.000000004112633980346984 + p * w; - p = -0.000000029070369957882005 + p * w; - p = 4.2347877827932403518e-07 + p * w; - p = -0.0000013654692000834679 + p * w; - p = -0.000013882523362786469 + p * w; - p = 0.0001867342080340571352 + p * w; - p = -0.000740702534166267 + p * w; - p = -0.006033670871430149 + p * w; - p = 0.24015818242558961693 + p * w; - p = 1.6536545626831027356 + p * w; - } else if (w < 16.0) { - w = Math.sqrt(w) - 3.25; - p = 2.2137376921775787049e-09; - p = 9.0756561938885390979e-08 + p * w; - p = -0.00000027517406297064545 + p * w; - p = 1.8239629214389227755e-08 + p * w; - p = 1.5027403968909827627e-06 + p * w; - p = -0.000004013867526981546 + p * w; - p = 2.9234449089955446044e-06 + p * w; - p = 1.2475304481671778723e-05 + p * w; - p = -0.000047318229009055734 + p * w; - p = 6.8284851459573175448e-05 + p * w; - p = 2.4031110387097893999e-05 + p * w; - p = -0.0003550375203628475 + p * w; - p = 0.00095328937973738049703 + p * w; - p = -0.0016882755560235047 + p * w; - p = 0.0024914420961078508066 + p * w; - p = -0.003751208507569241 + p * w; - p = 0.005370914553590063617 + p * w; - p = 1.0052589676941592334 + p * w; - p = 3.0838856104922207635 + p * w; - } else if (Number.isFinite(w)) { - w = Math.sqrt(w) - 5.0; - p = -0.000000000027109920616438573; - p = -0.0000000002555641816996525 + p * w; - p = 1.5076572693500548083e-09 + p * w; - p = -0.000000003789465440126737 + p * w; - p = 7.6157012080783393804e-09 + p * w; - p = -0.00000001496002662714924 + p * w; - p = 2.9147953450901080826e-08 + p * w; - p = -0.00000006771199775845234 + p * w; - p = 2.2900482228026654717e-07 + p * w; - p = -0.00000099298272942317 + p * w; - p = 4.5260625972231537039e-06 + p * w; - p = -0.00001968177810553167 + p * w; - p = 7.5995277030017761139e-05 + p * w; - p = -0.00021503011930044477 + p * w; - p = -0.00013871931833623122 + p * w; - p = 1.0103004648645343977 + p * w; - p = 4.8499064014085844221 + p * w; - } else p = Infinity; - return p * x; -} -function gaussian(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleNormal(mu, sigma), - pdf: (value)=>densityNormal(value, mu, sigma), - cdf: (value)=>cumulativeNormal(value, mu, sigma), - icdf: (p)=>quantileNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function kde(support, bandwidth) { - const kernel = gaussian(); - let n = 0; - const dist = { - data (_) { - if (arguments.length) { - support = _; - n = _ ? _.length : 0; - return dist.bandwidth(bandwidth); - } else return support; - }, - bandwidth (_) { - if (!arguments.length) return bandwidth; - bandwidth = _; - if (!bandwidth && support) bandwidth = estimateBandwidth(support); - return dist; - }, - sample () { - return support[~~(random() * n)] + bandwidth * kernel.sample(); - }, - pdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.pdf((x - support[i]) / bandwidth); - return y / bandwidth / n; - }, - cdf (x) { - let y = 0, i = 0; - for(; i < n; ++i)y += kernel.cdf((x - support[i]) / bandwidth); - return y / n; - }, - icdf () { - throw Error('KDE icdf not supported.'); - } - }; - return dist.data(support); -} -function sampleLogNormal(mean, stdev) { - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - return Math.exp(mean + sampleNormal() * stdev); -} -function densityLogNormal(value, mean, stdev) { - if (value <= 0) return 0; - mean = mean || 0; - stdev = stdev == null ? 1 : stdev; - const z = (Math.log(value) - mean) / stdev; - return Math.exp(-0.5 * z * z) / (stdev * SQRT2PI * value); -} -function cumulativeLogNormal(value, mean, stdev) { - return cumulativeNormal(Math.log(value), mean, stdev); -} -function quantileLogNormal(p, mean, stdev) { - return Math.exp(quantileNormal(p, mean, stdev)); -} -function lognormal(mean, stdev) { - let mu, sigma; - const dist = { - mean (_) { - if (arguments.length) { - mu = _ || 0; - return dist; - } else return mu; - }, - stdev (_) { - if (arguments.length) { - sigma = _ == null ? 1 : _; - return dist; - } else return sigma; - }, - sample: ()=>sampleLogNormal(mu, sigma), - pdf: (value)=>densityLogNormal(value, mu, sigma), - cdf: (value)=>cumulativeLogNormal(value, mu, sigma), - icdf: (p)=>quantileLogNormal(p, mu, sigma) - }; - return dist.mean(mean).stdev(stdev); -} -function mixture(dists, weights) { - let m = 0, w; - function normalize(x) { - const w = []; - let sum = 0, i; - for(i = 0; i < m; ++i)sum += w[i] = x[i] == null ? 1 : +x[i]; - for(i = 0; i < m; ++i)w[i] /= sum; - return w; - } - const dist = { - weights (_) { - if (arguments.length) { - w = normalize(weights = _ || []); - return dist; - } - return weights; - }, - distributions (_) { - if (arguments.length) { - if (_) { - m = _.length; - dists = _; - } else { - m = 0; - dists = []; - } - return dist.weights(weights); - } - return dists; - }, - sample () { - const r = random(); - let d = dists[m - 1], v = w[0], i = 0; - // first select distribution - for(; i < m - 1; v += w[++i])if (r < v) { - d = dists[i]; - break; - } - // then sample from it - return d.sample(); - }, - pdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].pdf(x); - return p; - }, - cdf (x) { - let p = 0, i = 0; - for(; i < m; ++i)p += w[i] * dists[i].cdf(x); - return p; - }, - icdf () { - throw Error('Mixture icdf not supported.'); - } - }; - return dist.distributions(dists).weights(weights); -} -function sampleUniform(min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return min + (max - min) * random(); -} -function densityUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value >= min && value <= max ? 1 / (max - min) : 0; -} -function cumulativeUniform(value, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return value < min ? 0 : value > max ? 1 : (value - min) / (max - min); -} -function quantileUniform(p, min, max) { - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return p >= 0 && p <= 1 ? min + p * (max - min) : NaN; -} -function uniform(min, max) { - let a, b; - const dist = { - min (_) { - if (arguments.length) { - a = _ || 0; - return dist; - } else return a; - }, - max (_) { - if (arguments.length) { - b = _ == null ? 1 : _; - return dist; - } else return b; - }, - sample: ()=>sampleUniform(a, b), - pdf: (value)=>densityUniform(value, a, b), - cdf: (value)=>cumulativeUniform(value, a, b), - icdf: (p)=>quantileUniform(p, a, b) - }; - if (max == null) { - max = min == null ? 1 : min; - min = 0; - } - return dist.min(min).max(max); -} -function constant(data, x, y) { - let mean = 0, n = 0; - for (const d of data){ - const val = y(d); - if (x(d) == null || val == null || isNaN(val)) continue; - mean += (val - mean) / ++n; - } - return { - coef: [ - mean - ], - predict: ()=>mean, - rSquared: 0 - }; -} -// Ordinary Least Squares -function ols(uX, uY, uXY, uX2) { - const delta = uX2 - uX * uX, slope = Math.abs(delta) < 1e-24 ? 0 : (uXY - uX * uY) / delta, intercept = uY - slope * uX; - return [ - intercept, - slope - ]; -} -function points(data, x, y, sort) { - data = data.filter((d)=>{ - let u = x(d), v = y(d); - return u != null && (u = +u) >= u && v != null && (v = +v) >= v; - }); - if (sort) data.sort((a, b)=>x(a) - x(b)); - const n = data.length, X = new Float64Array(n), Y = new Float64Array(n); - // extract values, calculate means - let i = 0, ux = 0, uy = 0, xv, yv, d; - for (d of data){ - X[i] = xv = +x(d); - Y[i] = yv = +y(d); - ++i; - ux += (xv - ux) / i; - uy += (yv - uy) / i; - } - // mean center the data - for(i = 0; i < n; ++i){ - X[i] -= ux; - Y[i] -= uy; - } - return [ - X, - Y, - ux, - uy - ]; -} -function visitPoints(data, x, y, callback) { - let i = -1, u, v; - for (const d of data){ - u = x(d); - v = y(d); - if (u != null && (u = +u) >= u && v != null && (v = +v) >= v) callback(u, v, ++i); - } -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function rSquared(data, x, y, uY, predict) { - let SSE = 0, SST = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const sse = dy - predict(dx), sst = dy - uY; - SSE += sse * sse; - SST += sst * sst; - }); - return 1 - SSE / SST; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function linear(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * x; - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function log(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - ++n; - dx = Math.log(dx); - X += (dx - X) / n; - Y += (dy - Y) / n; - XY += (dx * dy - XY) / n; - X2 += (dx * dx - X2) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] + coef[1] * Math.log(x); - return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, Y, predict) - }; -} -function exp(data, x, y) { - // eslint-disable-next-line no-unused-vars - const [xv, yv, ux, uy] = points(data, x, y); - let YL = 0, XY = 0, XYL = 0, X2Y = 0, n = 0, dx, ly, xy; - visitPoints(data, x, y, (_, dy)=>{ - dx = xv[n++]; - ly = Math.log(dy); - xy = dx * dy; - YL += (dy * ly - YL) / n; - XY += (xy - XY) / n; - XYL += (xy * ly - XYL) / n; - X2Y += (dx * xy - X2Y) / n; - }); - const [c0, c1] = ols(XY / uy, YL / uy, XYL / uy, X2Y / uy), predict = (x)=>Math.exp(c0 + c1 * (x - ux)); - return { - coef: [ - Math.exp(c0 - c1 * ux), - c1 - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -function pow(data, x, y) { - let X = 0, Y = 0, XY = 0, X2 = 0, YS = 0, n = 0; - visitPoints(data, x, y, (dx, dy)=>{ - const lx = Math.log(dx), ly = Math.log(dy); - ++n; - X += (lx - X) / n; - Y += (ly - Y) / n; - XY += (lx * ly - XY) / n; - X2 += (lx * lx - X2) / n; - YS += (dy - YS) / n; - }); - const coef = ols(X, Y, XY, X2), predict = (x)=>coef[0] * Math.pow(x, coef[1]); - coef[0] = Math.exp(coef[0]); return { - coef: coef, - predict: predict, - rSquared: rSquared(data, x, y, YS, predict) - }; -} -function quad(data, x, y) { - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length; - let X2 = 0, X3 = 0, X4 = 0, XY = 0, X2Y = 0, i, dx, dy, x2; - for(i = 0; i < n;){ - dx = xv[i]; - dy = yv[i++]; - x2 = dx * dx; - X2 += (x2 - X2) / i; - X3 += (x2 * dx - X3) / i; - X4 += (x2 * x2 - X4) / i; - XY += (dx * dy - XY) / i; - X2Y += (x2 * dy - X2Y) / i; - } - const X2X2 = X4 - X2 * X2, d = X2 * X2X2 - X3 * X3, a = (X2Y * X2 - XY * X3) / d, b = (XY * X2X2 - X2Y * X3) / d, c = -a * X2, predict = (x)=>{ - x = x - ux; - return a * x * x + b * x + c + uy; - }; - // transform coefficients back from mean-centered space - return { - coef: [ - c - b * ux + a * ux * ux + uy, - b - 2 * a * ux, - a - ], - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) - }; -} -// Adapted from d3-regression by Harry Stevens -// License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE -// ... which was adapted from regression-js by Tom Alexander -// Source: https://github.com/Tom-Alexander/regression-js/blob/master/src/regression.js#L246 -// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE -function poly(data, x, y, order) { - // use more efficient methods for lower orders - if (order === 0) return constant(data, x, y); - if (order === 1) return linear(data, x, y); - if (order === 2) return quad(data, x, y); - const [xv, yv, ux, uy] = points(data, x, y), n = xv.length, lhs = [], rhs = [], k = order + 1; - let i, j, l, v, c; - for(i = 0; i < k; ++i){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i) * yv[l]; - lhs.push(v); - c = new Float64Array(k); - for(j = 0; j < k; ++j){ - for(l = 0, v = 0; l < n; ++l)v += Math.pow(xv[l], i + j); - c[j] = v; - } - rhs.push(c); - } - rhs.push(lhs); - const coef = gaussianElimination(rhs), predict = (x)=>{ - x -= ux; - let y = uy + coef[0] + coef[1] * x + coef[2] * x * x; - for(i = 3; i < k; ++i)y += coef[i] * Math.pow(x, i); - return y; - }; - return { - coef: uncenter(k, coef, -ux, uy), - predict: predict, - rSquared: rSquared(data, x, y, uy, predict) + coef: uncenter(k, coef, -ux, uy), + predict, + rSquared: rSquared(data2, x2, y2, uy, predict) }; -} -function uncenter(k, a, x, y) { + } + function uncenter(k, a2, x2, y2) { const z = Array(k); - let i, j, v, c; - // initialize to zero - for(i = 0; i < k; ++i)z[i] = 0; - // polynomial expansion - for(i = k - 1; i >= 0; --i){ - v = a[i]; - c = 1; - z[i] += v; - for(j = 1; j <= i; ++j){ - c *= (i + 1 - j) / j; // binomial coefficent - z[i - j] += v * Math.pow(x, j) * c; - } - } - // bias term - z[0] += y; + let i, j, v, c2; + for (i = 0; i < k; ++i) z[i] = 0; + for (i = k - 1; i >= 0; --i) { + v = a2[i]; + c2 = 1; + z[i] += v; + for (j = 1; j <= i; ++j) { + c2 *= (i + 1 - j) / j; + z[i - j] += v * Math.pow(x2, j) * c2; + } + } + z[0] += y2; return z; -} -// Given an array for a two-dimensional matrix and the polynomial order, -// solve A * x = b using Gaussian elimination. -function gaussianElimination(matrix) { + } + function gaussianElimination(matrix) { const n = matrix.length - 1, coef = []; let i, j, k, r, t; - for(i = 0; i < n; ++i){ - r = i; // max row - for(j = i + 1; j < n; ++j)if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) r = j; - for(k = i; k < n + 1; ++k){ - t = matrix[k][i]; - matrix[k][i] = matrix[k][r]; - matrix[k][r] = t; + for (i = 0; i < n; ++i) { + r = i; + for (j = i + 1; j < n; ++j) { + if (Math.abs(matrix[i][j]) > Math.abs(matrix[i][r])) { + r = j; + } + } + for (k = i; k < n + 1; ++k) { + t = matrix[k][i]; + matrix[k][i] = matrix[k][r]; + matrix[k][r] = t; + } + for (j = i + 1; j < n; ++j) { + for (k = n; k >= i; k--) { + matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; } - for(j = i + 1; j < n; ++j)for(k = n; k >= i; k--)matrix[k][j] -= matrix[k][i] * matrix[i][j] / matrix[i][i]; + } } - for(j = n - 1; j >= 0; --j){ - t = 0; - for(k = j + 1; k < n; ++k)t += matrix[k][j] * coef[k]; - coef[j] = (matrix[n][j] - t) / matrix[j][j]; + for (j = n - 1; j >= 0; --j) { + t = 0; + for (k = j + 1; k < n; ++k) { + t += matrix[k][j] * coef[k]; + } + coef[j] = (matrix[n][j] - t) / matrix[j][j]; } return coef; -} -const maxiters = 2, epsilon = 1e-12; -// Adapted from science.js by Jason Davies -// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js -// License: https://github.com/jasondavies/science.js/blob/master/LICENSE -function loess(data, x, y, bandwidth) { - const [xv, yv, ux, uy] = points(data, x, y, true), n = xv.length, bw = Math.max(2, ~~(bandwidth * n)), // # nearest neighbors - yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); - for(let iter = -1; ++iter <= maxiters;){ - const interval = [ - 0, - bw - 1 - ]; - for(let i = 0; i < n; ++i){ - const dx = xv[i], i0 = interval[0], i1 = interval[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; - let W = 0, X = 0, Y = 0, XY = 0, X2 = 0; - const denom = 1 / Math.abs(xv[edge] - dx || 1); // avoid singularity! - for(let k = i0; k <= i1; ++k){ - const xk = xv[k], yk = yv[k], w = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w; - W += w; - X += xkw; - Y += yk * w; - XY += yk * xkw; - X2 += xk * xkw; - } - // linear regression fit - const [a, b] = ols(X / W, Y / W, XY / W, X2 / W); - yhat[i] = a + b * dx; - residuals[i] = Math.abs(yv[i] - yhat[i]); - updateInterval(xv, i + 1, interval); - } - if (iter === maxiters) break; - const medianResidual = (0, _d3Array.median)(residuals); - if (Math.abs(medianResidual) < epsilon) break; - for(let i = 0, arg, w; i < n; ++i){ - arg = residuals[i] / (6 * medianResidual); - // default to epsilon (rather than zero) for large deviations - // keeping weights tiny but non-zero prevents singularites - robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w; - } - } - return output(xv, yhat, ux, uy); -} -// weighting kernel for local regression -function tricube(x) { - return (x = 1 - x * x * x) * x * x; -} -// advance sliding window interval of nearest neighbors -function updateInterval(xv, i, interval) { + } + const maxiters = 2, epsilon$6 = 1e-12; + function loess(data2, x2, y2, bandwidth2) { + const [xv, yv, ux, uy] = points(data2, x2, y2, true), n = xv.length, bw = Math.max(2, ~~(bandwidth2 * n)), yhat = new Float64Array(n), residuals = new Float64Array(n), robustWeights = new Float64Array(n).fill(1); + for (let iter = -1; ++iter <= maxiters; ) { + const interval2 = [0, bw - 1]; + for (let i = 0; i < n; ++i) { + const dx = xv[i], i0 = interval2[0], i1 = interval2[1], edge = dx - xv[i0] > xv[i1] - dx ? i0 : i1; + let W = 0, X3 = 0, Y3 = 0, XY = 0, X22 = 0; + const denom = 1 / Math.abs(xv[edge] - dx || 1); + for (let k = i0; k <= i1; ++k) { + const xk = xv[k], yk = yv[k], w2 = tricube(Math.abs(dx - xk) * denom) * robustWeights[k], xkw = xk * w2; + W += w2; + X3 += xkw; + Y3 += yk * w2; + XY += yk * xkw; + X22 += xk * xkw; + } + const [a2, b2] = ols(X3 / W, Y3 / W, XY / W, X22 / W); + yhat[i] = a2 + b2 * dx; + residuals[i] = Math.abs(yv[i] - yhat[i]); + updateInterval(xv, i + 1, interval2); + } + if (iter === maxiters) { + break; + } + const medianResidual = median(residuals); + if (Math.abs(medianResidual) < epsilon$6) break; + for (let i = 0, arg, w2; i < n; ++i) { + arg = residuals[i] / (6 * medianResidual); + robustWeights[i] = arg >= 1 ? epsilon$6 : (w2 = 1 - arg * arg) * w2; + } + } + return output$1(xv, yhat, ux, uy); + } + function tricube(x2) { + return (x2 = 1 - x2 * x2 * x2) * x2 * x2; + } + function updateInterval(xv, i, interval2) { const val = xv[i]; - let left = interval[0], right = interval[1] + 1; + let left = interval2[0], right = interval2[1] + 1; if (right >= xv.length) return; - // step right if distance to new right edge is <= distance to old left edge - // step when distance is equal to ensure movement over duplicate x values - while(i > left && xv[right] - val <= val - xv[left]){ - interval[0] = ++left; - interval[1] = right; - ++right; - } -} -// generate smoothed output points -// average points with repeated x values -function output(xv, yhat, ux, uy) { + while (i > left && xv[right] - val <= val - xv[left]) { + interval2[0] = ++left; + interval2[1] = right; + ++right; + } + } + function output$1(xv, yhat, ux, uy) { const n = xv.length, out = []; let i = 0, cnt = 0, prev = [], v; - for(; i < n; ++i){ - v = xv[i] + ux; - if (prev[0] === v) // average output values via online update + for (; i < n; ++i) { + v = xv[i] + ux; + if (prev[0] === v) { prev[1] += (yhat[i] - prev[1]) / ++cnt; - else { - // add new output point - cnt = 0; - prev[1] += uy; - prev = [ - v, - yhat[i] - ]; - out.push(prev); - } + } else { + cnt = 0; + prev[1] += uy; + prev = [v, yhat[i]]; + out.push(prev); + } } prev[1] += uy; return out; -} -// subdivide up to accuracy of 0.5 degrees -const MIN_RADIANS = 0.5 * Math.PI / 180; -// Adaptively sample an interpolated function over a domain extent -function sampleCurve(f, extent, minSteps, maxSteps) { + } + const MIN_RADIANS = 0.5 * Math.PI / 180; + function sampleCurve(f, extent2, minSteps, maxSteps) { minSteps = minSteps || 25; maxSteps = Math.max(minSteps, maxSteps || 200); - const point = (x)=>[ - x, - f(x) - ], minX = extent[0], maxX = extent[1], span = maxX - minX, stop = span / maxSteps, prev = [ - point(minX) - ], next = []; + const point2 = (x2) => [x2, f(x2)], minX = extent2[0], maxX = extent2[1], span2 = maxX - minX, stop2 = span2 / maxSteps, prev = [point2(minX)], next = []; if (minSteps === maxSteps) { - // no adaptation, sample uniform grid directly and return - for(let i = 1; i < maxSteps; ++i)prev.push(point(minX + i / minSteps * span)); - prev.push(point(maxX)); - return prev; + for (let i = 1; i < maxSteps; ++i) { + prev.push(point2(minX + i / minSteps * span2)); + } + prev.push(point2(maxX)); + return prev; } else { - // sample minimum points on uniform grid - // then move on to perform adaptive refinement - next.push(point(maxX)); - for(let i = minSteps; --i > 0;)next.push(point(minX + i / minSteps * span)); + next.push(point2(maxX)); + for (let i = minSteps; --i > 0; ) { + next.push(point2(minX + i / minSteps * span2)); + } } - let p0 = prev[0]; + let p02 = prev[0]; let p1 = next[next.length - 1]; - const sx = 1 / span; - const sy = scaleY(p0[1], next); - while(p1){ - // midpoint for potential curve subdivision - const pm = point((p0[0] + p1[0]) / 2); - const dx = pm[0] - p0[0] >= stop; - if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) // maximum resolution has not yet been met, and - // subdivision midpoint is sufficiently different from endpoint - // save subdivision, push midpoint onto the visitation stack + const sx = 1 / span2; + const sy = scaleY(p02[1], next); + while (p1) { + const pm = point2((p02[0] + p1[0]) / 2); + const dx = pm[0] - p02[0] >= stop2; + if (dx && angleDelta(p02, pm, p1, sx, sy) > MIN_RADIANS) { next.push(pm); - else { - // subdivision midpoint sufficiently similar to endpoint - // skip subdivision, store endpoint, move to next point on the stack - p0 = p1; - prev.push(p1); - next.pop(); - } - p1 = next[next.length - 1]; + } else { + p02 = p1; + prev.push(p1); + next.pop(); + } + p1 = next[next.length - 1]; } return prev; -} -function scaleY(init, points) { - let ymin = init; - let ymax = init; - const n = points.length; - for(let i = 0; i < n; ++i){ - const y = points[i][1]; - if (y < ymin) ymin = y; - if (y > ymax) ymax = y; + } + function scaleY(init2, points2) { + let ymin = init2; + let ymax = init2; + const n = points2.length; + for (let i = 0; i < n; ++i) { + const y2 = points2[i][1]; + if (y2 < ymin) ymin = y2; + if (y2 > ymax) ymax = y2; } return 1 / (ymax - ymin); -} -function angleDelta(p, q, r, sx, sy) { + } + function angleDelta(p, q, r, sx, sy) { const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])), a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0])); return Math.abs(a0 - a1); -} - -},{"d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i63Ad":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "bound", ()=>Bound); -parcelHelpers.export(exports, "identifier", ()=>Identifier); -parcelHelpers.export(exports, "mark", ()=>Mark); -parcelHelpers.export(exports, "overlap", ()=>Overlap); -parcelHelpers.export(exports, "render", ()=>Render); -parcelHelpers.export(exports, "viewlayout", ()=>ViewLayout); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaUtil = require("vega-util"); -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const TopLeft = 'top-left'; -const TopRight = 'top-right'; -const BottomLeft = 'bottom-left'; -const BottomRight = 'bottom-right'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const X = 'x'; -const Y = 'y'; -const Group = 'group'; -const AxisRole = 'axis'; -const TitleRole = 'title'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const LegendRole = 'legend'; -const RowHeader = 'row-header'; -const RowFooter = 'row-footer'; -const RowTitle = 'row-title'; -const ColHeader = 'column-header'; -const ColFooter = 'column-footer'; -const ColTitle = 'column-title'; -const Padding = 'padding'; -const Symbols = 'symbol'; -const Fit = 'fit'; -const FitX = 'fit-x'; -const FitY = 'fit-y'; -const Pad = 'pad'; -const None = 'none'; -const All = 'all'; -const Each = 'each'; -const Flush = 'flush'; -const Column = 'column'; -const Row = 'row'; -/** - * Calculate bounding boxes for scenegraph items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - The scenegraph mark instance to bound. - */ function Bound(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Bound, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow, mark = _.mark, type = mark.marktype, entry = (0, _vegaScenegraph.Marks)[type], bound = entry.bound; - let markBounds = mark.bounds, rebound; - if (entry.nested) { - // multi-item marks have a single bounds instance - if (mark.items.length) view.dirty(mark.items[0]); - markBounds = boundItem(mark, bound); - mark.items.forEach((item)=>{ - item.bounds.clear().union(markBounds); - }); - } else if (type === Group || _.modified()) { - // operator parameters modified -> re-bound all items - // updates group bounds in response to modified group content - pulse.visit(pulse.MOD, (item)=>view.dirty(item)); - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(boundItem(item, bound))); - // force reflow for axes/legends/titles to propagate any layout changes - switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - pulse.reflow(); - } - } else { - // incrementally update bounds, re-bound mark as needed - rebound = pulse.changed(pulse.REM); - pulse.visit(pulse.ADD, (item)=>{ - markBounds.union(boundItem(item, bound)); - }); - pulse.visit(pulse.MOD, (item)=>{ - rebound = rebound || markBounds.alignsWith(item.bounds); - view.dirty(item); - markBounds.union(boundItem(item, bound)); - }); - if (rebound) { - markBounds.clear(); - mark.items.forEach((item)=>markBounds.union(item.bounds)); - } - } - // ensure mark bounds do not exceed any clipping region - (0, _vegaScenegraph.boundClip)(mark); - return pulse.modifies('bounds'); - } -}); -function boundItem(item, bound, opt) { - return bound(item.bounds.clear(), item, opt); -} -const COUNTER_NAME = ':vega_identifier:'; -/** - * Adds a unique identifier to all added tuples. - * This transform creates a new signal that serves as an id counter. - * As a result, the id counter is shared across all instances of this - * transform, generating unique ids across multiple data streams. In - * addition, this signal value can be included in a snapshot of the - * dataflow state, enabling correct resumption of id allocation. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {string} params.as - The field name for the generated identifier. - */ function Identifier(params) { - (0, _vegaDataflow.Transform).call(this, 0, params); -} -Identifier.Definition = { - 'type': 'Identifier', - 'metadata': { - 'modifies': true + } + function multikey(f) { + return (x2) => { + const n = f.length; + let i = 1, k = String(f[0](x2)); + for (; i < n; ++i) { + k += "|" + f[i](x2); + } + return k; + }; + } + function groupkey(fields) { + return !fields || !fields.length ? function() { + return ""; + } : fields.length === 1 ? fields[0] : multikey(fields); + } + function measureName(op, field2, as) { + return as || op + (!field2 ? "" : "_" + field2); + } + const noop$4 = () => { + }; + const base_op = { + init: noop$4, + add: noop$4, + rem: noop$4, + idx: 0 + }; + const AggregateOps = { + values: { + init: (m2) => m2.cell.store = true, + value: (m2) => m2.cell.data.values(), + idx: -1 }, - 'params': [ - { - 'name': 'as', - 'type': 'string', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Identifier, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const counter = getCounter(pulse.dataflow), as = _.as; - let id = counter.value; - pulse.visit(pulse.ADD, (t)=>t[as] = t[as] || ++id); - counter.set(this.value = id); - return pulse; - } -}); -function getCounter(view) { - return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); -} -/** - * Bind scenegraph items to a scenegraph mark instance. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.markdef - The mark definition for creating the mark. - * This is an object of legal scenegraph mark properties which *must* include - * the 'marktype' property. - */ function Mark(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Mark, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let mark = this.value; - // acquire mark on first invocation, bind context and group - if (!mark) { - mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index); - mark.group.context = _.context; - if (!_.context.group) _.context.group = mark.group; - mark.source = this.source; // point to upstream collector - mark.clip = _.clip; - mark.interactive = _.interactive; - this.value = mark; - } - // initialize entering items - const Init = mark.marktype === Group ? (0, _vegaScenegraph.GroupItem) : (0, _vegaScenegraph.Item); - pulse.visit(pulse.ADD, (item)=>Init.call(item, mark)); - // update clipping and/or interactive status - if (_.modified('clip') || _.modified('interactive')) { - mark.clip = _.clip; - mark.interactive = !!_.interactive; - mark.zdirty = true; // force scenegraph re-eval - pulse.reflow(); - } - // bind items array to scenegraph mark - mark.items = pulse.source; - return pulse; - } -}); -function lookup$1(_) { - const g = _.groups, p = _.parent; - return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; -} -/** - * Analyze items for overlap, changing opacity to hide items with - * overlapping bounding boxes. This transform will preserve at least - * two items (e.g., first and last) even if overlap persists. - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting items. - * @param {object} [params.method] - The overlap removal method to apply. - * One of 'parity' (default, hide every other item until there is no - * more overlap) or 'greedy' (sequentially scan and hide and items that - * overlap with the last visible item). - * @param {object} [params.boundScale] - A scale whose range should be used - * to bound the items. Items exceeding the bounds of the scale range - * will be treated as overlapping. If null or undefined, no bounds check - * will be applied. - * @param {object} [params.boundOrient] - The orientation of the scale - * (top, bottom, left, or right) used to bound items. This parameter is - * ignored if boundScale is null or undefined. - * @param {object} [params.boundTolerance] - The tolerance in pixels for - * bound inclusion testing (default 1). This specifies by how many pixels - * an item's bounds may exceed the scale range bounds and not be culled. - * @constructor - */ function Overlap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const methods = { - parity: (items)=>items.filter((item, i)=>i % 2 ? item.opacity = 0 : 1), - greedy: (items, sep)=>{ - let a; - return items.filter((b, i)=>!i || !intersect(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0); - } -}; -// compute bounding box intersection -// including padding pixels of separation -const intersect = (a, b, sep)=>sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2); -const hasOverlap = (items, pad)=>{ - for(var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i){ - if (intersect(a, b = items[i].bounds, pad)) return true; - } -}; -const hasBounds = (item)=>{ - const b = item.bounds; - return b.width() > 1 && b.height() > 1; -}; -const boundTest = (scale, orient, tolerance)=>{ - var range = scale.range(), b = new (0, _vegaScenegraph.Bounds)(); - if (orient === Top || orient === Bottom) b.set(range[0], -Infinity, range[1], Infinity); - else b.set(-Infinity, range[0], Infinity, range[1]); - b.expand(tolerance || 1); - return (item)=>b.encloses(item.bounds); -}; -// reset all items to be fully opaque -const reset = (source)=>{ - source.forEach((item)=>item.opacity = 1); - return source; -}; -// add all tuples to mod, fork pulse if parameters were modified -// fork prevents cross-stream tuple pollution (e.g., pulse from scale) -const reflow = (pulse, _)=>pulse.reflow(_.modified()).modifies('opacity'); -(0, _vegaUtil.inherits)(Overlap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; - let source = pulse.materialize(pulse.SOURCE).source, items, test; - if (!source || !source.length) return; - if (!_.method) { - // early exit if method is falsy - if (_.modified('method')) { - reset(source); - pulse = reflow(pulse, _); - } - return pulse; - } - // skip labels with no content - source = source.filter(hasBounds); - // early exit, nothing to do - if (!source.length) return; - if (_.sort) source = source.slice().sort(_.sort); - items = reset(source); - pulse = reflow(pulse, _); - if (items.length >= 3 && hasOverlap(items, sep)) { - do items = reduce(items, sep); - while (items.length >= 3 && hasOverlap(items, sep)); - if (items.length < 3 && !(0, _vegaUtil.peek)(source).opacity) { - if (items.length > 1) (0, _vegaUtil.peek)(items).opacity = 0; - (0, _vegaUtil.peek)(source).opacity = 1; - } - } - if (_.boundScale && _.boundTolerance >= 0) { - test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); - source.forEach((item)=>{ - if (!test(item)) item.opacity = 0; - }); - } - // re-calculate mark bounds - const bounds = items[0].mark.bounds.clear(); - source.forEach((item)=>{ - if (item.opacity) bounds.union(item.bounds); - }); - return pulse; - } -}); -/** - * Queue modified scenegraph items for rendering. - * @constructor - */ function Render(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Render, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - pulse.visit(pulse.ALL, (item)=>view.dirty(item)); - // set z-index dirty flag as needed - if (pulse.fields && pulse.fields['zindex']) { - const item = pulse.source && pulse.source[0]; - if (item) item.mark.zdirty = true; - } - } -}); -const tempBounds = new (0, _vegaScenegraph.Bounds)(); -function set(item, property, value) { - return item[property] === value ? 0 : (item[property] = value, 1); -} -function isYAxis(mark) { - var orient = mark.items[0].orient; - return orient === Left || orient === Right; -} -function axisIndices(datum) { - let index = +datum.grid; - return [ - datum.ticks ? index++ : -1, - // ticks index - datum.labels ? index++ : -1, - // labels index - index + +datum.domain // title index - ]; -} -function axisLayout(view, axis, width, height) { - var item = axis.items[0], datum = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum), range = item.range, offset = item.offset, position = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds = item.bounds, dl = title && (0, _vegaScenegraph.multiLineOffset)(title), x = 0, y = 0, i, s; - tempBounds.clear().union(bounds); - bounds.clear(); - if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds); - if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); - // position axis group and title - switch(orient){ - case Top: - x = position || 0; - y = -offset; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1)); - bounds.add(0, -s).add(range, 0); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds); - break; - case Left: - x = -offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1)); - bounds.add(-s, 0).add(0, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds); - break; - case Right: - x = width + offset; - y = position || 0; - s = Math.max(minExtent, Math.min(maxExtent, bounds.x2)); - bounds.add(0, 0).add(s, range); - if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds); - break; - case Bottom: - x = position || 0; - y = height + offset; - s = Math.max(minExtent, Math.min(maxExtent, bounds.y2)); - bounds.add(0, 0).add(range, s); - if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds); - break; - default: - x = item.x; - y = item.y; - } - // update bounds - (0, _vegaScenegraph.boundStroke)(bounds.translate(x, y), item); - if (set(item, 'x', x + delta) | set(item, 'y', y + delta)) { - item.bounds = tempBounds; - view.dirty(item); - item.bounds = bounds; - view.dirty(item); - } - return item.mark.bounds.clear().union(bounds); -} -function axisTitleLayout(view, title, offset, pad, dl, isYAxis, sign, bounds) { - const b = title.bounds; - if (title.auto) { - const v = sign * (offset + dl + pad); - let dx = 0, dy = 0; - view.dirty(title); - isYAxis ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); - title.mark.bounds.clear().union(b.translate(-dx, -dy)); - view.dirty(title); - } - bounds.union(b); -} -// aggregation functions for grid margin determination -const min = (a, b)=>Math.floor(Math.min(a, b)); -const max = (a, b)=>Math.ceil(Math.max(a, b)); -function gridLayoutGroups(group) { - var groups = group.items, n = groups.length, i = 0, mark, items; - const views = { - marks: [], - rowheaders: [], - rowfooters: [], - colheaders: [], - colfooters: [], - rowtitle: null, - coltitle: null - }; - // layout axes, gather legends, collect bounds - for(; i < n; ++i){ - mark = groups[i]; - items = mark.items; - if (mark.marktype === Group) switch(mark.role){ - case AxisRole: - case LegendRole: - case TitleRole: - break; - case RowHeader: - views.rowheaders.push(...items); - break; - case RowFooter: - views.rowfooters.push(...items); - break; - case ColHeader: - views.colheaders.push(...items); - break; - case ColFooter: - views.colfooters.push(...items); - break; - case RowTitle: - views.rowtitle = items[0]; - break; - case ColTitle: - views.coltitle = items[0]; - break; - default: - views.marks.push(...items); - } + count: { + value: (m2) => m2.cell.num + }, + __count__: { + value: (m2) => m2.missing + m2.valid + }, + missing: { + value: (m2) => m2.missing + }, + valid: { + value: (m2) => m2.valid + }, + sum: { + init: (m2) => m2.sum = 0, + value: (m2) => m2.valid ? m2.sum : void 0, + add: (m2, v) => m2.sum += +v, + rem: (m2, v) => m2.sum -= v + }, + product: { + init: (m2) => m2.product = 1, + value: (m2) => m2.valid ? m2.product : void 0, + add: (m2, v) => m2.product *= v, + rem: (m2, v) => m2.product /= v + }, + mean: { + init: (m2) => m2.mean = 0, + value: (m2) => m2.valid ? m2.mean : void 0, + add: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean += m2.mean_d / m2.valid), + rem: (m2, v) => (m2.mean_d = v - m2.mean, m2.mean -= m2.valid ? m2.mean_d / m2.valid : m2.mean) + }, + average: { + value: (m2) => m2.valid ? m2.mean : void 0, + req: ["mean"], + idx: 1 + }, + variance: { + init: (m2) => m2.dev = 0, + value: (m2) => m2.valid > 1 ? m2.dev / (m2.valid - 1) : void 0, + add: (m2, v) => m2.dev += m2.mean_d * (v - m2.mean), + rem: (m2, v) => m2.dev -= m2.mean_d * (v - m2.mean), + req: ["mean"], + idx: 1 + }, + variancep: { + value: (m2) => m2.valid > 1 ? m2.dev / m2.valid : void 0, + req: ["variance"], + idx: 2 + }, + stdev: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid - 1)) : void 0, + req: ["variance"], + idx: 2 + }, + stdevp: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / m2.valid) : void 0, + req: ["variance"], + idx: 2 + }, + stderr: { + value: (m2) => m2.valid > 1 ? Math.sqrt(m2.dev / (m2.valid * (m2.valid - 1))) : void 0, + req: ["variance"], + idx: 2 + }, + distinct: { + value: (m2) => m2.cell.data.distinct(m2.get), + req: ["values"], + idx: 3 + }, + ci0: { + value: (m2) => m2.cell.data.ci0(m2.get), + req: ["values"], + idx: 3 + }, + ci1: { + value: (m2) => m2.cell.data.ci1(m2.get), + req: ["values"], + idx: 3 + }, + median: { + value: (m2) => m2.cell.data.q2(m2.get), + req: ["values"], + idx: 3 + }, + q1: { + value: (m2) => m2.cell.data.q1(m2.get), + req: ["values"], + idx: 3 + }, + q3: { + value: (m2) => m2.cell.data.q3(m2.get), + req: ["values"], + idx: 3 + }, + min: { + init: (m2) => m2.min = void 0, + value: (m2) => m2.min = Number.isNaN(m2.min) ? m2.cell.data.min(m2.get) : m2.min, + add: (m2, v) => { + if (v < m2.min || m2.min === void 0) m2.min = v; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.min = NaN; + }, + req: ["values"], + idx: 4 + }, + max: { + init: (m2) => m2.max = void 0, + value: (m2) => m2.max = Number.isNaN(m2.max) ? m2.cell.data.max(m2.get) : m2.max, + add: (m2, v) => { + if (v > m2.max || m2.max === void 0) m2.max = v; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.max = NaN; + }, + req: ["values"], + idx: 4 + }, + argmin: { + init: (m2) => m2.argmin = void 0, + value: (m2) => m2.argmin || m2.cell.data.argmin(m2.get), + add: (m2, v, t) => { + if (v < m2.min) m2.argmin = t; + }, + rem: (m2, v) => { + if (v <= m2.min) m2.argmin = void 0; + }, + req: ["min", "values"], + idx: 3 + }, + argmax: { + init: (m2) => m2.argmax = void 0, + value: (m2) => m2.argmax || m2.cell.data.argmax(m2.get), + add: (m2, v, t) => { + if (v > m2.max) m2.argmax = t; + }, + rem: (m2, v) => { + if (v >= m2.max) m2.argmax = void 0; + }, + req: ["max", "values"], + idx: 3 + }, + exponential: { + init: (m2, r) => { + m2.exp = 0; + m2.exp_r = r; + }, + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) / (1 - m2.exp_r ** m2.valid) : void 0, + add: (m2, v) => m2.exp = m2.exp_r * m2.exp + v, + rem: (m2, v) => m2.exp = (m2.exp - v / m2.exp_r ** (m2.valid - 1)) / m2.exp_r + }, + exponentialb: { + value: (m2) => m2.valid ? m2.exp * (1 - m2.exp_r) : void 0, + req: ["exponential"], + idx: 1 } - return views; -} -function bboxFlush(item) { - return new (0, _vegaScenegraph.Bounds)().set(0, 0, item.width || 0, item.height || 0); -} -function bboxFull(item) { - const b = item.bounds.clone(); - return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0)); -} -function get(opt, key, d) { - const v = (0, _vegaUtil.isObject)(opt) ? opt[key] : opt; - return v != null ? v : d !== undefined ? d : 0; -} -function offsetValue(v) { - return v < 0 ? Math.ceil(-v) : 0; -} -function gridLayout(view, groups, opt) { - var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds = tempBounds.set(0, 0, 0, 0), alignCol = get(opt.align, Column), alignRow = get(opt.align, Row), padCol = get(opt.padding, Column), padRow = get(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m, i, c, r, b, g, px, py, x, y, offset; - for(i = 0; i < ncols; ++i)xExtent[i] = 0; - for(i = 0; i < nrows; ++i)yExtent[i] = 0; - // determine offsets for each group - for(i = 0; i < n; ++i){ - g = groups[i]; - b = boxes[i] = bbox(g); - g.x = g.x || 0; - dx[i] = 0; - g.y = g.y || 0; - dy[i] = 0; - c = i % ncols; - r = ~~(i / ncols); - xMax = Math.max(xMax, px = Math.ceil(b.x2)); - yMax = Math.max(yMax, py = Math.ceil(b.y2)); - xExtent[c] = Math.max(xExtent[c], px); - yExtent[r] = Math.max(yExtent[r], py); - xOffset[i] = padCol + offsetValue(b.x1); - yOffset[i] = padRow + offsetValue(b.y1); - if (dirty) view.dirty(groups[i]); - } - // set initial alignment offsets - for(i = 0; i < n; ++i){ - if (i % ncols === 0) xOffset[i] = 0; - if (i < ncols) yOffset[i] = 0; - } - // enforce column alignment constraints - if (alignCol === Each) for(c = 1; c < ncols; ++c){ - for(offset = 0, i = c; i < n; i += ncols)if (offset < xOffset[i]) offset = xOffset[i]; - for(i = c; i < n; i += ncols)xOffset[i] = offset + xExtent[c - 1]; - } - else if (alignCol === All) { - for(offset = 0, i = 0; i < n; ++i)if (i % ncols && offset < xOffset[i]) offset = xOffset[i]; - for(i = 0; i < n; ++i)if (i % ncols) xOffset[i] = offset + xMax; - } else { - for(alignCol = false, c = 1; c < ncols; ++c)for(i = c; i < n; i += ncols)xOffset[i] += xExtent[c - 1]; + }; + const ValidAggregateOps = Object.keys(AggregateOps).filter((d) => d !== "__count__"); + function measure(key2, value2) { + return (out, aggregate_param) => extend$1({ + name: key2, + aggregate_param, + out: out || key2 + }, base_op, value2); + } + [...ValidAggregateOps, "__count__"].forEach((key2) => { + AggregateOps[key2] = measure(key2, AggregateOps[key2]); + }); + function createMeasure(op, param2, name) { + return AggregateOps[op](name, param2); + } + function compareIndex(a2, b2) { + return a2.idx - b2.idx; + } + function resolve(agg) { + const map2 = {}; + agg.forEach((a2) => map2[a2.name] = a2); + const getreqs = (a2) => { + if (!a2.req) return; + a2.req.forEach((key2) => { + if (!map2[key2]) getreqs(map2[key2] = AggregateOps[key2]()); + }); + }; + agg.forEach(getreqs); + return Object.values(map2).sort(compareIndex); + } + function init$1() { + this.valid = 0; + this.missing = 0; + this._ops.forEach((op) => op.aggregate_param == null ? op.init(this) : op.init(this, op.aggregate_param)); + } + function add$3(v, t) { + if (v == null || v === "") { + ++this.missing; + return; } - // enforce row alignment constraints - if (alignRow === Each) for(r = 1; r < nrows; ++r){ - for(offset = 0, i = r * ncols, m = i + ncols; i < m; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = r * ncols; i < m; ++i)yOffset[i] = offset + yExtent[r - 1]; + if (v !== v) return; + ++this.valid; + this._ops.forEach((op) => op.add(this, v, t)); + } + function rem(v, t) { + if (v == null || v === "") { + --this.missing; + return; } - else if (alignRow === All) { - for(offset = 0, i = ncols; i < n; ++i)if (offset < yOffset[i]) offset = yOffset[i]; - for(i = ncols; i < n; ++i)yOffset[i] = offset + yMax; - } else { - for(alignRow = false, r = 1; r < nrows; ++r)for(i = r * ncols, m = i + ncols; i < m; ++i)yOffset[i] += yExtent[r - 1]; - } - // perform horizontal grid layout - for(x = 0, i = 0; i < n; ++i){ - x = xOffset[i] + (i % ncols ? x : 0); - dx[i] += x - groups[i].x; - } - // perform vertical grid layout - for(c = 0; c < ncols; ++c)for(y = 0, i = c; i < n; i += ncols){ - y += yOffset[i]; - dy[i] += y - groups[i].y; - } - // perform horizontal centering - if (alignCol && get(opt.center, Column) && nrows > 1) for(i = 0; i < n; ++i){ - b = alignCol === All ? xMax : xExtent[i % ncols]; - x = b - boxes[i].x2 - groups[i].x - dx[i]; - if (x > 0) dx[i] += x / 2; - } - // perform vertical centering - if (alignRow && get(opt.center, Row) && ncols !== 1) for(i = 0; i < n; ++i){ - b = alignRow === All ? yMax : yExtent[~~(i / ncols)]; - y = b - boxes[i].y2 - groups[i].y - dy[i]; - if (y > 0) dy[i] += y / 2; - } - // position grid relative to anchor - for(i = 0; i < n; ++i)bounds.union(boxes[i].translate(dx[i], dy[i])); - x = get(opt.anchor, X); - y = get(opt.anchor, Y); - switch(get(opt.anchor, Column)){ - case End: - x -= bounds.width(); - break; - case Middle: - x -= bounds.width() / 2; + if (v !== v) return; + --this.valid; + this._ops.forEach((op) => op.rem(this, v, t)); + } + function set$7(t) { + this._out.forEach((op) => t[op.out] = op.value(this)); + return t; + } + function compileMeasures(agg, field2) { + const get2 = field2 || identity$7, ops2 = resolve(agg), out = agg.slice().sort(compareIndex); + function ctr(cell2) { + this._ops = ops2; + this._out = out; + this.cell = cell2; + this.init(); + } + ctr.prototype.init = init$1; + ctr.prototype.add = add$3; + ctr.prototype.rem = rem; + ctr.prototype.set = set$7; + ctr.prototype.get = get2; + ctr.fields = agg.map((op) => op.out); + return ctr; + } + function TupleStore(key2) { + this._key = key2 ? field$1(key2) : tupleid; + this.reset(); + } + const prototype$1 = TupleStore.prototype; + prototype$1.reset = function() { + this._add = []; + this._rem = []; + this._ext = null; + this._get = null; + this._q = null; + }; + prototype$1.add = function(v) { + this._add.push(v); + }; + prototype$1.rem = function(v) { + this._rem.push(v); + }; + prototype$1.values = function() { + this._get = null; + if (this._rem.length === 0) return this._add; + const a2 = this._add, r = this._rem, k = this._key, n = a2.length, m2 = r.length, x2 = Array(n - m2), map2 = {}; + let i, j, v; + for (i = 0; i < m2; ++i) { + map2[k(r[i])] = 1; + } + for (i = 0, j = 0; i < n; ++i) { + if (map2[k(v = a2[i])]) { + map2[k(v)] = 0; + } else { + x2[j++] = v; + } } - switch(get(opt.anchor, Row)){ - case End: - y -= bounds.height(); - break; - case Middle: - y -= bounds.height() / 2; - } - x = Math.round(x); - y = Math.round(y); - // update mark positions, bounds, dirty - bounds.clear(); - for(i = 0; i < n; ++i)groups[i].mark.bounds.clear(); - for(i = 0; i < n; ++i){ - g = groups[i]; - g.x += dx[i] += x; - g.y += dy[i] += y; - bounds.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); - if (dirty) view.dirty(g); - } - return bounds; -} -function trellisLayout(view, group, opt) { - var views = gridLayoutGroups(group), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x, y, x2, y2, anchor, band, offset; - // -- initial grid layout - const bounds = gridLayout(view, groups, opt); - if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid - // -- layout grid headers and footers -- - // perform row header layout - if (views.rowheaders) { - band = get(opt.headerBand, Row, null); - x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band); + this._rem = []; + return this._add = x2; + }; + prototype$1.distinct = function(get2) { + const v = this.values(), map2 = {}; + let n = v.length, count2 = 0, s; + while (--n >= 0) { + s = get2(v[n]) + ""; + if (!has$1(map2, s)) { + map2[s] = 1; + ++count2; + } } - // perform column header layout - if (views.colheaders) { - band = get(opt.headerBand, Column, null); - y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band); - } - // perform row footer layout - if (views.rowfooters) { - band = get(opt.footerBand, Row, null); - x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band); - } - // perform column footer layout - if (views.colfooters) { - band = get(opt.footerBand, Column, null); - y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band); - } - // perform row title layout - if (views.rowtitle) { - anchor = get(opt.titleAnchor, Row); - offset = get(off, 'rowTitle'); - offset = anchor === End ? x2 + offset : x - offset; - band = get(opt.titleBand, Row, 0.5); - layoutTitle(view, views.rowtitle, offset, 0, bounds, band); - } - // perform column title layout - if (views.coltitle) { - anchor = get(opt.titleAnchor, Column); - offset = get(off, 'columnTitle'); - offset = anchor === End ? y2 + offset : y - offset; - band = get(opt.titleBand, Column, 0.5); - layoutTitle(view, views.coltitle, offset, 1, bounds, band); - } -} -function boundFlush(item, field) { - return field === 'x1' ? item.x || 0 : field === 'y1' ? item.y || 0 : field === 'x2' ? (item.x || 0) + (item.width || 0) : field === 'y2' ? (item.y || 0) + (item.height || 0) : undefined; -} -function boundFull(item, field) { - return item.bounds[field]; -} -function layoutHeaders(view, headers, groups, ncols, limit, offset, agg, isX, bound, bf, start, stride, back, band) { - var n = groups.length, init = 0, edge = 0, i, j, k, m, b, h, g, x, y; - // if no groups, early exit and return 0 - if (!n) return init; - // compute margin - for(i = start; i < n; i += stride)if (groups[i]) init = agg(init, bound(groups[i], bf)); - // if no headers, return margin calculation - if (!headers.length) return init; - // check if number of headers exceeds number of rows or columns - if (headers.length > limit) { - view.warn('Grid headers exceed limit: ' + limit); - headers = headers.slice(0, limit); - } - // apply offset - init += offset; - // clear mark bounds for all headers - for(j = 0, m = headers.length; j < m; ++j){ - view.dirty(headers[j]); - headers[j].mark.bounds.clear(); - } - // layout each header - for(i = start, j = 0, m = headers.length; j < m; ++j, i += stride){ - h = headers[j]; - b = h.mark.bounds; - // search for nearest group to align to - // necessary if table has empty cells - for(k = i; k >= 0 && (g = groups[k]) == null; k -= back); - // assign coordinates and update bounds - if (isX) { - x = band == null ? g.x : Math.round(g.bounds.x1 + band * g.bounds.width()); - y = init; - } else { - x = init; - y = band == null ? g.y : Math.round(g.bounds.y1 + band * g.bounds.height()); - } - b.union(h.bounds.translate(x - (h.x || 0), y - (h.y || 0))); - h.x = x; - h.y = y; - view.dirty(h); - // update current edge of layout bounds - edge = agg(edge, b[bf]); - } - return edge; -} -function layoutTitle(view, g, offset, isX, bounds, band) { - if (!g) return; - view.dirty(g); - // compute title coordinates - var x = offset, y = offset; - isX ? x = Math.round(bounds.x1 + band * bounds.width()) : y = Math.round(bounds.y1 + band * bounds.height()); - // assign coordinates and update bounds - g.bounds.translate(x - (g.x || 0), y - (g.y || 0)); - g.mark.bounds.clear().union(g.bounds); - g.x = x; - g.y = y; - // queue title for redraw - view.dirty(g); -} -// utility for looking up legend layout configuration -function lookup(config, orient) { - const opt = config[orient] || {}; - return (key, d)=>opt[key] != null ? opt[key] : config[key] != null ? config[key] : d; -} -// if legends specify offset directly, use the maximum specified value -function offsets(legends, value) { - let max = -Infinity; - legends.forEach((item)=>{ - if (item.offset != null) max = Math.max(max, item.offset); - }); - return max > -Infinity ? max : value; -} -function legendParams(g, orient, config, xb, yb, w, h) { - const _ = lookup(config, orient), offset = offsets(g, _('offset', 0)), anchor = _('anchor', Start), mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0; - const p = { - align: Each, - bounds: _('bounds', Flush), - columns: _('direction') === 'vertical' ? 1 : g.length, - padding: _('margin', 8), - center: _('center'), - nodirty: true - }; - switch(orient){ - case Left: - p.anchor = { - x: Math.floor(xb.x1) - offset, - column: End, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Right: - p.anchor = { - x: Math.ceil(xb.x2) + offset, - y: mult * (h || xb.height() + 2 * xb.y1), - row: anchor - }; - break; - case Top: - p.anchor = { - y: Math.floor(yb.y1) - offset, - row: End, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case Bottom: - p.anchor = { - y: Math.ceil(yb.y2) + offset, - x: mult * (w || yb.width() + 2 * yb.x1), - column: anchor - }; - break; - case TopLeft: - p.anchor = { - x: offset, - y: offset - }; - break; - case TopRight: - p.anchor = { - x: w - offset, - y: offset, - column: End - }; - break; - case BottomLeft: - p.anchor = { - x: offset, - y: h - offset, - row: End - }; - break; - case BottomRight: - p.anchor = { - x: w - offset, - y: h - offset, - column: End, - row: End - }; - break; - } - return p; -} -function legendLayout(view, legend) { - var item = legend.items[0], datum = item.datum, orient = item.orient, bounds = item.bounds, x = item.x, y = item.y, w, h; - // cache current bounds for later comparison - item._bounds ? item._bounds.clear().union(bounds) : item._bounds = bounds.clone(); - bounds.clear(); - // adjust legend to accommodate padding and title - legendGroupLayout(view, item, item.items[0].items[0]); - // aggregate bounds to determine size, and include origin - bounds = legendBounds(item, bounds); - w = 2 * item.padding; - h = 2 * item.padding; - if (!bounds.empty()) { - w = Math.ceil(bounds.width() + w); - h = Math.ceil(bounds.height() + h); - } - if (datum.type === Symbols) legendEntryLayout(item.items[0].items[0].items[0].items); - if (orient !== None) { - item.x = x = 0; - item.y = y = 0; - } - item.width = w; - item.height = h; - (0, _vegaScenegraph.boundStroke)(bounds.set(x, y, x + w, y + h), item); - item.mark.bounds.clear().union(bounds); - return item; -} -function legendBounds(item, b) { - // aggregate item bounds - item.items.forEach((_)=>b.union(_.bounds)); - // anchor to legend origin - b.x1 = item.padding; - b.y1 = item.padding; - return b; -} -function legendGroupLayout(view, item, entry) { - var pad = item.padding, ex = pad - entry.x, ey = pad - entry.y; - if (!item.datum.title) { - if (ex || ey) translate(view, entry, ex, ey); - } else { - var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx = pad - title.x, ty = pad - title.y; - switch(title.orient){ - case Left: - ex += Math.ceil(title.bounds.width()) + tpad; - break; - case Right: - case Bottom: - break; - default: - ey += title.bounds.height() + tpad; - } - if (ex || ey) translate(view, entry, ex, ey); - switch(title.orient){ - case Left: - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Right: - tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad; - ty += legendTitleOffset(item, entry, title, anchor, 1, 1); - break; - case Bottom: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad; - break; - default: - tx += legendTitleOffset(item, entry, title, anchor, 0, 0); - } - if (tx || ty) translate(view, title, tx, ty); - // translate legend if title pushes into negative coordinates - if ((tx = Math.round(title.bounds.x1 - pad)) < 0) { - translate(view, entry, -tx, 0); - translate(view, title, -tx, 0); - } - } -} -function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) { - const grad = item.datum.type !== 'symbol', vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry, s = e.bounds[y ? 'y2' : 'x2'] - item.padding, u = vgrad && lr ? s : 0, v = vgrad && lr ? 0 : s, o = y <= 0 ? 0 : (0, _vegaScenegraph.multiLineOffset)(title); - return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o)); -} -function translate(view, item, dx, dy) { - item.x += dx; - item.y += dy; - item.bounds.translate(dx, dy); - item.mark.bounds.translate(dx, dy); - view.dirty(item); -} -function legendEntryLayout(entries) { - // get max widths for each column - const widths = entries.reduce((w, g)=>{ - w[g.column] = Math.max(g.bounds.x2 - g.x, w[g.column] || 0); - return w; - }, {}); - // set dimensions of legend entry groups - entries.forEach((g)=>{ - g.width = widths[g.column]; - g.height = g.bounds.y2 - g.y; - }); -} -function titleLayout(view, mark, width, height, viewBounds) { - var group = mark.items[0], frame = group.frame, orient = group.orient, anchor = group.anchor, offset = group.offset, padding = group.padding, title = group.items[0].items[0], subtitle = group.items[1] && group.items[1].items[0], end = orient === Left || orient === Right ? height : width, start = 0, x = 0, y = 0, sx = 0, sy = 0, pos; - if (frame !== Group) orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2); - else if (orient === Left) start = height, end = 0; - pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2; - if (subtitle && subtitle.text) { - // position subtitle - switch(orient){ - case Top: - case Bottom: - sy = title.bounds.height() + padding; - break; - case Left: - sx = title.bounds.width() + padding; - break; - case Right: - sx = -title.bounds.width() - padding; - break; - } - tempBounds.clear().union(subtitle.bounds); - tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); - if (set(subtitle, 'x', sx) | set(subtitle, 'y', sy)) { - view.dirty(subtitle); - subtitle.bounds.clear().union(tempBounds); - subtitle.mark.bounds.clear().union(tempBounds); - view.dirty(subtitle); - } - tempBounds.clear().union(subtitle.bounds); - } else tempBounds.clear(); - tempBounds.union(title.bounds); - // position title group - switch(orient){ - case Top: - x = pos; - y = viewBounds.y1 - tempBounds.height() - offset; - break; - case Left: - x = viewBounds.x1 - tempBounds.width() - offset; - y = pos; - break; - case Right: - x = viewBounds.x2 + tempBounds.width() + offset; - y = pos; - break; - case Bottom: - x = pos; - y = viewBounds.y2 + offset; - break; - default: - x = group.x; - y = group.y; - } - if (set(group, 'x', x) | set(group, 'y', y)) { - tempBounds.translate(x, y); - view.dirty(group); - group.bounds.clear().union(tempBounds); - mark.bounds.clear().union(tempBounds); - view.dirty(group); - } - return group.bounds; -} -/** - * Layout view elements such as axes and legends. - * Also performs size adjustments. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.mark - Scenegraph mark of groups to layout. - */ function ViewLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(ViewLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const view = pulse.dataflow; - _.mark.items.forEach((group)=>{ - if (_.layout) trellisLayout(view, group, _.layout); - layoutGroup(view, group, _); - }); - return shouldReflow(_.mark.group) ? pulse.reflow() : pulse; - } -}); -function shouldReflow(group) { - // We typically should reflow if layout is invoked (#2568), as child items - // may have resized and reflow ensures group bounds are re-calculated. - // However, legend entries have a special exception to avoid instability. - // For example, if a selected legend symbol gains a stroke on hover, - // we don't want to re-position subsequent elements in the legend. - return group && group.mark.role !== 'legend-entry'; -} -function layoutGroup(view, group, _) { - var items = group.items, width = Math.max(0, group.width || 0), height = Math.max(0, group.height || 0), viewBounds = new (0, _vegaScenegraph.Bounds)().set(0, 0, width, height), xBounds = viewBounds.clone(), yBounds = viewBounds.clone(), legends = [], title, mark, orient, b, i, n; - // layout axes, gather legends, collect bounds - for(i = 0, n = items.length; i < n; ++i){ - mark = items[i]; - switch(mark.role){ - case AxisRole: - b = isYAxis(mark) ? xBounds : yBounds; - b.union(axisLayout(view, mark, width, height)); - break; - case TitleRole: - title = mark; - break; - case LegendRole: - legends.push(legendLayout(view, mark)); - break; - case FrameRole: - case ScopeRole: - case RowHeader: - case RowFooter: - case RowTitle: - case ColHeader: - case ColFooter: - case ColTitle: - xBounds.union(mark.bounds); - yBounds.union(mark.bounds); - break; - default: - viewBounds.union(mark.bounds); - } + return count2; + }; + prototype$1.extent = function(get2) { + if (this._get !== get2 || !this._ext) { + const v = this.values(), i = extentIndex(v, get2); + this._ext = [v[i[0]], v[i[1]]]; + this._get = get2; } - // layout legends, adjust viewBounds - if (legends.length) { - // group legends by orient - const l = {}; - legends.forEach((item)=>{ - orient = item.orient || Right; - if (orient !== None) (l[orient] || (l[orient] = [])).push(item); - }); - // perform grid layout for each orient group - for(const orient in l){ - const g = l[orient]; - gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height)); - } - // update view bounds - legends.forEach((item)=>{ - const b = item.bounds; - if (!b.equals(item._bounds)) { - item.bounds = item._bounds; - view.dirty(item); // dirty previous location - item.bounds = b; - view.dirty(item); - } - if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) // For autosize fit, incorporate the orthogonal dimension only. - // Legends that overrun the chart area will then be clipped; - // otherwise the chart area gets reduced to nothing! - switch(item.orient){ - case Left: - case Right: - viewBounds.add(b.x1, 0).add(b.x2, 0); - break; - case Top: - case Bottom: - viewBounds.add(0, b.y1).add(0, b.y2); - } - else viewBounds.union(b); - }); + return this._ext; + }; + prototype$1.argmin = function(get2) { + return this.extent(get2)[0] || {}; + }; + prototype$1.argmax = function(get2) { + return this.extent(get2)[1] || {}; + }; + prototype$1.min = function(get2) { + const m2 = this.extent(get2)[0]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.max = function(get2) { + const m2 = this.extent(get2)[1]; + return m2 != null ? get2(m2) : void 0; + }; + prototype$1.quartile = function(get2) { + if (this._get !== get2 || !this._q) { + this._q = quartiles(this.values(), get2); + this._get = get2; } - // combine bounding boxes - viewBounds.union(xBounds).union(yBounds); - // layout title, adjust bounds - if (title) viewBounds.union(titleLayout(view, title, width, height, viewBounds)); - // override aggregated view bounds if content is clipped - if (group.clip) viewBounds.set(0, 0, group.width || 0, group.height || 0); - // perform size adjustment - viewSizeLayout(view, group, viewBounds, _); -} -function viewSizeLayout(view, group, viewBounds, _) { - const auto = _.autosize || {}, type = auto.type; - if (view._autosize < 1 || !type) return; - let viewWidth = view._width, viewHeight = view._height, width = Math.max(0, group.width || 0), left = Math.max(0, Math.ceil(-viewBounds.x1)), height = Math.max(0, group.height || 0), top = Math.max(0, Math.ceil(-viewBounds.y1)); - const right = Math.max(0, Math.ceil(viewBounds.x2 - width)), bottom = Math.max(0, Math.ceil(viewBounds.y2 - height)); - if (auto.contains === Padding) { - const padding = view.padding(); - viewWidth -= padding.left + padding.right; - viewHeight -= padding.top + padding.bottom; - } - if (type === None) { - left = 0; - top = 0; - width = viewWidth; - height = viewHeight; - } else if (type === Fit) { - width = Math.max(0, viewWidth - left - right); - height = Math.max(0, viewHeight - top - bottom); - } else if (type === FitX) { - width = Math.max(0, viewWidth - left - right); - viewHeight = height + top + bottom; - } else if (type === FitY) { - viewWidth = width + left + right; - height = Math.max(0, viewHeight - top - bottom); - } else if (type === Pad) { - viewWidth = width + left + right; - viewHeight = height + top + bottom; - } - view._resizeView(viewWidth, viewHeight, width, height, [ - left, - top - ], auto.resize); -} - -},{"vega-dataflow":"3NitK","vega-scenegraph":"jattk","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jattk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "path", ()=>(0, _d3Path.path)); -parcelHelpers.export(exports, "Bounds", ()=>Bounds); -parcelHelpers.export(exports, "CanvasHandler", ()=>CanvasHandler); -parcelHelpers.export(exports, "CanvasRenderer", ()=>CanvasRenderer); -parcelHelpers.export(exports, "Gradient", ()=>Gradient); -parcelHelpers.export(exports, "GroupItem", ()=>GroupItem); -parcelHelpers.export(exports, "Handler", ()=>Handler); -parcelHelpers.export(exports, "HybridHandler", ()=>HybridHandler); -parcelHelpers.export(exports, "HybridRenderer", ()=>HybridRenderer); -parcelHelpers.export(exports, "Item", ()=>Item); -parcelHelpers.export(exports, "Marks", ()=>Marks); -parcelHelpers.export(exports, "RenderType", ()=>RenderType); -parcelHelpers.export(exports, "Renderer", ()=>Renderer); -parcelHelpers.export(exports, "ResourceLoader", ()=>ResourceLoader); -parcelHelpers.export(exports, "SVGHandler", ()=>SVGHandler); -parcelHelpers.export(exports, "SVGRenderer", ()=>SVGRenderer); -parcelHelpers.export(exports, "SVGStringRenderer", ()=>SVGStringRenderer); -parcelHelpers.export(exports, "Scenegraph", ()=>Scenegraph); -parcelHelpers.export(exports, "boundClip", ()=>boundClip); -parcelHelpers.export(exports, "boundContext", ()=>boundContext); -parcelHelpers.export(exports, "boundItem", ()=>boundItem); -parcelHelpers.export(exports, "boundMark", ()=>boundMark); -parcelHelpers.export(exports, "boundStroke", ()=>boundStroke); -parcelHelpers.export(exports, "domChild", ()=>domChild); -parcelHelpers.export(exports, "domClear", ()=>domClear); -parcelHelpers.export(exports, "domCreate", ()=>domCreate); -parcelHelpers.export(exports, "domFind", ()=>domFind); -parcelHelpers.export(exports, "font", ()=>font); -parcelHelpers.export(exports, "fontFamily", ()=>fontFamily); -parcelHelpers.export(exports, "fontSize", ()=>fontSize); -parcelHelpers.export(exports, "intersect", ()=>intersect); -parcelHelpers.export(exports, "intersectBoxLine", ()=>intersectBoxLine); -parcelHelpers.export(exports, "intersectPath", ()=>intersectPath); -parcelHelpers.export(exports, "intersectPoint", ()=>intersectPoint); -parcelHelpers.export(exports, "intersectRule", ()=>intersectRule); -parcelHelpers.export(exports, "lineHeight", ()=>lineHeight); -parcelHelpers.export(exports, "markup", ()=>markup); -parcelHelpers.export(exports, "multiLineOffset", ()=>multiLineOffset); -parcelHelpers.export(exports, "pathCurves", ()=>curves); -parcelHelpers.export(exports, "pathEqual", ()=>pathEqual); -parcelHelpers.export(exports, "pathParse", ()=>parse); -parcelHelpers.export(exports, "pathRectangle", ()=>vg_rect); -parcelHelpers.export(exports, "pathRender", ()=>pathRender); -parcelHelpers.export(exports, "pathSymbols", ()=>symbols); -parcelHelpers.export(exports, "pathTrail", ()=>vg_trail); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "renderModule", ()=>renderModule); -parcelHelpers.export(exports, "resetSVGClipId", ()=>resetSVGClipId); -parcelHelpers.export(exports, "resetSVGDefIds", ()=>resetSVGDefIds); -parcelHelpers.export(exports, "sceneEqual", ()=>sceneEqual); -parcelHelpers.export(exports, "sceneFromJSON", ()=>sceneFromJSON); -parcelHelpers.export(exports, "scenePickVisit", ()=>pickVisit); -parcelHelpers.export(exports, "sceneToJSON", ()=>sceneToJSON); -parcelHelpers.export(exports, "sceneVisit", ()=>visit); -parcelHelpers.export(exports, "sceneZOrder", ()=>zorder); -parcelHelpers.export(exports, "serializeXML", ()=>serializeXML); -parcelHelpers.export(exports, "setHybridRendererOptions", ()=>setHybridRendererOptions); -parcelHelpers.export(exports, "textMetrics", ()=>textMetrics); -var _vegaUtil = require("vega-util"); -var _d3Shape = require("d3-shape"); -var _d3Path = require("d3-path"); -var _vegaCanvas = require("vega-canvas"); -var _vegaLoader = require("vega-loader"); -var _vegaScale = require("vega-scale"); -let gradient_id = 0; -function resetSVGGradientId() { - gradient_id = 0; -} -const patternPrefix = 'p_'; -function isGradient(value) { - return value && value.gradient; -} -function gradientRef(g, defs, base) { - const type = g.gradient; - let id = g.id, prefix = type === 'radial' ? patternPrefix : ''; - // check id, assign default values as needed - if (!id) { - id = g.id = 'gradient_' + gradient_id++; - if (type === 'radial') { - g.x1 = get(g.x1, 0.5); - g.y1 = get(g.y1, 0.5); - g.r1 = get(g.r1, 0); - g.x2 = get(g.x2, 0.5); - g.y2 = get(g.y2, 0.5); - g.r2 = get(g.r2, 0.5); - prefix = patternPrefix; - } else { - g.x1 = get(g.x1, 0); - g.y1 = get(g.y1, 0); - g.x2 = get(g.x2, 1); - g.y2 = get(g.y2, 0); - } - } - // register definition - defs[id] = g; - // return url reference - return 'url(' + (base || '') + '#' + prefix + id + ')'; -} -function get(val, def) { - return val != null ? val : def; -} -function Gradient(p0, p1) { - var stops = [], gradient; - return gradient = { - gradient: 'linear', - x1: p0 ? p0[0] : 0, - y1: p0 ? p0[1] : 0, - x2: p1 ? p1[0] : 1, - y2: p1 ? p1[1] : 0, - stops: stops, - stop: function(offset, color) { - stops.push({ - offset: offset, - color: color - }); - return gradient; - } - }; -} -const lookup = { - 'basis': { - curve: (0, _d3Shape.curveBasis) - }, - 'basis-closed': { - curve: (0, _d3Shape.curveBasisClosed) - }, - 'basis-open': { - curve: (0, _d3Shape.curveBasisOpen) - }, - 'bundle': { - curve: (0, _d3Shape.curveBundle), - tension: 'beta', - value: 0.85 - }, - 'cardinal': { - curve: (0, _d3Shape.curveCardinal), - tension: 'tension', - value: 0 - }, - 'cardinal-open': { - curve: (0, _d3Shape.curveCardinalOpen), - tension: 'tension', - value: 0 - }, - 'cardinal-closed': { - curve: (0, _d3Shape.curveCardinalClosed), - tension: 'tension', - value: 0 - }, - 'catmull-rom': { - curve: (0, _d3Shape.curveCatmullRom), - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-closed': { - curve: (0, _d3Shape.curveCatmullRomClosed), - tension: 'alpha', - value: 0.5 - }, - 'catmull-rom-open': { - curve: (0, _d3Shape.curveCatmullRomOpen), - tension: 'alpha', - value: 0.5 - }, - 'linear': { - curve: (0, _d3Shape.curveLinear) - }, - 'linear-closed': { - curve: (0, _d3Shape.curveLinearClosed) - }, - 'monotone': { - horizontal: (0, _d3Shape.curveMonotoneY), - vertical: (0, _d3Shape.curveMonotoneX) - }, - 'natural': { - curve: (0, _d3Shape.curveNatural) - }, - 'step': { - curve: (0, _d3Shape.curveStep) - }, - 'step-after': { - curve: (0, _d3Shape.curveStepAfter) - }, - 'step-before': { - curve: (0, _d3Shape.curveStepBefore) - } -}; -function curves(type, orientation, tension) { - var entry = (0, _vegaUtil.hasOwnProperty)(lookup, type) && lookup[type], curve = null; - if (entry) { - curve = entry.curve || entry[orientation || 'vertical']; - if (entry.tension && tension != null) curve = curve[entry.tension](tension); - } - return curve; -} -const paramCounts = { - m: 2, - l: 2, - h: 1, - v: 1, - z: 0, - c: 6, - s: 4, - q: 4, - t: 2, - a: 7 -}; -const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; -const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; -const spacePattern = /^((\s+,?\s*)|(,\s*))/; -const flagPattern = /^[01]/; -function parse(path) { - const commands = []; - const matches = path.match(commandPattern) || []; - matches.forEach((str)=>{ - let cmd = str[0]; - const type = cmd.toLowerCase(); - // parse parameters - const paramCount = paramCounts[type]; - const params = parseParams(type, paramCount, str.slice(1).trim()); - const count = params.length; - // error checking based on parameter count - if (count < paramCount || count && count % paramCount !== 0) throw Error('Invalid SVG path, incorrect parameter count'); - // register the command - commands.push([ - cmd, - ...params.slice(0, paramCount) - ]); - // exit now if we're done, also handles zero-param 'z' - if (count === paramCount) return; - // handle implicit line-to - if (type === 'm') cmd = cmd === 'M' ? 'L' : 'l'; - // repeat command when given extended param list - for(let i = paramCount; i < count; i += paramCount)commands.push([ - cmd, - ...params.slice(i, i + paramCount) - ]); - }); - return commands; -} -function parseParams(type, paramCount, segment) { - const params = []; - for(let index = 0; paramCount && index < segment.length;)for(let i = 0; i < paramCount; ++i){ - const pattern = type === 'a' && (i === 3 || i === 4) ? flagPattern : numberPattern; - const match = segment.slice(index).match(pattern); - if (match === null) throw Error('Invalid SVG path, incorrect parameter type'); - index += match[0].length; - params.push(+match[0]); - const ws = segment.slice(index).match(spacePattern); - if (ws !== null) index += ws[0].length; - } - return params; -} -const DegToRad = Math.PI / 180; -const Epsilon = 1e-14; -const HalfPi = Math.PI / 2; -const Tau = Math.PI * 2; -const HalfSqrt3 = Math.sqrt(3) / 2; -var segmentCache = {}; -var bezierCache = {}; -var join = [].join; -// Copied from Inkscape svgtopdf, thanks! -function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) { - const key = join.call(arguments); - if (segmentCache[key]) return segmentCache[key]; - const th = rotateX * DegToRad; - const sin_th = Math.sin(th); - const cos_th = Math.cos(th); - rx = Math.abs(rx); - ry = Math.abs(ry); - const px = cos_th * (ox - x) * 0.5 + sin_th * (oy - y) * 0.5; - const py = cos_th * (oy - y) * 0.5 - sin_th * (ox - x) * 0.5; - let pl = px * px / (rx * rx) + py * py / (ry * ry); - if (pl > 1) { - pl = Math.sqrt(pl); - rx *= pl; - ry *= pl; + return this._q; + }; + prototype$1.q1 = function(get2) { + return this.quartile(get2)[0]; + }; + prototype$1.q2 = function(get2) { + return this.quartile(get2)[1]; + }; + prototype$1.q3 = function(get2) { + return this.quartile(get2)[2]; + }; + prototype$1.ci = function(get2) { + if (this._get !== get2 || !this._ci) { + this._ci = bootstrapCI(this.values(), 1e3, 0.05, get2); + this._get = get2; } - const a00 = cos_th / rx; - const a01 = sin_th / rx; - const a10 = -sin_th / ry; - const a11 = cos_th / ry; - const x0 = a00 * ox + a01 * oy; - const y0 = a10 * ox + a11 * oy; - const x1 = a00 * x + a01 * y; - const y1 = a10 * x + a11 * y; - const d = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0); - let sfactor_sq = 1 / d - 0.25; - if (sfactor_sq < 0) sfactor_sq = 0; - let sfactor = Math.sqrt(sfactor_sq); - if (sweep == large) sfactor = -sfactor; - const xc = 0.5 * (x0 + x1) - sfactor * (y1 - y0); - const yc = 0.5 * (y0 + y1) + sfactor * (x1 - x0); - const th0 = Math.atan2(y0 - yc, x0 - xc); - const th1 = Math.atan2(y1 - yc, x1 - xc); - let th_arc = th1 - th0; - if (th_arc < 0 && sweep === 1) th_arc += Tau; - else if (th_arc > 0 && sweep === 0) th_arc -= Tau; - const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 0.001))); - const result = []; - for(let i = 0; i < segs; ++i){ - const th2 = th0 + i * th_arc / segs; - const th3 = th0 + (i + 1) * th_arc / segs; - result[i] = [ - xc, - yc, - th2, - th3, - rx, - ry, - sin_th, - cos_th - ]; - } - return segmentCache[key] = result; -} -function bezier(params) { - const key = join.call(params); - if (bezierCache[key]) return bezierCache[key]; - var cx = params[0], cy = params[1], th0 = params[2], th1 = params[3], rx = params[4], ry = params[5], sin_th = params[6], cos_th = params[7]; - const a00 = cos_th * rx; - const a01 = -sin_th * ry; - const a10 = sin_th * rx; - const a11 = cos_th * ry; - const cos_th0 = Math.cos(th0); - const sin_th0 = Math.sin(th0); - const cos_th1 = Math.cos(th1); - const sin_th1 = Math.sin(th1); - const th_half = 0.5 * (th1 - th0); - const sin_th_h2 = Math.sin(th_half * 0.5); - const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); - const x1 = cx + cos_th0 - t * sin_th0; - const y1 = cy + sin_th0 + t * cos_th0; - const x3 = cx + cos_th1; - const y3 = cy + sin_th1; - const x2 = x3 + t * sin_th1; - const y2 = y3 - t * cos_th1; - return bezierCache[key] = [ - a00 * x1 + a01 * y1, - a10 * x1 + a11 * y1, - a00 * x2 + a01 * y2, - a10 * x2 + a11 * y2, - a00 * x3 + a01 * y3, - a10 * x3 + a11 * y3 - ]; -} -const temp = [ - 'l', - 0, - 0, - 0, - 0, - 0, - 0, - 0 -]; -function scale$1(current, sX, sY) { - const c = temp[0] = current[0]; - if (c === 'a' || c === 'A') { - temp[1] = sX * current[1]; - temp[2] = sY * current[2]; - temp[3] = current[3]; - temp[4] = current[4]; - temp[5] = current[5]; - temp[6] = sX * current[6]; - temp[7] = sY * current[7]; - } else if (c === 'h' || c === 'H') temp[1] = sX * current[1]; - else if (c === 'v' || c === 'V') temp[1] = sY * current[1]; - else for(var i = 1, n = current.length; i < n; ++i)temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; - return temp; -} -function pathRender(context, path, l, t, sX, sY) { - var current, // current instruction - previous = null, x = 0, // current x - y = 0, // current y - controlX = 0, // current control point x - controlY = 0, // current control point y - tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; - if (l == null) l = 0; - if (t == null) t = 0; - if (sX == null) sX = 1; - if (sY == null) sY = sX; - if (context.beginPath) context.beginPath(); - for(var i = 0, len = path.length; i < len; ++i){ - current = path[i]; - if (sX !== 1 || sY !== 1) current = scale$1(current, sX, sY); - switch(current[0]){ - // first letter - case 'l': - // lineto, relative - x += current[1]; - y += current[2]; - context.lineTo(x + l, y + t); - break; - case 'L': - // lineto, absolute - x = current[1]; - y = current[2]; - context.lineTo(x + l, y + t); - break; - case 'h': - // horizontal lineto, relative - x += current[1]; - context.lineTo(x + l, y + t); - break; - case 'H': - // horizontal lineto, absolute - x = current[1]; - context.lineTo(x + l, y + t); - break; - case 'v': - // vertical lineto, relative - y += current[1]; - context.lineTo(x + l, y + t); - break; - case 'V': - // verical lineto, absolute - y = current[1]; - context.lineTo(x + l, y + t); - break; - case 'm': - // moveTo, relative - x += current[1]; - y += current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'M': - // moveTo, absolute - x = current[1]; - y = current[2]; - anchorX = x; - anchorY = y; - context.moveTo(x + l, y + t); - break; - case 'c': - // bezierCurveTo, relative - tempX = x + current[5]; - tempY = y + current[6]; - controlX = x + current[3]; - controlY = y + current[4]; - context.bezierCurveTo(x + current[1] + l, // x1 - y + current[2] + t, // y1 - controlX + l, // x2 - controlY + t, // y2 - tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'C': - // bezierCurveTo, absolute - x = current[5]; - y = current[6]; - controlX = current[3]; - controlY = current[4]; - context.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t); - break; - case 's': - // shorthand cubic bezierCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t); - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = x + current[1]; - controlY = y + current[2]; - x = tempX; - y = tempY; - break; - case 'S': - // shorthand cubic bezierCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - // set control point to 2nd one of this command - // the first control point is assumed to be the reflection of - // the second control point on the previous command relative - // to the current point. - controlX = current[1]; - controlY = current[2]; - break; - case 'q': - // quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[3]; - tempY = y + current[4]; - controlX = x + current[1]; - controlY = y + current[2]; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'Q': - // quadraticCurveTo, absolute - tempX = current[3]; - tempY = current[4]; - context.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = current[1]; - controlY = current[2]; - break; - case 't': - // shorthand quadraticCurveTo, relative - // transform to absolute x,y - tempX = x + current[1]; - tempY = y + current[2]; - if (previous[0].match(/[QqTt]/) === null) { - // If there is no previous command or if the previous command was not a Q, q, T or t, - // assume the control point is coincident with the current point - controlX = x; - controlY = y; - } else if (previous[0] === 't') { - // calculate reflection of previous control points for t - controlX = 2 * x - tempControlX; - controlY = 2 * y - tempControlY; - } else if (previous[0] === 'q') { - // calculate reflection of previous control points for q - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - } - tempControlX = controlX; - tempControlY = controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - controlX = x + current[1]; - controlY = y + current[2]; - break; - case 'T': - tempX = current[1]; - tempY = current[2]; - // calculate reflection of previous control points - controlX = 2 * x - controlX; - controlY = 2 * y - controlY; - context.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); - x = tempX; - y = tempY; - break; - case 'a': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + x + l, - current[7] + y + t - ]); - x += current[6]; - y += current[7]; - break; - case 'A': - drawArc(context, x + l, y + t, [ - current[1], - current[2], - current[3], - current[4], - current[5], - current[6] + l, - current[7] + t - ]); - x = current[6]; - y = current[7]; - break; - case 'z': - case 'Z': - x = anchorX; - y = anchorY; - context.closePath(); - break; - } - previous = current; - } -} -function drawArc(context, x, y, coords) { - const seg = segments(coords[5], // end x - coords[6], // end y - coords[0], // radius x - coords[1], // radius y - coords[3], // large flag - coords[4], // sweep flag - coords[2], // rotation - x, y); - for(let i = 0; i < seg.length; ++i){ - const bez = bezier(seg[i]); - context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); - } -} -const Tan30 = 0.5773502691896257; -const builtins = { - 'circle': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(r, 0); - context.arc(0, 0, r, 0, Tau); - } - }, - 'cross': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 2.5; - context.moveTo(-r, -s); - context.lineTo(-r, s); - context.lineTo(-s, s); - context.lineTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, s); - context.lineTo(r, s); - context.lineTo(r, -s); - context.lineTo(s, -s); - context.lineTo(s, -r); - context.lineTo(-s, -r); - context.lineTo(-s, -s); - context.closePath(); + return this._ci; + }; + prototype$1.ci0 = function(get2) { + return this.ci(get2)[0]; + }; + prototype$1.ci1 = function(get2) { + return this.ci(get2)[1]; + }; + function Aggregate$1(params2) { + Transform.call(this, null, params2); + this._adds = []; + this._mods = []; + this._alen = 0; + this._mlen = 0; + this._drop = true; + this._cross = false; + this._dims = []; + this._dnames = []; + this._measures = []; + this._countOnly = false; + this._counts = null; + this._prev = null; + this._inputs = null; + this._outputs = null; + } + Aggregate$1.Definition = { + "type": "Aggregate", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "drop", + "type": "boolean", + "default": true + }, { + "name": "cross", + "type": "boolean", + "default": false + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Aggregate$1, Transform, { + transform(_, pulse2) { + const aggr = this, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), mod = _.modified(); + aggr.stamp = out.stamp; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + aggr._prev = aggr.value; + aggr.value = mod ? aggr.init(_) : /* @__PURE__ */ Object.create(null); + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + aggr.value = aggr.value || aggr.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + out.modifies(aggr._outputs); + aggr._drop = _.drop !== false; + if (_.cross && aggr._dims.length > 1) { + aggr._drop = false; + aggr.cross(); + } + if (pulse2.clean() && aggr._drop) { + out.clean(true).runAfter(() => this.clean()); + } + return aggr.changes(out); + }, + cross() { + const aggr = this, curr = aggr.value, dims = aggr._dnames, vals = dims.map(() => ({})), n = dims.length; + function collect2(cells) { + let key2, i, t, v; + for (key2 in cells) { + t = cells[key2].tuple; + for (i = 0; i < n; ++i) { + vals[i][v = t[dims[i]]] = v; + } } - }, - 'diamond': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.closePath(); + } + collect2(aggr._prev); + collect2(curr); + function generate2(base2, tuple, index2) { + const name = dims[index2], v = vals[index2++]; + for (const k in v) { + const key2 = base2 ? base2 + "|" + k : k; + tuple[name] = v[k]; + if (index2 < n) generate2(key2, tuple, index2); + else if (!curr[key2]) aggr.cell(key2, tuple); } - }, - 'square': { - draw: function(context, size) { - var w = Math.sqrt(size), x = -w / 2; - context.rect(x, x, w, w); + } + generate2("", {}, 0); + }, + init(_) { + const inputs = this._inputs = [], outputs = this._outputs = [], inputMap = {}; + function inputVisit(get2) { + const fields2 = array$5(accessorFields(get2)), n2 = fields2.length; + let i2 = 0, f; + for (; i2 < n2; ++i2) { + if (!inputMap[f = fields2[i2]]) { + inputMap[f] = 1; + inputs.push(f); + } } + } + this._dims = array$5(_.groupby); + this._dnames = this._dims.map((d) => { + const dname = accessorName(d); + inputVisit(d); + outputs.push(dname); + return dname; + }); + this.cellkey = _.key ? _.key : groupkey(this._dims); + this._countOnly = true; + this._counts = []; + this._measures = []; + const fields = _.fields || [null], ops2 = _.ops || ["count"], aggregate_params = _.aggregate_params || [null], as = _.as || [], n = fields.length, map2 = {}; + let field2, op, aggregate_param, m2, mname, outname, i; + if (n !== ops2.length) { + error("Unmatched number of fields and aggregate ops."); + } + for (i = 0; i < n; ++i) { + field2 = fields[i]; + op = ops2[i]; + aggregate_param = aggregate_params[i] || null; + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + mname = accessorName(field2); + outname = measureName(op, mname, as[i]); + outputs.push(outname); + if (op === "count") { + this._counts.push(outname); + continue; + } + m2 = map2[mname]; + if (!m2) { + inputVisit(field2); + m2 = map2[mname] = []; + m2.field = field2; + this._measures.push(m2); + } + if (op !== "count") this._countOnly = false; + m2.push(createMeasure(op, aggregate_param, outname)); + } + this._measures = this._measures.map((m3) => compileMeasures(m3, m3.field)); + return /* @__PURE__ */ Object.create(null); }, - 'arrow': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, s = r / 7, t = r / 2.5, v = r / 8; - context.moveTo(-s, r); - context.lineTo(s, r); - context.lineTo(s, -v); - context.lineTo(t, -v); - context.lineTo(0, -r); - context.lineTo(-t, -v); - context.lineTo(-s, -v); - context.closePath(); - } + // -- Cell Management ----- + cellkey: groupkey(), + cell(key2, t) { + let cell2 = this.value[key2]; + if (!cell2) { + cell2 = this.value[key2] = this.newcell(key2, t); + this._adds[this._alen++] = cell2; + } else if (cell2.num === 0 && this._drop && cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._adds[this._alen++] = cell2; + } else if (cell2.stamp < this.stamp) { + cell2.stamp = this.stamp; + this._mods[this._mlen++] = cell2; + } + return cell2; }, - 'wedge': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30, b = r / 4; - context.moveTo(0, -h - o); - context.lineTo(-b, h - o); - context.lineTo(b, h - o); - context.closePath(); + newcell(key2, t) { + const cell2 = { + key: key2, + num: 0, + agg: null, + tuple: this.newtuple(t, this._prev && this._prev[key2]), + stamp: this.stamp, + store: false + }; + if (!this._countOnly) { + const measures = this._measures, n = measures.length; + cell2.agg = Array(n); + for (let i = 0; i < n; ++i) { + cell2.agg[i] = new measures[i](cell2); } + } + if (cell2.store) { + cell2.data = new TupleStore(); + } + return cell2; }, - 'triangle': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r, o = h - r * Tan30; - context.moveTo(0, -h - o); - context.lineTo(-r, h - o); - context.lineTo(r, h - o); - context.closePath(); - } + newtuple(t, p) { + const names = this._dnames, dims = this._dims, n = dims.length, x2 = {}; + for (let i = 0; i < n; ++i) { + x2[names[i]] = dims[i](t); + } + return p ? replace$1(p.tuple, x2) : ingest$1(x2); }, - 'triangle-up': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, -h); - context.lineTo(-r, h); - context.lineTo(r, h); - context.closePath(); + clean() { + const cells = this.value; + for (const key2 in cells) { + if (cells[key2].num === 0) { + delete cells[key2]; } + } }, - 'triangle-down': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(0, h); - context.lineTo(-r, -h); - context.lineTo(r, -h); - context.closePath(); - } + // -- Process Tuples ----- + add(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num += 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.add(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].add(agg[i].get(t), t); + } }, - 'triangle-right': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(h, 0); - context.lineTo(-h, -r); - context.lineTo(-h, r); - context.closePath(); - } + rem(t) { + const key2 = this.cellkey(t), cell2 = this.cell(key2, t); + cell2.num -= 1; + if (this._countOnly) return; + if (cell2.store) cell2.data.rem(t); + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].rem(agg[i].get(t), t); + } }, - 'triangle-left': { - draw: function(context, size) { - var r = Math.sqrt(size) / 2, h = HalfSqrt3 * r; - context.moveTo(-h, 0); - context.lineTo(h, -r); - context.lineTo(h, r); - context.closePath(); + celltuple(cell2) { + const tuple = cell2.tuple, counts = this._counts; + if (cell2.store) { + cell2.data.values(); + } + for (let i = 0, n = counts.length; i < n; ++i) { + tuple[counts[i]] = cell2.num; + } + if (!this._countOnly) { + const agg = cell2.agg; + for (let i = 0, n = agg.length; i < n; ++i) { + agg[i].set(tuple); } - }, - 'stroke': { - draw: function(context, size) { - const r = Math.sqrt(size) / 2; - context.moveTo(-r, 0); - context.lineTo(r, 0); - } - } -}; -function symbols(_) { - return (0, _vegaUtil.hasOwnProperty)(builtins, _) ? builtins[_] : customSymbol(_); -} -var custom = {}; -function customSymbol(path) { - if (!(0, _vegaUtil.hasOwnProperty)(custom, path)) { - const parsed = parse(path); - custom[path] = { - draw: function(context, size) { - pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2); - } - }; + } + return tuple; + }, + changes(out) { + const adds = this._adds, mods = this._mods, prev = this._prev, drop = this._drop, add2 = out.add, rem2 = out.rem, mod = out.mod; + let cell2, key2, i, n; + if (prev) for (key2 in prev) { + cell2 = prev[key2]; + if (!drop || cell2.num) rem2.push(cell2.tuple); + } + for (i = 0, n = this._alen; i < n; ++i) { + add2.push(this.celltuple(adds[i])); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + cell2 = mods[i]; + (cell2.num === 0 && drop ? rem2 : mod).push(this.celltuple(cell2)); + mods[i] = null; + } + this._alen = this._mlen = 0; + this._prev = null; + return out; } - return custom[path]; -} -// See http://spencermortensen.com/articles/bezier-circle/ -const C = 0.448084975506; // C = 1 - c -function rectangleX(d) { - return d.x; -} -function rectangleY(d) { - return d.y; -} -function rectangleWidth(d) { - return d.width; -} -function rectangleHeight(d) { - return d.height; -} -function number(_) { - return typeof _ === 'function' ? _ : ()=>+_; -} -function clamp(value, min, max) { - return Math.max(min, Math.min(value, max)); -} -function vg_rect() { - var x = rectangleX, y = rectangleY, width = rectangleWidth, height = rectangleHeight, crTL = number(0), crTR = crTL, crBL = crTL, crBR = crTL, context = null; - function rectangle(_, x0, y0) { - var buffer, x1 = x0 != null ? x0 : +x.call(this, _), y1 = y0 != null ? y0 : +y.call(this, _), w = +width.call(this, _), h = +height.call(this, _), s = Math.min(w, h) / 2, tl = clamp(+crTL.call(this, _), 0, s), tr = clamp(+crTR.call(this, _), 0, s), bl = clamp(+crBL.call(this, _), 0, s), br = clamp(+crBR.call(this, _), 0, s); - if (!context) context = buffer = (0, _d3Path.path)(); - if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) context.rect(x1, y1, w, h); - else { - var x2 = x1 + w, y2 = y1 + h; - context.moveTo(x1 + tl, y1); - context.lineTo(x2 - tr, y1); - context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr); - context.lineTo(x2, y2 - br); - context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2); - context.lineTo(x1 + bl, y2); - context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl); - context.lineTo(x1, y1 + tl); - context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1); - context.closePath(); - } - if (buffer) { - context = null; - return buffer + '' || null; - } - } - rectangle.x = function(_) { - if (arguments.length) { - x = number(_); - return rectangle; - } else return x; - }; - rectangle.y = function(_) { - if (arguments.length) { - y = number(_); - return rectangle; - } else return y; - }; - rectangle.width = function(_) { - if (arguments.length) { - width = number(_); - return rectangle; - } else return width; - }; - rectangle.height = function(_) { - if (arguments.length) { - height = number(_); - return rectangle; - } else return height; - }; - rectangle.cornerRadius = function(tl, tr, br, bl) { - if (arguments.length) { - crTL = number(tl); - crTR = tr != null ? number(tr) : crTL; - crBR = br != null ? number(br) : crTL; - crBL = bl != null ? number(bl) : crTR; - return rectangle; - } else return crTL; - }; - rectangle.context = function(_) { - if (arguments.length) { - context = _ == null ? null : _; - return rectangle; - } else return context; - }; - return rectangle; -} -function vg_trail() { - var x, y, size, defined, context = null, ready, x1, y1, r1; - function point(x2, y2, w2) { - const r2 = w2 / 2; - if (ready) { - var ux = y1 - y2, uy = x2 - x1; - if (ux || uy) { - // get normal vector - var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); - // draw segment - context.moveTo(x1 - rx, y1 - ry); - context.lineTo(x2 - ux * r2, y2 - uy * r2); - context.arc(x2, y2, r2, t - Math.PI, t); - context.lineTo(x1 + rx, y1 + ry); - context.arc(x1, y1, r1, t, t + Math.PI); - } else context.arc(x2, y2, r2, 0, Tau); - context.closePath(); - } else ready = 1; - x1 = x2; - y1 = y2; - r1 = r2; - } - function trail(data) { - var i, n = data.length, d, defined0 = false, buffer; - if (context == null) context = buffer = (0, _d3Path.path)(); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) ready = 0; - } - if (defined0) point(+x(d, i, data), +y(d, i, data), +size(d, i, data)); - } - if (buffer) { - context = null; - return buffer + '' || null; - } + }); + const EPSILON$1$1 = 1e-14; + function Bin(params2) { + Transform.call(this, null, params2); + } + Bin.Definition = { + "type": "Bin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "anchor", + "type": "number" + }, { + "name": "maxbins", + "type": "number", + "default": 20 + }, { + "name": "base", + "type": "number", + "default": 10 + }, { + "name": "divide", + "type": "number", + "array": true, + "default": [5, 2] + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "span", + "type": "number" + }, { + "name": "step", + "type": "number" + }, { + "name": "steps", + "type": "number", + "array": true + }, { + "name": "minstep", + "type": "number", + "default": 0 + }, { + "name": "nice", + "type": "boolean", + "default": true + }, { + "name": "name", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["bin0", "bin1"] + }] + }; + inherits(Bin, Transform, { + transform(_, pulse2) { + const band2 = _.interval !== false, bins = this._bins(_), start = bins.start, step = bins.step, as = _.as || ["bin0", "bin1"], b0 = as[0], b1 = as[1]; + let flag2; + if (_.modified()) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + } else { + flag2 = pulse2.modified(accessorFields(_.field)) ? pulse2.ADD_MOD : pulse2.ADD; + } + pulse2.visit(flag2, band2 ? (t) => { + const v = bins(t); + t[b0] = v; + t[b1] = v == null ? null : start + step * (1 + (v - start) / step); + } : (t) => t[b0] = bins(t)); + return pulse2.modifies(band2 ? as : b0); + }, + _bins(_) { + if (this.value && !_.modified()) { + return this.value; + } + const field2 = _.field, bins = bin(_), step = bins.step; + let start = bins.start, stop2 = start + Math.ceil((bins.stop - start) / step) * step, a2, d; + if ((a2 = _.anchor) != null) { + d = a2 - (start + step * Math.floor((a2 - start) / step)); + start += d; + stop2 += d; + } + const f = function(t) { + let v = toNumber(field2(t)); + return v == null ? null : v < start ? -Infinity : v > stop2 ? Infinity : (v = Math.max(start, Math.min(v, stop2 - step)), start + step * Math.floor(EPSILON$1$1 + (v - start) / step)); + }; + f.start = start; + f.stop = bins.stop; + f.step = step; + return this.value = accessor(f, accessorFields(field2), _.name || "bin_" + accessorName(field2)); } - trail.x = function(_) { - if (arguments.length) { - x = _; - return trail; - } else return x; - }; - trail.y = function(_) { - if (arguments.length) { - y = _; - return trail; - } else return y; - }; - trail.size = function(_) { - if (arguments.length) { - size = _; - return trail; - } else return size; - }; - trail.defined = function(_) { - if (arguments.length) { - defined = _; - return trail; - } else return defined; + }); + function SortedList(idFunc, source2, input) { + const $2 = idFunc; + let data2 = source2 || [], add2 = input || [], rem2 = {}, cnt = 0; + return { + add: (t) => add2.push(t), + remove: (t) => rem2[$2(t)] = ++cnt, + size: () => data2.length, + data: (compare2, resort) => { + if (cnt) { + data2 = data2.filter((t) => !rem2[$2(t)]); + rem2 = {}; + cnt = 0; + } + if (resort && compare2) { + data2.sort(compare2); + } + if (add2.length) { + data2 = compare2 ? merge$3(compare2, data2, add2.sort(compare2)) : data2.concat(add2); + add2 = []; + } + return data2; + } }; - trail.context = function(_) { - if (arguments.length) { - if (_ == null) context = null; - else context = _; - return trail; - } else return context; - }; - return trail; -} -function value$1(a, b) { - return a != null ? a : b; -} -const x = (item)=>item.x || 0, y = (item)=>item.y || 0, w = (item)=>item.width || 0, h = (item)=>item.height || 0, xw = (item)=>(item.x || 0) + (item.width || 0), yh = (item)=>(item.y || 0) + (item.height || 0), sa = (item)=>item.startAngle || 0, ea = (item)=>item.endAngle || 0, pa = (item)=>item.padAngle || 0, ir = (item)=>item.innerRadius || 0, or = (item)=>item.outerRadius || 0, cr = (item)=>item.cornerRadius || 0, tl = (item)=>value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item)=>value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item)=>value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item)=>value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item)=>value$1(item.size, 64), ts = (item)=>item.size || 1, def = (item)=>!(item.defined === false), type = (item)=>symbols(item.shape || 'circle'); -const arcShape = (0, _d3Shape.arc)().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = (0, _d3Shape.area)().x(x).y1(y).y0(yh).defined(def), areahShape = (0, _d3Shape.area)().y(y).x1(x).x0(xw).defined(def), lineShape = (0, _d3Shape.line)().x(x).y(y).defined(def), rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = (0, _d3Shape.symbol)().type(type).size(sz), trailShape = vg_trail().x(x).y(y).defined(def).size(ts); -function hasCornerRadius(item) { - return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; -} -function arc$1(context, item) { - return arcShape.context(context)(item); -} -function area$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function line$1(context, items) { - const item = items[0], interp = item.interpolate || 'linear'; - return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items); -} -function rectangle(context, item, x, y) { - return rectShape.context(context)(item, x, y); -} -function shape$1(context, item) { - return (item.mark.shape || item.shape).context(context)(item); -} -function symbol$1(context, item) { - return symbolShape.context(context)(item); -} -function trail$1(context, items) { - return trailShape.context(context)(items); -} -var clip_id = 1; -function resetSVGClipId() { - clip_id = 1; -} -function clip$1(renderer, item, size) { - var clip = item.clip, defs = renderer._defs, id = item.clip_id || (item.clip_id = 'clip' + clip_id++), c = defs.clipping[id] || (defs.clipping[id] = { - id: id - }); - if ((0, _vegaUtil.isFunction)(clip)) c.path = clip(null); - else if (hasCornerRadius(size)) c.path = rectangle(null, size, 0, 0); - else { - c.width = size.width || 0; - c.height = size.height || 0; + } + function Collect$1(params2) { + Transform.call(this, [], params2); + } + Collect$1.Definition = { + "type": "Collect", + "metadata": { + "source": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }] + }; + inherits(Collect$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), list = SortedList(tupleid, this.value, out.materialize(out.ADD).add), sort2 = _.sort, mod = pulse2.changed() || sort2 && (_.modified("sort") || pulse2.modified(sort2.fields)); + out.visit(out.REM, list.remove); + this.modified(mod); + this.value = out.source = list.data(stableCompare(sort2), mod); + if (pulse2.source && pulse2.source.root) { + this.value.root = pulse2.source.root; + } + return out; } - return 'url(#' + id + ')'; -} -function Bounds(b) { - this.clear(); - if (b) this.union(b); -} -Bounds.prototype = { - clone () { - return new Bounds(this); - }, - clear () { - this.x1 = +Number.MAX_VALUE; - this.y1 = +Number.MAX_VALUE; - this.x2 = -Number.MAX_VALUE; - this.y2 = -Number.MAX_VALUE; - return this; - }, - empty () { - return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; - }, - equals (b) { - return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2; + }); + function Compare$1(params2) { + Operator.call(this, null, update$5, params2); + } + inherits(Compare$1, Operator); + function update$5(_) { + return this.value && !_.modified() ? this.value : compare$1(_.fields, _.orders); + } + function CountPattern(params2) { + Transform.call(this, null, params2); + } + CountPattern.Definition = { + "type": "CountPattern", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "case", + "type": "enum", + "values": ["upper", "lower", "mixed"], + "default": "mixed" + }, { + "name": "pattern", + "type": "string", + "default": '[\\w"]+' + }, { + "name": "stopwords", + "type": "string", + "default": "" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["text", "count"] + }] + }; + function tokenize(text2, tcase, match2) { + switch (tcase) { + case "upper": + text2 = text2.toUpperCase(); + break; + case "lower": + text2 = text2.toLowerCase(); + break; + } + return text2.match(match2); + } + inherits(CountPattern, Transform, { + transform(_, pulse2) { + const process = (update2) => (tuple) => { + var tokens = tokenize(get2(tuple), _.case, match2) || [], t; + for (var i = 0, n = tokens.length; i < n; ++i) { + if (!stop2.test(t = tokens[i])) update2(t); + } + }; + const init2 = this._parameterCheck(_, pulse2), counts = this._counts, match2 = this._match, stop2 = this._stop, get2 = _.field, as = _.as || ["text", "count"], add2 = process((t) => counts[t] = 1 + (counts[t] || 0)), rem2 = process((t) => counts[t] -= 1); + if (init2) { + pulse2.visit(pulse2.SOURCE, add2); + } else { + pulse2.visit(pulse2.ADD, add2); + pulse2.visit(pulse2.REM, rem2); + } + return this._finish(pulse2, as); }, - set (x1, y1, x2, y2) { - if (x2 < x1) { - this.x2 = x1; - this.x1 = x2; - } else { - this.x1 = x1; - this.x2 = x2; - } - if (y2 < y1) { - this.y2 = y1; - this.y1 = y2; - } else { - this.y1 = y1; - this.y2 = y2; + _parameterCheck(_, pulse2) { + let init2 = false; + if (_.modified("stopwords") || !this._stop) { + this._stop = new RegExp("^" + (_.stopwords || "") + "$", "i"); + init2 = true; + } + if (_.modified("pattern") || !this._match) { + this._match = new RegExp(_.pattern || "[\\w']+", "g"); + init2 = true; + } + if (_.modified("field") || pulse2.modified(_.field.fields)) { + init2 = true; + } + if (init2) this._counts = {}; + return init2; + }, + _finish(pulse2, as) { + const counts = this._counts, tuples = this._tuples || (this._tuples = {}), text2 = as[0], count2 = as[1], out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + let w2, t, c2; + for (w2 in counts) { + t = tuples[w2]; + c2 = counts[w2] || 0; + if (!t && c2) { + tuples[w2] = t = ingest$1({}); + t[text2] = w2; + t[count2] = c2; + out.add.push(t); + } else if (c2 === 0) { + if (t) out.rem.push(t); + counts[w2] = null; + tuples[w2] = null; + } else if (t[count2] !== c2) { + t[count2] = c2; + out.mod.push(t); } - return this; - }, - add (x, y) { - if (x < this.x1) this.x1 = x; - if (y < this.y1) this.y1 = y; - if (x > this.x2) this.x2 = x; - if (y > this.y2) this.y2 = y; - return this; - }, - expand (d) { - this.x1 -= d; - this.y1 -= d; - this.x2 += d; - this.y2 += d; - return this; - }, - round () { - this.x1 = Math.floor(this.x1); - this.y1 = Math.floor(this.y1); - this.x2 = Math.ceil(this.x2); - this.y2 = Math.ceil(this.y2); - return this; - }, - scale (s) { - this.x1 *= s; - this.y1 *= s; - this.x2 *= s; - this.y2 *= s; - return this; - }, - translate (dx, dy) { - this.x1 += dx; - this.x2 += dx; - this.y1 += dy; - this.y2 += dy; - return this; - }, - rotate (angle, x, y) { - const p = this.rotatedPoints(angle, x, y); - return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); - }, - rotatedPoints (angle, x, y) { - var { x1, y1, x2, y2 } = this, cos = Math.cos(angle), sin = Math.sin(angle), cx = x - x * cos + y * sin, cy = y - x * sin - y * cos; - return [ - cos * x1 - sin * y1 + cx, - sin * x1 + cos * y1 + cy, - cos * x1 - sin * y2 + cx, - sin * x1 + cos * y2 + cy, - cos * x2 - sin * y1 + cx, - sin * x2 + cos * y1 + cy, - cos * x2 - sin * y2 + cx, - sin * x2 + cos * y2 + cy - ]; - }, - union (b) { - if (b.x1 < this.x1) this.x1 = b.x1; - if (b.y1 < this.y1) this.y1 = b.y1; - if (b.x2 > this.x2) this.x2 = b.x2; - if (b.y2 > this.y2) this.y2 = b.y2; - return this; - }, - intersect (b) { - if (b.x1 > this.x1) this.x1 = b.x1; - if (b.y1 > this.y1) this.y1 = b.y1; - if (b.x2 < this.x2) this.x2 = b.x2; - if (b.y2 < this.y2) this.y2 = b.y2; - return this; - }, - encloses (b) { - return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2; - }, - alignsWith (b) { - return b && (this.x1 == b.x1 || this.x2 == b.x2 || this.y1 == b.y1 || this.y2 == b.y2); - }, - intersects (b) { - return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2); - }, - contains (x, y) { - return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2); - }, - width () { - return this.x2 - this.x1; - }, - height () { - return this.y2 - this.y1; + } + return out.modifies(as); } -}; -function Item(mark) { - this.mark = mark; - this.bounds = this.bounds || new Bounds(); -} -function GroupItem(mark) { - Item.call(this, mark); - this.items = this.items || []; -} -(0, _vegaUtil.inherits)(GroupItem, Item); -class ResourceLoader { - constructor(customLoader){ - this._pending = 0; - this._loader = customLoader || (0, _vegaLoader.loader)(); + }); + function Cross(params2) { + Transform.call(this, null, params2); + } + Cross.Definition = { + "type": "Cross", + "metadata": { + "generates": true + }, + "params": [{ + "name": "filter", + "type": "expr" + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["a", "b"] + }] + }; + inherits(Cross, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), as = _.as || ["a", "b"], a2 = as[0], b2 = as[1], reset2 = !this.value || pulse2.changed(pulse2.ADD_REM) || _.modified("as") || _.modified("filter"); + let data2 = this.value; + if (reset2) { + if (data2) out.rem = data2; + data2 = pulse2.materialize(pulse2.SOURCE).source; + out.add = this.value = cross$1(data2, a2, b2, _.filter || truthy); + } else { + out.mod = data2; + } + out.source = this.value; + return out.modifies(as); } - pending() { - return this._pending; + }); + function cross$1(input, a2, b2, filter2) { + var data2 = [], t = {}, n = input.length, i = 0, j, left; + for (; i < n; ++i) { + t[a2] = left = input[i]; + for (j = 0; j < n; ++j) { + t[b2] = input[j]; + if (filter2(t)) { + data2.push(ingest$1(t)); + t = {}; + t[a2] = left; + } + } } - sanitizeURL(uri) { - const loader = this; - increment(loader); - return loader._loader.sanitize(uri, { - context: 'href' - }).then((opt)=>{ - decrement(loader); - return opt; - }).catch(()=>{ - decrement(loader); - return null; - }); + return data2; + } + const Distributions = { + kde, + mixture: mixture$1, + normal: gaussian, + lognormal, + uniform + }; + const DISTRIBUTIONS = "distributions", FUNCTION = "function", FIELD = "field"; + function parse$4(def2, data2) { + const func = def2[FUNCTION]; + if (!has$1(Distributions, func)) { + error("Unknown distribution function: " + func); } - loadImage(uri) { - const loader = this, Image = (0, _vegaCanvas.image)(); - increment(loader); - return loader._loader.sanitize(uri, { - context: 'image' - }).then((opt)=>{ - const url = opt.href; - if (!url || !Image) throw { - url: url - }; - const img = new Image(); - // set crossOrigin only if cors is defined; empty string sets anonymous mode - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin - const cors = (0, _vegaUtil.hasOwnProperty)(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous'; - if (cors != null) img.crossOrigin = cors; - // attempt to load image resource - img.onload = ()=>decrement(loader); - img.onerror = ()=>decrement(loader); - img.src = url; - return img; - }).catch((e)=>{ - decrement(loader); - return { - complete: false, - width: 0, - height: 0, - src: e && e.url || '' - }; - }); + const d = Distributions[func](); + for (const name in def2) { + if (name === FIELD) { + d.data((def2.from || data2()).map(def2[name])); + } else if (name === DISTRIBUTIONS) { + d[name](def2[name].map((_) => parse$4(_, data2))); + } else if (typeof d[name] === FUNCTION) { + d[name](def2[name]); + } } - ready() { - const loader = this; - return new Promise((accept)=>{ - function poll(value) { - if (!loader.pending()) accept(value); - else setTimeout(()=>{ - poll(true); - }, 10); - } - poll(false); + return d; + } + function Density(params2) { + Transform.call(this, null, params2); + } + const distributions = [{ + "key": { + "function": "normal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "lognormal" + }, + "params": [{ + "name": "mean", + "type": "number", + "default": 0 + }, { + "name": "stdev", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "uniform" + }, + "params": [{ + "name": "min", + "type": "number", + "default": 0 + }, { + "name": "max", + "type": "number", + "default": 1 + }] + }, { + "key": { + "function": "kde" + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "from", + "type": "data" + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }] + }]; + const mixture = { + "key": { + "function": "mixture" + }, + "params": [{ + "name": "distributions", + "type": "param", + "array": true, + "params": distributions + }, { + "name": "weights", + "type": "number", + "array": true + }] + }; + Density.Definition = { + "type": "Density", + "metadata": { + "generates": true + }, + "params": [{ + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "method", + "type": "string", + "default": "pdf", + "values": ["pdf", "cdf"] + }, { + "name": "distribution", + "type": "param", + "params": distributions.concat(mixture) + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(Density, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const dist2 = parse$4(_.distribution, source$1(pulse2)), minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + let method2 = _.method || "pdf"; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (!_.extent && !dist2.data) { + error("Missing density extent parameter."); + } + method2 = dist2[method2]; + const as = _.as || ["value", "density"], domain2 = _.extent || extent(dist2.data()), values2 = sampleCurve(method2, domain2, minsteps, maxsteps).map((v) => { + const tuple = {}; + tuple[as[0]] = v[0]; + tuple[as[1]] = v[1]; + return ingest$1(tuple); }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; } -} -function increment(loader) { - loader._pending += 1; -} -function decrement(loader) { - loader._pending -= 1; -} -function boundStroke(bounds, item, miter) { - if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { - const sw = item.strokeWidth != null ? +item.strokeWidth : 1; - bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); - } - return bounds; -} -function miterAdjustment(item, strokeWidth) { - // TODO: more sophisticated adjustment? Or miter support in boundContext? - return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth; -} -const circleThreshold = Tau - 1e-8; -let bounds, lx, ly, rot, ma, mb, mc, md; -const add = (x, y)=>bounds.add(x, y); -const addL = (x, y)=>add(lx = x, ly = y); -const addX = (x)=>add(x, bounds.y1); -const addY = (y)=>add(bounds.x1, y); -const px = (x, y)=>ma * x + mc * y; -const py = (x, y)=>mb * x + md * y; -const addp = (x, y)=>add(px(x, y), py(x, y)); -const addpL = (x, y)=>addL(px(x, y), py(x, y)); -function boundContext(_, deg) { - bounds = _; - if (deg) { - rot = deg * DegToRad; - ma = md = Math.cos(rot); - mb = Math.sin(rot); - mc = -mb; + }); + function source$1(pulse2) { + return () => pulse2.materialize(pulse2.SOURCE).source; + } + function fieldNames(fields, as) { + if (!fields) return null; + return fields.map((f, i) => as[i] || accessorName(f)); + } + function partition$1$1(data2, groupby, field2) { + const groups = [], get2 = (f) => f(t); + let map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2.map(field2)); } else { - ma = md = 1; - rot = mb = mc = 0; + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); + } + g.push(field2(t)); + } } - return context$1; -} -const context$1 = { - beginPath () {}, - closePath () {}, - moveTo: addpL, - lineTo: addpL, - rect (x, y, w, h) { - if (rot) { - addp(x + w, y); - addp(x + w, y + h); - addp(x, y + h); - addpL(x, y); - } else { - add(x + w, y + h); - addL(x, y); + return groups; + } + const Output$5 = "bin"; + function DotBin(params2) { + Transform.call(this, null, params2); + } + DotBin.Definition = { + "type": "DotBin", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "step", + "type": "number" + }, { + "name": "smooth", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": Output$5 + }] + }; + const autostep = (data2, field2) => span(extent(data2, field2)) / 30; + inherits(DotBin, Transform, { + transform(_, pulse2) { + if (this.value && !(_.modified() || pulse2.changed())) { + return pulse2; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(pulse2.source, _.groupby, identity$7), smooth = _.smooth || false, field2 = _.field, step = _.step || autostep(source2, field2), sort2 = stableCompare((a2, b2) => field2(a2) - field2(b2)), as = _.as || Output$5, n = groups.length; + let min2 = Infinity, max2 = -Infinity, i = 0, j; + for (; i < n; ++i) { + const g = groups[i].sort(sort2); + j = -1; + for (const v of dotbin(g, step, smooth, field2)) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; + g[++j][as] = v; + } + } + this.value = { + start: min2, + stop: max2, + step + }; + return pulse2.reflow(true).modifies(as); + } + }); + function Expression$1(params2) { + Operator.call(this, null, update$4, params2); + this.modified(true); + } + inherits(Expression$1, Operator); + function update$4(_) { + const expr2 = _.expr; + return this.value && !_.modified("expr") ? this.value : accessor((datum2) => expr2(datum2, _), accessorFields(expr2), accessorName(expr2)); + } + function Extent(params2) { + Transform.call(this, [void 0, void 0], params2); + } + Extent.Definition = { + "type": "Extent", + "metadata": {}, + "params": [{ + "name": "field", + "type": "field", + "required": true + }] + }; + inherits(Extent, Transform, { + transform(_, pulse2) { + const extent2 = this.value, field2 = _.field, mod = pulse2.changed() || pulse2.modified(field2.fields) || _.modified("field"); + let min2 = extent2[0], max2 = extent2[1]; + if (mod || min2 == null) { + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(mod ? pulse2.SOURCE : pulse2.ADD, (t) => { + const v = toNumber(field2(t)); + if (v != null) { + if (v < min2) min2 = v; + if (v > max2) max2 = v; } + }); + if (!Number.isFinite(min2) || !Number.isFinite(max2)) { + let name = accessorName(field2); + if (name) name = ` for field "${name}"`; + pulse2.dataflow.warn(`Infinite extent${name}: [${min2}, ${max2}]`); + min2 = max2 = void 0; + } + this.value = [min2, max2]; + } + }); + function Subflow(pulse2, parent) { + Operator.call(this, pulse2); + this.parent = parent; + this.count = 0; + } + inherits(Subflow, Operator, { + /** + * Routes pulses from this subflow to a target transform. + * @param {Transform} target - A transform that receives the subflow of tuples. + */ + connect(target2) { + this.detachSubflow = target2.detachSubflow; + this.targets().add(target2); + return target2.source = this; }, - quadraticCurveTo (x1, y1, x2, y2) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2); - quadExtrema(lx, px1, px2, addX); - quadExtrema(ly, py1, py2, addY); - addL(px2, py2); + /** + * Add an 'add' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being added. + */ + add(t) { + this.count += 1; + this.value.add.push(t); }, - bezierCurveTo (x1, y1, x2, y2, x3, y3) { - const px1 = px(x1, y1), py1 = py(x1, y1), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); - cubicExtrema(lx, px1, px2, px3, addX); - cubicExtrema(ly, py1, py2, py3, addY); - addL(px3, py3); + /** + * Add a 'rem' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being removed. + */ + rem(t) { + this.count -= 1; + this.value.rem.push(t); }, - arc (cx, cy, r, sa, ea, ccw) { - sa += rot; - ea += rot; - // store last point on path - lx = r * Math.cos(ea) + cx; - ly = r * Math.sin(ea) + cy; - if (Math.abs(ea - sa) > circleThreshold) { - // treat as full circle - add(cx - r, cy - r); - add(cx + r, cy + r); - } else { - const update = (a)=>add(r * Math.cos(a) + cx, r * Math.sin(a) + cy); - let s, i; - // sample end points - update(sa); - update(ea); - // sample interior points aligned with 90 degrees - if (ea !== sa) { - sa = sa % Tau; - if (sa < 0) sa += Tau; - ea = ea % Tau; - if (ea < 0) ea += Tau; - if (ea < sa) { - ccw = !ccw; // flip direction - s = sa; - sa = ea; - ea = s; // swap end-points - } - if (ccw) { - ea -= Tau; - s = sa - sa % HalfPi; - for(i = 0; i < 4 && s > ea; ++i, s -= HalfPi)update(s); - } else { - s = sa - sa % HalfPi + HalfPi; - for(i = 0; i < 4 && s < ea; ++i, s = s + HalfPi)update(s); - } - } - } + /** + * Add a 'mod' tuple to the subflow pulse. + * @param {Tuple} t - The tuple being modified. + */ + mod(t) { + this.value.mod.push(t); + }, + /** + * Re-initialize this operator's pulse value. + * @param {Pulse} pulse - The pulse to copy from. + * @see Pulse.init + */ + init(pulse2) { + this.value.init(pulse2, pulse2.NO_SOURCE); + }, + /** + * Evaluate this operator. This method overrides the + * default behavior to simply return the contained pulse value. + * @return {Pulse} + */ + evaluate() { + return this.value; } -}; -function quadExtrema(x0, x1, x2, cb) { - const t = (x0 - x1) / (x0 + x2 - 2 * x1); - if (0 < t && t < 1) cb(x0 + (x1 - x0) * t); -} -function cubicExtrema(x0, x1, x2, x3, cb) { - const a = x3 - x0 + 3 * x1 - 3 * x2, b = x0 + x2 - 2 * x1, c = x0 - x1; - let t0 = 0, t1 = 0, r; - // solve for parameter t - if (Math.abs(a) > Epsilon) { - // quadratic equation - r = b * b + c * a; - if (r >= 0) { - r = Math.sqrt(r); - t0 = (-b + r) / a; - t1 = (-b - r) / a; - } - } else // linear equation - t0 = 0.5 * c / b; - // calculate position - if (0 < t0 && t0 < 1) cb(cubic(t0, x0, x1, x2, x3)); - if (0 < t1 && t1 < 1) cb(cubic(t1, x0, x1, x2, x3)); -} -function cubic(t, x0, x1, x2, x3) { - const s = 1 - t, s2 = s * s, t2 = t * t; - return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3; -} -var context = (context = (0, _vegaCanvas.canvas)(1, 1)) ? context.getContext('2d') : null; -const b = new Bounds(); -function intersectPath(draw) { - return function(item, brush) { - // rely on (inaccurate) bounds intersection if no context - if (!context) return true; - // add path to offscreen graphics context - draw(context, item); - // get bounds intersection region - b.clear().union(item.bounds).intersect(brush).round(); - const { x1, y1, x2, y2 } = b; - // iterate over intersection region - // perform fine grained inclusion test - for(let y = y1; y <= y2; ++y)for(let x = x1; x <= x2; ++x){ - if (context.isPointInPath(x, y)) return true; - } - // false if no hits in intersection region - return false; + }); + function Facet$1(params2) { + Transform.call(this, {}, params2); + this._keys = fastmap(); + const a2 = this._targets = []; + a2.active = 0; + a2.forEach = (f) => { + for (let i = 0, n = a2.active; i < n; ++i) { + f(a2[i], i, a2); + } }; -} -function intersectPoint(item, box) { - return box.contains(item.x || 0, item.y || 0); -} -function intersectRect(item, box) { - const x = item.x || 0, y = item.y || 0, w = item.width || 0, h = item.height || 0; - return box.intersects(b.set(x, y, x + w, y + h)); -} -function intersectRule(item, box) { - const x = item.x || 0, y = item.y || 0, x2 = item.x2 != null ? item.x2 : x, y2 = item.y2 != null ? item.y2 : y; - return intersectBoxLine(box, x, y, x2, y2); -} -function intersectBoxLine(box, x, y, u, v) { - const { x1, y1, x2, y2 } = box, dx = u - x, dy = v - y; - let t0 = 0, t1 = 1, p, q, r, e; - for(e = 0; e < 4; ++e){ - if (e === 0) { - p = -dx; - q = -(x1 - x); - } - if (e === 1) { - p = dx; - q = x2 - x; - } - if (e === 2) { - p = -dy; - q = -(y1 - y); - } - if (e === 3) { - p = dy; - q = y2 - y; - } - if (Math.abs(p) < 1e-10 && q < 0) return false; - r = q / p; - if (p < 0) { - if (r > t1) return false; - else if (r > t0) t0 = r; - } else if (p > 0) { - if (r < t0) return false; - else if (r < t1) t1 = r; - } - } - return true; -} -function blend(context, item) { - context.globalCompositeOperation = item.blend || 'source-over'; -} -function value(value, dflt) { - return value == null ? dflt : value; -} -function addStops(gradient, stops) { - const n = stops.length; - for(let i = 0; i < n; ++i)gradient.addColorStop(stops[i].offset, stops[i].color); - return gradient; -} -function gradient(context, spec, bounds) { - const w = bounds.width(), h = bounds.height(); - let gradient; - if (spec.gradient === 'radial') gradient = context.createRadialGradient(bounds.x1 + value(spec.x1, 0.5) * w, bounds.y1 + value(spec.y1, 0.5) * h, Math.max(w, h) * value(spec.r1, 0), bounds.x1 + value(spec.x2, 0.5) * w, bounds.y1 + value(spec.y2, 0.5) * h, Math.max(w, h) * value(spec.r2, 0.5)); - else { - // linear gradient - const x1 = value(spec.x1, 0), y1 = value(spec.y1, 0), x2 = value(spec.x2, 1), y2 = value(spec.y2, 0); - if (x1 === x2 || y1 === y2 || w === h) // axis aligned: use normal gradient - gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h); - else { - // not axis aligned: render gradient into a pattern (#2365) - // this allows us to use normalized bounding box coordinates - const image = (0, _vegaCanvas.canvas)(Math.ceil(w), Math.ceil(h)), ictx = image.getContext('2d'); - ictx.scale(w, h); - ictx.fillStyle = addStops(ictx.createLinearGradient(x1, y1, x2, y2), spec.stops); - ictx.fillRect(0, 0, w, h); - return context.createPattern(image, 'no-repeat'); - } - } - return addStops(gradient, spec.stops); -} -function color(context, item, value) { - return isGradient(value) ? gradient(context, value, item.bounds) : value; -} -function fill(context, item, opacity) { - opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.fillStyle = color(context, item, item.fill); - return true; - } else return false; -} -var Empty = []; -function stroke(context, item, opacity) { - var lw = (lw = item.strokeWidth) != null ? lw : 1; - if (lw <= 0) return false; - opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; - if (opacity > 0) { - context.globalAlpha = opacity; - context.strokeStyle = color(context, item, item.stroke); - context.lineWidth = lw; - context.lineCap = item.strokeCap || 'butt'; - context.lineJoin = item.strokeJoin || 'miter'; - context.miterLimit = item.strokeMiterLimit || 10; - if (context.setLineDash) { - context.setLineDash(item.strokeDash || Empty); - context.lineDashOffset = item.strokeDashOffset || 0; + } + inherits(Facet$1, Transform, { + activate(flow) { + this._targets[this._targets.active++] = flow; + }, + // parent argument provided by PreFacet subclass + subflow(key2, flow, pulse2, parent) { + const flows = this.value; + let sf = has$1(flows, key2) && flows[key2], df, p; + if (!sf) { + p = parent || (p = this._group[key2]) && p.tuple; + df = pulse2.dataflow; + sf = new Subflow(pulse2.fork(pulse2.NO_SOURCE), this); + df.add(sf).connect(flow(df, key2, p)); + flows[key2] = sf; + this.activate(sf); + } else if (sf.value.stamp < pulse2.stamp) { + sf.init(pulse2); + this.activate(sf); + } + return sf; + }, + clean() { + const flows = this.value; + let detached = 0; + for (const key2 in flows) { + if (flows[key2].count === 0) { + const detach = flows[key2].detachSubflow; + if (detach) detach(); + delete flows[key2]; + ++detached; } - return true; - } else return false; -} -function compare(a, b) { - return a.zindex - b.zindex || a.index - b.index; -} -function zorder(scene) { - if (!scene.zdirty) return scene.zitems; - var items = scene.items, output = [], item, i, n; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - item.index = i; - if (item.zindex) output.push(item); - } - scene.zdirty = false; - return scene.zitems = output.sort(compare); -} -function visit(scene, visitor) { - var items = scene.items, i, n; - if (!items || !items.length) return; - const zitems = zorder(scene); - if (zitems && zitems.length) { - for(i = 0, n = items.length; i < n; ++i)if (!items[i].zindex) visitor(items[i]); - items = zitems; - } - for(i = 0, n = items.length; i < n; ++i)visitor(items[i]); -} -function pickVisit(scene, visitor) { - var items = scene.items, hit, i; - if (!items || !items.length) return null; - const zitems = zorder(scene); - if (zitems && zitems.length) items = zitems; - for(i = items.length; --i >= 0;){ - if (hit = visitor(items[i])) return hit; - } - if (items === zitems) { - for(items = scene.items, i = items.length; --i >= 0;)if (!items[i].zindex) { - if (hit = visitor(items[i])) return hit; + } + if (detached) { + const active = this._targets.filter((sf) => sf && sf.count > 0); + this.initTargets(active); + } + }, + initTargets(act) { + const a2 = this._targets, n = a2.length, m2 = act ? act.length : 0; + let i = 0; + for (; i < m2; ++i) { + a2[i] = act[i]; + } + for (; i < n && a2[i] != null; ++i) { + a2[i] = null; + } + a2.active = m2; + }, + transform(_, pulse2) { + const df = pulse2.dataflow, key2 = _.key, flow = _.subflow, cache2 = this._keys, rekey = _.modified("key"), subflow = (key3) => this.subflow(key3, flow, pulse2); + this._group = _.group || {}; + this.initTargets(); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t), k = cache2.get(id2); + if (k !== void 0) { + cache2.delete(id2); + subflow(k).rem(t); } - } - return null; -} -function drawAll(path) { - return function(context, scene, bounds) { - visit(scene, (item)=>{ - if (!bounds || bounds.intersects(item.bounds)) drawPath(path, context, item, item); + }); + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + cache2.set(tupleid(t), k); + subflow(k).add(t); + }); + if (rekey || pulse2.modified(key2.fields)) { + pulse2.visit(pulse2.MOD, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 === k1) { + subflow(k1).mod(t); + } else { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } }); - }; -} -function drawOne(path) { - return function(context, scene, bounds) { - if (scene.items.length && (!bounds || bounds.intersects(scene.bounds))) drawPath(path, context, scene.items[0], scene.items); - }; -} -function drawPath(path, context, item, items) { - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity === 0) return; - if (path(context, items)) return; - blend(context, item); - if (item.fill && fill(context, item, opacity)) context.fill(); - if (item.stroke && stroke(context, item, opacity)) context.stroke(); -} -function pick$1(test) { - test = test || (0, _vegaUtil.truthy); - return function(context, scene, x, y, gx, gy) { - x *= context.pixelRatio; - y *= context.pixelRatio; - return pickVisit(scene, (item)=>{ - const b = item.bounds; - // first hit test against bounding box - if (b && !b.contains(gx, gy) || !b) return; - // if in bounding box, perform more careful test - if (test(context, item, x, y, gx, gy)) return item; + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => { + subflow(cache2.get(tupleid(t))).mod(t); }); - }; -} -function hitPath(path, filled) { - return function(context, o, x, y) { - var item = Array.isArray(o) ? o[0] : o, fill = filled == null ? item.fill : filled, stroke = item.stroke && context.isPointInStroke, lw, lc; - if (stroke) { - lw = item.strokeWidth; - lc = item.strokeCap; - context.lineWidth = lw != null ? lw : 1; - context.lineCap = lc != null ? lc : 'butt'; - } - return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y); - }; -} -function pickPath(path) { - return pick$1(hitPath(path)); -} -function translate(x, y) { - return 'translate(' + x + ',' + y + ')'; -} -function rotate(a) { - return 'rotate(' + a + ')'; -} -function scale(scaleX, scaleY) { - return 'scale(' + scaleX + ',' + scaleY + ')'; -} -function translateItem(item) { - return translate(item.x || 0, item.y || 0); -} -function rotateItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : ''); -} -function transformItem(item) { - return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : ''); -} -function markItemPath(type, shape, isect) { - function attr(emit, item) { - emit('transform', rotateItem(item)); - emit('d', shape(null, item)); - } - function bound(bounds, item) { - shape(boundContext(bounds, item.angle), item); - return boundStroke(bounds, item).translate(item.x || 0, item.y || 0); - } - function draw(context, item) { - var x = item.x || 0, y = item.y || 0, a = item.angle || 0; - context.translate(x, y); - if (a) context.rotate(a *= DegToRad); - context.beginPath(); - shape(context, item); - if (a) context.rotate(-a); - context.translate(-x, -y); + } + if (rekey) { + pulse2.visit(pulse2.REFLOW, (t) => { + const id2 = tupleid(t), k0 = cache2.get(id2), k1 = key2(t); + if (k0 !== k1) { + cache2.set(id2, k1); + subflow(k0).rem(t); + subflow(k1).add(t); + } + }); + } + if (pulse2.clean()) { + df.runAfter(() => { + this.clean(); + cache2.clean(); + }); + } else if (cache2.empty > df.cleanThreshold) { + df.runAfter(cache2.clean); + } + return pulse2; } - return { - type: type, - tag: 'path', - nested: false, - attr: attr, - bound: bound, - draw: drawAll(draw), - pick: pickPath(draw), - isect: isect || intersectPath(draw) - }; -} -var arc = markItemPath('arc', arc$1); -function pickArea(a, p) { - var v = a[0].orient === 'horizontal' ? p[1] : p[0], z = a[0].orient === 'horizontal' ? 'y' : 'x', i = a.length, min = Infinity, hit, d; - while(--i >= 0){ - if (a[i].defined === false) continue; - d = Math.abs(a[i][z] - v); - if (d < min) { - min = d; - hit = a[i]; - } - } - return hit; -} -function pickLine(a, p) { - var t = Math.pow(a[0].strokeWidth || 1, 2), i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - if (dd < t) return a[i]; - } - return null; -} -function pickTrail(a, p) { - var i = a.length, dx, dy, dd; - while(--i >= 0){ - if (a[i].defined === false) continue; - dx = a[i].x - p[0]; - dy = a[i].y - p[1]; - dd = dx * dx + dy * dy; - dx = a[i].size || 1; - if (dd < dx * dx) return a[i]; - } - return null; -} -function markMultiItemPath(type, shape, tip) { - function attr(emit, item) { - var items = item.mark.items; - if (items.length) emit('d', shape(null, items)); - } - function bound(bounds, mark) { - var items = mark.items; - if (items.length === 0) return bounds; - else { - shape(boundContext(bounds), items); - return boundStroke(bounds, items[0]); - } - } - function draw(context, items) { - context.beginPath(); - shape(context, items); - } - const hit = hitPath(draw); - function pick(context, scene, x, y, gx, gy) { - var items = scene.items, b = scene.bounds; - if (!items || !items.length || b && !b.contains(gx, gy)) return null; - x *= context.pixelRatio; - y *= context.pixelRatio; - return hit(context, items, x, y) ? items[0] : null; - } - return { - type: type, - tag: 'path', - nested: true, - attr: attr, - bound: bound, - draw: drawOne(draw), - pick: pick, - isect: intersectPoint, - tip: tip - }; -} -var area = markMultiItemPath('area', area$1, pickArea); -function clip(context, scene) { - var clip = scene.clip; - context.save(); - if ((0, _vegaUtil.isFunction)(clip)) { - context.beginPath(); - clip(context); - context.clip(); - } else clipGroup(context, scene.group); -} -function clipGroup(context, group) { - context.beginPath(); - hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0); - context.clip(); -} -function offset$1(item) { - const sw = value(item.strokeWidth, 1); - return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; -} -function attr$5(emit, item) { - emit('transform', translateItem(item)); -} -function emitRectangle(emit, item) { - const off = offset$1(item); - emit('d', rectangle(null, item, off, off)); -} -function background(emit, item) { - emit('class', 'background'); - emit('aria-hidden', true); - emitRectangle(emit, item); -} -function foreground(emit, item) { - emit('class', 'foreground'); - emit('aria-hidden', true); - if (item.strokeForeground) emitRectangle(emit, item); - else emit('d', ''); -} -function content(emit, item, renderer) { - const url = item.clip ? clip$1(renderer, item, item) : null; - emit('clip-path', url); -} -function bound$5(bounds, group) { - if (!group.clip && group.items) { - const items = group.items, m = items.length; - for(let j = 0; j < m; ++j)bounds.union(items[j].bounds); - } - if ((group.clip || group.width || group.height) && !group.noBound) bounds.add(0, 0).add(group.width || 0, group.height || 0); - boundStroke(bounds, group); - return bounds.translate(group.x || 0, group.y || 0); -} -function rectanglePath(context, group, x, y) { - const off = offset$1(group); - context.beginPath(); - rectangle(context, group, (x || 0) + off, (y || 0) + off); -} -const hitBackground = hitPath(rectanglePath); -const hitForeground = hitPath(rectanglePath, false); -const hitCorner = hitPath(rectanglePath, true); -function draw$4(context, scene, bounds, markTypes) { - visit(scene, (group)=>{ - const gx = group.x || 0, gy = group.y || 0, fore = group.strokeForeground, opacity = group.opacity == null ? 1 : group.opacity; - // draw group background - if ((group.stroke || group.fill) && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (group.fill && fill(context, group, opacity)) context.fill(); - if (group.stroke && !fore && stroke(context, group, opacity)) context.stroke(); - } - // setup graphics context, set clip and bounds - context.save(); - context.translate(gx, gy); - if (group.clip) clipGroup(context, group); - if (bounds) bounds.translate(-gx, -gy); - // draw group contents - visit(group, (item)=>{ - if (item.marktype === 'group' || markTypes == null || markTypes.includes(item.marktype)) this.draw(context, item, bounds, markTypes); - }); - // restore graphics context - if (bounds) bounds.translate(gx, gy); - context.restore(); - // draw group foreground - if (fore && group.stroke && opacity) { - rectanglePath(context, group, gx, gy); - blend(context, group); - if (stroke(context, group, opacity)) context.stroke(); - } - }); -} -function pick(context, scene, x, y, gx, gy) { - if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) return null; - const cx = x * context.pixelRatio, cy = y * context.pixelRatio; - return pickVisit(scene, (group)=>{ - let hit, dx, dy; - // first hit test bounding box - const b = group.bounds; - if (b && !b.contains(gx, gy)) return; - // passed bounds check, test rectangular clip - dx = group.x || 0; - dy = group.y || 0; - const dw = dx + (group.width || 0), dh = dy + (group.height || 0), c = group.clip; - if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return; - // adjust coordinate system - context.save(); - context.translate(dx, dy); - dx = gx - dx; - dy = gy - dy; - // test background for rounded corner clip - if (c && hasCornerRadius(group) && !hitCorner(context, group, cx, cy)) { - context.restore(); - return null; - } - const fore = group.strokeForeground, ix = scene.interactive !== false; - // hit test against group foreground - if (ix && fore && group.stroke && hitForeground(context, group, cx, cy)) { - context.restore(); - return group; - } - // hit test against contained marks - hit = pickVisit(group, (mark)=>pickMark(mark, dx, dy) ? this.pick(mark, x, y, dx, dy) : null); - // hit test against group background - if (!hit && ix && (group.fill || !fore && group.stroke) && hitBackground(context, group, cx, cy)) hit = group; - // restore state and return - context.restore(); - return hit || null; - }); -} -function pickMark(mark, x, y) { - return (mark.interactive !== false || mark.marktype === 'group') && mark.bounds && mark.bounds.contains(x, y); -} -var group = { - type: 'group', - tag: 'g', - nested: false, - attr: attr$5, - bound: bound$5, - draw: draw$4, - pick: pick, - isect: intersectRect, - content: content, - background: background, - foreground: foreground -}; -var metadata = { - 'xmlns': 'http://www.w3.org/2000/svg', - 'xmlns:xlink': 'http://www.w3.org/1999/xlink', - 'version': '1.1' -}; -function getImage(item, renderer) { - var image = item.image; - if (!image || item.url && item.url !== image.url) { - image = { - complete: false, - width: 0, - height: 0 - }; - renderer.loadImage(item.url).then((image)=>{ - item.image = image; - item.image.url = item.url; - }); - } - return image; -} -function imageWidth(item, image) { - return item.width != null ? item.width : !image || !image.width ? 0 : item.aspect !== false && item.height ? item.height * image.width / image.height : image.width; -} -function imageHeight(item, image) { - return item.height != null ? item.height : !image || !image.height ? 0 : item.aspect !== false && item.width ? item.width * image.height / image.width : image.height; -} -function imageXOffset(align, w) { - return align === 'center' ? w / 2 : align === 'right' ? w : 0; -} -function imageYOffset(baseline, h) { - return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0; -} -function attr$4(emit, item, renderer) { - const img = getImage(item, renderer), w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ''; - emit('href', i, metadata['xmlns:xlink'], 'xlink:href'); - emit('transform', translate(x, y)); - emit('width', w); - emit('height', h); - emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid'); -} -function bound$4(bounds, item) { - const img = item.image, w = imageWidth(item, img), h = imageHeight(item, img), x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h); - return bounds.set(x, y, x + w, y + h); -} -function draw$3(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - const img = getImage(item, this); - let w = imageWidth(item, img); - let h = imageHeight(item, img); - if (w === 0 || h === 0) return; // early exit - let x = (item.x || 0) - imageXOffset(item.align, w), y = (item.y || 0) - imageYOffset(item.baseline, h), opacity, ar0, ar1, t; - if (item.aspect !== false) { - ar0 = img.width / img.height; - ar1 = item.width / item.height; - if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { - if (ar1 < ar0) { - t = w / ar0; - y += (h - t) / 2; - h = t; - } else { - t = h * ar0; - x += (w - t) / 2; - w = t; - } - } - } - if (img.complete || img.toDataURL) { - blend(context, item); - context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; - context.imageSmoothingEnabled = item.smooth !== false; - context.drawImage(img, x, y, w, h); - } - }); -} -var image = { - type: 'image', - tag: 'image', - nested: false, - attr: attr$4, - bound: bound$4, - draw: draw$3, - pick: pick$1(), - isect: (0, _vegaUtil.truthy), - // bounds check is sufficient - get: getImage, - xOffset: imageXOffset, - yOffset: imageYOffset -}; -var line = markMultiItemPath('line', line$1, pickLine); -function attr$3(emit, item) { - var sx = item.scaleX || 1, sy = item.scaleY || 1; - if (sx !== 1 || sy !== 1) emit('vector-effect', 'non-scaling-stroke'); - emit('transform', transformItem(item)); - emit('d', item.path); -} -function path$1(context, item) { - var path = item.path; - if (path == null) return true; - var x = item.x || 0, y = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a = (item.angle || 0) * DegToRad, cache = item.pathCache; - if (!cache || cache.path !== path) (item.pathCache = cache = parse(path)).path = path; - if (a && context.rotate && context.translate) { - context.translate(x, y); - context.rotate(a); - pathRender(context, cache, 0, 0, sx, sy); - context.rotate(-a); - context.translate(-x, -y); - } else pathRender(context, cache, x, y, sx, sy); -} -function bound$3(bounds, item) { - return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true); -} -var path$2 = { - type: 'path', - tag: 'path', - nested: false, - attr: attr$3, - bound: bound$3, - draw: drawAll(path$1), - pick: pickPath(path$1), - isect: intersectPath(path$1) -}; -function attr$2(emit, item) { - emit('d', rectangle(null, item)); -} -function bound$2(bounds, item) { - var x, y; - return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item); -} -function draw$2(context, item) { - context.beginPath(); - rectangle(context, item); -} -var rect = { - type: 'rect', - tag: 'path', - nested: false, - attr: attr$2, - bound: bound$2, - draw: drawAll(draw$2), - pick: pickPath(draw$2), - isect: intersectRect -}; -function attr$1(emit, item) { - emit('transform', translateItem(item)); - emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0); - emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0); -} -function bound$1(bounds, item) { - var x1, y1; - return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item); -} -function path(context, item, opacity) { - var x1, y1, x2, y2; - if (item.stroke && stroke(context, item, opacity)) { - x1 = item.x || 0; - y1 = item.y || 0; - x2 = item.x2 != null ? item.x2 : x1; - y2 = item.y2 != null ? item.y2 : y1; - context.beginPath(); - context.moveTo(x1, y1); - context.lineTo(x2, y2); - return true; - } - return false; -} -function draw$1(context, scene, bounds) { - visit(scene, (item)=>{ - if (bounds && !bounds.intersects(item.bounds)) return; // bounds check - var opacity = item.opacity == null ? 1 : item.opacity; - if (opacity && path(context, item, opacity)) { - blend(context, item); - context.stroke(); - } - }); -} -function hit$1(context, item, x, y) { - if (!context.isPointInStroke) return false; - return path(context, item, 1) && context.isPointInStroke(x, y); -} -var rule = { - type: 'rule', - tag: 'line', - nested: false, - attr: attr$1, - bound: bound$1, - draw: draw$1, - pick: pick$1(hit$1), - isect: intersectRule -}; -var shape = markItemPath('shape', shape$1); -var symbol = markItemPath('symbol', symbol$1, intersectPoint); -// memoize text width measurement -const widthCache = (0, _vegaUtil.lruCache)(); -var textMetrics = { - height: fontSize, - measureWidth: measureWidth, - estimateWidth: estimateWidth, - width: estimateWidth, - canvas: useCanvas -}; -useCanvas(true); -function useCanvas(use) { - textMetrics.width = use && context ? measureWidth : estimateWidth; -} -// make simple estimate if no canvas is available -function estimateWidth(item, text) { - return _estimateWidth(textValue(item, text), fontSize(item)); -} -function _estimateWidth(text, currentFontHeight) { - return ~~(0.8 * text.length * currentFontHeight); -} -// measure text width if canvas is available -function measureWidth(item, text) { - return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item)); -} -function _measureWidth(text, currentFont) { - const key = `(${currentFont}) ${text}`; - let width = widthCache.get(key); - if (width === undefined) { - context.font = currentFont; - width = context.measureText(text).width; - widthCache.set(key, width); - } - return width; -} -function fontSize(item) { - return item.fontSize != null ? +item.fontSize || 0 : 11; -} -function lineHeight(item) { - return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; -} -function lineArray(_) { - return (0, _vegaUtil.isArray)(_) ? _.length > 1 ? _ : _[0] : _; -} -function textLines(item) { - return lineArray(item.lineBreak && item.text && !(0, _vegaUtil.isArray)(item.text) ? item.text.split(item.lineBreak) : item.text); -} -function multiLineOffset(item) { - const tl = textLines(item); - return ((0, _vegaUtil.isArray)(tl) ? tl.length - 1 : 0) * lineHeight(item); -} -function textValue(item, line) { - const text = line == null ? '' : (line + '').trim(); - return item.limit > 0 && text.length ? truncate(item, text) : text; -} -function widthGetter(item) { - if (textMetrics.width === measureWidth) { - // we are using canvas - const currentFont = font(item); - return (text)=>_measureWidth(text, currentFont); - } else if (textMetrics.width === estimateWidth) { - // we are relying on estimates - const currentFontHeight = fontSize(item); - return (text)=>_estimateWidth(text, currentFontHeight); - } else // User defined textMetrics.width function in use (e.g. vl-convert) - return (text)=>textMetrics.width(item, text); -} -function truncate(item, text) { - var limit = +item.limit, width = widthGetter(item); - if (width(text) < limit) return text; - var ellipsis = item.ellipsis || '\u2026', rtl = item.dir === 'rtl', lo = 0, hi = text.length, mid; - limit -= width(ellipsis); - if (rtl) { - while(lo < hi){ - mid = lo + hi >>> 1; - if (width(text.slice(mid)) > limit) lo = mid + 1; - else hi = mid; - } - return ellipsis + text.slice(lo); - } else { - while(lo < hi){ - mid = 1 + (lo + hi >>> 1); - if (width(text.slice(0, mid)) < limit) lo = mid; - else hi = mid - 1; - } - return text.slice(0, lo) + ellipsis; - } -} -function fontFamily(item, quote) { - var font = item.font; - return (quote && font ? String(font).replace(/"/g, '\'') : font) || 'sans-serif'; -} -function font(item, quote) { - return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote); -} -function offset(item) { - // perform our own font baseline calculation - // why? not all browsers support SVG 1.1 'alignment-baseline' :( - // this also ensures consistent layout across renderers - var baseline = item.baseline, h = fontSize(item); - return Math.round(baseline === 'top' ? 0.79 * h : baseline === 'middle' ? 0.30 * h : baseline === 'bottom' ? -0.21 * h : baseline === 'line-top' ? 0.29 * h + 0.5 * lineHeight(item) : baseline === 'line-bottom' ? 0.29 * h - 0.5 * lineHeight(item) : 0); -} -const textAlign = { - 'left': 'start', - 'center': 'middle', - 'right': 'end' -}; -const tempBounds = new Bounds(); -function anchorPoint(item) { - var x = item.x || 0, y = item.y || 0, r = item.radius || 0, t; - if (r) { - t = (item.theta || 0) - HalfPi; - x += r * Math.cos(t); - y += r * Math.sin(t); - } - tempBounds.x1 = x; - tempBounds.y1 = y; - return tempBounds; -} -function attr(emit, item) { - var dx = item.dx || 0, dy = (item.dy || 0) + offset(item), p = anchorPoint(item), x = p.x1, y = p.y1, a = item.angle || 0, t; - emit('text-anchor', textAlign[item.align] || 'start'); - if (a) { - t = translate(x, y) + ' ' + rotate(a); - if (dx || dy) t += ' ' + translate(dx, dy); - } else t = translate(x + dx, y + dy); - emit('transform', t); -} -function bound(bounds, item, mode) { - var h = textMetrics.height(item), a = item.align, p = anchorPoint(item), x = p.x1, y = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset(item) - Math.round(0.8 * h), // use 4/5 offset - tl = textLines(item), w; - // get dimensions - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - h += lineHeight(item) * (tl.length - 1); - w = tl.reduce((w, t)=>Math.max(w, textMetrics.width(item, t)), 0); - } else // single-line text - w = textMetrics.width(item, tl); - // horizontal alignment - if (a === 'center') dx -= w / 2; - else if (a === 'right') dx -= w; - bounds.set(dx += x, dy += y, dx + w, dy + h); - if (item.angle && !mode) bounds.rotate(item.angle * DegToRad, x, y); - else if (mode === 2) return bounds.rotatedPoints(item.angle * DegToRad, x, y); - return bounds; -} -function draw(context, scene, bounds) { - visit(scene, (item)=>{ - var opacity = item.opacity == null ? 1 : item.opacity, p, x, y, i, lh, tl, str; - if (bounds && !bounds.intersects(item.bounds) || // bounds check - opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; - context.font = font(item); - context.textAlign = item.align || 'left'; - p = anchorPoint(item); - x = p.x1, y = p.y1; - if (item.angle) { - context.save(); - context.translate(x, y); - context.rotate(item.angle * DegToRad); - x = y = 0; // reset x, y - } - x += item.dx || 0; - y += (item.dy || 0) + offset(item); - tl = textLines(item); - blend(context, item); - if ((0, _vegaUtil.isArray)(tl)) { - lh = lineHeight(item); - for(i = 0; i < tl.length; ++i){ - str = textValue(item, tl[i]); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); - y += lh; - } - } else { - str = textValue(item, tl); - if (item.fill && fill(context, item, opacity)) context.fillText(str, x, y); - if (item.stroke && stroke(context, item, opacity)) context.strokeText(str, x, y); + }); + function Field$1(params2) { + Operator.call(this, null, update$3, params2); + } + inherits(Field$1, Operator); + function update$3(_) { + return this.value && !_.modified() ? this.value : isArray(_.name) ? array$5(_.name).map((f) => field$1(f)) : field$1(_.name, _.as); + } + function Filter(params2) { + Transform.call(this, fastmap(), params2); + } + Filter.Definition = { + "type": "Filter", + "metadata": { + "changes": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }] + }; + inherits(Filter, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, cache2 = this.value, output2 = pulse2.fork(), add2 = output2.add, rem2 = output2.rem, mod = output2.mod, test2 = _.expr; + let isMod = true; + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (!cache2.has(id2)) rem2.push(t); + else cache2.delete(id2); + }); + pulse2.visit(pulse2.ADD, (t) => { + if (test2(t, _)) add2.push(t); + else cache2.set(tupleid(t), 1); + }); + function revisit(t) { + const id2 = tupleid(t), b2 = test2(t, _), s = cache2.get(id2); + if (b2 && s) { + cache2.delete(id2); + add2.push(t); + } else if (!b2 && !s) { + cache2.set(id2, 1); + rem2.push(t); + } else if (isMod && b2 && !s) { + mod.push(t); } - if (item.angle) context.restore(); - }); -} -function hit(context, item, x, y, gx, gy) { - if (item.fontSize <= 0) return false; - if (!item.angle) return true; // bounds sufficient if no rotation - // project point into space of unrotated bounds - var p = anchorPoint(item), ax = p.x1, ay = p.y1, b = bound(tempBounds, item, 1), a = -item.angle * DegToRad, cos = Math.cos(a), sin = Math.sin(a), px = cos * gx - sin * gy + (ax - cos * ax + sin * ay), py = sin * gx + cos * gy + (ay - sin * ax - cos * ay); - return b.contains(px, py); -} -function intersectText(item, box) { - const p = bound(tempBounds, item, 2); - return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]); -} -var text = { - type: 'text', - tag: 'text', - nested: false, - attr: attr, - bound: bound, - draw: draw, - pick: pick$1(hit), - isect: intersectText -}; -var trail = markMultiItemPath('trail', trail$1, pickTrail); -var Marks = { - arc: arc, - area: area, - group: group, - image: image, - line: line, - path: path$2, - rect: rect, - rule: rule, - shape: shape, - symbol: symbol, - text: text, - trail: trail -}; -function boundItem(item, func, opt) { - var type = Marks[item.mark.marktype], bound = func || type.bound; - if (type.nested) item = item.mark; - return bound(item.bounds || (item.bounds = new Bounds()), item, opt); -} -var DUMMY = { - mark: null -}; -function boundMark(mark, bounds, opt) { - var type = Marks[mark.marktype], bound = type.bound, items = mark.items, hasItems = items && items.length, i, n, item, b; - if (type.nested) { - if (hasItems) item = items[0]; - else { - // no items, fake it - DUMMY.mark = mark; - item = DUMMY; - } - b = boundItem(item, bound, opt); - bounds = bounds && bounds.union(b) || b; - return bounds; - } - bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds(); - if (hasItems) for(i = 0, n = items.length; i < n; ++i)bounds.union(boundItem(items[i], bound, opt)); - return mark.bounds = bounds; -} -const keys = [ - 'marktype', - 'name', - 'role', - 'interactive', - 'clip', - 'items', - 'zindex', - 'x', - 'y', - 'width', - 'height', - 'align', - 'baseline', - // layout - 'fill', - 'fillOpacity', - 'opacity', - 'blend', - // fill - 'stroke', - 'strokeOpacity', - 'strokeWidth', - 'strokeCap', - // stroke - 'strokeDash', - 'strokeDashOffset', - // stroke dash - 'strokeForeground', - 'strokeOffset', - // group - 'startAngle', - 'endAngle', - 'innerRadius', - 'outerRadius', - // arc - 'cornerRadius', - 'padAngle', - // arc, rect - 'cornerRadiusTopLeft', - 'cornerRadiusTopRight', - // rect, group - 'cornerRadiusBottomLeft', - 'cornerRadiusBottomRight', - 'interpolate', - 'tension', - 'orient', - 'defined', - // area, line - 'url', - 'aspect', - 'smooth', - // image - 'path', - 'scaleX', - 'scaleY', - // path - 'x2', - 'y2', - // rule - 'size', - 'shape', - // symbol - 'text', - 'angle', - 'theta', - 'radius', - 'dir', - 'dx', - 'dy', - // text - 'ellipsis', - 'limit', - 'lineBreak', - 'lineHeight', - 'font', - 'fontSize', - 'fontWeight', - 'fontStyle', - 'fontVariant', - // font - 'description', - 'aria', - 'ariaRole', - 'ariaRoleDescription' // aria -]; -function sceneToJSON(scene, indent) { - return JSON.stringify(scene, keys, indent); -} -function sceneFromJSON(json) { - const scene = typeof json === 'string' ? JSON.parse(json) : json; - return initialize(scene); -} -function initialize(scene) { - var type = scene.marktype, items = scene.items, parent, i, n; - if (items) for(i = 0, n = items.length; i < n; ++i){ - parent = type ? 'mark' : 'group'; - items[i][parent] = scene; - if (items[i].zindex) items[i][parent].zdirty = true; - if ('group' === (type || parent)) initialize(items[i]); + } + pulse2.visit(pulse2.MOD, revisit); + if (_.modified()) { + isMod = false; + pulse2.visit(pulse2.REFLOW, revisit); + } + if (cache2.empty > df.cleanThreshold) df.runAfter(cache2.clean); + return output2; } - if (type) boundMark(scene); - return scene; -} -class Scenegraph { - constructor(scene){ - if (arguments.length) this.root = sceneFromJSON(scene); - else { - this.root = createMark({ - marktype: 'group', - name: 'root', - role: 'frame' - }); - this.root.items = [ - new GroupItem(this.root) - ]; + }); + function Flatten(params2) { + Transform.call(this, [], params2); + } + Flatten.Definition = { + "type": "Flatten", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "index", + "type": "string" + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Flatten, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(fields, _.as || []), index2 = _.index || null, m2 = as.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + const arrays = fields.map((f) => f(t)), maxlen = arrays.reduce((l, a2) => Math.max(l, a2.length), 0); + let i = 0, j, d, v; + for (; i < maxlen; ++i) { + d = derive(t); + for (j = 0; j < m2; ++j) { + d[as[j]] = (v = arrays[j][i]) == null ? null : v; + } + if (index2) { + d[index2] = i; + } + out.add.push(d); } + }); + this.value = out.source = out.add; + if (index2) out.modifies(index2); + return out.modifies(as); } - toJSON(indent) { - return sceneToJSON(this.root, indent || 0); - } - mark(markdef, group, index) { - group = group || this.root.items[0]; - const mark = createMark(markdef, group); - group.items[index] = mark; - if (mark.zindex) mark.group.zdirty = true; - return mark; - } -} -function createMark(def, group) { - const mark = { - bounds: new Bounds(), - clip: !!def.clip, - group: group, - interactive: def.interactive === false ? false : true, - items: [], - marktype: def.marktype, - name: def.name || undefined, - role: def.role || undefined, - zindex: def.zindex || 0 - }; - // add accessibility properties if defined - if (def.aria != null) mark.aria = def.aria; - if (def.description) mark.description = def.description; - return mark; -} -// create a new DOM element -function domCreate(doc, tag, ns) { - if (!doc && typeof document !== 'undefined' && document.createElement) doc = document; - return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; -} -// find first child element with matching tag -function domFind(el, tag) { - tag = tag.toLowerCase(); - var nodes = el.childNodes, i = 0, n = nodes.length; - for(; i < n; ++i)if (nodes[i].tagName.toLowerCase() === tag) return nodes[i]; -} -// retrieve child element at given index -// create & insert if doesn't exist or if tags do not match -function domChild(el, index, tag, ns) { - var a = el.childNodes[index], b; - if (!a || a.tagName.toLowerCase() !== tag.toLowerCase()) { - b = a || null; - a = domCreate(el.ownerDocument, tag, ns); - el.insertBefore(a, b); - } - return a; -} -// remove all child elements at or above the given index -function domClear(el, index) { - var nodes = el.childNodes, curr = nodes.length; - while(curr > index)el.removeChild(nodes[--curr]); - return el; -} -// generate css class name for mark -function cssClass(mark) { - return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : ''); -} -function point(event, el) { - const rect = el.getBoundingClientRect(); - return [ - event.clientX - rect.left - (el.clientLeft || 0), - event.clientY - rect.top - (el.clientTop || 0) - ]; -} -function resolveItem(item, event, el, origin) { - var mark = item && item.mark, mdef, p; - if (mark && (mdef = Marks[mark.marktype]).tip) { - p = point(event, el); - p[0] -= origin[0]; - p[1] -= origin[1]; - while(item = item.mark.group){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; + }); + function Fold(params2) { + Transform.call(this, [], params2); + } + Fold.Definition = { + "type": "Fold", + "metadata": { + "generates": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["key", "value"] + }] + }; + inherits(Fold, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, fnames = fields.map(accessorName), as = _.as || ["key", "value"], k = as[0], v = as[1], n = fields.length; + out.rem = this.value; + pulse2.visit(pulse2.SOURCE, (t) => { + for (let i = 0, d; i < n; ++i) { + d = derive(t); + d[k] = fnames[i]; + d[v] = fields[i](t); + out.add.push(d); } - item = mdef.tip(mark.items, p); - } - return item; -} -class Handler { - /** - * Create a new Handler instance. - * @param {object} [customLoader] - Optional loader instance for - * href URL sanitization. If not specified, a standard loader - * instance will be generated. - * @param {function} [customTooltip] - Optional tooltip handler - * function for custom tooltip display. - * @constructor - */ constructor(customLoader, customTooltip){ - this._active = null; - this._handlers = {}; - this._loader = customLoader || (0, _vegaLoader.loader)(); - this._tooltip = customTooltip || defaultTooltip; - } - /** - * Initialize a new Handler instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {object} [obj] - Optional context object that should serve as - * the "this" context for event callbacks. - * @return {Handler} - This handler instance. - */ initialize(el, origin, obj) { - this._el = el; - this._obj = obj || null; - return this.origin(origin); - } - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; + }); + this.value = out.source = out.add; + return out.modifies(as); } - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; + }); + function Formula(params2) { + Transform.call(this, null, params2); + } + Formula.Definition = { + "type": "Formula", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "expr", + "type": "expr", + "required": true + }, { + "name": "as", + "type": "string", + "required": true + }, { + "name": "initonly", + "type": "boolean" + }] + }; + inherits(Formula, Transform, { + transform(_, pulse2) { + const func = _.expr, as = _.as, mod = _.modified(), flag2 = _.initonly ? pulse2.ADD : mod ? pulse2.SOURCE : pulse2.modified(func.fields) || pulse2.modified(as) ? pulse2.ADD_MOD : pulse2.ADD; + if (mod) { + pulse2 = pulse2.materialize().reflow(true); + } + if (!_.initonly) { + pulse2.modifies(as); + } + return pulse2.visit(flag2, (t) => t[as] = func(t, _)); } - /** - * Get / set the origin coordinates of the visualization. - */ origin(origin) { - if (arguments.length) { - this._origin = origin || [ - 0, - 0 - ]; - return this; - } else return this._origin.slice(); + }); + function Generate(params2) { + Transform.call(this, [], params2); + } + inherits(Generate, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.ALL), gen = _.generator; + let data2 = this.value, num = _.size - data2.length, add2, rem2, t; + if (num > 0) { + for (add2 = []; --num >= 0; ) { + add2.push(t = ingest$1(gen(_))); + data2.push(t); + } + out.add = out.add.length ? out.materialize(out.ADD).add.concat(add2) : add2; + } else { + rem2 = data2.slice(0, -num); + out.rem = out.rem.length ? out.materialize(out.REM).rem.concat(rem2) : rem2; + data2 = data2.slice(-num); + } + out.source = this.value = data2; + return out; } - /** - * Get / set the scenegraph root. - */ scene(scene) { - if (!arguments.length) return this._scene; - this._scene = scene; - return this; + }); + const Methods$1 = { + value: "value", + median, + mean, + min: min$3, + max: max$3 + }; + const Empty$1 = []; + function Impute(params2) { + Transform.call(this, [], params2); + } + Impute.Definition = { + "type": "Impute", + "metadata": { + "changes": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }, { + "name": "keyvals", + "array": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "enum", + "default": "value", + "values": ["value", "mean", "median", "max", "min"] + }, { + "name": "value", + "default": 0 + }] + }; + function getValue(_) { + var m2 = _.method || Methods$1.value, v; + if (Methods$1[m2] == null) { + error("Unrecognized imputation method: " + m2); + } else if (m2 === Methods$1.value) { + v = _.value !== void 0 ? _.value : 0; + return () => v; + } else { + return Methods$1[m2]; } - /** - * Add an event handler. Subclasses should override this method. - */ on() {} - /** - * Remove an event handler. Subclasses should override this method. - */ off() {} - /** - * Utility method for finding the array index of an event handler. - * @param {Array} h - An array of registered event handlers. - * @param {string} type - The event type. - * @param {function} handler - The event handler instance to find. - * @return {number} - The handler's array index or -1 if not registered. - */ _handlerIndex(h, type, handler) { - for(let i = h ? h.length : 0; --i >= 0;){ - if (h[i].type === type && (!handler || h[i].handler === handler)) return i; + } + function getField$1(_) { + const f = _.field; + return (t) => t ? f(t) : NaN; + } + inherits(Impute, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), impute = getValue(_), field2 = getField$1(_), fName = accessorName(_.field), kName = accessorName(_.key), gNames = (_.groupby || []).map(accessorName), groups = partition$4(pulse2.source, _.groupby, _.key, _.keyvals), curr = [], prev = this.value, m2 = groups.domain.length, group2, value2, gVals, kVal, g, i, j, l, n, t; + for (g = 0, l = groups.length; g < l; ++g) { + group2 = groups[g]; + gVals = group2.values; + value2 = NaN; + for (j = 0; j < m2; ++j) { + if (group2[j] != null) continue; + kVal = groups.domain[j]; + t = { + _impute: true + }; + for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i]; + t[kName] = kVal; + t[fName] = Number.isNaN(value2) ? value2 = impute(group2, field2) : value2; + curr.push(ingest$1(t)); } - return -1; - } - /** - * Returns an array with registered event handlers. - * @param {string} [type] - The event type to query. Any annotations - * are ignored; for example, for the argument "click.foo", ".foo" will - * be ignored and the method returns all "click" handlers. If type is - * null or unspecified, this method returns handlers for all types. - * @return {Array} - A new array containing all registered event handlers. - */ handlers(type) { - const h = this._handlers, a = []; - if (type) a.push(...h[this.eventName(type)]); - else for(const k in h)a.push(...h[k]); - return a; + } + if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr); + if (prev.length) out.rem = out.materialize(out.REM).rem.concat(prev); + this.value = curr; + return out; } - /** - * Parses an event name string to return the specific event type. - * For example, given "click.foo" returns "click" - * @param {string} name - The input event type string. - * @return {string} - A string with the event type only. - */ eventName(name) { - const i = name.indexOf('.'); - return i < 0 ? name : name.slice(0, i); + }); + function partition$4(data2, groupby, key2, keyvals) { + var get2 = (f) => f(t), groups = [], domain2 = keyvals ? keyvals.slice() : [], kMap = {}, gMap = {}, gVals, gKey, group2, i, j, k, n, t; + domain2.forEach((k2, i2) => kMap[k2] = i2 + 1); + for (i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = key2(t); + j = kMap[k] || (kMap[k] = domain2.push(k)); + gKey = (gVals = groupby ? groupby.map(get2) : Empty$1) + ""; + if (!(group2 = gMap[gKey])) { + group2 = gMap[gKey] = []; + groups.push(group2); + group2.values = gVals; + } + group2[j - 1] = t; } - /** - * Handle hyperlink navigation in response to an item.href value. - * @param {Event} event - The event triggering hyperlink navigation. - * @param {Item} item - The scenegraph item. - * @param {string} href - The URL to navigate to. - */ handleHref(event, item, href) { - this._loader.sanitize(href, { - context: 'href' - }).then((opt)=>{ - const e = new MouseEvent(event.type, event), a = domCreate(null, 'a'); - for(const name in opt)a.setAttribute(name, opt[name]); - a.dispatchEvent(e); - }).catch(()=>{}); + groups.domain = domain2; + return groups; + } + function JoinAggregate(params2) { + Aggregate$1.call(this, params2); + } + JoinAggregate.Definition = { + "type": "JoinAggregate", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidAggregateOps + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "key", + "type": "field" + }] + }; + inherits(JoinAggregate, Aggregate$1, { + transform(_, pulse2) { + const aggr = this, mod = _.modified(); + let cells; + if (aggr.value && (mod || pulse2.modified(aggr._inputs, true))) { + cells = aggr.value = mod ? aggr.init(_) : {}; + pulse2.visit(pulse2.SOURCE, (t) => aggr.add(t)); + } else { + cells = aggr.value = aggr.value || this.init(_); + pulse2.visit(pulse2.REM, (t) => aggr.rem(t)); + pulse2.visit(pulse2.ADD, (t) => aggr.add(t)); + } + aggr.changes(); + pulse2.visit(pulse2.SOURCE, (t) => { + extend$1(t, cells[aggr.cellkey(t)].tuple); + }); + return pulse2.reflow(mod).modifies(this._outputs); + }, + changes() { + const adds = this._adds, mods = this._mods; + let i, n; + for (i = 0, n = this._alen; i < n; ++i) { + this.celltuple(adds[i]); + adds[i] = null; + } + for (i = 0, n = this._mlen; i < n; ++i) { + this.celltuple(mods[i]); + mods[i] = null; + } + this._alen = this._mlen = 0; } - /** - * Handle tooltip display in response to an item.tooltip value. - * @param {Event} event - The event triggering tooltip display. - * @param {Item} item - The scenegraph item. - * @param {boolean} show - A boolean flag indicating whether - * to show or hide a tooltip for the given item. - */ handleTooltip(event, item, show) { - if (item && item.tooltip != null) { - item = resolveItem(item, event, this.canvas(), this._origin); - const value = show && item && item.tooltip || null; - this._tooltip.call(this._obj, this, event, item, value); - } + }); + function KDE(params2) { + Transform.call(this, null, params2); + } + KDE.Definition = { + "type": "KDE", + "metadata": { + "generates": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "cumulative", + "type": "boolean", + "default": false + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "bandwidth", + "type": "number", + "default": 0 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "steps", + "type": "number" + }, { + "name": "minsteps", + "type": "number", + "default": 25 + }, { + "name": "maxsteps", + "type": "number", + "default": 200 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["value", "density"] + }] + }; + inherits(KDE, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), bandwidth2 = _.bandwidth, method2 = _.cumulative ? "cdf" : "pdf", as = _.as || ["value", "density"], values2 = []; + let domain2 = _.extent, minsteps = _.steps || _.minsteps || 25, maxsteps = _.steps || _.maxsteps || 200; + if (method2 !== "pdf" && method2 !== "cdf") { + error("Invalid density method: " + method2); + } + if (_.resolve === "shared") { + if (!domain2) domain2 = extent(source2, _.field); + minsteps = maxsteps = _.steps || maxsteps; + } + groups.forEach((g) => { + const density = kde(g, bandwidth2)[method2], scale2 = _.counts ? g.length : 1, local = domain2 || extent(g); + sampleCurve(density, local, minsteps, maxsteps).forEach((v) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = v[0]; + t[as[1]] = v[1] * scale2; + values2.push(ingest$1(t)); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; } - /** - * Returns the size of a scenegraph item and its position relative - * to the viewport. - * @param {Item} item - The scenegraph item. - * @return {object} - A bounding box object (compatible with the - * DOMRect type) consisting of x, y, width, heigh, top, left, - * right, and bottom properties. - */ getItemBoundingClientRect(item) { - const el = this.canvas(); - if (!el) return; - const rect = el.getBoundingClientRect(), origin = this._origin, bounds = item.bounds, width = bounds.width(), height = bounds.height(); - let x = bounds.x1 + origin[0] + rect.left, y = bounds.y1 + origin[1] + rect.top; - // translate coordinate for each parent group - while(item.mark && (item = item.mark.group)){ - x += item.x || 0; - y += item.y || 0; - } - // return DOMRect-compatible bounding box + }); + function Key$1(params2) { + Operator.call(this, null, update$2, params2); + } + inherits(Key$1, Operator); + function update$2(_) { + return this.value && !_.modified() ? this.value : key$2(_.fields, _.flat); + } + function Load$1(params2) { + Transform.call(this, [], params2); + this._pending = null; + } + inherits(Load$1, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow; + if (this._pending) { + return output(this, pulse2, this._pending); + } + if (stop(_)) return pulse2.StopPropagation; + if (_.values) { + return output(this, pulse2, df.parse(_.values, _.format)); + } else if (_.async) { + const p = df.request(_.url, _.format).then((res) => { + this._pending = array$5(res.data); + return (df2) => df2.touch(this); + }); return { - x, - y, - width, - height, - left: x, - top: y, - right: x + width, - bottom: y + height + async: p }; + } else { + return df.request(_.url, _.format).then((res) => output(this, pulse2, array$5(res.data))); + } } -} -// The default tooltip display handler. -// Sets the HTML title attribute on the visualization container. -function defaultTooltip(handler, event, item, value) { - handler.element().setAttribute('title', value || ''); -} -class Renderer { - /** - * Create a new Renderer instance. - * @param {object} [loader] - Optional loader instance for - * image and href URL sanitization. If not specified, a - * standard loader instance will be generated. - * @constructor - */ constructor(loader){ - this._el = null; - this._bgcolor = null; - this._loader = new ResourceLoader(loader); - } - /** - * Initialize a new Renderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._el = el; - return this.resize(width, height, origin, scaleFactor); + }); + function stop(_) { + return _.modified("async") && !(_.modified("values") || _.modified("url") || _.modified("format")); + } + function output(op, pulse2, data2) { + data2.forEach(ingest$1); + const out = pulse2.fork(pulse2.NO_FIELDS & pulse2.NO_SOURCE); + out.rem = op.value; + op.value = out.source = out.add = data2; + op._pending = null; + if (out.rem.length) out.clean(true); + return out; + } + function Lookup(params2) { + Transform.call(this, {}, params2); + } + Lookup.Definition = { + "type": "Lookup", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "index", + "type": "index", + "params": [{ + "name": "from", + "type": "data", + "required": true + }, { + "name": "key", + "type": "field", + "required": true + }] + }, { + "name": "values", + "type": "field", + "array": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "as", + "type": "string", + "array": true + }, { + "name": "default", + "default": null + }] + }; + inherits(Lookup, Transform, { + transform(_, pulse2) { + const keys2 = _.fields, index2 = _.index, values2 = _.values, defaultValue = _.default == null ? null : _.default, reset2 = _.modified(), n = keys2.length; + let flag2 = reset2 ? pulse2.SOURCE : pulse2.ADD, out = pulse2, as = _.as, set2, m2, mods; + if (values2) { + m2 = values2.length; + if (n > 1 && !as) { + error('Multi-field lookup requires explicit "as" parameter.'); + } + if (as && as.length !== n * m2) { + error('The "as" parameter has too few output field names.'); + } + as = as || values2.map(accessorName); + set2 = function(t) { + for (var i = 0, k = 0, j, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + if (v == null) for (j = 0; j < m2; ++j, ++k) t[as[k]] = defaultValue; + else for (j = 0; j < m2; ++j, ++k) t[as[k]] = values2[j](v); + } + }; + } else { + if (!as) { + error("Missing output field names."); + } + set2 = function(t) { + for (var i = 0, v; i < n; ++i) { + v = index2.get(keys2[i](t)); + t[as[i]] = v == null ? defaultValue : v; + } + }; + } + if (reset2) { + out = pulse2.reflow(true); + } else { + mods = keys2.some((k) => pulse2.modified(k.fields)); + flag2 |= mods ? pulse2.MOD : 0; + } + pulse2.visit(flag2, set2); + return out.modifies(as); } - /** - * Returns the parent container element for a visualization. - * @return {DOMElement} - The containing DOM element. - */ element() { - return this._el; + }); + function MultiExtent$1(params2) { + Operator.call(this, null, update$1, params2); + } + inherits(MultiExtent$1, Operator); + function update$1(_) { + if (this.value && !_.modified()) { + return this.value; } - /** - * Returns the scene element (e.g., canvas or SVG) of the visualization - * Subclasses must override if the first child is not the scene element. - * @return {DOMElement} - The scene (e.g., canvas or SVG) element. - */ canvas() { - return this._el && this._el.firstChild; + const ext = _.extents, n = ext.length; + let min2 = Infinity, max2 = -Infinity, i, e; + for (i = 0; i < n; ++i) { + e = ext[i]; + if (e[0] < min2) min2 = e[0]; + if (e[1] > max2) max2 = e[1]; } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length === 0) return this._bgcolor; - this._bgcolor = bgcolor; - return this; + return [min2, max2]; + } + function MultiValues$1(params2) { + Operator.call(this, null, update, params2); + } + inherits(MultiValues$1, Operator); + function update(_) { + return this.value && !_.modified() ? this.value : _.values.reduce((data2, _2) => data2.concat(_2), []); + } + function Params$2(params2) { + Transform.call(this, null, params2); + } + inherits(Params$2, Transform, { + transform(_, pulse2) { + this.modified(_.modified()); + this.value = _; + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {Renderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - this._width = width; - this._height = height; - this._origin = origin || [ - 0, - 0 - ]; - this._scale = scaleFactor || 1; - return this; + }); + function Pivot(params2) { + Aggregate$1.call(this, params2); + } + Pivot.Definition = { + "type": "Pivot", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "value", + "type": "field", + "required": true + }, { + "name": "op", + "type": "enum", + "values": ValidAggregateOps, + "default": "sum" + }, { + "name": "limit", + "type": "number", + "default": 0 + }, { + "name": "key", + "type": "field" + }] + }; + inherits(Pivot, Aggregate$1, { + _transform: Aggregate$1.prototype.transform, + transform(_, pulse2) { + return this._transform(aggregateParams(_, pulse2), pulse2); } - /** - * Report a dirty item whose bounds should be redrawn. - * This base class method does nothing. Subclasses that perform - * incremental should implement this method. - * @param {Item} item - The dirty item whose bounds should be redrawn. - */ dirty() {} - /** - * Render an input scenegraph, potentially with a set of dirty items. - * This method will perform an immediate rendering with available resources. - * The renderer may also need to perform image loading to perform a complete - * render. This process can lead to asynchronous re-rendering of the scene - * after this method returns. To receive notification when rendering is - * complete, use the renderAsync method instead. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Renderer} - This renderer instance. - */ render(scene, markTypes) { - const r = this; - // bind arguments into a render call, and cache it - // this function may be subsequently called for async redraw - r._call = function() { - r._render(scene, markTypes); - }; - // invoke the renderer - r._call(); - // clear the cached call for garbage collection - // async redraws will stash their own copy - r._call = null; - return r; + }); + function aggregateParams(_, pulse2) { + const key2 = _.field, value2 = _.value, op = (_.op === "count" ? "__count__" : _.op) || "sum", fields = accessorFields(key2).concat(accessorFields(value2)), keys2 = pivotKeys(key2, _.limit || 0, pulse2); + if (pulse2.changed()) _.set("__pivot__", null, null, true); + return { + key: _.key, + groupby: _.groupby, + ops: keys2.map(() => op), + fields: keys2.map((k) => get$4(k, key2, value2, fields)), + as: keys2.map((k) => k + ""), + modified: _.modified.bind(_) + }; + } + function get$4(k, key2, value2, fields) { + return accessor((d) => key2(d) === k ? value2(d) : NaN, fields, k + ""); + } + function pivotKeys(key2, limit, pulse2) { + const map2 = {}, list = []; + pulse2.visit(pulse2.SOURCE, (t) => { + const k = key2(t); + if (!map2[k]) { + map2[k] = 1; + list.push(k); + } + }); + list.sort(ascending$2); + return limit ? list.slice(0, limit) : list; + } + function PreFacet$1(params2) { + Facet$1.call(this, params2); + } + inherits(PreFacet$1, Facet$1, { + transform(_, pulse2) { + const flow = _.subflow, field2 = _.field, subflow = (t) => this.subflow(tupleid(t), flow, pulse2, t); + if (_.modified("field") || field2 && pulse2.modified(accessorFields(field2))) { + error("PreFacet does not support field modification."); + } + this.initTargets(); + if (field2) { + pulse2.visit(pulse2.MOD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.mod(_2)); + }); + pulse2.visit(pulse2.ADD, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.add(ingest$1(_2))); + }); + pulse2.visit(pulse2.REM, (t) => { + const sf = subflow(t); + field2(t).forEach((_2) => sf.rem(_2)); + }); + } else { + pulse2.visit(pulse2.MOD, (t) => subflow(t).mod(t)); + pulse2.visit(pulse2.ADD, (t) => subflow(t).add(t)); + pulse2.visit(pulse2.REM, (t) => subflow(t).rem(t)); + } + if (pulse2.clean()) { + pulse2.runAfter(() => this.clean()); + } + return pulse2; } - /** - * Internal rendering method. Renderer subclasses should override this - * method to actually perform rendering. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render() { - // subclasses to override + }); + function Project(params2) { + Transform.call(this, null, params2); + } + Project.Definition = { + "type": "Project", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "fields", + "type": "field", + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }] + }; + inherits(Project, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), fields = _.fields, as = fieldNames(_.fields, _.as || []), derive2 = fields ? (s, t) => project(s, t, fields, as) : rederive; + let lut; + if (this.value) { + lut = this.value; + } else { + pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive2(t, ingest$1({})); + lut[tupleid(t)] = dt; + out.add.push(dt); + }); + pulse2.visit(pulse2.MOD, (t) => { + out.mod.push(derive2(t, lut[tupleid(t)])); + }); + return out; } - /** - * Asynchronous rendering method. Similar to render, but returns a Promise - * that resolves when all rendering is completed. Sometimes a renderer must - * perform image loading to get a complete rendering. The returned - * Promise will not resolve until this process completes. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - * @return {Promise} - A Promise that resolves when rendering is complete. - */ renderAsync(scene, markTypes) { - const r = this.render(scene, markTypes); - return this._ready ? this._ready.then(()=>r) : Promise.resolve(r); + }); + function project(s, t, fields, as) { + for (let i = 0, n = fields.length; i < n; ++i) { + t[as[i]] = fields[i](s); } - /** - * Internal method for asynchronous resource loading. - * Proxies method calls to the ImageLoader, and tracks loading - * progress to invoke a re-render once complete. - * @param {string} method - The method name to invoke on the ImageLoader. - * @param {string} uri - The URI for the requested resource. - * @return {Promise} - A Promise that resolves to the requested resource. - */ _load(method, uri) { - var r = this, p = r._loader[method](uri); - if (!r._ready) { - // re-render the scene when loading completes - const call = r._call; - r._ready = r._loader.ready().then((redraw)=>{ - if (redraw) call(); - r._ready = null; - }); - } - return p; + return t; + } + function Proxy$1(params2) { + Transform.call(this, null, params2); + } + inherits(Proxy$1, Transform, { + transform(_, pulse2) { + this.value = _.value; + return _.modified("value") ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; } - /** - * Sanitize a URL to include as a hyperlink in the rendered scene. - * This method proxies a call to ImageLoader.sanitizeURL, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string to sanitize. - * @return {Promise} - A Promise that resolves to the sanitized URL. - */ sanitizeURL(uri) { - return this._load('sanitizeURL', uri); + }); + function Quantile$1(params2) { + Transform.call(this, null, params2); + } + Quantile$1.Definition = { + "type": "Quantile", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "field", + "type": "field", + "required": true + }, { + "name": "probs", + "type": "number", + "array": true + }, { + "name": "step", + "type": "number", + "default": 0.01 + }, { + "name": "as", + "type": "string", + "array": true, + "default": ["prob", "value"] + }] + }; + const EPSILON$2 = 1e-14; + inherits(Quantile$1, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), as = _.as || ["prob", "value"]; + if (this.value && !_.modified() && !pulse2.changed()) { + out.source = this.value; + return out; + } + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$1$1(source2, _.groupby, _.field), names = (_.groupby || []).map(accessorName), values2 = [], step = _.step || 0.01, p = _.probs || range$3(step / 2, 1 - EPSILON$2, step), n = p.length; + groups.forEach((g) => { + const q = quantiles(g, p); + for (let i = 0; i < n; ++i) { + const t = {}; + for (let i2 = 0; i2 < names.length; ++i2) { + t[names[i2]] = g.dims[i2]; + } + t[as[0]] = p[i]; + t[as[1]] = q[i]; + values2.push(ingest$1(t)); + } + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + return out; } - /** - * Requests an image to include in the rendered scene. - * This method proxies a call to ImageLoader.loadImage, but also tracks - * image loading progress and invokes a re-render once complete. - * @param {string} uri - The URI string of the image. - * @return {Promise} - A Promise that resolves to the loaded Image. - */ loadImage(uri) { - return this._load('loadImage', uri); - } -} -const KeyDownEvent = 'keydown'; -const KeyPressEvent = 'keypress'; -const KeyUpEvent = 'keyup'; -const DragEnterEvent = 'dragenter'; -const DragLeaveEvent = 'dragleave'; -const DragOverEvent = 'dragover'; -const PointerDownEvent = 'pointerdown'; -const PointerUpEvent = 'pointerup'; -const PointerMoveEvent = 'pointermove'; -const PointerOutEvent = 'pointerout'; -const PointerOverEvent = 'pointerover'; -const MouseDownEvent = 'mousedown'; -const MouseUpEvent = 'mouseup'; -const MouseMoveEvent = 'mousemove'; -const MouseOutEvent = 'mouseout'; -const MouseOverEvent = 'mouseover'; -const ClickEvent = 'click'; -const DoubleClickEvent = 'dblclick'; -const WheelEvent = 'wheel'; -const MouseWheelEvent = 'mousewheel'; -const TouchStartEvent = 'touchstart'; -const TouchMoveEvent = 'touchmove'; -const TouchEndEvent = 'touchend'; -const Events = [ - KeyDownEvent, - KeyPressEvent, - KeyUpEvent, - DragEnterEvent, - DragLeaveEvent, - DragOverEvent, - PointerDownEvent, - PointerUpEvent, - PointerMoveEvent, - PointerOutEvent, - PointerOverEvent, - MouseDownEvent, - MouseUpEvent, - MouseMoveEvent, - MouseOutEvent, - MouseOverEvent, - ClickEvent, - DoubleClickEvent, - WheelEvent, - MouseWheelEvent, - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent -]; -const TooltipShowEvent = PointerMoveEvent; -const TooltipHideEvent = MouseOutEvent; -const HrefEvent = ClickEvent; -class CanvasHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - this._down = null; - this._touch = null; - this._first = true; - this._events = {}; - // supported events - this.events = Events; - this.pointermove = move([ - PointerMoveEvent, - MouseMoveEvent - ], [ - PointerOverEvent, - MouseOverEvent - ], [ - PointerOutEvent, - MouseOutEvent - ]); - this.dragover = move([ - DragOverEvent - ], [ - DragEnterEvent - ], [ - DragLeaveEvent - ]), this.pointerout = inactive([ - PointerOutEvent, - MouseOutEvent - ]); - this.dragleave = inactive([ - DragLeaveEvent - ]); + }); + function Relay$1(params2) { + Transform.call(this, null, params2); + } + inherits(Relay$1, Transform, { + transform(_, pulse2) { + let out, lut; + if (this.value) { + lut = this.value; + } else { + out = pulse2 = pulse2.addAll(); + lut = this.value = {}; + } + if (_.derive) { + out = pulse2.fork(pulse2.NO_SOURCE); + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + out.rem.push(lut[id2]); + lut[id2] = null; + }); + pulse2.visit(pulse2.ADD, (t) => { + const dt = derive(t); + lut[tupleid(t)] = dt; + out.add.push(dt); + }); + pulse2.visit(pulse2.MOD, (t) => { + const dt = lut[tupleid(t)]; + for (const k in t) { + dt[k] = t[k]; + out.modifies(k); + } + out.mod.push(dt); + }); + } + return out; } - initialize(el, origin, obj) { - this._canvas = el && domFind(el, 'canvas'); - // add minimal events required for proper state management - [ - ClickEvent, - MouseDownEvent, - PointerDownEvent, - PointerMoveEvent, - PointerOutEvent, - DragLeaveEvent - ].forEach((type)=>eventListenerCheck(this, type)); - return super.initialize(el, origin, obj); + }); + function Sample(params2) { + Transform.call(this, [], params2); + this.count = 0; + } + Sample.Definition = { + "type": "Sample", + "metadata": {}, + "params": [{ + "name": "size", + "type": "number", + "default": 1e3 + }] + }; + inherits(Sample, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE), mod = _.modified("size"), num = _.size, map2 = this.value.reduce((m2, t) => (m2[tupleid(t)] = 1, m2), {}); + let res = this.value, cnt = this.count, cap = 0; + function update2(t) { + let p, idx; + if (res.length < num) { + res.push(t); + } else { + idx = ~~((cnt + 1) * random()); + if (idx < res.length && idx >= cap) { + p = res[idx]; + if (map2[tupleid(p)]) out.rem.push(p); + res[idx] = t; + } + } + ++cnt; + } + if (pulse2.rem.length) { + pulse2.visit(pulse2.REM, (t) => { + const id2 = tupleid(t); + if (map2[id2]) { + map2[id2] = -1; + out.rem.push(t); + } + --cnt; + }); + res = res.filter((t) => map2[tupleid(t)] !== -1); + } + if ((pulse2.rem.length || mod) && res.length < num && pulse2.source) { + cap = cnt = res.length; + pulse2.visit(pulse2.SOURCE, (t) => { + if (!map2[tupleid(t)]) update2(t); + }); + cap = -1; + } + if (mod && res.length > num) { + const n = res.length - num; + for (let i = 0; i < n; ++i) { + map2[tupleid(res[i])] = -1; + out.rem.push(res[i]); + } + res = res.slice(n); + } + if (pulse2.mod.length) { + pulse2.visit(pulse2.MOD, (t) => { + if (map2[tupleid(t)]) out.mod.push(t); + }); + } + if (pulse2.add.length) { + pulse2.visit(pulse2.ADD, update2); + } + if (pulse2.add.length || cap < 0) { + out.add = res.filter((t) => !map2[tupleid(t)]); + } + this.count = cnt; + this.value = out.source = res; + return out; } - // return the backing canvas instance - canvas() { - return this._canvas; + }); + function Sequence(params2) { + Transform.call(this, null, params2); + } + Sequence.Definition = { + "type": "Sequence", + "metadata": { + "generates": true, + "changes": true + }, + "params": [{ + "name": "start", + "type": "number", + "required": true + }, { + "name": "stop", + "type": "number", + "required": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "as", + "type": "string", + "default": "data" + }] + }; + inherits(Sequence, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) return; + const out = pulse2.materialize().fork(pulse2.MOD), as = _.as || "data"; + out.rem = this.value ? pulse2.rem.concat(this.value) : pulse2.rem; + this.value = range$3(_.start, _.stop, _.step || 1).map((v) => { + const t = {}; + t[as] = v; + return ingest$1(t); + }); + out.add = pulse2.add.concat(this.value); + return out; } - // retrieve the current canvas context - context() { - return this._canvas.getContext('2d'); + }); + function Sieve$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Sieve$1, Transform, { + transform(_, pulse2) { + this.value = pulse2.source; + return pulse2.changed() ? pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS) : pulse2.StopPropagation; } - // to keep old versions of firefox happy - DOMMouseScroll(evt) { - this.fire(MouseWheelEvent, evt); + }); + function TimeUnit(params2) { + Transform.call(this, null, params2); + } + const OUTPUT = ["unit0", "unit1"]; + TimeUnit.Definition = { + "type": "TimeUnit", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field", + "required": true + }, { + "name": "interval", + "type": "boolean", + "default": true + }, { + "name": "units", + "type": "enum", + "values": TIME_UNITS, + "array": true + }, { + "name": "step", + "type": "number", + "default": 1 + }, { + "name": "maxbins", + "type": "number", + "default": 40 + }, { + "name": "extent", + "type": "date", + "array": true + }, { + "name": "timezone", + "type": "enum", + "default": "local", + "values": ["local", "utc"] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": OUTPUT + }] + }; + inherits(TimeUnit, Transform, { + transform(_, pulse2) { + const field2 = _.field, band2 = _.interval !== false, utc = _.timezone === "utc", floor2 = this._floor(_, pulse2), offset2 = (utc ? utcInterval : timeInterval)(floor2.unit).offset, as = _.as || OUTPUT, u0 = as[0], u1 = as[1], step = floor2.step; + let min2 = floor2.start || Infinity, max2 = floor2.stop || -Infinity, flag2 = pulse2.ADD; + if (_.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(field2))) { + pulse2 = pulse2.reflow(true); + flag2 = pulse2.SOURCE; + min2 = Infinity; + max2 = -Infinity; + } + pulse2.visit(flag2, (t) => { + const v = field2(t); + let a2, b2; + if (v == null) { + t[u0] = null; + if (band2) t[u1] = null; + } else { + t[u0] = a2 = b2 = floor2(v); + if (band2) t[u1] = b2 = offset2(a2, step); + if (a2 < min2) min2 = a2; + if (b2 > max2) max2 = b2; + } + }); + floor2.start = min2; + floor2.stop = max2; + return pulse2.modifies(band2 ? as : u0); + }, + _floor(_, pulse2) { + const utc = _.timezone === "utc"; + const { + units, + step + } = _.units ? { + units: _.units, + step: _.step || 1 + } : bin$1({ + extent: _.extent || extent(pulse2.materialize(pulse2.SOURCE).source, _.field), + maxbins: _.maxbins + }); + const tunits = timeUnits(units), prev = this.value || {}, floor2 = (utc ? utcFloor : timeFloor)(tunits, step); + floor2.unit = peek$1(tunits); + floor2.units = tunits; + floor2.step = step; + floor2.start = prev.start; + floor2.stop = prev.stop; + return this.value = floor2; } - pointerdown(evt) { - this._down = this._active; - this.fire(PointerDownEvent, evt); + }); + function TupleIndex(params2) { + Transform.call(this, fastmap(), params2); + } + inherits(TupleIndex, Transform, { + transform(_, pulse2) { + const df = pulse2.dataflow, field2 = _.field, index2 = this.value, set2 = (t) => index2.set(field2(t), t); + let mod = true; + if (_.modified("field") || pulse2.modified(field2.fields)) { + index2.clear(); + pulse2.visit(pulse2.SOURCE, set2); + } else if (pulse2.changed()) { + pulse2.visit(pulse2.REM, (t) => index2.delete(field2(t))); + pulse2.visit(pulse2.ADD, set2); + } else { + mod = false; + } + this.modified(mod); + if (index2.empty > df.cleanThreshold) df.runAfter(index2.clean); + return pulse2.fork(); } - mousedown(evt) { - this._down = this._active; - this.fire(MouseDownEvent, evt); + }); + function Values$1(params2) { + Transform.call(this, null, params2); + } + inherits(Values$1, Transform, { + transform(_, pulse2) { + const run2 = !this.value || _.modified("field") || _.modified("sort") || pulse2.changed() || _.sort && pulse2.modified(_.sort.fields); + if (run2) { + this.value = (_.sort ? pulse2.source.slice().sort(stableCompare(_.sort)) : pulse2.source).map(_.field); + } } - click(evt) { - if (this._down === this._active) { - this.fire(ClickEvent, evt); - this._down = null; + }); + function WindowOp(op, field2, param2, as) { + const fn = WindowOps[op](field2, param2); + return { + init: fn.init || zero$3, + update: function(w2, t) { + t[as] = fn.next(w2); + } + }; + } + const WindowOps = { + row_number: function() { + return { + next: (w2) => w2.index + 1 + }; + }, + rank: function() { + let rank2; + return { + init: () => rank2 = 1, + next: (w2) => { + const i = w2.index, data2 = w2.data; + return i && w2.compare(data2[i - 1], data2[i]) ? rank2 = i + 1 : rank2; } - } - touchstart(evt) { - this._touch = this.pickEvent(evt.changedTouches[0]); - if (this._first) { - this._active = this._touch; - this._first = false; + }; + }, + dense_rank: function() { + let drank; + return { + init: () => drank = 1, + next: (w2) => { + const i = w2.index, d = w2.data; + return i && w2.compare(d[i - 1], d[i]) ? ++drank : drank; } - this.fire(TouchStartEvent, evt, true); - } - touchmove(evt) { - this.fire(TouchMoveEvent, evt, true); - } - touchend(evt) { - this.fire(TouchEndEvent, evt, true); - this._touch = null; + }; + }, + percent_rank: function() { + const rank2 = WindowOps.rank(), next = rank2.next; + return { + init: rank2.init, + next: (w2) => (next(w2) - 1) / (w2.data.length - 1) + }; + }, + cume_dist: function() { + let cume; + return { + init: () => cume = 0, + next: (w2) => { + const d = w2.data, c2 = w2.compare; + let i = w2.index; + if (cume < i) { + while (i + 1 < d.length && !c2(d[i], d[i + 1])) ++i; + cume = i; + } + return (1 + cume) / d.length; + } + }; + }, + ntile: function(field2, num) { + num = +num; + if (!(num > 0)) error("ntile num must be greater than zero."); + const cume = WindowOps.cume_dist(), next = cume.next; + return { + init: cume.init, + next: (w2) => Math.ceil(num * next(w2)) + }; + }, + lag: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index - offset2; + return i >= 0 ? field2(w2.data[i]) : null; + } + }; + }, + lead: function(field2, offset2) { + offset2 = +offset2 || 1; + return { + next: (w2) => { + const i = w2.index + offset2, d = w2.data; + return i < d.length ? field2(d[i]) : null; + } + }; + }, + first_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i0]) + }; + }, + last_value: function(field2) { + return { + next: (w2) => field2(w2.data[w2.i1 - 1]) + }; + }, + nth_value: function(field2, nth) { + nth = +nth; + if (!(nth > 0)) error("nth_value nth must be greater than zero."); + return { + next: (w2) => { + const i = w2.i0 + (nth - 1); + return i < w2.i1 ? field2(w2.data[i]) : null; + } + }; + }, + prev_value: function(field2) { + let prev; + return { + init: () => prev = null, + next: (w2) => { + const v = field2(w2.data[w2.index]); + return v != null ? prev = v : prev; + } + }; + }, + next_value: function(field2) { + let v, i; + return { + init: () => (v = null, i = -1), + next: (w2) => { + const d = w2.data; + return w2.index <= i ? v : (i = find$2(field2, d, w2.index)) < 0 ? (i = d.length, v = null) : v = field2(d[i]); + } + }; } - // fire an event - fire(type, evt, touch) { - const a = touch ? this._touch : this._active, h = this._handlers[type]; - // set event type relative to scenegraph items - evt.vegaType = type; - // handle hyperlinks and tooltips first - if (type === HrefEvent && a && a.href) this.handleHref(evt, a, a.href); - else if (type === TooltipShowEvent || type === TooltipHideEvent) this.handleTooltip(evt, a, type !== TooltipHideEvent); - // invoke all registered handlers - if (h) for(let i = 0, len = h.length; i < len; ++i)h[i].handler.call(this._obj, evt, a); + }; + function find$2(field2, data2, index2) { + for (let n = data2.length; index2 < n; ++index2) { + const v = field2(data2[index2]); + if (v != null) return index2; } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - eventListenerCheck(this, type); - (h[name] || (h[name] = [])).push({ - type: type, - handler: handler - }); - } - return this; + return -1; + } + const ValidWindowOps = Object.keys(WindowOps); + function WindowState(_) { + const ops2 = array$5(_.ops), fields = array$5(_.fields), params2 = array$5(_.params), aggregate_params = array$5(_.aggregate_params), as = array$5(_.as), outputs = this.outputs = [], windows = this.windows = [], inputs = {}, map2 = {}, counts = [], measures = []; + let countOnly = true; + function visitInputs(f) { + array$5(accessorFields(f)).forEach((_2) => inputs[_2] = 1); } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) h.splice(i, 1); - return this; + visitInputs(_.sort); + ops2.forEach((op, i) => { + const field2 = fields[i], param2 = params2[i], aggregate_param = aggregate_params[i] || null, mname = accessorName(field2), name = measureName(op, mname, as[i]); + visitInputs(field2); + outputs.push(name); + if (has$1(WindowOps, op)) { + windows.push(WindowOp(op, field2, param2, name)); + } else { + if (field2 == null && op !== "count") { + error("Null aggregate field specified."); + } + if (op === "count") { + counts.push(name); + return; + } + countOnly = false; + let m2 = map2[mname]; + if (!m2) { + m2 = map2[mname] = []; + m2.field = field2; + measures.push(m2); + } + m2.push(createMeasure(op, aggregate_param, name)); + } + }); + if (counts.length || measures.length) { + this.cell = cell(measures, counts, countOnly); } - pickEvent(evt) { - const p = point(evt, this._canvas), o = this._origin; - return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); + this.inputs = Object.keys(inputs); + } + const prototype = WindowState.prototype; + prototype.init = function() { + this.windows.forEach((_) => _.init()); + if (this.cell) this.cell.init(); + }; + prototype.update = function(w2, t) { + const cell2 = this.cell, wind = this.windows, data2 = w2.data, m2 = wind && wind.length; + let j; + if (cell2) { + for (j = w2.p0; j < w2.i0; ++j) cell2.rem(data2[j]); + for (j = w2.p1; j < w2.i1; ++j) cell2.add(data2[j]); + cell2.set(t); } - // find the scenegraph item at the current pointer position - // x, y -- the absolute x, y pointer coordinates on the canvas element - // gx, gy -- the relative coordinates within the current group - pick(scene, x, y, gx, gy) { - const g = this.context(), mark = Marks[scene.marktype]; - return mark.pick.call(this, g, scene, x, y, gx, gy); - } -} -const eventBundle = (type)=>type === TouchStartEvent || type === TouchMoveEvent || type === TouchEndEvent ? [ - TouchStartEvent, - TouchMoveEvent, - TouchEndEvent - ] : [ - type - ]; -// lazily add listeners to the canvas as needed -function eventListenerCheck(handler, type) { - eventBundle(type).forEach((_)=>addEventListener(handler, _)); -} -function addEventListener(handler, type) { - const canvas = handler.canvas(); - if (canvas && !handler._events[type]) { - handler._events[type] = 1; - canvas.addEventListener(type, handler[type] ? (evt)=>handler[type](evt) : (evt)=>handler.fire(type, evt)); - } -} -function fireAll(handler, types, event) { - types.forEach((type)=>handler.fire(type, event)); -} -function move(moveEvents, overEvents, outEvents) { - return function(evt) { - const a = this._active, p = this.pickEvent(evt); - if (p === a) // active item and picked item are the same - fireAll(this, moveEvents, evt); // fire move - else { - // active item and picked item are different - if (!a || !a.exit) // fire out for prior active item - // suppress if active item was removed from scene - fireAll(this, outEvents, evt); - this._active = p; // set new active item - fireAll(this, overEvents, evt); // fire over for new active item - fireAll(this, moveEvents, evt); // fire move for new active item - } + for (j = 0; j < m2; ++j) wind[j].update(w2, t); + }; + function cell(measures, counts, countOnly) { + measures = measures.map((m2) => compileMeasures(m2, m2.field)); + const cell2 = { + num: 0, + agg: null, + store: false, + count: counts }; -} -function inactive(types) { - return function(evt) { - fireAll(this, types, evt); - this._active = null; - }; -} -function devicePixelRatio() { - return typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; -} -function resize(canvas, width, height, origin, scaleFactor, opt) { - const inDOM = typeof HTMLElement !== 'undefined' && canvas instanceof HTMLElement && canvas.parentNode != null, context = canvas.getContext('2d'), ratio = inDOM ? devicePixelRatio() : scaleFactor; - canvas.width = width * ratio; - canvas.height = height * ratio; - for(const key in opt)context[key] = opt[key]; - if (inDOM && ratio !== 1) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; + if (!countOnly) { + var n = measures.length, a2 = cell2.agg = Array(n), i = 0; + for (; i < n; ++i) a2[i] = new measures[i](cell2); + } + if (cell2.store) { + var store = cell2.data = new TupleStore(); + } + cell2.add = function(t) { + cell2.num += 1; + if (countOnly) return; + if (store) store.add(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].add(a2[i2].get(t), t); + } + }; + cell2.rem = function(t) { + cell2.num -= 1; + if (countOnly) return; + if (store) store.rem(t); + for (let i2 = 0; i2 < n; ++i2) { + a2[i2].rem(a2[i2].get(t), t); + } + }; + cell2.set = function(t) { + let i2, n2; + if (store) store.values(); + for (i2 = 0, n2 = counts.length; i2 < n2; ++i2) t[counts[i2]] = cell2.num; + if (!countOnly) for (i2 = 0, n2 = a2.length; i2 < n2; ++i2) a2[i2].set(t); + }; + cell2.init = function() { + cell2.num = 0; + if (store) store.reset(); + for (let i2 = 0; i2 < n; ++i2) a2[i2].init(); + }; + return cell2; + } + function Window(params2) { + Transform.call(this, {}, params2); + this._mlen = 0; + this._mods = []; + } + Window.Definition = { + "type": "Window", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "sort", + "type": "compare" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "ops", + "type": "enum", + "array": true, + "values": ValidWindowOps.concat(ValidAggregateOps) + }, { + "name": "params", + "type": "number", + "null": true, + "array": true + }, { + "name": "aggregate_params", + "type": "number", + "null": true, + "array": true + }, { + "name": "fields", + "type": "field", + "null": true, + "array": true + }, { + "name": "as", + "type": "string", + "null": true, + "array": true + }, { + "name": "frame", + "type": "number", + "null": true, + "array": true, + "length": 2, + "default": [null, 0] + }, { + "name": "ignorePeers", + "type": "boolean", + "default": false + }] + }; + inherits(Window, Transform, { + transform(_, pulse2) { + this.stamp = pulse2.stamp; + const mod = _.modified(), cmp = stableCompare(_.sort), key2 = groupkey(_.groupby), group2 = (t) => this.group(key2(t)); + let state = this.state; + if (!state || mod) { + state = this.state = new WindowState(_); + } + if (mod || pulse2.modified(state.inputs)) { + this.value = {}; + pulse2.visit(pulse2.SOURCE, (t) => group2(t).add(t)); + } else { + pulse2.visit(pulse2.REM, (t) => group2(t).remove(t)); + pulse2.visit(pulse2.ADD, (t) => group2(t).add(t)); + } + for (let i = 0, n = this._mlen; i < n; ++i) { + processPartition(this._mods[i], state, cmp, _); + } + this._mlen = 0; + this._mods = []; + return pulse2.reflow(mod).modifies(state.outputs); + }, + group(key2) { + let group2 = this.value[key2]; + if (!group2) { + group2 = this.value[key2] = SortedList(tupleid); + group2.stamp = -1; + } + if (group2.stamp < this.stamp) { + group2.stamp = this.stamp; + this._mods[this._mlen++] = group2; + } + return group2; } - context.pixelRatio = ratio; - context.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); - return canvas; -} -class CanvasRenderer extends Renderer { - constructor(loader){ - super(loader); - this._options = {}; - this._redraw = false; - this._dirty = new Bounds(); - this._tempb = new Bounds(); - } - initialize(el, width, height, origin, scaleFactor, options) { - this._options = options || {}; - this._canvas = this._options.externalContext ? null : (0, _vegaCanvas.canvas)(1, 1, this._options.type); // instantiate a small canvas - if (el && this._canvas) { - domClear(el, 0).appendChild(this._canvas); - this._canvas.setAttribute('class', 'marks'); - } - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin, scaleFactor); - } - resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._canvas) // configure canvas size and transform - resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); - else { - // external context needs to be scaled and positioned to origin - const ctx = this._options.externalContext; - if (!ctx) (0, _vegaUtil.error)('CanvasRenderer is missing a valid canvas or context'); - ctx.scale(this._scale, this._scale); - ctx.translate(this._origin[0], this._origin[1]); - } - this._redraw = true; - return this; + }); + function processPartition(list, state, cmp, _) { + const sort2 = _.sort, range2 = sort2 && !_.ignorePeers, frame2 = _.frame || [null, 0], data2 = list.data(cmp), n = data2.length, b2 = range2 ? bisector(sort2) : null, w2 = { + i0: 0, + i1: 0, + p0: 0, + p1: 0, + index: 0, + data: data2, + compare: sort2 || constant$5(-1) + }; + state.init(); + for (let i = 0; i < n; ++i) { + setWindow(w2, frame2, i, n); + if (range2) adjustRange(w2, b2); + state.update(w2, data2[i]); } - canvas() { - return this._canvas; + } + function setWindow(w2, f, i, n) { + w2.p0 = w2.i0; + w2.p1 = w2.i1; + w2.i0 = f[0] == null ? 0 : Math.max(0, i - Math.abs(f[0])); + w2.i1 = f[1] == null ? n : Math.min(n, i + Math.abs(f[1]) + 1); + w2.index = i; + } + function adjustRange(w2, bisect2) { + const r0 = w2.i0, r1 = w2.i1 - 1, c2 = w2.compare, d = w2.data, n = d.length - 1; + if (r0 > 0 && !c2(d[r0], d[r0 - 1])) w2.i0 = bisect2.left(d, d[r0]); + if (r1 < n && !c2(d[r1], d[r1 + 1])) w2.i1 = bisect2.right(d, d[r1]); + } + const tx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + aggregate: Aggregate$1, + bin: Bin, + collect: Collect$1, + compare: Compare$1, + countpattern: CountPattern, + cross: Cross, + density: Density, + dotbin: DotBin, + expression: Expression$1, + extent: Extent, + facet: Facet$1, + field: Field$1, + filter: Filter, + flatten: Flatten, + fold: Fold, + formula: Formula, + generate: Generate, + impute: Impute, + joinaggregate: JoinAggregate, + kde: KDE, + key: Key$1, + load: Load$1, + lookup: Lookup, + multiextent: MultiExtent$1, + multivalues: MultiValues$1, + params: Params$2, + pivot: Pivot, + prefacet: PreFacet$1, + project: Project, + proxy: Proxy$1, + quantile: Quantile$1, + relay: Relay$1, + sample: Sample, + sequence: Sequence, + sieve: Sieve$1, + subflow: Subflow, + timeunit: TimeUnit, + tupleindex: TupleIndex, + values: Values$1, + window: Window + }, Symbol.toStringTag, { value: "Module" })); + function constant$3(x2) { + return function constant2() { + return x2; + }; + } + const abs$2 = Math.abs; + const atan2$1 = Math.atan2; + const cos$2 = Math.cos; + const max$2 = Math.max; + const min$2 = Math.min; + const sin$2 = Math.sin; + const sqrt$3 = Math.sqrt; + const epsilon$5 = 1e-12; + const pi$3 = Math.PI; + const halfPi$2 = pi$3 / 2; + const tau$3 = 2 * pi$3; + function acos$1(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$3 : Math.acos(x2); + } + function asin$2(x2) { + return x2 >= 1 ? halfPi$2 : x2 <= -1 ? -halfPi$2 : Math.asin(x2); + } + const pi$2 = Math.PI, tau$2 = 2 * pi$2, epsilon$4 = 1e-6, tauEpsilon = tau$2 - epsilon$4; + function append$1(strings) { + this._ += strings[0]; + for (let i = 1, n = strings.length; i < n; ++i) { + this._ += arguments[i] + strings[i]; } - context() { - return this._options.externalContext || (this._canvas ? this._canvas.getContext('2d') : null); + } + function appendRound$1(digits) { + let d = Math.floor(digits); + if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`); + if (d > 15) return append$1; + const k = 10 ** d; + return function(strings) { + this._ += strings[0]; + for (let i = 1, n = strings.length; i < n; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings[i]; + } + }; + } + let Path$1 = class Path { + constructor(digits) { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + this._append = digits == null ? append$1 : appendRound$1(digits); } - dirty(item) { - const b = this._tempb.clear().union(item.bounds); - let g = item.mark.group; - while(g){ - b.translate(g.x || 0, g.y || 0); - g = g.mark.group; - } - this._dirty.union(b); + moveTo(x2, y2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; } - _render(scene, markTypes) { - const g = this.context(), o = this._origin, w = this._width, h = this._height, db = this._dirty, vb = viewBounds(o, w, h); - // setup - g.save(); - const b = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); - this.clear(-o[0], -o[1], w, h); - // render - this.draw(g, scene, b, markTypes); - // takedown - g.restore(); - db.clear(); - return this; + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._append`Z`; + } } - draw(ctx, scene, bounds, markTypes) { - if (scene.marktype !== 'group' && markTypes != null && !markTypes.includes(scene.marktype)) return; - const mark = Marks[scene.marktype]; - if (scene.clip) clip(ctx, scene); - mark.draw.call(this, ctx, scene, bounds, markTypes); - if (scene.clip) ctx.restore(); - } - clear(x, y, w, h) { - const opt = this._options, g = this.context(); - if (opt.type !== 'pdf' && !opt.externalContext) // calling clear rect voids vector output in pdf mode - // and could remove external context content (#2615) - g.clearRect(x, y, w, h); - if (this._bgcolor != null) { - g.fillStyle = this._bgcolor; - g.fillRect(x, y, w, h); - } - } -} -const viewBounds = (origin, width, height)=>new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]); -function clipToBounds(g, b, origin) { - // expand bounds by 1 pixel, then round to pixel boundaries - b.expand(1).round(); - // align to base pixel grid in case of non-integer scaling (#2425) - if (g.pixelRatio % 1) b.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); - // to avoid artifacts translate if origin has fractional pixels - b.translate(-(origin[0] % 1), -(origin[1] % 1)); - // set clip path - g.beginPath(); - g.rect(b.x1, b.y1, b.width(), b.height()); - g.clip(); - return b; -} -class SVGHandler extends Handler { - constructor(loader, tooltip){ - super(loader, tooltip); - const h = this; - h._hrefHandler = listener(h, (evt, item)=>{ - if (item && item.href) h.handleHref(evt, item, item.href); - }); - h._tooltipHandler = listener(h, (evt, item)=>{ - h.handleTooltip(evt, item, evt.type !== TooltipHideEvent); - }); + lineTo(x2, y2) { + this._append`L${this._x1 = +x2},${this._y1 = +y2}`; + } + quadraticCurveTo(x12, y12, x2, y2) { + this._append`Q${+x12},${+y12},${this._x1 = +x2},${this._y1 = +y2}`; + } + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + this._append`C${+x12},${+y12},${+x2},${+y2},${this._x1 = +x3},${this._y1 = +y3}`; + } + arcTo(x12, y12, x2, y2, r) { + x12 = +x12, y12 = +y12, x2 = +x2, y2 = +y2, r = +r; + if (r < 0) throw new Error(`negative radius: ${r}`); + let x02 = this._x1, y02 = this._y1, x21 = x2 - x12, y21 = y2 - y12, x01 = x02 - x12, y01 = y02 - y12, l01_2 = x01 * x01 + y01 * y01; + if (this._x1 === null) { + this._append`M${this._x1 = x12},${this._y1 = y12}`; + } else if (!(l01_2 > epsilon$4)) ; + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$4) || !r) { + this._append`L${this._x1 = x12},${this._y1 = y12}`; + } else { + let x20 = x2 - x02, y20 = y2 - y02, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; + if (Math.abs(t01 - 1) > epsilon$4) { + this._append`L${x12 + t01 * x01},${y12 + t01 * y01}`; + } + this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x12 + t21 * x21},${this._y1 = y12 + t21 * y21}`; + } } - initialize(el, origin, obj) { - let svg = this._svg; - if (svg) { - svg.removeEventListener(HrefEvent, this._hrefHandler); - svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); - svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); - } - this._svg = svg = el && domFind(el, 'svg'); - if (svg) { - svg.addEventListener(HrefEvent, this._hrefHandler); - svg.addEventListener(TooltipShowEvent, this._tooltipHandler); - svg.addEventListener(TooltipHideEvent, this._tooltipHandler); - } - return super.initialize(el, origin, obj); + arc(x2, y2, r, a0, a1, ccw) { + x2 = +x2, y2 = +y2, r = +r, ccw = !!ccw; + if (r < 0) throw new Error(`negative radius: ${r}`); + let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x02 = x2 + dx, y02 = y2 + dy, cw2 = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; + if (this._x1 === null) { + this._append`M${x02},${y02}`; + } else if (Math.abs(this._x1 - x02) > epsilon$4 || Math.abs(this._y1 - y02) > epsilon$4) { + this._append`L${x02},${y02}`; + } + if (!r) return; + if (da < 0) da = da % tau$2 + tau$2; + if (da > tauEpsilon) { + this._append`A${r},${r},0,1,${cw2},${x2 - dx},${y2 - dy}A${r},${r},0,1,${cw2},${this._x1 = x02},${this._y1 = y02}`; + } else if (da > epsilon$4) { + this._append`A${r},${r},0,${+(da >= pi$2)},${cw2},${this._x1 = x2 + r * Math.cos(a1)},${this._y1 = y2 + r * Math.sin(a1)}`; + } } - canvas() { - return this._svg; + rect(x2, y2, w2, h2) { + this._append`M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${w2 = +w2}v${+h2}h${-w2}Z`; } - // add an event handler - on(type, handler) { - const name = this.eventName(type), h = this._handlers, i = this._handlerIndex(h[name], type, handler); - if (i < 0) { - const x = { - type, - handler, - listener: listener(this, handler) - }; - (h[name] || (h[name] = [])).push(x); - if (this._svg) this._svg.addEventListener(name, x.listener); - } - return this; + toString() { + return this._; } - // remove an event handler - off(type, handler) { - const name = this.eventName(type), h = this._handlers[name], i = this._handlerIndex(h, type, handler); - if (i >= 0) { - if (this._svg) this._svg.removeEventListener(name, h[i].listener); - h.splice(i, 1); - } - return this; + }; + function path$3() { + return new Path$1(); + } + path$3.prototype = Path$1.prototype; + function withPath(shape2) { + let digits = 3; + shape2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) { + digits = null; + } else { + const d = Math.floor(_); + if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d; + } + return shape2; + }; + return () => new Path$1(digits); + } + function arcInnerRadius(d) { + return d.innerRadius; + } + function arcOuterRadius(d) { + return d.outerRadius; + } + function arcStartAngle(d) { + return d.startAngle; + } + function arcEndAngle(d) { + return d.endAngle; + } + function arcPadAngle(d) { + return d && d.padAngle; + } + function intersect$3(x02, y02, x12, y12, x2, y2, x3, y3) { + var x10 = x12 - x02, y10 = y12 - y02, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; + if (t * t < epsilon$5) return; + t = (x32 * (y02 - y2) - y32 * (x02 - x2)) / t; + return [x02 + t * x10, y02 + t * y10]; + } + function cornerTangents(x02, y02, x12, y12, r1, rc, cw2) { + var x01 = x02 - x12, y01 = y02 - y12, lo = (cw2 ? rc : -rc) / sqrt$3(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x02 + ox, y11 = y02 + oy, x10 = x12 + ox, y10 = y12 + oy, x002 = (x11 + x10) / 2, y002 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt$3(max$2(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d) / d2, cy0 = (-D2 * dx - dy * d) / d2, cx1 = (D2 * dy + dx * d) / d2, cy1 = (-D2 * dx + dy * d) / d2, dx0 = cx0 - x002, dy0 = cy0 - y002, dx1 = cx1 - x002, dy1 = cy1 - y002; + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + return { + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r - 1), + y11: cy0 * (r1 / r - 1) + }; + } + function arc$2$1() { + var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant$3(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context2 = null, path2 = withPath(arc2); + function arc2() { + var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi$2, a1 = endAngle.apply(this, arguments) - halfPi$2, da = abs$2(a1 - a0), cw2 = a1 > a0; + if (!context2) context2 = buffer = path2(); + if (r1 < r0) r = r1, r1 = r0, r0 = r; + if (!(r1 > epsilon$5)) context2.moveTo(0, 0); + else if (da > tau$3 - epsilon$5) { + context2.moveTo(r1 * cos$2(a0), r1 * sin$2(a0)); + context2.arc(0, 0, r1, a0, a1, !cw2); + if (r0 > epsilon$5) { + context2.moveTo(r0 * cos$2(a1), r0 * sin$2(a1)); + context2.arc(0, 0, r0, a1, a0, cw2); + } + } else { + var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon$5 && (padRadius ? +padRadius.apply(this, arguments) : sqrt$3(r0 * r0 + r1 * r1)), rc = min$2(abs$2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t02, t12; + if (rp > epsilon$5) { + var p02 = asin$2(rp / r0 * sin$2(ap)), p1 = asin$2(rp / r1 * sin$2(ap)); + if ((da0 -= p02 * 2) > epsilon$5) p02 *= cw2 ? 1 : -1, a00 += p02, a10 -= p02; + else da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon$5) p1 *= cw2 ? 1 : -1, a01 += p1, a11 -= p1; + else da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + var x01 = r1 * cos$2(a01), y01 = r1 * sin$2(a01), x10 = r0 * cos$2(a10), y10 = r0 * sin$2(a10); + if (rc > epsilon$5) { + var x11 = r1 * cos$2(a11), y11 = r1 * sin$2(a11), x002 = r0 * cos$2(a00), y002 = r0 * sin$2(a00), oc; + if (da < pi$3) { + if (oc = intersect$3(x01, y01, x002, y002, x11, y11, x10, y10)) { + var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$3(ax * ax + ay * ay) * sqrt$3(bx * bx + by * by))) / 2), lc = sqrt$3(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = min$2(rc, (r0 - lc) / (kc - 1)); + rc1 = min$2(rc, (r1 - lc) / (kc + 1)); + } else { + rc0 = rc1 = 0; + } + } + } + if (!(da1 > epsilon$5)) context2.moveTo(x01, y01); + else if (rc1 > epsilon$5) { + t02 = cornerTangents(x002, y002, x01, y01, r1, rc1, cw2); + t12 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw2); + context2.moveTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc1 < rc) context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc1, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r1, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), !cw2); + context2.arc(t12.cx, t12.cy, rc1, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.moveTo(x01, y01), context2.arc(0, 0, r1, a01, a11, !cw2); + if (!(r0 > epsilon$5) || !(da0 > epsilon$5)) context2.lineTo(x10, y10); + else if (rc0 > epsilon$5) { + t02 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw2); + t12 = cornerTangents(x01, y01, x002, y002, r0, -rc0, cw2); + context2.lineTo(t02.cx + t02.x01, t02.cy + t02.y01); + if (rc0 < rc) context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t12.y01, t12.x01), !cw2); + else { + context2.arc(t02.cx, t02.cy, rc0, atan2$1(t02.y01, t02.x01), atan2$1(t02.y11, t02.x11), !cw2); + context2.arc(0, 0, r0, atan2$1(t02.cy + t02.y11, t02.cx + t02.x11), atan2$1(t12.cy + t12.y11, t12.cx + t12.x11), cw2); + context2.arc(t12.cx, t12.cy, rc0, atan2$1(t12.y11, t12.x11), atan2$1(t12.y01, t12.x01), !cw2); + } + } else context2.arc(0, 0, r0, a10, a00, cw2); + } + context2.closePath(); + if (buffer) return context2 = null, buffer + "" || null; } -} -// wrap an event listener for the SVG DOM -const listener = (context, handler)=>(evt)=>{ - let item = evt.target.__data__; - item = Array.isArray(item) ? item[0] : item; - evt.vegaType = evt.type; - handler.call(context._obj, evt, item); - }; -const ARIA_HIDDEN = 'aria-hidden'; -const ARIA_LABEL = 'aria-label'; -const ARIA_ROLE = 'role'; -const ARIA_ROLEDESCRIPTION = 'aria-roledescription'; -const GRAPHICS_OBJECT = 'graphics-object'; -const GRAPHICS_SYMBOL = 'graphics-symbol'; -const bundle = (role, roledesc, label)=>({ - [ARIA_ROLE]: role, - [ARIA_ROLEDESCRIPTION]: roledesc, - [ARIA_LABEL]: label || undefined - }); -// these roles are covered by related roles -// we can ignore them, no need to generate attributes -const AriaIgnore = (0, _vegaUtil.toSet)([ - 'axis-domain', - 'axis-grid', - 'axis-label', - 'axis-tick', - 'axis-title', - 'legend-band', - 'legend-entry', - 'legend-gradient', - 'legend-label', - 'legend-title', - 'legend-symbol', - 'title' -]); -// aria attribute generators for guide roles -const AriaGuides = { - 'axis': { - desc: 'axis', - caption: axisCaption + arc2.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$3 / 2; + return [cos$2(a2) * r, sin$2(a2) * r]; + }; + arc2.innerRadius = function(_) { + return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$3(+_), arc2) : innerRadius; + }; + arc2.outerRadius = function(_) { + return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$3(+_), arc2) : outerRadius; + }; + arc2.cornerRadius = function(_) { + return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$3(+_), arc2) : cornerRadius; + }; + arc2.padRadius = function(_) { + return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), arc2) : padRadius; + }; + arc2.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$3(+_), arc2) : startAngle; + }; + arc2.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$3(+_), arc2) : endAngle; + }; + arc2.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$3(+_), arc2) : padAngle; + }; + arc2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, arc2) : context2; + }; + return arc2; + } + function array$4(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function Linear$1(context2) { + this._context = context2; + } + Linear$1.prototype = { + areaStart: function() { + this._line = 0; }, - 'legend': { - desc: 'legend', - caption: legendCaption + areaEnd: function() { + this._line = NaN; }, - 'title-text': { - desc: 'title', - caption: (item)=>`Title text '${titleCaption(item)}'` + lineStart: function() { + this._point = 0; }, - 'title-subtitle': { - desc: 'subtitle', - caption: (item)=>`Subtitle text '${titleCaption(item)}'` - } -}; -// aria properties generated for mark item encoding channels -const AriaEncode = { - ariaRole: ARIA_ROLE, - ariaRoleDescription: ARIA_ROLEDESCRIPTION, - description: ARIA_LABEL -}; -function ariaItemAttributes(emit, item) { - const hide = item.aria === false; - emit(ARIA_HIDDEN, hide || undefined); - if (hide || item.description == null) for(const prop in AriaEncode)emit(AriaEncode[prop], undefined); - else { - const type = item.mark.marktype; - emit(ARIA_LABEL, item.description); - emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); - emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`); - } -} -function ariaMarkAttributes(mark) { - return mark.aria === false ? { - [ARIA_HIDDEN]: true - } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); -} -function ariaMark(mark) { - const type = mark.marktype; - const recurse = type === 'group' || type === 'text' || mark.items.some((_)=>_.description != null && _.aria !== false); - return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description); -} -function ariaGuide(mark, opt) { - try { - const item = mark.items[0], caption = opt.caption || (()=>''); - return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); - } catch (err) { - return null; - } -} -function titleCaption(item) { - return (0, _vegaUtil.array)(item.text).join(' '); -} -function axisCaption(item) { - const datum = item.datum, orient = item.orient, title = datum.title ? extractTitle(item) : null, ctx = item.context, scale = ctx.scales[datum.scale].value, locale = ctx.dataflow.locale(), type = scale.type, xy = orient === 'left' || orient === 'right' ? 'Y' : 'X'; - return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${(0, _vegaScale.isDiscrete)(type) ? 'discrete' : type} scale` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function legendCaption(item) { - const datum = item.datum, title = datum.title ? extractTitle(item) : null, type = `${datum.type || ''} legend`.trim(), scales = datum.scales, props = Object.keys(scales), ctx = item.context, scale = ctx.scales[scales[props[0]]].value, locale = ctx.dataflow.locale(); - return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${(0, _vegaScale.domainCaption)(locale, scale, item)}`; -} -function extractTitle(item) { - try { - return (0, _vegaUtil.array)((0, _vegaUtil.peek)(item.items).items[0].text).join(' '); - } catch (err) { - return null; - } -} -function channelCaption(props) { - props = props.map((p)=>p + (p === 'fill' || p === 'stroke' ? ' color' : '')); - return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + (0, _vegaUtil.peek)(props); -} -function capitalize(s) { - return s.length ? s[0].toUpperCase() + s.slice(1) : s; -} -const innerText = (val)=>(val + '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); -const attrText = (val)=>innerText(val).replace(/"/g, '"').replace(/\t/g, ' ').replace(/\n/g, ' ').replace(/\r/g, ' '); -function markup() { - let buf = '', outer = '', inner = ''; - const stack = [], clear = ()=>outer = inner = '', push = (tag)=>{ - if (outer) { - buf += `${outer}>${inner}`; - clear(); - } - stack.push(tag); - }, attr = (name, value)=>{ - if (value != null) outer += ` ${name}="${attrText(value)}"`; - return m; - }, m = { - open (tag) { - push(tag); - outer = '<' + tag; - for(var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)attrs[_key - 1] = arguments[_key]; - for (const set of attrs)for(const key in set)attr(key, set[key]); - return m; - }, - close () { - const tag = stack.pop(); - if (outer) buf += outer + (inner ? `>${inner}</${tag}>` : '/>'); - else buf += `</${tag}>`; - clear(); - return m; - }, - attr, - text: (t)=>(inner += innerText(t), m), - toString: ()=>buf - }; - return m; -} -const serializeXML = (node)=>_serialize(markup(), node) + ''; -function _serialize(m, node) { - m.open(node.tagName); - if (node.hasAttributes()) { - const attrs = node.attributes, n = attrs.length; - for(let i = 0; i < n; ++i)m.attr(attrs[i].name, attrs[i].value); - } - if (node.hasChildNodes()) { - const children = node.childNodes; - for (const child of children)child.nodeType === 3 // text node - ? m.text(child.nodeValue) : _serialize(m, child); - } - return m.close(); -} -const stylesAttr = { - fill: 'fill', - fillOpacity: 'fill-opacity', - stroke: 'stroke', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - strokeCap: 'stroke-linecap', - strokeJoin: 'stroke-linejoin', - strokeDash: 'stroke-dasharray', - strokeDashOffset: 'stroke-dashoffset', - strokeMiterLimit: 'stroke-miterlimit', - opacity: 'opacity' -}; -const stylesCss = { - blend: 'mix-blend-mode' -}; -// ensure miter limit default is consistent with canvas (#2498) -const rootAttributes = { - 'fill': 'none', - 'stroke-miterlimit': 10 -}; -const RootIndex = 0, xmlns = 'http://www.w3.org/2000/xmlns/', svgns = metadata.xmlns; -class SVGRenderer extends Renderer { - constructor(loader){ - super(loader); - this._dirtyID = 0; - this._dirty = []; - this._svg = null; - this._root = null; - this._defs = null; - } - /** - * Initialize a new SVGRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - // create the svg definitions cache - this._defs = {}; - this._clearDefs(); - if (el) { - this._svg = domChild(el, 0, 'svg', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns', svgns); - this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']); - this._svg.setAttribute('version', metadata['version']); - this._svg.setAttribute('class', 'marks'); - domClear(el, 1); - // set the svg root group - this._root = domChild(this._svg, RootIndex, 'g', svgns); - setAttributes(this._root, rootAttributes); - // ensure no additional child elements - domClear(this._svg, RootIndex + 1); - } - // set background color if defined - this.background(this._bgcolor); - return super.initialize(el, width, height, origin, scaleFactor); + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: + this._context.lineTo(x2, y2); + break; + } } - /** - * Get / set the background color. - */ background(bgcolor) { - if (arguments.length && this._svg) this._svg.style.setProperty('background-color', bgcolor); - return super.background(...arguments); + }; + function curveLinear(context2) { + return new Linear$1(context2); + } + function x$3(p) { + return p[0]; + } + function y$3(p) { + return p[1]; + } + function line$2$1(x2, y2) { + var defined = constant$3(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(line2); + x2 = typeof x2 === "function" ? x2 : x2 === void 0 ? x$3 : constant$3(x2); + y2 = typeof y2 === "function" ? y2 : y2 === void 0 ? y$3 : constant$3(y2); + function line2(data2) { + var i, n = (data2 = array$4(data2)).length, d, defined0 = false, buffer; + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) output2.lineStart(); + else output2.lineEnd(); + } + if (defined0) output2.point(+x2(d, i, data2), +y2(d, i, data2)); + } + if (buffer) return output2 = null, buffer + "" || null; } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - if (this._svg) { - setAttributes(this._svg, { - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - }); - this._root.setAttribute('transform', `translate(${this._origin})`); + line2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$3(+_), line2) : x2; + }; + line2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$3(+_), line2) : y2; + }; + line2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$3(!!_), line2) : defined; + }; + line2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), line2) : curve2; + }; + line2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), line2) : context2; + }; + return line2; + } + function area$2$1(x02, y02, y12) { + var x12 = null, defined = constant$3(true), context2 = null, curve2 = curveLinear, output2 = null, path2 = withPath(area2); + x02 = typeof x02 === "function" ? x02 : x02 === void 0 ? x$3 : constant$3(+x02); + y02 = typeof y02 === "function" ? y02 : y02 === void 0 ? constant$3(0) : constant$3(+y02); + y12 = typeof y12 === "function" ? y12 : y12 === void 0 ? y$3 : constant$3(+y12); + function area2(data2) { + var i, j, k, n = (data2 = array$4(data2)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); + if (context2 == null) output2 = curve2(buffer = path2()); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) { + j = i; + output2.areaStart(); + output2.lineStart(); + } else { + output2.lineEnd(); + output2.lineStart(); + for (k = i - 1; k >= j; --k) { + output2.point(x0z[k], y0z[k]); + } + output2.lineEnd(); + output2.areaEnd(); + } + } + if (defined0) { + x0z[i] = +x02(d, i, data2), y0z[i] = +y02(d, i, data2); + output2.point(x12 ? +x12(d, i, data2) : x0z[i], y12 ? +y12(d, i, data2) : y0z[i]); } - this._dirty = []; - return this; + } + if (buffer) return output2 = null, buffer + "" || null; } - /** - * Returns the SVG element of the visualization. - * @return {DOMElement} - The SVG element. - */ canvas() { - return this._svg; + function arealine() { + return line$2$1().defined(defined).curve(curve2).context(context2); } - /** - * Returns an SVG text string for the rendered content, - * or null if this renderer is currently headless. - */ svg() { - const svg = this._svg, bg = this._bgcolor; - if (!svg) return null; - let node; - if (bg) { - svg.removeAttribute('style'); - node = domChild(svg, RootIndex, 'rect', svgns); - setAttributes(node, { - width: this._width, - height: this._height, - fill: bg - }); - } - const text = serializeXML(svg); - if (bg) { - svg.removeChild(node); - this._svg.style.setProperty('background-color', bg); - } - return text; + area2.x = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$3(+_), x12 = null, area2) : x02; + }; + area2.x0 = function(_) { + return arguments.length ? (x02 = typeof _ === "function" ? _ : constant$3(+_), area2) : x02; + }; + area2.x1 = function(_) { + return arguments.length ? (x12 = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), area2) : x12; + }; + area2.y = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$3(+_), y12 = null, area2) : y02; + }; + area2.y0 = function(_) { + return arguments.length ? (y02 = typeof _ === "function" ? _ : constant$3(+_), area2) : y02; + }; + area2.y1 = function(_) { + return arguments.length ? (y12 = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), area2) : y12; + }; + area2.lineX0 = area2.lineY0 = function() { + return arealine().x(x02).y(y02); + }; + area2.lineY1 = function() { + return arealine().x(x02).y(y12); + }; + area2.lineX1 = function() { + return arealine().x(x12).y(y02); + }; + area2.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$3(!!_), area2) : defined; + }; + area2.curve = function(_) { + return arguments.length ? (curve2 = _, context2 != null && (output2 = curve2(context2)), area2) : curve2; + }; + area2.context = function(_) { + return arguments.length ? (_ == null ? context2 = output2 = null : output2 = curve2(context2 = _), area2) : context2; + }; + return area2; + } + const circle = { + draw(context2, size) { + const r = sqrt$3(size / pi$3); + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, tau$3); } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - // perform spot updates and re-render markup - if (this._dirtyCheck()) { - if (this._dirtyAll) this._clearDefs(); - this.mark(this._root, scene, undefined, markTypes); - domClear(this._root, 1); - } - this.defs(); - this._dirty = []; - ++this._dirtyID; - return this; + }; + function Symbol$1(type2, size) { + let context2 = null, path2 = withPath(symbol2); + type2 = typeof type2 === "function" ? type2 : constant$3(type2 || circle); + size = typeof size === "function" ? size : constant$3(size === void 0 ? 64 : +size); + function symbol2() { + let buffer; + if (!context2) context2 = buffer = path2(); + type2.apply(this, arguments).draw(context2, +size.apply(this, arguments)); + if (buffer) return context2 = null, buffer + "" || null; + } + symbol2.type = function(_) { + return arguments.length ? (type2 = typeof _ === "function" ? _ : constant$3(_), symbol2) : type2; + }; + symbol2.size = function(_) { + return arguments.length ? (size = typeof _ === "function" ? _ : constant$3(+_), symbol2) : size; + }; + symbol2.context = function(_) { + return arguments.length ? (context2 = _ == null ? null : _, symbol2) : context2; + }; + return symbol2; + } + function noop$3() { + } + function point$5(that, x2, y2) { + that._context.bezierCurveTo( + (2 * that._x0 + that._x1) / 3, + (2 * that._y0 + that._y1) / 3, + (that._x0 + 2 * that._x1) / 3, + (that._y0 + 2 * that._y1) / 3, + (that._x0 + 4 * that._x1 + x2) / 6, + (that._y0 + 4 * that._y1 + y2) / 6 + ); + } + function Basis(context2) { + this._context = context2; + } + Basis.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 3: + point$5(this, this._x1, this._y1); + // falls through + case 2: + this._context.lineTo(this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; } - // -- Manage rendering of items marked as dirty -- - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (item.dirty !== this._dirtyID) { - item.dirty = this._dirtyID; - this._dirty.push(item); + }; + function curveBasis(context2) { + return new Basis(context2); + } + function BasisClosed(context2) { + this._context = context2; + } + BasisClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x2, this._y2); + this._context.closePath(); + break; + } + case 2: { + this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); + this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x2, this._y2); + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + break; } + } + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x2 = x2, this._y2 = y2; + break; + case 1: + this._point = 2; + this._x3 = x2, this._y3 = y2; + break; + case 2: + this._point = 3; + this._x4 = x2, this._y4 = y2; + this._context.moveTo((this._x0 + 4 * this._x1 + x2) / 6, (this._y0 + 4 * this._y1 + y2) / 6); + break; + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; } - /** - * Check if a mark item is considered dirty. - * @param {Item} item - The mark item. - */ isDirty(item) { - return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; + }; + function curveBasisClosed(context2) { + return new BasisClosed(context2); + } + function BasisOpen(context2) { + this._context = context2; + } + BasisOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._y0 = this._y1 = NaN; + this._point = 0; + }, + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + var x02 = (this._x0 + 4 * this._x1 + x2) / 6, y02 = (this._y0 + 4 * this._y1 + y2) / 6; + this._line ? this._context.lineTo(x02, y02) : this._context.moveTo(x02, y02); + break; + case 3: + this._point = 4; + // falls through + default: + point$5(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; } - /** - * Internal method to check dirty status and, if possible, - * make targetted updates without a full rendering pass. - */ _dirtyCheck() { - this._dirtyAll = true; - const items = this._dirty; - if (!items.length || !this._dirtyID) return true; - const id = ++this._dirtyID; - let item, mark, type, mdef, i, n, o; - for(i = 0, n = items.length; i < n; ++i){ - item = items[i]; - mark = item.mark; - if (mark.marktype !== type) { - // memoize mark instance lookup - type = mark.marktype; - mdef = Marks[type]; - } - if (mark.zdirty && mark.dirty !== id) { - this._dirtyAll = false; - dirtyParents(item, id); - mark.items.forEach((i)=>{ - i.dirty = id; - }); - } - if (mark.zdirty) continue; // handle in standard drawing pass - if (item.exit) { - // EXIT - if (mdef.nested && mark.items.length) { - // if nested mark with remaining points, update instead - o = mark.items[0]; - if (o._svg) this._update(mdef, o._svg, o); - } else if (item._svg) { - // otherwise remove from DOM - o = item._svg.parentNode; - if (o) o.removeChild(item._svg); - } - item._svg = null; - continue; - } - item = mdef.nested ? mark.items[0] : item; - if (item._update === id) continue; // already visited - if (!item._svg || !item._svg.ownerSVGElement) { - // ENTER - this._dirtyAll = false; - dirtyParents(item, id); - } else // IN-PLACE UPDATE - this._update(mdef, item._svg, item); - item._update = id; - } - return !this._dirtyAll; + }; + function curveBasisOpen(context2) { + return new BasisOpen(context2); + } + function Bundle(context2, beta) { + this._basis = new Basis(context2); + this._beta = beta; + } + Bundle.prototype = { + lineStart: function() { + this._x = []; + this._y = []; + this._basis.lineStart(); + }, + lineEnd: function() { + var x2 = this._x, y2 = this._y, j = x2.length - 1; + if (j > 0) { + var x02 = x2[0], y02 = y2[0], dx = x2[j] - x02, dy = y2[j] - y02, i = -1, t; + while (++i <= j) { + t = i / j; + this._basis.point( + this._beta * x2[i] + (1 - this._beta) * (x02 + t * dx), + this._beta * y2[i] + (1 - this._beta) * (y02 + t * dy) + ); + } + } + this._x = this._y = null; + this._basis.lineEnd(); + }, + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); } - // -- Construct & maintain scenegraph to SVG mapping --- - /** - * Render a set of mark items. - * @param {SVGElement} el - The parent element in the SVG tree. - * @param {object} scene - The mark parent to render. - * @param {SVGElement} prev - The previous sibling in the SVG tree. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ mark(el, scene, prev, markTypes) { - if (!this.isDirty(scene)) return scene._svg; - const svg = this._svg, markType = scene.marktype, mdef = Marks[markType], events = scene.interactive === false ? 'none' : null, isGroup = mdef.tag === 'g'; - const parent = bind(scene, el, prev, 'g', svg); - if (markType !== 'group' && markTypes != null && !markTypes.includes(markType)) { - domClear(parent, 0); - return scene._svg; - } - parent.setAttribute('class', cssClass(scene)); - // apply aria attributes to parent container element - const aria = ariaMarkAttributes(scene); - for(const key in aria)setAttribute(parent, key, aria[key]); - if (!isGroup) setAttribute(parent, 'pointer-events', events); - setAttribute(parent, 'clip-path', scene.clip ? clip$1(this, scene, scene.group) : null); - let sibling = null, i = 0; - const process = (item)=>{ - const dirty = this.isDirty(item), node = bind(item, parent, sibling, mdef.tag, svg); - if (dirty) { - this._update(mdef, node, item); - if (isGroup) recurse(this, node, item, markTypes); - } - sibling = node; - ++i; - }; - if (mdef.nested) { - if (scene.items.length) process(scene.items[0]); - } else visit(scene, process); - domClear(parent, i); - return parent; + }; + const curveBundle = (function custom2(beta) { + function bundle2(context2) { + return beta === 1 ? new Basis(context2) : new Bundle(context2, beta); + } + bundle2.beta = function(beta2) { + return custom2(+beta2); + }; + return bundle2; + })(0.85); + function point$4(that, x2, y2) { + that._context.bezierCurveTo( + that._x1 + that._k * (that._x2 - that._x0), + that._y1 + that._k * (that._y2 - that._y0), + that._x2 + that._k * (that._x1 - x2), + that._y2 + that._k * (that._y1 - y2), + that._x2, + that._y2 + ); + } + function Cardinal(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + Cardinal.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + point$4(this, this._x1, this._y1); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + this._x1 = x2, this._y1 = y2; + break; + case 2: + this._point = 3; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - /** - * Update the attributes of an SVG element for a mark item. - * @param {object} mdef - The mark definition object - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ _update(mdef, el, item) { - // set dom element and values cache - // provides access to emit method - element = el; - values = el.__values__; - // apply aria-specific properties - ariaItemAttributes(emit, item); - // apply svg attributes - mdef.attr(emit, item, this); - // some marks need special treatment - const extra = mark_extras[mdef.type]; - if (extra) extra.call(this, mdef, el, item); - // apply svg style attributes - // note: element state may have been modified by 'extra' method - if (element) this.style(element, item); + }; + const curveCardinal = (function custom2(tension) { + function cardinal(context2) { + return new Cardinal(context2, tension); } - /** - * Update the presentation attributes of an SVG element for a mark item. - * @param {SVGElement} el - The SVG element. - * @param {Item} item - The mark item. - */ style(el, item) { - if (item == null) return; - for(const prop in stylesAttr){ - let value = prop === 'font' ? fontFamily(item) : item[prop]; - if (value === values[prop]) continue; - const name = stylesAttr[prop]; - if (value == null) el.removeAttribute(name); - else { - if (isGradient(value)) value = gradientRef(value, this._defs.gradient, href()); - el.setAttribute(name, value + ''); - } - values[prop] = value; + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function CardinalClosed(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + CardinalClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; } - for(const prop in stylesCss)setStyle(el, stylesCss[prop], item[prop]); - } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - */ defs() { - const svg = this._svg, defs = this._defs; - let el = defs.el, index = 0; - for(const id in defs.gradient){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateGradient(el, defs.gradient[id], index); - } - for(const id in defs.clipping){ - if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns); - index = updateClipping(el, defs.clipping[id], index); - } - // clean-up - if (el) index === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index); + } + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - /** - * Clear defs caches. - */ _clearDefs() { - const def = this._defs; - def.gradient = {}; - def.clipping = {}; - } -} -// mark ancestor chain with a dirty id -function dirtyParents(item, id) { - for(; item && item.dirty !== id; item = item.mark.group){ - item.dirty = id; - if (item.mark && item.mark.dirty !== id) item.mark.dirty = id; - else return; - } -} -// update gradient definitions -function updateGradient(el, grad, index) { - let i, n, stop; - if (grad.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - let pt = domChild(el, index++, 'pattern', svgns); - setAttributes(pt, { - id: patternPrefix + grad.id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - pt = domChild(pt, 0, 'rect', svgns); - setAttributes(pt, { - width: 1, - height: 1, - fill: `url(${href()}#${grad.id})` - }); - el = domChild(el, index++, 'radialGradient', svgns); - setAttributes(el, { - id: grad.id, - fx: grad.x1, - fy: grad.y1, - fr: grad.r1, - cx: grad.x2, - cy: grad.y2, - r: grad.r2 - }); - } else { - el = domChild(el, index++, 'linearGradient', svgns); - setAttributes(el, { - id: grad.id, - x1: grad.x1, - x2: grad.x2, - y1: grad.y1, - y2: grad.y2 - }); + }; + const curveCardinalClosed = (function custom2(tension) { + function cardinal(context2) { + return new CardinalClosed(context2, tension); } - for(i = 0, n = grad.stops.length; i < n; ++i){ - stop = domChild(el, i, 'stop', svgns); - stop.setAttribute('offset', grad.stops[i].offset); - stop.setAttribute('stop-color', grad.stops[i].color); + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function CardinalOpen(context2, tension) { + this._context = context2; + this._k = (1 - tension) / 6; + } + CardinalOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, + lineEnd: function() { + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$4(this, x2, y2); + break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - domClear(el, i); - return index; -} -// update clipping path definitions -function updateClipping(el, clip, index) { - let mask; - el = domChild(el, index, 'clipPath', svgns); - el.setAttribute('id', clip.id); - if (clip.path) { - mask = domChild(el, 0, 'path', svgns); - mask.setAttribute('d', clip.path); - } else { - mask = domChild(el, 0, 'rect', svgns); - setAttributes(mask, { - x: 0, - y: 0, - width: clip.width, - height: clip.height - }); + }; + const curveCardinalOpen = (function custom2(tension) { + function cardinal(context2) { + return new CardinalOpen(context2, tension); } - domClear(el, 1); - return index + 1; -} -// Recursively process group contents. -function recurse(renderer, el, group, markTypes) { - // child 'g' element is second to last among children (path, g, path) - // other children here are foreground and background path elements - el = el.lastChild.previousSibling; - let prev, idx = 0; - visit(group, (item)=>{ - prev = renderer.mark(el, item, prev, markTypes); - ++idx; - }); - // remove any extraneous DOM elements - domClear(el, 1 + idx); -} -// Bind a scenegraph item to an SVG DOM element. -// Create new SVG elements as needed. -function bind(item, el, sibling, tag, svg) { - let node = item._svg, doc; - // create a new dom node if needed - if (!node) { - doc = el.ownerDocument; - node = domCreate(doc, tag, svgns); - item._svg = node; - if (item.mark) { - node.__data__ = item; - node.__values__ = { - fill: 'default' - }; - // if group, create background, content, and foreground elements - if (tag === 'g') { - const bg = domCreate(doc, 'path', svgns); - node.appendChild(bg); - bg.__data__ = item; - const cg = domCreate(doc, 'g', svgns); - node.appendChild(cg); - cg.__data__ = item; - const fg = domCreate(doc, 'path', svgns); - node.appendChild(fg); - fg.__data__ = item; - fg.__values__ = { - fill: 'default' - }; - } - } - } - // (re-)insert if (a) not contained in SVG or (b) sibling order has changed - if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); - return node; -} -// check if two nodes are ordered siblings -function siblingCheck(node, sibling) { - return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same -} -// -- Set attributes & styles on SVG elements --- -let element = null, // temp var for current SVG element -values = null; // temp var for current values hash -// Extra configuration for certain mark types -const mark_extras = { - group (mdef, el, item) { - const fg = element = el.childNodes[2]; - values = fg.__values__; - mdef.foreground(emit, item, this); - values = el.__values__; // use parent's values hash - element = el.childNodes[1]; - mdef.content(emit, item, this); - const bg = element = el.childNodes[0]; - mdef.background(emit, item, this); - const value = item.mark.interactive === false ? 'none' : null; - if (value !== values.events) { - setAttribute(fg, 'pointer-events', value); - setAttribute(bg, 'pointer-events', value); - values.events = value; - } - if (item.strokeForeground && item.stroke) { - const fill = item.fill; - setAttribute(fg, 'display', null); - // set style of background - this.style(bg, item); - setAttribute(bg, 'stroke', null); - // set style of foreground - if (fill) item.fill = null; - values = fg.__values__; - this.style(fg, item); - if (fill) item.fill = fill; - // leave element null to prevent downstream styling - element = null; - } else // ensure foreground is ignored - setAttribute(fg, 'display', 'none'); + cardinal.tension = function(tension2) { + return custom2(+tension2); + }; + return cardinal; + })(0); + function point$3(that, x2, y2) { + var x12 = that._x1, y12 = that._y1, x22 = that._x2, y22 = that._y2; + if (that._l01_a > epsilon$5) { + var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); + x12 = (x12 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; + y12 = (y12 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; + } + if (that._l23_a > epsilon$5) { + var b2 = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m2 = 3 * that._l23_a * (that._l23_a + that._l12_a); + x22 = (x22 * b2 + that._x1 * that._l23_2a - x2 * that._l12_2a) / m2; + y22 = (y22 * b2 + that._y1 * that._l23_2a - y2 * that._l12_2a) / m2; + } + that._context.bezierCurveTo(x12, y12, x22, y22, that._x2, that._y2); + } + function CatmullRom(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRom.prototype = { + areaStart: function() { + this._line = 0; }, - image (mdef, el, item) { - if (item.smooth === false) { - setStyle(el, 'image-rendering', 'optimizeSpeed'); - setStyle(el, 'image-rendering', 'pixelated'); - } else setStyle(el, 'image-rendering', null); + areaEnd: function() { + this._line = NaN; }, - text (mdef, el, item) { - const tl = textLines(item); - let key, value, doc, lh; - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - value = tl.map((_)=>textValue(item, _)); - key = value.join('\n'); // content cache key - if (key !== values.text) { - domClear(el, 0); - doc = el.ownerDocument; - lh = lineHeight(item); - value.forEach((t, i)=>{ - const ts = domCreate(doc, 'tspan', svgns); - ts.__data__ = item; // data binding - ts.textContent = t; - if (i) { - ts.setAttribute('x', 0); - ts.setAttribute('dy', lh); - } - el.appendChild(ts); - }); - values.text = key; - } - } else { - // single-line text - value = textValue(item, tl); - if (value !== values.text) { - el.textContent = value; - values.text = value; - } - } - setAttribute(el, 'font-family', fontFamily(item)); - setAttribute(el, 'font-size', fontSize(item) + 'px'); - setAttribute(el, 'font-style', item.fontStyle); - setAttribute(el, 'font-variant', item.fontVariant); - setAttribute(el, 'font-weight', item.fontWeight); - } -}; -function emit(name, value, ns) { - // early exit if value is unchanged - if (value === values[name]) return; - // use appropriate method given namespace (ns) - if (ns) setAttributeNS(element, name, value, ns); - else setAttribute(element, name, value); - // note current value for future comparison - values[name] = value; -} -function setStyle(el, name, value) { - if (value !== values[name]) { - if (value == null) el.style.removeProperty(name); - else el.style.setProperty(name, value + ''); - values[name] = value; - } -} -function setAttributes(el, attrs) { - for(const key in attrs)setAttribute(el, key, attrs[key]); -} -function setAttribute(el, name, value) { - if (value != null) // if value is provided, update DOM attribute - el.setAttribute(name, value); - else // else remove DOM attribute - el.removeAttribute(name); -} -function setAttributeNS(el, name, value, ns) { - if (value != null) // if value is provided, update DOM attribute - el.setAttributeNS(ns, name, value); - else // else remove DOM attribute - el.removeAttributeNS(ns, name); -} -function href() { - let loc; - return typeof window === 'undefined' ? '' : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; -} -class SVGStringRenderer extends Renderer { - constructor(loader){ - super(loader); - this._text = null; - this._defs = { - gradient: {}, - clipping: {} - }; - } - /** - * Returns the rendered SVG text string, - * or null if rendering has not yet occurred. - */ svg() { - return this._text; - } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - */ _render(scene) { - const m = markup(); - // svg tag - m.open('svg', (0, _vegaUtil.extend)({}, metadata, { - class: 'marks', - width: this._width * this._scale, - height: this._height * this._scale, - viewBox: `0 0 ${this._width} ${this._height}` - })); - // background, if defined - const bg = this._bgcolor; - if (bg && bg !== 'transparent' && bg !== 'none') m.open('rect', { - width: this._width, - height: this._height, - fill: bg - }).close(); - // root content group - m.open('g', rootAttributes, { - transform: 'translate(' + this._origin + ')' - }); - this.mark(m, scene); - m.close(); // </g> - // defs - this.defs(m); - // get SVG text string - this._text = m.close() + ''; - return this; - } - /** - * Render a set of mark items. - * @param {object} m - The markup context. - * @param {object} scene - The mark parent to render. - */ mark(m, scene) { - const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ - ariaItemAttributes, - mdef.attr - ]; - // render opening group tag - m.open('g', { - 'class': cssClass(scene), - 'clip-path': scene.clip ? clip$1(this, scene, scene.group) : null - }, ariaMarkAttributes(scene), { - 'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null - }); - // render contained elements - const process = (item)=>{ - const href = this.href(item); - if (href) m.open('a', href); - m.open(tag, this.attr(scene, item, attrList, tag !== 'g' ? tag : null)); - if (tag === 'text') { - const tl = textLines(item); - if ((0, _vegaUtil.isArray)(tl)) { - // multi-line text - const attrs = { - x: 0, - dy: lineHeight(item) - }; - for(let i = 0; i < tl.length; ++i)m.open('tspan', i ? attrs : null).text(textValue(item, tl[i])).close(); - } else // single-line text - m.text(textValue(item, tl)); - } else if (tag === 'g') { - const fore = item.strokeForeground, fill = item.fill, stroke = item.stroke; - if (fore && stroke) item.stroke = null; - m.open('path', this.attr(scene, item, mdef.background, 'bgrect')).close(); - // recurse for group content - m.open('g', this.attr(scene, item, mdef.content)); - visit(item, (scene)=>this.mark(m, scene)); - m.close(); - if (fore && stroke) { - if (fill) item.fill = null; - item.stroke = stroke; - m.open('path', this.attr(scene, item, mdef.foreground, 'bgrect')).close(); - if (fill) item.fill = fill; - } else m.open('path', this.attr(scene, item, mdef.foreground, 'bgfore')).close(); - } - m.close(); // </tag> - if (href) m.close(); // </a> - }; - if (mdef.nested) { - if (scene.items && scene.items.length) process(scene.items[0]); - } else visit(scene, process); - // render closing group tag - return m.close(); // </g> - } - /** - * Get href attributes for a hyperlinked mark item. - * @param {Item} item - The mark item. - */ href(item) { - const href = item.href; - let attr; - if (href) { - if (attr = this._hrefs && this._hrefs[href]) return attr; - else this.sanitizeURL(href).then((attr)=>{ - // rewrite to use xlink namespace - attr['xlink:href'] = attr.href; - attr.href = null; - (this._hrefs || (this._hrefs = {}))[href] = attr; - }); - } - return null; - } - /** - * Get an object of SVG attributes for a mark item. - * @param {object} scene - The mark parent. - * @param {Item} item - The mark item. - * @param {array|function} attrs - One or more attribute emitters. - * @param {string} tag - The tag being rendered. - */ attr(scene, item, attrs, tag) { - const object = {}, emit = (name, value, ns, prefixed)=>{ - object[prefixed || name] = value; - }; - // apply mark specific attributes - if (Array.isArray(attrs)) attrs.forEach((fn)=>fn(emit, item, this)); - else attrs(emit, item, this); - // apply style attributes - if (tag) style(object, item, scene, tag, this._defs); - return object; - } - /** - * Render SVG defs, as needed. - * Must be called *after* marks have been processed to ensure the - * collected state is current and accurate. - * @param {object} m - The markup context. - */ defs(m) { - const gradient = this._defs.gradient, clipping = this._defs.clipping, count = Object.keys(gradient).length + Object.keys(clipping).length; - if (count === 0) return; // nothing to do - m.open('defs'); - for(const id in gradient){ - const def = gradient[id], stops = def.stops; - if (def.gradient === 'radial') { - // SVG radial gradients automatically transform to normalized bbox - // coordinates, in a way that is cumbersome to replicate in canvas. - // We wrap the radial gradient in a pattern element, allowing us to - // maintain a circular gradient that matches what canvas provides. - m.open('pattern', { - id: patternPrefix + id, - viewBox: '0,0,1,1', - width: '100%', - height: '100%', - preserveAspectRatio: 'xMidYMid slice' - }); - m.open('rect', { - width: '1', - height: '1', - fill: 'url(#' + id + ')' - }).close(); - m.close(); // </pattern> - m.open('radialGradient', { - id: id, - fx: def.x1, - fy: def.y1, - fr: def.r1, - cx: def.x2, - cy: def.y2, - r: def.r2 - }); - } else m.open('linearGradient', { - id: id, - x1: def.x1, - x2: def.x2, - y1: def.y1, - y2: def.y2 - }); - for(let i = 0; i < stops.length; ++i)m.open('stop', { - offset: stops[i].offset, - 'stop-color': stops[i].color - }).close(); - m.close(); - } - for(const id in clipping){ - const def = clipping[id]; - m.open('clipPath', { - id: id - }); - if (def.path) m.open('path', { - d: def.path - }).close(); - else m.open('rect', { - x: 0, - y: 0, - width: def.width, - height: def.height - }).close(); - m.close(); - } - m.close(); - } -} -// Helper function for attr for style presentation attributes -function style(s, item, scene, tag, defs) { - let styleList; - if (item == null) return s; - if (tag === 'bgrect' && scene.interactive === false) s['pointer-events'] = 'none'; - if (tag === 'bgfore') { - if (scene.interactive === false) s['pointer-events'] = 'none'; - s.display = 'none'; - if (item.fill !== null) return s; - } - if (tag === 'image' && item.smooth === false) styleList = [ - 'image-rendering: optimizeSpeed;', - 'image-rendering: pixelated;' - ]; - if (tag === 'text') { - s['font-family'] = fontFamily(item); - s['font-size'] = fontSize(item) + 'px'; - s['font-style'] = item.fontStyle; - s['font-variant'] = item.fontVariant; - s['font-weight'] = item.fontWeight; - } - for(const prop in stylesAttr){ - let value = item[prop]; - const name = stylesAttr[prop]; - if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ; - else if (value != null) { - if (isGradient(value)) value = gradientRef(value, defs.gradient, ''); - s[name] = value; - } - } - for(const prop in stylesCss){ - const value = item[prop]; - if (value != null) { - styleList = styleList || []; - styleList.push(`${stylesCss[prop]}: ${value};`); - } - } - if (styleList) s.style = styleList.join(' '); - return s; -} -/** - * @typedef {Object} HybridRendererOptions - * - * @property {string[]} [svgMarkTypes=['text']] - An array of SVG mark types to render - * in the SVG layer. All other mark types - * will be rendered in the Canvas layer. - * @property {boolean} [svgOnTop=true] - Flag to determine if SVG should be rendered on top. - * @property {boolean} [debug=false] - Flag to enable or disable debugging mode. When true, - * the top layer will be stacked below the bottom layer - * rather than overlaid on top. - */ /** @type {HybridRendererOptions} */ const OPTS = { - svgMarkTypes: [ - 'text' - ], - svgOnTop: true, - debug: false -}; -/** - * Configure the HybridRenderer - * - * @param {HybridRendererOptions} options - HybridRenderer configuration options. - */ function setHybridRendererOptions(options) { - OPTS['svgMarkTypes'] = options.svgMarkTypes ?? [ - 'text' - ]; - OPTS['svgOnTop'] = options.svgOnTop ?? true; - OPTS['debug'] = options.debug ?? false; -} -class HybridRenderer extends Renderer { - constructor(loader){ - super(loader); - this._svgRenderer = new SVGRenderer(loader); - this._canvasRenderer = new CanvasRenderer(loader); - } - /** - * Initialize a new HybridRenderer instance. - * @param {DOMElement} el - The containing DOM element for the display. - * @param {number} width - The coordinate width of the display, in pixels. - * @param {number} height - The coordinate height of the display, in pixels. - * @param {Array<number>} origin - The origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {HybridRenderer} - This renderer instance. - */ initialize(el, width, height, origin, scaleFactor) { - this._root_el = domChild(el, 0, 'div'); - const bottomEl = domChild(this._root_el, 0, 'div'); - const topEl = domChild(this._root_el, 1, 'div'); - this._root_el.style.position = 'relative'; - // Set position absolute to overlay svg on top of canvas - if (!OPTS.debug) { - bottomEl.style.height = '100%'; - topEl.style.position = 'absolute'; - topEl.style.top = '0'; - topEl.style.left = '0'; - topEl.style.height = '100%'; - topEl.style.width = '100%'; - } - this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; - this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; - // pointer-events to none on SVG layer so that canvas gets all events - this._svgEl.style.pointerEvents = 'none'; - this._canvasRenderer.initialize(this._canvasEl, width, height, origin, scaleFactor); - this._svgRenderer.initialize(this._svgEl, width, height, origin, scaleFactor); - return super.initialize(el, width, height, origin, scaleFactor); - } - /** - * Flag a mark item as dirty. - * @param {Item} item - The mark item. - */ dirty(item) { - if (OPTS.svgMarkTypes.includes(item.mark.marktype)) this._svgRenderer.dirty(item); - else this._canvasRenderer.dirty(item); - return this; - } - /** - * Internal rendering method. - * @param {object} scene - The root mark of a scenegraph to render. - * @param {Array} markTypes - Array of the mark types to render. - * If undefined, render all mark types - */ _render(scene, markTypes) { - const allMarkTypes = markTypes ?? [ - 'arc', - 'area', - 'image', - 'line', - 'path', - 'rect', - 'rule', - 'shape', - 'symbol', - 'text', - 'trail' - ]; - const canvasMarkTypes = allMarkTypes.filter((m)=>!OPTS.svgMarkTypes.includes(m)); - this._svgRenderer.render(scene, OPTS.svgMarkTypes); - this._canvasRenderer.render(scene, canvasMarkTypes); - } - /** - * Resize the display. - * @param {number} width - The new coordinate width of the display, in pixels. - * @param {number} height - The new coordinate height of the display, in pixels. - * @param {Array<number>} origin - The new origin of the display, in pixels. - * The coordinate system will be translated to this point. - * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply - * the width and height to determine the final pixel size. - * @return {SVGRenderer} - This renderer instance; - */ resize(width, height, origin, scaleFactor) { - super.resize(width, height, origin, scaleFactor); - this._svgRenderer.resize(width, height, origin, scaleFactor); - this._canvasRenderer.resize(width, height, origin, scaleFactor); - return this; - } - background(bgcolor) { - // Propagate background color to lower canvas renderer - if (OPTS.svgOnTop) this._canvasRenderer.background(bgcolor); - else this._svgRenderer.background(bgcolor); - return this; - } -} -class HybridHandler extends CanvasHandler { - constructor(loader, tooltip){ - super(loader, tooltip); - } - initialize(el, origin, obj) { - const canvas = domChild(domChild(el, 0, 'div'), OPTS.svgOnTop ? 0 : 1, 'div'); - return super.initialize(canvas, origin, obj); - } -} -const Canvas = 'canvas'; -const Hybrid = 'hybrid'; -const PNG = 'png'; -const SVG = 'svg'; -const None = 'none'; -const RenderType = { - Canvas: Canvas, - PNG: PNG, - SVG: SVG, - Hybrid: Hybrid, - None: None -}; -const modules = {}; -modules[Canvas] = modules[PNG] = { - renderer: CanvasRenderer, - headless: CanvasRenderer, - handler: CanvasHandler -}; -modules[SVG] = { - renderer: SVGRenderer, - headless: SVGStringRenderer, - handler: SVGHandler -}; -modules[Hybrid] = { - renderer: HybridRenderer, - headless: HybridRenderer, - handler: HybridHandler -}; -modules[None] = {}; -function renderModule(name, _) { - name = String(name || '').toLowerCase(); - if (arguments.length > 1) { - modules[name] = _; - return this; - } else return modules[name]; -} -function intersect(scene, bounds, filter) { - const hits = [], // intersection results - box = new Bounds().union(bounds), // defensive copy - type = scene.marktype; - return type ? intersectMark(scene, box, filter, hits) : type === 'group' ? intersectGroup(scene, box, filter, hits) : (0, _vegaUtil.error)('Intersect scene must be mark node or group item.'); -} -function intersectMark(mark, box, filter, hits) { - if (visitMark(mark, box, filter)) { - const items = mark.items, type = mark.marktype, n = items.length; - let i = 0; - if (type === 'group') for(; i < n; ++i)intersectGroup(items[i], box, filter, hits); - else for(const test = Marks[type].isect; i < n; ++i){ - const item = items[i]; - if (intersectItem(item, box, test)) hits.push(item); - } - } - return hits; -} -function visitMark(mark, box, filter) { - // process if bounds intersect and if - // (1) mark is a group mark (so we must recurse), or - // (2) mark is interactive and passes filter - return mark.bounds && box.intersects(mark.bounds) && (mark.marktype === 'group' || mark.interactive !== false && (!filter || filter(mark))); -} -function intersectGroup(group, box, filter, hits) { - // test intersect against group - // skip groups by default unless filter says otherwise - if (filter && filter(group.mark) && intersectItem(group, box, Marks.group.isect)) hits.push(group); - // recursively test children marks - // translate box to group coordinate space - const marks = group.items, n = marks && marks.length; - if (n) { - const x = group.x || 0, y = group.y || 0; - box.translate(-x, -y); - for(let i = 0; i < n; ++i)intersectMark(marks[i], box, filter, hits); - box.translate(x, y); - } - return hits; -} -function intersectItem(item, box, test) { - // test bounds enclosure, bounds intersection, then detailed test - const bounds = item.bounds; - return box.encloses(bounds) || box.intersects(bounds) && test(item, box); -} -const clipBounds = new Bounds(); -function boundClip(mark) { - const clip = mark.clip; - if ((0, _vegaUtil.isFunction)(clip)) clip(boundContext(clipBounds.clear())); - else if (clip) clipBounds.set(0, 0, mark.group.width, mark.group.height); - else return; - mark.bounds.intersect(clipBounds); -} -const TOLERANCE = 1e-9; -function sceneEqual(a, b, key) { - return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : (0, _vegaUtil.isNumber)(a) && (0, _vegaUtil.isNumber)(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !(0, _vegaUtil.isObject)(a) && !(0, _vegaUtil.isObject)(b) ? a == b : objectEqual(a, b); -} -function pathEqual(a, b) { - return sceneEqual(parse(a), parse(b)); -} -function objectEqual(a, b) { - var ka = Object.keys(a), kb = Object.keys(b), key, i; - if (ka.length !== kb.length) return false; - ka.sort(); - kb.sort(); - for(i = ka.length - 1; i >= 0; i--){ - if (ka[i] != kb[i]) return false; + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: + this._context.lineTo(this._x2, this._y2); + break; + case 3: + this.point(this._x2, this._y2); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + // falls through + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - for(i = ka.length - 1; i >= 0; i--){ - key = ka[i]; - if (!sceneEqual(a[key], b[key], key)) return false; + }; + const curveCatmullRom = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRom(context2, alpha) : new Cardinal(context2, 0); } - return typeof a === typeof b; -} -function resetSVGDefIds() { - resetSVGClipId(); - resetSVGGradientId(); -} - -},{"vega-util":"bApja","d3-shape":"8QPYO","d3-path":"cRa94","vega-canvas":"kPWfS","vega-loader":"gmbOr","vega-scale":"bEydG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8QPYO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "arc", ()=>(0, _arcJsDefault.default)); -parcelHelpers.export(exports, "area", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "line", ()=>(0, _lineJsDefault.default)); -parcelHelpers.export(exports, "pie", ()=>(0, _pieJsDefault.default)); -parcelHelpers.export(exports, "areaRadial", ()=>(0, _areaRadialJsDefault.default)) // Note: radialArea is deprecated! -; -parcelHelpers.export(exports, "radialArea", ()=>(0, _areaRadialJsDefault.default)); -parcelHelpers.export(exports, "lineRadial", ()=>(0, _lineRadialJsDefault.default)) // Note: radialLine is deprecated! -; -parcelHelpers.export(exports, "radialLine", ()=>(0, _lineRadialJsDefault.default)); -parcelHelpers.export(exports, "pointRadial", ()=>(0, _pointRadialJsDefault.default)); -parcelHelpers.export(exports, "link", ()=>(0, _linkJs.link)); -parcelHelpers.export(exports, "linkHorizontal", ()=>(0, _linkJs.linkHorizontal)); -parcelHelpers.export(exports, "linkVertical", ()=>(0, _linkJs.linkVertical)); -parcelHelpers.export(exports, "linkRadial", ()=>(0, _linkJs.linkRadial)); -parcelHelpers.export(exports, "symbol", ()=>(0, _symbolJsDefault.default)); -parcelHelpers.export(exports, "symbolsStroke", ()=>(0, _symbolJs.symbolsStroke)); -parcelHelpers.export(exports, "symbolsFill", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbols", ()=>(0, _symbolJs.symbolsFill)); -parcelHelpers.export(exports, "symbolAsterisk", ()=>(0, _asteriskJsDefault.default)); -parcelHelpers.export(exports, "symbolCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "symbolCross", ()=>(0, _crossJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond", ()=>(0, _diamondJsDefault.default)); -parcelHelpers.export(exports, "symbolDiamond2", ()=>(0, _diamond2JsDefault.default)); -parcelHelpers.export(exports, "symbolPlus", ()=>(0, _plusJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare", ()=>(0, _squareJsDefault.default)); -parcelHelpers.export(exports, "symbolSquare2", ()=>(0, _square2JsDefault.default)); -parcelHelpers.export(exports, "symbolStar", ()=>(0, _starJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle", ()=>(0, _triangleJsDefault.default)); -parcelHelpers.export(exports, "symbolTriangle2", ()=>(0, _triangle2JsDefault.default)); -parcelHelpers.export(exports, "symbolWye", ()=>(0, _wyeJsDefault.default)); -parcelHelpers.export(exports, "symbolTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "symbolX", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "curveBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "curveBasisOpen", ()=>(0, _basisOpenJsDefault.default)); -parcelHelpers.export(exports, "curveBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "curveBumpX", ()=>(0, _bumpJs.bumpX)); -parcelHelpers.export(exports, "curveBumpY", ()=>(0, _bumpJs.bumpY)); -parcelHelpers.export(exports, "curveBundle", ()=>(0, _bundleJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalClosed", ()=>(0, _cardinalClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCardinalOpen", ()=>(0, _cardinalOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCardinal", ()=>(0, _cardinalJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomClosed", ()=>(0, _catmullRomClosedJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRomOpen", ()=>(0, _catmullRomOpenJsDefault.default)); -parcelHelpers.export(exports, "curveCatmullRom", ()=>(0, _catmullRomJsDefault.default)); -parcelHelpers.export(exports, "curveLinearClosed", ()=>(0, _linearClosedJsDefault.default)); -parcelHelpers.export(exports, "curveLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "curveMonotoneX", ()=>(0, _monotoneJs.monotoneX)); -parcelHelpers.export(exports, "curveMonotoneY", ()=>(0, _monotoneJs.monotoneY)); -parcelHelpers.export(exports, "curveNatural", ()=>(0, _naturalJsDefault.default)); -parcelHelpers.export(exports, "curveStep", ()=>(0, _stepJsDefault.default)); -parcelHelpers.export(exports, "curveStepAfter", ()=>(0, _stepJs.stepAfter)); -parcelHelpers.export(exports, "curveStepBefore", ()=>(0, _stepJs.stepBefore)); -parcelHelpers.export(exports, "stack", ()=>(0, _stackJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetExpand", ()=>(0, _expandJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetNone", ()=>(0, _noneJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetSilhouette", ()=>(0, _silhouetteJsDefault.default)); -parcelHelpers.export(exports, "stackOffsetWiggle", ()=>(0, _wiggleJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAppearance", ()=>(0, _appearanceJsDefault.default)); -parcelHelpers.export(exports, "stackOrderAscending", ()=>(0, _ascendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderDescending", ()=>(0, _descendingJsDefault.default)); -parcelHelpers.export(exports, "stackOrderInsideOut", ()=>(0, _insideOutJsDefault.default)); -parcelHelpers.export(exports, "stackOrderNone", ()=>(0, _noneJsDefault1.default)); -parcelHelpers.export(exports, "stackOrderReverse", ()=>(0, _reverseJsDefault.default)); -var _arcJs = require("./arc.js"); -var _arcJsDefault = parcelHelpers.interopDefault(_arcJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pieJs = require("./pie.js"); -var _pieJsDefault = parcelHelpers.interopDefault(_pieJs); -var _areaRadialJs = require("./areaRadial.js"); -var _areaRadialJsDefault = parcelHelpers.interopDefault(_areaRadialJs); -var _lineRadialJs = require("./lineRadial.js"); -var _lineRadialJsDefault = parcelHelpers.interopDefault(_lineRadialJs); -var _pointRadialJs = require("./pointRadial.js"); -var _pointRadialJsDefault = parcelHelpers.interopDefault(_pointRadialJs); -var _linkJs = require("./link.js"); -var _symbolJs = require("./symbol.js"); -var _symbolJsDefault = parcelHelpers.interopDefault(_symbolJs); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _basisClosedJs = require("./curve/basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _basisOpenJs = require("./curve/basisOpen.js"); -var _basisOpenJsDefault = parcelHelpers.interopDefault(_basisOpenJs); -var _basisJs = require("./curve/basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _bumpJs = require("./curve/bump.js"); -var _bundleJs = require("./curve/bundle.js"); -var _bundleJsDefault = parcelHelpers.interopDefault(_bundleJs); -var _cardinalClosedJs = require("./curve/cardinalClosed.js"); -var _cardinalClosedJsDefault = parcelHelpers.interopDefault(_cardinalClosedJs); -var _cardinalOpenJs = require("./curve/cardinalOpen.js"); -var _cardinalOpenJsDefault = parcelHelpers.interopDefault(_cardinalOpenJs); -var _cardinalJs = require("./curve/cardinal.js"); -var _cardinalJsDefault = parcelHelpers.interopDefault(_cardinalJs); -var _catmullRomClosedJs = require("./curve/catmullRomClosed.js"); -var _catmullRomClosedJsDefault = parcelHelpers.interopDefault(_catmullRomClosedJs); -var _catmullRomOpenJs = require("./curve/catmullRomOpen.js"); -var _catmullRomOpenJsDefault = parcelHelpers.interopDefault(_catmullRomOpenJs); -var _catmullRomJs = require("./curve/catmullRom.js"); -var _catmullRomJsDefault = parcelHelpers.interopDefault(_catmullRomJs); -var _linearClosedJs = require("./curve/linearClosed.js"); -var _linearClosedJsDefault = parcelHelpers.interopDefault(_linearClosedJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _monotoneJs = require("./curve/monotone.js"); -var _naturalJs = require("./curve/natural.js"); -var _naturalJsDefault = parcelHelpers.interopDefault(_naturalJs); -var _stepJs = require("./curve/step.js"); -var _stepJsDefault = parcelHelpers.interopDefault(_stepJs); -var _stackJs = require("./stack.js"); -var _stackJsDefault = parcelHelpers.interopDefault(_stackJs); -var _expandJs = require("./offset/expand.js"); -var _expandJsDefault = parcelHelpers.interopDefault(_expandJs); -var _divergingJs = require("./offset/diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _noneJs = require("./offset/none.js"); -var _noneJsDefault = parcelHelpers.interopDefault(_noneJs); -var _silhouetteJs = require("./offset/silhouette.js"); -var _silhouetteJsDefault = parcelHelpers.interopDefault(_silhouetteJs); -var _wiggleJs = require("./offset/wiggle.js"); -var _wiggleJsDefault = parcelHelpers.interopDefault(_wiggleJs); -var _appearanceJs = require("./order/appearance.js"); -var _appearanceJsDefault = parcelHelpers.interopDefault(_appearanceJs); -var _ascendingJs = require("./order/ascending.js"); -var _ascendingJsDefault = parcelHelpers.interopDefault(_ascendingJs); -var _descendingJs = require("./order/descending.js"); -var _descendingJsDefault = parcelHelpers.interopDefault(_descendingJs); -var _insideOutJs = require("./order/insideOut.js"); -var _insideOutJsDefault = parcelHelpers.interopDefault(_insideOutJs); -var _noneJs1 = require("./order/none.js"); -var _noneJsDefault1 = parcelHelpers.interopDefault(_noneJs1); -var _reverseJs = require("./order/reverse.js"); -var _reverseJsDefault = parcelHelpers.interopDefault(_reverseJs); - -},{"./arc.js":"c3ptb","./area.js":"lblzF","./line.js":"jVTJi","./pie.js":false,"./areaRadial.js":false,"./lineRadial.js":false,"./pointRadial.js":false,"./link.js":false,"./symbol.js":"bcejp","./symbol/asterisk.js":false,"./symbol/circle.js":false,"./symbol/cross.js":false,"./symbol/diamond.js":false,"./symbol/diamond2.js":false,"./symbol/plus.js":false,"./symbol/square.js":false,"./symbol/square2.js":false,"./symbol/star.js":false,"./symbol/triangle.js":false,"./symbol/triangle2.js":false,"./symbol/wye.js":false,"./symbol/times.js":false,"./curve/basisClosed.js":"3uf9r","./curve/basisOpen.js":"4LPKP","./curve/basis.js":"gNfFM","./curve/bump.js":false,"./curve/bundle.js":"7Gw48","./curve/cardinalClosed.js":"e0Ty2","./curve/cardinalOpen.js":"4cTvH","./curve/cardinal.js":"i0afA","./curve/catmullRomClosed.js":"kfNnJ","./curve/catmullRomOpen.js":"amodp","./curve/catmullRom.js":"8d6GP","./curve/linearClosed.js":"gpcM0","./curve/linear.js":"huz8f","./curve/monotone.js":"kghkb","./curve/natural.js":"4f94Q","./curve/step.js":"l5kmS","./stack.js":false,"./offset/expand.js":false,"./offset/diverging.js":false,"./offset/none.js":false,"./offset/silhouette.js":false,"./offset/wiggle.js":false,"./order/appearance.js":false,"./order/ascending.js":false,"./order/descending.js":false,"./order/insideOut.js":false,"./order/none.js":false,"./order/reverse.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c3ptb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = (0, _constantJsDefault.default)(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = (0, _pathJs.withPath)(arc); - function arc() { - var buffer, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - (0, _mathJs.halfPi), a1 = endAngle.apply(this, arguments) - (0, _mathJs.halfPi), da = (0, _mathJs.abs)(a1 - a0), cw = a1 > a0; - if (!context) context = buffer = path(); - // Ensure that the outer radius is always larger than the inner radius. - if (r1 < r0) r = r1, r1 = r0, r0 = r; - // Is it a point? - if (!(r1 > (0, _mathJs.epsilon))) context.moveTo(0, 0); - else if (da > (0, _mathJs.tau) - (0, _mathJs.epsilon)) { - context.moveTo(r1 * (0, _mathJs.cos)(a0), r1 * (0, _mathJs.sin)(a0)); - context.arc(0, 0, r1, a0, a1, !cw); - if (r0 > (0, _mathJs.epsilon)) { - context.moveTo(r0 * (0, _mathJs.cos)(a1), r0 * (0, _mathJs.sin)(a1)); - context.arc(0, 0, r0, a1, a0, cw); - } - } else { - var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > (0, _mathJs.epsilon) && (padRadius ? +padRadius.apply(this, arguments) : (0, _mathJs.sqrt)(r0 * r0 + r1 * r1)), rc = (0, _mathJs.min)((0, _mathJs.abs)(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1; - // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. - if (rp > (0, _mathJs.epsilon)) { - var p0 = (0, _mathJs.asin)(rp / r0 * (0, _mathJs.sin)(ap)), p1 = (0, _mathJs.asin)(rp / r1 * (0, _mathJs.sin)(ap)); - if ((da0 -= p0 * 2) > (0, _mathJs.epsilon)) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0; - else da0 = 0, a00 = a10 = (a0 + a1) / 2; - if ((da1 -= p1 * 2) > (0, _mathJs.epsilon)) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; - else da1 = 0, a01 = a11 = (a0 + a1) / 2; - } - var x01 = r1 * (0, _mathJs.cos)(a01), y01 = r1 * (0, _mathJs.sin)(a01), x10 = r0 * (0, _mathJs.cos)(a10), y10 = r0 * (0, _mathJs.sin)(a10); - // Apply rounded corners? - if (rc > (0, _mathJs.epsilon)) { - var x11 = r1 * (0, _mathJs.cos)(a11), y11 = r1 * (0, _mathJs.sin)(a11), x00 = r0 * (0, _mathJs.cos)(a00), y00 = r0 * (0, _mathJs.sin)(a00), oc; - // Restrict the corner radius according to the sector angle. If this - // intersection fails, it’s probably because the arc is too small, so - // disable the corner radius entirely. - if (da < (0, _mathJs.pi)) { - if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) { - var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / (0, _mathJs.sin)((0, _mathJs.acos)((ax * bx + ay * by) / ((0, _mathJs.sqrt)(ax * ax + ay * ay) * (0, _mathJs.sqrt)(bx * bx + by * by))) / 2), lc = (0, _mathJs.sqrt)(oc[0] * oc[0] + oc[1] * oc[1]); - rc0 = (0, _mathJs.min)(rc, (r0 - lc) / (kc - 1)); - rc1 = (0, _mathJs.min)(rc, (r1 - lc) / (kc + 1)); - } else rc0 = rc1 = 0; - } - } - // Is the sector collapsed to a line? - if (!(da1 > (0, _mathJs.epsilon))) context.moveTo(x01, y01); - else if (rc1 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); - t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); - context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc1, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r1, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), !cw); - context.arc(t1.cx, t1.cy, rc1, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); - // Is there no inner ring, and it’s a circular sector? - // Or perhaps it’s an annular sector collapsed due to padding? - if (!(r0 > (0, _mathJs.epsilon)) || !(da0 > (0, _mathJs.epsilon))) context.lineTo(x10, y10); - else if (rc0 > (0, _mathJs.epsilon)) { - t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); - t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); - context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); - // Have the corners merged? - if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - else { - context.arc(t0.cx, t0.cy, rc0, (0, _mathJs.atan2)(t0.y01, t0.x01), (0, _mathJs.atan2)(t0.y11, t0.x11), !cw); - context.arc(0, 0, r0, (0, _mathJs.atan2)(t0.cy + t0.y11, t0.cx + t0.x11), (0, _mathJs.atan2)(t1.cy + t1.y11, t1.cx + t1.x11), cw); - context.arc(t1.cx, t1.cy, rc0, (0, _mathJs.atan2)(t1.y11, t1.x11), (0, _mathJs.atan2)(t1.y01, t1.x01), !cw); - } - } else context.arc(0, 0, r0, a10, a00, cw); - } - context.closePath(); - if (buffer) return context = null, buffer + "" || null; - } - arc.centroid = function() { - var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - (0, _mathJs.pi) / 2; - return [ - (0, _mathJs.cos)(a) * r, - (0, _mathJs.sin)(a) * r - ]; - }; - arc.innerRadius = function(_) { - return arguments.length ? (innerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : innerRadius; - }; - arc.outerRadius = function(_) { - return arguments.length ? (outerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : outerRadius; - }; - arc.cornerRadius = function(_) { - return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : cornerRadius; - }; - arc.padRadius = function(_) { - return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padRadius; - }; - arc.startAngle = function(_) { - return arguments.length ? (startAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : startAngle; - }; - arc.endAngle = function(_) { - return arguments.length ? (endAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : endAngle; - }; - arc.padAngle = function(_) { - return arguments.length ? (padAngle = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), arc) : padAngle; - }; - arc.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, arc) : context; - }; - return arc; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _pathJs = require("./path.js"); -function arcInnerRadius(d) { - return d.innerRadius; -} -function arcOuterRadius(d) { - return d.outerRadius; -} -function arcStartAngle(d) { - return d.startAngle; -} -function arcEndAngle(d) { - return d.endAngle; -} -function arcPadAngle(d) { - return d && d.padAngle; // Note: optional! -} -function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { - var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; - if (t * t < (0, _mathJs.epsilon)) return; - t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t; - return [ - x0 + t * x10, - y0 + t * y10 - ]; -} -// Compute perpendicular offset line of length rc. -// http://mathworld.wolfram.com/Circle-LineIntersection.html -function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { - var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / (0, _mathJs.sqrt)(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * (0, _mathJs.sqrt)((0, _mathJs.max)(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00; - // Pick the closer of the two intersection points. - // TODO Is there a faster way to determine which intersection to use? - if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; - return { - cx: cx0, - cy: cy0, - x01: -ox, - y01: -oy, - x11: cx0 * (r1 / r - 1), - y11: cy0 * (r1 / r - 1) - }; -} - -},{"./constant.js":"12DQf","./math.js":"OHDSf","./path.js":"iSEDK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"12DQf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function constant() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"OHDSf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -const abs = Math.abs; -const atan2 = Math.atan2; -const cos = Math.cos; -const max = Math.max; -const min = Math.min; -const sin = Math.sin; -const sqrt = Math.sqrt; -const epsilon = 1e-12; -const pi = Math.PI; -const halfPi = pi / 2; -const tau = 2 * pi; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iSEDK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "withPath", ()=>withPath); -var _d3Path = require("d3-path"); -function withPath(shape) { - let digits = 3; - shape.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - return shape; - }; - return ()=>new (0, _d3Path.Path)(digits); -} - -},{"d3-path":"cRa94","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cRa94":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>(0, _pathJs.Path)); -parcelHelpers.export(exports, "path", ()=>(0, _pathJs.path)); -parcelHelpers.export(exports, "pathRound", ()=>(0, _pathJs.pathRound)); -var _pathJs = require("./path.js"); - -},{"./path.js":"6vvkL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6vvkL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Path", ()=>Path); -parcelHelpers.export(exports, "path", ()=>path); -parcelHelpers.export(exports, "pathRound", ()=>pathRound); -const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon; -function append(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - let d = Math.floor(digits); - if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`); - if (d > 15) return append; - const k = 10 ** d; - return function(strings) { - this._ += strings[0]; - for(let i = 1, n = strings.length; i < n; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); }; -} -class Path { - constructor(digits){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - this._append = digits == null ? append : appendRound(digits); - } - moveTo(x, y) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; - } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._append`Z`; + return catmullRom; + })(0.5); + function CatmullRomClosed(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRomClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; } + } + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + this._x3 = x2, this._y3 = y2; + break; + case 1: + this._point = 2; + this._context.moveTo(this._x4 = x2, this._y4 = y2); + break; + case 2: + this._point = 3; + this._x5 = x2, this._y5 = y2; + break; + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } - lineTo(x, y) { - this._append`L${this._x1 = +x},${this._y1 = +y}`; - } - quadraticCurveTo(x1, y1, x, y) { - this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`; - } - bezierCurveTo(x1, y1, x2, y2, x, y) { - this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`; - } - arcTo(x1, y1, x2, y2, r) { - x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01; - // Is this path empty? Move to (x1,y1). - if (this._x1 === null) this._append`M${this._x1 = x1},${this._y1 = y1}`; - else if (!(l01_2 > epsilon)) ; - else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) this._append`L${this._x1 = x1},${this._y1 = y1}`; - else { - let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; - // If the start tangent is not coincident with (x0,y0), line to. - if (Math.abs(t01 - 1) > epsilon) this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`; - this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`; - } - } - arc(x, y, r, a0, a1, ccw) { - x = +x, y = +y, r = +r, ccw = !!ccw; - // Is the radius negative? Error. - if (r < 0) throw new Error(`negative radius: ${r}`); - let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; - // Is this path empty? Move to (x0,y0). - if (this._x1 === null) this._append`M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._append`L${x0},${y0}`; - // Is this arc empty? We’re done. - if (!r) return; - // Does the angle go the wrong way? Flip the direction. - if (da < 0) da = da % tau + tau; - // Is this a complete circle? Draw two arcs to complete the circle. - if (da > tauEpsilon) this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`; - else if (da > epsilon) this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`; - } - rect(x, y, w, h) { - this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`; + }; + const curveCatmullRomClosed = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomClosed(context2, alpha) : new CardinalClosed(context2, 0); } - toString() { - return this._; - } -} -function path() { - return new Path; -} -// Allow instanceof d3.path -path.prototype = Path.prototype; -function pathRound(digits = 3) { - return new Path(+digits); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lblzF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x0, y0, y1) { - var x1 = null, defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(area); - x0 = typeof x0 === "function" ? x0 : x0 === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(+x0); - y0 = typeof y0 === "function" ? y0 : y0 === undefined ? (0, _constantJsDefault.default)(0) : (0, _constantJsDefault.default)(+y0); - y1 = typeof y1 === "function" ? y1 : y1 === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(+y1); - function area(data) { - var i, j, k, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer, x0z = new Array(n), y0z = new Array(n); - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) { - j = i; - output.areaStart(); - output.lineStart(); - } else { - output.lineEnd(); - output.lineStart(); - for(k = i - 1; k >= j; --k)output.point(x0z[k], y0z[k]); - output.lineEnd(); - output.areaEnd(); - } - } - if (defined0) { - x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); - output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); - } - } - if (buffer) return output = null, buffer + "" || null; - } - function arealine() { - return (0, _lineJsDefault.default)().defined(defined).curve(curve).context(context); - } - area.x = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), x1 = null, area) : x0; - }; - area.x0 = function(_) { - return arguments.length ? (x0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x0; - }; - area.x1 = function(_) { - return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : x1; - }; - area.y = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), y1 = null, area) : y0; - }; - area.y0 = function(_) { - return arguments.length ? (y0 = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y0; - }; - area.y1 = function(_) { - return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), area) : y1; - }; - area.lineX0 = area.lineY0 = function() { - return arealine().x(x0).y(y0); - }; - area.lineY1 = function() { - return arealine().x(x0).y(y1); - }; - area.lineX1 = function() { - return arealine().x(x1).y(y0); - }; - area.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), area) : defined; - }; - area.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; - }; - area.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; - }; - return area; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"gwBAX","./constant.js":"12DQf","./curve/linear.js":"huz8f","./line.js":"jVTJi","./path.js":"iSEDK","./point.js":"1IQGj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gwBAX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -var slice = Array.prototype.slice; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"huz8f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Linear(context); - }); -function Linear(context) { - this._context = context; -} -Linear.prototype = { + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function CatmullRomOpen(context2, alpha) { + this._context = context2; + this._alpha = alpha; + } + CatmullRomOpen.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._point = 0; + this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - this._context.lineTo(x, y); - break; - } + if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) { + var x23 = this._x2 - x2, y23 = this._y2 - y2; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + switch (this._point) { + case 0: + this._point = 1; + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); + break; + case 3: + this._point = 4; + // falls through + default: + point$3(this, x2, y2); + break; + } + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jVTJi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var defined = (0, _constantJsDefault.default)(true), context = null, curve = (0, _linearJsDefault.default), output = null, path = (0, _pathJs.withPath)(line); - x = typeof x === "function" ? x : x === undefined ? (0, _pointJs.x) : (0, _constantJsDefault.default)(x); - y = typeof y === "function" ? y : y === undefined ? (0, _pointJs.y) : (0, _constantJsDefault.default)(y); - function line(data) { - var i, n = (data = (0, _arrayJsDefault.default)(data)).length, d, defined0 = false, buffer; - if (context == null) output = curve(buffer = path()); - for(i = 0; i <= n; ++i){ - if (!(i < n && defined(d = data[i], i, data)) === defined0) { - if (defined0 = !defined0) output.lineStart(); - else output.lineEnd(); - } - if (defined0) output.point(+x(d, i, data), +y(d, i, data)); - } - if (buffer) return output = null, buffer + "" || null; - } - line.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : x; - }; - line.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), line) : y; - }; - line.defined = function(_) { - return arguments.length ? (defined = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(!!_), line) : defined; - }; - line.curve = function(_) { - return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; - }; - line.context = function(_) { - return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; - }; - return line; - }); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _linearJs = require("./curve/linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _pathJs = require("./path.js"); -var _pointJs = require("./point.js"); - -},{"./array.js":"gwBAX","./constant.js":"12DQf","./curve/linear.js":"huz8f","./path.js":"iSEDK","./point.js":"1IQGj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1IQGj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -function x(p) { - return p[0]; -} -function y(p) { - return p[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bcejp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symbolsFill", ()=>symbolsFill); -parcelHelpers.export(exports, "symbolsStroke", ()=>symbolsStroke); -parcelHelpers.export(exports, "default", ()=>Symbol); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _pathJs = require("./path.js"); -var _asteriskJs = require("./symbol/asterisk.js"); -var _asteriskJsDefault = parcelHelpers.interopDefault(_asteriskJs); -var _circleJs = require("./symbol/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _crossJs = require("./symbol/cross.js"); -var _crossJsDefault = parcelHelpers.interopDefault(_crossJs); -var _diamondJs = require("./symbol/diamond.js"); -var _diamondJsDefault = parcelHelpers.interopDefault(_diamondJs); -var _diamond2Js = require("./symbol/diamond2.js"); -var _diamond2JsDefault = parcelHelpers.interopDefault(_diamond2Js); -var _plusJs = require("./symbol/plus.js"); -var _plusJsDefault = parcelHelpers.interopDefault(_plusJs); -var _squareJs = require("./symbol/square.js"); -var _squareJsDefault = parcelHelpers.interopDefault(_squareJs); -var _square2Js = require("./symbol/square2.js"); -var _square2JsDefault = parcelHelpers.interopDefault(_square2Js); -var _starJs = require("./symbol/star.js"); -var _starJsDefault = parcelHelpers.interopDefault(_starJs); -var _triangleJs = require("./symbol/triangle.js"); -var _triangleJsDefault = parcelHelpers.interopDefault(_triangleJs); -var _triangle2Js = require("./symbol/triangle2.js"); -var _triangle2JsDefault = parcelHelpers.interopDefault(_triangle2Js); -var _wyeJs = require("./symbol/wye.js"); -var _wyeJsDefault = parcelHelpers.interopDefault(_wyeJs); -var _timesJs = require("./symbol/times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -const symbolsFill = [ - (0, _circleJsDefault.default), - (0, _crossJsDefault.default), - (0, _diamondJsDefault.default), - (0, _squareJsDefault.default), - (0, _starJsDefault.default), - (0, _triangleJsDefault.default), - (0, _wyeJsDefault.default) -]; -const symbolsStroke = [ - (0, _circleJsDefault.default), - (0, _plusJsDefault.default), - (0, _timesJsDefault.default), - (0, _triangle2JsDefault.default), - (0, _asteriskJsDefault.default), - (0, _square2JsDefault.default), - (0, _diamond2JsDefault.default) -]; -function Symbol(type, size) { - let context = null, path = (0, _pathJs.withPath)(symbol); - type = typeof type === "function" ? type : (0, _constantJsDefault.default)(type || (0, _circleJsDefault.default)); - size = typeof size === "function" ? size : (0, _constantJsDefault.default)(size === undefined ? 64 : +size); - function symbol() { - let buffer; - if (!context) context = buffer = path(); - type.apply(this, arguments).draw(context, +size.apply(this, arguments)); - if (buffer) return context = null, buffer + "" || null; - } - symbol.type = function(_) { - return arguments.length ? (type = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(_), symbol) : type; - }; - symbol.size = function(_) { - return arguments.length ? (size = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), symbol) : size; - }; - symbol.context = function(_) { - return arguments.length ? (context = _ == null ? null : _, symbol) : context; - }; - return symbol; -} - -},{"./constant.js":"12DQf","./path.js":"iSEDK","./symbol/asterisk.js":"kHR3A","./symbol/circle.js":"7RXTA","./symbol/cross.js":"4cmA2","./symbol/diamond.js":"1gK3j","./symbol/diamond2.js":"WsFhi","./symbol/plus.js":"a9FVq","./symbol/square.js":"fXRAH","./symbol/square2.js":"69bxi","./symbol/star.js":"8nJiq","./symbol/triangle.js":"bClaq","./symbol/triangle2.js":"8s1uD","./symbol/wye.js":"2D9bg","./symbol/times.js":"h0Zst","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kHR3A":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size + (0, _mathJs.min)(size / 28, 0.75)) * 0.59436; - const t = r / 2; - const u = t * sqrt3; - context.moveTo(0, r); - context.lineTo(0, -r); - context.moveTo(-u, -t); - context.lineTo(u, t); - context.moveTo(-u, t); - context.lineTo(u, -t); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7RXTA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / (0, _mathJs.pi)); - context.moveTo(r, 0); - context.arc(0, 0, r, 0, (0, _mathJs.tau)); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4cmA2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / 5) / 2; - context.moveTo(-3 * r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, -3 * r); - context.lineTo(r, -3 * r); - context.lineTo(r, -r); - context.lineTo(3 * r, -r); - context.lineTo(3 * r, r); - context.lineTo(r, r); - context.lineTo(r, 3 * r); - context.lineTo(-r, 3 * r); - context.lineTo(-r, r); - context.lineTo(-3 * r, r); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1gK3j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const tan30 = (0, _mathJs.sqrt)(1 / 3); -const tan30_2 = tan30 * 2; -exports.default = { - draw (context, size) { - const y = (0, _mathJs.sqrt)(size / tan30_2); - const x = y * tan30; - context.moveTo(0, -y); - context.lineTo(x, 0); - context.lineTo(0, y); - context.lineTo(-x, 0); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"WsFhi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.62625; - context.moveTo(0, -r); - context.lineTo(r, 0); - context.lineTo(0, r); - context.lineTo(-r, 0); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a9FVq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 7, 2)) * 0.87559; - context.moveTo(-r, 0); - context.lineTo(r, 0); - context.moveTo(0, r); - context.lineTo(0, -r); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fXRAH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const w = (0, _mathJs.sqrt)(size); - const x = -w / 2; - context.rect(x, x, w, w); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"69bxi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size) * 0.4431; - context.moveTo(r, r); - context.lineTo(r, -r); - context.lineTo(-r, -r); - context.lineTo(-r, r); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8nJiq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const ka = 0.89081309152928522810; -const kr = (0, _mathJs.sin)((0, _mathJs.pi) / 10) / (0, _mathJs.sin)(7 * (0, _mathJs.pi) / 10); -const kx = (0, _mathJs.sin)((0, _mathJs.tau) / 10) * kr; -const ky = -(0, _mathJs.cos)((0, _mathJs.tau) / 10) * kr; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size * ka); - const x = kx * r; - const y = ky * r; - context.moveTo(0, -r); - context.lineTo(x, y); - for(let i = 1; i < 5; ++i){ - const a = (0, _mathJs.tau) * i / 5; - const c = (0, _mathJs.cos)(a); - const s = (0, _mathJs.sin)(a); - context.lineTo(s * r, -c * r); - context.lineTo(c * x - s * y, s * x + c * y); - } - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bClaq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const y = -(0, _mathJs.sqrt)(size / (sqrt3 * 3)); - context.moveTo(0, y * 2); - context.lineTo(-sqrt3 * y, -y); - context.lineTo(sqrt3 * y, -y); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8s1uD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const sqrt3 = (0, _mathJs.sqrt)(3); -exports.default = { - draw (context, size) { - const s = (0, _mathJs.sqrt)(size) * 0.6824; - const t = s / 2; - const u = s * sqrt3 / 2; // cos(Math.PI / 6) - context.moveTo(0, -s); - context.lineTo(u, t); - context.lineTo(-u, t); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2D9bg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -const c = -0.5; -const s = (0, _mathJs.sqrt)(3) / 2; -const k = 1 / (0, _mathJs.sqrt)(12); -const a = (k / 2 + 1) * 3; -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size / a); - const x0 = r / 2, y0 = r * k; - const x1 = x0, y1 = r * k + r; - const x2 = -x1, y2 = y1; - context.moveTo(x0, y0); - context.lineTo(x1, y1); - context.lineTo(x2, y2); - context.lineTo(c * x0 - s * y0, s * x0 + c * y0); - context.lineTo(c * x1 - s * y1, s * x1 + c * y1); - context.lineTo(c * x2 - s * y2, s * x2 + c * y2); - context.lineTo(c * x0 + s * y0, c * y0 - s * x0); - context.lineTo(c * x1 + s * y1, c * y1 - s * x1); - context.lineTo(c * x2 + s * y2, c * y2 - s * x2); - context.closePath(); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h0Zst":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -exports.default = { - draw (context, size) { - const r = (0, _mathJs.sqrt)(size - (0, _mathJs.min)(size / 6, 1.7)) * 0.6189; - context.moveTo(-r, -r); - context.lineTo(r, r); - context.moveTo(-r, r); - context.lineTo(r, -r); - } -}; - -},{"../math.js":"OHDSf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3uf9r":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _basisJs = require("./basis.js"); -function BasisClosed(context) { - this._context = context; -} -BasisClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), + }; + const curveCatmullRomOpen = (function custom2(alpha) { + function catmullRom(context2) { + return alpha ? new CatmullRomOpen(context2, alpha) : new CardinalOpen(context2, 0); + } + catmullRom.alpha = function(alpha2) { + return custom2(+alpha2); + }; + return catmullRom; + })(0.5); + function LinearClosed(context2) { + this._context = context2; + } + LinearClosed.prototype = { + areaStart: noop$3, + areaEnd: noop$3, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; - this._point = 0; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x2, this._y2); - this._context.closePath(); - break; - case 2: - this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); - this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); - this._context.closePath(); - break; - case 3: - this.point(this._x2, this._y2); - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - break; - } + if (this._point) this._context.closePath(); }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x2 = x, this._y2 = y; - break; - case 1: - this._point = 2; - this._x3 = x, this._y3 = y; - break; - case 2: - this._point = 3; - this._x4 = x, this._y4 = y; - this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); - break; - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"../noop.js":"9n7oj","./basis.js":"gNfFM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9n7oj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() {}); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gNfFM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Basis", ()=>Basis); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Basis(context); - }); -function point(that, x, y) { - that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6); -} -function Basis(context) { - this._context = context; -} -Basis.prototype = { + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + if (this._point) this._context.lineTo(x2, y2); + else this._point = 1, this._context.moveTo(x2, y2); + } + }; + function curveLinearClosed(context2) { + return new LinearClosed(context2); + } + function sign$1(x2) { + return x2 < 0 ? -1 : 1; + } + function slope3(that, x2, y2) { + var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); + return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; + } + function slope2(that, t) { + var h2 = that._x1 - that._x0; + return h2 ? (3 * (that._y1 - that._y0) / h2 - t) / 2 : t; + } + function point$2(that, t02, t12) { + var x02 = that._x0, y02 = that._y0, x12 = that._x1, y12 = that._y1, dx = (x12 - x02) / 3; + that._context.bezierCurveTo(x02 + dx, y02 + dx * t02, x12 - dx, y12 - dx * t12, x12, y12); + } + function MonotoneX(context2) { + this._context = context2; + } + MonotoneX.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; + this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; + this._point = 0; }, lineEnd: function() { - switch(this._point){ - case 3: - point(this, this._x1, this._y1); // falls through - case 2: - this._context.lineTo(this._x1, this._y1); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // falls through - default: - point(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; + switch (this._point) { + case 2: + this._context.lineTo(this._x1, this._y1); + break; + case 3: + point$2(this, this._t0, slope2(this, this._t0)); + break; + } + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x2, y2) { + var t12 = NaN; + x2 = +x2, y2 = +y2; + if (x2 === this._x1 && y2 === this._y1) return; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + break; + case 2: + this._point = 3; + point$2(this, slope2(this, t12 = slope3(this, x2, y2)), t12); + break; + default: + point$2(this, this._t0, t12 = slope3(this, x2, y2)); + break; + } + this._x0 = this._x1, this._x1 = x2; + this._y0 = this._y1, this._y1 = y2; + this._t0 = t12; } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4LPKP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new BasisOpen(context); - }); -var _basisJs = require("./basis.js"); -function BasisOpen(context) { - this._context = context; -} -BasisOpen.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = NaN; - this._point = 0; - }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; - this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); - break; - case 3: - this._point = 4; // falls through - default: - (0, _basisJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - } -}; - -},{"./basis.js":"gNfFM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Gw48":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _basisJs = require("./basis.js"); -function Bundle(context, beta) { - this._basis = new (0, _basisJs.Basis)(context); - this._beta = beta; -} -Bundle.prototype = { - lineStart: function() { - this._x = []; - this._y = []; - this._basis.lineStart(); - }, - lineEnd: function() { - var x = this._x, y = this._y, j = x.length - 1; - if (j > 0) { - var x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1, t; - while(++i <= j){ - t = i / j; - this._basis.point(this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)); - } - } - this._x = this._y = null; - this._basis.lineEnd(); + }; + function MonotoneY(context2) { + this._context = new ReflectContext(context2); + } + (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) { + MonotoneX.prototype.point.call(this, y2, x2); + }; + function ReflectContext(context2) { + this._context = context2; + } + ReflectContext.prototype = { + moveTo: function(x2, y2) { + this._context.moveTo(y2, x2); }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -exports.default = function custom(beta) { - function bundle(context) { - return beta === 1 ? new (0, _basisJs.Basis)(context) : new Bundle(context, beta); - } - bundle.beta = function(beta) { - return custom(+beta); - }; - return bundle; -}(0.85); - -},{"./basis.js":"gNfFM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e0Ty2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalClosed", ()=>CardinalClosed); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _cardinalJs = require("./cardinal.js"); -function CardinalClosed(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._point = 0; + closePath: function() { + this._context.closePath(); }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } + lineTo: function(x2, y2) { + this._context.lineTo(y2, x2); }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _cardinalJs.point)(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + bezierCurveTo: function(x12, y12, x2, y2, x3, y3) { + this._context.bezierCurveTo(y12, x12, y2, x2, y3, x3); } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalClosed(context, tension); - } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"../noop.js":"9n7oj","./cardinal.js":"i0afA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i0afA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -parcelHelpers.export(exports, "Cardinal", ()=>Cardinal); -function point(that, x, y) { - that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2); -} -function Cardinal(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -Cardinal.prototype = { + }; + function monotoneX(context2) { + return new MonotoneX(context2); + } + function monotoneY(context2) { + return new MonotoneY(context2); + } + function Natural(context2) { + this._context = context2; + } + Natural.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; + this._x = []; + this._y = []; }, lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - point(this, this._x1, this._y1); - break; + var x2 = this._x, y2 = this._y, n = x2.length; + if (n) { + this._line ? this._context.lineTo(x2[0], y2[0]) : this._context.moveTo(x2[0], y2[0]); + if (n === 2) { + this._context.lineTo(x2[1], y2[1]); + } else { + var px2 = controlPoints(x2), py2 = controlPoints(y2); + for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { + this._context.bezierCurveTo(px2[0][i0], py2[0][i0], px2[1][i0], py2[1][i0], x2[i1], y2[i1]); + } } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + } + if (this._line || this._line !== 0 && n === 1) this._context.closePath(); + this._line = 1 - this._line; + this._x = this._y = null; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - this._x1 = x, this._y1 = y; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; - } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new Cardinal(context, tension); + point: function(x2, y2) { + this._x.push(+x2); + this._y.push(+y2); } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4cTvH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CardinalOpen", ()=>CardinalOpen); -var _cardinalJs = require("./cardinal.js"); -function CardinalOpen(context, tension) { - this._context = context; - this._k = (1 - tension) / 6; -} -CardinalOpen.prototype = { + }; + function controlPoints(x2) { + var i, n = x2.length - 1, m2, a2 = new Array(n), b2 = new Array(n), r = new Array(n); + a2[0] = 0, b2[0] = 2, r[0] = x2[0] + 2 * x2[1]; + for (i = 1; i < n - 1; ++i) a2[i] = 1, b2[i] = 4, r[i] = 4 * x2[i] + 2 * x2[i + 1]; + a2[n - 1] = 2, b2[n - 1] = 7, r[n - 1] = 8 * x2[n - 1] + x2[n]; + for (i = 1; i < n; ++i) m2 = a2[i] / b2[i - 1], b2[i] -= m2, r[i] -= m2 * r[i - 1]; + a2[n - 1] = r[n - 1] / b2[n - 1]; + for (i = n - 2; i >= 0; --i) a2[i] = (r[i] - a2[i + 1]) / b2[i]; + b2[n - 1] = (x2[n] + a2[n - 1]) / 2; + for (i = 0; i < n - 1; ++i) b2[i] = 2 * x2[i + 1] - a2[i + 1]; + return [a2, b2]; + } + function curveNatural(context2) { + return new Natural(context2); + } + function Step(context2, t) { + this._context = context2; + this._t = t; + } + Step.prototype = { areaStart: function() { - this._line = 0; + this._line = 0; }, areaEnd: function() { - this._line = NaN; + this._line = NaN; }, lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._point = 0; + this._x = this._y = NaN; + this._point = 0; }, lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; + if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); + if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); + if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _cardinalJs.point)(this, x, y); - break; + point: function(x2, y2) { + x2 = +x2, y2 = +y2; + switch (this._point) { + case 0: + this._point = 1; + this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); + break; + case 1: + this._point = 2; + // falls through + default: { + if (this._t <= 0) { + this._context.lineTo(this._x, y2); + this._context.lineTo(x2, y2); + } else { + var x12 = this._x * (1 - this._t) + x2 * this._t; + this._context.lineTo(x12, this._y); + this._context.lineTo(x12, y2); + } + break; } - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } + this._x = x2, this._y = y2; } -}; -exports.default = function custom(tension) { - function cardinal(context) { - return new CardinalOpen(context, tension); + }; + function curveStep(context2) { + return new Step(context2, 0.5); + } + function stepBefore(context2) { + return new Step(context2, 0); + } + function stepAfter(context2) { + return new Step(context2, 1); + } + function domCanvas(w2, h2) { + if (typeof document !== "undefined" && document.createElement) { + const c2 = document.createElement("canvas"); + if (c2 && c2.getContext) { + c2.width = w2; + c2.height = h2; + return c2; + } } - cardinal.tension = function(tension) { - return custom(+tension); - }; - return cardinal; -}(0); - -},{"./cardinal.js":"i0afA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kfNnJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalClosedJs = require("./cardinalClosed.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomClosed(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; - }, - lineEnd: function() { - switch(this._point){ - case 1: - this._context.moveTo(this._x3, this._y3); - this._context.closePath(); - break; - case 2: - this._context.lineTo(this._x3, this._y3); - this._context.closePath(); - break; - case 3: - this.point(this._x3, this._y3); - this.point(this._x4, this._y4); - this.point(this._x5, this._y5); - break; - } - }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._x3 = x, this._y3 = y; - break; - case 1: - this._point = 2; - this._context.moveTo(this._x4 = x, this._y4 = y); - break; - case 2: - this._point = 3; - this._x5 = x, this._y5 = y; - break; - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + return null; + } + const domImage = () => typeof Image !== "undefined" ? Image : null; + function initRange(domain2, range2) { + switch (arguments.length) { + case 0: + break; + case 1: + this.range(domain2); + break; + default: + this.range(range2).domain(domain2); + break; } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomClosed(context, alpha) : new (0, _cardinalClosedJs.CardinalClosed)(context, 0); + return this; + } + function initInterpolator(domain2, interpolator) { + switch (arguments.length) { + case 0: + break; + case 1: { + if (typeof domain2 === "function") this.interpolator(domain2); + else this.range(domain2); + break; + } + default: { + this.domain(domain2); + if (typeof interpolator === "function") this.interpolator(interpolator); + else this.range(interpolator); + break; + } } - catmullRom.alpha = function(alpha) { - return custom(+alpha); + return this; + } + const implicit = Symbol("implicit"); + function ordinal() { + var index2 = new InternMap(), domain2 = [], range2 = [], unknown = implicit; + function scale2(d) { + let i = index2.get(d); + if (i === void 0) { + if (unknown !== implicit) return unknown; + index2.set(d, i = domain2.push(d) - 1); + } + return range2[i % range2.length]; + } + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = [], index2 = new InternMap(); + for (const value2 of _) { + if (index2.has(value2)) continue; + index2.set(value2, domain2.push(value2) - 1); + } + return scale2; }; - return catmullRom; -}(0.5); - -},{"./cardinalClosed.js":"e0Ty2","../noop.js":"9n7oj","./catmullRom.js":"8d6GP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8d6GP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "point", ()=>point); -var _mathJs = require("../math.js"); -var _cardinalJs = require("./cardinal.js"); -function point(that, x, y) { - var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2; - if (that._l01_a > (0, _mathJs.epsilon)) { - var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); - x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; - y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; - } - if (that._l23_a > (0, _mathJs.epsilon)) { - var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a); - x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; - y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; - } - that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); -} -function CatmullRom(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRom.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), scale2) : range2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return ordinal(domain2, range2).unknown(unknown); + }; + initRange.apply(scale2, arguments); + return scale2; + } + function define2(constructor, factory, prototype2) { + constructor.prototype = factory.prototype = prototype2; + prototype2.constructor = constructor; + } + function extend(parent, definition2) { + var prototype2 = Object.create(parent.prototype); + for (var key2 in definition2) prototype2[key2] = definition2[key2]; + return prototype2; + } + function Color$1() { + } + var darker = 0.7; + var brighter = 1 / darker; + var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); + var named = { + aliceblue: 15792383, + antiquewhite: 16444375, + aqua: 65535, + aquamarine: 8388564, + azure: 15794175, + beige: 16119260, + bisque: 16770244, + black: 0, + blanchedalmond: 16772045, + blue: 255, + blueviolet: 9055202, + brown: 10824234, + burlywood: 14596231, + cadetblue: 6266528, + chartreuse: 8388352, + chocolate: 13789470, + coral: 16744272, + cornflowerblue: 6591981, + cornsilk: 16775388, + crimson: 14423100, + cyan: 65535, + darkblue: 139, + darkcyan: 35723, + darkgoldenrod: 12092939, + darkgray: 11119017, + darkgreen: 25600, + darkgrey: 11119017, + darkkhaki: 12433259, + darkmagenta: 9109643, + darkolivegreen: 5597999, + darkorange: 16747520, + darkorchid: 10040012, + darkred: 9109504, + darksalmon: 15308410, + darkseagreen: 9419919, + darkslateblue: 4734347, + darkslategray: 3100495, + darkslategrey: 3100495, + darkturquoise: 52945, + darkviolet: 9699539, + deeppink: 16716947, + deepskyblue: 49151, + dimgray: 6908265, + dimgrey: 6908265, + dodgerblue: 2003199, + firebrick: 11674146, + floralwhite: 16775920, + forestgreen: 2263842, + fuchsia: 16711935, + gainsboro: 14474460, + ghostwhite: 16316671, + gold: 16766720, + goldenrod: 14329120, + gray: 8421504, + green: 32768, + greenyellow: 11403055, + grey: 8421504, + honeydew: 15794160, + hotpink: 16738740, + indianred: 13458524, + indigo: 4915330, + ivory: 16777200, + khaki: 15787660, + lavender: 15132410, + lavenderblush: 16773365, + lawngreen: 8190976, + lemonchiffon: 16775885, + lightblue: 11393254, + lightcoral: 15761536, + lightcyan: 14745599, + lightgoldenrodyellow: 16448210, + lightgray: 13882323, + lightgreen: 9498256, + lightgrey: 13882323, + lightpink: 16758465, + lightsalmon: 16752762, + lightseagreen: 2142890, + lightskyblue: 8900346, + lightslategray: 7833753, + lightslategrey: 7833753, + lightsteelblue: 11584734, + lightyellow: 16777184, + lime: 65280, + limegreen: 3329330, + linen: 16445670, + magenta: 16711935, + maroon: 8388608, + mediumaquamarine: 6737322, + mediumblue: 205, + mediumorchid: 12211667, + mediumpurple: 9662683, + mediumseagreen: 3978097, + mediumslateblue: 8087790, + mediumspringgreen: 64154, + mediumturquoise: 4772300, + mediumvioletred: 13047173, + midnightblue: 1644912, + mintcream: 16121850, + mistyrose: 16770273, + moccasin: 16770229, + navajowhite: 16768685, + navy: 128, + oldlace: 16643558, + olive: 8421376, + olivedrab: 7048739, + orange: 16753920, + orangered: 16729344, + orchid: 14315734, + palegoldenrod: 15657130, + palegreen: 10025880, + paleturquoise: 11529966, + palevioletred: 14381203, + papayawhip: 16773077, + peachpuff: 16767673, + peru: 13468991, + pink: 16761035, + plum: 14524637, + powderblue: 11591910, + purple: 8388736, + rebeccapurple: 6697881, + red: 16711680, + rosybrown: 12357519, + royalblue: 4286945, + saddlebrown: 9127187, + salmon: 16416882, + sandybrown: 16032864, + seagreen: 3050327, + seashell: 16774638, + sienna: 10506797, + silver: 12632256, + skyblue: 8900331, + slateblue: 6970061, + slategray: 7372944, + slategrey: 7372944, + snow: 16775930, + springgreen: 65407, + steelblue: 4620980, + tan: 13808780, + teal: 32896, + thistle: 14204888, + tomato: 16737095, + turquoise: 4251856, + violet: 15631086, + wheat: 16113331, + white: 16777215, + whitesmoke: 16119285, + yellow: 16776960, + yellowgreen: 10145074 + }; + define2(Color$1, color$2, { + copy(channels) { + return Object.assign(new this.constructor(), this, channels); }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + displayable() { + return this.rgb().displayable(); }, - lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x2, this._y2); - break; - case 3: - this.point(this._x2, this._y2); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; + hex: color_formatHex, + // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); + function color_formatHex() { + return this.rgb().formatHex(); + } + function color_formatHex8() { + return this.rgb().formatHex8(); + } + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } + function color_formatRgb() { + return this.rgb().formatRgb(); + } + function color$2(format2) { + var m2, l; + format2 = (format2 + "").trim().toLowerCase(); + return (m2 = reHex.exec(format2)) ? (l = m2[1].length, m2 = parseInt(m2[1], 16), l === 6 ? rgbn(m2) : l === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; + } + function rgbn(n) { + return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); + } + function rgba(r, g, b2, a2) { + if (a2 <= 0) r = g = b2 = NaN; + return new Rgb(r, g, b2, a2); + } + function rgbConvert(o) { + if (!(o instanceof Color$1)) o = color$2(o); + if (!o) return new Rgb(); + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } + function rgb$1(r, g, b2, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b2, opacity == null ? 1 : opacity); + } + function Rgb(r, g, b2, opacity) { + this.r = +r; + this.g = +g; + this.b = +b2; + this.opacity = +opacity; + } + define2(Rgb, rgb$1, extend(Color$1, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; // falls through - default: - point(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRom(context, alpha) : new (0, _cardinalJs.Cardinal)(context, 0); - } - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - return catmullRom; -}(0.5); - -},{"../math.js":"OHDSf","./cardinal.js":"i0afA","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"amodp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _cardinalOpenJs = require("./cardinalOpen.js"); -var _catmullRomJs = require("./catmullRom.js"); -function CatmullRomOpen(context, alpha) { - this._context = context; - this._alpha = alpha; -} -CatmullRomOpen.prototype = { - areaStart: function() { - this._line = 0; + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); }, - areaEnd: function() { - this._line = NaN; + rgb() { + return this; }, - lineStart: function() { - this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; - this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); }, - lineEnd: function() { - if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); - this._line = 1 - this._line; + displayable() { + return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1); }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) { - var x23 = this._x2 - x, y23 = this._y2 - y; - this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); - } - switch(this._point){ - case 0: - this._point = 1; - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); - break; - case 3: - this._point = 4; // falls through - default: - (0, _catmullRomJs.point)(this, x, y); - break; - } - this._l01_a = this._l12_a, this._l12_a = this._l23_a; - this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; - this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; - this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; - } -}; -exports.default = function custom(alpha) { - function catmullRom(context) { - return alpha ? new CatmullRomOpen(context, alpha) : new (0, _cardinalOpenJs.CardinalOpen)(context, 0); + hex: rgb_formatHex, + // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); + function rgb_formatHex() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; + } + function rgb_formatHex8() { + return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; + } + function rgb_formatRgb() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`; + } + function clampa(opacity) { + return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); + } + function clampi(value2) { + return Math.max(0, Math.min(255, Math.round(value2) || 0)); + } + function hex(value2) { + value2 = clampi(value2); + return (value2 < 16 ? "0" : "") + value2.toString(16); + } + function hsla(h2, s, l, a2) { + if (a2 <= 0) h2 = s = l = NaN; + else if (l <= 0 || l >= 1) h2 = s = NaN; + else if (s <= 0) h2 = NaN; + return new Hsl(h2, s, l, a2); + } + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color$1)) o = color$2(o); + if (!o) return new Hsl(); + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, min2 = Math.min(r, g, b2), max2 = Math.max(r, g, b2), h2 = NaN, s = max2 - min2, l = (max2 + min2) / 2; + if (s) { + if (r === max2) h2 = (g - b2) / s + (g < b2) * 6; + else if (g === max2) h2 = (b2 - r) / s + 2; + else h2 = (r - g) / s + 4; + s /= l < 0.5 ? max2 + min2 : 2 - max2 - min2; + h2 *= 60; + } else { + s = l > 0 && l < 1 ? 0 : h2; } - catmullRom.alpha = function(alpha) { - return custom(+alpha); - }; - return catmullRom; -}(0.5); - -},{"./cardinalOpen.js":"4cTvH","./catmullRom.js":"8d6GP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gpcM0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new LinearClosed(context); - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function LinearClosed(context) { - this._context = context; -} -LinearClosed.prototype = { - areaStart: (0, _noopJsDefault.default), - areaEnd: (0, _noopJsDefault.default), - lineStart: function() { - this._point = 0; + return new Hsl(h2, s, l, o.opacity); + } + function hsl$1(h2, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s, l, opacity == null ? 1 : opacity); + } + function Hsl(h2, s, l, opacity) { + this.h = +h2; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + define2(Hsl, hsl$1, extend(Color$1, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = this.h % 360 + (this.h < 0) * 360, s = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2), + hsl2rgb(h2, m1, m2), + hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2), + this.opacity + ); }, - lineEnd: function() { - if (this._point) this._context.closePath(); + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); }, - point: function(x, y) { - x = +x, y = +y; - if (this._point) this._context.lineTo(x, y); - else this._point = 1, this._context.moveTo(x, y); - } -}; - -},{"../noop.js":"9n7oj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kghkb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "monotoneX", ()=>monotoneX); -parcelHelpers.export(exports, "monotoneY", ()=>monotoneY); -function sign(x) { - return x < 0 ? -1 : 1; -} -// Calculate the slopes of the tangents (Hermite-type interpolation) based on -// the following paper: Steffen, M. 1990. A Simple Method for Monotonic -// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. -// NOV(II), P. 443, 1990. -function slope3(that, x2, y2) { - var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); - return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; -} -// Calculate a one-sided slope. -function slope2(that, t) { - var h = that._x1 - that._x0; - return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; -} -// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations -// "you can express cubic Hermite interpolation in terms of cubic Bézier curves -// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". -function point(that, t0, t1) { - var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3; - that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); -} -function MonotoneX(context) { - this._context = context; -} -MonotoneX.prototype = { - areaStart: function() { - this._line = 0; + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1); }, - areaEnd: function() { - this._line = NaN; + formatHsl() { + const a2 = clampa(this.opacity); + return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`; + } + })); + function clamph(value2) { + value2 = (value2 || 0) % 360; + return value2 < 0 ? value2 + 360 : value2; + } + function clampt(value2) { + return Math.max(0, Math.min(1, value2 || 0)); + } + function hsl2rgb(h2, m1, m2) { + return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255; + } + const radians$1 = Math.PI / 180; + const degrees$2 = 180 / Math.PI; + const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; + function labConvert(o) { + if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); + if (o instanceof Hcl) return hcl2lab(o); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b2 = rgb2lrgb(o.b), y2 = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b2) / Yn), x2, z; + if (r === g && g === b2) x2 = z = y2; + else { + x2 = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b2) / Xn); + z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b2) / Zn); + } + return new Lab(116 * y2 - 16, 500 * (x2 - y2), 200 * (y2 - z), o.opacity); + } + function lab$1(l, a2, b2, opacity) { + return arguments.length === 1 ? labConvert(l) : new Lab(l, a2, b2, opacity == null ? 1 : opacity); + } + function Lab(l, a2, b2, opacity) { + this.l = +l; + this.a = +a2; + this.b = +b2; + this.opacity = +opacity; + } + define2(Lab, lab$1, extend(Color$1, { + brighter(k) { + return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + darker(k) { + return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + rgb() { + var y2 = (this.l + 16) / 116, x2 = isNaN(this.a) ? y2 : y2 + this.a / 500, z = isNaN(this.b) ? y2 : y2 - this.b / 200; + x2 = Xn * lab2xyz(x2); + y2 = Yn * lab2xyz(y2); + z = Zn * lab2xyz(z); + return new Rgb( + lrgb2rgb(3.1338561 * x2 - 1.6168667 * y2 - 0.4906146 * z), + lrgb2rgb(-0.9787684 * x2 + 1.9161415 * y2 + 0.033454 * z), + lrgb2rgb(0.0719453 * x2 - 0.2289914 * y2 + 1.4052427 * z), + this.opacity + ); + } + })); + function xyz2lab(t) { + return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; + } + function lab2xyz(t) { + return t > t1 ? t * t * t : t2 * (t - t0); + } + function lrgb2rgb(x2) { + return 255 * (x2 <= 31308e-7 ? 12.92 * x2 : 1.055 * Math.pow(x2, 1 / 2.4) - 0.055); + } + function rgb2lrgb(x2) { + return (x2 /= 255) <= 0.04045 ? x2 / 12.92 : Math.pow((x2 + 0.055) / 1.055, 2.4); + } + function hclConvert(o) { + if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); + if (!(o instanceof Lab)) o = labConvert(o); + if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); + var h2 = Math.atan2(o.b, o.a) * degrees$2; + return new Hcl(h2 < 0 ? h2 + 360 : h2, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); + } + function hcl$1(h2, c2, l, opacity) { + return arguments.length === 1 ? hclConvert(h2) : new Hcl(h2, c2, l, opacity == null ? 1 : opacity); + } + function Hcl(h2, c2, l, opacity) { + this.h = +h2; + this.c = +c2; + this.l = +l; + this.opacity = +opacity; + } + function hcl2lab(o) { + if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); + var h2 = o.h * radians$1; + return new Lab(o.l, Math.cos(h2) * o.c, Math.sin(h2) * o.c, o.opacity); + } + define2(Hcl, hcl$1, extend(Color$1, { + brighter(k) { + return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); }, - lineStart: function() { - this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; - this._point = 0; + darker(k) { + return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); }, - lineEnd: function() { - switch(this._point){ - case 2: - this._context.lineTo(this._x1, this._y1); - break; - case 3: - point(this, this._t0, slope2(this, this._t0)); - break; - } - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - this._line = 1 - this._line; - }, - point: function(x, y) { - var t1 = NaN; - x = +x, y = +y; - if (x === this._x1 && y === this._y1) return; // Ignore coincident points. - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; - break; - case 2: - this._point = 3; - point(this, slope2(this, t1 = slope3(this, x, y)), t1); - break; - default: - point(this, this._t0, t1 = slope3(this, x, y)); - break; - } - this._x0 = this._x1, this._x1 = x; - this._y0 = this._y1, this._y1 = y; - this._t0 = t1; - } -}; -function MonotoneY(context) { - this._context = new ReflectContext(context); -} -(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { - MonotoneX.prototype.point.call(this, y, x); -}; -function ReflectContext(context) { - this._context = context; -} -ReflectContext.prototype = { - moveTo: function(x, y) { - this._context.moveTo(y, x); - }, - closePath: function() { - this._context.closePath(); - }, - lineTo: function(x, y) { - this._context.lineTo(y, x); - }, - bezierCurveTo: function(x1, y1, x2, y2, x, y) { - this._context.bezierCurveTo(y1, x1, y2, x2, y, x); - } -}; -function monotoneX(context) { - return new MonotoneX(context); -} -function monotoneY(context) { - return new MonotoneY(context); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4f94Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Natural(context); - }); -function Natural(context) { - this._context = context; -} -Natural.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = []; - this._y = []; - }, - lineEnd: function() { - var x = this._x, y = this._y, n = x.length; - if (n) { - this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); - if (n === 2) this._context.lineTo(x[1], y[1]); - else { - var px = controlPoints(x), py = controlPoints(y); - for(var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1)this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); - } - } - if (this._line || this._line !== 0 && n === 1) this._context.closePath(); - this._line = 1 - this._line; - this._x = this._y = null; - }, - point: function(x, y) { - this._x.push(+x); - this._y.push(+y); - } -}; -// See https://www.particleincell.com/2012/bezier-splines/ for derivation. -function controlPoints(x) { - var i, n = x.length - 1, m, a = new Array(n), b = new Array(n), r = new Array(n); - a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; - for(i = 1; i < n - 1; ++i)a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; - a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; - for(i = 1; i < n; ++i)m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; - a[n - 1] = r[n - 1] / b[n - 1]; - for(i = n - 2; i >= 0; --i)a[i] = (r[i] - a[i + 1]) / b[i]; - b[n - 1] = (x[n] + a[n - 1]) / 2; - for(i = 0; i < n - 1; ++i)b[i] = 2 * x[i + 1] - a[i + 1]; - return [ - a, - b - ]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l5kmS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(context) { - return new Step(context, 0.5); - }); -parcelHelpers.export(exports, "stepBefore", ()=>stepBefore); -parcelHelpers.export(exports, "stepAfter", ()=>stepAfter); -function Step(context, t) { - this._context = context; - this._t = t; -} -Step.prototype = { - areaStart: function() { - this._line = 0; - }, - areaEnd: function() { - this._line = NaN; - }, - lineStart: function() { - this._x = this._y = NaN; - this._point = 0; - }, - lineEnd: function() { - if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); - if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); - if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; - }, - point: function(x, y) { - x = +x, y = +y; - switch(this._point){ - case 0: - this._point = 1; - this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); - break; - case 1: - this._point = 2; // falls through - default: - if (this._t <= 0) { - this._context.lineTo(this._x, y); - this._context.lineTo(x, y); - } else { - var x1 = this._x * (1 - this._t) + x * this._t; - this._context.lineTo(x1, this._y); - this._context.lineTo(x1, y); - } - break; - } - this._x = x, this._y = y; - } -}; -function stepBefore(context) { - return new Step(context, 0); -} -function stepAfter(context) { - return new Step(context, 1); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kPWfS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "canvas", ()=>domCanvas); -parcelHelpers.export(exports, "domCanvas", ()=>domCanvas); -parcelHelpers.export(exports, "image", ()=>domImage); -function domCanvas(w, h) { - if (typeof document !== 'undefined' && document.createElement) { - const c = document.createElement('canvas'); - if (c && c.getContext) { - c.width = w; - c.height = h; - return c; - } + rgb() { + return hcl2lab(this).rgb(); } - return null; -} -const domImage = ()=>typeof Image !== 'undefined' ? Image : null; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bEydG":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _d3Scale.scaleImplicit)); -parcelHelpers.export(exports, "Band", ()=>Band); -parcelHelpers.export(exports, "BinOrdinal", ()=>BinOrdinal); -parcelHelpers.export(exports, "DiscreteLegend", ()=>DiscreteLegend); -parcelHelpers.export(exports, "Diverging", ()=>Diverging); -parcelHelpers.export(exports, "GradientLegend", ()=>GradientLegend); -parcelHelpers.export(exports, "Identity", ()=>Identity); -parcelHelpers.export(exports, "Linear", ()=>Linear); -parcelHelpers.export(exports, "Log", ()=>Log); -parcelHelpers.export(exports, "Ordinal", ()=>Ordinal); -parcelHelpers.export(exports, "Point", ()=>Point); -parcelHelpers.export(exports, "Pow", ()=>Pow); -parcelHelpers.export(exports, "Quantile", ()=>Quantile); -parcelHelpers.export(exports, "Quantize", ()=>Quantize); -parcelHelpers.export(exports, "Sequential", ()=>Sequential); -parcelHelpers.export(exports, "Sqrt", ()=>Sqrt); -parcelHelpers.export(exports, "SymbolLegend", ()=>SymbolLegend); -parcelHelpers.export(exports, "Symlog", ()=>Symlog); -parcelHelpers.export(exports, "Threshold", ()=>Threshold); -parcelHelpers.export(exports, "Time", ()=>Time); -parcelHelpers.export(exports, "UTC", ()=>UTC); -parcelHelpers.export(exports, "bandSpace", ()=>bandSpace); -parcelHelpers.export(exports, "domainCaption", ()=>domainCaption); -parcelHelpers.export(exports, "interpolate", ()=>interpolate); -parcelHelpers.export(exports, "interpolateColors", ()=>interpolateColors); -parcelHelpers.export(exports, "interpolateRange", ()=>interpolateRange); -parcelHelpers.export(exports, "isContinuous", ()=>isContinuous); -parcelHelpers.export(exports, "isDiscrete", ()=>isDiscrete); -parcelHelpers.export(exports, "isDiscretizing", ()=>isDiscretizing); -parcelHelpers.export(exports, "isInterpolating", ()=>isInterpolating); -parcelHelpers.export(exports, "isLogarithmic", ()=>isLogarithmic); -parcelHelpers.export(exports, "isQuantile", ()=>isQuantile); -parcelHelpers.export(exports, "isRegisteredScale", ()=>isRegisteredScale); -parcelHelpers.export(exports, "isTemporal", ()=>isTemporal); -parcelHelpers.export(exports, "isValidScaleType", ()=>isValidScaleType); -parcelHelpers.export(exports, "labelFormat", ()=>labelFormat); -parcelHelpers.export(exports, "labelFraction", ()=>labelFraction); -parcelHelpers.export(exports, "labelValues", ()=>labelValues); -parcelHelpers.export(exports, "quantizeInterpolator", ()=>quantizeInterpolator); -parcelHelpers.export(exports, "registerScale", ()=>registerScale); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleCopy", ()=>scaleCopy); -parcelHelpers.export(exports, "scaleFraction", ()=>scaleFraction); -parcelHelpers.export(exports, "scheme", ()=>scheme); -parcelHelpers.export(exports, "tickCount", ()=>tickCount); -parcelHelpers.export(exports, "tickFormat", ()=>tickFormat); -parcelHelpers.export(exports, "tickValues", ()=>tickValues); -parcelHelpers.export(exports, "validTicks", ()=>validTicks); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Scale = require("d3-scale"); -var _d3Interpolate = require("d3-interpolate"); -var _d3ScaleChromatic = require("d3-scale-chromatic"); -var _vegaTime = require("vega-time"); -function bandSpace(count, paddingInner, paddingOuter) { - const space = count - paddingInner + paddingOuter * 2; - return count ? space > 0 ? space : 1 : 0; -} -const Identity = 'identity'; -const Linear = 'linear'; -const Log = 'log'; -const Pow = 'pow'; -const Sqrt = 'sqrt'; -const Symlog = 'symlog'; -const Time = 'time'; -const UTC = 'utc'; -const Sequential = 'sequential'; -const Diverging = 'diverging'; -const Quantile = 'quantile'; -const Quantize = 'quantize'; -const Threshold = 'threshold'; -const Ordinal = 'ordinal'; -const Point = 'point'; -const Band = 'band'; -const BinOrdinal = 'bin-ordinal'; -// categories -const Continuous = 'continuous'; -const Discrete = 'discrete'; -const Discretizing = 'discretizing'; -const Interpolating = 'interpolating'; -const Temporal = 'temporal'; -function invertRange(scale) { - return function(_) { - let lo = _[0], hi = _[1], t; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - return [ - scale.invert(lo), - scale.invert(hi) - ]; - }; -} -function invertRangeExtent(scale) { - return function(_) { - const range = scale.range(); - let lo = _[0], hi = _[1], min = -1, max, t, i, n; - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - for(i = 0, n = range.length; i < n; ++i)if (range[i] >= lo && range[i] <= hi) { - if (min < 0) min = i; - max = i; - } - if (min < 0) return undefined; - lo = scale.invertExtent(range[min]); - hi = scale.invertExtent(range[max]); - return [ - lo[0] === undefined ? lo[1] : lo[0], - hi[1] === undefined ? hi[0] : hi[1] - ]; - }; -} -function band() { - const scale = (0, _d3Scale.scaleOrdinal)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range; - let range$1 = [ - 0, - 1 - ], step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - const n = domain().length, reverse = range$1[1] < range$1[0], stop = range$1[1 - reverse], space = bandSpace(n, paddingInner, paddingOuter); - let start = range$1[reverse - 0]; - step = (stop - start) / (space || 1); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) { - start = Math.round(start); - bandwidth = Math.round(bandwidth); - } - const values = (0, _d3Array.range)(n).map((i)=>start + step * i); - return ordinalRange(reverse ? values.reverse() : values); - } - scale.domain = function(_) { - if (arguments.length) { - domain(_); - return rescale(); - } else return domain(); + })); + var A = -0.14861, B$1 = 1.78277, C$1 = -0.29227, D$1 = -0.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C$1 - D$1 * A; + function cubehelixConvert(o) { + if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = o.r / 255, g = o.g / 255, b2 = o.b / 255, l = (BC_DA * b2 + ED * r - EB * g) / (BC_DA + ED - EB), bl2 = b2 - l, k = (E * (g - l) - C$1 * bl2) / D$1, s = Math.sqrt(k * k + bl2 * bl2) / (E * l * (1 - l)), h2 = s ? Math.atan2(k, bl2) * degrees$2 - 120 : NaN; + return new Cubehelix(h2 < 0 ? h2 + 360 : h2, s, l, o.opacity); + } + function cubehelix$1(h2, s, l, opacity) { + return arguments.length === 1 ? cubehelixConvert(h2) : new Cubehelix(h2, s, l, opacity == null ? 1 : opacity); + } + function Cubehelix(h2, s, l, opacity) { + this.h = +h2; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } + define2(Cubehelix, cubehelix$1, extend(Color$1, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h2 = isNaN(this.h) ? 0 : (this.h + 120) * radians$1, l = +this.l, a2 = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh2 = Math.cos(h2), sinh2 = Math.sin(h2); + return new Rgb( + 255 * (l + a2 * (A * cosh2 + B$1 * sinh2)), + 255 * (l + a2 * (C$1 * cosh2 + D$1 * sinh2)), + 255 * (l + a2 * (E * cosh2)), + this.opacity + ); + } + })); + function basis(t12, v0, v1, v2, v3) { + var t22 = t12 * t12, t32 = t22 * t12; + return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6; + } + function basis$1(values2) { + var n = values2.length - 1; + return function(t) { + var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values2[i], v2 = values2[i + 1], v0 = i > 0 ? values2[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values2[i + 2] : 2 * v2 - v1; + return basis((t - i / n) * n, v0, v1, v2, v3); }; - scale.range = function(_) { - if (arguments.length) { - range$1 = [ - +_[0], - +_[1] - ]; - return rescale(); - } else return range$1.slice(); - }; - scale.rangeRound = function(_) { - range$1 = [ - +_[0], - +_[1] - ]; - round = true; - return rescale(); + } + function basisClosed(values2) { + var n = values2.length; + return function(t) { + var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values2[(i + n - 1) % n], v1 = values2[i % n], v2 = values2[(i + 1) % n], v3 = values2[(i + 2) % n]; + return basis((t - i / n) * n, v0, v1, v2, v3); }; - scale.bandwidth = function() { - return bandwidth; + } + const constant$2 = (x2) => () => x2; + function linear$1(a2, d) { + return function(t) { + return a2 + t * d; }; - scale.step = function() { - return step; + } + function exponential(a2, b2, y2) { + return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t) { + return Math.pow(a2 + t * b2, y2); }; - scale.round = function(_) { - if (arguments.length) { - round = !!_; - return rescale(); - } else return round; + } + function hue$1(a2, b2) { + var d = b2 - a2; + return d ? linear$1(a2, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$2(isNaN(a2) ? b2 : a2); + } + function gamma(y2) { + return (y2 = +y2) === 1 ? nogamma : function(a2, b2) { + return b2 - a2 ? exponential(a2, b2, y2) : constant$2(isNaN(a2) ? b2 : a2); }; - scale.padding = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - paddingInner = paddingOuter; - return rescale(); - } else return paddingInner; + } + function nogamma(a2, b2) { + var d = b2 - a2; + return d ? linear$1(a2, d) : constant$2(isNaN(a2) ? b2 : a2); + } + const rgb = (function rgbGamma(y2) { + var color2 = gamma(y2); + function rgb2(start, end) { + var r = color2((start = rgb$1(start)).r, (end = rgb$1(end)).r), g = color2(start.g, end.g), b2 = color2(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b2(t); + start.opacity = opacity(t); + return start + ""; + }; + } + rgb2.gamma = rgbGamma; + return rgb2; + })(1); + function rgbSpline(spline) { + return function(colors2) { + var n = colors2.length, r = new Array(n), g = new Array(n), b2 = new Array(n), i, color2; + for (i = 0; i < n; ++i) { + color2 = rgb$1(colors2[i]); + r[i] = color2.r || 0; + g[i] = color2.g || 0; + b2[i] = color2.b || 0; + } + r = spline(r); + g = spline(g); + b2 = spline(b2); + color2.opacity = 1; + return function(t) { + color2.r = r(t); + color2.g = g(t); + color2.b = b2(t); + return color2 + ""; + }; }; - scale.paddingInner = function(_) { - if (arguments.length) { - paddingInner = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingInner; + } + var rgbBasis = rgbSpline(basis$1); + var rgbBasisClosed = rgbSpline(basisClosed); + function numberArray(a2, b2) { + if (!b2) b2 = []; + var n = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i; + return function(t) { + for (i = 0; i < n; ++i) c2[i] = a2[i] * (1 - t) + b2[i] * t; + return c2; }; - scale.paddingOuter = function(_) { - if (arguments.length) { - paddingOuter = Math.max(0, Math.min(1, _)); - return rescale(); - } else return paddingOuter; + } + function isNumberArray(x2) { + return ArrayBuffer.isView(x2) && !(x2 instanceof DataView); + } + function array$3(a2, b2) { + return (isNumberArray(b2) ? numberArray : genericArray)(a2, b2); + } + function genericArray(a2, b2) { + var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i; + for (i = 0; i < na; ++i) x2[i] = interpolate$1(a2[i], b2[i]); + for (; i < nb; ++i) c2[i] = b2[i]; + return function(t) { + for (i = 0; i < na; ++i) c2[i] = x2[i](t); + return c2; }; - scale.align = function(_) { - if (arguments.length) { - align = Math.max(0, Math.min(1, _)); - return rescale(); - } else return align; - }; - scale.invertRange = function(_) { - // bail if range has null or undefined values - if (_[0] == null || _[1] == null) return; - const reverse = range$1[1] < range$1[0], values = reverse ? ordinalRange().reverse() : ordinalRange(), n = values.length - 1; - let lo = +_[0], hi = +_[1], a, b, t; - // bail if either range endpoint is invalid - if (lo !== lo || hi !== hi) return; - // order range inputs, bail if outside of scale range - if (hi < lo) { - t = lo; - lo = hi; - hi = t; - } - if (hi < values[0] || lo > range$1[1 - reverse]) return; - // binary search to index into scale range - a = Math.max(0, (0, _d3Array.bisectRight)(values, lo) - 1); - b = lo === hi ? a : (0, _d3Array.bisectRight)(values, hi) - 1; - // increment index a if lo is within padding gap - if (lo - values[a] > bandwidth + 1e-10) ++a; - if (reverse) { - // map + swap - t = a; - a = n - b; - b = n - t; - } - return a > b ? undefined : domain().slice(a, b + 1); - }; - scale.invert = function(_) { - const value = scale.invertRange([ - _, - _ - ]); - return value ? value[0] : value; - }; - scale.copy = function() { - return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); + } + function date$1(a2, b2) { + var d = /* @__PURE__ */ new Date(); + return a2 = +a2, b2 = +b2, function(t) { + return d.setTime(a2 * (1 - t) + b2 * t), d; }; - return rescale(); -} -function pointish(scale) { - const copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band().paddingInner(1)); -} -var map = Array.prototype.map; -function numbers(_) { - return map.call(_, (0, _vegaUtil.toNumber)); -} -const slice = Array.prototype.slice; -function scaleBinOrdinal() { - let domain = [], range = []; - function scale(x) { - return x == null || x !== x ? undefined : range[((0, _d3Array.bisect)(domain, x) - 1) % range.length]; - } - scale.domain = function(_) { - if (arguments.length) { - domain = numbers(_); - return scale; - } else return domain.slice(); + } + function interpolateNumber(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return a2 * (1 - t) + b2 * t; }; - scale.range = function(_) { - if (arguments.length) { - range = slice.call(_); - return scale; - } else return range.slice(); - }; - scale.tickFormat = function(count, specifier) { - return (0, _d3Scale.tickFormat)(domain[0], (0, _vegaUtil.peek)(domain), count == null ? 10 : count, specifier); - }; - scale.copy = function() { - return scaleBinOrdinal().domain(scale.domain()).range(scale.range()); - }; - return scale; -} -/** Private scale registry: should not be exported */ const scales = new Map(); -const VEGA_SCALE = Symbol('vega_scale'); -function registerScale(scale) { - scale[VEGA_SCALE] = true; - return scale; -} -/** - * Return true if object was created by a constructor from the vega-scale `scale` function. - */ function isRegisteredScale(scale) { - return scale && scale[VEGA_SCALE] === true; -} -/** - * Augment scales with their type and needed inverse methods. - */ function create(type, constructor, metadata) { - const ctr = function scale() { - const s = constructor(); - if (!s.invertRange) s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined; - s.type = type; - return registerScale(s); - }; - ctr.metadata = (0, _vegaUtil.toSet)((0, _vegaUtil.array)(metadata)); - return ctr; -} -/** - * Registry function for adding and accessing scale constructor functions. - * The *type* argument is a String indicating the name of the scale type. - * - * If the *scale* argument is not specified, this method returns the matching scale constructor in the registry, or `null` if not found. - * If the *scale* argument is provided, it must be a scale constructor function to add to the registry under the given *type* name. - * The *metadata* argument provides additional information to guide appropriate use of scales within Vega. - * - * *metadata* can be either a string or string array. The valid string values are: - * - `"continuous"` - the scale is defined over a continuous-valued domain. - * - `"discrete"` - the scale is defined over a discrete domain and range. - * - `"discretizing"` - the scale discretizes a continuous domain to a discrete range. - * - `"interpolating"` - the scale range is defined using a color interpolator. - * - `"log"` - the scale performs a logarithmic transform of the continuous domain. - * - `"temporal"` - the scale domain is defined over date-time values. - */ function scale(type, scale, metadata) { - if (arguments.length > 1) { - scales.set(type, create(type, scale, metadata)); - return this; - } else return isValidScaleType(type) ? scales.get(type) : undefined; -} -// identity scale -scale(Identity, _d3Scale.scaleIdentity); -// continuous scales -scale(Linear, _d3Scale.scaleLinear, Continuous); -scale(Log, _d3Scale.scaleLog, [ - Continuous, - Log -]); -scale(Pow, _d3Scale.scalePow, Continuous); -scale(Sqrt, _d3Scale.scaleSqrt, Continuous); -scale(Symlog, _d3Scale.scaleSymlog, Continuous); -scale(Time, _d3Scale.scaleTime, [ - Continuous, - Temporal -]); -scale(UTC, _d3Scale.scaleUtc, [ - Continuous, - Temporal -]); -// sequential scales -scale(Sequential, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); // backwards compat -scale(`${Sequential}-${Linear}`, _d3Scale.scaleSequential, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Log}`, _d3Scale.scaleSequentialLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Sequential}-${Pow}`, _d3Scale.scaleSequentialPow, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Sqrt}`, _d3Scale.scaleSequentialSqrt, [ - Continuous, - Interpolating -]); -scale(`${Sequential}-${Symlog}`, _d3Scale.scaleSequentialSymlog, [ - Continuous, - Interpolating -]); -// diverging scales -scale(`${Diverging}-${Linear}`, _d3Scale.scaleDiverging, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Log}`, _d3Scale.scaleDivergingLog, [ - Continuous, - Interpolating, - Log -]); -scale(`${Diverging}-${Pow}`, _d3Scale.scaleDivergingPow, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Sqrt}`, _d3Scale.scaleDivergingSqrt, [ - Continuous, - Interpolating -]); -scale(`${Diverging}-${Symlog}`, _d3Scale.scaleDivergingSymlog, [ - Continuous, - Interpolating -]); -// discretizing scales -scale(Quantile, _d3Scale.scaleQuantile, [ - Discretizing, - Quantile -]); -scale(Quantize, _d3Scale.scaleQuantize, Discretizing); -scale(Threshold, _d3Scale.scaleThreshold, Discretizing); -// discrete scales -scale(BinOrdinal, scaleBinOrdinal, [ - Discrete, - Discretizing -]); -scale(Ordinal, _d3Scale.scaleOrdinal, Discrete); -scale(Band, band, Discrete); -scale(Point, point, Discrete); -function isValidScaleType(type) { - return scales.has(type); -} -function hasType(key, type) { - const s = scales.get(key); - return s && s.metadata[type]; -} -function isContinuous(key) { - return hasType(key, Continuous); -} -function isDiscrete(key) { - return hasType(key, Discrete); -} -function isDiscretizing(key) { - return hasType(key, Discretizing); -} -function isLogarithmic(key) { - return hasType(key, Log); -} -function isTemporal(key) { - return hasType(key, Temporal); -} -function isInterpolating(key) { - return hasType(key, Interpolating); -} -function isQuantile(key) { - return hasType(key, Quantile); -} -const scaleProps = [ - 'clamp', - 'base', - 'constant', - 'exponent' -]; -function interpolateRange(interpolator, range) { - const start = range[0], span = (0, _vegaUtil.peek)(range) - start; - return function(i) { - return interpolator(start + i * span); - }; -} -function interpolateColors(colors, type, gamma) { - return _d3Interpolate.piecewise(interpolate(type || 'rgb', gamma), colors); -} -function quantizeInterpolator(interpolator, count) { - const samples = new Array(count), n = count + 1; - for(let i = 0; i < count;)samples[i] = interpolator(++i / n); - return samples; -} -function scaleCopy(scale) { - const t = scale.type, s = scale.copy(); - s.type = t; - return s; -} -function scaleFraction(scale$1, min, max) { - const delta = max - min; - let i, t, s; - if (!delta || !Number.isFinite(delta)) return (0, _vegaUtil.constant)(0.5); - else { - i = (t = scale$1.type).indexOf('-'); - t = i < 0 ? t : t.slice(i + 1); - s = scale(t)().domain([ - min, - max - ]).range([ - 0, - 1 - ]); - scaleProps.forEach((m)=>scale$1[m] ? s[m](scale$1[m]()) : 0); - return s; + } + function object(a2, b2) { + var i = {}, c2 = {}, k; + if (a2 === null || typeof a2 !== "object") a2 = {}; + if (b2 === null || typeof b2 !== "object") b2 = {}; + for (k in b2) { + if (k in a2) { + i[k] = interpolate$1(a2[k], b2[k]); + } else { + c2[k] = b2[k]; + } } -} -function interpolate(type, gamma) { - const interp = _d3Interpolate[method(type)]; - return gamma != null && interp && interp.gamma ? interp.gamma(gamma) : interp; -} -function method(type) { - return 'interpolate' + type.toLowerCase().split('-').map((s)=>s[0].toUpperCase() + s.slice(1)).join(''); -} -const continuous = { - blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90', - greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429', - greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e', - oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303', - purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c', - reds: 'fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13', - blueGreen: 'd5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429', - bluePurple: 'ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71', - greenBlue: 'd3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1', - orangeRed: 'fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403', - purpleBlue: 'dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281', - purpleBlueGreen: 'dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353', - purpleRed: 'dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a', - redPurple: 'fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174', - yellowGreen: 'e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034', - yellowOrangeBrown: 'feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204', - yellowOrangeRed: 'fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225', - blueOrange: '134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07', - brownBlueGreen: '704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147', - purpleGreen: '5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29', - purpleOrange: '4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07', - redBlue: '8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85', - redGrey: '8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434', - yellowGreenBlue: 'eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185', - redYellowBlue: 'a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695', - redYellowGreen: 'a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837', - pinkYellowGreen: '8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419', - spectral: '9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2', - viridis: '440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725', - magma: '0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf', - inferno: '0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4', - plasma: '0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921', - cividis: '00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647', - rainbow: '6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa', - sinebow: 'ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040', - turbo: '23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00', - browns: 'eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632', - tealBlues: 'bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985', - teals: 'bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667', - warmGreys: 'dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e', - goldGreen: 'f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36', - goldOrange: 'f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26', - goldRed: 'f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e', - lightGreyRed: 'efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b', - lightGreyTeal: 'e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc', - lightMulti: 'e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c', - lightOrange: 'f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b', - lightTealBlue: 'e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988', - darkBlue: '3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff', - darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff', - darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa', - darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff', - darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c' -}; -const discrete = { - accent: (0, _d3ScaleChromatic.schemeAccent), - category10: (0, _d3ScaleChromatic.schemeCategory10), - category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5', - category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6', - category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9', - dark2: (0, _d3ScaleChromatic.schemeDark2), - observable10: (0, _d3ScaleChromatic.schemeObservable10), - paired: (0, _d3ScaleChromatic.schemePaired), - pastel1: (0, _d3ScaleChromatic.schemePastel1), - pastel2: (0, _d3ScaleChromatic.schemePastel2), - set1: (0, _d3ScaleChromatic.schemeSet1), - set2: (0, _d3ScaleChromatic.schemeSet2), - set3: (0, _d3ScaleChromatic.schemeSet3), - tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac', - tableau20: '4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5' -}; -function colors(palette) { - if ((0, _vegaUtil.isArray)(palette)) return palette; - const n = palette.length / 6 | 0, c = new Array(n); - for(let i = 0; i < n;)c[i] = '#' + palette.slice(i * 6, ++i * 6); - return c; -} -function apply(_, f) { - for(const k in _)scheme(k, f(_[k])); -} -const schemes = {}; -apply(discrete, colors); -apply(continuous, (_)=>interpolateColors(colors(_))); -function scheme(name, scheme) { - name = name && name.toLowerCase(); - if (arguments.length > 1) { - schemes[name] = scheme; - return this; - } else return schemes[name]; -} -const SymbolLegend = 'symbol'; -const DiscreteLegend = 'discrete'; -const GradientLegend = 'gradient'; -const defaultFormatter = (value)=>(0, _vegaUtil.isArray)(value) ? value.map((v)=>String(v)) : String(value); -const ascending = (a, b)=>a[1] - b[1]; -const descending = (a, b)=>b[1] - a[1]; -/** - * Determine the tick count or interval function. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} count - The desired tick count or interval specifier. - * @param {number} minStep - The desired minimum step between tick values. - * @return {*} - The tick count or interval function. - */ function tickCount(scale, count, minStep) { - let step; - if ((0, _vegaUtil.isNumber)(count)) { - if (scale.bins) count = Math.max(count, scale.bins.length); - if (minStep != null) count = Math.min(count, Math.floor((0, _vegaUtil.span)(scale.domain()) / minStep || 1) + 1); - } - if ((0, _vegaUtil.isObject)(count)) { - step = count.step; - count = count.interval; - } - if ((0, _vegaUtil.isString)(count)) { - count = scale.type === Time ? (0, _vegaTime.timeInterval)(count) : scale.type == UTC ? (0, _vegaTime.utcInterval)(count) : (0, _vegaUtil.error)('Only time and utc scales accept interval strings.'); - if (step) count = count.every(step); - } - return count; -} -/** - * Filter a set of candidate tick values, ensuring that only tick values - * that lie within the scale range are included. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {Array<*>} ticks - The candidate tick values. - * @param {*} count - The tick count or interval function. - * @return {Array<*>} - The filtered tick values. - */ function validTicks(scale, ticks, count) { - let range = scale.range(), lo = range[0], hi = (0, _vegaUtil.peek)(range), cmp = ascending; - if (lo > hi) { - range = hi; - hi = lo; - lo = range; - cmp = descending; + return function(t) { + for (k in i) c2[k] = i[k](t); + return c2; + }; + } + var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); + function zero$1(b2) { + return function() { + return b2; + }; + } + function one$1(b2) { + return function(t) { + return b2(t) + ""; + }; + } + function string(a2, b2) { + var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; + a2 = a2 + "", b2 = b2 + ""; + while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) { + if ((bs = bm.index) > bi) { + bs = b2.slice(bi, bs); + if (s[i]) s[i] += bs; + else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { + if (s[i]) s[i] += bm; + else s[++i] = bm; + } else { + s[++i] = null; + q.push({ i, x: interpolateNumber(am, bm) }); + } + bi = reB.lastIndex; } - lo = Math.floor(lo); - hi = Math.ceil(hi); - // filter ticks to valid values within the range - // additionally sort ticks in range order (#2579) - ticks = ticks.map((v)=>[ - v, - scale(v) - ]).filter((_)=>lo <= _[1] && _[1] <= hi).sort(cmp).map((_)=>_[0]); - if (count > 0 && ticks.length > 1) { - const endpoints = [ - ticks[0], - (0, _vegaUtil.peek)(ticks) - ]; - while(ticks.length > count && ticks.length >= 3)ticks = ticks.filter((_, i)=>!(i % 2)); - if (ticks.length < 3) ticks = endpoints; - } - return ticks; -} -/** - * Generate tick values for the given scale and approximate tick count or - * interval value. If the scale has a 'ticks' method, it will be used to - * generate the ticks, with the count argument passed as a parameter. If the - * scale lacks a 'ticks' method, the full scale domain will be returned. - * @param {Scale} scale - The scale for which to generate tick values. - * @param {*} [count] - The approximate number of desired ticks. - * @return {Array<*>} - The generated tick values. - */ function tickValues(scale, count) { - return scale.bins ? validTicks(scale, scale.bins, count) : scale.ticks ? scale.ticks(count) : scale.domain(); -} -/** - * Generate a label format function for a scale. If the scale has a - * 'tickFormat' method, it will be used to generate the formatter, with the - * count and specifier arguments passed as parameters. If the scale lacks a - * 'tickFormat' method, the returned formatter performs simple string coercion. - * If the input scale is a logarithmic scale and the format specifier does not - * indicate a desired decimal precision, a special variable precision formatter - * that automatically trims trailing zeroes will be generated. - * @param {Scale} scale - The scale for which to generate the label formatter. - * @param {*} [count] - The approximate number of desired ticks. - * @param {string} [specifier] - The format specifier. Must be a legal d3 - * specifier string (see https://github.com/d3/d3-format#formatSpecifier) or - * time multi-format specifier object. - * @return {function(*):string} - The generated label formatter. - */ function tickFormat(locale, scale, count, specifier, formatType, noSkip) { - const type = scale.type; - let format = defaultFormatter; - if (type === Time || formatType === Time) format = locale.timeFormat(specifier); - else if (type === UTC || formatType === UTC) format = locale.utcFormat(specifier); - else if (isLogarithmic(type)) { - const varfmt = locale.formatFloat(specifier); - if (noSkip || scale.bins) format = varfmt; - else { - const test = tickLog(scale, count, false); - format = (_)=>test(_) ? varfmt(_) : ''; - } - } else if (scale.tickFormat) { - // if d3 scale has tickFormat, it must be continuous - const d = scale.domain(); - format = locale.formatSpan(d[0], d[d.length - 1], count, specifier); - } else if (specifier) format = locale.format(specifier); - return format; -} -function tickLog(scale, count, values) { - const ticks = tickValues(scale, count), base = scale.base(), logb = Math.log(base), k = Math.max(1, base * count / ticks.length); - // apply d3-scale's log format filter criteria - const test = (d)=>{ - let i = d / Math.pow(base, Math.round(Math.log(d) / logb)); - if (i * base < base - 0.5) i *= base; - return i <= k; - }; - return values ? ticks.filter(test) : test; -} -const symbols = { - [Quantile]: 'quantiles', - [Quantize]: 'thresholds', - [Threshold]: 'domain' -}; -const formats = { - [Quantile]: 'quantiles', - [Quantize]: 'domain' -}; -function labelValues(scale, count) { - return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : tickValues(scale, count); -} -function thresholdFormat(locale, scale, specifier) { - const _ = scale[formats[scale.type]](), n = _.length; - let d = n > 1 ? _[1] - _[0] : _[0], i; - for(i = 1; i < n; ++i)d = Math.min(d, _[i] - _[i - 1]); - // tickCount = 3 ticks times 10 for increased resolution - return locale.formatSpan(0, d, 30, specifier); -} -function thresholdValues(thresholds) { - const values = [ - -Infinity - ].concat(thresholds); - values.max = Infinity; - return values; -} -function binValues(bins) { - const values = bins.slice(0, -1); - values.max = (0, _vegaUtil.peek)(bins); - return values; -} -const isDiscreteRange = (scale)=>symbols[scale.type] || scale.bins; -function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) { - const format = formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat(locale, scale, count, specifier, formatType, noSkip); - return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format); -} -const formatRange = (format)=>(value, index, array)=>{ - const limit = get(array[index + 1], get(array.max, Infinity)), lo = formatValue(value, format), hi = formatValue(limit, format); - return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo; - }; -const get = (value, dflt)=>value != null ? value : dflt; -const formatDiscrete = (format)=>(value, index)=>index ? format(value) : null; -const formatPoint = (format)=>(value)=>format(value); -const formatValue = (value, format)=>Number.isFinite(value) ? format(value) : null; -function labelFraction(scale) { - const domain = scale.domain(), count = domain.length - 1; - let lo = +domain[0], hi = +(0, _vegaUtil.peek)(domain), span = hi - lo; - if (scale.type === Threshold) { - const adjust = count ? span / count : 0.1; - lo -= adjust; - hi += adjust; - span = hi - lo; - } - return (value)=>(value - lo) / span; -} -function format(locale, scale, specifier, formatType) { - const type = formatType || scale.type; - // replace abbreviated time specifiers to improve screen reader experience - if ((0, _vegaUtil.isString)(specifier) && isTemporal(type)) specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B'); - return !specifier && type === Time ? locale.timeFormat('%A, %d %B %Y, %X') : !specifier && type === UTC ? locale.utcFormat('%A, %d %B %Y, %X UTC') : labelFormat(locale, scale, 5, null, specifier, formatType, true); -} -function domainCaption(locale, scale, opt) { - opt = opt || {}; - const max = Math.max(3, opt.maxlen || 7), fmt = format(locale, scale, opt.format, opt.formatType); - // if scale breaks domain into bins, describe boundaries - if (isDiscretizing(scale.type)) { - const v = labelValues(scale).slice(1).map(fmt), n = v.length; - return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`; - } else if (isDiscrete(scale.type)) { - const d = scale.domain(), n = d.length, v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', '); - return `${n} value${n === 1 ? '' : 's'}: ${v}`; - } else { - const d = scale.domain(); - return `values from ${fmt(d[0])} to ${fmt((0, _vegaUtil.peek)(d))}`; - } -} - -},{"vega-util":"bApja","d3-array":"6IwJG","d3-scale":"9G9pz","d3-interpolate":"6gbPP","d3-scale-chromatic":"f3TcU","vega-time":"27kpp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9G9pz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "scaleBand", ()=>(0, _bandJsDefault.default)); -parcelHelpers.export(exports, "scalePoint", ()=>(0, _bandJs.point)); -parcelHelpers.export(exports, "scaleIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "scaleLinear", ()=>(0, _linearJsDefault.default)); -parcelHelpers.export(exports, "scaleLog", ()=>(0, _logJsDefault.default)); -parcelHelpers.export(exports, "scaleSymlog", ()=>(0, _symlogJsDefault.default)); -parcelHelpers.export(exports, "scaleOrdinal", ()=>(0, _ordinalJsDefault.default)); -parcelHelpers.export(exports, "scaleImplicit", ()=>(0, _ordinalJs.implicit)); -parcelHelpers.export(exports, "scalePow", ()=>(0, _powJsDefault.default)); -parcelHelpers.export(exports, "scaleSqrt", ()=>(0, _powJs.sqrt)); -parcelHelpers.export(exports, "scaleRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantile", ()=>(0, _quantileJsDefault.default)); -parcelHelpers.export(exports, "scaleQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "scaleThreshold", ()=>(0, _thresholdJsDefault.default)); -parcelHelpers.export(exports, "scaleTime", ()=>(0, _timeJsDefault.default)); -parcelHelpers.export(exports, "scaleUtc", ()=>(0, _utcTimeJsDefault.default)); -parcelHelpers.export(exports, "scaleSequential", ()=>(0, _sequentialJsDefault.default)); -parcelHelpers.export(exports, "scaleSequentialLog", ()=>(0, _sequentialJs.sequentialLog)); -parcelHelpers.export(exports, "scaleSequentialPow", ()=>(0, _sequentialJs.sequentialPow)); -parcelHelpers.export(exports, "scaleSequentialSqrt", ()=>(0, _sequentialJs.sequentialSqrt)); -parcelHelpers.export(exports, "scaleSequentialSymlog", ()=>(0, _sequentialJs.sequentialSymlog)); -parcelHelpers.export(exports, "scaleSequentialQuantile", ()=>(0, _sequentialQuantileJsDefault.default)); -parcelHelpers.export(exports, "scaleDiverging", ()=>(0, _divergingJsDefault.default)); -parcelHelpers.export(exports, "scaleDivergingLog", ()=>(0, _divergingJs.divergingLog)); -parcelHelpers.export(exports, "scaleDivergingPow", ()=>(0, _divergingJs.divergingPow)); -parcelHelpers.export(exports, "scaleDivergingSqrt", ()=>(0, _divergingJs.divergingSqrt)); -parcelHelpers.export(exports, "scaleDivergingSymlog", ()=>(0, _divergingJs.divergingSymlog)); -parcelHelpers.export(exports, "tickFormat", ()=>(0, _tickFormatJsDefault.default)); -var _bandJs = require("./band.js"); -var _bandJsDefault = parcelHelpers.interopDefault(_bandJs); -var _identityJs = require("./identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _linearJs = require("./linear.js"); -var _linearJsDefault = parcelHelpers.interopDefault(_linearJs); -var _logJs = require("./log.js"); -var _logJsDefault = parcelHelpers.interopDefault(_logJs); -var _symlogJs = require("./symlog.js"); -var _symlogJsDefault = parcelHelpers.interopDefault(_symlogJs); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -var _powJs = require("./pow.js"); -var _powJsDefault = parcelHelpers.interopDefault(_powJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _quantileJs = require("./quantile.js"); -var _quantileJsDefault = parcelHelpers.interopDefault(_quantileJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _thresholdJs = require("./threshold.js"); -var _thresholdJsDefault = parcelHelpers.interopDefault(_thresholdJs); -var _timeJs = require("./time.js"); -var _timeJsDefault = parcelHelpers.interopDefault(_timeJs); -var _utcTimeJs = require("./utcTime.js"); -var _utcTimeJsDefault = parcelHelpers.interopDefault(_utcTimeJs); -var _sequentialJs = require("./sequential.js"); -var _sequentialJsDefault = parcelHelpers.interopDefault(_sequentialJs); -var _sequentialQuantileJs = require("./sequentialQuantile.js"); -var _sequentialQuantileJsDefault = parcelHelpers.interopDefault(_sequentialQuantileJs); -var _divergingJs = require("./diverging.js"); -var _divergingJsDefault = parcelHelpers.interopDefault(_divergingJs); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); - -},{"./band.js":"6WWiS","./identity.js":"le9d2","./linear.js":"5CETT","./log.js":"2gcSE","./symlog.js":"iUUr7","./ordinal.js":"1j3zZ","./pow.js":"i4lyo","./radial.js":"5ODOz","./quantile.js":"aAURo","./quantize.js":"jjcn6","./threshold.js":"8ndX3","./time.js":"cjAqm","./utcTime.js":"cM5gE","./sequential.js":"f1sM1","./sequentialQuantile.js":"cSmYu","./diverging.js":"9Qcq3","./tickFormat.js":"dksn9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6WWiS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>band); -parcelHelpers.export(exports, "point", ()=>point); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -var _ordinalJs = require("./ordinal.js"); -var _ordinalJsDefault = parcelHelpers.interopDefault(_ordinalJs); -function band() { - var scale = (0, _ordinalJsDefault.default)().unknown(undefined), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; - delete scale.unknown; - function rescale() { - var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1; - step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); - if (round) step = Math.floor(step); - start += (stop - start - step * (n - paddingInner)) * align; - bandwidth = step * (1 - paddingInner); - if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); - var values = (0, _d3Array.range)(n).map(function(i) { - return start + step * i; - }); - return ordinalRange(reverse ? values.reverse() : values); - } - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.range = function(_) { - return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [ - r0, - r1 - ]; - }; - scale.rangeRound = function(_) { - return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale(); - }; - scale.bandwidth = function() { - return bandwidth; - }; - scale.step = function() { - return step; - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, rescale()) : round; - }; - scale.padding = function(_) { - return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner; - }; - scale.paddingInner = function(_) { - return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner; - }; - scale.paddingOuter = function(_) { - return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter; - }; - scale.align = function(_) { - return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; - }; - scale.copy = function() { - return band(domain(), [ - r0, - r1 - ]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); - }; - return (0, _initJs.initRange).apply(rescale(), arguments); -} -function pointish(scale) { - var copy = scale.copy; - scale.padding = scale.paddingOuter; - delete scale.paddingInner; - delete scale.paddingOuter; - scale.copy = function() { - return pointish(copy()); - }; - return scale; -} -function point() { - return pointish(band.apply(null, arguments).paddingInner(1)); -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","./ordinal.js":"1j3zZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kLKEv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initRange", ()=>initRange); -parcelHelpers.export(exports, "initInterpolator", ()=>initInterpolator); -function initRange(domain, range) { - switch(arguments.length){ - case 0: - break; - case 1: - this.range(domain); - break; - default: - this.range(range).domain(domain); - break; + if (bi < b2.length) { + bs = b2.slice(bi); + if (s[i]) s[i] += bs; + else s[++i] = bs; } - return this; -} -function initInterpolator(domain, interpolator) { - switch(arguments.length){ - case 0: - break; - case 1: - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); - break; - default: - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); - break; + return s.length < 2 ? q[0] ? one$1(q[0].x) : zero$1(b2) : (b2 = q.length, function(t) { + for (var i2 = 0, o; i2 < b2; ++i2) s[(o = q[i2]).i] = o.x(t); + return s.join(""); + }); + } + function interpolate$1(a2, b2) { + var t = typeof b2, c2; + return b2 == null || t === "boolean" ? constant$2(b2) : (t === "number" ? interpolateNumber : t === "string" ? (c2 = color$2(b2)) ? (b2 = c2, rgb) : string : b2 instanceof color$2 ? rgb : b2 instanceof Date ? date$1 : isNumberArray(b2) ? numberArray : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object : interpolateNumber)(a2, b2); + } + function discrete$1(range2) { + var n = range2.length; + return function(t) { + return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; + }; + } + function hue(a2, b2) { + var i = hue$1(+a2, +b2); + return function(t) { + var x2 = i(t); + return x2 - 360 * Math.floor(x2 / 360); + }; + } + function interpolateRound(a2, b2) { + return a2 = +a2, b2 = +b2, function(t) { + return Math.round(a2 * (1 - t) + b2 * t); + }; + } + var degrees$1 = 180 / Math.PI; + var identity$4 = { + translateX: 0, + translateY: 0, + rotate: 0, + skewX: 0, + scaleX: 1, + scaleY: 1 + }; + function decompose(a2, b2, c2, d, e, f) { + var scaleX, scaleY2, skewX; + if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX; + if (skewX = a2 * c2 + b2 * d) c2 -= a2 * skewX, d -= b2 * skewX; + if (scaleY2 = Math.sqrt(c2 * c2 + d * d)) c2 /= scaleY2, d /= scaleY2, skewX /= scaleY2; + if (a2 * d < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e, + translateY: f, + rotate: Math.atan2(b2, a2) * degrees$1, + skewX: Math.atan(skewX) * degrees$1, + scaleX, + scaleY: scaleY2 + }; + } + var svgNode; + function parseCss(value2) { + const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value2 + ""); + return m2.isIdentity ? identity$4 : decompose(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f); + } + function parseSvg(value2) { + if (value2 == null) return identity$4; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value2); + if (!(value2 = svgNode.transform.baseVal.consolidate())) return identity$4; + value2 = value2.matrix; + return decompose(value2.a, value2.b, value2.c, value2.d, value2.e, value2.f); + } + function interpolateTransform(parse2, pxComma, pxParen, degParen) { + function pop(s) { + return s.length ? s.pop() + " " : ""; + } + function translate2(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push("translate(", null, pxComma, null, pxParen); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb || yb) { + s.push("translate(" + xb + pxComma + yb + pxParen); + } } - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1j3zZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "implicit", ()=>implicit); -parcelHelpers.export(exports, "default", ()=>ordinal); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -const implicit = Symbol("implicit"); -function ordinal() { - var index = new (0, _d3Array.InternMap)(), domain = [], range = [], unknown = implicit; - function scale(d) { - let i = index.get(d); - if (i === undefined) { - if (unknown !== implicit) return unknown; - index.set(d, i = domain.push(d) - 1); - } - return range[i % range.length]; - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = [], index = new (0, _d3Array.InternMap)(); - for (const value of _){ - if (index.has(value)) continue; - index.set(value, domain.push(value) - 1); - } - return scale; - }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), scale) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return ordinal(domain, range).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"le9d2":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>identity); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function identity(domain) { - var unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : x; + function rotate2(a2, b2, s, q) { + if (a2 !== b2) { + if (a2 - b2 > 180) b2 += 360; + else if (b2 - a2 > 180) a2 += 360; + q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s.push(pop(s) + "rotate(" + b2 + degParen); + } + } + function skewX(a2, b2, s, q) { + if (a2 !== b2) { + q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: interpolateNumber(a2, b2) }); + } else if (b2) { + s.push(pop(s) + "skewX(" + b2 + degParen); + } + } + function scale2(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push(pop(s) + "scale(", null, ",", null, ")"); + q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); + } else if (xb !== 1 || yb !== 1) { + s.push(pop(s) + "scale(" + xb + "," + yb + ")"); + } + } + return function(a2, b2) { + var s = [], q = []; + a2 = parse2(a2), b2 = parse2(b2); + translate2(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s, q); + rotate2(a2.rotate, b2.rotate, s, q); + skewX(a2.skewX, b2.skewX, s, q); + scale2(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s, q); + a2 = b2 = null; + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; + } + var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); + var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + var epsilon2$1 = 1e-12; + function cosh(x2) { + return ((x2 = Math.exp(x2)) + 1 / x2) / 2; + } + function sinh(x2) { + return ((x2 = Math.exp(x2)) - 1 / x2) / 2; + } + function tanh(x2) { + return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1); + } + const zoom = (function zoomRho(rho, rho2, rho4) { + function zoom2(p02, p1) { + var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; + if (d2 < epsilon2$1) { + S = Math.log(w1 / w0) / rho; + i = function(t) { + return [ + ux0 + t * dx, + uy0 + t * dy, + w0 * Math.exp(rho * t * S) + ]; + }; + } else { + var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / rho; + i = function(t) { + var s = t * S, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); + return [ + ux0 + u2 * dx, + uy0 + u2 * dy, + w0 * coshr0 / cosh(rho * s + r0) + ]; + }; + } + i.duration = S * 1e3 * rho / Math.SQRT2; + return i; } - scale.invert = scale; - scale.domain = scale.range = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), scale) : domain.slice(); + zoom2.rho = function(_) { + var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; + return zoomRho(_1, _2, _4); }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + return zoom2; + })(Math.SQRT2, 2, 4); + function hsl(hue2) { + return function(start, end) { + var h2 = hue2((start = hsl$1(start)).h, (end = hsl$1(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.s = s(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; }; - scale.copy = function() { - return identity(domain).unknown(unknown); + } + const hsl_default = hsl(hue$1); + var hslLong = hsl(nogamma); + function lab(start, end) { + var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l), a2 = nogamma(start.a, end.a), b2 = nogamma(start.b, end.b), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.l = l(t); + start.a = a2(t); + start.b = b2(t); + start.opacity = opacity(t); + return start + ""; }; - domain = arguments.length ? Array.from(domain, (0, _numberJsDefault.default)) : [ - 0, - 1 - ]; - return (0, _linearJs.linearish)(scale); -} - -},{"./linear.js":"5CETT","./number.js":"bOzsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5CETT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "linearish", ()=>linearish); -parcelHelpers.export(exports, "default", ()=>linear); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _tickFormatJs = require("./tickFormat.js"); -var _tickFormatJsDefault = parcelHelpers.interopDefault(_tickFormatJs); -function linearish(scale) { - var domain = scale.domain; - scale.ticks = function(count) { - var d = domain(); - return (0, _d3Array.ticks)(d[0], d[d.length - 1], count == null ? 10 : count); - }; - scale.tickFormat = function(count, specifier) { - var d = domain(); - return (0, _tickFormatJsDefault.default)(d[0], d[d.length - 1], count == null ? 10 : count, specifier); - }; - scale.nice = function(count) { - if (count == null) count = 10; - var d = domain(); - var i0 = 0; - var i1 = d.length - 1; - var start = d[i0]; - var stop = d[i1]; - var prestep; - var step; - var maxIter = 10; - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - while(maxIter-- > 0){ - step = (0, _d3Array.tickIncrement)(start, stop, count); - if (step === prestep) { - d[i0] = start; - d[i1] = stop; - return domain(d); - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } else break; - prestep = step; - } - return scale; - }; - return scale; -} -function linear() { - var scale = (0, _continuousJsDefault.default)(); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, linear()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return linearish(scale); -} - -},{"d3-array":"6IwJG","./continuous.js":"it8xE","./init.js":"kLKEv","./tickFormat.js":"dksn9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"it8xE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "transformer", ()=>transformer); -parcelHelpers.export(exports, "default", ()=>continuous); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var unit = [ - 0, - 1 -]; -function identity(x) { - return x; -} -function normalize(a, b) { - return (b -= a = +a) ? function(x) { - return (x - a) / b; - } : (0, _constantJsDefault.default)(isNaN(b) ? NaN : 0.5); -} -function clamper(a, b) { + } + function hcl(hue2) { + return function(start, end) { + var h2 = hue2((start = hcl$1(start)).h, (end = hcl$1(end)).h), c2 = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.c = c2(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; + }; + } + const hcl_default = hcl(hue$1); + var hclLong = hcl(nogamma); + function cubehelix(hue2) { + return (function cubehelixGamma(y2) { + y2 = +y2; + function cubehelix2(start, end) { + var h2 = hue2((start = cubehelix$1(start)).h, (end = cubehelix$1(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h2(t); + start.s = s(t); + start.l = l(Math.pow(t, y2)); + start.opacity = opacity(t); + return start + ""; + }; + } + cubehelix2.gamma = cubehelixGamma; + return cubehelix2; + })(1); + } + const cubehelix_default = cubehelix(hue$1); + var cubehelixLong = cubehelix(nogamma); + function piecewise(interpolate2, values2) { + if (values2 === void 0) values2 = interpolate2, interpolate2 = interpolate$1; + var i = 0, n = values2.length - 1, v = values2[0], I = new Array(n < 0 ? 0 : n); + while (i < n) I[i] = interpolate2(v, v = values2[++i]); + return function(t) { + var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); + return I[i2](t - i2); + }; + } + function quantize$2(interpolator, n) { + var samples = new Array(n); + for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + return samples; + } + const $$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + interpolate: interpolate$1, + interpolateArray: array$3, + interpolateBasis: basis$1, + interpolateBasisClosed: basisClosed, + interpolateCubehelix: cubehelix_default, + interpolateCubehelixLong: cubehelixLong, + interpolateDate: date$1, + interpolateDiscrete: discrete$1, + interpolateHcl: hcl_default, + interpolateHclLong: hclLong, + interpolateHsl: hsl_default, + interpolateHslLong: hslLong, + interpolateHue: hue, + interpolateLab: lab, + interpolateNumber, + interpolateNumberArray: numberArray, + interpolateObject: object, + interpolateRgb: rgb, + interpolateRgbBasis: rgbBasis, + interpolateRgbBasisClosed: rgbBasisClosed, + interpolateRound, + interpolateString: string, + interpolateTransformCss, + interpolateTransformSvg, + interpolateZoom: zoom, + piecewise, + quantize: quantize$2 + }, Symbol.toStringTag, { value: "Module" })); + function constants(x2) { + return function() { + return x2; + }; + } + function number$5(x2) { + return +x2; + } + var unit = [0, 1]; + function identity$3(x2) { + return x2; + } + function normalize$4(a2, b2) { + return (b2 -= a2 = +a2) ? function(x2) { + return (x2 - a2) / b2; + } : constants(isNaN(b2) ? NaN : 0.5); + } + function clamper(a2, b2) { var t; - if (a > b) t = a, a = b, b = t; - return function(x) { - return Math.max(a, Math.min(b, x)); - }; -} -// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. -// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. -function bimap(domain, range, interpolate) { - var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; - if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); - else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); - return function(x) { - return r0(d0(x)); - }; -} -function polymap(domain, range, interpolate) { - var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1; - // Reverse descending domains. - if (domain[j] < domain[0]) { - domain = domain.slice().reverse(); - range = range.slice().reverse(); - } - while(++i < j){ - d[i] = normalize(domain[i], domain[i + 1]); - r[i] = interpolate(range[i], range[i + 1]); - } - return function(x) { - var i = (0, _d3Array.bisect)(domain, x, 1, j) - 1; - return r[i](d[i](x)); - }; -} -function copy(source, target) { - return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); -} -function transformer() { - var domain = unit, range = unit, interpolate = (0, _d3Interpolate.interpolate), transform, untransform, unknown, clamp = identity, piecewise, output, input; + if (a2 > b2) t = a2, a2 = b2, b2 = t; + return function(x2) { + return Math.max(a2, Math.min(b2, x2)); + }; + } + function bimap(domain2, range2, interpolate2) { + var d0 = domain2[0], d1 = domain2[1], r0 = range2[0], r1 = range2[1]; + if (d1 < d0) d0 = normalize$4(d1, d0), r0 = interpolate2(r1, r0); + else d0 = normalize$4(d0, d1), r0 = interpolate2(r0, r1); + return function(x2) { + return r0(d0(x2)); + }; + } + function polymap(domain2, range2, interpolate2) { + var j = Math.min(domain2.length, range2.length) - 1, d = new Array(j), r = new Array(j), i = -1; + if (domain2[j] < domain2[0]) { + domain2 = domain2.slice().reverse(); + range2 = range2.slice().reverse(); + } + while (++i < j) { + d[i] = normalize$4(domain2[i], domain2[i + 1]); + r[i] = interpolate2(range2[i], range2[i + 1]); + } + return function(x2) { + var i2 = bisectRight$1(domain2, x2, 1, j) - 1; + return r[i2](d[i2](x2)); + }; + } + function copy$7(source2, target2) { + return target2.domain(source2.domain()).range(source2.range()).interpolate(source2.interpolate()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function transformer$3() { + var domain2 = unit, range2 = unit, interpolate2 = interpolate$1, transform2, untransform, unknown, clamp2 = identity$3, piecewise2, output2, input; function rescale() { - var n = Math.min(domain.length, range.length); - if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]); - piecewise = n > 2 ? polymap : bimap; - output = input = null; - return scale; + var n = Math.min(domain2.length, range2.length); + if (clamp2 !== identity$3) clamp2 = clamper(domain2[0], domain2[n - 1]); + piecewise2 = n > 2 ? polymap : bimap; + output2 = input = null; + return scale2; } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : (output2 || (output2 = piecewise2(domain2.map(transform2), range2, interpolate2)))(transform2(clamp2(x2))); } - scale.invert = function(y) { - return clamp(untransform((input || (input = piecewise(range, domain.map(transform), (0, _d3Interpolate.interpolateNumber))))(y))); + scale2.invert = function(y2) { + return clamp2(untransform((input || (input = piecewise2(range2, domain2.map(transform2), interpolateNumber)))(y2))); }; - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_, (0, _numberJsDefault.default)), rescale()) : domain.slice(); + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), rescale()) : domain2.slice(); }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); }; - scale.rangeRound = function(_) { - return range = Array.from(_), interpolate = (0, _d3Interpolate.interpolateRound), rescale(); + scale2.rangeRound = function(_) { + return range2 = Array.from(_), interpolate2 = interpolateRound, rescale(); }; - scale.clamp = function(_) { - return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = _ ? true : identity$3, rescale()) : clamp2 !== identity$3; }; - scale.interpolate = function(_) { - return arguments.length ? (interpolate = _, rescale()) : interpolate; + scale2.interpolate = function(_) { + return arguments.length ? (interpolate2 = _, rescale()) : interpolate2; }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; - return function(t, u) { - transform = t, untransform = u; - return rescale(); + return function(t, u2) { + transform2 = t, untransform = u2; + return rescale(); }; -} -function continuous() { - return transformer()(identity, identity); -} - -},{"d3-array":"6IwJG","d3-interpolate":"6gbPP","./constant.js":"9JgB5","./number.js":"bOzsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6gbPP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolate", ()=>(0, _valueJsDefault.default)); -parcelHelpers.export(exports, "interpolateArray", ()=>(0, _arrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasis", ()=>(0, _basisJsDefault.default)); -parcelHelpers.export(exports, "interpolateBasisClosed", ()=>(0, _basisClosedJsDefault.default)); -parcelHelpers.export(exports, "interpolateDate", ()=>(0, _dateJsDefault.default)); -parcelHelpers.export(exports, "interpolateDiscrete", ()=>(0, _discreteJsDefault.default)); -parcelHelpers.export(exports, "interpolateHue", ()=>(0, _hueJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumber", ()=>(0, _numberJsDefault.default)); -parcelHelpers.export(exports, "interpolateNumberArray", ()=>(0, _numberArrayJsDefault.default)); -parcelHelpers.export(exports, "interpolateObject", ()=>(0, _objectJsDefault.default)); -parcelHelpers.export(exports, "interpolateRound", ()=>(0, _roundJsDefault.default)); -parcelHelpers.export(exports, "interpolateString", ()=>(0, _stringJsDefault.default)); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>(0, _indexJs.interpolateTransformCss)); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>(0, _indexJs.interpolateTransformSvg)); -parcelHelpers.export(exports, "interpolateZoom", ()=>(0, _zoomJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgb", ()=>(0, _rgbJsDefault.default)); -parcelHelpers.export(exports, "interpolateRgbBasis", ()=>(0, _rgbJs.rgbBasis)); -parcelHelpers.export(exports, "interpolateRgbBasisClosed", ()=>(0, _rgbJs.rgbBasisClosed)); -parcelHelpers.export(exports, "interpolateHsl", ()=>(0, _hslJsDefault.default)); -parcelHelpers.export(exports, "interpolateHslLong", ()=>(0, _hslJs.hslLong)); -parcelHelpers.export(exports, "interpolateLab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "interpolateHcl", ()=>(0, _hclJsDefault.default)); -parcelHelpers.export(exports, "interpolateHclLong", ()=>(0, _hclJs.hclLong)); -parcelHelpers.export(exports, "interpolateCubehelix", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixLong", ()=>(0, _cubehelixJs.cubehelixLong)); -parcelHelpers.export(exports, "piecewise", ()=>(0, _piecewiseJsDefault.default)); -parcelHelpers.export(exports, "quantize", ()=>(0, _quantizeJsDefault.default)); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _arrayJs = require("./array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _discreteJs = require("./discrete.js"); -var _discreteJsDefault = parcelHelpers.interopDefault(_discreteJs); -var _hueJs = require("./hue.js"); -var _hueJsDefault = parcelHelpers.interopDefault(_hueJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _indexJs = require("./transform/index.js"); -var _zoomJs = require("./zoom.js"); -var _zoomJsDefault = parcelHelpers.interopDefault(_zoomJs); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _hslJs = require("./hsl.js"); -var _hslJsDefault = parcelHelpers.interopDefault(_hslJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _hclJs = require("./hcl.js"); -var _hclJsDefault = parcelHelpers.interopDefault(_hclJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _piecewiseJs = require("./piecewise.js"); -var _piecewiseJsDefault = parcelHelpers.interopDefault(_piecewiseJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); - -},{"./value.js":"j390F","./array.js":"ak2mg","./basis.js":"aODfz","./basisClosed.js":"iMwsl","./date.js":"5kKci","./discrete.js":"kwucC","./hue.js":"l0WHx","./number.js":"e4PyF","./numberArray.js":"erlaq","./object.js":"4rZkd","./round.js":"l8dm5","./string.js":"5Q7tf","./transform/index.js":"ccQ0p","./zoom.js":"hXWwx","./rgb.js":"bXjD7","./hsl.js":"2r5a3","./lab.js":"4EvaS","./hcl.js":"CZyDl","./cubehelix.js":"1wxKY","./piecewise.js":"dHOj6","./quantize.js":"7aRYJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j390F":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var t = typeof b, c; - return b == null || t === "boolean" ? (0, _constantJsDefault.default)(b) : (t === "number" ? (0, _numberJsDefault.default) : t === "string" ? (c = (0, _d3Color.color)(b)) ? (b = c, _rgbJsDefault.default) : (0, _stringJsDefault.default) : b instanceof (0, _d3Color.color) ? (0, _rgbJsDefault.default) : b instanceof Date ? (0, _dateJsDefault.default) : (0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : Array.isArray(b) ? (0, _arrayJs.genericArray) : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? (0, _objectJsDefault.default) : (0, _numberJsDefault.default))(a, b); - }); -var _d3Color = require("d3-color"); -var _rgbJs = require("./rgb.js"); -var _rgbJsDefault = parcelHelpers.interopDefault(_rgbJs); -var _arrayJs = require("./array.js"); -var _dateJs = require("./date.js"); -var _dateJsDefault = parcelHelpers.interopDefault(_dateJs); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _objectJs = require("./object.js"); -var _objectJsDefault = parcelHelpers.interopDefault(_objectJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); - -},{"d3-color":"7SCp9","./rgb.js":"bXjD7","./array.js":"ak2mg","./date.js":"5kKci","./number.js":"e4PyF","./object.js":"4rZkd","./string.js":"5Q7tf","./constant.js":"3lDJx","./numberArray.js":"erlaq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7SCp9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "color", ()=>(0, _colorJsDefault.default)); -parcelHelpers.export(exports, "rgb", ()=>(0, _colorJs.rgb)); -parcelHelpers.export(exports, "hsl", ()=>(0, _colorJs.hsl)); -parcelHelpers.export(exports, "lab", ()=>(0, _labJsDefault.default)); -parcelHelpers.export(exports, "hcl", ()=>(0, _labJs.hcl)); -parcelHelpers.export(exports, "lch", ()=>(0, _labJs.lch)); -parcelHelpers.export(exports, "gray", ()=>(0, _labJs.gray)); -parcelHelpers.export(exports, "cubehelix", ()=>(0, _cubehelixJsDefault.default)); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -var _labJs = require("./lab.js"); -var _labJsDefault = parcelHelpers.interopDefault(_labJs); -var _cubehelixJs = require("./cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); - -},{"./color.js":"cJlE6","./lab.js":"3FaCQ","./cubehelix.js":"6YqvJ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cJlE6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -parcelHelpers.export(exports, "darker", ()=>darker); -parcelHelpers.export(exports, "brighter", ()=>brighter); -parcelHelpers.export(exports, "default", ()=>color); -parcelHelpers.export(exports, "rgbConvert", ()=>rgbConvert); -parcelHelpers.export(exports, "rgb", ()=>rgb); -parcelHelpers.export(exports, "Rgb", ()=>Rgb); -parcelHelpers.export(exports, "hslConvert", ()=>hslConvert); -parcelHelpers.export(exports, "hsl", ()=>hsl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -function Color() {} -var darker = 0.7; -var brighter = 1 / darker; -var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`); -var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 -}; -(0, _defineJsDefault.default)(Color, color, { - copy (channels) { - return Object.assign(new this.constructor, this, channels); - }, - displayable () { - return this.rgb().displayable(); - }, - hex: color_formatHex, - formatHex: color_formatHex, - formatHex8: color_formatHex8, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb -}); -function color_formatHex() { - return this.rgb().formatHex(); -} -function color_formatHex8() { - return this.rgb().formatHex8(); -} -function color_formatHsl() { - return hslConvert(this).formatHsl(); -} -function color_formatRgb() { - return this.rgb().formatRgb(); -} -function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 - : null // invalid hex - ) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; -} -function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); -} -function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); -} -function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); -} -function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); -} -function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Rgb, rgb, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb () { - return this; - }, - clamp () { - return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); - }, - displayable () { - return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; - }, - hex: rgb_formatHex, - formatHex: rgb_formatHex, - formatHex8: rgb_formatHex8, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb -})); -function rgb_formatHex() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`; -} -function rgb_formatHex8() { - return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; -} -function rgb_formatRgb() { - const a = clampa(this.opacity); - return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`; -} -function clampa(opacity) { - return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); -} -function clampi(value) { - return Math.max(0, Math.min(255, Math.round(value) || 0)); -} -function hex(value) { - value = clampi(value); - return (value < 16 ? "0" : "") + value.toString(16); -} -function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); -} -function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else s = l > 0 && l < 1 ? 0 : h; - return new Hsl(h, s, l, o.opacity); -} -function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); -} -function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Hsl, hsl, (0, _defineJs.extend)(Color, { - brighter (k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2; - return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); - }, - clamp () { - return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); - }, - displayable () { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; - }, - formatHsl () { - const a = clampa(this.opacity); - return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`; - } -})); -function clamph(value) { - value = (value || 0) % 360; - return value < 0 ? value + 360 : value; -} -function clampt(value) { - return Math.max(0, Math.min(1, value || 0)); -} -/* From FvD 13.37, CSS Color Module Level 3 */ function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; -} - -},{"./define.js":"fa5me","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fa5me":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - }); -parcelHelpers.export(exports, "extend", ()=>extend); -function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for(var key in definition)prototype[key] = definition[key]; - return prototype; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3FaCQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gray", ()=>gray); -parcelHelpers.export(exports, "default", ()=>lab); -parcelHelpers.export(exports, "Lab", ()=>Lab); -parcelHelpers.export(exports, "lch", ()=>lch); -parcelHelpers.export(exports, "hcl", ()=>hcl); -parcelHelpers.export(exports, "Hcl", ()=>Hcl); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -// https://observablehq.com/@mbostock/lab-and-rgb -const K = 18, Xn = 0.96422, Yn = 1, Zn = 0.82521, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1; -function labConvert(o) { - if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); - if (o instanceof Hcl) return hcl2lab(o); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = rgb2lrgb(o.r), g = rgb2lrgb(o.g), b = rgb2lrgb(o.b), y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z; - if (r === g && g === b) x = z = y; - else { - x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn); - z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn); - } - return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); -} -function gray(l, opacity) { - return new Lab(l, 0, 0, opacity == null ? 1 : opacity); -} -function lab(l, a, b, opacity) { - return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); -} -function Lab(l, a, b, opacity) { - this.l = +l; - this.a = +a; - this.b = +b; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Lab, lab, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - darker (k) { - return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity); - }, - rgb () { - var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200; - x = Xn * lab2xyz(x); - y = Yn * lab2xyz(y); - z = Zn * lab2xyz(z); - return new (0, _colorJs.Rgb)(lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity); - } -})); -function xyz2lab(t) { - return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; -} -function lab2xyz(t) { - return t > t1 ? t * t * t : t2 * (t - t0); -} -function lrgb2rgb(x) { - return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); -} -function rgb2lrgb(x) { - return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); -} -function hclConvert(o) { - if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); - if (!(o instanceof Lab)) o = labConvert(o); - if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity); - var h = Math.atan2(o.b, o.a) * (0, _mathJs.degrees); - return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); -} -function lch(l, c, h, opacity) { - return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function hcl(h, c, l, opacity) { - return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); -} -function Hcl(h, c, l, opacity) { - this.h = +h; - this.c = +c; - this.l = +l; - this.opacity = +opacity; -} -function hcl2lab(o) { - if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity); - var h = o.h * (0, _mathJs.radians); - return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); -} -(0, _defineJsDefault.default)(Hcl, hcl, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity); - }, - darker (k) { - return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity); - }, - rgb () { - return hcl2lab(this).rgb(); - } -})); - -},{"./define.js":"fa5me","./color.js":"cJlE6","./math.js":"2h5K4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2h5K4":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "degrees", ()=>degrees); -const radians = Math.PI / 180; -const degrees = 180 / Math.PI; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6YqvJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>cubehelix); -parcelHelpers.export(exports, "Cubehelix", ()=>Cubehelix); -var _defineJs = require("./define.js"); -var _defineJsDefault = parcelHelpers.interopDefault(_defineJs); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -var A = -0.14861, B = 1.78277, C = -0.29227, D = -0.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A; -function cubehelixConvert(o) { - if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof (0, _colorJs.Rgb))) o = (0, _colorJs.rgbConvert)(o); - var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * (0, _mathJs.degrees) - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); -} -function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); -} -function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; -} -(0, _defineJsDefault.default)(Cubehelix, cubehelix, (0, _defineJs.extend)((0, _colorJs.Color), { - brighter (k) { - k = k == null ? (0, _colorJs.brighter) : Math.pow((0, _colorJs.brighter), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker (k) { - k = k == null ? (0, _colorJs.darker) : Math.pow((0, _colorJs.darker), k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb () { - var h = isNaN(this.h) ? 0 : (this.h + 120) * (0, _mathJs.radians), l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h); - return new (0, _colorJs.Rgb)(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); - } -})); - -},{"./define.js":"fa5me","./color.js":"cJlE6","./math.js":"2h5K4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bXjD7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rgbBasis", ()=>rgbBasis); -parcelHelpers.export(exports, "rgbBasisClosed", ()=>rgbBasisClosed); -var _d3Color = require("d3-color"); -var _basisJs = require("./basis.js"); -var _basisJsDefault = parcelHelpers.interopDefault(_basisJs); -var _basisClosedJs = require("./basisClosed.js"); -var _basisClosedJsDefault = parcelHelpers.interopDefault(_basisClosedJs); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -exports.default = function rgbGamma(y) { - var color = (0, _colorJs.gamma)(y); - function rgb(start, end) { - var r = color((start = (0, _d3Color.rgb)(start)).r, (end = (0, _d3Color.rgb)(end)).r), g = color(start.g, end.g), b = color(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; + } + function continuous$1() { + return transformer$3()(identity$3, identity$3); + } + function tickFormat$1(start, stop2, count2, specifier) { + var step = tickStep(start, stop2, count2), precision; + specifier = formatSpecifier(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value2 = Math.max(Math.abs(start), Math.abs(stop2)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value2))) specifier.precision = precision; + return formatPrefix(specifier, value2); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop2))))) specifier.precision = precision - (specifier.type === "e"); + break; + } + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; + break; + } } - rgb.gamma = rgbGamma; - return rgb; -}(1); -function rgbSpline(spline) { - return function(colors) { - var n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color; - for(i = 0; i < n; ++i){ - color = (0, _d3Color.rgb)(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function(t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; + return format$3(specifier); + } + function linearish(scale2) { + var domain2 = scale2.domain; + scale2.ticks = function(count2) { + var d = domain2(); + return ticks(d[0], d[d.length - 1], count2 == null ? 10 : count2); + }; + scale2.tickFormat = function(count2, specifier) { + var d = domain2(); + return tickFormat$1(d[0], d[d.length - 1], count2 == null ? 10 : count2, specifier); + }; + scale2.nice = function(count2) { + if (count2 == null) count2 = 10; + var d = domain2(); + var i0 = 0; + var i1 = d.length - 1; + var start = d[i0]; + var stop2 = d[i1]; + var prestep; + var step; + var maxIter = 10; + if (stop2 < start) { + step = start, start = stop2, stop2 = step; + step = i0, i0 = i1, i1 = step; + } + while (maxIter-- > 0) { + step = tickIncrement(start, stop2, count2); + if (step === prestep) { + d[i0] = start; + d[i1] = stop2; + return domain2(d); + } else if (step > 0) { + start = Math.floor(start / step) * step; + stop2 = Math.ceil(stop2 / step) * step; + } else if (step < 0) { + start = Math.ceil(start * step) / step; + stop2 = Math.floor(stop2 * step) / step; + } else { + break; + } + prestep = step; + } + return scale2; }; -} -var rgbBasis = rgbSpline((0, _basisJsDefault.default)); -var rgbBasisClosed = rgbSpline((0, _basisClosedJsDefault.default)); - -},{"d3-color":"7SCp9","./basis.js":"aODfz","./basisClosed.js":"iMwsl","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aODfz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "basis", ()=>basis); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length - 1; - return function(t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - }); -function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, t3 = t2 * t1; - return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iMwsl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(values) { - var n = values.length; - return function(t) { - var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; - return (0, _basisJs.basis)((t - i / n) * n, v0, v1, v2, v3); - }; - }); -var _basisJs = require("./basis.js"); - -},{"./basis.js":"aODfz","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VtCQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hue", ()=>hue); -parcelHelpers.export(exports, "gamma", ()=>gamma); -parcelHelpers.export(exports, "default", ()=>nogamma); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -function linear(a, d) { - return function(t) { - return a + t * d; - }; -} -function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; -} -function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} -function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); - }; -} -function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : (0, _constantJsDefault.default)(isNaN(a) ? b : a); -} - -},{"./constant.js":"3lDJx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3lDJx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>()=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ak2mg":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return ((0, _numberArrayJs.isNumberArray)(b) ? (0, _numberArrayJsDefault.default) : genericArray)(a, b); - }); -parcelHelpers.export(exports, "genericArray", ()=>genericArray); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -var _numberArrayJs = require("./numberArray.js"); -var _numberArrayJsDefault = parcelHelpers.interopDefault(_numberArrayJs); -function genericArray(a, b) { - var nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb), i; - for(i = 0; i < na; ++i)x[i] = (0, _valueJsDefault.default)(a[i], b[i]); - for(; i < nb; ++i)c[i] = b[i]; - return function(t) { - for(i = 0; i < na; ++i)c[i] = x[i](t); - return c; - }; -} - -},{"./value.js":"j390F","./numberArray.js":"erlaq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erlaq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, c = b.slice(), i; - return function(t) { - for(i = 0; i < n; ++i)c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; - }); -parcelHelpers.export(exports, "isNumberArray", ()=>isNumberArray); -function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5kKci":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e4PyF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4rZkd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = {}, c = {}, k; - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; - for(k in b)if (k in a) i[k] = (0, _valueJsDefault.default)(a[k], b[k]); - else c[k] = b[k]; - return function(t) { - for(k in i)c[k] = i[k](t); - return c; - }; - }); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); - -},{"./value.js":"j390F","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Q7tf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s = [], q = []; // number interpolators - // Coerce inputs to strings. - a = a + "", b = b + ""; - // Interpolate pairs of numbers in a & b. - while((am = reA.exec(a)) && (bm = reB.exec(b))){ - if ((bs = bm.index) > bi) { - bs = b.slice(bi, bs); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - if ((am = am[0]) === (bm = bm[0])) { - if (s[i]) s[i] += bm; // coalesce with previous string - else s[++i] = bm; - } else { - s[++i] = null; - q.push({ - i: i, - x: (0, _numberJsDefault.default)(am, bm) - }); - } - bi = reB.lastIndex; - } - // Add remains of b. - if (bi < b.length) { - bs = b.slice(bi); - if (s[i]) s[i] += bs; // coalesce with previous string - else s[++i] = bs; - } - // Special optimization for only a single match. - // Otherwise, interpolate each of the numbers and rejoin the string. - return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) { - for(var i = 0, o; i < b; ++i)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }); - }); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); -function zero(b) { - return function() { - return b; + return scale2; + } + function linear() { + var scale2 = continuous$1(); + scale2.copy = function() { + return copy$7(scale2, linear()); }; -} -function one(b) { - return function(t) { - return b(t) + ""; - }; -} - -},{"./number.js":"e4PyF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kwucC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(range) { - var n = range.length; - return function(t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l0WHx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - var i = (0, _colorJs.hue)(+a, +b); - return function(t) { - var x = i(t); - return x - 360 * Math.floor(x / 360); - }; - }); -var _colorJs = require("./color.js"); - -},{"./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"l8dm5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return a = +a, b = +b, function(t) { - return Math.round(a * (1 - t) + b * t); - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ccQ0p":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "interpolateTransformCss", ()=>interpolateTransformCss); -parcelHelpers.export(exports, "interpolateTransformSvg", ()=>interpolateTransformSvg); -var _numberJs = require("../number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -var _parseJs = require("./parse.js"); -function interpolateTransform(parse, pxComma, pxParen, degParen) { - function pop(s) { - return s.length ? s.pop() + " " : ""; - } - function translate(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push("translate(", null, pxComma, null, pxParen); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb || yb) s.push("translate(" + xb + pxComma + yb + pxParen); - } - function rotate(a, b, s, q) { - if (a !== b) { - if (a - b > 180) b += 360; - else if (b - a > 180) a += 360; // shortest path - q.push({ - i: s.push(pop(s) + "rotate(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - } else if (b) s.push(pop(s) + "rotate(" + b + degParen); + initRange.apply(scale2, arguments); + return linearish(scale2); + } + function identity$2(domain2) { + var unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : x2; } - function skewX(a, b, s, q) { - if (a !== b) q.push({ - i: s.push(pop(s) + "skewX(", null, degParen) - 2, - x: (0, _numberJsDefault.default)(a, b) - }); - else if (b) s.push(pop(s) + "skewX(" + b + degParen); - } - function scale(xa, ya, xb, yb, s, q) { - if (xa !== xb || ya !== yb) { - var i = s.push(pop(s) + "scale(", null, ",", null, ")"); - q.push({ - i: i - 4, - x: (0, _numberJsDefault.default)(xa, xb) - }, { - i: i - 2, - x: (0, _numberJsDefault.default)(ya, yb) - }); - } else if (xb !== 1 || yb !== 1) s.push(pop(s) + "scale(" + xb + "," + yb + ")"); - } - return function(a, b) { - var s = [], q = []; // number interpolators - a = parse(a), b = parse(b); - translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); - rotate(a.rotate, b.rotate, s, q); - skewX(a.skewX, b.skewX, s, q); - scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); - a = b = null; // gc - return function(t) { - var i = -1, n = q.length, o; - while(++i < n)s[(o = q[i]).i] = o.x(t); - return s.join(""); - }; - }; -} -var interpolateTransformCss = interpolateTransform((0, _parseJs.parseCss), "px, ", "px)", "deg)"); -var interpolateTransformSvg = interpolateTransform((0, _parseJs.parseSvg), ", ", ")", ")"); - -},{"../number.js":"e4PyF","./parse.js":"fyjJk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fyjJk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/* eslint-disable no-undef */ parcelHelpers.export(exports, "parseCss", ()=>parseCss); -parcelHelpers.export(exports, "parseSvg", ()=>parseSvg); -var _decomposeJs = require("./decompose.js"); -var _decomposeJsDefault = parcelHelpers.interopDefault(_decomposeJs); -var svgNode; -function parseCss(value) { - const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + ""); - return m.isIdentity ? (0, _decomposeJs.identity) : (0, _decomposeJsDefault.default)(m.a, m.b, m.c, m.d, m.e, m.f); -} -function parseSvg(value) { - if (value == null) return 0, _decomposeJs.identity; - if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); - svgNode.setAttribute("transform", value); - if (!(value = svgNode.transform.baseVal.consolidate())) return 0, _decomposeJs.identity; - value = value.matrix; - return (0, _decomposeJsDefault.default)(value.a, value.b, value.c, value.d, value.e, value.f); -} - -},{"./decompose.js":"kD3Jv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kD3Jv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "identity", ()=>identity); -parcelHelpers.export(exports, "default", ()=>function(a, b, c, d, e, f) { - var scaleX, scaleY, skewX; - if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; - if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; - if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; - if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; - return { - translateX: e, - translateY: f, - rotate: Math.atan2(b, a) * degrees, - skewX: Math.atan(skewX) * degrees, - scaleX: scaleX, - scaleY: scaleY - }; - }); -var degrees = 180 / Math.PI; -var identity = { - translateX: 0, - translateY: 0, - rotate: 0, - skewX: 0, - scaleX: 1, - scaleY: 1 -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hXWwx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var epsilon2 = 1e-12; -function cosh(x) { - return ((x = Math.exp(x)) + 1 / x) / 2; -} -function sinh(x) { - return ((x = Math.exp(x)) - 1 / x) / 2; -} -function tanh(x) { - return ((x = Math.exp(2 * x)) - 1) / (x + 1); -} -exports.default = function zoomRho(rho, rho2, rho4) { - // p0 = [ux0, uy0, w0] - // p1 = [ux1, uy1, w1] - function zoom(p0, p1) { - var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; - // Special case for u0 ≅ u1. - if (d2 < epsilon2) { - S = Math.log(w1 / w0) / rho; - i = function(t) { - return [ - ux0 + t * dx, - uy0 + t * dy, - w0 * Math.exp(rho * t * S) - ]; - }; - } else { - var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); - S = (r1 - r0) / rho; - i = function(t) { - var s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); - return [ - ux0 + u * dx, - uy0 + u * dy, - w0 * coshr0 / cosh(rho * s + r0) - ]; - }; - } - i.duration = S * 1000 * rho / Math.SQRT2; - return i; - } - zoom.rho = function(_) { - var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2; - return zoomRho(_1, _2, _4); - }; - return zoom; -}(Math.SQRT2, 2, 4); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2r5a3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hslLong", ()=>hslLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hsl(hue) { - return function(start, end) { - var h = hue((start = (0, _d3Color.hsl)(start)).h, (end = (0, _d3Color.hsl)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; + scale2.invert = scale2; + scale2.domain = scale2.range = function(_) { + return arguments.length ? (domain2 = Array.from(_, number$5), scale2) : domain2.slice(); }; -} -exports.default = hsl((0, _colorJs.hue)); -var hslLong = hsl((0, _colorJsDefault.default)); - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4EvaS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>lab); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function lab(start, end) { - var l = (0, _colorJsDefault.default)((start = (0, _d3Color.lab)(start)).l, (end = (0, _d3Color.lab)(end)).l), a = (0, _colorJsDefault.default)(start.a, end.a), b = (0, _colorJsDefault.default)(start.b, end.b), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.l = l(t); - start.a = a(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; -} - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"CZyDl":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "hclLong", ()=>hclLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function hcl(hue) { - return function(start, end) { - var h = hue((start = (0, _d3Color.hcl)(start)).h, (end = (0, _d3Color.hcl)(end)).h), c = (0, _colorJsDefault.default)(start.c, end.c), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.c = c(t); - start.l = l(t); - start.opacity = opacity(t); - return start + ""; - }; + scale2.copy = function() { + return identity$2(domain2).unknown(unknown); }; -} -exports.default = hcl((0, _colorJs.hue)); -var hclLong = hcl((0, _colorJsDefault.default)); - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1wxKY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubehelixLong", ()=>cubehelixLong); -var _d3Color = require("d3-color"); -var _colorJs = require("./color.js"); -var _colorJsDefault = parcelHelpers.interopDefault(_colorJs); -function cubehelix(hue) { - return function cubehelixGamma(y) { - y = +y; - function cubehelix(start, end) { - var h = hue((start = (0, _d3Color.cubehelix)(start)).h, (end = (0, _d3Color.cubehelix)(end)).h), s = (0, _colorJsDefault.default)(start.s, end.s), l = (0, _colorJsDefault.default)(start.l, end.l), opacity = (0, _colorJsDefault.default)(start.opacity, end.opacity); - return function(t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - cubehelix.gamma = cubehelixGamma; - return cubehelix; - }(1); -} -exports.default = cubehelix((0, _colorJs.hue)); -var cubehelixLong = cubehelix((0, _colorJsDefault.default)); - -},{"d3-color":"7SCp9","./color.js":"9VtCQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dHOj6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>piecewise); -var _valueJs = require("./value.js"); -var _valueJsDefault = parcelHelpers.interopDefault(_valueJs); -function piecewise(interpolate, values) { - if (values === undefined) values = interpolate, interpolate = (0, _valueJsDefault.default); - var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); - while(i < n)I[i] = interpolate(v, v = values[++i]); - return function(t) { - var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); - return I[i](t - i); - }; -} - -},{"./value.js":"j390F","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7aRYJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(interpolator, n) { - var samples = new Array(n); - for(var i = 0; i < n; ++i)samples[i] = interpolator(i / (n - 1)); - return samples; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9JgB5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>constants); -function constants(x) { - return function() { - return x; - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOzsY":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>number); -function number(x) { - return +x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dksn9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>tickFormat); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -function tickFormat(start, stop, count, specifier) { - var step = (0, _d3Array.tickStep)(start, stop, count), precision; - specifier = (0, _d3Format.formatSpecifier)(specifier == null ? ",f" : specifier); - switch(specifier.type){ - case "s": - var value = Math.max(Math.abs(start), Math.abs(stop)); - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionPrefix)(step, value))) specifier.precision = precision; - return (0, _d3Format.formatPrefix)(specifier, value); - case "": - case "e": - case "g": - case "p": - case "r": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionRound)(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); - break; - case "f": - case "%": - if (specifier.precision == null && !isNaN(precision = (0, _d3Format.precisionFixed)(step))) specifier.precision = precision - (specifier.type === "%") * 2; - break; - } - return (0, _d3Format.format)(specifier); -} - -},{"d3-array":"6IwJG","d3-format":"8dYFL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2gcSE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loggish", ()=>loggish); -parcelHelpers.export(exports, "default", ()=>log); -var _d3Array = require("d3-array"); -var _d3Format = require("d3-format"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformLog(x) { - return Math.log(x); -} -function transformExp(x) { - return Math.exp(x); -} -function transformLogn(x) { - return -Math.log(-x); -} -function transformExpn(x) { - return -Math.exp(-x); -} -function pow10(x) { - return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; -} -function powp(base) { - return base === 10 ? pow10 : base === Math.E ? Math.exp : (x)=>Math.pow(base, x); -} -function logp(base) { - return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x)=>Math.log(x) / base); -} -function reflect(f) { - return (x, k)=>-f(-x, k); -} -function loggish(transform) { - const scale = transform(transformLog, transformExp); - const domain = scale.domain; - let base = 10; + domain2 = arguments.length ? Array.from(domain2, number$5) : [0, 1]; + return linearish(scale2); + } + function nice(domain2, interval2) { + domain2 = domain2.slice(); + var i0 = 0, i1 = domain2.length - 1, x02 = domain2[i0], x12 = domain2[i1], t; + if (x12 < x02) { + t = i0, i0 = i1, i1 = t; + t = x02, x02 = x12, x12 = t; + } + domain2[i0] = interval2.floor(x02); + domain2[i1] = interval2.ceil(x12); + return domain2; + } + function transformLog(x2) { + return Math.log(x2); + } + function transformExp(x2) { + return Math.exp(x2); + } + function transformLogn(x2) { + return -Math.log(-x2); + } + function transformExpn(x2) { + return -Math.exp(-x2); + } + function pow10(x2) { + return isFinite(x2) ? +("1e" + x2) : x2 < 0 ? 0 : x2; + } + function powp(base2) { + return base2 === 10 ? pow10 : base2 === Math.E ? Math.exp : (x2) => Math.pow(base2, x2); + } + function logp(base2) { + return base2 === Math.E ? Math.log : base2 === 10 && Math.log10 || base2 === 2 && Math.log2 || (base2 = Math.log(base2), (x2) => Math.log(x2) / base2); + } + function reflect(f) { + return (x2, k) => -f(-x2, k); + } + function loggish(transform2) { + const scale2 = transform2(transformLog, transformExp); + const domain2 = scale2.domain; + let base2 = 10; let logs; let pows; function rescale() { - logs = logp(base), pows = powp(base); - if (domain()[0] < 0) { - logs = reflect(logs), pows = reflect(pows); - transform(transformLogn, transformExpn); - } else transform(transformLog, transformExp); - return scale; - } - scale.base = function(_) { - return arguments.length ? (base = +_, rescale()) : base; - }; - scale.domain = function(_) { - return arguments.length ? (domain(_), rescale()) : domain(); - }; - scale.ticks = (count)=>{ - const d = domain(); - let u = d[0]; - let v = d[d.length - 1]; - const r = v < u; - if (r) [u, v] = [ - v, - u - ]; - let i = logs(u); - let j = logs(v); - let k; - let t; - const n = count == null ? 10 : +count; - let z = []; - if (!(base % 1) && j - i < n) { - i = Math.floor(i), j = Math.ceil(j); - if (u > 0) for(; i <= j; ++i)for(k = 1; k < base; ++k){ - t = i < 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - else for(; i <= j; ++i)for(k = base - 1; k >= 1; --k){ - t = i > 0 ? k / pows(-i) : k * pows(i); - if (t < u) continue; - if (t > v) break; - z.push(t); - } - if (z.length * 2 < n) z = (0, _d3Array.ticks)(u, v, n); - } else z = (0, _d3Array.ticks)(i, j, Math.min(j - i, n)).map(pows); - return r ? z.reverse() : z; - }; - scale.tickFormat = (count, specifier)=>{ - if (count == null) count = 10; - if (specifier == null) specifier = base === 10 ? "s" : ","; - if (typeof specifier !== "function") { - if (!(base % 1) && (specifier = (0, _d3Format.formatSpecifier)(specifier)).precision == null) specifier.trim = true; - specifier = (0, _d3Format.format)(specifier); - } - if (count === Infinity) return specifier; - const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? - return (d)=>{ - let i = d / pows(Math.round(logs(d))); - if (i * base < base - 0.5) i *= base; - return i <= k ? specifier(d) : ""; - }; + logs = logp(base2), pows = powp(base2); + if (domain2()[0] < 0) { + logs = reflect(logs), pows = reflect(pows); + transform2(transformLogn, transformExpn); + } else { + transform2(transformLog, transformExp); + } + return scale2; + } + scale2.base = function(_) { + return arguments.length ? (base2 = +_, rescale()) : base2; + }; + scale2.domain = function(_) { + return arguments.length ? (domain2(_), rescale()) : domain2(); + }; + scale2.ticks = (count2) => { + const d = domain2(); + let u2 = d[0]; + let v = d[d.length - 1]; + const r = v < u2; + if (r) [u2, v] = [v, u2]; + let i = logs(u2); + let j = logs(v); + let k; + let t; + const n = count2 == null ? 10 : +count2; + let z = []; + if (!(base2 % 1) && j - i < n) { + i = Math.floor(i), j = Math.ceil(j); + if (u2 > 0) for (; i <= j; ++i) { + for (k = 1; k < base2; ++k) { + t = i < 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z.push(t); + } + } + else for (; i <= j; ++i) { + for (k = base2 - 1; k >= 1; --k) { + t = i > 0 ? k / pows(-i) : k * pows(i); + if (t < u2) continue; + if (t > v) break; + z.push(t); + } + } + if (z.length * 2 < n) z = ticks(u2, v, n); + } else { + z = ticks(i, j, Math.min(j - i, n)).map(pows); + } + return r ? z.reverse() : z; + }; + scale2.tickFormat = (count2, specifier) => { + if (count2 == null) count2 = 10; + if (specifier == null) specifier = base2 === 10 ? "s" : ","; + if (typeof specifier !== "function") { + if (!(base2 % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true; + specifier = format$3(specifier); + } + if (count2 === Infinity) return specifier; + const k = Math.max(1, base2 * count2 / scale2.ticks().length); + return (d) => { + let i = d / pows(Math.round(logs(d))); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k ? specifier(d) : ""; + }; + }; + scale2.nice = () => { + return domain2(nice(domain2(), { + floor: (x2) => pows(Math.floor(logs(x2))), + ceil: (x2) => pows(Math.ceil(logs(x2))) + })); + }; + return scale2; + } + function log$2() { + const scale2 = loggish(transformer$3()).domain([1, 10]); + scale2.copy = () => copy$7(scale2, log$2()).base(scale2.base()); + initRange.apply(scale2, arguments); + return scale2; + } + function transformSymlog(c2) { + return function(x2) { + return Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); }; - scale.nice = ()=>{ - return domain((0, _niceJsDefault.default)(domain(), { - floor: (x)=>pows(Math.floor(logs(x))), - ceil: (x)=>pows(Math.ceil(logs(x))) - })); + } + function transformSymexp(c2) { + return function(x2) { + return Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; + }; + } + function symlogish(transform2) { + var c2 = 1, scale2 = transform2(transformSymlog(c2), transformSymexp(c2)); + scale2.constant = function(_) { + return arguments.length ? transform2(transformSymlog(c2 = +_), transformSymexp(c2)) : c2; }; - return scale; -} -function log() { - const scale = loggish((0, _continuousJs.transformer)()).domain([ - 1, - 10 - ]); - scale.copy = ()=>(0, _continuousJs.copy)(scale, log()).base(scale.base()); - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} - -},{"d3-array":"6IwJG","d3-format":"8dYFL","./nice.js":"dC4tu","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dC4tu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>nice); -function nice(domain, interval) { - domain = domain.slice(); - var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], t; - if (x1 < x0) { - t = i0, i0 = i1, i1 = t; - t = x0, x0 = x1, x1 = t; - } - domain[i0] = interval.floor(x0); - domain[i1] = interval.ceil(x1); - return domain; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iUUr7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "symlogish", ()=>symlogish); -parcelHelpers.export(exports, "default", ()=>symlog); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformSymlog(c) { - return function(x) { - return Math.sign(x) * Math.log1p(Math.abs(x / c)); - }; -} -function transformSymexp(c) { - return function(x) { - return Math.sign(x) * Math.expm1(Math.abs(x)) * c; - }; -} -function symlogish(transform) { - var c = 1, scale = transform(transformSymlog(c), transformSymexp(c)); - scale.constant = function(_) { - return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c; - }; - return (0, _linearJs.linearish)(scale); -} -function symlog() { - var scale = symlogish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, symlog()).constant(scale.constant()); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"./linear.js":"5CETT","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i4lyo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "powish", ()=>powish); -parcelHelpers.export(exports, "default", ()=>pow); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -var _linearJs = require("./linear.js"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function transformPow(exponent) { - return function(x) { - return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); - }; -} -function transformSqrt(x) { - return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x); -} -function transformSquare(x) { - return x < 0 ? -x * x : x * x; -} -function powish(transform) { - var scale = transform((0, _continuousJs.identity), (0, _continuousJs.identity)), exponent = 1; + return linearish(scale2); + } + function symlog() { + var scale2 = symlogish(transformer$3()); + scale2.copy = function() { + return copy$7(scale2, symlog()).constant(scale2.constant()); + }; + return initRange.apply(scale2, arguments); + } + function transformPow(exponent2) { + return function(x2) { + return x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); + }; + } + function transformSqrt(x2) { + return x2 < 0 ? -Math.sqrt(-x2) : Math.sqrt(x2); + } + function transformSquare(x2) { + return x2 < 0 ? -x2 * x2 : x2 * x2; + } + function powish(transform2) { + var scale2 = transform2(identity$3, identity$3), exponent2 = 1; function rescale() { - return exponent === 1 ? transform((0, _continuousJs.identity), (0, _continuousJs.identity)) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent)); - } - scale.exponent = function(_) { - return arguments.length ? (exponent = +_, rescale()) : exponent; - }; - return (0, _linearJs.linearish)(scale); -} -function pow() { - var scale = powish((0, _continuousJs.transformer)()); - scale.copy = function() { - return (0, _continuousJs.copy)(scale, pow()).exponent(scale.exponent()); - }; - (0, _initJs.initRange).apply(scale, arguments); - return scale; -} -function sqrt() { - return pow.apply(null, arguments).exponent(0.5); -} - -},{"./linear.js":"5CETT","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5ODOz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>radial); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _numberJs = require("./number.js"); -var _numberJsDefault = parcelHelpers.interopDefault(_numberJs); -function square(x) { - return Math.sign(x) * x * x; -} -function unsquare(x) { - return Math.sign(x) * Math.sqrt(Math.abs(x)); -} -function radial() { - var squared = (0, _continuousJsDefault.default)(), range = [ - 0, - 1 - ], round = false, unknown; - function scale(x) { - var y = unsquare(squared(x)); - return isNaN(y) ? unknown : round ? Math.round(y) : y; - } - scale.invert = function(y) { - return squared.invert(square(y)); - }; - scale.domain = function(_) { - return arguments.length ? (squared.domain(_), scale) : squared.domain(); - }; - scale.range = function(_) { - return arguments.length ? (squared.range((range = Array.from(_, (0, _numberJsDefault.default))).map(square)), scale) : range.slice(); - }; - scale.rangeRound = function(_) { - return scale.range(_).round(true); - }; - scale.round = function(_) { - return arguments.length ? (round = !!_, scale) : round; - }; - scale.clamp = function(_) { - return arguments.length ? (squared.clamp(_), scale) : squared.clamp(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return radial(squared.domain(), range).round(round).clamp(squared.clamp()).unknown(unknown); - }; - (0, _initJs.initRange).apply(scale, arguments); - return (0, _linearJs.linearish)(scale); -} - -},{"./continuous.js":"it8xE","./init.js":"kLKEv","./linear.js":"5CETT","./number.js":"bOzsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aAURo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantile); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function quantile() { - var domain = [], range = [], thresholds = [], unknown; + return exponent2 === 1 ? transform2(identity$3, identity$3) : exponent2 === 0.5 ? transform2(transformSqrt, transformSquare) : transform2(transformPow(exponent2), transformPow(1 / exponent2)); + } + scale2.exponent = function(_) { + return arguments.length ? (exponent2 = +_, rescale()) : exponent2; + }; + return linearish(scale2); + } + function pow$2() { + var scale2 = powish(transformer$3()); + scale2.copy = function() { + return copy$7(scale2, pow$2()).exponent(scale2.exponent()); + }; + initRange.apply(scale2, arguments); + return scale2; + } + function sqrt$2() { + return pow$2.apply(null, arguments).exponent(0.5); + } + function quantile() { + var domain2 = [], range2 = [], thresholds = [], unknown; function rescale() { - var i = 0, n = Math.max(1, range.length); - thresholds = new Array(n - 1); - while(++i < n)thresholds[i - 1] = (0, _d3Array.quantileSorted)(domain, i / n); - return scale; - } - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : range[(0, _d3Array.bisect)(thresholds, x)]; - } - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : [ - i > 0 ? thresholds[i - 1] : domain[0], - i < thresholds.length ? thresholds[i] : domain[domain.length - 1] - ]; - }; - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return rescale(); + var i = 0, n = Math.max(1, range2.length); + thresholds = new Array(n - 1); + while (++i < n) thresholds[i - 1] = quantileSorted(domain2, i / n); + return scale2; + } + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : range2[bisectRight$1(thresholds, x2)]; + } + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : [ + i > 0 ? thresholds[i - 1] : domain2[0], + i < thresholds.length ? thresholds[i] : domain2[domain2.length - 1] + ]; }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.quantiles = function() { - return thresholds.slice(); - }; - scale.copy = function() { - return quantile().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jjcn6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quantize); -var _d3Array = require("d3-array"); -var _linearJs = require("./linear.js"); -var _initJs = require("./init.js"); -function quantize() { - var x0 = 0, x1 = 1, n = 1, domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; + scale2.domain = function(_) { + if (!arguments.length) return domain2.slice(); + domain2 = []; + for (let d of _) if (d != null && !isNaN(d = +d)) domain2.push(d); + domain2.sort(ascending$1); + return rescale(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), rescale()) : range2.slice(); + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.quantiles = function() { + return thresholds.slice(); + }; + scale2.copy = function() { + return quantile().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + function quantize$1() { + var x02 = 0, x12 = 1, n = 1, domain2 = [0.5], range2 = [0, 1], unknown; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; } function rescale() { - var i = -1; - domain = new Array(n); - while(++i < n)domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); - return scale; - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [ - x0, - x1 - ]; - }; - scale.range = function(_) { - return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice(); - }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return i < 0 ? [ - NaN, - NaN - ] : i < 1 ? [ - x0, - domain[0] - ] : i >= n ? [ - domain[n - 1], - x1 - ] : [ - domain[i - 1], - domain[i] - ]; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : scale; - }; - scale.thresholds = function() { - return domain.slice(); - }; - scale.copy = function() { - return quantize().domain([ - x0, - x1 - ]).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply((0, _linearJs.linearish)(scale), arguments); -} - -},{"d3-array":"6IwJG","./linear.js":"5CETT","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8ndX3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>threshold); -var _d3Array = require("d3-array"); -var _initJs = require("./init.js"); -function threshold() { - var domain = [ - 0.5 - ], range = [ - 0, - 1 - ], unknown, n = 1; - function scale(x) { - return x != null && x <= x ? range[(0, _d3Array.bisect)(domain, x, 0, n)] : unknown; - } - scale.domain = function(_) { - return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice(); - }; - scale.range = function(_) { - return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice(); - }; - scale.invertExtent = function(y) { - var i = range.indexOf(y); - return [ - domain[i - 1], - domain[i] - ]; - }; - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; - }; - scale.copy = function() { - return threshold().domain(domain).range(range).unknown(unknown); - }; - return (0, _initJs.initRange).apply(scale, arguments); -} - -},{"d3-array":"6IwJG","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cjAqm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "calendar", ()=>calendar); -parcelHelpers.export(exports, "default", ()=>time); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _continuousJs = require("./continuous.js"); -var _continuousJsDefault = parcelHelpers.interopDefault(_continuousJs); -var _initJs = require("./init.js"); -var _niceJs = require("./nice.js"); -var _niceJsDefault = parcelHelpers.interopDefault(_niceJs); -function date(t) { + var i = -1; + domain2 = new Array(n); + while (++i < n) domain2[i] = ((i + 1) * x12 - (i - n) * x02) / (n + 1); + return scale2; + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, x02 = +x02, x12 = +x12, rescale()) : [x02, x12]; + }; + scale2.range = function(_) { + return arguments.length ? (n = (range2 = Array.from(_)).length - 1, rescale()) : range2.slice(); + }; + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return i < 0 ? [NaN, NaN] : i < 1 ? [x02, domain2[0]] : i >= n ? [domain2[n - 1], x12] : [domain2[i - 1], domain2[i]]; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : scale2; + }; + scale2.thresholds = function() { + return domain2.slice(); + }; + scale2.copy = function() { + return quantize$1().domain([x02, x12]).range(range2).unknown(unknown); + }; + return initRange.apply(linearish(scale2), arguments); + } + function threshold() { + var domain2 = [0.5], range2 = [0, 1], unknown, n = 1; + function scale2(x2) { + return x2 != null && x2 <= x2 ? range2[bisectRight$1(domain2, x2, 0, n)] : unknown; + } + scale2.domain = function(_) { + return arguments.length ? (domain2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : domain2.slice(); + }; + scale2.range = function(_) { + return arguments.length ? (range2 = Array.from(_), n = Math.min(domain2.length, range2.length - 1), scale2) : range2.slice(); + }; + scale2.invertExtent = function(y2) { + var i = range2.indexOf(y2); + return [domain2[i - 1], domain2[i]]; + }; + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; + }; + scale2.copy = function() { + return threshold().domain(domain2).range(range2).unknown(unknown); + }; + return initRange.apply(scale2, arguments); + } + function date(t) { return new Date(t); -} -function number(t) { - return t instanceof Date ? +t : +new Date(+t); -} -function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) { - var scale = (0, _continuousJsDefault.default)(), invert = scale.invert, domain = scale.domain; - var formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y"); - function tickFormat(date) { - return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date); - } - scale.invert = function(y) { - return new Date(invert(y)); - }; - scale.domain = function(_) { - return arguments.length ? domain(Array.from(_, number)) : domain().map(date); - }; - scale.ticks = function(interval) { - var d = domain(); - return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval); - }; - scale.tickFormat = function(count, specifier) { - return specifier == null ? tickFormat : format(specifier); - }; - scale.nice = function(interval) { - var d = domain(); - if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); - return interval ? domain((0, _niceJsDefault.default)(d, interval)) : scale; - }; - scale.copy = function() { - return (0, _continuousJs.copy)(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format)); - }; - return scale; -} -function time() { - return (0, _initJs.initRange).apply(calendar((0, _d3Time.timeTicks), (0, _d3Time.timeTickInterval), (0, _d3Time.timeYear), (0, _d3Time.timeMonth), (0, _d3Time.timeWeek), (0, _d3Time.timeDay), (0, _d3Time.timeHour), (0, _d3Time.timeMinute), (0, _d3Time.timeSecond), (0, _d3TimeFormat.timeFormat)).domain([ - new Date(2000, 0, 1), - new Date(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"8e7eR","d3-time-format":"242jH","./continuous.js":"it8xE","./init.js":"kLKEv","./nice.js":"dC4tu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cM5gE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>utcTime); -var _d3Time = require("d3-time"); -var _d3TimeFormat = require("d3-time-format"); -var _timeJs = require("./time.js"); -var _initJs = require("./init.js"); -function utcTime() { - return (0, _initJs.initRange).apply((0, _timeJs.calendar)((0, _d3Time.utcTicks), (0, _d3Time.utcTickInterval), (0, _d3Time.utcYear), (0, _d3Time.utcMonth), (0, _d3Time.utcWeek), (0, _d3Time.utcDay), (0, _d3Time.utcHour), (0, _d3Time.utcMinute), (0, _d3Time.utcSecond), (0, _d3TimeFormat.utcFormat)).domain([ - Date.UTC(2000, 0, 1), - Date.UTC(2000, 0, 2) - ]), arguments); -} - -},{"d3-time":"8e7eR","d3-time-format":"242jH","./time.js":"cjAqm","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f1sM1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "default", ()=>sequential); -parcelHelpers.export(exports, "sequentialLog", ()=>sequentialLog); -parcelHelpers.export(exports, "sequentialSymlog", ()=>sequentialSymlog); -parcelHelpers.export(exports, "sequentialPow", ()=>sequentialPow); -parcelHelpers.export(exports, "sequentialSqrt", ()=>sequentialSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 1, t0, t1, k10, transform, interpolator = (0, _continuousJs.identity), clamp = false, unknown; - function scale(x) { - return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [ - x0, - x1 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1; - return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [ - interpolator(0), - interpolator(1) - ]; - }; + } + function number$4(t) { + return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t); + } + function calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2) { + var scale2 = continuous$1(), invert2 = scale2.invert, domain2 = scale2.domain; + var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear2 = format2("%Y"); + function tickFormat2(date2) { + return (second2(date2) < date2 ? formatMillisecond : minute(date2) < date2 ? formatSecond : hour(date2) < date2 ? formatMinute : day(date2) < date2 ? formatHour : month(date2) < date2 ? week2(date2) < date2 ? formatDay : formatWeek : year(date2) < date2 ? formatMonth : formatYear2)(date2); + } + scale2.invert = function(y2) { + return new Date(invert2(y2)); + }; + scale2.domain = function(_) { + return arguments.length ? domain2(Array.from(_, number$4)) : domain2().map(date); + }; + scale2.ticks = function(interval2) { + var d = domain2(); + return ticks2(d[0], d[d.length - 1], interval2 == null ? 10 : interval2); + }; + scale2.tickFormat = function(count2, specifier) { + return specifier == null ? tickFormat2 : format2(specifier); + }; + scale2.nice = function(interval2) { + var d = domain2(); + if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval(d[0], d[d.length - 1], interval2 == null ? 10 : interval2); + return interval2 ? domain2(nice(d, interval2)) : scale2; + }; + scale2.copy = function() { + return copy$7(scale2, calendar(ticks2, tickInterval, year, month, week2, day, hour, minute, second2, format2)); + }; + return scale2; + } + function time$1() { + return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, timeFormat$1).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); + } + function utcTime() { + return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, utcFormat$1).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); + } + function transformer$2() { + var x02 = 0, x12 = 1, t02, t12, k10, transform2, interpolator = identity$3, clamp2 = false, unknown; + function scale2(x2) { + return x2 == null || isNaN(x2 = +x2) ? unknown : interpolator(k10 === 0 ? 0.5 : (x2 = (transform2(x2) - t02) * k10, clamp2 ? Math.max(0, Math.min(1, x2)) : x2)); + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02), scale2) : [x02, x12]; + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1; + return arguments.length ? ([r0, r1] = _, interpolator = interpolate2(r0, r1), scale2) : [interpolator(0), interpolator(1)]; + }; } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); - return scale; - }; -} -function copy(source, target) { - return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown()); -} -function sequential() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return copy(scale, sequential()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 1, - 10 - ]); - scale.copy = function() { - return copy(scale, sequentialLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return copy(scale, sequentialPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function sequentialSqrt() { + transform2 = t, t02 = t(x02), t12 = t(x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02); + return scale2; + }; + } + function copy$6(source2, target2) { + return target2.domain(source2.domain()).interpolator(source2.interpolator()).clamp(source2.clamp()).unknown(source2.unknown()); + } + function sequential() { + var scale2 = linearish(transformer$2()(identity$3)); + scale2.copy = function() { + return copy$6(scale2, sequential()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialLog() { + var scale2 = loggish(transformer$2()).domain([1, 10]); + scale2.copy = function() { + return copy$6(scale2, sequentialLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSymlog() { + var scale2 = symlogish(transformer$2()); + scale2.copy = function() { + return copy$6(scale2, sequentialSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialPow() { + var scale2 = powish(transformer$2()); + scale2.copy = function() { + return copy$6(scale2, sequentialPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function sequentialSqrt() { return sequentialPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"6gbPP","./continuous.js":"it8xE","./init.js":"kLKEv","./linear.js":"5CETT","./log.js":"2gcSE","./symlog.js":"iUUr7","./pow.js":"i4lyo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cSmYu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>sequentialQuantile); -var _d3Array = require("d3-array"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -function sequentialQuantile() { - var domain = [], interpolator = (0, _continuousJs.identity); - function scale(x) { - if (x != null && !isNaN(x = +x)) return interpolator(((0, _d3Array.bisect)(domain, x, 1) - 1) / (domain.length - 1)); - } - scale.domain = function(_) { - if (!arguments.length) return domain.slice(); - domain = []; - for (let d of _)if (d != null && !isNaN(d = +d)) domain.push(d); - domain.sort((0, _d3Array.ascending)); - return scale; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - scale.range = function() { - return domain.map((d, i)=>interpolator(i / (domain.length - 1))); - }; - scale.quantiles = function(n) { - return Array.from({ - length: n + 1 - }, (_, i)=>(0, _d3Array.quantile)(domain, i / n)); - }; - scale.copy = function() { - return sequentialQuantile(interpolator).domain(domain); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} - -},{"d3-array":"6IwJG","./continuous.js":"it8xE","./init.js":"kLKEv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Qcq3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>diverging); -parcelHelpers.export(exports, "divergingLog", ()=>divergingLog); -parcelHelpers.export(exports, "divergingSymlog", ()=>divergingSymlog); -parcelHelpers.export(exports, "divergingPow", ()=>divergingPow); -parcelHelpers.export(exports, "divergingSqrt", ()=>divergingSqrt); -var _d3Interpolate = require("d3-interpolate"); -var _continuousJs = require("./continuous.js"); -var _initJs = require("./init.js"); -var _linearJs = require("./linear.js"); -var _logJs = require("./log.js"); -var _sequentialJs = require("./sequential.js"); -var _symlogJs = require("./symlog.js"); -var _powJs = require("./pow.js"); -function transformer() { - var x0 = 0, x1 = 0.5, x2 = 1, s = 1, t0, t1, t2, k10, k21, interpolator = (0, _continuousJs.identity), transform, clamp = false, unknown; - function scale(x) { - return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (s * x < s * t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x)); - } - scale.domain = function(_) { - return arguments.length ? ([x0, x1, x2] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), t2 = transform(x2 = +x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1, scale) : [ - x0, - x1, - x2 - ]; - }; - scale.clamp = function(_) { - return arguments.length ? (clamp = !!_, scale) : clamp; - }; - scale.interpolator = function(_) { - return arguments.length ? (interpolator = _, scale) : interpolator; - }; - function range(interpolate) { - return function(_) { - var r0, r1, r2; - return arguments.length ? ([r0, r1, r2] = _, interpolator = (0, _d3Interpolate.piecewise)(interpolate, [ - r0, - r1, - r2 - ]), scale) : [ - interpolator(0), - interpolator(0.5), - interpolator(1) - ]; - }; + } + function transformer$1() { + var x02 = 0, x12 = 0.5, x2 = 1, s = 1, t02, t12, t22, k10, k21, interpolator = identity$3, transform2, clamp2 = false, unknown; + function scale2(x3) { + return isNaN(x3 = +x3) ? unknown : (x3 = 0.5 + ((x3 = +transform2(x3)) - t12) * (s * x3 < s * t12 ? k10 : k21), interpolator(clamp2 ? Math.max(0, Math.min(1, x3)) : x3)); + } + scale2.domain = function(_) { + return arguments.length ? ([x02, x12, x2] = _, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), t22 = transform2(x2 = +x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s = t12 < t02 ? -1 : 1, scale2) : [x02, x12, x2]; + }; + scale2.clamp = function(_) { + return arguments.length ? (clamp2 = !!_, scale2) : clamp2; + }; + scale2.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale2) : interpolator; + }; + function range2(interpolate2) { + return function(_) { + var r0, r1, r2; + return arguments.length ? ([r0, r1, r2] = _, interpolator = piecewise(interpolate2, [r0, r1, r2]), scale2) : [interpolator(0), interpolator(0.5), interpolator(1)]; + }; } - scale.range = range((0, _d3Interpolate.interpolate)); - scale.rangeRound = range((0, _d3Interpolate.interpolateRound)); - scale.unknown = function(_) { - return arguments.length ? (unknown = _, scale) : unknown; + scale2.range = range2(interpolate$1); + scale2.rangeRound = range2(interpolateRound); + scale2.unknown = function(_) { + return arguments.length ? (unknown = _, scale2) : unknown; }; return function(t) { - transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), s = t1 < t0 ? -1 : 1; - return scale; - }; -} -function diverging() { - var scale = (0, _linearJs.linearish)(transformer()((0, _continuousJs.identity))); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, diverging()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingLog() { - var scale = (0, _logJs.loggish)(transformer()).domain([ - 0.1, - 1, - 10 - ]); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingLog()).base(scale.base()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSymlog() { - var scale = (0, _symlogJs.symlogish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingSymlog()).constant(scale.constant()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingPow() { - var scale = (0, _powJs.powish)(transformer()); - scale.copy = function() { - return (0, _sequentialJs.copy)(scale, divergingPow()).exponent(scale.exponent()); - }; - return (0, _initJs.initInterpolator).apply(scale, arguments); -} -function divergingSqrt() { + transform2 = t, t02 = t(x02), t12 = t(x12), t22 = t(x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s = t12 < t02 ? -1 : 1; + return scale2; + }; + } + function diverging() { + var scale2 = linearish(transformer$1()(identity$3)); + scale2.copy = function() { + return copy$6(scale2, diverging()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingLog() { + var scale2 = loggish(transformer$1()).domain([0.1, 1, 10]); + scale2.copy = function() { + return copy$6(scale2, divergingLog()).base(scale2.base()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSymlog() { + var scale2 = symlogish(transformer$1()); + scale2.copy = function() { + return copy$6(scale2, divergingSymlog()).constant(scale2.constant()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingPow() { + var scale2 = powish(transformer$1()); + scale2.copy = function() { + return copy$6(scale2, divergingPow()).exponent(scale2.exponent()); + }; + return initInterpolator.apply(scale2, arguments); + } + function divergingSqrt() { return divergingPow.apply(null, arguments).exponent(0.5); -} - -},{"d3-interpolate":"6gbPP","./continuous.js":"it8xE","./init.js":"kLKEv","./linear.js":"5CETT","./log.js":"2gcSE","./sequential.js":"f1sM1","./symlog.js":"iUUr7","./pow.js":"i4lyo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f3TcU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "schemeCategory10", ()=>(0, _category10JsDefault.default)); -parcelHelpers.export(exports, "schemeAccent", ()=>(0, _accentJsDefault.default)); -parcelHelpers.export(exports, "schemeDark2", ()=>(0, _dark2JsDefault.default)); -parcelHelpers.export(exports, "schemeObservable10", ()=>(0, _observable10JsDefault.default)); -parcelHelpers.export(exports, "schemePaired", ()=>(0, _pairedJsDefault.default)); -parcelHelpers.export(exports, "schemePastel1", ()=>(0, _pastel1JsDefault.default)); -parcelHelpers.export(exports, "schemePastel2", ()=>(0, _pastel2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet1", ()=>(0, _set1JsDefault.default)); -parcelHelpers.export(exports, "schemeSet2", ()=>(0, _set2JsDefault.default)); -parcelHelpers.export(exports, "schemeSet3", ()=>(0, _set3JsDefault.default)); -parcelHelpers.export(exports, "schemeTableau10", ()=>(0, _tableau10JsDefault.default)); -parcelHelpers.export(exports, "interpolateBrBG", ()=>(0, _brBGJsDefault.default)); -parcelHelpers.export(exports, "schemeBrBG", ()=>(0, _brBGJs.scheme)); -parcelHelpers.export(exports, "interpolatePRGn", ()=>(0, _prgnJsDefault.default)); -parcelHelpers.export(exports, "schemePRGn", ()=>(0, _prgnJs.scheme)); -parcelHelpers.export(exports, "interpolatePiYG", ()=>(0, _piYGJsDefault.default)); -parcelHelpers.export(exports, "schemePiYG", ()=>(0, _piYGJs.scheme)); -parcelHelpers.export(exports, "interpolatePuOr", ()=>(0, _puOrJsDefault.default)); -parcelHelpers.export(exports, "schemePuOr", ()=>(0, _puOrJs.scheme)); -parcelHelpers.export(exports, "interpolateRdBu", ()=>(0, _rdBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdBu", ()=>(0, _rdBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdGy", ()=>(0, _rdGyJsDefault.default)); -parcelHelpers.export(exports, "schemeRdGy", ()=>(0, _rdGyJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlBu", ()=>(0, _rdYlBuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlBu", ()=>(0, _rdYlBuJs.scheme)); -parcelHelpers.export(exports, "interpolateRdYlGn", ()=>(0, _rdYlGnJsDefault.default)); -parcelHelpers.export(exports, "schemeRdYlGn", ()=>(0, _rdYlGnJs.scheme)); -parcelHelpers.export(exports, "interpolateSpectral", ()=>(0, _spectralJsDefault.default)); -parcelHelpers.export(exports, "schemeSpectral", ()=>(0, _spectralJs.scheme)); -parcelHelpers.export(exports, "interpolateBuGn", ()=>(0, _buGnJsDefault.default)); -parcelHelpers.export(exports, "schemeBuGn", ()=>(0, _buGnJs.scheme)); -parcelHelpers.export(exports, "interpolateBuPu", ()=>(0, _buPuJsDefault.default)); -parcelHelpers.export(exports, "schemeBuPu", ()=>(0, _buPuJs.scheme)); -parcelHelpers.export(exports, "interpolateGnBu", ()=>(0, _gnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeGnBu", ()=>(0, _gnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateOrRd", ()=>(0, _orRdJsDefault.default)); -parcelHelpers.export(exports, "schemeOrRd", ()=>(0, _orRdJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBuGn", ()=>(0, _puBuGnJsDefault.default)); -parcelHelpers.export(exports, "schemePuBuGn", ()=>(0, _puBuGnJs.scheme)); -parcelHelpers.export(exports, "interpolatePuBu", ()=>(0, _puBuJsDefault.default)); -parcelHelpers.export(exports, "schemePuBu", ()=>(0, _puBuJs.scheme)); -parcelHelpers.export(exports, "interpolatePuRd", ()=>(0, _puRdJsDefault.default)); -parcelHelpers.export(exports, "schemePuRd", ()=>(0, _puRdJs.scheme)); -parcelHelpers.export(exports, "interpolateRdPu", ()=>(0, _rdPuJsDefault.default)); -parcelHelpers.export(exports, "schemeRdPu", ()=>(0, _rdPuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGnBu", ()=>(0, _ylGnBuJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGnBu", ()=>(0, _ylGnBuJs.scheme)); -parcelHelpers.export(exports, "interpolateYlGn", ()=>(0, _ylGnJsDefault.default)); -parcelHelpers.export(exports, "schemeYlGn", ()=>(0, _ylGnJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrBr", ()=>(0, _ylOrBrJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrBr", ()=>(0, _ylOrBrJs.scheme)); -parcelHelpers.export(exports, "interpolateYlOrRd", ()=>(0, _ylOrRdJsDefault.default)); -parcelHelpers.export(exports, "schemeYlOrRd", ()=>(0, _ylOrRdJs.scheme)); -parcelHelpers.export(exports, "interpolateBlues", ()=>(0, _bluesJsDefault.default)); -parcelHelpers.export(exports, "schemeBlues", ()=>(0, _bluesJs.scheme)); -parcelHelpers.export(exports, "interpolateGreens", ()=>(0, _greensJsDefault.default)); -parcelHelpers.export(exports, "schemeGreens", ()=>(0, _greensJs.scheme)); -parcelHelpers.export(exports, "interpolateGreys", ()=>(0, _greysJsDefault.default)); -parcelHelpers.export(exports, "schemeGreys", ()=>(0, _greysJs.scheme)); -parcelHelpers.export(exports, "interpolatePurples", ()=>(0, _purplesJsDefault.default)); -parcelHelpers.export(exports, "schemePurples", ()=>(0, _purplesJs.scheme)); -parcelHelpers.export(exports, "interpolateReds", ()=>(0, _redsJsDefault.default)); -parcelHelpers.export(exports, "schemeReds", ()=>(0, _redsJs.scheme)); -parcelHelpers.export(exports, "interpolateOranges", ()=>(0, _orangesJsDefault.default)); -parcelHelpers.export(exports, "schemeOranges", ()=>(0, _orangesJs.scheme)); -parcelHelpers.export(exports, "interpolateCividis", ()=>(0, _cividisJsDefault.default)); -parcelHelpers.export(exports, "interpolateCubehelixDefault", ()=>(0, _cubehelixJsDefault.default)); -parcelHelpers.export(exports, "interpolateRainbow", ()=>(0, _rainbowJsDefault.default)); -parcelHelpers.export(exports, "interpolateWarm", ()=>(0, _rainbowJs.warm)); -parcelHelpers.export(exports, "interpolateCool", ()=>(0, _rainbowJs.cool)); -parcelHelpers.export(exports, "interpolateSinebow", ()=>(0, _sinebowJsDefault.default)); -parcelHelpers.export(exports, "interpolateTurbo", ()=>(0, _turboJsDefault.default)); -parcelHelpers.export(exports, "interpolateViridis", ()=>(0, _viridisJsDefault.default)); -parcelHelpers.export(exports, "interpolateMagma", ()=>(0, _viridisJs.magma)); -parcelHelpers.export(exports, "interpolateInferno", ()=>(0, _viridisJs.inferno)); -parcelHelpers.export(exports, "interpolatePlasma", ()=>(0, _viridisJs.plasma)); -var _category10Js = require("./categorical/category10.js"); -var _category10JsDefault = parcelHelpers.interopDefault(_category10Js); -var _accentJs = require("./categorical/Accent.js"); -var _accentJsDefault = parcelHelpers.interopDefault(_accentJs); -var _dark2Js = require("./categorical/Dark2.js"); -var _dark2JsDefault = parcelHelpers.interopDefault(_dark2Js); -var _observable10Js = require("./categorical/observable10.js"); -var _observable10JsDefault = parcelHelpers.interopDefault(_observable10Js); -var _pairedJs = require("./categorical/Paired.js"); -var _pairedJsDefault = parcelHelpers.interopDefault(_pairedJs); -var _pastel1Js = require("./categorical/Pastel1.js"); -var _pastel1JsDefault = parcelHelpers.interopDefault(_pastel1Js); -var _pastel2Js = require("./categorical/Pastel2.js"); -var _pastel2JsDefault = parcelHelpers.interopDefault(_pastel2Js); -var _set1Js = require("./categorical/Set1.js"); -var _set1JsDefault = parcelHelpers.interopDefault(_set1Js); -var _set2Js = require("./categorical/Set2.js"); -var _set2JsDefault = parcelHelpers.interopDefault(_set2Js); -var _set3Js = require("./categorical/Set3.js"); -var _set3JsDefault = parcelHelpers.interopDefault(_set3Js); -var _tableau10Js = require("./categorical/Tableau10.js"); -var _tableau10JsDefault = parcelHelpers.interopDefault(_tableau10Js); -var _brBGJs = require("./diverging/BrBG.js"); -var _brBGJsDefault = parcelHelpers.interopDefault(_brBGJs); -var _prgnJs = require("./diverging/PRGn.js"); -var _prgnJsDefault = parcelHelpers.interopDefault(_prgnJs); -var _piYGJs = require("./diverging/PiYG.js"); -var _piYGJsDefault = parcelHelpers.interopDefault(_piYGJs); -var _puOrJs = require("./diverging/PuOr.js"); -var _puOrJsDefault = parcelHelpers.interopDefault(_puOrJs); -var _rdBuJs = require("./diverging/RdBu.js"); -var _rdBuJsDefault = parcelHelpers.interopDefault(_rdBuJs); -var _rdGyJs = require("./diverging/RdGy.js"); -var _rdGyJsDefault = parcelHelpers.interopDefault(_rdGyJs); -var _rdYlBuJs = require("./diverging/RdYlBu.js"); -var _rdYlBuJsDefault = parcelHelpers.interopDefault(_rdYlBuJs); -var _rdYlGnJs = require("./diverging/RdYlGn.js"); -var _rdYlGnJsDefault = parcelHelpers.interopDefault(_rdYlGnJs); -var _spectralJs = require("./diverging/Spectral.js"); -var _spectralJsDefault = parcelHelpers.interopDefault(_spectralJs); -var _buGnJs = require("./sequential-multi/BuGn.js"); -var _buGnJsDefault = parcelHelpers.interopDefault(_buGnJs); -var _buPuJs = require("./sequential-multi/BuPu.js"); -var _buPuJsDefault = parcelHelpers.interopDefault(_buPuJs); -var _gnBuJs = require("./sequential-multi/GnBu.js"); -var _gnBuJsDefault = parcelHelpers.interopDefault(_gnBuJs); -var _orRdJs = require("./sequential-multi/OrRd.js"); -var _orRdJsDefault = parcelHelpers.interopDefault(_orRdJs); -var _puBuGnJs = require("./sequential-multi/PuBuGn.js"); -var _puBuGnJsDefault = parcelHelpers.interopDefault(_puBuGnJs); -var _puBuJs = require("./sequential-multi/PuBu.js"); -var _puBuJsDefault = parcelHelpers.interopDefault(_puBuJs); -var _puRdJs = require("./sequential-multi/PuRd.js"); -var _puRdJsDefault = parcelHelpers.interopDefault(_puRdJs); -var _rdPuJs = require("./sequential-multi/RdPu.js"); -var _rdPuJsDefault = parcelHelpers.interopDefault(_rdPuJs); -var _ylGnBuJs = require("./sequential-multi/YlGnBu.js"); -var _ylGnBuJsDefault = parcelHelpers.interopDefault(_ylGnBuJs); -var _ylGnJs = require("./sequential-multi/YlGn.js"); -var _ylGnJsDefault = parcelHelpers.interopDefault(_ylGnJs); -var _ylOrBrJs = require("./sequential-multi/YlOrBr.js"); -var _ylOrBrJsDefault = parcelHelpers.interopDefault(_ylOrBrJs); -var _ylOrRdJs = require("./sequential-multi/YlOrRd.js"); -var _ylOrRdJsDefault = parcelHelpers.interopDefault(_ylOrRdJs); -var _bluesJs = require("./sequential-single/Blues.js"); -var _bluesJsDefault = parcelHelpers.interopDefault(_bluesJs); -var _greensJs = require("./sequential-single/Greens.js"); -var _greensJsDefault = parcelHelpers.interopDefault(_greensJs); -var _greysJs = require("./sequential-single/Greys.js"); -var _greysJsDefault = parcelHelpers.interopDefault(_greysJs); -var _purplesJs = require("./sequential-single/Purples.js"); -var _purplesJsDefault = parcelHelpers.interopDefault(_purplesJs); -var _redsJs = require("./sequential-single/Reds.js"); -var _redsJsDefault = parcelHelpers.interopDefault(_redsJs); -var _orangesJs = require("./sequential-single/Oranges.js"); -var _orangesJsDefault = parcelHelpers.interopDefault(_orangesJs); -var _cividisJs = require("./sequential-multi/cividis.js"); -var _cividisJsDefault = parcelHelpers.interopDefault(_cividisJs); -var _cubehelixJs = require("./sequential-multi/cubehelix.js"); -var _cubehelixJsDefault = parcelHelpers.interopDefault(_cubehelixJs); -var _rainbowJs = require("./sequential-multi/rainbow.js"); -var _rainbowJsDefault = parcelHelpers.interopDefault(_rainbowJs); -var _sinebowJs = require("./sequential-multi/sinebow.js"); -var _sinebowJsDefault = parcelHelpers.interopDefault(_sinebowJs); -var _turboJs = require("./sequential-multi/turbo.js"); -var _turboJsDefault = parcelHelpers.interopDefault(_turboJs); -var _viridisJs = require("./sequential-multi/viridis.js"); -var _viridisJsDefault = parcelHelpers.interopDefault(_viridisJs); - -},{"./categorical/category10.js":"73dmt","./categorical/Accent.js":"354VI","./categorical/Dark2.js":"lRzjC","./categorical/observable10.js":"ji8JB","./categorical/Paired.js":"jDu6h","./categorical/Pastel1.js":"a9HVC","./categorical/Pastel2.js":"fqsx7","./categorical/Set1.js":"j2h0u","./categorical/Set2.js":"iGz31","./categorical/Set3.js":"Vc4dj","./categorical/Tableau10.js":false,"./diverging/BrBG.js":false,"./diverging/PRGn.js":false,"./diverging/PiYG.js":false,"./diverging/PuOr.js":false,"./diverging/RdBu.js":false,"./diverging/RdGy.js":false,"./diverging/RdYlBu.js":false,"./diverging/RdYlGn.js":false,"./diverging/Spectral.js":false,"./sequential-multi/BuGn.js":false,"./sequential-multi/BuPu.js":false,"./sequential-multi/GnBu.js":false,"./sequential-multi/OrRd.js":false,"./sequential-multi/PuBuGn.js":false,"./sequential-multi/PuBu.js":false,"./sequential-multi/PuRd.js":false,"./sequential-multi/RdPu.js":false,"./sequential-multi/YlGnBu.js":false,"./sequential-multi/YlGn.js":false,"./sequential-multi/YlOrBr.js":false,"./sequential-multi/YlOrRd.js":false,"./sequential-single/Blues.js":false,"./sequential-single/Greens.js":false,"./sequential-single/Greys.js":false,"./sequential-single/Purples.js":false,"./sequential-single/Reds.js":false,"./sequential-single/Oranges.js":false,"./sequential-multi/cividis.js":false,"./sequential-multi/cubehelix.js":false,"./sequential-multi/rainbow.js":false,"./sequential-multi/sinebow.js":false,"./sequential-multi/turbo.js":false,"./sequential-multi/viridis.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"73dmt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eXXy7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(specifier) { - var n = specifier.length / 6 | 0, colors = new Array(n), i = 0; - while(i < n)colors[i] = "#" + specifier.slice(i * 6, ++i * 6); - return colors; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"354VI":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lRzjC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ji8JB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jDu6h":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a9HVC":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fqsx7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j2h0u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iGz31":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Vc4dj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _colorsJs = require("../colors.js"); -var _colorsJsDefault = parcelHelpers.interopDefault(_colorsJs); -exports.default = (0, _colorsJsDefault.default)("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); - -},{"../colors.js":"eXXy7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fpesP":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "axisticks", ()=>AxisTicks); -parcelHelpers.export(exports, "datajoin", ()=>DataJoin); -parcelHelpers.export(exports, "encode", ()=>Encode); -parcelHelpers.export(exports, "legendentries", ()=>LegendEntries); -parcelHelpers.export(exports, "linkpath", ()=>LinkPath); -parcelHelpers.export(exports, "pie", ()=>Pie); -parcelHelpers.export(exports, "scale", ()=>Scale); -parcelHelpers.export(exports, "sortitems", ()=>SortItems); -parcelHelpers.export(exports, "stack", ()=>Stack); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScale = require("vega-scale"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _d3Interpolate = require("d3-interpolate"); -/** - * Generates axis ticks for visualizing a spatial scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate ticks for. - * @param {*} [params.count=10] - The approximate number of ticks, or - * desired tick interval, to use. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {function(*):string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid d3 4.0 format specifier. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function AxisTicks(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(AxisTicks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), ticks = this.value, scale = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count = (0, _vegaScale.tickCount)(scale, tally, _.minstep), format = _.format || (0, _vegaScale.tickFormat)(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values), values = _.values ? (0, _vegaScale.validTicks)(scale, _.values, count) : (0, _vegaScale.tickValues)(scale, count); - if (ticks) out.rem = ticks; - ticks = values.map((value, i)=>(0, _vegaDataflow.ingest)({ - index: i / (values.length - 1 || 1), - value: value, - label: format(value) - })); - if (_.extra && ticks.length) // add an extra tick pegged to the initial domain value - // this is used to generate axes with 'binned' domains - ticks.push((0, _vegaDataflow.ingest)({ - index: -1, - extra: { - value: ticks[0].value - }, - label: '' - })); - out.source = ticks; - out.add = ticks; - this.value = ticks; - return out; - } -}); -/** - * Joins a set of data elements against a set of visual items. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): object} [params.item] - An item generator function. - * @param {function(object): *} [params.key] - The key field associating data and visual items. - */ function DataJoin(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -function defaultItemCreate() { - return (0, _vegaDataflow.ingest)({}); -} -function newMap(key) { - const map = (0, _vegaUtil.fastmap)().test((t)=>t.exit); - map.lookup = (t)=>map.get(key(t)); - return map; -} -(0, _vegaUtil.inherits)(DataJoin, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), item = _.item || defaultItemCreate, key = _.key || (0, _vegaDataflow.tupleid), map = this.value; - // prevent transient (e.g., hover) requests from - // cascading across marks derived from marks - if ((0, _vegaUtil.isArray)(out.encode)) out.encode = null; - if (map && (_.modified('key') || pulse.modified(key))) (0, _vegaUtil.error)('DataJoin does not support modified key function or fields.'); - if (!map) { - pulse = pulse.addAll(); - this.value = map = newMap(key); - } - pulse.visit(pulse.ADD, (t)=>{ - const k = key(t); - let x = map.get(k); - if (x) { - if (x.exit) { - map.empty--; - out.add.push(x); - } else out.mod.push(x); - } else { - x = item(t); - map.set(k, x); - out.add.push(x); - } - x.datum = t; - x.exit = false; - }); - pulse.visit(pulse.MOD, (t)=>{ - const k = key(t), x = map.get(k); - if (x) { - x.datum = t; - out.mod.push(x); - } - }); - pulse.visit(pulse.REM, (t)=>{ - const k = key(t), x = map.get(k); - if (t === x.datum && !x.exit) { - out.rem.push(x); - x.exit = true; - ++map.empty; - } - }); - if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum'); - if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) df.runAfter(map.clean); - return out; - } -}); -/** - * Invokes encoding functions for visual items. - * @constructor - * @param {object} params - The parameters to the encoding functions. This - * parameter object will be passed through to all invoked encoding functions. - * @param {object} [params.mod=false] - Flag indicating if tuples in the input - * mod set that are unmodified by encoders should be included in the output. - * @param {object} param.encoders - The encoding functions - * @param {function(object, object): boolean} [param.encoders.update] - Update encoding set - * @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set - * @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set - */ function Encode(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(Encode, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode = pulse.encode; - // if an array, the encode directive includes additional sets - // that must be defined in order for the primary set to be invoked - // e.g., only run the update set if the hover set is defined - if ((0, _vegaUtil.isArray)(encode)) { - if (out.changed() || encode.every((e)=>encoders[e])) { - encode = encode[0]; - out.encode = null; // consume targeted encode directive - } else return pulse.StopPropagation; - } - // marshall encoder functions - var reenter = encode === 'enter', update = encoders.update || (0, _vegaUtil.falsy), enter = encoders.enter || (0, _vegaUtil.falsy), exit = encoders.exit || (0, _vegaUtil.falsy), set = (encode && !reenter ? encoders[encode] : update) || (0, _vegaUtil.falsy); - if (pulse.changed(pulse.ADD)) { - pulse.visit(pulse.ADD, (t)=>{ - enter(t, _); - update(t, _); - }); - out.modifies(enter.output); - out.modifies(update.output); - if (set !== (0, _vegaUtil.falsy) && set !== update) { - pulse.visit(pulse.ADD, (t)=>{ - set(t, _); - }); - out.modifies(set.output); - } + } + function colors$1(specifier) { + var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0; + while (i < n) colors2[i] = "#" + specifier.slice(i * 6, ++i * 6); + return colors2; + } + const schemeCategory10 = colors$1("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); + const schemeAccent = colors$1("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); + const schemeDark2 = colors$1("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); + const schemeObservable10 = colors$1("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"); + const schemePaired = colors$1("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); + const schemePastel1 = colors$1("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); + const schemePastel2 = colors$1("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); + const schemeSet1 = colors$1("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); + const schemeSet2 = colors$1("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); + const schemeSet3 = colors$1("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); + function bandSpace(count2, paddingInner, paddingOuter) { + const space = count2 - paddingInner + paddingOuter * 2; + return count2 ? space > 0 ? space : 1 : 0; + } + const Identity = "identity"; + const Linear = "linear"; + const Log$1 = "log"; + const Pow = "pow"; + const Sqrt = "sqrt"; + const Symlog = "symlog"; + const Time = "time"; + const UTC = "utc"; + const Sequential = "sequential"; + const Diverging = "diverging"; + const Quantile = "quantile"; + const Quantize = "quantize"; + const Threshold = "threshold"; + const Ordinal = "ordinal"; + const Point = "point"; + const Band = "band"; + const BinOrdinal = "bin-ordinal"; + const Continuous = "continuous"; + const Discrete$1 = "discrete"; + const Discretizing = "discretizing"; + const Interpolating = "interpolating"; + const Temporal = "temporal"; + function invertRange(scale2) { + return function(_) { + let lo = _[0], hi = _[1], t; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + return [scale2.invert(lo), scale2.invert(hi)]; + }; + } + function invertRangeExtent(scale2) { + return function(_) { + const range2 = scale2.range(); + let lo = _[0], hi = _[1], min2 = -1, max2, t, i, n; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + for (i = 0, n = range2.length; i < n; ++i) { + if (range2[i] >= lo && range2[i] <= hi) { + if (min2 < 0) min2 = i; + max2 = i; } - if (pulse.changed(pulse.REM) && exit !== (0, _vegaUtil.falsy)) { - pulse.visit(pulse.REM, (t)=>{ - exit(t, _); - }); - out.modifies(exit.output); - } - if (reenter || set !== (0, _vegaUtil.falsy)) { - const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0); - if (reenter) { - pulse.visit(flag, (t)=>{ - const mod = enter(t, _) || fmod; - if (set(t, _) || mod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(enter.output); - } else pulse.visit(flag, (t)=>{ - if (set(t, _) || fmod) out.mod.push(t); - }); - if (out.mod.length) out.modifies(set.output); - } - return out.changed() ? out : pulse.StopPropagation; - } -}); -/** - * Generates legend entries for visualizing a scale. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Scale} params.scale - The scale to generate items for. - * @param {*} [params.count=5] - The approximate number of items, or - * desired tick interval, to use. - * @param {*} [params.limit] - The maximum number of entries to - * include in a symbol legend. - * @param {Array<*>} [params.values] - The exact tick values to use. - * These must be legal domain values for the provided scale. - * If provided, the count argument is ignored. - * @param {string} [params.formatSpecifier] - A format specifier - * to use in conjunction with scale.tickFormat. Legal values are - * any valid D3 format specifier string. - * @param {function(*):string} [params.format] - The format function to use. - * If provided, the formatSpecifier argument is ignored. - */ function LegendEntries(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -(0, _vegaUtil.inherits)(LegendEntries, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value != null && !_.modified()) return pulse.StopPropagation; - var locale = pulse.dataflow.locale(), out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), items = this.value, type = _.type || (0, _vegaScale.SymbolLegend), scale = _.scale, limit = +_.limit, count = (0, _vegaScale.tickCount)(scale, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type === (0, _vegaScale.SymbolLegend), format = _.format || (0, _vegaScale.labelFormat)(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip), values = _.values || (0, _vegaScale.labelValues)(scale, count), domain, fraction, size, offset, ellipsis; - if (items) out.rem = items; - if (type === (0, _vegaScale.SymbolLegend)) { - if (limit && values.length > limit) { - pulse.dataflow.warn('Symbol legend count exceeds limit, filtering items.'); - items = values.slice(0, limit - 1); - ellipsis = true; - } else items = values; - if ((0, _vegaUtil.isFunction)(size = _.size)) { - // if first value maps to size zero, remove from list (vega#717) - if (!_.values && scale(items[0]) === 0) items = items.slice(1); - // compute size offset for legend entries - offset = items.reduce((max, value)=>Math.max(max, size(value, _)), 0); - } else size = (0, _vegaUtil.constant)(offset = size || 8); - items = items.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, items), - value: value, - offset: offset, - size: size(value, _) - })); - if (ellipsis) { - ellipsis = values[items.length]; - items.push((0, _vegaDataflow.ingest)({ - index: items.length, - label: `\u2026${values.length - items.length} entries`, - value: ellipsis, - offset: offset, - size: size(ellipsis, _) - })); - } - } else if (type === (0, _vegaScale.GradientLegend)) { - domain = scale.domain(), fraction = (0, _vegaScale.scaleFraction)(scale, domain[0], (0, _vegaUtil.peek)(domain)); - // if automatic label generation produces 2 or fewer values, - // use the domain end points instead (fixes vega/vega#1364) - if (values.length < 3 && !_.values && domain[0] !== (0, _vegaUtil.peek)(domain)) values = [ - domain[0], - (0, _vegaUtil.peek)(domain) - ]; - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: fraction(value) - })); - } else { - size = values.length - 1; - fraction = (0, _vegaScale.labelFraction)(scale); - items = values.map((value, index)=>(0, _vegaDataflow.ingest)({ - index: index, - label: format(value, index, values), - value: value, - perc: index ? fraction(value) : 0, - perc2: index === size ? 1 : fraction(values[index + 1]) - })); - } - out.source = items; - out.add = items; - this.value = items; - return out; + } + if (min2 < 0) return void 0; + lo = scale2.invertExtent(range2[min2]); + hi = scale2.invertExtent(range2[max2]); + return [lo[0] === void 0 ? lo[1] : lo[0], hi[1] === void 0 ? hi[0] : hi[1]]; + }; + } + function band() { + const scale2 = ordinal().unknown(void 0), domain2 = scale2.domain, ordinalRange = scale2.range; + let range$12 = [0, 1], step, bandwidth2, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; + delete scale2.unknown; + function rescale() { + const n = domain2().length, reverse2 = range$12[1] < range$12[0], stop2 = range$12[1 - reverse2], space = bandSpace(n, paddingInner, paddingOuter); + let start = range$12[reverse2 - 0]; + step = (stop2 - start) / (space || 1); + if (round) { + step = Math.floor(step); + } + start += (stop2 - start - step * (n - paddingInner)) * align; + bandwidth2 = step * (1 - paddingInner); + if (round) { + start = Math.round(start); + bandwidth2 = Math.round(bandwidth2); + } + const values2 = range$3(n).map((i) => start + step * i); + return ordinalRange(reverse2 ? values2.reverse() : values2); } -}); -const sourceX = (t)=>t.source.x; -const sourceY = (t)=>t.source.y; -const targetX = (t)=>t.target.x; -const targetY = (t)=>t.target.y; -/** - * Layout paths linking source and target elements. - * @constructor - * @param {object} params - The parameters for this operator. - */ function LinkPath(params) { - (0, _vegaDataflow.Transform).call(this, {}, params); -} -LinkPath.Definition = { - 'type': 'LinkPath', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'sourceX', - 'type': 'field', - 'default': 'source.x' - }, - { - 'name': 'sourceY', - 'type': 'field', - 'default': 'source.y' - }, - { - 'name': 'targetX', - 'type': 'field', - 'default': 'target.x' - }, - { - 'name': 'targetY', - 'type': 'field', - 'default': 'target.y' - }, - { - 'name': 'orient', - 'type': 'enum', - 'default': 'vertical', - 'values': [ - 'horizontal', - 'vertical', - 'radial' - ] - }, - { - 'name': 'shape', - 'type': 'enum', - 'default': 'line', - 'values': [ - 'line', - 'arc', - 'curve', - 'diagonal', - 'orthogonal' - ] - }, - { - 'name': 'require', - 'type': 'signal' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(LinkPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx = _.targetX || targetX, ty = _.targetY || targetY, as = _.as || 'path', orient = _.orient || 'vertical', shape = _.shape || 'line', path = Paths.get(shape + '-' + orient) || Paths.get(shape); - if (!path) (0, _vegaUtil.error)('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : '')); - pulse.visit(pulse.SOURCE, (t)=>{ - t[as] = path(sx(t), sy(t), tx(t), ty(t)); - }); - return pulse.reflow(_.modified()).modifies(as); - } -}); -const line = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'L' + tx + ',' + ty; -const lineR = (sa, sr, ta, tr)=>line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const arc = (sx, sy, tx, ty)=>{ - var dx = tx - sx, dy = ty - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; - return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty; -}; -const arcR = (sa, sr, ta, tr)=>arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const curve = (sx, sy, tx, ty)=>{ - const dx = tx - sx, dy = ty - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); - return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty; -}; -const curveR = (sa, sr, ta, tr)=>curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta)); -const orthoX = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'V' + ty + 'H' + tx; -const orthoY = (sx, sy, tx, ty)=>'M' + sx + ',' + sy + 'H' + tx + 'V' + ty; -const orthoR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa; - return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts; -}; -const diagonalX = (sx, sy, tx, ty)=>{ - const m = (sx + tx) / 2; - return 'M' + sx + ',' + sy + 'C' + m + ',' + sy + ' ' + m + ',' + ty + ' ' + tx + ',' + ty; -}; -const diagonalY = (sx, sy, tx, ty)=>{ - const m = (sy + ty) / 2; - return 'M' + sx + ',' + sy + 'C' + sx + ',' + m + ' ' + tx + ',' + m + ' ' + tx + ',' + ty; -}; -const diagonalR = (sa, sr, ta, tr)=>{ - const sc = Math.cos(sa), ss = Math.sin(sa), tc = Math.cos(ta), ts = Math.sin(ta), mr = (sr + tr) / 2; - return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts; -}; -const Paths = (0, _vegaUtil.fastmap)({ - 'line': line, - 'line-radial': lineR, - 'arc': arc, - 'arc-radial': arcR, - 'curve': curve, - 'curve-radial': curveR, - 'orthogonal-horizontal': orthoX, - 'orthogonal-vertical': orthoY, - 'orthogonal-radial': orthoR, - 'diagonal-horizontal': diagonalX, - 'diagonal-vertical': diagonalY, - 'diagonal-radial': diagonalR -}); -/** - * Pie and donut chart layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size pie segments. - * @param {number} [params.startAngle=0] - The start angle (in radians) of the layout. - * @param {number} [params.endAngle=2π] - The end angle (in radians) of the layout. - * @param {boolean} [params.sort] - Boolean flag for sorting sectors by value. - */ function Pie(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Pie.Definition = { - 'type': 'Pie', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'startAngle', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'endAngle', - 'type': 'number', - 'default': 6.283185307179586 - }, - { - 'name': 'sort', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'startAngle', - 'endAngle' - ] - } - ] -}; -(0, _vegaUtil.inherits)(Pie, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || [ - 'startAngle', - 'endAngle' - ], startAngle = as[0], endAngle = as[1], field = _.field || (0, _vegaUtil.one), start = _.startAngle || 0, stop = _.endAngle != null ? _.endAngle : 2 * Math.PI, data = pulse.source, values = data.map(field), n = values.length, a = start, k = (stop - start) / (0, _d3Array.sum)(values), index = (0, _d3Array.range)(n), i, t, v; - if (_.sort) index.sort((a, b)=>values[a] - values[b]); - for(i = 0; i < n; ++i){ - v = values[index[i]]; - t = data[index[i]]; - t[startAngle] = a; - t[endAngle] = a += v * k; - } - this.value = values; - return pulse.reflow(_.modified()).modifies(as); - } -}); -const DEFAULT_COUNT = 5; -function includeZero(scale) { - const type = scale.type; - return !scale.bins && (type === (0, _vegaScale.Linear) || type === (0, _vegaScale.Pow) || type === (0, _vegaScale.Sqrt)); -} -function includePad(type) { - return (0, _vegaScale.isContinuous)(type) && type !== (0, _vegaScale.Sequential); -} -const SKIP = (0, _vegaUtil.toSet)([ - 'set', - 'modified', - 'clear', - 'type', - 'scheme', - 'schemeExtent', - 'schemeCount', - 'domain', - 'domainMin', - 'domainMid', - 'domainMax', - 'domainRaw', - 'domainImplicit', - 'nice', - 'zero', - 'bins', - 'range', - 'rangeStep', - 'round', - 'reverse', - 'interpolate', - 'interpolateGamma' -]); -/** - * Maintains a scale function mapping data values to visual channels. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Scale(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Scale, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var df = pulse.dataflow, scale$1 = this.value, key = scaleKey(_); - if (!scale$1 || key !== scale$1.type) this.value = scale$1 = (0, _vegaScale.scale)(key)(); - for(key in _)if (!SKIP[key]) { - // padding is a scale property for band/point but not others - if (key === 'padding' && includePad(scale$1.type)) continue; - // invoke scale property setter, raise warning if not found - (0, _vegaUtil.isFunction)(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key); - } - configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df))); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function scaleKey(_) { - var t = _.type, d = '', n; - // backwards compatibility pre Vega 5. - if (t === (0, _vegaScale.Sequential)) return (0, _vegaScale.Sequential) + '-' + (0, _vegaScale.Linear); - if (isContinuousColor(_)) { - n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; - d = n === 2 ? (0, _vegaScale.Sequential) + '-' : n === 3 ? (0, _vegaScale.Diverging) + '-' : ''; + scale2.domain = function(_) { + if (arguments.length) { + domain2(_); + return rescale(); + } else { + return domain2(); + } + }; + scale2.range = function(_) { + if (arguments.length) { + range$12 = [+_[0], +_[1]]; + return rescale(); + } else { + return range$12.slice(); + } + }; + scale2.rangeRound = function(_) { + range$12 = [+_[0], +_[1]]; + round = true; + return rescale(); + }; + scale2.bandwidth = function() { + return bandwidth2; + }; + scale2.step = function() { + return step; + }; + scale2.round = function(_) { + if (arguments.length) { + round = !!_; + return rescale(); + } else { + return round; + } + }; + scale2.padding = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + paddingInner = paddingOuter; + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingInner = function(_) { + if (arguments.length) { + paddingInner = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingInner; + } + }; + scale2.paddingOuter = function(_) { + if (arguments.length) { + paddingOuter = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return paddingOuter; + } + }; + scale2.align = function(_) { + if (arguments.length) { + align = Math.max(0, Math.min(1, _)); + return rescale(); + } else { + return align; + } + }; + scale2.invertRange = function(_) { + if (_[0] == null || _[1] == null) return; + const reverse2 = range$12[1] < range$12[0], values2 = reverse2 ? ordinalRange().reverse() : ordinalRange(), n = values2.length - 1; + let lo = +_[0], hi = +_[1], a2, b2, t; + if (lo !== lo || hi !== hi) return; + if (hi < lo) { + t = lo; + lo = hi; + hi = t; + } + if (hi < values2[0] || lo > range$12[1 - reverse2]) return; + a2 = Math.max(0, bisectRight$1(values2, lo) - 1); + b2 = lo === hi ? a2 : bisectRight$1(values2, hi) - 1; + if (lo - values2[a2] > bandwidth2 + 1e-10) ++a2; + if (reverse2) { + t = a2; + a2 = n - b2; + b2 = n - t; + } + return a2 > b2 ? void 0 : domain2().slice(a2, b2 + 1); + }; + scale2.invert = function(_) { + const value2 = scale2.invertRange([_, _]); + return value2 ? value2[0] : value2; + }; + scale2.copy = function() { + return band().domain(domain2()).range(range$12).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); + }; + return rescale(); + } + function pointish(scale2) { + const copy2 = scale2.copy; + scale2.padding = scale2.paddingOuter; + delete scale2.paddingInner; + scale2.copy = function() { + return pointish(copy2()); + }; + return scale2; + } + function point$1() { + return pointish(band().paddingInner(1)); + } + var map = Array.prototype.map; + function numbers(_) { + return map.call(_, toNumber); + } + const slice$1 = Array.prototype.slice; + function scaleBinOrdinal() { + let domain2 = [], range2 = []; + function scale2(x2) { + return x2 == null || x2 !== x2 ? void 0 : range2[(bisectRight$1(domain2, x2) - 1) % range2.length]; + } + scale2.domain = function(_) { + if (arguments.length) { + domain2 = numbers(_); + return scale2; + } else { + return domain2.slice(); + } + }; + scale2.range = function(_) { + if (arguments.length) { + range2 = slice$1.call(_); + return scale2; + } else { + return range2.slice(); + } + }; + scale2.tickFormat = function(count2, specifier) { + return tickFormat$1(domain2[0], peek$1(domain2), count2 == null ? 10 : count2, specifier); + }; + scale2.copy = function() { + return scaleBinOrdinal().domain(scale2.domain()).range(scale2.range()); + }; + return scale2; + } + const scales = /* @__PURE__ */ new Map(); + const VEGA_SCALE = Symbol("vega_scale"); + function registerScale(scale2) { + scale2[VEGA_SCALE] = true; + return scale2; + } + function isRegisteredScale(scale2) { + return scale2 && scale2[VEGA_SCALE] === true; + } + function create$8(type2, constructor, metadata2) { + const ctr = function scale2() { + const s = constructor(); + if (!s.invertRange) { + s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : void 0; + } + s.type = type2; + return registerScale(s); + }; + ctr.metadata = toSet(array$5(metadata2)); + return ctr; + } + function scale$6(type2, scale2, metadata2) { + if (arguments.length > 1) { + scales.set(type2, create$8(type2, scale2, metadata2)); + return this; + } else { + return isValidScaleType(type2) ? scales.get(type2) : void 0; } - return (d + t || (0, _vegaScale.Linear)).toLowerCase(); -} -function isContinuousColor(_) { - const t = _.type; - return (0, _vegaScale.isContinuous)(t) && t !== (0, _vegaScale.Time) && t !== (0, _vegaScale.UTC) && (_.scheme || _.range && _.range.length && _.range.every((0, _vegaUtil.isString))); -} -function configureDomain(scale, _, df) { - // check raw domain, if provided use that and exit early - const raw = rawDomain(scale, _.domainRaw, df); - if (raw > -1) return raw; - var domain = _.domain, type = scale.type, zero = _.zero || _.zero === undefined && includeZero(scale), n, mid; - if (!domain) return 0; - // adjust domain based on zero, min, max settings - if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) { - n = (domain = domain.slice()).length - 1 || 1; - if (zero) { - if (domain[0] > 0) domain[0] = 0; - if (domain[n] < 0) domain[n] = 0; - } - if (_.domainMin != null) domain[0] = _.domainMin; - if (_.domainMax != null) domain[n] = _.domainMax; - if (_.domainMid != null) { - mid = _.domainMid; - const i = mid > domain[n] ? n + 1 : mid < domain[0] ? 0 : n; - if (i !== n) df.warn('Scale domainMid exceeds domain min or max.', mid); - domain.splice(i, 0, mid); - } - } - // adjust continuous domain for minimum pixel padding - if (includePad(type) && _.padding && domain[0] !== (0, _vegaUtil.peek)(domain)) domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant); - // set the scale domain - scale.domain(domainCheck(type, domain, df)); - // if ordinal scale domain is defined, prevent implicit - // domain construction as side-effect of scale lookup - if (type === (0, _vegaScale.Ordinal)) scale.unknown(_.domainImplicit ? (0, _vegaScale.scaleImplicit) : undefined); - // perform 'nice' adjustment as requested - if (_.nice && scale.nice) scale.nice(_.nice !== true && (0, _vegaScale.tickCount)(scale, _.nice) || null); - // return the cardinality of the domain - return domain.length; -} -function rawDomain(scale, raw, df) { - if (raw) { - scale.domain(domainCheck(scale.type, raw, df)); - return raw.length; - } else return -1; -} -function padDomain(type, domain, range, pad, exponent, constant) { - var span = Math.abs((0, _vegaUtil.peek)(range) - range[0]), frac = span / (span - 2 * pad), d = type === (0, _vegaScale.Log) ? (0, _vegaUtil.zoomLog)(domain, null, frac) : type === (0, _vegaScale.Sqrt) ? (0, _vegaUtil.zoomPow)(domain, null, frac, 0.5) : type === (0, _vegaScale.Pow) ? (0, _vegaUtil.zoomPow)(domain, null, frac, exponent || 1) : type === (0, _vegaScale.Symlog) ? (0, _vegaUtil.zoomSymlog)(domain, null, frac, constant || 1) : (0, _vegaUtil.zoomLinear)(domain, null, frac); - domain = domain.slice(); - domain[0] = d[0]; - domain[domain.length - 1] = d[1]; - return domain; -} -function domainCheck(type, domain, df) { - if ((0, _vegaScale.isLogarithmic)(type)) { - // sum signs of domain values - // if all pos or all neg, abs(sum) === domain.length - var s = Math.abs(domain.reduce((s, v)=>s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); - if (s !== domain.length) df.warn('Log scale domain includes zero: ' + (0, _vegaUtil.stringValue)(domain)); - } - return domain; -} -function configureBins(scale, _, count) { - let bins = _.bins; - if (bins && !(0, _vegaUtil.isArray)(bins)) { - // generate bin boundary array - const domain = scale.domain(), lo = domain[0], hi = (0, _vegaUtil.peek)(domain), step = bins.step; - let start = bins.start == null ? lo : bins.start, stop = bins.stop == null ? hi : bins.stop; - if (!step) (0, _vegaUtil.error)('Scale bins parameter missing step property.'); - if (start < lo) start = step * Math.ceil(lo / step); - if (stop > hi) stop = step * Math.floor(hi / step); - bins = (0, _d3Array.range)(start, stop + step / 2, step); - } - if (bins) // assign bin boundaries to scale instance - scale.bins = bins; - else if (scale.bins) // no current bins, remove bins if previously set - delete scale.bins; - // special handling for bin-ordinal scales - if (scale.type === (0, _vegaScale.BinOrdinal)) { - if (!bins) // the domain specifies the bins - scale.bins = scale.domain(); - else if (!_.domain && !_.domainRaw) { - // the bins specify the domain - scale.domain(bins); - count = bins.length; - } - } - // return domain cardinality - return count; -} -function configureRange(scale, _, count) { - var type = scale.type, round = _.round || false, range = _.range; - // if range step specified, calculate full range extent - if (_.rangeStep != null) range = configureRangeStep(type, _, count); - else if (_.scheme) { - range = configureScheme(type, _, count); - if ((0, _vegaUtil.isFunction)(range)) { - if (scale.interpolator) return scale.interpolator(range); - else (0, _vegaUtil.error)(`Scale type ${type} does not support interpolating color schemes.`); - } - } - // given a range array for an interpolating scale, convert to interpolator - if (range && (0, _vegaScale.isInterpolating)(type)) return scale.interpolator((0, _vegaScale.interpolateColors)(flip(range, _.reverse), _.interpolate, _.interpolateGamma)); - // configure rounding / interpolation - if (range && _.interpolate && scale.interpolate) scale.interpolate((0, _vegaScale.interpolate)(_.interpolate, _.interpolateGamma)); - else if ((0, _vegaUtil.isFunction)(scale.round)) scale.round(round); - else if ((0, _vegaUtil.isFunction)(scale.rangeRound)) scale.interpolate(round ? (0, _d3Interpolate.interpolateRound) : (0, _d3Interpolate.interpolate)); - if (range) scale.range(flip(range, _.reverse)); -} -function configureRangeStep(type, _, count) { - if (type !== (0, _vegaScale.Band) && type !== (0, _vegaScale.Point)) (0, _vegaUtil.error)('Only band and point scales support rangeStep.'); - // calculate full range based on requested step size and padding - var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type === (0, _vegaScale.Point) ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; - return [ - 0, - _.rangeStep * (0, _vegaScale.bandSpace)(count, inner, outer) - ]; -} -function configureScheme(type, _, count) { - var extent = _.schemeExtent, name, scheme$1; - if ((0, _vegaUtil.isArray)(_.scheme)) scheme$1 = (0, _vegaScale.interpolateColors)(_.scheme, _.interpolate, _.interpolateGamma); - else { - name = _.scheme.toLowerCase(); - scheme$1 = (0, _vegaScale.scheme)(name); - if (!scheme$1) (0, _vegaUtil.error)(`Unrecognized scheme name: ${_.scheme}`); - } - // determine size for potential discrete range - count = type === (0, _vegaScale.Threshold) ? count + 1 : type === (0, _vegaScale.BinOrdinal) ? count - 1 : type === (0, _vegaScale.Quantile) || type === (0, _vegaScale.Quantize) ? +_.schemeCount || DEFAULT_COUNT : count; - // adjust and/or quantize scheme as appropriate - return (0, _vegaScale.isInterpolating)(type) ? adjustScheme(scheme$1, extent, _.reverse) : (0, _vegaUtil.isFunction)(scheme$1) ? (0, _vegaScale.quantizeInterpolator)(adjustScheme(scheme$1, extent), count) : type === (0, _vegaScale.Ordinal) ? scheme$1 : scheme$1.slice(0, count); -} -function adjustScheme(scheme, extent, reverse) { - return (0, _vegaUtil.isFunction)(scheme) && (extent || reverse) ? (0, _vegaScale.interpolateRange)(scheme, flip(extent || [ - 0, - 1 - ], reverse)) : scheme; -} -function flip(array, reverse) { - return reverse ? array.slice().reverse() : array; -} -/** - * Sorts scenegraph items in the pulse source array. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(*,*): number} [params.sort] - A comparator - * function for sorting tuples. - */ function SortItems(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -(0, _vegaUtil.inherits)(SortItems, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum'); - if (mod) pulse.source.sort((0, _vegaDataflow.stableCompare)(_.sort)); - this.modified(mod); - return pulse; - } -}); -const Zero = 'zero', Center = 'center', Normalize = 'normalize', DefOutput = [ - 'y0', - 'y1' -]; -/** - * Stack layout for visualization elements. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to stack. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {function(object,object): number} [params.sort] - A comparator for stack sorting. - * @param {string} [offset='zero'] - Stack baseline offset. One of 'zero', 'center', 'normalize'. - */ function Stack(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stack.Definition = { - 'type': 'Stack', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'offset', - 'type': 'enum', - 'default': Zero, - 'values': [ - Zero, - Center, - Normalize - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': DefOutput - } - ] -}; -(0, _vegaUtil.inherits)(Stack, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var as = _.as || DefOutput, y0 = as[0], y1 = as[1], sort = (0, _vegaDataflow.stableCompare)(_.sort), field = _.field || (0, _vegaUtil.one), stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max; - // partition, sum, and sort the stack groups - groups = partition(pulse.source, _.groupby, sort, field); - // compute stack layouts per group - for(i = 0, n = groups.length, max = groups.max; i < n; ++i)stack(groups[i], max, field, y0, y1); - return pulse.reflow(_.modified()).modifies(as); - } -}); -function stackCenter(group, max, field, y0, y1) { - var last = (max - group.sum) / 2, m = group.length, j = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last += Math.abs(field(t)); - } -} -function stackNormalize(group, max, field, y0, y1) { - var scale = 1 / group.sum, last = 0, m = group.length, j = 0, v = 0, t; - for(; j < m; ++j){ - t = group[j]; - t[y0] = last; - t[y1] = last = scale * (v += Math.abs(field(t))); - } -} -function stackZero(group, max, field, y0, y1) { - var lastPos = 0, lastNeg = 0, m = group.length, j = 0, v, t; - for(; j < m; ++j){ - t = group[j]; - v = +field(t); - if (v < 0) { - t[y0] = lastNeg; - t[y1] = lastNeg += v; - } else { - t[y0] = lastPos; - t[y1] = lastPos += v; - } - } -} -function partition(data, groupby, sort, field) { - var groups = [], get = (f)=>f(t), map, i, n, m, t, k, g, s, max; - // partition data points into stack groups - if (groupby == null) groups.push(data.slice()); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - groups.push(g); - } - g.push(t); + } + scale$6(Identity, identity$2); + scale$6(Linear, linear, Continuous); + scale$6(Log$1, log$2, [Continuous, Log$1]); + scale$6(Pow, pow$2, Continuous); + scale$6(Sqrt, sqrt$2, Continuous); + scale$6(Symlog, symlog, Continuous); + scale$6(Time, time$1, [Continuous, Temporal]); + scale$6(UTC, utcTime, [Continuous, Temporal]); + scale$6(Sequential, sequential, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Log$1}`, sequentialLog, [Continuous, Interpolating, Log$1]); + scale$6(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]); + scale$6(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Linear}`, diverging, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Log$1}`, divergingLog, [Continuous, Interpolating, Log$1]); + scale$6(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]); + scale$6(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); + scale$6(Quantile, quantile, [Discretizing, Quantile]); + scale$6(Quantize, quantize$1, Discretizing); + scale$6(Threshold, threshold, Discretizing); + scale$6(BinOrdinal, scaleBinOrdinal, [Discrete$1, Discretizing]); + scale$6(Ordinal, ordinal, Discrete$1); + scale$6(Band, band, Discrete$1); + scale$6(Point, point$1, Discrete$1); + function isValidScaleType(type2) { + return scales.has(type2); + } + function hasType(key2, type2) { + const s = scales.get(key2); + return s && s.metadata[type2]; + } + function isContinuous(key2) { + return hasType(key2, Continuous); + } + function isDiscrete(key2) { + return hasType(key2, Discrete$1); + } + function isDiscretizing(key2) { + return hasType(key2, Discretizing); + } + function isLogarithmic(key2) { + return hasType(key2, Log$1); + } + function isTemporal(key2) { + return hasType(key2, Temporal); + } + function isInterpolating(key2) { + return hasType(key2, Interpolating); + } + function isQuantile(key2) { + return hasType(key2, Quantile); + } + const scaleProps = ["clamp", "base", "constant", "exponent"]; + function interpolateRange(interpolator, range2) { + const start = range2[0], span2 = peek$1(range2) - start; + return function(i) { + return interpolator(start + i * span2); + }; + } + function interpolateColors(colors2, type2, gamma2) { + return piecewise(interpolate(type2 || "rgb", gamma2), colors2); + } + function quantizeInterpolator(interpolator, count2) { + const samples = new Array(count2), n = count2 + 1; + for (let i = 0; i < count2; ) samples[i] = interpolator(++i / n); + return samples; + } + function scaleFraction(scale$12, min2, max2) { + const delta = max2 - min2; + let i, t, s; + if (!delta || !Number.isFinite(delta)) { + return constant$5(0.5); + } else { + i = (t = scale$12.type).indexOf("-"); + t = i < 0 ? t : t.slice(i + 1); + s = scale$6(t)().domain([min2, max2]).range([0, 1]); + scaleProps.forEach((m2) => scale$12[m2] ? s[m2](scale$12[m2]()) : 0); + return s; } - // compute sums of groups, sort groups as needed - for(k = 0, max = 0, m = groups.length; k < m; ++k){ - g = groups[k]; - for(i = 0, s = 0, n = g.length; i < n; ++i)s += Math.abs(field(g[i])); - g.sum = s; - if (s > max) max = s; - if (sort) g.sort(sort); + } + function interpolate(type2, gamma2) { + const interp = $$1[method(type2)]; + return gamma2 != null && interp && interp.gamma ? interp.gamma(gamma2) : interp; + } + function method(type2) { + return "interpolate" + type2.toLowerCase().split("-").map((s) => s[0].toUpperCase() + s.slice(1)).join(""); + } + const continuous = { + blues: "cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90", + greens: "d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429", + greys: "e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e", + oranges: "fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303", + purples: "e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c", + reds: "fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13", + blueGreen: "d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429", + bluePurple: "ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71", + greenBlue: "d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1", + orangeRed: "fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403", + purpleBlue: "dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281", + purpleBlueGreen: "dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353", + purpleRed: "dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a", + redPurple: "fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174", + yellowGreen: "e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034", + yellowOrangeBrown: "feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204", + yellowOrangeRed: "fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225", + blueOrange: "134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07", + brownBlueGreen: "704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147", + purpleGreen: "5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29", + purpleOrange: "4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07", + redBlue: "8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85", + redGrey: "8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434", + yellowGreenBlue: "eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185", + redYellowBlue: "a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695", + redYellowGreen: "a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837", + pinkYellowGreen: "8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419", + spectral: "9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2", + viridis: "440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725", + magma: "0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf", + inferno: "0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4", + plasma: "0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921", + cividis: "00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647", + rainbow: "6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa", + sinebow: "ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040", + turbo: "23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00", + browns: "eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632", + tealBlues: "bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985", + teals: "bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667", + warmGreys: "dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e", + goldGreen: "f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36", + goldOrange: "f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26", + goldRed: "f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e", + lightGreyRed: "efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b", + lightGreyTeal: "e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc", + lightMulti: "e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c", + lightOrange: "f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b", + lightTealBlue: "e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988", + darkBlue: "3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff", + darkGold: "3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff", + darkGreen: "3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa", + darkMulti: "3737371f5287197d8c29a86995ce3fffe800ffffff", + darkRed: "3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c" + }; + const discrete = { + accent: schemeAccent, + category10: schemeCategory10, + category20: "1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5", + category20b: "393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6", + category20c: "3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9", + dark2: schemeDark2, + observable10: schemeObservable10, + paired: schemePaired, + pastel1: schemePastel1, + pastel2: schemePastel2, + set1: schemeSet1, + set2: schemeSet2, + set3: schemeSet3, + tableau10: "4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac", + tableau20: "4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5" + }; + function colors(palette) { + if (isArray(palette)) return palette; + const n = palette.length / 6 | 0, c2 = new Array(n); + for (let i = 0; i < n; ) { + c2[i] = "#" + palette.slice(i * 6, ++i * 6); } - groups.max = max; - return groups; -} - -},{"vega-dataflow":"3NitK","vega-scale":"bEydG","vega-util":"bApja","d3-array":"6IwJG","d3-interpolate":"6gbPP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3rF9B":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "contour", ()=>Contour); -parcelHelpers.export(exports, "geojson", ()=>GeoJSON); -parcelHelpers.export(exports, "geopath", ()=>GeoPath); -parcelHelpers.export(exports, "geopoint", ()=>GeoPoint); -parcelHelpers.export(exports, "geoshape", ()=>GeoShape); -parcelHelpers.export(exports, "graticule", ()=>Graticule); -parcelHelpers.export(exports, "heatmap", ()=>Heatmap); -parcelHelpers.export(exports, "isocontour", ()=>Isocontour); -parcelHelpers.export(exports, "kde2d", ()=>KDE2D); -parcelHelpers.export(exports, "projection", ()=>Projection); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Array = require("d3-array"); -var _vegaStatistics = require("vega-statistics"); -var _vegaProjection = require("vega-projection"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaCanvas = require("vega-canvas"); -function noop() {} -const cases = [ - [], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 0.5, - 1.0 - ] - ], - [ - [ - 1.0, - 0.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.0, - 0.5 - ], - [ - 0.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ], - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [ - [ - [ - 1.5, - 1.0 - ], - [ - 1.0, - 0.5 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 1.0, - 1.5 - ], - [ - 1.5, - 1.0 - ] - ] - ], - [ - [ - [ - 0.5, - 1.0 - ], - [ - 1.0, - 1.5 - ] - ] - ], - [] -]; -// Implementation adapted from d3/d3-contour. Thanks! -function contours() { - var dx = 1, dy = 1, smooth = smoothLinear; - function contours(values, tz) { - return tz.map((value)=>contour(values, value)); - } - // Accumulate, smooth contour rings, assign holes to exterior rings. - // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js - function contour(values, value) { - var polygons = [], holes = []; - isorings(values, value, (ring)=>{ - smooth(ring, values, value); - if (area(ring) > 0) polygons.push([ - ring - ]); - else holes.push(ring); - }); - holes.forEach((hole)=>{ - for(var i = 0, n = polygons.length, polygon; i < n; ++i)if (contains((polygon = polygons[i])[0], hole) !== -1) { - polygon.push(hole); - return; - } - }); - return { - type: 'MultiPolygon', - value: value, - coordinates: polygons - }; + return c2; + } + function apply(_, f) { + for (const k in _) scheme(k, f(_[k])); + } + const schemes = {}; + apply(discrete, colors); + apply(continuous, (_) => interpolateColors(colors(_))); + function scheme(name, scheme2) { + name = name && name.toLowerCase(); + if (arguments.length > 1) { + schemes[name] = scheme2; + return this; + } else { + return schemes[name]; } - // Marching squares with isolines stitched into rings. - // Based on https://github.com/topojson/topojson-client/blob/v3.0.0/src/stitch.js - function isorings(values, value, callback) { - var fragmentByStart = [], fragmentByEnd = [], x, y, t0, t1, t2, t3; - // Special case for the first row (y = -1, t2 = t3 = 0). - x = y = -1; - t1 = values[0] >= value; - cases[t1 << 1].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[x + 1] >= value; - cases[t0 | t1 << 1].forEach(stitch); - } - cases[t1 << 0].forEach(stitch); - // General case for the intermediate rows. - while(++y < dy - 1){ - x = -1; - t1 = values[y * dx + dx] >= value; - t2 = values[y * dx] >= value; - cases[t1 << 1 | t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t0 = t1, t1 = values[y * dx + dx + x + 1] >= value; - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t1 | t2 << 3].forEach(stitch); - } - // Special case for the last row (y = dy - 1, t0 = t1 = 0). - x = -1; - t2 = values[y * dx] >= value; - cases[t2 << 2].forEach(stitch); - while(++x < dx - 1){ - t3 = t2, t2 = values[y * dx + x + 1] >= value; - cases[t2 << 2 | t3 << 3].forEach(stitch); - } - cases[t2 << 3].forEach(stitch); - function stitch(line) { - var start = [ - line[0][0] + x, - line[0][1] + y - ], end = [ - line[1][0] + x, - line[1][1] + y - ], startIndex = index(start), endIndex = index(end), f, g; - if (f = fragmentByEnd[startIndex]) { - if (g = fragmentByStart[endIndex]) { - delete fragmentByEnd[f.end]; - delete fragmentByStart[g.start]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[f.start] = fragmentByEnd[g.end] = { - start: f.start, - end: g.end, - ring: f.ring.concat(g.ring) - }; - } else { - delete fragmentByEnd[f.end]; - f.ring.push(end); - fragmentByEnd[f.end = endIndex] = f; - } - } else if (f = fragmentByStart[endIndex]) { - if (g = fragmentByEnd[startIndex]) { - delete fragmentByStart[f.start]; - delete fragmentByEnd[g.end]; - if (f === g) { - f.ring.push(end); - callback(f.ring); - } else fragmentByStart[g.start] = fragmentByEnd[f.end] = { - start: g.start, - end: f.end, - ring: g.ring.concat(f.ring) - }; - } else { - delete fragmentByStart[f.start]; - f.ring.unshift(start); - fragmentByStart[f.start = startIndex] = f; - } - } else fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { - start: startIndex, - end: endIndex, - ring: [ - start, - end - ] - }; - } + } + const SymbolLegend = "symbol"; + const DiscreteLegend = "discrete"; + const GradientLegend = "gradient"; + const defaultFormatter = (value2) => isArray(value2) ? value2.map((v) => String(v)) : String(value2); + const ascending = (a2, b2) => a2[1] - b2[1]; + const descending = (a2, b2) => b2[1] - a2[1]; + function tickCount(scale2, count2, minStep) { + let step; + if (isNumber$1(count2)) { + if (scale2.bins) { + count2 = Math.max(count2, scale2.bins.length); + } + if (minStep != null) { + count2 = Math.min(count2, Math.floor(span(scale2.domain()) / minStep || 1) + 1); + } } - function index(point) { - return point[0] * 2 + point[1] * (dx + 1) * 4; + if (isObject$1(count2)) { + step = count2.step; + count2 = count2.interval; } - function smoothLinear(ring, values, value) { - ring.forEach((point)=>{ - var x = point[0], y = point[1], xt = x | 0, yt = y | 0, v0, v1 = values[yt * dx + xt]; - if (x > 0 && x < dx && xt === x) { - v0 = values[yt * dx + xt - 1]; - point[0] = x + (value - v0) / (v1 - v0) - 0.5; - } - if (y > 0 && y < dy && yt === y) { - v0 = values[(yt - 1) * dx + xt]; - point[1] = y + (value - v0) / (v1 - v0) - 0.5; - } - }); + if (isString(count2)) { + count2 = scale2.type === Time ? timeInterval(count2) : scale2.type == UTC ? utcInterval(count2) : error("Only time and utc scales accept interval strings."); + if (step) count2 = count2.every(step); } - contours.contour = contour; - contours.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, contours; - }; - contours.smooth = function(_) { - return arguments.length ? (smooth = _ ? smoothLinear : noop, contours) : smooth === smoothLinear; - }; - return contours; -} -function area(ring) { - var i = 0, n = ring.length, area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; - while(++i < n)area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; - return area; -} -function contains(ring, hole) { - var i = -1, n = hole.length, c; - while(++i < n)if (c = ringContains(ring, hole[i])) return c; - return 0; -} -function ringContains(ring, point) { - var x = point[0], y = point[1], contains = -1; - for(var i = 0, n = ring.length, j = n - 1; i < n; j = i++){ - var pi = ring[i], xi = pi[0], yi = pi[1], pj = ring[j], xj = pj[0], yj = pj[1]; - if (segmentContains(pi, pj, point)) return 0; - if (yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi) contains = -contains; - } - return contains; -} -function segmentContains(a, b, c) { - var i; - return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]); -} -function collinear(a, b, c) { - return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]); -} -function within(p, q, r) { - return p <= q && q <= r || r <= q && q <= p; -} -function quantize(k, nice, zero) { - return function(values) { - var ex = (0, _vegaUtil.extent)(values), start = zero ? Math.min(ex[0], 0) : ex[0], stop = ex[1], span = stop - start, step = nice ? (0, _d3Array.tickStep)(start, stop, k) : span / (k + 1); - return (0, _d3Array.range)(start + step, stop, step); - }; -} -/** - * Generate isocontours (level sets) based on input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * specified, the levels, nice, resolve, and zero parameters are ignored. - * @param {number} [params.levels] - The desired number of contour levels. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified levels. - * @param {string} [params.resolve] - The method for resolving thresholds - * across multiple input grids. If 'independent' (the default), threshold - * calculation will be performed separately for each grid. If 'shared', a - * single set of threshold values will be used for all input grids. - * @param {boolean} [params.zero] - Boolean flag indicating if the contour - * threshold values should include zero. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - * @param {boolean} [params.scale] - Optional numerical value by which to - * scale the output isocontour coordinates. This parameter can be useful - * to scale the contours to match a desired output resolution. - * @param {string} [params.as='contour'] - The output field in which to store - * the generated isocontour data (default 'contour'). - */ function Isocontour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Isocontour.Definition = { - 'type': 'Isocontour', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'levels', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'zero', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'scale', - 'type': 'number', - 'expr': true - }, - { - 'name': 'translate', - 'type': 'number', - 'array': true, - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'null': true, - 'default': 'contour' - } - ] -}; -(0, _vegaUtil.inherits)(Isocontour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, field = _.field || (0, _vegaUtil.identity), contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source, field, _), as = _.as === null ? null : _.as || 'contour', values = []; - source.forEach((t)=>{ - const grid = field(t); - // generate contour paths in GeoJSON format - const paths = contour.size([ - grid.width, - grid.height - ])(grid.values, (0, _vegaUtil.isArray)(tz) ? tz : tz(grid.values)); - // adjust contour path coordinates as needed - transformPaths(paths, grid, t, _); - // ingest; copy source data properties to output - paths.forEach((p)=>{ - values.push((0, _vegaDataflow.rederive)(t, (0, _vegaDataflow.ingest)(as != null ? { - [as]: p - } : p))); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; + return count2; + } + function validTicks(scale2, ticks2, count2) { + let range2 = scale2.range(), lo = range2[0], hi = peek$1(range2), cmp = ascending; + if (lo > hi) { + range2 = hi; + hi = lo; + lo = range2; + cmp = descending; } -}); -function levels(values, f, _) { - const q = quantize(_.levels || 10, _.nice, _.zero !== false); - return _.resolve !== 'shared' ? q : q(values.map((t)=>(0, _d3Array.max)(f(t).values))); -} -function transformPaths(paths, grid, datum, _) { - let s = _.scale || grid.scale, t = _.translate || grid.translate; - if ((0, _vegaUtil.isFunction)(s)) s = s(datum, _); - if ((0, _vegaUtil.isFunction)(t)) t = t(datum, _); - if ((s === 1 || s == null) && !t) return; - const sx = ((0, _vegaUtil.isNumber)(s) ? s : s[0]) || 1, sy = ((0, _vegaUtil.isNumber)(s) ? s : s[1]) || 1, tx = t && t[0] || 0, ty = t && t[1] || 0; - paths.forEach(transform(grid, sx, sy, tx, ty)); -} -function transform(grid, sx, sy, tx, ty) { - const x1 = grid.x1 || 0, y1 = grid.y1 || 0, flip = sx * sy < 0; - function transformPolygon(coordinates) { - coordinates.forEach(transformRing); + lo = Math.floor(lo); + hi = Math.ceil(hi); + ticks2 = ticks2.map((v) => [v, scale2(v)]).filter((_) => lo <= _[1] && _[1] <= hi).sort(cmp).map((_) => _[0]); + if (count2 > 0 && ticks2.length > 1) { + const endpoints = [ticks2[0], peek$1(ticks2)]; + while (ticks2.length > count2 && ticks2.length >= 3) { + ticks2 = ticks2.filter((_, i) => !(i % 2)); + } + if (ticks2.length < 3) { + ticks2 = endpoints; + } } - function transformRing(coordinates) { - if (flip) coordinates.reverse(); // maintain winding order - coordinates.forEach(transformPoint); + return ticks2; + } + function tickValues(scale2, count2) { + return scale2.bins ? validTicks(scale2, scale2.bins, count2) : scale2.ticks ? scale2.ticks(count2) : scale2.domain(); + } + function tickFormat(locale2, scale2, count2, specifier, formatType, noSkip) { + const type2 = scale2.type; + let format2 = defaultFormatter; + if (type2 === Time || formatType === Time) { + format2 = locale2.timeFormat(specifier); + } else if (type2 === UTC || formatType === UTC) { + format2 = locale2.utcFormat(specifier); + } else if (isLogarithmic(type2)) { + const varfmt = locale2.formatFloat(specifier); + if (noSkip || scale2.bins) { + format2 = varfmt; + } else { + const test2 = tickLog(scale2, count2, false); + format2 = (_) => test2(_) ? varfmt(_) : ""; + } + } else if (scale2.tickFormat) { + const d = scale2.domain(); + format2 = locale2.formatSpan(d[0], d[d.length - 1], count2, specifier); + } else if (specifier) { + format2 = locale2.format(specifier); } - function transformPoint(coordinates) { - coordinates[0] = (coordinates[0] - x1) * sx + tx; - coordinates[1] = (coordinates[1] - y1) * sy + ty; + return format2; + } + function tickLog(scale2, count2, values2) { + const ticks2 = tickValues(scale2, count2), base2 = scale2.base(), logb = Math.log(base2), k = Math.max(1, base2 * count2 / ticks2.length); + const test2 = (d) => { + let i = d / Math.pow(base2, Math.round(Math.log(d) / logb)); + if (i * base2 < base2 - 0.5) i *= base2; + return i <= k; + }; + return values2 ? ticks2.filter(test2) : test2; + } + const symbols$1 = { + [Quantile]: "quantiles", + [Quantize]: "thresholds", + [Threshold]: "domain" + }; + const formats = { + [Quantile]: "quantiles", + [Quantize]: "domain" + }; + function labelValues(scale2, count2) { + return scale2.bins ? binValues(scale2.bins) : scale2.type === Log$1 ? tickLog(scale2, count2, true) : symbols$1[scale2.type] ? thresholdValues(scale2[symbols$1[scale2.type]]()) : tickValues(scale2, count2); + } + function thresholdFormat(locale2, scale2, specifier) { + const _ = scale2[formats[scale2.type]](), n = _.length; + let d = n > 1 ? _[1] - _[0] : _[0], i; + for (i = 1; i < n; ++i) { + d = Math.min(d, _[i] - _[i - 1]); } - return function(geometry) { - geometry.coordinates.forEach(transformPolygon); - return geometry; - }; -} -function radius(bw, data, f) { - const v = bw >= 0 ? bw : (0, _vegaStatistics.bandwidthNRD)(data, f); - return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); -} -function number(_) { - return (0, _vegaUtil.isFunction)(_) ? _ : (0, _vegaUtil.constant)(+_); -} -// Implementation adapted from d3/d3-contour. Thanks! -function density2D() { - var x = (d)=>d[0], y = (d)=>d[1], weight = (0, _vegaUtil.one), bandwidth = [ - -1, - -1 - ], dx = 960, dy = 500, k = 2; // log2(cellSize) - function density(data, counts) { - const rx = radius(bandwidth[0], data, x) >> k, // blur x-radius - ry = radius(bandwidth[1], data, y) >> k, // blur y-radius - ox = rx ? rx + 2 : 0, // x-offset padding for blur - oy = ry ? ry + 2 : 0, // y-offset padding for blur - n = 2 * ox + (dx >> k), // grid width - m = 2 * oy + (dy >> k), // grid height - values0 = new Float32Array(n * m), values1 = new Float32Array(n * m); - let values = values0; - data.forEach((d)=>{ - const xi = ox + (+x(d) >> k), yi = oy + (+y(d) >> k); - if (xi >= 0 && xi < n && yi >= 0 && yi < m) values0[xi + yi * n] += +weight(d); - }); - if (rx > 0 && ry > 0) { - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - blurX(n, m, values0, values1, rx); - blurY(n, m, values1, values0, ry); - } else if (rx > 0) { - blurX(n, m, values0, values1, rx); - blurX(n, m, values1, values0, rx); - blurX(n, m, values0, values1, rx); - values = values1; - } else if (ry > 0) { - blurY(n, m, values0, values1, ry); - blurY(n, m, values1, values0, ry); - blurY(n, m, values0, values1, ry); - values = values1; - } - // scale density estimates - // density in points per square pixel or probability density - const s = counts ? Math.pow(2, -2 * k) : 1 / (0, _d3Array.sum)(values); - for(let i = 0, sz = n * m; i < sz; ++i)values[i] *= s; - return { - values: values, - scale: 1 << k, - width: n, - height: m, - x1: ox, - y1: oy, - x2: ox + (dx >> k), - y2: oy + (dy >> k) - }; + return locale2.formatSpan(0, d, 3 * 10, specifier); + } + function thresholdValues(thresholds) { + const values2 = [-Infinity].concat(thresholds); + values2.max = Infinity; + return values2; + } + function binValues(bins) { + const values2 = bins.slice(0, -1); + values2.max = peek$1(bins); + return values2; + } + const isDiscreteRange = (scale2) => symbols$1[scale2.type] || scale2.bins; + function labelFormat(locale2, scale2, count2, type2, specifier, formatType, noSkip) { + const format2 = formats[scale2.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale2, scale2, specifier) : tickFormat(locale2, scale2, count2, specifier, formatType, noSkip); + return type2 === SymbolLegend && isDiscreteRange(scale2) ? formatRange(format2) : type2 === DiscreteLegend ? formatDiscrete(format2) : formatPoint(format2); + } + const formatRange = (format2) => (value2, index2, array2) => { + const limit = get$3(array2[index2 + 1], get$3(array2.max, Infinity)), lo = formatValue$1(value2, format2), hi = formatValue$1(limit, format2); + return lo && hi ? lo + " – " + hi : hi ? "< " + hi : "≥ " + lo; + }; + const get$3 = (value2, dflt) => value2 != null ? value2 : dflt; + const formatDiscrete = (format2) => (value2, index2) => index2 ? format2(value2) : null; + const formatPoint = (format2) => (value2) => format2(value2); + const formatValue$1 = (value2, format2) => Number.isFinite(value2) ? format2(value2) : null; + function labelFraction(scale2) { + const domain2 = scale2.domain(), count2 = domain2.length - 1; + let lo = +domain2[0], hi = +peek$1(domain2), span2 = hi - lo; + if (scale2.type === Threshold) { + const adjust = count2 ? span2 / count2 : 0.1; + lo -= adjust; + hi += adjust; + span2 = hi - lo; + } + return (value2) => (value2 - lo) / span2; + } + function format$1(locale2, scale2, specifier, formatType) { + const type2 = formatType || scale2.type; + if (isString(specifier) && isTemporal(type2)) { + specifier = specifier.replace(/%a/g, "%A").replace(/%b/g, "%B"); } - density.x = function(_) { - return arguments.length ? (x = number(_), density) : x; - }; - density.y = function(_) { - return arguments.length ? (y = number(_), density) : y; - }; - density.weight = function(_) { - return arguments.length ? (weight = number(_), density) : weight; - }; - density.size = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - var _0 = +_[0], _1 = +_[1]; - if (!(_0 >= 0 && _1 >= 0)) (0, _vegaUtil.error)('invalid size'); - return dx = _0, dy = _1, density; - }; - density.cellSize = function(_) { - if (!arguments.length) return 1 << k; - if (!((_ = +_) >= 1)) (0, _vegaUtil.error)('invalid cell size'); - k = Math.floor(Math.log(_) / Math.LN2); - return density; - }; - density.bandwidth = function(_) { - if (!arguments.length) return bandwidth; - _ = (0, _vegaUtil.array)(_); - if (_.length === 1) _ = [ - +_[0], - +_[0] - ]; - if (_.length !== 2) (0, _vegaUtil.error)('invalid bandwidth'); - return bandwidth = _, density; - }; - return density; -} -function blurX(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let j = 0; j < m; ++j)for(let i = 0, sr = 0; i < n + r; ++i){ - if (i < n) sr += source[i + j * n]; - if (i >= r) { - if (i >= w) sr -= source[i - w + j * n]; - target[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w); - } - } -} -function blurY(n, m, source, target, r) { - const w = (r << 1) + 1; - for(let i = 0; i < n; ++i)for(let j = 0, sr = 0; j < m + r; ++j){ - if (j < m) sr += source[i + j * n]; - if (j >= r) { - if (j >= w) sr -= source[i + (j - w) * n]; - target[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w); - } - } -} -/** - * Perform 2D kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The [width, height] extent (in - * units of input pixels) over which to perform density estimation. - * @param {function(object): number} params.x - The x-coordinate accessor. - * @param {function(object): number} params.y - The y-coordinate accessor. - * @param {function(object): number} [params.weight] - The weight accessor. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors - * to groupby. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * This parameter determines the level of spatial approximation. For example, - * the default value of 4 maps to 2x reductions in both x- and y- dimensions. - * A value of 1 will result in an output raster grid whose dimensions exactly - * matches the size parameter. - * @param {Array<number>} [params.bandwidth] - The KDE kernel bandwidths, - * in pixels. The input can be a two-element array specifying separate - * x and y bandwidths, or a single-element array specifying both. If the - * bandwidth is unspecified or less than zero, the bandwidth will be - * automatically determined. - * @param {boolean} [params.counts=false] - A boolean flag indicating if the - * output values should be probability estimates (false, default) or - * smoothed counts (true). - * @param {string} [params.as='grid'] - The output field in which to store - * the generated raster grid (default 'grid'). - */ function KDE2D(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -KDE2D.Definition = { - 'type': 'KDE2D', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'counts', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'grid' - } - ] -}; -const PARAMS = [ - 'x', - 'y', - 'weight', - 'size', - 'cellSize', - 'bandwidth' -]; -function params(obj, _) { - PARAMS.forEach((param)=>_[param] != null ? obj[param](_[param]) : 0); - return obj; -} -(0, _vegaUtil.inherits)(KDE2D, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), kde = params(density2D(), _), as = _.as || 'grid', values = []; - function set(t, vals) { - for(let i = 0; i < names.length; ++i)t[names[i]] = vals[i]; - return t; - } - // generate density raster grids - values = groups.map((g)=>(0, _vegaDataflow.ingest)(set({ - [as]: kde(g, _.counts) - }, g.dims))); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = values; - return out; + return !specifier && type2 === Time ? locale2.timeFormat("%A, %d %B %Y, %X") : !specifier && type2 === UTC ? locale2.utcFormat("%A, %d %B %Y, %X UTC") : labelFormat(locale2, scale2, 5, null, specifier, formatType, true); + } + function domainCaption(locale2, scale2, opt) { + opt = opt || {}; + const max2 = Math.max(3, opt.maxlen || 7), fmt = format$1(locale2, scale2, opt.format, opt.formatType); + if (isDiscretizing(scale2.type)) { + const v = labelValues(scale2).slice(1).map(fmt), n = v.length; + return `${n} boundar${n === 1 ? "y" : "ies"}: ${v.join(", ")}`; + } else if (isDiscrete(scale2.type)) { + const d = scale2.domain(), n = d.length, v = n > max2 ? d.slice(0, max2 - 2).map(fmt).join(", ") + ", ending with " + d.slice(-1).map(fmt) : d.map(fmt).join(", "); + return `${n} value${n === 1 ? "" : "s"}: ${v}`; + } else { + const d = scale2.domain(); + return `values from ${fmt(d[0])} to ${fmt(peek$1(d))}`; } -}); -function partition(data, groupby) { - var groups = [], get = (f)=>f(t), map, i, n, t, k, g; - // partition data points into groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); - } - g.push(t); + } + let gradient_id = 0; + function resetSVGGradientId() { + gradient_id = 0; + } + const patternPrefix = "p_"; + function isGradient(value2) { + return value2 && value2.gradient; + } + function gradientRef(g, defs, base2) { + const type2 = g.gradient; + let id2 = g.id, prefix = type2 === "radial" ? patternPrefix : ""; + if (!id2) { + id2 = g.id = "gradient_" + gradient_id++; + if (type2 === "radial") { + g.x1 = get$2(g.x1, 0.5); + g.y1 = get$2(g.y1, 0.5); + g.r1 = get$2(g.r1, 0); + g.x2 = get$2(g.x2, 0.5); + g.y2 = get$2(g.y2, 0.5); + g.r2 = get$2(g.r2, 0.5); + prefix = patternPrefix; + } else { + g.x1 = get$2(g.x1, 0); + g.y1 = get$2(g.y1, 0); + g.x2 = get$2(g.x2, 1); + g.y2 = get$2(g.y2, 0); + } } - return groups; -} -/** - * Generate contours based on kernel-density estimation of point data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The dimensions [width, height] over which to compute contours. - * If the values parameter is provided, this must be the dimensions of the input data. - * If density estimation is performed, this is the output view dimensions in pixels. - * @param {Array<number>} [params.values] - An array of numeric values representing an - * width x height grid of values over which to compute contours. If unspecified, this - * transform will instead attempt to compute contours for the kernel density estimate - * using values drawn from data tuples in the input pulse. - * @param {function(object): number} [params.x] - The pixel x-coordinate accessor for density estimation. - * @param {function(object): number} [params.y] - The pixel y-coordinate accessor for density estimation. - * @param {function(object): number} [params.weight] - The data point weight accessor for density estimation. - * @param {number} [params.cellSize] - Contour density calculation cell size. - * @param {number} [params.bandwidth] - Kernel density estimation bandwidth. - * @param {Array<number>} [params.thresholds] - Contour threshold array. If - * this parameter is set, the count and nice parameters will be ignored. - * @param {number} [params.count] - The desired number of contours. - * @param {boolean} [params.nice] - Boolean flag indicating if the contour - * threshold values should be automatically aligned to "nice" - * human-friendly values. Setting this flag may cause the number of - * thresholds to deviate from the specified count. - * @param {boolean} [params.smooth] - Boolean flag indicating if the contour - * polygons should be smoothed using linear interpolation. The default is - * true. The parameter is ignored when using density estimation. - */ function Contour(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Contour.Definition = { - 'type': 'Contour', - 'metadata': { - 'generates': true + defs[id2] = g; + return "url(" + (base2 || "") + "#" + prefix + id2 + ")"; + } + function get$2(val, def2) { + return val != null ? val : def2; + } + function Gradient$1(p02, p1) { + var stops = [], gradient2; + return gradient2 = { + gradient: "linear", + x1: p02 ? p02[0] : 0, + y1: p02 ? p02[1] : 0, + x2: p1 ? p1[0] : 1, + y2: p1 ? p1[1] : 0, + stops, + stop: function(offset2, color2) { + stops.push({ + offset: offset2, + color: color2 + }); + return gradient2; + } + }; + } + const lookup$4 = { + "basis": { + curve: curveBasis }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2, - 'required': true - }, - { - 'name': 'values', - 'type': 'number', - 'array': true - }, - { - 'name': 'x', - 'type': 'field' - }, - { - 'name': 'y', - 'type': 'field' - }, - { - 'name': 'weight', - 'type': 'field' - }, - { - 'name': 'cellSize', - 'type': 'number' - }, - { - 'name': 'bandwidth', - 'type': 'number' - }, - { - 'name': 'count', - 'type': 'number' - }, - { - 'name': 'nice', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'thresholds', - 'type': 'number', - 'array': true - }, - { - 'name': 'smooth', - 'type': 'boolean', - 'default': true - } - ] -}; -(0, _vegaUtil.inherits)(Contour, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation; - var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values), size = _.size, grid, post; - if (!values) { - values = pulse.materialize(pulse.SOURCE).source; - grid = params(density2D(), _)(values, true); - post = transform(grid, grid.scale || 1, grid.scale || 1, 0, 0); - size = [ - grid.width, - grid.height - ]; - values = grid.values; - } - thresh = (0, _vegaUtil.isArray)(thresh) ? thresh : thresh(values); - values = contour.size(size)(values, thresh); - if (post) values.forEach(post); - if (this.value) out.rem = this.value; - this.value = out.source = out.add = (values || []).map((0, _vegaDataflow.ingest)); - return out; - } -}); -const Feature = 'Feature'; -const FeatureCollection = 'FeatureCollection'; -const MultiPoint = 'MultiPoint'; -/** - * Consolidate an array of [longitude, latitude] points or GeoJSON features - * into a combined GeoJSON object. This transform is particularly useful for - * combining geo data for a Projection's fit argument. The resulting GeoJSON - * data is available as this transform's value. Input pulses are unchanged. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} [params.fields] - A two-element array - * of field accessors for the longitude and latitude values. - * @param {function(object): *} params.geojson - A field accessor for - * retrieving GeoJSON feature data. - */ function GeoJSON(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoJSON.Definition = { - 'type': 'GeoJSON', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'length': 2 - }, - { - 'name': 'geojson', - 'type': 'field' - } - ] -}; -(0, _vegaUtil.inherits)(GeoJSON, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var features = this._features, points = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && (0, _vegaUtil.identity), flag = pulse.ADD, mod; - mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified((0, _vegaUtil.accessorFields)(geojson)) || lon && pulse.modified((0, _vegaUtil.accessorFields)(lon)) || lat && pulse.modified((0, _vegaUtil.accessorFields)(lat)); - if (!this.value || mod) { - flag = pulse.SOURCE; - this._features = features = []; - this._points = points = []; - } - if (geojson) pulse.visit(flag, (t)=>features.push(geojson(t))); - if (lon && lat) { - pulse.visit(flag, (t)=>{ - var x = lon(t), y = lat(t); - if (x != null && y != null && (x = +x) === x && (y = +y) === y) points.push([ - x, - y - ]); - }); - features = features.concat({ - type: Feature, - geometry: { - type: MultiPoint, - coordinates: points - } - }); - } - this.value = { - type: FeatureCollection, - features: features - }; - } -}); -/** - * Map GeoJSON data to an SVG path string. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='path'] - The output field in which to store - * the generated path data (default 'path'). - */ function GeoPath(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPath.Definition = { - 'type': 'GeoPath', - 'metadata': { - 'modifies': true + "basis-closed": { + curve: curveBasisClosed }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -(0, _vegaUtil.inherits)(GeoPath, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), path = this.value, field = _.field || (0, _vegaUtil.identity), as = _.as || 'path', flag = out.SOURCE; - if (!path || _.modified()) { - // parameters updated, reset and reflow - this.value = path = (0, _vegaProjection.getProjectionPath)(_.projection); - out.materialize().reflow(); - } else flag = field === (0, _vegaUtil.identity) || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD; - const prev = initPath(path, _.pointRadius); - out.visit(flag, (t)=>t[as] = path(field(t))); - path.pointRadius(prev); - return out.modifies(as); - } -}); -function initPath(path, pointRadius) { - const prev = path.pointRadius(); - path.context(null); - if (pointRadius != null) path.pointRadius(pointRadius); - return prev; -} -/** - * Geo-code a longitude/latitude point to an x/y coordinate. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {Array<function(object): *>} params.fields - A two-element array of - * field accessors for the longitude and latitude values. - * @param {Array<string>} [params.as] - A two-element array of field names - * under which to store the result. Defaults to ['x','y']. - */ function GeoPoint(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoPoint.Definition = { - 'type': 'GeoPoint', - 'metadata': { - 'modifies': true + "basis-open": { + curve: curveBasisOpen }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection', - 'required': true - }, - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 2, - 'default': [ - 'x', - 'y' - ] - } - ] -}; -(0, _vegaUtil.inherits)(GeoPoint, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || [ - 'x', - 'y' - ], x = as[0], y = as[1], mod; - function set(t) { - const xy = proj([ - lon(t), - lat(t) - ]); - if (xy) { - t[x] = xy[0]; - t[y] = xy[1]; - } else { - t[x] = undefined; - t[y] = undefined; - } - } - if (_.modified()) // parameters updated, reflow - pulse = pulse.materialize().reflow(true).visit(pulse.SOURCE, set); - else { - mod = pulse.modified(lon.fields) || pulse.modified(lat.fields); - pulse.visit(mod ? pulse.ADD_MOD : pulse.ADD, set); - } - return pulse.modifies(as); - } -}); -/** - * Annotate items with a geopath shape generator. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(number, number): *} params.projection - The cartographic - * projection to apply. - * @param {function(object): *} [params.field] - The field with GeoJSON data, - * or null if the tuple itself is a GeoJSON feature. - * @param {string} [params.as='shape'] - The output field in which to store - * the generated path data (default 'shape'). - */ function GeoShape(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -GeoShape.Definition = { - 'type': 'GeoShape', - 'metadata': { - 'modifies': true, - 'nomod': true + "bundle": { + curve: curveBundle, + tension: "beta", + value: 0.85 }, - 'params': [ - { - 'name': 'projection', - 'type': 'projection' - }, - { - 'name': 'field', - 'type': 'field', - 'default': 'datum' - }, - { - 'name': 'pointRadius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'shape' - } - ] -}; -(0, _vegaUtil.inherits)(GeoShape, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var out = pulse.fork(pulse.ALL), shape = this.value, as = _.as || 'shape', flag = out.ADD; - if (!shape || _.modified()) { - // parameters updated, reset and reflow - this.value = shape = shapeGenerator((0, _vegaProjection.getProjectionPath)(_.projection), _.field || (0, _vegaUtil.field)('datum'), _.pointRadius); - out.materialize().reflow(); - flag = out.SOURCE; - } - out.visit(flag, (t)=>t[as] = shape); - return out.modifies(as); - } -}); -function shapeGenerator(path, field, pointRadius) { - const shape = pointRadius == null ? (_)=>path(field(_)) : (_)=>{ - var prev = path.pointRadius(), value = path.pointRadius(pointRadius)(field(_)); - path.pointRadius(prev); - return value; - }; - shape.context = (_)=>{ - path.context(_); - return shape; - }; - return shape; -} -/** - * GeoJSON feature generator for creating graticules. - * @constructor - */ function Graticule(params) { - (0, _vegaDataflow.Transform).call(this, [], params); - this.generator = (0, _d3Geo.geoGraticule)(); -} -Graticule.Definition = { - 'type': 'Graticule', - 'metadata': { - 'changes': true, - 'generates': true + "cardinal": { + curve: curveCardinal, + tension: "tension", + value: 0 }, - 'params': [ - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMajor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'extentMinor', - 'type': 'array', - 'array': true, - 'length': 2, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'step', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'stepMajor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 90, - 360 - ] - }, - { - 'name': 'stepMinor', - 'type': 'number', - 'array': true, - 'length': 2, - 'default': [ - 10, - 10 - ] - }, - { - 'name': 'precision', - 'type': 'number', - 'default': 2.5 - } - ] -}; -(0, _vegaUtil.inherits)(Graticule, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var src = this.value, gen = this.generator, t; - if (!src.length || _.modified()) { - for(const prop in _)if ((0, _vegaUtil.isFunction)(gen[prop])) gen[prop](_[prop]); - } - t = gen(); - if (src.length) pulse.mod.push((0, _vegaDataflow.replace)(src[0], t)); - else pulse.add.push((0, _vegaDataflow.ingest)(t)); - src[0] = t; - return pulse; - } -}); -/** - * Render a heatmap image for input raster grid data. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} [params.field] - The field with raster grid - * data. If unspecified, the tuple itself is interpreted as a raster grid. - * @param {string} [params.color] - A constant color value or function for - * individual pixel color. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {number} [params.opacity] - A constant opacity value or function for - * individual pixel opacity. If a function, it will be invoked with an input - * object that includes $x, $y, $value, and $max fields for the grid. - * @param {string} [params.resolve] - The method for resolving maximum values - * across multiple input grids. If 'independent' (the default), maximum - * calculation will be performed separately for each grid. If 'shared', - * a single global maximum will be used for all input grids. - * @param {string} [params.as='image'] - The output field in which to store - * the generated bitmap canvas images (default 'image'). - */ function Heatmap(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Heatmap.Definition = { - 'type': 'heatmap', - 'metadata': { - 'modifies': true + "cardinal-open": { + curve: curveCardinalOpen, + tension: "tension", + value: 0 }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'color', - 'type': 'string', - 'expr': true - }, - { - 'name': 'opacity', - 'type': 'number', - 'expr': true - }, - { - 'name': 'resolve', - 'type': 'enum', - 'values': [ - 'shared', - 'independent' - ], - 'default': 'independent' - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'image' - } - ] -}; -(0, _vegaUtil.inherits)(Heatmap, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.changed() && !_.modified()) return pulse.StopPropagation; - var source = pulse.materialize(pulse.SOURCE).source, shared = _.resolve === 'shared', field = _.field || (0, _vegaUtil.identity), opacity = opacity_(_.opacity, _), color = color_(_.color, _), as = _.as || 'image', obj = { - $x: 0, - $y: 0, - $value: 0, - $max: shared ? (0, _d3Array.max)(source.map((t)=>(0, _d3Array.max)(field(t).values))) : 0 - }; - source.forEach((t)=>{ - const v = field(t); - // build proxy data object - const o = (0, _vegaUtil.extend)({}, t, obj); - // set maximum value if not globally shared - if (!shared) o.$max = (0, _d3Array.max)(v.values || []); - // generate canvas image - // optimize color/opacity if not pixel-dependent - t[as] = toCanvas(v, o, color.dep ? color : (0, _vegaUtil.constant)(color(o)), opacity.dep ? opacity : (0, _vegaUtil.constant)(opacity(o))); - }); - return pulse.reflow(true).modifies(as); - } -}); -// get image color function -function color_(color, _) { - let f; - if ((0, _vegaUtil.isFunction)(color)) { - f = (obj)=>(0, _d3Color.rgb)(color(obj, _)); - f.dep = dependency(color); - } else // default to mid-grey - f = (0, _vegaUtil.constant)((0, _d3Color.rgb)(color || '#888')); - return f; -} -// get image opacity function -function opacity_(opacity, _) { - let f; - if ((0, _vegaUtil.isFunction)(opacity)) { - f = (obj)=>opacity(obj, _); - f.dep = dependency(opacity); - } else if (opacity) f = (0, _vegaUtil.constant)(opacity); - else { - // default to [0, max] opacity gradient - f = (obj)=>obj.$value / obj.$max || 0; - f.dep = true; - } - return f; -} -// check if function depends on individual pixel data -function dependency(f) { - if (!(0, _vegaUtil.isFunction)(f)) return false; - const set = (0, _vegaUtil.toSet)((0, _vegaUtil.accessorFields)(f)); - return set.$x || set.$y || set.$value || set.$max; -} -// render raster grid to canvas -function toCanvas(grid, obj, color, opacity) { - const n = grid.width, m = grid.height, x1 = grid.x1 || 0, y1 = grid.y1 || 0, x2 = grid.x2 || n, y2 = grid.y2 || m, val = grid.values, value = val ? (i)=>val[i] : (0, _vegaUtil.zero), can = (0, _vegaCanvas.canvas)(x2 - x1, y2 - y1), ctx = can.getContext('2d'), img = ctx.getImageData(0, 0, x2 - x1, y2 - y1), pix = img.data; - for(let j = y1, k = 0; j < y2; ++j){ - obj.$y = j - y1; - for(let i = x1, r = j * n; i < x2; ++i, k += 4){ - obj.$x = i - x1; - obj.$value = value(i + r); - const v = color(obj); - pix[k + 0] = v.r; - pix[k + 1] = v.g; - pix[k + 2] = v.b; - pix[k + 3] = ~~(255 * opacity(obj)); - } - } - ctx.putImageData(img, 0, 0); - return can; -} -/** - * Maintains a cartographic projection. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Projection(params) { - (0, _vegaDataflow.Transform).call(this, null, params); - this.modified(true); // always treat as modified -} -(0, _vegaUtil.inherits)(Projection, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - let proj = this.value; - if (!proj || _.modified('type')) { - this.value = proj = create(_.type); - (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_[prop] != null) set(proj, prop, _[prop]); - }); - } else (0, _vegaProjection.projectionProperties).forEach((prop)=>{ - if (_.modified(prop)) set(proj, prop, _[prop]); - }); - if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); - if (_.fit) fit(proj, _); - return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - } -}); -function fit(proj, _) { - const data = collectGeoJSON(_.fit); - _.extent ? proj.fitExtent(_.extent, data) : _.size && proj.fitSize(_.size, data); -} -function create(type) { - const constructor = (0, _vegaProjection.projection)((type || 'mercator').toLowerCase()); - if (!constructor) (0, _vegaUtil.error)('Unrecognized projection type: ' + type); - return constructor(); -} -function set(proj, key, value) { - if ((0, _vegaUtil.isFunction)(proj[key])) proj[key](value); -} -function collectGeoJSON(data) { - data = (0, _vegaUtil.array)(data); - return data.length === 1 ? data[0] : { - type: FeatureCollection, - features: data.reduce((a, f)=>a.concat(featurize(f)), []) - }; -} -function featurize(f) { - return f.type === FeatureCollection ? f.features : (0, _vegaUtil.array)(f).filter((d)=>d != null).map((d)=>d.type === Feature ? d : { - type: Feature, - geometry: d - }); -} - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-array":"6IwJG","vega-statistics":"5ncfv","vega-projection":"4wv4C","d3-geo":"lY61T","d3-color":"7SCp9","vega-canvas":"kPWfS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4wv4C":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getProjectionPath", ()=>getProjectionPath); -parcelHelpers.export(exports, "projection", ()=>projection); -parcelHelpers.export(exports, "projectionProperties", ()=>projectionProperties); -var _d3Geo = require("d3-geo"); -var _d3GeoProjection = require("d3-geo-projection"); -var _vegaScale = require("vega-scale"); -const defaultPath = (0, _d3Geo.geoPath)(); -const projectionProperties = [ - // standard properties in d3-geo - 'clipAngle', - 'clipExtent', - 'scale', - 'translate', - 'center', - 'rotate', - 'parallels', - 'precision', - 'reflectX', - 'reflectY', - // extended properties in d3-geo-projections - 'coefficient', - 'distance', - 'fraction', - 'lobes', - 'parallel', - 'radius', - 'ratio', - 'spacing', - 'tilt' -]; -/** - * Augment projections with their type and a copy method. - */ function create(type, constructor) { - return function projection() { - const p = constructor(); - p.type = type; - p.path = (0, _d3Geo.geoPath)().projection(p); - p.copy = p.copy || function() { - const c = projection(); - projectionProperties.forEach((prop)=>{ - if (p[prop]) c[prop](p[prop]()); - }); - c.path.pointRadius(p.path.pointRadius()); - return c; - }; - return (0, _vegaScale.registerScale)(p); - }; -} -function projection(type, proj) { - if (!type || typeof type !== 'string') throw new Error('Projection type must be a name string.'); - type = type.toLowerCase(); - if (arguments.length > 1) { - projections[type] = create(type, proj); - return this; - } else return projections[type] || null; -} -function getProjectionPath(proj) { - return proj && proj.path || defaultPath; -} -const projections = { - // base d3-geo projection types - albers: (0, _d3Geo.geoAlbers), - albersusa: (0, _d3Geo.geoAlbersUsa), - azimuthalequalarea: (0, _d3Geo.geoAzimuthalEqualArea), - azimuthalequidistant: (0, _d3Geo.geoAzimuthalEquidistant), - conicconformal: (0, _d3Geo.geoConicConformal), - conicequalarea: (0, _d3Geo.geoConicEqualArea), - conicequidistant: (0, _d3Geo.geoConicEquidistant), - equalEarth: (0, _d3Geo.geoEqualEarth), - equirectangular: (0, _d3Geo.geoEquirectangular), - gnomonic: (0, _d3Geo.geoGnomonic), - identity: (0, _d3Geo.geoIdentity), - mercator: (0, _d3Geo.geoMercator), - mollweide: (0, _d3GeoProjection.geoMollweide), - naturalEarth1: (0, _d3Geo.geoNaturalEarth1), - orthographic: (0, _d3Geo.geoOrthographic), - stereographic: (0, _d3Geo.geoStereographic), - transversemercator: (0, _d3Geo.geoTransverseMercator) -}; -for(const key in projections)projection(key, projections[key]); - -},{"d3-geo":"lY61T","d3-geo-projection":"ixW8K","vega-scale":"bEydG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lY61T":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoArea", ()=>(0, _areaJsDefault.default)); -parcelHelpers.export(exports, "geoBounds", ()=>(0, _boundsJsDefault.default)); -parcelHelpers.export(exports, "geoCentroid", ()=>(0, _centroidJsDefault.default)); -parcelHelpers.export(exports, "geoCircle", ()=>(0, _circleJsDefault.default)); -parcelHelpers.export(exports, "geoClipAntimeridian", ()=>(0, _antimeridianJsDefault.default)); -parcelHelpers.export(exports, "geoClipCircle", ()=>(0, _circleJsDefault1.default)); -parcelHelpers.export(exports, "geoClipExtent", ()=>(0, _extentJsDefault.default)) // DEPRECATED! Use d3.geoIdentity().clipExtent(…). -; -parcelHelpers.export(exports, "geoClipRectangle", ()=>(0, _rectangleJsDefault.default)); -parcelHelpers.export(exports, "geoContains", ()=>(0, _containsJsDefault.default)); -parcelHelpers.export(exports, "geoDistance", ()=>(0, _distanceJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule", ()=>(0, _graticuleJsDefault.default)); -parcelHelpers.export(exports, "geoGraticule10", ()=>(0, _graticuleJs.graticule10)); -parcelHelpers.export(exports, "geoInterpolate", ()=>(0, _interpolateJsDefault.default)); -parcelHelpers.export(exports, "geoLength", ()=>(0, _lengthJsDefault.default)); -parcelHelpers.export(exports, "geoPath", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoAlbers", ()=>(0, _albersJsDefault.default)); -parcelHelpers.export(exports, "geoAlbersUsa", ()=>(0, _albersUsaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualArea", ()=>(0, _azimuthalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEqualAreaRaw", ()=>(0, _azimuthalEqualAreaJs.azimuthalEqualAreaRaw)); -parcelHelpers.export(exports, "geoAzimuthalEquidistant", ()=>(0, _azimuthalEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoAzimuthalEquidistantRaw", ()=>(0, _azimuthalEquidistantJs.azimuthalEquidistantRaw)); -parcelHelpers.export(exports, "geoConicConformal", ()=>(0, _conicConformalJsDefault.default)); -parcelHelpers.export(exports, "geoConicConformalRaw", ()=>(0, _conicConformalJs.conicConformalRaw)); -parcelHelpers.export(exports, "geoConicEqualArea", ()=>(0, _conicEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoConicEqualAreaRaw", ()=>(0, _conicEqualAreaJs.conicEqualAreaRaw)); -parcelHelpers.export(exports, "geoConicEquidistant", ()=>(0, _conicEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoConicEquidistantRaw", ()=>(0, _conicEquidistantJs.conicEquidistantRaw)); -parcelHelpers.export(exports, "geoEqualEarth", ()=>(0, _equalEarthJsDefault.default)); -parcelHelpers.export(exports, "geoEqualEarthRaw", ()=>(0, _equalEarthJs.equalEarthRaw)); -parcelHelpers.export(exports, "geoEquirectangular", ()=>(0, _equirectangularJsDefault.default)); -parcelHelpers.export(exports, "geoEquirectangularRaw", ()=>(0, _equirectangularJs.equirectangularRaw)); -parcelHelpers.export(exports, "geoGnomonic", ()=>(0, _gnomonicJsDefault.default)); -parcelHelpers.export(exports, "geoGnomonicRaw", ()=>(0, _gnomonicJs.gnomonicRaw)); -parcelHelpers.export(exports, "geoIdentity", ()=>(0, _identityJsDefault.default)); -parcelHelpers.export(exports, "geoProjection", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoProjectionMutator", ()=>(0, _indexJs1.projectionMutator)); -parcelHelpers.export(exports, "geoMercator", ()=>(0, _mercatorJsDefault.default)); -parcelHelpers.export(exports, "geoMercatorRaw", ()=>(0, _mercatorJs.mercatorRaw)); -parcelHelpers.export(exports, "geoNaturalEarth1", ()=>(0, _naturalEarth1JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth1Raw", ()=>(0, _naturalEarth1Js.naturalEarth1Raw)); -parcelHelpers.export(exports, "geoOrthographic", ()=>(0, _orthographicJsDefault.default)); -parcelHelpers.export(exports, "geoOrthographicRaw", ()=>(0, _orthographicJs.orthographicRaw)); -parcelHelpers.export(exports, "geoStereographic", ()=>(0, _stereographicJsDefault.default)); -parcelHelpers.export(exports, "geoStereographicRaw", ()=>(0, _stereographicJs.stereographicRaw)); -parcelHelpers.export(exports, "geoTransverseMercator", ()=>(0, _transverseMercatorJsDefault.default)); -parcelHelpers.export(exports, "geoTransverseMercatorRaw", ()=>(0, _transverseMercatorJs.transverseMercatorRaw)); -parcelHelpers.export(exports, "geoRotation", ()=>(0, _rotationJsDefault.default)); -parcelHelpers.export(exports, "geoStream", ()=>(0, _streamJsDefault.default)); -parcelHelpers.export(exports, "geoTransform", ()=>(0, _transformJsDefault.default)); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _circleJs = require("./circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _antimeridianJs = require("./clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs1 = require("./clip/circle.js"); -var _circleJsDefault1 = parcelHelpers.interopDefault(_circleJs1); -var _extentJs = require("./clip/extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _rectangleJs = require("./clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _containsJs = require("./contains.js"); -var _containsJsDefault = parcelHelpers.interopDefault(_containsJs); -var _distanceJs = require("./distance.js"); -var _distanceJsDefault = parcelHelpers.interopDefault(_distanceJs); -var _graticuleJs = require("./graticule.js"); -var _graticuleJsDefault = parcelHelpers.interopDefault(_graticuleJs); -var _interpolateJs = require("./interpolate.js"); -var _interpolateJsDefault = parcelHelpers.interopDefault(_interpolateJs); -var _lengthJs = require("./length.js"); -var _lengthJsDefault = parcelHelpers.interopDefault(_lengthJs); -var _indexJs = require("./path/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _albersJs = require("./projection/albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _albersUsaJs = require("./projection/albersUsa.js"); -var _albersUsaJsDefault = parcelHelpers.interopDefault(_albersUsaJs); -var _azimuthalEqualAreaJs = require("./projection/azimuthalEqualArea.js"); -var _azimuthalEqualAreaJsDefault = parcelHelpers.interopDefault(_azimuthalEqualAreaJs); -var _azimuthalEquidistantJs = require("./projection/azimuthalEquidistant.js"); -var _azimuthalEquidistantJsDefault = parcelHelpers.interopDefault(_azimuthalEquidistantJs); -var _conicConformalJs = require("./projection/conicConformal.js"); -var _conicConformalJsDefault = parcelHelpers.interopDefault(_conicConformalJs); -var _conicEqualAreaJs = require("./projection/conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _conicEquidistantJs = require("./projection/conicEquidistant.js"); -var _conicEquidistantJsDefault = parcelHelpers.interopDefault(_conicEquidistantJs); -var _equalEarthJs = require("./projection/equalEarth.js"); -var _equalEarthJsDefault = parcelHelpers.interopDefault(_equalEarthJs); -var _equirectangularJs = require("./projection/equirectangular.js"); -var _equirectangularJsDefault = parcelHelpers.interopDefault(_equirectangularJs); -var _gnomonicJs = require("./projection/gnomonic.js"); -var _gnomonicJsDefault = parcelHelpers.interopDefault(_gnomonicJs); -var _identityJs = require("./projection/identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _indexJs1 = require("./projection/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _mercatorJs = require("./projection/mercator.js"); -var _mercatorJsDefault = parcelHelpers.interopDefault(_mercatorJs); -var _naturalEarth1Js = require("./projection/naturalEarth1.js"); -var _naturalEarth1JsDefault = parcelHelpers.interopDefault(_naturalEarth1Js); -var _orthographicJs = require("./projection/orthographic.js"); -var _orthographicJsDefault = parcelHelpers.interopDefault(_orthographicJs); -var _stereographicJs = require("./projection/stereographic.js"); -var _stereographicJsDefault = parcelHelpers.interopDefault(_stereographicJs); -var _transverseMercatorJs = require("./projection/transverseMercator.js"); -var _transverseMercatorJsDefault = parcelHelpers.interopDefault(_transverseMercatorJs); -var _rotationJs = require("./rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _transformJs = require("./transform.js"); -var _transformJsDefault = parcelHelpers.interopDefault(_transformJs); - -},{"./area.js":"iajNA","./bounds.js":"9Dbky","./centroid.js":"kO6wx","./circle.js":false,"./clip/antimeridian.js":false,"./clip/circle.js":false,"./clip/extent.js":false,"./clip/rectangle.js":false,"./contains.js":false,"./distance.js":false,"./graticule.js":"arQrO","./interpolate.js":false,"./length.js":false,"./path/index.js":"gBtNJ","./projection/albers.js":"dSks5","./projection/albersUsa.js":"4lZJF","./projection/azimuthalEqualArea.js":"jbLs0","./projection/azimuthalEquidistant.js":"eAR2Q","./projection/conicConformal.js":"dhBsj","./projection/conicEqualArea.js":"17j9x","./projection/conicEquidistant.js":"6B358","./projection/equalEarth.js":"bMVhy","./projection/equirectangular.js":"4kEjS","./projection/gnomonic.js":"6bdgO","./projection/identity.js":"huYSV","./projection/index.js":"cd9OX","./projection/mercator.js":"iIGjZ","./projection/naturalEarth1.js":"4AzsZ","./projection/orthographic.js":"kjinQ","./projection/stereographic.js":"6ko7r","./projection/transverseMercator.js":"i6NVd","./rotation.js":false,"./stream.js":false,"./transform.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iajNA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "areaRingSum", ()=>areaRingSum); -parcelHelpers.export(exports, "areaStream", ()=>areaStream); -parcelHelpers.export(exports, "default", ()=>function(object) { - areaSum = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, areaStream); - return areaSum * 2; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var areaRingSum = new (0, _d3Array.Adder)(); -// hello? -var areaSum = new (0, _d3Array.Adder)(), lambda00, phi00, lambda0, cosPhi0, sinPhi0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaRingSum = new (0, _d3Array.Adder)(); - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; + "cardinal-closed": { + curve: curveCardinalClosed, + tension: "tension", + value: 0 }, - polygonEnd: function() { - var areaRing = +areaRingSum; - areaSum.add(areaRing < 0 ? (0, _mathJs.tau) + areaRing : areaRing); - this.lineStart = this.lineEnd = this.point = (0, _noopJsDefault.default); + "catmull-rom": { + curve: curveCatmullRom, + tension: "alpha", + value: 0.5 }, - sphere: function() { - areaSum.add((0, _mathJs.tau)); - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaRingEnd() { - areaPoint(lambda00, phi00); -} -function areaPointFirst(lambda, phi) { - areaStream.point = areaPoint; - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - lambda0 = lambda, cosPhi0 = (0, _mathJs.cos)(phi = phi / 2 + (0, _mathJs.quarterPi)), sinPhi0 = (0, _mathJs.sin)(phi); -} -function areaPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - phi = phi / 2 + (0, _mathJs.quarterPi); // half the angular distance from south pole - // Spherical excess E for a spherical triangle with vertices: south pole, - // previous point, current point. Uses a formula derived from Cagnoli’s - // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). - var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = (0, _mathJs.cos)(phi), sinPhi = (0, _mathJs.sin)(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * (0, _mathJs.cos)(adLambda), v = k * sdLambda * (0, _mathJs.sin)(adLambda); - areaRingSum.add((0, _mathJs.atan2)(v, u)); - // Advance the previous points. - lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; -} - -},{"d3-array":"6IwJG","./math.js":"74X19","./noop.js":"aXmaS","./stream.js":"9nFXd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"74X19":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "hypot", ()=>hypot); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "haversin", ()=>haversin); -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var cos = Math.cos; -var ceil = Math.ceil; -var exp = Math.exp; -var floor = Math.floor; -var hypot = Math.hypot; -var log = Math.log; -var pow = Math.pow; -var sin = Math.sin; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sqrt = Math.sqrt; -var tan = Math.tan; -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function haversin(x) { - return (x = sin(x / 2)) * x; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aXmaS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>noop); -function noop() {} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9nFXd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object, stream) { - if (object && streamObjectType.hasOwnProperty(object.type)) streamObjectType[object.type](object, stream); - else streamGeometry(object, stream); - }); -function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) streamGeometryType[geometry.type](geometry, stream); -} -var streamObjectType = { - Feature: function(object, stream) { - streamGeometry(object.geometry, stream); + "catmull-rom-closed": { + curve: curveCatmullRomClosed, + tension: "alpha", + value: 0.5 }, - FeatureCollection: function(object, stream) { - var features = object.features, i = -1, n = features.length; - while(++i < n)streamGeometry(features[i].geometry, stream); - } -}; -var streamGeometryType = { - Sphere: function(object, stream) { - stream.sphere(); + "catmull-rom-open": { + curve: curveCatmullRomOpen, + tension: "alpha", + value: 0.5 }, - Point: function(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); + "linear": { + curve: curveLinear }, - MultiPoint: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)object = coordinates[i], stream.point(object[0], object[1], object[2]); + "linear-closed": { + curve: curveLinearClosed }, - LineString: function(object, stream) { - streamLine(object.coordinates, stream, 0); + "monotone": { + horizontal: monotoneY, + vertical: monotoneX }, - MultiLineString: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamLine(coordinates[i], stream, 0); + "natural": { + curve: curveNatural }, - Polygon: function(object, stream) { - streamPolygon(object.coordinates, stream); + "step": { + curve: curveStep }, - MultiPolygon: function(object, stream) { - var coordinates = object.coordinates, i = -1, n = coordinates.length; - while(++i < n)streamPolygon(coordinates[i], stream); + "step-after": { + curve: stepAfter }, - GeometryCollection: function(object, stream) { - var geometries = object.geometries, i = -1, n = geometries.length; - while(++i < n)streamGeometry(geometries[i], stream); + "step-before": { + curve: stepBefore } -}; -function streamLine(coordinates, stream, closed) { - var i = -1, n = coordinates.length - closed, coordinate; - stream.lineStart(); - while(++i < n)coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - stream.lineEnd(); -} -function streamPolygon(coordinates, stream) { - var i = -1, n = coordinates.length; - stream.polygonStart(); - while(++i < n)streamLine(coordinates[i], stream, 1); - stream.polygonEnd(); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9Dbky":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(feature) { - var i, n, a, b, merged, deltaMax, delta; - phi1 = lambda1 = -(lambda0 = phi0 = Infinity); - ranges = []; - (0, _streamJsDefault.default)(feature, boundsStream); - // First, sort ranges by their minimum longitudes. - if (n = ranges.length) { - ranges.sort(rangeCompare); - // Then, merge any ranges that overlap. - for(i = 1, a = ranges[0], merged = [ - a - ]; i < n; ++i){ - b = ranges[i]; - if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { - if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; - if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; - } else merged.push(a = b); - } - // Finally, find the largest gap between the merged ranges. - // The final bounding box will be the inverse of this gap. - for(deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i){ - b = merged[i]; - if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1]; - } - } - ranges = range = null; - return lambda0 === Infinity || phi0 === Infinity ? [ - [ - NaN, - NaN - ], - [ - NaN, - NaN - ] - ] : [ - [ - lambda0, - phi0 - ], - [ - lambda1, - phi1 - ] - ]; + }; + function curves(type2, orientation, tension) { + var entry2 = has$1(lookup$4, type2) && lookup$4[type2], curve2 = null; + if (entry2) { + curve2 = entry2.curve || entry2[orientation || "vertical"]; + if (entry2.tension && tension != null) { + curve2 = curve2[entry2.tension](tension); + } + } + return curve2; + } + const paramCounts = { + m: 2, + l: 2, + h: 1, + v: 1, + z: 0, + c: 6, + s: 4, + q: 4, + t: 2, + a: 7 + }; + const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi; + const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/; + const spacePattern = /^((\s+,?\s*)|(,\s*))/; + const flagPattern = /^[01]/; + function parse$3(path2) { + const commands = []; + const matches = path2.match(commandPattern) || []; + matches.forEach((str) => { + let cmd = str[0]; + const type2 = cmd.toLowerCase(); + const paramCount = paramCounts[type2]; + const params2 = parseParams(type2, paramCount, str.slice(1).trim()); + const count2 = params2.length; + if (count2 < paramCount || count2 && count2 % paramCount !== 0) { + throw Error("Invalid SVG path, incorrect parameter count"); + } + commands.push([cmd, ...params2.slice(0, paramCount)]); + if (count2 === paramCount) { + return; + } + if (type2 === "m") { + cmd = cmd === "M" ? "L" : "l"; + } + for (let i = paramCount; i < count2; i += paramCount) { + commands.push([cmd, ...params2.slice(i, i + paramCount)]); + } }); -var _d3Array = require("d3-array"); -var _areaJs = require("./area.js"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var lambda0, phi0, lambda1, phi1, lambda2, lambda00, phi00, p0, deltaSum, ranges, range; -var boundsStream = { - point: boundsPoint, - lineStart: boundsLineStart, - lineEnd: boundsLineEnd, - polygonStart: function() { - boundsStream.point = boundsRingPoint; - boundsStream.lineStart = boundsRingStart; - boundsStream.lineEnd = boundsRingEnd; - deltaSum = new (0, _d3Array.Adder)(); - (0, _areaJs.areaStream).polygonStart(); + return commands; + } + function parseParams(type2, paramCount, segment) { + const params2 = []; + for (let index2 = 0; paramCount && index2 < segment.length; ) { + for (let i = 0; i < paramCount; ++i) { + const pattern = type2 === "a" && (i === 3 || i === 4) ? flagPattern : numberPattern; + const match2 = segment.slice(index2).match(pattern); + if (match2 === null) { + throw Error("Invalid SVG path, incorrect parameter type"); + } + index2 += match2[0].length; + params2.push(+match2[0]); + const ws = segment.slice(index2).match(spacePattern); + if (ws !== null) { + index2 += ws[0].length; + } + } + } + return params2; + } + const DegToRad = Math.PI / 180; + const Epsilon = 1e-14; + const HalfPi = Math.PI / 2; + const Tau = Math.PI * 2; + const HalfSqrt3 = Math.sqrt(3) / 2; + var segmentCache = {}; + var bezierCache = {}; + var join$1 = [].join; + function segments(x2, y2, rx, ry, large, sweep, rotateX2, ox, oy) { + const key2 = join$1.call(arguments); + if (segmentCache[key2]) { + return segmentCache[key2]; + } + const th = rotateX2 * DegToRad; + const sin_th = Math.sin(th); + const cos_th = Math.cos(th); + rx = Math.abs(rx); + ry = Math.abs(ry); + const px2 = cos_th * (ox - x2) * 0.5 + sin_th * (oy - y2) * 0.5; + const py2 = cos_th * (oy - y2) * 0.5 - sin_th * (ox - x2) * 0.5; + let pl = px2 * px2 / (rx * rx) + py2 * py2 / (ry * ry); + if (pl > 1) { + pl = Math.sqrt(pl); + rx *= pl; + ry *= pl; + } + const a00 = cos_th / rx; + const a01 = sin_th / rx; + const a10 = -sin_th / ry; + const a11 = cos_th / ry; + const x02 = a00 * ox + a01 * oy; + const y02 = a10 * ox + a11 * oy; + const x12 = a00 * x2 + a01 * y2; + const y12 = a10 * x2 + a11 * y2; + const d = (x12 - x02) * (x12 - x02) + (y12 - y02) * (y12 - y02); + let sfactor_sq = 1 / d - 0.25; + if (sfactor_sq < 0) sfactor_sq = 0; + let sfactor = Math.sqrt(sfactor_sq); + if (sweep == large) sfactor = -sfactor; + const xc = 0.5 * (x02 + x12) - sfactor * (y12 - y02); + const yc = 0.5 * (y02 + y12) + sfactor * (x12 - x02); + const th0 = Math.atan2(y02 - yc, x02 - xc); + const th1 = Math.atan2(y12 - yc, x12 - xc); + let th_arc = th1 - th0; + if (th_arc < 0 && sweep === 1) { + th_arc += Tau; + } else if (th_arc > 0 && sweep === 0) { + th_arc -= Tau; + } + const segs = Math.ceil(Math.abs(th_arc / (HalfPi + 1e-3))); + const result = []; + for (let i = 0; i < segs; ++i) { + const th2 = th0 + i * th_arc / segs; + const th3 = th0 + (i + 1) * th_arc / segs; + result[i] = [xc, yc, th2, th3, rx, ry, sin_th, cos_th]; + } + return segmentCache[key2] = result; + } + function bezier(params2) { + const key2 = join$1.call(params2); + if (bezierCache[key2]) { + return bezierCache[key2]; + } + var cx = params2[0], cy = params2[1], th0 = params2[2], th1 = params2[3], rx = params2[4], ry = params2[5], sin_th = params2[6], cos_th = params2[7]; + const a00 = cos_th * rx; + const a01 = -sin_th * ry; + const a10 = sin_th * rx; + const a11 = cos_th * ry; + const cos_th0 = Math.cos(th0); + const sin_th0 = Math.sin(th0); + const cos_th1 = Math.cos(th1); + const sin_th1 = Math.sin(th1); + const th_half = 0.5 * (th1 - th0); + const sin_th_h2 = Math.sin(th_half * 0.5); + const t = 8 / 3 * sin_th_h2 * sin_th_h2 / Math.sin(th_half); + const x12 = cx + cos_th0 - t * sin_th0; + const y12 = cy + sin_th0 + t * cos_th0; + const x3 = cx + cos_th1; + const y3 = cy + sin_th1; + const x2 = x3 + t * sin_th1; + const y2 = y3 - t * cos_th1; + return bezierCache[key2] = [a00 * x12 + a01 * y12, a10 * x12 + a11 * y12, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3]; + } + const temp = ["l", 0, 0, 0, 0, 0, 0, 0]; + function scale$1$1(current, sX, sY) { + const c2 = temp[0] = current[0]; + if (c2 === "a" || c2 === "A") { + temp[1] = sX * current[1]; + temp[2] = sY * current[2]; + temp[3] = current[3]; + temp[4] = current[4]; + temp[5] = current[5]; + temp[6] = sX * current[6]; + temp[7] = sY * current[7]; + } else if (c2 === "h" || c2 === "H") { + temp[1] = sX * current[1]; + } else if (c2 === "v" || c2 === "V") { + temp[1] = sY * current[1]; + } else { + for (var i = 1, n = current.length; i < n; ++i) { + temp[i] = (i % 2 == 1 ? sX : sY) * current[i]; + } + } + return temp; + } + function pathRender(context2, path2, l, t, sX, sY) { + var current, previous = null, x2 = 0, y2 = 0, controlX = 0, controlY = 0, tempX, tempY, tempControlX, tempControlY, anchorX = 0, anchorY = 0; + if (l == null) l = 0; + if (t == null) t = 0; + if (sX == null) sX = 1; + if (sY == null) sY = sX; + if (context2.beginPath) context2.beginPath(); + for (var i = 0, len2 = path2.length; i < len2; ++i) { + current = path2[i]; + if (sX !== 1 || sY !== 1) { + current = scale$1$1(current, sX, sY); + } + switch (current[0]) { + // first letter + case "l": + x2 += current[1]; + y2 += current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "L": + x2 = current[1]; + y2 = current[2]; + context2.lineTo(x2 + l, y2 + t); + break; + case "h": + x2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "H": + x2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "v": + y2 += current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "V": + y2 = current[1]; + context2.lineTo(x2 + l, y2 + t); + break; + case "m": + x2 += current[1]; + y2 += current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "M": + x2 = current[1]; + y2 = current[2]; + anchorX = x2; + anchorY = y2; + context2.moveTo(x2 + l, y2 + t); + break; + case "c": + tempX = x2 + current[5]; + tempY = y2 + current[6]; + controlX = x2 + current[3]; + controlY = y2 + current[4]; + context2.bezierCurveTo( + x2 + current[1] + l, + // x1 + y2 + current[2] + t, + // y1 + controlX + l, + // x2 + controlY + t, + // y2 + tempX + l, + tempY + t + ); + x2 = tempX; + y2 = tempY; + break; + case "C": + x2 = current[5]; + y2 = current[6]; + controlX = current[3]; + controlY = current[4]; + context2.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x2 + l, y2 + t); + break; + case "s": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, x2 + current[1] + l, y2 + current[2] + t, tempX + l, tempY + t); + controlX = x2 + current[1]; + controlY = y2 + current[2]; + x2 = tempX; + y2 = tempY; + break; + case "S": + tempX = current[3]; + tempY = current[4]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "q": + tempX = x2 + current[3]; + tempY = y2 + current[4]; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "Q": + tempX = current[3]; + tempY = current[4]; + context2.quadraticCurveTo(current[1] + l, current[2] + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = current[1]; + controlY = current[2]; + break; + case "t": + tempX = x2 + current[1]; + tempY = y2 + current[2]; + if (previous[0].match(/[QqTt]/) === null) { + controlX = x2; + controlY = y2; + } else if (previous[0] === "t") { + controlX = 2 * x2 - tempControlX; + controlY = 2 * y2 - tempControlY; + } else if (previous[0] === "q") { + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + } + tempControlX = controlX; + tempControlY = controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + controlX = x2 + current[1]; + controlY = y2 + current[2]; + break; + case "T": + tempX = current[1]; + tempY = current[2]; + controlX = 2 * x2 - controlX; + controlY = 2 * y2 - controlY; + context2.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t); + x2 = tempX; + y2 = tempY; + break; + case "a": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + x2 + l, current[7] + y2 + t]); + x2 += current[6]; + y2 += current[7]; + break; + case "A": + drawArc(context2, x2 + l, y2 + t, [current[1], current[2], current[3], current[4], current[5], current[6] + l, current[7] + t]); + x2 = current[6]; + y2 = current[7]; + break; + case "z": + case "Z": + x2 = anchorX; + y2 = anchorY; + context2.closePath(); + break; + } + previous = current; + } + } + function drawArc(context2, x2, y2, coords) { + const seg = segments( + coords[5], + // end x + coords[6], + // end y + coords[0], + // radius x + coords[1], + // radius y + coords[3], + // large flag + coords[4], + // sweep flag + coords[2], + // rotation + x2, + y2 + ); + for (let i = 0; i < seg.length; ++i) { + const bez = bezier(seg[i]); + context2.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]); + } + } + const Tan30 = 0.5773502691896257; + const builtins = { + "circle": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(r, 0); + context2.arc(0, 0, r, 0, Tau); + } }, - polygonEnd: function() { - (0, _areaJs.areaStream).polygonEnd(); - boundsStream.point = boundsPoint; - boundsStream.lineStart = boundsLineStart; - boundsStream.lineEnd = boundsLineEnd; - if ((0, _areaJs.areaRingSum) < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - else if (deltaSum > (0, _mathJs.epsilon)) phi1 = 90; - else if (deltaSum < -(0, _mathJs.epsilon)) phi0 = -90; - range[0] = lambda0, range[1] = lambda1; + "cross": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, s = r / 2.5; + context2.moveTo(-r, -s); + context2.lineTo(-r, s); + context2.lineTo(-s, s); + context2.lineTo(-s, r); + context2.lineTo(s, r); + context2.lineTo(s, s); + context2.lineTo(r, s); + context2.lineTo(r, -s); + context2.lineTo(s, -s); + context2.lineTo(s, -r); + context2.lineTo(-s, -r); + context2.lineTo(-s, -s); + context2.closePath(); + } }, - sphere: function() { - lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); - } -}; -function boundsPoint(lambda, phi) { - ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; -} -function linePoint(lambda, phi) { - var p = (0, _cartesianJs.cartesian)([ - lambda * (0, _mathJs.radians), - phi * (0, _mathJs.radians) - ]); - if (p0) { - var normal = (0, _cartesianJs.cartesianCross)(p0, p), equatorial = [ - normal[1], - -normal[0], - 0 - ], inflection = (0, _cartesianJs.cartesianCross)(equatorial, normal); - (0, _cartesianJs.cartesianNormalizeInPlace)(inflection); - inflection = (0, _cartesianJs.spherical)(inflection); - var delta = lambda - lambda2, sign = delta > 0 ? 1 : -1, lambdai = inflection[0] * (0, _mathJs.degrees) * sign, phii, antimeridian = (0, _mathJs.abs)(delta) > 180; - if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = inflection[1] * (0, _mathJs.degrees); - if (phii > phi1) phi1 = phii; - } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) { - phii = -inflection[1] * (0, _mathJs.degrees); - if (phii < phi0) phi0 = phii; - } else { - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - } - if (antimeridian) { - if (lambda < lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } else if (lambda1 >= lambda0) { - if (lambda < lambda0) lambda0 = lambda; - if (lambda > lambda1) lambda1 = lambda; - } else { - if (lambda > lambda2) { - if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; - } else if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; - } - } else ranges.push(range = [ - lambda0 = lambda, - lambda1 = lambda - ]); - if (phi < phi0) phi0 = phi; - if (phi > phi1) phi1 = phi; - p0 = p, lambda2 = lambda; -} -function boundsLineStart() { - boundsStream.point = linePoint; -} -function boundsLineEnd() { - range[0] = lambda0, range[1] = lambda1; - boundsStream.point = boundsPoint; - p0 = null; -} -function boundsRingPoint(lambda, phi) { - if (p0) { - var delta = lambda - lambda2; - deltaSum.add((0, _mathJs.abs)(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); - } else lambda00 = lambda, phi00 = phi; - (0, _areaJs.areaStream).point(lambda, phi); - linePoint(lambda, phi); -} -function boundsRingStart() { - (0, _areaJs.areaStream).lineStart(); -} -function boundsRingEnd() { - boundsRingPoint(lambda00, phi00); - (0, _areaJs.areaStream).lineEnd(); - if ((0, _mathJs.abs)(deltaSum) > (0, _mathJs.epsilon)) lambda0 = -(lambda1 = 180); - range[0] = lambda0, range[1] = lambda1; - p0 = null; -} -// Finds the left-right distance between two longitudes. -// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want -// the distance between ±180° to be 360°. -function angle(lambda0, lambda1) { - return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; -} -function rangeCompare(a, b) { - return a[0] - b[0]; -} -function rangeContains(range, x) { - return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; -} - -},{"d3-array":"6IwJG","./area.js":"iajNA","./cartesian.js":"i2DwM","./math.js":"74X19","./stream.js":"9nFXd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i2DwM":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "spherical", ()=>spherical); -parcelHelpers.export(exports, "cartesian", ()=>cartesian); -parcelHelpers.export(exports, "cartesianDot", ()=>cartesianDot); -parcelHelpers.export(exports, "cartesianCross", ()=>cartesianCross); -// TODO return a -parcelHelpers.export(exports, "cartesianAddInPlace", ()=>cartesianAddInPlace); -parcelHelpers.export(exports, "cartesianScale", ()=>cartesianScale); -// TODO return d -parcelHelpers.export(exports, "cartesianNormalizeInPlace", ()=>cartesianNormalizeInPlace); -var _mathJs = require("./math.js"); -function spherical(cartesian) { - return [ - (0, _mathJs.atan2)(cartesian[1], cartesian[0]), - (0, _mathJs.asin)(cartesian[2]) - ]; -} -function cartesian(spherical) { - var lambda = spherical[0], phi = spherical[1], cosPhi = (0, _mathJs.cos)(phi); - return [ - cosPhi * (0, _mathJs.cos)(lambda), - cosPhi * (0, _mathJs.sin)(lambda), - (0, _mathJs.sin)(phi) - ]; -} -function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cartesianCross(a, b) { - return [ - a[1] * b[2] - a[2] * b[1], - a[2] * b[0] - a[0] * b[2], - a[0] * b[1] - a[1] * b[0] - ]; -} -function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; -} -function cartesianScale(vector, k) { - return [ - vector[0] * k, - vector[1] * k, - vector[2] * k - ]; -} -function cartesianNormalizeInPlace(d) { - var l = (0, _mathJs.sqrt)(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; -} - -},{"./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kO6wx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(object) { - W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0; - X2 = new (0, _d3Array.Adder)(); - Y2 = new (0, _d3Array.Adder)(); - Z2 = new (0, _d3Array.Adder)(); - (0, _streamJsDefault.default)(object, centroidStream); - var x = +X2, y = +Y2, z = +Z2, m = (0, _mathJs.hypot)(x, y, z); - // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. - if (m < (0, _mathJs.epsilon2)) { - x = X1, y = Y1, z = Z1; - // If the feature has zero length, fall back to arithmetic mean of point vectors. - if (W1 < (0, _mathJs.epsilon)) x = X0, y = Y0, z = Z0; - m = (0, _mathJs.hypot)(x, y, z); - // If the feature still has an undefined ccentroid, then return. - if (m < (0, _mathJs.epsilon2)) return [ - NaN, - NaN - ]; - } - return [ - (0, _mathJs.atan2)(y, x) * (0, _mathJs.degrees), - (0, _mathJs.asin)(z / m) * (0, _mathJs.degrees) - ]; - }); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -var _noopJs = require("./noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var _streamJs = require("./stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00, phi00, x0, y0, z0; // previous point -var centroidStream = { - sphere: (0, _noopJsDefault.default), - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - } -}; -// Arithmetic mean of Cartesian vectors. -function centroidPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - centroidPointCartesian(cosPhi * (0, _mathJs.cos)(lambda), cosPhi * (0, _mathJs.sin)(lambda), (0, _mathJs.sin)(phi)); -} -function centroidPointCartesian(x, y, z) { - ++W0; - X0 += (x - X0) / W0; - Y0 += (y - Y0) / W0; - Z0 += (z - Z0) / W0; -} -function centroidLineStart() { - centroidStream.point = centroidLinePointFirst; -} -function centroidLinePointFirst(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidStream.point = centroidLinePoint; - centroidPointCartesian(x0, y0, z0); -} -function centroidLinePoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), w = (0, _mathJs.atan2)((0, _mathJs.sqrt)((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, -// J. Applied Mechanics 42, 239 (1975). -function centroidRingStart() { - centroidStream.point = centroidRingPointFirst; -} -function centroidRingEnd() { - centroidRingPoint(lambda00, phi00); - centroidStream.point = centroidPoint; -} -function centroidRingPointFirst(lambda, phi) { - lambda00 = lambda, phi00 = phi; - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - centroidStream.point = centroidRingPoint; - var cosPhi = (0, _mathJs.cos)(phi); - x0 = cosPhi * (0, _mathJs.cos)(lambda); - y0 = cosPhi * (0, _mathJs.sin)(lambda); - z0 = (0, _mathJs.sin)(phi); - centroidPointCartesian(x0, y0, z0); -} -function centroidRingPoint(lambda, phi) { - lambda *= (0, _mathJs.radians), phi *= (0, _mathJs.radians); - var cosPhi = (0, _mathJs.cos)(phi), x = cosPhi * (0, _mathJs.cos)(lambda), y = cosPhi * (0, _mathJs.sin)(lambda), z = (0, _mathJs.sin)(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = (0, _mathJs.hypot)(cx, cy, cz), w = (0, _mathJs.asin)(m), v = m && -w / m; // area weight multiplier - X2.add(v * cx); - Y2.add(v * cy); - Z2.add(v * cz); - W1 += w; - X1 += w * (x0 + (x0 = x)); - Y1 += w * (y0 + (y0 = y)); - Z1 += w * (z0 + (z0 = z)); - centroidPointCartesian(x0, y0, z0); -} - -},{"d3-array":"6IwJG","./math.js":"74X19","./noop.js":"aXmaS","./stream.js":"9nFXd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPX3u":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Generates a circle centered at [0°, 0°], with a given radius and precision. -parcelHelpers.export(exports, "circleStream", ()=>circleStream); -parcelHelpers.export(exports, "default", ()=>function() { - var center = (0, _constantJsDefault.default)([ - 0, - 0 - ]), radius = (0, _constantJsDefault.default)(90), precision = (0, _constantJsDefault.default)(2), ring, rotate, stream = { - point: point - }; - function point(x, y) { - ring.push(x = rotate(x, y)); - x[0] *= (0, _mathJs.degrees), x[1] *= (0, _mathJs.degrees); - } - function circle() { - var c = center.apply(this, arguments), r = radius.apply(this, arguments) * (0, _mathJs.radians), p = precision.apply(this, arguments) * (0, _mathJs.radians); - ring = []; - rotate = (0, _rotationJs.rotateRadians)(-c[0] * (0, _mathJs.radians), -c[1] * (0, _mathJs.radians), 0).invert; - circleStream(stream, r, p, 1); - c = { - type: "Polygon", - coordinates: [ - ring - ] - }; - ring = rotate = null; - return c; - } - circle.center = function(_) { - return arguments.length ? (center = typeof _ === "function" ? _ : (0, _constantJsDefault.default)([ - +_[0], - +_[1] - ]), circle) : center; - }; - circle.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : radius; - }; - circle.precision = function(_) { - return arguments.length ? (precision = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), circle) : precision; - }; - return circle; - }); -var _cartesianJs = require("./cartesian.js"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _mathJs = require("./math.js"); -var _rotationJs = require("./rotation.js"); -function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = (0, _mathJs.cos)(radius), sinRadius = (0, _mathJs.sin)(radius), step = direction * delta; - if (t0 == null) { - t0 = radius + direction * (0, _mathJs.tau); - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * (0, _mathJs.tau); - } - for(var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step){ - point = (0, _cartesianJs.spherical)([ - cosRadius, - -sinRadius * (0, _mathJs.cos)(t), - -sinRadius * (0, _mathJs.sin)(t) - ]); - stream.point(point[0], point[1]); - } -} -// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. -function circleRadius(cosRadius, point) { - point = (0, _cartesianJs.cartesian)(point), point[0] -= cosRadius; - (0, _cartesianJs.cartesianNormalizeInPlace)(point); - var radius = (0, _mathJs.acos)(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + (0, _mathJs.tau) - (0, _mathJs.epsilon)) % (0, _mathJs.tau); -} - -},{"./cartesian.js":"i2DwM","./constant.js":"en6KO","./math.js":"74X19","./rotation.js":"8C7qH","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"en6KO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8C7qH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "rotateRadians", ()=>rotateRadians); -parcelHelpers.export(exports, "default", ()=>function(rotate) { - rotate = rotateRadians(rotate[0] * (0, _mathJs.radians), rotate[1] * (0, _mathJs.radians), rotate.length > 2 ? rotate[2] * (0, _mathJs.radians) : 0); - function forward(coordinates) { - coordinates = rotate(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - } - forward.invert = function(coordinates) { - coordinates = rotate.invert(coordinates[0] * (0, _mathJs.radians), coordinates[1] * (0, _mathJs.radians)); - return coordinates[0] *= (0, _mathJs.degrees), coordinates[1] *= (0, _mathJs.degrees), coordinates; - }; - return forward; - }); -var _composeJs = require("./compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _mathJs = require("./math.js"); -function rotationIdentity(lambda, phi) { - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; -} -rotationIdentity.invert = rotationIdentity; -function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= (0, _mathJs.tau)) ? deltaPhi || deltaGamma ? (0, _composeJsDefault.default)(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; -} -function forwardRotationLambda(deltaLambda) { - return function(lambda, phi) { - lambda += deltaLambda; - if ((0, _mathJs.abs)(lambda) > (0, _mathJs.pi)) lambda -= Math.round(lambda / (0, _mathJs.tau)) * (0, _mathJs.tau); - return [ - lambda, - phi - ]; - }; -} -function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; -} -function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = (0, _mathJs.cos)(deltaPhi), sinDeltaPhi = (0, _mathJs.sin)(deltaPhi), cosDeltaGamma = (0, _mathJs.cos)(deltaGamma), sinDeltaGamma = (0, _mathJs.sin)(deltaGamma); - function rotation(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaPhi + x * sinDeltaPhi; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaGamma + y * sinDeltaGamma) - ]; - } - rotation.invert = function(lambda, phi) { - var cosPhi = (0, _mathJs.cos)(phi), x = (0, _mathJs.cos)(lambda) * cosPhi, y = (0, _mathJs.sin)(lambda) * cosPhi, z = (0, _mathJs.sin)(phi), k = z * cosDeltaGamma - y * sinDeltaGamma; - return [ - (0, _mathJs.atan2)(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), - (0, _mathJs.asin)(k * cosDeltaPhi - x * sinDeltaPhi) - ]; - }; - return rotation; -} - -},{"./compose.js":"hmaf3","./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hmaf3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - if (a.invert && b.invert) compose.invert = function(x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kvVxQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -exports.default = (0, _indexJsDefault.default)(function() { - return true; -}, clipAntimeridianLine, clipAntimeridianInterpolate, [ - -(0, _mathJs.pi), - -(0, _mathJs.halfPi) -]); -// Takes a line and cuts into visible segments. Return values: 0 - there were -// intersections or the line was empty; 1 - no intersections; 2 - there were -// intersections, and the first and last segments should be rejoined. -function clipAntimeridianLine(stream) { - var lambda0 = NaN, phi0 = NaN, sign0 = NaN, clean; // no intersections - return { - lineStart: function() { - stream.lineStart(); - clean = 1; - }, - point: function(lambda1, phi1) { - var sign1 = lambda1 > 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi), delta = (0, _mathJs.abs)(lambda1 - lambda0); - if ((0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon)) { - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? (0, _mathJs.halfPi) : -(0, _mathJs.halfPi)); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - clean = 0; - } else if (sign0 !== sign1 && delta >= (0, _mathJs.pi)) { - if ((0, _mathJs.abs)(lambda0 - sign0) < (0, _mathJs.epsilon)) lambda0 -= sign0 * (0, _mathJs.epsilon); // handle degeneracies - if ((0, _mathJs.abs)(lambda1 - sign1) < (0, _mathJs.epsilon)) lambda1 -= sign1 * (0, _mathJs.epsilon); - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - clean = 0; - } - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function() { - return 2 - clean; // if intersections, rejoin first and last segments - } - }; -} -function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, cosPhi1, sinLambda0Lambda1 = (0, _mathJs.sin)(lambda0 - lambda1); - return (0, _mathJs.abs)(sinLambda0Lambda1) > (0, _mathJs.epsilon) ? (0, _mathJs.atan)(((0, _mathJs.sin)(phi0) * (cosPhi1 = (0, _mathJs.cos)(phi1)) * (0, _mathJs.sin)(lambda1) - (0, _mathJs.sin)(phi1) * (cosPhi0 = (0, _mathJs.cos)(phi0)) * (0, _mathJs.sin)(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2; -} -function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - if (from == null) { - phi = direction * (0, _mathJs.halfPi); - stream.point(-(0, _mathJs.pi), phi); - stream.point(0, phi); - stream.point((0, _mathJs.pi), phi); - stream.point((0, _mathJs.pi), 0); - stream.point((0, _mathJs.pi), -phi); - stream.point(0, -phi); - stream.point(-(0, _mathJs.pi), -phi); - stream.point(-(0, _mathJs.pi), 0); - stream.point(-(0, _mathJs.pi), phi); - } else if ((0, _mathJs.abs)(from[0] - to[0]) > (0, _mathJs.epsilon)) { - var lambda = from[0] < to[0] ? (0, _mathJs.pi) : -(0, _mathJs.pi); - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else stream.point(to[0], to[1]); -} - -},{"./index.js":"gHqWc","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gHqWc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(pointVisible, clipLine, interpolate, start) { - return function(sink) { - var line = clipLine(sink), ringBuffer = (0, _bufferJsDefault.default)(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon, segments, ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = (0, _d3Array.merge)(segments); - var startInside = (0, _polygonContainsJsDefault.default)(polygon, start); - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function() { - sink.polygonStart(); - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - sink.polygonEnd(); - } - }; - function point(lambda, phi) { - if (pointVisible(lambda, phi)) sink.point(lambda, phi); - } - function pointLine(lambda, phi) { - line.point(lambda, phi); - } - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - function pointRing(lambda, phi) { - ring.push([ - lambda, - phi - ]); - ringSink.point(lambda, phi); - } - function ringStart() { - ringSink.lineStart(); - ring = []; - } - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m, segment, point; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; - // No intersections. - if (clean & 1) { - segment = ringSegments[0]; - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - for(i = 0; i < m; ++i)sink.point((point = segment[i])[0], point[1]); - sink.lineEnd(); - } - return; - } - // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(validSegment)); - } - return clip; - }; - }); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _mathJs = require("../math.js"); -var _polygonContainsJs = require("../polygonContains.js"); -var _polygonContainsJsDefault = parcelHelpers.interopDefault(_polygonContainsJs); -var _d3Array = require("d3-array"); -function validSegment(segment) { - return segment.length > 1; -} -// Intersections are sorted along the clip edge. For both antimeridian cutting -// and circle clipping, the same comparison is used. -function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - a[1]) - ((b = b.x)[0] < 0 ? b[1] - (0, _mathJs.halfPi) - (0, _mathJs.epsilon) : (0, _mathJs.halfPi) - b[1]); -} - -},{"./buffer.js":"6d6VN","./rejoin.js":"6J55y","../math.js":"74X19","../polygonContains.js":"13VDK","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6d6VN":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var lines = [], line; - return { - point: function(x, y, m) { - line.push([ - x, - y, - m - ]); - }, - lineStart: function() { - lines.push(line = []); - }, - lineEnd: (0, _noopJsDefault.default), - rejoin: function() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function() { - var result = lines; - lines = []; - line = null; - return result; - } - }; - }); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); - -},{"../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6J55y":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A generalized polygon clipping algorithm: given a polygon that has been cut -// into its visible line segments, and rejoins the segments by interpolating -// along the clip edge. -parcelHelpers.export(exports, "default", ()=>function(segments, compareIntersection, startInside, interpolate, stream) { - var subject = [], clip = [], i, n; - segments.forEach(function(segment) { - if ((n = segment.length - 1) <= 0) return; - var n, p0 = segment[0], p1 = segment[n], x; - if ((0, _pointEqualJsDefault.default)(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - for(i = 0; i < n; ++i)stream.point((p0 = segment[i])[0], p0[1]); - stream.lineEnd(); - return; - } - // handle degenerate cases by moving the point - p1[0] += 2 * (0, _mathJs.epsilon); - } - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - if (!subject.length) return; - clip.sort(compareIntersection); - link(subject); - link(clip); - for(i = 0, n = clip.length; i < n; ++i)clip[i].e = startInside = !startInside; - var start = subject[0], points, point; - while(true){ - // Find first unvisited intersection. - var current = start, isSubject = true; - while(current.v)if ((current = current.n) === start) return; - points = current.z; - stream.lineStart(); - do { - current.v = current.o.v = true; - if (current.e) { - if (isSubject) for(i = 0, n = points.length; i < n; ++i)stream.point((point = points[i])[0], point[1]); - else interpolate(current.x, current.n.x, 1, stream); - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - for(i = points.length - 1; i >= 0; --i)stream.point((point = points[i])[0], point[1]); - } else interpolate(current.x, current.p.x, -1, stream); - current = current.p; - } - current = current.o; - points = current.z; - isSubject = !isSubject; - }while (!current.v); - stream.lineEnd(); - } - }); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _mathJs = require("../math.js"); -function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - this.e = entry; // is an entry? - this.v = false; // visited - this.n = this.p = null; // next & previous -} -function link(array) { - if (!(n = array.length)) return; - var n, i = 0, a = array[0], b; - while(++i < n){ - a.n = b = array[i]; - b.p = a; - a = b; - } - a.n = b = array[0]; - b.p = a; -} - -},{"../pointEqual.js":"f0mBF","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f0mBF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b) { - return (0, _mathJs.abs)(a[0] - b[0]) < (0, _mathJs.epsilon) && (0, _mathJs.abs)(a[1] - b[1]) < (0, _mathJs.epsilon); - }); -var _mathJs = require("./math.js"); - -},{"./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"13VDK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(polygon, point) { - var lambda = longitude(point), phi = point[1], sinPhi = (0, _mathJs.sin)(phi), normal = [ - (0, _mathJs.sin)(lambda), - -(0, _mathJs.cos)(lambda), - 0 - ], angle = 0, winding = 0; - var sum = new (0, _d3Array.Adder)(); - if (sinPhi === 1) phi = (0, _mathJs.halfPi) + (0, _mathJs.epsilon); - else if (sinPhi === -1) phi = -(0, _mathJs.halfPi) - (0, _mathJs.epsilon); - for(var i = 0, n = polygon.length; i < n; ++i){ - if (!(m = (ring = polygon[i]).length)) continue; - var ring, m, point0 = ring[m - 1], lambda0 = longitude(point0), phi0 = point0[1] / 2 + (0, _mathJs.quarterPi), sinPhi0 = (0, _mathJs.sin)(phi0), cosPhi0 = (0, _mathJs.cos)(phi0); - for(var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1){ - var point1 = ring[j], lambda1 = longitude(point1), phi1 = point1[1] / 2 + (0, _mathJs.quarterPi), sinPhi1 = (0, _mathJs.sin)(phi1), cosPhi1 = (0, _mathJs.cos)(phi1), delta = lambda1 - lambda0, sign = delta >= 0 ? 1 : -1, absDelta = sign * delta, antimeridian = absDelta > (0, _mathJs.pi), k = sinPhi0 * sinPhi1; - sum.add((0, _mathJs.atan2)(k * sign * (0, _mathJs.sin)(absDelta), cosPhi0 * cosPhi1 + k * (0, _mathJs.cos)(absDelta))); - angle += antimeridian ? delta + sign * (0, _mathJs.tau) : delta; - // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = (0, _cartesianJs.cartesianCross)((0, _cartesianJs.cartesian)(point0), (0, _cartesianJs.cartesian)(point1)); - (0, _cartesianJs.cartesianNormalizeInPlace)(arc); - var intersection = (0, _cartesianJs.cartesianCross)(normal, arc); - (0, _cartesianJs.cartesianNormalizeInPlace)(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * (0, _mathJs.asin)(intersection[2]); - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) winding += antimeridian ^ delta >= 0 ? 1 : -1; - } - } - } - // First, determine whether the South pole is inside or outside: - // - // It is inside if: - // * the polygon winds around it in a clockwise direction. - // * the polygon does not (cumulatively) wind around it, but has a negative - // (counter-clockwise) area. - // - // Second, count the (signed) number of times a segment crosses a lambda - // from the point to the South pole. If it is zero, then the point is the - // same side as the South pole. - return (angle < -(0, _mathJs.epsilon) || angle < (0, _mathJs.epsilon) && sum < -(0, _mathJs.epsilon2)) ^ winding & 1; - }); -var _d3Array = require("d3-array"); -var _cartesianJs = require("./cartesian.js"); -var _mathJs = require("./math.js"); -function longitude(point) { - return (0, _mathJs.abs)(point[0]) <= (0, _mathJs.pi) ? point[0] : (0, _mathJs.sign)(point[0]) * (((0, _mathJs.abs)(point[0]) + (0, _mathJs.pi)) % (0, _mathJs.tau) - (0, _mathJs.pi)); -} - -},{"d3-array":"6IwJG","./cartesian.js":"i2DwM","./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2PJ3I":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var cr = (0, _mathJs.cos)(radius), delta = 2 * (0, _mathJs.radians), smallRadius = cr > 0, notHemisphere = (0, _mathJs.abs)(cr) > (0, _mathJs.epsilon); // TODO optimise for this common case - function interpolate(from, to, direction, stream) { - (0, _circleJs.circleStream)(stream, radius, delta, direction, from, to); - } - function visible(lambda, phi) { - return (0, _mathJs.cos)(lambda) * (0, _mathJs.cos)(phi) > cr; - } - // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // should be rejoined. - function clipLine(stream) { - var point0, c0, v0, v00, clean; // no intersections - return { - lineStart: function() { - v00 = v0 = false; - clean = 1; - }, - point: function(lambda, phi) { - var point1 = [ - lambda, - phi - ], point2, v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? (0, _mathJs.pi) : -(0, _mathJs.pi)), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || (0, _pointEqualJsDefault.default)(point0, point2) || (0, _pointEqualJsDefault.default)(point1, point2)) point1[2] = 1; - } - if (v !== v0) { - clean = 0; - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; - // If the codes for two points are different, or are both zero, - // and there this segment intersects with the small circle. - if (!(c & c0) && (t = intersect(point1, point0, true))) { - clean = 0; - if (smallRadius) { - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - } else { - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - stream.lineStart(); - stream.point(t[0][0], t[0][1], 3); - } - } - } - if (v && (!point0 || !(0, _pointEqualJsDefault.default)(point0, point1))) stream.point(point1[0], point1[1]); - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function() { - if (v0) stream.lineEnd(); - point0 = null; - }, - // Rejoin first and last segments if there were intersections and the first - // and last points were visible. - clean: function() { - return clean | (v00 && v0) << 1; - } - }; - } - // Intersects the great circle between a and b with the clip circle. - function intersect(a, b, two) { - var pa = (0, _cartesianJs.cartesian)(a), pb = (0, _cartesianJs.cartesian)(b); - // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - var n1 = [ - 1, - 0, - 0 - ], n2 = (0, _cartesianJs.cartesianCross)(pa, pb), n2n2 = (0, _cartesianJs.cartesianDot)(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; - // Two polar points. - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = (0, _cartesianJs.cartesianCross)(n1, n2), A = (0, _cartesianJs.cartesianScale)(n1, c1), B = (0, _cartesianJs.cartesianScale)(n2, c2); - (0, _cartesianJs.cartesianAddInPlace)(A, B); - // Solve |p(t)|^2 = 1. - var u = n1xn2, w = (0, _cartesianJs.cartesianDot)(A, u), uu = (0, _cartesianJs.cartesianDot)(u, u), t2 = w * w - uu * ((0, _cartesianJs.cartesianDot)(A, A) - 1); - if (t2 < 0) return; - var t = (0, _mathJs.sqrt)(t2), q = (0, _cartesianJs.cartesianScale)(u, (-w - t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q, A); - q = (0, _cartesianJs.spherical)(q); - if (!two) return q; - // Two intersection points. - var lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1], z; - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - var delta = lambda1 - lambda0, polar = (0, _mathJs.abs)(delta - (0, _mathJs.pi)) < (0, _mathJs.epsilon), meridian = polar || delta < (0, _mathJs.epsilon); - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; - // Check that the first point is between a and b. - if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < ((0, _mathJs.abs)(q[0] - lambda0) < (0, _mathJs.epsilon) ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > (0, _mathJs.pi) ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = (0, _cartesianJs.cartesianScale)(u, (-w + t) / uu); - (0, _cartesianJs.cartesianAddInPlace)(q1, A); - return [ - q, - (0, _cartesianJs.spherical)(q1) - ]; - } - } - // Generates a 4-bit vector representing the location of a point relative to - // the small circle's bounding box. - function code(lambda, phi) { - var r = smallRadius ? radius : (0, _mathJs.pi) - radius, code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - return code; - } - return (0, _indexJsDefault.default)(visible, clipLine, interpolate, smallRadius ? [ - 0, - -radius - ] : [ - -(0, _mathJs.pi), - radius - (0, _mathJs.pi) - ]); - }); -var _cartesianJs = require("../cartesian.js"); -var _circleJs = require("../circle.js"); -var _mathJs = require("../math.js"); -var _pointEqualJs = require("../pointEqual.js"); -var _pointEqualJsDefault = parcelHelpers.interopDefault(_pointEqualJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); - -},{"../cartesian.js":"i2DwM","../circle.js":"lPX3u","../math.js":"74X19","../pointEqual.js":"f0mBF","./index.js":"gHqWc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9kmAt":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>clipRectangle); -var _mathJs = require("../math.js"); -var _bufferJs = require("./buffer.js"); -var _bufferJsDefault = parcelHelpers.interopDefault(_bufferJs); -var _lineJs = require("./line.js"); -var _lineJsDefault = parcelHelpers.interopDefault(_lineJs); -var _rejoinJs = require("./rejoin.js"); -var _rejoinJsDefault = parcelHelpers.interopDefault(_rejoinJs); -var _d3Array = require("d3-array"); -var clipMax = 1e9, clipMin = -clipMax; -function clipRectangle(x0, y0, x1, y1) { - function visible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - function interpolate(from, to, direction, stream) { - var a = 0, a1 = 0; - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - while ((a = (a + direction + 4) % 4) !== a1); - else stream.point(to[0], to[1]); - } - function corner(p, direction) { - return (0, _mathJs.abs)(p[0] - x0) < (0, _mathJs.epsilon) ? direction > 0 ? 0 : 3 : (0, _mathJs.abs)(p[0] - x1) < (0, _mathJs.epsilon) ? direction > 0 ? 2 : 1 : (0, _mathJs.abs)(p[1] - y0) < (0, _mathJs.epsilon) ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon - } - function compareIntersection(a, b) { - return comparePoint(a.x, b.x); - } - function comparePoint(a, b) { - var ca = corner(a, 1), cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - return function(stream) { - var activeStream = stream, bufferStream = (0, _bufferJsDefault.default)(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; - var clipStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: polygonStart, - polygonEnd: polygonEnd - }; - function point(x, y) { - if (visible(x, y)) activeStream.point(x, y); - } - function polygonInside() { - var winding = 0; - for(var i = 0, n = polygon.length; i < n; ++i)for(var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j){ - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - if (a1 <= y1) { - if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; - } else if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; - } - return winding; - } - // Buffer geometry within a polygon and then clip it en masse. - function polygonStart() { - activeStream = bufferStream, segments = [], polygon = [], clean = true; - } - function polygonEnd() { - var startInside = polygonInside(), cleanInside = clean && startInside, visible = (segments = (0, _d3Array.merge)(segments)).length; - if (cleanInside || visible) { - stream.polygonStart(); - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - if (visible) (0, _rejoinJsDefault.default)(segments, compareIntersection, startInside, interpolate, stream); - stream.polygonEnd(); - } - activeStream = stream, segments = polygon = ring = null; - } - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } - // TODO rather than special-case polygons, simply handle them separately. - // Ideally, coincident intersection points should be jittered to avoid - // clipping issues. - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferStream.rejoin(); - segments.push(bufferStream.result()); - } - clipStream.point = point; - if (v_) activeStream.lineEnd(); - } - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([ - x, - y - ]); - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else if (v && v_) activeStream.point(x, y); - else { - var a = [ - x_ = Math.max(clipMin, Math.min(clipMax, x_)), - y_ = Math.max(clipMin, Math.min(clipMax, y_)) - ], b = [ - x = Math.max(clipMin, Math.min(clipMax, x)), - y = Math.max(clipMin, Math.min(clipMax, y)) - ]; - if ((0, _lineJsDefault.default)(a, b, x0, y0, x1, y1)) { - if (!v_) { - activeStream.lineStart(); - activeStream.point(a[0], a[1]); - } - activeStream.point(b[0], b[1]); - if (!v) activeStream.lineEnd(); - clean = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - x_ = x, y_ = y, v_ = v; - } - return clipStream; - }; -} - -},{"../math.js":"74X19","./buffer.js":"6d6VN","./line.js":"eNqzi","./rejoin.js":"6J55y","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eNqzi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(a, b, x0, y0, x1, y1) { - var ax = a[0], ay = a[1], bx = b[0], by = b[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"arQrO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>graticule); -parcelHelpers.export(exports, "graticule10", ()=>graticule10); -var _d3Array = require("d3-array"); -var _mathJs = require("./math.js"); -function graticuleX(y0, y1, dy) { - var y = (0, _d3Array.range)(y0, y1 - (0, _mathJs.epsilon), dy).concat(y1); - return function(x) { - return y.map(function(y) { - return [ - x, - y - ]; - }); - }; -} -function graticuleY(x0, x1, dx) { - var x = (0, _d3Array.range)(x0, x1 - (0, _mathJs.epsilon), dx).concat(x1); - return function(y) { - return x.map(function(x) { - return [ - x, - y - ]; - }); - }; -} -function graticule() { - var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; - } - function lines() { - return (0, _d3Array.range)((0, _mathJs.ceil)(X0 / DX) * DX, X1, DX).map(X).concat((0, _d3Array.range)((0, _mathJs.ceil)(Y0 / DY) * DY, Y1, DY).map(Y)).concat((0, _d3Array.range)((0, _mathJs.ceil)(x0 / dx) * dx, x1, dx).filter(function(x) { - return (0, _mathJs.abs)(x % DX) > (0, _mathJs.epsilon); - }).map(x)).concat((0, _d3Array.range)((0, _mathJs.ceil)(y0 / dy) * dy, y1, dy).filter(function(y) { - return (0, _mathJs.abs)(y % DY) > (0, _mathJs.epsilon); - }).map(y)); - } - graticule.lines = function() { - return lines().map(function(coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; - }); - }; - graticule.outline = function() { - return { - type: "Polygon", - coordinates: [ - X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) - ] - }; - }; - graticule.extent = function(_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - graticule.extentMajor = function(_) { - if (!arguments.length) return [ - [ - X0, - Y0 - ], - [ - X1, - Y1 - ] - ]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - graticule.extentMinor = function(_) { - if (!arguments.length) return [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - graticule.step = function(_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - graticule.stepMajor = function(_) { - if (!arguments.length) return [ - DX, - DY - ]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - graticule.stepMinor = function(_) { - if (!arguments.length) return [ - dx, - dy - ]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - graticule.precision = function(_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - return graticule.extentMajor([ - [ - -180, - -90 + (0, _mathJs.epsilon) - ], - [ - 180, - 90 - (0, _mathJs.epsilon) - ] - ]).extentMinor([ - [ - -180, - -80 - (0, _mathJs.epsilon) - ], - [ - 180, - 80 + (0, _mathJs.epsilon) - ] - ]); -} -function graticule10() { - return graticule()(); -} - -},{"d3-array":"6IwJG","./math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gBtNJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(projection, context) { - let digits = 3, pointRadius = 4.5, projectionStream, contextStream; - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - (0, _streamJsDefault.default)(object, projectionStream(contextStream)); - } - return contextStream.result(); - } - path.area = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _areaJsDefault.default))); - return (0, _areaJsDefault.default).result(); - }; - path.measure = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _measureJsDefault.default))); - return (0, _measureJsDefault.default).result(); - }; - path.bounds = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _boundsJsDefault.default))); - return (0, _boundsJsDefault.default).result(); - }; - path.centroid = function(object) { - (0, _streamJsDefault.default)(object, projectionStream((0, _centroidJsDefault.default))); - return (0, _centroidJsDefault.default).result(); - }; - path.projection = function(_) { - if (!arguments.length) return projection; - projectionStream = _ == null ? (projection = null, _identityJsDefault.default) : (projection = _).stream; - return path; - }; - path.context = function(_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new (0, _stringJsDefault.default)(digits)) : new (0, _contextJsDefault.default)(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - path.pointRadius = function(_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - path.digits = function(_) { - if (!arguments.length) return digits; - if (_ == null) digits = null; - else { - const d = Math.floor(_); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); - digits = d; - } - if (context === null) contextStream = new (0, _stringJsDefault.default)(digits); - return path; - }; - return path.projection(projection).digits(digits).context(context); - }); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _areaJs = require("./area.js"); -var _areaJsDefault = parcelHelpers.interopDefault(_areaJs); -var _boundsJs = require("./bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -var _centroidJs = require("./centroid.js"); -var _centroidJsDefault = parcelHelpers.interopDefault(_centroidJs); -var _contextJs = require("./context.js"); -var _contextJsDefault = parcelHelpers.interopDefault(_contextJs); -var _measureJs = require("./measure.js"); -var _measureJsDefault = parcelHelpers.interopDefault(_measureJs); -var _stringJs = require("./string.js"); -var _stringJsDefault = parcelHelpers.interopDefault(_stringJs); - -},{"../identity.js":"kub29","../stream.js":"9nFXd","./area.js":"5SF2U","./bounds.js":"bhNL9","./centroid.js":"lPOtc","./context.js":"fIlZ0","./measure.js":"iTRFv","./string.js":"gD9Wt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kub29":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -exports.default = (x)=>x; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5SF2U":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var areaSum = new (0, _d3Array.Adder)(), areaRingSum = new (0, _d3Array.Adder)(), x00, y00, x0, y0; -var areaStream = { - point: (0, _noopJsDefault.default), - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: function() { - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function() { - areaStream.lineStart = areaStream.lineEnd = areaStream.point = (0, _noopJsDefault.default); - areaSum.add((0, _mathJs.abs)(areaRingSum)); - areaRingSum = new (0, _d3Array.Adder)(); - }, - result: function() { - var area = areaSum / 2; - areaSum = new (0, _d3Array.Adder)(); - return area; - } -}; -function areaRingStart() { - areaStream.point = areaPointFirst; -} -function areaPointFirst(x, y) { - areaStream.point = areaPoint; - x00 = x0 = x, y00 = y0 = y; -} -function areaPoint(x, y) { - areaRingSum.add(y0 * x - x0 * y); - x0 = x, y0 = y; -} -function areaRingEnd() { - areaPoint(x00, y00); -} -exports.default = areaStream; - -},{"d3-array":"6IwJG","../math.js":"74X19","../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bhNL9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var x0 = Infinity, y0 = x0, x1 = -x0, y1 = x1; -var boundsStream = { - point: boundsPoint, - lineStart: (0, _noopJsDefault.default), - lineEnd: (0, _noopJsDefault.default), - polygonStart: (0, _noopJsDefault.default), - polygonEnd: (0, _noopJsDefault.default), - result: function() { - var bounds = [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - x1 = y1 = -(y0 = x0 = Infinity); - return bounds; - } -}; -function boundsPoint(x, y) { - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; -} -exports.default = boundsStream; - -},{"../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lPOtc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _mathJs = require("../math.js"); -// TODO Enforce positive area for exterior, negative area for interior? -var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00, y00, x0, y0; -var centroidStream = { - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function() { - centroidStream.point = centroidPoint; - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - }, - result: function() { - var centroid = Z2 ? [ - X2 / Z2, - Y2 / Z2 - ] : Z1 ? [ - X1 / Z1, - Y1 / Z1 - ] : Z0 ? [ - X0 / Z0, - Y0 / Z0 - ] : [ - NaN, - NaN - ]; - X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; - return centroid; - } -}; -function centroidPoint(x, y) { - X0 += x; - Y0 += y; - ++Z0; -} -function centroidLineStart() { - centroidStream.point = centroidPointFirstLine; -} -function centroidPointFirstLine(x, y) { - centroidStream.point = centroidPointLine; - centroidPoint(x0 = x, y0 = y); -} -function centroidPointLine(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - centroidPoint(x0 = x, y0 = y); -} -function centroidLineEnd() { - centroidStream.point = centroidPoint; -} -function centroidRingStart() { - centroidStream.point = centroidPointFirstRing; -} -function centroidRingEnd() { - centroidPointRing(x00, y00); -} -function centroidPointFirstRing(x, y) { - centroidStream.point = centroidPointRing; - centroidPoint(x00 = x0 = x, y00 = y0 = y); -} -function centroidPointRing(x, y) { - var dx = x - x0, dy = y - y0, z = (0, _mathJs.sqrt)(dx * dx + dy * dy); - X1 += z * (x0 + x) / 2; - Y1 += z * (y0 + y) / 2; - Z1 += z; - z = y0 * x - x0 * y; - X2 += z * (x0 + x); - Y2 += z * (y0 + y); - Z2 += z * 3; - centroidPoint(x0 = x, y0 = y); -} -exports.default = centroidStream; - -},{"../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fIlZ0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>PathContext); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -function PathContext(context) { - this._context = context; -} -PathContext.prototype = { - _radius: 4.5, - pointRadius: function(_) { - return this._radius = _, this; - }, - polygonStart: function() { - this._line = 0; + "diamond": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(-r, 0); + context2.lineTo(0, -r); + context2.lineTo(r, 0); + context2.lineTo(0, r); + context2.closePath(); + } }, - polygonEnd: function() { - this._line = NaN; + "square": { + draw: function(context2, size) { + var w2 = Math.sqrt(size), x2 = -w2 / 2; + context2.rect(x2, x2, w2, w2); + } }, - lineStart: function() { - this._point = 0; + "arrow": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, s = r / 7, t = r / 2.5, v = r / 8; + context2.moveTo(-s, r); + context2.lineTo(s, r); + context2.lineTo(s, -v); + context2.lineTo(t, -v); + context2.lineTo(0, -r); + context2.lineTo(-t, -v); + context2.lineTo(-s, -v); + context2.closePath(); + } }, - lineEnd: function() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; + "wedge": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30, b2 = r / 4; + context2.moveTo(0, -h2 - o); + context2.lineTo(-b2, h2 - o); + context2.lineTo(b2, h2 - o); + context2.closePath(); + } }, - point: function(x, y) { - switch(this._point){ - case 0: - this._context.moveTo(x, y); - this._point = 1; - break; - case 1: - this._context.lineTo(x, y); - break; - default: - this._context.moveTo(x + this._radius, y); - this._context.arc(x, y, this._radius, 0, (0, _mathJs.tau)); - break; - } + "triangle": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r, o = h2 - r * Tan30; + context2.moveTo(0, -h2 - o); + context2.lineTo(-r, h2 - o); + context2.lineTo(r, h2 - o); + context2.closePath(); + } }, - result: (0, _noopJsDefault.default) -}; - -},{"../math.js":"74X19","../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iTRFv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _d3Array = require("d3-array"); -var _mathJs = require("../math.js"); -var _noopJs = require("../noop.js"); -var _noopJsDefault = parcelHelpers.interopDefault(_noopJs); -var lengthSum = new (0, _d3Array.Adder)(), lengthRing, x00, y00, x0, y0; -var lengthStream = { - point: (0, _noopJsDefault.default), - lineStart: function() { - lengthStream.point = lengthPointFirst; + "triangle-up": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, -h2); + context2.lineTo(-r, h2); + context2.lineTo(r, h2); + context2.closePath(); + } }, - lineEnd: function() { - if (lengthRing) lengthPoint(x00, y00); - lengthStream.point = (0, _noopJsDefault.default); + "triangle-down": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(0, h2); + context2.lineTo(-r, -h2); + context2.lineTo(r, -h2); + context2.closePath(); + } }, - polygonStart: function() { - lengthRing = true; + "triangle-right": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(h2, 0); + context2.lineTo(-h2, -r); + context2.lineTo(-h2, r); + context2.closePath(); + } }, - polygonEnd: function() { - lengthRing = null; + "triangle-left": { + draw: function(context2, size) { + var r = Math.sqrt(size) / 2, h2 = HalfSqrt3 * r; + context2.moveTo(-h2, 0); + context2.lineTo(h2, -r); + context2.lineTo(h2, r); + context2.closePath(); + } }, - result: function() { - var length = +lengthSum; - lengthSum = new (0, _d3Array.Adder)(); - return length; - } -}; -function lengthPointFirst(x, y) { - lengthStream.point = lengthPoint; - x00 = x0 = x, y00 = y0 = y; -} -function lengthPoint(x, y) { - x0 -= x, y0 -= y; - lengthSum.add((0, _mathJs.sqrt)(x0 * x0 + y0 * y0)); - x0 = x, y0 = y; -} -exports.default = lengthStream; - -},{"d3-array":"6IwJG","../math.js":"74X19","../noop.js":"aXmaS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gD9Wt":[function(require,module,exports,__globalThis) { -// Simple caching for constant-radius points. -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -let cacheDigits, cacheAppend, cacheRadius, cacheCircle; -class PathString { - constructor(digits){ - this._append = digits == null ? append : appendRound(digits); - this._radius = 4.5; - this._ = ""; - } - pointRadius(_) { - this._radius = +_; - return this; - } - polygonStart() { - this._line = 0; - } - polygonEnd() { - this._line = NaN; - } - lineStart() { - this._point = 0; + "stroke": { + draw: function(context2, size) { + const r = Math.sqrt(size) / 2; + context2.moveTo(-r, 0); + context2.lineTo(r, 0); + } } - lineEnd() { - if (this._line === 0) this._ += "Z"; - this._point = NaN; - } - point(x, y) { - switch(this._point){ - case 0: - this._append`M${x},${y}`; - this._point = 1; - break; - case 1: - this._append`L${x},${y}`; - break; - default: - this._append`M${x},${y}`; - if (this._radius !== cacheRadius || this._append !== cacheAppend) { - const r = this._radius; - const s = this._; - this._ = ""; // stash the old string so we can cache the circle path fragment - this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; - cacheRadius = r; - cacheAppend = this._append; - cacheCircle = this._; - this._ = s; - } - this._ += cacheCircle; - break; + }; + function symbols(_) { + return has$1(builtins, _) ? builtins[_] : customSymbol(_); + } + var custom = {}; + function customSymbol(path2) { + if (!has$1(custom, path2)) { + const parsed = parse$3(path2); + custom[path2] = { + draw: function(context2, size) { + pathRender(context2, parsed, 0, 0, Math.sqrt(size) / 2); } + }; } - result() { - const result = this._; - this._ = ""; - return result.length ? result : null; - } -} -exports.default = PathString; -function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += arguments[i] + strings[i]; -} -function appendRound(digits) { - const d = Math.floor(digits); - if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`); - if (d > 15) return append; - if (d !== cacheDigits) { - const k = 10 ** d; - cacheDigits = d; - cacheAppend = function append(strings) { - let i = 1; - this._ += strings[0]; - for(const j = strings.length; i < j; ++i)this._ += Math.round(arguments[i] * k) / k + strings[i]; - }; + return custom[path2]; + } + const C = 0.448084975506; + function rectangleX(d) { + return d.x; + } + function rectangleY(d) { + return d.y; + } + function rectangleWidth(d) { + return d.width; + } + function rectangleHeight(d) { + return d.height; + } + function number$3(_) { + return typeof _ === "function" ? _ : () => +_; + } + function clamp(value2, min2, max2) { + return Math.max(min2, Math.min(value2, max2)); + } + function vg_rect() { + var x2 = rectangleX, y2 = rectangleY, width2 = rectangleWidth, height2 = rectangleHeight, crTL = number$3(0), crTR = crTL, crBL = crTL, crBR = crTL, context2 = null; + function rectangle2(_, x02, y02) { + var buffer, x12 = x02 != null ? x02 : +x2.call(this, _), y12 = y02 != null ? y02 : +y2.call(this, _), w2 = +width2.call(this, _), h2 = +height2.call(this, _), s = Math.min(w2, h2) / 2, tl2 = clamp(+crTL.call(this, _), 0, s), tr2 = clamp(+crTR.call(this, _), 0, s), bl2 = clamp(+crBL.call(this, _), 0, s), br2 = clamp(+crBR.call(this, _), 0, s); + if (!context2) context2 = buffer = path$3(); + if (tl2 <= 0 && tr2 <= 0 && bl2 <= 0 && br2 <= 0) { + context2.rect(x12, y12, w2, h2); + } else { + var x22 = x12 + w2, y22 = y12 + h2; + context2.moveTo(x12 + tl2, y12); + context2.lineTo(x22 - tr2, y12); + context2.bezierCurveTo(x22 - C * tr2, y12, x22, y12 + C * tr2, x22, y12 + tr2); + context2.lineTo(x22, y22 - br2); + context2.bezierCurveTo(x22, y22 - C * br2, x22 - C * br2, y22, x22 - br2, y22); + context2.lineTo(x12 + bl2, y22); + context2.bezierCurveTo(x12 + C * bl2, y22, x12, y22 - C * bl2, x12, y22 - bl2); + context2.lineTo(x12, y12 + tl2); + context2.bezierCurveTo(x12, y12 + C * tl2, x12 + C * tl2, y12, x12 + tl2, y12); + context2.closePath(); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } } - return cacheAppend; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dSks5":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicEqualAreaJsDefault.default)().parallels([ - 29.5, - 45.5 - ]).scale(1070).translate([ - 480, - 250 - ]).rotate([ - 96, - 0 - ]).center([ - -0.6, - 38.7 - ]); - }); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); - -},{"./conicEqualArea.js":"17j9x","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"17j9x":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEqualAreaRaw", ()=>conicEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEqualAreaRaw).scale(155.424).center([ - 0, - 33.6442 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -function conicEqualAreaRaw(y0, y1) { - var sy0 = (0, _mathJs.sin)(y0), n = (sy0 + (0, _mathJs.sin)(y1)) / 2; - // Are the parallels symmetrical around the Equator? - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return (0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)(y0); - var c = 1 + sy0 * (2 * n - sy0), r0 = (0, _mathJs.sqrt)(c) / n; - function project(x, y) { - var r = (0, _mathJs.sqrt)(c - 2 * n * (0, _mathJs.sin)(y)) / n; - return [ - r * (0, _mathJs.sin)(x *= n), - r0 - r * (0, _mathJs.cos)(x) - ]; - } - project.invert = function(x, y) { - var r0y = r0 - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(r0y)) * (0, _mathJs.sign)(r0y); - if (r0y * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(r0y); - return [ - l / n, - (0, _mathJs.asin)((c - (x * x + r0y * r0y) * n * n) / (2 * n)) - ]; - }; - return project; -} - -},{"../math.js":"74X19","./conic.js":"15g8N","./cylindricalEqualArea.js":"j13Gc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"15g8N":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicProjection", ()=>conicProjection); -var _mathJs = require("../math.js"); -var _indexJs = require("./index.js"); -function conicProjection(projectAt) { - var phi0 = 0, phi1 = (0, _mathJs.pi) / 3, m = (0, _indexJs.projectionMutator)(projectAt), p = m(phi0, phi1); - p.parallels = function(_) { - return arguments.length ? m(phi0 = _[0] * (0, _mathJs.radians), phi1 = _[1] * (0, _mathJs.radians)) : [ - phi0 * (0, _mathJs.degrees), - phi1 * (0, _mathJs.degrees) - ]; + rectangle2.x = function(_) { + if (arguments.length) { + x2 = number$3(_); + return rectangle2; + } else { + return x2; + } }; - return p; -} - -},{"../math.js":"74X19","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cd9OX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>projection); -parcelHelpers.export(exports, "projectionMutator", ()=>projectionMutator); -var _antimeridianJs = require("../clip/antimeridian.js"); -var _antimeridianJsDefault = parcelHelpers.interopDefault(_antimeridianJs); -var _circleJs = require("../clip/circle.js"); -var _circleJsDefault = parcelHelpers.interopDefault(_circleJs); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _composeJs = require("../compose.js"); -var _composeJsDefault = parcelHelpers.interopDefault(_composeJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _resampleJs = require("./resample.js"); -var _resampleJsDefault = parcelHelpers.interopDefault(_resampleJs); -var transformRadians = (0, _transformJs.transformer)({ - point: function(x, y) { - this.stream.point(x * (0, _mathJs.radians), y * (0, _mathJs.radians)); - } -}); -function transformRotate(rotate) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); - } - }); -} -function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; - y *= sy; - return [ - dx + k * x, - dy - k * y - ]; - } - transform.invert = function(x, y) { - return [ - (x - dx) / k * sx, - (dy - y) / k * sy - ]; - }; - return transform; -} -function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); - var cosAlpha = (0, _mathJs.cos)(alpha), sinAlpha = (0, _mathJs.sin)(alpha), a = cosAlpha * k, b = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; - function transform(x, y) { - x *= sx; - y *= sy; - return [ - a * x - b * y + dx, - dy - b * x - a * y - ]; - } - transform.invert = function(x, y) { - return [ - sx * (ai * x - bi * y + ci), - sy * (fi - bi * x - ai * y) - ]; - }; - return transform; -} -function projection(project) { - return projectionMutator(function() { - return project; - })(); -} -function projectionMutator(projectAt) { - var project, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = (0, _antimeridianJsDefault.default), x0 = null, y0, x1, y1, postclip = (0, _identityJsDefault.default), delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream; - function projection(point) { - return projectRotateTransform(point[0] * (0, _mathJs.radians), point[1] * (0, _mathJs.radians)); - } - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [ - point[0] * (0, _mathJs.degrees), - point[1] * (0, _mathJs.degrees) - ]; - } - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - projection.preclip = function(_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipAngle = function(_) { - return arguments.length ? (preclip = +_ ? (0, _circleJsDefault.default)(theta = _ * (0, _mathJs.radians)) : (theta = null, _antimeridianJsDefault.default), reset()) : theta * (0, _mathJs.degrees); - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [ - x, - y - ]; - }; - projection.center = function(_) { - return arguments.length ? (lambda = _[0] % 360 * (0, _mathJs.radians), phi = _[1] % 360 * (0, _mathJs.radians), recenter()) : [ - lambda * (0, _mathJs.degrees), - phi * (0, _mathJs.degrees) - ]; - }; - projection.rotate = function(_) { - return arguments.length ? (deltaLambda = _[0] % 360 * (0, _mathJs.radians), deltaPhi = _[1] % 360 * (0, _mathJs.radians), deltaGamma = _.length > 2 ? _[2] % 360 * (0, _mathJs.radians) : 0, recenter()) : [ - deltaLambda * (0, _mathJs.degrees), - deltaPhi * (0, _mathJs.degrees), - deltaGamma * (0, _mathJs.degrees) - ]; - }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), recenter()) : alpha * (0, _mathJs.degrees); - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; - }; - projection.precision = function(_) { - return arguments.length ? (projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2 = _ * _), reset()) : (0, _mathJs.sqrt)(delta2); - }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); + rectangle2.y = function(_) { + if (arguments.length) { + y2 = number$3(_); + return rectangle2; + } else { + return y2; + } }; - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform = scaleTranslateRotate(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = (0, _rotationJs.rotateRadians)(deltaLambda, deltaPhi, deltaGamma); - projectTransform = (0, _composeJsDefault.default)(project, transform); - projectRotateTransform = (0, _composeJsDefault.default)(rotate, projectTransform); - projectResample = (0, _resampleJsDefault.default)(projectTransform, delta2); - return reset(); - } - function reset() { - cache = cacheStream = null; - return projection; - } - return function() { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; -} - -},{"../clip/antimeridian.js":"kvVxQ","../clip/circle.js":"2PJ3I","../clip/rectangle.js":"9kmAt","../compose.js":"hmaf3","../identity.js":"kub29","../math.js":"74X19","../rotation.js":"8C7qH","../transform.js":"9MXXE","./fit.js":"49j0j","./resample.js":"gWNAn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9MXXE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(methods) { - return { - stream: transformer(methods) - }; - }); -parcelHelpers.export(exports, "transformer", ()=>transformer); -function transformer(methods) { - return function(stream) { - var s = new TransformStream; - for(var key in methods)s[key] = methods[key]; - s.stream = stream; - return s; + rectangle2.width = function(_) { + if (arguments.length) { + width2 = number$3(_); + return rectangle2; + } else { + return width2; + } }; -} -function TransformStream() {} -TransformStream.prototype = { - constructor: TransformStream, - point: function(x, y) { - this.stream.point(x, y); - }, - sphere: function() { - this.stream.sphere(); - }, - lineStart: function() { - this.stream.lineStart(); - }, - lineEnd: function() { - this.stream.lineEnd(); - }, - polygonStart: function() { - this.stream.polygonStart(); - }, - polygonEnd: function() { - this.stream.polygonEnd(); - } -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"49j0j":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "fitExtent", ()=>fitExtent); -parcelHelpers.export(exports, "fitSize", ()=>fitSize); -parcelHelpers.export(exports, "fitWidth", ()=>fitWidth); -parcelHelpers.export(exports, "fitHeight", ()=>fitHeight); -var _streamJs = require("../stream.js"); -var _streamJsDefault = parcelHelpers.interopDefault(_streamJs); -var _boundsJs = require("../path/bounds.js"); -var _boundsJsDefault = parcelHelpers.interopDefault(_boundsJs); -function fit(projection, fitBounds, object) { - var clip = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([ - 0, - 0 - ]); - if (clip != null) projection.clipExtent(null); - (0, _streamJsDefault.default)(object, projection.stream((0, _boundsJsDefault.default))); - fitBounds((0, _boundsJsDefault.default).result()); - if (clip != null) projection.clipExtent(clip); - return projection; -} -function fitExtent(projection, extent, object) { - return fit(projection, function(b) { - var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitSize(projection, size, object) { - return fitExtent(projection, [ - [ - 0, - 0 - ], - size - ], object); -} -function fitWidth(projection, width, object) { - return fit(projection, function(b) { - var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1]; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} -function fitHeight(projection, height, object) { - return fit(projection, function(b) { - var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([ - x, - y - ]); - }, object); -} - -},{"../stream.js":"9nFXd","../path/bounds.js":"bhNL9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gWNAn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(project, delta2) { - return +delta2 ? resample(project, delta2) : resampleNone(project); - }); -var _cartesianJs = require("../cartesian.js"); -var _mathJs = require("../math.js"); -var _transformJs = require("../transform.js"); -var maxDepth = 16, cosMinDistance = (0, _mathJs.cos)(30 * (0, _mathJs.radians)); // cos(minimum angular distance) -function resampleNone(project) { - return (0, _transformJs.transformer)({ - point: function(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); -} -function resample(project, delta2) { - function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy; - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = (0, _mathJs.sqrt)(a * a + b * b + c * c), phi2 = (0, _mathJs.asin)(c /= m), lambda2 = (0, _mathJs.abs)((0, _mathJs.abs)(c) - 1) < (0, _mathJs.epsilon) || (0, _mathJs.abs)(lambda0 - lambda1) < (0, _mathJs.epsilon) ? (lambda0 + lambda1) / 2 : (0, _mathJs.atan2)(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2; - if (dz * dz / d2 > delta2 // perpendicular projected distance - || (0, _mathJs.abs)((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } + rectangle2.height = function(_) { + if (arguments.length) { + height2 = number$3(_); + return rectangle2; + } else { + return height2; + } + }; + rectangle2.cornerRadius = function(tl2, tr2, br2, bl2) { + if (arguments.length) { + crTL = number$3(tl2); + crTR = tr2 != null ? number$3(tr2) : crTL; + crBR = br2 != null ? number$3(br2) : crTL; + crBL = bl2 != null ? number$3(bl2) : crTR; + return rectangle2; + } else { + return crTL; + } + }; + rectangle2.context = function(_) { + if (arguments.length) { + context2 = _ == null ? null : _; + return rectangle2; + } else { + return context2; + } + }; + return rectangle2; + } + function vg_trail() { + var x2, y2, size, defined, context2 = null, ready, x12, y12, r1; + function point2(x22, y22, w2) { + const r2 = w2 / 2; + if (ready) { + var ux = y12 - y22, uy = x22 - x12; + if (ux || uy) { + var ud = Math.hypot(ux, uy), rx = (ux /= ud) * r1, ry = (uy /= ud) * r1, t = Math.atan2(uy, ux); + context2.moveTo(x12 - rx, y12 - ry); + context2.lineTo(x22 - ux * r2, y22 - uy * r2); + context2.arc(x22, y22, r2, t - Math.PI, t); + context2.lineTo(x12 + rx, y12 + ry); + context2.arc(x12, y12, r1, t, t + Math.PI); + } else { + context2.arc(x22, y22, r2, 0, Tau); } + context2.closePath(); + } else { + ready = 1; + } + x12 = x22; + y12 = y22; + r1 = r2; + } + function trail2(data2) { + var i, n = data2.length, d, defined0 = false, buffer; + if (context2 == null) context2 = buffer = path$3(); + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data2[i], i, data2)) === defined0) { + if (defined0 = !defined0) ready = 0; + } + if (defined0) point2(+x2(d, i, data2), +y2(d, i, data2), +size(d, i, data2)); + } + if (buffer) { + context2 = null; + return buffer + "" || null; + } } - return function(stream) { - var lambda00, x00, y00, a00, b00, c00, lambda0, x0, y0, a0, b0, c0; // previous point - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function() { - stream.polygonStart(); - resampleStream.lineStart = ringStart; - }, - polygonEnd: function() { - stream.polygonEnd(); - resampleStream.lineStart = lineStart; - } - }; - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - function linePoint(lambda, phi) { - var c = (0, _cartesianJs.cartesian)([ - lambda, - phi - ]), p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - return resampleStream; - }; -} - -},{"../cartesian.js":"i2DwM","../math.js":"74X19","../transform.js":"9MXXE","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j13Gc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cylindricalEqualAreaRaw", ()=>cylindricalEqualAreaRaw); -var _mathJs = require("../math.js"); -function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = (0, _mathJs.cos)(phi0); - function forward(lambda, phi) { - return [ - lambda * cosPhi0, - (0, _mathJs.sin)(phi) / cosPhi0 - ]; - } - forward.invert = function(x, y) { - return [ - x / cosPhi0, - (0, _mathJs.asin)(y * cosPhi0) - ]; + trail2.x = function(_) { + if (arguments.length) { + x2 = _; + return trail2; + } else { + return x2; + } }; - return forward; -} - -},{"../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4lZJF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// A composite projection for the United States, configured by default for -// 960×500. The projection also works quite well at 960×600 if you change the -// scale to 1285 and adjust the translate accordingly. The set of standard -// parallels for each region comes from USGS, which is published here: -// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers -parcelHelpers.export(exports, "default", ()=>function() { - var cache, cacheStream, lower48 = (0, _albersJsDefault.default)(), lower48Point, alaska = (0, _conicEqualAreaJsDefault.default)().rotate([ - 154, - 0 - ]).center([ - -2, - 58.5 - ]).parallels([ - 55, - 65 - ]), alaskaPoint, hawaii = (0, _conicEqualAreaJsDefault.default)().rotate([ - 157, - 0 - ]).center([ - -3, - 19.9 - ]).parallels([ - 8, - 18 - ]), hawaiiPoint, point, pointStream = { - point: function(x, y) { - point = [ - x, - y - ]; - } - }; - function albersUsa(coordinates) { - var x = coordinates[0], y = coordinates[1]; - return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point); - } - albersUsa.invert = function(coordinates) { - var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k; - return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates); - }; - albersUsa.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([ - lower48.stream(cacheStream = stream), - alaska.stream(stream), - hawaii.stream(stream) - ]); - }; - albersUsa.precision = function(_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - albersUsa.scale = function(_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); - return albersUsa.translate(lower48.translate()); - }; - albersUsa.translate = function(_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), x = +_[0], y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([ - [ - x - 0.455 * k, - y - 0.238 * k - ], - [ - x + 0.455 * k, - y + 0.238 * k - ] - ]).stream(pointStream); - alaskaPoint = alaska.translate([ - x - 0.307 * k, - y + 0.201 * k - ]).clipExtent([ - [ - x - 0.425 * k + (0, _mathJs.epsilon), - y + 0.120 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.214 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - hawaiiPoint = hawaii.translate([ - x - 0.205 * k, - y + 0.212 * k - ]).clipExtent([ - [ - x - 0.214 * k + (0, _mathJs.epsilon), - y + 0.166 * k + (0, _mathJs.epsilon) - ], - [ - x - 0.115 * k - (0, _mathJs.epsilon), - y + 0.234 * k - (0, _mathJs.epsilon) - ] - ]).stream(pointStream); - return reset(); - }; - albersUsa.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(albersUsa, extent, object); - }; - albersUsa.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(albersUsa, size, object); - }; - albersUsa.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(albersUsa, width, object); - }; - albersUsa.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(albersUsa, height, object); - }; - function reset() { - cache = cacheStream = null; - return albersUsa; + trail2.y = function(_) { + if (arguments.length) { + y2 = _; + return trail2; + } else { + return y2; + } + }; + trail2.size = function(_) { + if (arguments.length) { + size = _; + return trail2; + } else { + return size; + } + }; + trail2.defined = function(_) { + if (arguments.length) { + defined = _; + return trail2; + } else { + return defined; + } + }; + trail2.context = function(_) { + if (arguments.length) { + if (_ == null) { + context2 = null; + } else { + context2 = _; } - return albersUsa.scale(1070); - }); -var _mathJs = require("../math.js"); -var _albersJs = require("./albers.js"); -var _albersJsDefault = parcelHelpers.interopDefault(_albersJs); -var _conicEqualAreaJs = require("./conicEqualArea.js"); -var _conicEqualAreaJsDefault = parcelHelpers.interopDefault(_conicEqualAreaJs); -var _fitJs = require("./fit.js"); -// The projections must have mutually exclusive clip regions on the sphere, -// as this will avoid emitting interleaving lines and polygons. -function multiplex(streams) { - var n = streams.length; - return { - point: function(x, y) { - var i = -1; - while(++i < n)streams[i].point(x, y); - }, - sphere: function() { - var i = -1; - while(++i < n)streams[i].sphere(); - }, - lineStart: function() { - var i = -1; - while(++i < n)streams[i].lineStart(); - }, - lineEnd: function() { - var i = -1; - while(++i < n)streams[i].lineEnd(); - }, - polygonStart: function() { - var i = -1; - while(++i < n)streams[i].polygonStart(); - }, - polygonEnd: function() { - var i = -1; - while(++i < n)streams[i].polygonEnd(); - } - }; -} - -},{"../math.js":"74X19","./albers.js":"dSks5","./conicEqualArea.js":"17j9x","./fit.js":"49j0j","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jbLs0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEqualAreaRaw", ()=>azimuthalEqualAreaRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEqualAreaRaw).scale(124.75).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEqualAreaRaw = (0, _azimuthalJs.azimuthalRaw)(function(cxcy) { - return (0, _mathJs.sqrt)(2 / (1 + cxcy)); -}); -azimuthalEqualAreaRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.asin)(z / 2); -}); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"boRUu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalRaw", ()=>azimuthalRaw); -parcelHelpers.export(exports, "azimuthalInvert", ()=>azimuthalInvert); -var _mathJs = require("../math.js"); -function azimuthalRaw(scale) { - return function(x, y) { - var cx = (0, _mathJs.cos)(x), cy = (0, _mathJs.cos)(y), k = scale(cx * cy); - if (k === Infinity) return [ - 2, - 0 - ]; - return [ - k * cy * (0, _mathJs.sin)(x), - k * (0, _mathJs.sin)(y) - ]; - }; -} -function azimuthalInvert(angle) { - return function(x, y) { - var z = (0, _mathJs.sqrt)(x * x + y * y), c = angle(z), sc = (0, _mathJs.sin)(c), cc = (0, _mathJs.cos)(c); - return [ - (0, _mathJs.atan2)(x * sc, z * cc), - (0, _mathJs.asin)(z && y * sc / z) - ]; - }; -} - -},{"../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eAR2Q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "azimuthalEquidistantRaw", ()=>azimuthalEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(azimuthalEquidistantRaw).scale(79.4188).clipAngle(179.999); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var azimuthalEquidistantRaw = (0, _azimuthalJs.azimuthalRaw)(function(c) { - return (c = (0, _mathJs.acos)(c)) && c / (0, _mathJs.sin)(c); -}); -azimuthalEquidistantRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return z; -}); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dhBsj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicConformalRaw", ()=>conicConformalRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicConformalRaw).scale(109.5).parallels([ - 30, - 30 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _mercatorJs = require("./mercator.js"); -function tany(y) { - return (0, _mathJs.tan)(((0, _mathJs.halfPi) + y) / 2); -} -function conicConformalRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (0, _mathJs.log)(cy0 / (0, _mathJs.cos)(y1)) / (0, _mathJs.log)(tany(y1) / tany(y0)), f = cy0 * (0, _mathJs.pow)(tany(y0), n) / n; - if (!n) return 0, _mercatorJs.mercatorRaw; - function project(x, y) { - if (f > 0) { - if (y < -(0, _mathJs.halfPi) + (0, _mathJs.epsilon)) y = -(0, _mathJs.halfPi) + (0, _mathJs.epsilon); - } else if (y > (0, _mathJs.halfPi) - (0, _mathJs.epsilon)) y = (0, _mathJs.halfPi) - (0, _mathJs.epsilon); - var r = f / (0, _mathJs.pow)(tany(y), n); - return [ - r * (0, _mathJs.sin)(n * x), - f - r * (0, _mathJs.cos)(n * x) - ]; - } - project.invert = function(x, y) { - var fy = f - y, r = (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + fy * fy), l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(fy)) * (0, _mathJs.sign)(fy); - if (fy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(fy); - return [ - l / n, - 2 * (0, _mathJs.atan)((0, _mathJs.pow)(f / r, 1 / n)) - (0, _mathJs.halfPi) - ]; - }; - return project; -} - -},{"../math.js":"74X19","./conic.js":"15g8N","./mercator.js":"iIGjZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iIGjZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mercatorRaw", ()=>mercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return mercatorProjection(mercatorRaw).scale(961 / (0, _mathJs.tau)); - }); -parcelHelpers.export(exports, "mercatorProjection", ()=>mercatorProjection); -var _mathJs = require("../math.js"); -var _rotationJs = require("../rotation.js"); -var _rotationJsDefault = parcelHelpers.interopDefault(_rotationJs); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function mercatorRaw(lambda, phi) { - return [ - lambda, - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)) - ]; -} -mercatorRaw.invert = function(x, y) { - return [ - x, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(y)) - (0, _mathJs.halfPi) - ]; -}; -function mercatorProjection(project) { - var m = (0, _indexJsDefault.default)(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x0 = null, y0, x1, y1; // clip extent - m.scale = function(_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - m.translate = function(_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - m.center = function(_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - m.clipExtent = function(_) { - return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; + return trail2; + } else { + return context2; + } }; - function reclip() { - var k = (0, _mathJs.pi) * scale(), t = m((0, _rotationJsDefault.default)(m.rotate()).invert([ - 0, - 0 - ])); - return clipExtent(x0 == null ? [ - [ - t[0] - k, - t[1] - k - ], - [ - t[0] + k, - t[1] + k - ] - ] : project === mercatorRaw ? [ - [ - Math.max(t[0] - k, x0), - y0 - ], - [ - Math.min(t[0] + k, x1), - y1 - ] - ] : [ - [ - x0, - Math.max(t[1] - k, y0) - ], - [ - x1, - Math.min(t[1] + k, y1) - ] - ]); + return trail2; + } + function value$1(a2, b2) { + return a2 != null ? a2 : b2; + } + const x$2 = (item) => item.x || 0, y$2 = (item) => item.y || 0, w = (item) => item.width || 0, h = (item) => item.height || 0, xw = (item) => (item.x || 0) + (item.width || 0), yh = (item) => (item.y || 0) + (item.height || 0), sa = (item) => item.startAngle || 0, ea = (item) => item.endAngle || 0, pa = (item) => item.padAngle || 0, ir = (item) => item.innerRadius || 0, or = (item) => item.outerRadius || 0, cr = (item) => item.cornerRadius || 0, tl = (item) => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0, tr = (item) => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0, br = (item) => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0, bl = (item) => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0, sz = (item) => value$1(item.size, 64), ts = (item) => item.size || 1, def = (item) => !(item.defined === false), type = (item) => symbols(item.shape || "circle"); + const arcShape = arc$2$1().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr), areavShape = area$2$1().x(x$2).y1(y$2).y0(yh).defined(def), areahShape = area$2$1().y(y$2).x1(x$2).x0(xw).defined(def), lineShape = line$2$1().x(x$2).y(y$2).defined(def), rectShape = vg_rect().x(x$2).y(y$2).width(w).height(h).cornerRadius(tl, tr, br, bl), symbolShape = Symbol$1().type(type).size(sz), trailShape = vg_trail().x(x$2).y(y$2).defined(def).size(ts); + function hasCornerRadius(item) { + return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft; + } + function arc$1(context2, item) { + return arcShape.context(context2)(item); + } + function area$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return (item.orient === "horizontal" ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function line$1(context2, items) { + const item = items[0], interp = item.interpolate || "linear"; + return lineShape.curve(curves(interp, item.orient, item.tension)).context(context2)(items); + } + function rectangle(context2, item, x2, y2) { + return rectShape.context(context2)(item, x2, y2); + } + function shape$1(context2, item) { + return (item.mark.shape || item.shape).context(context2)(item); + } + function symbol$1(context2, item) { + return symbolShape.context(context2)(item); + } + function trail$1(context2, items) { + return trailShape.context(context2)(items); + } + var clip_id = 1; + function resetSVGClipId() { + clip_id = 1; + } + function clip$1$1(renderer, item, size) { + var clip2 = item.clip, defs = renderer._defs, id2 = item.clip_id || (item.clip_id = "clip" + clip_id++), c2 = defs.clipping[id2] || (defs.clipping[id2] = { + id: id2 + }); + if (isFunction(clip2)) { + c2.path = clip2(null); + } else if (hasCornerRadius(size)) { + c2.path = rectangle(null, size, 0, 0); + } else { + c2.width = size.width || 0; + c2.height = size.height || 0; } - return reclip(); -} - -},{"../math.js":"74X19","../rotation.js":"8C7qH","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6B358":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "conicEquidistantRaw", ()=>conicEquidistantRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _conicJs.conicProjection)(conicEquidistantRaw).scale(131.154).center([ - 0, - 13.9389 - ]); - }); -var _mathJs = require("../math.js"); -var _conicJs = require("./conic.js"); -var _equirectangularJs = require("./equirectangular.js"); -function conicEquidistantRaw(y0, y1) { - var cy0 = (0, _mathJs.cos)(y0), n = y0 === y1 ? (0, _mathJs.sin)(y0) : (cy0 - (0, _mathJs.cos)(y1)) / (y1 - y0), g = cy0 / n + y0; - if ((0, _mathJs.abs)(n) < (0, _mathJs.epsilon)) return 0, _equirectangularJs.equirectangularRaw; - function project(x, y) { - var gy = g - y, nx = n * x; - return [ - gy * (0, _mathJs.sin)(nx), - g - gy * (0, _mathJs.cos)(nx) - ]; - } - project.invert = function(x, y) { - var gy = g - y, l = (0, _mathJs.atan2)(x, (0, _mathJs.abs)(gy)) * (0, _mathJs.sign)(gy); - if (gy * n < 0) l -= (0, _mathJs.pi) * (0, _mathJs.sign)(x) * (0, _mathJs.sign)(gy); - return [ - l / n, - g - (0, _mathJs.sign)(n) * (0, _mathJs.sqrt)(x * x + gy * gy) - ]; - }; - return project; -} - -},{"../math.js":"74X19","./conic.js":"15g8N","./equirectangular.js":"4kEjS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4kEjS":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equirectangularRaw", ()=>equirectangularRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equirectangularRaw).scale(152.63); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function equirectangularRaw(lambda, phi) { - return [ - lambda, - phi - ]; -} -equirectangularRaw.invert = equirectangularRaw; - -},{"./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bMVhy":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "equalEarthRaw", ()=>equalEarthRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(equalEarthRaw).scale(177.158); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -var A1 = 1.340264, A2 = -0.081106, A3 = 0.000893, A4 = 0.003796, M = (0, _mathJs.sqrt)(3) / 2, iterations = 12; -function equalEarthRaw(lambda, phi) { - var l = (0, _mathJs.asin)(M * (0, _mathJs.sin)(phi)), l2 = l * l, l6 = l2 * l2 * l2; - return [ - lambda * (0, _mathJs.cos)(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), - l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - ]; -} -equalEarthRaw.invert = function(x, y) { - var l = y, l2 = l * l, l6 = l2 * l2 * l2; - for(var i = 0, delta, fy, fpy; i < iterations; ++i){ - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if ((0, _mathJs.abs)(delta) < (0, _mathJs.epsilon2)) break; + return "url(#" + id2 + ")"; + } + function Bounds(b2) { + this.clear(); + if (b2) this.union(b2); + } + Bounds.prototype = { + clone() { + return new Bounds(this); + }, + clear() { + this.x1 = +Number.MAX_VALUE; + this.y1 = +Number.MAX_VALUE; + this.x2 = -Number.MAX_VALUE; + this.y2 = -Number.MAX_VALUE; + return this; + }, + empty() { + return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE; + }, + equals(b2) { + return this.x1 === b2.x1 && this.y1 === b2.y1 && this.x2 === b2.x2 && this.y2 === b2.y2; + }, + set(x12, y12, x2, y2) { + if (x2 < x12) { + this.x2 = x12; + this.x1 = x2; + } else { + this.x1 = x12; + this.x2 = x2; + } + if (y2 < y12) { + this.y2 = y12; + this.y1 = y2; + } else { + this.y1 = y12; + this.y2 = y2; + } + return this; + }, + add(x2, y2) { + if (x2 < this.x1) this.x1 = x2; + if (y2 < this.y1) this.y1 = y2; + if (x2 > this.x2) this.x2 = x2; + if (y2 > this.y2) this.y2 = y2; + return this; + }, + expand(d) { + this.x1 -= d; + this.y1 -= d; + this.x2 += d; + this.y2 += d; + return this; + }, + round() { + this.x1 = Math.floor(this.x1); + this.y1 = Math.floor(this.y1); + this.x2 = Math.ceil(this.x2); + this.y2 = Math.ceil(this.y2); + return this; + }, + scale(s) { + this.x1 *= s; + this.y1 *= s; + this.x2 *= s; + this.y2 *= s; + return this; + }, + translate(dx, dy) { + this.x1 += dx; + this.x2 += dx; + this.y1 += dy; + this.y2 += dy; + return this; + }, + rotate(angle2, x2, y2) { + const p = this.rotatedPoints(angle2, x2, y2); + return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]); + }, + rotatedPoints(angle2, x2, y2) { + var { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = this, cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), cx = x2 - x2 * cos2 + y2 * sin2, cy = y2 - x2 * sin2 - y2 * cos2; + return [cos2 * x12 - sin2 * y12 + cx, sin2 * x12 + cos2 * y12 + cy, cos2 * x12 - sin2 * y22 + cx, sin2 * x12 + cos2 * y22 + cy, cos2 * x22 - sin2 * y12 + cx, sin2 * x22 + cos2 * y12 + cy, cos2 * x22 - sin2 * y22 + cx, sin2 * x22 + cos2 * y22 + cy]; + }, + union(b2) { + if (b2.x1 < this.x1) this.x1 = b2.x1; + if (b2.y1 < this.y1) this.y1 = b2.y1; + if (b2.x2 > this.x2) this.x2 = b2.x2; + if (b2.y2 > this.y2) this.y2 = b2.y2; + return this; + }, + intersect(b2) { + if (b2.x1 > this.x1) this.x1 = b2.x1; + if (b2.y1 > this.y1) this.y1 = b2.y1; + if (b2.x2 < this.x2) this.x2 = b2.x2; + if (b2.y2 < this.y2) this.y2 = b2.y2; + return this; + }, + encloses(b2) { + return b2 && this.x1 <= b2.x1 && this.x2 >= b2.x2 && this.y1 <= b2.y1 && this.y2 >= b2.y2; + }, + alignsWith(b2) { + return b2 && (this.x1 == b2.x1 || this.x2 == b2.x2 || this.y1 == b2.y1 || this.y2 == b2.y2); + }, + intersects(b2) { + return b2 && !(this.x2 < b2.x1 || this.x1 > b2.x2 || this.y2 < b2.y1 || this.y1 > b2.y2); + }, + contains(x2, y2) { + return !(x2 < this.x1 || x2 > this.x2 || y2 < this.y1 || y2 > this.y2); + }, + width() { + return this.x2 - this.x1; + }, + height() { + return this.y2 - this.y1; } - return [ - M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / (0, _mathJs.cos)(l), - (0, _mathJs.asin)((0, _mathJs.sin)(l) / M) - ]; -}; - -},{"./index.js":"cd9OX","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6bdgO":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "gnomonicRaw", ()=>gnomonicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(gnomonicRaw).scale(144.049).clipAngle(60); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function gnomonicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -gnomonicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.atan)); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"huYSV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x0 = null, y0, x1, y1, kx = 1, ky = 1, transform = (0, _transformJs.transformer)({ - point: function(x, y) { - var p = projection([ - x, - y - ]); - this.stream.point(p[0], p[1]); - } - }), postclip = (0, _identityJsDefault.default), cache, cacheStream; - function reset() { - kx = k * sx; - ky = k * sy; - cache = cacheStream = null; - return projection; - } - function projection(p) { - var x = p[0] * kx, y = p[1] * ky; - if (alpha) { - var t = y * ca - x * sa; - x = x * ca + y * sa; - y = t; - } - return [ - x + tx, - y + ty - ]; - } - projection.invert = function(p) { - var x = p[0] - tx, y = p[1] - ty; - if (alpha) { - var t = y * ca + x * sa; - x = x * ca - y * sa; - y = t; - } - return [ - x / kx, - y / ky - ]; - }; - projection.stream = function(stream) { - return cache && cacheStream === stream ? cache : cache = transform(postclip(cacheStream = stream)); - }; - projection.postclip = function(_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - projection.clipExtent = function(_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, _identityJsDefault.default) : (0, _rectangleJsDefault.default)(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [ - [ - x0, - y0 - ], - [ - x1, - y1 - ] - ]; - }; - projection.scale = function(_) { - return arguments.length ? (k = +_, reset()) : k; - }; - projection.translate = function(_) { - return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [ - tx, - ty - ]; - }; - projection.angle = function(_) { - return arguments.length ? (alpha = _ % 360 * (0, _mathJs.radians), sa = (0, _mathJs.sin)(alpha), ca = (0, _mathJs.cos)(alpha), reset()) : alpha * (0, _mathJs.degrees); - }; - projection.reflectX = function(_) { - return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0; - }; - projection.reflectY = function(_) { - return arguments.length ? (sy = _ ? -1 : 1, reset()) : sy < 0; - }; - projection.fitExtent = function(extent, object) { - return (0, _fitJs.fitExtent)(projection, extent, object); - }; - projection.fitSize = function(size, object) { - return (0, _fitJs.fitSize)(projection, size, object); - }; - projection.fitWidth = function(width, object) { - return (0, _fitJs.fitWidth)(projection, width, object); - }; - projection.fitHeight = function(height, object) { - return (0, _fitJs.fitHeight)(projection, height, object); - }; - return projection; - }); -var _rectangleJs = require("../clip/rectangle.js"); -var _rectangleJsDefault = parcelHelpers.interopDefault(_rectangleJs); -var _identityJs = require("../identity.js"); -var _identityJsDefault = parcelHelpers.interopDefault(_identityJs); -var _transformJs = require("../transform.js"); -var _fitJs = require("./fit.js"); -var _mathJs = require("../math.js"); - -},{"../clip/rectangle.js":"9kmAt","../identity.js":"kub29","../transform.js":"9MXXE","./fit.js":"49j0j","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4AzsZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "naturalEarth1Raw", ()=>naturalEarth1Raw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(naturalEarth1Raw).scale(175.295); - }); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _mathJs = require("../math.js"); -function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, phi4 = phi2 * phi2; - return [ - lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), - phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - ]; -} -naturalEarth1Raw.invert = function(x, y) { - var phi = y, i = 25, delta; - do { - var phi2 = phi * phi, phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.045255 + phi4 * (-0.311325 + 0.259866 * phi2 - 0.005916 * 11 * phi4))); - }while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return [ - x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), - phi - ]; -}; - -},{"./index.js":"cd9OX","../math.js":"74X19","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kjinQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orthographicRaw", ()=>orthographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(orthographicRaw).scale(249.5).clipAngle(90 + (0, _mathJs.epsilon)); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function orthographicRaw(x, y) { - return [ - (0, _mathJs.cos)(y) * (0, _mathJs.sin)(x), - (0, _mathJs.sin)(y) - ]; -} -orthographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)((0, _mathJs.asin)); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6ko7r":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "stereographicRaw", ()=>stereographicRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _indexJsDefault.default)(stereographicRaw).scale(250).clipAngle(142); - }); -var _mathJs = require("../math.js"); -var _azimuthalJs = require("./azimuthal.js"); -var _indexJs = require("./index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -function stereographicRaw(x, y) { - var cy = (0, _mathJs.cos)(y), k = 1 + (0, _mathJs.cos)(x) * cy; - return [ - cy * (0, _mathJs.sin)(x) / k, - (0, _mathJs.sin)(y) / k - ]; -} -stereographicRaw.invert = (0, _azimuthalJs.azimuthalInvert)(function(z) { - return 2 * (0, _mathJs.atan)(z); -}); - -},{"../math.js":"74X19","./azimuthal.js":"boRUu","./index.js":"cd9OX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i6NVd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "transverseMercatorRaw", ()=>transverseMercatorRaw); -parcelHelpers.export(exports, "default", ()=>function() { - var m = (0, _mercatorJs.mercatorProjection)(transverseMercatorRaw), center = m.center, rotate = m.rotate; - m.center = function(_) { - return arguments.length ? center([ - -_[1], - _[0] - ]) : (_ = center(), [ - _[1], - -_[0] - ]); - }; - m.rotate = function(_) { - return arguments.length ? rotate([ - _[0], - _[1], - _.length > 2 ? _[2] + 90 : 90 - ]) : (_ = rotate(), [ - _[0], - _[1], - _[2] - 90 - ]); + }; + function Item(mark) { + this.mark = mark; + this.bounds = this.bounds || new Bounds(); + } + function GroupItem(mark) { + Item.call(this, mark); + this.items = this.items || []; + } + inherits(GroupItem, Item); + class ResourceLoader { + constructor(customLoader) { + this._pending = 0; + this._loader = customLoader || loader(); + } + pending() { + return this._pending; + } + sanitizeURL(uri) { + const loader2 = this; + increment$1(loader2); + return loader2._loader.sanitize(uri, { + context: "href" + }).then((opt) => { + decrement(loader2); + return opt; + }).catch(() => { + decrement(loader2); + return null; + }); + } + loadImage(uri) { + const loader2 = this, Image2 = domImage(); + increment$1(loader2); + return loader2._loader.sanitize(uri, { + context: "image" + }).then((opt) => { + const url = opt.href; + if (!url || !Image2) throw { + url + }; + const img = new Image2(); + const cors = has$1(opt, "crossOrigin") ? opt.crossOrigin : "anonymous"; + if (cors != null) img.crossOrigin = cors; + img.onload = () => decrement(loader2); + img.onerror = () => decrement(loader2); + img.src = url; + return img; + }).catch((e) => { + decrement(loader2); + return { + complete: false, + width: 0, + height: 0, + src: e && e.url || "" }; - return rotate([ - 0, - 0, - 90 - ]).scale(159.155); - }); -var _mathJs = require("../math.js"); -var _mercatorJs = require("./mercator.js"); -function transverseMercatorRaw(lambda, phi) { - return [ - (0, _mathJs.log)((0, _mathJs.tan)(((0, _mathJs.halfPi) + phi) / 2)), - -lambda - ]; -} -transverseMercatorRaw.invert = function(x, y) { - return [ - -y, - 2 * (0, _mathJs.atan)((0, _mathJs.exp)(x)) - (0, _mathJs.halfPi) - ]; -}; - -},{"../math.js":"74X19","./mercator.js":"iIGjZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ixW8K":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "geoAiry", ()=>(0, _airyJsDefault.default)); -parcelHelpers.export(exports, "geoAiryRaw", ()=>(0, _airyJs.airyRaw)); -parcelHelpers.export(exports, "geoAitoff", ()=>(0, _aitoffJsDefault.default)); -parcelHelpers.export(exports, "geoAitoffRaw", ()=>(0, _aitoffJs.aitoffRaw)); -parcelHelpers.export(exports, "geoArmadillo", ()=>(0, _armadilloJsDefault.default)); -parcelHelpers.export(exports, "geoArmadilloRaw", ()=>(0, _armadilloJs.armadilloRaw)); -parcelHelpers.export(exports, "geoAugust", ()=>(0, _augustJsDefault.default)); -parcelHelpers.export(exports, "geoAugustRaw", ()=>(0, _augustJs.augustRaw)); -parcelHelpers.export(exports, "geoBaker", ()=>(0, _bakerJsDefault.default)); -parcelHelpers.export(exports, "geoBakerRaw", ()=>(0, _bakerJs.bakerRaw)); -parcelHelpers.export(exports, "geoBerghaus", ()=>(0, _berghausJsDefault.default)); -parcelHelpers.export(exports, "geoBerghausRaw", ()=>(0, _berghausJs.berghausRaw)); -parcelHelpers.export(exports, "geoBertin1953", ()=>(0, _bertinJsDefault.default)); -parcelHelpers.export(exports, "geoBertin1953Raw", ()=>(0, _bertinJs.bertin1953Raw)); -parcelHelpers.export(exports, "geoBoggs", ()=>(0, _boggsJsDefault.default)); -parcelHelpers.export(exports, "geoBoggsRaw", ()=>(0, _boggsJs.boggsRaw)); -parcelHelpers.export(exports, "geoBonne", ()=>(0, _bonneJsDefault.default)); -parcelHelpers.export(exports, "geoBonneRaw", ()=>(0, _bonneJs.bonneRaw)); -parcelHelpers.export(exports, "geoBottomley", ()=>(0, _bottomleyJsDefault.default)); -parcelHelpers.export(exports, "geoBottomleyRaw", ()=>(0, _bottomleyJs.bottomleyRaw)); -parcelHelpers.export(exports, "geoBromley", ()=>(0, _bromleyJsDefault.default)); -parcelHelpers.export(exports, "geoBromleyRaw", ()=>(0, _bromleyJs.bromleyRaw)); -parcelHelpers.export(exports, "geoChamberlin", ()=>(0, _chamberlinJsDefault.default)); -parcelHelpers.export(exports, "geoChamberlinRaw", ()=>(0, _chamberlinJs.chamberlinRaw)); -parcelHelpers.export(exports, "geoChamberlinAfrica", ()=>(0, _chamberlinJs.chamberlinAfrica)); -parcelHelpers.export(exports, "geoCollignon", ()=>(0, _collignonJsDefault.default)); -parcelHelpers.export(exports, "geoCollignonRaw", ()=>(0, _collignonJs.collignonRaw)); -parcelHelpers.export(exports, "geoCraig", ()=>(0, _craigJsDefault.default)); -parcelHelpers.export(exports, "geoCraigRaw", ()=>(0, _craigJs.craigRaw)); -parcelHelpers.export(exports, "geoCraster", ()=>(0, _crasterJsDefault.default)); -parcelHelpers.export(exports, "geoCrasterRaw", ()=>(0, _crasterJs.crasterRaw)); -parcelHelpers.export(exports, "geoCylindricalEqualArea", ()=>(0, _cylindricalEqualAreaJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalEqualAreaRaw", ()=>(0, _cylindricalEqualAreaJs.cylindricalEqualAreaRaw)); -parcelHelpers.export(exports, "geoCylindricalStereographic", ()=>(0, _cylindricalStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoCylindricalStereographicRaw", ()=>(0, _cylindricalStereographicJs.cylindricalStereographicRaw)); -parcelHelpers.export(exports, "geoEckert1", ()=>(0, _eckert1JsDefault.default)); -parcelHelpers.export(exports, "geoEckert1Raw", ()=>(0, _eckert1Js.eckert1Raw)); -parcelHelpers.export(exports, "geoEckert2", ()=>(0, _eckert2JsDefault.default)); -parcelHelpers.export(exports, "geoEckert2Raw", ()=>(0, _eckert2Js.eckert2Raw)); -parcelHelpers.export(exports, "geoEckert3", ()=>(0, _eckert3JsDefault.default)); -parcelHelpers.export(exports, "geoEckert3Raw", ()=>(0, _eckert3Js.eckert3Raw)); -parcelHelpers.export(exports, "geoEckert4", ()=>(0, _eckert4JsDefault.default)); -parcelHelpers.export(exports, "geoEckert4Raw", ()=>(0, _eckert4Js.eckert4Raw)); -parcelHelpers.export(exports, "geoEckert5", ()=>(0, _eckert5JsDefault.default)); -parcelHelpers.export(exports, "geoEckert5Raw", ()=>(0, _eckert5Js.eckert5Raw)); -parcelHelpers.export(exports, "geoEckert6", ()=>(0, _eckert6JsDefault.default)); -parcelHelpers.export(exports, "geoEckert6Raw", ()=>(0, _eckert6Js.eckert6Raw)); -parcelHelpers.export(exports, "geoEisenlohr", ()=>(0, _eisenlohrJsDefault.default)); -parcelHelpers.export(exports, "geoEisenlohrRaw", ()=>(0, _eisenlohrJs.eisenlohrRaw)); -parcelHelpers.export(exports, "geoFahey", ()=>(0, _faheyJsDefault.default)); -parcelHelpers.export(exports, "geoFaheyRaw", ()=>(0, _faheyJs.faheyRaw)); -parcelHelpers.export(exports, "geoFoucaut", ()=>(0, _foucautJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautRaw", ()=>(0, _foucautJs.foucautRaw)); -parcelHelpers.export(exports, "geoFoucautSinusoidal", ()=>(0, _foucautSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoFoucautSinusoidalRaw", ()=>(0, _foucautSinusoidalJs.foucautSinusoidalRaw)); -parcelHelpers.export(exports, "geoGilbert", ()=>(0, _gilbertJsDefault.default)); -parcelHelpers.export(exports, "geoGingery", ()=>(0, _gingeryJsDefault.default)); -parcelHelpers.export(exports, "geoGingeryRaw", ()=>(0, _gingeryJs.gingeryRaw)); -parcelHelpers.export(exports, "geoGinzburg4", ()=>(0, _ginzburg4JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg4Raw", ()=>(0, _ginzburg4Js.ginzburg4Raw)); -parcelHelpers.export(exports, "geoGinzburg5", ()=>(0, _ginzburg5JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg5Raw", ()=>(0, _ginzburg5Js.ginzburg5Raw)); -parcelHelpers.export(exports, "geoGinzburg6", ()=>(0, _ginzburg6JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg6Raw", ()=>(0, _ginzburg6Js.ginzburg6Raw)); -parcelHelpers.export(exports, "geoGinzburg8", ()=>(0, _ginzburg8JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg8Raw", ()=>(0, _ginzburg8Js.ginzburg8Raw)); -parcelHelpers.export(exports, "geoGinzburg9", ()=>(0, _ginzburg9JsDefault.default)); -parcelHelpers.export(exports, "geoGinzburg9Raw", ()=>(0, _ginzburg9Js.ginzburg9Raw)); -parcelHelpers.export(exports, "geoGringorten", ()=>(0, _gringortenJsDefault.default)); -parcelHelpers.export(exports, "geoGringortenRaw", ()=>(0, _gringortenJs.gringortenRaw)); -parcelHelpers.export(exports, "geoGuyou", ()=>(0, _guyouJsDefault.default)); -parcelHelpers.export(exports, "geoGuyouRaw", ()=>(0, _guyouJs.guyouRaw)); -parcelHelpers.export(exports, "geoHammer", ()=>(0, _hammerJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRaw", ()=>(0, _hammerJs.hammerRaw)); -parcelHelpers.export(exports, "geoHammerRetroazimuthal", ()=>(0, _hammerRetroazimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoHammerRetroazimuthalRaw", ()=>(0, _hammerRetroazimuthalJs.hammerRetroazimuthalRaw)); -parcelHelpers.export(exports, "geoHealpix", ()=>(0, _healpixJsDefault.default)); -parcelHelpers.export(exports, "geoHealpixRaw", ()=>(0, _healpixJs.healpixRaw)); -parcelHelpers.export(exports, "geoHill", ()=>(0, _hillJsDefault.default)); -parcelHelpers.export(exports, "geoHillRaw", ()=>(0, _hillJs.hillRaw)); -parcelHelpers.export(exports, "geoHomolosine", ()=>(0, _homolosineJsDefault.default)); -parcelHelpers.export(exports, "geoHomolosineRaw", ()=>(0, _homolosineJs.homolosineRaw)); -parcelHelpers.export(exports, "geoHufnagel", ()=>(0, _hufnagelJsDefault.default)); -parcelHelpers.export(exports, "geoHufnagelRaw", ()=>(0, _hufnagelJs.hufnagelRaw)); -parcelHelpers.export(exports, "geoHyperelliptical", ()=>(0, _hyperellipticalJsDefault.default)); -parcelHelpers.export(exports, "geoHyperellipticalRaw", ()=>(0, _hyperellipticalJs.hyperellipticalRaw)); -parcelHelpers.export(exports, "geoInterrupt", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedBoggs", ()=>(0, _boggsJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedHomolosine", ()=>(0, _homolosineJsDefault1.default)); -parcelHelpers.export(exports, "geoInterruptedMollweide", ()=>(0, _mollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedMollweideHemispheres", ()=>(0, _mollweideHemispheresJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinuMollweide", ()=>(0, _sinuMollweideJsDefault.default)); -parcelHelpers.export(exports, "geoInterruptedSinusoidal", ()=>(0, _sinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7", ()=>(0, _kavrayskiy7JsDefault.default)); -parcelHelpers.export(exports, "geoKavrayskiy7Raw", ()=>(0, _kavrayskiy7Js.kavrayskiy7Raw)); -parcelHelpers.export(exports, "geoLagrange", ()=>(0, _lagrangeJsDefault.default)); -parcelHelpers.export(exports, "geoLagrangeRaw", ()=>(0, _lagrangeJs.lagrangeRaw)); -parcelHelpers.export(exports, "geoLarrivee", ()=>(0, _larriveeJsDefault.default)); -parcelHelpers.export(exports, "geoLarriveeRaw", ()=>(0, _larriveeJs.larriveeRaw)); -parcelHelpers.export(exports, "geoLaskowski", ()=>(0, _laskowskiJsDefault.default)); -parcelHelpers.export(exports, "geoLaskowskiRaw", ()=>(0, _laskowskiJs.laskowskiRaw)); -parcelHelpers.export(exports, "geoLittrow", ()=>(0, _littrowJsDefault.default)); -parcelHelpers.export(exports, "geoLittrowRaw", ()=>(0, _littrowJs.littrowRaw)); -parcelHelpers.export(exports, "geoLoximuthal", ()=>(0, _loximuthalJsDefault.default)); -parcelHelpers.export(exports, "geoLoximuthalRaw", ()=>(0, _loximuthalJs.loximuthalRaw)); -parcelHelpers.export(exports, "geoMiller", ()=>(0, _millerJsDefault.default)); -parcelHelpers.export(exports, "geoMillerRaw", ()=>(0, _millerJs.millerRaw)); -parcelHelpers.export(exports, "geoModifiedStereographic", ()=>(0, _modifiedStereographicJsDefault.default)); -parcelHelpers.export(exports, "geoModifiedStereographicRaw", ()=>(0, _modifiedStereographicJs.modifiedStereographicRaw)); -parcelHelpers.export(exports, "geoModifiedStereographicAlaska", ()=>(0, _modifiedStereographicJs.modifiedStereographicAlaska)); -parcelHelpers.export(exports, "geoModifiedStereographicGs48", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs48)); -parcelHelpers.export(exports, "geoModifiedStereographicGs50", ()=>(0, _modifiedStereographicJs.modifiedStereographicGs50)); -parcelHelpers.export(exports, "geoModifiedStereographicMiller", ()=>(0, _modifiedStereographicJs.modifiedStereographicMiller)); -parcelHelpers.export(exports, "geoModifiedStereographicLee", ()=>(0, _modifiedStereographicJs.modifiedStereographicLee)); -parcelHelpers.export(exports, "geoMollweide", ()=>(0, _mollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoMollweideRaw", ()=>(0, _mollweideJs1.mollweideRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolic", ()=>(0, _mtFlatPolarParabolicJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarParabolicRaw", ()=>(0, _mtFlatPolarParabolicJs.mtFlatPolarParabolicRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarQuartic", ()=>(0, _mtFlatPolarQuarticJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarQuarticRaw", ()=>(0, _mtFlatPolarQuarticJs.mtFlatPolarQuarticRaw)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidal", ()=>(0, _mtFlatPolarSinusoidalJsDefault.default)); -parcelHelpers.export(exports, "geoMtFlatPolarSinusoidalRaw", ()=>(0, _mtFlatPolarSinusoidalJs.mtFlatPolarSinusoidalRaw)); -parcelHelpers.export(exports, "geoNaturalEarth2", ()=>(0, _naturalEarth2JsDefault.default)); -parcelHelpers.export(exports, "geoNaturalEarth2Raw", ()=>(0, _naturalEarth2Js.naturalEarth2Raw)); -parcelHelpers.export(exports, "geoNellHammer", ()=>(0, _nellHammerJsDefault.default)); -parcelHelpers.export(exports, "geoNellHammerRaw", ()=>(0, _nellHammerJs.nellHammerRaw)); -parcelHelpers.export(exports, "geoInterruptedQuarticAuthalic", ()=>(0, _quarticAuthalicJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosi", ()=>(0, _nicolosiJsDefault.default)); -parcelHelpers.export(exports, "geoNicolosiRaw", ()=>(0, _nicolosiJs.nicolosiRaw)); -parcelHelpers.export(exports, "geoPatterson", ()=>(0, _pattersonJsDefault.default)); -parcelHelpers.export(exports, "geoPattersonRaw", ()=>(0, _pattersonJs.pattersonRaw)); -parcelHelpers.export(exports, "geoPolyconic", ()=>(0, _polyconicJsDefault.default)); -parcelHelpers.export(exports, "geoPolyconicRaw", ()=>(0, _polyconicJs.polyconicRaw)); -parcelHelpers.export(exports, "geoPolyhedral", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralButterfly", ()=>(0, _butterflyJsDefault.default)); -parcelHelpers.export(exports, "geoPolyhedralCollignon", ()=>(0, _collignonJsDefault1.default)); -parcelHelpers.export(exports, "geoPolyhedralWaterman", ()=>(0, _watermanJsDefault.default)); -parcelHelpers.export(exports, "geoProject", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "geoGringortenQuincuncial", ()=>(0, _gringortenJsDefault1.default)); -parcelHelpers.export(exports, "geoPeirceQuincuncial", ()=>(0, _peirceJsDefault.default)); -parcelHelpers.export(exports, "geoQuantize", ()=>(0, _quantizeJsDefault.default)); -parcelHelpers.export(exports, "geoQuincuncial", ()=>(0, _indexJsDefault3.default)); -parcelHelpers.export(exports, "geoRectangularPolyconic", ()=>(0, _rectangularPolyconicJsDefault.default)); -parcelHelpers.export(exports, "geoRectangularPolyconicRaw", ()=>(0, _rectangularPolyconicJs.rectangularPolyconicRaw)); -parcelHelpers.export(exports, "geoRobinson", ()=>(0, _robinsonJsDefault.default)); -parcelHelpers.export(exports, "geoRobinsonRaw", ()=>(0, _robinsonJs.robinsonRaw)); -parcelHelpers.export(exports, "geoSatellite", ()=>(0, _satelliteJsDefault.default)); -parcelHelpers.export(exports, "geoSatelliteRaw", ()=>(0, _satelliteJs.satelliteRaw)); -parcelHelpers.export(exports, "geoSinuMollweide", ()=>(0, _sinuMollweideJsDefault1.default)); -parcelHelpers.export(exports, "geoSinuMollweideRaw", ()=>(0, _sinuMollweideJs1.sinuMollweideRaw)); -parcelHelpers.export(exports, "geoSinusoidal", ()=>(0, _sinusoidalJsDefault1.default)); -parcelHelpers.export(exports, "geoSinusoidalRaw", ()=>(0, _sinusoidalJs1.sinusoidalRaw)); -parcelHelpers.export(exports, "geoStitch", ()=>(0, _stitchJsDefault.default)); -parcelHelpers.export(exports, "geoTimes", ()=>(0, _timesJsDefault.default)); -parcelHelpers.export(exports, "geoTimesRaw", ()=>(0, _timesJs.timesRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthal", ()=>(0, _twoPointAzimuthalJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalRaw", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalRaw)); -parcelHelpers.export(exports, "geoTwoPointAzimuthalUsa", ()=>(0, _twoPointAzimuthalJs.twoPointAzimuthalUsa)); -parcelHelpers.export(exports, "geoTwoPointEquidistant", ()=>(0, _twoPointEquidistantJsDefault.default)); -parcelHelpers.export(exports, "geoTwoPointEquidistantRaw", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantRaw)); -parcelHelpers.export(exports, "geoTwoPointEquidistantUsa", ()=>(0, _twoPointEquidistantJs.twoPointEquidistantUsa)); -parcelHelpers.export(exports, "geoVanDerGrinten", ()=>(0, _vanDerGrintenJsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrintenRaw", ()=>(0, _vanDerGrintenJs.vanDerGrintenRaw)); -parcelHelpers.export(exports, "geoVanDerGrinten2", ()=>(0, _vanDerGrinten2JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten2Raw", ()=>(0, _vanDerGrinten2Js.vanDerGrinten2Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten3", ()=>(0, _vanDerGrinten3JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten3Raw", ()=>(0, _vanDerGrinten3Js.vanDerGrinten3Raw)); -parcelHelpers.export(exports, "geoVanDerGrinten4", ()=>(0, _vanDerGrinten4JsDefault.default)); -parcelHelpers.export(exports, "geoVanDerGrinten4Raw", ()=>(0, _vanDerGrinten4Js.vanDerGrinten4Raw)); -parcelHelpers.export(exports, "geoWagner", ()=>(0, _wagnerJsDefault.default)); -parcelHelpers.export(exports, "geoWagner7", ()=>(0, _wagnerJs.wagner7)); -parcelHelpers.export(exports, "geoWagnerRaw", ()=>(0, _wagnerJs.wagnerRaw)); -parcelHelpers.export(exports, "geoWagner4", ()=>(0, _wagner4JsDefault.default)); -parcelHelpers.export(exports, "geoWagner4Raw", ()=>(0, _wagner4Js.wagner4Raw)); -parcelHelpers.export(exports, "geoWagner6", ()=>(0, _wagner6JsDefault.default)); -parcelHelpers.export(exports, "geoWagner6Raw", ()=>(0, _wagner6Js.wagner6Raw)); -parcelHelpers.export(exports, "geoWiechel", ()=>(0, _wiechelJsDefault.default)); -parcelHelpers.export(exports, "geoWiechelRaw", ()=>(0, _wiechelJs.wiechelRaw)); -parcelHelpers.export(exports, "geoWinkel3", ()=>(0, _winkel3JsDefault.default)); -parcelHelpers.export(exports, "geoWinkel3Raw", ()=>(0, _winkel3Js.winkel3Raw)); -var _airyJs = require("./airy.js"); -var _airyJsDefault = parcelHelpers.interopDefault(_airyJs); -var _aitoffJs = require("./aitoff.js"); -var _aitoffJsDefault = parcelHelpers.interopDefault(_aitoffJs); -var _armadilloJs = require("./armadillo.js"); -var _armadilloJsDefault = parcelHelpers.interopDefault(_armadilloJs); -var _augustJs = require("./august.js"); -var _augustJsDefault = parcelHelpers.interopDefault(_augustJs); -var _bakerJs = require("./baker.js"); -var _bakerJsDefault = parcelHelpers.interopDefault(_bakerJs); -var _berghausJs = require("./berghaus.js"); -var _berghausJsDefault = parcelHelpers.interopDefault(_berghausJs); -var _bertinJs = require("./bertin.js"); -var _bertinJsDefault = parcelHelpers.interopDefault(_bertinJs); -var _boggsJs = require("./boggs.js"); -var _boggsJsDefault = parcelHelpers.interopDefault(_boggsJs); -var _bonneJs = require("./bonne.js"); -var _bonneJsDefault = parcelHelpers.interopDefault(_bonneJs); -var _bottomleyJs = require("./bottomley.js"); -var _bottomleyJsDefault = parcelHelpers.interopDefault(_bottomleyJs); -var _bromleyJs = require("./bromley.js"); -var _bromleyJsDefault = parcelHelpers.interopDefault(_bromleyJs); -var _chamberlinJs = require("./chamberlin.js"); -var _chamberlinJsDefault = parcelHelpers.interopDefault(_chamberlinJs); -var _collignonJs = require("./collignon.js"); -var _collignonJsDefault = parcelHelpers.interopDefault(_collignonJs); -var _craigJs = require("./craig.js"); -var _craigJsDefault = parcelHelpers.interopDefault(_craigJs); -var _crasterJs = require("./craster.js"); -var _crasterJsDefault = parcelHelpers.interopDefault(_crasterJs); -var _cylindricalEqualAreaJs = require("./cylindricalEqualArea.js"); -var _cylindricalEqualAreaJsDefault = parcelHelpers.interopDefault(_cylindricalEqualAreaJs); -var _cylindricalStereographicJs = require("./cylindricalStereographic.js"); -var _cylindricalStereographicJsDefault = parcelHelpers.interopDefault(_cylindricalStereographicJs); -var _eckert1Js = require("./eckert1.js"); -var _eckert1JsDefault = parcelHelpers.interopDefault(_eckert1Js); -var _eckert2Js = require("./eckert2.js"); -var _eckert2JsDefault = parcelHelpers.interopDefault(_eckert2Js); -var _eckert3Js = require("./eckert3.js"); -var _eckert3JsDefault = parcelHelpers.interopDefault(_eckert3Js); -var _eckert4Js = require("./eckert4.js"); -var _eckert4JsDefault = parcelHelpers.interopDefault(_eckert4Js); -var _eckert5Js = require("./eckert5.js"); -var _eckert5JsDefault = parcelHelpers.interopDefault(_eckert5Js); -var _eckert6Js = require("./eckert6.js"); -var _eckert6JsDefault = parcelHelpers.interopDefault(_eckert6Js); -var _eisenlohrJs = require("./eisenlohr.js"); -var _eisenlohrJsDefault = parcelHelpers.interopDefault(_eisenlohrJs); -var _faheyJs = require("./fahey.js"); -var _faheyJsDefault = parcelHelpers.interopDefault(_faheyJs); -var _foucautJs = require("./foucaut.js"); -var _foucautJsDefault = parcelHelpers.interopDefault(_foucautJs); -var _foucautSinusoidalJs = require("./foucautSinusoidal.js"); -var _foucautSinusoidalJsDefault = parcelHelpers.interopDefault(_foucautSinusoidalJs); -var _gilbertJs = require("./gilbert.js"); -var _gilbertJsDefault = parcelHelpers.interopDefault(_gilbertJs); -var _gingeryJs = require("./gingery.js"); -var _gingeryJsDefault = parcelHelpers.interopDefault(_gingeryJs); -var _ginzburg4Js = require("./ginzburg4.js"); -var _ginzburg4JsDefault = parcelHelpers.interopDefault(_ginzburg4Js); -var _ginzburg5Js = require("./ginzburg5.js"); -var _ginzburg5JsDefault = parcelHelpers.interopDefault(_ginzburg5Js); -var _ginzburg6Js = require("./ginzburg6.js"); -var _ginzburg6JsDefault = parcelHelpers.interopDefault(_ginzburg6Js); -var _ginzburg8Js = require("./ginzburg8.js"); -var _ginzburg8JsDefault = parcelHelpers.interopDefault(_ginzburg8Js); -var _ginzburg9Js = require("./ginzburg9.js"); -var _ginzburg9JsDefault = parcelHelpers.interopDefault(_ginzburg9Js); -var _gringortenJs = require("./gringorten.js"); -var _gringortenJsDefault = parcelHelpers.interopDefault(_gringortenJs); -var _guyouJs = require("./guyou.js"); -var _guyouJsDefault = parcelHelpers.interopDefault(_guyouJs); -var _hammerJs = require("./hammer.js"); -var _hammerJsDefault = parcelHelpers.interopDefault(_hammerJs); -var _hammerRetroazimuthalJs = require("./hammerRetroazimuthal.js"); -var _hammerRetroazimuthalJsDefault = parcelHelpers.interopDefault(_hammerRetroazimuthalJs); -var _healpixJs = require("./healpix.js"); -var _healpixJsDefault = parcelHelpers.interopDefault(_healpixJs); -var _hillJs = require("./hill.js"); -var _hillJsDefault = parcelHelpers.interopDefault(_hillJs); -var _homolosineJs = require("./homolosine.js"); -var _homolosineJsDefault = parcelHelpers.interopDefault(_homolosineJs); -var _hufnagelJs = require("./hufnagel.js"); -var _hufnagelJsDefault = parcelHelpers.interopDefault(_hufnagelJs); -var _hyperellipticalJs = require("./hyperelliptical.js"); -var _hyperellipticalJsDefault = parcelHelpers.interopDefault(_hyperellipticalJs); -var _indexJs = require("./interrupted/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _boggsJs1 = require("./interrupted/boggs.js"); -var _boggsJsDefault1 = parcelHelpers.interopDefault(_boggsJs1); -var _homolosineJs1 = require("./interrupted/homolosine.js"); -var _homolosineJsDefault1 = parcelHelpers.interopDefault(_homolosineJs1); -var _mollweideJs = require("./interrupted/mollweide.js"); -var _mollweideJsDefault = parcelHelpers.interopDefault(_mollweideJs); -var _mollweideHemispheresJs = require("./interrupted/mollweideHemispheres.js"); -var _mollweideHemispheresJsDefault = parcelHelpers.interopDefault(_mollweideHemispheresJs); -var _sinuMollweideJs = require("./interrupted/sinuMollweide.js"); -var _sinuMollweideJsDefault = parcelHelpers.interopDefault(_sinuMollweideJs); -var _sinusoidalJs = require("./interrupted/sinusoidal.js"); -var _sinusoidalJsDefault = parcelHelpers.interopDefault(_sinusoidalJs); -var _kavrayskiy7Js = require("./kavrayskiy7.js"); -var _kavrayskiy7JsDefault = parcelHelpers.interopDefault(_kavrayskiy7Js); -var _lagrangeJs = require("./lagrange.js"); -var _lagrangeJsDefault = parcelHelpers.interopDefault(_lagrangeJs); -var _larriveeJs = require("./larrivee.js"); -var _larriveeJsDefault = parcelHelpers.interopDefault(_larriveeJs); -var _laskowskiJs = require("./laskowski.js"); -var _laskowskiJsDefault = parcelHelpers.interopDefault(_laskowskiJs); -var _littrowJs = require("./littrow.js"); -var _littrowJsDefault = parcelHelpers.interopDefault(_littrowJs); -var _loximuthalJs = require("./loximuthal.js"); -var _loximuthalJsDefault = parcelHelpers.interopDefault(_loximuthalJs); -var _millerJs = require("./miller.js"); -var _millerJsDefault = parcelHelpers.interopDefault(_millerJs); -var _modifiedStereographicJs = require("./modifiedStereographic.js"); -var _modifiedStereographicJsDefault = parcelHelpers.interopDefault(_modifiedStereographicJs); -var _mollweideJs1 = require("./mollweide.js"); -var _mollweideJsDefault1 = parcelHelpers.interopDefault(_mollweideJs1); -var _mtFlatPolarParabolicJs = require("./mtFlatPolarParabolic.js"); -var _mtFlatPolarParabolicJsDefault = parcelHelpers.interopDefault(_mtFlatPolarParabolicJs); -var _mtFlatPolarQuarticJs = require("./mtFlatPolarQuartic.js"); -var _mtFlatPolarQuarticJsDefault = parcelHelpers.interopDefault(_mtFlatPolarQuarticJs); -var _mtFlatPolarSinusoidalJs = require("./mtFlatPolarSinusoidal.js"); -var _mtFlatPolarSinusoidalJsDefault = parcelHelpers.interopDefault(_mtFlatPolarSinusoidalJs); -var _naturalEarth2Js = require("./naturalEarth2.js"); -var _naturalEarth2JsDefault = parcelHelpers.interopDefault(_naturalEarth2Js); -var _nellHammerJs = require("./nellHammer.js"); -var _nellHammerJsDefault = parcelHelpers.interopDefault(_nellHammerJs); -var _quarticAuthalicJs = require("./interrupted/quarticAuthalic.js"); -var _quarticAuthalicJsDefault = parcelHelpers.interopDefault(_quarticAuthalicJs); -var _nicolosiJs = require("./nicolosi.js"); -var _nicolosiJsDefault = parcelHelpers.interopDefault(_nicolosiJs); -var _pattersonJs = require("./patterson.js"); -var _pattersonJsDefault = parcelHelpers.interopDefault(_pattersonJs); -var _polyconicJs = require("./polyconic.js"); -var _polyconicJsDefault = parcelHelpers.interopDefault(_polyconicJs); -var _indexJs1 = require("./polyhedral/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _butterflyJs = require("./polyhedral/butterfly.js"); -var _butterflyJsDefault = parcelHelpers.interopDefault(_butterflyJs); -var _collignonJs1 = require("./polyhedral/collignon.js"); -var _collignonJsDefault1 = parcelHelpers.interopDefault(_collignonJs1); -var _watermanJs = require("./polyhedral/waterman.js"); -var _watermanJsDefault = parcelHelpers.interopDefault(_watermanJs); -var _indexJs2 = require("./project/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _gringortenJs1 = require("./quincuncial/gringorten.js"); -var _gringortenJsDefault1 = parcelHelpers.interopDefault(_gringortenJs1); -var _peirceJs = require("./quincuncial/peirce.js"); -var _peirceJsDefault = parcelHelpers.interopDefault(_peirceJs); -var _quantizeJs = require("./quantize.js"); -var _quantizeJsDefault = parcelHelpers.interopDefault(_quantizeJs); -var _indexJs3 = require("./quincuncial/index.js"); -var _indexJsDefault3 = parcelHelpers.interopDefault(_indexJs3); -var _rectangularPolyconicJs = require("./rectangularPolyconic.js"); -var _rectangularPolyconicJsDefault = parcelHelpers.interopDefault(_rectangularPolyconicJs); -var _robinsonJs = require("./robinson.js"); -var _robinsonJsDefault = parcelHelpers.interopDefault(_robinsonJs); -var _satelliteJs = require("./satellite.js"); -var _satelliteJsDefault = parcelHelpers.interopDefault(_satelliteJs); -var _sinuMollweideJs1 = require("./sinuMollweide.js"); -var _sinuMollweideJsDefault1 = parcelHelpers.interopDefault(_sinuMollweideJs1); -var _sinusoidalJs1 = require("./sinusoidal.js"); -var _sinusoidalJsDefault1 = parcelHelpers.interopDefault(_sinusoidalJs1); -var _stitchJs = require("./stitch.js"); -var _stitchJsDefault = parcelHelpers.interopDefault(_stitchJs); -var _timesJs = require("./times.js"); -var _timesJsDefault = parcelHelpers.interopDefault(_timesJs); -var _twoPointAzimuthalJs = require("./twoPointAzimuthal.js"); -var _twoPointAzimuthalJsDefault = parcelHelpers.interopDefault(_twoPointAzimuthalJs); -var _twoPointEquidistantJs = require("./twoPointEquidistant.js"); -var _twoPointEquidistantJsDefault = parcelHelpers.interopDefault(_twoPointEquidistantJs); -var _vanDerGrintenJs = require("./vanDerGrinten.js"); -var _vanDerGrintenJsDefault = parcelHelpers.interopDefault(_vanDerGrintenJs); -var _vanDerGrinten2Js = require("./vanDerGrinten2.js"); -var _vanDerGrinten2JsDefault = parcelHelpers.interopDefault(_vanDerGrinten2Js); -var _vanDerGrinten3Js = require("./vanDerGrinten3.js"); -var _vanDerGrinten3JsDefault = parcelHelpers.interopDefault(_vanDerGrinten3Js); -var _vanDerGrinten4Js = require("./vanDerGrinten4.js"); -var _vanDerGrinten4JsDefault = parcelHelpers.interopDefault(_vanDerGrinten4Js); -var _wagnerJs = require("./wagner.js"); -var _wagnerJsDefault = parcelHelpers.interopDefault(_wagnerJs); -var _wagner4Js = require("./wagner4.js"); -var _wagner4JsDefault = parcelHelpers.interopDefault(_wagner4Js); -var _wagner6Js = require("./wagner6.js"); -var _wagner6JsDefault = parcelHelpers.interopDefault(_wagner6Js); -var _wiechelJs = require("./wiechel.js"); -var _wiechelJsDefault = parcelHelpers.interopDefault(_wiechelJs); -var _winkel3Js = require("./winkel3.js"); -var _winkel3JsDefault = parcelHelpers.interopDefault(_winkel3Js); - -},{"./airy.js":false,"./aitoff.js":false,"./armadillo.js":false,"./august.js":false,"./baker.js":false,"./berghaus.js":false,"./bertin.js":false,"./boggs.js":false,"./bonne.js":false,"./bottomley.js":false,"./bromley.js":false,"./chamberlin.js":false,"./collignon.js":false,"./craig.js":false,"./craster.js":false,"./cylindricalEqualArea.js":false,"./cylindricalStereographic.js":false,"./eckert1.js":false,"./eckert2.js":false,"./eckert3.js":false,"./eckert4.js":false,"./eckert5.js":false,"./eckert6.js":false,"./eisenlohr.js":false,"./fahey.js":false,"./foucaut.js":false,"./foucautSinusoidal.js":false,"./gilbert.js":false,"./gingery.js":false,"./ginzburg4.js":false,"./ginzburg5.js":false,"./ginzburg6.js":false,"./ginzburg8.js":false,"./ginzburg9.js":false,"./gringorten.js":false,"./guyou.js":false,"./hammer.js":false,"./hammerRetroazimuthal.js":false,"./healpix.js":false,"./hill.js":false,"./homolosine.js":false,"./hufnagel.js":false,"./hyperelliptical.js":false,"./interrupted/index.js":false,"./interrupted/boggs.js":false,"./interrupted/homolosine.js":false,"./interrupted/mollweide.js":false,"./interrupted/mollweideHemispheres.js":false,"./interrupted/sinuMollweide.js":false,"./interrupted/sinusoidal.js":false,"./kavrayskiy7.js":false,"./lagrange.js":false,"./larrivee.js":false,"./laskowski.js":false,"./littrow.js":false,"./loximuthal.js":false,"./miller.js":false,"./modifiedStereographic.js":false,"./mollweide.js":"dkpmT","./mtFlatPolarParabolic.js":false,"./mtFlatPolarQuartic.js":false,"./mtFlatPolarSinusoidal.js":false,"./naturalEarth2.js":false,"./nellHammer.js":false,"./interrupted/quarticAuthalic.js":false,"./nicolosi.js":false,"./patterson.js":false,"./polyconic.js":false,"./polyhedral/index.js":false,"./polyhedral/butterfly.js":false,"./polyhedral/collignon.js":false,"./polyhedral/waterman.js":false,"./project/index.js":false,"./quincuncial/gringorten.js":false,"./quincuncial/peirce.js":false,"./quantize.js":false,"./quincuncial/index.js":false,"./rectangularPolyconic.js":false,"./robinson.js":false,"./satellite.js":false,"./sinuMollweide.js":false,"./sinusoidal.js":false,"./stitch.js":false,"./times.js":false,"./twoPointAzimuthal.js":false,"./twoPointEquidistant.js":false,"./vanDerGrinten.js":false,"./vanDerGrinten2.js":false,"./vanDerGrinten3.js":false,"./vanDerGrinten4.js":false,"./wagner.js":false,"./wagner4.js":false,"./wagner6.js":false,"./wiechel.js":false,"./winkel3.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dkpmT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "mollweideBromleyTheta", ()=>mollweideBromleyTheta); -parcelHelpers.export(exports, "mollweideBromleyRaw", ()=>mollweideBromleyRaw); -parcelHelpers.export(exports, "mollweideRaw", ()=>mollweideRaw); -parcelHelpers.export(exports, "default", ()=>function() { - return (0, _d3Geo.geoProjection)(mollweideRaw).scale(169.529); - }); -var _d3Geo = require("d3-geo"); -var _mathJs = require("./math.js"); -function mollweideBromleyTheta(cp, phi) { - var cpsinPhi = cp * (0, _mathJs.sin)(phi), i = 30, delta; - do phi -= delta = (phi + (0, _mathJs.sin)(phi) - cpsinPhi) / (1 + (0, _mathJs.cos)(phi)); - while ((0, _mathJs.abs)(delta) > (0, _mathJs.epsilon) && --i > 0); - return phi / 2; -} -function mollweideBromleyRaw(cx, cy, cp) { - function forward(lambda, phi) { - return [ - cx * lambda * (0, _mathJs.cos)(phi = mollweideBromleyTheta(cp, phi)), - cy * (0, _mathJs.sin)(phi) - ]; - } - forward.invert = function(x, y) { - return y = (0, _mathJs.asin)(y / cy), [ - x / (cx * (0, _mathJs.cos)(y)), - (0, _mathJs.asin)((2 * y + (0, _mathJs.sin)(2 * y)) / cp) - ]; - }; - return forward; -} -var mollweideRaw = mollweideBromleyRaw((0, _mathJs.sqrt2) / (0, _mathJs.halfPi), (0, _mathJs.sqrt2), (0, _mathJs.pi)); - -},{"d3-geo":"lY61T","./math.js":"lq3g8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lq3g8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "abs", ()=>abs); -parcelHelpers.export(exports, "atan", ()=>atan); -parcelHelpers.export(exports, "atan2", ()=>atan2); -parcelHelpers.export(exports, "ceil", ()=>ceil); -parcelHelpers.export(exports, "cos", ()=>cos); -parcelHelpers.export(exports, "exp", ()=>exp); -parcelHelpers.export(exports, "floor", ()=>floor); -parcelHelpers.export(exports, "log", ()=>log); -parcelHelpers.export(exports, "max", ()=>max); -parcelHelpers.export(exports, "min", ()=>min); -parcelHelpers.export(exports, "pow", ()=>pow); -parcelHelpers.export(exports, "round", ()=>round); -parcelHelpers.export(exports, "sign", ()=>sign); -parcelHelpers.export(exports, "sin", ()=>sin); -parcelHelpers.export(exports, "tan", ()=>tan); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "epsilon2", ()=>epsilon2); -parcelHelpers.export(exports, "pi", ()=>pi); -parcelHelpers.export(exports, "halfPi", ()=>halfPi); -parcelHelpers.export(exports, "quarterPi", ()=>quarterPi); -parcelHelpers.export(exports, "sqrt1_2", ()=>sqrt1_2); -parcelHelpers.export(exports, "sqrt2", ()=>sqrt2); -parcelHelpers.export(exports, "sqrtPi", ()=>sqrtPi); -parcelHelpers.export(exports, "tau", ()=>tau); -parcelHelpers.export(exports, "degrees", ()=>degrees); -parcelHelpers.export(exports, "radians", ()=>radians); -parcelHelpers.export(exports, "sinci", ()=>sinci); -parcelHelpers.export(exports, "asin", ()=>asin); -parcelHelpers.export(exports, "acos", ()=>acos); -parcelHelpers.export(exports, "sqrt", ()=>sqrt); -parcelHelpers.export(exports, "tanh", ()=>tanh); -parcelHelpers.export(exports, "sinh", ()=>sinh); -parcelHelpers.export(exports, "cosh", ()=>cosh); -parcelHelpers.export(exports, "arsinh", ()=>arsinh); -parcelHelpers.export(exports, "arcosh", ()=>arcosh); -var abs = Math.abs; -var atan = Math.atan; -var atan2 = Math.atan2; -var ceil = Math.ceil; -var cos = Math.cos; -var exp = Math.exp; -var floor = Math.floor; -var log = Math.log; -var max = Math.max; -var min = Math.min; -var pow = Math.pow; -var round = Math.round; -var sign = Math.sign || function(x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; -}; -var sin = Math.sin; -var tan = Math.tan; -var epsilon = 1e-6; -var epsilon2 = 1e-12; -var pi = Math.PI; -var halfPi = pi / 2; -var quarterPi = pi / 4; -var sqrt1_2 = Math.SQRT1_2; -var sqrt2 = sqrt(2); -var sqrtPi = sqrt(pi); -var tau = pi * 2; -var degrees = 180 / pi; -var radians = pi / 180; -function sinci(x) { - return x ? x / Math.sin(x) : 1; -} -function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); -} -function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); -} -function sqrt(x) { - return x > 0 ? Math.sqrt(x) : 0; -} -function tanh(x) { - x = exp(2 * x); - return (x - 1) / (x + 1); -} -function sinh(x) { - return (exp(x) - exp(-x)) / 2; -} -function cosh(x) { - return (exp(x) + exp(-x)) / 2; -} -function arsinh(x) { - return log(x + sqrt(x * x + 1)); -} -function arcosh(x) { - return log(x + sqrt(x * x - 1)); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4JCry":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "force", ()=>Force); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Force = require("d3-force"); -const ForceMap = { - center: (0, _d3Force.forceCenter), - collide: (0, _d3Force.forceCollide), - nbody: (0, _d3Force.forceManyBody), - link: (0, _d3Force.forceLink), - x: (0, _d3Force.forceX), - y: (0, _d3Force.forceY) -}; -const Forces = 'forces', ForceParams = [ - 'alpha', - 'alphaMin', - 'alphaTarget', - 'velocityDecay', - 'forces' -], ForceConfig = [ - 'static', - 'iterations' -], ForceOutput = [ - 'x', - 'y', - 'vx', - 'vy' -]; -/** - * Force simulation layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<object>} params.forces - The forces to apply. - */ function Force(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Force.Definition = { - 'type': 'Force', - 'metadata': { - 'modifies': true + }); + } + ready() { + const loader2 = this; + return new Promise((accept) => { + function poll(value2) { + if (!loader2.pending()) accept(value2); + else setTimeout(() => { + poll(true); + }, 10); + } + poll(false); + }); + } + } + function increment$1(loader2) { + loader2._pending += 1; + } + function decrement(loader2) { + loader2._pending -= 1; + } + function boundStroke(bounds2, item, miter) { + if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) { + const sw = item.strokeWidth != null ? +item.strokeWidth : 1; + bounds2.expand(sw + (miter ? miterAdjustment(item, sw) : 0)); + } + return bounds2; + } + function miterAdjustment(item, strokeWidth) { + return item.strokeJoin && item.strokeJoin !== "miter" ? 0 : strokeWidth; + } + const circleThreshold = Tau - 1e-8; + let bounds, lx, ly, rot, ma, mb, mc, md; + const add$2 = (x2, y2) => bounds.add(x2, y2); + const addL = (x2, y2) => add$2(lx = x2, ly = y2); + const addX = (x2) => add$2(x2, bounds.y1); + const addY = (y2) => add$2(bounds.x1, y2); + const px = (x2, y2) => ma * x2 + mc * y2; + const py = (x2, y2) => mb * x2 + md * y2; + const addp = (x2, y2) => add$2(px(x2, y2), py(x2, y2)); + const addpL = (x2, y2) => addL(px(x2, y2), py(x2, y2)); + function boundContext(_, deg) { + bounds = _; + if (deg) { + rot = deg * DegToRad; + ma = md = Math.cos(rot); + mb = Math.sin(rot); + mc = -mb; + } else { + ma = md = 1; + rot = mb = mc = 0; + } + return context$1; + } + const context$1 = { + beginPath() { }, - 'params': [ - { - 'name': 'static', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'restart', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 300 - }, - { - 'name': 'alpha', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'alphaMin', - 'type': 'number', - 'default': 0.001 - }, - { - 'name': 'alphaTarget', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'velocityDecay', - 'type': 'number', - 'default': 0.4 - }, - { - 'name': 'forces', - 'type': 'param', - 'array': true, - 'params': [ - { - 'key': { - 'force': 'center' - }, - 'params': [ - { - 'name': 'x', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'y', - 'type': 'number', - 'default': 0 - } - ] - }, - { - 'key': { - 'force': 'collide' - }, - 'params': [ - { - 'name': 'radius', - 'type': 'number', - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'default': 0.7 - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'nbody' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': -30, - 'expr': true - }, - { - 'name': 'theta', - 'type': 'number', - 'default': 0.9 - }, - { - 'name': 'distanceMin', - 'type': 'number', - 'default': 1 - }, - { - 'name': 'distanceMax', - 'type': 'number' - } - ] - }, - { - 'key': { - 'force': 'link' - }, - 'params': [ - { - 'name': 'links', - 'type': 'data' - }, - { - 'name': 'id', - 'type': 'field' - }, - { - 'name': 'distance', - 'type': 'number', - 'default': 30, - 'expr': true - }, - { - 'name': 'strength', - 'type': 'number', - 'expr': true - }, - { - 'name': 'iterations', - 'type': 'number', - 'default': 1 - } - ] - }, - { - 'key': { - 'force': 'x' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'x', - 'type': 'field' - } - ] - }, - { - 'key': { - 'force': 'y' - }, - 'params': [ - { - 'name': 'strength', - 'type': 'number', - 'default': 0.1 - }, - { - 'name': 'y', - 'type': 'field' - } - ] - } - ] - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'modify': false, - 'default': ForceOutput - } - ] -}; -(0, _vegaUtil.inherits)(Force, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - var sim = this.value, change = pulse.changed(pulse.ADD_REM), params = _.modified(ForceParams), iters = _.iterations || 300; - // configure simulation - if (!sim) { - this.value = sim = simulation(pulse.source, _); - sim.on('tick', rerun(pulse.dataflow, this)); - if (!_.static) { - change = true; - sim.tick(); // ensure we run on init - } - pulse.modifies('index'); - } else { - if (change) { - pulse.modifies('index'); - sim.nodes(pulse.source); - } - if (params || pulse.changed(pulse.MOD)) setup(sim, _, 0, pulse); - } - // run simulation - if (params || change || _.modified(ForceConfig) || pulse.changed() && _.restart) { - sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); - if (_.static) for(sim.stop(); --iters >= 0;)sim.tick(); - else { - if (sim.stopped()) sim.restart(); - if (!change) return pulse.StopPropagation; // defer to sim ticks - } - } - return this.finish(_, pulse); + closePath() { }, - finish (_, pulse) { - const dataflow = pulse.dataflow; - // inspect dependencies, touch link source data - for(let args = this._argops, j = 0, m = args.length, arg; j < m; ++j){ - arg = args[j]; - if (arg.name !== Forces || arg.op._argval.force !== 'link') continue; - for(var ops = arg.op._argops, i = 0, n = ops.length, op; i < n; ++i)if (ops[i].name === 'links' && (op = ops[i].op.source)) { - dataflow.pulse(op, dataflow.changeset().reflow()); - break; - } + moveTo: addpL, + lineTo: addpL, + rect(x2, y2, w2, h2) { + if (rot) { + addp(x2 + w2, y2); + addp(x2 + w2, y2 + h2); + addp(x2, y2 + h2); + addpL(x2, y2); + } else { + add$2(x2 + w2, y2 + h2); + addL(x2, y2); + } + }, + quadraticCurveTo(x12, y12, x2, y2) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2); + quadExtrema(lx, px1, px2, addX); + quadExtrema(ly, py1, py2, addY); + addL(px2, py2); + }, + bezierCurveTo(x12, y12, x2, y2, x3, y3) { + const px1 = px(x12, y12), py1 = py(x12, y12), px2 = px(x2, y2), py2 = py(x2, y2), px3 = px(x3, y3), py3 = py(x3, y3); + cubicExtrema(lx, px1, px2, px3, addX); + cubicExtrema(ly, py1, py2, py3, addY); + addL(px3, py3); + }, + arc(cx, cy, r, sa2, ea2, ccw) { + sa2 += rot; + ea2 += rot; + lx = r * Math.cos(ea2) + cx; + ly = r * Math.sin(ea2) + cy; + if (Math.abs(ea2 - sa2) > circleThreshold) { + add$2(cx - r, cy - r); + add$2(cx + r, cy + r); + } else { + const update2 = (a2) => add$2(r * Math.cos(a2) + cx, r * Math.sin(a2) + cy); + let s, i; + update2(sa2); + update2(ea2); + if (ea2 !== sa2) { + sa2 = sa2 % Tau; + if (sa2 < 0) sa2 += Tau; + ea2 = ea2 % Tau; + if (ea2 < 0) ea2 += Tau; + if (ea2 < sa2) { + ccw = !ccw; + s = sa2; + sa2 = ea2; + ea2 = s; + } + if (ccw) { + ea2 -= Tau; + s = sa2 - sa2 % HalfPi; + for (i = 0; i < 4 && s > ea2; ++i, s -= HalfPi) update2(s); + } else { + s = sa2 - sa2 % HalfPi + HalfPi; + for (i = 0; i < 4 && s < ea2; ++i, s = s + HalfPi) update2(s); + } } - // reflow all nodes - return pulse.reflow(_.modified()).modifies(ForceOutput); + } } -}); -function rerun(df, op) { - return ()=>df.touch(op).run(); -} -function simulation(nodes, _) { - const sim = (0, _d3Force.forceSimulation)(nodes), stop = sim.stop, restart = sim.restart; - let stopped = false; - sim.stopped = ()=>stopped; - sim.restart = ()=>(stopped = false, restart()); - sim.stop = ()=>(stopped = true, stop()); - return setup(sim, _, true).on('end', ()=>stopped = true); -} -function setup(sim, _, init, pulse) { - var f = (0, _vegaUtil.array)(_.forces), i, n, p, name; - for(i = 0, n = ForceParams.length; i < n; ++i){ - p = ForceParams[i]; - if (p !== Forces && _.modified(p)) sim[p](_[p]); - } - for(i = 0, n = f.length; i < n; ++i){ - name = Forces + i; - p = init || _.modified(Forces, i) ? getForce(f[i]) : pulse && modified(f[i], pulse) ? sim.force(name) : null; - if (p) sim.force(name, p); - } - for(n = sim.numForces || 0; i < n; ++i)sim.force(Forces + i, null); // remove - sim.numForces = f.length; - return sim; -} -function modified(f, pulse) { - var k, v; - for(k in f){ - if ((0, _vegaUtil.isFunction)(v = f[k]) && pulse.modified((0, _vegaUtil.accessorFields)(v))) return 1; + }; + function quadExtrema(x02, x12, x2, cb) { + const t = (x02 - x12) / (x02 + x2 - 2 * x12); + if (0 < t && t < 1) cb(x02 + (x12 - x02) * t); + } + function cubicExtrema(x02, x12, x2, x3, cb) { + const a2 = x3 - x02 + 3 * x12 - 3 * x2, b2 = x02 + x2 - 2 * x12, c2 = x02 - x12; + let t02 = 0, t12 = 0, r; + if (Math.abs(a2) > Epsilon) { + r = b2 * b2 + c2 * a2; + if (r >= 0) { + r = Math.sqrt(r); + t02 = (-b2 + r) / a2; + t12 = (-b2 - r) / a2; + } + } else { + t02 = 0.5 * c2 / b2; } - return 0; -} -function getForce(_) { - var f, p; - if (!(0, _vegaUtil.hasOwnProperty)(ForceMap, _.force)) (0, _vegaUtil.error)('Unrecognized force: ' + _.force); - f = ForceMap[_.force](); - for(p in _)if ((0, _vegaUtil.isFunction)(f[p])) setForceParam(f[p], _[p], _); - return f; -} -function setForceParam(f, v, _) { - f((0, _vegaUtil.isFunction)(v) ? (d)=>v(d, _) : v); -} - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-force":"kTqQn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kTqQn":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "forceCenter", ()=>(0, _centerJsDefault.default)); -parcelHelpers.export(exports, "forceCollide", ()=>(0, _collideJsDefault.default)); -parcelHelpers.export(exports, "forceLink", ()=>(0, _linkJsDefault.default)); -parcelHelpers.export(exports, "forceManyBody", ()=>(0, _manyBodyJsDefault.default)); -parcelHelpers.export(exports, "forceRadial", ()=>(0, _radialJsDefault.default)); -parcelHelpers.export(exports, "forceSimulation", ()=>(0, _simulationJsDefault.default)); -parcelHelpers.export(exports, "forceX", ()=>(0, _xJsDefault.default)); -parcelHelpers.export(exports, "forceY", ()=>(0, _yJsDefault.default)); -var _centerJs = require("./center.js"); -var _centerJsDefault = parcelHelpers.interopDefault(_centerJs); -var _collideJs = require("./collide.js"); -var _collideJsDefault = parcelHelpers.interopDefault(_collideJs); -var _linkJs = require("./link.js"); -var _linkJsDefault = parcelHelpers.interopDefault(_linkJs); -var _manyBodyJs = require("./manyBody.js"); -var _manyBodyJsDefault = parcelHelpers.interopDefault(_manyBodyJs); -var _radialJs = require("./radial.js"); -var _radialJsDefault = parcelHelpers.interopDefault(_radialJs); -var _simulationJs = require("./simulation.js"); -var _simulationJsDefault = parcelHelpers.interopDefault(_simulationJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); - -},{"./center.js":"cmuXj","./collide.js":"kAxiK","./link.js":"dpYez","./manyBody.js":"1XMYH","./radial.js":false,"./simulation.js":"k5O0L","./x.js":"byekK","./y.js":"eIzZp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cmuXj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - var nodes, strength = 1; - if (x == null) x = 0; - if (y == null) y = 0; - function force() { - var i, n = nodes.length, node, sx = 0, sy = 0; - for(i = 0; i < n; ++i)node = nodes[i], sx += node.x, sy += node.y; - for(sx = (sx / n - x) * strength, sy = (sy / n - y) * strength, i = 0; i < n; ++i)node = nodes[i], node.x -= sx, node.y -= sy; - } - force.initialize = function(_) { - nodes = _; - }; - force.x = function(_) { - return arguments.length ? (x = +_, force) : x; - }; - force.y = function(_) { - return arguments.length ? (y = +_, force) : y; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - return force; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kAxiK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(radius) { - var nodes, radii, random, strength = 1, iterations = 1; - if (typeof radius !== "function") radius = (0, _constantJsDefault.default)(radius == null ? 1 : +radius); - function force() { - var i, n = nodes.length, tree, node, xi, yi, ri, ri2; - for(var k = 0; k < iterations; ++k){ - tree = (0, _d3Quadtree.quadtree)(nodes, x, y).visitAfter(prepare); - for(i = 0; i < n; ++i){ - node = nodes[i]; - ri = radii[node.index], ri2 = ri * ri; - xi = node.x + node.vx; - yi = node.y + node.vy; - tree.visit(apply); - } - } - function apply(quad, x0, y0, x1, y1) { - var data = quad.data, rj = quad.r, r = ri + rj; - if (data) { - if (data.index > node.index) { - var x = xi - data.x - data.vx, y = yi - data.y - data.vy, l = x * x + y * y; - if (l < r * r) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - l = (r - (l = Math.sqrt(l))) / l * strength; - node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); - node.vy += (y *= l) * r; - data.vx -= x * (r = 1 - r); - data.vy -= y * r; - } - } - return; - } - return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; - } - } - function prepare(quad) { - if (quad.data) return quad.r = radii[quad.data.index]; - for(var i = quad.r = 0; i < 4; ++i)if (quad[i] && quad[i].r > quad.r) quad.r = quad[i].r; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - radii = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], radii[node.index] = +radius(node, i, nodes); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = +_, force) : strength; - }; - force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : radius; - }; - return force; - }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function x(d) { - return d.x + d.vx; -} -function y(d) { - return d.y + d.vy; -} - -},{"d3-quadtree":"37u8M","./constant.js":"gq4mo","./jiggle.js":"2qIlb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"37u8M":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "quadtree", ()=>(0, _quadtreeJsDefault.default)); -var _quadtreeJs = require("./quadtree.js"); -var _quadtreeJsDefault = parcelHelpers.interopDefault(_quadtreeJs); - -},{"./quadtree.js":"3kHO8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3kHO8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>quadtree); -var _addJs = require("./add.js"); -var _addJsDefault = parcelHelpers.interopDefault(_addJs); -var _coverJs = require("./cover.js"); -var _coverJsDefault = parcelHelpers.interopDefault(_coverJs); -var _dataJs = require("./data.js"); -var _dataJsDefault = parcelHelpers.interopDefault(_dataJs); -var _extentJs = require("./extent.js"); -var _extentJsDefault = parcelHelpers.interopDefault(_extentJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _removeJs = require("./remove.js"); -var _removeJsDefault = parcelHelpers.interopDefault(_removeJs); -var _rootJs = require("./root.js"); -var _rootJsDefault = parcelHelpers.interopDefault(_rootJs); -var _sizeJs = require("./size.js"); -var _sizeJsDefault = parcelHelpers.interopDefault(_sizeJs); -var _visitJs = require("./visit.js"); -var _visitJsDefault = parcelHelpers.interopDefault(_visitJs); -var _visitAfterJs = require("./visitAfter.js"); -var _visitAfterJsDefault = parcelHelpers.interopDefault(_visitAfterJs); -var _xJs = require("./x.js"); -var _xJsDefault = parcelHelpers.interopDefault(_xJs); -var _yJs = require("./y.js"); -var _yJsDefault = parcelHelpers.interopDefault(_yJs); -function quadtree(nodes, x, y) { - var tree = new Quadtree(x == null ? (0, _xJs.defaultX) : x, y == null ? (0, _yJs.defaultY) : y, NaN, NaN, NaN, NaN); - return nodes == null ? tree : tree.addAll(nodes); -} -function Quadtree(x, y, x0, y0, x1, y1) { - this._x = x; - this._y = y; - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - this._root = undefined; -} -function leaf_copy(leaf) { - var copy = { - data: leaf.data - }, next = copy; - while(leaf = leaf.next)next = next.next = { - data: leaf.data - }; - return copy; -} -var treeProto = quadtree.prototype = Quadtree.prototype; -treeProto.copy = function() { - var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; - if (!node) return copy; - if (!node.length) return copy._root = leaf_copy(node), copy; - nodes = [ - { - source: node, - target: copy._root = new Array(4) + if (0 < t02 && t02 < 1) cb(cubic(t02, x02, x12, x2, x3)); + if (0 < t12 && t12 < 1) cb(cubic(t12, x02, x12, x2, x3)); + } + function cubic(t, x02, x12, x2, x3) { + const s = 1 - t, s2 = s * s, t22 = t * t; + return s2 * s * x02 + 3 * s2 * t * x12 + 3 * s * t22 * x2 + t22 * t * x3; + } + var context$2 = (context$2 = domCanvas(1, 1)) ? context$2.getContext("2d") : null; + const b = new Bounds(); + function intersectPath(draw2) { + return function(item, brush) { + if (!context$2) return true; + draw2(context$2, item); + b.clear().union(item.bounds).intersect(brush).round(); + const { + x1: x12, + y1: y12, + x2, + y2 + } = b; + for (let y3 = y12; y3 <= y2; ++y3) { + for (let x3 = x12; x3 <= x2; ++x3) { + if (context$2.isPointInPath(x3, y3)) { + return true; + } } - ]; - while(node = nodes.pop()){ - for(var i = 0; i < 4; ++i)if (child = node.source[i]) { - if (child.length) nodes.push({ - source: child, - target: node.target[i] = new Array(4) - }); - else node.target[i] = leaf_copy(child); - } - } - return copy; -}; -treeProto.add = (0, _addJsDefault.default); -treeProto.addAll = (0, _addJs.addAll); -treeProto.cover = (0, _coverJsDefault.default); -treeProto.data = (0, _dataJsDefault.default); -treeProto.extent = (0, _extentJsDefault.default); -treeProto.find = (0, _findJsDefault.default); -treeProto.remove = (0, _removeJsDefault.default); -treeProto.removeAll = (0, _removeJs.removeAll); -treeProto.root = (0, _rootJsDefault.default); -treeProto.size = (0, _sizeJsDefault.default); -treeProto.visit = (0, _visitJsDefault.default); -treeProto.visitAfter = (0, _visitAfterJsDefault.default); -treeProto.x = (0, _xJsDefault.default); -treeProto.y = (0, _yJsDefault.default); - -},{"./add.js":"5Rd7q","./cover.js":"bMVUj","./data.js":"8gCAF","./extent.js":"55OBQ","./find.js":"7wO3V","./remove.js":"aDV7k","./root.js":"i8Ybu","./size.js":"9DeOu","./visit.js":"4YvSz","./visitAfter.js":"fin30","./x.js":"39OFs","./y.js":"9VKON","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5Rd7q":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - const x = +this._x.call(null, d), y = +this._y.call(null, d); - return add(this.cover(x, y), x, y, d); - }); -parcelHelpers.export(exports, "addAll", ()=>addAll); -function add(tree, x, y, d) { - if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points - var parent, node = tree._root, leaf = { - data: d - }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1, xm, ym, xp, yp, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return tree._root = leaf, tree; - // Find the existing leaf for the new point, or add it. - while(node.length){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; - } - // Is the new point is exactly coincident with the existing point? - xp = +tree._x.call(null, node.data); - yp = +tree._y.call(null, node.data); - if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; - // Otherwise, split the leaf node until the old and new point are separated. - do { - parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - }while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); - return parent[j] = node, parent[i] = leaf, tree; -} -function addAll(data) { - var d, i, n = data.length, x, y, xz = new Array(n), yz = new Array(n), x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity; - // Compute the points and their extent. - for(i = 0; i < n; ++i){ - if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; - xz[i] = x; - yz[i] = y; - if (x < x0) x0 = x; - if (x > x1) x1 = x; - if (y < y0) y0 = y; - if (y > y1) y1 = y; - } - // If there were no (valid) points, abort. - if (x0 > x1 || y0 > y1) return this; - // Expand the tree to cover the new points. - this.cover(x0, y0).cover(x1, y1); - // Add the new points. - for(i = 0; i < n; ++i)add(this, xz[i], yz[i], data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bMVUj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y) { - if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points - var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1; - // If the quadtree has no extent, initialize them. - // Integer extent are necessary so that if we later double the extent, - // the existing quadrant boundaries don’t change due to floating point error! - if (isNaN(x0)) { - x1 = (x0 = Math.floor(x)) + 1; - y1 = (y0 = Math.floor(y)) + 1; - } else { - var z = x1 - x0 || 1, node = this._root, parent, i; - while(x0 > x || x >= x1 || y0 > y || y >= y1){ - i = (y < y0) << 1 | x < x0; - parent = new Array(4), parent[i] = node, node = parent, z *= 2; - switch(i){ - case 0: - x1 = x0 + z, y1 = y0 + z; - break; - case 1: - x0 = x1 - z, y1 = y0 + z; - break; - case 2: - x1 = x0 + z, y0 = y1 - z; - break; - case 3: - x0 = x1 - z, y0 = y1 - z; - break; - } - } - if (this._root && this._root.length) this._root = node; - } - this._x0 = x0; - this._y0 = y0; - this._x1 = x1; - this._y1 = y1; - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8gCAF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var data = []; - this.visit(function(node) { - if (!node.length) do data.push(node.data); - while (node = node.next); - }); - return data; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"55OBQ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [ - [ - this._x0, - this._y0 - ], - [ - this._x1, - this._y1 - ] - ]; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7wO3V":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x, y, radius) { - var data, x0 = this._x0, y0 = this._y0, x1, y1, x2, y2, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; - if (node) quads.push(new (0, _quadJsDefault.default)(node, x0, y0, x3, y3)); - if (radius == null) radius = Infinity; - else { - x0 = x - radius, y0 = y - radius; - x3 = x + radius, y3 = y + radius; - radius *= radius; - } - while(q = quads.pop()){ - // Stop searching if this quadrant can’t contain a closer node. - if (!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0) continue; - // Bisect the current quadrant. - if (node.length) { - var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2; - quads.push(new (0, _quadJsDefault.default)(node[3], xm, ym, x2, y2), new (0, _quadJsDefault.default)(node[2], x1, ym, xm, y2), new (0, _quadJsDefault.default)(node[1], xm, y1, x2, ym), new (0, _quadJsDefault.default)(node[0], x1, y1, xm, ym)); - // Visit the closest quadrant first. - if (i = (y >= ym) << 1 | x >= xm) { - q = quads[quads.length - 1]; - quads[quads.length - 1] = quads[quads.length - 1 - i]; - quads[quads.length - 1 - i] = q; - } - } else { - var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; - if (d2 < radius) { - var d = Math.sqrt(radius = d2); - x0 = x - d, y0 = y - d; - x3 = x + d, y3 = y + d; - data = node.data; - } - } + } + return false; + }; + } + function intersectPoint(item, box2) { + return box2.contains(item.x || 0, item.y || 0); + } + function intersectRect(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, w2 = item.width || 0, h2 = item.height || 0; + return box2.intersects(b.set(x2, y2, x2 + w2, y2 + h2)); + } + function intersectRule(item, box2) { + const x2 = item.x || 0, y2 = item.y || 0, x22 = item.x2 != null ? item.x2 : x2, y22 = item.y2 != null ? item.y2 : y2; + return intersectBoxLine(box2, x2, y2, x22, y22); + } + function intersectBoxLine(box2, x2, y2, u2, v) { + const { + x1: x12, + y1: y12, + x2: x22, + y2: y22 + } = box2, dx = u2 - x2, dy = v - y2; + let t02 = 0, t12 = 1, p, q, r, e; + for (e = 0; e < 4; ++e) { + if (e === 0) { + p = -dx; + q = -(x12 - x2); + } + if (e === 1) { + p = dx; + q = x22 - x2; + } + if (e === 2) { + p = -dy; + q = -(y12 - y2); + } + if (e === 3) { + p = dy; + q = y22 - y2; + } + if (Math.abs(p) < 1e-10 && q < 0) return false; + r = q / p; + if (p < 0) { + if (r > t12) return false; + else if (r > t02) t02 = r; + } else if (p > 0) { + if (r < t02) return false; + else if (r < t12) t12 = r; + } + } + return true; + } + function blend(context2, item) { + context2.globalCompositeOperation = item.blend || "source-over"; + } + function value$2(value2, dflt) { + return value2 == null ? dflt : value2; + } + function addStops(gradient2, stops) { + const n = stops.length; + for (let i = 0; i < n; ++i) { + gradient2.addColorStop(stops[i].offset, stops[i].color); + } + return gradient2; + } + function gradient$1(context2, spec, bounds2) { + const w2 = bounds2.width(), h2 = bounds2.height(); + let gradient2; + if (spec.gradient === "radial") { + gradient2 = context2.createRadialGradient(bounds2.x1 + value$2(spec.x1, 0.5) * w2, bounds2.y1 + value$2(spec.y1, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r1, 0), bounds2.x1 + value$2(spec.x2, 0.5) * w2, bounds2.y1 + value$2(spec.y2, 0.5) * h2, Math.max(w2, h2) * value$2(spec.r2, 0.5)); + } else { + const x12 = value$2(spec.x1, 0), y12 = value$2(spec.y1, 0), x2 = value$2(spec.x2, 1), y2 = value$2(spec.y2, 0); + if (x12 === x2 || y12 === y2 || w2 === h2) { + gradient2 = context2.createLinearGradient(bounds2.x1 + x12 * w2, bounds2.y1 + y12 * h2, bounds2.x1 + x2 * w2, bounds2.y1 + y2 * h2); + } else { + const image2 = domCanvas(Math.ceil(w2), Math.ceil(h2)), ictx = image2.getContext("2d"); + ictx.scale(w2, h2); + ictx.fillStyle = addStops(ictx.createLinearGradient(x12, y12, x2, y2), spec.stops); + ictx.fillRect(0, 0, w2, h2); + return context2.createPattern(image2, "no-repeat"); + } + } + return addStops(gradient2, spec.stops); + } + function color$1(context2, item, value2) { + return isGradient(value2) ? gradient$1(context2, value2, item.bounds) : value2; + } + function fill(context2, item, opacity) { + opacity *= item.fillOpacity == null ? 1 : item.fillOpacity; + if (opacity > 0) { + context2.globalAlpha = opacity; + context2.fillStyle = color$1(context2, item, item.fill); + return true; + } else { + return false; + } + } + var Empty = []; + function stroke(context2, item, opacity) { + var lw = (lw = item.strokeWidth) != null ? lw : 1; + if (lw <= 0) return false; + opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity; + if (opacity > 0) { + context2.globalAlpha = opacity; + context2.strokeStyle = color$1(context2, item, item.stroke); + context2.lineWidth = lw; + context2.lineCap = item.strokeCap || "butt"; + context2.lineJoin = item.strokeJoin || "miter"; + context2.miterLimit = item.strokeMiterLimit || 10; + if (context2.setLineDash) { + context2.setLineDash(item.strokeDash || Empty); + context2.lineDashOffset = item.strokeDashOffset || 0; + } + return true; + } else { + return false; + } + } + function compare(a2, b2) { + return a2.zindex - b2.zindex || a2.index - b2.index; + } + function zorder(scene) { + if (!scene.zdirty) return scene.zitems; + var items = scene.items, output2 = [], item, i, n; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + item.index = i; + if (item.zindex) output2.push(item); + } + scene.zdirty = false; + return scene.zitems = output2.sort(compare); + } + function visit(scene, visitor) { + var items = scene.items, i, n; + if (!items || !items.length) return; + const zitems = zorder(scene); + if (zitems && zitems.length) { + for (i = 0, n = items.length; i < n; ++i) { + if (!items[i].zindex) visitor(items[i]); + } + items = zitems; + } + for (i = 0, n = items.length; i < n; ++i) { + visitor(items[i]); + } + } + function pickVisit(scene, visitor) { + var items = scene.items, hit2, i; + if (!items || !items.length) return null; + const zitems = zorder(scene); + if (zitems && zitems.length) items = zitems; + for (i = items.length; --i >= 0; ) { + if (hit2 = visitor(items[i])) return hit2; + } + if (items === zitems) { + for (items = scene.items, i = items.length; --i >= 0; ) { + if (!items[i].zindex) { + if (hit2 = visitor(items[i])) return hit2; } - return data; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"ij3wf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ij3wf":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node, x0, y0, x1, y1) { - this.node = node; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aDV7k":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(d) { - if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points - var parent, node = this._root, retainer, previous, next, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1, x, y, xm, ym, right, bottom, i, j; - // If the tree is empty, initialize the root as a leaf. - if (!node) return this; - // Find the leaf node for the point. - // While descending, also retain the deepest parent with a non-removed sibling. - if (node.length) while(true){ - if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; - else x1 = xm; - if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; - else y1 = ym; - if (!(parent = node, node = node[i = bottom << 1 | right])) return this; - if (!node.length) break; - if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; - } - // Find the point to remove. - while(node.data !== d)if (!(previous = node, node = node.next)) return this; - if (next = node.next) delete node.next; - // If there are multiple coincident points, remove just the point. - if (previous) return next ? previous.next = next : delete previous.next, this; - // If this is the root point, remove it. - if (!parent) return this._root = next, this; - // Remove this leaf. - next ? parent[i] = next : delete parent[i]; - // If the parent now contains exactly one leaf, collapse superfluous parents. - if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { - if (retainer) retainer[j] = node; - else this._root = node; + } + } + return null; + } + function drawAll(path2) { + return function(context2, scene, bounds2) { + visit(scene, (item) => { + if (!bounds2 || bounds2.intersects(item.bounds)) { + drawPath(path2, context2, item, item); } - return this; - }); -parcelHelpers.export(exports, "removeAll", ()=>removeAll); -function removeAll(data) { - for(var i = 0, n = data.length; i < n; ++i)this.remove(data[i]); - return this; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i8Ybu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this._root; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9DeOu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var size = 0; - this.visit(function(node) { - if (!node.length) do ++size; - while (node = node.next); - }); - return size; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4YvSz":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], q, node = this._root, child, x0, y0, x1, y1; - if (node) quads.push(new (0, _quadJsDefault.default)(node, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop())if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { - var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); + }); + }; + } + function drawOne(path2) { + return function(context2, scene, bounds2) { + if (scene.items.length && (!bounds2 || bounds2.intersects(scene.bounds))) { + drawPath(path2, context2, scene.items[0], scene.items); + } + }; + } + function drawPath(path2, context2, item, items) { + var opacity = item.opacity == null ? 1 : item.opacity; + if (opacity === 0) return; + if (path2(context2, items)) return; + blend(context2, item); + if (item.fill && fill(context2, item, opacity)) { + context2.fill(); + } + if (item.stroke && stroke(context2, item, opacity)) { + context2.stroke(); + } + } + function pick$1(test2) { + test2 = test2 || truthy; + return function(context2, scene, x2, y2, gx, gy) { + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return pickVisit(scene, (item) => { + const b2 = item.bounds; + if (b2 && !b2.contains(gx, gy) || !b2) return; + if (test2(context2, item, x2, y2, gx, gy)) return item; + }); + }; + } + function hitPath(path2, filled) { + return function(context2, o, x2, y2) { + var item = Array.isArray(o) ? o[0] : o, fill2 = filled == null ? item.fill : filled, stroke2 = item.stroke && context2.isPointInStroke, lw, lc; + if (stroke2) { + lw = item.strokeWidth; + lc = item.strokeCap; + context2.lineWidth = lw != null ? lw : 1; + context2.lineCap = lc != null ? lc : "butt"; + } + return path2(context2, o) ? false : fill2 && context2.isPointInPath(x2, y2) || stroke2 && context2.isPointInStroke(x2, y2); + }; + } + function pickPath(path2) { + return pick$1(hitPath(path2)); + } + function translate$2(x2, y2) { + return "translate(" + x2 + "," + y2 + ")"; + } + function rotate(a2) { + return "rotate(" + a2 + ")"; + } + function scale$5(scaleX, scaleY2) { + return "scale(" + scaleX + "," + scaleY2 + ")"; + } + function translateItem(item) { + return translate$2(item.x || 0, item.y || 0); + } + function rotateItem(item) { + return translate$2(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : ""); + } + function transformItem(item) { + return translate$2(item.x || 0, item.y || 0) + (item.angle ? " " + rotate(item.angle) : "") + (item.scaleX || item.scaleY ? " " + scale$5(item.scaleX || 1, item.scaleY || 1) : ""); + } + function markItemPath(type2, shape2, isect) { + function attr2(emit2, item) { + emit2("transform", rotateItem(item)); + emit2("d", shape2(null, item)); + } + function bound2(bounds2, item) { + shape2(boundContext(bounds2, item.angle), item); + return boundStroke(bounds2, item).translate(item.x || 0, item.y || 0); + } + function draw2(context2, item) { + var x2 = item.x || 0, y2 = item.y || 0, a2 = item.angle || 0; + context2.translate(x2, y2); + if (a2) context2.rotate(a2 *= DegToRad); + context2.beginPath(); + shape2(context2, item); + if (a2) context2.rotate(-a2); + context2.translate(-x2, -y2); + } + return { + type: type2, + tag: "path", + nested: false, + attr: attr2, + bound: bound2, + draw: drawAll(draw2), + pick: pickPath(draw2), + isect: isect || intersectPath(draw2) + }; + } + var arc$2 = markItemPath("arc", arc$1); + function pickArea(a2, p) { + var v = a2[0].orient === "horizontal" ? p[1] : p[0], z = a2[0].orient === "horizontal" ? "y" : "x", i = a2.length, min2 = Infinity, hit2, d; + while (--i >= 0) { + if (a2[i].defined === false) continue; + d = Math.abs(a2[i][z] - v); + if (d < min2) { + min2 = d; + hit2 = a2[i]; + } + } + return hit2; + } + function pickLine(a2, p) { + var t = Math.pow(a2[0].strokeWidth || 1, 2), i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + if (dd < t) return a2[i]; + } + return null; + } + function pickTrail(a2, p) { + var i = a2.length, dx, dy, dd; + while (--i >= 0) { + if (a2[i].defined === false) continue; + dx = a2[i].x - p[0]; + dy = a2[i].y - p[1]; + dd = dx * dx + dy * dy; + dx = a2[i].size || 1; + if (dd < dx * dx) return a2[i]; + } + return null; + } + function markMultiItemPath(type2, shape2, tip) { + function attr2(emit2, item) { + var items = item.mark.items; + if (items.length) emit2("d", shape2(null, items)); + } + function bound2(bounds2, mark) { + var items = mark.items; + if (items.length === 0) { + return bounds2; + } else { + shape2(boundContext(bounds2), items); + return boundStroke(bounds2, items[0]); + } + } + function draw2(context2, items) { + context2.beginPath(); + shape2(context2, items); + } + const hit2 = hitPath(draw2); + function pick2(context2, scene, x2, y2, gx, gy) { + var items = scene.items, b2 = scene.bounds; + if (!items || !items.length || b2 && !b2.contains(gx, gy)) { + return null; + } + x2 *= context2.pixelRatio; + y2 *= context2.pixelRatio; + return hit2(context2, items, x2, y2) ? items[0] : null; + } + return { + type: type2, + tag: "path", + nested: true, + attr: attr2, + bound: bound2, + draw: drawOne(draw2), + pick: pick2, + isect: intersectPoint, + tip + }; + } + var area$2 = markMultiItemPath("area", area$1, pickArea); + function clip$2(context2, scene) { + var clip2 = scene.clip; + context2.save(); + if (isFunction(clip2)) { + context2.beginPath(); + clip2(context2); + context2.clip(); + } else { + clipGroup(context2, scene.group); + } + } + function clipGroup(context2, group2) { + context2.beginPath(); + hasCornerRadius(group2) ? rectangle(context2, group2, 0, 0) : context2.rect(0, 0, group2.width || 0, group2.height || 0); + context2.clip(); + } + function offset$1(item) { + const sw = value$2(item.strokeWidth, 1); + return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0; + } + function attr$5(emit2, item) { + emit2("transform", translateItem(item)); + } + function emitRectangle(emit2, item) { + const off = offset$1(item); + emit2("d", rectangle(null, item, off, off)); + } + function background$1(emit2, item) { + emit2("class", "background"); + emit2("aria-hidden", true); + emitRectangle(emit2, item); + } + function foreground(emit2, item) { + emit2("class", "foreground"); + emit2("aria-hidden", true); + if (item.strokeForeground) { + emitRectangle(emit2, item); + } else { + emit2("d", ""); + } + } + function content(emit2, item, renderer) { + const url = item.clip ? clip$1$1(renderer, item, item) : null; + emit2("clip-path", url); + } + function bound$5(bounds2, group2) { + if (!group2.clip && group2.items) { + const items = group2.items, m2 = items.length; + for (let j = 0; j < m2; ++j) { + bounds2.union(items[j].bounds); + } + } + if ((group2.clip || group2.width || group2.height) && !group2.noBound) { + bounds2.add(0, 0).add(group2.width || 0, group2.height || 0); + } + boundStroke(bounds2, group2); + return bounds2.translate(group2.x || 0, group2.y || 0); + } + function rectanglePath(context2, group2, x2, y2) { + const off = offset$1(group2); + context2.beginPath(); + rectangle(context2, group2, (x2 || 0) + off, (y2 || 0) + off); + } + const hitBackground = hitPath(rectanglePath); + const hitForeground = hitPath(rectanglePath, false); + const hitCorner = hitPath(rectanglePath, true); + function draw$4(context2, scene, bounds2, markTypes) { + visit(scene, (group2) => { + const gx = group2.x || 0, gy = group2.y || 0, fore = group2.strokeForeground, opacity = group2.opacity == null ? 1 : group2.opacity; + if ((group2.stroke || group2.fill) && opacity) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (group2.fill && fill(context2, group2, opacity)) { + context2.fill(); + } + if (group2.stroke && !fore && stroke(context2, group2, opacity)) { + context2.stroke(); } - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"ij3wf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fin30":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback) { - var quads = [], next = [], q; - if (this._root) quads.push(new (0, _quadJsDefault.default)(this._root, this._x0, this._y0, this._x1, this._y1)); - while(q = quads.pop()){ - var node = q.node; - if (node.length) { - var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; - if (child = node[0]) quads.push(new (0, _quadJsDefault.default)(child, x0, y0, xm, ym)); - if (child = node[1]) quads.push(new (0, _quadJsDefault.default)(child, xm, y0, x1, ym)); - if (child = node[2]) quads.push(new (0, _quadJsDefault.default)(child, x0, ym, xm, y1)); - if (child = node[3]) quads.push(new (0, _quadJsDefault.default)(child, xm, ym, x1, y1)); - } - next.push(q); + } + context2.save(); + context2.translate(gx, gy); + if (group2.clip) clipGroup(context2, group2); + if (bounds2) bounds2.translate(-gx, -gy); + visit(group2, (item) => { + if (item.marktype === "group" || markTypes == null || markTypes.includes(item.marktype)) { + this.draw(context2, item, bounds2, markTypes); } - while(q = next.pop())callback(q.node, q.x0, q.y0, q.x1, q.y1); - return this; - }); -var _quadJs = require("./quad.js"); -var _quadJsDefault = parcelHelpers.interopDefault(_quadJs); - -},{"./quad.js":"ij3wf","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"39OFs":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultX", ()=>defaultX); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._x = _, this) : this._x; - }); -function defaultX(d) { - return d[0]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9VKON":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "defaultY", ()=>defaultY); -parcelHelpers.export(exports, "default", ()=>function(_) { - return arguments.length ? (this._y = _, this) : this._y; - }); -function defaultY(d) { - return d[1]; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gq4mo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2qIlb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(random) { - return (random() - 0.5) * 1e-6; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dpYez":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(links) { - var id = index, strength = defaultStrength, strengths, distance = (0, _constantJsDefault.default)(30), distances, nodes, count, bias, random, iterations = 1; - if (links == null) links = []; - function defaultStrength(link) { - return 1 / Math.min(count[link.source.index], count[link.target.index]); - } - function force(alpha) { - for(var k = 0, n = links.length; k < iterations; ++k)for(var i = 0, link, source, target, x, y, l, b; i < n; ++i){ - link = links[i], source = link.source, target = link.target; - x = target.x + target.vx - source.x - source.vx || (0, _jiggleJsDefault.default)(random); - y = target.y + target.vy - source.y - source.vy || (0, _jiggleJsDefault.default)(random); - l = Math.sqrt(x * x + y * y); - l = (l - distances[i]) / l * alpha * strengths[i]; - x *= l, y *= l; - target.vx -= x * (b = bias[i]); - target.vy -= y * b; - source.vx += x * (b = 1 - b); - source.vy += y * b; - } + }); + if (bounds2) bounds2.translate(gx, gy); + context2.restore(); + if (fore && group2.stroke && opacity) { + rectanglePath(context2, group2, gx, gy); + blend(context2, group2); + if (stroke(context2, group2, opacity)) { + context2.stroke(); } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, m = links.length, nodeById = new Map(nodes.map((d, i)=>[ - id(d, i, nodes), - d - ])), link; - for(i = 0, count = new Array(n); i < m; ++i){ - link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = find(nodeById, link.source); - if (typeof link.target !== "object") link.target = find(nodeById, link.target); - count[link.source.index] = (count[link.source.index] || 0) + 1; - count[link.target.index] = (count[link.target.index] || 0) + 1; - } - for(i = 0, bias = new Array(m); i < m; ++i)link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); - strengths = new Array(m), initializeStrength(); - distances = new Array(m), initializeDistance(); - } - function initializeStrength() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)strengths[i] = +strength(links[i], i, links); - } - function initializeDistance() { - if (!nodes) return; - for(var i = 0, n = links.length; i < n; ++i)distances[i] = +distance(links[i], i, links); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.links = function(_) { - return arguments.length ? (links = _, initialize(), force) : links; - }; - force.id = function(_) { - return arguments.length ? (id = _, force) : id; - }; - force.iterations = function(_) { - return arguments.length ? (iterations = +_, force) : iterations; - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeStrength(), force) : strength; - }; - force.distance = function(_) { - return arguments.length ? (distance = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initializeDistance(), force) : distance; - }; - return force; + } }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -function index(d) { - return d.index; -} -function find(nodeById, nodeId) { - var node = nodeById.get(nodeId); - if (!node) throw new Error("node not found: " + nodeId); - return node; -} - -},{"./constant.js":"gq4mo","./jiggle.js":"2qIlb","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1XMYH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var nodes, node, random, alpha, strength = (0, _constantJsDefault.default)(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; - function force(_) { - var i, n = nodes.length, tree = (0, _d3Quadtree.quadtree)(nodes, (0, _simulationJs.x), (0, _simulationJs.y)).visitAfter(accumulate); - for(alpha = _, i = 0; i < n; ++i)node = nodes[i], tree.visit(apply); - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length, node; - strengths = new Array(n); - for(i = 0; i < n; ++i)node = nodes[i], strengths[node.index] = +strength(node, i, nodes); - } - function accumulate(quad) { - var strength = 0, q, c, weight = 0, x, y, i; - // For internal nodes, accumulate forces from child quadrants. - if (quad.length) { - for(x = y = i = 0; i < 4; ++i)if ((q = quad[i]) && (c = Math.abs(q.value))) strength += q.value, weight += c, x += c * q.x, y += c * q.y; - quad.x = x / weight; - quad.y = y / weight; - } else { - q = quad; - q.x = q.data.x; - q.y = q.data.y; - do strength += strengths[q.data.index]; - while (q = q.next); - } - quad.value = strength; - } - function apply(quad, x1, _, x2) { - if (!quad.value) return true; - var x = quad.x - node.x, y = quad.y - node.y, w = x2 - x1, l = x * x + y * y; - // Apply the Barnes-Hut approximation if possible. - // Limit forces for very close nodes; randomize direction if coincident. - if (w * w / theta2 < l) { - if (l < distanceMax2) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - node.vx += x * quad.value * alpha / l; - node.vy += y * quad.value * alpha / l; - } - return true; - } else if (quad.length || l >= distanceMax2) return; - // Limit forces for very close nodes; randomize direction if coincident. - if (quad.data !== node || quad.next) { - if (x === 0) x = (0, _jiggleJsDefault.default)(random), l += x * x; - if (y === 0) y = (0, _jiggleJsDefault.default)(random), l += y * y; - if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); - } - do if (quad.data !== node) { - w = strengths[quad.data.index] * alpha / l; - node.vx += x * w; - node.vy += y * w; - } - while (quad = quad.next); - } - force.initialize = function(_nodes, _random) { - nodes = _nodes; - random = _random; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.distanceMin = function(_) { - return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); - }; - force.distanceMax = function(_) { - return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); - }; - force.theta = function(_) { - return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); - }; - return force; + } + function pick(context2, scene, x2, y2, gx, gy) { + if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) { + return null; + } + const cx = x2 * context2.pixelRatio, cy = y2 * context2.pixelRatio; + return pickVisit(scene, (group2) => { + let hit2, dx, dy; + const b2 = group2.bounds; + if (b2 && !b2.contains(gx, gy)) return; + dx = group2.x || 0; + dy = group2.y || 0; + const dw = dx + (group2.width || 0), dh = dy + (group2.height || 0), c2 = group2.clip; + if (c2 && (gx < dx || gx > dw || gy < dy || gy > dh)) return; + context2.save(); + context2.translate(dx, dy); + dx = gx - dx; + dy = gy - dy; + if (c2 && hasCornerRadius(group2) && !hitCorner(context2, group2, cx, cy)) { + context2.restore(); + return null; + } + const fore = group2.strokeForeground, ix = scene.interactive !== false; + if (ix && fore && group2.stroke && hitForeground(context2, group2, cx, cy)) { + context2.restore(); + return group2; + } + hit2 = pickVisit(group2, (mark) => pickMark(mark, dx, dy) ? this.pick(mark, x2, y2, dx, dy) : null); + if (!hit2 && ix && (group2.fill || !fore && group2.stroke) && hitBackground(context2, group2, cx, cy)) { + hit2 = group2; + } + context2.restore(); + return hit2 || null; }); -var _d3Quadtree = require("d3-quadtree"); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _jiggleJs = require("./jiggle.js"); -var _jiggleJsDefault = parcelHelpers.interopDefault(_jiggleJs); -var _simulationJs = require("./simulation.js"); - -},{"d3-quadtree":"37u8M","./constant.js":"gq4mo","./jiggle.js":"2qIlb","./simulation.js":"k5O0L","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k5O0L":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "x", ()=>x); -parcelHelpers.export(exports, "y", ()=>y); -parcelHelpers.export(exports, "default", ()=>function(nodes) { - var simulation, alpha = 1, alphaMin = 0.001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = new Map(), stepper = (0, _d3Timer.timer)(step), event = (0, _d3Dispatch.dispatch)("tick", "end"), random = (0, _lcgJsDefault.default)(); - if (nodes == null) nodes = []; - function step() { - tick(); - event.call("tick", simulation); - if (alpha < alphaMin) { - stepper.stop(); - event.call("end", simulation); - } - } - function tick(iterations) { - var i, n = nodes.length, node; - if (iterations === undefined) iterations = 1; - for(var k = 0; k < iterations; ++k){ - alpha += (alphaTarget - alpha) * alphaDecay; - forces.forEach(function(force) { - force(alpha); - }); - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (node.fx == null) node.x += node.vx *= velocityDecay; - else node.x = node.fx, node.vx = 0; - if (node.fy == null) node.y += node.vy *= velocityDecay; - else node.y = node.fy, node.vy = 0; - } - } - return simulation; - } - function initializeNodes() { - for(var i = 0, n = nodes.length, node; i < n; ++i){ - node = nodes[i], node.index = i; - if (node.fx != null) node.x = node.fx; - if (node.fy != null) node.y = node.fy; - if (isNaN(node.x) || isNaN(node.y)) { - var radius = initialRadius * Math.sqrt(0.5 + i), angle = i * initialAngle; - node.x = radius * Math.cos(angle); - node.y = radius * Math.sin(angle); - } - if (isNaN(node.vx) || isNaN(node.vy)) node.vx = node.vy = 0; - } + } + function pickMark(mark, x2, y2) { + return (mark.interactive !== false || mark.marktype === "group") && mark.bounds && mark.bounds.contains(x2, y2); + } + var group$1 = { + type: "group", + tag: "g", + nested: false, + attr: attr$5, + bound: bound$5, + draw: draw$4, + pick, + isect: intersectRect, + content, + background: background$1, + foreground + }; + var metadata = { + "xmlns": "http://www.w3.org/2000/svg", + "xmlns:xlink": "http://www.w3.org/1999/xlink", + "version": "1.1" + }; + function getImage(item, renderer) { + var image2 = item.image; + if (!image2 || item.url && item.url !== image2.url) { + image2 = { + complete: false, + width: 0, + height: 0 + }; + renderer.loadImage(item.url).then((image3) => { + item.image = image3; + item.image.url = item.url; + }); + } + return image2; + } + function imageWidth(item, image2) { + return item.width != null ? item.width : !image2 || !image2.width ? 0 : item.aspect !== false && item.height ? item.height * image2.width / image2.height : image2.width; + } + function imageHeight(item, image2) { + return item.height != null ? item.height : !image2 || !image2.height ? 0 : item.aspect !== false && item.width ? item.width * image2.height / image2.width : image2.height; + } + function imageXOffset(align, w2) { + return align === "center" ? w2 / 2 : align === "right" ? w2 : 0; + } + function imageYOffset(baseline2, h2) { + return baseline2 === "middle" ? h2 / 2 : baseline2 === "bottom" ? h2 : 0; + } + function attr$4(emit2, item, renderer) { + const img = getImage(item, renderer), w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), i = !img.src && img.toDataURL ? img.toDataURL() : img.src || ""; + emit2("href", i, metadata["xmlns:xlink"], "xlink:href"); + emit2("transform", translate$2(x2, y2)); + emit2("width", w2); + emit2("height", h2); + emit2("preserveAspectRatio", item.aspect === false ? "none" : "xMidYMid"); + } + function bound$4(bounds2, item) { + const img = item.image, w2 = imageWidth(item, img), h2 = imageHeight(item, img), x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2); + return bounds2.set(x2, y2, x2 + w2, y2 + h2); + } + function draw$3(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + const img = getImage(item, this); + let w2 = imageWidth(item, img); + let h2 = imageHeight(item, img); + if (w2 === 0 || h2 === 0) return; + let x2 = (item.x || 0) - imageXOffset(item.align, w2), y2 = (item.y || 0) - imageYOffset(item.baseline, h2), opacity, ar0, ar1, t; + if (item.aspect !== false) { + ar0 = img.width / img.height; + ar1 = item.width / item.height; + if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) { + if (ar1 < ar0) { + t = w2 / ar0; + y2 += (h2 - t) / 2; + h2 = t; + } else { + t = h2 * ar0; + x2 += (w2 - t) / 2; + w2 = t; + } } - function initializeForce(force) { - if (force.initialize) force.initialize(nodes, random); - return force; - } - initializeNodes(); - return simulation = { - tick: tick, - restart: function() { - return stepper.restart(step), simulation; - }, - stop: function() { - return stepper.stop(), simulation; - }, - nodes: function(_) { - return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation) : nodes; - }, - alpha: function(_) { - return arguments.length ? (alpha = +_, simulation) : alpha; - }, - alphaMin: function(_) { - return arguments.length ? (alphaMin = +_, simulation) : alphaMin; - }, - alphaDecay: function(_) { - return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; - }, - alphaTarget: function(_) { - return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; - }, - velocityDecay: function(_) { - return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; - }, - randomSource: function(_) { - return arguments.length ? (random = _, forces.forEach(initializeForce), simulation) : random; - }, - force: function(name, _) { - return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation) : forces.get(name); - }, - find: function(x, y, radius) { - var i = 0, n = nodes.length, dx, dy, d2, node, closest; - if (radius == null) radius = Infinity; - else radius *= radius; - for(i = 0; i < n; ++i){ - node = nodes[i]; - dx = x - node.x; - dy = y - node.y; - d2 = dx * dx + dy * dy; - if (d2 < radius) closest = node, radius = d2; - } - return closest; - }, - on: function(name, _) { - return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); - } - }; + } + if (img.complete || img.toDataURL) { + blend(context2, item); + context2.globalAlpha = (opacity = item.opacity) != null ? opacity : 1; + context2.imageSmoothingEnabled = item.smooth !== false; + context2.drawImage(img, x2, y2, w2, h2); + } }); -var _d3Dispatch = require("d3-dispatch"); -var _d3Timer = require("d3-timer"); -var _lcgJs = require("./lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function x(d) { - return d.x; -} -function y(d) { - return d.y; -} -var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); - -},{"d3-dispatch":"i7nsc","d3-timer":"d15bJ","./lcg.js":"3KZNV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i7nsc":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "dispatch", ()=>(0, _dispatchJsDefault.default)); -var _dispatchJs = require("./dispatch.js"); -var _dispatchJsDefault = parcelHelpers.interopDefault(_dispatchJs); - -},{"./dispatch.js":"6iBKi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iBKi":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var noop = { - value: ()=>{} -}; -function dispatch() { - for(var i = 0, n = arguments.length, _ = {}, t; i < n; ++i){ - if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); - _[t] = []; + } + var image = { + type: "image", + tag: "image", + nested: false, + attr: attr$4, + bound: bound$4, + draw: draw$3, + pick: pick$1(), + isect: truthy, + // bounds check is sufficient + get: getImage, + xOffset: imageXOffset, + yOffset: imageYOffset + }; + var line$2 = markMultiItemPath("line", line$1, pickLine); + function attr$3(emit2, item) { + var sx = item.scaleX || 1, sy = item.scaleY || 1; + if (sx !== 1 || sy !== 1) { + emit2("vector-effect", "non-scaling-stroke"); } - return new Dispatch(_); -} -function Dispatch(_) { - this._ = _; -} -function parseTypenames(typenames, types) { - return typenames.trim().split(/^|\s+/).map(function(t) { - var name = "", i = t.indexOf("."); - if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); - if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); - return { - type: t, - name: name - }; - }); -} -Dispatch.prototype = dispatch.prototype = { - constructor: Dispatch, - on: function(typename, callback) { - var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; - // If no callback was specified, return the callback of the given type and name. - if (arguments.length < 2) { - while(++i < n)if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; - return; + emit2("transform", transformItem(item)); + emit2("d", item.path); + } + function path$1(context2, item) { + var path2 = item.path; + if (path2 == null) return true; + var x2 = item.x || 0, y2 = item.y || 0, sx = item.scaleX || 1, sy = item.scaleY || 1, a2 = (item.angle || 0) * DegToRad, cache2 = item.pathCache; + if (!cache2 || cache2.path !== path2) { + (item.pathCache = cache2 = parse$3(path2)).path = path2; + } + if (a2 && context2.rotate && context2.translate) { + context2.translate(x2, y2); + context2.rotate(a2); + pathRender(context2, cache2, 0, 0, sx, sy); + context2.rotate(-a2); + context2.translate(-x2, -y2); + } else { + pathRender(context2, cache2, x2, y2, sx, sy); + } + } + function bound$3(bounds2, item) { + return path$1(boundContext(bounds2, item.angle), item) ? bounds2.set(0, 0, 0, 0) : boundStroke(bounds2, item, true); + } + var path$2 = { + type: "path", + tag: "path", + nested: false, + attr: attr$3, + bound: bound$3, + draw: drawAll(path$1), + pick: pickPath(path$1), + isect: intersectPath(path$1) + }; + function attr$2(emit2, item) { + emit2("d", rectangle(null, item)); + } + function bound$2(bounds2, item) { + var x2, y2; + return boundStroke(bounds2.set(x2 = item.x || 0, y2 = item.y || 0, x2 + item.width || 0, y2 + item.height || 0), item); + } + function draw$2(context2, item) { + context2.beginPath(); + rectangle(context2, item); + } + var rect = { + type: "rect", + tag: "path", + nested: false, + attr: attr$2, + bound: bound$2, + draw: drawAll(draw$2), + pick: pickPath(draw$2), + isect: intersectRect + }; + function attr$1(emit2, item) { + emit2("transform", translateItem(item)); + emit2("x2", item.x2 != null ? item.x2 - (item.x || 0) : 0); + emit2("y2", item.y2 != null ? item.y2 - (item.y || 0) : 0); + } + function bound$1(bounds2, item) { + var x12, y12; + return boundStroke(bounds2.set(x12 = item.x || 0, y12 = item.y || 0, item.x2 != null ? item.x2 : x12, item.y2 != null ? item.y2 : y12), item); + } + function path(context2, item, opacity) { + var x12, y12, x2, y2; + if (item.stroke && stroke(context2, item, opacity)) { + x12 = item.x || 0; + y12 = item.y || 0; + x2 = item.x2 != null ? item.x2 : x12; + y2 = item.y2 != null ? item.y2 : y12; + context2.beginPath(); + context2.moveTo(x12, y12); + context2.lineTo(x2, y2); + return true; + } + return false; + } + function draw$1(context2, scene, bounds2) { + visit(scene, (item) => { + if (bounds2 && !bounds2.intersects(item.bounds)) return; + var opacity = item.opacity == null ? 1 : item.opacity; + if (opacity && path(context2, item, opacity)) { + blend(context2, item); + context2.stroke(); + } + }); + } + function hit$1(context2, item, x2, y2) { + if (!context2.isPointInStroke) return false; + return path(context2, item, 1) && context2.isPointInStroke(x2, y2); + } + var rule$1 = { + type: "rule", + tag: "line", + nested: false, + attr: attr$1, + bound: bound$1, + draw: draw$1, + pick: pick$1(hit$1), + isect: intersectRule + }; + var shape = markItemPath("shape", shape$1); + var symbol = markItemPath("symbol", symbol$1, intersectPoint); + const widthCache = lruCache(); + var textMetrics = { + height: fontSize, + measureWidth, + estimateWidth, + width: estimateWidth, + canvas: useCanvas + }; + useCanvas(true); + function useCanvas(use2) { + textMetrics.width = use2 && context$2 ? measureWidth : estimateWidth; + } + function estimateWidth(item, text2) { + return _estimateWidth(textValue(item, text2), fontSize(item)); + } + function _estimateWidth(text2, currentFontHeight) { + return ~~(0.8 * text2.length * currentFontHeight); + } + function measureWidth(item, text2) { + return fontSize(item) <= 0 || !(text2 = textValue(item, text2)) ? 0 : _measureWidth(text2, font(item)); + } + function _measureWidth(text2, currentFont) { + const key2 = `(${currentFont}) ${text2}`; + let width2 = widthCache.get(key2); + if (width2 === void 0) { + context$2.font = currentFont; + width2 = context$2.measureText(text2).width; + widthCache.set(key2, width2); + } + return width2; + } + function fontSize(item) { + return item.fontSize != null ? +item.fontSize || 0 : 11; + } + function lineHeight(item) { + return item.lineHeight != null ? item.lineHeight : fontSize(item) + 2; + } + function lineArray(_) { + return isArray(_) ? _.length > 1 ? _ : _[0] : _; + } + function textLines(item) { + return lineArray(item.lineBreak && item.text && !isArray(item.text) ? item.text.split(item.lineBreak) : item.text); + } + function multiLineOffset(item) { + const tl2 = textLines(item); + return (isArray(tl2) ? tl2.length - 1 : 0) * lineHeight(item); + } + function textValue(item, line2) { + const text2 = line2 == null ? "" : (line2 + "").trim(); + return item.limit > 0 && text2.length ? truncate(item, text2) : text2; + } + function widthGetter(item) { + if (textMetrics.width === measureWidth) { + const currentFont = font(item); + return (text2) => _measureWidth(text2, currentFont); + } else if (textMetrics.width === estimateWidth) { + const currentFontHeight = fontSize(item); + return (text2) => _estimateWidth(text2, currentFontHeight); + } else { + return (text2) => textMetrics.width(item, text2); + } + } + function truncate(item, text2) { + var limit = +item.limit, width2 = widthGetter(item); + if (width2(text2) < limit) return text2; + var ellipsis = item.ellipsis || "…", rtl = item.dir === "rtl", lo = 0, hi = text2.length, mid; + limit -= width2(ellipsis); + if (rtl) { + while (lo < hi) { + mid = lo + hi >>> 1; + if (width2(text2.slice(mid)) > limit) lo = mid + 1; + else hi = mid; + } + return ellipsis + text2.slice(lo); + } else { + while (lo < hi) { + mid = 1 + (lo + hi >>> 1); + if (width2(text2.slice(0, mid)) < limit) lo = mid; + else hi = mid - 1; + } + return text2.slice(0, lo) + ellipsis; + } + } + function fontFamily(item, quote) { + var font2 = item.font; + return (quote && font2 ? String(font2).replace(/"/g, "'") : font2) || "sans-serif"; + } + function font(item, quote) { + return (item.fontStyle ? item.fontStyle + " " : "") + (item.fontVariant ? item.fontVariant + " " : "") + (item.fontWeight ? item.fontWeight + " " : "") + fontSize(item) + "px " + fontFamily(item, quote); + } + function offset$2(item) { + var baseline2 = item.baseline, h2 = fontSize(item); + return Math.round(baseline2 === "top" ? 0.79 * h2 : baseline2 === "middle" ? 0.3 * h2 : baseline2 === "bottom" ? -0.21 * h2 : baseline2 === "line-top" ? 0.29 * h2 + 0.5 * lineHeight(item) : baseline2 === "line-bottom" ? 0.29 * h2 - 0.5 * lineHeight(item) : 0); + } + const textAlign = { + "left": "start", + "center": "middle", + "right": "end" + }; + const tempBounds$1 = new Bounds(); + function anchorPoint(item) { + var x2 = item.x || 0, y2 = item.y || 0, r = item.radius || 0, t; + if (r) { + t = (item.theta || 0) - HalfPi; + x2 += r * Math.cos(t); + y2 += r * Math.sin(t); + } + tempBounds$1.x1 = x2; + tempBounds$1.y1 = y2; + return tempBounds$1; + } + function attr(emit2, item) { + var dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item), p = anchorPoint(item), x2 = p.x1, y2 = p.y1, a2 = item.angle || 0, t; + emit2("text-anchor", textAlign[item.align] || "start"); + if (a2) { + t = translate$2(x2, y2) + " " + rotate(a2); + if (dx || dy) t += " " + translate$2(dx, dy); + } else { + t = translate$2(x2 + dx, y2 + dy); + } + emit2("transform", t); + } + function bound(bounds2, item, mode) { + var h2 = textMetrics.height(item), a2 = item.align, p = anchorPoint(item), x2 = p.x1, y2 = p.y1, dx = item.dx || 0, dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h2), tl2 = textLines(item), w2; + if (isArray(tl2)) { + h2 += lineHeight(item) * (tl2.length - 1); + w2 = tl2.reduce((w3, t) => Math.max(w3, textMetrics.width(item, t)), 0); + } else { + w2 = textMetrics.width(item, tl2); + } + if (a2 === "center") { + dx -= w2 / 2; + } else if (a2 === "right") { + dx -= w2; + } else ; + bounds2.set(dx += x2, dy += y2, dx + w2, dy + h2); + if (item.angle && !mode) { + bounds2.rotate(item.angle * DegToRad, x2, y2); + } else if (mode === 2) { + return bounds2.rotatedPoints(item.angle * DegToRad, x2, y2); + } + return bounds2; + } + function draw$5(context2, scene, bounds2) { + visit(scene, (item) => { + var opacity = item.opacity == null ? 1 : item.opacity, p, x2, y2, i, lh, tl2, str; + if (bounds2 && !bounds2.intersects(item.bounds) || // bounds check + opacity === 0 || item.fontSize <= 0 || item.text == null || item.text.length === 0) return; + context2.font = font(item); + context2.textAlign = item.align || "left"; + p = anchorPoint(item); + x2 = p.x1, y2 = p.y1; + if (item.angle) { + context2.save(); + context2.translate(x2, y2); + context2.rotate(item.angle * DegToRad); + x2 = y2 = 0; + } + x2 += item.dx || 0; + y2 += (item.dy || 0) + offset$2(item); + tl2 = textLines(item); + blend(context2, item); + if (isArray(tl2)) { + lh = lineHeight(item); + for (i = 0; i < tl2.length; ++i) { + str = textValue(item, tl2[i]); + if (item.fill && fill(context2, item, opacity)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity)) { + context2.strokeText(str, x2, y2); + } + y2 += lh; + } + } else { + str = textValue(item, tl2); + if (item.fill && fill(context2, item, opacity)) { + context2.fillText(str, x2, y2); + } + if (item.stroke && stroke(context2, item, opacity)) { + context2.strokeText(str, x2, y2); + } + } + if (item.angle) context2.restore(); + }); + } + function hit(context2, item, x2, y2, gx, gy) { + if (item.fontSize <= 0) return false; + if (!item.angle) return true; + var p = anchorPoint(item), ax = p.x1, ay = p.y1, b2 = bound(tempBounds$1, item, 1), a2 = -item.angle * DegToRad, cos2 = Math.cos(a2), sin2 = Math.sin(a2), px2 = cos2 * gx - sin2 * gy + (ax - cos2 * ax + sin2 * ay), py2 = sin2 * gx + cos2 * gy + (ay - sin2 * ax - cos2 * ay); + return b2.contains(px2, py2); + } + function intersectText(item, box2) { + const p = bound(tempBounds$1, item, 2); + return intersectBoxLine(box2, p[0], p[1], p[2], p[3]) || intersectBoxLine(box2, p[0], p[1], p[4], p[5]) || intersectBoxLine(box2, p[4], p[5], p[6], p[7]) || intersectBoxLine(box2, p[2], p[3], p[6], p[7]); + } + var text = { + type: "text", + tag: "text", + nested: false, + attr, + bound, + draw: draw$5, + pick: pick$1(hit), + isect: intersectText + }; + var trail = markMultiItemPath("trail", trail$1, pickTrail); + var Marks = { + arc: arc$2, + area: area$2, + group: group$1, + image, + line: line$2, + path: path$2, + rect, + rule: rule$1, + shape, + symbol, + text, + trail + }; + function boundItem$1(item, func, opt) { + var type2 = Marks[item.mark.marktype], bound2 = func || type2.bound; + if (type2.nested) item = item.mark; + return bound2(item.bounds || (item.bounds = new Bounds()), item, opt); + } + var DUMMY = { + mark: null + }; + function boundMark(mark, bounds2, opt) { + var type2 = Marks[mark.marktype], bound2 = type2.bound, items = mark.items, hasItems = items && items.length, i, n, item, b2; + if (type2.nested) { + if (hasItems) { + item = items[0]; + } else { + DUMMY.mark = mark; + item = DUMMY; + } + b2 = boundItem$1(item, bound2, opt); + bounds2 = bounds2 && bounds2.union(b2) || b2; + return bounds2; + } + bounds2 = bounds2 || mark.bounds && mark.bounds.clear() || new Bounds(); + if (hasItems) { + for (i = 0, n = items.length; i < n; ++i) { + bounds2.union(boundItem$1(items[i], bound2, opt)); + } + } + return mark.bounds = bounds2; + } + const keys$1 = [ + "marktype", + "name", + "role", + "interactive", + "clip", + "items", + "zindex", + "x", + "y", + "width", + "height", + "align", + "baseline", + // layout + "fill", + "fillOpacity", + "opacity", + "blend", + // fill + "stroke", + "strokeOpacity", + "strokeWidth", + "strokeCap", + // stroke + "strokeDash", + "strokeDashOffset", + // stroke dash + "strokeForeground", + "strokeOffset", + // group + "startAngle", + "endAngle", + "innerRadius", + "outerRadius", + // arc + "cornerRadius", + "padAngle", + // arc, rect + "cornerRadiusTopLeft", + "cornerRadiusTopRight", + // rect, group + "cornerRadiusBottomLeft", + "cornerRadiusBottomRight", + "interpolate", + "tension", + "orient", + "defined", + // area, line + "url", + "aspect", + "smooth", + // image + "path", + "scaleX", + "scaleY", + // path + "x2", + "y2", + // rule + "size", + "shape", + // symbol + "text", + "angle", + "theta", + "radius", + "dir", + "dx", + "dy", + // text + "ellipsis", + "limit", + "lineBreak", + "lineHeight", + "font", + "fontSize", + "fontWeight", + "fontStyle", + "fontVariant", + // font + "description", + "aria", + "ariaRole", + "ariaRoleDescription" + // aria + ]; + function sceneToJSON(scene, indent) { + return JSON.stringify(scene, keys$1, indent); + } + function sceneFromJSON(json2) { + const scene = typeof json2 === "string" ? JSON.parse(json2) : json2; + return initialize$1(scene); + } + function initialize$1(scene) { + var type2 = scene.marktype, items = scene.items, parent, i, n; + if (items) { + for (i = 0, n = items.length; i < n; ++i) { + parent = type2 ? "mark" : "group"; + items[i][parent] = scene; + if (items[i].zindex) items[i][parent].zdirty = true; + if ("group" === (type2 || parent)) initialize$1(items[i]); + } + } + if (type2) boundMark(scene); + return scene; + } + class Scenegraph { + constructor(scene) { + if (arguments.length) { + this.root = sceneFromJSON(scene); + } else { + this.root = createMark({ + marktype: "group", + name: "root", + role: "frame" + }); + this.root.items = [new GroupItem(this.root)]; + } + } + toJSON(indent) { + return sceneToJSON(this.root, indent || 0); + } + mark(markdef, group2, index2) { + group2 = group2 || this.root.items[0]; + const mark = createMark(markdef, group2); + group2.items[index2] = mark; + if (mark.zindex) mark.group.zdirty = true; + return mark; + } + } + function createMark(def2, group2) { + const mark = { + bounds: new Bounds(), + clip: !!def2.clip, + group: group2, + interactive: def2.interactive === false ? false : true, + items: [], + marktype: def2.marktype, + name: def2.name || void 0, + role: def2.role || void 0, + zindex: def2.zindex || 0 + }; + if (def2.aria != null) { + mark.aria = def2.aria; + } + if (def2.description) { + mark.description = def2.description; + } + return mark; + } + function domCreate(doc, tag, ns) { + if (!doc && typeof document !== "undefined" && document.createElement) { + doc = document; + } + return doc ? ns ? doc.createElementNS(ns, tag) : doc.createElement(tag) : null; + } + function domFind(el, tag) { + tag = tag.toLowerCase(); + var nodes = el.childNodes, i = 0, n = nodes.length; + for (; i < n; ++i) if (nodes[i].tagName.toLowerCase() === tag) { + return nodes[i]; + } + } + function domChild(el, index2, tag, ns) { + var a2 = el.childNodes[index2], b2; + if (!a2 || a2.tagName.toLowerCase() !== tag.toLowerCase()) { + b2 = a2 || null; + a2 = domCreate(el.ownerDocument, tag, ns); + el.insertBefore(a2, b2); + } + return a2; + } + function domClear(el, index2) { + var nodes = el.childNodes, curr = nodes.length; + while (curr > index2) el.removeChild(nodes[--curr]); + return el; + } + function cssClass(mark) { + return "mark-" + mark.marktype + (mark.role ? " role-" + mark.role : "") + (mark.name ? " " + mark.name : ""); + } + function point(event2, el) { + const rect2 = el.getBoundingClientRect(); + return [event2.clientX - rect2.left - (el.clientLeft || 0), event2.clientY - rect2.top - (el.clientTop || 0)]; + } + function resolveItem(item, event2, el, origin) { + var mark = item && item.mark, mdef, p; + if (mark && (mdef = Marks[mark.marktype]).tip) { + p = point(event2, el); + p[0] -= origin[0]; + p[1] -= origin[1]; + while (item = item.mark.group) { + p[0] -= item.x || 0; + p[1] -= item.y || 0; + } + item = mdef.tip(mark.items, p); + } + return item; + } + class Handler { + /** + * Create a new Handler instance. + * @param {object} [customLoader] - Optional loader instance for + * href URL sanitization. If not specified, a standard loader + * instance will be generated. + * @param {function} [customTooltip] - Optional tooltip handler + * function for custom tooltip display. + * @constructor + */ + constructor(customLoader, customTooltip) { + this._active = null; + this._handlers = {}; + this._loader = customLoader || loader(); + this._tooltip = customTooltip || defaultTooltip$1; + } + /** + * Initialize a new Handler instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {object} [obj] - Optional context object that should serve as + * the "this" context for event callbacks. + * @return {Handler} - This handler instance. + */ + initialize(el, origin, obj) { + this._el = el; + this._obj = obj || null; + return this.origin(origin); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the origin coordinates of the visualization. + */ + origin(origin) { + if (arguments.length) { + this._origin = origin || [0, 0]; + return this; + } else { + return this._origin.slice(); + } + } + /** + * Get / set the scenegraph root. + */ + scene(scene) { + if (!arguments.length) return this._scene; + this._scene = scene; + return this; + } + /** + * Add an event handler. Subclasses should override this method. + */ + on() { + } + /** + * Remove an event handler. Subclasses should override this method. + */ + off() { + } + /** + * Utility method for finding the array index of an event handler. + * @param {Array} h - An array of registered event handlers. + * @param {string} type - The event type. + * @param {function} handler - The event handler instance to find. + * @return {number} - The handler's array index or -1 if not registered. + */ + _handlerIndex(h2, type2, handler) { + for (let i = h2 ? h2.length : 0; --i >= 0; ) { + if (h2[i].type === type2 && (!handler || h2[i].handler === handler)) { + return i; + } + } + return -1; + } + /** + * Returns an array with registered event handlers. + * @param {string} [type] - The event type to query. Any annotations + * are ignored; for example, for the argument "click.foo", ".foo" will + * be ignored and the method returns all "click" handlers. If type is + * null or unspecified, this method returns handlers for all types. + * @return {Array} - A new array containing all registered event handlers. + */ + handlers(type2) { + const h2 = this._handlers, a2 = []; + if (type2) { + a2.push(...h2[this.eventName(type2)]); + } else { + for (const k in h2) { + a2.push(...h2[k]); + } + } + return a2; + } + /** + * Parses an event name string to return the specific event type. + * For example, given "click.foo" returns "click" + * @param {string} name - The input event type string. + * @return {string} - A string with the event type only. + */ + eventName(name) { + const i = name.indexOf("."); + return i < 0 ? name : name.slice(0, i); + } + /** + * Handle hyperlink navigation in response to an item.href value. + * @param {Event} event - The event triggering hyperlink navigation. + * @param {Item} item - The scenegraph item. + * @param {string} href - The URL to navigate to. + */ + handleHref(event2, item, href2) { + this._loader.sanitize(href2, { + context: "href" + }).then((opt) => { + const e = new MouseEvent(event2.type, event2), a2 = domCreate(null, "a"); + for (const name in opt) a2.setAttribute(name, opt[name]); + a2.dispatchEvent(e); + }).catch(() => { + }); + } + /** + * Handle tooltip display in response to an item.tooltip value. + * @param {Event} event - The event triggering tooltip display. + * @param {Item} item - The scenegraph item. + * @param {boolean} show - A boolean flag indicating whether + * to show or hide a tooltip for the given item. + */ + handleTooltip(event2, item, show) { + if (item && item.tooltip != null) { + item = resolveItem(item, event2, this.canvas(), this._origin); + const value2 = show && item && item.tooltip || null; + this._tooltip.call(this._obj, this, event2, item, value2); + } + } + /** + * Returns the size of a scenegraph item and its position relative + * to the viewport. + * @param {Item} item - The scenegraph item. + * @return {object} - A bounding box object (compatible with the + * DOMRect type) consisting of x, y, width, heigh, top, left, + * right, and bottom properties. + */ + getItemBoundingClientRect(item) { + const el = this.canvas(); + if (!el) return; + const rect2 = el.getBoundingClientRect(), origin = this._origin, bounds2 = item.bounds, width2 = bounds2.width(), height2 = bounds2.height(); + let x2 = bounds2.x1 + origin[0] + rect2.left, y2 = bounds2.y1 + origin[1] + rect2.top; + while (item.mark && (item = item.mark.group)) { + x2 += item.x || 0; + y2 += item.y || 0; + } + return { + x: x2, + y: y2, + width: width2, + height: height2, + left: x2, + top: y2, + right: x2 + width2, + bottom: y2 + height2 + }; + } + } + function defaultTooltip$1(handler, event2, item, value2) { + handler.element().setAttribute("title", value2 || ""); + } + class Renderer { + /** + * Create a new Renderer instance. + * @param {object} [loader] - Optional loader instance for + * image and href URL sanitization. If not specified, a + * standard loader instance will be generated. + * @constructor + */ + constructor(loader2) { + this._el = null; + this._bgcolor = null; + this._loader = new ResourceLoader(loader2); + } + /** + * Initialize a new Renderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._el = el; + return this.resize(width2, height2, origin, scaleFactor); + } + /** + * Returns the parent container element for a visualization. + * @return {DOMElement} - The containing DOM element. + */ + element() { + return this._el; + } + /** + * Returns the scene element (e.g., canvas or SVG) of the visualization + * Subclasses must override if the first child is not the scene element. + * @return {DOMElement} - The scene (e.g., canvas or SVG) element. + */ + canvas() { + return this._el && this._el.firstChild; + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length === 0) return this._bgcolor; + this._bgcolor = bgcolor; + return this; + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {Renderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + this._width = width2; + this._height = height2; + this._origin = origin || [0, 0]; + this._scale = scaleFactor || 1; + return this; + } + /** + * Report a dirty item whose bounds should be redrawn. + * This base class method does nothing. Subclasses that perform + * incremental should implement this method. + * @param {Item} item - The dirty item whose bounds should be redrawn. + */ + dirty() { + } + /** + * Render an input scenegraph, potentially with a set of dirty items. + * This method will perform an immediate rendering with available resources. + * The renderer may also need to perform image loading to perform a complete + * render. This process can lead to asynchronous re-rendering of the scene + * after this method returns. To receive notification when rendering is + * complete, use the renderAsync method instead. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Renderer} - This renderer instance. + */ + render(scene, markTypes) { + const r = this; + r._call = function() { + r._render(scene, markTypes); + }; + r._call(); + r._call = null; + return r; + } + /** + * Internal rendering method. Renderer subclasses should override this + * method to actually perform rendering. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render() { + } + /** + * Asynchronous rendering method. Similar to render, but returns a Promise + * that resolves when all rendering is completed. Sometimes a renderer must + * perform image loading to get a complete rendering. The returned + * Promise will not resolve until this process completes. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + * @return {Promise} - A Promise that resolves when rendering is complete. + */ + renderAsync(scene, markTypes) { + const r = this.render(scene, markTypes); + return this._ready ? this._ready.then(() => r) : Promise.resolve(r); + } + /** + * Internal method for asynchronous resource loading. + * Proxies method calls to the ImageLoader, and tracks loading + * progress to invoke a re-render once complete. + * @param {string} method - The method name to invoke on the ImageLoader. + * @param {string} uri - The URI for the requested resource. + * @return {Promise} - A Promise that resolves to the requested resource. + */ + _load(method2, uri) { + var r = this, p = r._loader[method2](uri); + if (!r._ready) { + const call = r._call; + r._ready = r._loader.ready().then((redraw) => { + if (redraw) call(); + r._ready = null; + }); + } + return p; + } + /** + * Sanitize a URL to include as a hyperlink in the rendered scene. + * This method proxies a call to ImageLoader.sanitizeURL, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string to sanitize. + * @return {Promise} - A Promise that resolves to the sanitized URL. + */ + sanitizeURL(uri) { + return this._load("sanitizeURL", uri); + } + /** + * Requests an image to include in the rendered scene. + * This method proxies a call to ImageLoader.loadImage, but also tracks + * image loading progress and invokes a re-render once complete. + * @param {string} uri - The URI string of the image. + * @return {Promise} - A Promise that resolves to the loaded Image. + */ + loadImage(uri) { + return this._load("loadImage", uri); + } + } + const KeyDownEvent = "keydown"; + const KeyPressEvent = "keypress"; + const KeyUpEvent = "keyup"; + const DragEnterEvent = "dragenter"; + const DragLeaveEvent = "dragleave"; + const DragOverEvent = "dragover"; + const PointerDownEvent = "pointerdown"; + const PointerUpEvent = "pointerup"; + const PointerMoveEvent = "pointermove"; + const PointerOutEvent = "pointerout"; + const PointerOverEvent = "pointerover"; + const MouseDownEvent = "mousedown"; + const MouseUpEvent = "mouseup"; + const MouseMoveEvent = "mousemove"; + const MouseOutEvent = "mouseout"; + const MouseOverEvent = "mouseover"; + const ClickEvent = "click"; + const DoubleClickEvent = "dblclick"; + const WheelEvent = "wheel"; + const MouseWheelEvent = "mousewheel"; + const TouchStartEvent = "touchstart"; + const TouchMoveEvent = "touchmove"; + const TouchEndEvent = "touchend"; + const Events = [KeyDownEvent, KeyPressEvent, KeyUpEvent, DragEnterEvent, DragLeaveEvent, DragOverEvent, PointerDownEvent, PointerUpEvent, PointerMoveEvent, PointerOutEvent, PointerOverEvent, MouseDownEvent, MouseUpEvent, MouseMoveEvent, MouseOutEvent, MouseOverEvent, ClickEvent, DoubleClickEvent, WheelEvent, MouseWheelEvent, TouchStartEvent, TouchMoveEvent, TouchEndEvent]; + const TooltipShowEvent = PointerMoveEvent; + const TooltipHideEvent = MouseOutEvent; + const HrefEvent = ClickEvent; + class CanvasHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + this._down = null; + this._touch = null; + this._first = true; + this._events = {}; + this.events = Events; + this.pointermove = move([PointerMoveEvent, MouseMoveEvent], [PointerOverEvent, MouseOverEvent], [PointerOutEvent, MouseOutEvent]); + this.dragover = move([DragOverEvent], [DragEnterEvent], [DragLeaveEvent]), this.pointerout = inactive([PointerOutEvent, MouseOutEvent]); + this.dragleave = inactive([DragLeaveEvent]); + } + initialize(el, origin, obj) { + this._canvas = el && domFind(el, "canvas"); + [ClickEvent, MouseDownEvent, PointerDownEvent, PointerMoveEvent, PointerOutEvent, DragLeaveEvent].forEach((type2) => eventListenerCheck(this, type2)); + return super.initialize(el, origin, obj); + } + // return the backing canvas instance + canvas() { + return this._canvas; + } + // retrieve the current canvas context + context() { + return this._canvas.getContext("2d"); + } + // to keep old versions of firefox happy + DOMMouseScroll(evt) { + this.fire(MouseWheelEvent, evt); + } + pointerdown(evt) { + this._down = this._active; + this.fire(PointerDownEvent, evt); + } + mousedown(evt) { + this._down = this._active; + this.fire(MouseDownEvent, evt); + } + click(evt) { + if (this._down === this._active) { + this.fire(ClickEvent, evt); + this._down = null; + } + } + touchstart(evt) { + this._touch = this.pickEvent(evt.changedTouches[0]); + if (this._first) { + this._active = this._touch; + this._first = false; + } + this.fire(TouchStartEvent, evt, true); + } + touchmove(evt) { + this.fire(TouchMoveEvent, evt, true); + } + touchend(evt) { + this.fire(TouchEndEvent, evt, true); + this._touch = null; + } + // fire an event + fire(type2, evt, touch2) { + const a2 = touch2 ? this._touch : this._active, h2 = this._handlers[type2]; + evt.vegaType = type2; + if (type2 === HrefEvent && a2 && a2.href) { + this.handleHref(evt, a2, a2.href); + } else if (type2 === TooltipShowEvent || type2 === TooltipHideEvent) { + this.handleTooltip(evt, a2, type2 !== TooltipHideEvent); + } + if (h2) { + for (let i = 0, len2 = h2.length; i < len2; ++i) { + h2[i].handler.call(this._obj, evt, a2); + } + } + } + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + eventListenerCheck(this, type2); + (h2[name] || (h2[name] = [])).push({ + type: type2, + handler + }); + } + return this; + } + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + h2.splice(i, 1); + } + return this; + } + pickEvent(evt) { + const p = point(evt, this._canvas), o = this._origin; + return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]); + } + // find the scenegraph item at the current pointer position + // x, y -- the absolute x, y pointer coordinates on the canvas element + // gx, gy -- the relative coordinates within the current group + pick(scene, x2, y2, gx, gy) { + const g = this.context(), mark = Marks[scene.marktype]; + return mark.pick.call(this, g, scene, x2, y2, gx, gy); + } + } + const eventBundle = (type2) => type2 === TouchStartEvent || type2 === TouchMoveEvent || type2 === TouchEndEvent ? [TouchStartEvent, TouchMoveEvent, TouchEndEvent] : [type2]; + function eventListenerCheck(handler, type2) { + eventBundle(type2).forEach((_) => addEventListener(handler, _)); + } + function addEventListener(handler, type2) { + const canvas = handler.canvas(); + if (canvas && !handler._events[type2]) { + handler._events[type2] = 1; + canvas.addEventListener(type2, handler[type2] ? (evt) => handler[type2](evt) : (evt) => handler.fire(type2, evt)); + } + } + function fireAll(handler, types, event2) { + types.forEach((type2) => handler.fire(type2, event2)); + } + function move(moveEvents, overEvents, outEvents) { + return function(evt) { + const a2 = this._active, p = this.pickEvent(evt); + if (p === a2) { + fireAll(this, moveEvents, evt); + } else { + if (!a2 || !a2.exit) { + fireAll(this, outEvents, evt); + } + this._active = p; + fireAll(this, overEvents, evt); + fireAll(this, moveEvents, evt); + } + }; + } + function inactive(types) { + return function(evt) { + fireAll(this, types, evt); + this._active = null; + }; + } + function devicePixelRatio$1() { + return typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1; + } + function resize(canvas, width2, height2, origin, scaleFactor, opt) { + const inDOM = typeof HTMLElement !== "undefined" && canvas instanceof HTMLElement && canvas.parentNode != null, context2 = canvas.getContext("2d"), ratio = inDOM ? devicePixelRatio$1() : scaleFactor; + canvas.width = width2 * ratio; + canvas.height = height2 * ratio; + for (const key2 in opt) { + context2[key2] = opt[key2]; + } + if (inDOM && ratio !== 1) { + canvas.style.width = width2 + "px"; + canvas.style.height = height2 + "px"; + } + context2.pixelRatio = ratio; + context2.setTransform(ratio, 0, 0, ratio, ratio * origin[0], ratio * origin[1]); + return canvas; + } + class CanvasRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._options = {}; + this._redraw = false; + this._dirty = new Bounds(); + this._tempb = new Bounds(); + } + initialize(el, width2, height2, origin, scaleFactor, options) { + this._options = options || {}; + this._canvas = this._options.externalContext ? null : domCanvas(1, 1, this._options.type); + if (el && this._canvas) { + domClear(el, 0).appendChild(this._canvas); + this._canvas.setAttribute("class", "marks"); + } + return super.initialize(el, width2, height2, origin, scaleFactor); + } + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._canvas) { + resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context); + } else { + const ctx = this._options.externalContext; + if (!ctx) error("CanvasRenderer is missing a valid canvas or context"); + ctx.scale(this._scale, this._scale); + ctx.translate(this._origin[0], this._origin[1]); + } + this._redraw = true; + return this; + } + canvas() { + return this._canvas; + } + context() { + return this._options.externalContext || (this._canvas ? this._canvas.getContext("2d") : null); + } + dirty(item) { + const b2 = this._tempb.clear().union(item.bounds); + let g = item.mark.group; + while (g) { + b2.translate(g.x || 0, g.y || 0); + g = g.mark.group; + } + this._dirty.union(b2); + } + _render(scene, markTypes) { + const g = this.context(), o = this._origin, w2 = this._width, h2 = this._height, db = this._dirty, vb = viewBounds(o, w2, h2); + g.save(); + const b2 = this._redraw || db.empty() ? (this._redraw = false, vb.expand(1)) : clipToBounds(g, vb.intersect(db), o); + this.clear(-o[0], -o[1], w2, h2); + this.draw(g, scene, b2, markTypes); + g.restore(); + db.clear(); + return this; + } + draw(ctx, scene, bounds2, markTypes) { + if (scene.marktype !== "group" && markTypes != null && !markTypes.includes(scene.marktype)) { + return; + } + const mark = Marks[scene.marktype]; + if (scene.clip) clip$2(ctx, scene); + mark.draw.call(this, ctx, scene, bounds2, markTypes); + if (scene.clip) ctx.restore(); + } + clear(x2, y2, w2, h2) { + const opt = this._options, g = this.context(); + if (opt.type !== "pdf" && !opt.externalContext) { + g.clearRect(x2, y2, w2, h2); + } + if (this._bgcolor != null) { + g.fillStyle = this._bgcolor; + g.fillRect(x2, y2, w2, h2); + } + } + } + const viewBounds = (origin, width2, height2) => new Bounds().set(0, 0, width2, height2).translate(-origin[0], -origin[1]); + function clipToBounds(g, b2, origin) { + b2.expand(1).round(); + if (g.pixelRatio % 1) { + b2.scale(g.pixelRatio).round().scale(1 / g.pixelRatio); + } + b2.translate(-(origin[0] % 1), -(origin[1] % 1)); + g.beginPath(); + g.rect(b2.x1, b2.y1, b2.width(), b2.height()); + g.clip(); + return b2; + } + class SVGHandler extends Handler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + const h2 = this; + h2._hrefHandler = listener(h2, (evt, item) => { + if (item && item.href) h2.handleHref(evt, item, item.href); + }); + h2._tooltipHandler = listener(h2, (evt, item) => { + h2.handleTooltip(evt, item, evt.type !== TooltipHideEvent); + }); + } + initialize(el, origin, obj) { + let svg = this._svg; + if (svg) { + svg.removeEventListener(HrefEvent, this._hrefHandler); + svg.removeEventListener(TooltipShowEvent, this._tooltipHandler); + svg.removeEventListener(TooltipHideEvent, this._tooltipHandler); + } + this._svg = svg = el && domFind(el, "svg"); + if (svg) { + svg.addEventListener(HrefEvent, this._hrefHandler); + svg.addEventListener(TooltipShowEvent, this._tooltipHandler); + svg.addEventListener(TooltipHideEvent, this._tooltipHandler); + } + return super.initialize(el, origin, obj); + } + canvas() { + return this._svg; + } + // add an event handler + on(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers, i = this._handlerIndex(h2[name], type2, handler); + if (i < 0) { + const x2 = { + type: type2, + handler, + listener: listener(this, handler) + }; + (h2[name] || (h2[name] = [])).push(x2); + if (this._svg) { + this._svg.addEventListener(name, x2.listener); + } + } + return this; + } + // remove an event handler + off(type2, handler) { + const name = this.eventName(type2), h2 = this._handlers[name], i = this._handlerIndex(h2, type2, handler); + if (i >= 0) { + if (this._svg) { + this._svg.removeEventListener(name, h2[i].listener); + } + h2.splice(i, 1); + } + return this; + } + } + const listener = (context2, handler) => (evt) => { + let item = evt.target.__data__; + item = Array.isArray(item) ? item[0] : item; + evt.vegaType = evt.type; + handler.call(context2._obj, evt, item); + }; + const ARIA_HIDDEN = "aria-hidden"; + const ARIA_LABEL = "aria-label"; + const ARIA_ROLE = "role"; + const ARIA_ROLEDESCRIPTION = "aria-roledescription"; + const GRAPHICS_OBJECT = "graphics-object"; + const GRAPHICS_SYMBOL = "graphics-symbol"; + const bundle = (role, roledesc, label2) => ({ + [ARIA_ROLE]: role, + [ARIA_ROLEDESCRIPTION]: roledesc, + [ARIA_LABEL]: label2 || void 0 + }); + const AriaIgnore = toSet(["axis-domain", "axis-grid", "axis-label", "axis-tick", "axis-title", "legend-band", "legend-entry", "legend-gradient", "legend-label", "legend-title", "legend-symbol", "title"]); + const AriaGuides = { + "axis": { + desc: "axis", + caption: axisCaption + }, + "legend": { + desc: "legend", + caption: legendCaption + }, + "title-text": { + desc: "title", + caption: (item) => `Title text '${titleCaption(item)}'` + }, + "title-subtitle": { + desc: "subtitle", + caption: (item) => `Subtitle text '${titleCaption(item)}'` + } + }; + const AriaEncode = { + ariaRole: ARIA_ROLE, + ariaRoleDescription: ARIA_ROLEDESCRIPTION, + description: ARIA_LABEL + }; + function ariaItemAttributes(emit2, item) { + const hide = item.aria === false; + emit2(ARIA_HIDDEN, hide || void 0); + if (hide || item.description == null) { + for (const prop in AriaEncode) { + emit2(AriaEncode[prop], void 0); + } + } else { + const type2 = item.mark.marktype; + emit2(ARIA_LABEL, item.description); + emit2(ARIA_ROLE, item.ariaRole || (type2 === "group" ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL)); + emit2(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type2} mark`); + } + } + function ariaMarkAttributes(mark) { + return mark.aria === false ? { + [ARIA_HIDDEN]: true + } : AriaIgnore[mark.role] ? null : AriaGuides[mark.role] ? ariaGuide(mark, AriaGuides[mark.role]) : ariaMark(mark); + } + function ariaMark(mark) { + const type2 = mark.marktype; + const recurse2 = type2 === "group" || type2 === "text" || mark.items.some((_) => _.description != null && _.aria !== false); + return bundle(recurse2 ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type2} mark container`, mark.description); + } + function ariaGuide(mark, opt) { + try { + const item = mark.items[0], caption = opt.caption || (() => ""); + return bundle(opt.role || GRAPHICS_SYMBOL, opt.desc, item.description || caption(item)); + } catch (err) { + return null; + } + } + function titleCaption(item) { + return array$5(item.text).join(" "); + } + function axisCaption(item) { + const datum2 = item.datum, orient = item.orient, title = datum2.title ? extractTitle(item) : null, ctx = item.context, scale2 = ctx.scales[datum2.scale].value, locale2 = ctx.dataflow.locale(), type2 = scale2.type, xy = orient === "left" || orient === "right" ? "Y" : "X"; + return `${xy}-axis` + (title ? ` titled '${title}'` : "") + ` for a ${isDiscrete(type2) ? "discrete" : type2} scale with ${domainCaption(locale2, scale2, item)}`; + } + function legendCaption(item) { + const datum2 = item.datum, title = datum2.title ? extractTitle(item) : null, type2 = `${datum2.type || ""} legend`.trim(), scales2 = datum2.scales, props = Object.keys(scales2), ctx = item.context, scale2 = ctx.scales[scales2[props[0]]].value, locale2 = ctx.dataflow.locale(); + return capitalize(type2) + (title ? ` titled '${title}'` : "") + ` for ${channelCaption(props)} with ${domainCaption(locale2, scale2, item)}`; + } + function extractTitle(item) { + try { + return array$5(peek$1(item.items).items[0].text).join(" "); + } catch (err) { + return null; + } + } + function channelCaption(props) { + props = props.map((p) => p + (p === "fill" || p === "stroke" ? " color" : "")); + return props.length < 2 ? props[0] : props.slice(0, -1).join(", ") + " and " + peek$1(props); + } + function capitalize(s) { + return s.length ? s[0].toUpperCase() + s.slice(1) : s; + } + const innerText = (val) => (val + "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); + const attrText = (val) => innerText(val).replace(/"/g, """).replace(/\t/g, " ").replace(/\n/g, " ").replace(/\r/g, " "); + function markup() { + let buf = "", outer = "", inner = ""; + const stack = [], clear = () => outer = inner = "", push = (tag) => { + if (outer) { + buf += `${outer}>${inner}`; + clear(); + } + stack.push(tag); + }, attr2 = (name, value2) => { + if (value2 != null) outer += ` ${name}="${attrText(value2)}"`; + return m2; + }, m2 = { + open(tag, ...attrs) { + push(tag); + outer = "<" + tag; + for (const set2 of attrs) { + for (const key2 in set2) attr2(key2, set2[key2]); + } + return m2; + }, + close() { + const tag = stack.pop(); + if (outer) { + buf += outer + (inner ? `>${inner}</${tag}>` : "/>"); + } else { + buf += `</${tag}>`; + } + clear(); + return m2; + }, + attr: attr2, + text: (t) => (inner += innerText(t), m2), + toString: () => buf + }; + return m2; + } + const serializeXML = (node) => _serialize(markup(), node) + ""; + function _serialize(m2, node) { + m2.open(node.tagName); + if (node.hasAttributes()) { + const attrs = node.attributes, n = attrs.length; + for (let i = 0; i < n; ++i) { + m2.attr(attrs[i].name, attrs[i].value); + } + } + if (node.hasChildNodes()) { + const children2 = node.childNodes; + for (const child of children2) { + child.nodeType === 3 ? m2.text(child.nodeValue) : _serialize(m2, child); + } + } + return m2.close(); + } + const stylesAttr = { + fill: "fill", + fillOpacity: "fill-opacity", + stroke: "stroke", + strokeOpacity: "stroke-opacity", + strokeWidth: "stroke-width", + strokeCap: "stroke-linecap", + strokeJoin: "stroke-linejoin", + strokeDash: "stroke-dasharray", + strokeDashOffset: "stroke-dashoffset", + strokeMiterLimit: "stroke-miterlimit", + opacity: "opacity" + }; + const stylesCss = { + blend: "mix-blend-mode" + }; + const rootAttributes = { + "fill": "none", + "stroke-miterlimit": 10 + }; + const RootIndex = 0, xmlns = "http://www.w3.org/2000/xmlns/", svgns = metadata.xmlns; + class SVGRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._dirtyID = 0; + this._dirty = []; + this._svg = null; + this._root = null; + this._defs = null; + } + /** + * Initialize a new SVGRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._defs = {}; + this._clearDefs(); + if (el) { + this._svg = domChild(el, 0, "svg", svgns); + this._svg.setAttributeNS(xmlns, "xmlns", svgns); + this._svg.setAttributeNS(xmlns, "xmlns:xlink", metadata["xmlns:xlink"]); + this._svg.setAttribute("version", metadata["version"]); + this._svg.setAttribute("class", "marks"); + domClear(el, 1); + this._root = domChild(this._svg, RootIndex, "g", svgns); + setAttributes(this._root, rootAttributes); + domClear(this._svg, RootIndex + 1); + } + this.background(this._bgcolor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Get / set the background color. + */ + background(bgcolor) { + if (arguments.length && this._svg) { + this._svg.style.setProperty("background-color", bgcolor); + } + return super.background(...arguments); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + if (this._svg) { + setAttributes(this._svg, { + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` + }); + this._root.setAttribute("transform", `translate(${this._origin})`); + } + this._dirty = []; + return this; + } + /** + * Returns the SVG element of the visualization. + * @return {DOMElement} - The SVG element. + */ + canvas() { + return this._svg; + } + /** + * Returns an SVG text string for the rendered content, + * or null if this renderer is currently headless. + */ + svg() { + const svg = this._svg, bg = this._bgcolor; + if (!svg) return null; + let node; + if (bg) { + svg.removeAttribute("style"); + node = domChild(svg, RootIndex, "rect", svgns); + setAttributes(node, { + width: this._width, + height: this._height, + fill: bg + }); + } + const text2 = serializeXML(svg); + if (bg) { + svg.removeChild(node); + this._svg.style.setProperty("background-color", bg); + } + return text2; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + if (this._dirtyCheck()) { + if (this._dirtyAll) this._clearDefs(); + this.mark(this._root, scene, void 0, markTypes); + domClear(this._root, 1); + } + this.defs(); + this._dirty = []; + ++this._dirtyID; + return this; + } + // -- Manage rendering of items marked as dirty -- + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (item.dirty !== this._dirtyID) { + item.dirty = this._dirtyID; + this._dirty.push(item); + } + } + /** + * Check if a mark item is considered dirty. + * @param {Item} item - The mark item. + */ + isDirty(item) { + return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID; + } + /** + * Internal method to check dirty status and, if possible, + * make targetted updates without a full rendering pass. + */ + _dirtyCheck() { + this._dirtyAll = true; + const items = this._dirty; + if (!items.length || !this._dirtyID) return true; + const id2 = ++this._dirtyID; + let item, mark, type2, mdef, i, n, o; + for (i = 0, n = items.length; i < n; ++i) { + item = items[i]; + mark = item.mark; + if (mark.marktype !== type2) { + type2 = mark.marktype; + mdef = Marks[type2]; + } + if (mark.zdirty && mark.dirty !== id2) { + this._dirtyAll = false; + dirtyParents(item, id2); + mark.items.forEach((i2) => { + i2.dirty = id2; + }); + } + if (mark.zdirty) continue; + if (item.exit) { + if (mdef.nested && mark.items.length) { + o = mark.items[0]; + if (o._svg) this._update(mdef, o._svg, o); + } else if (item._svg) { + o = item._svg.parentNode; + if (o) o.removeChild(item._svg); + } + item._svg = null; + continue; + } + item = mdef.nested ? mark.items[0] : item; + if (item._update === id2) continue; + if (!item._svg || !item._svg.ownerSVGElement) { + this._dirtyAll = false; + dirtyParents(item, id2); + } else { + this._update(mdef, item._svg, item); + } + item._update = id2; + } + return !this._dirtyAll; + } + // -- Construct & maintain scenegraph to SVG mapping --- + /** + * Render a set of mark items. + * @param {SVGElement} el - The parent element in the SVG tree. + * @param {object} scene - The mark parent to render. + * @param {SVGElement} prev - The previous sibling in the SVG tree. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + mark(el, scene, prev, markTypes) { + if (!this.isDirty(scene)) { + return scene._svg; + } + const svg = this._svg, markType2 = scene.marktype, mdef = Marks[markType2], events2 = scene.interactive === false ? "none" : null, isGroup = mdef.tag === "g"; + const parent = bind$1(scene, el, prev, "g", svg); + if (markType2 !== "group" && markTypes != null && !markTypes.includes(markType2)) { + domClear(parent, 0); + return scene._svg; + } + parent.setAttribute("class", cssClass(scene)); + const aria = ariaMarkAttributes(scene); + for (const key2 in aria) setAttribute$1(parent, key2, aria[key2]); + if (!isGroup) { + setAttribute$1(parent, "pointer-events", events2); + } + setAttribute$1(parent, "clip-path", scene.clip ? clip$1$1(this, scene, scene.group) : null); + let sibling = null, i = 0; + const process = (item) => { + const dirty = this.isDirty(item), node = bind$1(item, parent, sibling, mdef.tag, svg); + if (dirty) { + this._update(mdef, node, item); + if (isGroup) recurse(this, node, item, markTypes); + } + sibling = node; + ++i; + }; + if (mdef.nested) { + if (scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + domClear(parent, i); + return parent; + } + /** + * Update the attributes of an SVG element for a mark item. + * @param {object} mdef - The mark definition object + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + _update(mdef, el, item) { + element$1 = el; + values = el.__values__; + ariaItemAttributes(emit, item); + mdef.attr(emit, item, this); + const extra = mark_extras[mdef.type]; + if (extra) extra.call(this, mdef, el, item); + if (element$1) this.style(element$1, item); + } + /** + * Update the presentation attributes of an SVG element for a mark item. + * @param {SVGElement} el - The SVG element. + * @param {Item} item - The mark item. + */ + style(el, item) { + if (item == null) return; + for (const prop in stylesAttr) { + let value2 = prop === "font" ? fontFamily(item) : item[prop]; + if (value2 === values[prop]) continue; + const name = stylesAttr[prop]; + if (value2 == null) { + el.removeAttribute(name); + } else { + if (isGradient(value2)) { + value2 = gradientRef(value2, this._defs.gradient, href()); + } + el.setAttribute(name, value2 + ""); + } + values[prop] = value2; + } + for (const prop in stylesCss) { + setStyle(el, stylesCss[prop], item[prop]); + } + } + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + */ + defs() { + const svg = this._svg, defs = this._defs; + let el = defs.el, index2 = 0; + for (const id2 in defs.gradient) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateGradient(el, defs.gradient[id2], index2); + } + for (const id2 in defs.clipping) { + if (!el) defs.el = el = domChild(svg, RootIndex + 1, "defs", svgns); + index2 = updateClipping(el, defs.clipping[id2], index2); + } + if (el) { + index2 === 0 ? (svg.removeChild(el), defs.el = null) : domClear(el, index2); + } + } + /** + * Clear defs caches. + */ + _clearDefs() { + const def2 = this._defs; + def2.gradient = {}; + def2.clipping = {}; + } + } + function dirtyParents(item, id2) { + for (; item && item.dirty !== id2; item = item.mark.group) { + item.dirty = id2; + if (item.mark && item.mark.dirty !== id2) { + item.mark.dirty = id2; + } else return; + } + } + function updateGradient(el, grad, index2) { + let i, n, stop2; + if (grad.gradient === "radial") { + let pt = domChild(el, index2++, "pattern", svgns); + setAttributes(pt, { + id: patternPrefix + grad.id, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + pt = domChild(pt, 0, "rect", svgns); + setAttributes(pt, { + width: 1, + height: 1, + fill: `url(${href()}#${grad.id})` + }); + el = domChild(el, index2++, "radialGradient", svgns); + setAttributes(el, { + id: grad.id, + fx: grad.x1, + fy: grad.y1, + fr: grad.r1, + cx: grad.x2, + cy: grad.y2, + r: grad.r2 + }); + } else { + el = domChild(el, index2++, "linearGradient", svgns); + setAttributes(el, { + id: grad.id, + x1: grad.x1, + x2: grad.x2, + y1: grad.y1, + y2: grad.y2 + }); + } + for (i = 0, n = grad.stops.length; i < n; ++i) { + stop2 = domChild(el, i, "stop", svgns); + stop2.setAttribute("offset", grad.stops[i].offset); + stop2.setAttribute("stop-color", grad.stops[i].color); + } + domClear(el, i); + return index2; + } + function updateClipping(el, clip2, index2) { + let mask; + el = domChild(el, index2, "clipPath", svgns); + el.setAttribute("id", clip2.id); + if (clip2.path) { + mask = domChild(el, 0, "path", svgns); + mask.setAttribute("d", clip2.path); + } else { + mask = domChild(el, 0, "rect", svgns); + setAttributes(mask, { + x: 0, + y: 0, + width: clip2.width, + height: clip2.height + }); + } + domClear(el, 1); + return index2 + 1; + } + function recurse(renderer, el, group2, markTypes) { + el = el.lastChild.previousSibling; + let prev, idx = 0; + visit(group2, (item) => { + prev = renderer.mark(el, item, prev, markTypes); + ++idx; + }); + domClear(el, 1 + idx); + } + function bind$1(item, el, sibling, tag, svg) { + let node = item._svg, doc; + if (!node) { + doc = el.ownerDocument; + node = domCreate(doc, tag, svgns); + item._svg = node; + if (item.mark) { + node.__data__ = item; + node.__values__ = { + fill: "default" + }; + if (tag === "g") { + const bg = domCreate(doc, "path", svgns); + node.appendChild(bg); + bg.__data__ = item; + const cg = domCreate(doc, "g", svgns); + node.appendChild(cg); + cg.__data__ = item; + const fg = domCreate(doc, "path", svgns); + node.appendChild(fg); + fg.__data__ = item; + fg.__values__ = { + fill: "default" + }; + } + } + } + if (node.ownerSVGElement !== svg || siblingCheck(node, sibling)) { + el.insertBefore(node, sibling ? sibling.nextSibling : el.firstChild); + } + return node; + } + function siblingCheck(node, sibling) { + return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; + } + let element$1 = null, values = null; + const mark_extras = { + group(mdef, el, item) { + const fg = element$1 = el.childNodes[2]; + values = fg.__values__; + mdef.foreground(emit, item, this); + values = el.__values__; + element$1 = el.childNodes[1]; + mdef.content(emit, item, this); + const bg = element$1 = el.childNodes[0]; + mdef.background(emit, item, this); + const value2 = item.mark.interactive === false ? "none" : null; + if (value2 !== values.events) { + setAttribute$1(fg, "pointer-events", value2); + setAttribute$1(bg, "pointer-events", value2); + values.events = value2; + } + if (item.strokeForeground && item.stroke) { + const fill2 = item.fill; + setAttribute$1(fg, "display", null); + this.style(bg, item); + setAttribute$1(bg, "stroke", null); + if (fill2) item.fill = null; + values = fg.__values__; + this.style(fg, item); + if (fill2) item.fill = fill2; + element$1 = null; + } else { + setAttribute$1(fg, "display", "none"); + } + }, + image(mdef, el, item) { + if (item.smooth === false) { + setStyle(el, "image-rendering", "optimizeSpeed"); + setStyle(el, "image-rendering", "pixelated"); + } else { + setStyle(el, "image-rendering", null); + } + }, + text(mdef, el, item) { + const tl2 = textLines(item); + let key2, value2, doc, lh; + if (isArray(tl2)) { + value2 = tl2.map((_) => textValue(item, _)); + key2 = value2.join("\n"); + if (key2 !== values.text) { + domClear(el, 0); + doc = el.ownerDocument; + lh = lineHeight(item); + value2.forEach((t, i) => { + const ts2 = domCreate(doc, "tspan", svgns); + ts2.__data__ = item; + ts2.textContent = t; + if (i) { + ts2.setAttribute("x", 0); + ts2.setAttribute("dy", lh); + } + el.appendChild(ts2); + }); + values.text = key2; + } + } else { + value2 = textValue(item, tl2); + if (value2 !== values.text) { + el.textContent = value2; + values.text = value2; + } + } + setAttribute$1(el, "font-family", fontFamily(item)); + setAttribute$1(el, "font-size", fontSize(item) + "px"); + setAttribute$1(el, "font-style", item.fontStyle); + setAttribute$1(el, "font-variant", item.fontVariant); + setAttribute$1(el, "font-weight", item.fontWeight); + } + }; + function emit(name, value2, ns) { + if (value2 === values[name]) return; + if (ns) { + setAttributeNS(element$1, name, value2, ns); + } else { + setAttribute$1(element$1, name, value2); + } + values[name] = value2; + } + function setStyle(el, name, value2) { + if (value2 !== values[name]) { + if (value2 == null) { + el.style.removeProperty(name); + } else { + el.style.setProperty(name, value2 + ""); + } + values[name] = value2; + } + } + function setAttributes(el, attrs) { + for (const key2 in attrs) { + setAttribute$1(el, key2, attrs[key2]); + } + } + function setAttribute$1(el, name, value2) { + if (value2 != null) { + el.setAttribute(name, value2); + } else { + el.removeAttribute(name); + } + } + function setAttributeNS(el, name, value2, ns) { + if (value2 != null) { + el.setAttributeNS(ns, name, value2); + } else { + el.removeAttributeNS(ns, name); + } + } + function href() { + let loc; + return typeof window === "undefined" ? "" : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length) : loc.href; + } + class SVGStringRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._text = null; + this._defs = { + gradient: {}, + clipping: {} + }; + } + /** + * Returns the rendered SVG text string, + * or null if rendering has not yet occurred. + */ + svg() { + return this._text; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + */ + _render(scene) { + const m2 = markup(); + m2.open("svg", extend$1({}, metadata, { + class: "marks", + width: this._width * this._scale, + height: this._height * this._scale, + viewBox: `0 0 ${this._width} ${this._height}` + })); + const bg = this._bgcolor; + if (bg && bg !== "transparent" && bg !== "none") { + m2.open("rect", { + width: this._width, + height: this._height, + fill: bg + }).close(); + } + m2.open("g", rootAttributes, { + transform: "translate(" + this._origin + ")" + }); + this.mark(m2, scene); + m2.close(); + this.defs(m2); + this._text = m2.close() + ""; + return this; + } + /** + * Render a set of mark items. + * @param {object} m - The markup context. + * @param {object} scene - The mark parent to render. + */ + mark(m2, scene) { + const mdef = Marks[scene.marktype], tag = mdef.tag, attrList = [ariaItemAttributes, mdef.attr]; + m2.open("g", { + "class": cssClass(scene), + "clip-path": scene.clip ? clip$1$1(this, scene, scene.group) : null + }, ariaMarkAttributes(scene), { + "pointer-events": tag !== "g" && scene.interactive === false ? "none" : null + }); + const process = (item) => { + const href2 = this.href(item); + if (href2) m2.open("a", href2); + m2.open(tag, this.attr(scene, item, attrList, tag !== "g" ? tag : null)); + if (tag === "text") { + const tl2 = textLines(item); + if (isArray(tl2)) { + const attrs = { + x: 0, + dy: lineHeight(item) + }; + for (let i = 0; i < tl2.length; ++i) { + m2.open("tspan", i ? attrs : null).text(textValue(item, tl2[i])).close(); + } + } else { + m2.text(textValue(item, tl2)); + } + } else if (tag === "g") { + const fore = item.strokeForeground, fill2 = item.fill, stroke2 = item.stroke; + if (fore && stroke2) { + item.stroke = null; + } + m2.open("path", this.attr(scene, item, mdef.background, "bgrect")).close(); + m2.open("g", this.attr(scene, item, mdef.content)); + visit(item, (scene2) => this.mark(m2, scene2)); + m2.close(); + if (fore && stroke2) { + if (fill2) item.fill = null; + item.stroke = stroke2; + m2.open("path", this.attr(scene, item, mdef.foreground, "bgrect")).close(); + if (fill2) item.fill = fill2; + } else { + m2.open("path", this.attr(scene, item, mdef.foreground, "bgfore")).close(); + } + } + m2.close(); + if (href2) m2.close(); + }; + if (mdef.nested) { + if (scene.items && scene.items.length) process(scene.items[0]); + } else { + visit(scene, process); + } + return m2.close(); + } + /** + * Get href attributes for a hyperlinked mark item. + * @param {Item} item - The mark item. + */ + href(item) { + const href2 = item.href; + let attr2; + if (href2) { + if (attr2 = this._hrefs && this._hrefs[href2]) { + return attr2; + } else { + this.sanitizeURL(href2).then((attr3) => { + attr3["xlink:href"] = attr3.href; + attr3.href = null; + (this._hrefs || (this._hrefs = {}))[href2] = attr3; + }); + } + } + return null; + } + /** + * Get an object of SVG attributes for a mark item. + * @param {object} scene - The mark parent. + * @param {Item} item - The mark item. + * @param {array|function} attrs - One or more attribute emitters. + * @param {string} tag - The tag being rendered. + */ + attr(scene, item, attrs, tag) { + const object2 = {}, emit2 = (name, value2, ns, prefixed) => { + object2[prefixed || name] = value2; + }; + if (Array.isArray(attrs)) { + attrs.forEach((fn) => fn(emit2, item, this)); + } else { + attrs(emit2, item, this); + } + if (tag) { + style(object2, item, scene, tag, this._defs); + } + return object2; + } + /** + * Render SVG defs, as needed. + * Must be called *after* marks have been processed to ensure the + * collected state is current and accurate. + * @param {object} m - The markup context. + */ + defs(m2) { + const gradient2 = this._defs.gradient, clipping = this._defs.clipping, count2 = Object.keys(gradient2).length + Object.keys(clipping).length; + if (count2 === 0) return; + m2.open("defs"); + for (const id2 in gradient2) { + const def2 = gradient2[id2], stops = def2.stops; + if (def2.gradient === "radial") { + m2.open("pattern", { + id: patternPrefix + id2, + viewBox: "0,0,1,1", + width: "100%", + height: "100%", + preserveAspectRatio: "xMidYMid slice" + }); + m2.open("rect", { + width: "1", + height: "1", + fill: "url(#" + id2 + ")" + }).close(); + m2.close(); + m2.open("radialGradient", { + id: id2, + fx: def2.x1, + fy: def2.y1, + fr: def2.r1, + cx: def2.x2, + cy: def2.y2, + r: def2.r2 + }); + } else { + m2.open("linearGradient", { + id: id2, + x1: def2.x1, + x2: def2.x2, + y1: def2.y1, + y2: def2.y2 + }); + } + for (let i = 0; i < stops.length; ++i) { + m2.open("stop", { + offset: stops[i].offset, + "stop-color": stops[i].color + }).close(); + } + m2.close(); + } + for (const id2 in clipping) { + const def2 = clipping[id2]; + m2.open("clipPath", { + id: id2 + }); + if (def2.path) { + m2.open("path", { + d: def2.path + }).close(); + } else { + m2.open("rect", { + x: 0, + y: 0, + width: def2.width, + height: def2.height + }).close(); + } + m2.close(); + } + m2.close(); + } + } + function style(s, item, scene, tag, defs) { + let styleList; + if (item == null) return s; + if (tag === "bgrect" && scene.interactive === false) { + s["pointer-events"] = "none"; + } + if (tag === "bgfore") { + if (scene.interactive === false) { + s["pointer-events"] = "none"; + } + s.display = "none"; + if (item.fill !== null) return s; + } + if (tag === "image" && item.smooth === false) { + styleList = ["image-rendering: optimizeSpeed;", "image-rendering: pixelated;"]; + } + if (tag === "text") { + s["font-family"] = fontFamily(item); + s["font-size"] = fontSize(item) + "px"; + s["font-style"] = item.fontStyle; + s["font-variant"] = item.fontVariant; + s["font-weight"] = item.fontWeight; + } + for (const prop in stylesAttr) { + let value2 = item[prop]; + const name = stylesAttr[prop]; + if (value2 === "transparent" && (name === "fill" || name === "stroke")) ; + else if (value2 != null) { + if (isGradient(value2)) { + value2 = gradientRef(value2, defs.gradient, ""); + } + s[name] = value2; + } + } + for (const prop in stylesCss) { + const value2 = item[prop]; + if (value2 != null) { + styleList = styleList || []; + styleList.push(`${stylesCss[prop]}: ${value2};`); + } + } + if (styleList) { + s.style = styleList.join(" "); + } + return s; + } + const OPTS = { + svgMarkTypes: ["text"], + svgOnTop: true, + debug: false + }; + function setHybridRendererOptions(options) { + OPTS["svgMarkTypes"] = options.svgMarkTypes ?? ["text"]; + OPTS["svgOnTop"] = options.svgOnTop ?? true; + OPTS["debug"] = options.debug ?? false; + } + class HybridRenderer extends Renderer { + constructor(loader2) { + super(loader2); + this._svgRenderer = new SVGRenderer(loader2); + this._canvasRenderer = new CanvasRenderer(loader2); + } + /** + * Initialize a new HybridRenderer instance. + * @param {DOMElement} el - The containing DOM element for the display. + * @param {number} width - The coordinate width of the display, in pixels. + * @param {number} height - The coordinate height of the display, in pixels. + * @param {Array<number>} origin - The origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {HybridRenderer} - This renderer instance. + */ + initialize(el, width2, height2, origin, scaleFactor) { + this._root_el = domChild(el, 0, "div"); + const bottomEl = domChild(this._root_el, 0, "div"); + const topEl = domChild(this._root_el, 1, "div"); + this._root_el.style.position = "relative"; + if (!OPTS.debug) { + bottomEl.style.height = "100%"; + topEl.style.position = "absolute"; + topEl.style.top = "0"; + topEl.style.left = "0"; + topEl.style.height = "100%"; + topEl.style.width = "100%"; + } + this._svgEl = OPTS.svgOnTop ? topEl : bottomEl; + this._canvasEl = OPTS.svgOnTop ? bottomEl : topEl; + this._svgEl.style.pointerEvents = "none"; + this._canvasRenderer.initialize(this._canvasEl, width2, height2, origin, scaleFactor); + this._svgRenderer.initialize(this._svgEl, width2, height2, origin, scaleFactor); + return super.initialize(el, width2, height2, origin, scaleFactor); + } + /** + * Flag a mark item as dirty. + * @param {Item} item - The mark item. + */ + dirty(item) { + if (OPTS.svgMarkTypes.includes(item.mark.marktype)) { + this._svgRenderer.dirty(item); + } else { + this._canvasRenderer.dirty(item); + } + return this; + } + /** + * Internal rendering method. + * @param {object} scene - The root mark of a scenegraph to render. + * @param {Array} markTypes - Array of the mark types to render. + * If undefined, render all mark types + */ + _render(scene, markTypes) { + const allMarkTypes = markTypes ?? ["arc", "area", "image", "line", "path", "rect", "rule", "shape", "symbol", "text", "trail"]; + const canvasMarkTypes = allMarkTypes.filter((m2) => !OPTS.svgMarkTypes.includes(m2)); + this._svgRenderer.render(scene, OPTS.svgMarkTypes); + this._canvasRenderer.render(scene, canvasMarkTypes); + } + /** + * Resize the display. + * @param {number} width - The new coordinate width of the display, in pixels. + * @param {number} height - The new coordinate height of the display, in pixels. + * @param {Array<number>} origin - The new origin of the display, in pixels. + * The coordinate system will be translated to this point. + * @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply + * the width and height to determine the final pixel size. + * @return {SVGRenderer} - This renderer instance; + */ + resize(width2, height2, origin, scaleFactor) { + super.resize(width2, height2, origin, scaleFactor); + this._svgRenderer.resize(width2, height2, origin, scaleFactor); + this._canvasRenderer.resize(width2, height2, origin, scaleFactor); + return this; + } + background(bgcolor) { + if (OPTS.svgOnTop) { + this._canvasRenderer.background(bgcolor); + } else { + this._svgRenderer.background(bgcolor); + } + return this; + } + } + class HybridHandler extends CanvasHandler { + constructor(loader2, tooltip) { + super(loader2, tooltip); + } + initialize(el, origin, obj) { + const canvas = domChild(domChild(el, 0, "div"), OPTS.svgOnTop ? 0 : 1, "div"); + return super.initialize(canvas, origin, obj); + } + } + const Canvas = "canvas"; + const Hybrid = "hybrid"; + const PNG = "png"; + const SVG = "svg"; + const None$1 = "none"; + const RenderType = { + Canvas, + PNG, + SVG, + Hybrid, + None: None$1 + }; + const modules = {}; + modules[Canvas] = modules[PNG] = { + renderer: CanvasRenderer, + headless: CanvasRenderer, + handler: CanvasHandler + }; + modules[SVG] = { + renderer: SVGRenderer, + headless: SVGStringRenderer, + handler: SVGHandler + }; + modules[Hybrid] = { + renderer: HybridRenderer, + headless: HybridRenderer, + handler: HybridHandler + }; + modules[None$1] = {}; + function renderModule(name, _) { + name = String(name || "").toLowerCase(); + if (arguments.length > 1) { + modules[name] = _; + return this; + } else { + return modules[name]; + } + } + function intersect$2(scene, bounds2, filter2) { + const hits = [], box2 = new Bounds().union(bounds2), type2 = scene.marktype; + return type2 ? intersectMark(scene, box2, filter2, hits) : type2 === "group" ? intersectGroup(scene, box2, filter2, hits) : error("Intersect scene must be mark node or group item."); + } + function intersectMark(mark, box2, filter2, hits) { + if (visitMark(mark, box2, filter2)) { + const items = mark.items, type2 = mark.marktype, n = items.length; + let i = 0; + if (type2 === "group") { + for (; i < n; ++i) { + intersectGroup(items[i], box2, filter2, hits); + } + } else { + for (const test2 = Marks[type2].isect; i < n; ++i) { + const item = items[i]; + if (intersectItem(item, box2, test2)) hits.push(item); + } + } + } + return hits; + } + function visitMark(mark, box2, filter2) { + return mark.bounds && box2.intersects(mark.bounds) && (mark.marktype === "group" || mark.interactive !== false && (!filter2 || filter2(mark))); + } + function intersectGroup(group2, box2, filter2, hits) { + if (filter2 && filter2(group2.mark) && intersectItem(group2, box2, Marks.group.isect)) { + hits.push(group2); + } + const marks = group2.items, n = marks && marks.length; + if (n) { + const x2 = group2.x || 0, y2 = group2.y || 0; + box2.translate(-x2, -y2); + for (let i = 0; i < n; ++i) { + intersectMark(marks[i], box2, filter2, hits); + } + box2.translate(x2, y2); + } + return hits; + } + function intersectItem(item, box2, test2) { + const bounds2 = item.bounds; + return box2.encloses(bounds2) || box2.intersects(bounds2) && test2(item, box2); + } + const clipBounds = new Bounds(); + function boundClip(mark) { + const clip2 = mark.clip; + if (isFunction(clip2)) { + clip2(boundContext(clipBounds.clear())); + } else if (clip2) { + clipBounds.set(0, 0, mark.group.width, mark.group.height); + } else return; + mark.bounds.intersect(clipBounds); + } + const TOLERANCE = 1e-9; + function sceneEqual(a2, b2, key2) { + return a2 === b2 ? true : key2 === "path" ? pathEqual(a2, b2) : a2 instanceof Date && b2 instanceof Date ? +a2 === +b2 : isNumber$1(a2) && isNumber$1(b2) ? Math.abs(a2 - b2) <= TOLERANCE : !a2 || !b2 || !isObject$1(a2) && !isObject$1(b2) ? a2 == b2 : objectEqual(a2, b2); + } + function pathEqual(a2, b2) { + return sceneEqual(parse$3(a2), parse$3(b2)); + } + function objectEqual(a2, b2) { + var ka = Object.keys(a2), kb = Object.keys(b2), key2, i; + if (ka.length !== kb.length) return false; + ka.sort(); + kb.sort(); + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) return false; + } + for (i = ka.length - 1; i >= 0; i--) { + key2 = ka[i]; + if (!sceneEqual(a2[key2], b2[key2], key2)) return false; + } + return typeof a2 === typeof b2; + } + function resetSVGDefIds() { + resetSVGClipId(); + resetSVGGradientId(); + } + const Top$1 = "top"; + const Left$1 = "left"; + const Right$1 = "right"; + const Bottom$1 = "bottom"; + const TopLeft = "top-left"; + const TopRight = "top-right"; + const BottomLeft = "bottom-left"; + const BottomRight = "bottom-right"; + const Start$1 = "start"; + const Middle$1 = "middle"; + const End$1 = "end"; + const X = "x"; + const Y = "y"; + const Group = "group"; + const AxisRole$1 = "axis"; + const TitleRole$1 = "title"; + const FrameRole$1 = "frame"; + const ScopeRole$1 = "scope"; + const LegendRole$1 = "legend"; + const RowHeader = "row-header"; + const RowFooter = "row-footer"; + const RowTitle = "row-title"; + const ColHeader = "column-header"; + const ColFooter = "column-footer"; + const ColTitle = "column-title"; + const Padding$1 = "padding"; + const Symbols$1 = "symbol"; + const Fit = "fit"; + const FitX = "fit-x"; + const FitY = "fit-y"; + const Pad = "pad"; + const None = "none"; + const All = "all"; + const Each = "each"; + const Flush = "flush"; + const Column = "column"; + const Row = "row"; + function Bound$1(params2) { + Transform.call(this, null, params2); + } + inherits(Bound$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow, mark = _.mark, type2 = mark.marktype, entry2 = Marks[type2], bound2 = entry2.bound; + let markBounds = mark.bounds, rebound; + if (entry2.nested) { + if (mark.items.length) view.dirty(mark.items[0]); + markBounds = boundItem(mark, bound2); + mark.items.forEach((item) => { + item.bounds.clear().union(markBounds); + }); + } else if (type2 === Group || _.modified()) { + pulse2.visit(pulse2.MOD, (item) => view.dirty(item)); + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(boundItem(item, bound2))); + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + pulse2.reflow(); + } + } else { + rebound = pulse2.changed(pulse2.REM); + pulse2.visit(pulse2.ADD, (item) => { + markBounds.union(boundItem(item, bound2)); + }); + pulse2.visit(pulse2.MOD, (item) => { + rebound = rebound || markBounds.alignsWith(item.bounds); + view.dirty(item); + markBounds.union(boundItem(item, bound2)); + }); + if (rebound) { + markBounds.clear(); + mark.items.forEach((item) => markBounds.union(item.bounds)); + } + } + boundClip(mark); + return pulse2.modifies("bounds"); + } + }); + function boundItem(item, bound2, opt) { + return bound2(item.bounds.clear(), item, opt); + } + const COUNTER_NAME = ":vega_identifier:"; + function Identifier$1(params2) { + Transform.call(this, 0, params2); + } + Identifier$1.Definition = { + "type": "Identifier", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "as", + "type": "string", + "required": true + }] + }; + inherits(Identifier$1, Transform, { + transform(_, pulse2) { + const counter = getCounter(pulse2.dataflow), as = _.as; + let id2 = counter.value; + pulse2.visit(pulse2.ADD, (t) => t[as] = t[as] || ++id2); + counter.set(this.value = id2); + return pulse2; + } + }); + function getCounter(view) { + return view._signals[COUNTER_NAME] || (view._signals[COUNTER_NAME] = view.add(0)); + } + function Mark$1(params2) { + Transform.call(this, null, params2); + } + inherits(Mark$1, Transform, { + transform(_, pulse2) { + let mark = this.value; + if (!mark) { + mark = pulse2.dataflow.scenegraph().mark(_.markdef, lookup$1$1(_), _.index); + mark.group.context = _.context; + if (!_.context.group) _.context.group = mark.group; + mark.source = this.source; + mark.clip = _.clip; + mark.interactive = _.interactive; + this.value = mark; + } + const Init = mark.marktype === Group ? GroupItem : Item; + pulse2.visit(pulse2.ADD, (item) => Init.call(item, mark)); + if (_.modified("clip") || _.modified("interactive")) { + mark.clip = _.clip; + mark.interactive = !!_.interactive; + mark.zdirty = true; + pulse2.reflow(); + } + mark.items = pulse2.source; + return pulse2; + } + }); + function lookup$1$1(_) { + const g = _.groups, p = _.parent; + return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null; + } + function Overlap$1(params2) { + Transform.call(this, null, params2); + } + const methods = { + parity: (items) => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1), + greedy: (items, sep) => { + let a2; + return items.filter((b2, i) => !i || !intersect$1(a2.bounds, b2.bounds, sep) ? (a2 = b2, 1) : b2.opacity = 0); + } + }; + const intersect$1 = (a2, b2, sep) => sep > Math.max(b2.x1 - a2.x2, a2.x1 - b2.x2, b2.y1 - a2.y2, a2.y1 - b2.y2); + const hasOverlap = (items, pad2) => { + for (var i = 1, n = items.length, a2 = items[0].bounds, b2; i < n; a2 = b2, ++i) { + if (intersect$1(a2, b2 = items[i].bounds, pad2)) return true; + } + }; + const hasBounds = (item) => { + const b2 = item.bounds; + return b2.width() > 1 && b2.height() > 1; + }; + const boundTest = (scale2, orient, tolerance) => { + var range2 = scale2.range(), b2 = new Bounds(); + if (orient === Top$1 || orient === Bottom$1) { + b2.set(range2[0], -Infinity, range2[1], Infinity); + } else { + b2.set(-Infinity, range2[0], Infinity, range2[1]); + } + b2.expand(tolerance || 1); + return (item) => b2.encloses(item.bounds); + }; + const reset = (source2) => { + source2.forEach((item) => item.opacity = 1); + return source2; + }; + const reflow = (pulse2, _) => pulse2.reflow(_.modified()).modifies("opacity"); + inherits(Overlap$1, Transform, { + transform(_, pulse2) { + const reduce = methods[_.method] || methods.parity, sep = _.separation || 0; + let source2 = pulse2.materialize(pulse2.SOURCE).source, items, test2; + if (!source2 || !source2.length) return; + if (!_.method) { + if (_.modified("method")) { + reset(source2); + pulse2 = reflow(pulse2, _); + } + return pulse2; + } + source2 = source2.filter(hasBounds); + if (!source2.length) return; + if (_.sort) { + source2 = source2.slice().sort(_.sort); + } + items = reset(source2); + pulse2 = reflow(pulse2, _); + if (items.length >= 3 && hasOverlap(items, sep)) { + do { + items = reduce(items, sep); + } while (items.length >= 3 && hasOverlap(items, sep)); + if (items.length < 3 && !peek$1(source2).opacity) { + if (items.length > 1) peek$1(items).opacity = 0; + peek$1(source2).opacity = 1; + } + } + if (_.boundScale && _.boundTolerance >= 0) { + test2 = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance); + source2.forEach((item) => { + if (!test2(item)) item.opacity = 0; + }); + } + const bounds2 = items[0].mark.bounds.clear(); + source2.forEach((item) => { + if (item.opacity) bounds2.union(item.bounds); + }); + return pulse2; + } + }); + function Render$1(params2) { + Transform.call(this, null, params2); + } + inherits(Render$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + pulse2.visit(pulse2.ALL, (item) => view.dirty(item)); + if (pulse2.fields && pulse2.fields["zindex"]) { + const item = pulse2.source && pulse2.source[0]; + if (item) item.mark.zdirty = true; + } + } + }); + const tempBounds = new Bounds(); + function set$6(item, property2, value2) { + return item[property2] === value2 ? 0 : (item[property2] = value2, 1); + } + function isYAxis(mark) { + var orient = mark.items[0].orient; + return orient === Left$1 || orient === Right$1; + } + function axisIndices(datum2) { + let index2 = +datum2.grid; + return [ + datum2.ticks ? index2++ : -1, + // ticks index + datum2.labels ? index2++ : -1, + // labels index + index2 + +datum2.domain + // title index + ]; + } + function axisLayout(view, axis, width2, height2) { + var item = axis.items[0], datum2 = item.datum, delta = item.translate != null ? item.translate : 0.5, orient = item.orient, indices = axisIndices(datum2), range2 = item.range, offset2 = item.offset, position2 = item.position, minExtent = item.minExtent, maxExtent = item.maxExtent, title = datum2.title && item.items[indices[2]].items[0], titlePadding = item.titlePadding, bounds2 = item.bounds, dl = title && multiLineOffset(title), x2 = 0, y2 = 0, i, s; + tempBounds.clear().union(bounds2); + bounds2.clear(); + if ((i = indices[0]) > -1) bounds2.union(item.items[i].bounds); + if ((i = indices[1]) > -1) bounds2.union(item.items[i].bounds); + switch (orient) { + case Top$1: + x2 = position2 || 0; + y2 = -offset2; + s = Math.max(minExtent, Math.min(maxExtent, -bounds2.y1)); + bounds2.add(0, -s).add(range2, 0); + if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds2); + break; + case Left$1: + x2 = -offset2; + y2 = position2 || 0; + s = Math.max(minExtent, Math.min(maxExtent, -bounds2.x1)); + bounds2.add(-s, 0).add(0, range2); + if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds2); + break; + case Right$1: + x2 = width2 + offset2; + y2 = position2 || 0; + s = Math.max(minExtent, Math.min(maxExtent, bounds2.x2)); + bounds2.add(0, 0).add(s, range2); + if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds2); + break; + case Bottom$1: + x2 = position2 || 0; + y2 = height2 + offset2; + s = Math.max(minExtent, Math.min(maxExtent, bounds2.y2)); + bounds2.add(0, 0).add(range2, s); + if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds2); + break; + default: + x2 = item.x; + y2 = item.y; + } + boundStroke(bounds2.translate(x2, y2), item); + if (set$6(item, "x", x2 + delta) | set$6(item, "y", y2 + delta)) { + item.bounds = tempBounds; + view.dirty(item); + item.bounds = bounds2; + view.dirty(item); + } + return item.mark.bounds.clear().union(bounds2); + } + function axisTitleLayout(view, title, offset2, pad2, dl, isYAxis2, sign2, bounds2) { + const b2 = title.bounds; + if (title.auto) { + const v = sign2 * (offset2 + dl + pad2); + let dx = 0, dy = 0; + view.dirty(title); + isYAxis2 ? dx = (title.x || 0) - (title.x = v) : dy = (title.y || 0) - (title.y = v); + title.mark.bounds.clear().union(b2.translate(-dx, -dy)); + view.dirty(title); + } + bounds2.union(b2); + } + const min$1 = (a2, b2) => Math.floor(Math.min(a2, b2)); + const max$1 = (a2, b2) => Math.ceil(Math.max(a2, b2)); + function gridLayoutGroups(group2) { + var groups = group2.items, n = groups.length, i = 0, mark, items; + const views = { + marks: [], + rowheaders: [], + rowfooters: [], + colheaders: [], + colfooters: [], + rowtitle: null, + coltitle: null + }; + for (; i < n; ++i) { + mark = groups[i]; + items = mark.items; + if (mark.marktype === Group) { + switch (mark.role) { + case AxisRole$1: + case LegendRole$1: + case TitleRole$1: + break; + case RowHeader: + views.rowheaders.push(...items); + break; + case RowFooter: + views.rowfooters.push(...items); + break; + case ColHeader: + views.colheaders.push(...items); + break; + case ColFooter: + views.colfooters.push(...items); + break; + case RowTitle: + views.rowtitle = items[0]; + break; + case ColTitle: + views.coltitle = items[0]; + break; + default: + views.marks.push(...items); + } + } + } + return views; + } + function bboxFlush(item) { + return new Bounds().set(0, 0, item.width || 0, item.height || 0); + } + function bboxFull(item) { + const b2 = item.bounds.clone(); + return b2.empty() ? b2.set(0, 0, 0, 0) : b2.translate(-(item.x || 0), -(item.y || 0)); + } + function get$1(opt, key2, d) { + const v = isObject$1(opt) ? opt[key2] : opt; + return v != null ? v : d !== void 0 ? d : 0; + } + function offsetValue$1(v) { + return v < 0 ? Math.ceil(-v) : 0; + } + function gridLayout(view, groups, opt) { + var dirty = !opt.nodirty, bbox = opt.bounds === Flush ? bboxFlush : bboxFull, bounds2 = tempBounds.set(0, 0, 0, 0), alignCol = get$1(opt.align, Column), alignRow = get$1(opt.align, Row), padCol = get$1(opt.padding, Column), padRow = get$1(opt.padding, Row), ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), n = groups.length, xOffset = Array(n), xExtent = Array(ncols), xMax = 0, yOffset = Array(n), yExtent = Array(nrows), yMax = 0, dx = Array(n), dy = Array(n), boxes = Array(n), m2, i, c2, r, b2, g, px2, py2, x2, y2, offset2; + for (i = 0; i < ncols; ++i) xExtent[i] = 0; + for (i = 0; i < nrows; ++i) yExtent[i] = 0; + for (i = 0; i < n; ++i) { + g = groups[i]; + b2 = boxes[i] = bbox(g); + g.x = g.x || 0; + dx[i] = 0; + g.y = g.y || 0; + dy[i] = 0; + c2 = i % ncols; + r = ~~(i / ncols); + xMax = Math.max(xMax, px2 = Math.ceil(b2.x2)); + yMax = Math.max(yMax, py2 = Math.ceil(b2.y2)); + xExtent[c2] = Math.max(xExtent[c2], px2); + yExtent[r] = Math.max(yExtent[r], py2); + xOffset[i] = padCol + offsetValue$1(b2.x1); + yOffset[i] = padRow + offsetValue$1(b2.y1); + if (dirty) view.dirty(groups[i]); + } + for (i = 0; i < n; ++i) { + if (i % ncols === 0) xOffset[i] = 0; + if (i < ncols) yOffset[i] = 0; + } + if (alignCol === Each) { + for (c2 = 1; c2 < ncols; ++c2) { + for (offset2 = 0, i = c2; i < n; i += ncols) { + if (offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = c2; i < n; i += ncols) { + xOffset[i] = offset2 + xExtent[c2 - 1]; + } + } + } else if (alignCol === All) { + for (offset2 = 0, i = 0; i < n; ++i) { + if (i % ncols && offset2 < xOffset[i]) offset2 = xOffset[i]; + } + for (i = 0; i < n; ++i) { + if (i % ncols) xOffset[i] = offset2 + xMax; + } + } else { + for (alignCol = false, c2 = 1; c2 < ncols; ++c2) { + for (i = c2; i < n; i += ncols) { + xOffset[i] += xExtent[c2 - 1]; + } + } + } + if (alignRow === Each) { + for (r = 1; r < nrows; ++r) { + for (offset2 = 0, i = r * ncols, m2 = i + ncols; i < m2; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; + } + for (i = r * ncols; i < m2; ++i) { + yOffset[i] = offset2 + yExtent[r - 1]; + } + } + } else if (alignRow === All) { + for (offset2 = 0, i = ncols; i < n; ++i) { + if (offset2 < yOffset[i]) offset2 = yOffset[i]; + } + for (i = ncols; i < n; ++i) { + yOffset[i] = offset2 + yMax; + } + } else { + for (alignRow = false, r = 1; r < nrows; ++r) { + for (i = r * ncols, m2 = i + ncols; i < m2; ++i) { + yOffset[i] += yExtent[r - 1]; + } + } + } + for (x2 = 0, i = 0; i < n; ++i) { + x2 = xOffset[i] + (i % ncols ? x2 : 0); + dx[i] += x2 - groups[i].x; + } + for (c2 = 0; c2 < ncols; ++c2) { + for (y2 = 0, i = c2; i < n; i += ncols) { + y2 += yOffset[i]; + dy[i] += y2 - groups[i].y; + } + } + if (alignCol && get$1(opt.center, Column) && nrows > 1) { + for (i = 0; i < n; ++i) { + b2 = alignCol === All ? xMax : xExtent[i % ncols]; + x2 = b2 - boxes[i].x2 - groups[i].x - dx[i]; + if (x2 > 0) dx[i] += x2 / 2; + } + } + if (alignRow && get$1(opt.center, Row) && ncols !== 1) { + for (i = 0; i < n; ++i) { + b2 = alignRow === All ? yMax : yExtent[~~(i / ncols)]; + y2 = b2 - boxes[i].y2 - groups[i].y - dy[i]; + if (y2 > 0) dy[i] += y2 / 2; + } + } + for (i = 0; i < n; ++i) { + bounds2.union(boxes[i].translate(dx[i], dy[i])); + } + x2 = get$1(opt.anchor, X); + y2 = get$1(opt.anchor, Y); + switch (get$1(opt.anchor, Column)) { + case End$1: + x2 -= bounds2.width(); + break; + case Middle$1: + x2 -= bounds2.width() / 2; + } + switch (get$1(opt.anchor, Row)) { + case End$1: + y2 -= bounds2.height(); + break; + case Middle$1: + y2 -= bounds2.height() / 2; + } + x2 = Math.round(x2); + y2 = Math.round(y2); + bounds2.clear(); + for (i = 0; i < n; ++i) { + groups[i].mark.bounds.clear(); + } + for (i = 0; i < n; ++i) { + g = groups[i]; + g.x += dx[i] += x2; + g.y += dy[i] += y2; + bounds2.union(g.mark.bounds.union(g.bounds.translate(dx[i], dy[i]))); + if (dirty) view.dirty(g); + } + return bounds2; + } + function trellisLayout(view, group2, opt) { + var views = gridLayoutGroups(group2), groups = views.marks, bbox = opt.bounds === Flush ? boundFlush : boundFull, off = opt.offset, ncols = opt.columns || groups.length, nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols), cells = nrows * ncols, x2, y2, x22, y22, anchor, band2, offset2; + const bounds2 = gridLayout(view, groups, opt); + if (bounds2.empty()) bounds2.set(0, 0, 0, 0); + if (views.rowheaders) { + band2 = get$1(opt.headerBand, Row, null); + x2 = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$1(off, "rowHeader"), min$1, 0, bbox, "x1", 0, ncols, 1, band2); + } + if (views.colheaders) { + band2 = get$1(opt.headerBand, Column, null); + y2 = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$1(off, "columnHeader"), min$1, 1, bbox, "y1", 0, 1, ncols, band2); + } + if (views.rowfooters) { + band2 = get$1(opt.footerBand, Row, null); + x22 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$1(off, "rowFooter"), max$1, 0, bbox, "x2", ncols - 1, ncols, 1, band2); + } + if (views.colfooters) { + band2 = get$1(opt.footerBand, Column, null); + y22 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$1(off, "columnFooter"), max$1, 1, bbox, "y2", cells - ncols, 1, ncols, band2); + } + if (views.rowtitle) { + anchor = get$1(opt.titleAnchor, Row); + offset2 = get$1(off, "rowTitle"); + offset2 = anchor === End$1 ? x22 + offset2 : x2 - offset2; + band2 = get$1(opt.titleBand, Row, 0.5); + layoutTitle(view, views.rowtitle, offset2, 0, bounds2, band2); + } + if (views.coltitle) { + anchor = get$1(opt.titleAnchor, Column); + offset2 = get$1(off, "columnTitle"); + offset2 = anchor === End$1 ? y22 + offset2 : y2 - offset2; + band2 = get$1(opt.titleBand, Column, 0.5); + layoutTitle(view, views.coltitle, offset2, 1, bounds2, band2); + } + } + function boundFlush(item, field2) { + return field2 === "x1" ? item.x || 0 : field2 === "y1" ? item.y || 0 : field2 === "x2" ? (item.x || 0) + (item.width || 0) : field2 === "y2" ? (item.y || 0) + (item.height || 0) : void 0; + } + function boundFull(item, field2) { + return item.bounds[field2]; + } + function layoutHeaders(view, headers, groups, ncols, limit, offset2, agg, isX2, bound2, bf, start, stride, back, band2) { + var n = groups.length, init2 = 0, edge = 0, i, j, k, m2, b2, h2, g, x2, y2; + if (!n) return init2; + for (i = start; i < n; i += stride) { + if (groups[i]) init2 = agg(init2, bound2(groups[i], bf)); + } + if (!headers.length) return init2; + if (headers.length > limit) { + view.warn("Grid headers exceed limit: " + limit); + headers = headers.slice(0, limit); + } + init2 += offset2; + for (j = 0, m2 = headers.length; j < m2; ++j) { + view.dirty(headers[j]); + headers[j].mark.bounds.clear(); + } + for (i = start, j = 0, m2 = headers.length; j < m2; ++j, i += stride) { + h2 = headers[j]; + b2 = h2.mark.bounds; + for (k = i; k >= 0 && (g = groups[k]) == null; k -= back) ; + if (isX2) { + x2 = band2 == null ? g.x : Math.round(g.bounds.x1 + band2 * g.bounds.width()); + y2 = init2; + } else { + x2 = init2; + y2 = band2 == null ? g.y : Math.round(g.bounds.y1 + band2 * g.bounds.height()); + } + b2.union(h2.bounds.translate(x2 - (h2.x || 0), y2 - (h2.y || 0))); + h2.x = x2; + h2.y = y2; + view.dirty(h2); + edge = agg(edge, b2[bf]); + } + return edge; + } + function layoutTitle(view, g, offset2, isX2, bounds2, band2) { + if (!g) return; + view.dirty(g); + var x2 = offset2, y2 = offset2; + isX2 ? x2 = Math.round(bounds2.x1 + band2 * bounds2.width()) : y2 = Math.round(bounds2.y1 + band2 * bounds2.height()); + g.bounds.translate(x2 - (g.x || 0), y2 - (g.y || 0)); + g.mark.bounds.clear().union(g.bounds); + g.x = x2; + g.y = y2; + view.dirty(g); + } + function lookup$3(config, orient) { + const opt = config[orient] || {}; + return (key2, d) => opt[key2] != null ? opt[key2] : config[key2] != null ? config[key2] : d; + } + function offsets(legends, value2) { + let max2 = -Infinity; + legends.forEach((item) => { + if (item.offset != null) max2 = Math.max(max2, item.offset); + }); + return max2 > -Infinity ? max2 : value2; + } + function legendParams(g, orient, config, xb, yb, w2, h2) { + const _ = lookup$3(config, orient), offset2 = offsets(g, _("offset", 0)), anchor = _("anchor", Start$1), mult2 = anchor === End$1 ? 1 : anchor === Middle$1 ? 0.5 : 0; + const p = { + align: Each, + bounds: _("bounds", Flush), + columns: _("direction") === "vertical" ? 1 : g.length, + padding: _("margin", 8), + center: _("center"), + nodirty: true + }; + switch (orient) { + case Left$1: + p.anchor = { + x: Math.floor(xb.x1) - offset2, + column: End$1, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor + }; + break; + case Right$1: + p.anchor = { + x: Math.ceil(xb.x2) + offset2, + y: mult2 * (h2 || xb.height() + 2 * xb.y1), + row: anchor + }; + break; + case Top$1: + p.anchor = { + y: Math.floor(yb.y1) - offset2, + row: End$1, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case Bottom$1: + p.anchor = { + y: Math.ceil(yb.y2) + offset2, + x: mult2 * (w2 || yb.width() + 2 * yb.x1), + column: anchor + }; + break; + case TopLeft: + p.anchor = { + x: offset2, + y: offset2 + }; + break; + case TopRight: + p.anchor = { + x: w2 - offset2, + y: offset2, + column: End$1 + }; + break; + case BottomLeft: + p.anchor = { + x: offset2, + y: h2 - offset2, + row: End$1 + }; + break; + case BottomRight: + p.anchor = { + x: w2 - offset2, + y: h2 - offset2, + column: End$1, + row: End$1 + }; + break; + } + return p; + } + function legendLayout(view, legend) { + var item = legend.items[0], datum2 = item.datum, orient = item.orient, bounds2 = item.bounds, x2 = item.x, y2 = item.y, w2, h2; + item._bounds ? item._bounds.clear().union(bounds2) : item._bounds = bounds2.clone(); + bounds2.clear(); + legendGroupLayout(view, item, item.items[0].items[0]); + bounds2 = legendBounds(item, bounds2); + w2 = 2 * item.padding; + h2 = 2 * item.padding; + if (!bounds2.empty()) { + w2 = Math.ceil(bounds2.width() + w2); + h2 = Math.ceil(bounds2.height() + h2); + } + if (datum2.type === Symbols$1) { + legendEntryLayout(item.items[0].items[0].items[0].items); + } + if (orient !== None) { + item.x = x2 = 0; + item.y = y2 = 0; + } + item.width = w2; + item.height = h2; + boundStroke(bounds2.set(x2, y2, x2 + w2, y2 + h2), item); + item.mark.bounds.clear().union(bounds2); + return item; + } + function legendBounds(item, b2) { + item.items.forEach((_) => b2.union(_.bounds)); + b2.x1 = item.padding; + b2.y1 = item.padding; + return b2; + } + function legendGroupLayout(view, item, entry2) { + var pad2 = item.padding, ex = pad2 - entry2.x, ey = pad2 - entry2.y; + if (!item.datum.title) { + if (ex || ey) translate$1(view, entry2, ex, ey); + } else { + var title = item.items[1].items[0], anchor = title.anchor, tpad = item.titlePadding || 0, tx2 = pad2 - title.x, ty2 = pad2 - title.y; + switch (title.orient) { + case Left$1: + ex += Math.ceil(title.bounds.width()) + tpad; + break; + case Right$1: + case Bottom$1: + break; + default: + ey += title.bounds.height() + tpad; + } + if (ex || ey) translate$1(view, entry2, ex, ey); + switch (title.orient) { + case Left$1: + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Right$1: + tx2 += legendTitleOffset(item, entry2, title, End$1, 0, 0) + tpad; + ty2 += legendTitleOffset(item, entry2, title, anchor, 1, 1); + break; + case Bottom$1: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + ty2 += legendTitleOffset(item, entry2, title, End$1, -1, 0, 1) + tpad; + break; + default: + tx2 += legendTitleOffset(item, entry2, title, anchor, 0, 0); + } + if (tx2 || ty2) translate$1(view, title, tx2, ty2); + if ((tx2 = Math.round(title.bounds.x1 - pad2)) < 0) { + translate$1(view, entry2, -tx2, 0); + translate$1(view, title, -tx2, 0); + } + } + } + function legendTitleOffset(item, entry2, title, anchor, y2, lr, noBar) { + const grad = item.datum.type !== "symbol", vgrad = title.datum.vgrad, e = grad && (lr || !vgrad) && !noBar ? entry2.items[0] : entry2, s = e.bounds[y2 ? "y2" : "x2"] - item.padding, u2 = vgrad && lr ? s : 0, v = vgrad && lr ? 0 : s, o = y2 <= 0 ? 0 : multiLineOffset(title); + return Math.round(anchor === Start$1 ? u2 : anchor === End$1 ? v - o : 0.5 * (s - o)); + } + function translate$1(view, item, dx, dy) { + item.x += dx; + item.y += dy; + item.bounds.translate(dx, dy); + item.mark.bounds.translate(dx, dy); + view.dirty(item); + } + function legendEntryLayout(entries) { + const widths = entries.reduce((w2, g) => { + w2[g.column] = Math.max(g.bounds.x2 - g.x, w2[g.column] || 0); + return w2; + }, {}); + entries.forEach((g) => { + g.width = widths[g.column]; + g.height = g.bounds.y2 - g.y; + }); + } + function titleLayout(view, mark, width2, height2, viewBounds2) { + var group2 = mark.items[0], frame2 = group2.frame, orient = group2.orient, anchor = group2.anchor, offset2 = group2.offset, padding2 = group2.padding, title = group2.items[0].items[0], subtitle = group2.items[1] && group2.items[1].items[0], end = orient === Left$1 || orient === Right$1 ? height2 : width2, start = 0, x2 = 0, y2 = 0, sx = 0, sy = 0, pos; + if (frame2 !== Group) { + orient === Left$1 ? (start = viewBounds2.y2, end = viewBounds2.y1) : orient === Right$1 ? (start = viewBounds2.y1, end = viewBounds2.y2) : (start = viewBounds2.x1, end = viewBounds2.x2); + } else if (orient === Left$1) { + start = height2, end = 0; + } + pos = anchor === Start$1 ? start : anchor === End$1 ? end : (start + end) / 2; + if (subtitle && subtitle.text) { + switch (orient) { + case Top$1: + case Bottom$1: + sy = title.bounds.height() + padding2; + break; + case Left$1: + sx = title.bounds.width() + padding2; + break; + case Right$1: + sx = -title.bounds.width() - padding2; + break; + } + tempBounds.clear().union(subtitle.bounds); + tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0)); + if (set$6(subtitle, "x", sx) | set$6(subtitle, "y", sy)) { + view.dirty(subtitle); + subtitle.bounds.clear().union(tempBounds); + subtitle.mark.bounds.clear().union(tempBounds); + view.dirty(subtitle); + } + tempBounds.clear().union(subtitle.bounds); + } else { + tempBounds.clear(); + } + tempBounds.union(title.bounds); + switch (orient) { + case Top$1: + x2 = pos; + y2 = viewBounds2.y1 - tempBounds.height() - offset2; + break; + case Left$1: + x2 = viewBounds2.x1 - tempBounds.width() - offset2; + y2 = pos; + break; + case Right$1: + x2 = viewBounds2.x2 + tempBounds.width() + offset2; + y2 = pos; + break; + case Bottom$1: + x2 = pos; + y2 = viewBounds2.y2 + offset2; + break; + default: + x2 = group2.x; + y2 = group2.y; + } + if (set$6(group2, "x", x2) | set$6(group2, "y", y2)) { + tempBounds.translate(x2, y2); + view.dirty(group2); + group2.bounds.clear().union(tempBounds); + mark.bounds.clear().union(tempBounds); + view.dirty(group2); + } + return group2.bounds; + } + function ViewLayout$1(params2) { + Transform.call(this, null, params2); + } + inherits(ViewLayout$1, Transform, { + transform(_, pulse2) { + const view = pulse2.dataflow; + _.mark.items.forEach((group2) => { + if (_.layout) trellisLayout(view, group2, _.layout); + layoutGroup(view, group2, _); + }); + return shouldReflow(_.mark.group) ? pulse2.reflow() : pulse2; + } + }); + function shouldReflow(group2) { + return group2 && group2.mark.role !== "legend-entry"; + } + function layoutGroup(view, group2, _) { + var items = group2.items, width2 = Math.max(0, group2.width || 0), height2 = Math.max(0, group2.height || 0), viewBounds2 = new Bounds().set(0, 0, width2, height2), xBounds = viewBounds2.clone(), yBounds = viewBounds2.clone(), legends = [], title, mark, orient, b2, i, n; + for (i = 0, n = items.length; i < n; ++i) { + mark = items[i]; + switch (mark.role) { + case AxisRole$1: + b2 = isYAxis(mark) ? xBounds : yBounds; + b2.union(axisLayout(view, mark, width2, height2)); + break; + case TitleRole$1: + title = mark; + break; + case LegendRole$1: + legends.push(legendLayout(view, mark)); + break; + case FrameRole$1: + case ScopeRole$1: + case RowHeader: + case RowFooter: + case RowTitle: + case ColHeader: + case ColFooter: + case ColTitle: + xBounds.union(mark.bounds); + yBounds.union(mark.bounds); + break; + default: + viewBounds2.union(mark.bounds); + } + } + if (legends.length) { + const l = {}; + legends.forEach((item) => { + orient = item.orient || Right$1; + if (orient !== None) (l[orient] || (l[orient] = [])).push(item); + }); + for (const orient2 in l) { + const g = l[orient2]; + gridLayout(view, g, legendParams(g, orient2, _.legends, xBounds, yBounds, width2, height2)); + } + legends.forEach((item) => { + const b3 = item.bounds; + if (!b3.equals(item._bounds)) { + item.bounds = item._bounds; + view.dirty(item); + item.bounds = b3; + view.dirty(item); + } + if (_.autosize && (_.autosize.type === Fit || _.autosize.type === FitX || _.autosize.type === FitY)) { + switch (item.orient) { + case Left$1: + case Right$1: + viewBounds2.add(b3.x1, 0).add(b3.x2, 0); + break; + case Top$1: + case Bottom$1: + viewBounds2.add(0, b3.y1).add(0, b3.y2); + } + } else { + viewBounds2.union(b3); + } + }); + } + viewBounds2.union(xBounds).union(yBounds); + if (title) { + viewBounds2.union(titleLayout(view, title, width2, height2, viewBounds2)); + } + if (group2.clip) { + viewBounds2.set(0, 0, group2.width || 0, group2.height || 0); + } + viewSizeLayout(view, group2, viewBounds2, _); + } + function viewSizeLayout(view, group2, viewBounds2, _) { + const auto = _.autosize || {}, type2 = auto.type; + if (view._autosize < 1 || !type2) return; + let viewWidth2 = view._width, viewHeight2 = view._height, width2 = Math.max(0, group2.width || 0), left = Math.max(0, Math.ceil(-viewBounds2.x1)), height2 = Math.max(0, group2.height || 0), top = Math.max(0, Math.ceil(-viewBounds2.y1)); + const right = Math.max(0, Math.ceil(viewBounds2.x2 - width2)), bottom = Math.max(0, Math.ceil(viewBounds2.y2 - height2)); + if (auto.contains === Padding$1) { + const padding2 = view.padding(); + viewWidth2 -= padding2.left + padding2.right; + viewHeight2 -= padding2.top + padding2.bottom; + } + if (type2 === None) { + left = 0; + top = 0; + width2 = viewWidth2; + height2 = viewHeight2; + } else if (type2 === Fit) { + width2 = Math.max(0, viewWidth2 - left - right); + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === FitX) { + width2 = Math.max(0, viewWidth2 - left - right); + viewHeight2 = height2 + top + bottom; + } else if (type2 === FitY) { + viewWidth2 = width2 + left + right; + height2 = Math.max(0, viewHeight2 - top - bottom); + } else if (type2 === Pad) { + viewWidth2 = width2 + left + right; + viewHeight2 = height2 + top + bottom; + } + view._resizeView(viewWidth2, viewHeight2, width2, height2, [left, top], auto.resize); + } + const vtx = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + bound: Bound$1, + identifier: Identifier$1, + mark: Mark$1, + overlap: Overlap$1, + render: Render$1, + viewlayout: ViewLayout$1 + }, Symbol.toStringTag, { value: "Module" })); + function AxisTicks$1(params2) { + Transform.call(this, null, params2); + } + inherits(AxisTicks$1, Transform, { + transform(_, pulse2) { + if (this.value && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), ticks2 = this.value, scale2 = _.scale, tally = _.count == null ? _.values ? _.values.length : 10 : _.count, count2 = tickCount(scale2, tally, _.minstep), format2 = _.format || tickFormat(locale2, scale2, count2, _.formatSpecifier, _.formatType, !!_.values), values2 = _.values ? validTicks(scale2, _.values, count2) : tickValues(scale2, count2); + if (ticks2) out.rem = ticks2; + ticks2 = values2.map((value2, i) => ingest$1({ + index: i / (values2.length - 1 || 1), + value: value2, + label: format2(value2) + })); + if (_.extra && ticks2.length) { + ticks2.push(ingest$1({ + index: -1, + extra: { + value: ticks2[0].value + }, + label: "" + })); + } + out.source = ticks2; + out.add = ticks2; + this.value = ticks2; + return out; + } + }); + function DataJoin$1(params2) { + Transform.call(this, null, params2); + } + function defaultItemCreate() { + return ingest$1({}); + } + function newMap(key2) { + const map2 = fastmap().test((t) => t.exit); + map2.lookup = (t) => map2.get(key2(t)); + return map2; + } + inherits(DataJoin$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), item = _.item || defaultItemCreate, key2 = _.key || tupleid, map2 = this.value; + if (isArray(out.encode)) { + out.encode = null; + } + if (map2 && (_.modified("key") || pulse2.modified(key2))) { + error("DataJoin does not support modified key function or fields."); + } + if (!map2) { + pulse2 = pulse2.addAll(); + this.value = map2 = newMap(key2); + } + pulse2.visit(pulse2.ADD, (t) => { + const k = key2(t); + let x2 = map2.get(k); + if (x2) { + if (x2.exit) { + map2.empty--; + out.add.push(x2); + } else { + out.mod.push(x2); + } + } else { + x2 = item(t); + map2.set(k, x2); + out.add.push(x2); + } + x2.datum = t; + x2.exit = false; + }); + pulse2.visit(pulse2.MOD, (t) => { + const k = key2(t), x2 = map2.get(k); + if (x2) { + x2.datum = t; + out.mod.push(x2); + } + }); + pulse2.visit(pulse2.REM, (t) => { + const k = key2(t), x2 = map2.get(k); + if (t === x2.datum && !x2.exit) { + out.rem.push(x2); + x2.exit = true; + ++map2.empty; + } + }); + if (pulse2.changed(pulse2.ADD_MOD)) out.modifies("datum"); + if (pulse2.clean() || _.clean && map2.empty > df.cleanThreshold) { + df.runAfter(map2.clean); + } + return out; + } + }); + function Encode$1(params2) { + Transform.call(this, null, params2); + } + inherits(Encode$1, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ADD_REM), fmod = _.mod || false, encoders = _.encoders, encode2 = pulse2.encode; + if (isArray(encode2)) { + if (out.changed() || encode2.every((e) => encoders[e])) { + encode2 = encode2[0]; + out.encode = null; + } else { + return pulse2.StopPropagation; + } + } + var reenter = encode2 === "enter", update2 = encoders.update || falsy, enter = encoders.enter || falsy, exit = encoders.exit || falsy, set2 = (encode2 && !reenter ? encoders[encode2] : update2) || falsy; + if (pulse2.changed(pulse2.ADD)) { + pulse2.visit(pulse2.ADD, (t) => { + enter(t, _); + update2(t, _); + }); + out.modifies(enter.output); + out.modifies(update2.output); + if (set2 !== falsy && set2 !== update2) { + pulse2.visit(pulse2.ADD, (t) => { + set2(t, _); + }); + out.modifies(set2.output); + } + } + if (pulse2.changed(pulse2.REM) && exit !== falsy) { + pulse2.visit(pulse2.REM, (t) => { + exit(t, _); + }); + out.modifies(exit.output); + } + if (reenter || set2 !== falsy) { + const flag2 = pulse2.MOD | (_.modified() ? pulse2.REFLOW : 0); + if (reenter) { + pulse2.visit(flag2, (t) => { + const mod = enter(t, _) || fmod; + if (set2(t, _) || mod) out.mod.push(t); + }); + if (out.mod.length) out.modifies(enter.output); + } else { + pulse2.visit(flag2, (t) => { + if (set2(t, _) || fmod) out.mod.push(t); + }); + } + if (out.mod.length) out.modifies(set2.output); + } + return out.changed() ? out : pulse2.StopPropagation; + } + }); + function LegendEntries$1(params2) { + Transform.call(this, [], params2); + } + inherits(LegendEntries$1, Transform, { + transform(_, pulse2) { + if (this.value != null && !_.modified()) { + return pulse2.StopPropagation; + } + var locale2 = pulse2.dataflow.locale(), out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), items = this.value, type2 = _.type || SymbolLegend, scale2 = _.scale, limit = +_.limit, count2 = tickCount(scale2, _.count == null ? 5 : _.count, _.minstep), lskip = !!_.values || type2 === SymbolLegend, format2 = _.format || labelFormat(locale2, scale2, count2, type2, _.formatSpecifier, _.formatType, lskip), values2 = _.values || labelValues(scale2, count2), domain2, fraction, size, offset2, ellipsis; + if (items) out.rem = items; + if (type2 === SymbolLegend) { + if (limit && values2.length > limit) { + pulse2.dataflow.warn("Symbol legend count exceeds limit, filtering items."); + items = values2.slice(0, limit - 1); + ellipsis = true; + } else { + items = values2; + } + if (isFunction(size = _.size)) { + if (!_.values && scale2(items[0]) === 0) { + items = items.slice(1); + } + offset2 = items.reduce((max2, value2) => Math.max(max2, size(value2, _)), 0); + } else { + size = constant$5(offset2 = size || 8); + } + items = items.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, items), + value: value2, + offset: offset2, + size: size(value2, _) + })); + if (ellipsis) { + ellipsis = values2[items.length]; + items.push(ingest$1({ + index: items.length, + label: `…${values2.length - items.length} entries`, + value: ellipsis, + offset: offset2, + size: size(ellipsis, _) + })); + } + } else if (type2 === GradientLegend) { + domain2 = scale2.domain(), fraction = scaleFraction(scale2, domain2[0], peek$1(domain2)); + if (values2.length < 3 && !_.values && domain2[0] !== peek$1(domain2)) { + values2 = [domain2[0], peek$1(domain2)]; + } + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: fraction(value2) + })); + } else { + size = values2.length - 1; + fraction = labelFraction(scale2); + items = values2.map((value2, index2) => ingest$1({ + index: index2, + label: format2(value2, index2, values2), + value: value2, + perc: index2 ? fraction(value2) : 0, + perc2: index2 === size ? 1 : fraction(values2[index2 + 1]) + })); + } + out.source = items; + out.add = items; + this.value = items; + return out; + } + }); + const sourceX = (t) => t.source.x; + const sourceY = (t) => t.source.y; + const targetX = (t) => t.target.x; + const targetY = (t) => t.target.y; + function LinkPath(params2) { + Transform.call(this, {}, params2); + } + LinkPath.Definition = { + "type": "LinkPath", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "sourceX", + "type": "field", + "default": "source.x" + }, { + "name": "sourceY", + "type": "field", + "default": "source.y" + }, { + "name": "targetX", + "type": "field", + "default": "target.x" + }, { + "name": "targetY", + "type": "field", + "default": "target.y" + }, { + "name": "orient", + "type": "enum", + "default": "vertical", + "values": ["horizontal", "vertical", "radial"] + }, { + "name": "shape", + "type": "enum", + "default": "line", + "values": ["line", "arc", "curve", "diagonal", "orthogonal"] + }, { + "name": "require", + "type": "signal" + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(LinkPath, Transform, { + transform(_, pulse2) { + var sx = _.sourceX || sourceX, sy = _.sourceY || sourceY, tx2 = _.targetX || targetX, ty2 = _.targetY || targetY, as = _.as || "path", orient = _.orient || "vertical", shape2 = _.shape || "line", path2 = Paths.get(shape2 + "-" + orient) || Paths.get(shape2); + if (!path2) { + error("LinkPath unsupported type: " + _.shape + (_.orient ? "-" + _.orient : "")); + } + pulse2.visit(pulse2.SOURCE, (t) => { + t[as] = path2(sx(t), sy(t), tx2(t), ty2(t)); + }); + return pulse2.reflow(_.modified()).modifies(as); + } + }); + const line = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "L" + tx2 + "," + ty2; + const lineR = (sa2, sr, ta, tr2) => line(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const arc = (sx, sy, tx2, ty2) => { + var dx = tx2 - sx, dy = ty2 - sy, rr = Math.hypot(dx, dy) / 2, ra = 180 * Math.atan2(dy, dx) / Math.PI; + return "M" + sx + "," + sy + "A" + rr + "," + rr + " " + ra + " 0 1 " + tx2 + "," + ty2; + }; + const arcR = (sa2, sr, ta, tr2) => arc(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const curve = (sx, sy, tx2, ty2) => { + const dx = tx2 - sx, dy = ty2 - sy, ix = 0.2 * (dx + dy), iy = 0.2 * (dy - dx); + return "M" + sx + "," + sy + "C" + (sx + ix) + "," + (sy + iy) + " " + (tx2 + iy) + "," + (ty2 - ix) + " " + tx2 + "," + ty2; + }; + const curveR = (sa2, sr, ta, tr2) => curve(sr * Math.cos(sa2), sr * Math.sin(sa2), tr2 * Math.cos(ta), tr2 * Math.sin(ta)); + const orthoX = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "V" + ty2 + "H" + tx2; + const orthoY = (sx, sy, tx2, ty2) => "M" + sx + "," + sy + "H" + tx2 + "V" + ty2; + const orthoR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), sf = Math.abs(ta - sa2) > Math.PI ? ta <= sa2 : ta > sa2; + return "M" + sr * sc + "," + sr * ss + "A" + sr + "," + sr + " 0 0," + (sf ? 1 : 0) + " " + sr * tc + "," + sr * ts2 + "L" + tr2 * tc + "," + tr2 * ts2; + }; + const diagonalX = (sx, sy, tx2, ty2) => { + const m2 = (sx + tx2) / 2; + return "M" + sx + "," + sy + "C" + m2 + "," + sy + " " + m2 + "," + ty2 + " " + tx2 + "," + ty2; + }; + const diagonalY = (sx, sy, tx2, ty2) => { + const m2 = (sy + ty2) / 2; + return "M" + sx + "," + sy + "C" + sx + "," + m2 + " " + tx2 + "," + m2 + " " + tx2 + "," + ty2; + }; + const diagonalR = (sa2, sr, ta, tr2) => { + const sc = Math.cos(sa2), ss = Math.sin(sa2), tc = Math.cos(ta), ts2 = Math.sin(ta), mr = (sr + tr2) / 2; + return "M" + sr * sc + "," + sr * ss + "C" + mr * sc + "," + mr * ss + " " + mr * tc + "," + mr * ts2 + " " + tr2 * tc + "," + tr2 * ts2; + }; + const Paths = fastmap({ + "line": line, + "line-radial": lineR, + "arc": arc, + "arc-radial": arcR, + "curve": curve, + "curve-radial": curveR, + "orthogonal-horizontal": orthoX, + "orthogonal-vertical": orthoY, + "orthogonal-radial": orthoR, + "diagonal-horizontal": diagonalX, + "diagonal-vertical": diagonalY, + "diagonal-radial": diagonalR + }); + function Pie(params2) { + Transform.call(this, null, params2); + } + Pie.Definition = { + "type": "Pie", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "startAngle", + "type": "number", + "default": 0 + }, { + "name": "endAngle", + "type": "number", + "default": 6.283185307179586 + }, { + "name": "sort", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["startAngle", "endAngle"] + }] + }; + inherits(Pie, Transform, { + transform(_, pulse2) { + var as = _.as || ["startAngle", "endAngle"], startAngle = as[0], endAngle = as[1], field2 = _.field || one$2, start = _.startAngle || 0, stop2 = _.endAngle != null ? _.endAngle : 2 * Math.PI, data2 = pulse2.source, values2 = data2.map(field2), n = values2.length, a2 = start, k = (stop2 - start) / sum$1(values2), index2 = range$3(n), i, t, v; + if (_.sort) { + index2.sort((a3, b2) => values2[a3] - values2[b2]); + } + for (i = 0; i < n; ++i) { + v = values2[index2[i]]; + t = data2[index2[i]]; + t[startAngle] = a2; + t[endAngle] = a2 += v * k; + } + this.value = values2; + return pulse2.reflow(_.modified()).modifies(as); + } + }); + const DEFAULT_COUNT = 5; + function includeZero(scale2) { + const type2 = scale2.type; + return !scale2.bins && (type2 === Linear || type2 === Pow || type2 === Sqrt); + } + function includePad(type2) { + return isContinuous(type2) && type2 !== Sequential; + } + const SKIP$1 = toSet(["set", "modified", "clear", "type", "scheme", "schemeExtent", "schemeCount", "domain", "domainMin", "domainMid", "domainMax", "domainRaw", "domainImplicit", "nice", "zero", "bins", "range", "rangeStep", "round", "reverse", "interpolate", "interpolateGamma"]); + function Scale$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Scale$1, Transform, { + transform(_, pulse2) { + var df = pulse2.dataflow, scale$12 = this.value, key2 = scaleKey(_); + if (!scale$12 || key2 !== scale$12.type) { + this.value = scale$12 = scale$6(key2)(); + } + for (key2 in _) if (!SKIP$1[key2]) { + if (key2 === "padding" && includePad(scale$12.type)) continue; + isFunction(scale$12[key2]) ? scale$12[key2](_[key2]) : df.warn("Unsupported scale property: " + key2); + } + configureRange(scale$12, _, configureBins(scale$12, _, configureDomain(scale$12, _, df))); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + } + }); + function scaleKey(_) { + var t = _.type, d = "", n; + if (t === Sequential) return Sequential + "-" + Linear; + if (isContinuousColor(_)) { + n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0; + d = n === 2 ? Sequential + "-" : n === 3 ? Diverging + "-" : ""; + } + return (d + t || Linear).toLowerCase(); + } + function isContinuousColor(_) { + const t = _.type; + return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString)); + } + function configureDomain(scale2, _, df) { + const raw = rawDomain(scale2, _.domainRaw, df); + if (raw > -1) return raw; + var domain2 = _.domain, type2 = scale2.type, zero2 = _.zero || _.zero === void 0 && includeZero(scale2), n, mid; + if (!domain2) return 0; + if (zero2 || _.domainMin != null || _.domainMax != null || _.domainMid != null) { + n = (domain2 = domain2.slice()).length - 1 || 1; + if (zero2) { + if (domain2[0] > 0) domain2[0] = 0; + if (domain2[n] < 0) domain2[n] = 0; + } + if (_.domainMin != null) domain2[0] = _.domainMin; + if (_.domainMax != null) domain2[n] = _.domainMax; + if (_.domainMid != null) { + mid = _.domainMid; + const i = mid > domain2[n] ? n + 1 : mid < domain2[0] ? 0 : n; + if (i !== n) df.warn("Scale domainMid exceeds domain min or max.", mid); + domain2.splice(i, 0, mid); + } + } + if (includePad(type2) && _.padding && domain2[0] !== peek$1(domain2)) { + domain2 = padDomain(type2, domain2, _.range, _.padding, _.exponent, _.constant); + } + scale2.domain(domainCheck(type2, domain2, df)); + if (type2 === Ordinal) { + scale2.unknown(_.domainImplicit ? implicit : void 0); + } + if (_.nice && scale2.nice) { + scale2.nice(_.nice !== true && tickCount(scale2, _.nice) || null); + } + return domain2.length; + } + function rawDomain(scale2, raw, df) { + if (raw) { + scale2.domain(domainCheck(scale2.type, raw, df)); + return raw.length; + } else { + return -1; + } + } + function padDomain(type2, domain2, range2, pad2, exponent2, constant2) { + var span2 = Math.abs(peek$1(range2) - range2[0]), frac = span2 / (span2 - 2 * pad2), d = type2 === Log$1 ? zoomLog(domain2, null, frac) : type2 === Sqrt ? zoomPow(domain2, null, frac, 0.5) : type2 === Pow ? zoomPow(domain2, null, frac, exponent2 || 1) : type2 === Symlog ? zoomSymlog(domain2, null, frac, constant2 || 1) : zoomLinear(domain2, null, frac); + domain2 = domain2.slice(); + domain2[0] = d[0]; + domain2[domain2.length - 1] = d[1]; + return domain2; + } + function domainCheck(type2, domain2, df) { + if (isLogarithmic(type2)) { + var s = Math.abs(domain2.reduce((s2, v) => s2 + (v < 0 ? -1 : v > 0 ? 1 : 0), 0)); + if (s !== domain2.length) { + df.warn("Log scale domain includes zero: " + $(domain2)); + } + } + return domain2; + } + function configureBins(scale2, _, count2) { + let bins = _.bins; + if (bins && !isArray(bins)) { + const domain2 = scale2.domain(), lo = domain2[0], hi = peek$1(domain2), step = bins.step; + let start = bins.start == null ? lo : bins.start, stop2 = bins.stop == null ? hi : bins.stop; + if (!step) error("Scale bins parameter missing step property."); + if (start < lo) start = step * Math.ceil(lo / step); + if (stop2 > hi) stop2 = step * Math.floor(hi / step); + bins = range$3(start, stop2 + step / 2, step); + } + if (bins) { + scale2.bins = bins; + } else if (scale2.bins) { + delete scale2.bins; + } + if (scale2.type === BinOrdinal) { + if (!bins) { + scale2.bins = scale2.domain(); + } else if (!_.domain && !_.domainRaw) { + scale2.domain(bins); + count2 = bins.length; + } + } + return count2; + } + function configureRange(scale2, _, count2) { + var type2 = scale2.type, round = _.round || false, range2 = _.range; + if (_.rangeStep != null) { + range2 = configureRangeStep(type2, _, count2); + } else if (_.scheme) { + range2 = configureScheme(type2, _, count2); + if (isFunction(range2)) { + if (scale2.interpolator) { + return scale2.interpolator(range2); + } else { + error(`Scale type ${type2} does not support interpolating color schemes.`); + } + } + } + if (range2 && isInterpolating(type2)) { + return scale2.interpolator(interpolateColors(flip(range2, _.reverse), _.interpolate, _.interpolateGamma)); + } + if (range2 && _.interpolate && scale2.interpolate) { + scale2.interpolate(interpolate(_.interpolate, _.interpolateGamma)); + } else if (isFunction(scale2.round)) { + scale2.round(round); + } else if (isFunction(scale2.rangeRound)) { + scale2.interpolate(round ? interpolateRound : interpolate$1); + } + if (range2) scale2.range(flip(range2, _.reverse)); + } + function configureRangeStep(type2, _, count2) { + if (type2 !== Band && type2 !== Point) { + error("Only band and point scales support rangeStep."); + } + var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0, inner = type2 === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0; + return [0, _.rangeStep * bandSpace(count2, inner, outer)]; + } + function configureScheme(type2, _, count2) { + var extent2 = _.schemeExtent, name, scheme$1; + if (isArray(_.scheme)) { + scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma); + } else { + name = _.scheme.toLowerCase(); + scheme$1 = scheme(name); + if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`); + } + count2 = type2 === Threshold ? count2 + 1 : type2 === BinOrdinal ? count2 - 1 : type2 === Quantile || type2 === Quantize ? +_.schemeCount || DEFAULT_COUNT : count2; + return isInterpolating(type2) ? adjustScheme(scheme$1, extent2, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent2), count2) : type2 === Ordinal ? scheme$1 : scheme$1.slice(0, count2); + } + function adjustScheme(scheme2, extent2, reverse2) { + return isFunction(scheme2) && (extent2 || reverse2) ? interpolateRange(scheme2, flip(extent2 || [0, 1], reverse2)) : scheme2; + } + function flip(array2, reverse2) { + return reverse2 ? array2.slice().reverse() : array2; + } + function SortItems$1(params2) { + Transform.call(this, null, params2); + } + inherits(SortItems$1, Transform, { + transform(_, pulse2) { + const mod = _.modified("sort") || pulse2.changed(pulse2.ADD) || pulse2.modified(_.sort.fields) || pulse2.modified("datum"); + if (mod) pulse2.source.sort(stableCompare(_.sort)); + this.modified(mod); + return pulse2; + } + }); + const Zero = "zero", Center$1 = "center", Normalize = "normalize", DefOutput = ["y0", "y1"]; + function Stack(params2) { + Transform.call(this, null, params2); + } + Stack.Definition = { + "type": "Stack", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "sort", + "type": "compare" + }, { + "name": "offset", + "type": "enum", + "default": Zero, + "values": [Zero, Center$1, Normalize] + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": DefOutput + }] + }; + inherits(Stack, Transform, { + transform(_, pulse2) { + var as = _.as || DefOutput, y02 = as[0], y12 = as[1], sort2 = stableCompare(_.sort), field2 = _.field || one$2, stack = _.offset === Center$1 ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero, groups, i, n, max2; + groups = partition$3(pulse2.source, _.groupby, sort2, field2); + for (i = 0, n = groups.length, max2 = groups.max; i < n; ++i) { + stack(groups[i], max2, field2, y02, y12); + } + return pulse2.reflow(_.modified()).modifies(as); + } + }); + function stackCenter(group2, max2, field2, y02, y12) { + var last = (max2 - group2.sum) / 2, m2 = group2.length, j = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last += Math.abs(field2(t)); + } + } + function stackNormalize(group2, max2, field2, y02, y12) { + var scale2 = 1 / group2.sum, last = 0, m2 = group2.length, j = 0, v = 0, t; + for (; j < m2; ++j) { + t = group2[j]; + t[y02] = last; + t[y12] = last = scale2 * (v += Math.abs(field2(t))); + } + } + function stackZero(group2, max2, field2, y02, y12) { + var lastPos = 0, lastNeg = 0, m2 = group2.length, j = 0, v, t; + for (; j < m2; ++j) { + t = group2[j]; + v = +field2(t); + if (v < 0) { + t[y02] = lastNeg; + t[y12] = lastNeg += v; + } else { + t[y02] = lastPos; + t[y12] = lastPos += v; + } + } + } + function partition$3(data2, groupby, sort2, field2) { + var groups = [], get2 = (f) => f(t), map2, i, n, m2, t, k, g, s, max2; + if (groupby == null) { + groups.push(data2.slice()); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + groups.push(g); + } + g.push(t); + } + } + for (k = 0, max2 = 0, m2 = groups.length; k < m2; ++k) { + g = groups[k]; + for (i = 0, s = 0, n = g.length; i < n; ++i) { + s += Math.abs(field2(g[i])); + } + g.sum = s; + if (s > max2) max2 = s; + if (sort2) g.sort(sort2); + } + groups.max = max2; + return groups; + } + const encode$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + axisticks: AxisTicks$1, + datajoin: DataJoin$1, + encode: Encode$1, + legendentries: LegendEntries$1, + linkpath: LinkPath, + pie: Pie, + scale: Scale$1, + sortitems: SortItems$1, + stack: Stack + }, Symbol.toStringTag, { value: "Module" })); + var epsilon$3 = 1e-6; + var epsilon2 = 1e-12; + var pi$1 = Math.PI; + var halfPi$1 = pi$1 / 2; + var quarterPi = pi$1 / 4; + var tau$1 = pi$1 * 2; + var degrees = 180 / pi$1; + var radians = pi$1 / 180; + var abs$1 = Math.abs; + var atan = Math.atan; + var atan2 = Math.atan2; + var cos$1 = Math.cos; + var ceil = Math.ceil; + var exp = Math.exp; + var hypot = Math.hypot; + var log$1 = Math.log; + var pow$1 = Math.pow; + var sin$1 = Math.sin; + var sign = Math.sign || function(x2) { + return x2 > 0 ? 1 : x2 < 0 ? -1 : 0; + }; + var sqrt$1 = Math.sqrt; + var tan = Math.tan; + function acos(x2) { + return x2 > 1 ? 0 : x2 < -1 ? pi$1 : Math.acos(x2); + } + function asin$1(x2) { + return x2 > 1 ? halfPi$1 : x2 < -1 ? -halfPi$1 : Math.asin(x2); + } + function noop$2() { + } + function streamGeometry(geometry, stream2) { + if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { + streamGeometryType[geometry.type](geometry, stream2); + } + } + var streamObjectType = { + Feature: function(object2, stream2) { + streamGeometry(object2.geometry, stream2); + }, + FeatureCollection: function(object2, stream2) { + var features = object2.features, i = -1, n = features.length; + while (++i < n) streamGeometry(features[i].geometry, stream2); + } + }; + var streamGeometryType = { + Sphere: function(object2, stream2) { + stream2.sphere(); + }, + Point: function(object2, stream2) { + object2 = object2.coordinates; + stream2.point(object2[0], object2[1], object2[2]); + }, + MultiPoint: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) object2 = coordinates[i], stream2.point(object2[0], object2[1], object2[2]); + }, + LineString: function(object2, stream2) { + streamLine(object2.coordinates, stream2, 0); + }, + MultiLineString: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamLine(coordinates[i], stream2, 0); + }, + Polygon: function(object2, stream2) { + streamPolygon(object2.coordinates, stream2); + }, + MultiPolygon: function(object2, stream2) { + var coordinates = object2.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamPolygon(coordinates[i], stream2); + }, + GeometryCollection: function(object2, stream2) { + var geometries = object2.geometries, i = -1, n = geometries.length; + while (++i < n) streamGeometry(geometries[i], stream2); + } + }; + function streamLine(coordinates, stream2, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + stream2.lineStart(); + while (++i < n) coordinate = coordinates[i], stream2.point(coordinate[0], coordinate[1], coordinate[2]); + stream2.lineEnd(); + } + function streamPolygon(coordinates, stream2) { + var i = -1, n = coordinates.length; + stream2.polygonStart(); + while (++i < n) streamLine(coordinates[i], stream2, 1); + stream2.polygonEnd(); + } + function geoStream(object2, stream2) { + if (object2 && streamObjectType.hasOwnProperty(object2.type)) { + streamObjectType[object2.type](object2, stream2); + } else { + streamGeometry(object2, stream2); + } + } + var areaRingSum$1 = new Adder(); + var areaSum$1 = new Adder(), lambda00$2, phi00$2, lambda0$1, cosPhi0, sinPhi0; + var areaStream$1 = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaRingSum$1 = new Adder(); + areaStream$1.lineStart = areaRingStart$1; + areaStream$1.lineEnd = areaRingEnd$1; + }, + polygonEnd: function() { + var areaRing = +areaRingSum$1; + areaSum$1.add(areaRing < 0 ? tau$1 + areaRing : areaRing); + this.lineStart = this.lineEnd = this.point = noop$2; + }, + sphere: function() { + areaSum$1.add(tau$1); + } + }; + function areaRingStart$1() { + areaStream$1.point = areaPointFirst$1; + } + function areaRingEnd$1() { + areaPoint$1(lambda00$2, phi00$2); + } + function areaPointFirst$1(lambda, phi2) { + areaStream$1.point = areaPoint$1; + lambda00$2 = lambda, phi00$2 = phi2; + lambda *= radians, phi2 *= radians; + lambda0$1 = lambda, cosPhi0 = cos$1(phi2 = phi2 / 2 + quarterPi), sinPhi0 = sin$1(phi2); + } + function areaPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + phi2 = phi2 / 2 + quarterPi; + var dLambda = lambda - lambda0$1, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos$1(phi2), sinPhi = sin$1(phi2), k = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k * cos$1(adLambda), v = k * sdLambda * sin$1(adLambda); + areaRingSum$1.add(atan2(v, u2)); + lambda0$1 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; + } + function geoArea$1(object2) { + areaSum$1 = new Adder(); + geoStream(object2, areaStream$1); + return areaSum$1 * 2; + } + function spherical(cartesian2) { + return [atan2(cartesian2[1], cartesian2[0]), asin$1(cartesian2[2])]; + } + function cartesian(spherical2) { + var lambda = spherical2[0], phi2 = spherical2[1], cosPhi = cos$1(phi2); + return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)]; + } + function cartesianDot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cartesianCross(a2, b2) { + return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]]; + } + function cartesianAddInPlace(a2, b2) { + a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2]; + } + function cartesianScale(vector, k) { + return [vector[0] * k, vector[1] * k, vector[2] * k]; + } + function cartesianNormalizeInPlace(d) { + var l = sqrt$1(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + d[0] /= l, d[1] /= l, d[2] /= l; + } + var lambda0, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, deltaSum, ranges, range$2; + var boundsStream$1 = { + point: boundsPoint$1, + lineStart: boundsLineStart, + lineEnd: boundsLineEnd, + polygonStart: function() { + boundsStream$1.point = boundsRingPoint; + boundsStream$1.lineStart = boundsRingStart; + boundsStream$1.lineEnd = boundsRingEnd; + deltaSum = new Adder(); + areaStream$1.polygonStart(); + }, + polygonEnd: function() { + areaStream$1.polygonEnd(); + boundsStream$1.point = boundsPoint$1; + boundsStream$1.lineStart = boundsLineStart; + boundsStream$1.lineEnd = boundsLineEnd; + if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); + else if (deltaSum > epsilon$3) phi1 = 90; + else if (deltaSum < -epsilon$3) phi0 = -90; + range$2[0] = lambda0, range$2[1] = lambda1; + }, + sphere: function() { + lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90); + } + }; + function boundsPoint$1(lambda, phi2) { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + function linePoint(lambda, phi2) { + var p = cartesian([lambda * radians, phi2 * radians]); + if (p0) { + var normal = cartesianCross(p0, p), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal); + cartesianNormalizeInPlace(inflection); + inflection = spherical(inflection); + var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs$1(delta) > 180; + if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = inflection[1] * degrees; + if (phii > phi1) phi1 = phii; + } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { + phii = -inflection[1] * degrees; + if (phii < phi0) phi0 = phii; + } else { + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + } + if (antimeridian) { + if (lambda < lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } + } else { + if (lambda1 >= lambda0) { + if (lambda < lambda0) lambda0 = lambda; + if (lambda > lambda1) lambda1 = lambda; + } else { + if (lambda > lambda2) { + if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda; + } + } + } + } else { + ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]); + } + if (phi2 < phi0) phi0 = phi2; + if (phi2 > phi1) phi1 = phi2; + p0 = p, lambda2 = lambda; + } + function boundsLineStart() { + boundsStream$1.point = linePoint; + } + function boundsLineEnd() { + range$2[0] = lambda0, range$2[1] = lambda1; + boundsStream$1.point = boundsPoint$1; + p0 = null; + } + function boundsRingPoint(lambda, phi2) { + if (p0) { + var delta = lambda - lambda2; + deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); + } else { + lambda00$1 = lambda, phi00$1 = phi2; + } + areaStream$1.point(lambda, phi2); + linePoint(lambda, phi2); + } + function boundsRingStart() { + areaStream$1.lineStart(); + } + function boundsRingEnd() { + boundsRingPoint(lambda00$1, phi00$1); + areaStream$1.lineEnd(); + if (abs$1(deltaSum) > epsilon$3) lambda0 = -(lambda1 = 180); + range$2[0] = lambda0, range$2[1] = lambda1; + p0 = null; + } + function angle(lambda02, lambda12) { + return (lambda12 -= lambda02) < 0 ? lambda12 + 360 : lambda12; + } + function rangeCompare(a2, b2) { + return a2[0] - b2[0]; + } + function rangeContains(range2, x2) { + return range2[0] <= range2[1] ? range2[0] <= x2 && x2 <= range2[1] : x2 < range2[0] || range2[1] < x2; + } + function geoBounds$1(feature2) { + var i, n, a2, b2, merged, deltaMax, delta; + phi1 = lambda1 = -(lambda0 = phi0 = Infinity); + ranges = []; + geoStream(feature2, boundsStream$1); + if (n = ranges.length) { + ranges.sort(rangeCompare); + for (i = 1, a2 = ranges[0], merged = [a2]; i < n; ++i) { + b2 = ranges[i]; + if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) { + if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1]; + if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0]; + } else { + merged.push(a2 = b2); + } + } + for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a2 = merged[n]; i <= n; a2 = b2, ++i) { + b2 = merged[i]; + if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda0 = b2[0], lambda1 = a2[1]; + } + } + ranges = range$2 = null; + return lambda0 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]]; + } + var W0, W1, X0$1, Y0$1, Z0$1, X1$1, Y1$1, Z1$1, X2$1, Y2$1, Z2$1, lambda00, phi00, x0$4, y0$4, z0; + var centroidStream$1 = { + sphere: noop$2, + point: centroidPoint$1, + lineStart: centroidLineStart$1, + lineEnd: centroidLineEnd$1, + polygonStart: function() { + centroidStream$1.lineStart = centroidRingStart$1; + centroidStream$1.lineEnd = centroidRingEnd$1; + }, + polygonEnd: function() { + centroidStream$1.lineStart = centroidLineStart$1; + centroidStream$1.lineEnd = centroidLineEnd$1; + } + }; + function centroidPoint$1(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)); + } + function centroidPointCartesian(x2, y2, z) { + ++W0; + X0$1 += (x2 - X0$1) / W0; + Y0$1 += (y2 - Y0$1) / W0; + Z0$1 += (z - Z0$1) / W0; + } + function centroidLineStart$1() { + centroidStream$1.point = centroidLinePointFirst; + } + function centroidLinePointFirst(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidStream$1.point = centroidLinePoint; + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLinePoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z = sin$1(phi2), w2 = atan2(sqrt$1((w2 = y0$4 * z - z0 * y2) * w2 + (w2 = z0 * x2 - x0$4 * z) * w2 + (w2 = x0$4 * y2 - y0$4 * x2) * w2), x0$4 * x2 + y0$4 * y2 + z0 * z); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidLineEnd$1() { + centroidStream$1.point = centroidPoint$1; + } + function centroidRingStart$1() { + centroidStream$1.point = centroidRingPointFirst; + } + function centroidRingEnd$1() { + centroidRingPoint(lambda00, phi00); + centroidStream$1.point = centroidPoint$1; + } + function centroidRingPointFirst(lambda, phi2) { + lambda00 = lambda, phi00 = phi2; + lambda *= radians, phi2 *= radians; + centroidStream$1.point = centroidRingPoint; + var cosPhi = cos$1(phi2); + x0$4 = cosPhi * cos$1(lambda); + y0$4 = cosPhi * sin$1(lambda); + z0 = sin$1(phi2); + centroidPointCartesian(x0$4, y0$4, z0); + } + function centroidRingPoint(lambda, phi2) { + lambda *= radians, phi2 *= radians; + var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z = sin$1(phi2), cx = y0$4 * z - z0 * y2, cy = z0 * x2 - x0$4 * z, cz = x0$4 * y2 - y0$4 * x2, m2 = hypot(cx, cy, cz), w2 = asin$1(m2), v = m2 && -w2 / m2; + X2$1.add(v * cx); + Y2$1.add(v * cy); + Z2$1.add(v * cz); + W1 += w2; + X1$1 += w2 * (x0$4 + (x0$4 = x2)); + Y1$1 += w2 * (y0$4 + (y0$4 = y2)); + Z1$1 += w2 * (z0 + (z0 = z)); + centroidPointCartesian(x0$4, y0$4, z0); + } + function geoCentroid$1(object2) { + W0 = W1 = X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = 0; + X2$1 = new Adder(); + Y2$1 = new Adder(); + Z2$1 = new Adder(); + geoStream(object2, centroidStream$1); + var x2 = +X2$1, y2 = +Y2$1, z = +Z2$1, m2 = hypot(x2, y2, z); + if (m2 < epsilon2) { + x2 = X1$1, y2 = Y1$1, z = Z1$1; + if (W1 < epsilon$3) x2 = X0$1, y2 = Y0$1, z = Z0$1; + m2 = hypot(x2, y2, z); + if (m2 < epsilon2) return [NaN, NaN]; + } + return [atan2(y2, x2) * degrees, asin$1(z / m2) * degrees]; + } + function compose(a2, b2) { + function compose2(x2, y2) { + return x2 = a2(x2, y2), b2(x2[0], x2[1]); + } + if (a2.invert && b2.invert) compose2.invert = function(x2, y2) { + return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]); + }; + return compose2; + } + function rotationIdentity(lambda, phi2) { + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + } + rotationIdentity.invert = rotationIdentity; + function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { + return (deltaLambda %= tau$1) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; + } + function forwardRotationLambda(deltaLambda) { + return function(lambda, phi2) { + lambda += deltaLambda; + if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1; + return [lambda, phi2]; + }; + } + function rotationLambda(deltaLambda) { + var rotation2 = forwardRotationLambda(deltaLambda); + rotation2.invert = forwardRotationLambda(-deltaLambda); + return rotation2; + } + function rotationPhiGamma(deltaPhi, deltaGamma) { + var cosDeltaPhi = cos$1(deltaPhi), sinDeltaPhi = sin$1(deltaPhi), cosDeltaGamma = cos$1(deltaGamma), sinDeltaGamma = sin$1(deltaGamma); + function rotation2(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z = sin$1(phi2), k = z * cosDeltaPhi + x2 * sinDeltaPhi; + return [ + atan2(y2 * cosDeltaGamma - k * sinDeltaGamma, x2 * cosDeltaPhi - z * sinDeltaPhi), + asin$1(k * cosDeltaGamma + y2 * sinDeltaGamma) + ]; + } + rotation2.invert = function(lambda, phi2) { + var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z = sin$1(phi2), k = z * cosDeltaGamma - y2 * sinDeltaGamma; + return [ + atan2(y2 * cosDeltaGamma + z * sinDeltaGamma, x2 * cosDeltaPhi + k * sinDeltaPhi), + asin$1(k * cosDeltaPhi - x2 * sinDeltaPhi) + ]; + }; + return rotation2; + } + function rotation(rotate2) { + rotate2 = rotateRadians(rotate2[0] * radians, rotate2[1] * radians, rotate2.length > 2 ? rotate2[2] * radians : 0); + function forward(coordinates) { + coordinates = rotate2(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + } + forward.invert = function(coordinates) { + coordinates = rotate2.invert(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; + }; + return forward; + } + function circleStream(stream2, radius2, delta, direction, t02, t12) { + if (!delta) return; + var cosRadius = cos$1(radius2), sinRadius = sin$1(radius2), step = direction * delta; + if (t02 == null) { + t02 = radius2 + direction * tau$1; + t12 = radius2 - step / 2; + } else { + t02 = circleRadius(cosRadius, t02); + t12 = circleRadius(cosRadius, t12); + if (direction > 0 ? t02 < t12 : t02 > t12) t02 += direction * tau$1; + } + for (var point2, t = t02; direction > 0 ? t > t12 : t < t12; t -= step) { + point2 = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]); + stream2.point(point2[0], point2[1]); + } + } + function circleRadius(cosRadius, point2) { + point2 = cartesian(point2), point2[0] -= cosRadius; + cartesianNormalizeInPlace(point2); + var radius2 = acos(-point2[1]); + return ((-point2[2] < 0 ? -radius2 : radius2) + tau$1 - epsilon$3) % tau$1; + } + function clipBuffer() { + var lines = [], line2; + return { + point: function(x2, y2, m2) { + line2.push([x2, y2, m2]); + }, + lineStart: function() { + lines.push(line2 = []); + }, + lineEnd: noop$2, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + }, + result: function() { + var result = lines; + lines = []; + line2 = null; + return result; + } + }; + } + function pointEqual(a2, b2) { + return abs$1(a2[0] - b2[0]) < epsilon$3 && abs$1(a2[1] - b2[1]) < epsilon$3; + } + function Intersection(point2, points2, other, entry2) { + this.x = point2; + this.z = points2; + this.o = other; + this.e = entry2; + this.v = false; + this.n = this.p = null; + } + function clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2) { + var subject = [], clip2 = [], i, n; + segments2.forEach(function(segment) { + if ((n2 = segment.length - 1) <= 0) return; + var n2, p02 = segment[0], p1 = segment[n2], x2; + if (pointEqual(p02, p1)) { + if (!p02[2] && !p1[2]) { + stream2.lineStart(); + for (i = 0; i < n2; ++i) stream2.point((p02 = segment[i])[0], p02[1]); + stream2.lineEnd(); + return; + } + p1[0] += 2 * epsilon$3; + } + subject.push(x2 = new Intersection(p02, segment, null, true)); + clip2.push(x2.o = new Intersection(p02, null, x2, false)); + subject.push(x2 = new Intersection(p1, segment, null, false)); + clip2.push(x2.o = new Intersection(p1, null, x2, true)); + }); + if (!subject.length) return; + clip2.sort(compareIntersection2); + link(subject); + link(clip2); + for (i = 0, n = clip2.length; i < n; ++i) { + clip2[i].e = startInside = !startInside; + } + var start = subject[0], points2, point2; + while (1) { + var current = start, isSubject = true; + while (current.v) if ((current = current.n) === start) return; + points2 = current.z; + stream2.lineStart(); + do { + current.v = current.o.v = true; + if (current.e) { + if (isSubject) { + for (i = 0, n = points2.length; i < n; ++i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.n.x, 1, stream2); + } + current = current.n; + } else { + if (isSubject) { + points2 = current.p.z; + for (i = points2.length - 1; i >= 0; --i) stream2.point((point2 = points2[i])[0], point2[1]); + } else { + interpolate2(current.x, current.p.x, -1, stream2); + } + current = current.p; + } + current = current.o; + points2 = current.z; + isSubject = !isSubject; + } while (!current.v); + stream2.lineEnd(); + } + } + function link(array2) { + if (!(n = array2.length)) return; + var n, i = 0, a2 = array2[0], b2; + while (++i < n) { + a2.n = b2 = array2[i]; + b2.p = a2; + a2 = b2; + } + a2.n = b2 = array2[0]; + b2.p = a2; + } + function longitude(point2) { + return abs$1(point2[0]) <= pi$1 ? point2[0] : sign(point2[0]) * ((abs$1(point2[0]) + pi$1) % tau$1 - pi$1); + } + function polygonContains(polygon, point2) { + var lambda = longitude(point2), phi2 = point2[1], sinPhi = sin$1(phi2), normal = [sin$1(lambda), -cos$1(lambda), 0], angle2 = 0, winding = 0; + var sum2 = new Adder(); + if (sinPhi === 1) phi2 = halfPi$1 + epsilon$3; + else if (sinPhi === -1) phi2 = -halfPi$1 - epsilon$3; + for (var i = 0, n = polygon.length; i < n; ++i) { + if (!(m2 = (ring = polygon[i]).length)) continue; + var ring, m2, point0 = ring[m2 - 1], lambda02 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi02 = sin$1(phi02), cosPhi02 = cos$1(phi02); + for (var j = 0; j < m2; ++j, lambda02 = lambda12, sinPhi02 = sinPhi1, cosPhi02 = cosPhi1, point0 = point1) { + var point1 = ring[j], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin$1(phi12), cosPhi1 = cos$1(phi12), delta = lambda12 - lambda02, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi$1, k = sinPhi02 * sinPhi1; + sum2.add(atan2(k * sign2 * sin$1(absDelta), cosPhi02 * cosPhi1 + k * cos$1(absDelta))); + angle2 += antimeridian ? delta + sign2 * tau$1 : delta; + if (antimeridian ^ lambda02 >= lambda ^ lambda12 >= lambda) { + var arc2 = cartesianCross(cartesian(point0), cartesian(point1)); + cartesianNormalizeInPlace(arc2); + var intersection2 = cartesianCross(normal, arc2); + cartesianNormalizeInPlace(intersection2); + var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection2[2]); + if (phi2 > phiArc || phi2 === phiArc && (arc2[0] || arc2[1])) { + winding += antimeridian ^ delta >= 0 ? 1 : -1; + } + } + } + } + return (angle2 < -epsilon$3 || angle2 < epsilon$3 && sum2 < -epsilon2) ^ winding & 1; + } + function clip$1(pointVisible, clipLine2, interpolate2, start) { + return function(sink) { + var line2 = clipLine2(sink), ringBuffer = clipBuffer(), ringSink = clipLine2(ringBuffer), polygonStarted = false, polygon, segments2, ring; + var clip2 = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + clip2.point = pointRing; + clip2.lineStart = ringStart; + clip2.lineEnd = ringEnd; + segments2 = []; + polygon = []; + }, + polygonEnd: function() { + clip2.point = point2; + clip2.lineStart = lineStart; + clip2.lineEnd = lineEnd; + segments2 = merge$2(segments2); + var startInside = polygonContains(polygon, start); + if (segments2.length) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + clipRejoin(segments2, compareIntersection, startInside, interpolate2, sink); + } else if (startInside) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + } + if (polygonStarted) sink.polygonEnd(), polygonStarted = false; + segments2 = polygon = null; + }, + sphere: function() { + sink.polygonStart(); + sink.lineStart(); + interpolate2(null, null, 1, sink); + sink.lineEnd(); + sink.polygonEnd(); + } + }; + function point2(lambda, phi2) { + if (pointVisible(lambda, phi2)) sink.point(lambda, phi2); + } + function pointLine(lambda, phi2) { + line2.point(lambda, phi2); + } + function lineStart() { + clip2.point = pointLine; + line2.lineStart(); + } + function lineEnd() { + clip2.point = point2; + line2.lineEnd(); + } + function pointRing(lambda, phi2) { + ring.push([lambda, phi2]); + ringSink.point(lambda, phi2); + } + function ringStart() { + ringSink.lineStart(); + ring = []; + } + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringSink.lineEnd(); + var clean = ringSink.clean(), ringSegments = ringBuffer.result(), i, n = ringSegments.length, m2, segment, point3; + ring.pop(); + polygon.push(ring); + ring = null; + if (!n) return; + if (clean & 1) { + segment = ringSegments[0]; + if ((m2 = segment.length - 1) > 0) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + for (i = 0; i < m2; ++i) sink.point((point3 = segment[i])[0], point3[1]); + sink.lineEnd(); + } + return; + } + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + segments2.push(ringSegments.filter(validSegment)); + } + return clip2; + }; + } + function validSegment(segment) { + return segment.length > 1; + } + function compareIntersection(a2, b2) { + return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi$1 - epsilon$3 : halfPi$1 - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi$1 - epsilon$3 : halfPi$1 - b2[1]); + } + const clipAntimeridian = clip$1( + function() { + return true; + }, + clipAntimeridianLine, + clipAntimeridianInterpolate, + [-pi$1, -halfPi$1] + ); + function clipAntimeridianLine(stream2) { + var lambda02 = NaN, phi02 = NaN, sign0 = NaN, clean; + return { + lineStart: function() { + stream2.lineStart(); + clean = 1; + }, + point: function(lambda12, phi12) { + var sign1 = lambda12 > 0 ? pi$1 : -pi$1, delta = abs$1(lambda12 - lambda02); + if (abs$1(delta - pi$1) < epsilon$3) { + stream2.point(lambda02, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi$1 : -halfPi$1); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + stream2.point(lambda12, phi02); + clean = 0; + } else if (sign0 !== sign1 && delta >= pi$1) { + if (abs$1(lambda02 - sign0) < epsilon$3) lambda02 -= sign0 * epsilon$3; + if (abs$1(lambda12 - sign1) < epsilon$3) lambda12 -= sign1 * epsilon$3; + phi02 = clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12); + stream2.point(sign0, phi02); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(sign1, phi02); + clean = 0; + } + stream2.point(lambda02 = lambda12, phi02 = phi12); + sign0 = sign1; + }, + lineEnd: function() { + stream2.lineEnd(); + lambda02 = phi02 = NaN; + }, + clean: function() { + return 2 - clean; + } + }; + } + function clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12) { + var cosPhi02, cosPhi1, sinLambda0Lambda1 = sin$1(lambda02 - lambda12); + return abs$1(sinLambda0Lambda1) > epsilon$3 ? atan((sin$1(phi02) * (cosPhi1 = cos$1(phi12)) * sin$1(lambda12) - sin$1(phi12) * (cosPhi02 = cos$1(phi02)) * sin$1(lambda02)) / (cosPhi02 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2; + } + function clipAntimeridianInterpolate(from, to, direction, stream2) { + var phi2; + if (from == null) { + phi2 = direction * halfPi$1; + stream2.point(-pi$1, phi2); + stream2.point(0, phi2); + stream2.point(pi$1, phi2); + stream2.point(pi$1, 0); + stream2.point(pi$1, -phi2); + stream2.point(0, -phi2); + stream2.point(-pi$1, -phi2); + stream2.point(-pi$1, 0); + stream2.point(-pi$1, phi2); + } else if (abs$1(from[0] - to[0]) > epsilon$3) { + var lambda = from[0] < to[0] ? pi$1 : -pi$1; + phi2 = direction * lambda / 2; + stream2.point(-lambda, phi2); + stream2.point(0, phi2); + stream2.point(lambda, phi2); + } else { + stream2.point(to[0], to[1]); + } + } + function clipCircle(radius2) { + var cr2 = cos$1(radius2), delta = 2 * radians, smallRadius = cr2 > 0, notHemisphere = abs$1(cr2) > epsilon$3; + function interpolate2(from, to, direction, stream2) { + circleStream(stream2, radius2, delta, direction, from, to); + } + function visible(lambda, phi2) { + return cos$1(lambda) * cos$1(phi2) > cr2; + } + function clipLine2(stream2) { + var point0, c0, v0, v00, clean; + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(lambda, phi2) { + var point1 = [lambda, phi2], point2, v = visible(lambda, phi2), c2 = smallRadius ? v ? 0 : code(lambda, phi2) : v ? code(lambda + (lambda < 0 ? pi$1 : -pi$1), phi2) : 0; + if (!point0 && (v00 = v0 = v)) stream2.lineStart(); + if (v !== v0) { + point2 = intersect2(point0, point1); + if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) + point1[2] = 1; + } + if (v !== v0) { + clean = 0; + if (v) { + stream2.lineStart(); + point2 = intersect2(point1, point0); + stream2.point(point2[0], point2[1]); + } else { + point2 = intersect2(point0, point1); + stream2.point(point2[0], point2[1], 2); + stream2.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + if (!(c2 & c0) && (t = intersect2(point1, point0, true))) { + clean = 0; + if (smallRadius) { + stream2.lineStart(); + stream2.point(t[0][0], t[0][1]); + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + } else { + stream2.point(t[1][0], t[1][1]); + stream2.lineEnd(); + stream2.lineStart(); + stream2.point(t[0][0], t[0][1], 3); + } + } + } + if (v && (!point0 || !pointEqual(point0, point1))) { + stream2.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c2; + }, + lineEnd: function() { + if (v0) stream2.lineEnd(); + point0 = null; + }, + // Rejoin first and last segments if there were intersections and the first + // and last points were visible. + clean: function() { + return clean | (v00 && v0) << 1; + } + }; + } + function intersect2(a2, b2, two) { + var pa2 = cartesian(a2), pb = cartesian(b2); + var n1 = [1, 0, 0], n2 = cartesianCross(pa2, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; + if (!determinant) return !two && a2; + var c1 = cr2 * n2n2 / determinant, c2 = -cr2 * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A5 = cartesianScale(n1, c1), B2 = cartesianScale(n2, c2); + cartesianAddInPlace(A5, B2); + var u2 = n1xn2, w2 = cartesianDot(A5, u2), uu = cartesianDot(u2, u2), t22 = w2 * w2 - uu * (cartesianDot(A5, A5) - 1); + if (t22 < 0) return; + var t = sqrt$1(t22), q = cartesianScale(u2, (-w2 - t) / uu); + cartesianAddInPlace(q, A5); + q = spherical(q); + if (!two) return q; + var lambda02 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z; + if (lambda12 < lambda02) z = lambda02, lambda02 = lambda12, lambda12 = z; + var delta2 = lambda12 - lambda02, polar = abs$1(delta2 - pi$1) < epsilon$3, meridian = polar || delta2 < epsilon$3; + if (!polar && phi12 < phi02) z = phi02, phi02 = phi12, phi12 = z; + if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs$1(q[0] - lambda02) < epsilon$3 ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi$1 ^ (lambda02 <= q[0] && q[0] <= lambda12)) { + var q1 = cartesianScale(u2, (-w2 + t) / uu); + cartesianAddInPlace(q1, A5); + return [q, spherical(q1)]; + } + } + function code(lambda, phi2) { + var r = smallRadius ? radius2 : pi$1 - radius2, code2 = 0; + if (lambda < -r) code2 |= 1; + else if (lambda > r) code2 |= 2; + if (phi2 < -r) code2 |= 4; + else if (phi2 > r) code2 |= 8; + return code2; + } + return clip$1(visible, clipLine2, interpolate2, smallRadius ? [0, -radius2] : [-pi$1, radius2 - pi$1]); + } + function clipLine(a2, b2, x02, y02, x12, y12) { + var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r; + r = x02 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dx > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = x12 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dx > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + r = y02 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } else if (dy > 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } + r = y12 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t12) return; + if (r > t02) t02 = r; + } else if (dy > 0) { + if (r < t02) return; + if (r < t12) t12 = r; + } + if (t02 > 0) a2[0] = ax + t02 * dx, a2[1] = ay + t02 * dy; + if (t12 < 1) b2[0] = ax + t12 * dx, b2[1] = ay + t12 * dy; + return true; + } + var clipMax = 1e9, clipMin = -clipMax; + function clipRectangle(x02, y02, x12, y12) { + function visible(x2, y2) { + return x02 <= x2 && x2 <= x12 && y02 <= y2 && y2 <= y12; + } + function interpolate2(from, to, direction, stream2) { + var a2 = 0, a1 = 0; + if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { + do + stream2.point(a2 === 0 || a2 === 3 ? x02 : x12, a2 > 1 ? y12 : y02); + while ((a2 = (a2 + direction + 4) % 4) !== a1); + } else { + stream2.point(to[0], to[1]); + } + } + function corner(p, direction) { + return abs$1(p[0] - x02) < epsilon$3 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x12) < epsilon$3 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y02) < epsilon$3 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; + } + function compareIntersection2(a2, b2) { + return comparePoint(a2.x, b2.x); + } + function comparePoint(a2, b2) { + var ca = corner(a2, 1), cb = corner(b2, 1); + return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[0]; + } + return function(stream2) { + var activeStream = stream2, bufferStream = clipBuffer(), segments2, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; + var clipStream = { + point: point2, + lineStart, + lineEnd, + polygonStart, + polygonEnd + }; + function point2(x2, y2) { + if (visible(x2, y2)) activeStream.point(x2, y2); + } + function polygonInside() { + var winding = 0; + for (var i = 0, n = polygon.length; i < n; ++i) { + for (var ring2 = polygon[i], j = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j < m2; ++j) { + a0 = b0, a1 = b1, point3 = ring2[j], b0 = point3[0], b1 = point3[1]; + if (a1 <= y12) { + if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x02 - a0)) ++winding; + } else { + if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x02 - a0)) --winding; + } + } + } + return winding; + } + function polygonStart() { + activeStream = bufferStream, segments2 = [], polygon = [], clean = true; + } + function polygonEnd() { + var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments2 = merge$2(segments2)).length; + if (cleanInside || visible2) { + stream2.polygonStart(); + if (cleanInside) { + stream2.lineStart(); + interpolate2(null, null, 1, stream2); + stream2.lineEnd(); + } + if (visible2) { + clipRejoin(segments2, compareIntersection2, startInside, interpolate2, stream2); + } + stream2.polygonEnd(); + } + activeStream = stream2, segments2 = polygon = ring = null; + } + function lineStart() { + clipStream.point = linePoint2; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + function lineEnd() { + if (segments2) { + linePoint2(x__, y__); + if (v__ && v_) bufferStream.rejoin(); + segments2.push(bufferStream.result()); + } + clipStream.point = point2; + if (v_) activeStream.lineEnd(); + } + function linePoint2(x2, y2) { + var v = visible(x2, y2); + if (polygon) ring.push([x2, y2]); + if (first) { + x__ = x2, y__ = y2, v__ = v; + first = false; + if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + } + } else { + if (v && v_) activeStream.point(x2, y2); + else { + var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))]; + if (clipLine(a2, b2, x02, y02, x12, y12)) { + if (!v_) { + activeStream.lineStart(); + activeStream.point(a2[0], a2[1]); + } + activeStream.point(b2[0], b2[1]); + if (!v) activeStream.lineEnd(); + clean = false; + } else if (v) { + activeStream.lineStart(); + activeStream.point(x2, y2); + clean = false; + } + } + } + x_ = x2, y_ = y2, v_ = v; + } + return clipStream; + }; + } + function graticuleX(y02, y12, dy) { + var y2 = range$3(y02, y12 - epsilon$3, dy).concat(y12); + return function(x2) { + return y2.map(function(y3) { + return [x2, y3]; + }); + }; + } + function graticuleY(x02, x12, dx) { + var x2 = range$3(x02, x12 - epsilon$3, dx).concat(x12); + return function(y2) { + return x2.map(function(x3) { + return [x3, y2]; + }); + }; + } + function graticule() { + var x12, x02, X12, X02, y12, y02, Y12, Y02, dx = 10, dy = dx, DX = 90, DY = 360, x2, y2, X3, Y3, precision = 2.5; + function graticule2() { + return { type: "MultiLineString", coordinates: lines() }; + } + function lines() { + return range$3(ceil(X02 / DX) * DX, X12, DX).map(X3).concat(range$3(ceil(Y02 / DY) * DY, Y12, DY).map(Y3)).concat(range$3(ceil(x02 / dx) * dx, x12, dx).filter(function(x3) { + return abs$1(x3 % DX) > epsilon$3; + }).map(x2)).concat(range$3(ceil(y02 / dy) * dy, y12, dy).filter(function(y3) { + return abs$1(y3 % DY) > epsilon$3; + }).map(y2)); + } + graticule2.lines = function() { + return lines().map(function(coordinates) { + return { type: "LineString", coordinates }; + }); + }; + graticule2.outline = function() { + return { + type: "Polygon", + coordinates: [ + X3(X02).concat( + Y3(Y12).slice(1), + X3(X12).reverse().slice(1), + Y3(Y02).reverse().slice(1) + ) + ] + }; + }; + graticule2.extent = function(_) { + if (!arguments.length) return graticule2.extentMinor(); + return graticule2.extentMajor(_).extentMinor(_); + }; + graticule2.extentMajor = function(_) { + if (!arguments.length) return [[X02, Y02], [X12, Y12]]; + X02 = +_[0][0], X12 = +_[1][0]; + Y02 = +_[0][1], Y12 = +_[1][1]; + if (X02 > X12) _ = X02, X02 = X12, X12 = _; + if (Y02 > Y12) _ = Y02, Y02 = Y12, Y12 = _; + return graticule2.precision(precision); + }; + graticule2.extentMinor = function(_) { + if (!arguments.length) return [[x02, y02], [x12, y12]]; + x02 = +_[0][0], x12 = +_[1][0]; + y02 = +_[0][1], y12 = +_[1][1]; + if (x02 > x12) _ = x02, x02 = x12, x12 = _; + if (y02 > y12) _ = y02, y02 = y12, y12 = _; + return graticule2.precision(precision); + }; + graticule2.step = function(_) { + if (!arguments.length) return graticule2.stepMinor(); + return graticule2.stepMajor(_).stepMinor(_); + }; + graticule2.stepMajor = function(_) { + if (!arguments.length) return [DX, DY]; + DX = +_[0], DY = +_[1]; + return graticule2; + }; + graticule2.stepMinor = function(_) { + if (!arguments.length) return [dx, dy]; + dx = +_[0], dy = +_[1]; + return graticule2; + }; + graticule2.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x2 = graticuleX(y02, y12, 90); + y2 = graticuleY(x02, x12, precision); + X3 = graticuleX(Y02, Y12, 90); + Y3 = graticuleY(X02, X12, precision); + return graticule2; + }; + return graticule2.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]); + } + const identity$1 = (x2) => x2; + var areaSum = new Adder(), areaRingSum = new Adder(), x00$2, y00$2, x0$3, y0$3; + var areaStream = { + point: noop$2, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: function() { + areaStream.lineStart = areaRingStart; + areaStream.lineEnd = areaRingEnd; + }, + polygonEnd: function() { + areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$2; + areaSum.add(abs$1(areaRingSum)); + areaRingSum = new Adder(); + }, + result: function() { + var area2 = areaSum / 2; + areaSum = new Adder(); + return area2; + } + }; + function areaRingStart() { + areaStream.point = areaPointFirst; + } + function areaPointFirst(x2, y2) { + areaStream.point = areaPoint; + x00$2 = x0$3 = x2, y00$2 = y0$3 = y2; + } + function areaPoint(x2, y2) { + areaRingSum.add(y0$3 * x2 - x0$3 * y2); + x0$3 = x2, y0$3 = y2; + } + function areaRingEnd() { + areaPoint(x00$2, y00$2); + } + var x0$2 = Infinity, y0$2 = x0$2, x1 = -x0$2, y1 = x1; + var boundsStream = { + point: boundsPoint, + lineStart: noop$2, + lineEnd: noop$2, + polygonStart: noop$2, + polygonEnd: noop$2, + result: function() { + var bounds2 = [[x0$2, y0$2], [x1, y1]]; + x1 = y1 = -(y0$2 = x0$2 = Infinity); + return bounds2; + } + }; + function boundsPoint(x2, y2) { + if (x2 < x0$2) x0$2 = x2; + if (x2 > x1) x1 = x2; + if (y2 < y0$2) y0$2 = y2; + if (y2 > y1) y1 = y2; + } + var X0 = 0, Y0 = 0, Z0 = 0, X1 = 0, Y1 = 0, Z1 = 0, X2 = 0, Y2 = 0, Z2 = 0, x00$1, y00$1, x0$1, y0$1; + var centroidStream = { + point: centroidPoint, + lineStart: centroidLineStart, + lineEnd: centroidLineEnd, + polygonStart: function() { + centroidStream.lineStart = centroidRingStart; + centroidStream.lineEnd = centroidRingEnd; + }, + polygonEnd: function() { + centroidStream.point = centroidPoint; + centroidStream.lineStart = centroidLineStart; + centroidStream.lineEnd = centroidLineEnd; + }, + result: function() { + var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN]; + X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; + return centroid; + } + }; + function centroidPoint(x2, y2) { + X0 += x2; + Y0 += y2; + ++Z0; + } + function centroidLineStart() { + centroidStream.point = centroidPointFirstLine; + } + function centroidPointFirstLine(x2, y2) { + centroidStream.point = centroidPointLine; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidPointLine(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z = sqrt$1(dx * dx + dy * dy); + X1 += z * (x0$1 + x2) / 2; + Y1 += z * (y0$1 + y2) / 2; + Z1 += z; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function centroidLineEnd() { + centroidStream.point = centroidPoint; + } + function centroidRingStart() { + centroidStream.point = centroidPointFirstRing; + } + function centroidRingEnd() { + centroidPointRing(x00$1, y00$1); + } + function centroidPointFirstRing(x2, y2) { + centroidStream.point = centroidPointRing; + centroidPoint(x00$1 = x0$1 = x2, y00$1 = y0$1 = y2); + } + function centroidPointRing(x2, y2) { + var dx = x2 - x0$1, dy = y2 - y0$1, z = sqrt$1(dx * dx + dy * dy); + X1 += z * (x0$1 + x2) / 2; + Y1 += z * (y0$1 + y2) / 2; + Z1 += z; + z = y0$1 * x2 - x0$1 * y2; + X2 += z * (x0$1 + x2); + Y2 += z * (y0$1 + y2); + Z2 += z * 3; + centroidPoint(x0$1 = x2, y0$1 = y2); + } + function PathContext(context2) { + this._context = context2; + } + PathContext.prototype = { + _radius: 4.5, + pointRadius: function(_) { + return this._radius = _, this; + }, + polygonStart: function() { + this._line = 0; + }, + polygonEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line === 0) this._context.closePath(); + this._point = NaN; + }, + point: function(x2, y2) { + switch (this._point) { + case 0: { + this._context.moveTo(x2, y2); + this._point = 1; + break; + } + case 1: { + this._context.lineTo(x2, y2); + break; + } + default: { + this._context.moveTo(x2 + this._radius, y2); + this._context.arc(x2, y2, this._radius, 0, tau$1); + break; + } + } + }, + result: noop$2 + }; + var lengthSum = new Adder(), lengthRing, x00, y00, x0, y0; + var lengthStream = { + point: noop$2, + lineStart: function() { + lengthStream.point = lengthPointFirst; + }, + lineEnd: function() { + if (lengthRing) lengthPoint(x00, y00); + lengthStream.point = noop$2; + }, + polygonStart: function() { + lengthRing = true; + }, + polygonEnd: function() { + lengthRing = null; + }, + result: function() { + var length2 = +lengthSum; + lengthSum = new Adder(); + return length2; + } + }; + function lengthPointFirst(x2, y2) { + lengthStream.point = lengthPoint; + x00 = x0 = x2, y00 = y0 = y2; + } + function lengthPoint(x2, y2) { + x0 -= x2, y0 -= y2; + lengthSum.add(sqrt$1(x0 * x0 + y0 * y0)); + x0 = x2, y0 = y2; + } + let cacheDigits, cacheAppend, cacheRadius, cacheCircle; + class PathString { + constructor(digits) { + this._append = digits == null ? append : appendRound(digits); + this._radius = 4.5; + this._ = ""; + } + pointRadius(_) { + this._radius = +_; + return this; + } + polygonStart() { + this._line = 0; + } + polygonEnd() { + this._line = NaN; + } + lineStart() { + this._point = 0; + } + lineEnd() { + if (this._line === 0) this._ += "Z"; + this._point = NaN; + } + point(x2, y2) { + switch (this._point) { + case 0: { + this._append`M${x2},${y2}`; + this._point = 1; + break; + } + case 1: { + this._append`L${x2},${y2}`; + break; + } + default: { + this._append`M${x2},${y2}`; + if (this._radius !== cacheRadius || this._append !== cacheAppend) { + const r = this._radius; + const s = this._; + this._ = ""; + this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`; + cacheRadius = r; + cacheAppend = this._append; + cacheCircle = this._; + this._ = s; + } + this._ += cacheCircle; + break; + } + } + } + result() { + const result = this._; + this._ = ""; + return result.length ? result : null; + } + } + function append(strings) { + let i = 1; + this._ += strings[0]; + for (const j = strings.length; i < j; ++i) { + this._ += arguments[i] + strings[i]; + } + } + function appendRound(digits) { + const d = Math.floor(digits); + if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`); + if (d > 15) return append; + if (d !== cacheDigits) { + const k = 10 ** d; + cacheDigits = d; + cacheAppend = function append2(strings) { + let i = 1; + this._ += strings[0]; + for (const j = strings.length; i < j; ++i) { + this._ += Math.round(arguments[i] * k) / k + strings[i]; + } + }; + } + return cacheAppend; + } + function geoPath(projection2, context2) { + let digits = 3, pointRadius = 4.5, projectionStream, contextStream; + function path2(object2) { + if (object2) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + geoStream(object2, projectionStream(contextStream)); + } + return contextStream.result(); + } + path2.area = function(object2) { + geoStream(object2, projectionStream(areaStream)); + return areaStream.result(); + }; + path2.measure = function(object2) { + geoStream(object2, projectionStream(lengthStream)); + return lengthStream.result(); + }; + path2.bounds = function(object2) { + geoStream(object2, projectionStream(boundsStream)); + return boundsStream.result(); + }; + path2.centroid = function(object2) { + geoStream(object2, projectionStream(centroidStream)); + return centroidStream.result(); + }; + path2.projection = function(_) { + if (!arguments.length) return projection2; + projectionStream = _ == null ? (projection2 = null, identity$1) : (projection2 = _).stream; + return path2; + }; + path2.context = function(_) { + if (!arguments.length) return context2; + contextStream = _ == null ? (context2 = null, new PathString(digits)) : new PathContext(context2 = _); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return path2; + }; + path2.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path2; + }; + path2.digits = function(_) { + if (!arguments.length) return digits; + if (_ == null) digits = null; + else { + const d = Math.floor(_); + if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`); + digits = d; + } + if (context2 === null) contextStream = new PathString(digits); + return path2; + }; + return path2.projection(projection2).digits(digits).context(context2); + } + function transformer(methods2) { + return function(stream2) { + var s = new TransformStream(); + for (var key2 in methods2) s[key2] = methods2[key2]; + s.stream = stream2; + return s; + }; + } + function TransformStream() { + } + TransformStream.prototype = { + constructor: TransformStream, + point: function(x2, y2) { + this.stream.point(x2, y2); + }, + sphere: function() { + this.stream.sphere(); + }, + lineStart: function() { + this.stream.lineStart(); + }, + lineEnd: function() { + this.stream.lineEnd(); + }, + polygonStart: function() { + this.stream.polygonStart(); + }, + polygonEnd: function() { + this.stream.polygonEnd(); + } + }; + function fit$1(projection2, fitBounds, object2) { + var clip2 = projection2.clipExtent && projection2.clipExtent(); + projection2.scale(150).translate([0, 0]); + if (clip2 != null) projection2.clipExtent(null); + geoStream(object2, projection2.stream(boundsStream)); + fitBounds(boundsStream.result()); + if (clip2 != null) projection2.clipExtent(clip2); + return projection2; + } + function fitExtent(projection2, extent2, object2) { + return fit$1(projection2, function(b2) { + var w2 = extent2[1][0] - extent2[0][0], h2 = extent2[1][1] - extent2[0][1], k = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent2[0][0] + (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = +extent2[0][1] + (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitSize(projection2, size, object2) { + return fitExtent(projection2, [[0, 0], size], object2); + } + function fitWidth(projection2, width2, object2) { + return fit$1(projection2, function(b2) { + var w2 = +width2, k = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k * (b2[1][0] + b2[0][0])) / 2, y2 = -k * b2[0][1]; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + function fitHeight(projection2, height2, object2) { + return fit$1(projection2, function(b2) { + var h2 = +height2, k = h2 / (b2[1][1] - b2[0][1]), x2 = -k * b2[0][0], y2 = (h2 - k * (b2[1][1] + b2[0][1])) / 2; + projection2.scale(150 * k).translate([x2, y2]); + }, object2); + } + var maxDepth = 16, cosMinDistance = cos$1(30 * radians); + function resample(project2, delta2) { + return +delta2 ? resample$1(project2, delta2) : resampleNone(project2); + } + function resampleNone(project2) { + return transformer({ + point: function(x2, y2) { + x2 = project2(x2, y2); + this.stream.point(x2[0], x2[1]); + } + }); + } + function resample$1(project2, delta2) { + function resampleLineTo(x02, y02, lambda02, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream2) { + var dx = x12 - x02, dy = y12 - y02, d2 = dx * dx + dy * dy; + if (d2 > 4 * delta2 && depth--) { + var a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt$1(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin$1(c2 /= m2), lambda22 = abs$1(abs$1(c2) - 1) < epsilon$3 || abs$1(lambda02 - lambda12) < epsilon$3 ? (lambda02 + lambda12) / 2 : atan2(b2, a2), p = project2(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > delta2 || abs$1((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream2); + stream2.point(x2, y2); + resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream2); + } + } + } + return function(stream2) { + var lambda002, x002, y002, a00, b00, c00, lambda02, x02, y02, a0, b0, c0; + var resampleStream = { + point: point2, + lineStart, + lineEnd, + polygonStart: function() { + stream2.polygonStart(); + resampleStream.lineStart = ringStart; + }, + polygonEnd: function() { + stream2.polygonEnd(); + resampleStream.lineStart = lineStart; + } + }; + function point2(x2, y2) { + x2 = project2(x2, y2); + stream2.point(x2[0], x2[1]); + } + function lineStart() { + x02 = NaN; + resampleStream.point = linePoint2; + stream2.lineStart(); + } + function linePoint2(lambda, phi2) { + var c2 = cartesian([lambda, phi2]), p = project2(lambda, phi2); + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x02 = p[0], y02 = p[1], lambda02 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream2); + stream2.point(x02, y02); + } + function lineEnd() { + resampleStream.point = point2; + stream2.lineEnd(); + } + function ringStart() { + lineStart(); + resampleStream.point = ringPoint; + resampleStream.lineEnd = ringEnd; + } + function ringPoint(lambda, phi2) { + linePoint2(lambda002 = lambda, phi2), x002 = x02, y002 = y02, a00 = a0, b00 = b0, c00 = c0; + resampleStream.point = linePoint2; + } + function ringEnd() { + resampleLineTo(x02, y02, lambda02, a0, b0, c0, x002, y002, lambda002, a00, b00, c00, maxDepth, stream2); + resampleStream.lineEnd = lineEnd; + lineEnd(); + } + return resampleStream; + }; + } + var transformRadians = transformer({ + point: function(x2, y2) { + this.stream.point(x2 * radians, y2 * radians); + } + }); + function transformRotate(rotate2) { + return transformer({ + point: function(x2, y2) { + var r = rotate2(x2, y2); + return this.stream.point(r[0], r[1]); + } + }); + } + function scaleTranslate(k, dx, dy, sx, sy) { + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [dx + k * x2, dy - k * y2]; + } + transform2.invert = function(x2, y2) { + return [(x2 - dx) / k * sx, (dy - y2) / k * sy]; + }; + return transform2; + } + function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { + if (!alpha) return scaleTranslate(k, dx, dy, sx, sy); + var cosAlpha = cos$1(alpha), sinAlpha = sin$1(alpha), a2 = cosAlpha * k, b2 = sinAlpha * k, ai = cosAlpha / k, bi = sinAlpha / k, ci = (sinAlpha * dy - cosAlpha * dx) / k, fi = (sinAlpha * dx + cosAlpha * dy) / k; + function transform2(x2, y2) { + x2 *= sx; + y2 *= sy; + return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2]; + } + transform2.invert = function(x2, y2) { + return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)]; + }; + return transform2; + } + function projection$1(project2) { + return projectionMutator(function() { + return project2; + })(); + } + function projectionMutator(projectAt) { + var project2, k = 150, x2 = 480, y2 = 250, lambda = 0, phi2 = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate2, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity$1, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache2, cacheStream; + function projection2(point2) { + return projectRotateTransform(point2[0] * radians, point2[1] * radians); + } + function invert2(point2) { + point2 = projectRotateTransform.invert(point2[0], point2[1]); + return point2 && [point2[0] * degrees, point2[1] * degrees]; + } + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transformRadians(transformRotate(rotate2)(preclip(projectResample(postclip(cacheStream = stream2))))); + }; + projection2.preclip = function(_) { + return arguments.length ? (preclip = _, theta = void 0, reset2()) : preclip; + }; + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; + }; + projection2.clipAngle = function(_) { + return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset2()) : theta * degrees; + }; + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity$1) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + projection2.scale = function(_) { + return arguments.length ? (k = +_, recenter()) : k; + }; + projection2.translate = function(_) { + return arguments.length ? (x2 = +_[0], y2 = +_[1], recenter()) : [x2, y2]; + }; + projection2.center = function(_) { + return arguments.length ? (lambda = _[0] % 360 * radians, phi2 = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi2 * degrees]; + }; + projection2.rotate = function(_) { + return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; + }; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; + }; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; + }; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; + }; + projection2.precision = function(_) { + return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset2()) : sqrt$1(delta2); + }; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); + }; + projection2.fitSize = function(size, object2) { + return fitSize(projection2, size, object2); + }; + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); + }; + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); + }; + function recenter() { + var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project2(lambda, phi2)), transform2 = scaleTranslateRotate(k, x2 - center[0], y2 - center[1], sx, sy, alpha); + rotate2 = rotateRadians(deltaLambda, deltaPhi, deltaGamma); + projectTransform = compose(project2, transform2); + projectRotateTransform = compose(rotate2, projectTransform); + projectResample = resample(projectTransform, delta2); + return reset2(); + } + function reset2() { + cache2 = cacheStream = null; + return projection2; + } + return function() { + project2 = projectAt.apply(this, arguments); + projection2.invert = project2.invert && invert2; + return recenter(); + }; + } + function conicProjection(projectAt) { + var phi02 = 0, phi12 = pi$1 / 3, m2 = projectionMutator(projectAt), p = m2(phi02, phi12); + p.parallels = function(_) { + return arguments.length ? m2(phi02 = _[0] * radians, phi12 = _[1] * radians) : [phi02 * degrees, phi12 * degrees]; + }; + return p; + } + function cylindricalEqualAreaRaw(phi02) { + var cosPhi02 = cos$1(phi02); + function forward(lambda, phi2) { + return [lambda * cosPhi02, sin$1(phi2) / cosPhi02]; + } + forward.invert = function(x2, y2) { + return [x2 / cosPhi02, asin$1(y2 * cosPhi02)]; + }; + return forward; + } + function conicEqualAreaRaw(y02, y12) { + var sy0 = sin$1(y02), n = (sy0 + sin$1(y12)) / 2; + if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y02); + var c2 = 1 + sy0 * (2 * n - sy0), r0 = sqrt$1(c2) / n; + function project2(x2, y2) { + var r = sqrt$1(c2 - 2 * n * sin$1(y2)) / n; + return [r * sin$1(x2 *= n), r0 - r * cos$1(x2)]; + } + project2.invert = function(x2, y2) { + var r0y = r0 - y2, l = atan2(x2, abs$1(r0y)) * sign(r0y); + if (r0y * n < 0) + l -= pi$1 * sign(x2) * sign(r0y); + return [l / n, asin$1((c2 - (x2 * x2 + r0y * r0y) * n * n) / (2 * n))]; + }; + return project2; + } + function geoConicEqualArea() { + return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); + } + function geoAlbers() { + return geoConicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]); + } + function multiplex(streams) { + var n = streams.length; + return { + point: function(x2, y2) { + var i = -1; + while (++i < n) streams[i].point(x2, y2); + }, + sphere: function() { + var i = -1; + while (++i < n) streams[i].sphere(); + }, + lineStart: function() { + var i = -1; + while (++i < n) streams[i].lineStart(); + }, + lineEnd: function() { + var i = -1; + while (++i < n) streams[i].lineEnd(); + }, + polygonStart: function() { + var i = -1; + while (++i < n) streams[i].polygonStart(); + }, + polygonEnd: function() { + var i = -1; + while (++i < n) streams[i].polygonEnd(); + } + }; + } + function geoAlbersUsa() { + var cache2, cacheStream, lower48 = geoAlbers(), lower48Point, alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point2, pointStream = { point: function(x2, y2) { + point2 = [x2, y2]; + } }; + function albersUsa(coordinates) { + var x2 = coordinates[0], y2 = coordinates[1]; + return point2 = null, (lower48Point.point(x2, y2), point2) || (alaskaPoint.point(x2, y2), point2) || (hawaiiPoint.point(x2, y2), point2); + } + albersUsa.invert = function(coordinates) { + var k = lower48.scale(), t = lower48.translate(), x2 = (coordinates[0] - t[0]) / k, y2 = (coordinates[1] - t[1]) / k; + return (y2 >= 0.12 && y2 < 0.234 && x2 >= -0.425 && x2 < -0.214 ? alaska : y2 >= 0.166 && y2 < 0.234 && x2 >= -0.214 && x2 < -0.115 ? hawaii : lower48).invert(coordinates); + }; + albersUsa.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = multiplex([lower48.stream(cacheStream = stream2), alaska.stream(stream2), hawaii.stream(stream2)]); + }; + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_), alaska.precision(_), hawaii.precision(_); + return reset2(); + }; + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x2 = +_[0], y2 = +_[1]; + lower48Point = lower48.translate(_).clipExtent([[x2 - 0.455 * k, y2 - 0.238 * k], [x2 + 0.455 * k, y2 + 0.238 * k]]).stream(pointStream); + alaskaPoint = alaska.translate([x2 - 0.307 * k, y2 + 0.201 * k]).clipExtent([[x2 - 0.425 * k + epsilon$3, y2 + 0.12 * k + epsilon$3], [x2 - 0.214 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + hawaiiPoint = hawaii.translate([x2 - 0.205 * k, y2 + 0.212 * k]).clipExtent([[x2 - 0.214 * k + epsilon$3, y2 + 0.166 * k + epsilon$3], [x2 - 0.115 * k - epsilon$3, y2 + 0.234 * k - epsilon$3]]).stream(pointStream); + return reset2(); + }; + albersUsa.fitExtent = function(extent2, object2) { + return fitExtent(albersUsa, extent2, object2); + }; + albersUsa.fitSize = function(size, object2) { + return fitSize(albersUsa, size, object2); + }; + albersUsa.fitWidth = function(width2, object2) { + return fitWidth(albersUsa, width2, object2); + }; + albersUsa.fitHeight = function(height2, object2) { + return fitHeight(albersUsa, height2, object2); + }; + function reset2() { + cache2 = cacheStream = null; + return albersUsa; + } + return albersUsa.scale(1070); + } + function azimuthalRaw(scale2) { + return function(x2, y2) { + var cx = cos$1(x2), cy = cos$1(y2), k = scale2(cx * cy); + if (k === Infinity) return [2, 0]; + return [ + k * cy * sin$1(x2), + k * sin$1(y2) + ]; + }; + } + function azimuthalInvert(angle2) { + return function(x2, y2) { + var z = sqrt$1(x2 * x2 + y2 * y2), c2 = angle2(z), sc = sin$1(c2), cc = cos$1(c2); + return [ + atan2(x2 * sc, z * cc), + asin$1(z && y2 * sc / z) + ]; + }; + } + var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { + return sqrt$1(2 / (1 + cxcy)); + }); + azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { + return 2 * asin$1(z / 2); + }); + function geoAzimuthalEqualArea() { + return projection$1(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); + } + var azimuthalEquidistantRaw = azimuthalRaw(function(c2) { + return (c2 = acos(c2)) && c2 / sin$1(c2); + }); + azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { + return z; + }); + function geoAzimuthalEquidistant() { + return projection$1(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); + } + function mercatorRaw(lambda, phi2) { + return [lambda, log$1(tan((halfPi$1 + phi2) / 2))]; + } + mercatorRaw.invert = function(x2, y2) { + return [x2, 2 * atan(exp(y2)) - halfPi$1]; + }; + function geoMercator() { + return mercatorProjection(mercatorRaw).scale(961 / tau$1); + } + function mercatorProjection(project2) { + var m2 = projection$1(project2), center = m2.center, scale2 = m2.scale, translate2 = m2.translate, clipExtent = m2.clipExtent, x02 = null, y02, x12, y12; + m2.scale = function(_) { + return arguments.length ? (scale2(_), reclip()) : scale2(); + }; + m2.translate = function(_) { + return arguments.length ? (translate2(_), reclip()) : translate2(); + }; + m2.center = function(_) { + return arguments.length ? (center(_), reclip()) : center(); + }; + m2.clipExtent = function(_) { + return arguments.length ? (_ == null ? x02 = y02 = x12 = y12 = null : (x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + function reclip() { + var k = pi$1 * scale2(), t = m2(rotation(m2.rotate()).invert([0, 0])); + return clipExtent(x02 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project2 === mercatorRaw ? [[Math.max(t[0] - k, x02), y02], [Math.min(t[0] + k, x12), y12]] : [[x02, Math.max(t[1] - k, y02)], [x12, Math.min(t[1] + k, y12)]]); + } + return reclip(); + } + function tany(y2) { + return tan((halfPi$1 + y2) / 2); + } + function conicConformalRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : log$1(cy0 / cos$1(y12)) / log$1(tany(y12) / tany(y02)), f = cy0 * pow$1(tany(y02), n) / n; + if (!n) return mercatorRaw; + function project2(x2, y2) { + if (f > 0) { + if (y2 < -halfPi$1 + epsilon$3) y2 = -halfPi$1 + epsilon$3; + } else { + if (y2 > halfPi$1 - epsilon$3) y2 = halfPi$1 - epsilon$3; + } + var r = f / pow$1(tany(y2), n); + return [r * sin$1(n * x2), f - r * cos$1(n * x2)]; + } + project2.invert = function(x2, y2) { + var fy = f - y2, r = sign(n) * sqrt$1(x2 * x2 + fy * fy), l = atan2(x2, abs$1(fy)) * sign(fy); + if (fy * n < 0) + l -= pi$1 * sign(x2) * sign(fy); + return [l / n, 2 * atan(pow$1(f / r, 1 / n)) - halfPi$1]; + }; + return project2; + } + function geoConicConformal() { + return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); + } + function equirectangularRaw(lambda, phi2) { + return [lambda, phi2]; + } + equirectangularRaw.invert = equirectangularRaw; + function geoEquirectangular() { + return projection$1(equirectangularRaw).scale(152.63); + } + function conicEquidistantRaw(y02, y12) { + var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : (cy0 - cos$1(y12)) / (y12 - y02), g = cy0 / n + y02; + if (abs$1(n) < epsilon$3) return equirectangularRaw; + function project2(x2, y2) { + var gy = g - y2, nx = n * x2; + return [gy * sin$1(nx), g - gy * cos$1(nx)]; + } + project2.invert = function(x2, y2) { + var gy = g - y2, l = atan2(x2, abs$1(gy)) * sign(gy); + if (gy * n < 0) + l -= pi$1 * sign(x2) * sign(gy); + return [l / n, g - sign(n) * sqrt$1(x2 * x2 + gy * gy)]; + }; + return project2; + } + function geoConicEquidistant() { + return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); + } + var A1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt$1(3) / 2, iterations = 12; + function equalEarthRaw(lambda, phi2) { + var l = asin$1(M * sin$1(phi2)), l2 = l * l, l6 = l2 * l2 * l2; + return [ + lambda * cos$1(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), + l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) + ]; + } + equalEarthRaw.invert = function(x2, y2) { + var l = y2, l2 = l * l, l6 = l2 * l2 * l2; + for (var i = 0, delta, fy, fpy; i < iterations; ++i) { + fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y2; + fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); + l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; + if (abs$1(delta) < epsilon2) break; + } + return [ + M * x2 * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), + asin$1(sin$1(l) / M) + ]; + }; + function geoEqualEarth() { + return projection$1(equalEarthRaw).scale(177.158); + } + function gnomonicRaw(x2, y2) { + var cy = cos$1(y2), k = cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + gnomonicRaw.invert = azimuthalInvert(atan); + function geoGnomonic() { + return projection$1(gnomonicRaw).scale(144.049).clipAngle(60); + } + function geoIdentity() { + var k = 1, tx2 = 0, ty2 = 0, sx = 1, sy = 1, alpha = 0, ca, sa2, x02 = null, y02, x12, y12, kx = 1, ky = 1, transform2 = transformer({ + point: function(x2, y2) { + var p = projection2([x2, y2]); + this.stream.point(p[0], p[1]); + } + }), postclip = identity$1, cache2, cacheStream; + function reset2() { + kx = k * sx; + ky = k * sy; + cache2 = cacheStream = null; + return projection2; + } + function projection2(p) { + var x2 = p[0] * kx, y2 = p[1] * ky; + if (alpha) { + var t = y2 * ca - x2 * sa2; + x2 = x2 * ca + y2 * sa2; + y2 = t; + } + return [x2 + tx2, y2 + ty2]; + } + projection2.invert = function(p) { + var x2 = p[0] - tx2, y2 = p[1] - ty2; + if (alpha) { + var t = y2 * ca + x2 * sa2; + x2 = x2 * ca - y2 * sa2; + y2 = t; + } + return [x2 / kx, y2 / ky]; + }; + projection2.stream = function(stream2) { + return cache2 && cacheStream === stream2 ? cache2 : cache2 = transform2(postclip(cacheStream = stream2)); + }; + projection2.postclip = function(_) { + return arguments.length ? (postclip = _, x02 = y02 = x12 = y12 = null, reset2()) : postclip; + }; + projection2.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x02 = y02 = x12 = y12 = null, identity$1) : clipRectangle(x02 = +_[0][0], y02 = +_[0][1], x12 = +_[1][0], y12 = +_[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; + }; + projection2.scale = function(_) { + return arguments.length ? (k = +_, reset2()) : k; + }; + projection2.translate = function(_) { + return arguments.length ? (tx2 = +_[0], ty2 = +_[1], reset2()) : [tx2, ty2]; + }; + projection2.angle = function(_) { + return arguments.length ? (alpha = _ % 360 * radians, sa2 = sin$1(alpha), ca = cos$1(alpha), reset2()) : alpha * degrees; + }; + projection2.reflectX = function(_) { + return arguments.length ? (sx = _ ? -1 : 1, reset2()) : sx < 0; + }; + projection2.reflectY = function(_) { + return arguments.length ? (sy = _ ? -1 : 1, reset2()) : sy < 0; + }; + projection2.fitExtent = function(extent2, object2) { + return fitExtent(projection2, extent2, object2); + }; + projection2.fitSize = function(size, object2) { + return fitSize(projection2, size, object2); + }; + projection2.fitWidth = function(width2, object2) { + return fitWidth(projection2, width2, object2); + }; + projection2.fitHeight = function(height2, object2) { + return fitHeight(projection2, height2, object2); + }; + return projection2; + } + function naturalEarth1Raw(lambda, phi2) { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; + return [ + lambda * (0.8707 - 0.131979 * phi22 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi22 - 1529e-6 * phi4))), + phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) + ]; + } + naturalEarth1Raw.invert = function(x2, y2) { + var phi2 = y2, i = 25, delta; + do { + var phi22 = phi2 * phi2, phi4 = phi22 * phi22; + phi2 -= delta = (phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) - y2) / (1.007226 + phi22 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi22 - 5916e-6 * 11 * phi4))); + } while (abs$1(delta) > epsilon$3 && --i > 0); + return [ + x2 / (0.8707 + (phi22 = phi2 * phi2) * (-0.131979 + phi22 * (-0.013791 + phi22 * phi22 * phi22 * (3971e-6 - 1529e-6 * phi22)))), + phi2 + ]; + }; + function geoNaturalEarth1() { + return projection$1(naturalEarth1Raw).scale(175.295); + } + function orthographicRaw(x2, y2) { + return [cos$1(y2) * sin$1(x2), sin$1(y2)]; + } + orthographicRaw.invert = azimuthalInvert(asin$1); + function geoOrthographic() { + return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3); + } + function stereographicRaw(x2, y2) { + var cy = cos$1(y2), k = 1 + cos$1(x2) * cy; + return [cy * sin$1(x2) / k, sin$1(y2) / k]; + } + stereographicRaw.invert = azimuthalInvert(function(z) { + return 2 * atan(z); + }); + function geoStereographic() { + return projection$1(stereographicRaw).scale(250).clipAngle(142); + } + function transverseMercatorRaw(lambda, phi2) { + return [log$1(tan((halfPi$1 + phi2) / 2)), -lambda]; + } + transverseMercatorRaw.invert = function(x2, y2) { + return [-y2, 2 * atan(exp(x2)) - halfPi$1]; + }; + function geoTransverseMercator() { + var m2 = mercatorProjection(transverseMercatorRaw), center = m2.center, rotate2 = m2.rotate; + m2.center = function(_) { + return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); + }; + m2.rotate = function(_) { + return arguments.length ? rotate2([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate2(), [_[0], _[1], _[2] - 90]); + }; + return rotate2([0, 0, 90]).scale(159.155); + } + var abs = Math.abs; + var cos = Math.cos; + var sin = Math.sin; + var epsilon$2 = 1e-6; + var pi = Math.PI; + var halfPi = pi / 2; + var sqrt2 = sqrt(2); + function asin(x2) { + return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2); + } + function sqrt(x2) { + return x2 > 0 ? Math.sqrt(x2) : 0; + } + function mollweideBromleyTheta(cp, phi2) { + var cpsinPhi = cp * sin(phi2), i = 30, delta; + do + phi2 -= delta = (phi2 + sin(phi2) - cpsinPhi) / (1 + cos(phi2)); + while (abs(delta) > epsilon$2 && --i > 0); + return phi2 / 2; + } + function mollweideBromleyRaw(cx, cy, cp) { + function forward(lambda, phi2) { + return [cx * lambda * cos(phi2 = mollweideBromleyTheta(cp, phi2)), cy * sin(phi2)]; + } + forward.invert = function(x2, y2) { + return y2 = asin(y2 / cy), [x2 / (cx * cos(y2)), asin((2 * y2 + sin(2 * y2)) / cp)]; + }; + return forward; + } + var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi); + function geoMollweide() { + return projection$1(mollweideRaw).scale(169.529); + } + const defaultPath = geoPath(); + const projectionProperties = [ + // standard properties in d3-geo + "clipAngle", + "clipExtent", + "scale", + "translate", + "center", + "rotate", + "parallels", + "precision", + "reflectX", + "reflectY", + // extended properties in d3-geo-projections + "coefficient", + "distance", + "fraction", + "lobes", + "parallel", + "radius", + "ratio", + "spacing", + "tilt" + ]; + function create$7(type2, constructor) { + return function projection2() { + const p = constructor(); + p.type = type2; + p.path = geoPath().projection(p); + p.copy = p.copy || function() { + const c2 = projection2(); + projectionProperties.forEach((prop) => { + if (p[prop]) c2[prop](p[prop]()); + }); + c2.path.pointRadius(p.path.pointRadius()); + return c2; + }; + return registerScale(p); + }; + } + function projection(type2, proj) { + if (!type2 || typeof type2 !== "string") { + throw new Error("Projection type must be a name string."); + } + type2 = type2.toLowerCase(); + if (arguments.length > 1) { + projections[type2] = create$7(type2, proj); + return this; + } else { + return projections[type2] || null; + } + } + function getProjectionPath(proj) { + return proj && proj.path || defaultPath; + } + const projections = { + // base d3-geo projection types + albers: geoAlbers, + albersusa: geoAlbersUsa, + azimuthalequalarea: geoAzimuthalEqualArea, + azimuthalequidistant: geoAzimuthalEquidistant, + conicconformal: geoConicConformal, + conicequalarea: geoConicEqualArea, + conicequidistant: geoConicEquidistant, + equalEarth: geoEqualEarth, + equirectangular: geoEquirectangular, + gnomonic: geoGnomonic, + identity: geoIdentity, + mercator: geoMercator, + mollweide: geoMollweide, + naturalEarth1: geoNaturalEarth1, + orthographic: geoOrthographic, + stereographic: geoStereographic, + transversemercator: geoTransverseMercator + }; + for (const key2 in projections) { + projection(key2, projections[key2]); + } + function noop$1() { + } + const cases = [[], [[[1, 1.5], [0.5, 1]]], [[[1.5, 1], [1, 1.5]]], [[[1.5, 1], [0.5, 1]]], [[[1, 0.5], [1.5, 1]]], [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]], [[[1, 0.5], [1, 1.5]]], [[[1, 0.5], [0.5, 1]]], [[[0.5, 1], [1, 0.5]]], [[[1, 1.5], [1, 0.5]]], [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]], [[[1.5, 1], [1, 0.5]]], [[[0.5, 1], [1.5, 1]]], [[[1, 1.5], [1.5, 1]]], [[[0.5, 1], [1, 1.5]]], []]; + function contours() { + var dx = 1, dy = 1, smooth = smoothLinear; + function contours2(values2, tz) { + return tz.map((value2) => contour(values2, value2)); + } + function contour(values2, value2) { + var polygons = [], holes = []; + isorings(values2, value2, (ring) => { + smooth(ring, values2, value2); + if (area(ring) > 0) polygons.push([ring]); + else holes.push(ring); + }); + holes.forEach((hole) => { + for (var i = 0, n = polygons.length, polygon; i < n; ++i) { + if (contains((polygon = polygons[i])[0], hole) !== -1) { + polygon.push(hole); + return; + } + } + }); + return { + type: "MultiPolygon", + value: value2, + coordinates: polygons + }; + } + function isorings(values2, value2, callback) { + var fragmentByStart = [], fragmentByEnd = [], x2, y2, t02, t12, t22, t32; + x2 = y2 = -1; + t12 = values2[0] >= value2; + cases[t12 << 1].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[x2 + 1] >= value2; + cases[t02 | t12 << 1].forEach(stitch2); + } + cases[t12 << 0].forEach(stitch2); + while (++y2 < dy - 1) { + x2 = -1; + t12 = values2[y2 * dx + dx] >= value2; + t22 = values2[y2 * dx] >= value2; + cases[t12 << 1 | t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t02 = t12, t12 = values2[y2 * dx + dx + x2 + 1] >= value2; + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t02 | t12 << 1 | t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t12 | t22 << 3].forEach(stitch2); + } + x2 = -1; + t22 = values2[y2 * dx] >= value2; + cases[t22 << 2].forEach(stitch2); + while (++x2 < dx - 1) { + t32 = t22, t22 = values2[y2 * dx + x2 + 1] >= value2; + cases[t22 << 2 | t32 << 3].forEach(stitch2); + } + cases[t22 << 3].forEach(stitch2); + function stitch2(line2) { + var start = [line2[0][0] + x2, line2[0][1] + y2], end = [line2[1][0] + x2, line2[1][1] + y2], startIndex = index2(start), endIndex = index2(end), f, g; + if (f = fragmentByEnd[startIndex]) { + if (g = fragmentByStart[endIndex]) { + delete fragmentByEnd[f.end]; + delete fragmentByStart[g.start]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[f.start] = fragmentByEnd[g.end] = { + start: f.start, + end: g.end, + ring: f.ring.concat(g.ring) + }; + } + } else { + delete fragmentByEnd[f.end]; + f.ring.push(end); + fragmentByEnd[f.end = endIndex] = f; + } + } else if (f = fragmentByStart[endIndex]) { + if (g = fragmentByEnd[startIndex]) { + delete fragmentByStart[f.start]; + delete fragmentByEnd[g.end]; + if (f === g) { + f.ring.push(end); + callback(f.ring); + } else { + fragmentByStart[g.start] = fragmentByEnd[f.end] = { + start: g.start, + end: f.end, + ring: g.ring.concat(f.ring) + }; + } + } else { + delete fragmentByStart[f.start]; + f.ring.unshift(start); + fragmentByStart[f.start = startIndex] = f; + } + } else { + fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { + start: startIndex, + end: endIndex, + ring: [start, end] + }; + } + } + } + function index2(point2) { + return point2[0] * 2 + point2[1] * (dx + 1) * 4; + } + function smoothLinear(ring, values2, value2) { + ring.forEach((point2) => { + var x2 = point2[0], y2 = point2[1], xt = x2 | 0, yt = y2 | 0, v0, v1 = values2[yt * dx + xt]; + if (x2 > 0 && x2 < dx && xt === x2) { + v0 = values2[yt * dx + xt - 1]; + point2[0] = x2 + (value2 - v0) / (v1 - v0) - 0.5; + } + if (y2 > 0 && y2 < dy && yt === y2) { + v0 = values2[(yt - 1) * dx + xt]; + point2[1] = y2 + (value2 - v0) / (v1 - v0) - 0.5; + } + }); + } + contours2.contour = contour; + contours2.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = Math.floor(_[0]), _1 = Math.floor(_[1]); + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, contours2; + }; + contours2.smooth = function(_) { + return arguments.length ? (smooth = _ ? smoothLinear : noop$1, contours2) : smooth === smoothLinear; + }; + return contours2; + } + function area(ring) { + var i = 0, n = ring.length, area2 = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; + while (++i < n) area2 += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; + return area2; + } + function contains(ring, hole) { + var i = -1, n = hole.length, c2; + while (++i < n) if (c2 = ringContains(ring, hole[i])) return c2; + return 0; + } + function ringContains(ring, point2) { + var x2 = point2[0], y2 = point2[1], contains2 = -1; + for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { + var pi2 = ring[i], xi = pi2[0], yi = pi2[1], pj = ring[j], xj = pj[0], yj = pj[1]; + if (segmentContains(pi2, pj, point2)) return 0; + if (yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi) contains2 = -contains2; + } + return contains2; + } + function segmentContains(a2, b2, c2) { + var i; + return collinear$1(a2, b2, c2) && within(a2[i = +(a2[0] === b2[0])], c2[i], b2[i]); + } + function collinear$1(a2, b2, c2) { + return (b2[0] - a2[0]) * (c2[1] - a2[1]) === (c2[0] - a2[0]) * (b2[1] - a2[1]); + } + function within(p, q, r) { + return p <= q && q <= r || r <= q && q <= p; + } + function quantize(k, nice2, zero2) { + return function(values2) { + var ex = extent(values2), start = zero2 ? Math.min(ex[0], 0) : ex[0], stop2 = ex[1], span2 = stop2 - start, step = nice2 ? tickStep(start, stop2, k) : span2 / (k + 1); + return range$3(start + step, stop2, step); + }; + } + function Isocontour(params2) { + Transform.call(this, null, params2); + } + Isocontour.Definition = { + "type": "Isocontour", + "metadata": { + "generates": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "levels", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "zero", + "type": "boolean", + "default": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }, { + "name": "scale", + "type": "number", + "expr": true + }, { + "name": "translate", + "type": "number", + "array": true, + "expr": true + }, { + "name": "as", + "type": "string", + "null": true, + "default": "contour" + }] + }; + inherits(Isocontour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, field2 = _.field || identity$7, contour = contours().smooth(_.smooth !== false), tz = _.thresholds || levels(source2, field2, _), as = _.as === null ? null : _.as || "contour", values2 = []; + source2.forEach((t) => { + const grid = field2(t); + const paths = contour.size([grid.width, grid.height])(grid.values, isArray(tz) ? tz : tz(grid.values)); + transformPaths(paths, grid, t, _); + paths.forEach((p) => { + values2.push(rederive(t, ingest$1(as != null ? { + [as]: p + } : p))); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; + } + }); + function levels(values2, f, _) { + const q = quantize(_.levels || 10, _.nice, _.zero !== false); + return _.resolve !== "shared" ? q : q(values2.map((t) => max$3(f(t).values))); + } + function transformPaths(paths, grid, datum2, _) { + let s = _.scale || grid.scale, t = _.translate || grid.translate; + if (isFunction(s)) s = s(datum2, _); + if (isFunction(t)) t = t(datum2, _); + if ((s === 1 || s == null) && !t) return; + const sx = (isNumber$1(s) ? s : s[0]) || 1, sy = (isNumber$1(s) ? s : s[1]) || 1, tx2 = t && t[0] || 0, ty2 = t && t[1] || 0; + paths.forEach(transform$1(grid, sx, sy, tx2, ty2)); + } + function transform$1(grid, sx, sy, tx2, ty2) { + const x12 = grid.x1 || 0, y12 = grid.y1 || 0, flip2 = sx * sy < 0; + function transformPolygon(coordinates) { + coordinates.forEach(transformRing); + } + function transformRing(coordinates) { + if (flip2) coordinates.reverse(); + coordinates.forEach(transformPoint); + } + function transformPoint(coordinates) { + coordinates[0] = (coordinates[0] - x12) * sx + tx2; + coordinates[1] = (coordinates[1] - y12) * sy + ty2; + } + return function(geometry) { + geometry.coordinates.forEach(transformPolygon); + return geometry; + }; + } + function radius(bw, data2, f) { + const v = bw >= 0 ? bw : estimateBandwidth(data2, f); + return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2); + } + function number$2(_) { + return isFunction(_) ? _ : constant$5(+_); + } + function density2D() { + var x2 = (d) => d[0], y2 = (d) => d[1], weight = one$2, bandwidth2 = [-1, -1], dx = 960, dy = 500, k = 2; + function density(data2, counts) { + const rx = radius(bandwidth2[0], data2, x2) >> k, ry = radius(bandwidth2[1], data2, y2) >> k, ox = rx ? rx + 2 : 0, oy = ry ? ry + 2 : 0, n = 2 * ox + (dx >> k), m2 = 2 * oy + (dy >> k), values0 = new Float32Array(n * m2), values1 = new Float32Array(n * m2); + let values2 = values0; + data2.forEach((d) => { + const xi = ox + (+x2(d) >> k), yi = oy + (+y2(d) >> k); + if (xi >= 0 && xi < n && yi >= 0 && yi < m2) { + values0[xi + yi * n] += +weight(d); + } + }); + if (rx > 0 && ry > 0) { + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + blurX(n, m2, values0, values1, rx); + blurY(n, m2, values1, values0, ry); + } else if (rx > 0) { + blurX(n, m2, values0, values1, rx); + blurX(n, m2, values1, values0, rx); + blurX(n, m2, values0, values1, rx); + values2 = values1; + } else if (ry > 0) { + blurY(n, m2, values0, values1, ry); + blurY(n, m2, values1, values0, ry); + blurY(n, m2, values0, values1, ry); + values2 = values1; + } + const s = counts ? Math.pow(2, -2 * k) : 1 / sum$1(values2); + for (let i = 0, sz2 = n * m2; i < sz2; ++i) values2[i] *= s; + return { + values: values2, + scale: 1 << k, + width: n, + height: m2, + x1: ox, + y1: oy, + x2: ox + (dx >> k), + y2: oy + (dy >> k) + }; + } + density.x = function(_) { + return arguments.length ? (x2 = number$2(_), density) : x2; + }; + density.y = function(_) { + return arguments.length ? (y2 = number$2(_), density) : y2; + }; + density.weight = function(_) { + return arguments.length ? (weight = number$2(_), density) : weight; + }; + density.size = function(_) { + if (!arguments.length) return [dx, dy]; + var _0 = +_[0], _1 = +_[1]; + if (!(_0 >= 0 && _1 >= 0)) error("invalid size"); + return dx = _0, dy = _1, density; + }; + density.cellSize = function(_) { + if (!arguments.length) return 1 << k; + if (!((_ = +_) >= 1)) error("invalid cell size"); + k = Math.floor(Math.log(_) / Math.LN2); + return density; + }; + density.bandwidth = function(_) { + if (!arguments.length) return bandwidth2; + _ = array$5(_); + if (_.length === 1) _ = [+_[0], +_[0]]; + if (_.length !== 2) error("invalid bandwidth"); + return bandwidth2 = _, density; + }; + return density; + } + function blurX(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let j = 0; j < m2; ++j) { + for (let i = 0, sr = 0; i < n + r; ++i) { + if (i < n) { + sr += source2[i + j * n]; + } + if (i >= r) { + if (i >= w2) { + sr -= source2[i - w2 + j * n]; + } + target2[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w2 - i, w2); + } + } + } + } + function blurY(n, m2, source2, target2, r) { + const w2 = (r << 1) + 1; + for (let i = 0; i < n; ++i) { + for (let j = 0, sr = 0; j < m2 + r; ++j) { + if (j < m2) { + sr += source2[i + j * n]; + } + if (j >= r) { + if (j >= w2) { + sr -= source2[i + (j - w2) * n]; + } + target2[i + (j - r) * n] = sr / Math.min(j + 1, m2 - 1 + w2 - j, w2); + } + } + } + } + function KDE2D(params2) { + Transform.call(this, null, params2); + } + KDE2D.Definition = { + "type": "KDE2D", + "metadata": { + "generates": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "weight", + "type": "field" + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "counts", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "default": "grid" + }] + }; + const PARAMS = ["x", "y", "weight", "size", "cellSize", "bandwidth"]; + function params(obj, _) { + PARAMS.forEach((param2) => _[param2] != null ? obj[param2](_[param2]) : 0); + return obj; + } + inherits(KDE2D, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) return pulse2.StopPropagation; + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition$2(source2, _.groupby), names = (_.groupby || []).map(accessorName), kde2 = params(density2D(), _), as = _.as || "grid", values2 = []; + function set2(t, vals) { + for (let i = 0; i < names.length; ++i) t[names[i]] = vals[i]; + return t; + } + values2 = groups.map((g) => ingest$1(set2({ + [as]: kde2(g, _.counts) + }, g.dims))); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = values2; + return out; + } + }); + function partition$2(data2, groupby) { + var groups = [], get2 = (f) => f(t), map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); + } + g.push(t); + } + } + return groups; + } + function Contour(params2) { + Transform.call(this, null, params2); + } + Contour.Definition = { + "type": "Contour", + "metadata": { + "generates": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2, + "required": true + }, { + "name": "values", + "type": "number", + "array": true + }, { + "name": "x", + "type": "field" + }, { + "name": "y", + "type": "field" + }, { + "name": "weight", + "type": "field" + }, { + "name": "cellSize", + "type": "number" + }, { + "name": "bandwidth", + "type": "number" + }, { + "name": "count", + "type": "number" + }, { + "name": "nice", + "type": "boolean", + "default": false + }, { + "name": "thresholds", + "type": "number", + "array": true + }, { + "name": "smooth", + "type": "boolean", + "default": true + }] + }; + inherits(Contour, Transform, { + transform(_, pulse2) { + if (this.value && !pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS), contour = contours().smooth(_.smooth !== false), values2 = _.values, thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values2), size = _.size, grid, post; + if (!values2) { + values2 = pulse2.materialize(pulse2.SOURCE).source; + grid = params(density2D(), _)(values2, true); + post = transform$1(grid, grid.scale || 1, grid.scale || 1, 0, 0); + size = [grid.width, grid.height]; + values2 = grid.values; + } + thresh = isArray(thresh) ? thresh : thresh(values2); + values2 = contour.size(size)(values2, thresh); + if (post) values2.forEach(post); + if (this.value) out.rem = this.value; + this.value = out.source = out.add = (values2 || []).map(ingest$1); + return out; + } + }); + const Feature = "Feature"; + const FeatureCollection = "FeatureCollection"; + const MultiPoint = "MultiPoint"; + function GeoJSON(params2) { + Transform.call(this, null, params2); + } + GeoJSON.Definition = { + "type": "GeoJSON", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "length": 2 + }, { + "name": "geojson", + "type": "field" + }] + }; + inherits(GeoJSON, Transform, { + transform(_, pulse2) { + var features = this._features, points2 = this._points, fields = _.fields, lon = fields && fields[0], lat = fields && fields[1], geojson = _.geojson || !fields && identity$7, flag2 = pulse2.ADD, mod; + mod = _.modified() || pulse2.changed(pulse2.REM) || pulse2.modified(accessorFields(geojson)) || lon && pulse2.modified(accessorFields(lon)) || lat && pulse2.modified(accessorFields(lat)); + if (!this.value || mod) { + flag2 = pulse2.SOURCE; + this._features = features = []; + this._points = points2 = []; + } + if (geojson) { + pulse2.visit(flag2, (t) => features.push(geojson(t))); + } + if (lon && lat) { + pulse2.visit(flag2, (t) => { + var x2 = lon(t), y2 = lat(t); + if (x2 != null && y2 != null && (x2 = +x2) === x2 && (y2 = +y2) === y2) { + points2.push([x2, y2]); + } + }); + features = features.concat({ + type: Feature, + geometry: { + type: MultiPoint, + coordinates: points2 + } + }); + } + this.value = { + type: FeatureCollection, + features + }; + } + }); + function GeoPath(params2) { + Transform.call(this, null, params2); + } + GeoPath.Definition = { + "type": "GeoPath", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + inherits(GeoPath, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), path2 = this.value, field2 = _.field || identity$7, as = _.as || "path", flag2 = out.SOURCE; + if (!path2 || _.modified()) { + this.value = path2 = getProjectionPath(_.projection); + out.materialize().reflow(); + } else { + flag2 = field2 === identity$7 || pulse2.modified(field2.fields) ? out.ADD_MOD : out.ADD; + } + const prev = initPath(path2, _.pointRadius); + out.visit(flag2, (t) => t[as] = path2(field2(t))); + path2.pointRadius(prev); + return out.modifies(as); + } + }); + function initPath(path2, pointRadius) { + const prev = path2.pointRadius(); + path2.context(null); + if (pointRadius != null) { + path2.pointRadius(pointRadius); + } + return prev; + } + function GeoPoint(params2) { + Transform.call(this, null, params2); + } + GeoPoint.Definition = { + "type": "GeoPoint", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "projection", + "type": "projection", + "required": true + }, { + "name": "fields", + "type": "field", + "array": true, + "required": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": 2, + "default": ["x", "y"] + }] + }; + inherits(GeoPoint, Transform, { + transform(_, pulse2) { + var proj = _.projection, lon = _.fields[0], lat = _.fields[1], as = _.as || ["x", "y"], x2 = as[0], y2 = as[1], mod; + function set2(t) { + const xy = proj([lon(t), lat(t)]); + if (xy) { + t[x2] = xy[0]; + t[y2] = xy[1]; + } else { + t[x2] = void 0; + t[y2] = void 0; + } + } + if (_.modified()) { + pulse2 = pulse2.materialize().reflow(true).visit(pulse2.SOURCE, set2); + } else { + mod = pulse2.modified(lon.fields) || pulse2.modified(lat.fields); + pulse2.visit(mod ? pulse2.ADD_MOD : pulse2.ADD, set2); + } + return pulse2.modifies(as); + } + }); + function GeoShape(params2) { + Transform.call(this, null, params2); + } + GeoShape.Definition = { + "type": "GeoShape", + "metadata": { + "modifies": true, + "nomod": true + }, + "params": [{ + "name": "projection", + "type": "projection" + }, { + "name": "field", + "type": "field", + "default": "datum" + }, { + "name": "pointRadius", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "default": "shape" + }] + }; + inherits(GeoShape, Transform, { + transform(_, pulse2) { + var out = pulse2.fork(pulse2.ALL), shape2 = this.value, as = _.as || "shape", flag2 = out.ADD; + if (!shape2 || _.modified()) { + this.value = shape2 = shapeGenerator(getProjectionPath(_.projection), _.field || field$1("datum"), _.pointRadius); + out.materialize().reflow(); + flag2 = out.SOURCE; + } + out.visit(flag2, (t) => t[as] = shape2); + return out.modifies(as); + } + }); + function shapeGenerator(path2, field2, pointRadius) { + const shape2 = pointRadius == null ? (_) => path2(field2(_)) : (_) => { + var prev = path2.pointRadius(), value2 = path2.pointRadius(pointRadius)(field2(_)); + path2.pointRadius(prev); + return value2; + }; + shape2.context = (_) => { + path2.context(_); + return shape2; + }; + return shape2; + } + function Graticule(params2) { + Transform.call(this, [], params2); + this.generator = graticule(); + } + Graticule.Definition = { + "type": "Graticule", + "metadata": { + "changes": true, + "generates": true + }, + "params": [{ + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMajor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "extentMinor", + "type": "array", + "array": true, + "length": 2, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "step", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "stepMajor", + "type": "number", + "array": true, + "length": 2, + "default": [90, 360] + }, { + "name": "stepMinor", + "type": "number", + "array": true, + "length": 2, + "default": [10, 10] + }, { + "name": "precision", + "type": "number", + "default": 2.5 + }] + }; + inherits(Graticule, Transform, { + transform(_, pulse2) { + var src = this.value, gen = this.generator, t; + if (!src.length || _.modified()) { + for (const prop in _) { + if (isFunction(gen[prop])) { + gen[prop](_[prop]); + } + } + } + t = gen(); + if (src.length) { + pulse2.mod.push(replace$1(src[0], t)); + } else { + pulse2.add.push(ingest$1(t)); + } + src[0] = t; + return pulse2; + } + }); + function Heatmap(params2) { + Transform.call(this, null, params2); + } + Heatmap.Definition = { + "type": "heatmap", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "color", + "type": "string", + "expr": true + }, { + "name": "opacity", + "type": "number", + "expr": true + }, { + "name": "resolve", + "type": "enum", + "values": ["shared", "independent"], + "default": "independent" + }, { + "name": "as", + "type": "string", + "default": "image" + }] + }; + inherits(Heatmap, Transform, { + transform(_, pulse2) { + if (!pulse2.changed() && !_.modified()) { + return pulse2.StopPropagation; + } + var source2 = pulse2.materialize(pulse2.SOURCE).source, shared = _.resolve === "shared", field2 = _.field || identity$7, opacity = opacity_(_.opacity, _), color2 = color_(_.color, _), as = _.as || "image", obj = { + $x: 0, + $y: 0, + $value: 0, + $max: shared ? max$3(source2.map((t) => max$3(field2(t).values))) : 0 + }; + source2.forEach((t) => { + const v = field2(t); + const o = extend$1({}, t, obj); + if (!shared) o.$max = max$3(v.values || []); + t[as] = toCanvas(v, o, color2.dep ? color2 : constant$5(color2(o)), opacity.dep ? opacity : constant$5(opacity(o))); + }); + return pulse2.reflow(true).modifies(as); + } + }); + function color_(color2, _) { + let f; + if (isFunction(color2)) { + f = (obj) => rgb$1(color2(obj, _)); + f.dep = dependency(color2); + } else { + f = constant$5(rgb$1(color2 || "#888")); + } + return f; + } + function opacity_(opacity, _) { + let f; + if (isFunction(opacity)) { + f = (obj) => opacity(obj, _); + f.dep = dependency(opacity); + } else if (opacity) { + f = constant$5(opacity); + } else { + f = (obj) => obj.$value / obj.$max || 0; + f.dep = true; + } + return f; + } + function dependency(f) { + if (!isFunction(f)) return false; + const set2 = toSet(accessorFields(f)); + return set2.$x || set2.$y || set2.$value || set2.$max; + } + function toCanvas(grid, obj, color2, opacity) { + const n = grid.width, m2 = grid.height, x12 = grid.x1 || 0, y12 = grid.y1 || 0, x2 = grid.x2 || n, y2 = grid.y2 || m2, val = grid.values, value2 = val ? (i) => val[i] : zero$3, can = domCanvas(x2 - x12, y2 - y12), ctx = can.getContext("2d"), img = ctx.getImageData(0, 0, x2 - x12, y2 - y12), pix = img.data; + for (let j = y12, k = 0; j < y2; ++j) { + obj.$y = j - y12; + for (let i = x12, r = j * n; i < x2; ++i, k += 4) { + obj.$x = i - x12; + obj.$value = value2(i + r); + const v = color2(obj); + pix[k + 0] = v.r; + pix[k + 1] = v.g; + pix[k + 2] = v.b; + pix[k + 3] = ~~(255 * opacity(obj)); + } + } + ctx.putImageData(img, 0, 0); + return can; + } + function Projection$1(params2) { + Transform.call(this, null, params2); + this.modified(true); + } + inherits(Projection$1, Transform, { + transform(_, pulse2) { + let proj = this.value; + if (!proj || _.modified("type")) { + this.value = proj = create$6(_.type); + projectionProperties.forEach((prop) => { + if (_[prop] != null) set$5(proj, prop, _[prop]); + }); + } else { + projectionProperties.forEach((prop) => { + if (_.modified(prop)) set$5(proj, prop, _[prop]); + }); + } + if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius); + if (_.fit) fit(proj, _); + return pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + } + }); + function fit(proj, _) { + const data2 = collectGeoJSON(_.fit); + _.extent ? proj.fitExtent(_.extent, data2) : _.size ? proj.fitSize(_.size, data2) : 0; + } + function create$6(type2) { + const constructor = projection((type2 || "mercator").toLowerCase()); + if (!constructor) error("Unrecognized projection type: " + type2); + return constructor(); + } + function set$5(proj, key2, value2) { + if (isFunction(proj[key2])) proj[key2](value2); + } + function collectGeoJSON(data2) { + data2 = array$5(data2); + return data2.length === 1 ? data2[0] : { + type: FeatureCollection, + features: data2.reduce((a2, f) => a2.concat(featurize(f)), []) + }; + } + function featurize(f) { + return f.type === FeatureCollection ? f.features : array$5(f).filter((d) => d != null).map((d) => d.type === Feature ? d : { + type: Feature, + geometry: d + }); + } + const geo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + contour: Contour, + geojson: GeoJSON, + geopath: GeoPath, + geopoint: GeoPoint, + geoshape: GeoShape, + graticule: Graticule, + heatmap: Heatmap, + isocontour: Isocontour, + kde2d: KDE2D, + projection: Projection$1 + }, Symbol.toStringTag, { value: "Module" })); + function forceCenter(x2, y2) { + var nodes, strength = 1; + if (x2 == null) x2 = 0; + if (y2 == null) y2 = 0; + function force2() { + var i, n = nodes.length, node, sx = 0, sy = 0; + for (i = 0; i < n; ++i) { + node = nodes[i], sx += node.x, sy += node.y; + } + for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) { + node = nodes[i], node.x -= sx, node.y -= sy; + } + } + force2.initialize = function(_) { + nodes = _; + }; + force2.x = function(_) { + return arguments.length ? (x2 = +_, force2) : x2; + }; + force2.y = function(_) { + return arguments.length ? (y2 = +_, force2) : y2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + return force2; + } + function tree_add(d) { + const x2 = +this._x.call(null, d), y2 = +this._y.call(null, d); + return add$1(this.cover(x2, y2), x2, y2, d); + } + function add$1(tree2, x2, y2, d) { + if (isNaN(x2) || isNaN(y2)) return tree2; + var parent, node = tree2._root, leaf = { data: d }, x02 = tree2._x0, y02 = tree2._y0, x12 = tree2._x1, y12 = tree2._y1, xm, ym, xp, yp, right, bottom, i, j; + if (!node) return tree2._root = leaf, tree2; + while (node.length) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree2; + } + xp = +tree2._x.call(null, node.data); + yp = +tree2._y.call(null, node.data); + if (x2 === xp && y2 === yp) return leaf.next = node, parent ? parent[i] = leaf : tree2._root = leaf, tree2; + do { + parent = parent ? parent[i] = new Array(4) : tree2._root = new Array(4); + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | xp >= xm)); + return parent[j] = node, parent[i] = leaf, tree2; + } + function addAll(data2) { + var d, i, n = data2.length, x2, y2, xz = new Array(n), yz = new Array(n), x02 = Infinity, y02 = Infinity, x12 = -Infinity, y12 = -Infinity; + for (i = 0; i < n; ++i) { + if (isNaN(x2 = +this._x.call(null, d = data2[i])) || isNaN(y2 = +this._y.call(null, d))) continue; + xz[i] = x2; + yz[i] = y2; + if (x2 < x02) x02 = x2; + if (x2 > x12) x12 = x2; + if (y2 < y02) y02 = y2; + if (y2 > y12) y12 = y2; + } + if (x02 > x12 || y02 > y12) return this; + this.cover(x02, y02).cover(x12, y12); + for (i = 0; i < n; ++i) { + add$1(this, xz[i], yz[i], data2[i]); + } + return this; + } + function tree_cover(x2, y2) { + if (isNaN(x2 = +x2) || isNaN(y2 = +y2)) return this; + var x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1; + if (isNaN(x02)) { + x12 = (x02 = Math.floor(x2)) + 1; + y12 = (y02 = Math.floor(y2)) + 1; + } else { + var z = x12 - x02 || 1, node = this._root, parent, i; + while (x02 > x2 || x2 >= x12 || y02 > y2 || y2 >= y12) { + i = (y2 < y02) << 1 | x2 < x02; + parent = new Array(4), parent[i] = node, node = parent, z *= 2; + switch (i) { + case 0: + x12 = x02 + z, y12 = y02 + z; + break; + case 1: + x02 = x12 - z, y12 = y02 + z; + break; + case 2: + x12 = x02 + z, y02 = y12 - z; + break; + case 3: + x02 = x12 - z, y02 = y12 - z; + break; + } + } + if (this._root && this._root.length) this._root = node; + } + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + return this; + } + function tree_data() { + var data2 = []; + this.visit(function(node) { + if (!node.length) do + data2.push(node.data); + while (node = node.next); + }); + return data2; + } + function tree_extent(_) { + return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]]; + } + function Quad$3(node, x02, y02, x12, y12) { + this.node = node; + this.x0 = x02; + this.y0 = y02; + this.x1 = x12; + this.y1 = y12; + } + function tree_find(x2, y2, radius2) { + var data2, x02 = this._x0, y02 = this._y0, x12, y12, x22, y22, x3 = this._x1, y3 = this._y1, quads = [], node = this._root, q, i; + if (node) quads.push(new Quad$3(node, x02, y02, x3, y3)); + if (radius2 == null) radius2 = Infinity; + else { + x02 = x2 - radius2, y02 = y2 - radius2; + x3 = x2 + radius2, y3 = y2 + radius2; + radius2 *= radius2; + } + while (q = quads.pop()) { + if (!(node = q.node) || (x12 = q.x0) > x3 || (y12 = q.y0) > y3 || (x22 = q.x1) < x02 || (y22 = q.y1) < y02) continue; + if (node.length) { + var xm = (x12 + x22) / 2, ym = (y12 + y22) / 2; + quads.push( + new Quad$3(node[3], xm, ym, x22, y22), + new Quad$3(node[2], x12, ym, xm, y22), + new Quad$3(node[1], xm, y12, x22, ym), + new Quad$3(node[0], x12, y12, xm, ym) + ); + if (i = (y2 >= ym) << 1 | x2 >= xm) { + q = quads[quads.length - 1]; + quads[quads.length - 1] = quads[quads.length - 1 - i]; + quads[quads.length - 1 - i] = q; + } + } else { + var dx = x2 - +this._x.call(null, node.data), dy = y2 - +this._y.call(null, node.data), d2 = dx * dx + dy * dy; + if (d2 < radius2) { + var d = Math.sqrt(radius2 = d2); + x02 = x2 - d, y02 = y2 - d; + x3 = x2 + d, y3 = y2 + d; + data2 = node.data; + } + } + } + return data2; + } + function tree_remove(d) { + if (isNaN(x2 = +this._x.call(null, d)) || isNaN(y2 = +this._y.call(null, d))) return this; + var parent, node = this._root, retainer, previous, next, x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1, x2, y2, xm, ym, right, bottom, i, j; + if (!node) return this; + if (node.length) while (true) { + if (right = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; + else x12 = xm; + if (bottom = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; + else y12 = ym; + if (!(parent = node, node = node[i = bottom << 1 | right])) return this; + if (!node.length) break; + if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; + } + while (node.data !== d) if (!(previous = node, node = node.next)) return this; + if (next = node.next) delete node.next; + if (previous) return next ? previous.next = next : delete previous.next, this; + if (!parent) return this._root = next, this; + next ? parent[i] = next : delete parent[i]; + if ((node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length) { + if (retainer) retainer[j] = node; + else this._root = node; + } + return this; + } + function removeAll(data2) { + for (var i = 0, n = data2.length; i < n; ++i) this.remove(data2[i]); + return this; + } + function tree_root() { + return this._root; + } + function tree_size() { + var size = 0; + this.visit(function(node) { + if (!node.length) do + ++size; + while (node = node.next); + }); + return size; + } + function tree_visit(callback) { + var quads = [], q, node = this._root, child, x02, y02, x12, y12; + if (node) quads.push(new Quad$3(node, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + if (!callback(node = q.node, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1) && node.length) { + var xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[3]) quads.push(new Quad$3(child, xm, ym, x12, y12)); + if (child = node[2]) quads.push(new Quad$3(child, x02, ym, xm, y12)); + if (child = node[1]) quads.push(new Quad$3(child, xm, y02, x12, ym)); + if (child = node[0]) quads.push(new Quad$3(child, x02, y02, xm, ym)); + } + } + return this; + } + function tree_visitAfter(callback) { + var quads = [], next = [], q; + if (this._root) quads.push(new Quad$3(this._root, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + var node = q.node; + if (node.length) { + var child, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1, xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; + if (child = node[0]) quads.push(new Quad$3(child, x02, y02, xm, ym)); + if (child = node[1]) quads.push(new Quad$3(child, xm, y02, x12, ym)); + if (child = node[2]) quads.push(new Quad$3(child, x02, ym, xm, y12)); + if (child = node[3]) quads.push(new Quad$3(child, xm, ym, x12, y12)); + } + next.push(q); + } + while (q = next.pop()) { + callback(q.node, q.x0, q.y0, q.x1, q.y1); + } + return this; + } + function defaultX(d) { + return d[0]; + } + function tree_x(_) { + return arguments.length ? (this._x = _, this) : this._x; + } + function defaultY(d) { + return d[1]; + } + function tree_y(_) { + return arguments.length ? (this._y = _, this) : this._y; + } + function quadtree(nodes, x2, y2) { + var tree2 = new Quadtree(x2 == null ? defaultX : x2, y2 == null ? defaultY : y2, NaN, NaN, NaN, NaN); + return nodes == null ? tree2 : tree2.addAll(nodes); + } + function Quadtree(x2, y2, x02, y02, x12, y12) { + this._x = x2; + this._y = y2; + this._x0 = x02; + this._y0 = y02; + this._x1 = x12; + this._y1 = y12; + this._root = void 0; + } + function leaf_copy(leaf) { + var copy2 = { data: leaf.data }, next = copy2; + while (leaf = leaf.next) next = next.next = { data: leaf.data }; + return copy2; + } + var treeProto = quadtree.prototype = Quadtree.prototype; + treeProto.copy = function() { + var copy2 = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root, nodes, child; + if (!node) return copy2; + if (!node.length) return copy2._root = leaf_copy(node), copy2; + nodes = [{ source: node, target: copy2._root = new Array(4) }]; + while (node = nodes.pop()) { + for (var i = 0; i < 4; ++i) { + if (child = node.source[i]) { + if (child.length) nodes.push({ source: child, target: node.target[i] = new Array(4) }); + else node.target[i] = leaf_copy(child); + } + } + } + return copy2; + }; + treeProto.add = tree_add; + treeProto.addAll = addAll; + treeProto.cover = tree_cover; + treeProto.data = tree_data; + treeProto.extent = tree_extent; + treeProto.find = tree_find; + treeProto.remove = tree_remove; + treeProto.removeAll = removeAll; + treeProto.root = tree_root; + treeProto.size = tree_size; + treeProto.visit = tree_visit; + treeProto.visitAfter = tree_visitAfter; + treeProto.x = tree_x; + treeProto.y = tree_y; + function constant$1(x2) { + return function() { + return x2; + }; + } + function jiggle(random2) { + return (random2() - 0.5) * 1e-6; + } + function x$1(d) { + return d.x + d.vx; + } + function y$1(d) { + return d.y + d.vy; + } + function forceCollide(radius2) { + var nodes, radii, random2, strength = 1, iterations2 = 1; + if (typeof radius2 !== "function") radius2 = constant$1(radius2 == null ? 1 : +radius2); + function force2() { + var i, n = nodes.length, tree2, node, xi, yi, ri, ri2; + for (var k = 0; k < iterations2; ++k) { + tree2 = quadtree(nodes, x$1, y$1).visitAfter(prepare2); + for (i = 0; i < n; ++i) { + node = nodes[i]; + ri = radii[node.index], ri2 = ri * ri; + xi = node.x + node.vx; + yi = node.y + node.vy; + tree2.visit(apply2); + } + } + function apply2(quad2, x02, y02, x12, y12) { + var data2 = quad2.data, rj = quad2.r, r = ri + rj; + if (data2) { + if (data2.index > node.index) { + var x2 = xi - data2.x - data2.vx, y2 = yi - data2.y - data2.vy, l = x2 * x2 + y2 * y2; + if (l < r * r) { + if (x2 === 0) x2 = jiggle(random2), l += x2 * x2; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + l = (r - (l = Math.sqrt(l))) / l * strength; + node.vx += (x2 *= l) * (r = (rj *= rj) / (ri2 + rj)); + node.vy += (y2 *= l) * r; + data2.vx -= x2 * (r = 1 - r); + data2.vy -= y2 * r; + } + } + return; + } + return x02 > xi + r || x12 < xi - r || y02 > yi + r || y12 < yi - r; + } + } + function prepare2(quad2) { + if (quad2.data) return quad2.r = radii[quad2.data.index]; + for (var i = quad2.r = 0; i < 4; ++i) { + if (quad2[i] && quad2[i].r > quad2.r) { + quad2.r = quad2[i].r; + } + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node; + radii = new Array(n); + for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius2(node, i, nodes); + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); + }; + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = +_, force2) : strength; + }; + force2.radius = function(_) { + return arguments.length ? (radius2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : radius2; + }; + return force2; + } + function index$1(d) { + return d.index; + } + function find$1(nodeById, nodeId) { + var node = nodeById.get(nodeId); + if (!node) throw new Error("node not found: " + nodeId); + return node; + } + function forceLink(links) { + var id2 = index$1, strength = defaultStrength, strengths, distance2 = constant$1(30), distances, nodes, count2, bias, random2, iterations2 = 1; + if (links == null) links = []; + function defaultStrength(link2) { + return 1 / Math.min(count2[link2.source.index], count2[link2.target.index]); + } + function force2(alpha) { + for (var k = 0, n = links.length; k < iterations2; ++k) { + for (var i = 0, link2, source2, target2, x2, y2, l, b2; i < n; ++i) { + link2 = links[i], source2 = link2.source, target2 = link2.target; + x2 = target2.x + target2.vx - source2.x - source2.vx || jiggle(random2); + y2 = target2.y + target2.vy - source2.y - source2.vy || jiggle(random2); + l = Math.sqrt(x2 * x2 + y2 * y2); + l = (l - distances[i]) / l * alpha * strengths[i]; + x2 *= l, y2 *= l; + target2.vx -= x2 * (b2 = bias[i]); + target2.vy -= y2 * b2; + source2.vx += x2 * (b2 = 1 - b2); + source2.vy += y2 * b2; + } + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, m2 = links.length, nodeById = new Map(nodes.map((d, i2) => [id2(d, i2, nodes), d])), link2; + for (i = 0, count2 = new Array(n); i < m2; ++i) { + link2 = links[i], link2.index = i; + if (typeof link2.source !== "object") link2.source = find$1(nodeById, link2.source); + if (typeof link2.target !== "object") link2.target = find$1(nodeById, link2.target); + count2[link2.source.index] = (count2[link2.source.index] || 0) + 1; + count2[link2.target.index] = (count2[link2.target.index] || 0) + 1; + } + for (i = 0, bias = new Array(m2); i < m2; ++i) { + link2 = links[i], bias[i] = count2[link2.source.index] / (count2[link2.source.index] + count2[link2.target.index]); + } + strengths = new Array(m2), initializeStrength(); + distances = new Array(m2), initializeDistance(); + } + function initializeStrength() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + strengths[i] = +strength(links[i], i, links); + } + } + function initializeDistance() { + if (!nodes) return; + for (var i = 0, n = links.length; i < n; ++i) { + distances[i] = +distance2(links[i], i, links); + } + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); + }; + force2.links = function(_) { + return arguments.length ? (links = _, initialize2(), force2) : links; + }; + force2.id = function(_) { + return arguments.length ? (id2 = _, force2) : id2; + }; + force2.iterations = function(_) { + return arguments.length ? (iterations2 = +_, force2) : iterations2; + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force2) : strength; + }; + force2.distance = function(_) { + return arguments.length ? (distance2 = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force2) : distance2; + }; + return force2; + } + var noop = { value: () => { + } }; + function dispatch() { + for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { + if (!(t = arguments[i] + "") || t in _ || /[\s.]/.test(t)) throw new Error("illegal type: " + t); + _[t] = []; + } + return new Dispatch(_); + } + function Dispatch(_) { + this._ = _; + } + function parseTypenames(typenames, types) { + return typenames.trim().split(/^|\s+/).map(function(t) { + var name = "", i = t.indexOf("."); + if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); + return { type: t, name }; + }); + } + Dispatch.prototype = dispatch.prototype = { + constructor: Dispatch, + on: function(typename, callback) { + var _ = this._, T = parseTypenames(typename + "", _), t, i = -1, n = T.length; + if (arguments.length < 2) { + while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; + return; + } + if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); + while (++i < n) { + if (t = (typename = T[i]).type) _[t] = set$4(_[t], typename.name, callback); + else if (callback == null) for (t in _) _[t] = set$4(_[t], typename.name, null); + } + return this; + }, + copy: function() { + var copy2 = {}, _ = this._; + for (var t in _) copy2[t] = _[t].slice(); + return new Dispatch(copy2); + }, + call: function(type2, that) { + if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + }, + apply: function(type2, that, args) { + if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); + for (var t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + } + }; + function get(type2, name) { + for (var i = 0, n = type2.length, c2; i < n; ++i) { + if ((c2 = type2[i]).name === name) { + return c2.value; + } + } + } + function set$4(type2, name, callback) { + for (var i = 0, n = type2.length; i < n; ++i) { + if (type2[i].name === name) { + type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1)); + break; + } + } + if (callback != null) type2.push({ name, value: callback }); + return type2; + } + var frame = 0, timeout = 0, interval$1 = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { + setTimeout(f, 17); + }; + function now() { + return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); + } + function clearNow() { + clockNow = 0; + } + function Timer$1() { + this._call = this._time = this._next = null; + } + Timer$1.prototype = timer$1.prototype = { + constructor: Timer$1, + restart: function(callback, delay, time2) { + if (typeof callback !== "function") throw new TypeError("callback is not a function"); + time2 = (time2 == null ? now() : +time2) + (delay == null ? 0 : +delay); + if (!this._next && taskTail !== this) { + if (taskTail) taskTail._next = this; + else taskHead = this; + taskTail = this; + } + this._call = callback; + this._time = time2; + sleep(); + }, + stop: function() { + if (this._call) { + this._call = null; + this._time = Infinity; + sleep(); + } + } + }; + function timer$1(callback, delay, time2) { + var t = new Timer$1(); + t.restart(callback, delay, time2); + return t; + } + function timerFlush() { + now(); + ++frame; + var t = taskHead, e; + while (t) { + if ((e = clockNow - t._time) >= 0) t._call.call(void 0, e); + t = t._next; + } + --frame; + } + function wake() { + clockNow = (clockLast = clock.now()) + clockSkew; + frame = timeout = 0; + try { + timerFlush(); + } finally { + frame = 0; + nap(); + clockNow = 0; + } + } + function poke() { + var now2 = clock.now(), delay = now2 - clockLast; + if (delay > pokeDelay) clockSkew -= delay, clockLast = now2; + } + function nap() { + var t02, t12 = taskHead, t22, time2 = Infinity; + while (t12) { + if (t12._call) { + if (time2 > t12._time) time2 = t12._time; + t02 = t12, t12 = t12._next; + } else { + t22 = t12._next, t12._next = null; + t12 = t02 ? t02._next = t22 : taskHead = t22; + } + } + taskTail = t02; + sleep(time2); + } + function sleep(time2) { + if (frame) return; + if (timeout) timeout = clearTimeout(timeout); + var delay = time2 - clockNow; + if (delay > 24) { + if (time2 < Infinity) timeout = setTimeout(wake, time2 - clock.now() - clockSkew); + if (interval$1) interval$1 = clearInterval(interval$1); + } else { + if (!interval$1) clockLast = clock.now(), interval$1 = setInterval(poke, pokeDelay); + frame = 1, setFrame(wake); + } + } + function interval(callback, delay, time2) { + var t = new Timer$1(), total = delay; + if (delay == null) return t.restart(callback, delay, time2), t; + t._restart = t.restart; + t.restart = function(callback2, delay2, time3) { + delay2 = +delay2, time3 = time3 == null ? now() : +time3; + t._restart(function tick(elapsed) { + elapsed += total; + t._restart(tick, total += delay2, time3); + callback2(elapsed); + }, delay2, time3); + }; + t.restart(callback, delay, time2); + return t; + } + const a$1 = 1664525; + const c$1 = 1013904223; + const m$1 = 4294967296; + function lcg$1() { + let s = 1; + return () => (s = (a$1 * s + c$1) % m$1) / m$1; + } + function x(d) { + return d.x; + } + function y(d) { + return d.y; + } + var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); + function forceSimulation(nodes) { + var simulation2, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = /* @__PURE__ */ new Map(), stepper = timer$1(step), event2 = dispatch("tick", "end"), random2 = lcg$1(); + if (nodes == null) nodes = []; + function step() { + tick(); + event2.call("tick", simulation2); + if (alpha < alphaMin) { + stepper.stop(); + event2.call("end", simulation2); + } + } + function tick(iterations2) { + var i, n = nodes.length, node; + if (iterations2 === void 0) iterations2 = 1; + for (var k = 0; k < iterations2; ++k) { + alpha += (alphaTarget - alpha) * alphaDecay; + forces.forEach(function(force2) { + force2(alpha); + }); + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (node.fx == null) node.x += node.vx *= velocityDecay; + else node.x = node.fx, node.vx = 0; + if (node.fy == null) node.y += node.vy *= velocityDecay; + else node.y = node.fy, node.vy = 0; + } + } + return simulation2; + } + function initializeNodes() { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.index = i; + if (node.fx != null) node.x = node.fx; + if (node.fy != null) node.y = node.fy; + if (isNaN(node.x) || isNaN(node.y)) { + var radius2 = initialRadius * Math.sqrt(0.5 + i), angle2 = i * initialAngle; + node.x = radius2 * Math.cos(angle2); + node.y = radius2 * Math.sin(angle2); + } + if (isNaN(node.vx) || isNaN(node.vy)) { + node.vx = node.vy = 0; + } + } + } + function initializeForce(force2) { + if (force2.initialize) force2.initialize(nodes, random2); + return force2; + } + initializeNodes(); + return simulation2 = { + tick, + restart: function() { + return stepper.restart(step), simulation2; + }, + stop: function() { + return stepper.stop(), simulation2; + }, + nodes: function(_) { + return arguments.length ? (nodes = _, initializeNodes(), forces.forEach(initializeForce), simulation2) : nodes; + }, + alpha: function(_) { + return arguments.length ? (alpha = +_, simulation2) : alpha; + }, + alphaMin: function(_) { + return arguments.length ? (alphaMin = +_, simulation2) : alphaMin; + }, + alphaDecay: function(_) { + return arguments.length ? (alphaDecay = +_, simulation2) : +alphaDecay; + }, + alphaTarget: function(_) { + return arguments.length ? (alphaTarget = +_, simulation2) : alphaTarget; + }, + velocityDecay: function(_) { + return arguments.length ? (velocityDecay = 1 - _, simulation2) : 1 - velocityDecay; + }, + randomSource: function(_) { + return arguments.length ? (random2 = _, forces.forEach(initializeForce), simulation2) : random2; + }, + force: function(name, _) { + return arguments.length > 1 ? (_ == null ? forces.delete(name) : forces.set(name, initializeForce(_)), simulation2) : forces.get(name); + }, + find: function(x2, y2, radius2) { + var i = 0, n = nodes.length, dx, dy, d2, node, closest; + if (radius2 == null) radius2 = Infinity; + else radius2 *= radius2; + for (i = 0; i < n; ++i) { + node = nodes[i]; + dx = x2 - node.x; + dy = y2 - node.y; + d2 = dx * dx + dy * dy; + if (d2 < radius2) closest = node, radius2 = d2; + } + return closest; + }, + on: function(name, _) { + return arguments.length > 1 ? (event2.on(name, _), simulation2) : event2.on(name); + } + }; + } + function forceManyBody() { + var nodes, node, random2, alpha, strength = constant$1(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; + function force2(_) { + var i, n = nodes.length, tree2 = quadtree(nodes, x, y).visitAfter(accumulate); + for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree2.visit(apply2); + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length, node2; + strengths = new Array(n); + for (i = 0; i < n; ++i) node2 = nodes[i], strengths[node2.index] = +strength(node2, i, nodes); + } + function accumulate(quad2) { + var strength2 = 0, q, c2, weight = 0, x2, y2, i; + if (quad2.length) { + for (x2 = y2 = i = 0; i < 4; ++i) { + if ((q = quad2[i]) && (c2 = Math.abs(q.value))) { + strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y; + } + } + quad2.x = x2 / weight; + quad2.y = y2 / weight; + } else { + q = quad2; + q.x = q.data.x; + q.y = q.data.y; + do + strength2 += strengths[q.data.index]; + while (q = q.next); + } + quad2.value = strength2; + } + function apply2(quad2, x12, _, x2) { + if (!quad2.value) return true; + var x3 = quad2.x - node.x, y2 = quad2.y - node.y, w2 = x2 - x12, l = x3 * x3 + y2 * y2; + if (w2 * w2 / theta2 < l) { + if (l < distanceMax2) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + node.vx += x3 * quad2.value * alpha / l; + node.vy += y2 * quad2.value * alpha / l; + } + return true; + } else if (quad2.length || l >= distanceMax2) return; + if (quad2.data !== node || quad2.next) { + if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; + if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + } + do + if (quad2.data !== node) { + w2 = strengths[quad2.data.index] * alpha / l; + node.vx += x3 * w2; + node.vy += y2 * w2; + } + while (quad2 = quad2.next); + } + force2.initialize = function(_nodes, _random) { + nodes = _nodes; + random2 = _random; + initialize2(); + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; + }; + force2.distanceMin = function(_) { + return arguments.length ? (distanceMin2 = _ * _, force2) : Math.sqrt(distanceMin2); + }; + force2.distanceMax = function(_) { + return arguments.length ? (distanceMax2 = _ * _, force2) : Math.sqrt(distanceMax2); + }; + force2.theta = function(_) { + return arguments.length ? (theta2 = _ * _, force2) : Math.sqrt(theta2); + }; + return force2; + } + function forceX(x2) { + var strength = constant$1(0.1), nodes, strengths, xz; + if (typeof x2 !== "function") x2 = constant$1(x2 == null ? 0 : +x2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + xz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(xz[i] = +x2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; + }; + force2.x = function(_) { + return arguments.length ? (x2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : x2; + }; + return force2; + } + function forceY(y2) { + var strength = constant$1(0.1), nodes, strengths, yz; + if (typeof y2 !== "function") y2 = constant$1(y2 == null ? 0 : +y2); + function force2(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; + } + } + function initialize2() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + yz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(yz[i] = +y2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + force2.initialize = function(_) { + nodes = _; + initialize2(); + }; + force2.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : strength; + }; + force2.y = function(_) { + return arguments.length ? (y2 = typeof _ === "function" ? _ : constant$1(+_), initialize2(), force2) : y2; + }; + return force2; + } + const ForceMap = { + center: forceCenter, + collide: forceCollide, + nbody: forceManyBody, + link: forceLink, + x: forceX, + y: forceY + }; + const Forces = "forces", ForceParams = ["alpha", "alphaMin", "alphaTarget", "velocityDecay", "forces"], ForceConfig = ["static", "iterations"], ForceOutput = ["x", "y", "vx", "vy"]; + function Force(params2) { + Transform.call(this, null, params2); + } + Force.Definition = { + "type": "Force", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "static", + "type": "boolean", + "default": false + }, { + "name": "restart", + "type": "boolean", + "default": false + }, { + "name": "iterations", + "type": "number", + "default": 300 + }, { + "name": "alpha", + "type": "number", + "default": 1 + }, { + "name": "alphaMin", + "type": "number", + "default": 1e-3 + }, { + "name": "alphaTarget", + "type": "number", + "default": 0 + }, { + "name": "velocityDecay", + "type": "number", + "default": 0.4 + }, { + "name": "forces", + "type": "param", + "array": true, + "params": [{ + "key": { + "force": "center" + }, + "params": [{ + "name": "x", + "type": "number", + "default": 0 + }, { + "name": "y", + "type": "number", + "default": 0 + }] + }, { + "key": { + "force": "collide" + }, + "params": [{ + "name": "radius", + "type": "number", + "expr": true + }, { + "name": "strength", + "type": "number", + "default": 0.7 + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "nbody" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": -30, + "expr": true + }, { + "name": "theta", + "type": "number", + "default": 0.9 + }, { + "name": "distanceMin", + "type": "number", + "default": 1 + }, { + "name": "distanceMax", + "type": "number" + }] + }, { + "key": { + "force": "link" + }, + "params": [{ + "name": "links", + "type": "data" + }, { + "name": "id", + "type": "field" + }, { + "name": "distance", + "type": "number", + "default": 30, + "expr": true + }, { + "name": "strength", + "type": "number", + "expr": true + }, { + "name": "iterations", + "type": "number", + "default": 1 + }] + }, { + "key": { + "force": "x" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "x", + "type": "field" + }] + }, { + "key": { + "force": "y" + }, + "params": [{ + "name": "strength", + "type": "number", + "default": 0.1 + }, { + "name": "y", + "type": "field" + }] + }] + }, { + "name": "as", + "type": "string", + "array": true, + "modify": false, + "default": ForceOutput + }] + }; + inherits(Force, Transform, { + transform(_, pulse2) { + var sim = this.value, change2 = pulse2.changed(pulse2.ADD_REM), params2 = _.modified(ForceParams), iters = _.iterations || 300; + if (!sim) { + this.value = sim = simulation(pulse2.source, _); + sim.on("tick", rerun(pulse2.dataflow, this)); + if (!_.static) { + change2 = true; + sim.tick(); + } + pulse2.modifies("index"); + } else { + if (change2) { + pulse2.modifies("index"); + sim.nodes(pulse2.source); + } + if (params2 || pulse2.changed(pulse2.MOD)) { + setup(sim, _, 0, pulse2); + } + } + if (params2 || change2 || _.modified(ForceConfig) || pulse2.changed() && _.restart) { + sim.alpha(Math.max(sim.alpha(), _.alpha || 1)).alphaDecay(1 - Math.pow(sim.alphaMin(), 1 / iters)); + if (_.static) { + for (sim.stop(); --iters >= 0; ) sim.tick(); + } else { + if (sim.stopped()) sim.restart(); + if (!change2) return pulse2.StopPropagation; + } + } + return this.finish(_, pulse2); + }, + finish(_, pulse2) { + const dataflow = pulse2.dataflow; + for (let args = this._argops, j = 0, m2 = args.length, arg; j < m2; ++j) { + arg = args[j]; + if (arg.name !== Forces || arg.op._argval.force !== "link") { + continue; + } + for (var ops2 = arg.op._argops, i = 0, n = ops2.length, op; i < n; ++i) { + if (ops2[i].name === "links" && (op = ops2[i].op.source)) { + dataflow.pulse(op, dataflow.changeset().reflow()); + break; + } + } + } + return pulse2.reflow(_.modified()).modifies(ForceOutput); + } + }); + function rerun(df, op) { + return () => df.touch(op).run(); + } + function simulation(nodes, _) { + const sim = forceSimulation(nodes), stop2 = sim.stop, restart = sim.restart; + let stopped = false; + sim.stopped = () => stopped; + sim.restart = () => (stopped = false, restart()); + sim.stop = () => (stopped = true, stop2()); + return setup(sim, _, true).on("end", () => stopped = true); + } + function setup(sim, _, init2, pulse2) { + var f = array$5(_.forces), i, n, p, name; + for (i = 0, n = ForceParams.length; i < n; ++i) { + p = ForceParams[i]; + if (p !== Forces && _.modified(p)) sim[p](_[p]); + } + for (i = 0, n = f.length; i < n; ++i) { + name = Forces + i; + p = init2 || _.modified(Forces, i) ? getForce(f[i]) : pulse2 && modified(f[i], pulse2) ? sim.force(name) : null; + if (p) sim.force(name, p); + } + for (n = sim.numForces || 0; i < n; ++i) { + sim.force(Forces + i, null); + } + sim.numForces = f.length; + return sim; + } + function modified(f, pulse2) { + var k, v; + for (k in f) { + if (isFunction(v = f[k]) && pulse2.modified(accessorFields(v))) return 1; + } + return 0; + } + function getForce(_) { + var f, p; + if (!has$1(ForceMap, _.force)) { + error("Unrecognized force: " + _.force); + } + f = ForceMap[_.force](); + for (p in _) { + if (isFunction(f[p])) setForceParam(f[p], _[p], _); + } + return f; + } + function setForceParam(f, v, _) { + f(isFunction(v) ? (d) => v(d, _) : v); + } + const force = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + force: Force + }, Symbol.toStringTag, { value: "Module" })); + function defaultSeparation$2(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function meanX(children2) { + return children2.reduce(meanXReduce, 0) / children2.length; + } + function meanXReduce(x2, c2) { + return x2 + c2.x; + } + function maxY(children2) { + return 1 + children2.reduce(maxYReduce, 0); + } + function maxYReduce(y2, c2) { + return Math.max(y2, c2.y); + } + function leafLeft(node) { + var children2; + while (children2 = node.children) node = children2[0]; + return node; + } + function leafRight(node) { + var children2; + while (children2 = node.children) node = children2[children2.length - 1]; + return node; + } + function cluster() { + var separation = defaultSeparation$2, dx = 1, dy = 1, nodeSize = false; + function cluster2(root) { + var previousNode, x2 = 0; + root.eachAfter(function(node) { + var children2 = node.children; + if (children2) { + node.x = meanX(children2); + node.y = maxY(children2); + } else { + node.x = previousNode ? x2 += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + var left = leafLeft(root), right = leafRight(root), x02 = left.x - separation(left, right) / 2, x12 = right.x + separation(right, left) / 2; + return root.eachAfter(nodeSize ? function(node) { + node.x = (node.x - root.x) * dx; + node.y = (root.y - node.y) * dy; + } : function(node) { + node.x = (node.x - x02) / (x12 - x02) * dx; + node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; + }); + } + cluster2.separation = function(x2) { + return arguments.length ? (separation = x2, cluster2) : separation; + }; + cluster2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? null : [dx, dy]; + }; + cluster2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? [dx, dy] : null; + }; + return cluster2; + } + function count(node) { + var sum2 = 0, children2 = node.children, i = children2 && children2.length; + if (!i) sum2 = 1; + else while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + } + function node_count() { + return this.eachAfter(count); + } + function node_each(callback, that) { + let index2 = -1; + for (const node of this) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_eachBefore(callback, that) { + var node = this, nodes = [node], children2, i, index2 = -1; + while (node = nodes.pop()) { + callback.call(that, node, ++index2, this); + if (children2 = node.children) { + for (i = children2.length - 1; i >= 0; --i) { + nodes.push(children2[i]); + } + } + } + return this; + } + function node_eachAfter(callback, that) { + var node = this, nodes = [node], next = [], children2, i, n, index2 = -1; + while (node = nodes.pop()) { + next.push(node); + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + nodes.push(children2[i]); + } + } + } + while (node = next.pop()) { + callback.call(that, node, ++index2, this); + } + return this; + } + function node_find(callback, that) { + let index2 = -1; + for (const node of this) { + if (callback.call(that, node, ++index2, this)) { + return node; + } + } + } + function node_sum(value2) { + return this.eachAfter(function(node) { + var sum2 = +value2(node.data) || 0, children2 = node.children, i = children2 && children2.length; + while (--i >= 0) sum2 += children2[i].value; + node.value = sum2; + }); + } + function node_sort(compare2) { + return this.eachBefore(function(node) { + if (node.children) { + node.children.sort(compare2); + } + }); + } + function node_path(end) { + var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start]; + while (start !== ancestor) { + start = start.parent; + nodes.push(start); + } + var k = nodes.length; + while (end !== ancestor) { + nodes.splice(k, 0, end); + end = end.parent; + } + return nodes; + } + function leastCommonAncestor(a2, b2) { + if (a2 === b2) return a2; + var aNodes = a2.ancestors(), bNodes = b2.ancestors(), c2 = null; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + while (a2 === b2) { + c2 = a2; + a2 = aNodes.pop(); + b2 = bNodes.pop(); + } + return c2; + } + function node_ancestors() { + var node = this, nodes = [node]; + while (node = node.parent) { + nodes.push(node); + } + return nodes; + } + function node_descendants() { + return Array.from(this); + } + function node_leaves() { + var leaves = []; + this.eachBefore(function(node) { + if (!node.children) { + leaves.push(node); + } + }); + return leaves; + } + function node_links() { + var root = this, links = []; + root.each(function(node) { + if (node !== root) { + links.push({ source: node.parent, target: node }); + } + }); + return links; + } + function* node_iterator() { + var node = this, current, next = [node], children2, i, n; + do { + current = next.reverse(), next = []; + while (node = current.pop()) { + yield node; + if (children2 = node.children) { + for (i = 0, n = children2.length; i < n; ++i) { + next.push(children2[i]); + } + } + } + } while (next.length); + } + function hierarchy(data2, children2) { + if (data2 instanceof Map) { + data2 = [void 0, data2]; + if (children2 === void 0) children2 = mapChildren; + } else if (children2 === void 0) { + children2 = objectChildren; + } + var root = new Node$2(data2), node, nodes = [root], child, childs, i, n; + while (node = nodes.pop()) { + if ((childs = children2(node.data)) && (n = (childs = Array.from(childs)).length)) { + node.children = childs; + for (i = n - 1; i >= 0; --i) { + nodes.push(child = childs[i] = new Node$2(childs[i])); + child.parent = node; + child.depth = node.depth + 1; + } + } + } + return root.eachBefore(computeHeight); + } + function node_copy() { + return hierarchy(this).eachBefore(copyData); + } + function objectChildren(d) { + return d.children; + } + function mapChildren(d) { + return Array.isArray(d) ? d[1] : null; + } + function copyData(node) { + if (node.data.value !== void 0) node.value = node.data.value; + node.data = node.data.data; + } + function computeHeight(node) { + var height2 = 0; + do + node.height = height2; + while ((node = node.parent) && node.height < ++height2); + } + function Node$2(data2) { + this.data = data2; + this.depth = this.height = 0; + this.parent = null; + } + Node$2.prototype = hierarchy.prototype = { + constructor: Node$2, + count: node_count, + each: node_each, + eachAfter: node_eachAfter, + eachBefore: node_eachBefore, + find: node_find, + sum: node_sum, + sort: node_sort, + path: node_path, + ancestors: node_ancestors, + descendants: node_descendants, + leaves: node_leaves, + links: node_links, + copy: node_copy, + [Symbol.iterator]: node_iterator + }; + function optional(f) { + return f == null ? null : required(f); + } + function required(f) { + if (typeof f !== "function") throw new Error(); + return f; + } + function constantZero() { + return 0; + } + function constant(x2) { + return function() { + return x2; + }; + } + const a = 1664525; + const c = 1013904223; + const m = 4294967296; + function lcg() { + let s = 1; + return () => (s = (a * s + c) % m) / m; + } + function array$2(x2) { + return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); + } + function shuffle(array2, random2) { + let m2 = array2.length, t, i; + while (m2) { + i = random2() * m2-- | 0; + t = array2[m2]; + array2[m2] = array2[i]; + array2[i] = t; + } + return array2; + } + function packEncloseRandom(circles, random2) { + var i = 0, n = (circles = shuffle(Array.from(circles), random2)).length, B2 = [], p, e; + while (i < n) { + p = circles[i]; + if (e && enclosesWeak(e, p)) ++i; + else e = encloseBasis(B2 = extendBasis(B2, p)), i = 0; + } + return e; + } + function extendBasis(B2, p) { + var i, j; + if (enclosesWeakAll(p, B2)) return [p]; + for (i = 0; i < B2.length; ++i) { + if (enclosesNot(p, B2[i]) && enclosesWeakAll(encloseBasis2(B2[i], p), B2)) { + return [B2[i], p]; + } + } + for (i = 0; i < B2.length - 1; ++i) { + for (j = i + 1; j < B2.length; ++j) { + if (enclosesNot(encloseBasis2(B2[i], B2[j]), p) && enclosesNot(encloseBasis2(B2[i], p), B2[j]) && enclosesNot(encloseBasis2(B2[j], p), B2[i]) && enclosesWeakAll(encloseBasis3(B2[i], B2[j], p), B2)) { + return [B2[i], B2[j], p]; + } + } + } + throw new Error(); + } + function enclosesNot(a2, b2) { + var dr = a2.r - b2.r, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr < 0 || dr * dr < dx * dx + dy * dy; + } + function enclosesWeak(a2, b2) { + var dr = a2.r - b2.r + Math.max(a2.r, b2.r, 1) * 1e-9, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function enclosesWeakAll(a2, B2) { + for (var i = 0; i < B2.length; ++i) { + if (!enclosesWeak(a2, B2[i])) { + return false; + } + } + return true; + } + function encloseBasis(B2) { + switch (B2.length) { + case 1: + return encloseBasis1(B2[0]); + case 2: + return encloseBasis2(B2[0], B2[1]); + case 3: + return encloseBasis3(B2[0], B2[1], B2[2]); + } + } + function encloseBasis1(a2) { + return { + x: a2.x, + y: a2.y, + r: a2.r + }; + } + function encloseBasis2(a2, b2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x21 = x2 - x12, y21 = y2 - y12, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); + return { + x: (x12 + x2 + x21 / l * r21) / 2, + y: (y12 + y2 + y21 / l * r21) / 2, + r: (l + r1 + r2) / 2 + }; + } + function encloseBasis3(a2, b2, c2) { + var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b2.x, y2 = b2.y, r2 = b2.r, x3 = c2.x, y3 = c2.y, r3 = c2.r, a22 = x12 - x2, a3 = x12 - x3, b22 = y12 - y2, b3 = y12 - y3, c22 = r2 - r1, c3 = r3 - r1, d1 = x12 * x12 + y12 * y12 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b22 - a22 * b3, xa = (b22 * d3 - b3 * d2) / (ab * 2) - x12, xb = (b3 * c22 - b22 * c3) / ab, ya = (a3 * d2 - a22 * d3) / (ab * 2) - y12, yb = (a22 * c3 - a3 * c22) / ab, A5 = xb * xb + yb * yb - 1, B2 = 2 * (r1 + xa * xb + ya * yb), C3 = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A5) > 1e-6 ? (B2 + Math.sqrt(B2 * B2 - 4 * A5 * C3)) / (2 * A5) : C3 / B2); + return { + x: x12 + xa + xb * r, + y: y12 + ya + yb * r, + r + }; + } + function place(b2, a2, c2) { + var dx = b2.x - a2.x, x2, a22, dy = b2.y - a2.y, y2, b22, d2 = dx * dx + dy * dy; + if (d2) { + a22 = a2.r + c2.r, a22 *= a22; + b22 = b2.r + c2.r, b22 *= b22; + if (a22 > b22) { + x2 = (d2 + b22 - a22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, b22 / d2 - x2 * x2)); + c2.x = b2.x - x2 * dx - y2 * dy; + c2.y = b2.y - x2 * dy + y2 * dx; + } else { + x2 = (d2 + a22 - b22) / (2 * d2); + y2 = Math.sqrt(Math.max(0, a22 / d2 - x2 * x2)); + c2.x = a2.x + x2 * dx - y2 * dy; + c2.y = a2.y + x2 * dy + y2 * dx; + } + } else { + c2.x = a2.x + c2.r; + c2.y = a2.y; + } + } + function intersects(a2, b2) { + var dr = a2.r + b2.r - 1e-6, dx = b2.x - a2.x, dy = b2.y - a2.y; + return dr > 0 && dr * dr > dx * dx + dy * dy; + } + function score(node) { + var a2 = node._, b2 = node.next._, ab = a2.r + b2.r, dx = (a2.x * b2.r + b2.x * a2.r) / ab, dy = (a2.y * b2.r + b2.y * a2.r) / ab; + return dx * dx + dy * dy; + } + function Node$1(circle2) { + this._ = circle2; + this.next = null; + this.previous = null; + } + function packSiblingsRandom(circles, random2) { + if (!(n = (circles = array$2(circles)).length)) return 0; + var a2, b2, c2, n, aa, ca, i, j, k, sj, sk; + a2 = circles[0], a2.x = 0, a2.y = 0; + if (!(n > 1)) return a2.r; + b2 = circles[1], a2.x = -b2.r, b2.x = a2.r, b2.y = 0; + if (!(n > 2)) return a2.r + b2.r; + place(b2, a2, c2 = circles[2]); + a2 = new Node$1(a2), b2 = new Node$1(b2), c2 = new Node$1(c2); + a2.next = c2.previous = b2; + b2.next = a2.previous = c2; + c2.next = b2.previous = a2; + pack: for (i = 3; i < n; ++i) { + place(a2._, b2._, c2 = circles[i]), c2 = new Node$1(c2); + j = b2.next, k = a2.previous, sj = b2._.r, sk = a2._.r; + do { + if (sj <= sk) { + if (intersects(j._, c2._)) { + b2 = j, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sj += j._.r, j = j.next; + } else { + if (intersects(k._, c2._)) { + a2 = k, a2.next = b2, b2.previous = a2, --i; + continue pack; + } + sk += k._.r, k = k.previous; + } + } while (j !== k.next); + c2.previous = a2, c2.next = b2, a2.next = b2.previous = b2 = c2; + aa = score(a2); + while ((c2 = c2.next) !== b2) { + if ((ca = score(c2)) < aa) { + a2 = c2, aa = ca; + } + } + b2 = a2.next; + } + a2 = [b2._], c2 = b2; + while ((c2 = c2.next) !== b2) a2.push(c2._); + c2 = packEncloseRandom(a2, random2); + for (i = 0; i < n; ++i) a2 = circles[i], a2.x -= c2.x, a2.y -= c2.y; + return c2.r; + } + function defaultRadius(d) { + return Math.sqrt(d.value); + } + function pack() { + var radius2 = null, dx = 1, dy = 1, padding2 = constantZero; + function pack2(root) { + const random2 = lcg(); + root.x = dx / 2, root.y = dy / 2; + if (radius2) { + root.eachBefore(radiusLeaf(radius2)).eachAfter(packChildrenRandom(padding2, 0.5, random2)).eachBefore(translateChild(1)); + } else { + root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero, 1, random2)).eachAfter(packChildrenRandom(padding2, root.r / Math.min(dx, dy), random2)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); + } + return root; + } + pack2.radius = function(x2) { + return arguments.length ? (radius2 = optional(x2), pack2) : radius2; + }; + pack2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], pack2) : [dx, dy]; + }; + pack2.padding = function(x2) { + return arguments.length ? (padding2 = typeof x2 === "function" ? x2 : constant(+x2), pack2) : padding2; + }; + return pack2; + } + function radiusLeaf(radius2) { + return function(node) { + if (!node.children) { + node.r = Math.max(0, +radius2(node) || 0); + } + }; + } + function packChildrenRandom(padding2, k, random2) { + return function(node) { + if (children2 = node.children) { + var children2, i, n = children2.length, r = padding2(node) * k || 0, e; + if (r) for (i = 0; i < n; ++i) children2[i].r += r; + e = packSiblingsRandom(children2, random2); + if (r) for (i = 0; i < n; ++i) children2[i].r -= r; + node.r = e + r; + } + }; + } + function translateChild(k) { + return function(node) { + var parent = node.parent; + node.r *= k; + if (parent) { + node.x = parent.x + k * node.x; + node.y = parent.y + k * node.y; + } + }; + } + function roundNode(node) { + node.x0 = Math.round(node.x0); + node.y0 = Math.round(node.y0); + node.x1 = Math.round(node.x1); + node.y1 = Math.round(node.y1); + } + function treemapDice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x12 - x02) / parent.value; + while (++i < n) { + node = nodes[i], node.y0 = y02, node.y1 = y12; + node.x0 = x02, node.x1 = x02 += node.value * k; + } + } + function partition$1() { + var dx = 1, dy = 1, padding2 = 0, round = false; + function partition2(root) { + var n = root.height + 1; + root.x0 = root.y0 = padding2; + root.x1 = dx; + root.y1 = dy / n; + root.eachBefore(positionNode(dy, n)); + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(dy2, n) { + return function(node) { + if (node.children) { + treemapDice(node, node.x0, dy2 * (node.depth + 1) / n, node.x1, dy2 * (node.depth + 2) / n); + } + var x02 = node.x0, y02 = node.y0, x12 = node.x1 - padding2, y12 = node.y1 - padding2; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + }; + } + partition2.round = function(x2) { + return arguments.length ? (round = !!x2, partition2) : round; + }; + partition2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], partition2) : [dx, dy]; + }; + partition2.padding = function(x2) { + return arguments.length ? (padding2 = +x2, partition2) : padding2; + }; + return partition2; + } + var preroot = { depth: -1 }, ambiguous = {}, imputed = {}; + function defaultId(d) { + return d.id; + } + function defaultParentId(d) { + return d.parentId; + } + function stratify() { + var id2 = defaultId, parentId = defaultParentId, path2; + function stratify2(data2) { + var nodes = Array.from(data2), currentId = id2, currentParentId = parentId, n, d, i, root, parent, node, nodeId, nodeKey, nodeByKey = /* @__PURE__ */ new Map(); + if (path2 != null) { + const I = nodes.map((d2, i2) => normalize$3(path2(d2, i2, data2))); + const P = I.map(parentof); + const S = new Set(I).add(""); + for (const i2 of P) { + if (!S.has(i2)) { + S.add(i2); + I.push(i2); + P.push(parentof(i2)); + nodes.push(imputed); + } + } + currentId = (_, i2) => I[i2]; + currentParentId = (_, i2) => P[i2]; + } + for (i = 0, n = nodes.length; i < n; ++i) { + d = nodes[i], node = nodes[i] = new Node$2(d); + if ((nodeId = currentId(d, i, data2)) != null && (nodeId += "")) { + nodeKey = node.id = nodeId; + nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); + } + if ((nodeId = currentParentId(d, i, data2)) != null && (nodeId += "")) { + node.parent = nodeId; + } + } + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (nodeId = node.parent) { + parent = nodeByKey.get(nodeId); + if (!parent) throw new Error("missing: " + nodeId); + if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); + if (parent.children) parent.children.push(node); + else parent.children = [node]; + node.parent = parent; + } else { + if (root) throw new Error("multiple roots"); + root = node; + } + } + if (!root) throw new Error("no root"); + if (path2 != null) { + while (root.data === imputed && root.children.length === 1) { + root = root.children[0], --n; + } + for (let i2 = nodes.length - 1; i2 >= 0; --i2) { + node = nodes[i2]; + if (node.data !== imputed) break; + node.data = null; + } + } + root.parent = preroot; + root.eachBefore(function(node2) { + node2.depth = node2.parent.depth + 1; + --n; + }).eachBefore(computeHeight); + root.parent = null; + if (n > 0) throw new Error("cycle"); + return root; + } + stratify2.id = function(x2) { + return arguments.length ? (id2 = optional(x2), stratify2) : id2; + }; + stratify2.parentId = function(x2) { + return arguments.length ? (parentId = optional(x2), stratify2) : parentId; + }; + stratify2.path = function(x2) { + return arguments.length ? (path2 = optional(x2), stratify2) : path2; + }; + return stratify2; + } + function normalize$3(path2) { + path2 = `${path2}`; + let i = path2.length; + if (slash(path2, i - 1) && !slash(path2, i - 2)) path2 = path2.slice(0, -1); + return path2[0] === "/" ? path2 : `/${path2}`; + } + function parentof(path2) { + let i = path2.length; + if (i < 2) return ""; + while (--i > 1) if (slash(path2, i)) break; + return path2.slice(0, i); + } + function slash(path2, i) { + if (path2[i] === "/") { + let k = 0; + while (i > 0 && path2[--i] === "\\") ++k; + if ((k & 1) === 0) return true; + } + return false; + } + function defaultSeparation$1(a2, b2) { + return a2.parent === b2.parent ? 1 : 2; + } + function nextLeft(v) { + var children2 = v.children; + return children2 ? children2[0] : v.t; + } + function nextRight(v) { + var children2 = v.children; + return children2 ? children2[children2.length - 1] : v.t; + } + function moveSubtree(wm, wp, shift) { + var change2 = shift / (wp.i - wm.i); + wp.c -= change2; + wp.s += shift; + wm.c += change2; + wp.z += shift; + wp.m += shift; + } + function executeShifts(v) { + var shift = 0, change2 = 0, children2 = v.children, i = children2.length, w2; + while (--i >= 0) { + w2 = children2[i]; + w2.z += shift; + w2.m += shift; + shift += w2.s + (change2 += w2.c); + } + } + function nextAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; + } + function TreeNode(node, i) { + this._ = node; + this.parent = null; + this.children = null; + this.A = null; + this.a = this; + this.z = 0; + this.m = 0; + this.c = 0; + this.s = 0; + this.t = null; + this.i = i; + } + TreeNode.prototype = Object.create(Node$2.prototype); + function treeRoot(root) { + var tree2 = new TreeNode(root, 0), node, nodes = [tree2], child, children2, i, n; + while (node = nodes.pop()) { + if (children2 = node._.children) { + node.children = new Array(n = children2.length); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new TreeNode(children2[i], i)); + child.parent = node; + } + } + } + (tree2.parent = new TreeNode(null, 0)).children = [tree2]; + return tree2; + } + function tree$1() { + var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null; + function tree2(root) { + var t = treeRoot(root); + t.eachAfter(firstWalk), t.parent.m = -t.z; + t.eachBefore(secondWalk); + if (nodeSize) root.eachBefore(sizeNode); + else { + var left = root, right = root, bottom = root; + root.eachBefore(function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; + }); + var s = left === right ? 1 : separation(left, right) / 2, tx2 = s - left.x, kx = dx / (right.x + s + tx2), ky = dy / (bottom.depth || 1); + root.eachBefore(function(node) { + node.x = (node.x + tx2) * kx; + node.y = node.depth * ky; + }); + } + return root; + } + function firstWalk(v) { + var children2 = v.children, siblings = v.parent.children, w2 = v.i ? siblings[v.i - 1] : null; + if (children2) { + executeShifts(v); + var midpoint = (children2[0].z + children2[children2.length - 1].z) / 2; + if (w2) { + v.z = w2.z + separation(v._, w2._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; + } + } else if (w2) { + v.z = w2.z + separation(v._, w2._); + } + v.parent.A = apportion(v, w2, v.parent.A || siblings[0]); + } + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + function apportion(v, w2, ancestor) { + if (w2) { + var vip = v, vop = v, vim = w2, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; + while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { + vom = nextLeft(vom); + vop = nextRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + moveSubtree(nextAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !nextRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !nextLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; + } + } + return ancestor; + } + function sizeNode(node) { + node.x *= dx; + node.y = node.depth * dy; + } + tree2.separation = function(x2) { + return arguments.length ? (separation = x2, tree2) : separation; + }; + tree2.size = function(x2) { + return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? null : [dx, dy]; + }; + tree2.nodeSize = function(x2) { + return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? [dx, dy] : null; + }; + return tree2; + } + function treemapSlice(parent, x02, y02, x12, y12) { + var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y12 - y02) / parent.value; + while (++i < n) { + node = nodes[i], node.x0 = x02, node.x1 = x12; + node.y0 = y02, node.y1 = y02 += node.value * k; + } + } + var phi = (1 + Math.sqrt(5)) / 2; + function squarifyRatio(ratio, parent, x02, y02, x12, y12) { + var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value2 = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; + while (i0 < n) { + dx = x12 - x02, dy = y12 - y02; + do + sumValue = nodes[i1++].value; + while (!sumValue && i1 < n); + minValue = maxValue = sumValue; + alpha = Math.max(dy / dx, dx / dy) / (value2 * ratio); + beta = sumValue * sumValue * alpha; + minRatio = Math.max(maxValue / beta, beta / minValue); + for (; i1 < n; ++i1) { + sumValue += nodeValue = nodes[i1].value; + if (nodeValue < minValue) minValue = nodeValue; + if (nodeValue > maxValue) maxValue = nodeValue; + beta = sumValue * sumValue * alpha; + newRatio = Math.max(maxValue / beta, beta / minValue); + if (newRatio > minRatio) { + sumValue -= nodeValue; + break; + } + minRatio = newRatio; + } + rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) }); + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += dy * sumValue / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += dx * sumValue / value2 : x12, y12); + value2 -= sumValue, i0 = i1; + } + return rows; + } + const treemapSquarify = (function custom2(ratio) { + function squarify(parent, x02, y02, x12, y12) { + squarifyRatio(ratio, parent, x02, y02, x12, y12); + } + squarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return squarify; + })(phi); + function treemap() { + var tile = treemapSquarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero; + function treemap2(root) { + root.x0 = root.y0 = 0; + root.x1 = dx; + root.y1 = dy; + root.eachBefore(positionNode); + paddingStack = [0]; + if (round) root.eachBefore(roundNode); + return root; + } + function positionNode(node) { + var p = paddingStack[node.depth], x02 = node.x0 + p, y02 = node.y0 + p, x12 = node.x1 - p, y12 = node.y1 - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + node.x0 = x02; + node.y0 = y02; + node.x1 = x12; + node.y1 = y12; + if (node.children) { + p = paddingStack[node.depth + 1] = paddingInner(node) / 2; + x02 += paddingLeft(node) - p; + y02 += paddingTop(node) - p; + x12 -= paddingRight(node) - p; + y12 -= paddingBottom(node) - p; + if (x12 < x02) x02 = x12 = (x02 + x12) / 2; + if (y12 < y02) y02 = y12 = (y02 + y12) / 2; + tile(node, x02, y02, x12, y12); + } + } + treemap2.round = function(x2) { + return arguments.length ? (round = !!x2, treemap2) : round; + }; + treemap2.size = function(x2) { + return arguments.length ? (dx = +x2[0], dy = +x2[1], treemap2) : [dx, dy]; + }; + treemap2.tile = function(x2) { + return arguments.length ? (tile = required(x2), treemap2) : tile; + }; + treemap2.padding = function(x2) { + return arguments.length ? treemap2.paddingInner(x2).paddingOuter(x2) : treemap2.paddingInner(); + }; + treemap2.paddingInner = function(x2) { + return arguments.length ? (paddingInner = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingInner; + }; + treemap2.paddingOuter = function(x2) { + return arguments.length ? treemap2.paddingTop(x2).paddingRight(x2).paddingBottom(x2).paddingLeft(x2) : treemap2.paddingTop(); + }; + treemap2.paddingTop = function(x2) { + return arguments.length ? (paddingTop = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingTop; + }; + treemap2.paddingRight = function(x2) { + return arguments.length ? (paddingRight = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingRight; + }; + treemap2.paddingBottom = function(x2) { + return arguments.length ? (paddingBottom = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingBottom; + }; + treemap2.paddingLeft = function(x2) { + return arguments.length ? (paddingLeft = typeof x2 === "function" ? x2 : constant(+x2), treemap2) : paddingLeft; + }; + return treemap2; + } + function treemapBinary(parent, x02, y02, x12, y12) { + var nodes = parent.children, i, n = nodes.length, sum2, sums = new Array(n + 1); + for (sums[0] = sum2 = i = 0; i < n; ++i) { + sums[i + 1] = sum2 += nodes[i].value; + } + partition2(0, n, parent.value, x02, y02, x12, y12); + function partition2(i2, j, value2, x03, y03, x13, y13) { + if (i2 >= j - 1) { + var node = nodes[i2]; + node.x0 = x03, node.y0 = y03; + node.x1 = x13, node.y1 = y13; + return; + } + var valueOffset = sums[i2], valueTarget = value2 / 2 + valueOffset, k = i2 + 1, hi = j - 1; + while (k < hi) { + var mid = k + hi >>> 1; + if (sums[mid] < valueTarget) k = mid + 1; + else hi = mid; + } + if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i2 + 1 < k) --k; + var valueLeft = sums[k] - valueOffset, valueRight = value2 - valueLeft; + if (x13 - x03 > y13 - y03) { + var xk = value2 ? (x03 * valueRight + x13 * valueLeft) / value2 : x13; + partition2(i2, k, valueLeft, x03, y03, xk, y13); + partition2(k, j, valueRight, xk, y03, x13, y13); + } else { + var yk = value2 ? (y03 * valueRight + y13 * valueLeft) / value2 : y13; + partition2(i2, k, valueLeft, x03, y03, x13, yk); + partition2(k, j, valueRight, x03, yk, x13, y13); + } + } + } + function treemapSliceDice(parent, x02, y02, x12, y12) { + (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x02, y02, x12, y12); + } + const treemapResquarify = (function custom2(ratio) { + function resquarify(parent, x02, y02, x12, y12) { + if ((rows = parent._squarify) && rows.ratio === ratio) { + var rows, row, nodes, i, j = -1, n, m2 = rows.length, value2 = parent.value; + while (++j < m2) { + row = rows[j], nodes = row.children; + for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; + if (row.dice) treemapDice(row, x02, y02, x12, value2 ? y02 += (y12 - y02) * row.value / value2 : y12); + else treemapSlice(row, x02, y02, value2 ? x02 += (x12 - x02) * row.value / value2 : x12, y12); + value2 -= row.value; + } + } else { + parent._squarify = rows = squarifyRatio(ratio, parent, x02, y02, x12, y12); + rows.ratio = ratio; + } + } + resquarify.ratio = function(x2) { + return custom2((x2 = +x2) > 1 ? x2 : 1); + }; + return resquarify; + })(phi); + function lookup$2(tree2, key2, filter2) { + const map2 = {}; + tree2.each((node) => { + const t = node.data; + if (filter2(t)) map2[key2(t)] = node; + }); + tree2.lookup = map2; + return tree2; + } + function Nest(params2) { + Transform.call(this, null, params2); + } + Nest.Definition = { + "type": "Nest", + "metadata": { + "treesource": true, + "changes": true + }, + "params": [{ + "name": "keys", + "type": "field", + "array": true + }, { + "name": "generate", + "type": "boolean" + }] + }; + const children$1 = (n) => n.values; + inherits(Nest, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Nest transform requires an upstream data source."); + } + var gen = _.generate, mod = _.modified(), out = pulse2.clone(), tree2 = this.value; + if (!tree2 || mod || pulse2.changed()) { + if (tree2) { + tree2.each((node) => { + if (node.children && isTuple(node.data)) { + out.rem.push(node.data); + } + }); + } + this.value = tree2 = hierarchy({ + values: array$5(_.keys).reduce((n, k) => { + n.key(k); + return n; + }, nest()).entries(out.source) + }, children$1); + if (gen) { + tree2.each((node) => { + if (node.children) { + node = ingest$1(node.data); + out.add.push(node); + out.source.push(node); + } + }); + } + lookup$2(tree2, tupleid, tupleid); + } + out.source.root = tree2; + return out; + } + }); + function nest() { + const keys2 = [], nest2 = { + entries: (array2) => entries(apply2(array2, 0), 0), + key: (d) => (keys2.push(d), nest2) + }; + function apply2(array2, depth) { + if (depth >= keys2.length) { + return array2; + } + const n = array2.length, key2 = keys2[depth++], valuesByKey = {}, result = {}; + let i = -1, keyValue, value2, values2; + while (++i < n) { + keyValue = key2(value2 = array2[i]) + ""; + if (values2 = valuesByKey[keyValue]) { + values2.push(value2); + } else { + valuesByKey[keyValue] = [value2]; + } + } + for (keyValue in valuesByKey) { + result[keyValue] = apply2(valuesByKey[keyValue], depth); + } + return result; + } + function entries(map2, depth) { + if (++depth > keys2.length) return map2; + const array2 = []; + for (const key2 in map2) { + array2.push({ + key: key2, + values: entries(map2[key2], depth) + }); + } + return array2; + } + return nest2; + } + function HierarchyLayout(params2) { + Transform.call(this, null, params2); + } + const defaultSeparation = (a2, b2) => a2.parent === b2.parent ? 1 : 2; + inherits(HierarchyLayout, Transform, { + transform(_, pulse2) { + if (!pulse2.source || !pulse2.source.root) { + error(this.constructor.name + " transform requires a backing tree data source."); + } + const layout = this.layout(_.method), fields = this.fields, root = pulse2.source.root, as = _.as || fields; + if (_.field) root.sum(_.field); + else root.count(); + if (_.sort) root.sort(stableCompare(_.sort, (d) => d.data)); + setParams(layout, this.params, _); + if (layout.separation) { + layout.separation(_.separation !== false ? defaultSeparation : one$2); + } + try { + this.value = layout(root); + } catch (err) { + error(err); + } + root.each((node) => setFields(node, fields, as)); + return pulse2.reflow(_.modified()).modifies(as).modifies("leaf"); + } + }); + function setParams(layout, params2, _) { + for (let p, i = 0, n = params2.length; i < n; ++i) { + p = params2[i]; + if (p in _) layout[p](_[p]); + } + } + function setFields(node, fields, as) { + const t = node.data, n = fields.length - 1; + for (let i = 0; i < n; ++i) { + t[as[i]] = node[fields[i]]; + } + t[as[n]] = node.children ? node.children.length : 0; + } + const Output$3 = ["x", "y", "r", "depth", "children"]; + function Pack(params2) { + HierarchyLayout.call(this, params2); + } + Pack.Definition = { + "type": "Pack", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "radius", + "type": "field", + "default": null + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$3.length, + "default": Output$3 + }] + }; + inherits(Pack, HierarchyLayout, { + layout: pack, + params: ["radius", "size", "padding"], + fields: Output$3 + }); + const Output$2 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Partition(params2) { + HierarchyLayout.call(this, params2); + } + Partition.Definition = { + "type": "Partition", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$2.length, + "default": Output$2 + }] + }; + inherits(Partition, HierarchyLayout, { + layout: partition$1, + params: ["size", "round", "padding"], + fields: Output$2 + }); + function Stratify(params2) { + Transform.call(this, null, params2); + } + Stratify.Definition = { + "type": "Stratify", + "metadata": { + "treesource": true + }, + "params": [{ + "name": "key", + "type": "field", + "required": true + }, { + "name": "parentKey", + "type": "field", + "required": true + }] + }; + inherits(Stratify, Transform, { + transform(_, pulse2) { + if (!pulse2.source) { + error("Stratify transform requires an upstream data source."); + } + let tree2 = this.value; + const mod = _.modified(), out = pulse2.fork(pulse2.ALL).materialize(pulse2.SOURCE), run2 = !tree2 || mod || pulse2.changed(pulse2.ADD_REM) || pulse2.modified(_.key.fields) || pulse2.modified(_.parentKey.fields); + out.source = out.source.slice(); + if (run2) { + tree2 = out.source.length ? lookup$2(stratify().id(_.key).parentId(_.parentKey)(out.source), _.key, truthy) : lookup$2(stratify()([{}]), _.key, _.key); + } + out.source.root = this.value = tree2; + return out; + } + }); + const Layouts = { + tidy: tree$1, + cluster + }; + const Output$1$1 = ["x", "y", "depth", "children"]; + function Tree(params2) { + HierarchyLayout.call(this, params2); + } + Tree.Definition = { + "type": "Tree", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "tidy", + "values": ["tidy", "cluster"] + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "nodeSize", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "separation", + "type": "boolean", + "default": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$1$1.length, + "default": Output$1$1 + }] + }; + inherits(Tree, HierarchyLayout, { + /** + * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. + */ + layout(method2) { + const m2 = method2 || "tidy"; + if (has$1(Layouts, m2)) return Layouts[m2](); + else error("Unrecognized Tree layout method: " + m2); + }, + params: ["size", "nodeSize"], + fields: Output$1$1 + }); + function TreeLinks(params2) { + Transform.call(this, [], params2); + } + TreeLinks.Definition = { + "type": "TreeLinks", + "metadata": { + "tree": true, + "generates": true, + "changes": true + }, + "params": [] + }; + inherits(TreeLinks, Transform, { + transform(_, pulse2) { + const links = this.value, tree2 = pulse2.source && pulse2.source.root, out = pulse2.fork(pulse2.NO_SOURCE), lut = {}; + if (!tree2) error("TreeLinks transform requires a tree data source."); + if (pulse2.changed(pulse2.ADD_REM)) { + out.rem = links; + pulse2.visit(pulse2.SOURCE, (t) => lut[tupleid(t)] = 1); + tree2.each((node) => { + const t = node.data, p = node.parent && node.parent.data; + if (p && lut[tupleid(t)] && lut[tupleid(p)]) { + out.add.push(ingest$1({ + source: p, + target: t + })); + } + }); + this.value = out.add; + } else if (pulse2.changed(pulse2.MOD)) { + pulse2.visit(pulse2.MOD, (t) => lut[tupleid(t)] = 1); + links.forEach((link2) => { + if (lut[tupleid(link2.source)] || lut[tupleid(link2.target)]) { + out.mod.push(link2); + } + }); + } + return out; + } + }); + const Tiles = { + binary: treemapBinary, + dice: treemapDice, + slice: treemapSlice, + slicedice: treemapSliceDice, + squarify: treemapSquarify, + resquarify: treemapResquarify + }; + const Output$4 = ["x0", "y0", "x1", "y1", "depth", "children"]; + function Treemap(params2) { + HierarchyLayout.call(this, params2); + } + Treemap.Definition = { + "type": "Treemap", + "metadata": { + "tree": true, + "modifies": true + }, + "params": [{ + "name": "field", + "type": "field" + }, { + "name": "sort", + "type": "compare" + }, { + "name": "method", + "type": "enum", + "default": "squarify", + "values": ["squarify", "resquarify", "binary", "dice", "slice", "slicedice"] + }, { + "name": "padding", + "type": "number", + "default": 0 + }, { + "name": "paddingInner", + "type": "number", + "default": 0 + }, { + "name": "paddingOuter", + "type": "number", + "default": 0 + }, { + "name": "paddingTop", + "type": "number", + "default": 0 + }, { + "name": "paddingRight", + "type": "number", + "default": 0 + }, { + "name": "paddingBottom", + "type": "number", + "default": 0 + }, { + "name": "paddingLeft", + "type": "number", + "default": 0 + }, { + "name": "ratio", + "type": "number", + "default": 1.618033988749895 + }, { + "name": "round", + "type": "boolean", + "default": false + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "as", + "type": "string", + "array": true, + "length": Output$4.length, + "default": Output$4 + }] + }; + inherits(Treemap, HierarchyLayout, { + /** + * Treemap layout generator. Adds 'method' and 'ratio' parameters + * to configure the underlying tile method. + */ + layout() { + const x2 = treemap(); + x2.ratio = (_) => { + const t = x2.tile(); + if (t.ratio) x2.tile(t.ratio(_)); + }; + x2.method = (_) => { + if (has$1(Tiles, _)) x2.tile(Tiles[_]); + else error("Unrecognized Treemap layout method: " + _); + }; + return x2; + }, + params: ["method", "ratio", "size", "round", "padding", "paddingInner", "paddingOuter", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"], + fields: Output$4 + }); + const tree = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + nest: Nest, + pack: Pack, + partition: Partition, + stratify: Stratify, + tree: Tree, + treelinks: TreeLinks, + treemap: Treemap + }, Symbol.toStringTag, { value: "Module" })); + const ALPHA_MASK = 4278190080; + function baseBitmaps($2, data2) { + const bitmap = $2.bitmap(); + (data2 || []).forEach((d) => bitmap.set($2(d.boundary[0]), $2(d.boundary[3]))); + return [bitmap, void 0]; + } + function markBitmaps($2, baseMark, avoidMarks, labelInside, isGroupArea) { + const width2 = $2.width, height2 = $2.height, border = labelInside || isGroupArea, context2 = domCanvas(width2, height2).getContext("2d"), baseMarkContext = domCanvas(width2, height2).getContext("2d"), strokeContext = border && domCanvas(width2, height2).getContext("2d"); + avoidMarks.forEach((items) => draw(context2, items, false)); + draw(baseMarkContext, baseMark, false); + if (border) { + draw(strokeContext, baseMark, true); + } + const buffer = getBuffer(context2, width2, height2), baseMarkBuffer = getBuffer(baseMarkContext, width2, height2), strokeBuffer = border && getBuffer(strokeContext, width2, height2), layer1 = $2.bitmap(), layer2 = border && $2.bitmap(); + let x2, y2, u2, v, index2, alpha, strokeAlpha, baseMarkAlpha; + for (y2 = 0; y2 < height2; ++y2) { + for (x2 = 0; x2 < width2; ++x2) { + index2 = y2 * width2 + x2; + alpha = buffer[index2] & ALPHA_MASK; + baseMarkAlpha = baseMarkBuffer[index2] & ALPHA_MASK; + strokeAlpha = border && strokeBuffer[index2] & ALPHA_MASK; + if (alpha || strokeAlpha || baseMarkAlpha) { + u2 = $2(x2); + v = $2(y2); + if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u2, v); + if (border && (alpha || strokeAlpha)) layer2.set(u2, v); + } + } + } + return [layer1, layer2]; + } + function getBuffer(context2, width2, height2) { + return new Uint32Array(context2.getImageData(0, 0, width2, height2).data.buffer); + } + function draw(context2, items, interior) { + if (!items.length) return; + const type2 = items[0].mark.marktype; + if (type2 === "group") { + items.forEach((group2) => { + group2.items.forEach((mark) => draw(context2, mark.items, interior)); + }); + } else { + Marks[type2].draw(context2, { + items: interior ? items.map(prepare) : items + }); + } + } + function prepare(source2) { + const item = rederive(source2, {}); + if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) { + return { + ...item, + strokeOpacity: 1, + stroke: "#000", + fillOpacity: 0 + }; + } + return item; + } + const DIV = 5, MOD = 31, SIZE = 32, RIGHT0 = new Uint32Array(SIZE + 1), RIGHT1 = new Uint32Array(SIZE + 1); + RIGHT1[0] = 0; + RIGHT0[0] = ~RIGHT1[0]; + for (let i = 1; i <= SIZE; ++i) { + RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; + RIGHT0[i] = ~RIGHT1[i]; + } + function Bitmap(w2, h2) { + const array2 = new Uint32Array(~~((w2 * h2 + SIZE) / SIZE)); + function _set(index2, mask) { + array2[index2] |= mask; + } + function _clear(index2, mask) { + array2[index2] &= mask; + } + return { + array: array2, + get: (x2, y2) => { + const index2 = y2 * w2 + x2; + return array2[index2 >>> DIV] & 1 << (index2 & MOD); + }, + set: (x2, y2) => { + const index2 = y2 * w2 + x2; + _set(index2 >>> DIV, 1 << (index2 & MOD)); + }, + clear: (x2, y2) => { + const index2 = y2 * w2 + x2; + _clear(index2 >>> DIV, ~(1 << (index2 & MOD))); + }, + getRange: (x2, y2, x22, y22) => { + let r = y22, start, end, indexStart, indexEnd; + for (; r >= y2; --r) { + start = r * w2 + x2; + end = r * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + if (array2[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) { + return true; + } + } else { + if (array2[indexStart] & RIGHT0[start & MOD]) return true; + if (array2[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; + for (let i = indexStart + 1; i < indexEnd; ++i) { + if (array2[i]) return true; + } + } + } + return false; + }, + setRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); + } else { + _set(indexStart, RIGHT0[start & MOD]); + _set(indexEnd, RIGHT1[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 4294967295); + } + } + }, + clearRange: (x2, y2, x22, y22) => { + let start, end, indexStart, indexEnd, i; + for (; y2 <= y22; ++y2) { + start = y2 * w2 + x2; + end = y2 * w2 + x22; + indexStart = start >>> DIV; + indexEnd = end >>> DIV; + if (indexStart === indexEnd) { + _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); + } else { + _clear(indexStart, RIGHT1[start & MOD]); + _clear(indexEnd, RIGHT0[(end & MOD) + 1]); + for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0); + } + } + }, + outOfBounds: (x2, y2, x22, y22) => x2 < 0 || y2 < 0 || y22 >= h2 || x22 >= w2 + }; + } + function scaler(width2, height2, padding2) { + const ratio = Math.max(1, Math.sqrt(width2 * height2 / 1e6)), w2 = ~~((width2 + 2 * padding2 + ratio) / ratio), h2 = ~~((height2 + 2 * padding2 + ratio) / ratio), scale2 = (_) => ~~((_ + padding2) / ratio); + scale2.invert = (_) => _ * ratio - padding2; + scale2.bitmap = () => Bitmap(w2, h2); + scale2.ratio = ratio; + scale2.padding = padding2; + scale2.width = width2; + scale2.height = height2; + return scale2; + } + function placeAreaLabelNaive($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height; + return function(d) { + const items = d.datum.datum.items[markIndex].items, n = items.length, textHeight = d.datum.fontSize, textWidth = textMetrics.width(d.datum, d.datum.text); + let maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + areaWidth = Math.abs(x2 - x12 + y2 - y12); + if (areaWidth >= maxAreaWidth) { + maxAreaWidth = areaWidth; + d.x = x3; + d.y = y3; + } + } + x3 = textWidth / 2; + y3 = textHeight / 2; + x12 = d.x - x3; + x2 = d.x + x3; + y12 = d.y - y3; + y2 = d.y + y3; + d.align = "center"; + if (x12 < 0 && x2 <= width2) { + d.align = "left"; + } else if (0 <= x12 && width2 < x2) { + d.align = "right"; + } + d.baseline = "middle"; + if (y12 < 0 && y2 <= height2) { + d.baseline = "top"; + } else if (0 <= y12 && height2 < y2) { + d.baseline = "bottom"; + } + return true; + }; + } + function outOfBounds(x2, y2, textWidth, textHeight, width2, height2) { + let r = textWidth / 2; + return x2 - r < 0 || x2 + r > width2 || y2 - (r = textHeight / 2) < 0 || y2 + r > height2; + } + function collision($2, x2, y2, textHeight, textWidth, h2, bm0, bm1) { + const w2 = textWidth * h2 / (textHeight * 2), x12 = $2(x2 - w2), x22 = $2(x2 + w2), y12 = $2(y2 - (h2 = h2 / 2)), y22 = $2(y2 + h2); + return bm0.outOfBounds(x12, y12, x22, y22) || bm0.getRange(x12, y12, x22, y22) || bm1 && bm1.getRange(x12, y12, x22, y22); + } + function placeAreaLabelReducedSearch($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1]; + function tryLabel(_x, _y, maxSize, textWidth, textHeight) { + const x2 = $2.invert(_x), y2 = $2.invert(_y); + let lo = maxSize, hi = height2, mid; + if (!outOfBounds(x2, y2, textWidth, textHeight, width2, height2) && !collision($2, x2, y2, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x2, y2, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x2, y2, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + return [x2, y2, lo, true]; + } + } + } + return function(d) { + const items = d.datum.datum.items[markIndex].items, n = items.length, textHeight = d.datum.fontSize, textWidth = textMetrics.width(d.datum, d.datum.text); + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + if (x12 > x2) { + swapTmp = x12; + x12 = x2; + x2 = swapTmp; + } + if (y12 > y2) { + swapTmp = y12; + y12 = y2; + y2 = swapTmp; + } + _x1 = $2(x12); + _x2 = $2(x2); + _xMid = ~~((_x1 + _x2) / 2); + _y1 = $2(y12); + _y2 = $2(y2); + _yMid = ~~((_y1 + _y2) / 2); + for (_x = _xMid; _x >= _x1; --_x) { + for (_y = _yMid; _y >= _y1; --_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d.x, d.y, maxSize, labelPlaced] = result; + } + } + } + for (_x = _xMid; _x <= _x2; ++_x) { + for (_y = _yMid; _y <= _y2; ++_y) { + result = tryLabel(_x, _y, maxSize, textWidth, textHeight); + if (result) { + [d.x, d.y, maxSize, labelPlaced] = result; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d.x = x3; + d.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d.x - x3), $2(d.y - y3), $2(d.x + x3), $2(d.y + y3)); + d.align = "center"; + d.baseline = "middle"; + return true; + } else { + return false; + } + }; + } + const X_DIR = [-1, -1, 1, 1]; + const Y_DIR = [-1, 1, -1, 1]; + function placeAreaLabelFloodFill($2, bitmaps, avoidBaseMark, markIndex) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], bm2 = $2.bitmap(); + return function(d) { + const items = d.datum.datum.items[markIndex].items, n = items.length, textHeight = d.datum.fontSize, textWidth = textMetrics.width(d.datum, d.datum.text), stack = []; + let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x12, x2, y12, y2, x3, y3, _x, _y, lo, hi, mid, areaWidth; + for (let i = 0; i < n; ++i) { + x12 = items[i].x; + y12 = items[i].y; + x2 = items[i].x2 === void 0 ? x12 : items[i].x2; + y2 = items[i].y2 === void 0 ? y12 : items[i].y2; + stack.push([$2((x12 + x2) / 2), $2((y12 + y2) / 2)]); + while (stack.length) { + [_x, _y] = stack.pop(); + if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; + bm2.set(_x, _y); + for (let j = 0; j < 4; ++j) { + x3 = _x + X_DIR[j]; + y3 = _y + Y_DIR[j]; + if (!bm2.outOfBounds(x3, y3, x3, y3)) stack.push([x3, y3]); + } + x3 = $2.invert(_x); + y3 = $2.invert(_y); + lo = maxSize; + hi = height2; + if (!outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, lo, bm0, bm1) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + while (hi - lo >= 1) { + mid = (lo + hi) / 2; + if (collision($2, x3, y3, textHeight, textWidth, mid, bm0, bm1)) { + hi = mid; + } else { + lo = mid; + } + } + if (lo > maxSize) { + d.x = x3; + d.y = y3; + maxSize = lo; + labelPlaced = true; + } + } + } + if (!labelPlaced && !avoidBaseMark) { + areaWidth = Math.abs(x2 - x12 + y2 - y12); + x3 = (x12 + x2) / 2; + y3 = (y12 + y2) / 2; + if (areaWidth >= maxAreaWidth && !outOfBounds(x3, y3, textWidth, textHeight, width2, height2) && !collision($2, x3, y3, textHeight, textWidth, textHeight, bm0, null)) { + maxAreaWidth = areaWidth; + d.x = x3; + d.y = y3; + labelPlaced2 = true; + } + } + } + if (labelPlaced || labelPlaced2) { + x3 = textWidth / 2; + y3 = textHeight / 2; + bm0.setRange($2(d.x - x3), $2(d.y - y3), $2(d.x + x3), $2(d.y + y3)); + d.align = "center"; + d.baseline = "middle"; + return true; + } else { + return false; + } + }; + } + const Aligns = ["right", "center", "left"], Baselines = ["bottom", "middle", "top"]; + function placeMarkLabel($2, bitmaps, anchors, offsets2) { + const width2 = $2.width, height2 = $2.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets2.length; + return function(d) { + const boundary = d.boundary, textHeight = d.datum.fontSize; + if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width2 || boundary[3] > height2) { + return false; + } + let textWidth = d.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x12, x2, y12, y2, xc, yc, _x1, _x2, _y1, _y2; + for (let i = 0; i < n; ++i) { + dx = (anchors[i] & 3) - 1; + dy = (anchors[i] >>> 2 & 3) - 1; + isInside = dx === 0 && dy === 0 || offsets2[i] < 0; + sizeFactor = dx && dy ? Math.SQRT1_2 : 1; + insideFactor = offsets2[i] < 0 ? -1 : 1; + x12 = boundary[1 + dx] + offsets2[i] * dx * sizeFactor; + yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets2[i] * dy * sizeFactor; + y12 = yc - textHeight / 2; + y2 = yc + textHeight / 2; + _x1 = $2(x12); + _y1 = $2(y12); + _y2 = $2(y2); + if (!textWidth) { + if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x12, x12, y12, y2, boundary, isInside)) { + continue; + } else { + textWidth = textMetrics.width(d.datum, d.datum.text); + } + } + xc = x12 + insideFactor * textWidth * dx / 2; + x12 = xc - textWidth / 2; + x2 = xc + textWidth / 2; + _x1 = $2(x12); + _x2 = $2(x2); + if (test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside)) { + d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x12; + d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y12; + d.align = Aligns[dx * insideFactor + 1]; + d.baseline = Baselines[dy * insideFactor + 1]; + bm0.setRange(_x1, _y1, _x2, _y2); + return true; + } + } + return false; + }; + } + function test(_x1, _x2, _y1, _y2, bm0, bm1, x12, x2, y12, y2, boundary, isInside) { + return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); + } + const TOP = 0, MIDDLE = 4, BOTTOM = 8, LEFT = 0, CENTER = 1, RIGHT = 2; + const anchorCode = { + "top-left": TOP + LEFT, + "top": TOP + CENTER, + "top-right": TOP + RIGHT, + "left": MIDDLE + LEFT, + "middle": MIDDLE + CENTER, + "right": MIDDLE + RIGHT, + "bottom-left": BOTTOM + LEFT, + "bottom": BOTTOM + CENTER, + "bottom-right": BOTTOM + RIGHT + }; + const placeAreaLabel = { + "naive": placeAreaLabelNaive, + "reduced-search": placeAreaLabelReducedSearch, + "floodfill": placeAreaLabelFloodFill + }; + function labelLayout(texts, size, compare2, offset2, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding2, method2) { + if (!texts.length) return texts; + const positions = Math.max(offset2.length, anchor.length), offsets2 = getOffsets(offset2, positions), anchors = getAnchors(anchor, positions), marktype = markType(texts[0].datum), grouptype = marktype === "group" && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === "area", boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding2 === null || padding2 === Infinity, isNaiveGroupArea = isGroupArea && method2 === "naive"; + let maxTextWidth = -1, maxTextHeight = -1; + const data2 = texts.map((d) => { + const textWidth = infPadding ? textMetrics.width(d, d.text) : void 0; + maxTextWidth = Math.max(maxTextWidth, textWidth); + maxTextHeight = Math.max(maxTextHeight, d.fontSize); + return { + datum: d, + opacity: 0, + x: void 0, + y: void 0, + align: void 0, + baseline: void 0, + boundary: boundary(d), + textWidth + }; + }); + padding2 = padding2 === null || padding2 === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset2) : padding2; + const $2 = scaler(size[0], size[1], padding2); + let bitmaps; + if (!isNaiveGroupArea) { + if (compare2) { + data2.sort((a2, b2) => compare2(a2.datum, b2.datum)); + } + let labelInside = false; + for (let i = 0; i < anchors.length && !labelInside; ++i) { + labelInside = anchors[i] === 5 || offsets2[i] < 0; + } + const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d) => d.datum); + bitmaps = avoidMarks.length || baseMark ? markBitmaps($2, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($2, avoidBaseMark && data2); + } + const place2 = isGroupArea ? placeAreaLabel[method2]($2, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($2, bitmaps, anchors, offsets2); + data2.forEach((d) => d.opacity = +place2(d)); + return data2; + } + function getOffsets(_, count2) { + const offsets2 = new Float64Array(count2), n = _.length; + for (let i = 0; i < n; ++i) offsets2[i] = _[i] || 0; + for (let i = n; i < count2; ++i) offsets2[i] = offsets2[n - 1]; + return offsets2; + } + function getAnchors(_, count2) { + const anchors = new Int8Array(count2), n = _.length; + for (let i = 0; i < n; ++i) anchors[i] |= anchorCode[_[i]]; + for (let i = n; i < count2; ++i) anchors[i] = anchors[n - 1]; + return anchors; + } + function markType(item) { + return item && item.mark && item.mark.marktype; + } + function markBoundary(marktype, grouptype, lineAnchor, markIndex) { + const xy = (d) => [d.x, d.x, d.x, d.y, d.y, d.y]; + if (!marktype) { + return xy; + } else if (marktype === "line" || marktype === "area") { + return (d) => xy(d.datum); + } else if (grouptype === "line") { + return (d) => { + const items = d.datum.items[markIndex].items; + return xy(items.length ? items[lineAnchor === "start" ? 0 : items.length - 1] : { + x: NaN, + y: NaN + }); + }; + } else { + return (d) => { + const b2 = d.datum.bounds; + return [b2.x1, (b2.x1 + b2.x2) / 2, b2.x2, b2.y1, (b2.y1 + b2.y2) / 2, b2.y2]; + }; + } + } + const Output$1 = ["x", "y", "opacity", "align", "baseline"]; + const Anchors = ["top-left", "left", "bottom-left", "top", "bottom", "top-right", "right", "bottom-right"]; + function Label$1(params2) { + Transform.call(this, null, params2); + } + Label$1.Definition = { + type: "Label", + metadata: { + modifies: true + }, + params: [{ + name: "size", + type: "number", + array: true, + length: 2, + required: true + }, { + name: "sort", + type: "compare" + }, { + name: "anchor", + type: "string", + array: true, + default: Anchors + }, { + name: "offset", + type: "number", + array: true, + default: [1] + }, { + name: "padding", + type: "number", + default: 0, + null: true + }, { + name: "lineAnchor", + type: "string", + values: ["start", "end"], + default: "end" + }, { + name: "markIndex", + type: "number", + default: 0 + }, { + name: "avoidBaseMark", + type: "boolean", + default: true + }, { + name: "avoidMarks", + type: "data", + array: true + }, { + name: "method", + type: "string", + default: "naive" + }, { + name: "as", + type: "string", + array: true, + length: Output$1.length, + default: Output$1 + }] + }; + inherits(Label$1, Transform, { + transform(_, pulse2) { + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || modp("sort"))) return; + if (!_.size || _.size.length !== 2) { + error("Size parameter should be specified as a [width, height] array."); + } + const as = _.as || Output$1; + labelLayout(pulse2.materialize(pulse2.SOURCE).source || [], _.size, _.sort, array$5(_.offset == null ? 1 : _.offset), array$5(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || "end", _.markIndex || 0, _.padding === void 0 ? 0 : _.padding, _.method || "naive").forEach((l) => { + const t = l.datum; + t[as[0]] = l.x; + t[as[1]] = l.y; + t[as[2]] = l.opacity; + t[as[3]] = l.align; + t[as[4]] = l.baseline; + }); + return pulse2.reflow(mod).modifies(as); + } + }); + const label = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + label: Label$1 + }, Symbol.toStringTag, { value: "Module" })); + function partition(data2, groupby) { + var groups = [], get2 = function(f) { + return f(t); + }, map2, i, n, t, k, g; + if (groupby == null) { + groups.push(data2); + } else { + for (map2 = {}, i = 0, n = data2.length; i < n; ++i) { + t = data2[i]; + k = groupby.map(get2); + g = map2[k]; + if (!g) { + map2[k] = g = []; + g.dims = k; + groups.push(g); + } + g.push(t); + } + } + return groups; + } + function Loess(params2) { + Transform.call(this, null, params2); + } + Loess.Definition = { + "type": "Loess", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "bandwidth", + "type": "number", + "default": 0.3 + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Loess, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), m2 = names.length, as = _.as || [accessorName(_.x), accessorName(_.y)], values2 = []; + groups.forEach((g) => { + loess(g, _.x, _.y, _.bandwidth || 0.3).forEach((p) => { + const t = {}; + for (let i = 0; i < m2; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }); + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const Methods = { + constant: constant$4, + linear: linear$2, + log: log$3, + exp: exp$1, + pow: pow$3, + quad, + poly + }; + const degreesOfFreedom = (method2, order) => method2 === "poly" ? order : method2 === "quad" ? 2 : 1; + function Regression(params2) { + Transform.call(this, null, params2); + } + Regression.Definition = { + "type": "Regression", + "metadata": { + "generates": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "groupby", + "type": "field", + "array": true + }, { + "name": "method", + "type": "string", + "default": "linear", + "values": Object.keys(Methods) + }, { + "name": "order", + "type": "number", + "default": 3 + }, { + "name": "extent", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "params", + "type": "boolean", + "default": false + }, { + "name": "as", + "type": "string", + "array": true + }] + }; + inherits(Regression, Transform, { + transform(_, pulse2) { + const out = pulse2.fork(pulse2.NO_SOURCE | pulse2.NO_FIELDS); + if (!this.value || pulse2.changed() || _.modified()) { + const source2 = pulse2.materialize(pulse2.SOURCE).source, groups = partition(source2, _.groupby), names = (_.groupby || []).map(accessorName), method2 = _.method || "linear", order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method2, order), as = _.as || [accessorName(_.x), accessorName(_.y)], fit2 = Methods[method2], values2 = []; + let domain2 = _.extent; + if (!has$1(Methods, method2)) { + error("Invalid regression method: " + method2); + } + if (domain2 != null) { + if (method2 === "log" && domain2[0] <= 0) { + pulse2.dataflow.warn("Ignoring extent with values <= 0 for log regression."); + domain2 = null; + } + } + groups.forEach((g) => { + const n = g.length; + if (n <= dof) { + pulse2.dataflow.warn("Skipping regression with more parameters than data points."); + return; + } + const model = fit2(g, _.x, _.y, order); + if (_.params) { + values2.push(ingest$1({ + keys: g.dims, + coef: model.coef, + rSquared: model.rSquared + })); + return; + } + const dom = domain2 || extent(g, _.x), add2 = (p) => { + const t = {}; + for (let i = 0; i < names.length; ++i) { + t[names[i]] = g.dims[i]; + } + t[as[0]] = p[0]; + t[as[1]] = p[1]; + values2.push(ingest$1(t)); + }; + if (method2 === "linear" || method2 === "constant") { + dom.forEach((x2) => add2([x2, model.predict(x2)])); + } else { + sampleCurve(model.predict, dom, 25, 200).forEach(add2); + } + }); + if (this.value) out.rem = this.value; + this.value = out.add = out.source = values2; + } + return out; + } + }); + const reg = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + loess: Loess, + regression: Regression + }, Symbol.toStringTag, { value: "Module" })); + const epsilon$1 = 11102230246251565e-32; + const splitter = 134217729; + const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1; + function sum(elen, e, flen, f, h2) { + let Q, Qnew, hh, bvirt; + let enow = e[0]; + let fnow = f[0]; + let eindex = 0; + let findex = 0; + if (fnow > enow === fnow > -enow) { + Q = enow; + enow = e[++eindex]; + } else { + Q = fnow; + fnow = f[++findex]; + } + let hindex = 0; + if (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = enow + Q; + hh = Q - (Qnew - enow); + enow = e[++eindex]; + } else { + Qnew = fnow + Q; + hh = Q - (Qnew - fnow); + fnow = f[++findex]; + } + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + while (eindex < elen && findex < flen) { + if (fnow > enow === fnow > -enow) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; + } else { + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; + } + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + } + while (eindex < elen) { + Qnew = Q + enow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (enow - bvirt); + enow = e[++eindex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + while (findex < flen) { + Qnew = Q + fnow; + bvirt = Qnew - Q; + hh = Q - (Qnew - bvirt) + (fnow - bvirt); + fnow = f[++findex]; + Q = Qnew; + if (hh !== 0) { + h2[hindex++] = hh; + } + } + if (Q !== 0 || hindex === 0) { + h2[hindex++] = Q; + } + return hindex; + } + function estimate(elen, e) { + let Q = e[0]; + for (let i = 1; i < elen; i++) Q += e[i]; + return Q; + } + function vec(n) { + return new Float64Array(n); + } + const ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1; + const ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1; + const ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1; + const B = vec(4); + const C1 = vec(8); + const C2 = vec(12); + const D = vec(16); + const u = vec(4); + function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { + let acxtail, acytail, bcxtail, bcytail; + let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3; + const acx = ax - cx; + const bcx = bx - cx; + const acy = ay - cy; + const bcy = by - cy; + s1 = acx * bcy; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcx; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + B[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + B[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + B[2] = _j - (u3 - bvirt) + (_i - bvirt); + B[3] = u3; + let det = estimate(4, B); + let errbound = ccwerrboundB * detsum; + if (det >= errbound || -det >= errbound) { + return det; + } + bvirt = ax - acx; + acxtail = ax - (acx + bvirt) + (bvirt - cx); + bvirt = bx - bcx; + bcxtail = bx - (bcx + bvirt) + (bvirt - cx); + bvirt = ay - acy; + acytail = ay - (acy + bvirt) + (bvirt - cy); + bvirt = by - bcy; + bcytail = by - (bcy + bvirt) + (bvirt - cy); + if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) { + return det; + } + errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); + det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); + if (det >= errbound || -det >= errbound) return det; + s1 = acxtail * bcy; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcy; + bhi = c2 - (c2 - bcy); + blo = bcy - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcx; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcx; + bhi = c2 - (c2 - bcx); + blo = bcx - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C1len = sum(4, B, 4, u, C1); + s1 = acx * bcytail; + c2 = splitter * acx; + ahi = c2 - (c2 - acx); + alo = acx - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acy * bcxtail; + c2 = splitter * acy; + ahi = c2 - (c2 - acy); + alo = acy - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const C2len = sum(C1len, C1, 4, u, C2); + s1 = acxtail * bcytail; + c2 = splitter * acxtail; + ahi = c2 - (c2 - acxtail); + alo = acxtail - ahi; + c2 = splitter * bcytail; + bhi = c2 - (c2 - bcytail); + blo = bcytail - bhi; + s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); + t12 = acytail * bcxtail; + c2 = splitter * acytail; + ahi = c2 - (c2 - acytail); + alo = acytail - ahi; + c2 = splitter * bcxtail; + bhi = c2 - (c2 - bcxtail); + blo = bcxtail - bhi; + t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); + _i = s0 - t02; + bvirt = s0 - _i; + u[0] = s0 - (_i + bvirt) + (bvirt - t02); + _j = s1 + _i; + bvirt = _j - s1; + _0 = s1 - (_j - bvirt) + (_i - bvirt); + _i = _0 - t12; + bvirt = _0 - _i; + u[1] = _0 - (_i + bvirt) + (bvirt - t12); + u3 = _j + _i; + bvirt = u3 - _j; + u[2] = _j - (u3 - bvirt) + (_i - bvirt); + u[3] = u3; + const Dlen = sum(C2len, C2, 4, u, D); + return D[Dlen - 1]; + } + function orient2d(ax, ay, bx, by, cx, cy) { + const detleft = (ay - cy) * (bx - cx); + const detright = (ax - cx) * (by - cy); + const det = detleft - detright; + const detsum = Math.abs(detleft + detright); + if (Math.abs(det) >= ccwerrboundA * detsum) return det; + return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); + } + const EPSILON$1 = Math.pow(2, -52); + const EDGE_STACK = new Uint32Array(512); + class Delaunator { + static from(points2, getX = defaultGetX, getY = defaultGetY) { + const n = points2.length; + const coords = new Float64Array(n * 2); + for (let i = 0; i < n; i++) { + const p = points2[i]; + coords[2 * i] = getX(p); + coords[2 * i + 1] = getY(p); + } + return new Delaunator(coords); + } + constructor(coords) { + const n = coords.length >> 1; + if (n > 0 && typeof coords[0] !== "number") throw new Error("Expected coords to contain numbers."); + this.coords = coords; + const maxTriangles = Math.max(2 * n - 5, 0); + this._triangles = new Uint32Array(maxTriangles * 3); + this._halfedges = new Int32Array(maxTriangles * 3); + this._hashSize = Math.ceil(Math.sqrt(n)); + this._hullPrev = new Uint32Array(n); + this._hullNext = new Uint32Array(n); + this._hullTri = new Uint32Array(n); + this._hullHash = new Int32Array(this._hashSize); + this._ids = new Uint32Array(n); + this._dists = new Float64Array(n); + this.update(); + } + update() { + const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; + const n = coords.length >> 1; + let minX = Infinity; + let minY = Infinity; + let maxX = -Infinity; + let maxY2 = -Infinity; + for (let i = 0; i < n; i++) { + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (x2 < minX) minX = x2; + if (y2 < minY) minY = y2; + if (x2 > maxX) maxX = x2; + if (y2 > maxY2) maxY2 = y2; + this._ids[i] = i; + } + const cx = (minX + maxX) / 2; + const cy = (minY + maxY2) / 2; + let i0, i1, i2; + for (let i = 0, minDist = Infinity; i < n; i++) { + const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); + if (d < minDist) { + i0 = i; + minDist = d; + } + } + const i0x = coords[2 * i0]; + const i0y = coords[2 * i0 + 1]; + for (let i = 0, minDist = Infinity; i < n; i++) { + if (i === i0) continue; + const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); + if (d < minDist && d > 0) { + i1 = i; + minDist = d; + } + } + let i1x = coords[2 * i1]; + let i1y = coords[2 * i1 + 1]; + let minRadius = Infinity; + for (let i = 0; i < n; i++) { + if (i === i0 || i === i1) continue; + const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); + if (r < minRadius) { + i2 = i; + minRadius = r; + } + } + let i2x = coords[2 * i2]; + let i2y = coords[2 * i2 + 1]; + if (minRadius === Infinity) { + for (let i = 0; i < n; i++) { + this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; + } + quicksort(this._ids, this._dists, 0, n - 1); + const hull = new Uint32Array(n); + let j = 0; + for (let i = 0, d0 = -Infinity; i < n; i++) { + const id2 = this._ids[i]; + const d = this._dists[id2]; + if (d > d0) { + hull[j++] = id2; + d0 = d; + } + } + this.hull = hull.subarray(0, j); + this.triangles = new Uint32Array(0); + this.halfedges = new Uint32Array(0); + return; + } + if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { + const i = i1; + const x2 = i1x; + const y2 = i1y; + i1 = i2; + i1x = i2x; + i1y = i2y; + i2 = i; + i2x = x2; + i2y = y2; + } + const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); + this._cx = center.x; + this._cy = center.y; + for (let i = 0; i < n; i++) { + this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); + } + quicksort(this._ids, this._dists, 0, n - 1); + this._hullStart = i0; + let hullSize = 3; + hullNext[i0] = hullPrev[i2] = i1; + hullNext[i1] = hullPrev[i0] = i2; + hullNext[i2] = hullPrev[i1] = i0; + hullTri[i0] = 0; + hullTri[i1] = 1; + hullTri[i2] = 2; + hullHash.fill(-1); + hullHash[this._hashKey(i0x, i0y)] = i0; + hullHash[this._hashKey(i1x, i1y)] = i1; + hullHash[this._hashKey(i2x, i2y)] = i2; + this.trianglesLen = 0; + this._addTriangle(i0, i1, i2, -1, -1, -1); + for (let k = 0, xp, yp; k < this._ids.length; k++) { + const i = this._ids[k]; + const x2 = coords[2 * i]; + const y2 = coords[2 * i + 1]; + if (k > 0 && Math.abs(x2 - xp) <= EPSILON$1 && Math.abs(y2 - yp) <= EPSILON$1) continue; + xp = x2; + yp = y2; + if (i === i0 || i === i1 || i === i2) continue; + let start = 0; + for (let j = 0, key2 = this._hashKey(x2, y2); j < this._hashSize; j++) { + start = hullHash[(key2 + j) % this._hashSize]; + if (start !== -1 && start !== hullNext[start]) break; + } + start = hullPrev[start]; + let e = start, q; + while (q = hullNext[e], orient2d(x2, y2, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) { + e = q; + if (e === start) { + e = -1; + break; + } + } + if (e === -1) continue; + let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); + hullTri[i] = this._legalize(t + 2); + hullTri[e] = t; + hullSize++; + let n2 = hullNext[e]; + while (q = hullNext[n2], orient2d(x2, y2, coords[2 * n2], coords[2 * n2 + 1], coords[2 * q], coords[2 * q + 1]) < 0) { + t = this._addTriangle(n2, i, q, hullTri[i], -1, hullTri[n2]); + hullTri[i] = this._legalize(t + 2); + hullNext[n2] = n2; + hullSize--; + n2 = q; + } + if (e === start) { + while (q = hullPrev[e], orient2d(x2, y2, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) { + t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); + this._legalize(t + 2); + hullTri[q] = t; + hullNext[e] = e; + hullSize--; + e = q; + } + } + this._hullStart = hullPrev[i] = e; + hullNext[e] = hullPrev[n2] = i; + hullNext[i] = n2; + hullHash[this._hashKey(x2, y2)] = i; + hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; + } + this.hull = new Uint32Array(hullSize); + for (let i = 0, e = this._hullStart; i < hullSize; i++) { + this.hull[i] = e; + e = hullNext[e]; + } + this.triangles = this._triangles.subarray(0, this.trianglesLen); + this.halfedges = this._halfedges.subarray(0, this.trianglesLen); + } + _hashKey(x2, y2) { + return Math.floor(pseudoAngle(x2 - this._cx, y2 - this._cy) * this._hashSize) % this._hashSize; + } + _legalize(a2) { + const { _triangles: triangles, _halfedges: halfedges, coords } = this; + let i = 0; + let ar = 0; + while (true) { + const b2 = halfedges[a2]; + const a0 = a2 - a2 % 3; + ar = a0 + (a2 + 2) % 3; + if (b2 === -1) { + if (i === 0) break; + a2 = EDGE_STACK[--i]; + continue; + } + const b0 = b2 - b2 % 3; + const al = a0 + (a2 + 1) % 3; + const bl2 = b0 + (b2 + 2) % 3; + const p02 = triangles[ar]; + const pr = triangles[a2]; + const pl = triangles[al]; + const p1 = triangles[bl2]; + const illegal = inCircle( + coords[2 * p02], + coords[2 * p02 + 1], + coords[2 * pr], + coords[2 * pr + 1], + coords[2 * pl], + coords[2 * pl + 1], + coords[2 * p1], + coords[2 * p1 + 1] + ); + if (illegal) { + triangles[a2] = p1; + triangles[b2] = p02; + const hbl = halfedges[bl2]; + if (hbl === -1) { + let e = this._hullStart; + do { + if (this._hullTri[e] === bl2) { + this._hullTri[e] = a2; + break; + } + e = this._hullPrev[e]; + } while (e !== this._hullStart); + } + this._link(a2, hbl); + this._link(b2, halfedges[ar]); + this._link(ar, bl2); + const br2 = b0 + (b2 + 1) % 3; + if (i < EDGE_STACK.length) { + EDGE_STACK[i++] = br2; + } + } else { + if (i === 0) break; + a2 = EDGE_STACK[--i]; + } + } + return ar; + } + _link(a2, b2) { + this._halfedges[a2] = b2; + if (b2 !== -1) this._halfedges[b2] = a2; + } + // add a new triangle given vertex indices and adjacent half-edge ids + _addTriangle(i0, i1, i2, a2, b2, c2) { + const t = this.trianglesLen; + this._triangles[t] = i0; + this._triangles[t + 1] = i1; + this._triangles[t + 2] = i2; + this._link(t, a2); + this._link(t + 1, b2); + this._link(t + 2, c2); + this.trianglesLen += 3; + return t; + } + } + function pseudoAngle(dx, dy) { + const p = dx / (Math.abs(dx) + Math.abs(dy)); + return (dy > 0 ? 3 - p : 1 + p) / 4; + } + function dist(ax, ay, bx, by) { + const dx = ax - bx; + const dy = ay - by; + return dx * dx + dy * dy; + } + function inCircle(ax, ay, bx, by, cx, cy, px2, py2) { + const dx = ax - px2; + const dy = ay - py2; + const ex = bx - px2; + const ey = by - py2; + const fx = cx - px2; + const fy = cy - py2; + const ap = dx * dx + dy * dy; + const bp = ex * ex + ey * ey; + const cp = fx * fx + fy * fy; + return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; + } + function circumradius(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d = 0.5 / (dx * ey - dy * ex); + const x2 = (ey * bl2 - dy * cl) * d; + const y2 = (dx * cl - ex * bl2) * d; + return x2 * x2 + y2 * y2; + } + function circumcenter(ax, ay, bx, by, cx, cy) { + const dx = bx - ax; + const dy = by - ay; + const ex = cx - ax; + const ey = cy - ay; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + const d = 0.5 / (dx * ey - dy * ex); + const x2 = ax + (ey * bl2 - dy * cl) * d; + const y2 = ay + (dx * cl - ex * bl2) * d; + return { x: x2, y: y2 }; + } + function quicksort(ids, dists, left, right) { + if (right - left <= 20) { + for (let i = left + 1; i <= right; i++) { + const temp2 = ids[i]; + const tempDist = dists[temp2]; + let j = i - 1; + while (j >= left && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; + ids[j + 1] = temp2; + } + } else { + const median2 = left + right >> 1; + let i = left + 1; + let j = right; + swap(ids, median2, i); + if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); + if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); + if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); + const temp2 = ids[i]; + const tempDist = dists[temp2]; + while (true) { + do + i++; + while (dists[ids[i]] < tempDist); + do + j--; + while (dists[ids[j]] > tempDist); + if (j < i) break; + swap(ids, i, j); + } + ids[left + 1] = ids[j]; + ids[j] = temp2; + if (right - i + 1 >= j - left) { + quicksort(ids, dists, i, right); + quicksort(ids, dists, left, j - 1); + } else { + quicksort(ids, dists, left, j - 1); + quicksort(ids, dists, i, right); + } + } + } + function swap(arr, i, j) { + const tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + } + function defaultGetX(p) { + return p[0]; + } + function defaultGetY(p) { + return p[1]; + } + const epsilon = 1e-6; + class Path { + constructor() { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; + this._ = ""; + } + moveTo(x2, y2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; + } + closePath() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._ += "Z"; + } + } + lineTo(x2, y2) { + this._ += `L${this._x1 = +x2},${this._y1 = +y2}`; + } + arc(x2, y2, r) { + x2 = +x2, y2 = +y2, r = +r; + const x02 = x2 + r; + const y02 = y2; + if (r < 0) throw new Error("negative radius"); + if (this._x1 === null) this._ += `M${x02},${y02}`; + else if (Math.abs(this._x1 - x02) > epsilon || Math.abs(this._y1 - y02) > epsilon) this._ += "L" + x02 + "," + y02; + if (!r) return; + this._ += `A${r},${r},0,1,1,${x2 - r},${y2}A${r},${r},0,1,1,${this._x1 = x02},${this._y1 = y02}`; + } + rect(x2, y2, w2, h2) { + this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${+w2}v${+h2}h${-w2}Z`; + } + value() { + return this._ || null; + } + } + class Polygon { + constructor() { + this._ = []; + } + moveTo(x2, y2) { + this._.push([x2, y2]); + } + closePath() { + this._.push(this._[0].slice()); + } + lineTo(x2, y2) { + this._.push([x2, y2]); + } + value() { + return this._.length ? this._ : null; + } + } + let Voronoi$1 = class Voronoi { + constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { + if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); + this.delaunay = delaunay; + this._circumcenters = new Float64Array(delaunay.points.length * 2); + this.vectors = new Float64Array(delaunay.points.length * 2); + this.xmax = xmax, this.xmin = xmin; + this.ymax = ymax, this.ymin = ymin; + this._init(); + } + update() { + this.delaunay.update(); + this._init(); + return this; + } + _init() { + const { delaunay: { points: points2, hull, triangles }, vectors } = this; + let bx, by; + const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); + for (let i = 0, j = 0, n = triangles.length, x2, y2; i < n; i += 3, j += 2) { + const t12 = triangles[i] * 2; + const t22 = triangles[i + 1] * 2; + const t32 = triangles[i + 2] * 2; + const x13 = points2[t12]; + const y13 = points2[t12 + 1]; + const x22 = points2[t22]; + const y22 = points2[t22 + 1]; + const x3 = points2[t32]; + const y3 = points2[t32 + 1]; + const dx = x22 - x13; + const dy = y22 - y13; + const ex = x3 - x13; + const ey = y3 - y13; + const ab = (dx * ey - dy * ex) * 2; + if (Math.abs(ab) < 1e-9) { + if (bx === void 0) { + bx = by = 0; + for (const i2 of hull) bx += points2[i2 * 2], by += points2[i2 * 2 + 1]; + bx /= hull.length, by /= hull.length; + } + const a2 = 1e9 * Math.sign((bx - x13) * ey - (by - y13) * ex); + x2 = (x13 + x3) / 2 - a2 * ey; + y2 = (y13 + y3) / 2 + a2 * ex; + } else { + const d = 1 / ab; + const bl2 = dx * dx + dy * dy; + const cl = ex * ex + ey * ey; + x2 = x13 + (ey * bl2 - dy * cl) * d; + y2 = y13 + (dx * cl - ex * bl2) * d; + } + circumcenters[j] = x2; + circumcenters[j + 1] = y2; + } + let h2 = hull[hull.length - 1]; + let p02, p1 = h2 * 4; + let x02, x12 = points2[2 * h2]; + let y02, y12 = points2[2 * h2 + 1]; + vectors.fill(0); + for (let i = 0; i < hull.length; ++i) { + h2 = hull[i]; + p02 = p1, x02 = x12, y02 = y12; + p1 = h2 * 4, x12 = points2[2 * h2], y12 = points2[2 * h2 + 1]; + vectors[p02 + 2] = vectors[p1] = y02 - y12; + vectors[p02 + 3] = vectors[p1 + 1] = x12 - x02; + } + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; + if (hull.length <= 1) return null; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = Math.floor(i / 3) * 2; + const tj = Math.floor(j / 3) * 2; + const xi = circumcenters[ti]; + const yi = circumcenters[ti + 1]; + const xj = circumcenters[tj]; + const yj = circumcenters[tj + 1]; + this._renderSegment(xi, yi, xj, yj, context2); + } + let h0, h1 = hull[hull.length - 1]; + for (let i = 0; i < hull.length; ++i) { + h0 = h1, h1 = hull[i]; + const t = Math.floor(inedges[h1] / 3) * 2; + const x2 = circumcenters[t]; + const y2 = circumcenters[t + 1]; + const v = h0 * 4; + const p = this._project(x2, y2, vectors[v + 2], vectors[v + 3]); + if (p) this._renderSegment(x2, y2, p[0], p[1], context2); + } + return buffer && buffer.value(); + } + renderBounds(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + context2.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); + return buffer && buffer.value(); + } + renderCell(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const points2 = this._clip(i); + if (points2 === null || !points2.length) return; + context2.moveTo(points2[0], points2[1]); + let n = points2.length; + while (points2[0] === points2[n - 2] && points2[1] === points2[n - 1] && n > 1) n -= 2; + for (let i2 = 2; i2 < n; i2 += 2) { + if (points2[i2] !== points2[i2 - 2] || points2[i2 + 1] !== points2[i2 - 1]) + context2.lineTo(points2[i2], points2[i2 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + *cellPolygons() { + const { delaunay: { points: points2 } } = this; + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const cell2 = this.cellPolygon(i); + if (cell2) cell2.index = i, yield cell2; + } + } + cellPolygon(i) { + const polygon = new Polygon(); + this.renderCell(i, polygon); + return polygon.value(); + } + _renderSegment(x02, y02, x12, y12, context2) { + let S; + const c0 = this._regioncode(x02, y02); + const c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + context2.moveTo(x02, y02); + context2.lineTo(x12, y12); + } else if (S = this._clipSegment(x02, y02, x12, y12, c0, c1)) { + context2.moveTo(S[0], S[1]); + context2.lineTo(S[2], S[3]); + } + } + contains(i, x2, y2) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return false; + return this.delaunay._step(i, x2, y2) === i; + } + *neighbors(i) { + const ci = this._clip(i); + if (ci) for (const j of this.delaunay.neighbors(i)) { + const cj = this._clip(j); + if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { + for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { + if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { + yield j; + break loop; + } + } + } + } + } + _cell(i) { + const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; + const e0 = inedges[i]; + if (e0 === -1) return null; + const points2 = []; + let e = e0; + do { + const t = Math.floor(e / 3); + points2.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + } while (e !== e0 && e !== -1); + return points2; + } + _clip(i) { + if (i === 0 && this.delaunay.hull.length === 1) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + const points2 = this._cell(i); + if (points2 === null) return null; + const { vectors: V } = this; + const v = i * 4; + return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points2, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points2)); + } + _clipFinite(i, points2) { + const n = points2.length; + let P = null; + let x02, y02, x12 = points2[n - 2], y12 = points2[n - 1]; + let c0, c1 = this._regioncode(x12, y12); + let e0, e1 = 0; + for (let j = 0; j < n; j += 2) { + x02 = x12, y02 = y12, x12 = points2[j], y12 = points2[j + 1]; + c0 = c1, c1 = this._regioncode(x12, y12); + if (c0 === 0 && c1 === 0) { + e0 = e1, e1 = 0; + if (P) P.push(x12, y12); + else P = [x12, y12]; + } else { + let S, sx0, sy0, sx1, sy1; + if (c0 === 0) { + if ((S = this._clipSegment(x02, y02, x12, y12, c0, c1)) === null) continue; + [sx0, sy0, sx1, sy1] = S; + } else { + if ((S = this._clipSegment(x12, y12, x02, y02, c1, c0)) === null) continue; + [sx1, sy1, sx0, sy0] = S; + e0 = e1, e1 = this._edgecode(sx0, sy0); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx0, sy0); + else P = [sx0, sy0]; + } + e0 = e1, e1 = this._edgecode(sx1, sy1); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + if (P) P.push(sx1, sy1); + else P = [sx1, sy1]; + } + } + if (P) { + e0 = e1, e1 = this._edgecode(P[0], P[1]); + if (e0 && e1) this._edge(i, e0, e1, P, P.length); + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; + } + return P; + } + _clipSegment(x02, y02, x12, y12, c0, c1) { + const flip2 = c0 < c1; + if (flip2) [x02, y02, x12, y12, c0, c1] = [x12, y12, x02, y02, c1, c0]; + while (true) { + if (c0 === 0 && c1 === 0) return flip2 ? [x12, y12, x02, y02] : [x02, y02, x12, y12]; + if (c0 & c1) return null; + let x2, y2, c2 = c0 || c1; + if (c2 & 8) x2 = x02 + (x12 - x02) * (this.ymax - y02) / (y12 - y02), y2 = this.ymax; + else if (c2 & 4) x2 = x02 + (x12 - x02) * (this.ymin - y02) / (y12 - y02), y2 = this.ymin; + else if (c2 & 2) y2 = y02 + (y12 - y02) * (this.xmax - x02) / (x12 - x02), x2 = this.xmax; + else y2 = y02 + (y12 - y02) * (this.xmin - x02) / (x12 - x02), x2 = this.xmin; + if (c0) x02 = x2, y02 = y2, c0 = this._regioncode(x02, y02); + else x12 = x2, y12 = y2, c1 = this._regioncode(x12, y12); + } + } + _clipInfinite(i, points2, vx0, vy0, vxn, vyn) { + let P = Array.from(points2), p; + if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); + if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); + if (P = this._clipFinite(i, P)) { + for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { + c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); + if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; + } + } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { + P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; + } + return P; + } + _edge(i, e0, e1, P, j) { + while (e0 !== e1) { + let x2, y2; + switch (e0) { + case 5: + e0 = 4; + continue; + // top-left + case 4: + e0 = 6, x2 = this.xmax, y2 = this.ymin; + break; + // top + case 6: + e0 = 2; + continue; + // top-right + case 2: + e0 = 10, x2 = this.xmax, y2 = this.ymax; + break; + // right + case 10: + e0 = 8; + continue; + // bottom-right + case 8: + e0 = 9, x2 = this.xmin, y2 = this.ymax; + break; + // bottom + case 9: + e0 = 1; + continue; + // bottom-left + case 1: + e0 = 5, x2 = this.xmin, y2 = this.ymin; + break; } - // If a type was specified, set the callback for the given type and name. - // Otherwise, if a null callback was specified, remove callbacks of the given name. - if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); - while(++i < n){ - if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); - else if (callback == null) for(t in _)_[t] = set(_[t], typename.name, null); + if ((P[j] !== x2 || P[j + 1] !== y2) && this.contains(i, x2, y2)) { + P.splice(j, 0, x2, y2), j += 2; } - return this; - }, - copy: function() { - var copy = {}, _ = this._; - for(var t in _)copy[t] = _[t].slice(); - return new Dispatch(copy); - }, - call: function(type, that) { - if ((n = arguments.length - 2) > 0) for(var args = new Array(n), i = 0, n, t; i < n; ++i)args[i] = arguments[i + 2]; - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - }, - apply: function(type, that, args) { - if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); - for(var t = this._[type], i = 0, n = t.length; i < n; ++i)t[i].value.apply(that, args); - } -}; -function get(type, name) { - for(var i = 0, n = type.length, c; i < n; ++i){ - if ((c = type[i]).name === name) return c.value; - } -} -function set(type, name, callback) { - for(var i = 0, n = type.length; i < n; ++i)if (type[i].name === name) { - type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); - break; + } + return j; + } + _project(x02, y02, vx, vy) { + let t = Infinity, c2, x2, y2; + if (vy < 0) { + if (y02 <= this.ymin) return null; + if ((c2 = (this.ymin - y02) / vy) < t) y2 = this.ymin, x2 = x02 + (t = c2) * vx; + } else if (vy > 0) { + if (y02 >= this.ymax) return null; + if ((c2 = (this.ymax - y02) / vy) < t) y2 = this.ymax, x2 = x02 + (t = c2) * vx; + } + if (vx > 0) { + if (x02 >= this.xmax) return null; + if ((c2 = (this.xmax - x02) / vx) < t) x2 = this.xmax, y2 = y02 + (t = c2) * vy; + } else if (vx < 0) { + if (x02 <= this.xmin) return null; + if ((c2 = (this.xmin - x02) / vx) < t) x2 = this.xmin, y2 = y02 + (t = c2) * vy; + } + return [x2, y2]; } - if (callback != null) type.push({ - name: name, - value: callback - }); - return type; -} -exports.default = dispatch; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d15bJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>(0, _timerJs.now)); -parcelHelpers.export(exports, "timer", ()=>(0, _timerJs.timer)); -parcelHelpers.export(exports, "timerFlush", ()=>(0, _timerJs.timerFlush)); -parcelHelpers.export(exports, "timeout", ()=>(0, _timeoutJsDefault.default)); -parcelHelpers.export(exports, "interval", ()=>(0, _intervalJsDefault.default)); -var _timerJs = require("./timer.js"); -var _timeoutJs = require("./timeout.js"); -var _timeoutJsDefault = parcelHelpers.interopDefault(_timeoutJs); -var _intervalJs = require("./interval.js"); -var _intervalJsDefault = parcelHelpers.interopDefault(_intervalJs); - -},{"./timer.js":"1Lfpo","./timeout.js":false,"./interval.js":"dgSlx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Lfpo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "now", ()=>now); -parcelHelpers.export(exports, "Timer", ()=>Timer); -parcelHelpers.export(exports, "timer", ()=>timer); -parcelHelpers.export(exports, "timerFlush", ()=>timerFlush); -var frame = 0, timeout = 0, interval = 0, pokeDelay = 1000, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { - setTimeout(f, 17); -}; -function now() { - return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); -} -function clearNow() { - clockNow = 0; -} -function Timer() { - this._call = this._time = this._next = null; -} -Timer.prototype = timer.prototype = { - constructor: Timer, - restart: function(callback, delay, time) { - if (typeof callback !== "function") throw new TypeError("callback is not a function"); - time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); - if (!this._next && taskTail !== this) { - if (taskTail) taskTail._next = this; - else taskHead = this; - taskTail = this; - } - this._call = callback; - this._time = time; - sleep(); - }, - stop: function() { - if (this._call) { - this._call = null; - this._time = Infinity; - sleep(); - } + _edgecode(x2, y2) { + return (x2 === this.xmin ? 1 : x2 === this.xmax ? 2 : 0) | (y2 === this.ymin ? 4 : y2 === this.ymax ? 8 : 0); } -}; -function timer(callback, delay, time) { - var t = new Timer; - t.restart(callback, delay, time); - return t; -} -function timerFlush() { - now(); // Get the current time, if not already set. - ++frame; // Pretend we’ve set an alarm, if we haven’t already. - var t = taskHead, e; - while(t){ - if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e); - t = t._next; + _regioncode(x2, y2) { + return (x2 < this.xmin ? 1 : x2 > this.xmax ? 2 : 0) | (y2 < this.ymin ? 4 : y2 > this.ymax ? 8 : 0); } - --frame; -} -function wake() { - clockNow = (clockLast = clock.now()) + clockSkew; - frame = timeout = 0; - try { - timerFlush(); - } finally{ - frame = 0; - nap(); - clockNow = 0; - } -} -function poke() { - var now = clock.now(), delay = now - clockLast; - if (delay > pokeDelay) clockSkew -= delay, clockLast = now; -} -function nap() { - var t0, t1 = taskHead, t2, time = Infinity; - while(t1)if (t1._call) { - if (time > t1._time) time = t1._time; - t0 = t1, t1 = t1._next; - } else { - t2 = t1._next, t1._next = null; - t1 = t0 ? t0._next = t2 : taskHead = t2; - } - taskTail = t0; - sleep(time); -} -function sleep(time) { - if (frame) return; // Soonest alarm already set, or will be. - if (timeout) timeout = clearTimeout(timeout); - var delay = time - clockNow; // Strictly less than if we recomputed clockNow. - if (delay > 24) { - if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew); - if (interval) interval = clearInterval(interval); - } else { - if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay); - frame = 1, setFrame(wake); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dgSlx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, delay, time) { - var t = new (0, _timerJs.Timer), total = delay; - if (delay == null) return t.restart(callback, delay, time), t; - t._restart = t.restart; - t.restart = function(callback, delay, time) { - delay = +delay, time = time == null ? (0, _timerJs.now)() : +time; - t._restart(function tick(elapsed) { - elapsed += total; - t._restart(tick, total += delay, time); - callback(elapsed); - }, delay, time); - }; - t.restart(callback, delay, time); - return t; - }); -var _timerJs = require("./timer.js"); - -},{"./timer.js":"1Lfpo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3KZNV":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"byekK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, xz; - if (typeof x !== "function") x = (0, _constantJsDefault.default)(x == null ? 0 : +x); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - xz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.x = function(_) { - return arguments.length ? (x = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : x; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"gq4mo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eIzZp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(y) { - var strength = (0, _constantJsDefault.default)(0.1), nodes, strengths, yz; - if (typeof y !== "function") y = (0, _constantJsDefault.default)(y == null ? 0 : +y); - function force(alpha) { - for(var i = 0, n = nodes.length, node; i < n; ++i)node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; - } - function initialize() { - if (!nodes) return; - var i, n = nodes.length; - strengths = new Array(n); - yz = new Array(n); - for(i = 0; i < n; ++i)strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); - } - force.initialize = function(_) { - nodes = _; - initialize(); - }; - force.strength = function(_) { - return arguments.length ? (strength = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : strength; - }; - force.y = function(_) { - return arguments.length ? (y = typeof _ === "function" ? _ : (0, _constantJsDefault.default)(+_), initialize(), force) : y; - }; - return force; - }); -var _constantJs = require("./constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./constant.js":"gq4mo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lserr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "nest", ()=>Nest); -parcelHelpers.export(exports, "pack", ()=>Pack); -parcelHelpers.export(exports, "partition", ()=>Partition); -parcelHelpers.export(exports, "stratify", ()=>Stratify); -parcelHelpers.export(exports, "tree", ()=>Tree); -parcelHelpers.export(exports, "treelinks", ()=>TreeLinks); -parcelHelpers.export(exports, "treemap", ()=>Treemap); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Hierarchy = require("d3-hierarchy"); -// Build lookup table mapping tuple keys to tree node instances -function lookup(tree, key, filter) { - const map = {}; - tree.each((node)=>{ - const t = node.data; - if (filter(t)) map[key(t)] = node; - }); - tree.lookup = map; - return tree; -} -/** - * Nest tuples into a tree structure, grouped by key values. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.keys - The key fields to nest by, in order. - * @param {boolean} [params.generate=false] - A boolean flag indicating if - * non-leaf nodes generated by this transform should be included in the - * output. The default (false) includes only the input data (leaf nodes) - * in the data stream. - */ function Nest(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Nest.Definition = { - 'type': 'Nest', - 'metadata': { - 'treesource': true, - 'changes': true - }, - 'params': [ - { - 'name': 'keys', - 'type': 'field', - 'array': true - }, - { - 'name': 'generate', - 'type': 'boolean' - } - ] -}; -const children = (n)=>n.values; -(0, _vegaUtil.inherits)(Nest, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Nest transform requires an upstream data source.'); - var gen = _.generate, mod = _.modified(), out = pulse.clone(), tree = this.value; - if (!tree || mod || pulse.changed()) { - // collect nodes to remove - if (tree) tree.each((node)=>{ - if (node.children && (0, _vegaDataflow.isTuple)(node.data)) out.rem.push(node.data); - }); - // generate new tree structure - this.value = tree = (0, _d3Hierarchy.hierarchy)({ - values: (0, _vegaUtil.array)(_.keys).reduce((n, k)=>{ - n.key(k); - return n; - }, nest()).entries(out.source) - }, children); - // collect nodes to add - if (gen) tree.each((node)=>{ - if (node.children) { - node = (0, _vegaDataflow.ingest)(node.data); - out.add.push(node); - out.source.push(node); - } - }); - // build lookup table - lookup(tree, (0, _vegaDataflow.tupleid), (0, _vegaDataflow.tupleid)); - } - out.source.root = tree; - return out; + _simplify(P) { + if (P && P.length > 4) { + for (let i = 0; i < P.length; i += 2) { + const j = (i + 2) % P.length, k = (i + 4) % P.length; + if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) { + P.splice(j, 2), i -= 2; + } + } + if (!P.length) P = null; + } + return P; } -}); -function nest() { - const keys = [], nest = { - entries: (array)=>entries(apply(array, 0), 0), - key: (d)=>(keys.push(d), nest) - }; - function apply(array, depth) { - if (depth >= keys.length) return array; - const n = array.length, key = keys[depth++], valuesByKey = {}, result = {}; - let i = -1, keyValue, value, values; - while(++i < n){ - keyValue = key(value = array[i]) + ''; - if (values = valuesByKey[keyValue]) values.push(value); - else valuesByKey[keyValue] = [ - value - ]; - } - for(keyValue in valuesByKey)result[keyValue] = apply(valuesByKey[keyValue], depth); - return result; + }; + const tau = 2 * Math.PI, pow = Math.pow; + function pointX(p) { + return p[0]; + } + function pointY(p) { + return p[1]; + } + function collinear(d) { + const { triangles, coords } = d; + for (let i = 0; i < triangles.length; i += 3) { + const a2 = 2 * triangles[i], b2 = 2 * triangles[i + 1], c2 = 2 * triangles[i + 2], cross2 = (coords[c2] - coords[a2]) * (coords[b2 + 1] - coords[a2 + 1]) - (coords[b2] - coords[a2]) * (coords[c2 + 1] - coords[a2 + 1]); + if (cross2 > 1e-10) return false; } - function entries(map, depth) { - if (++depth > keys.length) return map; - const array = []; - for(const key in map)array.push({ - key, - values: entries(map[key], depth) - }); - return array; - } - return nest; -} -/** - * Abstract class for tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function HierarchyLayout(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -const defaultSeparation = (a, b)=>a.parent === b.parent ? 1 : 2; -(0, _vegaUtil.inherits)(HierarchyLayout, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source || !pulse.source.root) (0, _vegaUtil.error)(this.constructor.name + ' transform requires a backing tree data source.'); - const layout = this.layout(_.method), fields = this.fields, root = pulse.source.root, as = _.as || fields; - if (_.field) root.sum(_.field); - else root.count(); - if (_.sort) root.sort((0, _vegaDataflow.stableCompare)(_.sort, (d)=>d.data)); - setParams(layout, this.params, _); - if (layout.separation) layout.separation(_.separation !== false ? defaultSeparation : (0, _vegaUtil.one)); - try { - this.value = layout(root); - } catch (err) { - (0, _vegaUtil.error)(err); - } - root.each((node)=>setFields(node, fields, as)); - return pulse.reflow(_.modified()).modifies(as).modifies('leaf'); + return true; + } + function jitter(x2, y2, r) { + return [x2 + Math.sin(x2 + y2) * r, y2 + Math.cos(x2 - y2) * r]; + } + class Delaunay { + static from(points2, fx = pointX, fy = pointY, that) { + return new Delaunay("length" in points2 ? flatArray(points2, fx, fy, that) : Float64Array.from(flatIterable(points2, fx, fy, that))); } -}); -function setParams(layout, params, _) { - for(let p, i = 0, n = params.length; i < n; ++i){ - p = params[i]; - if (p in _) layout[p](_[p]); + constructor(points2) { + this._delaunator = new Delaunator(points2); + this.inedges = new Int32Array(points2.length / 2); + this._hullIndex = new Int32Array(points2.length / 2); + this.points = this._delaunator.coords; + this._init(); } -} -function setFields(node, fields, as) { - const t = node.data, n = fields.length - 1; - for(let i = 0; i < n; ++i)t[as[i]] = node[fields[i]]; - t[as[n]] = node.children ? node.children.length : 0; -} -const Output$3 = [ - 'x', - 'y', - 'r', - 'depth', - 'children' -]; -/** - * Packed circle tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Pack(params) { - HierarchyLayout.call(this, params); -} -Pack.Definition = { - 'type': 'Pack', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'radius', - 'type': 'field', - 'default': null - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$3.length, - 'default': Output$3 - } - ] -}; -(0, _vegaUtil.inherits)(Pack, HierarchyLayout, { - layout: (0, _d3Hierarchy.pack), - params: [ - 'radius', - 'size', - 'padding' - ], - fields: Output$3 -}); -const Output$2 = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Partition tree layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Partition(params) { - HierarchyLayout.call(this, params); -} -Partition.Definition = { - 'type': 'Partition', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$2.length, - 'default': Output$2 - } - ] -}; -(0, _vegaUtil.inherits)(Partition, HierarchyLayout, { - layout: (0, _d3Hierarchy.partition), - params: [ - 'size', - 'round', - 'padding' - ], - fields: Output$2 -}); -/** - * Stratify a collection of tuples into a tree structure based on - * id and parent id fields. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.key - Unique key field for each tuple. - * @param {function(object): *} params.parentKey - Field with key for parent tuple. - */ function Stratify(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Stratify.Definition = { - 'type': 'Stratify', - 'metadata': { - 'treesource': true - }, - 'params': [ - { - 'name': 'key', - 'type': 'field', - 'required': true - }, - { - 'name': 'parentKey', - 'type': 'field', - 'required': true - } - ] -}; -(0, _vegaUtil.inherits)(Stratify, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!pulse.source) (0, _vegaUtil.error)('Stratify transform requires an upstream data source.'); - let tree = this.value; - const mod = _.modified(), out = pulse.fork(pulse.ALL).materialize(pulse.SOURCE), run = !tree || mod || pulse.changed(pulse.ADD_REM) || pulse.modified(_.key.fields) || pulse.modified(_.parentKey.fields); - // prevent upstream source pollution - out.source = out.source.slice(); - if (run) tree = out.source.length ? lookup((0, _d3Hierarchy.stratify)().id(_.key).parentId(_.parentKey)(out.source), _.key, (0, _vegaUtil.truthy)) : lookup((0, _d3Hierarchy.stratify)()([ - {} - ]), _.key, _.key); - out.source.root = this.value = tree; - return out; + update() { + this._delaunator.update(); + this._init(); + return this; } -}); -const Layouts = { - tidy: (0, _d3Hierarchy.tree), - cluster: (0, _d3Hierarchy.cluster) -}; -const Output$1 = [ - 'x', - 'y', - 'depth', - 'children' -]; -/** - * Tree layout. Depending on the method parameter, performs either - * Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout. - * @constructor - * @param {object} params - The parameters for this operator. - */ function Tree(params) { - HierarchyLayout.call(this, params); -} -Tree.Definition = { - 'type': 'Tree', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'tidy', - 'values': [ - 'tidy', - 'cluster' - ] - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'nodeSize', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'separation', - 'type': 'boolean', - 'default': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output$1.length, - 'default': Output$1 - } - ] -}; -(0, _vegaUtil.inherits)(Tree, HierarchyLayout, { - /** - * Tree layout generator. Supports both 'tidy' and 'cluster' layouts. - */ layout (method) { - const m = method || 'tidy'; - if ((0, _vegaUtil.hasOwnProperty)(Layouts, m)) return Layouts[m](); - else (0, _vegaUtil.error)('Unrecognized Tree layout method: ' + m); - }, - params: [ - 'size', - 'nodeSize' - ], - fields: Output$1 -}); -/** - * Generate tuples representing links between tree nodes. - * The resulting tuples will contain 'source' and 'target' fields, - * which point to parent and child node tuples, respectively. - * @constructor - * @param {object} params - The parameters for this operator. - */ function TreeLinks(params) { - (0, _vegaDataflow.Transform).call(this, [], params); -} -TreeLinks.Definition = { - 'type': 'TreeLinks', - 'metadata': { - 'tree': true, - 'generates': true, - 'changes': true - }, - 'params': [] -}; -(0, _vegaUtil.inherits)(TreeLinks, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const links = this.value, tree = pulse.source && pulse.source.root, out = pulse.fork(pulse.NO_SOURCE), lut = {}; - if (!tree) (0, _vegaUtil.error)('TreeLinks transform requires a tree data source.'); - if (pulse.changed(pulse.ADD_REM)) { - // remove previous links - out.rem = links; - // build lookup table of valid tuples - pulse.visit(pulse.SOURCE, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // generate links for all edges incident on valid tuples - tree.each((node)=>{ - const t = node.data, p = node.parent && node.parent.data; - if (p && lut[(0, _vegaDataflow.tupleid)(t)] && lut[(0, _vegaDataflow.tupleid)(p)]) out.add.push((0, _vegaDataflow.ingest)({ - source: p, - target: t - })); - }); - this.value = out.add; - } else if (pulse.changed(pulse.MOD)) { - // build lookup table of modified tuples - pulse.visit(pulse.MOD, (t)=>lut[(0, _vegaDataflow.tupleid)(t)] = 1); - // gather links incident on modified tuples - links.forEach((link)=>{ - if (lut[(0, _vegaDataflow.tupleid)(link.source)] || lut[(0, _vegaDataflow.tupleid)(link.target)]) out.mod.push(link); - }); + _init() { + const d = this._delaunator, points2 = this.points; + if (d.hull && d.hull.length > 2 && collinear(d)) { + this.collinear = Int32Array.from({ length: points2.length / 2 }, (_, i) => i).sort((i, j) => points2[2 * i] - points2[2 * j] || points2[2 * i + 1] - points2[2 * j + 1]); + const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds2 = [points2[2 * e], points2[2 * e + 1], points2[2 * f], points2[2 * f + 1]], r = 1e-8 * Math.hypot(bounds2[3] - bounds2[1], bounds2[2] - bounds2[0]); + for (let i = 0, n = points2.length / 2; i < n; ++i) { + const p = jitter(points2[2 * i], points2[2 * i + 1], r); + points2[2 * i] = p[0]; + points2[2 * i + 1] = p[1]; + } + this._delaunator = new Delaunator(points2); + } else { + delete this.collinear; + } + const halfedges = this.halfedges = this._delaunator.halfedges; + const hull = this.hull = this._delaunator.hull; + const triangles = this.triangles = this._delaunator.triangles; + const inedges = this.inedges.fill(-1); + const hullIndex = this._hullIndex.fill(-1); + for (let e = 0, n = halfedges.length; e < n; ++e) { + const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; + if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; + } + for (let i = 0, n = hull.length; i < n; ++i) { + hullIndex[hull[i]] = i; + } + if (hull.length <= 2 && hull.length > 0) { + this.triangles = new Int32Array(3).fill(-1); + this.halfedges = new Int32Array(3).fill(-1); + this.triangles[0] = hull[0]; + inedges[hull[0]] = 1; + if (hull.length === 2) { + inedges[hull[1]] = 0; + this.triangles[1] = hull[1]; + this.triangles[2] = hull[1]; } - return out; + } } -}); -const Tiles = { - binary: (0, _d3Hierarchy.treemapBinary), - dice: (0, _d3Hierarchy.treemapDice), - slice: (0, _d3Hierarchy.treemapSlice), - slicedice: (0, _d3Hierarchy.treemapSliceDice), - squarify: (0, _d3Hierarchy.treemapSquarify), - resquarify: (0, _d3Hierarchy.treemapResquarify) -}; -const Output = [ - 'x0', - 'y0', - 'x1', - 'y1', - 'depth', - 'children' -]; -/** - * Treemap layout. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.field - The value field to size nodes. - */ function Treemap(params) { - HierarchyLayout.call(this, params); -} -Treemap.Definition = { - 'type': 'Treemap', - 'metadata': { - 'tree': true, - 'modifies': true - }, - 'params': [ - { - 'name': 'field', - 'type': 'field' - }, - { - 'name': 'sort', - 'type': 'compare' - }, - { - 'name': 'method', - 'type': 'enum', - 'default': 'squarify', - 'values': [ - 'squarify', - 'resquarify', - 'binary', - 'dice', - 'slice', - 'slicedice' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingInner', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingOuter', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingTop', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingRight', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingBottom', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'paddingLeft', - 'type': 'number', - 'default': 0 - }, - { - 'name': 'ratio', - 'type': 'number', - 'default': 1.618033988749895 - }, - { - 'name': 'round', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': Output.length, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Treemap, HierarchyLayout, { - /** - * Treemap layout generator. Adds 'method' and 'ratio' parameters - * to configure the underlying tile method. - */ layout () { - const x = (0, _d3Hierarchy.treemap)(); - x.ratio = (_)=>{ - const t = x.tile(); - if (t.ratio) x.tile(t.ratio(_)); - }; - x.method = (_)=>{ - if ((0, _vegaUtil.hasOwnProperty)(Tiles, _)) x.tile(Tiles[_]); - else (0, _vegaUtil.error)('Unrecognized Treemap layout method: ' + _); - }; - return x; - }, - params: [ - 'method', - 'ratio', - 'size', - 'round', - 'padding', - 'paddingInner', - 'paddingOuter', - 'paddingTop', - 'paddingRight', - 'paddingBottom', - 'paddingLeft' - ], - fields: Output -}); - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-hierarchy":"4fr5p","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4fr5p":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cluster", ()=>(0, _clusterJsDefault.default)); -parcelHelpers.export(exports, "hierarchy", ()=>(0, _indexJsDefault.default)); -parcelHelpers.export(exports, "Node", ()=>(0, _indexJs.Node)); -parcelHelpers.export(exports, "pack", ()=>(0, _indexJsDefault1.default)); -parcelHelpers.export(exports, "packSiblings", ()=>(0, _siblingsJsDefault.default)); -parcelHelpers.export(exports, "packEnclose", ()=>(0, _encloseJsDefault.default)); -parcelHelpers.export(exports, "partition", ()=>(0, _partitionJsDefault.default)); -parcelHelpers.export(exports, "stratify", ()=>(0, _stratifyJsDefault.default)); -parcelHelpers.export(exports, "tree", ()=>(0, _treeJsDefault.default)); -parcelHelpers.export(exports, "treemap", ()=>(0, _indexJsDefault2.default)); -parcelHelpers.export(exports, "treemapBinary", ()=>(0, _binaryJsDefault.default)); -parcelHelpers.export(exports, "treemapDice", ()=>(0, _diceJsDefault.default)); -parcelHelpers.export(exports, "treemapSlice", ()=>(0, _sliceJsDefault.default)); -parcelHelpers.export(exports, "treemapSliceDice", ()=>(0, _sliceDiceJsDefault.default)); -parcelHelpers.export(exports, "treemapSquarify", ()=>(0, _squarifyJsDefault.default)); -parcelHelpers.export(exports, "treemapResquarify", ()=>(0, _resquarifyJsDefault.default)); -var _clusterJs = require("./cluster.js"); -var _clusterJsDefault = parcelHelpers.interopDefault(_clusterJs); -var _indexJs = require("./hierarchy/index.js"); -var _indexJsDefault = parcelHelpers.interopDefault(_indexJs); -var _indexJs1 = require("./pack/index.js"); -var _indexJsDefault1 = parcelHelpers.interopDefault(_indexJs1); -var _siblingsJs = require("./pack/siblings.js"); -var _siblingsJsDefault = parcelHelpers.interopDefault(_siblingsJs); -var _encloseJs = require("./pack/enclose.js"); -var _encloseJsDefault = parcelHelpers.interopDefault(_encloseJs); -var _partitionJs = require("./partition.js"); -var _partitionJsDefault = parcelHelpers.interopDefault(_partitionJs); -var _stratifyJs = require("./stratify.js"); -var _stratifyJsDefault = parcelHelpers.interopDefault(_stratifyJs); -var _treeJs = require("./tree.js"); -var _treeJsDefault = parcelHelpers.interopDefault(_treeJs); -var _indexJs2 = require("./treemap/index.js"); -var _indexJsDefault2 = parcelHelpers.interopDefault(_indexJs2); -var _binaryJs = require("./treemap/binary.js"); -var _binaryJsDefault = parcelHelpers.interopDefault(_binaryJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./treemap/slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _sliceDiceJs = require("./treemap/sliceDice.js"); -var _sliceDiceJsDefault = parcelHelpers.interopDefault(_sliceDiceJs); -var _squarifyJs = require("./treemap/squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _resquarifyJs = require("./treemap/resquarify.js"); -var _resquarifyJsDefault = parcelHelpers.interopDefault(_resquarifyJs); - -},{"./cluster.js":"fviPU","./hierarchy/index.js":"jtgBj","./pack/index.js":"eQFOB","./pack/siblings.js":false,"./pack/enclose.js":false,"./partition.js":"hfHoW","./stratify.js":"1euRH","./tree.js":"5MDZW","./treemap/index.js":"ew6JB","./treemap/binary.js":"8vqlk","./treemap/dice.js":"c7pGx","./treemap/slice.js":"c9bya","./treemap/sliceDice.js":"fbNXv","./treemap/squarify.js":"dnoy6","./treemap/resquarify.js":"12ScZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fviPU":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = false; - function cluster(root) { - var previousNode, x = 0; - // First walk, computing the initial x & y values. - root.eachAfter(function(node) { - var children = node.children; - if (children) { - node.x = meanX(children); - node.y = maxY(children); - } else { - node.x = previousNode ? x += separation(node, previousNode) : 0; - node.y = 0; - previousNode = node; - } - }); - var left = leafLeft(root), right = leafRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2; - // Second walk, normalizing x & y to the desired size. - return root.eachAfter(nodeSize ? function(node) { - node.x = (node.x - root.x) * dx; - node.y = (root.y - node.y) * dy; - } : function(node) { - node.x = (node.x - x0) / (x1 - x0) * dx; - node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; - }); - } - cluster.separation = function(x) { - return arguments.length ? (separation = x, cluster) : separation; - }; - cluster.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : nodeSize ? null : [ - dx, - dy - ]; - }; - cluster.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : nodeSize ? [ - dx, - dy - ] : null; - }; - return cluster; - }); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -function meanX(children) { - return children.reduce(meanXReduce, 0) / children.length; -} -function meanXReduce(x, c) { - return x + c.x; -} -function maxY(children) { - return 1 + children.reduce(maxYReduce, 0); -} -function maxYReduce(y, c) { - return Math.max(y, c.y); -} -function leafLeft(node) { - var children; - while(children = node.children)node = children[0]; - return node; -} -function leafRight(node) { - var children; - while(children = node.children)node = children[children.length - 1]; - return node; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jtgBj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>hierarchy); -parcelHelpers.export(exports, "computeHeight", ()=>computeHeight); -parcelHelpers.export(exports, "Node", ()=>Node); -var _countJs = require("./count.js"); -var _countJsDefault = parcelHelpers.interopDefault(_countJs); -var _eachJs = require("./each.js"); -var _eachJsDefault = parcelHelpers.interopDefault(_eachJs); -var _eachBeforeJs = require("./eachBefore.js"); -var _eachBeforeJsDefault = parcelHelpers.interopDefault(_eachBeforeJs); -var _eachAfterJs = require("./eachAfter.js"); -var _eachAfterJsDefault = parcelHelpers.interopDefault(_eachAfterJs); -var _findJs = require("./find.js"); -var _findJsDefault = parcelHelpers.interopDefault(_findJs); -var _sumJs = require("./sum.js"); -var _sumJsDefault = parcelHelpers.interopDefault(_sumJs); -var _sortJs = require("./sort.js"); -var _sortJsDefault = parcelHelpers.interopDefault(_sortJs); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _ancestorsJs = require("./ancestors.js"); -var _ancestorsJsDefault = parcelHelpers.interopDefault(_ancestorsJs); -var _descendantsJs = require("./descendants.js"); -var _descendantsJsDefault = parcelHelpers.interopDefault(_descendantsJs); -var _leavesJs = require("./leaves.js"); -var _leavesJsDefault = parcelHelpers.interopDefault(_leavesJs); -var _linksJs = require("./links.js"); -var _linksJsDefault = parcelHelpers.interopDefault(_linksJs); -var _iteratorJs = require("./iterator.js"); -var _iteratorJsDefault = parcelHelpers.interopDefault(_iteratorJs); -function hierarchy(data, children) { - if (data instanceof Map) { - data = [ - undefined, - data - ]; - if (children === undefined) children = mapChildren; - } else if (children === undefined) children = objectChildren; - var root = new Node(data), node, nodes = [ - root - ], child, childs, i, n; - while(node = nodes.pop())if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) { - node.children = childs; - for(i = n - 1; i >= 0; --i){ - nodes.push(child = childs[i] = new Node(childs[i])); - child.parent = node; - child.depth = node.depth + 1; - } + voronoi(bounds2) { + return new Voronoi$1(this, bounds2); } - return root.eachBefore(computeHeight); -} -function node_copy() { - return hierarchy(this).eachBefore(copyData); -} -function objectChildren(d) { - return d.children; -} -function mapChildren(d) { - return Array.isArray(d) ? d[1] : null; -} -function copyData(node) { - if (node.data.value !== undefined) node.value = node.data.value; - node.data = node.data.data; -} -function computeHeight(node) { - var height = 0; - do node.height = height; - while ((node = node.parent) && node.height < ++height); -} -function Node(data) { - this.data = data; - this.depth = this.height = 0; - this.parent = null; -} -Node.prototype = hierarchy.prototype = { - constructor: Node, - count: (0, _countJsDefault.default), - each: (0, _eachJsDefault.default), - eachAfter: (0, _eachAfterJsDefault.default), - eachBefore: (0, _eachBeforeJsDefault.default), - find: (0, _findJsDefault.default), - sum: (0, _sumJsDefault.default), - sort: (0, _sortJsDefault.default), - path: (0, _pathJsDefault.default), - ancestors: (0, _ancestorsJsDefault.default), - descendants: (0, _descendantsJsDefault.default), - leaves: (0, _leavesJsDefault.default), - links: (0, _linksJsDefault.default), - copy: node_copy, - [Symbol.iterator]: (0, _iteratorJsDefault.default) -}; - -},{"./count.js":"jNzMu","./each.js":"8q3O0","./eachBefore.js":"kBI99","./eachAfter.js":"goYvF","./find.js":"dotdr","./sum.js":"6wYAA","./sort.js":"ljhs0","./path.js":"ecIKT","./ancestors.js":"9BIjB","./descendants.js":"6MhHV","./leaves.js":"jpVT1","./links.js":"eJseT","./iterator.js":"aGwDK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jNzMu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return this.eachAfter(count); - }); -function count(node) { - var sum = 0, children = node.children, i = children && children.length; - if (!i) sum = 1; - else while(--i >= 0)sum += children[i].value; - node.value = sum; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8q3O0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this)callback.call(that, node, ++index, this); - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kBI99":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], children, i, index = -1; - while(node = nodes.pop()){ - callback.call(that, node, ++index, this); - if (children = node.children) for(i = children.length - 1; i >= 0; --i)nodes.push(children[i]); + *neighbors(i) { + const { inedges, hull, _hullIndex, halfedges, triangles, collinear: collinear2 } = this; + if (collinear2) { + const l = collinear2.indexOf(i); + if (l > 0) yield collinear2[l - 1]; + if (l < collinear2.length - 1) yield collinear2[l + 1]; + return; + } + const e0 = inedges[i]; + if (e0 === -1) return; + let e = e0, p02 = -1; + do { + yield p02 = triangles[e]; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) return; + e = halfedges[e]; + if (e === -1) { + const p = hull[(_hullIndex[i] + 1) % hull.length]; + if (p !== p02) yield p; + return; + } + } while (e !== e0); + } + find(x2, y2, i = 0) { + if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return -1; + const i0 = i; + let c2; + while ((c2 = this._step(i, x2, y2)) >= 0 && c2 !== i && c2 !== i0) i = c2; + return c2; + } + _step(i, x2, y2) { + const { inedges, hull, _hullIndex, halfedges, triangles, points: points2 } = this; + if (inedges[i] === -1 || !points2.length) return (i + 1) % (points2.length >> 1); + let c2 = i; + let dc = pow(x2 - points2[i * 2], 2) + pow(y2 - points2[i * 2 + 1], 2); + const e0 = inedges[i]; + let e = e0; + do { + let t = triangles[e]; + const dt = pow(x2 - points2[t * 2], 2) + pow(y2 - points2[t * 2 + 1], 2); + if (dt < dc) dc = dt, c2 = t; + e = e % 3 === 2 ? e - 2 : e + 1; + if (triangles[e] !== i) break; + e = halfedges[e]; + if (e === -1) { + e = hull[(_hullIndex[i] + 1) % hull.length]; + if (e !== t) { + if (pow(x2 - points2[e * 2], 2) + pow(y2 - points2[e * 2 + 1], 2) < dc) return e; + } + break; + } + } while (e !== e0); + return c2; + } + render(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, halfedges, triangles } = this; + for (let i = 0, n = halfedges.length; i < n; ++i) { + const j = halfedges[i]; + if (j < i) continue; + const ti = triangles[i] * 2; + const tj = triangles[j] * 2; + context2.moveTo(points2[ti], points2[ti + 1]); + context2.lineTo(points2[tj], points2[tj + 1]); + } + this.renderHull(context2); + return buffer && buffer.value(); + } + renderPoints(context2, r) { + if (r === void 0 && (!context2 || typeof context2.moveTo !== "function")) r = context2, context2 = null; + r = r == void 0 ? 2 : +r; + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2 } = this; + for (let i = 0, n = points2.length; i < n; i += 2) { + const x2 = points2[i], y2 = points2[i + 1]; + context2.moveTo(x2 + r, y2); + context2.arc(x2, y2, r, 0, tau); + } + return buffer && buffer.value(); + } + renderHull(context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { hull, points: points2 } = this; + const h2 = hull[0] * 2, n = hull.length; + context2.moveTo(points2[h2], points2[h2 + 1]); + for (let i = 1; i < n; ++i) { + const h3 = 2 * hull[i]; + context2.lineTo(points2[h3], points2[h3 + 1]); + } + context2.closePath(); + return buffer && buffer.value(); + } + hullPolygon() { + const polygon = new Polygon(); + this.renderHull(polygon); + return polygon.value(); + } + renderTriangle(i, context2) { + const buffer = context2 == null ? context2 = new Path() : void 0; + const { points: points2, triangles } = this; + const t02 = triangles[i *= 3] * 2; + const t12 = triangles[i + 1] * 2; + const t22 = triangles[i + 2] * 2; + context2.moveTo(points2[t02], points2[t02 + 1]); + context2.lineTo(points2[t12], points2[t12 + 1]); + context2.lineTo(points2[t22], points2[t22 + 1]); + context2.closePath(); + return buffer && buffer.value(); + } + *trianglePolygons() { + const { triangles } = this; + for (let i = 0, n = triangles.length / 3; i < n; ++i) { + yield this.trianglePolygon(i); + } + } + trianglePolygon(i) { + const polygon = new Polygon(); + this.renderTriangle(i, polygon); + return polygon.value(); + } + } + function flatArray(points2, fx, fy, that) { + const n = points2.length; + const array2 = new Float64Array(n * 2); + for (let i = 0; i < n; ++i) { + const p = points2[i]; + array2[i * 2] = fx.call(that, p, i, points2); + array2[i * 2 + 1] = fy.call(that, p, i, points2); + } + return array2; + } + function* flatIterable(points2, fx, fy, that) { + let i = 0; + for (const p of points2) { + yield fx.call(that, p, i, points2); + yield fy.call(that, p, i, points2); + ++i; + } + } + function Voronoi(params2) { + Transform.call(this, null, params2); + } + Voronoi.Definition = { + "type": "Voronoi", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "x", + "type": "field", + "required": true + }, { + "name": "y", + "type": "field", + "required": true + }, { + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "extent", + "type": "array", + "array": true, + "length": 2, + "default": [[-1e5, -1e5], [1e5, 1e5]], + "content": { + "type": "number", + "array": true, + "length": 2 + } + }, { + "name": "as", + "type": "string", + "default": "path" + }] + }; + const defaultExtent = [-1e5, -1e5, 1e5, 1e5]; + inherits(Voronoi, Transform, { + transform(_, pulse2) { + const as = _.as || "path", data2 = pulse2.source; + if (!data2 || !data2.length) return pulse2; + let s = _.size; + s = s ? [0, 0, s[0], s[1]] : (s = _.extent) ? [s[0][0], s[0][1], s[1][0], s[1][1]] : defaultExtent; + const voronoi2 = this.value = Delaunay.from(data2, _.x, _.y).voronoi(s); + for (let i = 0, n = data2.length; i < n; ++i) { + const polygon = voronoi2.cellPolygon(i); + data2[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; + } + return pulse2.reflow(_.modified()).modifies(as); + } + }); + function toPathString(p) { + const x2 = p[0][0], y2 = p[0][1]; + let n = p.length - 1; + for (; p[n][0] === x2 && p[n][1] === y2; --n) ; + return "M" + p.slice(0, n + 1).join("L") + "Z"; + } + function isPoint(p) { + return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; + } + const voronoi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + voronoi: Voronoi + }, Symbol.toStringTag, { value: "Module" })); + var cloudRadians = Math.PI / 180, cw = 1 << 11 >> 5, ch = 1 << 11; + function cloud() { + var size = [256, 256], text2, font2, fontSize2, fontStyle, fontWeight, rotate2, padding2, spiral = archimedeanSpiral, words = [], random2 = Math.random, cloud2 = {}; + cloud2.layout = function() { + var contextAndRatio = getContext2(domCanvas()), board = zeroArray((size[0] >> 5) * size[1]), bounds2 = null, n = words.length, i = -1, tags = [], data2 = words.map((d2) => ({ + text: text2(d2), + font: font2(d2), + style: fontStyle(d2), + weight: fontWeight(d2), + rotate: rotate2(d2), + size: ~~(fontSize2(d2) + 1e-14), + padding: padding2(d2), + xoff: 0, + yoff: 0, + x1: 0, + y1: 0, + x0: 0, + y0: 0, + hasText: false, + sprite: null, + datum: d2 + })).sort((a2, b2) => b2.size - a2.size); + while (++i < n) { + var d = data2[i]; + d.x = size[0] * (random2() + 0.5) >> 1; + d.y = size[1] * (random2() + 0.5) >> 1; + cloudSprite(contextAndRatio, d, data2, i); + if (d.hasText && place2(board, d, bounds2)) { + tags.push(d); + if (bounds2) cloudBounds(bounds2, d); + else bounds2 = [{ + x: d.x + d.x0, + y: d.y + d.y0 + }, { + x: d.x + d.x1, + y: d.y + d.y1 + }]; + d.x -= size[0] >> 1; + d.y -= size[1] >> 1; } - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"goYvF":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - var node = this, nodes = [ - node - ], next = [], children, i, n, index = -1; - while(node = nodes.pop()){ - next.push(node); - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)nodes.push(children[i]); - } - while(node = next.pop())callback.call(that, node, ++index, this); - return this; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dotdr":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(callback, that) { - let index = -1; - for (const node of this){ - if (callback.call(that, node, ++index, this)) return node; + } + return tags; + }; + function getContext2(canvas) { + canvas.width = canvas.height = 1; + var ratio = Math.sqrt(canvas.getContext("2d").getImageData(0, 0, 1, 1).data.length >> 2); + canvas.width = (cw << 5) / ratio; + canvas.height = ch / ratio; + var context2 = canvas.getContext("2d"); + context2.fillStyle = context2.strokeStyle = "red"; + context2.textAlign = "center"; + return { + context: context2, + ratio + }; + } + function place2(board, tag, bounds2) { + var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size[0], size[1]), s = spiral(size), dt = random2() < 0.5 ? 1 : -1, t = -dt, dxdy, dx, dy; + while (dxdy = s(t += dt)) { + dx = ~~dxdy[0]; + dy = ~~dxdy[1]; + if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; + tag.x = startX + dx; + tag.y = startY + dy; + if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; + if (!bounds2 || !cloudCollide(tag, board, size[0])) { + if (!bounds2 || collideRects(tag, bounds2)) { + var sprite = tag.sprite, w2 = tag.width >> 5, sw = size[0] >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + board[x2 + i] |= last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0); + } + x2 += sw; + } + tag.sprite = null; + return true; + } } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6wYAA":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(value) { - return this.eachAfter(function(node) { - var sum = +value(node.data) || 0, children = node.children, i = children && children.length; - while(--i >= 0)sum += children[i].value; - node.value = sum; - }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ljhs0":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(compare) { - return this.eachBefore(function(node) { - if (node.children) node.children.sort(compare); - }); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ecIKT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(end) { - var start = this, ancestor = leastCommonAncestor(start, end), nodes = [ - start - ]; - while(start !== ancestor){ - start = start.parent; - nodes.push(start); - } - var k = nodes.length; - while(end !== ancestor){ - nodes.splice(k, 0, end); - end = end.parent; - } - return nodes; - }); -function leastCommonAncestor(a, b) { - if (a === b) return a; - var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null; - a = aNodes.pop(); - b = bNodes.pop(); - while(a === b){ - c = a; - a = aNodes.pop(); - b = bNodes.pop(); - } - return c; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9BIjB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var node = this, nodes = [ - node - ]; - while(node = node.parent)nodes.push(node); - return nodes; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6MhHV":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - return Array.from(this); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jpVT1":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var leaves = []; - this.eachBefore(function(node) { - if (!node.children) leaves.push(node); - }); - return leaves; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eJseT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var root = this, links = []; - root.each(function(node) { - if (node !== root) links.push({ - source: node.parent, - target: node - }); - }); - return links; - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aGwDK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function*() { - var node = this, current, next = [ - node - ], children, i, n; - do { - current = next.reverse(), next = []; - while(node = current.pop()){ - yield node; - if (children = node.children) for(i = 0, n = children.length; i < n; ++i)next.push(children[i]); - } - }while (next.length); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eQFOB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var radius = null, dx = 1, dy = 1, padding = (0, _constantJs.constantZero); - function pack(root) { - const random = (0, _lcgJsDefault.default)(); - root.x = dx / 2, root.y = dy / 2; - if (radius) root.eachBefore(radiusLeaf(radius)).eachAfter(packChildrenRandom(padding, 0.5, random)).eachBefore(translateChild(1)); - else root.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom((0, _constantJs.constantZero), 1, random)).eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); - return root; - } - pack.radius = function(x) { - return arguments.length ? (radius = (0, _accessorsJs.optional)(x), pack) : radius; - }; - pack.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [ - dx, - dy - ]; - }; - pack.padding = function(x) { - return arguments.length ? (padding = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), pack) : padding; - }; - return pack; - }); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _siblingsJs = require("./siblings.js"); -function defaultRadius(d) { - return Math.sqrt(d.value); -} -function radiusLeaf(radius) { - return function(node) { - if (!node.children) node.r = Math.max(0, +radius(node) || 0); + } + return false; + } + cloud2.words = function(_) { + if (arguments.length) { + words = _; + return cloud2; + } else { + return words; + } + }; + cloud2.size = function(_) { + if (arguments.length) { + size = [+_[0], +_[1]]; + return cloud2; + } else { + return size; + } + }; + cloud2.font = function(_) { + if (arguments.length) { + font2 = functor(_); + return cloud2; + } else { + return font2; + } + }; + cloud2.fontStyle = function(_) { + if (arguments.length) { + fontStyle = functor(_); + return cloud2; + } else { + return fontStyle; + } + }; + cloud2.fontWeight = function(_) { + if (arguments.length) { + fontWeight = functor(_); + return cloud2; + } else { + return fontWeight; + } + }; + cloud2.rotate = function(_) { + if (arguments.length) { + rotate2 = functor(_); + return cloud2; + } else { + return rotate2; + } + }; + cloud2.text = function(_) { + if (arguments.length) { + text2 = functor(_); + return cloud2; + } else { + return text2; + } }; -} -function packChildrenRandom(padding, k, random) { - return function(node) { - if (children = node.children) { - var children, i, n = children.length, r = padding(node) * k || 0, e; - if (r) for(i = 0; i < n; ++i)children[i].r += r; - e = (0, _siblingsJs.packSiblingsRandom)(children, random); - if (r) for(i = 0; i < n; ++i)children[i].r -= r; - node.r = e + r; - } + cloud2.spiral = function(_) { + if (arguments.length) { + spiral = spirals[_] || _; + return cloud2; + } else { + return spiral; + } }; -} -function translateChild(k) { - return function(node) { - var parent = node.parent; - node.r *= k; - if (parent) { - node.x = parent.x + k * node.x; - node.y = parent.y + k * node.y; - } - }; -} - -},{"../accessors.js":"i242w","../constant.js":"i6Ely","../lcg.js":"9jKig","./siblings.js":"8RhM7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i242w":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "optional", ()=>optional); -parcelHelpers.export(exports, "required", ()=>required); -function optional(f) { - return f == null ? null : required(f); -} -function required(f) { - if (typeof f !== "function") throw new Error; - return f; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"i6Ely":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "constantZero", ()=>constantZero); -parcelHelpers.export(exports, "default", ()=>function(x) { - return function() { - return x; - }; - }); -function constantZero() { - return 0; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9jKig":[function(require,module,exports,__globalThis) { -// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - let s = 1; - return ()=>(s = (a * s + c) % m) / m; - }); -const a = 1664525; -const c = 1013904223; -const m = 4294967296; // 2^32 - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8RhM7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "packSiblingsRandom", ()=>packSiblingsRandom); -parcelHelpers.export(exports, "default", ()=>function(circles) { - packSiblingsRandom(circles, (0, _lcgJsDefault.default)()); - return circles; - }); -var _arrayJs = require("../array.js"); -var _arrayJsDefault = parcelHelpers.interopDefault(_arrayJs); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -var _encloseJs = require("./enclose.js"); -function place(b, a, c) { - var dx = b.x - a.x, x, a2, dy = b.y - a.y, y, b2, d2 = dx * dx + dy * dy; - if (d2) { - a2 = a.r + c.r, a2 *= a2; - b2 = b.r + c.r, b2 *= b2; - if (a2 > b2) { - x = (d2 + b2 - a2) / (2 * d2); - y = Math.sqrt(Math.max(0, b2 / d2 - x * x)); - c.x = b.x - x * dx - y * dy; - c.y = b.y - x * dy + y * dx; - } else { - x = (d2 + a2 - b2) / (2 * d2); - y = Math.sqrt(Math.max(0, a2 / d2 - x * x)); - c.x = a.x + x * dx - y * dy; - c.y = a.y + x * dy + y * dx; + cloud2.fontSize = function(_) { + if (arguments.length) { + fontSize2 = functor(_); + return cloud2; + } else { + return fontSize2; + } + }; + cloud2.padding = function(_) { + if (arguments.length) { + padding2 = functor(_); + return cloud2; + } else { + return padding2; + } + }; + cloud2.random = function(_) { + if (arguments.length) { + random2 = _; + return cloud2; + } else { + return random2; + } + }; + return cloud2; + } + function cloudSprite(contextAndRatio, d, data2, di) { + if (d.sprite) return; + var c2 = contextAndRatio.context, ratio = contextAndRatio.ratio; + c2.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); + var x2 = 0, y2 = 0, maxh = 0, n = data2.length, w2, w32, h2, i, j; + --di; + while (++di < n) { + d = data2[di]; + c2.save(); + c2.font = d.style + " " + d.weight + " " + ~~((d.size + 1) / ratio) + "px " + d.font; + w2 = c2.measureText(d.text + "m").width * ratio; + h2 = d.size << 1; + if (d.rotate) { + var sr = Math.sin(d.rotate * cloudRadians), cr2 = Math.cos(d.rotate * cloudRadians), wcr = w2 * cr2, wsr = w2 * sr, hcr = h2 * cr2, hsr = h2 * sr; + w2 = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 31 >> 5 << 5; + h2 = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); + } else { + w2 = w2 + 31 >> 5 << 5; + } + if (h2 > maxh) maxh = h2; + if (x2 + w2 >= cw << 5) { + x2 = 0; + y2 += maxh; + maxh = 0; + } + if (y2 + h2 >= ch) break; + c2.translate((x2 + (w2 >> 1)) / ratio, (y2 + (h2 >> 1)) / ratio); + if (d.rotate) c2.rotate(d.rotate * cloudRadians); + c2.fillText(d.text, 0, 0); + if (d.padding) { + c2.lineWidth = 2 * d.padding; + c2.strokeText(d.text, 0, 0); + } + c2.restore(); + d.width = w2; + d.height = h2; + d.xoff = x2; + d.yoff = y2; + d.x1 = w2 >> 1; + d.y1 = h2 >> 1; + d.x0 = -d.x1; + d.y0 = -d.y1; + d.hasText = true; + x2 += w2; + } + var pixels = c2.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; + while (--di >= 0) { + d = data2[di]; + if (!d.hasText) continue; + w2 = d.width; + w32 = w2 >> 5; + h2 = d.y1 - d.y0; + for (i = 0; i < h2 * w32; i++) sprite[i] = 0; + x2 = d.xoff; + if (x2 == null) return; + y2 = d.yoff; + var seen = 0, seenRow = -1; + for (j = 0; j < h2; j++) { + for (i = 0; i < w2; i++) { + var k = w32 * j + (i >> 5), m2 = pixels[(y2 + j) * (cw << 5) + (x2 + i) << 2] ? 1 << 31 - i % 32 : 0; + sprite[k] |= m2; + seen |= m2; + } + if (seen) seenRow = j; + else { + d.y0++; + h2--; + j--; + y2++; } - } else { - c.x = a.x + c.r; - c.y = a.y; - } -} -function intersects(a, b) { - var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function score(node) { - var a = node._, b = node.next._, ab = a.r + b.r, dx = (a.x * b.r + b.x * a.r) / ab, dy = (a.y * b.r + b.y * a.r) / ab; - return dx * dx + dy * dy; -} -function Node(circle) { - this._ = circle; - this.next = null; - this.previous = null; -} -function packSiblingsRandom(circles, random) { - if (!(n = (circles = (0, _arrayJsDefault.default)(circles)).length)) return 0; - var a, b, c, n, aa, ca, i, j, k, sj, sk; - // Place the first circle. - a = circles[0], a.x = 0, a.y = 0; - if (!(n > 1)) return a.r; - // Place the second circle. - b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; - if (!(n > 2)) return a.r + b.r; - // Place the third circle. - place(b, a, c = circles[2]); - // Initialize the front-chain using the first three circles a, b and c. - a = new Node(a), b = new Node(b), c = new Node(c); - a.next = c.previous = b; - b.next = a.previous = c; - c.next = b.previous = a; - // Attempt to place each remaining circle… - pack: for(i = 3; i < n; ++i){ - place(a._, b._, c = circles[i]), c = new Node(c); - // Find the closest intersecting circle on the front-chain, if any. - // “Closeness” is determined by linear distance along the front-chain. - // “Ahead” or “behind” is likewise determined by linear distance. - j = b.next, k = a.previous, sj = b._.r, sk = a._.r; - do if (sj <= sk) { - if (intersects(j._, c._)) { - b = j, a.next = b, b.previous = a, --i; - continue pack; - } - sj += j._.r, j = j.next; - } else { - if (intersects(k._, c._)) { - a = k, a.next = b, b.previous = a, --i; - continue pack; - } - sk += k._.r, k = k.previous; - } - while (j !== k.next); - // Success! Insert the new circle c between a and b. - c.previous = a, c.next = b, a.next = b.previous = b = c; - // Compute the new closest circle pair to the centroid. - aa = score(a); - while((c = c.next) !== b)if ((ca = score(c)) < aa) a = c, aa = ca; - b = a.next; - } - // Compute the enclosing circle of the front chain. - a = [ - b._ - ], c = b; - while((c = c.next) !== b)a.push(c._); - c = (0, _encloseJs.packEncloseRandom)(a, random); - // Translate the circles to put the enclosing circle around the origin. - for(i = 0; i < n; ++i)a = circles[i], a.x -= c.x, a.y -= c.y; - return c.r; -} - -},{"../array.js":"4vcaT","../lcg.js":"9jKig","./enclose.js":"gBh5f","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4vcaT":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(x) { - return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like - : Array.from(x); // Map, Set, iterable, string, or anything else - }); -parcelHelpers.export(exports, "shuffle", ()=>shuffle); -function shuffle(array, random) { - let m = array.length, t, i; - while(m){ - i = random() * m-- | 0; - t = array[m]; - array[m] = array[i]; - array[i] = t; - } - return array; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gBh5f":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(circles) { - return packEncloseRandom(circles, (0, _lcgJsDefault.default)()); - }); -parcelHelpers.export(exports, "packEncloseRandom", ()=>packEncloseRandom); -var _arrayJs = require("../array.js"); -var _lcgJs = require("../lcg.js"); -var _lcgJsDefault = parcelHelpers.interopDefault(_lcgJs); -function packEncloseRandom(circles, random) { - var i = 0, n = (circles = (0, _arrayJs.shuffle)(Array.from(circles), random)).length, B = [], p, e; - while(i < n){ - p = circles[i]; - if (e && enclosesWeak(e, p)) ++i; - else e = encloseBasis(B = extendBasis(B, p)), i = 0; + } + d.y1 = d.y0 + seenRow; + d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); } - return e; -} -function extendBasis(B, p) { - var i, j; - if (enclosesWeakAll(p, B)) return [ - p - ]; - // If we get here then B must have at least one element. - for(i = 0; i < B.length; ++i){ - if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) return [ - B[i], - p - ]; - } - // If we get here then B must have at least two elements. - for(i = 0; i < B.length - 1; ++i)for(j = i + 1; j < B.length; ++j){ - if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) return [ - B[i], - B[j], - p - ]; - } - // If we get here then something is very wrong. - throw new Error; -} -function enclosesNot(a, b) { - var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; - return dr < 0 || dr * dr < dx * dx + dy * dy; -} -function enclosesWeak(a, b) { - var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y; - return dr > 0 && dr * dr > dx * dx + dy * dy; -} -function enclosesWeakAll(a, B) { - for(var i = 0; i < B.length; ++i){ - if (!enclosesWeak(a, B[i])) return false; + } + function cloudCollide(tag, board, sw) { + sw >>= 5; + var sprite = tag.sprite, w2 = tag.width >> 5, lx2 = tag.x - (w2 << 4), sx = lx2 & 127, msx = 32 - sx, h2 = tag.y1 - tag.y0, x2 = (tag.y + tag.y0) * sw + (lx2 >> 5), last; + for (var j = 0; j < h2; j++) { + last = 0; + for (var i = 0; i <= w2; i++) { + if ((last << msx | (i < w2 ? (last = sprite[j * w2 + i]) >>> sx : 0)) & board[x2 + i]) return true; + } + x2 += sw; } - return true; -} -function encloseBasis(B) { - switch(B.length){ + return false; + } + function cloudBounds(bounds2, d) { + var b0 = bounds2[0], b1 = bounds2[1]; + if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; + if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; + if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; + if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; + } + function collideRects(a2, b2) { + return a2.x + a2.x1 > b2[0].x && a2.x + a2.x0 < b2[1].x && a2.y + a2.y1 > b2[0].y && a2.y + a2.y0 < b2[1].y; + } + function archimedeanSpiral(size) { + var e = size[0] / size[1]; + return function(t) { + return [e * (t *= 0.1) * Math.cos(t), t * Math.sin(t)]; + }; + } + function rectangularSpiral(size) { + var dy = 4, dx = dy * size[0] / size[1], x2 = 0, y2 = 0; + return function(t) { + var sign2 = t < 0 ? -1 : 1; + switch (Math.sqrt(1 + 4 * sign2 * t) - sign2 & 3) { + case 0: + x2 += dx; + break; case 1: - return encloseBasis1(B[0]); + y2 += dy; + break; case 2: - return encloseBasis2(B[0], B[1]); - case 3: - return encloseBasis3(B[0], B[1], B[2]); + x2 -= dx; + break; + default: + y2 -= dy; + break; + } + return [x2, y2]; + }; + } + function zeroArray(n) { + var a2 = [], i = -1; + while (++i < n) a2[i] = 0; + return a2; + } + function functor(d) { + return typeof d === "function" ? d : function() { + return d; + }; + } + var spirals = { + archimedean: archimedeanSpiral, + rectangular: rectangularSpiral + }; + const Output = ["x", "y", "font", "fontSize", "fontStyle", "fontWeight", "angle"]; + const Params$1 = ["text", "font", "rotate", "fontSize", "fontStyle", "fontWeight"]; + function Wordcloud(params2) { + Transform.call(this, cloud(), params2); + } + Wordcloud.Definition = { + "type": "Wordcloud", + "metadata": { + "modifies": true + }, + "params": [{ + "name": "size", + "type": "number", + "array": true, + "length": 2 + }, { + "name": "font", + "type": "string", + "expr": true, + "default": "sans-serif" + }, { + "name": "fontStyle", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontWeight", + "type": "string", + "expr": true, + "default": "normal" + }, { + "name": "fontSize", + "type": "number", + "expr": true, + "default": 14 + }, { + "name": "fontSizeRange", + "type": "number", + "array": "nullable", + "default": [10, 50] + }, { + "name": "rotate", + "type": "number", + "expr": true, + "default": 0 + }, { + "name": "text", + "type": "field" + }, { + "name": "spiral", + "type": "string", + "values": ["archimedean", "rectangular"] + }, { + "name": "padding", + "type": "number", + "expr": true + }, { + "name": "as", + "type": "string", + "array": true, + "length": 7, + "default": Output + }] + }; + inherits(Wordcloud, Transform, { + transform(_, pulse2) { + if (_.size && !(_.size[0] && _.size[1])) { + error("Wordcloud size dimensions must be non-zero."); + } + function modp(param2) { + const p = _[param2]; + return isFunction(p) && pulse2.modified(p.fields); + } + const mod = _.modified(); + if (!(mod || pulse2.changed(pulse2.ADD_REM) || Params$1.some(modp))) return; + const data2 = pulse2.materialize(pulse2.SOURCE).source, layout = this.value, as = _.as || Output; + let fontSize2 = _.fontSize || 14, range2; + isFunction(fontSize2) ? range2 = _.fontSizeRange : fontSize2 = constant$5(fontSize2); + if (range2) { + const fsize = fontSize2, sizeScale = scale$6("sqrt")().domain(extent(data2, fsize)).range(range2); + fontSize2 = (x2) => sizeScale(fsize(x2)); + } + data2.forEach((t) => { + t[as[0]] = NaN; + t[as[1]] = NaN; + t[as[3]] = 0; + }); + const words = layout.words(data2).text(_.text).size(_.size || [500, 500]).padding(_.padding || 1).spiral(_.spiral || "archimedean").rotate(_.rotate || 0).font(_.font || "sans-serif").fontStyle(_.fontStyle || "normal").fontWeight(_.fontWeight || "normal").fontSize(fontSize2).random(random).layout(); + const size = layout.size(), dx = size[0] >> 1, dy = size[1] >> 1, n = words.length; + for (let i = 0, w2, t; i < n; ++i) { + w2 = words[i]; + t = w2.datum; + t[as[0]] = w2.x + dx; + t[as[1]] = w2.y + dy; + t[as[2]] = w2.font; + t[as[3]] = w2.size; + t[as[4]] = w2.style; + t[as[5]] = w2.weight; + t[as[6]] = w2.rotate; + } + return pulse2.reflow(mod).modifies(as); } -} -function encloseBasis1(a) { + }); + const wordcloud = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + wordcloud: Wordcloud + }, Symbol.toStringTag, { value: "Module" })); + const array8 = (n) => new Uint8Array(n); + const array16 = (n) => new Uint16Array(n); + const array32 = (n) => new Uint32Array(n); + function Bitmaps() { + let width2 = 8, data2 = [], seen = array32(0), curr = array$1(0, width2), prev = array$1(0, width2); return { - x: a.x, - y: a.y, - r: a.r + data: () => data2, + seen: () => seen = lengthen(seen, data2.length), + add(array2) { + for (let i = 0, j = data2.length, n = array2.length, t; i < n; ++i) { + t = array2[i]; + t._index = j++; + data2.push(t); + } + }, + remove(num, map2) { + const n = data2.length, copy2 = Array(n - num), reindex = data2; + let t, i, j; + for (i = 0; !map2[i] && i < n; ++i) { + copy2[i] = data2[i]; + reindex[i] = i; + } + for (j = i; i < n; ++i) { + t = data2[i]; + if (!map2[i]) { + reindex[i] = j; + curr[j] = curr[i]; + prev[j] = prev[i]; + copy2[j] = t; + t._index = j++; + } else { + reindex[i] = -1; + } + curr[i] = 0; + } + data2 = copy2; + return reindex; + }, + size: () => data2.length, + curr: () => curr, + prev: () => prev, + reset: (k) => prev[k] = curr[k], + all: () => width2 < 257 ? 255 : width2 < 65537 ? 65535 : 4294967295, + set(k, one2) { + curr[k] |= one2; + }, + clear(k, one2) { + curr[k] &= ~one2; + }, + resize(n, m2) { + const k = curr.length; + if (n > k || m2 > width2) { + width2 = Math.max(m2, width2); + curr = array$1(n, width2, curr); + prev = array$1(n, width2); + } + } }; -} -function encloseBasis2(a, b) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); + } + function lengthen(array2, length2, copy2) { + if (array2.length >= length2) return array2; + copy2 = copy2 || new array2.constructor(length2); + copy2.set(array2); + return copy2; + } + function array$1(n, m2, array2) { + const copy2 = (m2 < 257 ? array8 : m2 < 65537 ? array16 : array32)(n); + if (array2) copy2.set(array2); + return copy2; + } + function Dimension(index2, i, query) { + const bit = 1 << i; return { - x: (x1 + x2 + x21 / l * r21) / 2, - y: (y1 + y2 + y21 / l * r21) / 2, - r: (l + r1 + r2) / 2 + one: bit, + zero: ~bit, + range: query.slice(), + bisect: index2.bisect, + index: index2.index, + size: index2.size, + onAdd(added, curr) { + const dim = this, range2 = dim.bisect(dim.range, added.value), idx = added.index, lo = range2[0], hi = range2[1], n1 = idx.length; + let i2; + for (i2 = 0; i2 < lo; ++i2) curr[idx[i2]] |= bit; + for (i2 = hi; i2 < n1; ++i2) curr[idx[i2]] |= bit; + return dim; + } }; -} -function encloseBasis3(a, b, c) { - var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c.x, y3 = c.y, r3 = c.r, a2 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c2 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a2 * b3, xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1, xb = (b3 * c2 - b2 * c3) / ab, ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1, yb = (a2 * c3 - a3 * c2) / ab, A = xb * xb + yb * yb - 1, B = 2 * (r1 + xa * xb + ya * yb), C = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B); - return { - x: x1 + xa + xb * r, - y: y1 + ya + yb * r, - r: r - }; -} - -},{"../array.js":"4vcaT","../lcg.js":"9jKig","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hfHoW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var dx = 1, dy = 1, padding = 0, round = false; - function partition(root) { - var n = root.height + 1; - root.x0 = root.y0 = padding; - root.x1 = dx; - root.y1 = dy / n; - root.eachBefore(positionNode(dy, n)); - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(dy, n) { - return function(node) { - if (node.children) (0, _diceJsDefault.default)(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n); - var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - }; - } - partition.round = function(x) { - return arguments.length ? (round = !!x, partition) : round; - }; - partition.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [ - dx, - dy - ]; - }; - partition.padding = function(x) { - return arguments.length ? (padding = +x, partition) : padding; - }; - return partition; - }); -var _roundJs = require("./treemap/round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _diceJs = require("./treemap/dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); - -},{"./treemap/round.js":"9PNun","./treemap/dice.js":"c7pGx","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9PNun":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(node) { - node.x0 = Math.round(node.x0); - node.y0 = Math.round(node.y0); - node.x1 = Math.round(node.x1); - node.y1 = Math.round(node.y1); - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c7pGx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value; - while(++i < n){ - node = nodes[i], node.y0 = y0, node.y1 = y1; - node.x0 = x0, node.x1 = x0 += node.value * k; + } + function SortedIndex() { + let index2 = array32(0), value2 = [], size = 0; + function insert2(key2, data2, base2) { + if (!data2.length) return []; + const n0 = size, n1 = data2.length, addi = array32(n1); + let addv = Array(n1), oldv, oldi, i; + for (i = 0; i < n1; ++i) { + addv[i] = key2(data2[i]); + addi[i] = i; + } + addv = sort$1(addv, addi); + if (n0) { + oldv = value2; + oldi = index2; + value2 = Array(n0 + n1); + index2 = array32(n0 + n1); + merge$1(base2, oldv, oldi, n0, addv, addi, n1, value2, index2); + } else { + if (base2 > 0) for (i = 0; i < n1; ++i) { + addi[i] += base2; + } + value2 = addv; + index2 = addi; + } + size = n0 + n1; + return { + index: addi, + value: addv + }; + } + function remove2(num, map2) { + const n = size; + let idx, i, j; + for (i = 0; !map2[index2[i]] && i < n; ++i) ; + for (j = i; i < n; ++i) { + if (!map2[idx = index2[i]]) { + index2[j] = idx; + value2[j] = value2[i]; + ++j; } + } + size = n - num; + } + function reindex(map2) { + for (let i = 0, n = size; i < n; ++i) { + index2[i] = map2[index2[i]]; + } + } + function bisect2(range2, array2) { + let n; + if (array2) { + n = array2.length; + } else { + array2 = value2; + n = size; + } + return [bisectLeft$1(array2, range2[0], 0, n), bisectRight$1(array2, range2[1], 0, n)]; + } + return { + insert: insert2, + remove: remove2, + bisect: bisect2, + reindex, + index: () => index2, + size: () => size + }; + } + function sort$1(values2, index2) { + values2.sort.call(index2, (a2, b2) => { + const x2 = values2[a2], y2 = values2[b2]; + return x2 < y2 ? -1 : x2 > y2 ? 1 : 0; }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1euRH":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var id = defaultId, parentId = defaultParentId, path; - function stratify(data) { - var nodes = Array.from(data), currentId = id, currentParentId = parentId, n, d, i, root, parent, node, nodeId, nodeKey, nodeByKey = new Map; - if (path != null) { - const I = nodes.map((d, i)=>normalize(path(d, i, data))); - const P = I.map(parentof); - const S = new Set(I).add(""); - for (const i of P)if (!S.has(i)) { - S.add(i); - I.push(i); - P.push(parentof(i)); - nodes.push(imputed); - } - currentId = (_, i)=>I[i]; - currentParentId = (_, i)=>P[i]; - } - for(i = 0, n = nodes.length; i < n; ++i){ - d = nodes[i], node = nodes[i] = new (0, _indexJs.Node)(d); - if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) { - nodeKey = node.id = nodeId; - nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node); - } - if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) node.parent = nodeId; - } - for(i = 0; i < n; ++i){ - node = nodes[i]; - if (nodeId = node.parent) { - parent = nodeByKey.get(nodeId); - if (!parent) throw new Error("missing: " + nodeId); - if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); - if (parent.children) parent.children.push(node); - else parent.children = [ - node - ]; - node.parent = parent; - } else { - if (root) throw new Error("multiple roots"); - root = node; - } - } - if (!root) throw new Error("no root"); - // When imputing internal nodes, only introduce roots if needed. - // Then replace the imputed marker data with null. - if (path != null) { - while(root.data === imputed && root.children.length === 1)root = root.children[0], --n; - for(let i = nodes.length - 1; i >= 0; --i){ - node = nodes[i]; - if (node.data !== imputed) break; - node.data = null; - } - } - root.parent = preroot; - root.eachBefore(function(node) { - node.depth = node.parent.depth + 1; - --n; - }).eachBefore((0, _indexJs.computeHeight)); - root.parent = null; - if (n > 0) throw new Error("cycle"); - return root; - } - stratify.id = function(x) { - return arguments.length ? (id = (0, _accessorsJs.optional)(x), stratify) : id; - }; - stratify.parentId = function(x) { - return arguments.length ? (parentId = (0, _accessorsJs.optional)(x), stratify) : parentId; - }; - stratify.path = function(x) { - return arguments.length ? (path = (0, _accessorsJs.optional)(x), stratify) : path; - }; - return stratify; - }); -var _accessorsJs = require("./accessors.js"); -var _indexJs = require("./hierarchy/index.js"); -var preroot = { - depth: -1 -}, ambiguous = {}, imputed = {}; -function defaultId(d) { - return d.id; -} -function defaultParentId(d) { - return d.parentId; -} -// To normalize a path, we coerce to a string, strip the trailing slash if any -// (as long as the trailing slash is not immediately preceded by another slash), -// and add leading slash if missing. -function normalize(path) { - path = `${path}`; - let i = path.length; - if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1); - return path[0] === "/" ? path : `/${path}`; -} -// Walk backwards to find the first slash that is not the leading slash, e.g.: -// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased -// because the id of the root must be a truthy value.) -function parentof(path) { - let i = path.length; - if (i < 2) return ""; - while(--i > 1)if (slash(path, i)) break; - return path.slice(0, i); -} -// Slashes can be escaped; to determine whether a slash is a path delimiter, we -// count the number of preceding backslashes escaping the forward slash: an odd -// number indicates an escaped forward slash. -function slash(path, i) { - if (path[i] === "/") { - let k = 0; - while(i > 0 && path[--i] === "\\")++k; - if ((k & 1) === 0) return true; + return permute(values2, index2); + } + function merge$1(base2, value0, index0, n0, value1, index1, n1, value2, index2) { + let i0 = 0, i1 = 0, i; + for (i = 0; i0 < n0 && i1 < n1; ++i) { + if (value0[i0] < value1[i1]) { + value2[i] = value0[i0]; + index2[i] = index0[i0++]; + } else { + value2[i] = value1[i1]; + index2[i] = index1[i1++] + base2; + } } - return false; -} - -},{"./accessors.js":"i242w","./hierarchy/index.js":"jtgBj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5MDZW":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm -parcelHelpers.export(exports, "default", ()=>function() { - var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null; - function tree(root) { - var t = treeRoot(root); - // Compute the layout using Buchheim et al.’s algorithm. - t.eachAfter(firstWalk), t.parent.m = -t.z; - t.eachBefore(secondWalk); - // If a fixed node size is specified, scale x and y. - if (nodeSize) root.eachBefore(sizeNode); - else { - var left = root, right = root, bottom = root; - root.eachBefore(function(node) { - if (node.x < left.x) left = node; - if (node.x > right.x) right = node; - if (node.depth > bottom.depth) bottom = node; - }); - var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1); - root.eachBefore(function(node) { - node.x = (node.x + tx) * kx; - node.y = node.depth * ky; - }); - } - return root; - } - // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is - // applied recursively to the children of v, as well as the function - // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the - // node v is placed to the midpoint of its outermost children. - function firstWalk(v) { - var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null; - if (children) { - executeShifts(v); - var midpoint = (children[0].z + children[children.length - 1].z) / 2; - if (w) { - v.z = w.z + separation(v._, w._); - v.m = v.z - midpoint; - } else v.z = midpoint; - } else if (w) v.z = w.z + separation(v._, w._); - v.parent.A = apportion(v, w, v.parent.A || siblings[0]); - } - // Computes all real x-coordinates by summing up the modifiers recursively. - function secondWalk(v) { - v._.x = v.z + v.parent.m; - v.m += v.parent.m; - } - // The core of the algorithm. Here, a new subtree is combined with the - // previous subtrees. Threads are used to traverse the inside and outside - // contours of the left and right subtree up to the highest common level. The - // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the - // superscript o means outside and i means inside, the subscript - means left - // subtree and + means right subtree. For summing up the modifiers along the - // contour, we use respective variables si+, si-, so-, and so+. Whenever two - // nodes of the inside contours conflict, we compute the left one of the - // greatest uncommon ancestors using the function ANCESTOR and call MOVE - // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. - // Finally, we add a new thread (if necessary). - function apportion(v, w, ancestor) { - if (w) { - var vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; - while(vim = nextRight(vim), vip = nextLeft(vip), vim && vip){ - vom = nextLeft(vom); - vop = nextRight(vop); - vop.a = v; - shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); - if (shift > 0) { - moveSubtree(nextAncestor(vim, v, ancestor), v, shift); - sip += shift; - sop += shift; - } - sim += vim.m; - sip += vip.m; - som += vom.m; - sop += vop.m; - } - if (vim && !nextRight(vop)) { - vop.t = vim; - vop.m += sim - sop; - } - if (vip && !nextLeft(vom)) { - vom.t = vip; - vom.m += sip - som; - ancestor = v; - } - } - return ancestor; + for (; i0 < n0; ++i0, ++i) { + value2[i] = value0[i0]; + index2[i] = index0[i0]; + } + for (; i1 < n1; ++i1, ++i) { + value2[i] = value1[i1]; + index2[i] = index1[i1] + base2; + } + } + function CrossFilter(params2) { + Transform.call(this, Bitmaps(), params2); + this._indices = null; + this._dims = null; + } + CrossFilter.Definition = { + "type": "CrossFilter", + "metadata": {}, + "params": [{ + "name": "fields", + "type": "field", + "array": true, + "required": true + }, { + "name": "query", + "type": "array", + "array": true, + "required": true, + "content": { + "type": "number", + "array": true, + "length": 2 + } + }] + }; + inherits(CrossFilter, Transform, { + transform(_, pulse2) { + if (!this._dims) { + return this.init(_, pulse2); + } else { + var init2 = _.modified("fields") || _.fields.some((f) => pulse2.modified(f.fields)); + return init2 ? this.reinit(_, pulse2) : this.eval(_, pulse2); + } + }, + init(_, pulse2) { + const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m2 = query.length; + let i = 0, key2, index2; + for (; i < m2; ++i) { + key2 = fields[i].fname; + index2 = indices[key2] || (indices[key2] = SortedIndex()); + dims.push(Dimension(index2, i, query[i])); + } + return this.eval(_, pulse2); + }, + reinit(_, pulse2) { + const output2 = pulse2.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output2.rem = output2.add, mod = output2.mod, m2 = query.length, adds = {}; + let add2, index2, key2, mods, remMap, modMap, i, n, f; + prev.set(curr); + if (pulse2.rem.length) { + remMap = this.remove(_, pulse2, output2); + } + if (pulse2.add.length) { + bits.add(pulse2.add); + } + if (pulse2.mod.length) { + modMap = {}; + for (mods = pulse2.mod, i = 0, n = mods.length; i < n; ++i) { + modMap[mods[i]._index] = 1; } - function sizeNode(node) { - node.x *= dx; - node.y = node.depth * dy; + } + for (i = 0; i < m2; ++i) { + f = fields[i]; + if (!dims[i] || _.modified("fields", i) || pulse2.modified(f.fields)) { + key2 = f.fname; + if (!(add2 = adds[key2])) { + indices[key2] = index2 = SortedIndex(); + adds[key2] = add2 = index2.insert(f, pulse2.source, 0); + } + dims[i] = Dimension(index2, i, query[i]).onAdd(add2, curr); } - tree.separation = function(x) { - return arguments.length ? (separation = x, tree) : separation; - }; - tree.size = function(x) { - return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [ - dx, - dy - ]; - }; - tree.nodeSize = function(x) { - return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : nodeSize ? [ - dx, - dy - ] : null; - }; - return tree; - }); -var _indexJs = require("./hierarchy/index.js"); -function defaultSeparation(a, b) { - return a.parent === b.parent ? 1 : 2; -} -// function radialSeparation(a, b) { -// return (a.parent === b.parent ? 1 : 2) / a.depth; -// } -// This function is used to traverse the left contour of a subtree (or -// subforest). It returns the successor of v on this contour. This successor is -// either given by the leftmost child of v or by the thread of v. The function -// returns null if and only if v is on the highest level of its subtree. -function nextLeft(v) { - var children = v.children; - return children ? children[0] : v.t; -} -// This function works analogously to nextLeft. -function nextRight(v) { - var children = v.children; - return children ? children[children.length - 1] : v.t; -} -// Shifts the current subtree rooted at w+. This is done by increasing -// prelim(w+) and mod(w+) by shift. -function moveSubtree(wm, wp, shift) { - var change = shift / (wp.i - wm.i); - wp.c -= change; - wp.s += shift; - wm.c += change; - wp.z += shift; - wp.m += shift; -} -// All other shifts, applied to the smaller subtrees between w- and w+, are -// performed by this function. To prepare the shifts, we have to adjust -// change(w+), shift(w+), and change(w-). -function executeShifts(v) { - var shift = 0, change = 0, children = v.children, i = children.length, w; - while(--i >= 0){ - w = children[i]; - w.z += shift; - w.m += shift; - shift += w.s + (change += w.c); - } -} -// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, -// returns the specified (default) ancestor. -function nextAncestor(vim, v, ancestor) { - return vim.a.parent === v.parent ? vim.a : ancestor; -} -function TreeNode(node, i) { - this._ = node; - this.parent = null; - this.children = null; - this.A = null; // default ancestor - this.a = this; // ancestor - this.z = 0; // prelim - this.m = 0; // mod - this.c = 0; // change - this.s = 0; // shift - this.t = null; // thread - this.i = i; // number -} -TreeNode.prototype = Object.create((0, _indexJs.Node).prototype); -function treeRoot(root) { - var tree = new TreeNode(root, 0), node, nodes = [ - tree - ], child, children, i, n; - while(node = nodes.pop())if (children = node._.children) { - node.children = new Array(n = children.length); - for(i = n - 1; i >= 0; --i){ - nodes.push(child = node.children[i] = new TreeNode(children[i], i)); - child.parent = node; - } - } - (tree.parent = new TreeNode(null, 0)).children = [ - tree - ]; - return tree; -} - -},{"./hierarchy/index.js":"jtgBj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ew6JB":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function() { - var tile = (0, _squarifyJsDefault.default), round = false, dx = 1, dy = 1, paddingStack = [ - 0 - ], paddingInner = (0, _constantJs.constantZero), paddingTop = (0, _constantJs.constantZero), paddingRight = (0, _constantJs.constantZero), paddingBottom = (0, _constantJs.constantZero), paddingLeft = (0, _constantJs.constantZero); - function treemap(root) { - root.x0 = root.y0 = 0; - root.x1 = dx; - root.y1 = dy; - root.eachBefore(positionNode); - paddingStack = [ - 0 - ]; - if (round) root.eachBefore((0, _roundJsDefault.default)); - return root; - } - function positionNode(node) { - var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - node.x0 = x0; - node.y0 = y0; - node.x1 = x1; - node.y1 = y1; - if (node.children) { - p = paddingStack[node.depth + 1] = paddingInner(node) / 2; - x0 += paddingLeft(node) - p; - y0 += paddingTop(node) - p; - x1 -= paddingRight(node) - p; - y1 -= paddingBottom(node) - p; - if (x1 < x0) x0 = x1 = (x0 + x1) / 2; - if (y1 < y0) y0 = y1 = (y0 + y1) / 2; - tile(node, x0, y0, x1, y1); - } + } + for (i = 0, n = bits.data().length; i < n; ++i) { + if (remMap[i]) { + continue; + } else if (prev[i] !== curr[i]) { + out.push(i); + } else if (modMap[i] && curr[i] !== all) { + mod.push(i); } - treemap.round = function(x) { - return arguments.length ? (round = !!x, treemap) : round; - }; - treemap.size = function(x) { - return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [ - dx, - dy - ]; - }; - treemap.tile = function(x) { - return arguments.length ? (tile = (0, _accessorsJs.required)(x), treemap) : tile; - }; - treemap.padding = function(x) { - return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); - }; - treemap.paddingInner = function(x) { - return arguments.length ? (paddingInner = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingInner; - }; - treemap.paddingOuter = function(x) { - return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); - }; - treemap.paddingTop = function(x) { - return arguments.length ? (paddingTop = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingTop; - }; - treemap.paddingRight = function(x) { - return arguments.length ? (paddingRight = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingRight; - }; - treemap.paddingBottom = function(x) { - return arguments.length ? (paddingBottom = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingBottom; - }; - treemap.paddingLeft = function(x) { - return arguments.length ? (paddingLeft = typeof x === "function" ? x : (0, _constantJsDefault.default)(+x), treemap) : paddingLeft; - }; - return treemap; - }); -var _roundJs = require("./round.js"); -var _roundJsDefault = parcelHelpers.interopDefault(_roundJs); -var _squarifyJs = require("./squarify.js"); -var _squarifyJsDefault = parcelHelpers.interopDefault(_squarifyJs); -var _accessorsJs = require("../accessors.js"); -var _constantJs = require("../constant.js"); -var _constantJsDefault = parcelHelpers.interopDefault(_constantJs); - -},{"./round.js":"9PNun","./squarify.js":"dnoy6","../accessors.js":"i242w","../constant.js":"i6Ely","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dnoy6":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "phi", ()=>phi); -parcelHelpers.export(exports, "squarifyRatio", ()=>squarifyRatio); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var phi = (1 + Math.sqrt(5)) / 2; -function squarifyRatio(ratio, parent, x0, y0, x1, y1) { - var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta; - while(i0 < n){ - dx = x1 - x0, dy = y1 - y0; - // Find the next non-empty node. - do sumValue = nodes[i1++].value; - while (!sumValue && i1 < n); - minValue = maxValue = sumValue; - alpha = Math.max(dy / dx, dx / dy) / (value * ratio); - beta = sumValue * sumValue * alpha; - minRatio = Math.max(maxValue / beta, beta / minValue); - // Keep adding nodes while the aspect ratio maintains or improves. - for(; i1 < n; ++i1){ - sumValue += nodeValue = nodes[i1].value; - if (nodeValue < minValue) minValue = nodeValue; - if (nodeValue > maxValue) maxValue = nodeValue; - beta = sumValue * sumValue * alpha; - newRatio = Math.max(maxValue / beta, beta / minValue); - if (newRatio > minRatio) { - sumValue -= nodeValue; - break; - } - minRatio = newRatio; + } + bits.mask = (1 << m2) - 1; + return output2; + }, + eval(_, pulse2) { + const output2 = pulse2.materialize().fork(), m2 = this._dims.length; + let mask = 0; + if (pulse2.rem.length) { + this.remove(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (_.modified("query") && !_.modified("fields")) { + mask |= this.update(_, pulse2, output2); + } + if (pulse2.add.length) { + this.insert(_, pulse2, output2); + mask |= (1 << m2) - 1; + } + if (pulse2.mod.length) { + this.modify(pulse2, output2); + mask |= (1 << m2) - 1; + } + this.value.mask = mask; + return output2; + }, + insert(_, pulse2, output2) { + const tuples = pulse2.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output2.add, n = bits.size() + tuples.length, m2 = dims.length; + let k = bits.size(), j, key2, add2; + bits.resize(n, m2); + bits.add(tuples); + const curr = bits.curr(), prev = bits.prev(), all = bits.all(); + for (j = 0; j < m2; ++j) { + key2 = fields[j].fname; + add2 = adds[key2] || (adds[key2] = indices[key2].insert(fields[j], tuples, k)); + dims[j].onAdd(add2, curr); + } + for (; k < n; ++k) { + prev[k] = all; + if (curr[k] !== all) out.push(k); + } + }, + modify(pulse2, output2) { + const out = output2.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse2.mod; + let i, n, k; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + if (curr[k] !== all) out.push(k); + } + }, + remove(_, pulse2, output2) { + const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map2 = {}, out = output2.rem, tuples = pulse2.rem; + let i, n, k, f; + for (i = 0, n = tuples.length; i < n; ++i) { + k = tuples[i]._index; + map2[k] = 1; + prev[k] = f = curr[k]; + curr[k] = all; + if (f !== all) out.push(k); + } + for (k in indices) { + indices[k].remove(n, map2); + } + this.reindex(pulse2, n, map2); + return map2; + }, + // reindex filters and indices after propagation completes + reindex(pulse2, num, map2) { + const indices = this._indices, bits = this.value; + pulse2.runAfter(() => { + const indexMap = bits.remove(num, map2); + for (const key2 in indices) indices[key2].reindex(indexMap); + }); + }, + update(_, pulse2, output2) { + const dims = this._dims, query = _.query, stamp = pulse2.stamp, m2 = dims.length; + let mask = 0, i, q; + output2.filters = 0; + for (q = 0; q < m2; ++q) { + if (_.modified("query", q)) { + i = q; + ++mask; + } + } + if (mask === 1) { + mask = dims[i].one; + this.incrementOne(dims[i], query[i], output2.add, output2.rem); + } else { + for (q = 0, mask = 0; q < m2; ++q) { + if (!_.modified("query", q)) continue; + mask |= dims[q].one; + this.incrementAll(dims[q], query[q], stamp, output2.add); + output2.rem = output2.add; + } + } + return mask; + }, + incrementAll(dim, query, stamp, out) { + const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + if (seen[k] !== stamp) { + prev[k] = curr[k]; + seen[k] = stamp; + out.push(k); + } + curr[k] ^= one2; + } + } + dim.range = query.slice(); + }, + incrementOne(dim, query, add2, rem2) { + const bits = this.value, curr = bits.curr(), index2 = dim.index(), old = dim.bisect(dim.range), range2 = dim.bisect(query), lo1 = range2[0], hi1 = range2[1], lo0 = old[0], hi0 = old[1], one2 = dim.one; + let i, j, k; + if (lo1 < lo0) { + for (i = lo1, j = Math.min(lo0, hi1); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (lo1 > lo0) { + for (i = lo0, j = Math.min(lo1, hi0); i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); + } + } + if (hi1 > hi0) { + for (i = Math.max(lo1, hi0), j = hi1; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + add2.push(k); + } + } else if (hi1 < hi0) { + for (i = Math.max(lo0, hi1), j = hi0; i < j; ++i) { + k = index2[i]; + curr[k] ^= one2; + rem2.push(k); } - // Position and record the row orientation. - rows.push(row = { - value: sumValue, - dice: dx < dy, - children: nodes.slice(i0, i1) + } + dim.range = query.slice(); + } + }); + function ResolveFilter(params2) { + Transform.call(this, null, params2); + } + ResolveFilter.Definition = { + "type": "ResolveFilter", + "metadata": {}, + "params": [{ + "name": "ignore", + "type": "number", + "required": true, + "description": "A bit mask indicating which filters to ignore." + }, { + "name": "filter", + "type": "object", + "required": true, + "description": "Per-tuple filter bitmaps from a CrossFilter transform." + }] + }; + inherits(ResolveFilter, Transform, { + transform(_, pulse2) { + const ignore = ~(_.ignore || 0), bitmap = _.filter, mask = bitmap.mask; + if ((mask & ignore) === 0) return pulse2.StopPropagation; + const output2 = pulse2.fork(pulse2.ALL), data2 = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k) => !(curr[k] & ignore) ? data2[k] : null; + output2.filter(output2.MOD, pass); + if (!(mask & mask - 1)) { + output2.filter(output2.ADD, pass); + output2.filter(output2.REM, (k) => (curr[k] & ignore) === mask ? data2[k] : null); + } else { + output2.filter(output2.ADD, (k) => { + const c2 = curr[k] & ignore, f = !c2 && c2 ^ prev[k] & ignore; + return f ? data2[k] : null; + }); + output2.filter(output2.REM, (k) => { + const c2 = curr[k] & ignore, f = c2 && !(c2 ^ (c2 ^ prev[k] & ignore)); + return f ? data2[k] : null; }); - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); - value -= sumValue, i0 = i1; + } + return output2.filter(output2.SOURCE, (t) => pass(t._index)); + } + }); + const xf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + crossfilter: CrossFilter, + resolvefilter: ResolveFilter + }, Symbol.toStringTag, { value: "Module" })); + const RawCode = "RawCode"; + const Literal = "Literal"; + const Property = "Property"; + const Identifier = "Identifier"; + const ArrayExpression = "ArrayExpression"; + const BinaryExpression = "BinaryExpression"; + const CallExpression = "CallExpression"; + const ConditionalExpression = "ConditionalExpression"; + const LogicalExpression = "LogicalExpression"; + const MemberExpression = "MemberExpression"; + const ObjectExpression = "ObjectExpression"; + const UnaryExpression = "UnaryExpression"; + function ASTNode(type2) { + this.type = type2; + } + ASTNode.prototype.visit = function(visitor) { + let c2, i, n; + if (visitor(this)) return 1; + for (c2 = children(this), i = 0, n = c2.length; i < n; ++i) { + if (c2[i].visit(visitor)) return 1; + } + }; + function children(node) { + switch (node.type) { + case ArrayExpression: + return node.elements; + case BinaryExpression: + case LogicalExpression: + return [node.left, node.right]; + case CallExpression: + return [node.callee].concat(node.arguments); + case ConditionalExpression: + return [node.test, node.consequent, node.alternate]; + case MemberExpression: + return [node.object, node.property]; + case ObjectExpression: + return node.properties; + case Property: + return [node.key, node.value]; + case UnaryExpression: + return [node.argument]; + case Identifier: + case Literal: + case RawCode: + default: + return []; + } + } + var TokenName, source, index, length$1, lookahead; + var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; + TokenName = {}; + TokenName[TokenBooleanLiteral] = "Boolean"; + TokenName[TokenEOF] = "<end>"; + TokenName[TokenIdentifier] = "Identifier"; + TokenName[TokenKeyword] = "Keyword"; + TokenName[TokenNullLiteral] = "Null"; + TokenName[TokenNumericLiteral] = "Numeric"; + TokenName[TokenPunctuator] = "Punctuator"; + TokenName[TokenStringLiteral] = "String"; + TokenName[TokenRegularExpression] = "RegularExpression"; + var SyntaxArrayExpression = "ArrayExpression", SyntaxBinaryExpression = "BinaryExpression", SyntaxCallExpression = "CallExpression", SyntaxConditionalExpression = "ConditionalExpression", SyntaxIdentifier = "Identifier", SyntaxLiteral = "Literal", SyntaxLogicalExpression = "LogicalExpression", SyntaxMemberExpression = "MemberExpression", SyntaxObjectExpression = "ObjectExpression", SyntaxProperty = "Property", SyntaxUnaryExpression = "UnaryExpression"; + var MessageUnexpectedToken = "Unexpected token %0", MessageUnexpectedNumber = "Unexpected number", MessageUnexpectedString = "Unexpected string", MessageUnexpectedIdentifier = "Unexpected identifier", MessageUnexpectedReserved = "Unexpected reserved word", MessageUnexpectedEOS = "Unexpected end of input", MessageInvalidRegExp = "Invalid regular expression", MessageUnterminatedRegExp = "Invalid regular expression: missing /", MessageStrictOctalLiteral = "Octal literals are not allowed in strict mode.", MessageStrictDuplicateProperty = "Duplicate data property in object literal not allowed in strict mode"; + var ILLEGAL$1 = "ILLEGAL", DISABLED = "Disabled."; + var RegexNonAsciiIdentifierStart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"), RegexNonAsciiIdentifierPart = new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"); + function assert(condition, message) { + if (!condition) { + throw new Error("ASSERT: " + message); + } + } + function isDecimalDigit(ch2) { + return ch2 >= 48 && ch2 <= 57; + } + function isHexDigit(ch2) { + return "0123456789abcdefABCDEF".includes(ch2); + } + function isOctalDigit(ch2) { + return "01234567".includes(ch2); + } + function isWhiteSpace(ch2) { + return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && [5760, 6158, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].includes(ch2); + } + function isLineTerminator(ch2) { + return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233; + } + function isIdentifierStart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch2)); + } + function isIdentifierPart(ch2) { + return ch2 === 36 || ch2 === 95 || // $ (dollar) and _ (underscore) + ch2 >= 65 && ch2 <= 90 || // A..Z + ch2 >= 97 && ch2 <= 122 || // a..z + ch2 >= 48 && ch2 <= 57 || // 0..9 + ch2 === 92 || // \ (backslash) + ch2 >= 128 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch2)); + } + const keywords = { + "if": 1, + "in": 1, + "do": 1, + "var": 1, + "for": 1, + "new": 1, + "try": 1, + "let": 1, + "this": 1, + "else": 1, + "case": 1, + "void": 1, + "with": 1, + "enum": 1, + "while": 1, + "break": 1, + "catch": 1, + "throw": 1, + "const": 1, + "yield": 1, + "class": 1, + "super": 1, + "return": 1, + "typeof": 1, + "delete": 1, + "switch": 1, + "export": 1, + "import": 1, + "public": 1, + "static": 1, + "default": 1, + "finally": 1, + "extends": 1, + "package": 1, + "private": 1, + "function": 1, + "continue": 1, + "debugger": 1, + "interface": 1, + "protected": 1, + "instanceof": 1, + "implements": 1 + }; + function skipComment() { + while (index < length$1) { + const ch2 = source.charCodeAt(index); + if (isWhiteSpace(ch2) || isLineTerminator(ch2)) { + ++index; + } else { + break; + } + } + } + function scanHexEscape(prefix) { + var i, len2, ch2, code = 0; + len2 = prefix === "u" ? 4 : 2; + for (i = 0; i < len2; ++i) { + if (index < length$1 && isHexDigit(source[index])) { + ch2 = source[index++]; + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + } + return String.fromCharCode(code); + } + function scanUnicodeCodePointEscape() { + var ch2, code, cu1, cu2; + ch2 = source[index]; + code = 0; + if (ch2 === "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + while (index < length$1) { + ch2 = source[index++]; + if (!isHexDigit(ch2)) { + break; + } + code = code * 16 + "0123456789abcdef".indexOf(ch2.toLowerCase()); } - return rows; -} -exports.default = function custom(ratio) { - function squarify(parent, x0, y0, x1, y1) { - squarifyRatio(ratio, parent, x0, y0, x1, y1); + if (code > 1114111 || ch2 !== "}") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - squarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); - }; - return squarify; -}(phi); - -},{"./dice.js":"c7pGx","./slice.js":"c9bya","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c9bya":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value; - while(++i < n){ - node = nodes[i], node.x0 = x0, node.x1 = x1; - node.y0 = y0, node.y1 = y0 += node.value * k; - } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8vqlk":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1); - for(sums[0] = sum = i = 0; i < n; ++i)sums[i + 1] = sum += nodes[i].value; - partition(0, n, parent.value, x0, y0, x1, y1); - function partition(i, j, value, x0, y0, x1, y1) { - if (i >= j - 1) { - var node = nodes[i]; - node.x0 = x0, node.y0 = y0; - node.x1 = x1, node.y1 = y1; - return; - } - var valueOffset = sums[i], valueTarget = value / 2 + valueOffset, k = i + 1, hi = j - 1; - while(k < hi){ - var mid = k + hi >>> 1; - if (sums[mid] < valueTarget) k = mid + 1; - else hi = mid; - } - if (valueTarget - sums[k - 1] < sums[k] - valueTarget && i + 1 < k) --k; - var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft; - if (x1 - x0 > y1 - y0) { - var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1; - partition(i, k, valueLeft, x0, y0, xk, y1); - partition(k, j, valueRight, xk, y0, x1, y1); - } else { - var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1; - partition(i, k, valueLeft, x0, y0, x1, yk); - partition(k, j, valueRight, x0, yk, x1, y1); - } + if (code <= 65535) { + return String.fromCharCode(code); + } + cu1 = (code - 65536 >> 10) + 55296; + cu2 = (code - 65536 & 1023) + 56320; + return String.fromCharCode(cu1, cu2); + } + function getEscapedIdentifier() { + var ch2, id2; + ch2 = source.charCodeAt(index++); + id2 = String.fromCharCode(ch2); + if (ch2 === 92) { + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierStart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + id2 = ch2; + } + while (index < length$1) { + ch2 = source.charCodeAt(index); + if (!isIdentifierPart(ch2)) { + break; + } + ++index; + id2 += String.fromCharCode(ch2); + if (ch2 === 92) { + id2 = id2.substr(0, id2.length - 1); + if (source.charCodeAt(index) !== 117) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - }); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fbNXv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "default", ()=>function(parent, x0, y0, x1, y1) { - (parent.depth & 1 ? (0, _sliceJsDefault.default) : (0, _diceJsDefault.default))(parent, x0, y0, x1, y1); - }); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); - -},{"./dice.js":"c7pGx","./slice.js":"c9bya","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"12ScZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _diceJs = require("./dice.js"); -var _diceJsDefault = parcelHelpers.interopDefault(_diceJs); -var _sliceJs = require("./slice.js"); -var _sliceJsDefault = parcelHelpers.interopDefault(_sliceJs); -var _squarifyJs = require("./squarify.js"); -exports.default = function custom(ratio) { - function resquarify(parent, x0, y0, x1, y1) { - if ((rows = parent._squarify) && rows.ratio === ratio) { - var rows, row, nodes, i, j = -1, n, m = rows.length, value = parent.value; - while(++j < m){ - row = rows[j], nodes = row.children; - for(i = row.value = 0, n = nodes.length; i < n; ++i)row.value += nodes[i].value; - if (row.dice) (0, _diceJsDefault.default)(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1); - else (0, _sliceJsDefault.default)(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1); - value -= row.value; - } - } else { - parent._squarify = rows = (0, _squarifyJs.squarifyRatio)(ratio, parent, x0, y0, x1, y1); - rows.ratio = ratio; + ++index; + ch2 = scanHexEscape("u"); + if (!ch2 || ch2 === "\\" || !isIdentifierPart(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } + id2 += ch2; + } + } + return id2; + } + function getIdentifier() { + var start, ch2; + start = index++; + while (index < length$1) { + ch2 = source.charCodeAt(index); + if (ch2 === 92) { + index = start; + return getEscapedIdentifier(); + } + if (isIdentifierPart(ch2)) { + ++index; + } else { + break; + } } - resquarify.ratio = function(x) { - return custom((x = +x) > 1 ? x : 1); + return source.slice(start, index); + } + function scanIdentifier() { + var start, id2, type2; + start = index; + id2 = source.charCodeAt(index) === 92 ? getEscapedIdentifier() : getIdentifier(); + if (id2.length === 1) { + type2 = TokenIdentifier; + } else if (keywords.hasOwnProperty(id2)) { + type2 = TokenKeyword; + } else if (id2 === "null") { + type2 = TokenNullLiteral; + } else if (id2 === "true" || id2 === "false") { + type2 = TokenBooleanLiteral; + } else { + type2 = TokenIdentifier; + } + return { + type: type2, + value: id2, + start, + end: index }; - return resquarify; -}((0, _squarifyJs.phi)); - -},{"./dice.js":"c7pGx","./slice.js":"c9bya","./squarify.js":"dnoy6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lZyUZ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "label", ()=>Label); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -// bit mask for getting first 2 bytes of alpha value -const ALPHA_MASK = 0xff000000; -function baseBitmaps($, data) { - const bitmap = $.bitmap(); - // when there is no base mark but data points are to be avoided - (data || []).forEach((d)=>bitmap.set($(d.boundary[0]), $(d.boundary[3]))); - return [ - bitmap, - undefined - ]; -} -function markBitmaps($, baseMark, avoidMarks, labelInside, isGroupArea) { - // create canvas - const width = $.width, height = $.height, border = labelInside || isGroupArea, context = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), baseMarkContext = (0, _vegaCanvas.canvas)(width, height).getContext('2d'), strokeContext = border && (0, _vegaCanvas.canvas)(width, height).getContext('2d'); - // render all marks to be avoided into canvas - avoidMarks.forEach((items)=>draw(context, items, false)); - draw(baseMarkContext, baseMark, false); - if (border) draw(strokeContext, baseMark, true); - // get canvas buffer, create bitmaps - const buffer = getBuffer(context, width, height), baseMarkBuffer = getBuffer(baseMarkContext, width, height), strokeBuffer = border && getBuffer(strokeContext, width, height), layer1 = $.bitmap(), layer2 = border && $.bitmap(); - // populate bitmap layers - let x, y, u, v, index, alpha, strokeAlpha, baseMarkAlpha; - for(y = 0; y < height; ++y)for(x = 0; x < width; ++x){ - index = y * width + x; - alpha = buffer[index] & ALPHA_MASK; - baseMarkAlpha = baseMarkBuffer[index] & ALPHA_MASK; - strokeAlpha = border && strokeBuffer[index] & ALPHA_MASK; - if (alpha || strokeAlpha || baseMarkAlpha) { - u = $(x); - v = $(y); - if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u, v); // update interior bitmap - if (border && (alpha || strokeAlpha)) layer2.set(u, v); // update border bitmap + } + function scanPunctuator() { + var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; + switch (code) { + // Check for most common single-character punctuators. + case 46: + // . dot + case 40: + // ( open bracket + case 41: + // ) close bracket + case 59: + // ; semicolon + case 44: + // , comma + case 123: + // { open curly brace + case 125: + // } close curly brace + case 91: + // [ + case 93: + // ] + case 58: + // : + case 63: + // ? + case 126: + ++index; + return { + type: TokenPunctuator, + value: String.fromCharCode(code), + start, + end: index + }; + default: + code2 = source.charCodeAt(index + 1); + if (code2 === 61) { + switch (code) { + case 43: + // + + case 45: + // - + case 47: + // / + case 60: + // < + case 62: + // > + case 94: + // ^ + case 124: + // | + case 37: + // % + case 38: + // & + case 42: + index += 2; + return { + type: TokenPunctuator, + value: String.fromCharCode(code) + String.fromCharCode(code2), + start, + end: index + }; + case 33: + // ! + case 61: + index += 2; + if (source.charCodeAt(index) === 61) { + ++index; + } + return { + type: TokenPunctuator, + value: source.slice(start, index), + start, + end: index + }; + } } } - return [ - layer1, - layer2 - ]; -} -function getBuffer(context, width, height) { - return new Uint32Array(context.getImageData(0, 0, width, height).data.buffer); -} -function draw(context, items, interior) { - if (!items.length) return; - const type = items[0].mark.marktype; - if (type === 'group') items.forEach((group)=>{ - group.items.forEach((mark)=>draw(context, mark.items, interior)); - }); - else (0, _vegaScenegraph.Marks)[type].draw(context, { - items: interior ? items.map(prepare) : items - }); -} -/** - * Prepare item before drawing into canvas (setting stroke and opacity) - * @param {object} source item to be prepared - * @returns prepared item - */ function prepare(source) { - const item = (0, _vegaDataflow.rederive)(source, {}); - if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) return { - ...item, - strokeOpacity: 1, - stroke: '#000', - fillOpacity: 0 - }; - return item; -} -const DIV = 5, // bit shift from x, y index to bit vector array index -MOD = 31, // bit mask for index lookup within a bit vector -SIZE = 32, // individual bit vector size -RIGHT0 = new Uint32Array(SIZE + 1), // left-anchored bit vectors, full -> 0 -RIGHT1 = new Uint32Array(SIZE + 1); // right-anchored bit vectors, 0 -> full -RIGHT1[0] = 0; -RIGHT0[0] = ~RIGHT1[0]; -for(let i = 1; i <= SIZE; ++i){ - RIGHT1[i] = RIGHT1[i - 1] << 1 | 1; - RIGHT0[i] = ~RIGHT1[i]; -} -function Bitmap(w, h) { - const array = new Uint32Array(~~((w * h + SIZE) / SIZE)); - function _set(index, mask) { - array[index] |= mask; + ch4 = source.substr(index, 4); + if (ch4 === ">>>=") { + index += 4; + return { + type: TokenPunctuator, + value: ch4, + start, + end: index + }; + } + ch3 = ch4.substr(0, 3); + if (ch3 === ">>>" || ch3 === "<<=" || ch3 === ">>=") { + index += 3; + return { + type: TokenPunctuator, + value: ch3, + start, + end: index + }; + } + ch2 = ch3.substr(0, 2); + if (ch1 === ch2[1] && "+-<>&|".includes(ch1) || ch2 === "=>") { + index += 2; + return { + type: TokenPunctuator, + value: ch2, + start, + end: index + }; + } + if (ch2 === "//") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + if ("<>=!+-*%&|^/".includes(ch1)) { + ++index; + return { + type: TokenPunctuator, + value: ch1, + start, + end: index + }; + } + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + function scanHexLiteral(start) { + let number2 = ""; + while (index < length$1) { + if (!isHexDigit(source[index])) { + break; + } + number2 += source[index++]; } - function _clear(index, mask) { - array[index] &= mask; + if (number2.length === 0) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } return { - array: array, - get: (x, y)=>{ - const index = y * w + x; - return array[index >>> DIV] & 1 << (index & MOD); - }, - set: (x, y)=>{ - const index = y * w + x; - _set(index >>> DIV, 1 << (index & MOD)); - }, - clear: (x, y)=>{ - const index = y * w + x; - _clear(index >>> DIV, ~(1 << (index & MOD))); - }, - getRange: (x, y, x2, y2)=>{ - let r = y2, start, end, indexStart, indexEnd; - for(; r >= y; --r){ - start = r * w + x; - end = r * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) { - if (array[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) return true; - } else { - if (array[indexStart] & RIGHT0[start & MOD]) return true; - if (array[indexEnd] & RIGHT1[(end & MOD) + 1]) return true; - for(let i = indexStart + 1; i < indexEnd; ++i){ - if (array[i]) return true; - } - } - } - return false; - }, - setRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]); - else { - _set(indexStart, RIGHT0[start & MOD]); - _set(indexEnd, RIGHT1[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_set(i, 0xffffffff); - } - } - }, - clearRange: (x, y, x2, y2)=>{ - let start, end, indexStart, indexEnd, i; - for(; y <= y2; ++y){ - start = y * w + x; - end = y * w + x2; - indexStart = start >>> DIV; - indexEnd = end >>> DIV; - if (indexStart === indexEnd) _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]); - else { - _clear(indexStart, RIGHT1[start & MOD]); - _clear(indexEnd, RIGHT0[(end & MOD) + 1]); - for(i = indexStart + 1; i < indexEnd; ++i)_clear(i, 0); - } - } - }, - outOfBounds: (x, y, x2, y2)=>x < 0 || y < 0 || y2 >= h || x2 >= w - }; -} -function scaler(width, height, padding) { - const ratio = Math.max(1, Math.sqrt(width * height / 1e6)), w = ~~((width + 2 * padding + ratio) / ratio), h = ~~((height + 2 * padding + ratio) / ratio), scale = (_)=>~~((_ + padding) / ratio); - scale.invert = (_)=>_ * ratio - padding; - scale.bitmap = ()=>Bitmap(w, h); - scale.ratio = ratio; - scale.padding = padding; - scale.width = width; - scale.height = height; - return scale; -} -function placeAreaLabelNaive($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height; - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxAreaWidth = 0, x1, x2, y1, y2, x, y, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - areaWidth = Math.abs(x2 - x1 + y2 - y1); - if (areaWidth >= maxAreaWidth) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - } - } - x = textWidth / 2; - y = textHeight / 2; - x1 = d.x - x; - x2 = d.x + x; - y1 = d.y - y; - y2 = d.y + y; - d.align = 'center'; - if (x1 < 0 && x2 <= width) d.align = 'left'; - else if (0 <= x1 && width < x2) d.align = 'right'; - d.baseline = 'middle'; - if (y1 < 0 && y2 <= height) d.baseline = 'top'; - else if (0 <= y1 && height < y2) d.baseline = 'bottom'; - return true; + type: TokenNumericLiteral, + value: parseInt("0x" + number2, 16), + start, + end: index }; -} -function outOfBounds(x, y, textWidth, textHeight, width, height) { - let r = textWidth / 2; - return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height; -} -function collision($, x, y, textHeight, textWidth, h, bm0, bm1) { - const w = textWidth * h / (textHeight * 2), x1 = $(x - w), x2 = $(x + w), y1 = $(y - (h = h / 2)), y2 = $(y + h); - return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2); -} -function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1]; // area outlines - function tryLabel(_x, _y, maxSize, textWidth, textHeight) { - const x = $.invert(_x), y = $.invert(_y); - let lo = maxSize, hi = height, mid; - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) return [ - x, - y, - lo, - true - ]; - } + } + function scanOctalLiteral(start) { + let number2 = "0" + source[index++]; + while (index < length$1) { + if (!isOctalDigit(source[index])) { + break; + } + number2 += source[index++]; } - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); // label height - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, _x1, _xMid, _x2, _y1, _yMid, _y2, areaWidth, result, swapTmp; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - if (x1 > x2) { - swapTmp = x1; - x1 = x2; - x2 = swapTmp; - } - if (y1 > y2) { - swapTmp = y1; - y1 = y2; - y2 = swapTmp; - } - _x1 = $(x1); - _x2 = $(x2); - _xMid = ~~((_x1 + _x2) / 2); - _y1 = $(y1); - _y2 = $(y2); - _yMid = ~~((_y1 + _y2) / 2); - // search along the line from mid point between the 2 border to lower border - for(_x = _xMid; _x >= _x1; --_x)for(_y = _yMid; _y >= _y1; --_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // search along the line from mid point between the 2 border to upper border - for(_x = _xMid; _x <= _x2; ++_x)for(_y = _yMid; _y <= _y2; ++_y){ - result = tryLabel(_x, _y, maxSize, textWidth, textHeight); - if (result) [d.x, d.y, maxSize, labelPlaced] = result; - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } - } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; + if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + return { + type: TokenNumericLiteral, + value: parseInt(number2, 8), + octal: true, + start, + end: index }; -} -// pixel direction offsets for flood fill search -const X_DIR = [ - -1, - -1, - 1, - 1 -]; -const Y_DIR = [ - -1, - 1, - -1, - 1 -]; -function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex) { - const width = $.width, height = $.height, bm0 = bitmaps[0], // where labels have been placed - bm1 = bitmaps[1], // area outlines - bm2 = $.bitmap(); // flood-fill visitations - // try to place a label within an input area mark - return function(d) { - const items = d.datum.datum.items[markIndex].items, // area points - n = items.length, // number of points - textHeight = d.datum.fontSize, // label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text), // label height - stack = []; // flood fill stack - let maxSize = avoidBaseMark ? textHeight : 0, labelPlaced = false, labelPlaced2 = false, maxAreaWidth = 0, x1, x2, y1, y2, x, y, _x, _y, lo, hi, mid, areaWidth; - // for each area sample point - for(let i = 0; i < n; ++i){ - x1 = items[i].x; - y1 = items[i].y; - x2 = items[i].x2 === undefined ? x1 : items[i].x2; - y2 = items[i].y2 === undefined ? y1 : items[i].y2; - // add scaled center point to stack - stack.push([ - $((x1 + x2) / 2), - $((y1 + y2) / 2) - ]); - // perform flood fill, visit points - while(stack.length){ - [_x, _y] = stack.pop(); - // exit if point already marked - if (bm0.get(_x, _y) || bm1.get(_x, _y) || bm2.get(_x, _y)) continue; - // mark point in flood fill bitmap - // add search points for all (in bound) directions - bm2.set(_x, _y); - for(let j = 0; j < 4; ++j){ - x = _x + X_DIR[j]; - y = _y + Y_DIR[j]; - if (!bm2.outOfBounds(x, y, x, y)) stack.push([ - x, - y - ]); - } - // unscale point back to x, y space - x = $.invert(_x); - y = $.invert(_y); - lo = maxSize; - hi = height; // TODO: make this bound smaller - if (!outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, lo, bm0, bm1) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - // if the label fits at the current sample point, - // perform binary search to find the largest font size that fits - while(hi - lo >= 1){ - mid = (lo + hi) / 2; - if (collision($, x, y, textHeight, textWidth, mid, bm0, bm1)) hi = mid; - else lo = mid; - } - // place label if current lower bound exceeds prior max font size - if (lo > maxSize) { - d.x = x; - d.y = y; - maxSize = lo; - labelPlaced = true; - } - } - } - // place label at slice center if not placed through other means - // and if we're not avoiding overlap with other areas - if (!labelPlaced && !avoidBaseMark) { - // one span is zero, hence we can add - areaWidth = Math.abs(x2 - x1 + y2 - y1); - x = (x1 + x2) / 2; - y = (y1 + y2) / 2; - // place label if it fits and improves the max area width - if (areaWidth >= maxAreaWidth && !outOfBounds(x, y, textWidth, textHeight, width, height) && !collision($, x, y, textHeight, textWidth, textHeight, bm0, null)) { - maxAreaWidth = areaWidth; - d.x = x; - d.y = y; - labelPlaced2 = true; - } - } + } + function scanNumericLiteral() { + var number2, start, ch2; + ch2 = source[index]; + assert(isDecimalDigit(ch2.charCodeAt(0)) || ch2 === ".", "Numeric literal must start with a decimal digit or a decimal point"); + start = index; + number2 = ""; + if (ch2 !== ".") { + number2 = source[index++]; + ch2 = source[index]; + if (number2 === "0") { + if (ch2 === "x" || ch2 === "X") { + ++index; + return scanHexLiteral(start); } - // record current label placement information, update label bitmap - if (labelPlaced || labelPlaced2) { - x = textWidth / 2; - y = textHeight / 2; - bm0.setRange($(d.x - x), $(d.y - y), $(d.x + x), $(d.y + y)); - d.align = 'center'; - d.baseline = 'middle'; - return true; - } else return false; - }; -} -const Aligns = [ - 'right', - 'center', - 'left' -], Baselines = [ - 'bottom', - 'middle', - 'top' -]; -function placeMarkLabel($, bitmaps, anchors, offsets) { - const width = $.width, height = $.height, bm0 = bitmaps[0], bm1 = bitmaps[1], n = offsets.length; - return function(d) { - const boundary = d.boundary, textHeight = d.datum.fontSize; - // can not be placed if the mark is not visible in the graph bound - if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) return false; - let textWidth = d.textWidth ?? 0, dx, dy, isInside, sizeFactor, insideFactor, x1, x2, y1, y2, xc, yc, _x1, _x2, _y1, _y2; - // for each anchor and offset - for(let i = 0; i < n; ++i){ - dx = (anchors[i] & 0x3) - 1; - dy = (anchors[i] >>> 0x2 & 0x3) - 1; - isInside = dx === 0 && dy === 0 || offsets[i] < 0; - sizeFactor = dx && dy ? Math.SQRT1_2 : 1; - insideFactor = offsets[i] < 0 ? -1 : 1; - x1 = boundary[1 + dx] + offsets[i] * dx * sizeFactor; - yc = boundary[4 + dy] + insideFactor * textHeight * dy / 2 + offsets[i] * dy * sizeFactor; - y1 = yc - textHeight / 2; - y2 = yc + textHeight / 2; - _x1 = $(x1); - _y1 = $(y1); - _y2 = $(y2); - if (!textWidth) { - // to avoid finding width of text label, - if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) continue; - else // Otherwise, find the label width - textWidth = (0, _vegaScenegraph.textMetrics).width(d.datum, d.datum.text); - } - xc = x1 + insideFactor * textWidth * dx / 2; - x1 = xc - textWidth / 2; - x2 = xc + textWidth / 2; - _x1 = $(x1); - _x2 = $(x2); - if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) { - // place label if the position is placeable - d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1; - d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1; - d.align = Aligns[dx * insideFactor + 1]; - d.baseline = Baselines[dy * insideFactor + 1]; - bm0.setRange(_x1, _y1, _x2, _y2); - return true; - } + if (isOctalDigit(ch2)) { + return scanOctalLiteral(start); } - return false; - }; -} -// Test if a label with the given dimensions can be added without overlap -function test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) { - return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2)); -} -// 8-bit representation of anchors -const TOP = 0x0, MIDDLE = 0x4, BOTTOM = 0x8, LEFT = 0x0, CENTER = 0x1, RIGHT = 0x2; -// Mapping from text anchor to number representation -const anchorCode = { - 'top-left': TOP + LEFT, - 'top': TOP + CENTER, - 'top-right': TOP + RIGHT, - 'left': MIDDLE + LEFT, - 'middle': MIDDLE + CENTER, - 'right': MIDDLE + RIGHT, - 'bottom-left': BOTTOM + LEFT, - 'bottom': BOTTOM + CENTER, - 'bottom-right': BOTTOM + RIGHT -}; -const placeAreaLabel = { - 'naive': placeAreaLabelNaive, - 'reduced-search': placeAreaLabelReducedSearch, - 'floodfill': placeAreaLabelFloodFill -}; -function labelLayout(texts, size, compare, offset, anchor, avoidMarks, avoidBaseMark, lineAnchor, markIndex, padding, method) { - // early exit for empty data - if (!texts.length) return texts; - const positions = Math.max(offset.length, anchor.length), offsets = getOffsets(offset, positions), anchors = getAnchors(anchor, positions), marktype = markType(texts[0].datum), grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype, isGroupArea = grouptype === 'area', boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex), infPadding = padding === null || padding === Infinity, isNaiveGroupArea = isGroupArea && method === 'naive'; - let maxTextWidth = -1, maxTextHeight = -1; - // prepare text mark data for placing - const data = texts.map((d)=>{ - const textWidth = infPadding ? (0, _vegaScenegraph.textMetrics).width(d, d.text) : undefined; - maxTextWidth = Math.max(maxTextWidth, textWidth); - maxTextHeight = Math.max(maxTextHeight, d.fontSize); - return { - datum: d, - opacity: 0, - x: undefined, - y: undefined, - align: undefined, - baseline: undefined, - boundary: boundary(d), - textWidth - }; - }); - padding = padding === null || padding === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset) : padding; - const $ = scaler(size[0], size[1], padding); - let bitmaps; - if (!isNaiveGroupArea) { - // sort labels in priority order, if comparator is provided - if (compare) data.sort((a, b)=>compare(a.datum, b.datum)); - // flag indicating if label can be placed inside its base mark - let labelInside = false; - for(let i = 0; i < anchors.length && !labelInside; ++i)// label inside if anchor is at center - // label inside if offset to be inside the mark bound - labelInside = anchors[i] === 0x5 || offsets[i] < 0; - // extract data information from base mark when base mark is to be avoided - // base mark is implicitly avoided if it is a group area - const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map((d)=>d.datum); - // generate bitmaps for layout calculation - bitmaps = avoidMarks.length || baseMark ? markBitmaps($, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data); - } - // generate label placement function - const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets); - // place all labels - data.forEach((d)=>d.opacity = +place(d)); - return data; -} -function getOffsets(_, count) { - const offsets = new Float64Array(count), n = _.length; - for(let i = 0; i < n; ++i)offsets[i] = _[i] || 0; - for(let i = n; i < count; ++i)offsets[i] = offsets[n - 1]; - return offsets; -} -function getAnchors(_, count) { - const anchors = new Int8Array(count), n = _.length; - for(let i = 0; i < n; ++i)anchors[i] |= anchorCode[_[i]]; - for(let i = n; i < count; ++i)anchors[i] = anchors[n - 1]; - return anchors; -} -function markType(item) { - return item && item.mark && item.mark.marktype; -} -/** - * Factory function for function for getting base mark boundary, depending - * on mark and group type. When mark type is undefined, line or area: boundary - * is the coordinate of each data point. When base mark is grouped line, - * boundary is either at the start or end of the line depending on the - * value of lineAnchor. Otherwise, use bounds of base mark. - */ function markBoundary(marktype, grouptype, lineAnchor, markIndex) { - const xy = (d)=>[ - d.x, - d.x, - d.x, - d.y, - d.y, - d.y - ]; - if (!marktype) return xy; // no reactive geometry - else if (marktype === 'line' || marktype === 'area') return (d)=>xy(d.datum); - else if (grouptype === 'line') return (d)=>{ - const items = d.datum.items[markIndex].items; - return xy(items.length ? items[lineAnchor === 'start' ? 0 : items.length - 1] : { - x: NaN, - y: NaN - }); - }; - else return (d)=>{ - const b = d.datum.bounds; - return [ - b.x1, - (b.x1 + b.x2) / 2, - b.x2, - b.y1, - (b.y1 + b.y2) / 2, - b.y2 - ]; - }; -} -const Output = [ - 'x', - 'y', - 'opacity', - 'align', - 'baseline' -]; -const Anchors = [ - 'top-left', - 'left', - 'bottom-left', - 'top', - 'bottom', - 'top-right', - 'right', - 'bottom-right' -]; -/** - * Compute text label layout to annotate marks. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<number>} params.size - The size of the layout, provided as a [width, height] array. - * @param {function(*,*): number} [params.sort] - An optional - * comparator function for sorting label data in priority order. - * @param {Array<string>} [params.anchor] - Label anchor points relative to the base mark bounding box. - * The available options are 'top-left', 'left', 'bottom-left', 'top', - * 'bottom', 'top-right', 'right', 'bottom-right', 'middle'. - * @param {Array<number>} [params.offset] - Label offsets (in pixels) from the base mark bounding box. - * This parameter is parallel to the list of anchor points. - * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size. - * If this parameter is null, a label may exceed the layout size without any boundary. - * @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor - * position for labels. One of 'start' or 'end'. - * @param {string} [params.markIndex=0] - For group mark labels only, an index indicating - * which mark within the group should be labeled. - * @param {Array<number>} [params.avoidMarks] - A list of additional mark names for which the label - * layout should avoid overlap. - * @param {boolean} [params.avoidBaseMark=true] - Boolean flag indicating if labels should avoid - * overlap with the underlying base mark being labeled. - * @param {string} [params.method='naive'] - For area make labels only, a method for - * place labels. One of 'naive', 'reduced-search', or 'floodfill'. - * @param {Array<string>} [params.as] - The output fields written by the transform. - * The default is ['x', 'y', 'opacity', 'align', 'baseline']. - */ function Label(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Label.Definition = { - type: 'Label', - metadata: { - modifies: true - }, - params: [ - { - name: 'size', - type: 'number', - array: true, - length: 2, - required: true - }, - { - name: 'sort', - type: 'compare' - }, - { - name: 'anchor', - type: 'string', - array: true, - default: Anchors - }, - { - name: 'offset', - type: 'number', - array: true, - default: [ - 1 - ] - }, - { - name: 'padding', - type: 'number', - default: 0, - null: true - }, - { - name: 'lineAnchor', - type: 'string', - values: [ - 'start', - 'end' - ], - default: 'end' - }, - { - name: 'markIndex', - type: 'number', - default: 0 - }, - { - name: 'avoidBaseMark', - type: 'boolean', - default: true - }, - { - name: 'avoidMarks', - type: 'data', - array: true - }, - { - name: 'method', - type: 'string', - default: 'naive' - }, - { - name: 'as', - type: 'string', - array: true, - length: Output.length, - default: Output - } - ] -}; -(0, _vegaUtil.inherits)(Label, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || modp('sort'))) return; - if (!_.size || _.size.length !== 2) (0, _vegaUtil.error)('Size parameter should be specified as a [width, height] array.'); - const as = _.as || Output; - // run label layout - labelLayout(pulse.materialize(pulse.SOURCE).source || [], _.size, _.sort, (0, _vegaUtil.array)(_.offset == null ? 1 : _.offset), (0, _vegaUtil.array)(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || 'end', _.markIndex || 0, _.padding === undefined ? 0 : _.padding, _.method || 'naive').forEach((l)=>{ - // write layout results to data stream - const t = l.datum; - t[as[0]] = l.x; - t[as[1]] = l.y; - t[as[2]] = l.opacity; - t[as[3]] = l.align; - t[as[4]] = l.baseline; - }); - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-scenegraph":"jattk","vega-canvas":"kPWfS","vega-dataflow":"3NitK","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"elv3U":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "loess", ()=>Loess); -parcelHelpers.export(exports, "regression", ()=>Regression); -var _vegaStatistics = require("vega-statistics"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -function partition(data, groupby) { - var groups = [], get = function(f) { - return f(t); - }, map, i, n, t, k, g; - // partition data points into stack groups - if (groupby == null) groups.push(data); - else for(map = {}, i = 0, n = data.length; i < n; ++i){ - t = data[i]; - k = groupby.map(get); - g = map[k]; - if (!g) { - map[k] = g = []; - g.dims = k; - groups.push(g); + if (ch2 && isDecimalDigit(ch2.charCodeAt(0))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - g.push(t); + } + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; } - return groups; -} -/** - * Compute locally-weighted regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {number} [params.bandwidth=0.3] - The loess bandwidth. - */ function Loess(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Loess.Definition = { - 'type': 'Loess', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'bandwidth', - 'type': 'number', - 'default': 0.3 - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Loess, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), m = names.length, as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], values = []; - groups.forEach((g)=>{ - (0, _vegaStatistics.regressionLoess)(g, _.x, _.y, _.bandwidth || 0.3).forEach((p)=>{ - const t = {}; - for(let i = 0; i < m; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + if (ch2 === ".") { + number2 += source[index++]; + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; + } + ch2 = source[index]; + } + if (ch2 === "e" || ch2 === "E") { + number2 += source[index++]; + ch2 = source[index]; + if (ch2 === "+" || ch2 === "-") { + number2 += source[index++]; + } + if (isDecimalDigit(source.charCodeAt(index))) { + while (isDecimalDigit(source.charCodeAt(index))) { + number2 += source[index++]; } - return out; + } else { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } } -}); -const Methods = { - constant: (0, _vegaStatistics.regressionConstant), - linear: (0, _vegaStatistics.regressionLinear), - log: (0, _vegaStatistics.regressionLog), - exp: (0, _vegaStatistics.regressionExp), - pow: (0, _vegaStatistics.regressionPow), - quad: (0, _vegaStatistics.regressionQuad), - poly: (0, _vegaStatistics.regressionPoly) -}; -const degreesOfFreedom = (method, order)=>method === 'poly' ? order : method === 'quad' ? 2 : 1; -/** - * Compute regression fits for one or more data groups. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {function(object): *} params.x - An accessor for the predictor data field. - * @param {function(object): *} params.y - An accessor for the predicted data field. - * @param {string} [params.method='linear'] - The regression method to apply. - * @param {Array<function(object): *>} [params.groupby] - An array of accessors to groupby. - * @param {Array<number>} [params.extent] - The domain extent over which to plot the regression line. - * @param {number} [params.order=3] - The polynomial order. Only applies to the 'poly' method. - */ function Regression(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Regression.Definition = { - 'type': 'Regression', - 'metadata': { - 'generates': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'groupby', - 'type': 'field', - 'array': true - }, - { - 'name': 'method', - 'type': 'string', - 'default': 'linear', - 'values': Object.keys(Methods) - }, - { - 'name': 'order', - 'type': 'number', - 'default': 3 - }, - { - 'name': 'extent', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'params', - 'type': 'boolean', - 'default': false - }, - { - 'name': 'as', - 'type': 'string', - 'array': true - } - ] -}; -(0, _vegaUtil.inherits)(Regression, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); - if (!this.value || pulse.changed() || _.modified()) { - const source = pulse.materialize(pulse.SOURCE).source, groups = partition(source, _.groupby), names = (_.groupby || []).map((0, _vegaUtil.accessorName)), method = _.method || 'linear', order = _.order == null ? 3 : _.order, dof = degreesOfFreedom(method, order), as = _.as || [ - (0, _vegaUtil.accessorName)(_.x), - (0, _vegaUtil.accessorName)(_.y) - ], fit = Methods[method], values = []; - let domain = _.extent; - if (!(0, _vegaUtil.hasOwnProperty)(Methods, method)) (0, _vegaUtil.error)('Invalid regression method: ' + method); - if (domain != null) { - if (method === 'log' && domain[0] <= 0) { - pulse.dataflow.warn('Ignoring extent with values <= 0 for log regression.'); - domain = null; - } - } - groups.forEach((g)=>{ - const n = g.length; - if (n <= dof) { - pulse.dataflow.warn('Skipping regression with more parameters than data points.'); - return; + if (isIdentifierStart(source.charCodeAt(index))) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } + return { + type: TokenNumericLiteral, + value: parseFloat(number2), + start, + end: index + }; + } + function scanStringLiteral() { + var str = "", quote, start, ch2, code, octal = false; + quote = source[index]; + assert(quote === "'" || quote === '"', "String literal must starts with a quote"); + start = index; + ++index; + while (index < length$1) { + ch2 = source[index++]; + if (ch2 === quote) { + quote = ""; + break; + } else if (ch2 === "\\") { + ch2 = source[index++]; + if (!ch2 || !isLineTerminator(ch2.charCodeAt(0))) { + switch (ch2) { + case "u": + case "x": + if (source[index] === "{") { + ++index; + str += scanUnicodeCodePointEscape(); + } else { + str += scanHexEscape(ch2); + } + break; + case "n": + str += "\n"; + break; + case "r": + str += "\r"; + break; + case "t": + str += " "; + break; + case "b": + str += "\b"; + break; + case "f": + str += "\f"; + break; + case "v": + str += "\v"; + break; + default: + if (isOctalDigit(ch2)) { + code = "01234567".indexOf(ch2); + if (code !== 0) { + octal = true; } - const model = fit(g, _.x, _.y, order); - if (_.params) { - // if parameter vectors requested return those - values.push((0, _vegaDataflow.ingest)({ - keys: g.dims, - coef: model.coef, - rSquared: model.rSquared - })); - return; + if (index < length$1 && isOctalDigit(source[index])) { + octal = true; + code = code * 8 + "01234567".indexOf(source[index++]); + if ("0123".includes(ch2) && index < length$1 && isOctalDigit(source[index])) { + code = code * 8 + "01234567".indexOf(source[index++]); + } } - const dom = domain || (0, _vegaUtil.extent)(g, _.x), add = (p)=>{ - const t = {}; - for(let i = 0; i < names.length; ++i)t[names[i]] = g.dims[i]; - t[as[0]] = p[0]; - t[as[1]] = p[1]; - values.push((0, _vegaDataflow.ingest)(t)); - }; - if (method === 'linear' || method === 'constant') // for linear or constant regression we only need the end points - dom.forEach((x)=>add([ - x, - model.predict(x) - ])); - else // otherwise return trend line sample points - (0, _vegaStatistics.sampleCurve)(model.predict, dom, 25, 200).forEach(add); - }); - if (this.value) out.rem = this.value; - this.value = out.add = out.source = values; + str += String.fromCharCode(code); + } else { + str += ch2; + } + break; + } + } else { + if (ch2 === "\r" && source[index] === "\n") { + ++index; + } } - return out; - } -}); - -},{"vega-statistics":"5ncfv","vega-dataflow":"3NitK","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"96rkJ":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "voronoi", ()=>Voronoi); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _d3Delaunay = require("d3-delaunay"); -function Voronoi(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -Voronoi.Definition = { - 'type': 'Voronoi', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'x', - 'type': 'field', - 'required': true - }, - { - 'name': 'y', - 'type': 'field', - 'required': true - }, - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'extent', - 'type': 'array', - 'array': true, - 'length': 2, - 'default': [ - [ - -100000, - -100000 - ], - [ - 1e5, - 1e5 - ] - ], - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - }, - { - 'name': 'as', - 'type': 'string', - 'default': 'path' - } - ] -}; -const defaultExtent = [ - -100000, - -100000, - 1e5, - 1e5 -]; -(0, _vegaUtil.inherits)(Voronoi, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const as = _.as || 'path', data = pulse.source; - // nothing to do if no data - if (!data || !data.length) return pulse; - // configure and construct voronoi diagram - let s = _.size; - s = s ? [ - 0, - 0, - s[0], - s[1] - ] : (s = _.extent) ? [ - s[0][0], - s[0][1], - s[1][0], - s[1][1] - ] : defaultExtent; - const voronoi = this.value = (0, _d3Delaunay.Delaunay).from(data, _.x, _.y).voronoi(s); - // map polygons to paths - for(let i = 0, n = data.length; i < n; ++i){ - const polygon = voronoi.cellPolygon(i); - data[i][as] = polygon && !isPoint(polygon) ? toPathString(polygon) : null; - } - return pulse.reflow(_.modified()).modifies(as); - } -}); -// suppress duplicated end point vertices -function toPathString(p) { - const x = p[0][0], y = p[0][1]; - let n = p.length - 1; - for(; p[n][0] === x && p[n][1] === y; --n); - return 'M' + p.slice(0, n + 1).join('L') + 'Z'; -} -function isPoint(p) { - return p.length === 2 && p[0][0] === p[1][0] && p[0][1] === p[1][1]; -} - -},{"vega-dataflow":"3NitK","vega-util":"bApja","d3-delaunay":"9qKHu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9qKHu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Delaunay", ()=>(0, _delaunayJsDefault.default)); -parcelHelpers.export(exports, "Voronoi", ()=>(0, _voronoiJsDefault.default)); -var _delaunayJs = require("./delaunay.js"); -var _delaunayJsDefault = parcelHelpers.interopDefault(_delaunayJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); - -},{"./delaunay.js":"1eiyj","./voronoi.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1eiyj":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _delaunator = require("delaunator"); -var _delaunatorDefault = parcelHelpers.interopDefault(_delaunator); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -var _voronoiJs = require("./voronoi.js"); -var _voronoiJsDefault = parcelHelpers.interopDefault(_voronoiJs); -const tau = 2 * Math.PI, pow = Math.pow; -function pointX(p) { - return p[0]; -} -function pointY(p) { - return p[1]; -} -// A triangulation is collinear if all its triangles have a non-null area -function collinear(d) { - const { triangles, coords } = d; - for(let i = 0; i < triangles.length; i += 3){ - const a = 2 * triangles[i], b = 2 * triangles[i + 1], c = 2 * triangles[i + 2], cross = (coords[c] - coords[a]) * (coords[b + 1] - coords[a + 1]) - (coords[b] - coords[a]) * (coords[c + 1] - coords[a + 1]); - if (cross > 1e-10) return false; - } - return true; -} -function jitter(x, y, r) { - return [ - x + Math.sin(x + y) * r, - y + Math.cos(x - y) * r - ]; -} -class Delaunay { - static from(points, fx = pointX, fy = pointY, that) { - return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); - } - constructor(points){ - this._delaunator = new (0, _delaunatorDefault.default)(points); - this.inedges = new Int32Array(points.length / 2); - this._hullIndex = new Int32Array(points.length / 2); - this.points = this._delaunator.coords; - this._init(); + } else if (isLineTerminator(ch2.charCodeAt(0))) { + break; + } else { + str += ch2; + } } - update() { - this._delaunator.update(); - this._init(); - return this; + if (quote !== "") { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); } - _init() { - const d = this._delaunator, points = this.points; - // check for collinear - if (d.hull && d.hull.length > 2 && collinear(d)) { - this.collinear = Int32Array.from({ - length: points.length / 2 - }, (_, i)=>i).sort((i, j)=>points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors - const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds = [ - points[2 * e], - points[2 * e + 1], - points[2 * f], - points[2 * f + 1] - ], r = 1e-8 * Math.hypot(bounds[3] - bounds[1], bounds[2] - bounds[0]); - for(let i = 0, n = points.length / 2; i < n; ++i){ - const p = jitter(points[2 * i], points[2 * i + 1], r); - points[2 * i] = p[0]; - points[2 * i + 1] = p[1]; - } - this._delaunator = new (0, _delaunatorDefault.default)(points); - } else delete this.collinear; - const halfedges = this.halfedges = this._delaunator.halfedges; - const hull = this.hull = this._delaunator.hull; - const triangles = this.triangles = this._delaunator.triangles; - const inedges = this.inedges.fill(-1); - const hullIndex = this._hullIndex.fill(-1); - // Compute an index from each point to an (arbitrary) incoming halfedge - // Used to give the first neighbor of each point; for this reason, - // on the hull we give priority to exterior halfedges - for(let e = 0, n = halfedges.length; e < n; ++e){ - const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; - if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; - } - for(let i = 0, n = hull.length; i < n; ++i)hullIndex[hull[i]] = i; - // degenerate case: 1 or 2 (distinct) points - if (hull.length <= 2 && hull.length > 0) { - this.triangles = new Int32Array(3).fill(-1); - this.halfedges = new Int32Array(3).fill(-1); - this.triangles[0] = hull[0]; - inedges[hull[0]] = 1; - if (hull.length === 2) { - inedges[hull[1]] = 0; - this.triangles[1] = hull[1]; - this.triangles[2] = hull[1]; - } + return { + type: TokenStringLiteral, + value: str, + octal, + start, + end: index + }; + } + function testRegExp(pattern, flags) { + let tmp = pattern; + if (flags.includes("u")) { + tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1) => { + if (parseInt($1, 16) <= 1114111) { + return "x"; } + throwError({}, MessageInvalidRegExp); + }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, "x"); } - voronoi(bounds) { - return new (0, _voronoiJsDefault.default)(this, bounds); + try { + new RegExp(tmp); + } catch (e) { + throwError({}, MessageInvalidRegExp); } - *neighbors(i) { - const { inedges, hull, _hullIndex, halfedges, triangles, collinear } = this; - // degenerate case with several collinear points - if (collinear) { - const l = collinear.indexOf(i); - if (l > 0) yield collinear[l - 1]; - if (l < collinear.length - 1) yield collinear[l + 1]; - return; + try { + return new RegExp(pattern, flags); + } catch (exception) { + return null; + } + } + function scanRegExpBody() { + var ch2, str, classMarker, terminated, body; + ch2 = source[index]; + assert(ch2 === "/", "Regular expression literal must start with a slash"); + str = source[index++]; + classMarker = false; + terminated = false; + while (index < length$1) { + ch2 = source[index++]; + str += ch2; + if (ch2 === "\\") { + ch2 = source[index++]; + if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } + str += ch2; + } else if (isLineTerminator(ch2.charCodeAt(0))) { + throwError({}, MessageUnterminatedRegExp); + } else if (classMarker) { + if (ch2 === "]") { + classMarker = false; + } + } else { + if (ch2 === "/") { + terminated = true; + break; + } else if (ch2 === "[") { + classMarker = true; } - const e0 = inedges[i]; - if (e0 === -1) return; // coincident point - let e = e0, p0 = -1; - do { - yield p0 = triangles[e]; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) return; // bad triangulation - e = halfedges[e]; - if (e === -1) { - const p = hull[(_hullIndex[i] + 1) % hull.length]; - if (p !== p0) yield p; - return; - } - }while (e !== e0); - } - find(x, y, i = 0) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return -1; - const i0 = i; - let c; - while((c = this._step(i, x, y)) >= 0 && c !== i && c !== i0)i = c; - return c; - } - _step(i, x, y) { - const { inedges, hull, _hullIndex, halfedges, triangles, points } = this; - if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); - let c = i; - let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2); - const e0 = inedges[i]; - let e = e0; - do { - let t = triangles[e]; - const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2); - if (dt < dc) dc = dt, c = t; - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - if (e === -1) { - e = hull[(_hullIndex[i] + 1) % hull.length]; - if (e !== t) { - if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e; - } - break; - } - }while (e !== e0); - return c; - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, halfedges, triangles } = this; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = triangles[i] * 2; - const tj = triangles[j] * 2; - context.moveTo(points[ti], points[ti + 1]); - context.lineTo(points[tj], points[tj + 1]); - } - this.renderHull(context); - return buffer && buffer.value(); - } - renderPoints(context, r) { - if (r === undefined && (!context || typeof context.moveTo !== "function")) r = context, context = null; - r = r == undefined ? 2 : +r; - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points } = this; - for(let i = 0, n = points.length; i < n; i += 2){ - const x = points[i], y = points[i + 1]; - context.moveTo(x + r, y); - context.arc(x, y, r, 0, tau); - } - return buffer && buffer.value(); - } - renderHull(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { hull, points } = this; - const h = hull[0] * 2, n = hull.length; - context.moveTo(points[h], points[h + 1]); - for(let i = 1; i < n; ++i){ - const h = 2 * hull[i]; - context.lineTo(points[h], points[h + 1]); - } - context.closePath(); - return buffer && buffer.value(); + } } - hullPolygon() { - const polygon = new (0, _polygonJsDefault.default); - this.renderHull(polygon); - return polygon.value(); - } - renderTriangle(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { points, triangles } = this; - const t0 = triangles[i *= 3] * 2; - const t1 = triangles[i + 1] * 2; - const t2 = triangles[i + 2] * 2; - context.moveTo(points[t0], points[t0 + 1]); - context.lineTo(points[t1], points[t1 + 1]); - context.lineTo(points[t2], points[t2 + 1]); - context.closePath(); - return buffer && buffer.value(); + if (!terminated) { + throwError({}, MessageUnterminatedRegExp); } - *trianglePolygons() { - const { triangles } = this; - for(let i = 0, n = triangles.length / 3; i < n; ++i)yield this.trianglePolygon(i); + body = str.substr(1, str.length - 2); + return { + value: body, + literal: str + }; + } + function scanRegExpFlags() { + var ch2, str, flags; + str = ""; + flags = ""; + while (index < length$1) { + ch2 = source[index]; + if (!isIdentifierPart(ch2.charCodeAt(0))) { + break; + } + ++index; + if (ch2 === "\\" && index < length$1) { + throwError({}, MessageUnexpectedToken, ILLEGAL$1); + } else { + flags += ch2; + str += ch2; + } } - trianglePolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderTriangle(i, polygon); - return polygon.value(); - } -} -exports.default = Delaunay; -function flatArray(points, fx, fy, that) { - const n = points.length; - const array = new Float64Array(n * 2); - for(let i = 0; i < n; ++i){ - const p = points[i]; - array[i * 2] = fx.call(that, p, i, points); - array[i * 2 + 1] = fy.call(that, p, i, points); - } - return array; -} -function* flatIterable(points, fx, fy, that) { - let i = 0; - for (const p of points){ - yield fx.call(that, p, i, points); - yield fy.call(that, p, i, points); - ++i; + if (flags.search(/[^gimuy]/g) >= 0) { + throwError({}, MessageInvalidRegExp, flags); } -} - -},{"delaunator":"auyGo","./path.js":"60Yfe","./polygon.js":"5nsXD","./voronoi.js":"a33Bo","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"auyGo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _robustPredicates = require("robust-predicates"); -const EPSILON = Math.pow(2, -52); -const EDGE_STACK = new Uint32Array(512); -class Delaunator { - static from(points, getX = defaultGetX, getY = defaultGetY) { - const n = points.length; - const coords = new Float64Array(n * 2); - for(let i = 0; i < n; i++){ - const p = points[i]; - coords[2 * i] = getX(p); - coords[2 * i + 1] = getY(p); - } - return new Delaunator(coords); - } - constructor(coords){ - const n = coords.length >> 1; - if (n > 0 && typeof coords[0] !== 'number') throw new Error('Expected coords to contain numbers.'); - this.coords = coords; - // arrays that will store the triangulation graph - const maxTriangles = Math.max(2 * n - 5, 0); - this._triangles = new Uint32Array(maxTriangles * 3); - this._halfedges = new Int32Array(maxTriangles * 3); - // temporary arrays for tracking the edges of the advancing convex hull - this._hashSize = Math.ceil(Math.sqrt(n)); - this._hullPrev = new Uint32Array(n); // edge to prev edge - this._hullNext = new Uint32Array(n); // edge to next edge - this._hullTri = new Uint32Array(n); // edge to adjacent triangle - this._hullHash = new Int32Array(this._hashSize); // angular edge hash - // temporary arrays for sorting points - this._ids = new Uint32Array(n); - this._dists = new Float64Array(n); - this.update(); + return { + value: flags, + literal: str + }; + } + function scanRegExp() { + var start, body, flags, value2; + lookahead = null; + skipComment(); + start = index; + body = scanRegExpBody(); + flags = scanRegExpFlags(); + value2 = testRegExp(body.value, flags.value); + return { + literal: body.literal + flags.literal, + value: value2, + regex: { + pattern: body.value, + flags: flags.value + }, + start, + end: index + }; + } + function isIdentifierName(token) { + return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; + } + function advance() { + skipComment(); + if (index >= length$1) { + return { + type: TokenEOF, + start: index, + end: index + }; } - update() { - const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; - const n = coords.length >> 1; - // populate an array of point indices; calculate input data bbox - let minX = Infinity; - let minY = Infinity; - let maxX = -Infinity; - let maxY = -Infinity; - for(let i = 0; i < n; i++){ - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - this._ids[i] = i; - } - const cx = (minX + maxX) / 2; - const cy = (minY + maxY) / 2; - let i0, i1, i2; - // pick a seed point close to the center - for(let i = 0, minDist = Infinity; i < n; i++){ - const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); - if (d < minDist) { - i0 = i; - minDist = d; - } - } - const i0x = coords[2 * i0]; - const i0y = coords[2 * i0 + 1]; - // find the point closest to the seed - for(let i = 0, minDist = Infinity; i < n; i++){ - if (i === i0) continue; - const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); - if (d < minDist && d > 0) { - i1 = i; - minDist = d; - } - } - let i1x = coords[2 * i1]; - let i1y = coords[2 * i1 + 1]; - let minRadius = Infinity; - // find the third point which forms the smallest circumcircle with the first two - for(let i = 0; i < n; i++){ - if (i === i0 || i === i1) continue; - const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); - if (r < minRadius) { - i2 = i; - minRadius = r; - } - } - let i2x = coords[2 * i2]; - let i2y = coords[2 * i2 + 1]; - if (minRadius === Infinity) { - // order collinear points by dx (or dy if all x are identical) - // and return the list as a hull - for(let i = 0; i < n; i++)this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; - quicksort(this._ids, this._dists, 0, n - 1); - const hull = new Uint32Array(n); - let j = 0; - for(let i = 0, d0 = -Infinity; i < n; i++){ - const id = this._ids[i]; - const d = this._dists[id]; - if (d > d0) { - hull[j++] = id; - d0 = d; - } - } - this.hull = hull.subarray(0, j); - this.triangles = new Uint32Array(0); - this.halfedges = new Uint32Array(0); - return; - } - // swap the order of the seed points for counter-clockwise orientation - if ((0, _robustPredicates.orient2d)(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { - const i = i1; - const x = i1x; - const y = i1y; - i1 = i2; - i1x = i2x; - i1y = i2y; - i2 = i; - i2x = x; - i2y = y; - } - const center = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); - this._cx = center.x; - this._cy = center.y; - for(let i = 0; i < n; i++)this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center.x, center.y); - // sort the points by distance from the seed triangle circumcenter - quicksort(this._ids, this._dists, 0, n - 1); - // set up the seed triangle as the starting hull - this._hullStart = i0; - let hullSize = 3; - hullNext[i0] = hullPrev[i2] = i1; - hullNext[i1] = hullPrev[i0] = i2; - hullNext[i2] = hullPrev[i1] = i0; - hullTri[i0] = 0; - hullTri[i1] = 1; - hullTri[i2] = 2; - hullHash.fill(-1); - hullHash[this._hashKey(i0x, i0y)] = i0; - hullHash[this._hashKey(i1x, i1y)] = i1; - hullHash[this._hashKey(i2x, i2y)] = i2; - this.trianglesLen = 0; - this._addTriangle(i0, i1, i2, -1, -1, -1); - for(let k = 0, xp, yp; k < this._ids.length; k++){ - const i = this._ids[k]; - const x = coords[2 * i]; - const y = coords[2 * i + 1]; - // skip near-duplicate points - if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue; - xp = x; - yp = y; - // skip seed triangle points - if (i === i0 || i === i1 || i === i2) continue; - // find a visible edge on the convex hull using edge hash - let start = 0; - for(let j = 0, key = this._hashKey(x, y); j < this._hashSize; j++){ - start = hullHash[(key + j) % this._hashSize]; - if (start !== -1 && start !== hullNext[start]) break; - } - start = hullPrev[start]; - let e = start, q; - while(q = hullNext[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0){ - e = q; - if (e === start) { - e = -1; - break; - } - } - if (e === -1) continue; // likely a near-duplicate point; skip it - // add the first triangle from the point - let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); - // recursively flip triangles from the point until they satisfy the Delaunay condition - hullTri[i] = this._legalize(t + 2); - hullTri[e] = t; // keep track of boundary triangles on the hull - hullSize++; - // walk forward through the hull, adding more triangles and flipping recursively - let n = hullNext[e]; - while(q = hullNext[n], (0, _robustPredicates.orient2d)(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0){ - t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]); - hullTri[i] = this._legalize(t + 2); - hullNext[n] = n; // mark as removed - hullSize--; - n = q; - } - // walk backward from the other side, adding more triangles and flipping - if (e === start) while(q = hullPrev[e], (0, _robustPredicates.orient2d)(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0){ - t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); - this._legalize(t + 2); - hullTri[q] = t; - hullNext[e] = e; // mark as removed - hullSize--; - e = q; - } - // update the hull indices - this._hullStart = hullPrev[i] = e; - hullNext[e] = hullPrev[n] = i; - hullNext[i] = n; - // save the two new edges in the hash table - hullHash[this._hashKey(x, y)] = i; - hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; - } - this.hull = new Uint32Array(hullSize); - for(let i = 0, e = this._hullStart; i < hullSize; i++){ - this.hull[i] = e; - e = hullNext[e]; - } - // trim typed triangle mesh arrays - this.triangles = this._triangles.subarray(0, this.trianglesLen); - this.halfedges = this._halfedges.subarray(0, this.trianglesLen); - } - _hashKey(x, y) { - return Math.floor(pseudoAngle(x - this._cx, y - this._cy) * this._hashSize) % this._hashSize; - } - _legalize(a) { - const { _triangles: triangles, _halfedges: halfedges, coords } = this; - let i = 0; - let ar = 0; - // recursion eliminated with a fixed-size stack - while(true){ - const b = halfedges[a]; - /* if the pair of triangles doesn't satisfy the Delaunay condition - * (p1 is inside the circumcircle of [p0, pl, pr]), flip them, - * then do the same check/flip recursively for the new pair of triangles - * - * pl pl - * /||\ / \ - * al/ || \bl al/ \a - * / || \ / \ - * / a||b \ flip /___ar___\ - * p0\ || /p1 => p0\---bl---/p1 - * \ || / \ / - * ar\ || /br b\ /br - * \||/ \ / - * pr pr - */ const a0 = a - a % 3; - ar = a0 + (a + 2) % 3; - if (b === -1) { - if (i === 0) break; - a = EDGE_STACK[--i]; - continue; - } - const b0 = b - b % 3; - const al = a0 + (a + 1) % 3; - const bl = b0 + (b + 2) % 3; - const p0 = triangles[ar]; - const pr = triangles[a]; - const pl = triangles[al]; - const p1 = triangles[bl]; - const illegal = inCircle(coords[2 * p0], coords[2 * p0 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1]); - if (illegal) { - triangles[a] = p1; - triangles[b] = p0; - const hbl = halfedges[bl]; - // edge swapped on the other side of the hull (rare); fix the halfedge reference - if (hbl === -1) { - let e = this._hullStart; - do { - if (this._hullTri[e] === bl) { - this._hullTri[e] = a; - break; - } - e = this._hullPrev[e]; - }while (e !== this._hullStart); - } - this._link(a, hbl); - this._link(b, halfedges[ar]); - this._link(ar, bl); - const br = b0 + (b + 1) % 3; - // don't worry about hitting the cap: it can only happen on extremely degenerate input - if (i < EDGE_STACK.length) EDGE_STACK[i++] = br; - } else { - if (i === 0) break; - a = EDGE_STACK[--i]; - } - } - return ar; + const ch2 = source.charCodeAt(index); + if (isIdentifierStart(ch2)) { + return scanIdentifier(); } - _link(a, b) { - this._halfedges[a] = b; - if (b !== -1) this._halfedges[b] = a; + if (ch2 === 40 || ch2 === 41 || ch2 === 59) { + return scanPunctuator(); } - // add a new triangle given vertex indices and adjacent half-edge ids - _addTriangle(i0, i1, i2, a, b, c) { - const t = this.trianglesLen; - this._triangles[t] = i0; - this._triangles[t + 1] = i1; - this._triangles[t + 2] = i2; - this._link(t, a); - this._link(t + 1, b); - this._link(t + 2, c); - this.trianglesLen += 3; - return t; + if (ch2 === 39 || ch2 === 34) { + return scanStringLiteral(); } -} -exports.default = Delaunator; -// monotonically increases with real angle, but doesn't need expensive trigonometry -function pseudoAngle(dx, dy) { - const p = dx / (Math.abs(dx) + Math.abs(dy)); - return (dy > 0 ? 3 - p : 1 + p) / 4; // [0..1] -} -function dist(ax, ay, bx, by) { - const dx = ax - bx; - const dy = ay - by; - return dx * dx + dy * dy; -} -function inCircle(ax, ay, bx, by, cx, cy, px, py) { - const dx = ax - px; - const dy = ay - py; - const ex = bx - px; - const ey = by - py; - const fx = cx - px; - const fy = cy - py; - const ap = dx * dx + dy * dy; - const bp = ex * ex + ey * ey; - const cp = fx * fx + fy * fy; - return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; -} -function circumradius(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = (ey * bl - dy * cl) * d; - const y = (dx * cl - ex * bl) * d; - return x * x + y * y; -} -function circumcenter(ax, ay, bx, by, cx, cy) { - const dx = bx - ax; - const dy = by - ay; - const ex = cx - ax; - const ey = cy - ay; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - const d = 0.5 / (dx * ey - dy * ex); - const x = ax + (ey * bl - dy * cl) * d; - const y = ay + (dx * cl - ex * bl) * d; - return { - x, - y - }; -} -function quicksort(ids, dists, left, right) { - if (right - left <= 20) for(let i = left + 1; i <= right; i++){ - const temp = ids[i]; - const tempDist = dists[temp]; - let j = i - 1; - while(j >= left && dists[ids[j]] > tempDist)ids[j + 1] = ids[j--]; - ids[j + 1] = temp; + if (ch2 === 46) { + if (isDecimalDigit(source.charCodeAt(index + 1))) { + return scanNumericLiteral(); + } + return scanPunctuator(); } - else { - const median = left + right >> 1; - let i = left + 1; - let j = right; - swap(ids, median, i); - if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right); - if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right); - if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i); - const temp = ids[i]; - const tempDist = dists[temp]; - while(true){ - do i++; - while (dists[ids[i]] < tempDist); - do j--; - while (dists[ids[j]] > tempDist); - if (j < i) break; - swap(ids, i, j); - } - ids[left + 1] = ids[j]; - ids[j] = temp; - if (right - i + 1 >= j - left) { - quicksort(ids, dists, i, right); - quicksort(ids, dists, left, j - 1); - } else { - quicksort(ids, dists, left, j - 1); - quicksort(ids, dists, i, right); - } + if (isDecimalDigit(ch2)) { + return scanNumericLiteral(); } -} -function swap(arr, i, j) { - const tmp = arr[i]; - arr[i] = arr[j]; - arr[j] = tmp; -} -function defaultGetX(p) { - return p[0]; -} -function defaultGetY(p) { - return p[1]; -} - -},{"robust-predicates":"KLZHK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"KLZHK":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>(0, _orient2DJs.orient2d)); -parcelHelpers.export(exports, "orient2dfast", ()=>(0, _orient2DJs.orient2dfast)); -parcelHelpers.export(exports, "orient3d", ()=>(0, _orient3DJs.orient3d)); -parcelHelpers.export(exports, "orient3dfast", ()=>(0, _orient3DJs.orient3dfast)); -parcelHelpers.export(exports, "incircle", ()=>(0, _incircleJs.incircle)); -parcelHelpers.export(exports, "incirclefast", ()=>(0, _incircleJs.incirclefast)); -parcelHelpers.export(exports, "insphere", ()=>(0, _insphereJs.insphere)); -parcelHelpers.export(exports, "inspherefast", ()=>(0, _insphereJs.inspherefast)); -var _orient2DJs = require("./esm/orient2d.js"); -var _orient3DJs = require("./esm/orient3d.js"); -var _incircleJs = require("./esm/incircle.js"); -var _insphereJs = require("./esm/insphere.js"); - -},{"./esm/orient2d.js":"9dV6v","./esm/orient3d.js":"60Ijp","./esm/incircle.js":"eSgV9","./esm/insphere.js":"lKwEh","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9dV6v":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient2d", ()=>orient2d); -parcelHelpers.export(exports, "orient2dfast", ()=>orient2dfast); -var _utilJs = require("./util.js"); -const ccwerrboundA = (3 + 16 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundB = (2 + 12 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const ccwerrboundC = (9 + 64 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const B = (0, _utilJs.vec)(4); -const C1 = (0, _utilJs.vec)(8); -const C2 = (0, _utilJs.vec)(12); -const D = (0, _utilJs.vec)(16); -const u = (0, _utilJs.vec)(4); -function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { - let acxtail, acytail, bcxtail, bcytail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const acx = ax - cx; - const bcx = bx - cx; - const acy = ay - cy; - const bcy = by - cy; - s1 = acx * bcy; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcx; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - B[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - B[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - B[2] = _j - (u3 - bvirt) + (_i - bvirt); - B[3] = u3; - let det = (0, _utilJs.estimate)(4, B); - let errbound = ccwerrboundB * detsum; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - acx; - acxtail = ax - (acx + bvirt) + (bvirt - cx); - bvirt = bx - bcx; - bcxtail = bx - (bcx + bvirt) + (bvirt - cx); - bvirt = ay - acy; - acytail = ay - (acy + bvirt) + (bvirt - cy); - bvirt = by - bcy; - bcytail = by - (bcy + bvirt) + (bvirt - cy); - if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) return det; - errbound = ccwerrboundC * detsum + (0, _utilJs.resulterrbound) * Math.abs(det); - det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); - if (det >= errbound || -det >= errbound) return det; - s1 = acxtail * bcy; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcy; - bhi = c - (c - bcy); - blo = bcy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcx; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcx; - bhi = c - (c - bcx); - blo = bcx - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C1len = (0, _utilJs.sum)(4, B, 4, u, C1); - s1 = acx * bcytail; - c = (0, _utilJs.splitter) * acx; - ahi = c - (c - acx); - alo = acx - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acy * bcxtail; - c = (0, _utilJs.splitter) * acy; - ahi = c - (c - acy); - alo = acy - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const C2len = (0, _utilJs.sum)(C1len, C1, 4, u, C2); - s1 = acxtail * bcytail; - c = (0, _utilJs.splitter) * acxtail; - ahi = c - (c - acxtail); - alo = acxtail - ahi; - c = (0, _utilJs.splitter) * bcytail; - bhi = c - (c - bcytail); - blo = bcytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = acytail * bcxtail; - c = (0, _utilJs.splitter) * acytail; - ahi = c - (c - acytail); - alo = acytail - ahi; - c = (0, _utilJs.splitter) * bcxtail; - bhi = c - (c - bcxtail); - blo = bcxtail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - u[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - u[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - const Dlen = (0, _utilJs.sum)(C2len, C2, 4, u, D); - return D[Dlen - 1]; -} -function orient2d(ax, ay, bx, by, cx, cy) { - const detleft = (ay - cy) * (bx - cx); - const detright = (ax - cx) * (by - cy); - const det = detleft - detright; - const detsum = Math.abs(detleft + detright); - if (Math.abs(det) >= ccwerrboundA * detsum) return det; - return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); -} -function orient2dfast(ax, ay, bx, by, cx, cy) { - return (ay - cy) * (bx - cx) - (ax - cx) * (by - cy); -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3WWl7":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "epsilon", ()=>epsilon); -parcelHelpers.export(exports, "splitter", ()=>splitter); -parcelHelpers.export(exports, "resulterrbound", ()=>resulterrbound); -// fast_expansion_sum_zeroelim routine from oritinal code -parcelHelpers.export(exports, "sum", ()=>sum); -parcelHelpers.export(exports, "sum_three", ()=>sum_three); -// scale_expansion_zeroelim routine from oritinal code -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "negate", ()=>negate); -parcelHelpers.export(exports, "estimate", ()=>estimate); -parcelHelpers.export(exports, "vec", ()=>vec); -const epsilon = 1.1102230246251565e-16; -const splitter = 134217729; -const resulterrbound = (3 + 8 * epsilon) * epsilon; -function sum(elen, e, flen, f, h) { - let Q, Qnew, hh, bvirt; - let enow = e[0]; - let fnow = f[0]; - let eindex = 0; - let findex = 0; - if (fnow > enow === fnow > -enow) { - Q = enow; - enow = e[++eindex]; - } else { - Q = fnow; - fnow = f[++findex]; + return scanPunctuator(); + } + function lex() { + const token = lookahead; + index = token.end; + lookahead = advance(); + index = token.end; + return token; + } + function peek() { + const pos = index; + lookahead = advance(); + index = pos; + } + function finishArrayExpression(elements) { + const node = new ASTNode(SyntaxArrayExpression); + node.elements = elements; + return node; + } + function finishBinaryExpression(operator2, left, right) { + const node = new ASTNode(operator2 === "||" || operator2 === "&&" ? SyntaxLogicalExpression : SyntaxBinaryExpression); + node.operator = operator2; + node.left = left; + node.right = right; + return node; + } + function finishCallExpression(callee, args) { + const node = new ASTNode(SyntaxCallExpression); + node.callee = callee; + node.arguments = args; + return node; + } + function finishConditionalExpression(test2, consequent, alternate) { + const node = new ASTNode(SyntaxConditionalExpression); + node.test = test2; + node.consequent = consequent; + node.alternate = alternate; + return node; + } + function finishIdentifier(name) { + const node = new ASTNode(SyntaxIdentifier); + node.name = name; + return node; + } + function finishLiteral(token) { + const node = new ASTNode(SyntaxLiteral); + node.value = token.value; + node.raw = source.slice(token.start, token.end); + if (token.regex) { + if (node.raw === "//") { + node.raw = "/(?:)/"; + } + node.regex = token.regex; + } + return node; + } + function finishMemberExpression(accessor2, object2, property2) { + const node = new ASTNode(SyntaxMemberExpression); + node.computed = accessor2 === "["; + node.object = object2; + node.property = property2; + if (!node.computed) property2.member = true; + return node; + } + function finishObjectExpression(properties) { + const node = new ASTNode(SyntaxObjectExpression); + node.properties = properties; + return node; + } + function finishProperty(kind, key2, value2) { + const node = new ASTNode(SyntaxProperty); + node.key = key2; + node.value = value2; + node.kind = kind; + return node; + } + function finishUnaryExpression(operator2, argument) { + const node = new ASTNode(SyntaxUnaryExpression); + node.operator = operator2; + node.argument = argument; + node.prefix = true; + return node; + } + function throwError(token, messageFormat) { + var error2, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index2) => { + assert(index2 < args.length, "Message reference must be in range"); + return args[index2]; + }); + error2 = new Error(msg); + error2.index = index; + error2.description = msg; + throw error2; + } + function throwUnexpected(token) { + if (token.type === TokenEOF) { + throwError(token, MessageUnexpectedEOS); } - let hindex = 0; - if (eindex < elen && findex < flen) { - if (fnow > enow === fnow > -enow) { - Qnew = enow + Q; - hh = Q - (Qnew - enow); - enow = e[++eindex]; - } else { - Qnew = fnow + Q; - hh = Q - (Qnew - fnow); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; - while(eindex < elen && findex < flen){ - if (fnow > enow === fnow > -enow) { - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - } else { - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - } - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; - } + if (token.type === TokenNumericLiteral) { + throwError(token, MessageUnexpectedNumber); } - while(eindex < elen){ - Qnew = Q + enow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (enow - bvirt); - enow = e[++eindex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + if (token.type === TokenStringLiteral) { + throwError(token, MessageUnexpectedString); } - while(findex < flen){ - Qnew = Q + fnow; - bvirt = Qnew - Q; - hh = Q - (Qnew - bvirt) + (fnow - bvirt); - fnow = f[++findex]; - Q = Qnew; - if (hh !== 0) h[hindex++] = hh; + if (token.type === TokenIdentifier) { + throwError(token, MessageUnexpectedIdentifier); } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function sum_three(alen, a, blen, b, clen, c, tmp, out) { - return sum(sum(alen, a, blen, b, tmp), tmp, clen, c, out); -} -function scale(elen, e, b, h) { - let Q, sum, hh, product1, product0; - let bvirt, c, ahi, alo, bhi, blo; - c = splitter * b; - bhi = c - (c - b); - blo = b - bhi; - let enow = e[0]; - Q = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - hh = alo * blo - (Q - ahi * bhi - alo * bhi - ahi * blo); - let hindex = 0; - if (hh !== 0) h[hindex++] = hh; - for(let i = 1; i < elen; i++){ - enow = e[i]; - product1 = enow * b; - c = splitter * enow; - ahi = c - (c - enow); - alo = enow - ahi; - product0 = alo * blo - (product1 - ahi * bhi - alo * bhi - ahi * blo); - sum = Q + product0; - bvirt = sum - Q; - hh = Q - (sum - bvirt) + (product0 - bvirt); - if (hh !== 0) h[hindex++] = hh; - Q = product1 + sum; - hh = sum - (Q - product1); - if (hh !== 0) h[hindex++] = hh; - } - if (Q !== 0 || hindex === 0) h[hindex++] = Q; - return hindex; -} -function negate(elen, e) { - for(let i = 0; i < elen; i++)e[i] = -e[i]; - return elen; -} -function estimate(elen, e) { - let Q = e[0]; - for(let i = 1; i < elen; i++)Q += e[i]; - return Q; -} -function vec(n) { - return new Float64Array(n); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60Ijp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "orient3d", ()=>orient3d); -parcelHelpers.export(exports, "orient3dfast", ()=>orient3dfast); -var _utilJs = require("./util.js"); -const o3derrboundA = (7 + 56 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundB = (3 + 28 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const o3derrboundC = (26 + 288 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const at_b = (0, _utilJs.vec)(4); -const at_c = (0, _utilJs.vec)(4); -const bt_c = (0, _utilJs.vec)(4); -const bt_a = (0, _utilJs.vec)(4); -const ct_a = (0, _utilJs.vec)(4); -const ct_b = (0, _utilJs.vec)(4); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const u = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(8); -const _12 = (0, _utilJs.vec)(12); -let fin = (0, _utilJs.vec)(192); -let fin2 = (0, _utilJs.vec)(192); -function finadd(finlen, alen, a) { - finlen = (0, _utilJs.sum)(finlen, fin, alen, a, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function tailinit(xtail, ytail, ax, ay, bx, by, a, b) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3, negate; - if (xtail === 0) { - if (ytail === 0) { - a[0] = 0; - b[0] = 0; - return 1; - } else { - negate = -ytail; - s1 = negate * ax; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } - } else if (ytail === 0) { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - a[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - a[1] = s1; - negate = -xtail; - s1 = negate * by; - c = (0, _utilJs.splitter) * negate; - ahi = c - (c - negate); - alo = negate - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - b[0] = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - b[1] = s1; - return 2; - } else { - s1 = xtail * ay; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ytail * ax; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * ax; - bhi = c - (c - ax); - blo = ax - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - a[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - a[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - a[2] = _j - (u3 - bvirt) + (_i - bvirt); - a[3] = u3; - s1 = ytail * bx; - c = (0, _utilJs.splitter) * ytail; - ahi = c - (c - ytail); - alo = ytail - ahi; - c = (0, _utilJs.splitter) * bx; - bhi = c - (c - bx); - blo = bx - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = xtail * by; - c = (0, _utilJs.splitter) * xtail; - ahi = c - (c - xtail); - alo = xtail - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - b[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - b[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - b[2] = _j - (u3 - bvirt) + (_i - bvirt); - b[3] = u3; - return 4; - } -} -function tailadd(finlen, a, b, k, z) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, u3; - s1 = a * b; - c = (0, _utilJs.splitter) * a; - ahi = c - (c - a); - alo = a - ahi; - c = (0, _utilJs.splitter) * b; - bhi = c - (c - b); - blo = b - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - c = (0, _utilJs.splitter) * k; - bhi = c - (c - k); - blo = k - bhi; - _i = s0 * k; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * k; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - if (z !== 0) { - c = (0, _utilJs.splitter) * z; - bhi = c - (c - z); - blo = z - bhi; - _i = s0 * z; - c = (0, _utilJs.splitter) * s0; - ahi = c - (c - s0); - alo = s0 - ahi; - u[0] = alo * blo - (_i - ahi * bhi - alo * bhi - ahi * blo); - _j = s1 * z; - c = (0, _utilJs.splitter) * s1; - ahi = c - (c - s1); - alo = s1 - ahi; - _0 = alo * blo - (_j - ahi * bhi - alo * bhi - ahi * blo); - _k = _i + _0; - bvirt = _k - _i; - u[1] = _i - (_k - bvirt) + (_0 - bvirt); - u3 = _j + _k; - u[2] = _k - (u3 - _j); - u[3] = u3; - finlen = finadd(finlen, 4, u); - } - return finlen; -} -function orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail; - let adytail, bdytail, cdytail; - let adztail, bdztail, cdztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _k, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)(4, bc, adz, _8), _8, (0, _utilJs.scale)(4, ca, bdz, _8b), _8b, _16), _16, (0, _utilJs.scale)(4, ab, cdz, _8), _8, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = o3derrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - bvirt = az - adz; - adztail = az - (adz + bvirt) + (bvirt - dz); - bvirt = bz - bdz; - bdztail = bz - (bdz + bvirt) + (bvirt - dz); - bvirt = cz - cdz; - cdztail = cz - (cdz + bvirt) + (bvirt - dz); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0 && adztail === 0 && bdztail === 0 && cdztail === 0) return det; - errbound = o3derrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += adz * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + adztail * (bdx * cdy - bdy * cdx) + bdz * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + bdztail * (cdx * ady - cdy * adx) + cdz * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + cdztail * (adx * bdy - ady * bdx); - if (det >= errbound || -det >= errbound) return det; - const at_len = tailinit(adxtail, adytail, bdx, bdy, cdx, cdy, at_b, at_c); - const bt_len = tailinit(bdxtail, bdytail, cdx, cdy, adx, ady, bt_c, bt_a); - const ct_len = tailinit(cdxtail, cdytail, adx, ady, bdx, bdy, ct_a, ct_b); - const bctlen = (0, _utilJs.sum)(bt_len, bt_c, ct_len, ct_b, bct); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adz, _16), _16); - const catlen = (0, _utilJs.sum)(ct_len, ct_a, at_len, at_c, cat); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdz, _16), _16); - const abtlen = (0, _utilJs.sum)(at_len, at_b, bt_len, bt_a, abt); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdz, _16), _16); - if (adztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, bc, adztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(bctlen, bct, adztail, _16), _16); - } - if (bdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ca, bdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(catlen, cat, bdztail, _16), _16); - } - if (cdztail !== 0) { - finlen = finadd(finlen, (0, _utilJs.scale)(4, ab, cdztail, _12), _12); - finlen = finadd(finlen, (0, _utilJs.scale)(abtlen, abt, cdztail, _16), _16); - } - if (adxtail !== 0) { - if (bdytail !== 0) finlen = tailadd(finlen, adxtail, bdytail, cdz, cdztail); - if (cdytail !== 0) finlen = tailadd(finlen, -adxtail, cdytail, bdz, bdztail); - } - if (bdxtail !== 0) { - if (cdytail !== 0) finlen = tailadd(finlen, bdxtail, cdytail, adz, adztail); - if (adytail !== 0) finlen = tailadd(finlen, -bdxtail, adytail, cdz, cdztail); - } - if (cdxtail !== 0) { - if (adytail !== 0) finlen = tailadd(finlen, cdxtail, adytail, bdz, bdztail); - if (bdytail !== 0) finlen = tailadd(finlen, -cdxtail, bdytail, adz, adztail); - } - return fin[finlen - 1]; -} -function orient3d(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const det = adz * (bdxcdy - cdxbdy) + bdz * (cdxady - adxcdy) + cdz * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * Math.abs(adz) + (Math.abs(cdxady) + Math.abs(adxcdy)) * Math.abs(bdz) + (Math.abs(adxbdy) + Math.abs(bdxady)) * Math.abs(cdz); - const errbound = o3derrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return orient3dadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, permanent); -} -function orient3dfast(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const adz = az - dz; - const bdz = bz - dz; - const cdz = cz - dz; - return adx * (bdy * cdz - bdz * cdy) + bdx * (cdy * adz - cdz * ady) + cdx * (ady * bdz - adz * bdy); -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eSgV9":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "incircle", ()=>incircle); -parcelHelpers.export(exports, "incirclefast", ()=>incirclefast); -var _utilJs = require("./util.js"); -const iccerrboundA = (10 + 96 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundB = (4 + 48 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const iccerrboundC = (44 + 576 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const bc = (0, _utilJs.vec)(4); -const ca = (0, _utilJs.vec)(4); -const ab = (0, _utilJs.vec)(4); -const aa = (0, _utilJs.vec)(4); -const bb = (0, _utilJs.vec)(4); -const cc = (0, _utilJs.vec)(4); -const u = (0, _utilJs.vec)(4); -const v = (0, _utilJs.vec)(4); -const axtbc = (0, _utilJs.vec)(8); -const aytbc = (0, _utilJs.vec)(8); -const bxtca = (0, _utilJs.vec)(8); -const bytca = (0, _utilJs.vec)(8); -const cxtab = (0, _utilJs.vec)(8); -const cytab = (0, _utilJs.vec)(8); -const abt = (0, _utilJs.vec)(8); -const bct = (0, _utilJs.vec)(8); -const cat = (0, _utilJs.vec)(8); -const abtt = (0, _utilJs.vec)(4); -const bctt = (0, _utilJs.vec)(4); -const catt = (0, _utilJs.vec)(4); -const _8 = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _16b = (0, _utilJs.vec)(16); -const _16c = (0, _utilJs.vec)(16); -const _32 = (0, _utilJs.vec)(32); -const _32b = (0, _utilJs.vec)(32); -const _48 = (0, _utilJs.vec)(48); -const _64 = (0, _utilJs.vec)(64); -let fin = (0, _utilJs.vec)(1152); -let fin2 = (0, _utilJs.vec)(1152); -function finadd(finlen, a, alen) { - finlen = (0, _utilJs.sum)(finlen, fin, a, alen, fin2); - const tmp = fin; - fin = fin2; - fin2 = tmp; - return finlen; -} -function incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent) { - let finlen; - let adxtail, bdxtail, cdxtail, adytail, bdytail, cdytail; - let axtbclen, aytbclen, bxtcalen, bytcalen, cxtablen, cytablen; - let abtlen, bctlen, catlen; - let abttlen, bcttlen, cattlen; - let n1, n0; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - s1 = bdx * cdy; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * bdy; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cdx * ady; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * cdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ca[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ca[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ca[2] = _j - (u3 - bvirt) + (_i - bvirt); - ca[3] = u3; - s1 = adx * bdy; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * ady; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, bc, adx, _8), _8, adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bc, ady, _8), _8, ady, _16b), _16b, _32), _32, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdx, _8), _8, bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ca, bdy, _8), _8, bdy, _16b), _16b, _32b), _32b, _64), _64, (0, _utilJs.sum)((0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdx, _8), _8, cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, ab, cdy, _8), _8, cdy, _16b), _16b, _32), _32, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = iccerrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - adx; - adxtail = ax - (adx + bvirt) + (bvirt - dx); - bvirt = ay - ady; - adytail = ay - (ady + bvirt) + (bvirt - dy); - bvirt = bx - bdx; - bdxtail = bx - (bdx + bvirt) + (bvirt - dx); - bvirt = by - bdy; - bdytail = by - (bdy + bvirt) + (bvirt - dy); - bvirt = cx - cdx; - cdxtail = cx - (cdx + bvirt) + (bvirt - dx); - bvirt = cy - cdy; - cdytail = cy - (cdy + bvirt) + (bvirt - dy); - if (adxtail === 0 && bdxtail === 0 && cdxtail === 0 && adytail === 0 && bdytail === 0 && cdytail === 0) return det; - errbound = iccerrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - det += (adx * adx + ady * ady) * (bdx * cdytail + cdy * bdxtail - (bdy * cdxtail + cdx * bdytail)) + 2 * (adx * adxtail + ady * adytail) * (bdx * cdy - bdy * cdx) + ((bdx * bdx + bdy * bdy) * (cdx * adytail + ady * cdxtail - (cdy * adxtail + adx * cdytail)) + 2 * (bdx * bdxtail + bdy * bdytail) * (cdx * ady - cdy * adx)) + ((cdx * cdx + cdy * cdy) * (adx * bdytail + bdy * adxtail - (ady * bdxtail + bdx * adytail)) + 2 * (cdx * cdxtail + cdy * cdytail) * (adx * bdy - ady * bdx)); - if (det >= errbound || -det >= errbound) return det; - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = adx * adx; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = ady * ady; - c = (0, _utilJs.splitter) * ady; - ahi = c - (c - ady); - alo = ady - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - aa[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - aa[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - aa[2] = _j - (u3 - bvirt) + (_i - bvirt); - aa[3] = u3; - } - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = bdx * bdx; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = bdy * bdy; - c = (0, _utilJs.splitter) * bdy; - ahi = c - (c - bdy); - alo = bdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - bb[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - bb[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - bb[2] = _j - (u3 - bvirt) + (_i - bvirt); - bb[3] = u3; - } - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = cdx * cdx; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - s0 = alo * alo - (s1 - ahi * ahi - (ahi + ahi) * alo); - t1 = cdy * cdy; - c = (0, _utilJs.splitter) * cdy; - ahi = c - (c - cdy); - alo = cdy - ahi; - t0 = alo * alo - (t1 - ahi * ahi - (ahi + ahi) * alo); - _i = s0 + t0; - bvirt = _i - s0; - cc[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - cc[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - cc[2] = _j - (u3 - bvirt) + (_i - bvirt); - cc[3] = u3; - } - if (adxtail !== 0) { - axtbclen = (0, _utilJs.scale)(4, bc, adxtail, axtbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(axtbclen, axtbc, 2 * adx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adxtail, _8), _8, -cdy, _16c), _16c, _32, _48), _48); - } - if (adytail !== 0) { - aytbclen = (0, _utilJs.scale)(4, bc, adytail, aytbc); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(aytbclen, aytbc, 2 * ady, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, adytail, _8), _8, cdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adytail, _8), _8, -bdx, _16c), _16c, _32, _48), _48); - } - if (bdxtail !== 0) { - bxtcalen = (0, _utilJs.scale)(4, ca, bdxtail, bxtca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bxtcalen, bxtca, 2 * bdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdy, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdxtail, _8), _8, -ady, _16c), _16c, _32, _48), _48); - } - if (bdytail !== 0) { - bytcalen = (0, _utilJs.scale)(4, ca, bdytail, bytca); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(bytcalen, bytca, 2 * bdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, bdytail, _8), _8, adx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdytail, _8), _8, -cdx, _16c), _16c, _32, _48), _48); - } - if (cdxtail !== 0) { - cxtablen = (0, _utilJs.scale)(4, ab, cdxtail, cxtab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cxtablen, cxtab, 2 * cdx, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, ady, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdxtail, _8), _8, -bdy, _16c), _16c, _32, _48), _48); - } - if (cdytail !== 0) { - cytablen = (0, _utilJs.scale)(4, ab, cdytail, cytab); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(cytablen, cytab, 2 * cdy, _16), _16, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, cdytail, _8), _8, bdx, _16b), _16b, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdytail, _8), _8, -adx, _16c), _16c, _32, _48), _48); - } - if (adxtail !== 0 || adytail !== 0) { - if (bdxtail !== 0 || bdytail !== 0 || cdxtail !== 0 || cdytail !== 0) { - s1 = bdxtail * cdy; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdy; - bhi = c - (c - cdy); - blo = cdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * cdytail; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - s1 = cdxtail * -bdy; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * -bdy; - bhi = c - (c - -bdy); - blo = -bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * -bdytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * -bdytail; - bhi = c - (c - -bdytail); - blo = -bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - bctlen = (0, _utilJs.sum)(4, u, 4, v, bct); - s1 = bdxtail * cdytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdxtail * bdytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bctt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bctt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bctt[2] = _j - (u3 - bvirt) + (_i - bvirt); - bctt[3] = u3; - bcttlen = 4; - } else { - bct[0] = 0; - bctlen = 1; - bctt[0] = 0; - bcttlen = 1; - } - if (adxtail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(axtbclen, axtbc, adxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * adx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * adx, _16), _16, (0, _utilJs.scale)(len2, _8, adxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adxtail, _32), _32, _32b, _64), _64); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, adxtail, _8), _8, bdytail, _16), _16); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, -adxtail, _8), _8, cdytail, _16), _16); - } - if (adytail !== 0) { - const len = (0, _utilJs.scale)(bctlen, bct, adytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(aytbclen, aytbc, adytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * ady, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(bcttlen, bctt, adytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * ady, _16), _16, (0, _utilJs.scale)(len2, _8, adytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, adytail, _32), _32, _32b, _64), _64); - } - } - if (bdxtail !== 0 || bdytail !== 0) { - if (cdxtail !== 0 || cdytail !== 0 || adxtail !== 0 || adytail !== 0) { - s1 = cdxtail * ady; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * ady; - bhi = c - (c - ady); - blo = ady - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cdx * adytail; - c = (0, _utilJs.splitter) * cdx; - ahi = c - (c - cdx); - alo = cdx - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -cdy; - n0 = -cdytail; - s1 = adxtail * n1; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * n0; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - catlen = (0, _utilJs.sum)(4, u, 4, v, cat); - s1 = cdxtail * adytail; - c = (0, _utilJs.splitter) * cdxtail; - ahi = c - (c - cdxtail); - alo = cdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adxtail * cdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * cdytail; - bhi = c - (c - cdytail); - blo = cdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - catt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - catt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - catt[2] = _j - (u3 - bvirt) + (_i - bvirt); - catt[3] = u3; - cattlen = 4; - } else { - cat[0] = 0; - catlen = 1; - catt[0] = 0; - cattlen = 1; - } - if (bdxtail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bxtcalen, bxtca, bdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdx, _16), _16, (0, _utilJs.scale)(len2, _8, bdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdxtail, _32), _32, _32b, _64), _64); - if (cdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, bdxtail, _8), _8, cdytail, _16), _16); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, cc, -bdxtail, _8), _8, adytail, _16), _16); - } - if (bdytail !== 0) { - const len = (0, _utilJs.scale)(catlen, cat, bdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(bytcalen, bytca, bdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * bdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(cattlen, catt, bdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * bdy, _16), _16, (0, _utilJs.scale)(len2, _8, bdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, bdytail, _32), _32, _32b, _64), _64); - } - } - if (cdxtail !== 0 || cdytail !== 0) { - if (adxtail !== 0 || adytail !== 0 || bdxtail !== 0 || bdytail !== 0) { - s1 = adxtail * bdy; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdy; - bhi = c - (c - bdy); - blo = bdy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = adx * bdytail; - c = (0, _utilJs.splitter) * adx; - ahi = c - (c - adx); - alo = adx - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - u[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - u[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - u[2] = _j - (u3 - bvirt) + (_i - bvirt); - u[3] = u3; - n1 = -ady; - n0 = -adytail; - s1 = bdxtail * n1; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * n1; - bhi = c - (c - n1); - blo = n1 - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdx * n0; - c = (0, _utilJs.splitter) * bdx; - ahi = c - (c - bdx); - alo = bdx - ahi; - c = (0, _utilJs.splitter) * n0; - bhi = c - (c - n0); - blo = n0 - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 + t0; - bvirt = _i - s0; - v[0] = s0 - (_i - bvirt) + (t0 - bvirt); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 + t1; - bvirt = _i - _0; - v[1] = _0 - (_i - bvirt) + (t1 - bvirt); - u3 = _j + _i; - bvirt = u3 - _j; - v[2] = _j - (u3 - bvirt) + (_i - bvirt); - v[3] = u3; - abtlen = (0, _utilJs.sum)(4, u, 4, v, abt); - s1 = adxtail * bdytail; - c = (0, _utilJs.splitter) * adxtail; - ahi = c - (c - adxtail); - alo = adxtail - ahi; - c = (0, _utilJs.splitter) * bdytail; - bhi = c - (c - bdytail); - blo = bdytail - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bdxtail * adytail; - c = (0, _utilJs.splitter) * bdxtail; - ahi = c - (c - bdxtail); - alo = bdxtail - ahi; - c = (0, _utilJs.splitter) * adytail; - bhi = c - (c - adytail); - blo = adytail - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - abtt[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - abtt[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - abtt[2] = _j - (u3 - bvirt) + (_i - bvirt); - abtt[3] = u3; - abttlen = 4; - } else { - abt[0] = 0; - abtlen = 1; - abtt[0] = 0; - abttlen = 1; - } - if (cdxtail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdxtail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cxtablen, cxtab, cdxtail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdx, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdxtail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdx, _16), _16, (0, _utilJs.scale)(len2, _8, cdxtail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdxtail, _32), _32, _32b, _64), _64); - if (adytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, bb, cdxtail, _8), _8, adytail, _16), _16); - if (bdytail !== 0) finlen = finadd(finlen, (0, _utilJs.scale)((0, _utilJs.scale)(4, aa, -cdxtail, _8), _8, bdytail, _16), _16); - } - if (cdytail !== 0) { - const len = (0, _utilJs.scale)(abtlen, abt, cdytail, _16c); - finlen = finadd(finlen, (0, _utilJs.sum)((0, _utilJs.scale)(cytablen, cytab, cdytail, _16), _16, (0, _utilJs.scale)(len, _16c, 2 * cdy, _32), _32, _48), _48); - const len2 = (0, _utilJs.scale)(abttlen, abtt, cdytail, _8); - finlen = finadd(finlen, (0, _utilJs.sum_three)((0, _utilJs.scale)(len2, _8, 2 * cdy, _16), _16, (0, _utilJs.scale)(len2, _8, cdytail, _16b), _16b, (0, _utilJs.scale)(len, _16c, cdytail, _32), _32, _32b, _64), _64); - } - } - return fin[finlen - 1]; -} -function incircle(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const bdx = bx - dx; - const cdx = cx - dx; - const ady = ay - dy; - const bdy = by - dy; - const cdy = cy - dy; - const bdxcdy = bdx * cdy; - const cdxbdy = cdx * bdy; - const alift = adx * adx + ady * ady; - const cdxady = cdx * ady; - const adxcdy = adx * cdy; - const blift = bdx * bdx + bdy * bdy; - const adxbdy = adx * bdy; - const bdxady = bdx * ady; - const clift = cdx * cdx + cdy * cdy; - const det = alift * (bdxcdy - cdxbdy) + blift * (cdxady - adxcdy) + clift * (adxbdy - bdxady); - const permanent = (Math.abs(bdxcdy) + Math.abs(cdxbdy)) * alift + (Math.abs(cdxady) + Math.abs(adxcdy)) * blift + (Math.abs(adxbdy) + Math.abs(bdxady)) * clift; - const errbound = iccerrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return incircleadapt(ax, ay, bx, by, cx, cy, dx, dy, permanent); -} -function incirclefast(ax, ay, bx, by, cx, cy, dx, dy) { - const adx = ax - dx; - const ady = ay - dy; - const bdx = bx - dx; - const bdy = by - dy; - const cdx = cx - dx; - const cdy = cy - dy; - const abdet = adx * bdy - bdx * ady; - const bcdet = bdx * cdy - cdx * bdy; - const cadet = cdx * ady - adx * cdy; - const alift = adx * adx + ady * ady; - const blift = bdx * bdx + bdy * bdy; - const clift = cdx * cdx + cdy * cdy; - return alift * bcdet + blift * cadet + clift * abdet; -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lKwEh":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "insphere", ()=>insphere); -parcelHelpers.export(exports, "inspherefast", ()=>inspherefast); -var _utilJs = require("./util.js"); -const isperrboundA = (16 + 224 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundB = (5 + 72 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon); -const isperrboundC = (71 + 1408 * (0, _utilJs.epsilon)) * (0, _utilJs.epsilon) * (0, _utilJs.epsilon); -const ab = (0, _utilJs.vec)(4); -const bc = (0, _utilJs.vec)(4); -const cd = (0, _utilJs.vec)(4); -const de = (0, _utilJs.vec)(4); -const ea = (0, _utilJs.vec)(4); -const ac = (0, _utilJs.vec)(4); -const bd = (0, _utilJs.vec)(4); -const ce = (0, _utilJs.vec)(4); -const da = (0, _utilJs.vec)(4); -const eb = (0, _utilJs.vec)(4); -const abc = (0, _utilJs.vec)(24); -const bcd = (0, _utilJs.vec)(24); -const cde = (0, _utilJs.vec)(24); -const dea = (0, _utilJs.vec)(24); -const eab = (0, _utilJs.vec)(24); -const abd = (0, _utilJs.vec)(24); -const bce = (0, _utilJs.vec)(24); -const cda = (0, _utilJs.vec)(24); -const deb = (0, _utilJs.vec)(24); -const eac = (0, _utilJs.vec)(24); -const adet = (0, _utilJs.vec)(1152); -const bdet = (0, _utilJs.vec)(1152); -const cdet = (0, _utilJs.vec)(1152); -const ddet = (0, _utilJs.vec)(1152); -const edet = (0, _utilJs.vec)(1152); -const abdet = (0, _utilJs.vec)(2304); -const cddet = (0, _utilJs.vec)(2304); -const cdedet = (0, _utilJs.vec)(3456); -const deter = (0, _utilJs.vec)(5760); -const _8 = (0, _utilJs.vec)(8); -const _8b = (0, _utilJs.vec)(8); -const _8c = (0, _utilJs.vec)(8); -const _16 = (0, _utilJs.vec)(16); -const _24 = (0, _utilJs.vec)(24); -const _48 = (0, _utilJs.vec)(48); -const _48b = (0, _utilJs.vec)(48); -const _96 = (0, _utilJs.vec)(96); -const _192 = (0, _utilJs.vec)(192); -const _384x = (0, _utilJs.vec)(384); -const _384y = (0, _utilJs.vec)(384); -const _384z = (0, _utilJs.vec)(384); -const _768 = (0, _utilJs.vec)(768); -function sum_three_scale(a, b, c, az, bz, cz, out) { - return (0, _utilJs.sum_three)((0, _utilJs.scale)(4, a, az, _8), _8, (0, _utilJs.scale)(4, b, bz, _8b), _8b, (0, _utilJs.scale)(4, c, cz, _8c), _8c, _16, out); -} -function liftexact(alen, a, blen, b, clen, c, dlen, d, x, y, z, out) { - const len = (0, _utilJs.sum)((0, _utilJs.sum)(alen, a, blen, b, _48), _48, (0, _utilJs.negate)((0, _utilJs.sum)(clen, c, dlen, d, _48b), _48b), _48b, _96); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _96, x, _192), _192, x, _384x), _384x, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, y, _192), _192, y, _384y), _384y, (0, _utilJs.scale)((0, _utilJs.scale)(len, _96, z, _192), _192, z, _384z), _384z, _768, out); -} -function insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3; - s1 = ax * by; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ay; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ab[2] = _j - (u3 - bvirt) + (_i - bvirt); - ab[3] = u3; - s1 = bx * cy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * by; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bc[2] = _j - (u3 - bvirt) + (_i - bvirt); - bc[3] = u3; - s1 = cx * dy; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * cy; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - cd[2] = _j - (u3 - bvirt) + (_i - bvirt); - cd[3] = u3; - s1 = dx * ey; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * dy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - de[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - de[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - de[2] = _j - (u3 - bvirt) + (_i - bvirt); - de[3] = u3; - s1 = ex * ay; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * ey; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ea[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ea[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ea[2] = _j - (u3 - bvirt) + (_i - bvirt); - ea[3] = u3; - s1 = ax * cy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cx * ay; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ac[2] = _j - (u3 - bvirt) + (_i - bvirt); - ac[3] = u3; - s1 = bx * dy; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dx * by; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - bd[2] = _j - (u3 - bvirt) + (_i - bvirt); - bd[3] = u3; - s1 = cx * ey; - c = (0, _utilJs.splitter) * cx; - ahi = c - (c - cx); - alo = cx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ex * cy; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * cy; - bhi = c - (c - cy); - blo = cy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ce[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ce[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - ce[2] = _j - (u3 - bvirt) + (_i - bvirt); - ce[3] = u3; - s1 = dx * ay; - c = (0, _utilJs.splitter) * dx; - ahi = c - (c - dx); - alo = dx - ahi; - c = (0, _utilJs.splitter) * ay; - bhi = c - (c - ay); - blo = ay - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = ax * dy; - c = (0, _utilJs.splitter) * ax; - ahi = c - (c - ax); - alo = ax - ahi; - c = (0, _utilJs.splitter) * dy; - bhi = c - (c - dy); - blo = dy - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - da[2] = _j - (u3 - bvirt) + (_i - bvirt); - da[3] = u3; - s1 = ex * by; - c = (0, _utilJs.splitter) * ex; - ahi = c - (c - ex); - alo = ex - ahi; - c = (0, _utilJs.splitter) * by; - bhi = c - (c - by); - blo = by - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bx * ey; - c = (0, _utilJs.splitter) * bx; - ahi = c - (c - bx); - alo = bx - ahi; - c = (0, _utilJs.splitter) * ey; - bhi = c - (c - ey); - blo = ey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - eb[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - eb[1] = _0 - (_i + bvirt) + (bvirt - t1); - u3 = _j + _i; - bvirt = u3 - _j; - eb[2] = _j - (u3 - bvirt) + (_i - bvirt); - eb[3] = u3; - const abclen = sum_three_scale(ab, bc, ac, cz, az, -bz, abc); - const bcdlen = sum_three_scale(bc, cd, bd, dz, bz, -cz, bcd); - const cdelen = sum_three_scale(cd, de, ce, ez, cz, -dz, cde); - const dealen = sum_three_scale(de, ea, da, az, dz, -ez, dea); - const eablen = sum_three_scale(ea, ab, eb, bz, ez, -az, eab); - const abdlen = sum_three_scale(ab, bd, da, dz, az, bz, abd); - const bcelen = sum_three_scale(bc, ce, eb, ez, bz, cz, bce); - const cdalen = sum_three_scale(cd, da, ac, az, cz, dz, cda); - const deblen = sum_three_scale(de, eb, bd, bz, dz, ez, deb); - const eaclen = sum_three_scale(ea, ac, ce, cz, ez, az, eac); - const deterlen = (0, _utilJs.sum_three)(liftexact(cdelen, cde, bcelen, bce, deblen, deb, bcdlen, bcd, ax, ay, az, adet), adet, liftexact(dealen, dea, cdalen, cda, eaclen, eac, cdelen, cde, bx, by, bz, bdet), bdet, (0, _utilJs.sum_three)(liftexact(eablen, eab, deblen, deb, abdlen, abd, dealen, dea, cx, cy, cz, cdet), cdet, liftexact(abclen, abc, eaclen, eac, bcelen, bce, eablen, eab, dx, dy, dz, ddet), ddet, liftexact(bcdlen, bcd, abdlen, abd, cdalen, cda, abclen, abc, ex, ey, ez, edet), edet, cddet, cdedet), cdedet, abdet, deter); - return deter[deterlen - 1]; -} -const xdet = (0, _utilJs.vec)(96); -const ydet = (0, _utilJs.vec)(96); -const zdet = (0, _utilJs.vec)(96); -const fin = (0, _utilJs.vec)(1152); -function liftadapt(a, b, c, az, bz, cz, x, y, z, out) { - const len = sum_three_scale(a, b, c, az, bz, cz, _24); - return (0, _utilJs.sum_three)((0, _utilJs.scale)((0, _utilJs.scale)(len, _24, x, _48), _48, x, xdet), xdet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, y, _48), _48, y, ydet), ydet, (0, _utilJs.scale)((0, _utilJs.scale)(len, _24, z, _48), _48, z, zdet), zdet, _192, out); -} -function insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent) { - let ab3, bc3, cd3, da3, ac3, bd3; - let aextail, bextail, cextail, dextail; - let aeytail, beytail, ceytail, deytail; - let aeztail, beztail, ceztail, deztail; - let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0; - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - s1 = aex * bey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = bex * aey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ab[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ab[1] = _0 - (_i + bvirt) + (bvirt - t1); - ab3 = _j + _i; - bvirt = ab3 - _j; - ab[2] = _j - (ab3 - bvirt) + (_i - bvirt); - ab[3] = ab3; - s1 = bex * cey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * bey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bc[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bc[1] = _0 - (_i + bvirt) + (bvirt - t1); - bc3 = _j + _i; - bvirt = bc3 - _j; - bc[2] = _j - (bc3 - bvirt) + (_i - bvirt); - bc[3] = bc3; - s1 = cex * dey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * cey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - cd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - cd[1] = _0 - (_i + bvirt) + (bvirt - t1); - cd3 = _j + _i; - bvirt = cd3 - _j; - cd[2] = _j - (cd3 - bvirt) + (_i - bvirt); - cd[3] = cd3; - s1 = dex * aey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = aex * dey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - da[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - da[1] = _0 - (_i + bvirt) + (bvirt - t1); - da3 = _j + _i; - bvirt = da3 - _j; - da[2] = _j - (da3 - bvirt) + (_i - bvirt); - da[3] = da3; - s1 = aex * cey; - c = (0, _utilJs.splitter) * aex; - ahi = c - (c - aex); - alo = aex - ahi; - c = (0, _utilJs.splitter) * cey; - bhi = c - (c - cey); - blo = cey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = cex * aey; - c = (0, _utilJs.splitter) * cex; - ahi = c - (c - cex); - alo = cex - ahi; - c = (0, _utilJs.splitter) * aey; - bhi = c - (c - aey); - blo = aey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - ac[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - ac[1] = _0 - (_i + bvirt) + (bvirt - t1); - ac3 = _j + _i; - bvirt = ac3 - _j; - ac[2] = _j - (ac3 - bvirt) + (_i - bvirt); - ac[3] = ac3; - s1 = bex * dey; - c = (0, _utilJs.splitter) * bex; - ahi = c - (c - bex); - alo = bex - ahi; - c = (0, _utilJs.splitter) * dey; - bhi = c - (c - dey); - blo = dey - bhi; - s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); - t1 = dex * bey; - c = (0, _utilJs.splitter) * dex; - ahi = c - (c - dex); - alo = dex - ahi; - c = (0, _utilJs.splitter) * bey; - bhi = c - (c - bey); - blo = bey - bhi; - t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo); - _i = s0 - t0; - bvirt = s0 - _i; - bd[0] = s0 - (_i + bvirt) + (bvirt - t0); - _j = s1 + _i; - bvirt = _j - s1; - _0 = s1 - (_j - bvirt) + (_i - bvirt); - _i = _0 - t1; - bvirt = _0 - _i; - bd[1] = _0 - (_i + bvirt) + (bvirt - t1); - bd3 = _j + _i; - bvirt = bd3 - _j; - bd[2] = _j - (bd3 - bvirt) + (_i - bvirt); - bd[3] = bd3; - const finlen = (0, _utilJs.sum)((0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(bc, cd, bd, dez, bez, -cez, aex, aey, aez, adet), adet), adet, liftadapt(cd, da, ac, aez, cez, dez, bex, bey, bez, bdet), bdet, abdet), abdet, (0, _utilJs.sum)((0, _utilJs.negate)(liftadapt(da, ab, bd, bez, dez, aez, cex, cey, cez, cdet), cdet), cdet, liftadapt(ab, bc, ac, cez, aez, -bez, dex, dey, dez, ddet), ddet, cddet), cddet, fin); - let det = (0, _utilJs.estimate)(finlen, fin); - let errbound = isperrboundB * permanent; - if (det >= errbound || -det >= errbound) return det; - bvirt = ax - aex; - aextail = ax - (aex + bvirt) + (bvirt - ex); - bvirt = ay - aey; - aeytail = ay - (aey + bvirt) + (bvirt - ey); - bvirt = az - aez; - aeztail = az - (aez + bvirt) + (bvirt - ez); - bvirt = bx - bex; - bextail = bx - (bex + bvirt) + (bvirt - ex); - bvirt = by - bey; - beytail = by - (bey + bvirt) + (bvirt - ey); - bvirt = bz - bez; - beztail = bz - (bez + bvirt) + (bvirt - ez); - bvirt = cx - cex; - cextail = cx - (cex + bvirt) + (bvirt - ex); - bvirt = cy - cey; - ceytail = cy - (cey + bvirt) + (bvirt - ey); - bvirt = cz - cez; - ceztail = cz - (cez + bvirt) + (bvirt - ez); - bvirt = dx - dex; - dextail = dx - (dex + bvirt) + (bvirt - ex); - bvirt = dy - dey; - deytail = dy - (dey + bvirt) + (bvirt - ey); - bvirt = dz - dez; - deztail = dz - (dez + bvirt) + (bvirt - ez); - if (aextail === 0 && aeytail === 0 && aeztail === 0 && bextail === 0 && beytail === 0 && beztail === 0 && cextail === 0 && ceytail === 0 && ceztail === 0 && dextail === 0 && deytail === 0 && deztail === 0) return det; - errbound = isperrboundC * permanent + (0, _utilJs.resulterrbound) * Math.abs(det); - const abeps = aex * beytail + bey * aextail - (aey * bextail + bex * aeytail); - const bceps = bex * ceytail + cey * bextail - (bey * cextail + cex * beytail); - const cdeps = cex * deytail + dey * cextail - (cey * dextail + dex * ceytail); - const daeps = dex * aeytail + aey * dextail - (dey * aextail + aex * deytail); - const aceps = aex * ceytail + cey * aextail - (aey * cextail + cex * aeytail); - const bdeps = bex * deytail + dey * bextail - (bey * dextail + dex * beytail); - det += (bex * bex + bey * bey + bez * bez) * (cez * daeps + dez * aceps + aez * cdeps + (ceztail * da3 + deztail * ac3 + aeztail * cd3)) + (dex * dex + dey * dey + dez * dez) * (aez * bceps - bez * aceps + cez * abeps + (aeztail * bc3 - beztail * ac3 + ceztail * ab3)) - ((aex * aex + aey * aey + aez * aez) * (bez * cdeps - cez * bdeps + dez * bceps + (beztail * cd3 - ceztail * bd3 + deztail * bc3)) + (cex * cex + cey * cey + cez * cez) * (dez * abeps + aez * bdeps + bez * daeps + (deztail * ab3 + aeztail * bd3 + beztail * da3))) + 2 * ((bex * bextail + bey * beytail + bez * beztail) * (cez * da3 + dez * ac3 + aez * cd3) + (dex * dextail + dey * deytail + dez * deztail) * (aez * bc3 - bez * ac3 + cez * ab3) - ((aex * aextail + aey * aeytail + aez * aeztail) * (bez * cd3 - cez * bd3 + dez * bc3) + (cex * cextail + cey * ceytail + cez * ceztail) * (dez * ab3 + aez * bd3 + bez * da3))); - if (det >= errbound || -det >= errbound) return det; - return insphereexact(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez); -} -function insphere(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez) { - const aex = ax - ex; - const bex = bx - ex; - const cex = cx - ex; - const dex = dx - ex; - const aey = ay - ey; - const bey = by - ey; - const cey = cy - ey; - const dey = dy - ey; - const aez = az - ez; - const bez = bz - ez; - const cez = cz - ez; - const dez = dz - ez; - const aexbey = aex * bey; - const bexaey = bex * aey; - const ab = aexbey - bexaey; - const bexcey = bex * cey; - const cexbey = cex * bey; - const bc = bexcey - cexbey; - const cexdey = cex * dey; - const dexcey = dex * cey; - const cd = cexdey - dexcey; - const dexaey = dex * aey; - const aexdey = aex * dey; - const da = dexaey - aexdey; - const aexcey = aex * cey; - const cexaey = cex * aey; - const ac = aexcey - cexaey; - const bexdey = bex * dey; - const dexbey = dex * bey; - const bd = bexdey - dexbey; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - const det = clift * (dez * ab + aez * bd + bez * da) - dlift * (aez * bc - bez * ac + cez * ab) + (alift * (bez * cd - cez * bd + dez * bc) - blift * (cez * da + dez * ac + aez * cd)); - const aezplus = Math.abs(aez); - const bezplus = Math.abs(bez); - const cezplus = Math.abs(cez); - const dezplus = Math.abs(dez); - const aexbeyplus = Math.abs(aexbey) + Math.abs(bexaey); - const bexceyplus = Math.abs(bexcey) + Math.abs(cexbey); - const cexdeyplus = Math.abs(cexdey) + Math.abs(dexcey); - const dexaeyplus = Math.abs(dexaey) + Math.abs(aexdey); - const aexceyplus = Math.abs(aexcey) + Math.abs(cexaey); - const bexdeyplus = Math.abs(bexdey) + Math.abs(dexbey); - const permanent = (cexdeyplus * bezplus + bexdeyplus * cezplus + bexceyplus * dezplus) * alift + (dexaeyplus * cezplus + aexceyplus * dezplus + cexdeyplus * aezplus) * blift + (aexbeyplus * dezplus + bexdeyplus * aezplus + dexaeyplus * bezplus) * clift + (bexceyplus * aezplus + aexceyplus * bezplus + aexbeyplus * cezplus) * dlift; - const errbound = isperrboundA * permanent; - if (det > errbound || -det > errbound) return det; - return -insphereadapt(ax, ay, az, bx, by, bz, cx, cy, cz, dx, dy, dz, ex, ey, ez, permanent); -} -function inspherefast(pax, pay, paz, pbx, pby, pbz, pcx, pcy, pcz, pdx, pdy, pdz, pex, pey, pez) { - const aex = pax - pex; - const bex = pbx - pex; - const cex = pcx - pex; - const dex = pdx - pex; - const aey = pay - pey; - const bey = pby - pey; - const cey = pcy - pey; - const dey = pdy - pey; - const aez = paz - pez; - const bez = pbz - pez; - const cez = pcz - pez; - const dez = pdz - pez; - const ab = aex * bey - bex * aey; - const bc = bex * cey - cex * bey; - const cd = cex * dey - dex * cey; - const da = dex * aey - aex * dey; - const ac = aex * cey - cex * aey; - const bd = bex * dey - dex * bey; - const abc = aez * bc - bez * ac + cez * ab; - const bcd = bez * cd - cez * bd + dez * bc; - const cda = cez * da + dez * ac + aez * cd; - const dab = dez * ab + aez * bd + bez * da; - const alift = aex * aex + aey * aey + aez * aez; - const blift = bex * bex + bey * bey + bez * bez; - const clift = cex * cex + cey * cey + cez * cez; - const dlift = dex * dex + dey * dey + dez * dez; - return clift * dab - dlift * abc + (alift * bcd - blift * cda); -} - -},{"./util.js":"3WWl7","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60Yfe":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -const epsilon = 1e-6; -class Path { - constructor(){ - this._x0 = this._y0 = this._x1 = this._y1 = null; // end of current subpath - this._ = ""; - } - moveTo(x, y) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`; + if (token.type === TokenKeyword) { + throwError(token, MessageUnexpectedReserved); } - closePath() { - if (this._x1 !== null) { - this._x1 = this._x0, this._y1 = this._y0; - this._ += "Z"; + throwError(token, MessageUnexpectedToken, token.value); + } + function expect(value2) { + const token = lex(); + if (token.type !== TokenPunctuator || token.value !== value2) { + throwUnexpected(token); + } + } + function match(value2) { + return lookahead.type === TokenPunctuator && lookahead.value === value2; + } + function matchKeyword(keyword) { + return lookahead.type === TokenKeyword && lookahead.value === keyword; + } + function parseArrayInitialiser() { + const elements = []; + index = lookahead.start; + expect("["); + while (!match("]")) { + if (match(",")) { + lex(); + elements.push(null); + } else { + elements.push(parseConditionalExpression()); + if (!match("]")) { + expect(","); } + } + } + lex(); + return finishArrayExpression(elements); + } + function parseObjectPropertyKey() { + index = lookahead.start; + const token = lex(); + if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { + if (token.octal) { + throwError(token, MessageStrictOctalLiteral); + } + return finishLiteral(token); } - lineTo(x, y) { - this._ += `L${this._x1 = +x},${this._y1 = +y}`; + return finishIdentifier(token.value); + } + function parseObjectProperty() { + var token, key2, id2, value2; + index = lookahead.start; + token = lookahead; + if (token.type === TokenIdentifier) { + id2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", id2, value2); } - arc(x, y, r) { - x = +x, y = +y, r = +r; - const x0 = x + r; - const y0 = y; - if (r < 0) throw new Error("negative radius"); - if (this._x1 === null) this._ += `M${x0},${y0}`; - else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0; - if (!r) return; - this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`; + if (token.type === TokenEOF || token.type === TokenPunctuator) { + throwUnexpected(token); + } else { + key2 = parseObjectPropertyKey(); + expect(":"); + value2 = parseConditionalExpression(); + return finishProperty("init", key2, value2); } - rect(x, y, w, h) { - this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`; + } + function parseObjectInitialiser() { + var properties = [], property2, name, key2, map2 = {}, toString2 = String; + index = lookahead.start; + expect("{"); + while (!match("}")) { + property2 = parseObjectProperty(); + if (property2.key.type === SyntaxIdentifier) { + name = property2.key.name; + } else { + name = toString2(property2.key.value); + } + key2 = "$" + name; + if (Object.prototype.hasOwnProperty.call(map2, key2)) { + throwError({}, MessageStrictDuplicateProperty); + } else { + map2[key2] = true; + } + properties.push(property2); + if (!match("}")) { + expect(","); + } } - value() { - return this._ || null; - } -} -exports.default = Path; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5nsXD":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -class Polygon { - constructor(){ - this._ = []; - } - moveTo(x, y) { - this._.push([ - x, - y - ]); + expect("}"); + return finishObjectExpression(properties); + } + function parseGroupExpression() { + expect("("); + const expr2 = parseExpression(); + expect(")"); + return expr2; + } + const legalKeywords = { + "if": 1 + }; + function parsePrimaryExpression() { + var type2, token, expr2; + if (match("(")) { + return parseGroupExpression(); } - closePath() { - this._.push(this._[0].slice()); + if (match("[")) { + return parseArrayInitialiser(); } - lineTo(x, y) { - this._.push([ - x, - y - ]); + if (match("{")) { + return parseObjectInitialiser(); } - value() { - return this._.length ? this._ : null; - } -} -exports.default = Polygon; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a33Bo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _pathJs = require("./path.js"); -var _pathJsDefault = parcelHelpers.interopDefault(_pathJs); -var _polygonJs = require("./polygon.js"); -var _polygonJsDefault = parcelHelpers.interopDefault(_polygonJs); -class Voronoi { - constructor(delaunay, [xmin, ymin, xmax, ymax] = [ - 0, - 0, - 960, - 500 - ]){ - if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); - this.delaunay = delaunay; - this._circumcenters = new Float64Array(delaunay.points.length * 2); - this.vectors = new Float64Array(delaunay.points.length * 2); - this.xmax = xmax, this.xmin = xmin; - this.ymax = ymax, this.ymin = ymin; - this._init(); + type2 = lookahead.type; + index = lookahead.start; + if (type2 === TokenIdentifier || legalKeywords[lookahead.value]) { + expr2 = finishIdentifier(lex().value); + } else if (type2 === TokenStringLiteral || type2 === TokenNumericLiteral) { + if (lookahead.octal) { + throwError(lookahead, MessageStrictOctalLiteral); + } + expr2 = finishLiteral(lex()); + } else if (type2 === TokenKeyword) { + throw new Error(DISABLED); + } else if (type2 === TokenBooleanLiteral) { + token = lex(); + token.value = token.value === "true"; + expr2 = finishLiteral(token); + } else if (type2 === TokenNullLiteral) { + token = lex(); + token.value = null; + expr2 = finishLiteral(token); + } else if (match("/") || match("/=")) { + expr2 = finishLiteral(scanRegExp()); + peek(); + } else { + throwUnexpected(lex()); } - update() { - this.delaunay.update(); - this._init(); - return this; + return expr2; + } + function parseArguments() { + const args = []; + expect("("); + if (!match(")")) { + while (index < length$1) { + args.push(parseConditionalExpression()); + if (match(")")) { + break; + } + expect(","); + } + } + expect(")"); + return args; + } + function parseNonComputedProperty() { + index = lookahead.start; + const token = lex(); + if (!isIdentifierName(token)) { + throwUnexpected(token); } - _init() { - const { delaunay: { points, hull, triangles }, vectors } = this; - let bx, by; // lazily computed barycenter of the hull - // Compute circumcenters. - const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); - for(let i = 0, j = 0, n = triangles.length, x, y; i < n; i += 3, j += 2){ - const t1 = triangles[i] * 2; - const t2 = triangles[i + 1] * 2; - const t3 = triangles[i + 2] * 2; - const x1 = points[t1]; - const y1 = points[t1 + 1]; - const x2 = points[t2]; - const y2 = points[t2 + 1]; - const x3 = points[t3]; - const y3 = points[t3 + 1]; - const dx = x2 - x1; - const dy = y2 - y1; - const ex = x3 - x1; - const ey = y3 - y1; - const ab = (dx * ey - dy * ex) * 2; - if (Math.abs(ab) < 1e-9) { - // For a degenerate triangle, the circumcenter is at the infinity, in a - // direction orthogonal to the halfedge and away from the “center” of - // the diagram <bx, by>, defined as the hull’s barycenter. - if (bx === undefined) { - bx = by = 0; - for (const i of hull)bx += points[i * 2], by += points[i * 2 + 1]; - bx /= hull.length, by /= hull.length; - } - const a = 1e9 * Math.sign((bx - x1) * ey - (by - y1) * ex); - x = (x1 + x3) / 2 - a * ey; - y = (y1 + y3) / 2 + a * ex; - } else { - const d = 1 / ab; - const bl = dx * dx + dy * dy; - const cl = ex * ex + ey * ey; - x = x1 + (ey * bl - dy * cl) * d; - y = y1 + (dx * cl - ex * bl) * d; - } - circumcenters[j] = x; - circumcenters[j + 1] = y; - } - // Compute exterior cell rays. - let h = hull[hull.length - 1]; - let p0, p1 = h * 4; - let x0, x1 = points[2 * h]; - let y0, y1 = points[2 * h + 1]; - vectors.fill(0); - for(let i = 0; i < hull.length; ++i){ - h = hull[i]; - p0 = p1, x0 = x1, y0 = y1; - p1 = h * 4, x1 = points[2 * h], y1 = points[2 * h + 1]; - vectors[p0 + 2] = vectors[p1] = y0 - y1; - vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0; - } - } - render(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const { delaunay: { halfedges, inedges, hull }, circumcenters, vectors } = this; - if (hull.length <= 1) return null; - for(let i = 0, n = halfedges.length; i < n; ++i){ - const j = halfedges[i]; - if (j < i) continue; - const ti = Math.floor(i / 3) * 2; - const tj = Math.floor(j / 3) * 2; - const xi = circumcenters[ti]; - const yi = circumcenters[ti + 1]; - const xj = circumcenters[tj]; - const yj = circumcenters[tj + 1]; - this._renderSegment(xi, yi, xj, yj, context); - } - let h0, h1 = hull[hull.length - 1]; - for(let i = 0; i < hull.length; ++i){ - h0 = h1, h1 = hull[i]; - const t = Math.floor(inedges[h1] / 3) * 2; - const x = circumcenters[t]; - const y = circumcenters[t + 1]; - const v = h0 * 4; - const p = this._project(x, y, vectors[v + 2], vectors[v + 3]); - if (p) this._renderSegment(x, y, p[0], p[1], context); - } - return buffer && buffer.value(); - } - renderBounds(context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); - return buffer && buffer.value(); - } - renderCell(i, context) { - const buffer = context == null ? context = new (0, _pathJsDefault.default) : undefined; - const points = this._clip(i); - if (points === null || !points.length) return; - context.moveTo(points[0], points[1]); - let n = points.length; - while(points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1)n -= 2; - for(let i = 2; i < n; i += 2)if (points[i] !== points[i - 2] || points[i + 1] !== points[i - 1]) context.lineTo(points[i], points[i + 1]); - context.closePath(); - return buffer && buffer.value(); + return finishIdentifier(token.value); + } + function parseNonComputedMember() { + expect("."); + return parseNonComputedProperty(); + } + function parseComputedMember() { + expect("["); + const expr2 = parseExpression(); + expect("]"); + return expr2; + } + function parseLeftHandSideExpressionAllowCall() { + var expr2, args, property2; + expr2 = parsePrimaryExpression(); + for (; ; ) { + if (match(".")) { + property2 = parseNonComputedMember(); + expr2 = finishMemberExpression(".", expr2, property2); + } else if (match("(")) { + args = parseArguments(); + expr2 = finishCallExpression(expr2, args); + } else if (match("[")) { + property2 = parseComputedMember(); + expr2 = finishMemberExpression("[", expr2, property2); + } else { + break; + } } - *cellPolygons() { - const { delaunay: { points } } = this; - for(let i = 0, n = points.length / 2; i < n; ++i){ - const cell = this.cellPolygon(i); - if (cell) cell.index = i, yield cell; - } + return expr2; + } + function parsePostfixExpression() { + const expr2 = parseLeftHandSideExpressionAllowCall(); + if (lookahead.type === TokenPunctuator) { + if (match("++") || match("--")) { + throw new Error(DISABLED); + } } - cellPolygon(i) { - const polygon = new (0, _polygonJsDefault.default); - this.renderCell(i, polygon); - return polygon.value(); - } - _renderSegment(x0, y0, x1, y1, context) { - let S; - const c0 = this._regioncode(x0, y0); - const c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - context.moveTo(x0, y0); - context.lineTo(x1, y1); - } else if (S = this._clipSegment(x0, y0, x1, y1, c0, c1)) { - context.moveTo(S[0], S[1]); - context.lineTo(S[2], S[3]); - } + return expr2; + } + function parseUnaryExpression() { + var token, expr2; + if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) { + expr2 = parsePostfixExpression(); + } else if (match("++") || match("--")) { + throw new Error(DISABLED); + } else if (match("+") || match("-") || match("~") || match("!")) { + token = lex(); + expr2 = parseUnaryExpression(); + expr2 = finishUnaryExpression(token.value, expr2); + } else if (matchKeyword("delete") || matchKeyword("void") || matchKeyword("typeof")) { + throw new Error(DISABLED); + } else { + expr2 = parsePostfixExpression(); } - contains(i, x, y) { - if ((x = +x, x !== x) || (y = +y, y !== y)) return false; - return this.delaunay._step(i, x, y) === i; + return expr2; + } + function binaryPrecedence(token) { + let prec = 0; + if (token.type !== TokenPunctuator && token.type !== TokenKeyword) { + return 0; } - *neighbors(i) { - const ci = this._clip(i); - if (ci) for (const j of this.delaunay.neighbors(i)){ - const cj = this._clip(j); - // find the common edge - if (cj) loop: for(let ai = 0, li = ci.length; ai < li; ai += 2){ - for(let aj = 0, lj = cj.length; aj < lj; aj += 2)if (ci[ai] === cj[aj] && ci[ai + 1] === cj[aj + 1] && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) { - yield j; - break loop; - } - } - } + switch (token.value) { + case "||": + prec = 1; + break; + case "&&": + prec = 2; + break; + case "|": + prec = 3; + break; + case "^": + prec = 4; + break; + case "&": + prec = 5; + break; + case "==": + case "!=": + case "===": + case "!==": + prec = 6; + break; + case "<": + case ">": + case "<=": + case ">=": + case "instanceof": + case "in": + prec = 7; + break; + case "<<": + case ">>": + case ">>>": + prec = 8; + break; + case "+": + case "-": + prec = 9; + break; + case "*": + case "/": + case "%": + prec = 11; + break; } - _cell(i) { - const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; - const e0 = inedges[i]; - if (e0 === -1) return null; // coincident point - const points = []; - let e = e0; - do { - const t = Math.floor(e / 3); - points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); - e = e % 3 === 2 ? e - 2 : e + 1; - if (triangles[e] !== i) break; // bad triangulation - e = halfedges[e]; - }while (e !== e0 && e !== -1); - return points; + return prec; + } + function parseBinaryExpression() { + var marker, markers, expr2, token, prec, stack, right, operator2, left, i; + marker = lookahead; + left = parseUnaryExpression(); + token = lookahead; + prec = binaryPrecedence(token); + if (prec === 0) { + return left; } - _clip(i) { - // degenerate case (1 valid point: return the box) - if (i === 0 && this.delaunay.hull.length === 1) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - const points = this._cell(i); - if (points === null) return null; - const { vectors: V } = this; - const v = i * 4; - return this._simplify(V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points)); - } - _clipFinite(i, points) { - const n = points.length; - let P = null; - let x0, y0, x1 = points[n - 2], y1 = points[n - 1]; - let c0, c1 = this._regioncode(x1, y1); - let e0, e1 = 0; - for(let j = 0; j < n; j += 2){ - x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1]; - c0 = c1, c1 = this._regioncode(x1, y1); - if (c0 === 0 && c1 === 0) { - e0 = e1, e1 = 0; - if (P) P.push(x1, y1); - else P = [ - x1, - y1 - ]; - } else { - let S, sx0, sy0, sx1, sy1; - if (c0 === 0) { - if ((S = this._clipSegment(x0, y0, x1, y1, c0, c1)) === null) continue; - [sx0, sy0, sx1, sy1] = S; - } else { - if ((S = this._clipSegment(x1, y1, x0, y0, c1, c0)) === null) continue; - [sx1, sy1, sx0, sy0] = S; - e0 = e1, e1 = this._edgecode(sx0, sy0); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx0, sy0); - else P = [ - sx0, - sy0 - ]; - } - e0 = e1, e1 = this._edgecode(sx1, sy1); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - if (P) P.push(sx1, sy1); - else P = [ - sx1, - sy1 - ]; - } - } - if (P) { - e0 = e1, e1 = this._edgecode(P[0], P[1]); - if (e0 && e1) this._edge(i, e0, e1, P, P.length); - } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) return [ - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax, - this.xmin, - this.ymin - ]; - return P; - } - _clipSegment(x0, y0, x1, y1, c0, c1) { - // for more robustness, always consider the segment in the same order - const flip = c0 < c1; - if (flip) [x0, y0, x1, y1, c0, c1] = [ - x1, - y1, - x0, - y0, - c1, - c0 - ]; - while(true){ - if (c0 === 0 && c1 === 0) return flip ? [ - x1, - y1, - x0, - y0 - ] : [ - x0, - y0, - x1, - y1 - ]; - if (c0 & c1) return null; - let x, y, c = c0 || c1; - if (c & 8) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax; - else if (c & 4) x = x0 + (x1 - x0) * (this.ymin - y0) / (y1 - y0), y = this.ymin; - else if (c & 2) y = y0 + (y1 - y0) * (this.xmax - x0) / (x1 - x0), x = this.xmax; - else y = y0 + (y1 - y0) * (this.xmin - x0) / (x1 - x0), x = this.xmin; - if (c0) x0 = x, y0 = y, c0 = this._regioncode(x0, y0); - else x1 = x, y1 = y, c1 = this._regioncode(x1, y1); - } - } - _clipInfinite(i, points, vx0, vy0, vxn, vyn) { - let P = Array.from(points), p; - if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); - if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); - if (P = this._clipFinite(i, P)) for(let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2){ - c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); - if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; - } - else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) P = [ - this.xmin, - this.ymin, - this.xmax, - this.ymin, - this.xmax, - this.ymax, - this.xmin, - this.ymax - ]; - return P; + token.prec = prec; + lex(); + markers = [marker, lookahead]; + right = parseUnaryExpression(); + stack = [left, token, right]; + while ((prec = binaryPrecedence(lookahead)) > 0) { + while (stack.length > 2 && prec <= stack[stack.length - 2].prec) { + right = stack.pop(); + operator2 = stack.pop().value; + left = stack.pop(); + markers.pop(); + expr2 = finishBinaryExpression(operator2, left, right); + stack.push(expr2); + } + token = lex(); + token.prec = prec; + stack.push(token); + markers.push(lookahead); + expr2 = parseUnaryExpression(); + stack.push(expr2); } - _edge(i, e0, e1, P, j) { - while(e0 !== e1){ - let x, y; - switch(e0){ - case 5: - e0 = 4; - continue; // top-left - case 4: - e0 = 6, x = this.xmax, y = this.ymin; - break; // top - case 6: - e0 = 2; - continue; // top-right - case 2: - e0 = 10, x = this.xmax, y = this.ymax; - break; // right - case 10: - e0 = 8; - continue; // bottom-right - case 8: - e0 = 9, x = this.xmin, y = this.ymax; - break; // bottom - case 9: - e0 = 1; - continue; // bottom-left - case 1: - e0 = 5, x = this.xmin, y = this.ymin; - break; // left - } - // Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are - // undefined, the conditional statement will be executed. - if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) P.splice(j, 0, x, y), j += 2; - } - return j; - } - _project(x0, y0, vx, vy) { - let t = Infinity, c, x, y; - if (vy < 0) { - if (y0 <= this.ymin) return null; - if ((c = (this.ymin - y0) / vy) < t) y = this.ymin, x = x0 + (t = c) * vx; - } else if (vy > 0) { - if (y0 >= this.ymax) return null; - if ((c = (this.ymax - y0) / vy) < t) y = this.ymax, x = x0 + (t = c) * vx; - } - if (vx > 0) { - if (x0 >= this.xmax) return null; - if ((c = (this.xmax - x0) / vx) < t) x = this.xmax, y = y0 + (t = c) * vy; - } else if (vx < 0) { - if (x0 <= this.xmin) return null; - if ((c = (this.xmin - x0) / vx) < t) x = this.xmin, y = y0 + (t = c) * vy; - } - return [ - x, - y - ]; - } - _edgecode(x, y) { - return (x === this.xmin ? 1 : x === this.xmax ? 2 : 0) | (y === this.ymin ? 4 : y === this.ymax ? 8 : 0); - } - _regioncode(x, y) { - return (x < this.xmin ? 1 : x > this.xmax ? 2 : 0) | (y < this.ymin ? 4 : y > this.ymax ? 8 : 0); + i = stack.length - 1; + expr2 = stack[i]; + markers.pop(); + while (i > 1) { + markers.pop(); + expr2 = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr2); + i -= 2; } - _simplify(P) { - if (P && P.length > 4) { - for(let i = 0; i < P.length; i += 2){ - const j = (i + 2) % P.length, k = (i + 4) % P.length; - if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) P.splice(j, 2), i -= 2; - } - if (!P.length) P = null; - } - return P; - } -} -exports.default = Voronoi; - -},{"./path.js":"60Yfe","./polygon.js":"5nsXD","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7Z7Aq":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "wordcloud", ()=>Wordcloud); -var _vegaCanvas = require("vega-canvas"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -var _vegaScale = require("vega-scale"); -var _vegaStatistics = require("vega-statistics"); -/* -Copyright (c) 2013, Jason Davies. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * The name Jason Davies may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL JASON DAVIES BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ // Word cloud layout by Jason Davies, https://www.jasondavies.com/wordcloud/ -// Algorithm due to Jonathan Feinberg, http://static.mrfeinberg.com/bv_ch03.pdf -var cloudRadians = Math.PI / 180, cw = 64, ch = 2048; -function cloud() { - var size = [ - 256, - 256 - ], text, font, fontSize, fontStyle, fontWeight, rotate, padding, spiral = archimedeanSpiral, words = [], random = Math.random, cloud = {}; - cloud.layout = function() { - var contextAndRatio = getContext((0, _vegaCanvas.canvas)()), board = zeroArray((size[0] >> 5) * size[1]), bounds = null, n = words.length, i = -1, tags = [], data = words.map((d)=>({ - text: text(d), - font: font(d), - style: fontStyle(d), - weight: fontWeight(d), - rotate: rotate(d), - size: ~~(fontSize(d) + 1e-14), - padding: padding(d), - xoff: 0, - yoff: 0, - x1: 0, - y1: 0, - x0: 0, - y0: 0, - hasText: false, - sprite: null, - datum: d - })).sort((a, b)=>b.size - a.size); - while(++i < n){ - var d = data[i]; - d.x = size[0] * (random() + .5) >> 1; - d.y = size[1] * (random() + .5) >> 1; - cloudSprite(contextAndRatio, d, data, i); - if (d.hasText && place(board, d, bounds)) { - tags.push(d); - if (bounds) cloudBounds(bounds, d); - else bounds = [ - { - x: d.x + d.x0, - y: d.y + d.y0 - }, - { - x: d.x + d.x1, - y: d.y + d.y1 - } - ]; - // Temporary hack - d.x -= size[0] >> 1; - d.y -= size[1] >> 1; - } - } - return tags; - }; - function getContext(canvas) { - canvas.width = canvas.height = 1; - var ratio = Math.sqrt(canvas.getContext('2d').getImageData(0, 0, 1, 1).data.length >> 2); - canvas.width = (cw << 5) / ratio; - canvas.height = ch / ratio; - var context = canvas.getContext('2d'); - context.fillStyle = context.strokeStyle = 'red'; - context.textAlign = 'center'; - return { - context: context, - ratio: ratio - }; + return expr2; + } + function parseConditionalExpression() { + var expr2, consequent, alternate; + expr2 = parseBinaryExpression(); + if (match("?")) { + lex(); + consequent = parseConditionalExpression(); + expect(":"); + alternate = parseConditionalExpression(); + expr2 = finishConditionalExpression(expr2, consequent, alternate); + } + return expr2; + } + function parseExpression() { + const expr2 = parseConditionalExpression(); + if (match(",")) { + throw new Error(DISABLED); } - function place(board, tag, bounds) { - var startX = tag.x, startY = tag.y, maxDelta = Math.hypot(size[0], size[1]), s = spiral(size), dt = random() < .5 ? 1 : -1, t = -dt, dxdy, dx, dy; - while(dxdy = s(t += dt)){ - dx = ~~dxdy[0]; - dy = ~~dxdy[1]; - if (Math.min(Math.abs(dx), Math.abs(dy)) >= maxDelta) break; - tag.x = startX + dx; - tag.y = startY + dy; - if (tag.x + tag.x0 < 0 || tag.y + tag.y0 < 0 || tag.x + tag.x1 > size[0] || tag.y + tag.y1 > size[1]) continue; - // TODO only check for collisions within current bounds. - if (!bounds || !cloudCollide(tag, board, size[0])) { - if (!bounds || collideRects(tag, bounds)) { - var sprite = tag.sprite, w = tag.width >> 5, sw = size[0] >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++)board[x + i] |= last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0); - x += sw; - } - tag.sprite = null; - return true; - } - } - } - return false; + return expr2; + } + function parser$1(code) { + source = code; + index = 0; + length$1 = source.length; + lookahead = null; + peek(); + const expr2 = parseExpression(); + if (lookahead.type !== TokenEOF) { + throw new Error("Unexpect token after expression."); } - cloud.words = function(_) { - if (arguments.length) { - words = _; - return cloud; - } else return words; - }; - cloud.size = function(_) { - if (arguments.length) { - size = [ - +_[0], - +_[1] - ]; - return cloud; - } else return size; - }; - cloud.font = function(_) { - if (arguments.length) { - font = functor(_); - return cloud; - } else return font; - }; - cloud.fontStyle = function(_) { - if (arguments.length) { - fontStyle = functor(_); - return cloud; - } else return fontStyle; - }; - cloud.fontWeight = function(_) { - if (arguments.length) { - fontWeight = functor(_); - return cloud; - } else return fontWeight; - }; - cloud.rotate = function(_) { - if (arguments.length) { - rotate = functor(_); - return cloud; - } else return rotate; - }; - cloud.text = function(_) { - if (arguments.length) { - text = functor(_); - return cloud; - } else return text; - }; - cloud.spiral = function(_) { - if (arguments.length) { - spiral = spirals[_] || _; - return cloud; - } else return spiral; - }; - cloud.fontSize = function(_) { - if (arguments.length) { - fontSize = functor(_); - return cloud; - } else return fontSize; - }; - cloud.padding = function(_) { - if (arguments.length) { - padding = functor(_); - return cloud; - } else return padding; - }; - cloud.random = function(_) { - if (arguments.length) { - random = _; - return cloud; - } else return random; - }; - return cloud; -} -// Fetches a monochrome sprite bitmap for the specified text. -// Load in batches for speed. -function cloudSprite(contextAndRatio, d, data, di) { - if (d.sprite) return; - var c = contextAndRatio.context, ratio = contextAndRatio.ratio; - c.clearRect(0, 0, (cw << 5) / ratio, ch / ratio); - var x = 0, y = 0, maxh = 0, n = data.length, w, w32, h, i, j; - --di; - while(++di < n){ - d = data[di]; - c.save(); - c.font = d.style + ' ' + d.weight + ' ' + ~~((d.size + 1) / ratio) + 'px ' + d.font; - w = c.measureText(d.text + 'm').width * ratio; - h = d.size << 1; - if (d.rotate) { - var sr = Math.sin(d.rotate * cloudRadians), cr = Math.cos(d.rotate * cloudRadians), wcr = w * cr, wsr = w * sr, hcr = h * cr, hsr = h * sr; - w = Math.max(Math.abs(wcr + hsr), Math.abs(wcr - hsr)) + 0x1f >> 5 << 5; - h = ~~Math.max(Math.abs(wsr + hcr), Math.abs(wsr - hcr)); - } else w = w + 0x1f >> 5 << 5; - if (h > maxh) maxh = h; - if (x + w >= cw << 5) { - x = 0; - y += maxh; - maxh = 0; - } - if (y + h >= ch) break; - c.translate((x + (w >> 1)) / ratio, (y + (h >> 1)) / ratio); - if (d.rotate) c.rotate(d.rotate * cloudRadians); - c.fillText(d.text, 0, 0); - if (d.padding) { - c.lineWidth = 2 * d.padding; - c.strokeText(d.text, 0, 0); - } - c.restore(); - d.width = w; - d.height = h; - d.xoff = x; - d.yoff = y; - d.x1 = w >> 1; - d.y1 = h >> 1; - d.x0 = -d.x1; - d.y0 = -d.y1; - d.hasText = true; - x += w; - } - var pixels = c.getImageData(0, 0, (cw << 5) / ratio, ch / ratio).data, sprite = []; - while(--di >= 0){ - d = data[di]; - if (!d.hasText) continue; - w = d.width; - w32 = w >> 5; - h = d.y1 - d.y0; - // Zero the buffer - for(i = 0; i < h * w32; i++)sprite[i] = 0; - x = d.xoff; - if (x == null) return; - y = d.yoff; - var seen = 0, seenRow = -1; - for(j = 0; j < h; j++){ - for(i = 0; i < w; i++){ - var k = w32 * j + (i >> 5), m = pixels[(y + j) * (cw << 5) + (x + i) << 2] ? 1 << 31 - i % 32 : 0; - sprite[k] |= m; - seen |= m; - } - if (seen) seenRow = j; - else { - d.y0++; - h--; - j--; - y++; - } - } - d.y1 = d.y0 + seenRow; - d.sprite = sprite.slice(0, (d.y1 - d.y0) * w32); + return expr2; + } + var Constants$1 = { + NaN: "NaN", + E: "Math.E", + LN2: "Math.LN2", + LN10: "Math.LN10", + LOG2E: "Math.LOG2E", + LOG10E: "Math.LOG10E", + PI: "Math.PI", + SQRT1_2: "Math.SQRT1_2", + SQRT2: "Math.SQRT2", + MIN_VALUE: "Number.MIN_VALUE", + MAX_VALUE: "Number.MAX_VALUE" + }; + function Functions(codegen2) { + function fncall(name, args, cast, type2) { + let obj = codegen2(args[0]); + if (cast) { + obj = cast + "(" + obj + ")"; + if (cast.lastIndexOf("new ", 0) === 0) obj = "(" + obj + ")"; + } + return obj + "." + name + (type2 < 0 ? "" : type2 === 0 ? "()" : "(" + args.slice(1).map(codegen2).join(",") + ")"); } -} -// Use mask-based collision detection. -function cloudCollide(tag, board, sw) { - sw >>= 5; - var sprite = tag.sprite, w = tag.width >> 5, lx = tag.x - (w << 4), sx = lx & 0x7f, msx = 32 - sx, h = tag.y1 - tag.y0, x = (tag.y + tag.y0) * sw + (lx >> 5), last; - for(var j = 0; j < h; j++){ - last = 0; - for(var i = 0; i <= w; i++){ - if ((last << msx | (i < w ? (last = sprite[j * w + i]) >>> sx : 0)) & board[x + i]) return true; - } - x += sw; + function fn(name, cast, type2) { + return (args) => fncall(name, args, cast, type2); } - return false; -} -function cloudBounds(bounds, d) { - var b0 = bounds[0], b1 = bounds[1]; - if (d.x + d.x0 < b0.x) b0.x = d.x + d.x0; - if (d.y + d.y0 < b0.y) b0.y = d.y + d.y0; - if (d.x + d.x1 > b1.x) b1.x = d.x + d.x1; - if (d.y + d.y1 > b1.y) b1.y = d.y + d.y1; -} -function collideRects(a, b) { - return a.x + a.x1 > b[0].x && a.x + a.x0 < b[1].x && a.y + a.y1 > b[0].y && a.y + a.y0 < b[1].y; -} -function archimedeanSpiral(size) { - var e = size[0] / size[1]; - return function(t) { - return [ - e * (t *= .1) * Math.cos(t), - t * Math.sin(t) - ]; - }; -} -function rectangularSpiral(size) { - var dy = 4, dx = dy * size[0] / size[1], x = 0, y = 0; - return function(t) { - var sign = t < 0 ? -1 : 1; - // See triangular numbers: T_n = n * (n + 1) / 2. - switch(Math.sqrt(1 + 4 * sign * t) - sign & 3){ - case 0: - x += dx; - break; - case 1: - y += dy; - break; - case 2: - x -= dx; - break; - default: - y -= dy; - break; - } - return [ - x, - y - ]; - }; -} -// TODO reuse arrays? -function zeroArray(n) { - var a = [], i = -1; - while(++i < n)a[i] = 0; - return a; -} -function functor(d) { - return typeof d === 'function' ? d : function() { - return d; - }; -} -var spirals = { - archimedean: archimedeanSpiral, - rectangular: rectangularSpiral -}; -const Output = [ - 'x', - 'y', - 'font', - 'fontSize', - 'fontStyle', - 'fontWeight', - 'angle' -]; -const Params = [ - 'text', - 'font', - 'rotate', - 'fontSize', - 'fontStyle', - 'fontWeight' -]; -function Wordcloud(params) { - (0, _vegaDataflow.Transform).call(this, cloud(), params); -} -Wordcloud.Definition = { - 'type': 'Wordcloud', - 'metadata': { - 'modifies': true - }, - 'params': [ - { - 'name': 'size', - 'type': 'number', - 'array': true, - 'length': 2 - }, - { - 'name': 'font', - 'type': 'string', - 'expr': true, - 'default': 'sans-serif' - }, - { - 'name': 'fontStyle', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontWeight', - 'type': 'string', - 'expr': true, - 'default': 'normal' - }, - { - 'name': 'fontSize', - 'type': 'number', - 'expr': true, - 'default': 14 - }, - { - 'name': 'fontSizeRange', - 'type': 'number', - 'array': 'nullable', - 'default': [ - 10, - 50 - ] - }, - { - 'name': 'rotate', - 'type': 'number', - 'expr': true, - 'default': 0 - }, - { - 'name': 'text', - 'type': 'field' - }, - { - 'name': 'spiral', - 'type': 'string', - 'values': [ - 'archimedean', - 'rectangular' - ] - }, - { - 'name': 'padding', - 'type': 'number', - 'expr': true - }, - { - 'name': 'as', - 'type': 'string', - 'array': true, - 'length': 7, - 'default': Output - } - ] -}; -(0, _vegaUtil.inherits)(Wordcloud, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (_.size && !(_.size[0] && _.size[1])) (0, _vegaUtil.error)('Wordcloud size dimensions must be non-zero.'); - function modp(param) { - const p = _[param]; - return (0, _vegaUtil.isFunction)(p) && pulse.modified(p.fields); - } - const mod = _.modified(); - if (!(mod || pulse.changed(pulse.ADD_REM) || Params.some(modp))) return; - const data = pulse.materialize(pulse.SOURCE).source, layout = this.value, as = _.as || Output; - let fontSize = _.fontSize || 14, range; - (0, _vegaUtil.isFunction)(fontSize) ? range = _.fontSizeRange : fontSize = (0, _vegaUtil.constant)(fontSize); - // create font size scaling function as needed - if (range) { - const fsize = fontSize, sizeScale = (0, _vegaScale.scale)('sqrt')().domain((0, _vegaUtil.extent)(data, fsize)).range(range); - fontSize = (x)=>sizeScale(fsize(x)); - } - data.forEach((t)=>{ - t[as[0]] = NaN; - t[as[1]] = NaN; - t[as[3]] = 0; - }); - // configure layout - const words = layout.words(data).text(_.text).size(_.size || [ - 500, - 500 - ]).padding(_.padding || 1).spiral(_.spiral || 'archimedean').rotate(_.rotate || 0).font(_.font || 'sans-serif').fontStyle(_.fontStyle || 'normal').fontWeight(_.fontWeight || 'normal').fontSize(fontSize).random((0, _vegaStatistics.random)).layout(); - const size = layout.size(), dx = size[0] >> 1, dy = size[1] >> 1, n = words.length; - for(let i = 0, w, t; i < n; ++i){ - w = words[i]; - t = w.datum; - t[as[0]] = w.x + dx; - t[as[1]] = w.y + dy; - t[as[2]] = w.font; - t[as[3]] = w.size; - t[as[4]] = w.style; - t[as[5]] = w.weight; - t[as[6]] = w.rotate; - } - return pulse.reflow(mod).modifies(as); - } -}); - -},{"vega-canvas":"kPWfS","vega-dataflow":"3NitK","vega-util":"bApja","vega-scale":"bEydG","vega-statistics":"5ncfv","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8iEZv":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "crossfilter", ()=>CrossFilter); -parcelHelpers.export(exports, "resolvefilter", ()=>ResolveFilter); -var _d3Array = require("d3-array"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaUtil = require("vega-util"); -const array8 = (n)=>new Uint8Array(n); -const array16 = (n)=>new Uint16Array(n); -const array32 = (n)=>new Uint32Array(n); -/** - * Maintains CrossFilter state. - */ function Bitmaps() { - let width = 8, data = [], seen = array32(0), curr = array(0, width), prev = array(0, width); + const DATE2 = "new Date", STRING = "String", REGEXP = "RegExp"; return { - data: ()=>data, - seen: ()=>seen = lengthen(seen, data.length), - add (array) { - for(let i = 0, j = data.length, n = array.length, t; i < n; ++i){ - t = array[i]; - t._index = j++; - data.push(t); - } - }, - remove (num, map) { - // map: index -> boolean (true => remove) - const n = data.length, copy = Array(n - num), reindex = data; // reuse old data array for index map - let t, i, j; - // seek forward to first removal - for(i = 0; !map[i] && i < n; ++i){ - copy[i] = data[i]; - reindex[i] = i; - } - // condense arrays - for(j = i; i < n; ++i){ - t = data[i]; - if (!map[i]) { - reindex[i] = j; - curr[j] = curr[i]; - prev[j] = prev[i]; - copy[j] = t; - t._index = j++; - } else reindex[i] = -1; - curr[i] = 0; // clear unused bits - } - data = copy; - return reindex; - }, - size: ()=>data.length, - curr: ()=>curr, - prev: ()=>prev, - reset: (k)=>prev[k] = curr[k], - all: ()=>width < 0x101 ? 0xff : width < 0x10001 ? 0xffff : 0xffffffff, - set (k, one) { - curr[k] |= one; - }, - clear (k, one) { - curr[k] &= ~one; - }, - resize (n, m) { - const k = curr.length; - if (n > k || m > width) { - width = Math.max(m, width); - curr = array(n, width, curr); - prev = array(n, width); - } - } + // MATH functions + isNaN: "Number.isNaN", + isFinite: "Number.isFinite", + abs: "Math.abs", + acos: "Math.acos", + asin: "Math.asin", + atan: "Math.atan", + atan2: "Math.atan2", + ceil: "Math.ceil", + cos: "Math.cos", + exp: "Math.exp", + floor: "Math.floor", + hypot: "Math.hypot", + log: "Math.log", + max: "Math.max", + min: "Math.min", + pow: "Math.pow", + random: "Math.random", + round: "Math.round", + sin: "Math.sin", + sqrt: "Math.sqrt", + tan: "Math.tan", + clamp: function(args) { + if (args.length < 3) error("Missing arguments to clamp function."); + if (args.length > 3) error("Too many arguments to clamp function."); + const a2 = args.map(codegen2); + return "Math.max(" + a2[1] + ", Math.min(" + a2[2] + "," + a2[0] + "))"; + }, + // DATE functions + now: "Date.now", + utc: "Date.UTC", + datetime: DATE2, + date: fn("getDate", DATE2, 0), + day: fn("getDay", DATE2, 0), + year: fn("getFullYear", DATE2, 0), + month: fn("getMonth", DATE2, 0), + hours: fn("getHours", DATE2, 0), + minutes: fn("getMinutes", DATE2, 0), + seconds: fn("getSeconds", DATE2, 0), + milliseconds: fn("getMilliseconds", DATE2, 0), + time: fn("getTime", DATE2, 0), + timezoneoffset: fn("getTimezoneOffset", DATE2, 0), + utcdate: fn("getUTCDate", DATE2, 0), + utcday: fn("getUTCDay", DATE2, 0), + utcyear: fn("getUTCFullYear", DATE2, 0), + utcmonth: fn("getUTCMonth", DATE2, 0), + utchours: fn("getUTCHours", DATE2, 0), + utcminutes: fn("getUTCMinutes", DATE2, 0), + utcseconds: fn("getUTCSeconds", DATE2, 0), + utcmilliseconds: fn("getUTCMilliseconds", DATE2, 0), + // sequence functions + length: fn("length", null, -1), + // STRING functions + parseFloat: "parseFloat", + parseInt: "parseInt", + upper: fn("toUpperCase", STRING, 0), + lower: fn("toLowerCase", STRING, 0), + substring: fn("substring", STRING), + split: fn("split", STRING), + trim: fn("trim", STRING, 0), + // base64 encode/decode + btoa: "btoa", + atob: "atob", + // REGEXP functions + regexp: REGEXP, + test: fn("test", REGEXP), + // Control Flow functions + if: function(args) { + if (args.length < 3) error("Missing arguments to if function."); + if (args.length > 3) error("Too many arguments to if function."); + const a2 = args.map(codegen2); + return "(" + a2[0] + "?" + a2[1] + ":" + a2[2] + ")"; + } }; -} -function lengthen(array, length, copy) { - if (array.length >= length) return array; - copy = copy || new array.constructor(length); - copy.set(array); - return copy; -} -function array(n, m, array) { - const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n); - if (array) copy.set(array); - return copy; -} -function Dimension(index, i, query) { - const bit = 1 << i; - return { - one: bit, - zero: ~bit, - range: query.slice(), - bisect: index.bisect, - index: index.index, - size: index.size, - onAdd (added, curr) { - const dim = this, range = dim.bisect(dim.range, added.value), idx = added.index, lo = range[0], hi = range[1], n1 = idx.length; - let i; - for(i = 0; i < lo; ++i)curr[idx[i]] |= bit; - for(i = hi; i < n1; ++i)curr[idx[i]] |= bit; - return dim; - } - }; -} -/** - * Maintains a list of values, sorted by key. - */ function SortedIndex() { - let index = array32(0), value = [], size = 0; - function insert(key, data, base) { - if (!data.length) return []; - const n0 = size, n1 = data.length, addi = array32(n1); - let addv = Array(n1), oldv, oldi, i; - for(i = 0; i < n1; ++i){ - addv[i] = key(data[i]); - addi[i] = i; - } - addv = sort(addv, addi); - if (n0) { - oldv = value; - oldi = index; - value = Array(n0 + n1); - index = array32(n0 + n1); - merge(base, oldv, oldi, n0, addv, addi, n1, value, index); - } else { - if (base > 0) for(i = 0; i < n1; ++i)addi[i] += base; - value = addv; - index = addi; - } - size = n0 + n1; - return { - index: addi, - value: addv - }; - } - function remove(num, map) { - // map: index -> remove - const n = size; - let idx, i, j; - // seek forward to first removal - for(i = 0; !map[index[i]] && i < n; ++i); - // condense index and value arrays - for(j = i; i < n; ++i)if (!map[idx = index[i]]) { - index[j] = idx; - value[j] = value[i]; - ++j; - } - size = n - num; - } - function reindex(map) { - for(let i = 0, n = size; i < n; ++i)index[i] = map[index[i]]; - } - function bisect(range, array) { - let n; - if (array) n = array.length; - else { - array = value; - n = size; - } - return [ - (0, _d3Array.bisectLeft)(array, range[0], 0, n), - (0, _d3Array.bisectRight)(array, range[1], 0, n) - ]; + } + function stripQuotes(s) { + const n = s && s.length - 1; + return n && (s[0] === '"' && s[n] === '"' || s[0] === "'" && s[n] === "'") ? s.slice(1, -1) : s; + } + function codegen(opt) { + opt = opt || {}; + const allowed = opt.allowed ? toSet(opt.allowed) : {}, forbidden = opt.forbidden ? toSet(opt.forbidden) : {}, constants2 = opt.constants || Constants$1, functions = (opt.functions || Functions)(visit2), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = isFunction(globalvar) ? globalvar : (id2) => `${globalvar}["${id2}"]`; + /* @__PURE__ */ new Set([...Object.getOwnPropertyNames(Object.prototype).filter((name) => typeof Object.prototype[name] === "function"), "__proto__"]); + let globals = {}, fields = {}, memberDepth = 0; + function visit2(ast) { + if (isString(ast)) return ast; + const generator = Generators[ast.type]; + if (generator == null) error("Unsupported type: " + ast.type); + return generator(ast); } - return { - insert: insert, - remove: remove, - bisect: bisect, - reindex: reindex, - index: ()=>index, - size: ()=>size - }; -} -function sort(values, index) { - values.sort.call(index, (a, b)=>{ - const x = values[a], y = values[b]; - return x < y ? -1 : x > y ? 1 : 0; - }); - return (0, _d3Array.permute)(values, index); -} -function merge(base, value0, index0, n0, value1, index1, n1, value, index) { - let i0 = 0, i1 = 0, i; - for(i = 0; i0 < n0 && i1 < n1; ++i)if (value0[i0] < value1[i1]) { - value[i] = value0[i0]; - index[i] = index0[i0++]; - } else { - value[i] = value1[i1]; - index[i] = index1[i1++] + base; - } - for(; i0 < n0; ++i0, ++i){ - value[i] = value0[i0]; - index[i] = index0[i0]; - } - for(; i1 < n1; ++i1, ++i){ - value[i] = value1[i1]; - index[i] = index1[i1] + base; - } -} -/** - * An indexed multi-dimensional filter. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {Array<function(object): *>} params.fields - An array of dimension accessors to filter. - * @param {Array} params.query - An array of per-dimension range queries. - */ function CrossFilter(params) { - (0, _vegaDataflow.Transform).call(this, Bitmaps(), params); - this._indices = null; - this._dims = null; -} -CrossFilter.Definition = { - 'type': 'CrossFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'fields', - 'type': 'field', - 'array': true, - 'required': true - }, - { - 'name': 'query', - 'type': 'array', - 'array': true, - 'required': true, - 'content': { - 'type': 'number', - 'array': true, - 'length': 2 - } - } - ] -}; -(0, _vegaUtil.inherits)(CrossFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - if (!this._dims) return this.init(_, pulse); - else { - var init = _.modified('fields') || _.fields.some((f)=>pulse.modified(f.fields)); - return init ? this.reinit(_, pulse) : this.eval(_, pulse); - } - }, - init (_, pulse) { - const fields = _.fields, query = _.query, indices = this._indices = {}, dims = this._dims = [], m = query.length; - let i = 0, key, index; - // instantiate indices and dimensions - for(; i < m; ++i){ - key = fields[i].fname; - index = indices[key] || (indices[key] = SortedIndex()); - dims.push(Dimension(index, i, query[i])); - } - return this.eval(_, pulse); - }, - reinit (_, pulse) { - const output = pulse.materialize().fork(), fields = _.fields, query = _.query, indices = this._indices, dims = this._dims, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), out = output.rem = output.add, mod = output.mod, m = query.length, adds = {}; - let add, index, key, mods, remMap, modMap, i, n, f; - // set prev to current state - prev.set(curr); - // if pulse has remove tuples, process them first - if (pulse.rem.length) remMap = this.remove(_, pulse, output); - // if pulse has added tuples, add them to state - if (pulse.add.length) bits.add(pulse.add); - // if pulse has modified tuples, create an index map - if (pulse.mod.length) { - modMap = {}; - for(mods = pulse.mod, i = 0, n = mods.length; i < n; ++i)modMap[mods[i]._index] = 1; - } - // re-initialize indices as needed, update curr bitmap - for(i = 0; i < m; ++i){ - f = fields[i]; - if (!dims[i] || _.modified('fields', i) || pulse.modified(f.fields)) { - key = f.fname; - if (!(add = adds[key])) { - indices[key] = index = SortedIndex(); - adds[key] = add = index.insert(f, pulse.source, 0); - } - dims[i] = Dimension(index, i, query[i]).onAdd(add, curr); - } - } - // visit each tuple - // if filter state changed, push index to add/rem - // else if in mod and passes a filter, push index to mod - for(i = 0, n = bits.data().length; i < n; ++i){ - if (remMap[i]) continue; - else if (prev[i] !== curr[i]) // add if state changed - out.push(i); - else if (modMap[i] && curr[i] !== all) // otherwise, pass mods through - mod.push(i); - } - bits.mask = (1 << m) - 1; - return output; - }, - eval (_, pulse) { - const output = pulse.materialize().fork(), m = this._dims.length; - let mask = 0; - if (pulse.rem.length) { - this.remove(_, pulse, output); - mask |= (1 << m) - 1; - } - if (_.modified('query') && !_.modified('fields')) mask |= this.update(_, pulse, output); - if (pulse.add.length) { - this.insert(_, pulse, output); - mask |= (1 << m) - 1; - } - if (pulse.mod.length) { - this.modify(pulse, output); - mask |= (1 << m) - 1; - } - this.value.mask = mask; - return output; - }, - insert (_, pulse, output) { - const tuples = pulse.add, bits = this.value, dims = this._dims, indices = this._indices, fields = _.fields, adds = {}, out = output.add, n = bits.size() + tuples.length, m = dims.length; - let k = bits.size(), j, key, add; - // resize bitmaps and add tuples as needed - bits.resize(n, m); - bits.add(tuples); - const curr = bits.curr(), prev = bits.prev(), all = bits.all(); - // add to dimensional indices - for(j = 0; j < m; ++j){ - key = fields[j].fname; - add = adds[key] || (adds[key] = indices[key].insert(fields[j], tuples, k)); - dims[j].onAdd(add, curr); - } - // set previous filters, output if passes at least one filter - for(; k < n; ++k){ - prev[k] = all; - if (curr[k] !== all) out.push(k); - } - }, - modify (pulse, output) { - const out = output.mod, bits = this.value, curr = bits.curr(), all = bits.all(), tuples = pulse.mod; - let i, n, k; - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - if (curr[k] !== all) out.push(k); - } - }, - remove (_, pulse, output) { - const indices = this._indices, bits = this.value, curr = bits.curr(), prev = bits.prev(), all = bits.all(), map = {}, out = output.rem, tuples = pulse.rem; - let i, n, k, f; - // process tuples, output if passes at least one filter - for(i = 0, n = tuples.length; i < n; ++i){ - k = tuples[i]._index; - map[k] = 1; // build index map - prev[k] = f = curr[k]; - curr[k] = all; - if (f !== all) out.push(k); - } - // remove from dimensional indices - for(k in indices)indices[k].remove(n, map); - this.reindex(pulse, n, map); - return map; - }, - // reindex filters and indices after propagation completes - reindex (pulse, num, map) { - const indices = this._indices, bits = this.value; - pulse.runAfter(()=>{ - const indexMap = bits.remove(num, map); - for(const key in indices)indices[key].reindex(indexMap); - }); - }, - update (_, pulse, output) { - const dims = this._dims, query = _.query, stamp = pulse.stamp, m = dims.length; - let mask = 0, i, q; - // survey how many queries have changed - output.filters = 0; - for(q = 0; q < m; ++q)if (_.modified('query', q)) { - i = q; - ++mask; - } - if (mask === 1) { - // only one query changed, use more efficient update - mask = dims[i].one; - this.incrementOne(dims[i], query[i], output.add, output.rem); - } else // multiple queries changed, perform full record keeping - for(q = 0, mask = 0; q < m; ++q){ - if (!_.modified('query', q)) continue; - mask |= dims[q].one; - this.incrementAll(dims[q], query[q], stamp, output.add); - output.rem = output.add; // duplicate add/rem for downstream resolve - } - return mask; - }, - incrementAll (dim, query, stamp, out) { - const bits = this.value, seen = bits.seen(), curr = bits.curr(), prev = bits.prev(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - if (seen[k] !== stamp) { - prev[k] = curr[k]; - seen[k] = stamp; - out.push(k); - } - curr[k] ^= one; - } - dim.range = query.slice(); - }, - incrementOne (dim, query, add, rem) { - const bits = this.value, curr = bits.curr(), index = dim.index(), old = dim.bisect(dim.range), range = dim.bisect(query), lo1 = range[0], hi1 = range[1], lo0 = old[0], hi0 = old[1], one = dim.one; - let i, j, k; - // Fast incremental update based on previous lo index. - if (lo1 < lo0) for(i = lo1, j = Math.min(lo0, hi1); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (lo1 > lo0) for(i = lo0, j = Math.min(lo1, hi0); i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - // Fast incremental update based on previous hi index. - if (hi1 > hi0) for(i = Math.max(lo1, hi0), j = hi1; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - add.push(k); - } - else if (hi1 < hi0) for(i = Math.max(lo0, hi1), j = hi0; i < j; ++i){ - k = index[i]; - curr[k] ^= one; - rem.push(k); - } - dim.range = query.slice(); - } -}); -/** - * Selectively filters tuples by resolving against a filter bitmap. - * Useful for processing the output of a cross-filter transform. - * @constructor - * @param {object} params - The parameters for this operator. - * @param {object} params.ignore - A bit mask indicating which filters to ignore. - * @param {object} params.filter - The per-tuple filter bitmaps. Typically this - * parameter value is a reference to a {@link CrossFilter} transform. - */ function ResolveFilter(params) { - (0, _vegaDataflow.Transform).call(this, null, params); -} -ResolveFilter.Definition = { - 'type': 'ResolveFilter', - 'metadata': {}, - 'params': [ - { - 'name': 'ignore', - 'type': 'number', - 'required': true, - 'description': 'A bit mask indicating which filters to ignore.' - }, - { - 'name': 'filter', - 'type': 'object', - 'required': true, - 'description': 'Per-tuple filter bitmaps from a CrossFilter transform.' - } - ] -}; -(0, _vegaUtil.inherits)(ResolveFilter, (0, _vegaDataflow.Transform), { - transform (_, pulse) { - const ignore = ~(_.ignore || 0), // bit mask where zeros -> dims to ignore - bitmap = _.filter, mask = bitmap.mask; - // exit early if no relevant filter changes - if ((mask & ignore) === 0) return pulse.StopPropagation; - const output = pulse.fork(pulse.ALL), data = bitmap.data(), curr = bitmap.curr(), prev = bitmap.prev(), pass = (k)=>!(curr[k] & ignore) ? data[k] : null; - // propagate all mod tuples that pass the filter - output.filter(output.MOD, pass); - // determine add & rem tuples via filter functions - // for efficiency, we do *not* populate new arrays, - // instead we add filter functions applied downstream - if (!(mask & mask - 1)) { - // only one filter changed - output.filter(output.ADD, pass); - output.filter(output.REM, (k)=>(curr[k] & ignore) === mask ? data[k] : null); + const Generators = { + Literal: (n) => n.raw, + Identifier: (n) => { + const id2 = n.name; + if (memberDepth > 0) { + return id2; + } else if (has$1(forbidden, id2)) { + return error("Illegal identifier: " + id2); + } else if (has$1(constants2, id2)) { + return constants2[id2]; + } else if (has$1(allowed, id2)) { + return id2; } else { - // multiple filters changed - output.filter(output.ADD, (k)=>{ - const c = curr[k] & ignore, f = !c && c ^ prev[k] & ignore; - return f ? data[k] : null; - }); - output.filter(output.REM, (k)=>{ - const c = curr[k] & ignore, f = c && !(c ^ (c ^ prev[k] & ignore)); - return f ? data[k] : null; - }); - } - // add filter to source data in case of reflow... - return output.filter(output.SOURCE, (t)=>pass(t._index)); - } -}); - -},{"d3-array":"6IwJG","vega-dataflow":"3NitK","vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cGC2i":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "View", ()=>View); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _d3Array = require("d3-array"); -var _vegaFunctions = require("vega-functions"); -var _vegaRuntime = require("vega-runtime"); -var _d3Timer = require("d3-timer"); -var _vegaFormat = require("vega-format"); -// initialize aria role and label attributes -function initializeAria(view) { - const el = view.container(); - if (el) { - el.setAttribute('role', 'graphics-document'); - el.setAttribute('aria-roleDescription', 'visualization'); - ariaLabel(el, view.description()); - } -} -// update aria-label if we have a DOM container element -function ariaLabel(el, desc) { - if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc); -} -function background(view) { - // respond to background signal - view.add(null, (_)=>{ - view._background = _.bg; - view._resize = 1; - return _.bg; - }, { - bg: view._signals.background - }); -} -const Default = 'default'; -function cursor(view) { - // get cursor signal, add to dataflow if needed - const cursor = view._signals.cursor || (view._signals.cursor = view.add({ - user: Default, - item: null - })); - // evaluate cursor on each pointermove event - view.on(view.events('view', 'pointermove'), cursor, (_, event)=>{ - const value = cursor.value, user = value ? (0, _vegaUtil.isString)(value) ? value : value.user : Default, item = event.item && event.item.cursor || null; - return value && user === value.user && item == value.item ? value : { - user: user, - item: item - }; - }); - // when cursor signal updates, set visible cursor - view.add(null, function(_) { - let user = _.cursor, item = this.value; - if (!(0, _vegaUtil.isString)(user)) { - item = user.item; - user = user.user; - } - setCursor(view, user && user !== Default ? user : item || user); - return item; - }, { - cursor: cursor - }); -} -function setCursor(view, cursor) { - const el = view.globalCursor() ? typeof document !== 'undefined' && document.body : view.container(); - if (el) return cursor == null ? el.style.removeProperty('cursor') : el.style.cursor = cursor; -} -function dataref(view, name) { - var data = view._runtime.data; - if (!(0, _vegaUtil.hasOwnProperty)(data, name)) (0, _vegaUtil.error)('Unrecognized data set: ' + name); - return data[name]; -} -function data(name, values) { - return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, (0, _vegaDataflow.changeset)().remove((0, _vegaUtil.truthy)).insert(values)); -} -function change(name, changes) { - if (!(0, _vegaDataflow.isChangeSet)(changes)) (0, _vegaUtil.error)('Second argument to changes must be a changeset.'); - const dataset = dataref(this, name); - dataset.modified = true; - return this.pulse(dataset.input, changes); -} -function insert(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().insert(_)); -} -function remove(name, _) { - return change.call(this, name, (0, _vegaDataflow.changeset)().remove(_)); -} -function width(view) { - var padding = view.padding(); - return Math.max(0, view._viewWidth + padding.left + padding.right); -} -function height(view) { - var padding = view.padding(); - return Math.max(0, view._viewHeight + padding.top + padding.bottom); -} -function offset(view) { - var padding = view.padding(), origin = view._origin; - return [ - padding.left + origin[0], - padding.top + origin[1] - ]; -} -function resizeRenderer(view) { - var origin = offset(view), w = width(view), h = height(view); - view._renderer.background(view.background()); - view._renderer.resize(w, h, origin); - view._handler.origin(origin); - view._resizeListeners.forEach((handler)=>{ - try { - handler(w, h); - } catch (error) { - view.error(error); - } - }); -} -/** - * Extend an event with additional view-specific methods. - * Adds a new property ('vega') to an event that provides a number - * of methods for querying information about the current interaction. - * The vega object provides the following methods: - * view - Returns the backing View instance. - * item - Returns the currently active scenegraph item (if any). - * group - Returns the currently active scenegraph group (if any). - * This method accepts a single string-typed argument indicating the name - * of the desired parent group. The scenegraph will be traversed from - * the item up towards the root to search for a matching group. If no - * argument is provided the enclosing group for the active item is - * returned, unless the item it itself a group, in which case it is - * returned directly. - * xy - Returns a two-element array containing the x and y coordinates for - * mouse or touch events. For touch events, this is based on the first - * elements in the changedTouches array. This method accepts a single - * argument: either an item instance or mark name that should serve as - * the reference coordinate system. If no argument is provided the - * top-level view coordinate system is assumed. - * x - Returns the current x-coordinate, accepts the same arguments as xy. - * y - Returns the current y-coordinate, accepts the same arguments as xy. - * @param {Event} event - The input event to extend. - * @param {Item} item - The currently active scenegraph item (if any). - * @return {Event} - The extended input event. - */ function eventExtend(view, event, item) { - var r = view._renderer, el = r && r.canvas(), p, e, translate; - if (el) { - translate = offset(view); - e = event.changedTouches ? event.changedTouches[0] : event; - p = (0, _vegaScenegraph.point)(e, el); - p[0] -= translate[0]; - p[1] -= translate[1]; - } - event.dataflow = view; - event.item = item; - event.vega = extension(view, item, p); - return event; -} -function extension(view, item, point) { - const itemGroup = item ? item.mark.marktype === 'group' ? item : item.mark.group : null; - function group(name) { - var g = itemGroup, i; - if (name) { - for(i = item; i; i = i.mark.group)if (i.mark.name === name) { - g = i; - break; - } + globals[id2] = 1; + return outputGlobal(id2); } - return g && g.mark && g.mark.interactive ? g : {}; - } - function xy(item) { - if (!item) return point; - if ((0, _vegaUtil.isString)(item)) item = group(item); - const p = point.slice(); - while(item){ - p[0] -= item.x || 0; - p[1] -= item.y || 0; - item = item.mark && item.mark.group; + }, + MemberExpression: (n) => { + const d = !n.computed, o = visit2(n.object); + if (d) memberDepth += 1; + const p = visit2(n.property); + if (o === fieldvar) { + fields[stripQuotes(p)] = 1; + } + if (d) memberDepth -= 1; + return o + (d ? "." + p : "[" + p + "]"); + }, + CallExpression: (n) => { + if (n.callee.type !== "Identifier") { + error("Illegal callee type: " + n.callee.type); } - return p; - } - return { - view: (0, _vegaUtil.constant)(view), - item: (0, _vegaUtil.constant)(item || {}), - group: group, - xy: xy, - x: (item)=>xy(item)[0], - y: (item)=>xy(item)[1] - }; -} -const VIEW = 'view', TIMER = 'timer', WINDOW = 'window', NO_TRAP = { - trap: false -}; -/** - * Initialize event handling configuration. - * @param {object} config - The configuration settings. - * @return {object} - */ function initializeEventConfig(config) { - const events = (0, _vegaUtil.extend)({ - defaults: {} - }, config); - const unpack = (obj, keys)=>{ - keys.forEach((k)=>{ - if ((0, _vegaUtil.isArray)(obj[k])) obj[k] = (0, _vegaUtil.toSet)(obj[k]); - }); + const callee = n.callee.name, args = n.arguments, fn = has$1(functions, callee) && functions[callee]; + if (!fn) error("Unrecognized function: " + callee); + return isFunction(fn) ? fn(args) : fn + "(" + args.map(visit2).join(",") + ")"; + }, + ArrayExpression: (n) => "[" + n.elements.map(visit2).join(",") + "]", + BinaryExpression: (n) => "(" + visit2(n.left) + " " + n.operator + " " + visit2(n.right) + ")", + UnaryExpression: (n) => "(" + n.operator + visit2(n.argument) + ")", + ConditionalExpression: (n) => "(" + visit2(n.test) + "?" + visit2(n.consequent) + ":" + visit2(n.alternate) + ")", + LogicalExpression: (n) => "(" + visit2(n.left) + n.operator + visit2(n.right) + ")", + ObjectExpression: (n) => { + for (const prop of n.properties) { + const keyName = prop.key.name; + if (DisallowedObjectProperties.has(keyName)) { + error("Illegal property: " + keyName); + } + } + return "{" + n.properties.map(visit2).join(",") + "}"; + }, + Property: (n) => { + memberDepth += 1; + const k = visit2(n.key); + memberDepth -= 1; + return k + ":" + visit2(n.value); + } }; - unpack(events.defaults, [ - 'prevent', - 'allow' - ]); - unpack(events, [ - 'view', - 'window', - 'selector' - ]); - return events; -} -function trackEventListener(view, sources, type, handler) { - view._eventListeners.push({ - type: type, - sources: (0, _vegaUtil.array)(sources), - handler: handler - }); -} -function prevent(view, type) { - var def = view._eventConfig.defaults, prevent = def.prevent, allow = def.allow; - return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault(); -} -function permit(view, key, type) { - const rule = view._eventConfig && view._eventConfig[key]; - if (rule === false || (0, _vegaUtil.isObject)(rule) && !rule[type]) { - view.warn(`Blocked ${key} ${type} event listener.`); - return false; + function codegen2(ast) { + const result = { + code: visit2(ast), + globals: Object.keys(globals), + fields: Object.keys(fields) + }; + globals = {}; + fields = {}; + return result; + } + codegen2.functions = functions; + codegen2.constants = constants2; + return codegen2; + } + const SELECTION_GETTER = Symbol("vega_selection_getter"); + function getter(f) { + if (!f.getter || !f.getter[SELECTION_GETTER]) { + f.getter = field$1(f.field); + f.getter[SELECTION_GETTER] = true; } - return true; -} -/** - * Create a new event stream from an event source. - * @param {object} source - The event source to monitor. - * @param {string} type - The event type. - * @param {function(object): boolean} [filter] - Event filter function. - * @return {EventStream} - */ function events(source, type, filter) { - var view = this, s = new (0, _vegaDataflow.EventStream)(filter), send = function(e, item) { - view.runAsync(null, ()=>{ - if (source === VIEW && prevent(view, type)) e.preventDefault(); - s.receive(eventExtend(view, e, item)); - }); - }, sources; - if (source === TIMER) { - if (permit(view, 'timer', type)) view.timer(send, type); - } else if (source === VIEW) { - if (permit(view, 'view', type)) // send traps errors, so use {trap: false} option - view.addEventListener(type, send, NO_TRAP); - } else { - if (source === WINDOW) { - if (permit(view, 'window', type) && typeof window !== 'undefined') sources = [ - window - ]; - } else if (typeof document !== 'undefined') { - if (permit(view, 'selector', type)) sources = Array.from(document.querySelectorAll(source)); - } - if (!sources) view.warn('Can not resolve event source: ' + source); - else { - for(var i = 0, n = sources.length; i < n; ++i)sources[i].addEventListener(type, send); - trackEventListener(view, sources, type, send); + return f.getter; + } + const Intersect = "intersect"; + const Union = "union"; + const VlMulti = "vlMulti"; + const VlPoint = "vlPoint"; + const Or = "or"; + const And = "and"; + const SelectionId = "_vgsid_"; + const $selectionId = field$1(SelectionId); + const TYPE_ENUM = "E", TYPE_RANGE_INC = "R", TYPE_RANGE_EXC = "R-E", TYPE_RANGE_LE = "R-LE", TYPE_RANGE_RE = "R-RE", TYPE_PRED_LT = "E-LT", TYPE_PRED_LTE = "E-LTE", TYPE_PRED_GT = "E-GT", TYPE_PRED_GTE = "E-GTE", TYPE_PRED_VALID = "E-VALID", TYPE_PRED_ONE_OF = "E-ONE", UNIT_INDEX = "index:unit"; + function testPoint(datum2, entry2) { + var fields = entry2.fields, values2 = entry2.values, n = fields.length, i = 0, dval, f; + for (; i < n; ++i) { + f = fields[i]; + dval = getter(f)(datum2); + if (isDate$1(dval)) dval = toNumber(dval); + if (isDate$1(values2[i])) values2[i] = toNumber(values2[i]); + if (isArray(values2[i]) && isDate$1(values2[i][0])) values2[i] = values2[i].map(toNumber); + if (f.type === TYPE_ENUM) { + if (isArray(values2[i]) ? !values2[i].includes(dval) : dval !== values2[i]) { + return false; + } + } else { + if (f.type === TYPE_RANGE_INC) { + if (!inrange(dval, values2[i])) return false; + } else if (f.type === TYPE_RANGE_RE) { + if (!inrange(dval, values2[i], true, false)) return false; + } else if (f.type === TYPE_RANGE_EXC) { + if (!inrange(dval, values2[i], false, false)) return false; + } else if (f.type === TYPE_RANGE_LE) { + if (!inrange(dval, values2[i], false, true)) return false; + } else if (f.type === TYPE_PRED_LT) { + if (dval >= values2[i]) return false; + } else if (f.type === TYPE_PRED_LTE) { + if (dval > values2[i]) return false; + } else if (f.type === TYPE_PRED_GT) { + if (dval <= values2[i]) return false; + } else if (f.type === TYPE_PRED_GTE) { + if (dval < values2[i]) return false; + } else if (f.type === TYPE_PRED_VALID) { + if (dval === null || isNaN(dval)) return false; + } else if (f.type === TYPE_PRED_ONE_OF) { + if (values2[i].indexOf(dval) === -1) return false; } + } } - return s; -} -function itemFilter(event) { - return event.item; -} -function markTarget(event) { - // grab upstream collector feeding the mark operator - return event.item.mark.source; -} -function invoke(name) { - return function(_, event) { - return event.vega.view().changeset().encode(event.item, name); - }; -} -function hover(hoverSet, leaveSet) { - hoverSet = [ - hoverSet || 'hover' - ]; - leaveSet = [ - leaveSet || 'update', - hoverSet[0] - ]; - // invoke hover set upon pointerover - this.on(this.events('view', 'pointerover', itemFilter), markTarget, invoke(hoverSet)); - // invoke leave set upon pointerout - this.on(this.events('view', 'pointerout', itemFilter), markTarget, invoke(leaveSet)); - return this; -} -/** - * Finalize a View instance that is being removed. - * Cancel any running timers. - * Remove all external event listeners. - * Remove any currently displayed tooltip. - */ function finalize() { - var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m, e, h, t; - n = timers.length; - while(--n >= 0)timers[n].stop(); - n = listeners.length; - while(--n >= 0){ - e = listeners[n]; - m = e.sources.length; - while(--m >= 0)e.sources[m].removeEventListener(e.type, e.handler); - } - if (tooltip) tooltip.call(this, this._handler, null, null, null); - // turn off all registered handlers - n = handlers.length; - while(--n >= 0){ - t = handlers[n].type; - h = handlers[n].handler; - this._handler.off(t, h); + return true; + } + function selectionTest(name, datum2, op) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, n = entries.length, i = 0, entry2, miss, count2, unit2, b2; + for (; i < n; ++i) { + entry2 = entries[i]; + if (unitIdx && intersect2) { + miss = miss || {}; + count2 = miss[unit2 = entry2.unit] || 0; + if (count2 === -1) continue; + b2 = testPoint(datum2, entry2); + miss[unit2] = b2 ? -1 : ++count2; + if (b2 && unitIdx.size === 1) return true; + if (!b2 && count2 === unitIdx.get(unit2).count) return false; + } else { + b2 = testPoint(datum2, entry2); + if (intersect2 ^ b2) return b2; + } } - return this; -} -function element(tag, attr, text) { - const el = document.createElement(tag); - for(const key in attr)el.setAttribute(key, attr[key]); - if (text != null) el.textContent = text; - return el; -} -const BindClass = 'vega-bind', NameClass = 'vega-bind-name', RadioClass = 'vega-bind-radio'; -/** - * Bind a signal to an external HTML input element. The resulting two-way - * binding will propagate input changes to signals, and propagate signal - * changes to the input element state. If this view instance has no parent - * element, we assume the view is headless and no bindings are created. - * @param {Element|string} el - The parent DOM element to which the input - * element should be appended as a child. If string-valued, this argument - * will be treated as a CSS selector. If null or undefined, the parent - * element of this view will be used as the element. - * @param {object} param - The binding parameters which specify the signal - * to bind to, the input element type, and type-specific configuration. - * @return {View} - This view instance. - */ function bind(view, el, binding) { - if (!el) return; - const param = binding.param; - let bind = binding.state; - if (!bind) { - bind = binding.state = { - elements: null, - active: false, - set: null, - update: (value)=>{ - if (value != view.signal(param.signal)) view.runAsync(null, ()=>{ - bind.source = true; - view.signal(param.signal, value); - }); - } - }; - if (param.debounce) bind.update = (0, _vegaUtil.debounce)(param.debounce, bind.update); + return n && intersect2; + } + const bisect = bisector($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; + function selectionIdTest(name, datum2, op) { + const data2 = this.context.data[name], entries = data2 ? data2.values.value : [], unitIdx = data2 ? data2[UNIT_INDEX] && data2[UNIT_INDEX].value : void 0, intersect2 = op === Intersect, value2 = $selectionId(datum2), index2 = bisectLeft(entries, value2); + if (index2 === entries.length) return false; + if ($selectionId(entries[index2]) !== value2) return false; + if (unitIdx && intersect2) { + if (unitIdx.size === 1) return true; + if (bisectRight(entries, value2) - index2 < unitIdx.size) return false; } - const create = param.input == null && param.element ? target : generate; - create(bind, el, param, view); - if (!bind.active) { - view.on(view._signals[param.signal], null, ()=>{ - bind.source ? bind.source = false : bind.set(view.signal(param.signal)); - }); - bind.active = true; - } - return bind; -} -/** - * Bind the signal to an external EventTarget. - */ function target(bind, node, param, view) { - const type = param.event || 'input'; - const handler = ()=>bind.update(node.value); - // initialize signal value to external input value - view.signal(param.signal, node.value); - // listen for changes on the element - node.addEventListener(type, handler); - // register with view, so we can remove it upon finalization - trackEventListener(view, node, type, handler); - // propagate change to element - bind.set = (value)=>{ - node.value = value; - node.dispatchEvent(event(type)); - }; -} -function event(type) { - return typeof Event !== 'undefined' ? new Event(type) : { - type - }; -} -/** - * Generate an HTML input form element and bind it to a signal. - */ function generate(bind, el, param, view) { - const value = view.signal(param.signal); - const div = element('div', { - 'class': BindClass - }); - const wrapper = param.input === 'radio' ? div : div.appendChild(element('label')); - wrapper.appendChild(element('span', { - 'class': NameClass - }, param.name || param.signal)); - el.appendChild(div); - let input = form; - switch(param.input){ - case 'checkbox': - input = checkbox; - break; - case 'select': - input = select; - break; - case 'radio': - input = radio; - break; - case 'range': - input = range; - break; + return true; + } + function selectionTuples(array2, base2) { + if (!isArray(array2)) { + error("First argument to selectionTuples must be an array."); } - input(bind, wrapper, param, value); -} -/** - * Generates an arbitrary input form element. - * The input type is controlled via user-provided parameters. - */ function form(bind, el, param, value) { - const node = element('input'); - for(const key in param)if (key !== 'signal' && key !== 'element') node.setAttribute(key === 'input' ? 'type' : key, param[key]); - node.setAttribute('name', param.signal); - node.value = value; - el.appendChild(node); - node.addEventListener('input', ()=>bind.update(node.value)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.value = value; -} -/** - * Generates a checkbox input element. - */ function checkbox(bind, el, param, value) { - const attr = { - type: 'checkbox', - name: param.signal - }; - if (value) attr.checked = true; - const node = element('input', attr); - el.appendChild(node); - node.addEventListener('change', ()=>bind.update(node.checked)); - bind.elements = [ - node - ]; - bind.set = (value)=>node.checked = !!value || null; -} -/** - * Generates a selection list input element. - */ function select(bind, el, param, value) { - const node = element('select', { - name: param.signal - }), labels = param.labels || []; - param.options.forEach((option, i)=>{ - const attr = { - value: option - }; - if (valuesEqual(option, value)) attr.selected = true; - node.appendChild(element('option', attr, (labels[i] || option) + '')); - }); - el.appendChild(node); - node.addEventListener('change', ()=>{ - bind.update(param.options[node.selectedIndex]); - }); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - for(let i = 0, n = param.options.length; i < n; ++i)if (valuesEqual(param.options[i], value)) { - node.selectedIndex = i; - return; - } - }; -} -/** - * Generates a radio button group. - */ function radio(bind, el, param, value) { - const group = element('span', { - 'class': RadioClass - }), labels = param.labels || []; - el.appendChild(group); - bind.elements = param.options.map((option, i)=>{ - const attr = { - type: 'radio', - name: param.signal, - value: option - }; - if (valuesEqual(option, value)) attr.checked = true; - const input = element('input', attr); - input.addEventListener('change', ()=>bind.update(option)); - const label = element('label', {}, (labels[i] || option) + ''); - label.prepend(input); - group.appendChild(label); - return input; - }); - bind.set = (value)=>{ - const nodes = bind.elements, n = nodes.length; - for(let i = 0; i < n; ++i)if (valuesEqual(nodes[i].value, value)) nodes[i].checked = true; - }; -} -/** - * Generates a slider input element. - */ function range(bind, el, param, value) { - value = value !== undefined ? value : (+param.max + +param.min) / 2; - const max = param.max != null ? param.max : Math.max(100, +value) || 100, min = param.min || Math.min(0, max, +value) || 0, step = param.step || (0, _d3Array.tickStep)(min, max, 100); - const node = element('input', { - type: 'range', - name: param.signal, - min: min, - max: max, - step: step - }); - node.value = value; - const span = element('span', {}, +value); - el.appendChild(node); - el.appendChild(span); - const update = ()=>{ - span.textContent = node.value; - bind.update(+node.value); - }; - // subscribe to both input and change - node.addEventListener('input', update); - node.addEventListener('change', update); - bind.elements = [ - node - ]; - bind.set = (value)=>{ - node.value = value; - span.textContent = value; - }; -} -function valuesEqual(a, b) { - return a === b || a + '' === b + ''; -} -function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { - r = r || new constructor(view.loader()); - return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); -} -function trap(view, fn) { - return !fn ? null : function() { - try { - fn.apply(this, arguments); - } catch (error) { - view.error(error); - } - }; -} -function initializeHandler(view, prevHandler, el, constructor) { - // instantiate scenegraph handler - const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); - // transfer event handlers - if (prevHandler) prevHandler.handlers().forEach((h)=>{ - handler.on(h.type, h.handler); - }); - return handler; -} -function initialize(el, elBind) { - const view = this, type = view._renderType, config = view._eventConfig.bind, module = (0, _vegaScenegraph.renderModule)(type); - // containing dom element - el = view._el = el ? lookup(view, el, true) : null; - // initialize aria attributes - initializeAria(view); - // select appropriate renderer & handler - if (!module) view.error('Unrecognized renderer type: ' + type); - const Handler = module.handler || (0, _vegaScenegraph.CanvasHandler), Renderer = el ? module.renderer : module.headless; - // initialize renderer and input handler - view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer); - view._handler = initializeHandler(view, view._handler, el, Handler); - view._redraw = true; - // initialize signal bindings - if (el && config !== 'none') { - elBind = elBind ? view._elBind = lookup(view, elBind, true) : el.appendChild(element('form', { - 'class': 'vega-bindings' - })); - view._bind.forEach((_)=>{ - if (_.param.element && config !== 'container') _.element = lookup(view, _.param.element, !!_.param.input); - }); - view._bind.forEach((_)=>{ - bind(view, _.element || elBind, _); - }); + if (!isObject$1(base2)) { + error("Second argument to selectionTuples must be an object."); } - return view; -} -function lookup(view, el, clear) { - if (typeof el === 'string') { - if (typeof document !== 'undefined') { - el = document.querySelector(el); - if (!el) { - view.error('Signal bind element not found: ' + el); - return null; - } - } else { - view.error('DOM document instance not found.'); - return null; + return array2.map((x2) => extend$1(base2.fields ? { + values: base2.fields.map((f) => getter(f)(x2.datum)) + } : { + [SelectionId]: $selectionId(x2.datum) + }, base2)); + } + function selectionResolve(name, op, isMulti, vl5) { + var data2 = this.context.data[name], entries = data2 ? data2.values.value : [], resolved = {}, multiRes = {}, types = {}, entry2, fields, values2, unit2, field2, value2, res, resUnit, type2, union2, n = entries.length, i = 0, j, m2; + for (; i < n; ++i) { + entry2 = entries[i]; + unit2 = entry2.unit; + fields = entry2.fields; + values2 = entry2.values; + if (fields && values2) { + for (j = 0, m2 = fields.length; j < m2; ++j) { + field2 = fields[j]; + res = resolved[field2.field] || (resolved[field2.field] = {}); + resUnit = res[unit2] || (res[unit2] = []); + types[field2.field] = type2 = field2.type.charAt(0); + union2 = ops[`${type2}_union`]; + res[unit2] = union2(resUnit, array$5(values2[j])); + } + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push(array$5(values2).reduce((obj, curr, j2) => (obj[fields[j2].field] = curr, obj), {})); + } + } else { + field2 = SelectionId; + value2 = $selectionId(entry2); + res = resolved[field2] || (resolved[field2] = {}); + resUnit = res[unit2] || (res[unit2] = []); + resUnit.push(value2); + if (isMulti) { + resUnit = multiRes[unit2] || (multiRes[unit2] = []); + resUnit.push({ + [SelectionId]: value2 + }); } + } } - if (el && clear) try { - el.textContent = ''; - } catch (e) { - el = null; - view.error(e); + op = op || Union; + if (resolved[SelectionId]) { + resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); + } else { + Object.keys(resolved).forEach((field3) => { + resolved[field3] = Object.keys(resolved[field3]).map((unit3) => resolved[field3][unit3]).reduce((acc, curr) => acc === void 0 ? curr : ops[`${types[field3]}_${op}`](acc, curr)); + }); } - return el; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ - }); -function padding(_) { - return (0, _vegaUtil.isObject)(_) ? { - top: number(_.top), - bottom: number(_.bottom), - left: number(_.left), - right: number(_.right) - } : paddingObject(number(_)); -} -/** - * Render the current scene in a headless fashion. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A Promise that resolves to a renderer. - */ async function renderHeadless(view, type, scaleFactor, opt) { - const module = (0, _vegaScenegraph.renderModule)(type), ctr = module && module.headless; - if (!ctr) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - await view.runAsync(); - return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); -} -/** - * Produce an image URL for the visualization. Depending on the type - * parameter, the generated URL contains data for either a PNG or SVG image. - * The URL can be used (for example) to download images of the visualization. - * This method is asynchronous, returning a Promise instance. - * @param {string} type - The image type. One of 'svg', 'png' or 'canvas'. - * The 'canvas' and 'png' types are synonyms for a PNG image. - * @return {Promise} - A promise that resolves to an image URL. - */ async function renderToImageURL(type, scaleFactor) { - if (type !== (0, _vegaScenegraph.RenderType).Canvas && type !== (0, _vegaScenegraph.RenderType).SVG && type !== (0, _vegaScenegraph.RenderType).PNG) (0, _vegaUtil.error)('Unrecognized image type: ' + type); - const r = await renderHeadless(this, type, scaleFactor); - return type === (0, _vegaScenegraph.RenderType).SVG ? toBlobURL(r.svg(), 'image/svg+xml') : r.canvas().toDataURL('image/png'); -} -function toBlobURL(data, mime) { - const blob = new Blob([ - data - ], { - type: mime - }); - return window.URL.createObjectURL(blob); -} -/** - * Produce a Canvas instance containing a rendered visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to a Canvas instance. - */ async function renderToCanvas(scaleFactor, opt) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).Canvas, scaleFactor, opt); - return r.canvas(); -} -/** - * Produce a rendered SVG string of the visualization. - * This method is asynchronous, returning a Promise instance. - * @return {Promise} - A promise that resolves to an SVG string. - */ async function renderToSVG(scaleFactor) { - const r = await renderHeadless(this, (0, _vegaScenegraph.RenderType).SVG, scaleFactor); - return r.svg(); -} -function runtime(view, spec, expr) { - return (0, _vegaRuntime.context)(view, (0, _vegaDataflow.transforms), (0, _vegaFunctions.functionContext), expr).parse(spec); -} -function scale(name) { - var scales = this._runtime.scales; - if (!(0, _vegaUtil.hasOwnProperty)(scales, name)) (0, _vegaUtil.error)('Unrecognized scale or projection: ' + name); - return scales[name].value; -} -var Width = 'width', Height = 'height', Padding = 'padding', Skip = { - skip: true -}; -function viewWidth(view, width) { - var a = view.autosize(), p = view.padding(); - return width - (a && a.contains === Padding ? p.left + p.right : 0); -} -function viewHeight(view, height) { - var a = view.autosize(), p = view.padding(); - return height - (a && a.contains === Padding ? p.top + p.bottom : 0); -} -function initializeResize(view) { - var s = view._signals, w = s[Width], h = s[Height], p = s[Padding]; - function resetSize() { - view._autosize = view._resize = 1; + entries = Object.keys(multiRes); + if (isMulti && entries.length) { + const key2 = vl5 ? VlPoint : VlMulti; + resolved[key2] = op === Union ? { + [Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), []) + } : { + [And]: entries.map((k) => ({ + [Or]: multiRes[k] + })) + }; } - // respond to width signal - view._resizeWidth = view.add(null, (_)=>{ - view._width = _.size; - view._viewWidth = viewWidth(view, _.size); - resetSize(); - }, { - size: w - }); - // respond to height signal - view._resizeHeight = view.add(null, (_)=>{ - view._height = _.size; - view._viewHeight = viewHeight(view, _.size); - resetSize(); - }, { - size: h - }); - // respond to padding signal - const resizePadding = view.add(null, resetSize, { - pad: p - }); - // set rank to run immediately after source signal - view._resizeWidth.rank = w.rank + 1; - view._resizeHeight.rank = h.rank + 1; - resizePadding.rank = p.rank + 1; -} -function resizeView(viewWidth, viewHeight, width, height, origin, auto) { - this.runAfter((view)=>{ - let rerun = 0; - // reset autosize flag - view._autosize = 0; - // width value changed: update signal, skip resize op - if (view.width() !== width) { - rerun = 1; - view.signal(Width, width, Skip); // set width, skip update calc - view._resizeWidth.skip(true); // skip width resize handler - } - // height value changed: update signal, skip resize op - if (view.height() !== height) { - rerun = 1; - view.signal(Height, height, Skip); // set height, skip update calc - view._resizeHeight.skip(true); // skip height resize handler - } - // view width changed: update view property, set resize flag - if (view._viewWidth !== viewWidth) { - view._resize = 1; - view._viewWidth = viewWidth; - } - // view height changed: update view property, set resize flag - if (view._viewHeight !== viewHeight) { - view._resize = 1; - view._viewHeight = viewHeight; - } - // origin changed: update view property, set resize flag - if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { - view._resize = 1; - view._origin = origin; - } - // run dataflow on width/height signal change - if (rerun) view.run('enter'); - if (auto) view.runAfter((v)=>v.resize()); - }, false, 1); -} -/** - * Get the current view state, consisting of signal values and/or data sets. - * @param {object} [options] - Options flags indicating which state to export. - * If unspecified, all signals and data sets will be exported. - * @param {function(string, Operator):boolean} [options.signals] - Optional - * predicate function for testing if a signal should be included in the - * exported state. If unspecified, all signals will be included, except for - * those named 'parent' or those which refer to a Transform value. - * @param {function(string, object):boolean} [options.data] - Optional - * predicate function for testing if a data set's input should be included - * in the exported state. If unspecified, all data sets that have been - * explicitly modified will be included. - * @param {boolean} [options.recurse=true] - Flag indicating if the exported - * state should recursively include state from group mark sub-contexts. - * @return {object} - An object containing the exported state values. - */ function getState(options) { - return this._runtime.getState(options || { - data: dataTest, - signals: signalTest, - recurse: true - }); -} -function dataTest(name, data) { - return data.modified && (0, _vegaUtil.isArray)(data.input.value) && !name.startsWith('_:vega:_'); -} -function signalTest(name, op) { - return !(name === 'parent' || op instanceof (0, _vegaDataflow.transforms).proxy); -} -/** - * Sets the current view state and updates the view by invoking run. - * @param {object} state - A state object containing signal and/or - * data set values, following the format used by the getState method. - * @return {View} - This view instance. - */ function setState(state) { - this.runAsync(null, (v)=>{ - v._trigger = false; - v._runtime.setState(state); - }, (v)=>{ - v._trigger = true; - }); - return this; -} -function timer(callback, delay) { - function tick(elapsed) { - callback({ - timestamp: Date.now(), - elapsed: elapsed - }); + return resolved; + } + var ops = { + [`${SelectionId}_union`]: union, + [`${SelectionId}_intersect`]: intersection, + E_union: function(base2, value2) { + if (!base2.length) return value2; + var i = 0, n = value2.length; + for (; i < n; ++i) if (!base2.includes(value2[i])) base2.push(value2[i]); + return base2; + }, + E_intersect: function(base2, value2) { + return !base2.length ? value2 : base2.filter((v) => value2.includes(v)); + }, + R_union: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (base2[0] > lo) base2[0] = lo; + if (base2[1] < hi) base2[1] = hi; + return base2; + }, + R_intersect: function(base2, value2) { + var lo = toNumber(value2[0]), hi = toNumber(value2[1]); + if (lo > hi) { + lo = value2[1]; + hi = value2[0]; + } + if (!base2.length) return [lo, hi]; + if (hi < base2[0] || base2[1] < lo) { + return []; + } else { + if (base2[0] < lo) base2[0] = lo; + if (base2[1] > hi) base2[1] = hi; + } + return base2; } - this._timers.push((0, _d3Timer.interval)(tick, delay)); -} -function defaultTooltip(handler, event, item, value) { - const el = handler.element(); - if (el) el.setAttribute('title', formatTooltip(value)); -} -function formatTooltip(value) { - return value == null ? '' : (0, _vegaUtil.isArray)(value) ? formatArray(value) : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? formatObject(value) : value + ''; -} -function formatObject(obj) { - return Object.keys(obj).map((key)=>{ - const v = obj[key]; - return key + ': ' + ((0, _vegaUtil.isArray)(v) ? formatArray(v) : formatValue(v)); - }).join('\n'); -} -function formatArray(value) { - return '[' + value.map(formatValue).join(', ') + ']'; -} -function formatValue(value) { - return (0, _vegaUtil.isArray)(value) ? '[\u2026]' : (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isDate)(value) ? '{\u2026}' : value; -} -function watchPixelRatio() { - // based on https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio#monitoring_screen_resolution_or_zoom_level_changes - if (this.renderer() === 'canvas' && this._renderer._canvas) { - let remove = null; - const updatePixelRatio = ()=>{ - if (remove != null) remove(); - const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); - media.addEventListener('change', updatePixelRatio); - remove = ()=>{ - media.removeEventListener('change', updatePixelRatio); - }; - this._renderer._canvas.getContext('2d').pixelRatio = window.devicePixelRatio || 1; - this._redraw = true; - this._resize = 1; - this.resize().runAsync(); - }; - updatePixelRatio(); - } -} -/** - * Create a new View instance from a Vega dataflow runtime specification. - * The generated View will not immediately be ready for display. Callers - * should also invoke the initialize method (e.g., to set the parent - * DOM element in browser-based deployment) and then invoke the run - * method to evaluate the dataflow graph. Rendering will automatically - * be performed upon dataflow runs. - * @constructor - * @param {object} spec - The Vega dataflow runtime specification. - */ function View(spec, options) { - const view = this; - options = options || {}; - (0, _vegaDataflow.Dataflow).call(view); - if (options.loader) view.loader(options.loader); - if (options.logger) view.logger(options.logger); - if (options.logLevel != null) view.logLevel(options.logLevel); - if (options.locale || spec.locale) { - const loc = (0, _vegaUtil.extend)({}, spec.locale, options.locale); - view.locale((0, _vegaFormat.locale)(loc.number, loc.time)); + }; + const DataPrefix$1 = ":", IndexPrefix$1 = "@"; + function selectionVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to selection functions must be a string literal."); + const data2 = args[0].value, op = args.length >= 2 && peek$1(args).value, field2 = "unit", indexName = IndexPrefix$1 + field2, dataName = DataPrefix$1 + data2; + if (op === Intersect && !has$1(params2, indexName)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); } - view._el = null; - view._elBind = null; - view._renderType = options.renderer || (0, _vegaScenegraph.RenderType).Canvas; - view._scenegraph = new (0, _vegaScenegraph.Scenegraph)(); - const root = view._scenegraph.root; - // initialize renderer, handler and event management - view._renderer = null; - view._tooltip = options.tooltip || defaultTooltip, view._redraw = true; - view._handler = new (0, _vegaScenegraph.CanvasHandler)().scene(root); - view._globalCursor = false; - view._preventDefault = false; - view._timers = []; - view._eventListeners = []; - view._resizeListeners = []; - // initialize event configuration - view._eventConfig = initializeEventConfig(spec.eventConfig); - view.globalCursor(view._eventConfig.globalCursor); - // initialize dataflow graph - const ctx = runtime(view, spec, options.expr); - view._runtime = ctx; - view._signals = ctx.signals; - view._bind = (spec.bindings || []).map((_)=>({ - state: null, - param: (0, _vegaUtil.extend)({}, _) - })); - // initialize scenegraph - if (ctx.root) ctx.root.set(root); - root.source = ctx.data.root.input; - view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); - // initialize view size - view._width = view.width(); - view._height = view.height(); - view._viewWidth = viewWidth(view, view._width); - view._viewHeight = viewHeight(view, view._height); - view._origin = [ - 0, - 0 - ]; - view._resize = 0; - view._autosize = 1; - initializeResize(view); - // initialize background color - background(view); - // initialize cursor - cursor(view); - // initialize view description - view.description(spec.description); - // initialize hover proessing, if requested - if (options.hover) view.hover(); - // initialize DOM container(s) and renderer - if (options.container) view.initialize(options.container, options.bind); - if (options.watchPixelRatio) view._watchPixelRatio(); -} -function lookupSignal(view, name) { - return (0, _vegaUtil.hasOwnProperty)(view._signals, name) ? view._signals[name] : (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); -} -function findOperatorHandler(op, handler) { - const h = (op._targets || []).filter((op)=>op._update && op._update.handler === handler); - return h.length ? h[0] : null; -} -function addOperatorListener(view, name, op, handler) { - let h = findOperatorHandler(op, handler); - if (!h) { - h = trap(view, ()=>handler(name, op.value)); - h.handler = handler; - view.on(op, null, h); + if (!has$1(params2, dataName)) { + params2[dataName] = scope.getData(data2).tuplesRef(); } - return view; -} -function removeOperatorListener(view, op, handler) { - const h = findOperatorHandler(op, handler); - if (h) op._targets.remove(h); - return view; -} -(0, _vegaUtil.inherits)(View, (0, _vegaDataflow.Dataflow), { - // -- DATAFLOW / RENDERING ---- - async evaluate (encode, prerun, postrun) { - // evaluate dataflow and prerun - await (0, _vegaDataflow.Dataflow).prototype.evaluate.call(this, encode, prerun); - // render as needed - if (this._redraw || this._resize) try { - if (this._renderer) { - if (this._resize) { - this._resize = 0; - resizeRenderer(this); - } - await this._renderer.renderAsync(this._scenegraph.root); - } - this._redraw = false; - } catch (e) { - this.error(e); - } - // evaluate postrun - if (postrun) (0, _vegaDataflow.asyncCallback)(this, postrun); - return this; - }, - dirty (item) { - this._redraw = true; - this._renderer && this._renderer.dirty(item); - }, - // -- GET / SET ---- - description (text) { - if (arguments.length) { - const desc = text != null ? text + '' : null; - if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); - return this; - } - return this._desc; - }, - container () { - return this._el; - }, - scenegraph () { - return this._scenegraph; - }, - origin () { - return this._origin.slice(); - }, - signal (name, value, options) { - const op = lookupSignal(this, name); - return arguments.length === 1 ? op.value : this.update(op, value, options); - }, - width (_) { - return arguments.length ? this.signal('width', _) : this.signal('width'); - }, - height (_) { - return arguments.length ? this.signal('height', _) : this.signal('height'); - }, - padding (_) { - return arguments.length ? this.signal('padding', padding(_)) : padding(this.signal('padding')); - }, - autosize (_) { - return arguments.length ? this.signal('autosize', _) : this.signal('autosize'); - }, - background (_) { - return arguments.length ? this.signal('background', _) : this.signal('background'); - }, - renderer (type) { - if (!arguments.length) return this._renderType; - if (!(0, _vegaScenegraph.renderModule)(type)) (0, _vegaUtil.error)('Unrecognized renderer type: ' + type); - if (type !== this._renderType) { - this._renderType = type; - this._resetRenderer(); - } - return this; - }, - tooltip (handler) { - if (!arguments.length) return this._tooltip; - if (handler !== this._tooltip) { - this._tooltip = handler; - this._resetRenderer(); - } - return this; - }, - loader (loader) { - if (!arguments.length) return this._loader; - if (loader !== this._loader) { - (0, _vegaDataflow.Dataflow).prototype.loader.call(this, loader); - this._resetRenderer(); - } - return this; - }, - resize () { - // set flag to perform autosize - this._autosize = 1; - // touch autosize signal to ensure top-level ViewLayout runs - return this.touch(lookupSignal(this, 'autosize')); - }, - _resetRenderer () { - if (this._renderer) { - this._renderer = null; - this.initialize(this._el, this._elBind); - } - }, - // -- SIZING ---- - _resizeView: resizeView, - // -- EVENT HANDLING ---- - addEventListener (type, handler, options) { - let callback = handler; - if (!(options && options.trap === false)) { - // wrap callback in error handler - callback = trap(this, handler); - callback.raw = handler; - } - this._handler.on(type, callback); - return this; - }, - removeEventListener (type, handler) { - var handlers = this._handler.handlers(type), i = handlers.length, h, t; - // search registered handlers, remove if match found - while(--i >= 0){ - t = handlers[i].type; - h = handlers[i].handler; - if (type === t && (handler === h || handler === h.raw)) { - this._handler.off(t, h); - break; - } - } - return this; - }, - addResizeListener (handler) { - const l = this._resizeListeners; - if (!l.includes(handler)) // add handler if it isn't already registered - // note: error trapping handled elsewhere, so - // no need to wrap handlers here - l.push(handler); - return this; - }, - removeResizeListener (handler) { - var l = this._resizeListeners, i = l.indexOf(handler); - if (i >= 0) l.splice(i, 1); - return this; - }, - addSignalListener (name, handler) { - return addOperatorListener(this, name, lookupSignal(this, name), handler); - }, - removeSignalListener (name, handler) { - return removeOperatorListener(this, lookupSignal(this, name), handler); - }, - addDataListener (name, handler) { - return addOperatorListener(this, name, dataref(this, name).values, handler); - }, - removeDataListener (name, handler) { - return removeOperatorListener(this, dataref(this, name).values, handler); - }, - globalCursor (_) { - if (arguments.length) { - if (this._globalCursor !== !!_) { - const prev = setCursor(this, null); // clear previous cursor - this._globalCursor = !!_; - if (prev) setCursor(this, prev); // swap cursor - } - return this; - } else return this._globalCursor; - }, - preventDefault (_) { - if (arguments.length) { - this._preventDefault = _; - return this; - } else return this._preventDefault; - }, - timer, - events, - finalize, - hover, - // -- DATA ---- - data, - change, - insert, - remove, - // -- SCALES -- - scale, - // -- INITIALIZATION ---- - initialize, - // -- HEADLESS RENDERING ---- - toImageURL: renderToImageURL, - toCanvas: renderToCanvas, - toSVG: renderToSVG, - // -- SAVE / RESTORE STATE ---- - getState, - setState, - // RE-RENDER ON ZOOM - _watchPixelRatio: watchPixelRatio -}); - -},{"vega-util":"bApja","vega-dataflow":"3NitK","vega-scenegraph":"jattk","d3-array":"6IwJG","vega-functions":"iuqsd","vega-runtime":"k7ppL","d3-timer":"d15bJ","vega-format":"47kOt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iuqsd":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DataPrefix", ()=>DataPrefix); -parcelHelpers.export(exports, "IndexPrefix", ()=>IndexPrefix); -parcelHelpers.export(exports, "ScalePrefix", ()=>ScalePrefix); -parcelHelpers.export(exports, "SignalPrefix", ()=>SignalPrefix); -parcelHelpers.export(exports, "bandspace", ()=>bandspace); -parcelHelpers.export(exports, "bandwidth", ()=>bandwidth); -parcelHelpers.export(exports, "codeGenerator", ()=>codeGenerator); -parcelHelpers.export(exports, "codegenParams", ()=>codegenParams); -parcelHelpers.export(exports, "containerSize", ()=>containerSize); -parcelHelpers.export(exports, "contrast", ()=>contrast); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "data", ()=>data); -parcelHelpers.export(exports, "dataVisitor", ()=>dataVisitor); -parcelHelpers.export(exports, "dayAbbrevFormat", ()=>dayAbbrevFormat); -parcelHelpers.export(exports, "dayFormat", ()=>dayFormat); -parcelHelpers.export(exports, "debug", ()=>debug); -parcelHelpers.export(exports, "domain", ()=>domain); -parcelHelpers.export(exports, "encode", ()=>encode); -parcelHelpers.export(exports, "expressionFunction", ()=>expressionFunction); -parcelHelpers.export(exports, "format", ()=>format); -parcelHelpers.export(exports, "functionContext", ()=>functionContext); -parcelHelpers.export(exports, "geoArea", ()=>geoArea); -parcelHelpers.export(exports, "geoBounds", ()=>geoBounds); -parcelHelpers.export(exports, "geoCentroid", ()=>geoCentroid); -parcelHelpers.export(exports, "geoScale", ()=>geoScale); -parcelHelpers.export(exports, "geoShape", ()=>geoShape); -parcelHelpers.export(exports, "inScope", ()=>inScope); -parcelHelpers.export(exports, "indata", ()=>indata); -parcelHelpers.export(exports, "indataVisitor", ()=>indataVisitor); -parcelHelpers.export(exports, "indexof", ()=>indexof); -parcelHelpers.export(exports, "info", ()=>info); -parcelHelpers.export(exports, "invert", ()=>invert); -parcelHelpers.export(exports, "join", ()=>join); -parcelHelpers.export(exports, "lastindexof", ()=>lastindexof); -parcelHelpers.export(exports, "luminance", ()=>luminance); -parcelHelpers.export(exports, "merge", ()=>merge); -parcelHelpers.export(exports, "modify", ()=>modify); -parcelHelpers.export(exports, "monthAbbrevFormat", ()=>monthAbbrevFormat); -parcelHelpers.export(exports, "monthFormat", ()=>monthFormat); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -parcelHelpers.export(exports, "pathShape", ()=>pathShape); -parcelHelpers.export(exports, "pinchAngle", ()=>pinchAngle); -parcelHelpers.export(exports, "pinchDistance", ()=>pinchDistance); -parcelHelpers.export(exports, "pluck", ()=>pluck); -parcelHelpers.export(exports, "range", ()=>range); -parcelHelpers.export(exports, "replace", ()=>replace); -parcelHelpers.export(exports, "reverse", ()=>reverse); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "scaleGradient", ()=>scaleGradient); -parcelHelpers.export(exports, "scaleVisitor", ()=>scaleVisitor); -parcelHelpers.export(exports, "screen", ()=>screen); -parcelHelpers.export(exports, "setdata", ()=>setdata); -parcelHelpers.export(exports, "slice", ()=>slice); -parcelHelpers.export(exports, "sort", ()=>sort); -parcelHelpers.export(exports, "timeFormat", ()=>timeFormat); -parcelHelpers.export(exports, "timeParse", ()=>timeParse); -parcelHelpers.export(exports, "treeAncestors", ()=>treeAncestors); -parcelHelpers.export(exports, "treePath", ()=>treePath); -parcelHelpers.export(exports, "utcFormat", ()=>utcFormat); -parcelHelpers.export(exports, "utcParse", ()=>utcParse); -parcelHelpers.export(exports, "warn", ()=>warn); -parcelHelpers.export(exports, "windowSize", ()=>windowSize); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -var _vegaScale = require("vega-scale"); -var _d3Geo = require("d3-geo"); -var _d3Color = require("d3-color"); -var _vegaDataflow = require("vega-dataflow"); -var _vegaScenegraph = require("vega-scenegraph"); -var _vegaSelections = require("vega-selections"); -var _vegaStatistics = require("vega-statistics"); -var _vegaTime = require("vega-time"); -var _d3Array = require("d3-array"); -function data(name) { - const data = this.context.data[name]; - return data ? data.values.value : []; -} -function indata(name, field, value) { - const index = this.context.data[name]['index:' + field], entry = index ? index.value.get(value) : undefined; - return entry ? entry.count : entry; -} -function setdata(name, tuples) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input; - df.pulse(input, df.changeset().remove((0, _vegaUtil.truthy)).insert(tuples)); + } + function data$1(name) { + const data2 = this.context.data[name]; + return data2 ? data2.values.value : []; + } + function indata(name, field2, value2) { + const index2 = this.context.data[name]["index:" + field2], entry2 = index2 ? index2.value.get(value2) : void 0; + return entry2 ? entry2.count : entry2; + } + function setdata(name, tuples) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input; + df.pulse(input, df.changeset().remove(truthy).insert(tuples)); return 1; -} -function encode(item, name, retval) { + } + function encode(item, name, retval) { if (item) { - const df = this.context.dataflow, target = item.mark.source; - df.pulse(target, df.changeset().encode(item, name)); - } - return retval !== undefined ? retval : item; -} -const wrap = (method)=>function(value, spec) { - const locale = this.context.dataflow.locale(); - return value === null ? 'null' : locale[method](spec)(value); - }; -const format = wrap('format'); -const timeFormat = wrap('timeFormat'); -const utcFormat = wrap('utcFormat'); -const timeParse = wrap('timeParse'); -const utcParse = wrap('utcParse'); -const dateObj = new Date(2000, 0, 1); -function time(month, day, specifier) { - if (!Number.isInteger(month) || !Number.isInteger(day)) return ''; - dateObj.setYear(2000); + const df = this.context.dataflow, target2 = item.mark.source; + df.pulse(target2, df.changeset().encode(item, name)); + } + return retval !== void 0 ? retval : item; + } + const wrap = (method2) => function(value2, spec) { + const locale2 = this.context.dataflow.locale(); + return value2 === null ? "null" : locale2[method2](spec)(value2); + }; + const format = wrap("format"); + const timeFormat = wrap("timeFormat"); + const utcFormat = wrap("utcFormat"); + const timeParse = wrap("timeParse"); + const utcParse = wrap("utcParse"); + const dateObj = new Date(2e3, 0, 1); + function time(month, day, specifier) { + if (!Number.isInteger(month) || !Number.isInteger(day)) return ""; + dateObj.setYear(2e3); dateObj.setMonth(month); dateObj.setDate(day); return timeFormat.call(this, dateObj, specifier); -} -function monthFormat(month) { - return time.call(this, month, 1, '%B'); -} -function monthAbbrevFormat(month) { - return time.call(this, month, 1, '%b'); -} -function dayFormat(day) { - return time.call(this, 0, 2 + day, '%A'); -} -function dayAbbrevFormat(day) { - return time.call(this, 0, 2 + day, '%a'); -} -const DataPrefix = ':'; -const IndexPrefix = '@'; -const ScalePrefix = '%'; -const SignalPrefix = '$'; -function dataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to data functions must be a string literal.'); - const data = args[0].value, dataName = DataPrefix + data; - if (!(0, _vegaUtil.hasOwnProperty)(dataName, params)) try { - params[dataName] = scope.getData(data).tuplesRef(); - } catch (err) { - // if data set does not exist, there's nothing to track - } -} -function indataVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to indata must be a string literal.'); - if (args[1].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('Second argument to indata must be a string literal.'); - const data = args[0].value, field = args[1].value, indexName = IndexPrefix + field; - if (!(0, _vegaUtil.hasOwnProperty)(indexName, params)) params[indexName] = scope.getData(data).indataRef(scope, field); -} -function scaleVisitor(name, args, scope, params) { - if (args[0].type === (0, _vegaExpression.Literal)) // add scale dependency - addScaleDependency(scope, params, args[0].value); - else // indirect scale lookup; add all scales as parameters - for(name in scope.scales)addScaleDependency(scope, params, name); -} -function addScaleDependency(scope, params, name) { + } + function monthFormat(month) { + return time.call(this, month, 1, "%B"); + } + function monthAbbrevFormat(month) { + return time.call(this, month, 1, "%b"); + } + function dayFormat(day) { + return time.call(this, 0, 2 + day, "%A"); + } + function dayAbbrevFormat(day) { + return time.call(this, 0, 2 + day, "%a"); + } + const DataPrefix = ":"; + const IndexPrefix = "@"; + const ScalePrefix = "%"; + const SignalPrefix = "$"; + function dataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) { + error("First argument to data functions must be a string literal."); + } + const data2 = args[0].value, dataName = DataPrefix + data2; + if (!has$1(dataName, params2)) { + try { + params2[dataName] = scope.getData(data2).tuplesRef(); + } catch (err) { + } + } + } + function indataVisitor(name, args, scope, params2) { + if (args[0].type !== Literal) error("First argument to indata must be a string literal."); + if (args[1].type !== Literal) error("Second argument to indata must be a string literal."); + const data2 = args[0].value, field2 = args[1].value, indexName = IndexPrefix + field2; + if (!has$1(indexName, params2)) { + params2[indexName] = scope.getData(data2).indataRef(scope, field2); + } + } + function scaleVisitor(name, args, scope, params2) { + if (args[0].type === Literal) { + addScaleDependency(scope, params2, args[0].value); + } else { + for (name in scope.scales) { + addScaleDependency(scope, params2, name); + } + } + } + function addScaleDependency(scope, params2, name) { const scaleName = ScalePrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, scaleName)) try { - params[scaleName] = scope.scaleRef(name); - } catch (err) { - // TODO: error handling? warning? - } -} -/** - * Name must be a string. Return undefined if the scale is not registered. - */ function getScale(name, ctx) { - if ((0, _vegaUtil.isString)(name)) { - const maybeScale = ctx.scales[name]; - return maybeScale && (0, _vegaScale.isRegisteredScale)(maybeScale.value) ? maybeScale.value : undefined; - } - return undefined; -} -function internalScaleFunctions(codegen, fnctx, visitors) { - // add helper method to the 'this' expression function context - fnctx.__bandwidth = (s)=>s && s.bandwidth ? s.bandwidth() : 0; - // register AST visitors for internal scale functions + if (!has$1(params2, scaleName)) { + try { + params2[scaleName] = scope.scaleRef(name); + } catch (err) { + } + } + } + function getScale(nameOrFunction, ctx) { + if (isString(nameOrFunction)) { + const maybeScale = ctx.scales[nameOrFunction]; + return maybeScale && isRegisteredScale(maybeScale.value) ? maybeScale.value : void 0; + } else if (isFunction(nameOrFunction)) { + return isRegisteredScale(nameOrFunction) ? nameOrFunction : void 0; + } + return void 0; + } + function internalScaleFunctions(codegen2, fnctx, visitors) { + fnctx.__bandwidth = (s) => s && s.bandwidth ? s.bandwidth() : 0; visitors._bandwidth = scaleVisitor; visitors._range = scaleVisitor; visitors._scale = scaleVisitor; - // resolve scale reference directly to the signal hash argument - const ref = (arg)=>'_[' + (arg.type === (0, _vegaExpression.Literal) ? (0, _vegaUtil.stringValue)(ScalePrefix + arg.value) : (0, _vegaUtil.stringValue)(ScalePrefix) + '+' + codegen(arg)) + ']'; - // define and return internal scale function code generators - // these internal functions are called by mark encoders + const ref2 = (arg) => "_[" + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + "+" + codegen2(arg)) + "]"; return { - _bandwidth: (args)=>`this.__bandwidth(${ref(args[0])})`, - _range: (args)=>`${ref(args[0])}.range()`, - _scale: (args)=>`${ref(args[0])}(${codegen(args[1])})` - }; -} -function geoMethod(methodName, globalMethod) { - return function(projection, geojson, group) { - if (projection) { - // projection defined, use it - const p = getScale(projection, (group || this).context); - return p && p.path[methodName](geojson); - } else // projection undefined, use global method + _bandwidth: (args) => `this.__bandwidth(${ref2(args[0])})`, + _range: (args) => `${ref2(args[0])}.range()`, + _scale: (args) => `${ref2(args[0])}(${codegen2(args[1])})` + }; + } + function geoMethod(methodName, globalMethod) { + return function(projection2, geojson, group2) { + if (projection2) { + const p = getScale(projection2, (group2 || this).context); + return p && p.path[methodName](geojson); + } else { return globalMethod(geojson); + } }; -} -const geoArea = geoMethod('area', (0, _d3Geo.geoArea)); -const geoBounds = geoMethod('bounds', (0, _d3Geo.geoBounds)); -const geoCentroid = geoMethod('centroid', (0, _d3Geo.geoCentroid)); -function geoScale(projection, group) { - const p = getScale(projection, (group || this).context); + } + const geoArea = geoMethod("area", geoArea$1); + const geoBounds = geoMethod("bounds", geoBounds$1); + const geoCentroid = geoMethod("centroid", geoCentroid$1); + function geoScale(projection2, group2) { + const p = getScale(projection2, (group2 || this).context); return p && p.scale(); -} -function inScope(item) { - const group = this.context.group; - let value = false; - if (group) while(item){ - if (item === group) { - value = true; - break; - } - item = item.mark.group; + } + function inScope(item) { + const group2 = this.context.group; + let value2 = false; + if (group2) while (item) { + if (item === group2) { + value2 = true; + break; + } + item = item.mark.group; } - return value; -} -function log(df, method, args) { + return value2; + } + function log(df, method2, args) { try { - df[method].apply(df, [ - 'EXPRESSION' - ].concat([].slice.call(args))); + df[method2].apply(df, ["EXPRESSION"].concat([].slice.call(args))); } catch (err) { - df.warn(err); + df.warn(err); } return args[args.length - 1]; -} -function warn() { - return log(this.context.dataflow, 'warn', arguments); -} -function info() { - return log(this.context.dataflow, 'info', arguments); -} -function debug() { - return log(this.context.dataflow, 'debug', arguments); -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef -function channel_luminance_value(channelValue) { + } + function warn() { + return log(this.context.dataflow, "warn", arguments); + } + function info() { + return log(this.context.dataflow, "info", arguments); + } + function debug() { + return log(this.context.dataflow, "debug", arguments); + } + function channel_luminance_value(channelValue) { const val = channelValue / 255; - if (val <= 0.03928) return val / 12.92; + if (val <= 0.03928) { + return val / 12.92; + } return Math.pow((val + 0.055) / 1.055, 2.4); -} -function luminance(color) { - const c = (0, _d3Color.rgb)(color), r = channel_luminance_value(c.r), g = channel_luminance_value(c.g), b = channel_luminance_value(c.b); - return 0.2126 * r + 0.7152 * g + 0.0722 * b; -} -// https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef -function contrast(color1, color2) { + } + function luminance(color2) { + const c2 = rgb$1(color2), r = channel_luminance_value(c2.r), g = channel_luminance_value(c2.g), b2 = channel_luminance_value(c2.b); + return 0.2126 * r + 0.7152 * g + 0.0722 * b2; + } + function contrast(color1, color2) { const lum1 = luminance(color1), lum2 = luminance(color2), lumL = Math.max(lum1, lum2), lumD = Math.min(lum1, lum2); return (lumL + 0.05) / (lumD + 0.05); -} -function merge() { + } + function merge() { const args = [].slice.call(arguments); args.unshift({}); - return (0, _vegaUtil.extend)(...args); -} -function equal(a, b) { - return a === b || a !== a && b !== b ? true : (0, _vegaUtil.isArray)(a) ? (0, _vegaUtil.isArray)(b) && a.length === b.length ? equalArray(a, b) : false : (0, _vegaUtil.isObject)(a) && (0, _vegaUtil.isObject)(b) ? equalObject(a, b) : false; -} -function equalArray(a, b) { - for(let i = 0, n = a.length; i < n; ++i){ - if (!equal(a[i], b[i])) return false; + return extend$1(...args); + } + function equal(a2, b2) { + return a2 === b2 || a2 !== a2 && b2 !== b2 ? true : isArray(a2) ? isArray(b2) && a2.length === b2.length ? equalArray(a2, b2) : false : isObject$1(a2) && isObject$1(b2) ? equalObject(a2, b2) : false; + } + function equalArray(a2, b2) { + for (let i = 0, n = a2.length; i < n; ++i) { + if (!equal(a2[i], b2[i])) return false; + } + return true; + } + function equalObject(a2, b2) { + for (const key2 in a2) { + if (!equal(a2[key2], b2[key2])) return false; + } + return true; + } + function removePredicate(props) { + return (_) => equalObject(props, _); + } + function modify(name, insert2, remove2, toggle, modify2, values2) { + const df = this.context.dataflow, data2 = this.context.data[name], input = data2.input, stamp = df.stamp(); + let changes = data2.changes, predicate, key2; + if (df._trigger === false || !(input.value.length || insert2 || toggle)) { + return 0; + } + if (!changes || changes.stamp < stamp) { + data2.changes = changes = df.changeset(); + changes.stamp = stamp; + df.runAfter(() => { + data2.modified = true; + df.pulse(input, changes).run(); + }, true, 1); + } + if (remove2) { + predicate = remove2 === true ? truthy : isArray(remove2) || isTuple(remove2) ? remove2 : removePredicate(remove2); + changes.remove(predicate); + } + if (insert2) { + changes.insert(insert2); + } + if (toggle) { + predicate = removePredicate(toggle); + if (input.value.some(predicate)) { + changes.remove(predicate); + } else { + changes.insert(toggle); + } + } + if (modify2) { + for (key2 in values2) { + changes.modify(modify2, key2, values2[key2]); + } + } + return 1; + } + function pinchDistance(event2) { + const t = event2.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; + return Math.hypot(dx, dy); + } + function pinchAngle(event2) { + const t = event2.touches; + return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); + } + const accessors = {}; + function pluck(data2, name) { + const accessor2 = accessors[name] || (accessors[name] = field$1(name)); + return isArray(data2) ? data2.map(accessor2) : accessor2(data2); + } + function array(seq) { + return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null; + } + function sequence(seq) { + return array(seq) || (isString(seq) ? seq : null); + } + function join(seq, ...args) { + return array(seq).join(...args); + } + function indexof(seq, ...args) { + return sequence(seq).indexOf(...args); + } + function lastindexof(seq, ...args) { + return sequence(seq).lastIndexOf(...args); + } + function slice(seq, ...args) { + return sequence(seq).slice(...args); + } + function replace(str, pattern, repl) { + if (isFunction(repl)) error("Function argument passed to replace."); + if (!isString(pattern) && !isRegExp(pattern)) error("Please pass a string or RegExp argument to replace."); + return String(str).replace(pattern, repl); + } + function reverse(seq) { + return array(seq).slice().reverse(); + } + function sort(seq) { + return array(seq).slice().sort(ascending$2); + } + function bandspace(count2, paddingInner, paddingOuter) { + return bandSpace(count2 || 0, paddingInner || 0, paddingOuter || 0); + } + function bandwidth(name, group2) { + const s = getScale(name, (group2 || this).context); + return s && s.bandwidth ? s.bandwidth() : 0; + } + function copy$5(name, group2) { + const s = getScale(name, (group2 || this).context); + return s ? s.copy() : void 0; + } + function domain(name, group2) { + const s = getScale(name, (group2 || this).context); + return s ? s.domain() : []; + } + function invert$1(name, range2, group2) { + const s = getScale(name, (group2 || this).context); + return !s ? void 0 : isArray(range2) ? (s.invertRange || s.invert)(range2) : (s.invert || s.invertExtent)(range2); + } + function range$1(name, group2) { + const s = getScale(name, (group2 || this).context); + return s && s.range ? s.range() : []; + } + function scale$4(name, value2, group2) { + const s = getScale(name, (group2 || this).context); + return s ? s(value2) : void 0; + } + function scaleGradient(scale2, p02, p1, count2, group2) { + scale2 = getScale(scale2, (group2 || this).context); + const gradient2 = Gradient$1(p02, p1); + let stops = scale2.domain(), min2 = stops[0], max2 = peek$1(stops), fraction = identity$7; + if (!(max2 - min2)) { + scale2 = (scale2.interpolator ? scale$6("sequential")().interpolator(scale2.interpolator()) : scale$6("linear")().interpolate(scale2.interpolate()).range(scale2.range())).domain([min2 = 0, max2 = 1]); + } else { + fraction = scaleFraction(scale2, min2, max2); + } + if (scale2.ticks) { + stops = scale2.ticks(+count2 || 15); + if (min2 !== stops[0]) stops.unshift(min2); + if (max2 !== peek$1(stops)) stops.push(max2); + } + stops.forEach((_) => gradient2.stop(fraction(_), scale2(_))); + return gradient2; + } + function geoShape(projection2, geojson, group2) { + const p = getScale(projection2, (group2 || this).context); + return function(context2) { + return p ? p.path.context(context2)(geojson) : ""; + }; + } + function pathShape(path2) { + let p = null; + return function(context2) { + return context2 ? pathRender(context2, p = p || parse$3(path2)) : path2; + }; + } + const datum = (d) => d.data; + function treeNodes(name, context2) { + const tree2 = data$1.call(context2, name); + return tree2.root && tree2.root.lookup || {}; + } + function treePath(name, source2, target2) { + const nodes = treeNodes(name, this), s = nodes[source2], t = nodes[target2]; + return s && t ? s.path(t).map(datum) : void 0; + } + function treeAncestors(name, node) { + const n = treeNodes(name, this)[node]; + return n ? n.ancestors().map(datum) : void 0; + } + const _window = () => typeof window !== "undefined" && window || null; + function screen() { + const w2 = _window(); + return w2 ? w2.screen : {}; + } + function windowSize() { + const w2 = _window(); + return w2 ? [w2.innerWidth, w2.innerHeight] : [void 0, void 0]; + } + function containerSize() { + const view = this.context.dataflow, el = view.container && view.container(); + return el ? [el.clientWidth, el.clientHeight] : [void 0, void 0]; + } + function intersect(b2, opt, group2) { + if (!b2) return []; + const [u2, v] = b2, box2 = new Bounds().set(u2[0], u2[1], v[0], v[1]), scene = group2 || this.context.dataflow.scenegraph().root; + return intersect$2(scene, box2, filter(opt)); + } + function filter(opt) { + let p = null; + if (opt) { + const types = array$5(opt.marktype), names = array$5(opt.markname); + p = (_) => (!types.length || types.some((t) => _.marktype === t)) && (!names.length || names.some((s) => _.name === s)); + } + return p; + } + function lassoAppend(lasso, x2, y2, minDist = 5) { + lasso = array$5(lasso); + const last = lasso[lasso.length - 1]; + return last === void 0 || Math.hypot(last[0] - x2, last[1] - y2) > minDist ? [...lasso, [x2, y2]] : lasso; + } + function lassoPath(lasso) { + return array$5(lasso).reduce((svg, [x2, y2], i) => { + return svg += i == 0 ? `M ${x2},${y2} ` : i === lasso.length - 1 ? " Z" : `L ${x2},${y2} `; + }, ""); + } + function intersectLasso(markname, pixelLasso, unit2) { + const { + x: x2, + y: y2, + mark + } = unit2; + const bb = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); + for (const [px2, py2] of pixelLasso) { + if (px2 < bb.x1) bb.x1 = px2; + if (px2 > bb.x2) bb.x2 = px2; + if (py2 < bb.y1) bb.y1 = py2; + if (py2 > bb.y2) bb.y2 = py2; + } + bb.translate(x2, y2); + const intersection2 = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark); + return intersection2.filter((tuple) => pointInPolygon(tuple.x, tuple.y, pixelLasso)); + } + function pointInPolygon(testx, testy, polygon) { + let intersections = 0; + for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { + const [prevX, prevY] = polygon[j]; + const [x2, y2] = polygon[i]; + if (y2 > testy != prevY > testy && testx < (prevX - x2) * (testy - y2) / (prevY - y2) + x2) { + intersections++; + } + } + return intersections & 1; + } + const functionContext = { + random() { + return random(); + }, + // override default + cumulativeNormal, + cumulativeLogNormal, + cumulativeUniform, + densityNormal, + densityLogNormal, + densityUniform, + quantileNormal, + quantileLogNormal, + quantileUniform, + sampleNormal, + sampleLogNormal, + sampleUniform, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isDefined(_) { + return _ !== void 0; + }, + isNumber: isNumber$1, + isObject: isObject$1, + isRegExp, + isString, + isTuple, + isValid(_) { + return _ != null && _ === _; + }, + toBoolean, + toDate(_) { + return toDate(_); + }, + // suppress extra arguments + toNumber, + toString, + indexof, + join, + lastindexof, + replace, + reverse, + sort, + slice, + flush, + lerp: lerp$1, + merge, + pad: pad$2, + peek: peek$1, + pluck, + span, + inrange, + truncate: truncate$1, + rgb: rgb$1, + lab: lab$1, + hcl: hcl$1, + hsl: hsl$1, + luminance, + contrast, + sequence: range$3, + format, + utcFormat, + utcParse, + utcOffset, + utcSequence, + timeFormat, + timeParse, + timeOffset, + timeSequence, + timeUnitSpecifier, + monthFormat, + monthAbbrevFormat, + dayFormat, + dayAbbrevFormat, + quarter, + utcquarter, + week, + utcweek, + dayofyear, + utcdayofyear, + warn, + info, + debug, + extent(_) { + return extent(_); + }, + // suppress extra arguments + inScope, + intersect, + clampRange, + pinchDistance, + pinchAngle, + screen, + containerSize, + windowSize, + bandspace, + setdata, + pathShape, + panLinear, + panLog, + panPow, + panSymlog, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog, + encode, + modify, + lassoAppend, + lassoPath, + intersectLasso + }; + const eventFunctions = ["view", "item", "group", "xy", "x", "y"], eventPrefix = "event.vega.", thisPrefix = "this.", astVisitors = {}; + const codegenParams = { + forbidden: ["_"], + allowed: ["datum", "event", "item"], + fieldvar: "datum", + globalvar: (id2) => `_[${$(SignalPrefix + id2)}]`, + functions: buildFunctions, + constants: Constants$1, + visitors: astVisitors + }; + const codeGenerator = codegen(codegenParams); + function buildFunctions(codegen2) { + const fn = Functions(codegen2); + eventFunctions.forEach((name) => fn[name] = eventPrefix + name); + for (const name in functionContext) { + fn[name] = thisPrefix + name; + } + extend$1(fn, internalScaleFunctions(codegen2, functionContext, astVisitors)); + return fn; + } + function expressionFunction(name, fn, visitor) { + if (arguments.length === 1) { + return functionContext[name]; + } + functionContext[name] = fn; + if (visitor) astVisitors[name] = visitor; + if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; + return this; + } + expressionFunction("bandwidth", bandwidth, scaleVisitor); + expressionFunction("copy", copy$5, scaleVisitor); + expressionFunction("domain", domain, scaleVisitor); + expressionFunction("range", range$1, scaleVisitor); + expressionFunction("invert", invert$1, scaleVisitor); + expressionFunction("scale", scale$4, scaleVisitor); + expressionFunction("gradient", scaleGradient, scaleVisitor); + expressionFunction("geoArea", geoArea, scaleVisitor); + expressionFunction("geoBounds", geoBounds, scaleVisitor); + expressionFunction("geoCentroid", geoCentroid, scaleVisitor); + expressionFunction("geoShape", geoShape, scaleVisitor); + expressionFunction("geoScale", geoScale, scaleVisitor); + expressionFunction("indata", indata, indataVisitor); + expressionFunction("data", data$1, dataVisitor); + expressionFunction("treePath", treePath, dataVisitor); + expressionFunction("treeAncestors", treeAncestors, dataVisitor); + expressionFunction("vlSelectionTest", selectionTest, selectionVisitor); + expressionFunction("vlSelectionIdTest", selectionIdTest, selectionVisitor); + expressionFunction("vlSelectionResolve", selectionResolve, selectionVisitor); + expressionFunction("vlSelectionTuples", selectionTuples); + function parser(expr2, scope) { + const params2 = {}; + let ast; + try { + expr2 = isString(expr2) ? expr2 : $(expr2) + ""; + ast = parser$1(expr2); + } catch (err) { + error("Expression parse error: " + expr2); + } + ast.visit((node) => { + if (node.type !== CallExpression) return; + const name = node.callee.name, visit2 = codegenParams.visitors[name]; + if (visit2) visit2(name, node.arguments, scope, params2); + }); + const gen = codeGenerator(ast); + gen.globals.forEach((name) => { + const signalName = SignalPrefix + name; + if (!has$1(params2, signalName) && scope.getSignal(name)) { + params2[signalName] = scope.signalRef(name); + } + }); + return { + $expr: extend$1({ + code: gen.code + }, scope.options.ast ? { + ast + } : null), + $fields: gen.fields, + $params: params2 + }; + } + function parse$2(spec) { + const ctx = this, operators = spec.operators || []; + if (spec.background) { + ctx.background = spec.background; + } + if (spec.eventConfig) { + ctx.eventConfig = spec.eventConfig; + } + if (spec.locale) { + ctx.locale = spec.locale; + } + operators.forEach((entry2) => ctx.parseOperator(entry2)); + operators.forEach((entry2) => ctx.parseOperatorParameters(entry2)); + (spec.streams || []).forEach((entry2) => ctx.parseStream(entry2)); + (spec.updates || []).forEach((entry2) => ctx.parseUpdate(entry2)); + return ctx.resolve(); + } + const Skip$2 = toSet(["rule"]), Swap = toSet(["group", "image", "rect"]); + function adjustSpatial(encode2, marktype) { + let code = ""; + if (Skip$2[marktype]) return code; + if (encode2.x2) { + if (encode2.x) { + if (Swap[marktype]) { + code += "if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"; + } + code += "o.width=o.x2-o.x;"; + } else { + code += "o.x=o.x2-(o.width||0);"; + } + } + if (encode2.xc) { + code += "o.x=o.xc-(o.width||0)/2;"; + } + if (encode2.y2) { + if (encode2.y) { + if (Swap[marktype]) { + code += "if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"; + } + code += "o.height=o.y2-o.y;"; + } else { + code += "o.y=o.y2-(o.height||0);"; + } + } + if (encode2.yc) { + code += "o.y=o.yc-(o.height||0)/2;"; + } + return code; + } + function canonicalType(type2) { + return (type2 + "").toLowerCase(); + } + function isOperator(type2) { + return canonicalType(type2) === "operator"; + } + function isCollect(type2) { + return canonicalType(type2) === "collect"; + } + function expression(ctx, args, code) { + if (!code.endsWith(";")) { + code = "return(" + code + ");"; + } + const fn = Function(...args.concat(code)); + return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; + } + function _compare(u2, v, lt, gt) { + return `((u = ${u2}) < (v = ${v}) || u == null) && v != null ? ${lt} + : (u > v || v == null) && u != null ? ${gt} + : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} + : v !== v && u === u ? ${gt} : `; + } + var expressionCodegen = { + /** + * Parse an expression used to update an operator value. + */ + operator: (ctx, expr2) => expression(ctx, ["_"], expr2.code), + /** + * Parse an expression provided as an operator parameter value. + */ + parameter: (ctx, expr2) => expression(ctx, ["datum", "_"], expr2.code), + /** + * Parse an expression applied to an event stream. + */ + event: (ctx, expr2) => expression(ctx, ["event"], expr2.code), + /** + * Parse an expression used to handle an event-driven operator update. + */ + handler: (ctx, expr2) => { + const code = `var datum=event.item&&event.item.datum;return ${expr2.code};`; + return expression(ctx, ["_", "event"], code); + }, + /** + * Parse an expression that performs visual encoding. + */ + encode: (ctx, encode2) => { + const { + marktype, + channels + } = encode2; + let code = "var o=item,datum=o.datum,m=0,$;"; + for (const name in channels) { + const o = "o[" + $(name) + "]"; + code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; + } + code += adjustSpatial(channels, marktype); + code += "return m;"; + return expression(ctx, ["item", "_"], code); + }, + /** + * Optimized code generators for access and comparison. + */ + codegen: { + get(path2) { + const ref2 = `[${path2.map($).join("][")}]`; + const get2 = Function("_", `return _${ref2};`); + get2.path = ref2; + return get2; + }, + comparator(fields, orders) { + let t; + const map2 = (f, i) => { + const o = orders[i]; + let u2, v; + if (f.path) { + u2 = `a${f.path}`; + v = `b${f.path}`; + } else { + (t = t || {})["f" + i] = f; + u2 = `this.f${i}(a)`; + v = `this.f${i}(b)`; + } + return _compare(u2, v, -o, o); + }; + const fn = Function("a", "b", "var u, v; return " + fields.map(map2).join("") + "0;"); + return t ? fn.bind(t) : fn; + } + } + }; + function parseOperator(spec) { + const ctx = this; + if (isOperator(spec.type) || !spec.type) { + ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); + } else { + ctx.transform(spec, spec.type); + } + } + function parseOperatorParameters(spec) { + const ctx = this; + if (spec.params) { + const op = ctx.get(spec.id); + if (!op) error("Invalid operator id: " + spec.id); + ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); + } + } + function parseParameters$1(spec, params2) { + params2 = params2 || {}; + const ctx = this; + for (const key2 in spec) { + const value2 = spec[key2]; + params2[key2] = isArray(value2) ? value2.map((v) => parseParameter$2(v, ctx, params2)) : parseParameter$2(value2, ctx, params2); + } + return params2; + } + function parseParameter$2(spec, ctx, params2) { + if (!spec || !isObject$1(spec)) return spec; + for (let i = 0, n = PARSERS.length, p; i < n; ++i) { + p = PARSERS[i]; + if (has$1(spec, p.key)) { + return p.parse(spec, ctx, params2); + } + } + return spec; + } + var PARSERS = [{ + key: "$ref", + parse: getOperator + }, { + key: "$key", + parse: getKey + }, { + key: "$expr", + parse: getExpression + }, { + key: "$field", + parse: getField + }, { + key: "$encode", + parse: getEncode + }, { + key: "$compare", + parse: getCompare + }, { + key: "$context", + parse: getContext + }, { + key: "$subflow", + parse: getSubflow + }, { + key: "$tupleid", + parse: getTupleId + }]; + function getOperator(_, ctx) { + return ctx.get(_.$ref) || error("Operator not defined: " + _.$ref); + } + function getExpression(_, ctx, params2) { + if (_.$params) { + ctx.parseParameters(_.$params, params2); + } + const k = "e:" + _.$expr.code; + return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields)); + } + function getKey(_, ctx) { + const k = "k:" + _.$key + "_" + !!_.$flat; + return ctx.fn[k] || (ctx.fn[k] = key$2(_.$key, _.$flat, ctx.expr.codegen)); + } + function getField(_, ctx) { + if (!_.$field) return null; + const k = "f:" + _.$field + "_" + _.$name; + return ctx.fn[k] || (ctx.fn[k] = field$1(_.$field, _.$name, ctx.expr.codegen)); + } + function getCompare(_, ctx) { + const k = "c:" + _.$compare + "_" + _.$order, c2 = array$5(_.$compare).map((_2) => _2 && _2.$tupleid ? tupleid : _2); + return ctx.fn[k] || (ctx.fn[k] = compare$1(c2, _.$order, ctx.expr.codegen)); + } + function getEncode(_, ctx) { + const spec = _.$encode, encode2 = {}; + for (const name in spec) { + const enc = spec[name]; + encode2[name] = accessor(ctx.encodeExpression(enc.$expr), enc.$fields); + encode2[name].output = enc.$output; + } + return encode2; + } + function getContext(_, ctx) { + return ctx; + } + function getSubflow(_, ctx) { + const spec = _.$subflow; + return function(dataflow, key2, parent) { + const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; + if (p) p.set(parent); + op.detachSubflow = () => ctx.detach(subctx); + return op; + }; + } + function getTupleId() { + return tupleid; + } + function parseStream$2(spec) { + var ctx = this, filter2 = spec.filter != null ? ctx.eventExpression(spec.filter) : void 0, stream2 = spec.stream != null ? ctx.get(spec.stream) : void 0, args; + if (spec.source) { + stream2 = ctx.events(spec.source, spec.type, filter2); + } else if (spec.merge) { + args = spec.merge.map((_) => ctx.get(_)); + stream2 = args[0].merge.apply(args[0], args.slice(1)); + } + if (spec.between) { + args = spec.between.map((_) => ctx.get(_)); + stream2 = stream2.between(args[0], args[1]); + } + if (spec.filter) { + stream2 = stream2.filter(filter2); + } + if (spec.throttle != null) { + stream2 = stream2.throttle(+spec.throttle); + } + if (spec.debounce != null) { + stream2 = stream2.debounce(+spec.debounce); + } + if (stream2 == null) { + error("Invalid stream definition: " + JSON.stringify(spec)); + } + if (spec.consume) stream2.consume(true); + ctx.stream(spec, stream2); + } + function parseUpdate$1(spec) { + var ctx = this, srcid = isObject$1(srcid = spec.source) ? srcid.$ref : srcid, source2 = ctx.get(srcid), target2 = null, update2 = spec.update, params2 = void 0; + if (!source2) error("Source not defined: " + spec.source); + target2 = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); + if (update2 && update2.$expr) { + if (update2.$params) { + params2 = ctx.parseParameters(update2.$params); + } + update2 = ctx.handlerExpression(update2.$expr); } - return true; -} -function equalObject(a, b) { - for(const key in a){ - if (!equal(a[key], b[key])) return false; + ctx.update(spec, source2, target2, update2, params2); + } + const SKIP = { + skip: true + }; + function getState$1(options) { + var ctx = this, state = {}; + if (options.signals) { + var signals = state.signals = {}; + Object.keys(ctx.signals).forEach((key2) => { + const op = ctx.signals[key2]; + if (options.signals(key2, op)) { + signals[key2] = op.value; + } + }); } - return true; -} -function removePredicate(props) { - return (_)=>equalObject(props, _); -} -function modify(name, insert, remove, toggle, modify, values) { - const df = this.context.dataflow, data = this.context.data[name], input = data.input, stamp = df.stamp(); - let changes = data.changes, predicate, key; - if (df._trigger === false || !(input.value.length || insert || toggle)) // nothing to do! - return 0; - if (!changes || changes.stamp < stamp) { - data.changes = changes = df.changeset(); - changes.stamp = stamp; - df.runAfter(()=>{ - data.modified = true; - df.pulse(input, changes).run(); - }, true, 1); - } - if (remove) { - predicate = remove === true ? (0, _vegaUtil.truthy) : (0, _vegaUtil.isArray)(remove) || (0, _vegaDataflow.isTuple)(remove) ? remove : removePredicate(remove); - changes.remove(predicate); + if (options.data) { + var data2 = state.data = {}; + Object.keys(ctx.data).forEach((key2) => { + const dataset = ctx.data[key2]; + if (options.data(key2, dataset)) { + data2[key2] = dataset.input.value; + } + }); } - if (insert) changes.insert(insert); - if (toggle) { - predicate = removePredicate(toggle); - if (input.value.some(predicate)) changes.remove(predicate); - else changes.insert(toggle); + if (ctx.subcontext && options.recurse !== false) { + state.subcontext = ctx.subcontext.map((ctx2) => ctx2.getState(options)); } - if (modify) for(key in values)changes.modify(modify, key, values[key]); - return 1; -} -function pinchDistance(event) { - const t = event.touches, dx = t[0].clientX - t[1].clientX, dy = t[0].clientY - t[1].clientY; - return Math.hypot(dx, dy); -} -function pinchAngle(event) { - const t = event.touches; - return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX); -} -// memoize accessor functions -const accessors = {}; -function pluck(data, name) { - const accessor = accessors[name] || (accessors[name] = (0, _vegaUtil.field)(name)); - return (0, _vegaUtil.isArray)(data) ? data.map(accessor) : accessor(data); -} -function array(seq) { - return (0, _vegaUtil.isArray)(seq) || ArrayBuffer.isView(seq) ? seq : null; -} -function sequence(seq) { - return array(seq) || ((0, _vegaUtil.isString)(seq) ? seq : null); -} -function join(seq) { - for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)args[_key - 1] = arguments[_key]; - return array(seq).join(...args); -} -function indexof(seq) { - for(var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)args[_key2 - 1] = arguments[_key2]; - return sequence(seq).indexOf(...args); -} -function lastindexof(seq) { - for(var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)args[_key3 - 1] = arguments[_key3]; - return sequence(seq).lastIndexOf(...args); -} -function slice(seq) { - for(var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++)args[_key4 - 1] = arguments[_key4]; - return sequence(seq).slice(...args); -} -function replace(str, pattern, repl) { - if ((0, _vegaUtil.isFunction)(repl)) (0, _vegaUtil.error)('Function argument passed to replace.'); - if (!(0, _vegaUtil.isString)(pattern) && !(0, _vegaUtil.isRegExp)(pattern)) (0, _vegaUtil.error)('Please pass a string or RegExp argument to replace.'); - return String(str).replace(pattern, repl); -} -function reverse(seq) { - return array(seq).slice().reverse(); -} -function sort(seq) { - return array(seq).slice().sort((0, _vegaUtil.ascending)); -} -function bandspace(count, paddingInner, paddingOuter) { - return (0, _vegaScale.bandSpace)(count || 0, paddingInner || 0, paddingOuter || 0); -} -function bandwidth(name, group) { - const s = getScale(name, (group || this).context); - return s && s.bandwidth ? s.bandwidth() : 0; -} -function copy(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.copy() : undefined; -} -function domain(name, group) { - const s = getScale(name, (group || this).context); - return s ? s.domain() : []; -} -function invert(name, range, group) { - const s = getScale(name, (group || this).context); - return !s ? undefined : (0, _vegaUtil.isArray)(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range); -} -function range(name, group) { - const s = getScale(name, (group || this).context); - return s && s.range ? s.range() : []; -} -function scale(name, value, group) { - const s = getScale(name, (group || this).context); - return s ? s(value) : undefined; -} -/** - * Passing a function is only used for for testing. - * Outside of tests, the first argument should be a string. - */ function scaleGradient(scaleOrFunction, p0, p1, count, group) { - let scale = typeof scaleOrFunction === 'string' ? getScale(scaleOrFunction, (group || this).context) : scaleOrFunction; - const gradient = (0, _vegaScenegraph.Gradient)(p0, p1); - let stops = scale.domain(), min = stops[0], max = (0, _vegaUtil.peek)(stops), fraction = (0, _vegaUtil.identity); - if (!(max - min)) // expand scale if domain has zero span, fix #1479 - scale = (scale.interpolator ? (0, _vegaScale.scale)('sequential')().interpolator(scale.interpolator()) : (0, _vegaScale.scale)('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([ - min = 0, - max = 1 - ]); - else fraction = (0, _vegaScale.scaleFraction)(scale, min, max); - if (scale.ticks) { - stops = scale.ticks(+count || 15); - if (min !== stops[0]) stops.unshift(min); - if (max !== (0, _vegaUtil.peek)(stops)) stops.push(max); - } - stops.forEach((_)=>gradient.stop(fraction(_), scale(_))); - return gradient; -} -function geoShape(projection, geojson, group) { - const p = getScale(projection, (group || this).context); - return function(context) { - return p ? p.path.context(context)(geojson) : ''; - }; -} -function pathShape(path) { - let p = null; - return function(context) { - return context ? (0, _vegaScenegraph.pathRender)(context, p = p || (0, _vegaScenegraph.pathParse)(path)) : path; - }; -} -const datum = (d)=>d.data; -function treeNodes(name, context) { - const tree = data.call(context, name); - return tree.root && tree.root.lookup || {}; -} -function treePath(name, source, target) { - const nodes = treeNodes(name, this), s = nodes[source], t = nodes[target]; - return s && t ? s.path(t).map(datum) : undefined; -} -function treeAncestors(name, node) { - const n = treeNodes(name, this)[node]; - return n ? n.ancestors().map(datum) : undefined; -} -const _window = ()=>typeof window !== 'undefined' && window || null; -function screen() { - const w = _window(); - return w ? w.screen : {}; -} -function windowSize() { - const w = _window(); - return w ? [ - w.innerWidth, - w.innerHeight - ] : [ - undefined, - undefined - ]; -} -function containerSize() { - const view = this.context.dataflow, el = view.container && view.container(); - return el ? [ - el.clientWidth, - el.clientHeight - ] : [ - undefined, - undefined - ]; -} -function intersect(b, opt, group) { - if (!b) return []; - const [u, v] = b, box = new (0, _vegaScenegraph.Bounds)().set(u[0], u[1], v[0], v[1]), scene = group || this.context.dataflow.scenegraph().root; - return (0, _vegaScenegraph.intersect)(scene, box, filter(opt)); -} -function filter(opt) { - let p = null; - if (opt) { - const types = (0, _vegaUtil.array)(opt.marktype), names = (0, _vegaUtil.array)(opt.markname); - p = (_)=>(!types.length || types.some((t)=>_.marktype === t)) && (!names.length || names.some((s)=>_.name === s)); + return state; + } + function setState$1(state) { + var ctx = this, df = ctx.dataflow, data2 = state.data, signals = state.signals; + Object.keys(signals || {}).forEach((key2) => { + df.update(ctx.signals[key2], signals[key2], SKIP); + }); + Object.keys(data2 || {}).forEach((key2) => { + df.pulse(ctx.data[key2].input, df.changeset().remove(truthy).insert(data2[key2])); + }); + (state.subcontext || []).forEach((substate, i) => { + const subctx = ctx.subcontext[i]; + if (subctx) subctx.setState(substate); + }); + } + function context(df, transforms2, functions, expr2) { + return new Context(df, transforms2, functions, expr2); + } + function Context(df, transforms2, functions, expr2) { + this.dataflow = df; + this.transforms = transforms2; + this.events = df.events.bind(df); + this.expr = expr2 || expressionCodegen, this.signals = {}; + this.scales = {}; + this.nodes = {}; + this.data = {}; + this.fn = {}; + if (functions) { + this.functions = Object.create(functions); + this.functions.context = this; } - return p; -} -/** - * Appends a new point to the lasso - * - * @param {*} lasso the lasso in pixel space - * @param {*} x the x coordinate in pixel space - * @param {*} y the y coordinate in pixel space - * @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point - * @returns a new array containing the lasso with the new point - */ function lassoAppend(lasso, x, y) { - let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5; - lasso = (0, _vegaUtil.array)(lasso); - const last = lasso[lasso.length - 1]; - // Add point to lasso if its the first point or distance to last point exceed minDist - return last === undefined || Math.hypot(last[0] - x, last[1] - y) > minDist ? [ - ...lasso, - [ - x, - y - ] - ] : lasso; -} -/** - * Generates a svg path command which draws a lasso - * - * @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...] - * @returns the svg path command that draws the lasso - */ function lassoPath(lasso) { - return (0, _vegaUtil.array)(lasso).reduce((svg, _ref, i)=>{ - let [x, y] = _ref; - return svg += i == 0 ? `M ${x},${y} ` : i === lasso.length - 1 ? ' Z' : `L ${x},${y} `; - }, ''); -} -/** - * Inverts the lasso from pixel space to an array of vega scenegraph tuples - * - * @param {*} data the dataset - * @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...] - * @param {*} unit the unit where the lasso is defined - * - * @returns an array of vega scenegraph tuples - */ function intersectLasso(markname, pixelLasso, unit) { - const { x, y, mark } = unit; - const bb = new (0, _vegaScenegraph.Bounds)().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); - // Get bounding box around lasso - for (const [px, py] of pixelLasso){ - if (px < bb.x1) bb.x1 = px; - if (px > bb.x2) bb.x2 = px; - if (py < bb.y1) bb.y1 = py; - if (py > bb.y2) bb.y2 = py; - } - // Translate bb against unit coordinates - bb.translate(x, y); - const intersection = intersect([ - [ - bb.x1, - bb.y1 - ], - [ - bb.x2, - bb.y2 - ] - ], markname, mark); - // Check every point against the lasso - return intersection.filter((tuple)=>pointInPolygon(tuple.x, tuple.y, pixelLasso)); -} -/** - * Performs a test if a point is inside a polygon based on the idea from - * https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html - * - * This method will not need the same start/end point since it wraps around the edges of the array - * - * @param {*} test a point to test against - * @param {*} polygon a polygon in the form [[x,y], [x,y], ...] - * @returns true if the point lies inside the polygon, false otherwise - */ function pointInPolygon(testx, testy, polygon) { - let intersections = 0; - for(let i = 0, j = polygon.length - 1; i < polygon.length; j = i++){ - const [prevX, prevY] = polygon[j]; - const [x, y] = polygon[i]; - // count intersections - if (y > testy != prevY > testy && testx < (prevX - x) * (testy - y) / (prevY - y) + x) intersections++; + } + function Subcontext(ctx) { + this.dataflow = ctx.dataflow; + this.transforms = ctx.transforms; + this.events = ctx.events; + this.expr = ctx.expr; + this.signals = Object.create(ctx.signals); + this.scales = Object.create(ctx.scales); + this.nodes = Object.create(ctx.nodes); + this.data = Object.create(ctx.data); + this.fn = Object.create(ctx.fn); + if (ctx.functions) { + this.functions = Object.create(ctx.functions); + this.functions.context = this; } - // point is in polygon if intersection count is odd - return intersections & 1; -} -// Expression function context object -const functionContext = { - random () { - return (0, _vegaStatistics.random)(); + } + Context.prototype = Subcontext.prototype = { + fork() { + const ctx = new Subcontext(this); + (this.subcontext || (this.subcontext = [])).push(ctx); + return ctx; + }, + detach(ctx) { + this.subcontext = this.subcontext.filter((c2) => c2 !== ctx); + const keys2 = Object.keys(ctx.nodes); + for (const key2 of keys2) ctx.nodes[key2]._targets = null; + for (const key2 of keys2) ctx.nodes[key2].detach(); + ctx.nodes = null; + }, + get(id2) { + return this.nodes[id2]; + }, + set(id2, node) { + return this.nodes[id2] = node; + }, + add(spec, op) { + const ctx = this, df = ctx.dataflow, data2 = spec.value; + ctx.set(spec.id, op); + if (isCollect(spec.type) && data2) { + if (data2.$ingest) { + df.ingest(op, data2.$ingest, data2.$format); + } else if (data2.$request) { + df.preload(op, data2.$request, data2.$format); + } else { + df.pulse(op, df.changeset().insert(data2)); + } + } + if (spec.root) { + ctx.root = op; + } + if (spec.parent) { + let p = ctx.get(spec.parent.$ref); + if (p) { + df.connect(p, [op]); + op.targets().add(p); + } else { + (ctx.unresolved = ctx.unresolved || []).push(() => { + p = ctx.get(spec.parent.$ref); + df.connect(p, [op]); + op.targets().add(p); + }); + } + } + if (spec.signal) { + ctx.signals[spec.signal] = op; + } + if (spec.scale) { + ctx.scales[spec.scale] = op; + } + if (spec.data) { + for (const name in spec.data) { + const data3 = ctx.data[name] || (ctx.data[name] = {}); + spec.data[name].forEach((role) => data3[role] = op); + } + } }, - cumulativeNormal: // override default - (0, _vegaStatistics.cumulativeNormal), - cumulativeLogNormal: (0, _vegaStatistics.cumulativeLogNormal), - cumulativeUniform: (0, _vegaStatistics.cumulativeUniform), - densityNormal: (0, _vegaStatistics.densityNormal), - densityLogNormal: (0, _vegaStatistics.densityLogNormal), - densityUniform: (0, _vegaStatistics.densityUniform), - quantileNormal: (0, _vegaStatistics.quantileNormal), - quantileLogNormal: (0, _vegaStatistics.quantileLogNormal), - quantileUniform: (0, _vegaStatistics.quantileUniform), - sampleNormal: (0, _vegaStatistics.sampleNormal), - sampleLogNormal: (0, _vegaStatistics.sampleLogNormal), - sampleUniform: (0, _vegaStatistics.sampleUniform), - isArray: (0, _vegaUtil.isArray), - isBoolean: (0, _vegaUtil.isBoolean), - isDate: (0, _vegaUtil.isDate), - isDefined (_) { - return _ !== undefined; + resolve() { + (this.unresolved || []).forEach((fn) => fn()); + delete this.unresolved; + return this; }, - isNumber: (0, _vegaUtil.isNumber), - isObject: (0, _vegaUtil.isObject), - isRegExp: (0, _vegaUtil.isRegExp), - isString: (0, _vegaUtil.isString), - isTuple: (0, _vegaDataflow.isTuple), - isValid (_) { - return _ != null && _ === _; + operator(spec, update2) { + this.add(spec, this.dataflow.add(spec.value, update2)); }, - toBoolean: (0, _vegaUtil.toBoolean), - toDate (_) { - return (0, _vegaUtil.toDate)(_); + transform(spec, type2) { + this.add(spec, this.dataflow.add(this.transforms[canonicalType(type2)])); }, - toNumber: // suppress extra arguments - (0, _vegaUtil.toNumber), - toString: (0, _vegaUtil.toString), - indexof, - join, - lastindexof, - replace, - reverse, - sort, - slice, - flush: (0, _vegaUtil.flush), - lerp: (0, _vegaUtil.lerp), - merge, - pad: (0, _vegaUtil.pad), - peek: (0, _vegaUtil.peek), - pluck, - span: (0, _vegaUtil.span), - inrange: (0, _vegaUtil.inrange), - truncate: (0, _vegaUtil.truncate), - rgb: (0, _d3Color.rgb), - lab: (0, _d3Color.lab), - hcl: (0, _d3Color.hcl), - hsl: (0, _d3Color.hsl), - luminance, - contrast, - sequence: (0, _d3Array.range), - format, - utcFormat, - utcParse, - utcOffset: (0, _vegaTime.utcOffset), - utcSequence: (0, _vegaTime.utcSequence), - timeFormat, - timeParse, - timeOffset: (0, _vegaTime.timeOffset), - timeSequence: (0, _vegaTime.timeSequence), - timeUnitSpecifier: (0, _vegaTime.timeUnitSpecifier), - monthFormat, - monthAbbrevFormat, - dayFormat, - dayAbbrevFormat, - quarter: (0, _vegaUtil.quarter), - utcquarter: (0, _vegaUtil.utcquarter), - week: (0, _vegaTime.week), - utcweek: (0, _vegaTime.utcweek), - dayofyear: (0, _vegaTime.dayofyear), - utcdayofyear: (0, _vegaTime.utcdayofyear), - warn, - info, - debug, - extent (_) { - return (0, _vegaUtil.extent)(_); + stream(spec, stream2) { + this.set(spec.id, stream2); }, - // suppress extra arguments - inScope, - intersect, - clampRange: (0, _vegaUtil.clampRange), - pinchDistance, - pinchAngle, - screen, - containerSize, - windowSize, - bandspace, - setdata, - pathShape, - panLinear: (0, _vegaUtil.panLinear), - panLog: (0, _vegaUtil.panLog), - panPow: (0, _vegaUtil.panPow), - panSymlog: (0, _vegaUtil.panSymlog), - zoomLinear: (0, _vegaUtil.zoomLinear), - zoomLog: (0, _vegaUtil.zoomLog), - zoomPow: (0, _vegaUtil.zoomPow), - zoomSymlog: (0, _vegaUtil.zoomSymlog), - encode, - modify, - lassoAppend, - lassoPath, - intersectLasso -}; -const eventFunctions = [ - 'view', - 'item', - 'group', - 'xy', - 'x', - 'y' -], // event functions -eventPrefix = 'event.vega.', // event function prefix -thisPrefix = 'this.', // function context prefix -astVisitors = {}; // AST visitors for dependency analysis -// export code generator parameters -const codegenParams = { - forbidden: [ - '_' - ], - allowed: [ - 'datum', - 'event', - 'item' - ], - fieldvar: 'datum', - globalvar: (id)=>`_[${(0, _vegaUtil.stringValue)(SignalPrefix + id)}]`, - functions: buildFunctions, - constants: (0, _vegaExpression.constants), - visitors: astVisitors -}; -// export code generator -const codeGenerator = (0, _vegaExpression.codegenExpression)(codegenParams); -// Build expression function registry -function buildFunctions(codegen) { - const fn = (0, _vegaExpression.functions)(codegen); - eventFunctions.forEach((name)=>fn[name] = eventPrefix + name); - for(const name in functionContext)fn[name] = thisPrefix + name; - (0, _vegaUtil.extend)(fn, internalScaleFunctions(codegen, functionContext, astVisitors)); - return fn; -} -// Register an expression function -function expressionFunction(name, fn, visitor) { - if (arguments.length === 1) return functionContext[name]; - // register with the functionContext - functionContext[name] = fn; - // if there is an astVisitor register that, too - if (visitor) astVisitors[name] = visitor; - // if the code generator has already been initialized, - // we need to also register the function with it - if (codeGenerator) codeGenerator.functions[name] = thisPrefix + name; - return this; -} -// register expression functions with ast visitors -expressionFunction('bandwidth', bandwidth, scaleVisitor); -expressionFunction('copy', copy, scaleVisitor); -expressionFunction('domain', domain, scaleVisitor); -expressionFunction('range', range, scaleVisitor); -expressionFunction('invert', invert, scaleVisitor); -expressionFunction('scale', scale, scaleVisitor); -expressionFunction('gradient', scaleGradient, scaleVisitor); -expressionFunction('geoArea', geoArea, scaleVisitor); -expressionFunction('geoBounds', geoBounds, scaleVisitor); -expressionFunction('geoCentroid', geoCentroid, scaleVisitor); -expressionFunction('geoShape', geoShape, scaleVisitor); -expressionFunction('geoScale', geoScale, scaleVisitor); -expressionFunction('indata', indata, indataVisitor); -expressionFunction('data', data, dataVisitor); -expressionFunction('treePath', treePath, dataVisitor); -expressionFunction('treeAncestors', treeAncestors, dataVisitor); -// register Vega-Lite selection functions -expressionFunction('vlSelectionTest', (0, _vegaSelections.selectionTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionIdTest', (0, _vegaSelections.selectionIdTest), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionResolve', (0, _vegaSelections.selectionResolve), (0, _vegaSelections.selectionVisitor)); -expressionFunction('vlSelectionTuples', (0, _vegaSelections.selectionTuples)); -function parser(expr, scope) { - const params = {}; - // parse the expression to an abstract syntax tree (ast) - let ast; - try { - expr = (0, _vegaUtil.isString)(expr) ? expr : (0, _vegaUtil.stringValue)(expr) + ''; - ast = (0, _vegaExpression.parseExpression)(expr); - } catch (err) { - (0, _vegaUtil.error)('Expression parse error: ' + expr); + update(spec, stream2, target2, update2, params2) { + this.dataflow.on(stream2, target2, update2, params2, spec.options); + }, + // expression parsing + operatorExpression(expr2) { + return this.expr.operator(this, expr2); + }, + parameterExpression(expr2) { + return this.expr.parameter(this, expr2); + }, + eventExpression(expr2) { + return this.expr.event(this, expr2); + }, + handlerExpression(expr2) { + return this.expr.handler(this, expr2); + }, + encodeExpression(encode2) { + return this.expr.encode(this, encode2); + }, + // parse methods + parse: parse$2, + parseOperator, + parseOperatorParameters, + parseParameters: parseParameters$1, + parseStream: parseStream$2, + parseUpdate: parseUpdate$1, + // state methods + getState: getState$1, + setState: setState$1 + }; + function initializeAria(view) { + const el = view.container(); + if (el) { + el.setAttribute("role", "graphics-document"); + el.setAttribute("aria-roleDescription", "visualization"); + ariaLabel(el, view.description()); } - // analyze ast function calls for dependencies - ast.visit((node)=>{ - if (node.type !== (0, _vegaExpression.CallExpression)) return; - const name = node.callee.name, visit = codegenParams.visitors[name]; - if (visit) visit(name, node.arguments, scope, params); + } + function ariaLabel(el, desc) { + if (el) desc == null ? el.removeAttribute("aria-label") : el.setAttribute("aria-label", desc); + } + function background(view) { + view.add(null, (_) => { + view._background = _.bg; + view._resize = 1; + return _.bg; + }, { + bg: view._signals.background }); - // perform code generation - const gen = codeGenerator(ast); - // collect signal dependencies - gen.globals.forEach((name)=>{ - const signalName = SignalPrefix + name; - if (!(0, _vegaUtil.hasOwnProperty)(params, signalName) && scope.getSignal(name)) params[signalName] = scope.signalRef(name); + } + const Default = "default"; + function cursor(view) { + const cursor2 = view._signals.cursor || (view._signals.cursor = view.add({ + user: Default, + item: null + })); + view.on(view.events("view", "pointermove"), cursor2, (_, event2) => { + const value2 = cursor2.value, user = value2 ? isString(value2) ? value2 : value2.user : Default, item = event2.item && event2.item.cursor || null; + return value2 && user === value2.user && item == value2.item ? value2 : { + user, + item + }; }); - // return generated expression code and dependencies - return { - $expr: (0, _vegaUtil.extend)({ - code: gen.code - }, scope.options.ast ? { - ast - } : null), - $fields: gen.fields, - $params: params - }; -} - -},{"vega-util":"bApja","vega-expression":"2l1no","vega-scale":"bEydG","d3-geo":"lY61T","d3-color":"7SCp9","vega-dataflow":"3NitK","vega-scenegraph":"jattk","vega-selections":"674qo","vega-statistics":"5ncfv","vega-time":"27kpp","d3-array":"6IwJG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2l1no":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ASTNode", ()=>ASTNode); -parcelHelpers.export(exports, "ArrayExpression", ()=>ArrayExpression); -parcelHelpers.export(exports, "BinaryExpression", ()=>BinaryExpression); -parcelHelpers.export(exports, "CallExpression", ()=>CallExpression); -parcelHelpers.export(exports, "ConditionalExpression", ()=>ConditionalExpression); -parcelHelpers.export(exports, "Identifier", ()=>Identifier); -parcelHelpers.export(exports, "Literal", ()=>Literal); -parcelHelpers.export(exports, "LogicalExpression", ()=>LogicalExpression); -parcelHelpers.export(exports, "MemberExpression", ()=>MemberExpression); -parcelHelpers.export(exports, "ObjectExpression", ()=>ObjectExpression); -parcelHelpers.export(exports, "Property", ()=>Property); -parcelHelpers.export(exports, "RawCode", ()=>RawCode); -parcelHelpers.export(exports, "UnaryExpression", ()=>UnaryExpression); -parcelHelpers.export(exports, "codegenExpression", ()=>codegen); -parcelHelpers.export(exports, "constants", ()=>Constants); -parcelHelpers.export(exports, "functions", ()=>Functions); -parcelHelpers.export(exports, "parseExpression", ()=>parser); -var _vegaUtil = require("vega-util"); -const RawCode = 'RawCode'; -const Literal = 'Literal'; -const Property = 'Property'; -const Identifier = 'Identifier'; -const ArrayExpression = 'ArrayExpression'; -const BinaryExpression = 'BinaryExpression'; -const CallExpression = 'CallExpression'; -const ConditionalExpression = 'ConditionalExpression'; -const LogicalExpression = 'LogicalExpression'; -const MemberExpression = 'MemberExpression'; -const ObjectExpression = 'ObjectExpression'; -const UnaryExpression = 'UnaryExpression'; -function ASTNode(type) { - this.type = type; -} -ASTNode.prototype.visit = function(visitor) { - let c, i, n; - if (visitor(this)) return 1; - for(c = children(this), i = 0, n = c.length; i < n; ++i){ - if (c[i].visit(visitor)) return 1; - } -}; -function children(node) { - switch(node.type){ - case ArrayExpression: - return node.elements; - case BinaryExpression: - case LogicalExpression: - return [ - node.left, - node.right - ]; - case CallExpression: - return [ - node.callee - ].concat(node.arguments); - case ConditionalExpression: - return [ - node.test, - node.consequent, - node.alternate - ]; - case MemberExpression: - return [ - node.object, - node.property - ]; - case ObjectExpression: - return node.properties; - case Property: - return [ - node.key, - node.value - ]; - case UnaryExpression: - return [ - node.argument - ]; - case Identifier: - case Literal: - case RawCode: - default: - return []; - } -} -/* - The following expression parser is based on Esprima (http://esprima.org/). - Original header comment and license for Esprima is included here: - - Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com> - Copyright (C) 2013 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com> - Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be> - Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl> - Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com> - Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com> - Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com> - Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com> - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ var TokenName, source, index, length, lookahead; -var TokenBooleanLiteral = 1, TokenEOF = 2, TokenIdentifier = 3, TokenKeyword = 4, TokenNullLiteral = 5, TokenNumericLiteral = 6, TokenPunctuator = 7, TokenStringLiteral = 8, TokenRegularExpression = 9; -TokenName = {}; -TokenName[TokenBooleanLiteral] = 'Boolean'; -TokenName[TokenEOF] = '<end>'; -TokenName[TokenIdentifier] = 'Identifier'; -TokenName[TokenKeyword] = 'Keyword'; -TokenName[TokenNullLiteral] = 'Null'; -TokenName[TokenNumericLiteral] = 'Numeric'; -TokenName[TokenPunctuator] = 'Punctuator'; -TokenName[TokenStringLiteral] = 'String'; -TokenName[TokenRegularExpression] = 'RegularExpression'; -var SyntaxArrayExpression = 'ArrayExpression', SyntaxBinaryExpression = 'BinaryExpression', SyntaxCallExpression = 'CallExpression', SyntaxConditionalExpression = 'ConditionalExpression', SyntaxIdentifier = 'Identifier', SyntaxLiteral = 'Literal', SyntaxLogicalExpression = 'LogicalExpression', SyntaxMemberExpression = 'MemberExpression', SyntaxObjectExpression = 'ObjectExpression', SyntaxProperty = 'Property', SyntaxUnaryExpression = 'UnaryExpression'; -// Error messages should be identical to V8. -var MessageUnexpectedToken = 'Unexpected token %0', MessageUnexpectedNumber = 'Unexpected number', MessageUnexpectedString = 'Unexpected string', MessageUnexpectedIdentifier = 'Unexpected identifier', MessageUnexpectedReserved = 'Unexpected reserved word', MessageUnexpectedEOS = 'Unexpected end of input', MessageInvalidRegExp = 'Invalid regular expression', MessageUnterminatedRegExp = 'Invalid regular expression: missing /', MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.', MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode'; -var ILLEGAL = 'ILLEGAL', DISABLED = 'Disabled.'; -// See also tools/generate-unicode-regex.py. -var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'), // eslint-disable-next-line no-misleading-character-class -RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); -// Ensure the condition is true, otherwise throw an error. -// This is only to have a better contract semantic, i.e. another safety net -// to catch a logic error. The condition shall be fulfilled in normal case. -// Do NOT use this to enforce a certain condition on any user input. -function assert(condition, message) { - /* istanbul ignore next */ if (!condition) throw new Error('ASSERT: ' + message); -} -function isDecimalDigit(ch) { - return ch >= 0x30 && ch <= 0x39; // 0..9 -} -function isHexDigit(ch) { - return '0123456789abcdefABCDEF'.includes(ch); -} -function isOctalDigit(ch) { - return '01234567'.includes(ch); -} -// 7.2 White Space -function isWhiteSpace(ch) { - return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && [ - 0x1680, - 0x180E, - 0x2000, - 0x2001, - 0x2002, - 0x2003, - 0x2004, - 0x2005, - 0x2006, - 0x2007, - 0x2008, - 0x2009, - 0x200A, - 0x202F, - 0x205F, - 0x3000, - 0xFEFF - ].includes(ch); -} -// 7.3 Line Terminators -function isLineTerminator(ch) { - return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; -} -// 7.6 Identifier Names and Identifiers -function isIdentifierStart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch)); -} -function isIdentifierPart(ch) { - return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore) - ch >= 0x41 && ch <= 0x5A || // A..Z - ch >= 0x61 && ch <= 0x7A || // a..z - ch >= 0x30 && ch <= 0x39 || // 0..9 - ch === 0x5C || // \ (backslash) - ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch)); -} -// 7.6.1.1 Keywords -const keywords = { - 'if': 1, - 'in': 1, - 'do': 1, - 'var': 1, - 'for': 1, - 'new': 1, - 'try': 1, - 'let': 1, - 'this': 1, - 'else': 1, - 'case': 1, - 'void': 1, - 'with': 1, - 'enum': 1, - 'while': 1, - 'break': 1, - 'catch': 1, - 'throw': 1, - 'const': 1, - 'yield': 1, - 'class': 1, - 'super': 1, - 'return': 1, - 'typeof': 1, - 'delete': 1, - 'switch': 1, - 'export': 1, - 'import': 1, - 'public': 1, - 'static': 1, - 'default': 1, - 'finally': 1, - 'extends': 1, - 'package': 1, - 'private': 1, - 'function': 1, - 'continue': 1, - 'debugger': 1, - 'interface': 1, - 'protected': 1, - 'instanceof': 1, - 'implements': 1 -}; -function skipComment() { - while(index < length){ - const ch = source.charCodeAt(index); - if (isWhiteSpace(ch) || isLineTerminator(ch)) ++index; - else break; - } -} -function scanHexEscape(prefix) { - var i, len, ch, code = 0; - len = prefix === 'u' ? 4 : 2; - for(i = 0; i < len; ++i)if (index < length && isHexDigit(source[index])) { - ch = source[index++]; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } else throwError({}, MessageUnexpectedToken, ILLEGAL); - return String.fromCharCode(code); -} -function scanUnicodeCodePointEscape() { - var ch, code, cu1, cu2; - ch = source[index]; - code = 0; - // At least, one hex digit is required. - if (ch === '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - while(index < length){ - ch = source[index++]; - if (!isHexDigit(ch)) break; - code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - if (code > 0x10FFFF || ch !== '}') throwError({}, MessageUnexpectedToken, ILLEGAL); - // UTF-16 Encoding - if (code <= 0xFFFF) return String.fromCharCode(code); - cu1 = (code - 0x10000 >> 10) + 0xD800; - cu2 = (code - 0x10000 & 1023) + 0xDC00; - return String.fromCharCode(cu1, cu2); -} -function getEscapedIdentifier() { - var ch, id; - ch = source.charCodeAt(index++); - id = String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id = ch; + view.add(null, function(_) { + let user = _.cursor, item = this.value; + if (!isString(user)) { + item = user.item; + user = user.user; + } + setCursor(view, user && user !== Default ? user : item || user); + return item; + }, { + cursor: cursor2 + }); + } + function setCursor(view, cursor2) { + const el = view.globalCursor() ? typeof document !== "undefined" && document.body : view.container(); + if (el) { + return cursor2 == null ? el.style.removeProperty("cursor") : el.style.cursor = cursor2; } - while(index < length){ - ch = source.charCodeAt(index); - if (!isIdentifierPart(ch)) break; - ++index; - id += String.fromCharCode(ch); - // '\u' (U+005C, U+0075) denotes an escaped character. - if (ch === 0x5C) { - id = id.substr(0, id.length - 1); - if (source.charCodeAt(index) !== 0x75) throwError({}, MessageUnexpectedToken, ILLEGAL); - ++index; - ch = scanHexEscape('u'); - if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - id += ch; - } + } + function dataref(view, name) { + var data2 = view._runtime.data; + if (!has$1(data2, name)) { + error("Unrecognized data set: " + name); } - return id; -} -function getIdentifier() { - var start, ch; - start = index++; - while(index < length){ - ch = source.charCodeAt(index); - if (ch === 0x5C) { - // Blackslash (U+005C) marks Unicode escape sequence. - index = start; - return getEscapedIdentifier(); + return data2[name]; + } + function data(name, values2) { + return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values2)); + } + function change(name, changes) { + if (!isChangeSet(changes)) { + error("Second argument to changes must be a changeset."); + } + const dataset = dataref(this, name); + dataset.modified = true; + return this.pulse(dataset.input, changes); + } + function insert(name, _) { + return change.call(this, name, changeset().insert(_)); + } + function remove(name, _) { + return change.call(this, name, changeset().remove(_)); + } + function width(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewWidth + padding2.left + padding2.right); + } + function height(view) { + var padding2 = view.padding(); + return Math.max(0, view._viewHeight + padding2.top + padding2.bottom); + } + function offset(view) { + var padding2 = view.padding(), origin = view._origin; + return [padding2.left + origin[0], padding2.top + origin[1]]; + } + function resizeRenderer(view) { + var origin = offset(view), w2 = width(view), h2 = height(view); + view._renderer.background(view.background()); + view._renderer.resize(w2, h2, origin); + view._handler.origin(origin); + view._resizeListeners.forEach((handler) => { + try { + handler(w2, h2); + } catch (error2) { + view.error(error2); + } + }); + } + function eventExtend(view, event2, item) { + var r = view._renderer, el = r && r.canvas(), p, e, translate2; + if (el) { + translate2 = offset(view); + e = event2.changedTouches ? event2.changedTouches[0] : event2; + p = point(e, el); + p[0] -= translate2[0]; + p[1] -= translate2[1]; + } + event2.dataflow = view; + event2.item = item; + event2.vega = extension(view, item, p); + return event2; + } + function extension(view, item, point2) { + const itemGroup = item ? item.mark.marktype === "group" ? item : item.mark.group : null; + function group2(name) { + var g = itemGroup, i; + if (name) for (i = item; i; i = i.mark.group) { + if (i.mark.name === name) { + g = i; + break; } - if (isIdentifierPart(ch)) ++index; - else break; + } + return g && g.mark && g.mark.interactive ? g : {}; + } + function xy(item2) { + if (!item2) return point2; + if (isString(item2)) item2 = group2(item2); + const p = point2.slice(); + while (item2) { + p[0] -= item2.x || 0; + p[1] -= item2.y || 0; + item2 = item2.mark && item2.mark.group; + } + return p; } - return source.slice(start, index); -} -function scanIdentifier() { - var start, id, type; - start = index; - // Backslash (U+005C) starts an escaped character. - id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); - // There is no keyword or literal with only one character. - // Thus, it must be an identifier. - if (id.length === 1) type = TokenIdentifier; - else if (keywords.hasOwnProperty(id)) // eslint-disable-line no-prototype-builtins - type = TokenKeyword; - else if (id === 'null') type = TokenNullLiteral; - else if (id === 'true' || id === 'false') type = TokenBooleanLiteral; - else type = TokenIdentifier; return { - type: type, - value: id, - start: start, - end: index + view: constant$5(view), + item: constant$5(item || {}), + group: group2, + xy, + x: (item2) => xy(item2)[0], + y: (item2) => xy(item2)[1] }; -} -// 7.7 Punctuators -function scanPunctuator() { - var start = index, code = source.charCodeAt(index), code2, ch1 = source[index], ch2, ch3, ch4; - switch(code){ - // Check for most common single-character punctuators. - case 0x2E: - case 0x28: - case 0x29: - case 0x3B: - case 0x2C: - case 0x7B: - case 0x7D: - case 0x5B: - case 0x5D: - case 0x3A: - case 0x3F: - case 0x7E: - // ~ - ++index; - return { - type: TokenPunctuator, - value: String.fromCharCode(code), - start: start, - end: index - }; - default: - code2 = source.charCodeAt(index + 1); - // '=' (U+003D) marks an assignment or comparison operator. - if (code2 === 0x3D) switch(code){ - case 0x2B: - case 0x2D: - case 0x2F: - case 0x3C: - case 0x3E: - case 0x5E: - case 0x7C: - case 0x25: - case 0x26: - case 0x2A: - // * - index += 2; - return { - type: TokenPunctuator, - value: String.fromCharCode(code) + String.fromCharCode(code2), - start: start, - end: index - }; - case 0x21: - case 0x3D: - // = - index += 2; - // !== and === - if (source.charCodeAt(index) === 0x3D) ++index; - return { - type: TokenPunctuator, - value: source.slice(start, index), - start: start, - end: index - }; - } - } - // 4-character punctuator: >>>= - ch4 = source.substr(index, 4); - if (ch4 === '>>>=') { - index += 4; - return { - type: TokenPunctuator, - value: ch4, - start: start, - end: index - }; - } - // 3-character punctuators: === !== >>> <<= >>= - ch3 = ch4.substr(0, 3); - if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') { - index += 3; - return { - type: TokenPunctuator, - value: ch3, - start: start, - end: index - }; - } - // Other 2-character punctuators: ++ -- << >> && || - ch2 = ch3.substr(0, 2); - if (ch1 === ch2[1] && '+-<>&|'.includes(ch1) || ch2 === '=>') { - index += 2; - return { - type: TokenPunctuator, - value: ch2, - start: start, - end: index - }; - } - if (ch2 === '//') throwError({}, MessageUnexpectedToken, ILLEGAL); - // 1-character punctuators: < > = ! + - * % & | ^ / - if ('<>=!+-*%&|^/'.includes(ch1)) { - ++index; - return { - type: TokenPunctuator, - value: ch1, - start: start, - end: index - }; - } - throwError({}, MessageUnexpectedToken, ILLEGAL); -} -// 7.8.3 Numeric Literals -function scanHexLiteral(start) { - let number = ''; - while(index < length){ - if (!isHexDigit(source[index])) break; - number += source[index++]; - } - if (number.length === 0) throwError({}, MessageUnexpectedToken, ILLEGAL); - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt('0x' + number, 16), - start: start, - end: index + } + const VIEW$1 = "view", TIMER = "timer", WINDOW = "window", NO_TRAP = { + trap: false + }; + function initializeEventConfig(config) { + const events2 = extend$1({ + defaults: {} + }, config); + const unpack = (obj, keys2) => { + keys2.forEach((k) => { + if (isArray(obj[k])) obj[k] = toSet(obj[k]); + }); }; -} -function scanOctalLiteral(start) { - let number = '0' + source[index++]; - while(index < length){ - if (!isOctalDigit(source[index])) break; - number += source[index++]; + unpack(events2.defaults, ["prevent", "allow"]); + unpack(events2, ["view", "window", "selector"]); + return events2; + } + function trackEventListener(view, sources, type2, handler) { + view._eventListeners.push({ + type: type2, + sources: array$5(sources), + handler + }); + } + function prevent(view, type2) { + var def2 = view._eventConfig.defaults, prevent2 = def2.prevent, allow = def2.allow; + return prevent2 === false || allow === true ? false : prevent2 === true || allow === false ? true : prevent2 ? prevent2[type2] : allow ? !allow[type2] : view.preventDefault(); + } + function permit(view, key2, type2) { + const rule2 = view._eventConfig && view._eventConfig[key2]; + if (rule2 === false || isObject$1(rule2) && !rule2[type2]) { + view.warn(`Blocked ${key2} ${type2} event listener.`); + return false; } - if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseInt(number, 8), - octal: true, - start: start, - end: index - }; -} -function scanNumericLiteral() { - var number, start, ch; - ch = source[index]; - assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point'); - start = index; - number = ''; - if (ch !== '.') { - number = source[index++]; - ch = source[index]; - // Hex number starts with '0x'. - // Octal number starts with '0'. - if (number === '0') { - if (ch === 'x' || ch === 'X') { - ++index; - return scanHexLiteral(start); - } - if (isOctalDigit(ch)) return scanOctalLiteral(start); - // decimal number starts with '0' such as '09' is illegal. - if (ch && isDecimalDigit(ch.charCodeAt(0))) throwError({}, MessageUnexpectedToken, ILLEGAL); - } - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === '.') { - number += source[index++]; - while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - ch = source[index]; - } - if (ch === 'e' || ch === 'E') { - number += source[index++]; - ch = source[index]; - if (ch === '+' || ch === '-') number += source[index++]; - if (isDecimalDigit(source.charCodeAt(index))) while(isDecimalDigit(source.charCodeAt(index)))number += source[index++]; - else throwError({}, MessageUnexpectedToken, ILLEGAL); - } - if (isIdentifierStart(source.charCodeAt(index))) throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenNumericLiteral, - value: parseFloat(number), - start: start, - end: index - }; -} -// 7.8.4 String Literals -function scanStringLiteral() { - var str = '', quote, start, ch, code, octal = false; - quote = source[index]; - assert(quote === '\'' || quote === '"', 'String literal must starts with a quote'); - start = index; - ++index; - while(index < length){ - ch = source[index++]; - if (ch === quote) { - quote = ''; - break; - } else if (ch === '\\') { - ch = source[index++]; - if (!ch || !isLineTerminator(ch.charCodeAt(0))) switch(ch){ - case 'u': - case 'x': - if (source[index] === '{') { - ++index; - str += scanUnicodeCodePointEscape(); - } else str += scanHexEscape(ch); - break; - case 'n': - str += '\n'; - break; - case 'r': - str += '\r'; - break; - case 't': - str += '\t'; - break; - case 'b': - str += '\b'; - break; - case 'f': - str += '\f'; - break; - case 'v': - str += '\x0B'; - break; - default: - if (isOctalDigit(ch)) { - code = '01234567'.indexOf(ch); - // \0 is not octal escape sequence - if (code !== 0) octal = true; - if (index < length && isOctalDigit(source[index])) { - octal = true; - code = code * 8 + '01234567'.indexOf(source[index++]); - // 3 digits are only allowed when string starts - // with 0, 1, 2, 3 - if ('0123'.includes(ch) && index < length && isOctalDigit(source[index])) code = code * 8 + '01234567'.indexOf(source[index++]); - } - str += String.fromCharCode(code); - } else str += ch; - break; - } - else if (ch === '\r' && source[index] === '\n') ++index; - } else if (isLineTerminator(ch.charCodeAt(0))) break; - else str += ch; + return true; + } + function events(source2, type2, filter2) { + var view = this, s = new EventStream(filter2), send = function(e, item) { + view.runAsync(null, () => { + if (source2 === VIEW$1 && prevent(view, type2)) { + e.preventDefault(); + } + s.receive(eventExtend(view, e, item)); + }); + }, sources; + if (source2 === TIMER) { + if (permit(view, "timer", type2)) { + view.timer(send, type2); + } + } else if (source2 === VIEW$1) { + if (permit(view, "view", type2)) { + view.addEventListener(type2, send, NO_TRAP); + } + } else { + if (source2 === WINDOW) { + if (permit(view, "window", type2) && typeof window !== "undefined") { + sources = [window]; + } + } else if (typeof document !== "undefined") { + if (permit(view, "selector", type2)) { + sources = Array.from(document.querySelectorAll(source2)); + } + } + if (!sources) { + view.warn("Can not resolve event source: " + source2); + } else { + for (var i = 0, n = sources.length; i < n; ++i) { + sources[i].addEventListener(type2, send); + } + trackEventListener(view, sources, type2, send); + } } - if (quote !== '') throwError({}, MessageUnexpectedToken, ILLEGAL); - return { - type: TokenStringLiteral, - value: str, - octal: octal, - start: start, - end: index + return s; + } + function itemFilter(event2) { + return event2.item; + } + function markTarget(event2) { + return event2.item.mark.source; + } + function invoke(name) { + return function(_, event2) { + return event2.vega.view().changeset().encode(event2.item, name); }; -} -function testRegExp(pattern, flags) { - let tmp = pattern; - if (flags.includes('u')) // Replace each astral symbol and every Unicode code point - // escape sequence with a single ASCII symbol to avoid throwing on - // regular expressions that are only valid in combination with the - // `/u` flag. - // Note: replacing with the ASCII symbol `x` might cause false - // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a - // perfectly valid pattern that is equivalent to `[a-b]`, but it - // would be replaced by `[x-b]` which throws an error. - tmp = tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g, ($0, $1)=>{ - if (parseInt($1, 16) <= 0x10FFFF) return 'x'; - throwError({}, MessageInvalidRegExp); - }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x'); - // First, detect invalid regular expressions. - try { - new RegExp(tmp); - } catch (e) { - throwError({}, MessageInvalidRegExp); + } + function hover(hoverSet, leaveSet) { + hoverSet = [hoverSet || "hover"]; + leaveSet = [leaveSet || "update", hoverSet[0]]; + this.on(this.events("view", "pointerover", itemFilter), markTarget, invoke(hoverSet)); + this.on(this.events("view", "pointerout", itemFilter), markTarget, invoke(leaveSet)); + return this; + } + function finalize() { + var tooltip = this._tooltip, timers = this._timers, handlers = this._handler.handlers(), listeners = this._eventListeners, n, m2, e, h2, t; + n = timers.length; + while (--n >= 0) { + timers[n].stop(); } - // Return a regular expression object for this pattern-flag pair, or - // `null` in case the current environment doesn't support the flags it - // uses. - try { - return new RegExp(pattern, flags); - } catch (exception) { - return null; + n = listeners.length; + while (--n >= 0) { + e = listeners[n]; + m2 = e.sources.length; + while (--m2 >= 0) { + e.sources[m2].removeEventListener(e.type, e.handler); + } } -} -function scanRegExpBody() { - var ch, str, classMarker, terminated, body; - ch = source[index]; - assert(ch === '/', 'Regular expression literal must start with a slash'); - str = source[index++]; - classMarker = false; - terminated = false; - while(index < length){ - ch = source[index++]; - str += ch; - if (ch === '\\') { - ch = source[index++]; - // ECMA-262 7.8.5 - if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - str += ch; - } else if (isLineTerminator(ch.charCodeAt(0))) throwError({}, MessageUnterminatedRegExp); - else if (classMarker) { - if (ch === ']') classMarker = false; - } else { - if (ch === '/') { - terminated = true; - break; - } else if (ch === '[') classMarker = true; - } + if (tooltip) { + tooltip.call(this, this._handler, null, null, null); } - if (!terminated) throwError({}, MessageUnterminatedRegExp); - // Exclude leading and trailing slash. - body = str.substr(1, str.length - 2); - return { - value: body, - literal: str - }; -} -function scanRegExpFlags() { - var ch, str, flags; - str = ''; - flags = ''; - while(index < length){ - ch = source[index]; - if (!isIdentifierPart(ch.charCodeAt(0))) break; - ++index; - if (ch === '\\' && index < length) throwError({}, MessageUnexpectedToken, ILLEGAL); - else { - flags += ch; - str += ch; + n = handlers.length; + while (--n >= 0) { + t = handlers[n].type; + h2 = handlers[n].handler; + this._handler.off(t, h2); + } + return this; + } + function element(tag, attr2, text2) { + const el = document.createElement(tag); + for (const key2 in attr2) el.setAttribute(key2, attr2[key2]); + if (text2 != null) el.textContent = text2; + return el; + } + const BindClass = "vega-bind", NameClass = "vega-bind-name", RadioClass = "vega-bind-radio"; + function bind(view, el, binding) { + if (!el) return; + const param2 = binding.param; + let bind2 = binding.state; + if (!bind2) { + bind2 = binding.state = { + elements: null, + active: false, + set: null, + update: (value2) => { + if (value2 != view.signal(param2.signal)) { + view.runAsync(null, () => { + bind2.source = true; + view.signal(param2.signal, value2); + }); + } } + }; + if (param2.debounce) { + bind2.update = debounce(param2.debounce, bind2.update); + } } - if (flags.search(/[^gimuy]/g) >= 0) throwError({}, MessageInvalidRegExp, flags); - return { - value: flags, - literal: str - }; -} -function scanRegExp() { - var start, body, flags, value; - lookahead = null; - skipComment(); - start = index; - body = scanRegExpBody(); - flags = scanRegExpFlags(); - value = testRegExp(body.value, flags.value); - return { - literal: body.literal + flags.literal, - value: value, - regex: { - pattern: body.value, - flags: flags.value - }, - start: start, - end: index + const create2 = param2.input == null && param2.element ? target : generate; + create2(bind2, el, param2, view); + if (!bind2.active) { + view.on(view._signals[param2.signal], null, () => { + bind2.source ? bind2.source = false : bind2.set(view.signal(param2.signal)); + }); + bind2.active = true; + } + return bind2; + } + function target(bind2, node, param2, view) { + const type2 = param2.event || "input"; + const handler = () => bind2.update(node.value); + view.signal(param2.signal, node.value); + node.addEventListener(type2, handler); + trackEventListener(view, node, type2, handler); + bind2.set = (value2) => { + node.value = value2; + node.dispatchEvent(event(type2)); }; -} -function isIdentifierName(token) { - return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral; -} -function advance() { - skipComment(); - if (index >= length) return { - type: TokenEOF, - start: index, - end: index + } + function event(type2) { + return typeof Event !== "undefined" ? new Event(type2) : { + type: type2 }; - const ch = source.charCodeAt(index); - if (isIdentifierStart(ch)) return scanIdentifier(); - // Very common: ( and ) and ; - if (ch === 0x28 || ch === 0x29 || ch === 0x3B) return scanPunctuator(); - // String literal starts with single quote (U+0027) or double quote (U+0022). - if (ch === 0x27 || ch === 0x22) return scanStringLiteral(); - // Dot (.) U+002E can also start a floating-point number, hence the need - // to check the next character. - if (ch === 0x2E) { - if (isDecimalDigit(source.charCodeAt(index + 1))) return scanNumericLiteral(); - return scanPunctuator(); - } - if (isDecimalDigit(ch)) return scanNumericLiteral(); - return scanPunctuator(); -} -function lex() { - const token = lookahead; - index = token.end; - lookahead = advance(); - index = token.end; - return token; -} -function peek() { - const pos = index; - lookahead = advance(); - index = pos; -} -function finishArrayExpression(elements) { - const node = new ASTNode(SyntaxArrayExpression); - node.elements = elements; - return node; -} -function finishBinaryExpression(operator, left, right) { - const node = new ASTNode(operator === '||' || operator === '&&' ? SyntaxLogicalExpression : SyntaxBinaryExpression); - node.operator = operator; - node.left = left; - node.right = right; - return node; -} -function finishCallExpression(callee, args) { - const node = new ASTNode(SyntaxCallExpression); - node.callee = callee; - node.arguments = args; - return node; -} -function finishConditionalExpression(test, consequent, alternate) { - const node = new ASTNode(SyntaxConditionalExpression); - node.test = test; - node.consequent = consequent; - node.alternate = alternate; - return node; -} -function finishIdentifier(name) { - const node = new ASTNode(SyntaxIdentifier); - node.name = name; - return node; -} -function finishLiteral(token) { - const node = new ASTNode(SyntaxLiteral); - node.value = token.value; - node.raw = source.slice(token.start, token.end); - if (token.regex) { - if (node.raw === '//') node.raw = '/(?:)/'; - node.regex = token.regex; + } + function generate(bind2, el, param2, view) { + const value2 = view.signal(param2.signal); + const div = element("div", { + "class": BindClass + }); + const wrapper = param2.input === "radio" ? div : div.appendChild(element("label")); + wrapper.appendChild(element("span", { + "class": NameClass + }, param2.name || param2.signal)); + el.appendChild(div); + let input = form; + switch (param2.input) { + case "checkbox": + input = checkbox; + break; + case "select": + input = select; + break; + case "radio": + input = radio; + break; + case "range": + input = range; + break; } - return node; -} -function finishMemberExpression(accessor, object, property) { - const node = new ASTNode(SyntaxMemberExpression); - node.computed = accessor === '['; - node.object = object; - node.property = property; - if (!node.computed) property.member = true; - return node; -} -function finishObjectExpression(properties) { - const node = new ASTNode(SyntaxObjectExpression); - node.properties = properties; - return node; -} -function finishProperty(kind, key, value) { - const node = new ASTNode(SyntaxProperty); - node.key = key; - node.value = value; - node.kind = kind; - return node; -} -function finishUnaryExpression(operator, argument) { - const node = new ASTNode(SyntaxUnaryExpression); - node.operator = operator; - node.argument = argument; - node.prefix = true; - return node; -} -// Throw an exception -function throwError(token, messageFormat) { - var error, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index)=>{ - assert(index < args.length, 'Message reference must be in range'); - return args[index]; + input(bind2, wrapper, param2, value2); + } + function form(bind2, el, param2, value2) { + const node = element("input"); + for (const key2 in param2) { + if (key2 !== "signal" && key2 !== "element") { + node.setAttribute(key2 === "input" ? "type" : key2, param2[key2]); + } + } + node.setAttribute("name", param2.signal); + node.value = value2; + el.appendChild(node); + node.addEventListener("input", () => bind2.update(node.value)); + bind2.elements = [node]; + bind2.set = (value3) => node.value = value3; + } + function checkbox(bind2, el, param2, value2) { + const attr2 = { + type: "checkbox", + name: param2.signal + }; + if (value2) attr2.checked = true; + const node = element("input", attr2); + el.appendChild(node); + node.addEventListener("change", () => bind2.update(node.checked)); + bind2.elements = [node]; + bind2.set = (value3) => node.checked = !!value3 || null; + } + function select(bind2, el, param2, value2) { + const node = element("select", { + name: param2.signal + }), labels = param2.labels || []; + param2.options.forEach((option, i) => { + const attr2 = { + value: option + }; + if (valuesEqual(option, value2)) attr2.selected = true; + node.appendChild(element("option", attr2, (labels[i] || option) + "")); }); - error = new Error(msg); - error.index = index; - error.description = msg; - throw error; -} -// Throw an exception because of the token. -function throwUnexpected(token) { - if (token.type === TokenEOF) throwError(token, MessageUnexpectedEOS); - if (token.type === TokenNumericLiteral) throwError(token, MessageUnexpectedNumber); - if (token.type === TokenStringLiteral) throwError(token, MessageUnexpectedString); - if (token.type === TokenIdentifier) throwError(token, MessageUnexpectedIdentifier); - if (token.type === TokenKeyword) throwError(token, MessageUnexpectedReserved); - // BooleanLiteral, NullLiteral, or Punctuator. - throwError(token, MessageUnexpectedToken, token.value); -} -// Expect the next token to match the specified punctuator. -// If not, an exception will be thrown. -function expect(value) { - const token = lex(); - if (token.type !== TokenPunctuator || token.value !== value) throwUnexpected(token); -} -// Return true if the next token matches the specified punctuator. -function match(value) { - return lookahead.type === TokenPunctuator && lookahead.value === value; -} -// Return true if the next token matches the specified keyword -function matchKeyword(keyword) { - return lookahead.type === TokenKeyword && lookahead.value === keyword; -} -// 11.1.4 Array Initialiser -function parseArrayInitialiser() { - const elements = []; - index = lookahead.start; - expect('['); - while(!match(']'))if (match(',')) { - lex(); - elements.push(null); - } else { - elements.push(parseConditionalExpression()); - if (!match(']')) expect(','); + el.appendChild(node); + node.addEventListener("change", () => { + bind2.update(param2.options[node.selectedIndex]); + }); + bind2.elements = [node]; + bind2.set = (value3) => { + for (let i = 0, n = param2.options.length; i < n; ++i) { + if (valuesEqual(param2.options[i], value3)) { + node.selectedIndex = i; + return; + } + } + }; + } + function radio(bind2, el, param2, value2) { + const group2 = element("span", { + "class": RadioClass + }), labels = param2.labels || []; + el.appendChild(group2); + bind2.elements = param2.options.map((option, i) => { + const attr2 = { + type: "radio", + name: param2.signal, + value: option + }; + if (valuesEqual(option, value2)) attr2.checked = true; + const input = element("input", attr2); + input.addEventListener("change", () => bind2.update(option)); + const label2 = element("label", {}, (labels[i] || option) + ""); + label2.prepend(input); + group2.appendChild(label2); + return input; + }); + bind2.set = (value3) => { + const nodes = bind2.elements, n = nodes.length; + for (let i = 0; i < n; ++i) { + if (valuesEqual(nodes[i].value, value3)) nodes[i].checked = true; + } + }; + } + function range(bind2, el, param2, value2) { + value2 = value2 !== void 0 ? value2 : (+param2.max + +param2.min) / 2; + const max2 = param2.max != null ? param2.max : Math.max(100, +value2) || 100, min2 = param2.min || Math.min(0, max2, +value2) || 0, step = param2.step || tickStep(min2, max2, 100); + const node = element("input", { + type: "range", + name: param2.signal, + min: min2, + max: max2, + step + }); + node.value = value2; + const span2 = element("span", {}, +value2); + el.appendChild(node); + el.appendChild(span2); + const update2 = () => { + span2.textContent = node.value; + bind2.update(+node.value); + }; + node.addEventListener("input", update2); + node.addEventListener("change", update2); + bind2.elements = [node]; + bind2.set = (value3) => { + node.value = value3; + span2.textContent = value3; + }; + } + function valuesEqual(a2, b2) { + return a2 === b2 || a2 + "" === b2 + ""; + } + function initializeRenderer(view, r, el, constructor, scaleFactor, opt) { + r = r || new constructor(view.loader()); + return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background()); + } + function trap(view, fn) { + return !fn ? null : function() { + try { + fn.apply(this, arguments); + } catch (error2) { + view.error(error2); + } + }; + } + function initializeHandler(view, prevHandler, el, constructor) { + const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); + if (prevHandler) { + prevHandler.handlers().forEach((h2) => { + handler.on(h2.type, h2.handler); + }); } - lex(); - return finishArrayExpression(elements); -} -// 11.1.5 Object Initialiser -function parseObjectPropertyKey() { - index = lookahead.start; - const token = lex(); - // Note: This function is called only from parseObjectProperty(), where - // EOF and Punctuator tokens are already filtered out. - if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) { - if (token.octal) throwError(token, MessageStrictOctalLiteral); - return finishLiteral(token); + return handler; + } + function initialize(el, elBind) { + const view = this, type2 = view._renderType, config = view._eventConfig.bind, module = renderModule(type2); + el = view._el = el ? lookup$1(view, el, true) : null; + initializeAria(view); + if (!module) view.error("Unrecognized renderer type: " + type2); + const Handler2 = module.handler || CanvasHandler, Renderer2 = el ? module.renderer : module.headless; + view._renderer = !Renderer2 ? null : initializeRenderer(view, view._renderer, el, Renderer2); + view._handler = initializeHandler(view, view._handler, el, Handler2); + view._redraw = true; + if (el && config !== "none") { + elBind = elBind ? view._elBind = lookup$1(view, elBind, true) : el.appendChild(element("form", { + "class": "vega-bindings" + })); + view._bind.forEach((_) => { + if (_.param.element && config !== "container") { + _.element = lookup$1(view, _.param.element, !!_.param.input); + } + }); + view._bind.forEach((_) => { + bind(view, _.element || elBind, _); + }); } - return finishIdentifier(token.value); -} -function parseObjectProperty() { - var token, key, id, value; - index = lookahead.start; - token = lookahead; - if (token.type === TokenIdentifier) { - id = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', id, value); + return view; + } + function lookup$1(view, el, clear) { + if (typeof el === "string") { + if (typeof document !== "undefined") { + el = document.querySelector(el); + if (!el) { + view.error("Signal bind element not found: " + el); + return null; + } + } else { + view.error("DOM document instance not found."); + return null; + } } - if (token.type === TokenEOF || token.type === TokenPunctuator) throwUnexpected(token); - else { - key = parseObjectPropertyKey(); - expect(':'); - value = parseConditionalExpression(); - return finishProperty('init', key, value); - } -} -function parseObjectInitialiser() { - var properties = [], property, name, key, map = {}, toString = String; - index = lookahead.start; - expect('{'); - while(!match('}')){ - property = parseObjectProperty(); - if (property.key.type === SyntaxIdentifier) name = property.key.name; - else name = toString(property.key.value); - key = '$' + name; - if (Object.prototype.hasOwnProperty.call(map, key)) throwError({}, MessageStrictDuplicateProperty); - else map[key] = true; - properties.push(property); - if (!match('}')) expect(','); - } - expect('}'); - return finishObjectExpression(properties); -} -// 11.1.6 The Grouping Operator -function parseGroupExpression() { - expect('('); - const expr = parseExpression(); - expect(')'); - return expr; -} -// 11.1 Primary Expressions -const legalKeywords = { - 'if': 1 -}; -function parsePrimaryExpression() { - var type, token, expr; - if (match('(')) return parseGroupExpression(); - if (match('[')) return parseArrayInitialiser(); - if (match('{')) return parseObjectInitialiser(); - type = lookahead.type; - index = lookahead.start; - if (type === TokenIdentifier || legalKeywords[lookahead.value]) expr = finishIdentifier(lex().value); - else if (type === TokenStringLiteral || type === TokenNumericLiteral) { - if (lookahead.octal) throwError(lookahead, MessageStrictOctalLiteral); - expr = finishLiteral(lex()); - } else if (type === TokenKeyword) throw new Error(DISABLED); - else if (type === TokenBooleanLiteral) { - token = lex(); - token.value = token.value === 'true'; - expr = finishLiteral(token); - } else if (type === TokenNullLiteral) { - token = lex(); - token.value = null; - expr = finishLiteral(token); - } else if (match('/') || match('/=')) { - expr = finishLiteral(scanRegExp()); - peek(); - } else throwUnexpected(lex()); - return expr; -} -// 11.2 Left-Hand-Side Expressions -function parseArguments() { - const args = []; - expect('('); - if (!match(')')) while(index < length){ - args.push(parseConditionalExpression()); - if (match(')')) break; - expect(','); + if (el && clear) { + try { + el.textContent = ""; + } catch (e) { + el = null; + view.error(e); + } } - expect(')'); - return args; -} -function parseNonComputedProperty() { - index = lookahead.start; - const token = lex(); - if (!isIdentifierName(token)) throwUnexpected(token); - return finishIdentifier(token.value); -} -function parseNonComputedMember() { - expect('.'); - return parseNonComputedProperty(); -} -function parseComputedMember() { - expect('['); - const expr = parseExpression(); - expect(']'); - return expr; -} -function parseLeftHandSideExpressionAllowCall() { - var expr, args, property; - expr = parsePrimaryExpression(); - for(;;){ - if (match('.')) { - property = parseNonComputedMember(); - expr = finishMemberExpression('.', expr, property); - } else if (match('(')) { - args = parseArguments(); - expr = finishCallExpression(expr, args); - } else if (match('[')) { - property = parseComputedMember(); - expr = finishMemberExpression('[', expr, property); - } else break; - } - return expr; -} -// 11.3 Postfix Expressions -function parsePostfixExpression() { - const expr = parseLeftHandSideExpressionAllowCall(); - if (lookahead.type === TokenPunctuator) { - if (match('++') || match('--')) throw new Error(DISABLED); - } - return expr; -} -// 11.4 Unary Operators -function parseUnaryExpression() { - var token, expr; - if (lookahead.type !== TokenPunctuator && lookahead.type !== TokenKeyword) expr = parsePostfixExpression(); - else if (match('++') || match('--')) throw new Error(DISABLED); - else if (match('+') || match('-') || match('~') || match('!')) { - token = lex(); - expr = parseUnaryExpression(); - expr = finishUnaryExpression(token.value, expr); - } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) throw new Error(DISABLED); - else expr = parsePostfixExpression(); - return expr; -} -function binaryPrecedence(token) { - let prec = 0; - if (token.type !== TokenPunctuator && token.type !== TokenKeyword) return 0; - switch(token.value){ - case '||': - prec = 1; - break; - case '&&': - prec = 2; - break; - case '|': - prec = 3; - break; - case '^': - prec = 4; - break; - case '&': - prec = 5; - break; - case '==': - case '!=': - case '===': - case '!==': - prec = 6; - break; - case '<': - case '>': - case '<=': - case '>=': - case 'instanceof': - case 'in': - prec = 7; - break; - case '<<': - case '>>': - case '>>>': - prec = 8; - break; - case '+': - case '-': - prec = 9; - break; - case '*': - case '/': - case '%': - prec = 11; - break; + return el; + } + const number$1 = (_) => +_ || 0; + const paddingObject$1 = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function padding(_) { + return isObject$1(_) ? { + top: number$1(_.top), + bottom: number$1(_.bottom), + left: number$1(_.left), + right: number$1(_.right) + } : paddingObject$1(number$1(_)); + } + async function renderHeadless(view, type2, scaleFactor, opt) { + const module = renderModule(type2), ctr = module && module.headless; + if (!ctr) error("Unrecognized renderer type: " + type2); + await view.runAsync(); + return initializeRenderer(view, null, null, ctr, scaleFactor, opt).renderAsync(view._scenegraph.root); + } + async function renderToImageURL(type2, scaleFactor) { + if (type2 !== RenderType.Canvas && type2 !== RenderType.SVG && type2 !== RenderType.PNG) { + error("Unrecognized image type: " + type2); } - return prec; -} -// 11.5 Multiplicative Operators -// 11.6 Additive Operators -// 11.7 Bitwise Shift Operators -// 11.8 Relational Operators -// 11.9 Equality Operators -// 11.10 Binary Bitwise Operators -// 11.11 Binary Logical Operators -function parseBinaryExpression() { - var marker, markers, expr, token, prec, stack, right, operator, left, i; - marker = lookahead; - left = parseUnaryExpression(); - token = lookahead; - prec = binaryPrecedence(token); - if (prec === 0) return left; - token.prec = prec; - lex(); - markers = [ - marker, - lookahead - ]; - right = parseUnaryExpression(); - stack = [ - left, - token, - right - ]; - while((prec = binaryPrecedence(lookahead)) > 0){ - // Reduce: make a binary expression from the three topmost entries. - while(stack.length > 2 && prec <= stack[stack.length - 2].prec){ - right = stack.pop(); - operator = stack.pop().value; - left = stack.pop(); - markers.pop(); - expr = finishBinaryExpression(operator, left, right); - stack.push(expr); - } - // Shift. - token = lex(); - token.prec = prec; - stack.push(token); - markers.push(lookahead); - expr = parseUnaryExpression(); - stack.push(expr); - } - // Final reduce to clean-up the stack. - i = stack.length - 1; - expr = stack[i]; - markers.pop(); - while(i > 1){ - markers.pop(); - expr = finishBinaryExpression(stack[i - 1].value, stack[i - 2], expr); - i -= 2; - } - return expr; -} -// 11.12 Conditional Operator -function parseConditionalExpression() { - var expr, consequent, alternate; - expr = parseBinaryExpression(); - if (match('?')) { - lex(); - consequent = parseConditionalExpression(); - expect(':'); - alternate = parseConditionalExpression(); - expr = finishConditionalExpression(expr, consequent, alternate); - } - return expr; -} -// 11.14 Comma Operator -function parseExpression() { - const expr = parseConditionalExpression(); - if (match(',')) throw new Error(DISABLED); // no sequence expressions - return expr; -} -function parser(code) { - source = code; - index = 0; - length = source.length; - lookahead = null; - peek(); - const expr = parseExpression(); - if (lookahead.type !== TokenEOF) throw new Error('Unexpect token after expression.'); - return expr; -} -var Constants = { - NaN: 'NaN', - E: 'Math.E', - LN2: 'Math.LN2', - LN10: 'Math.LN10', - LOG2E: 'Math.LOG2E', - LOG10E: 'Math.LOG10E', - PI: 'Math.PI', - SQRT1_2: 'Math.SQRT1_2', - SQRT2: 'Math.SQRT2', - MIN_VALUE: 'Number.MIN_VALUE', - MAX_VALUE: 'Number.MAX_VALUE' -}; -function Functions(codegen) { - function fncall(name, args, cast, type) { - let obj = codegen(args[0]); - if (cast) { - obj = cast + '(' + obj + ')'; - if (cast.lastIndexOf('new ', 0) === 0) obj = '(' + obj + ')'; - } - return obj + '.' + name + (type < 0 ? '' : type === 0 ? '()' : '(' + args.slice(1).map(codegen).join(',') + ')'); - } - function fn(name, cast, type) { - return (args)=>fncall(name, args, cast, type); - } - const DATE = 'new Date', STRING = 'String', REGEXP = 'RegExp'; - return { - // MATH functions - isNaN: 'Number.isNaN', - isFinite: 'Number.isFinite', - abs: 'Math.abs', - acos: 'Math.acos', - asin: 'Math.asin', - atan: 'Math.atan', - atan2: 'Math.atan2', - ceil: 'Math.ceil', - cos: 'Math.cos', - exp: 'Math.exp', - floor: 'Math.floor', - hypot: 'Math.hypot', - log: 'Math.log', - max: 'Math.max', - min: 'Math.min', - pow: 'Math.pow', - random: 'Math.random', - round: 'Math.round', - sin: 'Math.sin', - sqrt: 'Math.sqrt', - tan: 'Math.tan', - clamp: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to clamp function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to clamp function.'); - const a = args.map(codegen); - return 'Math.max(' + a[1] + ', Math.min(' + a[2] + ',' + a[0] + '))'; - }, - // DATE functions - now: 'Date.now', - utc: 'Date.UTC', - datetime: DATE, - date: fn('getDate', DATE, 0), - day: fn('getDay', DATE, 0), - year: fn('getFullYear', DATE, 0), - month: fn('getMonth', DATE, 0), - hours: fn('getHours', DATE, 0), - minutes: fn('getMinutes', DATE, 0), - seconds: fn('getSeconds', DATE, 0), - milliseconds: fn('getMilliseconds', DATE, 0), - time: fn('getTime', DATE, 0), - timezoneoffset: fn('getTimezoneOffset', DATE, 0), - utcdate: fn('getUTCDate', DATE, 0), - utcday: fn('getUTCDay', DATE, 0), - utcyear: fn('getUTCFullYear', DATE, 0), - utcmonth: fn('getUTCMonth', DATE, 0), - utchours: fn('getUTCHours', DATE, 0), - utcminutes: fn('getUTCMinutes', DATE, 0), - utcseconds: fn('getUTCSeconds', DATE, 0), - utcmilliseconds: fn('getUTCMilliseconds', DATE, 0), - // sequence functions - length: fn('length', null, -1), - // STRING functions - parseFloat: 'parseFloat', - parseInt: 'parseInt', - upper: fn('toUpperCase', STRING, 0), - lower: fn('toLowerCase', STRING, 0), - substring: fn('substring', STRING), - split: fn('split', STRING), - trim: fn('trim', STRING, 0), - // base64 encode/decode - btoa: 'btoa', - atob: 'atob', - // REGEXP functions - regexp: REGEXP, - test: fn('test', REGEXP), - // Control Flow functions - if: function(args) { - if (args.length < 3) (0, _vegaUtil.error)('Missing arguments to if function.'); - if (args.length > 3) (0, _vegaUtil.error)('Too many arguments to if function.'); - const a = args.map(codegen); - return '(' + a[0] + '?' + a[1] + ':' + a[2] + ')'; - } - }; -} -function stripQuotes(s) { - const n = s && s.length - 1; - return n && (s[0] === '"' && s[n] === '"' || s[0] === '\'' && s[n] === '\'') ? s.slice(1, -1) : s; -} -function codegen(opt) { - opt = opt || {}; - const allowed = opt.allowed ? (0, _vegaUtil.toSet)(opt.allowed) : {}, forbidden = opt.forbidden ? (0, _vegaUtil.toSet)(opt.forbidden) : {}, constants = opt.constants || Constants, functions = (opt.functions || Functions)(visit), globalvar = opt.globalvar, fieldvar = opt.fieldvar, outputGlobal = (0, _vegaUtil.isFunction)(globalvar) ? globalvar : (id)=>`${globalvar}["${id}"]`; - let globals = {}, fields = {}, memberDepth = 0; - function visit(ast) { - if ((0, _vegaUtil.isString)(ast)) return ast; - const generator = Generators[ast.type]; - if (generator == null) (0, _vegaUtil.error)('Unsupported type: ' + ast.type); - return generator(ast); + const r = await renderHeadless(this, type2, scaleFactor); + return type2 === RenderType.SVG ? toBlobURL(r.svg(), "image/svg+xml") : r.canvas().toDataURL("image/png"); + } + function toBlobURL(data2, mime) { + const blob = new Blob([data2], { + type: mime + }); + return window.URL.createObjectURL(blob); + } + async function renderToCanvas(scaleFactor, opt) { + const r = await renderHeadless(this, RenderType.Canvas, scaleFactor, opt); + return r.canvas(); + } + async function renderToSVG(scaleFactor) { + const r = await renderHeadless(this, RenderType.SVG, scaleFactor); + return r.svg(); + } + function runtime(view, spec, expr2) { + return context(view, transforms, functionContext, expr2).parse(spec); + } + function scale$3(name) { + var scales2 = this._runtime.scales; + if (!has$1(scales2, name)) { + error("Unrecognized scale or projection: " + name); } - const Generators = { - Literal: (n)=>n.raw, - Identifier: (n)=>{ - const id = n.name; - if (memberDepth > 0) return id; - else if ((0, _vegaUtil.hasOwnProperty)(forbidden, id)) return (0, _vegaUtil.error)('Illegal identifier: ' + id); - else if ((0, _vegaUtil.hasOwnProperty)(constants, id)) return constants[id]; - else if ((0, _vegaUtil.hasOwnProperty)(allowed, id)) return id; - else { - globals[id] = 1; - return outputGlobal(id); - } - }, - MemberExpression: (n)=>{ - const d = !n.computed, o = visit(n.object); - if (d) memberDepth += 1; - const p = visit(n.property); - if (o === fieldvar) // strip quotes to sanitize field name (#1653) - fields[stripQuotes(p)] = 1; - if (d) memberDepth -= 1; - return o + (d ? '.' + p : '[' + p + ']'); - }, - CallExpression: (n)=>{ - if (n.callee.type !== 'Identifier') (0, _vegaUtil.error)('Illegal callee type: ' + n.callee.type); - const callee = n.callee.name, args = n.arguments, fn = (0, _vegaUtil.hasOwnProperty)(functions, callee) && functions[callee]; - if (!fn) (0, _vegaUtil.error)('Unrecognized function: ' + callee); - return (0, _vegaUtil.isFunction)(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')'; - }, - ArrayExpression: (n)=>'[' + n.elements.map(visit).join(',') + ']', - BinaryExpression: (n)=>'(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')', - UnaryExpression: (n)=>'(' + n.operator + visit(n.argument) + ')', - ConditionalExpression: (n)=>'(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')', - LogicalExpression: (n)=>'(' + visit(n.left) + n.operator + visit(n.right) + ')', - ObjectExpression: (n)=>'{' + n.properties.map(visit).join(',') + '}', - Property: (n)=>{ - memberDepth += 1; - const k = visit(n.key); - memberDepth -= 1; - return k + ':' + visit(n.value); - } - }; - function codegen(ast) { - const result = { - code: visit(ast), - globals: Object.keys(globals), - fields: Object.keys(fields) - }; - globals = {}; - fields = {}; - return result; + return scales2[name].value; + } + var Width = "width", Height = "height", Padding = "padding", Skip$1 = { + skip: true + }; + function viewWidth(view, width2) { + var a2 = view.autosize(), p = view.padding(); + return width2 - (a2 && a2.contains === Padding ? p.left + p.right : 0); + } + function viewHeight(view, height2) { + var a2 = view.autosize(), p = view.padding(); + return height2 - (a2 && a2.contains === Padding ? p.top + p.bottom : 0); + } + function initializeResize(view) { + var s = view._signals, w2 = s[Width], h2 = s[Height], p = s[Padding]; + function resetSize() { + view._autosize = view._resize = 1; + } + view._resizeWidth = view.add(null, (_) => { + view._width = _.size; + view._viewWidth = viewWidth(view, _.size); + resetSize(); + }, { + size: w2 + }); + view._resizeHeight = view.add(null, (_) => { + view._height = _.size; + view._viewHeight = viewHeight(view, _.size); + resetSize(); + }, { + size: h2 + }); + const resizePadding = view.add(null, resetSize, { + pad: p + }); + view._resizeWidth.rank = w2.rank + 1; + view._resizeHeight.rank = h2.rank + 1; + resizePadding.rank = p.rank + 1; + } + function resizeView(viewWidth2, viewHeight2, width2, height2, origin, auto) { + this.runAfter((view) => { + let rerun2 = 0; + view._autosize = 0; + if (view.width() !== width2) { + rerun2 = 1; + view.signal(Width, width2, Skip$1); + view._resizeWidth.skip(true); + } + if (view.height() !== height2) { + rerun2 = 1; + view.signal(Height, height2, Skip$1); + view._resizeHeight.skip(true); + } + if (view._viewWidth !== viewWidth2) { + view._resize = 1; + view._viewWidth = viewWidth2; + } + if (view._viewHeight !== viewHeight2) { + view._resize = 1; + view._viewHeight = viewHeight2; + } + if (view._origin[0] !== origin[0] || view._origin[1] !== origin[1]) { + view._resize = 1; + view._origin = origin; + } + if (rerun2) view.run("enter"); + if (auto) view.runAfter((v) => v.resize()); + }, false, 1); + } + function getState(options) { + return this._runtime.getState(options || { + data: dataTest, + signals: signalTest, + recurse: true + }); + } + function dataTest(name, data2) { + return data2.modified && isArray(data2.input.value) && !name.startsWith("_:vega:_"); + } + function signalTest(name, op) { + return !(name === "parent" || op instanceof transforms.proxy); + } + function setState(state) { + this.runAsync(null, (v) => { + v._trigger = false; + v._runtime.setState(state); + }, (v) => { + v._trigger = true; + }); + return this; + } + function timer(callback, delay) { + function tick(elapsed) { + callback({ + timestamp: Date.now(), + elapsed + }); } - codegen.functions = functions; - codegen.constants = constants; - return codegen; -} - -},{"vega-util":"bApja","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"674qo":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "selectionIdTest", ()=>selectionIdTest); -parcelHelpers.export(exports, "selectionResolve", ()=>selectionResolve); -parcelHelpers.export(exports, "selectionTest", ()=>selectionTest); -parcelHelpers.export(exports, "selectionTuples", ()=>selectionTuples); -parcelHelpers.export(exports, "selectionVisitor", ()=>selectionVisitor); -var _d3Array = require("d3-array"); -var _vegaUtil = require("vega-util"); -var _vegaExpression = require("vega-expression"); -// Registers vega-util field accessors to protect against XSS attacks -const SELECTION_GETTER = Symbol('vega_selection_getter'); -function getter(f) { - if (!f.getter || !f.getter[SELECTION_GETTER]) { - f.getter = (0, _vegaUtil.field)(f.field); - f.getter[SELECTION_GETTER] = true; + this._timers.push(interval(tick, delay)); + } + function defaultTooltip(handler, event2, item, value2) { + const el = handler.element(); + if (el) el.setAttribute("title", formatTooltip(value2)); + } + function formatTooltip(value2) { + return value2 == null ? "" : isArray(value2) ? formatArray(value2) : isObject$1(value2) && !isDate$1(value2) ? formatObject(value2) : value2 + ""; + } + function formatObject(obj) { + return Object.keys(obj).map((key2) => { + const v = obj[key2]; + return key2 + ": " + (isArray(v) ? formatArray(v) : formatValue(v)); + }).join("\n"); + } + function formatArray(value2) { + return "[" + value2.map(formatValue).join(", ") + "]"; + } + function formatValue(value2) { + return isArray(value2) ? "[…]" : isObject$1(value2) && !isDate$1(value2) ? "{…}" : value2; + } + function watchPixelRatio() { + if (this.renderer() === "canvas" && this._renderer._canvas) { + let remove2 = null; + const updatePixelRatio = () => { + if (remove2 != null) { + remove2(); + } + const media = matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`); + media.addEventListener("change", updatePixelRatio); + remove2 = () => { + media.removeEventListener("change", updatePixelRatio); + }; + this._renderer._canvas.getContext("2d").pixelRatio = window.devicePixelRatio || 1; + this._redraw = true; + this._resize = 1; + this.resize().runAsync(); + }; + updatePixelRatio(); } - return f.getter; -} -const Intersect = 'intersect'; -const Union = 'union'; -const VlMulti = 'vlMulti'; -const VlPoint = 'vlPoint'; -const Or = 'or'; -const And = 'and'; -const SelectionId = '_vgsid_'; -const $selectionId = (0, _vegaUtil.field)(SelectionId); -const TYPE_ENUM = 'E', TYPE_RANGE_INC = 'R', TYPE_RANGE_EXC = 'R-E', TYPE_RANGE_LE = 'R-LE', TYPE_RANGE_RE = 'R-RE', TYPE_PRED_LT = 'E-LT', TYPE_PRED_LTE = 'E-LTE', TYPE_PRED_GT = 'E-GT', TYPE_PRED_GTE = 'E-GTE', TYPE_PRED_VALID = 'E-VALID', TYPE_PRED_ONE_OF = 'E-ONE', UNIT_INDEX = 'index:unit'; -// TODO: revisit date coercion? -function testPoint(datum, entry) { - var fields = entry.fields, values = entry.values, n = fields.length, i = 0, dval, f; - for(; i < n; ++i){ - f = fields[i]; - dval = getter(f)(datum); - if ((0, _vegaUtil.isDate)(dval)) dval = (0, _vegaUtil.toNumber)(dval); - if ((0, _vegaUtil.isDate)(values[i])) values[i] = (0, _vegaUtil.toNumber)(values[i]); - if ((0, _vegaUtil.isArray)(values[i]) && (0, _vegaUtil.isDate)(values[i][0])) values[i] = values[i].map((0, _vegaUtil.toNumber)); - if (f.type === TYPE_ENUM) { - // Enumerated fields can either specify individual values (single/multi selections) - // or an array of values (interval selections). - if ((0, _vegaUtil.isArray)(values[i]) ? !values[i].includes(dval) : dval !== values[i]) return false; - } else { - if (f.type === TYPE_RANGE_INC) { - if (!(0, _vegaUtil.inrange)(dval, values[i])) return false; - } else if (f.type === TYPE_RANGE_RE) { - // Discrete selection of bins test within the range [bin_start, bin_end). - if (!(0, _vegaUtil.inrange)(dval, values[i], true, false)) return false; - } else if (f.type === TYPE_RANGE_EXC) { - // 'R-E'/'R-LE' included for completeness. - if (!(0, _vegaUtil.inrange)(dval, values[i], false, false)) return false; - } else if (f.type === TYPE_RANGE_LE) { - if (!(0, _vegaUtil.inrange)(dval, values[i], false, true)) return false; - } else if (f.type === TYPE_PRED_LT) { - if (dval >= values[i]) return false; - } else if (f.type === TYPE_PRED_LTE) { - if (dval > values[i]) return false; - } else if (f.type === TYPE_PRED_GT) { - if (dval <= values[i]) return false; - } else if (f.type === TYPE_PRED_GTE) { - if (dval < values[i]) return false; - } else if (f.type === TYPE_PRED_VALID) { - if (dval === null || isNaN(dval)) return false; - } else if (f.type === TYPE_PRED_ONE_OF) { - if (values[i].indexOf(dval) === -1) return false; - } - } + } + function View$1(spec, options) { + const view = this; + options = options || {}; + Dataflow.call(view); + if (options.loader) view.loader(options.loader); + if (options.logger) view.logger(options.logger); + if (options.logLevel != null) view.logLevel(options.logLevel); + if (options.locale || spec.locale) { + const loc = extend$1({}, spec.locale, options.locale); + view.locale(locale(loc.number, loc.time)); } - return true; -} -/** - * Tests if a tuple is contained within an interactive selection. - * @param {string} name - The name of the data set representing the selection. - * Tuples in the dataset are of the form - * {unit: string, fields: array<fielddef>, values: array<*>}. - * Fielddef is of the form - * {field: string, channel: string, type: 'E' | 'R'} where - * 'type' identifies whether tuples in the dataset enumerate - * values for the field, or specify a continuous range. - * @param {object} datum - The tuple to test for inclusion. - * @param {string} op - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @return {boolean} - True if the datum is in the selection, false otherwise. - */ function selectionTest(name, datum, op) { - var data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, n = entries.length, i = 0, entry, miss, count, unit, b; - for(; i < n; ++i){ - entry = entries[i]; - if (unitIdx && intersect) { - // multi selections union within the same unit and intersect across units. - miss = miss || {}; - count = miss[unit = entry.unit] || 0; - // if we've already matched this unit, skip. - if (count === -1) continue; - b = testPoint(datum, entry); - miss[unit] = b ? -1 : ++count; - // if we match and there are no other units return true - // if we've missed against all tuples in this unit return false - if (b && unitIdx.size === 1) return true; - if (!b && count === unitIdx.get(unit).count) return false; - } else { - b = testPoint(datum, entry); - // if we find a miss and we do require intersection return false - // if we find a match and we don't require intersection return true - if (intersect ^ b) return b; - } - } - // if intersecting and we made it here, then we saw no misses - // if not intersecting, then we saw no matches - // if no active selections, return false - return n && intersect; -} -const bisect = (0, _d3Array.bisector)($selectionId), bisectLeft = bisect.left, bisectRight = bisect.right; -function selectionIdTest(name, datum, op) { - const data = this.context.data[name], entries = data ? data.values.value : [], unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined, intersect = op === Intersect, value = $selectionId(datum), index = bisectLeft(entries, value); - if (index === entries.length) return false; - if ($selectionId(entries[index]) !== value) return false; - if (unitIdx && intersect) { - if (unitIdx.size === 1) return true; - if (bisectRight(entries, value) - index < unitIdx.size) return false; + view._el = null; + view._elBind = null; + view._renderType = options.renderer || RenderType.Canvas; + view._scenegraph = new Scenegraph(); + const root = view._scenegraph.root; + view._renderer = null; + view._tooltip = options.tooltip || defaultTooltip, view._redraw = true; + view._handler = new CanvasHandler().scene(root); + view._globalCursor = false; + view._preventDefault = false; + view._timers = []; + view._eventListeners = []; + view._resizeListeners = []; + view._eventConfig = initializeEventConfig(spec.eventConfig); + view.globalCursor(view._eventConfig.globalCursor); + const ctx = runtime(view, spec, options.expr); + view._runtime = ctx; + view._signals = ctx.signals; + view._bind = (spec.bindings || []).map((_) => ({ + state: null, + param: extend$1({}, _) + })); + if (ctx.root) ctx.root.set(root); + root.source = ctx.data.root.input; + view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); + view._width = view.width(); + view._height = view.height(); + view._viewWidth = viewWidth(view, view._width); + view._viewHeight = viewHeight(view, view._height); + view._origin = [0, 0]; + view._resize = 0; + view._autosize = 1; + initializeResize(view); + background(view); + cursor(view); + view.description(spec.description); + if (options.hover) view.hover(); + if (options.container) view.initialize(options.container, options.bind); + if (options.watchPixelRatio) view._watchPixelRatio(); + } + function lookupSignal(view, name) { + return has$1(view._signals, name) ? view._signals[name] : error("Unrecognized signal name: " + $(name)); + } + function findOperatorHandler(op, handler) { + const h2 = (op._targets || []).filter((op2) => op2._update && op2._update.handler === handler); + return h2.length ? h2[0] : null; + } + function addOperatorListener(view, name, op, handler) { + let h2 = findOperatorHandler(op, handler); + if (!h2) { + h2 = trap(view, () => handler(name, op.value)); + h2.handler = handler; + view.on(op, null, h2); } - return true; -} -/** - * Maps an array of scene graph items to an array of selection tuples. - * @param {string} name - The name of the dataset representing the selection. - * @param {string} base - The base object that generated tuples extend. - * - * @returns {array} An array of selection entries for the given unit. - */ function selectionTuples(array, base) { - return array.map((x)=>(0, _vegaUtil.extend)(base.fields ? { - values: base.fields.map((f)=>getter(f)(x.datum)) - } : { - [SelectionId]: $selectionId(x.datum) - }, base)); -} -/** - * Resolves selection for use as a scale domain or reads via the API. - * @param {string} name - The name of the dataset representing the selection - * @param {string} [op='union'] - The set operation for combining selections. - * One of 'intersect' or 'union' (default). - * @param {boolean} isMulti - Identifies a "multi" selection to perform more - * expensive resolution computation. - * @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point" - * selections, and thus the resolved tuple should reflect this name. - * This parameter allows us to reflect this change without triggering - * a major version bump for Vega. - * @returns {object} An object of selected fields and values. - */ function selectionResolve(name, op, isMulti, vl5) { - var data = this.context.data[name], entries = data ? data.values.value : [], resolved = {}, multiRes = {}, types = {}, entry, fields, values, unit, field, value, res, resUnit, type, union, n = entries.length, i = 0, j, m; - // First union all entries within the same unit. - for(; i < n; ++i){ - entry = entries[i]; - unit = entry.unit; - fields = entry.fields; - values = entry.values; - if (fields && values) { - // Intentional selection stores - for(j = 0, m = fields.length; j < m; ++j){ - field = fields[j]; - res = resolved[field.field] || (resolved[field.field] = {}); - resUnit = res[unit] || (res[unit] = []); - types[field.field] = type = field.type.charAt(0); - union = ops[`${type}_union`]; - res[unit] = union(resUnit, (0, _vegaUtil.array)(values[j])); - } - // If the same multi-selection is repeated over views and projected over - // an encoding, it may operate over different fields making it especially - // tricky to reliably resolve it. At best, we can de-dupe identical entries - // but doing so may be more computationally expensive than it is worth. - // Instead, for now, we simply transform our store representation into - // a more human-friendly one. - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push((0, _vegaUtil.array)(values).reduce((obj, curr, j)=>(obj[fields[j].field] = curr, obj), {})); - } - } else { - // Short circuit extensional selectionId stores which hold sorted IDs unique to each unit. - field = SelectionId; - value = $selectionId(entry); - res = resolved[field] || (resolved[field] = {}); - resUnit = res[unit] || (res[unit] = []); - resUnit.push(value); - if (isMulti) { - resUnit = multiRes[unit] || (multiRes[unit] = []); - resUnit.push({ - [SelectionId]: value - }); - } + return view; + } + function removeOperatorListener(view, op, handler) { + const h2 = findOperatorHandler(op, handler); + if (h2) op._targets.remove(h2); + return view; + } + inherits(View$1, Dataflow, { + // -- DATAFLOW / RENDERING ---- + async evaluate(encode2, prerun, postrun) { + await Dataflow.prototype.evaluate.call(this, encode2, prerun); + if (this._redraw || this._resize) { + try { + if (this._renderer) { + if (this._resize) { + this._resize = 0; + resizeRenderer(this); + } + await this._renderer.renderAsync(this._scenegraph.root); + } + this._redraw = false; + } catch (e) { + this.error(e); } - } - // Then resolve fields across units as per the op. - op = op || Union; - if (resolved[SelectionId]) resolved[SelectionId] = ops[`${SelectionId}_${op}`](...Object.values(resolved[SelectionId])); - else Object.keys(resolved).forEach((field)=>{ - resolved[field] = Object.keys(resolved[field]).map((unit)=>resolved[field][unit]).reduce((acc, curr)=>acc === undefined ? curr : ops[`${types[field]}_${op}`](acc, curr)); - }); - entries = Object.keys(multiRes); - if (isMulti && entries.length) { - const key = vl5 ? VlPoint : VlMulti; - resolved[key] = op === Union ? { - [Or]: entries.reduce((acc, k)=>(acc.push(...multiRes[k]), acc), []) - } : { - [And]: entries.map((k)=>({ - [Or]: multiRes[k] - })) - }; - } - return resolved; -} -var ops = { - [`${SelectionId}_union`]: (0, _d3Array.union), - [`${SelectionId}_intersect`]: (0, _d3Array.intersection), - E_union: function(base, value) { - if (!base.length) return value; - var i = 0, n = value.length; - for(; i < n; ++i)if (!base.includes(value[i])) base.push(value[i]); - return base; + } + if (postrun) asyncCallback(this, postrun); + return this; }, - E_intersect: function(base, value) { - return !base.length ? value : base.filter((v)=>value.includes(v)); + dirty(item) { + this._redraw = true; + this._renderer && this._renderer.dirty(item); }, - R_union: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (base[0] > lo) base[0] = lo; - if (base[1] < hi) base[1] = hi; - return base; + // -- GET / SET ---- + description(text2) { + if (arguments.length) { + const desc = text2 != null ? text2 + "" : null; + if (desc !== this._desc) ariaLabel(this._el, this._desc = desc); + return this; + } + return this._desc; }, - R_intersect: function(base, value) { - var lo = (0, _vegaUtil.toNumber)(value[0]), hi = (0, _vegaUtil.toNumber)(value[1]); - if (lo > hi) { - lo = value[1]; - hi = value[0]; - } - if (!base.length) return [ - lo, - hi - ]; - if (hi < base[0] || base[1] < lo) return []; - else { - if (base[0] < lo) base[0] = lo; - if (base[1] > hi) base[1] = hi; - } - return base; - } -}; -const DataPrefix = ':', IndexPrefix = '@'; -function selectionVisitor(name, args, scope, params) { - if (args[0].type !== (0, _vegaExpression.Literal)) (0, _vegaUtil.error)('First argument to selection functions must be a string literal.'); - const data = args[0].value, op = args.length >= 2 && (0, _vegaUtil.peek)(args).value, field = 'unit', indexName = IndexPrefix + field, dataName = DataPrefix + data; - // eslint-disable-next-line no-prototype-builtins - if (op === Intersect && !(0, _vegaUtil.hasOwnProperty)(params, indexName)) params[indexName] = scope.getData(data).indataRef(scope, field); - // eslint-disable-next-line no-prototype-builtins - if (!(0, _vegaUtil.hasOwnProperty)(params, dataName)) params[dataName] = scope.getData(data).tuplesRef(); -} - -},{"d3-array":"6IwJG","vega-util":"bApja","vega-expression":"2l1no","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k7ppL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "context", ()=>context); -var _vegaUtil = require("vega-util"); -var _vegaDataflow = require("vega-dataflow"); -/** - * Parse a serialized dataflow specification. - */ function parse(spec) { - const ctx = this, operators = spec.operators || []; - // parse background - if (spec.background) ctx.background = spec.background; - // parse event configuration - if (spec.eventConfig) ctx.eventConfig = spec.eventConfig; - // parse locale configuration - if (spec.locale) ctx.locale = spec.locale; - // parse operators - operators.forEach((entry)=>ctx.parseOperator(entry)); - // parse operator parameters - operators.forEach((entry)=>ctx.parseOperatorParameters(entry)); - // parse streams - (spec.streams || []).forEach((entry)=>ctx.parseStream(entry)); - // parse updates - (spec.updates || []).forEach((entry)=>ctx.parseUpdate(entry)); - return ctx.resolve(); -} -const Skip = (0, _vegaUtil.toSet)([ - 'rule' -]), Swap = (0, _vegaUtil.toSet)([ - 'group', - 'image', - 'rect' -]); -function adjustSpatial(encode, marktype) { - let code = ''; - if (Skip[marktype]) return code; - if (encode.x2) { - if (encode.x) { - if (Swap[marktype]) code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;'; - code += 'o.width=o.x2-o.x;'; - } else code += 'o.x=o.x2-(o.width||0);'; - } - if (encode.xc) code += 'o.x=o.xc-(o.width||0)/2;'; - if (encode.y2) { - if (encode.y) { - if (Swap[marktype]) code += 'if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;'; - code += 'o.height=o.y2-o.y;'; - } else code += 'o.y=o.y2-(o.height||0);'; - } - if (encode.yc) code += 'o.y=o.yc-(o.height||0)/2;'; - return code; -} -function canonicalType(type) { - return (type + '').toLowerCase(); -} -function isOperator(type) { - return canonicalType(type) === 'operator'; -} -function isCollect(type) { - return canonicalType(type) === 'collect'; -} -function expression(ctx, args, code) { - // wrap code in return statement if expression does not terminate - if (!code.endsWith(';')) code = 'return(' + code + ');'; - const fn = Function(...args.concat(code)); - return ctx && ctx.functions ? fn.bind(ctx.functions) : fn; -} -// generate code for comparing a single field -function _compare(u, v, lt, gt) { - return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt} - : (u > v || v == null) && u != null ? ${gt} - : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt} - : v !== v && u === u ? ${gt} : `; -} -var expressionCodegen = { - /** - * Parse an expression used to update an operator value. - */ operator: (ctx, expr)=>expression(ctx, [ - '_' - ], expr.code), - /** - * Parse an expression provided as an operator parameter value. - */ parameter: (ctx, expr)=>expression(ctx, [ - 'datum', - '_' - ], expr.code), - /** - * Parse an expression applied to an event stream. - */ event: (ctx, expr)=>expression(ctx, [ - 'event' - ], expr.code), - /** - * Parse an expression used to handle an event-driven operator update. - */ handler: (ctx, expr)=>{ - const code = `var datum=event.item&&event.item.datum;return ${expr.code};`; - return expression(ctx, [ - '_', - 'event' - ], code); + container() { + return this._el; }, - /** - * Parse an expression that performs visual encoding. - */ encode: (ctx, encode)=>{ - const { marktype, channels } = encode; - let code = 'var o=item,datum=o.datum,m=0,$;'; - for(const name in channels){ - const o = 'o[' + (0, _vegaUtil.stringValue)(name) + ']'; - code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`; - } - code += adjustSpatial(channels, marktype); - code += 'return m;'; - return expression(ctx, [ - 'item', - '_' - ], code); + scenegraph() { + return this._scenegraph; }, - /** - * Optimized code generators for access and comparison. - */ codegen: { - get (path) { - const ref = `[${path.map((0, _vegaUtil.stringValue)).join('][')}]`; - const get = Function('_', `return _${ref};`); - get.path = ref; - return get; - }, - comparator (fields, orders) { - let t; - const map = (f, i)=>{ - const o = orders[i]; - let u, v; - if (f.path) { - u = `a${f.path}`; - v = `b${f.path}`; - } else { - (t = t || {})['f' + i] = f; - u = `this.f${i}(a)`; - v = `this.f${i}(b)`; - } - return _compare(u, v, -o, o); - }; - const fn = Function('a', 'b', 'var u, v; return ' + fields.map(map).join('') + '0;'); - return t ? fn.bind(t) : fn; + origin() { + return this._origin.slice(); + }, + signal(name, value2, options) { + const op = lookupSignal(this, name); + return arguments.length === 1 ? op.value : this.update(op, value2, options); + }, + width(_) { + return arguments.length ? this.signal("width", _) : this.signal("width"); + }, + height(_) { + return arguments.length ? this.signal("height", _) : this.signal("height"); + }, + padding(_) { + return arguments.length ? this.signal("padding", padding(_)) : padding(this.signal("padding")); + }, + autosize(_) { + return arguments.length ? this.signal("autosize", _) : this.signal("autosize"); + }, + background(_) { + return arguments.length ? this.signal("background", _) : this.signal("background"); + }, + renderer(type2) { + if (!arguments.length) return this._renderType; + if (!renderModule(type2)) error("Unrecognized renderer type: " + type2); + if (type2 !== this._renderType) { + this._renderType = type2; + this._resetRenderer(); + } + return this; + }, + tooltip(handler) { + if (!arguments.length) return this._tooltip; + if (handler !== this._tooltip) { + this._tooltip = handler; + this._resetRenderer(); + } + return this; + }, + loader(loader2) { + if (!arguments.length) return this._loader; + if (loader2 !== this._loader) { + Dataflow.prototype.loader.call(this, loader2); + this._resetRenderer(); + } + return this; + }, + resize() { + this._autosize = 1; + return this.touch(lookupSignal(this, "autosize")); + }, + _resetRenderer() { + if (this._renderer) { + this._renderer = null; + this.initialize(this._el, this._elBind); + } + }, + // -- SIZING ---- + _resizeView: resizeView, + // -- EVENT HANDLING ---- + addEventListener(type2, handler, options) { + let callback = handler; + if (!(options && options.trap === false)) { + callback = trap(this, handler); + callback.raw = handler; + } + this._handler.on(type2, callback); + return this; + }, + removeEventListener(type2, handler) { + var handlers = this._handler.handlers(type2), i = handlers.length, h2, t; + while (--i >= 0) { + t = handlers[i].type; + h2 = handlers[i].handler; + if (type2 === t && (handler === h2 || handler === h2.raw)) { + this._handler.off(t, h2); + break; } - } -}; -/** - * Parse a dataflow operator. - */ function parseOperator(spec) { - const ctx = this; - if (isOperator(spec.type) || !spec.type) ctx.operator(spec, spec.update ? ctx.operatorExpression(spec.update) : null); - else ctx.transform(spec, spec.type); -} -/** - * Parse and assign operator parameters. - */ function parseOperatorParameters(spec) { - const ctx = this; - if (spec.params) { - const op = ctx.get(spec.id); - if (!op) (0, _vegaUtil.error)('Invalid operator id: ' + spec.id); - ctx.dataflow.connect(op, op.parameters(ctx.parseParameters(spec.params), spec.react, spec.initonly)); - } -} -/** - * Parse a set of operator parameters. - */ function parseParameters(spec, params) { - params = params || {}; - const ctx = this; - for(const key in spec){ - const value = spec[key]; - params[key] = (0, _vegaUtil.isArray)(value) ? value.map((v)=>parseParameter(v, ctx, params)) : parseParameter(value, ctx, params); - } - return params; -} -/** - * Parse a single parameter. - */ function parseParameter(spec, ctx, params) { - if (!spec || !(0, _vegaUtil.isObject)(spec)) return spec; - for(let i = 0, n = PARSERS.length, p; i < n; ++i){ - p = PARSERS[i]; - if ((0, _vegaUtil.hasOwnProperty)(spec, p.key)) return p.parse(spec, ctx, params); - } - return spec; -} -/** Reference parsers. */ var PARSERS = [ - { - key: '$ref', - parse: getOperator + } + return this; }, - { - key: '$key', - parse: getKey + addResizeListener(handler) { + const l = this._resizeListeners; + if (!l.includes(handler)) { + l.push(handler); + } + return this; }, - { - key: '$expr', - parse: getExpression + removeResizeListener(handler) { + var l = this._resizeListeners, i = l.indexOf(handler); + if (i >= 0) { + l.splice(i, 1); + } + return this; }, - { - key: '$field', - parse: getField + addSignalListener(name, handler) { + return addOperatorListener(this, name, lookupSignal(this, name), handler); }, - { - key: '$encode', - parse: getEncode + removeSignalListener(name, handler) { + return removeOperatorListener(this, lookupSignal(this, name), handler); }, - { - key: '$compare', - parse: getCompare + addDataListener(name, handler) { + return addOperatorListener(this, name, dataref(this, name).values, handler); }, - { - key: '$context', - parse: getContext + removeDataListener(name, handler) { + return removeOperatorListener(this, dataref(this, name).values, handler); }, - { - key: '$subflow', - parse: getSubflow + globalCursor(_) { + if (arguments.length) { + if (this._globalCursor !== !!_) { + const prev = setCursor(this, null); + this._globalCursor = !!_; + if (prev) setCursor(this, prev); + } + return this; + } else { + return this._globalCursor; + } }, - { - key: '$tupleid', - parse: getTupleId - } -]; -/** - * Resolve an operator reference. - */ function getOperator(_, ctx) { - return ctx.get(_.$ref) || (0, _vegaUtil.error)('Operator not defined: ' + _.$ref); -} -/** - * Resolve an expression reference. - */ function getExpression(_, ctx, params) { - if (_.$params) // parse expression parameters - ctx.parseParameters(_.$params, params); - const k = 'e:' + _.$expr.code; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.accessor)(ctx.parameterExpression(_.$expr), _.$fields)); -} -/** - * Resolve a key accessor reference. - */ function getKey(_, ctx) { - const k = 'k:' + _.$key + '_' + !!_.$flat; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.key)(_.$key, _.$flat, ctx.expr.codegen)); -} -/** - * Resolve a field accessor reference. - */ function getField(_, ctx) { - if (!_.$field) return null; - const k = 'f:' + _.$field + '_' + _.$name; - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.field)(_.$field, _.$name, ctx.expr.codegen)); -} -/** - * Resolve a comparator function reference. - */ function getCompare(_, ctx) { - // As of Vega 5.5.3, $tupleid sort is no longer used. - // Keep here for now for backwards compatibility. - const k = 'c:' + _.$compare + '_' + _.$order, c = (0, _vegaUtil.array)(_.$compare).map((_)=>_ && _.$tupleid ? (0, _vegaDataflow.tupleid) : _); - return ctx.fn[k] || (ctx.fn[k] = (0, _vegaUtil.compare)(c, _.$order, ctx.expr.codegen)); -} -/** - * Resolve an encode operator reference. - */ function getEncode(_, ctx) { - const spec = _.$encode, encode = {}; - for(const name in spec){ - const enc = spec[name]; - encode[name] = (0, _vegaUtil.accessor)(ctx.encodeExpression(enc.$expr), enc.$fields); - encode[name].output = enc.$output; - } - return encode; -} -/** - * Resolve a context reference. - */ function getContext(_, ctx) { - return ctx; -} -/** - * Resolve a recursive subflow specification. - */ function getSubflow(_, ctx) { - const spec = _.$subflow; - return function(dataflow, key, parent) { - const subctx = ctx.fork().parse(spec), op = subctx.get(spec.operators[0].id), p = subctx.signals.parent; - if (p) p.set(parent); - op.detachSubflow = ()=>ctx.detach(subctx); - return op; - }; -} -/** - * Resolve a tuple id reference. - */ function getTupleId() { - return 0, _vegaDataflow.tupleid; -} -/** - * Parse an event stream specification. - */ function parseStream(spec) { - var ctx = this, filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined, stream = spec.stream != null ? ctx.get(spec.stream) : undefined, args; - if (spec.source) stream = ctx.events(spec.source, spec.type, filter); - else if (spec.merge) { - args = spec.merge.map((_)=>ctx.get(_)); - stream = args[0].merge.apply(args[0], args.slice(1)); + preventDefault(_) { + if (arguments.length) { + this._preventDefault = _; + return this; + } else { + return this._preventDefault; + } + }, + timer, + events, + finalize, + hover, + // -- DATA ---- + data, + change, + insert, + remove, + // -- SCALES -- + scale: scale$3, + // -- INITIALIZATION ---- + initialize, + // -- HEADLESS RENDERING ---- + toImageURL: renderToImageURL, + toCanvas: renderToCanvas, + toSVG: renderToSVG, + // -- SAVE / RESTORE STATE ---- + getState, + setState, + // RE-RENDER ON ZOOM + _watchPixelRatio: watchPixelRatio + }); + const VIEW = "view", LBRACK = "[", RBRACK = "]", LBRACE = "{", RBRACE = "}", COLON = ":", COMMA = ",", NAME = "@", GT = ">", ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { + "*": 1, + arc: 1, + area: 1, + group: 1, + image: 1, + line: 1, + path: 1, + rect: 1, + rule: 1, + shape: 1, + symbol: 1, + text: 1, + trail: 1 + }; + let DEFAULT_SOURCE, MARKS; + function eventSelector(selector, source2, marks) { + DEFAULT_SOURCE = source2 || VIEW; + MARKS = marks || DEFAULT_MARKS; + return parseMerge(selector.trim()).map(parseSelector); + } + function isMarkType(type2) { + return MARKS[type2]; + } + function find(s, i, endChar, pushChar, popChar) { + const n = s.length; + let count2 = 0, c2; + for (; i < n; ++i) { + c2 = s[i]; + if (!count2 && c2 === endChar) return i; + else if (popChar && popChar.includes(c2)) --count2; + else if (pushChar && pushChar.includes(c2)) ++count2; + } + return i; + } + function parseMerge(s) { + const output2 = [], n = s.length; + let start = 0, i = 0; + while (i < n) { + i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); + output2.push(s.substring(start, i).trim()); + start = ++i; + } + if (output2.length === 0) { + throw "Empty event selector: " + s; + } + return output2; + } + function parseSelector(s) { + return s[0] === "[" ? parseBetween(s) : parseStream$1(s); + } + function parseBetween(s) { + const n = s.length; + let i = 1, b2; + i = find(s, i, RBRACK, LBRACK, RBRACK); + if (i === n) { + throw "Empty between selector: " + s; + } + b2 = parseMerge(s.substring(1, i)); + if (b2.length !== 2) { + throw "Between selector must have two elements: " + s; + } + s = s.slice(i + 1).trim(); + if (s[0] !== GT) { + throw "Expected '>' after between selector: " + s; + } + b2 = b2.map(parseSelector); + const stream2 = parseSelector(s.slice(1).trim()); + if (stream2.between) { + return { + between: b2, + stream: stream2 + }; + } else { + stream2.between = b2; + } + return stream2; + } + function parseStream$1(s) { + const stream2 = { + source: DEFAULT_SOURCE + }, source2 = []; + let throttle = [0, 0], markname = 0, start = 0, n = s.length, i = 0, j, filter2; + if (s[n - 1] === RBRACE) { + i = s.lastIndexOf(LBRACE); + if (i >= 0) { + try { + throttle = parseThrottle(s.substring(i + 1, n - 1)); + } catch (e) { + throw "Invalid throttle specification: " + s; + } + s = s.slice(0, i).trim(); + n = s.length; + } else throw "Unmatched right brace: " + s; + i = 0; + } + if (!n) throw s; + if (s[0] === NAME) markname = ++i; + j = find(s, i, COLON); + if (j < n) { + source2.push(s.substring(start, j).trim()); + start = i = ++j; + } + i = find(s, i, LBRACK); + if (i === n) { + source2.push(s.substring(start, n).trim()); + } else { + source2.push(s.substring(start, i).trim()); + filter2 = []; + start = ++i; + if (start === n) throw "Unmatched left bracket: " + s; + } + while (i < n) { + i = find(s, i, RBRACK); + if (i === n) throw "Unmatched left bracket: " + s; + filter2.push(s.substring(start, i).trim()); + if (i < n - 1 && s[++i] !== LBRACK) throw "Expected left bracket: " + s; + start = ++i; + } + if (!(n = source2.length) || ILLEGAL.test(source2[n - 1])) { + throw "Invalid event selector: " + s; + } + if (n > 1) { + stream2.type = source2[1]; + if (markname) { + stream2.markname = source2[0].slice(1); + } else if (isMarkType(source2[0])) { + stream2.marktype = source2[0]; + } else { + stream2.source = source2[0]; + } + } else { + stream2.type = source2[0]; + } + if (stream2.type.slice(-1) === "!") { + stream2.consume = true; + stream2.type = stream2.type.slice(0, -1); + } + if (filter2 != null) stream2.filter = filter2; + if (throttle[0]) stream2.throttle = throttle[0]; + if (throttle[1]) stream2.debounce = throttle[1]; + return stream2; + } + function parseThrottle(s) { + const a2 = s.split(COMMA); + if (!s.length || a2.length > 2) throw s; + return a2.map((_) => { + const x2 = +_; + if (x2 !== x2) throw s; + return x2; + }); + } + function parseAutosize(spec) { + return isObject$1(spec) ? spec : { + type: spec || "pad" + }; + } + const number = (_) => +_ || 0; + const paddingObject = (_) => ({ + top: _, + bottom: _, + left: _, + right: _ + }); + function parsePadding(spec) { + return !isObject$1(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { + top: number(spec.top), + bottom: number(spec.bottom), + left: number(spec.left), + right: number(spec.right) + }; + } + const encoder = (_) => isObject$1(_) && !isArray(_) ? extend$1({}, _) : { + value: _ + }; + function addEncode(object2, name, value2, set2) { + if (value2 != null) { + const isEncoder = isObject$1(value2) && !isArray(value2) || isArray(value2) && value2.length && isObject$1(value2[0]); + if (isEncoder) { + object2.update[name] = value2; + } else { + object2[set2 || "enter"][name] = { + value: value2 + }; + } + return 1; + } else { + return 0; } - if (spec.between) { - args = spec.between.map((_)=>ctx.get(_)); - stream = stream.between(args[0], args[1]); - } - if (spec.filter) stream = stream.filter(filter); - if (spec.throttle != null) stream = stream.throttle(+spec.throttle); - if (spec.debounce != null) stream = stream.debounce(+spec.debounce); - if (stream == null) (0, _vegaUtil.error)('Invalid stream definition: ' + JSON.stringify(spec)); - if (spec.consume) stream.consume(true); - ctx.stream(spec, stream); -} -/** - * Parse an event-driven operator update. - */ function parseUpdate(spec) { - var ctx = this, srcid = (0, _vegaUtil.isObject)(srcid = spec.source) ? srcid.$ref : srcid, source = ctx.get(srcid), target = null, update = spec.update, params = undefined; - if (!source) (0, _vegaUtil.error)('Source not defined: ' + spec.source); - target = spec.target && spec.target.$expr ? ctx.eventExpression(spec.target.$expr) : ctx.get(spec.target); - if (update && update.$expr) { - if (update.$params) params = ctx.parseParameters(update.$params); - update = ctx.handlerExpression(update.$expr); - } - ctx.update(spec, source, target, update, params); -} -const SKIP = { - skip: true -}; -function getState(options) { - var ctx = this, state = {}; - if (options.signals) { - var signals = state.signals = {}; - Object.keys(ctx.signals).forEach((key)=>{ - const op = ctx.signals[key]; - if (options.signals(key, op)) signals[key] = op.value; - }); + } + function addEncoders(object2, enter, update2) { + for (const name in enter) { + addEncode(object2, name, enter[name]); } - if (options.data) { - var data = state.data = {}; - Object.keys(ctx.data).forEach((key)=>{ - const dataset = ctx.data[key]; - if (options.data(key, dataset)) data[key] = dataset.input.value; - }); + for (const name in update2) { + addEncode(object2, name, update2[name], "update"); } - if (ctx.subcontext && options.recurse !== false) state.subcontext = ctx.subcontext.map((ctx)=>ctx.getState(options)); - return state; -} -function setState(state) { - var ctx = this, df = ctx.dataflow, data = state.data, signals = state.signals; - Object.keys(signals || {}).forEach((key)=>{ - df.update(ctx.signals[key], signals[key], SKIP); - }); - Object.keys(data || {}).forEach((key)=>{ - df.pulse(ctx.data[key].input, df.changeset().remove((0, _vegaUtil.truthy)).insert(data[key])); - }); - (state.subcontext || []).forEach((substate, i)=>{ - const subctx = ctx.subcontext[i]; - if (subctx) subctx.setState(substate); - }); -} -/** - * Context objects store the current parse state. - * Enables lookup of parsed operators, event streams, accessors, etc. - * Provides a 'fork' method for creating child contexts for subflows. - */ function context(df, transforms, functions, expr) { - return new Context(df, transforms, functions, expr); -} -function Context(df, transforms, functions, expr) { - this.dataflow = df; - this.transforms = transforms; - this.events = df.events.bind(df); - this.expr = expr || expressionCodegen, this.signals = {}; - this.scales = {}; - this.nodes = {}; - this.data = {}; - this.fn = {}; - if (functions) { - this.functions = Object.create(functions); - this.functions.context = this; + } + function extendEncode(encode2, extra, skip) { + for (const name in extra) { + if (skip && has$1(skip, name)) continue; + encode2[name] = extend$1(encode2[name] || {}, extra[name]); } -} -function Subcontext(ctx) { - this.dataflow = ctx.dataflow; - this.transforms = ctx.transforms; - this.events = ctx.events; - this.expr = ctx.expr; - this.signals = Object.create(ctx.signals); - this.scales = Object.create(ctx.scales); - this.nodes = Object.create(ctx.nodes); - this.data = Object.create(ctx.data); - this.fn = Object.create(ctx.fn); - if (ctx.functions) { - this.functions = Object.create(ctx.functions); - this.functions.context = this; - } -} -Context.prototype = Subcontext.prototype = { - fork () { - const ctx = new Subcontext(this); - (this.subcontext || (this.subcontext = [])).push(ctx); - return ctx; - }, - detach (ctx) { - this.subcontext = this.subcontext.filter((c)=>c !== ctx); - // disconnect all nodes in the subcontext - // wipe out targets first for better efficiency - const keys = Object.keys(ctx.nodes); - for (const key of keys)ctx.nodes[key]._targets = null; - for (const key of keys)ctx.nodes[key].detach(); - ctx.nodes = null; - }, - get (id) { - return this.nodes[id]; - }, - set (id, node) { - return this.nodes[id] = node; - }, - add (spec, op) { - const ctx = this, df = ctx.dataflow, data = spec.value; - ctx.set(spec.id, op); - if (isCollect(spec.type) && data) { - if (data.$ingest) df.ingest(op, data.$ingest, data.$format); - else if (data.$request) df.preload(op, data.$request, data.$format); - else df.pulse(op, df.changeset().insert(data)); - } - if (spec.root) ctx.root = op; - if (spec.parent) { - let p = ctx.get(spec.parent.$ref); - if (p) { - df.connect(p, [ - op - ]); - op.targets().add(p); - } else (ctx.unresolved = ctx.unresolved || []).push(()=>{ - p = ctx.get(spec.parent.$ref); - df.connect(p, [ - op - ]); - op.targets().add(p); - }); - } - if (spec.signal) ctx.signals[spec.signal] = op; - if (spec.scale) ctx.scales[spec.scale] = op; - if (spec.data) for(const name in spec.data){ - const data = ctx.data[name] || (ctx.data[name] = {}); - spec.data[name].forEach((role)=>data[role] = op); + return encode2; + } + function has(key2, encode2) { + return encode2 && (encode2.enter && encode2.enter[key2] || encode2.update && encode2.update[key2]); + } + const MarkRole = "mark"; + const FrameRole = "frame"; + const ScopeRole = "scope"; + const AxisRole = "axis"; + const AxisDomainRole = "axis-domain"; + const AxisGridRole = "axis-grid"; + const AxisLabelRole = "axis-label"; + const AxisTickRole = "axis-tick"; + const AxisTitleRole = "axis-title"; + const LegendRole = "legend"; + const LegendBandRole = "legend-band"; + const LegendEntryRole = "legend-entry"; + const LegendGradientRole = "legend-gradient"; + const LegendLabelRole = "legend-label"; + const LegendSymbolRole = "legend-symbol"; + const LegendTitleRole = "legend-title"; + const TitleRole = "title"; + const TitleTextRole = "title-text"; + const TitleSubtitleRole = "title-subtitle"; + function applyDefaults(encode2, type2, role, style2, config) { + const defaults2 = {}, enter = {}; + let update2, key2, skip, props; + key2 = "lineBreak"; + if (type2 === "text" && config[key2] != null && !has(key2, encode2)) { + applyDefault(defaults2, key2, config[key2]); + } + if (role == "legend" || String(role).startsWith("axis")) { + role = null; + } + props = role === FrameRole ? config.group : role === MarkRole ? extend$1({}, config.mark, config[type2]) : null; + for (key2 in props) { + skip = has(key2, encode2) || (key2 === "fill" || key2 === "stroke") && (has("fill", encode2) || has("stroke", encode2)); + if (!skip) applyDefault(defaults2, key2, props[key2]); + } + array$5(style2).forEach((name) => { + const props2 = config.style && config.style[name]; + for (const key3 in props2) { + if (!has(key3, encode2)) { + applyDefault(defaults2, key3, props2[key3]); } - }, - resolve () { - (this.unresolved || []).forEach((fn)=>fn()); - delete this.unresolved; - return this; - }, - operator (spec, update) { - this.add(spec, this.dataflow.add(spec.value, update)); - }, - transform (spec, type) { - this.add(spec, this.dataflow.add(this.transforms[canonicalType(type)])); - }, - stream (spec, stream) { - this.set(spec.id, stream); - }, - update (spec, stream, target, update, params) { - this.dataflow.on(stream, target, update, params, spec.options); - }, - // expression parsing - operatorExpression (expr) { - return this.expr.operator(this, expr); - }, - parameterExpression (expr) { - return this.expr.parameter(this, expr); - }, - eventExpression (expr) { - return this.expr.event(this, expr); - }, - handlerExpression (expr) { - return this.expr.handler(this, expr); - }, - encodeExpression (encode) { - return this.expr.encode(this, encode); - }, - // parse methods - parse, - parseOperator, - parseOperatorParameters, - parseParameters, - parseStream, - parseUpdate, - // state methods - getState, - setState -}; - -},{"vega-util":"bApja","vega-dataflow":"3NitK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hsy9Z":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisDomainRole", ()=>AxisDomainRole); -parcelHelpers.export(exports, "AxisGridRole", ()=>AxisGridRole); -parcelHelpers.export(exports, "AxisLabelRole", ()=>AxisLabelRole); -parcelHelpers.export(exports, "AxisRole", ()=>AxisRole); -parcelHelpers.export(exports, "AxisTickRole", ()=>AxisTickRole); -parcelHelpers.export(exports, "AxisTitleRole", ()=>AxisTitleRole); -parcelHelpers.export(exports, "DataScope", ()=>DataScope); -parcelHelpers.export(exports, "FrameRole", ()=>FrameRole); -parcelHelpers.export(exports, "LegendEntryRole", ()=>LegendEntryRole); -parcelHelpers.export(exports, "LegendLabelRole", ()=>LegendLabelRole); -parcelHelpers.export(exports, "LegendRole", ()=>LegendRole); -parcelHelpers.export(exports, "LegendSymbolRole", ()=>LegendSymbolRole); -parcelHelpers.export(exports, "LegendTitleRole", ()=>LegendTitleRole); -parcelHelpers.export(exports, "MarkRole", ()=>MarkRole); -parcelHelpers.export(exports, "Scope", ()=>Scope); -parcelHelpers.export(exports, "ScopeRole", ()=>ScopeRole); -parcelHelpers.export(exports, "config", ()=>defaults); -parcelHelpers.export(exports, "parse", ()=>parse); -parcelHelpers.export(exports, "signal", ()=>parseSignal); -parcelHelpers.export(exports, "signalUpdates", ()=>parseSignalUpdates); -parcelHelpers.export(exports, "stream", ()=>parseStream); -var _vegaUtil = require("vega-util"); -var _vegaFunctions = require("vega-functions"); -var _vegaEventSelector = require("vega-event-selector"); -var _vegaScale = require("vega-scale"); -var _vegaDataflow = require("vega-dataflow"); -function parseAutosize(spec) { - return (0, _vegaUtil.isObject)(spec) ? spec : { - type: spec || 'pad' - }; -} -const number = (_)=>+_ || 0; -const paddingObject = (_)=>({ - top: _, - bottom: _, - left: _, - right: _ - }); -function parsePadding(spec) { - return !(0, _vegaUtil.isObject)(spec) ? paddingObject(number(spec)) : spec.signal ? spec : { - top: number(spec.top), - bottom: number(spec.bottom), - left: number(spec.left), - right: number(spec.right) - }; -} -const encoder = (_)=>(0, _vegaUtil.isObject)(_) && !(0, _vegaUtil.isArray)(_) ? (0, _vegaUtil.extend)({}, _) : { - value: _ - }; -function addEncode(object, name, value, set) { - if (value != null) { - const isEncoder = (0, _vegaUtil.isObject)(value) && !(0, _vegaUtil.isArray)(value) || (0, _vegaUtil.isArray)(value) && value.length && (0, _vegaUtil.isObject)(value[0]); - // Always assign signal to update, even if the signal is from the enter block - if (isEncoder) object.update[name] = value; - else object[set || 'enter'][name] = { - value: value - }; - return 1; - } else return 0; -} -function addEncoders(object, enter, update) { - for(const name in enter)addEncode(object, name, enter[name]); - for(const name in update)addEncode(object, name, update[name], 'update'); -} -function extendEncode(encode, extra, skip) { - for(const name in extra){ - if (skip && (0, _vegaUtil.hasOwnProperty)(skip, name)) continue; - encode[name] = (0, _vegaUtil.extend)(encode[name] || {}, extra[name]); - } - return encode; -} -function has(key, encode) { - return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]); -} -const MarkRole = 'mark'; -const FrameRole = 'frame'; -const ScopeRole = 'scope'; -const AxisRole = 'axis'; -const AxisDomainRole = 'axis-domain'; -const AxisGridRole = 'axis-grid'; -const AxisLabelRole = 'axis-label'; -const AxisTickRole = 'axis-tick'; -const AxisTitleRole = 'axis-title'; -const LegendRole = 'legend'; -const LegendBandRole = 'legend-band'; -const LegendEntryRole = 'legend-entry'; -const LegendGradientRole = 'legend-gradient'; -const LegendLabelRole = 'legend-label'; -const LegendSymbolRole = 'legend-symbol'; -const LegendTitleRole = 'legend-title'; -const TitleRole = 'title'; -const TitleTextRole = 'title-text'; -const TitleSubtitleRole = 'title-subtitle'; -function applyDefaults(encode, type, role, style, config) { - const defaults = {}, enter = {}; - let update, key, skip, props; - // if text mark, apply global lineBreak settings (#2370) - key = 'lineBreak'; - if (type === 'text' && config[key] != null && !has(key, encode)) applyDefault(defaults, key, config[key]); - // ignore legend and axis roles - if (role == 'legend' || String(role).startsWith('axis')) role = null; - // resolve mark config - props = role === FrameRole ? config.group : role === MarkRole ? (0, _vegaUtil.extend)({}, config.mark, config[type]) : null; - for(key in props){ - // do not apply defaults if relevant fields are defined - skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode)); - if (!skip) applyDefault(defaults, key, props[key]); - } - // resolve styles, apply with increasing precedence - (0, _vegaUtil.array)(style).forEach((name)=>{ - const props = config.style && config.style[name]; - for(const key in props)if (!has(key, encode)) applyDefault(defaults, key, props[key]); + } }); - encode = (0, _vegaUtil.extend)({}, encode); // defensive copy - for(key in defaults){ - props = defaults[key]; - if (props.signal) (update = update || {})[key] = props; - else enter[key] = props; - } - encode.enter = (0, _vegaUtil.extend)(enter, encode.enter); - if (update) encode.update = (0, _vegaUtil.extend)(update, encode.update); - return encode; -} -function applyDefault(defaults, key, value) { - defaults[key] = value && value.signal ? { - signal: value.signal + encode2 = extend$1({}, encode2); + for (key2 in defaults2) { + props = defaults2[key2]; + if (props.signal) { + (update2 = update2 || {})[key2] = props; + } else { + enter[key2] = props; + } + } + encode2.enter = extend$1(enter, encode2.enter); + if (update2) encode2.update = extend$1(update2, encode2.update); + return encode2; + } + function applyDefault(defaults2, key2, value2) { + defaults2[key2] = value2 && value2.signal ? { + signal: value2.signal } : { - value: value - }; -} -const scaleRef = (scale)=>(0, _vegaUtil.isString)(scale) ? (0, _vegaUtil.stringValue)(scale) : scale.signal ? `(${scale.signal})` : field(scale); -function entry$1(enc) { - if (enc.gradient != null) return gradient(enc); - let value = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? (0, _vegaUtil.stringValue)(enc.value) : undefined; - if (enc.scale != null) value = scale(enc, value); - if (value === undefined) value = null; - if (enc.exponent != null) value = `pow(${value},${property(enc.exponent)})`; - if (enc.mult != null) value += `*${property(enc.mult)}`; - if (enc.offset != null) value += `+${property(enc.offset)}`; - if (enc.round) value = `round(${value})`; - return value; -} -const _color = (type, x, y, z)=>`(${type}(${[ - x, - y, - z - ].map(entry$1).join(',')})+'')`; -function color(enc) { - return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null; -} -function gradient(enc) { - // map undefined to null; expression lang does not allow undefined - const args = [ - enc.start, - enc.stop, - enc.count - ].map((_)=>_ == null ? null : (0, _vegaUtil.stringValue)(_)); - // trim null inputs from the end - while(args.length && (0, _vegaUtil.peek)(args) == null)args.pop(); + value: value2 + }; + } + const scaleRef = (scale2) => isString(scale2) ? $(scale2) : scale2.signal ? `(${scale2.signal})` : field(scale2); + function entry$1(enc) { + if (enc.gradient != null) { + return gradient(enc); + } + let value2 = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== void 0 ? $(enc.value) : void 0; + if (enc.scale != null) { + value2 = scale$2(enc, value2); + } + if (value2 === void 0) { + value2 = null; + } + if (enc.exponent != null) { + value2 = `pow(${value2},${property(enc.exponent)})`; + } + if (enc.mult != null) { + value2 += `*${property(enc.mult)}`; + } + if (enc.offset != null) { + value2 += `+${property(enc.offset)}`; + } + if (enc.round) { + value2 = `round(${value2})`; + } + return value2; + } + const _color = (type2, x2, y2, z) => `(${type2}(${[x2, y2, z].map(entry$1).join(",")})+'')`; + function color(enc) { + return enc.c ? _color("hcl", enc.h, enc.c, enc.l) : enc.h || enc.s ? _color("hsl", enc.h, enc.s, enc.l) : enc.l || enc.a ? _color("lab", enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color("rgb", enc.r, enc.g, enc.b) : null; + } + function gradient(enc) { + const args = [enc.start, enc.stop, enc.count].map((_) => _ == null ? null : $(_)); + while (args.length && peek$1(args) == null) args.pop(); args.unshift(scaleRef(enc.gradient)); - return `gradient(${args.join(',')})`; -} -function property(property) { - return (0, _vegaUtil.isObject)(property) ? '(' + entry$1(property) + ')' : property; -} -function field(ref) { - return resolveField((0, _vegaUtil.isObject)(ref) ? ref : { - datum: ref + return `gradient(${args.join(",")})`; + } + function property(property2) { + return isObject$1(property2) ? "(" + entry$1(property2) + ")" : property2; + } + function field(ref2) { + return resolveField(isObject$1(ref2) ? ref2 : { + datum: ref2 }); -} -function resolveField(ref) { - let object, level, field; - if (ref.signal) { - object = 'datum'; - field = ref.signal; - } else if (ref.group || ref.parent) { - level = Math.max(1, ref.level || 1); - object = 'item'; - while(level-- > 0)object += '.mark.group'; - if (ref.parent) { - field = ref.parent; - object += '.datum'; - } else field = ref.group; - } else if (ref.datum) { - object = 'datum'; - field = ref.datum; - } else (0, _vegaUtil.error)('Invalid field reference: ' + (0, _vegaUtil.stringValue)(ref)); - if (!ref.signal) field = (0, _vegaUtil.isString)(field) ? (0, _vegaUtil.splitAccessPath)(field).map((0, _vegaUtil.stringValue)).join('][') : resolveField(field); - return object + '[' + field + ']'; -} -function scale(enc, value) { - const scale = scaleRef(enc.scale); - if (enc.range != null) // pull value from scale range - value = `lerp(_range(${scale}), ${+enc.range})`; - else { - // run value through scale and/or pull scale bandwidth - if (value !== undefined) value = `_scale(${scale}, ${value})`; - if (enc.band) { - value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + property(enc.band)); - if (enc.extra) // include logic to handle extraneous elements - value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`; - } - if (value == null) value = '0'; - } - return value; -} -function rule(enc) { - let code = ''; - enc.forEach((rule)=>{ - const value = entry$1(rule); - code += rule.test ? `(${rule.test})?${value}:` : value; + } + function resolveField(ref2) { + let object2, level, field2; + if (ref2.signal) { + object2 = "datum"; + field2 = ref2.signal; + } else if (ref2.group || ref2.parent) { + level = Math.max(1, ref2.level || 1); + object2 = "item"; + while (level-- > 0) { + object2 += ".mark.group"; + } + if (ref2.parent) { + field2 = ref2.parent; + object2 += ".datum"; + } else { + field2 = ref2.group; + } + } else if (ref2.datum) { + object2 = "datum"; + field2 = ref2.datum; + } else { + error("Invalid field reference: " + $(ref2)); + } + if (!ref2.signal) { + field2 = isString(field2) ? splitAccessPath(field2).map($).join("][") : resolveField(field2); + } + return object2 + "[" + field2 + "]"; + } + function scale$2(enc, value2) { + const scale2 = scaleRef(enc.scale); + if (enc.range != null) { + value2 = `lerp(_range(${scale2}), ${+enc.range})`; + } else { + if (value2 !== void 0) value2 = `_scale(${scale2}, ${value2})`; + if (enc.band) { + value2 = (value2 ? value2 + "+" : "") + `_bandwidth(${scale2})` + (+enc.band === 1 ? "" : "*" + property(enc.band)); + if (enc.extra) { + value2 = `(datum.extra ? _scale(${scale2}, datum.extra.value) : ${value2})`; + } + } + if (value2 == null) value2 = "0"; + } + return value2; + } + function rule(enc) { + let code = ""; + enc.forEach((rule2) => { + const value2 = entry$1(rule2); + code += rule2.test ? `(${rule2.test})?${value2}:` : value2; }); - // if no else clause, terminate with null (#1366) - if ((0, _vegaUtil.peek)(code) === ':') code += 'null'; + if (peek$1(code) === ":") { + code += "null"; + } return code; -} -function parseEncode(encode, type, role, style, scope, params) { + } + function parseEncode(encode2, type2, role, style2, scope, params2) { const enc = {}; - params = params || {}; - params.encoders = { - $encode: enc - }; - encode = applyDefaults(encode, type, role, style, scope.config); - for(const key in encode)enc[key] = parseBlock(encode[key], type, params, scope); - return params; -} -function parseBlock(block, marktype, params, scope) { + params2 = params2 || {}; + params2.encoders = { + $encode: enc + }; + encode2 = applyDefaults(encode2, type2, role, style2, scope.config); + for (const key2 in encode2) { + enc[key2] = parseBlock(encode2[key2], type2, params2, scope); + } + return params2; + } + function parseBlock(block, marktype, params2, scope) { const channels = {}, fields = {}; - for(const name in block)if (block[name] != null) // skip any null entries - channels[name] = parse$1(expr(block[name]), scope, params, fields); + for (const name in block) { + if (block[name] != null) { + channels[name] = parse$1(expr(block[name]), scope, params2, fields); + } + } return { - $expr: { - marktype, - channels - }, - $fields: Object.keys(fields), - $output: Object.keys(block) - }; -} -function expr(enc) { - return (0, _vegaUtil.isArray)(enc) ? rule(enc) : entry$1(enc); -} -function parse$1(code, scope, params, fields) { - const expr = (0, _vegaFunctions.parseExpression)(code, scope); - expr.$fields.forEach((name)=>fields[name] = 1); - (0, _vegaUtil.extend)(params, expr.$params); - return expr.$expr; -} -const OUTER = 'outer', OUTER_INVALID = [ - 'value', - 'update', - 'init', - 'react', - 'bind' -]; -function outerError(prefix, name) { - (0, _vegaUtil.error)(prefix + ' for "outer" push: ' + (0, _vegaUtil.stringValue)(name)); -} -function parseSignal(signal, scope) { + $expr: { + marktype, + channels + }, + $fields: Object.keys(fields), + $output: Object.keys(block) + }; + } + function expr(enc) { + return isArray(enc) ? rule(enc) : entry$1(enc); + } + function parse$1(code, scope, params2, fields) { + const expr2 = parser(code, scope); + expr2.$fields.forEach((name) => fields[name] = 1); + extend$1(params2, expr2.$params); + return expr2.$expr; + } + const OUTER = "outer", OUTER_INVALID = ["value", "update", "init", "react", "bind"]; + function outerError(prefix, name) { + error(prefix + ' for "outer" push: ' + $(name)); + } + function parseSignal(signal, scope) { const name = signal.name; if (signal.push === OUTER) { - // signal must already be defined, raise error if not - if (!scope.signals[name]) outerError('No prior signal definition', name); - // signal push must not use properties reserved for standard definition - OUTER_INVALID.forEach((prop)=>{ - if (signal[prop] !== undefined) outerError('Invalid property ', prop); - }); + if (!scope.signals[name]) outerError("No prior signal definition", name); + OUTER_INVALID.forEach((prop) => { + if (signal[prop] !== void 0) outerError("Invalid property ", prop); + }); } else { - // define a new signal in the current scope - const op = scope.addSignal(name, signal.value); - if (signal.react === false) op.react = false; - if (signal.bind) scope.addBinding(name, signal.bind); + const op = scope.addSignal(name, signal.value); + if (signal.react === false) op.react = false; + if (signal.bind) scope.addBinding(name, signal.bind); } -} -function Entry(type, value, params, parent) { + } + function Entry(type2, value2, params2, parent) { this.id = -1; - this.type = type; - this.value = value; - this.params = params; + this.type = type2; + this.value = value2; + this.params = params2; if (parent) this.parent = parent; -} -function entry(type, value, params, parent) { - return new Entry(type, value, params, parent); -} -function operator(value, params) { - return entry('operator', value, params); -} -// ----- -function ref(op) { - const ref = { - $ref: op.id - }; - // if operator not yet registered, cache ref to resolve later - if (op.id < 0) (op.refs = op.refs || []).push(ref); - return ref; -} -function fieldRef$1(field, name) { + } + function entry(type2, value2, params2, parent) { + return new Entry(type2, value2, params2, parent); + } + function operator(value2, params2) { + return entry("operator", value2, params2); + } + function ref(op) { + const ref2 = { + $ref: op.id + }; + if (op.id < 0) (op.refs = op.refs || []).push(ref2); + return ref2; + } + function fieldRef$1(field2, name) { return name ? { - $field: field, - $name: name + $field: field2, + $name: name } : { - $field: field + $field: field2 }; -} -const keyFieldRef = fieldRef$1('key'); -function compareRef(fields, orders) { + } + const keyFieldRef = fieldRef$1("key"); + function compareRef(fields, orders) { return { - $compare: fields, - $order: orders - }; -} -function keyRef(fields, flat) { - const ref = { - $key: fields - }; - if (flat) ref.$flat = true; - return ref; -} -// ----- -const Ascending = 'ascending'; -const Descending = 'descending'; -function sortKey(sort) { - return !(0, _vegaUtil.isObject)(sort) ? '' : (sort.order === Descending ? '-' : '+') + aggrField(sort.op, sort.field); -} -function aggrField(op, field) { - return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || ''); -} -// ----- -const Scope$1 = 'scope'; -const View = 'view'; -function isSignal(_) { + $compare: fields, + $order: orders + }; + } + function keyRef(fields, flat) { + const ref2 = { + $key: fields + }; + if (flat) ref2.$flat = true; + return ref2; + } + const Ascending = "ascending"; + const Descending = "descending"; + function sortKey(sort2) { + return !isObject$1(sort2) ? "" : (sort2.order === Descending ? "-" : "+") + aggrField(sort2.op, sort2.field); + } + function aggrField(op, field2) { + return (op && op.signal ? "$" + op.signal : op || "") + (op && field2 ? "_" : "") + (field2 && field2.signal ? "$" + field2.signal : field2 || ""); + } + const Scope$1 = "scope"; + const View = "view"; + function isSignal(_) { return _ && _.signal; -} -function isExpr$1(_) { + } + function isExpr$1(_) { return _ && _.expr; -} -function hasSignal(_) { + } + function hasSignal(_) { if (isSignal(_)) return true; - if ((0, _vegaUtil.isObject)(_)) for(const key in _){ - if (hasSignal(_[key])) return true; + if (isObject$1(_)) for (const key2 in _) { + if (hasSignal(_[key2])) return true; } return false; -} -function value(specValue, defaultValue) { + } + function value(specValue, defaultValue) { return specValue != null ? specValue : defaultValue; -} -function deref(v) { + } + function deref(v) { return v && v.signal || v; -} -const Timer = 'timer'; -function parseStream(stream, scope) { - const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : (0, _vegaUtil.error)('Invalid stream specification: ' + (0, _vegaUtil.stringValue)(stream)); - return method(stream, scope); -} -function eventSource(source) { - return source === Scope$1 ? View : source || View; -} -function mergeStream(stream, scope) { - const list = stream.merge.map((s)=>parseStream(s, scope)), entry = streamParameters({ - merge: list - }, stream, scope); - return scope.addStream(entry).id; -} -function nestedStream(stream, scope) { - const id = parseStream(stream.stream, scope), entry = streamParameters({ - stream: id - }, stream, scope); - return scope.addStream(entry).id; -} -function eventStream(stream, scope) { - let id; - if (stream.type === Timer) { - id = scope.event(Timer, stream.throttle); - stream = { - between: stream.between, - filter: stream.filter - }; - } else id = scope.event(eventSource(stream.source), stream.type); - const entry = streamParameters({ - stream: id - }, stream, scope); - return Object.keys(entry).length === 1 ? id : scope.addStream(entry).id; -} -function streamParameters(entry, stream, scope) { - let param = stream.between; - if (param) { - if (param.length !== 2) (0, _vegaUtil.error)('Stream "between" parameter must have 2 entries: ' + (0, _vegaUtil.stringValue)(stream)); - entry.between = [ - parseStream(param[0], scope), - parseStream(param[1], scope) - ]; - } - param = stream.filter ? [].concat(stream.filter) : []; - if (stream.marktype || stream.markname || stream.markrole) // add filter for mark type, name and/or role - param.push(filterMark(stream.marktype, stream.markname, stream.markrole)); - if (stream.source === Scope$1) // add filter to limit events from sub-scope only - param.push('inScope(event.item)'); - if (param.length) entry.filter = (0, _vegaFunctions.parseExpression)('(' + param.join(')&&(') + ')', scope).$expr; - if ((param = stream.throttle) != null) entry.throttle = +param; - if ((param = stream.debounce) != null) entry.debounce = +param; - if (stream.consume) entry.consume = true; - return entry; -} -function filterMark(type, name, role) { - const item = 'event.item'; - return item + (type && type !== '*' ? '&&' + item + '.mark.marktype===\'' + type + '\'' : '') + (role ? '&&' + item + '.mark.role===\'' + role + '\'' : '') + (name ? '&&' + item + '.mark.name===\'' + name + '\'' : ''); -} -// bypass expression parser for internal operator references -const OP_VALUE_EXPR = { - code: '_.$value', + } + const Timer = "timer"; + function parseStream(stream2, scope) { + const method2 = stream2.merge ? mergeStream : stream2.stream ? nestedStream : stream2.type ? eventStream : error("Invalid stream specification: " + $(stream2)); + return method2(stream2, scope); + } + function eventSource(source2) { + return source2 === Scope$1 ? View : source2 || View; + } + function mergeStream(stream2, scope) { + const list = stream2.merge.map((s) => parseStream(s, scope)), entry2 = streamParameters({ + merge: list + }, stream2, scope); + return scope.addStream(entry2).id; + } + function nestedStream(stream2, scope) { + const id2 = parseStream(stream2.stream, scope), entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return scope.addStream(entry2).id; + } + function eventStream(stream2, scope) { + let id2; + if (stream2.type === Timer) { + id2 = scope.event(Timer, stream2.throttle); + stream2 = { + between: stream2.between, + filter: stream2.filter + }; + } else { + id2 = scope.event(eventSource(stream2.source), stream2.type); + } + const entry2 = streamParameters({ + stream: id2 + }, stream2, scope); + return Object.keys(entry2).length === 1 ? id2 : scope.addStream(entry2).id; + } + function streamParameters(entry2, stream2, scope) { + let param2 = stream2.between; + if (param2) { + if (param2.length !== 2) { + error('Stream "between" parameter must have 2 entries: ' + $(stream2)); + } + entry2.between = [parseStream(param2[0], scope), parseStream(param2[1], scope)]; + } + param2 = stream2.filter ? [].concat(stream2.filter) : []; + if (stream2.marktype || stream2.markname || stream2.markrole) { + param2.push(filterMark(stream2.marktype, stream2.markname, stream2.markrole)); + } + if (stream2.source === Scope$1) { + param2.push("inScope(event.item)"); + } + if (param2.length) { + entry2.filter = parser("(" + param2.join(")&&(") + ")", scope).$expr; + } + if ((param2 = stream2.throttle) != null) { + entry2.throttle = +param2; + } + if ((param2 = stream2.debounce) != null) { + entry2.debounce = +param2; + } + if (stream2.consume) { + entry2.consume = true; + } + return entry2; + } + function filterMark(type2, name, role) { + const item = "event.item"; + return item + (type2 && type2 !== "*" ? "&&" + item + ".mark.marktype==='" + type2 + "'" : "") + (role ? "&&" + item + ".mark.role==='" + role + "'" : "") + (name ? "&&" + item + ".mark.name==='" + name + "'" : ""); + } + const OP_VALUE_EXPR = { + code: "_.$value", ast: { - type: 'Identifier', - value: 'value' - } -}; -function parseUpdate(spec, scope, target) { - const encode = spec.encode, entry = { - target: target - }; - let events = spec.events, update = spec.update, sources = []; - if (!events) (0, _vegaUtil.error)('Signal update missing events specification.'); - // interpret as an event selector string - if ((0, _vegaUtil.isString)(events)) events = (0, _vegaEventSelector.parseSelector)(events, scope.isSubscope() ? Scope$1 : View); - // separate event streams from signal updates - events = (0, _vegaUtil.array)(events).filter((s)=>s.signal || s.scale ? (sources.push(s), 0) : 1); - // merge internal operator listeners - if (sources.length > 1) sources = [ - mergeSources(sources) - ]; - // merge event streams, include as source - if (events.length) sources.push(events.length > 1 ? { - merge: events - } : events[0]); - if (encode != null) { - if (update) (0, _vegaUtil.error)('Signal encode and update are mutually exclusive.'); - update = 'encode(item(),' + (0, _vegaUtil.stringValue)(encode) + ')'; - } - // resolve update value - entry.update = (0, _vegaUtil.isString)(update) ? (0, _vegaFunctions.parseExpression)(update, scope) : update.expr != null ? (0, _vegaFunctions.parseExpression)(update.expr, scope) : update.value != null ? update.value : update.signal != null ? { - $expr: OP_VALUE_EXPR, - $params: { - $value: scope.signalRef(update.signal) - } - } : (0, _vegaUtil.error)('Invalid signal update specification.'); - if (spec.force) entry.options = { + type: "Identifier", + value: "value" + } + }; + function parseUpdate(spec, scope, target2) { + const encode2 = spec.encode, entry2 = { + target: target2 + }; + let events2 = spec.events, update2 = spec.update, sources = []; + if (!events2) { + error("Signal update missing events specification."); + } + if (isString(events2)) { + events2 = eventSelector(events2, scope.isSubscope() ? Scope$1 : View); + } + events2 = array$5(events2).filter((s) => s.signal || s.scale ? (sources.push(s), 0) : 1); + if (sources.length > 1) { + sources = [mergeSources(sources)]; + } + if (events2.length) { + sources.push(events2.length > 1 ? { + merge: events2 + } : events2[0]); + } + if (encode2 != null) { + if (update2) error("Signal encode and update are mutually exclusive."); + update2 = "encode(item()," + $(encode2) + ")"; + } + entry2.update = isString(update2) ? parser(update2, scope) : update2.expr != null ? parser(update2.expr, scope) : update2.value != null ? update2.value : update2.signal != null ? { + $expr: OP_VALUE_EXPR, + $params: { + $value: scope.signalRef(update2.signal) + } + } : error("Invalid signal update specification."); + if (spec.force) { + entry2.options = { force: true - }; - sources.forEach((source)=>scope.addUpdate((0, _vegaUtil.extend)(streamSource(source, scope), entry))); -} -function streamSource(stream, scope) { + }; + } + sources.forEach((source2) => scope.addUpdate(extend$1(streamSource(source2, scope), entry2))); + } + function streamSource(stream2, scope) { return { - source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream(stream, scope) + source: stream2.signal ? scope.signalRef(stream2.signal) : stream2.scale ? scope.scaleRef(stream2.scale) : parseStream(stream2, scope) }; -} -function mergeSources(sources) { + } + function mergeSources(sources) { return { - signal: '[' + sources.map((s)=>s.scale ? 'scale("' + s.scale + '")' : s.signal) + ']' + signal: "[" + sources.map((s) => s.scale ? 'scale("' + s.scale + '")' : s.signal) + "]" }; -} -function parseSignalUpdates(signal, scope) { + } + function parseSignalUpdates(signal, scope) { const op = scope.getSignal(signal.name); - let expr = signal.update; + let expr2 = signal.update; if (signal.init) { - if (expr) (0, _vegaUtil.error)('Signals can not include both init and update expressions.'); - else { - expr = signal.init; - op.initonly = true; - } - } - if (expr) { - expr = (0, _vegaFunctions.parseExpression)(expr, scope); - op.update = expr.$expr; - op.params = expr.$params; - } - if (signal.on) signal.on.forEach((_)=>parseUpdate(_, scope, op.id)); -} -const transform = (name)=>(params, value, parent)=>entry(name, value, params || undefined, parent); -const Aggregate = transform('aggregate'); -const AxisTicks = transform('axisticks'); -const Bound = transform('bound'); -const Collect = transform('collect'); -const Compare = transform('compare'); -const DataJoin = transform('datajoin'); -const Encode = transform('encode'); -const Expression = transform('expression'); -const Facet = transform('facet'); -const Field = transform('field'); -const Key = transform('key'); -const LegendEntries = transform('legendentries'); -const Load = transform('load'); -const Mark = transform('mark'); -const MultiExtent = transform('multiextent'); -const MultiValues = transform('multivalues'); -const Overlap = transform('overlap'); -const Params = transform('params'); -const PreFacet = transform('prefacet'); -const Projection = transform('projection'); -const Proxy = transform('proxy'); -const Relay = transform('relay'); -const Render = transform('render'); -const Scale = transform('scale'); -const Sieve = transform('sieve'); -const SortItems = transform('sortitems'); -const ViewLayout = transform('viewlayout'); -const Values = transform('values'); -let FIELD_REF_ID = 0; -const MULTIDOMAIN_SORT_OPS = { - min: 'min', - max: 'max', - count: 'sum' -}; -function initScale(spec, scope) { - const type = spec.type || 'linear'; - if (!(0, _vegaScale.isValidScaleType)(type)) (0, _vegaUtil.error)('Unrecognized scale type: ' + (0, _vegaUtil.stringValue)(type)); + if (expr2) { + error("Signals can not include both init and update expressions."); + } else { + expr2 = signal.init; + op.initonly = true; + } + } + if (expr2) { + expr2 = parser(expr2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + if (signal.on) { + signal.on.forEach((_) => parseUpdate(_, scope, op.id)); + } + } + const transform = (name) => (params2, value2, parent) => entry(name, value2, params2 || void 0, parent); + const Aggregate = transform("aggregate"); + const AxisTicks = transform("axisticks"); + const Bound = transform("bound"); + const Collect = transform("collect"); + const Compare = transform("compare"); + const DataJoin = transform("datajoin"); + const Encode = transform("encode"); + const Expression = transform("expression"); + const Facet = transform("facet"); + const Field = transform("field"); + const Key = transform("key"); + const LegendEntries = transform("legendentries"); + const Load = transform("load"); + const Mark = transform("mark"); + const MultiExtent = transform("multiextent"); + const MultiValues = transform("multivalues"); + const Overlap = transform("overlap"); + const Params = transform("params"); + const PreFacet = transform("prefacet"); + const Projection = transform("projection"); + const Proxy = transform("proxy"); + const Relay = transform("relay"); + const Render = transform("render"); + const Scale = transform("scale"); + const Sieve = transform("sieve"); + const SortItems = transform("sortitems"); + const ViewLayout = transform("viewlayout"); + const Values = transform("values"); + let FIELD_REF_ID = 0; + const MULTIDOMAIN_SORT_OPS = { + min: "min", + max: "max", + count: "sum" + }; + function initScale(spec, scope) { + const type2 = spec.type || "linear"; + if (!isValidScaleType(type2)) { + error("Unrecognized scale type: " + $(type2)); + } scope.addScale(spec.name, { - type, - domain: undefined + type: type2, + domain: void 0 }); -} -function parseScale(spec, scope) { - const params = scope.getScale(spec.name).params; - let key; - params.domain = parseScaleDomain(spec.domain, spec, scope); - if (spec.range != null) params.range = parseScaleRange(spec, scope, params); - if (spec.interpolate != null) parseScaleInterpolate(spec.interpolate, params); - if (spec.nice != null) params.nice = parseScaleNice(spec.nice, scope); - if (spec.bins != null) params.bins = parseScaleBins(spec.bins, scope); - for(key in spec){ - if ((0, _vegaUtil.hasOwnProperty)(params, key) || key === 'name') continue; - params[key] = parseLiteral(spec[key], scope); - } -} -function parseLiteral(v, scope) { - return !(0, _vegaUtil.isObject)(v) ? v : v.signal ? scope.signalRef(v.signal) : (0, _vegaUtil.error)('Unsupported object: ' + (0, _vegaUtil.stringValue)(v)); -} -function parseArray(v, scope) { - return v.signal ? scope.signalRef(v.signal) : v.map((v)=>parseLiteral(v, scope)); -} -function dataLookupError(name) { - (0, _vegaUtil.error)('Can not find data set: ' + (0, _vegaUtil.stringValue)(name)); -} -// -- SCALE DOMAIN ---- -function parseScaleDomain(domain, spec, scope) { - if (!domain) { - if (spec.domainMin != null || spec.domainMax != null) (0, _vegaUtil.error)('No scale domain defined for domainMin/domainMax to override.'); - return; // default domain - } - return domain.signal ? scope.signalRef(domain.signal) : ((0, _vegaUtil.isArray)(domain) ? explicitDomain : domain.fields ? multipleDomain : singularDomain)(domain, spec, scope); -} -function explicitDomain(domain, spec, scope) { - return domain.map((v)=>parseLiteral(v, scope)); -} -function singularDomain(domain, spec, scope) { - const data = scope.getData(domain.data); - if (!data) dataLookupError(domain.data); - return (0, _vegaScale.isDiscrete)(spec.type) ? data.valuesRef(scope, domain.field, parseSort(domain.sort, false)) : (0, _vegaScale.isQuantile)(spec.type) ? data.domainRef(scope, domain.field) : data.extentRef(scope, domain.field); -} -function multipleDomain(domain, spec, scope) { - const data = domain.data, fields = domain.fields.reduce((dom, d)=>{ - d = (0, _vegaUtil.isString)(d) ? { - data: data, - field: d - } : (0, _vegaUtil.isArray)(d) || d.signal ? fieldRef(d, scope) : d; - dom.push(d); - return dom; + } + function parseScale(spec, scope) { + const params2 = scope.getScale(spec.name).params; + let key2; + params2.domain = parseScaleDomain(spec.domain, spec, scope); + if (spec.range != null) { + params2.range = parseScaleRange(spec, scope, params2); + } + if (spec.interpolate != null) { + parseScaleInterpolate(spec.interpolate, params2); + } + if (spec.nice != null) { + params2.nice = parseScaleNice(spec.nice, scope); + } + if (spec.bins != null) { + params2.bins = parseScaleBins(spec.bins, scope); + } + for (key2 in spec) { + if (has$1(params2, key2) || key2 === "name") continue; + params2[key2] = parseLiteral(spec[key2], scope); + } + } + function parseLiteral(v, scope) { + return !isObject$1(v) ? v : v.signal ? scope.signalRef(v.signal) : error("Unsupported object: " + $(v)); + } + function parseArray(v, scope) { + return v.signal ? scope.signalRef(v.signal) : v.map((v2) => parseLiteral(v2, scope)); + } + function dataLookupError(name) { + error("Can not find data set: " + $(name)); + } + function parseScaleDomain(domain2, spec, scope) { + if (!domain2) { + if (spec.domainMin != null || spec.domainMax != null) { + error("No scale domain defined for domainMin/domainMax to override."); + } + return; + } + return domain2.signal ? scope.signalRef(domain2.signal) : (isArray(domain2) ? explicitDomain : domain2.fields ? multipleDomain : singularDomain)(domain2, spec, scope); + } + function explicitDomain(domain2, spec, scope) { + return domain2.map((v) => parseLiteral(v, scope)); + } + function singularDomain(domain2, spec, scope) { + const data2 = scope.getData(domain2.data); + if (!data2) dataLookupError(domain2.data); + return isDiscrete(spec.type) ? data2.valuesRef(scope, domain2.field, parseSort(domain2.sort, false)) : isQuantile(spec.type) ? data2.domainRef(scope, domain2.field) : data2.extentRef(scope, domain2.field); + } + function multipleDomain(domain2, spec, scope) { + const data2 = domain2.data, fields = domain2.fields.reduce((dom, d) => { + d = isString(d) ? { + data: data2, + field: d + } : isArray(d) || d.signal ? fieldRef(d, scope) : d; + dom.push(d); + return dom; }, []); - return ((0, _vegaScale.isDiscrete)(spec.type) ? ordinalMultipleDomain : (0, _vegaScale.isQuantile)(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields); -} -function fieldRef(data, scope) { - const name = '_:vega:_' + FIELD_REF_ID++, coll = Collect({}); - if ((0, _vegaUtil.isArray)(data)) coll.value = { - $ingest: data - }; - else if (data.signal) { - const code = 'setdata(' + (0, _vegaUtil.stringValue)(name) + ',' + data.signal + ')'; - coll.params.input = scope.signalRef(code); - } - scope.addDataPipeline(name, [ - coll, - Sieve({}) - ]); + return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain2, scope, fields); + } + function fieldRef(data2, scope) { + const name = "_:vega:_" + FIELD_REF_ID++, coll = Collect({}); + if (isArray(data2)) { + coll.value = { + $ingest: data2 + }; + } else if (data2.signal) { + const code = "setdata(" + $(name) + "," + data2.signal + ")"; + coll.params.input = scope.signalRef(code); + } + scope.addDataPipeline(name, [coll, Sieve({})]); return { - data: name, - field: 'data' - }; -} -function ordinalMultipleDomain(domain, scope, fields) { - const sort = parseSort(domain.sort, true); - let a, v; - // get value counts for each domain field - const counts = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.countsRef(scope, f.field, sort); + data: name, + field: "data" + }; + } + function ordinalMultipleDomain(domain2, scope, fields) { + const sort2 = parseSort(domain2.sort, true); + let a2, v; + const counts = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.countsRef(scope, f.field, sort2); }); - // aggregate the results from each domain field const p = { - groupby: keyFieldRef, - pulse: counts - }; - if (sort) { - a = sort.op || 'count'; - v = sort.field ? aggrField(a, sort.field) : 'count'; - p.ops = [ - MULTIDOMAIN_SORT_OPS[a] - ]; - p.fields = [ - scope.fieldRef(v) - ]; - p.as = [ - v - ]; - } - a = scope.add(Aggregate(p)); - // collect aggregate output - const c = scope.add(Collect({ - pulse: ref(a) + groupby: keyFieldRef, + pulse: counts + }; + if (sort2) { + a2 = sort2.op || "count"; + v = sort2.field ? aggrField(a2, sort2.field) : "count"; + p.ops = [MULTIDOMAIN_SORT_OPS[a2]]; + p.fields = [scope.fieldRef(v)]; + p.as = [v]; + } + a2 = scope.add(Aggregate(p)); + const c2 = scope.add(Collect({ + pulse: ref(a2) })); - // extract values for combined domain v = scope.add(Values({ - field: keyFieldRef, - sort: scope.sortRef(sort), - pulse: ref(c) + field: keyFieldRef, + sort: scope.sortRef(sort2), + pulse: ref(c2) })); return ref(v); -} -function parseSort(sort, multidomain) { - if (sort) { - if (!sort.field && !sort.op) { - if ((0, _vegaUtil.isObject)(sort)) sort.field = 'key'; - else sort = { - field: 'key' - }; - } else if (!sort.field && sort.op !== 'count') (0, _vegaUtil.error)('No field provided for sort aggregate op: ' + sort.op); - else if (multidomain && sort.field) { - if (sort.op && !MULTIDOMAIN_SORT_OPS[sort.op]) (0, _vegaUtil.error)('Multiple domain scales can not be sorted using ' + sort.op); - } - } - return sort; -} -function quantileMultipleDomain(domain, scope, fields) { - // get value arrays for each domain field - const values = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.domainRef(scope, f.field); + } + function parseSort(sort2, multidomain) { + if (sort2) { + if (!sort2.field && !sort2.op) { + if (isObject$1(sort2)) sort2.field = "key"; + else sort2 = { + field: "key" + }; + } else if (!sort2.field && sort2.op !== "count") { + error("No field provided for sort aggregate op: " + sort2.op); + } else if (multidomain && sort2.field) { + if (sort2.op && !MULTIDOMAIN_SORT_OPS[sort2.op]) { + error("Multiple domain scales can not be sorted using " + sort2.op); + } + } + } + return sort2; + } + function quantileMultipleDomain(domain2, scope, fields) { + const values2 = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.domainRef(scope, f.field); }); - // combine value arrays return ref(scope.add(MultiValues({ - values: values + values: values2 }))); -} -function numericMultipleDomain(domain, scope, fields) { - // get extents for each domain field - const extents = fields.map((f)=>{ - const data = scope.getData(f.data); - if (!data) dataLookupError(f.data); - return data.extentRef(scope, f.field); + } + function numericMultipleDomain(domain2, scope, fields) { + const extents = fields.map((f) => { + const data2 = scope.getData(f.data); + if (!data2) dataLookupError(f.data); + return data2.extentRef(scope, f.field); }); - // combine extents return ref(scope.add(MultiExtent({ - extents: extents + extents }))); -} -// -- SCALE BINS ----- -function parseScaleBins(v, scope) { - return v.signal || (0, _vegaUtil.isArray)(v) ? parseArray(v, scope) : scope.objectProperty(v); -} -// -- SCALE NICE ----- -function parseScaleNice(nice, scope) { - return nice.signal ? scope.signalRef(nice.signal) : (0, _vegaUtil.isObject)(nice) ? { - interval: parseLiteral(nice.interval), - step: parseLiteral(nice.step) - } : parseLiteral(nice); -} -// -- SCALE INTERPOLATION ----- -function parseScaleInterpolate(interpolate, params) { - params.interpolate = parseLiteral(interpolate.type || interpolate); - if (interpolate.gamma != null) params.interpolateGamma = parseLiteral(interpolate.gamma); -} -// -- SCALE RANGE ----- -function parseScaleRange(spec, scope, params) { + } + function parseScaleBins(v, scope) { + return v.signal || isArray(v) ? parseArray(v, scope) : scope.objectProperty(v); + } + function parseScaleNice(nice2, scope) { + return nice2.signal ? scope.signalRef(nice2.signal) : isObject$1(nice2) ? { + interval: parseLiteral(nice2.interval), + step: parseLiteral(nice2.step) + } : parseLiteral(nice2); + } + function parseScaleInterpolate(interpolate2, params2) { + params2.interpolate = parseLiteral(interpolate2.type || interpolate2); + if (interpolate2.gamma != null) { + params2.interpolateGamma = parseLiteral(interpolate2.gamma); + } + } + function parseScaleRange(spec, scope, params2) { const config = scope.config.range; - let range = spec.range; - if (range.signal) return scope.signalRef(range.signal); - else if ((0, _vegaUtil.isString)(range)) { - if (config && (0, _vegaUtil.hasOwnProperty)(config, range)) { - spec = (0, _vegaUtil.extend)({}, spec, { - range: config[range] - }); - return parseScaleRange(spec, scope, params); - } else if (range === 'width') range = [ - 0, - { - signal: 'width' - } - ]; - else if (range === 'height') range = (0, _vegaScale.isDiscrete)(spec.type) ? [ - 0, - { - signal: 'height' - } - ] : [ - { - signal: 'height' - }, - 0 - ]; - else (0, _vegaUtil.error)('Unrecognized scale range value: ' + (0, _vegaUtil.stringValue)(range)); - } else if (range.scheme) { - params.scheme = (0, _vegaUtil.isArray)(range.scheme) ? parseArray(range.scheme, scope) : parseLiteral(range.scheme, scope); - if (range.extent) params.schemeExtent = parseArray(range.extent, scope); - if (range.count) params.schemeCount = parseLiteral(range.count, scope); - return; - } else if (range.step) { - params.rangeStep = parseLiteral(range.step, scope); - return; - } else if ((0, _vegaScale.isDiscrete)(spec.type) && !(0, _vegaUtil.isArray)(range)) return parseScaleDomain(range, spec, scope); - else if (!(0, _vegaUtil.isArray)(range)) (0, _vegaUtil.error)('Unsupported range type: ' + (0, _vegaUtil.stringValue)(range)); - return range.map((v)=>((0, _vegaUtil.isArray)(v) ? parseArray : parseLiteral)(v, scope)); -} -function parseProjection(proj, scope) { - const config = scope.config.projection || {}, params = {}; - for(const name in proj){ - if (name === 'name') continue; - params[name] = parseParameter$1(proj[name], name, scope); - } - // apply projection defaults from config - for(const name in config)if (params[name] == null) params[name] = parseParameter$1(config[name], name, scope); - scope.addProjection(proj.name, params); -} -function parseParameter$1(_, name, scope) { - return (0, _vegaUtil.isArray)(_) ? _.map((_)=>parseParameter$1(_, name, scope)) : !(0, _vegaUtil.isObject)(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : (0, _vegaUtil.error)('Unsupported parameter object: ' + (0, _vegaUtil.stringValue)(_)); -} -const Top = 'top'; -const Left = 'left'; -const Right = 'right'; -const Bottom = 'bottom'; -const Center = 'center'; -const Vertical = 'vertical'; -const Start = 'start'; -const Middle = 'middle'; -const End = 'end'; -const Index = 'index'; -const Label = 'label'; -const Offset = 'offset'; -const Perc = 'perc'; -const Perc2 = 'perc2'; -const Value = 'value'; -const GuideLabelStyle = 'guide-label'; -const GuideTitleStyle = 'guide-title'; -const GroupTitleStyle = 'group-title'; -const GroupSubtitleStyle = 'group-subtitle'; -/** All values of LegendType */ const Symbols = 'symbol'; -const Gradient = 'gradient'; -const Discrete = 'discrete'; -const Size = 'size'; -const Shape = 'shape'; -const Fill = 'fill'; -const Stroke = 'stroke'; -const StrokeWidth = 'strokeWidth'; -const StrokeDash = 'strokeDash'; -const Opacity = 'opacity'; -// Encoding channels supported by legends -// In priority order of 'canonical' scale -const LegendScales = [ - Size, - Shape, - Fill, - Stroke, - StrokeWidth, - StrokeDash, - Opacity -]; -const Skip = { + let range2 = spec.range; + if (range2.signal) { + return scope.signalRef(range2.signal); + } else if (isString(range2)) { + if (config && has$1(config, range2)) { + spec = extend$1({}, spec, { + range: config[range2] + }); + return parseScaleRange(spec, scope, params2); + } else if (range2 === "width") { + range2 = [0, { + signal: "width" + }]; + } else if (range2 === "height") { + range2 = isDiscrete(spec.type) ? [0, { + signal: "height" + }] : [{ + signal: "height" + }, 0]; + } else { + error("Unrecognized scale range value: " + $(range2)); + } + } else if (range2.scheme) { + params2.scheme = isArray(range2.scheme) ? parseArray(range2.scheme, scope) : parseLiteral(range2.scheme, scope); + if (range2.extent) params2.schemeExtent = parseArray(range2.extent, scope); + if (range2.count) params2.schemeCount = parseLiteral(range2.count, scope); + return; + } else if (range2.step) { + params2.rangeStep = parseLiteral(range2.step, scope); + return; + } else if (isDiscrete(spec.type) && !isArray(range2)) { + return parseScaleDomain(range2, spec, scope); + } else if (!isArray(range2)) { + error("Unsupported range type: " + $(range2)); + } + return range2.map((v) => (isArray(v) ? parseArray : parseLiteral)(v, scope)); + } + function parseProjection(proj, scope) { + const config = scope.config.projection || {}, params2 = {}; + for (const name in proj) { + if (name === "name") continue; + params2[name] = parseParameter$1(proj[name], name, scope); + } + for (const name in config) { + if (params2[name] == null) { + params2[name] = parseParameter$1(config[name], name, scope); + } + } + scope.addProjection(proj.name, params2); + } + function parseParameter$1(_, name, scope) { + return isArray(_) ? _.map((_2) => parseParameter$1(_2, name, scope)) : !isObject$1(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === "fit" ? _ : error("Unsupported parameter object: " + $(_)); + } + const Top = "top"; + const Left = "left"; + const Right = "right"; + const Bottom = "bottom"; + const Center = "center"; + const Vertical = "vertical"; + const Start = "start"; + const Middle = "middle"; + const End = "end"; + const Index = "index"; + const Label = "label"; + const Offset = "offset"; + const Perc = "perc"; + const Perc2 = "perc2"; + const Value = "value"; + const GuideLabelStyle = "guide-label"; + const GuideTitleStyle = "guide-title"; + const GroupTitleStyle = "group-title"; + const GroupSubtitleStyle = "group-subtitle"; + const Symbols = "symbol"; + const Gradient = "gradient"; + const Discrete = "discrete"; + const Size = "size"; + const Shape = "shape"; + const Fill = "fill"; + const Stroke = "stroke"; + const StrokeWidth = "strokeWidth"; + const StrokeDash = "strokeDash"; + const Opacity = "opacity"; + const LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity]; + const Skip = { name: 1, style: 1, interactive: 1 -}; -const zero = { + }; + const zero = { value: 0 -}; -const one = { + }; + const one = { value: 1 -}; -const GroupMark = 'group'; -const RectMark = 'rect'; -const RuleMark = 'rule'; -const SymbolMark = 'symbol'; -const TextMark = 'text'; -function guideGroup(mark) { + }; + const GroupMark = "group"; + const RectMark = "rect"; + const RuleMark = "rule"; + const SymbolMark = "symbol"; + const TextMark = "text"; + function guideGroup(mark) { mark.type = GroupMark; mark.interactive = mark.interactive || false; return mark; -} -function lookup(spec, config) { - const _ = (name, dflt)=>value(spec[name], value(config[name], dflt)); - _.isVertical = (s)=>Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); - _.gradientLength = ()=>value(spec.gradientLength, config.gradientLength || config.gradientWidth); - _.gradientThickness = ()=>value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); - _.entryColumns = ()=>value(spec.columns, value(config.columns, +_.isVertical(true))); + } + function lookup(spec, config) { + const _ = (name, dflt) => value(spec[name], value(config[name], dflt)); + _.isVertical = (s) => Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection)); + _.gradientLength = () => value(spec.gradientLength, config.gradientLength || config.gradientWidth); + _.gradientThickness = () => value(spec.gradientThickness, config.gradientThickness || config.gradientHeight); + _.entryColumns = () => value(spec.columns, value(config.columns, +_.isVertical(true))); return _; -} -function getEncoding(name, encode) { - const v = encode && (encode.update && encode.update[name] || encode.enter && encode.enter[name]); + } + function getEncoding(name, encode2) { + const v = encode2 && (encode2.update && encode2.update[name] || encode2.enter && encode2.enter[name]); return v && v.signal ? v : v ? v.value : null; -} -function getStyle(name, scope, style) { - const s = scope.config.style[style]; + } + function getStyle(name, scope, style2) { + const s = scope.config.style[style2]; return s && s[name]; -} -function anchorExpr(s, e, m) { - return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`; -} -const alignExpr$1 = anchorExpr((0, _vegaUtil.stringValue)(Left), (0, _vegaUtil.stringValue)(Right), (0, _vegaUtil.stringValue)(Center)); -function tickBand(_) { - const v = _('tickBand'); - let offset = _('tickOffset'), band, extra; + } + function anchorExpr(s, e, m2) { + return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m2}`; + } + const alignExpr$1 = anchorExpr($(Left), $(Right), $(Center)); + function tickBand(_) { + const v = _("tickBand"); + let offset2 = _("tickOffset"), band2, extra; if (!v) { - // if no tick band entry, fall back on other properties - band = _('bandPosition'); - extra = _('tickExtra'); + band2 = _("bandPosition"); + extra = _("tickExtra"); } else if (v.signal) { - // if signal, augment code to interpret values - band = { - signal: `(${v.signal}) === 'extent' ? 1 : 0.5` - }; - extra = { - signal: `(${v.signal}) === 'extent'` + band2 = { + signal: `(${v.signal}) === 'extent' ? 1 : 0.5` + }; + extra = { + signal: `(${v.signal}) === 'extent'` + }; + if (!isObject$1(offset2)) { + offset2 = { + signal: `(${v.signal}) === 'extent' ? 0 : ${offset2}` }; - if (!(0, _vegaUtil.isObject)(offset)) offset = { - signal: `(${v.signal}) === 'extent' ? 0 : ${offset}` - }; - } else if (v === 'extent') { - // if constant, simply set values - band = 1; - extra = true; - offset = 0; + } + } else if (v === "extent") { + band2 = 1; + extra = true; + offset2 = 0; } else { - band = 0.5; - extra = false; + band2 = 0.5; + extra = false; } return { - extra, - band, - offset - }; -} -function extendOffset(value, offset) { - return !offset ? value : !value ? offset : !(0, _vegaUtil.isObject)(value) ? { - value, - offset - } : Object.assign({}, value, { - offset: extendOffset(value.offset, offset) + extra, + band: band2, + offset: offset2 + }; + } + function extendOffset(value2, offset2) { + return !offset2 ? value2 : !value2 ? offset2 : !isObject$1(value2) ? { + value: value2, + offset: offset2 + } : Object.assign({}, value2, { + offset: extendOffset(value2.offset, offset2) }); -} -function guideMark(mark, extras) { + } + function guideMark(mark, extras) { if (extras) { - mark.name = extras.name; - mark.style = extras.style || mark.style; - mark.interactive = !!extras.interactive; - mark.encode = extendEncode(mark.encode, extras, Skip); - } else mark.interactive = false; + mark.name = extras.name; + mark.style = extras.style || mark.style; + mark.interactive = !!extras.interactive; + mark.encode = extendEncode(mark.encode, extras, Skip); + } else { + mark.interactive = false; + } return mark; -} -function legendGradient(spec, scale, config, userEncode) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let enter, start, stop, width, height; + } + function legendGradient(spec, scale2, config, userEncode) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let enter, start, stop2, width2, height2; if (vertical) { - start = [ - 0, - 1 - ]; - stop = [ - 0, - 0 - ]; - width = thickness; - height = length; + start = [0, 1]; + stop2 = [0, 0]; + width2 = thickness; + height2 = length2; } else { - start = [ - 0, - 0 - ]; - stop = [ - 1, - 0 - ]; - width = length; - height = thickness; - } - const encode = { - enter: enter = { - opacity: zero, - x: zero, - y: zero, - width: encoder(width), - height: encoder(height) - }, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one, - fill: { - gradient: scale, - start: start, - stop: stop - } - }), - exit: { - opacity: zero + start = [0, 0]; + stop2 = [1, 0]; + width2 = length2; + height2 = thickness; + } + const encode2 = { + enter: enter = { + opacity: zero, + x: zero, + y: zero, + width: encoder(width2), + height: encoder(height2) + }, + update: extend$1({}, enter, { + opacity: one, + fill: { + gradient: scale2, + start, + stop: stop2 } + }), + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendGradientRole, - encode + type: RectMark, + role: LegendGradientRole, + encode: encode2 }, userEncode); -} -function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length = _.gradientLength(); - let u, v, uu, vv, adjust = ''; - vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height'); + } + function legendGradientDiscrete(spec, scale2, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = _.gradientThickness(), length2 = _.gradientLength(); + let u2, v, uu, vv, adjust = ""; + vertical ? (u2 = "y", uu = "y2", v = "x", vv = "width", adjust = "1-") : (u2 = "x", uu = "x2", v = "y", vv = "height"); const enter = { - opacity: zero, - fill: { - scale: scale, - field: Value - } + opacity: zero, + fill: { + scale: scale2, + field: Value + } }; - enter[u] = { - signal: adjust + 'datum.' + Perc, - mult: length + enter[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 }; enter[v] = zero; enter[uu] = { - signal: adjust + 'datum.' + Perc2, - mult: length + signal: adjust + "datum." + Perc2, + mult: length2 }; enter[vv] = encoder(thickness); - const encode = { - enter: enter, - update: (0, _vegaUtil.extend)({}, enter, { - opacity: one - }), - exit: { - opacity: zero - } - }; - addEncoders(encode, { - stroke: _('gradientStrokeColor'), - strokeWidth: _('gradientStrokeWidth') + const encode2 = { + enter, + update: extend$1({}, enter, { + opacity: one + }), + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + stroke: _("gradientStrokeColor"), + strokeWidth: _("gradientStrokeWidth") }, { - // update - opacity: _('gradientOpacity') + // update + opacity: _("gradientOpacity") }); return guideMark({ - type: RectMark, - role: LegendBandRole, - key: Value, - from: dataRef, - encode + type: RectMark, + role: LegendBandRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; -function legendGradientLabels(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length = _.gradientLength(); - let overlap = _('labelOverlap'), enter, update, u, v, adjust = ''; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one, - text: { - field: Label - } - }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: value(spec.labelLimit, config.gradientLabelLimit) + } + const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`, baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`; + function legendGradientLabels(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), vertical = _.isVertical(), thickness = encoder(_.gradientThickness()), length2 = _.gradientLength(); + let overlap = _("labelOverlap"), enter, update2, u2, v, adjust = ""; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one, + text: { + field: Label + } + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: value(spec.labelLimit, config.gradientLabelLimit) }); if (vertical) { - enter.align = { - value: 'left' - }; - enter.baseline = update.baseline = { - signal: baselineExpr - }; - u = 'y'; - v = 'x'; - adjust = '1-'; + enter.align = { + value: "left" + }; + enter.baseline = update2.baseline = { + signal: baselineExpr + }; + u2 = "y"; + v = "x"; + adjust = "1-"; } else { - enter.align = update.align = { - signal: alignExpr - }; - enter.baseline = { - value: 'top' - }; - u = 'x'; - v = 'y'; - } - enter[u] = update[u] = { - signal: adjust + 'datum.' + Perc, - mult: length - }; - enter[v] = update[v] = thickness; + enter.align = update2.align = { + signal: alignExpr + }; + enter.baseline = { + value: "top" + }; + u2 = "x"; + v = "y"; + } + enter[u2] = update2[u2] = { + signal: adjust + "datum." + Perc, + mult: length2 + }; + enter[v] = update2[v] = thickness; thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0; overlap = overlap ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.' + Index - } : undefined; - // type, role, style, key, dataRef, encode, extras + separation: _("labelSeparation"), + method: overlap, + order: "datum." + Index + } : void 0; return guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -// userEncode is top-level, includes entries, symbols, labels -function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { - const _ = lookup(spec, config), entries = userEncode.entries, interactive = !!(entries && entries.interactive), name = entries ? entries.name : undefined, height = _('clipHeight'), symbolOffset = _('symbolOffset'), valueRef = { - data: 'value' - }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height ? encoder(height) : { - field: Size - }, index = `datum.${Index}`, ncols = `max(1, ${columns})`; - let encode, enter, update, nrows, sort; + } + function legendSymbolGroups(spec, config, userEncode, dataRef, columns) { + const _ = lookup(spec, config), entries = userEncode.entries, interactive2 = !!(entries && entries.interactive), name = entries ? entries.name : void 0, height2 = _("clipHeight"), symbolOffset = _("symbolOffset"), valueRef = { + data: "value" + }, xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`, yEncode = height2 ? encoder(height2) : { + field: Size + }, index2 = `datum.${Index}`, ncols = `max(1, ${columns})`; + let encode2, enter, update2, nrows, sort2; yEncode.mult = 0.5; - // -- LEGEND SYMBOLS -- - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - mult: 0.5, - offset: symbolOffset - }, - y: yEncode - }, - update: update = { - opacity: one, - x: enter.x, - y: enter.y + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + mult: 0.5, + offset: symbolOffset }, - exit: { - opacity: zero - } + y: yEncode + }, + update: update2 = { + opacity: one, + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } }; let baseFill = null, baseStroke = null; if (!spec.fill) { - baseFill = config.symbolBaseFillColor; - baseStroke = config.symbolBaseStrokeColor; - } - addEncoders(encode, { - fill: _('symbolFillColor', baseFill), - shape: _('symbolType'), - size: _('symbolSize'), - stroke: _('symbolStrokeColor', baseStroke), - strokeDash: _('symbolDash'), - strokeDashOffset: _('symbolDashOffset'), - strokeWidth: _('symbolStrokeWidth') + baseFill = config.symbolBaseFillColor; + baseStroke = config.symbolBaseStrokeColor; + } + addEncoders(encode2, { + fill: _("symbolFillColor", baseFill), + shape: _("symbolType"), + size: _("symbolSize"), + stroke: _("symbolStrokeColor", baseStroke), + strokeDash: _("symbolDash"), + strokeDashOffset: _("symbolDashOffset"), + strokeWidth: _("symbolStrokeWidth") }, { - // update - opacity: _('symbolOpacity') + // update + opacity: _("symbolOpacity") }); - LegendScales.forEach((scale)=>{ - if (spec[scale]) update[scale] = enter[scale] = { - scale: spec[scale], - field: Value + LegendScales.forEach((scale2) => { + if (spec[scale2]) { + update2[scale2] = enter[scale2] = { + scale: spec[scale2], + field: Value }; + } }); - const symbols = guideMark({ - type: SymbolMark, - role: LegendSymbolRole, - key: Value, - from: valueRef, - clip: height ? true : undefined, - encode + const symbols2 = guideMark({ + type: SymbolMark, + role: LegendSymbolRole, + key: Value, + from: valueRef, + clip: height2 ? true : void 0, + encode: encode2 }, userEncode.symbols); - // -- LEGEND LABELS -- const labelOffset = encoder(symbolOffset); - labelOffset.offset = _('labelOffset'); - encode = { - enter: enter = { - opacity: zero, - x: { - signal: xSignal, - offset: labelOffset - }, - y: yEncode + labelOffset.offset = _("labelOffset"); + encode2 = { + enter: enter = { + opacity: zero, + x: { + signal: xSignal, + offset: labelOffset }, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y + y: yEncode + }, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero - } - }; - addEncoders(encode, { - align: _('labelAlign'), - baseline: _('labelBaseline'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontStyle: _('labelFontStyle'), - fontWeight: _('labelFontWeight'), - limit: _('labelLimit') + x: enter.x, + y: enter.y + }, + exit: { + opacity: zero + } + }; + addEncoders(encode2, { + align: _("labelAlign"), + baseline: _("labelBaseline"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontStyle: _("labelFontStyle"), + fontWeight: _("labelFontWeight"), + limit: _("labelLimit") }); const labels = guideMark({ - type: TextMark, - role: LegendLabelRole, - style: GuideLabelStyle, - key: Value, - from: valueRef, - encode + type: TextMark, + role: LegendLabelRole, + style: GuideLabelStyle, + key: Value, + from: valueRef, + encode: encode2 }, userEncode.labels); - // -- LEGEND ENTRY GROUPS -- - encode = { - enter: { - noBound: { - value: !height - }, - // ignore width/height in bounds calc - width: zero, - height: height ? encoder(height) : zero, - opacity: zero - }, - exit: { - opacity: zero + encode2 = { + enter: { + noBound: { + value: !height2 + }, + // ignore width/height in bounds calc + width: zero, + height: height2 ? encoder(height2) : zero, + opacity: zero + }, + exit: { + opacity: zero + }, + update: update2 = { + opacity: one, + row: { + signal: null }, - update: update = { - opacity: one, - row: { - signal: null - }, - column: { - signal: null - } + column: { + signal: null } + } }; - // annotate and sort groups to ensure correct ordering if (_.isVertical(true)) { - nrows = `ceil(item.mark.items.length / ${ncols})`; - update.row.signal = `${index}%${nrows}`; - update.column.signal = `floor(${index} / ${nrows})`; - sort = { - field: [ - 'row', - index - ] - }; + nrows = `ceil(item.mark.items.length / ${ncols})`; + update2.row.signal = `${index2}%${nrows}`; + update2.column.signal = `floor(${index2} / ${nrows})`; + sort2 = { + field: ["row", index2] + }; } else { - update.row.signal = `floor(${index} / ${ncols})`; - update.column.signal = `${index} % ${ncols}`; - sort = { - field: index - }; + update2.row.signal = `floor(${index2} / ${ncols})`; + update2.column.signal = `${index2} % ${ncols}`; + sort2 = { + field: index2 + }; } - // handle zero column case (implies infinite columns) - update.column.signal = `(${columns})?${update.column.signal}:${index}`; - // facet legend entries into sub-groups + update2.column.signal = `(${columns})?${update2.column.signal}:${index2}`; dataRef = { - facet: { - data: dataRef, - name: 'value', - groupby: Index - } + facet: { + data: dataRef, + name: "value", + groupby: Index + } }; return guideGroup({ - role: ScopeRole, - from: dataRef, - encode: extendEncode(encode, entries, Skip), - marks: [ - symbols, - labels - ], - name, - interactive, - sort + role: ScopeRole, + from: dataRef, + encode: extendEncode(encode2, entries, Skip), + marks: [symbols2, labels], + name, + interactive: interactive2, + sort: sort2 }); -} -function legendSymbolLayout(spec, config) { + } + function legendSymbolLayout(spec, config) { const _ = lookup(spec, config); - // layout parameters for legend entries return { - align: _('gridAlign'), - columns: _.entryColumns(), - center: { - row: true, - column: false - }, - padding: { - row: _('rowPadding'), - column: _('columnPadding') - } + align: _("gridAlign"), + columns: _.entryColumns(), + center: { + row: true, + column: false + }, + padding: { + row: _("rowPadding"), + column: _("columnPadding") + } }; -} -// expression logic for align, anchor, angle, and baseline calculation -const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; -function legendTitle(spec, config, userEncode, dataRef) { + } + const isL = 'item.orient === "left"', isR = 'item.orient === "right"', isLR = `(${isL} || ${isR})`, isVG = `datum.vgrad && ${isLR}`, baseline = anchorExpr('"top"', '"bottom"', '"middle"'), alignFlip = anchorExpr('"right"', '"left"', '"center"'), exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`, exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`, exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`, exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`; + function legendTitle(spec, config, userEncode, dataRef) { const _ = lookup(spec, config); - const encode = { - enter: { - opacity: zero - }, - update: { - opacity: one, - x: { - field: { - group: 'padding' - } - }, - y: { - field: { - group: 'padding' - } - } - }, - exit: { - opacity: zero + const encode2 = { + enter: { + opacity: zero + }, + update: { + opacity: one, + x: { + field: { + group: "padding" + } + }, + y: { + field: { + group: "padding" + } } + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - orient: _('titleOrient'), - _anchor: _('titleAnchor'), - anchor: { - signal: exprAnchor - }, - angle: { - signal: exprAngle - }, - align: { - signal: exprAlign - }, - baseline: { - signal: exprBaseline - }, - text: spec.title, - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + addEncoders(encode2, { + orient: _("titleOrient"), + _anchor: _("titleAnchor"), + anchor: { + signal: exprAnchor + }, + angle: { + signal: exprAngle + }, + align: { + signal: exprAlign + }, + baseline: { + signal: exprBaseline + }, + text: spec.title, + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - baseline: _('titleBaseline') + // require update + align: _("titleAlign"), + baseline: _("titleBaseline") }); return guideMark({ - type: TextMark, - role: LegendTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: LegendTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function clip(clip, scope) { - let expr; - if ((0, _vegaUtil.isObject)(clip)) { - if (clip.signal) expr = clip.signal; - else if (clip.path) expr = 'pathShape(' + param(clip.path) + ')'; - else if (clip.sphere) expr = 'geoShape(' + param(clip.sphere) + ', {type: "Sphere"})'; - } - return expr ? scope.signalRef(expr) : !!clip; -} -function param(value) { - return (0, _vegaUtil.isObject)(value) && value.signal ? value.signal : (0, _vegaUtil.stringValue)(value); -} -function getRole(spec) { - const role = spec.role || ''; - return role.startsWith('axis') || role.startsWith('legend') || role.startsWith('title') ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; -} -function definition(spec) { + } + function clip(clip2, scope) { + let expr2; + if (isObject$1(clip2)) { + if (clip2.signal) { + expr2 = clip2.signal; + } else if (clip2.path) { + expr2 = "pathShape(" + param(clip2.path) + ")"; + } else if (clip2.sphere) { + expr2 = "geoShape(" + param(clip2.sphere) + ', {type: "Sphere"})'; + } + } + return expr2 ? scope.signalRef(expr2) : !!clip2; + } + function param(value2) { + return isObject$1(value2) && value2.signal ? value2.signal : $(value2); + } + function getRole(spec) { + const role = spec.role || ""; + return role.startsWith("axis") || role.startsWith("legend") || role.startsWith("title") ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole; + } + function definition(spec) { return { - marktype: spec.type, - name: spec.name || undefined, - role: spec.role || getRole(spec), - zindex: +spec.zindex || undefined, - aria: spec.aria, - description: spec.description - }; -} -function interactive(spec, scope) { + marktype: spec.type, + name: spec.name || void 0, + role: spec.role || getRole(spec), + zindex: +spec.zindex || void 0, + aria: spec.aria, + description: spec.description + }; + } + function interactive(spec, scope) { return spec && spec.signal ? scope.signalRef(spec.signal) : spec === false ? false : true; -} -/** - * Parse a data transform specification. - */ function parseTransform(spec, scope) { - const def = (0, _vegaDataflow.definition)(spec.type); - if (!def) (0, _vegaUtil.error)('Unrecognized transform type: ' + (0, _vegaUtil.stringValue)(spec.type)); - const t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope)); + } + function parseTransform(spec, scope) { + const def2 = definition$1(spec.type); + if (!def2) error("Unrecognized transform type: " + $(spec.type)); + const t = entry(def2.type.toLowerCase(), null, parseParameters(def2, spec, scope)); if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t)); - t.metadata = def.metadata || {}; + t.metadata = def2.metadata || {}; return t; -} -/** - * Parse all parameters of a data transform. - */ function parseParameters(def, spec, scope) { - const params = {}, n = def.params.length; - for(let i = 0; i < n; ++i){ - const pdef = def.params[i]; - params[pdef.name] = parseParameter(pdef, spec, scope); - } - return params; -} -/** - * Parse a data transform parameter. - */ function parseParameter(def, spec, scope) { - const type = def.type, value = spec[def.name]; - if (type === 'index') return parseIndexParameter(def, spec, scope); - else if (value === undefined) { - if (def.required) (0, _vegaUtil.error)('Missing required ' + (0, _vegaUtil.stringValue)(spec.type) + ' parameter: ' + (0, _vegaUtil.stringValue)(def.name)); - return; - } else if (type === 'param') return parseSubParameters(def, spec, scope); - else if (type === 'projection') return scope.projectionRef(spec[def.name]); - return def.array && !isSignal(value) ? value.map((v)=>parameterValue(def, v, scope)) : parameterValue(def, value, scope); -} -/** - * Parse a single parameter value. - */ function parameterValue(def, value, scope) { - const type = def.type; - if (isSignal(value)) return isExpr(type) ? (0, _vegaUtil.error)('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal); - else { - const expr = def.expr || isField(type); - return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : isExpr(type) ? (0, _vegaFunctions.parseExpression)(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value; - } -} -/** - * Parse parameter for accessing an index of another data set. - */ function parseIndexParameter(def, spec, scope) { - if (!(0, _vegaUtil.isString)(spec.from)) (0, _vegaUtil.error)('Lookup "from" parameter must be a string literal.'); + } + function parseParameters(def2, spec, scope) { + const params2 = {}, n = def2.params.length; + for (let i = 0; i < n; ++i) { + const pdef = def2.params[i]; + params2[pdef.name] = parseParameter(pdef, spec, scope); + } + return params2; + } + function parseParameter(def2, spec, scope) { + const type2 = def2.type, value2 = spec[def2.name]; + if (type2 === "index") { + return parseIndexParameter(def2, spec, scope); + } else if (value2 === void 0) { + if (def2.required) { + error("Missing required " + $(spec.type) + " parameter: " + $(def2.name)); + } + return; + } else if (type2 === "param") { + return parseSubParameters(def2, spec, scope); + } else if (type2 === "projection") { + return scope.projectionRef(spec[def2.name]); + } + return def2.array && !isSignal(value2) ? value2.map((v) => parameterValue(def2, v, scope)) : parameterValue(def2, value2, scope); + } + function parameterValue(def2, value2, scope) { + const type2 = def2.type; + if (isSignal(value2)) { + return isExpr(type2) ? error("Expression references can not be signals.") : isField(type2) ? scope.fieldRef(value2) : isCompare(type2) ? scope.compareRef(value2) : scope.signalRef(value2.signal); + } else { + const expr2 = def2.expr || isField(type2); + return expr2 && outerExpr(value2) ? scope.exprRef(value2.expr, value2.as) : expr2 && outerField(value2) ? fieldRef$1(value2.field, value2.as) : isExpr(type2) ? parser(value2, scope) : isData(type2) ? ref(scope.getData(value2).values) : isField(type2) ? fieldRef$1(value2) : isCompare(type2) ? scope.compareRef(value2) : value2; + } + } + function parseIndexParameter(def2, spec, scope) { + if (!isString(spec.from)) { + error('Lookup "from" parameter must be a string literal.'); + } return scope.getData(spec.from).lookupRef(scope, spec.key); -} -/** - * Parse a parameter that contains one or more sub-parameter objects. - */ function parseSubParameters(def, spec, scope) { - const value = spec[def.name]; - if (def.array) { - if (!(0, _vegaUtil.isArray)(value)) // signals not allowed! - (0, _vegaUtil.error)('Expected an array of sub-parameters. Instead: ' + (0, _vegaUtil.stringValue)(value)); - return value.map((v)=>parseSubParameter(def, v, scope)); - } else return parseSubParameter(def, value, scope); -} -/** - * Parse a sub-parameter object. - */ function parseSubParameter(def, value, scope) { - const n = def.params.length; + } + function parseSubParameters(def2, spec, scope) { + const value2 = spec[def2.name]; + if (def2.array) { + if (!isArray(value2)) { + error("Expected an array of sub-parameters. Instead: " + $(value2)); + } + return value2.map((v) => parseSubParameter(def2, v, scope)); + } else { + return parseSubParameter(def2, value2, scope); + } + } + function parseSubParameter(def2, value2, scope) { + const n = def2.params.length; let pdef; - // loop over defs to find matching key - for(let i = 0; i < n; ++i){ - pdef = def.params[i]; - for(const k in pdef.key)if (pdef.key[k] !== value[k]) { - pdef = null; - break; + for (let i = 0; i < n; ++i) { + pdef = def2.params[i]; + for (const k in pdef.key) { + if (pdef.key[k] !== value2[k]) { + pdef = null; + break; } - if (pdef) break; - } - // raise error if matching key not found - if (!pdef) (0, _vegaUtil.error)('Unsupported parameter: ' + (0, _vegaUtil.stringValue)(value)); - // parse params, create Params transform, return ref - const params = (0, _vegaUtil.extend)(parseParameters(pdef, value, scope), pdef.key); - return ref(scope.add(Params(params))); -} -// -- Utilities ----- -const outerExpr = (_)=>_ && _.expr; -const outerField = (_)=>_ && _.field; -const isData = (_)=>_ === 'data'; -const isExpr = (_)=>_ === 'expr'; -const isField = (_)=>_ === 'field'; -const isCompare = (_)=>_ === 'compare'; -function parseData$1(from, group, scope) { - let facet, key, op, dataRef, parent; - // if no source data, generate singleton datum - if (!from) dataRef = ref(scope.add(Collect(null, [ - {} - ]))); - else if (facet = from.facet) { - if (!group) (0, _vegaUtil.error)('Only group marks can be faceted.'); - // use pre-faceted source data, if available - if (facet.field != null) dataRef = parent = getDataRef(facet, scope); - else { - // generate facet aggregates if no direct data specification - if (!from.data) { - op = parseTransform((0, _vegaUtil.extend)({ - type: 'aggregate', - groupby: (0, _vegaUtil.array)(facet.groupby) - }, facet.aggregate), scope); - op.params.key = scope.keyRef(facet.groupby); - op.params.pulse = getDataRef(facet, scope); - dataRef = parent = ref(scope.add(op)); - } else parent = ref(scope.getData(from.data).aggregate); - key = scope.keyRef(facet.groupby, true); - } - } - // if not yet defined, get source data reference - if (!dataRef) dataRef = getDataRef(from, scope); + } + if (pdef) break; + } + if (!pdef) error("Unsupported parameter: " + $(value2)); + const params2 = extend$1(parseParameters(pdef, value2, scope), pdef.key); + return ref(scope.add(Params(params2))); + } + const outerExpr = (_) => _ && _.expr; + const outerField = (_) => _ && _.field; + const isData = (_) => _ === "data"; + const isExpr = (_) => _ === "expr"; + const isField = (_) => _ === "field"; + const isCompare = (_) => _ === "compare"; + function parseData$1(from, group2, scope) { + let facet, key2, op, dataRef, parent; + if (!from) { + dataRef = ref(scope.add(Collect(null, [{}]))); + } else if (facet = from.facet) { + if (!group2) error("Only group marks can be faceted."); + if (facet.field != null) { + dataRef = parent = getDataRef(facet, scope); + } else { + if (!from.data) { + op = parseTransform(extend$1({ + type: "aggregate", + groupby: array$5(facet.groupby) + }, facet.aggregate), scope); + op.params.key = scope.keyRef(facet.groupby); + op.params.pulse = getDataRef(facet, scope); + dataRef = parent = ref(scope.add(op)); + } else { + parent = ref(scope.getData(from.data).aggregate); + } + key2 = scope.keyRef(facet.groupby, true); + } + } + if (!dataRef) { + dataRef = getDataRef(from, scope); + } return { - key: key, - pulse: dataRef, - parent: parent + key: key2, + pulse: dataRef, + parent }; -} -function getDataRef(from, scope) { + } + function getDataRef(from, scope) { return from.$ref ? from : from.data && from.data.$ref ? from.data : ref(scope.getData(from.data).output); -} -function DataScope(scope, input, output, values, aggr) { - this.scope = scope; // parent scope object - this.input = input; // first operator in pipeline (tuple input) - this.output = output; // last operator in pipeline (tuple output) - this.values = values; // operator for accessing tuples (but not tuple flow) - // last aggregate in transform pipeline + } + function DataScope(scope, input, output2, values2, aggr) { + this.scope = scope; + this.input = input; + this.output = output2; + this.values = values2; this.aggregate = aggr; - // lookup table of field indices this.index = {}; -} -DataScope.fromEntries = function(scope, entries) { - const n = entries.length, values = entries[n - 1], output = entries[n - 2]; + } + DataScope.fromEntries = function(scope, entries) { + const n = entries.length, values2 = entries[n - 1], output2 = entries[n - 2]; let input = entries[0], aggr = null, i = 1; - if (input && input.type === 'load') input = entries[1]; - // add operator entries to this scope, wire up pulse chain + if (input && input.type === "load") { + input = entries[1]; + } scope.add(entries[0]); - for(; i < n; ++i){ - entries[i].params.pulse = ref(entries[i - 1]); - scope.add(entries[i]); - if (entries[i].type === 'aggregate') aggr = entries[i]; - } - return new DataScope(scope, input, output, values, aggr); -}; -function fieldKey(field) { - return (0, _vegaUtil.isString)(field) ? field : null; -} -function addSortField(scope, p, sort) { - const as = aggrField(sort.op, sort.field); + for (; i < n; ++i) { + entries[i].params.pulse = ref(entries[i - 1]); + scope.add(entries[i]); + if (entries[i].type === "aggregate") aggr = entries[i]; + } + return new DataScope(scope, input, output2, values2, aggr); + }; + function fieldKey(field2) { + return isString(field2) ? field2 : null; + } + function addSortField(scope, p, sort2) { + const as = aggrField(sort2.op, sort2.field); let s; - if (p.ops) for(let i = 0, n = p.as.length; i < n; ++i){ + if (p.ops) { + for (let i = 0, n = p.as.length; i < n; ++i) { if (p.as[i] === as) return; + } + } else { + p.ops = ["count"]; + p.fields = [null]; + p.as = ["count"]; } - else { - p.ops = [ - 'count' - ]; - p.fields = [ - null - ]; - p.as = [ - 'count' - ]; - } - if (sort.op) { - p.ops.push((s = sort.op.signal) ? scope.signalRef(s) : sort.op); - p.fields.push(scope.fieldRef(sort.field)); - p.as.push(as); - } -} -function cache(scope, ds, name, optype, field, counts, index) { - const cache = ds[name] || (ds[name] = {}), sort = sortKey(counts); - let k = fieldKey(field), v, op; + if (sort2.op) { + p.ops.push((s = sort2.op.signal) ? scope.signalRef(s) : sort2.op); + p.fields.push(scope.fieldRef(sort2.field)); + p.as.push(as); + } + } + function cache(scope, ds, name, optype, field2, counts, index2) { + const cache2 = ds[name] || (ds[name] = {}), sort2 = sortKey(counts); + let k = fieldKey(field2), v, op; if (k != null) { - scope = ds.scope; - k = k + (sort ? '|' + sort : ''); - v = cache[k]; + scope = ds.scope; + k = k + (sort2 ? "|" + sort2 : ""); + v = cache2[k]; } if (!v) { - const params = counts ? { - field: keyFieldRef, - pulse: ds.countsRef(scope, field, counts) - } : { - field: scope.fieldRef(field), - pulse: ref(ds.output) - }; - if (sort) params.sort = scope.sortRef(counts); - op = scope.add(entry(optype, undefined, params)); - if (index) ds.index[field] = op; - v = ref(op); - if (k != null) cache[k] = v; + const params2 = counts ? { + field: keyFieldRef, + pulse: ds.countsRef(scope, field2, counts) + } : { + field: scope.fieldRef(field2), + pulse: ref(ds.output) + }; + if (sort2) params2.sort = scope.sortRef(counts); + op = scope.add(entry(optype, void 0, params2)); + if (index2) ds.index[field2] = op; + v = ref(op); + if (k != null) cache2[k] = v; } return v; -} -DataScope.prototype = { - countsRef (scope, field, sort) { - const ds = this, cache = ds.counts || (ds.counts = {}), k = fieldKey(field); - let v, a, p; - if (k != null) { - scope = ds.scope; - v = cache[k]; - } - if (!v) { - p = { - groupby: scope.fieldRef(field, 'key'), - pulse: ref(ds.output) - }; - if (sort && sort.field) addSortField(scope, p, sort); - a = scope.add(Aggregate(p)); - v = scope.add(Collect({ - pulse: ref(a) - })); - v = { - agg: a, - ref: ref(v) - }; - if (k != null) cache[k] = v; - } else if (sort && sort.field) addSortField(scope, v.agg.params, sort); - return v.ref; + } + DataScope.prototype = { + countsRef(scope, field2, sort2) { + const ds = this, cache2 = ds.counts || (ds.counts = {}), k = fieldKey(field2); + let v, a2, p; + if (k != null) { + scope = ds.scope; + v = cache2[k]; + } + if (!v) { + p = { + groupby: scope.fieldRef(field2, "key"), + pulse: ref(ds.output) + }; + if (sort2 && sort2.field) addSortField(scope, p, sort2); + a2 = scope.add(Aggregate(p)); + v = scope.add(Collect({ + pulse: ref(a2) + })); + v = { + agg: a2, + ref: ref(v) + }; + if (k != null) cache2[k] = v; + } else if (sort2 && sort2.field) { + addSortField(scope, v.agg.params, sort2); + } + return v.ref; }, - tuplesRef () { - return ref(this.values); + tuplesRef() { + return ref(this.values); }, - extentRef (scope, field) { - return cache(scope, this, 'extent', 'extent', field, false); + extentRef(scope, field2) { + return cache(scope, this, "extent", "extent", field2, false); }, - domainRef (scope, field) { - return cache(scope, this, 'domain', 'values', field, false); + domainRef(scope, field2) { + return cache(scope, this, "domain", "values", field2, false); }, - valuesRef (scope, field, sort) { - return cache(scope, this, 'vals', 'values', field, sort || true); + valuesRef(scope, field2, sort2) { + return cache(scope, this, "vals", "values", field2, sort2 || true); }, - lookupRef (scope, field) { - return cache(scope, this, 'lookup', 'tupleindex', field, false); + lookupRef(scope, field2) { + return cache(scope, this, "lookup", "tupleindex", field2, false); }, - indataRef (scope, field) { - return cache(scope, this, 'indata', 'tupleindex', field, true, true); + indataRef(scope, field2) { + return cache(scope, this, "indata", "tupleindex", field2, true, true); } -}; -function parseFacet(spec, scope, group) { - const facet = spec.from.facet, name = facet.name, data = getDataRef(facet, scope); + }; + function parseFacet(spec, scope, group2) { + const facet = spec.from.facet, name = facet.name, data2 = getDataRef(facet, scope); let op; - if (!facet.name) (0, _vegaUtil.error)('Facet must have a name: ' + (0, _vegaUtil.stringValue)(facet)); - if (!facet.data) (0, _vegaUtil.error)('Facet must reference a data set: ' + (0, _vegaUtil.stringValue)(facet)); - if (facet.field) op = scope.add(PreFacet({ + if (!facet.name) { + error("Facet must have a name: " + $(facet)); + } + if (!facet.data) { + error("Facet must reference a data set: " + $(facet)); + } + if (facet.field) { + op = scope.add(PreFacet({ field: scope.fieldRef(facet.field), - pulse: data - })); - else if (facet.groupby) op = scope.add(Facet({ + pulse: data2 + })); + } else if (facet.groupby) { + op = scope.add(Facet({ key: scope.keyRef(facet.groupby), - group: ref(scope.proxy(group.parent)), - pulse: data - })); - else (0, _vegaUtil.error)('Facet must specify groupby or field: ' + (0, _vegaUtil.stringValue)(facet)); - // initialize facet subscope - const subscope = scope.fork(), source = subscope.add(Collect()), values = subscope.add(Sieve({ - pulse: ref(source) + group: ref(scope.proxy(group2.parent)), + pulse: data2 + })); + } else { + error("Facet must specify groupby or field: " + $(facet)); + } + const subscope = scope.fork(), source2 = subscope.add(Collect()), values2 = subscope.add(Sieve({ + pulse: ref(source2) })); - subscope.addData(name, new DataScope(subscope, source, source, values)); - subscope.addSignal('parent', null); - // parse faceted subflow + subscope.addData(name, new DataScope(subscope, source2, source2, values2)); + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() + $subflow: subscope.parse(spec).toRuntime() }; -} -function parseSubflow(spec, scope, input) { + } + function parseSubflow(spec, scope, input) { const op = scope.add(PreFacet({ - pulse: input.pulse + pulse: input.pulse })), subscope = scope.fork(); subscope.add(Sieve()); - subscope.addSignal('parent', null); - // parse group mark subflow + subscope.addSignal("parent", null); op.params.subflow = { - $subflow: subscope.parse(spec).toRuntime() - }; -} -function parseTrigger(spec, scope, name) { - const remove = spec.remove, insert = spec.insert, toggle = spec.toggle, modify = spec.modify, values = spec.values, op = scope.add(operator()); - const update = 'if(' + spec.trigger + ',modify("' + name + '",' + [ - insert, - remove, - toggle, - modify, - values - ].map((_)=>_ == null ? 'null' : _).join(',') + '),0)'; - const expr = (0, _vegaFunctions.parseExpression)(update, scope); - op.update = expr.$expr; - op.params = expr.$params; -} -function parseMark(spec, scope) { - const role = getRole(spec), group = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; - let layout = spec.layout || role === ScopeRole || role === FrameRole, ops, op, store, enc, name, layoutRef, boundRef; + $subflow: subscope.parse(spec).toRuntime() + }; + } + function parseTrigger(spec, scope, name) { + const remove2 = spec.remove, insert2 = spec.insert, toggle = spec.toggle, modify2 = spec.modify, values2 = spec.values, op = scope.add(operator()); + const update2 = "if(" + spec.trigger + ',modify("' + name + '",' + [insert2, remove2, toggle, modify2, values2].map((_) => _ == null ? "null" : _).join(",") + "),0)"; + const expr2 = parser(update2, scope); + op.update = expr2.$expr; + op.params = expr2.$params; + } + function parseMark(spec, scope) { + const role = getRole(spec), group2 = spec.type === GroupMark, facet = spec.from && spec.from.facet, overlap = spec.overlap; + let layout = spec.layout || role === ScopeRole || role === FrameRole, ops2, op, store, enc, name, layoutRef, boundRef; const nested = role === MarkRole || layout || facet; - // resolve input data - const input = parseData$1(spec.from, group, scope); - // data join to map tuples to visual items + const input = parseData$1(spec.from, group2, scope); op = scope.add(DataJoin({ - key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined), - pulse: input.pulse, - clean: !group + key: input.key || (spec.key ? fieldRef$1(spec.key) : void 0), + pulse: input.pulse, + clean: !group2 })); const joinRef = ref(op); - // collect visual items op = store = scope.add(Collect({ - pulse: joinRef + pulse: joinRef })); - // connect visual items to scenegraph op = scope.add(Mark({ - markdef: definition(spec), - interactive: interactive(spec.interactive, scope), - clip: clip(spec.clip, scope), - context: { - $context: true - }, - groups: scope.lookup(), - parent: scope.signals.parent ? scope.signalRef('parent') : null, - index: scope.markpath(), - pulse: ref(op) + markdef: definition(spec), + interactive: interactive(spec.interactive, scope), + clip: clip(spec.clip, scope), + context: { + $context: true + }, + groups: scope.lookup(), + parent: scope.signals.parent ? scope.signalRef("parent") : null, + index: scope.markpath(), + pulse: ref(op) })); const markRef = ref(op); - // add visual encoders op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, { - mod: false, - pulse: markRef + mod: false, + pulse: markRef }))); - // monitor parent marks to propagate changes op.params.parent = scope.encode(); - // add post-encoding transforms, if defined - if (spec.transform) spec.transform.forEach((_)=>{ - const tx = parseTransform(_, scope), md = tx.metadata; - if (md.generates || md.changes) (0, _vegaUtil.error)('Mark transforms should not generate new data.'); - if (!md.nomod) enc.params.mod = true; // update encode mod handling - tx.params.pulse = ref(op); - scope.add(op = tx); - }); - // if item sort specified, perform post-encoding - if (spec.sort) op = scope.add(SortItems({ + if (spec.transform) { + spec.transform.forEach((_) => { + const tx2 = parseTransform(_, scope), md2 = tx2.metadata; + if (md2.generates || md2.changes) { + error("Mark transforms should not generate new data."); + } + if (!md2.nomod) enc.params.mod = true; + tx2.params.pulse = ref(op); + scope.add(op = tx2); + }); + } + if (spec.sort) { + op = scope.add(SortItems({ sort: scope.compareRef(spec.sort), pulse: ref(op) - })); + })); + } const encodeRef = ref(op); - // add view layout operator if needed if (facet || layout) { - layout = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - mark: markRef, - pulse: encodeRef - })); - layoutRef = ref(layout); - } - // compute bounding boxes - const bound = scope.add(Bound({ + layout = scope.add(ViewLayout({ + layout: scope.objectProperty(spec.layout), + legends: scope.legends, mark: markRef, - pulse: layoutRef || encodeRef + pulse: encodeRef + })); + layoutRef = ref(layout); + } + const bound2 = scope.add(Bound({ + mark: markRef, + pulse: layoutRef || encodeRef })); - boundRef = ref(bound); - // if group mark, recurse to parse nested content - if (group) { - // juggle layout & bounds to ensure they run *after* any faceting transforms - if (nested) { - ops = scope.operators; - ops.pop(); - if (layout) ops.pop(); - } - scope.pushState(encodeRef, layoutRef || boundRef, joinRef); - facet ? parseFacet(spec, scope, input) // explicit facet - : nested ? parseSubflow(spec, scope, input) // standard mark group - : scope.parse(spec); // guide group, we can avoid nested scopes - scope.popState(); - if (nested) { - if (layout) ops.push(layout); - ops.push(bound); - } - } - // if requested, add overlap removal transform - if (overlap) boundRef = parseOverlap(overlap, boundRef, scope); - // render / sieve items + boundRef = ref(bound2); + if (group2) { + if (nested) { + ops2 = scope.operators; + ops2.pop(); + if (layout) ops2.pop(); + } + scope.pushState(encodeRef, layoutRef || boundRef, joinRef); + facet ? parseFacet(spec, scope, input) : nested ? parseSubflow(spec, scope, input) : scope.parse(spec); + scope.popState(); + if (nested) { + if (layout) ops2.push(layout); + ops2.push(bound2); + } + } + if (overlap) { + boundRef = parseOverlap(overlap, boundRef, scope); + } const render = scope.add(Render({ - pulse: boundRef + pulse: boundRef })), sieve = scope.add(Sieve({ - pulse: ref(render) - }, undefined, scope.parent())); - // if mark is named, make accessible as reactive geometry - // add trigger updates if defined + pulse: ref(render) + }, void 0, scope.parent())); if (spec.name != null) { - name = spec.name; - scope.addData(name, new DataScope(scope, store, render, sieve)); - if (spec.on) spec.on.forEach((on)=>{ - if (on.insert || on.remove || on.toggle) (0, _vegaUtil.error)('Marks only support modify triggers.'); - parseTrigger(on, scope, name); - }); + name = spec.name; + scope.addData(name, new DataScope(scope, store, render, sieve)); + if (spec.on) spec.on.forEach((on2) => { + if (on2.insert || on2.remove || on2.toggle) { + error("Marks only support modify triggers."); + } + parseTrigger(on2, scope, name); + }); } -} -function parseOverlap(overlap, source, scope) { - const method = overlap.method, bound = overlap.bound, sep = overlap.separation; - const params = { - separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, - method: isSignal(method) ? scope.signalRef(method.signal) : method, - pulse: source - }; - if (overlap.order) params.sort = scope.compareRef({ + } + function parseOverlap(overlap, source2, scope) { + const method2 = overlap.method, bound2 = overlap.bound, sep = overlap.separation; + const params2 = { + separation: isSignal(sep) ? scope.signalRef(sep.signal) : sep, + method: isSignal(method2) ? scope.signalRef(method2.signal) : method2, + pulse: source2 + }; + if (overlap.order) { + params2.sort = scope.compareRef({ field: overlap.order - }); - if (bound) { - const tol = bound.tolerance; - params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; - params.boundScale = scope.scaleRef(bound.scale); - params.boundOrient = bound.orient; - } - return ref(scope.add(Overlap(params))); -} -function parseLegend(spec, scope) { - const config = scope.config.legend, encode = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode.legend || {}, name = legendEncode.name || undefined, interactive = legendEncode.interactive, style = legendEncode.style, scales = {}; - let scale = 0, entryLayout, params, children; - // resolve scales and 'canonical' scale name - LegendScales.forEach((s)=>spec[s] ? (scales[s] = spec[s], scale = scale || spec[s]) : 0); - if (!scale) (0, _vegaUtil.error)('Missing valid scale for legend.'); - // resolve legend type (symbol, gradient, or discrete gradient) - const type = legendType(spec, scope.scaleType(scale)); - // single-element data source for legend group - const datum = { - title: spec.title != null, - scales: scales, - type: type, - vgrad: type !== 'symbol' && _.isVertical() - }; - const dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // encoding properties for legend entry sub-group + }); + } + if (bound2) { + const tol = bound2.tolerance; + params2.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol; + params2.boundScale = scope.scaleRef(bound2.scale); + params2.boundOrient = bound2.orient; + } + return ref(scope.add(Overlap(params2))); + } + function parseLegend(spec, scope) { + const config = scope.config.legend, encode2 = spec.encode || {}, _ = lookup(spec, config), legendEncode = encode2.legend || {}, name = legendEncode.name || void 0, interactive2 = legendEncode.interactive, style2 = legendEncode.style, scales2 = {}; + let scale2 = 0, entryLayout, params2, children2; + LegendScales.forEach((s) => spec[s] ? (scales2[s] = spec[s], scale2 = scale2 || spec[s]) : 0); + if (!scale2) error("Missing valid scale for legend."); + const type2 = legendType(spec, scope.scaleType(scale2)); + const datum2 = { + title: spec.title != null, + scales: scales2, + type: type2, + vgrad: type2 !== "symbol" && _.isVertical() + }; + const dataRef = ref(scope.add(Collect(null, [datum2]))); const entryEncode = { - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } + enter: { + x: { + value: 0 + }, + y: { + value: 0 } + } }; - // data source for legend values - const entryRef = ref(scope.add(LegendEntries(params = { - type: type, - scale: scope.scaleRef(scale), - count: scope.objectProperty(_('tickCount')), - limit: scope.property(_('symbolLimit')), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + const entryRef = ref(scope.add(LegendEntries(params2 = { + type: type2, + scale: scope.scaleRef(scale2), + count: scope.objectProperty(_("tickCount")), + limit: scope.property(_("symbolLimit")), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // continuous gradient legend - if (type === Gradient) { - children = [ - legendGradient(spec, scale, config, encode.gradient), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - // adjust default tick count based on the gradient length - params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); - } else if (type === Discrete) children = [ - legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), - legendGradientLabels(spec, config, encode.labels, entryRef) - ]; - else { - // determine legend symbol group layout - entryLayout = legendSymbolLayout(spec, config); - children = [ - legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns)) - ]; - // pass symbol size information to legend entry generator - params.size = sizeExpression(spec, scope, children[0].marks); - } - // generate legend marks - children = [ - guideGroup({ - role: LegendEntryRole, - from: dataRef, - encode: entryEncode, - marks: children, - layout: entryLayout, - interactive - }) - ]; - // include legend title if defined - if (datum.title) children.push(legendTitle(spec, config, encode.title, dataRef)); - // parse legend specification + if (type2 === Gradient) { + children2 = [legendGradient(spec, scale2, config, encode2.gradient), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + params2.count = params2.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`); + } else if (type2 === Discrete) { + children2 = [legendGradientDiscrete(spec, scale2, config, encode2.gradient, entryRef), legendGradientLabels(spec, config, encode2.labels, entryRef)]; + } else { + entryLayout = legendSymbolLayout(spec, config); + children2 = [legendSymbolGroups(spec, config, encode2, entryRef, deref(entryLayout.columns))]; + params2.size = sizeExpression(spec, scope, children2[0].marks); + } + children2 = [guideGroup({ + role: LegendEntryRole, + from: dataRef, + encode: entryEncode, + marks: children2, + layout: entryLayout, + interactive: interactive2 + })]; + if (datum2.title) { + children2.push(legendTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: LegendRole, - from: dataRef, - encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: LegendRole, + from: dataRef, + encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function legendType(spec, scaleType) { - let type = spec.type || Symbols; - if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) type = (0, _vegaScale.isContinuous)(scaleType) ? Gradient : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Symbols; - return type !== Gradient ? type : (0, _vegaScale.isDiscretizing)(scaleType) ? Discrete : Gradient; -} -function scaleCount(spec) { - return LegendScales.reduce((count, type)=>count + (spec[type] ? 1 : 0), 0); -} -function buildLegendEncode(_, spec, config) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset'), - padding: _('padding'), - titlePadding: _('titlePadding'), - cornerRadius: _('cornerRadius'), - fill: _('fillColor'), - stroke: _('strokeColor'), - strokeWidth: config.strokeWidth, - strokeDash: config.strokeDash, - x: _('legendX'), - y: _('legendY'), - // accessibility support - format: spec.format, - formatType: spec.formatType - }); - return encode; -} -function sizeExpression(spec, scope, marks) { - const size = deref(getChannel('size', spec, marks)), strokeWidth = deref(getChannel('strokeWidth', spec, marks)), fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); - return (0, _vegaFunctions.parseExpression)(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope); -} -function getChannel(name, spec, marks) { + } + function legendType(spec, scaleType) { + let type2 = spec.type || Symbols; + if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) { + type2 = isContinuous(scaleType) ? Gradient : isDiscretizing(scaleType) ? Discrete : Symbols; + } + return type2 !== Gradient ? type2 : isDiscretizing(scaleType) ? Discrete : Gradient; + } + function scaleCount(spec) { + return LegendScales.reduce((count2, type2) => count2 + (spec[type2] ? 1 : 0), 0); + } + function buildLegendEncode(_, spec, config) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset"), + padding: _("padding"), + titlePadding: _("titlePadding"), + cornerRadius: _("cornerRadius"), + fill: _("fillColor"), + stroke: _("strokeColor"), + strokeWidth: config.strokeWidth, + strokeDash: config.strokeDash, + x: _("legendX"), + y: _("legendY"), + // accessibility support + format: spec.format, + formatType: spec.formatType + }); + return encode2; + } + function sizeExpression(spec, scope, marks) { + const size = deref(getChannel("size", spec, marks)), strokeWidth = deref(getChannel("strokeWidth", spec, marks)), fontSize2 = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle)); + return parser(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize2})`, scope); + } + function getChannel(name, spec, marks) { return spec[name] ? `scale("${spec[name]}",datum)` : getEncoding(name, marks[0].encode); -} -function getFontSize(encode, scope, style) { - return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style); -} -const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; -function parseTitle(spec, scope) { - spec = (0, _vegaUtil.isString)(spec) ? { - text: spec + } + function getFontSize(encode2, scope, style2) { + return getEncoding("fontSize", encode2) || getStyle("fontSize", scope, style2); + } + const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`; + function parseTitle(spec, scope) { + spec = isString(spec) ? { + text: spec } : spec; - const _ = lookup(spec, scope.config.title), encode = spec.encode || {}, userEncode = encode.group || {}, name = userEncode.name || undefined, interactive = userEncode.interactive, style = userEncode.style, children = []; - // single-element data source for group title - const datum = {}, dataRef = ref(scope.add(Collect(null, [ - datum - ]))); - // include title text - children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); - // include subtitle text - if (spec.subtitle) children.push(buildSubTitle(spec, _, encode.subtitle, dataRef)); - // parse title specification + const _ = lookup(spec, scope.config.title), encode2 = spec.encode || {}, userEncode = encode2.group || {}, name = userEncode.name || void 0, interactive2 = userEncode.interactive, style2 = userEncode.style, children2 = []; + const datum2 = {}, dataRef = ref(scope.add(Collect(null, [datum2]))); + children2.push(buildTitle(spec, _, titleEncode(spec), dataRef)); + if (spec.subtitle) { + children2.push(buildSubTitle(spec, _, encode2.subtitle, dataRef)); + } return parseMark(guideGroup({ - role: TitleRole, - from: dataRef, - encode: groupEncode(_, userEncode), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: TitleRole, + from: dataRef, + encode: groupEncode(_, userEncode), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -// provide backwards-compatibility for title custom encode; -// the top-level encode block has been *deprecated*. -function titleEncode(spec) { - const encode = spec.encode; - return encode && encode.title || (0, _vegaUtil.extend)({ - name: spec.name, - interactive: spec.interactive, - style: spec.style - }, encode); -} -function groupEncode(_, userEncode) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - anchor: _('anchor'), - align: { - signal: alignExpr$1 - }, - angle: { - signal: angleExpr - }, - limit: _('limit'), - frame: _('frame'), - offset: _('offset') || 0, - padding: _('subtitlePadding') + } + function titleEncode(spec) { + const encode2 = spec.encode; + return encode2 && encode2.title || extend$1({ + name: spec.name, + interactive: spec.interactive, + style: spec.style + }, encode2); + } + function groupEncode(_, userEncode) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + anchor: _("anchor"), + align: { + signal: alignExpr$1 + }, + angle: { + signal: angleExpr + }, + limit: _("limit"), + frame: _("frame"), + offset: _("offset") || 0, + padding: _("subtitlePadding") }); - return extendEncode(encode, userEncode, Skip); -} -function buildTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.text, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + return extendEncode(encode2, userEncode, Skip); + } + function buildTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.text, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('color'), - font: _('font'), - fontSize: _('fontSize'), - fontStyle: _('fontStyle'), - fontWeight: _('fontWeight'), - lineHeight: _('lineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("color"), + font: _("font"), + fontSize: _("fontSize"), + fontStyle: _("fontStyle"), + fontWeight: _("fontWeight"), + lineHeight: _("lineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleTextRole, - style: GroupTitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleTextRole, + style: GroupTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function buildSubTitle(spec, _, userEncode, dataRef) { - const zero = { - value: 0 - }, text = spec.subtitle, encode = { - enter: { - opacity: zero - }, - update: { - opacity: { - value: 1 - } - }, - exit: { - opacity: zero + } + function buildSubTitle(spec, _, userEncode, dataRef) { + const zero2 = { + value: 0 + }, text2 = spec.subtitle, encode2 = { + enter: { + opacity: zero2 + }, + update: { + opacity: { + value: 1 } + }, + exit: { + opacity: zero2 + } }; - addEncoders(encode, { - text: text, - align: { - signal: 'item.mark.group.align' - }, - angle: { - signal: 'item.mark.group.angle' - }, - limit: { - signal: 'item.mark.group.limit' - }, - baseline: 'top', - dx: _('dx'), - dy: _('dy'), - fill: _('subtitleColor'), - font: _('subtitleFont'), - fontSize: _('subtitleFontSize'), - fontStyle: _('subtitleFontStyle'), - fontWeight: _('subtitleFontWeight'), - lineHeight: _('subtitleLineHeight') + addEncoders(encode2, { + text: text2, + align: { + signal: "item.mark.group.align" + }, + angle: { + signal: "item.mark.group.angle" + }, + limit: { + signal: "item.mark.group.limit" + }, + baseline: "top", + dx: _("dx"), + dy: _("dy"), + fill: _("subtitleColor"), + font: _("subtitleFont"), + fontSize: _("subtitleFontSize"), + fontStyle: _("subtitleFontStyle"), + fontWeight: _("subtitleFontWeight"), + lineHeight: _("subtitleLineHeight") }, { - // update - align: _('align'), - angle: _('angle'), - baseline: _('baseline') + // update + align: _("align"), + angle: _("angle"), + baseline: _("baseline") }); return guideMark({ - type: TextMark, - role: TitleSubtitleRole, - style: GroupSubtitleStyle, - from: dataRef, - encode + type: TextMark, + role: TitleSubtitleRole, + style: GroupSubtitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function parseData(data, scope) { - const transforms = []; - if (data.transform) data.transform.forEach((tx)=>{ - transforms.push(parseTransform(tx, scope)); - }); - if (data.on) data.on.forEach((on)=>{ - parseTrigger(on, scope, data.name); - }); - scope.addDataPipeline(data.name, analyze(data, scope, transforms)); -} -/** - * Analyze a data pipeline, add needed operators. - */ function analyze(data, scope, ops) { - const output = []; - let source = null, modify = false, generate = false, upstream, i, n, t, m; - if (data.values) { - // hard-wired input data set - if (isSignal(data.values) || hasSignal(data.format)) { - // if either values is signal or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, ingest upon dataflow init - output.push(source = collect({ - $ingest: data.values, - $format: data.format + } + function parseData(data2, scope) { + const transforms2 = []; + if (data2.transform) { + data2.transform.forEach((tx2) => { + transforms2.push(parseTransform(tx2, scope)); + }); + } + if (data2.on) { + data2.on.forEach((on2) => { + parseTrigger(on2, scope, data2.name); + }); + } + scope.addDataPipeline(data2.name, analyze(data2, scope, transforms2)); + } + function analyze(data2, scope, ops2) { + const output2 = []; + let source2 = null, modify2 = false, generate2 = false, upstream, i, n, t, m2; + if (data2.values) { + if (isSignal(data2.values) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $ingest: data2.values, + $format: data2.format })); - } else if (data.url) { - // load data from external source - if (hasSignal(data.url) || hasSignal(data.format)) { - // if either url or format has signal, use dynamic loader - output.push(load(scope, data)); - output.push(source = collect()); - } else // otherwise, request load upon dataflow init - output.push(source = collect({ - $request: data.url, - $format: data.format + } + } else if (data2.url) { + if (hasSignal(data2.url) || hasSignal(data2.format)) { + output2.push(load(scope, data2)); + output2.push(source2 = collect()); + } else { + output2.push(source2 = collect({ + $request: data2.url, + $format: data2.format })); - } else if (data.source) { - // derives from one or more other data sets - source = upstream = (0, _vegaUtil.array)(data.source).map((d)=>ref(scope.getData(d).output)); - output.push(null); // populate later - } - // scan data transforms, add collectors as needed - for(i = 0, n = ops.length; i < n; ++i){ - t = ops[i]; - m = t.metadata; - if (!source && !m.source) output.push(source = collect()); - output.push(t); - if (m.generates) generate = true; - if (m.modifies && !generate) modify = true; - if (m.source) source = t; - else if (m.changes) source = null; + } + } else if (data2.source) { + source2 = upstream = array$5(data2.source).map((d) => ref(scope.getData(d).output)); + output2.push(null); + } + for (i = 0, n = ops2.length; i < n; ++i) { + t = ops2[i]; + m2 = t.metadata; + if (!source2 && !m2.source) { + output2.push(source2 = collect()); + } + output2.push(t); + if (m2.generates) generate2 = true; + if (m2.modifies && !generate2) modify2 = true; + if (m2.source) source2 = t; + else if (m2.changes) source2 = null; } if (upstream) { - n = upstream.length - 1; - output[0] = Relay({ - derive: modify, - pulse: n ? upstream : upstream[0] - }); - if (modify || n) // collect derived and multi-pulse tuples - output.splice(1, 0, collect()); - } - if (!source) output.push(collect()); - output.push(Sieve({})); - return output; -} -function collect(values) { - const s = Collect({}, values); + n = upstream.length - 1; + output2[0] = Relay({ + derive: modify2, + pulse: n ? upstream : upstream[0] + }); + if (modify2 || n) { + output2.splice(1, 0, collect()); + } + } + if (!source2) output2.push(collect()); + output2.push(Sieve({})); + return output2; + } + function collect(values2) { + const s = Collect({}, values2); s.metadata = { - source: true + source: true }; return s; -} -function load(scope, data) { + } + function load(scope, data2) { return Load({ - url: data.url ? scope.property(data.url) : undefined, - async: data.async ? scope.property(data.async) : undefined, - values: data.values ? scope.property(data.values) : undefined, - format: scope.objectProperty(data.format) - }); -} -const isX = (orient)=>orient === Bottom || orient === Top; -// get sign coefficient based on axis orient -const getSign = (orient, a, b)=>isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left || orient === Top ? a : b; -// condition on axis x-direction -const ifX = (orient, a, b)=>isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; -// condition on axis y-direction -const ifY = (orient, a, b)=>isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a; -const ifTop = (orient, a, b)=>isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top ? { - value: a - } : { - value: b - }; -const ifRight = (orient, a, b)=>isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right ? { - value: a - } : { - value: b - }; -const ifXEnc = ($orient, a, b)=>ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b); -const ifYEnc = ($orient, a, b)=>ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b); -const ifLeftTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b); -const ifTopExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Top}'`, a, b); -const ifRightExpr = ($orient, a, b)=>ifExpr(`${$orient} === '${Right}'`, a, b); -const ifEnc = (test, a, b)=>{ - // ensure inputs are encoder objects (or null) - a = a != null ? encoder(a) : a; - b = b != null ? encoder(b) : b; - if (isSimple(a) && isSimple(b)) { - // if possible generate simple signal expression - a = a ? a.signal || (0, _vegaUtil.stringValue)(a.value) : null; - b = b ? b.signal || (0, _vegaUtil.stringValue)(b.value) : null; - return { - signal: `${test} ? (${a}) : (${b})` - }; - } else // otherwise generate rule set - return [ - (0, _vegaUtil.extend)({ - test - }, a) - ].concat(b || []); -}; -const isSimple = (enc)=>enc == null || Object.keys(enc).length === 1; -const ifExpr = (test, a, b)=>({ - signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})` - }); -const ifOrient = ($orient, t, b, l, r)=>({ - signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') + '(null)' + url: data2.url ? scope.property(data2.url) : void 0, + async: data2.async ? scope.property(data2.async) : void 0, + values: data2.values ? scope.property(data2.values) : void 0, + format: scope.objectProperty(data2.format) }); -const toExpr = (v)=>isSignal(v) ? v.signal : v == null ? null : (0, _vegaUtil.stringValue)(v); -const mult = (sign, value)=>value === 0 ? 0 : isSignal(sign) ? { - signal: `(${sign.signal}) * ${value}` - } : { - value: sign * value - }; -const patch = (value, base)=>{ - const s = value.signal; - return s && s.endsWith('(null)') ? { - signal: s.slice(0, -6) + base.signal - } : value; -}; -function fallback(prop, config, axisConfig, style) { + } + const isX = (orient) => orient === Bottom || orient === Top; + const getSign = (orient, a2, b2) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a2, b2) : orient === Left || orient === Top ? a2 : b2; + const ifX = (orient, a2, b2) => isSignal(orient) ? ifXEnc(orient.signal, a2, b2) : isX(orient) ? a2 : b2; + const ifY = (orient, a2, b2) => isSignal(orient) ? ifYEnc(orient.signal, a2, b2) : isX(orient) ? b2 : a2; + const ifTop = (orient, a2, b2) => isSignal(orient) ? ifTopExpr(orient.signal, a2, b2) : orient === Top ? { + value: a2 + } : { + value: b2 + }; + const ifRight = (orient, a2, b2) => isSignal(orient) ? ifRightExpr(orient.signal, a2, b2) : orient === Right ? { + value: a2 + } : { + value: b2 + }; + const ifXEnc = ($orient, a2, b2) => ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a2, b2); + const ifYEnc = ($orient, a2, b2) => ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a2, b2); + const ifLeftTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a2, b2); + const ifTopExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Top}'`, a2, b2); + const ifRightExpr = ($orient, a2, b2) => ifExpr(`${$orient} === '${Right}'`, a2, b2); + const ifEnc = (test2, a2, b2) => { + a2 = a2 != null ? encoder(a2) : a2; + b2 = b2 != null ? encoder(b2) : b2; + if (isSimple(a2) && isSimple(b2)) { + a2 = a2 ? a2.signal || $(a2.value) : null; + b2 = b2 ? b2.signal || $(b2.value) : null; + return { + signal: `${test2} ? (${a2}) : (${b2})` + }; + } else { + return [extend$1({ + test: test2 + }, a2)].concat(b2 || []); + } + }; + const isSimple = (enc) => enc == null || Object.keys(enc).length === 1; + const ifExpr = (test2, a2, b2) => ({ + signal: `${test2} ? (${toExpr(a2)}) : (${toExpr(b2)})` + }); + const ifOrient = ($orient, t, b2, l, r) => ({ + signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : "") + (b2 != null ? `${$orient} === '${Bottom}' ? (${toExpr(b2)}) : ` : "") + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : "") + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : "") + "(null)" + }); + const toExpr = (v) => isSignal(v) ? v.signal : v == null ? null : $(v); + const mult = (sign2, value2) => value2 === 0 ? 0 : isSignal(sign2) ? { + signal: `(${sign2.signal}) * ${value2}` + } : { + value: sign2 * value2 + }; + const patch = (value2, base2) => { + const s = value2.signal; + return s && s.endsWith("(null)") ? { + signal: s.slice(0, -6) + base2.signal + } : value2; + }; + function fallback(prop, config, axisConfig2, style2) { let styleProp; - if (config && (0, _vegaUtil.hasOwnProperty)(config, prop)) return config[prop]; - else if ((0, _vegaUtil.hasOwnProperty)(axisConfig, prop)) return axisConfig[prop]; - else if (prop.startsWith('title')) { - switch(prop){ - case 'titleColor': - styleProp = 'fill'; - break; - case 'titleFont': - case 'titleFontSize': - case 'titleFontWeight': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideTitleStyle][styleProp]; - } else if (prop.startsWith('label')) { - switch(prop){ - case 'labelColor': - styleProp = 'fill'; - break; - case 'labelFont': - case 'labelFontSize': - styleProp = prop[5].toLowerCase() + prop.slice(6); - } - return style[GuideLabelStyle][styleProp]; + if (config && has$1(config, prop)) { + return config[prop]; + } else if (has$1(axisConfig2, prop)) { + return axisConfig2[prop]; + } else if (prop.startsWith("title")) { + switch (prop) { + case "titleColor": + styleProp = "fill"; + break; + case "titleFont": + case "titleFontSize": + case "titleFontWeight": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideTitleStyle][styleProp]; + } else if (prop.startsWith("label")) { + switch (prop) { + case "labelColor": + styleProp = "fill"; + break; + case "labelFont": + case "labelFontSize": + styleProp = prop[5].toLowerCase() + prop.slice(6); + } + return style2[GuideLabelStyle][styleProp]; } return null; -} -function keys(objects) { - const map = {}; - for (const obj of objects){ - if (!obj) continue; - for(const key in obj)map[key] = 1; - } - return Object.keys(map); -} -function axisConfig(spec, scope) { - var config = scope.config, style = config.style, axis = config.axis, band = scope.scaleType(spec.scale) === 'band' && config.axisBand, orient = spec.orient, xy, or, key; + } + function keys(objects) { + const map2 = {}; + for (const obj of objects) { + if (!obj) continue; + for (const key2 in obj) map2[key2] = 1; + } + return Object.keys(map2); + } + function axisConfig(spec, scope) { + var config = scope.config, style2 = config.style, axis = config.axis, band2 = scope.scaleType(spec.scale) === "band" && config.axisBand, orient = spec.orient, xy, or2, key2; if (isSignal(orient)) { - const xyKeys = keys([ - config.axisX, - config.axisY - ]), orientKeys = keys([ - config.axisTop, - config.axisBottom, - config.axisLeft, - config.axisRight - ]); - xy = {}; - for (key of xyKeys)xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style)); - or = {}; - for (key of orientKeys)or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style)); + const xyKeys = keys([config.axisX, config.axisY]), orientKeys = keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]); + xy = {}; + for (key2 of xyKeys) { + xy[key2] = ifX(orient, fallback(key2, config.axisX, axis, style2), fallback(key2, config.axisY, axis, style2)); + } + or2 = {}; + for (key2 of orientKeys) { + or2[key2] = ifOrient(orient.signal, fallback(key2, config.axisTop, axis, style2), fallback(key2, config.axisBottom, axis, style2), fallback(key2, config.axisLeft, axis, style2), fallback(key2, config.axisRight, axis, style2)); + } } else { - xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; - or = config['axis' + orient[0].toUpperCase() + orient.slice(1)]; + xy = orient === Top || orient === Bottom ? config.axisX : config.axisY; + or2 = config["axis" + orient[0].toUpperCase() + orient.slice(1)]; } - const result = xy || or || band ? (0, _vegaUtil.extend)({}, axis, xy, or, band) : axis; + const result = xy || or2 || band2 ? extend$1({}, axis, xy, or2, band2) : axis; return result; -} -function axisDomain(spec, config, userEncode, dataRef) { + } + function axisDomain(spec, config, userEncode, dataRef) { const _ = lookup(spec, config), orient = spec.orient; - let enter, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: { - opacity: zero - } + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('domainColor'), - strokeCap: _('domainCap'), - strokeDash: _('domainDash'), - strokeDashOffset: _('domainDashOffset'), - strokeWidth: _('domainWidth'), - strokeOpacity: _('domainOpacity') + addEncoders(encode2, { + stroke: _("domainColor"), + strokeCap: _("domainCap"), + strokeDash: _("domainDash"), + strokeDashOffset: _("domainDashOffset"), + strokeWidth: _("domainWidth"), + strokeOpacity: _("domainOpacity") }); const pos0 = position(spec, 0); const pos1 = position(spec, 1); - enter.x = update.x = ifX(orient, pos0, zero); - enter.x2 = update.x2 = ifX(orient, pos1); - enter.y = update.y = ifY(orient, pos0, zero); - enter.y2 = update.y2 = ifY(orient, pos1); + enter.x = update2.x = ifX(orient, pos0, zero); + enter.x2 = update2.x2 = ifX(orient, pos1); + enter.y = update2.y = ifY(orient, pos0, zero); + enter.y2 = update2.y2 = ifY(orient, pos1); return guideMark({ - type: RuleMark, - role: AxisDomainRole, - from: dataRef, - encode + type: RuleMark, + role: AxisDomainRole, + from: dataRef, + encode: encode2 }, userEncode); -} -function position(spec, pos) { + } + function position(spec, pos) { return { - scale: spec.scale, - range: pos - }; -} -function axisGrid(spec, config, userEncode, dataRef, band) { - const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign = getSign(orient, 1, -1), offset = offsetValue(spec.offset, sign); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero - } + scale: spec.scale, + range: pos }; - addEncoders(encode, { - stroke: _('gridColor'), - strokeCap: _('gridCap'), - strokeDash: _('gridDash'), - strokeDashOffset: _('gridDashOffset'), - strokeOpacity: _('gridOpacity'), - strokeWidth: _('gridWidth') + } + function axisGrid(spec, config, userEncode, dataRef, band2) { + const _ = lookup(spec, config), orient = spec.orient, vscale = spec.gridScale, sign2 = getSign(orient, 1, -1), offset2 = offsetValue(spec.offset, sign2); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } + }; + addEncoders(encode2, { + stroke: _("gridColor"), + strokeCap: _("gridCap"), + strokeDash: _("gridDash"), + strokeDashOffset: _("gridDashOffset"), + strokeOpacity: _("gridOpacity"), + strokeWidth: _("gridWidth") }); const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - const sz = ifX(orient, { - signal: 'height' + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + const sz2 = ifX(orient, { + signal: "height" }, { - signal: 'width' + signal: "width" }); const gridStart = vscale ? { - scale: vscale, - range: 0, - mult: sign, - offset: offset + scale: vscale, + range: 0, + mult: sign2, + offset: offset2 } : { - value: 0, - offset: offset + value: 0, + offset: offset2 }; const gridEnd = vscale ? { - scale: vscale, - range: 1, - mult: sign, - offset: offset - } : (0, _vegaUtil.extend)(sz, { - mult: sign, - offset: offset - }); - enter.x = update.x = ifX(orient, tickPos, gridStart); - enter.y = update.y = ifY(orient, tickPos, gridStart); - enter.x2 = update.x2 = ifY(orient, gridEnd); - enter.y2 = update.y2 = ifX(orient, gridEnd); + scale: vscale, + range: 1, + mult: sign2, + offset: offset2 + } : extend$1(sz2, { + mult: sign2, + offset: offset2 + }); + enter.x = update2.x = ifX(orient, tickPos, gridStart); + enter.y = update2.y = ifY(orient, tickPos, gridStart); + enter.x2 = update2.x2 = ifY(orient, gridEnd); + enter.y2 = update2.y2 = ifX(orient, gridEnd); exit.x = ifX(orient, tickPos); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisGridRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisGridRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function offsetValue(offset, sign) { - if (sign === 1) ; - else if (!(0, _vegaUtil.isObject)(offset)) offset = isSignal(sign) ? { - signal: `(${sign.signal}) * (${offset || 0})` - } : sign * (offset || 0); - else { - let entry = offset = (0, _vegaUtil.extend)({}, offset); - while(entry.mult != null)if (!(0, _vegaUtil.isObject)(entry.mult)) { - entry.mult = isSignal(sign) // no offset if sign === 1 - ? { - signal: `(${entry.mult}) * (${sign.signal})` - } : entry.mult * sign; - return offset; - } else entry = entry.mult = (0, _vegaUtil.extend)({}, entry.mult); - entry.mult = sign; - } - return offset; -} -function axisTicks(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, exit, update; - const encode = { - enter: enter = { - opacity: zero - }, - update: update = { - opacity: one - }, - exit: exit = { - opacity: zero + } + function offsetValue(offset2, sign2) { + if (sign2 === 1) ; + else if (!isObject$1(offset2)) { + offset2 = isSignal(sign2) ? { + signal: `(${sign2.signal}) * (${offset2 || 0})` + } : sign2 * (offset2 || 0); + } else { + let entry2 = offset2 = extend$1({}, offset2); + while (entry2.mult != null) { + if (!isObject$1(entry2.mult)) { + entry2.mult = isSignal(sign2) ? { + signal: `(${entry2.mult}) * (${sign2.signal})` + } : entry2.mult * sign2; + return offset2; + } else { + entry2 = entry2.mult = extend$1({}, entry2.mult); } + } + entry2.mult = sign2; + } + return offset2; + } + function axisTicks(spec, config, userEncode, dataRef, size, band2) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, exit, update2; + const encode2 = { + enter: enter = { + opacity: zero + }, + update: update2 = { + opacity: one + }, + exit: exit = { + opacity: zero + } }; - addEncoders(encode, { - stroke: _('tickColor'), - strokeCap: _('tickCap'), - strokeDash: _('tickDash'), - strokeDashOffset: _('tickDashOffset'), - strokeOpacity: _('tickOpacity'), - strokeWidth: _('tickWidth') + addEncoders(encode2, { + stroke: _("tickColor"), + strokeCap: _("tickCap"), + strokeDash: _("tickDash"), + strokeDashOffset: _("tickDashOffset"), + strokeOpacity: _("tickOpacity"), + strokeWidth: _("tickWidth") }); const tickSize = encoder(size); - tickSize.mult = sign; + tickSize.mult = sign2; const tickPos = { - scale: spec.scale, - field: Value, - band: band.band, - extra: band.extra, - offset: band.offset, - round: _('tickRound') - }; - update.y = enter.y = ifX(orient, zero, tickPos); - update.y2 = enter.y2 = ifX(orient, tickSize); + scale: spec.scale, + field: Value, + band: band2.band, + extra: band2.extra, + offset: band2.offset, + round: _("tickRound") + }; + update2.y = enter.y = ifX(orient, zero, tickPos); + update2.y2 = enter.y2 = ifX(orient, tickSize); exit.x = ifX(orient, tickPos); - update.x = enter.x = ifY(orient, zero, tickPos); - update.x2 = enter.x2 = ifY(orient, tickSize); + update2.x = enter.x = ifY(orient, zero, tickPos); + update2.x2 = enter.x2 = ifY(orient, tickSize); exit.y = ifY(orient, tickPos); return guideMark({ - type: RuleMark, - role: AxisTickRole, - key: Value, - from: dataRef, - encode + type: RuleMark, + role: AxisTickRole, + key: Value, + from: dataRef, + encode: encode2 }, userEncode); -} -function flushExpr(scale, threshold, a, b, c) { + } + function flushExpr(scale2, threshold2, a2, b2, c2) { return { - signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')' + signal: 'flush(range("' + scale2 + '"), scale("' + scale2 + '", datum.value), ' + threshold2 + "," + a2 + "," + b2 + "," + c2 + ")" }; -} -function axisLabels(spec, config, userEncode, dataRef, size, band) { - const _ = lookup(spec, config), orient = spec.orient, scale = spec.scale, sign = getSign(orient, -1, 1), flush = deref(_('labelFlush')), flushOffset = deref(_('labelFlushOffset')), labelAlign = _('labelAlign'), labelBaseline = _('labelBaseline'); - let flushOn = flush === 0 || !!flush, update; + } + function axisLabels(spec, config, userEncode, dataRef, size, band2) { + const _ = lookup(spec, config), orient = spec.orient, scale2 = spec.scale, sign2 = getSign(orient, -1, 1), flush2 = deref(_("labelFlush")), flushOffset = deref(_("labelFlushOffset")), labelAlign = _("labelAlign"), labelBaseline = _("labelBaseline"); + let flushOn = flush2 === 0 || !!flush2, update2; const tickSize = encoder(size); - tickSize.mult = sign; - tickSize.offset = encoder(_('labelPadding') || 0); - tickSize.offset.mult = sign; + tickSize.mult = sign2; + tickSize.offset = encoder(_("labelPadding") || 0); + tickSize.offset.mult = sign2; const tickPos = { - scale: scale, - field: Value, - band: 0.5, - offset: extendOffset(band.offset, _('labelOffset')) - }; - const align = ifX(orient, flushOn ? flushExpr(scale, flush, '"left"', '"right"', '"center"') : { - value: 'center' - }, ifRight(orient, 'left', 'right')); - const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : { - value: 'middle' - }); - const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0); + scale: scale2, + field: Value, + band: 0.5, + offset: extendOffset(band2.offset, _("labelOffset")) + }; + const align = ifX(orient, flushOn ? flushExpr(scale2, flush2, '"left"', '"right"', '"center"') : { + value: "center" + }, ifRight(orient, "left", "right")); + const baseline2 = ifX(orient, ifTop(orient, "bottom", "top"), flushOn ? flushExpr(scale2, flush2, '"top"', '"bottom"', '"middle"') : { + value: "middle" + }); + const offsetExpr = flushExpr(scale2, flush2, `-(${flushOffset})`, flushOffset, 0); flushOn = flushOn && flushOffset; const enter = { - opacity: zero, - x: ifX(orient, tickPos, tickSize), - y: ifY(orient, tickPos, tickSize) - }; - const encode = { - enter: enter, - update: update = { - opacity: one, - text: { - field: Label - }, - x: enter.x, - y: enter.y, - align, - baseline + opacity: zero, + x: ifX(orient, tickPos, tickSize), + y: ifY(orient, tickPos, tickSize) + }; + const encode2 = { + enter, + update: update2 = { + opacity: one, + text: { + field: Label }, - exit: { - opacity: zero, - x: enter.x, - y: enter.y - } + x: enter.x, + y: enter.y, + align, + baseline: baseline2 + }, + exit: { + opacity: zero, + x: enter.x, + y: enter.y + } }; - addEncoders(encode, { - dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, - dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null - }); - addEncoders(encode, { - angle: _('labelAngle'), - fill: _('labelColor'), - fillOpacity: _('labelOpacity'), - font: _('labelFont'), - fontSize: _('labelFontSize'), - fontWeight: _('labelFontWeight'), - fontStyle: _('labelFontStyle'), - limit: _('labelLimit'), - lineHeight: _('labelLineHeight') + addEncoders(encode2, { + dx: !labelAlign && flushOn ? ifX(orient, offsetExpr) : null, + dy: !labelBaseline && flushOn ? ifY(orient, offsetExpr) : null + }); + addEncoders(encode2, { + angle: _("labelAngle"), + fill: _("labelColor"), + fillOpacity: _("labelOpacity"), + font: _("labelFont"), + fontSize: _("labelFontSize"), + fontWeight: _("labelFontWeight"), + fontStyle: _("labelFontStyle"), + limit: _("labelLimit"), + lineHeight: _("labelLineHeight") }, { - align: labelAlign, - baseline: labelBaseline - }); - const bound = _('labelBound'); - let overlap = _('labelOverlap'); - // if overlap method or bound defined, request label overlap removal - overlap = overlap || bound ? { - separation: _('labelSeparation'), - method: overlap, - order: 'datum.index', - bound: bound ? { - scale, - orient, - tolerance: bound - } : null - } : undefined; - if (update.align !== align) update.align = patch(update.align, align); - if (update.baseline !== baseline) update.baseline = patch(update.baseline, baseline); + align: labelAlign, + baseline: labelBaseline + }); + const bound2 = _("labelBound"); + let overlap = _("labelOverlap"); + overlap = overlap || bound2 ? { + separation: _("labelSeparation"), + method: overlap, + order: "datum.index", + bound: bound2 ? { + scale: scale2, + orient, + tolerance: bound2 + } : null + } : void 0; + if (update2.align !== align) { + update2.align = patch(update2.align, align); + } + if (update2.baseline !== baseline2) { + update2.baseline = patch(update2.baseline, baseline2); + } return guideMark({ - type: TextMark, - role: AxisLabelRole, - style: GuideLabelStyle, - key: Value, - from: dataRef, - encode, - overlap + type: TextMark, + role: AxisLabelRole, + style: GuideLabelStyle, + key: Value, + from: dataRef, + encode: encode2, + overlap }, userEncode); -} -function axisTitle(spec, config, userEncode, dataRef) { - const _ = lookup(spec, config), orient = spec.orient, sign = getSign(orient, -1, 1); - let enter, update; - const encode = { - enter: enter = { - opacity: zero, - anchor: encoder(_('titleAnchor', null)), - align: { - signal: alignExpr$1 - } - }, - update: update = (0, _vegaUtil.extend)({}, enter, { - opacity: one, - text: encoder(spec.title) - }), - exit: { - opacity: zero + } + function axisTitle(spec, config, userEncode, dataRef) { + const _ = lookup(spec, config), orient = spec.orient, sign2 = getSign(orient, -1, 1); + let enter, update2; + const encode2 = { + enter: enter = { + opacity: zero, + anchor: encoder(_("titleAnchor", null)), + align: { + signal: alignExpr$1 } + }, + update: update2 = extend$1({}, enter, { + opacity: one, + text: encoder(spec.title) + }), + exit: { + opacity: zero + } }; const titlePos = { - signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` + signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})` }; - update.x = ifX(orient, titlePos); - update.y = ifY(orient, titlePos); - enter.angle = ifX(orient, zero, mult(sign, 90)); + update2.x = ifX(orient, titlePos); + update2.y = ifY(orient, titlePos); + enter.angle = ifX(orient, zero, mult(sign2, 90)); enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), { - value: Bottom - }); - update.angle = enter.angle; - update.baseline = enter.baseline; - addEncoders(encode, { - fill: _('titleColor'), - fillOpacity: _('titleOpacity'), - font: _('titleFont'), - fontSize: _('titleFontSize'), - fontStyle: _('titleFontStyle'), - fontWeight: _('titleFontWeight'), - limit: _('titleLimit'), - lineHeight: _('titleLineHeight') + value: Bottom + }); + update2.angle = enter.angle; + update2.baseline = enter.baseline; + addEncoders(encode2, { + fill: _("titleColor"), + fillOpacity: _("titleOpacity"), + font: _("titleFont"), + fontSize: _("titleFontSize"), + fontStyle: _("titleFontStyle"), + fontWeight: _("titleFontWeight"), + limit: _("titleLimit"), + lineHeight: _("titleLineHeight") }, { - // require update - align: _('titleAlign'), - angle: _('titleAngle'), - baseline: _('titleBaseline') - }); - autoLayout(_, orient, encode, userEncode); - encode.update.align = patch(encode.update.align, enter.align); - encode.update.angle = patch(encode.update.angle, enter.angle); - encode.update.baseline = patch(encode.update.baseline, enter.baseline); + // require update + align: _("titleAlign"), + angle: _("titleAngle"), + baseline: _("titleBaseline") + }); + autoLayout(_, orient, encode2, userEncode); + encode2.update.align = patch(encode2.update.align, enter.align); + encode2.update.angle = patch(encode2.update.angle, enter.angle); + encode2.update.baseline = patch(encode2.update.baseline, enter.baseline); return guideMark({ - type: TextMark, - role: AxisTitleRole, - style: GuideTitleStyle, - from: dataRef, - encode + type: TextMark, + role: AxisTitleRole, + style: GuideTitleStyle, + from: dataRef, + encode: encode2 }, userEncode); -} -function autoLayout(_, orient, encode, userEncode) { - const auto = (value, dim)=>value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false; - const autoY = auto(_('titleX'), 'x'), autoX = auto(_('titleY'), 'y'); - encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); -} -function parseAxis(spec, scope) { - const config = axisConfig(spec, scope), encode = spec.encode || {}, axisEncode = encode.axis || {}, name = axisEncode.name || undefined, interactive = axisEncode.interactive, style = axisEncode.style, _ = lookup(spec, config), band = tickBand(_); - // single-element data source for axis group - const datum = { - scale: spec.scale, - ticks: !!_('ticks'), - labels: !!_('labels'), - grid: !!_('grid'), - domain: !!_('domain'), - title: spec.title != null - }; - const dataRef = ref(scope.add(Collect({}, [ - datum - ]))); - // data source for axis ticks + } + function autoLayout(_, orient, encode2, userEncode) { + const auto = (value2, dim) => value2 != null ? (encode2.update[dim] = patch(encoder(value2), encode2.update[dim]), false) : !has(dim, userEncode) ? true : false; + const autoY = auto(_("titleX"), "x"), autoX = auto(_("titleY"), "y"); + encode2.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY)); + } + function parseAxis(spec, scope) { + const config = axisConfig(spec, scope), encode2 = spec.encode || {}, axisEncode = encode2.axis || {}, name = axisEncode.name || void 0, interactive2 = axisEncode.interactive, style2 = axisEncode.style, _ = lookup(spec, config), band2 = tickBand(_); + const datum2 = { + scale: spec.scale, + ticks: !!_("ticks"), + labels: !!_("labels"), + grid: !!_("grid"), + domain: !!_("domain"), + title: spec.title != null + }; + const dataRef = ref(scope.add(Collect({}, [datum2]))); const ticksRef = ref(scope.add(AxisTicks({ - scale: scope.scaleRef(spec.scale), - extra: scope.property(band.extra), - count: scope.objectProperty(spec.tickCount), - values: scope.objectProperty(spec.values), - minstep: scope.property(spec.tickMinStep), - formatType: scope.property(spec.formatType), - formatSpecifier: scope.property(spec.format) + scale: scope.scaleRef(spec.scale), + extra: scope.property(band2.extra), + count: scope.objectProperty(spec.tickCount), + values: scope.objectProperty(spec.values), + minstep: scope.property(spec.tickMinStep), + formatType: scope.property(spec.formatType), + formatSpecifier: scope.property(spec.format) }))); - // generate axis marks - const children = []; + const children2 = []; let size; - // include axis gridlines if requested - if (datum.grid) children.push(axisGrid(spec, config, encode.grid, ticksRef, band)); - // include axis ticks if requested - if (datum.ticks) { - size = _('tickSize'); - children.push(axisTicks(spec, config, encode.ticks, ticksRef, size, band)); - } - // include axis labels if requested - if (datum.labels) { - size = datum.ticks ? size : 0; - children.push(axisLabels(spec, config, encode.labels, ticksRef, size, band)); - } - // include axis domain path if requested - if (datum.domain) children.push(axisDomain(spec, config, encode.domain, dataRef)); - // include axis title if defined - if (datum.title) children.push(axisTitle(spec, config, encode.title, dataRef)); - // parse axis specification + if (datum2.grid) { + children2.push(axisGrid(spec, config, encode2.grid, ticksRef, band2)); + } + if (datum2.ticks) { + size = _("tickSize"); + children2.push(axisTicks(spec, config, encode2.ticks, ticksRef, size, band2)); + } + if (datum2.labels) { + size = datum2.ticks ? size : 0; + children2.push(axisLabels(spec, config, encode2.labels, ticksRef, size, band2)); + } + if (datum2.domain) { + children2.push(axisDomain(spec, config, encode2.domain, dataRef)); + } + if (datum2.title) { + children2.push(axisTitle(spec, config, encode2.title, dataRef)); + } return parseMark(guideGroup({ - role: AxisRole, - from: dataRef, - encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), - marks: children, - aria: _('aria'), - description: _('description'), - zindex: _('zindex'), - name, - interactive, - style + role: AxisRole, + from: dataRef, + encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip), + marks: children2, + aria: _("aria"), + description: _("description"), + zindex: _("zindex"), + name, + interactive: interactive2, + style: style2 }), scope); -} -function buildAxisEncode(_, spec) { - const encode = { - enter: {}, - update: {} - }; - addEncoders(encode, { - orient: _('orient'), - offset: _('offset') || 0, - position: value(spec.position, 0), - titlePadding: _('titlePadding'), - minExtent: _('minExtent'), - maxExtent: _('maxExtent'), - range: { - signal: `abs(span(range("${spec.scale}")))` - }, - translate: _('translate'), - // accessibility support - format: spec.format, - formatType: spec.formatType + } + function buildAxisEncode(_, spec) { + const encode2 = { + enter: {}, + update: {} + }; + addEncoders(encode2, { + orient: _("orient"), + offset: _("offset") || 0, + position: value(spec.position, 0), + titlePadding: _("titlePadding"), + minExtent: _("minExtent"), + maxExtent: _("maxExtent"), + range: { + signal: `abs(span(range("${spec.scale}")))` + }, + translate: _("translate"), + // accessibility support + format: spec.format, + formatType: spec.formatType }); - return encode; -} -function parseScope(spec, scope, preprocessed) { - const signals = (0, _vegaUtil.array)(spec.signals), scales = (0, _vegaUtil.array)(spec.scales); - // parse signal definitions, if not already preprocessed - if (!preprocessed) signals.forEach((_)=>parseSignal(_, scope)); - // parse cartographic projection definitions - (0, _vegaUtil.array)(spec.projections).forEach((_)=>parseProjection(_, scope)); - // initialize scale references - scales.forEach((_)=>initScale(_, scope)); - // parse data sources - (0, _vegaUtil.array)(spec.data).forEach((_)=>parseData(_, scope)); - // parse scale definitions - scales.forEach((_)=>parseScale(_, scope)); - // parse signal updates - (preprocessed || signals).forEach((_)=>parseSignalUpdates(_, scope)); - // parse axis definitions - (0, _vegaUtil.array)(spec.axes).forEach((_)=>parseAxis(_, scope)); - // parse mark definitions - (0, _vegaUtil.array)(spec.marks).forEach((_)=>parseMark(_, scope)); - // parse legend definitions - (0, _vegaUtil.array)(spec.legends).forEach((_)=>parseLegend(_, scope)); - // parse title, if defined + return encode2; + } + function parseScope(spec, scope, preprocessed) { + const signals = array$5(spec.signals), scales2 = array$5(spec.scales); + if (!preprocessed) signals.forEach((_) => parseSignal(_, scope)); + array$5(spec.projections).forEach((_) => parseProjection(_, scope)); + scales2.forEach((_) => initScale(_, scope)); + array$5(spec.data).forEach((_) => parseData(_, scope)); + scales2.forEach((_) => parseScale(_, scope)); + (preprocessed || signals).forEach((_) => parseSignalUpdates(_, scope)); + array$5(spec.axes).forEach((_) => parseAxis(_, scope)); + array$5(spec.marks).forEach((_) => parseMark(_, scope)); + array$5(spec.legends).forEach((_) => parseLegend(_, scope)); if (spec.title) parseTitle(spec.title, scope); - // parse collected lambda (anonymous) expressions scope.parseLambdas(); return scope; -} -const rootEncode = (spec)=>extendEncode({ - enter: { - x: { - value: 0 - }, - y: { - value: 0 - } - }, - update: { - width: { - signal: 'width' - }, - height: { - signal: 'height' - } - } - }, spec); -function parseView(spec, scope) { + } + const rootEncode = (spec) => extendEncode({ + enter: { + x: { + value: 0 + }, + y: { + value: 0 + } + }, + update: { + width: { + signal: "width" + }, + height: { + signal: "height" + } + } + }, spec); + function parseView(spec, scope) { const config = scope.config; - // add scenegraph root const root = ref(scope.root = scope.add(operator())); - // parse top-level signal definitions const signals = collectSignals(spec, config); - signals.forEach((_)=>parseSignal(_, scope)); - // assign description, event, legend, and locale configuration + signals.forEach((_) => parseSignal(_, scope)); scope.description = spec.description || config.description; scope.eventConfig = config.events; scope.legends = scope.objectProperty(config.legend && config.legend.layout); scope.locale = config.locale; - // store root group item const input = scope.add(Collect()); - // encode root group item - const encode = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { - pulse: ref(input) + const encode2 = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, { + pulse: ref(input) }))); - // perform view layout const parent = scope.add(ViewLayout({ - layout: scope.objectProperty(spec.layout), - legends: scope.legends, - autosize: scope.signalRef('autosize'), - mark: root, - pulse: ref(encode) + layout: scope.objectProperty(spec.layout), + legends: scope.legends, + autosize: scope.signalRef("autosize"), + mark: root, + pulse: ref(encode2) })); scope.operators.pop(); - // parse remainder of specification - scope.pushState(ref(encode), ref(parent), null); + scope.pushState(ref(encode2), ref(parent), null); parseScope(spec, scope, signals); scope.operators.push(parent); - // bound / render / sieve root item let op = scope.add(Bound({ - mark: root, - pulse: ref(parent) + mark: root, + pulse: ref(parent) })); op = scope.add(Render({ - pulse: ref(op) + pulse: ref(op) })); op = scope.add(Sieve({ - pulse: ref(op) + pulse: ref(op) })); - // track metadata for root item - scope.addData('root', new DataScope(scope, input, input, op)); + scope.addData("root", new DataScope(scope, input, input, op)); return scope; -} -function signalObject(name, value) { - return value && value.signal ? { - name, - update: value.signal + } + function signalObject(name, value2) { + return value2 && value2.signal ? { + name, + update: value2.signal } : { - name, - value - }; -} -/** - * Collect top-level signals, merging values as needed. Signals - * defined in the config signals arrays are added only if that - * signal is not explicitly defined in the specification. - * Built-in signals (autosize, background, padding, width, height) - * receive special treatment. They are initialized using the - * top-level spec property, or, if undefined in the spec, using - * the corresponding top-level config property. If this property - * is a signal reference object, the signal expression maps to the - * signal 'update' property. If the spec's top-level signal array - * contains an entry that matches a built-in signal, that entry - * will be merged with the built-in specification, potentially - * overwriting existing 'value' or 'update' properties. - */ function collectSignals(spec, config) { - const _ = (name)=>value(spec[name], config[name]), signals = [ - signalObject('background', _('background')), - signalObject('autosize', parseAutosize(_('autosize'))), - signalObject('padding', parsePadding(_('padding'))), - signalObject('width', _('width') || 0), - signalObject('height', _('height') || 0) - ], pre = signals.reduce((p, s)=>(p[s.name] = s, p), {}), map = {}; - // add spec signal array - (0, _vegaUtil.array)(spec.signals).forEach((s)=>{ - if ((0, _vegaUtil.hasOwnProperty)(pre, s.name)) // merge if built-in signal - s = (0, _vegaUtil.extend)(pre[s.name], s); - else // otherwise add to signal list + name, + value: value2 + }; + } + function collectSignals(spec, config) { + const _ = (name) => value(spec[name], config[name]), signals = [signalObject("background", _("background")), signalObject("autosize", parseAutosize(_("autosize"))), signalObject("padding", parsePadding(_("padding"))), signalObject("width", _("width") || 0), signalObject("height", _("height") || 0)], pre = signals.reduce((p, s) => (p[s.name] = s, p), {}), map2 = {}; + array$5(spec.signals).forEach((s) => { + if (has$1(pre, s.name)) { + s = extend$1(pre[s.name], s); + } else { signals.push(s); - map[s.name] = s; + } + map2[s.name] = s; }); - // add config signal array - (0, _vegaUtil.array)(config.signals).forEach((s)=>{ - if (!(0, _vegaUtil.hasOwnProperty)(map, s.name) && !(0, _vegaUtil.hasOwnProperty)(pre, s.name)) // add to signal list if not already defined + array$5(config.signals).forEach((s) => { + if (!has$1(map2, s.name) && !has$1(pre, s.name)) { signals.push(s); + } }); return signals; -} -function Scope(config, options) { + } + function Scope(config, options) { this.config = config || {}; this.options = options || {}; this.bindings = []; @@ -47140,15 +32625,13 @@ function Scope(config, options) { this.locale = null; this._id = 0; this._subid = 0; - this._nextsub = [ - 0 - ]; + this._nextsub = [0]; this._parent = []; this._encode = []; this._lookup = []; this._markpath = []; -} -function Subscope(scope) { + } + function Subscope(scope) { this.config = scope.config; this.options = scope.options; this.legends = scope.legends; @@ -47168,2013 +32651,997 @@ function Subscope(scope) { this._encode = scope._encode.slice(); this._lookup = scope._lookup.slice(); this._markpath = scope._markpath; -} -Scope.prototype = Subscope.prototype = { - parse (spec) { - return parseScope(spec, this); - }, - fork () { - return new Subscope(this); - }, - isSubscope () { - return this._subid > 0; - }, - toRuntime () { - this.finish(); - return { - description: this.description, - operators: this.operators, - streams: this.streams, - updates: this.updates, - bindings: this.bindings, - eventConfig: this.eventConfig, - locale: this.locale - }; - }, - id () { - return (this._subid ? this._subid + ':' : 0) + this._id++; - }, - add (op) { - this.operators.push(op); - op.id = this.id(); - // if pre-registration references exist, resolve them now - if (op.refs) { - op.refs.forEach((ref)=>{ - ref.$ref = op.id; - }); - op.refs = null; - } - return op; + } + Scope.prototype = Subscope.prototype = { + parse(spec) { + return parseScope(spec, this); + }, + fork() { + return new Subscope(this); + }, + isSubscope() { + return this._subid > 0; + }, + toRuntime() { + this.finish(); + return { + description: this.description, + operators: this.operators, + streams: this.streams, + updates: this.updates, + bindings: this.bindings, + eventConfig: this.eventConfig, + locale: this.locale + }; + }, + id() { + return (this._subid ? this._subid + ":" : 0) + this._id++; + }, + add(op) { + this.operators.push(op); + op.id = this.id(); + if (op.refs) { + op.refs.forEach((ref2) => { + ref2.$ref = op.id; + }); + op.refs = null; + } + return op; }, - proxy (op) { - const vref = op instanceof Entry ? ref(op) : op; - return this.add(Proxy({ - value: vref - })); + proxy(op) { + const vref = op instanceof Entry ? ref(op) : op; + return this.add(Proxy({ + value: vref + })); }, - addStream (stream) { - this.streams.push(stream); - stream.id = this.id(); - return stream; + addStream(stream2) { + this.streams.push(stream2); + stream2.id = this.id(); + return stream2; }, - addUpdate (update) { - this.updates.push(update); - return update; + addUpdate(update2) { + this.updates.push(update2); + return update2; }, // Apply metadata - finish () { - let name, ds; - // annotate root - if (this.root) this.root.root = true; - // annotate signals - for(name in this.signals)this.signals[name].signal = name; - // annotate scales - for(name in this.scales)this.scales[name].scale = name; - // annotate data sets - function annotate(op, name, type) { - let data, list; - if (op) { - data = op.data || (op.data = {}); - list = data[name] || (data[name] = []); - list.push(type); - } + finish() { + let name, ds; + if (this.root) this.root.root = true; + for (name in this.signals) { + this.signals[name].signal = name; + } + for (name in this.scales) { + this.scales[name].scale = name; + } + function annotate(op, name2, type2) { + let data2, list; + if (op) { + data2 = op.data || (op.data = {}); + list = data2[name2] || (data2[name2] = []); + list.push(type2); } - for(name in this.data){ - ds = this.data[name]; - annotate(ds.input, name, 'input'); - annotate(ds.output, name, 'output'); - annotate(ds.values, name, 'values'); - for(const field in ds.index)annotate(ds.index[field], name, 'index:' + field); + } + for (name in this.data) { + ds = this.data[name]; + annotate(ds.input, name, "input"); + annotate(ds.output, name, "output"); + annotate(ds.values, name, "values"); + for (const field2 in ds.index) { + annotate(ds.index[field2], name, "index:" + field2); } - return this; + } + return this; }, // ---- - pushState (encode, parent, lookup) { - this._encode.push(ref(this.add(Sieve({ - pulse: encode - })))); - this._parent.push(parent); - this._lookup.push(lookup ? ref(this.proxy(lookup)) : null); - this._markpath.push(-1); + pushState(encode2, parent, lookup2) { + this._encode.push(ref(this.add(Sieve({ + pulse: encode2 + })))); + this._parent.push(parent); + this._lookup.push(lookup2 ? ref(this.proxy(lookup2)) : null); + this._markpath.push(-1); }, - popState () { - this._encode.pop(); - this._parent.pop(); - this._lookup.pop(); - this._markpath.pop(); + popState() { + this._encode.pop(); + this._parent.pop(); + this._lookup.pop(); + this._markpath.pop(); }, - parent () { - return (0, _vegaUtil.peek)(this._parent); + parent() { + return peek$1(this._parent); }, - encode () { - return (0, _vegaUtil.peek)(this._encode); + encode() { + return peek$1(this._encode); }, - lookup () { - return (0, _vegaUtil.peek)(this._lookup); + lookup() { + return peek$1(this._lookup); }, - markpath () { - const p = this._markpath; - return ++p[p.length - 1]; + markpath() { + const p = this._markpath; + return ++p[p.length - 1]; }, // ---- - fieldRef (field, name) { - if ((0, _vegaUtil.isString)(field)) return fieldRef$1(field, name); - if (!field.signal) (0, _vegaUtil.error)('Unsupported field reference: ' + (0, _vegaUtil.stringValue)(field)); - const s = field.signal; - let f = this.field[s]; - if (!f) { - const params = { - name: this.signalRef(s) - }; - if (name) params.as = name; - this.field[s] = f = ref(this.add(Field(params))); - } - return f; - }, - compareRef (cmp) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; - const fields = (0, _vegaUtil.array)(cmp.field).map(check), orders = (0, _vegaUtil.array)(cmp.order).map(check); - return signal ? ref(this.add(Compare({ - fields: fields, - orders: orders - }))) : compareRef(fields, orders); - }, - keyRef (fields, flat) { - let signal = false; - const check = (_)=>isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; - const sig = this.signals; - fields = (0, _vegaUtil.array)(fields).map(check); - return signal ? ref(this.add(Key({ - fields: fields, - flat: flat - }))) : keyRef(fields, flat); - }, - sortRef (sort) { - if (!sort) return sort; - // including id ensures stable sorting - const a = aggrField(sort.op, sort.field), o = sort.order || Ascending; - return o.signal ? ref(this.add(Compare({ - fields: a, - orders: this.signalRef(o.signal) - }))) : compareRef(a, o); + fieldRef(field2, name) { + if (isString(field2)) return fieldRef$1(field2, name); + if (!field2.signal) { + error("Unsupported field reference: " + $(field2)); + } + const s = field2.signal; + let f = this.field[s]; + if (!f) { + const params2 = { + name: this.signalRef(s) + }; + if (name) params2.as = name; + this.field[s] = f = ref(this.add(Field(params2))); + } + return f; + }, + compareRef(cmp) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _; + const fields = array$5(cmp.field).map(check), orders = array$5(cmp.order).map(check); + return signal ? ref(this.add(Compare({ + fields, + orders + }))) : compareRef(fields, orders); + }, + keyRef(fields, flat) { + let signal = false; + const check = (_) => isSignal(_) ? (signal = true, ref(sig[_.signal])) : _; + const sig = this.signals; + fields = array$5(fields).map(check); + return signal ? ref(this.add(Key({ + fields, + flat + }))) : keyRef(fields, flat); + }, + sortRef(sort2) { + if (!sort2) return sort2; + const a2 = aggrField(sort2.op, sort2.field), o = sort2.order || Ascending; + return o.signal ? ref(this.add(Compare({ + fields: a2, + orders: this.signalRef(o.signal) + }))) : compareRef(a2, o); }, // ---- - event (source, type) { - const key = source + ':' + type; - if (!this.events[key]) { - const id = this.id(); - this.streams.push({ - id: id, - source: source, - type: type - }); - this.events[key] = id; - } - return this.events[key]; + event(source2, type2) { + const key2 = source2 + ":" + type2; + if (!this.events[key2]) { + const id2 = this.id(); + this.streams.push({ + id: id2, + source: source2, + type: type2 + }); + this.events[key2] = id2; + } + return this.events[key2]; }, // ---- - hasOwnSignal (name) { - return (0, _vegaUtil.hasOwnProperty)(this.signals, name); + hasOwnSignal(name) { + return has$1(this.signals, name); }, - addSignal (name, value) { - if (this.hasOwnSignal(name)) (0, _vegaUtil.error)('Duplicate signal name: ' + (0, _vegaUtil.stringValue)(name)); - const op = value instanceof Entry ? value : this.add(operator(value)); - return this.signals[name] = op; - }, - getSignal (name) { - if (!this.signals[name]) (0, _vegaUtil.error)('Unrecognized signal name: ' + (0, _vegaUtil.stringValue)(name)); - return this.signals[name]; + addSignal(name, value2) { + if (this.hasOwnSignal(name)) { + error("Duplicate signal name: " + $(name)); + } + const op = value2 instanceof Entry ? value2 : this.add(operator(value2)); + return this.signals[name] = op; }, - signalRef (s) { - if (this.signals[s]) return ref(this.signals[s]); - else if (!(0, _vegaUtil.hasOwnProperty)(this.lambdas, s)) this.lambdas[s] = this.add(operator(null)); - return ref(this.lambdas[s]); + getSignal(name) { + if (!this.signals[name]) { + error("Unrecognized signal name: " + $(name)); + } + return this.signals[name]; }, - parseLambdas () { - const code = Object.keys(this.lambdas); - for(let i = 0, n = code.length; i < n; ++i){ - const s = code[i], e = (0, _vegaFunctions.parseExpression)(s, this), op = this.lambdas[s]; - op.params = e.$params; - op.update = e.$expr; - } + signalRef(s) { + if (this.signals[s]) { + return ref(this.signals[s]); + } else if (!has$1(this.lambdas, s)) { + this.lambdas[s] = this.add(operator(null)); + } + return ref(this.lambdas[s]); + }, + parseLambdas() { + const code = Object.keys(this.lambdas); + for (let i = 0, n = code.length; i < n; ++i) { + const s = code[i], e = parser(s, this), op = this.lambdas[s]; + op.params = e.$params; + op.update = e.$expr; + } }, - property (spec) { - return spec && spec.signal ? this.signalRef(spec.signal) : spec; + property(spec) { + return spec && spec.signal ? this.signalRef(spec.signal) : spec; }, - objectProperty (spec) { - return !spec || !(0, _vegaUtil.isObject)(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); + objectProperty(spec) { + return !spec || !isObject$1(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec)); }, - exprRef (code, name) { - const params = { - expr: (0, _vegaFunctions.parseExpression)(code, this) - }; - if (name) params.expr.$name = name; - return ref(this.add(Expression(params))); + exprRef(code, name) { + const params2 = { + expr: parser(code, this) + }; + if (name) params2.expr.$name = name; + return ref(this.add(Expression(params2))); }, - addBinding (name, bind) { - if (!this.bindings) (0, _vegaUtil.error)('Nested signals do not support binding: ' + (0, _vegaUtil.stringValue)(name)); - this.bindings.push((0, _vegaUtil.extend)({ - signal: name - }, bind)); + addBinding(name, bind2) { + if (!this.bindings) { + error("Nested signals do not support binding: " + $(name)); + } + this.bindings.push(extend$1({ + signal: name + }, bind2)); }, // ---- - addScaleProj (name, transform) { - if ((0, _vegaUtil.hasOwnProperty)(this.scales, name)) (0, _vegaUtil.error)('Duplicate scale or projection name: ' + (0, _vegaUtil.stringValue)(name)); - this.scales[name] = this.add(transform); + addScaleProj(name, transform2) { + if (has$1(this.scales, name)) { + error("Duplicate scale or projection name: " + $(name)); + } + this.scales[name] = this.add(transform2); }, - addScale (name, params) { - this.addScaleProj(name, Scale(params)); + addScale(name, params2) { + this.addScaleProj(name, Scale(params2)); }, - addProjection (name, params) { - this.addScaleProj(name, Projection(params)); + addProjection(name, params2) { + this.addScaleProj(name, Projection(params2)); }, - getScale (name) { - if (!this.scales[name]) (0, _vegaUtil.error)('Unrecognized scale name: ' + (0, _vegaUtil.stringValue)(name)); - return this.scales[name]; + getScale(name) { + if (!this.scales[name]) { + error("Unrecognized scale name: " + $(name)); + } + return this.scales[name]; }, - scaleRef (name) { - return ref(this.getScale(name)); + scaleRef(name) { + return ref(this.getScale(name)); }, - scaleType (name) { - return this.getScale(name).params.type; + scaleType(name) { + return this.getScale(name).params.type; }, - projectionRef (name) { - return this.scaleRef(name); + projectionRef(name) { + return this.scaleRef(name); }, - projectionType (name) { - return this.scaleType(name); + projectionType(name) { + return this.scaleType(name); }, // ---- - addData (name, dataScope) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name] = dataScope; + addData(name, dataScope) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.data[name] = dataScope; }, - getData (name) { - if (!this.data[name]) (0, _vegaUtil.error)('Undefined data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.data[name]; + getData(name) { + if (!this.data[name]) { + error("Undefined data set name: " + $(name)); + } + return this.data[name]; }, - addDataPipeline (name, entries) { - if ((0, _vegaUtil.hasOwnProperty)(this.data, name)) (0, _vegaUtil.error)('Duplicate data set name: ' + (0, _vegaUtil.stringValue)(name)); - return this.addData(name, DataScope.fromEntries(this, entries)); - } -}; -function propertyLambda(spec) { - return ((0, _vegaUtil.isArray)(spec) ? arrayLambda : objectLambda)(spec); -} -function arrayLambda(array) { - const n = array.length; - let code = '['; - for(let i = 0; i < n; ++i){ - const value = array[i]; - code += (i > 0 ? ',' : '') + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + ']'; -} -function objectLambda(obj) { - let code = '{', i = 0, key, value; - for(key in obj){ - value = obj[key]; - code += (++i > 1 ? ',' : '') + (0, _vegaUtil.stringValue)(key) + ':' + ((0, _vegaUtil.isObject)(value) ? value.signal || propertyLambda(value) : (0, _vegaUtil.stringValue)(value)); - } - return code + '}'; -} -/** - * Standard configuration defaults for Vega specification parsing. - * Users can provide their own (sub-)set of these default values - * by passing in a config object to the top-level parse method. - */ function defaults() { - const defaultFont = 'sans-serif', defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = '#4c78a8', black = '#000', gray = '#888', lightGray = '#ddd'; - return { - // default visualization description - description: 'Vega visualization', - // default padding around visualization - padding: 0, - // default for automatic sizing; options: 'none', 'pad', 'fit' - // or provide an object (e.g., {'type': 'pad', 'resize': true}) - autosize: 'pad', - // default view background color - // covers the entire view component - background: null, - // default event handling configuration - // preventDefault for view-sourced event types except 'wheel' - events: { - defaults: { - allow: [ - 'wheel' - ] - } - }, - // defaults for top-level group marks - // accepts mark properties (fill, stroke, etc) - // covers the data rectangle within group width/height - group: null, - // defaults for basic mark types - // each subset accepts mark properties (fill, stroke, etc) - mark: null, - arc: { - fill: defaultColor - }, - area: { - fill: defaultColor - }, - image: null, - line: { - stroke: defaultColor, - strokeWidth: defaultStrokeWidth - }, - path: { - stroke: defaultColor - }, - rect: { - fill: defaultColor - }, - rule: { - stroke: black - }, - shape: { - stroke: defaultColor - }, - symbol: { - fill: defaultColor, - size: 64 - }, - text: { - fill: black, - font: defaultFont, - fontSize: 11 - }, - trail: { - fill: defaultColor, - size: defaultStrokeWidth - }, - // style definitions - style: { - // axis & legend labels - 'guide-label': { - fill: black, - font: defaultFont, - fontSize: 10 - }, - // axis & legend titles - 'guide-title': { - fill: black, - font: defaultFont, - fontSize: 11, - fontWeight: 'bold' - }, - // headers, including chart title - 'group-title': { - fill: black, - font: defaultFont, - fontSize: 13, - fontWeight: 'bold' - }, - // chart subtitle - 'group-subtitle': { - fill: black, - font: defaultFont, - fontSize: 12 - }, - // defaults for styled point marks in Vega-Lite - point: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'circle' - }, - circle: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth - }, - square: { - size: defaultSymbolSize, - strokeWidth: defaultStrokeWidth, - shape: 'square' - }, - // defaults for styled group marks in Vega-Lite - cell: { - fill: 'transparent', - stroke: lightGray - }, - view: { - fill: 'transparent' - } - }, - // defaults for title - title: { - orient: 'top', - anchor: 'middle', - offset: 4, - subtitlePadding: 3 - }, - // defaults for axes - axis: { - minExtent: 0, - maxExtent: 200, - bandPosition: 0.5, - domain: true, - domainWidth: 1, - domainColor: gray, - grid: false, - gridWidth: 1, - gridColor: lightGray, - labels: true, - labelAngle: 0, - labelLimit: 180, - labelOffset: 0, - labelPadding: 2, - ticks: true, - tickColor: gray, - tickOffset: 0, - tickRound: true, - tickSize: 5, - tickWidth: 1, - titlePadding: 4 - }, - // correction for centering bias - axisBand: { - tickOffset: -0.5 - }, - // defaults for cartographic projection - projection: { - type: 'mercator' - }, - // defaults for legends - legend: { - orient: 'right', - padding: 0, - gridAlign: 'each', - columnPadding: 10, - rowPadding: 2, - symbolDirection: 'vertical', - gradientDirection: 'vertical', - gradientLength: 200, - gradientThickness: 16, - gradientStrokeColor: lightGray, - gradientStrokeWidth: 0, - gradientLabelOffset: 2, - labelAlign: 'left', - labelBaseline: 'middle', - labelLimit: 160, - labelOffset: 4, - labelOverlap: true, - symbolLimit: 30, - symbolType: 'circle', - symbolSize: 100, - symbolOffset: 0, - symbolStrokeWidth: 1.5, - symbolBaseFillColor: 'transparent', - symbolBaseStrokeColor: gray, - titleLimit: 180, - titleOrient: 'top', - titlePadding: 5, - layout: { - offset: 18, - direction: 'horizontal', - left: { - direction: 'vertical' - }, - right: { - direction: 'vertical' - } - } - }, - // defaults for scale ranges - range: { - category: { - scheme: 'tableau10' - }, - ordinal: { - scheme: 'blues' - }, - heatmap: { - scheme: 'yellowgreenblue' - }, - ramp: { - scheme: 'blues' - }, - diverging: { - scheme: 'blueorange', - extent: [ - 1, - 0 - ] - }, - symbol: [ - 'circle', - 'square', - 'triangle-up', - 'cross', - 'diamond', - 'triangle-right', - 'triangle-down', - 'triangle-left' - ] - } - }; -} -function parse(spec, config, options) { - if (!(0, _vegaUtil.isObject)(spec)) (0, _vegaUtil.error)('Input Vega specification must be an object.'); - config = (0, _vegaUtil.mergeConfig)(defaults(), config, spec.config); - return parseView(spec, new Scope(config, options)).toRuntime(); -} - -},{"vega-util":"bApja","vega-functions":"iuqsd","vega-event-selector":"gXMNx","vega-scale":"bEydG","vega-dataflow":"3NitK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gXMNx":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "parseSelector", ()=>eventSelector); -const VIEW = 'view', LBRACK = '[', RBRACK = ']', LBRACE = '{', RBRACE = '}', COLON = ':', COMMA = ',', NAME = '@', GT = '>', ILLEGAL = /[[\]{}]/, DEFAULT_MARKS = { - '*': 1, - arc: 1, - area: 1, - group: 1, - image: 1, - line: 1, - path: 1, - rect: 1, - rule: 1, - shape: 1, - symbol: 1, - text: 1, - trail: 1 -}; -let DEFAULT_SOURCE, MARKS; -/** - * Parse an event selector string. - * Returns an array of event stream definitions. - */ function eventSelector(selector, source, marks) { - DEFAULT_SOURCE = source || VIEW; - MARKS = marks || DEFAULT_MARKS; - return parseMerge(selector.trim()).map(parseSelector); -} -function isMarkType(type) { - return MARKS[type]; -} -function find(s, i, endChar, pushChar, popChar) { - const n = s.length; - let count = 0, c; - for(; i < n; ++i){ - c = s[i]; - if (!count && c === endChar) return i; - else if (popChar && popChar.indexOf(c) >= 0) --count; - else if (pushChar && pushChar.indexOf(c) >= 0) ++count; - } - return i; -} -function parseMerge(s) { - const output = [], n = s.length; - let start = 0, i = 0; - while(i < n){ - i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE); - output.push(s.substring(start, i).trim()); - start = ++i; - } - if (output.length === 0) throw 'Empty event selector: ' + s; - return output; -} -function parseSelector(s) { - return s[0] === '[' ? parseBetween(s) : parseStream(s); -} -function parseBetween(s) { - const n = s.length; - let i = 1, b; - i = find(s, i, RBRACK, LBRACK, RBRACK); - if (i === n) throw 'Empty between selector: ' + s; - b = parseMerge(s.substring(1, i)); - if (b.length !== 2) throw 'Between selector must have two elements: ' + s; - s = s.slice(i + 1).trim(); - if (s[0] !== GT) throw 'Expected \'>\' after between selector: ' + s; - b = b.map(parseSelector); - const stream = parseSelector(s.slice(1).trim()); - if (stream.between) return { - between: b, - stream: stream - }; - else stream.between = b; - return stream; -} -function parseStream(s) { - const stream = { - source: DEFAULT_SOURCE - }, source = []; - let throttle = [ - 0, - 0 - ], markname = 0, start = 0, n = s.length, i = 0, j, filter; - // extract throttle from end - if (s[n - 1] === RBRACE) { - i = s.lastIndexOf(LBRACE); - if (i >= 0) { - try { - throttle = parseThrottle(s.substring(i + 1, n - 1)); - } catch (e) { - throw 'Invalid throttle specification: ' + s; - } - s = s.slice(0, i).trim(); - n = s.length; - } else throw 'Unmatched right brace: ' + s; - i = 0; - } - if (!n) throw s; - // set name flag based on first char - if (s[0] === NAME) markname = ++i; - // extract first part of multi-part stream selector - j = find(s, i, COLON); - if (j < n) { - source.push(s.substring(start, j).trim()); - start = i = ++j; - } - // extract remaining part of stream selector - i = find(s, i, LBRACK); - if (i === n) source.push(s.substring(start, n).trim()); - else { - source.push(s.substring(start, i).trim()); - filter = []; - start = ++i; - if (start === n) throw 'Unmatched left bracket: ' + s; - } - // extract filters - while(i < n){ - i = find(s, i, RBRACK); - if (i === n) throw 'Unmatched left bracket: ' + s; - filter.push(s.substring(start, i).trim()); - if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s; - start = ++i; - } - // marshall event stream specification - if (!(n = source.length) || ILLEGAL.test(source[n - 1])) throw 'Invalid event selector: ' + s; - if (n > 1) { - stream.type = source[1]; - if (markname) stream.markname = source[0].slice(1); - else if (isMarkType(source[0])) stream.marktype = source[0]; - else stream.source = source[0]; - } else stream.type = source[0]; - if (stream.type.slice(-1) === '!') { - stream.consume = true; - stream.type = stream.type.slice(0, -1); - } - if (filter != null) stream.filter = filter; - if (throttle[0]) stream.throttle = throttle[0]; - if (throttle[1]) stream.debounce = throttle[1]; - return stream; -} -function parseThrottle(s) { - const a = s.split(COMMA); - if (!s.length || a.length > 2) throw s; - return a.map((_)=>{ - const x = +_; - if (x !== x) throw s; - return x; - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lOTjG":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>(0, _base.base)); -parcelHelpers.export(exports, "use", ()=>(0, _base.use)); -parcelHelpers.export(exports, "Presenter", ()=>(0, _presenter.Presenter)); -parcelHelpers.export(exports, "ViewGl", ()=>(0, _viewGl.ViewGl)); -parcelHelpers.export(exports, "version", ()=>(0, _version.version)); -parcelHelpers.export(exports, "controls", ()=>_controls); -parcelHelpers.export(exports, "defaults", ()=>_defaults); -parcelHelpers.export(exports, "types", ()=>_types); -parcelHelpers.export(exports, "util", ()=>_util); -var _controls = require("./exports/controls"); -var _types = require("./exports/types"); -var _util = require("./exports/util"); -var _defaults = require("./defaults"); -var _base = require("./base"); -var _presenter = require("./presenter"); -var _viewGl = require("./vega-classes/viewGl"); -var _enums = require("./enums"); -parcelHelpers.exportAll(_enums, exports); -var _version = require("./version"); - -},{"./exports/controls":"lDyXE","./exports/types":"faegL","./exports/util":"4xUmx","./defaults":"c3DaF","./base":"bxBcY","./presenter":"3NoKz","./vega-classes/viewGl":"98mkQ","./enums":"dvKuu","./version":"fBSq8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lDyXE":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize variables for documentation -parcelHelpers.export(exports, "Table", ()=>(0, _controls.Table)); -var _controls = require("../controls"); - -},{"../controls":"mTToq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"mTToq":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -var _tsxCreateElement = require("tsx-create-element"); -const KeyCodes = { - ENTER: 'Enter' -}; -const Table = (props)=>{ - return (0, _tsxCreateElement.createElement)("table", { - className: props.className - }, props.children, props.rows.map((row, i)=>(0, _tsxCreateElement.createElement)("tr", { - className: props.rowClassName || '', - onClick: (e)=>props.onRowClick && props.onRowClick(e, i), - tabIndex: props.onRowClick ? 0 : -1, - onKeyUp: (e)=>{ - if (e.key === KeyCodes.ENTER && props.onRowClick) props.onRowClick(e, i); - } - }, row.cells.map((cell, i)=>(0, _tsxCreateElement.createElement)("td", { - className: cell.className || '', - title: cell.title || '' - }, cell.content))))); -}; - -},{"tsx-create-element":"9w9U8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9w9U8":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createElement", ()=>createElement); -parcelHelpers.export(exports, "addChild", ()=>addChild); -parcelHelpers.export(exports, "mount", ()=>mount); -parcelHelpers.export(exports, "findElementByChildPositions", ()=>findElementByChildPositions); -parcelHelpers.export(exports, "focusActiveElement", ()=>focusActiveElement); -parcelHelpers.export(exports, "setActiveElement", ()=>setActiveElement); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>getActiveElementInfo); -var _htmlTags = require("html-tags"); -var _svgTags = require("svg-tags"); -const htmlTagArray = _htmlTags.default || _htmlTags; -const svgTagArray = _svgTags.default || _svgTags; -/** - * Decamelizes a string with/without a custom separator (hyphen by default). - * from: https://ourcodeworld.com/articles/read/608/how-to-camelize-and-decamelize-strings-in-javascript - * - * @param str String in camelcase - * @param separator Separator for the new decamelized string. - */ function decamelize(str, separator = '-') { - return str.replace(/([a-z\d])([A-Z])/g, '$1' + separator + '$2').replace(/([A-Z]+)([A-Z][a-z\d]+)/g, '$1' + separator + '$2').toLowerCase(); -} -function createElement(tag, attrs, ...children) { - if (typeof tag === 'function') { - const fn = tag; - const props = attrs; - props.children = children; - return fn(props); - } else { - const ns = tagNamespace(tag); - const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); - const map = attrs; - let ref; - for(let name in map)if (name && map.hasOwnProperty(name)) { - let value = map[name]; - if (name === 'className' && value !== void 0) setAttribute(el, ns, 'class', value.toString()); - else if (name === 'disabled' && !value) ; - else if (value === null || value === undefined) continue; - else if (value === true) setAttribute(el, ns, name, name); - else if (typeof value === 'function') { - if (name === 'ref') ref = value; - else el[name.toLowerCase()] = value; - } else if (typeof value === 'object') setAttribute(el, ns, name, flatten(value)); - else setAttribute(el, ns, name, value.toString()); - } - if (children && children.length > 0) appendChildren(el, children); - if (ref) ref(el); - return el; - } -} -function setAttribute(el, ns, name, value) { - if (ns) el.setAttributeNS(null, name, value); - else el.setAttribute(name, value); -} -function flatten(o) { - const arr = []; - for(let prop in o)arr.push(`${decamelize(prop, '-')}:${o[prop]}`); - return arr.join(';'); -} -function addChild(parentElement, child) { - if (child === null || child === undefined || typeof child === "boolean") return; - else if (Array.isArray(child)) appendChildren(parentElement, child); - else if (isElement(child)) parentElement.appendChild(child); - else parentElement.appendChild(document.createTextNode(child.toString())); -} -function appendChildren(parentElement, children) { - children.forEach((child)=>addChild(parentElement, child)); -} -function isElement(el) { - //nodeType cannot be zero https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType - return !!el.nodeType; -} -function mount(element, container) { - container.innerHTML = ''; - if (element) addChild(container, element); -} -function findElementByChildPositions(childPositions, container) { - let element = container || document.body; - let childPosition; - while(element && childPositions.length){ - childPosition = childPositions.shift(); - element = element.children.item(childPosition); - } - if (element) return element; -} -function focusActiveElement(element, activeElementInfo) { - element.focus(); - element.scrollTop = activeElementInfo.scrollTop; - const input = element; - if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); -} -function setActiveElement(activeElementInfo, container) { - if (activeElementInfo) { - const element = findElementByChildPositions(activeElementInfo.childPositions, container); - if (element) focusActiveElement(element, activeElementInfo); + addDataPipeline(name, entries) { + if (has$1(this.data, name)) { + error("Duplicate data set name: " + $(name)); + } + return this.addData(name, DataScope.fromEntries(this, entries)); } -} -function getActiveElementInfo(container) { - let element = document.activeElement; - const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element; - const activeElementInfo = { - childPositions: [], - scrollTop, - selectionDirection, - selectionEnd, - selectionStart - }; - while(element && element !== document.body && element !== container){ - activeElementInfo.childPositions.unshift(getChildPosition(element)); - element = element.parentElement; - } - if ((element === document.body || element === container) && activeElementInfo.childPositions.length) return activeElementInfo; -} -function getChildPosition(element) { - let childPosition = 0; - while(element = element.previousElementSibling)childPosition++; - return childPosition; -} -function tagNamespace(tag) { - //issue: this won't disambiguate certain tags which exist in both svg and html: <a>, <title> ... - if (tag === 'svg' || svgTagArray.indexOf(tag) >= 0 && !(htmlTagArray.indexOf(tag) >= 0)) return "http://www.w3.org/2000/svg"; -} - -},{"html-tags":"2VCdh","svg-tags":"gZvs0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2VCdh":[function(require,module,exports,__globalThis) { -'use strict'; -module.exports = require("6c9bf1ded7f8a5a1"); - -},{"6c9bf1ded7f8a5a1":"gXRj7"}],"gXRj7":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"abbr\",\"address\",\"area\",\"article\",\"aside\",\"audio\",\"b\",\"base\",\"bdi\",\"bdo\",\"blockquote\",\"body\",\"br\",\"button\",\"canvas\",\"caption\",\"cite\",\"code\",\"col\",\"colgroup\",\"data\",\"datalist\",\"dd\",\"del\",\"details\",\"dfn\",\"dialog\",\"div\",\"dl\",\"dt\",\"em\",\"embed\",\"fieldset\",\"figcaption\",\"figure\",\"footer\",\"form\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"header\",\"hgroup\",\"hr\",\"html\",\"i\",\"iframe\",\"img\",\"input\",\"ins\",\"kbd\",\"keygen\",\"label\",\"legend\",\"li\",\"link\",\"main\",\"map\",\"mark\",\"math\",\"menu\",\"menuitem\",\"meta\",\"meter\",\"nav\",\"noscript\",\"object\",\"ol\",\"optgroup\",\"option\",\"output\",\"p\",\"param\",\"picture\",\"pre\",\"progress\",\"q\",\"rb\",\"rp\",\"rt\",\"rtc\",\"ruby\",\"s\",\"samp\",\"script\",\"section\",\"select\",\"slot\",\"small\",\"source\",\"span\",\"strong\",\"style\",\"sub\",\"summary\",\"sup\",\"svg\",\"table\",\"tbody\",\"td\",\"template\",\"textarea\",\"tfoot\",\"th\",\"thead\",\"time\",\"title\",\"tr\",\"track\",\"u\",\"ul\",\"var\",\"video\",\"wbr\"]"); - -},{}],"gZvs0":[function(require,module,exports,__globalThis) { -module.exports = require("8c03a2b8d2417863"); - -},{"8c03a2b8d2417863":"1rF1l"}],"1rF1l":[function(require,module,exports,__globalThis) { -module.exports = JSON.parse("[\"a\",\"altGlyph\",\"altGlyphDef\",\"altGlyphItem\",\"animate\",\"animateColor\",\"animateMotion\",\"animateTransform\",\"circle\",\"clipPath\",\"color-profile\",\"cursor\",\"defs\",\"desc\",\"ellipse\",\"feBlend\",\"feColorMatrix\",\"feComponentTransfer\",\"feComposite\",\"feConvolveMatrix\",\"feDiffuseLighting\",\"feDisplacementMap\",\"feDistantLight\",\"feFlood\",\"feFuncA\",\"feFuncB\",\"feFuncG\",\"feFuncR\",\"feGaussianBlur\",\"feImage\",\"feMerge\",\"feMergeNode\",\"feMorphology\",\"feOffset\",\"fePointLight\",\"feSpecularLighting\",\"feSpotLight\",\"feTile\",\"feTurbulence\",\"filter\",\"font\",\"font-face\",\"font-face-format\",\"font-face-name\",\"font-face-src\",\"font-face-uri\",\"foreignObject\",\"g\",\"glyph\",\"glyphRef\",\"hkern\",\"image\",\"line\",\"linearGradient\",\"marker\",\"mask\",\"metadata\",\"missing-glyph\",\"mpath\",\"path\",\"pattern\",\"polygon\",\"polyline\",\"radialGradient\",\"rect\",\"script\",\"set\",\"stop\",\"style\",\"svg\",\"switch\",\"symbol\",\"text\",\"textPath\",\"title\",\"tref\",\"tspan\",\"use\",\"view\",\"vkern\"]"); - -},{}],"faegL":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize interfaces for documentation -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _interfaces.MorphChartsCore)); -var _interfaces = require("../interfaces"); - -},{"../interfaces":"eYe6N","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eYe6N":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MorphChartsCore", ()=>(0, _morphcharts.Core)); -var _morphcharts = require("morphcharts"); - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lF8Ji":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Core", ()=>(0, _mainJs.Core)); -parcelHelpers.export(exports, "ModelView", ()=>(0, _mainJs.ModelView)); -parcelHelpers.export(exports, "SingleTouchAction", ()=>(0, _mainJs.SingleTouchAction)); -parcelHelpers.export(exports, "UnitType", ()=>(0, _mainJs.UnitType)); -parcelHelpers.export(exports, "Theme", ()=>(0, _mainJs.Theme)); -parcelHelpers.export(exports, "PickType", ()=>(0, _mainJs.PickType)); -parcelHelpers.export(exports, "SelectionMode", ()=>(0, _mainJs.SelectionMode)); -parcelHelpers.export(exports, "HighlightMode", ()=>(0, _mainJs.HighlightMode)); -parcelHelpers.export(exports, "FilterMode", ()=>(0, _mainJs.FilterMode)); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>(0, _mainJs.AxesTextOrientation)); -parcelHelpers.export(exports, "Orientation", ()=>(0, _mainJs.Orientation)); -parcelHelpers.export(exports, "StereoMode", ()=>(0, _mainJs.StereoMode)); -parcelHelpers.export(exports, "RenderMode", ()=>(0, _mainJs.RenderMode)); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>(0, _mainJs.HorizontalAlignment)); -parcelHelpers.export(exports, "VerticalAlignment", ()=>(0, _mainJs.VerticalAlignment)); -parcelHelpers.export(exports, "LogLevel", ()=>(0, _mainJs.LogLevel)); -parcelHelpers.export(exports, "AxesVisibility", ()=>(0, _mainJs.AxesVisibility)); -parcelHelpers.export(exports, "Edge2D", ()=>(0, _mainJs.Edge2D)); -parcelHelpers.export(exports, "Edge3D", ()=>(0, _mainJs.Edge3D)); -parcelHelpers.export(exports, "Face2D", ()=>(0, _mainJs.Face2D)); -parcelHelpers.export(exports, "Face3D", ()=>(0, _mainJs.Face3D)); -parcelHelpers.export(exports, "PaletteName", ()=>(0, _paletteJs.PaletteName)); -parcelHelpers.export(exports, "PaletteResources", ()=>(0, _paletteJs.PaletteResources)); -parcelHelpers.export(exports, "PaletteType", ()=>(0, _paletteJs.PaletteType)); -parcelHelpers.export(exports, "Config", ()=>(0, _configJs.Config)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -parcelHelpers.export(exports, "Colors", ()=>(0, _colorsJs.Colors)); -parcelHelpers.export(exports, "Font", ()=>(0, _fontJs.Font)); -parcelHelpers.export(exports, "FontRasterizer", ()=>(0, _fontJs.FontRasterizer)); -parcelHelpers.export(exports, "FontAtlas", ()=>(0, _fontJs.FontAtlas)); -parcelHelpers.export(exports, "Map", ()=>(0, _mapJs.Map)); -parcelHelpers.export(exports, "MapRasterizer", ()=>(0, _mapJs.MapRasterizer)); -parcelHelpers.export(exports, "MapAtlas", ()=>(0, _mapJs.MapAtlas)); -parcelHelpers.export(exports, "Icons", ()=>(0, _iconsJs.Icons)); -parcelHelpers.export(exports, "IconsRasterizer", ()=>(0, _iconsJs.IconsRasterizer)); -parcelHelpers.export(exports, "IconsAtlas", ()=>(0, _iconsJs.IconsAtlas)); -parcelHelpers.export(exports, "Components", ()=>_indexJs); -parcelHelpers.export(exports, "Axes", ()=>_indexJs1); -parcelHelpers.export(exports, "Helpers", ()=>_indexJs2); -parcelHelpers.export(exports, "Layouts", ()=>_indexJs3); -parcelHelpers.export(exports, "Input", ()=>_indexJs4); -parcelHelpers.export(exports, "Providers", ()=>_indexJs5); -parcelHelpers.export(exports, "Meshes", ()=>_indexJs6); -parcelHelpers.export(exports, "Renderers", ()=>_indexJs7); -parcelHelpers.export(exports, "Tables", ()=>_indexJs8); -parcelHelpers.export(exports, "Cameras", ()=>_indexJs9); -var _mainJs = require("./main.js"); -var _paletteJs = require("./palette.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _colorsJs = require("./colors.js"); -var _fontJs = require("./font.js"); -var _mapJs = require("./map.js"); -var _iconsJs = require("./icons.js"); -var _indexJs = require("./components/index.js"); -var _indexJs1 = require("./components/axes/index.js"); -var _indexJs2 = require("./helpers/index.js"); -var _indexJs3 = require("./layouts/index.js"); -var _indexJs4 = require("./input/index.js"); -var _indexJs5 = require("./providers/index.js"); -var _indexJs6 = require("./meshes/index.js"); -var _indexJs7 = require("./renderers/index.js"); -var _indexJs8 = require("./tables/index.js"); -var _indexJs9 = require("./cameras/index.js"); - -},{"./main.js":"b6Xbk","./palette.js":"a14oj","./config.js":"fYehi","./constants.js":"dHTsY","./colors.js":"8FW7c","./font.js":"fn4YW","./map.js":"edWrj","./icons.js":"6zd9W","./components/index.js":"9pN13","./components/axes/index.js":"k6xxB","./helpers/index.js":"1IX9R","./layouts/index.js":"7e7Mi","./input/index.js":"eCWft","./providers/index.js":"azoZM","./meshes/index.js":"lHwiA","./renderers/index.js":"aAH73","./tables/index.js":"kKGRB","./cameras/index.js":"faZ4P","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b6Xbk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ModelView", ()=>ModelView); -parcelHelpers.export(exports, "Core", ()=>Core); -parcelHelpers.export(exports, "CameraMode", ()=>CameraMode); -parcelHelpers.export(exports, "StereoMode", ()=>StereoMode); -parcelHelpers.export(exports, "SelectionMode", ()=>SelectionMode); -parcelHelpers.export(exports, "FilterMode", ()=>FilterMode); -parcelHelpers.export(exports, "HorizontalAlignment", ()=>HorizontalAlignment); -parcelHelpers.export(exports, "VerticalAlignment", ()=>VerticalAlignment); -parcelHelpers.export(exports, "TextAlignment", ()=>TextAlignment); -parcelHelpers.export(exports, "Orientation", ()=>Orientation); -parcelHelpers.export(exports, "AxesTextOrientation", ()=>AxesTextOrientation); -parcelHelpers.export(exports, "AxesVisibility", ()=>AxesVisibility); -parcelHelpers.export(exports, "PickType", ()=>PickType); -parcelHelpers.export(exports, "Theme", ()=>Theme); -parcelHelpers.export(exports, "HighlightMode", ()=>HighlightMode); -parcelHelpers.export(exports, "UnitType", ()=>UnitType); -parcelHelpers.export(exports, "SingleTouchAction", ()=>SingleTouchAction); -parcelHelpers.export(exports, "MouseWheelAction", ()=>MouseWheelAction); -parcelHelpers.export(exports, "LogLevel", ()=>LogLevel); -parcelHelpers.export(exports, "Edge2D", ()=>Edge2D); -parcelHelpers.export(exports, "Face2D", ()=>Face2D); -parcelHelpers.export(exports, "Edge3D", ()=>Edge3D); -parcelHelpers.export(exports, "Face3D", ()=>Face3D); -parcelHelpers.export(exports, "HexOrientation", ()=>HexOrientation); -parcelHelpers.export(exports, "RenderMode", ()=>RenderMode); -var _glMatrix = require("gl-matrix"); -var _altazimuthJs = require("./cameras/altazimuth.js"); -var _configJs = require("./config.js"); -var _constantsJs = require("./constants.js"); -var _debugJs = require("./debug.js"); -var _fpsJs = require("./fps.js"); -var _angleJs = require("./helpers/angle.js"); -var _paletteJs = require("./palette.js"); -var _controllerJs = require("./components/controller.js"); -var _matrixJs = require("./helpers/matrix.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _fontJs = require("./font.js"); -var _vertexJs = require("./vertex.js"); -var _managerJs = require("./input/manager.js"); -var _logJs = require("./log.js"); -var _mathJs = require("./helpers/math.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + }; + function propertyLambda(spec) { + return (isArray(spec) ? arrayLambda : objectLambda)(spec); + } + function arrayLambda(array2) { + const n = array2.length; + let code = "["; + for (let i = 0; i < n; ++i) { + const value2 = array2[i]; + code += (i > 0 ? "," : "") + (isObject$1(value2) ? value2.signal || propertyLambda(value2) : $(value2)); + } + return code + "]"; + } + function objectLambda(obj) { + let code = "{", i = 0, key2, value2; + for (key2 in obj) { + value2 = obj[key2]; + code += (++i > 1 ? "," : "") + $(key2) + ":" + (isObject$1(value2) ? value2.signal || propertyLambda(value2) : $(value2)); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + return code + "}"; + } + function defaults() { + const defaultFont = "sans-serif", defaultSymbolSize = 30, defaultStrokeWidth = 2, defaultColor = "#4c78a8", black = "#000", gray = "#888", lightGray = "#ddd"; + return { + // default visualization description + description: "Vega visualization", + // default padding around visualization + padding: 0, + // default for automatic sizing; options: 'none', 'pad', 'fit' + // or provide an object (e.g., {'type': 'pad', 'resize': true}) + autosize: "pad", + // default view background color + // covers the entire view component + background: null, + // default event handling configuration + // preventDefault for view-sourced event types except 'wheel' + events: { + defaults: { + allow: ["wheel"] } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class ModelView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - this.manipulationOrigin = (0, _glMatrix.vec3).create(); - this.rotation = (0, _glMatrix.quat).create(); - (0, _glMatrix.vec3).set(this.position, 0, 0, -core.config.modelDistance); - this.scale = core.config.modelSize; - } -} -class Core { - get container() { - return this._container; - } - get started() { - return this._started; - } - get debugText() { - return this._debugText; - } - get log() { - return this._log; - } - get totalFrames() { - return this._fps.totalFrames; - } - get camera() { - return this._camera; - } - set camera(value) { - this._camera = value; - } - getModelRotation(value) { - (0, _glMatrix.quat).copy(value, this._modelRotation); - } - setModelRotation(value, isSmooth) { - (0, _glMatrix.quat).copy(this._modelRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - getModelScale() { - return this._modelScale[0]; - } - setModelScale(value, isSmooth) { - (0, _glMatrix.vec3).set(this._modelScale, value, value, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); - } - getModelManipulationOrigin(value) { - (0, _glMatrix.vec3).copy(value, this._modelManipulationOrigin); - } - setModelManipulationOrigin(value) { - this._updateManipulationOrigin(value); - } - getModelPosition(value) { - (0, _glMatrix.vec3).copy(value, this._modelPosition); - } - setModelPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._modelPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - } - get webXRSession() { - return this._webXRSession; - } - get renderer() { - return this._renderer; - } - set renderer(renderer) { - if (this._renderer == renderer) return; - if (this._renderer) { - this.stop(); - this._renderer.remove(); - } - if (!renderer.isInitialized) renderer.initialize(this); - if (this._renderer) { - renderer.transitionTime = this._renderer.transitionTime; - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const previousTransitionBuffer = this._renderer.transitionBuffers[i]; - const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); - transitionBuffer.copyFrom(previousTransitionBuffer); - renderer.transitionBuffers.push(transitionBuffer); - } - const currentAxes = this._renderer.currentAxes; - if (currentAxes) { - renderer.currentAxes = []; - for(let i = 0; i < currentAxes.length; i++){ - const axesVisual = currentAxes[i]; - const axes = axesVisual.axes; - if (axes instanceof (0, _cartesian3DJs.Cartesian3dAxes)) { - const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); - renderer.currentAxes.push(cartesian3dAxesVisual); - } else if (axes instanceof (0, _cartesian2DJs.Cartesian2dAxes)) renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); - } - } - const labelSets = this._renderer.labelSets; - if (labelSets) { - renderer.labelSets = []; - for(let i = 0; i < labelSets.length; i++)renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); - } - const images = this._renderer.images; - if (images) { - renderer.images = []; - for(let i = 0; i < images.length; i++)renderer.images.push(renderer.createImageVisual(images[i].image)); - } - const fonts = this._renderer.fonts; - if (fonts) for(const key in fonts){ - const font = fonts[key].font; - renderer.fonts[font.name] = renderer.createFontVisual(font); - } - } else renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); - if (this._renderer) this._renderer.finalize(); - this._renderer = renderer; - this._fps.reset(); - this.start(); - } - get font() { - return this._font; - } - get paletteResources() { - return this._paletteResources; - } - get config() { - return this._config; - } - get inputManager() { - return this._inputManager; - } - constructor(options){ - (0, _glMatrix.glMatrix).setMatrixArrayType(Array); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat4 = (0, _glMatrix.mat4).create(); - this._container = options && options.container ? options.container : document.body; - this._config = new (0, _configJs.Config)(this); - this._log = new (0, _logJs.Log)(this); - this._debugText = new (0, _debugJs.DebugText)(); - this._inputManager = options && options.useInputManager === false ? null : new (0, _managerJs.Manager)(this); - const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { - fontAtlas: new (0, _fontJs.FontAtlas)(256, 512), - fontSize: 24, - border: 3, - fontFamily: "\"segoe ui semibold\", sans-serif", - fontWeight: "normal", - fontStyle: "normal", - baseline: "alphabetic", - maxDistance: 8, - edgeValue: 0xc0 - }; - const fontRasterizer = new (0, _fontJs.FontRasterizer)(this, fontRasterizerOptions); - this._font = fontRasterizer.font; - this._paletteResources = new (0, _paletteJs.PaletteResources)(); - this._previousTime = 0; - this._fps = new (0, _fpsJs.Fps)(this); - this._modelMMatrix = (0, _glMatrix.mat4).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelRotation = (0, _glMatrix.quat).create(); - this._modelScale = (0, _glMatrix.vec3).create(); - this._smoothedModelPosition = (0, _glMatrix.vec3).create(); - this._smoothedModelRotation = (0, _glMatrix.quat).create(); - this._smoothedModelScale = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._camera = new (0, _altazimuthJs.AltAzimuthCamera)(this); - this.resetModel(false); - } - getView(view) { - this.getModelPosition(view.position); - this.getModelRotation(view.rotation); - view.scale = this.getModelScale(); - } - setView(view, isSmooth) { - this.setModelPosition(view.position, isSmooth); - this.setModelRotation(view.rotation, isSmooth); - this.setModelScale(view.scale, isSmooth); - } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setModelPosition(this._vec3, false); - (0, _glMatrix.quat).slerp(this._quat, from.rotation, to.rotation, time); - this.setModelRotation(this._quat, false); - this.setModelScale((0, _mathJs.MathHelper).lerp(from.scale, to.scale, time), false); - } - resetModel(isSmooth) { - (0, _glMatrix.vec3).set(this._modelPosition, 0, 0, -this._config.modelDistance); - (0, _glMatrix.vec3).set(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); - (0, _glMatrix.quat).set(this._modelRotation, 0, 0, 0, 1); - if (!isSmooth) this._syncSmooth(); - } - resetManipulationOrigin() { - if (!(0, _glMatrix.vec3).exactEquals(this._modelManipulationOrigin, (0, _constantsJs.Constants).VECTOR3_ZERO)) this._updateManipulationOrigin((0, _constantsJs.Constants).VECTOR3_ZERO); - } - reset(isSmooth) { - this.resetModel(isSmooth); - this.resetManipulationOrigin(); - this._camera.reset(isSmooth); - } - start() { - if (!this._started && this._renderer) { - this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - this._started = true; - this._log.write(LogLevel.info, "render loop started"); - if (this.startCallback) this.startCallback(); + }, + // defaults for top-level group marks + // accepts mark properties (fill, stroke, etc) + // covers the data rectangle within group width/height + group: null, + // defaults for basic mark types + // each subset accepts mark properties (fill, stroke, etc) + mark: null, + arc: { + fill: defaultColor + }, + area: { + fill: defaultColor + }, + image: null, + line: { + stroke: defaultColor, + strokeWidth: defaultStrokeWidth + }, + path: { + stroke: defaultColor + }, + rect: { + fill: defaultColor + }, + rule: { + stroke: black + }, + shape: { + stroke: defaultColor + }, + symbol: { + fill: defaultColor, + size: 64 + }, + text: { + fill: black, + font: defaultFont, + fontSize: 11 + }, + trail: { + fill: defaultColor, + size: defaultStrokeWidth + }, + // style definitions + style: { + // axis & legend labels + "guide-label": { + fill: black, + font: defaultFont, + fontSize: 10 + }, + // axis & legend titles + "guide-title": { + fill: black, + font: defaultFont, + fontSize: 11, + fontWeight: "bold" + }, + // headers, including chart title + "group-title": { + fill: black, + font: defaultFont, + fontSize: 13, + fontWeight: "bold" + }, + // chart subtitle + "group-subtitle": { + fill: black, + font: defaultFont, + fontSize: 12 + }, + // defaults for styled point marks in Vega-Lite + point: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "circle" + }, + circle: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth + }, + square: { + size: defaultSymbolSize, + strokeWidth: defaultStrokeWidth, + shape: "square" + }, + // defaults for styled group marks in Vega-Lite + cell: { + fill: "transparent", + stroke: lightGray + }, + view: { + fill: "transparent" } + }, + // defaults for title + title: { + orient: "top", + anchor: "middle", + offset: 4, + subtitlePadding: 3 + }, + // defaults for axes + axis: { + minExtent: 0, + maxExtent: 200, + bandPosition: 0.5, + domain: true, + domainWidth: 1, + domainColor: gray, + grid: false, + gridWidth: 1, + gridColor: lightGray, + labels: true, + labelAngle: 0, + labelLimit: 180, + labelOffset: 0, + labelPadding: 2, + ticks: true, + tickColor: gray, + tickOffset: 0, + tickRound: true, + tickSize: 5, + tickWidth: 1, + titlePadding: 4 + }, + // correction for centering bias + axisBand: { + tickOffset: -0.5 + }, + // defaults for cartographic projection + projection: { + type: "mercator" + }, + // defaults for legends + legend: { + orient: "right", + padding: 0, + gridAlign: "each", + columnPadding: 10, + rowPadding: 2, + symbolDirection: "vertical", + gradientDirection: "vertical", + gradientLength: 200, + gradientThickness: 16, + gradientStrokeColor: lightGray, + gradientStrokeWidth: 0, + gradientLabelOffset: 2, + labelAlign: "left", + labelBaseline: "middle", + labelLimit: 160, + labelOffset: 4, + labelOverlap: true, + symbolLimit: 30, + symbolType: "circle", + symbolSize: 100, + symbolOffset: 0, + symbolStrokeWidth: 1.5, + symbolBaseFillColor: "transparent", + symbolBaseStrokeColor: gray, + titleLimit: 180, + titleOrient: "top", + titlePadding: 5, + layout: { + offset: 18, + direction: "horizontal", + left: { + direction: "vertical" + }, + right: { + direction: "vertical" + } + } + }, + // defaults for scale ranges + range: { + category: { + scheme: "tableau10" + }, + ordinal: { + scheme: "blues" + }, + heatmap: { + scheme: "yellowgreenblue" + }, + ramp: { + scheme: "blues" + }, + diverging: { + scheme: "blueorange", + extent: [1, 0] + }, + symbol: ["circle", "square", "triangle-up", "cross", "diamond", "triangle-right", "triangle-down", "triangle-left"] + } + }; + } + function parse(spec, config, options) { + if (!isObject$1(spec)) { + error("Input Vega specification must be an object."); } - stop() { - if (this._started) { - this._started = false; - if (this._windowAnimationFrame != null) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - this._log.write(LogLevel.info, "render loop stopped"); + config = mergeConfig(defaults(), config, spec.config); + return parseView(spec, new Scope(config, options)).toRuntime(); + } + var version$1 = "6.2.0"; + extend$1(transforms, tx, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf); + const version = version$1; + const vega$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + Bounds, + CanvasHandler, + CanvasRenderer, + DATE, + DAY, + DAYOFYEAR, + Dataflow, + Debug, + DisallowedObjectProperties, + Error: Error$1, + EventStream, + Gradient: Gradient$1, + GroupItem, + HOURS, + Handler, + HybridHandler, + HybridRenderer, + Info, + Item, + MILLISECONDS, + MINUTES, + MONTH, + Marks, + MultiPulse, + None: None$2, + Operator, + Parameters, + Pulse, + QUARTER, + RenderType, + Renderer, + ResourceLoader, + SECONDS, + SVGHandler, + SVGRenderer, + SVGStringRenderer, + Scenegraph, + TIME_UNITS, + Transform, + View: View$1, + WEEK, + Warn, + YEAR, + accessor, + accessorFields, + accessorName, + array: array$5, + ascending: ascending$2, + bandwidthNRD: estimateBandwidth, + bin, + bootstrapCI, + boundClip, + boundContext, + boundItem: boundItem$1, + boundMark, + boundStroke, + changeset, + clampRange, + codegenExpression: codegen, + compare: compare$1, + constant: constant$5, + cumulativeLogNormal, + cumulativeNormal, + cumulativeUniform, + dayofyear, + debounce, + defaultLocale, + definition: definition$1, + densityLogNormal, + densityNormal, + densityUniform, + domChild, + domClear, + domCreate, + domFind, + dotbin, + error, + expressionFunction, + extend: extend$1, + extent, + extentIndex, + falsy, + fastmap, + field: field$1, + flush, + font, + fontFamily, + fontSize, + format: format$2, + formatLocale: numberFormatDefaultLocale, + formats: formats$1, + hasOwnProperty: has$1, + id, + identity: identity$7, + inferType, + inferTypes, + ingest: ingest$1, + inherits, + inrange, + interpolate, + interpolateColors, + interpolateRange, + intersect: intersect$2, + intersectBoxLine, + intersectPath, + intersectPoint, + intersectRule, + isArray, + isBoolean: isBoolean$1, + isDate: isDate$1, + isFunction, + isIterable, + isNumber: isNumber$1, + isObject: isObject$1, + isRegExp, + isString, + isTuple, + key: key$2, + lerp: lerp$1, + lineHeight, + loader, + locale, + logger, + lruCache, + markup, + merge: merge$3, + mergeConfig, + multiLineOffset, + one: one$2, + pad: pad$2, + panLinear, + panLog, + panPow, + panSymlog, + parse, + parseExpression: parser$1, + parseSelector: eventSelector, + path: path$3, + pathCurves: curves, + pathEqual, + pathParse: parse$3, + pathRectangle: vg_rect, + pathRender, + pathSymbols: symbols, + pathTrail: vg_trail, + peek: peek$1, + point, + projection, + quantileLogNormal, + quantileNormal, + quantileUniform, + quantiles, + quantizeInterpolator, + quarter, + quartiles, + get random() { + return random; + }, + randomInteger: integer, + randomKDE: kde, + randomLCG: lcg$2, + randomLogNormal: lognormal, + randomMixture: mixture$1, + randomNormal: gaussian, + randomUniform: uniform, + read, + regressionConstant: constant$4, + regressionExp: exp$1, + regressionLinear: linear$2, + regressionLoess: loess, + regressionLog: log$3, + regressionPoly: poly, + regressionPow: pow$3, + regressionQuad: quad, + renderModule, + repeat, + resetDefaultLocale, + resetSVGDefIds, + responseType, + runtimeContext: context, + sampleCurve, + sampleLogNormal, + sampleNormal, + sampleUniform, + scale: scale$6, + sceneEqual, + sceneFromJSON, + scenePickVisit: pickVisit, + sceneToJSON, + sceneVisit: visit, + sceneZOrder: zorder, + scheme, + serializeXML, + setHybridRendererOptions, + setRandom, + span, + splitAccessPath, + stringValue: $, + textMetrics, + timeBin: bin$1, + timeFloor, + timeFormatLocale: timeFormatDefaultLocale, + timeInterval, + timeOffset, + timeSequence, + timeUnitSpecifier, + timeUnits, + toBoolean, + toDate, + toNumber, + toSet, + toString, + transform: transform$2, + transforms, + truncate: truncate$1, + truthy, + tupleid, + typeParsers, + utcFloor, + utcInterval, + utcOffset, + utcSequence, + utcdayofyear, + utcquarter, + utcweek, + version, + visitArray, + week, + writeConfig, + zero: zero$3, + zoomLinear, + zoomLog, + zoomPow, + zoomSymlog + }, Symbol.toStringTag, { value: "Module" })); + const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; + function decamelize(str, separator = "-") { + return str.replace(/([a-z\d])([A-Z])/g, "$1" + separator + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + separator + "$2").toLowerCase(); + } + function createElement(tag, attrs, ...children2) { + if (typeof tag === "function") { + const fn = tag; + let props = attrs; + if (props === null || props === void 0) { + props = { children: children2 }; + } else { + props.children = children2; + } + return fn(props); + } else { + const ns = tag === "svg" ? SVG_NAMESPACE : null; + const el = ns ? document.createElementNS(ns, tag) : document.createElement(tag); + const map2 = attrs; + let ref2; + for (let name in map2) { + if (name && map2.hasOwnProperty(name)) { + let value2 = map2[name]; + if (name === "className" && value2 !== void 0) { + setAttribute(el, ns, "class", value2.toString()); + } else if (name === "disabled" && !value2) ; + else if (value2 === null || value2 === void 0) { + continue; + } else if (value2 === true) { + setAttribute(el, ns, name, name); + } else if (typeof value2 === "function") { + if (name === "ref") { + ref2 = value2; + } else { + el[name.toLowerCase()] = value2; } - if (this.stopCallback) this.stopCallback(); + } else if (typeof value2 === "object") { + setAttribute(el, ns, name, flatten(value2)); + } else { + setAttribute(el, ns, name, value2.toString()); + } } + } + if (children2 && children2.length > 0) { + appendChildren(el, children2); + } + if (ref2) { + ref2(el); + } + return el; } - checkWebXRSupport() { - const xrSystem = navigator.xr; - if (xrSystem) xrSystem.isSessionSupported("immersive-vr").then((supported)=>{ - if (supported) { - this._log.write(LogLevel.info, "WebXR supported"); - if (this.webXRSupportedCallback) this.webXRSupportedCallback(); - } - }); + } + function setAttribute(el, ns, name, value2) { + if (ns) { + el.setAttributeNS(null, name, value2); + } else { + el.setAttribute(name, value2); } - requestWebXRSession() { - if (this._webXRSession) this._webXRSession.end(); - else navigator.xr.requestSession("immersive-vr").then((session)=>this._webXRSessionStarted(session)); + } + function flatten(o) { + const arr = []; + for (let prop in o) + arr.push(`${decamelize(prop, "-")}:${o[prop]}`); + return arr.join(";"); + } + function isInsideForeignObject(element2) { + let current = element2; + while (current) { + if (current.tagName.toLowerCase() === "foreignobject") { + return true; + } + current = current.parentElement; } - _webXRSessionStarted(session) { - if (this.webXRSessionStartedCallback) this.webXRSessionStartedCallback(); - this._webXRSession = session; - session.onend = ()=>this._webXRSessionEnded(); - this._renderer.initializeWebXR(session).then(()=>{ - if (this._windowAnimationFrame) { - window.cancelAnimationFrame(this._windowAnimationFrame); - this._windowAnimationFrame = null; - } - session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - }); - session.oninputsourceschange = (event)=>this._webXRInputSourcesChanged(event); + return false; + } + function recreateWithSvgNamespace(element2) { + const svgElement = document.createElementNS(SVG_NAMESPACE, element2.tagName.toLowerCase()); + for (let i = 0; i < element2.attributes.length; i++) { + const attr2 = element2.attributes[i]; + svgElement.setAttributeNS(null, attr2.name, attr2.value); + } + const eventProperties = [ + "onclick", + "onmousedown", + "onmouseup", + "onmouseover", + "onmouseout", + "onmousemove", + "onkeydown", + "onkeyup", + "onkeypress", + "onfocus", + "onblur" + ]; + for (const prop of eventProperties) { + if (element2[prop]) { + svgElement[prop] = element2[prop]; + } } - _webXRSessionEnded() { - if (this.webXRSessionEndedCallback) this.webXRSessionEndedCallback(); - this._webXRSession = null; - this._renderer.controllers.length = 0; - this.start(); - } - _webXRInputSourcesChanged(event) { - if (event.added.length > 0) { - const added = event.added[0]; - if (added.targetRayMode == "tracked-pointer") { - const profiles = added.profiles; - const handedness = added.handedness; - if (this.webXRInputSourceRequestCallback) this.webXRInputSourceRequestCallback(profiles, handedness, (response)=>{ - const options = { - profiles: profiles, - handedness: handedness, - obj: response.obj, - texture: response.texture - }; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - }, (e)=>{ - this._log.write(LogLevel.error, e); - }); - else { - const options = {}; - const controller = new (0, _controllerJs.Controller)(this, options); - this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); - } - } - } - if (event.removed.length > 0) this.renderer.controllers.length = 0; + for (let i = 0; i < element2.childNodes.length; i++) { + const child = element2.childNodes[i]; + if (child.nodeType === Node.ELEMENT_NODE) { + svgElement.appendChild(recreateWithSvgNamespace(child)); + } else { + svgElement.appendChild(child.cloneNode(true)); + } } - _tick(currentTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - let elapsedTime = currentTime - this._previousTime; - this._previousTime = currentTime; - if (elapsedTime > 0) { - this.update(elapsedTime, xrFrame); - yield this.render(elapsedTime, xrFrame); - } - if (xrFrame) xrFrame.session.requestAnimationFrame((currentTime, xrframe)=>this._tick(currentTime, xrframe)); - else if (this._started) this._windowAnimationFrame = window.requestAnimationFrame((currentTime)=>this._tick(currentTime)); - }); + return svgElement; + } + function addChild(parentElement, child) { + if (child === null || child === void 0 || typeof child === "boolean") { + return; + } else if (Array.isArray(child)) { + appendChildren(parentElement, child); + } else if (isElement(child)) { + const childEl = child; + if (parentElement.namespaceURI === SVG_NAMESPACE && childEl.namespaceURI !== SVG_NAMESPACE && childEl.tagName.toLowerCase() !== "foreignobject" && !isInsideForeignObject(parentElement)) { + const recreated = recreateWithSvgNamespace(childEl); + parentElement.appendChild(recreated); + } else { + parentElement.appendChild(childEl); + } + } else { + parentElement.appendChild(document.createTextNode(child.toString())); } - update(elapsedTime, xrFrame) { - this._renderer.setSize(elapsedTime); - if (this.updateCallback) this.updateCallback(elapsedTime, xrFrame); - if (this._config.isDebugVisible) this._debugText.clear(); - this._fps.update(elapsedTime); - if (this._inputManager) { - this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; - this._inputManager.update(elapsedTime, xrFrame); - } - let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); - amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); - amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); - this._renderer.mMatrix = this._modelMMatrix; - if (this._config.isDebugVisible) { - this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); - this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); - this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); - this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); - this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); - this._debugText.addLine(`cam fov ${Math.round((0, _angleJs.AngleHelper).radiansToDegrees(this._config.fov))}`); - this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); - } - if (!xrFrame) { - this._camera.width = this._renderer.width; - this._camera.height = this._renderer.height; - this._camera.modelMMatrix = this._modelMMatrix; - this._camera.modelPosition = this._smoothedModelPosition; - this._camera.modelRotation = this._smoothedModelRotation; - this._camera.modelScale = this._smoothedModelScale; - this._camera.modelManipulationOrigin = this._modelManipulationOrigin; - this._camera.update(elapsedTime); - this._renderer.vMatrices = this._camera.vMatrices; - this._renderer.mvMatrices = this._camera.mvMatrices; - this._renderer.pMatrices = this._camera.pMatrices; - this._renderer.inverseVMatrices = this._camera.inverseVMatrices; - this._renderer.inversePMatrices = this._camera.inversePMatrices; - } - this._renderer.prepare(xrFrame); - if (!xrFrame && this._config.stereoMode == StereoMode.none) this._renderer.pickPMatrix = this._camera.pMatrices[0]; - else { - const fov = (0, _matrixJs.MatrixHelper).fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); - (0, _glMatrix.mat4).perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); - this._renderer.pickPMatrix = this._mat4; - } - if (this._renderer.isInitialized) this._renderer.update(elapsedTime); + } + function appendChildren(parentElement, children2) { + children2.forEach((child) => addChild(parentElement, child)); + } + function isElement(el) { + return !!el.nodeType; + } + function mount(element2, container) { + container.innerHTML = ""; + if (element2) { + addChild(container, element2); } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - this._fps.render(); - if (this._renderer.isInitialized) { - yield this._renderer.render(elapsedTime, xrFrame); - if (this.afterRenderCallback) this.afterRenderCallback(); - } - }); + } + function findElementByChildPositions(childPositions, container) { + let element2 = document.body; + let childPosition; + while (element2 && childPositions.length) { + childPosition = childPositions.shift(); + element2 = element2.children.item(childPosition); } - _syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - (0, _glMatrix.vec3).copy(this._smoothedModelScale, this._modelScale); - (0, _glMatrix.quat).copy(this._smoothedModelRotation, this._modelRotation); - } - _updateManipulationOrigin(position) { - this._log.write(LogLevel.info, `manipulation origin ${position[0].toFixed(3)},${position[1].toFixed(3)},${position[2].toFixed(3)}`); - this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).copy(this._modelManipulationOrigin, position); - (0, _glMatrix.vec3).transformMat4(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); - (0, _glMatrix.vec3).subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); - (0, _glMatrix.vec3).copy(this._smoothedModelPosition, this._modelPosition); - if (this.manipulationOriginChangedCallback) { - const result = { - x: position[0], - y: position[1], - z: position[2] - }; - this.manipulationOriginChangedCallback(result); - } - } - pickLasso(x0, y0, x1, y1, pickType) { - const inverseMMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).invert(inverseMMatrix, this._modelMMatrix); - const sets = []; - const nearPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const farPositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const directions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._camera.unproject(nearPositions[0], x0, y1, -1); - this._camera.unproject(farPositions[0], x0, y1, 1); - this._camera.unproject(nearPositions[1], x1, y1, -1); - this._camera.unproject(farPositions[1], x1, y1, 1); - this._camera.unproject(nearPositions[2], x1, y0, -1); - this._camera.unproject(farPositions[2], x1, y0, 1); - this._camera.unproject(nearPositions[3], x0, y0, -1); - this._camera.unproject(farPositions[3], x0, y0, 1); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).transformMat4(nearPositions[i], nearPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).transformMat4(farPositions[i], farPositions[i], inverseMMatrix); - (0, _glMatrix.vec3).subtract(directions[i], farPositions[i], nearPositions[i]); - (0, _glMatrix.vec3).normalize(directions[i], directions[i]); - } - const normals = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - const d = []; - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).cross(normals[i], directions[(i + 1) % 4], directions[i]); - (0, _glMatrix.vec3).normalize(normals[i], normals[i]); - d.push(-(0, _glMatrix.vec3).dot(normals[i], nearPositions[i])); - } - if (pickType == PickType.data) { - const translation = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._renderer.transitionBuffers.length; i++){ - const transitionBuffer = this._renderer.transitionBuffers[i]; - const set = new Set(); - if (transitionBuffer.isVisible) { - const start = window.performance.now(); - const currentBuffer = transitionBuffer.currentBuffer; - const lookup = currentBuffer.lookup; - for(let j = 0; j < currentBuffer.length; j++){ - const id = currentBuffer.ids[j]; - const index = lookup[id]; - if (index != null) { - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, index, translation); - let isInside = true; - for(let k = 0; k < 4; k++){ - let distance = (0, _glMatrix.vec3).dot(normals[k], translation); - distance += d[k]; - if (distance < 0) { - isInside = false; - break; - } - } - if (isInside) set.add(id); - } - } - if (set.size > 0) this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set.size} ${Math.round(window.performance.now() - start)}ms`); - } - sets.push(set); - } - } - return sets; + if (element2) { + return element2; } -} -const CameraMode = { - orbit: "orbit", - altAzimuth: "altAzimuth" -}; -const StereoMode = { - none: "none", - split: "split", - anaglyph: "anaglyph", - left: "left", - right: "right" -}; -const SelectionMode = { - new: "new", - add: "add", - subtract: "subtract", - intersect: "intersect" -}; -const FilterMode = { - isolate: "isolate", - exclude: "exclude" -}; -const HorizontalAlignment = { - left: "left", - center: "center", - right: "right" -}; -const VerticalAlignment = { - top: "top", - center: "center", - bottom: "bottom" -}; -const TextAlignment = { - left: "left", - center: "center", - right: "right" -}; -const Orientation = { - horizontal: "horizontal", - vertical: "vertical" -}; -const AxesTextOrientation = { - parallel: "parallel", - perpendicular: "perpendicular" -}; -const AxesVisibility = { - none: "none", - current: "current", - previous: "previous" -}; -const PickType = { - none: 0, - data: 1, - label: 2, - axesDivision: 3, - axesTitle: 4, - axesLabel: 5, - axesHeading: 6 -}; -const Theme = { - dark: "dark", - light: "light" -}; -const HighlightMode = { - luminance: "luminance", - color: "color" -}; -const UnitType = { - block: "block", - blockSdf: "blockSdf", - boxFrameSdf: "boxFrameSdf", - sphere: "sphere", - sphereSdf: "sphereSdf", - cylinder: "cylinder", - cylinderSdf: "cylinderSdf", - hexPrism: "hexPrism", - hexPrismSdf: "hexPrismSdf", - sdf: "sdf", - disk: "disk", - ringSdf: "ringSdf" -}; -const SingleTouchAction = { - none: "none", - translate: "translate", - rotate: "rotate", - lasso: "lasso" -}; -const MouseWheelAction = { - none: "none", - zoom: "zoom", - rotateY: "rotateY" -}; -const LogLevel = { - trace: 0, - debug: 1, - info: 2, - warn: 3, - error: 4 -}; -const Edge2D = { - top: 0, - right: 1, - bottom: 2, - left: 3 -}; -const Face2D = { - front: 0, - back: 1 -}; -const Edge3D = { - topFront: 0, - topRight: 1, - topBack: 2, - topLeft: 3, - bottomFront: 4, - bottomRight: 5, - bottomBack: 6, - bottomLeft: 7, - frontRight: 8, - backRight: 9, - backLeft: 10, - frontLeft: 11 -}; -const Face3D = { - top: 0, - right: 1, - bottom: 2, - left: 3, - front: 4, - back: 5 -}; -const HexOrientation = { - pointyTop: "pointyTop", - flatTop: "flatTop" -}; -const RenderMode = { - color: "color", - hdr: "hdr", - depth: "depth", - normal: "normal", - segment: "segment", - edge: "edge" -}; - -},{"gl-matrix":"erHGu","./cameras/altazimuth.js":"48TUG","./config.js":"fYehi","./constants.js":"dHTsY","./debug.js":"lwhbM","./fps.js":"kh2PX","./helpers/angle.js":"hBXkO","./palette.js":"a14oj","./components/controller.js":"3tuGu","./helpers/matrix.js":"ffHCZ","./components/axes/cartesian3d.js":"fmvJ2","./components/axes/cartesian2d.js":"lhcyD","./font.js":"fn4YW","./vertex.js":"8lW8V","./input/manager.js":"kM2vK","./log.js":"dneJo","./helpers/math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"erHGu":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "glMatrix", ()=>_commonJs); -parcelHelpers.export(exports, "mat2", ()=>_mat2Js); -parcelHelpers.export(exports, "mat2d", ()=>_mat2DJs); -parcelHelpers.export(exports, "mat3", ()=>_mat3Js); -parcelHelpers.export(exports, "mat4", ()=>_mat4Js); -parcelHelpers.export(exports, "quat", ()=>_quatJs); -parcelHelpers.export(exports, "quat2", ()=>_quat2Js); -parcelHelpers.export(exports, "vec2", ()=>_vec2Js); -parcelHelpers.export(exports, "vec3", ()=>_vec3Js); -parcelHelpers.export(exports, "vec4", ()=>_vec4Js); -var _commonJs = require("./common.js"); -var _mat2Js = require("./mat2.js"); -var _mat2DJs = require("./mat2d.js"); -var _mat3Js = require("./mat3.js"); -var _mat4Js = require("./mat4.js"); -var _quatJs = require("./quat.js"); -var _quat2Js = require("./quat2.js"); -var _vec2Js = require("./vec2.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); - -},{"./common.js":"Li4u6","./mat2.js":false,"./mat2d.js":false,"./mat3.js":"5XUpE","./mat4.js":"jn7Bp","./quat.js":"khTmL","./quat2.js":false,"./vec2.js":"ceSVb","./vec3.js":"cAIcX","./vec4.js":"czCsm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Li4u6":[function(require,module,exports,__globalThis) { -/** - * Common utilities - * @module glMatrix - */ // Configuration Constants -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "EPSILON", ()=>EPSILON); -parcelHelpers.export(exports, "ARRAY_TYPE", ()=>ARRAY_TYPE); -parcelHelpers.export(exports, "RANDOM", ()=>RANDOM); -/** - * Sets the type of array used when creating new vectors and matrices - * - * @param {Float32ArrayConstructor | ArrayConstructor} type Array type, such as Float32Array or Array - */ parcelHelpers.export(exports, "setMatrixArrayType", ()=>setMatrixArrayType); -/** - * Convert Degree To Radian - * - * @param {Number} a Angle in Degrees - */ parcelHelpers.export(exports, "toRadian", ()=>toRadian); -/** - * Tests whether or not the arguments have approximately the same value, within an absolute - * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less - * than or equal to 1.0, and a relative tolerance is used for larger values) - * - * @param {Number} a The first number to test. - * @param {Number} b The second number to test. - * @returns {Boolean} True if the numbers are approximately equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -var EPSILON = 0.000001; -var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array; -var RANDOM = Math.random; -function setMatrixArrayType(type) { - ARRAY_TYPE = type; -} -var degree = Math.PI / 180; -function toRadian(a) { - return a * degree; -} -function equals(a, b) { - return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b)); -} -if (!Math.hypot) Math.hypot = function() { - var y = 0, i = arguments.length; - while(i--)y += arguments[i] * arguments[i]; - return Math.sqrt(y); -}; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5XUpE":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3x3 Matrix - * @module mat3 - */ /** - * Creates a new identity mat3 - * - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param {mat3} out the receiving 3x3 matrix - * @param {ReadonlyMat4} a the source 4x4 matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromMat4", ()=>fromMat4); -/** - * Creates a new mat3 initialized with values from an existing matrix - * - * @param {ReadonlyMat3} a matrix to clone - * @returns {mat3} a new 3x3 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat3 to another - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat3 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} A new mat3 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat3 to the given values - * - * @param {mat3} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m10 Component in column 1, row 0 position (index 3) - * @param {Number} m11 Component in column 1, row 1 position (index 4) - * @param {Number} m12 Component in column 1, row 2 position (index 5) - * @param {Number} m20 Component in column 2, row 0 position (index 6) - * @param {Number} m21 Component in column 2, row 1 position (index 7) - * @param {Number} m22 Component in column 2, row 2 position (index 8) - * @returns {mat3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat3 to the identity matrix - * - * @param {mat3} out the receiving matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the source matrix - * @returns {mat3} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat3 - * - * @param {ReadonlyMat3} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat3 by the given vector - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to translate - * @param {ReadonlyVec2} v vector to translate by - * @returns {mat3} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Rotates a mat3 by the given angle - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Scales the mat3 by the dimensions in the given vec2 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to rotate - * @param {ReadonlyVec2} v the vec2 to scale the matrix by - * @returns {mat3} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.translate(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Translation vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a given angle - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.rotate(dest, dest, rad); - * - * @param {mat3} out mat3 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat3.identity(dest); - * mat3.scale(dest, dest, vec); - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyVec2} v Scaling vector - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Copies the values from a mat2d into a mat3 - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat2d} a the matrix to copy - * @returns {mat3} out - **/ parcelHelpers.export(exports, "fromMat2d", ()=>fromMat2d); -/** - * Calculates a 3x3 matrix from the given quaternion - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix - * - * @param {mat3} out mat3 receiving operation result - * @param {ReadonlyMat4} a Mat4 to derive the normal matrix from - * - * @returns {mat3} out - */ parcelHelpers.export(exports, "normalFromMat4", ()=>normalFromMat4); -/** - * Generates a 2D projection matrix with the given bounds - * - * @param {mat3} out mat3 frustum matrix will be written into - * @param {number} width Width of your gl context - * @param {number} height Height of gl context - * @returns {mat3} out - */ parcelHelpers.export(exports, "projection", ()=>projection); -/** - * Returns a string representation of a mat3 - * - * @param {ReadonlyMat3} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat3 - * - * @param {ReadonlyMat3} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat3's - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @returns {mat3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat3} out the receiving matrix - * @param {ReadonlyMat3} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat3's after multiplying each element of the second operand by a scalar value. - * - * @param {mat3} out the receiving vector - * @param {ReadonlyMat3} a the first operand - * @param {ReadonlyMat3} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat3} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat3} a The first matrix. - * @param {ReadonlyMat3} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(9); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[5] = 0; - out[6] = 0; - out[7] = 0; + } + function focusActiveElement(element2, activeElementInfo) { + element2.focus(); + element2.scrollTop = activeElementInfo.scrollTop; + const input = element2; + if (input.setSelectionRange && activeElementInfo && activeElementInfo.selectionStart != null && activeElementInfo.selectionEnd != null) { + input.setSelectionRange(activeElementInfo.selectionStart, activeElementInfo.selectionEnd, activeElementInfo.selectionDirection); + } + } + function setActiveElement(activeElementInfo, container) { + if (activeElementInfo) { + const element2 = findElementByChildPositions(activeElementInfo.childPositions); + if (element2) { + focusActiveElement(element2, activeElementInfo); + } + } + } + function getActiveElementInfo(container) { + let element2 = document.activeElement; + const { scrollTop, selectionDirection, selectionEnd, selectionStart } = element2; + const activeElementInfo = { + childPositions: [], + scrollTop, + selectionDirection, + selectionEnd, + selectionStart + }; + while (element2 && element2 !== document.body && element2 !== container) { + activeElementInfo.childPositions.unshift(getChildPosition(element2)); + element2 = element2.parentElement; + } + if ((element2 === document.body || element2 === container) && activeElementInfo.childPositions.length) + return activeElementInfo; + } + function getChildPosition(element2) { + let childPosition = 0; + while (element2 = element2.previousElementSibling) + childPosition++; + return childPosition; + } + const KeyCodes = { + ENTER: "Enter" + }; + const Table = (props) => { + return createElement( + "table", + { className: props.className }, + props.children, + props.rows.map((row, i) => createElement("tr", { className: props.rowClassName || "", onClick: (e) => props.onRowClick && props.onRowClick(e, i), tabIndex: props.onRowClick ? 0 : -1, onKeyUp: (e) => { + if (e.key === KeyCodes.ENTER && props.onRowClick) { + props.onRowClick(e, i); + } + } }, row.cells.map((cell2, i2) => createElement("td", { className: cell2.className || "", title: cell2.title || "" }, cell2.content)))) + ); + }; + var EPSILON = 1e-6; + var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; + function setMatrixArrayType(type2) { + ARRAY_TYPE = type2; + } + function create$5() { + var out = new ARRAY_TYPE(9); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[5] = 0; + out[6] = 0; + out[7] = 0; } out[0] = 1; out[4] = 1; out[8] = 1; return out; -} -function fromMat4(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) { - var out = new _commonJs.ARRAY_TYPE(9); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m10; - out[4] = m11; - out[5] = m12; - out[6] = m20; - out[7] = m21; - out[8] = m22; + } + function fromMat4(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[4]; + out[4] = a2[5]; + out[5] = a2[6]; + out[6] = a2[8]; + out[7] = a2[9]; + out[8] = a2[10]; return out; -} -function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) { + } + function fromValues$5(m00, m01, m02, m10, m11, m12, m20, m21, m22) { + var out = new ARRAY_TYPE(9); out[0] = m00; out[1] = m01; out[2] = m02; @@ -49185,884 +33652,75 @@ function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) { out[7] = m21; out[8] = m22; return out; -} -function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a12 = a[5]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a01; - out[5] = a[7]; - out[6] = a02; - out[7] = a12; - } else { - out[0] = a[0]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a[1]; - out[4] = a[4]; - out[5] = a[7]; - out[6] = a[2]; - out[7] = a[5]; - out[8] = a[8]; - } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b01 = a22 * a11 - a12 * a21; - var b11 = -a22 * a10 + a12 * a20; - var b21 = a21 * a10 - a11 * a20; // Calculate the determinant - var det = a00 * b01 + a01 * b11 + a02 * b21; - if (!det) return null; - det = 1.0 / det; - out[0] = b01 * det; - out[1] = (-a22 * a01 + a02 * a21) * det; - out[2] = (a12 * a01 - a02 * a11) * det; - out[3] = b11 * det; - out[4] = (a22 * a00 - a02 * a20) * det; - out[5] = (-a12 * a00 + a02 * a10) * det; - out[6] = b21 * det; - out[7] = (-a21 * a00 + a01 * a20) * det; - out[8] = (a11 * a00 - a01 * a10) * det; - return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - out[0] = a11 * a22 - a12 * a21; - out[1] = a02 * a21 - a01 * a22; - out[2] = a01 * a12 - a02 * a11; - out[3] = a12 * a20 - a10 * a22; - out[4] = a00 * a22 - a02 * a20; - out[5] = a02 * a10 - a00 * a12; - out[6] = a10 * a21 - a11 * a20; - out[7] = a01 * a20 - a00 * a21; - out[8] = a00 * a11 - a01 * a10; - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2]; - var a10 = a[3], a11 = a[4], a12 = a[5]; - var a20 = a[6], a21 = a[7], a22 = a[8]; - var b00 = b[0], b01 = b[1], b02 = b[2]; - var b10 = b[3], b11 = b[4], b12 = b[5]; - var b20 = b[6], b21 = b[7], b22 = b[8]; - out[0] = b00 * a00 + b01 * a10 + b02 * a20; - out[1] = b00 * a01 + b01 * a11 + b02 * a21; - out[2] = b00 * a02 + b01 * a12 + b02 * a22; - out[3] = b10 * a00 + b11 * a10 + b12 * a20; - out[4] = b10 * a01 + b11 * a11 + b12 * a21; - out[5] = b10 * a02 + b11 * a12 + b12 * a22; - out[6] = b20 * a00 + b21 * a10 + b22 * a20; - out[7] = b20 * a01 + b21 * a11 + b22 * a21; - out[8] = b20 * a02 + b21 * a12 + b22 * a22; - return out; -} -function translate(out, a, v) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], x = v[0], y = v[1]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a10; - out[4] = a11; - out[5] = a12; - out[6] = x * a00 + y * a10 + a20; - out[7] = x * a01 + y * a11 + a21; - out[8] = x * a02 + y * a12 + a22; - return out; -} -function rotate(out, a, rad) { - var a00 = a[0], a01 = a[1], a02 = a[2], a10 = a[3], a11 = a[4], a12 = a[5], a20 = a[6], a21 = a[7], a22 = a[8], s = Math.sin(rad), c = Math.cos(rad); - out[0] = c * a00 + s * a10; - out[1] = c * a01 + s * a11; - out[2] = c * a02 + s * a12; - out[3] = c * a10 - s * a00; - out[4] = c * a11 - s * a01; - out[5] = c * a12 - s * a02; - out[6] = a20; - out[7] = a21; - out[8] = a22; - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1]; - out[0] = x * a[0]; - out[1] = x * a[1]; - out[2] = x * a[2]; - out[3] = y * a[3]; - out[4] = y * a[4]; - out[5] = y * a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = v[0]; - out[7] = v[1]; - out[8] = 1; - return out; -} -function fromRotation(out, rad) { - var s = Math.sin(rad), c = Math.cos(rad); - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = -s; - out[4] = c; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromScaling(out, v) { - out[0] = v[0]; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = v[1]; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -} -function fromMat2d(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = 0; - out[3] = a[2]; - out[4] = a[3]; - out[5] = 0; - out[6] = a[4]; - out[7] = a[5]; - out[8] = 1; - return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromQuat$1(out, q) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z * x22; + var zy = z * y22; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; out[0] = 1 - yy - zz; out[3] = yx - wz; out[6] = zx + wy; - out[1] = yx + wz; - out[4] = 1 - xx - zz; - out[7] = zy - wx; - out[2] = zx - wy; - out[5] = zy + wx; - out[8] = 1 - xx - yy; - return out; -} -function normalFromMat4(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - return out; -} -function projection(out, width, height) { - out[0] = 2 / width; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = -2 / height; - out[5] = 0; - out[6] = -1; - out[7] = 1; - out[8] = 1; - return out; -} -function str(a) { - return "mat3(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; + out[1] = yx + wz; + out[4] = 1 - xx - zz; + out[7] = zy - wx; + out[2] = zx - wy; + out[5] = zy + wx; + out[8] = 1 - xx - yy; return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7], a8 = a[8]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jn7Bp":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4x4 Matrix<br>Format: column-major, when typed out it looks like row-major<br>The matrices are being post multiplied. - * @module mat4 - */ /** - * Creates a new identity mat4 - * - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new mat4 initialized with values from an existing matrix - * - * @param {ReadonlyMat4} a matrix to clone - * @returns {mat4} a new 4x4 matrix - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Copy the values from one mat4 to another - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Create a new mat4 with the given values - * - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} A new mat4 - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Set the components of a mat4 to the given values - * - * @param {mat4} out the receiving matrix - * @param {Number} m00 Component in column 0, row 0 position (index 0) - * @param {Number} m01 Component in column 0, row 1 position (index 1) - * @param {Number} m02 Component in column 0, row 2 position (index 2) - * @param {Number} m03 Component in column 0, row 3 position (index 3) - * @param {Number} m10 Component in column 1, row 0 position (index 4) - * @param {Number} m11 Component in column 1, row 1 position (index 5) - * @param {Number} m12 Component in column 1, row 2 position (index 6) - * @param {Number} m13 Component in column 1, row 3 position (index 7) - * @param {Number} m20 Component in column 2, row 0 position (index 8) - * @param {Number} m21 Component in column 2, row 1 position (index 9) - * @param {Number} m22 Component in column 2, row 2 position (index 10) - * @param {Number} m23 Component in column 2, row 3 position (index 11) - * @param {Number} m30 Component in column 3, row 0 position (index 12) - * @param {Number} m31 Component in column 3, row 1 position (index 13) - * @param {Number} m32 Component in column 3, row 2 position (index 14) - * @param {Number} m33 Component in column 3, row 3 position (index 15) - * @returns {mat4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Set a mat4 to the identity matrix - * - * @param {mat4} out the receiving matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Transpose the values of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "transpose", ()=>transpose); -/** - * Inverts a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the adjugate of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the source matrix - * @returns {mat4} out - */ parcelHelpers.export(exports, "adjoint", ()=>adjoint); -/** - * Calculates the determinant of a mat4 - * - * @param {ReadonlyMat4} a the source matrix - * @returns {Number} determinant of a - */ parcelHelpers.export(exports, "determinant", ()=>determinant); -/** - * Multiplies two mat4s - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Translate a mat4 by the given vector - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to translate - * @param {ReadonlyVec3} v vector to translate by - * @returns {mat4} out - */ parcelHelpers.export(exports, "translate", ()=>translate); -/** - * Scales the mat4 by the dimensions in the given vec3 not using vectorization - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {ReadonlyVec3} v the vec3 to scale the matrix by - * @returns {mat4} out - **/ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Rotates a mat4 by the given angle around the given axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Rotates a matrix by the given angle around the X axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a matrix by the given angle around the Y axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a matrix by the given angle around the Z axis - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Creates a matrix from a vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromTranslation", ()=>fromTranslation); -/** - * Creates a matrix from a vector scaling - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.scale(dest, dest, vec); - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyVec3} v Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromScaling", ()=>fromScaling); -/** - * Creates a matrix from a given angle around a given axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotate(dest, dest, rad, axis); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @param {ReadonlyVec3} axis the axis to rotate around - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotation", ()=>fromRotation); -/** - * Creates a matrix from the given angle around the X axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateX(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromXRotation", ()=>fromXRotation); -/** - * Creates a matrix from the given angle around the Y axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateY(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromYRotation", ()=>fromYRotation); -/** - * Creates a matrix from the given angle around the Z axis - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.rotateZ(dest, dest, rad); - * - * @param {mat4} out mat4 receiving operation result - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromZRotation", ()=>fromZRotation); -/** - * Creates a matrix from a quaternion rotation and vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslation", ()=>fromRotationTranslation); -/** - * Creates a new mat4 from a dual quat. - * - * @param {mat4} out Matrix - * @param {ReadonlyQuat2} a Dual Quaternion - * @returns {mat4} mat4 receiving operation result - */ parcelHelpers.export(exports, "fromQuat2", ()=>fromQuat2); -/** - * Returns the translation vector component of a transformation - * matrix. If a matrix is built with fromRotationTranslation, - * the returned vector will be the same as the translation vector - * originally supplied. - * @param {vec3} out Vector to receive translation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getTranslation", ()=>getTranslation); -/** - * Returns the scaling factor component of a transformation - * matrix. If a matrix is built with fromRotationTranslationScale - * with a normalized Quaternion paramter, the returned vector will be - * the same as the scaling vector - * originally supplied. - * @param {vec3} out Vector to receive scaling factor component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {vec3} out - */ parcelHelpers.export(exports, "getScaling", ()=>getScaling); -/** - * Returns a quaternion representing the rotational component - * of a transformation matrix. If a matrix is built with - * fromRotationTranslation, the returned quaternion will be the - * same as the quaternion originally supplied. - * @param {quat} out Quaternion to receive the rotation component - * @param {ReadonlyMat4} mat Matrix to be decomposed (input) - * @return {quat} out - */ parcelHelpers.export(exports, "getRotation", ()=>getRotation); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScale", ()=>fromRotationTranslationScale); -/** - * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * mat4.translate(dest, origin); - * let quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * mat4.scale(dest, scale) - * mat4.translate(dest, negativeOrigin); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {ReadonlyVec3} v Translation vector - * @param {ReadonlyVec3} s Scaling vector - * @param {ReadonlyVec3} o The origin vector around which to scale and rotate - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromRotationTranslationScaleOrigin", ()=>fromRotationTranslationScaleOrigin); -/** - * Calculates a 4x4 matrix from the given quaternion - * - * @param {mat4} out mat4 receiving operation result - * @param {ReadonlyQuat} q Quaternion to create matrix from - * - * @returns {mat4} out - */ parcelHelpers.export(exports, "fromQuat", ()=>fromQuat); -/** - * Generates a frustum matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Number} left Left bound of the frustum - * @param {Number} right Right bound of the frustum - * @param {Number} bottom Bottom bound of the frustum - * @param {Number} top Top bound of the frustum - * @param {Number} near Near bound of the frustum - * @param {Number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "frustum", ()=>frustum); -/** - * Generates a perspective projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveNO", ()=>perspectiveNO); -parcelHelpers.export(exports, "perspective", ()=>perspective); -/** - * Generates a perspective projection matrix suitable for WebGPU with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * Passing null/undefined/no value for far will generate infinite projection matrix. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum, can be null or Infinity - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveZO", ()=>perspectiveZO); -/** - * Generates a perspective projection matrix with the given field of view. - * This is primarily useful for generating projection matrices to be used - * with the still experiemental WebVR API. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "perspectiveFromFieldOfView", ()=>perspectiveFromFieldOfView); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [-1, 1], - * which matches WebGL/OpenGL's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoNO", ()=>orthoNO); -parcelHelpers.export(exports, "ortho", ()=>ortho); -/** - * Generates a orthogonal projection matrix with the given bounds. - * The near/far clip planes correspond to a normalized device coordinate Z range of [0, 1], - * which matches WebGPU/Vulkan/DirectX/Metal's clip volume. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ parcelHelpers.export(exports, "orthoZO", ()=>orthoZO); -/** - * Generates a look-at matrix with the given eye position, focal point, and up axis. - * If you want a matrix that actually makes an object look at another object, you should use targetTo instead. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "lookAt", ()=>lookAt); -/** - * Generates a matrix that makes something look at something else. - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {ReadonlyVec3} eye Position of the viewer - * @param {ReadonlyVec3} center Point the viewer is looking at - * @param {ReadonlyVec3} up vec3 pointing up - * @returns {mat4} out - */ parcelHelpers.export(exports, "targetTo", ()=>targetTo); -/** - * Returns a string representation of a mat4 - * - * @param {ReadonlyMat4} a matrix to represent as a string - * @returns {String} string representation of the matrix - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns Frobenius norm of a mat4 - * - * @param {ReadonlyMat4} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ parcelHelpers.export(exports, "frob", ()=>frob); -/** - * Adds two mat4's - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts matrix b from matrix a - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @returns {mat4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiply each element of the matrix by a scalar. - * - * @param {mat4} out the receiving matrix - * @param {ReadonlyMat4} a the matrix to scale - * @param {Number} b amount to scale the matrix's elements by - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalar", ()=>multiplyScalar); -/** - * Adds two mat4's after multiplying each element of the second operand by a scalar value. - * - * @param {mat4} out the receiving vector - * @param {ReadonlyMat4} a the first operand - * @param {ReadonlyMat4} b the second operand - * @param {Number} scale the amount to scale b's elements by before adding - * @returns {mat4} out - */ parcelHelpers.export(exports, "multiplyScalarAndAdd", ()=>multiplyScalarAndAdd); -/** - * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the matrices have approximately the same elements in the same position. - * - * @param {ReadonlyMat4} a The first matrix. - * @param {ReadonlyMat4} b The second matrix. - * @returns {Boolean} True if the matrices are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "sub", ()=>sub); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(16); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; + } + function create$4() { + var out = new ARRAY_TYPE(16); + if (ARRAY_TYPE != Float32Array) { + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; } out[0] = 1; out[5] = 1; out[10] = 1; out[15] = 1; return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function fromValues(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { - var out = new _commonJs.ARRAY_TYPE(16); - out[0] = m00; - out[1] = m01; - out[2] = m02; - out[3] = m03; - out[4] = m10; - out[5] = m11; - out[6] = m12; - out[7] = m13; - out[8] = m20; - out[9] = m21; - out[10] = m22; - out[11] = m23; - out[12] = m30; - out[13] = m31; - out[14] = m32; - out[15] = m33; + } + function copy$4(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; + out[4] = a2[4]; + out[5] = a2[5]; + out[6] = a2[6]; + out[7] = a2[7]; + out[8] = a2[8]; + out[9] = a2[9]; + out[10] = a2[10]; + out[11] = a2[11]; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; return out; -} -function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + } + function fromValues$4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) { + var out = new ARRAY_TYPE(16); out[0] = m00; out[1] = m01; out[2] = m02; @@ -50080,8 +33738,8 @@ function set(out, m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m3 out[14] = m32; out[15] = m33; return out; -} -function identity(out) { + } + function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; @@ -50099,50 +33757,12 @@ function identity(out) { out[14] = 0; out[15] = 1; return out; -} -function transpose(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a03 = a[3]; - var a12 = a[6], a13 = a[7]; - var a23 = a[11]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a01; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a02; - out[9] = a12; - out[11] = a[14]; - out[12] = a03; - out[13] = a13; - out[14] = a23; - } else { - out[0] = a[0]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a[1]; - out[5] = a[5]; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a[2]; - out[9] = a[6]; - out[10] = a[10]; - out[11] = a[14]; - out[12] = a[3]; - out[13] = a[7]; - out[14] = a[11]; - out[15] = a[15]; - } - return out; -} -function invert(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + } + function invert(out, a2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; var b00 = a00 * a11 - a01 * a10; var b01 = a00 * a12 - a02 * a10; var b02 = a00 * a13 - a03 * a10; @@ -50154,10 +33774,12 @@ function invert(out, a) { var b08 = a20 * a33 - a23 * a30; var b09 = a21 * a32 - a22 * a31; var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant + var b11 = a22 * a33 - a23 * a32; var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - if (!det) return null; - det = 1.0 / det; + if (!det) { + return null; + } + det = 1 / det; out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; @@ -50175,323 +33797,106 @@ function invert(out, a) { out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; return out; -} -function adjoint(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - out[0] = a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22); - out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - out[2] = a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12); - out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - out[5] = a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22); - out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - out[7] = a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12); - out[8] = a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21); - out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - out[10] = a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11); - out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - out[13] = a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21); - out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - out[15] = a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11); - return out; -} -function determinant(a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - var b00 = a00 * a11 - a01 * a10; - var b01 = a00 * a12 - a02 * a10; - var b02 = a00 * a13 - a03 * a10; - var b03 = a01 * a12 - a02 * a11; - var b04 = a01 * a13 - a03 * a11; - var b05 = a02 * a13 - a03 * a12; - var b06 = a20 * a31 - a21 * a30; - var b07 = a20 * a32 - a22 * a30; - var b08 = a20 * a33 - a23 * a30; - var b09 = a21 * a32 - a22 * a31; - var b10 = a21 * a33 - a23 * a31; - var b11 = a22 * a33 - a23 * a32; // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -} -function multiply(out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; - var a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; - var a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; - var a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[4]; - b1 = b[5]; - b2 = b[6]; - b3 = b[7]; - out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[8]; - b1 = b[9]; - b2 = b[10]; - b3 = b[11]; - out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; - b0 = b[12]; - b1 = b[13]; - b2 = b[14]; - b3 = b[15]; - out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; - out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; - out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; - out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + } + function multiply$2(out, a2, b2) { + var a00 = a2[0], a01 = a2[1], a02 = a2[2], a03 = a2[3]; + var a10 = a2[4], a11 = a2[5], a12 = a2[6], a13 = a2[7]; + var a20 = a2[8], a21 = a2[9], a22 = a2[10], a23 = a2[11]; + var a30 = a2[12], a31 = a2[13], a32 = a2[14], a33 = a2[15]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2], b3 = b2[3]; + out[0] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[4]; + b1 = b2[5]; + b22 = b2[6]; + b3 = b2[7]; + out[4] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[8]; + b1 = b2[9]; + b22 = b2[10]; + b3 = b2[11]; + out[8] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; + b0 = b2[12]; + b1 = b2[13]; + b22 = b2[14]; + b3 = b2[15]; + out[12] = b0 * a00 + b1 * a10 + b22 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b22 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b22 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b22 * a23 + b3 * a33; return out; -} -function translate(out, a, v) { - var x = v[0], y = v[1], z = v[2]; + } + function translate(out, a2, v) { + var x2 = v[0], y2 = v[1], z = v[2]; var a00, a01, a02, a03; var a10, a11, a12, a13; var a20, a21, a22, a23; - if (a === out) { - out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + if (a2 === out) { + out[12] = a2[0] * x2 + a2[4] * y2 + a2[8] * z + a2[12]; + out[13] = a2[1] * x2 + a2[5] * y2 + a2[9] * z + a2[13]; + out[14] = a2[2] * x2 + a2[6] * y2 + a2[10] * z + a2[14]; + out[15] = a2[3] * x2 + a2[7] * y2 + a2[11] * z + a2[15]; } else { - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; - out[0] = a00; - out[1] = a01; - out[2] = a02; - out[3] = a03; - out[4] = a10; - out[5] = a11; - out[6] = a12; - out[7] = a13; - out[8] = a20; - out[9] = a21; - out[10] = a22; - out[11] = a23; - out[12] = a00 * x + a10 * y + a20 * z + a[12]; - out[13] = a01 * x + a11 * y + a21 * z + a[13]; - out[14] = a02 * x + a12 * y + a22 * z + a[14]; - out[15] = a03 * x + a13 * y + a23 * z + a[15]; - } - return out; -} -function scale(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - out[0] = a[0] * x; - out[1] = a[1] * x; - out[2] = a[2] * x; - out[3] = a[3] * x; - out[4] = a[4] * y; - out[5] = a[5] * y; - out[6] = a[6] * y; - out[7] = a[7] * y; - out[8] = a[8] * z; - out[9] = a[9] * z; - out[10] = a[10] * z; - out[11] = a[11] * z; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -} -function rotate(out, a, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - var a00, a01, a02, a03; - var a10, a11, a12, a13; - var a20, a21, a22, a23; - var b00, b01, b02; - var b10, b11, b12; - var b20, b21, b22; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; - a00 = a[0]; - a01 = a[1]; - a02 = a[2]; - a03 = a[3]; - a10 = a[4]; - a11 = a[5]; - a12 = a[6]; - a13 = a[7]; - a20 = a[8]; - a21 = a[9]; - a22 = a[10]; - a23 = a[11]; // Construct the elements of the rotation matrix - b00 = x * x * t + c; - b01 = y * x * t + z * s; - b02 = z * x * t - y * s; - b10 = x * y * t - z * s; - b11 = y * y * t + c; - b12 = z * y * t + x * s; - b20 = x * z * t + y * s; - b21 = y * z * t - x * s; - b22 = z * z * t + c; // Perform rotation-specific matrix multiplication - out[0] = a00 * b00 + a10 * b01 + a20 * b02; - out[1] = a01 * b00 + a11 * b01 + a21 * b02; - out[2] = a02 * b00 + a12 * b01 + a22 * b02; - out[3] = a03 * b00 + a13 * b01 + a23 * b02; - out[4] = a00 * b10 + a10 * b11 + a20 * b12; - out[5] = a01 * b10 + a11 * b11 + a21 * b12; - out[6] = a02 * b10 + a12 * b11 + a22 * b12; - out[7] = a03 * b10 + a13 * b11 + a23 * b12; - out[8] = a00 * b20 + a10 * b21 + a20 * b22; - out[9] = a01 * b20 + a11 * b21 + a21 * b22; - out[10] = a02 * b20 + a12 * b21 + a22 * b22; - out[11] = a03 * b20 + a13 * b21 + a23 * b22; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; + a00 = a2[0]; + a01 = a2[1]; + a02 = a2[2]; + a03 = a2[3]; + a10 = a2[4]; + a11 = a2[5]; + a12 = a2[6]; + a13 = a2[7]; + a20 = a2[8]; + a21 = a2[9]; + a22 = a2[10]; + a23 = a2[11]; + out[0] = a00; + out[1] = a01; + out[2] = a02; + out[3] = a03; + out[4] = a10; + out[5] = a11; + out[6] = a12; + out[7] = a13; + out[8] = a20; + out[9] = a21; + out[10] = a22; + out[11] = a23; + out[12] = a00 * x2 + a10 * y2 + a20 * z + a2[12]; + out[13] = a01 * x2 + a11 * y2 + a21 * z + a2[13]; + out[14] = a02 * x2 + a12 * y2 + a22 * z + a2[14]; + out[15] = a03 * x2 + a13 * y2 + a23 * z + a2[15]; } return out; -} -function rotateX(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[4] = a10 * c + a20 * s; - out[5] = a11 * c + a21 * s; - out[6] = a12 * c + a22 * s; - out[7] = a13 * c + a23 * s; - out[8] = a20 * c - a10 * s; - out[9] = a21 * c - a11 * s; - out[10] = a22 * c - a12 * s; - out[11] = a23 * c - a13 * s; - return out; -} -function rotateY(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a20 = a[8]; - var a21 = a[9]; - var a22 = a[10]; - var a23 = a[11]; - if (a !== out) { - // If the source and destination differ, copy the unchanged rows - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c - a20 * s; - out[1] = a01 * c - a21 * s; - out[2] = a02 * c - a22 * s; - out[3] = a03 * c - a23 * s; - out[8] = a00 * s + a20 * c; - out[9] = a01 * s + a21 * c; - out[10] = a02 * s + a22 * c; - out[11] = a03 * s + a23 * c; - return out; -} -function rotateZ(out, a, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); - var a00 = a[0]; - var a01 = a[1]; - var a02 = a[2]; - var a03 = a[3]; - var a10 = a[4]; - var a11 = a[5]; - var a12 = a[6]; - var a13 = a[7]; - if (a !== out) { - // If the source and destination differ, copy the unchanged last row - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } // Perform axis-specific matrix multiplication - out[0] = a00 * c + a10 * s; - out[1] = a01 * c + a11 * s; - out[2] = a02 * c + a12 * s; - out[3] = a03 * c + a13 * s; - out[4] = a10 * c - a00 * s; - out[5] = a11 * c - a01 * s; - out[6] = a12 * c - a02 * s; - out[7] = a13 * c - a03 * s; - return out; -} -function fromTranslation(out, v) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; + } + function scale$1(out, a2, v) { + var x2 = v[0], y2 = v[1], z = v[2]; + out[0] = a2[0] * x2; + out[1] = a2[1] * x2; + out[2] = a2[2] * x2; + out[3] = a2[3] * x2; + out[4] = a2[4] * y2; + out[5] = a2[5] * y2; + out[6] = a2[6] * y2; + out[7] = a2[7] * y2; + out[8] = a2[8] * z; + out[9] = a2[9] * z; + out[10] = a2[10] * z; + out[11] = a2[11] * z; + out[12] = a2[12]; + out[13] = a2[13]; + out[14] = a2[14]; + out[15] = a2[15]; return out; -} -function fromScaling(out, v) { + } + function fromScaling(out, v) { out[0] = v[0]; out[1] = 0; out[2] = 0; @@ -50509,232 +33914,24 @@ function fromScaling(out, v) { out[14] = 0; out[15] = 1; return out; -} -function fromRotation(out, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2]; - var len = Math.hypot(x, y, z); - var s, c, t; - if (len < _commonJs.EPSILON) return null; - len = 1 / len; - x *= len; - y *= len; - z *= len; - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; // Perform rotation-specific matrix multiplication - out[0] = x * x * t + c; - out[1] = y * x * t + z * s; - out[2] = z * x * t - y * s; - out[3] = 0; - out[4] = x * y * t - z * s; - out[5] = y * y * t + c; - out[6] = z * y * t + x * s; - out[7] = 0; - out[8] = x * z * t + y * s; - out[9] = y * z * t - x * s; - out[10] = z * z * t + c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromXRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = c; - out[6] = s; - out[7] = 0; - out[8] = 0; - out[9] = -s; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromYRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = 0; - out[2] = -s; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = s; - out[9] = 0; - out[10] = c; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromZRotation(out, rad) { - var s = Math.sin(rad); - var c = Math.cos(rad); // Perform axis-specific matrix multiplication - out[0] = c; - out[1] = s; - out[2] = 0; - out[3] = 0; - out[4] = -s; - out[5] = c; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -} -function fromRotationTranslation(out, q, v) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; - var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; - var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - return out; -} -function fromQuat2(out, a) { - var translation = new _commonJs.ARRAY_TYPE(3); - var bx = -a[0], by = -a[1], bz = -a[2], bw = a[3], ax = a[4], ay = a[5], az = a[6], aw = a[7]; - var magnitude = bx * bx + by * by + bz * bz + bw * bw; //Only scale if it makes sense - if (magnitude > 0) { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2 / magnitude; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2 / magnitude; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2 / magnitude; - } else { - translation[0] = (ax * bw + aw * bx + ay * bz - az * by) * 2; - translation[1] = (ay * bw + aw * by + az * bx - ax * bz) * 2; - translation[2] = (az * bw + aw * bz + ax * by - ay * bx) * 2; - } - fromRotationTranslation(out, a, translation); - return out; -} -function getTranslation(out, mat) { - out[0] = mat[12]; - out[1] = mat[13]; - out[2] = mat[14]; - return out; -} -function getScaling(out, mat) { - var m11 = mat[0]; - var m12 = mat[1]; - var m13 = mat[2]; - var m21 = mat[4]; - var m22 = mat[5]; - var m23 = mat[6]; - var m31 = mat[8]; - var m32 = mat[9]; - var m33 = mat[10]; - out[0] = Math.hypot(m11, m12, m13); - out[1] = Math.hypot(m21, m22, m23); - out[2] = Math.hypot(m31, m32, m33); - return out; -} -function getRotation(out, mat) { - var scaling = new _commonJs.ARRAY_TYPE(3); - getScaling(scaling, mat); - var is1 = 1 / scaling[0]; - var is2 = 1 / scaling[1]; - var is3 = 1 / scaling[2]; - var sm11 = mat[0] * is1; - var sm12 = mat[1] * is2; - var sm13 = mat[2] * is3; - var sm21 = mat[4] * is1; - var sm22 = mat[5] * is2; - var sm23 = mat[6] * is3; - var sm31 = mat[8] * is1; - var sm32 = mat[9] * is2; - var sm33 = mat[10] * is3; - var trace = sm11 + sm22 + sm33; - var S = 0; - if (trace > 0) { - S = Math.sqrt(trace + 1.0) * 2; - out[3] = 0.25 * S; - out[0] = (sm23 - sm32) / S; - out[1] = (sm31 - sm13) / S; - out[2] = (sm12 - sm21) / S; - } else if (sm11 > sm22 && sm11 > sm33) { - S = Math.sqrt(1.0 + sm11 - sm22 - sm33) * 2; - out[3] = (sm23 - sm32) / S; - out[0] = 0.25 * S; - out[1] = (sm12 + sm21) / S; - out[2] = (sm31 + sm13) / S; - } else if (sm22 > sm33) { - S = Math.sqrt(1.0 + sm22 - sm11 - sm33) * 2; - out[3] = (sm31 - sm13) / S; - out[0] = (sm12 + sm21) / S; - out[1] = 0.25 * S; - out[2] = (sm23 + sm32) / S; - } else { - S = Math.sqrt(1.0 + sm33 - sm11 - sm22) * 2; - out[3] = (sm12 - sm21) / S; - out[0] = (sm31 + sm13) / S; - out[1] = (sm23 + sm32) / S; - out[2] = 0.25 * S; - } - return out; -} -function fromRotationTranslationScale(out, q, v, s) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromRotationTranslationScale(out, q, v, s) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z2; + var yy = y2 * y22; + var yz = y2 * z2; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; var sx = s[0]; var sy = s[1]; - var sz = s[2]; + var sz2 = s[2]; out[0] = (1 - (yy + zz)) * sx; out[1] = (xy + wz) * sx; out[2] = (xz - wy) * sx; @@ -50743,34 +33940,33 @@ function fromRotationTranslationScale(out, q, v, s) { out[5] = (1 - (xx + zz)) * sy; out[6] = (yz + wx) * sy; out[7] = 0; - out[8] = (xz + wy) * sz; - out[9] = (yz - wx) * sz; - out[10] = (1 - (xx + yy)) * sz; + out[8] = (xz + wy) * sz2; + out[9] = (yz - wx) * sz2; + out[10] = (1 - (xx + yy)) * sz2; out[11] = 0; out[12] = v[0]; out[13] = v[1]; out[14] = v[2]; out[15] = 1; return out; -} -function fromRotationTranslationScaleOrigin(out, q, v, s, o) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromRotationTranslationScaleOrigin(out, q, v, s, o) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var xy = x * y2; - var xz = x * z2; - var yy = y * y2; - var yz = y * z2; + var xx = x2 * x22; + var xy = x2 * y22; + var xz = x2 * z2; + var yy = y2 * y22; + var yz = y2 * z2; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; var sx = s[0]; var sy = s[1]; - var sz = s[2]; + var sz2 = s[2]; var ox = o[0]; var oy = o[1]; var oz = o[2]; @@ -50780,9 +33976,9 @@ function fromRotationTranslationScaleOrigin(out, q, v, s, o) { var out4 = (xy - wz) * sy; var out5 = (1 - (xx + zz)) * sy; var out6 = (yz + wx) * sy; - var out8 = (xz + wy) * sz; - var out9 = (yz - wx) * sz; - var out10 = (1 - (xx + yy)) * sz; + var out8 = (xz + wy) * sz2; + var out9 = (yz - wx) * sz2; + var out10 = (1 - (xx + yy)) * sz2; out[0] = out0; out[1] = out1; out[2] = out2; @@ -50800,21 +33996,21 @@ function fromRotationTranslationScaleOrigin(out, q, v, s, o) { out[14] = v[2] + oz - (out2 * ox + out6 * oy + out10 * oz); out[15] = 1; return out; -} -function fromQuat(out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x + x; - var y2 = y + y; + } + function fromQuat(out, q) { + var x2 = q[0], y2 = q[1], z = q[2], w2 = q[3]; + var x22 = x2 + x2; + var y22 = y2 + y2; var z2 = z + z; - var xx = x * x2; - var yx = y * x2; - var yy = y * y2; - var zx = z * x2; - var zy = z * y2; + var xx = x2 * x22; + var yx = y2 * x22; + var yy = y2 * y22; + var zx = z * x22; + var zy = z * y22; var zz = z * z2; - var wx = w * x2; - var wy = w * y2; - var wz = w * z2; + var wx = w2 * x22; + var wy = w2 * y22; + var wz = w2 * z2; out[0] = 1 - yy - zz; out[1] = yx + wz; out[2] = zx - wy; @@ -50832,8 +34028,8 @@ function fromQuat(out, q) { out[14] = 0; out[15] = 1; return out; -} -function frustum(out, left, right, bottom, top, near, far) { + } + function frustum(out, left, right, bottom, top, near, far) { var rl = 1 / (right - left); var tb = 1 / (top - bottom); var nf = 1 / (near - far); @@ -50854,36 +34050,9 @@ function frustum(out, left, right, bottom, top, near, far) { out[14] = far * near * 2 * nf; out[15] = 0; return out; -} -function perspectiveNO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[15] = 0; - if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = (far + near) * nf; - out[14] = 2 * far * near * nf; - } else { - out[10] = -1; - out[14] = -2 * near; - } - return out; -} -var perspective = perspectiveNO; -function perspectiveZO(out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), nf; + } + function perspectiveNO(out, fovy, aspect, near, far) { + var f = 1 / Math.tan(fovy / 2); out[0] = f / aspect; out[1] = 0; out[2] = 0; @@ -50899,87 +34068,18 @@ function perspectiveZO(out, fovy, aspect, near, far) { out[13] = 0; out[15] = 0; if (far != null && far !== Infinity) { - nf = 1 / (near - far); - out[10] = far * nf; - out[14] = far * near * nf; + var nf = 1 / (near - far); + out[10] = (far + near) * nf; + out[14] = 2 * far * near * nf; } else { - out[10] = -1; - out[14] = -near; + out[10] = -1; + out[14] = -2 * near; } return out; -} -function perspectiveFromFieldOfView(out, fov, near, far) { - var upTan = Math.tan(fov.upDegrees * Math.PI / 180.0); - var downTan = Math.tan(fov.downDegrees * Math.PI / 180.0); - var leftTan = Math.tan(fov.leftDegrees * Math.PI / 180.0); - var rightTan = Math.tan(fov.rightDegrees * Math.PI / 180.0); - var xScale = 2.0 / (leftTan + rightTan); - var yScale = 2.0 / (upTan + downTan); - out[0] = xScale; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - out[4] = 0.0; - out[5] = yScale; - out[6] = 0.0; - out[7] = 0.0; - out[8] = -((leftTan - rightTan) * xScale * 0.5); - out[9] = (upTan - downTan) * yScale * 0.5; - out[10] = far / (near - far); - out[11] = -1; - out[12] = 0.0; - out[13] = 0.0; - out[14] = far * near / (near - far); - out[15] = 0.0; - return out; -} -function orthoNO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - return out; -} -var ortho = orthoNO; -function orthoZO(out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right); - var bt = 1 / (bottom - top); - var nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = near * nf; - out[15] = 1; - return out; -} -function lookAt(out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len; + } + var perspective = perspectiveNO; + function lookAt(out, eye, center, up) { + var x02, x12, x2, y02, y12, y2, z02, z1, z2, len2; var eyex = eye[0]; var eyey = eye[1]; var eyez = eye[2]; @@ -50989,402 +34089,378 @@ function lookAt(out, eye, center, up) { var centerx = center[0]; var centery = center[1]; var centerz = center[2]; - if (Math.abs(eyex - centerx) < _commonJs.EPSILON && Math.abs(eyey - centery) < _commonJs.EPSILON && Math.abs(eyez - centerz) < _commonJs.EPSILON) return identity(out); - z0 = eyex - centerx; + if (Math.abs(eyex - centerx) < EPSILON && Math.abs(eyey - centery) < EPSILON && Math.abs(eyez - centerz) < EPSILON) { + return identity(out); + } + z02 = eyex - centerx; z1 = eyey - centery; z2 = eyez - centerz; - len = 1 / Math.hypot(z0, z1, z2); - z0 *= len; - z1 *= len; - z2 *= len; - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len = Math.hypot(x0, x1, x2); - if (!len) { - x0 = 0; - x1 = 0; - x2 = 0; + len2 = 1 / Math.sqrt(z02 * z02 + z1 * z1 + z2 * z2); + z02 *= len2; + z1 *= len2; + z2 *= len2; + x02 = upy * z2 - upz * z1; + x12 = upz * z02 - upx * z2; + x2 = upx * z1 - upy * z02; + len2 = Math.sqrt(x02 * x02 + x12 * x12 + x2 * x2); + if (!len2) { + x02 = 0; + x12 = 0; + x2 = 0; } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - len = Math.hypot(y0, y1, y2); - if (!len) { - y0 = 0; - y1 = 0; - y2 = 0; + len2 = 1 / len2; + x02 *= len2; + x12 *= len2; + x2 *= len2; + } + y02 = z1 * x2 - z2 * x12; + y12 = z2 * x02 - z02 * x2; + y2 = z02 * x12 - z1 * x02; + len2 = Math.sqrt(y02 * y02 + y12 * y12 + y2 * y2); + if (!len2) { + y02 = 0; + y12 = 0; + y2 = 0; } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - out[0] = x0; - out[1] = y0; - out[2] = z0; + len2 = 1 / len2; + y02 *= len2; + y12 *= len2; + y2 *= len2; + } + out[0] = x02; + out[1] = y02; + out[2] = z02; out[3] = 0; - out[4] = x1; - out[5] = y1; + out[4] = x12; + out[5] = y12; out[6] = z1; out[7] = 0; out[8] = x2; out[9] = y2; out[10] = z2; out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); + out[12] = -(x02 * eyex + x12 * eyey + x2 * eyez); + out[13] = -(y02 * eyex + y12 * eyey + y2 * eyez); + out[14] = -(z02 * eyex + z1 * eyey + z2 * eyez); out[15] = 1; return out; -} -function targetTo(out, eye, target, up) { - var eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2]; - var z0 = eyex - target[0], z1 = eyey - target[1], z2 = eyez - target[2]; - var len = z0 * z0 + z1 * z1 + z2 * z2; - if (len > 0) { - len = 1 / Math.sqrt(len); - z0 *= len; - z1 *= len; - z2 *= len; - } - var x0 = upy * z2 - upz * z1, x1 = upz * z0 - upx * z2, x2 = upx * z1 - upy * z0; - len = x0 * x0 + x1 * x1 + x2 * x2; - if (len > 0) { - len = 1 / Math.sqrt(len); - x0 *= len; - x1 *= len; - x2 *= len; - } - out[0] = x0; - out[1] = x1; - out[2] = x2; - out[3] = 0; - out[4] = z1 * x2 - z2 * x1; - out[5] = z2 * x0 - z0 * x2; - out[6] = z0 * x1 - z1 * x0; - out[7] = 0; - out[8] = z0; - out[9] = z1; - out[10] = z2; - out[11] = 0; - out[12] = eyex; - out[13] = eyey; - out[14] = eyez; - out[15] = 1; + } + var mul = multiply$2; + function create$3() { + var out = new ARRAY_TYPE(3); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } + return out; + } + function clone$3(a2) { + var out = new ARRAY_TYPE(3); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function length(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z * z); + } + function fromValues$3(x2, y2, z) { + var out = new ARRAY_TYPE(3); + out[0] = x2; + out[1] = y2; + out[2] = z; + return out; + } + function copy$3(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + return out; + } + function set$3(out, x2, y2, z) { + out[0] = x2; + out[1] = y2; + out[2] = z; + return out; + } + function add(out, a2, b2) { + out[0] = a2[0] + b2[0]; + out[1] = a2[1] + b2[1]; + out[2] = a2[2] + b2[2]; + return out; + } + function subtract(out, a2, b2) { + out[0] = a2[0] - b2[0]; + out[1] = a2[1] - b2[1]; + out[2] = a2[2] - b2[2]; + return out; + } + function multiply$1(out, a2, b2) { + out[0] = a2[0] * b2[0]; + out[1] = a2[1] * b2[1]; + out[2] = a2[2] * b2[2]; + return out; + } + function min(out, a2, b2) { + out[0] = Math.min(a2[0], b2[0]); + out[1] = Math.min(a2[1], b2[1]); + out[2] = Math.min(a2[2], b2[2]); + return out; + } + function max(out, a2, b2) { + out[0] = Math.max(a2[0], b2[0]); + out[1] = Math.max(a2[1], b2[1]); + out[2] = Math.max(a2[2], b2[2]); + return out; + } + function scale(out, a2, b2) { + out[0] = a2[0] * b2; + out[1] = a2[1] * b2; + out[2] = a2[2] * b2; + return out; + } + function scaleAndAdd(out, a2, b2, scale2) { + out[0] = a2[0] + b2[0] * scale2; + out[1] = a2[1] + b2[1] * scale2; + out[2] = a2[2] + b2[2] * scale2; + return out; + } + function distance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z = b2[2] - a2[2]; + return Math.sqrt(x2 * x2 + y2 * y2 + z * z); + } + function squaredDistance(a2, b2) { + var x2 = b2[0] - a2[0]; + var y2 = b2[1] - a2[1]; + var z = b2[2] - a2[2]; + return x2 * x2 + y2 * y2 + z * z; + } + function squaredLength(a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + return x2 * x2 + y2 * y2 + z * z; + } + function negate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + return out; + } + function normalize$2(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + var len2 = x2 * x2 + y2 * y2 + z * z; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = a2[0] * len2; + out[1] = a2[1] * len2; + out[2] = a2[2] * len2; + return out; + } + function dot$1(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2]; + } + function cross(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2]; + var bx = b2[0], by = b2[1], bz = b2[2]; + out[0] = ay * bz - az * by; + out[1] = az * bx - ax * bz; + out[2] = ax * by - ay * bx; + return out; + } + function lerp(out, a2, b2, t) { + var ax = a2[0]; + var ay = a2[1]; + var az = a2[2]; + out[0] = ax + t * (b2[0] - ax); + out[1] = ay + t * (b2[1] - ay); + out[2] = az + t * (b2[2] - az); + return out; + } + function transformMat4$2(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z = a2[2]; + var w2 = m2[3] * x2 + m2[7] * y2 + m2[11] * z + m2[15]; + w2 = w2 || 1; + out[0] = (m2[0] * x2 + m2[4] * y2 + m2[8] * z + m2[12]) / w2; + out[1] = (m2[1] * x2 + m2[5] * y2 + m2[9] * z + m2[13]) / w2; + out[2] = (m2[2] * x2 + m2[6] * y2 + m2[10] * z + m2[14]) / w2; + return out; + } + function transformMat3(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z = a2[2]; + out[0] = x2 * m2[0] + y2 * m2[3] + z * m2[6]; + out[1] = x2 * m2[1] + y2 * m2[4] + z * m2[7]; + out[2] = x2 * m2[2] + y2 * m2[5] + z * m2[8]; + return out; + } + function transformQuat(out, a2, q) { + var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; + var vx = a2[0], vy = a2[1], vz = a2[2]; + var tx2 = qy * vz - qz * vy; + var ty2 = qz * vx - qx * vz; + var tz = qx * vy - qy * vx; + tx2 = tx2 + tx2; + ty2 = ty2 + ty2; + tz = tz + tz; + out[0] = vx + qw * tx2 + qy * tz - qz * ty2; + out[1] = vy + qw * ty2 + qz * tx2 - qx * tz; + out[2] = vz + qw * tz + qx * ty2 - qy * tx2; + return out; + } + function exactEquals$1(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2]; + } + function equals$2(a2, b2) { + var a0 = a2[0], a1 = a2[1], a22 = a2[2]; + var b0 = b2[0], b1 = b2[1], b22 = b2[2]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a22 - b22) <= EPSILON * Math.max(1, Math.abs(a22), Math.abs(b22)); + } + var len = length; + (function() { + var vec2 = create$3(); + return function(a2, stride, offset2, count2, fn, arg) { + var i, l; + if (!stride) { + stride = 3; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + fn(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + } + return a2; + }; + })(); + function create$2() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + out[3] = 0; + } + return out; + } + function clone$2(a2) { + var out = new ARRAY_TYPE(4); + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; return out; -} -function str(a) { - return "mat4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ", " + a[4] + ", " + a[5] + ", " + a[6] + ", " + a[7] + ", " + a[8] + ", " + a[9] + ", " + a[10] + ", " + a[11] + ", " + a[12] + ", " + a[13] + ", " + a[14] + ", " + a[15] + ")"; -} -function frob(a) { - return Math.hypot(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14], a[15]); -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - out[4] = a[4] + b[4]; - out[5] = a[5] + b[5]; - out[6] = a[6] + b[6]; - out[7] = a[7] + b[7]; - out[8] = a[8] + b[8]; - out[9] = a[9] + b[9]; - out[10] = a[10] + b[10]; - out[11] = a[11] + b[11]; - out[12] = a[12] + b[12]; - out[13] = a[13] + b[13]; - out[14] = a[14] + b[14]; - out[15] = a[15] + b[15]; + } + function fromValues$2(x2, y2, z, w2) { + var out = new ARRAY_TYPE(4); + out[0] = x2; + out[1] = y2; + out[2] = z; + out[3] = w2; return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - out[4] = a[4] - b[4]; - out[5] = a[5] - b[5]; - out[6] = a[6] - b[6]; - out[7] = a[7] - b[7]; - out[8] = a[8] - b[8]; - out[9] = a[9] - b[9]; - out[10] = a[10] - b[10]; - out[11] = a[11] - b[11]; - out[12] = a[12] - b[12]; - out[13] = a[13] - b[13]; - out[14] = a[14] - b[14]; - out[15] = a[15] - b[15]; + } + function copy$2(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; + out[2] = a2[2]; + out[3] = a2[3]; return out; -} -function multiplyScalar(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - out[4] = a[4] * b; - out[5] = a[5] * b; - out[6] = a[6] * b; - out[7] = a[7] * b; - out[8] = a[8] * b; - out[9] = a[9] * b; - out[10] = a[10] * b; - out[11] = a[11] * b; - out[12] = a[12] * b; - out[13] = a[13] * b; - out[14] = a[14] * b; - out[15] = a[15] * b; + } + function set$2(out, x2, y2, z, w2) { + out[0] = x2; + out[1] = y2; + out[2] = z; + out[3] = w2; return out; -} -function multiplyScalarAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - out[4] = a[4] + b[4] * scale; - out[5] = a[5] + b[5] * scale; - out[6] = a[6] + b[6] * scale; - out[7] = a[7] + b[7] * scale; - out[8] = a[8] + b[8] * scale; - out[9] = a[9] + b[9] * scale; - out[10] = a[10] + b[10] * scale; - out[11] = a[11] + b[11] * scale; - out[12] = a[12] + b[12] * scale; - out[13] = a[13] + b[13] * scale; - out[14] = a[14] + b[14] * scale; - out[15] = a[15] + b[15] * scale; + } + function normalize$1(out, a2) { + var x2 = a2[0]; + var y2 = a2[1]; + var z = a2[2]; + var w2 = a2[3]; + var len2 = x2 * x2 + y2 * y2 + z * z + w2 * w2; + if (len2 > 0) { + len2 = 1 / Math.sqrt(len2); + } + out[0] = x2 * len2; + out[1] = y2 * len2; + out[2] = z * len2; + out[3] = w2 * len2; return out; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8] && a[9] === b[9] && a[10] === b[10] && a[11] === b[11] && a[12] === b[12] && a[13] === b[13] && a[14] === b[14] && a[15] === b[15]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var a4 = a[4], a5 = a[5], a6 = a[6], a7 = a[7]; - var a8 = a[8], a9 = a[9], a10 = a[10], a11 = a[11]; - var a12 = a[12], a13 = a[13], a14 = a[14], a15 = a[15]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - var b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7]; - var b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11]; - var b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a8), Math.abs(b8)) && Math.abs(a9 - b9) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a9), Math.abs(b9)) && Math.abs(a10 - b10) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a10), Math.abs(b10)) && Math.abs(a11 - b11) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a11), Math.abs(b11)) && Math.abs(a12 - b12) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a12), Math.abs(b12)) && Math.abs(a13 - b13) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a13), Math.abs(b13)) && Math.abs(a14 - b14) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a14), Math.abs(b14)) && Math.abs(a15 - b15) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a15), Math.abs(b15)); -} -var mul = multiply; -var sub = subtract; - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"khTmL":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Quaternion - * @module quat - */ /** - * Creates a new identity quat - * - * @returns {quat} a new quaternion - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Set a quat to the identity quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "identity", ()=>identity); -/** - * Sets a quat from the given angle and rotation axis, - * then returns it. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyVec3} axis the axis around which to rotate - * @param {Number} rad the angle in radians - * @returns {quat} out - **/ parcelHelpers.export(exports, "setAxisAngle", ()=>setAxisAngle); -/** - * Gets the rotation axis and angle for a given - * quaternion. If a quaternion is created with - * setAxisAngle, this method will return the same - * values as providied in the original parameter list - * OR functionally equivalent values. - * Example: The quaternion formed by axis [0, 0, 1] and - * angle -90 is the same as the quaternion formed by - * [0, 0, 1] and 270. This method favors the latter. - * @param {vec3} out_axis Vector receiving the axis of rotation - * @param {ReadonlyQuat} q Quaternion to be decomposed - * @return {Number} Angle, in radians, of the rotation - */ parcelHelpers.export(exports, "getAxisAngle", ()=>getAxisAngle); -/** - * Gets the angular distance between two unit quaternions - * - * @param {ReadonlyQuat} a Origin unit quaternion - * @param {ReadonlyQuat} b Destination unit quaternion - * @return {Number} Angle, in radians, between the two quaternions - */ parcelHelpers.export(exports, "getAngle", ()=>getAngle); -/** - * Multiplies two quat's - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @returns {quat} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Rotates a quaternion by the given angle about the X axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotates a quaternion by the given angle about the Y axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotates a quaternion by the given angle about the Z axis - * - * @param {quat} out quat receiving operation result - * @param {ReadonlyQuat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Calculates the W component of a quat from the X, Y, and Z components. - * Assumes that quaternion is 1 unit in length. - * Any existing W component will be ignored. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate W component of - * @returns {quat} out - */ parcelHelpers.export(exports, "calculateW", ()=>calculateW); -/** - * Calculate the exponential of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "exp", ()=>exp); -/** - * Calculate the natural logarithm of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @returns {quat} out - */ parcelHelpers.export(exports, "ln", ()=>ln); -/** - * Calculate the scalar power of a unit quaternion. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate the exponential of - * @param {Number} b amount to scale the quaternion by - * @returns {quat} out - */ parcelHelpers.export(exports, "pow", ()=>pow); -/** - * Performs a spherical linear interpolation between two quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a the first operand - * @param {ReadonlyQuat} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {quat} out - */ parcelHelpers.export(exports, "slerp", ()=>slerp); -/** - * Generates a random unit quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Calculates the inverse of a quat - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate inverse of - * @returns {quat} out - */ parcelHelpers.export(exports, "invert", ()=>invert); -/** - * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyQuat} a quat to calculate conjugate of - * @returns {quat} out - */ parcelHelpers.export(exports, "conjugate", ()=>conjugate); -/** - * Creates a quaternion from the given 3x3 rotation matrix. - * - * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. - * - * @param {quat} out the receiving quaternion - * @param {ReadonlyMat3} m rotation matrix - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromMat3", ()=>fromMat3); -/** - * Creates a quaternion from the given euler angle x, y, z. - * - * @param {quat} out the receiving quaternion - * @param {x} Angle to rotate around X axis in degrees. - * @param {y} Angle to rotate around Y axis in degrees. - * @param {z} Angle to rotate around Z axis in degrees. - * @returns {quat} out - * @function - */ parcelHelpers.export(exports, "fromEuler", ()=>fromEuler); -/** - * Returns a string representation of a quatenion - * - * @param {ReadonlyQuat} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "fromValues", ()=>fromValues); -parcelHelpers.export(exports, "copy", ()=>copy); -parcelHelpers.export(exports, "set", ()=>set); -parcelHelpers.export(exports, "add", ()=>add); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "scale", ()=>scale); -parcelHelpers.export(exports, "dot", ()=>dot); -parcelHelpers.export(exports, "lerp", ()=>lerp); -parcelHelpers.export(exports, "length", ()=>length); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "normalize", ()=>normalize); -parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "rotationTo", ()=>rotationTo); -parcelHelpers.export(exports, "sqlerp", ()=>sqlerp); -parcelHelpers.export(exports, "setAxes", ()=>setAxes); -var _commonJs = require("./common.js"); -var _mat3Js = require("./mat3.js"); -var _vec3Js = require("./vec3.js"); -var _vec4Js = require("./vec4.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - out[3] = 1; + } + function dot(a2, b2) { + return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2] + a2[3] * b2[3]; + } + function transformMat4$1(out, a2, m2) { + var x2 = a2[0], y2 = a2[1], z = a2[2], w2 = a2[3]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[8] * z + m2[12] * w2; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[9] * z + m2[13] * w2; + out[2] = m2[2] * x2 + m2[6] * y2 + m2[10] * z + m2[14] * w2; + out[3] = m2[3] * x2 + m2[7] * y2 + m2[11] * z + m2[15] * w2; return out; -} -function identity(out) { - out[0] = 0; - out[1] = 0; - out[2] = 0; + } + function exactEquals(a2, b2) { + return a2[0] === b2[0] && a2[1] === b2[1] && a2[2] === b2[2] && a2[3] === b2[3]; + } + (function() { + var vec2 = create$2(); + return function(a2, stride, offset2, count2, fn, arg) { + var i, l; + if (!stride) { + stride = 4; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + vec2[2] = a2[i + 2]; + vec2[3] = a2[i + 3]; + fn(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + a2[i + 2] = vec2[2]; + a2[i + 3] = vec2[3]; + } + return a2; + }; + })(); + function create$1() { + var out = new ARRAY_TYPE(4); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; + out[2] = 0; + } out[3] = 1; return out; -} -function setAxisAngle(out, axis, rad) { + } + function setAxisAngle(out, axis, rad) { rad = rad * 0.5; var s = Math.sin(rad); out[0] = s * axis[0]; @@ -51392,6663 +34468,2077 @@ function setAxisAngle(out, axis, rad) { out[2] = s * axis[2]; out[3] = Math.cos(rad); return out; -} -function getAxisAngle(out_axis, q) { - var rad = Math.acos(q[3]) * 2.0; - var s = Math.sin(rad / 2.0); - if (s > _commonJs.EPSILON) { - out_axis[0] = q[0] / s; - out_axis[1] = q[1] / s; - out_axis[2] = q[2] / s; - } else { - // If s is zero, return any axis (no rotation - axis does not matter) - out_axis[0] = 1; - out_axis[1] = 0; - out_axis[2] = 0; - } - return rad; -} -function getAngle(a, b) { - var dotproduct = dot(a, b); - return Math.acos(2 * dotproduct * dotproduct - 1); -} -function multiply(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; + } + function multiply(out, a2, b2) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; out[0] = ax * bw + aw * bx + ay * bz - az * by; out[1] = ay * bw + aw * by + az * bx - ax * bz; out[2] = az * bw + aw * bz + ax * by - ay * bx; out[3] = aw * bw - ax * bx - ay * by - az * bz; return out; -} -function rotateX(out, a, rad) { + } + function rotateX(out, a2, rad) { rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; var bx = Math.sin(rad), bw = Math.cos(rad); out[0] = ax * bw + aw * bx; out[1] = ay * bw + az * bx; out[2] = az * bw - ay * bx; out[3] = aw * bw - ax * bx; return out; -} -function rotateY(out, a, rad) { + } + function rotateY(out, a2, rad) { rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; var by = Math.sin(rad), bw = Math.cos(rad); out[0] = ax * bw - az * by; out[1] = ay * bw + aw * by; out[2] = az * bw + ax * by; out[3] = aw * bw - ay * by; return out; -} -function rotateZ(out, a, rad) { - rad *= 0.5; - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bz = Math.sin(rad), bw = Math.cos(rad); - out[0] = ax * bw + ay * bz; - out[1] = ay * bw - ax * bz; - out[2] = az * bw + aw * bz; - out[3] = aw * bw - az * bz; - return out; -} -function calculateW(out, a) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); - return out; -} -function exp(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var et = Math.exp(w); - var s = r > 0 ? et * Math.sin(r) / r : 0; - out[0] = x * s; - out[1] = y * s; - out[2] = z * s; - out[3] = et * Math.cos(r); - return out; -} -function ln(out, a) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - var r = Math.sqrt(x * x + y * y + z * z); - var t = r > 0 ? Math.atan2(r, w) / r : 0; - out[0] = x * t; - out[1] = y * t; - out[2] = z * t; - out[3] = 0.5 * Math.log(x * x + y * y + z * z + w * w); - return out; -} -function pow(out, a, b) { - ln(out, a); - scale(out, out, b); - exp(out, out); - return out; -} -function slerp(out, a, b, t) { - // benchmarks: - // http://jsperf.com/quaternion-slerp-implementations - var ax = a[0], ay = a[1], az = a[2], aw = a[3]; - var bx = b[0], by = b[1], bz = b[2], bw = b[3]; - var omega, cosom, sinom, scale0, scale1; // calc cosine - cosom = ax * bx + ay * by + az * bz + aw * bw; // adjust signs (if necessary) - if (cosom < 0.0) { - cosom = -cosom; - bx = -bx; - by = -by; - bz = -bz; - bw = -bw; - } // calculate coefficients - if (1.0 - cosom > _commonJs.EPSILON) { - // standard case (slerp) - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; + } + function slerp(out, a2, b2, t) { + var ax = a2[0], ay = a2[1], az = a2[2], aw = a2[3]; + var bx = b2[0], by = b2[1], bz = b2[2], bw = b2[3]; + var omega, cosom, sinom, scale0, scale1; + cosom = ax * bx + ay * by + az * bz + aw * bw; + if (cosom < 0) { + cosom = -cosom; + bx = -bx; + by = -by; + bz = -bz; + bw = -bw; + } + if (1 - cosom > EPSILON) { + omega = Math.acos(cosom); + sinom = Math.sin(omega); + scale0 = Math.sin((1 - t) * omega) / sinom; + scale1 = Math.sin(t * omega) / sinom; } else { - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - scale0 = 1.0 - t; - scale1 = t; - } // calculate final values + scale0 = 1 - t; + scale1 = t; + } out[0] = scale0 * ax + scale1 * bx; out[1] = scale0 * ay + scale1 * by; out[2] = scale0 * az + scale1 * bz; out[3] = scale0 * aw + scale1 * bw; return out; -} -function random(out) { - // Implementation of http://planning.cs.uiuc.edu/node198.html - // TODO: Calling random 3 times is probably not the fastest solution - var u1 = _commonJs.RANDOM(); - var u2 = _commonJs.RANDOM(); - var u3 = _commonJs.RANDOM(); - var sqrt1MinusU1 = Math.sqrt(1 - u1); - var sqrtU1 = Math.sqrt(u1); - out[0] = sqrt1MinusU1 * Math.sin(2.0 * Math.PI * u2); - out[1] = sqrt1MinusU1 * Math.cos(2.0 * Math.PI * u2); - out[2] = sqrtU1 * Math.sin(2.0 * Math.PI * u3); - out[3] = sqrtU1 * Math.cos(2.0 * Math.PI * u3); - return out; -} -function invert(out, a) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3; - var invDot = dot ? 1.0 / dot : 0; // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - out[0] = -a0 * invDot; - out[1] = -a1 * invDot; - out[2] = -a2 * invDot; - out[3] = a3 * invDot; - return out; -} -function conjugate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a[3]; + } + function conjugate(out, a2) { + out[0] = -a2[0]; + out[1] = -a2[1]; + out[2] = -a2[2]; + out[3] = a2[3]; return out; -} -function fromMat3(out, m) { - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var fTrace = m[0] + m[4] + m[8]; + } + function fromMat3(out, m2) { + var fTrace = m2[0] + m2[4] + m2[8]; var fRoot; - if (fTrace > 0.0) { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w - out[3] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; // 1/(4w) - out[0] = (m[5] - m[7]) * fRoot; - out[1] = (m[6] - m[2]) * fRoot; - out[2] = (m[1] - m[3]) * fRoot; + if (fTrace > 0) { + fRoot = Math.sqrt(fTrace + 1); + out[3] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[0] = (m2[5] - m2[7]) * fRoot; + out[1] = (m2[6] - m2[2]) * fRoot; + out[2] = (m2[1] - m2[3]) * fRoot; } else { - // |w| <= 1/2 - var i = 0; - if (m[4] > m[0]) i = 1; - if (m[8] > m[i * 3 + i]) i = 2; - var j = (i + 1) % 3; - var k = (i + 2) % 3; - fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot; - out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot; - out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot; + var i = 0; + if (m2[4] > m2[0]) i = 1; + if (m2[8] > m2[i * 3 + i]) i = 2; + var j = (i + 1) % 3; + var k = (i + 2) % 3; + fRoot = Math.sqrt(m2[i * 3 + i] - m2[j * 3 + j] - m2[k * 3 + k] + 1); + out[i] = 0.5 * fRoot; + fRoot = 0.5 / fRoot; + out[3] = (m2[j * 3 + k] - m2[k * 3 + j]) * fRoot; + out[j] = (m2[j * 3 + i] + m2[i * 3 + j]) * fRoot; + out[k] = (m2[k * 3 + i] + m2[i * 3 + k]) * fRoot; } return out; -} -function fromEuler(out, x, y, z) { - var halfToRad = 0.5 * Math.PI / 180.0; - x *= halfToRad; - y *= halfToRad; - z *= halfToRad; - var sx = Math.sin(x); - var cx = Math.cos(x); - var sy = Math.sin(y); - var cy = Math.cos(y); - var sz = Math.sin(z); - var cz = Math.cos(z); - out[0] = sx * cy * cz - cx * sy * sz; - out[1] = cx * sy * cz + sx * cy * sz; - out[2] = cx * cy * sz - sx * sy * cz; - out[3] = cx * cy * cz + sx * sy * sz; - return out; -} -function str(a) { - return "quat(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -var clone = _vec4Js.clone; -var fromValues = _vec4Js.fromValues; -var copy = _vec4Js.copy; -var set = _vec4Js.set; -var add = _vec4Js.add; -var mul = multiply; -var scale = _vec4Js.scale; -var dot = _vec4Js.dot; -var lerp = _vec4Js.lerp; -var length = _vec4Js.length; -var len = length; -var squaredLength = _vec4Js.squaredLength; -var sqrLen = squaredLength; -var normalize = _vec4Js.normalize; -var exactEquals = _vec4Js.exactEquals; -var equals = _vec4Js.equals; -var rotationTo = function() { - var tmpvec3 = _vec3Js.create(); - var xUnitVec3 = _vec3Js.fromValues(1, 0, 0); - var yUnitVec3 = _vec3Js.fromValues(0, 1, 0); - return function(out, a, b) { - var dot = _vec3Js.dot(a, b); - if (dot < -0.999999) { - _vec3Js.cross(tmpvec3, xUnitVec3, a); - if (_vec3Js.len(tmpvec3) < 0.000001) _vec3Js.cross(tmpvec3, yUnitVec3, a); - _vec3Js.normalize(tmpvec3, tmpvec3); - setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; - } else { - _vec3Js.cross(tmpvec3, a, b); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot; - return normalize(out, out); - } - }; -}(); -var sqlerp = function() { - var temp1 = create(); - var temp2 = create(); - return function(out, a, b, c, d, t) { - slerp(temp1, a, d, t); - slerp(temp2, b, c, t); - slerp(out, temp1, temp2, 2 * t * (1 - t)); + } + var clone$1 = clone$2; + var fromValues$1 = fromValues$2; + var copy$1 = copy$2; + var set$1 = set$2; + var normalize = normalize$1; + function equals$1(a2, b2) { + return Math.abs(dot(a2, b2)) >= 1 - EPSILON; + } + var rotationTo = (function() { + var tmpvec3 = create$3(); + var xUnitVec3 = fromValues$3(1, 0, 0); + var yUnitVec3 = fromValues$3(0, 1, 0); + return function(out, a2, b2) { + var dot2 = dot$1(a2, b2); + if (dot2 < -0.999999) { + cross(tmpvec3, xUnitVec3, a2); + if (len(tmpvec3) < 1e-6) cross(tmpvec3, yUnitVec3, a2); + normalize$2(tmpvec3, tmpvec3); + setAxisAngle(out, tmpvec3, Math.PI); return out; - }; -}(); -var setAxes = function() { - var matr = _mat3Js.create(); - return function(out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - return normalize(out, fromMat3(out, matr)); - }; -}(); - -},{"./common.js":"Li4u6","./mat3.js":"5XUpE","./vec3.js":"cAIcX","./vec4.js":"czCsm","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cAIcX":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 3 Dimensional Vector - * @module vec3 - */ /** - * Creates a new, empty vec3 - * - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec3 initialized with values from an existing vector - * - * @param {ReadonlyVec3} a vector to clone - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Calculates the length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Creates a new vec3 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} a new 3D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec3 to another - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the source vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec3 to the given values - * - * @param {vec3} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to ceil - * @returns {vec3} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to floor - * @returns {vec3} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to round - * @returns {vec3} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec3 by a scalar number - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec3} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec3} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the squared length of a vec3 - * - * @param {ReadonlyVec3} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to negate - * @returns {vec3} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to invert - * @returns {vec3} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec3 - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a vector to normalize - * @returns {vec3} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec3's - * - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec3's - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Performs a hermite interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "hermite", ()=>hermite); -/** - * Performs a bezier interpolation with two control points - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the first operand - * @param {ReadonlyVec3} b the second operand - * @param {ReadonlyVec3} c the third operand - * @param {ReadonlyVec3} d the fourth operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec3} out - */ parcelHelpers.export(exports, "bezier", ()=>bezier); -/** - * Generates a random vector with the given scale - * - * @param {vec3} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec3} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec3 with a mat3. - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyMat3} m the 3x3 matrix to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec3 with a quat - * Can also be used for dual quaternions. (Multiply it with the real part) - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec3} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec3} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Rotate a 3D vector around the x-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateX", ()=>rotateX); -/** - * Rotate a 3D vector around the y-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateY", ()=>rotateY); -/** - * Rotate a 3D vector around the z-axis - * @param {vec3} out The receiving vec3 - * @param {ReadonlyVec3} a The vec3 point to rotate - * @param {ReadonlyVec3} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec3} out - */ parcelHelpers.export(exports, "rotateZ", ()=>rotateZ); -/** - * Get the angle between two 3D vectors - * @param {ReadonlyVec3} a The first operand - * @param {ReadonlyVec3} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec3 to zero - * - * @param {vec3} out the receiving vector - * @returns {vec3} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec3} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec3} a The first vector. - * @param {ReadonlyVec3} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(3); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return Math.hypot(x, y, z); -} -function fromValues(x, y, z) { - var out = new _commonJs.ARRAY_TYPE(3); - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -} -function set(out, x, y, z) { - out[0] = x; - out[1] = y; - out[2] = z; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return Math.hypot(x, y, z); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - return x * x + y * y + z * z; -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - return x * x + y * y + z * z; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var len = x * x + y * y + z * z; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -} -function cross(out, a, b) { - var ax = a[0], ay = a[1], az = a[2]; - var bx = b[0], by = b[1], bz = b[2]; - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - return out; -} -function hermite(out, a, b, c, d, t) { - var factorTimes2 = t * t; - var factor1 = factorTimes2 * (2 * t - 3) + 1; - var factor2 = factorTimes2 * (t - 2) + t; - var factor3 = factorTimes2 * (t - 1); - var factor4 = factorTimes2 * (3 - 2 * t); - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function bezier(out, a, b, c, d, t) { - var inverseFactor = 1 - t; - var inverseFactorTimesTwo = inverseFactor * inverseFactor; - var factorTimes2 = t * t; - var factor1 = inverseFactorTimesTwo * inverseFactor; - var factor2 = 3 * t * inverseFactorTimesTwo; - var factor3 = 3 * factorTimes2 * inverseFactor; - var factor4 = factorTimes2 * t; - out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; - out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; - out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - var z = _commonJs.RANDOM() * 2.0 - 1.0; - var zScale = Math.sqrt(1.0 - z * z) * scale; - out[0] = Math.cos(r) * zScale; - out[1] = Math.sin(r) * zScale; - out[2] = z * scale; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - var w = m[3] * x + m[7] * y + m[11] * z + m[15]; - w = w || 1.0; - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x * m[0] + y * m[3] + z * m[6]; - out[1] = x * m[1] + y * m[4] + z * m[7]; - out[2] = x * m[2] + y * m[5] + z * m[8]; - return out; -} -function transformQuat(out, a, q) { - // benchmarks: https://jsperf.com/quaternion-transform-vec3-implementations-fixed - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; - var x = a[0], y = a[1], z = a[2]; // var qvec = [qx, qy, qz]; - // var uv = vec3.cross([], qvec, a); - var uvx = qy * z - qz * y, uvy = qz * x - qx * z, uvz = qx * y - qy * x; // var uuv = vec3.cross([], qvec, uv); - var uuvx = qy * uvz - qz * uvy, uuvy = qz * uvx - qx * uvz, uuvz = qx * uvy - qy * uvx; // vec3.scale(uv, uv, 2 * w); - var w2 = qw * 2; - uvx *= w2; - uvy *= w2; - uvz *= w2; // vec3.scale(uuv, uuv, 2); - uuvx *= 2; - uuvy *= 2; - uuvz *= 2; // return vec3.add(out, a, vec3.add(out, uv, uuv)); - out[0] = x + uvx + uuvx; - out[1] = y + uvy + uuvy; - out[2] = z + uvz + uuvz; - return out; -} -function rotateX(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0]; - r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); - r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateY(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); - r[1] = p[1]; - r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function rotateZ(out, a, b, rad) { - var p = [], r = []; //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; //perform rotation - r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); - r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); - r[2] = p[2]; //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - return out; -} -function angle(a, b) { - var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2], mag1 = Math.sqrt(ax * ax + ay * ay + az * az), mag2 = Math.sqrt(bx * bx + by * by + bz * bz), mag = mag1 * mag2, cosine = mag && dot(a, b) / mag; - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - return out; -} -function str(a) { - return "vec3(" + a[0] + ", " + a[1] + ", " + a[2] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2]; - var b0 = b[0], b1 = b[1], b2 = b[2]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 3; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - } - return a; - }; -}(); - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"czCsm":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 4 Dimensional Vector - * @module vec4 - */ /** - * Creates a new, empty vec4 - * - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec4 initialized with values from an existing vector - * - * @param {ReadonlyVec4} a vector to clone - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec4 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} a new 4D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec4 to another - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the source vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec4 to the given values - * - * @param {vec4} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to ceil - * @returns {vec4} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to floor - * @returns {vec4} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {vec4} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to round - * @returns {vec4} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec4 by a scalar number - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec4} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec4's after scaling the second operand by a scalar value - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec4} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec4 - * - * @param {ReadonlyVec4} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to negate - * @returns {vec4} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to invert - * @returns {vec4} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec4 - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a vector to normalize - * @returns {vec4} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec4's - * - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Returns the cross-product of three vectors in a 4-dimensional space - * - * @param {ReadonlyVec4} result the receiving vector - * @param {ReadonlyVec4} U the first vector - * @param {ReadonlyVec4} V the second vector - * @param {ReadonlyVec4} W the third vector - * @returns {vec4} result - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec4's - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the first operand - * @param {ReadonlyVec4} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec4} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec4} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec4} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec4 with a mat4. - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Transforms the vec4 with a quat - * - * @param {vec4} out the receiving vector - * @param {ReadonlyVec4} a the vector to transform - * @param {ReadonlyQuat} q quaternion to transform with - * @returns {vec4} out - */ parcelHelpers.export(exports, "transformQuat", ()=>transformQuat); -/** - * Set the components of a vec4 to zero - * - * @param {vec4} out the receiving vector - * @returns {vec4} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec4} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec4} a The first vector. - * @param {ReadonlyVec4} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(4); - if (_commonJs.ARRAY_TYPE != Float32Array) { + } else if (dot2 > 0.999999) { out[0] = 0; out[1] = 0; out[2] = 0; - out[3] = 0; - } - return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function fromValues(x, y, z, w) { - var out = new _commonJs.ARRAY_TYPE(4); - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} -function set(out, x, y, z, w) { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - out[3] = a[3] * b[3]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - out[3] = a[3] / b[3]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - out[2] = Math.ceil(a[2]); - out[3] = Math.ceil(a[3]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - out[2] = Math.floor(a[2]); - out[3] = Math.floor(a[3]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - out[3] = Math.min(a[3], b[3]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - out[3] = Math.max(a[3], b[3]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - out[2] = Math.round(a[2]); - out[3] = Math.round(a[3]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - out[2] = a[2] + b[2] * scale; - out[3] = a[3] + b[3] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return Math.hypot(x, y, z, w); -} -function squaredDistance(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - var z = b[2] - a[2]; - var w = b[3] - a[3]; - return x * x + y * y + z * z + w * w; -} -function length(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return Math.hypot(x, y, z, w); -} -function squaredLength(a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - return x * x + y * y + z * z + w * w; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = -a[3]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - out[3] = 1.0 / a[3]; - return out; -} -function normalize(out, a) { - var x = a[0]; - var y = a[1]; - var z = a[2]; - var w = a[3]; - var len = x * x + y * y + z * z + w * w; - if (len > 0) len = 1 / Math.sqrt(len); - out[0] = x * len; - out[1] = y * len; - out[2] = z * len; - out[3] = w * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; -} -function cross(out, u, v, w) { - var A = v[0] * w[1] - v[1] * w[0], B = v[0] * w[2] - v[2] * w[0], C = v[0] * w[3] - v[3] * w[0], D = v[1] * w[2] - v[2] * w[1], E = v[1] * w[3] - v[3] * w[1], F = v[2] * w[3] - v[3] * w[2]; - var G = u[0]; - var H = u[1]; - var I = u[2]; - var J = u[3]; - out[0] = H * F - I * E + J * D; - out[1] = -(G * F) + I * C - J * B; - out[2] = G * E - H * C + J * A; - out[3] = -(G * D) + H * B - I * A; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0]; - var ay = a[1]; - var az = a[2]; - var aw = a[3]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - out[3] = aw + t * (b[3] - aw); - return out; -} -function random(out, scale) { - scale = scale || 1.0; // Marsaglia, George. Choosing a Point from the Surface of a - // Sphere. Ann. Math. Statist. 43 (1972), no. 2, 645--646. - // http://projecteuclid.org/euclid.aoms/1177692644; - var v1, v2, v3, v4; - var s1, s2; - do { - v1 = _commonJs.RANDOM() * 2 - 1; - v2 = _commonJs.RANDOM() * 2 - 1; - s1 = v1 * v1 + v2 * v2; - }while (s1 >= 1); - do { - v3 = _commonJs.RANDOM() * 2 - 1; - v4 = _commonJs.RANDOM() * 2 - 1; - s2 = v3 * v3 + v4 * v4; - }while (s2 >= 1); - var d = Math.sqrt((1 - s1) / s2); - out[0] = scale * v1; - out[1] = scale * v2; - out[2] = scale * v3 * d; - out[3] = scale * v4 * d; - return out; -} -function transformMat4(out, a, m) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return out; -} -function transformQuat(out, a, q) { - var x = a[0], y = a[1], z = a[2]; - var qx = q[0], qy = q[1], qz = q[2], qw = q[3]; // calculate quat * vec - var ix = qw * x + qy * z - qz * y; - var iy = qw * y + qz * x - qx * z; - var iz = qw * z + qx * y - qy * x; - var iw = -qx * x - qy * y - qz * z; // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; - out[3] = a[3]; - return out; -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; - out[2] = 0.0; - out[3] = 0.0; - return out; -} -function str(a) { - return "vec4(" + a[0] + ", " + a[1] + ", " + a[2] + ", " + a[3] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a3), Math.abs(b3)); -} -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var len = length; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 4; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - vec[2] = a[i + 2]; - vec[3] = a[i + 3]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - a[i + 2] = vec[2]; - a[i + 3] = vec[3]; - } - return a; - }; -}(); - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ceSVb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * 2 Dimensional Vector - * @module vec2 - */ /** - * Creates a new, empty vec2 - * - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "create", ()=>create); -/** - * Creates a new vec2 initialized with values from an existing vector - * - * @param {ReadonlyVec2} a vector to clone - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "clone", ()=>clone); -/** - * Creates a new vec2 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} a new 2D vector - */ parcelHelpers.export(exports, "fromValues", ()=>fromValues); -/** - * Copy the values from one vec2 to another - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the source vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "copy", ()=>copy); -/** - * Set the components of a vec2 to the given values - * - * @param {vec2} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} out - */ parcelHelpers.export(exports, "set", ()=>set); -/** - * Adds two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "add", ()=>add); -/** - * Subtracts vector b from vector a - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "subtract", ()=>subtract); -/** - * Multiplies two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "multiply", ()=>multiply); -/** - * Divides two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "divide", ()=>divide); -/** - * Math.ceil the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to ceil - * @returns {vec2} out - */ parcelHelpers.export(exports, "ceil", ()=>ceil); -/** - * Math.floor the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to floor - * @returns {vec2} out - */ parcelHelpers.export(exports, "floor", ()=>floor); -/** - * Returns the minimum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "min", ()=>min); -/** - * Returns the maximum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec2} out - */ parcelHelpers.export(exports, "max", ()=>max); -/** - * Math.round the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to round - * @returns {vec2} out - */ parcelHelpers.export(exports, "round", ()=>round); -/** - * Scales a vec2 by a scalar number - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec2} out - */ parcelHelpers.export(exports, "scale", ()=>scale); -/** - * Adds two vec2's after scaling the second operand by a scalar value - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec2} out - */ parcelHelpers.export(exports, "scaleAndAdd", ()=>scaleAndAdd); -/** - * Calculates the euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} distance between a and b - */ parcelHelpers.export(exports, "distance", ()=>distance); -/** - * Calculates the squared euclidian distance between two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} squared distance between a and b - */ parcelHelpers.export(exports, "squaredDistance", ()=>squaredDistance); -/** - * Calculates the length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate length of - * @returns {Number} length of a - */ parcelHelpers.export(exports, "length", ()=>length); -/** - * Calculates the squared length of a vec2 - * - * @param {ReadonlyVec2} a vector to calculate squared length of - * @returns {Number} squared length of a - */ parcelHelpers.export(exports, "squaredLength", ()=>squaredLength); -/** - * Negates the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to negate - * @returns {vec2} out - */ parcelHelpers.export(exports, "negate", ()=>negate); -/** - * Returns the inverse of the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to invert - * @returns {vec2} out - */ parcelHelpers.export(exports, "inverse", ()=>inverse); -/** - * Normalize a vec2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a vector to normalize - * @returns {vec2} out - */ parcelHelpers.export(exports, "normalize", ()=>normalize); -/** - * Calculates the dot product of two vec2's - * - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {Number} dot product of a and b - */ parcelHelpers.export(exports, "dot", ()=>dot); -/** - * Computes the cross product of two vec2's - * Note that the cross product must by definition produce a 3D vector - * - * @param {vec3} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @returns {vec3} out - */ parcelHelpers.export(exports, "cross", ()=>cross); -/** - * Performs a linear interpolation between two vec2's - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the first operand - * @param {ReadonlyVec2} b the second operand - * @param {Number} t interpolation amount, in the range [0-1], between the two inputs - * @returns {vec2} out - */ parcelHelpers.export(exports, "lerp", ()=>lerp); -/** - * Generates a random vector with the given scale - * - * @param {vec2} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec2} out - */ parcelHelpers.export(exports, "random", ()=>random); -/** - * Transforms the vec2 with a mat2 - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2", ()=>transformMat2); -/** - * Transforms the vec2 with a mat2d - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat2d} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat2d", ()=>transformMat2d); -/** - * Transforms the vec2 with a mat3 - * 3rd vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat3} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat3", ()=>transformMat3); -/** - * Transforms the vec2 with a mat4 - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {ReadonlyVec2} a the vector to transform - * @param {ReadonlyMat4} m matrix to transform with - * @returns {vec2} out - */ parcelHelpers.export(exports, "transformMat4", ()=>transformMat4); -/** - * Rotate a 2D vector - * @param {vec2} out The receiving vec2 - * @param {ReadonlyVec2} a The vec2 point to rotate - * @param {ReadonlyVec2} b The origin of the rotation - * @param {Number} rad The angle of rotation in radians - * @returns {vec2} out - */ parcelHelpers.export(exports, "rotate", ()=>rotate); -/** - * Get the angle between two 2D vectors - * @param {ReadonlyVec2} a The first operand - * @param {ReadonlyVec2} b The second operand - * @returns {Number} The angle in radians - */ parcelHelpers.export(exports, "angle", ()=>angle); -/** - * Set the components of a vec2 to zero - * - * @param {vec2} out the receiving vector - * @returns {vec2} out - */ parcelHelpers.export(exports, "zero", ()=>zero); -/** - * Returns a string representation of a vector - * - * @param {ReadonlyVec2} a vector to represent as a string - * @returns {String} string representation of the vector - */ parcelHelpers.export(exports, "str", ()=>str); -/** - * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===) - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "exactEquals", ()=>exactEquals); -/** - * Returns whether or not the vectors have approximately the same elements in the same position. - * - * @param {ReadonlyVec2} a The first vector. - * @param {ReadonlyVec2} b The second vector. - * @returns {Boolean} True if the vectors are equal, false otherwise. - */ parcelHelpers.export(exports, "equals", ()=>equals); -parcelHelpers.export(exports, "len", ()=>len); -parcelHelpers.export(exports, "sub", ()=>sub); -parcelHelpers.export(exports, "mul", ()=>mul); -parcelHelpers.export(exports, "div", ()=>div); -parcelHelpers.export(exports, "dist", ()=>dist); -parcelHelpers.export(exports, "sqrDist", ()=>sqrDist); -parcelHelpers.export(exports, "sqrLen", ()=>sqrLen); -parcelHelpers.export(exports, "forEach", ()=>forEach); -var _commonJs = require("./common.js"); -function create() { - var out = new _commonJs.ARRAY_TYPE(2); - if (_commonJs.ARRAY_TYPE != Float32Array) { - out[0] = 0; - out[1] = 0; + out[3] = 1; + return out; + } else { + cross(tmpvec3, a2, b2); + out[0] = tmpvec3[0]; + out[1] = tmpvec3[1]; + out[2] = tmpvec3[2]; + out[3] = 1 + dot2; + return normalize(out, out); + } + }; + })(); + (function() { + var temp1 = create$1(); + var temp2 = create$1(); + return function(out, a2, b2, c2, d, t) { + slerp(temp1, a2, d, t); + slerp(temp2, b2, c2, t); + slerp(out, temp1, temp2, 2 * t * (1 - t)); + return out; + }; + })(); + (function() { + var matr = create$5(); + return function(out, view, right, up) { + matr[0] = right[0]; + matr[3] = right[1]; + matr[6] = right[2]; + matr[1] = up[0]; + matr[4] = up[1]; + matr[7] = up[2]; + matr[2] = -view[0]; + matr[5] = -view[1]; + matr[8] = -view[2]; + return normalize(out, fromMat3(out, matr)); + }; + })(); + function create() { + var out = new ARRAY_TYPE(2); + if (ARRAY_TYPE != Float32Array) { + out[0] = 0; + out[1] = 0; } return out; -} -function clone(a) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function fromValues(x, y) { - var out = new _commonJs.ARRAY_TYPE(2); - out[0] = x; - out[1] = y; - return out; -} -function copy(out, a) { - out[0] = a[0]; - out[1] = a[1]; - return out; -} -function set(out, x, y) { - out[0] = x; - out[1] = y; - return out; -} -function add(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - return out; -} -function subtract(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - return out; -} -function multiply(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - return out; -} -function divide(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - return out; -} -function ceil(out, a) { - out[0] = Math.ceil(a[0]); - out[1] = Math.ceil(a[1]); - return out; -} -function floor(out, a) { - out[0] = Math.floor(a[0]); - out[1] = Math.floor(a[1]); - return out; -} -function min(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - return out; -} -function max(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - return out; -} -function round(out, a) { - out[0] = Math.round(a[0]); - out[1] = Math.round(a[1]); - return out; -} -function scale(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - return out; -} -function scaleAndAdd(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - return out; -} -function distance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return Math.hypot(x, y); -} -function squaredDistance(a, b) { - var x = b[0] - a[0], y = b[1] - a[1]; - return x * x + y * y; -} -function length(a) { - var x = a[0], y = a[1]; - return Math.hypot(x, y); -} -function squaredLength(a) { - var x = a[0], y = a[1]; - return x * x + y * y; -} -function negate(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - return out; -} -function inverse(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - return out; -} -function normalize(out, a) { - var x = a[0], y = a[1]; - var len = x * x + y * y; - if (len > 0) //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - return out; -} -function dot(a, b) { - return a[0] * b[0] + a[1] * b[1]; -} -function cross(out, a, b) { - var z = a[0] * b[1] - a[1] * b[0]; - out[0] = out[1] = 0; - out[2] = z; - return out; -} -function lerp(out, a, b, t) { - var ax = a[0], ay = a[1]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - return out; -} -function random(out, scale) { - scale = scale || 1.0; - var r = _commonJs.RANDOM() * 2.0 * Math.PI; - out[0] = Math.cos(r) * scale; - out[1] = Math.sin(r) * scale; - return out; -} -function transformMat2(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y; - out[1] = m[1] * x + m[3] * y; - return out; -} -function transformMat2d(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[2] * y + m[4]; - out[1] = m[1] * x + m[3] * y + m[5]; + } + function clone(a2) { + var out = new ARRAY_TYPE(2); + out[0] = a2[0]; + out[1] = a2[1]; return out; -} -function transformMat3(out, a, m) { - var x = a[0], y = a[1]; - out[0] = m[0] * x + m[3] * y + m[6]; - out[1] = m[1] * x + m[4] * y + m[7]; + } + function fromValues(x2, y2) { + var out = new ARRAY_TYPE(2); + out[0] = x2; + out[1] = y2; return out; -} -function transformMat4(out, a, m) { - var x = a[0]; - var y = a[1]; - out[0] = m[0] * x + m[4] * y + m[12]; - out[1] = m[1] * x + m[5] * y + m[13]; + } + function copy(out, a2) { + out[0] = a2[0]; + out[1] = a2[1]; return out; -} -function rotate(out, a, b, rad) { - //Translate point to the origin - var p0 = a[0] - b[0], p1 = a[1] - b[1], sinC = Math.sin(rad), cosC = Math.cos(rad); //perform rotation and translate to correct position - out[0] = p0 * cosC - p1 * sinC + b[0]; - out[1] = p0 * sinC + p1 * cosC + b[1]; + } + function set(out, x2, y2) { + out[0] = x2; + out[1] = y2; return out; -} -function angle(a, b) { - var x1 = a[0], y1 = a[1], x2 = b[0], y2 = b[1], // mag is the product of the magnitudes of a and b - mag = Math.sqrt(x1 * x1 + y1 * y1) * Math.sqrt(x2 * x2 + y2 * y2), // mag &&.. short circuits if mag == 0 - cosine = mag && (x1 * x2 + y1 * y2) / mag; // Math.min(Math.max(cosine, -1), 1) clamps the cosine between -1 and 1 - return Math.acos(Math.min(Math.max(cosine, -1), 1)); -} -function zero(out) { - out[0] = 0.0; - out[1] = 0.0; + } + function transformMat4(out, a2, m2) { + var x2 = a2[0]; + var y2 = a2[1]; + out[0] = m2[0] * x2 + m2[4] * y2 + m2[12]; + out[1] = m2[1] * x2 + m2[5] * y2 + m2[13]; return out; -} -function str(a) { - return "vec2(" + a[0] + ", " + a[1] + ")"; -} -function exactEquals(a, b) { - return a[0] === b[0] && a[1] === b[1]; -} -function equals(a, b) { - var a0 = a[0], a1 = a[1]; - var b0 = b[0], b1 = b[1]; - return Math.abs(a0 - b0) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= _commonJs.EPSILON * Math.max(1.0, Math.abs(a1), Math.abs(b1)); -} -var len = length; -var sub = subtract; -var mul = multiply; -var div = divide; -var dist = distance; -var sqrDist = squaredDistance; -var sqrLen = squaredLength; -var forEach = function() { - var vec = create(); - return function(a, stride, offset, count, fn, arg) { - var i, l; - if (!stride) stride = 2; - if (!offset) offset = 0; - if (count) l = Math.min(count * stride + offset, a.length); - else l = a.length; - for(i = offset; i < l; i += stride){ - vec[0] = a[i]; - vec[1] = a[i + 1]; - fn(vec, vec, arg); - a[i] = vec[0]; - a[i + 1] = vec[1]; - } - return a; - }; -}(); - -},{"./common.js":"Li4u6","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"48TUG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>AltAzimuthCameraView); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>AltAzimuthCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _cameraJs = require("./camera.js"); -class AltAzimuthCameraView extends (0, _cameraJs.CameraView) { - constructor(core){ - super(core); - this.fov = core.config.fov; - this.altitude = 0; - this.azimuth = 0; - } -} -class AltAzimuthCamera extends (0, _cameraJs.CameraBase) { - getView(view) { - super.getView(view); - view.altitude = this.altitude; - view.azimuth = this.azimuth; - view.fov = this._core.config.fov; - } - setView(view, isSmooth) { - super.setView(view, isSmooth); - this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); - this._core.config.fov = view.fov; - } - lerpView(from, to, time) { - super.lerpView(from, to, time); - this.setAltAzimuth((0, _mathJs.MathHelper).lerp(from.altitude, to.altitude, time), (0, _mathJs.MathHelper).lerp(from.azimuth, to.azimuth, time), false); - this._core.config.fov = (0, _mathJs.MathHelper).lerp(from.fov, to.fov, time); - } - update(elapsedTime) { - super.update(elapsedTime); - if (this._core.config.isDebugVisible) { - const altitude = (0, _angleJs.AngleHelper).radiansToDegrees(this.altitude); - const azimuth = (0, _angleJs.AngleHelper).radiansToDegrees(this.azimuth); - this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); - this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); - } - } - get altitude() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITY, this._up, this._right); - } - get azimuth() { - (0, _glMatrix.vec3).transformQuat(this._up, (0, _constantsJs.Constants).VECTOR3_UNITY, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._right, (0, _constantsJs.Constants).VECTOR3_UNITX, this._combinedRotation); - return -(0, _angleJs.AngleHelper).signedAngleBetweenVectors((0, _constantsJs.Constants).VECTOR3_UNITX, this._right, this._up); - } - setAltAzimuth(altitude, azimuth, isSmooth) { - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, altitude); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, azimuth); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - if (!isSmooth) this.syncSmooth(); - } - rotate(translationDelta) { - const length = Math.min(this.width, this.height); - let angle = translationDelta[1] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - angle = translationDelta[0] * (0, _constantsJs.Constants).PI / length; - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._orbitRotation, this._quat); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/angle.js":"hBXkO","../helpers/math.js":"6Lv1i","./camera.js":"1KLf3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dHTsY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -var _glMatrix = require("gl-matrix"); -class Constants { -} -Constants.TWO_PI = 6.283185307179586; -Constants.PI = 3.141592653589793; -Constants.PI_OVER_TWO = 1.5707963267948966; -Constants.PI_OVER_THREE = 1.0471975511965976; -Constants.PI_OVER_FOUR = 0.7853981633974483; -Constants.PI_OVER_SIX = 0.5235987755982988; -Constants.LOG_2 = 0.6931471805599453; -Constants.RADIANS_PER_DEGREE = 0.017453292519943295; -Constants.DEGREES_PER_RADIAN = 57.29577951308232; -Constants.ROOT_TWO = 1.4142135623730951; -Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; -Constants.ROOT_THREE = 1.7320508075688772; -Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; -Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; -Constants.VECTOR2_ZERO = (0, _glMatrix.vec2).fromValues(0, 0); -Constants.VECTOR2_ONE = (0, _glMatrix.vec2).fromValues(1, 1); -Constants.VECTOR2_UNITX = (0, _glMatrix.vec2).fromValues(1, 0); -Constants.VECTOR2_UNITY = (0, _glMatrix.vec2).fromValues(0, 1); -Constants.VECTOR3_ZERO = (0, _glMatrix.vec3).fromValues(0, 0, 0); -Constants.VECTOR3_ONE = (0, _glMatrix.vec3).fromValues(1, 1, 1); -Constants.VECTOR3_UNITX = (0, _glMatrix.vec3).fromValues(1, 0, 0); -Constants.VECTOR3_UNITY = (0, _glMatrix.vec3).fromValues(0, 1, 0); -Constants.VECTOR3_UNITZ = (0, _glMatrix.vec3).fromValues(0, 0, 1); -Constants.VECTOR3_REFLECTX = (0, _glMatrix.vec3).fromValues(1, -1, -1); -Constants.VECTOR3_REFLECTY = (0, _glMatrix.vec3).fromValues(-1, 1, -1); -Constants.VECTOR3_REFLECTZ = (0, _glMatrix.vec3).fromValues(-1, -1, 1); -Constants.VECTOR4_ZERO = (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); -Constants.VECTOR4_ONE = (0, _glMatrix.vec4).fromValues(1, 1, 1, 1); -Constants.VECTOR4_UNITX = (0, _glMatrix.vec4).fromValues(1, 0, 0, 0); -Constants.VECTOR4_UNITY = (0, _glMatrix.vec4).fromValues(0, 1, 0, 0); -Constants.VECTOR4_UNITZ = (0, _glMatrix.vec4).fromValues(0, 0, 1, 0); -Constants.VECTOR4_UNITW = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); -Constants.MAT3_IDENTITY = (0, _glMatrix.mat3).create(); -Constants.MAT4_IDENTITY = (0, _glMatrix.mat4).create(); -Constants.MAT4_ROTATION_MINUS_90 = (0, _glMatrix.mat4).fromValues(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); -Constants.QUAT_IDENTITY = (0, _glMatrix.quat).create(); -Constants.QUAT_ROTATEX_PLUS_90 = (0, _glMatrix.quat).fromValues(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEX_MINUS_90 = (0, _glMatrix.quat).fromValues(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_PLUS_90 = (0, _glMatrix.quat).fromValues(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEY_MINUS_90 = (0, _glMatrix.quat).fromValues(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_PLUS_90 = (0, _glMatrix.quat).fromValues(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.QUAT_ROTATEZ_MINUS_90 = (0, _glMatrix.quat).fromValues(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); -Constants.MILLISECONDS_PER_DAY = 86400000; - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hBXkO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>AngleHelper); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("./math.js"); -var _constantsJs = require("../constants.js"); -class AngleHelper { - static degreesToRadians(degrees) { - return degrees * (0, _constantsJs.Constants).RADIANS_PER_DEGREE; - } - static radiansToDegrees(radians) { - return radians * (0, _constantsJs.Constants).DEGREES_PER_RADIAN; - } - static wrapAngle(angle) { - if (angle > (0, _constantsJs.Constants).PI) angle = angle - (0, _constantsJs.Constants).TWO_PI; - else if (angle < -(0, _constantsJs.Constants).PI) angle += (0, _constantsJs.Constants).TWO_PI; - return angle; - } - static sphericalToCartesian(altitude, longitude, latitude, result) { - latitude = AngleHelper.degreesToRadians(latitude); - longitude = AngleHelper.degreesToRadians(longitude); - const scale = Math.cos(latitude); - result[0] = altitude * scale * Math.sin(longitude); - result[1] = altitude * Math.sin(latitude); - result[2] = altitude * scale * Math.cos(longitude); - } - static cartesianToSpherical(x, y, z, result) { - result[0] = Math.atan2(x, z); - result[1] = Math.asin(y); - } - static angleBetweenVectors(from, to) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - return Math.acos(dot); - } - } - static signedAngleBetweenVectors(from, to, up) { - if ((0, _glMatrix.vec3).exactEquals(from, to)) return 0; - else { - const dot = (0, _mathJs.MathHelper).clamp((0, _glMatrix.vec3).dot(from, to), -1, 1); - let angle = Math.acos(dot); - (0, _glMatrix.vec3).cross(AngleHelper._vec3, from, to); - if ((0, _glMatrix.vec3).dot(AngleHelper._vec3, up) < 0) angle = -angle; - return angle; - } - } -} -AngleHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","./math.js":"6Lv1i","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6Lv1i":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MathHelper", ()=>MathHelper); -parcelHelpers.export(exports, "PseudoRandom", ()=>PseudoRandom); -class MathHelper { - static simpleLinearRegression(points) { - const n = points.length; - let sumX = 0; - let sumY = 0; - let sumXY = 0; - let sumXX = 0; - for(let i = 0; i < n; i++){ - sumX += points[i].x; - sumY += points[i].y; - sumXY += points[i].x * points[i].y; - sumXX += points[i].x * points[i].x; - } - const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); - const yIntercept = (sumY - slope * sumX) / n; - return { - slope, - yIntercept - }; - } - static clamp(value, min, max) { - return Math.max(Math.min(value, max), min); - } - static lerp(value1, value2, amount) { - return value1 + (value2 - value1) * amount; - } - static normalize(value, min, max, from = 0, to = 1) { - return max - min == 0 ? 0 : Math.max(Math.min((to - from) * (value - min) / (max - min) + from, to), from); - } - static splitExponent(value, result) { - let exponent = Math.round(Math.log10(Math.abs(value))); - let coefficient = value / Math.pow(10, exponent); - if (coefficient < 1) { - coefficient *= 10; - exponent--; - } - result[0] = coefficient; - result[1] = exponent; - } - static combineExponent(mantissa, exponent) { - return mantissa * Math.pow(10, exponent); - } - static isPowerOf2(value) { - return (value & value - 1) == 0; - } -} -class PseudoRandom { - constructor(seed){ - this._seed = seed % 2147483647; - if (this._seed <= 0) this._seed += 2147483646; - } - next() { - return this._seed = this._seed * 16807 % 2147483647; - } - nextFloat() { - return (this.next() - 1) / 2147483646; - } - nextInteger(min, max) { - return Math.floor(this.nextFloat() * (max - min + 1) + min); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1KLf3":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraView", ()=>CameraView); -parcelHelpers.export(exports, "CameraBase", ()=>CameraBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _constantsJs = require("../constants.js"); -class CameraView { - constructor(core){ - this.position = (0, _glMatrix.vec3).create(); - } -} -class CameraBase { - getView(view) { - this.getPosition(view.position); - } - setView(view, isSmooth) { - this.setPosition(view.position, isSmooth); - } - lerpView(from, to, time) { - (0, _glMatrix.vec3).lerp(this._vec3, from.position, to.position, time); - this.setPosition(this._vec3, false); - } - get vMatrices() { - return this._vMatrices; - } - get inverseVMatrices() { - return this._inverseVMatrices; - } - get mvMatrices() { - return this._mvMatrices; - } - get pMatrices() { - return this._pMatrices; - } - get inversePMatrices() { - return this._inversePMatrices; - } - get pickVMatrix() { - return this._pickVMatrix; - } - get rMatrix() { - return this._mat3; - } - getOrbit(value) { - (0, _glMatrix.quat).copy(value, this._orbitRotation); - } - setOrbit(value, isSmooth) { - (0, _glMatrix.quat).copy(this._orbitRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, value); - } - getPosition(value) { - (0, _glMatrix.vec3).copy(value, this._cameraPosition); - } - setPosition(value, isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, value); - if (!isSmooth) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, value); - } - constructor(core){ - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this.modelPosition = (0, _glMatrix.vec3).create(); - this.modelScale = (0, _glMatrix.vec3).create(); - this.modelRotation = (0, _glMatrix.quat).create(); - this._orbitRotation = (0, _glMatrix.quat).create(); - this._orbitDirection = (0, _glMatrix.quat).create(); - this._smoothedOrbitRotation = (0, _glMatrix.quat).create(); - this._smoothedCameraPosition = (0, _glMatrix.vec3).create(); - this._smoothedCameraRotation = (0, _glMatrix.quat).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.quat).create(); - this._combinedPosition = (0, _glMatrix.vec3).create(); - this._combinedRotation = (0, _glMatrix.quat).create(); - this._leftToRightEye = (0, _glMatrix.vec3).create(); - this._pickVMatrix = (0, _glMatrix.mat4).create(); - this._eyePositions = [ - (0, _glMatrix.vec3).create(), - (0, _glMatrix.vec3).create() - ]; - this._vMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._pMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inverseVMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this._inversePMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - } - reset(isSmooth) { - (0, _glMatrix.vec3).copy(this._cameraPosition, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.quat).copy(this._cameraRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - (0, _glMatrix.quat).copy(this._orbitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (!isSmooth) this.syncSmooth(); - } - update(elapsedTime) { - let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); - (0, _glMatrix.vec3).lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); - amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); - (0, _glMatrix.quat).slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); - (0, _glMatrix.quat).slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); - const epsilon = 0.000001; - let x; - let y; - let z; - let w; - x = this._smoothedCameraPosition[0] - this._cameraPosition[0]; - y = this._smoothedCameraPosition[1] - this._cameraPosition[1]; - z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon) (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - x = this._smoothedCameraRotation[0] - this._cameraRotation[0]; - y = this._smoothedCameraRotation[1] - this._cameraRotation[1]; - z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; - w = this._smoothedCameraRotation[3] - this._cameraRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - x = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; - y = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; - z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; - w = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; - if (Math.abs(x) < epsilon && Math.abs(y) < epsilon && Math.abs(z) < epsilon && Math.abs(w) < epsilon) (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); - (0, _glMatrix.quat).normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); - (0, _glMatrix.quat).normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); - (0, _glMatrix.quat).conjugate(this._orbitDirection, this._smoothedOrbitRotation); - (0, _glMatrix.vec3).transformMat4(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); - (0, _glMatrix.vec3).transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); - (0, _glMatrix.vec3).add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); - (0, _glMatrix.quat).multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); - (0, _glMatrix.mat3).fromQuat(this._mat3, this._combinedRotation); - this._right[0] = this._mat3[0]; - this._right[1] = this._mat3[1]; - this._right[2] = this._mat3[2]; - this._up[0] = this._mat3[3]; - this._up[1] = this._mat3[4]; - this._up[2] = this._mat3[5]; - this._forward[0] = this._mat3[6]; - this._forward[1] = this._mat3[7]; - this._forward[2] = this._mat3[8]; - const view = this._vMatrices[0]; - view[0] = this._right[0]; - view[1] = this._up[0]; - view[2] = this._forward[0]; - view[4] = this._right[1]; - view[5] = this._up[1]; - view[6] = this._forward[1]; - view[8] = this._right[2]; - view[9] = this._up[2]; - view[10] = this._forward[2]; - view[12] = -(0, _glMatrix.vec3).dot(this._right, this._combinedPosition); - view[13] = -(0, _glMatrix.vec3).dot(this._up, this._combinedPosition); - view[14] = -(0, _glMatrix.vec3).dot(this._forward, this._combinedPosition); - const aspectRatio = this.width / this.height; - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).none) { - if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - const left = -aspectRatio * top; - const right = aspectRatio * top; - const width = right - left; - const height = top - bottom; - const tileWidth = width / this._core.config.tilesX; - const tileHeight = height / this._core.config.tilesY; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); - } else (0, _glMatrix.mat4).perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this.vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this.pMatrices[0]); - } else { - (0, _glMatrix.vec3).cross(this._leftToRightEye, this._forward, this._up); - (0, _glMatrix.vec3).normalize(this._leftToRightEye, this._leftToRightEye); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); - (0, _glMatrix.vec3).scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); - this._vMatrices[0][12] += this._core.config.ipd * 0.5; - (0, _glMatrix.mat4).copy(this._vMatrices[1], this._vMatrices[0]); - this._vMatrices[1][12] -= this._core.config.ipd; - const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; - const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; - const bottom = -top; - let left = -aspectRatio * top + frustumShift; - let right = aspectRatio * top + frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - left = -aspectRatio * top - frustumShift; - right = aspectRatio * top - frustumShift; - (0, _glMatrix.mat4).frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.mat4).multiply(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); - (0, _glMatrix.mat4).multiply(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); - (0, _glMatrix.mat4).invert(this._inverseVMatrices[0], this._vMatrices[0]); - (0, _glMatrix.mat4).invert(this._inversePMatrices[0], this._pMatrices[0]); - (0, _glMatrix.mat4).copy(this._inverseVMatrices[1], this._inverseVMatrices[0]); - this._inverseVMatrices[1][12] += this._core.config.ipd; - (0, _glMatrix.mat4).invert(this._inversePMatrices[1], this._pMatrices[1]); - } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); - this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); - } - } - _zoom(direction, distance) { - (0, _glMatrix.vec3).scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance); - } - rotate(translationDelta) {} - zoom(zoomDelta, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - const distance = zoomDelta * (0, _glMatrix.vec3).distance(this._combinedPosition, this.modelPosition); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._zoom(this._vec3, distance); - } - _twist(axis, angle) {} - twist(angle, x, y) {} - updatePickVMatrix(x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.mat4).lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); - } - syncSmooth() { - (0, _glMatrix.vec3).copy(this._smoothedCameraPosition, this._cameraPosition); - (0, _glMatrix.quat).copy(this._smoothedCameraRotation, this._cameraRotation); - (0, _glMatrix.quat).copy(this._smoothedOrbitRotation, this._orbitRotation); - } - updateModelManipulationOrigin(from, to) { - const a = (0, _glMatrix.vec3).create(); - const b = (0, _glMatrix.vec3).create(); - const c = (0, _glMatrix.vec3).create(); - const d = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformMat4(a, from, this.modelMMatrix); - (0, _glMatrix.vec3).transformMat4(b, to, this.modelMMatrix); - (0, _glMatrix.vec3).subtract(a, this._cameraPosition, a); - (0, _glMatrix.vec3).subtract(b, this._cameraPosition, b); - (0, _glMatrix.vec3).transformQuat(c, a, this._orbitDirection); - (0, _glMatrix.vec3).transformQuat(d, b, this._orbitDirection); - (0, _glMatrix.vec3).subtract(c, c, a); - (0, _glMatrix.vec3).subtract(d, d, b); - (0, _glMatrix.vec3).subtract(this._vec3, c, d); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).add(this._cameraPosition, this._cameraPosition, this._vec3); - (0, _glMatrix.vec3).add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); - } - unproject(position, x, y, z) { - (0, _glMatrix.vec3).set(position, 2 * x / this.width - 1, 1 - 2 * y / this.height, z); - (0, _glMatrix.vec3).transformMat4(position, position, this._inversePMatrices[0]); - (0, _glMatrix.vec3).transformMat4(position, position, this._inverseVMatrices[0]); - } - translate(translationDelta) { - const distance = (0, _glMatrix.vec3).distance(this.modelPosition, this._combinedPosition); - const height = 2 * Math.tan(this._core.config.fov / 2) * distance / this.height; - (0, _glMatrix.vec3).set(this._vec3, height * translationDelta[0], -height * translationDelta[1], 0); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._combinedRotation); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - (0, _glMatrix.vec3).subtract(this._cameraPosition, this._cameraPosition, this._vec3); - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fYehi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _mainJs = require("./main.js"); -var _angleJs = require("./helpers/angle.js"); -class Config { - constructor(core){ - this.reset(); - } - reset() { - this.isDebugVisible = false; - this.logLevel = (0, _mainJs.LogLevel).warn; - this.shaderPath = "shaders"; - this.fontPath = "fonts"; - this.modelDistance = 0.5; - this.modelSize = 0.25; - this.stereoMode = (0, _mainJs.StereoMode).none; - this.ipd = 0.06; - this.screenDistance = 0.5; - this.fov = (0, _angleJs.AngleHelper).degreesToRadians(30); - this.nearPlane = 0.01; - this.farPlane = 100; - this.pickWidth = 512; - this.pickHeight = 512; - this.pickHoldDelay = 1000; - this.pickSelectDelay = 100; - this.resizeMinimumDelay = 250; - this.rotationSmoothing = 0.02; - this.positionSmoothing = 0.02; - this.focusSmoothing = 0.01; - this.scaleSmoothing = 0.02; - this.mouseWheelZoomScale = -0.002; - this.mouseWheelRotationScale = -0.002; - this.dragToleranceSquared = 100; - this.manipulatorMinRelativeDistanceSquared = 100; - this.isMultiTouchEnabled = true; - this.isMultiTouchZoomEnabled = true; - this.isMultiTouchTwistEnabled = true; - this.isMultiTouchRotateEnabled = true; - this.isMultiTouchTranslateEnabled = true; - this.multiTouchZoomScale = 1; - this.cameraMinDistance = 0.1; - this.cameraMaxDistance = 10; - this.xrControllerRayColor = (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5); - this.xrControllerProfile = "windows-mixed-reality"; - this.xrControllerHandedness = "right"; - this.paletteColor = new Uint8Array([ - 0x80, - 0x80, - 0x80, - 0 - ]); - this.textColor = (0, _glMatrix.vec3).create(); - this.textHoverColor = (0, _glMatrix.vec3).create(); - this.textBorderColor = (0, _glMatrix.vec3).create(); - this.textBorderWidth = 0x18 / 0xff; - this.identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - this.axesTextLabelMaxGlyphs = 32; - this.axesTextColor = (0, _glMatrix.vec3).create(); - this.axesTextBorderColor = (0, _glMatrix.vec3).create(); - this.axesTextHoverColor = (0, _glMatrix.vec3).create(); - this.axesTextLabelMajorSize = 0.03; - this.axesTextLabelMinorSize = 0.02; - this.axesTextTitleMaxGlyphs = 127; - this.axesTextTitleSize = 0.05; - this.axesTextHeadingMaxGlyphs = 128; - this.axesTextHeadingSize = 0.075; - this.axesTextTitleLineHeight = 1.5; - this.axesTextHeadingLineHeight = 1.5; - this.axesTextLabelLineHeight = 1.5; - this.axesGridMajorThickness = 0.0002; - this.axesGridMinorThickness = 0.0001; - this.axesGridZeroThickness = 0.002; - this.axesGridPickDivisionHeight = 0.025; - this.axesGridBackgroundColor = (0, _glMatrix.vec3).create(); - this.axesGridHighlightColor = (0, _glMatrix.vec3).create(); - this.axesGridMinorColor = (0, _glMatrix.vec3).create(); - this.axesGridMajorColor = (0, _glMatrix.vec3).create(); - this.axesGridZeroColor = (0, _glMatrix.vec3).create(); - this.axesGridDefaultDivisions = 10; - this.keyTitleMaxGlyphs = 64; - this.keyLabelMaxGlyphs = 64; - this.selectionColor = (0, _glMatrix.vec3).create(); - this.hoverColor = (0, _glMatrix.vec3).create(); - this.activeColor = (0, _glMatrix.vec3).create(); - this.highlightMode = (0, _mainJs.HighlightMode).color; - this.lassoThickness = 4; - this.lassoDashWidth = 2; - this.lassoColor = (0, _glMatrix.vec3).create(); - this.minCubifiedTreeMapSlice = 0.01; - this.sdfBuffer = 0xc0; - this.sdfBorder = 0x0; - this.forceDirectIsEnabled = false; - this.forceDirectAttraction = 1; - this.forceDirectRepulsion = 1; - this.forceDirectGravity = 1; - this.forceDirectInterval = 0.1; - this.forceDirectMaxDistance = 0.1; - this.forceDirectTheta = 1; - this.forceDirectIterationsPerLayout = 1; - this.forceDirectEdgeWeightPower = 1; - this.forceDirectLockX = false; - this.forceDirectLockY = false; - this.forceDirectLockZ = false; - this.transitionDuration = 400; - this.transitionStaggering = 100; - this.transitionView = true; - this.isTransitionPickingEnabled = false; - this.backgroundColor = (0, _glMatrix.vec4).create(); - this.theme = (0, _mainJs.Theme).light; - this.renderMode = (0, _mainJs.RenderMode).color; - this.tilesX = 1; - this.tilesY = 1; - this.tileOffsetX = 0; - this.tileOffsetY = 0; - } - get theme() { - return this._theme; - } - set theme(value) { - if (this._theme != value) { - this._theme = value; - switch(value){ - case (0, _mainJs.Theme).dark: - (0, _glMatrix.vec4).set(this.backgroundColor, 0, 0, 0, 1); - (0, _glMatrix.vec3).set(this.textColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.textHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.04, 0.04, 0.04); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.05, 0.05, 0.05); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.05, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.9, 0.9, 0.9); - break; - case (0, _mainJs.Theme).light: - (0, _glMatrix.vec4).set(this.backgroundColor, 1, 1, 1, 1); - (0, _glMatrix.vec3).set(this.textColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.textHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.textBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextColor, 0, 0, 0); - (0, _glMatrix.vec3).set(this.axesTextBorderColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesTextHoverColor, 0.1, 0.1, 0.1); - (0, _glMatrix.vec3).set(this.axesGridBackgroundColor, 1, 1, 1); - (0, _glMatrix.vec3).set(this.axesGridHighlightColor, 0.925, 0.925, 0.925); - (0, _glMatrix.vec3).set(this.axesGridMinorColor, 0.9, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.axesGridMajorColor, 0.8, 0.8, 0.8); - (0, _glMatrix.vec3).set(this.axesGridZeroColor, 0.7, 0.9, 0.9); - (0, _glMatrix.vec3).set(this.selectionColor, 1, 1, 0); - (0, _glMatrix.vec3).set(this.hoverColor, 1, 0, 1); - (0, _glMatrix.vec3).set(this.activeColor, 0, 1, 1); - (0, _glMatrix.vec3).set(this.lassoColor, 0.1, 0.1, 0.1); - break; - } - if (this.themeChangedCallback) this.themeChangedCallback(this._theme); - } - } -} - -},{"gl-matrix":"erHGu","./constants.js":"dHTsY","./main.js":"b6Xbk","./helpers/angle.js":"hBXkO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lwhbM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugText", ()=>DebugText); -class DebugText { - get text() { - return this._text; - } - constructor(){ - this.clear(); - } - clear() { - this._text = ""; - } - addLine(value) { - this._text += value + "\n"; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kh2PX":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fps", ()=>Fps); -class Fps { - get frameCounter() { - return this._frameCounter; + } + function equals(a2, b2) { + var a0 = a2[0], a1 = a2[1]; + var b0 = b2[0], b1 = b2[1]; + return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)); + } + (function() { + var vec2 = create(); + return function(a2, stride, offset2, count2, fn, arg) { + var i, l; + if (!stride) { + stride = 2; + } + if (!offset2) { + offset2 = 0; + } + if (count2) { + l = Math.min(count2 * stride + offset2, a2.length); + } else { + l = a2.length; + } + for (i = offset2; i < l; i += stride) { + vec2[0] = a2[i]; + vec2[1] = a2[i + 1]; + fn(vec2, vec2, arg); + a2[i] = vec2[0]; + a2[i + 1] = vec2[1]; + } + return a2; + }; + })(); + class Constants { + } + Constants.TWO_PI = 6.283185307179586; + Constants.PI = 3.141592653589793; + Constants.PI_OVER_TWO = 1.5707963267948966; + Constants.PI_OVER_THREE = 1.0471975511965976; + Constants.PI_OVER_FOUR = 0.7853981633974483; + Constants.PI_OVER_SIX = 0.5235987755982988; + Constants.LOG_2 = 0.6931471805599453; + Constants.RADIANS_PER_DEGREE = 0.017453292519943295; + Constants.DEGREES_PER_RADIAN = 57.29577951308232; + Constants.ROOT_TWO = 1.4142135623730951; + Constants.ROOT_TWO_OVER_TWO = 0.7071067811865476; + Constants.ROOT_THREE = 1.7320508075688772; + Constants.ROOT_THREE_OVER_TWO = 0.8660254037844386; + Constants.ROOT_THREE_OVER_THREE = 0.5773502691896257; + Constants.VECTOR2_ZERO = fromValues(0, 0); + Constants.VECTOR2_ONE = fromValues(1, 1); + Constants.VECTOR2_UNITX = fromValues(1, 0); + Constants.VECTOR2_UNITY = fromValues(0, 1); + Constants.VECTOR3_ZERO = fromValues$3(0, 0, 0); + Constants.VECTOR3_ONE = fromValues$3(1, 1, 1); + Constants.VECTOR3_UNITX = fromValues$3(1, 0, 0); + Constants.VECTOR3_UNITY = fromValues$3(0, 1, 0); + Constants.VECTOR3_UNITZ = fromValues$3(0, 0, 1); + Constants.VECTOR3_REFLECTX = fromValues$3(1, -1, -1); + Constants.VECTOR3_REFLECTY = fromValues$3(-1, 1, -1); + Constants.VECTOR3_REFLECTZ = fromValues$3(-1, -1, 1); + Constants.VECTOR4_ZERO = fromValues$2(0, 0, 0, 0); + Constants.VECTOR4_ONE = fromValues$2(1, 1, 1, 1); + Constants.VECTOR4_UNITX = fromValues$2(1, 0, 0, 0); + Constants.VECTOR4_UNITY = fromValues$2(0, 1, 0, 0); + Constants.VECTOR4_UNITZ = fromValues$2(0, 0, 1, 0); + Constants.VECTOR4_UNITW = fromValues$2(0, 0, 0, 1); + Constants.MAT3_IDENTITY = create$5(); + Constants.MAT4_IDENTITY = create$4(); + Constants.MAT4_ROTATION_MINUS_90 = fromValues$4(0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); + Constants.QUAT_IDENTITY = create$1(); + Constants.QUAT_ROTATEX_PLUS_90 = fromValues$1(Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEX_MINUS_90 = fromValues$1(-Constants.ROOT_TWO_OVER_TWO, 0, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEY_PLUS_90 = fromValues$1(0, Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEY_MINUS_90 = fromValues$1(0, -Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEZ_PLUS_90 = fromValues$1(0, 0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); + Constants.QUAT_ROTATEZ_MINUS_90 = fromValues$1(0, 0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO); + Constants.MILLISECONDS_PER_DAY = 864e5; + class MathHelper { + static simpleLinearRegression(points2) { + const n = points2.length; + let sumX = 0; + let sumY = 0; + let sumXY = 0; + let sumXX = 0; + for (let i = 0; i < n; i++) { + sumX += points2[i].x; + sumY += points2[i].y; + sumXY += points2[i].x * points2[i].y; + sumXX += points2[i].x * points2[i].x; + } + const slope = (n * sumXY - sumX * sumY) / (n * sumXX - sumX * sumX); + const yIntercept = (sumY - slope * sumX) / n; + return { slope, yIntercept }; } - get totalFrames() { - return this._totalFrames; + static clamp(value2, min2, max2) { + return Math.max(Math.min(value2, max2), min2); } - constructor(core){ - this._core = core; - this._totalFrames = 0; - this.reset(); + static lerp(value1, value2, amount) { + return value1 + (value2 - value1) * amount; } - update(elapsedTime) { - this._elapsedTime += elapsedTime; - if (this._elapsedTime > 1000) { - this._elapsedTime -= 1000; - this._fps = this._frameCounter; - this._frameCounter = 0; - } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`fps ${this._fps}`); + static normalize(value2, min2, max2, from = 0, to = 1) { + return max2 - min2 == 0 ? 0 : Math.max(Math.min((to - from) * (value2 - min2) / (max2 - min2) + from, to), from); } - render() { - this._frameCounter++; - this._totalFrames++; + static splitExponent(value2, result) { + let exponent2 = Math.round(Math.log10(Math.abs(value2))); + let coefficient = value2 / Math.pow(10, exponent2); + if (coefficient < 1) { + coefficient *= 10; + exponent2--; + } + result[0] = coefficient; + result[1] = exponent2; } - reset() { - this._fps = 0; - this._frameCounter = 0; - this._elapsedTime = 0; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a14oj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteType", ()=>PaletteType); -parcelHelpers.export(exports, "PaletteName", ()=>PaletteName); -parcelHelpers.export(exports, "PaletteResources", ()=>PaletteResources); -parcelHelpers.export(exports, "PaletteBase", ()=>PaletteBase); -parcelHelpers.export(exports, "Palette", ()=>Palette); -const PaletteType = { - sequentialsinglehue: "sequentialsinglehue", - sequentialmultihue: "sequentialmultihue", - diverging: "diverging", - qualitative: "qualitative" -}; -const PaletteName = { - blues: "blues", - greens: "greens", - greys: "greys", - oranges: "oranges", - purples: "purples", - reds: "reds", - viridis: "viridis", - inferno: "inferno", - magma: "magma", - plasma: "plasma", - bluegreen: "bluegreen", - bluepurple: "bluepurple", - greenblue: "greenblue", - orangered: "orangered", - purpleblue: "purpleblue", - purplebluegreen: "purplebluegreen", - purplered: "purplered", - redpurple: "redpurple", - yellowgreen: "yellowgreen", - yellowgreenblue: "yellowgreenblue", - yelloworangebrown: "yelloworangebrown", - yelloworangered: "yelloworangered", - brownbluegreen: "brownbluegreen", - pinkyellowgreen: "pinkyellowgreen", - purplegreen: "purplegreen", - purpleorange: "purpleorange", - redblue: "redblue", - redgrey: "redgrey", - redyellowblue: "redyellowblue", - redyellowgreen: "redyellowgreen", - spectral: "spectral", - accent: "accent", - dark2: "dark2", - paired: "paired", - pastel1: "pastel1", - pastel2: "pastel2", - set1: "set1", - set2: "set2", - set3: "set3" -}; -class PaletteResources { - constructor(){ - this.palettes = { - "blues": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 251, - 255, - 222, - 235, - 247, - 198, - 219, - 239, - 158, - 202, - 225, - 107, - 174, - 214, - 66, - 146, - 198, - 33, - 113, - 181, - 8, - 81, - 156, - 8, - 48, - 107 - ]) - }, - "greens": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 247, - 252, - 245, - 229, - 245, - 224, - 199, - 233, - 192, - 161, - 217, - 155, - 116, - 196, - 118, - 65, - 171, - 93, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "greys": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 255, - 255, - 240, - 240, - 240, - 217, - 217, - 217, - 189, - 189, - 189, - 150, - 150, - 150, - 115, - 115, - 115, - 82, - 82, - 82, - 37, - 37, - 37, - 0, - 0, - 0 - ]) - }, - "oranges": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 235, - 254, - 230, - 206, - 253, - 208, - 162, - 253, - 174, - 107, - 253, - 141, - 60, - 241, - 105, - 19, - 217, - 72, - 1, - 166, - 54, - 3, - 127, - 39, - 4 - ]) - }, - "purples": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 252, - 251, - 253, - 239, - 237, - 245, - 218, - 218, - 235, - 188, - 189, - 220, - 158, - 154, - 200, - 128, - 125, - 186, - 106, - 81, - 163, - 84, - 39, - 143, - 63, - 0, - 125 - ]) - }, - "reds": { - type: PaletteType.sequentialsinglehue, - colors: new Uint8Array([ - 255, - 245, - 240, - 254, - 224, - 210, - 252, - 187, - 161, - 252, - 146, - 114, - 251, - 106, - 74, - 239, - 59, - 44, - 203, - 24, - 29, - 165, - 15, - 21, - 103, - 0, - 13 - ]) - }, - "viridis": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x48, - 0x25, - 0x75, - 0x41, - 0x44, - 0x87, - 0x35, - 0x60, - 0x8d, - 0x2a, - 0x78, - 0x8e, - 0x21, - 0x91, - 0x8d, - 0x22, - 0xa8, - 0x84, - 0x43, - 0xbf, - 0x71, - 0x7a, - 0xd1, - 0x51, - 0xbc, - 0xdf, - 0x27 - ]) - }, - "inferno": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x17, - 0x0c, - 0x3b, - 0x42, - 0x0a, - 0x68, - 0x6b, - 0x17, - 0x6e, - 0x93, - 0x26, - 0x67, - 0xbb, - 0x37, - 0x55, - 0xdd, - 0x51, - 0x3a, - 0xf3, - 0x77, - 0x1a, - 0xfc, - 0xa5, - 0x0a, - 0xf6, - 0xd6, - 0x45 - ]) - }, - "magma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x15, - 0x0e, - 0x37, - 0x3b, - 0x0f, - 0x70, - 0x65, - 0x1a, - 0x80, - 0x8c, - 0x29, - 0x81, - 0xb6, - 0x37, - 0x7a, - 0xde, - 0x49, - 0x68, - 0xf7, - 0x6f, - 0x5c, - 0xfe, - 0x9f, - 0x6d, - 0xfe, - 0xce, - 0x91 - ]) - }, - "plasma": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 0x42, - 0x03, - 0x9d, - 0x6a, - 0x00, - 0xa8, - 0x90, - 0x0d, - 0xa4, - 0xb1, - 0x2a, - 0x90, - 0xcb, - 0x47, - 0x79, - 0xe1, - 0x64, - 0x62, - 0xf2, - 0x83, - 0x4c, - 0xfc, - 0xa6, - 0x36, - 0xfc, - 0xce, - 0x25 - ]) - }, - "bluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 229, - 245, - 249, - 204, - 236, - 230, - 153, - 216, - 201, - 102, - 194, - 164, - 65, - 174, - 118, - 35, - 139, - 69, - 0, - 109, - 44, - 0, - 68, - 27 - ]) - }, - "bluepurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 253, - 224, - 236, - 244, - 191, - 211, - 230, - 158, - 188, - 218, - 140, - 150, - 198, - 140, - 107, - 177, - 136, - 65, - 157, - 129, - 15, - 124, - 77, - 0, - 75 - ]) - }, - "greenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 252, - 240, - 224, - 243, - 219, - 204, - 235, - 197, - 168, - 221, - 181, - 123, - 204, - 196, - 78, - 179, - 211, - 43, - 140, - 190, - 8, - 104, - 172, - 8, - 64, - 129 - ]) - }, - "orangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 236, - 254, - 232, - 200, - 253, - 212, - 158, - 253, - 187, - 132, - 252, - 141, - 89, - 239, - 101, - 72, - 215, - 48, - 31, - 179, - 0, - 0, - 127, - 0, - 0 - ]) - }, - "purpleblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 231, - 242, - 208, - 209, - 230, - 166, - 189, - 219, - 116, - 169, - 207, - 54, - 144, - 192, - 5, - 112, - 176, - 4, - 90, - 141, - 2, - 56, - 88 - ]) - }, - "purplebluegreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 251, - 236, - 226, - 240, - 208, - 209, - 230, - 166, - 189, - 219, - 103, - 169, - 207, - 54, - 144, - 192, - 2, - 129, - 138, - 1, - 108, - 89, - 1, - 70, - 54 - ]) - }, - "purplered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 247, - 244, - 249, - 231, - 225, - 239, - 212, - 185, - 218, - 201, - 148, - 199, - 223, - 101, - 176, - 231, - 41, - 138, - 206, - 18, - 86, - 152, - 0, - 67, - 103, - 0, - 31 - ]) - }, - "redpurple": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 247, - 243, - 253, - 224, - 221, - 252, - 197, - 192, - 250, - 159, - 181, - 247, - 104, - 161, - 221, - 52, - 151, - 174, - 1, - 126, - 122, - 1, - 119, - 73, - 0, - 106 - ]) - }, - "yellowgreen": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 247, - 252, - 185, - 217, - 240, - 163, - 173, - 221, - 142, - 120, - 198, - 121, - 65, - 171, - 93, - 35, - 132, - 67, - 0, - 104, - 55, - 0, - 69, - 41 - ]) - }, - "yellowgreenblue": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 217, - 237, - 248, - 177, - 199, - 233, - 180, - 127, - 205, - 187, - 65, - 182, - 196, - 29, - 145, - 192, - 34, - 94, - 168, - 37, - 52, - 148, - 8, - 29, - 88 - ]) - }, - "yelloworangebrown": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 229, - 255, - 247, - 188, - 254, - 227, - 145, - 254, - 196, - 79, - 254, - 153, - 41, - 236, - 112, - 20, - 204, - 76, - 2, - 153, - 52, - 4, - 102, - 37, - 6 - ]) - }, - "yelloworangered": { - type: PaletteType.sequentialmultihue, - colors: new Uint8Array([ - 255, - 255, - 204, - 255, - 237, - 160, - 254, - 217, - 118, - 254, - 178, - 76, - 253, - 141, - 60, - 252, - 78, - 42, - 227, - 26, - 28, - 189, - 0, - 38, - 128, - 0, - 38 - ]) - }, - "brownbluegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 84, - 48, - 5, - 140, - 81, - 10, - 191, - 129, - 45, - 223, - 194, - 125, - 246, - 232, - 195, - 245, - 245, - 245, - 199, - 234, - 229, - 128, - 205, - 193, - 53, - 151, - 143, - 1, - 102, - 94, - 0, - 60, - 48 - ]) - }, - "pinkyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 142, - 1, - 82, - 197, - 27, - 125, - 222, - 119, - 174, - 241, - 182, - 218, - 253, - 224, - 239, - 247, - 247, - 247, - 230, - 245, - 208, - 184, - 225, - 134, - 127, - 188, - 65, - 77, - 146, - 33, - 39, - 100, - 25 - ]) - }, - "purplegreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 64, - 0, - 75, - 118, - 42, - 131, - 153, - 112, - 171, - 194, - 165, - 207, - 231, - 212, - 232, - 247, - 247, - 247, - 217, - 240, - 211, - 166, - 219, - 160, - 90, - 174, - 97, - 27, - 120, - 55, - 0, - 68, - 27 - ]) - }, - "purpleorange": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 127, - 59, - 8, - 179, - 88, - 6, - 224, - 130, - 20, - 253, - 184, - 99, - 254, - 224, - 182, - 247, - 247, - 247, - 216, - 218, - 235, - 178, - 171, - 210, - 128, - 115, - 172, - 84, - 39, - 136, - 45, - 0, - 75 - ]) - }, - "redblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 247, - 247, - 247, - 209, - 229, - 240, - 146, - 197, - 222, - 67, - 147, - 195, - 33, - 102, - 172, - 5, - 48, - 97 - ]) - }, - "redgrey": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 103, - 0, - 31, - 178, - 24, - 43, - 214, - 96, - 77, - 244, - 165, - 130, - 253, - 219, - 199, - 255, - 255, - 255, - 224, - 224, - 224, - 186, - 186, - 186, - 135, - 135, - 135, - 77, - 77, - 77, - 26, - 26, - 26 - ]) - }, - "redyellowblue": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 144, - 255, - 255, - 191, - 224, - 243, - 248, - 171, - 217, - 233, - 116, - 173, - 209, - 69, - 117, - 180, - 49, - 54, - 149 - ]) - }, - "redyellowgreen": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 165, - 0, - 38, - 215, - 48, - 39, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 217, - 239, - 139, - 166, - 217, - 106, - 102, - 189, - 99, - 26, - 152, - 80, - 0, - 104, - 55 - ]) - }, - "spectral": { - type: PaletteType.diverging, - colors: new Uint8Array([ - 158, - 1, - 66, - 213, - 62, - 79, - 244, - 109, - 67, - 253, - 174, - 97, - 254, - 224, - 139, - 255, - 255, - 191, - 230, - 245, - 152, - 171, - 221, - 164, - 102, - 194, - 165, - 50, - 136, - 189, - 94, - 79, - 162 - ]) - }, - "accent": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 127, - 201, - 127, - 190, - 174, - 212, - 253, - 192, - 134, - 255, - 255, - 153, - 56, - 108, - 176, - 240, - 2, - 127, - 191, - 91, - 23, - 102, - 102, - 102 - ]) - }, - "dark2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 27, - 158, - 119, - 217, - 95, - 2, - 117, - 112, - 179, - 231, - 41, - 138, - 102, - 166, - 30, - 230, - 171, - 2, - 166, - 118, - 29, - 102, - 102, - 102 - ]) - }, - "paired": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 166, - 206, - 227, - 31, - 120, - 180, - 178, - 223, - 138, - 51, - 160, - 44, - 251, - 154, - 153, - 227, - 26, - 28, - 253, - 191, - 111, - 255, - 127, - 0, - 202, - 178, - 214, - 106, - 61, - 154, - 255, - 255, - 153, - 177, - 89, - 40 - ]) - }, - "pastel1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 251, - 180, - 174, - 179, - 205, - 227, - 204, - 235, - 197, - 222, - 203, - 228, - 254, - 217, - 166, - 255, - 255, - 204, - 229, - 216, - 189, - 253, - 218, - 236, - 242, - 242, - 242 - ]) - }, - "pastel2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 179, - 226, - 205, - 253, - 205, - 172, - 203, - 213, - 232, - 244, - 202, - 228, - 230, - 245, - 201, - 255, - 242, - 174, - 241, - 226, - 204, - 204, - 204, - 204 - ]) - }, - "set1": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 228, - 26, - 28, - 55, - 126, - 184, - 77, - 175, - 74, - 152, - 78, - 163, - 255, - 127, - 0, - 255, - 255, - 51, - 166, - 86, - 40, - 247, - 129, - 191, - 153, - 153, - 153 - ]) - }, - "set2": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 102, - 194, - 165, - 252, - 141, - 98, - 141, - 160, - 203, - 231, - 138, - 195, - 166, - 216, - 84, - 255, - 217, - 47, - 229, - 196, - 148, - 179, - 179, - 179 - ]) - }, - "set3": { - type: PaletteType.qualitative, - colors: new Uint8Array([ - 141, - 211, - 199, - 255, - 255, - 179, - 190, - 186, - 218, - 251, - 128, - 114, - 128, - 177, - 211, - 253, - 180, - 98, - 179, - 222, - 105, - 252, - 205, - 229, - 217, - 217, - 217, - 188, - 128, - 189, - 204, - 235, - 197, - 255, - 237, - 111 - ]) - } - }; + static combineExponent(mantissa, exponent2) { + return mantissa * Math.pow(10, exponent2); } -} -class PaletteBase { - get colors() { - return this._colors; + static isPowerOf2(value2) { + return (value2 & value2 - 1) == 0; } - set colors(value) { - if (this._colors != value) { - this._colors = value; - this._changed = true; - } + } + class PseudoRandom { + constructor(seed) { + this._seed = seed % 2147483647; + if (this._seed <= 0) + this._seed += 2147483646; } - constructor(){ - this._colors = null; + next() { + return this._seed = this._seed * 16807 % 2147483647; } - copyFrom(palette) { - if (palette.colors) this.colors = new Uint8Array(palette.colors); - else this.colors = null; - } - update() {} -} -class Palette extends PaletteBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3tuGu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -parcelHelpers.export(exports, "Controller", ()=>Controller); -var _mainJs = require("../main.js"); -var _objJs = require("../helpers/obj.js"); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class ControllerVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(controller){ - this.controller = controller; - } -} -class Controller { - get isInitialized() { - return this._isInitialized; + nextFloat() { + return (this.next() - 1) / 2147483646; } - get mMatrix() { - return this._mMatrix; + nextInteger(min2, max2) { + return Math.floor(this.nextFloat() * (max2 - min2 + 1) + min2); } - get indexCount() { - return this._indexCount; + } + class AngleHelper { + static degreesToRadians(degrees2) { + return degrees2 * Constants.RADIANS_PER_DEGREE; + } + static radiansToDegrees(radians2) { + return radians2 * Constants.DEGREES_PER_RADIAN; + } + static wrapAngle(angle2) { + if (angle2 > Constants.PI) + angle2 = angle2 - Constants.TWO_PI; + else if (angle2 < -Constants.PI) + angle2 += Constants.TWO_PI; + return angle2; + } + static sphericalToCartesian(altitude, longitude2, latitude, result) { + latitude = AngleHelper.degreesToRadians(latitude); + longitude2 = AngleHelper.degreesToRadians(longitude2); + const scale2 = Math.cos(latitude); + result[0] = altitude * scale2 * Math.sin(longitude2); + result[1] = altitude * Math.sin(latitude); + result[2] = altitude * scale2 * Math.cos(longitude2); + } + static cartesianToSpherical(x2, y2, z, result) { + result[0] = Math.atan2(x2, z); + result[1] = Math.asin(y2); } - get vertices() { - return this._vertices; + static angleBetweenVectors(from, to) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + return Math.acos(dot2); + } } - get indices() { - return this._indices; + static signedAngleBetweenVectors(from, to, up) { + if (exactEquals$1(from, to)) { + return 0; + } else { + const dot2 = MathHelper.clamp(dot$1(from, to), -1, 1); + let angle2 = Math.acos(dot2); + cross(AngleHelper._vec3, from, to); + if (dot$1(AngleHelper._vec3, up) < 0) { + angle2 = -angle2; + } + return angle2; + } } - get texture() { - return this._texture; + } + AngleHelper._vec3 = create$3(); + class CameraBase { + getView(view) { + this.getPosition(view.position); } - get rayMMatrix() { - return this._rayMMatrix; + setView(view, isSmooth) { + this.setPosition(view.position, isSmooth); } - get rayIndexCount() { - return this._rayIndexCount; + lerpView(from, to, time2) { + lerp(this._vec3, from.position, to.position, time2); + this.setPosition(this._vec3, false); } - get rayVertices() { - return this._rayVertices; + get vMatrices() { + return this._vMatrices; } - get rayIndices() { - return this._rayIndices; + get inverseVMatrices() { + return this._inverseVMatrices; } - constructor(core, options){ - this._cubeObj = `o Cube -v 1.000000 -1.000000 -1.000000 -v 1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 1.000000 -v -1.000000 -1.000000 -1.000000 -v 1.000000 1.000000 -0.999999 -v 0.999999 1.000000 1.000001 -v -1.000000 1.000000 1.000000 -v -1.000000 1.000000 -1.000000 -vt 1.000000 0.333333 -vt 1.000000 0.666667 -vt 0.666667 0.666667 -vt 0.666667 0.333333 -vt 0.666667 0.000000 -vt 0.000000 0.333333 -vt 0.000000 0.000000 -vt 0.333333 0.000000 -vt 0.333333 1.000000 -vt 0.000000 1.000000 -vt 0.000000 0.666667 -vt 0.333333 0.333333 -vt 0.333333 0.666667 -vt 1.000000 0.000000 -vn 0.000000 -1.000000 0.000000 -vn 0.000000 1.000000 0.000000 -vn 1.000000 0.000000 0.000000 -vn -0.000000 0.000000 1.000000 -vn -1.000000 -0.000000 -0.000000 -vn 0.000000 0.000000 -1.000000 -s off -f 2/1/1 3/2/1 4/3/1 -f 8/1/2 7/4/2 6/5/2 -f 5/6/3 6/7/3 2/8/3 -f 6/8/4 7/5/4 3/4/4 -f 3/9/5 7/10/5 8/11/5 -f 1/12/6 4/13/6 8/11/6 -f 1/4/1 2/1/1 4/3/1 -f 5/14/2 8/1/2 6/5/2 -f 1/12/3 5/6/3 2/8/3 -f 2/12/4 6/8/4 3/4/4 -f 4/13/5 3/9/5 8/11/5 -f 5/6/6 1/12/6 8/11/6`; - this._core = core; - this._obj = options.obj; - this._texture = options.texture || new ImageData(new Uint8ClampedArray([ - 0, - 0, - 0, - 255 - ]), 1, 1); + get mvMatrices() { + return this._mvMatrices; } - initialize() { - const _vec3 = (0, _glMatrix.vec3).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - const objMesh = new (0, _objJs.ObjHelper)(this._core).read(this._obj || this._cubeObj); - if (!this._obj) { - this.useRayPose = true; - const modelThickness = 0.02; - const modelLength = 0.1; - (0, _glMatrix.vec3).set(_vec3, modelThickness, modelThickness, modelLength); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, 1); - (0, _glMatrix.mat4).translate(this._mMatrix, this._mMatrix, _vec3); - } - this._vertices = objMesh.vertices; - this._indices = objMesh.indices; - this._indexCount = objMesh.indexCount; - this._rayMMatrix = (0, _glMatrix.mat4).create(); - const rayVertices = (0, _cubeJs.Cube).POSITIONS; - this._rayVertices = new ArrayBuffer((0, _vertexJs.PositionColorVertex).SIZE_BYTES * rayVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const rayVerticesView = new DataView(this._rayVertices); - const rayIndices = (0, _cubeJs.Cube).INDICES; - this._rayIndices = new Uint16Array(rayIndices); - const rayVertexCount = rayVertices.length / (0, _vertexJs.PositionVertex).SIZE; - this._rayIndexCount = rayIndices.length; - for(let i = 0; i < rayVertexCount; i++){ - (0, _glMatrix.vec3).set(_vec3, rayVertices[i * (0, _vertexJs.PositionVertex).SIZE], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], rayVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _vertexJs.PositionColorVertex).setPosition(rayVerticesView, i, _vec3); - (0, _vertexJs.PositionColorVertex).setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); - } - const rayThickness = 0.0025; - const rayLength = 10; - (0, _glMatrix.vec3).set(_vec3, rayThickness, rayThickness, rayLength); - (0, _glMatrix.mat4).fromScaling(this._rayMMatrix, _vec3); - (0, _glMatrix.vec3).set(_vec3, 0, 0, -0.5); - (0, _glMatrix.mat4).translate(this._rayMMatrix, this._rayMMatrix, _vec3); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "controller initialized"); - } - update(elapsedTime) {} -} - -},{"../main.js":"b6Xbk","../helpers/obj.js":"bfvOU","gl-matrix":"erHGu","../meshes/cube.js":"dYecn","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bfvOU":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ObjMesh", ()=>ObjMesh); -parcelHelpers.export(exports, "ObjHelper", ()=>ObjHelper); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class ObjMesh { -} -class ObjHelper { - constructor(core){ - this._core = core; - } - read(data) { - const start = window.performance.now(); - const indices = []; - const positions = []; - const normals = []; - const texCoords = []; - const meshes = []; - const indexOffsets = []; - const indexCounts = []; - const faceLookup = {}; - const lines = data.split("\n"); - let faceCount = 0; - for(let i = 0; i < lines.length; i++){ - const parts = lines[i].trim().split(" "); - if (parts.length > 0) switch(parts[0]){ - case "o": - meshes.push(parts[1]); - indexOffsets.push(indices.length); - break; - case "v": - positions.push(parseFloat(parts[1])); - positions.push(parseFloat(parts[2])); - positions.push(parseFloat(parts[3])); - break; - case "vt": - texCoords.push(parseFloat(parts[1])); - texCoords.push(parseFloat(parts[2])); - break; - case "vn": - normals.push(parseFloat(parts[1])); - normals.push(parseFloat(parts[2])); - normals.push(parseFloat(parts[3])); - break; - case "f": - for(let i = 0; i < parts.length - 1; i++){ - const part = parts[i + 1]; - if (faceLookup[part] == undefined) faceLookup[part] = faceCount++; - indices.push(faceLookup[part]); - } - break; - case "usemtl": - case "mtllib": - default: - break; - } - } - for(let i = 0; i < meshes.length - 1; i++)indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); - indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * Object.keys(faceLookup).length); - const dataView = new DataView(vertices); - let minX = Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let minZ = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - let maxZ = -Number.MAX_VALUE; - const faces = Object.keys(faceLookup); - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - let hasTexCoords, hasNormals; - if (faces.length > 0) { - const faceParts = faces[0].split("/"); - hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); - hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); - } - for(let i = 0; i < faces.length; i++){ - const faceParts = faces[i].split("/"); - let index = (parseInt(faceParts[0]) - 1) * 3; - const x = positions[index]; - const y = positions[index + 1]; - const z = positions[index + 2]; - (0, _glMatrix.vec3).set(_vec3, x, y, z); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(dataView, i, _vec3); - minX = Math.min(x, minX); - minY = Math.min(y, minY); - minZ = Math.min(z, minZ); - maxX = Math.max(x, maxX); - maxY = Math.max(y, maxY); - maxZ = Math.max(z, maxZ); - if (hasNormals) { - index = (parseInt(faceParts[2]) - 1) * 3; - (0, _glMatrix.vec3).set(_vec3, normals[index], normals[index + 1], normals[index + 2]); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(dataView, i, _vec3); - } - if (hasTexCoords) { - index = (parseInt(faceParts[1]) - 1) * 2; - (0, _glMatrix.vec2).set(_vec2, texCoords[index], texCoords[index + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(dataView, i, _vec2); - } - } - const originX = (minX + maxX) / 2; - const originY = (minY + maxY) / 2; - const originZ = (minZ + maxZ) / 2; - const objMesh = new ObjMesh(); - objMesh.vertices = vertices; - objMesh.indices = new Uint16Array(indices); - objMesh.meshes = meshes; - objMesh.indexOffsets = indexOffsets; - objMesh.indexCounts = indexCounts; - objMesh.indexCount = indices.length; - objMesh.minX = minX; - objMesh.minY = minY; - objMesh.minZ = minZ; - objMesh.maxX = maxX; - objMesh.maxY = maxY; - objMesh.maxZ = maxZ; - objMesh.originX = originX; - objMesh.originY = originY; - objMesh.originZ = originZ; - this._core.log.write((0, _mainJs.LogLevel).info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); - return objMesh; - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8lW8V":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PositionVertex", ()=>PositionVertex); -parcelHelpers.export(exports, "PositionColorVertex", ()=>PositionColorVertex); -parcelHelpers.export(exports, "PositionTextureVertex", ()=>PositionTextureVertex); -parcelHelpers.export(exports, "PositionTexturePickVertex", ()=>PositionTexturePickVertex); -parcelHelpers.export(exports, "PositionNormalVertex", ()=>PositionNormalVertex); -parcelHelpers.export(exports, "PositionNormalColorVertex", ()=>PositionNormalColorVertex); -parcelHelpers.export(exports, "PositionNormalTextureVertex", ()=>PositionNormalTextureVertex); -parcelHelpers.export(exports, "PickGridVertex", ()=>PickGridVertex); -parcelHelpers.export(exports, "UnitVertex", ()=>UnitVertex); -var _glMatrix = require("gl-matrix"); -class PositionVertex { - static getPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - (0, _glMatrix.vec3).set(value, buffer[offset], buffer[offset + 1], buffer[offset + 2]); - } - static setPosition(buffer, index, value) { - const offset = index * PositionVertex.SIZE; - buffer[offset] = value[0]; - buffer[offset + 1] = value[1]; - buffer[offset + 2] = value[2]; - } -} -PositionVertex.SIZE = 3; -PositionVertex.SIZE_BYTES = 12; -class PositionColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionColorVertex.SIZE_BYTES = 16; -PositionColorVertex.POSITION_OFFSET_BYTES = 0; -PositionColorVertex.COLOR_OFFSET_BYTES = 12; -class PositionTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionColorVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionTextureVertex.SIZE_BYTES = 16; -PositionTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; -class PositionTexturePickVertex { - static getPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PositionTexturePickVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } -} -PositionTexturePickVertex.SIZE_BYTES = 20; -PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; -PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; -PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; -class PositionNormalVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } -} -PositionNormalVertex.SIZE_BYTES = 16; -PositionNormalVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalVertex.NORMAL_OFFSET_BYTES = 12; -class PositionNormalColorVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF); - } - static setColor(bufferView, index, value) { - const offset = PositionNormalColorVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - } -} -PositionNormalColorVertex.SIZE_BYTES = 20; -PositionNormalColorVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalColorVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalColorVertex.COLOR_OFFSET_BYTES = 16; -class PositionNormalTextureVertex { - static getPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setPosition(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.POSITION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PositionNormalTextureVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } -} -PositionNormalTextureVertex.SIZE_BYTES = 20; -PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; -PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; -PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; -class PickGridVertex { - static getTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); - } - static setTranslation(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - } - static getNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getInt8(offset) / 0x7F, bufferView.getInt8(offset + 1) / 0x7F, bufferView.getInt8(offset + 2) / 0x7F); - } - static setNormal(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.NORMAL_OFFSET_BYTES; - bufferView.setInt8(offset, value[0] * 0x7F); - bufferView.setInt8(offset + 1, value[1] * 0x7F); - bufferView.setInt8(offset + 2, value[2] * 0x7F); - } - static getIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF); - } - static setTexCoord(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.TEX_COORD_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - } - static getBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint16(offset, true) / 0xFFFF, bufferView.getUint16(offset + 2, true) / 0xFFFF, bufferView.getUint16(offset + 4, true) / 0xFFFF, bufferView.getUint16(offset + 6, true) / 0xFFFF); - } - static setBounds(bufferView, index, value) { - const offset = PickGridVertex.SIZE_BYTES * index + this.BOUNDS_OFFSET_BYTES; - bufferView.setUint16(offset, value[0] * 0xFFFF, true); - bufferView.setUint16(offset + 2, value[1] * 0xFFFF, true); - bufferView.setUint16(offset + 4, value[2] * 0xFFFF, true); - bufferView.setUint16(offset + 6, value[3] * 0xFFFF, true); - } -} -PickGridVertex.SIZE_BYTES = 32; -PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; -PickGridVertex.NORMAL_OFFSET_BYTES = 12; -PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; -PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; -PickGridVertex.BOUNDS_OFFSET_BYTES = 24; -class UnitVertex { - static getIdHover(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, true); - } - static setIdHover(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ID_HOVER_OFFSET_BYTES, value, true); + get pMatrices() { + return this._pMatrices; } - static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); + get inversePMatrices() { + return this._inversePMatrices; } - static getTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + get pickVMatrix() { + return this._pickVMatrix; } - static setTranslation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TRANSLATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + get rMatrix() { + return this._mat3; } - static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + getOrbit(value2) { + copy$1(value2, this._orbitRotation); } - static getColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF); + setOrbit(value2, isSmooth) { + copy$1(this._orbitRotation, value2); + if (!isSmooth) { + copy$1(this._smoothedOrbitRotation, value2); + } } - static setColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); + getPosition(value2) { + copy$3(value2, this._cameraPosition); } - static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; - toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); - toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + setPosition(value2, isSmooth) { + copy$3(this._cameraPosition, value2); + if (!isSmooth) { + copy$3(this._smoothedCameraPosition, value2); + } } - static getOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - (0, _glMatrix.vec2).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true)); + constructor(core) { + this._core = core; + this._vec3 = create$3(); + this._quat = create$1(); + this._mat3 = create$5(); + this._right = create$3(); + this._up = create$3(); + this._forward = create$3(); + this._modelManipulationOrigin = create$3(); + this.modelPosition = create$3(); + this.modelScale = create$3(); + this.modelRotation = create$1(); + this._orbitRotation = create$1(); + this._orbitDirection = create$1(); + this._smoothedOrbitRotation = create$1(); + this._smoothedCameraPosition = create$3(); + this._smoothedCameraRotation = create$1(); + this._cameraPosition = create$3(); + this._cameraRotation = create$1(); + this._combinedPosition = create$3(); + this._combinedRotation = create$1(); + this._leftToRightEye = create$3(); + this._pickVMatrix = create$4(); + this._eyePositions = [create$3(), create$3()]; + this._vMatrices = [create$4(), create$4()]; + this._mvMatrices = [create$4(), create$4()]; + this._pMatrices = [create$4(), create$4()]; + this._inverseVMatrices = [create$4(), create$4()]; + this._inversePMatrices = [create$4(), create$4()]; } - static setOrder(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ORDER_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); + reset(isSmooth) { + copy$3(this._cameraPosition, Constants.VECTOR3_ZERO); + copy$1(this._cameraRotation, Constants.QUAT_IDENTITY); + copy$1(this._orbitRotation, Constants.QUAT_IDENTITY); + if (!isSmooth) { + this.syncSmooth(); + } } - static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + update(elapsedTime) { + let amount = Math.min(elapsedTime * this._core.config.positionSmoothing, 1); + lerp(this._smoothedCameraPosition, this._smoothedCameraPosition, this._cameraPosition, amount); + amount = Math.min(elapsedTime * this._core.config.rotationSmoothing, 1); + slerp(this._smoothedCameraRotation, this._smoothedCameraRotation, this._cameraRotation, amount); + slerp(this._smoothedOrbitRotation, this._smoothedOrbitRotation, this._orbitRotation, amount); + const epsilon3 = 1e-6; + let x2; + let y2; + let z; + let w2; + x2 = this._smoothedCameraPosition[0] - this._cameraPosition[0]; + y2 = this._smoothedCameraPosition[1] - this._cameraPosition[1]; + z = this._smoothedCameraPosition[2] - this._cameraPosition[2]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z) < epsilon3) { + copy$3(this._smoothedCameraPosition, this._cameraPosition); + } + x2 = this._smoothedCameraRotation[0] - this._cameraRotation[0]; + y2 = this._smoothedCameraRotation[1] - this._cameraRotation[1]; + z = this._smoothedCameraRotation[2] - this._cameraRotation[2]; + w2 = this._smoothedCameraRotation[3] - this._cameraRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$1(this._smoothedCameraRotation, this._cameraRotation); + } + x2 = this._smoothedOrbitRotation[0] - this._orbitRotation[0]; + y2 = this._smoothedOrbitRotation[1] - this._orbitRotation[1]; + z = this._smoothedOrbitRotation[2] - this._orbitRotation[2]; + w2 = this._smoothedOrbitRotation[3] - this._orbitRotation[3]; + if (Math.abs(x2) < epsilon3 && Math.abs(y2) < epsilon3 && Math.abs(z) < epsilon3 && Math.abs(w2) < epsilon3) { + copy$1(this._smoothedOrbitRotation, this._orbitRotation); + } + normalize(this._smoothedCameraRotation, this._smoothedCameraRotation); + normalize(this._smoothedOrbitRotation, this._smoothedOrbitRotation); + conjugate(this._orbitDirection, this._smoothedOrbitRotation); + transformMat4$2(this._modelManipulationOrigin, this.modelManipulationOrigin, this.modelMMatrix); + subtract(this._vec3, this._smoothedCameraPosition, this._modelManipulationOrigin); + transformQuat(this._combinedPosition, this._vec3, this._orbitDirection); + add(this._combinedPosition, this._combinedPosition, this._modelManipulationOrigin); + multiply(this._combinedRotation, this._orbitDirection, this._smoothedCameraRotation); + fromQuat$1(this._mat3, this._combinedRotation); + this._right[0] = this._mat3[0]; + this._right[1] = this._mat3[1]; + this._right[2] = this._mat3[2]; + this._up[0] = this._mat3[3]; + this._up[1] = this._mat3[4]; + this._up[2] = this._mat3[5]; + this._forward[0] = this._mat3[6]; + this._forward[1] = this._mat3[7]; + this._forward[2] = this._mat3[8]; + const view = this._vMatrices[0]; + view[0] = this._right[0]; + view[1] = this._up[0]; + view[2] = this._forward[0]; + view[4] = this._right[1]; + view[5] = this._up[1]; + view[6] = this._forward[1]; + view[8] = this._right[2]; + view[9] = this._up[2]; + view[10] = this._forward[2]; + view[12] = -dot$1(this._right, this._combinedPosition); + view[13] = -dot$1(this._up, this._combinedPosition); + view[14] = -dot$1(this._forward, this._combinedPosition); + const aspectRatio = this.width / this.height; + if (this._core.config.stereoMode == StereoMode.none) { + if (this._core.config.tilesX != 1 || this._core.config.tilesY != 1) { + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + const left = -aspectRatio * top; + const right = aspectRatio * top; + const width2 = right - left; + const height2 = top - bottom; + const tileWidth = width2 / this._core.config.tilesX; + const tileHeight = height2 / this._core.config.tilesY; + frustum(this._pMatrices[0], left + this._core.config.tileOffsetX * tileWidth, left + (this._core.config.tileOffsetX + 1) * tileWidth, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY - 1) * tileHeight, bottom + (this._core.config.tilesY - this._core.config.tileOffsetY) * tileHeight, this._core.config.nearPlane, this._core.config.farPlane); + } else { + perspective(this.pMatrices[0], this._core.config.fov, aspectRatio, this._core.config.nearPlane, this._core.config.farPlane); + } + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + invert(this._inverseVMatrices[0], this.vMatrices[0]); + invert(this._inversePMatrices[0], this.pMatrices[0]); + } else { + cross(this._leftToRightEye, this._forward, this._up); + normalize$2(this._leftToRightEye, this._leftToRightEye); + scaleAndAdd(this._eyePositions[0], this._combinedPosition, this._leftToRightEye, -this._core.config.ipd); + scaleAndAdd(this._eyePositions[1], this._combinedPosition, this._leftToRightEye, this._core.config.ipd); + this._vMatrices[0][12] += this._core.config.ipd * 0.5; + copy$4(this._vMatrices[1], this._vMatrices[0]); + this._vMatrices[1][12] -= this._core.config.ipd; + const frustumShift = this._core.config.ipd * 0.5 * this._core.config.nearPlane / this._core.config.screenDistance; + const top = Math.tan(this._core.config.fov * 0.5) * this._core.config.nearPlane; + const bottom = -top; + let left = -aspectRatio * top + frustumShift; + let right = aspectRatio * top + frustumShift; + frustum(this._pMatrices[0], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + left = -aspectRatio * top - frustumShift; + right = aspectRatio * top - frustumShift; + frustum(this._pMatrices[1], left, right, bottom, top, this._core.config.nearPlane, this._core.config.farPlane); + multiply$2(this._mvMatrices[0], this._vMatrices[0], this.modelMMatrix); + multiply$2(this._mvMatrices[1], this._vMatrices[1], this.modelMMatrix); + invert(this._inverseVMatrices[0], this._vMatrices[0]); + invert(this._inversePMatrices[0], this._pMatrices[0]); + copy$4(this._inverseVMatrices[1], this._inverseVMatrices[0]); + this._inverseVMatrices[1][12] += this._core.config.ipd; + invert(this._inversePMatrices[1], this._pMatrices[1]); + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`cam off ${this._cameraPosition[0] < 0 ? "" : " "}${this._cameraPosition[0].toFixed(3)},${this._cameraPosition[1] < 0 ? "" : " "}${this._cameraPosition[1].toFixed(3)},${this._cameraPosition[2] < 0 ? "" : " "}${this._cameraPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam pos ${this._combinedPosition[0] < 0 ? "" : " "}${this._combinedPosition[0].toFixed(3)},${this._combinedPosition[1] < 0 ? "" : " "}${this._combinedPosition[1].toFixed(3)},${this._combinedPosition[2] < 0 ? "" : " "}${this._combinedPosition[2].toFixed(3)}`); + this._core.debugText.addLine(`cam rot ${this._combinedRotation[0] < 0 ? "" : " "}${this._combinedRotation[0].toFixed(3)},${this._combinedRotation[1] < 0 ? "" : " "}${this._combinedRotation[1].toFixed(3)},${this._combinedRotation[2] < 0 ? "" : " "}${this._combinedRotation[2].toFixed(3)},${this._combinedRotation[3] < 0 ? "" : " "}${this._combinedRotation[3].toFixed(3)}`); + } } - static getScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - (0, _glMatrix.vec3).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true)); + _zoom(direction, distance2) { + scaleAndAdd(this._cameraPosition, this._cameraPosition, direction, distance2); } - static setScale(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.SCALE_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); + rotate(translationDelta) { } - static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - } - static getRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setRotation(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ROTATION_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + zoom(zoomDelta, x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + normalize$2(this._vec3, this._vec3); + const distance$1 = zoomDelta * distance(this._combinedPosition, this.modelPosition); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + this._zoom(this._vec3, distance$1); } - static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - (0, _glMatrix.quat).set(value, bufferView.getFloat32(offset, true), bufferView.getFloat32(offset + 4, true), bufferView.getFloat32(offset + 8, true), bufferView.getFloat32(offset + 12, true)); - } - static setTexCoord(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.TEXCOORD_OFFSET_BYTES; - bufferView.setFloat32(offset, value[0], true); - bufferView.setFloat32(offset + 4, value[1], true); - bufferView.setFloat32(offset + 8, value[2], true); - bufferView.setFloat32(offset + 12, value[3], true); + _twist(axis, angle2) { } - static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { - const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; - const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; - toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); - toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); - toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); - toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); - } - static getIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - (0, _glMatrix.vec4).set(value, bufferView.getUint8(offset) / 0xFF, bufferView.getUint8(offset + 1) / 0xFF, bufferView.getUint8(offset + 2) / 0xFF, bufferView.getUint8(offset + 3) / 0xFF); - } - static setIdColor(bufferView, index, value) { - const offset = UnitVertex.SIZE_BYTES * index + this.ID_COLOR_OFFSET_BYTES; - bufferView.setUint8(offset, value[0] * 0xFF); - bufferView.setUint8(offset + 1, value[1] * 0xFF); - bufferView.setUint8(offset + 2, value[2] * 0xFF); - bufferView.setUint8(offset + 3, value[3] * 0xFF); - } - static getSelected(bufferView, index) { - return bufferView.getInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES) / 0x7F; - } - static setSelected(bufferView, index, value) { - bufferView.setInt8(UnitVertex.SIZE_BYTES * index + this.SELECTED_OFFSET_BYTES, value * 0x7F); + twist(angle2, x2, y2) { } - static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); + updatePickVMatrix(x2, y2) { + this.unproject(this._vec3, x2, y2, 1); + lookAt(this._pickVMatrix, this._combinedPosition, this._vec3, this._up); } - static getRounding(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, true); + syncSmooth() { + copy$3(this._smoothedCameraPosition, this._cameraPosition); + copy$1(this._smoothedCameraRotation, this._cameraRotation); + copy$1(this._smoothedOrbitRotation, this._orbitRotation); } - static setRounding(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.ROUNDING_OFFSET_BYTES, value, true); + updateModelManipulationOrigin(from, to) { + const a2 = create$3(); + const b2 = create$3(); + const c2 = create$3(); + const d = create$3(); + transformMat4$2(a2, from, this.modelMMatrix); + transformMat4$2(b2, to, this.modelMMatrix); + subtract(a2, this._cameraPosition, a2); + subtract(b2, this._cameraPosition, b2); + transformQuat(c2, a2, this._orbitDirection); + transformQuat(d, b2, this._orbitDirection); + subtract(c2, c2, a2); + subtract(d, d, b2); + subtract(this._vec3, c2, d); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + add(this._cameraPosition, this._cameraPosition, this._vec3); + add(this._smoothedCameraPosition, this._smoothedCameraPosition, this._vec3); + } + unproject(position2, x2, y2, z) { + set$3(position2, 2 * x2 / this.width - 1, 1 - 2 * y2 / this.height, z); + transformMat4$2(position2, position2, this._inversePMatrices[0]); + transformMat4$2(position2, position2, this._inverseVMatrices[0]); } - static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); + translate(translationDelta) { + const distance$1 = distance(this.modelPosition, this._combinedPosition); + const height2 = 2 * Math.tan(this._core.config.fov / 2) * distance$1 / this.height; + set$3(this._vec3, height2 * translationDelta[0], -height2 * translationDelta[1], 0); + transformQuat(this._vec3, this._vec3, this._combinedRotation); + transformQuat(this._vec3, this._vec3, this._orbitRotation); + subtract(this._cameraPosition, this._cameraPosition, this._vec3); } - static getParameter1(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, true); + } + class AltAzimuthCamera extends CameraBase { + getView(view) { + super.getView(view); + view.altitude = this.altitude; + view.azimuth = this.azimuth; + view.fov = this._core.config.fov; } - static setParameter1(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_1_OFFSET_BYTES, value, true); + setView(view, isSmooth) { + super.setView(view, isSmooth); + this.setAltAzimuth(view.altitude, view.azimuth, isSmooth); + this._core.config.fov = view.fov; } - static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); + lerpView(from, to, time2) { + super.lerpView(from, to, time2); + this.setAltAzimuth(MathHelper.lerp(from.altitude, to.altitude, time2), MathHelper.lerp(from.azimuth, to.azimuth, time2), false); + this._core.config.fov = MathHelper.lerp(from.fov, to.fov, time2); } - static getParameter2(bufferView, index) { - return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, true); + update(elapsedTime) { + super.update(elapsedTime); + if (this._core.config.isDebugVisible) { + const altitude = AngleHelper.radiansToDegrees(this.altitude); + const azimuth = AngleHelper.radiansToDegrees(this.azimuth); + this._core.debugText.addLine(`cam alt ${altitude < 0 ? "" : " "}${altitude.toFixed(1)}`); + this._core.debugText.addLine(`cam azi ${azimuth < 0 ? "" : " "}${azimuth.toFixed(1)}`); + } } - static setParameter2(bufferView, index, value) { - bufferView.setFloat32(UnitVertex.SIZE_BYTES * index + this.PARAMETER_2_OFFSET_BYTES, value, true); + get altitude() { + transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITY, this._up, this._right); } - static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); + get azimuth() { + transformQuat(this._up, Constants.VECTOR3_UNITY, this._combinedRotation); + transformQuat(this._right, Constants.VECTOR3_UNITX, this._combinedRotation); + return -AngleHelper.signedAngleBetweenVectors(Constants.VECTOR3_UNITX, this._right, this._up); } - static getMaterial(bufferView, index) { - return bufferView.getUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES); + setAltAzimuth(altitude, azimuth, isSmooth) { + setAxisAngle(this._quat, Constants.VECTOR3_UNITX, altitude); + multiply(this._orbitRotation, this._quat, Constants.QUAT_IDENTITY); + setAxisAngle(this._quat, Constants.VECTOR3_UNITY, azimuth); + multiply(this._orbitRotation, this._orbitRotation, this._quat); + if (!isSmooth) { + this.syncSmooth(); + } } - static setMaterial(bufferView, index, value) { - bufferView.setUint16(UnitVertex.SIZE_BYTES * index + this.MATERIAL_OFFSET_BYTES, value); + rotate(translationDelta) { + const length2 = Math.min(this.width, this.height); + let angle2 = translationDelta[1] * Constants.PI / length2; + setAxisAngle(this._quat, Constants.VECTOR3_UNITX, angle2); + multiply(this._orbitRotation, this._quat, this._orbitRotation); + angle2 = translationDelta[0] * Constants.PI / length2; + setAxisAngle(this._quat, Constants.VECTOR3_UNITY, angle2); + multiply(this._orbitRotation, this._orbitRotation, this._quat); } - static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); + } + let Config$2 = class Config { + constructor(core) { + this.reset(); } - static getTexture(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES); + reset() { + this.isDebugVisible = false; + this.logLevel = LogLevel.warn; + this.shaderPath = "shaders"; + this.fontPath = "fonts"; + this.modelDistance = 0.5; + this.modelSize = 0.25; + this.stereoMode = StereoMode.none; + this.ipd = 0.06; + this.screenDistance = 0.5; + this.fov = AngleHelper.degreesToRadians(30); + this.nearPlane = 0.01; + this.farPlane = 100; + this.pickWidth = 512; + this.pickHeight = 512; + this.pickHoldDelay = 1e3; + this.pickSelectDelay = 100; + this.resizeMinimumDelay = 250; + this.rotationSmoothing = 0.02; + this.positionSmoothing = 0.02; + this.focusSmoothing = 0.01; + this.scaleSmoothing = 0.02; + this.mouseWheelZoomScale = -2e-3; + this.mouseWheelRotationScale = -2e-3; + this.dragToleranceSquared = 100; + this.manipulatorMinRelativeDistanceSquared = 100; + this.isMultiTouchEnabled = true; + this.isMultiTouchZoomEnabled = true; + this.isMultiTouchTwistEnabled = true; + this.isMultiTouchRotateEnabled = true; + this.isMultiTouchTranslateEnabled = true; + this.multiTouchZoomScale = 1; + this.cameraMinDistance = 0.1; + this.cameraMaxDistance = 10; + this.xrControllerRayColor = fromValues$3(0.5, 0.5, 0.5); + this.xrControllerProfile = "windows-mixed-reality"; + this.xrControllerHandedness = "right"; + this.paletteColor = new Uint8Array([128, 128, 128, 0]); + this.textColor = create$3(); + this.textHoverColor = create$3(); + this.textBorderColor = create$3(); + this.textBorderWidth = 24 / 255; + this.identityRotation = Constants.VECTOR3_UNITY; + this.axesTextLabelMaxGlyphs = 32; + this.axesTextColor = create$3(); + this.axesTextBorderColor = create$3(); + this.axesTextHoverColor = create$3(); + this.axesTextLabelMajorSize = 0.03; + this.axesTextLabelMinorSize = 0.02; + this.axesTextTitleMaxGlyphs = 127; + this.axesTextTitleSize = 0.05; + this.axesTextHeadingMaxGlyphs = 128; + this.axesTextHeadingSize = 0.075; + this.axesTextTitleLineHeight = 1.5; + this.axesTextHeadingLineHeight = 1.5; + this.axesTextLabelLineHeight = 1.5; + this.axesGridMajorThickness = 2e-4; + this.axesGridMinorThickness = 1e-4; + this.axesGridZeroThickness = 2e-3; + this.axesGridPickDivisionHeight = 0.025; + this.axesGridBackgroundColor = create$3(); + this.axesGridHighlightColor = create$3(); + this.axesGridMinorColor = create$3(); + this.axesGridMajorColor = create$3(); + this.axesGridZeroColor = create$3(); + this.axesGridDefaultDivisions = 10; + this.keyTitleMaxGlyphs = 64; + this.keyLabelMaxGlyphs = 64; + this.selectionColor = create$3(); + this.hoverColor = create$3(); + this.activeColor = create$3(); + this.highlightMode = HighlightMode.color; + this.lassoThickness = 4; + this.lassoDashWidth = 2; + this.lassoColor = create$3(); + this.minCubifiedTreeMapSlice = 0.01; + this.sdfBuffer = 192; + this.sdfBorder = 0; + this.forceDirectIsEnabled = false; + this.forceDirectAttraction = 1; + this.forceDirectRepulsion = 1; + this.forceDirectGravity = 1; + this.forceDirectInterval = 0.1; + this.forceDirectMaxDistance = 0.1; + this.forceDirectTheta = 1; + this.forceDirectIterationsPerLayout = 1; + this.forceDirectEdgeWeightPower = 1; + this.forceDirectLockX = false; + this.forceDirectLockY = false; + this.forceDirectLockZ = false; + this.transitionDuration = 400; + this.transitionStaggering = 100; + this.transitionView = true; + this.isTransitionPickingEnabled = false; + this.backgroundColor = create$2(); + this.theme = Theme.light; + this.ambientColor = create$3(); + this.renderMode = RenderMode.color; + this.tilesX = 1; + this.tilesY = 1; + this.tileOffsetX = 0; + this.tileOffsetY = 0; } - static setTexture(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.TEXTURE_OFFSET_BYTES, value); + get theme() { + return this._theme; + } + set theme(value2) { + if (this._theme != value2) { + this._theme = value2; + switch (value2) { + case Theme.dark: + set$2(this.backgroundColor, 0, 0, 0, 1); + set$3(this.textColor, 0.9, 0.9, 0.9); + set$3(this.textHoverColor, 1, 1, 1); + set$3(this.textBorderColor, 0, 0, 0); + set$3(this.axesTextColor, 0.9, 0.9, 0.9); + set$3(this.axesTextBorderColor, 0, 0, 0); + set$3(this.axesTextHoverColor, 1, 1, 1); + set$3(this.axesGridBackgroundColor, 0.02, 0.02, 0.02); + set$3(this.axesGridHighlightColor, 0.04, 0.04, 0.04); + set$3(this.axesGridMinorColor, 0.05, 0.05, 0.05); + set$3(this.axesGridMajorColor, 0.1, 0.1, 0.1); + set$3(this.axesGridZeroColor, 0.05, 0.1, 0.1); + set$3(this.selectionColor, 1, 1, 0); + set$3(this.hoverColor, 1, 0, 1); + set$3(this.activeColor, 0, 1, 1); + set$3(this.lassoColor, 0.9, 0.9, 0.9); + break; + case Theme.light: + set$2(this.backgroundColor, 1, 1, 1, 1); + set$3(this.textColor, 0, 0, 0); + set$3(this.textHoverColor, 0.1, 0.1, 0.1); + set$3(this.textBorderColor, 1, 1, 1); + set$3(this.axesTextColor, 0, 0, 0); + set$3(this.axesTextBorderColor, 1, 1, 1); + set$3(this.axesTextHoverColor, 0.1, 0.1, 0.1); + set$3(this.axesGridBackgroundColor, 1, 1, 1); + set$3(this.axesGridHighlightColor, 0.925, 0.925, 0.925); + set$3(this.axesGridMinorColor, 0.9, 0.9, 0.9); + set$3(this.axesGridMajorColor, 0.8, 0.8, 0.8); + set$3(this.axesGridZeroColor, 0.7, 0.9, 0.9); + set$3(this.selectionColor, 1, 1, 0); + set$3(this.hoverColor, 1, 0, 1); + set$3(this.activeColor, 0, 1, 1); + set$3(this.lassoColor, 0.1, 0.1, 0.1); + break; + } + if (this.themeChangedCallback) { + this.themeChangedCallback(this._theme); + } + } } - static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); + }; + class DebugText { + get text() { + return this._text; } - static getSdfBuffer(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES); + constructor() { + this.clear(); } - static setSdfBuffer(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BUFFER_OFFSET_BYTES, value); + clear() { + this._text = ""; } - static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); + addLine(value2) { + this._text += value2 + "\n"; } - static getSdfBorder(bufferView, index) { - return bufferView.getUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES); + } + class Fps { + get frameCounter() { + return this._frameCounter; } - static setSdfBorder(bufferView, index, value) { - bufferView.setUint8(UnitVertex.SIZE_BYTES * index + this.SDF_BORDER_OFFSET_BYTES, value); + get totalFrames() { + return this._totalFrames; } - static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { - toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); - } -} -UnitVertex.SIZE_BYTES = 92; -UnitVertex.ID_HOVER_OFFSET_BYTES = 0; -UnitVertex.ID_COLOR_OFFSET_BYTES = 4; -UnitVertex.ORDER_OFFSET_BYTES = 8; -UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; -UnitVertex.SELECTED_OFFSET_BYTES = 80; -UnitVertex.TRANSLATION_OFFSET_BYTES = 16; -UnitVertex.COLOR_OFFSET_BYTES = 28; -UnitVertex.MATERIAL_OFFSET_BYTES = 30; -UnitVertex.SCALE_OFFSET_BYTES = 32; -UnitVertex.ROUNDING_OFFSET_BYTES = 44; -UnitVertex.ROTATION_OFFSET_BYTES = 48; -UnitVertex.TEXCOORD_OFFSET_BYTES = 64; -UnitVertex.TEXTURE_OFFSET_BYTES = 81; -UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; -UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; -UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; -UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dYecn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class Cube { -} -Cube.POSITIONS = new Float32Array([ - -0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - 0.5, - -0.5, - 0.5, - -0.5, - 0.5, - 0.5, - -0.5, - 0.5, - -0.5, - -0.5, - -0.5, - -0.5, - -0.5 -]); -Cube.INDICES = new Uint16Array([ - 5, - 4, - 1, - 0, - 3, - 4, - 7, - 5, - 6, - 1, - 2, - 3, - 6, - 7 -]); -Cube.CUBE_MAP_INDICES = new Uint16Array([ - 2, - 3, - 1, - 0, - 4, - 3, - 7, - 2, - 6, - 1, - 5, - 4, - 6, - 7 -]); -Cube.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Cube.FACE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0.0, 0.5, 0.0), - (0, _glMatrix.vec3).fromValues(0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, -0.5, 0.0), - (0, _glMatrix.vec3).fromValues(-0.5, 0.0, 0.0), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, 0.5), - (0, _glMatrix.vec3).fromValues(0.0, 0.0, -0.5) -]; -Cube.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, -1, 0, 1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, -1, 0, 1, 0, 1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 0, 1, 0, -1, 0), - (0, _glMatrix.mat3).fromValues(0, 0, 1, 0, 1, 0, -1, 0, 0), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Cube.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, 0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, -0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0.5), - (0, _glMatrix.vec3).fromValues(0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, -0.5), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0.5) -]; -Cube.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; -Cube.EDGE_CORNERS = [ - [ - 0, - 1 - ], - [ - 1, - 5 - ], - [ - 4, - 5 - ], - [ - 0, - 4 - ], - [ - 2, - 3 - ], - [ - 2, - 6 - ], - [ - 6, - 7 - ], - [ - 3, - 7 - ], - [ - 1, - 2 - ], - [ - 5, - 6 - ], - [ - 4, - 7 - ], - [ - 0, - 3 - ] -]; -Cube.EDGE_FACES = [ - [ - 0, - 4 - ], - [ - 0, - 1 - ], - [ - 0, - 5 - ], - [ - 0, - 3 - ], - [ - 2, - 4 - ], - [ - 2, - 1 - ], - [ - 2, - 5 - ], - [ - 2, - 3 - ], - [ - 1, - 4 - ], - [ - 1, - 5 - ], - [ - 3, - 5 - ], - [ - 3, - 4 - ] -]; -Cube.EDGE_AXIS = [ - 0, - 2, - 0, - 2, - 0, - 2, - 0, - 2, - 1, - 1, - 1, - 1 -]; -Cube.AXIS_EDGES = [ - [ - 0, - 2, - 4, - 6 - ], - [ - 8, - 9, - 10, - 11 - ], - [ - 1, - 3, - 5, - 7 - ] -]; -Cube.AXIS_FACES = [ - [ - 1, - 3 - ], - [ - 0, - 2 - ], - [ - 4, - 5 - ] -]; -Cube.OPPOSITE_FACES = [ - 2, - 3, - 0, - 1, - 5, - 4 -]; -Cube.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Cube.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, (0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues((0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO), - (0, _glMatrix.vec3).fromValues(-(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO, 0, -(0, _constantsJs.Constants).ROOT_TWO_OVER_TWO) -]; - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ffHCZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MatrixHelper", ()=>MatrixHelper); -class MatrixHelper { - static fieldOfViewFromProjectionMatrix(p) { - return 2 * Math.atan(1 / p[5]); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fmvJ2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>Cartesian3dAxesHelper); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>Cartesian3dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _cubeJs = require("../../meshes/cube.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian3dAxesHelper { - static create(core, options) { - const cartesian3dAxes = new Cartesian3dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const minValueZ = options.minValueZ === undefined ? 0 : options.minValueZ; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const maxValueZ = options.maxValueZ === undefined ? 1 : options.maxValueZ; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian3dAxes.minBoundsX = minBoundsX; - cartesian3dAxes.minBoundsY = minBoundsY; - cartesian3dAxes.minBoundsZ = minBoundsZ; - cartesian3dAxes.maxBoundsX = maxBoundsX; - cartesian3dAxes.maxBoundsY = maxBoundsY; - cartesian3dAxes.maxBoundsZ = maxBoundsZ; - cartesian3dAxes.scalingX = scaling; - cartesian3dAxes.scalingY = scaling; - cartesian3dAxes.scalingZ = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, Math.max(maxBoundsY - minBoundsY, maxBoundsZ - minBoundsZ)); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY, - options.divisionsZ == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsZ - minBoundsZ) / maxLength), 1) : options.divisionsZ - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY, - options.minorGridlinesZ == undefined ? 2 : options.minorGridlinesZ - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY, - options.labelMajorSizeZ === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeZ - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY, - options.labelMinorSizeZ === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeZ - ]; - cartesian3dAxes.isDiscreteX = options.isDiscreteX; - cartesian3dAxes.isDiscreteY = options.isDiscreteY; - cartesian3dAxes.isDiscreteZ = options.isDiscreteZ; - cartesian3dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY, - options.isDivisionPickingEnabledZ - ]; - const isLabelPickingEnabledArray = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY, - options.isLabelPickingEnabledZ - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY, - options.reverseZ - ]; - const labelsArray = [ - options.labelsX, - options.labelsY, - options.labelsZ - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY, - options.labelOrientationZ - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const areTicksVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY, - options.arePickDivisionsVisibleZ - ]; - const minValueArray = [ - minValueX, - minValueY, - minValueZ - ]; - const maxValueArray = [ - maxValueX, - maxValueY, - maxValueZ - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY, - options.isDiscreteZ - ]; - const titleArray = [ - options.titleX, - options.titleY, - options.titleZ - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY, - options.titleSizeZ - ]; - const headingArray = [ - options.headingX, - options.headingY, - options.headingZ - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY, - options.headingSizeZ - ]; - for(let axisId = 0; axisId < 3; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian3dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian3dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian3dAxes.setLabels(axisId, discreteAxis.labels); - cartesian3dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian3dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian3dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian3dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian3dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian3dAxes.setLabels(axisId, continuousAxis.labels); - cartesian3dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian3dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian3dAxes.setLabelSizes(axisId, labelSizes); - cartesian3dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian3dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian3dAxes.setTitle(axisId, titleArray[axisId]); - cartesian3dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian3dAxes.setHeading(axisId, headingArray[axisId]); - cartesian3dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian3dAxes.arePickDivisionsVisible[axisId] = areTicksVisibleArray[axisId] === undefined ? true : areTicksVisibleArray[axisId]; - cartesian3dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian3dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabledArray[axisId]; - cartesian3dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian3dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian3dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian3dAxes; - } -} -class Cartesian3dAxes extends (0, _axesJs.AxesBase) { - get size() { - return this._size; + constructor(core) { + this._core = core; + this._totalFrames = 0; + this.reset(); } - get isDiscreteX() { - return this._isDiscrete[0]; + update(elapsedTime) { + this._elapsedTime += elapsedTime; + if (this._elapsedTime > 1e3) { + this._elapsedTime -= 1e3; + this._fps = this._frameCounter; + this._frameCounter = 0; + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`fps ${this._fps}`); + } } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } + render() { + this._frameCounter++; + this._totalFrames++; } - get isDiscreteY() { - return this._isDiscrete[1]; + reset() { + this._fps = 0; + this._frameCounter = 0; + this._elapsedTime = 0; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } + } + const PaletteType = { + sequentialsinglehue: "sequentialsinglehue", + sequentialmultihue: "sequentialmultihue", + diverging: "diverging", + qualitative: "qualitative" + }; + class PaletteResources { + constructor() { + this.palettes = { + "blues": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 251, 255, 222, 235, 247, 198, 219, 239, 158, 202, 225, 107, 174, 214, 66, 146, 198, 33, 113, 181, 8, 81, 156, 8, 48, 107]) }, + "greens": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([247, 252, 245, 229, 245, 224, 199, 233, 192, 161, 217, 155, 116, 196, 118, 65, 171, 93, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "greys": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 255, 255, 240, 240, 240, 217, 217, 217, 189, 189, 189, 150, 150, 150, 115, 115, 115, 82, 82, 82, 37, 37, 37, 0, 0, 0]) }, + "oranges": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 235, 254, 230, 206, 253, 208, 162, 253, 174, 107, 253, 141, 60, 241, 105, 19, 217, 72, 1, 166, 54, 3, 127, 39, 4]) }, + "purples": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([252, 251, 253, 239, 237, 245, 218, 218, 235, 188, 189, 220, 158, 154, 200, 128, 125, 186, 106, 81, 163, 84, 39, 143, 63, 0, 125]) }, + "reds": { type: PaletteType.sequentialsinglehue, colors: new Uint8Array([255, 245, 240, 254, 224, 210, 252, 187, 161, 252, 146, 114, 251, 106, 74, 239, 59, 44, 203, 24, 29, 165, 15, 21, 103, 0, 13]) }, + "viridis": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([72, 37, 117, 65, 68, 135, 53, 96, 141, 42, 120, 142, 33, 145, 141, 34, 168, 132, 67, 191, 113, 122, 209, 81, 188, 223, 39]) }, + "inferno": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([23, 12, 59, 66, 10, 104, 107, 23, 110, 147, 38, 103, 187, 55, 85, 221, 81, 58, 243, 119, 26, 252, 165, 10, 246, 214, 69]) }, + "magma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([21, 14, 55, 59, 15, 112, 101, 26, 128, 140, 41, 129, 182, 55, 122, 222, 73, 104, 247, 111, 92, 254, 159, 109, 254, 206, 145]) }, + "plasma": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([66, 3, 157, 106, 0, 168, 144, 13, 164, 177, 42, 144, 203, 71, 121, 225, 100, 98, 242, 131, 76, 252, 166, 54, 252, 206, 37]) }, + "bluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 229, 245, 249, 204, 236, 230, 153, 216, 201, 102, 194, 164, 65, 174, 118, 35, 139, 69, 0, 109, 44, 0, 68, 27]) }, + "bluepurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 253, 224, 236, 244, 191, 211, 230, 158, 188, 218, 140, 150, 198, 140, 107, 177, 136, 65, 157, 129, 15, 124, 77, 0, 75]) }, + "greenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 252, 240, 224, 243, 219, 204, 235, 197, 168, 221, 181, 123, 204, 196, 78, 179, 211, 43, 140, 190, 8, 104, 172, 8, 64, 129]) }, + "orangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 236, 254, 232, 200, 253, 212, 158, 253, 187, 132, 252, 141, 89, 239, 101, 72, 215, 48, 31, 179, 0, 0, 127, 0, 0]) }, + "purpleblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 231, 242, 208, 209, 230, 166, 189, 219, 116, 169, 207, 54, 144, 192, 5, 112, 176, 4, 90, 141, 2, 56, 88]) }, + "purplebluegreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 251, 236, 226, 240, 208, 209, 230, 166, 189, 219, 103, 169, 207, 54, 144, 192, 2, 129, 138, 1, 108, 89, 1, 70, 54]) }, + "purplered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([247, 244, 249, 231, 225, 239, 212, 185, 218, 201, 148, 199, 223, 101, 176, 231, 41, 138, 206, 18, 86, 152, 0, 67, 103, 0, 31]) }, + "redpurple": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 247, 243, 253, 224, 221, 252, 197, 192, 250, 159, 181, 247, 104, 161, 221, 52, 151, 174, 1, 126, 122, 1, 119, 73, 0, 106]) }, + "yellowgreen": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 247, 252, 185, 217, 240, 163, 173, 221, 142, 120, 198, 121, 65, 171, 93, 35, 132, 67, 0, 104, 55, 0, 69, 41]) }, + "yellowgreenblue": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 217, 237, 248, 177, 199, 233, 180, 127, 205, 187, 65, 182, 196, 29, 145, 192, 34, 94, 168, 37, 52, 148, 8, 29, 88]) }, + "yelloworangebrown": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 229, 255, 247, 188, 254, 227, 145, 254, 196, 79, 254, 153, 41, 236, 112, 20, 204, 76, 2, 153, 52, 4, 102, 37, 6]) }, + "yelloworangered": { type: PaletteType.sequentialmultihue, colors: new Uint8Array([255, 255, 204, 255, 237, 160, 254, 217, 118, 254, 178, 76, 253, 141, 60, 252, 78, 42, 227, 26, 28, 189, 0, 38, 128, 0, 38]) }, + "brownbluegreen": { type: PaletteType.diverging, colors: new Uint8Array([84, 48, 5, 140, 81, 10, 191, 129, 45, 223, 194, 125, 246, 232, 195, 245, 245, 245, 199, 234, 229, 128, 205, 193, 53, 151, 143, 1, 102, 94, 0, 60, 48]) }, + "pinkyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([142, 1, 82, 197, 27, 125, 222, 119, 174, 241, 182, 218, 253, 224, 239, 247, 247, 247, 230, 245, 208, 184, 225, 134, 127, 188, 65, 77, 146, 33, 39, 100, 25]) }, + "purplegreen": { type: PaletteType.diverging, colors: new Uint8Array([64, 0, 75, 118, 42, 131, 153, 112, 171, 194, 165, 207, 231, 212, 232, 247, 247, 247, 217, 240, 211, 166, 219, 160, 90, 174, 97, 27, 120, 55, 0, 68, 27]) }, + "purpleorange": { type: PaletteType.diverging, colors: new Uint8Array([127, 59, 8, 179, 88, 6, 224, 130, 20, 253, 184, 99, 254, 224, 182, 247, 247, 247, 216, 218, 235, 178, 171, 210, 128, 115, 172, 84, 39, 136, 45, 0, 75]) }, + "redblue": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 247, 247, 247, 209, 229, 240, 146, 197, 222, 67, 147, 195, 33, 102, 172, 5, 48, 97]) }, + "redgrey": { type: PaletteType.diverging, colors: new Uint8Array([103, 0, 31, 178, 24, 43, 214, 96, 77, 244, 165, 130, 253, 219, 199, 255, 255, 255, 224, 224, 224, 186, 186, 186, 135, 135, 135, 77, 77, 77, 26, 26, 26]) }, + "redyellowblue": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 144, 255, 255, 191, 224, 243, 248, 171, 217, 233, 116, 173, 209, 69, 117, 180, 49, 54, 149]) }, + "redyellowgreen": { type: PaletteType.diverging, colors: new Uint8Array([165, 0, 38, 215, 48, 39, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 217, 239, 139, 166, 217, 106, 102, 189, 99, 26, 152, 80, 0, 104, 55]) }, + "spectral": { type: PaletteType.diverging, colors: new Uint8Array([158, 1, 66, 213, 62, 79, 244, 109, 67, 253, 174, 97, 254, 224, 139, 255, 255, 191, 230, 245, 152, 171, 221, 164, 102, 194, 165, 50, 136, 189, 94, 79, 162]) }, + "accent": { type: PaletteType.qualitative, colors: new Uint8Array([127, 201, 127, 190, 174, 212, 253, 192, 134, 255, 255, 153, 56, 108, 176, 240, 2, 127, 191, 91, 23, 102, 102, 102]) }, + "category10": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 255, 127, 14, 44, 160, 44, 214, 39, 40, 148, 103, 189, 140, 86, 75, 227, 119, 194, 127, 127, 127, 188, 189, 34, 23, 190, 207]) }, + "category20": { type: PaletteType.qualitative, colors: new Uint8Array([31, 119, 180, 174, 199, 232, 255, 127, 14, 255, 187, 120, 44, 160, 44, 152, 223, 138, 214, 39, 40, 255, 152, 150, 148, 103, 189, 197, 176, 213, 140, 86, 75, 196, 156, 148, 227, 119, 194, 247, 182, 210, 127, 127, 127, 199, 199, 199, 188, 189, 34, 219, 219, 141, 23, 190, 207, 158, 218, 229]) }, + "dark2": { type: PaletteType.qualitative, colors: new Uint8Array([27, 158, 119, 217, 95, 2, 117, 112, 179, 231, 41, 138, 102, 166, 30, 230, 171, 2, 166, 118, 29, 102, 102, 102]) }, + "paired": { type: PaletteType.qualitative, colors: new Uint8Array([166, 206, 227, 31, 120, 180, 178, 223, 138, 51, 160, 44, 251, 154, 153, 227, 26, 28, 253, 191, 111, 255, 127, 0, 202, 178, 214, 106, 61, 154, 255, 255, 153, 177, 89, 40]) }, + "pastel1": { type: PaletteType.qualitative, colors: new Uint8Array([251, 180, 174, 179, 205, 227, 204, 235, 197, 222, 203, 228, 254, 217, 166, 255, 255, 204, 229, 216, 189, 253, 218, 236, 242, 242, 242]) }, + "pastel2": { type: PaletteType.qualitative, colors: new Uint8Array([179, 226, 205, 253, 205, 172, 203, 213, 232, 244, 202, 228, 230, 245, 201, 255, 242, 174, 241, 226, 204, 204, 204, 204]) }, + "set1": { type: PaletteType.qualitative, colors: new Uint8Array([228, 26, 28, 55, 126, 184, 77, 175, 74, 152, 78, 163, 255, 127, 0, 255, 255, 51, 166, 86, 40, 247, 129, 191, 153, 153, 153]) }, + "set2": { type: PaletteType.qualitative, colors: new Uint8Array([102, 194, 165, 252, 141, 98, 141, 160, 203, 231, 138, 195, 166, 216, 84, 255, 217, 47, 229, 196, 148, 179, 179, 179]) }, + "set3": { type: PaletteType.qualitative, colors: new Uint8Array([141, 211, 199, 255, 255, 179, 190, 186, 218, 251, 128, 114, 128, 177, 211, 253, 180, 98, 179, 222, 105, 252, 205, 229, 217, 217, 217, 188, 128, 189, 204, 235, 197, 255, 237, 111]) } + }; } - get isDiscreteZ() { - return this._isDiscrete[2]; + } + class PaletteBase { + get colors() { + return this._colors; } - set isDiscreteZ(value) { - if (value != this._isDiscrete[2]) { - this._isDiscrete[2] = value; - this._hasChanged = true; - } + set colors(value2) { + if (this._colors != value2) { + this._colors = value2; + this._changed = true; + } } - get minBoundsX() { - return this._minBoundsX; + constructor() { + this._colors = null; } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + copyFrom(palette) { + if (palette.colors) { + this.colors = new Uint8Array(palette.colors); + } else { + this.colors = null; + } } - get maxBoundsX() { - return this._maxBoundsX; + update() { } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + } + let Palette$2 = class Palette extends PaletteBase { + }; + class PositionVertex { + static getPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + set$3(value2, buffer[offset2], buffer[offset2 + 1], buffer[offset2 + 2]); } - get minBoundsY() { - return this._minBoundsY; + static setPosition(buffer, index2, value2) { + const offset2 = index2 * PositionVertex.SIZE; + buffer[offset2] = value2[0]; + buffer[offset2 + 1] = value2[1]; + buffer[offset2 + 2] = value2[2]; } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } + } + PositionVertex.SIZE = 3; + PositionVertex.SIZE_BYTES = 12; + class PositionColorVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set$3(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255); + } + static setColor(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); } - get maxBoundsY() { - return this._maxBoundsY; + } + PositionColorVertex.SIZE_BYTES = 16; + PositionColorVertex.POSITION_OFFSET_BYTES = 0; + PositionColorVertex.COLOR_OFFSET_BYTES = 12; + class PositionTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionColorVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + } + PositionTextureVertex.SIZE_BYTES = 16; + PositionTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionTextureVertex.TEX_COORD_OFFSET_BYTES = 12; + class PositionTexturePickVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$2(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PositionTexturePickVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); } - get minBoundsZ() { - return this._minBoundsZ; + } + PositionTexturePickVertex.SIZE_BYTES = 20; + PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES = 0; + PositionTexturePickVertex.POSITION_OFFSET_BYTES = 4; + PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES = 16; + class PositionNormalTextureVertex { + static getPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setPosition(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.POSITION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$3(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PositionNormalTextureVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); } - set minBoundsZ(value) { - if (value != this._minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } + } + PositionNormalTextureVertex.SIZE_BYTES = 20; + PositionNormalTextureVertex.POSITION_OFFSET_BYTES = 0; + PositionNormalTextureVertex.NORMAL_OFFSET_BYTES = 12; + PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES = 16; + class PickGridVertex { + static getTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); + } + static setTranslation(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + } + static getNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + set$3(value2, bufferView.getInt8(offset2) / 127, bufferView.getInt8(offset2 + 1) / 127, bufferView.getInt8(offset2 + 2) / 127); + } + static setNormal(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.NORMAL_OFFSET_BYTES; + bufferView.setInt8(offset2, value2[0] * 127); + bufferView.setInt8(offset2 + 1, value2[1] * 127); + bufferView.setInt8(offset2 + 2, value2[2] * 127); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$2(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + set(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.TEX_COORD_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + } + static getBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + set$2(value2, bufferView.getUint16(offset2, true) / 65535, bufferView.getUint16(offset2 + 2, true) / 65535, bufferView.getUint16(offset2 + 4, true) / 65535, bufferView.getUint16(offset2 + 6, true) / 65535); + } + static setBounds(bufferView, index2, value2) { + const offset2 = PickGridVertex.SIZE_BYTES * index2 + this.BOUNDS_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 65535, true); + bufferView.setUint16(offset2 + 2, value2[1] * 65535, true); + bufferView.setUint16(offset2 + 4, value2[2] * 65535, true); + bufferView.setUint16(offset2 + 6, value2[3] * 65535, true); } - get maxBoundsZ() { - return this._maxBoundsZ; + } + PickGridVertex.SIZE_BYTES = 32; + PickGridVertex.TRANSLATION_OFFSET_BYTES = 0; + PickGridVertex.NORMAL_OFFSET_BYTES = 12; + PickGridVertex.ID_COLOR_OFFSET_BYTES = 16; + PickGridVertex.TEX_COORD_OFFSET_BYTES = 20; + PickGridVertex.BOUNDS_OFFSET_BYTES = 24; + class UnitVertex { + static getIdHover(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, true); + } + static setIdHover(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ID_HOVER_OFFSET_BYTES, value2, true); } - set maxBoundsZ(value) { - if (value != this._minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + static copyIdHover(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ID_HOVER_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ID_HOVER_OFFSET_BYTES, true), true); } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; + static getTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - getIsForwardFace(index) { - return this._isForwardFace[index]; + static setTranslation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TRANSLATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } - get textVertices() { - return this._textVertices; + static copyTranslation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TRANSLATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TRANSLATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); } - get textIndices() { - return this._textIndices; + static getColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + set(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255); } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; + static setColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } + static copyColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } + static getOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + set(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true)); } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } + static setOrder(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ORDER_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); } - getLabelOrientation(index) { - return this._orientations[index]; + static copyOrder(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ORDER_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ORDER_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } + static getScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + set$3(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true)); } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; + static setScale(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SCALE_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; + static copyScale(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SCALE_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SCALE_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + } + static getRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + set$1(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setRotation(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ROTATION_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; + static copyRotation(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.ROTATION_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.ROTATION_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + set$1(value2, bufferView.getFloat32(offset2, true), bufferView.getFloat32(offset2 + 4, true), bufferView.getFloat32(offset2 + 8, true), bufferView.getFloat32(offset2 + 12, true)); + } + static setTexCoord(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.TEXCOORD_OFFSET_BYTES; + bufferView.setFloat32(offset2, value2[0], true); + bufferView.setFloat32(offset2 + 4, value2[1], true); + bufferView.setFloat32(offset2 + 8, value2[2], true); + bufferView.setFloat32(offset2 + 12, value2[3], true); } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } + static copyTexCoord(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.TEXCOORD_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.TEXCOORD_OFFSET_BYTES; + toBufferView.setFloat32(toOffset, fromBufferView.getFloat32(fromOffset, true), true); + toBufferView.setFloat32(toOffset + 4, fromBufferView.getFloat32(fromOffset + 4, true), true); + toBufferView.setFloat32(toOffset + 8, fromBufferView.getFloat32(fromOffset + 8, true), true); + toBufferView.setFloat32(toOffset + 12, fromBufferView.getFloat32(fromOffset + 12, true), true); + } + static getIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + set$2(value2, bufferView.getUint8(offset2) / 255, bufferView.getUint8(offset2 + 1) / 255, bufferView.getUint8(offset2 + 2) / 255, bufferView.getUint8(offset2 + 3) / 255); + } + static setIdColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.ID_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static getSelected(bufferView, index2) { + return bufferView.getInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES) / 127; + } + static setSelected(bufferView, index2, value2) { + bufferView.setInt8(UnitVertex.SIZE_BYTES * index2 + this.SELECTED_OFFSET_BYTES, value2 * 127); } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } + static copySelected(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setInt8(UnitVertex.SIZE_BYTES * toIndex + this.SELECTED_OFFSET_BYTES, fromBufferView.getInt8(UnitVertex.SIZE_BYTES * fromIndex + this.SELECTED_OFFSET_BYTES)); } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; + static getRounding(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, true); } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; + static setRounding(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.ROUNDING_OFFSET_BYTES, value2, true); } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; + static copyRounding(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.ROUNDING_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.ROUNDING_OFFSET_BYTES, true), true); } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } + static getParameter1(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, true); } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } + static setParameter1(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_1_OFFSET_BYTES, value2, true); } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; + static copyParameter1(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_1_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_1_OFFSET_BYTES, true), true); } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; + static getParameter2(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, true); } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; + static setParameter2(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.PARAMETER_2_OFFSET_BYTES, value2, true); } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; + static copyParameter2(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.PARAMETER_2_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.PARAMETER_2_OFFSET_BYTES, true), true); } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; + static getMaterial(bufferView, index2) { + return bufferView.getUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES); } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; + static setMaterial(bufferView, index2, value2) { + bufferView.setUint16(UnitVertex.SIZE_BYTES * index2 + this.MATERIAL_OFFSET_BYTES, value2); } - get gridVertices() { - return this._gridVertices; + static copyMaterial(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint16(UnitVertex.SIZE_BYTES * toIndex + this.MATERIAL_OFFSET_BYTES, fromBufferView.getUint16(UnitVertex.SIZE_BYTES * fromIndex + this.MATERIAL_OFFSET_BYTES, true), true); } - get gridIndices() { - return this._gridIndices; + static getTexture(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES); } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; + static setTexture(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.TEXTURE_OFFSET_BYTES, value2); } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; + static copyTexture(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.TEXTURE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.TEXTURE_OFFSET_BYTES)); } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; + static getSdfBuffer(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES); } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; + static setSdfBuffer(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BUFFER_OFFSET_BYTES, value2); } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; + static copySdfBuffer(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BUFFER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BUFFER_OFFSET_BYTES)); } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; + static getSdfBorder(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES); } - getGridTicksScale(index) { - return this._gridTicksScales[index]; + static setSdfBorder(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.SDF_BORDER_OFFSET_BYTES, value2); } - getGridFaceZero(index) { - return this._gridFaceZeros[index]; + static copySdfBorder(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.SDF_BORDER_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.SDF_BORDER_OFFSET_BYTES)); + } + static getMatId(bufferView, index2) { + return bufferView.getUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES); + } + static setMatId(bufferView, index2, value2) { + bufferView.setUint8(UnitVertex.SIZE_BYTES * index2 + this.MAT_TYPE_OFFSET_BYTES, value2); + } + static copyMatId(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_TYPE_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_TYPE_OFFSET_BYTES)); + } + static getMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint16(offset2) / 255; + value2[1] = bufferView.getUint16(offset2 + 2) / 255; + value2[2] = bufferView.getUint16(offset2 + 4) / 255; + } + static setMatColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_COLOR_OFFSET_BYTES; + bufferView.setUint16(offset2, value2[0] * 255); + bufferView.setUint16(offset2 + 2, value2[1] * 255); + bufferView.setUint16(offset2 + 4, value2[2] * 255); + } + static copyMatColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.MAT_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.MAT_COLOR_OFFSET_BYTES; + toBufferView.setUint16(toOffset, fromBufferView.getUint16(fromOffset)); + toBufferView.setUint16(toOffset + 2, fromBufferView.getUint16(fromOffset + 2)); + toBufferView.setUint16(toOffset + 4, fromBufferView.getUint16(fromOffset + 4)); + } + static getMatFuzz(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatFuzz(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_FUZZ_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatFuzz(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_FUZZ_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_FUZZ_OFFSET_BYTES)); + } + static getMatGloss(bufferView, index2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + return bufferView.getUint8(offset2) / 255; + } + static setMatGloss(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.MAT_GLOSS_OFFSET_BYTES; + bufferView.setUint8(offset2, value2 * 255); + } + static copyMatGloss(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setUint8(UnitVertex.SIZE_BYTES * toIndex + this.MAT_GLOSS_OFFSET_BYTES, fromBufferView.getUint8(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_GLOSS_OFFSET_BYTES)); + } + static getMatDensity(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, true); + } + static setMatDensity(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_DENSITY_OFFSET_BYTES, value2, true); + } + static copyMatDensity(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_DENSITY_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_DENSITY_OFFSET_BYTES, true), true); + } + static getMatRefractiveIndex(bufferView, index2) { + return bufferView.getFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true); + } + static setMatRefractiveIndex(bufferView, index2, value2) { + bufferView.setFloat32(UnitVertex.SIZE_BYTES * index2 + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, value2, true); + } + static copyMatRefractiveIndex(fromBufferView, fromIndex, toBufferView, toIndex) { + toBufferView.setFloat32(UnitVertex.SIZE_BYTES * toIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, fromBufferView.getFloat32(UnitVertex.SIZE_BYTES * fromIndex + this.MAT_REFRACTIVE_INDEX_OFFSET_BYTES, true), true); + } + static getSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + value2[0] = bufferView.getUint8(offset2) / 255; + value2[1] = bufferView.getUint8(offset2 + 1) / 255; + value2[2] = bufferView.getUint8(offset2 + 2) / 255; + value2[3] = bufferView.getUint8(offset2 + 3) / 255; + } + static setSegColor(bufferView, index2, value2) { + const offset2 = UnitVertex.SIZE_BYTES * index2 + this.SEG_COLOR_OFFSET_BYTES; + bufferView.setUint8(offset2, value2[0] * 255); + bufferView.setUint8(offset2 + 1, value2[1] * 255); + bufferView.setUint8(offset2 + 2, value2[2] * 255); + bufferView.setUint8(offset2 + 3, value2[3] * 255); + } + static copySegColor(fromBufferView, fromIndex, toBufferView, toIndex) { + const fromOffset = UnitVertex.SIZE_BYTES * fromIndex + this.SEG_COLOR_OFFSET_BYTES; + const toOffset = UnitVertex.SIZE_BYTES * toIndex + this.SEG_COLOR_OFFSET_BYTES; + toBufferView.setUint8(toOffset, fromBufferView.getUint8(fromOffset)); + toBufferView.setUint8(toOffset + 1, fromBufferView.getUint8(fromOffset + 1)); + toBufferView.setUint8(toOffset + 2, fromBufferView.getUint8(fromOffset + 2)); + toBufferView.setUint8(toOffset + 3, fromBufferView.getUint8(fromOffset + 3)); } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; + } + UnitVertex.SIZE_BYTES = 120; + UnitVertex.ID_HOVER_OFFSET_BYTES = 0; + UnitVertex.ID_COLOR_OFFSET_BYTES = 4; + UnitVertex.ORDER_OFFSET_BYTES = 8; + UnitVertex.STAGGER_ORDER_OFFSET_BYTES = 12; + UnitVertex.SELECTED_OFFSET_BYTES = 80; + UnitVertex.TRANSLATION_OFFSET_BYTES = 16; + UnitVertex.COLOR_OFFSET_BYTES = 28; + UnitVertex.MATERIAL_OFFSET_BYTES = 30; + UnitVertex.SCALE_OFFSET_BYTES = 32; + UnitVertex.ROUNDING_OFFSET_BYTES = 44; + UnitVertex.ROTATION_OFFSET_BYTES = 48; + UnitVertex.TEXCOORD_OFFSET_BYTES = 64; + UnitVertex.TEXTURE_OFFSET_BYTES = 81; + UnitVertex.SDF_BUFFER_OFFSET_BYTES = 82; + UnitVertex.SDF_BORDER_OFFSET_BYTES = 83; + UnitVertex.PARAMETER_1_OFFSET_BYTES = 84; + UnitVertex.PARAMETER_2_OFFSET_BYTES = 88; + UnitVertex.MAT_TYPE_OFFSET_BYTES = 92; + UnitVertex.MAT_COLOR_OFFSET_BYTES = 112; + UnitVertex.MAT_FUZZ_OFFSET_BYTES = 96; + UnitVertex.MAT_GLOSS_OFFSET_BYTES = 97; + UnitVertex.MAT_DENSITY_OFFSET_BYTES = 100; + UnitVertex.MAT_REFRACTIVE_INDEX_OFFSET_BYTES = 104; + UnitVertex.SEG_COLOR_OFFSET_BYTES = 108; + class ObjMesh { + } + class ObjHelper { + constructor(core) { + this._core = core; + } + read(data2) { + const start = window.performance.now(); + const indices = []; + const positions = []; + const normals = []; + const texCoords = []; + const meshes = []; + const indexOffsets = []; + const indexCounts = []; + const faceLookup = {}; + const lines = data2.split("\n"); + let faceCount = 0; + for (let i = 0; i < lines.length; i++) { + const parts = lines[i].trim().split(" "); + if (parts.length > 0) { + switch (parts[0]) { + case "o": + meshes.push(parts[1]); + indexOffsets.push(indices.length); + break; + case "v": + positions.push(parseFloat(parts[1])); + positions.push(parseFloat(parts[2])); + positions.push(parseFloat(parts[3])); + break; + case "vt": + texCoords.push(parseFloat(parts[1])); + texCoords.push(parseFloat(parts[2])); + break; + case "vn": + normals.push(parseFloat(parts[1])); + normals.push(parseFloat(parts[2])); + normals.push(parseFloat(parts[3])); + break; + case "f": + for (let i2 = 0; i2 < parts.length - 1; i2++) { + const part = parts[i2 + 1]; + if (faceLookup[part] == void 0) { + faceLookup[part] = faceCount++; + } + indices.push(faceLookup[part]); + } + break; + } + } + } + for (let i = 0; i < meshes.length - 1; i++) { + indexCounts.push(indexOffsets[i + 1] - indexOffsets[i]); + } + indexCounts.push(indices.length - indexOffsets[meshes.length - 1]); + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * Object.keys(faceLookup).length); + const dataView = new DataView(vertices); + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let minZ2 = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY2 = -Number.MAX_VALUE; + let maxZ = -Number.MAX_VALUE; + const faces = Object.keys(faceLookup); + const _vec2 = create(); + const _vec3 = create$3(); + let hasTexCoords, hasNormals; + if (faces.length > 0) { + const faceParts = faces[0].split("/"); + hasTexCoords = faceParts.length > 1 && !isNaN(parseInt(faceParts[1])); + hasNormals = faceParts.length > 2 && !isNaN(parseInt(faceParts[2])); + } + for (let i = 0; i < faces.length; i++) { + const faceParts = faces[i].split("/"); + let index2 = (parseInt(faceParts[0]) - 1) * 3; + const x2 = positions[index2]; + const y2 = positions[index2 + 1]; + const z = positions[index2 + 2]; + set$3(_vec3, x2, y2, z); + PositionNormalTextureVertex.setPosition(dataView, i, _vec3); + minX = Math.min(x2, minX); + minY = Math.min(y2, minY); + minZ2 = Math.min(z, minZ2); + maxX = Math.max(x2, maxX); + maxY2 = Math.max(y2, maxY2); + maxZ = Math.max(z, maxZ); + if (hasNormals) { + index2 = (parseInt(faceParts[2]) - 1) * 3; + set$3(_vec3, normals[index2], normals[index2 + 1], normals[index2 + 2]); + PositionNormalTextureVertex.setNormal(dataView, i, _vec3); + } + if (hasTexCoords) { + index2 = (parseInt(faceParts[1]) - 1) * 2; + set(_vec2, texCoords[index2], texCoords[index2 + 1]); + PositionNormalTextureVertex.setTexCoord(dataView, i, _vec2); + } + } + const originX = (minX + maxX) / 2; + const originY = (minY + maxY2) / 2; + const originZ = (minZ2 + maxZ) / 2; + const objMesh = new ObjMesh(); + objMesh.vertices = vertices; + objMesh.indices = new Uint16Array(indices); + objMesh.meshes = meshes; + objMesh.indexOffsets = indexOffsets; + objMesh.indexCounts = indexCounts; + objMesh.indexCount = indices.length; + objMesh.minX = minX; + objMesh.minY = minY; + objMesh.minZ = minZ2; + objMesh.maxX = maxX; + objMesh.maxY = maxY2; + objMesh.maxZ = maxZ; + objMesh.originX = originX; + objMesh.originY = originY; + objMesh.originZ = originZ; + this._core.log.write(LogLevel.info, `obj loaded ${Math.round(window.performance.now() - start)}ms`); + return objMesh; } - getGridFaceMinorGridlines(index) { - return this._gridFaceMinorGridlines[index]; + } + class Cube { + } + Cube.POSITIONS = new Float32Array([ + -0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + 0.5, + -0.5, + 0.5, + -0.5, + 0.5, + 0.5, + -0.5, + 0.5, + -0.5, + -0.5, + -0.5, + -0.5, + -0.5 + ]); + Cube.INDICES = new Uint16Array([5, 4, 1, 0, 3, 4, 7, 5, 6, 1, 2, 3, 6, 7]); + Cube.CUBE_MAP_INDICES = new Uint16Array([2, 3, 1, 0, 4, 3, 7, 2, 6, 1, 5, 4, 6, 7]); + Cube.FACE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Cube.FACE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0), + fromValues$3(0, 0, 0.5), + fromValues$3(0, 0, -0.5) + ]; + Cube.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 0, -1, 0, 1, 0), + fromValues$5(0, 0, -1, 0, 1, 0, 1, 0, 0), + fromValues$5(1, 0, 0, 0, 0, 1, 0, -1, 0), + fromValues$5(0, 0, 1, 0, 1, 0, -1, 0, 0), + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Cube.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0.5), + fromValues$3(0.5, 0.5, 0), + fromValues$3(0, 0.5, -0.5), + fromValues$3(-0.5, 0.5, 0), + fromValues$3(0, -0.5, 0.5), + fromValues$3(0.5, -0.5, 0), + fromValues$3(0, -0.5, -0.5), + fromValues$3(-0.5, -0.5, 0), + fromValues$3(0.5, 0, 0.5), + fromValues$3(0.5, 0, -0.5), + fromValues$3(-0.5, 0, -0.5), + fromValues$3(-0.5, 0, 0.5) + ]; + Cube.EDGE_NORMALS = [ + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO) + ]; + Cube.EDGE_CORNERS = [ + [0, 1], + [1, 5], + [4, 5], + [0, 4], + [2, 3], + [2, 6], + [6, 7], + [3, 7], + [1, 2], + [5, 6], + [4, 7], + [0, 3] + ]; + Cube.EDGE_FACES = [ + [0, 4], + [0, 1], + [0, 5], + [0, 3], + [2, 4], + [2, 1], + [2, 5], + [2, 3], + [1, 4], + [1, 5], + [3, 5], + [3, 4] + ]; + Cube.EDGE_AXIS = [ + 0, + 2, + 0, + 2, + 0, + 2, + 0, + 2, + 1, + 1, + 1, + 1 + ]; + Cube.AXIS_EDGES = [ + [0, 2, 4, 6], + [8, 9, 10, 11], + [1, 3, 5, 7] + ]; + Cube.AXIS_FACES = [ + [1, 3], + [0, 2], + [4, 5] + ]; + Cube.OPPOSITE_FACES = [ + 2, + 3, + 0, + 1, + 5, + 4 + ]; + Cube.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(1, 0, 0), + fromValues$3(0, 0, 1), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0), + fromValues$3(0, 1, 0) + ]; + Cube.EDGE_FORWARDS = [ + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, -Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(0, -Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, Constants.ROOT_TWO_OVER_TWO, 0), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, Constants.ROOT_TWO_OVER_TWO), + fromValues$3(Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO), + fromValues$3(-Constants.ROOT_TWO_OVER_TWO, 0, -Constants.ROOT_TWO_OVER_TWO) + ]; + let ControllerVisual$1 = class ControllerVisual { + render(elapsedTime, xrFrame) { } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + update(elapsedTime) { } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + constructor(controller) { + this.controller = controller; } - get scalingX() { - return this._scalingX; + }; + class Controller { + get isInitialized() { + return this._isInitialized; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + get mMatrix() { + return this._mMatrix; } - get scalingY() { - return this._scalingY; + get indexCount() { + return this._indexCount; } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } + get vertices() { + return this._vertices; } - get scalingZ() { - return this._scalingZ; + get indices() { + return this._indices; } - set scalingZ(value) { - if (value != this._scalingZ) { - this._scalingZ = value; - this._hasChanged = true; - } + get texture() { + return this._texture; } - get offsetX() { - return this._offset[12]; + get rayMMatrix() { + return this._rayMMatrix; } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; + get rayIndexCount() { + return this._rayIndexCount; } - get offsetY() { - return this._offset[13]; + get rayVertices() { + return this._rayVertices; } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; + get rayIndices() { + return this._rayIndices; } - get offsetZ() { - return this._offset[14]; - } - set offsetZ(value) { - if (value != this._offset[14]) this._offset[14] = value; - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._minBoundsZ = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._maxBoundsZ = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 6; i++)this._isForwardFace.push(false); - for(let i = 0; i < 12; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 12; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 3; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 3; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 3; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 12; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 12; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 6; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = []; - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = []; - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 3; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridFaceZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridFaceMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - } - for(let i = 0; i < 6; i++){ - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 12; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _cubeJs.Cube).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _cubeJs.Cube).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _cubeJs.Cube).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _cubeJs.Cube).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIVES[i], (0, _cubeJs.Cube).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null, - null - ]; - this._toValues = [ - null, - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false, - false - ]; - this.isAxisReversed = [ - false, - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._scalingZ = 1; - this._offset = (0, _glMatrix.mat4).create(); + constructor(core, options) { + this._cubeObj = `o Cube +v 1.000000 -1.000000 -1.000000 +v 1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 1.000000 +v -1.000000 -1.000000 -1.000000 +v 1.000000 1.000000 -0.999999 +v 0.999999 1.000000 1.000001 +v -1.000000 1.000000 1.000000 +v -1.000000 1.000000 -1.000000 +vt 1.000000 0.333333 +vt 1.000000 0.666667 +vt 0.666667 0.666667 +vt 0.666667 0.333333 +vt 0.666667 0.000000 +vt 0.000000 0.333333 +vt 0.000000 0.000000 +vt 0.333333 0.000000 +vt 0.333333 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.666667 +vt 0.333333 0.333333 +vt 0.333333 0.666667 +vt 1.000000 0.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn -0.000000 0.000000 1.000000 +vn -1.000000 -0.000000 -0.000000 +vn 0.000000 0.000000 -1.000000 +s off +f 2/1/1 3/2/1 4/3/1 +f 8/1/2 7/4/2 6/5/2 +f 5/6/3 6/7/3 2/8/3 +f 6/8/4 7/5/4 3/4/4 +f 3/9/5 7/10/5 8/11/5 +f 1/12/6 4/13/6 8/11/6 +f 1/4/1 2/1/1 4/3/1 +f 5/14/2 8/1/2 6/5/2 +f 1/12/3 5/6/3 2/8/3 +f 2/12/4 6/8/4 3/4/4 +f 4/13/5 3/9/5 8/11/5 +f 5/6/6 1/12/6 8/11/6`; + this._core = core; + this._obj = options.obj; + this._texture = options.texture || new ImageData(new Uint8ClampedArray([0, 0, 0, 255]), 1, 1); } initialize() { - this._isInitialized = true; + const _vec3 = create$3(); + this._mMatrix = create$4(); + const objMesh = new ObjHelper(this._core).read(this._obj || this._cubeObj); + if (!this._obj) { + this.useRayPose = true; + const modelThickness = 0.02; + const modelLength = 0.1; + set$3(_vec3, modelThickness, modelThickness, modelLength); + fromScaling(this._mMatrix, _vec3); + set$3(_vec3, 0, 0, 1); + translate(this._mMatrix, this._mMatrix, _vec3); + } + this._vertices = objMesh.vertices; + this._indices = objMesh.indices; + this._indexCount = objMesh.indexCount; + this._rayMMatrix = create$4(); + const rayVertices = Cube.POSITIONS; + this._rayVertices = new ArrayBuffer(PositionColorVertex.SIZE_BYTES * rayVertices.length / PositionVertex.SIZE); + const rayVerticesView = new DataView(this._rayVertices); + const rayIndices = Cube.INDICES; + this._rayIndices = new Uint16Array(rayIndices); + const rayVertexCount = rayVertices.length / PositionVertex.SIZE; + this._rayIndexCount = rayIndices.length; + for (let i = 0; i < rayVertexCount; i++) { + set$3(_vec3, rayVertices[i * PositionVertex.SIZE], rayVertices[i * PositionVertex.SIZE + 1], rayVertices[i * PositionVertex.SIZE + 2]); + PositionColorVertex.setPosition(rayVerticesView, i, _vec3); + PositionColorVertex.setColor(rayVerticesView, i, this._core.config.xrControllerRayColor); + } + const rayThickness = 25e-4; + const rayLength = 10; + set$3(_vec3, rayThickness, rayThickness, rayLength); + fromScaling(this._rayMMatrix, _vec3); + set$3(_vec3, 0, 0, -0.5); + translate(this._rayMMatrix, this._rayMMatrix, _vec3); + this._isInitialized = true; + this._core.log.write(LogLevel.info, "controller initialized"); } update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._size[2] *= this._scalingZ / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); - } - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 6; faceId++){ - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).FACE_POSITIONS[faceId], this._size); - (0, _glMatrix.vec3).transformMat4(this._forward, this._vec3, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 12; edgeId++){ - const faceIds = (0, _cubeJs.Cube).EDGE_FACES[edgeId]; - const forward1 = this._isForwardFace[faceIds[0]]; - const forward2 = this._isForwardFace[faceIds[1]]; - const outsideEdge = forward1 != forward2; - this._isOutsideEdge[edgeId] = outsideEdge; - if (outsideEdge) this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _cubeJs.Cube).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 3; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - for(let axisId = 0; axisId < 3; axisId++)if (this.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - (0, _glMatrix.vec2).set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - if (this._size[axisId] > 0) (0, _glMatrix.mat4).translate(gridFaceMMatrix, gridFaceMMatrix, (0, _cubeJs.Cube).FACE_POSITIONS[faceId]); - } - } - } - for(let axisId = 0; axisId < 3; axisId++)for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (this._isOutsideEdge[edgeId]) { - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _cubeJs.Cube).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); - } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); - } - } - } - } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; - } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _cubeJs.Cube).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _cubeJs.Cube).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; + } + class MatrixHelper { + static fieldOfViewFromProjectionMatrix(p) { + return 2 * Math.atan(1 / p[5]); } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 3; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); - } - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } + } + class AxesVisual { + render(elapsedTime, xrFrame) { } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 3; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 3; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } + update(elapsedTime) { } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; + constructor(axes) { + this.axes = axes; } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _cubeJs.Cube).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../main.js":"b6Xbk","./axes.js":"4X9HQ","../../meshes/quad.js":"6dxCM","../../meshes/cube.js":"dYecn","../../vertex.js":"8lW8V","../../helpers/axes.js":"ihirw","../../helpers/text.js":"keNgB","../../helpers/pick.js":"fOypM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4X9HQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisual", ()=>AxesVisual); -parcelHelpers.export(exports, "AxesBase", ()=>AxesBase); -var _glMatrix = require("gl-matrix"); -class AxesVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(axes){ - this.axes = axes; - } -} -class AxesBase { + } + class AxesBase { get isInitialized() { - return this._isInitialized; - } - set vMatrix(value) { - this._vMatrix = value; - } - pickGrid(id) { - const offset = id * 3; - return { - divisionX: this._pickGrid[offset] - 1, - divisionY: this._pickGrid[offset + 1] - 1, - divisionZ: this._pickGrid[offset + 2] - 1 - }; + return this._isInitialized; + } + set vMatrix(value2) { + this._vMatrix = value2; + } + pickGrid(id2) { + const offset2 = id2 * 3; + return { + divisionX: this._pickGrid[offset2] - 1, + divisionY: this._pickGrid[offset2 + 1] - 1, + divisionZ: this._pickGrid[offset2 + 2] - 1 + }; + } + pickTitle(id2) { + return { axis: this._pickTitle[id2] }; + } + pickLabel(id2) { + const offset2 = id2 * 2; + return { + axis: this._pickLabel[offset2], + label: this._pickLabel[offset2 + 1] + }; + } + pickHeading(id2) { + return { axis: this._pickHeading[id2] }; + } + getFromValues(index2) { + return this._fromValues[index2]; + } + setFromValues(index2, value2) { + if (this._fromValues[index2] != value2) { + this._fromValues[index2] = value2; + this._hasChanged = true; + } } - pickTitle(id) { - return { - axis: this._pickTitle[id] - }; + getToValues(index2) { + return this._toValues[index2]; } - pickLabel(id) { - const offset = id * 2; - return { - axis: this._pickLabel[offset], - label: this._pickLabel[offset + 1] - }; + setToValues(index2, value2) { + if (this._toValues[index2] != value2) { + this._toValues[index2] = value2; + this._hasChanged = true; + } } - pickHeading(id) { - return { - axis: this._pickHeading[id] - }; + get font() { + return this._font; } - getFromValues(index) { - return this._fromValues[index]; + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } - setFromValues(index, value) { - if (this._fromValues[index] != value) { - this._fromValues[index] = value; - this._hasChanged = true; - } + get gridPickDivisionHeight() { + return this._gridPickDivisionHeight; } - getToValues(index) { - return this._toValues[index]; + set gridPickDivisionHeight(value2) { + if (this._gridPickDivisionHeight != value2) { + this._gridPickDivisionHeight = value2; + this._hasChanged = true; + } } - setToValues(index, value) { - if (this._toValues[index] != value) { - this._toValues[index] = value; - this._hasChanged = true; - } + constructor(core) { + this._core = core; + this._mMatrix = create$4(); + this._mvMatrix = create$4(); + this._textMetric = { maxTop: 0, width: 0, maxHeight: 0 }; + this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; + this.textBorderWidth = core.config.textBorderWidth; + this.gamma = 0; + this.gridMajorThickness = core.config.axesGridMajorThickness; + this.gridMinorThickness = core.config.axesGridMinorThickness; + this.gridZeroThickness = core.config.axesGridZeroThickness; + this._font = core.font; + this.isGridPickingEnabled = false; } - get font() { - return this._font; + update(elapsedTime) { } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } + } + let Quad$2 = class Quad { + static positions(transform2) { + const positions = new Float32Array(12); + const position2 = create$3(); + for (let i = 0; i < 4; i++) { + set$3(position2, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); + transformMat4$2(position2, position2, transform2); + positions[i * 3] = position2[0]; + positions[i * 3 + 1] = position2[1]; + positions[i * 3 + 2] = position2[2]; + } + return positions; + } + static textured(transform2, texTransform = Constants.MAT4_IDENTITY) { + const positions = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$3(); + const texCoord = create(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$3(position2, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionTextureVertex.setPosition(verticesView, i, position2); + PositionTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; + } + static normalTextured(transform2, texTransform = Constants.MAT4_IDENTITY) { + const positions = this.positions(transform2); + const texCoords = this.TEX_COORDS; + const vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * positions.length / 3); + const verticesView = new DataView(vertices); + const position2 = create$3(); + const texCoord = create(); + const normal3 = create$3(); + const normal4 = create$2(); + for (let i = 0; i < positions.length / PositionVertex.SIZE; i++) { + set$3(position2, positions[i * PositionVertex.SIZE], positions[i * PositionVertex.SIZE + 1], positions[i * PositionVertex.SIZE + 2]); + set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); + transformMat4(texCoord, texCoord, texTransform); + PositionNormalTextureVertex.setPosition(verticesView, i, position2); + set$2(normal4, 0, 0, 1, 0); + transformMat4$1(normal4, normal4, transform2); + set$3(normal3, normal4[0], normal4[1], normal4[2]); + normalize$2(normal3, normal3); + PositionNormalTextureVertex.setNormal(verticesView, i, normal3); + PositionNormalTextureVertex.setTexCoord(verticesView, i, texCoord); + } + return verticesView; } - get gridPickDivisionHeight() { - return this._gridPickDivisionHeight; - } - set gridPickDivisionHeight(value) { - if (this._gridPickDivisionHeight != value) { - this._gridPickDivisionHeight = value; - this._hasChanged = true; - } - } - constructor(core){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._mvMatrix = (0, _glMatrix.mat4).create(); - this._textMetric = { - maxTop: 0, - width: 0, - maxHeight: 0 - }; - this._gridPickDivisionHeight = core.config.axesGridPickDivisionHeight; - this.textBorderWidth = core.config.textBorderWidth; - this.gamma = 0; - this.gridMajorThickness = core.config.axesGridMajorThickness; - this.gridMinorThickness = core.config.axesGridMinorThickness; - this.gridZeroThickness = core.config.axesGridZeroThickness; - this._font = core.font; - this.isGridPickingEnabled = false; - } - update(elapsedTime) {} -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6dxCM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -parcelHelpers.export(exports, "Grid", ()=>Grid); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -class Quad { - static positions(transform) { - const positions = new Float32Array(12); - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 4; i++){ - (0, _glMatrix.vec3).set(position, this.POSITIONS[i * 3], this.POSITIONS[i * 3 + 1], this.POSITIONS[i * 3 + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - positions[i * 3] = position[0]; - positions[i * 3 + 1] = position[1]; - positions[i * 3 + 2] = position[2]; - } - return positions; - } - static textured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - static normalTextured(transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(transform); - const texCoords = this.TEX_COORDS; - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal3 = (0, _glMatrix.vec3).create(); - const normal4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, texTransform); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _glMatrix.vec4).set(normal4, 0.0, 0.0, 1.0, 0.0); - (0, _glMatrix.vec4).transformMat4(normal4, normal4, transform); - (0, _glMatrix.vec3).set(normal3, normal4[0], normal4[1], normal4[2]); - (0, _glMatrix.vec3).normalize(normal3, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal3); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } -} -Quad.FACE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.FACE_ROTATIONS = [ - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, 1, 0, 0, 0, 1), - (0, _glMatrix.mat3).fromValues(1, 0, 0, 0, -1, 0, 0, 0, -1) -]; -Quad.EDGE_POSITIONS = [ - (0, _glMatrix.vec3).fromValues(0, 0.5, 0), - (0, _glMatrix.vec3).fromValues(0.5, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -0.5, 0), - (0, _glMatrix.vec3).fromValues(-0.5, 0, 0) -]; -Quad.EDGE_NORMALS = [ - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, -1, 0), - (0, _glMatrix.vec3).fromValues(-1, 0, 0) -]; -Quad.EDGE_POSITIVES = [ - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0), - (0, _glMatrix.vec3).fromValues(1, 0, 0), - (0, _glMatrix.vec3).fromValues(0, 1, 0) -]; -Quad.EDGE_FORWARDS = [ - (0, _glMatrix.vec3).fromValues(0, 0, -1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, 1), - (0, _glMatrix.vec3).fromValues(0, 0, -1) -]; -Quad.AXIS_EDGES = [ - [ - 0, - 2 - ], - [ - 1, - 3 - ] -]; -Quad.POSITIONS = new Float32Array([ + }; + Quad$2.FACE_NORMALS = [ + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$2.FACE_ROTATIONS = [ + fromValues$5(1, 0, 0, 0, 1, 0, 0, 0, 1), + fromValues$5(1, 0, 0, 0, -1, 0, 0, 0, -1) + ]; + Quad$2.EDGE_POSITIONS = [ + fromValues$3(0, 0.5, 0), + fromValues$3(0.5, 0, 0), + fromValues$3(0, -0.5, 0), + fromValues$3(-0.5, 0, 0) + ]; + Quad$2.EDGE_NORMALS = [ + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, -1, 0), + fromValues$3(-1, 0, 0) + ]; + Quad$2.EDGE_POSITIVES = [ + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0), + fromValues$3(1, 0, 0), + fromValues$3(0, 1, 0) + ]; + Quad$2.EDGE_FORWARDS = [ + fromValues$3(0, 0, -1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, 1), + fromValues$3(0, 0, -1) + ]; + Quad$2.AXIS_EDGES = [ + [0, 2], + [1, 3] + ]; + Quad$2.POSITIONS = new Float32Array([ -0.5, 0.5, 0, @@ -58061,26178 +36551,15595 @@ Quad.POSITIONS = new Float32Array([ 0.5, -0.5, 0 -]); -Quad.INDICES = new Uint16Array([ - 0, - 2, - 1, - 1, - 2, - 3 -]); -Quad.TEX_COORDS = new Float32Array([ - 0, - 1, - 1, - 1, - 0, - 0, - 1, - 0 -]); -class Grid { - static positions(cols, rows, transform) { - const vertices = new Float32Array((cols + 1) * (rows + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec3).set(position, col / cols - 0.5, 0.5 - row / rows, 0); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - return vertices; - } - static indices(cols, rows) { - const indices = new Uint16Array(cols * rows * 6); - let index = 0; - for(let row = 0; row < rows; row++)for(let col = 0; col < cols; col++){ - indices[index++] = col + row * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + row * (cols + 1) + 1; - indices[index++] = col + (row + 1) * (cols + 1); - indices[index++] = col + (row + 1) * (cols + 1) + 1; - } - return indices; - } - static textured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static normalTextured(cols, rows, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(cols, rows, transform); - const texCoords = this._texCoords(cols, rows, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, index, position); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, index, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, index++, texCoord); - } - return verticesView; - } - static _texCoords(cols, rows, transform) { - const texCoords = new Float32Array((cols + 1) * (rows + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let row = 0; row <= rows; row++)for(let col = 0; col <= cols; col++){ - (0, _glMatrix.vec2).set(texCoord, col / cols, 1 - row / rows); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ihirw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxisHelper", ()=>AxisHelper); -class AxisHelper { - static continuous(options) { - const labels = []; - const positions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - for(let i = 0; i <= options.divisions; i++){ - positions.push(options.divisions == 0 ? 0.5 : i / options.divisions); - const value = options.divisions == 0 ? (options.min + options.max) / 2 : options.min + i * (options.max - options.min) / options.divisions; - labels.push(label(value)); - if (i == 0) fromValues.push(options.min); - else if (i < options.divisions) { - toValues.push(value); - fromValues.push(value); - } - } - toValues.push(options.max); - return { - labels: labels, - positions: positions, - fromValues: fromValues, - toValues: toValues - }; - } - static discrete(options) { - const divisions = options.maxDivisions !== undefined ? Math.min(options.divisions, options.maxDivisions) : options.divisions; - const divisionStep = 1 / options.divisions; - const labelStep = 1 / divisions; - const valueStep = (options.max - options.min + 1) / options.divisions; - let nextDivision, toValue, nextPosition; - const labels = []; - const labelPositions = []; - const tickPositions = []; - const fromValues = []; - const toValues = []; - const label = options.label || ((value)=>{ - return value.toString(); - }); - const fromToLabel = options.fromToLabel || ((fromValue, toValue)=>{ - return `${label(fromValue)}-${label(toValue)}`; - }); - for(let i = 0; i < divisions; i++){ - const division = Math.round(i * labelStep / divisionStep); - const tickPosition = division / options.divisions; - const fromValue = options.min + Math.ceil(division * valueStep); - if (i == divisions - 1) { - nextDivision = divisions; - nextPosition = 1; - toValue = options.max; - } else { - nextDivision = Math.round((i + 1) * labelStep / divisionStep); - nextPosition = nextDivision / options.divisions; - toValue = options.min + Math.ceil(nextDivision * valueStep) - 1; - } - labelPositions.push((tickPosition + nextPosition) / 2); - labels.push(fromValue == toValue ? label(fromValue) : fromToLabel(fromValue, toValue)); - fromValues.push(fromValue); - toValues.push(toValue); - tickPositions.push(tickPosition); + ]); + Quad$2.INDICES = new Uint16Array([0, 2, 1, 1, 2, 3]); + Quad$2.TEX_COORDS = new Float32Array([0, 1, 1, 1, 0, 0, 1, 0]); + class TextHelper { + static truncate(text2, length2) { + return text2.length > length2 ? `${text2.substr(0, length2 - 1)}…` : text2; + } + static measure(font2, text2, size) { + size.width = 0; + let maxDescent = 0; + for (const char of text2) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; } - tickPositions.push(1); - return { - labels: labels, - labelPositions: labelPositions, - tickPositions: tickPositions, - fromValues: fromValues, - toValues: toValues - }; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"keNgB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextHelper", ()=>TextHelper); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -class TextHelper { - static truncate(text, length) { - return text.length > length ? `${text.substr(0, length - 1)}\u{2026}` : text; - } - static measure(font, text, size) { - size.width = 0; - let maxDescent = 0; - for (const char of text){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - size.width += glyph.advance; - size.maxTop = Math.max(glyph.top, size.maxTop); - maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + size.width += glyph.advance; + size.maxTop = Math.max(glyph.top, size.maxTop); + maxDescent = Math.max(glyph.height - glyph.top, maxDescent); + } + size.maxHeight = size.maxTop + maxDescent; + } + static wrap(font2, text2, maxWidth) { + const lines = []; + let width2 = 0; + let start = 0; + let lastBreakingChar = -1; + let widthAfterLastBreakingChar = 0; + for (let i = 0; i < text2.length; i++) { + let char = text2.charAt(i); + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + width2 += glyph.advance; + if (char == " " || char == "-") { + widthAfterLastBreakingChar = width2; + lastBreakingChar = i; + } + if (width2 > maxWidth) { + if (lastBreakingChar == -1) { + lines.push(text2.substring(start, i)); + start = i; + width2 += glyph.advance; + } else { + lines.push(text2.substring(start, lastBreakingChar)); + start = lastBreakingChar + 1; + width2 -= widthAfterLastBreakingChar; + widthAfterLastBreakingChar = 0; + lastBreakingChar = -1; + } } - size.maxHeight = size.maxTop + maxDescent; + } + lines.push(text2.substring(start, text2.length)); + return lines; } - static wrap(font, text, maxWidth) { - const lines = []; - let width = 0; - let start = 0; - let lastBreakingChar = -1; - let widthAfterLastBreakingChar = 0; - for(let i = 0; i < text.length; i++){ - let char = text.charAt(i); - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - width += glyph.advance; - if (char == " " || char == "-") { - widthAfterLastBreakingChar = width; - lastBreakingChar = i; - } - if (width > maxWidth) { - if (lastBreakingChar == -1) { - lines.push(text.substring(start, i)); - start = i; - width += glyph.advance; - } else { - lines.push(text.substring(start, lastBreakingChar)); - start = lastBreakingChar + 1; - width -= widthAfterLastBreakingChar; - widthAfterLastBreakingChar = 0; - lastBreakingChar = -1; - } - } - } - lines.push(text.substring(start, text.length)); - return lines; + static addString(font2, text2, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + for (const char of text2) { + this.addGlyph(font2, char, vertices, indices, index2++, position2, scale2, offset2, rotation2, idColor); + } } - static addString(font, text, vertices, indices, index, position, scale, offset, rotation, idColor) { - for (const char of text)this.addGlyph(font, char, vertices, indices, index++, position, scale, offset, rotation, idColor); + static addGlyph(font2, char, vertices, indices, index2, position2, scale2, offset2, rotation2, idColor) { + let glyph = font2.glyphs[char]; + if (!glyph) { + font2.addGlyph(char); + glyph = font2.glyphs[char]; + } + const vertexOffset = index2 * 4; + const width2 = glyph.width * scale2; + const height2 = glyph.height * scale2; + const top = glyph.top * scale2; + const border = font2.border * scale2; + const x02 = offset2[0] - border; + const x12 = offset2[0] + width2 + border; + const y02 = offset2[1] + top + border; + const y12 = offset2[1] + top - height2 - border; + const z02 = offset2[2]; + set$3(this._topLeft, x02, y02, z02); + set$3(this._topRight, x12, y02, z02); + set$3(this._bottomLeft, x02, y12, z02); + set$3(this._bottomRight, x12, y12, z02); + if (rotation2) { + transformQuat(this._topLeft, this._topLeft, rotation2); + transformQuat(this._topRight, this._topRight, rotation2); + transformQuat(this._bottomLeft, this._bottomLeft, rotation2); + transformQuat(this._bottomRight, this._bottomRight, rotation2); + } + add(this._vec3, this._topLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset, this._vec3); + add(this._vec3, this._topRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 1, this._vec3); + add(this._vec3, this._bottomLeft, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 2, this._vec3); + add(this._vec3, this._bottomRight, position2); + PositionTexturePickVertex.setPosition(vertices, vertexOffset + 3, this._vec3); + set(this._vec2, glyph.u0, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset, this._vec2); + set(this._vec2, glyph.u1, glyph.v0); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 1, this._vec2); + set(this._vec2, glyph.u0, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 2, this._vec2); + set(this._vec2, glyph.u1, glyph.v1); + PositionTexturePickVertex.setTexCoord(vertices, vertexOffset + 3, this._vec2); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 1, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 2, idColor); + PositionTexturePickVertex.setIdColor(vertices, vertexOffset + 3, idColor); + offset2[0] += glyph.advance * scale2; + const indexTemplate = Quad$2.INDICES; + const indexOffset = index2 * 6; + for (let i = 0; i < 6; i++) { + indices[indexOffset + i] = indexTemplate[i] + vertexOffset; + } } - static addGlyph(font, char, vertices, indices, index, position, scale, offset, rotation, idColor) { - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const vertexOffset = index * 4; - const width = glyph.width * scale; - const height = glyph.height * scale; - const top = glyph.top * scale; - const border = font.border * scale; - const x0 = offset[0] - border; - const x1 = offset[0] + width + border; - const y0 = offset[1] + top + border; - const y1 = offset[1] + top - height - border; - const z0 = offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (rotation) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, rotation); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, rotation); - } - (0, _glMatrix.vec3).add(this._vec3, this._topLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._topRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 1, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomLeft, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 2, this._vec3); - (0, _glMatrix.vec3).add(this._vec3, this._bottomRight, position); - (0, _vertexJs.PositionTexturePickVertex).setPosition(vertices, vertexOffset + 3, this._vec3); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v0); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 1, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u0, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 2, this._vec2); - (0, _glMatrix.vec2).set(this._vec2, glyph.u1, glyph.v1); - (0, _vertexJs.PositionTexturePickVertex).setTexCoord(vertices, vertexOffset + 3, this._vec2); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 1, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 2, idColor); - (0, _vertexJs.PositionTexturePickVertex).setIdColor(vertices, vertexOffset + 3, idColor); - offset[0] += glyph.advance * scale; - const indexTemplate = (0, _quadJs.Quad).INDICES; - const indexOffset = index * 6; - for(let i = 0; i < 6; i++)indices[indexOffset + i] = indexTemplate[i] + vertexOffset; - } -} -TextHelper._vec2 = (0, _glMatrix.vec2).create(); -TextHelper._vec3 = (0, _glMatrix.vec3).create(); -TextHelper._topLeft = (0, _glMatrix.vec3).create(); -TextHelper._topRight = (0, _glMatrix.vec3).create(); -TextHelper._bottomLeft = (0, _glMatrix.vec3).create(); -TextHelper._bottomRight = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","../vertex.js":"8lW8V","../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fOypM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickHelper", ()=>PickHelper); -class PickHelper { + } + TextHelper._vec2 = create(); + TextHelper._vec3 = create$3(); + TextHelper._topLeft = create$3(); + TextHelper._topRight = create$3(); + TextHelper._bottomLeft = create$3(); + TextHelper._bottomRight = create$3(); + class PickHelper { static nextPickId() { - return this._pickId++; - } - static encodeNumber(number, type, color) { - const encoded = number | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16); - } - static encodeVec3(vec3, type, color) { - const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type); - PickHelper.float32ToVec4(encoded, color); - } - static decodeVec3(color, axes) { - axes[0] = color[0]; - axes[1] = color[1]; - axes[2] = color[2]; - } - static encodeType(type) { - return type << 24; - } - static decodeType(color) { - return color[3]; - } - static float32ToVec4(number, color) { - color[0] = ((number & 0xFF) >>> 0) / 0xFF; - color[1] = ((number & 0xFF00) >>> 8) / 0xFF; - color[2] = ((number & 0xFF0000) >>> 16) / 0xFF; - color[3] = ((number & 0xFF000000) >>> 24) / 0xFF; - } - static uint8ArrayToNumber(color) { - return color[0] + (color[1] << 8) + (color[2] << 16) + (color[3] << 24); - } -} -PickHelper._pickId = 1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lhcyD":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>Cartesian2dAxesHelper); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>Cartesian2dAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _mainJs = require("../../main.js"); -var _axesJs = require("./axes.js"); -var _quadJs = require("../../meshes/quad.js"); -var _vertexJs = require("../../vertex.js"); -var _axesJs1 = require("../../helpers/axes.js"); -var _textJs = require("../../helpers/text.js"); -var _pickJs = require("../../helpers/pick.js"); -class Cartesian2dAxesHelper { - static create(core, options) { - const cartesian2dAxes = new Cartesian2dAxes(core); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - const minValueX = options.minValueX === undefined ? 0 : options.minValueX; - const minValueY = options.minValueY === undefined ? 0 : options.minValueY; - const maxValueX = options.maxValueX === undefined ? 1 : options.maxValueX; - const maxValueY = options.maxValueY === undefined ? 1 : options.maxValueY; - const scaling = options.scaling === undefined ? 1 : options.scaling; - cartesian2dAxes.minBoundsX = minBoundsX; - cartesian2dAxes.minBoundsY = minBoundsY; - cartesian2dAxes.maxBoundsX = maxBoundsX; - cartesian2dAxes.maxBoundsY = maxBoundsY; - cartesian2dAxes.scalingX = scaling; - cartesian2dAxes.scalingY = scaling; - const maxLength = Math.max(maxBoundsX - minBoundsX, maxBoundsY - minBoundsY); - const requestedDivisions = [ - options.divisionsX == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsX - minBoundsX) / maxLength), 1) : options.divisionsX, - options.divisionsY == undefined ? Math.max(Math.floor(core.config.axesGridDefaultDivisions * (maxBoundsY - minBoundsY) / maxLength), 1) : options.divisionsY - ]; - const minorGridlines = [ - options.minorGridlinesX == undefined ? 2 : options.minorGridlinesX, - options.minorGridlinesY == undefined ? 2 : options.minorGridlinesY - ]; - const labelMajorSizes = [ - options.labelMajorSizeX === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeX, - options.labelMajorSizeY === undefined ? core.config.axesTextLabelMajorSize : options.labelMajorSizeY - ]; - const labelMinorSizes = [ - options.labelMinorSizeX === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeX, - options.labelMinorSizeY === undefined ? core.config.axesTextLabelMinorSize : options.labelMinorSizeY - ]; - cartesian2dAxes.isDiscreteX = options.isDiscreteX; - cartesian2dAxes.isDiscreteY = options.isDiscreteY; - cartesian2dAxes.isGridPickingEnabled = options.isGridPickingEnabled; - const isDivisionPickingEnabledArray = [ - options.isDivisionPickingEnabledX, - options.isDivisionPickingEnabledY - ]; - const isLabelPickingEnabled = [ - options.isLabelPickingEnabledX, - options.isLabelPickingEnabledY - ]; - const isAxisReversed = [ - options.reverseX, - options.reverseY - ]; - const labelsArray = [ - options.labelsX, - options.labelsY - ]; - const labelOrientationsArray = [ - options.labelOrientationX, - options.labelOrientationY - ]; - const labelOrientationDefaultArray = [ - (0, _mainJs.AxesTextOrientation).parallel, - (0, _mainJs.AxesTextOrientation).perpendicular, - (0, _mainJs.AxesTextOrientation).parallel - ]; - const arePickDivisionsVisibleArray = [ - options.arePickDivisionsVisibleX, - options.arePickDivisionsVisibleY - ]; - const minValueArray = [ - minValueX, - minValueY - ]; - const maxValueArray = [ - maxValueX, - maxValueY - ]; - const isDiscreteArray = [ - options.isDiscreteX, - options.isDiscreteY - ]; - const titleArray = [ - options.titleX, - options.titleY - ]; - const titleSizeArray = [ - options.titleSizeX, - options.titleSizeY - ]; - const headingArray = [ - options.headingX, - options.headingY - ]; - const headingSizeArray = [ - options.headingSizeX, - options.headingSizeY - ]; - for(let axisId = 0; axisId < 2; axisId++){ - const label = labelsArray[axisId]; - const minValue = minValueArray[axisId]; - const maxValue = maxValueArray[axisId]; - const discrete = isDiscreteArray[axisId]; - if (discrete) { - const divisions = maxValue - minValue + 1; - const maxDivisions = Math.min(requestedDivisions[axisId], divisions); - const discreteAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - maxDivisions: maxDivisions, - label: label - }; - const discreteAxis = (0, _axesJs1.AxisHelper).discrete(discreteAxisOptions); - cartesian2dAxes.setTickPositions(axisId, discreteAxis.tickPositions); - cartesian2dAxes.setLabelPositions(axisId, discreteAxis.labelPositions); - cartesian2dAxes.setLabels(axisId, discreteAxis.labels); - cartesian2dAxes.setFromValues(axisId, discreteAxis.fromValues); - cartesian2dAxes.setToValues(axisId, discreteAxis.toValues); - cartesian2dAxes.setLabelSizes(axisId, Array(discreteAxis.labels.length).fill(labelMajorSizes[axisId])); - cartesian2dAxes.minorGridlines[axisId] = 1; - } else { - const divisions = requestedDivisions[axisId]; - const continuousAxisOptions = { - min: minValue, - max: maxValue, - divisions: divisions, - label: label - }; - const continuousAxis = (0, _axesJs1.AxisHelper).continuous(continuousAxisOptions); - cartesian2dAxes.setTickPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabelPositions(axisId, continuousAxis.positions); - cartesian2dAxes.setLabels(axisId, continuousAxis.labels); - cartesian2dAxes.setFromValues(axisId, continuousAxis.fromValues); - cartesian2dAxes.setToValues(axisId, continuousAxis.toValues); - const labelSizes = []; - for(let i = 0; i < continuousAxis.labels.length; i++)labelSizes.push(i == 0 || i == divisions ? labelMajorSizes[axisId] : labelMinorSizes[axisId]); - cartesian2dAxes.setLabelSizes(axisId, labelSizes); - cartesian2dAxes.minorGridlines[axisId] = minorGridlines[axisId]; - } - cartesian2dAxes.setLabelOrientation(axisId, labelOrientationsArray[axisId] === undefined ? labelOrientationDefaultArray[axisId] : labelOrientationsArray[axisId]); - cartesian2dAxes.setTitle(axisId, titleArray[axisId]); - cartesian2dAxes.setTitleSize(axisId, titleSizeArray[axisId] === undefined ? core.config.axesTextTitleSize : titleSizeArray[axisId]); - cartesian2dAxes.setHeading(axisId, headingArray[axisId]); - cartesian2dAxes.setHeadingSize(axisId, headingSizeArray[axisId] === undefined ? core.config.axesTextHeadingSize : headingSizeArray[axisId]); - cartesian2dAxes.arePickDivisionsVisible[axisId] = arePickDivisionsVisibleArray[axisId] === undefined ? true : arePickDivisionsVisibleArray[axisId]; - cartesian2dAxes.isDivisionPickingEnabled[axisId] = isDivisionPickingEnabledArray[axisId]; - cartesian2dAxes.isLabelPickingEnabled[axisId] = isLabelPickingEnabled[axisId]; - cartesian2dAxes.isAxisReversed[axisId] = isAxisReversed[axisId]; - if (minValue <= 0 && maxValue >= 0 && minValue != maxValue) cartesian2dAxes.zero[axisId] = -minValue / (maxValue - minValue); - else cartesian2dAxes.zero[axisId] = -Number.MAX_VALUE; - } - return cartesian2dAxes; - } -} -class Cartesian2dAxes extends (0, _axesJs.AxesBase) { + return this._pickId++; + } + static encodeNumber(number2, type2, color2) { + const encoded = number2 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16); + } + static encodeVec3(vec3, type2, color2) { + const encoded = vec3[0] | vec3[1] << 8 | vec3[2] << 16 | PickHelper.encodeType(type2); + PickHelper.float32ToVec4(encoded, color2); + } + static decodeVec3(color2, axes) { + axes[0] = color2[0]; + axes[1] = color2[1]; + axes[2] = color2[2]; + } + static encodeType(type2) { + return type2 << 24; + } + static decodeType(color2) { + return color2[3]; + } + static float32ToVec4(number2, color2) { + color2[0] = ((number2 & 255) >>> 0) / 255; + color2[1] = ((number2 & 65280) >>> 8) / 255; + color2[2] = ((number2 & 16711680) >>> 16) / 255; + color2[3] = ((number2 & 4278190080) >>> 24) / 255; + } + static uint8ArrayToNumber(color2) { + return color2[0] + (color2[1] << 8) + (color2[2] << 16) + (color2[3] << 24); + } + } + PickHelper._pickId = 1; + class Cartesian3dAxes extends AxesBase { get size() { - return this._size; + return this._size; } get isDiscreteX() { - return this._isDiscrete[0]; + return this._isDiscrete[0]; } - set isDiscreteX(value) { - if (value != this._isDiscrete[0]) { - this._isDiscrete[0] = value; - this._hasChanged = true; - } + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } get isDiscreteY() { - return this._isDiscrete[1]; + return this._isDiscrete[1]; } - set isDiscreteY(value) { - if (value != this._isDiscrete[1]) { - this._isDiscrete[1] = value; - this._hasChanged = true; - } + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } + } + get isDiscreteZ() { + return this._isDiscrete[2]; + } + set isDiscreteZ(value2) { + if (value2 != this._isDiscrete[2]) { + this._isDiscrete[2] = value2; + this._hasChanged = true; + } } get minBoundsX() { - return this._minBoundsX; + return this._minBoundsX; } - set minBoundsX(value) { - if (value != this._minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } get maxBoundsX() { - return this._maxBoundsX; + return this._maxBoundsX; } - set maxBoundsX(value) { - if (value != this._minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } get minBoundsY() { - return this._minBoundsY; + return this._minBoundsY; } - set minBoundsY(value) { - if (value != this._minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } get maxBoundsY() { - return this._maxBoundsY; + return this._maxBoundsY; } - set maxBoundsY(value) { - if (value != this._minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } + } + get minBoundsZ() { + return this._minBoundsZ; + } + set minBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._minBoundsZ = value2; + this._hasChanged = true; + } + } + get maxBoundsZ() { + return this._maxBoundsZ; } - getIsOutsideEdge(index) { - return this._isOutsideEdge[index]; + set maxBoundsZ(value2) { + if (value2 != this._minBoundsZ) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - getIsForwardFace(index) { - return this._isForwardFace[index]; + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; + } + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } get textVertices() { - return this._textVertices; + return this._textVertices; } get textIndices() { - return this._textIndices; + return this._textIndices; } - getLabelMMatrix(index) { - return this._labelMMatrices[index]; + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - setLabelPositions(index, value) { - if (this._labelPositions[index] != value) { - this._labelPositions[index] = value; - this._hasChanged = true; - } + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } - setLabels(index, value) { - if (this._labels[index] != value) { - this._labels[index] = value; - this._hasChanged = true; - } + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } - setLabelSizes(index, value) { - if (this._labelSizes[index] != value) { - this._labelSizes[index] = value; - this._hasChanged = true; - } + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } - getLabelOrientation(index) { - return this._orientations[index]; + getLabelOrientation(index2) { + return this._orientations[index2]; } - setLabelOrientation(index, orientation) { - if (this._orientations[index] != orientation) { - this._orientations[index] = orientation; - this._hasChanged = true; - } + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - getTitleIndexCount(index) { - return this._titleIndexCounts[index]; + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - getTitleIndexOffset(index) { - return this._titleIndexOffsets[index]; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } - getTitleMMatrix(index) { - return this._titleMMatrices[index]; + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } - setTitle(index, value) { - if (this._titles[index] != value) { - this._titles[index] = value; - this._hasChanged = true; - } + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } - setTitleSize(index, value) { - if (this._titleSizes[index] != value) { - this._titleSizes[index] = value; - this._hasChanged = true; - } + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } - getHeadingIndexCount(index) { - return this._headingIndexCounts[index]; + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; } - getHeadingIndexOffset(index) { - return this._headingIndexOffsets[index]; + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; } - getHeadingMMatrix(index) { - return this._headingMMatrices[index]; + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - setHeading(index, value) { - if (this._headings[index] != value) { - this._headings[index] = value; - this._hasChanged = true; - } + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - setHeadingSize(index, value) { - if (this._headingSizes[index] != value) { - this._headingSizes[index] = value; - this._hasChanged = true; - } + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } - getIsLeftToRightHorizontal(index) { - return this._isLeftToRightHorizontal[index]; + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - getIsLeftToRightVertical(index) { - return this._isLeftToRightVertical[index]; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - getAxesLeftToRightIndexCount(index) { - return this._axesLeftToRightIndexCounts[index]; + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - getAxesRightToLeftIndexCount(index) { - return this._axesRightToLeftIndexCounts[index]; + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } - getAxesLeftToRightIndexOffset(index) { - return this._axesLeftToRightIndexOffsets[index]; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } - getAxesRightToLeftIndexOffset(index) { - return this._axesRightToLeftIndexOffsets[index]; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } get gridVertices() { - return this._gridVertices; + return this._gridVertices; } get gridIndices() { - return this._gridIndices; + return this._gridIndices; } - getGridTicksIndexCount(index) { - return this._gridTicksIndexCounts[index]; + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - getGridTicksIndexOffset(index) { - return this._gridTicksIndexOffsets[index]; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } - getGridFaceIndexCount(index) { - return this._gridFaceIndexCounts[index]; + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - getGridFaceIndexOffset(index) { - return this._gridFaceIndexOffsets[index]; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - getGridTicksMMatrix(index) { - return this._gridTicksMMatrices[index]; + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; } - getGridFaceMMatrix(index) { - return this._gridFaceMMatrices[index]; + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; } - getGridTicksScale(index) { - return this._gridTicksScales[index]; + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; } - getGridTicksZero(index) { - return this._gridTicksZeros[index]; + getGridFaceZero(index2) { + return this._gridFaceZeros[index2]; } - get gridFaceZero() { - return this._gridFaceZeros; + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; } - get gridFaceMinorGridlines() { - return this._gridFaceMinorGridlines; + getGridFaceMinorGridlines(index2) { + return this._gridFaceMinorGridlines[index2]; } - getGridTicksMinorGridlines(index) { - return this._gridTicksMinorGridlines[index]; + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; } - setTickPositions(index, value) { - if (this._gridTicksPositions[index] != value) { - this._gridTicksPositions[index] = value; - this._hasChanged = true; - } + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } } get scalingX() { - return this._scalingX; + return this._scalingX; } - set scalingX(value) { - if (value != this._scalingX) { - this._scalingX = value; - this._hasChanged = true; - } + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } } get scalingY() { - return this._scalingY; - } - set scalingY(value) { - if (value != this._scalingY) { - this._scalingY = value; - this._hasChanged = true; - } - } - get offsetX() { - return this._offset[12]; - } - set offsetX(value) { - if (value != this._offset[12]) this._offset[12] = value; - } - get offsetY() { - return this._offset[13]; - } - set offsetY(value) { - if (value != this._offset[13]) this._offset[13] = value; - } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._rMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromQuat(this._rMatrix, value); - } - } - constructor(core){ - super(core); - this._size = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._normal = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._texCoord = (0, _glMatrix.vec2).create(); - this._bounds = (0, _glMatrix.vec4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._isDiscrete = [ - false, - false - ]; - this._minBoundsX = 0; - this._minBoundsY = 0; - this._maxBoundsX = 0; - this._maxBoundsY = 0; - this._isForwardFace = []; - this._isForwardEdge = []; - this._isOutsideEdge = []; - for(let i = 0; i < 2; i++)this._isForwardFace.push(false); - for(let i = 0; i < 4; i++){ - this._isForwardEdge.push(false); - this._isOutsideEdge.push(false); - } - this._textOffset = (0, _glMatrix.vec3).create(); - this._textPosition = (0, _glMatrix.vec3).create(); - this._distances = []; - for(let i = 0; i < 4; i++)this._distances.push(0); - this._labelPositions = []; - this._labels = []; - this._labelSizes = []; - this._maxLabelSize = []; - this._axesLeftToRightIndexCounts = []; - this._axesRightToLeftIndexCounts = []; - this._axesLeftToRightIndexOffsets = []; - this._axesRightToLeftIndexOffsets = []; - this._labelMMatrices = []; - this._orientations = []; - for(let i = 0; i < 2; i++){ - this._maxLabelSize.push((0, _glMatrix.vec2).create()); - this._orientations.push((0, _mainJs.AxesTextOrientation).parallel); - this._axesLeftToRightIndexCounts.push(0); - this._axesRightToLeftIndexCounts.push(0); - this._axesLeftToRightIndexOffsets.push(0); - this._axesRightToLeftIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._labelMMatrices.push((0, _glMatrix.mat4).create()); - this._titles = []; - this._titleSizes = []; - this._titleIndexCounts = []; - this._titleIndexOffsets = []; - this._titleMMatrices = []; - for(let i = 0; i < 2; i++){ - this._titles.push(null); - this._titleSizes.push(core.config.axesTextTitleSize); - this._titleIndexCounts.push(0); - this._titleIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++)this._titleMMatrices.push((0, _glMatrix.mat4).create()); - this._headings = []; - this._headingSizes = []; - this._headingIndexCounts = []; - this._headingIndexOffsets = []; - this._headingMMatrices = []; - this.isHeadingVisible = []; - for(let i = 0; i < 2; i++){ - this._headings.push(null); - this._headingSizes.push(core.config.axesTextHeadingSize); - this._headingIndexCounts.push(0); - this._headingIndexOffsets.push(0); - } - for(let i = 0; i < 4; i++){ - this._headingMMatrices.push((0, _glMatrix.mat4).create()); - this.isHeadingVisible.push(true); - } - this.isEdgeVisible = []; - this._edgePosition = (0, _glMatrix.vec3).create(); - this._edgePositive = (0, _glMatrix.vec3).create(); - this._edgeNormal = (0, _glMatrix.vec3).create(); - this._edgeNormalTemp = (0, _glMatrix.vec3).create(); - this._edgePositiveTemp = (0, _glMatrix.vec3).create(); - this._isLeftToRightHorizontal = []; - this._isLeftToRightVertical = []; - this._edgeHorizontalRight = []; - this._edgeHorizontalUp = []; - this._edgeHorizontalForward = []; - this._edgeVerticalRight = []; - this._edgeVerticalUp = []; - this._edgeVerticalForward = []; - for(let i = 0; i < 4; i++){ - this.isEdgeVisible.push(true); - this._isLeftToRightHorizontal.push(false); - this._isLeftToRightVertical.push(false); - this._edgeHorizontalRight.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalUp.push((0, _glMatrix.vec3).create()); - this._edgeHorizontalForward.push((0, _glMatrix.vec3).create()); - this._edgeVerticalRight.push((0, _glMatrix.vec3).create()); - this._edgeVerticalUp.push((0, _glMatrix.vec3).create()); - this._edgeVerticalForward.push((0, _glMatrix.vec3).create()); - } - this.isFaceVisible = []; - for(let i = 0; i < 2; i++)this.isFaceVisible.push(true); - this.arePickDivisionsVisible = []; - this.areFacesVisible = []; - this._indexTemplate = (0, _quadJs.Quad).INDICES; - this.zero = (0, _glMatrix.vec3).create(); - this._gridTicksZeros = []; - this._gridFaceZeros = (0, _glMatrix.vec2).create(); - this.minorGridlines = (0, _glMatrix.vec3).fromValues(1, 1, 1); - this._gridTicksMinorGridlines = []; - this._gridFaceMinorGridlines = (0, _glMatrix.vec2).create(); - this._gridTicksPositions = []; - this._gridTicksScales = []; - this._gridTicksIndexCounts = []; - this._gridTicksIndexOffsets = []; - this._gridFaceScale = (0, _glMatrix.vec3).create(); - this._gridFaceIndexCounts = []; - this._gridFaceIndexOffsets = []; - this._gridFaceMMatrices = []; - this._gridTicksMMatrices = []; - this._gridTicksRotations = []; - for(let i = 0; i < 2; i++){ - this.arePickDivisionsVisible.push(true); - this.areFacesVisible.push(true); - this._gridTicksZeros.push((0, _glMatrix.vec2).create()); - this._gridTicksMinorGridlines.push((0, _glMatrix.vec2).create()); - this._gridTicksScales.push((0, _glMatrix.vec3).create()); - this._gridTicksIndexCounts.push(0); - this._gridTicksIndexOffsets.push(0); - this._gridFaceIndexCounts.push(0); - this._gridFaceIndexOffsets.push(0); - this._gridFaceMMatrices.push((0, _glMatrix.mat4).create()); - } - for(let i = 0; i < 4; i++){ - this._gridTicksMMatrices.push((0, _glMatrix.mat4).create()); - this._gridTicksRotations.push((0, _glMatrix.mat4).create()); - const _mat4 = this._gridTicksRotations[i]; - _mat4[0] = (0, _quadJs.Quad).EDGE_POSITIVES[i][0]; - _mat4[1] = (0, _quadJs.Quad).EDGE_POSITIVES[i][1]; - _mat4[2] = (0, _quadJs.Quad).EDGE_POSITIVES[i][2]; - _mat4[4] = (0, _quadJs.Quad).EDGE_NORMALS[i][0]; - _mat4[5] = (0, _quadJs.Quad).EDGE_NORMALS[i][1]; - _mat4[6] = (0, _quadJs.Quad).EDGE_NORMALS[i][2]; - (0, _glMatrix.vec3).cross(this._vec3, (0, _quadJs.Quad).EDGE_POSITIVES[i], (0, _quadJs.Quad).EDGE_NORMALS[i]); - _mat4[8] = this._vec3[0]; - _mat4[9] = this._vec3[1]; - _mat4[10] = this._vec3[2]; - } - this._fromValues = [ - null, - null - ]; - this._toValues = [ - null, - null - ]; - this.isDivisionPickingEnabled = [ - false, - false - ]; - this.isLabelPickingEnabled = [ - false, - false - ]; - this.isTitlePickingEnabled = [ - false, - false - ]; - this.isHeadingPickingEnabled = [ - false, - false - ]; - this.isAxisReversed = [ - false, - false - ]; - this._scalingX = 1; - this._scalingY = 1; - this._offset = (0, _glMatrix.mat4).create(); - } - initialize() { - this._isInitialized = true; - } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); - const maxBounds = Math.max(this._size[0], this._size[1]); - this._size[0] *= this._scalingX / maxBounds; - this._size[1] *= this._scalingY / maxBounds; - this._updateGrids(this._size); - this._updateText(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); - } - if (this._rMatrix) { - (0, _glMatrix.mat4).mul(this._mMatrix, this.mMatrix, this._rMatrix); - (0, _glMatrix.mat4).mul(this._mMatrix, this._mMatrix, this._offset); - } else (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._offset); - this._mvMatrix = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).multiply(this._mvMatrix, this._vMatrix, this._mMatrix); - (0, _glMatrix.mat3).fromMat4(this._mat3, this._mvMatrix); - for(let faceId = 0; faceId < 2; faceId++){ - (0, _glMatrix.vec3).transformMat4(this._forward, (0, _constantsJs.Constants).VECTOR3_ZERO, this._mvMatrix); - (0, _glMatrix.vec3).transformMat3(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId], this._mat3); - this._isForwardFace[faceId] = (0, _glMatrix.vec3).dot(this._normal, this._forward) > 0; - } - this._forward[0] = this._mat3[2]; - this._forward[1] = this._mat3[5]; - this._forward[2] = this._mat3[8]; - for(let edgeId = 0; edgeId < 4; edgeId++){ - this._isForwardEdge[edgeId] = (0, _glMatrix.vec3).dot((0, _quadJs.Quad).EDGE_FORWARDS[edgeId], this._forward) < 0; - this._distances[edgeId] = 0; - } - for(let axisId = 0; axisId < 2; axisId++)if (this.arePickDivisionsVisible[axisId]) { - (0, _glMatrix.vec2).set(this._gridTicksZeros[axisId], this.zero[axisId], -1); - (0, _glMatrix.vec2).set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); - const gridTicksScale = this._gridTicksScales[axisId]; - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (this.isEdgeVisible[edgeId]) { - let distance = this._distances[edgeId]; - distance += this._gridPickDivisionHeight * 0.5; - const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - (0, _glMatrix.mat4).translate(gridTicksMMatrix, this._mMatrix, this._vec3); - (0, _glMatrix.mat4).multiply(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); - if (!this._isForwardEdge[edgeId]) (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, (0, _constantsJs.Constants).VECTOR3_REFLECTX); - (0, _glMatrix.mat4).scale(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); - distance += this._gridPickDivisionHeight * 0.5; - this._distances[edgeId] = distance; - } - } - } - (0, _glMatrix.vec2).set(this._gridFaceZeros, this.zero[0], this.zero[1]); - (0, _glMatrix.vec2).set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); - for(let faceId = 0; faceId < 2; faceId++)if (this._isForwardFace[faceId]) { - const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; - (0, _glMatrix.mat4).scale(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); - } - for(let axisId = 0; axisId < 2; axisId++)for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - (0, _glMatrix.vec3).multiply(this._edgePosition, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).transformMat4(this._edgePosition, this._edgePosition, this._mvMatrix); - (0, _glMatrix.vec3).normalize(this._forward, this._edgePosition); - (0, _glMatrix.vec3).negate(this._forward, this._forward); - (0, _glMatrix.vec3).cross(this._right, (0, _constantsJs.Constants).VECTOR3_UNITY, this._forward); - (0, _glMatrix.vec3).normalize(this._right, this._right); - (0, _glMatrix.vec3).cross(this._up, this._forward, this._right); - (0, _glMatrix.vec3).transformMat3(this._edgeNormal, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], this._mat3); - (0, _glMatrix.vec3).transformMat3(this._edgePositive, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId], this._mat3); - (0, _glMatrix.vec3).copy(this._edgeNormalTemp, this._edgeNormal); - (0, _glMatrix.vec3).copy(this._edgePositiveTemp, this._edgePositive); - const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; - const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; - const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormalTemp, this._up) > 0) (0, _glMatrix.vec3).copy(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeHorizontalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormalTemp, this._edgeNormalTemp); - } - if ((0, _glMatrix.vec3).dot(this._edgePositiveTemp, this._right) > 0) { - this._isLeftToRightHorizontal[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightHorizontal[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositiveTemp, this._edgePositiveTemp); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); - if ((0, _glMatrix.vec3).dot(edgeHorizontalForward, this._forward) < 0) { - this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; - (0, _glMatrix.vec3).negate(edgeHorizontalRight, edgeHorizontalRight); - } - (0, _glMatrix.vec3).cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); - const edgeVerticalRight = this._edgeVerticalRight[edgeId]; - const edgeVerticalUp = this._edgeVerticalUp[edgeId]; - const edgeVerticalForward = this._edgeVerticalForward[edgeId]; - if ((0, _glMatrix.vec3).dot(this._edgeNormal, this._right) < 0) (0, _glMatrix.vec3).copy(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - else { - (0, _glMatrix.vec3).negate(edgeVerticalUp, (0, _quadJs.Quad).EDGE_NORMALS[edgeId]); - (0, _glMatrix.vec3).negate(this._edgeNormal, this._edgeNormal); - } - if ((0, _glMatrix.vec3).dot(this._edgePositive, this._up) < 0) { - this._isLeftToRightVertical[edgeId] = true; - (0, _glMatrix.vec3).copy(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - } else { - this._isLeftToRightVertical[edgeId] = false; - (0, _glMatrix.vec3).negate(edgeVerticalRight, (0, _quadJs.Quad).EDGE_POSITIVES[edgeId]); - (0, _glMatrix.vec3).negate(this._edgePositive, this._edgePositive); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); - if ((0, _glMatrix.vec3).dot(edgeVerticalForward, this._forward) < 0) { - this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; - (0, _glMatrix.vec3).negate(edgeVerticalRight, edgeVerticalRight); - } - (0, _glMatrix.vec3).cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); - if (this.isEdgeVisible[edgeId]) { - if (this._labels[axisId]) this._updateLabels(axisId, edgeId); - if (this._titles[axisId]) this._updateTitle(axisId, edgeId); - } - if (this.isHeadingVisible[edgeId]) this._updateHeading(axisId, edgeId); - } - } + return this._scalingY; } - _updateLabels(axisId, edgeId) { - const orientation = this._orientations[axisId]; - let distance = this._distances[edgeId]; - let maxLabelSize = this._maxLabelSize[axisId][1]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) maxLabelSize *= this._core.config.axesTextLabelLineHeight; - distance += maxLabelSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const labelMMatrix = this._labelMMatrices[edgeId]; - labelMMatrix[12] = this._vec3[0]; - labelMMatrix[13] = this._vec3[1]; - labelMMatrix[14] = this._vec3[2]; - if (orientation == (0, _mainJs.AxesTextOrientation).parallel) { - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } else { - const right = this._edgeVerticalRight[edgeId]; - const up = this._edgeVerticalUp[edgeId]; - const forward = this._edgeVerticalForward[edgeId]; - labelMMatrix[0] = right[0]; - labelMMatrix[1] = right[1]; - labelMMatrix[2] = right[2]; - labelMMatrix[4] = up[0]; - labelMMatrix[5] = up[1]; - labelMMatrix[6] = up[2]; - labelMMatrix[8] = forward[0]; - labelMMatrix[9] = forward[1]; - labelMMatrix[10] = forward[2]; - } - (0, _glMatrix.mat4).multiply(labelMMatrix, this._mMatrix, labelMMatrix); - if (orientation == (0, _mainJs.AxesTextOrientation).perpendicular) (0, _glMatrix.mat4).multiply(labelMMatrix, labelMMatrix, (0, _constantsJs.Constants).MAT4_ROTATION_MINUS_90); - distance += maxLabelSize * 0.5; - this._distances[edgeId] = distance; - } - _updateTitle(axisId, edgeId) { - let distance = this._distances[edgeId]; - const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; - distance += titleTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const titleMMatrix = this._titleMMatrices[edgeId]; - titleMMatrix[12] = this._vec3[0]; - titleMMatrix[13] = this._vec3[1]; - titleMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - titleMMatrix[0] = right[0]; - titleMMatrix[1] = right[1]; - titleMMatrix[2] = right[2]; - titleMMatrix[4] = up[0]; - titleMMatrix[5] = up[1]; - titleMMatrix[6] = up[2]; - titleMMatrix[8] = forward[0]; - titleMMatrix[9] = forward[1]; - titleMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(titleMMatrix, this._mMatrix, titleMMatrix); - distance += titleTextSize * 0.5; - this._distances[edgeId] = distance; + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } } - _updateHeading(axisId, edgeId) { - let distance = this._distances[edgeId]; - const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; - distance += headingTextSize * 0.5; - (0, _glMatrix.vec3).multiply(this._vec3, (0, _quadJs.Quad).EDGE_POSITIONS[edgeId], this._size); - (0, _glMatrix.vec3).scaleAndAdd(this._vec3, this._vec3, (0, _quadJs.Quad).EDGE_NORMALS[edgeId], distance); - const headingMMatrix = this._headingMMatrices[edgeId]; - headingMMatrix[12] = this._vec3[0]; - headingMMatrix[13] = this._vec3[1]; - headingMMatrix[14] = this._vec3[2]; - const right = this._edgeHorizontalRight[edgeId]; - const up = this._edgeHorizontalUp[edgeId]; - const forward = this._edgeHorizontalForward[edgeId]; - headingMMatrix[0] = right[0]; - headingMMatrix[1] = right[1]; - headingMMatrix[2] = right[2]; - headingMMatrix[4] = up[0]; - headingMMatrix[5] = up[1]; - headingMMatrix[6] = up[2]; - headingMMatrix[8] = forward[0]; - headingMMatrix[9] = forward[1]; - headingMMatrix[10] = forward[2]; - (0, _glMatrix.mat4).multiply(headingMMatrix, this._mMatrix, headingMMatrix); - distance += headingTextSize * 0.5; - this._distances[edgeId] = distance; + get scalingZ() { + return this._scalingZ; } - _updateGrids(size) { - let offset = 0; - this.pickGridLookup = {}; - this._pickGrid = []; - const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; - const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; - const count = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; - const byteLength = (0, _vertexJs.PickGridVertex).SIZE_BYTES * count * 4; - if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { - this._gridVertices = new ArrayBuffer(byteLength); - this._gridVerticesView = new DataView(this._gridVertices); - this._gridIndices = new Uint16Array(count * 6); - } - for(let axisId = 0; axisId < 2; axisId++){ - const width = size[axisId]; - (0, _glMatrix.vec3).set(this._gridTicksScales[axisId], width, this._gridPickDivisionHeight, 1); - offset = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset); - this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; - } - const axisId = 2; - this._gridFaceScale[axisId] = 1; - for(let faceId = 0; faceId < 2; faceId++)offset = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset); + set scalingZ(value2) { + if (value2 != this._scalingZ) { + this._scalingZ = value2; + this._hasChanged = true; + } } - _updateText(size) { - let glyphOffset = 0; - let count = 0; - for(let axisId = 0; axisId < 2; axisId++){ - const labels = this._labels[axisId]; - if (labels) for(let i = 0; i < labels.length; i++)count += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); - const title = this._titles[axisId]; - if (title) count += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); - const heading = this._headings[axisId]; - if (heading) count += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); - } - const byteLength = (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * count * 4; - if (!this._textVertices || this._textVertices.byteLength < byteLength) { - this._textVertices = new ArrayBuffer(byteLength); - this._textVerticesView = new DataView(this._textVertices); - this._textIndices = new Uint16Array(count * 6); - } - this.pickLabelLookup = {}; - this._pickLabel = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._labels[axisId]) { - const width = size[axisId]; - const maxLabelSize = this._maxLabelSize[axisId]; - const orientation = this._orientations[axisId]; - (0, _glMatrix.vec2).set(maxLabelSize, 0, 0); - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateLeftToRightAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - glyphOffset = this._updateRightToLeftAxisLabels(axisId, width, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); - this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; - } else { - this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; - this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; - this._axesLeftToRightIndexCounts[axisId] = 0; - this._axesRightToLeftIndexCounts[axisId] = 0; - this._maxLabelSize[axisId][0] = 0; - this._maxLabelSize[axisId][1] = 0; - } - this.pickTitleLookup = {}; - this._pickTitle = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._titles[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._titleIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); - const scale = this._titleSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesTitle, this._vec4); - this.pickTitleLookup[pickId] = this._pickTitle.length; - this._pickTitle.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; - } else { - this._titleIndexOffsets[axisId] = glyphOffset * 6; - this._titleIndexCounts[axisId] = 0; - } - this.pickHeadingLookup = {}; - this._pickHeading = []; - for(let axisId = 0; axisId < 2; axisId++)if (this._headings[axisId]) { - (0, _glMatrix.vec3).set(this._textPosition, 0, 0, 0); - (0, _glMatrix.vec3).set(this._textOffset, 0, 0, 0); - this._headingIndexOffsets[axisId] = glyphOffset * 6; - const text = (0, _textJs.TextHelper).truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); - const scale = this._headingSizes[axisId] / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const lineHeight = this._font.size * scale; - this._textOffset[0] -= width / 2; - this._textOffset[1] -= (lineHeight - maxGlyphTop) / 2; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesHeading, this._vec4); - this.pickHeadingLookup[pickId] = this._pickHeading.length; - this._pickHeading.push(axisId); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; - } else { - this._headingIndexOffsets[axisId] = glyphOffset * 6; - this._headingIndexCounts[axisId] = 0; - } + get offsetX() { + return this._offset[12]; } - _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (position - 0.5) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = position == 0 ? 0 : position == 1 ? -width : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - maxSize[0] = Math.max(width, maxSize[0]); - maxSize[1] = Math.max(lineHeight, maxSize[1]); - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (position - 0.5) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = position == 0 ? 0 : position == 1 ? -maxGlyphTop : -maxGlyphTop / 2; - maxSize[0] = Math.max(lineHeight, maxSize[0]); - maxSize[1] = Math.max(width, maxSize[1]); - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } } - _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales) { - const isAxisReversed = this.isAxisReversed[axisId]; - for(let label = 0; label < labels.length; label++){ - const text = (0, _textJs.TextHelper).truncate(labels[label], this._core.config.axesTextLabelMaxGlyphs); - const lineHeight = scales[label]; - const scale = lineHeight / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const maxGlyphTop = this._textMetric.maxTop * scale; - const position = isAxisReversed ? 1 - positions[label] : positions[label]; - switch(orientation){ - case (0, _mainJs.AxesTextOrientation).parallel: - (0, _glMatrix.vec3).set(this._textPosition, (0.5 - position) * size, 0, 0); - if (this._isDiscrete[axisId]) this._textOffset[0] = -width / 2; - else this._textOffset[0] = label == 0 ? -width : label == labels.length - 1 ? 0 : -width / 2; - this._textOffset[1] = (maxGlyphTop - lineHeight) / 2; - break; - case (0, _mainJs.AxesTextOrientation).perpendicular: - (0, _glMatrix.vec3).set(this._textPosition, 0, (0.5 - position) * size, 0); - this._textOffset[0] = -width / 2; - if (this._isDiscrete[axisId]) this._textOffset[1] = -maxGlyphTop / 2; - else this._textOffset[1] = label == 0 ? -maxGlyphTop : label == labels.length - 1 ? 0 : -maxGlyphTop / 2; - break; - } - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesLabel, this._vec4); - this.pickLabelLookup[pickId] = this._pickLabel.length / 2; - this._pickLabel.push(axisId); - this._pickLabel.push(label); - (0, _textJs.TextHelper).addString(this._font, text, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale, this._textOffset, null, this._vec4); - glyphOffset += text.length; - } - return glyphOffset; - } - _updateGridTicks(axisId, dataView, indices, offset) { - this._gridTicksIndexOffsets[axisId] = offset * 6; - if (this._gridTicksPositions[axisId]) { - const axes = (0, _glMatrix.vec3).create(); - const positions = this._gridTicksPositions[axisId]; - const isAxisReversed = this.isAxisReversed[axisId]; - let vertexOffset = offset * 4; - for(let position = 0; position < positions.length - 1; position++){ - const left = isAxisReversed ? 1 - positions[position + 1] - 0.5 : positions[position] - 0.5; - const right = isAxisReversed ? 1 - positions[position] - 0.5 : positions[position + 1] - 0.5; - axes[axisId] = position + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let j = 0; j < this._indexTemplate.length; j++)indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, left + 0.5, 0, right + 0.5, 1); - this._translation[0] = left; - this._translation[1] = 0.5; - this._translation[2] = 0; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 1; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = left; - this._translation[1] = -0.5; - this._texCoord[0] = left + 0.5; - this._texCoord[1] = 0; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[0] = right; - this._texCoord[0] = right + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, (0, _constantsJs.Constants).VECTOR3_UNITZ); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - this._gridTicksIndexCounts[axisId] = offset * 6 - this._gridTicksIndexOffsets[axisId]; - return offset; - } - _updateGridFace(axisId, faceId, dataView, indices, offset) { - (0, _glMatrix.vec3).set(this._translation, 0, 0, 0); - this._gridFaceIndexOffsets[faceId] = offset * 6; - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { - const axes = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).negate(this._normal, (0, _quadJs.Quad).FACE_NORMALS[faceId]); - const positions2 = this._gridTicksPositions[axisId2]; - const positions3 = this._gridTicksPositions[axisId3]; - const isAxisReversed2 = this.isAxisReversed[axisId2]; - const isAxisReversed3 = this.isAxisReversed[axisId3]; - for(let position2 = 0; position2 < positions2.length - 1; position2++){ - const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; - const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; - axes[axisId2] = position2 + 1; - let vertexOffset = offset * 4; - for(let position3 = 0; position3 < positions3.length - 1; position3++){ - const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; - const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; - axes[axisId3] = position3 + 1; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).axesDivision, this._vec4); - this.pickGridLookup[pickId] = this._pickGrid.length / 3; - this._pickGrid.push(axes[0]); - this._pickGrid.push(axes[1]); - this._pickGrid.push(axes[2]); - let indexOffset = offset * 6; - for(let i = 0; i < this._indexTemplate.length; i++)indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; - (0, _glMatrix.vec4).set(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); - this._translation[axisId2] = min2; - this._translation[axisId3] = max3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = max3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = min2; - this._translation[axisId3] = min3; - this._texCoord[0] = min2 + 0.5; - this._texCoord[1] = min3 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - this._translation[axisId2] = max2; - this._texCoord[0] = max2 + 0.5; - (0, _vertexJs.PickGridVertex).setTranslation(dataView, vertexOffset, this._translation); - (0, _vertexJs.PickGridVertex).setNormal(dataView, vertexOffset, this._normal); - (0, _vertexJs.PickGridVertex).setIdColor(dataView, vertexOffset, this._vec4); - (0, _vertexJs.PickGridVertex).setTexCoord(dataView, vertexOffset, this._texCoord); - (0, _vertexJs.PickGridVertex).setBounds(dataView, vertexOffset, this._bounds); - vertexOffset++; - offset++; - } - } - } - this._gridFaceIndexCounts[faceId] = offset * 6 - this._gridFaceIndexOffsets[faceId]; - return offset; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../main.js":"b6Xbk","./axes.js":"4X9HQ","../../meshes/quad.js":"6dxCM","../../vertex.js":"8lW8V","../../helpers/axes.js":"ihirw","../../helpers/text.js":"keNgB","../../helpers/pick.js":"fOypM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fn4YW":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Glyph", ()=>Glyph); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -parcelHelpers.export(exports, "Font", ()=>Font); -parcelHelpers.export(exports, "FontAtlas", ()=>FontAtlas); -parcelHelpers.export(exports, "FontRasterizer", ()=>FontRasterizer); -parcelHelpers.export(exports, "GlyphRasterizer", ()=>GlyphRasterizer); -var _mainJs = require("./main.js"); -class Glyph { - toJSON() { - return { - key: this.key, - char: this.char, - width: this.width, - height: this.height, - top: this.top, - left: this.left, - advance: this.advance, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + get offsetY() { + return this._offset[13]; } -} -class FontVisual { - update() {} - constructor(font){ - this.font = font; + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } } -} -class Font { - get atlas() { - return this._rasterizer.fontAtlas; + get offsetZ() { + return this._offset[14]; } - get count() { - return this._chars.size; + set offsetZ(value2) { + if (value2 != this._offset[14]) { + this._offset[14] = value2; + } } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._chars = new Set(); - this._previousSize = 0; - this.glyphs = {}; + constructor(core) { + super(core); + this._size = create$3(); + this._translation = create$3(); + this._normal = create$3(); + this._forward = create$3(); + this._right = create$3(); + this._up = create$3(); + this._texCoord = create(); + this._bounds = create$2(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mat3 = create$5(); + this._isDiscrete = [false, false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._minBoundsZ = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._maxBoundsZ = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 6; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 12; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$3(); + this._textPosition = create$3(); + this._distances = []; + for (let i = 0; i < 12; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 3; i++) { + this._maxLabelSize.push(create()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._labelMMatrices.push(create$4()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 3; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._titleMMatrices.push(create$4()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 3; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 12; i++) { + this._headingMMatrices.push(create$4()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$3(); + this._edgePositive = create$3(); + this._edgeNormal = create$3(); + this._edgeNormalTemp = create$3(); + this._edgePositiveTemp = create$3(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 12; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$3()); + this._edgeHorizontalUp.push(create$3()); + this._edgeHorizontalForward.push(create$3()); + this._edgeVerticalRight.push(create$3()); + this._edgeVerticalUp.push(create$3()); + this._edgeVerticalForward.push(create$3()); + } + this.isFaceVisible = []; + for (let i = 0; i < 6; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$3(); + this._gridTicksZeros = []; + this._gridFaceZeros = []; + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = []; + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$3(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 3; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create()); + this._gridFaceZeros.push(create()); + this._gridTicksMinorGridlines.push(create()); + this._gridFaceMinorGridlines.push(create()); + this._gridTicksScales.push(create$3()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + } + for (let i = 0; i < 6; i++) { + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$4()); + } + for (let i = 0; i < 12; i++) { + this._gridTicksMMatrices.push(create$4()); + this._gridTicksRotations.push(create$4()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Cube.EDGE_POSITIVES[i][0]; + _mat4[1] = Cube.EDGE_POSITIVES[i][1]; + _mat4[2] = Cube.EDGE_POSITIVES[i][2]; + _mat4[4] = Cube.EDGE_NORMALS[i][0]; + _mat4[5] = Cube.EDGE_NORMALS[i][1]; + _mat4[6] = Cube.EDGE_NORMALS[i][2]; + cross(this._vec3, Cube.EDGE_POSITIVES[i], Cube.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null, null]; + this._toValues = [null, null, null]; + this.isDivisionPickingEnabled = [false, false, false]; + this.isLabelPickingEnabled = [false, false, false]; + this.isTitlePickingEnabled = [false, false, false]; + this.isHeadingPickingEnabled = [false, false, false]; + this.isAxisReversed = [false, false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._scalingZ = 1; + this._offset = create$4(); } - addGlyph(char) { - if (!this._chars.has(char)) { - this._chars.add(char); - this._rasterizer.draw(char); - this._hasChanged = true; - } + initialize() { + this._isInitialized = true; } - update() { + update(elapsedTime) { + if (this.isInitialized) { if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); - this._previousSize = this._chars.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } - toJSON() { - const glyphs = []; - for(let key in this.glyphs){ - const glyph = this.glyphs[key]; - glyphs.push(glyph.toJSON()); - } - return { - name: this.name, - size: this.size, - border: this.border, - glyphs: glyphs, - edgeValue: this.edgeValue - }; - } -} -class FontAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class FontRasterizer { - get font() { - return this._font; - } - get fontAtlas() { - return this._fontAtlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontAtlas = options.fontAtlas; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._font = new Font(core, this); - this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); - this._font.size = this._fontSize; - this._font.border = this._border; - this._font.edgeValue = this._edgeValue; - const glyphRasterizerOptions = { - baseline: this._baseline, - border: this._border, - edgeValue: this._edgeValue, - fontFamily: this._fontFamily, - fontSize: this._fontSize, - fontStyle: this._fontStyle, - fontWeight: this._fontWeight, - maxDistance: this._maxDistance - }; - this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const glyph = this._glyphRasterizer.draw(char); - const texWidth = glyph.width + 2 * this._border; - const texHeight = glyph.height + 2 * this._border; - const width = this._fontAtlas.imageData.width; - const height = this._fontAtlas.imageData.height; - if (this._fontAtlas.x + texWidth > width) this._fontAtlas.x = 0; - let y = 0; - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)y = Math.max(y, this._fontAtlas.top[x]); - if (y + texHeight > height) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._font.name} height overflow`); - for(let x = this._fontAtlas.x; x < this._fontAtlas.x + texWidth; x++)this._fontAtlas.top[x] = y + texHeight; - glyph.u0 = this._fontAtlas.x / width; - glyph.v0 = y / height; - glyph.u1 = (this._fontAtlas.x + texWidth) / width; - glyph.v1 = (y + texHeight) / height; - this._font.glyphs[char] = glyph; - for(let i = 0; i < glyph.distances.length; i++){ - const distance = glyph.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._fontAtlas.x + dataX + (y + dataY) * width) * 4; - this._fontAtlas.imageData.data[offset + 0] = distance; - this._fontAtlas.imageData.data[offset + 1] = distance; - this._fontAtlas.imageData.data[offset + 2] = distance; - this._fontAtlas.imageData.data[offset + 3] = 0xff; - } - this._fontAtlas.x += texWidth; - } -} -class GlyphRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._fontSize = options.fontSize; - this._border = options.border; - this._fontFamily = options.fontFamily; - this._fontWeight = options.fontWeight; - this._fontStyle = options.fontStyle; - this._baseline = options.baseline; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._size = this._fontSize + this._border * 2; - this._size += this._border * 2; - this._gridOuter = new Float64Array(this._size * this._size); - this._gridInner = new Float64Array(this._size * this._size); - this._f = new Float64Array(this._size); - this._z = new Float64Array(this._size + 1); - this._v = new Uint16Array(this._size); - const canvas = document.createElement("canvas"); - canvas.width = canvas.height = this._size; - this._context = canvas.getContext("2d", { - willReadFrequently: true - }); - this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; - this._context.textBaseline = this._baseline; - this._context.textAlign = "left"; - this._context.fillStyle = "black"; - this._core.log.write((0, _mainJs.LogLevel).info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(char) { - const textMetrics = this._context.measureText(char); - const glyphLeft = 0; - const glyphTop = Math.floor(textMetrics.actualBoundingBoxAscent); - let glyphWidth = Math.ceil(textMetrics.actualBoundingBoxRight); - let glyphHeight = Math.ceil(textMetrics.actualBoundingBoxAscent) + Math.ceil(textMetrics.actualBoundingBoxDescent); - glyphWidth = Math.min(this._size - this._border, glyphWidth); - glyphHeight = Math.min(this._size - this._border, glyphHeight); - const width = glyphWidth + 2 * this._border; - const height = glyphHeight + 2 * this._border; - const length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const glyph = new Glyph(); - glyph.char = char; - glyph.key = char.codePointAt(0); - glyph.distances = distances; - glyph.gradientsX = gradientsX; - glyph.gradientsY = gradientsY; - glyph.pixels = pixels; - glyph.width = glyphWidth; - glyph.height = glyphHeight; - glyph.top = glyphTop; - glyph.left = glyphLeft; - glyph.advance = textMetrics.width; - if (glyphWidth == 0 || glyphHeight == 0) return glyph; - this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); - this._context.fillText(char, this._border, this._border + glyphTop); - const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < glyphHeight; y++)for(let x = 0; x < glyphWidth; x++){ - const a = imgData.data[4 * (y * glyphWidth + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - pixels[j] = 0xff; + const start = window.performance.now(); + this._hasChanged = false; + set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); + const maxBounds = Math.max(this._size[0], Math.max(this._size[1], this._size[2])); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._size[2] *= this._scalingZ / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian3d updated ${Math.round(window.performance.now() - start)}ms`); + } + multiply$2(this._mMatrix, this.mMatrix, this._offset); + this._mvMatrix = create$4(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 6; faceId++) { + multiply$1(this._vec3, Cube.FACE_POSITIONS[faceId], this._size); + transformMat4$2(this._forward, this._vec3, this._mvMatrix); + transformMat3(this._normal, Cube.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 12; edgeId++) { + const faceIds = Cube.EDGE_FACES[edgeId]; + const forward1 = this._isForwardFace[faceIds[0]]; + const forward2 = this._isForwardFace[faceIds[1]]; + const outsideEdge = forward1 != forward2; + this._isOutsideEdge[edgeId] = outsideEdge; + if (outsideEdge) { + this._isForwardEdge[edgeId] = dot$1(Cube.EDGE_FORWARDS[edgeId], this._forward) < 0; + } + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 3; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId] && this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + translate(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); } + scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } } + } } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return glyph; - } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kM2vK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manager", ()=>Manager); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _animationJs = require("../helpers/animation.js"); -var _constantsJs = require("../constants.js"); -var _keyboardJs = require("./keyboard.js"); -class Manager { - constructor(core){ - this._manipulators = {}; - this._core = core; - this._vec3 = (0, _glMatrix.vec3).create(); - this._manipulationProcessor = new (0, _manipulationprocessorJs.ManipulationProcessor)(core); - this._manipulators = {}; - this._pointers = new (0, _pointersJs.Pointers)(core, this._manipulators); - this._pointers.initialize(core.container); - this._mouseWheel = new (0, _mousewheelJs.MouseWheel)(core); - this._mouseWheel.initialize(core.container); - this._keyboard = new (0, _keyboardJs.Keyboard)(core); - this._keyboard.initialize(core.container); - this.isPickingEnabled = true; - this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; - this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; - this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; - this.pickHoldDelay = this._core.config.pickHoldDelay; - this.pickSelectDelay = this._core.config.pickSelectDelay; - const rightButton = 2; - this.singleTouchAction = (manipulator)=>{ - if (manipulator.type == "mouse" && manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _mainJs.SingleTouchAction).translate; - else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton) return (0, _mainJs.SingleTouchAction).lasso; - else return (0, _mainJs.SingleTouchAction).rotate; - }; - this.mouseWheelAction = (keyboard)=>{ - if (this._keyboard.isKeyDown("Control")) return (0, _mainJs.MouseWheelAction).rotateY; - else return (0, _mainJs.MouseWheelAction).zoom; - }; - this.lassoPickType = (0, _mainJs.PickType).data; - this._thumbstickX = 0; - this._previousControllerButtonPressed = [ - false, - false, - false, - false - ]; - this._quat0 = (0, _glMatrix.quat).create(); - this._quat1 = (0, _glMatrix.quat).create(); - } - update(elapsedTime, xrFrame) { - if (xrFrame) { - const inputSources = this._core.webXRSession.inputSources; - if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { - const inputSource = inputSources[0]; - const controllerVisual = this._core.renderer.controllers[0]; - if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { - const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); - if (gripPose) controllerVisual.mMatrix = gripPose.transform.matrix; - const gamepad = inputSource.gamepad; - this._core.renderer.isPickingEnabled = false; - const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); - if (rayPose) { - controllerVisual.rayMMatrix = rayPose.transform.matrix; - if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { - this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; - this._core.renderer.isPickingEnabled = true; - } - } - const threshold = 0.2; - const dampening = Math.min(0.015 * elapsedTime, 1); - this._thumbstickX = (0, _animationJs.AnimationHelper).damp(this._thumbstickX, gamepad.axes[2], threshold, dampening); - if (this._thumbstickX != 0) { - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); - this._core.getModelRotation(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat0, this._quat1); - this._core.setModelRotation(this._quat1, true); - } - if (gamepad.buttons[2].pressed) { - if (!this._previousControllerButtonPressed[2]) { - this._previousControllerButtonPressed[2] = true; - if (this.controllerButtonPressedCallback) this.controllerButtonPressedCallback(2); - } - } else this._previousControllerButtonPressed[2] = false; - } - } - } else { - const camera = this._core.camera; - this._manipulationProcessor.update(elapsedTime, this._manipulators); - this._pointers.update(elapsedTime); - this._mouseWheel.update(elapsedTime); - this._keyboard.update(elapsedTime); - if (this._mouseWheel.delta != 0) switch(this.mouseWheelAction(this._keyboard)){ - case (0, _mainJs.MouseWheelAction).zoom: - if (this._pointers.hoverX, this._pointers.hoverY) camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); - break; - case (0, _mainJs.MouseWheelAction).rotateY: - (0, _glMatrix.quat).setAxisAngle(this._quat0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); - camera.getOrbit(this._quat1); - (0, _glMatrix.quat).multiply(this._quat1, this._quat1, this._quat0); - camera.setOrbit(this._quat1, true); - break; - } - const count = this._manipulationProcessor.count; - if (count == 0) { - if (this._isLassoPicking) { - this._isLassoPicking = false; - this._core.renderer.isLassoPicking = false; - const x0 = Math.min(this._lassoX0, this._lassoX1); - const y0 = Math.min(this._lassoY0, this._lassoY1); - const x1 = Math.max(this._lassoX0, this._lassoX1); - const y1 = Math.max(this._lassoY0, this._lassoY1); - if (x1 - x0 > 0 && y1 - y0 > 0) { - const sets = this._core.pickLasso(x0, y0, x1, y1, this.lassoPickType); - const result = { - x0: x0, - y0: y0, - x1: x1, - y1: y1, - pickType: this.lassoPickType, - ids: sets, - manipulator: this._manipulator - }; - this.pickLassoCallback(result); - } - } - } else if (count == 1) { - const translationDelta = this._manipulationProcessor.translationDelta; - if (translationDelta[0] != 0 || translationDelta[1] != 0) { - const manipulators = this._manipulationProcessor.manipulators; - for(const key in manipulators){ - const manipulator = manipulators[key]; - switch(this.singleTouchAction(manipulator)){ - case (0, _mainJs.SingleTouchAction).rotate: - camera.rotate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).translate: - camera.translate(translationDelta); - break; - case (0, _mainJs.SingleTouchAction).lasso: - if (this.pickLassoCallback) { - if (!this._isLassoPicking) { - this._isLassoPicking = true; - this._core.renderer.isLassoPicking = true; - this._lassoX0 = manipulator.position[0]; - this._lassoY0 = manipulator.position[1]; - } - this._lassoX1 = manipulator.position[0]; - this._lassoY1 = manipulator.position[1]; - this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); - this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); - this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); - } - break; - } - break; - } - } - } else { - const translationDelta = this._manipulationProcessor.translationDelta; - const camera = this._core.camera; - if (translationDelta[0] != 0 || translationDelta[1] != 0) camera.translate(translationDelta); - if (this._manipulationProcessor.scaleDelta != 0) { - const distance = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; - camera.zoom(distance, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this._manipulationProcessor.twistDelta != 0) camera.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); - } - if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { - const camera = this._core.camera; - const renderer = this._core.renderer; - if (renderer.isCapturingPickImage) { - camera.updatePickVMatrix(renderer.width / 2, renderer.height / 2); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - this._pickedTime = 0; - } else if (this._pointers.hoverId > -1) { - const pickingX = this._pointers.hoverX; - const pickingY = this._pointers.hoverY; - camera.updatePickVMatrix(pickingX, pickingY); - renderer.pickVMatrix = camera.pickVMatrix; - renderer.isPickingEnabled = true; - if (this._pickedId != renderer.pickedId) { - this._pickedId = renderer.pickedId; - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 1) { - this._pickedTime += elapsedTime; - for(const key in this._manipulators){ - this._manipulator = this._manipulators[key]; - break; - } - } - if (this._pickedTime > 0) switch(renderer.pickedType){ - case (0, _mainJs.PickType).data: - if (this._pickedTime > this.pickHoldDelay) { - renderer.getVertexPosition(this._vec3, this._pickedId); - this._core.setModelManipulationOrigin(this._vec3); - this._pickedTime = 0; - } else if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.transitionBuffers.length; i++){ - const transitionBuffer = renderer.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - transitionBuffer: i, - id: id, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked id ${result.id}, transition buffer ${i}`); - if (this.pickItemCallback) this.pickItemCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).label: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.labelSets.length; i++){ - const labelSet = renderer.labelSets[i].label; - const id = labelSet.pickIdLookup[this._pickedId]; - if (id > -1) { - const result = { - label: id, - set: i, - manipulator: this._manipulator - }; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, set ${result.set}`); - if (this.pickLabelSetCallback) this.pickLabelSetCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesDivision: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickGridLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickGrid(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); - if (this.pickAxesGridCallback) this.pickAxesGridCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesTitle: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickTitleLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickTitle(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked title ${result.axis}, axes ${result.axes}`); - if (this.pickAxesTitleCallback) this.pickAxesTitleCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesLabel: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickLabelLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickLabel(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); - if (this.pickAxesLabelCallback) this.pickAxesLabelCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - case (0, _mainJs.PickType).axesHeading: - if (this._manipulationProcessor.count == 0) { - if (this._pickedTime > this.pickSelectDelay) for(let i = 0; i < renderer.currentAxes.length; i++){ - const axes = renderer.currentAxes[i].axes; - const id = axes.pickHeadingLookup[this._pickedId]; - if (id > -1) { - const result = axes.pickHeading(id); - result.axes = i; - result.manipulator = this._manipulator; - this._core.log.write((0, _mainJs.LogLevel).info, `picked heading ${result.axis}, axes ${result.axes}`); - if (this.pickAxesHeadingCallback) this.pickAxesHeadingCallback(result); - break; - } - } - this._pickedTime = 0; - } - break; - } - } else { - renderer.isPickingEnabled = false; - this._pickedTime = 0; + for (let axisId = 0; axisId < 3; axisId++) { + if (this.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + set(this._gridFaceZeros[axisId], this.zero[axisId2], this.zero[axisId3]); + set(this._gridFaceMinorGridlines[axisId], this.minorGridlines[axisId2], this.minorGridlines[axisId3]); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + if (this._size[axisId] > 0) { + translate(gridFaceMMatrix, gridFaceMMatrix, Cube.FACE_POSITIONS[faceId]); } - } else { - this._core.renderer.isPickingEnabled = false; - this._pickedTime = 0; + } + } + } + } + for (let axisId = 0; axisId < 3; axisId++) { + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (this._isOutsideEdge[edgeId]) { + multiply$1(this._edgePosition, Cube.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$2(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross(this._right, Constants.VECTOR3_UNITY, this._forward); + normalize$2(this._right, this._right); + cross(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Cube.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Cube.EDGE_POSITIVES[edgeId], this._mat3); + copy$3(this._edgeNormalTemp, this._edgeNormal); + copy$3(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$3(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$3(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$3(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Cube.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$3(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Cube.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } } + } } - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); - this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); - } - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","./manipulationprocessor.js":"elobQ","./mousewheel.js":"gBsJR","./pointers.js":"deD7J","../helpers/animation.js":"gfPT1","../constants.js":"dHTsY","./keyboard.js":"5tZWK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"elobQ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>ManipulationProcessor); -var _glMatrix = require("gl-matrix"); -var _mathJs = require("../helpers/math.js"); -var _angleJs = require("../helpers/angle.js"); -class ManipulationProcessor { - get manipulators() { - return this._manipulators; + } } - get count() { - return this._count; + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; } - get isDragging() { - return this._isDragging; - } - constructor(core){ - this._core = core; - this._count = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._previousCentroid = (0, _glMatrix.vec3).create(); - this._relativePositionToCentroid = (0, _glMatrix.vec3).create(); - this._directionToCentroid = (0, _glMatrix.vec3).create(); - this._previousDirectionToCentroid = (0, _glMatrix.vec3).create(); - this._manipulators = {}; - this._removedManipulators = []; - this.cumulativeTranslation = (0, _glMatrix.vec3).create(); - this.translationDelta = (0, _glMatrix.vec3).create(); - this.centroid = (0, _glMatrix.vec3).create(); - this.maxScale = Number.MAX_VALUE; - this.twistAxis = (0, _glMatrix.vec3).fromValues(0, 0, 1); - this.initialize(); + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } - update(elapsedTime, manipulators) { - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (!manipulators[manipulator.id]) { - if (this.removeManipulator) this.removeManipulator(manipulator); - this._removedManipulators.push(manipulator.id); - } + _updateHeading(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Cube.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Cube.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; + } + _updateGrids(size) { + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const zDivisions = this._gridTicksPositions[2] ? this._gridTicksPositions[2].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + 2 * (xDivisions * zDivisions) + 2 * (yDivisions * zDivisions) + xDivisions + yDivisions + zDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId = 0; axisId < 3; axisId++) { + const width2 = size[axisId]; + set$3(this._gridTicksScales[axisId], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId, this._gridVerticesView, this._gridIndices, offset2); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } + this._gridFaceScale[axisId] = size[axisId] == 0 ? 1 : size[axisId]; + } + } + _updateText(size) { + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 3; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); + } + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._labels[axisId]) { + const width2 = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; + } + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._titles[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; + } + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 3; axisId++) { + if (this._headings[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; } - if (this._removedManipulators.length > 0) { - for(let i = 0; i < this._removedManipulators.length; i++){ - delete this._manipulators[this._removedManipulators[i]]; - this._count--; + } + } + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (position2 - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; } - this._removedManipulators = []; - } - for(const key in manipulators){ - const manipulator = manipulators[key]; - if (!this._manipulators[manipulator.id]) { - if (!this.addManipulator || this.addManipulator(manipulator)) { - (0, _glMatrix.vec3).copy(manipulator.initialPosition, manipulator.position); - this._manipulators[manipulator.id] = manipulator; - this._count++; - } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (position2 - 0.5) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } - (0, _glMatrix.vec3).set(this.translationDelta, 0, 0, 0); - this.scaleDelta = 0; - this.twistDelta = 0; - if (this._count > 0) { - if (this._previousCount > 0) { - if (this.prepareManipulation) this.prepareManipulation(); - this._process(); - if (this.processManipulation) this.processManipulation(elapsedTime); + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (0.5 - position2) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; } else { - this.initialize(); - if (this.beginManipulation) this.beginManipulation(); + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; } - } else { - if (this._previousCount > 0) { - if (this.endManipulation) this.endManipulation(); + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (0.5 - position2) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; } + break; } - this._isDragging = this._count == 1 && (0, _glMatrix.vec3).squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; - this._previousCount = this._count; - } - initialize() { - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - (0, _glMatrix.vec3).set(this.cumulativeTranslation, 0, 0, 0); - this.cumulativeScale = 1; - this.cumulativeTwist = 0; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; } - _process() { - if (this._previousCount > 0) { - let persisted = 0; - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) persisted++; - } - const removed = this._previousCount - persisted; - if (persisted > 0) { - if (removed > 0) (0, _glMatrix.vec3).copy(this._centroid, this._previousCentroid); - else { - (0, _glMatrix.vec3).set(this._centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) (0, _glMatrix.vec3).add(this._centroid, this._centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this._centroid, this._centroid, 1 / persisted); - } - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - if (manipulator.isPersisted) { - manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, (0, _glMatrix.vec3).squaredDistance(manipulator.position, manipulator.initialPosition)); - (0, _glMatrix.vec3).add(this.translationDelta, this.translationDelta, manipulator.position); - (0, _glMatrix.vec3).subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); - (0, _glMatrix.vec3).subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); - const distanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(this._relativePositionToCentroid); - if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) this.scaleDelta += 1; - else { - const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); - const previousDistanceToCentroidSquared = (0, _glMatrix.vec3).squaredLength(manipulator.previousPositionRelativeToCentroid); - const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); - this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; - (0, _glMatrix.vec3).scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); - (0, _glMatrix.vec3).scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); - this.twistDelta += (0, _angleJs.AngleHelper).signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); - } - } - } - (0, _glMatrix.vec3).scale(this.translationDelta, this.translationDelta, 1 / persisted); - (0, _glMatrix.vec3).add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); - this.scaleDelta /= persisted; - this.cumulativeScale = (0, _mathJs.MathHelper).clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); - this.scaleDelta -= 1; - this.twistDelta /= persisted; - this.cumulativeTwist += this.twistDelta; - } + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$3(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions[position2 + 1] - 0.5 : positions[position2] - 0.5; + const right = isAxisReversed ? 1 - positions[position2] - 0.5 : positions[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; } - (0, _glMatrix.vec3).set(this.centroid, 0, 0, 0); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).add(this.centroid, this.centroid, manipulator.position); - } - (0, _glMatrix.vec3).scale(this.centroid, this.centroid, 1 / this._count); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - (0, _glMatrix.vec3).subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); - } - (0, _glMatrix.vec3).copy(this._previousCentroid, this.centroid); - for(const key in this._manipulators){ - const manipulator = this._manipulators[key]; - manipulator.isPersisted = true; - (0, _glMatrix.vec3).copy(manipulator.previousPosition, manipulator.position); - (0, _glMatrix.vec3).copy(manipulator.previousRotationAxis, manipulator.rotationAxis); - (0, _glMatrix.vec3).copy(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); - } - } -} - -},{"gl-matrix":"erHGu","../helpers/math.js":"6Lv1i","../helpers/angle.js":"hBXkO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gBsJR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MouseWheel", ()=>MouseWheel); -class MouseWheel { - constructor(core){ - this._core = core; - this._previousTotal = 0; - this.total = 0; - } - initialize(element) { - element.addEventListener("wheel", (e)=>{ - e.preventDefault(); - const wheelEvent = e; - this.total += wheelEvent.deltaY; - }, { - passive: false - }); + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$3(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$3(); + negate(this._normal, Cube.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } - update(elapsedTime) { - const total = this.total; - this.delta = total - this._previousTotal; - this._previousTotal = total; - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"deD7J":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Pointers", ()=>Pointers); -var _manipulatorJs = require("../input/manipulator.js"); -class Pointers { - get hoverX() { - return this._hoverX; + } + class Cartesian2dAxes extends AxesBase { + get size() { + return this._size; } - get hoverY() { - return this._hoverY; + get isDiscreteX() { + return this._isDiscrete[0]; } - get hoverId() { - return this._hoverId; + set isDiscreteX(value2) { + if (value2 != this._isDiscrete[0]) { + this._isDiscrete[0] = value2; + this._hasChanged = true; + } } - constructor(core, manipulators){ - this._core = core; - this._manipulators = manipulators; + get isDiscreteY() { + return this._isDiscrete[1]; } - initialize(element) { - this._element = element; - element.addEventListener("pointerdown", (e)=>this._handlePointerDown(e), { - passive: true - }); - element.addEventListener("pointermove", (e)=>this._handlePointerMove(e), { - passive: true - }); - element.addEventListener("pointerup", (e)=>this._handlePointerUp(e), { - passive: true - }); - element.addEventListener("pointercancel", (e)=>this._handlePointerCancel(e), { - passive: true - }); - element.addEventListener("pointerleave", (e)=>this._handlePointerLeave(e), { - passive: true - }); - element.addEventListener("pointerout", (e)=>this._handlePointerOut(e), { - passive: true - }); + set isDiscreteY(value2) { + if (value2 != this._isDiscrete[1]) { + this._isDiscrete[1] = value2; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this._core.config.isDebugVisible) { - this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); - this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); - } + get minBoundsX() { + return this._minBoundsX; } - _handlePointerDown(e) { - this._element.focus(); - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const manipulator = new (0, _manipulatorJs.Manipulator)(); - const id = e.pointerId; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - manipulator.id = id; - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.type = e.pointerType; - manipulator.button = e.button; - manipulator.shiftKey = e.shiftKey; - manipulator.ctrlKey = e.ctrlKey; - manipulator.altKey = e.altKey; - manipulator.event = e; - this._manipulators[id] = manipulator; - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; + set minBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - _handlePointerMove(e) { - const devicePixelRatio = this._core.renderer.devicePixelRatio; - const x = e.offsetX * devicePixelRatio; - const y = e.offsetY * devicePixelRatio; - const id = e.pointerId; - const manipulator = this._manipulators[id]; - if (manipulator) { - manipulator.position[0] = x; - manipulator.position[1] = y; - manipulator.event = e; - } - switch(e.pointerType){ - case "mouse": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - break; - case "pen": - this._hoverId = id; - this._hoverX = x; - this._hoverY = y; - this._tiltX = e.tiltX; - this._tiltY = e.tiltY; - this._twist = e.twist; - break; - } + get maxBoundsX() { + return this._maxBoundsX; } - _handlePointerUp(e) { - const manipulator = this._manipulators[e.pointerId]; - if (manipulator) manipulator.event = e; - this._remove(e.pointerId); + set maxBoundsX(value2) { + if (value2 != this._minBoundsX) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - _handlePointerCancel(e) { - this._remove(e.pointerId); + get minBoundsY() { + return this._minBoundsY; } - _handlePointerLeave(e) { - this._resetHover(); - this._remove(e.pointerId); + set minBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - _handlePointerOut(e) { - this._resetHover(); - this._remove(e.pointerId); + get maxBoundsY() { + return this._maxBoundsY; } - _resetHover() { - this._hoverId = null; - this._hoverX = null; - this._hoverY = null; + set maxBoundsY(value2) { + if (value2 != this._minBoundsY) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - _remove(pointerId) { - const manipulator = this._manipulators[pointerId]; - if (manipulator) delete this._manipulators[pointerId]; - } -} - -},{"../input/manipulator.js":"gniz0","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gniz0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Manipulator", ()=>Manipulator); -var _glMatrix = require("gl-matrix"); -class Manipulator { - constructor(){ - this.pickedIndex = 0; - this.maxTranslationSquared = 0; - this.initialPosition = (0, _glMatrix.vec3).create(); - this.position = (0, _glMatrix.vec3).create(); - this.previousPosition = (0, _glMatrix.vec3).create(); - this.holdOrigin = (0, _glMatrix.vec3).create(); - this.positionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.previousPositionRelativeToCentroid = (0, _glMatrix.vec3).create(); - this.rotationAxis = (0, _glMatrix.vec3).create(); - this.previousRotationAxis = (0, _glMatrix.vec3).create(); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfPT1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AnimationHelper", ()=>AnimationHelper); -var _mathJs = require("./math.js"); -class AnimationHelper { - static smoothStep(value) { - return value * value * (3 - 2 * value); - } - static damp(value, target, threshold, dampening) { - if (Math.abs(target) < threshold) return (0, _mathJs.MathHelper).lerp(value, 0, dampening); - else return (0, _mathJs.MathHelper).lerp(value, target, dampening); - } -} - -},{"./math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5tZWK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>Keyboard); -class Keyboard { - constructor(core){ - this._core = core; - this._pressedKeys = new Set(); - this._previousPressedKeys = new Set(); - } - initialize(element) { - element.addEventListener("keydown", (e)=>{ - this._handleKeyDown(e); - }, false); - element.addEventListener("keyup", (e)=>{ - this._handleKeyUp(e); - }, false); + getIsOutsideEdge(index2) { + return this._isOutsideEdge[index2]; } - update(elapsedTime) { - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + getIsForwardFace(index2) { + return this._isForwardFace[index2]; } - isKeyDown(key) { - return this._pressedKeys.has(key); + get textVertices() { + return this._textVertices; } - wasKeyReleased(key) { - if (this._pressedKeys.has(key)) { - if (!this._previousPressedKeys.has(key)) { - this._previousPressedKeys.add(key); - return true; - } - } else this._previousPressedKeys.delete(key); - return false; + get textIndices() { + return this._textIndices; } - _handleKeyDown(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (!this._pressedKeys.has(key)) this._pressedKeys.add(key); + getLabelMMatrix(index2) { + return this._labelMMatrices[index2]; } - _handleKeyUp(e) { - const keyboardEvent = e; - const key = keyboardEvent.key; - if (this._pressedKeys.has(key)) this._pressedKeys.delete(key); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dneJo":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Log", ()=>Log); -var _mainJs = require("./main.js"); -class Log { - constructor(core){ - this._core = core; - } - write(level, value) { - if (level >= this._core.config.logLevel) switch(level){ - case (0, _mainJs.LogLevel).trace: - console.trace(value); - break; - case (0, _mainJs.LogLevel).debug: - console.debug(value); - break; - case (0, _mainJs.LogLevel).info: - console.info(value); - break; - case (0, _mainJs.LogLevel).warn: - console.warn(value); - break; - case (0, _mainJs.LogLevel).error: - console.error(value); - break; - } + setLabelPositions(index2, value2) { + if (this._labelPositions[index2] != value2) { + this._labelPositions[index2] = value2; + this._hasChanged = true; + } } -} - -},{"./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8FW7c":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Colors", ()=>Colors); -var _glMatrix = require("gl-matrix"); -class Colors { -} -Colors.MediumVioletRed = (0, _glMatrix.vec3).fromValues(0xc7, 0x15, 0x85); -Colors.DeepPink = (0, _glMatrix.vec3).fromValues(0xff, 0x14, 0x93); -Colors.PaleVioletRed = (0, _glMatrix.vec3).fromValues(0xdb, 0x70, 0x93); -Colors.HotPink = (0, _glMatrix.vec3).fromValues(0xff, 0x69, 0xb4); -Colors.LightPink = (0, _glMatrix.vec3).fromValues(0xff, 0xb6, 0xc1); -Colors.Pink = (0, _glMatrix.vec3).fromValues(0xff, 0xc0, 0xcb); -Colors.DarkRed = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x00); -Colors.Red = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0x00); -Colors.Firebrick = (0, _glMatrix.vec3).fromValues(0xb2, 0x22, 0x22); -Colors.Crimson = (0, _glMatrix.vec3).fromValues(0xdc, 0x14, 0x3c); -Colors.IndianRed = (0, _glMatrix.vec3).fromValues(0xcd, 0x5c, 0x5c); -Colors.LightCoral = (0, _glMatrix.vec3).fromValues(0xf0, 0x80, 0x80); -Colors.Salmon = (0, _glMatrix.vec3).fromValues(0xfa, 0x80, 0x72); -Colors.DarkSalmon = (0, _glMatrix.vec3).fromValues(0xe9, 0x96, 0x7a); -Colors.LightSalmon = (0, _glMatrix.vec3).fromValues(0xff, 0xa0, 0x7a); -Colors.OrangeRed = (0, _glMatrix.vec3).fromValues(0xff, 0x45, 0x00); -Colors.Tomato = (0, _glMatrix.vec3).fromValues(0xff, 0x63, 0x47); -Colors.DarkOrange = (0, _glMatrix.vec3).fromValues(0xff, 0x8c, 0x00); -Colors.Coral = (0, _glMatrix.vec3).fromValues(0xff, 0x7f, 0x50); -Colors.Orange = (0, _glMatrix.vec3).fromValues(0xff, 0xa5, 0x00); -Colors.DarkKhaki = (0, _glMatrix.vec3).fromValues(0xbd, 0xb7, 0x6b); -Colors.Gold = (0, _glMatrix.vec3).fromValues(0xff, 0xd7, 0x00); -Colors.Khaki = (0, _glMatrix.vec3).fromValues(0xf0, 0xe6, 0x8c); -Colors.PeachPuff = (0, _glMatrix.vec3).fromValues(0xff, 0xda, 0xb9); -Colors.Yellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0x00); -Colors.PaleGoldenrod = (0, _glMatrix.vec3).fromValues(0xee, 0xe8, 0xaa); -Colors.Moccasin = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xb5); -Colors.PapayaWhip = (0, _glMatrix.vec3).fromValues(0xff, 0xef, 0xd5); -Colors.LightGoldenrodYellow = (0, _glMatrix.vec3).fromValues(0xfa, 0xfa, 0xd2); -Colors.LemonChiffon = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xcd); -Colors.LightYellow = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xe0); -Colors.Maroon = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x00); -Colors.Brown = (0, _glMatrix.vec3).fromValues(0xa5, 0x2a, 0x2a); -Colors.SaddleBrown = (0, _glMatrix.vec3).fromValues(0x8b, 0x45, 0x13); -Colors.Sienna = (0, _glMatrix.vec3).fromValues(0xa0, 0x52, 0x2d); -Colors.Chocolate = (0, _glMatrix.vec3).fromValues(0xd2, 0x69, 0x1e); -Colors.DarkGoldenrod = (0, _glMatrix.vec3).fromValues(0xb8, 0x86, 0x0b); -Colors.Peru = (0, _glMatrix.vec3).fromValues(0xcd, 0x85, 0x3f); -Colors.RosyBrown = (0, _glMatrix.vec3).fromValues(0xbc, 0x8f, 0x8f); -Colors.Goldenrod = (0, _glMatrix.vec3).fromValues(0xda, 0xa5, 0x20); -Colors.SandyBrown = (0, _glMatrix.vec3).fromValues(0xf4, 0xa4, 0x60); -Colors.Tan = (0, _glMatrix.vec3).fromValues(0xd2, 0xb4, 0x8c); -Colors.Burlywood = (0, _glMatrix.vec3).fromValues(0xde, 0xb8, 0x87); -Colors.Wheat = (0, _glMatrix.vec3).fromValues(0xf5, 0xde, 0xb3); -Colors.NavajoWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xde, 0xad); -Colors.Bisque = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xc4); -Colors.BlanchedAlmond = (0, _glMatrix.vec3).fromValues(0xff, 0xeb, 0xcd); -Colors.Cornsilk = (0, _glMatrix.vec3).fromValues(0xff, 0xf8, 0xdc); -Colors.DarkGreen = (0, _glMatrix.vec3).fromValues(0x00, 0x64, 0x00); -Colors.Green = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x00); -Colors.DarkOliveGreen = (0, _glMatrix.vec3).fromValues(0x55, 0x6b, 0x2f); -Colors.ForestGreen = (0, _glMatrix.vec3).fromValues(0x22, 0x8b, 0x22); -Colors.SeaGreen = (0, _glMatrix.vec3).fromValues(0x2e, 0x8b, 0x57); -Colors.Olive = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x00); -Colors.OliveDrab = (0, _glMatrix.vec3).fromValues(0x6b, 0x8e, 0x23); -Colors.MediumSeaGreen = (0, _glMatrix.vec3).fromValues(0x3c, 0xb3, 0x71); -Colors.LimeGreen = (0, _glMatrix.vec3).fromValues(0x32, 0xcd, 0x32); -Colors.Lime = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x00); -Colors.SpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0x7f); -Colors.MediumSpringGreen = (0, _glMatrix.vec3).fromValues(0x00, 0xfa, 0x9a); -Colors.DarkSeaGreen = (0, _glMatrix.vec3).fromValues(0x8f, 0xbc, 0x8f); -Colors.MediumAquamarine = (0, _glMatrix.vec3).fromValues(0x66, 0xcd, 0xaa); -Colors.YellowGreen = (0, _glMatrix.vec3).fromValues(0x9a, 0xcd, 0x32); -Colors.LawnGreen = (0, _glMatrix.vec3).fromValues(0x7c, 0xfc, 0x00); -Colors.Chartreuse = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0x00); -Colors.LightGreen = (0, _glMatrix.vec3).fromValues(0x90, 0xee, 0x90); -Colors.GreenYellow = (0, _glMatrix.vec3).fromValues(0xad, 0xff, 0x2f); -Colors.PaleGreen = (0, _glMatrix.vec3).fromValues(0x98, 0xfb, 0x98); -Colors.Teal = (0, _glMatrix.vec3).fromValues(0x00, 0x80, 0x80); -Colors.DarkCyan = (0, _glMatrix.vec3).fromValues(0x00, 0x8b, 0x8b); -Colors.LightSeaGreen = (0, _glMatrix.vec3).fromValues(0x20, 0xb2, 0xaa); -Colors.CadetBlue = (0, _glMatrix.vec3).fromValues(0x5f, 0x9e, 0xa0); -Colors.DarkTurquoise = (0, _glMatrix.vec3).fromValues(0x00, 0xce, 0xd1); -Colors.MediumTurquoise = (0, _glMatrix.vec3).fromValues(0x48, 0xd1, 0xcc); -Colors.Turquoise = (0, _glMatrix.vec3).fromValues(0x40, 0xe0, 0xd0); -Colors.Aqua = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Cyan = (0, _glMatrix.vec3).fromValues(0x00, 0xff, 0xff); -Colors.Aquamarine = (0, _glMatrix.vec3).fromValues(0x7f, 0xff, 0xd4); -Colors.PaleTurquoise = (0, _glMatrix.vec3).fromValues(0xaf, 0xee, 0xee); -Colors.LightCyan = (0, _glMatrix.vec3).fromValues(0xe0, 0xff, 0xff); -Colors.Navy = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x80); -Colors.DarkBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x8b); -Colors.MediumBlue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xcd); -Colors.Blue = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0xff); -Colors.MidnightBlue = (0, _glMatrix.vec3).fromValues(0x19, 0x19, 0x70); -Colors.RoyalBlue = (0, _glMatrix.vec3).fromValues(0x41, 0x69, 0xe1); -Colors.SteelBlue = (0, _glMatrix.vec3).fromValues(0x46, 0x82, 0xb4); -Colors.DodgerBlue = (0, _glMatrix.vec3).fromValues(0x1e, 0x90, 0xff); -Colors.DeepSkyBlue = (0, _glMatrix.vec3).fromValues(0x00, 0xbf, 0xff); -Colors.CornflowerBlue = (0, _glMatrix.vec3).fromValues(0x64, 0x95, 0xed); -Colors.SkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xeb); -Colors.LightSkyBlue = (0, _glMatrix.vec3).fromValues(0x87, 0xce, 0xfa); -Colors.LightSteelBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xc4, 0xde); -Colors.LightBlue = (0, _glMatrix.vec3).fromValues(0xad, 0xd8, 0xe6); -Colors.PowderBlue = (0, _glMatrix.vec3).fromValues(0xb0, 0xe0, 0xe6); -Colors.Indigo = (0, _glMatrix.vec3).fromValues(0x4b, 0x00, 0x82); -Colors.Purple = (0, _glMatrix.vec3).fromValues(0x80, 0x00, 0x80); -Colors.DarkMagenta = (0, _glMatrix.vec3).fromValues(0x8b, 0x00, 0x8b); -Colors.DarkViolet = (0, _glMatrix.vec3).fromValues(0x94, 0x00, 0xd3); -Colors.DarkSlateBlue = (0, _glMatrix.vec3).fromValues(0x48, 0x3d, 0x8b); -Colors.BlueViolet = (0, _glMatrix.vec3).fromValues(0x8a, 0x2b, 0xe2); -Colors.DarkOrchid = (0, _glMatrix.vec3).fromValues(0x99, 0x32, 0xcc); -Colors.Fuchsia = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.Magenta = (0, _glMatrix.vec3).fromValues(0xff, 0x00, 0xff); -Colors.SlateBlue = (0, _glMatrix.vec3).fromValues(0x6a, 0x5a, 0xcd); -Colors.MediumSlateBlue = (0, _glMatrix.vec3).fromValues(0x7b, 0x68, 0xee); -Colors.MediumOrchid = (0, _glMatrix.vec3).fromValues(0xba, 0x55, 0xd3); -Colors.MediumPurple = (0, _glMatrix.vec3).fromValues(0x93, 0x70, 0xdb); -Colors.Orchid = (0, _glMatrix.vec3).fromValues(0xda, 0x70, 0xd6); -Colors.Violet = (0, _glMatrix.vec3).fromValues(0xee, 0x82, 0xee); -Colors.Plum = (0, _glMatrix.vec3).fromValues(0xdd, 0xa0, 0xdd); -Colors.Thistle = (0, _glMatrix.vec3).fromValues(0xd8, 0xbf, 0xd8); -Colors.Lavender = (0, _glMatrix.vec3).fromValues(0xe6, 0xe6, 0xfa); -Colors.MistyRose = (0, _glMatrix.vec3).fromValues(0xff, 0xe4, 0xe1); -Colors.AntiqueWhite = (0, _glMatrix.vec3).fromValues(0xfa, 0xeb, 0xd7); -Colors.Linen = (0, _glMatrix.vec3).fromValues(0xfa, 0xf0, 0xe6); -Colors.Beige = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xdc); -Colors.WhiteSmoke = (0, _glMatrix.vec3).fromValues(0xf5, 0xf5, 0xf5); -Colors.LavenderBlush = (0, _glMatrix.vec3).fromValues(0xff, 0xf0, 0xf5); -Colors.OldLace = (0, _glMatrix.vec3).fromValues(0xfd, 0xf5, 0xe6); -Colors.AliceBlue = (0, _glMatrix.vec3).fromValues(0xf0, 0xf8, 0xff); -Colors.Seashell = (0, _glMatrix.vec3).fromValues(0xff, 0xf5, 0xee); -Colors.GhostWhite = (0, _glMatrix.vec3).fromValues(0xf8, 0xf8, 0xff); -Colors.Honeydew = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xf0); -Colors.FloralWhite = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xf0); -Colors.Azure = (0, _glMatrix.vec3).fromValues(0xf0, 0xff, 0xff); -Colors.MintCream = (0, _glMatrix.vec3).fromValues(0xf5, 0xff, 0xfa); -Colors.Snow = (0, _glMatrix.vec3).fromValues(0xff, 0xfa, 0xfa); -Colors.Ivory = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xf0); -Colors.White = (0, _glMatrix.vec3).fromValues(0xff, 0xff, 0xff); -Colors.Black = (0, _glMatrix.vec3).fromValues(0x00, 0x00, 0x00); -Colors.DarkSlateGray = (0, _glMatrix.vec3).fromValues(0x2f, 0x4f, 0x4f); -Colors.DimGray = (0, _glMatrix.vec3).fromValues(0x69, 0x69, 0x69); -Colors.SlateGray = (0, _glMatrix.vec3).fromValues(0x70, 0x80, 0x90); -Colors.Gray = (0, _glMatrix.vec3).fromValues(0x80, 0x80, 0x80); -Colors.LightSlateGray = (0, _glMatrix.vec3).fromValues(0x77, 0x88, 0x99); -Colors.DarkGray = (0, _glMatrix.vec3).fromValues(0xa9, 0xa9, 0xa9); -Colors.Silver = (0, _glMatrix.vec3).fromValues(0xc0, 0xc0, 0xc0); -Colors.LightGray = (0, _glMatrix.vec3).fromValues(0xd3, 0xd3, 0xd3); -Colors.Gainsboro = (0, _glMatrix.vec3).fromValues(0xdc, 0xdc, 0xdc); -Colors.Copper = (0, _glMatrix.vec3).fromValues(0xb8, 0x73, 0x33); -Colors.Bronze = (0, _glMatrix.vec3).fromValues(0xcd, 0x7f, 0x32); -Colors.Steel = (0, _glMatrix.vec3).fromValues(0xce, 0xd2, 0xd7); -Colors.Platinum = (0, _glMatrix.vec3).fromValues(0xe5, 0xe4, 0xe2); -Colors.Gunmetal = (0, _glMatrix.vec3).fromValues(0x5c, 0x5d, 0x5b); -Colors.Titanium = (0, _glMatrix.vec3).fromValues(0x87, 0x86, 0x81); -Colors.RoseGold = (0, _glMatrix.vec3).fromValues(0xcb, 0xa3, 0xb2); -Colors.AquaGlass = (0, _glMatrix.vec3).fromValues(0xd2, 0xe8, 0xdf); -Colors.BlueGlass = (0, _glMatrix.vec3).fromValues(0xc7, 0xe3, 0xe1); - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"edWrj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MapItem", ()=>MapItem); -parcelHelpers.export(exports, "MapVisual", ()=>MapVisual); -parcelHelpers.export(exports, "Map", ()=>Map); -parcelHelpers.export(exports, "MapAtlas", ()=>MapAtlas); -parcelHelpers.export(exports, "MapRasterizer", ()=>MapRasterizer); -parcelHelpers.export(exports, "GeoJSONRasterizer", ()=>GeoJSONRasterizer); -var _mapJs = require("./helpers/map.js"); -var _mainJs = require("./main.js"); -class MapItem { - toJSON() { - return { - key: this.key, - scale: this.scale, - minLat: this.minLat, - maxLat: this.maxLat, - minLon: this.minLon, - maxLon: this.maxLon, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + setLabels(index2, value2) { + if (this._labels[index2] != value2) { + this._labels[index2] = value2; + this._hasChanged = true; + } } -} -class MapVisual { - update() {} - constructor(map){ - this.map = map; + setLabelSizes(index2, value2) { + if (this._labelSizes[index2] != value2) { + this._labelSizes[index2] = value2; + this._hasChanged = true; + } } -} -class Map { - get atlas() { - return this._rasterizer.atlas; + getLabelOrientation(index2) { + return this._orientations[index2]; } - get count() { - return this._keys.size; - } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; - } - add(key) { - if (!this._keys.has(key)) { - if (this._rasterizer.draw(key) !== null) { - this._keys.add(key); - this._hasChanged = true; - } - } + setLabelOrientation(index2, orientation) { + if (this._orientations[index2] != orientation) { + this._orientations[index2] = orientation; + this._hasChanged = true; + } } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); - } + getTitleIndexCount(index2) { + return this._titleIndexCounts[index2]; } - toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); - } - return { - key: this.key, - items: items - }; + getTitleIndexOffset(index2) { + return this._titleIndexOffsets[index2]; } -} -class MapAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class MapRasterizer { - get map() { - return this._map; + getTitleMMatrix(index2) { + return this._titleMMatrices[index2]; } - get atlas() { - return this._atlas; + setTitle(index2, value2) { + if (this._titles[index2] != value2) { + this._titles[index2] = value2; + this._hasChanged = true; + } } - get scale() { - return this._scale; - } - set scale(value) { - this._scale = value; - this._geoJSONRasterizer.scale = value; - } - get geoJSON() { - return this._geoJSON; - } - set geoJSON(value) { - this._geoJSON = value; - this._geoJSONRasterizer.geoJSON = value; - } - get property() { - return this._property; - } - set property(value) { - this._property = value; - this._geoJSONRasterizer.property = value; - } - get mapProjection() { - return this._mapProjection; - } - set mapProjection(value) { - this._mapProjection = value; - this._geoJSONRasterizer.mapProjection = value; - } - get scaleFactor() { - return this._scaleFactor; - } - set scaleFactor(value) { - this._scaleFactor = value; - this._geoJSONRasterizer.scaleFactor = this._scaleFactor; - } - get minLongitude() { - return this._minLogitude; - } - set minLongitude(value) { - this._minLogitude = value; - this._geoJSONRasterizer.minLongitude = this._minLogitude; - } - get maxLongitude() { - return this._maxLongitude; - } - set maxLongitude(value) { - this._maxLongitude = value; - this._geoJSONRasterizer.maxLongitude = this._maxLongitude; - } - get minLatitude() { - return this._minLatitude; - } - set minLatitude(value) { - this._minLatitude = value; - this._geoJSONRasterizer.minLatitude = this._minLatitude; - } - get maxLatitude() { - return this._maxLatitude; - } - set maxLatitude(value) { - this._maxLatitude = value; - this._geoJSONRasterizer.maxLatitude = this._maxLatitude; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._mapProjection = options.mapProjection; - this._map = new Map(core, this); - this._map.key = this._key; - const geoJSONRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance, - geoJSON: this._geoJSON, - scale: this._scale, - property: this._property, - mapProjection: this._mapProjection - }; - this._geoJSONRasterizer = new GeoJSONRasterizer(core, geoJSONRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `map rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key) { - const item = this._geoJSONRasterizer.draw(key); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._map.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._map.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; - } - this._atlas.x += texWidth; - } - return item; + setTitleSize(index2, value2) { + if (this._titleSizes[index2] != value2) { + this._titleSizes[index2] = value2; + this._hasChanged = true; + } } -} -class GeoJSONRasterizer { - get scale() { - return this._scale; + getHeadingIndexCount(index2) { + return this._headingIndexCounts[index2]; + } + getHeadingIndexOffset(index2) { + return this._headingIndexOffsets[index2]; + } + getHeadingMMatrix(index2) { + return this._headingMMatrices[index2]; } - set scale(value) { - this._scale = value; + setHeading(index2, value2) { + if (this._headings[index2] != value2) { + this._headings[index2] = value2; + this._hasChanged = true; + } } - get geoJSON() { - return this._geoJSON; + setHeadingSize(index2, value2) { + if (this._headingSizes[index2] != value2) { + this._headingSizes[index2] = value2; + this._hasChanged = true; + } } - set geoJSON(value) { - this._geoJSON = value; + getIsLeftToRightHorizontal(index2) { + return this._isLeftToRightHorizontal[index2]; } - get property() { - return this._property; + getIsLeftToRightVertical(index2) { + return this._isLeftToRightVertical[index2]; } - set property(value) { - this._property = value; + getAxesLeftToRightIndexCount(index2) { + return this._axesLeftToRightIndexCounts[index2]; } - get mapProjection() { - return this._mapProjection; + getAxesRightToLeftIndexCount(index2) { + return this._axesRightToLeftIndexCounts[index2]; } - set mapProjection(value) { - this._mapProjection = value; + getAxesLeftToRightIndexOffset(index2) { + return this._axesLeftToRightIndexOffsets[index2]; } - get scaleFactor() { - return this._scaleFactor; + getAxesRightToLeftIndexOffset(index2) { + return this._axesRightToLeftIndexOffsets[index2]; } - set scaleFactor(value) { - this._scaleFactor = value; + get gridVertices() { + return this._gridVertices; } - get minLongitude() { - return this._minLongitude; + get gridIndices() { + return this._gridIndices; } - set minLongitude(value) { - this._minLongitude = value; + getGridTicksIndexCount(index2) { + return this._gridTicksIndexCounts[index2]; } - get maxLongitude() { - return this._maxLongitude; + getGridTicksIndexOffset(index2) { + return this._gridTicksIndexOffsets[index2]; } - set maxLongitude(value) { - this._maxLongitude = value; + getGridFaceIndexCount(index2) { + return this._gridFaceIndexCounts[index2]; } - get minLatitude() { - return this._minLatitude; + getGridFaceIndexOffset(index2) { + return this._gridFaceIndexOffsets[index2]; } - set minLatitude(value) { - this._minLatitude = value; + getGridTicksMMatrix(index2) { + return this._gridTicksMMatrices[index2]; } - get maxLatitude() { - return this._maxLatitude; + getGridFaceMMatrix(index2) { + return this._gridFaceMMatrices[index2]; } - set maxLatitude(value) { - this._maxLatitude = value; + getGridTicksScale(index2) { + return this._gridTicksScales[index2]; } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._geoJSON = options.geoJSON; - this._scale = options.scale; - this._property = options.property; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._mapProjection = options.mapProjection; - this._lonLat = [ - 0, - 0 - ]; - this._geoJSONHelper = new (0, _mapJs.GeoJSONHelper)(); - this._core.log.write((0, _mainJs.LogLevel).info, `geoJSON rasterizer ${Math.round(window.performance.now() - start)}ms`); + getGridTicksZero(index2) { + return this._gridTicksZeros[index2]; } - draw(key) { - let feature = this._geoJSONHelper.feature(this._geoJSON, this._property, key); - if (feature) { - let geometry = feature.geometry; - const clip = { - minLon: this._minLongitude, - maxLon: this._maxLongitude, - minLat: this._minLatitude, - maxLat: this._maxLatitude - }; - const bounds = this._geoJSONHelper.bounds(geometry, clip, this._mapProjection); - if (bounds) { - let minX = bounds.minX; - let maxX = bounds.maxX; - let minY = bounds.minY; - let maxY = bounds.maxY; - let sizeX = bounds.maxX - bounds.minX; - let sizeY = bounds.maxY - bounds.minY; - if (sizeX > 0 && sizeY > 0) { - const scale = this._scale * this._scaleFactor; - sizeX = Math.ceil(sizeX * scale); - sizeY = Math.ceil(sizeY * scale); - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new MapItem(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - item.minLon = minX; - item.maxLon = maxX; - item.minLat = minY; - item.maxLat = maxY; - item.scale = this._scaleFactor; - ctx.clearRect(this._border, this._border, sizeX, sizeY); - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.coordinates.length; k++){ - const inner = polygon.coordinates[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - ctx.fillStyle = "black"; - ctx.beginPath(); - this._lonLat[0] = outer[0][0]; - this._lonLat[1] = outer[0][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let k = 1; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - for(let k = 1; k < polygon.length; k++){ - const inner = polygon[k]; - ctx.fillStyle = "transparent"; - ctx.beginPath(); - this._lonLat[0] = inner[0][0]; - this._lonLat[1] = inner[0][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.moveTo(x, y); - for(let l = 1; l < inner.length; l++){ - this._lonLat[0] = inner[l][0]; - this._lonLat[1] = inner[l][1]; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (this._mapProjection) this._mapProjection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - const x = (this._lonLat[0] - minX) * scale - sizeX / 2 + width / 2; - const y = height / 2 - (this._lonLat[1] - minY) * scale + sizeY / 2; - ctx.lineTo(x, y); - } - ctx.fill(); - } - } - break; - } - const imgData = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } - } - } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); - } - return item; - } - } - } - if (!feature) this._core.log.write((0, _mainJs.LogLevel).warn, `geoJSON rasterizer ${key} not found`); - return null; + get gridFaceZero() { + return this._gridFaceZeros; } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./helpers/map.js":"luVrT","./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"luVrT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MercatorHelper", ()=>MercatorHelper); -parcelHelpers.export(exports, "AlbersHelper", ()=>AlbersHelper); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>GeoJSONHelper); -var _mathJs = require("./math.js"); -var _angleJs = require("./angle.js"); -var _constantsJs = require("../constants.js"); -class MercatorHelper { - constructor(){ - this.minLatitude = -85.05112878; - this.maxLatitude = 85.05112878; - this.minLongitude = -180; - this.maxLongitude = 180; - this.minX = -1; - this.minY = -1; - this.maxX = 1; - this.maxY = 1; - } - project(longitude, latitude, xy) { - const x = longitude / 180; - latitude = (0, _mathJs.MathHelper).clamp(latitude, this.minLatitude, this.maxLatitude); - latitude = (0, _angleJs.AngleHelper).degreesToRadians(latitude); - const sinLatitude = Math.sin(latitude); - let y = Math.log((1 + sinLatitude) / (1 - sinLatitude)) / 2; - y = (0, _mathJs.MathHelper).clamp(y / Math.PI, this.minY, this.maxY); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const longitude = x * 180; - y *= Math.PI; - let latitude = (0, _constantsJs.Constants).PI_OVER_TWO - 2 * Math.atan(Math.exp(-y)); - latitude = (0, _angleJs.AngleHelper).radiansToDegrees(latitude); - lonLat[0] = longitude; - lonLat[1] = latitude; - } -} -class AlbersHelper { - constructor(){ - this._phi1 = 29.5; - this._phi2 = 45.5; - this._lat0 = 37.5; - this._lon0 = -96; - } - get standardParallel1() { - return this._phi1; - } - set standardParallel1(value) { - this._phi1 = value; - } - get standardParallel2() { - return this._phi2; - } - set standardParallel2(value) { - this._phi2 = value; - } - get latitudeOfOrigin() { - return this._lat0; - } - set latitudeOfOrigin(value) { - this._lat0 = value; - } - get centralMeridian() { - return this._lon0; - } - set centralMeridian(value) { - this._lon0 = value; - } - project(lon, lat, xy) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - lat = (0, _angleJs.AngleHelper).degreesToRadians(lat); - lon = (0, _angleJs.AngleHelper).degreesToRadians(lon); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - const theta = n * (lon - lon0); - const p = Math.sqrt(C - 2 * n * Math.sin(lat)) / n; - const x = p * Math.sin(theta); - const y = p0 - p * Math.cos(theta); - xy[0] = x; - xy[1] = y; - } - unproject(x, y, lonLat) { - const phi1 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi1); - const phi2 = (0, _angleJs.AngleHelper).degreesToRadians(this._phi2); - const lat0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lat0); - const lon0 = (0, _angleJs.AngleHelper).degreesToRadians(this._lon0); - const n = 0.5 * (Math.sin(phi1) + Math.sin(phi2)); - const c = Math.cos(phi1); - const C = c * c + 2 * n * Math.sin(phi1); - const p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n; - let theta = Math.atan(x / Math.abs(p0 - y) * Math.sign(p0 - y)); - if ((p0 - y) * n < 0) theta -= Math.PI * Math.sign(x) * Math.sign(p0 - y); - const p = Math.sqrt(x * x + Math.pow(p0 - y, 2)); - const lon = lon0 + theta / n; - const lat = Math.asin((C - p * p * n * n) / (2 * n)); - lonLat[0] = (0, _angleJs.AngleHelper).radiansToDegrees(lon); - lonLat[1] = (0, _angleJs.AngleHelper).radiansToDegrees(lat); - } -} -class GeoJSONHelper { - constructor(){ - this._lonLat = [ - 0, - 0 - ]; - } - feature(geoJSON, property, key) { - for(let i = 0; i < geoJSON.features.length; i++){ - let feature = geoJSON.features[i]; - if (feature.properties[property] == key) return feature; - } - return null; + get gridFaceMinorGridlines() { + return this._gridFaceMinorGridlines; } - bounds(geometry, clip, projection) { - let minX = Number.MAX_VALUE; - let maxX = -Number.MAX_VALUE; - let minY = Number.MAX_VALUE; - let maxY = -Number.MAX_VALUE; - switch(geometry.type){ - case "Polygon": - const polygon = geometry; - const outer = polygon.coordinates[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) break; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } - break; - case "MultiPolygon": - const multiPolygon = geometry; - for(let j = 0; j < multiPolygon.coordinates.length; j++){ - const polygon = multiPolygon.coordinates[j]; - const outer = polygon[0]; - for(let k = 0; k < outer.length; k++){ - this._lonLat[0] = outer[k][0]; - this._lonLat[1] = outer[k][1]; - if (this._lonLat[0] < clip.minLon || this._lonLat[0] > clip.maxLon || this._lonLat[1] < clip.minLat || this._lonLat[1] > clip.maxLat) continue; - if (this._lonLat[0] > 0) this._lonLat[0] -= 360; - if (projection) projection.project(this._lonLat[0], this._lonLat[1], this._lonLat); - minX = Math.min(minX, this._lonLat[0]); - maxX = Math.max(maxX, this._lonLat[0]); - minY = Math.min(minY, this._lonLat[1]); - maxY = Math.max(maxY, this._lonLat[1]); - } + getGridTicksMinorGridlines(index2) { + return this._gridTicksMinorGridlines[index2]; + } + setTickPositions(index2, value2) { + if (this._gridTicksPositions[index2] != value2) { + this._gridTicksPositions[index2] = value2; + this._hasChanged = true; + } + } + get scalingX() { + return this._scalingX; + } + set scalingX(value2) { + if (value2 != this._scalingX) { + this._scalingX = value2; + this._hasChanged = true; + } + } + get scalingY() { + return this._scalingY; + } + set scalingY(value2) { + if (value2 != this._scalingY) { + this._scalingY = value2; + this._hasChanged = true; + } + } + get offsetX() { + return this._offset[12]; + } + set offsetX(value2) { + if (value2 != this._offset[12]) { + this._offset[12] = value2; + } + } + get offsetY() { + return this._offset[13]; + } + set offsetY(value2) { + if (value2 != this._offset[13]) { + this._offset[13] = value2; + } + } + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._rMatrix = create$4(); + fromQuat(this._rMatrix, value2); + } + } + constructor(core) { + super(core); + this._size = create$3(); + this._translation = create$3(); + this._normal = create$3(); + this._forward = create$3(); + this._right = create$3(); + this._up = create$3(); + this._texCoord = create(); + this._bounds = create$2(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mat3 = create$5(); + this._isDiscrete = [false, false]; + this._minBoundsX = 0; + this._minBoundsY = 0; + this._maxBoundsX = 0; + this._maxBoundsY = 0; + this._isForwardFace = []; + this._isForwardEdge = []; + this._isOutsideEdge = []; + for (let i = 0; i < 2; i++) { + this._isForwardFace.push(false); + } + for (let i = 0; i < 4; i++) { + this._isForwardEdge.push(false); + this._isOutsideEdge.push(false); + } + this._textOffset = create$3(); + this._textPosition = create$3(); + this._distances = []; + for (let i = 0; i < 4; i++) { + this._distances.push(0); + } + this._labelPositions = []; + this._labels = []; + this._labelSizes = []; + this._maxLabelSize = []; + this._axesLeftToRightIndexCounts = []; + this._axesRightToLeftIndexCounts = []; + this._axesLeftToRightIndexOffsets = []; + this._axesRightToLeftIndexOffsets = []; + this._labelMMatrices = []; + this._orientations = []; + for (let i = 0; i < 2; i++) { + this._maxLabelSize.push(create()); + this._orientations.push(AxesTextOrientation.parallel); + this._axesLeftToRightIndexCounts.push(0); + this._axesRightToLeftIndexCounts.push(0); + this._axesLeftToRightIndexOffsets.push(0); + this._axesRightToLeftIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._labelMMatrices.push(create$4()); + } + this._titles = []; + this._titleSizes = []; + this._titleIndexCounts = []; + this._titleIndexOffsets = []; + this._titleMMatrices = []; + for (let i = 0; i < 2; i++) { + this._titles.push(null); + this._titleSizes.push(core.config.axesTextTitleSize); + this._titleIndexCounts.push(0); + this._titleIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._titleMMatrices.push(create$4()); + } + this._headings = []; + this._headingSizes = []; + this._headingIndexCounts = []; + this._headingIndexOffsets = []; + this._headingMMatrices = []; + this.isHeadingVisible = []; + for (let i = 0; i < 2; i++) { + this._headings.push(null); + this._headingSizes.push(core.config.axesTextHeadingSize); + this._headingIndexCounts.push(0); + this._headingIndexOffsets.push(0); + } + for (let i = 0; i < 4; i++) { + this._headingMMatrices.push(create$4()); + this.isHeadingVisible.push(true); + } + this.isEdgeVisible = []; + this._edgePosition = create$3(); + this._edgePositive = create$3(); + this._edgeNormal = create$3(); + this._edgeNormalTemp = create$3(); + this._edgePositiveTemp = create$3(); + this._isLeftToRightHorizontal = []; + this._isLeftToRightVertical = []; + this._edgeHorizontalRight = []; + this._edgeHorizontalUp = []; + this._edgeHorizontalForward = []; + this._edgeVerticalRight = []; + this._edgeVerticalUp = []; + this._edgeVerticalForward = []; + for (let i = 0; i < 4; i++) { + this.isEdgeVisible.push(true); + this._isLeftToRightHorizontal.push(false); + this._isLeftToRightVertical.push(false); + this._edgeHorizontalRight.push(create$3()); + this._edgeHorizontalUp.push(create$3()); + this._edgeHorizontalForward.push(create$3()); + this._edgeVerticalRight.push(create$3()); + this._edgeVerticalUp.push(create$3()); + this._edgeVerticalForward.push(create$3()); + } + this.isFaceVisible = []; + for (let i = 0; i < 2; i++) { + this.isFaceVisible.push(true); + } + this.arePickDivisionsVisible = []; + this.areFacesVisible = []; + this._indexTemplate = Quad$2.INDICES; + this.zero = create$3(); + this._gridTicksZeros = []; + this._gridFaceZeros = create(); + this.minorGridlines = fromValues$3(1, 1, 1); + this._gridTicksMinorGridlines = []; + this._gridFaceMinorGridlines = create(); + this._gridTicksPositions = []; + this._gridTicksScales = []; + this._gridTicksIndexCounts = []; + this._gridTicksIndexOffsets = []; + this._gridFaceScale = create$3(); + this._gridFaceIndexCounts = []; + this._gridFaceIndexOffsets = []; + this._gridFaceMMatrices = []; + this._gridTicksMMatrices = []; + this._gridTicksRotations = []; + for (let i = 0; i < 2; i++) { + this.arePickDivisionsVisible.push(true); + this.areFacesVisible.push(true); + this._gridTicksZeros.push(create()); + this._gridTicksMinorGridlines.push(create()); + this._gridTicksScales.push(create$3()); + this._gridTicksIndexCounts.push(0); + this._gridTicksIndexOffsets.push(0); + this._gridFaceIndexCounts.push(0); + this._gridFaceIndexOffsets.push(0); + this._gridFaceMMatrices.push(create$4()); + } + for (let i = 0; i < 4; i++) { + this._gridTicksMMatrices.push(create$4()); + this._gridTicksRotations.push(create$4()); + const _mat4 = this._gridTicksRotations[i]; + _mat4[0] = Quad$2.EDGE_POSITIVES[i][0]; + _mat4[1] = Quad$2.EDGE_POSITIVES[i][1]; + _mat4[2] = Quad$2.EDGE_POSITIVES[i][2]; + _mat4[4] = Quad$2.EDGE_NORMALS[i][0]; + _mat4[5] = Quad$2.EDGE_NORMALS[i][1]; + _mat4[6] = Quad$2.EDGE_NORMALS[i][2]; + cross(this._vec3, Quad$2.EDGE_POSITIVES[i], Quad$2.EDGE_NORMALS[i]); + _mat4[8] = this._vec3[0]; + _mat4[9] = this._vec3[1]; + _mat4[10] = this._vec3[2]; + } + this._fromValues = [null, null]; + this._toValues = [null, null]; + this.isDivisionPickingEnabled = [false, false]; + this.isLabelPickingEnabled = [false, false]; + this.isTitlePickingEnabled = [false, false]; + this.isHeadingPickingEnabled = [false, false]; + this.isAxisReversed = [false, false]; + this._scalingX = 1; + this._scalingY = 1; + this._offset = create$4(); + } + initialize() { + this._isInitialized = true; + } + update(elapsedTime) { + if (this.isInitialized) { + if (this._hasChanged) { + const start = window.performance.now(); + this._hasChanged = false; + set$3(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, 0); + const maxBounds = Math.max(this._size[0], this._size[1]); + this._size[0] *= this._scalingX / maxBounds; + this._size[1] *= this._scalingY / maxBounds; + this._updateGrids(this._size); + this._updateText(this._size); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + this._core.log.write(LogLevel.info, `cartesian2d updated ${Math.round(window.performance.now() - start)}ms`); + } + if (this._rMatrix) { + mul(this._mMatrix, this.mMatrix, this._rMatrix); + mul(this._mMatrix, this._mMatrix, this._offset); + } else { + multiply$2(this._mMatrix, this.mMatrix, this._offset); + } + this._mvMatrix = create$4(); + multiply$2(this._mvMatrix, this._vMatrix, this._mMatrix); + fromMat4(this._mat3, this._mvMatrix); + for (let faceId = 0; faceId < 2; faceId++) { + transformMat4$2(this._forward, Constants.VECTOR3_ZERO, this._mvMatrix); + transformMat3(this._normal, Quad$2.FACE_NORMALS[faceId], this._mat3); + this._isForwardFace[faceId] = dot$1(this._normal, this._forward) > 0; + } + this._forward[0] = this._mat3[2]; + this._forward[1] = this._mat3[5]; + this._forward[2] = this._mat3[8]; + for (let edgeId = 0; edgeId < 4; edgeId++) { + this._isForwardEdge[edgeId] = dot$1(Quad$2.EDGE_FORWARDS[edgeId], this._forward) < 0; + this._distances[edgeId] = 0; + } + for (let axisId = 0; axisId < 2; axisId++) { + if (this.arePickDivisionsVisible[axisId]) { + set(this._gridTicksZeros[axisId], this.zero[axisId], -1); + set(this._gridTicksMinorGridlines[axisId], this.minorGridlines[axisId], 1); + const gridTicksScale = this._gridTicksScales[axisId]; + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (this.isEdgeVisible[edgeId]) { + let distance2 = this._distances[edgeId]; + distance2 += this._gridPickDivisionHeight * 0.5; + const gridTicksMMatrix = this._gridTicksMMatrices[edgeId]; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + translate(gridTicksMMatrix, this._mMatrix, this._vec3); + multiply$2(gridTicksMMatrix, gridTicksMMatrix, this._gridTicksRotations[edgeId]); + if (!this._isForwardEdge[edgeId]) { + scale$1(gridTicksMMatrix, gridTicksMMatrix, Constants.VECTOR3_REFLECTX); } - break; - } - if (minX == Number.MAX_VALUE) { - minX = 0; - maxX = 0; - minY = 0; - maxY = 0; + scale$1(gridTicksMMatrix, gridTicksMMatrix, gridTicksScale); + distance2 += this._gridPickDivisionHeight * 0.5; + this._distances[edgeId] = distance2; + } + } + } + } + set(this._gridFaceZeros, this.zero[0], this.zero[1]); + set(this._gridFaceMinorGridlines, this.minorGridlines[0], this.minorGridlines[1]); + for (let faceId = 0; faceId < 2; faceId++) { + if (this._isForwardFace[faceId]) { + const gridFaceMMatrix = this._gridFaceMMatrices[faceId]; + scale$1(gridFaceMMatrix, this._mMatrix, this._gridFaceScale); + } + } + for (let axisId = 0; axisId < 2; axisId++) { + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + multiply$1(this._edgePosition, Quad$2.EDGE_POSITIONS[edgeId], this._size); + transformMat4$2(this._edgePosition, this._edgePosition, this._mvMatrix); + normalize$2(this._forward, this._edgePosition); + negate(this._forward, this._forward); + cross(this._right, Constants.VECTOR3_UNITY, this._forward); + normalize$2(this._right, this._right); + cross(this._up, this._forward, this._right); + transformMat3(this._edgeNormal, Quad$2.EDGE_NORMALS[edgeId], this._mat3); + transformMat3(this._edgePositive, Quad$2.EDGE_POSITIVES[edgeId], this._mat3); + copy$3(this._edgeNormalTemp, this._edgeNormal); + copy$3(this._edgePositiveTemp, this._edgePositive); + const edgeHorizontalRight = this._edgeHorizontalRight[edgeId]; + const edgeHorizontalUp = this._edgeHorizontalUp[edgeId]; + const edgeHorizontalForward = this._edgeHorizontalForward[edgeId]; + if (dot$1(this._edgeNormalTemp, this._up) > 0) { + copy$3(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + } else { + negate(edgeHorizontalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormalTemp, this._edgeNormalTemp); + } + if (dot$1(this._edgePositiveTemp, this._right) > 0) { + this._isLeftToRightHorizontal[edgeId] = true; + copy$3(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightHorizontal[edgeId] = false; + negate(edgeHorizontalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositiveTemp, this._edgePositiveTemp); + } + cross(edgeHorizontalForward, this._edgePositiveTemp, this._edgeNormalTemp); + if (dot$1(edgeHorizontalForward, this._forward) < 0) { + this._isLeftToRightHorizontal[edgeId] = !this._isLeftToRightHorizontal[edgeId]; + negate(edgeHorizontalRight, edgeHorizontalRight); + } + cross(edgeHorizontalForward, edgeHorizontalRight, edgeHorizontalUp); + const edgeVerticalRight = this._edgeVerticalRight[edgeId]; + const edgeVerticalUp = this._edgeVerticalUp[edgeId]; + const edgeVerticalForward = this._edgeVerticalForward[edgeId]; + if (dot$1(this._edgeNormal, this._right) < 0) { + copy$3(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + } else { + negate(edgeVerticalUp, Quad$2.EDGE_NORMALS[edgeId]); + negate(this._edgeNormal, this._edgeNormal); + } + if (dot$1(this._edgePositive, this._up) < 0) { + this._isLeftToRightVertical[edgeId] = true; + copy$3(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + } else { + this._isLeftToRightVertical[edgeId] = false; + negate(edgeVerticalRight, Quad$2.EDGE_POSITIVES[edgeId]); + negate(this._edgePositive, this._edgePositive); + } + cross(edgeVerticalForward, this._edgePositive, this._edgeNormal); + if (dot$1(edgeVerticalForward, this._forward) < 0) { + this._isLeftToRightVertical[edgeId] = !this._isLeftToRightVertical[edgeId]; + negate(edgeVerticalRight, edgeVerticalRight); + } + cross(edgeVerticalForward, edgeVerticalRight, edgeVerticalUp); + if (this.isEdgeVisible[edgeId]) { + if (this._labels[axisId]) { + this._updateLabels(axisId, edgeId); + } + if (this._titles[axisId]) { + this._updateTitle(axisId, edgeId); + } + } + if (this.isHeadingVisible[edgeId]) { + this._updateHeading(axisId, edgeId); + } + } } - return { - minX: minX, - maxX: maxX, - minY: minY, - maxY: maxY - }; - } -} - -},{"./math.js":"6Lv1i","./angle.js":"hBXkO","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6zd9W":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Icon", ()=>Icon); -parcelHelpers.export(exports, "IconsVisual", ()=>IconsVisual); -parcelHelpers.export(exports, "Icons", ()=>Icons); -parcelHelpers.export(exports, "IconsAtlas", ()=>IconsAtlas); -parcelHelpers.export(exports, "IconsRasterizer", ()=>IconsRasterizer); -parcelHelpers.export(exports, "IconRasterizer", ()=>IconRasterizer); -var _mainJs = require("./main.js"); -class Icon { - toJSON() { - return { - key: this.key, - u0: this.u0, - v0: this.v0, - u1: this.u1, - v1: this.v1 - }; + } } -} -class IconsVisual { - update() {} - constructor(icons){ - this.icons = icons; + _updateLabels(axisId, edgeId) { + const orientation = this._orientations[axisId]; + let distance2 = this._distances[edgeId]; + let maxLabelSize = this._maxLabelSize[axisId][1]; + if (orientation == AxesTextOrientation.parallel) + maxLabelSize *= this._core.config.axesTextLabelLineHeight; + distance2 += maxLabelSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + const labelMMatrix = this._labelMMatrices[edgeId]; + labelMMatrix[12] = this._vec3[0]; + labelMMatrix[13] = this._vec3[1]; + labelMMatrix[14] = this._vec3[2]; + if (orientation == AxesTextOrientation.parallel) { + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } else { + const right = this._edgeVerticalRight[edgeId]; + const up = this._edgeVerticalUp[edgeId]; + const forward = this._edgeVerticalForward[edgeId]; + labelMMatrix[0] = right[0]; + labelMMatrix[1] = right[1]; + labelMMatrix[2] = right[2]; + labelMMatrix[4] = up[0]; + labelMMatrix[5] = up[1]; + labelMMatrix[6] = up[2]; + labelMMatrix[8] = forward[0]; + labelMMatrix[9] = forward[1]; + labelMMatrix[10] = forward[2]; + } + multiply$2(labelMMatrix, this._mMatrix, labelMMatrix); + if (orientation == AxesTextOrientation.perpendicular) { + multiply$2(labelMMatrix, labelMMatrix, Constants.MAT4_ROTATION_MINUS_90); + } + distance2 += maxLabelSize * 0.5; + this._distances[edgeId] = distance2; } -} -class Icons { - get atlas() { - return this._rasterizer.atlas; + _updateTitle(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const titleTextSize = this._titleSizes[axisId] * this._core.config.axesTextTitleLineHeight; + distance2 += titleTextSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + const titleMMatrix = this._titleMMatrices[edgeId]; + titleMMatrix[12] = this._vec3[0]; + titleMMatrix[13] = this._vec3[1]; + titleMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + titleMMatrix[0] = right[0]; + titleMMatrix[1] = right[1]; + titleMMatrix[2] = right[2]; + titleMMatrix[4] = up[0]; + titleMMatrix[5] = up[1]; + titleMMatrix[6] = up[2]; + titleMMatrix[8] = forward[0]; + titleMMatrix[9] = forward[1]; + titleMMatrix[10] = forward[2]; + multiply$2(titleMMatrix, this._mMatrix, titleMMatrix); + distance2 += titleTextSize * 0.5; + this._distances[edgeId] = distance2; } - get count() { - return this._keys.size; + _updateHeading(axisId, edgeId) { + let distance2 = this._distances[edgeId]; + const headingTextSize = this._headingSizes[axisId] * this._core.config.axesTextHeadingLineHeight; + distance2 += headingTextSize * 0.5; + multiply$1(this._vec3, Quad$2.EDGE_POSITIONS[edgeId], this._size); + scaleAndAdd(this._vec3, this._vec3, Quad$2.EDGE_NORMALS[edgeId], distance2); + const headingMMatrix = this._headingMMatrices[edgeId]; + headingMMatrix[12] = this._vec3[0]; + headingMMatrix[13] = this._vec3[1]; + headingMMatrix[14] = this._vec3[2]; + const right = this._edgeHorizontalRight[edgeId]; + const up = this._edgeHorizontalUp[edgeId]; + const forward = this._edgeHorizontalForward[edgeId]; + headingMMatrix[0] = right[0]; + headingMMatrix[1] = right[1]; + headingMMatrix[2] = right[2]; + headingMMatrix[4] = up[0]; + headingMMatrix[5] = up[1]; + headingMMatrix[6] = up[2]; + headingMMatrix[8] = forward[0]; + headingMMatrix[9] = forward[1]; + headingMMatrix[10] = forward[2]; + multiply$2(headingMMatrix, this._mMatrix, headingMMatrix); + distance2 += headingTextSize * 0.5; + this._distances[edgeId] = distance2; } - constructor(core, rasterizer){ - this._core = core; - this._rasterizer = rasterizer; - this._keys = new Set(); - this._previousSize = 0; - this.items = {}; + _updateGrids(size) { + let offset2 = 0; + this.pickGridLookup = {}; + this._pickGrid = []; + const xDivisions = this._gridTicksPositions[0] ? this._gridTicksPositions[0].length - 1 : 0; + const yDivisions = this._gridTicksPositions[1] ? this._gridTicksPositions[1].length - 1 : 0; + const count2 = 2 * (xDivisions * yDivisions) + xDivisions + yDivisions; + const byteLength = PickGridVertex.SIZE_BYTES * count2 * 4; + if (!this._gridVertices || this._gridVertices.byteLength < byteLength) { + this._gridVertices = new ArrayBuffer(byteLength); + this._gridVerticesView = new DataView(this._gridVertices); + this._gridIndices = new Uint16Array(count2 * 6); + } + for (let axisId2 = 0; axisId2 < 2; axisId2++) { + const width2 = size[axisId2]; + set$3(this._gridTicksScales[axisId2], width2, this._gridPickDivisionHeight, 1); + offset2 = this._updateGridTicks(axisId2, this._gridVerticesView, this._gridIndices, offset2); + this._gridFaceScale[axisId2] = size[axisId2] == 0 ? 1 : size[axisId2]; + } + const axisId = 2; + this._gridFaceScale[axisId] = 1; + for (let faceId = 0; faceId < 2; faceId++) { + offset2 = this._updateGridFace(axisId, faceId, this._gridVerticesView, this._gridIndices, offset2); + } } - add(key, imgData) { - if (!this._keys.has(key)) { - this._keys.add(key); - this._rasterizer.draw(key, imgData); + _updateText(size) { + let glyphOffset = 0; + let count2 = 0; + for (let axisId = 0; axisId < 2; axisId++) { + const labels = this._labels[axisId]; + if (labels) { + for (let i = 0; i < labels.length; i++) { + count2 += 2 * Math.min(labels[i].length, this._core.config.axesTextLabelMaxGlyphs); + } + } + const title = this._titles[axisId]; + if (title) { + count2 += Math.min(title.length, this._core.config.axesTextTitleMaxGlyphs); + } + const heading = this._headings[axisId]; + if (heading) { + count2 += Math.min(heading.length, this._core.config.axesTextHeadingMaxGlyphs); } - } - update() { - if (this._hasChanged) { - this._hasChanged = false; - this._core.log.write((0, _mainJs.LogLevel).info, `${this.key} added ${this._keys.size - this._previousSize} new items`); - this._previousSize = this._keys.size; - if (this.hasChangedCallback) this.hasChangedCallback(); + } + const byteLength = PositionTexturePickVertex.SIZE_BYTES * count2 * 4; + if (!this._textVertices || this._textVertices.byteLength < byteLength) { + this._textVertices = new ArrayBuffer(byteLength); + this._textVerticesView = new DataView(this._textVertices); + this._textIndices = new Uint16Array(count2 * 6); + } + this.pickLabelLookup = {}; + this._pickLabel = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._labels[axisId]) { + const width2 = size[axisId]; + const maxLabelSize = this._maxLabelSize[axisId]; + const orientation = this._orientations[axisId]; + set(maxLabelSize, 0, 0); + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateLeftToRightAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesLeftToRightIndexCounts[axisId] = glyphOffset * 6 - this._axesLeftToRightIndexOffsets[axisId]; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + glyphOffset = this._updateRightToLeftAxisLabels(axisId, width2, maxLabelSize, glyphOffset, orientation, this._labels[axisId], this._labelPositions[axisId], this._labelSizes[axisId]); + this._axesRightToLeftIndexCounts[axisId] = glyphOffset * 6 - this._axesRightToLeftIndexOffsets[axisId]; + } else { + this._axesLeftToRightIndexOffsets[axisId] = glyphOffset * 6; + this._axesRightToLeftIndexOffsets[axisId] = glyphOffset * 6; + this._axesLeftToRightIndexCounts[axisId] = 0; + this._axesRightToLeftIndexCounts[axisId] = 0; + this._maxLabelSize[axisId][0] = 0; + this._maxLabelSize[axisId][1] = 0; } - } - toJSON() { - const items = []; - for(let key in this.items){ - const item = this.items[key]; - items.push(item.toJSON()); + } + this.pickTitleLookup = {}; + this._pickTitle = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._titles[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._titleIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._titles[axisId], this._core.config.axesTextTitleMaxGlyphs); + const scale2 = this._titleSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesTitle, this._vec4); + this.pickTitleLookup[pickId] = this._pickTitle.length; + this._pickTitle.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._titleIndexCounts[axisId] = glyphOffset * 6 - this._titleIndexOffsets[axisId]; + } else { + this._titleIndexOffsets[axisId] = glyphOffset * 6; + this._titleIndexCounts[axisId] = 0; } - return { - key: this.key, - items: items - }; - } -} -class IconsAtlas { - constructor(width, height){ - const canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - const context = canvas.getContext("2d"); - context.clearRect(0, 0, width, height); - this.imageData = context.getImageData(0, 0, width, height); - this.x = 0; - this.top = new Uint16Array(width); - } -} -class IconsRasterizer { - get icons() { - return this._icons; + } + this.pickHeadingLookup = {}; + this._pickHeading = []; + for (let axisId = 0; axisId < 2; axisId++) { + if (this._headings[axisId]) { + set$3(this._textPosition, 0, 0, 0); + set$3(this._textOffset, 0, 0, 0); + this._headingIndexOffsets[axisId] = glyphOffset * 6; + const text2 = TextHelper.truncate(this._headings[axisId], this._core.config.axesTextHeadingMaxGlyphs); + const scale2 = this._headingSizes[axisId] / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const lineHeight2 = this._font.size * scale2; + this._textOffset[0] -= width2 / 2; + this._textOffset[1] -= (lineHeight2 - maxGlyphTop) / 2; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesHeading, this._vec4); + this.pickHeadingLookup[pickId] = this._pickHeading.length; + this._pickHeading.push(axisId); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + this._headingIndexCounts[axisId] = glyphOffset * 6 - this._headingIndexOffsets[axisId]; + } else { + this._headingIndexOffsets[axisId] = glyphOffset * 6; + this._headingIndexCounts[axisId] = 0; + } + } } - get atlas() { - return this._atlas; - } - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._atlas = options.atlas; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._key = options.key; - this._icons = new Icons(core, this); - this._icons.key = this._key; - const iconRasterizerOptions = { - border: this._border, - edgeValue: this._edgeValue, - maxDistance: this._maxDistance - }; - this._iconRasterizer = new IconRasterizer(core, iconRasterizerOptions); - this._core.log.write((0, _mainJs.LogLevel).info, `icons rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData) { - const item = this._iconRasterizer.draw(key, imgData); - if (item) { - const texWidth = item.width + 2 * this._border; - const texHeight = item.height + 2 * this._border; - const width = this._atlas.imageData.width; - const height = this.atlas.imageData.height; - if (this._atlas.x + texWidth > width - 1) this._atlas.x = 0; - let y = 0; - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)y = Math.max(y, this._atlas.top[x]); - if (y + texHeight > height - 1) this._core.log.write((0, _mainJs.LogLevel).warn, `${this._icons.key} height overflow`); - for(let x = this._atlas.x; x < this._atlas.x + texWidth; x++)this._atlas.top[x] = y + texHeight; - const halfTexelOffsetX = 0.5 / width; - const halfTexelOffsetY = 0.5 / height; - item.u0 = this._atlas.x / width + halfTexelOffsetX; - item.v0 = y / height + halfTexelOffsetY; - item.u1 = (this._atlas.x + texWidth) / width - halfTexelOffsetX; - item.v1 = (y + texHeight) / height - halfTexelOffsetY; - this._icons.items[key] = item; - for(let i = 0; i < item.distances.length; i++){ - const distance = item.distances[i]; - const dataX = i % texWidth; - const dataY = Math.floor(i / texWidth); - const offset = (this._atlas.x + dataX + (y + dataY) * width) * 4; - this._atlas.imageData.data[offset + 0] = distance; - this._atlas.imageData.data[offset + 1] = distance; - this._atlas.imageData.data[offset + 2] = distance; - this._atlas.imageData.data[offset + 3] = 0xff; + _updateLeftToRightAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (position2 - 0.5) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = position2 == 0 ? 0 : position2 == 1 ? -width2 : -width2 / 2; } - this._atlas.x += texWidth; - } - } -} -class IconRasterizer { - constructor(core, options){ - let start = performance.now(); - this._core = core; - this._border = options.border; - this._maxDistance = options.maxDistance; - this._edgeValue = options.edgeValue; - this._core.log.write((0, _mainJs.LogLevel).info, `icon rasterizer ${Math.round(window.performance.now() - start)}ms`); - } - draw(key, imgData0) { - const sizeX = imgData0.width; - const sizeY = imgData0.height; - const canvas = document.createElement("canvas"); - const width = sizeX + 2 * this._border; - const height = sizeY + 2 * this._border; - canvas.width = width; - canvas.height = height; - let length = width * height; - this._gridOuter = new Float64Array(length); - this._gridInner = new Float64Array(length); - length = Math.max(width, height); - this._f = new Float64Array(length); - this._z = new Float64Array(length + 1); - this._v = new Uint16Array(length); - length = width * height; - const distances = new Uint8ClampedArray(length); - const gradientsX = new Uint8ClampedArray(length); - const gradientsY = new Uint8ClampedArray(length); - const pixels = new Uint8ClampedArray(length); - const item = new Icon(); - item.key = key; - item.distances = distances; - item.gradientsX = gradientsX; - item.gradientsY = gradientsY; - item.pixels = pixels; - item.width = sizeX; - item.height = sizeY; - const ctx = canvas.getContext("2d", { - willReadFrequently: true - }); - ctx.clearRect(this._border, this._border, sizeX, sizeY); - ctx.putImageData(imgData0, this._border, this._border); - const imgData1 = ctx.getImageData(this._border, this._border, sizeX, sizeY); - for(let i = 0; i < length; i++){ - this._gridOuter[i] = Number.MAX_VALUE; - this._gridInner[i] = 0; - } - for(let y = 0; y < sizeY; y++)for(let x = 0; x < sizeX; x++){ - const a = imgData1.data[4 * (y * sizeX + x) + 3] / 0xff; - if (a > 0) { - const j = (y + this._border) * width + x + this._border; - if (a == 1) { - this._gridOuter[j] = 0; - this._gridInner[j] = Number.MAX_VALUE; - pixels[j] = 0xff; - } else { - const d = 0.5 - a; - this._gridOuter[j] = d > 0 ? d * d : 0; - this._gridInner[j] = d < 0 ? d * d : 0; - } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + maxSize[0] = Math.max(width2, maxSize[0]); + maxSize[1] = Math.max(lineHeight2, maxSize[1]); + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (position2 - 0.5) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = position2 == 0 ? 0 : position2 == 1 ? -maxGlyphTop : -maxGlyphTop / 2; } + maxSize[0] = Math.max(lineHeight2, maxSize[0]); + maxSize[1] = Math.max(width2, maxSize[1]); + break; } - this._edt(this._gridOuter, 0, 0, width, height, width, this._f, this._v, this._z); - this._edt(this._gridInner, this._border, this._border, sizeX, sizeY, width, this._f, this._v, this._z); - const distances2 = new Float32Array(length); - for(let i = 0; i < length; i++){ - const distance = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); - distances[i] = Math.round(this._edgeValue - distance * 0xff / this._maxDistance); - distances2[i] = distance; - } - for(let i = 0; i < length; i++){ - const x = i % width; - const y = Math.floor(i / width); - const d = distances2[i]; - const sign = d < 0 ? -1 : 1; - const x0 = x > 0 ? distances2[i - 1] : Number.MAX_VALUE; - const x1 = x < width - 1 ? distances2[i + 1] : Number.MAX_VALUE; - const y0 = y > 0 ? distances2[i - width] : Number.MAX_VALUE; - const y1 = y < height - 1 ? distances2[i + width] : Number.MAX_VALUE; - let gradientX = sign * x0 < sign * x1 ? d - x0 : x1 - d; - let gradientY = sign * y0 < sign * y1 ? y0 - d : d - y1; - gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 0xff); - gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 0xff); + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; + } + _updateRightToLeftAxisLabels(axisId, size, maxSize, glyphOffset, orientation, labels, positions, scales2) { + const isAxisReversed = this.isAxisReversed[axisId]; + for (let label2 = 0; label2 < labels.length; label2++) { + const text2 = TextHelper.truncate(labels[label2], this._core.config.axesTextLabelMaxGlyphs); + const lineHeight2 = scales2[label2]; + const scale2 = lineHeight2 / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const maxGlyphTop = this._textMetric.maxTop * scale2; + const position2 = isAxisReversed ? 1 - positions[label2] : positions[label2]; + switch (orientation) { + case AxesTextOrientation.parallel: + set$3(this._textPosition, (0.5 - position2) * size, 0, 0); + if (this._isDiscrete[axisId]) { + this._textOffset[0] = -width2 / 2; + } else { + this._textOffset[0] = label2 == 0 ? -width2 : label2 == labels.length - 1 ? 0 : -width2 / 2; + } + this._textOffset[1] = (maxGlyphTop - lineHeight2) / 2; + break; + case AxesTextOrientation.perpendicular: + set$3(this._textPosition, 0, (0.5 - position2) * size, 0); + this._textOffset[0] = -width2 / 2; + if (this._isDiscrete[axisId]) { + this._textOffset[1] = -maxGlyphTop / 2; + } else { + this._textOffset[1] = label2 == 0 ? -maxGlyphTop : label2 == labels.length - 1 ? 0 : -maxGlyphTop / 2; + } + break; } - return item; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesLabel, this._vec4); + this.pickLabelLookup[pickId] = this._pickLabel.length / 2; + this._pickLabel.push(axisId); + this._pickLabel.push(label2); + TextHelper.addString(this._font, text2, this._textVerticesView, this._textIndices, glyphOffset, this._textPosition, scale2, this._textOffset, null, this._vec4); + glyphOffset += text2.length; + } + return glyphOffset; } - _edt(data, x0, y0, width, height, gridSize, f, v, z) { - for(let x = x0; x < x0 + width; x++)this._edt1d(data, y0 * gridSize + x, gridSize, height, f, v, z); - for(let y = y0; y < y0 + height; y++)this._edt1d(data, y * gridSize + x0, 1, width, f, v, z); - } - _edt1d(grid, offset, stride, n, f, v, z) { - v[0] = 0; - z[0] = -Number.MAX_VALUE; - z[1] = Number.MAX_VALUE; - f[0] = grid[offset]; - for(let q = 1, k = 0, s = 0; q < n; q++){ - f[q] = grid[offset + q * stride]; - const q2 = q * q; - do { - const r = v[k]; - s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; - }while (s <= z[k] && --k > -1); - k++; - v[k] = q; - z[k] = s; - z[k + 1] = Number.MAX_VALUE; - } - for(let q = 0, k = 0; q < n; q++){ - while(z[k + 1] < q)k++; - const r = v[k]; - const qr = q - r; - grid[offset + q * stride] = f[r] + qr * qr; - } - } -} - -},{"./main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9pN13":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Controller", ()=>(0, _controllerJs.Controller)); -parcelHelpers.export(exports, "ControllerVisual", ()=>(0, _controllerJs.ControllerVisual)); -parcelHelpers.export(exports, "Label", ()=>(0, _labelsJs.Label)); -parcelHelpers.export(exports, "LabelVisual", ()=>(0, _labelsJs.LabelVisual)); -parcelHelpers.export(exports, "LabelSet", ()=>(0, _labelsJs.LabelSet)); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>(0, _labelsJs.TransitionLabelSet)); -parcelHelpers.export(exports, "LabelSetVisual", ()=>(0, _labelsJs.LabelSetVisual)); -parcelHelpers.export(exports, "ImageVisual", ()=>(0, _imageJs.ImageVisual)); -parcelHelpers.export(exports, "ImageQuad", ()=>(0, _imageJs.ImageQuad)); -parcelHelpers.export(exports, "ImageSphere", ()=>(0, _imageJs.ImageSphere)); -parcelHelpers.export(exports, "NominalKey", ()=>(0, _keysJs.NominalKey)); -var _controllerJs = require("./controller.js"); -var _labelsJs = require("./labels.js"); -var _imageJs = require("./image.js"); -var _keysJs = require("./keys.js"); - -},{"./controller.js":"3tuGu","./labels.js":"dXJPK","./image.js":"eexvE","./keys.js":"6qIGL","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dXJPK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -parcelHelpers.export(exports, "LabelBase", ()=>LabelBase); -parcelHelpers.export(exports, "Label", ()=>Label); -parcelHelpers.export(exports, "LabelSet", ()=>LabelSet); -parcelHelpers.export(exports, "TransitionLabelSet", ()=>TransitionLabelSet); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _constantsJs = require("../constants.js"); -var _vertexJs = require("../vertex.js"); -var _pickJs = require("../helpers/pick.js"); -var _mathJs = require("../helpers/math.js"); -class LabelVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(label){ - this.label = label; - } -} -class LabelSetVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(labelSet){ - this.label = labelSet; - } -} -class LabelBase { - get material() { - return this._material; + _updateGridTicks(axisId, dataView, indices, offset2) { + this._gridTicksIndexOffsets[axisId] = offset2 * 6; + if (this._gridTicksPositions[axisId]) { + const axes = create$3(); + const positions = this._gridTicksPositions[axisId]; + const isAxisReversed = this.isAxisReversed[axisId]; + let vertexOffset = offset2 * 4; + for (let position2 = 0; position2 < positions.length - 1; position2++) { + const left = isAxisReversed ? 1 - positions[position2 + 1] - 0.5 : positions[position2] - 0.5; + const right = isAxisReversed ? 1 - positions[position2] - 0.5 : positions[position2 + 1] - 0.5; + axes[axisId] = position2 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let j = 0; j < this._indexTemplate.length; j++) { + indices[indexOffset++] = this._indexTemplate[j] + vertexOffset; + } + set$2(this._bounds, left + 0.5, 0, right + 0.5, 1); + this._translation[0] = left; + this._translation[1] = 0.5; + this._translation[2] = 0; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 1; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = left; + this._translation[1] = -0.5; + this._texCoord[0] = left + 0.5; + this._texCoord[1] = 0; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[0] = right; + this._texCoord[0] = right + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, Constants.VECTOR3_UNITZ); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } + } + this._gridTicksIndexCounts[axisId] = offset2 * 6 - this._gridTicksIndexOffsets[axisId]; + return offset2; + } + _updateGridFace(axisId, faceId, dataView, indices, offset2) { + set$3(this._translation, 0, 0, 0); + this._gridFaceIndexOffsets[faceId] = offset2 * 6; + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + if (this._gridTicksPositions[axisId2] && this._gridTicksPositions[axisId3]) { + const axes = create$3(); + negate(this._normal, Quad$2.FACE_NORMALS[faceId]); + const positions2 = this._gridTicksPositions[axisId2]; + const positions3 = this._gridTicksPositions[axisId3]; + const isAxisReversed2 = this.isAxisReversed[axisId2]; + const isAxisReversed3 = this.isAxisReversed[axisId3]; + for (let position2 = 0; position2 < positions2.length - 1; position2++) { + const min2 = isAxisReversed2 ? 1 - positions2[position2 + 1] - 0.5 : positions2[position2] - 0.5; + const max2 = isAxisReversed2 ? 1 - positions2[position2] - 0.5 : positions2[position2 + 1] - 0.5; + axes[axisId2] = position2 + 1; + let vertexOffset = offset2 * 4; + for (let position3 = 0; position3 < positions3.length - 1; position3++) { + const min3 = isAxisReversed3 ? 1 - positions3[position3 + 1] - 0.5 : positions3[position3] - 0.5; + const max3 = isAxisReversed3 ? 1 - positions3[position3] - 0.5 : positions3[position3 + 1] - 0.5; + axes[axisId3] = position3 + 1; + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.axesDivision, this._vec4); + this.pickGridLookup[pickId] = this._pickGrid.length / 3; + this._pickGrid.push(axes[0]); + this._pickGrid.push(axes[1]); + this._pickGrid.push(axes[2]); + let indexOffset = offset2 * 6; + for (let i = 0; i < this._indexTemplate.length; i++) { + indices[indexOffset++] = this._indexTemplate[i] + vertexOffset; + } + set$2(this._bounds, min2 + 0.5, min3 + 0.5, max2 + 0.5, max3 + 0.5); + this._translation[axisId2] = min2; + this._translation[axisId3] = max3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = max3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = min2; + this._translation[axisId3] = min3; + this._texCoord[0] = min2 + 0.5; + this._texCoord[1] = min3 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + this._translation[axisId2] = max2; + this._texCoord[0] = max2 + 0.5; + PickGridVertex.setTranslation(dataView, vertexOffset, this._translation); + PickGridVertex.setNormal(dataView, vertexOffset, this._normal); + PickGridVertex.setIdColor(dataView, vertexOffset, this._vec4); + PickGridVertex.setTexCoord(dataView, vertexOffset, this._texCoord); + PickGridVertex.setBounds(dataView, vertexOffset, this._bounds); + vertexOffset++; + offset2++; + } + } + } + this._gridFaceIndexCounts[faceId] = offset2 * 6 - this._gridFaceIndexOffsets[faceId]; + return offset2; } - get vertices() { - return this._vertices; + } + class Glyph { + toJSON() { + return { + key: this.key, + char: this.char, + width: this.width, + height: this.height, + top: this.top, + left: this.left, + advance: this.advance, + u0: this.u0, + v0: this.v0, + u1: this.u1, + v1: this.v1 + }; } - get verticesView() { - return this._verticesView; + } + let FontVisual$2 = class FontVisual { + update() { } - get indices() { - return this._indices; + constructor(font2) { + this.font = font2; } - get indexCount() { - return this._indexCount; + }; + class Font { + get atlas() { + return this._rasterizer.fontAtlas; } - get isInitialized() { - return this._isInitialized; + get count() { + return this._chars.size; } - get mMatrix() { - return this._mMatrix; + constructor(core, rasterizer) { + this._core = core; + this._rasterizer = rasterizer; + this._chars = /* @__PURE__ */ new Set(); + this._previousSize = 0; + this.glyphs = {}; } - get scale() { - return this._scale; + addGlyph(char) { + if (!this._chars.has(char)) { + this._chars.add(char); + this._rasterizer.draw(char); + this._hasChanged = true; + } } - set scale(value) { - if (this._scale != value) { - this._scale = value; - this._hasChanged = true; + update() { + if (this._hasChanged) { + this._hasChanged = false; + this._core.log.write(LogLevel.info, `${this.name} added ${this._chars.size - this._previousSize} new glyphs`); + this._previousSize = this._chars.size; + if (this.hasChangedCallback) { + this.hasChangedCallback(); } + } } - get font() { - return this._font; + toJSON() { + const glyphs = []; + for (let key2 in this.glyphs) { + const glyph = this.glyphs[key2]; + glyphs.push(glyph.toJSON()); + } + return { + name: this.name, + size: this.size, + border: this.border, + glyphs, + edgeValue: this.edgeValue + }; } - set font(value) { - if (this._font != value) { - this._font = value; - this._hasChanged = true; - } + } + class FontAtlas { + constructor(width2, height2) { + const canvas = document.createElement("canvas"); + canvas.width = width2; + canvas.height = height2; + const context2 = canvas.getContext("2d"); + context2.clearRect(0, 0, width2, height2); + this.imageData = context2.getImageData(0, 0, width2, height2); + this.x = 0; + this.top = new Uint16Array(width2); } - get rotation() { - return this._rotation; + } + class FontRasterizer { + get font() { + return this._font; } - set rotation(value) { - if (this._rotation != value) { - this._rotation = value; - this._hasChanged = true; - } + get fontAtlas() { + return this._fontAtlas; + } + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontAtlas = options.fontAtlas; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._font = new Font(core, this); + this._font.name = `${this._fontFamily}${this._fontSize}${this._fontWeight == "normal" ? "" : this._fontWeight}${this._fontStyle == "normal" ? "" : this._fontStyle}`.replace(/[^a-z0-9,]/ig, "").toLowerCase(); + this._font.size = this._fontSize; + this._font.border = this._border; + this._font.edgeValue = this._edgeValue; + const glyphRasterizerOptions = { + baseline: this._baseline, + border: this._border, + edgeValue: this._edgeValue, + fontFamily: this._fontFamily, + fontSize: this._fontSize, + fontStyle: this._fontStyle, + fontWeight: this._fontWeight, + maxDistance: this._maxDistance + }; + this._glyphRasterizer = new GlyphRasterizer(core, glyphRasterizerOptions); + this._core.log.write(LogLevel.info, `font rasterizer ${Math.round(window.performance.now() - start)}ms`); } - set reverseX(value) { - if (this._reverseX != value) { - this._reverseX = value; - this._hasChanged = true; - } + draw(char) { + const glyph = this._glyphRasterizer.draw(char); + const texWidth = glyph.width + 2 * this._border; + const texHeight = glyph.height + 2 * this._border; + const width2 = this._fontAtlas.imageData.width; + const height2 = this._fontAtlas.imageData.height; + if (this._fontAtlas.x + texWidth > width2) { + this._fontAtlas.x = 0; + } + let y2 = 0; + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + y2 = Math.max(y2, this._fontAtlas.top[x2]); + } + if (y2 + texHeight > height2) { + this._core.log.write(LogLevel.warn, `${this._font.name} height overflow`); + } + for (let x2 = this._fontAtlas.x; x2 < this._fontAtlas.x + texWidth; x2++) { + this._fontAtlas.top[x2] = y2 + texHeight; + } + glyph.u0 = this._fontAtlas.x / width2; + glyph.v0 = y2 / height2; + glyph.u1 = (this._fontAtlas.x + texWidth) / width2; + glyph.v1 = (y2 + texHeight) / height2; + this._font.glyphs[char] = glyph; + for (let i = 0; i < glyph.distances.length; i++) { + const distance2 = glyph.distances[i]; + const dataX = i % texWidth; + const dataY = Math.floor(i / texWidth); + const offset2 = (this._fontAtlas.x + dataX + (y2 + dataY) * width2) * 4; + this._fontAtlas.imageData.data[offset2 + 0] = distance2; + this._fontAtlas.imageData.data[offset2 + 1] = distance2; + this._fontAtlas.imageData.data[offset2 + 2] = distance2; + this._fontAtlas.imageData.data[offset2 + 3] = 255; + } + this._fontAtlas.x += texWidth; } - set reverseY(value) { - if (this._reverseY != value) { - this._reverseY = value; - this._hasChanged = true; - } + } + class GlyphRasterizer { + constructor(core, options) { + let start = performance.now(); + this._core = core; + this._fontSize = options.fontSize; + this._border = options.border; + this._fontFamily = options.fontFamily; + this._fontWeight = options.fontWeight; + this._fontStyle = options.fontStyle; + this._baseline = options.baseline; + this._maxDistance = options.maxDistance; + this._edgeValue = options.edgeValue; + this._size = this._fontSize + this._border * 2; + this._size += this._border * 2; + this._gridOuter = new Float64Array(this._size * this._size); + this._gridInner = new Float64Array(this._size * this._size); + this._f = new Float64Array(this._size); + this._z = new Float64Array(this._size + 1); + this._v = new Uint16Array(this._size); + const canvas = document.createElement("canvas"); + canvas.width = canvas.height = this._size; + this._context = canvas.getContext("2d", { willReadFrequently: true }); + this._context.font = `${this._fontStyle} ${this._fontWeight} ${this._fontSize}px ${this._fontFamily} `; + this._context.textBaseline = this._baseline; + this._context.textAlign = "left"; + this._context.fillStyle = "black"; + this._core.log.write(LogLevel.info, `glyph rasterizer ${Math.round(window.performance.now() - start)}ms`); } - set reverseZ(value) { - if (this._reverseZ != value) { - this._reverseZ = value; - this._hasChanged = true; + draw(char) { + const textMetrics2 = this._context.measureText(char); + const glyphLeft = 0; + const glyphTop = Math.floor(textMetrics2.actualBoundingBoxAscent); + let glyphWidth = Math.ceil(textMetrics2.actualBoundingBoxRight); + let glyphHeight = Math.ceil(textMetrics2.actualBoundingBoxAscent) + Math.ceil(textMetrics2.actualBoundingBoxDescent); + glyphWidth = Math.min(this._size - this._border, glyphWidth); + glyphHeight = Math.min(this._size - this._border, glyphHeight); + const width2 = glyphWidth + 2 * this._border; + const height2 = glyphHeight + 2 * this._border; + const length2 = width2 * height2; + const distances = new Uint8ClampedArray(length2); + const gradientsX = new Uint8ClampedArray(length2); + const gradientsY = new Uint8ClampedArray(length2); + const pixels = new Uint8ClampedArray(length2); + const glyph = new Glyph(); + glyph.char = char; + glyph.key = char.codePointAt(0); + glyph.distances = distances; + glyph.gradientsX = gradientsX; + glyph.gradientsY = gradientsY; + glyph.pixels = pixels; + glyph.width = glyphWidth; + glyph.height = glyphHeight; + glyph.top = glyphTop; + glyph.left = glyphLeft; + glyph.advance = textMetrics2.width; + if (glyphWidth == 0 || glyphHeight == 0) { + return glyph; + } + this._context.clearRect(this._border, this._border, glyphWidth, glyphHeight); + this._context.fillText(char, this._border, this._border + glyphTop); + const imgData = this._context.getImageData(this._border, this._border, glyphWidth, glyphHeight); + for (let i = 0; i < length2; i++) { + this._gridOuter[i] = Number.MAX_VALUE; + this._gridInner[i] = 0; + } + for (let y2 = 0; y2 < glyphHeight; y2++) { + for (let x2 = 0; x2 < glyphWidth; x2++) { + const a2 = imgData.data[4 * (y2 * glyphWidth + x2) + 3] / 255; + if (a2 > 0) { + const j = (y2 + this._border) * width2 + x2 + this._border; + if (a2 == 1) { + this._gridOuter[j] = 0; + this._gridInner[j] = Number.MAX_VALUE; + } else { + const d = 0.5 - a2; + this._gridOuter[j] = d > 0 ? d * d : 0; + this._gridInner[j] = d < 0 ? d * d : 0; + pixels[j] = 255; + } + } } - } - get horizontalAlignment() { - return this._horizontalAlignment; - } - set horizontalAlignment(value) { - if (this._horizontalAlignment != value) { - this._horizontalAlignment = value; - this._hasChanged = true; + } + this._edt(this._gridOuter, 0, 0, width2, height2, width2, this._f, this._v, this._z); + this._edt(this._gridInner, this._border, this._border, glyphWidth, glyphHeight, width2, this._f, this._v, this._z); + const distances2 = new Float32Array(length2); + for (let i = 0; i < length2; i++) { + const distance2 = Math.sqrt(this._gridOuter[i]) - Math.sqrt(this._gridInner[i]); + distances[i] = Math.round(this._edgeValue - distance2 * 255 / this._maxDistance); + distances2[i] = distance2; + } + for (let i = 0; i < length2; i++) { + const x2 = i % width2; + const y2 = Math.floor(i / width2); + const d = distances2[i]; + const sign2 = d < 0 ? -1 : 1; + const x02 = x2 > 0 ? distances2[i - 1] : Number.MAX_VALUE; + const x12 = x2 < width2 - 1 ? distances2[i + 1] : Number.MAX_VALUE; + const y02 = y2 > 0 ? distances2[i - width2] : Number.MAX_VALUE; + const y12 = y2 < height2 - 1 ? distances2[i + width2] : Number.MAX_VALUE; + let gradientX = sign2 * x02 < sign2 * x12 ? d - x02 : x12 - d; + let gradientY = sign2 * y02 < sign2 * y12 ? y02 - d : d - y12; + gradientsX[i] = Math.round((gradientX * 0.5 + 0.5) * 255); + gradientsY[i] = Math.round((gradientY * 0.5 + 0.5) * 255); + } + return glyph; + } + _edt(data2, x02, y02, width2, height2, gridSize, f, v, z) { + for (let x2 = x02; x2 < x02 + width2; x2++) + this._edt1d(data2, y02 * gridSize + x2, gridSize, height2, f, v, z); + for (let y2 = y02; y2 < y02 + height2; y2++) + this._edt1d(data2, y2 * gridSize + x02, 1, width2, f, v, z); + } + _edt1d(grid, offset2, stride, n, f, v, z) { + v[0] = 0; + z[0] = -Number.MAX_VALUE; + z[1] = Number.MAX_VALUE; + f[0] = grid[offset2]; + for (let q = 1, k = 0, s = 0; q < n; q++) { + f[q] = grid[offset2 + q * stride]; + const q2 = q * q; + do { + const r = v[k]; + s = (f[q] - f[r] + q2 - r * r) / (q - r) / 2; + } while (s <= z[k] && --k > -1); + k++; + v[k] = q; + z[k] = s; + z[k + 1] = Number.MAX_VALUE; + } + for (let q = 0, k = 0; q < n; q++) { + while (z[k + 1] < q) { + k++; } + const r = v[k]; + const qr = q - r; + grid[offset2 + q * stride] = f[r] + qr * qr; + } } - get verticalAlignment() { - return this._verticalAlignment; + } + class ManipulationProcessor { + get manipulators() { + return this._manipulators; } - set verticalAlignment(value) { - if (this._verticalAlignment != value) { - this._verticalAlignment = value; - this._hasChanged = true; - } + get count() { + return this._count; } - get offsetX() { - return this._offsetX; + get isDragging() { + return this._isDragging; + } + constructor(core) { + this._core = core; + this._count = 0; + this._centroid = create$3(); + this._previousCentroid = create$3(); + this._relativePositionToCentroid = create$3(); + this._directionToCentroid = create$3(); + this._previousDirectionToCentroid = create$3(); + this._manipulators = {}; + this._removedManipulators = []; + this.cumulativeTranslation = create$3(); + this.translationDelta = create$3(); + this.centroid = create$3(); + this.maxScale = Number.MAX_VALUE; + this.twistAxis = fromValues$3(0, 0, 1); + this.initialize(); } - set offsetX(value) { - if (this._offsetX != value) { - this._offsetX = value; - this._hasChanged = true; + update(elapsedTime, manipulators) { + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (!manipulators[manipulator.id]) { + if (this.removeManipulator) { + this.removeManipulator(manipulator); + } + this._removedManipulators.push(manipulator.id); } - } - get offsetY() { - return this._offsetY; - } - set offsetY(value) { - if (this._offsetY != value) { - this._offsetY = value; - this._hasChanged = true; + } + if (this._removedManipulators.length > 0) { + for (let i = 0; i < this._removedManipulators.length; i++) { + delete this._manipulators[this._removedManipulators[i]]; + this._count--; } - } - get offsetZ() { - return this._offsetZ; - } - set offsetZ(value) { - if (this._offsetZ != value) { - this._offsetZ = value; - this._hasChanged = true; + this._removedManipulators = []; + } + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + if (!this._manipulators[manipulator.id]) { + if (!this.addManipulator || this.addManipulator(manipulator)) { + copy$3(manipulator.initialPosition, manipulator.position); + this._manipulators[manipulator.id] = manipulator; + this._count++; + } } - } - get maxGlyphTop() { - return this._maxGlyphTop; - } - set maxGlyphTop(value) { - if (this._maxGlyphTop != value) { - this._maxGlyphTop = value; - this._hasChanged = true; + } + set$3(this.translationDelta, 0, 0, 0); + this.scaleDelta = 0; + this.twistDelta = 0; + if (this._count > 0) { + if (this._previousCount > 0) { + if (this.prepareManipulation) { + this.prepareManipulation(); + } + this._process(); + if (this.processManipulation) { + this.processManipulation(elapsedTime); + } + } else { + this.initialize(); + if (this.beginManipulation) { + this.beginManipulation(); + } } - } - get maxGlyphHeight() { - return this._maxGlyphHeight; - } - set maxGlyphHeight(value) { - if (this._maxGlyphHeight != value) { - this._maxGlyphHeight = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._offset = (0, _glMatrix.vec3).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._mMatrix = (0, _glMatrix.mat4).create(); - this._indexCount = 0; - this._maxGlyphs = options.maxGlyphs; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this.scale = options.scale ? options.scale : 1; - this.offsetX = options.offsetX ? options.offsetX : 0; - this.offsetY = options.offsetY ? options.offsetY : 0; - this.offsetZ = options.offsetZ ? options.offsetZ : 0; - this.reverseX = options.reverseX; - this.reverseY = options.reverseY; - this.reverseZ = options.reverseZ; - this.rotation = options.rotation; - this.maxGlyphTop = options.maxGlyphTop; - this.horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - this.verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - this._material = options.material; - this.borderWidth = core.config.textBorderWidth; - this.gamma = 0; - } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES * this._maxGlyphs * 4); - this._verticesView = new DataView(this._vertices); - this._indices = new Uint32Array(this._maxGlyphs * 6); - this._isInitialized = true; - } - update(elapsedTime) {} -} -class Label extends LabelBase { - get textAlignment() { - return this._textAlignment; - } - set textAlignment(value) { - if (this._textAlignment != value) { - this._textAlignment = value; - this._hasChanged = true; + } else { + if (this._previousCount > 0) { + if (this.endManipulation) { + this.endManipulation(); + } } + } + this._isDragging = this._count == 1 && squaredLength(this.cumulativeTranslation) > this._core.config.dragToleranceSquared || this._count > 1; + this._previousCount = this._count; } - get text() { - return this._text; + initialize() { + set$3(this.centroid, 0, 0, 0); + set$3(this.cumulativeTranslation, 0, 0, 0); + this.cumulativeScale = 1; + this.cumulativeTwist = 0; } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; + _process() { + if (this._previousCount > 0) { + let persisted = 0; + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + persisted++; + } + } + const removed = this._previousCount - persisted; + if (persisted > 0) { + if (removed > 0) { + copy$3(this._centroid, this._previousCentroid); + } else { + set$3(this._centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + add(this._centroid, this._centroid, manipulator.position); + } + } + scale(this._centroid, this._centroid, 1 / persisted); + } + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + if (manipulator.isPersisted) { + manipulator.maxTranslationSquared = Math.max(manipulator.maxTranslationSquared, squaredDistance(manipulator.position, manipulator.initialPosition)); + add(this.translationDelta, this.translationDelta, manipulator.position); + subtract(this.translationDelta, this.translationDelta, manipulator.previousPosition); + subtract(this._relativePositionToCentroid, manipulator.position, this._centroid); + const distanceToCentroidSquared = squaredLength(this._relativePositionToCentroid); + if (distanceToCentroidSquared < this._core.config.manipulatorMinRelativeDistanceSquared) { + this.scaleDelta += 1; + } else { + const distanceToCentroid = Math.sqrt(distanceToCentroidSquared); + const previousDistanceToCentroidSquared = squaredLength(manipulator.previousPositionRelativeToCentroid); + const previousDistanceToCentroid = Math.sqrt(previousDistanceToCentroidSquared); + this.scaleDelta += distanceToCentroid / previousDistanceToCentroid; + scale(this._directionToCentroid, this._relativePositionToCentroid, 1 / distanceToCentroid); + scale(this._previousDirectionToCentroid, manipulator.previousPositionRelativeToCentroid, 1 / previousDistanceToCentroid); + this.twistDelta += AngleHelper.signedAngleBetweenVectors(this._previousDirectionToCentroid, this._directionToCentroid, this.twistAxis); + } + } + } + scale(this.translationDelta, this.translationDelta, 1 / persisted); + add(this.cumulativeTranslation, this.cumulativeTranslation, this.translationDelta); + this.scaleDelta /= persisted; + this.cumulativeScale = MathHelper.clamp(this.cumulativeScale * this.scaleDelta, this.minScale, this.maxScale); + this.scaleDelta -= 1; + this.twistDelta /= persisted; + this.cumulativeTwist += this.twistDelta; } + } + set$3(this.centroid, 0, 0, 0); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + add(this.centroid, this.centroid, manipulator.position); + } + scale(this.centroid, this.centroid, 1 / this._count); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + subtract(manipulator.positionRelativeToCentroid, manipulator.position, this.centroid); + } + copy$3(this._previousCentroid, this.centroid); + for (const key2 in this._manipulators) { + const manipulator = this._manipulators[key2]; + manipulator.isPersisted = true; + copy$3(manipulator.previousPosition, manipulator.position); + copy$3(manipulator.previousRotationAxis, manipulator.rotationAxis); + copy$3(manipulator.previousPositionRelativeToCentroid, manipulator.positionRelativeToCentroid); + } } - constructor(core, options){ - super(core, options); - this._font = options.font || core.font; - this._text = options.text; - this._textAlignment = options.textAlignment === undefined ? (0, _mainJs.TextAlignment).left : options.textAlignment; + } + class MouseWheel { + constructor(core) { + this._core = core; + this._previousTotal = 0; + this.total = 0; + } + initialize(element2) { + element2.addEventListener("wheel", (e) => { + e.preventDefault(); + const wheelEvent = e; + this.total += wheelEvent.deltaY; + }, { passive: false }); } update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - if (!this._text) { - this._indexCount = 0; - this.width = 0; - this.height = 0; - } else { - const widths = []; - const truncated = []; - let maxWidth = 0; - let maxGlyphHeight = 0; - let maxGlyphTop = 0; - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - widths.push(this._textMetric.width); - maxWidth = Math.max(this._textMetric.width, maxWidth); - maxGlyphHeight = Math.max(this._textMetric.maxHeight, maxGlyphHeight); - maxGlyphTop = Math.max(this._textMetric.maxTop, maxGlyphTop); - glyphs += text.length; - truncated.push(text); - if (glyphs >= this._maxGlyphs) break; - } - if (this._maxGlyphHeight) maxGlyphHeight = this._maxGlyphHeight; - if (this._maxGlyphTop) maxGlyphTop = this._maxGlyphTop; - const lineHeight = this._font.size; - const height = truncated.length * lineHeight; - switch(this._horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._originX = this._offsetX + maxWidth / 2; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._originX = this._offsetX; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._originX = this._offsetX - maxWidth / 2; - break; - } - switch(this._verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._originY = this._offsetY - height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._originY = this._offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._originY = this._offsetY + height / 2; - break; - } - glyphs = 0; - for(let i = 0; i < truncated.length; i++){ - switch(this._textAlignment){ - case (0, _mainJs.TextAlignment).left: - this._offset[0] = this._originX - maxWidth / 2; - break; - case (0, _mainJs.TextAlignment).center: - this._offset[0] = this._originX - widths[i] / 2; - break; - case (0, _mainJs.TextAlignment).right: - this._offset[0] = this._originX + maxWidth / 2 - widths[i]; - break; - } - this._offset[1] = this._originY + height / 2 - i * lineHeight - lineHeight / 2 - maxGlyphTop / 2; - const pickingId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickingId, (0, _mainJs.PickType).label, this._vec4); - const text = truncated[i]; - if (text.length > 0) { - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, (0, _constantsJs.Constants).VECTOR3_ZERO, 1, this._offset, null, this._vec4); - glyphs += text.length; - } - } - const scaling = this._scale / this._font.size; - this.width = maxWidth * scaling; - this.height = height * scaling; - this._indexCount = glyphs * 6; - (0, _glMatrix.vec3).set(this._vec3, scaling, scaling, scaling); - (0, _glMatrix.mat4).fromScaling(this._mMatrix, this._vec3); - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } - } -} -class LabelSet extends LabelBase { - get materials() { - return this._materials; + const total = this.total; + this.delta = total - this._previousTotal; + this._previousTotal = total; + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`mse whl ${this.total < 0 ? "" : " "}${Math.round(this.total)}`); + } } - get minBoundsX() { - return this._minBoundsX; + } + class Manipulator { + constructor() { + this.pickedIndex = 0; + this.maxTranslationSquared = 0; + this.initialPosition = create$3(); + this.position = create$3(); + this.previousPosition = create$3(); + this.holdOrigin = create$3(); + this.positionRelativeToCentroid = create$3(); + this.previousPositionRelativeToCentroid = create$3(); + this.rotationAxis = create$3(); + this.previousRotationAxis = create$3(); } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; - } + } + class Pointers { + get hoverX() { + return this._hoverX; } - get minBoundsY() { - return this._minBoundsY; + get hoverY() { + return this._hoverY; } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; - } + get hoverId() { + return this._hoverId; } - get minBoundsZ() { - return this._minBoundsZ; + constructor(core, manipulators) { + this._core = core; + this._manipulators = manipulators; } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } + initialize(element2) { + this._element = element2; + element2.addEventListener("pointerdown", (e) => this._handlePointerDown(e), { passive: true }); + element2.addEventListener("pointermove", (e) => this._handlePointerMove(e), { passive: true }); + element2.addEventListener("pointerup", (e) => this._handlePointerUp(e), { passive: true }); + element2.addEventListener("pointercancel", (e) => this._handlePointerCancel(e), { passive: true }); + element2.addEventListener("pointerleave", (e) => this._handlePointerLeave(e), { passive: true }); + element2.addEventListener("pointerout", (e) => this._handlePointerOut(e), { passive: true }); } - get maxBoundsX() { - return this._maxBoundsX; + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`pen rot ${(this._tiltX | 0).toFixed(3)},${(this._tiltY | 0).toFixed(3)},${(this._twist | 0).toFixed(3)}`); + this._core.debugText.addLine(`hov pos ${this.hoverX ? `${this.hoverX.toFixed(3)},${this.hoverY.toFixed(3)}px` : ""}`); + } } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + _handlePointerDown(e) { + this._element.focus(); + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const manipulator = new Manipulator(); + const id2 = e.pointerId; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + manipulator.id = id2; + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.type = e.pointerType; + manipulator.button = e.button; + manipulator.shiftKey = e.shiftKey; + manipulator.ctrlKey = e.ctrlKey; + manipulator.altKey = e.altKey; + manipulator.event = e; + this._manipulators[id2] = manipulator; + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; } - get maxBoundsY() { - return this._maxBoundsY; + _handlePointerMove(e) { + const devicePixelRatio2 = this._core.renderer.devicePixelRatio; + const x2 = e.offsetX * devicePixelRatio2; + const y2 = e.offsetY * devicePixelRatio2; + const id2 = e.pointerId; + const manipulator = this._manipulators[id2]; + if (manipulator) { + manipulator.position[0] = x2; + manipulator.position[1] = y2; + manipulator.event = e; + } + switch (e.pointerType) { + case "mouse": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + break; + case "pen": + this._hoverId = id2; + this._hoverX = x2; + this._hoverY = y2; + this._tiltX = e.tiltX; + this._tiltY = e.tiltY; + this._twist = e.twist; + break; + } } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } + _handlePointerUp(e) { + const manipulator = this._manipulators[e.pointerId]; + if (manipulator) { + manipulator.event = e; + } + this._remove(e.pointerId); } - get maxBoundsZ() { - return this._maxBoundsZ; + _handlePointerCancel(e) { + this._remove(e.pointerId); } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + _handlePointerLeave(e) { + this._resetHover(); + this._remove(e.pointerId); } - get positionsX() { - return this._positionsX; + _handlePointerOut(e) { + this._resetHover(); + this._remove(e.pointerId); } - set positionsX(value) { - if (this._positionsX != value) { - this._positionsX = value; - this._hasChanged = true; - } + _resetHover() { + this._hoverId = null; + this._hoverX = null; + this._hoverY = null; } - get positionsY() { - return this._positionsY; + _remove(pointerId) { + const manipulator = this._manipulators[pointerId]; + if (manipulator) { + delete this._manipulators[pointerId]; + } } - set positionsY(value) { - if (this._positionsY != value) { - this._positionsY = value; - this._hasChanged = true; - } + } + class AnimationHelper { + static smoothStep(value2) { + return value2 * value2 * (3 - 2 * value2); + } + static damp(value2, target2, threshold2, dampening) { + if (Math.abs(target2) < threshold2) { + return MathHelper.lerp(value2, 0, dampening); + } else { + return MathHelper.lerp(value2, target2, dampening); + } } - get positionsZ() { - return this._positionsZ; + } + class Keyboard { + constructor(core) { + this._core = core; + this._pressedKeys = /* @__PURE__ */ new Set(); + this._previousPressedKeys = /* @__PURE__ */ new Set(); + } + initialize(element2) { + element2.addEventListener("keydown", (e) => { + this._handleKeyDown(e); + }, false); + element2.addEventListener("keyup", (e) => { + this._handleKeyUp(e); + }, false); } - set positionsZ(value) { - if (this._positionsZ != value) { - this._positionsZ = value; - this._hasChanged = true; - } + update(elapsedTime) { + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`key tot ${this._pressedKeys.size}`); + } } - get positionScalingX() { - return this._positionScalingX; + isKeyDown(key2) { + return this._pressedKeys.has(key2); } - set positionScalingX(value) { - if (this._positionScalingX != value) { - this._positionScalingX = value; - this._hasChanged = true; + wasKeyReleased(key2) { + if (this._pressedKeys.has(key2)) { + if (!this._previousPressedKeys.has(key2)) { + this._previousPressedKeys.add(key2); + return true; } + } else { + this._previousPressedKeys.delete(key2); + } + return false; } - get positionScalingY() { - return this._positionScalingY; - } - set positionScalingY(value) { - if (this._positionScalingY != value) { - this._positionScalingY = value; - this._hasChanged = true; - } + _handleKeyDown(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (!this._pressedKeys.has(key2)) { + this._pressedKeys.add(key2); + } } - get positionScalingZ() { - return this._positionScalingZ; + _handleKeyUp(e) { + const keyboardEvent = e; + const key2 = keyboardEvent.key; + if (this._pressedKeys.has(key2)) { + this._pressedKeys.delete(key2); + } } - set positionScalingZ(value) { - if (this._positionScalingZ != value) { - this._positionScalingZ = value; - this._hasChanged = true; + } + class Manager { + constructor(core) { + this._manipulators = {}; + this._core = core; + this._vec3 = create$3(); + this._manipulationProcessor = new ManipulationProcessor(core); + this._manipulators = {}; + this._pointers = new Pointers(core, this._manipulators); + this._pointers.initialize(core.container); + this._mouseWheel = new MouseWheel(core); + this._mouseWheel.initialize(core.container); + this._keyboard = new Keyboard(core); + this._keyboard.initialize(core.container); + this.isPickingEnabled = true; + this.mouseWheelZoomScale = this._core.config.mouseWheelZoomScale; + this.mouseWheelRotationScale = this._core.config.mouseWheelRotationScale; + this.multiTouchZoomScale = this._core.config.multiTouchZoomScale; + this.pickHoldDelay = this._core.config.pickHoldDelay; + this.pickSelectDelay = this._core.config.pickSelectDelay; + const rightButton2 = 2; + this.singleTouchAction = (manipulator) => { + if (manipulator.type == "mouse" && manipulator.button == rightButton2 || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.translate; + } else if (manipulator.altKey || manipulator.type == "pen" && manipulator.button == rightButton2) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.rotate; } - } - get rotations() { - return this._rotations; - } - set rotations(value) { - if (this._rotations != value) { - this._rotations = value; - this._hasChanged = true; + }; + this.mouseWheelAction = (keyboard) => { + if (this._keyboard.isKeyDown("Control")) { + return MouseWheelAction.rotateY; + } else { + return MouseWheelAction.zoom; } + }; + this.lassoPickType = PickType.data; + this._thumbstickX = 0; + this._previousControllerButtonPressed = [false, false, false, false]; + this._quat0 = create$1(); + this._quat1 = create$1(); } - get offsetsX() { - return this._offsetsX; + update(elapsedTime, xrFrame) { + if (xrFrame) { + const inputSources = this._core.webXRSession.inputSources; + if (inputSources.length > 0 && this._core.renderer.controllers.length > 0) { + const inputSource = inputSources[0]; + const controllerVisual = this._core.renderer.controllers[0]; + if (inputSource.gripSpace && inputSource.targetRayMode == "tracked-pointer") { + const gripPose = xrFrame.getPose(inputSource.gripSpace, this._core.renderer.webXRReferenceSpace); + if (gripPose) { + controllerVisual.mMatrix = gripPose.transform.matrix; + } + const gamepad = inputSource.gamepad; + this._core.renderer.isPickingEnabled = false; + const rayPose = xrFrame.getPose(inputSource.targetRaySpace, this._core.renderer.webXRReferenceSpace); + if (rayPose) { + controllerVisual.rayMMatrix = rayPose.transform.matrix; + if (gamepad.buttons[0].value > 0 && this.isPickingEnabled) { + this._core.renderer.pickVMatrix = rayPose.transform.inverse.matrix; + this._core.renderer.isPickingEnabled = true; + } + } + const threshold2 = 0.2; + const dampening = Math.min(0.015 * elapsedTime, 1); + this._thumbstickX = AnimationHelper.damp(this._thumbstickX, gamepad.axes[2], threshold2, dampening); + if (this._thumbstickX != 0) { + setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, 0.01 * this._thumbstickX * elapsedTime); + this._core.getModelRotation(this._quat1); + multiply(this._quat1, this._quat0, this._quat1); + this._core.setModelRotation(this._quat1, true); + } + if (gamepad.buttons[2].pressed) { + if (!this._previousControllerButtonPressed[2]) { + this._previousControllerButtonPressed[2] = true; + if (this.controllerButtonPressedCallback) { + this.controllerButtonPressedCallback(2); + } + } + } else { + this._previousControllerButtonPressed[2] = false; + } + } + } + } else { + const camera = this._core.camera; + this._manipulationProcessor.update(elapsedTime, this._manipulators); + this._pointers.update(elapsedTime); + this._mouseWheel.update(elapsedTime); + this._keyboard.update(elapsedTime); + if (this._mouseWheel.delta != 0) { + switch (this.mouseWheelAction(this._keyboard)) { + case MouseWheelAction.zoom: + if (this._pointers.hoverX, this._pointers.hoverY) { + camera.zoom(this._mouseWheel.delta * this.mouseWheelZoomScale, this._pointers.hoverX, this._pointers.hoverY); + } + break; + case MouseWheelAction.rotateY: + setAxisAngle(this._quat0, Constants.VECTOR3_UNITY, this._mouseWheel.delta * this.mouseWheelRotationScale); + camera.getOrbit(this._quat1); + multiply(this._quat1, this._quat1, this._quat0); + camera.setOrbit(this._quat1, true); + break; + } + } + const count2 = this._manipulationProcessor.count; + if (count2 == 0) { + if (this._isLassoPicking) { + this._isLassoPicking = false; + this._core.renderer.isLassoPicking = false; + const x02 = Math.min(this._lassoX0, this._lassoX1); + const y02 = Math.min(this._lassoY0, this._lassoY1); + const x12 = Math.max(this._lassoX0, this._lassoX1); + const y12 = Math.max(this._lassoY0, this._lassoY1); + if (x12 - x02 > 0 && y12 - y02 > 0) { + const sets = this._core.pickLasso(x02, y02, x12, y12, this.lassoPickType); + const result = { + x0: x02, + y0: y02, + x1: x12, + y1: y12, + pickType: this.lassoPickType, + ids: sets, + manipulator: this._manipulator + }; + this.pickLassoCallback(result); + } + } + } else if (count2 == 1) { + const translationDelta = this._manipulationProcessor.translationDelta; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + const manipulators = this._manipulationProcessor.manipulators; + for (const key2 in manipulators) { + const manipulator = manipulators[key2]; + switch (this.singleTouchAction(manipulator)) { + case SingleTouchAction.rotate: + camera.rotate(translationDelta); + break; + case SingleTouchAction.translate: + camera.translate(translationDelta); + break; + case SingleTouchAction.lasso: + if (this.pickLassoCallback) { + if (!this._isLassoPicking) { + this._isLassoPicking = true; + this._core.renderer.isLassoPicking = true; + this._lassoX0 = manipulator.position[0]; + this._lassoY0 = manipulator.position[1]; + } + this._lassoX1 = manipulator.position[0]; + this._lassoY1 = manipulator.position[1]; + this._core.renderer.lassoX0 = Math.min(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY0 = Math.min(this._lassoY0, this._lassoY1); + this._core.renderer.lassoX1 = Math.max(this._lassoX0, this._lassoX1); + this._core.renderer.lassoY1 = Math.max(this._lassoY0, this._lassoY1); + } + break; + } + break; + } + } + } else { + const translationDelta = this._manipulationProcessor.translationDelta; + const camera2 = this._core.camera; + if (translationDelta[0] != 0 || translationDelta[1] != 0) { + camera2.translate(translationDelta); + } + if (this._manipulationProcessor.scaleDelta != 0) { + const distance2 = this._manipulationProcessor.scaleDelta * this.multiTouchZoomScale; + camera2.zoom(distance2, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + if (this._manipulationProcessor.twistDelta != 0) { + camera2.twist(this._manipulationProcessor.twistDelta, this._manipulationProcessor.centroid[0], this._manipulationProcessor.centroid[1]); + } + } + if (this.isPickingEnabled && !this._manipulationProcessor.isDragging && !this._isLassoPicking) { + const camera2 = this._core.camera; + const renderer = this._core.renderer; + if (renderer.isCapturingPickImage) { + camera2.updatePickVMatrix(renderer.width / 2, renderer.height / 2); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + this._pickedTime = 0; + } else if (this._pointers.hoverId > -1) { + const pickingX = this._pointers.hoverX; + const pickingY = this._pointers.hoverY; + camera2.updatePickVMatrix(pickingX, pickingY); + renderer.pickVMatrix = camera2.pickVMatrix; + renderer.isPickingEnabled = true; + if (this._pickedId != renderer.pickedId) { + this._pickedId = renderer.pickedId; + this._pickedTime = 0; + } else { + if (this._manipulationProcessor.count == 1) { + this._pickedTime += elapsedTime; + for (const key2 in this._manipulators) { + this._manipulator = this._manipulators[key2]; + break; + } + } + } + if (this._pickedTime > 0) { + switch (renderer.pickedType) { + case PickType.data: + if (this._pickedTime > this.pickHoldDelay) { + renderer.getVertexPosition(this._vec3, this._pickedId); + this._core.setModelManipulationOrigin(this._vec3); + this._pickedTime = 0; + } else if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.transitionBuffers.length; i++) { + const transitionBuffer = renderer.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + transitionBuffer: i, + id: id2, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked id ${result.id}, transition buffer ${i}`); + if (this.pickItemCallback) { + this.pickItemCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.label: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.labelSets.length; i++) { + const labelSet = renderer.labelSets[i].label; + const id2 = labelSet.pickIdLookup[this._pickedId]; + if (id2 > -1) { + const result = { + label: id2, + set: i, + manipulator: this._manipulator + }; + this._core.log.write(LogLevel.info, `picked label ${result.label}, set ${result.set}`); + if (this.pickLabelSetCallback) { + this.pickLabelSetCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesDivision: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickGridLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickGrid(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked division (${result.divisionX}, ${result.divisionY}, ${result.divisionZ}), axes ${result.axes}`); + if (this.pickAxesGridCallback) { + this.pickAxesGridCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesTitle: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickTitleLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickTitle(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked title ${result.axis}, axes ${result.axes}`); + if (this.pickAxesTitleCallback) { + this.pickAxesTitleCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesLabel: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickLabelLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickLabel(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked label ${result.label}, axis ${result.axis}, axes ${result.axes}`); + if (this.pickAxesLabelCallback) { + this.pickAxesLabelCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + case PickType.axesHeading: + if (this._manipulationProcessor.count == 0) { + if (this._pickedTime > this.pickSelectDelay) { + for (let i = 0; i < renderer.currentAxes.length; i++) { + const axes = renderer.currentAxes[i].axes; + const id2 = axes.pickHeadingLookup[this._pickedId]; + if (id2 > -1) { + const result = axes.pickHeading(id2); + result.axes = i; + result.manipulator = this._manipulator; + this._core.log.write(LogLevel.info, `picked heading ${result.axis}, axes ${result.axes}`); + if (this.pickAxesHeadingCallback) { + this.pickAxesHeadingCallback(result); + } + break; + } + } + } + this._pickedTime = 0; + } + break; + } + } + } else { + renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } else { + this._core.renderer.isPickingEnabled = false; + this._pickedTime = 0; + } + } + if (this._core.config.isDebugVisible) { + this._core.debugText.addLine(`man tot ${this._manipulationProcessor.count}`); + this._core.debugText.addLine(`pck key ${this._core.renderer.pickedId}`); + } } - set offsetsX(value) { - if (this._offsetsX != value) { - this._offsetsX = value; - this._hasChanged = true; + } + class Log { + constructor(core) { + this._core = core; + } + write(level, value2) { + if (level >= this._core.config.logLevel) { + switch (level) { + case LogLevel.trace: + console.trace(value2); + break; + case LogLevel.debug: + console.debug(value2); + break; + case LogLevel.info: + console.info(value2); + break; + case LogLevel.warn: + console.warn(value2); + break; + case LogLevel.error: + console.error(value2); + break; } + } } - get offsetsY() { - return this._offsetsY; + } + var __awaiter$3 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - set offsetsY(value) { - if (this._offsetsY != value) { - this._offsetsY = value; - this._hasChanged = true; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Core { + get container() { + return this._container; } - get offsetsZ() { - return this._offsetsZ; + get started() { + return this._started; } - set offsetsZ(value) { - if (this._offsetsZ != value) { - this._offsetsZ = value; - this._hasChanged = true; - } + get debugText() { + return this._debugText; } - get offsetScalingX() { - return this._offsetScalingX; + get log() { + return this._log; } - set offsetScalingX(value) { - if (this._offsetScalingX != value) { - this._offsetScalingX = value; - this._hasChanged = true; - } + get totalFrames() { + return this._fps.totalFrames; } - get offsetScalingY() { - return this._offsetScalingY; + get camera() { + return this._camera; } - set offsetScalingY(value) { - if (this._offsetScalingY != value) { - this._offsetScalingY = value; - this._hasChanged = true; - } + set camera(value2) { + this._camera = value2; } - get offsetScalingZ() { - return this._offsetScalingZ; + getModelRotation(value2) { + copy$1(value2, this._modelRotation); } - set offsetScalingZ(value) { - if (this._offsetScalingZ != value) { - this._offsetScalingZ = value; - this._hasChanged = true; - } + setModelRotation(value2, isSmooth) { + copy$1(this._modelRotation, value2); + if (!isSmooth) { + copy$1(this._smoothedModelRotation, this._modelRotation); + } } - get text() { - return this._text; + getModelScale() { + return this._modelScale[0]; } - set text(value) { - if (this._text != value) { - this._text = value; - this._hasChanged = true; - } + setModelScale(value2, isSmooth) { + set$3(this._modelScale, value2, value2, value2); + if (!isSmooth) { + copy$3(this._smoothedModelScale, this._modelScale); + } } - get horizontalAlignments() { - return this._horizontalAlignments; + getModelManipulationOrigin(value2) { + copy$3(value2, this._modelManipulationOrigin); } - set horizontalAlignments(value) { - if (this._horizontalAlignments != value) { - this._horizontalAlignments = value; - this._hasChanged = true; - } + setModelManipulationOrigin(value2) { + this._updateManipulationOrigin(value2); } - get verticalAlignments() { - return this._verticalAlignments; + getModelPosition(value2) { + copy$3(value2, this._modelPosition); } - set verticalAlignments(value) { - if (this._verticalAlignments != value) { - this._verticalAlignments = value; - this._hasChanged = true; - } + setModelPosition(value2, isSmooth) { + copy$3(this._modelPosition, value2); + if (!isSmooth) { + copy$3(this._smoothedModelPosition, this._modelPosition); + } } - get scales() { - return this._scales; + get webXRSession() { + return this._webXRSession; } - set scales(value) { - if (this._scales != value) { - this._scales = value; - this._hasChanged = true; - } + get renderer() { + return this._renderer; } - get scalesScaling() { - return this._scalesScaling; - } - set scalesScaling(value) { - if (this._scalesScaling != value) { - this._scalesScaling = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._quat = (0, _glMatrix.quat).create(); - this._materials = options.materials; - this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - this._font = options.font || core.font; - this.text = options.text; - this.positionsX = options.positionsX; - this.positionsY = options.positionsY; - this.positionsZ = options.positionsZ; - this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - this.rotations = options.rotations; - this.offsetsX = options.offsetsX; - this.offsetsY = options.offsetsY; - this.offsetsZ = options.offsetsZ; - this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - if (options.horizontalAlignments) this.horizontalAlignments = options.horizontalAlignments; - if (options.verticalAlignments) this.verticalAlignments = options.verticalAlignments; - if (options.scales) this.scales = options.scales; - this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; + set renderer(renderer) { + if (this._renderer == renderer) { + return; + } + if (this._renderer) { + this.stop(); + this._renderer.remove(); + } + if (!renderer.isInitialized) { + renderer.initialize(this); + } + if (this._renderer) { + renderer.transitionTime = this._renderer.transitionTime; + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const previousTransitionBuffer = this._renderer.transitionBuffers[i]; + const transitionBuffer = renderer.createTransitionBuffer(previousTransitionBuffer.currentBuffer.ids); + transitionBuffer.copyFrom(previousTransitionBuffer); + renderer.transitionBuffers.push(transitionBuffer); + } + const currentAxes = this._renderer.currentAxes; + if (currentAxes) { + renderer.currentAxes = []; + for (let i = 0; i < currentAxes.length; i++) { + const axesVisual = currentAxes[i]; + const axes = axesVisual.axes; + if (axes instanceof Cartesian3dAxes) { + const cartesian3dAxesVisual = renderer.createCartesian3dAxesVisual(axes); + renderer.currentAxes.push(cartesian3dAxesVisual); + } else if (axes instanceof Cartesian2dAxes) { + renderer.currentAxes.push(renderer.createCartesian2dAxesVisual(axes)); + } + } + } + const labelSets = this._renderer.labelSets; + if (labelSets) { + renderer.labelSets = []; + for (let i = 0; i < labelSets.length; i++) { + renderer.labelSets.push(renderer.createLabelSetVisual(labelSets[i].label)); + } + } + const images = this._renderer.images; + if (images) { + renderer.images = []; + for (let i = 0; i < images.length; i++) { + renderer.images.push(renderer.createImageVisual(images[i].image)); + } + } + const fonts = this._renderer.fonts; + if (fonts) { + for (const key2 in fonts) { + const font2 = fonts[key2].font; + renderer.fonts[font2.name] = renderer.createFontVisual(font2); + } + } + } else { + renderer.fonts[this._font.name] = renderer.createFontVisual(this._font); + } + if (this._renderer) { + this._renderer.finalize(); + } + this._renderer = renderer; + this._fps.reset(); + this.start(); } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.pickIdLookup = {}; - if (!this._text) this._indexCount = 0; - else { - const start = window.performance.now(); - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; - const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; - const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; - if (this._rotation) (0, _glMatrix.quat).set(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); - let glyphs = 0; - for(let i = 0; i < this._text.length; i++){ - const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; - const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; - const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; - const text = (0, _textJs.TextHelper).truncate(this._text[i], this._maxGlyphs - glyphs); - const scale = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; - (0, _textJs.TextHelper).measure(this._font, text, this._textMetric); - const width = this._textMetric.width * scale; - const lineHeight = this._font.size * scale; - const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale; - const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = offsetX - width; - break; - } - const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = offsetY + lineHeight / 2; - break; - } - this._offset[1] -= maxGlyphTop / 2; - this._offset[2] = offsetZ; - let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; - let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; - let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; - if (this._reverseX) positionX = this.minBoundsX + this.maxBoundsX - positionX; - if (this._reverseY) positionY = this.minBoundsY + this.maxBoundsY - positionY; - if (this._reverseZ) positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; - (0, _glMatrix.vec3).set(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); - if (this._rotations) (0, _glMatrix.quat).set(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = i; - (0, _textJs.TextHelper).addString(this._font, text, this._verticesView, this._indices, glyphs, this._vec3, scale, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); - glyphs += text.length; - if (glyphs >= this._maxGlyphs) { - glyphs = this._maxGlyphs; - break; - } - } - this._indexCount = glyphs * 6; - this._core.log.write((0, _mainJs.LogLevel).info, `label set updated ${Math.round(window.performance.now() - start)}ms`); - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } + get font() { + return this._font; } -} -class TransitionLabelSet { - constructor(core){ - this._core = core; - this._vec2 = (0, _glMatrix.vec2).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._vec4 = (0, _glMatrix.vec4).create(); - this._quat = (0, _glMatrix.quat).create(); - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; - this._topLeft = (0, _glMatrix.vec3).create(); - this._topRight = (0, _glMatrix.vec3).create(); - this._bottomLeft = (0, _glMatrix.vec3).create(); - this._bottomRight = (0, _glMatrix.vec3).create(); - this._offset = (0, _glMatrix.vec3).create(); + get paletteResources() { + return this._paletteResources; } - update(buffer, labelIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.text.length : options.count; - const dataView = buffer.dataView; - const minBoundsX = options.minBoundsX ? options.minBoundsX : 0; - const minBoundsY = options.minBoundsY ? options.minBoundsY : 0; - const minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; - const maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; - const maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; - const maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; - const positionScalingX = options.positionScalingX ? options.positionScalingX : 1; - const positionScalingY = options.positionScalingY ? options.positionScalingY : 1; - const positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; - const offsetX = options.offsetX ? options.offsetX : 0; - const offsetY = options.offsetY ? options.offsetY : 0; - const offsetZ = options.offsetZ ? options.offsetZ : 0; - const offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; - const offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; - const offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const scale = options.scale ? options.scale : 1; - const scalesScaling = options.scalesScaling ? options.scalesScaling : 1; - const font = options.font || this._core.font; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const modelSizeX = maxBoundsX - minBoundsX; - const modelSizeY = maxBoundsY - minBoundsY; - const modelSizeZ = maxBoundsZ - minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - const modelOriginX = (minBoundsX + maxBoundsX) / 2; - const modelOriginY = (minBoundsY + maxBoundsY) / 2; - const modelOriginZ = (minBoundsZ + maxBoundsZ) / 2; - if (options.rotation) { - this._quat[0] = options.rotation[0]; - this._quat[1] = options.rotation[1]; - this._quat[2] = options.rotation[2]; - this._quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(this._quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - this.pickIdLookup = {}; - for(let i = 0; i < count; i++){ - const labelIndex = labelIds[i + offset]; - const _offsetX = (options.offsetsX ? options.offsetsX[labelIndex] / 2 : offsetX) * boundsScaling * offsetScalingX; - const _offsetY = (options.offsetsY ? options.offsetsY[labelIndex] / 2 : offsetY) * boundsScaling * offsetScalingY; - const _offsetZ = (options.offsetsZ ? options.offsetsZ[labelIndex] / 2 : offsetZ) * boundsScaling * offsetScalingZ; - const label = options.text[labelIndex]; - const _scale = (options.scales ? options.scales[labelIndex] * scalesScaling : scale) * boundsScaling / font.size; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width * _scale; - const lineHeight = font.size * _scale; - const _maxGlyphTop = (options.maxGlyphTop ? options.maxGlyphTop : this._textMetric.maxTop) * _scale; - const _horizontalAlignment = options.horizontalAlignments ? options.horizontalAlignments[labelIndex] : horizontalAlignment; - switch(_horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).left: - this._offset[0] = _offsetX; - break; - case (0, _mainJs.HorizontalAlignment).center: - this._offset[0] = _offsetX - width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - this._offset[0] = _offsetX - width; - break; - } - const _verticalAlignment = options.verticalAlignments ? options.verticalAlignments[labelIndex] : verticalAlignment; - switch(_verticalAlignment){ - case (0, _mainJs.VerticalAlignment).top: - this._offset[1] = _offsetY - lineHeight / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - this._offset[1] = _offsetY; - break; - case (0, _mainJs.VerticalAlignment).bottom: - this._offset[1] = _offsetY + lineHeight / 2; - break; - } - this._offset[1] -= _maxGlyphTop / 2; - this._offset[2] = _offsetZ; - let positionX = options.positionsX ? options.positionsX[labelIndex] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[labelIndex] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[labelIndex] * positionScalingZ : 0; - if (options.reverseX) positionX = minBoundsX + maxBoundsX - positionX; - if (options.reverseY) positionY = minBoundsY + maxBoundsY - positionY; - if (options.reverseZ) positionZ = minBoundsZ + maxBoundsZ - positionZ; - positionX = (positionX - modelOriginX) * boundsScaling; - positionY = (positionY - modelOriginY) * boundsScaling; - positionZ = (positionZ - modelOriginZ) * boundsScaling; - if (options.rotations) (0, _glMatrix.quat).set(this._quat, options.rotations[labelIndex * 4], options.rotations[labelIndex * 4 + 1], options.rotations[labelIndex * 4 + 2], options.rotations[labelIndex * 4 + 3]); - const pickId = (0, _pickJs.PickHelper).nextPickId(); - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).label, this._vec4); - this.pickIdLookup[pickId] = labelIndex; - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[labelIndex], minOrder, maxOrder, 0, 1); - this._vec2[0] = orderReverse ? 1 - order : order; - } else this._vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) this._vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[labelIndex], minStaggerOrder, maxStaggerOrder, 0, 1); - this._vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else this._vec2[1] = count == 1 ? 0 : i / (count - 1); - let glyphIndex = options.glyphOffsets[labelIndex]; - for (const char of label){ - let glyph = font.glyphs[char]; - if (!glyph) { - font.addGlyph(char); - glyph = font.glyphs[char]; - } - const width = glyph.width * _scale; - const height = glyph.height * _scale; - const top = glyph.top * _scale; - const border = font.border * _scale; - const x0 = this._offset[0] - border; - const x1 = this._offset[0] + width + border; - const y0 = this._offset[1] + top + border; - const y1 = this._offset[1] + top - height - border; - const z0 = this._offset[2]; - (0, _glMatrix.vec3).set(this._topLeft, x0, y0, z0); - (0, _glMatrix.vec3).set(this._topRight, x1, y0, z0); - (0, _glMatrix.vec3).set(this._bottomLeft, x0, y1, z0); - (0, _glMatrix.vec3).set(this._bottomRight, x1, y1, z0); - if (options.rotation || options.rotations) { - (0, _glMatrix.vec3).transformQuat(this._topLeft, this._topLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._topRight, this._topRight, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomLeft, this._bottomLeft, this._quat); - (0, _glMatrix.vec3).transformQuat(this._bottomRight, this._bottomRight, this._quat); - } - (0, _vertexJs.UnitVertex).setRotation(dataView, glyphIndex, this._quat); - this._vec3[0] = positionX + (this._topLeft[0] + this._bottomRight[0]) / 2; - this._vec3[1] = positionY + (this._topLeft[1] + this._bottomRight[1]) / 2; - this._vec3[2] = positionZ + (this._topLeft[2] + this._bottomRight[2]) / 2; - (0, _vertexJs.UnitVertex).setTranslation(dataView, glyphIndex, this._vec3); - this._vec3[0] = Math.abs(x1 - x0); - this._vec3[1] = Math.abs(y1 - y0); - this._vec3[2] = 0.001; - (0, _vertexJs.UnitVertex).setScale(dataView, glyphIndex, this._vec3); - this._vec4[0] = glyph.u0; - this._vec4[1] = glyph.v0; - this._vec4[2] = glyph.u1; - this._vec4[3] = glyph.v1; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, glyphIndex, this._vec4); - (0, _vertexJs.UnitVertex).setIdHover(dataView, glyphIndex, options.hover ? options.hover[labelIndex] : labelIndex); - (0, _vertexJs.UnitVertex).setOrder(dataView, glyphIndex, this._vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, glyphIndex, options.material ? options.material : options.materials ? options.materials[labelIndex] : 0); - (0, _vertexJs.UnitVertex).setTexture(dataView, glyphIndex, 1); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, glyphIndex, this._core.config.sdfBuffer); - this._offset[0] += glyph.advance * _scale; - glyphIndex++; - } - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../helpers/text.js":"keNgB","../constants.js":"dHTsY","../vertex.js":"8lW8V","../helpers/pick.js":"fOypM","../helpers/math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eexvE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -parcelHelpers.export(exports, "ImageBase", ()=>ImageBase); -parcelHelpers.export(exports, "ImageQuad", ()=>ImageQuad); -parcelHelpers.export(exports, "ImageSphere", ()=>ImageSphere); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../vertex.js"); -var _quadJs = require("../meshes/quad.js"); -var _sphereJs = require("../meshes/sphere.js"); -var _constantsJs = require("../constants.js"); -class ImageVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(image){ - this.image = image; - } -} -class ImageBase { - get material() { - return this._material; + get config() { + return this._config; } - get vertices() { - return this._vertices; + get inputManager() { + return this._inputManager; + } + constructor(options) { + setMatrixArrayType(Array); + this._vec3 = create$3(); + this._quat = create$1(); + this._mat4 = create$4(); + this._container = options && options.container ? options.container : document.body; + this._config = new Config$2(this); + this._log = new Log(this); + this._debugText = new DebugText(); + this._inputManager = options && options.useInputManager === false ? null : new Manager(this); + const fontRasterizerOptions = options && options.fontRasterizerOptions ? options.fontRasterizerOptions : { + fontAtlas: new FontAtlas(256, 512), + fontSize: 24, + border: 3, + fontFamily: '"segoe ui semibold", sans-serif', + fontWeight: "normal", + fontStyle: "normal", + baseline: "alphabetic", + maxDistance: 8, + edgeValue: 192 + }; + const fontRasterizer = new FontRasterizer(this, fontRasterizerOptions); + this._font = fontRasterizer.font; + this._paletteResources = new PaletteResources(); + this._previousTime = 0; + this._fps = new Fps(this); + this._modelMMatrix = create$4(); + this._modelPosition = create$3(); + this._modelRotation = create$1(); + this._modelScale = create$3(); + this._smoothedModelPosition = create$3(); + this._smoothedModelRotation = create$1(); + this._smoothedModelScale = create$3(); + this._modelManipulationOrigin = create$3(); + this._camera = new AltAzimuthCamera(this); + this.resetModel(false); } - get indices() { - return this._indices; + getView(view) { + this.getModelPosition(view.position); + this.getModelRotation(view.rotation); + view.scale = this.getModelScale(); } - get indexCount() { - return this._indexCount; + setView(view, isSmooth) { + this.setModelPosition(view.position, isSmooth); + this.setModelRotation(view.rotation, isSmooth); + this.setModelScale(view.scale, isSmooth); } - get isInitialized() { - return this._isInitialized; + lerpView(from, to, time2) { + lerp(this._vec3, from.position, to.position, time2); + this.setModelPosition(this._vec3, false); + slerp(this._quat, from.rotation, to.rotation, time2); + this.setModelRotation(this._quat, false); + this.setModelScale(MathHelper.lerp(from.scale, to.scale, time2), false); } - get mMatrix() { - return this._mMatrix; + resetModel(isSmooth) { + set$3(this._modelPosition, 0, 0, -this._config.modelDistance); + set$3(this._modelScale, this._config.modelSize, this._config.modelSize, this._config.modelSize); + set$1(this._modelRotation, 0, 0, 0, 1); + if (!isSmooth) { + this._syncSmooth(); + } } - get imageData() { - return this._imageData; + resetManipulationOrigin() { + if (!exactEquals$1(this._modelManipulationOrigin, Constants.VECTOR3_ZERO)) { + this._updateManipulationOrigin(Constants.VECTOR3_ZERO); + } } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._hasChanged = true; - } + reset(isSmooth) { + this.resetModel(isSmooth); + this.resetManipulationOrigin(); + this._camera.reset(isSmooth); } - get rotation() { - return this._rotation; + start() { + if (!this._started && this._renderer) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime) => this._tick(currentTime)); + this._started = true; + this._log.write(LogLevel.info, "render loop started"); + if (this.startCallback) { + this.startCallback(); + } + } } - set rotation(value) { - if (!(0, _glMatrix.quat).equals(this._rotation, value)) { - (0, _glMatrix.quat).copy(this._rotation, value); - this._hasChanged = true; + stop() { + if (this._started) { + this._started = false; + if (this._windowAnimationFrame != null) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + this._log.write(LogLevel.info, "render loop stopped"); + } + if (this.stopCallback) { + this.stopCallback(); } + } } - get position() { - return this._position; + checkWebXRSupport() { + const xrSystem = navigator.xr; + if (xrSystem) { + xrSystem.isSessionSupported("immersive-vr").then((supported) => { + if (supported) { + this._log.write(LogLevel.info, "WebXR supported"); + if (this.webXRSupportedCallback) { + this.webXRSupportedCallback(); + } + } + }); + } } - set position(value) { - if (!(0, _glMatrix.vec3).equals(this._position, value)) { - (0, _glMatrix.vec3).copy(this._position, value); - this._hasChanged = true; - } + requestWebXRSession() { + if (this._webXRSession) { + this._webXRSession.end(); + } else { + navigator.xr.requestSession("immersive-vr").then((session) => this._webXRSessionStarted(session)); + } } - get texCoord0() { - return this._texCoord0; + _webXRSessionStarted(session) { + if (this.webXRSessionStartedCallback) { + this.webXRSessionStartedCallback(); + } + this._webXRSession = session; + session.onend = () => this._webXRSessionEnded(); + this._renderer.initializeWebXR(session).then(() => { + if (this._windowAnimationFrame) { + window.cancelAnimationFrame(this._windowAnimationFrame); + this._windowAnimationFrame = null; + } + session.requestAnimationFrame((currentTime, xrframe) => this._tick(currentTime, xrframe)); + }); + session.oninputsourceschange = (event2) => this._webXRInputSourcesChanged(event2); } - set texCoord0(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord0, value)) { - (0, _glMatrix.vec2).copy(this._texCoord0, value); - this._hasChanged = true; + _webXRSessionEnded() { + if (this.webXRSessionEndedCallback) { + this.webXRSessionEndedCallback(); + } + this._webXRSession = null; + this._renderer.controllers.length = 0; + this.start(); + } + _webXRInputSourcesChanged(event2) { + if (event2.added.length > 0) { + const added = event2.added[0]; + if (added.targetRayMode == "tracked-pointer") { + const profiles = added.profiles; + const handedness = added.handedness; + if (this.webXRInputSourceRequestCallback) { + this.webXRInputSourceRequestCallback(profiles, handedness, (response) => { + const options = { + profiles, + handedness, + obj: response.obj, + texture: response.texture + }; + const controller = new Controller(this, options); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + }, (e) => { + this._log.write(LogLevel.error, e); + }); + } else { + const options = {}; + const controller = new Controller(this, options); + this.renderer.controllers.push(this.renderer.createControllerVisual(controller)); + } } + } + if (event2.removed.length > 0) { + this.renderer.controllers.length = 0; + } } - get texCoord1() { - return this._texCoord1; - } - set texCoord1(value) { - if (!(0, _glMatrix.vec2).equals(this._texCoord1, value)) { - (0, _glMatrix.vec2).copy(this._texCoord1, value); - this._hasChanged = true; + _tick(currentTime, xrFrame) { + return __awaiter$3(this, void 0, void 0, function* () { + let elapsedTime = currentTime - this._previousTime; + this._previousTime = currentTime; + if (elapsedTime > 0) { + this.update(elapsedTime, xrFrame); + yield this.render(elapsedTime, xrFrame); + } + if (xrFrame) { + xrFrame.session.requestAnimationFrame((currentTime2, xrframe) => this._tick(currentTime2, xrframe)); + } else if (this._started) { + this._windowAnimationFrame = window.requestAnimationFrame((currentTime2) => this._tick(currentTime2)); } + }); } - get minBoundsX() { - return this._minBoundsX; + update(elapsedTime, xrFrame) { + this._renderer.setSize(elapsedTime); + if (this.updateCallback) { + this.updateCallback(elapsedTime, xrFrame); + } + if (this._config.isDebugVisible) { + this._debugText.clear(); + } + this._fps.update(elapsedTime); + if (this._inputManager) { + this._inputManager.isPickingEnabled = this._config.isTransitionPickingEnabled || this._renderer.transitionTime == 1; + this._inputManager.update(elapsedTime, xrFrame); + } + let amount = Math.min(elapsedTime * this._config.positionSmoothing, 1); + lerp(this._smoothedModelPosition, this._smoothedModelPosition, this._modelPosition, amount); + amount = Math.min(elapsedTime * this._config.rotationSmoothing, 1); + slerp(this._smoothedModelRotation, this._smoothedModelRotation, this._modelRotation, amount); + amount = Math.min(elapsedTime * this._config.scaleSmoothing, 1); + lerp(this._smoothedModelScale, this._smoothedModelScale, this._modelScale, amount); + fromRotationTranslationScaleOrigin(this._modelMMatrix, this._smoothedModelRotation, this._smoothedModelPosition, this._smoothedModelScale, this._modelManipulationOrigin); + this._renderer.mMatrix = this._modelMMatrix; + if (this._config.isDebugVisible) { + this._debugText.addLine(`mod pos ${this._smoothedModelPosition[0] < 0 ? "" : " "}${this._smoothedModelPosition[0].toFixed(3)},${this._smoothedModelPosition[1] < 0 ? "" : " "}${this._smoothedModelPosition[1].toFixed(3)},${this._smoothedModelPosition[2] < 0 ? "" : " "}${this._smoothedModelPosition[2].toFixed(3)}`); + this._debugText.addLine(`mod rot ${this._smoothedModelRotation[0] < 0 ? "" : " "}${this._smoothedModelRotation[0].toFixed(3)},${this._smoothedModelRotation[1] < 0 ? "" : " "}${this._smoothedModelRotation[1].toFixed(3)},${this._smoothedModelRotation[2] < 0 ? "" : " "}${this._smoothedModelRotation[2].toFixed(3)},${this._smoothedModelRotation[3] < 0 ? "" : " "}${this._smoothedModelRotation[3].toFixed(3)}`); + this._debugText.addLine(`mod siz ${this._smoothedModelScale[0].toFixed(3)}`); + this._debugText.addLine(`man ori ${this._modelManipulationOrigin[0] < 0 ? "" : " "}${this._modelManipulationOrigin[0].toFixed(3)},${this._modelManipulationOrigin[1] < 0 ? "" : " "}${this._modelManipulationOrigin[1].toFixed(3)},${this._modelManipulationOrigin[2] < 0 ? "" : " "}${this._modelManipulationOrigin[2].toFixed(3)}`); + this._debugText.addLine(`scr dst ${this._config.screenDistance.toFixed(3)}`); + this._debugText.addLine(`cam fov ${Math.round(AngleHelper.radiansToDegrees(this._config.fov))}`); + this._debugText.addLine(`tbf tot ${this._renderer.transitionBuffers.length}`); + } + if (!xrFrame) { + this._camera.width = this._renderer.width; + this._camera.height = this._renderer.height; + this._camera.modelMMatrix = this._modelMMatrix; + this._camera.modelPosition = this._smoothedModelPosition; + this._camera.modelRotation = this._smoothedModelRotation; + this._camera.modelScale = this._smoothedModelScale; + this._camera.modelManipulationOrigin = this._modelManipulationOrigin; + this._camera.update(elapsedTime); + this._renderer.vMatrices = this._camera.vMatrices; + this._renderer.mvMatrices = this._camera.mvMatrices; + this._renderer.pMatrices = this._camera.pMatrices; + this._renderer.inverseVMatrices = this._camera.inverseVMatrices; + this._renderer.inversePMatrices = this._camera.inversePMatrices; + } + this._renderer.prepare(xrFrame); + if (!xrFrame && this._config.stereoMode == StereoMode.none) { + this._renderer.pickPMatrix = this._camera.pMatrices[0]; + } else { + const fov = MatrixHelper.fieldOfViewFromProjectionMatrix(this._renderer.pMatrices[0]); + perspective(this._mat4, fov, this._renderer.width / this._renderer.height, this._config.nearPlane, this._config.farPlane); + this._renderer.pickPMatrix = this._mat4; + } + if (this._renderer.isInitialized) { + this._renderer.update(elapsedTime); + } } - set minBoundsX(value) { - if (this._minBoundsX != value) { - this._minBoundsX = value; - this._hasChanged = true; + render(elapsedTime, xrFrame) { + return __awaiter$3(this, void 0, void 0, function* () { + this._fps.render(); + if (this._renderer.isInitialized) { + yield this._renderer.render(elapsedTime, xrFrame); + if (this.afterRenderCallback) { + this.afterRenderCallback(); + } } + }); } - get minBoundsY() { - return this._minBoundsY; + _syncSmooth() { + copy$3(this._smoothedModelPosition, this._modelPosition); + copy$3(this._smoothedModelScale, this._modelScale); + copy$1(this._smoothedModelRotation, this._modelRotation); + } + _updateManipulationOrigin(position2) { + this._log.write(LogLevel.info, `manipulation origin ${position2[0].toFixed(3)},${position2[1].toFixed(3)},${position2[2].toFixed(3)}`); + this._camera.updateModelManipulationOrigin(this._modelManipulationOrigin, position2); + copy$3(this._modelManipulationOrigin, position2); + transformMat4$2(this._vec3, this._modelManipulationOrigin, this._modelMMatrix); + subtract(this._modelPosition, this._vec3, this._modelManipulationOrigin); + copy$3(this._smoothedModelPosition, this._modelPosition); + if (this.manipulationOriginChangedCallback) { + const result = { + x: position2[0], + y: position2[1], + z: position2[2] + }; + this.manipulationOriginChangedCallback(result); + } } - set minBoundsY(value) { - if (this._minBoundsY != value) { - this._minBoundsY = value; - this._hasChanged = true; + pickLasso(x02, y02, x12, y12, pickType) { + const inverseMMatrix = create$4(); + invert(inverseMMatrix, this._modelMMatrix); + const sets = []; + const nearPositions = [create$3(), create$3(), create$3(), create$3()]; + const farPositions = [create$3(), create$3(), create$3(), create$3()]; + const directions = [create$3(), create$3(), create$3(), create$3()]; + this._camera.unproject(nearPositions[0], x02, y12, -1); + this._camera.unproject(farPositions[0], x02, y12, 1); + this._camera.unproject(nearPositions[1], x12, y12, -1); + this._camera.unproject(farPositions[1], x12, y12, 1); + this._camera.unproject(nearPositions[2], x12, y02, -1); + this._camera.unproject(farPositions[2], x12, y02, 1); + this._camera.unproject(nearPositions[3], x02, y02, -1); + this._camera.unproject(farPositions[3], x02, y02, 1); + for (let i = 0; i < 4; i++) { + transformMat4$2(nearPositions[i], nearPositions[i], inverseMMatrix); + transformMat4$2(farPositions[i], farPositions[i], inverseMMatrix); + subtract(directions[i], farPositions[i], nearPositions[i]); + normalize$2(directions[i], directions[i]); + } + const normals = [create$3(), create$3(), create$3(), create$3()]; + const d = []; + for (let i = 0; i < 4; i++) { + cross(normals[i], directions[(i + 1) % 4], directions[i]); + normalize$2(normals[i], normals[i]); + d.push(-dot$1(normals[i], nearPositions[i])); + } + if (pickType == PickType.data) { + const translation = create$3(); + for (let i = 0; i < this._renderer.transitionBuffers.length; i++) { + const transitionBuffer = this._renderer.transitionBuffers[i]; + const set2 = /* @__PURE__ */ new Set(); + if (transitionBuffer.isVisible) { + const start = window.performance.now(); + const currentBuffer = transitionBuffer.currentBuffer; + const lookup2 = currentBuffer.lookup; + for (let j = 0; j < currentBuffer.length; j++) { + const id2 = currentBuffer.ids[j]; + const index2 = lookup2[id2]; + if (index2 != null) { + UnitVertex.getTranslation(currentBuffer.dataView, index2, translation); + let isInside = true; + for (let k = 0; k < 4; k++) { + let distance2 = dot$1(normals[k], translation); + distance2 += d[k]; + if (distance2 < 0) { + isInside = false; + break; + } + } + if (isInside) { + set2.add(id2); + } + } + } + if (set2.size > 0) { + this._log.write(LogLevel.info, `lasso transition buffer ${i} picked ${set2.size} ${Math.round(window.performance.now() - start)}ms`); + } + } + sets.push(set2); } + } + return sets; } - get minBoundsZ() { - return this._minBoundsZ; + } + const StereoMode = { + none: "none", + split: "split", + anaglyph: "anaglyph", + left: "left", + right: "right" + }; + const HorizontalAlignment = { + left: "left", + center: "center", + right: "right" + }; + const VerticalAlignment = { + top: "top", + center: "center", + bottom: "bottom" + }; + const AxesTextOrientation = { + parallel: "parallel", + perpendicular: "perpendicular" + }; + const AxesVisibility = { + none: "none", + current: "current", + previous: "previous" + }; + const PickType = { + none: 0, + data: 1, + label: 2, + axesDivision: 3, + axesTitle: 4, + axesLabel: 5, + axesHeading: 6 + }; + const Theme = { + dark: "dark", + light: "light" + }; + const HighlightMode = { + luminance: "luminance", + color: "color" + }; + const UnitType = { + block: "block", + blockSdf: "blockSdf", + sphere: "sphere", + sphereSdf: "sphereSdf", + cylinder: "cylinder", + cylinderSdf: "cylinderSdf", + hexPrism: "hexPrism", + hexPrismSdf: "hexPrismSdf", + sdf: "sdf", + disk: "disk", + ringSdf: "ringSdf" + }; + const SingleTouchAction = { + translate: "translate", + rotate: "rotate", + lasso: "lasso" + }; + const MouseWheelAction = { + zoom: "zoom", + rotateY: "rotateY" + }; + const LogLevel = { + trace: 0, + debug: 1, + info: 2, + warn: 3, + error: 4 + }; + const Edge3D = { + topFront: 0, + topRight: 1, + topBack: 2, + bottomRight: 5, + frontRight: 8, + backRight: 9 + }; + const RenderMode = { + color: "color" + }; + let LabelSetVisual$2 = class LabelSetVisual { + render(elapsedTime, xrFrame) { } - set minBoundsZ(value) { - if (this._minBoundsZ != value) { - this._minBoundsZ = value; - this._hasChanged = true; - } + update(elapsedTime) { } - get maxBoundsX() { - return this._maxBoundsX; + constructor(labelSet) { + this.label = labelSet; } - set maxBoundsX(value) { - if (this._maxBoundsX != value) { - this._maxBoundsX = value; - this._hasChanged = true; - } + }; + class LabelBase { + get material() { + return this._material; } - get maxBoundsY() { - return this._maxBoundsY; + get vertices() { + return this._vertices; } - set maxBoundsY(value) { - if (this._maxBoundsY != value) { - this._maxBoundsY = value; - this._hasChanged = true; - } + get verticesView() { + return this._verticesView; } - get maxBoundsZ() { - return this._maxBoundsZ; - } - set maxBoundsZ(value) { - if (this._maxBoundsZ != value) { - this._maxBoundsZ = value; - this._hasChanged = true; - } - } - constructor(core, options){ - this._core = core; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._origin = (0, _glMatrix.vec3).create(); - this._translation = (0, _glMatrix.vec3).create(); - this._scale = (0, _glMatrix.vec3).create(); - this._transform = (0, _glMatrix.mat4).create(); - this._imageData = options.imageData; - this._minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - this._minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - this._minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - this._maxBoundsX = options.maxBoundsX === undefined ? 1 : options.maxBoundsX; - this._maxBoundsY = options.maxBoundsY === undefined ? 1 : options.maxBoundsY; - this._maxBoundsZ = options.maxBoundsZ === undefined ? 1 : options.maxBoundsZ; - this._position = options.position ? (0, _glMatrix.vec3).clone(options.position) : (0, _glMatrix.vec3).create(); - this._rotation = options.rotation ? (0, _glMatrix.quat).clone(options.rotation) : (0, _glMatrix.quat).create(); - this._texCoord0 = options.texCoord0 ? (0, _glMatrix.vec2).clone(options.texCoord0) : (0, _glMatrix.vec2).fromValues(0, 0); - this._texCoord1 = options.texCoord1 ? (0, _glMatrix.vec2).clone(options.texCoord1) : (0, _glMatrix.vec2).fromValues(1, 1); - this._material = options.material === undefined ? -1 : options.material; - this._hasChanged = true; + get indices() { + return this._indices; } -} -class ImageQuad extends ImageBase { - get width() { - return this._width; + get indexCount() { + return this._indexCount; } - set width(value) { - if (this._width != value) { - this._width = value; - this._hasChanged = true; - } + get isInitialized() { + return this._isInitialized; } - get height() { - return this._height; + get mMatrix() { + return this._mMatrix; } - set height(value) { - if (this._height != value) { - this._height = value; - this._hasChanged = true; - } + get materialType() { + return this._materialType; } - constructor(core, options){ - super(core, options); - this._width = options.width === undefined ? 1 : options.width; - this._height = options.height === undefined ? 1 : options.height; - this._texTransform = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).translate(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(0, 1, 0)); - (0, _glMatrix.mat4).scale(this._texTransform, this._texTransform, (0, _glMatrix.vec3).fromValues(1, -1, 1)); + get materialColor() { + return this._materialColor; } - initialize() { - this._vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * 4); - this._indices = (0, _quadJs.Quad).INDICES; - this._indexCount = this._indices.length; - this._isInitialized = true; + get materialFuzz() { + return this._materialFuzz; } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(this._translation, this._position, this._origin); - (0, _glMatrix.vec3).scale(this._translation, this._translation, boundsScaling); - (0, _glMatrix.vec3).set(this._scale, this._width, this._height, 1); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); - this._verticesView = (0, _quadJs.Quad).normalTextured(this._transform, this._texTransform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} -class ImageSphere extends ImageBase { - get radius() { - return this._radius; - } - set radius(value) { - if (this._radius != value) { - this._radius = value; - this._hasChanged = true; - } - } - constructor(core, options){ - super(core, options); - this._radius = options.radius === undefined ? 0.5 : options.radius; - this._slices = options.slices === undefined ? 72 : options.slices; - this._stacks = options.stacks === undefined ? 36 : options.stacks; + get materialGloss() { + return this._materialGloss; } - initialize() { - this._sphere = new (0, _sphereJs.Sphere)(this._core); - this._vertices = this._sphere.normalTextured(this._slices, this._stacks, (0, _constantsJs.Constants).MAT4_IDENTITY).buffer; - this._indices = this._sphere.indices(this._slices, this._stacks); - this._indexCount = this._indices.length; - this._isInitialized = true; + get segmentColor() { + return this._segmentColor; } - update(elapsedTime) { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const modelSizeX = this._maxBoundsX - this._minBoundsX; - const modelSizeY = this._maxBoundsY - this._minBoundsY; - const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); - (0, _glMatrix.vec3).set(this._scale, this._radius, this._radius, this._radius); - (0, _glMatrix.vec3).scale(this._scale, this._scale, boundsScaling); - (0, _glMatrix.mat4).fromRotationTranslationScaleOrigin(this._transform, this._rotation, this._position, this._scale, this._origin); - this._verticesView = this._sphere.normalTextured(this._slices, this._stacks, this._transform); - this._vertices = this._verticesView.buffer; - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"erHGu","../vertex.js":"8lW8V","../meshes/quad.js":"6dxCM","../meshes/sphere.js":"2nvcG","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2nvcG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sphere", ()=>Sphere); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _vertexJs = require("../vertex.js"); -class Sphere { - constructor(core){} - positions(slices, stacks, transform) { - const vertices = new Float32Array((slices + 1) * (stacks + 1) * (0, _vertexJs.PositionVertex).SIZE); - const position = (0, _glMatrix.vec3).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++){ - const latitude = 90 - 180 * stack / stacks; - for(let slice = 0; slice <= slices; slice++){ - const longitude = 360 * slice / slices - 180; - (0, _angleJs.AngleHelper).sphericalToCartesian(1, longitude, latitude, position); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionVertex).setPosition(vertices, index++, position); - } - } - return vertices; - } - indices(slices, stacks) { - const indices = new Uint16Array(slices * stacks * 6); - let index = 0; - for(let stack = 0; stack < stacks; stack++){ - const top = stack * (slices + 1); - const bottom = (stack + 1) * (slices + 1); - for(let slice = 0; slice < slices; slice++){ - if (stack != 0) { - indices[index++] = top + slice; - indices[index++] = bottom + slice; - indices[index++] = top + slice + 1; - } - if (stack != stacks - 1) { - indices[index++] = top + slice + 1; - indices[index++] = bottom + slice; - indices[index++] = bottom + slice + 1; - } - } - } - return indices; - } - textured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionTextureVertex).setTexCoord(verticesView, i, texCoord); - } - return verticesView; - } - normalTextured(slices, stacks, transform, texTransform = (0, _constantsJs.Constants).MAT4_IDENTITY) { - const positions = this.positions(slices, stacks, transform); - const texCoords = this._texCoords(slices, stacks, texTransform); - const vertices = new ArrayBuffer((0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES * positions.length / 3); - const verticesView = new DataView(vertices); - const position = (0, _glMatrix.vec3).create(); - const texCoord = (0, _glMatrix.vec2).create(); - const normal = (0, _glMatrix.vec3).create(); - for(let i = 0; i < positions.length / (0, _vertexJs.PositionVertex).SIZE; i++){ - (0, _glMatrix.vec3).set(position, positions[i * (0, _vertexJs.PositionVertex).SIZE], positions[i * (0, _vertexJs.PositionVertex).SIZE + 1], positions[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec2).set(texCoord, texCoords[i * 2], texCoords[i * 2 + 1]); - (0, _vertexJs.PositionNormalTextureVertex).setPosition(verticesView, i, position); - (0, _vertexJs.PositionNormalTextureVertex).setTexCoord(verticesView, i, texCoord); - (0, _glMatrix.vec3).set(normal, position[0] - transform[12], position[1] - transform[13], position[2] - transform[14]); - (0, _glMatrix.vec3).normalize(normal, normal); - (0, _vertexJs.PositionNormalTextureVertex).setNormal(verticesView, i, normal); - } - return verticesView; - } - _texCoords(slices, stacks, transform) { - const texCoords = new Float32Array((slices + 1) * (stacks + 1) * 2); - const texCoord = (0, _glMatrix.vec2).create(); - let index = 0; - for(let stack = 0; stack <= stacks; stack++)for(let slice = 0; slice <= slices; slice++){ - (0, _glMatrix.vec2).set(texCoord, slice / slices, stack / stacks); - (0, _glMatrix.vec2).transformMat4(texCoord, texCoord, transform); - texCoords[index++] = texCoord[0]; - texCoords[index++] = texCoord[1]; - } - return texCoords; - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/angle.js":"hBXkO","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6qIGL":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "KeyVisual", ()=>KeyVisual); -parcelHelpers.export(exports, "KeyBase", ()=>KeyBase); -parcelHelpers.export(exports, "NominalKey", ()=>NominalKey); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _textJs = require("../helpers/text.js"); -var _scatterJs = require("../layouts/scatter.js"); -var _mathJs = require("../helpers/math.js"); -var _labelsJs = require("./labels.js"); -class KeyVisual { - render(elapsedTime, xrFrame) {} - update(elapsedTime) {} - constructor(key){ - this.key = key; - } -} -class KeyBase { - get isInitialized() { - return this._isInitialized; + get scale() { + return this._scale; } - get minBoundsX() { - return this._minBoundsX; + set scale(value2) { + if (this._scale != value2) { + this._scale = value2; + this._hasChanged = true; + } } - set minBoundsX(value) { - if (value != this.minBoundsX) { - this._minBoundsX = value; - this._hasChanged = true; - } + get font() { + return this._font; } - get maxBoundsX() { - return this._maxBoundsX; + set font(value2) { + if (this._font != value2) { + this._font = value2; + this._hasChanged = true; + } } - set maxBoundsX(value) { - if (value != this.minBoundsX) { - this._maxBoundsX = value; - this._hasChanged = true; - } + get rotation() { + return this._rotation; } - get minBoundsY() { - return this._minBoundsY; + set rotation(value2) { + if (this._rotation != value2) { + this._rotation = value2; + this._hasChanged = true; + } } - set minBoundsY(value) { - if (value != this.minBoundsY) { - this._minBoundsY = value; - this._hasChanged = true; - } + set reverseX(value2) { + if (this._reverseX != value2) { + this._reverseX = value2; + this._hasChanged = true; + } } - get maxBoundsY() { - return this._maxBoundsY; + set reverseY(value2) { + if (this._reverseY != value2) { + this._reverseY = value2; + this._hasChanged = true; + } } - set maxBoundsY(value) { - if (value != this.minBoundsY) { - this._maxBoundsY = value; - this._hasChanged = true; - } + set reverseZ(value2) { + if (this._reverseZ != value2) { + this._reverseZ = value2; + this._hasChanged = true; + } } - get minBoundsZ() { - return this._minBoundsZ; + get horizontalAlignment() { + return this._horizontalAlignment; } - set minBoundsZ(value) { - if (value != this.minBoundsZ) { - this._minBoundsZ = value; - this._hasChanged = true; - } + set horizontalAlignment(value2) { + if (this._horizontalAlignment != value2) { + this._horizontalAlignment = value2; + this._hasChanged = true; + } } - get maxBoundsZ() { - return this._maxBoundsZ; + get verticalAlignment() { + return this._verticalAlignment; } - set maxBoundsZ(value) { - if (value != this.minBoundsZ) { - this._maxBoundsZ = value; - this._hasChanged = true; - } + set verticalAlignment(value2) { + if (this._verticalAlignment != value2) { + this._verticalAlignment = value2; + this._hasChanged = true; + } } - get unitType() { - return this._unitType; + get offsetX() { + return this._offsetX; } - set unitType(value) { - if (this._unitType != value) { - this._unitType = value; - this._hasChanged = true; - } + set offsetX(value2) { + if (this._offsetX != value2) { + this._offsetX = value2; + this._hasChanged = true; + } } - get palette() { - return this._palette; + get offsetY() { + return this._offsetY; } - set palette(value) { - if (this._palette != value) { - this._palette = value; - this._hasChanged = true; - } + set offsetY(value2) { + if (this._offsetY != value2) { + this._offsetY = value2; + this._hasChanged = true; + } } - get materials() { - return this._materials; + get offsetZ() { + return this._offsetZ; } - set materials(value) { - if (this._materials != value) { - this._materials = value; - this._hasChanged = true; - } + set offsetZ(value2) { + if (this._offsetZ != value2) { + this._offsetZ = value2; + this._hasChanged = true; + } } - get sizesX() { - return this._sizesX; + get maxGlyphTop() { + return this._maxGlyphTop; } - set sizesX(value) { - if (this._sizesX != value) { - this._sizesX = value; - this._hasChanged = true; - } + set maxGlyphTop(value2) { + if (this._maxGlyphTop != value2) { + this._maxGlyphTop = value2; + this._hasChanged = true; + } } - get sizesY() { - return this._sizesY; + get maxGlyphHeight() { + return this._maxGlyphHeight; } - set sizesY(value) { - if (this._sizesY != value) { - this._sizesY = value; - this._hasChanged = true; - } + set maxGlyphHeight(value2) { + if (this._maxGlyphHeight != value2) { + this._maxGlyphHeight = value2; + this._hasChanged = true; + } } - get sizesZ() { - return this._sizesZ; + constructor(core, options) { + this._core = core; + this._offset = create$3(); + this._vec3 = create$3(); + this._vec4 = create$2(); + this._mMatrix = create$4(); + this._indexCount = 0; + this._maxGlyphs = options.maxGlyphs; + this._textMetric = { width: 0, maxHeight: 0, maxTop: 0 }; + this.scale = options.scale ? options.scale : 1; + this.offsetX = options.offsetX ? options.offsetX : 0; + this.offsetY = options.offsetY ? options.offsetY : 0; + this.offsetZ = options.offsetZ ? options.offsetZ : 0; + this.reverseX = options.reverseX; + this.reverseY = options.reverseY; + this.reverseZ = options.reverseZ; + this.rotation = options.rotation; + this.maxGlyphTop = options.maxGlyphTop; + this.horizontalAlignment = options.horizontalAlignment === void 0 ? HorizontalAlignment.center : options.horizontalAlignment; + this.verticalAlignment = options.verticalAlignment === void 0 ? VerticalAlignment.center : options.verticalAlignment; + this._material = options.material; + this.borderWidth = core.config.textBorderWidth; + this.gamma = 0; + this._materialType = options.materialType || 0; + this._materialColor = options.materialColor || core.config.textColor; + this._materialFuzz = options.materialFuzz || 0; + this._materialGloss = options.materialGloss || 0; + this._segmentColor = options.segmentColor; } - set sizesZ(value) { - if (this._sizesZ != value) { - this._sizesZ = value; - this._hasChanged = true; - } + initialize() { + this._vertices = new ArrayBuffer(PositionTexturePickVertex.SIZE_BYTES * this._maxGlyphs * 4); + this._verticesView = new DataView(this._vertices); + this._indices = new Uint32Array(this._maxGlyphs * 6); + this._isInitialized = true; } - get spacing() { - return this._spacing; + update(elapsedTime) { } - set spacing(value) { - if (this._spacing != value) { - this._spacing = value; - this._hasChanged = true; - } + } + class LabelSet extends LabelBase { + get materials() { + return this._materials; } - get textVertices() { - return this._textVertices; + get materialTypes() { + return this._materialTypes; } - get textIndices() { - return this._textIndices; + get materialColors() { + return this._materialColors; } - get labelMMatrix() { - return this._labelMMatrix; + get materialFuzzes() { + return this._materialFuzzes; } - set labelPositions(value) { - if (this._labelPositions != value) { - this._labelPositions = value; - this._hasChanged = true; - } + get materialGlosses() { + return this._materialGlosses; } - set labels(value) { - if (this._labels != value) { - this._labels = value; - this._hasChanged = true; - } + get segmentColors() { + return this._segmentColors; } - set labelSize(value) { - if (this._labelSize != value) { - this._labelSize = value; - this._hasChanged = true; - } + get minBoundsX() { + return this._minBoundsX; } - get labelOrientation() { - return this._orientation; + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - set labelOrientation(value) { - if (this._orientation != value) { - this._orientation = value; - this._hasChanged = true; - } + get minBoundsY() { + return this._minBoundsY; } - get titleIndexCount() { - return this._titleIndexCount; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - get titleIndexOffset() { - return this._titleIndexOffset; + get minBoundsZ() { + return this._minBoundsZ; } - get titleMMatrix() { - return this._titleMMatrix; + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - set title(value) { - if (this._title != value) { - this._title = value; - this._hasChanged = true; - } + get maxBoundsX() { + return this._maxBoundsX; } - set titleSize(value) { - if (this._titleSize != value) { - this._titleSize = value; - this._hasChanged = true; - } + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - constructor(core, options){ - this._core = core; - this._textMetric = { - width: 0, - maxHeight: 0, - maxTop: 0 - }; + get maxBoundsY() { + return this._maxBoundsY; } - initialize() { - this._isInitialized = true; + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - update(elapsedTime) { - if (this.isInitialized) { - if (this._hasChanged) { - const start = window.performance.now(); - this._hasChanged = false; - (0, _glMatrix.vec3).set(this._size, this._maxBoundsX - this._minBoundsX, this._maxBoundsY - this._minBoundsY, this._maxBoundsZ - this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._size[0], this._size[1]), this._size[2]); - (0, _glMatrix.vec3).scale(this._size, this._size, 1 / maxBounds); - this._update(this._size); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `key updated ${Math.round(window.performance.now() - start)}ms`); - } - } + get maxBoundsZ() { + return this._maxBoundsZ; } - _update(size) {} -} -class NominalKey extends KeyBase { - constructor(core, options){ - super(core, options); - const minBoundsX = options.minBoundsX === undefined ? 0 : options.minBoundsX; - const minBoundsY = options.minBoundsY === undefined ? 0 : options.minBoundsY; - const minBoundsZ = options.minBoundsZ === undefined ? 0 : options.minBoundsZ; - const maxBoundsX = options.maxBoundsX === undefined ? 0 : options.maxBoundsX; - const maxBoundsY = options.maxBoundsY === undefined ? 0 : options.maxBoundsY; - const maxBoundsZ = options.maxBoundsZ === undefined ? 0 : options.maxBoundsZ; - const positionX = options.positionX === undefined ? 0 : options.positionX; - const positionY = options.positionY === undefined ? 0 : options.positionY; - const positionZ = options.positionZ === undefined ? 0 : options.positionZ; - const sizeX = options.sizeX === undefined ? 1 : options.sizeX; - const sizeY = options.sizeY === undefined ? 1 : options.sizeY; - const sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - const spacing = options.spacing === undefined ? 1 : options.spacing; - const labelScale = options.labelScale === undefined ? 1 : options.labelScale; - const labelMaxGlyphs = options.labelMaxGlyphs === undefined ? this._core.config.keyLabelMaxGlyphs : options.labelMaxGlyphs; - const titleScale = options.titleScale === undefined ? 1 : options.titleScale; - const titleMaxGlyphs = options.titleMaxGlyphs === undefined ? this._core.config.keyTitleMaxGlyphs : options.titleMaxGlyphs; - const font = options.font ? options.font : this._core.font; - const horizontalAlignment = options.horizontalAlignment === undefined ? (0, _mainJs.HorizontalAlignment).center : options.horizontalAlignment; - const verticalAlignment = options.verticalAlignment === undefined ? (0, _mainJs.VerticalAlignment).center : options.verticalAlignment; - const orientation = options.orientation === undefined ? (0, _mainJs.Orientation).horizontal : options.orientation; - const labelPosition = options.labelPosition === undefined ? (0, _mainJs.Edge2D).right : options.labelPosition; - const labelOrientation = options.labelOrientation === undefined ? (0, _mainJs.Orientation).horizontal : options.labelOrientation; - const rotation = (0, _glMatrix.quat).create(); - let count = options.values.length; - const ids = new Uint32Array(count); - let minValue = Number.MAX_VALUE; - let maxValue = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - ids[i] = i; - const value = options.values[i]; - minValue = Math.min(minValue, value); - maxValue = Math.max(maxValue, value); - } - const materialIds = new Uint32Array(count); - for(let i = 0; i < count; i++)materialIds[i] = (0, _mathJs.MathHelper).normalize(options.values[i], minValue, maxValue, 0, options.palette.length / 4 - 1); - let glyphCount = 0; - let totalLabelWidth = 0; - let maxLabelWidth = 0; - for(let i = 0; i < count; i++){ - const label = (0, _textJs.TextHelper).truncate(options.labels[i], labelMaxGlyphs); - glyphCount += label.length; - (0, _textJs.TextHelper).measure(font, label, this._textMetric); - const width = this._textMetric.width; - totalLabelWidth += width; - maxLabelWidth = Math.max(width, maxLabelWidth); - } - let titleWidth = 0; - let title; - if (options.title) { - title = (0, _textJs.TextHelper).truncate(options.title, titleMaxGlyphs); - glyphCount += title.length; - (0, _textJs.TextHelper).measure(font, title, this._textMetric); - titleWidth = this._textMetric.width; - } - let width; - let height; - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - case (0, _mainJs.Orientation).vertical: - switch(labelPosition){ - case (0, _mainJs.Edge2D).bottom: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).left: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).right: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - case (0, _mainJs.Edge2D).top: - switch(labelOrientation){ - case (0, _mainJs.Orientation).horizontal: - break; - case (0, _mainJs.Orientation).vertical: - break; - } - break; - } - break; - } - switch(orientation){ - case (0, _mainJs.Orientation).horizontal: - width = Math.max(sizeX * count + spacing * (count - 1) + totalLabelWidth, titleWidth); - height = sizeY; - if (options.title) height += titleScale; - break; - case (0, _mainJs.Orientation).vertical: - width = Math.max(sizeX + labelScale / 2 + maxLabelWidth, titleWidth); - height = sizeY * count + spacing * (count - 1); - if (options.title) height += titleScale; - break; - } - let originX = positionX; - let originY = positionY; - let originZ = positionZ; - switch(horizontalAlignment){ - case (0, _mainJs.HorizontalAlignment).center: - break; - case (0, _mainJs.HorizontalAlignment).left: - originX += width / 2; - break; - case (0, _mainJs.HorizontalAlignment).right: - originX -= width / 2; - break; - } - switch(verticalAlignment){ - case (0, _mainJs.VerticalAlignment).bottom: - originY += height / 2; - break; - case (0, _mainJs.VerticalAlignment).center: - break; - case (0, _mainJs.VerticalAlignment).top: - originY -= height / 2; - break; - } - const positionsX = new Float64Array(count); - const positionsY = new Float64Array(count); - const positionsZ = new Float64Array(count); - for(let i = 0; i < count; i++){ - positionsX[i] = originX - width / 2 + sizeX / 2; - positionsY[i] = originY + height / 2 - i * (sizeY + spacing); - positionsZ[i] = originZ + sizeZ / 2; - } - const scatter = new (0, _scatterJs.Scatter)(this._core); - const scatterLayoutOptions = { - positionsX: positionsX, - positionsY: positionsY, - positionsZ: positionsZ - }; - scatter.layout(this._transitionBuffer.currentBuffer, ids, scatterLayoutOptions); - const scatterVertexOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - colors: options.values, - minColor: minValue, - maxColor: maxValue, - sizeScalingX: sizeX, - sizeScalingY: sizeY, - sizeScalingZ: sizeZ, - materials: materialIds - }; - scatter.update(this._transitionBuffer.currentBuffer, ids, scatterVertexOptions); - const labelSetOptions = { - text: options.labels, - maxGlyphs: glyphCount, - scale: labelScale, - font: font - }; - const labelSet = new (0, _labelsJs.LabelSet)(this._core, labelSetOptions); - if (options.title) count++; - const labelPositionsX = new Float64Array(count); - const labelPositionsY = new Float64Array(count); - const labelPositionsZ = new Float64Array(count); - for(let i = 0; i < (options.title ? count - 1 : count); i++){ - labelPositionsX[i] = originX - width / 2 + sizeX + labelScale / 2; - labelPositionsY[i] = positionsY[i]; - labelPositionsZ[i] = originZ; - } - options.title; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - labelSet.positionsX = positionsX; - labelSet.positionsY = positionsY; - labelSet.positionsZ = positionsZ; - labelSet.rotation = new Float64Array([ - rotation[0], - rotation[1], - rotation[2], - rotation[3] - ]); - labelSet.horizontalAlignment = (0, _mainJs.HorizontalAlignment).left; - } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../helpers/text.js":"keNgB","../layouts/scatter.js":"kIsBP","../helpers/math.js":"6Lv1i","./labels.js":"dXJPK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kIsBP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Scatter", ()=>Scatter); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Scatter extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - let positionY = options.positionsY ? options.positionsY[id] * positionScalingY : 0; - let positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const sizesX = options.sizes ? options.sizes : options.sizesX; - const sizesY = options.sizes ? options.sizes : options.sizesY; - const sizesZ = options.sizes ? options.sizes : options.sizesZ; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - if (options.rotation) { - _quat[0] = options.rotation[0]; - _quat[1] = options.rotation[1]; - _quat[2] = options.rotation[2]; - _quat[3] = options.rotation[3]; - } else (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id]) : 1) * sizeScalingX, minSize) * this._boundsScaling; - _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id]) : 1) * sizeScalingY, minSize) * this._boundsScaling; - _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - if (options.rotations) { - _quat[0] = options.rotations[id * 4]; - _quat[1] = options.rotations[id * 4 + 1]; - _quat[2] = options.rotations[id * 4 + 2]; - _quat[3] = options.rotations[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - } else (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setParameter1(dataView, index, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id] : 0); - (0, _vertexJs.UnitVertex).setParameter2(dataView, index, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id] : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ijsq1":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LayoutBase", ()=>LayoutBase); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _boundsJs = require("../helpers/bounds.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -class LayoutBase { - get facetScaling() { - return this._facetScaling; + get positionsX() { + return this._positionsX; } - offsetX(facetCoordX) { - return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; + set positionsX(value2) { + if (this._positionsX != value2) { + this._positionsX = value2; + this._hasChanged = true; + } } - offsetY(facetCoordY) { - return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; + get positionsY() { + return this._positionsY; } - offsetZ(facetCoordZ) { - return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; - } - constructor(core){ - this._core = core; - this.modelOriginX = 0; - this.modelOriginY = 0; - this.modelOriginZ = 0; - this.minModelBoundsX = 0; - this.minModelBoundsY = 0; - this.minModelBoundsZ = 0; - this.maxModelBoundsX = 0; - this.maxModelBoundsY = 0; - this.maxModelBoundsZ = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._facetSpacingX = 0; - this._facetSpacingY = 0; - this._facetSpacingZ = 0; - this._facetSizeX = 0; - this._facetSizeY = 0; - this._facetSizeZ = 0; - this._facetsX = 1; - this._facetsY = 1; - this._facetsZ = 1; + set positionsY(value2) { + if (this._positionsY != value2) { + this._positionsY = value2; + this._hasChanged = true; + } } - _updateModelBounds(options) { - this.minModelBoundsX = options.minBoundsX === undefined ? this.minLayoutBoundsX : options.minBoundsX; - this.minModelBoundsY = options.minBoundsY === undefined ? this.minLayoutBoundsY : options.minBoundsY; - this.minModelBoundsZ = options.minBoundsZ === undefined ? this.minLayoutBoundsZ : options.minBoundsZ; - this.maxModelBoundsX = options.maxBoundsX === undefined ? this.maxLayoutBoundsX : options.maxBoundsX; - this.maxModelBoundsY = options.maxBoundsY === undefined ? this.maxLayoutBoundsY : options.maxBoundsY; - this.maxModelBoundsZ = options.maxBoundsZ === undefined ? this.maxLayoutBoundsZ : options.maxBoundsZ; - this._isFacetted = options.facetsX !== undefined && options.facetsX > 1 && options.facetCoordsX != null || options.facetsY !== undefined && options.facetsY > 1 && options.facetCoordsY != null || options.facetsZ !== undefined && options.facetsZ > 1 && options.facetCoordsZ != null; - this._facetSpacingX = options.facetSpacingX === undefined ? 0 : options.facetSpacingX; - this._facetSpacingY = options.facetSpacingY === undefined ? 0 : options.facetSpacingY; - this._facetSpacingZ = options.facetSpacingZ === undefined ? 0 : options.facetSpacingZ; - let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._facetSizeX = modelSizeX; - this._facetSizeY = modelSizeY; - this._facetSizeZ = modelSizeZ; - this._facetsX = options.facetCoordsX ? options.facetsX : 1; - this._facetsY = options.facetCoordsY ? options.facetsY : 1; - this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; - this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; - this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; - this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; - this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); - this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); - this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); - this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; - this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; - this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; - modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; - modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; - modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; - this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; - this._facetScaling = maxBounds / this._maxBounds; + get positionsZ() { + return this._positionsZ; } - resetCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = undefined; - this.minCumulativeLayoutBoundsY = undefined; - this.minCumulativeLayoutBoundsZ = undefined; - this.maxCumulativeLayoutBoundsX = undefined; - this.maxCumulativeLayoutBoundsY = undefined; - this.maxCumulativeLayoutBoundsZ = undefined; + set positionsZ(value2) { + if (this._positionsZ != value2) { + this._positionsZ = value2; + this._hasChanged = true; + } } - _updateCumulativeLayoutBounds() { - this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === undefined ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); - this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === undefined ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); - this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === undefined ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); - this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === undefined ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); - this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === undefined ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); - this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === undefined ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); + get positionScalingX() { + return this._positionScalingX; } - unitToModelSize(unitSize) { - return unitSize / this._boundsScaling; + set positionScalingX(value2) { + if (this._positionScalingX != value2) { + this._positionScalingX = value2; + this._hasChanged = true; + } } - unitToModelPositionX(unitPositionX) { - return this.unitToModelSize(unitPositionX) + this.modelOriginX; + get positionScalingY() { + return this._positionScalingY; } - unitToModelPositionY(unitPositionY) { - return this.unitToModelSize(unitPositionY) + this.modelOriginY; + set positionScalingY(value2) { + if (this._positionScalingY != value2) { + this._positionScalingY = value2; + this._hasChanged = true; + } } - unitToModelPositionZ(unitPositionZ) { - return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; + get positionScalingZ() { + return this._positionScalingZ; } - unitToModelPosition(unitPosition, modelPosition) { - modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); - modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); - modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); + set positionScalingZ(value2) { + if (this._positionScalingZ != value2) { + this._positionScalingZ = value2; + this._hasChanged = true; + } } - modelToUnitSize(modelSize) { - return modelSize * this._boundsScaling; + get rotations() { + return this._rotations; } - modelToUnitPositionX(modelPositionX) { - return (modelPositionX - this.modelOriginX) * this._boundsScaling; + set rotations(value2) { + if (this._rotations != value2) { + this._rotations = value2; + this._hasChanged = true; + } } - modelToUnitPositionY(modelPositionY) { - return (modelPositionY - this.modelOriginY) * this._boundsScaling; + get offsetsX() { + return this._offsetsX; } - modelToUnitPositionZ(modelPositionZ) { - return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; + set offsetsX(value2) { + if (this._offsetsX != value2) { + this._offsetsX = value2; + this._hasChanged = true; + } } - modelToUnitPosition(modelPosition, unitPosition) { - unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); - unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); - unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); - } - inclusiveUnitBounds(buffer, ids, unitType, offset, count, minBounds, maxBounds) { - (0, _glMatrix.vec3).set(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const unitScale = (0, _glMatrix.vec3).create(); - const unitRotation = (0, _glMatrix.quat).create(); - const unitTranslation = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - const dataView = buffer.dataView; - let minBounds0; - let maxBounds0; - let minBounds1; - let maxBounds1; - switch(unitType){ - case (0, _mainJs.UnitType).sphere: - case (0, _mainJs.UnitType).sphereSdf: - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const radius = unitScale[0] / 2; - minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius); - minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius); - minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius); - maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius); - maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius); - maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius); - } - break; - case (0, _mainJs.UnitType).hexPrism: - case (0, _mainJs.UnitType).hexPrismSdf: - case (0, _mainJs.UnitType).block: - case (0, _mainJs.UnitType).blockSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - minBounds1 = (0, _glMatrix.vec3).create(); - maxBounds1 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; - minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; - minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; - maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; - maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; - maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; - (0, _boundsJs.BoundsHelper).rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, (0, _constantsJs.Constants).VECTOR3_ZERO); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds1); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds1); - } - break; - case (0, _mainJs.UnitType).cylinder: - case (0, _mainJs.UnitType).cylinderSdf: - minBounds0 = (0, _glMatrix.vec3).create(); - maxBounds0 = (0, _glMatrix.vec3).create(); - const pa = (0, _glMatrix.vec3).create(); - const pb = (0, _glMatrix.vec3).create(); - const identityRotation = (0, _constantsJs.Constants).VECTOR3_UNITY; - let ca; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, unitTranslation); - (0, _vertexJs.UnitVertex).getRotation(dataView, index, unitRotation); - (0, _vertexJs.UnitVertex).getScale(dataView, index, unitScale); - const length = unitScale[1]; - const radius = Math.max(unitScale[0], unitScale[2]); - if (length != 0 && radius != 0) { - if ((0, _glMatrix.quat).equals(unitRotation, (0, _constantsJs.Constants).QUAT_IDENTITY)) ca = identityRotation; - else { - ca = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca, identityRotation, unitRotation); - } - (0, _glMatrix.vec3).scaleAndAdd(pa, unitTranslation, ca, -length * 0.5); - (0, _glMatrix.vec3).scaleAndAdd(pb, unitTranslation, ca, length * 0.5); - (0, _boundsJs.BoundsHelper).cylinder(pa, pb, radius, minBounds0, maxBounds0); - (0, _glMatrix.vec3).min(minBounds, minBounds, minBounds0); - (0, _glMatrix.vec3).max(maxBounds, maxBounds, maxBounds0); - } - } - break; - } + get offsetsY() { + return this._offsetsY; } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/bounds.js":"lo93N","../main.js":"b6Xbk","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lo93N":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BoundsHelper", ()=>BoundsHelper); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../meshes/cube.js"); -class BoundsHelper { - static rotateBounds(minBounds, maxBounds, rotation, rotatedMinBounds, rotatedMaxBounds, offset) { - const sizeX = maxBounds[0] - minBounds[0]; - const sizeY = maxBounds[1] - minBounds[1]; - const sizeZ = maxBounds[2] - minBounds[2]; - const min = rotatedMinBounds; - const max = rotatedMaxBounds; - (0, _glMatrix.vec3).set(min, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - (0, _glMatrix.vec3).set(max, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const vertices = (0, _cubeJs.Cube).POSITIONS; - const position = (0, _glMatrix.vec3).create(); - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).add(position, position, offset); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).subtract(position, position, offset); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).add(position, minBounds, maxBounds); - (0, _glMatrix.vec3).scale(position, position, 0.5); - (0, _glMatrix.vec3).add(min, min, position); - (0, _glMatrix.vec3).add(max, max, position); - } - static cylinder(pa, pb, radius, minBounds, maxBounds) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - minBounds[0] = Math.min(pa[0] - ex, pb[0] - ex); - minBounds[1] = Math.min(pa[1] - ey, pb[1] - ey); - minBounds[2] = Math.min(pa[2] - ez, pb[2] - ez); - maxBounds[0] = Math.max(pa[0] + ex, pb[0] + ex); - maxBounds[1] = Math.max(pa[1] + ey, pb[1] + ey); - maxBounds[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"erHGu","../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"k6xxB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesBase", ()=>(0, _axesJs.AxesBase)); -parcelHelpers.export(exports, "Cartesian2dAxes", ()=>(0, _cartesian2DJs.Cartesian2dAxes)); -parcelHelpers.export(exports, "Cartesian2dAxesHelper", ()=>(0, _cartesian2DJs.Cartesian2dAxesHelper)); -parcelHelpers.export(exports, "Cartesian3dAxes", ()=>(0, _cartesian3DJs.Cartesian3dAxes)); -parcelHelpers.export(exports, "Cartesian3dAxesHelper", ()=>(0, _cartesian3DJs.Cartesian3dAxesHelper)); -var _axesJs = require("./axes.js"); -var _cartesian2DJs = require("./cartesian2d.js"); -var _cartesian3DJs = require("./cartesian3d.js"); - -},{"./axes.js":"4X9HQ","./cartesian2d.js":"lhcyD","./cartesian3d.js":"fmvJ2","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1IX9R":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AngleHelper", ()=>(0, _angleJs.AngleHelper)); -parcelHelpers.export(exports, "AnimationHelper", ()=>(0, _animationJs.AnimationHelper)); -parcelHelpers.export(exports, "ArrayHelper", ()=>(0, _arrayJs.ArrayHelper)); -parcelHelpers.export(exports, "AxisHelper", ()=>(0, _axesJs.AxisHelper)); -parcelHelpers.export(exports, "Base64Helper", ()=>(0, _base64Js.Base64Helper)); -parcelHelpers.export(exports, "BinHelper", ()=>(0, _binJs.BinHelper)); -parcelHelpers.export(exports, "ColorHelper", ()=>(0, _colorJs.ColorHelper)); -parcelHelpers.export(exports, "CsvHelper", ()=>(0, _csvJs.CsvHelper)); -parcelHelpers.export(exports, "FacetHelper", ()=>(0, _facetJs.FacetHelper)); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>(0, _forcedirectJs.ForceDirectHelper)); -parcelHelpers.export(exports, "HexHelper", ()=>(0, _hexJs.HexHelper)); -parcelHelpers.export(exports, "HexBinHelper", ()=>(0, _hexbinJs.HexBinHelper)); -parcelHelpers.export(exports, "LineHelper", ()=>(0, _lineJs.LineHelper)); -parcelHelpers.export(exports, "MathHelper", ()=>(0, _mathJs.MathHelper)); -parcelHelpers.export(exports, "PseudoRandom", ()=>(0, _mathJs.PseudoRandom)); -parcelHelpers.export(exports, "MatrixHelper", ()=>(0, _matrixJs.MatrixHelper)); -parcelHelpers.export(exports, "MercatorHelper", ()=>(0, _mapJs.MercatorHelper)); -parcelHelpers.export(exports, "AlbersHelper", ()=>(0, _mapJs.AlbersHelper)); -parcelHelpers.export(exports, "GeoJSONHelper", ()=>(0, _mapJs.GeoJSONHelper)); -parcelHelpers.export(exports, "OctTreeHelper", ()=>(0, _octtreeJs.OctTreeHelper)); -parcelHelpers.export(exports, "PaletteHelper", ()=>(0, _paletteJs.PaletteHelper)); -parcelHelpers.export(exports, "PathHelper", ()=>(0, _pathJs.PathHelper)); -parcelHelpers.export(exports, "PickHelper", ()=>(0, _pickJs.PickHelper)); -parcelHelpers.export(exports, "TableHelper", ()=>(0, _tableJs.TableHelper)); -parcelHelpers.export(exports, "TextHelper", ()=>(0, _textJs.TextHelper)); -parcelHelpers.export(exports, "TextureHelper", ()=>(0, _textureJs.TextureHelper)); -parcelHelpers.export(exports, "TreeHelper", ()=>(0, _treeJs.TreeHelper)); -parcelHelpers.export(exports, "SetHelper", ()=>(0, _setJs.SetHelper)); -parcelHelpers.export(exports, "SdfHelper", ()=>(0, _sdfJs.SdfHelper)); -parcelHelpers.export(exports, "VectorHelper", ()=>(0, _vectorJs.VectorHelper)); -var _angleJs = require("./angle.js"); -var _animationJs = require("./animation.js"); -var _arrayJs = require("./array.js"); -var _axesJs = require("./axes.js"); -var _base64Js = require("./base64.js"); -var _binJs = require("./bin.js"); -var _colorJs = require("./color.js"); -var _csvJs = require("./csv.js"); -var _facetJs = require("./facet.js"); -var _forcedirectJs = require("./forcedirect.js"); -var _hexJs = require("./hex.js"); -var _hexbinJs = require("./hexbin.js"); -var _lineJs = require("./line.js"); -var _mathJs = require("./math.js"); -var _matrixJs = require("./matrix.js"); -var _mapJs = require("./map.js"); -var _octtreeJs = require("./octtree.js"); -var _paletteJs = require("./palette.js"); -var _pathJs = require("./path.js"); -var _pickJs = require("./pick.js"); -var _tableJs = require("./table.js"); -var _textJs = require("./text.js"); -var _textureJs = require("./texture.js"); -var _treeJs = require("./tree.js"); -var _setJs = require("./set.js"); -var _sdfJs = require("./sdf.js"); -var _vectorJs = require("./vector.js"); - -},{"./angle.js":"hBXkO","./animation.js":"gfPT1","./array.js":"4HTFI","./axes.js":"ihirw","./base64.js":"jPxDT","./bin.js":"6iYuz","./color.js":"e6MgZ","./csv.js":"aipXV","./facet.js":"lCGoH","./forcedirect.js":"aTxJq","./hex.js":"7e5Gl","./hexbin.js":"6aPHf","./line.js":"fJDGL","./math.js":"6Lv1i","./matrix.js":"ffHCZ","./map.js":"luVrT","./octtree.js":"hnmkG","./palette.js":"60qny","./path.js":"ekXmH","./pick.js":"fOypM","./table.js":"fZzMq","./text.js":"keNgB","./texture.js":"kVjwp","./tree.js":"6KTQh","./set.js":"hTJIH","./sdf.js":"cvuqr","./vector.js":"fLgIj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4HTFI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ArrayHelper", ()=>ArrayHelper); -class ArrayHelper { - static minIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) { - index = ~index; - index = Math.max(0, index); - } else while(index > 0 && orderedValues[index - 1] == value)index--; - return index; - } - static maxIndex(orderedValues, offset, length, value) { - let index = ArrayHelper.binarySearch(orderedValues, offset, length, value); - if (index < 0) index = ~index - 1; - else { - while(index < length - 1 && orderedValues[index + 1] == value)index++; - index = Math.min(length, index); - } - return index; - } - static binarySearch(array, index, length, value) { - let low = index; - let high = index + length - 1; - while(low <= high){ - const mid = low + (high - low >> 1); - if (array[mid] == value) return mid; - if (array[mid] <= value) low = mid + 1; - else high = mid - 1; - } - return ~low; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jPxDT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Base64Helper", ()=>Base64Helper); -class Base64Helper { - uint6ToB64(nUint6) { - return nUint6 < 26 ? nUint6 + 65 : nUint6 < 52 ? nUint6 + 71 : nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? 47 : 65; - } - base64EncArr(aBytes) { - let nMod3 = 2; - let sB64Enc = ""; - let nLen = aBytes.byteLength; - let nUint24 = 0; - for(let nIdx = 0; nIdx < nLen; nIdx++){ - nMod3 = nIdx % 3; - if (nIdx > 0 && nIdx * 4 / 3 % 76 === 0) sB64Enc += "\r\n"; - nUint24 |= aBytes.getUint8(nIdx) << (16 >>> nMod3 & 24); - if (nMod3 === 2 || aBytes.byteLength - nIdx === 1) { - sB64Enc += String.fromCharCode(this.uint6ToB64(nUint24 >>> 18 & 63), this.uint6ToB64(nUint24 >>> 12 & 63), this.uint6ToB64(nUint24 >>> 6 & 63), this.uint6ToB64(nUint24 & 63)); - nUint24 = 0; - } - } - return sB64Enc.substring(0, sB64Enc.length - 2 + nMod3) + (nMod3 === 2 ? "" : nMod3 === 1 ? "=" : "=="); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6iYuz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BinHelper", ()=>BinHelper); -class BinHelper { - static quantile(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const itemsPerBin = count / options.bins; - let bin = 0; - if (options.froms && options.tos) { - const firstId = options.ids[offset]; - options.froms[0] = options.values[firstId]; - } - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - if (i > Math.floor(itemsPerBin * (bin + 1))) { - bin++; - if (options.froms && options.tos) { - options.tos[bin - 1] = options.values[id]; - const nextId = options.ids[i + offset + 1]; - options.froms[bin] = options.values[nextId]; - } - } - options.binIds[id] = bin; - } - if (options.froms && options.tos) { - const lastId = options.ids[count - 1 + offset]; - options.tos[options.bins - 1] = options.values[lastId]; - } - return Math.floor(itemsPerBin); - } - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const counts = options.counts ? options.counts : new Float64Array(options.bins); - let minValue = options.minValue; - let maxValue = options.maxValue; - if (options.isDiscrete || maxValue == minValue) { - minValue -= 0.5; - maxValue += 0.5; - } - const binSize = (maxValue - minValue) / options.bins; - let maxCount = 0; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - const value = options.values[id]; - const binId = Math.max(Math.min(Math.floor((value - minValue) / binSize), options.bins - 1), 0); - options.binIds[id] = binId; - counts[binId]++; - maxCount = Math.max(counts[binId], maxCount); - } - if (options.froms && options.tos) { - for(let i = 0; i < options.bins; i++)if (options.isDiscrete || maxValue == minValue) { - options.froms[i] = Math.ceil(minValue + binSize * i); - options.tos[i] = Math.floor(minValue + binSize * (i + 1)); - } else { - options.froms[i] = minValue + binSize * i; - options.tos[i] = minValue + binSize * (i + 1); - } - } - return maxCount; - } - static maxBins(minValue, maxValue, isDiscrete, maxBins) { - if (isDiscrete) return Math.min(maxValue - minValue + 1, maxBins); - else return maxBins; - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e6MgZ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorHelper", ()=>ColorHelper); -var _glMatrix = require("gl-matrix"); -class ColorHelper { - static luminance(rgb) { - return rgb[0] * ColorHelper.LUMINANCE[0] + rgb[1] * ColorHelper.LUMINANCE[1] + rgb[2] * ColorHelper.LUMINANCE[2]; - } - static rgbToHex(r, g, b) { - const r2 = `0${Math.round(r * 255).toString(16)}`; - const g2 = `0${Math.round(g * 255).toString(16)}`; - const b2 = `0${Math.round(b * 255).toString(16)}`; - return `#${r2.substr(r2.length - 2, 2)}${g2.substr(g2.length - 2, 2)}${b2.substr(b2.length - 2, 2)}`; - } - static rgbToHsv(r, g, b, hsv) { - let h, s, v, delta; - const min = Math.min(Math.min(r, g), b); - const max = Math.max(Math.max(r, g), b); - delta = max - min; - v = max; - if (delta == 0) { - h = -1; - if (max == 0) s = -1; - else s = 0; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - s = delta / max; - if (r == max) h = (g - b) / delta; - else if (g == max) h = 2 + (b - r) / delta; - else h = 4 + (r - g) / delta; - h *= 60; - if (h < 0) h += 360; - hsv[0] = h; - hsv[1] = s; - hsv[2] = v; - } - static hsvToRgb(h, s, v, rgb) { - let sextant, r, g, b; - if (s == 0) { - r = g = b = v; - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } - let frac, p, q, t; - h %= 360; - h /= 60; - sextant = Math.floor(h); - frac = h - sextant; - p = v * (1 - s); - q = v * (1 - s * frac); - t = v * (1 - s * (1 - frac)); - switch(sextant){ - case 0: - r = v; - g = t; - b = p; - break; - case 1: - r = q; - g = v; - b = p; - break; - case 2: - r = p; - g = v; - b = t; - break; - case 3: - r = p; - g = q; - b = v; - break; - case 4: - r = t; - g = p; - b = v; - break; - default: - r = v; - g = p; - b = q; - break; - } - rgb[0] = r; - rgb[1] = g; - rgb[2] = b; - } -} -ColorHelper.LUMINANCE = (0, _glMatrix.vec3).fromValues(0.2126, 0.7152, 0.0722); - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aipXV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CsvHelper", ()=>CsvHelper); -var _mainJs = require("../main.js"); -class CsvHelper { - constructor(core){ - this.QUOTE = '"'; - this.DELIMETER = ','; - this.LINE_BREAKS = [ - '\n', - '\r' - ]; - this._core = core; - } - readline(text, row) { - return this.read(text, row, 1)[0]; - } - read(text, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const rows = []; - let rowBuffer = []; - let row = 0; - let columnBuffer = ""; - let quoted = false; - for(let i = 0; i < text.length; i++){ - const char = text.charAt(i); - if (char == this.QUOTE) { - if (text.charAt(i + 1) == this.QUOTE) { - i++; - columnBuffer += this.QUOTE; - } else quoted = !quoted; - } else if (quoted) columnBuffer += char; - else { - if (char == this.DELIMETER) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - } else if (this.LINE_BREAKS.indexOf(char) > -1) { - rowBuffer.push(columnBuffer); - columnBuffer = ""; - while(this.LINE_BREAKS.indexOf(text.charAt(i + 1)) > -1)i++; - if (row++ >= firstRow) rows.push(rowBuffer); - rowBuffer = []; - if (rows.length == maxRows) break; - } else columnBuffer += char; - } - } - if (columnBuffer != "") rowBuffer.push(columnBuffer); - if (rowBuffer.length > 0) rows.push(rowBuffer); - if (maxRows > 1) this._core.log.write((0, _mainJs.LogLevel).info, `csv ${rows.length} rows ${Math.round(window.performance.now() - start)}ms`); - return rows; - } - writeLine(data) { - let text = ""; - for(let i = 0; i < data.length; i++){ - let column = data[i]; - if (column) { - const quotes = column.indexOf(this.DELIMETER) > -1 || column.indexOf(this.QUOTE) > -1; - column = column.replace(/"/g, '""'); - if (quotes) column = `${this.QUOTE}${column}${this.QUOTE}`; - } - text += column; - if (i < data.length - 1) text += this.DELIMETER; - } - return text; - } - writeAsJavaScriptArray(headings, data) { - let text = "[["; - for (let column of headings)text += `"${column}",`; - text = text.slice(0, -1); - text += "]\n"; - let row; - for(let i = 0; i < data.length; i++){ - const line = data[i]; - row = "["; - for(let j = 0; j < line.length; j++){ - const column = line[j]; - row += `"${column.replace(/"/g, '\\"')}",`; - } - row = row.slice(0, -1); - row += "],\n"; - text += row; - } - text += "];"; - return text; - } -} - -},{"../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lCGoH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FacetHelper", ()=>FacetHelper); -var _mainJs = require("../main.js"); -class FacetHelper { - constructor(core){ - this._core = core; - } - split1d(ids, facetsX, valuesX, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, undefined, undefined, valuesX, null, null, orderedIds, facetIds, offsets, counts); - } - split2d(ids, facetsX, facetsY, valuesX, valuesY, orderedIds, facetIds, offsets, counts) { - this.split3d(ids, facetsX, facetsY, undefined, valuesX, valuesY, null, orderedIds, facetIds, offsets, counts); - } - split3d(ids, facetsX, facetsY, facetsZ, valuesX, valuesY, valuesZ, orderedIds, facetIds, offsets, counts) { - if (valuesX && facetIds.length != valuesX.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesX"); - if (valuesY && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - if (valuesZ && facetIds.length != valuesY.length) this._core.log.write((0, _mainJs.LogLevel).warn, "facet helper split1d facetIds should be same length as facetValuesY"); - const start = window.performance.now(); - if (facetsX === undefined) facetsX = 1; - if (facetsY === undefined) facetsY = 1; - if (facetsZ === undefined) facetsZ = 1; - const maxFacetId = facetsX * facetsY * facetsZ - 1; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const valueX = valuesX ? valuesX[id] : 0; - const valueY = valuesY ? valuesY[id] : 0; - const valueZ = valuesZ ? valuesZ[id] : 0; - const facetId = valueX + valueY * facetsX + valueZ * facetsX * facetsZ; - facetIds[id] = facetId; - if (facetId > maxFacetId) this._core.log.write((0, _mainJs.LogLevel).warn, "facet overflow"); - counts[facetId]++; - } - let offset = 0; - for(let i = 0; i < offsets.length; i++){ - const count = counts[i]; - offsets[i] = offset; - offset += count; - } - const tempOffsets = new Uint32Array(offsets); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const facetId = facetIds[id]; - offset = tempOffsets[facetId]++; - orderedIds[offset] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet split ${Math.round(window.performance.now() - start)}ms`); - } - wrap1d(ids, values, columns, coordsX, coordsY) { - const start = window.performance.now(); - let rows = 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const value = values[id]; - coordsX[id] = value % columns; - const row = Math.floor(value / columns); - coordsY[id] = row; - rows = Math.max(row, rows); - } - this._core.log.write((0, _mainJs.LogLevel).info, `facet wrap ${Math.round(window.performance.now() - start)}ms`); - return rows + 1; + set offsetsY(value2) { + if (this._offsetsY != value2) { + this._offsetsY = value2; + this._hasChanged = true; + } } -} - -},{"../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aTxJq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ForceDirectHelper", ()=>ForceDirectHelper); -var _octtreeJs = require("./octtree.js"); -class ForceDirectHelper { - set gravity(value) { - this._gravity = value; - } - get gravity() { - return this._gravity; - } - set attraction(value) { - this._attraction = value; - } - get attraction() { - return this._attraction; - } - set repulsion(value) { - this._repulsion = value; - } - get repulsion() { - return this._repulsion; - } - set interval(value) { - this._interval = value; - } - get interval() { - return this._interval; - } - set maxDistance(value) { - this._maxDistance = value; - } - get maxDistance() { - return this._maxDistance; - } - set iterationsPerLayout(value) { - this._iteractionsPerLayout = value; - } - get iterationsPerLayout() { - return this._iteractionsPerLayout; - } - set edgeWeightPower(value) { - this._edgeWeightPower = value; - } - get edgeWeightPower() { - return this._edgeWeightPower; - } - set theta(value) { - this._theta = value; - } - get theta() { - return this._theta; - } - get iterations() { - return this._totalIterations; - } - get totalRepulsion() { - return this._totalRepulsion; - } - get nodePositionsX() { - return this._nodePositionsX; - } - get nodePositionsY() { - return this._nodePositionsY; - } - get nodePositionsZ() { - return this._nodePositionsZ; - } - get lockX() { - return this._lockX; - } - set lockX(value) { - this._lockX = value; - } - get lockY() { - return this._lockY; - } - set lockY(value) { - this._lockY = value; - } - get lockZ() { - return this._lockZ; - } - set lockZ(value) { - this._lockZ = value; - } - constructor(options){ - this._forcesX = new Float64Array(options.nodeIds.length); - this._forcesY = new Float64Array(options.nodeIds.length); - this._forcesZ = new Float64Array(options.nodeIds.length); - this._totalIterations = 0; - this._totalRepulsion = 0; - this._repulsion = options.repulsion || 1; - this._attraction = options.attraction || 1; - this._gravity = options.gravity || 1; - this._interval = options.interval || 1; - this._maxDistance = options.maxDistance || 1; - this._iteractionsPerLayout = options.iterationsPerLayout || 1; - this._theta = options.theta || 1; - this._nodeIds = options.nodeIds; - this._nodePositionsX = options.nodePositionsX; - this._nodePositionsY = options.nodePositionsY; - this._nodePositionsZ = options.nodePositionsZ; - this._nodeWeights = options.nodeWeights || new Float64Array(this._nodeIds.length).fill(1); - this._edgeIds = options.edgeIds; - this._edgeFromIds = options.edgeFromIds; - this._edgeToIds = options.edgeToIds; - this._edgeWeights = options.edgeWeights || new Float64Array(this._edgeIds.length).fill(1); - this._edgeWeightPower = options.edgeWeightPower || 1; + get offsetsZ() { + return this._offsetsZ; } - layout() { - this._minBoundsX = Number.MAX_VALUE; - this._minBoundsY = Number.MAX_VALUE; - this._minBoundsZ = Number.MAX_VALUE; - this._maxBoundsX = -Number.MAX_VALUE; - this._maxBoundsY = -Number.MAX_VALUE; - this._maxBoundsZ = -Number.MAX_VALUE; - for(let i = 0; i < this._nodeIds.length; i++){ - this._minBoundsX = Math.min(this._minBoundsX, this._nodePositionsX[i]); - this._minBoundsY = Math.min(this._minBoundsY, this._nodePositionsY[i]); - this._minBoundsZ = Math.min(this._minBoundsZ, this._nodePositionsZ[i]); - this._maxBoundsX = Math.max(this._maxBoundsX, this._nodePositionsX[i]); - this._maxBoundsY = Math.max(this._maxBoundsY, this._nodePositionsY[i]); - this._maxBoundsZ = Math.max(this._maxBoundsZ, this._nodePositionsZ[i]); - } - for(let iteration = 0; iteration < this._iteractionsPerLayout; iteration++){ - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forcesX[id] = 0; - this._forcesY[id] = 0; - this._forcesZ[id] = 0; - } - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - let dx = this._nodePositionsX[id]; - let dy = this._nodePositionsY[id]; - let dz = this._nodePositionsZ[id]; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -this._nodeWeights[id] * this._gravity; - this._forcesX[id] += magnitude * dx; - this._forcesY[id] += magnitude * dy; - this._forcesZ[id] += magnitude * dz; - } - } - for(let i = 0; i < this._edgeIds.length; i++){ - const id = this._edgeIds[i]; - const fromId = this._edgeFromIds[id]; - const toId = this._edgeToIds[id]; - const x1 = this._nodePositionsX[fromId]; - const y1 = this._nodePositionsY[fromId]; - const z1 = this._nodePositionsZ[fromId]; - const x2 = this._nodePositionsX[toId]; - const y2 = this._nodePositionsY[toId]; - const z2 = this._nodePositionsZ[toId]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = -distance * this._attraction * Math.pow(this._edgeWeights[id], this._edgeWeightPower); - this._forcesX[fromId] += magnitude * dx; - this._forcesY[fromId] += magnitude * dy; - this._forcesZ[fromId] += magnitude * dz; - this._forcesX[toId] -= magnitude * dx; - this._forcesY[toId] -= magnitude * dy; - this._forcesZ[toId] -= magnitude * dz; - } - } - const minBounds = Math.min(Math.min(this._minBoundsX, this._minBoundsY), this._minBoundsZ); - const maxBounds = Math.max(Math.max(this._maxBoundsX, this._maxBoundsY), this._maxBoundsZ); - const size = maxBounds - minBounds; - const maxLevel = 10; - const minBoundsX = minBounds; - const minBoundsY = minBounds; - const minBoundsZ = minBounds; - const maxBoundsX = maxBounds; - const maxBoundsY = maxBounds; - const maxBoundsZ = maxBounds; - const octTreeOptions = { - minBoundsX: minBoundsX, - minBoundsY: minBoundsY, - minBoundsZ: minBoundsZ, - maxBoundsX: maxBoundsX, - maxBoundsY: maxBoundsY, - maxBoundsZ: maxBoundsZ, - maxLevel: maxLevel, - ids: this._nodeIds, - positionsX: this._nodePositionsX, - positionsY: this._nodePositionsY, - positionsZ: this._nodePositionsZ, - masses: this._nodeWeights - }; - const octTree = new (0, _octtreeJs.OctTreeHelper)(octTreeOptions); - this._totalRepulsion = 0; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - this._forceX = 0; - this._forceY = 0; - this._forceZ = 0; - this.calculateRepulsion(octTree.root, id); - this._forcesX[id] += this._forceX; - this._forcesY[id] += this._forceY; - this._forcesZ[id] += this._forceZ; - this._totalRepulsion += Math.sqrt(this._forceX * this._forceX + this._forceY * this._forceY + this._forceZ * this._forceZ); - } - const timeSquared = this._interval * this._interval; - for(let i = 0; i < this._nodeIds.length; i++){ - const id = this._nodeIds[i]; - const mass = this._nodeWeights[id]; - const ax = this._forcesX[id] / mass; - const ay = this._forcesY[id] / mass; - const az = this._forcesZ[id] / mass; - let dx = ax * timeSquared / 2; - let dy = ay * timeSquared / 2; - let dz = az * timeSquared / 2; - const distanceSquared = dx * dx + dy * dy + dz * dz; - const distance = Math.sqrt(distanceSquared); - if (distance > this._maxDistance * size) { - dx *= this._maxDistance * size / distance; - dy *= this._maxDistance * size / distance; - dz *= this._maxDistance * size / distance; - } - if (!this._lockX) this._nodePositionsX[id] += dx; - if (!this._lockY) this._nodePositionsY[id] += dy; - if (!this._lockZ) this._nodePositionsZ[id] += dz; - } - } - if (this.layoutCallback) this.layoutCallback(); - } - calculateRepulsion(parent, id1) { - const x1 = this._nodePositionsX[id1]; - const y1 = this._nodePositionsY[id1]; - const z1 = this._nodePositionsZ[id1]; - for(let k = 0; k < parent.children.length; k++){ - const child = parent.children[k]; - if (!child.children) for(let i = 0; i < child.ids.length; i++){ - const id2 = child.ids[i]; - if (id1 != id2) { - const x2 = this._nodePositionsX[id2]; - const y2 = this._nodePositionsY[id2]; - const z2 = this._nodePositionsZ[id2]; - let dx = x1 - x2; - let dy = y1 - y2; - let dz = z1 - z2; - let distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - let distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const magnitude = this._repulsion * this._nodeWeights[id1] * this._nodeWeights[id2] / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } - } - } - else { - let dx = x1 - child.centerOfMassX; - let dy = y1 - child.centerOfMassY; - let dz = z1 - child.centerOfMassZ; - const distanceSquared = dx * dx + dy * dy + dz * dz; - if (distanceSquared > 0) { - const distance = Math.sqrt(distanceSquared); - dx /= distance; - dy /= distance; - dz /= distance; - const width = child.maxBoundsX - child.minBoundsX; - if (width / distance < this._theta) { - const magnitude = this._repulsion * this._nodeWeights[id1] * child.mass / distanceSquared; - this._forceX += dx * magnitude; - this._forceY += dy * magnitude; - this._forceZ += dz * magnitude; - } else this.calculateRepulsion(child, id1); - } - } - } + set offsetsZ(value2) { + if (this._offsetsZ != value2) { + this._offsetsZ = value2; + this._hasChanged = true; + } } -} - -},{"./octtree.js":"hnmkG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hnmkG":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OctTreeNode", ()=>OctTreeNode); -parcelHelpers.export(exports, "OctTreeHelper", ()=>OctTreeHelper); -class OctTreeNode { -} -class OctTreeHelper { - constructor(options){ - this._ids = options.ids; - this._positionsX = options.positionsX; - this._positionsY = options.positionsY; - this._positionsZ = options.positionsZ; - this._masses = options.masses; - this._maxLevel = options.maxLevel; - this.root = new OctTreeNode(); - this.root.minBoundsX = options.minBoundsX; - this.root.minBoundsY = options.minBoundsY; - this.root.minBoundsZ = options.minBoundsZ; - this.root.maxBoundsX = options.maxBoundsX; - this.root.maxBoundsY = options.maxBoundsY; - this.root.maxBoundsZ = options.maxBoundsZ; - this.root.level = 0; - this.root.octKey = ""; - this._buildTree(this.root, this._ids); - } - _buildTree(parent, ids) { - const centerX = (parent.minBoundsX + parent.maxBoundsX) / 2; - const centerY = (parent.minBoundsY + parent.maxBoundsY) / 2; - const centerZ = (parent.minBoundsZ + parent.maxBoundsZ) / 2; - const minBoundsX = []; - const minBoundsY = []; - const minBoundsZ = []; - const maxBoundsX = []; - const maxBoundsY = []; - const maxBoundsZ = []; - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(parent.minBoundsY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(centerY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(parent.minBoundsZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(centerZ); - minBoundsX.push(centerX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(parent.maxBoundsX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - minBoundsX.push(parent.minBoundsX); - minBoundsY.push(centerY); - minBoundsZ.push(centerZ); - maxBoundsX.push(centerX); - maxBoundsY.push(parent.maxBoundsY); - maxBoundsZ.push(parent.maxBoundsZ); - const masses = new Float64Array(8); - const centerOfMassesX = new Float64Array(8); - const centerOfMassesY = new Float64Array(8); - const centerOfMassesZ = new Float64Array(8); - const buckets = [ - [], - [], - [], - [], - [], - [], - [], - [] - ]; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const x = this._positionsX[index]; - const y = this._positionsY[index]; - const z = this._positionsZ[index]; - const mass = this._masses[index]; - for(let j = 0; j < 8; j++)if (minBoundsX[j] <= x && maxBoundsX[j] >= x && minBoundsY[j] <= y && maxBoundsY[j] >= y && minBoundsZ[j] <= z && maxBoundsZ[j] >= z) { - buckets[j].push(index); - masses[j] += mass; - centerOfMassesX[j] += x * mass; - centerOfMassesY[j] += y * mass; - centerOfMassesZ[j] += z * mass; - break; - } - } - parent.children = []; - for(let i = 0; i < 8; i++)if (buckets[i].length > 0) { - const child = new OctTreeNode(); - child.minBoundsX = minBoundsX[i]; - child.minBoundsY = minBoundsY[i]; - child.minBoundsZ = minBoundsZ[i]; - child.maxBoundsX = maxBoundsX[i]; - child.maxBoundsY = maxBoundsY[i]; - child.maxBoundsZ = maxBoundsZ[i]; - child.mass = masses[i]; - child.centerOfMassX = centerOfMassesX[i] / masses[i]; - child.centerOfMassY = centerOfMassesY[i] / masses[i]; - child.centerOfMassZ = centerOfMassesZ[i] / masses[i]; - child.level = parent.level + 1; - child.octKey += i.toString(); - child.parent = parent; - child.ids = new Uint32Array(buckets[i]); - parent.children.push(child); - if (child.ids.length > 1 && child.level < this._maxLevel) this._buildTree(child, child.ids); - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7e5Gl":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexHelper", ()=>HexHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _angleJs = require("./angle.js"); -class HexHelper { - static width(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return (0, _constantsJs.Constants).ROOT_THREE * size; - else return 2 * size; - } - static height(size, orientation) { - if (orientation == (0, _mainJs.HexOrientation).pointyTop) return 2 * size; - else return (0, _constantsJs.Constants).ROOT_THREE * size; - } - static pointyHexCorner(center, size, i, position) { - const angle = (0, _angleJs.AngleHelper).degreesToRadians(60 * i - 30); - position[0] = center[0] + size * Math.cos(angle); - position[1] = center[1] + size * Math.sin(angle); - } - static cubeToAxial(cube, hex) { - hex[0] = cube[0]; - hex[1] = cube[2]; - } - static axialToCube(hex, cube) { - const x = hex[0]; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static cubeToOddr(cube, hex) { - const col = cube[0] + (cube[2] - (cube[2] & 1)) / 2; - const row = cube[2]; - hex[0] = col; - hex[1] = row; - } - static oddrToCube(hex, cube) { - const x = hex[0] - (hex[1] - (hex[1] & 1)) / 2; - const z = hex[1]; - const y = -x - z; - cube[0] = x; - cube[1] = y; - cube[2] = z; - } - static pointyHexToPixel(hex, size, point) { - point[0] = size * ((0, _constantsJs.Constants).ROOT_THREE * hex[0] + (0, _constantsJs.Constants).ROOT_THREE / 2 * hex[1]); - point[1] = size * (1.5 * hex[1]); - } - static pixelToPointyHex(point, size, hex) { - hex[0] = ((0, _constantsJs.Constants).ROOT_THREE / 3 * point[0] - 1 / 3 * point[1]) / size; - hex[1] = 2 / 3 * point[1] / size; - this.hexRound(hex, hex); - } - static hexRound(hex, hexRound) { - const cube = this._vec3; - this.axialToCube(hex, cube); - this.cubeRound(cube, cube); - this.cubeToAxial(cube, hexRound); - } - static cubeRound(cube, cubeRound) { - let rx = Math.round(cube[0]); - let ry = Math.round(cube[1]); - let rz = Math.round(cube[2]); - const x_diff = Math.abs(rx - cube[0]); - const y_diff = Math.abs(ry - cube[1]); - const z_diff = Math.abs(rz - cube[2]); - if (x_diff > y_diff && x_diff > z_diff) rx = -ry - rz; - else if (y_diff > z_diff) ry = -rx - rz; - else rz = -rx - ry; - cubeRound[0] = rx; - cubeRound[1] = ry; - cubeRound[2] = rz; - } -} -HexHelper._vec3 = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../main.js":"b6Xbk","./angle.js":"hBXkO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6aPHf":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HexBinHelper", ()=>HexBinHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mainJs = require("../main.js"); -var _hexJs = require("./hex.js"); -class HexBinHelper { - static bin(options) { - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? options.ids.length : options.count; - const width = (options.maxValueX - options.minValueX) / options.binsX; - const minValueX = options.minValueX - width / 2; - const binsX = options.binsX + 1; - const size = width / (0, _constantsJs.Constants).ROOT_THREE; - const height = 2 * size; - const heightBetweenCenters = 3 * height / 4; - const binsY = Math.ceil((options.maxValueY - options.minValueY) / heightBetweenCenters) + 1; - const minValueY = options.minValueY; - const minQ = -Math.floor(binsY / 2); - const maxBins = (binsX - minQ) * binsY; - const binCounts = new Float64Array(maxBins); - const binLookup = new Uint32Array(maxBins); - const point = (0, _glMatrix.vec2).create(); - const hex = (0, _glMatrix.vec2).create(); - let nonEmptyBins = 0; - let minCount = Number.MAX_VALUE; - let maxCount = -Number.MAX_VALUE; - for(let i = 0; i < count; i++){ - const id = options.ids[i + offset]; - point[0] = options.valuesX[id] - minValueX; - point[1] = options.valuesY[id] - minValueY; - (0, _hexJs.HexHelper).pixelToPointyHex(point, size, hex); - const q = hex[0] - minQ; - const r = hex[1]; - const binId = q + r * (binsX - minQ); - if (binCounts[binId] == 0) { - binLookup[binId] = nonEmptyBins; - nonEmptyBins++; - } - binCounts[binId]++; - options.binIds[id] = binId; - minCount = Math.min(minCount, binCounts[binId]); - maxCount = Math.max(maxCount, binCounts[binId]); - } - const positionsX = new Float64Array(nonEmptyBins); - const positionsY = new Float64Array(nonEmptyBins); - const counts = new Uint32Array(nonEmptyBins); - const lookup = {}; - for(let i = 0; i < maxBins; i++){ - const count = binCounts[i]; - if (count > 0) { - const index = binLookup[i]; - lookup[i] = index; - counts[index] = count; - const q = i % (binsX - minQ); - const r = Math.floor(i / (binsX - minQ)); - hex[0] = q + minQ; - hex[1] = r; - (0, _hexJs.HexHelper).pointyHexToPixel(hex, size, point); - positionsX[index] = point[0] + minValueX; - positionsY[index] = point[1] + minValueY; - } - } - const result = { - binIds: options.binIds, - positionsX: positionsX, - positionsY: positionsY, - counts: counts, - minCount: minCount, - maxCount: maxCount, - orientation: (0, _mainJs.HexOrientation).pointyTop, - size: size, - lookup: lookup, - binsY: binsY - }; - return result; + get offsetScalingX() { + return this._offsetScalingX; } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../main.js":"b6Xbk","./hex.js":"7e5Gl","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fJDGL":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LineHelper", ()=>LineHelper); -var _mainJs = require("../main.js"); -class LineHelper { - constructor(core){ - this._core = core; - } - connect(orderedIds, series, toIds, offset = 0, count = orderedIds.length) { - const start = window.performance.now(); - const lines = new Set(); - const lookup = {}; - for(let i = offset; i < count; i++){ - const id = orderedIds[i + offset]; - const value = series[id]; - const fromId = lookup[value]; - if (fromId != null) { - toIds[fromId] = id; - lines.add(value); - } - lookup[value] = id; - toIds[id] = id; - } - this._core.log.write((0, _mainJs.LogLevel).info, `${lines.size} lines connected ${Math.round(window.performance.now() - start)}ms`); - return lines.size; - } -} - -},{"../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"60qny":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PaletteHelper", ()=>PaletteHelper); -var _glMatrix = require("gl-matrix"); -var _colorJs = require("./color.js"); -var _mathJs = require("./math.js"); -class PaletteHelper { - static resample(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < divisionsOut; i++){ - const positionOut = (i + 0.5) / divisionsOut; - const positionIn = positionOut * (divisionsIn - 1); - const stepIn = Math.floor(positionIn); - const fractIn = positionIn - stepIn; - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3], colorsIn[(stepIn + 1) * 3], fractIn); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 1], colorsIn[(stepIn + 1) * 3 + 1], fractIn); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(colorsIn[stepIn * 3 + 2], colorsIn[(stepIn + 1) * 3 + 2], fractIn); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static truncate(colorsIn, divisionsOut, reverse) { - const divisionsIn = colorsIn.length / 3; - const colorsOut = new Uint8Array(divisionsOut * 4); - for(let i = 0; i < Math.min(divisionsIn, divisionsOut); i++){ - const j = reverse ? divisionsOut - i - 1 : i; - colorsOut[j * 4] = colorsIn[i * 3]; - colorsOut[j * 4 + 1] = colorsIn[i * 3 + 1]; - colorsOut[j * 4 + 2] = colorsIn[i * 3 + 2]; - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static resampleStops(stops, divisions, reverse) { - const colorsOut = new Uint8Array(divisions * 4); - let from = 0; - let to = 0; - for(let i = 0; i < divisions; i++){ - const positionOut = (i + 0.5) / divisions; - while(stops[from].position < positionOut && from < stops.length - 1)from++; - from = Math.max(from - 1, 0); - to = Math.min(from + 1, stops.length - 1); - const fromStop = stops[from]; - const toStop = stops[to]; - const fract = from == to ? 0 : (positionOut - fromStop.position) / (toStop.position - fromStop.position); - const j = reverse ? divisions - i - 1 : i; - colorsOut[j * 4] = (0, _mathJs.MathHelper).lerp(fromStop.r, toStop.r, fract); - colorsOut[j * 4 + 1] = (0, _mathJs.MathHelper).lerp(fromStop.g, toStop.g, fract); - colorsOut[j * 4 + 2] = (0, _mathJs.MathHelper).lerp(fromStop.b, toStop.b, fract); - colorsOut[j * 4 + 3] = 255; - } - return colorsOut; - } - static lerpRgb(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - colors[i * 4] = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - colors[i * 4 + 1] = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - colors[i * 4 + 2] = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - colors[i * 4 + 3] = 0xff; - } - return colors; - } - static lerpHsv(from, to, divisions) { - const colors = new Uint8Array(divisions * 4); - for(let i = 0; i < divisions; i++){ - const amount = i / (divisions - 1); - const h = (0, _mathJs.MathHelper).lerp(from[0], to[0], amount); - const s = (0, _mathJs.MathHelper).lerp(from[1], to[1], amount); - const v = (0, _mathJs.MathHelper).lerp(from[2], to[2], amount); - (0, _colorJs.ColorHelper).hsvToRgb(h, s, v, PaletteHelper._rgb); - colors[i * 4] = PaletteHelper._rgb[0] * 0xff; - colors[i * 4 + 1] = PaletteHelper._rgb[1] * 0xff; - colors[i * 4 + 2] = PaletteHelper._rgb[2] * 0xff; - colors[i * 4 + 3] = 0xff; - } - return colors; - } -} -PaletteHelper._rgb = (0, _glMatrix.vec3).create(); - -},{"gl-matrix":"erHGu","./color.js":"e6MgZ","./math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ekXmH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PathHelper", ()=>PathHelper); -class PathHelper { - static getFilenameWithoutExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1) return path; - else { - const start = path.lastIndexOf('/') == -1 ? 0 : path.lastIndexOf('/') + 1; - return path.substring(start, dot); - } + set offsetScalingX(value2) { + if (this._offsetScalingX != value2) { + this._offsetScalingX = value2; + this._hasChanged = true; + } } - static getExtension(path) { - const dot = path.lastIndexOf('.'); - if (dot == -1 || dot == path.length - 1) return null; - else return path.substring(dot + 1, path.length); + get offsetScalingY() { + return this._offsetScalingY; } - static getFilename(path) { - if (path.lastIndexOf('/') == -1) return path; - else { - const start = path.lastIndexOf('/') + 1; - return path.substring(start, path.length); - } + set offsetScalingY(value2) { + if (this._offsetScalingY != value2) { + this._offsetScalingY = value2; + this._hasChanged = true; + } } - static getPath(path) { - if (path.lastIndexOf('/') == -1) return ""; - else return path.substring(0, path.lastIndexOf('/')); + get offsetScalingZ() { + return this._offsetScalingZ; } - static combine(first, second) { - const seperator = first.lastIndexOf('/') == first.length - 1; - if (second.indexOf('/') == 0) { - if (seperator) return first.substring(0, first.length - 1) + second; - else return first + second; - } else { - if (seperator) return first + second; - else return first + '/' + second; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fZzMq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TableHelper", ()=>TableHelper); -var _mainJs = require("../main.js"); -var _tableJs = require("../tables/table.js"); -class TableHelper { - constructor(core){ - this._core = core; - } - compatibleTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const start = window.performance.now(); - const types = []; - const integers = []; - let values = data[firstRow]; - let parsedFloat, parsedDate; - for(let i = 0; i < values.length; i++){ - const value = values[i]; - parsedFloat = Number(value); - parsedDate = Date.parse(value); - let integer = false; - let type; - if (!isNaN(parsedFloat)) { - type = (0, _tableJs.ColumnType).float; - integer = Number.isSafeInteger(parsedFloat); - } else if (!isNaN(parsedDate)) type = (0, _tableJs.ColumnType).date; - else type = (0, _tableJs.ColumnType).string; - types.push(type); - integers.push(integer); - } - for(let i = firstRow + 1; i < Math.min(data.length, firstRow + maxRows); i++){ - values = data[i]; - for(let j = 0; j < values.length; j++)if (types[j] != (0, _tableJs.ColumnType).string) { - const value = values[j]; - parsedFloat = Number(value); - if (types[j] == (0, _tableJs.ColumnType).float) { - if (isNaN(parsedFloat)) { - types[j] = (0, _tableJs.ColumnType).string; - integers[j] = false; - } else if (integers[j]) integers[j] = Number.isSafeInteger(parsedFloat); - } else if (types[j] == (0, _tableJs.ColumnType).date) { - parsedDate = Date.parse(value); - if (isNaN(parsedDate)) types[j] = (0, _tableJs.ColumnType).string; - } - } - } - const compatibleTypes = []; - for(let i = 0; i < types.length; i++){ - let compatible = types[i] | (0, _tableJs.ColumnType).string; - if (integers[i]) compatible |= (0, _tableJs.ColumnType).integer; - compatibleTypes.push(compatible); - } - this._core.log.write((0, _mainJs.LogLevel).info, `compatible types ${Math.round(window.performance.now() - start)}ms`); - return compatibleTypes; - } - inferTypes(data, firstRow = 0, maxRows = Number.MAX_VALUE) { - const columnTypes = []; - const compatibleTypes = this.compatibleTypes(data, firstRow, maxRows); - for(let i = 0; i < compatibleTypes.length; i++){ - let columnType; - const compatibleType = compatibleTypes[i]; - if (compatibleType & (0, _tableJs.ColumnType).integer) columnType = (0, _tableJs.ColumnType).integer; - else if (compatibleType & (0, _tableJs.ColumnType).float) columnType = (0, _tableJs.ColumnType).float; - else if (compatibleType & (0, _tableJs.ColumnType).date) columnType = (0, _tableJs.ColumnType).date; - else columnType = (0, _tableJs.ColumnType).string; - columnTypes.push(columnType); - } - return columnTypes; - } - convertToObject(table) { - const headings = table.headings; - const jsonObject = []; - for(let i = 0; i < table.all.ids.length; i++){ - const row = {}; - for(let j = 0; j < headings.length; j++){ - const column = headings[j]; - const value = table.all.columnValues(j)[i]; - switch(table.getColumnType(j)){ - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - row[column] = value; - break; - case (0, _tableJs.ColumnType).string: - case (0, _tableJs.ColumnType).date: - default: - row[column] = table.data[i][j]; - break; - } - jsonObject.push(row); - } - } - return jsonObject; - } -} - -},{"../main.js":"b6Xbk","../tables/table.js":"cNpSp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cNpSp":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>Table); -parcelHelpers.export(exports, "ColumnType", ()=>ColumnType); -var _filterJs = require("./filter.js"); -class Table { - get data() { - return this._data; - } - get headings() { - return this._headings; - } - get all() { - return this._all; + set offsetScalingZ(value2) { + if (this._offsetScalingZ != value2) { + this._offsetScalingZ = value2; + this._hasChanged = true; + } } - get isInitialized() { - return this._isInitialized; + get text() { + return this._text; } - get filter() { - return this._filter; + set text(value2) { + if (this._text != value2) { + this._text = value2; + this._hasChanged = true; + } } - set filter(value) { - if (this._filter !== value) { - this._filter = value; - if (this.filterChangedCallback) this.filterChangedCallback(); - } + get horizontalAlignments() { + return this._horizontalAlignments; } - getColumnType(column) { - return this._columnTypes[column]; + set horizontalAlignments(value2) { + if (this._horizontalAlignments != value2) { + this._horizontalAlignments = value2; + this._hasChanged = true; + } } - isColumnDiscrete(column) { - return (this._columnTypes[column] & ColumnType.discrete) > 0; + get verticalAlignments() { + return this._verticalAlignments; } - isColumnNumeric(column) { - return (this._columnTypes[column] & ColumnType.numeric) > 0; + set verticalAlignments(value2) { + if (this._verticalAlignments != value2) { + this._verticalAlignments = value2; + this._hasChanged = true; + } } - isColumnContinuous(column) { - return (this._columnTypes[column] & ColumnType.continuous) > 0; + get scales() { + return this._scales; } - constructor(core, headings, data, columnTypes){ - this._core = core; - this._headings = headings; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = Array(columnTypes.length).fill(null); - const indices = new Uint32Array(data.length); - for(let i = 0; i < indices.length; i++)indices[i] = i; - this._all = new (0, _filterJs.Filter)(core, indices, data, headings, columnTypes, this._numericValues); - this._isInitialized = true; + set scales(value2) { + if (this._scales != value2) { + this._scales = value2; + this._hasChanged = true; + } } - createFilter(ids) { - return new (0, _filterJs.Filter)(this._core, ids, this._data, this._headings, this._columnTypes, this._numericValues); + get scalesScaling() { + return this._scalesScaling; } -} -const ColumnType = { - none: 0, - float: 1, - integer: 2, - string: 4, - date: 8, - continuous: 9, - discrete: 6, - numeric: 11 -}; - -},{"./filter.js":"h4ise","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"h4ise":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Filter", ()=>Filter); -var _mainJs = require("../main.js"); -var _tableJs = require("./table.js"); -class Filter { - get ids() { - return this._ids; - } - constructor(core, ids, data, headings, columnTypes, numericValues){ - this._core = core; - this._ids = ids; - this._data = data; - this._columnTypes = columnTypes; - this._numericValues = numericValues; - this._stringValues = Array(columnTypes.length).fill(null); - this._hasMinMaxValues = Array(columnTypes.length).fill(false); - this._minValues = Array(columnTypes.length).fill(0); - this._maxValues = Array(columnTypes.length).fill(0); - this._distinctStrings = Array(columnTypes.length).fill(null); - this._orderedIds = Array(columnTypes.length).fill(null); - this._orderedValues = Array(columnTypes.length).fill(null); - } - columnValues(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) return this._createStringValues(column); - else return this._createNumericValues(column); - } - minValue(column) { - this._createMinMaxValues(column); - return this._minValues[column]; - } - maxValue(column) { - this._createMinMaxValues(column); - return this._maxValues[column]; - } - distinctStrings(column) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - return this._distinctStrings[column]; - } else return null; - } - toJSON(ids, columns) { - const rows = []; - for(let i = 0; i < ids.length; i++){ - const rowIndex = ids[i]; - const row = []; - for(let j = 0; j < columns.length; j++){ - const columnIndex = columns[j]; - switch(this._columnTypes[columnIndex]){ - case (0, _tableJs.ColumnType).date: - case (0, _tableJs.ColumnType).string: - row.push(this._data[rowIndex][columnIndex]); - break; - case (0, _tableJs.ColumnType).integer: - case (0, _tableJs.ColumnType).float: - const numericValues = this._createNumericValues(columnIndex); - row.push(numericValues[rowIndex]); - break; - } - } - rows.push(row); - } - return JSON.stringify(rows); + set scalesScaling(value2) { + if (this._scalesScaling != value2) { + this._scalesScaling = value2; + this._hasChanged = true; + } } - orderedIds(column) { - if (!this._orderedIds[column]) { - const start = window.performance.now(); - const orderedIds = new Uint32Array(this._ids); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - orderedIds.sort(function(a, b) { - return values[a] - values[b]; - }); - this._orderedIds[column] = orderedIds; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered ids ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedIds[column]; + constructor(core, options) { + super(core, options); + this._quat = create$1(); + this._materials = options.materials; + this._materialType = options.materialType; + this._materialColor = options.materialColors ? null : options.materialColor || core.config.textColor; + this._materialColors = options.materialColors; + this.minBoundsX = options.minBoundsX ? options.minBoundsX : 0; + this.minBoundsY = options.minBoundsY ? options.minBoundsY : 0; + this.minBoundsZ = options.minBoundsZ ? options.minBoundsZ : 0; + this.maxBoundsX = options.maxBoundsX ? options.maxBoundsX : 1; + this.maxBoundsY = options.maxBoundsY ? options.maxBoundsY : 1; + this.maxBoundsZ = options.maxBoundsZ ? options.maxBoundsZ : 1; + this._font = options.font || core.font; + this.text = options.text; + this.positionsX = options.positionsX; + this.positionsY = options.positionsY; + this.positionsZ = options.positionsZ; + this.positionScalingX = options.positionScalingX ? options.positionScalingX : 1; + this.positionScalingY = options.positionScalingY ? options.positionScalingY : 1; + this.positionScalingZ = options.positionScalingZ ? options.positionScalingZ : 1; + this.rotations = options.rotations; + this.offsetsX = options.offsetsX; + this.offsetsY = options.offsetsY; + this.offsetsZ = options.offsetsZ; + this.offsetScalingX = options.offsetScalingX ? options.offsetScalingX : 1; + this.offsetScalingY = options.offsetScalingY ? options.offsetScalingY : 1; + this.offsetScalingZ = options.offsetScalingZ ? options.offsetScalingZ : 1; + if (options.horizontalAlignments) + this.horizontalAlignments = options.horizontalAlignments; + if (options.verticalAlignments) + this.verticalAlignments = options.verticalAlignments; + if (options.scales) + this.scales = options.scales; + this.scalesScaling = options.scalesScaling ? options.scalesScaling : 1; } - orderedValues(column) { - if (!this._orderedValues[column]) { - const start = window.performance.now(); - const values = this._columnTypes[column] == (0, _tableJs.ColumnType).string ? this._createStringValues(column) : this._createNumericValues(column); - const orderedIds = this.orderedIds(column); - const orderedValues = new Float64Array(this._ids.length); - for(let i = 0; i < this._ids.length; i++)orderedValues[i] = values[orderedIds[i]]; - this._orderedValues[column] = orderedValues; - this._core.log.write((0, _mainJs.LogLevel).info, `ordered values ${column} ${Math.round(window.performance.now() - start)}ms`); - } - return this._orderedValues[column]; - } - distinctStringsOrdered(ids, column, stringValues) { - if (this._columnTypes[column] == (0, _tableJs.ColumnType).string) { - const distinctStrings = []; - const distinctStringValues = {}; - const set = new Set(); - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const string = this._data[id][column]; - let value; - if (!set.has(string)) { - distinctStrings.push(string); - value = set.size; - distinctStringValues[string] = value; - set.add(string); - } else value = distinctStringValues[string]; - stringValues[id] = value; - } - return distinctStrings; - } else return null; - } - _createMinMaxValues(column) { - if (!this._hasMinMaxValues[column]) { - const type = this._columnTypes[column]; - let min, max; - if (type == (0, _tableJs.ColumnType).string) { - this._createStringValues(column); - min = 0; - max = this._distinctStrings[column].length - 1; - } else { - const numericValues = this._createNumericValues(column); - min = Number.MAX_VALUE; - max = -Number.MAX_VALUE; - for(let i = 0; i < this._ids.length; i++){ - const id = this._ids[i]; - const value = numericValues[id]; - min = Math.min(min, value); - max = Math.max(max, value); - } - } - this._minValues[column] = min; - this._maxValues[column] = max; - this._hasMinMaxValues[column] = true; - } - } - _createNumericValues(column) { - if (!this._numericValues[column]) { - const numericValues = new Float64Array(this._data.length); - const type = this._columnTypes[column]; - if (type == (0, _tableJs.ColumnType).float) for(let i = 0; i < this._data.length; i++){ - const value = parseFloat(this._data[i][column]); - numericValues[i] = value; - } - else if (type == (0, _tableJs.ColumnType).integer) for(let i = 0; i < this._data.length; i++){ - const value = parseInt(this._data[i][column]); - numericValues[i] = value; + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.pickIdLookup = {}; + if (!this._text) { + this._indexCount = 0; + } else { + const start = window.performance.now(); + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + const modelOriginX = (this._minBoundsX + this._maxBoundsX) / 2; + const modelOriginY = (this._minBoundsY + this._maxBoundsY) / 2; + const modelOriginZ = (this._minBoundsZ + this._maxBoundsZ) / 2; + if (this._rotation) { + set$1(this._quat, this._rotation[0], this._rotation[1], this._rotation[2], this._rotation[3]); + } + let glyphs = 0; + for (let i = 0; i < this._text.length; i++) { + const offsetX = (this._offsetsX ? this._offsetsX[i] / 2 : this._offsetX) * boundsScaling * this._offsetScalingX; + const offsetY = (this._offsetsY ? this._offsetsY[i] / 2 : this._offsetY) * boundsScaling * this._offsetScalingY; + const offsetZ = (this._offsetsZ ? this._offsetsZ[i] / 2 : this._offsetZ) * boundsScaling * this._offsetScalingZ; + const text2 = TextHelper.truncate(this._text[i], this._maxGlyphs - glyphs); + const scale2 = (this._scales ? this._scales[i] * this._scalesScaling : this._scale) * boundsScaling / this._font.size; + TextHelper.measure(this._font, text2, this._textMetric); + const width2 = this._textMetric.width * scale2; + const lineHeight2 = this._font.size * scale2; + const maxGlyphTop = (this._maxGlyphTop ? this._maxGlyphTop : this._textMetric.maxTop) * scale2; + const horizontalAlignment = this._horizontalAlignments ? this._horizontalAlignments[i] : this._horizontalAlignment; + switch (horizontalAlignment) { + case HorizontalAlignment.left: + this._offset[0] = offsetX; + break; + case HorizontalAlignment.center: + this._offset[0] = offsetX - width2 / 2; + break; + case HorizontalAlignment.right: + this._offset[0] = offsetX - width2; + break; } - else if (type == (0, _tableJs.ColumnType).date) for(let i = 0; i < this._data.length; i++){ - const value = Date.parse(this._data[i][column]); - numericValues[i] = value; + const verticalAlignment = this._verticalAlignments ? this._verticalAlignments[i] : this._verticalAlignment; + switch (verticalAlignment) { + case VerticalAlignment.top: + this._offset[1] = offsetY - lineHeight2 / 2; + break; + case VerticalAlignment.center: + this._offset[1] = offsetY; + break; + case VerticalAlignment.bottom: + this._offset[1] = offsetY + lineHeight2 / 2; + break; } - this._numericValues[column] = numericValues; - } - return this._numericValues[column]; - } - _createStringValues(column) { - if (!this._stringValues[column]) { - this._stringValues[column] = new Float64Array(this._data.length); - this._distinctStrings[column] = this.distinctStringsOrdered(this._ids, column, this._stringValues[column]); - this._minValues[column] = 0; - this._maxValues[column] = this._distinctStrings[column].length - 1; - this._hasMinMaxValues[column] = true; - } - return this._stringValues[column]; - } -} - -},{"../main.js":"b6Xbk","./table.js":"cNpSp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kVjwp":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureHelper", ()=>TextureHelper); -var _mathJs = require("./math.js"); -class TextureHelper { - static create(gl, width, height, format, type, filter, bytes, internalFormat = format) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); - gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width, height, 0, format, type, bytes); - return texture; - } - static fromImage(gl, image, mipmaps, filter) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); - if (mipmaps && (0, _mathJs.MathHelper).isPowerOf2(image.width) && (0, _mathJs.MathHelper).isPowerOf2(image.height)) gl.generateMipmap(gl.TEXTURE_2D); - else { - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter); + this._offset[1] -= maxGlyphTop / 2; + this._offset[2] = offsetZ; + let positionX = this.positionsX ? this.positionsX[i] * this.positionScalingX : 0; + let positionY = this.positionsY ? this.positionsY[i] * this.positionScalingY : 0; + let positionZ = this.positionsZ ? this.positionsZ[i] * this.positionScalingZ : 0; + if (this._reverseX) { + positionX = this.minBoundsX + this.maxBoundsX - positionX; + } + if (this._reverseY) { + positionY = this.minBoundsY + this.maxBoundsY - positionY; + } + if (this._reverseZ) { + positionZ = this.minBoundsZ + this.maxBoundsZ - positionZ; + } + set$3(this._vec3, (positionX - modelOriginX) * boundsScaling, (positionY - modelOriginY) * boundsScaling, (positionZ - modelOriginZ) * boundsScaling); + if (this._rotations) { + set$1(this._quat, this._rotations[i * 4], this._rotations[i * 4 + 1], this._rotations[i * 4 + 2], this._rotations[i * 4 + 3]); + } + const pickId = PickHelper.nextPickId(); + PickHelper.encodeNumber(pickId, PickType.label, this._vec4); + this.pickIdLookup[pickId] = i; + TextHelper.addString(this._font, text2, this._verticesView, this._indices, glyphs, this._vec3, scale2, this._offset, this._rotation || this._rotations ? this._quat : null, this._vec4); + glyphs += text2.length; + if (glyphs >= this._maxGlyphs) { + glyphs = this._maxGlyphs; + break; + } + } + this._indexCount = glyphs * 6; + this._core.log.write(LogLevel.info, `label set updated ${Math.round(window.performance.now() - start)}ms`); + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } } - gl.bindTexture(gl.TEXTURE_2D, null); - return texture; + } } - static cubemapFromImages(gl, images) { - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); - const targets = [ - gl.TEXTURE_CUBE_MAP_POSITIVE_X, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X, - gl.TEXTURE_CUBE_MAP_POSITIVE_Y, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, - gl.TEXTURE_CUBE_MAP_POSITIVE_Z, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Z - ]; - for(let i = 0; i < 6; i++){ - gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - } - gl.generateMipmap(gl.TEXTURE_CUBE_MAP); - gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); - return texture; - } -} - -},{"./math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6KTQh":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TreeHelper", ()=>TreeHelper); -class TreeHelper { - static parentChildren(ids, parentIds, childIds) { - const rootIds = []; - const degrees = new Uint32Array(ids.length); - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const index = ids[i]; - const parentId = parentIds[index]; - const childId = childIds[index]; - indices[childId] = index; - if (children[parentId] === undefined) { - children[parentId] = []; - degrees[index] = 1; - } - if (parentId < 0 || parentId == childId) rootIds.push(parentId); - else { - children[parentId].push(childId); - degrees[index]++; - } - } - return { - rootIds: rootIds, - indices: indices, - children: children, - degrees: degrees - }; + } + let ImageVisual$2 = class ImageVisual { + render(elapsedTime, xrFrame) { } - static tree(rootId, indices, children, positions, widths, descendents) { - let nextId = 0; - const idsArray = []; - let maxDescendents = 0; - const buildTree = (parentId)=>{ - const index = indices[parentId]; - idsArray.push(index); - const childIds = children[parentId]; - if (childIds !== undefined) { - const start = nextId; - let total = 0; - for(let i = 0; i < childIds.length; i++){ - buildTree(childIds[i]); - total += descendents[indices[childIds[i]]] + 1; - } - const end = nextId - 1; - positions[index] = (start + end) / 2; - descendents[index] = total; - maxDescendents = Math.max(maxDescendents, total); - widths[index] = end - start + 1; - } else { - widths[index] = 1; - positions[index] = nextId++; - } - }; - buildTree(rootId); - const maxPosition = nextId - 1; - return { - ids: new Uint32Array(idsArray), - maxDescendents: maxDescendents, - maxPosition: maxPosition - }; + update(elapsedTime) { } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hTJIH":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SetHelper", ()=>SetHelper); -class SetHelper { - static new(a, b) { - a.clear(); - for (let item of b)a.add(item); - } - static union(a, b) { - for (let item of b)a.add(item); - } - static intersection(a, b) { - const c = new Set(b); - for (let item of a)if (!c.has(item)) a.delete(item); - for (let item of b)if (!a.has(item)) a.delete(item); - } - static symmetricDifference(a, b) { - for (let item of b)if (a.has(item)) a.delete(item); - else a.add(item); - } - static difference(a, b) { - for (let item of b)a.delete(item); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cvuqr":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfHelper", ()=>SdfHelper); -class SdfHelper { - static _circle(px, py, r) { - return Math.sqrt(px * px + py * py) - r; - } - static _box(px, py, bx, by) { - const dx0 = Math.abs(px) - bx; - const dy0 = Math.abs(py) - by; - const dx1 = Math.max(dx0, 0); - const dy1 = Math.max(dy0, 0); - return Math.sqrt(dx1 * dx1 + dy1 * dy1) + Math.min(Math.max(dx0, dy0), 0); - } - static _create(width, height, edge, sdf) { - const pixels = new Uint8ClampedArray(width * height * 4); - for(let y = 0; y < height; y++)for(let x = 0; x < width; x++){ - const d = edge - sdf(x - width / 2, y - height / 2); - const offset = (x + y * height) * 4; - pixels[offset] = d; - pixels[offset + 1] = d; - pixels[offset + 2] = d; - pixels[offset + 3] = 0xff; - } - return new ImageData(pixels, width, height); - } - static circle(imageWidth, imageHeight, radius, edgeValue) { - const sdf = (x, y)=>this._circle(x, y, radius); - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } - static box(imageWidth, imageHeight, boxWidth, boxHeight, edgeValue, rounding = 0) { - const sdf = (x, y)=>this._box(x, y, boxWidth - rounding, boxHeight - rounding) - rounding; - return this._create(imageWidth, imageHeight, edgeValue, sdf); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fLgIj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "VectorHelper", ()=>VectorHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -class VectorHelper { - static orthonormalBasis(n, b1, b2) { - if (n[0] > 0.9) (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITY); - else (0, _glMatrix.vec3).copy(b1, (0, _constantsJs.Constants).VECTOR3_UNITX); - (0, _glMatrix.vec3).scaleAndAdd(b1, b1, n, -(0, _glMatrix.vec3).dot(b1, n)); - (0, _glMatrix.vec3).normalize(b1, b1); - (0, _glMatrix.vec3).cross(b2, n, b1); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7e7Mi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>(0, _barJs.Bar)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Line", ()=>(0, _lineJs.Line)); -parcelHelpers.export(exports, "Tree", ()=>(0, _treeJs.Tree)); -parcelHelpers.export(exports, "PythagorasTree", ()=>(0, _treeJs.PythagorasTree)); -parcelHelpers.export(exports, "Scatter", ()=>(0, _scatterJs.Scatter)); -parcelHelpers.export(exports, "Sheet", ()=>(0, _sheetJs.Sheet)); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>(0, _treemapJs.SquarifiedTreeMap)); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>(0, _treemapJs.CubifiedTreeMap)); -parcelHelpers.export(exports, "Stack", ()=>(0, _stackJs.Stack)); -parcelHelpers.export(exports, "StackTreeMap", ()=>(0, _stackJs.StackTreeMap)); -var _barJs = require("./bar.js"); -var _cubeJs = require("./cube.js"); -var _lineJs = require("./line.js"); -var _treeJs = require("./tree.js"); -var _scatterJs = require("./scatter.js"); -var _sheetJs = require("./sheet.js"); -var _treemapJs = require("./treemap.js"); -var _stackJs = require("./stack.js"); - -},{"./bar.js":"coa76","./cube.js":"fwMCO","./line.js":"2wx47","./tree.js":"8yKY2","./scatter.js":"kIsBP","./sheet.js":"aH4Zb","./treemap.js":"gDhOz","./stack.js":"9D8OK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"coa76":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bar", ()=>Bar); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Bar extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const heightScaling = options.heightScaling === undefined ? 1 : options.heightScaling; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const paddingX = options.paddingX == undefined ? 0 : options.paddingX * positionScalingX; - const paddingZ = options.paddingZ == undefined ? 0 : options.paddingZ * positionScalingZ; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - let positionX, positionY, positionZ; - let sizeX, sizeY, sizeZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(options.heights ? options.heights[id] * heightScaling : heightScaling, minHeight); - positionX = options.positionsX ? options.positionsX[id] * positionScalingX : 0; - positionY = height / 2; - positionZ = options.positionsZ ? options.positionsZ[id] * positionScalingZ : 0; - this._positions[index * 3] = positionX; - this._positions[index * 3 + 1] = positionY; - this._positions[index * 3 + 2] = positionZ; - sizeX = (options.sizeX === undefined ? options.sizesX ? options.sizesX[id] : 1 : options.sizeX) * positionScalingX; - sizeY = Math.abs(height); - sizeZ = (options.sizeZ === undefined ? options.sizesZ ? options.sizesZ[id] : 1 : options.sizeZ) * positionScalingZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX - sizeX / 2); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY - sizeY / 2); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ - sizeZ / 2); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX + sizeX / 2); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY + sizeY / 2); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ + sizeZ / 2); - this._sizes[index * 3] = Math.max(sizeX - paddingX, 0); - this._sizes[index * 3 + 1] = sizeY; - this._sizes[index * 3 + 2] = Math.max(sizeZ - paddingZ, 0); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + constructor(image2) { + this.image = image2; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - if (options.colors1) { - const color1 = (0, _mathJs.MathHelper).normalize(options.colors1[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color1); - } else (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fwMCO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cube", ()=>Cube); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Cube extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + }; + class ImageBase { + get material() { + return this._material; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.cbrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / (side * side)); - const z = Math.floor((i - y * side * side) / side); - const x = i - y * side * side - z * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = z; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, z); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get vertices() { + return this._vertices; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - _vec2[0] = color; - _vec2[1] = color; - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2wx47":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Line", ()=>Line); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Line extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const positionScalingX = options.positionScalingX === undefined ? 1 : options.positionScalingX; - const positionScalingY = options.positionScalingY === undefined ? 1 : options.positionScalingY; - const positionScalingZ = options.positionScalingZ === undefined ? 1 : options.positionScalingZ; - const sizeScalingX = options.sizeScaling === undefined ? options.sizeScalingX === undefined ? 1 : options.sizeScalingX : options.sizeScaling; - const sizeScalingY = options.sizeScaling === undefined ? options.sizeScalingY === undefined ? 1 : options.sizeScalingY : options.sizeScaling; - const sizeScalingZ = options.sizeScaling === undefined ? options.sizeScalingZ === undefined ? 1 : options.sizeScalingZ : options.sizeScaling; - const minSize = options.minSize === undefined ? 0 : options.minSize; - const offsetScaling = options.offsetScaling === undefined ? 1 : options.offsetScaling; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float32Array(buffer.length * 3); - this._sizes = new Float32Array(buffer.length * 3); - this._rotations = new Float32Array(buffer.length * 4); - } - this.minLayoutBoundsX = Number.MAX_VALUE; - this.minLayoutBoundsY = Number.MAX_VALUE; - this.minLayoutBoundsZ = Number.MAX_VALUE; - this.maxLayoutBoundsX = -Number.MAX_VALUE; - this.maxLayoutBoundsY = -Number.MAX_VALUE; - this.maxLayoutBoundsZ = -Number.MAX_VALUE; - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const direction = (0, _glMatrix.vec3).create(); - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; - let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; - let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; - let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; - let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; - let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; - if (fromId == toId) { - this._sizes[index * 3] = 0; - this._sizes[index * 3 + 1] = 0; - this._sizes[index * 3 + 2] = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - } else { - direction[0] = toPositionX - fromPositionX; - direction[1] = toPositionY - fromPositionY; - direction[2] = toPositionZ - fromPositionZ; - let length = (0, _glMatrix.vec3).length(direction); - (0, _glMatrix.vec3).scale(direction, direction, 1 / length); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, direction); - this._rotations[index * 4] = _quat[0]; - this._rotations[index * 4 + 1] = _quat[1]; - this._rotations[index * 4 + 2] = _quat[2]; - this._rotations[index * 4 + 3] = _quat[3]; - if (options.offsets) { - const fromOffset = options.offsets[fromId] * offsetScaling / 2; - const toOffset = options.offsets[toId] * offsetScaling / 2; - toPositionX -= direction[0] * toOffset; - toPositionY -= direction[1] * toOffset; - toPositionZ -= direction[2] * toOffset; - fromPositionX += direction[0] * fromOffset; - fromPositionY += direction[1] * fromOffset; - fromPositionZ += direction[2] * fromOffset; - length = Math.max(length - toOffset - fromOffset, minSize); - } - this._sizes[index * 3 + 1] = Math.max(length * sizeScalingY, minSize); - if (options.lineSizes) { - this._sizes[index * 3] = Math.max(options.lineSizes[id] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.lineSizes[id] * sizeScalingZ, minSize); - } else if (options.endSizes) { - this._sizes[index * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); - this._sizes[index * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); - } else { - this._sizes[index * 3] = sizeScalingX; - this._sizes[index * 3 + 2] = sizeScalingZ; - } - } - _vec3[0] = (fromPositionX + toPositionX) / 2; - _vec3[1] = (fromPositionY + toPositionY) / 2; - _vec3[2] = (fromPositionZ + toPositionZ) / 2; - this._positions[index * 3] = _vec3[0]; - this._positions[index * 3 + 1] = _vec3[1]; - this._positions[index * 3 + 2] = _vec3[2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get indices() { + return this._indices; } - update(buffer, ids, fromIds, toIds, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const endMinColor = options.endMinColor === undefined ? 0 : options.endMinColor; - const endMaxColor = options.endMaxColor === undefined ? 1 : options.endMaxColor; - const lineMinColor = options.lineMinColor === undefined ? 0 : options.lineMinColor; - const lineMaxColor = options.lineMaxColor === undefined ? 1 : options.lineMaxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const fromId = fromIds[id]; - const toId = toIds[id]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - let size; - if (options.endColors) { - size = 1 / (endMaxColor - endMinColor + 1); - const fromColor = (0, _mathJs.MathHelper).normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - const toColor = (0, _mathJs.MathHelper).normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, fromColor, toColor); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else if (options.lineColors) { - size = 1 / (lineMaxColor - lineMinColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.lineColors[id], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8yKY2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PythagorasTree", ()=>PythagorasTree); -parcelHelpers.export(exports, "Tree", ()=>Tree); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _angleJs = require("../helpers/angle.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class PythagorasTree extends (0, _layoutJs.LayoutBase) { - get levels() { - return this._levels; - } - get maxLevel() { - return this._maxLevel; - } - get volumes() { - return this._volumes; - } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentTranslation = (0, _glMatrix.vec3).create(); - this._parentScale = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - } - static calculateTotalVertices(level) { - return (2 << level) - 1; - } - static calculateMaxLevel(vertices) { - return Math.ceil(Math.log2(vertices + 1)) - 1; + get indexCount() { + return this._indexCount; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const scalingX = options.scalingX === undefined ? 1 : options.scalingX; - const scalingY = options.scalingY === undefined ? 1 : options.scalingY; - const scalingZ = options.scalingZ === undefined ? 1 : options.scalingZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._levels = new Uint32Array(buffer.length); - this._volumes = new Float64Array(buffer.length); - } - this._maxLevel = PythagorasTree.calculateMaxLevel(ids.length); - const lookup = buffer.lookup; - const id = ids[0]; - const index = lookup[id]; - this._levels[index] = 0; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3] = scalingX; - this._sizes[index * 3 + 1] = scalingY; - this._sizes[index * 3 + 2] = scalingZ; - this._volumes[index] = scalingX * scalingY * scalingZ; - this._count = 1; - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(index, ids, lookup, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); + get isInitialized() { + return this._isInitialized; } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentIndex, ids, lookup, pseudoRandom) { - const parentLevel = this._levels[parentIndex]; - if (parentLevel < this._maxLevel && this._count < ids.length) { - let angle = this._angle + (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - this._parentTranslation[0] = this._positions[parentIndex * 3]; - this._parentTranslation[1] = this._positions[parentIndex * 3 + 1]; - this._parentTranslation[2] = this._positions[parentIndex * 3 + 2]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - this._parentScale[0] = this._sizes[parentIndex * 3]; - this._parentScale[1] = this._sizes[parentIndex * 3 + 1]; - this._parentScale[2] = this._sizes[parentIndex * 3 + 2]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - const childId1 = ids[this._count++]; - const childIndex1 = lookup[childId1]; - let cos = Math.cos(angle); - this._sizes[childIndex1 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex1 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex1 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex1 * 4] = this._childRotation[0]; - this._rotations[childIndex1 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex1 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex1 * 4 + 3] = this._childRotation[3]; - const halfparentScaleX = this._parentScale[0] * 0.5; - const halfparentScaleY = this._parentScale[1] * 0.5; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos + this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos + this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos + this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY - this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY - this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY - this._parentRight[2] * halfparentScaleX; - this._positions[childIndex1 * 3] = childTranslationX; - this._positions[childIndex1 * 3 + 1] = childTranslationY; - this._positions[childIndex1 * 3 + 2] = childTranslationZ; - this._levels[childIndex1] = parentLevel + 1; - this._volumes[childIndex1] = this._sizes[childIndex1 * 3] * this._sizes[childIndex1 * 3 + 1] * this._sizes[childIndex1 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (this._count < ids.length) { - const childId2 = ids[this._count++]; - const childIndex2 = lookup[childId2]; - cos = Math.cos((0, _constantsJs.Constants).PI_OVER_TWO - angle); - this._sizes[childIndex2 * 3] = this._parentScale[0] * cos; - this._sizes[childIndex2 * 3 + 1] = this._parentScale[1] * cos; - this._sizes[childIndex2 * 3 + 2] = this._parentScale[2] * cos; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentForward, angle - (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - this._rotations[childIndex2 * 4] = this._childRotation[0]; - this._rotations[childIndex2 * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex2 * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex2 * 4 + 3] = this._childRotation[3]; - this._vec3[0] = this._parentUp[0] * halfparentScaleY * cos - this._parentRight[0] * halfparentScaleX * cos; - this._vec3[1] = this._parentUp[1] * halfparentScaleY * cos - this._parentRight[1] * halfparentScaleX * cos; - this._vec3[2] = this._parentUp[2] * halfparentScaleY * cos - this._parentRight[2] * halfparentScaleX * cos; - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._quat); - const childTranslationX = this._parentTranslation[0] + this._vec3[0] + this._parentUp[0] * halfparentScaleY + this._parentRight[0] * halfparentScaleX; - const childTranslationY = this._parentTranslation[1] + this._vec3[1] + this._parentUp[1] * halfparentScaleY + this._parentRight[1] * halfparentScaleX; - const childTranslationZ = this._parentTranslation[2] + this._vec3[2] + this._parentUp[2] * halfparentScaleY + this._parentRight[2] * halfparentScaleX; - this._positions[childIndex2 * 3] = childTranslationX; - this._positions[childIndex2 * 3 + 1] = childTranslationY; - this._positions[childIndex2 * 3 + 2] = childTranslationZ; - this._levels[childIndex2] = parentLevel + 1; - this._volumes[childIndex2] = this._sizes[childIndex2 * 3] * this._sizes[childIndex2 * 3 + 1] * this._sizes[childIndex2 * 3 + 2]; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - this._branch(childIndex1, ids, lookup, pseudoRandom); - this._branch(childIndex2, ids, lookup, pseudoRandom); - } - } + get mMatrix() { + return this._mMatrix; } -} -class Tree extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; + get imageData() { + return this._imageData; } - getPositionY(index) { - return this._positions[index * 3 + 1]; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._hasChanged = true; + } } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + get rotation() { + return this._rotation; } - getSizeX(index) { - return this._sizes[index * 3]; + set rotation(value2) { + if (!equals$1(this._rotation, value2)) { + copy$1(this._rotation, value2); + this._hasChanged = true; + } } - getSizeY(index) { - return this._sizes[index * 3 + 1]; + get position() { + return this._position; } - getSizeZ(index) { - return this._sizes[index * 3 + 2]; + set position(value2) { + if (!equals$2(this._position, value2)) { + copy$3(this._position, value2); + this._hasChanged = true; + } } - constructor(core){ - super(core); - this._vec3 = (0, _glMatrix.vec3).create(); - this._quat = (0, _glMatrix.quat).create(); - this._childRotation = (0, _glMatrix.quat).create(); - this._parentRight = (0, _glMatrix.vec3).create(); - this._parentUp = (0, _glMatrix.vec3).create(); - this._parentForward = (0, _glMatrix.vec3).create(); - this._parentRotation = (0, _glMatrix.quat).create(); - this._parentTwist = (0, _glMatrix.quat).create(); + get texCoord0() { + return this._texCoord0; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const rootId = options.rootId; - this._sizeX = options.sizeX === undefined ? 1 : options.sizeX; - this._sizeY = options.sizeY === undefined ? 1 : options.sizeY; - this._sizeZ = options.sizeZ === undefined ? 1 : options.sizeZ; - this._angle = options.angle === undefined ? (0, _angleJs.AngleHelper).degreesToRadians(45) : options.angle; - this._randomAngle = options.randomAngle === undefined ? 0 : options.randomAngle; - this._twist = options.twist === undefined ? 0 : options.twist; - this._lengthScaling = options.lengthScaling === undefined ? 1 : options.lengthScaling; - this._thicknessScaling = options.thicknessScaling === undefined ? 1 : options.thicknessScaling; - this._randomTwist = options.randomTwist === undefined ? 0 : options.randomTwist; - this._randomSplit = options.randomSplit === undefined ? 0 : options.randomSplit; - this._randomLengthScaling = options.randomLengthScaling === undefined ? 0 : options.randomLengthScaling; - this._randomThicknessScaling = options.randomThicknessScaling === undefined ? 0 : options.randomThicknessScaling; - this._minLength = options.minLength === undefined ? 0 : options.minLength; - this._minThickness = options.minThickness === undefined ? 0 : options.minThickness; - this._lengthScalings = options.lengthScalings; - this._thicknessScalings = options.thicknessScalings; - this._splitAngles = options.splitAngles; - this._angles = options.angles; - if (!this._positions || this._positions.length < buffer.length * 3) { - this._positions = new Float64Array(buffer.length * 3); - this._sizes = new Float64Array(buffer.length * 3); - this._rotations = new Float64Array(buffer.length * 4); - this._parentRights = new Float64Array(buffer.length * 3); - this._parentUps = new Float64Array(buffer.length * 3); - this._parentForwards = new Float64Array(buffer.length * 3); - this._parentTwists = new Float64Array(buffer.length * 4); - } - const lookup = buffer.lookup; - const indices = {}; - const children = {}; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - const parentId = options.parentIds[index]; - const childId = options.childIds[index]; - indices[childId] = index; - if (childId === rootId) children[rootId] = []; - else { - if (children[parentId] === undefined) children[parentId] = []; - children[parentId].push(childId); - } - } - const index = indices[rootId]; - this._positions[index * 3] = 0; - this._positions[index * 3 + 1] = 0; - this._positions[index * 3 + 2] = 0; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - this._rotations[index * 4] = 0; - this._rotations[index * 4 + 1] = 0; - this._rotations[index * 4 + 2] = 0; - this._rotations[index * 4 + 3] = 1; - this._sizes[index * 3 + 1] = this._sizeY; - this._sizes[index * 3] = this._sizeX; - this._sizes[index * 3 + 2] = this._sizeZ; - if (this._lengthScalings) { - this._lengthScaling = this._lengthScalings[index]; - this._sizes[index * 3 + 1] *= this._lengthScaling; - } - if (this._thicknessScalings) { - this._thicknessScaling = this._thicknessScalings[index]; - this._sizes[index * 3] *= this._thicknessScaling; - this._sizes[index * 3 + 2] *= this._thicknessScaling; - } - const pseudoRandom = new (0, _mathJs.PseudoRandom)(0); - this._branch(rootId, indices, children, pseudoRandom); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); + set texCoord0(value2) { + if (!equals(this._texCoord0, value2)) { + copy(this._texCoord0, value2); + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < ids.length; i++){ - const id = ids[i]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (reverseX) positionX = this.modelOriginX + this.modelOriginX - positionX; - if (reverseY) positionY = this.modelOriginY + this.modelOriginY - positionY; - if (reverseZ) positionZ = this.modelOriginZ + this.modelOriginZ - positionZ; - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = this._sizes[index * 3] * this._boundsScaling; - _vec3[1] = this._sizes[index * 3 + 1] * this._boundsScaling; - _vec3[2] = this._sizes[index * 3 + 2] * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - _quat[0] = this._rotations[index * 4]; - _quat[1] = this._rotations[index * 4 + 1]; - _quat[2] = this._rotations[index * 4 + 2]; - _quat[3] = this._rotations[index * 4 + 3]; - if (reverseX) { - _quat[1] = -_quat[1]; - _quat[2] = -_quat[2]; - } - if (reverseY) { - _quat[0] = -_quat[0]; - _quat[2] = -_quat[2]; - } - if (reverseZ) { - _quat[0] = -_quat[0]; - _quat[1] = -_quat[1]; - } - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = i / (ids.length - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = i / (ids.length - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} vertices ${Math.round(window.performance.now() - start)}ms`); - } - _branch(parentId, indices, children, pseudoRandom) { - const childIds = children[parentId]; - const parentIndex = indices[parentId]; - this._parentRotation[0] = this._rotations[parentIndex * 4]; - this._parentRotation[1] = this._rotations[parentIndex * 4 + 1]; - this._parentRotation[2] = this._rotations[parentIndex * 4 + 2]; - this._parentRotation[3] = this._rotations[parentIndex * 4 + 3]; - (0, _glMatrix.vec3).transformQuat(this._parentUp, (0, _constantsJs.Constants).VECTOR3_UNITY, this._parentRotation); - this._parentUps[parentIndex * 3] = this._parentUp[0]; - this._parentUps[parentIndex * 3 + 1] = this._parentUp[1]; - this._parentUps[parentIndex * 3 + 2] = this._parentUp[2]; - let twist = this._twist + (pseudoRandom.nextFloat() * 2 - 1) * this._randomTwist; - twist = (0, _mathJs.MathHelper).clamp(twist, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, twist); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._parentTwist, this._quat, this._parentRotation); - this._parentTwists[parentIndex * 4] = this._parentTwist[0]; - this._parentTwists[parentIndex * 4 + 1] = this._parentTwist[1]; - this._parentTwists[parentIndex * 4 + 2] = this._parentTwist[2]; - this._parentTwists[parentIndex * 4 + 3] = this._parentTwist[3]; - (0, _glMatrix.vec3).transformQuat(this._parentRight, (0, _constantsJs.Constants).VECTOR3_UNITX, this._parentTwist); - this._parentRights[parentIndex * 3] = this._parentRight[0]; - this._parentRights[parentIndex * 3 + 1] = this._parentRight[1]; - this._parentRights[parentIndex * 3 + 2] = this._parentRight[2]; - (0, _glMatrix.vec3).transformQuat(this._parentForward, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._parentTwist); - this._parentForwards[parentIndex * 3] = this._parentForward[0]; - this._parentForwards[parentIndex * 3 + 1] = this._parentForward[1]; - this._parentForwards[parentIndex * 3 + 2] = this._parentForward[2]; - for(let i = 0; i < childIds.length; i++){ - const childId = childIds[i]; - const childIndex = indices[childId]; - const parentScaleX = this._sizes[parentIndex * 3]; - const parentScaleY = this._sizes[parentIndex * 3 + 1]; - const parentScaleZ = this._sizes[parentIndex * 3 + 2]; - this._parentUp[0] = this._parentUps[parentIndex * 3]; - this._parentUp[1] = this._parentUps[parentIndex * 3 + 1]; - this._parentUp[2] = this._parentUps[parentIndex * 3 + 2]; - this._parentTwist[0] = this._parentTwists[parentIndex * 4]; - this._parentTwist[1] = this._parentTwists[parentIndex * 4 + 1]; - this._parentTwist[2] = this._parentTwists[parentIndex * 4 + 2]; - this._parentTwist[3] = this._parentTwists[parentIndex * 4 + 3]; - if (this._lengthScalings) { - const lengthScale = this._lengthScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(this._sizeY * lengthScale, this._minLength); - } else { - const lengthScale = this._lengthScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomLengthScaling; - this._sizes[childIndex * 3 + 1] = Math.max(parentScaleY * lengthScale, this._minLength); - } - if (this._thicknessScalings) { - const thicknessScale = this._thicknessScalings[childIndex] + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(this._sizeX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(this._sizeZ * thicknessScale, this._minThickness); - } else { - const thicknessScale = this._thicknessScaling + (pseudoRandom.nextFloat() * 2 - 1) * this._randomThicknessScaling; - this._sizes[childIndex * 3] = Math.max(parentScaleX * thicknessScale, this._minThickness); - this._sizes[childIndex * 3 + 2] = Math.max(parentScaleZ * thicknessScale, this._minThickness); - } - let split; - if (this._splitAngles) split = this._splitAngles[childIndex]; - else split = (0, _constantsJs.Constants).TWO_PI * i / childIds.length; - split += (pseudoRandom.nextFloat() * 2 - 1) * this._randomSplit; - (0, _glMatrix.quat).setAxisAngle(this._quat, this._parentUp, split); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._quat, this._parentTwist); - let angle; - if (this._angles) angle = this._angles[childIndex]; - else angle = this._angle; - angle += (pseudoRandom.nextFloat() * 2 - 1) * this._randomAngle; - angle = (0, _mathJs.MathHelper).clamp(angle, -(0, _constantsJs.Constants).PI_OVER_TWO, (0, _constantsJs.Constants).PI_OVER_TWO); - (0, _glMatrix.quat).setAxisAngle(this._quat, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).normalize(this._quat, this._quat); - (0, _glMatrix.quat).multiply(this._childRotation, this._childRotation, this._quat); - this._rotations[childIndex * 4] = this._childRotation[0]; - this._rotations[childIndex * 4 + 1] = this._childRotation[1]; - this._rotations[childIndex * 4 + 2] = this._childRotation[2]; - this._rotations[childIndex * 4 + 3] = this._childRotation[3]; - const halfParentScaleY = parentScaleY * 0.5; - const halfChildScaleY = this._sizes[childIndex * 3 + 1] * 0.5; - (0, _glMatrix.vec3).transformQuat(this._vec3, (0, _constantsJs.Constants).VECTOR3_UNITY, this._childRotation); - const childTranslationX = this._positions[parentIndex * 3] + this._parentUp[0] * halfParentScaleY + this._vec3[0] * halfChildScaleY; - const childTranslationY = this._positions[parentIndex * 3 + 1] + this._parentUp[1] * halfParentScaleY + this._vec3[1] * halfChildScaleY; - const childTranslationZ = this._positions[parentIndex * 3 + 2] + this._parentUp[2] * halfParentScaleY + this._vec3[2] * halfChildScaleY; - this._positions[childIndex * 3] = childTranslationX; - this._positions[childIndex * 3 + 1] = childTranslationY; - this._positions[childIndex * 3 + 2] = childTranslationZ; - this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, childTranslationX); - this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, childTranslationY); - this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, childTranslationZ); - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, childTranslationX); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, childTranslationY); - this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, childTranslationZ); - if (children[childId]) this._branch(childId, indices, children, pseudoRandom); - } - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/angle.js":"hBXkO","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aH4Zb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Sheet", ()=>Sheet); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class Sheet extends (0, _layoutJs.LayoutBase) { - getPositionX(index) { - return this._positions[index * 3]; - } - getPositionY(index) { - return this._positions[index * 3 + 1]; - } - getPositionZ(index) { - return this._positions[index * 3 + 2]; + get texCoord1() { + return this._texCoord1; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const side = options.side === undefined ? Math.ceil(Math.sqrt(count)) : options.side; - if (!this._positions || this._positions.length < buffer.length * 3) this._positions = new Float32Array(buffer.length * 3); - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = 0; - this.maxLayoutBoundsY = 0; - this.maxLayoutBoundsZ = 0; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const y = Math.floor(i / side); - const x = i - y * side; - this._positions[index * 3] = x; - this._positions[index * 3 + 1] = y; - this._positions[index * 3 + 2] = 0; - this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, x); - this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, y); - } - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + set texCoord1(value2) { + if (!equals(this._texCoord1, value2)) { + copy(this._texCoord1, value2); + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (1 - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positions[index * 3]; - let positionY = this._positions[index * 3 + 1]; - let positionZ = this._positions[index * 3 + 2]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)} ms`); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gDhOz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SquarifiedTreeMap", ()=>SquarifiedTreeMap); -parcelHelpers.export(exports, "CubifiedTreeMap", ()=>CubifiedTreeMap); -parcelHelpers.export(exports, "TreeMapHelper", ()=>TreeMapHelper); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _mainJs = require("../main.js"); -var _vertexJs = require("../vertex.js"); -var _layoutJs = require("./layout.js"); -class SquarifiedTreeMap extends (0, _layoutJs.LayoutBase) { - get positionsX() { - return this._positionsX; + get minBoundsX() { + return this._minBoundsX; } - get positionsY() { - return this._positionsY; + set minBoundsX(value2) { + if (this._minBoundsX != value2) { + this._minBoundsX = value2; + this._hasChanged = true; + } } - get sizesX() { - return this._sizesX; + get minBoundsY() { + return this._minBoundsY; } - get sizesY() { - return this._sizesY; + set minBoundsY(value2) { + if (this._minBoundsY != value2) { + this._minBoundsY = value2; + this._hasChanged = true; + } } - layout(buffer, ids, options) { - const start = window.performance.now(); - const size = options.size == undefined ? 1 : options.size; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } else if (size <= 0) return; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - } - TreeMapHelper.squarifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, sizeX, sizeY, buffer.lookup); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + get minBoundsZ() { + return this._minBoundsZ; } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const heights = options.heights; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - let maxHeight; - if (heights) { - maxHeight = 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - maxHeight = Math.max(heights[id], maxHeight); - } - } else maxHeight = 1; - const heightScaling = (this.maxLayoutBoundsZ - this.minLayoutBoundsZ) / maxHeight; - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const height = Math.max(heights ? heights[id] * heightScaling : heightScaling, minHeight); - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this.minLayoutBoundsZ + height / 2; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = height * this._boundsScaling; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class CubifiedTreeMap extends (0, _layoutJs.LayoutBase) { - layout(buffer, ids, options) { - const start = window.performance.now(); - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - let offset = options.offset === undefined ? 0 : options.offset; - let count = options.count === undefined ? ids.length : options.count; - this.minLayoutBoundsX = options.minBoundsX; - this.minLayoutBoundsY = options.minBoundsY; - this.minLayoutBoundsZ = options.minBoundsZ; - this.maxLayoutBoundsX = options.maxBoundsX; - this.maxLayoutBoundsY = options.maxBoundsY; - this.maxLayoutBoundsZ = options.maxBoundsZ; - if (options.sizes) { - for(let i = 0; i < count; i++){ - if (options.sizes[ids[offset]] > 0) break; - offset++; - count--; - } - if (count == 0) return; - } - const sizeX = this.maxLayoutBoundsX - this.minLayoutBoundsX; - const sizeY = this.maxLayoutBoundsY - this.minLayoutBoundsY; - const sizeZ = this.maxLayoutBoundsZ - this.minLayoutBoundsZ; - const minHeight = this._core.config.minCubifiedTreeMapSlice / sizeY; - const side = Math.sqrt(sizeX * sizeZ); - const total = options.sizes ? TreeMapHelper.totalSize(ids, options.sizes, offset, offset + count - 1) : count; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - } - TreeMapHelper.cubifiedLayout(ids, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, offset, offset + count - 1, this.minLayoutBoundsX, this.minLayoutBoundsY, this.minLayoutBoundsZ, sizeX, sizeY, sizeZ, side, total, minHeight, isTopToBottom, buffer.lookup); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + set minBoundsZ(value2) { + if (this._minBoundsZ != value2) { + this._minBoundsZ = value2; + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, (0, _constantsJs.Constants).QUAT_IDENTITY); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TreeMapHelper { - static squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - if (from > to) return; - if (to - from < 2) { - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup); - return; - } - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - const a = sizes ? sizes[ids[to]] / totalSize : 1 / totalSize; - let b = a; - let mid = to; - if (width < height) { - while(mid > from){ - const aspect = TreeMapHelper._aspect(height, width, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(height, width, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width, height * b, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x, y + height * b, width, height * (1 - b), lookup); - } else { - while(mid > from){ - const aspect = TreeMapHelper._aspect(width, height, a, b); - const q = sizes ? sizes[ids[mid - 1]] / totalSize : 1 / totalSize; - if (TreeMapHelper._aspect(width, height, a, b + q) > aspect) break; - mid--; - b += q; - } - TreeMapHelper._sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, mid, to, x, y, width * b, height, lookup); - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, mid - 1, x + width * b, y, width * (1 - b), height, lookup); - } + get maxBoundsX() { + return this._maxBoundsX; } - static totalSize(ids, sizes, from, to) { - let size = 0; - for(let i = from; i <= to; i++)size += sizes[ids[i]]; - return size; + set maxBoundsX(value2) { + if (this._maxBoundsX != value2) { + this._maxBoundsX = value2; + this._hasChanged = true; + } } - static _sliceLayout(ids, sizes, positionsX, positionsY, sizesX, sizesY, from, to, x, y, width, height, lookup) { - const totalSize = sizes ? TreeMapHelper.totalSize(ids, sizes, from, to) : to - from + 1; - let a = 0; - for(let i = to; i >= from; i--){ - const id = ids[i]; - const index = lookup[id]; - const b = sizes ? sizes[id] / totalSize : 1 / totalSize; - if (width > height) { - sizesY[index] = height; - sizesX[index] = width * b; - positionsY[index] = y + height / 2; - positionsX[index] = x + width * a + width * b / 2; - } else { - sizesX[index] = width; - sizesY[index] = height * b; - positionsX[index] = x + width / 2; - positionsY[index] = y + height * a + height * b / 2; - } - a += b; - } - } - static _aspect(big, small, a, b) { - const x = big * b / (small * a / b); - if (x < 1) return 1 / x; - return x; - } - static cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, to, x, y, z, width, height, depth, side, total, minHeight, isTopToBottom, lookup) { - if (from > to) return; - let sliceHeight = 0; - let sliceTotal = 0; - let previousAspect = 0; - let mid = to; - while(mid >= from){ - const itemSize = sizes ? sizes[ids[mid]] : 1; - sliceTotal += itemSize; - sliceHeight = height * sliceTotal / total; - const remainingHeight = height - sliceHeight; - if (remainingHeight < minHeight) { - mid = from; - const totalSize = sizes ? this.totalSize(ids, sizes, mid, to) : to - from + 1; - sliceHeight = height * totalSize / total; - break; - } - const itemSide = Math.sqrt(itemSize / sliceTotal) * side; - const aspect = itemSide > sliceHeight ? sliceHeight / itemSide : itemSide / sliceHeight; - if (aspect < previousAspect || mid == from) break; - previousAspect = aspect; - mid--; - } - TreeMapHelper.squarifiedLayout(ids, sizes, positionsX, positionsZ, sizesX, sizesZ, mid, to, x, z, width, depth, lookup); - for(let j = mid; j <= to; j++){ - const id = ids[j]; - const index = lookup[id]; - sizesY[index] = Math.max(sliceHeight, 0.01); - positionsY[index] = isTopToBottom ? positionsY[index] = y + sliceHeight / 2 : y + height - sliceHeight / 2; - } - TreeMapHelper.cubifiedLayout(ids, sizes, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, from, mid - 1, x, isTopToBottom ? y + sliceHeight : y, z, width, height - sliceHeight, depth, side, total - sliceTotal, minHeight, isTopToBottom, lookup); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../main.js":"b6Xbk","../vertex.js":"8lW8V","./layout.js":"ijsq1","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9D8OK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "StackBase", ()=>StackBase); -parcelHelpers.export(exports, "Stack", ()=>Stack); -parcelHelpers.export(exports, "StackTreeMap", ()=>StackTreeMap); -var _constantsJs = require("../constants.js"); -var _mathJs = require("../helpers/math.js"); -var _vertexJs = require("../vertex.js"); -var _treemapJs = require("./treemap.js"); -var _layoutJs = require("./layout.js"); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -class StackBase extends (0, _layoutJs.LayoutBase) { - get maxCount() { - return this._maxCount; - } - get levels() { - return this._levels; - } - get binCounts() { - return this._binCounts; - } - getPositionX(index) { - return this._positionsX[index]; - } - getPositionY(index) { - return this._positionsY[index]; - } - getPositionZ(index) { - return this._positionsZ[index]; - } -} -class Stack extends StackBase { - get maxLevel() { - return this._maxLevel; + get maxBoundsY() { + return this._maxBoundsY; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - this._maxLevel = 0; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - this._height = options.height == undefined ? 1 : options.height; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._levels = new Uint32Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinLevel = 0; - let positionX, positionY, positionZ; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - const binCount = this._binCounts[binId]; - const level = Math.floor(binCount / sizeX / sizeZ); - this._levels[index] = level; - const levelCount = binCount - level * sizeX * sizeZ; - const itemZ = Math.floor(levelCount / sizeX); - const itemX = levelCount - itemZ * sizeX; - positionX = spacingX / 2 + binIdX * (sizeX + spacingX) + itemX + 0.5; - positionY = this._height * (level + 0.5); - positionZ = spacingZ / 2 + binIdZ * (sizeZ + spacingZ) + itemZ + 0.5; - this._positionsX[index] = positionX; - this._positionsY[index] = positionY; - this._positionsZ[index] = positionZ; - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - maxBinLevel = Math.max(maxBinLevel, level); - } - this._maxLevel = maxBinLevel + 1; - this._maxCount = maxBinCount; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = this._maxLevel * this._height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + set maxBoundsY(value2) { + if (this._maxBoundsY != value2) { + this._maxBoundsY = value2; + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _vec4 = (0, _glMatrix.vec4).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const thickness = options.thickness === undefined ? 1 - padding : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - if (options.texCoord) { - _vec4[0] = options.texCoord[0]; - _vec4[1] = options.texCoord[1]; - _vec4[2] = options.texCoord[2]; - _vec4[3] = options.texCoord[3]; - } - const scale = (0, _glMatrix.vec3).fromValues((1 - padding) * this._boundsScaling, (this._height - padding) * this._boundsScaling, thickness * this._boundsScaling); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setScale(dataView, index, scale); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - if (options.texCoords) { - _vec4[0] = options.texCoords[id * 4]; - _vec4[1] = options.texCoords[id * 4 + 1]; - _vec4[2] = options.texCoords[id * 4 + 2]; - _vec4[3] = options.texCoords[id * 4 + 3]; - (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } else (0, _vertexJs.UnitVertex).setTexCoord(dataView, index, _vec4); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class StackTreeMap extends StackBase { - get maxTotal() { - return this._maxTotal; - } - get binGroupIds() { - return this._binGroupIds; - } - getSizeX(index) { - return this._sizesX[index]; - } - getSizeY(index) { - return this._sizesY[index]; - } - getSizeZ(index) { - return this._sizesZ[index]; + get maxBoundsZ() { + return this._maxBoundsZ; } - layout(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const isNormalized = options.isNormalized === undefined ? false : options.isNormalized; - const minHeight = options.minHeight === undefined ? 0 : options.minHeight; - const maxHeight = options.maxHeight === undefined ? 0 : options.maxHeight; - const isTopToBottom = options.isTopToBottom === undefined ? false : options.isTopToBottom; - const sizeX = options.sizeX == undefined ? 1 : options.sizeX; - const sizeZ = options.sizeZ == undefined ? 1 : options.sizeZ; - const spacingX = options.spacingX == undefined ? 0 : options.spacingX; - const spacingZ = options.spacingZ == undefined ? 0 : options.spacingZ; - const binsX = options.binsX == undefined ? 1 : options.binsX; - const binsZ = options.binsZ == undefined ? 1 : options.binsZ; - if (!this._positionsX || this._positionsX.length < buffer.length) { - this._positionsX = new Float32Array(buffer.length); - this._positionsY = new Float32Array(buffer.length); - this._positionsZ = new Float32Array(buffer.length); - this._sizesX = new Float32Array(buffer.length); - this._sizesY = new Float32Array(buffer.length); - this._sizesZ = new Float32Array(buffer.length); - this._binIds = new Uint32Array(buffer.length); - this._binGroupIds = new Float64Array(buffer.length); - } - this._binCounts = new Uint32Array(binsX * binsZ); - this._binTotals = new Float64Array(binsX * binsZ); - let maxBinCount = 0; - let maxBinTotal = 0; - let height; - const lookup = buffer.lookup; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - const binId = binIdX + binIdZ * binsX; - this._binIds[index] = binId; - if (binId > this._binCounts.length - 1) this._core.log.write((0, _mainJs.LogLevel).warn, "bin overflow"); - this._binCounts[binId]++; - maxBinCount = Math.max(maxBinCount, this._binCounts[binId]); - this._binTotals[binId] += options.sizes ? options.sizes[id] : 1; - maxBinTotal = Math.max(maxBinTotal, this._binTotals[binId]); - } - if (maxHeight - minHeight > 0) height = maxHeight - minHeight; - else height = Math.ceil(maxBinCount / sizeX / sizeZ); - if (!this._orderedIds || this._orderedIds.length < buffer.length) this._orderedIds = new Uint32Array(buffer.length); - let ids2; - if (options.groupIds || options.sizes) { - if (count == ids.length) this._ids = new Uint32Array(ids); - else { - this._ids = new Uint32Array(count); - for(let i = 0; i < count; i++)this._ids[i] = ids[offset + i]; - } - if (options.groupIds && options.sizes) { - this._ids.sort(function(a, b) { - return options.groupIds[a] == options.groupIds[b] ? options.sizes[a] - options.sizes[b] : options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.groupIds) { - this._ids.sort(function(a, b) { - return options.groupIds[a] - options.groupIds[b]; - }); - ids2 = this._ids; - } else if (options.sizes) { - this._ids.sort(function(a, b) { - return options.sizes[a] - options.sizes[b]; - }); - ids2 = this._ids; - } - } else ids2 = ids; - const binOffsets = new Uint32Array(this._binCounts.length); - let binOffset = 0; - for(let i = 0; i < this._binCounts.length; i++){ - const binCount = this._binCounts[i]; - binOffsets[i] = binOffset; - binOffset += binCount; - } - for(let i = 0; i < count; i++){ - const id = ids2[i]; - const index = lookup[id]; - const binId = this._binIds[index]; - binOffset = binOffsets[binId]++; - this._orderedIds[binOffset + offset] = id; - } - const minSliceHeight = this._core.config.minCubifiedTreeMapSlice * height; - const side = Math.sqrt(sizeX * sizeZ); - let from = offset; - let isLastInGroup = false; - let isLastInBin = false; - let groupCount = 0; - let groupTotal = 0; - let positionY = 0; - for(let i = 0; i < count; i++){ - const id = this._orderedIds[i + offset]; - const index = lookup[id]; - groupCount++; - groupTotal += options.sizes ? options.sizes[id] : 1; - const binId = this._binIds[index]; - const groupId = options.groupIds ? options.groupIds[id] : 0; - if (i == count - 1) { - isLastInBin = true; - isLastInGroup = true; - } else { - const nextId = this._orderedIds[i + 1 + offset]; - const nextIndex = lookup[nextId]; - const nextBinId = this._binIds[nextIndex]; - const nextGroupId = options.groupIds ? options.groupIds[nextId] : 0; - isLastInBin = binId != nextBinId; - isLastInGroup = groupId != nextGroupId; - } - if (isLastInBin || isLastInGroup) { - const mid = i + offset; - const binIdX = options.binIdsX ? options.binIdsX[id] : 0; - const binIdZ = options.binIdsZ ? options.binIdsZ[id] : 0; - let groupValue, binValue; - if (options.sizes) { - groupValue = groupTotal; - binValue = isNormalized ? this._binTotals[binId] : maxBinTotal; - } else { - groupValue = groupCount; - binValue = isNormalized ? this._binCounts[binId] : maxBinCount; - } - const groupHeight = height * groupValue / binValue; - if (sizeZ == 1) { - const positionX = spacingX / 2 + binIdX * (sizeX + spacingX); - (0, _treemapJs.TreeMapHelper).squarifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._sizesX, this._sizesY, from, mid, positionX, positionY, sizeX, groupHeight, lookup); - const isRightToLeft = true; - for(let i = from; i <= mid; i++){ - const id = this._orderedIds[i]; - const index = lookup[id]; - this._sizesZ[index] = sizeZ; - this._positionsZ[index] = (binIdZ + 0.5) * (sizeZ + spacingZ); - if (isRightToLeft) this._positionsX[index] = positionX + sizeX - this._positionsX[index] + positionX; - if (!isTopToBottom) this._positionsY[index] = positionY + groupHeight - this._positionsY[index] + positionY; - } - } else (0, _treemapJs.TreeMapHelper).cubifiedLayout(this._orderedIds, options.sizes, this._positionsX, this._positionsY, this._positionsZ, this._sizesX, this._sizesY, this._sizesZ, from, mid, spacingX / 2 + binIdX * (sizeX + spacingX), positionY, spacingZ / 2 + binIdZ * (sizeZ + spacingZ), sizeX, groupHeight, sizeZ, side, groupValue, minSliceHeight, isTopToBottom, lookup); - if (isLastInGroup) { - isLastInGroup = false; - positionY += groupHeight; - } - if (isLastInBin) { - isLastInBin = false; - positionY = 0; - } - groupCount = 0; - groupTotal = 0; - from = mid + 1; - } - } - this._maxCount = maxBinCount; - this._maxTotal = maxBinTotal; - this.minLayoutBoundsX = 0; - this.minLayoutBoundsY = 0; - this.minLayoutBoundsZ = 0; - this.maxLayoutBoundsX = binsX * (sizeX + spacingX); - this.maxLayoutBoundsY = height; - this.maxLayoutBoundsZ = binsZ * (sizeZ + spacingZ); - this._updateCumulativeLayoutBounds(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} layout ${count} ${Math.round(window.performance.now() - start)}ms`); + set maxBoundsZ(value2) { + if (this._maxBoundsZ != value2) { + this._maxBoundsZ = value2; + this._hasChanged = true; + } } - update(buffer, ids, options) { - const start = window.performance.now(); - const offset = options.offset === undefined ? 0 : options.offset; - const count = options.count === undefined ? ids.length : options.count; - const dataView = buffer.dataView; - const _vec2 = (0, _glMatrix.vec2).create(); - const _vec3 = (0, _glMatrix.vec3).create(); - const _quat = (0, _glMatrix.quat).create(); - const minColor = options.minColor === undefined ? 0 : options.minColor; - const maxColor = options.maxColor === undefined ? 1 : options.maxColor; - const minOrder = options.minOrder === undefined ? 0 : options.minOrder; - const maxOrder = options.maxOrder === undefined ? 1 : options.maxOrder; - const orderReverse = options.orderReverse === undefined ? false : options.orderReverse; - const minStaggerOrder = options.minStaggerOrder === undefined ? 0 : options.minStaggerOrder; - const maxStaggerOrder = options.maxStaggerOrder === undefined ? 1 : options.maxStaggerOrder; - const staggerOrderReverse = options.staggerOrderReverse === undefined ? false : options.staggerOrderReverse; - const padding = options.padding === undefined ? 0 : options.padding; - const paddingZ = options.thickness === undefined ? padding : 0; - const thickness = options.thickness === undefined ? 1 : options.thickness; - const reverseX = options.reverseX === undefined ? false : options.reverseX; - const reverseY = options.reverseY === undefined ? false : options.reverseY; - const reverseZ = options.reverseZ === undefined ? false : options.reverseZ; - this._updateModelBounds(options); - (0, _glMatrix.quat).rotationTo(_quat, this._core.config.identityRotation, (0, _constantsJs.Constants).VECTOR3_UNITY); - const lookup = buffer.lookup; - const selection = options.selected && options.selected.size > 0; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = lookup[id]; - let positionX = this._positionsX[index]; - let positionY = this._positionsY[index]; - let positionZ = this._positionsZ[index]; - if (this._isFacetted) { - if (reverseX) positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; - const facetX = options.facetCoordsX ? options.facetCoordsX[id] : 0; - const facetY = options.facetCoordsY ? options.facetCoordsY[id] : 0; - const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id] : 0; - positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); - positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); - positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); - } else { - if (reverseX) positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; - if (reverseY) positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; - if (reverseZ) positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; - } - _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; - _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; - _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; - (0, _vertexJs.UnitVertex).setTranslation(dataView, index, _vec3); - _vec3[0] = Math.max((this._sizesX[index] - padding) * this._boundsScaling, 0); - _vec3[1] = Math.max((this._sizesY[index] - padding) * this._boundsScaling, 0); - _vec3[2] = Math.max((this._sizesZ[index] - paddingZ) * this._boundsScaling, 0) * thickness; - (0, _vertexJs.UnitVertex).setScale(dataView, index, _vec3); - (0, _vertexJs.UnitVertex).setRotation(dataView, index, _quat); - if (options.colors) { - const size = 1 / (maxColor - minColor + 1); - const color = (0, _mathJs.MathHelper).normalize(options.colors[id], minColor, maxColor, size / 2, 1 - size / 2); - (0, _glMatrix.vec2).set(_vec2, color, color); - (0, _vertexJs.UnitVertex).setColor(dataView, index, _vec2); - } else (0, _vertexJs.UnitVertex).setColor(dataView, index, (0, _constantsJs.Constants).VECTOR2_ONE); - (0, _vertexJs.UnitVertex).setIdHover(dataView, index, options.hover ? options.hover[id] : id); - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? options.selected.has(id) ? 1 : -1 : 0); - if (options.order !== undefined) { - const order = (0, _mathJs.MathHelper).normalize(options.order[id], minOrder, maxOrder, 0, 1); - _vec2[0] = orderReverse ? 1 - order : order; - } else _vec2[0] = count == 1 ? 0 : i / (count - 1); - if (options.staggerOrder !== undefined) _vec2[1] = options.staggerOrder; - else if (options.staggerOrders) { - const stagger = (0, _mathJs.MathHelper).normalize(options.staggerOrders[id], minStaggerOrder, maxStaggerOrder, 0, 1); - _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; - } else _vec2[1] = count == 1 ? 0 : i / (count - 1); - (0, _vertexJs.UnitVertex).setOrder(dataView, index, _vec2); - (0, _vertexJs.UnitVertex).setMaterial(dataView, index, options.material ? options.material : options.materials ? options.materials[id] : 0); - (0, _vertexJs.UnitVertex).setRounding(dataView, index, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id] * this._boundsScaling : 0); - (0, _vertexJs.UnitVertex).setSdfBuffer(dataView, index, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id] : this._core.config.sdfBuffer); - (0, _vertexJs.UnitVertex).setSdfBorder(dataView, index, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id] : this._core.config.sdfBorder); - } - buffer.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this.constructor.name.toLowerCase()} update ${ids.length} ${Math.round(window.performance.now() - start)}ms`); - } -} - -},{"../constants.js":"dHTsY","../helpers/math.js":"6Lv1i","../vertex.js":"8lW8V","./treemap.js":"gDhOz","./layout.js":"ijsq1","gl-matrix":"erHGu","../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eCWft":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Keyboard", ()=>(0, _keyboardJs.Keyboard)); -parcelHelpers.export(exports, "MouseWheel", ()=>(0, _mousewheelJs.MouseWheel)); -parcelHelpers.export(exports, "Pointers", ()=>(0, _pointersJs.Pointers)); -parcelHelpers.export(exports, "Manipulator", ()=>(0, _manipulatorJs.Manipulator)); -parcelHelpers.export(exports, "ManipulationProcessor", ()=>(0, _manipulationprocessorJs.ManipulationProcessor)); -parcelHelpers.export(exports, "Manager", ()=>(0, _managerJs.Manager)); -var _keyboardJs = require("./keyboard.js"); -var _mousewheelJs = require("./mousewheel.js"); -var _pointersJs = require("./pointers.js"); -var _manipulatorJs = require("./manipulator.js"); -var _manipulationprocessorJs = require("./manipulationprocessor.js"); -var _managerJs = require("./manager.js"); - -},{"./keyboard.js":"5tZWK","./mousewheel.js":"gBsJR","./pointers.js":"deD7J","./manipulator.js":"gniz0","./manipulationprocessor.js":"elobQ","./manager.js":"kM2vK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"azoZM":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>(0, _fileJs.LocalFile)); -parcelHelpers.export(exports, "XmlHttp", ()=>(0, _xmlHttpJs.XmlHttp)); -var _fileJs = require("./file.js"); -var _xmlHttpJs = require("./xmlHttp.js"); - -},{"./file.js":"alzEA","./xmlHttp.js":"eqQpi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"alzEA":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LocalFile", ()=>LocalFile); -class LocalFile { - constructor(core){} - loadText(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - completed(text); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsText(file); - } - loadImage(file, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - const reader = new FileReader(); - reader.onload = (event)=>{ - const text = event.target.result; - image.src = text; - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsDataURL(file); + constructor(core, options) { + this._core = core; + this._mMatrix = create$4(); + this._origin = create$3(); + this._translation = create$3(); + this._scale = create$3(); + this._transform = create$4(); + this._imageData = options.imageData; + this._minBoundsX = options.minBoundsX === void 0 ? 0 : options.minBoundsX; + this._minBoundsY = options.minBoundsY === void 0 ? 0 : options.minBoundsY; + this._minBoundsZ = options.minBoundsZ === void 0 ? 0 : options.minBoundsZ; + this._maxBoundsX = options.maxBoundsX === void 0 ? 1 : options.maxBoundsX; + this._maxBoundsY = options.maxBoundsY === void 0 ? 1 : options.maxBoundsY; + this._maxBoundsZ = options.maxBoundsZ === void 0 ? 1 : options.maxBoundsZ; + this._position = options.position ? clone$3(options.position) : create$3(); + this._rotation = options.rotation ? clone$1(options.rotation) : create$1(); + this._texCoord0 = options.texCoord0 ? clone(options.texCoord0) : fromValues(0, 0); + this._texCoord1 = options.texCoord1 ? clone(options.texCoord1) : fromValues(1, 1); + this._material = options.material === void 0 ? -1 : options.material; + this._hasChanged = true; } - loadArrayBuffer(file, completed, failed) { - const reader = new FileReader(); - reader.onload = (event)=>{ - const arrayBuffer = event.target.result; - completed(arrayBuffer); - }; - reader.onerror = (event)=>{ - const error = event.target.error; - failed(error.message); - }; - reader.readAsArrayBuffer(file); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eqQpi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "XmlHttp", ()=>XmlHttp); -class XmlHttp { - constructor(core){} - loadText(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.responseText); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } - loadImage(url, completed, failed) { - const image = new Image(); - image.onload = ()=>completed(image); - image.onerror = (event)=>{ - const error = event.message; - failed(error); - }; - image.src = url; - } - loadArrayBuffer(url, completed, failed) { - const request = new XMLHttpRequest(); - request.open("GET", url); - request.responseType = "arraybuffer"; - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE) switch(request.status){ - case 200: - completed(request.response); - break; - default: - failed(request.statusText); - break; - } - }; - request.send(); - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lHwiA":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>(0, _quadJs.Quad)); -parcelHelpers.export(exports, "Cube", ()=>(0, _cubeJs.Cube)); -parcelHelpers.export(exports, "Sphere", ()=>(0, _sphereJs.Sphere)); -var _quadJs = require("./quad.js"); -var _cubeJs = require("./cube.js"); -var _sphereJs = require("./sphere.js"); - -},{"./quad.js":"6dxCM","./cube.js":"dYecn","./sphere.js":"2nvcG","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aAH73":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererBase", ()=>(0, _rendererJs.RendererBase)); -parcelHelpers.export(exports, "Basic", ()=>_indexJs); -parcelHelpers.export(exports, "Advanced", ()=>_indexJs1); -parcelHelpers.export(exports, "RayTraceWebGPU", ()=>_indexJs2); -var _rendererJs = require("./renderer.js"); -var _indexJs = require("./basic/index.js"); -var _indexJs1 = require("./advanced/index.js"); -var _indexJs2 = require("./raytracewebgpu/index.js"); - -},{"./renderer.js":"as6Zc","./basic/index.js":"fkg7Y","./advanced/index.js":"lu1e0","./raytracewebgpu/index.js":"j817I","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"as6Zc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererConfig", ()=>RendererConfig); -parcelHelpers.export(exports, "RendererBase", ()=>RendererBase); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../main.js"); -var _axesJs = require("../components/axes/axes.js"); -var _bufferJs = require("../buffer.js"); -var _vertexJs = require("../vertex.js"); -var _labelsJs = require("../components/labels.js"); -var _debugJs = require("../components/debug.js"); -var _controllerJs = require("../components/controller.js"); -var _imageJs = require("../components/image.js"); -var _fontJs = require("../font.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + } + class ImageQuad extends ImageBase { + get width() { + return this._width; } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class RendererConfig { - reset() {} -} -class RendererBase { - get isInitialized() { - return this._isInitialized; + set width(value2) { + if (this._width != value2) { + this._width = value2; + this._hasChanged = true; + } } - get config() { - return this._config; + get height() { + return this._height; } - get devicePixelRatio() { - return this._devicePixelRatio; + set height(value2) { + if (this._height != value2) { + this._height = value2; + this._hasChanged = true; + } } - get width() { - return this._canvas.width; + constructor(core, options) { + super(core, options); + this._width = options.width === void 0 ? 1 : options.width; + this._height = options.height === void 0 ? 1 : options.height; + this._texTransform = create$4(); + translate(this._texTransform, this._texTransform, fromValues$3(0, 1, 0)); + scale$1(this._texTransform, this._texTransform, fromValues$3(1, -1, 1)); } - set width(value) { - this._options.width = value; + initialize() { + this._vertices = new ArrayBuffer(PositionNormalTextureVertex.SIZE_BYTES * 4); + this._indices = Quad$2.INDICES; + this._indexCount = this._indices.length; + this._isInitialized = true; } - get height() { - return this._canvas.height; + update(elapsedTime) { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + const modelSizeX = this._maxBoundsX - this._minBoundsX; + const modelSizeY = this._maxBoundsY - this._minBoundsY; + const modelSizeZ = this._maxBoundsZ - this._minBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; + set$3(this._origin, (this._minBoundsX + this._maxBoundsX) / 2, (this._minBoundsY + this._maxBoundsY) / 2, (this._minBoundsZ + this._maxBoundsZ) / 2); + subtract(this._translation, this._position, this._origin); + scale(this._translation, this._translation, boundsScaling); + set$3(this._scale, this._width, this._height, 1); + scale(this._scale, this._scale, boundsScaling); + fromRotationTranslationScale(this._transform, this._rotation, this._translation, this._scale); + this._verticesView = Quad$2.normalTextured(this._transform, this._texTransform); + this._vertices = this._verticesView.buffer; + if (this.hasChangedCallback) { + this.hasChangedCallback(); + } + } } - set height(value) { - this._options.height = value; + } + class BoundsHelper { + static rotateBounds(minBounds, maxBounds, rotation2, rotatedMinBounds, rotatedMaxBounds, offset2) { + const sizeX = maxBounds[0] - minBounds[0]; + const sizeY = maxBounds[1] - minBounds[1]; + const sizeZ = maxBounds[2] - minBounds[2]; + const min$12 = rotatedMinBounds; + const max$12 = rotatedMaxBounds; + set$3(min$12, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$3(max$12, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const vertices = Cube.POSITIONS; + const position2 = create$3(); + for (let i = 0; i < 8; i++) { + set$3(position2, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); + add(position2, position2, offset2); + transformQuat(position2, position2, rotation2); + subtract(position2, position2, offset2); + min(min$12, min$12, position2); + max(max$12, max$12, position2); + } + add(position2, minBounds, maxBounds); + scale(position2, position2, 0.5); + add(min$12, min$12, position2); + add(max$12, max$12, position2); + } + static cylinder(pa2, pb, radius2, minBounds, maxBounds) { + const a2 = create$3(); + subtract(a2, pb, pa2); + const aa = dot$1(a2, a2); + const ex = radius2 * Math.sqrt(1 - a2[0] * a2[0] / aa); + const ey = radius2 * Math.sqrt(1 - a2[1] * a2[1] / aa); + const ez = radius2 * Math.sqrt(1 - a2[2] * a2[2] / aa); + minBounds[0] = Math.min(pa2[0] - ex, pb[0] - ex); + minBounds[1] = Math.min(pa2[1] - ey, pb[1] - ey); + minBounds[2] = Math.min(pa2[2] - ez, pb[2] - ez); + maxBounds[0] = Math.max(pa2[0] + ex, pb[0] + ex); + maxBounds[1] = Math.max(pa2[1] + ey, pb[1] + ey); + maxBounds[2] = Math.max(pa2[2] + ez, pb[2] + ez); } - get webXRReferenceSpace() { - return this._webXRReferenceSpace; + } + class LayoutBase { + get facetScaling() { + return this._facetScaling; } - get pickedType() { - return this._pickedType; + offsetX(facetCoordX) { + return ((facetCoordX + 0.5) / this._facetsX - 0.5) * (this.maxModelBoundsX - this.minModelBoundsX) / this._maxBounds; } - get pickedId() { - return this._pickedId; + offsetY(facetCoordY) { + return ((facetCoordY + 0.5) / this._facetsY - 0.5) * (this.maxModelBoundsY - this.minModelBoundsY) / this._maxBounds; } - get isCapturingPickImage() { - return this._isCapturingPickImage; + offsetZ(facetCoordZ) { + return ((facetCoordZ + 0.5) / this._facetsZ - 0.5) * (this.maxModelBoundsZ - this.minModelBoundsZ) / this._maxBounds; + } + constructor(core) { + this._core = core; + this.modelOriginX = 0; + this.modelOriginY = 0; + this.modelOriginZ = 0; + this.minModelBoundsX = 0; + this.minModelBoundsY = 0; + this.minModelBoundsZ = 0; + this.maxModelBoundsX = 0; + this.maxModelBoundsY = 0; + this.maxModelBoundsZ = 0; + this.minLayoutBoundsX = 0; + this.minLayoutBoundsY = 0; + this.minLayoutBoundsZ = 0; + this.maxLayoutBoundsX = 0; + this.maxLayoutBoundsY = 0; + this.maxLayoutBoundsZ = 0; + this._facetSpacingX = 0; + this._facetSpacingY = 0; + this._facetSpacingZ = 0; + this._facetSizeX = 0; + this._facetSizeY = 0; + this._facetSizeZ = 0; + this._facetsX = 1; + this._facetsY = 1; + this._facetsZ = 1; + } + _updateModelBounds(options) { + this.minModelBoundsX = options.minBoundsX === void 0 ? this.minLayoutBoundsX : options.minBoundsX; + this.minModelBoundsY = options.minBoundsY === void 0 ? this.minLayoutBoundsY : options.minBoundsY; + this.minModelBoundsZ = options.minBoundsZ === void 0 ? this.minLayoutBoundsZ : options.minBoundsZ; + this.maxModelBoundsX = options.maxBoundsX === void 0 ? this.maxLayoutBoundsX : options.maxBoundsX; + this.maxModelBoundsY = options.maxBoundsY === void 0 ? this.maxLayoutBoundsY : options.maxBoundsY; + this.maxModelBoundsZ = options.maxBoundsZ === void 0 ? this.maxLayoutBoundsZ : options.maxBoundsZ; + this._isFacetted = options.facetsX !== void 0 && options.facetsX > 1 && options.facetCoordsX != null || options.facetsY !== void 0 && options.facetsY > 1 && options.facetCoordsY != null || options.facetsZ !== void 0 && options.facetsZ > 1 && options.facetCoordsZ != null; + this._facetSpacingX = options.facetSpacingX === void 0 ? 0 : options.facetSpacingX; + this._facetSpacingY = options.facetSpacingY === void 0 ? 0 : options.facetSpacingY; + this._facetSpacingZ = options.facetSpacingZ === void 0 ? 0 : options.facetSpacingZ; + let modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + let modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + let modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._facetSizeX = modelSizeX; + this._facetSizeY = modelSizeY; + this._facetSizeZ = modelSizeZ; + this._facetsX = options.facetCoordsX ? options.facetsX : 1; + this._facetsY = options.facetCoordsY ? options.facetsY : 1; + this._facetsZ = options.facetCoordsZ ? options.facetsZ : 1; + this.minModelBoundsX -= this._facetSizeX * this._facetSpacingX / 2; + this.minModelBoundsY -= this._facetSizeY * this._facetSpacingY / 2; + this.minModelBoundsZ -= this._facetSizeZ * this._facetSpacingZ / 2; + this.maxModelBoundsX = this.minModelBoundsX + this._facetsX * this._facetSizeX * (1 + this._facetSpacingX); + this.maxModelBoundsY = this.minModelBoundsY + this._facetsY * this._facetSizeY * (1 + this._facetSpacingY); + this.maxModelBoundsZ = this.minModelBoundsZ + this._facetsZ * this._facetSizeZ * (1 + this._facetSpacingZ); + this.modelOriginX = (this.minModelBoundsX + this.maxModelBoundsX) / 2; + this.modelOriginY = (this.minModelBoundsY + this.maxModelBoundsY) / 2; + this.modelOriginZ = (this.minModelBoundsZ + this.maxModelBoundsZ) / 2; + modelSizeX = this.maxModelBoundsX - this.minModelBoundsX; + modelSizeY = this.maxModelBoundsY - this.minModelBoundsY; + modelSizeZ = this.maxModelBoundsZ - this.minModelBoundsZ; + this._maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); + this._boundsScaling = this._maxBounds == 0 ? 1 : 1 / this._maxBounds; + this._facetScaling = maxBounds / this._maxBounds; } - capturePickImage() { - this._isCapturingPickImage = true; + resetCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = void 0; + this.minCumulativeLayoutBoundsY = void 0; + this.minCumulativeLayoutBoundsZ = void 0; + this.maxCumulativeLayoutBoundsX = void 0; + this.maxCumulativeLayoutBoundsY = void 0; + this.maxCumulativeLayoutBoundsZ = void 0; } - get backgroundColor() { - return this._backgroundColor; + _updateCumulativeLayoutBounds() { + this.minCumulativeLayoutBoundsX = this.minCumulativeLayoutBoundsX === void 0 ? this.minLayoutBoundsX : Math.min(this.minCumulativeLayoutBoundsX, this.minLayoutBoundsX); + this.minCumulativeLayoutBoundsY = this.minCumulativeLayoutBoundsY === void 0 ? this.minLayoutBoundsY : Math.min(this.minCumulativeLayoutBoundsY, this.minLayoutBoundsY); + this.minCumulativeLayoutBoundsZ = this.minCumulativeLayoutBoundsZ === void 0 ? this.minLayoutBoundsZ : Math.min(this.minCumulativeLayoutBoundsZ, this.minLayoutBoundsZ); + this.maxCumulativeLayoutBoundsX = this.maxCumulativeLayoutBoundsX === void 0 ? this.maxLayoutBoundsX : Math.max(this.maxCumulativeLayoutBoundsX, this.maxLayoutBoundsX); + this.maxCumulativeLayoutBoundsY = this.maxCumulativeLayoutBoundsY === void 0 ? this.maxLayoutBoundsY : Math.max(this.maxCumulativeLayoutBoundsY, this.maxLayoutBoundsY); + this.maxCumulativeLayoutBoundsZ = this.maxCumulativeLayoutBoundsZ === void 0 ? this.maxLayoutBoundsZ : Math.max(this.maxCumulativeLayoutBoundsZ, this.maxLayoutBoundsZ); } - set backgroundColor(value) { - if (!(0, _glMatrix.vec4).exactEquals(value, this._backgroundColor)) this._backgroundColor = value; + unitToModelSize(unitSize) { + return unitSize / this._boundsScaling; } - get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + unitToModelPositionX(unitPositionX) { + return this.unitToModelSize(unitPositionX) + this.modelOriginX; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + unitToModelPositionY(unitPositionY) { + return this.unitToModelSize(unitPositionY) + this.modelOriginY; } - get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + unitToModelPositionZ(unitPositionZ) { + return this.unitToModelSize(unitPositionZ) + this.modelOriginZ; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + unitToModelPosition(unitPosition, modelPosition) { + modelPosition[0] = this.unitToModelPositionX(unitPosition[0]); + modelPosition[1] = this.unitToModelPositionY(unitPosition[1]); + modelPosition[2] = this.unitToModelPositionZ(unitPosition[2]); } - swapAxes() { - this._isAxes1Current = !this._isAxes1Current; + modelToUnitSize(modelSize) { + return modelSize * this._boundsScaling; } - createCartesian2dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + modelToUnitPositionX(modelPositionX) { + return (modelPositionX - this.modelOriginX) * this._boundsScaling; } - createCartesian3dAxesVisual(axes) { - return new (0, _axesJs.AxesVisual)(axes); + modelToUnitPositionY(modelPositionY) { + return (modelPositionY - this.modelOriginY) * this._boundsScaling; } - _createDebugAxesVisual(debugAxes) { - return null; + modelToUnitPositionZ(modelPositionZ) { + return (modelPositionZ - this.modelOriginZ) * this._boundsScaling; } - createLabelSetVisual(labelSet) { - return new (0, _labelsJs.LabelSetVisual)(labelSet); + modelToUnitPosition(modelPosition, unitPosition) { + unitPosition[0] = this.modelToUnitPositionX(modelPosition[0]); + unitPosition[1] = this.modelToUnitPositionY(modelPosition[1]); + unitPosition[2] = this.modelToUnitPositionZ(modelPosition[2]); + } + inclusiveUnitBounds(buffer, ids, unitType, offset2, count2, minBounds, maxBounds) { + set$3(minBounds, Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); + set$3(maxBounds, -Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); + const unitScale = create$3(); + const unitRotation = create$1(); + const unitTranslation = create$3(); + const lookup2 = buffer.lookup; + const dataView = buffer.dataView; + let minBounds0; + let maxBounds0; + let minBounds1; + let maxBounds1; + switch (unitType) { + case UnitType.sphere: + case UnitType.sphereSdf: + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getScale(dataView, index2, unitScale); + const radius2 = unitScale[0] / 2; + minBounds[0] = Math.min(minBounds[0], unitTranslation[0] - radius2); + minBounds[1] = Math.min(minBounds[1], unitTranslation[1] - radius2); + minBounds[2] = Math.min(minBounds[2], unitTranslation[2] - radius2); + maxBounds[0] = Math.max(maxBounds[0], unitTranslation[0] + radius2); + maxBounds[1] = Math.max(maxBounds[1], unitTranslation[1] + radius2); + maxBounds[2] = Math.max(maxBounds[2], unitTranslation[2] + radius2); + } + break; + case UnitType.hexPrism: + case UnitType.hexPrismSdf: + case UnitType.block: + case UnitType.blockSdf: + minBounds0 = create$3(); + maxBounds0 = create$3(); + minBounds1 = create$3(); + maxBounds1 = create$3(); + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + minBounds0[0] = unitTranslation[0] - unitScale[0] / 2; + minBounds0[1] = unitTranslation[1] - unitScale[1] / 2; + minBounds0[2] = unitTranslation[2] - unitScale[2] / 2; + maxBounds0[0] = unitTranslation[0] + unitScale[0] / 2; + maxBounds0[1] = unitTranslation[1] + unitScale[1] / 2; + maxBounds0[2] = unitTranslation[2] + unitScale[2] / 2; + BoundsHelper.rotateBounds(minBounds0, maxBounds0, unitRotation, minBounds1, maxBounds1, Constants.VECTOR3_ZERO); + min(minBounds, minBounds, minBounds1); + max(maxBounds, maxBounds, maxBounds1); + } + break; + case UnitType.cylinder: + case UnitType.cylinderSdf: + minBounds0 = create$3(); + maxBounds0 = create$3(); + const pa2 = create$3(); + const pb = create$3(); + const identityRotation = Constants.VECTOR3_UNITY; + let ca; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + UnitVertex.getTranslation(dataView, index2, unitTranslation); + UnitVertex.getRotation(dataView, index2, unitRotation); + UnitVertex.getScale(dataView, index2, unitScale); + const length2 = unitScale[1]; + const radius2 = Math.max(unitScale[0], unitScale[2]); + if (length2 != 0 && radius2 != 0) { + if (equals$1(unitRotation, Constants.QUAT_IDENTITY)) { + ca = identityRotation; + } else { + ca = create$3(); + transformQuat(ca, identityRotation, unitRotation); + } + scaleAndAdd(pa2, unitTranslation, ca, -length2 * 0.5); + scaleAndAdd(pb, unitTranslation, ca, length2 * 0.5); + BoundsHelper.cylinder(pa2, pb, radius2, minBounds0, maxBounds0); + min(minBounds, minBounds, minBounds0); + max(maxBounds, maxBounds, maxBounds0); + } + } + break; + } } - createControllerVisual(controller) { - return new (0, _controllerJs.ControllerVisual)(controller); + } + class Scatter extends LayoutBase { + layout(buffer, ids, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const positionScalingX = options.positionScalingX === void 0 ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === void 0 ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === void 0 ? 1 : options.positionScalingZ; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = options.positionsX ? options.positionsX[id2] * positionScalingX : 0; + let positionY = options.positionsY ? options.positionsY[id2] * positionScalingY : 0; + let positionZ = options.positionsZ ? options.positionsZ[id2] * positionScalingZ : 0; + this._positions[index2 * 3] = positionX; + this._positions[index2 * 3 + 1] = positionY; + this._positions[index2 * 3 + 2] = positionZ; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, positionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, positionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, positionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, positionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, positionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, positionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); } - createTransitionBuffer(ids) { - return new (0, _bufferJs.TransitionBuffer)(this._core, ids); + update(buffer, ids, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create(); + const _vec3 = create$3(); + const _vec4 = create$2(); + const _quat = create$1(); + const sizeScalingX = options.sizeScaling === void 0 ? options.sizeScalingX === void 0 ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === void 0 ? options.sizeScalingY === void 0 ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === void 0 ? options.sizeScalingZ === void 0 ? 1 : options.sizeScalingZ : options.sizeScaling; + const sizesX = options.sizes ? options.sizes : options.sizesX; + const sizesY = options.sizes ? options.sizes : options.sizesY; + const sizesZ = options.sizes ? options.sizes : options.sizesZ; + const minSize = options.minSize === void 0 ? 0 : options.minSize; + const minColor = options.minColor === void 0 ? 0 : options.minColor; + const maxColor = options.maxColor === void 0 ? 1 : options.maxColor; + const minOrder = options.minOrder === void 0 ? 0 : options.minOrder; + const maxOrder = options.maxOrder === void 0 ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === void 0 ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === void 0 ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === void 0 ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === void 0 ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === void 0 ? false : options.reverseX; + const reverseY = options.reverseY === void 0 ? false : options.reverseY; + const reverseZ = options.reverseZ === void 0 ? false : options.reverseZ; + this._updateModelBounds(options); + if (options.rotation) { + _quat[0] = options.rotation[0]; + _quat[1] = options.rotation[1]; + _quat[2] = options.rotation[2]; + _quat[3] = options.rotation[3]; + } else { + rotationTo(_quat, this._core.config.identityRotation, Constants.VECTOR3_UNITY); + } + if (options.texCoord) { + _vec4[0] = options.texCoord[0]; + _vec4[1] = options.texCoord[1]; + _vec4[2] = options.texCoord[2]; + _vec4[3] = options.texCoord[3]; + } + const lookup2 = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options.facetCoordsX ? options.facetCoordsX[id2] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id2] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = Math.max((sizesX ? Math.abs(sizesX[id2]) : 1) * sizeScalingX, minSize) * this._boundsScaling; + _vec3[1] = Math.max((sizesY ? Math.abs(sizesY[id2]) : 1) * sizeScalingY, minSize) * this._boundsScaling; + _vec3[2] = Math.max((sizesZ ? Math.abs(sizesZ[id2]) : 1) * sizeScalingZ, minSize) * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + if (options.rotations) { + _quat[0] = options.rotations[id2 * 4]; + _quat[1] = options.rotations[id2 * 4 + 1]; + _quat[2] = options.rotations[id2 * 4 + 2]; + _quat[3] = options.rotations[id2 * 4 + 3]; + UnitVertex.setRotation(dataView, index2, _quat); + } else { + UnitVertex.setRotation(dataView, index2, _quat); + } + if (options.colors) { + const size = 1 / (maxColor - minColor + 1); + const color2 = MathHelper.normalize(options.colors[id2], minColor, maxColor, size / 2, 1 - size / 2); + if (options.colors1) { + const color1 = MathHelper.normalize(options.colors1[id2], minColor, maxColor, size / 2, 1 - size / 2); + set(_vec2, color2, color1); + } else { + set(_vec2, color2, color2); + } + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants.VECTOR2_ONE); + } + UnitVertex.setIdHover(dataView, index2, options.hover ? options.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options.selected.has(id2) ? 1 : -1 : 0); + if (options.order !== void 0) { + const order = MathHelper.normalize(options.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); + } + if (options.staggerOrder !== void 0) { + _vec2[1] = options.staggerOrder; + } else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options.material ? options.material : options.materials ? options.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setParameter1(dataView, index2, options.parameter1 ? options.parameter1 : options.parameters1 ? options.parameters1[id2] : 0); + UnitVertex.setParameter2(dataView, index2, options.parameter2 ? options.parameter2 : options.parameters2 ? options.parameters2[id2] : 0); + UnitVertex.setSdfBuffer(dataView, index2, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id2] : this._core.config.sdfBorder); + if (options.texCoords) { + _vec4[0] = options.texCoords[id2 * 4]; + _vec4[1] = options.texCoords[id2 * 4 + 1]; + _vec4[2] = options.texCoords[id2 * 4 + 2]; + _vec4[3] = options.texCoords[id2 * 4 + 3]; + UnitVertex.setTexCoord(dataView, index2, _vec4); + } else { + UnitVertex.setTexCoord(dataView, index2, _vec4); + } + UnitVertex.setMatId(dataView, index2, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id2 * 3], options.materialColors[id2 * 3 + 1], options.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id2 * 4], options.segmentColors[id2 * 4 + 1], options.segmentColors[id2 * 4 + 2], options.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); } - createImageVisual(image) { - return new (0, _imageJs.ImageVisual)(image); + } + fromValues$3(0.2126, 0.7152, 0.0722); + create$3(); + create$3(); + class PathHelper { + static getFilenameWithoutExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") == -1 ? 0 : path2.lastIndexOf("/") + 1; + return path2.substring(start, dot2); + } } - createFontVisual(font) { - return new (0, _fontJs.FontVisual)(font); + static getExtension(path2) { + const dot2 = path2.lastIndexOf("."); + if (dot2 == -1 || dot2 == path2.length - 1) { + return null; + } else { + return path2.substring(dot2 + 1, path2.length); + } } - constructor(options){ - this._options = options; - this.fonts = {}; + static getFilename(path2) { + if (path2.lastIndexOf("/") == -1) { + return path2; + } else { + const start = path2.lastIndexOf("/") + 1; + return path2.substring(start, path2.length); + } } - get isWebXRSupported() { - return false; + static getPath(path2) { + if (path2.lastIndexOf("/") == -1) { + return ""; + } else { + return path2.substring(0, path2.lastIndexOf("/")); + } } - initialize(core) { - this._core = core; - this._canvas = document.createElement("canvas"); - const contextmenu = this._options && this._options.contextmenu; - if (!contextmenu) this._canvas.addEventListener("contextmenu", (e)=>{ - e.preventDefault(); - }); - this._canvas.tabIndex = this._core.container.tabIndex; - this._canvas.style.display = "block"; - this._canvas.style.touchAction = "none"; - this._core.container.appendChild(this._canvas); - this._mvMatrices = [ - (0, _glMatrix.mat4).create(), - (0, _glMatrix.mat4).create() - ]; - this.pickPMatrix = (0, _glMatrix.mat4).create(); - this.axesVisibility = (0, _mainJs.AxesVisibility).current; - this._debugAxes = new (0, _debugJs.DebugAxes)(); - this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); - this.transitionTime = 1; - this.transitionBuffers = []; - this.areLabelsVisible = true; - this.labelSets = []; - this.controllers = []; - this.areImagesVisible = true; - this.images = []; - this._viewports = [ - new DOMRect(), - new DOMRect() - ]; - this.isPickingEnabled = false; - this._pickedType = (0, _mainJs.PickType).none; - this._pickedId = 0; - this._lassoMMatrix = (0, _glMatrix.mat4).create(); - this._lassoThickness = (0, _glMatrix.vec2).create(); - this._resizeMinimumDelay = -1; - this._previousResizeWidth = -1; - this._previousResizeHeight = -1; + static combine(first, second2) { + const seperator = first.lastIndexOf("/") == first.length - 1; + if (second2.indexOf("/") == 0) { + if (seperator) { + return first.substring(0, first.length - 1) + second2; + } else { + return first + second2; + } + } else { + if (seperator) { + return first + second2; + } else { + return first + "/" + second2; + } + } } - remove() { - this._core.container.removeChild(this._canvas); + } + class TextureHelper { + static create(gl, width2, height2, format2, type2, filter2, bytes, internalFormat = format2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, width2, height2, 0, format2, type2, bytes); + return texture; + } + static fromImage(gl, image2, mipmaps, filter2) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, texture); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image2); + if (mipmaps && MathHelper.isPowerOf2(image2.width) && MathHelper.isPowerOf2(image2.height)) + gl.generateMipmap(gl.TEXTURE_2D); + else { + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filter2); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filter2); + } + gl.bindTexture(gl.TEXTURE_2D, null); + return texture; } - finalize() { - this._isInitialized = false; + static cubemapFromImages(gl, images) { + const texture = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture); + const targets = [ + gl.TEXTURE_CUBE_MAP_POSITIVE_X, + gl.TEXTURE_CUBE_MAP_NEGATIVE_X, + gl.TEXTURE_CUBE_MAP_POSITIVE_Y, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, + gl.TEXTURE_CUBE_MAP_POSITIVE_Z, + gl.TEXTURE_CUBE_MAP_NEGATIVE_Z + ]; + for (let i = 0; i < 6; i++) { + gl.texImage2D(targets[i], 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, images[i]); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + } + gl.generateMipmap(gl.TEXTURE_CUBE_MAP); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); + return texture; } - setSize(elapsedTime) { - if (this._options && this._options.width && this._options.height) { - this._devicePixelRatio = 1; - this._resizeWidth = this._options.width; - this._resizeHeight = this._options.height; + } + class Line extends LayoutBase { + layout(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const positionScalingX = options.positionScalingX === void 0 ? 1 : options.positionScalingX; + const positionScalingY = options.positionScalingY === void 0 ? 1 : options.positionScalingY; + const positionScalingZ = options.positionScalingZ === void 0 ? 1 : options.positionScalingZ; + const sizeScalingX = options.sizeScaling === void 0 ? options.sizeScalingX === void 0 ? 1 : options.sizeScalingX : options.sizeScaling; + const sizeScalingY = options.sizeScaling === void 0 ? options.sizeScalingY === void 0 ? 1 : options.sizeScalingY : options.sizeScaling; + const sizeScalingZ = options.sizeScaling === void 0 ? options.sizeScalingZ === void 0 ? 1 : options.sizeScalingZ : options.sizeScaling; + const minSize = options.minSize === void 0 ? 0 : options.minSize; + const offsetScaling = options.offsetScaling === void 0 ? 1 : options.offsetScaling; + if (!this._positions || this._positions.length < buffer.length * 3) { + this._positions = new Float32Array(buffer.length * 3); + this._sizes = new Float32Array(buffer.length * 3); + this._rotations = new Float32Array(buffer.length * 4); + } + this.minLayoutBoundsX = Number.MAX_VALUE; + this.minLayoutBoundsY = Number.MAX_VALUE; + this.minLayoutBoundsZ = Number.MAX_VALUE; + this.maxLayoutBoundsX = -Number.MAX_VALUE; + this.maxLayoutBoundsY = -Number.MAX_VALUE; + this.maxLayoutBoundsZ = -Number.MAX_VALUE; + const _vec3 = create$3(); + const _quat = create$1(); + const direction = create$3(); + const lookup2 = buffer.lookup; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let toPositionX = options.positionsX ? options.positionsX[toId] * positionScalingX : 0; + let toPositionY = options.positionsY ? options.positionsY[toId] * positionScalingY : 0; + let toPositionZ = options.positionsZ ? options.positionsZ[toId] * positionScalingZ : 0; + let fromPositionX = options.positionsX ? options.positionsX[fromId] * positionScalingX : 0; + let fromPositionY = options.positionsY ? options.positionsY[fromId] * positionScalingY : 0; + let fromPositionZ = options.positionsZ ? options.positionsZ[fromId] * positionScalingZ : 0; + if (fromId == toId) { + this._sizes[index2 * 3] = 0; + this._sizes[index2 * 3 + 1] = 0; + this._sizes[index2 * 3 + 2] = 0; + this._rotations[index2 * 4] = 0; + this._rotations[index2 * 4 + 1] = 0; + this._rotations[index2 * 4 + 2] = 0; + this._rotations[index2 * 4 + 3] = 1; } else { - this._devicePixelRatio = window.devicePixelRatio || 1; - this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; - this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; - } - if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { - this._previousResizeWidth = this._resizeWidth; - this._previousResizeHeight = this._resizeHeight; - this._isResizing = true; - this._resizeElapsedTime = elapsedTime; - } - if (this._isResizing) { - if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { - this._isResizing = false; - this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; - this._resize(this._resizeWidth, this._resizeHeight); - } else this._resizeElapsedTime += elapsedTime; - } - } - _resize(width, height) { - this._canvas.style.width = `${Math.floor(width / this._devicePixelRatio)}px`; - this._canvas.style.height = `${Math.floor(height / this._devicePixelRatio)}px`; - width = Math.floor(width); - height = Math.floor(height); - this._canvas.width = width; - this._canvas.height = height; + direction[0] = toPositionX - fromPositionX; + direction[1] = toPositionY - fromPositionY; + direction[2] = toPositionZ - fromPositionZ; + let length$12 = length(direction); + scale(direction, direction, 1 / length$12); + rotationTo(_quat, this._core.config.identityRotation, direction); + this._rotations[index2 * 4] = _quat[0]; + this._rotations[index2 * 4 + 1] = _quat[1]; + this._rotations[index2 * 4 + 2] = _quat[2]; + this._rotations[index2 * 4 + 3] = _quat[3]; + if (options.offsets) { + const fromOffset = options.offsets[fromId] * offsetScaling / 2; + const toOffset = options.offsets[toId] * offsetScaling / 2; + toPositionX -= direction[0] * toOffset; + toPositionY -= direction[1] * toOffset; + toPositionZ -= direction[2] * toOffset; + fromPositionX += direction[0] * fromOffset; + fromPositionY += direction[1] * fromOffset; + fromPositionZ += direction[2] * fromOffset; + length$12 = Math.max(length$12 - toOffset - fromOffset, minSize); + } + this._sizes[index2 * 3 + 1] = Math.max(length$12 * sizeScalingY, minSize); + if (options.lineSizes) { + this._sizes[index2 * 3] = Math.max(options.lineSizes[id2] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options.lineSizes[id2] * sizeScalingZ, minSize); + } else if (options.endSizes) { + this._sizes[index2 * 3] = Math.max(options.endSizes[fromId] * sizeScalingX, minSize); + this._sizes[index2 * 3 + 2] = Math.max(options.endSizes[toId] * sizeScalingZ, minSize); + } else { + this._sizes[index2 * 3] = sizeScalingX; + this._sizes[index2 * 3 + 2] = sizeScalingZ; + } + } + _vec3[0] = (fromPositionX + toPositionX) / 2; + _vec3[1] = (fromPositionY + toPositionY) / 2; + _vec3[2] = (fromPositionZ + toPositionZ) / 2; + this._positions[index2 * 3] = _vec3[0]; + this._positions[index2 * 3 + 1] = _vec3[1]; + this._positions[index2 * 3 + 2] = _vec3[2]; + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, fromPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, fromPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, fromPositionZ); + this.minLayoutBoundsX = Math.min(this.minLayoutBoundsX, toPositionX); + this.minLayoutBoundsY = Math.min(this.minLayoutBoundsY, toPositionY); + this.minLayoutBoundsZ = Math.min(this.minLayoutBoundsZ, toPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, fromPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, fromPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, fromPositionZ); + this.maxLayoutBoundsX = Math.max(this.maxLayoutBoundsX, toPositionX); + this.maxLayoutBoundsY = Math.max(this.maxLayoutBoundsY, toPositionY); + this.maxLayoutBoundsZ = Math.max(this.maxLayoutBoundsZ, toPositionZ); + } + this._updateCumulativeLayoutBounds(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} layout ${count2} ${Math.round(window.performance.now() - start)}ms`); } - update(elapsedTime) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousPalette; - const current = transitionBuffer.currentPalette; - if (previous) previous.update(); - if (current) current.update(); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const previous = transitionBuffer.previousAtlas; - const current = transitionBuffer.currentAtlas; - if (previous) previous.update(); - if (current) current.update(); - } - } - if (this._core.config.isDebugVisible) { - if (this._debugAxesVisual) { - this._debugAxesVisual.mMatrix = this.mMatrix; - this._debugAxesVisual.vMatrices = this.vMatrices; - this._debugAxesVisual.pMatrices = this.pMatrices; - this._debugAxesVisual.viewports = this._viewports; - this._debugAxesVisual.viewportOffset = this._viewportOffset; - this._debugAxesVisual.viewportCount = this._viewportCount; - } - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - this.labelSets[i].label.update(elapsedTime); - labelSetVisual.mMatrix = this.mMatrix; - labelSetVisual.vMatrices = this.vMatrices; - labelSetVisual.pMatrices = this.pMatrices; - labelSetVisual.isPickingEnabled = this.isPickingEnabled; - labelSetVisual.pickPMatrix = this.pickPMatrix; - labelSetVisual.pickVMatrix = this.pickVMatrix; - labelSetVisual.viewports = this._viewports; - labelSetVisual.viewportOffset = this._viewportOffset; - labelSetVisual.viewportCount = this._viewportCount; - labelSetVisual.update(elapsedTime); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual && imageVisual.isVisible) { - const image = this.images[i].image; - image.update(elapsedTime); - imageVisual.mMatrix = this.mMatrix; - imageVisual.vMatrices = this.vMatrices; - imageVisual.pMatrices = this.pMatrices; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.pickPMatrix = this.pickPMatrix; - imageVisual.pickVMatrix = this.pickVMatrix; - imageVisual.viewports = this._viewports; - imageVisual.viewportOffset = this._viewportOffset; - imageVisual.viewportCount = this._viewportCount; - imageVisual.update(elapsedTime); - } - } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - const controller = this.controllers[i].controller; - controller.update(elapsedTime); - controllerVisual.vMatrices = this.vMatrices; - controllerVisual.inverseVMatrices = this.vMatrices; - controllerVisual.pMatrices = this.pMatrices; - controllerVisual.viewports = this._viewports; - controllerVisual.viewportOffset = this._viewportOffset; - controllerVisual.viewportCount = this._viewportCount; - controllerVisual.update(elapsedTime); - } - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - const axes = axesVisual.axes; - axes.mMatrix = this.mMatrix; - axes.vMatrix = this.vMatrices[0]; - axes.update(elapsedTime); - axesVisual.vMatrices = this.vMatrices; - axesVisual.pMatrices = this.pMatrices; - axesVisual.isPickingEnabled = this.isPickingEnabled; - axesVisual.pickPMatrix = this.pickPMatrix; - axesVisual.pickVMatrix = this.pickVMatrix; - axesVisual.viewports = this._viewports; - axesVisual.viewportOffset = this._viewportOffset; - axesVisual.viewportCount = this._viewportCount; - axesVisual.update(elapsedTime); - } + update(buffer, ids, fromIds, toIds, options) { + const start = window.performance.now(); + const offset2 = options.offset === void 0 ? 0 : options.offset; + const count2 = options.count === void 0 ? ids.length : options.count; + const dataView = buffer.dataView; + const _vec2 = create(); + const _vec3 = create$3(); + const _quat = create$1(); + const endMinColor = options.endMinColor === void 0 ? 0 : options.endMinColor; + const endMaxColor = options.endMaxColor === void 0 ? 1 : options.endMaxColor; + const lineMinColor = options.lineMinColor === void 0 ? 0 : options.lineMinColor; + const lineMaxColor = options.lineMaxColor === void 0 ? 1 : options.lineMaxColor; + const minOrder = options.minOrder === void 0 ? 0 : options.minOrder; + const maxOrder = options.maxOrder === void 0 ? 1 : options.maxOrder; + const orderReverse = options.orderReverse === void 0 ? false : options.orderReverse; + const minStaggerOrder = options.minStaggerOrder === void 0 ? 0 : options.minStaggerOrder; + const maxStaggerOrder = options.maxStaggerOrder === void 0 ? 1 : options.maxStaggerOrder; + const staggerOrderReverse = options.staggerOrderReverse === void 0 ? false : options.staggerOrderReverse; + const reverseX = options.reverseX === void 0 ? false : options.reverseX; + const reverseY = options.reverseY === void 0 ? false : options.reverseY; + const reverseZ = options.reverseZ === void 0 ? false : options.reverseZ; + this._updateModelBounds(options); + const lookup2 = buffer.lookup; + const selection = options.selected && options.selected.size > 0; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const fromId = fromIds[id2]; + const toId = toIds[id2]; + const index2 = lookup2[id2]; + let positionX = this._positions[index2 * 3]; + let positionY = this._positions[index2 * 3 + 1]; + let positionZ = this._positions[index2 * 3 + 2]; + if (this._isFacetted) { + if (reverseX) { + positionX = this.minModelBoundsX + this.minModelBoundsX + this._facetSizeX * (1 + this._facetSpacingX) - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.minModelBoundsY + this._facetSizeY * (1 + this._facetSpacingY) - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.minModelBoundsZ + this._facetSizeZ * (1 + this._facetSpacingZ) - positionZ; + } + const facetX = options.facetCoordsX ? options.facetCoordsX[id2] : 0; + const facetY = options.facetCoordsY ? options.facetCoordsY[id2] : 0; + const facetZ = options.facetCoordsZ ? options.facetCoordsZ[id2] : 0; + positionX += facetX * this._facetSizeX * (1 + this._facetSpacingX); + positionY += facetY * this._facetSizeY * (1 + this._facetSpacingY); + positionZ += facetZ * this._facetSizeZ * (1 + this._facetSpacingZ); + } else { + if (reverseX) { + positionX = this.minModelBoundsX + this.maxModelBoundsX - positionX; + } + if (reverseY) { + positionY = this.minModelBoundsY + this.maxModelBoundsY - positionY; + } + if (reverseZ) { + positionZ = this.minModelBoundsZ + this.maxModelBoundsZ - positionZ; + } + } + _vec3[0] = (positionX - this.modelOriginX) * this._boundsScaling; + _vec3[1] = (positionY - this.modelOriginY) * this._boundsScaling; + _vec3[2] = (positionZ - this.modelOriginZ) * this._boundsScaling; + UnitVertex.setTranslation(dataView, index2, _vec3); + _vec3[0] = this._sizes[index2 * 3] * this._boundsScaling; + _vec3[1] = this._sizes[index2 * 3 + 1] * this._boundsScaling; + _vec3[2] = this._sizes[index2 * 3 + 2] * this._boundsScaling; + UnitVertex.setScale(dataView, index2, _vec3); + _quat[0] = this._rotations[index2 * 4]; + _quat[1] = this._rotations[index2 * 4 + 1]; + _quat[2] = this._rotations[index2 * 4 + 2]; + _quat[3] = this._rotations[index2 * 4 + 3]; + if (reverseX) { + _quat[1] = -_quat[1]; + _quat[2] = -_quat[2]; + } + if (reverseY) { + _quat[0] = -_quat[0]; + _quat[2] = -_quat[2]; + } + if (reverseZ) { + _quat[0] = -_quat[0]; + _quat[1] = -_quat[1]; + } + UnitVertex.setRotation(dataView, index2, _quat); + let size; + if (options.endColors) { + size = 1 / (endMaxColor - endMinColor + 1); + const fromColor = MathHelper.normalize(options.endColors[fromId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + const toColor = MathHelper.normalize(options.endColors[toId], endMinColor, endMaxColor, size / 2, 1 - size / 2); + set(_vec2, fromColor, toColor); + UnitVertex.setColor(dataView, index2, _vec2); + } else if (options.lineColors) { + size = 1 / (lineMaxColor - lineMinColor + 1); + const color2 = MathHelper.normalize(options.lineColors[id2], lineMinColor, lineMaxColor, size / 2, 1 - size / 2); + set(_vec2, color2, color2); + UnitVertex.setColor(dataView, index2, _vec2); + } else { + UnitVertex.setColor(dataView, index2, Constants.VECTOR2_ONE); } - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - const font = fontVisual.font; - font.update(); - fontVisual.update(); - } - } - getVertexPosition(position, pickedId) { - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - const id = transitionBuffer.pickIdLookup[pickedId]; - if (id > -1) { - const index = transitionBuffer.currentBuffer.lookup[id]; - const dataView = transitionBuffer.currentBuffer.dataView; - (0, _vertexJs.UnitVertex).getTranslation(dataView, index, position); - break; - } + UnitVertex.setIdHover(dataView, index2, options.hover ? options.hover[id2] : id2); + UnitVertex.setSelected(dataView, index2, selection ? options.selected.has(id2) ? 1 : -1 : 0); + if (options.order !== void 0) { + const order = MathHelper.normalize(options.order[id2], minOrder, maxOrder, 0, 1); + _vec2[0] = orderReverse ? 1 - order : order; + } else { + _vec2[0] = count2 == 1 ? 0 : i / (count2 - 1); } + if (options.staggerOrder !== void 0) { + _vec2[1] = options.staggerOrder; + } else if (options.staggerOrders) { + const stagger = MathHelper.normalize(options.staggerOrders[id2], minStaggerOrder, maxStaggerOrder, 0, 1); + _vec2[1] = staggerOrderReverse ? 1 - stagger : stagger; + } else { + _vec2[1] = count2 == 1 ? 0 : i / (count2 - 1); + } + UnitVertex.setOrder(dataView, index2, _vec2); + UnitVertex.setMaterial(dataView, index2, options.material ? options.material : options.materials ? options.materials[id2] : 0); + UnitVertex.setRounding(dataView, index2, options.rounding ? options.rounding * this._boundsScaling : options.roundings ? options.roundings[id2] * this._boundsScaling : 0); + UnitVertex.setSdfBuffer(dataView, index2, options.sdfBuffer ? options.sdfBuffer : options.sdfBuffers ? options.sdfBuffers[id2] : this._core.config.sdfBuffer); + UnitVertex.setSdfBorder(dataView, index2, options.sdfBorder ? options.sdfBorder : options.sdfBorders ? options.sdfBorders[id2] : this._core.config.sdfBorder); + UnitVertex.setMatId(dataView, index2, options.materialType ? options.materialType : options.materialTypes ? options.materialTypes[id2] : 0); + UnitVertex.setMatColor(dataView, index2, options.materialColor ? options.materialColor : options.materialColors ? [options.materialColors[id2 * 3], options.materialColors[id2 * 3 + 1], options.materialColors[id2 * 3 + 2]] : [0, 0, 0]); + UnitVertex.setMatFuzz(dataView, index2, options.materialFuzz ? options.materialFuzz : options.materialFuzzes ? options.materialFuzzes[id2] : 0); + UnitVertex.setMatGloss(dataView, index2, options.materialGloss ? options.materialGloss : options.materialGlosses ? options.materialGlosses[id2] : 0); + UnitVertex.setMatDensity(dataView, index2, options.materialDensity ? options.materialDensity : options.materialDensities ? options.materialDensities[id2] : 0); + UnitVertex.setMatRefractiveIndex(dataView, index2, options.materialRefractiveIndex ? options.materialRefractiveIndex : options.materialRefractiveIndices ? options.materialRefractiveIndices[id2] : 0); + UnitVertex.setSegColor(dataView, index2, options.segmentColor ? options.segmentColor : options.segmentColors ? [options.segmentColors[id2 * 4], options.segmentColors[id2 * 4 + 1], options.segmentColors[id2 * 4 + 2], options.segmentColors[id2 * 4 + 3]] : [buffer.idColors[id2 * 4], buffer.idColors[id2 * 4 + 1], buffer.idColors[id2 * 4 + 2], buffer.idColors[id2 * 4 + 3]]); + } + buffer.update(); + this._core.log.write(LogLevel.info, `${this.constructor.name.toLowerCase()} update ${count2} ${Math.round(window.performance.now() - start)}ms`); } - render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() {}); + } + class AtlasBase { + get imageData() { + return this._imageData; } - prepare(xrFrame) {} - initializeWebXR(session) { - return null; + set imageData(value2) { + if (this._imageData != value2) { + this._imageData = value2; + this._changed = true; + } + } + constructor() { + this._imageData = null; + } + copyFrom(atlas) { + if (atlas.imageData) { + this._imageData = atlas.imageData; + this._changed = true; + } else { + this.imageData = null; + } + } + update() { } -} - -},{"gl-matrix":"erHGu","../main.js":"b6Xbk","../components/axes/axes.js":"4X9HQ","../buffer.js":"8oaJi","../vertex.js":"8lW8V","../components/labels.js":"dXJPK","../components/debug.js":"1WLrb","../components/controller.js":"3tuGu","../components/image.js":"eexvE","../font.js":"fn4YW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8oaJi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "BufferBase", ()=>BufferBase); -parcelHelpers.export(exports, "TransitionBufferBase", ()=>TransitionBufferBase); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("./constants.js"); -var _paletteJs = require("./palette.js"); -var _vertexJs = require("./vertex.js"); -var _pickJs = require("./helpers/pick.js"); -var _mainJs = require("./main.js"); -var _atlasJs = require("./atlas.js"); -class BufferBase { + } + let Atlas$2 = class Atlas extends AtlasBase { + }; + class BufferBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get ids() { - return this._ids; + return this._ids; } get dataView() { - return this._dataView; + return this._dataView; } get vertices() { - return this._vertices; + return this._vertices; } get lookup() { - return this._lookup; + return this._lookup; } get length() { - return this._length; + return this._length; } get selected() { - return this._selected; - } - constructor(core, ids){ - this._core = core; - this._ids = ids; - this._length = ids.length; - this._vertices = new ArrayBuffer(this._length * (0, _vertexJs.UnitVertex).SIZE_BYTES); - this._dataView = new DataView(this._vertices); - this._selected = new Set(); - this.from = 0; - this.to = 1; - this.unitType = (0, _mainJs.UnitType).block; - this._lookup = {}; - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - this._lookup[id] = i; - (0, _vertexJs.UnitVertex).setRotation(this._dataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } + return this._selected; + } + constructor(core, ids) { + this._core = core; + this._ids = ids; + this._length = ids.length; + this._vertices = new ArrayBuffer(this._length * UnitVertex.SIZE_BYTES); + this._dataView = new DataView(this._vertices); + this._selected = /* @__PURE__ */ new Set(); + this.from = 0; + this.to = 1; + this.unitType = UnitType.block; + this._lookup = {}; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + this._lookup[id2] = i; + UnitVertex.setRotation(this._dataView, i, Constants.QUAT_IDENTITY); + } } createShared() { - const buffer = Object.create(this); - buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); - buffer._dataView = new DataView(buffer._vertices); - return buffer; + const buffer = Object.create(this); + buffer._vertices = new ArrayBuffer(buffer._vertices.byteLength); + buffer._dataView = new DataView(buffer._vertices); + return buffer; } copyFrom(buffer) { - const start = window.performance.now(); - const fromDataView = buffer.dataView; - const toDataView = this._dataView; - const lookup = buffer.lookup; - for(let i = 0; i < this._length; i++){ - const index = lookup[this._ids[i]]; - if (index != null) { - (0, _vertexJs.UnitVertex).copyIdHover(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTranslation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyScale(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRotation(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyColor(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySelected(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyMaterial(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyRounding(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyOrder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexCoord(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyTexture(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBuffer(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copySdfBorder(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter1(fromDataView, index, toDataView, i); - (0, _vertexJs.UnitVertex).copyParameter2(fromDataView, index, toDataView, i); - } else (0, _vertexJs.UnitVertex).setRotation(toDataView, i, (0, _constantsJs.Constants).QUAT_IDENTITY); - } - this.unitType = buffer.unitType; - this._selected = buffer.selected; - this._core.log.write((0, _mainJs.LogLevel).info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - update() {} + const start = window.performance.now(); + const fromDataView = buffer.dataView; + const toDataView = this._dataView; + const lookup2 = buffer.lookup; + for (let i = 0; i < this._length; i++) { + const index2 = lookup2[this._ids[i]]; + if (index2 != null) { + UnitVertex.copyIdHover(fromDataView, index2, toDataView, i); + UnitVertex.copyTranslation(fromDataView, index2, toDataView, i); + UnitVertex.copyScale(fromDataView, index2, toDataView, i); + UnitVertex.copyRotation(fromDataView, index2, toDataView, i); + UnitVertex.copyColor(fromDataView, index2, toDataView, i); + UnitVertex.copySelected(fromDataView, index2, toDataView, i); + UnitVertex.copyMaterial(fromDataView, index2, toDataView, i); + UnitVertex.copyRounding(fromDataView, index2, toDataView, i); + UnitVertex.copyOrder(fromDataView, index2, toDataView, i); + UnitVertex.copyTexCoord(fromDataView, index2, toDataView, i); + UnitVertex.copyTexture(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBuffer(fromDataView, index2, toDataView, i); + UnitVertex.copySdfBorder(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter1(fromDataView, index2, toDataView, i); + UnitVertex.copyParameter2(fromDataView, index2, toDataView, i); + UnitVertex.copyMatId(fromDataView, index2, toDataView, i); + UnitVertex.copyMatColor(fromDataView, index2, toDataView, i); + UnitVertex.copyMatFuzz(fromDataView, index2, toDataView, i); + UnitVertex.copyMatRefractiveIndex(fromDataView, index2, toDataView, i); + UnitVertex.copyMatGloss(fromDataView, index2, toDataView, i); + UnitVertex.copyMatDensity(fromDataView, index2, toDataView, i); + UnitVertex.copySegColor(fromDataView, index2, toDataView, i); + } else { + UnitVertex.setRotation(toDataView, i, Constants.QUAT_IDENTITY); + } + } + this.unitType = buffer.unitType; + this._selected = buffer.selected; + this._core.log.write(LogLevel.info, `buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } + update() { + } updateSelection(options) { - const start = window.performance.now(); - const ids = options && options.ids ? options.ids : this._ids; - const offset = options && options.offset !== undefined ? options.offset : 0; - const count = options && options.count !== undefined ? options.count : ids.length; - const selection = this._selected.size > 0; - const dataView = this._dataView; - for(let i = 0; i < count; i++){ - const id = ids[i + offset]; - const index = this._lookup[id]; - (0, _vertexJs.UnitVertex).setSelected(dataView, index, selection ? this._selected.has(id) ? 1 : -1 : 0); - } - this.update(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer update selection ${count} ${Math.round(window.performance.now() - start)}ms`); - } -} -class TransitionBufferBase { + const start = window.performance.now(); + const ids = options && options.ids ? options.ids : this._ids; + const offset2 = options && options.offset !== void 0 ? options.offset : 0; + const count2 = options && options.count !== void 0 ? options.count : ids.length; + const selection = this._selected.size > 0; + const dataView = this._dataView; + for (let i = 0; i < count2; i++) { + const id2 = ids[i + offset2]; + const index2 = this._lookup[id2]; + UnitVertex.setSelected(dataView, index2, selection ? this._selected.has(id2) ? 1 : -1 : 0); + } + this.update(); + this._core.log.write(LogLevel.info, `buffer update selection ${count2} ${Math.round(window.performance.now() - start)}ms`); + } + } + class TransitionBufferBase { get pickIdLookup() { - return this._pickIdLookup; + return this._pickIdLookup; } get currentBuffer() { - return this._isBuffer1Current ? this._buffer1 : this._buffer2; + return this._isBuffer1Current ? this._buffer1 : this._buffer2; } get previousBuffer() { - return this._isBuffer1Current ? this._buffer2 : this._buffer1; + return this._isBuffer1Current ? this._buffer2 : this._buffer1; } get currentPalette() { - return this._isBuffer1Current ? this._palette1 : this._palette2; + return this._isBuffer1Current ? this._palette1 : this._palette2; } get previousPalette() { - return this._isBuffer1Current ? this._palette2 : this._palette1; + return this._isBuffer1Current ? this._palette2 : this._palette1; } get currentAtlas() { - return this._isBuffer1Current ? this._atlas1 : this._atlas2; + return this._isBuffer1Current ? this._atlas1 : this._atlas2; } get previousAtlas() { - return this._isBuffer1Current ? this._atlas2 : this._atlas1; + return this._isBuffer1Current ? this._atlas2 : this._atlas1; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get length() { - return this._length; - } - constructor(core, ids, bufferType, paletteType, atlasType){ - this.bufferType = bufferType; - this.paletteType = paletteType; - this.atlasType = atlasType; - this._core = core; - this._length = ids.length; - this.id = TransitionBufferBase._id++; - this.isVisible = true; - this.transitionTime = 1; - this.activeId = -1; - const start = window.performance.now(); - this._buffer1 = new bufferType(core, ids); - this._buffer2 = this._buffer1.createShared(); - this._palette1 = new paletteType(); - this._palette2 = new paletteType(); - this._atlas1 = new atlasType(); - this._atlas2 = new atlasType(); - this.isPickingEnabled = true; - this._pickIdLookup = {}; - const dataView1 = this._buffer1.dataView; - const dataView2 = this._buffer2.dataView; - const _vec4 = (0, _glMatrix.vec4).create(); - for(let i = 0; i < this._length; i++){ - const id = ids[i]; - const pickId = (0, _pickJs.PickHelper).nextPickId(); - this._pickIdLookup[pickId] = id; - (0, _pickJs.PickHelper).encodeNumber(pickId, (0, _mainJs.PickType).data, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView1, i, _vec4); - (0, _vertexJs.UnitVertex).setIdColor(dataView2, i, _vec4); - } - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); + return this._length; + } + constructor(core, ids, bufferType, paletteType, atlasType) { + this.bufferType = bufferType; + this.paletteType = paletteType; + this.atlasType = atlasType; + this._core = core; + this._length = ids.length; + this.id = TransitionBufferBase._id++; + this.isVisible = true; + this.transitionTime = 1; + this.activeId = -1; + const start = window.performance.now(); + this._buffer1 = new bufferType(core, ids); + this._buffer2 = this._buffer1.createShared(); + this._palette1 = new paletteType(); + this._palette2 = new paletteType(); + this._atlas1 = new atlasType(); + this._atlas2 = new atlasType(); + this.isPickingEnabled = true; + this._pickIdLookup = {}; + const dataView1 = this._buffer1.dataView; + const dataView2 = this._buffer2.dataView; + const _vec4 = create$2(); + this.idColors = new Float32Array(this._length * 4); + this._buffer1.idColors = this.idColors; + this._buffer2.idColors = this.idColors; + for (let i = 0; i < this._length; i++) { + const id2 = ids[i]; + const pickId = PickHelper.nextPickId(); + this._pickIdLookup[pickId] = id2; + PickHelper.encodeNumber(pickId, PickType.data, _vec4); + this.idColors[i * 4] = _vec4[0]; + this.idColors[i * 4 + 1] = _vec4[1]; + this.idColors[i * 4 + 2] = _vec4[2]; + this.idColors[i * 4 + 3] = _vec4[3]; + UnitVertex.setIdColor(dataView1, i, _vec4); + UnitVertex.setIdColor(dataView2, i, _vec4); + } + this._core.log.write(LogLevel.info, `transition buffer created ${this._length} ${Math.round(window.performance.now() - start)}ms`); } swap() { - this._isBuffer1Current = !this._isBuffer1Current; + this._isBuffer1Current = !this._isBuffer1Current; } copyFrom(transitionBuffer) { - const start = window.performance.now(); - this.key = transitionBuffer.key; - this.isVisible = transitionBuffer.isVisible; - this.transitionTime = transitionBuffer.transitionTime; - this.isPickingEnabled = transitionBuffer.isPickingEnabled; - this.unitType = transitionBuffer.unitType; - this.activeId = transitionBuffer.activeId; - this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); - this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); - this.currentBuffer.update(); - this.previousBuffer.update(); - this.currentPalette.copyFrom(transitionBuffer.currentPalette); - this.previousPalette.copyFrom(transitionBuffer.previousPalette); - this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); - this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); - this._core.log.write((0, _mainJs.LogLevel).info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } -} -TransitionBufferBase._id = 1; -class Buffer extends BufferBase { - constructor(core, ids){ - super(core, ids); - } -} -class TransitionBuffer extends TransitionBufferBase { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - } -} - -},{"gl-matrix":"erHGu","./constants.js":"dHTsY","./palette.js":"a14oj","./vertex.js":"8lW8V","./helpers/pick.js":"fOypM","./main.js":"b6Xbk","./atlas.js":"huG9l","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"huG9l":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AtlasBase", ()=>AtlasBase); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -class AtlasBase { - get imageData() { - return this._imageData; + const start = window.performance.now(); + this.key = transitionBuffer.key; + this.isVisible = transitionBuffer.isVisible; + this.transitionTime = transitionBuffer.transitionTime; + this.isPickingEnabled = transitionBuffer.isPickingEnabled; + this.unitType = transitionBuffer.unitType; + this.activeId = transitionBuffer.activeId; + this.currentBuffer.copyFrom(transitionBuffer.currentBuffer); + this.previousBuffer.copyFrom(transitionBuffer.previousBuffer); + this.currentBuffer.update(); + this.previousBuffer.update(); + this.currentPalette.copyFrom(transitionBuffer.currentPalette); + this.previousPalette.copyFrom(transitionBuffer.previousPalette); + this.currentAtlas.copyFrom(transitionBuffer.currentAtlas); + this.previousAtlas.copyFrom(transitionBuffer.previousAtlas); + this._core.log.write(LogLevel.info, `transition buffer copied ${this._length} ${Math.round(window.performance.now() - start)}ms`); } - set imageData(value) { - if (this._imageData != value) { - this._imageData = value; - this._changed = true; - } + } + TransitionBufferBase._id = 1; + let Buffer$3 = class Buffer extends BufferBase { + constructor(core, ids) { + super(core, ids); } - constructor(){ - this._imageData = null; + }; + let TransitionBuffer$2 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$3, Palette$2, Atlas$2); } - copyFrom(atlas) { - if (atlas.imageData) { - this._imageData = atlas.imageData; - this._changed = true; - } else this.imageData = null; - } - update() {} -} -class Atlas extends AtlasBase { -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1WLrb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxes", ()=>DebugAxes); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cubeJs = require("../meshes/cube.js"); -var _vertexJs = require("../vertex.js"); -class DebugAxes { + }; + class DebugAxes { get vertices() { - return this._vertices; + return this._vertices; } get indices() { - return this._indices; + return this._indices; } get indexCount() { - return this._indexCount; + return this._indexCount; } get isInitialized() { - return this._isInitialized; + return this._isInitialized; } initialize() { - let vertexOffset = 0; - let indexOffset = 0; - const axisVertices = (0, _cubeJs.Cube).POSITIONS; - const axisIndices = (0, _cubeJs.Cube).INDICES; - this._vertices = new ArrayBuffer(3 * (0, _vertexJs.PositionColorVertex).SIZE_BYTES * axisVertices.length / (0, _vertexJs.PositionVertex).SIZE); - const verticesView = new DataView(this._vertices); - this._indices = new Uint16Array(3 * axisIndices.length + 4); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - const transform = (0, _glMatrix.mat4).create(); - const length = 1; - const width = 0.01; - transform[0] = length; - transform[5] = width; - transform[10] = width; - transform[12] = 0.5; - transform[13] = 0; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITX, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = length; - transform[10] = width; - transform[12] = 0; - transform[13] = 0.5; - transform[14] = 0; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITY, transform, vertexOffset, indexOffset); - indexOffset += indexCount; - this._indices[indexOffset++] = axisIndices[indexCount - 1] + vertexOffset; - vertexOffset += vertexCount; - this._indices[indexOffset++] = axisIndices[0] + vertexOffset; - transform[0] = width; - transform[5] = width; - transform[10] = length; - transform[12] = 0; - transform[13] = 0; - transform[14] = 0.5; - this._createAxis(axisVertices, axisIndices, verticesView, this._indices, (0, _constantsJs.Constants).VECTOR3_UNITZ, transform, vertexOffset, indexOffset); - this._indexCount = this._indices.length; - this._isInitialized = true; + let vertexOffset = 0; + let indexOffset = 0; + const axisVertices = Cube.POSITIONS; + const axisIndices2 = Cube.INDICES; + this._vertices = new ArrayBuffer(3 * PositionColorVertex.SIZE_BYTES * axisVertices.length / PositionVertex.SIZE); + const verticesView = new DataView(this._vertices); + this._indices = new Uint16Array(3 * axisIndices2.length + 4); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + const transform2 = create$4(); + const length2 = 1; + const width2 = 0.01; + transform2[0] = length2; + transform2[5] = width2; + transform2[10] = width2; + transform2[12] = 0.5; + transform2[13] = 0; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants.VECTOR3_UNITX, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = length2; + transform2[10] = width2; + transform2[12] = 0; + transform2[13] = 0.5; + transform2[14] = 0; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants.VECTOR3_UNITY, transform2, vertexOffset, indexOffset); + indexOffset += indexCount; + this._indices[indexOffset++] = axisIndices2[indexCount - 1] + vertexOffset; + vertexOffset += vertexCount; + this._indices[indexOffset++] = axisIndices2[0] + vertexOffset; + transform2[0] = width2; + transform2[5] = width2; + transform2[10] = length2; + transform2[12] = 0; + transform2[13] = 0; + transform2[14] = 0.5; + this._createAxis(axisVertices, axisIndices2, verticesView, this._indices, Constants.VECTOR3_UNITZ, transform2, vertexOffset, indexOffset); + this._indexCount = this._indices.length; + this._isInitialized = true; } - update(elapsedTime) {} - _createAxis(axisVertices, axisIndices, verticesView, indices, color, transform, vertexOffset, indexOffset) { - const position = (0, _glMatrix.vec3).create(); - const vertexCount = axisVertices.length / (0, _vertexJs.PositionVertex).SIZE; - const indexCount = axisIndices.length; - for(let i = 0; i < vertexCount; i++){ - (0, _glMatrix.vec3).set(position, axisVertices[i * (0, _vertexJs.PositionVertex).SIZE], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 1], axisVertices[i * (0, _vertexJs.PositionVertex).SIZE + 2]); - (0, _glMatrix.vec3).transformMat4(position, position, transform); - (0, _vertexJs.PositionColorVertex).setPosition(verticesView, vertexOffset + i, position); - (0, _vertexJs.PositionColorVertex).setColor(verticesView, vertexOffset + i, color); - } - for(let i = 0; i < indexCount; i++)indices[indexOffset + i] = axisIndices[i] + vertexOffset; - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","../meshes/cube.js":"dYecn","../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fkg7Y":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"hUucd","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hUucd":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _colorJs = require("./shaders/color.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _modelJs = require("./shaders/model.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unithexprismJs = require("./shaders/unithexprism.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _anaglyphJs = require("./shaders/anaglyph.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _pickJs = require("../../helpers/pick.js"); -var _debugJs = require("./components/debug.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _controllerJs = require("./components/controller.js"); -var _imageJs = require("./components/image.js"); -var _vertexJs = require("../../vertex.js"); -var _labelsJs = require("./components/labels.js"); -var _fontJs = require("./font.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + update(elapsedTime) { } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + _createAxis(axisVertices, axisIndices2, verticesView, indices, color2, transform2, vertexOffset, indexOffset) { + const position2 = create$3(); + const vertexCount = axisVertices.length / PositionVertex.SIZE; + const indexCount = axisIndices2.length; + for (let i = 0; i < vertexCount; i++) { + set$3(position2, axisVertices[i * PositionVertex.SIZE], axisVertices[i * PositionVertex.SIZE + 1], axisVertices[i * PositionVertex.SIZE + 2]); + transformMat4$2(position2, position2, transform2); + PositionColorVertex.setPosition(verticesView, vertexOffset + i, position2); + PositionColorVertex.setColor(verticesView, vertexOffset + i, color2); + } + for (let i = 0; i < indexCount; i++) { + indices[indexOffset + i] = axisIndices2[i] + vertexOffset; + } + } + } + var __awaiter$2 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get shaderResources() { - return this._shaderResources; + }; + class RendererConfig { + reset() { } - get colorShader() { - return this._colorShader; + } + class RendererBase { + get isInitialized() { + return this._isInitialized; } - get textureShader() { - return this._textureShader; + get config() { + return this._config; } - get lassoShader() { - return this._lassoShader; + get devicePixelRatio() { + return this._devicePixelRatio; } - get modelShader() { - return this._modelShader; + get width() { + return this._canvas.width; } - get sdfTextShader() { - return this._sdfTextShader; + set width(value2) { + this._options.width = value2; } - get gridShader() { - return this._gridShader; + get height() { + return this._canvas.height; } - get blockShader() { - return this._blockShader; + set height(value2) { + this._options.height = value2; } - get sphereShader() { - return this._sphereShader; + get webXRReferenceSpace() { + return this._webXRReferenceSpace; } - get cyclinderShader() { - return this._cylinderShader; + get pickedType() { + return this._pickedType; } - get hexPrismShader() { - return this._hexPrismShader; + get pickedId() { + return this._pickedId; } - get sdfShader() { - return this._sdfShader; + get isCapturingPickImage() { + return this._isCapturingPickImage; } - get anaglyphShader() { - return this._anaglyphShader; + capturePickImage() { + this._isCapturingPickImage = true; + } + get backgroundColor() { + return this._backgroundColor; + } + set backgroundColor(value2) { + if (!exactEquals(value2, this._backgroundColor)) { + this._backgroundColor = value2; + } + } + get ambientColor() { + return this._ambientColor; + } + set ambientColor(value2) { + if (!exactEquals$1(value2, this._ambientColor)) { + this._ambientColor = value2; + } } get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._mat3 = (0, _glMatrix.mat3).create(); - this._directionToCamera = (0, _glMatrix.vec3).create(); - this._directionToLight = (0, _glMatrix.vec3).create(); - this._halfAngle = (0, _glMatrix.vec3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this.depthEnabled = true; + swapAxes() { + this._isAxes1Current = !this._isAxes1Current; } - get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + createCartesian2dAxesVisual(axes) { + return new AxesVisual(axes); } - get isWebXRSupported() { - return true; + createCartesian3dAxesVisual(axes) { + return new AxesVisual(axes); } - initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._colorShader = new (0, _colorJs.Color)(this._core, this); - this._textureShader = new (0, _textureJs.Texture)(this._core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(this._core, this); - this._modelShader = new (0, _modelJs.Model)(this._core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(this._core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(this._core, this); - this._anaglyphShader = new (0, _anaglyphJs.Anaglyph)(this._core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(this._core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(this._core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(this._core, this); - this._hexPrismShader = new (0, _unithexprismJs.UnitHexPrism)(this._core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(this._core, this); - this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - this._isInitialized = false; - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._isInitialized = true; - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); - this._isInitialized = true; + _createDebugAxesVisual(debugAxes) { + return null; } - _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._shaderResources.initializeContext(this._gl); - this._colorShader.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._modelShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._anaglyphShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._hexPrismShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._debugAxesVisual.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - this._anaglyphTextures = [ - null, - null - ]; - this.anaglyphFramebuffers = [ - null, - null - ]; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - for(let i = 0; i < this.controllers.length; i++)this.controllers[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - for(let i = 0; i < 2; i++){ - const texture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width, height); - const framebuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(framebuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._anaglyphTextures[i] = texture; - this.anaglyphFramebuffers[i] = framebuffer; - } - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + createLabelSetVisual(labelSet) { + return new LabelSetVisual$2(labelSet); } - _createContext(canvas) { - const antialias = this._options ? this._options.antialias === undefined ? true : this._options.antialias : true; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - return canvas.getContext("webgl", { - stencil: true, - alpha: true, - antialias: antialias, - preserveDrawingBuffer: preserveDrawingBuffer - }); + createControllerVisual(controller) { + return new ControllerVisual$1(controller); } - initializeWebXR(session) { - const promise = new Promise((resolve, reject)=>{ - this._gl.makeXRCompatible().then(()=>{ - session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, this._gl), - depthNear: this._core.config.nearPlane, - depthFar: this._core.config.farPlane - }); - session.requestReferenceSpace('local').then((refSpace)=>{ - this._webXRReferenceSpace = refSpace; - resolve(); - }); - }); - }); - return promise; + createTransitionBuffer(ids) { + return new TransitionBuffer$2(this._core, ids); } - prepare(xrFrame) { - if (xrFrame) { - const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); - if (pose) { - const glLayer = xrFrame.session.renderState.baseLayer; - for(let i = 0; i < pose.views.length; i++){ - const view = pose.views[i]; - this.vMatrices[i] = view.transform.inverse.matrix; - this.inverseVMatrices[i] = view.transform.matrix; - (0, _glMatrix.mat4).multiply(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); - this.mvMatrices[i] = this._mvMatrices[i]; - this.pMatrices[i] = view.projectionMatrix; - const viewport = glLayer.getViewport(view); - this._viewports[i].x = viewport.x; - this._viewports[i].y = viewport.y; - this._viewports[i].width = viewport.width; - this._viewports[i].height = viewport.height; - this._framebuffers[i] = glLayer.framebuffer; - } - } - this._viewportOffset = 0; - this._viewportCount = 2; - } else { - let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - this._framebuffers[0] = null; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - this._framebuffers[1] = null; - break; - case (0, _mainJs.StereoMode).anaglyph: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = this.anaglyphFramebuffers[0]; - this._framebuffers[1] = this.anaglyphFramebuffers[1]; - break; - case (0, _mainJs.StereoMode).split: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - viewport = this._viewports[1]; - viewport.x = this._canvas.width / 2; - viewport.y = 0; - viewport.width = this._canvas.width / 2; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 2; - this._framebuffers[0] = null; - this._framebuffers[1] = null; - break; - } - } + createImageVisual(image2) { + return new ImageVisual$2(image2); } - createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; + createFontVisual(font2) { + return new FontVisual$2(font2); } - createControllerVisual(controller) { - const visual = new (0, _controllerJs.ControllerVisual)(this._core, this, controller); - visual.initializeContext(this._gl); - return visual; + constructor(options) { + this._options = options; + this.fonts = {}; } - createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + get isWebXRSupported() { + return false; } - createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + initialize(core) { + this._core = core; + this._canvas = document.createElement("canvas"); + const contextmenu = this._options && this._options.contextmenu; + if (!contextmenu) { + this._canvas.addEventListener("contextmenu", (e) => { + e.preventDefault(); + }); + } + this._canvas.tabIndex = this._core.container.tabIndex; + this._canvas.style.display = "block"; + this._canvas.style.touchAction = "none"; + this._core.container.appendChild(this._canvas); + this._mvMatrices = [create$4(), create$4()]; + this.pickPMatrix = create$4(); + this.axesVisibility = AxesVisibility.current; + this._debugAxes = new DebugAxes(); + this._debugAxesVisual = this._createDebugAxesVisual(this._debugAxes); + this.transitionTime = 1; + this.transitionBuffers = []; + this.areLabelsVisible = true; + this.labelSets = []; + this.controllers = []; + this.areImagesVisible = true; + this.images = []; + this._viewports = [new DOMRect(), new DOMRect()]; + this.isPickingEnabled = false; + this._pickedType = PickType.none; + this._pickedId = 0; + this._lassoMMatrix = create$4(); + this._lassoThickness = create(); + this._resizeMinimumDelay = -1; + this._previousResizeWidth = -1; + this._previousResizeHeight = -1; } - _createDebugAxesVisual(debugAxes) { - return new (0, _debugJs.DebugAxesVisual)(this._core, this, debugAxes); + remove() { + this._core.container.removeChild(this._canvas); } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); + finalize() { + this._isInitialized = false; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; + setSize(elapsedTime) { + if (this._options && this._options.width && this._options.height) { + this._devicePixelRatio = 1; + this._resizeWidth = this._options.width; + this._resizeHeight = this._options.height; + } else { + this._devicePixelRatio = window.devicePixelRatio || 1; + this._resizeWidth = this._core.container.clientWidth * devicePixelRatio; + this._resizeHeight = this._core.container.clientHeight * devicePixelRatio; + } + if (this._resizeWidth != this._previousResizeWidth || this._resizeHeight != this._previousResizeHeight) { + this._previousResizeWidth = this._resizeWidth; + this._previousResizeHeight = this._resizeHeight; + this._isResizing = true; + this._resizeElapsedTime = elapsedTime; + } + if (this._isResizing) { + if (this._resizeElapsedTime > this._resizeMinimumDelay && this._isInitialized) { + this._isResizing = false; + this._resizeMinimumDelay = this._core.config.resizeMinimumDelay; + this._resize(this._resizeWidth, this._resizeHeight); + } else { + this._resizeElapsedTime += elapsedTime; + } + } } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; + _resize(width2, height2) { + this._canvas.style.width = `${Math.floor(width2 / this._devicePixelRatio)}px`; + this._canvas.style.height = `${Math.floor(height2 / this._devicePixelRatio)}px`; + width2 = Math.floor(width2); + height2 = Math.floor(height2); + this._canvas.width = width2; + this._canvas.height = height2; } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; + update(elapsedTime) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousPalette; + const current = transitionBuffer.currentPalette; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + const previous = transitionBuffer.previousAtlas; + const current = transitionBuffer.currentAtlas; + if (previous) { + previous.update(); + } + if (current) { + current.update(); + } + } + } + if (this._core.config.isDebugVisible) { + if (this._debugAxesVisual) { + this._debugAxesVisual.mMatrix = this.mMatrix; + this._debugAxesVisual.vMatrices = this.vMatrices; + this._debugAxesVisual.pMatrices = this.pMatrices; + this._debugAxesVisual.viewports = this._viewports; + this._debugAxesVisual.viewportOffset = this._viewportOffset; + this._debugAxesVisual.viewportCount = this._viewportCount; + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + this.labelSets[i].label.update(elapsedTime); + labelSetVisual.mMatrix = this.mMatrix; + labelSetVisual.vMatrices = this.vMatrices; + labelSetVisual.pMatrices = this.pMatrices; + labelSetVisual.isPickingEnabled = this.isPickingEnabled; + labelSetVisual.pickPMatrix = this.pickPMatrix; + labelSetVisual.pickVMatrix = this.pickVMatrix; + labelSetVisual.viewports = this._viewports; + labelSetVisual.viewportOffset = this._viewportOffset; + labelSetVisual.viewportCount = this._viewportCount; + labelSetVisual.update(elapsedTime); + } + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual && imageVisual.isVisible) { + const image2 = this.images[i].image; + image2.update(elapsedTime); + imageVisual.mMatrix = this.mMatrix; + imageVisual.vMatrices = this.vMatrices; + imageVisual.pMatrices = this.pMatrices; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.pickPMatrix = this.pickPMatrix; + imageVisual.pickVMatrix = this.pickVMatrix; + imageVisual.viewports = this._viewports; + imageVisual.viewportOffset = this._viewportOffset; + imageVisual.viewportCount = this._viewportCount; + imageVisual.update(elapsedTime); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + const controller = this.controllers[i].controller; + controller.update(elapsedTime); + controllerVisual.vMatrices = this.vMatrices; + controllerVisual.inverseVMatrices = this.vMatrices; + controllerVisual.pMatrices = this.pMatrices; + controllerVisual.viewports = this._viewports; + controllerVisual.viewportOffset = this._viewportOffset; + controllerVisual.viewportCount = this._viewportCount; + controllerVisual.update(elapsedTime); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + const axes = axesVisual.axes; + axes.mMatrix = this.mMatrix; + axes.vMatrix = this.vMatrices[0]; + axes.update(elapsedTime); + axesVisual.vMatrices = this.vMatrices; + axesVisual.pMatrices = this.pMatrices; + axesVisual.isPickingEnabled = this.isPickingEnabled; + axesVisual.pickPMatrix = this.pickPMatrix; + axesVisual.pickVMatrix = this.pickVMatrix; + axesVisual.viewports = this._viewports; + axesVisual.viewportOffset = this._viewportOffset; + axesVisual.viewportCount = this._viewportCount; + axesVisual.update(elapsedTime); + } + } + } + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + const font2 = fontVisual.font; + font2.update(); + fontVisual.update(); + } } - getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); + getVertexPosition(position2, pickedId) { + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + const id2 = transitionBuffer.pickIdLookup[pickedId]; + if (id2 > -1) { + const index2 = transitionBuffer.currentBuffer.lookup[id2]; + const dataView = transitionBuffer.currentBuffer.dataView; + UnitVertex.getTranslation(dataView, index2, position2); + break; + } + } } render(elapsedTime, xrFrame) { - return __awaiter(this, void 0, void 0, function*() { - if (this.depthEnabled) this._gl.enable(this._gl.DEPTH_TEST); - else this._gl.disable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); - if (xrFrame) { - const glLayer = xrFrame.session.renderState.baseLayer; - this._shaderResources.bindFramebuffer(glLayer.framebuffer); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph) { - for(let i = 0; i < 2; i++){ - this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } else { - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - if (this._core.config.isDebugVisible) { - this._debugAxesVisual.framebuffers = this._framebuffers; - this._debugAxesVisual.render(elapsedTime, xrFrame); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.framebuffers = this._framebuffers; - axesVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(xrFrame, transitionBuffer); - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.framebuffers = this._framebuffers; - labelSetVisual.render(elapsedTime, xrFrame); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.framebuffers = this._framebuffers; - imageVisual.pickFramebuffer = this._pickFrameBuffer; - imageVisual.isPickingEnabled = this.isPickingEnabled; - imageVisual.render(elapsedTime, xrFrame); - } - } - for(let i = 0; i < this.controllers.length; i++){ - const controllerVisual = this.controllers[i]; - if (controllerVisual.isVisible) { - controllerVisual.isRayVisible = this.isPickingEnabled; - controllerVisual.framebuffers = this._framebuffers; - controllerVisual.render(elapsedTime, xrFrame); - } - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - if (this._isCapturingPickImage && this.capturePickImageCallback) { - this._isCapturingPickImage = false; - const data = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); - this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data); - for(let i = 0; i < data.length / 4; i++)if (data[i * 4 + 3] == (0, _mainJs.PickType).data) data[i * 4 + 3] = 255; - else { - data[i * 4] = 0; - data[i * 4 + 1] = 0; - data[i * 4 + 2] = 0; - data[i * 4 + 3] = 0; - } - const length = this._core.config.pickWidth * this._core.config.pickHeight * 4; - const row = this._core.config.pickWidth * 4; - const end = (this._core.config.pickHeight - 1) * row; - const flipped = new Uint8ClampedArray(length); - for(let i = 0; i < length; i += row)flipped.set(data.subarray(i, i + row), end - i); - this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); - } - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - if (this._core.config.stereoMode == (0, _mainJs.StereoMode).anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { - this._shaderResources.bindFramebuffer(null); - this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); - this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; - this._anaglyphShader.indexBuffer = this._quad.indexBuffer; - this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; - this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; - this._anaglyphShader.prepare(); - this._anaglyphShader.viewport = this._viewports[0]; - this._anaglyphShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - }); + return __awaiter$2(this, void 0, void 0, function* () { + }); } - _renderTransitionBuffer(xrFrame, transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf || unitType == (0, _mainJs.UnitType).ringSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = 0; - this._blockShader.rangeMax = transitionBuffer.length - 1; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.selectedColor = this._core.config.selectionColor; - this._blockShader.hoverColor = this._core.config.hoverColor; - this._blockShader.activeColor = this._core.config.activeColor; - this._blockShader.highlightMode = this._core.config.highlightMode; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.ambient = this._config.ambient; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._blockShader.directionToLight = this._directionToLight; - this._blockShader.halfAngle = this._halfAngle; - } else { - this._blockShader.directionToLight = this._config.directionToLight; - this._blockShader.halfAngle = this._config.halfAngle; - } - this._blockShader.vMatrix = vMatrix; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf || unitType == (0, _mainJs.UnitType).disk)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = 0; - this._sphereShader.rangeMax = transitionBuffer.length - 1; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.selectedColor = this._core.config.selectionColor; - this._sphereShader.hoverColor = this._core.config.hoverColor; - this._sphereShader.activeColor = this._core.config.activeColor; - this._sphereShader.highlightMode = this._core.config.highlightMode; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.ambient = this._config.ambient; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sphereShader.directionToLight = this._directionToLight; - this._sphereShader.halfAngle = this._halfAngle; - } else { - this._sphereShader.directionToLight = this._config.directionToLight; - this._sphereShader.halfAngle = this._config.halfAngle; - } - this._sphereShader.vMatrix = vMatrix; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = 0; - this._cylinderShader.rangeMax = transitionBuffer.length - 1; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.selectedColor = this._core.config.selectionColor; - this._cylinderShader.hoverColor = this._core.config.hoverColor; - this._cylinderShader.activeColor = this._core.config.activeColor; - this._cylinderShader.highlightMode = this._core.config.highlightMode; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.ambient = this._config.ambient; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._cylinderShader.directionToLight = this._directionToLight; - this._cylinderShader.halfAngle = this._halfAngle; - } else { - this._cylinderShader.directionToLight = this._config.directionToLight; - this._cylinderShader.halfAngle = this._config.halfAngle; - } - this._cylinderShader.vMatrix = vMatrix; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._hexPrismShader.isInitialized && (unitType == (0, _mainJs.UnitType).hexPrism || unitType == (0, _mainJs.UnitType).hexPrismSdf)) { - this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; - this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._hexPrismShader.prepare(); - this._hexPrismShader.mMatrix = this.mMatrix; - this._hexPrismShader.time = this.transitionTime; - this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._hexPrismShader.rangeMin = 0; - this._hexPrismShader.rangeMax = transitionBuffer.length - 1; - this._hexPrismShader.hover = hoverId; - this._hexPrismShader.active = activeId; - this._hexPrismShader.selectedColor = this._core.config.selectionColor; - this._hexPrismShader.hoverColor = this._core.config.hoverColor; - this._hexPrismShader.activeColor = this._core.config.activeColor; - this._hexPrismShader.highlightMode = this._core.config.highlightMode; - this._hexPrismShader.specularPower = this._config.specularPower; - this._hexPrismShader.specularIntensity = this._config.specularIntensity; - this._hexPrismShader.ambient = this._config.ambient; - this._hexPrismShader.apply(); - this._hexPrismShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._hexPrismShader.directionToLight = this._directionToLight; - this._hexPrismShader.halfAngle = this._halfAngle; - } else { - this._hexPrismShader.directionToLight = this._config.directionToLight; - this._hexPrismShader.halfAngle = this._config.halfAngle; - } - this._hexPrismShader.vMatrix = vMatrix; - this._hexPrismShader.pMatrix = this.pMatrices[viewport]; - this._hexPrismShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._hexPrismShader.isPickShader = true; - this._hexPrismShader.pMatrix = this.pickPMatrix; - this._hexPrismShader.vMatrix = this.pickVMatrix; - this._hexPrismShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = 0; - this._sdfShader.rangeMax = transitionBuffer.length - 1; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.selectedColor = this._core.config.selectionColor; - this._sdfShader.hoverColor = this._core.config.hoverColor; - this._sdfShader.activeColor = this._core.config.activeColor; - this._sdfShader.highlightMode = this._core.config.highlightMode; - this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 0xff; - this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.ambient = this._config.ambient; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - const vMatrix = this.vMatrices[viewport]; - if (xrFrame) { - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToLight, this._directionToLight); - const inverseVMatrix = this.inverseVMatrices[viewport]; - (0, _glMatrix.vec3).set(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); - (0, _glMatrix.vec3).subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); - (0, _glMatrix.vec3).normalize(this._directionToCamera, this._directionToCamera); - (0, _glMatrix.vec3).add(this._halfAngle, this._directionToLight, this._directionToCamera); - (0, _glMatrix.vec3).normalize(this._halfAngle, this._halfAngle); - (0, _glMatrix.mat3).fromMat4(this._mat3, vMatrix); - (0, _glMatrix.vec3).transformMat3(this._directionToLight, this._directionToLight, this._mat3); - (0, _glMatrix.vec3).transformMat3(this._halfAngle, this._halfAngle, this._mat3); - this._sdfShader.directionToLight = this._directionToLight; - this._sdfShader.halfAngle = this._halfAngle; - } else { - this._sdfShader.directionToLight = this._config.directionToLight; - this._sdfShader.halfAngle = this._config.halfAngle; - } - this._sdfShader.vMatrix = vMatrix; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } + prepare(xrFrame) { } -} - -},{"gl-matrix":"erHGu","../../main.js":"b6Xbk","../renderer.js":"as6Zc","./components/quad.js":"jADik","./buffer.js":"jvMAm","./config.js":"j6xuo","./shaders/shader.js":"iHdfn","./shaders/color.js":"4deoj","./shaders/texture.js":"3kACR","./shaders/lasso.js":"84GaR","./shaders/model.js":"d1jaI","./shaders/sdftext.js":"fArBv","./shaders/pickgrid.js":"kon45","./shaders/unitblock.js":"hyLH6","./shaders/unitsphere.js":"dcUFE","./shaders/unitcylinder.js":"5MykT","./shaders/unithexprism.js":"1Gq4W","./shaders/unitsdf.js":"Ooz78","./shaders/anaglyph.js":"3ENS2","../../helpers/texture.js":"kVjwp","../../helpers/pick.js":"fOypM","./components/debug.js":"fy6nY","./components/axes/cartesian2d.js":"ePDNv","./components/axes/cartesian3d.js":"eoEim","./components/controller.js":"kScGF","./components/image.js":"43dVw","../../vertex.js":"8lW8V","./components/labels.js":"5z3WR","./font.js":"fn1Fc","./components/lasso.js":"jU67t","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jADik":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { + initializeWebXR(session) { + return null; + } + } + let Quad$1 = class Quad { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$4(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"gl-matrix":"erHGu","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jvMAm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - get vertexBuffer() { - return this._vertexBuffer; + }; + let Atlas$1 = class Atlas extends AtlasBase { + get texture() { + return this._texture; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + get defaultTexture() { + return this._defaultTexture; } - update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + update() { + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } } -} - -},{"../../buffer.js":"8oaJi","../../main.js":"b6Xbk","./atlas.js":"hIdlm","./palette.js":"a6WOR","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hIdlm":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + }; + let Palette$1 = class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../atlas.js":"huG9l","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a6WOR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { - get texture() { - return this._texture; + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } } - get defaultTexture() { - return this._defaultTexture; + }; + let Buffer$2 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../palette.js":"a14oj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j6xuo":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); + }; + let TransitionBuffer$1 = class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$2, Palette$1, Atlas$1); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + }; + let Config$1 = class Config extends RendererConfig { + constructor() { + super(); + this.reset(); } reset() { - this.specularIntensity = 0.15; - this.specularPower = 150; - this.lightPosition = (0, _glMatrix.vec3).fromValues(-0.5, 0.5, 0); - this.ambient = 0.01; - const _quat1 = (0, _glMatrix.quat).create(); - const _quat2 = (0, _glMatrix.quat).create(); - let angle = (0, _angleJs.AngleHelper).degreesToRadians(15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITX, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat1, _quat2); - angle = (0, _angleJs.AngleHelper).degreesToRadians(-15); - (0, _glMatrix.quat).setAxisAngle(_quat1, (0, _constantsJs.Constants).VECTOR3_UNITY, angle); - (0, _glMatrix.quat).multiply(_quat2, _quat2, _quat1); - this.directionToLight = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(this.directionToLight, (0, _constantsJs.Constants).VECTOR3_UNITZ, _quat2); - this.halfAngle = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(this.halfAngle, (0, _constantsJs.Constants).VECTOR3_UNITZ, this.directionToLight); - (0, _glMatrix.vec3).normalize(this.halfAngle, this.halfAngle); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../helpers/angle.js":"hBXkO","../renderer.js":"as6Zc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iHdfn":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.specularIntensity = 0.15; + this.specularPower = 150; + this.lightPosition = fromValues$3(-0.5, 0.5, 0); + this.ambient = 0.01; + const _quat1 = create$1(); + const _quat2 = create$1(); + let angle2 = AngleHelper.degreesToRadians(15); + setAxisAngle(_quat1, Constants.VECTOR3_UNITX, angle2); + multiply(_quat2, _quat1, _quat2); + angle2 = AngleHelper.degreesToRadians(-15); + setAxisAngle(_quat1, Constants.VECTOR3_UNITY, angle2); + multiply(_quat2, _quat2, _quat1); + this.directionToLight = create$3(); + transformQuat(this.directionToLight, Constants.VECTOR3_UNITZ, _quat2); + this.halfAngle = create$3(); + add(this.halfAngle, Constants.VECTOR3_UNITZ, this.directionToLight); + normalize$2(this.halfAngle, this.halfAngle); + this.isFxaaEnabled = false; + } + }; + let Resources$1 = class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); - this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); - this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); - this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "anaglyph.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n", - "color.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.ANGLE_instanced_arrays = gl.getExtension("ANGLE_instanced_arrays"); + this.OES_standard_derivatives = gl.getExtension("OES_standard_derivatives"); + this.EXT_frag_depth = gl.getExtension("EXT_frag_depth"); + this.OES_element_index_uint = gl.getExtension("OES_element_index_uint"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + }; + Resources$1.glsl = { + "anaglyph.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec4 uViewport;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nconst vec3 LEFT_MASK = vec3(1.0, 0.0, 0.0);\nconst vec3 RIGHT_MASK = vec3(0.0, 1.0, 1.0);\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 color = LEFT_MASK * dot(texture2D(uSampler1, texCoords).rgb, LUMINANCE);\ncolor += RIGHT_MASK * dot(texture2D(uSampler2, texCoords).rgb, LUMINANCE);\ngl_FragColor = vec4(color, 1.0);\n}\n', + "color.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec3 vColor;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(vColor, GAMMA), 1.0);\n}\n', "color.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec3 aColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying lowp vec3 vColor;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvColor = aColor;\n}\n", - "lasso.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\ngl_FragColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "model.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n", + "model.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\ngl_FragColor = vec4(pow(texture2D(uSampler, vTexCoord).xyz, GAMMA), 1.0);\nvec3 color = texture2D(uSampler, vTexCoord).xyz;\nfloat ambient = 0.01;\nvec3 normal = normalize(vNormal);\nfloat diffuse = 0.5 * max(dot(uDirectionToLight, normal), 0.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (ambient + diffuse);\ncolor += specular;\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n', "model.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nvTexCoord = aTexCoord;\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(aNormal, 0.0));\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\n}\n", - "pickgrid.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n", + "pickgrid.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nuniform vec3 uDirectionToLight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick)\n{\ngl_FragColor = vColor;\n}\nelse\n{\nvec2 buffer;\n#ifdef Derivatives\nbuffer = fwidth(vTexCoord);\n#else\nbuffer = vec2(0.002);\n#endif\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nfloat diffuse = 0.2 * max(dot(uDirectionToLight, vNormal), 0.0);\nfloat ambient = 0.8;\ncolor.xyz *= (ambient + diffuse);\ncolor.xyz = pow(color.xyz, GAMMA);\ngl_FragColor = color;\n}\n}\n', "pickgrid.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute lowp vec4 aIdColor;\nattribute mediump vec2 aTexCoord;\nattribute mediump vec3 aNormal;\nattribute mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nvarying lowp vec4 vColor;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec4 vBounds;\nvarying mediump vec3 vNormal;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", - "sdftext.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n", + "sdftext.fragment.fx": '#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#define Derivatives\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse {\nfloat distance = texture2D(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\ngl_FragColor = vec4(pow(mix(uBorderColor, mix(uColor, uHoverColor, vHover), value), GAMMA), 1.0);\n}\n}\n', "sdftext.vertex.fx": "#version 100\nattribute lowp vec4 aIdColor;\nattribute vec3 aPosition;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nvarying mediump vec2 vTexCoord;\nvarying lowp vec4 vIdColor;\nvarying lowp float vHover;\nvoid main(void) {\ngl_Position = uPMatrix * uVMatrix * uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 100\nattribute vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "texture.fragment.fx": "#version 100\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nvarying mediump vec2 vTexCoord;\nvoid main(void)\n{\nif (uPick) {\ngl_FragColor = vec4(0.0);\n}\nelse {\ngl_FragColor = vec4(texture2D(uSampler, vTexCoord).xyz, 1.0);\n}\n}\n", "texture.vertex.fx": "#version 100\nattribute vec3 aPosition;\nattribute mediump vec3 aNormal;\nattribute mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nvarying mediump vec3 vNormal;\nvarying mediump vec2 vTexCoord;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\ngl_Position = uPMatrix * mvMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n", - "unitblock.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitcylinder.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unithexprism.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unithexprism.vertex.fx": "#version 100\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n", - "unitsdf.vertex.fx": "#version 100\n#include \"quat.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n", - "unitsphere.vertex.fx": "#version 100\n#include \"common.include.fx\"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void)\n{\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n', + "unitblock.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - sqrt(h1);\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - sqrt(h2);\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitcylinder.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec4 vCircle1;\nvarying vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unithexprism.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform mat4 uVMatrix;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nvec4 iHexPrism( in vec3 ro, in vec3 rd, in float ra, in float he )\n{\nconst vec3 n1 = vec3( 1.0,0.0,0.0);\nconst vec3 n2 = vec3( 0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n3 = vec3(-0.5,0.0,ROOT_THREE_OVER_TWO);\nconst vec3 n4 = vec3( 0.0,1.0,0.0);\nvec3 t1 = vec3((vec2(ra,-ra)-dot(ro,n1))/dot(rd,n1), 1.0);\nvec3 t2 = vec3((vec2(ra,-ra)-dot(ro,n2))/dot(rd,n2), 1.0);\nvec3 t3 = vec3((vec2(ra,-ra)-dot(ro,n3))/dot(rd,n3), 1.0);\nvec3 t4 = vec3((vec2(he,-he)-dot(ro,n4))/dot(rd,n4), 1.0);\nif( t1.y<t1.x ) t1=vec3(t1.yx,-1.0);\nif( t2.y<t2.x ) t2=vec3(t2.yx,-1.0);\nif( t3.y<t3.x ) t3=vec3(t3.yx,-1.0);\nif( t4.y<t4.x ) t4=vec3(t4.yx,-1.0);\nvec4 tN=vec4(t1.x,t1.z*n1);\nif( t2.x>tN.x ) tN=vec4(t2.x,t2.z*n2);\nif( t3.x>tN.x ) tN=vec4(t3.x,t3.z*n3);\nif( t4.x>tN.x ) tN=vec4(t4.x,t4.z*n4);\nfloat tF = min(min(t1.y,t2.y),min(t3.y,t4.y));\nif( tN.x>tF || tF<0.0) return vec4(-1.0);\nreturn tN;\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = -vViewCenter;\nmat3 rot = mat3(uVMatrix);\nvec3 rdd = rd * rot;\nvec3 roo = ro * rot;\nvec4 tnor = iHexPrism(roo, rdd, vRadius * vScaling, vHeight * vScaling);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = rot * tnor.yzw;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unithexprism.vertex.fx": '#version 100\n#include "common.include.fx"\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying float vRadius;\nvarying float vHeight;\nvarying float vScaling;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvRadius = 0.0;\nvHeight = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvRadius = scale.x * ROOT_THREE_OVER_TWO;\nvHeight = scale.y;\nvec3 position = aPosition;\nposition.y *= scale.y;\nposition.z *= scale.x;\nposition.x *= scale.x * ROOT_THREE_OVER_TWO;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvScaling = length(uMMatrix[0].xyz) / 2.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 100\n#define Derivatives\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\nuniform vec3 uBackgroundColor;\nuniform float uBuffer;\n#ifdef Derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\nvoid main(void) {\nfloat distance = mix(texture2D(uPreviousSampler1, vPreviousTexCoord).r, texture2D(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer) {\ndiscard;\n}\nif (uPick) {\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nfloat diffuse, specular;\n#ifdef Derivatives\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\ndiffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nspecular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\n#else\ndiffuse = 1.0;\nspecular = 0.0;\n#endif\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\nfloat uGamma = 0.0;\nfloat gamma;\n#ifdef Derivatives\ngamma = fwidth(distance);\n#else\ngamma = uGamma;\n#endif\nfloat value = smoothstep(uBuffer + gamma, uBuffer, distance);\ngl_FragColor = vec4(mix(color, uBackgroundColor, value), 1.0);\n}\n}\n', + "unitsdf.vertex.fx": '#version 100\n#include "quat.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute mediump vec4 aRotation;\nattribute mediump vec4 aPreviousRotation;\nattribute mediump vec4 aTexCoord;\nattribute mediump vec4 aPreviousTexCoord;\nattribute lowp vec2 aColor;\nattribute lowp vec2 aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\n#define Derivatives\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump vec2 vTexCoord;\nvarying mediump vec2 vPreviousTexCoord;\n#ifdef Derivatives\nvarying vec3 vViewPosition;\n#endif\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\ngl_Position = vec4(0.0);\n#ifdef Derivatives\nvViewPosition = vec3(0.0);\n#endif\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\n#ifdef Derivatives\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\n#else\ngl_Position = uPMatrix * mvMatrix * vec4(position, 1.0);\n#endif\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 100\n#define FragDepth\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvarying mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform vec3 uDirectionToLight;\nuniform vec3 uHalfAngle;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbient;\nuniform vec3 uHoverColor;\nuniform vec3 uActiveColor;\nuniform vec3 uSelectedColor;\nuniform float uHighlightMode;\n#ifdef FragDepth\n#extension GL_EXT_frag_depth : enable\n#endif\nfloat sphIntersect(in vec3 ro, in vec3 rd, in vec4 sph)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot(oc, rd);\nfloat c = dot(oc, oc) - sph.w * sph.w;\nfloat h = b * b - c;\nif (h < 0.0) return -1.0;\nreturn -b - sqrt(h);\n}\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s);\nif (t < 0.0)\n{\ndiscard;\n}\nelse\n{\nvec3 viewPosition = rd * t;\n#ifdef FragDepth\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepthEXT = ndcDepth * 0.5 + 0.5;\n#endif\nif (uPick)\n{\ngl_FragColor = vIdColor;\n}\nelse\n{\nfloat emissive = 0.0;\nvec3 previousColor = texture2D(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture2D(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\nif (uHighlightMode < 0.5) {\nemissive = vVertexSelected * 0.5;\nemissive += 1.5 * max(vHover, vActive);\nemissive /= 4.0;\n}\nelse {\npreviousColor = mix(previousColor, vec3(dot(LUMINANCE, previousColor)), max(-vVertexSelected, 0.0));\ncolor = mix(color, vec3(dot(LUMINANCE, color)), max(-vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uSelectedColor, max(vVertexSelected, 0.0));\ncolor = mix(color, uSelectedColor, max(vVertexSelected, 0.0));\npreviousColor = mix(previousColor, uActiveColor, vActive);\ncolor = mix(color, uActiveColor, vActive);\npreviousColor = mix(previousColor, uHoverColor, vHover);\ncolor = mix(color, uHoverColor, vHover);\n}\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nfloat diffuse = clamp(dot(uDirectionToLight, normal), 0.0, 1.0);\nfloat specular = pow(clamp(dot(normal, uHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity;\ncolor *= (uAmbient + diffuse + emissive);\ncolor += specular;\ncolor = clamp(color, 0.0, 1.0);\ncolor = pow(color, GAMMA);\ngl_FragColor = vec4(color, 1.0);\n}\n}\n}\n', + "unitsphere.vertex.fx": '#version 100\n#include "common.include.fx"\nattribute mediump vec3 aPosition;\nattribute vec3 aTranslation;\nattribute vec3 aPreviousTranslation;\nattribute lowp float aColor;\nattribute lowp float aPreviousColor;\nattribute vec3 aScale;\nattribute vec3 aPreviousScale;\nattribute float aId;\nattribute vec2 aOrder;\nattribute lowp float aSelected;\nattribute lowp float aPreviousSelected;\nattribute lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nvarying lowp vec4 vIdColor;\nvarying lowp vec2 vVertexColor;\nvarying lowp float vVertexSelected;\nvarying highp float vAnimation;\nvarying lowp float vHover;\nvarying lowp float vActive;\nvarying mediump float vRadius;\nvarying vec3 vViewPosition;\nvarying vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec4 translation = vec4(mix(aPreviousTranslation, aTranslation, animation), 1.0);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * translation).xyz;\ntranslation.xyz += aPosition * scale;\nvViewPosition = (mvMatrix * translation).xyz;\ngl_Position = uPMatrix * vec4(vViewPosition, 1.0);\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nmat3 transpose(in mat3 mat) {\nvec3 i0 = mat[0];\nvec3 i1 = mat[1];\nvec3 i2 = mat[2];\nreturn mat3\n(\nvec3(i0.x, i1.x, i2.x),\nvec3(i0.y, i1.y, i2.y),\nvec3(i0.z, i1.z, i2.z)\n);\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + let ShaderBase$1 = class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); + } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources$1.glsl[vsName]), this._includesFromFile(Resources$1.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources$1.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"ekXmH","../../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4deoj":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Color", ()=>Color); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Color extends (0, _shaderJs.ShaderBase) { + }; + class Color extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("color.vertex.fx", "color.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionColorVertex).SIZE_BYTES, (0, _vertexJs.PositionColorVertex).COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._colorAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionColorVertex.SIZE_BYTES, PositionColorVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 3, this._gl.UNSIGNED_BYTE, true, PositionColorVertex.SIZE_BYTES, PositionColorVertex.COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._colorAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3kACR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + } + let Texture$1 = class Texture extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"84GaR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let Lasso$3 = class Lasso extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d1jaI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Model", ()=>Model); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Model extends (0, _shaderJs.ShaderBase) { + }; + class Model extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("model.vertex.fx", "model.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); } applyView() { - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fArBv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let SdfText$1 = class SdfText extends ShaderBase$1 { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kon45":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + }; + let PickGrid$1 = class PickGrid extends ShaderBase$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) fsSource = this._removeDirective(fsSource, "Derivatives"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hyLH6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eEo4k":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -var _mainJs = require("../../../main.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + }; + let UnitShader$1 = class UnitShader extends ShaderBase$1 { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); - this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); - this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); - this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); - this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._directionToLightUniform = gl.getUniformLocation(this._program, "uDirectionToLight"); + this._halfAngleUniform = gl.getUniformLocation(this._program, "uHalfAngle"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._ambientUniform = gl.getUniformLocation(this._program, "uAmbient"); + this._activeColorUniform = gl.getUniformLocation(this._program, "uActiveColor"); + this._selectedColorUniform = gl.getUniformLocation(this._program, "uSelectedColor"); + this._highlightModeUniform = gl.getUniformLocation(this._program, "uHighlightMode"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); } _updateCurrentBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); } _updatePreviousBuffer() { - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform1f(this._ambientUniform, this.ambient); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._activeColorUniform, this.activeColor); - this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == (0, _mainJs.HighlightMode).luminance ? 0.0 : 1.0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform1f(this._ambientUniform, this.ambient); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._activeColorUniform, this.activeColor); + this._gl.uniform3fv(this._selectedColorUniform, this.selectedColor); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + this._gl.uniform1f(this._highlightModeUniform, this.highlightMode == HighlightMode.luminance ? 0 : 1); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); - this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform3fv(this._directionToLightUniform, this.directionToLight); + this._gl.uniform3fv(this._halfAngleUniform, this.halfAngle); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); } updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"iHdfn","../../../meshes/cube.js":"dYecn","../../../vertex.js":"8lW8V","../../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dcUFE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._translationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTranslationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._scaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousScaleAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._selectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousSelectedAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._orderAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._idColorAttribute, 0); + } + }; + let UnitBlock$1 = class UnitBlock extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5MykT":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + disableProgram() { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + let UnitSphere$1 = class UnitSphere extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + }; + let UnitCylinder$1 = class UnitCylinder extends UnitShader$1 { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; + } + _updateCurrentBuffer() { + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); + } + _updatePreviousBuffer() { + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1Gq4W":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitHexPrism", ()=>UnitHexPrism); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitHexPrism extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + }; + class UnitHexPrism extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.EXT_frag_depth == null) fsSource = this._removeDirective(fsSource, "FragDepth"); - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unithexprism.vertex.fx", "unithexprism.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.EXT_frag_depth == null) { + fsSource = this._removeDirective(fsSource, "FragDepth"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"Ooz78":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + } + } + let UnitSdf$1 = class UnitSdf extends UnitShader$1 { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - if (this._main.shaderResources.OES_standard_derivatives == null) { - vsSource = this._removeDirective(vsSource, "Derivatives"); - fsSource = this._removeDirective(fsSource, "Derivatives"); - } - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + if (this._main.shaderResources.OES_standard_derivatives == null) { + vsSource = this._removeDirective(vsSource, "Derivatives"); + fsSource = this._removeDirective(fsSource, "Derivatives"); + } + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._sdfBufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._sdfBackgroundColorUniform = gl.getUniformLocation(this._program, "uBackgroundColor"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); - this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); - this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); + this._gl.uniform1f(this._sdfBufferUniform, this.sdfBuffer); + this._gl.uniform3fv(this._sdfBackgroundColorUniform, this.sdfBackgroundColor); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); - ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"eEo4k","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3ENS2":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Anaglyph", ()=>Anaglyph); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Anaglyph extends (0, _shaderJs.ShaderBase) { + super.disableProgram(); + const ANGLE_instanced_arrays = this._main.shaderResources.ANGLE_instanced_arrays; + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._rotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousRotationAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._texCoordAttribute, 0); + ANGLE_instanced_arrays.vertexAttribDivisorANGLE(this._previousTexCoordAttribute, 0); + } + }; + class Anaglyph extends ShaderBase$1 { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "anaglyph.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - } -} - -},{"./shader.js":"iHdfn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fy6nY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DebugAxesVisual", ()=>DebugAxesVisual); -class DebugAxesVisual { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + } + } + class DebugAxesVisual { get isInitialized() { - return this._isInitialized && this._main.colorShader.isInitialized; + return this._isInitialized && this._main.colorShader.isInitialized; + } + constructor(core, main, debugAxes) { + this._main = main; + this._debugAxes = debugAxes; + this.isVisible = true; + } + initializeContext(gl) { + if (!this._debugAxes.isInitialized) { + this._debugAxes.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const colorShader = this._main.colorShader; + const shaderResources = this._main.shaderResources; + colorShader.vertexBuffer = this._vertexBuffer; + colorShader.indexBuffer = this._indexBuffer; + colorShader.prepare(); + colorShader.mMatrix = this.mMatrix; + colorShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + colorShader.vMatrix = this.vMatrices[viewport]; + colorShader.pMatrix = this.pMatrices[viewport]; + colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + } + let AxesVisualBase$1 = class AxesVisualBase { + get isInitialized() { + return this._isInitialized; + } + get axes() { + return this._axes; } - constructor(core, main, debugAxes){ - this._main = main; - this._debugAxes = debugAxes; - this.isVisible = true; + constructor(core) { + this._core = core; + this.isVisible = true; } initializeContext(gl) { - if (!this._debugAxes.isInitialized) this._debugAxes.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._debugAxes.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._debugAxes.indices, gl.STATIC_DRAW); - this._isInitialized = true; + this._gl = gl; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const colorShader = this._main.colorShader; - const shaderResources = this._main.shaderResources; - colorShader.vertexBuffer = this._vertexBuffer; - colorShader.indexBuffer = this._indexBuffer; - colorShader.prepare(); - colorShader.mMatrix = this.mMatrix; - colorShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - colorShader.vMatrix = this.vMatrices[viewport]; - colorShader.pMatrix = this.pMatrices[viewport]; - colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._debugAxes.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } + } + _renderGrid() { + } + _renderText() { } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ePDNv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { + }; + let Cartesian2dVisual$1 = class Cartesian2dVisual extends AxesVisualBase$1 { get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; + } + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, this._axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"71uct","../../../../main.js":"b6Xbk","../../../../constants.js":"dHTsY","../../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"71uct":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { + }; + let Cartesian3dVisual$1 = class Cartesian3dVisual extends AxesVisualBase$1 { get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; - } - constructor(core){ - this._core = core; - this.isVisible = true; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - initializeContext(gl) { - this._gl = gl; - } - update(elapsedTime) {} - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eoEim":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _constantsJs = require("../../../../constants.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + } } + } } _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.directionToLight = Constants.VECTOR3_UNITZ; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } - this._gl.enable(this._gl.CULL_FACE); + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"71uct","../../../../main.js":"b6Xbk","../../../../constants.js":"dHTsY","../../../../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kScGF":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ControllerVisual", ()=>ControllerVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -var _constantsJs = require("../../../constants.js"); -class ControllerVisual { + }; + class ControllerVisual { get isInitialized() { - return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; + return this._isInitialized && this._modelShader.isInitialized && this._colorShader.isInitialized; } get controller() { - return this._controller; - } - constructor(core, main, controller){ - this._core = core; - this._main = main; - this._mMatrix = (0, _glMatrix.mat4).create(); - this._vec3 = (0, _glMatrix.vec3).create(); - this._controller = controller; - this._modelShader = main.modelShader; - this._colorShader = main.colorShader; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.rayMMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._controller; + } + constructor(core, main, controller) { + this._core = core; + this._main = main; + this._mMatrix = create$4(); + this._vec3 = create$3(); + this._controller = controller; + this._modelShader = main.modelShader; + this._colorShader = main.colorShader; + this.mMatrix = create$4(); + this.rayMMatrix = create$4(); + this.isVisible = true; } initializeContext(gl) { - if (!this._controller.isInitialized) this._controller.initialize(); - this._initialize(gl); + if (!this._controller.isInitialized) { + this._controller.initialize(); + } + this._initialize(gl); } _initialize(gl) { - this._gl = gl; - this.modelTexture = (0, _textureJs.TextureHelper).fromImage(gl, this._controller.texture, false, gl.LINEAR); - this._modelVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); - this._modelIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); - this._rayVertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); - this._rayIndexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); - this._isInitialized = true; + this._gl = gl; + this.modelTexture = TextureHelper.fromImage(gl, this._controller.texture, false, gl.LINEAR); + this._modelVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._modelVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.vertices, gl.STATIC_DRAW); + this._modelIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._modelIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.indices, gl.STATIC_DRAW); + this._rayVertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._rayVertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._controller.rayVertices, gl.STATIC_DRAW); + this._rayIndexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._rayIndexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._controller.rayIndices, gl.STATIC_DRAW); + this._isInitialized = true; + } + update(elapsedTime) { } - update(elapsedTime) {} render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._modelShader.vertexBuffer = this._modelVertexBuffer; - this._modelShader.indexBuffer = this._modelIndexBuffer; - this._modelShader.texture2D = this.modelTexture; - this._modelShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); - this._modelShader.mMatrix = this._mMatrix; - this._modelShader.specularPower = 10; - this._modelShader.specularIntensity = 0.01; - this._modelShader.apply(); - this._modelShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._modelShader.directionToLight = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.halfAngle = (0, _constantsJs.Constants).VECTOR3_UNITZ; - this._modelShader.vMatrix = this.vMatrices[viewport]; - this._modelShader.pMatrix = this.pMatrices[viewport]; - this._modelShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isRayVisible) { - this._colorShader.vertexBuffer = this._rayVertexBuffer; - this._colorShader.indexBuffer = this._rayIndexBuffer; - this._colorShader.prepare(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); - this._colorShader.mMatrix = this._mMatrix; - this._colorShader.apply(); - this._colorShader.applyModel(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - this._colorShader.vMatrix = this.vMatrices[viewport]; - this._colorShader.pMatrix = this.pMatrices[viewport]; - this._colorShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); - } - } + if (this.isInitialized) { + this._modelShader.vertexBuffer = this._modelVertexBuffer; + this._modelShader.indexBuffer = this._modelIndexBuffer; + this._modelShader.texture2D = this.modelTexture; + this._modelShader.prepare(); + multiply$2(this._mMatrix, this._controller.useRayPose ? this.rayMMatrix : this.mMatrix, this._controller.mMatrix); + this._modelShader.mMatrix = this._mMatrix; + this._modelShader.specularPower = 10; + this._modelShader.specularIntensity = 0.01; + this._modelShader.apply(); + this._modelShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._modelShader.directionToLight = Constants.VECTOR3_UNITZ; + this._modelShader.halfAngle = Constants.VECTOR3_UNITZ; + this._modelShader.vMatrix = this.vMatrices[viewport]; + this._modelShader.pMatrix = this.pMatrices[viewport]; + this._modelShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._controller.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isRayVisible) { + this._colorShader.vertexBuffer = this._rayVertexBuffer; + this._colorShader.indexBuffer = this._rayIndexBuffer; + this._colorShader.prepare(); + multiply$2(this._mMatrix, this.rayMMatrix, this._controller.rayMMatrix); + this._colorShader.mMatrix = this._mMatrix; + this._colorShader.apply(); + this._colorShader.applyModel(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + this._colorShader.vMatrix = this.vMatrices[viewport]; + this._colorShader.pMatrix = this.pMatrices[viewport]; + this._colorShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLE_STRIP, this._controller.rayIndexCount, this._gl.UNSIGNED_SHORT, 0); + } } + } } -} - -},{"gl-matrix":"erHGu","../../../helpers/texture.js":"kVjwp","../../../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"43dVw":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { + } + let ImageVisual$1 = class ImageVisual { get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; + return this._isInitialized && this._main.textureShader.isInitialized; } get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._image; + } + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$4(); + this.isVisible = true; } initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - const shaderResources = this._main.shaderResources; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.isPickShader = false; - textureShader.apply(); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - textureShader.isPickShader = true; - textureShader.vMatrix = this.pickVMatrix; - textureShader.pMatrix = this.pickPMatrix; - textureShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); - } + if (this.isInitialized) { + const textureShader = this._main.textureShader; + const shaderResources = this._main.shaderResources; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.isPickShader = false; + textureShader.apply(); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + textureShader.isPickShader = true; + textureShader.vMatrix = this.pickVMatrix; + textureShader.pMatrix = this.pickPMatrix; + textureShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); } + } } -} - -},{"gl-matrix":"erHGu","../../../helpers/texture.js":"kVjwp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5z3WR":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { + }; + let LabelVisualBase$1 = class LabelVisualBase { get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; + } + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$4(); + this.mMatrix = create$4(); + this.isVisible = true; } initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - this._main.shaderResources.currentProgram = null; - } + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + this._main.shaderResources.currentProgram = null; + } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); - } - } + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._main.shaderResources.bindFramebuffer(this.framebuffers[viewport]); + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_INT, 0); + } } + } } -} -class LabelVisual extends LabelVisualBase { + }; + let LabelVisual$1 = class LabelVisual extends LabelVisualBase$1 { get label() { - return this._label; + return this._label; } - set text(value) { - this._label.text = value; + set text(value2) { + this._label.text = value2; } get text() { - return this._label.text; + return this._label.text; } - constructor(core, main, label){ - super(core, main, label); + constructor(core, main, label2) { + super(core, main, label2); } -} -class LabelSetVisual extends LabelVisualBase { + }; + let LabelSetVisual$1 = class LabelSetVisual extends LabelVisualBase$1 { get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fn1Fc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { + return this._label; + } + constructor(core, main, label2) { + super(core, main, label2); + } + }; + let FontVisual$1 = class FontVisual { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get font() { - return this._font; + return this._font; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } } update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"kVjwp","../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jU67t":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + }; + let Lasso$2 = class Lasso { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"../../../constants.js":"dHTsY","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lu1e0":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -var _mainJs = require("./main.js"); - -},{"./main.js":"gfDfg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gfDfg":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _rendererJs = require("../renderer.js"); -var _quadJs = require("./components/quad.js"); -var _bufferJs = require("./buffer.js"); -var _configJs = require("./config.js"); -var _shaderJs = require("./shaders/shader.js"); -var _textureJs = require("./shaders/texture.js"); -var _lassoJs = require("./shaders/lasso.js"); -var _sdftextJs = require("./shaders/sdftext.js"); -var _pickgridJs = require("./shaders/pickgrid.js"); -var _unitblockJs = require("./shaders/unitblock.js"); -var _unitsphereJs = require("./shaders/unitsphere.js"); -var _unitcylinderJs = require("./shaders/unitcylinder.js"); -var _unitsdfJs = require("./shaders/unitsdf.js"); -var _backgroundJs = require("./shaders/background.js"); -var _ssaoJs = require("./shaders/ssao.js"); -var _boxJs = require("./shaders/box.js"); -var _deferredJs = require("./shaders/deferred.js"); -var _combineJs = require("./shaders/combine.js"); -var _dofblurJs = require("./shaders/dofblur.js"); -var _downsampleJs = require("./shaders/downsample.js"); -var _gaussianJs = require("./shaders/gaussian.js"); -var _dofcombineJs = require("./shaders/dofcombine.js"); -var _fxaaJs = require("./shaders/fxaa.js"); -var _brightJs = require("./shaders/bright.js"); -var _angleJs = require("../../helpers/angle.js"); -var _pickJs = require("../../helpers/pick.js"); -var _cartesian2DJs = require("./components/axes/cartesian2d.js"); -var _cartesian3DJs = require("./components/axes/cartesian3d.js"); -var _fontJs = require("./font.js"); -var _mathJs = require("./../../helpers/math.js"); -var _constantsJs = require("../../constants.js"); -var _vertexJs = require("../../vertex.js"); -var _textureJs1 = require("../../helpers/texture.js"); -var _labelsJs = require("./components/labels.js"); -var _imageJs = require("./components/image.js"); -var _lassoJs1 = require("./components/lasso.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); + }; + var __awaiter$1 = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -}; -class Main extends (0, _rendererJs.RendererBase) { + }; + let Main$1 = class Main extends RendererBase { get shaderResources() { - return this._shaderResources; + return this._shaderResources; + } + get colorShader() { + return this._colorShader; } get textureShader() { - return this._textureShader; + return this._textureShader; } get lassoShader() { - return this._lassoShader; + return this._lassoShader; + } + get modelShader() { + return this._modelShader; } get sdfTextShader() { - return this._sdfTextShader; + return this._sdfTextShader; } get gridShader() { - return this._gridShader; + return this._gridShader; } get blockShader() { - return this._blockShader; + return this._blockShader; } get sphereShader() { - return this._sphereShader; + return this._sphereShader; } get cyclinderShader() { - return this._cylinderShader; + return this._cylinderShader; + } + get hexPrismShader() { + return this._hexPrismShader; } get sdfShader() { - return this._sdfShader; + return this._sdfShader; + } + get anaglyphShader() { + return this._anaglyphShader; } get currentAxes() { - return this._isAxes1Current ? this._axes1 : this._axes2; + return this._isAxes1Current ? this._axes1 : this._axes2; } - set currentAxes(value) { - if (this._isAxes1Current) this._axes1 = value; - else this._axes2 = value; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } get previousAxes() { - return this._isAxes1Current ? this._axes2 : this._axes1; + return this._isAxes1Current ? this._axes2 : this._axes1; } - set previousAxes(value) { - if (this._isAxes1Current) this._axes2 = value; - else this._axes1 = value; + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } get config() { - return this._config; - } - constructor(options){ - super(options); - this._config = new (0, _configJs.Config)(); - this._quad = new (0, _quadJs.Quad)(); - this._lasso = new (0, _lassoJs1.Lasso)(); - this._pickedPixels = new Uint8Array(4); - this._pickedIdColor = (0, _glMatrix.vec4).create(); - this._position = (0, _glMatrix.vec3).create(); - this._direction = (0, _glMatrix.vec3).create(); - this._cameraRotation = (0, _glMatrix.mat3).create(); - this._cameraPosition = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._modelManipulationOrigin = (0, _glMatrix.vec3).create(); - this._shadowVMatrix = (0, _glMatrix.mat4).create(); - this._shadowPMatrix = (0, _glMatrix.mat4).create(); + return this._config; + } + constructor(options) { + super(options); + this._config = new Config$1(); + this._quad = new Quad$1(); + this._lasso = new Lasso$2(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$2(); + this._mat3 = create$5(); + this._directionToCamera = create$3(); + this._directionToLight = create$3(); + this._halfAngle = create$3(); + this._cameraPosition = create$3(); + this._modelPosition = create$3(); + this.depthEnabled = true; } get isSupported() { - return this._createContext(document.createElement("canvas")) !== null; + return this._createContext(document.createElement("canvas")) !== null; + } + get isWebXRSupported() { + return true; } initialize(core) { - super.initialize(core); - this._shaderResources = new (0, _shaderJs.Resources)(); - this._textureShader = new (0, _textureJs.Texture)(core, this); - this._lassoShader = new (0, _lassoJs.Lasso)(core, this); - this._sdfTextShader = new (0, _sdftextJs.SdfText)(core, this); - this._gridShader = new (0, _pickgridJs.PickGrid)(core, this); - this._blockShader = new (0, _unitblockJs.UnitBlock)(core, this); - this._sphereShader = new (0, _unitsphereJs.UnitSphere)(core, this); - this._cylinderShader = new (0, _unitcylinderJs.UnitCylinder)(core, this); - this._sdfShader = new (0, _unitsdfJs.UnitSdf)(core, this); - this._backgroundShader = new (0, _backgroundJs.Background)(core, this); - this._ssaoShader = new (0, _ssaoJs.Ssao)(core, this); - this._boxShader = new (0, _boxJs.Box)(core, this); - this._deferredShader = new (0, _deferredJs.Deferred)(core, this); - this._combineShader = new (0, _combineJs.Combine)(core, this); - this._dofBlurShader = new (0, _dofblurJs.DofBlur)(core, this); - this._downsampleShader = new (0, _downsampleJs.Downsample)(core, this); - this._gaussianShader = new (0, _gaussianJs.Gaussian)(core, this); - this._dofCombineShader = new (0, _dofcombineJs.DofCombine)(core, this); - this._fxaaShader = new (0, _fxaaJs.Fxaa)(core, this); - this._brightPassShader = new (0, _brightJs.Bright)(core, this); + super.initialize(core); + this._shaderResources = new Resources$1(); + this._colorShader = new Color(this._core, this); + this._textureShader = new Texture$1(this._core, this); + this._lassoShader = new Lasso$3(this._core, this); + this._modelShader = new Model(this._core, this); + this._sdfTextShader = new SdfText$1(this._core, this); + this._gridShader = new PickGrid$1(this._core, this); + this._anaglyphShader = new Anaglyph(this._core, this); + this._blockShader = new UnitBlock$1(this._core, this); + this._sphereShader = new UnitSphere$1(this._core, this); + this._cylinderShader = new UnitCylinder$1(this._core, this); + this._hexPrismShader = new UnitHexPrism(this._core, this); + this._sdfShader = new UnitSdf$1(this._core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + this._isInitialized = false; + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { this._initializeContext(this._createContext(this._canvas)); - this._canvas.addEventListener("webglcontextlost", (event)=>{ - this._core.log.write((0, _mainJs.LogLevel).warn, "WebGL context lost"); - event.preventDefault(); - }, false); - this._canvas.addEventListener("webglcontextrestored", ()=>{ - this._initializeContext(this._createContext(this._canvas)); - this._core.log.write((0, _mainJs.LogLevel).info, "WebGL context restored"); - }, false); this._isInitialized = true; + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; + } + _initializeContext(gl) { + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._shaderResources.initializeContext(this._gl); + this._colorShader.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._modelShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._anaglyphShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._hexPrismShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._debugAxesVisual.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + this._anaglyphTextures = [null, null]; + this.anaglyphFramebuffers = [null, null]; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); + } + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); + } + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + for (let i = 0; i < this.controllers.length; i++) { + this.controllers[i].initializeContext(this._gl); + } } - _initializeContext(gl) { - this._gl = gl; - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(gl); - } - this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); - const random = new (0, _mathJs.PseudoRandom)(0); - const _vec3 = (0, _glMatrix.vec3).create(); - for(let i = 0; i < this._config.ssaoKernelSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - _vec3[2] = random.nextFloat(); - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - (0, _glMatrix.vec3).scale(_vec3, _vec3, random.nextFloat()); - let scale = i / this._config.ssaoKernelSize; - scale = (0, _mathJs.MathHelper).lerp(0.1, 1, scale * scale); - (0, _glMatrix.vec3).scale(_vec3, _vec3, scale); - this._ssaoSampleKernel[i * 3] = _vec3[0]; - this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; - this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; - } - const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); - _vec3[2] = 0; - for(let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++){ - _vec3[0] = random.nextFloat() * 2 - 1; - _vec3[1] = random.nextFloat() * 2 - 1; - (0, _glMatrix.vec3).normalize(_vec3, _vec3); - noise[i * 4] = _vec3[0]; - noise[i * 4 + 1] = _vec3[1]; - } - this._ssaoNoiseTexture = this._gl.createTexture(); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); - this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); - this._ssaoWidth = -1; - this._ssaoHeight = -1; - this._shadowWidth = -1; - this._shadowHeight = -1; - this._shaderResources.initializeContext(this._gl); - this._textureShader.initializeContext(this._gl); - this._lassoShader.initializeContext(this._gl); - this._sdfTextShader.initializeContext(this._gl); - this._gridShader.initializeContext(this._gl); - this._blockShader.initializeContext(this._gl); - this._sphereShader.initializeContext(this._gl); - this._cylinderShader.initializeContext(this._gl); - this._sdfShader.initializeContext(this._gl); - this._backgroundShader.initializeContext(this._gl); - this._ssaoShader.initializeContext(this._gl); - this._boxShader.initializeContext(this._gl); - this._deferredShader.initializeContext(this._gl); - this._combineShader.initializeContext(this._gl); - this._dofBlurShader.initializeContext(this._gl); - this._downsampleShader.initializeContext(this._gl); - this._gaussianShader.initializeContext(this._gl); - this._dofCombineShader.initializeContext(this._gl); - this._fxaaShader.initializeContext(this._gl); - this._brightPassShader.initializeContext(this._gl); - this._quad.initializeContext(this._gl); - this._lasso.initializeContext(this._gl); - this._framebuffers = [ - null, - null - ]; - const texture = (0, _textureJs1.TextureHelper).create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + _resize(width2, height2) { + super._resize(width2, height2); + for (let i = 0; i < 2; i++) { + const texture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); const renderBuffer = this._gl.createRenderbuffer(); this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT16, width2, height2); const framebuffer = this._gl.createFramebuffer(); this._shaderResources.bindFramebuffer(framebuffer); this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._pickFrameBuffer = framebuffer; - for(let i = 0; i < this.transitionBuffers.length; i++)this.transitionBuffers[i].initializeContext(this._gl); - if (this._axes1) for(let i = 0; i < this._axes1.length; i++)this._axes1[i].initializeContext(this._gl); - if (this._axes2) for(let i = 0; i < this._axes2.length; i++)this._axes2[i].initializeContext(this._gl); - for(let i = 0; i < this.labelSets.length; i++)this.labelSets[i].initializeContext(this._gl); - for(let i = 0; i < this.images.length; i++)this.images[i].initializeContext(this._gl); - } - _resize(width, height) { - super._resize(width, height); - this._positionTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); - this._colorTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._normalTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._geometryFrameBuffer = this._gl.createFramebuffer(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); - const renderBuffer = this._gl.createRenderbuffer(); - this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); - this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width, height); - this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); - this._gl.drawBuffers([ - this._gl.COLOR_ATTACHMENT0, - this._gl.COLOR_ATTACHMENT1, - this._gl.COLOR_ATTACHMENT2 - ]); - this._postProcessTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); - this._postProcessTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); - this._postProcessDofTexture = (0, _textureJs1.TextureHelper).create(this._gl, width, height, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); - this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); - const widthHalf = Math.round(width / 2); - const heightHalf = Math.round(height / 2); - this._postProcessHalfTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); - this._postProcessHalfTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - this._postProcessQuarterTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); - this._postProcessQuarterTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - this._postProcessEighthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); - this._postProcessEighthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); - const widthSixteenth = Math.round(widthEighth / 2); - const hgeightSixteenth = Math.round(heightEighth / 2); - this._postProcessSixteenthTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); - this._postProcessSixteenthTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); - this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); + this._anaglyphTextures[i] = texture; + this.anaglyphFramebuffers[i] = framebuffer; + } + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); } _createContext(canvas) { - let supported = false; - const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === undefined ? false : this._options.preserveDrawingBuffer : false; - const options = { - stencil: true, - alpha: false, - antialias: false, - preserveDrawingBuffer: preserveDrawingBuffer - }; - const gl = canvas.getContext("webgl2", options); - if (gl) { - const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); - if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { - const texture = (0, _textureJs1.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); - const framebuffer = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); - const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); - if (status == gl.FRAMEBUFFER_COMPLETE) supported = true; - gl.bindTexture(gl.TEXTURE_2D, null); - } - } - return supported ? gl : null; + const antialias = this._options ? this._options.antialias === void 0 ? true : this._options.antialias : true; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + return canvas.getContext("webgl", { + stencil: true, + alpha: true, + antialias, + preserveDrawingBuffer + }); } - prepare() { + initializeWebXR(session) { + const promise = new Promise((resolve2, reject) => { + this._gl.makeXRCompatible().then(() => { + session.updateRenderState({ + baseLayer: new XRWebGLLayer(session, this._gl), + depthNear: this._core.config.nearPlane, + depthFar: this._core.config.farPlane + }); + session.requestReferenceSpace("local").then((refSpace) => { + this._webXRReferenceSpace = refSpace; + resolve2(); + }); + }); + }); + return promise; + } + prepare(xrFrame) { + if (xrFrame) { + const pose = xrFrame.getViewerPose(this._webXRReferenceSpace); + if (pose) { + const glLayer = xrFrame.session.renderState.baseLayer; + for (let i = 0; i < pose.views.length; i++) { + const view = pose.views[i]; + this.vMatrices[i] = view.transform.inverse.matrix; + this.inverseVMatrices[i] = view.transform.matrix; + multiply$2(this._mvMatrices[i], this.vMatrices[i], this.mMatrix); + this.mvMatrices[i] = this._mvMatrices[i]; + this.pMatrices[i] = view.projectionMatrix; + const viewport = glLayer.getViewport(view); + this._viewports[i].x = viewport.x; + this._viewports[i].y = viewport.y; + this._viewports[i].width = viewport.width; + this._viewports[i].height = viewport.height; + this._framebuffers[i] = glLayer.framebuffer; + } + } + this._viewportOffset = 0; + this._viewportCount = 2; + } else { let viewport; - switch(this._core.config.stereoMode){ - case (0, _mainJs.StereoMode).none: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).left: - viewport = this._viewports[0]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 0; - this._viewportCount = 1; - break; - case (0, _mainJs.StereoMode).right: - viewport = this._viewports[1]; - viewport.x = 0; - viewport.y = 0; - viewport.width = this._canvas.width; - viewport.height = this._canvas.height; - this._viewportOffset = 1; - this._viewportCount = 1; - break; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + this._framebuffers[0] = null; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + this._framebuffers[1] = null; + break; + case StereoMode.anaglyph: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = this.anaglyphFramebuffers[0]; + this._framebuffers[1] = this.anaglyphFramebuffers[1]; + break; + case StereoMode.split: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + viewport = this._viewports[1]; + viewport.x = this._canvas.width / 2; + viewport.y = 0; + viewport.width = this._canvas.width / 2; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 2; + this._framebuffers[0] = null; + this._framebuffers[1] = null; + break; } + } } createTransitionBuffer(ids) { - const buffer = new (0, _bufferJs.TransitionBuffer)(this._core, ids); - buffer.initializeContext(this._gl); - return buffer; + const buffer = new TransitionBuffer$1(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createControllerVisual(controller) { + const visual = new ControllerVisual(this._core, this, controller); + visual.initializeContext(this._gl); + return visual; } createCartesian2dAxesVisual(axes) { - const visual = new (0, _cartesian2DJs.Cartesian2dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + const visual = new Cartesian2dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } createCartesian3dAxesVisual(axes) { - const visual = new (0, _cartesian3DJs.Cartesian3dVisual)(this._core, this, axes); - visual.initializeContext(this._gl); - return visual; + const visual = new Cartesian3dVisual$1(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; } - _createLabelVisual(label) { - return new (0, _labelsJs.LabelVisual)(this._core, this, label); + _createDebugAxesVisual(debugAxes) { + return new DebugAxesVisual(this._core, this, debugAxes); + } + _createLabelVisual(label2) { + return new LabelVisual$1(this._core, this, label2); } createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.initializeContext(this._gl); - return visual; + const visual = new LabelSetVisual$1(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - visual.initializeContext(this._gl); - return visual; + createImageVisual(image2) { + const visual = new ImageVisual$1(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - visual.initializeContext(this._gl); - return visual; + createFontVisual(font2) { + const visual = new FontVisual$1(this._core, font2); + visual.initializeContext(this._gl); + return visual; } getDataUrl(mimeType) { - return this._canvas.toDataURL(mimeType); + return this._canvas.toDataURL(mimeType); } - update(elapsedTime) { - super.update(elapsedTime); - if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { - this._shadowWidth = this._config.shadowWidth; - this._shadowHeight = this._config.shadowHeight; - this._shadowColorTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); - this._shadowDepthTexture = (0, _textureJs1.TextureHelper).create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); - this._shadowFrameBuffer = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); - } - if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { - this._ssaoWidth = this._config.ssaoWidth; - this._ssaoHeight = this._config.ssaoHeight; - this._ssaoTexture1 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); - this._ssaoTexture2 = (0, _textureJs1.TextureHelper).create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); - this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); - this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); - this._core.log.write((0, _mainJs.LogLevel).info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); - } - if (this._config.isDofEnabled && this._config.dofAutoFocus) { - this._core.getModelManipulationOrigin(this._modelManipulationOrigin); - this._core.getModelPosition(this._modelPosition); - (0, _glMatrix.vec3).add(this._position, this._modelManipulationOrigin, this._modelPosition); - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.vec3).subtract(this._position, this._position, this._cameraPosition); - const distance = -this._position[2]; - const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); - this._config.dofFocusDistance = (0, _mathJs.MathHelper).lerp(this._config.dofFocusDistance, distance, amount); + render(elapsedTime, xrFrame) { + return __awaiter$1(this, void 0, void 0, function* () { + if (this.depthEnabled) { + this._gl.enable(this._gl.DEPTH_TEST); + } else { + this._gl.disable(this._gl.DEPTH_TEST); } - } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - this._gl.enable(this._gl.DEPTH_TEST); - this._gl.enable(this._gl.CULL_FACE); - this._gl.cullFace(this._gl.BACK); - this._gl.disable(this._gl.BLEND); - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.clearColor(0, 0, 0, 0); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); - } - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; - this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); - if (this.config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.clear(this._gl.DEPTH_BUFFER_BIT); - (0, _glMatrix.mat4).perspective(this._shadowPMatrix, (0, _angleJs.AngleHelper).degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, this.inverseVMatrices[0]); - (0, _glMatrix.vec3).transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); - (0, _glMatrix.vec3).add(this._position, this._position, this._modelPosition); - (0, _glMatrix.mat4).lookAt(this._shadowVMatrix, this._position, this._modelPosition, (0, _constantsJs.Constants).VECTOR3_UNITY); - } - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) this._renderTransitionBuffer(transitionBuffer); - } - const axesVisuals = this.axesVisibility == (0, _mainJs.AxesVisibility).current ? this.currentAxes : this.axesVisibility == (0, _mainJs.AxesVisibility).previous ? this.previousAxes : null; - if (axesVisuals) for(let i = 0; i < axesVisuals.length; i++){ - const axesVisual = axesVisuals[i]; - if (axesVisual.isVisible) { - axesVisual.pickedIdColor = this._pickedIdColor; - axesVisual.pickFramebuffer = this._pickFrameBuffer; - axesVisual.geometryFramebuffer = this._geometryFrameBuffer; - axesVisual.render(elapsedTime); - } - } - if (this.areLabelsVisible) for(let i = 0; i < this.labelSets.length; i++){ - const labelSetVisual = this.labelSets[i]; - if (labelSetVisual.isVisible) { - labelSetVisual.pickedIdColor = this._pickedIdColor; - labelSetVisual.pickFramebuffer = this._pickFrameBuffer; - labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; - labelSetVisual.render(elapsedTime); - } - } - if (this.areImagesVisible) for(let i = 0; i < this.images.length; i++){ - const imageVisual = this.images[i]; - if (imageVisual.isVisible) { - imageVisual.geometryFramebuffer = this._geometryFrameBuffer; - imageVisual.render(elapsedTime); - } - } - if (this._backgroundShader.isInitialized) { - this._backgroundShader.prepare(); - this._backgroundShader.color = (0, _glMatrix.vec3).fromValues(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); - this._backgroundShader.apply(); - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - this._gl.bindVertexArray(null); - } - if (this.isPickingEnabled) { - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); - this._pickedType = (0, _pickJs.PickHelper).decodeType(this._pickedPixels); - (0, _glMatrix.vec4).set(this._pickedIdColor, this._pickedPixels[0] / 0xff, this._pickedPixels[1] / 0xff, this._pickedPixels[2] / 0xff, this._pickedPixels[3] / 0xff); - this._pickedId = (0, _pickJs.PickHelper).decodeNumber(this._pickedPixels); - } else { - (0, _glMatrix.vec4).set(this._pickedIdColor, 0, 0, 0, 0); - this._pickedId = 0; - } - if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { - const viewport = this._viewportOffset; - this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); - } - if (this.isLassoPicking && this._lassoShader.isInitialized) { - this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; - this._lassoShader.indexBuffer = this._lasso.indexBuffer; - const lassoWidth = this.lassoX1 - this.lassoX0; - const lassoHeight = this.lassoY1 - this.lassoY0; - this._lassoShader.prepare(); - this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; - this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; - this._lassoShader.apply(); - const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; - for(let i = 0; i < this._viewportCount; i++){ - const viewportIndex = i + this._viewportOffset; - this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); - const viewport = this._viewports[viewportIndex]; - this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; - this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; - this._lassoMMatrix[10] = 1; - this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; - this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; - this._lassoShader.mMatrix = this._lassoMMatrix; - (0, _glMatrix.vec2).set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); - this._lassoShader.thickness = this._lassoThickness; - this._lassoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - }); - } - _renderTransitionBuffer(transitionBuffer) { - const currentBuffer = transitionBuffer.currentBuffer; - const previousBuffer = transitionBuffer.previousBuffer; - const currentPalette = transitionBuffer.currentPalette; - const previousPalette = transitionBuffer.previousPalette; - const currentAtlas = transitionBuffer.currentAtlas; - const previousAtlas = transitionBuffer.previousAtlas; - const unitType = transitionBuffer.unitType === undefined ? currentBuffer.unitType : transitionBuffer.unitType; - const id = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; - const hoverId = id > -1 ? (0, _vertexJs.UnitVertex).getIdHover(currentBuffer.dataView, id) : -1; - const activeId = transitionBuffer.activeId; - if (this._blockShader.isInitialized && (unitType == (0, _mainJs.UnitType).block || unitType == (0, _mainJs.UnitType).blockSdf)) { - this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; - this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._blockShader.prepare(); - this._blockShader.mMatrix = this.mMatrix; - this._blockShader.time = this.transitionTime; - this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._blockShader.rangeMin = currentBuffer.from; - this._blockShader.rangeMax = currentBuffer.to; - this._blockShader.hover = hoverId; - this._blockShader.active = activeId; - this._blockShader.specularPower = this._config.specularPower; - this._blockShader.specularIntensity = this._config.specularIntensity; - this._blockShader.apply(); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._blockShader.vMatrix = this.vMatrices[viewport]; - this._blockShader.pMatrix = this.pMatrices[viewport]; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._blockShader.isPickShader = false; - this._blockShader.isShadowMap = true; - this._blockShader.vMatrix = this._shadowVMatrix; - this._blockShader.pMatrix = this._shadowPMatrix; - this._blockShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._blockShader.isPickShader = true; - this._blockShader.isShadowMap = false; - this._blockShader.pMatrix = this.pickPMatrix; - this._blockShader.vMatrix = this.pickVMatrix; - this._blockShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sphereShader.isInitialized && (unitType == (0, _mainJs.UnitType).sphere || unitType == (0, _mainJs.UnitType).sphereSdf)) { - this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sphereShader.prepare(); - this._sphereShader.mMatrix = this.mMatrix; - this._sphereShader.time = this.transitionTime; - this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sphereShader.rangeMin = currentBuffer.from; - this._sphereShader.rangeMax = currentBuffer.to; - this._sphereShader.hover = hoverId; - this._sphereShader.active = activeId; - this._sphereShader.specularPower = this._config.specularPower; - this._sphereShader.specularIntensity = this._config.specularIntensity; - this._sphereShader.apply(); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sphereShader.vMatrix = this.vMatrices[viewport]; - this._sphereShader.pMatrix = this.pMatrices[viewport]; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._sphereShader.isPickShader = false; - this._sphereShader.isShadowMap = true; - this._sphereShader.vMatrix = this._shadowVMatrix; - this._sphereShader.pMatrix = this._shadowPMatrix; - this._sphereShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._sphereShader.isPickShader = true; - this._sphereShader.isShadowMap = false; - this._sphereShader.pMatrix = this.pickPMatrix; - this._sphereShader.vMatrix = this.pickVMatrix; - this._sphereShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._cylinderShader.isInitialized && (unitType == (0, _mainJs.UnitType).cylinder || unitType == (0, _mainJs.UnitType).cylinderSdf)) { - this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; - this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._cylinderShader.prepare(); - this._cylinderShader.mMatrix = this.mMatrix; - this._cylinderShader.time = this.transitionTime; - this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._cylinderShader.rangeMin = currentBuffer.from; - this._cylinderShader.rangeMax = currentBuffer.to; - this._cylinderShader.hover = hoverId; - this._cylinderShader.active = activeId; - this._cylinderShader.specularPower = this._config.specularPower; - this._cylinderShader.specularIntensity = this._config.specularIntensity; - this._cylinderShader.apply(); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._cylinderShader.vMatrix = this.vMatrices[viewport]; - this._cylinderShader.pMatrix = this.pMatrices[viewport]; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._cylinderShader.isPickShader = false; - this._cylinderShader.isShadowMap = true; - this._cylinderShader.vMatrix = this._shadowVMatrix; - this._cylinderShader.pMatrix = this._shadowPMatrix; - this._cylinderShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - } - if (this.isPickingEnabled) { - this._cylinderShader.isPickShader = true; - this._cylinderShader.isShadowMap = false; - this._cylinderShader.pMatrix = this.pickPMatrix; - this._cylinderShader.vMatrix = this.pickVMatrix; - this._cylinderShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - } else if (this._sdfShader.isInitialized && unitType == (0, _mainJs.UnitType).sdf) { - this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; - this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; - this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; - this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; - this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; - this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; - this._sdfShader.prepare(); - this._sdfShader.mMatrix = this.mMatrix; - this._sdfShader.time = this.transitionTime; - this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); - this._sdfShader.rangeMin = currentBuffer.from; - this._sdfShader.rangeMax = currentBuffer.to; - this._sdfShader.hover = hoverId; - this._sdfShader.active = activeId; - this._sdfShader.specularPower = this._config.specularPower; - this._sdfShader.specularIntensity = this._config.specularIntensity; - this._sdfShader.apply(); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = false; - this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); - for(let i = 0; i < this._viewportCount; i++){ - const viewport = i + this._viewportOffset; - this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); - this._sdfShader.vMatrix = this.vMatrices[viewport]; - this._sdfShader.pMatrix = this.pMatrices[viewport]; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } - if (this._config.isShadowEnabled) { - this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); - this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); - this._gl.cullFace(this._gl.FRONT); - this._sdfShader.isPickShader = false; - this._sdfShader.isShadowMap = true; - this._sdfShader.vMatrix = this._shadowVMatrix; - this._sdfShader.pMatrix = this._shadowPMatrix; - this._sdfShader.applyView(); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - this._gl.colorMask(true, true, true, true); - this._gl.cullFace(this._gl.BACK); - } - if (this.isPickingEnabled) { - this._sdfShader.isPickShader = true; - this._sdfShader.isShadowMap = false; - this._sdfShader.pMatrix = this.pickPMatrix; - this._sdfShader.vMatrix = this.pickVMatrix; - this._sdfShader.applyView(); - this._shaderResources.bindFramebuffer(this._pickFrameBuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); - } + this._gl.enable(this._gl.CULL_FACE); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], backgroundColor[3]); + if (xrFrame) { + const glLayer = xrFrame.session.renderState.baseLayer; + this._shaderResources.bindFramebuffer(glLayer.framebuffer); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else if (this._core.config.stereoMode == StereoMode.anaglyph) { + for (let i = 0; i < 2; i++) { + this._shaderResources.bindFramebuffer(this.anaglyphFramebuffers[i]); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } else { + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); } - } - _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { - if (this._deferredShader.isInitialized) { - this._gl.disable(this._gl.DEPTH_TEST); - let ssaoTexture; - if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { - this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); - ssaoTexture = this._ssaoTexture1; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); - this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; - this._ssaoShader.indexBuffer = this._quad.indexBuffer; - this._ssaoShader.texture2D1 = this._positionTexture; - this._ssaoShader.texture2D2 = this._normalTexture; - this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; - this._ssaoShader.prepare(); - this._ssaoShader.pMatrix = pMatrix; - this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; - this._ssaoShader.ssaoRadius = this._config.ssaoRadius; - this._ssaoShader.ssaoPower = this._config.ssaoPower; - this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; - this._ssaoShader.left = 0; - this._ssaoShader.top = 0; - this._ssaoShader.width = this._config.ssaoWidth; - this._ssaoShader.height = this._config.ssaoHeight; - this._ssaoShader.apply(); - this._ssaoShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { - ssaoTexture = this._ssaoTexture2; - this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); - this._boxShader.vertexBuffer = this._quad.vertexBuffer; - this._boxShader.indexBuffer = this._quad.indexBuffer; - this._boxShader.texture2D = this._ssaoTexture1; - this._boxShader.prepare(); - this._boxShader.left = 0; - this._boxShader.top = 0; - this._boxShader.width = this._config.ssaoWidth; - this._boxShader.height = this._config.ssaoHeight; - this._boxShader.apply(); - this._boxShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); - let postProcessFrameBuffer = this._postProcessFrameBuffer1; - this._shaderResources.bindFramebuffer(postProcessFrameBuffer); - this._deferredShader.vertexBuffer = this._quad.vertexBuffer; - this._deferredShader.indexBuffer = this._quad.indexBuffer; - this._deferredShader.texture2D1 = this._positionTexture; - this._deferredShader.texture2D2 = this._colorTexture; - this._deferredShader.texture2D3 = this._normalTexture; - this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; - this._deferredShader.texture2D5 = this._shadowDepthTexture; - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); - this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); - this._deferredShader.prepare(); - this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; - this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; - this._deferredShader.inverseVMatrix = inverseVMatrix; - this._deferredShader.shadowVMatrix = this._shadowVMatrix; - this._deferredShader.shadowPMatrix = this._shadowPMatrix; - this._deferredShader.vMatrix = vMatrix; - this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; - this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; - this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; - this._core.camera.getPosition(this._cameraPosition); - (0, _glMatrix.mat3).fromMat4(this._cameraRotation, vMatrix); - (0, _glMatrix.vec3).set(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - (0, _glMatrix.vec3).normalize(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); - (0, _glMatrix.vec3).subtract(this._direction, this._cameraPosition, this._position); - (0, _glMatrix.vec3).normalize(this._direction, this._direction); - (0, _glMatrix.vec3).add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); - (0, _glMatrix.vec3).normalize(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); - (0, _glMatrix.vec3).copy(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); - this._deferredShader.left = viewport.left; - this._deferredShader.top = viewport.top; - this._deferredShader.width = viewport.width; - this._deferredShader.height = viewport.height; - this._deferredShader.shadowMapWidth = this._config.shadowWidth; - this._deferredShader.shadowMapHeight = this._config.shadowHeight; - this._deferredShader.ambientIntensity = this._config.ambientIntensity; - this._deferredShader.materialIntensity = this._config.materialIntensity; - this._deferredShader.specularPower = this._config.specularPower; - this._deferredShader.specularIntensity = this._config.specularIntensity; - this._deferredShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - const widthHalf = Math.round(viewport.width / 2); - const heightHalf = Math.round(viewport.height / 2); - const widthQuarter = Math.round(widthHalf / 2); - const heightQuarter = Math.round(heightHalf / 2); - const widthEighth = Math.round(widthQuarter / 2); - const heightEighth = Math.round(heightQuarter / 2); - const widthSixteenth = Math.round(widthEighth / 2); - const heightSixteenth = Math.round(heightEighth / 2); - if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); - this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; - this._dofBlurShader.indexBuffer = this._quad.indexBuffer; - this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofBlurShader.texture2D2 = this._positionTexture; - this._dofBlurShader.prepare(); - this._dofBlurShader.focusDepth = this._config.dofFocusDistance; - this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; - this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; - this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; - this._dofBlurShader.left = viewport.left; - this._dofBlurShader.top = viewport.top; - this._dofBlurShader.width = viewport.width; - this._dofBlurShader.height = viewport.height; - this._dofBlurShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; - this._dofCombineShader.indexBuffer = this._quad.indexBuffer; - this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._dofCombineShader.texture2D2 = this._postProcessDofTexture; - this._dofCombineShader.prepare(); - this._dofCombineShader.focusDepth = this._config.dofFocusDistance; - this._dofCombineShader.left = viewport.left; - this._dofCombineShader.top = viewport.top; - this._dofCombineShader.width = viewport.width; - this._dofCombineShader.height = viewport.height; - this._dofCombineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthHalf; - this._brightPassShader.height = heightHalf; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessHalfTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthQuarter; - this._brightPassShader.height = heightQuarter; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessQuarterTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthEighth; - this._brightPassShader.height = heightEighth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; - this._brightPassShader.indexBuffer = this._quad.indexBuffer; - this._brightPassShader.texture2D = this._postProcessEighthTexture1; - this._brightPassShader.prepare(); - this._brightPassShader.width = widthSixteenth; - this._brightPassShader.height = heightSixteenth; - this._brightPassShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessHalfTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthHalf; - this._gaussianShader.height = heightHalf; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessHalfTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessQuarterTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthQuarter; - this._gaussianShader.height = heightQuarter; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessQuarterTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessEighthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthEighth; - this._gaussianShader.height = heightEighth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessEighthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); - this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; - this._gaussianShader.indexBuffer = this._quad.indexBuffer; - this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; - this._gaussianShader.prepare(); - this._gaussianShader.width = widthSixteenth; - this._gaussianShader.height = heightSixteenth; - this._gaussianShader.horizontal = true; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); - this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; - this._gaussianShader.prepare(); - this._gaussianShader.horizontal = false; - this._gaussianShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._core.config.isDebugVisible) { + this._debugAxesVisual.framebuffers = this._framebuffers; + this._debugAxesVisual.render(elapsedTime, xrFrame); + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.framebuffers = this._framebuffers; + axesVisual.render(elapsedTime, xrFrame); } - if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { - postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); - this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; - this._fxaaShader.indexBuffer = this._quad.indexBuffer; - this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; - this._fxaaShader.prepare(); - this._fxaaShader.left = viewport.left; - this._fxaaShader.top = viewport.top; - this._fxaaShader.width = viewport.width; - this._fxaaShader.height = viewport.height; - this._fxaaShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(xrFrame, transitionBuffer); + } + } + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.framebuffers = this._framebuffers; + labelSetVisual.render(elapsedTime, xrFrame); } - this._shaderResources.bindFramebuffer(null); - this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + } + } + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.framebuffers = this._framebuffers; + imageVisual.pickFramebuffer = this._pickFrameBuffer; + imageVisual.isPickingEnabled = this.isPickingEnabled; + imageVisual.render(elapsedTime, xrFrame); + } + } + } + for (let i = 0; i < this.controllers.length; i++) { + const controllerVisual = this.controllers[i]; + if (controllerVisual.isVisible) { + controllerVisual.isRayVisible = this.isPickingEnabled; + controllerVisual.framebuffers = this._framebuffers; + controllerVisual.render(elapsedTime, xrFrame); + } + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$2(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + if (this._isCapturingPickImage && this.capturePickImageCallback) { + this._isCapturingPickImage = false; + const data2 = new Uint8ClampedArray(this._core.config.pickWidth * this._core.config.pickHeight * 4); + this._gl.readPixels(0, 0, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, data2); + for (let i = 0; i < data2.length / 4; i++) { + if (data2[i * 4 + 3] == PickType.data) { + data2[i * 4 + 3] = 255; + } else { + data2[i * 4] = 0; + data2[i * 4 + 1] = 0; + data2[i * 4 + 2] = 0; + data2[i * 4 + 3] = 0; + } + } + const length2 = this._core.config.pickWidth * this._core.config.pickHeight * 4; + const row = this._core.config.pickWidth * 4; + const end = (this._core.config.pickHeight - 1) * row; + const flipped = new Uint8ClampedArray(length2); + for (let i = 0; i < length2; i += row) { + flipped.set(data2.subarray(i, i + row), end - i); + } + this.capturePickImageCallback(flipped, this._core.config.pickWidth, this._core.config.pickHeight); + } + } else { + set$2(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); - this._combineShader.vertexBuffer = this._quad.vertexBuffer; - this._combineShader.indexBuffer = this._quad.indexBuffer; - this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; - if (this._config.isBloomEnabled) { - this._combineShader.texture2D2 = this._postProcessHalfTexture1; - this._combineShader.texture2D3 = this._postProcessQuarterTexture1; - this._combineShader.texture2D4 = this._postProcessEighthTexture1; - this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; - } else { - this._combineShader.texture2D2 = null; - this._combineShader.texture2D3 = null; - this._combineShader.texture2D4 = null; - this._combineShader.texture2D5 = null; - } - this._combineShader.prepare(); - this._combineShader.viewport = viewport; - this._combineShader.intensity = this._config.bloomIntensity; - this._combineShader.apply(); - this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + if (this._core.config.stereoMode == StereoMode.anaglyph && this._anaglyphShader.isInitialized && this._quad.isInitialized) { + this._shaderResources.bindFramebuffer(null); + this._gl.viewport(this._viewports[0].x, this._viewports[0].y, this._viewports[0].width, this._viewports[0].height); + this._anaglyphShader.vertexBuffer = this._quad.vertexBuffer; + this._anaglyphShader.indexBuffer = this._quad.indexBuffer; + this._anaglyphShader.texture2D1 = this._anaglyphTextures[0]; + this._anaglyphShader.texture2D2 = this._anaglyphTextures[1]; + this._anaglyphShader.prepare(); + this._anaglyphShader.viewport = this._viewports[0]; + this._anaglyphShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + }); + } + _renderTransitionBuffer(xrFrame, transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf || unitType == UnitType.ringSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = 0; + this._blockShader.rangeMax = transitionBuffer.length - 1; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.selectedColor = this._core.config.selectionColor; + this._blockShader.hoverColor = this._core.config.hoverColor; + this._blockShader.activeColor = this._core.config.activeColor; + this._blockShader.highlightMode = this._core.config.highlightMode; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.ambient = this._config.ambient; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._blockShader.directionToLight = this._directionToLight; + this._blockShader.halfAngle = this._halfAngle; + } else { + this._blockShader.directionToLight = this._config.directionToLight; + this._blockShader.halfAngle = this._config.halfAngle; + } + this._blockShader.vMatrix = vMatrix; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf || unitType == UnitType.disk)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = 0; + this._sphereShader.rangeMax = transitionBuffer.length - 1; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.selectedColor = this._core.config.selectionColor; + this._sphereShader.hoverColor = this._core.config.hoverColor; + this._sphereShader.activeColor = this._core.config.activeColor; + this._sphereShader.highlightMode = this._core.config.highlightMode; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.ambient = this._config.ambient; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sphereShader.directionToLight = this._directionToLight; + this._sphereShader.halfAngle = this._halfAngle; + } else { + this._sphereShader.directionToLight = this._config.directionToLight; + this._sphereShader.halfAngle = this._config.halfAngle; + } + this._sphereShader.vMatrix = vMatrix; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = 0; + this._cylinderShader.rangeMax = transitionBuffer.length - 1; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.selectedColor = this._core.config.selectionColor; + this._cylinderShader.hoverColor = this._core.config.hoverColor; + this._cylinderShader.activeColor = this._core.config.activeColor; + this._cylinderShader.highlightMode = this._core.config.highlightMode; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.ambient = this._config.ambient; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._cylinderShader.directionToLight = this._directionToLight; + this._cylinderShader.halfAngle = this._halfAngle; + } else { + this._cylinderShader.directionToLight = this._config.directionToLight; + this._cylinderShader.halfAngle = this._config.halfAngle; + } + this._cylinderShader.vMatrix = vMatrix; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._hexPrismShader.isInitialized && (unitType == UnitType.hexPrism || unitType == UnitType.hexPrismSdf)) { + this._hexPrismShader.instanceBuffer = currentBuffer.vertexBuffer; + this._hexPrismShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._hexPrismShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._hexPrismShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._hexPrismShader.prepare(); + this._hexPrismShader.mMatrix = this.mMatrix; + this._hexPrismShader.time = this.transitionTime; + this._hexPrismShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._hexPrismShader.rangeMin = 0; + this._hexPrismShader.rangeMax = transitionBuffer.length - 1; + this._hexPrismShader.hover = hoverId; + this._hexPrismShader.active = activeId; + this._hexPrismShader.selectedColor = this._core.config.selectionColor; + this._hexPrismShader.hoverColor = this._core.config.hoverColor; + this._hexPrismShader.activeColor = this._core.config.activeColor; + this._hexPrismShader.highlightMode = this._core.config.highlightMode; + this._hexPrismShader.specularPower = this._config.specularPower; + this._hexPrismShader.specularIntensity = this._config.specularIntensity; + this._hexPrismShader.ambient = this._config.ambient; + this._hexPrismShader.apply(); + this._hexPrismShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._hexPrismShader.directionToLight = this._directionToLight; + this._hexPrismShader.halfAngle = this._halfAngle; + } else { + this._hexPrismShader.directionToLight = this._config.directionToLight; + this._hexPrismShader.halfAngle = this._config.halfAngle; + } + this._hexPrismShader.vMatrix = vMatrix; + this._hexPrismShader.pMatrix = this.pMatrices[viewport]; + this._hexPrismShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._hexPrismShader.isPickShader = true; + this._hexPrismShader.pMatrix = this.pickPMatrix; + this._hexPrismShader.vMatrix = this.pickVMatrix; + this._hexPrismShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._hexPrismShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = 0; + this._sdfShader.rangeMax = transitionBuffer.length - 1; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.selectedColor = this._core.config.selectionColor; + this._sdfShader.hoverColor = this._core.config.hoverColor; + this._sdfShader.activeColor = this._core.config.activeColor; + this._sdfShader.highlightMode = this._core.config.highlightMode; + this._sdfShader.sdfBuffer = (this.sdfBuffer || this._core.config.sdfBuffer) / 255; + this._sdfShader.sdfBackgroundColor = this.sdfBackgroundColor || fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.ambient = this._config.ambient; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewport]); + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + const vMatrix = this.vMatrices[viewport]; + if (xrFrame) { + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + subtract(this._directionToLight, this._config.lightPosition, this._modelPosition); + normalize$2(this._directionToLight, this._directionToLight); + const inverseVMatrix = this.inverseVMatrices[viewport]; + set$3(this._cameraPosition, inverseVMatrix[12], inverseVMatrix[13], inverseVMatrix[14]); + subtract(this._directionToCamera, this._cameraPosition, this._modelPosition); + normalize$2(this._directionToCamera, this._directionToCamera); + add(this._halfAngle, this._directionToLight, this._directionToCamera); + normalize$2(this._halfAngle, this._halfAngle); + fromMat4(this._mat3, vMatrix); + transformMat3(this._directionToLight, this._directionToLight, this._mat3); + transformMat3(this._halfAngle, this._halfAngle, this._mat3); + this._sdfShader.directionToLight = this._directionToLight; + this._sdfShader.halfAngle = this._halfAngle; + } else { + this._sdfShader.directionToLight = this._config.directionToLight; + this._sdfShader.halfAngle = this._config.halfAngle; + } + this._sdfShader.vMatrix = vMatrix; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this.isPickingEnabled && transitionBuffer.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._shaderResources.ANGLE_instanced_arrays.drawElementsInstancedANGLE(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } + } } -} - -},{"gl-matrix":"erHGu","../../main.js":"b6Xbk","../renderer.js":"as6Zc","./components/quad.js":"jnURY","./buffer.js":"ehf4a","./config.js":"cAS6R","./shaders/shader.js":"67Z4f","./shaders/texture.js":"gN1DJ","./shaders/lasso.js":"9ZGAb","./shaders/sdftext.js":"eGxSt","./shaders/pickgrid.js":"cWCAC","./shaders/unitblock.js":"4WGJz","./shaders/unitsphere.js":"3msJ8","./shaders/unitcylinder.js":"fTtgI","./shaders/unitsdf.js":"kAjIu","./shaders/background.js":"6itVY","./shaders/ssao.js":"ju7sc","./shaders/box.js":"3yIW6","./shaders/deferred.js":"dbxlx","./shaders/combine.js":"d4boX","./shaders/dofblur.js":"c0jpv","./shaders/downsample.js":"3sWXu","./shaders/gaussian.js":"g5wih","./shaders/dofcombine.js":"dE6Xe","./shaders/fxaa.js":"7EIbd","./shaders/bright.js":"3CyrI","../../helpers/angle.js":"hBXkO","../../helpers/pick.js":"fOypM","./components/axes/cartesian2d.js":"diZyK","./components/axes/cartesian3d.js":"24qTq","./font.js":"IvK0g","./../../helpers/math.js":"6Lv1i","../../constants.js":"dHTsY","../../vertex.js":"8lW8V","../../helpers/texture.js":"kVjwp","./components/labels.js":"bPD4j","./components/image.js":"7hNgE","./components/lasso.js":"7afcI","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jnURY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Quad", ()=>Quad); -var _glMatrix = require("gl-matrix"); -var _quadJs = require("../../../meshes/quad.js"); -class Quad { + }; + class Quad { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } get indexCount() { - return this._indexCount; + return this._indexCount; } initializeContext(gl) { - const _vec3 = (0, _glMatrix.vec3).fromValues(2, 2, 2); - const _mat4 = (0, _glMatrix.mat4).create(); - (0, _glMatrix.mat4).fromScaling(_mat4, _vec3); - const vertices = (0, _quadJs.Quad).positions(_mat4); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; + const _vec3 = fromValues$3(2, 2, 2); + const _mat4 = create$4(); + fromScaling(_mat4, _vec3); + const vertices = Quad$2.positions(_mat4); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } -} - -},{"gl-matrix":"erHGu","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ehf4a":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _bufferJs = require("../../buffer.js"); -var _mainJs = require("../../main.js"); -var _atlasJs = require("./atlas.js"); -var _paletteJs = require("./palette.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - get vertexBuffer() { - return this._vertexBuffer; + } + class Atlas extends AtlasBase { + get texture() { + return this._texture; } - constructor(core, ids){ - super(core, ids); + get defaultTexture() { + return this._defaultTexture; } - initializeContext(gl) { - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); - this._isInitialized = true; + initializeContext(core, gl) { + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([255, 255, 255, 255])); + this._updateTexture(); } update() { - if (this._isInitialized) { - const start = window.performance.now(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - constructor(core, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } - initializeContext(gl) { - this._buffer1.initializeContext(gl); - this._buffer2.initializeContext(gl); - this._palette1.initializeContext(this._core, gl); - this._palette2.initializeContext(this._core, gl); - this._atlas1.initializeContext(this._core, gl); - this._atlas2.initializeContext(this._core, gl); - this._isInitialized = true; + _updateTexture() { + if (this._imageData) { + this._texture = TextureHelper.fromImage(this._gl, this._imageData, false, this._gl.LINEAR); + } else { + this._texture = null; + } } -} - -},{"../../buffer.js":"8oaJi","../../main.js":"b6Xbk","./atlas.js":"6e5ov","./palette.js":"bgpEk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6e5ov":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Atlas", ()=>Atlas); -var _textureJs = require("../../helpers/texture.js"); -var _atlasJs = require("../../atlas.js"); -class Atlas extends (0, _atlasJs.AtlasBase) { + } + class Palette extends PaletteBase { get texture() { - return this._texture; + return this._texture; } get defaultTexture() { - return this._defaultTexture; + return this._defaultTexture; } initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, new Uint8Array([ - 0xff, - 0xff, - 0xff, - 0xff - ])); - this._updateTexture(); + this._gl = gl; + this._defaultTexture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); + this._updateTexture(); } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + super.update(); + if (this._changed) { + this._changed = false; + this._updateTexture(); + } } _updateTexture() { - if (this._imageData) this._texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._imageData, false, this._gl.LINEAR); - else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../atlas.js":"huG9l","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bgpEk":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Palette", ()=>Palette); -var _textureJs = require("../../helpers/texture.js"); -var _paletteJs = require("../../palette.js"); -class Palette extends (0, _paletteJs.PaletteBase) { - get texture() { - return this._texture; + if (this._colors) { + const colors2 = new Uint8Array(this._colors); + for (let i = 0; i < colors2.length; i++) { + colors2[i] = Math.pow(colors2[i] / 255, 2.2) * 255; + } + this._texture = TextureHelper.create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors2); + } else { + this._texture = null; + } } - get defaultTexture() { - return this._defaultTexture; + } + let Buffer$1 = class Buffer extends BufferBase { + get vertexBuffer() { + return this._vertexBuffer; } - initializeContext(core, gl) { - this._gl = gl; - this._defaultTexture = (0, _textureJs.TextureHelper).create(gl, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, gl.NEAREST, core.config.paletteColor); - this._updateTexture(); + constructor(core, ids) { + super(core, ids); + } + initializeContext(gl) { + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.STATIC_DRAW); + this._isInitialized = true; } update() { - super.update(); - if (this._changed) { - this._changed = false; - this._updateTexture(); - } + if (this._isInitialized) { + const start = window.performance.now(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._vertices); + this._core.log.write(LogLevel.info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); + } } - _updateTexture() { - if (this._colors) { - const colors = new Uint8Array(this._colors); - for(let i = 0; i < colors.length; i++)colors[i] = Math.pow(colors[i] / 0xff, 2.2) * 0xff; - this._texture = (0, _textureJs.TextureHelper).create(this._gl, this._colors.length / 4, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.NEAREST, colors); - } else this._texture = null; - } -} - -},{"../../helpers/texture.js":"kVjwp","../../palette.js":"a14oj","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cAS6R":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _rendererJs = require("../renderer.js"); -class Config extends (0, _rendererJs.RendererConfig) { + }; + class TransitionBuffer extends TransitionBufferBase { + constructor(core, ids) { + super(core, ids, Buffer$1, Palette, Atlas); + } + initializeContext(gl) { + this._buffer1.initializeContext(gl); + this._buffer2.initializeContext(gl); + this._palette1.initializeContext(this._core, gl); + this._palette2.initializeContext(this._core, gl); + this._atlas1.initializeContext(this._core, gl); + this._atlas2.initializeContext(this._core, gl); + this._isInitialized = true; + } + } + class Config extends RendererConfig { get keyLightAltitude() { - return this._keyLightAltitude; + return this._keyLightAltitude; } - set keyLightAltitude(value) { - this._keyLightAltitude = value; - this._updateLights(); + set keyLightAltitude(value2) { + this._keyLightAltitude = value2; + this._updateLights(); } get keyLightAzimuth() { - return this._keyLightAzimuth; + return this._keyLightAzimuth; } - set keyLightAzimuth(value) { - this._keyLightAzimuth = value; - this._updateLights(); + set keyLightAzimuth(value2) { + this._keyLightAzimuth = value2; + this._updateLights(); } get keyLightDistance() { - return this._keyLightDistance; + return this._keyLightDistance; } - set keyLightDistance(value) { - this._keyLightDistance = value; - this._updateLights(); + set keyLightDistance(value2) { + this._keyLightDistance = value2; + this._updateLights(); } get fillLight1Altitude() { - return this._fillLight1Altitude; + return this._fillLight1Altitude; } - set fillLight1Altitude(value) { - this._fillLight1Altitude = value; - this._updateLights(); + set fillLight1Altitude(value2) { + this._fillLight1Altitude = value2; + this._updateLights(); } get fillLight1Azimuth() { - return this._fillLight1Azimuth; + return this._fillLight1Azimuth; } - set fillLight1Azimuth(value) { - this._fillLight1Azimuth = value; - this._updateLights(); + set fillLight1Azimuth(value2) { + this._fillLight1Azimuth = value2; + this._updateLights(); } get fillLight2Altitude() { - return this._fillLight2Altitude; + return this._fillLight2Altitude; } - set fillLight2Altitude(value) { - this._fillLight2Altitude = value; - this._updateLights(); + set fillLight2Altitude(value2) { + this._fillLight2Altitude = value2; + this._updateLights(); } get fillLight2Azimuth() { - return this._fillLight2Azimuth; + return this._fillLight2Azimuth; } - set fillLight2Azimuth(value) { - this._fillLight2Azimuth = value; - this._updateLights(); + set fillLight2Azimuth(value2) { + this._fillLight2Azimuth = value2; + this._updateLights(); } - constructor(){ - super(); - this._rotation = (0, _glMatrix.quat).create(); - this.keyLightPosition = (0, _glMatrix.vec3).create(); - this.fillLight1Position = (0, _glMatrix.vec3).create(); - this.fillLight2Position = (0, _glMatrix.vec3).create(); - this.reset(); + constructor() { + super(); + this._rotation = create$1(); + this.keyLightPosition = create$3(); + this.fillLight1Position = create$3(); + this.fillLight2Position = create$3(); + this.reset(); } _updateLights() { - this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); - this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); - this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); + this._updateLight(this._keyLightAltitude, this._keyLightAzimuth, this._keyLightDistance, this.keyLightPosition); + this._updateLight(this._fillLight1Altitude, this._fillLight1Azimuth, 1, this.fillLight1Position); + this._updateLight(this._fillLight2Altitude, this._fillLight2Azimuth, 1, this.fillLight2Position); } - _updateLight(altitude, azimuth, distance, position) { - (0, _glMatrix.quat).rotateY(this._rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, (0, _angleJs.AngleHelper).degreesToRadians(azimuth)); - (0, _glMatrix.quat).rotateX(this._rotation, this._rotation, (0, _angleJs.AngleHelper).degreesToRadians(-altitude)); - (0, _glMatrix.vec3).transformQuat(position, (0, _constantsJs.Constants).VECTOR3_UNITZ, this._rotation); - (0, _glMatrix.vec3).scale(position, position, distance); + _updateLight(altitude, azimuth, distance2, position2) { + rotateY(this._rotation, Constants.QUAT_IDENTITY, AngleHelper.degreesToRadians(azimuth)); + rotateX(this._rotation, this._rotation, AngleHelper.degreesToRadians(-altitude)); + transformQuat(position2, Constants.VECTOR3_UNITZ, this._rotation); + scale(position2, position2, distance2); } reset() { - this.isSsaoEnabled = true; - this.ssaoWidth = 1024; - this.ssaoHeight = 1024; - this.ssaoBlurEnabled = true; - this.ssaoKernelSize = 8; - this.ssaoNoiseSize = 4; - this.ssaoRadius = 0.02; - this.ssaoPower = 1; - this.isShadowEnabled = true; - this.shadowWidth = 1024; - this.shadowHeight = 1024; - this.isDofEnabled = false; - this.dofAutoFocus = true; - this.dofFocusDistance = 0.5; - this.dofFocusRange = 0.5; - this.dofMaxBackgroundBlur = 0.75; - this.isBloomEnabled = false; - this.bloomIntensity = 2; - this.specularIntensity = 0.15; - this.specularPower = 150; - this.ambientIntensity = 0.1; - this.materialIntensity = 0.5; - this.keyLightIntensity = 1.5; - this.fillLight1Intensity = 0.25; - this.fillLight2Intensity = 0.25; - this._keyLightAltitude = 30; - this._keyLightAzimuth = -45; - this._keyLightDistance = 1; - this._fillLight1Altitude = 30; - this._fillLight1Azimuth = 45; - this._fillLight2Altitude = 30; - this._fillLight2Azimuth = -135; - this._updateLights(); - this.isFxaaEnabled = false; - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../helpers/angle.js":"hBXkO","../renderer.js":"as6Zc","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"67Z4f":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Resources", ()=>Resources); -parcelHelpers.export(exports, "ShaderBase", ()=>ShaderBase); -var _pathJs = require("../../../helpers/path.js"); -var _mainJs = require("../../../main.js"); -class Resources { + this.isSsaoEnabled = true; + this.ssaoWidth = 1024; + this.ssaoHeight = 1024; + this.ssaoBlurEnabled = true; + this.ssaoKernelSize = 8; + this.ssaoNoiseSize = 4; + this.ssaoRadius = 0.02; + this.ssaoPower = 1; + this.isShadowEnabled = true; + this.shadowWidth = 1024; + this.shadowHeight = 1024; + this.isDofEnabled = false; + this.dofAutoFocus = true; + this.dofFocusDistance = 0.5; + this.dofFocusRange = 0.5; + this.dofMaxBackgroundBlur = 0.75; + this.isBloomEnabled = false; + this.bloomIntensity = 2; + this.specularIntensity = 0.15; + this.specularPower = 150; + this.ambientIntensity = 0.1; + this.materialIntensity = 0.5; + this.keyLightIntensity = 1.5; + this.fillLight1Intensity = 0.25; + this.fillLight2Intensity = 0.25; + this._keyLightAltitude = 30; + this._keyLightAzimuth = -45; + this._keyLightDistance = 1; + this._fillLight1Altitude = 30; + this._fillLight1Azimuth = 45; + this._fillLight2Altitude = 30; + this._fillLight2Azimuth = -135; + this._updateLights(); + this.isFxaaEnabled = false; + } + } + class Resources { bindFramebuffer(framebuffer) { - if (this.framebuffer != framebuffer) { - this.framebuffer = framebuffer; - this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); - } + if (this.framebuffer != framebuffer) { + this.framebuffer = framebuffer; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer); + } } initializeContext(gl) { - this._gl = gl; - this.framebuffer = this._gl.createFramebuffer(); - this.OES_texture_float = gl.getExtension("OES_texture_float"); - this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); - this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); - } -} -Resources.glsl = { - "background.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n", + this._gl = gl; + this.framebuffer = this._gl.createFramebuffer(); + this.OES_texture_float = gl.getExtension("OES_texture_float"); + this.OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + this.WEBGL_lose_context = gl.getExtension("WEBGL_lose_context"); + } + } + Resources.glsl = { + "background.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\ngl_FragDepth = 0.99999;\nmyPosition = vec4(0.0, 0.0, -FAR_PLANE, 0.0);\nmyColor = vec4(uColor, 1.0);\nmyNormal = vec4(0.0, 0.0, 1.0, 0.0);\n}\n', "box.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform sampler2D uSampler;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nfloat result = 0.0;\nfor (int x = -2; x < 2; x++)\n{\nfor (int y = -2; y < 2; y++)\n{\nvec2 offset = vec2(float(x) + 0.5, float(y) + 0.5) * texelSize;\nresult += texture(uSampler, texCoords + offset).r;\n}\n}\nresult /= 16.0;\nmyOutputColor = vec4(vec3(result), 1.0);\n}\n", "bright.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec4 color = texture(uSampler, texCoords);\nmyOutputColor = vec4(color.rgb * color.a, 1.0);\n}\n", "combine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform float uIntensity;\nout vec4 myOutputColor;\nvoid main() {\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 bloom =\ntexture(uSampler2, texCoords).rgb +\ntexture(uSampler3, texCoords).rgb +\ntexture(uSampler4, texCoords).rgb +\ntexture(uSampler5, texCoords).rgb;\nbloom *= uIntensity;\nvec3 color = texture(uSampler1, texCoords).rgb;\ncolor += bloom;\nmyOutputColor = vec4(color, 1.0);\n}\n", - "deferred.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n", + "deferred.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform mat4 uInverseVMatrix;\nuniform mat4 uShadowVMatrix;\nuniform mat4 uShadowPMatrix;\nuniform bool uShadow;\nuniform bool uSsao;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform sampler2D uSampler4;\nuniform sampler2D uSampler5;\nuniform vec4 uViewport;\nuniform vec3 uKeyLightHalfAngle;\nuniform vec3 uDirectionToKeyLight;\nuniform vec3 uDirectionToFillLight1;\nuniform vec3 uDirectionToFillLight2;\nuniform vec2 uShadowMapSize;\nuniform float uKeyLightIntensity;\nuniform float uFillLight1Intensity;\nuniform float uFillLight2Intensity;\nuniform float uSpecularPower;\nuniform float uSpecularIntensity;\nuniform float uAmbientIntensity;\nuniform float uMaterialIntensity;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec4 position = texture(uSampler1, texCoords);\nvec4 color = texture(uSampler2, texCoords);\nvec4 normal = texture(uSampler3, texCoords);\nfloat shadow;\nif (uShadow)\n{\nvec4 positionWorld = uInverseVMatrix * vec4(position.xyz, 1.0);\nvec4 positionShadowView = uShadowVMatrix * positionWorld;\nvec4 positionShadowViewProjection = uShadowPMatrix * positionShadowView;\nvec3 projCoords = positionShadowViewProjection.xyz / positionShadowViewProjection.w;\nprojCoords = projCoords * 0.5 + 0.5;\nfloat minProjCoords = min(projCoords.x, projCoords.y);\nfloat maxProjCoords = max(projCoords.x, projCoords.y);\nif (minProjCoords < 0.0 || maxProjCoords > 1.0)\n{\nshadow = 1.0;\n}\nelse\n{\nfloat currentDepth = projCoords.z;\nfloat bias = 0.0;\nvec2 texelSize = 1.0 / uShadowMapSize;\nfor(int x = -1; x <= 1; ++x)\n{\nfor(int y = -1; y <= 1; ++y)\n{\nfloat pcfDepth = texture(uSampler5, projCoords.xy + vec2(x, y) * texelSize).r;\nshadow += currentDepth - bias > pcfDepth ? 1.0 : 0.0;\n}\n}\nshadow /= 9.0;\nshadow = clamp(1.0 - shadow, 0.0, 1.0);\n}\n}\nelse\n{\nshadow = 1.0;\n}\nfloat ssao = uSsao ? texture(uSampler4, texCoords).r : 1.0;\nfloat diffuseIntensity = clamp(dot(normal.rgb, uDirectionToKeyLight), 0.0, 1.0) * uKeyLightIntensity * shadow;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight1), 0.0, 1.0) * uFillLight1Intensity * ssao;\ndiffuseIntensity += clamp(dot(normal.rgb, uDirectionToFillLight2), 0.0, 1.0) * uFillLight2Intensity * ssao;\nvec3 diffuse = color.rgb * diffuseIntensity * uMaterialIntensity;\nvec3 ambient = uAmbientIntensity * color.rgb * ssao;\nvec3 emissive = color.w * color.rgb;\nfloat specular = normal.w * clamp(pow(clamp(dot(normal.rgb, uKeyLightHalfAngle), 0.0, 1.0), uSpecularPower) * uSpecularIntensity * uKeyLightIntensity * shadow, 0.0, 1.0);\nvec3 result = min(ambient + diffuse + specular + emissive, 1.0);\nresult = pow(result, GAMMA);\nmyOutputColor = vec4(result, position.w);\n}\n', "dofblur.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uNearFocusDepth;\nuniform float uFarFocusDepth;\nuniform float uMaxBackgroundBlur;\nout vec4 myOutputColor;\nfloat circleOfConfusion(in float depth )\n{\nfloat f;\nif (depth < uFocusDepth)\n{\nf = (depth - uFocusDepth) / (uFocusDepth - uNearFocusDepth);\nf = clamp(f, -1.0, 0.0);\n}\nelse\n{\nf = (depth - uFocusDepth) / (uFarFocusDepth - uFocusDepth);\nf = clamp(f, 0.0, uMaxBackgroundBlur);\n}\nreturn f * 0.5 + 0.5;\n}\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nvec4 color = texture(uSampler1, texCoords);\nfloat depth = -texture(uSampler2, texCoords).z;\nfloat coc = circleOfConfusion(depth);\nmyOutputColor = vec4(coc);\n}\n", "dofcombine.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform vec4 uViewport;\nuniform float uFocusDepth;\nuniform float uAperture;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nout vec4 myOutputColor;\nconst float MAX_CIRCLE_OF_CONFUSION = 3.0;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec2 texelSizeLow = texelSize * 4.0;\nconst int NUM_TAPS = 13;\nvec2 samples[NUM_TAPS];\nsamples[0] = vec2(-0.326212,-0.405810);\nsamples[1] = vec2(-0.840144,-0.073580);\nsamples[2] = vec2(-0.695914, 0.457137);\nsamples[3] = vec2(-0.203345, 0.620716);\nsamples[4] = vec2( 0.962340,-0.194983);\nsamples[5] = vec2( 0.473434,-0.480026);\nsamples[6] = vec2( 0.519456, 0.767022);\nsamples[7] = vec2( 0.185461,-0.893124);\nsamples[8] = vec2( 0.507431, 0.064425);\nsamples[9] = vec2( 0.896420, 0.412458);\nsamples[10] = vec2(-0.321940,-0.932615);\nsamples[11] = vec2(-0.791559,-0.597710);\nsamples[12] = vec2( 0.000000, 0.000000);\nconst float maxCoC = 5.0;\nconst float radiusScale = 0.5;\nvec4 cOut = texture(uSampler1, texCoords);\nfloat coc = texture(uSampler2, texCoords).r;\nfloat centerDepth = coc;\nfloat discRadius = abs(coc * 2.0 - 1.0) * maxCoC;\nfloat discRadiusLow = discRadius * radiusScale;\ncOut = vec4(0.0);\nfloat acc = 0.0;\nfor (int t = 0; t < NUM_TAPS; t++)\n{\nvec2 coordLow = texCoords + (texelSizeLow * samples[t] * discRadiusLow);\nvec2 coordHigh = texCoords + (texelSize * samples[t] * discRadius);\nvec4 tapLow = texture(uSampler1, coordLow);\nvec4 tapHigh = texture(uSampler1, coordHigh);\nfloat cocLow = texture(uSampler2, coordLow).r;\nfloat cocHigh = texture(uSampler2, coordHigh).r;\nfloat tapBlur = abs(cocHigh * 2.0 - 1.0);\nvec4 tap = mix(tapHigh, tapLow, tapBlur);\nfloat cocBlur = mix(cocHigh, cocLow, tapBlur);\ncocBlur = (cocBlur >= centerDepth) ? 1.0 : abs(cocBlur * 2.0 - 1.0);\ncOut += tap * cocBlur;\nacc += cocBlur;\n}\nvec4 result = cOut / acc;\nmyOutputColor = result;\n}\n", "downsample.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uViewport.zw;\nmyOutputColor = texture(uSampler, texCoords);\n}\n", - "fxaa.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n", + "fxaa.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nconst float FXAA_SPAN_MAX = 8.0;\nconst float FXAA_REDUCE_MUL = 1.0 / 8.0;\nconst float FXAA_REDUCE_MIN = 1.0 / 128.0;\nuniform sampler2D uSampler;\nuniform vec4 uViewport;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec2 texelSize = vec2(1.0) / uViewport.zw;\nvec3 color = texture(uSampler, texCoords).rgb;\nvec3 colorNW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorNE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y - texelSize.y)).rgb;\nvec3 colorSW = texture(uSampler, vec2(texCoords.x - texelSize.x, texCoords.y + texelSize.y)).rgb;\nvec3 colorSE = texture(uSampler, vec2(texCoords.x + texelSize.x, texCoords.y + texelSize.y)).rgb;\nfloat luminance = dot(color, LUMINANCE);\nfloat luminanceNW = dot(colorNW, LUMINANCE);\nfloat luminanceNE = dot(colorNE, LUMINANCE);\nfloat luminanceSW = dot(colorSW, LUMINANCE);\nfloat luminanceSE = dot(colorSE, LUMINANCE);\nfloat luminanceMin = min(luminance, min(min(luminanceNW, luminanceNE), min(luminanceSW, luminanceSE)));\nfloat luminanceMax = max(luminance, max(max(luminanceNW, luminanceNE), max(luminanceSW, luminanceSE)));\nvec2 dir = vec2(luminanceSW + luminanceSE - luminanceNW - luminanceNE, luminanceNW + luminanceSW - luminanceNE - luminanceSE);\nfloat dirReduce = max((luminanceNW + luminanceNE + luminanceSW + luminanceSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\nfloat rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\ndir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texelSize;\nvec3 colorA = 0.5 * (\ntexture(uSampler, texCoords.xy + dir * (1.0/3.0 - 0.5)).rgb +\ntexture(uSampler, texCoords.xy + dir * (2.0/3.0 - 0.5)).rgb);\nvec3 colorB = colorA * 0.5 + 0.25 * (\ntexture(uSampler, texCoords.xy - dir * 0.5).rgb +\ntexture(uSampler, texCoords.xy + dir * 0.5).rgb);\nluminance = dot(colorB, LUMINANCE);\nif (luminance < luminanceMin || luminance > luminanceMax)\n{\nmyOutputColor = vec4(colorA, 1.0);\n}\nelse\n{\nmyOutputColor = vec4(colorB, 1.0);\n}\n}\n', "gaussian.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform vec2 uResolution;\nuniform bool uHorizontal;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = gl_FragCoord.xy / uResolution;\nvec2 texelSize = vec2(1.0) / uResolution;\nconst int NUM_WEIGHTS = 3;\nfloat weights[NUM_WEIGHTS];\nweights[0] = 0.2270270270;\nweights[1] = 0.3162162162;\nweights[2] = 0.0702702703;\nfloat offsets[NUM_WEIGHTS];\noffsets[0] = 0.0;\noffsets[1] = 1.3846153846;\noffsets[2] = 3.2307692308;\nvec3 color = texture(uSampler, texCoords).rgb * weights[0];\nif (uHorizontal)\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(texelSize.x * offsets[i], 0.0)).rgb * weights[i];\n}\n}\nelse\n{\nfor (int i = 1; i < NUM_WEIGHTS; i++) {\ncolor += texture(uSampler, texCoords + vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\ncolor += texture(uSampler, texCoords - vec2(0.0, texelSize.y * offsets[i])).rgb * weights[i];\n}\n}\nmyOutputColor = vec4(color, 1.0);\n}\n", - "lasso.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n", + "lasso.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform vec3 uColor;\nuniform vec2 uThickness;\nuniform float uDashWidth;\nin mediump vec2 vTexCoord;\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 distance = min(vTexCoord, 1.0 - vTexCoord);\nif (distance.x > uThickness.x && distance.y > uThickness.y) {\ndiscard;\n}\nvec2 texCoord = vec2(vTexCoord.x, 1.0 - vTexCoord.y);\nvec2 thickness = uThickness * uDashWidth;\nvec2 b = mod(floor(texCoord / thickness), 2.0);\nif (b.x > 0.0 && texCoord.x < 1.0 - thickness.x) {\ndiscard;\n}\nif (b.y > 0.0 && texCoord.y < 1.0 - thickness.y) {\ndiscard;\n}\nmyOutputColor = vec4(pow(uColor, GAMMA), 1.0);\n}\n', "lasso.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nout mediump vec2 vTexCoord;\nvoid main(void) {\ngl_Position = uMMatrix * vec4(aPosition, 1.0);\nvTexCoord = aTexCoord;\n}\n", - "pickgrid.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n", + "pickgrid.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform bool uPick;\nuniform vec2 uFaceSize;\nuniform vec3 uMajorColor;\nuniform vec3 uMinorColor;\nuniform vec3 uZeroColor;\nuniform float uMajorThickness;\nuniform float uMinorThickness;\nuniform float uZeroThickness;\nuniform vec2 uZero;\nuniform vec2 uMinorGridlines;\nin lowp vec4 vColor;\nin mediump vec2 vTexCoord;\nin mediump vec4 vBounds;\nin mediump vec3 vNormal;\nin vec3 vViewPosition;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void) {\nif (uPick)\n{\nmyPosition = vColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec2 buffer = fwidth(vTexCoord);\nvec2 distance, thickness, step;\nvec4 color = vColor;\nvec2 width = vBounds.zw - vBounds.xy;\ndistance = (vTexCoord - vBounds.xy) / width;\ndistance = min(abs(distance - floor(uMinorGridlines * distance) / uMinorGridlines), abs(distance - ceil(uMinorGridlines * distance) / uMinorGridlines));\ndistance *= width;\nthickness = vec2(uMinorThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMinorColor, color.xyz, min(step.x, step.y));\nthickness = vec2(uMajorThickness) / uFaceSize;\ndistance = min(vTexCoord - vBounds.xy, vBounds.zw - vTexCoord);\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uMajorColor, color.xyz, min(step.x, step.y));\ndistance = abs(vTexCoord - uZero);\nthickness = vec2(uZeroThickness) / uFaceSize;\nstep = smoothstep(thickness, thickness + buffer, distance);\ncolor.xyz = mix(uZeroColor, color.xyz, min(step.x, step.y));\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\nmyColor.xyz = color.xyz;\n}\n}\n', "pickgrid.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin lowp vec4 aIdColor;\nin mediump vec2 aTexCoord;\nin mediump vec3 aNormal;\nin mediump vec4 aBounds;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform bool uPick;\nuniform vec4 uPickedIdColor;\nuniform vec3 uBackground;\nuniform vec3 uHighlight;\nout lowp vec4 vColor;\nout mediump vec2 vTexCoord;\nout mediump vec4 vBounds;\nout mediump vec3 vNormal;\nout vec3 vViewPosition;\nvoid main(void) {\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize(vec3(mvMatrix * vec4(aNormal, 0.0)));\nvTexCoord = aTexCoord;\nvBounds = aBounds;\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nif (uPick)\n{\nvColor = aIdColor;\n}\nelse\n{\nvColor = uPickedIdColor == aIdColor ? vec4(uHighlight, 1.0) : vColor = vec4(uBackground, 1.0);\n}\n}\n", "sdftext.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform sampler2D uSampler;\nuniform bool uPick;\nuniform vec3 uColor;\nuniform vec3 uHoverColor;\nuniform float uGamma;\nuniform vec3 uBorderColor;\nuniform float uBuffer;\nuniform float uBorderWidth;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nin lowp vec4 vIdColor;\nin lowp float vHover;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick) {\nmyPosition = vIdColor;\n}\nelse\n{\nfloat distance = texture(uSampler, vTexCoord).r;\nif (distance < uBuffer - uBorderWidth)\n{\ndiscard;\n}\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, mix(uColor, uHoverColor, vHover), value);\nmyPosition.xyz = vViewPosition;\nmyNormal.xyz = vNormal;\nmyColor.w = 1.0;\nmyPosition.w = 0.0;\nmyNormal.w = 0.0;\n}\n}\n", "sdftext.vertex.fx": "#version 300 es\nin lowp vec4 aIdColor;\nin vec3 aPosition;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform vec4 uPickedIdColor;\nout vec3 vViewPosition;\nout vec3 vNormal;\nout mediump vec2 vTexCoord;\nout lowp vec4 vIdColor;\nout lowp float vHover;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = vec3(mvMatrix * vec4(0.0, 0.0, 1.0, 0.0));\nvec4 viewPosition = mvMatrix* vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\nvIdColor = aIdColor;\nvHover = uPickedIdColor == aIdColor ? 1.0 : 0.0;\n}\n", "simple.vertex.fx": "#version 300 es\nin vec3 aPosition;\nvoid main(void) {\ngl_Position = vec4(aPosition, 1.0);\n}\n", "ssao.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int SSAO_KERNEL_SIZE = 8;\nuniform sampler2D uSampler1;\nuniform sampler2D uSampler2;\nuniform sampler2D uSampler3;\nuniform mat4 uPMatrix;\nuniform vec4 uViewport;\nuniform float uSsaoNoiseSize;\nuniform float uSsaoRadius;\nuniform float uSsaoPower;\nuniform vec3 uSsaoKernel[SSAO_KERNEL_SIZE];\nout vec4 myOutputColor;\nvoid main(void)\n{\nvec2 texCoords = (gl_FragCoord.xy - uViewport.xy) / uViewport.zw;\nvec3 position = texture(uSampler1, texCoords).rgb;\nvec3 normal = texture(uSampler2, texCoords).rgb;\nfloat occlusion = 0.0;\nvec2 noiseScale = uViewport.zw / uSsaoNoiseSize;\nvec3 randomVec = texture(uSampler3, texCoords * noiseScale).rgb;\nvec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));\nvec3 bitangent = cross(normal, tangent);\nmat3 tbn = mat3(tangent, bitangent, normal);\nfor(int i = 0; i < SSAO_KERNEL_SIZE; i++)\n{\nvec3 mySample = tbn * uSsaoKernel[i];\nmySample = position + mySample * uSsaoRadius;\nvec4 offset = vec4(mySample, 1.0);\noffset = uPMatrix * offset;\noffset.xy /= offset.w;\noffset.xy = offset.xy * 0.5 + 0.5;\nfloat sampleDepth = texture(uSampler1, offset.xy).z;\nfloat rangeCheck = abs(position.z - sampleDepth) > uSsaoRadius ? 0.0 : 1.0;\nocclusion += (sampleDepth < mySample.z ? 0.0 : 1.0) * rangeCheck;\n}\nocclusion /= float(SSAO_KERNEL_SIZE);\nocclusion = pow(1.0 - occlusion, uSsaoPower);\nmyOutputColor = vec4(occlusion, 0.0, 0.0, 1.0);\n}\n", - "texture.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n", + "texture.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\nuniform sampler2D uSampler;\nin mediump vec2 vTexCoord;\nin vec3 vViewPosition;\nin vec3 vNormal;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nmyPosition.xyz = vViewPosition;\nmyColor.xyz = pow(texture(uSampler, vTexCoord).xyz, INV_GAMMA);\nmyColor.w = 0.0;\nmyNormal.xyz = vNormal;\nmyNormal.w = 0.0;\n}\n', "texture.vertex.fx": "#version 300 es\nin vec3 aPosition;\nin mediump vec3 aNormal;\nin mediump vec2 aTexCoord;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nout vec3 vViewPosition;\nout mediump vec3 vNormal;\nout mediump vec2 vTexCoord;\nvoid main(void)\n{\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvNormal = normalize((mvMatrix * vec4(aNormal, 0.0)).xyz);\nvec4 viewPosition = mvMatrix * vec4(aPosition, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvTexCoord = aTexCoord;\n}\n", - "unitblock.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitblock.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitcylinder.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitcylinder.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n", - "unitsdf.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n", - "unitsdf.vertex.fx": "#version 300 es\n#include \"quat.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n", - "unitsphere.fragment.fx": "#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include \"common.include.fx\"\n#include \"intersect.include.fx\"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n", - "unitsphere.vertex.fx": "#version 300 es\n#include \"common.include.fx\"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n", + "unitblock.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitblock.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitcylinder.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec4 vCircle1;\nin vec4 vCircle2;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 tnor = iCappedCone(ro, rd, vCircle1.xyz, vCircle2.xyz, vCircle1.w, vCircle2.w, uShadow ? -1.0 : 1.0);\nfloat t = tnor.x;\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = tnor.yzw;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitcylinder.vertex.fx": '#version 300 es\n#include "common.include.fx"\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nuniform vec3 uIdentityRotation;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout vec3 vViewPosition;\nout vec4 vCircle1;\nout vec4 vCircle2;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvCircle1 = vec4(0.0);\nvCircle2 = vec4(0.0);\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec3 viewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition;\nposition.xz *= max(scale.x, scale.z);\nposition.y *= scale.y;\nvec3 direction = IDENTITY_ROTATION;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\ndirection = rotate(direction, quat);\n}\nvec3 viewDirection = (mvMatrix * vec4(direction, 0.0)).xyz;\nvec3 h = viewDirection * scale.y * 0.5;\nfloat r1 = length(viewDirection) * 0.5;\nfloat r2 = r1 * scale.z;\nr1 *= scale.x;\nvCircle1 = vec4(viewCenter - h, r1);\nvCircle2 = vec4(viewCenter + h, r2);\nvec4 viewPosition = mvMatrix * vec4(position + translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\n}\n}\n', + "unitsdf.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin mediump vec2 vTexCoord;\nin mediump vec2 vPreviousTexCoord;\nin mediump vec3 vModelPosition;\nin vec3 vViewPosition;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform sampler2D uSampler1;\nuniform sampler2D uPreviousSampler1;\nuniform bool uPick;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nfloat uBorderWidth = 0.0 / 255.0;\nfloat uBuffer = 192.0 / 255.0;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat distance = mix(texture(uPreviousSampler1, vPreviousTexCoord).r, texture(uSampler1, vTexCoord).r, vAnimation);\nif (distance < uBuffer - uBorderWidth) {\ndiscard;\n}\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = vViewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nfloat distanceSquared = (0.75 - dot2(vModelPosition)) * 2.0;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nvec3 normal = normalize(cross(dFdx(vViewPosition), dFdy(vViewPosition)));\nmyNormal.xyz = normal;\nfloat specular = 1.0;\nmyNormal.w = specular;\nvec3 uBorderColor = vec3(1.0, 1.0, 1.0);\nfloat uGamma = 0.0;\nfloat gamma = fwidth(distance);\nfloat value = smoothstep(uBuffer - gamma, uBuffer + gamma, distance);\nmyColor.xyz = mix(uBorderColor, color, value);\n}\n}\n', + "unitsdf.vertex.fx": '#version 300 es\n#include "quat.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin mediump vec4 aRotation;\nin mediump vec4 aPreviousRotation;\nin mediump vec4 aTexCoord;\nin mediump vec4 aPreviousTexCoord;\nin lowp vec2 aColor;\nin lowp vec2 aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin vec2 aOrder;\nin float aId;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump vec3 vModelPosition;\nout mediump vec2 vTexCoord;\nout mediump vec2 vPreviousTexCoord;\nout vec3 vViewPosition;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvModelPosition = vec3(0.0);\ngl_Position = vec4(0.0);\nvViewPosition = vec3(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nvModelPosition = aPosition;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nvec3 scale = mix(aPreviousScale, aScale, animation);\nvec3 position = aPosition * scale;\nif (aRotation.w * aPreviousRotation.w != 1.0)\n{\nvec4 quat = slerp(aPreviousRotation, aRotation, animation);\nposition = rotate(position, quat);\n}\nposition += mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvec4 viewPosition = mvMatrix * vec4(position, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = aPosition.y < 0.0 ? vec2(aColor.x, aPreviousColor.x) : vec2(aColor.y, aPreviousColor.y);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvPreviousTexCoord.x = aPosition.x < 0.0 ? aPreviousTexCoord.x : aPreviousTexCoord.z;\nvPreviousTexCoord.y = aPosition.y > 0.0 ? aPreviousTexCoord.y : aPreviousTexCoord.w;\nvTexCoord.x = aPosition.x < 0.0 ? aTexCoord.x : aTexCoord.z;\nvTexCoord.y = aPosition.y > 0.0 ? aTexCoord.y : aTexCoord.w;\n}\n}\n', + "unitsphere.fragment.fx": '#version 300 es\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "common.include.fx"\n#include "intersect.include.fx"\nin lowp vec4 vIdColor;\nin lowp vec2 vVertexColor;\nin lowp float vVertexSelected;\nin float vAnimation;\nin lowp float vHover;\nin lowp float vActive;\nin vec3 vViewPosition;\nin vec3 vViewCenter;\nin mediump float vRadius;\nuniform sampler2D uSampler;\nuniform sampler2D uPreviousSampler;\nuniform bool uPick;\nuniform bool uShadow;\nlayout(location = 0) out vec4 myPosition;\nlayout(location = 1) out vec4 myColor;\nlayout(location = 2) out vec4 myNormal;\nvoid main(void)\n{\nvec3 rd = normalize(vViewPosition);\nvec3 ro = vec3(0.0);\nvec4 s = vec4(vViewCenter, vRadius);\nfloat t = sphIntersect(ro, rd, s, uShadow ? -1.0 : 1.0);\nif (t < 0.0)\n{\ndiscard;\n}\nvec3 viewPosition = rd * t;\nfloat ndcDepth = DEPTH_A + DEPTH_B / viewPosition.z;\ngl_FragDepth = ndcDepth * 0.5 + 0.5;\nif (uPick)\n{\nmyPosition = vIdColor;\n}\nelse\n{\nmyPosition.xyz = viewPosition;\nvec3 previousColor = texture(uPreviousSampler, vec2(vVertexColor.y, 0.0)).xyz;\nvec3 color = texture(uSampler, vec2(vVertexColor.x, 0.0)).xyz;\ncolor = mix(previousColor, color, vAnimation);\nvec3 normal = (viewPosition - vViewCenter) / s.w;\nmyNormal.xyz = normal;\nfloat distanceSquared = dot(normal, rd);\ndistanceSquared *= distanceSquared;\nfloat emissive = max(vVertexSelected, 0.0);\nemissive += max(vHover, vActive);\nemissive *= distanceSquared;\nmyColor.w = emissive;\nmyPosition.w = emissive;\nfloat specular = 1.0;\nmyNormal.w = specular;\nmyColor.xyz = color;\n}\n}\n', + "unitsphere.vertex.fx": '#version 300 es\n#include "common.include.fx"\nin mediump vec3 aPosition;\nin vec3 aTranslation;\nin vec3 aPreviousTranslation;\nin lowp float aColor;\nin lowp float aPreviousColor;\nin vec3 aScale;\nin vec3 aPreviousScale;\nin float aId;\nin vec2 aOrder;\nin lowp float aSelected;\nin lowp float aPreviousSelected;\nin lowp vec4 aIdColor;\nuniform mat4 uMMatrix;\nuniform mat4 uVMatrix;\nuniform mat4 uPMatrix;\nuniform float uTime;\nuniform float uDuration;\nuniform float uOrderFrom;\nuniform float uOrderTo;\nuniform float uHover;\nuniform float uActive;\nout lowp vec4 vIdColor;\nout lowp vec2 vVertexColor;\nout lowp float vVertexSelected;\nout highp float vAnimation;\nout lowp float vHover;\nout lowp float vActive;\nout mediump float vRadius;\nout vec3 vViewPosition;\nout vec3 vViewCenter;\nvoid main(void)\n{\nif (aOrder.x < uOrderFrom || aOrder.x > uOrderTo)\n{\nvIdColor = vec4(0.0);\nvVertexColor = vec2(0.0);\nvVertexSelected = 0.0;\nvAnimation = 0.0;\nvHover = 0.0;\nvActive = 0.0;\nvViewPosition = vec3(0.0);\nvViewCenter = vec3(0.0);\nvRadius = 0.0;\ngl_Position = vec4(0.0);\n}\nelse\n{\nvIdColor = aIdColor;\nfloat staggerOrder = aOrder.y;\nfloat startTime = staggerOrder * (1.0 - uDuration);\nfloat animation = clamp((uTime - startTime) / uDuration, 0.0, 1.0);\nanimation = smoothstep(0.0, 1.0, animation);\nfloat scale = mix(min(aPreviousScale.x, min(aPreviousScale.y, aPreviousScale.z)), min(aScale.x, min(aScale.y, aScale.z)), animation);\nvec3 translation = mix(aPreviousTranslation, aTranslation, animation);\nmat4 mvMatrix = uVMatrix * uMMatrix;\nvViewCenter = (mvMatrix * vec4(translation, 1.0)).xyz;\ntranslation.xyz += aPosition * scale;\nvec4 viewPosition = mvMatrix * vec4(translation, 1.0);\nvViewPosition = viewPosition.xyz;\ngl_Position = uPMatrix * viewPosition;\nvVertexColor = vec2(aColor, aPreviousColor);\nvVertexSelected = mix(aPreviousSelected, aSelected, animation);\nvAnimation = animation;\nvHover = uHover == aId ? 1.0 : 0.0;\nvActive = uActive == aId ? 1.0 : 0.0;\nvRadius = distance(vViewPosition, vViewCenter) / ROOT_THREE;\n}\n}\n', "common.include.fx": "const float NEAR_PLANE = 0.01;\nconst float FAR_PLANE = 100.0;\nconst float DEPTH_A = 1.0002000200020003;\nconst float DEPTH_B = 0.020002000200020003;\nconst vec3 GAMMA = vec3(0.45454545454545453);\nconst vec3 INV_GAMMA = vec3(2.2);\nconst vec3 LUMINANCE = vec3(0.2126, 0.7152, 0.0722);\nconst float PI = 3.1415926538;\nconst float ROOT_TWO = 1.4142135624;\nconst float ROOT_TWO_OVER_TWO = 0.7071067811865476;\nconst float ROOT_THREE = 1.7320508075688772;\nconst float ROOT_THREE_OVER_TWO = 0.8660254037844386;\nconst vec3 IDENTITY_ROTATION = vec3(0.0, 1.0, 0.0);\nfloat dot2(in vec2 v) { return dot(v, v); }\nfloat dot2(in vec3 v) { return dot(v, v); }\n", "intersect.include.fx": "float sphIntersect( in vec3 ro, in vec3 rd, in vec4 sph, in float shadow)\n{\nvec3 oc = ro - sph.xyz;\nfloat b = dot( oc, rd );\nfloat c = dot( oc, oc ) - sph.w*sph.w;\nfloat h = b*b - c;\nif( h<0.0 ) return -1.0;\nreturn -b - shadow * sqrt( h );\n}\nfloat roundedboxIntersect( in vec3 ro, in vec3 rd, in vec3 size, in float rad )\n{\nvec3 m = 1.0/rd;\nvec3 n = m*ro;\nvec3 k = abs(m)*(size+rad);\nvec3 t1 = -n - k;\nvec3 t2 = -n + k;\nfloat tN = max( max( t1.x, t1.y ), t1.z );\nfloat tF = min( min( t2.x, t2.y ), t2.z );\nif( tN > tF || tF < 0.0) return -1.0;\nfloat t = tN;\nvec3 pos = ro+t*rd;\nvec3 s = sign(pos);\nro *= s;\nrd *= s;\npos *= s;\npos -= size;\npos = max( pos.xyz, pos.yzx );\nif( min(min(pos.x,pos.y),pos.z)<0.0 ) return t;\nvec3 oc = ro - size;\nvec3 dd = rd*rd;\nvec3 oo = oc*oc;\nvec3 od = oc*rd;\nfloat ra2 = rad*rad;\nt = 1e20;\n{\nfloat b = od.x + od.y + od.z;\nfloat c = oo.x + oo.y + oo.z - ra2;\nfloat h = b*b - c;\nif( h>0.0 ) t = -b-sqrt(h);\n}\n{\nfloat a = dd.y + dd.z;\nfloat b = od.y + od.z;\nfloat c = oo.y + oo.z - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.x+rd.x*h)<size.x ) t = h;\n}\n}\n{\nfloat a = dd.z + dd.x;\nfloat b = od.z + od.x;\nfloat c = oo.z + oo.x - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.y+rd.y*h)<size.y ) t = h;\n}\n}\n{\nfloat a = dd.x + dd.y;\nfloat b = od.x + od.y;\nfloat c = oo.x + oo.y - ra2;\nfloat h = b*b - a*c;\nif( h>0.0 )\n{\nh = (-b-sqrt(h))/a;\nif( h>0.0 && h<t && abs(ro.z+rd.z*h)<size.z ) t = h;\n}\n}\nif( t>1e19 ) t=-1.0;\nreturn t;\n}\nvec3 roundedboxNormal( in vec3 pos, in vec3 siz, in float rad )\n{\nreturn sign(pos)*normalize(max(abs(pos)-siz,0.0));\n}\nvec4 iCappedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(oa, ba);\nfloat m2 = dot(ob, ba);\nfloat m3 = dot(rd, ba);\nif (m1 < 0.0) { if (dot2(oa * m3 - rd * m1) < (ra * ra * m3 * m3)) return vec4(-m1 / m3, -ba * inversesqrt(m0)); }\nelse if (m2 > 0.0) { if (dot2(ob * m3 - rd * m2) < (rb * rb * m3 * m3)) return vec4(-m2 / m3, ba * inversesqrt(m0)); }\nfloat m4 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat rr = ra - rb;\nfloat hy = m0 + rr * rr;\nfloat k2 = m0 * m0 - m3 * m3 * hy;\nfloat k1 = m0 * m0 * m4 - m1 * m3 * hy + m0 * ra * (rr * m3 * 1.0);\nfloat k0 = m0 * m0 * m5 - m1 * m1 * hy + m0 * ra * (rr * m1 * 2.0 - m0 * ra);\nfloat h = k1 * k1 - k2 * k0;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-k1 - shadow * sqrt(h)) / k2;\nfloat y = m1 + t * m3;\nif (y > 0.0 && y < m0)\n{\nreturn vec4(t, normalize(m0 * (m0 * (oa + t * rd) + rr * ba * ra) - ba * hy * y));\n}\nreturn vec4(-1.0);\n}\nvec4 iRoundedCone(in vec3 ro, in vec3 rd,\nin vec3 pa, in vec3 pb,\nin float ra, in float rb, in float shadow)\n{\nvec3 ba = pb - pa;\nvec3 oa = ro - pa;\nvec3 ob = ro - pb;\nfloat rr = ra - rb;\nfloat m0 = dot(ba, ba);\nfloat m1 = dot(ba, oa);\nfloat m2 = dot(ba, rd);\nfloat m3 = dot(rd, oa);\nfloat m5 = dot(oa, oa);\nfloat m6 = dot(ob, rd);\nfloat m7 = dot(ob, ob);\nfloat d2 = m0 - rr * rr;\nfloat k2 = d2 - m2 * m2;\nfloat k1 = d2 * m3 - m1 * m2 + m2 * rr * ra;\nfloat k0 = d2 * m5 - m1 * m1 + m1 * rr * ra * 2.0 - m0 * ra * ra;\nfloat h = k1 * k1 - k0 * k2;\nif (h < 0.0) return vec4(-1.0);\nfloat t = (-shadow * sqrt(h) - k1) / k2;\nfloat y = m1 - ra * rr + t * m2;\nif (y > 0.0 && y < d2)\n{\nreturn vec4(t, normalize(d2 * (oa + t * rd) - ba * y));\n}\nfloat h1 = m3 * m3 - m5 + ra * ra;\nfloat h2 = m6 * m6 - m7 + rb * rb;\nif (max(h1, h2) < 0.0) return vec4(-1.0);\nvec4 r = vec4(1e20);\nif (h1 > 0.0)\n{\nt = -m3 - shadow * sqrt( h1 );\nr = vec4(t, (oa + t * rd) / ra);\n}\nif (h2 > 0.0)\n{\nt = -m6 - shadow * sqrt( h2 );\nif (t < r.x)\nr = vec4(t, (ob + t * rd) / rb);\n}\nreturn r;\n}\n", "quat.include.fx": "const float EPSILON = 0.000001;\nmat3 fromQuat(in vec4 q) {\nfloat x = q.x;\nfloat y = q.y;\nfloat z = q.z;\nfloat w = q.w;\nfloat x2 = x + x;\nfloat y2 = y + y;\nfloat z2 = z + z;\nfloat xx = x * x2;\nfloat yx = y * x2;\nfloat yy = y * y2;\nfloat zx = z * x2;\nfloat zy = z * y2;\nfloat zz = z * z2;\nfloat wx = w * x2;\nfloat wy = w * y2;\nfloat wz = w * z2;\nmat3 m;\nm[0][0] = 1.0 - yy - zz;\nm[0][1] = yx - wz;\nm[0][2] = zx + wy;\nm[1][0] = yx + wz;\nm[1][1] = 1.0 - xx - zz;\nm[1][2] = zy - wx;\nm[2][0] = zx - wy;\nm[2][1] = zy + wx;\nm[2][2] = 1.0 - xx - yy;\nreturn m;\n}\nvec3 rotate(in vec3 p, in vec4 q) {\nreturn p + 2.0 * cross(q.xyz, cross(q.xyz, p) + q.w * p);\n}\nvec4 slerp(in vec4 a, in vec4 b, in float t) {\nfloat cosom = dot(a, b);\nif (cosom < 0.0) {\ncosom = -cosom;\nb = -b;\n}\nfloat scale0, scale1;\nif (1.0 - cosom > EPSILON) {\nfloat omega = acos(cosom);\nfloat sinom = sin(omega);\nscale0 = sin((1.0 - t) * omega) / sinom;\nscale1 = sin(t * omega) / sinom;\n}\nelse {\nscale0 = 1.0 - t;\nscale1 = t;\n}\nreturn vec4(scale0 * a + scale1 * b);\n}\n" -}; -class ShaderBase { + }; + class ShaderBase { get isInitialized() { - return this._isInitialized; + return this._isInitialized; } get vertexBuffer() { - return this._vertexBuffer; + return this._vertexBuffer; } - set vertexBuffer(value) { - if (this._vertexBuffer != value) { - this._vertexBuffer = value; - this._haveBuffersChanged = true; - } + set vertexBuffer(value2) { + if (this._vertexBuffer != value2) { + this._vertexBuffer = value2; + this._haveBuffersChanged = true; + } } get indexBuffer() { - return this._indexBuffer; + return this._indexBuffer; } - set indexBuffer(value) { - if (this._indexBuffer != value) { - this._indexBuffer = value; - this._haveBuffersChanged = true; - } + set indexBuffer(value2) { + if (this._indexBuffer != value2) { + this._indexBuffer = value2; + this._haveBuffersChanged = true; + } } - constructor(core, main){ - this._core = core; - this._main = main; + constructor(core, main) { + this._core = core; + this._main = main; } initializeContext(gl) { - this._gl = gl; + this._gl = gl; } _createProgram(vs, fs) { - const program = this._gl.createProgram(); - this._gl.attachShader(program, vs); - this._gl.attachShader(program, fs); - this._gl.linkProgram(program); - if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getProgramInfoLog(program)); - return program; - } - _compileShader(source, type) { - const shader = this._gl.createShader(type); - this._gl.shaderSource(shader, source); - this._gl.compileShader(shader); - if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) this._core.log.write((0, _mainJs.LogLevel).error, this._gl.getShaderInfoLog(shader)); - return shader; + const program = this._gl.createProgram(); + this._gl.attachShader(program, vs); + this._gl.attachShader(program, fs); + this._gl.linkProgram(program); + if (!this._gl.getProgramParameter(program, this._gl.LINK_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getProgramInfoLog(program)); + } + return program; + } + _compileShader(source2, type2) { + const shader = this._gl.createShader(type2); + this._gl.shaderSource(shader, source2); + this._gl.compileShader(shader); + if (!this._gl.getShaderParameter(shader, this._gl.COMPILE_STATUS)) { + this._core.log.write(LogLevel.error, this._gl.getShaderInfoLog(shader)); + } + return shader; } _removeDirective(shaderSource, directive) { - const remove = `#define ${directive}`; - const index = shaderSource.indexOf(remove); - shaderSource = index == -1 ? shaderSource : shaderSource.substring(0, index) + shaderSource.substring(index + remove.length); - return shaderSource; + const remove2 = `#define ${directive}`; + const index2 = shaderSource.indexOf(remove2); + shaderSource = index2 == -1 ? shaderSource : shaderSource.substring(0, index2) + shaderSource.substring(index2 + remove2.length); + return shaderSource; } prepare() { - if (this._program != this._main.shaderResources.currentProgram) { - if (this._main.shaderResources.currentShader) this._main.shaderResources.currentShader.disableProgram(); - this.enableProgram(this._program); - this.updateBuffers(); - this.updateTextures(); - } else { - if (this._haveBuffersChanged) this.updateBuffers(); - if (this._haveTexturesChanged) this.updateTextures(); + if (this._program != this._main.shaderResources.currentProgram) { + if (this._main.shaderResources.currentShader) { + this._main.shaderResources.currentShader.disableProgram(); } + this.enableProgram(this._program); + this.updateBuffers(); + this.updateTextures(); + } else { + if (this._haveBuffersChanged) { + this.updateBuffers(); + } + if (this._haveTexturesChanged) { + this.updateTextures(); + } + } + } + apply() { + } + applyModel() { + } + applyView() { } - apply() {} - applyModel() {} - applyView() {} enableProgram(program) { - this._gl.useProgram(program); - this._main.shaderResources.currentProgram = program; - this._main.shaderResources.currentShader = this; + this._gl.useProgram(program); + this._main.shaderResources.currentProgram = program; + this._main.shaderResources.currentShader = this; } updateBuffers() { - this._haveBuffersChanged = false; + this._haveBuffersChanged = false; } updateTextures() { - this._haveTexturesChanged = false; + this._haveTexturesChanged = false; } disableProgram() { - this._main.shaderResources.currentShader = null; - this._main.shaderResources.currentProgram = null; + this._main.shaderResources.currentShader = null; + this._main.shaderResources.currentProgram = null; } _shaderFromFile(vsName, fsName, callback) { - callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); + callback(this._includesFromFile(Resources.glsl[vsName]), this._includesFromFile(Resources.glsl[fsName])); } _shaderFromUrl(vsName, fsName, callback) { - this._sourceFromUrl(vsName, (vsSource)=>{ - this._includesFromUrl(vsSource, 0, (vsIncSource)=>{ - this._sourceFromUrl(fsName, (fsSource)=>{ - this._includesFromUrl(fsSource, 0, (fsIncSource)=>{ - callback(vsIncSource, fsIncSource); - }); - }); + this._sourceFromUrl(vsName, (vsSource) => { + this._includesFromUrl(vsSource, 0, (vsIncSource) => { + this._sourceFromUrl(fsName, (fsSource) => { + this._includesFromUrl(fsSource, 0, (fsIncSource) => { + callback(vsIncSource, fsIncSource); }); + }); }); + }); } _sourceFromUrl(url, callback) { - const request = new XMLHttpRequest(); - request.open("GET", (0, _pathJs.PathHelper).combine(this._core.config.shaderPath, url)); - request.onreadystatechange = ()=>{ - if (request.readyState == XMLHttpRequest.DONE && request.status == 200) callback(request.responseText); - }; - request.send(); + const request2 = new XMLHttpRequest(); + request2.open("GET", PathHelper.combine(this._core.config.shaderPath, url)); + request2.onreadystatechange = () => { + if (request2.readyState == XMLHttpRequest.DONE && request2.status == 200) { + callback(request2.responseText); + } + }; + request2.send(); + } + _includesFromFile(source2) { + let index2 = 0; + do { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + const inc = Resources.glsl[name]; + source2 = source2.substring(0, index2) + inc + source2.substring(end + 1); + } + } while (index2 != -1); + return source2; + } + _includesFromUrl(source2, index2, callback) { + index2 = source2.indexOf("#include", index2); + if (index2 != -1) { + const start = source2.indexOf('"', index2); + const end = source2.indexOf('"', start + 1); + const name = source2.substring(start + 1, end); + this._sourceFromUrl(PathHelper.combine("inc", name), (include) => { + source2 = source2.substring(0, index2) + include + source2.substring(end + 1); + this._includesFromUrl(source2, index2, callback); + }); + } else { + callback(source2); + } } - _includesFromFile(source) { - let index = 0; - do { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - const inc = Resources.glsl[name]; - source = source.substring(0, index) + inc + source.substring(end + 1); - } - }while (index != -1); - return source; - } - _includesFromUrl(source, index, callback) { - index = source.indexOf("#include", index); - if (index != -1) { - const start = source.indexOf("\"", index); - const end = source.indexOf("\"", start + 1); - const name = source.substring(start + 1, end); - this._sourceFromUrl((0, _pathJs.PathHelper).combine("inc", name), (include)=>{ - source = source.substring(0, index) + include + source.substring(end + 1); - this._includesFromUrl(source, index, callback); - }); - } else callback(source); - } -} - -},{"../../../helpers/path.js":"ekXmH","../../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gN1DJ":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Texture", ()=>Texture); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Texture extends (0, _shaderJs.ShaderBase) { + } + class Texture extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("texture.vertex.fx", "texture.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = gl.getAttribLocation(this._program, "aNormal"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._isInitialized = true; } apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1i(this._samplerUniform, 0); } applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionNormalTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionNormalTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionNormalTextureVertex.SIZE_BYTES, PositionNormalTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9ZGAb":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Lasso extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + let Lasso$1 = class Lasso extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("lasso.vertex.fx", "lasso.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); - this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._thicknessUniform = gl.getUniformLocation(this._program, "uThickness"); + this._dashWidthUniform = gl.getUniformLocation(this._program, "uDashWidth"); + this._isInitialized = true; } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform1f(this._dashWidthUniform, this.dashWidth); } applyView() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2fv(this._thicknessUniform, this.thickness); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2fv(this._thicknessUniform, this.thickness); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTextureVertex).SIZE_BYTES, (0, _vertexJs.PositionTextureVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTextureVertex.SIZE_BYTES, PositionTextureVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eGxSt":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SdfText", ()=>SdfText); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class SdfText extends (0, _shaderJs.ShaderBase) { + }; + class SdfText extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("sdftext.vertex.fx", "sdftext.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); - this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); - this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); - this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._hoverColorUniform = gl.getUniformLocation(this._program, "uHoverColor"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._borderColorUniform = gl.getUniformLocation(this._program, "uBorderColor"); + this._bufferUniform = gl.getUniformLocation(this._program, "uBuffer"); + this._borderWidthUniform = gl.getUniformLocation(this._program, "uBorderWidth"); + this._gammaUniform = gl.getUniformLocation(this._program, "uGamma"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform3fv(this._colorUniform, this.color); - this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); - this._gl.uniform3fv(this._borderColorUniform, this.borderColor); - this._gl.uniform1f(this._gammaUniform, this.gamma); - this._gl.uniform1f(this._bufferUniform, this.buffer); - this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._hoverColorUniform, this.hoverColor); + this._gl.uniform3fv(this._borderColorUniform, this.borderColor); + this._gl.uniform1f(this._gammaUniform, this.gamma); + this._gl.uniform1f(this._bufferUniform, this.buffer); + this._gl.uniform1f(this._borderWidthUniform, this.borderWidth); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyModel() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).POSITION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PositionTexturePickVertex).SIZE_BYTES, (0, _vertexJs.PositionTexturePickVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.POSITION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PositionTexturePickVertex.SIZE_BYTES, PositionTexturePickVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cWCAC":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PickGrid", ()=>PickGrid); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class PickGrid extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class PickGrid extends ShaderBase { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("pickgrid.vertex.fx", "pickgrid.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); - this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); - this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); - this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); - this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); - this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); - this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); - this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); - this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); - this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); - this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); - this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); - this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); - this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); - this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); - this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = this._gl.getAttribLocation(this._program, "aPosition"); + this._idColorAttribute = this._gl.getAttribLocation(this._program, "aIdColor"); + this._texCoordAttribute = this._gl.getAttribLocation(this._program, "aTexCoord"); + this._normalAttribute = this._gl.getAttribLocation(this._program, "aNormal"); + this._boundsAttribute = this._gl.getAttribLocation(this._program, "aBounds"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._majorColorUniform = gl.getUniformLocation(this._program, "uMajorColor"); + this._minorColorUniform = gl.getUniformLocation(this._program, "uMinorColor"); + this._zeroColorUniform = gl.getUniformLocation(this._program, "uZeroColor"); + this._backgroundUniform = gl.getUniformLocation(this._program, "uBackground"); + this._highlightUniform = gl.getUniformLocation(this._program, "uHighlight"); + this._pickedIdColorUniform = gl.getUniformLocation(this._program, "uPickedIdColor"); + this._faceSizeUniform = gl.getUniformLocation(this._program, "uFaceSize"); + this._majorThicknessUniform = gl.getUniformLocation(this._program, "uMajorThickness"); + this._minorThicknessUniform = gl.getUniformLocation(this._program, "uMinorThickness"); + this._zeroThicknessUniform = gl.getUniformLocation(this._program, "uZeroThickness"); + this._zeroUniform = gl.getUniformLocation(this._program, "uZero"); + this._minorGridlinesUniform = gl.getUniformLocation(this._program, "uMinorGridlines"); + this._isInitialized = true; } apply() { - this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); - this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); - this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); - this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); - this._gl.uniform3fv(this._highlightUniform, this.highlightColor); - this._gl.uniform3fv(this._majorColorUniform, this.majorColor); - this._gl.uniform3fv(this._minorColorUniform, this.minorColor); - this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); - this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); + this._gl.uniform1f(this._majorThicknessUniform, this.majorThickness); + this._gl.uniform1f(this._minorThicknessUniform, this.minorThickness); + this._gl.uniform1f(this._zeroThicknessUniform, this.zeroThickness); + this._gl.uniform3fv(this._backgroundUniform, this.backgroundColor); + this._gl.uniform3fv(this._highlightUniform, this.highlightColor); + this._gl.uniform3fv(this._majorColorUniform, this.majorColor); + this._gl.uniform3fv(this._minorColorUniform, this.minorColor); + this._gl.uniform3fv(this._zeroColorUniform, this.zeroColor); + this._gl.uniform4fv(this._pickedIdColorUniform, this.pickedIdColor); } applyView() { - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } ApplyFace() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); - this._gl.uniform2fv(this._zeroUniform, this.zero); - this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform2f(this._faceSizeUniform, this.faceWidth, this.faceHeight); + this._gl.uniform2fv(this._zeroUniform, this.zero); + this._gl.uniform2fv(this._minorGridlinesUniform, this.minorGridlines); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TRANSLATION_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).NORMAL_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._normalAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).TEX_COORD_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).ID_COLOR_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, (0, _vertexJs.PickGridVertex).SIZE_BYTES, (0, _vertexJs.PickGridVertex).BOUNDS_OFFSET_BYTES); - this._gl.enableVertexAttribArray(this._boundsAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4WGJz":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitBlock", ()=>UnitBlock); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitBlock extends (0, _unitshaderJs.UnitShader) { - initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); - }); - } - _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; - } - _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); - } - _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PickGridVertex.SIZE_BYTES, PickGridVertex.TRANSLATION_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.vertexAttribPointer(this._normalAttribute, 3, this._gl.BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.NORMAL_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._normalAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 2, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.TEX_COORD_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, PickGridVertex.SIZE_BYTES, PickGridVertex.ID_COLOR_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._boundsAttribute, 4, this._gl.UNSIGNED_SHORT, true, PickGridVertex.SIZE_BYTES, PickGridVertex.BOUNDS_OFFSET_BYTES); + this._gl.enableVertexAttribArray(this._boundsAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5XXeS":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitShader", ()=>UnitShader); -var _shaderJs = require("./shader.js"); -var _cubeJs = require("../../../meshes/cube.js"); -var _vertexJs = require("../../../vertex.js"); -class UnitShader extends (0, _shaderJs.ShaderBase) { + } + class UnitShader extends ShaderBase { get paletteTexture() { - return this._paletteTexture; + return this._paletteTexture; } - set paletteTexture(value) { - if (this._paletteTexture != value) { - this._paletteTexture = value; - this._haveTexturesChanged = true; - } + set paletteTexture(value2) { + if (this._paletteTexture != value2) { + this._paletteTexture = value2; + this._haveTexturesChanged = true; + } } get previousPaletteTexture() { - return this._previousPaletteTexture; + return this._previousPaletteTexture; } - set previousPaletteTexture(value) { - if (this._previousPaletteTexture != value) { - this._previousPaletteTexture = value; - this._haveTexturesChanged = true; - } + set previousPaletteTexture(value2) { + if (this._previousPaletteTexture != value2) { + this._previousPaletteTexture = value2; + this._haveTexturesChanged = true; + } } get sdfTexture() { - return this._sdfTexture; + return this._sdfTexture; } - set sdfTexture(value) { - if (this._sdfTexture != value) { - this._sdfTexture = value; - this._haveTexturesChanged = true; - } + set sdfTexture(value2) { + if (this._sdfTexture != value2) { + this._sdfTexture = value2; + this._haveTexturesChanged = true; + } } get previousSdfTexture() { - return this._previousSdfTexture; + return this._previousSdfTexture; } - set previousSdfTexture(value) { - if (this._previousSdfTexture != value) { - this._previousSdfTexture = value; - this._haveTexturesChanged = true; - } + set previousSdfTexture(value2) { + if (this._previousSdfTexture != value2) { + this._previousSdfTexture = value2; + this._haveTexturesChanged = true; + } } - set instanceBuffer(value) { - if (this._instanceBuffer != value) { - this._instanceBuffer = value; - this._haveBuffersChanged = true; - } + set instanceBuffer(value2) { + if (this._instanceBuffer != value2) { + this._instanceBuffer = value2; + this._haveBuffersChanged = true; + } } - set previousInstanceBuffer(value) { - if (this._previousInstanceBuffer != value) { - this._previousInstanceBuffer = value; - this._haveBuffersChanged = true; - } + set previousInstanceBuffer(value2) { + if (this._previousInstanceBuffer != value2) { + this._previousInstanceBuffer = value2; + this._haveBuffersChanged = true; + } } initializeData() { - this._areBuffersInitialized = false; + this._areBuffersInitialized = false; } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); - this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); - this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); - this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); - this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); - this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); - this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); - this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); - this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); - this._idAttribute = gl.getAttribLocation(this._program, "aId"); - this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); - this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); - this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); - this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); - this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._timeUniform = gl.getUniformLocation(this._program, "uTime"); - this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); - this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); - this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); - this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); - this._activeUniform = gl.getUniformLocation(this._program, "uActive"); - this._pickUniform = gl.getUniformLocation(this._program, "uPick"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - const vertices = (0, _cubeJs.Cube).POSITIONS; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _cubeJs.Cube).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this.indexCount = indices.length; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._translationAttribute = gl.getAttribLocation(this._program, "aTranslation"); + this._previousTranslationAttribute = gl.getAttribLocation(this._program, "aPreviousTranslation"); + this._scaleAttribute = gl.getAttribLocation(this._program, "aScale"); + this._previousScaleAttribute = gl.getAttribLocation(this._program, "aPreviousScale"); + this._colorAttribute = gl.getAttribLocation(this._program, "aColor"); + this._previousColorAttribute = gl.getAttribLocation(this._program, "aPreviousColor"); + this._selectedAttribute = gl.getAttribLocation(this._program, "aSelected"); + this._previousSelectedAttribute = gl.getAttribLocation(this._program, "aPreviousSelected"); + this._orderAttribute = gl.getAttribLocation(this._program, "aOrder"); + this._idAttribute = gl.getAttribLocation(this._program, "aId"); + this._idColorAttribute = gl.getAttribLocation(this._program, "aIdColor"); + this._sampler0Uniform = gl.getUniformLocation(this._program, "uSampler"); + this._previousSampler0Uniform = gl.getUniformLocation(this._program, "uPreviousSampler"); + this._mMatrixUniform = gl.getUniformLocation(this._program, "uMMatrix"); + this._vMatrixUniform = gl.getUniformLocation(this._program, "uVMatrix"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._timeUniform = gl.getUniformLocation(this._program, "uTime"); + this._durationUniform = gl.getUniformLocation(this._program, "uDuration"); + this._fromOrderUniform = gl.getUniformLocation(this._program, "uOrderFrom"); + this._toOrderUniform = gl.getUniformLocation(this._program, "uOrderTo"); + this._hoverUniform = gl.getUniformLocation(this._program, "uHover"); + this._activeUniform = gl.getUniformLocation(this._program, "uActive"); + this._pickUniform = gl.getUniformLocation(this._program, "uPick"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + const vertices = Cube.POSITIONS; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Cube.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this.indexCount = indices.length; } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._updateCurrentBuffer(); - this._updatePreviousBuffer(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, 12, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._updateCurrentBuffer(); + this._updatePreviousBuffer(); + } + _updateCurrentBuffer() { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); + this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ID_HOVER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idAttribute, 1); + this._gl.enableVertexAttribArray(this._idAttribute); + this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.ID_COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._idColorAttribute, 1); + this._gl.enableVertexAttribArray(this._idColorAttribute); + this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._translationAttribute, 1); + this._gl.enableVertexAttribArray(this._translationAttribute); + this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._scaleAttribute, 1); + this._gl.enableVertexAttribArray(this._scaleAttribute); + this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._selectedAttribute, 1); + this._gl.enableVertexAttribArray(this._selectedAttribute); + this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ORDER_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._orderAttribute, 1); + this._gl.enableVertexAttribArray(this._orderAttribute); + } + _updatePreviousBuffer() { + if (this._previousInstanceBuffer != this._instanceBuffer) { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); + } + this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TRANSLATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTranslationAttribute); + this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.SCALE_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); + this._gl.enableVertexAttribArray(this._previousScaleAttribute); + this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.SELECTED_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); + this._gl.enableVertexAttribArray(this._previousSelectedAttribute); + } + apply() { + this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); + this._gl.uniform1f(this._timeUniform, this.time); + this._gl.uniform1f(this._durationUniform, this.duration); + this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); + this._gl.uniform1f(this._toOrderUniform, this.rangeMax); + this._gl.uniform1i(this._previousSampler0Uniform, 0); + this._gl.uniform1i(this._sampler0Uniform, 1); + this._gl.uniform1f(this._hoverUniform, this.hover); + this._gl.uniform1f(this._activeUniform, this.active); + } + applyView() { + this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); + this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); + } + updateTextures() { + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + } + disableProgram() { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._translationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); + this._gl.vertexAttribDivisor(this._scaleAttribute, 0); + this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); + this._gl.vertexAttribDivisor(this._colorAttribute, 0); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); + this._gl.vertexAttribDivisor(this._selectedAttribute, 0); + this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); + this._gl.vertexAttribDivisor(this._orderAttribute, 0); + this._gl.vertexAttribDivisor(this._idAttribute, 0); + this._gl.vertexAttribDivisor(this._idColorAttribute, 0); + } + } + class UnitBlock extends UnitShader { + initializeContext(gl) { + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitblock.vertex.fx", "unitblock.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); + }); + } + } + _initializeShader(gl, vsSource, fsSource) { + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._instanceBuffer); - this._gl.vertexAttribPointer(this._idAttribute, 1, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_HOVER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idAttribute, 1); - this._gl.enableVertexAttribArray(this._idAttribute); - this._gl.vertexAttribPointer(this._idColorAttribute, 4, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ID_COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._idColorAttribute, 1); - this._gl.enableVertexAttribArray(this._idColorAttribute); - this._gl.vertexAttribPointer(this._translationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._translationAttribute, 1); - this._gl.enableVertexAttribArray(this._translationAttribute); - this._gl.vertexAttribPointer(this._scaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._scaleAttribute, 1); - this._gl.enableVertexAttribArray(this._scaleAttribute); - this._gl.vertexAttribPointer(this._selectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._selectedAttribute, 1); - this._gl.enableVertexAttribArray(this._selectedAttribute); - this._gl.vertexAttribPointer(this._orderAttribute, 2, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ORDER_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._orderAttribute, 1); - this._gl.enableVertexAttribArray(this._orderAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - if (this._previousInstanceBuffer != this._instanceBuffer) this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._previousInstanceBuffer); - this._gl.vertexAttribPointer(this._previousTranslationAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TRANSLATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTranslationAttribute); - this._gl.vertexAttribPointer(this._previousScaleAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SCALE_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 1); - this._gl.enableVertexAttribArray(this._previousScaleAttribute); - this._gl.vertexAttribPointer(this._previousSelectedAttribute, 1, this._gl.BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).SELECTED_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 1); - this._gl.enableVertexAttribArray(this._previousSelectedAttribute); - } - apply() { - this._gl.uniformMatrix4fv(this._mMatrixUniform, false, this.mMatrix); - this._gl.uniform1f(this._timeUniform, this.time); - this._gl.uniform1f(this._durationUniform, this.duration); - this._gl.uniform1f(this._fromOrderUniform, this.rangeMin); - this._gl.uniform1f(this._toOrderUniform, this.rangeMax); - this._gl.uniform1i(this._previousSampler0Uniform, 0); - this._gl.uniform1i(this._sampler0Uniform, 1); - this._gl.uniform1f(this._hoverUniform, this.hover); - this._gl.uniform1f(this._activeUniform, this.active); - } - applyView() { - this._gl.uniformMatrix4fv(this._vMatrixUniform, false, this.vMatrix); - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); - this._gl.uniform1i(this._pickUniform, this.isPickShader ? 1 : 0); - this._gl.uniform1i(this._shadowUniform, this.isShadowMap ? 1 : 0); - } - updateTextures() { - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousPaletteTexture); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._paletteTexture); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._translationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTranslationAttribute, 0); - this._gl.vertexAttribDivisor(this._scaleAttribute, 0); - this._gl.vertexAttribDivisor(this._previousScaleAttribute, 0); - this._gl.vertexAttribDivisor(this._colorAttribute, 0); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 0); - this._gl.vertexAttribDivisor(this._selectedAttribute, 0); - this._gl.vertexAttribDivisor(this._previousSelectedAttribute, 0); - this._gl.vertexAttribDivisor(this._orderAttribute, 0); - this._gl.vertexAttribDivisor(this._idAttribute, 0); - this._gl.vertexAttribDivisor(this._idColorAttribute, 0); - } -} - -},{"./shader.js":"67Z4f","../../../meshes/cube.js":"dYecn","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3msJ8":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSphere", ()=>UnitSphere); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSphere extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSphere extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsphere.vertex.fx", "unitsphere.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._colorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fTtgI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitCylinder", ()=>UnitCylinder); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitCylinder extends (0, _unitshaderJs.UnitShader) { + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousColorAttribute, 1, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); + } + } + class UnitCylinder extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitcylinder.vertex.fx", "unitcylinder.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kAjIu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "UnitSdf", ()=>UnitSdf); -var _vertexJs = require("../../../vertex.js"); -var _unitshaderJs = require("./unitshader.js"); -class UnitSdf extends (0, _unitshaderJs.UnitShader) { + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + } + } + class UnitSdf extends UnitShader { initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("unitsdf.vertex.fx", "unitsdf.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - super._initializeShader(gl, vsSource, fsSource); - this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); - this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); - this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); - this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); - this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); - this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); - this._isInitialized = true; + super._initializeShader(gl, vsSource, fsSource); + this._rotationAttribute = gl.getAttribLocation(this._program, "aRotation"); + this._previousRotationAttribute = gl.getAttribLocation(this._program, "aPreviousRotation"); + this._texCoordAttribute = gl.getAttribLocation(this._program, "aTexCoord"); + this._previousTexCoordAttribute = gl.getAttribLocation(this._program, "aPreviousTexCoord"); + this._sampler1Uniform = gl.getUniformLocation(this._program, "uSampler1"); + this._previousSampler1Uniform = gl.getUniformLocation(this._program, "uPreviousSampler1"); + this._isInitialized = true; } _updateCurrentBuffer() { - super._updateCurrentBuffer(); - this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._rotationAttribute, 1); - this._gl.enableVertexAttribArray(this._rotationAttribute); - this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._texCoordAttribute); - this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._colorAttribute, 1); - this._gl.enableVertexAttribArray(this._colorAttribute); + super._updateCurrentBuffer(); + this._gl.vertexAttribPointer(this._rotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._rotationAttribute, 1); + this._gl.enableVertexAttribArray(this._rotationAttribute); + this._gl.vertexAttribPointer(this._texCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._texCoordAttribute); + this._gl.vertexAttribPointer(this._colorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._colorAttribute, 1); + this._gl.enableVertexAttribArray(this._colorAttribute); } _updatePreviousBuffer() { - super._updatePreviousBuffer(); - this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).ROTATION_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); - this._gl.enableVertexAttribArray(this._previousRotationAttribute); - this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).TEXCOORD_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); - this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); - this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, (0, _vertexJs.UnitVertex).SIZE_BYTES, (0, _vertexJs.UnitVertex).COLOR_OFFSET_BYTES); - this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); - this._gl.enableVertexAttribArray(this._previousColorAttribute); + super._updatePreviousBuffer(); + this._gl.vertexAttribPointer(this._previousRotationAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.ROTATION_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 1); + this._gl.enableVertexAttribArray(this._previousRotationAttribute); + this._gl.vertexAttribPointer(this._previousTexCoordAttribute, 4, this._gl.FLOAT, false, UnitVertex.SIZE_BYTES, UnitVertex.TEXCOORD_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 1); + this._gl.enableVertexAttribArray(this._previousTexCoordAttribute); + this._gl.vertexAttribPointer(this._previousColorAttribute, 2, this._gl.UNSIGNED_BYTE, true, UnitVertex.SIZE_BYTES, UnitVertex.COLOR_OFFSET_BYTES); + this._gl.vertexAttribDivisor(this._previousColorAttribute, 1); + this._gl.enableVertexAttribArray(this._previousColorAttribute); } apply() { - super.apply(); - this._gl.uniform1i(this._previousSampler1Uniform, 2); - this._gl.uniform1i(this._sampler1Uniform, 3); + super.apply(); + this._gl.uniform1i(this._previousSampler1Uniform, 2); + this._gl.uniform1i(this._sampler1Uniform, 3); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._previousSdfTexture); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._sdfTexture); } disableProgram() { - super.disableProgram(); - this._gl.vertexAttribDivisor(this._rotationAttribute, 0); - this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); - this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); - this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); - } -} - -},{"../../../vertex.js":"8lW8V","./unitshader.js":"5XXeS","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6itVY":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Background", ()=>Background); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _quadJs = require("../components/quad.js"); -class Background extends (0, _shaderJs.ShaderBase) { - constructor(core, main){ - super(core, main); - this._quad = new (0, _quadJs.Quad)(); + super.disableProgram(); + this._gl.vertexAttribDivisor(this._rotationAttribute, 0); + this._gl.vertexAttribDivisor(this._previousRotationAttribute, 0); + this._gl.vertexAttribDivisor(this._texCoordAttribute, 0); + this._gl.vertexAttribDivisor(this._previousTexCoordAttribute, 0); + } + } + class Background extends ShaderBase { + constructor(core, main) { + super(core, main); + this._quad = new Quad(); } initializeContext(gl) { - super.initializeContext(gl); - this._quad.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + this._quad.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "background.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._colorUniform = gl.getUniformLocation(this._program, "uColor"); - this._isInitialized = true; - this._vao = gl.createVertexArray(); - gl.bindVertexArray(this._vao); - gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); - gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - gl.enableVertexAttribArray(this._positionAttribute); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); - gl.bindVertexArray(null); + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._colorUniform = gl.getUniformLocation(this._program, "uColor"); + this._isInitialized = true; + this._vao = gl.createVertexArray(); + gl.bindVertexArray(this._vao); + gl.bindBuffer(gl.ARRAY_BUFFER, this._quad.vertexBuffer); + gl.vertexAttribPointer(this._positionAttribute, 3, gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + gl.enableVertexAttribArray(this._positionAttribute); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._quad.indexBuffer); + gl.bindVertexArray(null); } apply() { - this._gl.uniform3fv(this._colorUniform, this.color); + this._gl.uniform3fv(this._colorUniform, this.color); } updateBuffers() { - super.updateBuffers(); - this._gl.bindVertexArray(this._vao); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","../components/quad.js":"jnURY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ju7sc":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ssao", ()=>Ssao); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Ssao extends (0, _shaderJs.ShaderBase) { + super.updateBuffers(); + this._gl.bindVertexArray(this._vao); + } + } + class Ssao extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "ssao.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); - this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); - this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); - this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._pMatrixUniform = gl.getUniformLocation(this._program, "uPMatrix"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._ssaoNoiseSizeUniform = gl.getUniformLocation(this._program, "uSsaoNoiseSize"); + this._ssaoRadiusUniform = gl.getUniformLocation(this._program, "uSsaoRadius"); + this._ssaoPowerUniform = gl.getUniformLocation(this._program, "uSsaoPower"); + this._ssaoKernelUniform = gl.getUniformLocation(this._program, "uSsaoKernel"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); - this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); - this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); - this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._ssaoNoiseSizeUniform, this.ssaoNoiseSize); + this._gl.uniform1f(this._ssaoRadiusUniform, this.ssaoRadius); + this._gl.uniform1f(this._ssaoPowerUniform, this.ssaoPower); + this._gl.uniform3fv(this._ssaoKernelUniform, this.ssaoKernel); } applyView() { - this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); + this._gl.uniformMatrix4fv(this._pMatrixUniform, false, this.pMatrix); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3yIW6":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Box", ()=>Box); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Box extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + class Box extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "box.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dbxlx":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Deferred", ()=>Deferred); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -var _glMatrix = require("gl-matrix"); -class Deferred extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Deferred extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } - constructor(core, main){ - super(core, main); - this.directionToKeyLight = (0, _glMatrix.vec3).create(); - this.directionToFillLight1 = (0, _glMatrix.vec3).create(); - this.directionToFillLight2 = (0, _glMatrix.vec3).create(); - this.keyLightHalfAngle = (0, _glMatrix.vec3).create(); + constructor(core, main) { + super(core, main); + this.directionToKeyLight = create$3(); + this.directionToFillLight1 = create$3(); + this.directionToFillLight2 = create$3(); + this.keyLightHalfAngle = create$3(); } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "deferred.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); - this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); - this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); - this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); - this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); - this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); - this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); - this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); - this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); - this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); - this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); - this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); - this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); - this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); - this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); - this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._shadowUniform = gl.getUniformLocation(this._program, "uShadow"); + this._ssaoUniform = gl.getUniformLocation(this._program, "uSsao"); + this._inverseVMatrixUniform = gl.getUniformLocation(this._program, "uInverseVMatrix"); + this._shadowVMatrixUniform = gl.getUniformLocation(this._program, "uShadowVMatrix"); + this._shadowPMatrixUniform = gl.getUniformLocation(this._program, "uShadowPMatrix"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._shadowMapSizeUniform = gl.getUniformLocation(this._program, "uShadowMapSize"); + this._keyLightHalfAngleUniform = gl.getUniformLocation(this._program, "uKeyLightHalfAngle"); + this._directionToKeyLightUniform = gl.getUniformLocation(this._program, "uDirectionToKeyLight"); + this._directionToFillLight1Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight1"); + this._directionToFillLight2Uniform = gl.getUniformLocation(this._program, "uDirectionToFillLight2"); + this._keyLightIntensityUniform = gl.getUniformLocation(this._program, "uKeyLightIntensity"); + this._fillLight1IntensityUniform = gl.getUniformLocation(this._program, "uFillLight1Intensity"); + this._fillLight2IntensityUniform = gl.getUniformLocation(this._program, "uFillLight2Intensity"); + this._ambientIntensityUniform = gl.getUniformLocation(this._program, "uAmbientIntensity"); + this._materialIntensityUniform = gl.getUniformLocation(this._program, "uMaterialIntensity"); + this._specularPowerUniform = gl.getUniformLocation(this._program, "uSpecularPower"); + this._specularIntensityUniform = gl.getUniformLocation(this._program, "uSpecularIntensity"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); - this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); - this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); - this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); - this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); - this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); - this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); - this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); - this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); - this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); - this._gl.uniform1f(this._specularPowerUniform, this.specularPower); - this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); - this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); - this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); - this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); - this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); + this._gl.uniform1i(this._shadowUniform, this.isShadowEnabled ? 1 : 0); + this._gl.uniform1i(this._ssaoUniform, this.isSsaoEnabled ? 1 : 0); + this._gl.uniformMatrix4fv(this._inverseVMatrixUniform, false, this.inverseVMatrix); + this._gl.uniformMatrix4fv(this._shadowVMatrixUniform, false, this.shadowVMatrix); + this._gl.uniformMatrix4fv(this._shadowPMatrixUniform, false, this.shadowPMatrix); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform2f(this._shadowMapSizeUniform, this.shadowMapWidth, this.shadowMapHeight); + this._gl.uniform1f(this._keyLightIntensityUniform, this.keyLightIntensity); + this._gl.uniform1f(this._fillLight1IntensityUniform, this.fillLight1Intensity); + this._gl.uniform1f(this._fillLight2IntensityUniform, this.fillLight2Intensity); + this._gl.uniform1f(this._ambientIntensityUniform, this.ambientIntensity); + this._gl.uniform1f(this._materialIntensityUniform, this.materialIntensity); + this._gl.uniform1f(this._specularPowerUniform, this.specularPower); + this._gl.uniform1f(this._specularIntensityUniform, this.specularIntensity); + this._gl.uniform3fv(this._directionToKeyLightUniform, this.directionToKeyLight); + this._gl.uniform3fv(this._directionToFillLight1Uniform, this.directionToFillLight1); + this._gl.uniform3fv(this._directionToFillLight2Uniform, this.directionToFillLight2); + this._gl.uniform3fv(this._keyLightHalfAngleUniform, this.keyLightHalfAngle); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"d4boX":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Combine", ()=>Combine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Combine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class Combine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } get texture2D4() { - return this._texture2D4; + return this._texture2D4; } - set texture2D4(value) { - if (this._texture2D4 != value) { - this._texture2D4 = value; - this._haveTexturesChanged = true; - } + set texture2D4(value2) { + if (this._texture2D4 != value2) { + this._texture2D4 = value2; + this._haveTexturesChanged = true; + } } get texture2D5() { - return this._texture2D5; + return this._texture2D5; } - set texture2D5(value) { - if (this._texture2D5 != value) { - this._texture2D5 = value; - this._haveTexturesChanged = true; - } + set texture2D5(value2) { + if (this._texture2D5 != value2) { + this._texture2D5 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "combine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); - this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._intensityUniform = gl.getUniformLocation(this._program, "uIntensity"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._samplerUniform4 = gl.getUniformLocation(this._program, "uSampler4"); + this._samplerUniform5 = gl.getUniformLocation(this._program, "uSampler5"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); - this._gl.uniform1f(this._intensityUniform, this.intensity); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); - this._gl.uniform1i(this._samplerUniform4, 3); - this._gl.uniform1i(this._samplerUniform5, 4); + this._gl.uniform4f(this._viewportUniform, this.viewport.x, this.viewport.y, this.viewport.width, this.viewport.height); + this._gl.uniform1f(this._intensityUniform, this.intensity); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform1i(this._samplerUniform4, 3); + this._gl.uniform1i(this._samplerUniform5, 4); } updateBuffers() { - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - this._gl.activeTexture(this._gl.TEXTURE3); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); - this._gl.activeTexture(this._gl.TEXTURE4); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c0jpv":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofBlur", ()=>DofBlur); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofBlur extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + this._gl.activeTexture(this._gl.TEXTURE3); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D4); + this._gl.activeTexture(this._gl.TEXTURE4); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D5); + } + } + class DofBlur extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofblur.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); - this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); - this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._nearFocusDepthUniform = gl.getUniformLocation(this._program, "uNearFocusDepth"); + this._farFocusDepthUniform = gl.getUniformLocation(this._program, "uFarFocusDepth"); + this._maxBackgroundBlurUniform = gl.getUniformLocation(this._program, "uMaxBackgroundBlur"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); - this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); - this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._nearFocusDepthUniform, this.nearFocusDepth); + this._gl.uniform1f(this._farFocusDepthUniform, this.farFocusDepth); + this._gl.uniform1f(this._maxBackgroundBlurUniform, this.maxBackgroundBlur); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3sWXu":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Downsample", ()=>Downsample); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Downsample extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + } + } + class Downsample extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "downsample.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"g5wih":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Gaussian", ()=>Gaussian); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Gaussian extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Gaussian extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "gaussian.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._horizontalUniform = gl.getUniformLocation(this._program, "uHorizontal"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); - this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._horizontalUniform, this.horizontal ? 1 : 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dE6Xe":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "DofCombine", ()=>DofCombine); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class DofCombine extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class DofCombine extends ShaderBase { get texture2D1() { - return this._texture2D1; + return this._texture2D1; } - set texture2D1(value) { - if (this._texture2D1 != value) { - this._texture2D1 = value; - this._haveTexturesChanged = true; - } + set texture2D1(value2) { + if (this._texture2D1 != value2) { + this._texture2D1 = value2; + this._haveTexturesChanged = true; + } } get texture2D2() { - return this._texture2D2; + return this._texture2D2; } - set texture2D2(value) { - if (this._texture2D2 != value) { - this._texture2D2 = value; - this._haveTexturesChanged = true; - } + set texture2D2(value2) { + if (this._texture2D2 != value2) { + this._texture2D2 = value2; + this._haveTexturesChanged = true; + } } get texture2D3() { - return this._texture2D3; + return this._texture2D3; } - set texture2D3(value) { - if (this._texture2D3 != value) { - this._texture2D3 = value; - this._haveTexturesChanged = true; - } + set texture2D3(value2) { + if (this._texture2D3 != value2) { + this._texture2D3 = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "dofcombine.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); - this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); - this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); - this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); - this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._focusDepthUniform = gl.getUniformLocation(this._program, "uFocusDepth"); + this._apertureUniform = gl.getUniformLocation(this._program, "uAperture"); + this._samplerUniform1 = gl.getUniformLocation(this._program, "uSampler1"); + this._samplerUniform2 = gl.getUniformLocation(this._program, "uSampler2"); + this._samplerUniform3 = gl.getUniformLocation(this._program, "uSampler3"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); - this._gl.uniform1f(this._apertureUniform, this.aperture); - this._gl.uniform1i(this._samplerUniform1, 0); - this._gl.uniform1i(this._samplerUniform2, 1); - this._gl.uniform1i(this._samplerUniform3, 2); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1f(this._focusDepthUniform, this.focusDepth); + this._gl.uniform1f(this._apertureUniform, this.aperture); + this._gl.uniform1i(this._samplerUniform1, 0); + this._gl.uniform1i(this._samplerUniform2, 1); + this._gl.uniform1i(this._samplerUniform3, 2); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); - this._gl.activeTexture(this._gl.TEXTURE1); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); - this._gl.activeTexture(this._gl.TEXTURE2); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7EIbd":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Fxaa", ()=>Fxaa); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Fxaa extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D1); + this._gl.activeTexture(this._gl.TEXTURE1); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D2); + this._gl.activeTexture(this._gl.TEXTURE2); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D3); + } + } + class Fxaa extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "fxaa.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._viewportUniform = gl.getUniformLocation(this._program, "uViewport"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._isInitialized = true; } apply() { - this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); - this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform4f(this._viewportUniform, this.left, this.top, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3CyrI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Bright", ()=>Bright); -var _shaderJs = require("./shader.js"); -var _vertexJs = require("../../../vertex.js"); -class Bright extends (0, _shaderJs.ShaderBase) { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); + } + } + class Bright extends ShaderBase { get texture2D() { - return this._texture2D; + return this._texture2D; } - set texture2D(value) { - if (this._texture2D != value) { - this._texture2D = value; - this._haveTexturesChanged = true; - } + set texture2D(value2) { + if (this._texture2D != value2) { + this._texture2D = value2; + this._haveTexturesChanged = true; + } } initializeContext(gl) { - super.initializeContext(gl); - if (this._isLoaded) this._initializeShader(gl, this._vsSource, this._fsSource); - else this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource)=>{ - this._vsSource = vsSource; - this._fsSource = fsSource; - this._isLoaded = true; - this._initializeShader(gl, vsSource, fsSource); + super.initializeContext(gl); + if (this._isLoaded) { + this._initializeShader(gl, this._vsSource, this._fsSource); + } else { + this._shaderFromFile("simple.vertex.fx", "bright.fragment.fx", (vsSource, fsSource) => { + this._vsSource = vsSource; + this._fsSource = fsSource; + this._isLoaded = true; + this._initializeShader(gl, vsSource, fsSource); }); + } } _initializeShader(gl, vsSource, fsSource) { - const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); - const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); - this._program = this._createProgram(vs, fs); - this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); - this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); - this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); - this._isInitialized = true; + const vs = this._compileShader(vsSource, gl.VERTEX_SHADER); + const fs = this._compileShader(fsSource, gl.FRAGMENT_SHADER); + this._program = this._createProgram(vs, fs); + this._positionAttribute = gl.getAttribLocation(this._program, "aPosition"); + this._samplerUniform = gl.getUniformLocation(this._program, "uSampler"); + this._resolutionUniform = gl.getUniformLocation(this._program, "uResolution"); + this._isInitialized = true; } apply() { - this._gl.uniform1i(this._samplerUniform, 0); - this._gl.uniform2f(this._resolutionUniform, this.width, this.height); + this._gl.uniform1i(this._samplerUniform, 0); + this._gl.uniform2f(this._resolutionUniform, this.width, this.height); } updateBuffers() { - super.updateBuffers(); - super.updateBuffers(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, (0, _vertexJs.PositionVertex).SIZE_BYTES, 0); - this._gl.enableVertexAttribArray(this._positionAttribute); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - } - updateTextures() { - super.updateTextures(); - this._gl.activeTexture(this._gl.TEXTURE0); - this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); - } -} - -},{"./shader.js":"67Z4f","../../../vertex.js":"8lW8V","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"diZyK":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian2dVisual", ()=>Cartesian2dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _quadJs = require("../../../../meshes/quad.js"); -class Cartesian2dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian2dAxes){ - super(core); - this._main = main; - this._axes = cartesian2dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian2d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 2; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - _renderGrid() { - const gridShader = this._main.gridShader; - const axes = this._axes; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 2; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 2; edge++){ - const edgeId = (0, _quadJs.Quad).AXIS_EDGES[axisId][edge]; - if (axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - const axisId2 = 0; - const axisId3 = 1; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.gridFaceZero; - gridShader.minorGridlines = axes.gridFaceMinorGridlines; - for(let face = 0; face < 2; face++){ - const faceId = face; - if (axes.getIsForwardFace(faceId)) this._renderGridFace(faceId, width, height); - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width, height) { - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - const axes = this._axes; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"gLQPI","../../../../main.js":"b6Xbk","../../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gLQPI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AxesVisualBase", ()=>AxesVisualBase); -class AxesVisualBase { - get isInitialized() { - return this._isInitialized; - } - get axes() { - return this._axes; - } - constructor(core){ - this._core = core; - this.isVisible = true; - } - initializeContext(gl) { - this._gl = gl; + super.updateBuffers(); + super.updateBuffers(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.vertexAttribPointer(this._positionAttribute, 3, this._gl.FLOAT, false, PositionVertex.SIZE_BYTES, 0); + this._gl.enableVertexAttribArray(this._positionAttribute); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); } - update(elapsedTime) {} - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - this._renderGrid(); - this._renderText(); - } - } - _renderGrid() {} - _renderText() {} -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"24qTq":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Cartesian3dVisual", ()=>Cartesian3dVisual); -var _axesJs = require("./axes.js"); -var _mainJs = require("../../../../main.js"); -var _cubeJs = require("../../../../meshes/cube.js"); -class Cartesian3dVisual extends (0, _axesJs.AxesVisualBase) { - get isInitialized() { - return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; - } - constructor(core, main, cartesian3dAxes){ - super(core); - this._main = main; - this._axes = cartesian3dAxes; - this._axes.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - } - initializeContext(gl) { - super.initializeContext(gl); - const axes = this._axes; - if (!axes.isInitialized) axes.initialize(); - if (axes.gridVertices) this._createGridBuffers(); - if (axes.textVertices) this._createTextBuffers(); - this._isInitialized = true; - } - _createGridBuffers() { - const axes = this._axes; - this._gridVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); - this._gridIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); - this._gridBufferSize = axes.gridVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers created`); - } - _createTextBuffers() { - const axes = this._axes; - this._textVertexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); - this._textIndexBuffer = this._gl.createBuffer(); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); - this._textBufferSize = axes.textVertices.byteLength; - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers created`); - } - update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - const axes = this._axes; - if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) this._createGridBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual grid buffers updated`); - } - if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) this._createTextBuffers(); - else { - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); - this._core.log.write((0, _mainJs.LogLevel).info, `cartesian3d visual text buffers updated`); - } - this._main.shaderResources.currentProgram = null; - } - } - _renderText() { - const axes = this._axes; - const shader = this._main.sdfTextShader; - const shaderResources = this._main.shaderResources; - const fontVisual = this._main.fonts[axes.font.name]; - shader.vertexBuffer = this._textVertexBuffer; - shader.indexBuffer = this._textIndexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.gamma = axes.gamma; - shader.borderWidth = axes.textBorderWidth; - shader.color = axes.textColor || this._core.config.axesTextColor; - shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; - shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - let indexCount, indexOffset; - for(let axisId = 0; axisId < 3; axisId++){ - const orientation = axes.getLabelOrientation(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId)) { - if (axes.isEdgeVisible[edgeId]) { - if (orientation == (0, _mainJs.AxesTextOrientation).parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == (0, _mainJs.AxesTextOrientation).perpendicular && axes.getIsLeftToRightVertical(edgeId)) { - indexCount = axes.getAxesLeftToRightIndexCount(axisId); - indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); - } else { - indexCount = axes.getAxesRightToLeftIndexCount(axisId); - indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); - } - if (indexCount > 0) { - shader.mMatrix = axes.getLabelMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - indexCount = axes.getTitleIndexCount(axisId); - if (indexCount > 0) { - indexOffset = axes.getTitleIndexOffset(axisId); - shader.mMatrix = axes.getTitleMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - indexCount = axes.getHeadingIndexCount(axisId); - if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { - indexOffset = axes.getHeadingIndexOffset(axisId); - shader.mMatrix = axes.getHeadingMMatrix(edgeId); - shader.applyModel(); - shader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); - } - } - } - } - } - } - _renderGrid() { - const axes = this._axes; - const gridShader = this._main.gridShader; - gridShader.vertexBuffer = this._gridVertexBuffer; - gridShader.indexBuffer = this._gridIndexBuffer; - gridShader.prepare(); - gridShader.majorThickness = axes.gridMajorThickness; - gridShader.minorThickness = axes.gridMinorThickness; - gridShader.zeroThickness = axes.gridZeroThickness; - gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; - gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; - gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; - gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; - gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; - gridShader.pickedIdColor = this.pickedIdColor; - gridShader.apply(); - for(let axisId = 0; axisId < 3; axisId++)if (axes.arePickDivisionsVisible[axisId]) { - const gridTicksScale = axes.getGridTicksScale(axisId); - const width = gridTicksScale[0]; - const height = gridTicksScale[1]; - gridShader.zero = axes.getGridTicksZero(axisId); - gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); - for(let edge = 0; edge < 4; edge++){ - const edgeId = (0, _cubeJs.Cube).AXIS_EDGES[axisId][edge]; - if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) this._renderGridTicks(axisId, edgeId, width, height); - } - } - this._gl.disable(this._gl.CULL_FACE); - const size = axes.size; - for(let axisId = 0; axisId < 3; axisId++)if (axes.areFacesVisible[axisId]) { - const axisId2 = axisId == 0 ? 1 : 0; - const axisId3 = axisId == 2 ? 1 : 2; - const width = size[axisId2]; - const height = size[axisId3]; - gridShader.zero = axes.getGridFaceZero(axisId); - gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); - for(let face = 0; face < 2; face++){ - const faceId = (0, _cubeJs.Cube).AXIS_FACES[axisId][face]; - if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) this._renderGridFace(faceId, width, height); - } - } - this._gl.enable(this._gl.CULL_FACE); - } - _renderGridTicks(axisId, edgeId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); - } - } - _renderGridFace(faceId, width, height) { - const axes = this._axes; - const gridShader = this._main.gridShader; - const shaderResources = this._main.shaderResources; - gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); - gridShader.faceWidth = width; - gridShader.faceHeight = height; - gridShader.ApplyFace(); - gridShader.isPickShader = false; - shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - gridShader.vMatrix = this.vMatrices[viewport]; - gridShader.pMatrix = this.pMatrices[viewport]; - gridShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - if (this.isPickingEnabled && axes.isGridPickingEnabled) { - gridShader.isPickShader = true; - gridShader.vMatrix = this.pickVMatrix; - gridShader.pMatrix = this.pickPMatrix; - gridShader.applyView(); - shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); - } - } -} - -},{"./axes.js":"gLQPI","../../../../main.js":"b6Xbk","../../../../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"IvK0g":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _textureJs = require("../../helpers/texture.js"); -var _mainJs = require("../../main.js"); -class FontVisual { - get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; - } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - } - initializeContext(gl) { - this._gl = gl; - this._isInitialized = true; - if (this._font.count > 0) this._hasChanged = true; + updateTextures() { + super.updateTextures(); + this._gl.activeTexture(this._gl.TEXTURE0); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._texture2D); } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.texture = (0, _textureJs.TextureHelper).fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated`); - } - } -} - -},{"../../helpers/texture.js":"kVjwp","../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bPD4j":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelVisual", ()=>LabelVisual); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -class LabelVisualBase { + } + class AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; - } - constructor(core, main, label){ - this._core = core; - this._main = main; - this._label = label; - this._label.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._mMatrix = (0, _glMatrix.mat4).create(); - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + return this._isInitialized; + } + get axes() { + return this._axes; + } + constructor(core) { + this._core = core; + this.isVisible = true; } initializeContext(gl) { - if (!this._label.isInitialized) this._label.initialize(); - this._gl = gl; - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); - this._isInitialized = true; + this._gl = gl; } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); - this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); - } } render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const indexCount = this._label.indexCount; - if (indexCount > 0) { - const shader = this._main.sdfTextShader; - const fontVisual = this._main.fonts[this._label.font.name]; - shader.vertexBuffer = this._vertexBuffer; - shader.indexBuffer = this._indexBuffer; - shader.texture2D = fontVisual.texture; - shader.prepare(); - shader.gamma = this._label.gamma; - shader.buffer = fontVisual.font.edgeValue / 0xff; - shader.borderWidth = this._label.borderWidth; - shader.color = this._label.color || this._core.config.textColor; - shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; - shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; - shader.pickedIdColor = this.pickedIdColor; - shader.apply(); - (0, _glMatrix.mat4).multiply(this._mMatrix, this.mMatrix, this._label.mMatrix); - shader.mMatrix = this._mMatrix; - shader.applyModel(); - shader.isPickShader = false; - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ - const viewport = i + this.viewportOffset; - this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - shader.vMatrix = this.vMatrices[viewport]; - shader.pMatrix = this.pMatrices[viewport]; - shader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - if (this.isPickingEnabled) { - shader.isPickShader = true; - shader.pMatrix = this.pickPMatrix; - shader.vMatrix = this.pickVMatrix; - shader.applyView(); - this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); - this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); - this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); - } - } - } - } -} -class LabelVisual extends LabelVisualBase { - get label() { - return this._label; - } - set text(value) { - this._label.text = value; + if (this.isInitialized) { + this._renderGrid(); + this._renderText(); + } } - get text() { - return this._label.text; + _renderGrid() { } - constructor(core, main, label){ - super(core, main, label); + _renderText() { } -} -class LabelSetVisual extends LabelVisualBase { - get label() { - return this._label; - } - constructor(core, main, label){ - super(core, main, label); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7hNgE":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _textureJs = require("../../../helpers/texture.js"); -class ImageVisual { + } + class Cartesian2dVisual extends AxesVisualBase { get isInitialized() { - return this._isInitialized && this._main.textureShader.isInitialized; + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - get image() { - return this._image; - } - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this._image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this.mMatrix = (0, _glMatrix.mat4).create(); - this.isVisible = true; + constructor(core, main, cartesian2dAxes) { + super(core); + this._main = main; + this._axes = cartesian2dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - if (!this._image.isInitialized) this._image.initialize(); - this._gl = gl; - if (this._image.imageData) this.texture = (0, _textureJs.TextureHelper).fromImage(gl, this._image.imageData, false, gl.LINEAR); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); - this._isInitialized = true; + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; + } + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers created`); + } + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers created`); } update(elapsedTime) { - if (this._hasChanged) { - this._hasChanged = false; - this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); - this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); - this._main.shaderResources.currentProgram = null; + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian2d visual text buffers updated`); } + this._main.shaderResources.currentProgram = null; + } } - render(elapsedTime, xrFrame) { - if (this.isInitialized) { - const textureShader = this._main.textureShader; - textureShader.vertexBuffer = this._vertexBuffer; - textureShader.indexBuffer = this._indexBuffer; - textureShader.texture2D = this.texture; - textureShader.prepare(); - textureShader.mMatrix = this.mMatrix; - textureShader.apply(); - this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); - for(let i = 0; i < this.viewportCount; i++){ + _renderText() { + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 2; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { const viewport = i + this.viewportOffset; this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); - textureShader.vMatrix = this.vMatrices[viewport]; - textureShader.pMatrix = this.pMatrices[viewport]; - textureShader.applyView(); - this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } } + } } -} - -},{"gl-matrix":"erHGu","../../../helpers/texture.js":"kVjwp","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7afcI":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Lasso", ()=>Lasso); -var _constantsJs = require("../../../constants.js"); -var _quadJs = require("../../../meshes/quad.js"); -class Lasso { - get isInitialized() { - return this._isInitialized; + _renderGrid() { + const gridShader = this._main.gridShader; + const axes = this._axes; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 2; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width3 = gridTicksScale[0]; + const height3 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 2; edge++) { + const edgeId = Quad$2.AXIS_EDGES[axisId][edge]; + if (axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width3, height3); + } + } + } + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + const axisId2 = 0; + const axisId3 = 1; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.gridFaceZero; + gridShader.minorGridlines = axes.gridFaceMinorGridlines; + for (let face = 0; face < 2; face++) { + const faceId = face; + if (axes.getIsForwardFace(faceId)) { + this._renderGridFace(faceId, width2, height2); + } + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - get vertexBuffer() { - return this._vertexBuffer; + _renderGridFace(faceId, width2, height2) { + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + const axes = this._axes; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - get indexBuffer() { - return this._indexBuffer; + } + class Cartesian3dVisual extends AxesVisualBase { + get isInitialized() { + return this._isInitialized && this._main.gridShader.isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._axes.font.name].isInitialized; } - get indexCount() { - return this._indexCount; + constructor(core, main, cartesian3dAxes) { + super(core); + this._main = main; + this._axes = cartesian3dAxes; + this._axes.hasChangedCallback = () => { + this._hasChanged = true; + }; } initializeContext(gl) { - const vertices = (0, _quadJs.Quad).textured((0, _constantsJs.Constants).MAT4_IDENTITY); - this._vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); - const indices = (0, _quadJs.Quad).INDICES; - this._indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); - gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); - this._indexCount = indices.length; - this._isInitialized = true; - } -} - -},{"../../../constants.js":"dHTsY","../../../meshes/quad.js":"6dxCM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j817I":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>(0, _mainJs.Main)); -parcelHelpers.export(exports, "Material", ()=>(0, _materialJs.Material)); -parcelHelpers.export(exports, "MetalMaterial", ()=>(0, _materialJs.MetalMaterial)); -parcelHelpers.export(exports, "GlossyMaterial", ()=>(0, _materialJs.GlossyMaterial)); -parcelHelpers.export(exports, "VarnishMaterial", ()=>(0, _materialJs.VarnishMaterial)); -parcelHelpers.export(exports, "LambertianMaterial", ()=>(0, _materialJs.LambertianMaterial)); -parcelHelpers.export(exports, "DielectricMaterial", ()=>(0, _materialJs.DielectricMaterial)); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>(0, _materialJs.DiffuseLightMaterial)); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>(0, _materialJs.IsotropicMaterial)); -parcelHelpers.export(exports, "Texture", ()=>(0, _textureJs.Texture)); -parcelHelpers.export(exports, "SolidColorTexture", ()=>(0, _textureJs.SolidColorTexture)); -parcelHelpers.export(exports, "ImageTexture", ()=>(0, _textureJs.ImageTexture)); -parcelHelpers.export(exports, "CheckerTexture", ()=>(0, _textureJs.CheckerTexture)); -parcelHelpers.export(exports, "GridTexture", ()=>(0, _textureJs.GridTexture)); -parcelHelpers.export(exports, "Light", ()=>(0, _lightJs.Light)); -parcelHelpers.export(exports, "SphereLight", ()=>(0, _lightJs.SphereLight)); -parcelHelpers.export(exports, "RectLight", ()=>(0, _lightJs.RectLight)); -parcelHelpers.export(exports, "Ground", ()=>(0, _groundJs.Ground)); -parcelHelpers.export(exports, "Constants", ()=>(0, _constantsJs.Constants)); -var _mainJs = require("./main.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _groundJs = require("./ground.js"); -var _constantsJs = require("./constants.js"); - -},{"./main.js":"dV6n9","./material.js":"ewL2a","./texture.js":"f9eG4","./light.js":"inb41","./ground.js":"b3WSb","./constants.js":"lFJgO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dV6n9":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Main", ()=>Main); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _mainJs = require("../../main.js"); -var _configJs = require("./config.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _raytraceJs = require("./shaders/raytrace.js"); -var _fullscreenquadJs = require("./shaders/fullscreenquad.js"); -var _bvhJs = require("./bvh.js"); -var _textureJs = require("./texture.js"); -var _lightJs = require("./light.js"); -var _constantsJs = require("../../constants.js"); -var _angleJs = require("../../helpers/angle.js"); -var _fontJs = require("./font.js"); -var _imageJs = require("./image.js"); -var _labelsJs = require("./labels.js"); -var _bufferJs = require("./buffer.js"); -var _constantsJs1 = require("./constants.js"); -var __awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -class Main extends (0, _rendererJs.RendererBase) { - get frameCount() { - return this._frameCount; - } - get duration() { - return this._duration; - } - get config() { - return this._config; - } - set lights(value) { - if (value != this._lights) { - this._lights = value; - this._haveLightsChanged = true; - this._frameCount = 0; - } - } - get lights() { - return this._lights; - } - restart() { - this._frameCount = 0; - this._core.start(); - } - constructor(options){ - super(options); - (0, _glMatrix.glMatrix).setMatrixArrayType(Float32Array); - this._config = new (0, _configJs.Config)(); - this._frameCount = 0; - this._duration = 0; - this._position = (0, _glMatrix.vec3).create(); - this._right = (0, _glMatrix.vec3).create(); - this._up = (0, _glMatrix.vec3).create(); - this._forward = (0, _glMatrix.vec3).create(); - this._modelPosition = (0, _glMatrix.vec3).create(); - this._manipulationOrigin = (0, _glMatrix.vec3).create(); - this._backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); + super.initializeContext(gl); + const axes = this._axes; + if (!axes.isInitialized) { + axes.initialize(); + } + if (axes.gridVertices) { + this._createGridBuffers(); + } + if (axes.textVertices) { + this._createTextBuffers(); + } + this._isInitialized = true; } - initialize(core) { - super.initialize(core); - this._hittables = []; - this._lightBuffer = null; - this._worldCreated = false; - this._initializeAPI().then(()=>{ - this._initializeResources(); - }); + _createGridBuffers() { + const axes = this._axes; + this._gridVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.gridVertices, this._gl.STATIC_DRAW); + this._gridIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.gridIndices, this._gl.STATIC_DRAW); + this._gridBufferSize = axes.gridVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers created`); } - _initializeAPI() { - return __awaiter(this, void 0, void 0, function*() { - try { - const start = window.performance.now(); - const gpu = navigator.gpu; - this._presentationFormat = gpu.getPreferredCanvasFormat(); - this._adapter = yield gpu.requestAdapter(); - const gpuDeviceDescriptor = { - requiredLimits: { - maxStorageBufferBindingSize: 134217728, - maxComputeWorkgroupsPerDimension: 256 - } - }; - this._device = yield this._adapter.requestDevice(gpuDeviceDescriptor); - this._queue = this._device.queue; - this._context = this._canvas.getContext("webgpu"); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU API initialized ${Math.round(window.performance.now() - start)}ms`); - } catch (e) { - this._core.log.write((0, _mainJs.LogLevel).error, e); - return false; - } - return true; - }); + _createTextBuffers() { + const axes = this._axes; + this._textVertexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferData(this._gl.ARRAY_BUFFER, axes.textVertices, this._gl.STATIC_DRAW); + this._textIndexBuffer = this._gl.createBuffer(); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, axes.textIndices, this._gl.STATIC_DRAW); + this._textBufferSize = axes.textVertices.byteLength; + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers created`); } - _initializeResources() { - const start = window.performance.now(); - const canvasConfig = { - device: this._device, - format: this._presentationFormat, - alphaMode: "premultiplied" - }; - this._context.configure(canvasConfig); - const computeUniformBufferDescriptor = { - label: "Compute uniform buffer", - size: (0, _raytraceJs.ComputeUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._computeUniformBuffer = this._device.createBuffer(computeUniformBufferDescriptor); - this._computeUniformBufferData = new (0, _raytraceJs.ComputeUniformBufferData)(); - const depthMinMaxBufferDescriptor = { - label: "Depth min max buffer", - size: 8, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - this._depthMinMaxBuffer = this._device.createBuffer(depthMinMaxBufferDescriptor); - const depthMinMaxBufferResultDescriptor = { - label: "Depth min max result buffer", - size: 8, - usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.MAP_READ - }; - this._depthMinMaxResultBuffer = this._device.createBuffer(depthMinMaxBufferResultDescriptor); - const fullscreenQuadUniformBufferDescriptor = { - label: "Full screen quad uniform buffer", - size: (0, _fullscreenquadJs.FullscreenQuadUniformBufferData).SIZE * 4, - usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST - }; - this._fullscreenQuadUniformBuffer = this._device.createBuffer(fullscreenQuadUniformBufferDescriptor); - this._fullscreenQuadUniformBufferData = new (0, _fullscreenquadJs.FullscreenQuadUniformBufferData)(); - this._sampler = this._device.createSampler({ - label: "Sampler", - magFilter: "linear", - minFilter: "linear" - }); - for(const key in this.fonts){ - const fontVisual = this.fonts[key]; - fontVisual.initializeContext(this._device); - fontVisual.update(); - } - for(let i = 0; i < this.images.length; i++){ - const image = this.images[i]; - image.initializeContext(this._device); - image.update(); - } - const textureSize = { - width: 1, - height: 1 - }; - const textureDescriptor = { - label: "Placeholder texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._texture = this._device.createTexture(textureDescriptor); - this._core.log.write((0, _mainJs.LogLevel).info, `WebGPU resources initialized ${Math.round(window.performance.now() - start)}ms`); - this._isInitialized = true; + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + const axes = this._axes; + if (!this._gridVertexBuffer || axes.gridVertices.byteLength > this._gridBufferSize) { + this._createGridBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._gridVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.gridVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._gridIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.gridIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual grid buffers updated`); + } + if (!this._textVertexBuffer || axes.textVertices.byteLength > this._textBufferSize) { + this._createTextBuffers(); + } else { + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._textVertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, axes.textVertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._textIndexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, axes.textIndices); + this._core.log.write(LogLevel.info, `cartesian3d visual text buffers updated`); + } + this._main.shaderResources.currentProgram = null; + } } - get isSupported() { - return navigator.gpu !== undefined; - } - _createWorld() { - return __awaiter(this, void 0, void 0, function*() { - const start = performance.now(); - this._hittables = this._getHittables(); - if (this._hittables.length == 0) return; - const bvhAccel = new (0, _bvhJs.BVHAccel)(this._core, this._hittables, this._config.maxPrimsInNode, (0, _bvhJs.SplitMethod).sah); - const hittables = bvhAccel.orderedPrimitives; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const atlas = transitionBuffer.currentAtlas; - if (atlas.imageData) { - const imageData = atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - yield createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - label: "Atlas texture", - size: textureSize, - format: this._presentationFormat, - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._atlasTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this._atlasTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `atlas texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - break; - } + _renderText() { + const axes = this._axes; + const shader = this._main.sdfTextShader; + const shaderResources = this._main.shaderResources; + const fontVisual = this._main.fonts[axes.font.name]; + shader.vertexBuffer = this._textVertexBuffer; + shader.indexBuffer = this._textIndexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.buffer = fontVisual.font.edgeValue / 255; + shader.gamma = axes.gamma; + shader.borderWidth = axes.textBorderWidth; + shader.color = axes.textColor || this._core.config.axesTextColor; + shader.hoverColor = axes.textHoverColor || this._core.config.axesTextHoverColor; + shader.borderColor = axes.textBorderColor || this._core.config.textBorderColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + let indexCount, indexOffset; + for (let axisId = 0; axisId < 3; axisId++) { + const orientation = axes.getLabelOrientation(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId)) { + if (axes.isEdgeVisible[edgeId]) { + if (orientation == AxesTextOrientation.parallel && axes.getIsLeftToRightHorizontal(edgeId) || orientation == AxesTextOrientation.perpendicular && axes.getIsLeftToRightVertical(edgeId)) { + indexCount = axes.getAxesLeftToRightIndexCount(axisId); + indexOffset = axes.getAxesLeftToRightIndexOffset(axisId); + } else { + indexCount = axes.getAxesRightToLeftIndexCount(axisId); + indexOffset = axes.getAxesRightToLeftIndexOffset(axisId); + } + if (indexCount > 0) { + shader.mMatrix = axes.getLabelMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } - } - const materials = []; - const materialIds = []; - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - const material = hittable.material; - let materialId; - let found; - for(let j = 0; j < materials.length; j++)if (materials[j] === material) { - found = true; - materialId = j; - break; + if (this.isPickingEnabled && axes.isLabelPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } - if (!found) { - materialId = materials.length; - materials.push(material); + } + indexCount = axes.getTitleIndexCount(axisId); + if (indexCount > 0) { + indexOffset = axes.getTitleIndexOffset(axisId); + shader.mMatrix = axes.getTitleMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); } - materialIds.push(materialId); - } - const textures = []; - const textureIds = []; - for(let i = 0; i < materials.length; i++){ - const material = materials[i]; - const texture = material.texture; - if (texture) { - let textureId; - let found; - for(let j = 0; j < textures.length; j++)if (textures[j] === texture) { - found = true; - textureId = j; - break; - } - if (!found) { - textureId = textures.length; - textures.push(texture); - if (texture instanceof (0, _textureJs.ImageTexture)) { - const imageData = texture.image; - if (imageData) { - let start = performance.now(); - const imageDataLinear = new ImageData(imageData.width, imageData.height); - for(let i = 0; i < imageData.data.length; i++)imageDataLinear.data[i] = Math.pow(imageData.data[i] / 0xff, 2.2) * 0xff; - this._core.log.write((0, _mainJs.LogLevel).info, `image inverse gamma ${Math.round(window.performance.now() - start)}ms`); - start = window.performance.now(); - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageDataLinear).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this._backgroundTexture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap, - flipY: true - }; - const imageCopyTextureTagged = { - texture: this._backgroundTexture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - this._core.log.write((0, _mainJs.LogLevel).info, `background image updated ${Math.round(window.performance.now() - start)}ms`); - }); - } - } - } - textureIds.push(textureId); - } else textureIds.push(0); - } - const textureBufferSizeBytes = textures.length * (0, _textureJs.TextureBufferData).SIZE * 4; - const textureBufferDescriptor = { - label: "Texture buffer", - size: textureBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._textureBuffer = this._device.createBuffer(textureBufferDescriptor); - this._textureBufferData = new (0, _textureJs.TextureBufferData)(textures.length); - for(let i = 0; i < textures.length; i++)textures[i].toBuffer(this._textureBufferData, i); - const materialBufferSizeBytes = materials.length * (0, _materialJs.MaterialBufferData).SIZE * 4; - const materialBufferDescriptor = { - label: "Material buffer", - size: materialBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._materialBuffer = this._device.createBuffer(materialBufferDescriptor); - this._materialBufferData = new (0, _materialJs.MaterialBufferData)(materials.length); - for(let i = 0; i < materials.length; i++)materials[i].toBuffer(this._materialBufferData, i, textureIds[i]); - const hittableBufferSizeBytes = hittables.length * (0, _hittableJs.HittableBufferData).SIZE * 4; - const hittableBufferDescriptor = { - label: "Hittable buffer", - size: hittableBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._hittableBuffer = this._device.createBuffer(hittableBufferDescriptor); - this._hittableBufferData = new (0, _hittableJs.HittableBufferData)(hittables.length); - for(let i = 0; i < hittables.length; i++){ - const hittable = hittables[i]; - hittable.toBuffer(this._hittableBufferData, i, materialIds[i]); + if (this.isPickingEnabled && axes.isTitlePickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + } + } + indexCount = axes.getHeadingIndexCount(axisId); + if (indexCount > 0 && axes.isHeadingVisible[edgeId]) { + indexOffset = axes.getHeadingIndexOffset(axisId); + shader.mMatrix = axes.getHeadingMMatrix(edgeId); + shader.applyModel(); + shader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } + if (this.isPickingEnabled && axes.isHeadingPickingEnabled[axisId]) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, indexOffset * 2); + } } - const linearBVHNodes = bvhAccel.nodes; - const linearBVHNodeBufferSizeBytes = linearBVHNodes.length * (0, _bvhJs.LinearBVHNodeBufferData).SIZE * 4; - const linearBVHNodeBufferDescriptor = { - label: "Linear BVH node buffer", - size: linearBVHNodeBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._linearBVHNodeBuffer = this._device.createBuffer(linearBVHNodeBufferDescriptor); - this._linearBVHNodeBufferData = new (0, _bvhJs.LinearBVHNodeBufferData)(linearBVHNodes.length); - for(let i = 0; i < linearBVHNodes.length; i++)linearBVHNodes[i].toBuffer(this._linearBVHNodeBufferData, i); - this._device.queue.writeBuffer(this._hittableBuffer, 0, this._hittableBufferData.buffer, this._hittableBufferData.byteOffset, this._hittableBufferData.byteLength); - this._device.queue.writeBuffer(this._materialBuffer, 0, this._materialBufferData.buffer, this._materialBufferData.byteOffset, this._materialBufferData.byteLength); - this._device.queue.writeBuffer(this._textureBuffer, 0, this._textureBufferData.buffer, this._textureBufferData.byteOffset, this._textureBufferData.byteLength); - this._device.queue.writeBuffer(this._linearBVHNodeBuffer, 0, this._linearBVHNodeBufferData.buffer, this._linearBVHNodeBufferData.byteOffset, this._linearBVHNodeBufferData.byteLength); - this._core.log.write((0, _mainJs.LogLevel).info, `create world ${Math.round(window.performance.now() - start)}ms`); - }); - } - _createLights() { - if (!this._lights || this._lights.length == 0) return; - const modelScale = this._core.getModelScale(); - (0, _glMatrix.vec3).set(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - if (!this._lightBuffer) { - const lightBufferSizeBytes = this._lights.length * (0, _lightJs.LightBufferData).SIZE * 4; - const lightBufferDescriptor = { - label: "Light buffer", - size: lightBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST - }; - this._lightBuffer = this._device.createBuffer(lightBufferDescriptor); - this._lightBufferData = new (0, _lightJs.LightBufferData)(this._lights.length); - } - for(let i = 0; i < this._lights.length; i++){ - const light = this._lights[i]; - let lightCopy; - if (light instanceof (0, _lightJs.RectLight)) lightCopy = new (0, _lightJs.RectLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - rotation: (0, _glMatrix.quat).clone(light.rotation), - size: (0, _glMatrix.vec2).fromValues(light.size[0] * modelScale, light.size[1] * modelScale) - }); - else if (light instanceof (0, _lightJs.SphereLight)) lightCopy = new (0, _lightJs.SphereLight)({ - center: (0, _glMatrix.vec3).clone(light.center), - color: (0, _glMatrix.vec3).clone(light.color), - radius: light.radius * modelScale - }); - (0, _glMatrix.vec3).scale(lightCopy.center, lightCopy.center, modelScale); - (0, _glMatrix.vec3).add(lightCopy.center, lightCopy.center, this._modelPosition); - lightCopy.toBuffer(this._lightBufferData, i); - } - this._device.queue.writeBuffer(this._lightBuffer, 0, this._lightBufferData.buffer, this._lightBufferData.byteOffset, this._lightBufferData.byteLength); - this._areLightsInitialized = true; - } - standardLighting(lights) { - lights || (lights = this._config.standardLightingOptions()); - const rectLights = []; - for(let i = 0; i < lights.length; i++){ - const light = lights[i]; - const center = (0, _glMatrix.vec3).create(); - const rotation = (0, _glMatrix.quat).create(); - const azimuth = (0, _angleJs.AngleHelper).degreesToRadians(light.azimuth); - const altitude = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, azimuth); - (0, _glMatrix.quat).rotateX(rotation, rotation, altitude); - (0, _glMatrix.vec3).transformQuat(center, (0, _constantsJs.Constants).VECTOR3_UNITZ, rotation); - (0, _glMatrix.vec3).scale(center, center, light.distance); - const yaw = (0, _angleJs.AngleHelper).degreesToRadians(light.yaw); - const pitch = (0, _angleJs.AngleHelper).degreesToRadians(-light.altitude); - (0, _glMatrix.quat).rotateY(rotation, (0, _constantsJs.Constants).QUAT_IDENTITY, yaw); - (0, _glMatrix.quat).rotateX(rotation, rotation, pitch); - rectLights.push(new (0, _lightJs.RectLight)({ - center: center, - rotation: rotation, - size: light.size, - color: light.color - })); + } } - return rectLights; + } } - _getHittables() { - const hittables = []; - let minY = Number.MAX_VALUE; - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible && transitionBuffer.hittables && transitionBuffer.hittables.length > 0) { - minY = Math.min(minY, transitionBuffer.minY); - for(let j = 0; j < transitionBuffer.hittables.length; j++)hittables.push(transitionBuffer.hittables[j]); - } - } - if (this.labelSets && this.labelSets.length > 0) for(let i = 0; i < this.labelSets.length; i++){ - const labelSet = this.labelSets[i]; - if (labelSet.hittables) for(let j = 0; j < labelSet.hittables.length; j++)hittables.push(labelSet.hittables[j]); - } - if (this.images && this.images.length > 0) { - for(let i = 0; i < this.images.length; i++)if (this.images[i].hittable) { - const hittable = this.images[i].hittable; - hittables.push(hittable); - minY = Math.min(hittable.bounds.min[1], minY); - } + _renderGrid() { + const axes = this._axes; + const gridShader = this._main.gridShader; + gridShader.vertexBuffer = this._gridVertexBuffer; + gridShader.indexBuffer = this._gridIndexBuffer; + gridShader.prepare(); + gridShader.majorThickness = axes.gridMajorThickness; + gridShader.minorThickness = axes.gridMinorThickness; + gridShader.zeroThickness = axes.gridZeroThickness; + gridShader.backgroundColor = axes.gridBackgroundColor || this._core.config.axesGridBackgroundColor; + gridShader.highlightColor = axes.gridHighlightColor || this._core.config.axesGridHighlightColor; + gridShader.majorColor = axes.gridMajorColor || this._core.config.axesGridMajorColor; + gridShader.minorColor = axes.gridMinorColor || this._core.config.axesGridMinorColor; + gridShader.zeroColor = axes.gridZeroColor || this._core.config.axesGridZeroColor; + gridShader.pickedIdColor = this.pickedIdColor; + gridShader.apply(); + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.arePickDivisionsVisible[axisId]) { + const gridTicksScale = axes.getGridTicksScale(axisId); + const width2 = gridTicksScale[0]; + const height2 = gridTicksScale[1]; + gridShader.zero = axes.getGridTicksZero(axisId); + gridShader.minorGridlines = axes.getGridTicksMinorGridlines(axisId); + for (let edge = 0; edge < 4; edge++) { + const edgeId = Cube.AXIS_EDGES[axisId][edge]; + if (axes.getIsOutsideEdge(edgeId) && axes.isEdgeVisible[edgeId]) { + this._renderGridTicks(axisId, edgeId, width2, height2); + } + } } - if (this.ground) { - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); - const groundSize = (0, _glMatrix.vec2).create(); - const groundPosition = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec2).scale(groundSize, this.ground.size || this._config.groundSize, modelScale); - if (this.ground.position) (0, _glMatrix.vec3).scale(groundPosition, this.ground.position, modelScale); - else (0, _glMatrix.vec3).set(groundPosition, 0, minY - (0, _constantsJs1.Constants).SHADOW_OFFSET, 0); - const options = { - size0: groundSize, - size1: groundSize, - center0: groundPosition, - center1: groundPosition, - time0: 1, - time1: 1, - texCoord0: (0, _glMatrix.vec2).fromValues(0, 0), - texCoord1: (0, _glMatrix.vec2).fromValues(1, 1), - material: this.ground.material || this.config.defaultMaterial - }; - (0, _glMatrix.vec3).add(options.center0, options.center0, modelPosition); - hittables.push(new (0, _hittableJs.HittableXzRect)(options)); + } + this._gl.disable(this._gl.CULL_FACE); + const size = axes.size; + for (let axisId = 0; axisId < 3; axisId++) { + if (axes.areFacesVisible[axisId]) { + const axisId2 = axisId == 0 ? 1 : 0; + const axisId3 = axisId == 2 ? 1 : 2; + const width2 = size[axisId2]; + const height2 = size[axisId3]; + gridShader.zero = axes.getGridFaceZero(axisId); + gridShader.minorGridlines = axes.getGridFaceMinorGridlines(axisId); + for (let face = 0; face < 2; face++) { + const faceId = Cube.AXIS_FACES[axisId][face]; + if (axes.getIsForwardFace(faceId) && axes.isFaceVisible[faceId]) { + this._renderGridFace(faceId, width2, height2); + } + } } - return hittables; + } + this._gl.enable(this._gl.CULL_FACE); + } + _renderGridTicks(axisId, edgeId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridTicksMMatrix(edgeId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } + if (this.isPickingEnabled && axes.isDivisionPickingEnabled[axisId]) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridTicksIndexCount(axisId), this._gl.UNSIGNED_SHORT, axes.getGridTicksIndexOffset(axisId) * 2); + } } - createFontVisual(font) { - const visual = new (0, _fontJs.FontVisual)(this._core, font); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + _renderGridFace(faceId, width2, height2) { + const axes = this._axes; + const gridShader = this._main.gridShader; + const shaderResources = this._main.shaderResources; + gridShader.mMatrix = axes.getGridFaceMMatrix(faceId); + gridShader.faceWidth = width2; + gridShader.faceHeight = height2; + gridShader.ApplyFace(); + gridShader.isPickShader = false; + shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + gridShader.vMatrix = this.vMatrices[viewport]; + gridShader.pMatrix = this.pMatrices[viewport]; + gridShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } + if (this.isPickingEnabled && axes.isGridPickingEnabled) { + gridShader.isPickShader = true; + gridShader.vMatrix = this.pickVMatrix; + gridShader.pMatrix = this.pickPMatrix; + gridShader.applyView(); + shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, axes.getGridFaceIndexCount(faceId), this._gl.UNSIGNED_SHORT, axes.getGridFaceIndexOffset(faceId) * 2); + } } - createImageVisual(image) { - const visual = new (0, _imageJs.ImageVisual)(this._core, this, image); - if (this._isInitialized) visual.initializeContext(this._device); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + } + class FontVisual { + get isInitialized() { + return this._isInitialized; } - createLabelSetVisual(labelSet) { - const visual = new (0, _labelsJs.LabelSetVisual)(this._core, this, labelSet); - visual.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return visual; + get font() { + return this._font; } - createTransitionBuffer(ids) { - const transitionBuffer = new (0, _bufferJs.TransitionBuffer)(this._core, this, ids); - transitionBuffer.hasChangedCallback = ()=>{ - this._hasWorldChanged = true; - }; - return transitionBuffer; - } - _resizeBackings() { - const width = this.width; - const height = this.height; - const colorChannels = 3; - const outputColorBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * colorChannels; - const outputColorBufferDescriptor = { - label: "Output color buffer", - size: outputColorBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputColorBuffer = this._device.createBuffer(outputColorBufferDescriptor); - const outputNormalDepthBufferSizeBytes = Uint32Array.BYTES_PER_ELEMENT * width * height * 4; - const outputDepthBufferDescriptor = { - label: "Output normal depth buffer", - size: outputNormalDepthBufferSizeBytes, - usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC - }; - const outputNormalDepthBuffer = this._device.createBuffer(outputDepthBufferDescriptor); - const computeShaderModuleDescriptor = { - code: (0, _raytraceJs.ComputeShaderWgsl) - }; - const computeModule = this._device.createShaderModule(computeShaderModuleDescriptor); - const computeBindGroupLayoutDescriptor = { - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 1, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "uniform" - } - }, - { - binding: 2, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 3, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 4, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 5, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 6, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 7, - visibility: GPUShaderStage.COMPUTE, - sampler: { - type: "filtering" - } - }, - { - binding: 8, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 9, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 10, - visibility: GPUShaderStage.COMPUTE, - texture: { - multisampled: false, - sampleType: "float", - viewDimension: "2d" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const computeBindGroupLayout = this._device.createBindGroupLayout(computeBindGroupLayoutDescriptor); - const computeBindGroupDescriptor = { - label: "Compute bind group descriptor", - layout: computeBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 1, - resource: { - buffer: this._computeUniformBuffer - } - }, - { - binding: 2, - resource: { - buffer: this._hittableBuffer - } - }, - { - binding: 3, - resource: { - buffer: this._materialBuffer - } - }, - { - binding: 4, - resource: { - buffer: this._textureBuffer - } - }, - { - binding: 5, - resource: { - buffer: this._lightBuffer - } - }, - { - binding: 6, - resource: { - buffer: this._linearBVHNodeBuffer - } - }, - { - binding: 7, - resource: this._sampler - }, - { - binding: 8, - resource: (this.fonts[this._core.font.name].texture || this._texture).createView() - }, - { - binding: 9, - resource: (this._backgroundTexture || this._texture).createView() - }, - { - binding: 10, - resource: (this._atlasTexture || this._texture).createView() - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._computeBindGroup = this._device.createBindGroup(computeBindGroupDescriptor); - const computePipelineLayoutDescriptor = { - label: "Compute pipeline layout descriptor", - bindGroupLayouts: [ - computeBindGroupLayout - ] - }; - const computePipelineLayout = this._device.createPipelineLayout(computePipelineLayoutDescriptor); - const compute = { - module: computeModule, - entryPoint: "main" - }; - const computePipelineDescriptor = { - label: "Compute pipeline descriptor", - layout: computePipelineLayout, - compute: compute - }; - this._computePipeline = this._device.createComputePipeline(computePipelineDescriptor); - const computeDepthNormal = { - module: computeModule, - entryPoint: "depthNormal" - }; - const computeDepthNormalPipelineDescriptor = { - label: "Depth normal pipeline descriptor", - layout: computePipelineLayout, - compute: computeDepthNormal - }; - this._computeDepthNormalPipeline = this._device.createComputePipeline(computeDepthNormalPipelineDescriptor); - const computeSegment = { - module: computeModule, - entryPoint: "segment" - }; - const computeSegmentPipelineDescriptor = { - label: "Segment pipeline descriptor", - layout: computePipelineLayout, - compute: computeSegment - }; - this._computeSegmentPipeline = this._device.createComputePipeline(computeSegmentPipelineDescriptor); - const clearBindGroupLayoutDescriptor = { - label: "Clear bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 11, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - }, - { - binding: 12, - visibility: GPUShaderStage.COMPUTE, - buffer: { - type: "storage" - } - } - ] - }; - const clearBindGroupLayout = this._device.createBindGroupLayout(clearBindGroupLayoutDescriptor); - const clearBindGroupDescriptor = { - label: "Clear bind group descriptor", - layout: clearBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 11, - resource: { - buffer: outputNormalDepthBuffer - } - }, - { - binding: 12, - resource: { - buffer: this._depthMinMaxBuffer - } - } - ] - }; - this._clearBindGroup = this._device.createBindGroup(clearBindGroupDescriptor); - const clearPipelineLayoutDescriptor = { - label: "Clear pipeline layout descriptor", - bindGroupLayouts: [ - clearBindGroupLayout - ] - }; - const clearPipelineLayout = this._device.createPipelineLayout(clearPipelineLayoutDescriptor); - const clear = { - module: computeModule, - entryPoint: "clear" - }; - const clearPipelineDescriptor = { - label: "Clear pipeline descriptor", - layout: clearPipelineLayout, - compute: clear - }; - this._clearPipeline = this._device.createComputePipeline(clearPipelineDescriptor); - const fullscreenQuadShaderDescriptor = { - label: "Fullscreen quad shader descriptor", - code: (0, _fullscreenquadJs.FullscreenQuadWgsl) - }; - const fullscreenQuadModule = this._device.createShaderModule(fullscreenQuadShaderDescriptor); - const fullscreenQuadBindGroupLayoutDescriptor = { - label: "Fullscreen quad bind group layout descriptor", - entries: [ - { - binding: 0, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "uniform" - } - }, - { - binding: 1, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - }, - { - binding: 2, - visibility: GPUShaderStage.FRAGMENT, - buffer: { - type: "read-only-storage" - } - } - ] - }; - const fullscreenQuadBindGroupLayout = this._device.createBindGroupLayout(fullscreenQuadBindGroupLayoutDescriptor); - const fullscreenQuadPipelineLayoutDescriptor = { - label: "Fullscreen quad pipeline layout descriptor", - bindGroupLayouts: [ - fullscreenQuadBindGroupLayout - ] - }; - const fullscreenQuadPipelineLayout = this._device.createPipelineLayout(fullscreenQuadPipelineLayoutDescriptor); - const vertex = { - module: fullscreenQuadModule, - entryPoint: "vert_main" - }; - const primitive = { - topology: "triangle-list" - }; - const colorState = { - format: this._presentationFormat - }; - const fragment = { - module: fullscreenQuadModule, - entryPoint: "frag_main", - targets: [ - colorState - ] - }; - const fullscreenQuadPiplelineDescriptor = { - label: "Fullscreen quad pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragment, - primitive: primitive - }; - this._fullscreenQuadPipeline = this._device.createRenderPipeline(fullscreenQuadPiplelineDescriptor); - const fullscreenQuadBindGroupDescriptor = { - label: "Fullscreen quad bind group descriptor", - layout: fullscreenQuadBindGroupLayout, - entries: [ - { - binding: 0, - resource: { - buffer: this._fullscreenQuadUniformBuffer - } - }, - { - binding: 1, - resource: { - buffer: outputColorBuffer - } - }, - { - binding: 2, - resource: { - buffer: outputNormalDepthBuffer - } - } - ] - }; - this._fullscreenQuadBindGroup = this._device.createBindGroup(fullscreenQuadBindGroupDescriptor); - const fragmentHdr = { - module: fullscreenQuadModule, - entryPoint: "frag_main_hdr", - targets: [ - colorState - ] - }; - const fullscreenQuadHdrPiplelineDescriptor = { - label: "Fullscreen quad HDR pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentHdr, - primitive: primitive - }; - this._fullscreenQuadHdrPipeline = this._device.createRenderPipeline(fullscreenQuadHdrPiplelineDescriptor); - const fragmentDepth = { - module: fullscreenQuadModule, - entryPoint: "frag_depth", - targets: [ - colorState - ] - }; - const fullscreenQuadDepthPiplelineDescriptor = { - label: "Fullscreen quad depth pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentDepth, - primitive: primitive - }; - this._fullscreenQuadDepthPipeline = this._device.createRenderPipeline(fullscreenQuadDepthPiplelineDescriptor); - const fragmentNormal = { - module: fullscreenQuadModule, - entryPoint: "frag_normal", - targets: [ - colorState - ] - }; - const fullscreenQuadNormalPiplelineDescriptor = { - label: "Fullscreen quad normal pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentNormal, - primitive: primitive - }; - this._fullscreenQuadNormalPipeline = this._device.createRenderPipeline(fullscreenQuadNormalPiplelineDescriptor); - const fragmentEdge = { - module: fullscreenQuadModule, - entryPoint: "frag_edge", - targets: [ - colorState - ] - }; - const fullscreenQuadEdgePiplelineDescriptor = { - label: "Fullscreen quad edge pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentEdge, - primitive: primitive - }; - this._fullscreenQuadEdgePipeline = this._device.createRenderPipeline(fullscreenQuadEdgePiplelineDescriptor); - const fragmentSegment = { - module: fullscreenQuadModule, - entryPoint: "frag_segment", - targets: [ - colorState - ] - }; - const fullscreenQuadSegmentPiplelineDescriptor = { - label: "Fullscreen quad segment pipeline descriptor", - layout: fullscreenQuadPipelineLayout, - vertex: vertex, - fragment: fragmentSegment, - primitive: primitive - }; - this._fullscreenQuadSegmentPipeline = this._device.createRenderPipeline(fullscreenQuadSegmentPiplelineDescriptor); - this._computeUniformBufferData.setWidth(width); - this._computeUniformBufferData.setHeight(height); - this._fullscreenQuadUniformBufferData.setWidth(width); - this._fullscreenQuadUniformBufferData.setHeight(height); - this._computeUniformBufferData.setTime0(0); - this._computeUniformBufferData.setTime1(1); - this._computeDispatchCount = Math.min(Math.ceil(width * height / 256), this._device.limits.maxComputeWorkgroupsPerDimension); - this._frameCount = 0; - this._core.log.write((0, _mainJs.LogLevel).info, "backings resized"); + constructor(core, font2) { + this._core = core; + this._font = font2; + font2.hasChangedCallback = () => { + this._hasChanged = true; + }; + } + initializeContext(gl) { + this._gl = gl; + this._isInitialized = true; + if (this._font.count > 0) { + this._hasChanged = true; + } + } + update() { + if (this._hasChanged && this._isInitialized) { + this._hasChanged = false; + this.texture = TextureHelper.fromImage(this._gl, this._font.atlas.imageData, false, this._gl.LINEAR); + this._core.log.write(LogLevel.info, `${this._font.name} texture updated`); + } + } + } + class LabelVisualBase { + get isInitialized() { + return this._isInitialized && this._main.sdfTextShader.isInitialized && this._main.fonts[this._label.font.name].isInitialized; + } + constructor(core, main, label2) { + this._core = core; + this._main = main; + this._label = label2; + this._label.hasChangedCallback = () => { + this._hasChanged = true; + }; + this._mMatrix = create$4(); + this.mMatrix = create$4(); + this.isVisible = true; + } + initializeContext(gl) { + if (!this._label.isInitialized) { + this._label.initialize(); + } + this._gl = gl; + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._label.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._label.indices, gl.STATIC_DRAW); + this._isInitialized = true; } update(elapsedTime) { - super.update(elapsedTime); - for(let i = 0; i < this.transitionBuffers.length; i++){ - const transitionBuffer = this.transitionBuffers[i]; - if (transitionBuffer.isVisible) { - const time0 = this._core.renderer.transitionTime; - const time1 = Math.min(time0 + this._config.shutterSpeed, 1); - transitionBuffer.time0 = time0; - transitionBuffer.time1 = time1; - transitionBuffer.duration = this._core.config.transitionDuration; - transitionBuffer.stagger = this._core.config.transitionStaggering; - transitionBuffer.update(); - } - } - if (this._haveLightsChanged || !this._lightBuffer) { - this._haveLightsChanged = false; - this._createLights(); - } - if (this._hasWorldChanged) { - this._hasWorldChanged = false; - this._createWorld().then(()=>{ - if (this._hittables.length > 0) { - this._resizeBackings(); - this._worldCreated = true; - } - }); + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._label.vertices); + this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER, 0, this._label.indices); + } + } + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const indexCount = this._label.indexCount; + if (indexCount > 0) { + const shader = this._main.sdfTextShader; + const fontVisual = this._main.fonts[this._label.font.name]; + shader.vertexBuffer = this._vertexBuffer; + shader.indexBuffer = this._indexBuffer; + shader.texture2D = fontVisual.texture; + shader.prepare(); + shader.gamma = this._label.gamma; + shader.buffer = fontVisual.font.edgeValue / 255; + shader.borderWidth = this._label.borderWidth; + shader.color = this._label.color || this._core.config.textColor; + shader.borderColor = this._label.borderColor || this._core.config.textBorderColor; + shader.hoverColor = this._label.hoverColor || this._core.config.textHoverColor; + shader.pickedIdColor = this.pickedIdColor; + shader.apply(); + multiply$2(this._mMatrix, this.mMatrix, this._label.mMatrix); + shader.mMatrix = this._mMatrix; + shader.applyModel(); + shader.isPickShader = false; + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + shader.vMatrix = this.vMatrices[viewport]; + shader.pMatrix = this.pMatrices[viewport]; + shader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this.isPickingEnabled) { + shader.isPickShader = true; + shader.pMatrix = this.pickPMatrix; + shader.vMatrix = this.pickVMatrix; + shader.applyView(); + this._main.shaderResources.bindFramebuffer(this.pickFramebuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElements(this._gl.TRIANGLES, indexCount, this._gl.UNSIGNED_SHORT, 0); + } } - if (this._core.config.isDebugVisible) this._core.debugText.addLine(`frm tot ${this._frameCount}`); + } } - render(elapsedTime) { - return __awaiter(this, void 0, void 0, function*() { - if (!this._worldCreated || !this._areLightsInitialized || this._hittables.length == 0) return; - const epsilon = 0.000001; - if (Math.abs(this._computeUniformBufferData.getFieldOfView() - this._core.config.fov) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setFieldOfView(this._core.config.fov); - } - if (Math.abs(this._computeUniformBufferData.getAperture() - this._config.aperture) > epsilon) { - this._frameCount = 0; - this._computeUniformBufferData.setAperture(this._config.aperture); - } - const m = this.inverseVMatrices[0]; - this._computeUniformBufferData.getPosition(this._position); - this._computeUniformBufferData.getRight(this._right); - this._computeUniformBufferData.getUp(this._up); - this._computeUniformBufferData.getForward(this._forward); - if (Math.abs(this._position[0] - m[12]) > epsilon || Math.abs(this._position[1] - m[13]) > epsilon || Math.abs(this._position[2] - m[14]) > epsilon || Math.abs(this._right[0] - m[0]) > epsilon || Math.abs(this._right[1] - m[1]) > epsilon || Math.abs(this._right[2] - m[2]) > epsilon || Math.abs(this._up[0] - m[4]) > epsilon || Math.abs(this._up[1] - m[5]) > epsilon || Math.abs(this._up[2] - m[6]) > epsilon || Math.abs(this._forward[0] - m[8]) > epsilon || Math.abs(this._forward[1] - m[9]) > epsilon || Math.abs(this._forward[2] - m[10]) > epsilon) { - this._frameCount = 0; - (0, _glMatrix.vec3).set(this._position, m[12], m[13], m[14]); - (0, _glMatrix.vec3).set(this._right, m[0], m[1], m[2]); - (0, _glMatrix.vec3).set(this._up, m[4], m[5], m[6]); - (0, _glMatrix.vec3).set(this._forward, m[8], m[9], m[10]); - this._computeUniformBufferData.setPosition(this._position); - this._computeUniformBufferData.setRight(this._right); - this._computeUniformBufferData.setUp(this._up); - this._computeUniformBufferData.setForward(this._forward); - this._core.getModelPosition(this._modelPosition); - this._core.getModelManipulationOrigin(this._manipulationOrigin); - (0, _glMatrix.vec3).add(this._modelPosition, this._modelPosition, this._manipulationOrigin); - this._computeUniformBufferData.setLookAt(this._modelPosition); - } - this._computeUniformBufferData.getBackgroundColor(this._backgroundColor); - if (!(0, _glMatrix.vec4).equals(this._backgroundColor, this._config.backgroundColor)) { - this._frameCount = 0; - this._computeUniformBufferData.setBackgroundColor(this._config.backgroundColor); - } - this._tilesX = this._computeUniformBufferData.getTilesX(); - this._tilesY = this._computeUniformBufferData.getTilesY(); - this._tileOffsetX = this._computeUniformBufferData.getTileOffsetX(); - this._tileOffsetY = this._computeUniformBufferData.getTileOffsetY(); - if (this._tilesX != this._core.config.tilesX || this._tilesY != this._core.config.tilesY || this._tileOffsetX != this._core.config.tileOffsetX || this._tileOffsetY != this._core.config.tileOffsetY) { - this._frameCount = 0; - this._computeUniformBufferData.setTilesX(this._core.config.tilesX); - this._computeUniformBufferData.setTilesY(this._core.config.tilesY); - this._computeUniformBufferData.setTileOffsetX(this._core.config.tileOffsetX); - this._computeUniformBufferData.setTileOffsetY(this._core.config.tileOffsetY); - } - const clear = this._frameCount == 0; - if (clear) { - this._duration = 0; - this._startTime = performance.now(); - } - if (this._frameCount >= this._config.maxSamplesPerPixel) { - this._core.stop(); - return; - } - const raysPerFrame = this._config.raysPerFrame; - this._computeUniformBufferData.setRaysPerFrame(raysPerFrame); - this._computeUniformBufferData.setSeed(this._core.totalFrames * raysPerFrame); - this._device.queue.writeBuffer(this._computeUniformBuffer, 0, this._computeUniformBufferData.buffer, this._computeUniformBufferData.byteOffset, this._computeUniformBufferData.byteLength); - this._frameCount += raysPerFrame; - this._fullscreenQuadUniformBufferData.setSamplesPerPixel(this._frameCount); - this._fullscreenQuadUniformBufferData.setExposure(this._config.exposure); - this._fullscreenQuadUniformBufferData.setMinDepth(this._config.minDepth); - this._fullscreenQuadUniformBufferData.setMaxDepth(this._config.maxDepth); - this._fullscreenQuadUniformBufferData.setEdgeDepth(this._config.edgeDepth); - this._fullscreenQuadUniformBufferData.setEdgeNormal(this._config.edgeNormal); - this._device.queue.writeBuffer(this._fullscreenQuadUniformBuffer, 0, this._fullscreenQuadUniformBufferData.buffer, this._fullscreenQuadUniformBufferData.byteOffset, this._fullscreenQuadUniformBufferData.byteLength); - yield this._encodeCommands(clear); - this._duration = performance.now() - this._startTime; - }); + } + class LabelVisual extends LabelVisualBase { + get label() { + return this._label; } - clear() { - this._frameCount = 0; - } - _encodeCommands(clear) { - return __awaiter(this, void 0, void 0, function*() { - const commandEncoder = this._device.createCommandEncoder(); - const computePassEncoder = commandEncoder.beginComputePass(); - if (clear) { - computePassEncoder.setPipeline(this._clearPipeline); - computePassEncoder.setBindGroup(0, this._clearBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - } - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - case (0, _mainJs.RenderMode).hdr: - computePassEncoder.setPipeline(this._computePipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - case (0, _mainJs.RenderMode).depth: - case (0, _mainJs.RenderMode).normal: - computePassEncoder.setPipeline(this._computeDepthNormalPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - commandEncoder.copyBufferToBuffer(this._depthMinMaxBuffer, 0, this._depthMinMaxResultBuffer, 0, this._depthMinMaxResultBuffer.size); - if (this._config.autoDepth) { - yield this._depthMinMaxResultBuffer.mapAsync(GPUMapMode.READ); - const depthMinMax = new Uint32Array(this._depthMinMaxResultBuffer.getMappedRange()); - const depthMin = depthMinMax[0] / 1000; - const depthMax = depthMinMax[1] / 1000; - if (this._config.minDepth != depthMin || this._config.maxDepth != depthMax) console.log('depthMinMax', depthMin, depthMax); - this._config.minDepth = depthMin; - this._config.maxDepth = depthMax; - this._depthMinMaxResultBuffer.unmap(); - } - break; - case (0, _mainJs.RenderMode).edge: - case (0, _mainJs.RenderMode).segment: - computePassEncoder.setPipeline(this._computeSegmentPipeline); - computePassEncoder.setBindGroup(0, this._computeBindGroup); - computePassEncoder.dispatchWorkgroups(this._computeDispatchCount, 1, 1); - computePassEncoder.end(); - break; - } - const colorAttachment = { - view: this._context.getCurrentTexture().createView(), - clearValue: { - r: 0.0, - g: 0.0, - b: 0.0, - a: 0.0 - }, - loadOp: "clear", - storeOp: "store" - }; - const fullscreenQuadRenderPassDescriptor = { - colorAttachments: [ - colorAttachment - ] - }; - const renderPassEncoder = commandEncoder.beginRenderPass(fullscreenQuadRenderPassDescriptor); - switch(this._core.config.renderMode){ - case (0, _mainJs.RenderMode).color: - renderPassEncoder.setPipeline(this._fullscreenQuadPipeline); - break; - case (0, _mainJs.RenderMode).hdr: - renderPassEncoder.setPipeline(this._fullscreenQuadHdrPipeline); - break; - case (0, _mainJs.RenderMode).depth: - renderPassEncoder.setPipeline(this._fullscreenQuadDepthPipeline); - break; - case (0, _mainJs.RenderMode).normal: - renderPassEncoder.setPipeline(this._fullscreenQuadNormalPipeline); - break; - case (0, _mainJs.RenderMode).edge: - renderPassEncoder.setPipeline(this._fullscreenQuadEdgePipeline); - break; - case (0, _mainJs.RenderMode).segment: - renderPassEncoder.setPipeline(this._fullscreenQuadSegmentPipeline); - break; - } - renderPassEncoder.setBindGroup(0, this._fullscreenQuadBindGroup); - renderPassEncoder.draw(6, 1, 0, 0); - renderPassEncoder.end(); - this._queue.submit([ - commandEncoder.finish() - ]); - }); + set text(value2) { + this._label.text = value2; } - _resize(width, height) { - super._resize(width, height); - if (this._isInitialized && this._hittables.length > 0) { - this._resizeBackings(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffers resized ${width},${height}`); - } - } -} - -},{"gl-matrix":"erHGu","../renderer.js":"as6Zc","../../main.js":"b6Xbk","./config.js":"hBC5n","./hittable.js":"a4kPP","./material.js":"ewL2a","./shaders/raytrace.js":"KHqJX","./shaders/fullscreenquad.js":"iaEI5","./bvh.js":"gC34F","./texture.js":"f9eG4","./light.js":"inb41","../../constants.js":"dHTsY","../../helpers/angle.js":"hBXkO","./font.js":"5qz1r","./image.js":"ebXJi","./labels.js":"1pTTV","./buffer.js":"3l2Pt","./constants.js":"lFJgO","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hBC5n":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Config", ()=>Config); -var _glMatrix = require("gl-matrix"); -var _rendererJs = require("../renderer.js"); -var _materialJs = require("./material.js"); -var _textureJs = require("./texture.js"); -class Config extends (0, _rendererJs.RendererConfig) { - constructor(){ - super(); - this.reset(); - } - standardLightingOptions(options) { - const azimuthOffset = options && options.azimuthOffset ? options.azimuthOffset : this.lightingAzimuthOffset; - const altitude = options && options.altitude ? options.altitude : this.lightingAltitude; - const size = options && options.size ? options.size : this.lightingSize; - const distance = options && options.distance ? options.distance : this.lightingDistance; - return [ - { - azimuth: -45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(10, 10, 10) - }, - { - azimuth: 45 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: 45 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }, - { - azimuth: -135 + azimuthOffset, - altitude: altitude, - distance: distance, - size: (0, _glMatrix.vec2).fromValues(size, size), - yaw: -135 + azimuthOffset, - pitch: altitude, - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - } - ]; + get text() { + return this._label.text; } - reset() { - this.aperture = 0; - this.exposure = 1; - this.maxSamplesPerPixel = 10000; - this.shutterSpeed = 0; - this.raysPerFrame = 1; - this.maxPrimsInNode = 1; - this.defaultMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(0.5, 0.5, 0.5) - }) - }); - this.defaultTextMaterial = new (0, _materialJs.LambertianMaterial)({ - texture: new (0, _textureJs.SolidColorTexture)({ - color: (0, _glMatrix.vec3).fromValues(1, 1, 1) - }) - }); - this.groundSize = (0, _glMatrix.vec2).fromValues(10, 10); - this.backgroundColor = (0, _glMatrix.vec4).fromValues(0, 0, 0, 1); - this.lightingAzimuthOffset = 0; - this.lightingAltitude = 30; - this.lightingSize = 0.5; - this.lightingDistance = 1.5; - this.autoDepth = true; - this.minDepth = 1; - this.maxDepth = 10; - this.edgeDepth = 0.01; - this.edgeNormal = 0.025; - } -} - -},{"gl-matrix":"erHGu","../renderer.js":"as6Zc","./material.js":"ewL2a","./texture.js":"f9eG4","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ewL2a":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "MaterialType", ()=>MaterialType); -parcelHelpers.export(exports, "MaterialBufferData", ()=>MaterialBufferData); -parcelHelpers.export(exports, "Material", ()=>Material); -parcelHelpers.export(exports, "LambertianMaterial", ()=>LambertianMaterial); -parcelHelpers.export(exports, "MetalMaterial", ()=>MetalMaterial); -parcelHelpers.export(exports, "DielectricMaterial", ()=>DielectricMaterial); -parcelHelpers.export(exports, "DiffuseLightMaterial", ()=>DiffuseLightMaterial); -parcelHelpers.export(exports, "GlossyMaterial", ()=>GlossyMaterial); -parcelHelpers.export(exports, "IsotropicMaterial", ()=>IsotropicMaterial); -parcelHelpers.export(exports, "VarnishMaterial", ()=>VarnishMaterial); -var _glMatrix = require("gl-matrix"); -const MaterialType = { - lambertian: 0, - metal: 1, - dielectric: 2, - glossy: 3, - diffuseLight: 4, - isotropic: 5, - varnish: 6 -}; -class MaterialBufferData extends Float32Array { - constructor(count){ - super(count * MaterialBufferData.SIZE); - this.TYPE_OFFSET = 0; - this.FUZZ_OFFSET = 1; - this.REFRACTIVE_INDEX_OFFSET = 2; - this.TEXTURE_ID_OFFSET = 3; - this.COLOR_OFFSET = 4; - this.GLOSSINESS_OFFSET = 7; - this.ID_COLOR_OFFSET = 8; - this.DENSITY_OFFSET = 12; - } - getType(index) { - return this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[MaterialBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getFuzz(index) { - return this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET]; - } - setFuzz(index, value) { - this[MaterialBufferData.SIZE * index + this.FUZZ_OFFSET] = value; - } - getRefractiveIndex(index) { - return this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET]; - } - setRefractiveIndex(index, value) { - this[MaterialBufferData.SIZE * index + this.REFRACTIVE_INDEX_OFFSET] = value; - } - getTextureId(index) { - return this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET]; - } - setTextureId(index, value) { - this[MaterialBufferData.SIZE * index + this.TEXTURE_ID_OFFSET] = value; - } - getColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getGlossiness(index) { - return this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET]; - } - setGlossiness(index, value) { - this[MaterialBufferData.SIZE * index + this.GLOSSINESS_OFFSET] = value; - } - getDensity(index) { - return this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET]; - } - setDensity(index, value) { - this[MaterialBufferData.SIZE * index + this.DENSITY_OFFSET] = value; - } - getIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setIdColor(index, value) { - const offset = MaterialBufferData.SIZE * index + this.ID_COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -MaterialBufferData.SIZE = 16; -class Material { - get texture() { - return this._texture; - } - get idColor() { - return this._idColor; - } - constructor(options){ - this._idColor = options.idColor || (0, _glMatrix.vec4).fromValues(0, 0, 0, 0); - } - toBuffer(buffer, index, textureId) {} -} -class LambertianMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.lambertian); - buffer.setIdColor(index, this.idColor); - buffer.setTextureId(index, textureId); - } -} -class MetalMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this._texture = options.texture; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.metal); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setTextureId(index, textureId); - } -} -class DielectricMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - this.density = options && options.density !== undefined ? options.density : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.dielectric); - buffer.setIdColor(index, this.idColor); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setColor(index, (0, _glMatrix.vec3).fromValues(-Math.log(this.color[0]) * this.density, -Math.log(this.color[1]) * this.density, -Math.log(this.color[2]) * this.density)); - } -} -class DiffuseLightMaterial extends Material { - constructor(options){ - super(options); - this.color = options && options.color || (0, _glMatrix.vec3).fromValues(1, 1, 1); - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.diffuseLight); - buffer.setIdColor(index, this.idColor); - buffer.setColor(index, this.color); - } -} -class GlossyMaterial extends Material { - constructor(options){ - super(options); - this._texture = options.texture; - this.fuzz = options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.glossy); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - buffer.setTextureId(index, textureId); - } -} -class IsotropicMaterial extends Material { - constructor(options){ - super(options); - this.density = options.density; - this.color = options.color; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.isotropic); - buffer.setIdColor(index, this.idColor); - buffer.setDensity(index, this.density); - buffer.setColor(index, this.color); - } -} -class VarnishMaterial extends Material { - constructor(options){ - super(options); - this.fuzz = options && options.fuzz !== undefined ? options.fuzz : 0; - this.refractiveIndex = options && options.refractiveIndex !== undefined ? options.refractiveIndex : 1.5; - this.glossiness = options && options.glossiness !== undefined ? options.glossiness : 1; - } - toBuffer(buffer, index, textureId) { - buffer.setType(index, MaterialType.varnish); - buffer.setIdColor(index, this.idColor); - buffer.setFuzz(index, this.fuzz); - buffer.setGlossiness(index, this.glossiness); - buffer.setRefractiveIndex(index, this.refractiveIndex); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f9eG4":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "TextureType", ()=>TextureType); -parcelHelpers.export(exports, "TextureBufferData", ()=>TextureBufferData); -parcelHelpers.export(exports, "Texture", ()=>Texture); -parcelHelpers.export(exports, "SolidColorTexture", ()=>SolidColorTexture); -parcelHelpers.export(exports, "ImageTexture", ()=>ImageTexture); -parcelHelpers.export(exports, "CheckerTexture", ()=>CheckerTexture); -parcelHelpers.export(exports, "GridTexture", ()=>GridTexture); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -const TextureType = { - none: 0, - solidColor: 1, - image: 2, - sdfText: 3, - checker: 4, - grid: 5 -}; -class TextureBufferData extends Float32Array { - constructor(count){ - super(count * TextureBufferData.SIZE); - this.COLOR0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.COLOR1_OFFSET = 4; - this.SIZE0_OFFSET = 8; - this.SIZE1_OFFSET = 12; - this.CLIP_OFFSET = 16; - this.OFFSET_OFFSET = 20; - } - getType(index) { - return this[TextureBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[TextureBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor0(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor1(index, value) { - const offset = TextureBufferData.SIZE * index + this.COLOR1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize0(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setSize1(index, value) { - const offset = TextureBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - (0, _glMatrix.vec4).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setClip(index, value) { - const offset = TextureBufferData.SIZE * index + this.CLIP_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); - } - setOffset(index, value) { - const offset = TextureBufferData.SIZE * index + this.OFFSET_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - } -} -TextureBufferData.SIZE = 24; -class Texture { -} -class SolidColorTexture extends Texture { - constructor(options){ - super(); - this.color = options.color; - this.borderColor = options.borderColor || (0, _constantsJs.Constants).VECTOR3_ONE; - this._color = (0, _glMatrix.vec3).fromValues(Math.pow(this.color[0], 2.2), Math.pow(this.color[1], 2.2), Math.pow(this.color[2], 2.2)); - this._borderColor = (0, _glMatrix.vec3).fromValues(Math.pow(this.borderColor[0], 2.2), Math.pow(this.borderColor[1], 2.2), Math.pow(this.borderColor[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.solidColor); - buffer.setColor0(index, this._color); - buffer.setColor1(index, this._borderColor); - } -} -class ImageTexture extends Texture { - constructor(options){ - super(); - this.image = options.image; - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.image); - } -} -class CheckerTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.checker); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], 0, 0)); - buffer.setOffset(index, this.offset); - } -} -class GridTexture extends Texture { - constructor(options){ - super(); - this.color0 = options.color0; - this.color1 = options.color1; - this.size = options.size; - this.minorSize = options.minorSize; - this.thickness = options.thickness; - this.minorThickness = options.minorThickness; - this.offset = options.offset || (0, _constantsJs.Constants).VECTOR2_ZERO; - this.clip = options.clip || (0, _glMatrix.vec4).fromValues(0, 0, 1, 1); - this._color0 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color0[0], 2.2), Math.pow(this.color0[1], 2.2), Math.pow(this.color0[2], 2.2)); - this._color1 = (0, _glMatrix.vec3).fromValues(Math.pow(this.color1[0], 2.2), Math.pow(this.color1[1], 2.2), Math.pow(this.color1[2], 2.2)); - } - toBuffer(buffer, index) { - buffer.setType(index, TextureType.grid); - buffer.setColor0(index, this._color0); - buffer.setColor1(index, this._color1); - buffer.setSize0(index, (0, _glMatrix.vec4).fromValues(this.size[0], this.size[1], this.minorSize[0], this.minorSize[1])); - buffer.setSize1(index, (0, _glMatrix.vec4).fromValues(this.thickness[0], this.thickness[1], this.minorThickness[0], this.minorThickness[1])); - buffer.setOffset(index, this.offset); - buffer.setClip(index, this.clip); - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"a4kPP":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "HittableType", ()=>HittableType); -parcelHelpers.export(exports, "HittableBufferData", ()=>HittableBufferData); -parcelHelpers.export(exports, "Hittable", ()=>Hittable); -parcelHelpers.export(exports, "HittableSphere", ()=>HittableSphere); -parcelHelpers.export(exports, "HittableXyDisk", ()=>HittableXyDisk); -parcelHelpers.export(exports, "HittableRotatedXyDisk", ()=>HittableRotatedXyDisk); -parcelHelpers.export(exports, "HittableRingSdf", ()=>HittableRingSdf); -parcelHelpers.export(exports, "HittableRotatedRingSdf", ()=>HittableRotatedRingSdf); -parcelHelpers.export(exports, "HittableBox", ()=>HittableBox); -parcelHelpers.export(exports, "HittableBoxSdf", ()=>HittableBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBoxSdf", ()=>HittableRotatedBoxSdf); -parcelHelpers.export(exports, "HittableRotatedBox", ()=>HittableRotatedBox); -parcelHelpers.export(exports, "HittableCylinder", ()=>HittableCylinder); -parcelHelpers.export(exports, "HittableCylinderSdf", ()=>HittableCylinderSdf); -parcelHelpers.export(exports, "HittableHexPrism", ()=>HittableHexPrism); -parcelHelpers.export(exports, "HittableHexPrismSdf", ()=>HittableHexPrismSdf); -parcelHelpers.export(exports, "HittableRect", ()=>HittableRect); -parcelHelpers.export(exports, "HittableXyRect", ()=>HittableXyRect); -parcelHelpers.export(exports, "HittableXzRect", ()=>HittableXzRect); -parcelHelpers.export(exports, "HittableYzRect", ()=>HittableYzRect); -parcelHelpers.export(exports, "HittableFontXyRect", ()=>HittableFontXyRect); -parcelHelpers.export(exports, "HittableSdfXyRect", ()=>HittableSdfXyRect); -parcelHelpers.export(exports, "HittableRotatedXyRect", ()=>HittableRotatedXyRect); -parcelHelpers.export(exports, "HittableRotatedFontXyRect", ()=>HittableRotatedFontXyRect); -parcelHelpers.export(exports, "HittableRotatedSdfXyRect", ()=>HittableRotatedSdfXyRect); -parcelHelpers.export(exports, "HittableConstantMedium", ()=>HittableConstantMedium); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../../constants.js"); -var _boundsJs = require("../../helpers/bounds.js"); -var _aabbJs = require("./aabb.js"); -const HittableType = { - sphere: 0, - box: 1, - cylinder: 2, - hexPrism: 3, - rotatedBox: 4, - xyRect: 5, - xzRect: 6, - yzRect: 7, - rotatedXyRect: 8, - fontXyRect: 9, - rotatedFontXyRect: 10, - boxSdf: 11, - cylinderSdf: 12, - hexPrismSdf: 13, - constantMedium: 14, - sdfXyRect: 15, - rotatedSdfXyRect: 16, - rotatedBoxSdf: 17, - xYDisk: 18, - rotatedXyDisk: 19, - ringSdf: 20, - rotatedRingSdf: 21 -}; -class HittableBufferData extends Float32Array { - constructor(count){ - super(count * HittableBufferData.SIZE); - this.CENTER0_OFFSET = 0; - this.TYPE_OFFSET = 3; - this.SIZE0_OFFSET = 4; - this.MATERIAL_ID_OFFSET = 7; - this.ROTATION0_OFFSET = 8; - this.ROTATION1_OFFSET = 12; - this.TEXCOORD0_OFFSET = 16; - this.TEXCOORD1_OFFSET = 18; - this.CENTER1_OFFSET = 20; - this.ROUNDING_OFFSET = 23; - this.SIZE1_OFFSET = 24; - this.BOUNDARY_TYPE_OFFSET = 27; - this.TIME0_OFFSET = 28; - this.TIME1_OFFSET = 29; - this.TEX_ID_OFFSET = 30; - this.SDF_BUFFER_OFFSET = 31; - this.SDF_BORDER_OFFSET = 32; - this.PARAMETER_1_OFFSET = 33; - this.PARAMETER_2_OFFSET = 34; - } - getType(index) { - return this[HittableBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[HittableBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter0(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter1(index, value) { - const offset = HittableBufferData.SIZE * index + this.CENTER1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getTime0(index) { - return this[HittableBufferData.SIZE * index + this.TIME0_OFFSET]; - } - setTime0(index, value) { - this[HittableBufferData.SIZE * index + this.TIME0_OFFSET] = value; - } - getTime1(index) { - return this[HittableBufferData.SIZE * index + this.TIME1_OFFSET]; - } - setTime1(index, value) { - this[HittableBufferData.SIZE * index + this.TIME1_OFFSET] = value; - } - getSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize0(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize1(index, value) { - const offset = HittableBufferData.SIZE * index + this.SIZE1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getMaterialId(index) { - return this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET]; - } - setMaterialId(index, value) { - this[HittableBufferData.SIZE * index + this.MATERIAL_ID_OFFSET] = value; - } - getRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation0(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation1(index, value) { - const offset = HittableBufferData.SIZE * index + this.ROTATION1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } - getTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + constructor(core, main, label2) { + super(core, main, label2); } - setTexCoord0(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD0_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + } + class LabelSetVisual extends LabelVisualBase { + get label() { + return this._label; } - getTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - (0, _glMatrix.vec2).set(value, this[offset], this[offset + 1]); + constructor(core, main, label2) { + super(core, main, label2); } - setTexCoord1(index, value) { - const offset = HittableBufferData.SIZE * index + this.TEXCOORD1_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; + } + class ImageVisual { + get isInitialized() { + return this._isInitialized && this._main.textureShader.isInitialized; } - getRounding(index) { - return this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET]; + get image() { + return this._image; } - setRounding(index, value) { - this[HittableBufferData.SIZE * index + this.ROUNDING_OFFSET] = value; + constructor(core, main, image2) { + this._core = core; + this._main = main; + this._image = image2; + this._image.hasChangedCallback = () => { + this._hasChanged = true; + }; + this.mMatrix = create$4(); + this.isVisible = true; } - getParameter1(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET]; + initializeContext(gl) { + if (!this._image.isInitialized) { + this._image.initialize(); + } + this._gl = gl; + if (this._image.imageData) { + this.texture = TextureHelper.fromImage(gl, this._image.imageData, false, gl.LINEAR); + } + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, this._image.vertices, gl.STATIC_DRAW); + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._image.indices, gl.STATIC_DRAW); + this._isInitialized = true; } - setParameter1(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_1_OFFSET] = value; + update(elapsedTime) { + if (this._hasChanged) { + this._hasChanged = false; + this._gl.bindBuffer(this._gl.ARRAY_BUFFER, this._vertexBuffer); + this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, this._image.vertices); + this._main.shaderResources.currentProgram = null; + } } - getParameter2(index) { - return this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET]; + render(elapsedTime, xrFrame) { + if (this.isInitialized) { + const textureShader = this._main.textureShader; + textureShader.vertexBuffer = this._vertexBuffer; + textureShader.indexBuffer = this._indexBuffer; + textureShader.texture2D = this.texture; + textureShader.prepare(); + textureShader.mMatrix = this.mMatrix; + textureShader.apply(); + this._main.shaderResources.bindFramebuffer(this.geometryFramebuffer); + for (let i = 0; i < this.viewportCount; i++) { + const viewport = i + this.viewportOffset; + this._gl.viewport(this.viewports[viewport].x, this.viewports[viewport].y, this.viewports[viewport].width, this.viewports[viewport].height); + textureShader.vMatrix = this.vMatrices[viewport]; + textureShader.pMatrix = this.pMatrices[viewport]; + textureShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._image.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } } - setParameter2(index, value) { - this[HittableBufferData.SIZE * index + this.PARAMETER_2_OFFSET] = value; + } + class Lasso { + get isInitialized() { + return this._isInitialized; } - getBoundaryType(index) { - return this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET]; + get vertexBuffer() { + return this._vertexBuffer; } - setBoundaryType(index, value) { - this[HittableBufferData.SIZE * index + this.BOUNDARY_TYPE_OFFSET] = value; + get indexBuffer() { + return this._indexBuffer; } - getTexId(index) { - return this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET]; + get indexCount() { + return this._indexCount; } - setTexId(index, value) { - this[HittableBufferData.SIZE * index + this.TEX_ID_OFFSET] = value; + initializeContext(gl) { + const vertices = Quad$2.textured(Constants.MAT4_IDENTITY); + this._vertexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + const indices = Quad$2.INDICES; + this._indexBuffer = gl.createBuffer(); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + this._indexCount = indices.length; + this._isInitialized = true; } - getSdfBuffer(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET]; + } + var __awaiter = function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - setSdfBuffer(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BUFFER_OFFSET] = value; + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + class Main extends RendererBase { + get shaderResources() { + return this._shaderResources; } - getSdfBorder(index) { - return this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET]; + get textureShader() { + return this._textureShader; } - setSdfBorder(index, value) { - this[HittableBufferData.SIZE * index + this.SDF_BORDER_OFFSET] = value; + get lassoShader() { + return this._lassoShader; } -} -HittableBufferData.SIZE = 36; -class Hittable { - get center0() { - return this._center0; + get sdfTextShader() { + return this._sdfTextShader; } - get center1() { - return this._center1; + get gridShader() { + return this._gridShader; } - get time0() { - return this._time0; + get blockShader() { + return this._blockShader; } - get time1() { - return this._time1; + get sphereShader() { + return this._sphereShader; } - get material() { - return this._material; - } - set material(material) { - this._material = material; - } - get bounds() { - return this._bounds; - } - get offset0() { - return this._offset0; - } - get offset1() { - return this._offset1; - } - constructor(options){ - this._center0 = options.center0; - this._center1 = options.center1; - this._time0 = options.time0; - this._time1 = options.time1; - this._material = options.material; - this._bounds = new (0, _aabbJs.AABB)(); - this._offset0 = (0, _glMatrix.vec3).create(); - this._offset1 = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index, materialId) { - buffer.setCenter0(index, this._center0); - buffer.setCenter1(index, this._center1); - buffer.setTime0(index, this._time0); - buffer.setTime1(index, this._time1); - buffer.setMaterialId(index, materialId); - } -} -class HittableSphere extends Hittable { - get radius() { - return this._radius; - } - constructor(options){ - super(options); - this._radius = options.radius; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._radius, this._center1[1] - this._radius); - max[1] = Math.max(this._center0[1] + this._radius, this._center1[1] + this._radius); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.sphere); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._radius, this._radius)); - } -} -class HittableXyDisk extends Hittable { - get texCoord0() { - return this._texCoord0; + get cyclinderShader() { + return this._cylinderShader; } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._radius0 = options.radius0; - this._radius1 = options.radius1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius0, this._center1[0] - this._radius1); - max[0] = Math.max(this._center0[0] + this._radius0, this._center1[0] + this._radius1); - min[1] = Math.min(this._center0[1] - this._radius0, this._center1[1] - this._radius1); - max[1] = Math.max(this._center0[1] + this._radius0, this._center1[1] + this._radius1); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xYDisk); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius0, this._radius0, this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius1, this._radius1, this._thickness)); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableRotatedXyDisk extends HittableXyDisk { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyDisk); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRingSdf extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - this._angle = options.angle0; - this._innerRadius = options.innerRadius0; - this._rounding = options.rounding; - const outerRadius = this._size0[0]; - const innerRadius = this._size0[1]; - const extrudedThicknesses = this._size0[2]; - const min = this._bounds.min; - const max = this._bounds.max; - max[1] = this._center0[1] + outerRadius; - const sinAngle = Math.sin(this._angle); - const cosAngle = Math.cos(this._angle); - if (this._angle < (0, _constantsJs.Constants).PI_OVER_TWO) { - min[0] = this.center0[0] - sinAngle * outerRadius; - max[0] = this.center0[0] + sinAngle * outerRadius; - min[1] = this.center0[1] + cosAngle * innerRadius; - } else { - min[0] = this._center0[0] - outerRadius; - max[0] = this._center0[0] + outerRadius; - min[1] = this._center0[1] + cosAngle * outerRadius; - } - min[2] = this._center0[2] - extrudedThicknesses; - max[2] = this._center0[2] + extrudedThicknesses; - this.offset0[0] = (min[0] + max[0]) / 2 - this._center0[0]; - this.offset0[1] = (min[1] + max[1]) / 2 - this._center0[1]; - this.offset0[2] = (min[2] + max[2]) / 2 - this._center0[2]; - this.offset1[0] = (min[0] + max[0]) / 2 - this._center1[0]; - this.offset1[1] = (min[1] + max[1]) / 2 - this._center1[1]; - this.offset1[2] = (min[2] + max[2]) / 2 - this._center1[2]; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.ringSdf); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - buffer.setParameter1(index, this._angle); - buffer.setParameter2(index, this._innerRadius); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedRingSdf extends HittableRingSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedRingSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableBox extends Hittable { - constructor(options){ - super(options); - this._size0 = options.size0; - this._size1 = options.size1; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._size0[2], this._center1[2] - this._size1[2]); - max[2] = Math.max(this._center0[2] + this._size0[2], this._center1[2] + this._size1[2]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.box); - buffer.setSize0(index, this._size0); - buffer.setSize1(index, this._size1); - } -} -class HittableBoxSdf extends HittableBox { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.boxSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRotatedBoxSdf extends HittableBoxSdf { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBoxSdf); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedBox extends HittableBox { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedBox); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinder extends Hittable { - get radius() { - return this._radius; + get sdfShader() { + return this._sdfShader; } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - this._rotation0 = options.rotation0 || (0, _constantsJs.Constants).QUAT_IDENTITY; - this._rotation1 = options.rotation1 || (0, _constantsJs.Constants).QUAT_IDENTITY; - if (this._rotation0[3] * this._rotation1[3] == 1) { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._radius, this._center1[0] - this._radius); - max[0] = Math.max(this._center0[0] + this._radius, this._center1[0] + this._radius); - min[1] = Math.min(this._center0[1] - this._height, this._center1[1] - this._height); - max[1] = Math.max(this._center0[1] + this._height, this._center1[1] + this._height); - min[2] = Math.min(this._center0[2] - this._radius, this._center1[2] - this._radius); - max[2] = Math.max(this._center0[2] + this._radius, this._center1[2] + this._radius); - } else { - const ca0 = (0, _glMatrix.vec3).create(); - const pa0 = (0, _glMatrix.vec3).create(); - const pb0 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca0, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation0); - (0, _glMatrix.vec3).scaleAndAdd(pa0, this._center0, ca0, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb0, this._center0, ca0, this._height); - const ca1 = (0, _glMatrix.vec3).create(); - const pa1 = (0, _glMatrix.vec3).create(); - const pb1 = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).transformQuat(ca1, (0, _constantsJs.Constants).VECTOR3_UNITY, this._rotation1); - (0, _glMatrix.vec3).scaleAndAdd(pa1, this._center1, ca1, -this._height); - (0, _glMatrix.vec3).scaleAndAdd(pb1, this._center1, ca1, this._height); - this._bounds.fromCylinder(pa0, pb0, this._radius); - const bounds = new (0, _aabbJs.AABB)(); - bounds.fromCylinder(pa1, pb1, this._radius); - const min0 = this._bounds.min; - const max0 = this._bounds.max; - const min1 = bounds.min; - const max1 = bounds.max; - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - } - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinder); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._radius, this._height, this._radius)); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableCylinderSdf extends HittableCylinder { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.cylinderSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableHexPrism extends Hittable { - get radius() { - return this._radius; + get currentAxes() { + return this._isAxes1Current ? this._axes1 : this._axes2; } - get height() { - return this._height; - } - constructor(options){ - super(options); - this._radius = options.radius; - this._height = options.height; - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = this._center0[0] - this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - max[0] = this._center0[0] + this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO; - min[1] = this._center0[1] - this._height; - max[1] = this._center0[1] + this._height; - min[2] = this._center0[2] - this._radius; - max[2] = this._center0[2] + this._radius; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrism); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._radius * (0, _constantsJs.Constants).ROOT_THREE_OVER_TWO, this._height, this._radius)); - } -} -class HittableHexPrismSdf extends HittableHexPrism { - constructor(options){ - super(options); - this._rounding = options.rounding; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.hexPrismSdf); - buffer.setRounding(index, this._rounding); - } -} -class HittableRect extends Hittable { - get texCoord0() { - return this._texCoord0; + set currentAxes(value2) { + if (this._isAxes1Current) { + this._axes1 = value2; + } else { + this._axes2 = value2; + } } - get texCoord1() { - return this._texCoord1; - } - constructor(options){ - super(options); - this._thickness = 0.00001; - this._size0 = options.size0; - this._size1 = options.size1; - this._texCoord0 = options.texCoord0; - this._texCoord1 = options.texCoord1; - this._setBounds(); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexCoord0(index, this._texCoord0); - buffer.setTexCoord1(index, this._texCoord1); - } -} -class HittableXyRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._size0[1], this._center1[1] - this._size1[1]); - max[1] = Math.max(this._center0[1] + this._size0[1], this._center1[1] + this._size1[1]); - min[2] = Math.min(this._center0[2] - this._thickness, this._center1[2] - this._thickness); - max[2] = Math.max(this._center0[2] + this._thickness, this._center1[2] + this._thickness); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xyRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._size0[1], this._thickness)); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._size1[1], this._thickness)); - } -} -class HittableXzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._size0[0], this._center1[0] - this._size1[0]); - max[0] = Math.max(this._center0[0] + this._size0[0], this._center1[0] + this._size1[0]); - min[1] = Math.min(this._center0[1] - this._thickness, this._center1[1] - this._thickness); - max[1] = Math.max(this._center0[1] + this._thickness, this._center1[1] + this._thickness); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.xzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._size0[0], this._thickness, this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._size1[0], this._thickness, this._size1[1])); - } -} -class HittableYzRect extends HittableRect { - _setBounds() { - const min = this._bounds.min; - const max = this._bounds.max; - min[0] = Math.min(this._center0[0] - this._thickness, this._center1[0] - this._thickness); - max[0] = Math.max(this._center0[0] + this._thickness, this._center1[0] + this._thickness); - min[1] = Math.min(this._center0[1] - this._size0[0], this._center1[1] - this._size1[0]); - max[1] = Math.max(this._center0[1] + this._size0[0], this._center1[1] + this._size1[0]); - min[2] = Math.min(this._center0[2] - this._size0[1], this._center1[2] - this._size1[1]); - max[2] = Math.max(this._center0[2] + this._size0[1], this._center1[2] + this._size1[1]); - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.yzRect); - buffer.setSize0(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size0[0], this._size0[1])); - buffer.setSize1(index, (0, _glMatrix.vec3).fromValues(this._thickness, this._size1[0], this._size1[1])); - } -} -class HittableFontXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.fontXyRect); - } -} -class HittableSdfXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.sdfXyRect); - } -} -class HittableRotatedXyRect extends HittableXyRect { - constructor(options){ - super(options); - this._rotation0 = options.rotation0; - this._rotation1 = options.rotation1; - const rotatedBounds0 = new (0, _aabbJs.AABB)(); - const rotatedBounds1 = new (0, _aabbJs.AABB)(); - const min0 = rotatedBounds0.min; - const max0 = rotatedBounds0.max; - const min1 = rotatedBounds1.min; - const max1 = rotatedBounds1.max; - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation0, min0, max0, this._offset0); - (0, _boundsJs.BoundsHelper).rotateBounds(this._bounds.min, this._bounds.max, this._rotation1, min1, max1, this._offset1); - min0[0] = Math.min(min0[0], min1[0]); - max0[0] = Math.max(max0[0], max1[0]); - min0[1] = Math.min(min0[1], min1[1]); - max0[1] = Math.max(max0[1], max1[1]); - min0[2] = Math.min(min0[2], min1[2]); - max0[2] = Math.max(max0[2], max1[2]); - this._bounds = rotatedBounds0; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setType(index, HittableType.rotatedXyRect); - buffer.setRotation0(index, this._rotation0); - buffer.setRotation1(index, this._rotation1); - } -} -class HittableRotatedFontXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._sdfBuffer = options.sdfBuffer; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setType(index, HittableType.rotatedFontXyRect); - } -} -class HittableRotatedSdfXyRect extends HittableRotatedXyRect { - constructor(options){ - super(options); - this._texId = options.texId; - this._sdfBuffer = options.sdfBuffer; - this._sdfBorder = options.sdfBorder; - } - toBuffer(buffer, index, materialId) { - super.toBuffer(buffer, index, materialId); - buffer.setTexId(index, this._texId); - buffer.setSdfBuffer(index, this._sdfBuffer); - buffer.setSdfBorder(index, this._sdfBorder); - buffer.setType(index, HittableType.rotatedSdfXyRect); - } -} -class HittableConstantMedium extends Hittable { - get boundary() { - return this._boundary; - } - constructor(options){ - super(options); - this._boundary = options.boundary; - this._bounds = this._boundary.bounds; - } - toBuffer(buffer, index, materialId) { - this._boundary.toBuffer(buffer, index, materialId); - buffer.setBoundaryType(index, buffer.getType(index)); - buffer.setType(index, HittableType.constantMedium); - } -} - -},{"gl-matrix":"erHGu","../../constants.js":"dHTsY","../../helpers/bounds.js":"lo93N","./aabb.js":"3Gscs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3Gscs":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "AABB", ()=>AABB); -var _glMatrix = require("gl-matrix"); -var _cubeJs = require("../../meshes/cube.js"); -class AABB { - get min() { - return this._min; - } - get max() { - return this._max; - } - constructor(){ - this._min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - this._max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - } - centroid(centroid) { - centroid[0] = (this._min[0] + this._max[0]) / 2; - centroid[1] = (this._min[1] + this._max[1]) / 2; - centroid[2] = (this._min[2] + this._max[2]) / 2; - } - size(size) { - size[0] = this._max[0] - this._min[0]; - size[1] = this._max[1] - this._min[1]; - size[2] = this._max[2] - this._min[2]; - } - offset(point, normalized) { - normalized[0] = (point[0] - this._min[0]) / (this._max[0] - this._min[0]); - normalized[1] = (point[1] - this._min[1]) / (this._max[1] - this._min[1]); - normalized[2] = (point[2] - this._min[2]) / (this._max[2] - this._min[2]); - } - unionBounds(bounds) { - (0, _glMatrix.vec3).min(this._min, this._min, bounds.min); - (0, _glMatrix.vec3).max(this._max, this._max, bounds.max); - } - unionPoint(point) { - (0, _glMatrix.vec3).min(this._min, this._min, point); - (0, _glMatrix.vec3).max(this._max, this._max, point); - } - maximumExtent() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - if (dx > dy && dx > dz) return 0; - else if (dy > dz) return 1; - return 2; - } - surfaceArea() { - const dx = this._max[0] - this._min[0]; - const dy = this._max[1] - this._min[1]; - const dz = this._max[2] - this._min[2]; - return 2 * (dx * dy + dx * dz + dy * dz); - } - rotate(rotation) { - const sizeX = this._max[0] - this._min[0]; - const sizeY = this._max[1] - this._min[1]; - const sizeZ = this._max[2] - this._min[2]; - const min = (0, _glMatrix.vec3).fromValues(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE); - const max = (0, _glMatrix.vec3).fromValues(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE); - const position = (0, _glMatrix.vec3).create(); - const vertices = (0, _cubeJs.Cube).POSITIONS; - for(let i = 0; i < 8; i++){ - (0, _glMatrix.vec3).set(position, vertices[i * 3] * sizeX, vertices[i * 3 + 1] * sizeY, vertices[i * 3 + 2] * sizeZ); - (0, _glMatrix.vec3).transformQuat(position, position, rotation); - (0, _glMatrix.vec3).min(min, min, position); - (0, _glMatrix.vec3).max(max, max, position); - } - (0, _glMatrix.vec3).copy(this._min, min); - (0, _glMatrix.vec3).copy(this._max, max); - } - fromCylinder(pa, pb, radius) { - const a = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).subtract(a, pb, pa); - const aa = (0, _glMatrix.vec3).dot(a, a); - const ex = radius * Math.sqrt(1 - a[0] * a[0] / aa); - const ey = radius * Math.sqrt(1 - a[1] * a[1] / aa); - const ez = radius * Math.sqrt(1 - a[2] * a[2] / aa); - this._min[0] = Math.min(pa[0] - ex, pb[0] - ex); - this._min[1] = Math.min(pa[1] - ey, pb[1] - ey); - this._min[2] = Math.min(pa[2] - ez, pb[2] - ez); - this._max[0] = Math.max(pa[0] + ex, pb[0] + ex); - this._max[1] = Math.max(pa[1] + ey, pb[1] + ey); - this._max[2] = Math.max(pa[2] + ez, pb[2] + ez); - } -} - -},{"gl-matrix":"erHGu","../../meshes/cube.js":"dYecn","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"KHqJX":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ComputeShaderWgsl", ()=>ComputeShaderWgsl); -parcelHelpers.export(exports, "ComputeUniformBufferData", ()=>ComputeUniformBufferData); -var _glMatrix = require("gl-matrix"); -const ComputeShaderWgsl = ` -const PI = 3.1415926535897932385f; -const TWO_PI = 6.2831853071795864769f; -const ROOT_THREE_OVER_TWO = 0.86602540378443864676f; - -struct ColorBuffer { - values: array<f32>, -} - -// (normal.x, normal.y, normal.z, depth) -struct NormalDepthBuffer { - values: array<f32>, -} - -// Min, max -// TODO: Convert to atomic add with uint -struct DepthMinMaxBuffer { - values: array<atomic<u32>>, -} - -struct Ray { - origin: vec3<f32>, - direction: vec3<f32>, - time: f32, -} - -struct HitRecord { - normal: vec3<f32>, - t: f32, - frontFace: bool, - materialId: u32, - uv: vec2<f32>, - id: u32, - previousId: u32, - position: vec3<f32>, - previousPosition: vec3<f32>, - isAbsorbing: bool, - previousIsAbsorbing: bool, - absorption: vec3<f32>, - previousAbsorption: vec3<f32>, - sdfBorder: bool, -} - -struct Camera { - origin: vec3<f32>, - lowerLeftCorner: vec3<f32>, - horizontal: vec3<f32>, - vertical: vec3<f32>, - lookAt: vec3<f32>, - u: vec3<f32>, - v: vec3<f32>, - w: vec3<f32>, - aspectRatio: f32, - viewportWidth: f32, - viewportHeight: f32, - fov: f32, - aperture: f32, - time0: f32, - time1: f32, -} - - // offest align size -struct Uniforms { // ------------------------------ - position: vec3<f32>, // 0 16 12 - width: f32, // 12 4 4 - right: vec3<f32>, // 16 16 12 - height: f32, // 28 4 4 - up: vec3<f32>, // 32 16 12 - seed: f32, // 44 4 4 - forward: vec3<f32>, // 48 16 12 - fov: f32, // 60 4 4 - lookAt: vec3<f32>, // 64 16 12 - aperture: f32, // 76 4 4 - backgroundColor: vec3<f32>, // 80 16 12 - time0: f32, // 92 4 4 - time1: f32, // 96 4 4 - tilesX : f32, // 100 4 4 - tilesY : f32, // 104 4 4 - tileOffsetX : f32, // 108 4 4 - tileOffsetY : f32, // 112 4 4 - raysPerFrame : f32, // 116 4 4 - // padding 120 4 8 - // ------------------------------ - // 16 128 -} - -// id type -// ---------------- -// 0 none -// 1 solidColor -// 2 image -// 3 sdfText -// 4 checker -// 5 grid - // offest align size stride -struct Texture { // --------------------------------------- - color0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - color1: vec3<f32>, // 16 12 12 - // padding 28 12 12 - size0: vec4<f32>, // 32 16 16 - size1: vec4<f32>, // 48 16 16 - clip: vec4<f32>, // 64 16 16 - offset: vec2<f32>, // 80 8 8 -} // --------------------------------------- - // 16 88 96 - -// id type -// --------------- -// 0 lambertian -// 1 metal -// 2 dielectric -// 3 diffuse light -// 4 glossy -// 5 isotropic -// 6 varnitsh - // offest align size stride -struct Material { // --------------------------------------- - typeId: f32, // 0 4 4 - fuzz: f32, // 4 4 4 - refractiveIndex: f32, // 8 4 4 - textureId: f32, // 12 4 4 - color: vec3<f32>, // 16 16 12 - glossiness: f32, // 28 4 4 - idColor: vec4<f32>, // 32 16 16 - density: f32, // 48 4 4 - // --------------------------------------- -} // 16 52 64 - -// id type -// ---------------- -// 0 distant -// 1 sphere -// 2 rect -// 3 disk -// 4 cylinder -// 5 dome - // offest align size stride -struct Light { // --------------------------------------- - rotation: vec4<f32>, // 0 16 16 - center: vec3<f32>, // 16 16 12 - typeId: f32, // 28 4 4 - size: vec3<f32>, // 32 16 12 - // padding 44 4 4 - color: vec3<f32>, // 48 16 12 -} // --------------------------------------- - // 16 60 64 - -// id type -// ---------------- -// 0 sphere -// 1 box -// 2 cylinder -// 3 hexPrism -// 4 rotatedBox -// 5 xyRect -// 6 xzRect -// 7 yzRect -// 8 rotatedXyRect -// 9 fontXyRect -// 10 rotatedFontXyRect -// 11 boxSdf -// 12 cylinderSdf -// 13 hexPrismSdf -// 14 constantMedium -// 15 sdfXyRect -// 16 rotatedSdfXyRect -// 17 rotatedBoxSdf -// 18 xyDisk -// 19 rotatedXyDisk -// 20 ringSdf -// 21 rotatedRingSdf - // offest align size stride -struct Hittable { // --------------------------------------- - center0: vec3<f32>, // 0 16 12 - typeId: f32, // 12 4 4 - size0: vec3<f32>, // 16 16 12 - materialId: f32, // 28 4 4 - rotation0: vec4<f32>, // 32 16 16 - rotation1: vec4<f32>, // 48 16 16 - texCoord0: vec2<f32>, // 64 8 8 - texCoord1: vec2<f32>, // 72 8 8 - center1: vec3<f32>, // 80 16 12 - rounding: f32, // 92 4 4 - size1: vec3<f32>, // 96 16 12 - boundaryTypeId: f32, // 108 4 4 - time0: f32, // 112 4 4 - time1: f32, // 116 4 4 - texId: f32, // 120 4 4 - sdfBuffer: f32, // 124 4 4 - sdfBorder: f32, // 128 4 4 - parameter1: f32, // 132 4 4 - parameter2: f32, // 136 4 4 - // padding 140 4 4 -} // --------------------------------------- - // 16 144 144 - - // offest align size stride -struct LinearBVHNode { // --------------------------------------- - center: vec3<f32>, // 0 16 12 - primitivesOffset: f32, // 12 4 4 - size: vec3<f32>, // 16 16 12 - secondChildOffset: f32, // 28 4 4 - nPrimitives: f32, // 32 4 4 - axis: f32, // 36 4 4 -} // --------------------------------------- - // 16 40 48 - -struct HittableBuffer { - hittables: array<Hittable>, -} - -struct MaterialBuffer { - materials: array<Material>, -} - -struct TextureBuffer { - textures: array<Texture>, -} - -struct LightBuffer { - lights: array<Light>, -} - -struct LinearBVHNodeBuffer { - nodes: array<LinearBVHNode>, -} - -// Schlick's approximation for reflectance -fn reflectance(cos: f32, refractiveIndex: f32) -> f32 { - var r = (1f - refractiveIndex) / (1f + refractiveIndex); - r = r * r; - return r + (1f - r) * pow(1f - cos, 5f); -} - -fn refraction(uv: vec3<f32>, n: vec3<f32>, etaiOverEtat: f32) -> vec3<f32> { - let cosTheta = min(dot(-uv, n), 1f); - let rOutPerp = etaiOverEtat * (uv + cosTheta * n); - let rOutParallel = -sqrt(abs(1f - dot(rOutPerp, rOutPerp))) * n; - return rOutPerp + rOutParallel; -} - -fn getCamera(uniforms: Uniforms) -> Camera { - var camera: Camera; - camera.aperture = uniforms.aperture; - camera.aspectRatio = uniforms.width / uniforms.height; - camera.fov = uniforms.fov; - camera.viewportHeight = 2f * tan(camera.fov / 2f); - camera.viewportWidth = camera.aspectRatio * camera.viewportHeight; - camera.origin = uniforms.position; - camera.lookAt = uniforms.lookAt; - camera.u = uniforms.right; - camera.v = uniforms.up; - camera.w = uniforms.forward; - let focusDistance = dot(camera.w, camera.origin - camera.lookAt); - camera.horizontal = camera.u * camera.viewportWidth * focusDistance; - camera.vertical = camera.v * camera.viewportHeight * focusDistance; - camera.lowerLeftCorner = camera.origin - camera.horizontal / 2f + camera.vertical / 2f - camera.w * focusDistance; - camera.time0 = uniforms.time0; - camera.time1 = uniforms.time1; - return camera; -} - -fn getCameraRay(camera: Camera, seed: ptr<function, u32>, texCoord: vec2<f32>) -> Ray { - // Depth of field - let rd = camera.aperture * randomInUnitDisk(seed); - let offset = camera.u * rd.x + camera.v * rd.y; - - var ray: Ray; - ray.origin = camera.origin + offset; - ray.direction = normalize(camera.lowerLeftCorner + texCoord.x * camera.horizontal - texCoord.y * camera.vertical - camera.origin - offset); - ray.time = camera.time0 + random(seed) * (camera.time1 - camera.time0); - return ray; -} - -fn degreesToRadians(degrees: f32) -> f32 { - return degrees * PI / 180f; -} - -// See https://www.reedbeta.com/blog/hash-functions-for-gpu-rendering/ -fn random(seed: ptr<function, u32>) -> f32 { - var random = ((*seed >> ((*seed >> 28u) + 4u)) ^ *seed) * 277803737u; - random = (random >> 22u) ^ random; - *seed = *seed * 747796405u + 2891336453u; - return f32(random) / 4294967295f; // [0,1] -} - -fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { - var p: vec2<f32>; - loop { - p = 2f * vec2<f32>(random(seed), random(seed)) - vec2<f32>(1f, 1f); - if (dot(p, p) <= 1f) { break; } + get previousAxes() { + return this._isAxes1Current ? this._axes2 : this._axes1; } - return p; -} - -// fn randomInUnitDisk(seed: ptr<function, u32>) -> vec2<f32> { -// let t = TWO_PI * random(seed); -// let r = sqrt(random(seed)); -// return r * vec2<f32>(cos(t), sin(t)); -// } - -fn randomInUnitSphere(seed: ptr<function, u32>) -> vec3<f32> { - var p: vec3<f32>; - loop { - p = 2f * vec3<f32>(random(seed), random(seed), random(seed)) - vec3<f32>(1f, 1f, 1f); - if (dot(p, p) <= 1f) { break; } + set previousAxes(value2) { + if (this._isAxes1Current) { + this._axes2 = value2; + } else { + this._axes1 = value2; + } } - return p; -} - -fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { - return normalize(randomInUnitSphere(seed)); -} - -// fn randomUnitVector(seed: ptr<function, u32>) -> vec3<f32> { -// let theta = TWO_PI * random(seed); // [0,2Pi] -// let phi = acos(2f * random(seed) - 1f); // [-1,1] -// return vec3<f32>(sin(phi) * cos(theta), sin(phi) * sin(theta), cos(phi)); -// } - -fn rayAt(ray: Ray, t: f32) -> vec3<f32> { - return ray.origin + ray.direction * t; -} - -fn setFaceNormal(ray: Ray, outwardNormal: vec3<f32>, hitRecord: ptr<function, HitRecord>) { - (*hitRecord).frontFace = dot(ray.direction, outwardNormal) < 0f; - (*hitRecord).normal = select(-outwardNormal, outwardNormal, (*hitRecord).frontFace); -} - -// fn hitWorld(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { -// var hitAnything = false; -// var closestSoFar = tMax; -// let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; -// var tempHitRecord: HitRecord; -// for (var i: u32 = 0u; i < arrayLength(&hittableBuffer.hittables); i = i + 1u) { -// if (hit(i, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { -// hitAnything = true; -// closestSoFar = tempHitRecord.t; -// tempHitRecord.materialId = u32(hittableBuffer.hittables[i].materialId); -// *hitRecord = tempHitRecord; -// } -// } -// return hitAnything; -// } - -fn hitBVH(ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - var hitAnything = false; - var closestSoFar = tMax; - let invDir = vec3<f32>(1f, 1f, 1f) / ray.direction; - var tempHitRecord: HitRecord; - var toVisitOffset = 0u; - var currentNodeIndex = 0u; - var nodesToVisit: array<u32, 64>; - loop { - let node = &linearBVHNodeBuffer.nodes[currentNodeIndex]; - // Check ray against BVH node - if (intersectBox((*node).center, (*node).size, ray, invDir, tMin, closestSoFar)) { - let nPrimitives = u32((*node).nPrimitives); - if (nPrimitives > 0u) { - let primitiveOffset = u32((*node).primitivesOffset); - for (var i: u32 = 0u; i < nPrimitives; i = i + 1u) { - let id = primitiveOffset + i; - if (hit(id, ray, invDir, tMin, closestSoFar, &tempHitRecord, seed)) { - hitAnything = true; - closestSoFar = tempHitRecord.t; - tempHitRecord.materialId = u32(hittableBuffer.hittables[id].materialId); - tempHitRecord.id = id; - } - } - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; - } - else { - // Put far BVH node on nodesToVisit stack, advance to near node - if (ray.direction[u32((*node).axis)] < 0f) { - nodesToVisit[toVisitOffset] = currentNodeIndex + 1u; - currentNodeIndex = u32((*node).secondChildOffset); - } else { - nodesToVisit[toVisitOffset] = u32((*node).secondChildOffset); - currentNodeIndex = currentNodeIndex + 1u; - } - toVisitOffset = toVisitOffset + 1u; - } - } - else { - if (toVisitOffset == 0u) { break; } - toVisitOffset = toVisitOffset - 1u; - currentNodeIndex = nodesToVisit[toVisitOffset]; - } + get config() { + return this._config; + } + constructor(options) { + super(options); + this._config = new Config(); + this._quad = new Quad(); + this._lasso = new Lasso(); + this._pickedPixels = new Uint8Array(4); + this._pickedIdColor = create$2(); + this._position = create$3(); + this._direction = create$3(); + this._cameraRotation = create$5(); + this._cameraPosition = create$3(); + this._modelPosition = create$3(); + this._modelManipulationOrigin = create$3(); + this._shadowVMatrix = create$4(); + this._shadowPMatrix = create$4(); } - if (hitAnything) { - tempHitRecord.previousId = (*hitRecord).id; - tempHitRecord.previousPosition = (*hitRecord).position; - tempHitRecord.previousIsAbsorbing = (*hitRecord).isAbsorbing; - tempHitRecord.previousAbsorption = (*hitRecord).absorption; - *hitRecord = tempHitRecord; - return true; - }; - return false; -} - -fn hit(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - switch u32(hittableBuffer.hittables[id].typeId) { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 5u: { - return hitXyRect(id, ray, tMin, tMax, hitRecord); - } - case 6u: { - return hitXzRect(id, ray, tMin, tMax, hitRecord); - } - // case 7u: { - // return hitYzRect(hittable, ray, tMin, tMax, hitRecord); - // } - case 8u: { - return hitRotatedXyRect(id, ray, tMin, tMax, hitRecord); - } - case 9u: { - return hitFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 10u: { - return hitRotatedFontXyRect(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); + get isSupported() { + return this._createContext(document.createElement("canvas")) !== null; + } + initialize(core) { + super.initialize(core); + this._shaderResources = new Resources(); + this._textureShader = new Texture(core, this); + this._lassoShader = new Lasso$1(core, this); + this._sdfTextShader = new SdfText(core, this); + this._gridShader = new PickGrid(core, this); + this._blockShader = new UnitBlock(core, this); + this._sphereShader = new UnitSphere(core, this); + this._cylinderShader = new UnitCylinder(core, this); + this._sdfShader = new UnitSdf(core, this); + this._backgroundShader = new Background(core, this); + this._ssaoShader = new Ssao(core, this); + this._boxShader = new Box(core, this); + this._deferredShader = new Deferred(core, this); + this._combineShader = new Combine(core, this); + this._dofBlurShader = new DofBlur(core, this); + this._downsampleShader = new Downsample(core, this); + this._gaussianShader = new Gaussian(core, this); + this._dofCombineShader = new DofCombine(core, this); + this._fxaaShader = new Fxaa(core, this); + this._brightPassShader = new Bright(core, this); + this._initializeContext(this._createContext(this._canvas)); + this._canvas.addEventListener("webglcontextlost", (event2) => { + this._core.log.write(LogLevel.warn, "WebGL context lost"); + event2.preventDefault(); + }, false); + this._canvas.addEventListener("webglcontextrestored", () => { + this._initializeContext(this._createContext(this._canvas)); + this._core.log.write(LogLevel.info, "WebGL context restored"); + }, false); + this._isInitialized = true; + } + _initializeContext(gl) { + this._gl = gl; + for (const key2 in this.fonts) { + const fontVisual = this.fonts[key2]; + fontVisual.initializeContext(gl); + } + this._ssaoSampleKernel = new Float32Array(this._config.ssaoKernelSize * 3); + const random2 = new PseudoRandom(0); + const _vec3 = create$3(); + for (let i = 0; i < this._config.ssaoKernelSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + _vec3[2] = random2.nextFloat(); + normalize$2(_vec3, _vec3); + scale(_vec3, _vec3, random2.nextFloat()); + let scale$12 = i / this._config.ssaoKernelSize; + scale$12 = MathHelper.lerp(0.1, 1, scale$12 * scale$12); + scale(_vec3, _vec3, scale$12); + this._ssaoSampleKernel[i * 3] = _vec3[0]; + this._ssaoSampleKernel[i * 3 + 1] = _vec3[1]; + this._ssaoSampleKernel[i * 3 + 2] = _vec3[2]; + } + const noise = new Float32Array(this._config.ssaoNoiseSize * this._config.ssaoNoiseSize * 4); + _vec3[2] = 0; + for (let i = 0; i < this._config.ssaoNoiseSize * this._config.ssaoNoiseSize; i++) { + _vec3[0] = random2.nextFloat() * 2 - 1; + _vec3[1] = random2.nextFloat() * 2 - 1; + normalize$2(_vec3, _vec3); + noise[i * 4] = _vec3[0]; + noise[i * 4 + 1] = _vec3[1]; + } + this._ssaoNoiseTexture = this._gl.createTexture(); + this._gl.bindTexture(this._gl.TEXTURE_2D, this._ssaoNoiseTexture); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.REPEAT); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, this._gl.NEAREST); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, this._gl.NEAREST); + this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA32F, this._config.ssaoNoiseSize, this._config.ssaoNoiseSize, 0, this._gl.RGBA, this._gl.FLOAT, noise); + this._ssaoWidth = -1; + this._ssaoHeight = -1; + this._shadowWidth = -1; + this._shadowHeight = -1; + this._shaderResources.initializeContext(this._gl); + this._textureShader.initializeContext(this._gl); + this._lassoShader.initializeContext(this._gl); + this._sdfTextShader.initializeContext(this._gl); + this._gridShader.initializeContext(this._gl); + this._blockShader.initializeContext(this._gl); + this._sphereShader.initializeContext(this._gl); + this._cylinderShader.initializeContext(this._gl); + this._sdfShader.initializeContext(this._gl); + this._backgroundShader.initializeContext(this._gl); + this._ssaoShader.initializeContext(this._gl); + this._boxShader.initializeContext(this._gl); + this._deferredShader.initializeContext(this._gl); + this._combineShader.initializeContext(this._gl); + this._dofBlurShader.initializeContext(this._gl); + this._downsampleShader.initializeContext(this._gl); + this._gaussianShader.initializeContext(this._gl); + this._dofCombineShader.initializeContext(this._gl); + this._fxaaShader.initializeContext(this._gl); + this._brightPassShader.initializeContext(this._gl); + this._quad.initializeContext(this._gl); + this._lasso.initializeContext(this._gl); + this._framebuffers = [null, null]; + const texture = TextureHelper.create(this._gl, this._core.config.pickWidth, this._core.config.pickHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, this._core.config.pickWidth, this._core.config.pickHeight); + const framebuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(framebuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, texture, 0); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._pickFrameBuffer = framebuffer; + for (let i = 0; i < this.transitionBuffers.length; i++) { + this.transitionBuffers[i].initializeContext(this._gl); + } + if (this._axes1) { + for (let i = 0; i < this._axes1.length; i++) { + this._axes1[i].initializeContext(this._gl); } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); + } + if (this._axes2) { + for (let i = 0; i < this._axes2.length; i++) { + this._axes2[i].initializeContext(this._gl); } - case 14u: { - return hitConstantMedium(id, ray, invDir, tMin, tMax, hitRecord, seed); + } + for (let i = 0; i < this.labelSets.length; i++) { + this.labelSets[i].initializeContext(this._gl); + } + for (let i = 0; i < this.images.length; i++) { + this.images[i].initializeContext(this._gl); + } + } + _resize(width2, height2) { + super._resize(width2, height2); + this._positionTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.NEAREST, null, this._gl.RGBA32F); + this._colorTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._normalTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._geometryFrameBuffer = this._gl.createFramebuffer(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._positionTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT1, this._gl.TEXTURE_2D, this._colorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT2, this._gl.TEXTURE_2D, this._normalTexture, 0); + const renderBuffer = this._gl.createRenderbuffer(); + this._gl.bindRenderbuffer(this._gl.RENDERBUFFER, renderBuffer); + this._gl.renderbufferStorage(this._gl.RENDERBUFFER, this._gl.DEPTH_COMPONENT24, width2, height2); + this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.RENDERBUFFER, renderBuffer); + this._gl.drawBuffers([this._gl.COLOR_ATTACHMENT0, this._gl.COLOR_ATTACHMENT1, this._gl.COLOR_ATTACHMENT2]); + this._postProcessTexture1 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessDepthTexture = TextureHelper.create(this._gl, width2, height2, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._postProcessFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture1, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._postProcessDepthTexture, 0); + this._postProcessTexture2 = TextureHelper.create(this._gl, width2, height2, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessTexture2, 0); + this._postProcessDofTexture = TextureHelper.create(this._gl, width2, height2, this._gl.RED, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.R32F); + this._postProcessDofFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessDofTexture, 0); + const widthHalf = Math.round(width2 / 2); + const heightHalf = Math.round(height2 / 2); + this._postProcessHalfTexture1 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture1, 0); + this._postProcessHalfTexture2 = TextureHelper.create(this._gl, widthHalf, heightHalf, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessHalfFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessHalfTexture2, 0); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + this._postProcessQuarterTexture1 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture1, 0); + this._postProcessQuarterTexture2 = TextureHelper.create(this._gl, widthQuarter, heightQuarter, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessQuarterFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessQuarterTexture2, 0); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + this._postProcessEighthTexture1 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture1, 0); + this._postProcessEighthTexture2 = TextureHelper.create(this._gl, widthEighth, heightEighth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessEighthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessEighthTexture2, 0); + const widthSixteenth = Math.round(widthEighth / 2); + const hgeightSixteenth = Math.round(heightEighth / 2); + this._postProcessSixteenthTexture1 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture1, 0); + this._postProcessSixteenthTexture2 = TextureHelper.create(this._gl, widthSixteenth, hgeightSixteenth, this._gl.RGBA, this._gl.FLOAT, this._gl.LINEAR, null, this._gl.RGBA32F); + this._postProcessSixteenthFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._postProcessSixteenthTexture2, 0); + this._core.log.write(LogLevel.info, `buffers resized ${width2},${height2}`); + } + _createContext(canvas) { + let supported = false; + const preserveDrawingBuffer = this._options ? this._options.preserveDrawingBuffer === void 0 ? false : this._options.preserveDrawingBuffer : false; + const options = { + stencil: true, + alpha: false, + antialias: false, + preserveDrawingBuffer + }; + const gl = canvas.getContext("webgl2", options); + if (gl) { + const OES_texture_float_linear = gl.getExtension("OES_texture_float_linear"); + const EXT_color_buffer_float = gl.getExtension("EXT_color_buffer_float"); + if (OES_texture_float_linear && EXT_color_buffer_float && gl.MAX_DRAW_BUFFERS > 3) { + const texture = TextureHelper.create(gl, 1, 1, gl.RGBA, gl.FLOAT, gl.LINEAR, null, gl.RGBA32F); + const framebuffer = gl.createFramebuffer(); + gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); + const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); + if (status == gl.FRAMEBUFFER_COMPLETE) { + supported = true; + } + gl.bindTexture(gl.TEXTURE_2D, null); } - case 15u: { - return hitSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); + } + return supported ? gl : null; + } + prepare() { + let viewport; + switch (this._core.config.stereoMode) { + case StereoMode.none: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.left: + viewport = this._viewports[0]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 0; + this._viewportCount = 1; + break; + case StereoMode.right: + viewport = this._viewports[1]; + viewport.x = 0; + viewport.y = 0; + viewport.width = this._canvas.width; + viewport.height = this._canvas.height; + this._viewportOffset = 1; + this._viewportCount = 1; + break; + } + } + createTransitionBuffer(ids) { + const buffer = new TransitionBuffer(this._core, ids); + buffer.initializeContext(this._gl); + return buffer; + } + createCartesian2dAxesVisual(axes) { + const visual = new Cartesian2dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + createCartesian3dAxesVisual(axes) { + const visual = new Cartesian3dVisual(this._core, this, axes); + visual.initializeContext(this._gl); + return visual; + } + _createLabelVisual(label2) { + return new LabelVisual(this._core, this, label2); + } + createLabelSetVisual(labelSet) { + const visual = new LabelSetVisual(this._core, this, labelSet); + visual.initializeContext(this._gl); + return visual; + } + createImageVisual(image2) { + const visual = new ImageVisual(this._core, this, image2); + visual.initializeContext(this._gl); + return visual; + } + createFontVisual(font2) { + const visual = new FontVisual(this._core, font2); + visual.initializeContext(this._gl); + return visual; + } + getDataUrl(mimeType) { + return this._canvas.toDataURL(mimeType); + } + update(elapsedTime) { + super.update(elapsedTime); + if (this._shadowWidth != this._config.shadowWidth || this._shadowHeight != this._config.shadowHeight) { + this._shadowWidth = this._config.shadowWidth; + this._shadowHeight = this._config.shadowHeight; + this._shadowColorTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null); + this._shadowDepthTexture = TextureHelper.create(this._gl, this._config.shadowWidth, this._config.shadowHeight, this._gl.DEPTH_COMPONENT, this._gl.UNSIGNED_INT, this._gl.NEAREST, null, this._gl.DEPTH_COMPONENT24); + this._shadowFrameBuffer = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._shadowFrameBuffer); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._shadowColorTexture, 0); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.DEPTH_ATTACHMENT, this._gl.TEXTURE_2D, this._shadowDepthTexture, 0); + this._core.log.write(LogLevel.info, `shadow map resized ${this._shadowWidth},${this._shadowHeight}`); + } + if (this._ssaoWidth != this._config.ssaoWidth || this._ssaoHeight != this._config.ssaoHeight) { + this._ssaoWidth = this._config.ssaoWidth; + this._ssaoHeight = this._config.ssaoHeight; + this._ssaoTexture1 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer1 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer1); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture1, 0); + this._ssaoTexture2 = TextureHelper.create(this._gl, this._config.ssaoWidth, this._config.ssaoHeight, this._gl.RED, this._gl.UNSIGNED_BYTE, this._gl.LINEAR, null, this._gl.R8); + this._ssaoFrameBuffer2 = this._gl.createFramebuffer(); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._ssaoFrameBuffer2); + this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER, this._gl.COLOR_ATTACHMENT0, this._gl.TEXTURE_2D, this._ssaoTexture2, 0); + this._core.log.write(LogLevel.info, `ssao map resized ${this._ssaoWidth},${this._ssaoHeight}`); + } + if (this._config.isDofEnabled && this._config.dofAutoFocus) { + this._core.getModelManipulationOrigin(this._modelManipulationOrigin); + this._core.getModelPosition(this._modelPosition); + add(this._position, this._modelManipulationOrigin, this._modelPosition); + this._core.camera.getPosition(this._cameraPosition); + subtract(this._position, this._position, this._cameraPosition); + const distance2 = -this._position[2]; + const amount = Math.min(elapsedTime * this._core.config.focusSmoothing, 1); + this._config.dofFocusDistance = MathHelper.lerp(this._config.dofFocusDistance, distance2, amount); + } + } + render(elapsedTime) { + return __awaiter(this, void 0, void 0, function* () { + this._gl.enable(this._gl.DEPTH_TEST); + this._gl.enable(this._gl.CULL_FACE); + this._gl.cullFace(this._gl.BACK); + this._gl.disable(this._gl.BLEND); + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.clearColor(0, 0, 0, 0); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); } - case 16u: { - return hitRotatedSdfXyRect(id, ray, tMin, tMax, hitRecord, seed); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + const backgroundColor = this._backgroundColor || this._core.config.backgroundColor; + this._gl.clearColor(backgroundColor[0], backgroundColor[1], backgroundColor[2], 1); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT | this._gl.STENCIL_BUFFER_BIT); + if (this.config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.clear(this._gl.DEPTH_BUFFER_BIT); + perspective(this._shadowPMatrix, AngleHelper.degreesToRadians(30), this._config.shadowWidth / this._config.shadowHeight, this._core.config.nearPlane, this._core.config.farPlane); + set$3(this._modelPosition, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + fromMat4(this._cameraRotation, this.inverseVMatrices[0]); + transformMat3(this._position, this._config.keyLightPosition, this._cameraRotation); + add(this._position, this._position, this._modelPosition); + lookAt(this._shadowVMatrix, this._position, this._modelPosition, Constants.VECTOR3_UNITY); + } + for (let i = 0; i < this.transitionBuffers.length; i++) { + const transitionBuffer = this.transitionBuffers[i]; + if (transitionBuffer.isVisible) { + this._renderTransitionBuffer(transitionBuffer); + } + } + const axesVisuals = this.axesVisibility == AxesVisibility.current ? this.currentAxes : this.axesVisibility == AxesVisibility.previous ? this.previousAxes : null; + if (axesVisuals) { + for (let i = 0; i < axesVisuals.length; i++) { + const axesVisual = axesVisuals[i]; + if (axesVisual.isVisible) { + axesVisual.pickedIdColor = this._pickedIdColor; + axesVisual.pickFramebuffer = this._pickFrameBuffer; + axesVisual.geometryFramebuffer = this._geometryFrameBuffer; + axesVisual.render(elapsedTime); + } + } } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); + if (this.areLabelsVisible) { + for (let i = 0; i < this.labelSets.length; i++) { + const labelSetVisual = this.labelSets[i]; + if (labelSetVisual.isVisible) { + labelSetVisual.pickedIdColor = this._pickedIdColor; + labelSetVisual.pickFramebuffer = this._pickFrameBuffer; + labelSetVisual.geometryFramebuffer = this._geometryFrameBuffer; + labelSetVisual.render(elapsedTime); + } + } } - case 18u: { - return hitXyDisk(id, ray, tMin, tMax, hitRecord); + if (this.areImagesVisible) { + for (let i = 0; i < this.images.length; i++) { + const imageVisual = this.images[i]; + if (imageVisual.isVisible) { + imageVisual.geometryFramebuffer = this._geometryFrameBuffer; + imageVisual.render(elapsedTime); + } + } + } + if (this._backgroundShader.isInitialized) { + this._backgroundShader.prepare(); + this._backgroundShader.color = fromValues$3(this._core.config.backgroundColor[0], this._core.config.backgroundColor[1], this._core.config.backgroundColor[2]); + this._backgroundShader.apply(); + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._gl.bindVertexArray(null); + } + if (this.isPickingEnabled) { + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.readPixels(this._core.config.pickWidth / 2, this._core.config.pickHeight / 2, 1, 1, this._gl.RGBA, this._gl.UNSIGNED_BYTE, this._pickedPixels); + this._pickedType = PickHelper.decodeType(this._pickedPixels); + set$2(this._pickedIdColor, this._pickedPixels[0] / 255, this._pickedPixels[1] / 255, this._pickedPixels[2] / 255, this._pickedPixels[3] / 255); + this._pickedId = PickHelper.decodeNumber(this._pickedPixels); + } else { + set$2(this._pickedIdColor, 0, 0, 0, 0); + this._pickedId = 0; + } + if (this.transitionBuffers.length > 0 && this._quad.isInitialized) { + const viewport = this._viewportOffset; + this._postProcess(this.vMatrices[viewport], this.inverseVMatrices[viewport], this.pMatrices[viewport], this._viewports[viewport]); + } + if (this.isLassoPicking && this._lassoShader.isInitialized) { + this._lassoShader.vertexBuffer = this._lasso.vertexBuffer; + this._lassoShader.indexBuffer = this._lasso.indexBuffer; + const lassoWidth = this.lassoX1 - this.lassoX0; + const lassoHeight = this.lassoY1 - this.lassoY0; + this._lassoShader.prepare(); + this._lassoShader.color = this.lassoColor ? this.lassoColor : this._core.config.lassoColor; + this._lassoShader.dashWidth = this.lassoDashWidth ? this.lassoDashWidth : this._core.config.lassoDashWidth; + this._lassoShader.apply(); + const lassoThickness = this.lassoThickness ? this.lassoThickness : this._core.config.lassoThickness; + for (let i = 0; i < this._viewportCount; i++) { + const viewportIndex = i + this._viewportOffset; + this._shaderResources.bindFramebuffer(this._framebuffers[viewportIndex]); + const viewport = this._viewports[viewportIndex]; + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._lassoMMatrix[0] = lassoWidth * 2 / viewport.width; + this._lassoMMatrix[5] = lassoHeight * 2 / viewport.height; + this._lassoMMatrix[10] = 1; + this._lassoMMatrix[12] = (this.lassoX0 + lassoWidth / 2) / viewport.width * 2 - 1; + this._lassoMMatrix[13] = 1 - (this.lassoY0 + lassoHeight / 2) / viewport.height * 2; + this._lassoShader.mMatrix = this._lassoMMatrix; + set(this._lassoThickness, lassoThickness / lassoWidth, lassoThickness / lassoHeight); + this._lassoShader.thickness = this._lassoThickness; + this._lassoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._lasso.indexCount, this._gl.UNSIGNED_SHORT, 0); + } } - case 19u: { - return hitRotatedXyDisk(id, ray, tMin, tMax, hitRecord); + }); + } + _renderTransitionBuffer(transitionBuffer) { + const currentBuffer = transitionBuffer.currentBuffer; + const previousBuffer = transitionBuffer.previousBuffer; + const currentPalette = transitionBuffer.currentPalette; + const previousPalette = transitionBuffer.previousPalette; + const currentAtlas = transitionBuffer.currentAtlas; + const previousAtlas = transitionBuffer.previousAtlas; + const unitType = transitionBuffer.unitType === void 0 ? currentBuffer.unitType : transitionBuffer.unitType; + const id2 = currentBuffer.lookup[transitionBuffer.pickIdLookup[this._pickedId]]; + const hoverId = id2 > -1 ? UnitVertex.getIdHover(currentBuffer.dataView, id2) : -1; + const activeId = transitionBuffer.activeId; + if (this._blockShader.isInitialized && (unitType == UnitType.block || unitType == UnitType.blockSdf)) { + this._blockShader.instanceBuffer = currentBuffer.vertexBuffer; + this._blockShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._blockShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._blockShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._blockShader.prepare(); + this._blockShader.mMatrix = this.mMatrix; + this._blockShader.time = this.transitionTime; + this._blockShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._blockShader.rangeMin = currentBuffer.from; + this._blockShader.rangeMax = currentBuffer.to; + this._blockShader.hover = hoverId; + this._blockShader.active = activeId; + this._blockShader.specularPower = this._config.specularPower; + this._blockShader.specularIntensity = this._config.specularIntensity; + this._blockShader.apply(); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._blockShader.vMatrix = this.vMatrices[viewport]; + this._blockShader.pMatrix = this.pMatrices[viewport]; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._blockShader.isPickShader = false; + this._blockShader.isShadowMap = true; + this._blockShader.vMatrix = this._shadowVMatrix; + this._blockShader.pMatrix = this._shadowPMatrix; + this._blockShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._blockShader.isPickShader = true; + this._blockShader.isShadowMap = false; + this._blockShader.pMatrix = this.pickPMatrix; + this._blockShader.vMatrix = this.pickVMatrix; + this._blockShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._blockShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sphereShader.isInitialized && (unitType == UnitType.sphere || unitType == UnitType.sphereSdf)) { + this._sphereShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sphereShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sphereShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sphereShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sphereShader.prepare(); + this._sphereShader.mMatrix = this.mMatrix; + this._sphereShader.time = this.transitionTime; + this._sphereShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sphereShader.rangeMin = currentBuffer.from; + this._sphereShader.rangeMax = currentBuffer.to; + this._sphereShader.hover = hoverId; + this._sphereShader.active = activeId; + this._sphereShader.specularPower = this._config.specularPower; + this._sphereShader.specularIntensity = this._config.specularIntensity; + this._sphereShader.apply(); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sphereShader.vMatrix = this.vMatrices[viewport]; + this._sphereShader.pMatrix = this.pMatrices[viewport]; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._sphereShader.isPickShader = false; + this._sphereShader.isShadowMap = true; + this._sphereShader.vMatrix = this._shadowVMatrix; + this._sphereShader.pMatrix = this._shadowPMatrix; + this._sphereShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._sphereShader.isPickShader = true; + this._sphereShader.isShadowMap = false; + this._sphereShader.pMatrix = this.pickPMatrix; + this._sphereShader.vMatrix = this.pickVMatrix; + this._sphereShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sphereShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._cylinderShader.isInitialized && (unitType == UnitType.cylinder || unitType == UnitType.cylinderSdf)) { + this._cylinderShader.instanceBuffer = currentBuffer.vertexBuffer; + this._cylinderShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._cylinderShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._cylinderShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._cylinderShader.prepare(); + this._cylinderShader.mMatrix = this.mMatrix; + this._cylinderShader.time = this.transitionTime; + this._cylinderShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._cylinderShader.rangeMin = currentBuffer.from; + this._cylinderShader.rangeMax = currentBuffer.to; + this._cylinderShader.hover = hoverId; + this._cylinderShader.active = activeId; + this._cylinderShader.specularPower = this._config.specularPower; + this._cylinderShader.specularIntensity = this._config.specularIntensity; + this._cylinderShader.apply(); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._cylinderShader.vMatrix = this.vMatrices[viewport]; + this._cylinderShader.pMatrix = this.pMatrices[viewport]; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._cylinderShader.isPickShader = false; + this._cylinderShader.isShadowMap = true; + this._cylinderShader.vMatrix = this._shadowVMatrix; + this._cylinderShader.pMatrix = this._shadowPMatrix; + this._cylinderShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + } + if (this.isPickingEnabled) { + this._cylinderShader.isPickShader = true; + this._cylinderShader.isShadowMap = false; + this._cylinderShader.pMatrix = this.pickPMatrix; + this._cylinderShader.vMatrix = this.pickVMatrix; + this._cylinderShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._cylinderShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + } else if (this._sdfShader.isInitialized && unitType == UnitType.sdf) { + this._sdfShader.instanceBuffer = currentBuffer.vertexBuffer; + this._sdfShader.previousInstanceBuffer = previousBuffer.vertexBuffer; + this._sdfShader.paletteTexture = currentPalette.texture || currentPalette.defaultTexture; + this._sdfShader.previousPaletteTexture = previousPalette.texture || previousPalette.defaultTexture; + this._sdfShader.sdfTexture = currentAtlas.texture || currentAtlas.defaultTexture; + this._sdfShader.previousSdfTexture = previousAtlas.texture || previousAtlas.defaultTexture; + this._sdfShader.prepare(); + this._sdfShader.mMatrix = this.mMatrix; + this._sdfShader.time = this.transitionTime; + this._sdfShader.duration = this._core.config.transitionDuration / (this._core.config.transitionDuration + this._core.config.transitionStaggering); + this._sdfShader.rangeMin = currentBuffer.from; + this._sdfShader.rangeMax = currentBuffer.to; + this._sdfShader.hover = hoverId; + this._sdfShader.active = activeId; + this._sdfShader.specularPower = this._config.specularPower; + this._sdfShader.specularIntensity = this._config.specularIntensity; + this._sdfShader.apply(); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = false; + this._shaderResources.bindFramebuffer(this._geometryFrameBuffer); + for (let i = 0; i < this._viewportCount; i++) { + const viewport = i + this._viewportOffset; + this._gl.viewport(this._viewports[viewport].x, this._viewports[viewport].y, this._viewports[viewport].width, this._viewports[viewport].height); + this._sdfShader.vMatrix = this.vMatrices[viewport]; + this._sdfShader.pMatrix = this.pMatrices[viewport]; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + } + if (this._config.isShadowEnabled) { + this._shaderResources.bindFramebuffer(this._shadowFrameBuffer); + this._gl.viewport(0, 0, this._config.shadowWidth, this._config.shadowHeight); + this._gl.cullFace(this._gl.FRONT); + this._sdfShader.isPickShader = false; + this._sdfShader.isShadowMap = true; + this._sdfShader.vMatrix = this._shadowVMatrix; + this._sdfShader.pMatrix = this._shadowPMatrix; + this._sdfShader.applyView(); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); + this._gl.colorMask(true, true, true, true); + this._gl.cullFace(this._gl.BACK); + } + if (this.isPickingEnabled) { + this._sdfShader.isPickShader = true; + this._sdfShader.isShadowMap = false; + this._sdfShader.pMatrix = this.pickPMatrix; + this._sdfShader.vMatrix = this.pickVMatrix; + this._sdfShader.applyView(); + this._shaderResources.bindFramebuffer(this._pickFrameBuffer); + this._gl.viewport(0, 0, this._core.config.pickWidth, this._core.config.pickHeight); + this._gl.drawElementsInstanced(this._gl.TRIANGLE_STRIP, this._sdfShader.indexCount, this._gl.UNSIGNED_SHORT, 0, transitionBuffer.length); } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); + } + } + _postProcess(vMatrix, inverseVMatrix, pMatrix, viewport) { + if (this._deferredShader.isInitialized) { + this._gl.disable(this._gl.DEPTH_TEST); + let ssaoTexture; + if (this._config.isSsaoEnabled && this._ssaoShader.isInitialized) { + this._gl.viewport(0, 0, this._config.ssaoWidth, this._config.ssaoHeight); + ssaoTexture = this._ssaoTexture1; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer1); + this._ssaoShader.vertexBuffer = this._quad.vertexBuffer; + this._ssaoShader.indexBuffer = this._quad.indexBuffer; + this._ssaoShader.texture2D1 = this._positionTexture; + this._ssaoShader.texture2D2 = this._normalTexture; + this._ssaoShader.texture2D3 = this._ssaoNoiseTexture; + this._ssaoShader.prepare(); + this._ssaoShader.pMatrix = pMatrix; + this._ssaoShader.ssaoNoiseSize = this._config.ssaoNoiseSize; + this._ssaoShader.ssaoRadius = this._config.ssaoRadius; + this._ssaoShader.ssaoPower = this._config.ssaoPower; + this._ssaoShader.ssaoKernel = this._ssaoSampleKernel; + this._ssaoShader.left = 0; + this._ssaoShader.top = 0; + this._ssaoShader.width = this._config.ssaoWidth; + this._ssaoShader.height = this._config.ssaoHeight; + this._ssaoShader.apply(); + this._ssaoShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + if (this._config.ssaoBlurEnabled && this._boxShader.isInitialized) { + ssaoTexture = this._ssaoTexture2; + this._shaderResources.bindFramebuffer(this._ssaoFrameBuffer2); + this._boxShader.vertexBuffer = this._quad.vertexBuffer; + this._boxShader.indexBuffer = this._quad.indexBuffer; + this._boxShader.texture2D = this._ssaoTexture1; + this._boxShader.prepare(); + this._boxShader.left = 0; + this._boxShader.top = 0; + this._boxShader.width = this._config.ssaoWidth; + this._boxShader.height = this._config.ssaoHeight; + this._boxShader.apply(); + this._boxShader.applyView(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + this._gl.viewport(viewport.left, viewport.top, viewport.width, viewport.height); + let postProcessFrameBuffer = this._postProcessFrameBuffer1; + this._shaderResources.bindFramebuffer(postProcessFrameBuffer); + this._deferredShader.vertexBuffer = this._quad.vertexBuffer; + this._deferredShader.indexBuffer = this._quad.indexBuffer; + this._deferredShader.texture2D1 = this._positionTexture; + this._deferredShader.texture2D2 = this._colorTexture; + this._deferredShader.texture2D3 = this._normalTexture; + this._deferredShader.texture2D4 = this._config.isSsaoEnabled ? ssaoTexture : null; + this._deferredShader.texture2D5 = this._shadowDepthTexture; + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._gl.CLAMP_TO_EDGE); + this._gl.texParameteri(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._gl.CLAMP_TO_EDGE); + this._deferredShader.prepare(); + this._deferredShader.isShadowEnabled = this._config.isShadowEnabled; + this._deferredShader.isSsaoEnabled = this._config.isSsaoEnabled; + this._deferredShader.inverseVMatrix = inverseVMatrix; + this._deferredShader.shadowVMatrix = this._shadowVMatrix; + this._deferredShader.shadowPMatrix = this._shadowPMatrix; + this._deferredShader.vMatrix = vMatrix; + this._deferredShader.keyLightIntensity = this._config.keyLightIntensity; + this._deferredShader.fillLight1Intensity = this._config.fillLight1Intensity; + this._deferredShader.fillLight2Intensity = this._config.fillLight2Intensity; + this._core.camera.getPosition(this._cameraPosition); + fromMat4(this._cameraRotation, vMatrix); + set$3(this._position, this.mMatrix[12], this.mMatrix[13], this.mMatrix[14]); + normalize$2(this._deferredShader.directionToKeyLight, this._config.keyLightPosition); + subtract(this._direction, this._cameraPosition, this._position); + normalize$2(this._direction, this._direction); + add(this._deferredShader.keyLightHalfAngle, this._direction, this._deferredShader.directionToKeyLight); + normalize$2(this._deferredShader.keyLightHalfAngle, this._deferredShader.keyLightHalfAngle); + copy$3(this._deferredShader.directionToFillLight1, this._config.fillLight1Position); + copy$3(this._deferredShader.directionToFillLight2, this._config.fillLight2Position); + this._deferredShader.left = viewport.left; + this._deferredShader.top = viewport.top; + this._deferredShader.width = viewport.width; + this._deferredShader.height = viewport.height; + this._deferredShader.shadowMapWidth = this._config.shadowWidth; + this._deferredShader.shadowMapHeight = this._config.shadowHeight; + this._deferredShader.ambientIntensity = this._config.ambientIntensity; + this._deferredShader.materialIntensity = this._config.materialIntensity; + this._deferredShader.specularPower = this._config.specularPower; + this._deferredShader.specularIntensity = this._config.specularIntensity; + this._deferredShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + const widthHalf = Math.round(viewport.width / 2); + const heightHalf = Math.round(viewport.height / 2); + const widthQuarter = Math.round(widthHalf / 2); + const heightQuarter = Math.round(heightHalf / 2); + const widthEighth = Math.round(widthQuarter / 2); + const heightEighth = Math.round(heightQuarter / 2); + const widthSixteenth = Math.round(widthEighth / 2); + const heightSixteenth = Math.round(heightEighth / 2); + if (this._config.isDofEnabled && this._dofBlurShader.isInitialized && this._dofCombineShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessDofFrameBuffer); + this._dofBlurShader.vertexBuffer = this._quad.vertexBuffer; + this._dofBlurShader.indexBuffer = this._quad.indexBuffer; + this._dofBlurShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofBlurShader.texture2D2 = this._positionTexture; + this._dofBlurShader.prepare(); + this._dofBlurShader.focusDepth = this._config.dofFocusDistance; + this._dofBlurShader.nearFocusDepth = this._config.dofFocusDistance - this._config.dofFocusRange / 2; + this._dofBlurShader.farFocusDepth = this._config.dofFocusDistance + this._config.dofFocusRange / 2; + this._dofBlurShader.maxBackgroundBlur = this._config.dofMaxBackgroundBlur; + this._dofBlurShader.left = viewport.left; + this._dofBlurShader.top = viewport.top; + this._dofBlurShader.width = viewport.width; + this._dofBlurShader.height = viewport.height; + this._dofBlurShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._dofCombineShader.vertexBuffer = this._quad.vertexBuffer; + this._dofCombineShader.indexBuffer = this._quad.indexBuffer; + this._dofCombineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._dofCombineShader.texture2D2 = this._postProcessDofTexture; + this._dofCombineShader.prepare(); + this._dofCombineShader.focusDepth = this._config.dofFocusDistance; + this._dofCombineShader.left = viewport.left; + this._dofCombineShader.top = viewport.top; + this._dofCombineShader.width = viewport.width; + this._dofCombineShader.height = viewport.height; + this._dofCombineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isBloomEnabled && this._brightPassShader.isInitialized && this._gaussianShader.isInitialized) { + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthHalf; + this._brightPassShader.height = heightHalf; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessHalfTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthQuarter; + this._brightPassShader.height = heightQuarter; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessQuarterTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthEighth; + this._brightPassShader.height = heightEighth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._brightPassShader.vertexBuffer = this._quad.vertexBuffer; + this._brightPassShader.indexBuffer = this._quad.indexBuffer; + this._brightPassShader.texture2D = this._postProcessEighthTexture1; + this._brightPassShader.prepare(); + this._brightPassShader.width = widthSixteenth; + this._brightPassShader.height = heightSixteenth; + this._brightPassShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessHalfTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthHalf; + this._gaussianShader.height = heightHalf; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessHalfFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessHalfTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessQuarterTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthQuarter; + this._gaussianShader.height = heightQuarter; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessQuarterFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessQuarterTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessEighthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthEighth; + this._gaussianShader.height = heightEighth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessEighthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessEighthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer2); + this._gaussianShader.vertexBuffer = this._quad.vertexBuffer; + this._gaussianShader.indexBuffer = this._quad.indexBuffer; + this._gaussianShader.texture2D = this._postProcessSixteenthTexture1; + this._gaussianShader.prepare(); + this._gaussianShader.width = widthSixteenth; + this._gaussianShader.height = heightSixteenth; + this._gaussianShader.horizontal = true; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, this._postProcessSixteenthFrameBuffer1); + this._gaussianShader.texture2D = this._postProcessSixteenthTexture2; + this._gaussianShader.prepare(); + this._gaussianShader.horizontal = false; + this._gaussianShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + if (this._config.isFxaaEnabled && this._fxaaShader.isInitialized) { + postProcessFrameBuffer = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessFrameBuffer2 : this._postProcessFrameBuffer1; + this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, postProcessFrameBuffer); + this._fxaaShader.vertexBuffer = this._quad.vertexBuffer; + this._fxaaShader.indexBuffer = this._quad.indexBuffer; + this._fxaaShader.texture2D = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture2 : this._postProcessTexture1; + this._fxaaShader.prepare(); + this._fxaaShader.left = viewport.left; + this._fxaaShader.top = viewport.top; + this._fxaaShader.width = viewport.width; + this._fxaaShader.height = viewport.height; + this._fxaaShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + this._shaderResources.bindFramebuffer(null); + this._gl.clear(this._gl.COLOR_BUFFER_BIT | this._gl.DEPTH_BUFFER_BIT); + this._gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); + this._combineShader.vertexBuffer = this._quad.vertexBuffer; + this._combineShader.indexBuffer = this._quad.indexBuffer; + this._combineShader.texture2D1 = postProcessFrameBuffer == this._postProcessFrameBuffer1 ? this._postProcessTexture1 : this._postProcessTexture2; + if (this._config.isBloomEnabled) { + this._combineShader.texture2D2 = this._postProcessHalfTexture1; + this._combineShader.texture2D3 = this._postProcessQuarterTexture1; + this._combineShader.texture2D4 = this._postProcessEighthTexture1; + this._combineShader.texture2D5 = this._postProcessSixteenthTexture1; + } else { + this._combineShader.texture2D2 = null; + this._combineShader.texture2D3 = null; + this._combineShader.texture2D4 = null; + this._combineShader.texture2D5 = null; + } + this._combineShader.prepare(); + this._combineShader.viewport = viewport; + this._combineShader.intensity = this._config.bloomIntensity; + this._combineShader.apply(); + this._gl.drawElements(this._gl.TRIANGLES, this._quad.indexCount, this._gl.UNSIGNED_SHORT, 0); + } + } + } + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); + } + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }); + class MaterialBufferData extends Float32Array { + constructor(count2) { + super(count2 * MaterialBufferData.SIZE); + this.TYPE_OFFSET = 0 / 4; + this.FUZZ_OFFSET = 4 / 4; + this.REFRACTIVE_INDEX_OFFSET = 8 / 4; + this.TEXTURE_ID_OFFSET = 12 / 4; + this.COLOR_OFFSET = 16 / 4; + this.GLOSSINESS_OFFSET = 28 / 4; + this.ID_COLOR_OFFSET = 32 / 4; + this.DENSITY_OFFSET = 48 / 4; } -} - -fn intersectBox(center: vec3<f32>, size: vec3<f32>, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32) -> bool { - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t0 = -n - k; - let t1 = -n + k; - let tNear = max(max(t0.x, t0.y), t0.z); - let tFar = min(min(t1.x, t1.y), t1.z); - if (tNear > tFar) { return false; } - return tNear < tMax && tFar > 0f; // Must return true when inside box, even if closestSoFar is closer than far box intersection -} - -fn hitConstantMedium(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let constantMedium = &hittableBuffer.hittables[id]; - let boundaryTypeId = u32((*constantMedium).boundaryTypeId); - var tempHitRecord1: HitRecord; - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, -100f, 100f, &tempHitRecord1)) { return false; } - var tempHitRecord2: HitRecord; - // When raymarching narrow grazing angles, adding SHADOW_OFFSET is < epsilon from surface, so hit function returns tN not tF, hence distanceInsideBoundary is incorrect - // Add larger distance to t - if (!hitConstantMediumBoundary(id, boundaryTypeId, ray, invDir, tempHitRecord1.t + 0.001f, 100f, &tempHitRecord2)) { return false; } - if (tempHitRecord1.t < tMin) { tempHitRecord1.t = tMin; } - if (tempHitRecord2.t > tMax) { tempHitRecord2.t = tMax; } - if (tempHitRecord1.t >= tempHitRecord2.t) { - return false; + getType(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET]; } - tempHitRecord1.t = max(tempHitRecord1.t, 0f); - let distanceInsideBoundary = tempHitRecord2.t - tempHitRecord1.t; - let negativeInverseDensity = -1f / materialBuffer.materials[u32((*constantMedium).materialId)].density; - let hitDistance = negativeInverseDensity * log(random(seed)); - if (hitDistance > distanceInsideBoundary) { return false; } - let t = tempHitRecord1.t + hitDistance; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - return true; -} - -fn hitConstantMediumBoundary(id: u32, boundaryTypeId: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - switch boundaryTypeId { - default: { - return false; - } - case 0u: { - return hitSphere(id, ray, tMin, tMax, hitRecord); - } - case 1u: { - return hitBox(id, ray, invDir, tMin, tMax, hitRecord); - } - case 2u: { - return hitCylinder(id, ray, tMin, tMax, hitRecord); - } - case 3u: { - return hitHexPrism(id, ray, tMin, tMax, hitRecord); - } - case 4u: { - return hitRotatedBox(id, ray, tMin, tMax, hitRecord); - } - case 11u: { - return hitBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 12u: { - return hitCylinderSdf(id, ray, tMin, tMax, hitRecord); - } - case 13u: { - return hitHexPrismSdf(id, ray, tMin, tMax, hitRecord); - } - case 17u: { - return hitRotatedBoxSdf(id, ray, tMin, tMax, hitRecord); - } - case 20u: { - return hitRingSdf(id, ray, tMin, tMax, hitRecord); - } - case 21u: { - return hitRotatedRingSdf(id, ray, tMin, tMax, hitRecord); - } - } -} - -fn hitSphere(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let sphere = &hittableBuffer.hittables[id]; - let radius = (*sphere).size0.x; - let time = min(max((ray.time - (*sphere).time0) / ((*sphere).time1 - (*sphere).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*sphere).center0 + time * ((*sphere).center1 - (*sphere).center0); - let oc = ray.origin - center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - h = sqrt(h); - - // Find the nearest root in range - var root = -b - h; - if (root < tMin || root > tMax) { - root = -b + h; - if (root < tMin || root > tMax) { return false; } - } - - // (*hitRecord).t = root; - // (*hitRecord).position = rayAt(ray, root); - // let outwardNormal = ((*hitRecord).position - center) / radius; - // setFaceNormal(ray, outwardNormal, hitRecord); - - // Reduce precision error in t by ensuring hit position is on sphere surface - let outwardNormal = normalize(ray.origin + ray.direction * root - center); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + outwardNormal * radius; // Use outward normal with internal reflection - (*hitRecord).t = root; // I should also re-calculate t, but this would involve another normalization. t is only used to check closest hit, so only important with overlapping geometry - - // UV - let phi = atan2(outwardNormal.x, outwardNormal.z); // [-pi,pi] - let theta = asin(outwardNormal.y); // [-pi/2, pi/2] - (*hitRecord).uv = vec2<f32>(phi / TWO_PI + 0.5f, theta / PI + 0.5f); // [0,1] - return true; -} - -fn hitBox(id: u32, ray: Ray, invDir: vec3<f32>, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let box = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*box).time0) / ((*box).time1 - (*box).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*box).center0 + time * ((*box).center1 - (*box).center0); - let size = (*box).size0 + time * ((*box).size1 - (*box).size0); - let oc = ray.origin - center; - let n = invDir * oc; - let k = abs(invDir) * size; // Box size is from center to edge - let t1 = -n - k; - let t2 = -n + k; - let tNear = max(max(t1.x, t1.y), t1.z); - let tFar = min(min(t2.x, t2.y), t2.z); - // if (tFar <= tNear) { return false; } - if (tNear > tFar || tFar < 0f) { return false; } - - // Find nearest root in range - var outwardNormal: vec3<f32>; - var root = tNear; - if (root < tMin || root > tMax) { - root = tFar; - if (root < tMin || root > tMax) { return false; } - outwardNormal = sign(ray.direction) * step(t2.xyz, t2.yzx) * step(t2.xyz, t2.zxy); + setType(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; } - else { - outwardNormal = -sign(ray.direction) * step(t1.yzx, t1.xyz) * step(t1.zxy, t1.xyz); + getFuzz(index2) { + return this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET]; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedBox(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBox = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBox).time0) / ((*rotatedBox).time1 - (*rotatedBox).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBox).center0 + time * ((*rotatedBox).center1 - (*rotatedBox).center0); - let rotation = slerpQuat((*rotatedBox).rotation0, (*rotatedBox).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let rotatedInvDir = vec3<f32>(1f, 1f, 1f) / rotatedRay.direction; - let hit = hitBox(id, rotatedRay, rotatedInvDir, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setFuzz(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.FUZZ_OFFSET] = value2; } - return false; -} - -fn hitXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyDisk = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyDisk).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let radius = (*xyDisk).size0.x; - if (dot(p, p) > radius * radius) { return false; } // dot(p, p) is squared distance from disk center to intersection point - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / radius + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyDisk).texCoord0; - let texCoord1 = (*xyDisk).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyDisk(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyDisk = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyDisk).center0; - let time = min(max((ray.time - (*rotatedXyDisk).time0) / ((*rotatedXyDisk).time1 - (*rotatedXyDisk).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyDisk).center0 + time * ((*rotatedXyDisk).center1 - (*rotatedXyDisk).center0); - let rotation = slerpQuat((*rotatedXyDisk).rotation0, (*rotatedXyDisk).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyDisk(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getRefractiveIndex(index2) { + return this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET]; } - return false; -} - -fn hitXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xyRect).center0; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setRefractiveIndex(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.REFRACTIVE_INDEX_OFFSET] = value2; + } + getTextureId(index2) { + return this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET]; + } + setTextureId(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.TEXTURE_ID_OFFSET] = value2; + } + getColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getGlossiness(index2) { + return this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET]; + } + setGlossiness(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.GLOSSINESS_OFFSET] = value2; + } + getDensity(index2) { + return this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET]; + } + setDensity(index2, value2) { + this[MaterialBufferData.SIZE * index2 + this.DENSITY_OFFSET] = value2; + } + getIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setIdColor(index2, value2) { + const offset2 = MaterialBufferData.SIZE * index2 + this.ID_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + } + MaterialBufferData.SIZE = 64 / 4; + class TextureBufferData extends Float32Array { + constructor(count2) { + super(count2 * TextureBufferData.SIZE); + this.COLOR0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.COLOR1_OFFSET = 16 / 4; + this.SIZE0_OFFSET = 32 / 4; + this.SIZE1_OFFSET = 48 / 4; + this.CLIP_OFFSET = 64 / 4; + this.OFFSET_OFFSET = 80 / 4; + } + getType(index2) { + return this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[TextureBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.COLOR1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize0(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setSize1(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + set$2(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setClip(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.CLIP_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + set(value2, this[offset2], this[offset2 + 1]); + } + setOffset(index2, value2) { + const offset2 = TextureBufferData.SIZE * index2 + this.OFFSET_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + } + } + TextureBufferData.SIZE = 96 / 4; + class HittableBufferData extends Float32Array { + constructor(count2) { + super(count2 * HittableBufferData.SIZE); + this.CENTER0_OFFSET = 0 / 4; + this.TYPE_OFFSET = 12 / 4; + this.SIZE0_OFFSET = 16 / 4; + this.MATERIAL_ID_OFFSET = 28 / 4; + this.ROTATION0_OFFSET = 32 / 4; + this.ROTATION1_OFFSET = 48 / 4; + this.TEXCOORD0_OFFSET = 64 / 4; + this.TEXCOORD1_OFFSET = 72 / 4; + this.CENTER1_OFFSET = 80 / 4; + this.ROUNDING_OFFSET = 92 / 4; + this.SIZE1_OFFSET = 96 / 4; + this.BOUNDARY_TYPE_OFFSET = 108 / 4; + this.TIME0_OFFSET = 112 / 4; + this.TIME1_OFFSET = 116 / 4; + this.TEX_ID_OFFSET = 120 / 4; + this.SDF_BUFFER_OFFSET = 124 / 4; + this.SDF_BORDER_OFFSET = 128 / 4; + this.PARAMETER_1_OFFSET = 132 / 4; + this.PARAMETER_2_OFFSET = 136 / 4; + this.MATERIAL_FUZZ_OFFSET = 140 / 4; + this.MATERIAL_GLOSS_OFFSET = 144 / 4; + this.MATERIAL_DENSITY_OFFSET = 148 / 4; + this.MATERIAL_REFRACTIVE_INDEX_OFFSET = 152 / 4; + this.MATERIAL_COLOR_OFFSET = 160 / 4; + this.MATERIAL_TYPE_ID_OFFSET = 172 / 4; + this.SEGMENT_COLOR_OFFSET = 176 / 4; + this.TEXTURE_TYPE_ID_OFFSET = 192 / 4; + this.TEXTURE_ID_OFFSET = 196 / 4; + } + getType(index2) { + return this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.CENTER1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getTime0(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET]; + } + setTime0(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME0_OFFSET] = value2; + } + getTime1(index2) { + return this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET]; + } + setTime1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TIME1_OFFSET] = value2; + } + getSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SIZE1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + set$1(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + set$1(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.ROTATION1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + getTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + set(value2, this[offset2], this[offset2 + 1]); + } + setTexCoord0(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD0_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + } + getTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + set(value2, this[offset2], this[offset2 + 1]); + } + setTexCoord1(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.TEXCOORD1_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + } + getRounding(index2) { + return this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET]; + } + setRounding(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.ROUNDING_OFFSET] = value2; + } + getParameter1(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET]; + } + setParameter1(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_1_OFFSET] = value2; + } + getParameter2(index2) { + return this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET]; + } + setParameter2(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.PARAMETER_2_OFFSET] = value2; + } + getBoundaryType(index2) { + return this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET]; + } + setBoundaryType(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.BOUNDARY_TYPE_OFFSET] = value2; + } + getTexId(index2) { + return this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET]; + } + setTexId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.TEX_ID_OFFSET] = value2; } - return false; -} - -fn hitXzRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xzRect = &hittableBuffer.hittables[id]; - let oc = ray.origin - (*xzRect).center0; - - // Distance to plane, t - let t = -oc.y / ray.direction.y; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xzRect).size0; - if (abs(p.x) > size.x || abs(p.z) > size.z) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xz / size.xz + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xzRect).texCoord0; - let texCoord1 = (*xzRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 1f, 0f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -// fn hitYzRect(yzRect: Hittable, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { -// let oc = ray.origin - yzRect.center0; - -// // Distance to plane, t -// let t = -oc.x / ray.direction.x; - -// // If direction == 0, t = +/- infinity, which always returns false -// if (t < tMin || t > tMax) { return false; } - -// // Intersection point in model space -// let p = oc + t * ray.direction; - -// // Bounds -// if (abs(p.y) > yzRect.size0.y || abs(p.z) > yzRect.size0.z) { return false; } - -// // Texture coords -// var uv = vec2<f32>(0.5 * p.yz / yzRect.size0.yz + vec2<f32>(0.5f, 0.5f)); -// uv = yzRect.texCoord0 + uv * (yzRect.texCoord1 - yzRect.texCoord0); - -// (*hitRecord).uv = uv; -// (*hitRecord).t = t; -// (*hitRecord).position = rayAt(ray, t); -// let outwardNormal = vec3<f32>(1f, 0f, 0f); -// setFaceNormal(ray, outwardNormal, hitRecord); -// return true; -// } - -// TODO: Share hit function with XyRect -fn hitFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - let size = (*xyRect).size0; - if (abs(p.x) > size.x || abs(p.y) > size.y) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - let r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - if (r < buffer) { return false; } - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedFontXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitFontXyRect(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getSdfBuffer(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET]; } - return false; -} - -// TODO: Share hit function with FontXyRect, specifying texture -fn hitSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let xyRect = &hittableBuffer.hittables[id]; - - // let oc = ray.origin - (*xyRect).center0; - let time = min(max((ray.time - (*xyRect).time0) / ((*xyRect).time1 - (*xyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*xyRect).center0 + time * ((*xyRect).center1 - (*xyRect).center0); - let oc = ray.origin - center; - - // Distance to plane, t - let t = -oc.z / ray.direction.z; - - // If direction == 0, t = +/- infinity, which always returns false - if (t < tMin || t > tMax) { return false; } - - // Intersection point in model space - let p = oc + t * ray.direction; - - // Bounds - // let size = (*xyRect).size0; - let size = (*xyRect).size0 + time * ((*xyRect).size1 - (*xyRect).size0); - if (abs(p.x) > (*xyRect).size0.x || abs(p.y) > (*xyRect).size0.y) { return false; } - - // Zero-thickness transparency - // TODO: Pre-multiplied alpha - // if (random(seed) > 0.5f) { return false; } - - // Texture coords - var uv = vec2<f32>(0.5 * p.xy / size.xy + vec2<f32>(0.5f, 0.5f)); - let texCoord0 = (*xyRect).texCoord0; - let texCoord1 = (*xyRect).texCoord1; - uv = texCoord0 + uv * (texCoord1 - texCoord0); - - // Sample sdf - let buffer = xyRect.sdfBuffer / 0xff; - // let r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; - var r: f32; - if ((*xyRect).texId == 0f) { - r = textureSampleLevel(atlasTexture, linearSampler, uv, 0f).r; + setSdfBuffer(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BUFFER_OFFSET] = value2; } - else { - r = textureSampleLevel(fontTexture, linearSampler, uv, 0f).r; - } - if (r < buffer) { return false; } - - // sdfBorder - let border = xyRect.sdfBorder / 0xff; - (*hitRecord).sdfBorder = r - buffer < border; - - (*hitRecord).uv = uv; - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - let outwardNormal = vec3<f32>(0f, 0f, 1f); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn hitRotatedSdfXyRect(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>, seed: ptr<function, u32>) -> bool { - let rotatedXyRect = &hittableBuffer.hittables[id]; - // let center = (*rotatedXyRect).center0; - let time = min(max((ray.time - (*rotatedXyRect).time0) / ((*rotatedXyRect).time1 - (*rotatedXyRect).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedXyRect).center0 + time * ((*rotatedXyRect).center1 - (*rotatedXyRect).center0); - let rotation = slerpQuat((*rotatedXyRect).rotation0, (*rotatedXyRect).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitSdfXyRect(id, rotatedRay, tMin, tMax, hitRecord, seed); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + getSdfBorder(index2) { + return this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET]; } - return false; -} - -fn rotateQuat(v: vec3<f32>, q: vec4<f32>) -> vec3<f32> { - return v + 2f * cross(q.xyz, cross(q.xyz, v) + q.w * v); -} - -fn slerpQuat(q0: vec4<f32>, q1: vec4<f32>, t: f32) -> vec4<f32> { - var cosom = dot(q0, q1); - var q2 = q1; - if (cosom < 0f) { - cosom = -cosom; - q2 = -q2; - } - var s0: f32; - var s1: f32; - if (1f - cosom > 0.000001f) { - // SLERP - let omega = acos(cosom); - let sinom = sin(omega); - s0 = sin((1f - t) * omega) / sinom; - s1 = sin(t * omega) / sinom; - } - else { - // Quaternions close enough for LERP - s0 = 1f - t; - s1 = t; - } - return s0 * q0 + s1 * q2; -} - -fn conjugate(q: vec4<f32>) -> vec4<f32> { - return vec4<f32>(-q.x, -q.y, -q.z, q.w); -} - -fn hitCylinder(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinder = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinder).time0) / ((*cylinder).time1 - (*cylinder).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinder).center0 + time * ((*cylinder).center1 - (*cylinder).center0); - let size = (*cylinder).size0 + time * ((*cylinder).size1 - (*cylinder).size0); - let rotation = slerpQuat((*cylinder).rotation0, (*cylinder).rotation1, time); - let ra = size.x; // Radius - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let oc = ray.origin - center; - let card = dot(ca, ray.direction); - let caoc = dot(ca, oc); - let a = 1f - card * card; - let b = dot(oc, ray.direction) - caoc * card; - let c = dot(oc, oc) - caoc * caoc - ra * ra; - var h = b * b - a * c; - if (h < 0f) { return false; } - h = sqrt(h); - let br0 = (-b - h) / a; - let br1 = (-b + h) / a; - - // Body - let ch = size.y; // Half-height - let y0 = caoc + br0 * card; - let y1 = caoc + br1 * card; - let bt0 = select(10000000f, br0, abs(y0) < ch); - let bt1 = select(-10000000f, br1, abs(y1) < ch); - - // Caps - let sy0 = sign(y0); - let sy1 = sign(y1); - let cr0 = (sy0 * ch - caoc) / card; - let cr1 = (sy1 * ch - caoc) / card; - let ct0 = select(10000000f, cr0, abs(b + a * cr0) < h); - let ct1 = select(-10000000f, cr1, abs(b + a * cr1) < h); - - // Find the nearest root in range - let tN = min(bt0, ct0); - let tF = max(bt1, ct1); - var root = tN; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - } - - // Normal - var outwardNormal: vec3<f32>; - if (root == bt0 || root == bt1) { - let y = select(y1, y0, root == bt0); - // outwardNormal = (oc + root * ray.direction - ca * y) / ra; - - // Reduce precision error in t by ensuring hit position is on cylinder surface - outwardNormal = normalize(oc + root * ray.direction - ca * y); - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = center + ca * y + outwardNormal * ra; // Use outward normal with internal reflection - (*hitRecord).t = root; + setSdfBorder(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.SDF_BORDER_OFFSET] = value2; } - else { - let sy = select(sy1, sy0, root == ct0); - outwardNormal = ca * sy; - - // TODO: Reduce precision error - setFaceNormal(ray, outwardNormal, hitRecord); - (*hitRecord).position = rayAt(ray, root); - (*hitRecord).t = root; - } - - // setFaceNormal(ray, outwardNormal, hitRecord); - // (*hitRecord).position = rayAt(ray, root); - // (*hitRecord).t = root; - return true; -} - -fn hitHexPrism(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrism = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*hexPrism).time0) / ((*hexPrism).time1 - (*hexPrism).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrism).center0 + time * ((*hexPrism).center1 - (*hexPrism).center0); - let oc = ray.origin - center; - let size = (*hexPrism).size0; - let ra = size.x; // Distance from center to edge - let he = size.y; // Half-height - let rd = ray.direction; - - // Normals - let n1 = vec3<f32>(1f, 0f, 0f); - let n2 = vec3<f32>(0.5f, 0f, ROOT_THREE_OVER_TWO); - let n3 = vec3<f32>(-0.5f, 0f, ROOT_THREE_OVER_TWO); - let n4 = vec3<f32>(0f, 1f, 0f); - - // Slabs intersections - var t1 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n1)) / dot(rd, n1), 1f); - var t2 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n2)) / dot(rd, n2), 1f); - var t3 = vec3<f32>((vec2<f32>(ra, -ra) - dot(oc, n3)) / dot(rd, n3), 1f); - var t4 = vec3<f32>((vec2<f32>(he, -he) - dot(oc, n4)) / dot(rd, n4), 1f); - - // Inetsection selection - if (t1.y < t1.x) { t1 = vec3<f32>(t1.yx, -1f); } - if (t2.y < t2.x) { t2 = vec3<f32>(t2.yx, -1f); } - if (t3.y < t3.x) { t3 = vec3<f32>(t3.yx, -1f); } - if (t4.y < t4.x) { t4 = vec3<f32>(t4.yx, -1f); } - - var tN = vec4<f32>(t1.x, t1.z * n1); - if (t2.x > tN.x) { tN = vec4<f32>(t2.x, t2.z * n2); } - if (t3.x > tN.x) { tN = vec4<f32>(t3.x, t3.z * n3); } - if (t4.x > tN.x) { tN = vec4<f32>(t4.x, t4.z * n4); } - - let tF = min(min(t1.y,t2.y),min(t3.y,t4.y)); - - if (tN.x > tF || tF < 0f) { return false; } - - // Find the nearest root in range - var outwardNormal: vec3<f32>; - var root = tN.x; - if (root < tMin || root > tMax) { - root = tF; - if (root < tMin || root > tMax) { return false; } - - // Normal - if (root == t1.y) { outwardNormal = -t1.z * n1; } - else if (root == t2.y) { outwardNormal = -t2.z * n2; } - else if (root == t3.y) { outwardNormal = -t3.z * n3; } - else if (root == t4.y) { outwardNormal = -t4.z * n4; } + getMaterialTypeId(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET]; } - else { - outwardNormal = tN.yzw; + setMaterialTypeId(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_TYPE_ID_OFFSET] = value2; } - - (*hitRecord).t = root; - (*hitRecord).position = rayAt(ray, root); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; -} - -fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { - let q = abs(p) - b; - return length(max(q, vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y, q.z)), 0f) - r; -} - -// Box frame -// fn mapBoxSdf(p: vec3<f32>, b: vec3<f32>, r: f32) -> f32 { -// let s = abs(p) - b; -// // let e = b.y / 3f; -// let e = 0.0002f; -// let q = abs(s + e) - e; -// return min(min( -// length(max(vec3<f32>(s.x, q.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(s.x, max(q.y,q.z)), 0f), -// length(max(vec3<f32>(q.x, s.y, q.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(s.y,q.z)), 0f)), -// length(max(vec3<f32>(q.x, q.y, s.z), vec3<f32>(0f, 0f, 0f))) + min(max(q.x, max(q.y,s.z)), 0f)); -// } - -fn hitBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let boxSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*boxSdf).rounding; - // let size = (*boxSdf).size0 - r; - let time = min(max((ray.time - (*boxSdf).time0) / ((*boxSdf).time1 - (*boxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*boxSdf).center0 + time * ((*boxSdf).center1 - (*boxSdf).center0); - // TODO: r0, r1 - let size = (*boxSdf).size0 + time * ((*boxSdf).size1 - (*boxSdf).size0) - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapBoxSdf(oc, size, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapBoxSdf(oc + k.xyy * h, size, r) + - k.yyx * mapBoxSdf(oc + k.yyx * h, size, r) + - k.yxy * mapBoxSdf(oc + k.yxy * h, size, r) + - k.xxx * mapBoxSdf(oc + k.xxx * h, size, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getMaterialFuzz(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET]; } - return false; -} - -fn hitRotatedBoxSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedBoxSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedBoxSdf).time0) / ((*rotatedBoxSdf).time1 - (*rotatedBoxSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedBoxSdf).center0 + time * ((*rotatedBoxSdf).center1 - (*rotatedBoxSdf).center0); - let rotation = slerpQuat((*rotatedBoxSdf).rotation0, (*rotatedBoxSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitBoxSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setMaterialFuzz(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_FUZZ_OFFSET] = value2; } - return false; -} - -fn mapCylinderSdf(p: vec3<f32>, a: vec3<f32>, b: vec3<f32>, r0: f32, r1: f32) -> f32 { - let ba: vec3<f32> = b - a; - let pa: vec3<f32> = p - a; - let baba: f32 = dot(ba, ba); - let paba: f32 = dot(pa, ba); - let x: f32 = length(pa * baba - ba * paba) - r0 * baba; - let y: f32 = abs(paba - baba * 0.5f) - baba * 0.5f; - let x2: f32 = x * x; - let y2: f32 = y * y * baba; - // let d: f32 = (max(x, y) < 0f) ? -min(x2, y2) : (((x > 0f) ? x2 : 0f) + ((y > 0f) ? y2 : 0f)); - let d: f32 = select(select(0f, x2, x > 0f) + select(0f, y2, y > 0f), -min(x2, y2), max(x, y) < 0f); - return sign(d) * sqrt(abs(d)) / baba - r1; -} - -fn hitCylinderSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let cylinderSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*cylinderSdf).time0) / ((*cylinderSdf).time1 - (*cylinderSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*cylinderSdf).center0 + time * ((*cylinderSdf).center1 - (*cylinderSdf).center0); - let size = (*cylinderSdf).size0 + time * ((*cylinderSdf).size1 - (*cylinderSdf).size0); - let rotation = slerpQuat((*cylinderSdf).rotation0, (*cylinderSdf).rotation1, time); - var t = tMin; - let r1 = (*cylinderSdf).rounding; - let r0 = size.x - r1; - let h0 = size.y - r1; - let ca = rotateQuat(vec3<f32>(0f, 1f, 0f), rotation); - let pa = ca * h0; - let pb = -pa; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapCylinderSdf(oc, pa, pb, r0, r1)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapCylinderSdf(oc + k.xyy * h, pa, pb, r0, r1) + - k.yyx * mapCylinderSdf(oc + k.yyx * h, pa, pb, r0, r1) + - k.yxy * mapCylinderSdf(oc + k.yxy * h, pa, pb, r0, r1) + - k.xxx * mapCylinderSdf(oc + k.xxx * h, pa, pb, r0, r1)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getMaterialDensity(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET]; } - return false; -} - -fn mapHexPrismSdf(p: vec3<f32>, hx: f32, hy: f32, r: f32) -> f32 { - let k = vec3<f32>(-0.8660254, 0.5, 0.57735); // (-sqrt(3)/2 or sin(60), 0.5, sqrt(3)/3 or tan(30)) - var p0 = abs(p.zxy); - let p1 = p0.xy - 2f * min(dot(k.xy, p0.xy), 0f) * k.xy; - let d = vec2<f32>(length(p1.xy - vec2(clamp(p1.x, -k.z * hx, k.z * hx), hx)) * sign(p1.y - hx), p0.z - hy); - return min(max(d.x, d.y), 0f) + length(max(d, vec2<f32>(0f, 0f))) - r; -} - -fn hitHexPrismSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let hexPrismSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let r = (*hexPrismSdf).rounding; - let size = (*hexPrismSdf).size0; - let time = min(max((ray.time - (*hexPrismSdf).time0) / ((*hexPrismSdf).time1 - (*hexPrismSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*hexPrismSdf).center0 + time * ((*hexPrismSdf).center1 - (*hexPrismSdf).center0); - let hx = size.x - r; - let hy = size.y - r; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapHexPrismSdf(oc, hx, hy, r)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.000001f; // Replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapHexPrismSdf(oc + k.xyy * h, hx, hy, r) + - k.yyx * mapHexPrismSdf(oc + k.yyx * h, hx, hy, r) + - k.yxy * mapHexPrismSdf(oc + k.yxy * h, hx, hy, r) + - k.xxx * mapHexPrismSdf(oc + k.xxx * h, hx, hy, r)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + setMaterialDensity(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_DENSITY_OFFSET] = value2; } - return false; -} - -fn mapRingSdf(p: vec3<f32>, n: vec2<f32>, r: f32, th: f32, h: f32, rounding: f32) -> f32 { - let px = abs(p.x); - // expand result of mat2x2(n.x,n.y,-n.y,n.x)*p; - // let p2 = vec2<f32>(n.x * px + n.y * p.y, -n.y * px + n.x * p.y); - // Column-major instead of row-major - let p2 = vec2<f32>(n.x * px - n.y * p.y, n.y * px + n.x * p.y); - let d = max(abs(length(p2) - r) - th * 0.5f, length(vec2<f32>(p2.x, max(0f, abs(r - p2.y) - th * 0.5f))) * sign(p2.x)); - - // Extrude - let w = vec2<f32>(d, abs(p.z) - h); - return min(max(w.x, w.y), 0f) + length(max(w, vec2<f32>(0f, 0f))) - rounding; -} - -fn hitRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let ringSdf = &hittableBuffer.hittables[id]; - var t = tMin; - let size = (*ringSdf).size0; - let center = (*ringSdf).center0; - let rounding = (*ringSdf).rounding; - let outerr = size.x; - let innerr = size.y; - // Reduce angle such that inner radius arc reduces by rounding - var angle = (*ringSdf).parameter1; - angle -= angle * rounding / innerr * PI * 2; - let cs = vec2<f32>(cos(angle), sin(angle)); - let r = (outerr + innerr) * 0.5f; - let th = (outerr - innerr) - rounding; - let e = size.z - rounding; - for (var i: u32 = 0u; i < 256u; i = i + 1u) { - let position = rayAt(ray, t); - let oc = position - center; - let distance = abs(mapRingSdf(oc, cs, r, th, e, rounding)); - t = t + distance; - if (t > tMax) { return false; } - if (distance < 0.000001f) { - (*hitRecord).t = t; - (*hitRecord).position = rayAt(ray, t); - - // Normal - let h = 0.00001f; // replace by an appropriate value - let k = vec2<f32>(1f, -1f); - let outwardNormal = normalize( - k.xyy * mapRingSdf(oc + k.xyy * h, cs, r, th, e, rounding) + - k.yyx * mapRingSdf(oc + k.yyx * h, cs, r, th, e, rounding) + - k.yxy * mapRingSdf(oc + k.yxy * h, cs, r, th, e, rounding) + - k.xxx * mapRingSdf(oc + k.xxx * h, cs, r, th, e, rounding)); - setFaceNormal(ray, outwardNormal, hitRecord); - return true; - } + getMaterialGloss(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET]; } - return false; -} - -fn hitRotatedRingSdf(id: u32, ray: Ray, tMin: f32, tMax: f32, hitRecord: ptr<function, HitRecord>) -> bool { - let rotatedRingSdf = &hittableBuffer.hittables[id]; - let time = min(max((ray.time - (*rotatedRingSdf).time0) / ((*rotatedRingSdf).time1 - (*rotatedRingSdf).time0), 0f), 1f); // Normalize time to [0,1] - let center = (*rotatedRingSdf).center0 + time * ((*rotatedRingSdf).center1 - (*rotatedRingSdf).center0); - let rotation = slerpQuat((*rotatedRingSdf).rotation0, (*rotatedRingSdf).rotation1, time); - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - rotatedRay.time = ray.time; - let hit = hitRingSdf(id, rotatedRay, tMin, tMax, hitRecord); - if (hit) { - (*hitRecord).position = rotateQuat((*hitRecord).position - center, rotation) + center; - (*hitRecord).normal = rotateQuat((*hitRecord).normal, rotation); - return true; + setMaterialGloss(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_GLOSS_OFFSET] = value2; } - return false; -} - -fn hitLights(ray: Ray) -> vec3<f32> { - var hit: bool; - for (var i: u32 = 0u; i < arrayLength(&lightBuffer.lights); i = i + 1u) { - // let light = lightBuffer.lights[i]; - switch u32(lightBuffer.lights[i].typeId) { - default: { - hit = hitSphereLight(i, ray); - } - case 2u: { - hit = hitRectLight(i, ray); - } - } - if (hit) { - return lightBuffer.lights[i].color; - } - } - - // Background color - // return vec3<f32>(0f, 0f, 0f); - // return vec3<f32>(1f, 1f, 1f); - return uniforms.backgroundColor; - - // TODO: Dome light - // let t = 0.5f * (ray.direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return background; -} - -fn hitSphereLight(id: u32, ray: Ray) -> bool { - let sphere = &lightBuffer.lights[id]; - let radius = (*sphere).size.x; - let oc = ray.origin - (*sphere).center; - let b = dot(oc, ray.direction); - let c = dot(oc, oc) - radius * radius; - var h = b * b - c; - if (h < 0f) { return false; } - return b < 0f; // Ensure ray towards light -} - -fn hitRectLight(id: u32, ray: Ray) -> bool { - let rotatedXyRect = &lightBuffer.lights[id]; - let center = (*rotatedXyRect).center; - let rotation = (*rotatedXyRect).rotation; - let invRotation = conjugate(rotation); - var rotatedRay: Ray; - rotatedRay.origin = rotateQuat(ray.origin - center, invRotation) + center; - rotatedRay.direction = rotateQuat(ray.direction, invRotation); - if (dot(rotatedRay.direction, vec3<f32>(0f, 0f, 1f)) < 0f) { return false; } // Directional light - let oc = rotatedRay.origin - center; - let t = -oc.z / rotatedRay.direction.z; - if (t < 0f) { return false; } - let p = oc + t * rotatedRay.direction; - if (abs(p.x) > (*rotatedXyRect).size.x || abs(p.y) > (*rotatedXyRect).size.y) { return false; } - return true; -} - -fn nearZero(v: vec3<f32>) -> bool { - return max(max(abs(v.x), abs(v.y)), abs(v.z)) < 0.00000001f; // 1e-8 -} - -fn scatterLambertian(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let scatterDirection = hitRecord.normal + randomUnitVector(seed); - - // Catch degenerate scatter direction - (*ray).direction = select(normalize(scatterDirection), hitRecord.normal, nearZero(scatterDirection)); - - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - return true; -} - -fn scatterMetal(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + materialBuffer.materials[hitRecord.materialId].fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = textureValue(hitRecord); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; -} - -fn scatterGlossy(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Specular - let material = &materialBuffer.materials[hitRecord.materialId]; - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - if (reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = normalize(reflect((*ray).direction, hitRecord.normal) + (*material).fuzz * randomInUnitSphere(seed)); - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - - // Absorb any rays which fuzz scatters below the surface - return dot((*ray).direction, hitRecord.normal) > 0f; + getMaterialRefractiveIndex(index2) { + return this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET]; } - else { - // Lambertian - return scatterLambertian(ray, hitRecord, attenuation, seed); - } -} - -fn scatterDielectric(ray: ptr<function, Ray>, hitRecord: ptr<function, HitRecord>, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - let material = &materialBuffer.materials[(*hitRecord).materialId]; - let refractiveIndex = (*material).refractiveIndex; - // TODO: If still inside another material, use its refractive index - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, (*hitRecord).frontFace); - let cosTheta = min(dot(-(*ray).direction, (*hitRecord).normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - // if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - if (cannotRefract || reflectance(cosTheta, refractionRatio) * (*material).glossiness > random(seed)) { - (*ray).direction = reflect((*ray).direction, (*hitRecord).normal); + setMaterialRefractiveIndex(index2, value2) { + this[HittableBufferData.SIZE * index2 + this.MATERIAL_REFRACTIVE_INDEX_OFFSET] = value2; } - else { - (*ray).direction = refraction((*ray).direction, (*hitRecord).normal, refractionRatio); - } - (*ray).origin = (*hitRecord).position; - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); - - // Did the ray enter/stay inside? - (*attenuation) = vec3<f32>(1f, 1f, 1f); - // if (dot((*ray).direction, (*hitRecord).normal) < 0f) { - if (dot((*ray).direction, select(-(*hitRecord).normal, (*hitRecord).normal, (*hitRecord).frontFace)) < 0f) { - (*hitRecord).isAbsorbing = true; - (*hitRecord).absorption = (*material).color; - - // If already inside another absorbing dielectric, add to absorption - if ((*hitRecord).previousIsAbsorbing && (*hitRecord).id != (*hitRecord).previousId) { - (*hitRecord).absorption = (*hitRecord).absorption + (*hitRecord).previousAbsorption; - } + getMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; } - return true; -} - -fn scatterIsotropic(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - (*ray).direction = randomUnitVector(seed); - (*ray).origin = hitRecord.position; - (*attenuation) = materialBuffer.materials[hitRecord.materialId].color; - return true; -} - -fn scatterVarnish(ray: ptr<function, Ray>, hitRecord: HitRecord, attenuation: ptr<function, vec3<f32>>, seed: ptr<function, u32>) -> bool { - // Front-face only (no internal reflection or refraction) - let material = &materialBuffer.materials[hitRecord.materialId]; - if (hitRecord.frontFace && (*material).glossiness > random(seed)) { - let refractiveIndex = (*material).refractiveIndex; - let refractionRatio = select(refractiveIndex, 1f / refractiveIndex, hitRecord.frontFace); - let cosTheta = min(dot(-(*ray).direction, hitRecord.normal), 1f); - let sinTheta = sqrt(1f - cosTheta * cosTheta); - let cannotRefract = refractionRatio * sinTheta > 1f; - if (cannotRefract || reflectance(cosTheta, refractionRatio) > random(seed)) { - (*ray).direction = reflect((*ray).direction, hitRecord.normal); - } - else { - // Refraction improves definition at edges and deepens color on faces - (*ray).direction = refraction((*ray).direction, hitRecord.normal, refractionRatio); - } - (*ray).direction = normalize((*ray).direction + (*material).fuzz * randomInUnitSphere(seed)); + setMaterialColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.MATERIAL_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - // Pass-through - (*ray).origin = hitRecord.position; - (*attenuation) = vec3<f32>(1f, 1f, 1f); - return true; -} - -fn textureValue(hitRecord: HitRecord) -> vec3<f32> { - let textureId = materialBuffer.materials[hitRecord.materialId].textureId; - let texture = &textureBuffer.textures[u32(textureId)]; - switch u32((*texture).typeId) { - // No texture - default: { - return vec3<f32>(); - } - // Solid color - case 1u: { - if (hitRecord.sdfBorder) { - return (*texture).color1; - } - else { - return (*texture).color0; - } - - // Debug uv - // return vec3<f32>(hitRecord.uv, 0f); - } - // Image - case 2u: { - // Sample in linear space - return textureSampleLevel(backgroundTexture, linearSampler, hitRecord.uv, 0f).rgb; - // return vec3(hitRecord.uv.x, hitRecord.uv.y, 0f); - } - // Checker - case 4u: { - let q = trunc((hitRecord.uv + (*texture).offset) / (*texture).size0.xy); - return select((*texture).color0, (*texture).color1, (q.x + q.y) % 2f > 0f); - } - // Grid - case 5u: { - let size0 = (*texture).size0; - let size1 = (*texture).size1; - let clip = (*texture).clip; - if (hitRecord.uv.x < clip.x || hitRecord.uv.y < clip.y || hitRecord.uv.x > clip.z || hitRecord.uv.y > clip.w) { - return (*texture).color1; - } - let uv = hitRecord.uv + (*texture).offset; - var d = uv / size0.xy; - d = abs(d - round(d)) * size0.xy; - if (d.x < size1.x || d.y < size1.y) { - return (*texture).color0; - } - else { - d = uv / size0.zw; - d = abs(d - round(d)) * size0.zw; - if (d.x < size1.z || d.y < size1.w) { - return (*texture).color0; - } - return (*texture).color1; - } - } + getSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + value2[0] = this[offset2]; + value2[1] = this[offset2 + 1]; + value2[2] = this[offset2 + 2]; + value2[3] = this[offset2 + 3]; } -} - -fn rayColor(ray: ptr<function, Ray>, seed: ptr<function, u32>) -> vec3<f32> { - let maxDepth = 16u; // TODO: Pass as uniform - var depth = 0u; - // var result: Color; - var color = vec3<f32>(1f, 1f, 1f); - var attenuation = vec3<f32>(1f, 1f, 1f); - var emitted = vec3<f32>(0f, 0f, 0f); - var hitRecord: HitRecord; - hitRecord.id = 4294967295; // -1 as u32 - var scatter: bool; - loop { - // if (hitWorld(*ray, 0.00001f, 100f, &hitRecord, seed)) { - if (hitBVH(*ray, 0.00001f, 100f, &hitRecord, seed)) { - // Debug normal, depth - // First hit - // if (depth == 0u) { - // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - // // result.normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f) - // // result.depth = 1f / hitRecord.t; - // result.depth = -1f / dot(hitRecord.position - (*ray).origin, uniforms.forward); - // } - // return result; - - // Depth - depth = depth + 1u; - if (depth == maxDepth) { - // Exceeded bounce limit, no more light is gathered - // result.color = vec3<f32>(0f, 0f, 0f); - // return result; - return vec3<f32>(0f, 0f, 0f); - } - - // Bounce - // If last hit was travelling INTO a dielectric, use last hit position to calculate distance - // and apply Beer's law to attenuate the light. Modify the dielectric scattering function to - // recrord travelling INTO a dielectric based on hitRecord normal and ray direction. - // Reset this flag each time here. - if (hitRecord.previousIsAbsorbing) { - // Beer's law - let d = distance(hitRecord.previousPosition, hitRecord.position); - color = color * exp(-d * hitRecord.previousAbsorption); - } - // Reset absorption - hitRecord.isAbsorbing = false; - hitRecord.absorption = vec3<f32>(0f, 0f, 0f); - switch u32(materialBuffer.materials[hitRecord.materialId].typeId) { - default: { - scatter = false; - } - case 0u: { - scatter = scatterLambertian(ray, hitRecord, &attenuation, seed); - } - case 1u: { - scatter = scatterMetal(ray, hitRecord, &attenuation, seed); - } - case 2u: { - scatter = scatterDielectric(ray, &hitRecord, &attenuation, seed); - } - case 3u: { - scatter = scatterGlossy(ray, hitRecord, &attenuation, seed); - } - case 4u: { - // Diffuse light - scatter = false; - emitted = materialBuffer.materials[hitRecord.materialId].color; - } - case 5u: { - scatter = scatterIsotropic(ray, hitRecord, &attenuation, seed); - } - case 6u: { - scatter = scatterVarnish(ray, hitRecord, &attenuation, seed); - } - } - - if (scatter) { - // Attenuate - color = color * attenuation; - } - else { - // Emit - // result.color = color * emitted; - // return result; - return color * emitted; - } - } - else { - // return color; - - // No hits - if (depth > 0u) { // Hide lights, background - return hitLights(*ray) * color; - // result.color = hitLights(*ray) * color; - // return result; - } - else { - // return vec3<f32>(0f, 0f, 0f); - return uniforms.backgroundColor; - // result.color = uniforms.backgroundColor; - // return result; - } - - // Background - // let t = 0.5f * ((*ray).direction.y + 1f); - // let background = (1f - t) * vec3<f32>(1f, 1f, 1f) + t * vec3<f32>(0.5f, 0.7f, 1.0f); - // return color * background; - } - } -} - -// TODO: Try writing color directly using var outputTexture : texture_storage_2d<rgb32f,read_write>; -// textureStore(outputTexture, uv, vec3<f32>(1f, 1f, 1f)); -@group(0) @binding(0) var<storage, read_write> outputColorBuffer: ColorBuffer; -@group(0) @binding(1) var<uniform> uniforms: Uniforms; -@group(0) @binding(2) var<storage, read> hittableBuffer: HittableBuffer; -@group(0) @binding(3) var<storage, read> materialBuffer: MaterialBuffer; -@group(0) @binding(4) var<storage, read> textureBuffer: TextureBuffer; -@group(0) @binding(5) var<storage, read> lightBuffer: LightBuffer; -@group(0) @binding(6) var<storage, read> linearBVHNodeBuffer: LinearBVHNodeBuffer; -@group(0) @binding(7) var linearSampler: sampler; -@group(0) @binding(8) var fontTexture: texture_2d<f32>; -@group(0) @binding(9) var backgroundTexture: texture_2d<f32>; -@group(0) @binding(10) var atlasTexture: texture_2d<f32>; -@group(0) @binding(11) var<storage, read_write> outputNormalDepthBuffer: NormalDepthBuffer; -@group(0) @binding(12) var<storage, read_write> depthMinMaxBuffer: DepthMinMaxBuffer; - -// TODO: Move lighting to seperate bind group so I can update it independently - -@compute @workgroup_size(256, 1, 1) -fn clear(@builtin(global_invocation_id) globalId : vec3<u32>) { - var index = globalId.x * 3u; - outputColorBuffer.values[index] = 0f; - outputColorBuffer.values[index + 1u] = 0f; - outputColorBuffer.values[index + 2u] = 0f; - index = globalId.x * 4u; - outputNormalDepthBuffer.values[index] = 0f; // Normal x - outputNormalDepthBuffer.values[index + 1u] = 0f; // Normal y - outputNormalDepthBuffer.values[index + 2u] = 0f; // Normal z - outputNormalDepthBuffer.values[index + 3u] = 0f; // Depth - atomicStore(&depthMinMaxBuffer.values[0], 4294967295u); - atomicStore(&depthMinMaxBuffer.values[1], 0u); -} - -@compute @workgroup_size(256, 1, 1) -fn depthNormal(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var normal = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - normal = hitRecord.normal * 0.5f + vec3<f32>(0.5f, 0.5f, 0.5f); - depth = -1f / dot(hitRecord.position - ray.origin, uniforms.forward); - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = normal.x; - outputNormalDepthBuffer.values[index + 1u] = normal.y; - outputNormalDepthBuffer.values[index + 2u] = normal.z; - outputNormalDepthBuffer.values[index + 3u] = depth; - - // Min, max depth - // When depth is 0, it means no hit, so ignore - if (depth > 0f) { - atomicMin(&depthMinMaxBuffer.values[0], u32(depth * 1000f)); - } - atomicMax(&depthMinMaxBuffer.values[1], u32(depth * 1000f)); -} - -@compute @workgroup_size(256, 1, 1) -fn segment(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // Tex coords [0,1] - // let id = f32(globalId.x); - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord); - - // Ray - var seed = 0u; // No depth of field for depth, normal - var ray = getCameraRay(camera, &seed, samplePos); - - // Result - var color = vec4<f32>(1f, 1f, 1f, 0f); - var hitRecord: HitRecord; - if (hitBVH(ray, 0.00001f, 100f, &hitRecord, &seed)) { - // color = materialBuffer.materials[hitRecord.materialId].idColor; - let id = f32(hitRecord.id & 255u) / 255f; - color.x = id; - color.y = id; - color.z = id; - // let color3 = textureValue(hitRecord); - // color.x = color3.x; - // color.y = color3.y; - // color.z = color3.z; - } - - let index = globalId.x * 4u; - // let index = u32(pixelY * imageSize.x + pixelX) * 4u; - outputNormalDepthBuffer.values[index] = color.x; - outputNormalDepthBuffer.values[index + 1u] = color.y; - outputNormalDepthBuffer.values[index + 2u] = color.z; - outputNormalDepthBuffer.values[index + 3u] = 1f; -} - -// @builtin(local_invocation_id) localId : vec3<u32>, -// @builtin(num_workgroups) numWorkgroups : vec3<u32>, -// @builtin(workgroup_id) workgroupId : vec3<u32> -// TODO: Use workgroup dimensions xy to get position directly froem globalId -// Then store using textureStore -// Check within bounds due to overdispatching - -@compute @workgroup_size(256, 1, 1) -fn main(@builtin(global_invocation_id) globalId : vec3<u32>) { - let imageSize = vec2<f32>(uniforms.width * uniforms.tilesX, uniforms.height * uniforms.tilesY); - let tileSize = vec2<f32>(uniforms.width, uniforms.height); - - // TODO: Is additional noise when tiling due to sdf iterations (try non-sdf), texel offsets, (size - 1) issues, overdispatching? - - // Tex coords [0,1] - // let id = f32(globalId.x); - // TODO: Divide by (imageSize.x - 1) - // let v = floor(id / imageSize.x); - // let u = (id - v * imageSize.x); - // let uv = vec2<f32>(u, v); - // let texCoord = uv / imageSize; - - // Pixel coords ([0,width-1], [0,height-1]) - let id = f32(globalId.x); - let tilePixelY = floor(id / tileSize.x); - let tilePixelX = id - tilePixelY * tileSize.x; - let imagePixelX = tilePixelX + uniforms.tileOffsetX * tileSize.x; - let imagePixelY = tilePixelY + uniforms.tileOffsetY * tileSize.y; - - // Tex coords ([0,1], [0,1]) - let texCoord = vec2<f32>(imagePixelX / imageSize.x, imagePixelY / imageSize.y); - - // Camera - var camera = getCamera(uniforms); - - // Frame seed - var frameSeed = u32(uniforms.seed); - let raysPerFrame = u32(uniforms.raysPerFrame); - var color = vec3<f32>(0f, 0f, 0f); - var depth = 0f; - var normal = vec3<f32>(0f, 0f, 0f); - var seed: u32; - - for (var i = 0u; i < raysPerFrame; i = i + 1u) { - // Random number generator - // See https://nelari.us/post/weekend_raytracing_with_wgpu_1/#implement-a-random-number-generator - // fn initRng(pixel: vec2<u32>, resolution: vec2<u32>, frame: u32) -> u32 { - // // Adapted from https://github.com/boksajak/referencePT - // let seed = dot(pixel, vec2<u32>(1u, resolution.x)) ^ jenkinsHash(frame); - // return jenkinsHash(seed); - // } - // - // fn jenkinsHash(input: u32) -> u32 { - // var x = input; - // x += x << 10u; - // x ^= x >> 6u; - // x += x << 3u; - // x ^= x >> 11u; - // x += x << 15u; - // return x; - // } - // TODO: Consider switching to u32 for uniforms and use vec3<u32> arithmetic - seed = u32(tilePixelY * tileSize.x + tilePixelX) + frameSeed * u32(tileSize.x * tileSize.y); - - // Sample position (sub-pixel sampling has same seed, but only sampled once per frame) - let samplePos = vec2<f32>(texCoord) + vec2<f32>(random(&seed), random(&seed)) / imageSize; - - // Ray - var ray = getCameraRay(camera, &seed, samplePos); - - // Color [0,1] - // let color = result.color; - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(1f, 1f, 1f)); - // let color = clamp(result.color, vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - color += clamp(rayColor(&ray, &seed), vec3<f32>(0f, 0f, 0f), vec3<f32>(10f, 10f, 10f)); // Max light - - // Depth - // let depth = 1f / rayColor(&ray, &seed).depth; - // color = vec3<f32>(depth, depth, depth); - // depth += result.depth; - - // Normal - // normal += result.normal; - - // Next frame - frameSeed = frameSeed + 1u; - } - let index = globalId.x * 3u; - outputColorBuffer.values[index + 0u] = outputColorBuffer.values[index + 0u] + color.x; - outputColorBuffer.values[index + 1u] = outputColorBuffer.values[index + 1u] + color.y; - outputColorBuffer.values[index + 2u] = outputColorBuffer.values[index + 2u] + color.z; - // outputDepthBuffer.values[globalId.x] = outputDepthBuffer.values[globalId.x] + depth; - // outputNormalBuffer.values[index + 0u] = outputNormalBuffer.values[index + 0u] + normal.x; - // outputNormalBuffer.values[index + 1u] = outputNormalBuffer.values[index + 1u] + normal.y; - // outputNormalBuffer.values[index + 2u] = outputNormalBuffer.values[index + 2u] + normal.z; -}`; -class ComputeUniformBufferData extends Float32Array { - constructor(){ - super(ComputeUniformBufferData.SIZE); - this.POSITION_OFFSET = 0; - this.WIDTH_OFFSET = 3; - this.RIGHT_OFFSET = 4; - this.HEIGHT_OFFSET = 7; - this.UP_OFFSET = 8; - this.SEED_OFFSET = 11; - this.FORWARD_OFFSET = 12; - this.FOV_OFFSET = 15; - this.LOOKAT_OFFSET = 16; - this.APERTURE_OFFSET = 19; - this.BACKGROUND_COLOR_OFFSET = 20; - this.TIME0_OFFSET = 23; - this.TIME1_OFFSET = 24; - this.TILES_X = 25; - this.TILES_Y = 26; - this.TILE_OFFSET_X = 27; - this.TILE_OFFSET_Y = 28; - this.RAYS_PER_FRAME_OFFSET = 29; + setSegmentColor(index2, value2) { + const offset2 = HittableBufferData.SIZE * index2 + this.SEGMENT_COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; + } + } + HittableBufferData.SIZE = 208 / 4; + class ComputeUniformBufferData extends Float32Array { + constructor() { + super(ComputeUniformBufferData.SIZE); + this.POSITION_OFFSET = 0 / 4; + this.WIDTH_OFFSET = 12 / 4; + this.RIGHT_OFFSET = 16 / 4; + this.HEIGHT_OFFSET = 28 / 4; + this.UP_OFFSET = 32 / 4; + this.SEED_OFFSET = 44 / 4; + this.FORWARD_OFFSET = 48 / 4; + this.FOV_OFFSET = 60 / 4; + this.BACKGROUND_COLOR_OFFSET = 64 / 4; + this.TIME0_OFFSET = 76 / 4; + this.AMBIENT_COLOR_OFFSET = 80 / 4; + this.TIME1_OFFSET = 92 / 4; + this.TILES_X = 96 / 4; + this.TILES_Y = 100 / 4; + this.TILE_OFFSET_X = 104 / 4; + this.TILE_OFFSET_Y = 108 / 4; + this.LOOKAT_OFFSET = 112 / 4; + this.APERTURE_OFFSET = 124 / 4; + this.FOCUS_DISTANCE_OFFSET = 128 / 4; + this.RAYS_PER_FRAME_OFFSET = 132 / 4; + } + getFocusDistance() { + return this[this.FOCUS_DISTANCE_OFFSET]; + } + setFocusDistance(value2) { + this[this.FOCUS_DISTANCE_OFFSET] = value2; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSeed() { - return this[this.SEED_OFFSET]; + return this[this.SEED_OFFSET]; } - setSeed(value) { - this[this.SEED_OFFSET] = value; + setSeed(value2) { + this[this.SEED_OFFSET] = value2; } getRaysPerFrame() { - return this[this.RAYS_PER_FRAME_OFFSET]; + return this[this.RAYS_PER_FRAME_OFFSET]; } - setRaysPerFrame(value) { - this[this.RAYS_PER_FRAME_OFFSET] = value; + setRaysPerFrame(value2) { + this[this.RAYS_PER_FRAME_OFFSET] = value2; } getFieldOfView() { - return this[this.FOV_OFFSET]; + return this[this.FOV_OFFSET]; } - setFieldOfView(value) { - this[this.FOV_OFFSET] = value; + setFieldOfView(value2) { + this[this.FOV_OFFSET] = value2; } getAperture() { - return this[this.APERTURE_OFFSET]; + return this[this.APERTURE_OFFSET]; } - setAperture(value) { - this[this.APERTURE_OFFSET] = value; + setAperture(value2) { + this[this.APERTURE_OFFSET] = value2; } - getPosition(value) { - (0, _glMatrix.vec3).set(value, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); + getPosition(value2) { + set$3(value2, this[this.POSITION_OFFSET], this[this.POSITION_OFFSET + 1], this[this.POSITION_OFFSET + 2]); } - setPosition(value) { - this[this.POSITION_OFFSET] = value[0]; - this[this.POSITION_OFFSET + 1] = value[1]; - this[this.POSITION_OFFSET + 2] = value[2]; + setPosition(value2) { + this[this.POSITION_OFFSET] = value2[0]; + this[this.POSITION_OFFSET + 1] = value2[1]; + this[this.POSITION_OFFSET + 2] = value2[2]; } - getRight(value) { - (0, _glMatrix.vec3).set(value, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); + getRight(value2) { + set$3(value2, this[this.RIGHT_OFFSET], this[this.RIGHT_OFFSET + 1], this[this.RIGHT_OFFSET + 2]); } - setRight(value) { - this[this.RIGHT_OFFSET] = value[0]; - this[this.RIGHT_OFFSET + 1] = value[1]; - this[this.RIGHT_OFFSET + 2] = value[2]; + setRight(value2) { + this[this.RIGHT_OFFSET] = value2[0]; + this[this.RIGHT_OFFSET + 1] = value2[1]; + this[this.RIGHT_OFFSET + 2] = value2[2]; } - getUp(value) { - (0, _glMatrix.vec3).set(value, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); + getUp(value2) { + set$3(value2, this[this.UP_OFFSET], this[this.UP_OFFSET + 1], this[this.UP_OFFSET + 2]); } - setUp(value) { - this[this.UP_OFFSET] = value[0]; - this[this.UP_OFFSET + 1] = value[1]; - this[this.UP_OFFSET + 2] = value[2]; + setUp(value2) { + this[this.UP_OFFSET] = value2[0]; + this[this.UP_OFFSET + 1] = value2[1]; + this[this.UP_OFFSET + 2] = value2[2]; } - getForward(value) { - (0, _glMatrix.vec3).set(value, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); + getForward(value2) { + set$3(value2, this[this.FORWARD_OFFSET], this[this.FORWARD_OFFSET + 1], this[this.FORWARD_OFFSET + 2]); } - setForward(value) { - this[this.FORWARD_OFFSET] = value[0]; - this[this.FORWARD_OFFSET + 1] = value[1]; - this[this.FORWARD_OFFSET + 2] = value[2]; + setForward(value2) { + this[this.FORWARD_OFFSET] = value2[0]; + this[this.FORWARD_OFFSET + 1] = value2[1]; + this[this.FORWARD_OFFSET + 2] = value2[2]; } - getLookAt(value) { - (0, _glMatrix.vec3).set(value, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + getBackgroundColor(value2) { + set$2(value2, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], this[this.BACKGROUND_COLOR_OFFSET + 3]); } - setLookAt(value) { - this[this.LOOKAT_OFFSET] = value[0]; - this[this.LOOKAT_OFFSET + 1] = value[1]; - this[this.LOOKAT_OFFSET + 2] = value[2]; + setBackgroundColor(value2) { + this[this.BACKGROUND_COLOR_OFFSET] = value2[0]; + this[this.BACKGROUND_COLOR_OFFSET + 1] = value2[1]; + this[this.BACKGROUND_COLOR_OFFSET + 2] = value2[2]; + this[this.BACKGROUND_COLOR_OFFSET + 3] = value2[3]; } - getBackgroundColor(value) { - (0, _glMatrix.vec4).set(value, this[this.BACKGROUND_COLOR_OFFSET], this[this.BACKGROUND_COLOR_OFFSET + 1], this[this.BACKGROUND_COLOR_OFFSET + 2], 1); + getAmbientColor(value2) { + set$3(value2, this[this.AMBIENT_COLOR_OFFSET], this[this.AMBIENT_COLOR_OFFSET + 1], this[this.AMBIENT_COLOR_OFFSET + 2]); } - setBackgroundColor(value) { - this[this.BACKGROUND_COLOR_OFFSET] = value[0]; - this[this.BACKGROUND_COLOR_OFFSET + 1] = value[1]; - this[this.BACKGROUND_COLOR_OFFSET + 2] = value[2]; + setAmbientColor(value2) { + this[this.AMBIENT_COLOR_OFFSET] = value2[0]; + this[this.AMBIENT_COLOR_OFFSET + 1] = value2[1]; + this[this.AMBIENT_COLOR_OFFSET + 2] = value2[2]; } getTime0() { - return this[this.TIME0_OFFSET]; + return this[this.TIME0_OFFSET]; } - setTime0(value) { - this[this.TIME0_OFFSET] = value; + setTime0(value2) { + this[this.TIME0_OFFSET] = value2; } getTime1() { - return this[this.TIME1_OFFSET]; + return this[this.TIME1_OFFSET]; } - setTime1(value) { - this[this.TIME1_OFFSET] = value; + setTime1(value2) { + this[this.TIME1_OFFSET] = value2; } getTilesX() { - return this[this.TILES_X]; + return this[this.TILES_X]; } - setTilesX(value) { - this[this.TILES_X] = value; + setTilesX(value2) { + this[this.TILES_X] = value2; } getTilesY() { - return this[this.TILES_Y]; + return this[this.TILES_Y]; } - setTilesY(value) { - this[this.TILES_Y] = value; + setTilesY(value2) { + this[this.TILES_Y] = value2; } getTileOffsetX() { - return this[this.TILE_OFFSET_X]; + return this[this.TILE_OFFSET_X]; } - setTileOffsetX(value) { - this[this.TILE_OFFSET_X] = value; + setTileOffsetX(value2) { + this[this.TILE_OFFSET_X] = value2; } getTileOffsetY() { - return this[this.TILE_OFFSET_Y]; - } - setTileOffsetY(value) { - this[this.TILE_OFFSET_Y] = value; - } -} -ComputeUniformBufferData.SIZE = 32; - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iaEI5":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FullscreenQuadWgsl", ()=>FullscreenQuadWgsl); -parcelHelpers.export(exports, "FullscreenQuadUniformBufferData", ()=>FullscreenQuadUniformBufferData); -const FullscreenQuadWgsl = ` -const GAMMA = vec3<f32>(0.45454545f); // 1 / 2.2 - -struct ColorData { - data : array<f32>, -} - -struct NormalDepthData { - data : array<f32>, -} - - // offest align size -struct Uniforms { // ------------------------------ - width: f32, // 0 4 4 - height: f32, // 4 4 4 - samplesPerPixel: f32, // 8 4 4 - exposure: f32, // 12 4 4 - minDepth: f32, // 16 4 4 - maxDepth: f32, // 20 4 4 - normalEdge: f32, // 24 4 4 - depthEdge: f32, // 28 4 4 -} // ------------------------------ - // 4 32 - -@group(0) @binding(0) var<uniform> uniforms : Uniforms; -@group(0) @binding(1) var<storage, read> colorBuffer : ColorData; -@group(0) @binding(2) var<storage, read> normalDepthBuffer : NormalDepthData; - -struct VertexOutput { - @builtin(position) Position : vec4<f32>, -}; - -@vertex -fn vert_main(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { - var pos = array<vec2<f32>, 6>( - vec2<f32>( 1f, 1f), - vec2<f32>( 1f, -1f), - vec2<f32>(-1f, -1f), - vec2<f32>( 1f, 1f), - vec2<f32>(-1f, -1f), - vec2<f32>(-1f, 1f)); - var output : VertexOutput; - output.Position = vec4<f32>(pos[vertexIndex], 0f, 1f); - return output; -} - -@fragment -fn frag_main(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - // [0,1] - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -} - -@fragment -fn frag_depth(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - let depth = normalDepthBuffer.data[index + 3u]; - let minDepth = uniforms.minDepth; - let maxDepth = uniforms.maxDepth; - if (minDepth == maxDepth) { - // Raw, unnormalized depth - return vec4<f32>(vec3<f32>(depth, depth, depth), 1f); + return this[this.TILE_OFFSET_Y]; } - else { - // Normalize depth - var normalizedDepth = (depth - minDepth) / (maxDepth - minDepth); - return vec4<f32>(normalizedDepth, normalizedDepth, normalizedDepth, 1f); - } -} - -@fragment -fn frag_normal(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -// @fragment -// fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { -// let x = floor(coord.x); -// let y = floor(coord.y); -// let index = u32(x + y * uniforms.width) * 4u; - -// // Prevent edge detection at screen edges -// if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } - -// // Normal derivatives -// let p = vec3<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u]); -// let px = vec3<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u]); -// let py = vec3<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u]); -// let dpdx = px - p; -// let dpdy = py - p; -// let fwidth = abs(dpdx) + abs(dpdy); - -// // Depth derivatives -// let d = normalDepthBuffer.data[index + 3u]; -// let dx = normalDepthBuffer.data[index + 7u]; -// let dy = normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]; -// let ddpx = dx - d; -// let ddpy = dy - d; - -// // Normalize depth -// // let minDepth = uniforms.minDepth; -// // let maxDepth = uniforms.maxDepth; -// // let nd = (d - minDepth) / (maxDepth - minDepth); -// // let ndx = (dx - minDepth) / (maxDepth - minDepth); -// // let ndy = (dy - minDepth) / (maxDepth - minDepth); -// // let ddpx = ndx - nd; -// // let ddpy = ndy - nd; - -// let dfwidth = abs(ddpx) + abs(ddpy); - -// // Output white when magnitude of dpdx over a threshold -// let depthEdge = uniforms.depthEdge; -// let normalEdge = uniforms.normalEdge; -// if (dot(fwidth, fwidth) > normalEdge || dfwidth > depthEdge) { -// return vec4<f32>(1f, 1f, 1f, 1f); -// } else { -// return vec4<f32>(0f, 0f, 0f, 1f); -// } -// } - -@fragment -fn frag_edge(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - - // Prevent edge detection at screen edges - if (x == 0 || x == uniforms.width - 1 || y == 0 || y == uniforms.height - 1) { - return vec4<f32>(0f, 0f, 0f, 1f); - } - - // Segment derivatives - let p = vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], normalDepthBuffer.data[index + 3u]); - let px = vec4<f32>(normalDepthBuffer.data[index + 4u], normalDepthBuffer.data[index + 5u], normalDepthBuffer.data[index + 6u], normalDepthBuffer.data[index + 7u]); - let py = vec4<f32>(normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 0u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 1u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 2u], normalDepthBuffer.data[index + u32(uniforms.width) * 4u + 3u]); - let dpdx = px - p; - let dpdy = py - p; - let fwidth = abs(dpdx) + abs(dpdy); - - // Output white when magnitude of dpdx over a threshold - if (dot(fwidth, fwidth) > 0f) { - return vec4<f32>(1f, 1f, 1f, 1f); - } else { - return vec4<f32>(0f, 0f, 0f, 1f); - // return p; - } -} - -@fragment -fn frag_segment(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 4u; - return vec4<f32>(normalDepthBuffer.data[index + 0u], normalDepthBuffer.data[index + 1u], normalDepthBuffer.data[index + 2u], 1f); -} - -@fragment -fn frag_main_hdr(@builtin(position) coord: vec4<f32>) -> @location(0) vec4<f32> { - let x = floor(coord.x); - let y = floor(coord.y); - let index = u32(x + y * uniforms.width) * 3u; - var color = vec3<f32>(colorBuffer.data[index + 0u], colorBuffer.data[index + 1u], colorBuffer.data[index + 2u]) / uniforms.samplesPerPixel; - - // Simple tone-mapping from HDR to LDR - // if (uniforms.exposure > 0f) { - // color = color * uniforms.exposure; - // color = color / (color + vec3<f32>(1f, 1f, 1f)); - // } - - color = color * uniforms.exposure; - // ACES - // https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/ - let a = 2.51f; - let b = 0.03f; - let c = 2.43f; - let d = 0.59f; - let e = 0.14f; - color = (color * (a * color + b)) / (color * (c * color + d) + e); - - // See https://bruop.github.io/tonemapping/ - // See https://www.shadertoy.com/view/WdjSW3 - - // Gamma-correct - return vec4<f32>(pow(color, GAMMA), 1f); -}`; -class FullscreenQuadUniformBufferData extends Float32Array { - constructor(){ - super(FullscreenQuadUniformBufferData.SIZE); - this.WIDTH_OFFSET = 0; - this.HEIGHT_OFFSET = 1; - this.SPP_OFFSET = 2; - this.EXPOSURE_OFFSET = 3; - this.MIN_DEPTH_OFFSET = 4; - this.MAX_DEPTH_OFFSET = 5; - this.EDGE_NORMAL_OFFSET = 6; - this.EDGE_DEPTH_OFFSET = 7; + setTileOffsetY(value2) { + this[this.TILE_OFFSET_Y] = value2; + } + getLookAt(value2) { + set$3(value2, this[this.LOOKAT_OFFSET], this[this.LOOKAT_OFFSET + 1], this[this.LOOKAT_OFFSET + 2]); + } + setLookAt(value2) { + this[this.LOOKAT_OFFSET] = value2[0]; + this[this.LOOKAT_OFFSET + 1] = value2[1]; + this[this.LOOKAT_OFFSET + 2] = value2[2]; + } + } + ComputeUniformBufferData.SIZE = 144 / 4; + class FullscreenQuadUniformBufferData extends Float32Array { + constructor() { + super(FullscreenQuadUniformBufferData.SIZE); + this.WIDTH_OFFSET = 0 / 4; + this.HEIGHT_OFFSET = 4 / 4; + this.SPP_OFFSET = 8 / 4; + this.EXPOSURE_OFFSET = 12 / 4; + this.MIN_DEPTH_OFFSET = 16 / 4; + this.MAX_DEPTH_OFFSET = 20 / 4; + this.EDGE_NORMAL_OFFSET = 24 / 4; + this.EDGE_DEPTH_OFFSET = 28 / 4; + this.EDGE_FOREGROUND_OFFSET = 32 / 4; + this.EDGE_BACKGROUND_OFFSET = 48 / 4; } getWidth() { - return this[this.WIDTH_OFFSET]; + return this[this.WIDTH_OFFSET]; } - setWidth(value) { - this[this.WIDTH_OFFSET] = value; + setWidth(value2) { + this[this.WIDTH_OFFSET] = value2; } getHeight() { - return this[this.HEIGHT_OFFSET]; + return this[this.HEIGHT_OFFSET]; } - setHeight(value) { - this[this.HEIGHT_OFFSET] = value; + setHeight(value2) { + this[this.HEIGHT_OFFSET] = value2; } getSamplesPerPixel() { - return this[this.SPP_OFFSET]; + return this[this.SPP_OFFSET]; } - setSamplesPerPixel(value) { - this[this.SPP_OFFSET] = value; + setSamplesPerPixel(value2) { + this[this.SPP_OFFSET] = value2; } getExposure() { - return this[this.EXPOSURE_OFFSET]; + return this[this.EXPOSURE_OFFSET]; } - setExposure(value) { - this[this.EXPOSURE_OFFSET] = value; + setExposure(value2) { + this[this.EXPOSURE_OFFSET] = value2; } getMinDepth() { - return this[this.MIN_DEPTH_OFFSET]; + return this[this.MIN_DEPTH_OFFSET]; } - setMinDepth(value) { - this[this.MIN_DEPTH_OFFSET] = value; + setMinDepth(value2) { + this[this.MIN_DEPTH_OFFSET] = value2; } getMaxDepth() { - return this[this.MAX_DEPTH_OFFSET]; + return this[this.MAX_DEPTH_OFFSET]; } - setMaxDepth(value) { - this[this.MAX_DEPTH_OFFSET] = value; + setMaxDepth(value2) { + this[this.MAX_DEPTH_OFFSET] = value2; } getEdgeDepth() { - return this[this.EDGE_DEPTH_OFFSET]; + return this[this.EDGE_DEPTH_OFFSET]; } - setEdgeDepth(value) { - this[this.EDGE_DEPTH_OFFSET] = value; + setEdgeDepth(value2) { + this[this.EDGE_DEPTH_OFFSET] = value2; } getEdgeNormal() { - return this[this.EDGE_NORMAL_OFFSET]; - } - setEdgeNormal(value) { - this[this.EDGE_NORMAL_OFFSET] = value; - } -} -FullscreenQuadUniformBufferData.SIZE = 8; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gC34F":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "SplitMethod", ()=>SplitMethod); -parcelHelpers.export(exports, "LinearBVHNode", ()=>LinearBVHNode); -parcelHelpers.export(exports, "BVHAccel", ()=>BVHAccel); -parcelHelpers.export(exports, "LinearBVHNodeBufferData", ()=>LinearBVHNodeBufferData); -var _glMatrix = require("gl-matrix"); -var _mainJs = require("../../main.js"); -var _aabbJs = require("./aabb.js"); -const SplitMethod = { - middle: "middle", - equalCounts: "equalCounts", - sah: "sah" -}; -class BVHPrimitiveInfo { - get primitiveNumber() { - return this._primitiveNumber; - } - get bounds() { - return this._bounds; - } - get centroid() { - return this._centroid; - } - constructor(primitiveNumber, bounds){ - this._primitiveNumber = primitiveNumber; - this._bounds = bounds; - this._centroid = (0, _glMatrix.vec3).create(); - bounds.centroid(this._centroid); - } -} -class BVHBuildNode { - get bounds() { - return this._bounds; - } - get left() { - return this._left; - } - get right() { - return this._right; - } - get splitAxis() { - return this._splitAxis; - } - get firstPrimOffset() { - return this._firstPrimOffset; - } - get nPrimitives() { - return this._nPrimitives; - } - get start() { - return this._start; - } - get end() { - return this._end; - } - constructor(start, end){ - this._start = start; - this._end = end; - } - initLeaf(first, n, bounds) { - this._firstPrimOffset = first; - this._nPrimitives = n; - this._bounds = bounds; - this._left = null; - this._right = null; - } - initInterior(axis, left, right) { - this._left = left; - this._right = right; - this._bounds = new (0, _aabbJs.AABB)(); - this._bounds.unionBounds(this._left.bounds); - this._bounds.unionBounds(this._right.bounds); - this._splitAxis = axis; - this._nPrimitives = 0; - } -} -class LinearBVHNode { - constructor(){ - this.bounds = new (0, _aabbJs.AABB)(); - this.primitivesOffset = 0; - this.secondChildOffset = 0; - this.nPrimitives = 0; - this.axis = 0; - this._centroid = (0, _glMatrix.vec3).create(); - this._size = (0, _glMatrix.vec3).create(); - } - toBuffer(buffer, index) { - this.bounds.centroid(this._centroid); - buffer.setCenter(index, this._centroid); - this.bounds.size(this._size); - (0, _glMatrix.vec3).scale(this._size, this._size, 0.5); - buffer.setSize(index, this._size); - buffer.setPrimitivesOffset(index, this.primitivesOffset); - buffer.setSecondChildOffset(index, this.secondChildOffset); - buffer.setNPrimitives(index, this.nPrimitives); - buffer.setAxis(index, this.axis); - } -} -class BVHAccel { - get orderedPrimitives() { - return this._orderedPrimitives; - } - get nodes() { - return this._nodes; - } - constructor(core, primitives, maxPrimsInNode, splitMethod){ - this._core = core; - if (!primitives || primitives.length == 0) return; - let start = performance.now(); - this._maxPrimsInNode = maxPrimsInNode; - this._splitMethod = splitMethod; - this._primitives = primitives; - this._normalized = (0, _glMatrix.vec3).create(); - this._primitiveInfo = []; - for(let i = 0; i < primitives.length; i++)this._primitiveInfo.push(new BVHPrimitiveInfo(i, primitives[i].bounds)); - this._totalNodes = 0; - this._orderedPrimitives = []; - const root = this._recursiveBuild(0, primitives.length); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh ${this._totalNodes} nodes split ${this._splitMethod} ${Math.round(window.performance.now() - start)}ms`); - start = performance.now(); - this._nodes = []; - for(let i = 0; i < this._totalNodes; i++)this._nodes.push(new LinearBVHNode()); - this._offset = 0; - this._flattenBVHTree(root); - this._core.log.write((0, _mainJs.LogLevel).info, `bvh flattened ${Math.round(window.performance.now() - start)}ms`); - } - _recursiveBuild(start, end) { - const node = new BVHBuildNode(start, end - 1); - this._totalNodes++; - const bounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)bounds.unionBounds(this._primitiveInfo[i].bounds); - const nPrimitives = end - start; - if (nPrimitives == 1) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - const centroidBounds = new (0, _aabbJs.AABB)(); - for(let i = start; i < end; i++)centroidBounds.unionPoint(this._primitiveInfo[i].centroid); - const dim = centroidBounds.maximumExtent(); - let mid = Math.floor((start + end) / 2); - if (centroidBounds.max[dim] == centroidBounds.min[dim]) { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } else { - switch(this._splitMethod){ - case SplitMethod.middle: - break; - case SplitMethod.equalCounts: - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - break; - case SplitMethod.sah: - default: - if (nPrimitives <= 4) { - mid = Math.floor((start + end) / 2); - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - } else { - const nBuckets = 12; - const buckets = []; - for(let i = 0; i < nBuckets; i++)buckets.push({ - count: 0, - bounds: new (0, _aabbJs.AABB)() - }); - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - buckets[b].count++; - buckets[b].bounds.unionBounds(this._primitiveInfo[i].bounds); - } - const cost = []; - for(let i = 0; i < nBuckets - 1; i++){ - const b0 = new (0, _aabbJs.AABB)(); - const b1 = new (0, _aabbJs.AABB)(); - let count0 = 0; - let count1 = 0; - for(let j = 0; j <= i; j++){ - b0.unionBounds(buckets[j].bounds); - count0 += buckets[j].count; - } - for(let j = i + 1; j < nBuckets; j++){ - b1.unionBounds(buckets[j].bounds); - count1 += buckets[j].count; - } - cost.push(0.125 + (count0 * b0.surfaceArea() + count1 * b1.surfaceArea()) / bounds.surfaceArea()); - } - let minCost = cost[0]; - let minCostSplitBucket = 0; - for(let i = 1; i < nBuckets - 1; i++)if (cost[i] < minCost) { - minCost = cost[i]; - minCostSplitBucket = i; - } - const leafCost = nPrimitives; - if (nPrimitives > this._maxPrimsInNode || minCost < leafCost) { - const primtiveInfo = this._primitiveInfo.slice(start, end); - primtiveInfo.sort(function(a, b) { - return a.centroid[dim] - b.centroid[dim]; - }); - for(let i = start; i < end; i++)this._primitiveInfo[i] = primtiveInfo[i - start]; - for(let i = start; i < end; i++){ - centroidBounds.offset(this._primitiveInfo[i].centroid, this._normalized); - const b = Math.min(Math.round(nBuckets * this._normalized[dim]), nBuckets - 1); - if (b > minCostSplitBucket) { - mid = i; - break; - } - } - } else { - const firstPrimOffset = this._orderedPrimitives.length; - for(let i = start; i < end; i++){ - const primNum = this._primitiveInfo[i].primitiveNumber; - this._orderedPrimitives.push(this._primitives[primNum]); - } - node.initLeaf(firstPrimOffset, nPrimitives, bounds); - return node; - } - } - break; - } - node.initInterior(dim, this._recursiveBuild(start, mid), this._recursiveBuild(mid, end)); - } - } - return node; - } - _flattenBVHTree(node) { - const linearNode = this._nodes[this._offset]; - linearNode.bounds = node.bounds; - const myOffset = this._offset++; - if (node.nPrimitives > 0) { - linearNode.primitivesOffset = node.firstPrimOffset; - linearNode.nPrimitives = node.nPrimitives; - } else { - linearNode.axis = node.splitAxis; - linearNode.nPrimitives = 0; - this._flattenBVHTree(node.left); - linearNode.secondChildOffset = this._flattenBVHTree(node.right); - } - return myOffset; - } -} -class LinearBVHNodeBufferData extends Float32Array { - constructor(count){ - super(count * LinearBVHNodeBufferData.SIZE); - this.CENTER_OFFSET = 0; - this.SIZE_OFFSET = 4; - this.PRIMITIVES_OFFSET_OFFSET = 3; - this.SECOND_CHILD_OFFSET_OFFSET = 7; - this.N_PRIMITIVES_OFFSET = 8; - this.AXIS_OFFSET = 9; - } - getCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LinearBVHNodeBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getPrimitivesOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET]; - } - setPrimitivesOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.PRIMITIVES_OFFSET_OFFSET] = value; - } - getSecondChildOffset(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET]; - } - setSecondChildOffset(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.SECOND_CHILD_OFFSET_OFFSET] = value; - } - getNPrimitives(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET]; - } - setNPrimitives(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.N_PRIMITIVES_OFFSET] = value; - } - getAxis(index) { - return this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET]; - } - setAxis(index, value) { - this[LinearBVHNodeBufferData.SIZE * index + this.AXIS_OFFSET] = value; - } -} -LinearBVHNodeBufferData.SIZE = 12; - -},{"gl-matrix":"erHGu","../../main.js":"b6Xbk","./aabb.js":"3Gscs","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"inb41":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LightType", ()=>LightType); -parcelHelpers.export(exports, "LightBufferData", ()=>LightBufferData); -parcelHelpers.export(exports, "Light", ()=>Light); -parcelHelpers.export(exports, "SphereLight", ()=>SphereLight); -parcelHelpers.export(exports, "RectLight", ()=>RectLight); -var _glMatrix = require("gl-matrix"); -const LightType = { - distant: 0, - sphere: 1, - rect: 2, - disc: 3, - cylinder: 4, - dome: 5 -}; -class LightBufferData extends Float32Array { - constructor(count){ - super(count * LightBufferData.SIZE); - this.ROTATION_OFFSET = 0; - this.CENTER_OFFSET = 4; - this.TYPE_OFFSET = 7; - this.SIZE_OFFSET = 8; - this.COLOR_OFFSET = 12; - } - getType(index) { - return this[LightBufferData.SIZE * index + this.TYPE_OFFSET]; - } - setType(index, value) { - this[LightBufferData.SIZE * index + this.TYPE_OFFSET] = value; - } - getCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setCenter(index, value) { - const offset = LightBufferData.SIZE * index + this.CENTER_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setSize(index, value) { - const offset = LightBufferData.SIZE * index + this.SIZE_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - (0, _glMatrix.vec3).set(value, this[offset], this[offset + 1], this[offset + 2]); - } - setColor(index, value) { - const offset = LightBufferData.SIZE * index + this.COLOR_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - } - getRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - (0, _glMatrix.quat).set(value, this[offset], this[offset + 1], this[offset + 2], this[offset + 3]); - } - setRotation(index, value) { - const offset = LightBufferData.SIZE * index + this.ROTATION_OFFSET; - this[offset] = value[0]; - this[offset + 1] = value[1]; - this[offset + 2] = value[2]; - this[offset + 3] = value[3]; - } -} -LightBufferData.SIZE = 16; -class Light { - constructor(options){ - this.color = options.color; - this.center = options.center; - } - toBuffer(buffer, index) { - buffer.setCenter(index, this.center); - buffer.setColor(index, this.color); - } -} -class SphereLight extends Light { - constructor(options){ - super(options); - this.radius = options.radius / 2; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.sphere); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.radius, this.radius, this.radius)); - } -} -class RectLight extends Light { - constructor(options){ - super(options); - this._thickness = 0.00001; - this.size = options.size; - this.rotation = options.rotation; - } - toBuffer(buffer, index) { - super.toBuffer(buffer, index); - buffer.setType(index, LightType.rect); - buffer.setSize(index, (0, _glMatrix.vec3).fromValues(this.size[0], this.size[1], this._thickness)); - buffer.setRotation(index, this.rotation); - } -} - -},{"gl-matrix":"erHGu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5qz1r":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "FontVisual", ()=>FontVisual); -var _mainJs = require("../../main.js"); -class FontVisual { - get isInitialized() { - return this._isInitialized; - } - get font() { - return this._font; + return this[this.EDGE_NORMAL_OFFSET]; } - constructor(core, font){ - this._core = core; - this._font = font; - font.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeNormal(value2) { + this[this.EDGE_NORMAL_OFFSET] = value2; } - initializeContext(device) { - this._device = device; - this._hasChanged = true; - this._isInitialized = true; + getEdgeForeground(value2) { + set$2(value2, this[this.EDGE_FOREGROUND_OFFSET], this[this.EDGE_FOREGROUND_OFFSET + 1], this[this.EDGE_FOREGROUND_OFFSET + 2], this[this.EDGE_FOREGROUND_OFFSET + 3]); } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - const imageData = this._font.atlas.imageData; - const textureSize = { - width: imageData.width, - height: imageData.height - }; - createImageBitmap(imageData).then((imageBitmap)=>{ - const textureDescriptor = { - size: textureSize, - format: 'rgba8unorm', - usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.RENDER_ATTACHMENT - }; - this.texture = this._device.createTexture(textureDescriptor); - const imageCopyExternalImage = { - source: imageBitmap - }; - const imageCopyTextureTagged = { - texture: this.texture - }; - const copySize = { - width: imageData.width, - height: imageData.height - }; - this._device.queue.copyExternalImageToTexture(imageCopyExternalImage, imageCopyTextureTagged, copySize); - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `${this._font.name} texture updated ${Math.round(window.performance.now() - start)}ms`); - }); - } + setEdgeForeground(value2) { + this[this.EDGE_FOREGROUND_OFFSET] = value2[0]; + this[this.EDGE_FOREGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_FOREGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_FOREGROUND_OFFSET + 3] = value2[3]; } -} - -},{"../../main.js":"b6Xbk","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"ebXJi":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ImageVisual", ()=>ImageVisual); -var _glMatrix = require("gl-matrix"); -var _imageJs = require("../../components/image.js"); -var _hittableJs = require("./hittable.js"); -class ImageVisual { - get isInitialized() { - return this._isInitialized; + getEdgeBackground(value2) { + set$2(value2, this[this.EDGE_BACKGROUND_OFFSET], this[this.EDGE_BACKGROUND_OFFSET + 1], this[this.EDGE_BACKGROUND_OFFSET + 2], this[this.EDGE_BACKGROUND_OFFSET + 3]); } - get image() { - return this._image; - } - render(elapsedTime) {} - constructor(core, main, image){ - this._core = core; - this._main = main; - this._image = image; - this.isVisible = true; - image.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; + setEdgeBackground(value2) { + this[this.EDGE_BACKGROUND_OFFSET] = value2[0]; + this[this.EDGE_BACKGROUND_OFFSET + 1] = value2[1]; + this[this.EDGE_BACKGROUND_OFFSET + 2] = value2[2]; + this[this.EDGE_BACKGROUND_OFFSET + 3] = value2[3]; } - initializeContext(device) { - if (!this._image.isInitialized) this._image.initialize(); - this._hasChanged = true; - this._isInitialized = true; + } + FullscreenQuadUniformBufferData.SIZE = 64 / 4; + class LinearBVHNodeBufferData extends Float32Array { + constructor(count2) { + super(count2 * LinearBVHNodeBufferData.SIZE); + this.CENTER_OFFSET = 0 / 4; + this.SIZE_OFFSET = 16 / 4; + this.PRIMITIVES_OFFSET_OFFSET = 12 / 4; + this.SECOND_CHILD_OFFSET_OFFSET = 28 / 4; + this.N_PRIMITIVES_OFFSET = 32 / 4; + this.AXIS_OFFSET = 36 / 4; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const material = this._image.material == -1 ? this._main.config.defaultMaterial : this._main.materials[this._image.material]; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - const modelSizeX = this._image.maxBoundsX - this._image.minBoundsX; - const modelSizeY = this._image.maxBoundsY - this._image.minBoundsY; - const modelSizeZ = this._image.maxBoundsZ - this._image.minBoundsZ; - const maxBounds = Math.max(modelSizeX, Math.max(modelSizeY, modelSizeZ)); - const boundsScaling = maxBounds == 0 ? 1 : 1 / maxBounds; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - if (this._image instanceof (0, _imageJs.ImageQuad)) { - const imageQuad = this._image; - const position = (0, _glMatrix.vec3).fromValues((imageQuad.minBoundsX + imageQuad.maxBoundsX) / 2, (imageQuad.minBoundsY + imageQuad.maxBoundsY) / 2, (imageQuad.minBoundsZ + imageQuad.maxBoundsZ) / 2); - (0, _glMatrix.vec3).subtract(position, imageQuad.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableRotatedXyRectOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - size1: (0, _glMatrix.vec2).fromValues(imageQuad.width * boundsScaling * modelScale / 2, imageQuad.height * boundsScaling * modelScale / 2), - material: material, - texCoord0: imageQuad.texCoord0, - texCoord1: imageQuad.texCoord1, - rotation0: imageQuad.rotation, - rotation1: imageQuad.rotation - }; - this.hittable = new (0, _hittableJs.HittableRotatedXyRect)(hittableRotatedXyRectOptions); - } else if (this._image instanceof (0, _imageJs.ImageSphere)) { - const imageSphere = this._image; - const position = imageSphere.position; - (0, _glMatrix.vec3).subtract(position, imageSphere.position, position); - (0, _glMatrix.vec3).scale(position, position, boundsScaling); - (0, _glMatrix.vec3).scale(position, position, modelScale); - (0, _glMatrix.vec3).transformQuat(position, position, modelRotation); - (0, _glMatrix.vec3).add(position, position, modelPosition); - const hittableSphereOptions = { - center0: position, - center1: position, - time0: 1, - time1: 1, - radius: imageSphere.radius * boundsScaling, - material: material - }; - this.hittable = new (0, _hittableJs.HittableSphere)(hittableSphereOptions); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"erHGu","../../components/image.js":"eexvE","./hittable.js":"a4kPP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1pTTV":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LabelSetVisual", ()=>LabelSetVisual); -var _glMatrix = require("gl-matrix"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -class LabelSetVisual { - get isInitialized() { - return this._isInitialized; + getCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - get label() { - return this._labelSet; - } - render(elapsedTime) {} - constructor(core, main, labelSet){ - this._core = core; - this._main = main; - this._labelSet = labelSet; - this.isVisible = true; - labelSet.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - if (!this._labelSet.isInitialized) this._labelSet.initialize(); - if (this._labelSet.text && this._labelSet.text.length > 0) this._hasChanged = true; - this._isInitialized = true; + setCenter(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const glpyhRotation = (0, _glMatrix.quat).create(); - const glyphInvRotation = (0, _glMatrix.quat).create(); - const position0 = (0, _glMatrix.vec3).create(); - const position1 = (0, _glMatrix.vec3).create(); - const dataView = this._labelSet.verticesView; - const labelCount = this._labelSet.text.length; - let glyphIndex = 0; - for(let i = 0; i < labelCount; i++){ - const material = this._labelSet.material !== undefined ? this._main.materials[this._labelSet.material] : this._labelSet.materials ? this._main.materials[this._labelSet.materials[i]] : this._main.config.defaultTextMaterial; - const glyphCount = this._labelSet.text[i].length; - for(let j = 0; j < glyphCount; j++){ - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 2, position0); - (0, _vertexJs.PositionTexturePickVertex).getPosition(dataView, glyphIndex * 4 + 1, position1); - (0, _glMatrix.vec3).scale(position0, position0, modelScale); - (0, _glMatrix.vec3).scale(position1, position1, modelScale); - (0, _glMatrix.vec3).transformQuat(position0, position0, modelRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, modelRotation); - (0, _glMatrix.vec3).add(position0, position0, modelPosition); - (0, _glMatrix.vec3).add(position1, position1, modelPosition); - const centroid = (0, _glMatrix.vec3).create(); - (0, _glMatrix.vec3).add(centroid, position0, position1); - (0, _glMatrix.vec3).scale(centroid, centroid, 0.5); - if (this._labelSet.rotation) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotation[0], this._labelSet.rotation[1], this._labelSet.rotation[2], this._labelSet.rotation[3]); - else if (this._labelSet.rotations) (0, _glMatrix.quat).set(glpyhRotation, this._labelSet.rotations[i * 4], this._labelSet.rotations[i * 4 + 1], this._labelSet.rotations[i * 4 + 2], this._labelSet.rotations[i * 4 + 3]); - else (0, _glMatrix.quat).identity(glpyhRotation); - const rotation = (0, _glMatrix.quat).clone(glpyhRotation); - (0, _glMatrix.quat).multiply(rotation, modelRotation, rotation); - (0, _glMatrix.quat).conjugate(glyphInvRotation, rotation); - (0, _glMatrix.vec3).subtract(position0, position0, centroid); - (0, _glMatrix.vec3).subtract(position1, position1, centroid); - (0, _glMatrix.vec3).transformQuat(position0, position0, glyphInvRotation); - (0, _glMatrix.vec3).transformQuat(position1, position1, glyphInvRotation); - (0, _glMatrix.vec3).add(position0, position0, centroid); - (0, _glMatrix.vec3).add(position1, position1, centroid); - const texCoord0 = (0, _glMatrix.vec2).create(); - const texCoord1 = (0, _glMatrix.vec2).create(); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 2, texCoord0); - (0, _vertexJs.PositionTexturePickVertex).getTexCoord(dataView, glyphIndex * 4 + 1, texCoord1); - const hittableFontOptions = { - center0: centroid, - center1: centroid, - time0: 1, - time1: 1, - size0: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - size1: (0, _glMatrix.vec2).fromValues((position1[0] - position0[0]) / 2, (position1[1] - position0[1]) / 2), - material: material, - texCoord0: texCoord0, - texCoord1: texCoord1, - rotation0: rotation, - rotation1: rotation, - sdfBuffer: this._core.config.sdfBuffer - }; - const hittable = new (0, _hittableJs.HittableRotatedFontXyRect)(hittableFontOptions); - this.hittables.push(hittable); - glyphIndex++; - } - } - if (this.hasChangedCallback) this.hasChangedCallback(); - } - } -} - -},{"gl-matrix":"erHGu","../../vertex.js":"8lW8V","./hittable.js":"a4kPP","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3l2Pt":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Buffer", ()=>Buffer); -parcelHelpers.export(exports, "TransitionBuffer", ()=>TransitionBuffer); -var _glMatrix = require("gl-matrix"); -var _atlasJs = require("../../atlas.js"); -var _bufferJs = require("../../buffer.js"); -var _indexJs = require("../../index.js"); -var _mainJs = require("../../main.js"); -var _paletteJs = require("../../palette.js"); -var _vertexJs = require("../../vertex.js"); -var _hittableJs = require("./hittable.js"); -var _materialJs = require("./material.js"); -var _mathJs = require("../../helpers/math.js"); -class Buffer extends (0, _bufferJs.BufferBase) { - constructor(core, ids){ - super(core, ids); - this._isInitialized = true; + getSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); } - update() { - if (this._isInitialized) { - if (this.hasChangedCallback) this.hasChangedCallback(); - } + setSize(index2, value2) { + const offset2 = LinearBVHNodeBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; } -} -class TransitionBuffer extends (0, _bufferJs.TransitionBufferBase) { - get time0() { - return this._time0; + getPrimitivesOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET]; } - set time0(value) { - if (this._time0 != value) { - this._time0 = value; - this._hasChanged = true; - } + setPrimitivesOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.PRIMITIVES_OFFSET_OFFSET] = value2; } - get time1() { - return this._time1; + getSecondChildOffset(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET]; } - set time1(value) { - if (this._time1 != value) { - this._time1 = value; - this._hasChanged = true; - } + setSecondChildOffset(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.SECOND_CHILD_OFFSET_OFFSET] = value2; } - get duration() { - return this._duration; + getNPrimitives(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET]; } - set duration(value) { - if (this._duration != value) { - this._duration = value; - this._hasChanged = true; - } + setNPrimitives(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.N_PRIMITIVES_OFFSET] = value2; } - get stagger() { - return this.stagger; + getAxis(index2) { + return this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET]; } - set stagger(value) { - if (this._stagger != value) { - this._stagger = value; - this._hasChanged = true; - } + setAxis(index2, value2) { + this[LinearBVHNodeBufferData.SIZE * index2 + this.AXIS_OFFSET] = value2; } - constructor(core, main, ids){ - super(core, ids, Buffer, (0, _paletteJs.Palette), (0, _atlasJs.Atlas)); - this._main = main; - this._time0 = 0; - this._time1 = 1; - this._buffer1.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._buffer2.hasChangedCallback = ()=>{ - this._hasChanged = true; - }; - this._isInitialized = true; + } + LinearBVHNodeBufferData.SIZE = 48 / 4; + class LightBufferData extends Float32Array { + constructor(count2) { + super(count2 * LightBufferData.SIZE); + this.ROTATION_OFFSET = 0 / 4; + this.CENTER_OFFSET = 16 / 4; + this.TYPE_OFFSET = 28 / 4; + this.SIZE_OFFSET = 32 / 4; + this.COLOR_OFFSET = 48 / 4; + } + getType(index2) { + return this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET]; + } + setType(index2, value2) { + this[LightBufferData.SIZE * index2 + this.TYPE_OFFSET] = value2; + } + getCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setCenter(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.CENTER_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setSize(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.SIZE_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + set$3(value2, this[offset2], this[offset2 + 1], this[offset2 + 2]); + } + setColor(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.COLOR_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + } + getRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + set$1(value2, this[offset2], this[offset2 + 1], this[offset2 + 2], this[offset2 + 3]); + } + setRotation(index2, value2) { + const offset2 = LightBufferData.SIZE * index2 + this.ROTATION_OFFSET; + this[offset2] = value2[0]; + this[offset2 + 1] = value2[1]; + this[offset2 + 2] = value2[2]; + this[offset2 + 3] = value2[3]; } - update() { - if (this._hasChanged && this._isInitialized) { - this._hasChanged = false; - const start = window.performance.now(); - this.hittables = []; - const modelPosition = (0, _glMatrix.vec3).create(); - const modelScale = this._core.getModelScale(); - const modelRotation = (0, _glMatrix.quat).create(); - this._core.getModelRotation(modelRotation); - this.minY = Number.MAX_VALUE; - (0, _glMatrix.vec3).set(modelPosition, this._main.mMatrix[12], this._main.mMatrix[13], this._main.mMatrix[14]); - const previousBuffer = this.previousBuffer; - const currentBuffer = this.currentBuffer; - const currentUnitTranslation = (0, _glMatrix.vec3).create(); - const previousUnitTranslation = (0, _glMatrix.vec3).create(); - const currentUnitScale = (0, _glMatrix.vec3).create(); - const previousUnitScale = (0, _glMatrix.vec3).create(); - const currentUnitRotation = (0, _glMatrix.quat).create(); - const previousUnitRotation = (0, _glMatrix.quat).create(); - const unitOrder = (0, _glMatrix.vec2).create(); - const transitionDuration = this._duration / (this._duration + this._stagger); - for(let j = 0; j < currentBuffer.ids.length; j++){ - (0, _vertexJs.UnitVertex).getOrder(currentBuffer.dataView, j, unitOrder); - const startTime = unitOrder[1] * (1 - transitionDuration); - const animation0 = (0, _mathJs.MathHelper).clamp((this._time0 - startTime) / transitionDuration, 0, 1); - const animation1 = (0, _mathJs.MathHelper).clamp((this._time1 - startTime) / transitionDuration, 0, 1); - const unitScale0 = (0, _glMatrix.vec3).create(); - const unitScale1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getScale(currentBuffer.dataView, j, currentUnitScale); - (0, _vertexJs.UnitVertex).getScale(previousBuffer.dataView, j, previousUnitScale); - (0, _glMatrix.vec3).lerp(unitScale0, previousUnitScale, currentUnitScale, animation0); - (0, _glMatrix.vec3).lerp(unitScale1, previousUnitScale, currentUnitScale, animation1); - const unitTranslation0 = (0, _glMatrix.vec3).create(); - const unitTranslation1 = (0, _glMatrix.vec3).create(); - (0, _vertexJs.UnitVertex).getTranslation(currentBuffer.dataView, j, currentUnitTranslation); - (0, _vertexJs.UnitVertex).getTranslation(previousBuffer.dataView, j, previousUnitTranslation); - (0, _glMatrix.vec3).lerp(unitTranslation0, previousUnitTranslation, currentUnitTranslation, animation0); - (0, _glMatrix.vec3).lerp(unitTranslation1, previousUnitTranslation, currentUnitTranslation, animation1); - const unitRotation0 = (0, _glMatrix.quat).create(); - const unitRotation1 = (0, _glMatrix.quat).create(); - (0, _vertexJs.UnitVertex).getRotation(currentBuffer.dataView, j, currentUnitRotation); - (0, _vertexJs.UnitVertex).getRotation(previousBuffer.dataView, j, previousUnitRotation); - (0, _glMatrix.quat).slerp(unitRotation0, previousUnitRotation, currentUnitRotation, animation0); - (0, _glMatrix.quat).slerp(unitRotation1, previousUnitRotation, currentUnitRotation, animation1); - (0, _glMatrix.quat).multiply(unitRotation0, modelRotation, unitRotation0); - (0, _glMatrix.quat).multiply(unitRotation1, modelRotation, unitRotation1); - (0, _glMatrix.vec3).scale(unitTranslation0, unitTranslation0, modelScale); - (0, _glMatrix.vec3).scale(unitTranslation1, unitTranslation1, modelScale); - (0, _glMatrix.vec3).transformQuat(unitTranslation0, unitTranslation0, modelRotation); - (0, _glMatrix.vec3).transformQuat(unitTranslation1, unitTranslation1, modelRotation); - (0, _glMatrix.vec3).add(unitTranslation0, unitTranslation0, modelPosition); - (0, _glMatrix.vec3).add(unitTranslation1, unitTranslation1, modelPosition); - (0, _glMatrix.vec3).scale(unitScale0, unitScale0, modelScale / 2); - (0, _glMatrix.vec3).scale(unitScale1, unitScale1, modelScale / 2); - unitScale0[0] = Math.max(unitScale0[0], 0.00001); - unitScale0[1] = Math.max(unitScale0[1], 0.00001); - unitScale0[2] = Math.max(unitScale0[2], 0.00001); - unitScale1[0] = Math.max(unitScale1[0], 0.00001); - unitScale1[1] = Math.max(unitScale1[1], 0.00001); - unitScale1[2] = Math.max(unitScale1[2], 0.00001); - const endTime = startTime + transitionDuration; - const time0 = Math.min(Math.max((startTime - this._time0) / (this._time1 - this.time0), 0), 1); - const time1 = Math.min(Math.max((endTime - this._time0) / (this._time1 - this.time0), 0), 1); - const materialId = (0, _vertexJs.UnitVertex).getMaterial(currentBuffer.dataView, j); - const material = this._main.materials && this._main.materials.length > materialId ? this._main.materials[materialId] : this._main.config.defaultMaterial; - let hittable; - let unitTexCoord; - switch(currentBuffer.unitType){ - case (0, _indexJs.UnitType).sphere: - case (0, _indexJs.UnitType).sphereSdf: - hittable = new (0, _hittableJs.HittableSphere)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - material: material - }); - break; - case (0, _indexJs.UnitType).disk: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - else hittable = new (0, _hittableJs.HittableRotatedXyDisk)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius0: unitScale0[0], - radius1: unitScale1[0], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]) - }); - break; - case (0, _indexJs.UnitType).block: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBox)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).sdf: - unitTexCoord = (0, _glMatrix.vec4).create(); - (0, _vertexJs.UnitVertex).getTexCoord(currentBuffer.dataView, j, unitTexCoord); - const texId = (0, _vertexJs.UnitVertex).getTexture(currentBuffer.dataView, j); - const sdfBuffer = (0, _vertexJs.UnitVertex).getSdfBuffer(currentBuffer.dataView, j); - const sdfBorder = (0, _vertexJs.UnitVertex).getSdfBorder(currentBuffer.dataView, j); - const options = { - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: (0, _glMatrix.vec2).fromValues(unitScale0[0], unitScale0[1]), - size1: (0, _glMatrix.vec2).fromValues(unitScale1[0], unitScale1[1]), - texCoord0: (0, _glMatrix.vec2).fromValues(unitTexCoord[0], unitTexCoord[3]), - texCoord1: (0, _glMatrix.vec2).fromValues(unitTexCoord[2], unitTexCoord[1]), - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material, - texId: texId, - sdfBuffer: sdfBuffer, - sdfBorder: sdfBorder - }; - hittable = unitRotation1[3] == 1 ? new (0, _hittableJs.HittableSdfXyRect)(options) : new (0, _hittableJs.HittableRotatedSdfXyRect)(options); - break; - case (0, _indexJs.UnitType).blockSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedBoxSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).ringSdf: - if (unitRotation1[3] == 1) hittable = new (0, _hittableJs.HittableRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material - }); - else hittable = new (0, _hittableJs.HittableRotatedRingSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - size0: unitScale0, - size1: unitScale1, - angle0: (0, _vertexJs.UnitVertex).getParameter1(currentBuffer.dataView, j), - innerRadius0: (0, _vertexJs.UnitVertex).getParameter2(currentBuffer.dataView, j), - rounding: Math.min(Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), unitScale0[2]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).cylinder: - hittable = new (0, _hittableJs.HittableCylinder)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rotation0: unitRotation0, - rotation1: unitRotation1, - material: material - }); - break; - case (0, _indexJs.UnitType).cylinderSdf: - hittable = new (0, _hittableJs.HittableCylinderSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material, - rotation0: unitRotation0, - rotation1: unitRotation1 - }); - break; - case (0, _indexJs.UnitType).hexPrism: - hittable = new (0, _hittableJs.HittableHexPrism)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - material: material - }); - break; - case (0, _indexJs.UnitType).hexPrismSdf: - hittable = new (0, _hittableJs.HittableHexPrismSdf)({ - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - radius: unitScale0[0], - height: unitScale0[1], - rounding: Math.min(Math.min((0, _vertexJs.UnitVertex).getRounding(currentBuffer.dataView, j) * modelScale, unitScale0[0]), unitScale0[1]), - material: material - }); - break; - } - if (hittable.material instanceof (0, _materialJs.IsotropicMaterial)) this.hittables.push(new (0, _hittableJs.HittableConstantMedium)({ - boundary: hittable, - center0: unitTranslation0, - center1: unitTranslation1, - time0: time0, - time1: time1, - material: hittable.material - })); - else this.hittables.push(hittable); - this.minY = Math.min(hittable.bounds.min[1], this.minY); - } - if (this.hasChangedCallback) this.hasChangedCallback(); - this._core.log.write((0, _mainJs.LogLevel).info, `buffer updated ${this._length} ${Math.round(window.performance.now() - start)}ms`); - } - } -} - -},{"gl-matrix":"erHGu","../../atlas.js":"huG9l","../../buffer.js":"8oaJi","../../index.js":"lF8Ji","../../main.js":"b6Xbk","../../palette.js":"a14oj","../../vertex.js":"8lW8V","./hittable.js":"a4kPP","./material.js":"ewL2a","../../helpers/math.js":"6Lv1i","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"lFJgO":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Constants", ()=>Constants); -class Constants { -} -Constants.SHADOW_OFFSET = 0.001; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"b3WSb":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Ground", ()=>Ground); -class Ground { - constructor(options){ - if (options) { - this.position = options.position; - this.size = options.size; - this.material = options.material; - } - } -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"kKGRB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Table", ()=>(0, _tableJs.Table)); -parcelHelpers.export(exports, "ColumnType", ()=>(0, _tableJs.ColumnType)); -parcelHelpers.export(exports, "Filter", ()=>(0, _filterJs.Filter)); -var _tableJs = require("./table.js"); -var _filterJs = require("./filter.js"); - -},{"./table.js":"cNpSp","./filter.js":"h4ise","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"faZ4P":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "CameraBase", ()=>(0, _cameraJs.CameraBase)); -parcelHelpers.export(exports, "CameraView", ()=>(0, _cameraJs.CameraView)); -parcelHelpers.export(exports, "AltAzimuthCamera", ()=>(0, _altazimuthJs.AltAzimuthCamera)); -parcelHelpers.export(exports, "AltAzimuthCameraView", ()=>(0, _altazimuthJs.AltAzimuthCameraView)); -parcelHelpers.export(exports, "OrbitCamera", ()=>(0, _orbitJs.OrbitCamera)); -var _cameraJs = require("./camera.js"); -var _altazimuthJs = require("./altazimuth.js"); -var _orbitJs = require("./orbit.js"); - -},{"./camera.js":"1KLf3","./altazimuth.js":"48TUG","./orbit.js":"5oTkB","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"5oTkB":[function(require,module,exports,__globalThis) { -/*! - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "OrbitCamera", ()=>OrbitCamera); -var _glMatrix = require("gl-matrix"); -var _constantsJs = require("../constants.js"); -var _cameraJs = require("./camera.js"); -class OrbitCamera extends (0, _cameraJs.CameraBase) { - getTwist(value) { - (0, _glMatrix.quat).copy(value, this._cameraRotation); - } - setTwist(value, isSmooth) { - (0, _glMatrix.quat).copy(this._cameraRotation, value); - if (!isSmooth) (0, _glMatrix.quat).copy(this._smoothedCameraRotation, value); - } - twist(angle, x, y) { - this.unproject(this._vec3, x, y, 1); - (0, _glMatrix.vec3).normalize(this._vec3, this._vec3); - (0, _glMatrix.vec3).transformQuat(this._vec3, this._vec3, this._orbitRotation); - this._twist(this._vec3, angle); - } - _twist(axis, angle) { - (0, _glMatrix.quat).setAxisAngle(this._quat, axis, angle); - (0, _glMatrix.quat).multiply(this._cameraRotation, this._quat, this._cameraRotation); + } + LightBufferData.SIZE = 64 / 4; + (function(thisArg, _arguments, P, generator) { + function adopt(value2) { + return value2 instanceof P ? value2 : new P(function(resolve2) { + resolve2(value2); + }); } - rotate(translationDelta) { - (0, _glMatrix.vec3).set(this._vec3, translationDelta[1], translationDelta[0], 0); - const length = (0, _glMatrix.vec3).length(this._vec3); - const angle = length * (0, _constantsJs.Constants).PI / Math.min(this.width, this.height); - (0, _glMatrix.vec3).scale(this._vec3, this._vec3, 1 / length); - (0, _glMatrix.quat).setAxisAngle(this._quat, this._vec3, angle); - (0, _glMatrix.quat).multiply(this._orbitRotation, this._quat, this._orbitRotation); - } -} - -},{"gl-matrix":"erHGu","../constants.js":"dHTsY","./camera.js":"1KLf3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4xUmx":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * This file is for external facing export only, do not use this for internal references, - * as it may cause circular dependencies in Rollup. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -//alphabetize for documentation -parcelHelpers.export(exports, "addDiv", ()=>(0, _htmlHelpers.addDiv)); -parcelHelpers.export(exports, "addEl", ()=>(0, _htmlHelpers.addEl)); -parcelHelpers.export(exports, "allTruthy", ()=>(0, _array.allTruthy)); -parcelHelpers.export(exports, "clone", ()=>(0, _clone.clone)); -parcelHelpers.export(exports, "colorFromString", ()=>(0, _color.colorFromString)); -parcelHelpers.export(exports, "colorIsEqual", ()=>(0, _color.colorIsEqual)); -parcelHelpers.export(exports, "colorToString", ()=>(0, _color.colorToString)); -parcelHelpers.export(exports, "concat", ()=>(0, _array.concat)); -parcelHelpers.export(exports, "createElement", ()=>(0, _tsxCreateElement.createElement)); -parcelHelpers.export(exports, "deepMerge", ()=>(0, _clone.deepMerge)); -parcelHelpers.export(exports, "desaturate", ()=>(0, _color.desaturate)); -parcelHelpers.export(exports, "getActiveElementInfo", ()=>(0, _tsxCreateElement.getActiveElementInfo)); -parcelHelpers.export(exports, "mount", ()=>(0, _tsxCreateElement.mount)); -parcelHelpers.export(exports, "outerSize", ()=>(0, _htmlHelpers.outerSize)); -parcelHelpers.export(exports, "push", ()=>(0, _array.push)); -parcelHelpers.export(exports, "setActiveElement", ()=>(0, _tsxCreateElement.setActiveElement)); -var _array = require("../array"); -var _htmlHelpers = require("../htmlHelpers"); -var _clone = require("../clone"); -var _color = require("../color"); -var _tsxCreateElement = require("tsx-create-element"); - -},{"../array":"0536B","../htmlHelpers":"2Ooqn","../clone":"9OkEI","../color":"gRfIg","tsx-create-element":"9w9U8","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"0536B":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "concat", ()=>concat); -/** - * Returns array with items which are truthy. - * @param args array or arrays to concat into a single array. - */ parcelHelpers.export(exports, "allTruthy", ()=>allTruthy); -/** - * Add an array to an existing array in place. - * @param arr Array to append to. - * @param items Arrof of items to append. - */ parcelHelpers.export(exports, "push", ()=>push); -function concat(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []); -} -function allTruthy(...args) { - return args.reduce((p, c)=>c ? p.concat(c) : p, []).filter(Boolean); -} -function push(arr, items) { - arr.push.apply(arr, items); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2Ooqn":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * Create a new element as a child of another element. - * @param tagName Tag name of the new tag to create. - * @param parentElement Reference of the element to append to. - * @returns new HTMLElement. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "addEl", ()=>addEl); -/** - * Create a new div HTMLElement as a child of another element. - * @param parentElement Reference of the element to append to. - * @param className Optional css class name to apply to the div. - */ parcelHelpers.export(exports, "addDiv", ()=>addDiv); -/** - * Measure the outer height and width of an HTMLElement, including margin, padding and border. - * @param el HTML Element to measure. - */ parcelHelpers.export(exports, "outerSize", ()=>outerSize); -function addEl(tagName, parentElement) { - const el = document.createElement(tagName); - parentElement.appendChild(el); - return el; -} -function addDiv(parentElement, className) { - const div = addEl('div', parentElement); - if (className) div.className = className; - return div; -} -function outerSize(el) { - const cs = getComputedStyle(el); - const height = parseFloat(cs.marginTop) + parseFloat(cs.paddingTop) + parseFloat(cs.borderTopWidth) + el.offsetHeight + parseFloat(cs.borderBottomWidth) + parseFloat(cs.paddingBottom) + parseFloat(cs.marginBottom); - const width = parseFloat(cs.marginLeft) + parseFloat(cs.paddingLeft) + parseFloat(cs.borderLeftWidth) + el.offsetWidth + parseFloat(cs.borderRightWidth) + parseFloat(cs.paddingRight) + parseFloat(cs.marginRight); - return { - height, - width - }; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"9OkEI":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "clone", ()=>clone); -parcelHelpers.export(exports, "deepMerge", ()=>deepMerge); -var _deepmerge = require("deepmerge"); -var _isPlainObject = require("is-plain-object"); -const deepmerge = _deepmerge.default || _deepmerge; -function clone(objectToClone) { - if (!objectToClone) return objectToClone; - return deepmerge.all([ - objectToClone - ]); -} -const dontMerge = (destination, source)=>source; -function deepMerge(...objectsToMerge) { - const objects = objectsToMerge.filter(Boolean); - return deepmerge.all(objects, { - arrayMerge: dontMerge, - isMergeableObject: (0, _isPlainObject.isPlainObject) + return new (P || (P = Promise))(function(resolve2, reject) { + function fulfilled(value2) { + try { + step(generator.next(value2)); + } catch (e) { + reject(e); + } + } + function rejected(value2) { + try { + step(generator["throw"](value2)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); -} - -},{"deepmerge":"f8559","is-plain-object":"j1mOX","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"f8559":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var isMergeableObject = function isMergeableObject(value) { - return isNonNullObject(value) && !isSpecial(value); -}; -function isNonNullObject(value) { - return !!value && typeof value === 'object'; -} -function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value); -} -// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 -var canUseSymbol = typeof Symbol === 'function' && Symbol.for; -var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; -function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE; -} -function emptyTarget(val) { + }); + var isMergeableObject = function isMergeableObject2(value2) { + return isNonNullObject(value2) && !isSpecial(value2); + }; + function isNonNullObject(value2) { + return !!value2 && typeof value2 === "object"; + } + function isSpecial(value2) { + var stringValue = Object.prototype.toString.call(value2); + return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value2); + } + var canUseSymbol = typeof Symbol === "function" && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103; + function isReactElement(value2) { + return value2.$$typeof === REACT_ELEMENT_TYPE; + } + function emptyTarget(val) { return Array.isArray(val) ? [] : {}; -} -function cloneUnlessOtherwiseSpecified(value, options) { - return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; -} -function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options); + } + function cloneUnlessOtherwiseSpecified(value2, options) { + return options.clone !== false && options.isMergeableObject(value2) ? deepmerge$1(emptyTarget(value2), value2, options) : value2; + } + function defaultArrayMerge(target2, source2, options) { + return target2.concat(source2).map(function(element2) { + return cloneUnlessOtherwiseSpecified(element2, options); }); -} -function mergeObject(target, source, options) { + } + function mergeObject(target2, source2, options) { var destination = {}; - if (options.isMergeableObject(target)) Object.keys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - Object.keys(source).forEach(function(key) { - if (!options.isMergeableObject(source[key]) || !target[key]) destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); - else destination[key] = deepmerge(target[key], source[key], options); + if (options.isMergeableObject(target2)) { + Object.keys(target2).forEach(function(key2) { + destination[key2] = cloneUnlessOtherwiseSpecified(target2[key2], options); + }); + } + Object.keys(source2).forEach(function(key2) { + if (!options.isMergeableObject(source2[key2]) || !target2[key2]) { + destination[key2] = cloneUnlessOtherwiseSpecified(source2[key2], options); + } else { + destination[key2] = deepmerge$1(target2[key2], source2[key2], options); + } }); return destination; -} -function deepmerge(target, source, options) { + } + function deepmerge$1(target2, source2, options) { options = options || {}; options.arrayMerge = options.arrayMerge || defaultArrayMerge; options.isMergeableObject = options.isMergeableObject || isMergeableObject; - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); + var sourceIsArray = Array.isArray(source2); + var targetIsArray = Array.isArray(target2); var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - if (!sourceAndTargetTypesMatch) return cloneUnlessOtherwiseSpecified(source, options); - else if (sourceIsArray) return options.arrayMerge(target, source, options); - else return mergeObject(target, source, options); -} -deepmerge.all = function deepmergeAll(array, options) { - if (!Array.isArray(array)) throw new Error('first argument should be an array'); - return array.reduce(function(prev, next) { - return deepmerge(prev, next, options); + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source2, options); + } else if (sourceIsArray) { + return options.arrayMerge(target2, source2, options); + } else { + return mergeObject(target2, source2, options); + } + } + deepmerge$1.all = function deepmergeAll(array2, options) { + if (!Array.isArray(array2)) { + throw new Error("first argument should be an array"); + } + return array2.reduce(function(prev, next) { + return deepmerge$1(prev, next, options); }, {}); -}; -var deepmerge_1 = deepmerge; -exports.default = deepmerge_1; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"j1mOX":[function(require,module,exports,__globalThis) { -/*! - * is-plain-object <https://github.com/jonschlinkert/is-plain-object> - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "isPlainObject", ()=>isPlainObject); -function isObject(o) { - return Object.prototype.toString.call(o) === '[object Object]'; -} -function isPlainObject(o) { + }; + var deepmerge_1 = deepmerge$1; + const _deepmerge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: deepmerge_1 + }, Symbol.toStringTag, { value: "Module" })); + function isObject(o) { + return Object.prototype.toString.call(o) === "[object Object]"; + } + function isPlainObject(o) { var ctor, prot; if (isObject(o) === false) return false; - // If has modified constructor ctor = o.constructor; - if (ctor === undefined) return true; - // If has modified prototype + if (ctor === void 0) return true; prot = ctor.prototype; if (isObject(prot) === false) return false; - // If constructor does not have an Object-specific method - if (prot.hasOwnProperty('isPrototypeOf') === false) return false; - // Most likely a plain Object + if (prot.hasOwnProperty("isPrototypeOf") === false) { + return false; + } return true; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gRfIg":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Compares 2 colors to see if they are equal. - * @param a RGBAColor to compare - * @param b RGBAColor to compare - * @returns True if colors are equal. - */ parcelHelpers.export(exports, "colorIsEqual", ()=>colorIsEqual); -/** - * Convert a CSS color string to a Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.). - * @param cssColorSpecifier A CSS Color Module Level 3 specifier string. - */ parcelHelpers.export(exports, "colorFromString", ()=>colorFromString); -/** - * Convert a Deck.gl color to a CSS rgba() string. - * @param color A Deck.gl RGBAColor array - (The rgba color of each object, in r, g, b, [a]. Each component is in the 0-255 range.) - */ parcelHelpers.export(exports, "colorToString", ()=>colorToString); -parcelHelpers.export(exports, "desaturate", ()=>desaturate); -var _d3Color = require("d3-color"); -function rgbToDeckglColor(c) { - return [ - c.r, - c.g, - c.b, - c.opacity * 255 - ]; -} -function colorIsEqual(a, b) { - if (a.length !== b.length) return false; - for(let i = 0; i < a.length; i++){ - if (a[i] !== b[i]) return false; + } + const deepmerge = deepmerge_1 || _deepmerge; + const dontMerge = (destination, source2) => source2; + function deepMerge(...objectsToMerge) { + const objects = objectsToMerge.filter(Boolean); + return deepmerge.all(objects, { arrayMerge: dontMerge, isMergeableObject: isPlainObject }); + } + function rgbToDeckglColor(c2) { + return [c2.r, c2.g, c2.b, c2.opacity * 255]; + } + function colorIsEqual(a2, b2) { + if (a2.length !== b2.length) + return false; + for (let i = 0; i < a2.length; i++) { + if (a2[i] !== b2[i]) + return false; } return true; -} -function colorFromString(cssColorSpecifier) { + } + function colorFromString(cssColorSpecifier) { if (cssColorSpecifier) { - const dc = (0, _d3Color.color)(cssColorSpecifier); - if (dc) { - const c = dc.rgb(); - return rgbToDeckglColor(c); - } + const dc = color$2(cssColorSpecifier); + if (dc) { + const c2 = dc.rgb(); + return rgbToDeckglColor(c2); + } } -} -function colorToString(color) { - const c = [ - ...color - ]; - if (c.length > 3) c[3] /= 255; - return `rgba(${c.join(',')})`; -} -function desaturate(color, value) { - const rgb = (0, _d3Color.rgb)(color[0], color[1], color[2], color[3] / 255); - const hslColor = (0, _d3Color.hsl)(rgb); - hslColor.s = value; - const c = hslColor.rgb(); - return rgbToDeckglColor(c); -} - -},{"d3-color":"7SCp9","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"c3DaF":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "minHeight", ()=>minHeight); -parcelHelpers.export(exports, "minWidth", ()=>minWidth); -parcelHelpers.export(exports, "defaultPresenterStyle", ()=>defaultPresenterStyle); -parcelHelpers.export(exports, "defaultPresenterConfig", ()=>defaultPresenterConfig); -parcelHelpers.export(exports, "createStage", ()=>createStage); -parcelHelpers.export(exports, "groupStrokeWidth", ()=>groupStrokeWidth); -parcelHelpers.export(exports, "lineZ", ()=>lineZ); -parcelHelpers.export(exports, "defaultView", ()=>defaultView); -parcelHelpers.export(exports, "minZ", ()=>minZ); -parcelHelpers.export(exports, "min3dDepth", ()=>min3dDepth); -parcelHelpers.export(exports, "minPixelSize", ()=>minPixelSize); -parcelHelpers.export(exports, "defaultOnAxisItem", ()=>defaultOnAxisItem); -var _color = require("./color"); -const minHeight = '100px'; -const minWidth = '100px'; -const defaultPresenterStyle = { - cssPrefix: 'vega-morphcharts-', - defaultCubeColor: [ - 128, - 128, - 128, - 255 - ], - highlightColor: [ - 0, - 0, - 0, - 255 - ] -}; -const defaultPresenterConfig = { - onCubeClick: (e, cube)=>{}, - onCubeHover: (e, cube)=>{}, + } + const minHeight = "100px"; + const minWidth = "100px"; + const defaultPresenterStyle = { + cssPrefix: "vega-morphcharts-", + defaultCubeColor: [128, 128, 128, 255], + highlightColor: [0, 0, 0, 255] + }; + const defaultPresenterConfig = { + onCubeClick: (e, cube) => { + }, + onCubeHover: (e, cube) => { + }, transitionDurations: { - position: 600, - stagger: 600, - view: 600 + position: 600, + stagger: 600, + view: 600 }, renderer: { - advanced: false, - advancedOptions: {}, - basicOptions: { - antialias: true - } + advanced: false, + advancedOptions: {}, + basicOptions: { + antialias: true + } } -}; -function createStage(view) { + }; + function createStage(view) { const stage = { - view, - cubeData: [], - pathData: [], - axes: { - x: [], - y: [], - z: [] - }, - gridLines: [], - textData: [], - legend: { - rows: {} - }, - facets: [] + view, + cubeData: [], + pathData: [], + axes: { + x: [], + y: [], + z: [] + }, + gridLines: [], + textData: [], + legend: { + rows: {} + }, + facets: [] }; return stage; -} -const groupStrokeWidth = 1; -const lineZ = 0; -const defaultView = '2d'; -const minZ = 0.5; -const min3dDepth = 0.05; -const minPixelSize = 0.5; -const zAxisEncodeColor = [ - 7, - 7, - 7, - 255 -]; -const zAxisOutColor = [ - 0, - 0, - 0, - 255 -]; -function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { - if ((0, _color.colorIsEqual)(stageItem.color, zAxisEncodeColor)) { - stageItem.color = zAxisOutColor; - if (currAxis.axisRole !== 'z') { - const previousAxisRole = removeCurrentAxes(stage, currAxis); - if (previousAxisRole) { - currAxis.axisRole = 'z'; - stage.axes.z.push(currAxis); - } - } - } -} -function removeCurrentAxes(stage, currAxis) { - //find the current axis, remove it from parent - for(const axisRole in stage.axes){ - const axes = stage.axes[axisRole]; - for(let i = 0; i < axes.length; i++)if (axes[i] === currAxis) { - axes.splice(i, 1); - return axisRole; - } - } -} - -},{"./color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bxBcY":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "base", ()=>base); -/** - * Specify the dependency libraries to use for rendering. - * @param vega Vega library. - */ parcelHelpers.export(exports, "use", ()=>use); -const vega = { - CanvasHandler: null, - inferType: null, - inferTypes: null, - loader: null, - parse: null, - read: null, - renderModule: null, - Renderer: null, - sceneVisit: null, - scheme: null, - truncate: null, - View: null -}; -const base = { - vega -}; -function use(vega) { - base.vega = vega; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3NoKz":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -/** - * Class which presents a Stage of chart data using MorphCharts to render. - */ parcelHelpers.export(exports, "Presenter", ()=>Presenter); -var _clone = require("./clone"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -var _legend = require("./legend"); -var _panel = require("./panel"); -var _patchedCubeArray = require("./patchedCubeArray"); -var _stagers = require("./stagers"); -var _tsxCreateElement = require("tsx-create-element"); -var _morphcharts = require("./morphcharts"); -class Presenter { - /** - * Get the previously rendered Stage object. - */ get stage() { - return this._last.stage; - } - /** - * Get the current View camera type. - */ get view() { - return this._last.view; - } - /** - * Instantiate a new Presenter. - * @param el Parent HTMLElement to present within. - * @param style Optional PresenterStyle styling options. - */ constructor(el, style){ - this.el = el; - this.style = (0, _clone.deepMerge)((0, _defaults.defaultPresenterStyle), style); - (0, _panel.initializePanel)(this); - this._last = { - view: null, - height: null, - width: null, - cubeCount: null, - stage: null - }; - } - /** - * Cancels any pending animation, calling animationCanceled() on original queue. - */ animationCancel() { - if (this.animationTimer) { - clearTimeout(this.animationTimer); - this.animationTimer = null; - if (this.logger) this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || 'handler'}`); - if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) this.queuedAnimationOptions.animationCanceled.call(null); - } - } - /** - * Stops the current animation and queues a new animation. - * @param handler Function to invoke when timeout is complete. - * @param timeout Length of time to wait before invoking the handler. - * @param options Optional QueuedAnimationOptions object. - */ animationQueue(handler, timeout, options) { - if (this.logger) this.logger(`queueing animation ${options && options.waitingLabel || 'waiting'}...(${timeout})`); - this.animationCancel(); - this.animationTimer = setTimeout(()=>{ - if (this.logger) this.logger(`queueing animation ${options && options.handlerLabel || 'handler'}...`); - handler(); - }, timeout); - } - /** - * Retrieve a sub-element of the rendered output. - * @param type PresenterElement type of the HTMLElement to retrieve. - */ getElement(type) { - const elements = this.el.getElementsByClassName((0, _panel.className)(type, this)); - if (elements && elements.length) return elements[0]; - } - /** - * Present the Vega Scene, or Stage object using Morphcharts. - * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. - * @param height Height of the rendering area. - * @param width Width of the rendering area. - * @param config Optional presentation configuration object. - */ present(sceneOrStage, height, width, config) { - this.animationCancel(); - const scene = sceneOrStage; - let stage; - const options = { - maxOrdinal: 0, - currAxis: null, - defaultCubeColor: this.style.defaultCubeColor, - assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (()=>options.maxOrdinal++), - modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : (0, _defaults.defaultOnAxisItem), - zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex - }; - //determine if this is a vega scene - if (scene.marktype) { - stage = (0, _defaults.createStage)(scene.view); - (0, _stagers.sceneToStage)(options, stage, scene); - } else stage = sceneOrStage; - const c = (0, _clone.deepMerge)((0, _defaults.defaultPresenterConfig), config); - if (!this.morphchartsref) { - this._morphChartsOptions = { - container: this.getElement((0, _enums.PresenterElement).gl), - pickGridCallback: c.axisPickGridCallback, - onCubeHover: (e, ordinal)=>{ - c.onCubeHover(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCubeClick: (e, ordinal)=>{ - c.onCubeClick(e, { - ordinal, - color: null, - position: null, - size: null - }); - }, - onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, - onLasso: config === null || config === void 0 ? void 0 : config.onLasso - }; - this.morphchartsref = (0, _morphcharts.init)(this._morphChartsOptions, c.renderer || (0, _defaults.defaultPresenterConfig).renderer); + } + const groupStrokeWidth = 1; + const lineZ = 0; + const defaultView = "2d"; + const minZ = 0.5; + const min3dDepth = 0.05; + const zAxisEncodeColor = [7, 7, 7, 255]; + const zAxisOutColor = [0, 0, 0, 255]; + function defaultOnAxisItem(vegaItem, stageItem, stage, currAxis) { + if (colorIsEqual(stageItem.color, zAxisEncodeColor)) { + stageItem.color = zAxisOutColor; + if (currAxis.axisRole !== "z") { + const previousAxisRole = removeCurrentAxes(stage, currAxis); + if (previousAxisRole) { + currAxis.axisRole = "z"; + stage.axes.z.push(currAxis); } - let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); - if (options.maxOrdinal) { - cubeCount = Math.max(cubeCount, options.maxOrdinal); - const empty = { - isEmpty: true - }; - stage.cubeData = (0, _patchedCubeArray.patchCubeArray)(cubeCount, empty, stage.cubeData); - } - config.preLayer && config.preLayer(stage); - this.morphChartsRenderResult = (0, _morphcharts.morphChartsRender)(this.morphchartsref, this._last.stage, stage, height, width, config && config.preStage, config && config.morphChartsColors, c); - delete stage.cubeData; - delete stage.redraw; - this._last = { - cubeCount, - height, - width, - stage, - view: stage.view - }; - const a = (0, _tsxCreateElement.getActiveElementInfo)(); - (0, _tsxCreateElement.mount)((0, _legend.LegendView)({ - legend: stage.legend, - onClick: config && config.onLegendClick - }), this.getElement((0, _enums.PresenterElement).legend)); - (0, _tsxCreateElement.setActiveElement)(a); - if (config && config.onPresent) config.onPresent(); - } - canvasToDataURL() { - return new Promise((resolve, reject)=>{ - this.morphchartsref.core.afterRenderCallback = ()=>{ - this.morphchartsref.core.afterRenderCallback = null; - const canvas = this.getElement((0, _enums.PresenterElement).gl).getElementsByTagName('canvas')[0]; - const png = canvas.toDataURL('image/png'); - resolve(png); - }; - }); - } - configColors(mcColors) { - (0, _morphcharts.colorConfig)(this.morphchartsref, mcColors); - } - /** - * Home the camera to the last initial position. - */ homeCamera() { - var _a; - (_a = this.morphchartsref) === null || _a === void 0 || _a.reset(); - } - /** - * Show guidelines of rendering height/width and center of OrbitView. - */ showGuides() { - this.getElement((0, _enums.PresenterElement).gl).classList.add('show-center'); - //TODO Morphcharts gridlines + } } - finalize() { - this.animationCancel(); - if (this.morphchartsref) this.morphchartsref.core.stop(); - if (this.el) this.el.innerHTML = ''; - this._last = null; - this.morphchartsref = null; - this.el = null; - this.logger = null; - this.queuedAnimationOptions = null; - } -} - -},{"./clone":"9OkEI","./defaults":"c3DaF","./enums":"dvKuu","./legend":"8NtN9","./panel":"3DB3l","./patchedCubeArray":"aGmmw","./stagers":"iwkC9","tsx-create-element":"9w9U8","./morphcharts":"1zeZZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"dvKuu":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ /** - * HTML elements outputted by the presenter. - */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "PresenterElement", ()=>PresenterElement); -var PresenterElement; -(function(PresenterElement) { - PresenterElement[PresenterElement["root"] = 0] = "root"; - PresenterElement[PresenterElement["gl"] = 1] = "gl"; - PresenterElement[PresenterElement["panel"] = 2] = "panel"; - PresenterElement[PresenterElement["legend"] = 3] = "legend"; - PresenterElement[PresenterElement["vegaControls"] = 4] = "vegaControls"; -})(PresenterElement || (PresenterElement = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"8NtN9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "LegendView", ()=>LegendView); -var _tsxCreateElement = require("tsx-create-element"); -var _controls = require("./controls"); -const LegendView = (props)=>{ + } + function removeCurrentAxes(stage, currAxis) { + for (const axisRole in stage.axes) { + const axes = stage.axes[axisRole]; + for (let i = 0; i < axes.length; i++) { + if (axes[i] === currAxis) { + axes.splice(i, 1); + return axisRole; + } + } + } + } + const vega = { + CanvasHandler: null, + inferType: null, + inferTypes: null, + loader: null, + parse: null, + read: null, + renderModule: null, + Renderer: null, + sceneVisit: null, + scheme: null, + truncate: null, + View: null + }; + const base = { + vega + }; + function use(vega2) { + base.vega = vega2; + } + var PresenterElement; + (function(PresenterElement2) { + PresenterElement2[PresenterElement2["root"] = 0] = "root"; + PresenterElement2[PresenterElement2["gl"] = 1] = "gl"; + PresenterElement2[PresenterElement2["panel"] = 2] = "panel"; + PresenterElement2[PresenterElement2["legend"] = 3] = "legend"; + PresenterElement2[PresenterElement2["vegaControls"] = 4] = "vegaControls"; + })(PresenterElement || (PresenterElement = {})); + const LegendView = (props) => { const rows = []; - const addRow = (row, i)=>{ - const fn = symbolMap[row.symbol.shape]; - let jsx; - if (fn) jsx = fn(row.symbol); - else jsx = (0, _tsxCreateElement.createElement)("span", null, "x"); - rows.push({ - cells: [ - { - className: 'symbol', - content: jsx - }, - { - className: 'label', - content: row.label, - title: row.label - } - ] - }); + const addRow = (row, i) => { + const fn = symbolMap[row.symbol.shape]; + let jsx; + if (fn) { + jsx = fn(row.symbol); + } else { + jsx = createElement("span", null, "x"); + } + rows.push({ + cells: [ + { className: "symbol", content: jsx }, + { className: "label", content: row.label, title: row.label } + ] + }); }; - const sorted = Object.keys(props.legend.rows).sort((a, b)=>+a - +b); - sorted.forEach((i)=>addRow(props.legend.rows[i], +i)); - if (sorted.length) return (0, _tsxCreateElement.createElement)((0, _controls.Table), { - rows: rows, - rowClassName: "legend-row", - onRowClick: (e, i)=>props.onClick(e, props.legend, i) - }, props.legend.title !== void 0 && (0, _tsxCreateElement.createElement)("tr", { - onClick: (e)=>props.onClick(e, props.legend, null) - }, (0, _tsxCreateElement.createElement)("th", { - colSpan: 2 - }, props.legend.title))); -}; -const symbolMap = { - square: function(symbol) { - return (0, _tsxCreateElement.createElement)("div", { - style: { - height: `${symbol.bounds.y2 - symbol.bounds.y1}px`, - width: `${symbol.bounds.x2 - symbol.bounds.x1}px`, - backgroundColor: symbol.fill, - borderColor: symbol.fill - } - }); + const sorted = Object.keys(props.legend.rows).sort((a2, b2) => +a2 - +b2); + sorted.forEach((i) => addRow(props.legend.rows[i])); + if (sorted.length) { + return createElement(Table, { rows, rowClassName: "legend-row", onRowClick: (e, i) => props.onClick(e, props.legend, i) }, props.legend.title !== void 0 && createElement( + "tr", + { onClick: (e) => props.onClick(e, props.legend, null) }, + createElement("th", { colSpan: 2 }, props.legend.title) + )); } -}; - -},{"tsx-create-element":"9w9U8","./controls":"mTToq","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3DB3l":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "initializePanel", ()=>initializePanel); -parcelHelpers.export(exports, "className", ()=>className); -var _tsxCreateElement = require("tsx-create-element"); -var _defaults = require("./defaults"); -var _enums = require("./enums"); -function initializePanel(presenter) { - const rootDiv = (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).root, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).gl, presenter), - style: { - minHeight: (0, _defaults.minHeight), - minWidth: (0, _defaults.minWidth) - } - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).panel, presenter) - }, (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).vegaControls, presenter) - }), (0, _tsxCreateElement.createElement)("div", { - className: className((0, _enums.PresenterElement).legend, presenter) - }))); - (0, _tsxCreateElement.mount)(rootDiv, presenter.el); -} -function className(type, presenter) { - return `${presenter.style.cssPrefix}${(0, _enums.PresenterElement)[type]}`; -} - -},{"tsx-create-element":"9w9U8","./defaults":"c3DaF","./enums":"dvKuu","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aGmmw":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "patchCubeArray", ()=>patchCubeArray); -function patchCubeArray(allocatedSize, empty, cubes) { + }; + const symbolMap = { + square: function(symbol2) { + return createElement("div", { style: { + height: `${symbol2.bounds.y2 - symbol2.bounds.y1}px`, + width: `${symbol2.bounds.x2 - symbol2.bounds.x1}px`, + backgroundColor: symbol2.fill, + borderColor: symbol2.fill + } }); + } + }; + function initializePanel(presenter) { + const rootDiv = createElement( + "div", + { className: className(PresenterElement.root, presenter) }, + createElement("div", { className: className(PresenterElement.gl, presenter), style: { minHeight, minWidth } }), + createElement( + "div", + { className: className(PresenterElement.panel, presenter) }, + createElement("div", { className: className(PresenterElement.vegaControls, presenter) }), + createElement("div", { className: className(PresenterElement.legend, presenter) }) + ) + ); + mount(rootDiv, presenter.el); + } + function className(type2, presenter) { + return `${presenter.style.cssPrefix}${PresenterElement[type2]}`; + } + function patchCubeArray(allocatedSize, empty, cubes) { const patched = new Array(allocatedSize); patched.fill(empty); - cubes.forEach((cube)=>patched[cube.ordinal] = cube); + cubes.forEach((cube) => patched[cube.ordinal] = cube); return patched; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"iwkC9":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "sceneToStage", ()=>sceneToStage); -var _legend = require("./marks/legend"); -var _legendDefault = parcelHelpers.interopDefault(_legend); -var _image = require("./marks/image"); -var _imageDefault = parcelHelpers.interopDefault(_image); -var _rect = require("./marks/rect"); -var _rectDefault = parcelHelpers.interopDefault(_rect); -var _rule = require("./marks/rule"); -var _ruleDefault = parcelHelpers.interopDefault(_rule); -var _line = require("./marks/line"); -var _lineDefault = parcelHelpers.interopDefault(_line); -var _text = require("./marks/text"); -var _textDefault = parcelHelpers.interopDefault(_text); -var _base = require("./base"); -var _color = require("./color"); -var _defaults = require("./defaults"); -var _interfaces = require("./marks/interfaces"); -function getAxisGroupType(item, options) { - const axisItem = item; - const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; - if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== undefined) return (0, _interfaces.GroupType).zAxis; - switch(axisItem.orient){ - case 'bottom': - case 'top': - return (0, _interfaces.GroupType).xAxis; - case 'left': - case 'right': - return (0, _interfaces.GroupType).yAxis; - } -} -function convertGroupRole(item, options) { - if (item.mark.role === 'legend') return (0, _interfaces.GroupType).legend; - if (item.mark.role === 'axis') { - const groupType = getAxisGroupType(item, options); - if (groupType !== undefined) return groupType; - } -} -const group = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(g) { - const gx = g.x || 0, gy = g.y || 0; - if (g.context && g.context.background && !stage.backgroundColor) stage.backgroundColor = (0, _color.colorFromString)(g.context.background); - if (g.stroke) { - const facetRect = { - datum: g.datum, - lines: (0, _rule.box)(gx + x, gy + y, g.height, g.width, g.stroke, (0, _defaults.groupStrokeWidth)) - }; - stage.facets.push(facetRect); - } - groupType = convertGroupRole(g, options) || groupType; - setCurrentAxis(options, stage, groupType); - // draw group contents - (0, _base.base).vega.sceneVisit(g, function(item) { - mainStager(options, stage, item, gx + x, gy + y, groupType); - }); - }); -}; -function setCurrentAxis(options, stage, groupType) { - let axisRole; - switch(groupType){ - case (0, _interfaces.GroupType).xAxis: - axisRole = 'x'; - break; - case (0, _interfaces.GroupType).yAxis: - axisRole = 'y'; - break; - case (0, _interfaces.GroupType).zAxis: - axisRole = 'z'; - break; - default: - return; - } - options.currAxis = { - axisRole, - domain: null, - tickText: [], - ticks: [] - }; - stage.axes[axisRole].push(options.currAxis); -} -const markStagers = { - group, - legend: (0, _legendDefault.default), - image: (0, _imageDefault.default), - rect: (0, _rectDefault.default), - rule: (0, _ruleDefault.default), - line: (0, _lineDefault.default), - text: (0, _textDefault.default) -}; -const mainStager = (options, stage, scene, x, y, groupType)=>{ - if (scene.marktype !== 'group' && groupType === (0, _interfaces.GroupType).legend) (0, _legendDefault.default)(options, stage, scene, x, y, groupType); - else { - const markStager = markStagers[scene.marktype]; - if (markStager) markStager(options, stage, scene, x, y, groupType); + } + const legendMap = { + "legend-title": function(legend, textItem) { + legend.title = textItem.text; + }, + "legend-symbol": function(legend, symbol2) { + const { bounds: bounds2, fill: fill2, shape: shape2 } = symbol2; + const legendRowSymbol = { bounds: bounds2, fill: fill2, shape: shape2 }; + const i = symbol2.datum.index; + legend.rows[i] = legend.rows[i] || {}; + legend.rows[i].symbol = legendRowSymbol; + }, + "legend-label": function(legend, label2) { + const i = label2.datum.index; + legend.rows[i] = legend.rows[i] || {}; + const row = legend.rows[i]; + row.label = label2.text; + row.value = label2.datum.value; } -}; -function sceneToStage(options, stage, scene) { - mainStager(options, stage, scene, 0, 0, null); - sortAxis(stage.axes.x, 0); - sortAxis(stage.axes.y, 1); - sortAxis(stage.axes.z, 1); -} -function sortAxis(axes, dim) { - axes.forEach((axis)=>{ - if (axis.domain) orderDomain(axis.domain, dim); - axis.ticks.sort((a, b)=>a.sourcePosition[dim] - b.sourcePosition[dim]); - axis.tickText.sort((a, b)=>a.position[dim] - b.position[dim]); - }); -} -function orderDomain(domain, dim) { - if (domain.sourcePosition[dim] > domain.targetPosition[dim]) { - const temp = domain.targetPosition; - domain.targetPosition = domain.sourcePosition; - domain.sourcePosition = temp; - } -} - -},{"./marks/legend":"4ew4D","./marks/image":"7l9CM","./marks/rect":"3v8BK","./marks/rule":"gXjfm","./marks/line":"eSo5o","./marks/text":"2EWWv","./base":"bxBcY","./color":"gRfIg","./defaults":"c3DaF","./marks/interfaces":"S4mDt","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4ew4D":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const legendMap = { - 'legend-title': function(legend, textItem) { - legend.title = textItem.text; - }, - 'legend-symbol': function(legend, symbol) { - const { bounds, fill, shape } = symbol; - //this object is safe for serialization - const legendRowSymbol = { - bounds, - fill, - shape - }; - const i = symbol.datum.index; - legend.rows[i] = legend.rows[i] || {}; - legend.rows[i].symbol = legendRowSymbol; - }, - 'legend-label': function(legend, label) { - const i = label.datum.index; - legend.rows[i] = legend.rows[i] || {}; - const row = legend.rows[i]; - row.label = label.text; - row.value = label.datum.value; - } -}; -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const fn = legendMap[item.mark.role]; - if (fn) fn(stage.legend, item); + }; + const markStager$5 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const fn = legendMap[item.mark.role]; + if (fn) { + fn(stage.legend, item); + } }); -}; -exports.default = markStager; - -},{"../base":"bxBcY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7l9CM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const { bounds, height, url, width } = item; - let { x1, x2, y1, y2 } = bounds; - x1 += x; - x2 += x; - y1 += y; - y2 += y; - if (!stage.backgroundImages) stage.backgroundImages = []; - stage.backgroundImages.push({ - bounds: { - x1, - x2, - y1, - y2 - }, - height, - url, - width - }); + }; + const markStager$4 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const { bounds: bounds2, height: height2, url, width: width2 } = item; + let { x1: x12, x2: x22, y1: y12, y2: y22 } = bounds2; + x12 += x2; + x22 += x2; + y12 += y2; + y22 += y2; + if (!stage.backgroundImages) { + stage.backgroundImages = []; + } + stage.backgroundImages.push({ bounds: { x1: x12, x2: x22, y1: y12, y2: y22 }, height: height2, url, width: width2 }); }); -}; -exports.default = markStager; - -},{"../base":"bxBcY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3v8BK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const noZ = item.z === undefined; - const z = noZ ? 0 : (item.z || 0) + (0, _defaults.minZ); - const depth = (noZ ? 0 : item.depth || 0) + (0, _defaults.min3dDepth); - //change direction of y from SVG to GL - const ty = -1; - const ordinal = options.assignCubeOrdinal(item.datum); - if (ordinal > options.maxOrdinal) options.maxOrdinal = ordinal; - if (ordinal === undefined) ; - else { - const cube = { - ordinal, - size: [ - item.width, - item.height, - depth - ], - position: [ - x + (+item.x || 0), - ty * (y + (+item.y || 0)) - +item.height, - z - ], - color: (0, _color.colorFromString)(item.fill) || options.defaultCubeColor || [ - 128, - 128, - 128, - 128 - ] - }; - cube.color[3] = item.opacity === undefined ? 255 : 255 * item.opacity; - stage.cubeData.push(cube); - } + }; + const markStager$3 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const noZ = item.z === void 0; + const z = noZ ? 0 : (item.z || 0) + minZ; + const depth = (noZ ? 0 : item.depth || 0) + min3dDepth; + const ty2 = -1; + const ordinal2 = options.assignCubeOrdinal(item.datum); + if (ordinal2 > options.maxOrdinal) { + options.maxOrdinal = ordinal2; + } + if (ordinal2 === void 0) ; + else { + const cube = { + ordinal: ordinal2, + size: [item.width, item.height, depth], + position: [x2 + (+item.x || 0), ty2 * (y2 + (+item.y || 0)) - +item.height, z], + color: colorFromString(item.fill) || options.defaultCubeColor || [128, 128, 128, 128] + }; + cube.color[3] = item.opacity === void 0 ? 255 : 255 * item.opacity; + stage.cubeData.push(cube); + } }); -}; -exports.default = markStager; - -},{"../base":"bxBcY","../color":"gRfIg","../defaults":"c3DaF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gXjfm":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "box", ()=>box); -var _base = require("../base"); -var _color = require("../color"); -var _defaults = require("../defaults"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - (0, _base.base).vega.sceneVisit(scene, function(item) { - const x1 = item.x || 0; - const y1 = item.y || 0; - const x2 = item.x2 != null ? item.x2 : x1; - const y2 = item.y2 != null ? item.y2 : y1; - const lineItem = styledLine(x1 + x, y1 + y, x2 + x, y2 + y, item.stroke, item.strokeWidth); - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, lineItem, stage, currAxis); - if (item.mark.role === 'axis-tick') currAxis.ticks.push(lineItem); - else if (item.mark.role === 'axis-domain') currAxis.domain = lineItem; - else stage.gridLines.push(lineItem); + }; + const markStager$2 = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(item) { + const x12 = item.x || 0; + const y12 = item.y || 0; + const x22 = item.x2 != null ? item.x2 : x12; + const y22 = item.y2 != null ? item.y2 : y12; + const lineItem = styledLine(x12 + x2, y12 + y2, x22 + x2, y22 + y2, item.stroke, item.strokeWidth); + const { currAxis } = options; + if (options.modifyAxis) { + options.modifyAxis(item, lineItem, stage, currAxis); + } + if (item.mark.role === "axis-tick") { + currAxis.ticks.push(lineItem); + } else if (item.mark.role === "axis-domain") { + currAxis.domain = lineItem; + } else { + stage.gridLines.push(lineItem); + } }); -}; -function styledLine(x1, y1, x2, y2, stroke, strokeWidth) { - const line = { - sourcePosition: [ - x1, - -y1, - (0, _defaults.lineZ) - ], - targetPosition: [ - x2, - -y2, - (0, _defaults.lineZ) - ], - color: (0, _color.colorFromString)(stroke), - strokeWidth: strokeWidth - }; - return line; -} -function box(gx, gy, height, width, stroke, strokeWidth, diagonals = false) { + }; + function styledLine(x12, y12, x2, y2, stroke2, strokeWidth) { + const line2 = { + sourcePosition: [x12, -y12, lineZ], + //-1 = change direction of y from SVG to GL + targetPosition: [x2, -y2, lineZ], + color: colorFromString(stroke2), + strokeWidth + }; + return line2; + } + function box(gx, gy, height2, width2, stroke2, strokeWidth, diagonals = false) { const lines = [ - styledLine(gx, gy, gx + width, gy, stroke, strokeWidth), - styledLine(gx + width, gy, gx + width, gy + height, stroke, strokeWidth), - styledLine(gx + width, gy + height, gx, gy + height, stroke, strokeWidth), - styledLine(gx, gy + height, gx, gy, stroke, strokeWidth) + styledLine(gx, gy, gx + width2, gy, stroke2, strokeWidth), + styledLine(gx + width2, gy, gx + width2, gy + height2, stroke2, strokeWidth), + styledLine(gx + width2, gy + height2, gx, gy + height2, stroke2, strokeWidth), + styledLine(gx, gy + height2, gx, gy, stroke2, strokeWidth) ]; if (diagonals) { - lines.push(styledLine(gx, gy, gx + width, gy + height, stroke, strokeWidth)); - lines.push(styledLine(gx, gy + height, gx + width, gy, stroke, strokeWidth)); + lines.push(styledLine(gx, gy, gx + width2, gy + height2, stroke2, strokeWidth)); + lines.push(styledLine(gx, gy + height2, gx + width2, gy, stroke2, strokeWidth)); } return lines; -} -exports.default = markStager; - -},{"../base":"bxBcY","../color":"gRfIg","../defaults":"c3DaF","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"eSo5o":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _color = require("../color"); -//change direction of y from SVG to GL -const ty = -1; -const markStager = (options, stage, scene, x, y, groupType)=>{ - const g = Object.assign({ - opacity: 1, - strokeOpacity: 1, - strokeWidth: 1 - }, scene.items[0]); - const path = { - strokeWidth: g.strokeWidth, - strokeColor: (0, _color.colorFromString)(g.stroke), - positions: scene.items.map((it)=>[ - it.x, - ty * it.y, - it.z || 0 - ]) - }; - path.strokeColor[3] *= g.strokeOpacity; - path.strokeColor[3] *= g.opacity; - stage.pathData.push(path); -}; -exports.default = markStager; - -},{"../color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"2EWWv":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ // import { AlignmentBaseline, TextAnchor } from '@deck.gl/layers/text-layer/text-layer'; -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _base = require("../base"); -var _color = require("../color"); -const markStager = (options, stage, scene, x, y, groupType)=>{ - //change direction of y from SVG to GL - const ty = -1; - (0, _base.base).vega.sceneVisit(scene, function(item) { - if (!item.text) return; - const size = item.fontSize; - //const alignmentBaseline = convertBaseline(item.baseline); - //const yOffset = alignmentBaseline === 'top' ? item.fontSize / 2 : 0; //fixup to get tick text correct - const yOffset = 0; - const textItem = { - color: (0, _color.colorFromString)(item.fill), - text: item.limit === undefined ? item.text : (0, _base.base).vega.truncate(item.text, item.limit, 'right', item.ellipsis || '...'), - position: [ - x + (item.x || 0), - ty * (y + (item.y || 0) + yOffset), - 0 - ], - size, - angle: convertAngle(item.angle), - //textAnchor: convertAlignment(item.align), - //alignmentBaseline, - metaData: item.metaData - }; - const { currAxis } = options; - if (options.modifyAxis) options.modifyAxis(item, textItem, stage, currAxis); - if (item.mark.role === 'axis-label') { - const tickText = textItem; - tickText.value = item.datum.value; - currAxis.tickText.push(tickText); - } else if (item.mark.role === 'axis-title') currAxis.title = textItem; - else stage.textData.push(textItem); + } + const ty = -1; + const markStager$1 = (options, stage, scene, x2, y2, groupType) => { + const g = Object.assign({ opacity: 1, strokeOpacity: 1, strokeWidth: 1 }, scene.items[0]); + const path2 = { + strokeWidth: g.strokeWidth, + strokeColor: colorFromString(g.stroke), + positions: scene.items.map((it) => [ + it.x, + ty * it.y, + it.z || 0 + ]) + }; + path2.strokeColor[3] *= g.strokeOpacity; + path2.strokeColor[3] *= g.opacity; + stage.pathData.push(path2); + }; + const markStager = (options, stage, scene, x2, y2, groupType) => { + const ty2 = -1; + base.vega.sceneVisit(scene, function(item) { + if (!item.text) + return; + const size = item.fontSize; + const yOffset = 0; + const textItem = { + color: colorFromString(item.fill), + text: item.limit === void 0 ? item.text : base.vega.truncate(item.text, item.limit, "right", item.ellipsis || "..."), + //use dots instead of unicode ellipsis for + position: [x2 + (item.x || 0), ty2 * (y2 + (item.y || 0) + yOffset), 0], + size, + angle: convertAngle(item.angle), + //textAnchor: convertAlignment(item.align), + //alignmentBaseline, + metaData: item.metaData + }; + const { currAxis } = options; + if (options.modifyAxis) { + options.modifyAxis(item, textItem, stage, currAxis); + } + if (item.mark.role === "axis-label") { + const tickText = textItem; + tickText.value = item.datum.value; + currAxis.tickText.push(tickText); + } else if (item.mark.role === "axis-title") { + currAxis.title = textItem; + } else { + stage.textData.push(textItem); + } }); -}; -function convertAngle(vegaTextAngle) { - if (vegaTextAngle && !isNaN(vegaTextAngle)) return 360 - vegaTextAngle; + }; + function convertAngle(vegaTextAngle) { + if (vegaTextAngle && !isNaN(vegaTextAngle)) { + return 360 - vegaTextAngle; + } return 0; -} -// function convertAlignment(textAlign: SceneTextAlign): TextAnchor { -// switch (textAlign) { -// case 'center': return 'middle'; -// case 'left': return 'start'; -// case 'right': return 'end'; -// } -// return 'start'; -// } -// function convertBaseline(baseline: SceneTextBaseline): AlignmentBaseline { -// switch (baseline) { -// case 'middle': return 'center'; -// } -// return baseline || 'bottom'; -// } -exports.default = markStager; - -},{"../base":"bxBcY","../color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"S4mDt":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "GroupType", ()=>GroupType); -var GroupType; -(function(GroupType) { - GroupType[GroupType["none"] = 0] = "none"; - GroupType[GroupType["legend"] = 1] = "legend"; - GroupType[GroupType["xAxis"] = 2] = "xAxis"; - GroupType[GroupType["yAxis"] = 3] = "yAxis"; - GroupType[GroupType["zAxis"] = 4] = "zAxis"; -})(GroupType || (GroupType = {})); - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"1zeZZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -var _render = require("./render"); -parcelHelpers.exportAll(_render, exports); -var _color = require("./color"); -parcelHelpers.exportAll(_color, exports); -var _init = require("./init"); -parcelHelpers.exportAll(_init, exports); - -},{"./render":"bOMKd","./color":"cLUpV","./init":"gSXAZ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"bOMKd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "morphChartsRender", ()=>morphChartsRender); -var _axes = require("./axes"); -var _bounds = require("./bounds"); -var _cubes = require("./cubes"); -var _lines = require("./lines"); -var _text = require("./text"); -var _image = require("./image"); -var _defaults = require("../defaults"); -var _color = require("./color"); -var _defaults1 = require("./defaults"); -var _camera = require("./camera"); -function morphChartsRender(ref, prevStage, stage, height, width, preStage, colors, config) { - const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults1.cameraDefaults); - const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref; - let transistion2dOnly = false; - let cameraTo; - let holdCamera; - if (config.camera === 'hold') holdCamera = true; - else cameraTo = config.camera; - if (prevStage && prevStage.view !== stage.view) { - modelTransitioner.shouldTransition = !holdCamera; - if (stage.view === '2d') { - modelTransitioner.qRotation.from = qModelRotation3d; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.from = qModelRotation2d; - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } - } else { - modelTransitioner.shouldTransition = false; - if (stage.view === '2d') { - transistion2dOnly = true; - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d; - cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition; - } + } + var GroupType; + (function(GroupType2) { + GroupType2[GroupType2["none"] = 0] = "none"; + GroupType2[GroupType2["legend"] = 1] = "legend"; + GroupType2[GroupType2["xAxis"] = 2] = "xAxis"; + GroupType2[GroupType2["yAxis"] = 3] = "yAxis"; + GroupType2[GroupType2["zAxis"] = 4] = "zAxis"; + })(GroupType || (GroupType = {})); + function getAxisGroupType(item, options) { + const axisItem = item; + const axisMark = axisItem === null || axisItem === void 0 ? void 0 : axisItem.mark; + if ((axisMark === null || axisMark === void 0 ? void 0 : axisMark.zindex) === options.zAxisZindex && options.zAxisZindex !== void 0) { + return GroupType.zAxis; } - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - if (!prevStage) { - core.setModelRotation(modelTransitioner.qRotation.to, false); - core.camera.setOrbit(cameraTransitioner.qRotation.to, false); - core.camera.setPosition(cameraTransitioner.vPosition.to, false); - } else if (!holdCamera) cameraTransitioner.begin(); - positionTransitioner.begin(); - if (modelTransitioner.shouldTransition) modelTransitioner.begin(); - const props = { - ref, - stage, - height, - width, - config - }; - const cubeLayer = (0, _cubes.createCubeLayer)(props); - const lineLayer = (0, _lines.createLineLayer)(props); - const textLayer = (0, _text.createTextLayer)(props); - const { backgroundImages } = stage; - let contentBounds = (0, _bounds.outerBounds)((0, _bounds.outerBounds)(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), (0, _bounds.outerBounds)(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); - backgroundImages === null || backgroundImages === void 0 || backgroundImages.forEach((backgroundImage)=>{ - contentBounds = (0, _bounds.outerBounds)(contentBounds, convertBounds(backgroundImage.bounds)); - }); - props.bounds = contentBounds; - core.renderer.previousAxes = core.renderer.currentAxes; - const axesLayer = (0, _axes.createAxesLayer)(props); - core.config.transitionStaggering = config.transitionDurations.stagger; - core.config.transitionDuration = config.transitionDurations.position; - let bounds; - if (axesLayer && axesLayer.bounds) bounds = axesLayer.bounds; - else bounds = contentBounds; - ref.setMorphChartsRendererOptions(config.renderer); - if (preStage) preStage(stage, cubeLayer); - //add images - core.renderer.images = []; - if (backgroundImages) { - const addImage = (imageBounds, imageData)=>{ - const imageWidth = imageBounds.maxBoundsX - imageBounds.minBoundsX; - const imageHeight = imageBounds.maxBoundsY - imageBounds.minBoundsY; - const position = [ - imageBounds.minBoundsX + imageWidth / 2, - imageBounds.minBoundsY + imageHeight / 2, - 0 - ]; - const imageQuad = (0, _image.createImageQuad)(core, imageData, contentBounds, position, imageWidth, imageHeight); - const imageVisual = core.renderer.createImageVisual(imageQuad); - core.renderer.images.push(imageVisual); + switch (axisItem.orient) { + case "bottom": + case "top": + return GroupType.xAxis; + case "left": + case "right": + return GroupType.yAxis; + } + } + function convertGroupRole(item, options) { + if (item.mark.role === "legend") + return GroupType.legend; + if (item.mark.role === "axis") { + const groupType = getAxisGroupType(item, options); + if (groupType !== void 0) { + return groupType; + } + } + } + const group = (options, stage, scene, x2, y2, groupType) => { + base.vega.sceneVisit(scene, function(g) { + const gx = g.x || 0, gy = g.y || 0; + if (g.context && g.context.background && !stage.backgroundColor) { + stage.backgroundColor = colorFromString(g.context.background); + } + if (g.stroke) { + const facetRect = { + datum: g.datum, + lines: box(gx + x2, gy + y2, g.height, g.width, g.stroke, groupStrokeWidth) }; - const imageDataCache = {}; - backgroundImages.forEach((backgroundImage)=>{ - const imageBounds = convertBounds(backgroundImage.bounds); - const imageData = imageDataCache[backgroundImage.url]; - if (imageData) addImage(imageBounds, imageData); - else (0, _image.getImageData)(backgroundImage.url).then((imageData)=>{ - imageDataCache[backgroundImage.url] = imageData; - addImage(imageBounds, imageData); - }); - }); + stage.facets.push(facetRect); + } + groupType = convertGroupRole(g, options) || groupType; + setCurrentAxis(options, stage, groupType); + base.vega.sceneVisit(g, function(item) { + mainStager(options, stage, item, gx + x2, gy + y2, groupType); + }); + }); + }; + function setCurrentAxis(options, stage, groupType) { + let axisRole; + switch (groupType) { + case GroupType.xAxis: + axisRole = "x"; + break; + case GroupType.yAxis: + axisRole = "y"; + break; + case GroupType.zAxis: + axisRole = "z"; + break; + default: + return; } - //Now call update on each layout - layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds, ref.layerStagger); - (0, _camera.applyCameraCallbacks)(ref, config, stage.view, transistion2dOnly); - core.renderer.transitionTime = 0; // Set renderer transition time for this render pass to prevent rendering target buffer for single frame - (0, _color.colorConfig)(ref, colors); - return { - bounds, - getCubeLayer: ()=>cubeLayer, - update: (layerSelection)=>layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, ref.layerStagger), - activate: (id)=>core.renderer.transitionBuffers[0].activeId = id, - moveCamera: (camera)=>{ - if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { - core.camera.getOrbit(cameraTransitioner.qRotation.from); - core.camera.getPosition(cameraTransitioner.vPosition.from); - cameraTransitioner.move(camera.position, camera.rotation); - } - }, - setTransitionTimeAxesVisibility: ()=>{ - (0, _camera.setTransitionTimeAxesVisibility)(transistion2dOnly, core); - } + options.currAxis = { + axisRole, + domain: null, + tickText: [], + ticks: [] }; -} -function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds, layerStagger) { - const layerItems = [ - { - layer: cubeLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes - }, - { - layer: lineLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines - }, - { - layer: textLayer, - selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, - stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts - } + stage.axes[axisRole].push(options.currAxis); + } + const markStagers = { + group, + legend: markStager$5, + image: markStager$4, + rect: markStager$3, + rule: markStager$2, + line: markStager$1, + text: markStager + }; + const mainStager = (options, stage, scene, x2, y2, groupType) => { + if (scene.marktype !== "group" && groupType === GroupType.legend) { + markStager$5(options, stage, scene); + } else { + const markStager2 = markStagers[scene.marktype]; + if (markStager2) { + markStager2(options, stage, scene, x2, y2, groupType); + } + } + }; + function sceneToStage(options, stage, scene) { + mainStager(options, stage, scene, 0, 0, null); + sortAxis(stage.axes.x, 0); + sortAxis(stage.axes.y, 1); + sortAxis(stage.axes.z, 1); + } + function sortAxis(axes, dim) { + axes.forEach((axis) => { + if (axis.domain) + orderDomain(axis.domain, dim); + axis.ticks.sort((a2, b2) => a2.sourcePosition[dim] - b2.sourcePosition[dim]); + axis.tickText.sort((a2, b2) => a2.position[dim] - b2.position[dim]); + }); + } + function orderDomain(domain2, dim) { + if (domain2.sourcePosition[dim] > domain2.targetPosition[dim]) { + const temp2 = domain2.targetPosition; + domain2.targetPosition = domain2.sourcePosition; + domain2.sourcePosition = temp2; + } + } + function outerBounds(b1, b2) { + if (!b1 && !b2) + return; + if (!b1) + return b2; + if (!b2) + return b1; + const minProps = [ + "minBoundsX", + "minBoundsY", + "minBoundsZ" ]; - layerItems.forEach((layerItem)=>{ - var _a; - return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds, layerItem.selection, layerItem.stagger); + const maxProps = [ + "maxBoundsX", + "maxBoundsY", + "maxBoundsZ" + ]; + const result = {}; + minProps.forEach((p) => result[p] = notNull(Math.min, b1[p], b2[p])); + maxProps.forEach((p) => result[p] = notNull(Math.max, b1[p], b2[p])); + return result; + } + function notNull(fn, v1, v2) { + if (v1 == null && v2 == null) + return null; + if (v1 == null) + return v2; + if (v2 == null) + return v1; + return fn(v1, v2); + } + function increment(b2, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { + return outerBounds(b2, { + minBoundsX, + minBoundsY, + minBoundsZ, + maxBoundsX, + maxBoundsY, + maxBoundsZ }); -} -function convertBounds(bounds) { - if (!bounds) return; - return { - minBoundsX: bounds.x1, - maxBoundsX: bounds.x2, - minBoundsY: -bounds.y2, - maxBoundsY: -bounds.y1, - minBoundsZ: (0, _defaults.minZ), - maxBoundsZ: (0, _defaults.minZ) - }; -} - -},{"./axes":"fQgAd","./bounds":"jYVLQ","./cubes":"fl32M","./lines":"3egUA","./text":"6GPxW","./image":"cic5g","../defaults":"c3DaF","./color":"cLUpV","./defaults":"e8nEW","./camera":"fuwxM","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fQgAd":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createAxesLayer", ()=>createAxesLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -const createAxesLayer = (props)=>{ - const { config, height, ref, stage } = props; - const { core } = ref; + } + const createAxesLayer = (props) => { + const { config, height: height2, ref: ref2, stage } = props; + const { core } = ref2; const { renderer } = core; - const { x, y, z } = stage.axes; - const xyz = [ - ...x, - ...y, - ...z - ]; + const { x: x2, y: y2, z } = stage.axes; + const xyz = [...x2, ...y2, ...z]; renderer.currentAxes = []; if (!xyz.length) { - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - return; + renderer.axesVisibility = AxesVisibility.none; + return; } - renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + renderer.axesVisibility = AxesVisibility.current; const correlation = new AxesCorrelation(stage, 3); const { axesSets, labels } = correlation; const grid = correlation.getGrid(); if (grid.byColumn[0]) { - grid.byColumn[0].forEach((row)=>{ - row.axesSet.showFacetTitleY = true; - }); - grid.byRow[0].forEach((col)=>{ - col.axesSet.showFacetTitleX = true; - }); + grid.byColumn[0].forEach((row) => { + row.axesSet.showFacetTitleY = true; + }); + grid.byRow[0].forEach((col) => { + col.axesSet.showFacetTitleX = true; + }); } if (grid.rows > 1) { - const { byRow } = grid; - byRow[0].forEach(({ axesSet }, col)=>{ - if (!axesSet.y) { - if (byRow[1][col].axesSet) { - //move x up - byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; - byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; - delete axesSet.x; - } - } - }); + const { byRow } = grid; + byRow[0].forEach(({ axesSet }, col) => { + if (!axesSet.y) { + if (byRow[1][col].axesSet) { + byRow[1][col].axesSet.x.tickText = axesSet.x.tickText; + byRow[1][col].axesSet.showFacetTitleX = axesSet.showFacetTitleX; + delete axesSet.x; + } + } + }); } - let bounds; + let bounds2; const allAxesSetBounds = []; let anyZ = false; - for(let i = 0; i < axesSets.length; i++)if (axesSets[i].z) { + for (let i = 0; i < axesSets.length; i++) { + if (axesSets[i].z) { anyZ = true; break; + } } - const is3d = stage.view === '3d' && anyZ; - axesSets.forEach((axesSet)=>{ - if (!axesSet.x && !axesSet.y) return; - const axesSetBounds = { - axesSet, - maxBoundsX: null, - maxBoundsY: null, - maxBoundsZ: null, - minBoundsX: null, - minBoundsY: null, - minBoundsZ: null - }; - if (is3d) { - const zBounds = getDomainBounds(1, axesSet.z); - axesSetBounds.minBoundsZ = -zBounds.maxBounds; - axesSetBounds.maxBoundsZ = -zBounds.minBounds; - } - const yBounds = getDomainBounds(1, axesSet.y); - axesSetBounds.minBoundsY = yBounds.minBounds; - axesSetBounds.maxBoundsY = yBounds.maxBounds; - axesSetBounds.y = yBounds.minBounds; - axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; - const xBounds = getDomainBounds(0, axesSet.x); - axesSetBounds.minBoundsX = xBounds.minBounds; - axesSetBounds.maxBoundsX = xBounds.maxBounds; - axesSetBounds.x = xBounds.minBounds; - axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; - allAxesSetBounds.push(axesSetBounds); - bounds = (0, _bounds.outerBounds)(bounds, axesSetBounds); - }); - const facetLabelX = labels.filter((label)=>label.axisRole === 'x')[0]; - const facetLabelY = labels.filter((label)=>label.axisRole === 'y')[0]; - core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator })=>{ - const axesSet = axesSets[axes]; - let a; - let f; - switch(axis){ - case 0: - a = axesSet.x; - f = facetLabelX; - break; - case 1: - a = axesSet.y; - f = facetLabelY; - break; - case 2: - a = axesSet.z; - break; + const is3d = stage.view === "3d" && anyZ; + axesSets.forEach((axesSet) => { + if (!axesSet.x && !axesSet.y) + return; + const axesSetBounds = { + axesSet, + maxBoundsX: null, + maxBoundsY: null, + maxBoundsZ: null, + minBoundsX: null, + minBoundsY: null, + minBoundsZ: null + }; + if (is3d) { + const zBounds = getDomainBounds(1, axesSet.z); + axesSetBounds.minBoundsZ = -zBounds.maxBounds; + axesSetBounds.maxBoundsZ = -zBounds.minBounds; + } + const yBounds = getDomainBounds(1, axesSet.y); + axesSetBounds.minBoundsY = yBounds.minBounds; + axesSetBounds.maxBoundsY = yBounds.maxBounds; + axesSetBounds.y = yBounds.minBounds; + axesSetBounds.h = yBounds.maxBounds - yBounds.minBounds; + const xBounds = getDomainBounds(0, axesSet.x); + axesSetBounds.minBoundsX = xBounds.minBounds; + axesSetBounds.maxBoundsX = xBounds.maxBounds; + axesSetBounds.x = xBounds.minBounds; + axesSetBounds.w = xBounds.maxBounds - xBounds.minBounds; + allAxesSetBounds.push(axesSetBounds); + bounds2 = outerBounds(bounds2, axesSetBounds); + }); + const facetLabelX = labels.filter((label2) => label2.axisRole === "x")[0]; + const facetLabelY = labels.filter((label2) => label2.axisRole === "y")[0]; + core.inputManager.pickAxesTitleCallback = ({ axis, axes, manipulator }) => { + const axesSet = axesSets[axes]; + let a2; + let f; + switch (axis) { + case 0: { + a2 = axesSet.x; + f = facetLabelX; + break; + } + case 1: { + a2 = axesSet.y; + f = facetLabelY; + break; + } + case 2: { + a2 = axesSet.z; + break; } - if (a) config.onTextClick(manipulator.event, a.title || f.title); - }; - allAxesSetBounds.forEach((axesSetBounds)=>{ - const { axesSet } = axesSetBounds; - if (!axesSet.x && !axesSet.y) return; - const cartesian = new (is3d ? (0, _morphcharts.Axes).Cartesian3dAxes : (0, _morphcharts.Axes).Cartesian2dAxes)(core); - cartesian.isDivisionPickingEnabled = [ - false, - false, - false - ]; - cartesian.arePickDivisionsVisible = [ - false, - false, - false - ]; - cartesian.isLabelPickingEnabled = [ - false, - false, - false - ]; - cartesian.isTitlePickingEnabled = [ - false, - false, - false - ]; - cartesian.isGridPickingEnabled = false; - cartesian.isHeadingPickingEnabled = [ - false, - false, - false - ]; - createAxes(cartesian, 0, 0, axesSet.x, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleX && facetLabelX); - createAxes(cartesian, 1, 1, axesSet.y, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props, axesSet.showFacetTitleY && facetLabelY); - if (is3d) createAxes(cartesian, 1, 2, axesSet.z, (0, _morphcharts.AxesTextOrientation).perpendicular, height, props); - configCartesianAxes(is3d, bounds, cartesian); - const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds; - const w = maxBoundsX - minBoundsX; - const h = maxBoundsY - minBoundsY; - cartesian.scalingX = axesSetBounds.w / w; - cartesian.scalingY = axesSetBounds.h / h; - cartesian.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w - 0.5; - cartesian.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h - 0.5; - const aspect = h / w; - if (aspect > 1) cartesian.offsetX /= aspect; - else cartesian.offsetY *= aspect; - const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian) : renderer.createCartesian2dAxesVisual(cartesian); - renderer.currentAxes.push(axes); - props.config.onAxesComplete && props.config.onAxesComplete(cartesian); + } + if (a2) { + config.onTextClick(manipulator.event, a2.title || f.title); + } + }; + allAxesSetBounds.forEach((axesSetBounds) => { + const { axesSet } = axesSetBounds; + if (!axesSet.x && !axesSet.y) + return; + const cartesian2 = new (is3d ? Cartesian3dAxes : Cartesian2dAxes)(core); + cartesian2.isDivisionPickingEnabled = [false, false, false]; + cartesian2.arePickDivisionsVisible = [false, false, false]; + cartesian2.isLabelPickingEnabled = [false, false, false]; + cartesian2.isTitlePickingEnabled = [false, false, false]; + cartesian2.isGridPickingEnabled = false; + cartesian2.isHeadingPickingEnabled = [false, false, false]; + createAxes(cartesian2, 0, 0, axesSet.x, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleX && facetLabelX); + createAxes(cartesian2, 1, 1, axesSet.y, AxesTextOrientation.perpendicular, height2, props, axesSet.showFacetTitleY && facetLabelY); + if (is3d) { + createAxes(cartesian2, 1, 2, axesSet.z, AxesTextOrientation.perpendicular, height2, props); + } + configCartesianAxes(is3d, bounds2, cartesian2); + const { maxBoundsX, maxBoundsY, minBoundsX, minBoundsY } = bounds2; + const w2 = maxBoundsX - minBoundsX; + const h2 = maxBoundsY - minBoundsY; + cartesian2.scalingX = axesSetBounds.w / w2; + cartesian2.scalingY = axesSetBounds.h / h2; + cartesian2.offsetX = (axesSetBounds.x - minBoundsX + axesSetBounds.w / 2) / w2 - 0.5; + cartesian2.offsetY = (axesSetBounds.y - minBoundsY + axesSetBounds.h / 2) / h2 - 0.5; + const aspect = h2 / w2; + if (aspect > 1) { + cartesian2.offsetX /= aspect; + } else { + cartesian2.offsetY *= aspect; + } + const axes = is3d ? renderer.createCartesian3dAxesVisual(cartesian2) : renderer.createCartesian2dAxesVisual(cartesian2); + renderer.currentAxes.push(axes); + props.config.onAxesComplete && props.config.onAxesComplete(cartesian2); }); - return { - bounds - }; -}; -const nullDomain = { - sourcePosition: [ - 0, - 0, - 0 - ], - targetPosition: [ - 0, - 0, - 0 - ] -}; -class AxesCorrelation { - constructor(stage, dimensions){ - this.dimensions = dimensions; - const { x, y, z } = stage.axes; - this.axesSets = []; - this.labels = []; - [ - x, - y, - z - ].forEach((axes)=>{ - axes.forEach((axis)=>{ - if (this.axesSets.length === 0) this.initialize(axis); - else this.correlate(axis); - }); + return { bounds: bounds2 }; + }; + const nullDomain = { + sourcePosition: [0, 0, 0], + targetPosition: [0, 0, 0] + }; + class AxesCorrelation { + constructor(stage, dimensions) { + this.dimensions = dimensions; + const { x: x2, y: y2, z } = stage.axes; + this.axesSets = []; + this.labels = []; + [x2, y2, z].forEach((axes) => { + axes.forEach((axis) => { + if (this.axesSets.length === 0) { + this.initialize(axis); + } else { + this.correlate(axis); + } }); + }); } getGrid() { - const mapCols = {}; - const mapRows = {}; - this.axesSets.forEach((axesSet)=>{ - var _a; - const domain = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; - if (!domain) return; - const col = domain.sourcePosition[0].toString(); - const row = domain.sourcePosition[1].toString(); - if (!mapCols[col]) mapCols[col] = {}; - mapCols[col][row] = axesSet; - mapRows[row] = null; - }); - const colKeys = Object.keys(mapCols).sort((a, b)=>+a - +b); - const rowKeys = Object.keys(mapRows).sort((a, b)=>+a - +b); - return { - cols: colKeys.length, - rows: rowKeys.length, - byColumn: colKeys.map((colKey)=>rowKeys.map((rowKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })), - byRow: rowKeys.map((rowKey)=>colKeys.map((colKey)=>{ - return { - colKey, - rowKey, - axesSet: mapCols[colKey][rowKey] - }; - })) - }; + const mapCols = {}; + const mapRows = {}; + this.axesSets.forEach((axesSet) => { + var _a; + const domain2 = (_a = axesSet === null || axesSet === void 0 ? void 0 : axesSet.x) === null || _a === void 0 ? void 0 : _a.domain; + if (!domain2) + return; + const col = domain2.sourcePosition[0].toString(); + const row = domain2.sourcePosition[1].toString(); + if (!mapCols[col]) { + mapCols[col] = {}; + } + mapCols[col][row] = axesSet; + mapRows[row] = null; + }); + const colKeys = Object.keys(mapCols).sort((a2, b2) => +a2 - +b2); + const rowKeys = Object.keys(mapRows).sort((a2, b2) => +a2 - +b2); + return { + cols: colKeys.length, + rows: rowKeys.length, + byColumn: colKeys.map((colKey) => rowKeys.map((rowKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })), + byRow: rowKeys.map((rowKey) => colKeys.map((colKey) => { + return { colKey, rowKey, axesSet: mapCols[colKey][rowKey] }; + })) + }; } initialize(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - const axesSet = {}; - axesSet[axis.axisRole] = axis; - this.axesSets.push(axesSet); + if (!axis.domain) { + this.labels.push(axis); + return; + } + const axesSet = {}; + axesSet[axis.axisRole] = axis; + this.axesSets.push(axesSet); } correlate(axis) { - if (!axis.domain) { - this.labels.push(axis); - return; - } - for(let i = 0; i < this.axesSets.length; i++){ - const axesSet = this.axesSets[i]; - for(const axisRole in axesSet){ - const test = axesSet[axisRole]; - if (this.matchDomains(axis.domain, test.domain)) { - //prefer the axes with titles - if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) axesSet[axis.axisRole] = axis; - return; - } + if (!axis.domain) { + this.labels.push(axis); + return; + } + for (let i = 0; i < this.axesSets.length; i++) { + const axesSet = this.axesSets[i]; + for (const axisRole in axesSet) { + const test2 = axesSet[axisRole]; + if (this.matchDomains(axis.domain, test2.domain)) { + if (!axesSet[axis.axisRole] || !axesSet[axis.axisRole].tickText.length && axis.tickText.length) { + axesSet[axis.axisRole] = axis; } + return; + } } - this.initialize(axis); - } - matchDomains(a, b) { - if (this.matchPoint(a.sourcePosition, b.sourcePosition)) return true; - if (this.matchPoint(a.sourcePosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.targetPosition)) return true; - if (this.matchPoint(a.targetPosition, b.sourcePosition)) return true; - return false; + } + this.initialize(axis); } - matchPoint(a, b) { - for(let i = 0; i < this.dimensions; i++){ - if (a[i] !== b[i]) return false; - } + matchDomains(a2, b2) { + if (this.matchPoint(a2.sourcePosition, b2.sourcePosition)) return true; + if (this.matchPoint(a2.sourcePosition, b2.targetPosition)) + return true; + if (this.matchPoint(a2.targetPosition, b2.targetPosition)) + return true; + if (this.matchPoint(a2.targetPosition, b2.sourcePosition)) + return true; + return false; + } + matchPoint(a2, b2) { + for (let i = 0; i < this.dimensions; i++) { + if (a2[i] !== b2[i]) + return false; + } + return true; } -} -function createAxes(cartesian, dim2d, dim3d, axis, orientation, height, props, facetLabel) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain, dim2d, height); - if (axis.axisRole === 'z') { - tickPositions.forEach((t, i)=>tickPositions[i] = 1 - t); - textPos.forEach((t, i)=>textPos[i] = 1 - t); - tickText.reverse(); - tickPositions.reverse(); - textPos.reverse(); - } - cartesian.setTickPositions(dim3d, tickPositions); - cartesian.zero[dim3d] = 0; //TODO get any "zero" gridline position from vega - cartesian.setLabelPositions(dim3d, textPos); - cartesian.setLabels(dim3d, tickText); - cartesian.setLabelSizes(dim3d, textSize); + } + function createAxes(cartesian2, dim2d, dim3d, axis, orientation, height2, props, facetLabel) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const { tickPositions, tickText, textPos, textSize } = convertAxis(axis, domain2, dim2d, height2); + if (axis.axisRole === "z") { + tickPositions.forEach((t, i) => tickPositions[i] = 1 - t); + textPos.forEach((t, i) => textPos[i] = 1 - t); + tickText.reverse(); + tickPositions.reverse(); + textPos.reverse(); + } + cartesian2.setTickPositions(dim3d, tickPositions); + cartesian2.zero[dim3d] = 0; + cartesian2.setLabelPositions(dim3d, textPos); + cartesian2.setLabels(dim3d, tickText); + cartesian2.setLabelSizes(dim3d, textSize); const title = (axis === null || axis === void 0 ? void 0 : axis.title) || (facetLabel === null || facetLabel === void 0 ? void 0 : facetLabel.title); if (title === null || title === void 0 ? void 0 : title.text) { - cartesian.setTitle(dim3d, title.text); - cartesian.setTitleSize(dim3d, title.size / height); + cartesian2.setTitle(dim3d, title.text); + cartesian2.setTitleSize(dim3d, title.size / height2); } - cartesian.setLabelOrientation(dim3d, orientation); - props.config.onAxisConfig && props.config.onAxisConfig(cartesian, dim3d, axis); + cartesian2.setLabelOrientation(dim3d, orientation); + props.config.onAxisConfig && props.config.onAxisConfig(cartesian2, dim3d, axis); return { - tickText - }; -} -function configCartesianAxes(is3d, bounds, cartesian) { - if (is3d) cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topBack] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).backRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).bottomRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).frontRight] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topFront] = false; - cartesian.isEdgeVisible[(0, _morphcharts.Edge3D).topRight] = false; - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - cartesian.minBoundsX = minBoundsX; - cartesian.maxBoundsX = maxBoundsX; - cartesian.minBoundsY = minBoundsY; - cartesian.maxBoundsY = maxBoundsY; + tickText + }; + } + function configCartesianAxes(is3d, bounds2, cartesian2) { if (is3d) { - cartesian.minBoundsZ = minBoundsZ; - cartesian.maxBoundsZ = maxBoundsZ; - } -} -function getDomainBounds(dim2d, axis) { - const domain = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; - const minBounds = domain.sourcePosition[dim2d]; - const maxBounds = domain.targetPosition[dim2d]; + cartesian2.isEdgeVisible[Edge3D.topBack] = false; + } + cartesian2.isEdgeVisible[Edge3D.backRight] = false; + cartesian2.isEdgeVisible[Edge3D.bottomRight] = false; + cartesian2.isEdgeVisible[Edge3D.frontRight] = false; + cartesian2.isEdgeVisible[Edge3D.topFront] = false; + cartesian2.isEdgeVisible[Edge3D.topRight] = false; + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; + cartesian2.minBoundsX = minBoundsX; + cartesian2.maxBoundsX = maxBoundsX; + cartesian2.minBoundsY = minBoundsY; + cartesian2.maxBoundsY = maxBoundsY; + if (is3d) { + cartesian2.minBoundsZ = minBoundsZ; + cartesian2.maxBoundsZ = maxBoundsZ; + } + } + function getDomainBounds(dim2d, axis) { + const domain2 = (axis === null || axis === void 0 ? void 0 : axis.domain) || nullDomain; + const minBounds = domain2.sourcePosition[dim2d]; + const maxBounds = domain2.targetPosition[dim2d]; return { - maxBounds, - minBounds - }; -} -function convertAxis(axis, domain, dim, height) { - const start = domain.sourcePosition[dim]; - const span = domain.targetPosition[dim] - start; - const tickPositions = axis ? axis.ticks.map((t)=>(t.sourcePosition[dim] - start) / span) : []; - const tickText = axis ? axis.tickText.map((t)=>t.text) : []; - const textPos = axis ? axis.tickText.map((t)=>(t.position[dim] - start) / span) : []; - const textSize = axis ? axis.tickText.map((t)=>t.size / height) : []; + maxBounds, + minBounds + }; + } + function convertAxis(axis, domain2, dim, height2) { + const start = domain2.sourcePosition[dim]; + const span2 = domain2.targetPosition[dim] - start; + const tickPositions = axis ? axis.ticks.map((t) => (t.sourcePosition[dim] - start) / span2) : []; + const tickText = axis ? axis.tickText.map((t) => t.text) : []; + const textPos = axis ? axis.tickText.map((t) => (t.position[dim] - start) / span2) : []; + const textSize = axis ? axis.tickText.map((t) => t.size / height2) : []; if (tickPositions.length) { - if (tickPositions[0] !== 0) tickPositions[0] = 0; - if (tickPositions[tickPositions.length - 1] !== 1) tickPositions[tickPositions.length - 1] = 1; + if (tickPositions[0] !== 0) { + tickPositions[0] = 0; + } + if (tickPositions[tickPositions.length - 1] !== 1) { + tickPositions[tickPositions.length - 1] = 1; + } } return { - tickPositions, - tickText, - textPos, - textSize - }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"jYVLQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "outerBounds", ()=>outerBounds); -parcelHelpers.export(exports, "increment", ()=>increment); -function outerBounds(b1, b2) { - if (!b1 && !b2) return; - if (!b1) return b2; - if (!b2) return b1; - const minProps = [ - 'minBoundsX', - 'minBoundsY', - 'minBoundsZ' - ]; - const maxProps = [ - 'maxBoundsX', - 'maxBoundsY', - 'maxBoundsZ' - ]; - const result = {}; - minProps.forEach((p)=>result[p] = notNull(Math.min, b1[p], b2[p])); - maxProps.forEach((p)=>result[p] = notNull(Math.max, b1[p], b2[p])); - return result; -} -function notNull(fn, v1, v2) { - if (v1 == null && v2 == null) return null; - if (v1 == null) return v2; - if (v2 == null) return v1; - return fn(v1, v2); -} -function increment(b, minBoundsX, minBoundsY, minBoundsZ, maxBoundsX, maxBoundsY, maxBoundsZ) { - return outerBounds(b, { - minBoundsX, - minBoundsY, - minBoundsZ, - maxBoundsX, - maxBoundsY, - maxBoundsZ - }); -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fl32M":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createCubeLayer", ()=>createCubeLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'cube'; -const createCubeLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const scatter = new (0, _morphcharts.Layouts).Scatter(core); - const { ids, colors, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds, maxColor, palette } = convert(stage); - if (!ids.length) return; + tickPositions, + tickText, + textPos, + textSize + }; + } + class ColorMap { + constructor(quant = 5) { + this.quant = quant; + this.colorMap = {}; + this.colorArray = []; + } + getColorKey(rgbaColor) { + const color2 = rgbaColor.slice(0, 3).map((e) => Math.floor(e / this.quant) * this.quant); + color2[3] = rgbaColor[3]; + return JSON.stringify(color2); + } + registerColor(rgbaColor) { + const colorKey = this.getColorKey(rgbaColor); + if (!this.colorMap[colorKey]) { + this.colorMap[colorKey] = { + index: this.colorArray.length, + rgbaColor + }; + this.colorArray.push(rgbaColor); + } + return this.colorMap[colorKey].index; + } + getPalette() { + return { + palette: new Uint8Array(this.colorArray.flat()), + maxColor: this.colorArray.length - 1 + }; + } + } + function convert$3(newColor) { + const c2 = colorFromString(newColor).slice(0, 3); + return c2.map((v) => v / 255); + } + function colorConfig(ref2, colors2) { + if (!colors2) + return; + const { config } = ref2.core; + config.activeColor = convert$3(colors2.activeItemColor); + config.backgroundColor = new Float32Array(convert$3(colors2.backgroundColor)); + config.textColor = convert$3(colors2.textColor); + config.textBorderColor = convert$3(colors2.textBorderColor); + config.axesTextColor = convert$3(colors2.axesTextLabelColor); + config.axesGridBackgroundColor = convert$3(colors2.axesGridBackgroundColor); + config.axesGridHighlightColor = convert$3(colors2.axesGridHighlightColor); + config.axesGridMinorColor = convert$3(colors2.axesGridMinorColor); + config.axesGridMajorColor = convert$3(colors2.axesGridMajorColor); + config.axesGridZeroColor = convert$3(colors2.axesGridZeroColor); + ref2.core.renderer["_theme"] = null; + } + const key$1 = "cube"; + const createCubeLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const scatter = new Scatter(core); + const { ids, colors: colors2, positionsX, positionsY, positionsZ, sizesX, sizesY, sizesZ, bounds: bounds2, maxColor, palette } = convert$2(stage); + if (!ids.length) + return; const { renderer } = core; - let cubeTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let cubeTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key$1); if (!cubeTransitionBuffer) { - cubeTransitionBuffer = renderer.createTransitionBuffer(ids); - cubeTransitionBuffer.key = key; - renderer.transitionBuffers.push(cubeTransitionBuffer); - } else cubeTransitionBuffer.swap(); + cubeTransitionBuffer = renderer.createTransitionBuffer(ids); + cubeTransitionBuffer.key = key$1; + renderer.transitionBuffers.push(cubeTransitionBuffer); + } else { + cubeTransitionBuffer.swap(); + } scatter.layout(cubeTransitionBuffer.currentBuffer, ids, { - positionsX, - positionsY, - positionsZ + positionsX, + positionsY, + positionsZ }); const layer = { - positionsX, - positionsY, - positionsZ, - update: (newBounds, selected, stagger)=>{ - const { colors, maxColor, minColor, palette } = layer.unitColorMap; - // reference off of core.renderer to get the actual buffer - const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - currCubeTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).block; - currCubeTransitionBuffer.currentPalette.colors = palette; - let options = Object.assign({ - selected, - colors, - minColor, - maxColor, - sizesX, - sizesY, - sizesZ - }, newBounds); - if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { - const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; - options = Object.assign(Object.assign({}, options), { - maxStaggerOrder, - minStaggerOrder, - staggerOrders - }); - } - scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); - }, - bounds, - unitColorMap: { - colors, - ids, - minColor: 0, - maxColor, - palette - } + positionsX, + positionsY, + positionsZ, + update: (newBounds, selected, stagger) => { + const { colors: colors3, maxColor: maxColor2, minColor, palette: palette2 } = layer.unitColorMap; + const currCubeTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key$1); + currCubeTransitionBuffer.currentBuffer.unitType = UnitType.block; + currCubeTransitionBuffer.currentPalette.colors = palette2; + let options = Object.assign({ + selected, + colors: colors3, + minColor, + maxColor: maxColor2, + sizesX, + sizesY, + sizesZ + }, newBounds); + if (stagger === null || stagger === void 0 ? void 0 : stagger.staggerOrders) { + const { maxStaggerOrder, minStaggerOrder, staggerOrders } = stagger; + options = Object.assign(Object.assign({}, options), { + maxStaggerOrder, + minStaggerOrder, + staggerOrders + }); + } + scatter.update(currCubeTransitionBuffer.currentBuffer, ids, options); + }, + bounds: bounds2, + unitColorMap: { + colors: colors2, + ids, + minColor: 0, + maxColor, + palette + } }; return layer; -}; -function convert(stage) { + }; + function convert$2(stage) { const { cubeData } = stage; - const { length } = cubeData; + const { length: length2 } = cubeData; const ids = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizesX = new Float64Array(length); - const sizesY = new Float64Array(length); - const sizesZ = new Float64Array(length); - let bounds; - const colorMap = new (0, _color.ColorMap)(); - cubeData.forEach((cube, i)=>{ - ids.push(i); - if (cube.isEmpty) { - positionsX[i] = 0; - positionsY[i] = 0; - positionsZ[i] = 0; - sizesX[i] = 0; - sizesY[i] = 0; - sizesZ[i] = 0; - colors[i] = 0; - } else { - //ids.push(cube.ordinal); - positionsX[i] = cube.position[0] + cube.size[0] * 0.5; - positionsY[i] = cube.position[1] + cube.size[1] * 0.5; - positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; - sizesX[i] = cube.size[0]; - sizesY[i] = cube.size[1]; - sizesZ[i] = cube.size[2]; - bounds = (0, _bounds.increment)(bounds, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); - colors[i] = colorMap.registerColor(cube.color); - } + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizesX = new Float64Array(length2); + const sizesY = new Float64Array(length2); + const sizesZ = new Float64Array(length2); + let bounds2; + const colorMap = new ColorMap(); + cubeData.forEach((cube, i) => { + ids.push(i); + if (cube.isEmpty) { + positionsX[i] = 0; + positionsY[i] = 0; + positionsZ[i] = 0; + sizesX[i] = 0; + sizesY[i] = 0; + sizesZ[i] = 0; + colors2[i] = 0; + } else { + positionsX[i] = cube.position[0] + cube.size[0] * 0.5; + positionsY[i] = cube.position[1] + cube.size[1] * 0.5; + positionsZ[i] = cube.position[2] + cube.size[2] * 0.5; + sizesX[i] = cube.size[0]; + sizesY[i] = cube.size[1]; + sizesZ[i] = cube.size[2]; + bounds2 = increment(bounds2, cube.position[0], cube.position[1], cube.position[2], cube.position[0] + cube.size[0], cube.position[1] + cube.size[1], cube.position[2] + cube.size[2]); + colors2[i] = colorMap.registerColor(cube.color); + } }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizesX, - sizesY, - sizesZ, - bounds, - maxColor, - palette + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizesX, + sizesY, + sizesZ, + bounds: bounds2, + maxColor, + palette }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","./color":"cLUpV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cLUpV":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ColorMap", ()=>ColorMap); -parcelHelpers.export(exports, "colorConfig", ()=>colorConfig); -var _color = require("../color"); -class ColorMap { - constructor(quant = 5){ - this.quant = quant; - this.colorMap = {}; - this.colorArray = []; - } - getColorKey(rgbaColor) { - const color = rgbaColor.slice(0, 3).map((e)=>Math.floor(e / this.quant) * this.quant); - color[3] = rgbaColor[3]; //retain alpha - return JSON.stringify(color); - } - registerColor(rgbaColor) { - const colorKey = this.getColorKey(rgbaColor); - if (!this.colorMap[colorKey]) { - this.colorMap[colorKey] = { - index: this.colorArray.length, - rgbaColor - }; - this.colorArray.push(rgbaColor); - } - return this.colorMap[colorKey].index; - } - getPalette() { - return { - palette: new Uint8Array(this.colorArray.flat()), - maxColor: this.colorArray.length - 1 - }; - } -} -function convert(newColor) { - const c = (0, _color.colorFromString)(newColor).slice(0, 3); - return c.map((v)=>v / 255); -} -function colorConfig(ref, colors) { - if (!colors) return; - const { config } = ref.core; - config.activeColor = convert(colors.activeItemColor); - config.backgroundColor = new Float32Array(convert(colors.backgroundColor)); - config.textColor = convert(colors.textColor); - config.textBorderColor = convert(colors.textBorderColor); - config.axesTextColor = convert(colors.axesTextLabelColor); - config.axesGridBackgroundColor = convert(colors.axesGridBackgroundColor); - config.axesGridHighlightColor = convert(colors.axesGridHighlightColor); - config.axesGridMinorColor = convert(colors.axesGridMinorColor); - config.axesGridMajorColor = convert(colors.axesGridMajorColor); - config.axesGridZeroColor = convert(colors.axesGridZeroColor); - //TODO fix this - hack to reset the background color - ref.core.renderer['_theme'] = null; -} - -},{"../color":"gRfIg","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"3egUA":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createLineLayer", ()=>createLineLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const key = 'line'; -const createLineLayer = (props)=>{ - const { height, ref, stage, width } = props; - const { core } = ref; - const lines = new (0, _morphcharts.Layouts).Line(core); - const { ids, fromIds, toIds, lineColors, lineSizes, bounds, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert(stage, height, width); - if (!ids.length) return; + } + const key = "line"; + const createLineLayer = (props) => { + const { height: height2, ref: ref2, stage } = props; + const { core } = ref2; + const lines = new Line(core); + const { ids, fromIds, toIds, lineColors, lineSizes, bounds: bounds2, positionsX, positionsY, positionsZ, lineMaxColor, palette } = convert$1(stage, height2); + if (!ids.length) + return; const { renderer } = core; - let lineTransitionBuffer = renderer.transitionBuffers.find((t)=>t.key === key); + let lineTransitionBuffer = renderer.transitionBuffers.find((t) => t.key === key); if (!lineTransitionBuffer) { - lineTransitionBuffer = renderer.createTransitionBuffer(ids); - lineTransitionBuffer.key = key; - renderer.transitionBuffers.push(lineTransitionBuffer); - } else lineTransitionBuffer.swap(); + lineTransitionBuffer = renderer.createTransitionBuffer(ids); + lineTransitionBuffer.key = key; + renderer.transitionBuffers.push(lineTransitionBuffer); + } else { + lineTransitionBuffer.swap(); + } lines.layout(lineTransitionBuffer.currentBuffer, ids, fromIds, toIds, { - positionsX, - positionsY, - positionsZ, - lineSizes, - sizeScaling: 1 + positionsX, + positionsY, + positionsZ, + lineSizes, + sizeScaling: 1 }); let options = { - lineColors, - lineMinColor: 0, - lineMaxColor + lineColors, + lineMinColor: 0, + lineMaxColor }; - // Unit type - lineTransitionBuffer.currentBuffer.unitType = (0, _morphcharts.UnitType).cylinder; + lineTransitionBuffer.currentBuffer.unitType = UnitType.cylinder; lineTransitionBuffer.currentPalette.colors = palette; return { - update: (newBounds)=>{ - options = Object.assign(Object.assign({}, options), newBounds); - // reference off of core.renderer to get the actual buffer - const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t)=>t.key === key); - lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); - }, - bounds, - unitColorMap: { - ids, - colors: lineColors, - minColor: 0, - maxColor: lineMaxColor, - palette - } + update: (newBounds) => { + options = Object.assign(Object.assign({}, options), newBounds); + const currLineTransitionBuffer = core.renderer.transitionBuffers.find((t) => t.key === key); + lines.update(currLineTransitionBuffer.currentBuffer, ids, fromIds, toIds, options); + }, + bounds: bounds2, + unitColorMap: { + ids, + colors: lineColors, + minColor: 0, + maxColor: lineMaxColor, + palette + } }; -}; -function convert(stage, height, width) { + }; + function convert$1(stage, height2, width2) { const { pathData } = stage; const positions = []; const lines = []; - const colorMap = new (0, _color.ColorMap)(); - pathData.forEach((path)=>{ - const color = colorMap.registerColor(path.strokeColor); - let from = positions.length; - positions.push(path.positions[0]); - for(let i = 1; i < path.positions.length; i++){ - const to = positions.length; - positions.push(path.positions[i]); - lines.push({ - id: lines.length, - from, - to, - color, - size: path.strokeWidth - }); - from = to; - } + const colorMap = new ColorMap(); + pathData.forEach((path2) => { + const color2 = colorMap.registerColor(path2.strokeColor); + let from = positions.length; + positions.push(path2.positions[0]); + for (let i = 1; i < path2.positions.length; i++) { + const to = positions.length; + positions.push(path2.positions[i]); + lines.push({ + id: lines.length, + from, + to, + color: color2, + size: path2.strokeWidth + }); + from = to; + } }); const ids = new Uint32Array(lines.length); const fromIds = new Uint32Array(lines.length); const toIds = new Uint32Array(lines.length); const lineColors = new Float64Array(lines.length); const lineSizes = new Float64Array(lines.length); - lines.forEach((line, i)=>{ - ids[i] = i; - fromIds[i] = line.from; - toIds[i] = line.to; - lineColors[i] = line.color; - lineSizes[i] = line.size; + lines.forEach((line2, i) => { + ids[i] = i; + fromIds[i] = line2.from; + toIds[i] = line2.to; + lineColors[i] = line2.color; + lineSizes[i] = line2.size; }); const positionsX = new Float64Array(positions.length); const positionsY = new Float64Array(positions.length); const positionsZ = new Float64Array(positions.length); - let bounds; - positions.forEach((p, i)=>{ - positionsX[i] = p[0]; - positionsY[i] = p[1] + height; - positionsZ[i] = p[2]; - bounds = (0, _bounds.increment)(bounds, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); + let bounds2; + positions.forEach((p, i) => { + positionsX[i] = p[0]; + positionsY[i] = p[1] + height2; + positionsZ[i] = p[2]; + bounds2 = increment(bounds2, positionsX[i], positionsY[i], positionsZ[i], positionsX[i], positionsY[i], positionsZ[i]); }); const { palette, maxColor: lineMaxColor } = colorMap.getPalette(); return { - ids, - fromIds, - toIds, - lineColors, - lineSizes, - bounds, - positionsX, - positionsY, - positionsZ, - lineMaxColor, - palette + ids, + fromIds, + toIds, + lineColors, + lineSizes, + bounds: bounds2, + positionsX, + positionsY, + positionsZ, + lineMaxColor, + palette }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","./color":"cLUpV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"6GPxW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "createTextLayer", ()=>createTextLayer); -var _morphcharts = require("morphcharts"); -var _bounds = require("./bounds"); -var _color = require("./color"); -const createTextLayer = (props)=>{ - const { ref, stage } = props; - const { core } = ref; - const { positionsX, positionsY, positionsZ, sizes, bounds, maxGlyphs, text } = convert(stage); - if (text.length === 0) { - core.renderer.labelSets = []; - return; + } + const createTextLayer = (props) => { + const { ref: ref2, stage } = props; + const { core } = ref2; + const { positionsX, positionsY, positionsZ, sizes, bounds: bounds2, maxGlyphs, text: text2 } = convert(stage); + if (text2.length === 0) { + core.renderer.labelSets = []; + return; } const options = { - text, - maxGlyphs, - scales: sizes + text: text2, + maxGlyphs, + scales: sizes }; - const labelSet = new (0, _morphcharts.Components).LabelSet(core, options); + const labelSet = new LabelSet(core, options); labelSet.positionsX = positionsX; labelSet.positionsY = positionsY; labelSet.positionsZ = positionsZ; - labelSet.horizontalAlignment = (0, _morphcharts.HorizontalAlignment).center; - labelSet.verticalAlignment = (0, _morphcharts.VerticalAlignment).center; + labelSet.horizontalAlignment = HorizontalAlignment.center; + labelSet.verticalAlignment = VerticalAlignment.center; const layer = { - update: (bounds)=>{ - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; - labelSet.minBoundsX = minBoundsX; - labelSet.minBoundsY = minBoundsY; - labelSet.minBoundsZ = minBoundsZ; - labelSet.maxBoundsX = maxBoundsX; - labelSet.maxBoundsY = maxBoundsY; - labelSet.maxBoundsZ = maxBoundsZ; - }, - bounds + update: (bounds3) => { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds3; + labelSet.minBoundsX = minBoundsX; + labelSet.minBoundsY = minBoundsY; + labelSet.minBoundsZ = minBoundsZ; + labelSet.maxBoundsX = maxBoundsX; + labelSet.maxBoundsY = maxBoundsY; + labelSet.maxBoundsZ = maxBoundsZ; + }, + bounds: bounds2 }; const labelSetVisual = core.renderer.createLabelSetVisual(labelSet); - core.renderer.labelSets = [ - labelSetVisual - ]; + core.renderer.labelSets = [labelSetVisual]; return layer; -}; -function convert(stage) { + }; + function convert(stage) { const { textData } = stage; - const { length } = textData; + const { length: length2 } = textData; const ids = []; - const text = []; - const colors = new Float64Array(length); - const positionsX = new Float64Array(length); - const positionsY = new Float64Array(length); - const positionsZ = new Float64Array(length); - const sizes = new Float64Array(length); - let bounds; + const text2 = []; + const colors2 = new Float64Array(length2); + const positionsX = new Float64Array(length2); + const positionsY = new Float64Array(length2); + const positionsZ = new Float64Array(length2); + const sizes = new Float64Array(length2); + let bounds2; let maxGlyphs = 0; - const colorMap = new (0, _color.ColorMap)(); - textData.forEach((t, i)=>{ - ids.push(i); - text.push(t.text); - maxGlyphs += t.text.length; - positionsX[i] = t.position[0]; - positionsY[i] = t.position[1]; - positionsZ[i] = t.position[2]; - sizes[i] = 1.5 * t.size; //scale similar to axes - bounds = (0, _bounds.increment)(bounds, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); - colors[i] = colorMap.registerColor(t.color); + const colorMap = new ColorMap(); + textData.forEach((t, i) => { + ids.push(i); + text2.push(t.text); + maxGlyphs += t.text.length; + positionsX[i] = t.position[0]; + positionsY[i] = t.position[1]; + positionsZ[i] = t.position[2]; + sizes[i] = 1.5 * t.size; + bounds2 = increment(bounds2, t.position[0], t.position[1], t.position[2], t.position[0], t.position[1], t.position[2]); + colors2[i] = colorMap.registerColor(t.color); }); const { palette, maxColor } = colorMap.getPalette(); return { - ids: new Uint32Array(ids), - colors, - positionsX, - positionsY, - positionsZ, - sizes, - bounds, - maxColor, - maxGlyphs, - palette, - text - }; -} - -},{"morphcharts":"lF8Ji","./bounds":"jYVLQ","./color":"cLUpV","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"cic5g":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "getImageData", ()=>getImageData); -parcelHelpers.export(exports, "createImageQuad", ()=>createImageQuad); -var _morphcharts = require("morphcharts"); -function getImageData(url) { - return new Promise((resolve, reject)=>{ - const imageElement = document.createElement('img'); - imageElement.onload = ()=>{ - const canvas = document.createElement('canvas'); - const ctx = canvas.getContext('2d'); - const { height, width } = imageElement; - canvas.width = width; - canvas.height = height; - ctx.drawImage(imageElement, 0, 0); - resolve(ctx.getImageData(0, 0, width, height)); - }; - imageElement.src = url; + ids: new Uint32Array(ids), + colors: colors2, + positionsX, + positionsY, + positionsZ, + sizes, + bounds: bounds2, + maxColor, + maxGlyphs, + palette, + text: text2 + }; + } + function getImageData(url) { + return new Promise((resolve2, reject) => { + const imageElement = document.createElement("img"); + imageElement.onload = () => { + const canvas = document.createElement("canvas"); + const ctx = canvas.getContext("2d"); + const { height: height2, width: width2 } = imageElement; + canvas.width = width2; + canvas.height = height2; + ctx.drawImage(imageElement, 0, 0); + resolve2(ctx.getImageData(0, 0, width2, height2)); + }; + imageElement.src = url; }); -} -function createImageQuad(core, imageData, bounds, position, width, height) { - const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds; + } + function createImageQuad(core, imageData, bounds2, position2, width2, height2) { + const { maxBoundsX, maxBoundsY, maxBoundsZ, minBoundsX, minBoundsY, minBoundsZ } = bounds2; const imageOptions = { - imageData, - position, - height, - width, - minBoundsX, - maxBoundsX, - minBoundsZ, - maxBoundsZ, - minBoundsY, - maxBoundsY - }; - return new (0, _morphcharts.Components).ImageQuad(core, imageOptions); -} - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"e8nEW":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cameraDefaults", ()=>cameraDefaults); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -function createCameraDefaults() { - const qModelRotation2d = (0, _glMatrix.quat).create(); - const qModelRotation3d = (0, _morphcharts.Constants).QUAT_ROTATEX_MINUS_90; - const qCameraRotation2d = (0, _glMatrix.quat).create(); - const qCameraRotation3d = (0, _glMatrix.quat).create(); - const qAngle = (0, _glMatrix.quat).create(); - const vCameraPosition = (0, _glMatrix.vec3).create(); - // Altitude (pitch around local right axis) - (0, _glMatrix.quat).setAxisAngle(qCameraRotation3d, (0, _morphcharts.Constants).VECTOR3_UNITX, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(30)); - // Azimuth (yaw around global up axis) - (0, _glMatrix.quat).setAxisAngle(qAngle, (0, _morphcharts.Constants).VECTOR3_UNITY, (0, _morphcharts.Helpers).AngleHelper.degreesToRadians(-25)); - (0, _glMatrix.quat).multiply(qCameraRotation3d, qCameraRotation3d, qAngle); + imageData, + position: position2, + height: height2, + width: width2, + minBoundsX, + maxBoundsX, + minBoundsZ, + maxBoundsZ, + minBoundsY, + maxBoundsY + }; + return new ImageQuad(core, imageOptions); + } + function createCameraDefaults() { + const qModelRotation2d2 = create$1(); + const qModelRotation3d2 = Constants.QUAT_ROTATEX_MINUS_90; + const qCameraRotation2d2 = create$1(); + const qCameraRotation3d2 = create$1(); + const qAngle = create$1(); + const vCameraPosition2 = create$3(); + setAxisAngle(qCameraRotation3d2, Constants.VECTOR3_UNITX, AngleHelper.degreesToRadians(30)); + setAxisAngle(qAngle, Constants.VECTOR3_UNITY, AngleHelper.degreesToRadians(-25)); + multiply(qCameraRotation3d2, qCameraRotation3d2, qAngle); return { - qModelRotation2d, - qModelRotation3d, - qCameraRotation2d, - qCameraRotation3d, - vCameraPosition - }; -} -const cameraDefaults = createCameraDefaults(); - -},{"gl-matrix":"erHGu","morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fuwxM":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "applyCameraCallbacks", ()=>applyCameraCallbacks); -parcelHelpers.export(exports, "setTransitionTimeAxesVisibility", ()=>setTransitionTimeAxesVisibility); -var _glMatrix = require("gl-matrix"); -var _morphcharts = require("morphcharts"); -var _defaults = require("./defaults"); -const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = (0, _defaults.cameraDefaults); -function applyCameraCallbacks(ref, lastPresenterConfig, lastView, transistion2dOnly) { - const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref; - ref.reset = ()=>{ - core.reset(true); - if (lastView === '3d') { - modelTransitioner.qRotation.to = qModelRotation3d; - cameraTransitioner.qRotation.to = qCameraRotation3d; - cameraTransitioner.vPosition.to = vCameraPosition; - } else { - modelTransitioner.qRotation.to = qModelRotation2d; - cameraTransitioner.qRotation.to = qCameraRotation2d; - cameraTransitioner.vPosition.to = vCameraPosition; - } - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); - core.setModelRotation(modelTransitioner.qRotation.current, true); - core.camera.setOrbit(cameraTransitioner.qRotation.to, true); - core.camera.setPosition(cameraTransitioner.vPosition.to, true); - }; - const cam = (t)=>{ - (0, _glMatrix.quat).slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); - (0, _glMatrix.vec3).lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); - core.camera.setOrbit(cameraTransitioner.qRotation.current, false); - core.camera.setPosition(cameraTransitioner.vPosition.current, false); - // disable picking during transitions, as the performance degradation could reduce the framerate - core.inputManager.isPickingEnabled = false; - }; - core.updateCallback = (elapsedTime)=>{ - const { transitionDurations } = lastPresenterConfig; - if (positionTransitioner.isTransitioning) { - const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); - core.renderer.transitionTime = t; - setTransitionTimeAxesVisibility(transistion2dOnly, core); - } else core.inputManager.isPickingEnabled = true; - if (modelTransitioner.isTransitioning) { - const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); - if (modelTransitioner.shouldTransition) { - (0, _glMatrix.quat).slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); - core.setModelRotation(modelTransitioner.qRotation.current, false); - } - cam(tm); - } - if (cameraTransitioner.isTransitioning) { - const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); - cam(t); + qModelRotation2d: qModelRotation2d2, + qModelRotation3d: qModelRotation3d2, + qCameraRotation2d: qCameraRotation2d2, + qCameraRotation3d: qCameraRotation3d2, + vCameraPosition: vCameraPosition2 + }; + } + const cameraDefaults = createCameraDefaults(); + const { qCameraRotation2d, qCameraRotation3d, qModelRotation2d, qModelRotation3d, vCameraPosition } = cameraDefaults; + function applyCameraCallbacks(ref2, lastPresenterConfig, lastView, transistion2dOnly) { + const { cameraTransitioner, core, modelTransitioner, positionTransitioner } = ref2; + ref2.reset = () => { + core.reset(true); + if (lastView === "3d") { + modelTransitioner.qRotation.to = qModelRotation3d; + cameraTransitioner.qRotation.to = qCameraRotation3d; + cameraTransitioner.vPosition.to = vCameraPosition; + } else { + modelTransitioner.qRotation.to = qModelRotation2d; + cameraTransitioner.qRotation.to = qCameraRotation2d; + cameraTransitioner.vPosition.to = vCameraPosition; + } + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.to, modelTransitioner.qRotation.to, 0); + core.setModelRotation(modelTransitioner.qRotation.current, true); + core.camera.setOrbit(cameraTransitioner.qRotation.to, true); + core.camera.setPosition(cameraTransitioner.vPosition.to, true); + }; + const cam = (t) => { + slerp(cameraTransitioner.qRotation.current, cameraTransitioner.qRotation.from, cameraTransitioner.qRotation.to, t); + lerp(cameraTransitioner.vPosition.current, cameraTransitioner.vPosition.from, cameraTransitioner.vPosition.to, t); + core.camera.setOrbit(cameraTransitioner.qRotation.current, false); + core.camera.setPosition(cameraTransitioner.vPosition.current, false); + core.inputManager.isPickingEnabled = false; + }; + core.updateCallback = (elapsedTime) => { + const { transitionDurations } = lastPresenterConfig; + if (positionTransitioner.isTransitioning) { + const t = positionTransitioner.elapse(elapsedTime, transitionDurations.position + transitionDurations.stagger); + core.renderer.transitionTime = t; + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } else { + core.inputManager.isPickingEnabled = true; + } + if (modelTransitioner.isTransitioning) { + const tm = modelTransitioner.elapse(elapsedTime, transitionDurations.view, true); + if (modelTransitioner.shouldTransition) { + slerp(modelTransitioner.qRotation.current, modelTransitioner.qRotation.from, modelTransitioner.qRotation.to, tm); + core.setModelRotation(modelTransitioner.qRotation.current, false); } + cam(tm); + } + if (cameraTransitioner.isTransitioning) { + const t = cameraTransitioner.elapse(elapsedTime, transitionDurations.view, true); + cam(t); + } }; -} -function setTransitionTimeAxesVisibility(transistion2dOnly, core) { + } + function setTransitionTimeAxesVisibility(transistion2dOnly, core) { const t = core.renderer.transitionTime; if (transistion2dOnly) { - if (t < 0.5) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; + if (t < 0.5) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else { + core.renderer.axesVisibility = AxesVisibility.current; + } } else { - if (t <= 0.01) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).previous; - else if (t >= 0.99) core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - else core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).none; - } -} - -},{"gl-matrix":"erHGu","morphcharts":"lF8Ji","./defaults":"e8nEW","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"gSXAZ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "init", ()=>init); -var _morphcharts = require("morphcharts"); -var _renderer = require("./renderer"); -var _canvas = require("./canvas"); -var _transition = require("../transition"); -function init(options, mcRendererOptions) { - const { container } = options; - const core = new (0, _morphcharts.Core)({ - container + if (t <= 0.01) { + core.renderer.axesVisibility = AxesVisibility.previous; + } else if (t >= 0.99) { + core.renderer.axesVisibility = AxesVisibility.current; + } else { + core.renderer.axesVisibility = AxesVisibility.none; + } + } + } + function morphChartsRender(ref2, prevStage, stage, height2, width2, preStage, colors2, config) { + const { qCameraRotation2d: qCameraRotation2d2, qCameraRotation3d: qCameraRotation3d2, qModelRotation2d: qModelRotation2d2, qModelRotation3d: qModelRotation3d2, vCameraPosition: vCameraPosition2 } = cameraDefaults; + const { core, cameraTransitioner, modelTransitioner, positionTransitioner } = ref2; + let transistion2dOnly = false; + let cameraTo; + let holdCamera; + if (config.camera === "hold") { + holdCamera = true; + } else { + cameraTo = config.camera; + } + if (prevStage && prevStage.view !== stage.view) { + modelTransitioner.shouldTransition = !holdCamera; + if (stage.view === "2d") { + modelTransitioner.qRotation.from = qModelRotation3d2; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.from = qModelRotation2d2; + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } + } else { + modelTransitioner.shouldTransition = false; + if (stage.view === "2d") { + transistion2dOnly = true; + modelTransitioner.qRotation.to = qModelRotation2d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation2d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } else { + modelTransitioner.qRotation.to = qModelRotation3d2; + cameraTransitioner.qRotation.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.rotation) || qCameraRotation3d2; + cameraTransitioner.vPosition.to = (cameraTo === null || cameraTo === void 0 ? void 0 : cameraTo.position) || vCameraPosition2; + } + } + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + if (!prevStage) { + core.setModelRotation(modelTransitioner.qRotation.to, false); + core.camera.setOrbit(cameraTransitioner.qRotation.to, false); + core.camera.setPosition(cameraTransitioner.vPosition.to, false); + } else if (!holdCamera) { + cameraTransitioner.begin(); + } + positionTransitioner.begin(); + if (modelTransitioner.shouldTransition) { + modelTransitioner.begin(); + } + const props = { ref: ref2, stage, height: height2, config }; + const cubeLayer = createCubeLayer(props); + const lineLayer = createLineLayer(props); + const textLayer = createTextLayer(props); + const { backgroundImages } = stage; + let contentBounds = outerBounds(outerBounds(cubeLayer === null || cubeLayer === void 0 ? void 0 : cubeLayer.bounds, lineLayer === null || lineLayer === void 0 ? void 0 : lineLayer.bounds), outerBounds(textLayer === null || textLayer === void 0 ? void 0 : textLayer.bounds, null)); + backgroundImages === null || backgroundImages === void 0 ? void 0 : backgroundImages.forEach((backgroundImage) => { + contentBounds = outerBounds(contentBounds, convertBounds(backgroundImage.bounds)); }); - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - core.config.pickSelectDelay = 50; - const cameraTransitioner = new (0, _transition.CameraTransitioner)(); - const modelTransitioner = new (0, _transition.ModelTransitioner)(); - const positionTransitioner = new (0, _transition.Transitioner)(); - positionTransitioner.ended = ()=>{ - core.renderer.axesVisibility = (0, _morphcharts.AxesVisibility).current; - }; - const ref = { - supportedRenders: { - advanced: (0, _renderer.rendererEnabled)(true), - basic: (0, _renderer.rendererEnabled)(false) - }, - reset: null, - cameraTransitioner, - modelTransitioner, - positionTransitioner, - core, - setMorphChartsRendererOptions (mcRendererOptions) { - if ((0, _renderer.shouldChangeRenderer)(ref.lastMorphChartsRendererOptions, mcRendererOptions)) { - (0, _renderer.getRenderer)(mcRendererOptions, core); - (0, _canvas.listenCanvasEvents)(core, options); - } else if (mcRendererOptions.advanced) //same renderer, poke the config - (0, _renderer.setRendererOptions)(core.renderer, mcRendererOptions); - ref.lastMorphChartsRendererOptions = mcRendererOptions; - }, - lastMorphChartsRendererOptions: mcRendererOptions, - layerStagger: {} - }; - return ref; -} - -},{"morphcharts":"lF8Ji","./renderer":"hCMuN","./canvas":"baSAp","../transition":"aaeTK","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"hCMuN":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "shouldChangeRenderer", ()=>shouldChangeRenderer); -parcelHelpers.export(exports, "getRenderer", ()=>getRenderer); -parcelHelpers.export(exports, "setRendererOptions", ()=>setRendererOptions); -parcelHelpers.export(exports, "rendererEnabled", ()=>rendererEnabled); -var _morphcharts = require("morphcharts"); -function shouldChangeRenderer(prev, next) { + props.bounds = contentBounds; + core.renderer.previousAxes = core.renderer.currentAxes; + const axesLayer = createAxesLayer(props); + core.config.transitionStaggering = config.transitionDurations.stagger; + core.config.transitionDuration = config.transitionDurations.position; + let bounds2; + if (axesLayer && axesLayer.bounds) { + bounds2 = axesLayer.bounds; + } else { + bounds2 = contentBounds; + } + ref2.setMorphChartsRendererOptions(config.renderer); + if (preStage) { + preStage(stage, cubeLayer); + } + core.renderer.images = []; + if (backgroundImages) { + const addImage = (imageBounds, imageData) => { + const imageWidth2 = imageBounds.maxBoundsX - imageBounds.minBoundsX; + const imageHeight2 = imageBounds.maxBoundsY - imageBounds.minBoundsY; + const position2 = [imageBounds.minBoundsX + imageWidth2 / 2, imageBounds.minBoundsY + imageHeight2 / 2, 0]; + const imageQuad = createImageQuad(core, imageData, contentBounds, position2, imageWidth2, imageHeight2); + const imageVisual = core.renderer.createImageVisual(imageQuad); + core.renderer.images.push(imageVisual); + }; + const imageDataCache = {}; + backgroundImages.forEach((backgroundImage) => { + const imageBounds = convertBounds(backgroundImage.bounds); + const imageData = imageDataCache[backgroundImage.url]; + if (imageData) { + addImage(imageBounds, imageData); + } else { + getImageData(backgroundImage.url).then((imageData2) => { + imageDataCache[backgroundImage.url] = imageData2; + addImage(imageBounds, imageData2); + }); + } + }); + } + layersWithSelection(cubeLayer, lineLayer, textLayer, config.layerSelection, bounds2, ref2.layerStagger); + applyCameraCallbacks(ref2, config, stage.view, transistion2dOnly); + core.renderer.transitionTime = 0; + colorConfig(ref2, colors2); + return { + bounds: bounds2, + getCubeLayer: () => cubeLayer, + update: (layerSelection) => layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, ref2.layerStagger), + activate: (id2) => core.renderer.transitionBuffers[0].activeId = id2, + moveCamera: (camera) => { + if (!(positionTransitioner.isTransitioning || modelTransitioner.isTransitioning)) { + core.camera.getOrbit(cameraTransitioner.qRotation.from); + core.camera.getPosition(cameraTransitioner.vPosition.from); + cameraTransitioner.move(camera.position, camera.rotation); + } + }, + setTransitionTimeAxesVisibility: () => { + setTransitionTimeAxesVisibility(transistion2dOnly, core); + } + }; + } + function layersWithSelection(cubeLayer, lineLayer, textLayer, layerSelection, bounds2, layerStagger) { + const layerItems = [ + { + layer: cubeLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.cubes, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.cubes + }, + { + layer: lineLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.lines, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.lines + }, + { + layer: textLayer, + selection: layerSelection === null || layerSelection === void 0 ? void 0 : layerSelection.texts, + stagger: layerStagger === null || layerStagger === void 0 ? void 0 : layerStagger.texts + } + ]; + layerItems.forEach((layerItem) => { + var _a; + return (_a = layerItem.layer) === null || _a === void 0 ? void 0 : _a.update(bounds2, layerItem.selection, layerItem.stagger); + }); + } + function convertBounds(bounds2) { + if (!bounds2) + return; + return { + minBoundsX: bounds2.x1, + maxBoundsX: bounds2.x2, + minBoundsY: -bounds2.y2, + maxBoundsY: -bounds2.y1, + minBoundsZ: minZ, + maxBoundsZ: minZ + }; + } + function shouldChangeRenderer(prev, next) { var _a, _b; - if (!prev || !next) return true; - if (prev.advanced !== next.advanced) return true; - if (!prev.advanced) return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); -} -function getRenderer(mcRendererOptions, core) { + if (!prev || !next) + return true; + if (prev.advanced !== next.advanced) + return true; + if (!prev.advanced) { + return ((_a = prev.basicOptions) === null || _a === void 0 ? void 0 : _a.antialias) != ((_b = next.basicOptions) === null || _b === void 0 ? void 0 : _b.antialias); + } + } + function getRenderer(mcRendererOptions, core) { const advanced = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced; - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); + const r = advanced ? new Main() : new Main$1(mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.basicOptions); core.renderer = r; setRendererOptions(r, mcRendererOptions); return r; -} -function setRendererOptions(renderer, mcRendererOptions) { + } + function setRendererOptions(renderer, mcRendererOptions) { const o = mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advancedOptions; - if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) for(const key in o)renderer.config[key] = o[key]; -} -function rendererEnabled(advanced) { - const r = advanced ? new (0, _morphcharts.Renderers).Advanced.Main() : new (0, _morphcharts.Renderers).Basic.Main(); + if ((mcRendererOptions === null || mcRendererOptions === void 0 ? void 0 : mcRendererOptions.advanced) && o) { + for (const key2 in o) { + renderer.config[key2] = o[key2]; + } + } + } + function rendererEnabled(advanced) { + const r = advanced ? new Main() : new Main$1(); return r.isSupported; -} - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"baSAp":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "listenCanvasEvents", ()=>listenCanvasEvents); -var _morphcharts = require("morphcharts"); -const rightButton = 2; -function listenCanvasEvents(core, options) { + } + const rightButton = 2; + function listenCanvasEvents(core, options) { const { container, pickGridCallback } = options; const { inputManager } = core; - if (options.onLasso) inputManager.pickLassoCallback = (result)=>{ + if (options.onLasso) { + inputManager.pickLassoCallback = (result) => { options.onLasso(result.ids[0], result.manipulator.event); + }; + } + inputManager.singleTouchAction = (manipulator) => { + if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) { + return SingleTouchAction.rotate; + } else if (manipulator.altKey) { + return SingleTouchAction.lasso; + } else { + return SingleTouchAction.translate; + } }; - inputManager.singleTouchAction = (manipulator)=>{ - if (manipulator.button == rightButton || manipulator.shiftKey || manipulator.ctrlKey) return (0, _morphcharts.SingleTouchAction).rotate; - else if (manipulator.altKey) return (0, _morphcharts.SingleTouchAction).lasso; - else return (0, _morphcharts.SingleTouchAction).translate; - }; - inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator })=>{ - clearClickTimeout(); - const { altKey, button, shiftKey } = manipulator; - const me = { - altKey, - shiftKey, - button - }; - const e = me; - pickGridCallback([ - divisionX, - divisionY, - divisionZ - ], e); - }; - const canvas = container.getElementsByTagName('canvas')[0]; + inputManager.pickAxesGridCallback = ({ divisionX, divisionY, divisionZ, manipulator }) => { + clearClickTimeout(); + const { altKey, button, shiftKey } = manipulator; + const me = { altKey, shiftKey, button }; + const e = me; + pickGridCallback([divisionX, divisionY, divisionZ], e); + }; + const canvas = container.getElementsByTagName("canvas")[0]; let pickedId; - const hover = (e)=>{ - if (core.renderer.pickedId !== pickedId) { - pickedId = core.renderer.pickedId; - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeHover(e, ordinal); - } + const hover2 = (e) => { + if (core.renderer.pickedId !== pickedId) { + pickedId = core.renderer.pickedId; + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeHover(e, ordinal2); + } }; - canvas.addEventListener('mousemove', (e)=>{ - clearClickTimeout(); - if (mousedown) options.onCubeHover(e, null); - hover(e); + canvas.addEventListener("mousemove", (e) => { + clearClickTimeout(); + if (mousedown) { + options.onCubeHover(e, null); + } + hover2(e); }); - canvas.addEventListener('mouseout', hover); - canvas.addEventListener('mouseover', hover); + canvas.addEventListener("mouseout", hover2); + canvas.addEventListener("mouseover", hover2); let mousedown; - canvas.addEventListener('mousedown', ()=>{ - mousedown = true; + canvas.addEventListener("mousedown", () => { + mousedown = true; }); - canvas.addEventListener('mouseup', (e)=>{ - mousedown = false; + canvas.addEventListener("mouseup", (e) => { + mousedown = false; }); let canvasClickTimeout; - const clearClickTimeout = ()=>{ - clearTimeout(canvasClickTimeout); - canvasClickTimeout = null; - }; - canvas.addEventListener('click', (e)=>{ - canvasClickTimeout = setTimeout(()=>{ - options.onCanvasClick(e); - }, 50); + const clearClickTimeout = () => { + clearTimeout(canvasClickTimeout); + canvasClickTimeout = null; + }; + canvas.addEventListener("click", (e) => { + canvasClickTimeout = setTimeout(() => { + options.onCanvasClick(e); + }, 50); }); - inputManager.pickItemCallback = ({ manipulator })=>{ - clearClickTimeout(); - const ordinal = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; - options.onCubeClick(manipulator.event, ordinal); - }; -} - -},{"morphcharts":"lF8Ji","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"aaeTK":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "Transitioner", ()=>Transitioner); -parcelHelpers.export(exports, "CameraTransitioner", ()=>CameraTransitioner); -parcelHelpers.export(exports, "ModelTransitioner", ()=>ModelTransitioner); -var _glMatrix = require("gl-matrix"); -var _easing = require("./easing"); -class Transitioner { - constructor(){ - this.isTransitioning = false; + inputManager.pickItemCallback = ({ manipulator }) => { + clearClickTimeout(); + const ordinal2 = core.renderer.transitionBuffers[0].pickIdLookup[pickedId]; + options.onCubeClick(manipulator.event, ordinal2); + }; + } + function cubicInOut(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; + } + function easing(t) { + if (t === 0 || t === 1) + return t; + return cubicInOut(t); + } + class Transitioner { + constructor() { + this.isTransitioning = false; } begin() { - this.isTransitioning = true; - this.time = 0; + this.isTransitioning = true; + this.time = 0; } elapse(elapsedTime, totalTime, ease = false) { - this.time += elapsedTime; - if (this.time >= totalTime) { - this.isTransitioning = false; - this.time = totalTime; - this.ended && this.ended(); - } - const t = this.time / totalTime; - return ease ? (0, _easing.easing)(t) : t; - } -} -class CameraTransitioner extends Transitioner { - constructor(){ - super(); - this.qRotation = { - from: (0, _glMatrix.quat).create(), - to: null, - current: (0, _glMatrix.quat).create() - }; - this.vPosition = { - from: (0, _glMatrix.vec3).create(), - to: null, - current: (0, _glMatrix.vec3).create() - }; + this.time += elapsedTime; + if (this.time >= totalTime) { + this.isTransitioning = false; + this.time = totalTime; + this.ended && this.ended(); + } + const t = this.time / totalTime; + return ease ? easing(t) : t; } - move(position, rotation) { - this.begin(); - this.qRotation.to = rotation; - this.vPosition.to = position; - } -} -class ModelTransitioner extends Transitioner { - constructor(){ - super(); - this.shouldTransition = false; - this.qRotation = { - from: null, - to: null, - current: (0, _glMatrix.quat).create() - }; + } + class CameraTransitioner extends Transitioner { + constructor() { + super(); + this.qRotation = { + from: create$1(), + to: null, + current: create$1() + }; + this.vPosition = { + from: create$3(), + to: null, + current: create$3() + }; + } + move(position2, rotation2) { + this.begin(); + this.qRotation.to = rotation2; + this.vPosition.to = position2; } -} - -},{"gl-matrix":"erHGu","./easing":"4dfzi","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4dfzi":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easing", ()=>easing); -var _d3Ease = require("d3-ease"); -function easing(t) { - if (t === 0 || t === 1) return t; - return (0, _d3Ease.easeCubicInOut)(t); -} - -},{"d3-ease":"johm3","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"johm3":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "easeLinear", ()=>(0, _linearJs.linear)); -parcelHelpers.export(exports, "easeQuad", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeQuadIn", ()=>(0, _quadJs.quadIn)); -parcelHelpers.export(exports, "easeQuadOut", ()=>(0, _quadJs.quadOut)); -parcelHelpers.export(exports, "easeQuadInOut", ()=>(0, _quadJs.quadInOut)); -parcelHelpers.export(exports, "easeCubic", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easeCubicIn", ()=>(0, _cubicJs.cubicIn)); -parcelHelpers.export(exports, "easeCubicOut", ()=>(0, _cubicJs.cubicOut)); -parcelHelpers.export(exports, "easeCubicInOut", ()=>(0, _cubicJs.cubicInOut)); -parcelHelpers.export(exports, "easePoly", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easePolyIn", ()=>(0, _polyJs.polyIn)); -parcelHelpers.export(exports, "easePolyOut", ()=>(0, _polyJs.polyOut)); -parcelHelpers.export(exports, "easePolyInOut", ()=>(0, _polyJs.polyInOut)); -parcelHelpers.export(exports, "easeSin", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeSinIn", ()=>(0, _sinJs.sinIn)); -parcelHelpers.export(exports, "easeSinOut", ()=>(0, _sinJs.sinOut)); -parcelHelpers.export(exports, "easeSinInOut", ()=>(0, _sinJs.sinInOut)); -parcelHelpers.export(exports, "easeExp", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeExpIn", ()=>(0, _expJs.expIn)); -parcelHelpers.export(exports, "easeExpOut", ()=>(0, _expJs.expOut)); -parcelHelpers.export(exports, "easeExpInOut", ()=>(0, _expJs.expInOut)); -parcelHelpers.export(exports, "easeCircle", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeCircleIn", ()=>(0, _circleJs.circleIn)); -parcelHelpers.export(exports, "easeCircleOut", ()=>(0, _circleJs.circleOut)); -parcelHelpers.export(exports, "easeCircleInOut", ()=>(0, _circleJs.circleInOut)); -parcelHelpers.export(exports, "easeBounce", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceIn", ()=>(0, _bounceJs.bounceIn)); -parcelHelpers.export(exports, "easeBounceOut", ()=>(0, _bounceJs.bounceOut)); -parcelHelpers.export(exports, "easeBounceInOut", ()=>(0, _bounceJs.bounceInOut)); -parcelHelpers.export(exports, "easeBack", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeBackIn", ()=>(0, _backJs.backIn)); -parcelHelpers.export(exports, "easeBackOut", ()=>(0, _backJs.backOut)); -parcelHelpers.export(exports, "easeBackInOut", ()=>(0, _backJs.backInOut)); -parcelHelpers.export(exports, "easeElastic", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticIn", ()=>(0, _elasticJs.elasticIn)); -parcelHelpers.export(exports, "easeElasticOut", ()=>(0, _elasticJs.elasticOut)); -parcelHelpers.export(exports, "easeElasticInOut", ()=>(0, _elasticJs.elasticInOut)); -var _linearJs = require("./linear.js"); -var _quadJs = require("./quad.js"); -var _cubicJs = require("./cubic.js"); -var _polyJs = require("./poly.js"); -var _sinJs = require("./sin.js"); -var _expJs = require("./exp.js"); -var _circleJs = require("./circle.js"); -var _bounceJs = require("./bounce.js"); -var _backJs = require("./back.js"); -var _elasticJs = require("./elastic.js"); - -},{"./linear.js":false,"./quad.js":false,"./cubic.js":"4Bdab","./poly.js":false,"./sin.js":false,"./exp.js":false,"./circle.js":false,"./bounce.js":false,"./back.js":false,"./elastic.js":false,"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"4Bdab":[function(require,module,exports,__globalThis) { -var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "cubicIn", ()=>cubicIn); -parcelHelpers.export(exports, "cubicOut", ()=>cubicOut); -parcelHelpers.export(exports, "cubicInOut", ()=>cubicInOut); -function cubicIn(t) { - return t * t * t; -} -function cubicOut(t) { - return --t * t * t + 1; -} -function cubicInOut(t) { - return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; -} - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"98mkQ":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "ViewGl", ()=>ViewGl); -var _base = require("../base"); -var _defaults = require("../defaults"); -var _presenter = require("../presenter"); -var _enums = require("../enums"); -var _rendererGl = require("./rendererGl"); -let registered = false; -//dynamic superclass lets us create a subclass at execution phase instead of declaration phase. -//This allows us to retrieve vega.View from either UMD or ES6 consumers of this class. -//pass in the SuperClass, which should be a vega.View -function _ViewGl(runtime, config) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class ViewGlInternal extends (0, _base.base).vega.View { - constructor(runtime, config = {}){ - super(runtime, config); - this.config = config; - this.presenter = config.presenter; - config.presenterConfig = config.presenterConfig || {}; - config.presenterConfig.redraw = ()=>{ - this._redraw = true; //use Vega View private member _redraw - this.run(); - }; + } + class ModelTransitioner extends Transitioner { + constructor() { + super(); + this.shouldTransition = false; + this.qRotation = { + from: null, + to: null, + current: create$1() + }; + } + } + function init(options, mcRendererOptions) { + const { container } = options; + const core = new Core({ container }); + getRenderer(mcRendererOptions, core); + listenCanvasEvents(core, options); + core.config.pickSelectDelay = 50; + const cameraTransitioner = new CameraTransitioner(); + const modelTransitioner = new ModelTransitioner(); + const positionTransitioner = new Transitioner(); + positionTransitioner.ended = () => { + core.renderer.axesVisibility = AxesVisibility.current; + }; + const ref2 = { + supportedRenders: { + advanced: rendererEnabled(true), + basic: rendererEnabled(false) + }, + reset: null, + cameraTransitioner, + modelTransitioner, + positionTransitioner, + core, + setMorphChartsRendererOptions(mcRendererOptions2) { + if (shouldChangeRenderer(ref2.lastMorphChartsRendererOptions, mcRendererOptions2)) { + getRenderer(mcRendererOptions2, core); + listenCanvasEvents(core, options); + } else { + if (mcRendererOptions2.advanced) { + setRendererOptions(core.renderer, mcRendererOptions2); + } } - renderer(...args) { - if (args && args.length) { - const renderer = args[0]; - if (renderer === 'morphcharts' && !registered) { - (0, _base.base).vega.renderModule('morphcharts', { - handler: (0, _base.base).vega.CanvasHandler, - renderer: (0, _rendererGl.RendererGl) - }); - registered = true; - } - return super.renderer(renderer); - } else return super.renderer(); + ref2.lastMorphChartsRendererOptions = mcRendererOptions2; + }, + lastMorphChartsRendererOptions: mcRendererOptions, + layerStagger: {} + }; + return ref2; + } + class Presenter { + /** + * Get the previously rendered Stage object. + */ + get stage() { + return this._last.stage; + } + /** + * Get the current View camera type. + */ + get view() { + return this._last.view; + } + /** + * Instantiate a new Presenter. + * @param el Parent HTMLElement to present within. + * @param style Optional PresenterStyle styling options. + */ + constructor(el, style2) { + this.el = el; + this.style = deepMerge(defaultPresenterStyle, style2); + initializePanel(this); + this._last = { view: null, height: null, width: null, cubeCount: null, stage: null }; + } + /** + * Cancels any pending animation, calling animationCanceled() on original queue. + */ + animationCancel() { + if (this.animationTimer) { + clearTimeout(this.animationTimer); + this.animationTimer = null; + if (this.logger) { + this.logger(`canceling animation ${this.queuedAnimationOptions && this.queuedAnimationOptions.handlerLabel || "handler"}`); } - initialize(el) { - if (!this.presenter) this.presenter = new (0, _presenter.Presenter)(el); - super.initialize(this.presenter.getElement((0, _enums.PresenterElement).vegaControls)); - const renderer = this._renderer; - renderer.presenterConfig = this.config.presenterConfig; - renderer.presenter = this.presenter; - renderer.getView = this.config && this.config.getView || (()=>this.presenter.view || (0, _defaults.defaultView)); - return this; + if (this.queuedAnimationOptions && this.queuedAnimationOptions.animationCanceled) { + this.queuedAnimationOptions.animationCanceled.call(null); } - error(e) { - if (this.presenter.logger) this.presenter.logger(e); + } + } + /** + * Stops the current animation and queues a new animation. + * @param handler Function to invoke when timeout is complete. + * @param timeout Length of time to wait before invoking the handler. + * @param options Optional QueuedAnimationOptions object. + */ + animationQueue(handler, timeout2, options) { + if (this.logger) { + this.logger(`queueing animation ${options && options.waitingLabel || "waiting"}...(${timeout2})`); + } + this.animationCancel(); + this.animationTimer = setTimeout(() => { + if (this.logger) { + this.logger(`queueing animation ${options && options.handlerLabel || "handler"}...`); } + handler(); + }, timeout2); + } + /** + * Retrieve a sub-element of the rendered output. + * @param type PresenterElement type of the HTMLElement to retrieve. + */ + getElement(type2) { + const elements = this.el.getElementsByClassName(className(type2, this)); + if (elements && elements.length) { + return elements[0]; + } } - const instance = new ViewGlInternal(runtime, config); + /** + * Present the Vega Scene, or Stage object using Morphcharts. + * @param sceneOrStage Vega Scene object, or Stage object containing chart layout info. + * @param height Height of the rendering area. + * @param width Width of the rendering area. + * @param config Optional presentation configuration object. + */ + present(sceneOrStage, height2, width2, config) { + this.animationCancel(); + const scene = sceneOrStage; + let stage; + const options = { + maxOrdinal: 0, + currAxis: null, + defaultCubeColor: this.style.defaultCubeColor, + assignCubeOrdinal: config && config.onSceneRectAssignCubeOrdinal || (() => options.maxOrdinal++), + modifyAxis: (config === null || config === void 0 ? void 0 : config.onAxisItem) ? config.onAxisItem : defaultOnAxisItem, + zAxisZindex: config === null || config === void 0 ? void 0 : config.zAxisZindex + }; + if (scene.marktype) { + stage = createStage(scene.view); + sceneToStage(options, stage, scene); + } else { + stage = sceneOrStage; + } + const c2 = deepMerge(defaultPresenterConfig, config); + if (!this.morphchartsref) { + this._morphChartsOptions = { + container: this.getElement(PresenterElement.gl), + pickGridCallback: c2.axisPickGridCallback, + onCubeHover: (e, ordinal2) => { + c2.onCubeHover(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCubeClick: (e, ordinal2) => { + c2.onCubeClick(e, { ordinal: ordinal2, color: null, position: null, size: null }); + }, + onCanvasClick: config === null || config === void 0 ? void 0 : config.onLayerClick, + onLasso: config === null || config === void 0 ? void 0 : config.onLasso + }; + this.morphchartsref = init(this._morphChartsOptions, c2.renderer || defaultPresenterConfig.renderer); + } + let cubeCount = Math.max(this._last.cubeCount, stage.cubeData.length); + if (options.maxOrdinal) { + cubeCount = Math.max(cubeCount, options.maxOrdinal); + const empty = { + isEmpty: true + }; + stage.cubeData = patchCubeArray(cubeCount, empty, stage.cubeData); + } + config.preLayer && config.preLayer(stage); + this.morphChartsRenderResult = morphChartsRender(this.morphchartsref, this._last.stage, stage, height2, width2, config && config.preStage, config && config.morphChartsColors, c2); + delete stage.cubeData; + delete stage.redraw; + this._last = { + cubeCount, + height: height2, + width: width2, + stage, + view: stage.view + }; + const a2 = getActiveElementInfo(); + mount(LegendView({ legend: stage.legend, onClick: config && config.onLegendClick }), this.getElement(PresenterElement.legend)); + setActiveElement(a2); + if (config && config.onPresent) { + config.onPresent(); + } + } + canvasToDataURL() { + return new Promise((resolve2, reject) => { + this.morphchartsref.core.afterRenderCallback = () => { + this.morphchartsref.core.afterRenderCallback = null; + const canvas = this.getElement(PresenterElement.gl).getElementsByTagName("canvas")[0]; + const png = canvas.toDataURL("image/png"); + resolve2(png); + }; + }); + } + configColors(mcColors) { + colorConfig(this.morphchartsref, mcColors); + } + /** + * Home the camera to the last initial position. + */ + homeCamera() { + var _a; + (_a = this.morphchartsref) === null || _a === void 0 ? void 0 : _a.reset(); + } + /** + * Show guidelines of rendering height/width and center of OrbitView. + */ + showGuides() { + this.getElement(PresenterElement.gl).classList.add("show-center"); + } + finalize() { + this.animationCancel(); + if (this.morphchartsref) + this.morphchartsref.core.stop(); + if (this.el) + this.el.innerHTML = ""; + this._last = null; + this.morphchartsref = null; + this.el = null; + this.logger = null; + this.queuedAnimationOptions = null; + } + } + function _RendererGl(loader2) { + class RendererGlInternal extends base.vega.Renderer { + initialize(el, width2, height2, origin) { + this.height = height2; + this.width = width2; + return super.initialize(el, width2, height2, origin); + } + resize(width2, height2, origin) { + super.resize(width2, height2, origin); + this.origin = origin; + this.height = height2; + this.width = width2; + return this; + } + _render(scene, items) { + const scene3d = scene; + scene3d.view = this.getView(); + this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); + return this; + } + } + const instance = new RendererGlInternal(loader2); return instance; -} -const ViewGl = _ViewGl; - -},{"../base":"bxBcY","../defaults":"c3DaF","../presenter":"3NoKz","../enums":"dvKuu","./rendererGl":"7K3we","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"7K3we":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "RendererGl", ()=>RendererGl); -var _base = require("../base"); -//pass in the SuperClass, which should be a vega.View -function _RendererGl(loader) { - //dynamic superclass, since we don't know have vega.View in the declaration phase - class RendererGlInternal extends (0, _base.base).vega.Renderer { - initialize(el, width, height, origin) { - this.height = height; - this.width = width; - // this method will invoke resize to size the canvas appropriately - return super.initialize(el, width, height, origin); - } - resize(width, height, origin) { - super.resize(width, height, origin); - this.origin = origin; - this.height = height; - this.width = width; - //rteturn this for vega - return this; - } - _render(scene, items) { - const scene3d = scene; - scene3d.view = this.getView(); - this.presenter.present(scene3d, this.height, this.width, this.presenterConfig); - //return this for vega - return this; - } - } - const instance = new RendererGlInternal(loader); + } + const RendererGl = _RendererGl; + let registered = false; + function _ViewGl(runtime2, config) { + class ViewGlInternal extends base.vega.View { + constructor(runtime3, config2 = {}) { + super(runtime3, config2); + this.config = config2; + this.presenter = config2.presenter; + config2.presenterConfig = config2.presenterConfig || {}; + config2.presenterConfig.redraw = () => { + this._redraw = true; + this.run(); + }; + } + renderer(...args) { + if (args && args.length) { + const renderer = args[0]; + if (renderer === "morphcharts" && !registered) { + base.vega.renderModule("morphcharts", { handler: base.vega.CanvasHandler, renderer: RendererGl }); + registered = true; + } + return super.renderer(renderer); + } else { + return super.renderer(); + } + } + initialize(el) { + if (!this.presenter) { + this.presenter = new Presenter(el); + } + super.initialize(this.presenter.getElement(PresenterElement.vegaControls)); + const renderer = this._renderer; + renderer.presenterConfig = this.config.presenterConfig; + renderer.presenter = this.presenter; + renderer.getView = this.config && this.config.getView || (() => this.presenter.view || defaultView); + return this; + } + error(e) { + if (this.presenter.logger) { + this.presenter.logger(e); + } + } + } + const instance = new ViewGlInternal(runtime2, config); return instance; -} -const RendererGl = _RendererGl; - -},{"../base":"bxBcY","@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}],"fBSq8":[function(require,module,exports,__globalThis) { -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); -parcelHelpers.defineInteropFlag(exports); -parcelHelpers.export(exports, "version", ()=>version); -const version = '1.0.6'; - -},{"@parcel/transformer-js/src/esmodule-helpers.js":"j7FRh"}]},["1dxDQ"], "1dxDQ", "parcelRequirec6f8", {}) - + } + const ViewGl = _ViewGl; + use(vega$1); + class SpecRenderer { + constructor() { + this.viewType = "2d"; + this.spec = null; + this.view = null; + const json2 = localStorage.getItem("spec"); + if (json2) { + this.getTextArea().value = json2; + } + } + toggleView() { + if (this.viewType === "3d") { + this.viewType = "2d"; + } else { + this.viewType = "3d"; + } + this.getText(); + } + getTextArea() { + return document.getElementsByTagName("textarea")[0]; + } + getText() { + const textarea = this.getTextArea(); + const text2 = textarea.value; + const errorDiv = document.getElementById("error"); + const splitRight = document.getElementById("vis"); + try { + const spec = JSON.parse(text2); + splitRight.style.opacity = "1"; + errorDiv.style.display = "none"; + this.update(spec, text2); + } catch (e) { + errorDiv.innerText = e; + errorDiv.style.display = ""; + splitRight.style.opacity = "0.1"; + } + } + update(spec, json2) { + if (this.view != null) ; + const runtime2 = parse(spec); + localStorage.setItem("spec", json2); + this.view = new ViewGl( + runtime2, + { + getView: () => { + return this.viewType; + }, + presenterConfig: { + onTargetViewState: (height2, width2) => { + return { height: height2, width: width2, newViewStateTarget: false }; + } + } + } + ).renderer("morphcharts").initialize(document.querySelector("#vis")); + this.view.run(); + } + } + const specRenderer = new SpecRenderer(); + window["vegaTest"] = { + vega: vega$1, + specRenderer + }; +})); diff --git a/docs/tests/v4/umd/qualBarChartTest.html b/docs/tests/v4/umd/qualBarChartTest.html index fbef9944c..e2dab9476 100644 --- a/docs/tests/v4/umd/qualBarChartTest.html +++ b/docs/tests/v4/umd/qualBarChartTest.html @@ -8,7 +8,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../../../dist/sanddance/v4/sanddance.css" /> <link rel="stylesheet" href="css/test.css" /> - <script src="https://unpkg.com/vega@^5.32/build/vega.js" charset="utf-8"></script> + <script src="https://unpkg.com/vega@^6.2/build/vega.js" charset="utf-8"></script> <script src="../../../dist/sanddance/v4/sanddance.js"></script> </head> diff --git a/docs/tests/v4/umd/quanBarChartTest.html b/docs/tests/v4/umd/quanBarChartTest.html index d7b9742af..92f8c3c5b 100644 --- a/docs/tests/v4/umd/quanBarChartTest.html +++ b/docs/tests/v4/umd/quanBarChartTest.html @@ -8,7 +8,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../../../dist/sanddance/v4/sanddance.css" /> <link rel="stylesheet" href="css/test.css" /> - <script src="https://unpkg.com/vega@^5.32/build/vega.js" charset="utf-8"></script> + <script src="https://unpkg.com/vega@^6.2/build/vega.js" charset="utf-8"></script> <script src="../../../dist/sanddance/v4/sanddance.js"></script> </head> diff --git a/docs/tests/v4/umd/sanddance-react.html b/docs/tests/v4/umd/sanddance-react.html index 4580ff4a7..78bf2d7b9 100644 --- a/docs/tests/v4/umd/sanddance-react.html +++ b/docs/tests/v4/umd/sanddance-react.html @@ -17,7 +17,7 @@ <script src="../../../external/js/react-dom.development.js" crossorigin=""></script> <script src="../../../dist/sanddance/v4/sanddance.js"></script> <script src="../../../dist/sanddance-react/v4/sanddance-react.js"></script> - <script src="https://unpkg.com/vega@^5.32/build/vega.js" charset="utf-8"></script> + <script src="https://unpkg.com/vega@^6.2/build/vega.js" charset="utf-8"></script> <style> .sanddance-ReactViewer { diff --git a/docs/tests/v4/umd/sanddance-specs.html b/docs/tests/v4/umd/sanddance-specs.html index 492578caa..97304ac33 100644 --- a/docs/tests/v4/umd/sanddance-specs.html +++ b/docs/tests/v4/umd/sanddance-specs.html @@ -5,7 +5,7 @@ <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>sanddance-specs demo - + diff --git a/docs/tests/v4/umd/scatterplotTest.html b/docs/tests/v4/umd/scatterplotTest.html index b9813c4ed..287deed1a 100644 --- a/docs/tests/v4/umd/scatterplotTest.html +++ b/docs/tests/v4/umd/scatterplotTest.html @@ -8,7 +8,7 @@ - + diff --git a/docs/tests/v4/umd/test.html b/docs/tests/v4/umd/test.html index 3c30d7028..7da3f5cbd 100644 --- a/docs/tests/v4/umd/test.html +++ b/docs/tests/v4/umd/test.html @@ -8,7 +8,7 @@ - + diff --git a/docs/tests/v4/umd/transforms.html b/docs/tests/v4/umd/transforms.html index 153f507d5..ee052c599 100644 --- a/docs/tests/v4/umd/transforms.html +++ b/docs/tests/v4/umd/transforms.html @@ -8,7 +8,7 @@ - + diff --git a/docs/tests/v4/umd/transition.html b/docs/tests/v4/umd/transition.html index d4be9a2f2..5089f6a0d 100644 --- a/docs/tests/v4/umd/transition.html +++ b/docs/tests/v4/umd/transition.html @@ -10,7 +10,7 @@ - +
diff --git a/docs/tests/v4/umd/treeMapTest.html b/docs/tests/v4/umd/treeMapTest.html index 6c128a6c1..9f9759d69 100644 --- a/docs/tests/v4/umd/treeMapTest.html +++ b/docs/tests/v4/umd/treeMapTest.html @@ -8,7 +8,7 @@ - + diff --git a/docs/tests/v4/umd/vega-morphcharts.test.html b/docs/tests/v4/umd/vega-morphcharts.test.html index a52d284d4..ff17f60a0 100644 --- a/docs/tests/v4/umd/vega-morphcharts.test.html +++ b/docs/tests/v4/umd/vega-morphcharts.test.html @@ -7,7 +7,7 @@ vega-morphcharts test - + diff --git a/extensions/common-frontend/package.json b/extensions/common-frontend/package.json index 042661f15..959db81e0 100644 --- a/extensions/common-frontend/package.json +++ b/extensions/common-frontend/package.json @@ -8,8 +8,7 @@ "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "build-css": "sass ./src/css/app.scss ./dist/app.css", "build-ui": "tsc -p .", - "build:07": "npm run build-css && npm run build-ui", - "remove-vega": "npm un vega" + "build:07": "npm run build-css && npm run build-ui" }, "repository": { "type": "git", diff --git a/package-lock.json b/package-lock.json index ea45ef3b1..c87336f1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,12 +15,11 @@ "@deck.gl/layers": "8.3.7", "@fluentui/react": "^8", "@luma.gl/core": "8.3.1", - "@parcel/transformer-sass": "^2.15.2", "@rollup/plugin-buble": "^1.0.3", - "@rollup/plugin-commonjs": "^28.0.0", + "@rollup/plugin-commonjs": "^29.0.0", "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.3.0", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-node-resolve": "^16.0.3", + "@rollup/plugin-typescript": "^12.3.0", "@types/azdata": "^1.29.0", "@types/d3-color": "^3.1.0", "@types/d3-ease": "^3.0.0", @@ -42,7 +41,7 @@ "eslint-plugin-react": "^7.37.5", "esm": "^3.2.25", "fs-extra": "^7.0.1", - "glob": "^11.1.0", + "glob": "^13.0.0", "inuitcss": "^6.0.0", "is-plain-object": "^5.0.0", "just-compare": "^1.3.0", @@ -51,23 +50,22 @@ "mocha": "^10.1.0", "morphcharts": "^1", "npm-run-all": "^4.1.5", - "parcel": "^2.15.2", "process": "^0.11.10", "react": ">=16.8.0 <18.0.0", "react-dom": ">=16.8.0 <18.0.0", "regenerator-runtime": "^0.13.3", - "rimraf": "^2.6.2", - "rollup": "^4.22.5", - "sass": "^1.32.4", - "streamlit-component-lib": "^2.0.0", + "rimraf": "^6.1.2", + "rollup": "^4.53.3", + "sass": "^1.94.2", "temp-write": "^3.4.0", "ts-loader": "^9.3.1", "tsx-create-element": "^2.2.9", "typescript": "^5.7.2", "unified": "^7.0.2", - "vega": "^5.32.0", + "vega": "^6.2.0", "vega-datasets": "2.8.1", - "vega-typings": "^1.5.0", + "vega-typings": "^2.1.0", + "vite": "^7.2.6", "vscode-test": "^1.3.0", "webpack": "^5.52.0", "webpack-cli": "^4.8.0" @@ -75,8 +73,7 @@ "workspaces": { "packages": [ "extensions/*", - "packages/*", - "streamlit/streamlit_sanddance/frontend" + "packages/*" ], "nohoist": [ "packages/powerbi/**", @@ -111,13 +108,15 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/@azu/format-text/-/format-text-1.0.2.tgz", "integrity": "sha512-Swi4N7Edy1Eqq82GxgEECXSSLyn6GOb5htRFPzBDdUkECGXtlf12ynO5oJSpWKPwCaUssOu7NfhDcCWpIC6Ywg==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/@azu/style-format": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@azu/style-format/-/style-format-1.0.1.tgz", "integrity": "sha512-AHcTojlNBdD/3/KxIKlg8sxIWHfOtQszLvOpagLTO+bjC3u7SAszu1lf//u7JJC50aUSH+BVWDD/KvaA6Gfn5g==", "dev": true, + "license": "WTFPL", "dependencies": { "@azu/format-text": "^1.0.1" } @@ -127,6 +126,7 @@ "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", "integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^2.6.2" }, @@ -135,86 +135,92 @@ } }, "node_modules/@azure/core-auth": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.9.0.tgz", - "integrity": "sha512-FPwHpZywuyasDSLMqJ6fhbOK3TqUdviZNF8OqRGA4W5Ewib2lEEZ+pBsYcBa88B2NGO/SEnYPGhyBqNlE8ilSw==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.10.1.tgz", + "integrity": "sha512-ykRMW8PjVAn+RS6ww5cmK9U2CyH9p4Q88YJwvUslfuMmN98w/2rdGRLPqJYObapBCdzBVeDgYWdJnFPFb7qzpg==", "dev": true, + "license": "MIT", "dependencies": { - "@azure/abort-controller": "^2.0.0", - "@azure/core-util": "^1.11.0", + "@azure/abort-controller": "^2.1.2", + "@azure/core-util": "^1.13.0", "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@azure/core-client": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.9.4.tgz", - "integrity": "sha512-f7IxTD15Qdux30s2qFARH+JxgwxWLG2Rlr4oSkPGuLWm+1p5y1+C04XGLA0vmX6EtqfutmjvpNmAfgwVIS5hpw==", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.10.1.tgz", + "integrity": "sha512-Nh5PhEOeY6PrnxNPsEHRr9eimxLwgLlpmguQaHKBinFYA/RU9+kOYVOQqOrTsCL+KSxrLLl1gD8Dk5BFW/7l/w==", "dev": true, + "license": "MIT", "dependencies": { - "@azure/abort-controller": "^2.0.0", - "@azure/core-auth": "^1.4.0", - "@azure/core-rest-pipeline": "^1.20.0", - "@azure/core-tracing": "^1.0.0", - "@azure/core-util": "^1.6.1", - "@azure/logger": "^1.0.0", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-rest-pipeline": "^1.22.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@azure/core-rest-pipeline": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.21.0.tgz", - "integrity": "sha512-a4MBwe/5WKbq9MIxikzgxLBbruC5qlkFYlBdI7Ev50Y7ib5Vo/Jvt5jnJo7NaWeJ908LCHL0S1Us4UMf1VoTfg==", + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.22.2.tgz", + "integrity": "sha512-MzHym+wOi8CLUlKCQu12de0nwcq9k9Kuv43j4Wa++CsCpJwps2eeBQwD2Bu8snkxTtDKDx4GwjuR9E8yC8LNrg==", "dev": true, + "license": "MIT", "dependencies": { - "@azure/abort-controller": "^2.0.0", - "@azure/core-auth": "^1.8.0", - "@azure/core-tracing": "^1.0.1", - "@azure/core-util": "^1.11.0", - "@azure/logger": "^1.0.0", - "@typespec/ts-http-runtime": "^0.2.3", + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", + "@typespec/ts-http-runtime": "^0.3.0", "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@azure/core-tracing": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.2.0.tgz", - "integrity": "sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.3.1.tgz", + "integrity": "sha512-9MWKevR7Hz8kNzzPLfX4EAtGM2b8mr50HPDBvio96bURP/9C+HjdH3sBlLSNNrvRAr5/k/svoH457gB5IKpmwQ==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@azure/core-util": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.12.0.tgz", - "integrity": "sha512-13IyjTQgABPARvG90+N2dXpC+hwp466XCdQXPCRlbWHgd3SJd5Q1VvaBGv6k1BIa4MQm6hAF1UBU1m8QUxV8sQ==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.13.1.tgz", + "integrity": "sha512-XPArKLzsvl0Hf0CaGyKHUyVgF7oDnhKoP85Xv6M4StF/1AhfORhZudHtOyf2s+FcbuQ9dPRAjB8J2KvRRMUK2A==", "dev": true, + "license": "MIT", "dependencies": { - "@azure/abort-controller": "^2.0.0", - "@typespec/ts-http-runtime": "^0.2.2", + "@azure/abort-controller": "^2.1.2", + "@typespec/ts-http-runtime": "^0.3.0", "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@azure/identity": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.10.1.tgz", - "integrity": "sha512-YM/z6RxRtFlXUH2egAYF/FDPes+MUE6ZoknjEdaq7ebJMMNUzn9zCJ3bd2ZZZlkP0r1xKa88kolhFH/FGV7JnA==", + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.13.0.tgz", + "integrity": "sha512-uWC0fssc+hs1TGGVkkghiaFkkS7NkTxfnCH+Hdg+yTehTpMcehpok4PgUKKdyCH+9ldu6FhiHRv84Ntqj1vVcw==", "dev": true, + "license": "MIT", "dependencies": { "@azure/abort-controller": "^2.0.0", "@azure/core-auth": "^1.9.0", @@ -229,50 +235,54 @@ "tslib": "^2.2.0" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@azure/logger": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.2.0.tgz", - "integrity": "sha512-0hKEzLhpw+ZTAfNJyRrn6s+V0nDWzXk9OjBr2TiGIu0OfMr5s2V4FpKLTAK3Ca5r5OKLbf4hkOGDPyiRjie/jA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.3.0.tgz", + "integrity": "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA==", "dev": true, + "license": "MIT", "dependencies": { - "@typespec/ts-http-runtime": "^0.2.2", + "@typespec/ts-http-runtime": "^0.3.0", "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@azure/msal-browser": { - "version": "4.13.2", - "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.13.2.tgz", - "integrity": "sha512-lS75bF6FYZRwsacKLXc8UYu/jb+gOB7dtZq5938chCvV/zKTFDnzuXxCXhsSUh0p8s/P8ztgbfdueD9lFARQlQ==", + "version": "4.27.0", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-4.27.0.tgz", + "integrity": "sha512-bZ8Pta6YAbdd0o0PEaL1/geBsPrLEnyY/RDWqvF1PP9RUH8EMLvUMGoZFYS6jSlUan6KZ9IMTLCnwpWWpQRK/w==", "dev": true, + "license": "MIT", "dependencies": { - "@azure/msal-common": "15.7.1" + "@azure/msal-common": "15.13.3" }, "engines": { "node": ">=0.8.0" } }, "node_modules/@azure/msal-common": { - "version": "15.7.1", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.7.1.tgz", - "integrity": "sha512-a0eowoYfRfKZEjbiCoA5bPT3IlWRAdGSvi63OU23Hv+X6EI8gbvXCoeqokUceFMoT9NfRUWTJSx5FiuzruqT8g==", + "version": "15.13.3", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-15.13.3.tgz", + "integrity": "sha512-shSDU7Ioecya+Aob5xliW9IGq1Ui8y4EVSdWGyI1Gbm4Vg61WpP95LuzcY214/wEjSn6w4PZYD4/iVldErHayQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8.0" } }, "node_modules/@azure/msal-node": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.6.1.tgz", - "integrity": "sha512-ctcVz4xS+st5KxOlQqgpvA+uDFAa59CvkmumnuhlD2XmNczloKBdCiMQG7/TigSlaeHe01qoOlDjz3TyUAmKUg==", + "version": "3.8.4", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-3.8.4.tgz", + "integrity": "sha512-lvuAwsDpPDE/jSuVQOBMpLbXuVuLsPNRwWCyK3/6bPlBk0fGWegqoZ0qjZclMWyQ2JNvIY3vHY7hoFmFmFQcOw==", "dev": true, + "license": "MIT", "dependencies": { - "@azure/msal-common": "15.7.1", + "@azure/msal-common": "15.13.3", "jsonwebtoken": "^9.0.0", "uuid": "^8.3.0" }, @@ -285,6 +295,7 @@ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", "dev": true, + "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", @@ -295,59 +306,30 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", - "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/runtime": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz", - "integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==", - "dependencies": { - "regenerator-runtime": "^0.14.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/runtime-corejs2": { - "version": "7.26.10", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs2/-/runtime-corejs2-7.26.10.tgz", - "integrity": "sha512-JfoPiD7f/vvd/PaOfu5cr9CyzwDMPg4T0nX3MQr6IgTq49DhjvUcmjmjA7j6+xih1Evq+QKZnge1SoIlYozv/Q==", - "dependencies": { - "core-js": "^2.6.12", - "regenerator-runtime": "^0.14.0" - }, + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", + "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==", + "license": "MIT", "engines": { "node": ">=6.9.0" } }, - "node_modules/@babel/runtime-corejs2/node_modules/core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", - "hasInstallScript": true - }, - "node_modules/@babel/runtime-corejs2/node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" - }, - "node_modules/@babel/runtime/node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" - }, "node_modules/@danmarshall/deckgl-typings": { "version": "4.9.28", "resolved": "https://registry.npmjs.org/@danmarshall/deckgl-typings/-/deckgl-typings-4.9.28.tgz", "integrity": "sha512-cvp0sPunaOgzI/6Kb9zQjNPOegFrli8t/mWLESTDarZT1xBGe9FwLQ9wQT0XFcVagdlhe2NFBx0oeRy0L4f1GQ==", "hasInstallScript": true, + "license": "MIT", "dependencies": { "@types/hammerjs": "^2.0.36", "@types/react": "*", @@ -359,6 +341,7 @@ "resolved": "https://registry.npmjs.org/@deck.gl/core/-/core-8.3.7.tgz", "integrity": "sha512-SfQVk4z9aHxsj/+KZFj838xRgrKmh3x08euRavnaSW25CLEYWLHf5crmxfzEYcyErDz8x9ydkr/T4POloH3eqA==", "dev": true, + "license": "MIT", "dependencies": { "@loaders.gl/core": "^2.3.0", "@loaders.gl/images": "^2.3.0", @@ -375,6 +358,7 @@ "resolved": "https://registry.npmjs.org/@deck.gl/layers/-/layers-8.3.7.tgz", "integrity": "sha512-cwt6PPrGTwy1RgxIh/BF/HDtmWiQwH8cJSPPzGN6UZpoqHNlRp/g05hJpr8FQCjkvUr11GyH2+vA5ndD5KfW2A==", "dev": true, + "license": "MIT", "dependencies": { "@loaders.gl/images": "^2.3.0", "@mapbox/tiny-sdf": "^1.1.0", @@ -391,2337 +375,1338 @@ "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", "integrity": "sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10.0.0" } }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz", - "integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==", + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], "dev": true, - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + "node": ">=18" } }, - "node_modules/@eslint-community/regexpp": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", - "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + "node": ">=18" } }, - "node_modules/@eslint/config-array": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.20.0.tgz", - "integrity": "sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ==", + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@eslint/object-schema": "^2.1.6", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">=18" } }, - "node_modules/@eslint/config-helpers": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.2.2.tgz", - "integrity": "sha512-+GPzk8PlG0sPpzdU5ZvIRMPidzAnZDl/s9L+y13iodqvb8leL53bTannOrQ/Im7UkpsmFU5Ily5U60LWixnmLg==", + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">=18" } }, - "node_modules/@eslint/core": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.14.0.tgz", - "integrity": "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg==", + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.15" - }, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">=18" } }, - "node_modules/@eslint/eslintrc": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.1.tgz", - "integrity": "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ==", + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.0", - "minimatch": "^3.1.2", - "strip-json-comments": "^3.1.1" - }, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">=18" } }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], "engines": { "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@eslint/eslintrc/node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">= 4" + "node": ">=18" } }, - "node_modules/@eslint/js": { - "version": "9.28.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.28.0.tgz", - "integrity": "sha512-fnqSjGWd/CoIp4EXIxWVK/sHA6DOHN4+8Ix2cX5ycOY7LG0UY8nHCU5pIp2eaE1Mc7Qd8kHspYNzYXT2ojPLzg==", + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" + "node": ">=18" } }, - "node_modules/@eslint/object-schema": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.6.tgz", - "integrity": "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA==", + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">=18" } }, - "node_modules/@eslint/plugin-kit": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.3.5.tgz", - "integrity": "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w==", + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.15.2", - "levn": "^0.4.1" - }, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">=18" } }, - "node_modules/@eslint/plugin-kit/node_modules/@eslint/core": { - "version": "0.15.2", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.15.2.tgz", - "integrity": "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg==", + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@fluentui/date-time-utilities": { - "version": "8.6.9", - "resolved": "https://registry.npmjs.org/@fluentui/date-time-utilities/-/date-time-utilities-8.6.9.tgz", - "integrity": "sha512-dgOlVm4nXBWDLqijmvn4iAtyv1hVpQZjN6p0So74BW+7ASUTkQGe3lf8PHV/OjBiXfZa4qwONvmTQBGCheNU0w==", - "dependencies": { - "@fluentui/set-version": "^8.2.23", - "tslib": "^2.1.0" + "node": ">=18" } }, - "node_modules/@fluentui/dom-utilities": { - "version": "2.3.9", - "resolved": "https://registry.npmjs.org/@fluentui/dom-utilities/-/dom-utilities-2.3.9.tgz", - "integrity": "sha512-8PPzv31VXnyMvZrzK7iSGPRx8piJjas0xV+qaNQ1tzAXHuTaLXPeADJK/gEDH1XA/e9Vaakb3lPUpRVa8tal+w==", - "dependencies": { - "@fluentui/set-version": "^8.2.23", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/font-icons-mdl2": { - "version": "8.5.56", - "resolved": "https://registry.npmjs.org/@fluentui/font-icons-mdl2/-/font-icons-mdl2-8.5.56.tgz", - "integrity": "sha512-8U2k68O9kjckXxL3ogYB8zidwslbnc7Xj3RoiGToJNDNkCWRiSBzpKQv2TGVWTY4C3+iDmWW2ars1VK0jpTbEw==", - "dependencies": { - "@fluentui/set-version": "^8.2.23", - "@fluentui/style-utilities": "^8.11.5", - "@fluentui/utilities": "^8.15.19", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/foundation-legacy": { - "version": "8.4.22", - "resolved": "https://registry.npmjs.org/@fluentui/foundation-legacy/-/foundation-legacy-8.4.22.tgz", - "integrity": "sha512-TOoWd0Zoam0fuvsGSPvfXYmo7LgnDaDlIOIaIPUOaoane+XoEyefzWz62+p5iPW3ZA6s/Ho4D6KQBcttpScKJA==", - "dependencies": { - "@fluentui/merge-styles": "^8.6.13", - "@fluentui/set-version": "^8.2.23", - "@fluentui/style-utilities": "^8.11.5", - "@fluentui/utilities": "^8.15.19", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/keyboard-key": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/@fluentui/keyboard-key/-/keyboard-key-0.4.23.tgz", - "integrity": "sha512-9GXeyUqNJUdg5JiQUZeGPiKnRzMRi9YEUn1l9zq6X/imYdMhxHrxpVZS12129cBfgvPyxt9ceJpywSfmLWqlKA==", - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/merge-styles": { - "version": "8.6.13", - "resolved": "https://registry.npmjs.org/@fluentui/merge-styles/-/merge-styles-8.6.13.tgz", - "integrity": "sha512-IWgvi2CC+mcQ7/YlCvRjsmHL2+PUz7q+Pa2Rqk3a+QHN0V1uBvgIbKk5y/Y/awwDXy1yJHiqMCcDHjBNmS1d4A==", - "dependencies": { - "@fluentui/set-version": "^8.2.23", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/react": { - "version": "8.122.1", - "resolved": "https://registry.npmjs.org/@fluentui/react/-/react-8.122.1.tgz", - "integrity": "sha512-mH2TDCiVmj6Zly0iU9GfR824ZM2RIeKjuB0LnAmIWyvtaAVAUfmYtQFF/ZKDJC6jXoF7as8vyVmTxhDt9wQsDw==", - "dependencies": { - "@fluentui/date-time-utilities": "^8.6.9", - "@fluentui/font-icons-mdl2": "^8.5.56", - "@fluentui/foundation-legacy": "^8.4.22", - "@fluentui/merge-styles": "^8.6.13", - "@fluentui/react-focus": "^8.9.19", - "@fluentui/react-hooks": "^8.8.16", - "@fluentui/react-portal-compat-context": "^9.0.13", - "@fluentui/react-window-provider": "^2.2.28", - "@fluentui/set-version": "^8.2.23", - "@fluentui/style-utilities": "^8.11.5", - "@fluentui/theme": "^2.6.63", - "@fluentui/utilities": "^8.15.19", - "@microsoft/load-themed-styles": "^1.10.26", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "@types/react-dom": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0", - "react-dom": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/react-focus": { - "version": "8.9.19", - "resolved": "https://registry.npmjs.org/@fluentui/react-focus/-/react-focus-8.9.19.tgz", - "integrity": "sha512-nTPqsZnBLcFLPxapNNN7VIJ0PfwVLDhWPJHSgXkaRLQFe6NAnPQ85NQepCx5usL2XmsJe0i2WdwJVSWZDDeM3g==", - "dependencies": { - "@fluentui/keyboard-key": "^0.4.23", - "@fluentui/merge-styles": "^8.6.13", - "@fluentui/set-version": "^8.2.23", - "@fluentui/style-utilities": "^8.11.5", - "@fluentui/utilities": "^8.15.19", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/react-hooks": { - "version": "8.8.16", - "resolved": "https://registry.npmjs.org/@fluentui/react-hooks/-/react-hooks-8.8.16.tgz", - "integrity": "sha512-PQ1BeOp+99mdO0g7j6QLtChfXG1LxXeHG0q5CtUeD1OUGR+vUDK84h60sw7e7qU9sSmvPmHO7jn69Lg3CS+DXw==", - "dependencies": { - "@fluentui/react-window-provider": "^2.2.28", - "@fluentui/set-version": "^8.2.23", - "@fluentui/utilities": "^8.15.19", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/react-portal-compat-context": { - "version": "9.0.13", - "resolved": "https://registry.npmjs.org/@fluentui/react-portal-compat-context/-/react-portal-compat-context-9.0.13.tgz", - "integrity": "sha512-N+c6Qs775jnr/4WIzsQuNaRu4v16fa+gGsOCzzU1bqxX0IR9BSjjO2oLGC6luaAOqlQP+JIwn/aumOIJICKXkA==", - "dependencies": { - "@swc/helpers": "^0.5.1" - }, - "peerDependencies": { - "@types/react": ">=16.14.0 <19.0.0", - "react": ">=16.14.0 <19.0.0" - } - }, - "node_modules/@fluentui/react-window-provider": { - "version": "2.2.28", - "resolved": "https://registry.npmjs.org/@fluentui/react-window-provider/-/react-window-provider-2.2.28.tgz", - "integrity": "sha512-YdZ74HTaoDwlvLDzoBST80/17ExIl93tLJpTxnqK5jlJOAUVQ+mxLPF2HQEJq+SZr5IMXHsQ56w/KaZVRn72YA==", - "dependencies": { - "@fluentui/set-version": "^8.2.23", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/set-version": { - "version": "8.2.23", - "resolved": "https://registry.npmjs.org/@fluentui/set-version/-/set-version-8.2.23.tgz", - "integrity": "sha512-VPXaBsiaa3Xn/AY40nLU9bvDQ62lpMVnFzFTlQ8CbpdwrjxNlRxDUY5vRToNzp1+Zu5gD/+CgsXqIZGcry5L5w==", - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/style-utilities": { - "version": "8.11.5", - "resolved": "https://registry.npmjs.org/@fluentui/style-utilities/-/style-utilities-8.11.5.tgz", - "integrity": "sha512-uzauiguDkurPAe5VsVPgRC9+0f8qptvL9NemVeaymJqnf0fYTqA/h/+638eJDySkdRwLzF20Q80xh+dlFOaLAA==", - "dependencies": { - "@fluentui/merge-styles": "^8.6.13", - "@fluentui/set-version": "^8.2.23", - "@fluentui/theme": "^2.6.63", - "@fluentui/utilities": "^8.15.19", - "@microsoft/load-themed-styles": "^1.10.26", - "tslib": "^2.1.0" - } - }, - "node_modules/@fluentui/theme": { - "version": "2.6.63", - "resolved": "https://registry.npmjs.org/@fluentui/theme/-/theme-2.6.63.tgz", - "integrity": "sha512-BZ+YG4Vqb+ulhmZzDv8yZFuYo2kHp1m2cttBZLkc+61FnrwCaDBmJxwg65gXoF7wwXKh2qJIcJueSLMmvVyAOQ==", - "dependencies": { - "@fluentui/merge-styles": "^8.6.13", - "@fluentui/set-version": "^8.2.23", - "@fluentui/utilities": "^8.15.19", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@fluentui/utilities": { - "version": "8.15.19", - "resolved": "https://registry.npmjs.org/@fluentui/utilities/-/utilities-8.15.19.tgz", - "integrity": "sha512-20WoYz0wW7pkmur+7qxTwRfvkdAnHfylLdCYSm91WLupb0cwQ1wWZWIuyo+e0cjcvem1T9TC1+NjWs0kavTWBg==", - "dependencies": { - "@fluentui/dom-utilities": "^2.3.9", - "@fluentui/merge-styles": "^8.6.13", - "@fluentui/react-window-provider": "^2.2.28", - "@fluentui/set-version": "^8.2.23", - "tslib": "^2.1.0" - }, - "peerDependencies": { - "@types/react": ">=16.8.0 <19.0.0", - "react": ">=16.8.0 <19.0.0" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=18.18.0" + "node": ">=18" } }, - "node_modules/@humanfs/node": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz", - "integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==", + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], "dev": true, - "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.3.0" - }, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=18.18.0" + "node": ">=18" } }, - "node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz", - "integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==", + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "node": ">=18" } }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "node": ">=18" } }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", - "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" + "node": ">=18" } }, - "node_modules/@isaacs/balanced-match": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", - "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], "engines": { - "node": "20 || >=22" + "node": ">=18" } }, - "node_modules/@isaacs/brace-expansion": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", - "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", - "dependencies": { - "@isaacs/balanced-match": "^4.0.1" - }, + "optional": true, + "os": [ + "netbsd" + ], "engines": { - "node": "20 || >=22" + "node": ">=18" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], "engines": { - "node": ">=12" + "node": ">=18" } }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "node": ">=18" } }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, + "optional": true, + "os": [ + "openharmony" + ], "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "node": ">=18" } }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", - "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], "engines": { - "node": ">=6.0.0" + "node": ">=18" } }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.0.0" + "node": ">=18" } }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", - "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.6.tgz", - "integrity": "sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.25" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", - "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" + "node": ">=18" } }, - "node_modules/@jsonjoy.com/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jsonjoy.com/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==", + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=10.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/streamich" - }, - "peerDependencies": { - "tslib": "2" + "node": ">=18" } }, - "node_modules/@jsonjoy.com/json-pack": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@jsonjoy.com/json-pack/-/json-pack-1.1.1.tgz", - "integrity": "sha512-osjeBqMJ2lb/j/M8NCPjs1ylqWIcTRTycIhVB5pt6LgzgeRSb0YRZ7j9RfA8wIUrsr/medIuhVyonXRZWLyfdw==", + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", "dev": true, + "license": "MIT", "dependencies": { - "@jsonjoy.com/base64": "^1.1.1", - "@jsonjoy.com/util": "^1.1.2", - "hyperdyperid": "^1.2.0", - "thingies": "^1.20.0" + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": ">=10.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/streamich" + "url": "https://opencollective.com/eslint" }, "peerDependencies": { - "tslib": "2" + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, - "node_modules/@jsonjoy.com/util": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jsonjoy.com/util/-/util-1.5.0.tgz", - "integrity": "sha512-ojoNsrIuPI9g6o8UxhraZQSyF2ByJanAY4cTFbc8Mf2AXEF4aQRGY1dJxyJpuyav8r9FGflEt/Ff3u5Nt6YMPA==", + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", "dev": true, + "license": "MIT", "engines": { - "node": ">=10.0" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/streamich" - }, - "peerDependencies": { - "tslib": "2" + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/@leichtgewicht/ip-codec": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz", - "integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==", - "dev": true - }, - "node_modules/@lezer/common": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", - "integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==", - "dev": true - }, - "node_modules/@lezer/lr": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.2.tgz", - "integrity": "sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==", + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@lezer/common": "^1.0.0" + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@lmdb/lmdb-darwin-arm64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-arm64/-/lmdb-darwin-arm64-2.8.5.tgz", - "integrity": "sha512-KPDeVScZgA1oq0CiPBcOa3kHIqU+pTOwRFDIhxvmf8CTNvqdZQYp5cCKW0bUk69VygB2PuTiINFWbY78aR2pQw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@lmdb/lmdb-darwin-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-darwin-x64/-/lmdb-darwin-x64-2.8.5.tgz", - "integrity": "sha512-w/sLhN4T7MW1nB3R/U8WK5BgQLz904wh+/SmA2jD8NnF7BLLoUgflCNxOeSPOWp8geP6nP/+VjWzZVip7rZ1ug==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm/-/lmdb-linux-arm-2.8.5.tgz", - "integrity": "sha512-c0TGMbm2M55pwTDIfkDLB6BpIsgxV4PjYck2HiOX+cy/JWiBXz32lYbarPqejKs9Flm7YVAKSILUducU9g2RVg==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-arm64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-arm64/-/lmdb-linux-arm64-2.8.5.tgz", - "integrity": "sha512-vtbZRHH5UDlL01TT5jB576Zox3+hdyogvpcbvVJlmU5PdL3c5V7cj1EODdh1CHPksRl+cws/58ugEHi8bcj4Ww==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@lmdb/lmdb-linux-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-linux-x64/-/lmdb-linux-x64-2.8.5.tgz", - "integrity": "sha512-Xkc8IUx9aEhP0zvgeKy7IQ3ReX2N8N1L0WPcQwnZweWmOuKfwpS3GRIYqLtK5za/w3E60zhFfNdS+3pBZPytqQ==", - "cpu": [ - "x64" - ], + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, - "optional": true, - "os": [ - "linux" - ] + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } }, - "node_modules/@lmdb/lmdb-win32-x64": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-2.8.5.tgz", - "integrity": "sha512-4wvrf5BgnR8RpogHhtpCPJMKBmvyZPhhUtEwMJbXh0ni2BucpfF07jlmyM11zRqQ2XIq6PbC2j7W7UCCcm1rRQ==", - "cpu": [ - "x64" - ], + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "optional": true, - "os": [ - "win32" - ] + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } }, - "node_modules/@loaders.gl/core": { - "version": "2.3.13", - "resolved": "https://registry.npmjs.org/@loaders.gl/core/-/core-2.3.13.tgz", - "integrity": "sha512-Hjm8eJjS/OUnaHrOSgXtE+qDg5V4Do0jIpp2u0Dv3CMxPrtd2TpwkDfAyZWmmbZew9rzqPoAVMINejS/ItWUeg==", + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@babel/runtime": "^7.3.1", - "@loaders.gl/loader-utils": "2.3.13" + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@loaders.gl/images": { - "version": "2.3.13", - "resolved": "https://registry.npmjs.org/@loaders.gl/images/-/images-2.3.13.tgz", - "integrity": "sha512-BBgLf17udhRnYwvsObAOM7jEeLBaeU3di1NyLhpTMa7WbG3jAnDlmy1BRue8wYfgVpWnmk18YubZtX6vCRrJnA==", + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@loaders.gl/loader-utils": "2.3.13" + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@loaders.gl/loader-utils": { - "version": "2.3.13", - "resolved": "https://registry.npmjs.org/@loaders.gl/loader-utils/-/loader-utils-2.3.13.tgz", - "integrity": "sha512-vXzH5CWG8pWjUEb7hUr6CM4ERj4NVRpA60OxvVv/OaZZ7hNN63+9/tSUA5IXD9QArWPWrFBnKnvE+5gg4WNqTg==", + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/runtime": "^7.3.1", - "@probe.gl/stats": "^3.3.0" + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/@luma.gl/constants": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@luma.gl/constants/-/constants-8.3.1.tgz", - "integrity": "sha512-3b2RScz7TSwsrHjRx1iYvyn46fKXtR/mOSyFOPiRx+15FOLBdkYL2DPpaJAZ5fU9Rx7ToazJiWW1Mzgn6z2d0A==", - "dev": true - }, - "node_modules/@luma.gl/core": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@luma.gl/core/-/core-8.3.1.tgz", - "integrity": "sha512-QMVxS83HQpVQ8D/74/A20fl1Wz7qLuV5bQuVZhvQ6bkHb8A6gAZMWr4Y2gpWNJTStWJuDkzAL8pB3us1jWCg2Q==", + "node_modules/@eslint/eslintrc/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/runtime": "^7.0.0", - "@luma.gl/constants": "8.3.1", - "@luma.gl/engine": "8.3.1", - "@luma.gl/shadertools": "8.3.1", - "@luma.gl/webgl": "8.3.1" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/@luma.gl/engine": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@luma.gl/engine/-/engine-8.3.1.tgz", - "integrity": "sha512-oE7sNmSihLeMCCrGYx6hv3g1GZAcNUbL8XKAQQNxs7Bo4abGIURuHFEc9mpT90YtEtkQcg2OewykeZT9jD9mIg==", + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/runtime": "^7.0.0", - "@luma.gl/constants": "8.3.1", - "@luma.gl/gltools": "8.3.1", - "@luma.gl/shadertools": "8.3.1", - "@luma.gl/webgl": "8.3.1", - "math.gl": "^3.3.0", - "probe.gl": "^3.2.1" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/@luma.gl/gltools": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@luma.gl/gltools/-/gltools-8.3.1.tgz", - "integrity": "sha512-l/mnVSG5ioW19eZHMJlOD6crR58fwmdLoEKooXhnHiHofZ37h9HNlRlDf0XZIJPe4H4KLUM+Vv9VK0hqRrZHqA==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.0.0", - "@luma.gl/constants": "8.3.1", - "probe.gl": "^3.2.1" - } - }, - "node_modules/@luma.gl/shadertools": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@luma.gl/shadertools/-/shadertools-8.3.1.tgz", - "integrity": "sha512-y9s1R0Uv64QooGKROkNCvPKJd5CJDQ21wxJt5FH/E98F0z4IcJXzKWu1num/XG23eSJyQpIf7qsSqvXDBfm/fA==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.0.0", - "math.gl": "^3.3.0" - } - }, - "node_modules/@luma.gl/webgl": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@luma.gl/webgl/-/webgl-8.3.1.tgz", - "integrity": "sha512-lsGo5Pp/hPlKj1emErRAUvOBxztU/goltBh3hfhg7BoKdlEa6EJcfjqX+YkCmfc8bbp7QePM7mj+1ZsrzKhlgg==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.0.0", - "@luma.gl/constants": "8.3.1", - "@luma.gl/gltools": "8.3.1", - "probe.gl": "^3.2.1" - } - }, - "node_modules/@mapbox/tiny-sdf": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-1.2.5.tgz", - "integrity": "sha512-cD8A/zJlm6fdJOk6DqPUV8mcpyJkRz2x2R+/fYcWDYG3oWbG7/L7Yl/WqQ1VZCjnL9OTIMAn6c+BC5Eru4sQEw==", - "dev": true - }, - "node_modules/@math.gl/core": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/@math.gl/core/-/core-3.6.3.tgz", - "integrity": "sha512-jBABmDkj5uuuE0dTDmwwss7Cup5ZwQ6Qb7h1pgvtkEutTrhkcv8SuItQNXmF45494yIHeoGue08NlyeY6wxq2A==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.12.0", - "@math.gl/types": "3.6.3", - "gl-matrix": "^3.4.0" - } - }, - "node_modules/@math.gl/polygon": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/@math.gl/polygon/-/polygon-3.6.3.tgz", - "integrity": "sha512-FivQ1ZnYcAss1wVifOkHP/ZnlfQy1IL/769uzNtiHxwUbW0kZG3yyOZ9I7fwyzR5Hvqt3ErJKHjSYZr0uVlz5g==", - "dev": true, - "dependencies": { - "@math.gl/core": "3.6.3" - } - }, - "node_modules/@math.gl/types": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/@math.gl/types/-/types-3.6.3.tgz", - "integrity": "sha512-3uWLVXHY3jQxsXCr/UCNPSc2BG0hNUljhmOBt9l+lNFDp7zHgm0cK2Tw4kj2XfkJy4TgwZTBGwRDQgWEbLbdTA==", - "dev": true - }, - "node_modules/@math.gl/web-mercator": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.6.3.tgz", - "integrity": "sha512-UVrkSOs02YLehKaehrxhAejYMurehIHPfFQvPFZmdJHglHOU4V2cCUApTVEwOksvCp161ypEqVp+9H6mGhTTcw==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.12.0", - "gl-matrix": "^3.4.0" - } - }, - "node_modules/@microsoft/load-themed-styles": { - "version": "1.10.295", - "resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.10.295.tgz", - "integrity": "sha512-W+IzEBw8a6LOOfRJM02dTT7BDZijxm+Z7lhtOAz1+y9vQm1Kdz9jlAO+qCEKsfxtUOmKilW8DIRqFw2aUgKeGg==" - }, - "node_modules/@mischnic/json-sourcemap": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@mischnic/json-sourcemap/-/json-sourcemap-0.1.1.tgz", - "integrity": "sha512-iA7+tyVqfrATAIsIRWQG+a7ZLLD0VaOCKV2Wd/v4mqIU3J9c4jx9p7S0nw1XH3gJCKNBOOwACOPYYSUu9pgT+w==", - "dev": true, - "dependencies": { - "@lezer/common": "^1.0.0", - "@lezer/lr": "^1.0.0", - "json5": "^2.2.1" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-arm64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz", - "integrity": "sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-darwin-x64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz", - "integrity": "sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz", - "integrity": "sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-arm64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz", - "integrity": "sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-linux-x64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz", - "integrity": "sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@msgpackr-extract/msgpackr-extract-win32-x64": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz", - "integrity": "sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@msrvida/chart-recommender": { - "resolved": "packages/chart-recommender", - "link": true - }, - "node_modules/@msrvida/chart-types": { - "resolved": "packages/chart-types", - "link": true - }, - "node_modules/@msrvida/data-inference": { - "resolved": "packages/data-inference", - "link": true - }, - "node_modules/@msrvida/fluentui-icons": { - "resolved": "packages/fluentui-icons", - "link": true - }, - "node_modules/@msrvida/fluentui-react-cdn-typings": { - "resolved": "packages/fluentui-react-cdn-typings", - "link": true - }, - "node_modules/@msrvida/sanddance": { - "resolved": "packages/sanddance", - "link": true - }, - "node_modules/@msrvida/sanddance-app": { - "resolved": "packages/sanddance-app", - "link": true - }, - "node_modules/@msrvida/sanddance-embed": { - "resolved": "packages/sanddance-embed", - "link": true - }, - "node_modules/@msrvida/sanddance-explorer": { - "resolved": "packages/sanddance-explorer", - "link": true - }, - "node_modules/@msrvida/sanddance-react": { - "resolved": "packages/sanddance-react", - "link": true - }, - "node_modules/@msrvida/sanddance-specs": { - "resolved": "packages/sanddance-specs", - "link": true - }, - "node_modules/@msrvida/search-expression": { - "resolved": "packages/search-expression", - "link": true - }, - "node_modules/@msrvida/vega-deck.gl": { - "resolved": "packages/vega-deck.gl", - "link": true - }, - "node_modules/@msrvida/vega-morphcharts": { - "resolved": "packages/vega-morphcharts", - "link": true - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@parcel/bundler-default": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/bundler-default/-/bundler-default-2.15.2.tgz", - "integrity": "sha512-k0psV7OZYs1g6jcJweBjINVZaVTcfFr6PuCQr28biZ85qbc70f5pWzCzY963+dF3XO/QwTzDABZsJUiDf5jPfQ==", - "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/graph": "3.5.2", - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/utils": "2.15.2", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/cache": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/cache/-/cache-2.15.2.tgz", - "integrity": "sha512-xYVNKWUHT5hCxo+9nBy9xm7NVfk/jswo+SrU12pXtJm4S5kyK7/PaNkiXxnDu/Hiec2s9BqG/7ny5WBX+i/fAw==", - "dev": true, - "dependencies": { - "@parcel/fs": "2.15.2", - "@parcel/logger": "2.15.2", - "@parcel/utils": "2.15.2", - "lmdb": "2.8.5" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "peerDependencies": { - "@parcel/core": "^2.15.2" - } - }, - "node_modules/@parcel/codeframe": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/codeframe/-/codeframe-2.15.2.tgz", - "integrity": "sha512-uzcHUXBXV+vUqXE7SR6Et60GauPGTWvc381pVzCzc90VQJyWY/xyRRIgcA+4MLi2+lQj+w4Uq9H9qg+hMx/JFg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.2" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/compressor-raw": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/compressor-raw/-/compressor-raw-2.15.2.tgz", - "integrity": "sha512-p+Rr70kX6+bcFPtrrKFdNYnZzdSRSWXi8fvLzZtxissX2ANYS1oFdF6ia37pnzVlHhuYcN6HHMIHbDzJmRvMqA==", - "dev": true, - "dependencies": { - "@parcel/plugin": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/config-default": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/config-default/-/config-default-2.15.2.tgz", - "integrity": "sha512-spJWqNnymehtESYM89d/E7P7WgFJ7PpOwr2Y1k1ItdEzuq87FZvudAs8bccXMHD69IgtEes+B0dUSEiOb8YlMQ==", - "dev": true, - "dependencies": { - "@parcel/bundler-default": "2.15.2", - "@parcel/compressor-raw": "2.15.2", - "@parcel/namer-default": "2.15.2", - "@parcel/optimizer-css": "2.15.2", - "@parcel/optimizer-html": "2.15.2", - "@parcel/optimizer-image": "2.15.2", - "@parcel/optimizer-svg": "2.15.2", - "@parcel/optimizer-swc": "2.15.2", - "@parcel/packager-css": "2.15.2", - "@parcel/packager-html": "2.15.2", - "@parcel/packager-js": "2.15.2", - "@parcel/packager-raw": "2.15.2", - "@parcel/packager-svg": "2.15.2", - "@parcel/packager-wasm": "2.15.2", - "@parcel/reporter-dev-server": "2.15.2", - "@parcel/resolver-default": "2.15.2", - "@parcel/runtime-browser-hmr": "2.15.2", - "@parcel/runtime-js": "2.15.2", - "@parcel/runtime-rsc": "2.15.2", - "@parcel/runtime-service-worker": "2.15.2", - "@parcel/transformer-babel": "2.15.2", - "@parcel/transformer-css": "2.15.2", - "@parcel/transformer-html": "2.15.2", - "@parcel/transformer-image": "2.15.2", - "@parcel/transformer-js": "2.15.2", - "@parcel/transformer-json": "2.15.2", - "@parcel/transformer-node": "2.15.2", - "@parcel/transformer-postcss": "2.15.2", - "@parcel/transformer-posthtml": "2.15.2", - "@parcel/transformer-raw": "2.15.2", - "@parcel/transformer-react-refresh-wrap": "2.15.2", - "@parcel/transformer-svg": "2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "peerDependencies": { - "@parcel/core": "^2.15.2" - } - }, - "node_modules/@parcel/core": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/core/-/core-2.15.2.tgz", - "integrity": "sha512-yIFtxeLPLbTkpNuXGmnBX1U51unxv+gRoH/I5IcyD/vRL2Kp/cQU6YJWTSGK5sWG1Fgo+1Z2DeYp914Yd4a1WQ==", - "dev": true, - "dependencies": { - "@mischnic/json-sourcemap": "^0.1.1", - "@parcel/cache": "2.15.2", - "@parcel/diagnostic": "2.15.2", - "@parcel/events": "2.15.2", - "@parcel/feature-flags": "2.15.2", - "@parcel/fs": "2.15.2", - "@parcel/graph": "3.5.2", - "@parcel/logger": "2.15.2", - "@parcel/package-manager": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/profiler": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/types": "2.15.2", - "@parcel/utils": "2.15.2", - "@parcel/workers": "2.15.2", - "base-x": "^3.0.11", - "browserslist": "^4.24.5", - "clone": "^2.1.2", - "dotenv": "^16.5.0", - "dotenv-expand": "^11.0.7", - "json5": "^2.2.3", - "msgpackr": "^1.11.2", - "nullthrows": "^1.1.1", - "semver": "^7.7.1" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/diagnostic": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/diagnostic/-/diagnostic-2.15.2.tgz", - "integrity": "sha512-lsIF59BgfLzN3SP5VM42pa9lilcotEoF42H2RgnqLe3KACcNcbbtvjyjlvac+iaSRix4gEkuZa6376X6p7DkFQ==", - "dev": true, - "dependencies": { - "@mischnic/json-sourcemap": "^0.1.1", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/error-overlay": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/error-overlay/-/error-overlay-2.15.2.tgz", - "integrity": "sha512-bfDWkTQ4jCBUdOSynXo49pCPrVgtYSwobSxMeNhmwpdKbFvavj/09eZkAHikQgcrCF8gBwapik/U2YBTnFt0fg==", - "dev": true, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/events": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/events/-/events-2.15.2.tgz", - "integrity": "sha512-CxXVuYz/K3sDIquM+3Pemxhppb8Q/mRayxqxZtXHoKbhiLBeyX+pLz2v9Hr0R7fiN6naV00IG48Zc5aArHXR4w==", - "dev": true, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/feature-flags": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/feature-flags/-/feature-flags-2.15.2.tgz", - "integrity": "sha512-6oiuLd3ypk4GY8X9/l/GrngzSddHW8yF8DrYA++TkaPDtTz4llanza/p7RIk/ltdV3hmBxnH4vjWtciJEcbQww==", + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">= 4" } }, - "node_modules/@parcel/fs": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/fs/-/fs-2.15.2.tgz", - "integrity": "sha512-/Xe+eFbxH43vBCZD+L0nkyIKo8i/nYQpRqzum4YTEoG8WHdcwNl12L9dOcM6EwpaCf6amNVjzBQJMwQ+6E1Y4A==", + "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "dependencies": { - "@parcel/feature-flags": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/types-internal": "2.15.2", - "@parcel/utils": "2.15.2", - "@parcel/watcher": "^2.0.7", - "@parcel/workers": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "peerDependencies": { - "@parcel/core": "^2.15.2" - } + "license": "MIT" }, - "node_modules/@parcel/graph": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/@parcel/graph/-/graph-3.5.2.tgz", - "integrity": "sha512-SsKKRPotNALU5R5r5WOsP+6FsuaNkk9L0Bmu1UzeyyrHiQPO1OVBYCsX+NtsGDAdDX7oOkGqgfkavJHrAG/BFA==", + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { - "@parcel/feature-flags": "2.15.2", - "nullthrows": "^1.1.1" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "*" } }, - "node_modules/@parcel/logger": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/logger/-/logger-2.15.2.tgz", - "integrity": "sha512-naF3dXcvO1lZvtCi6kCTaXhB1cqRwWkRifQRfEei+yp0QZqZF9dmWwZzMOefst/PTl3RaW014vrwFtiegdqsbQ==", + "node_modules/@eslint/js": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", + "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/events": "2.15.2" - }, + "license": "MIT", "engines": { - "node": ">= 16.0.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "url": "https://eslint.org/donate" } }, - "node_modules/@parcel/markdown-ansi": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/markdown-ansi/-/markdown-ansi-2.15.2.tgz", - "integrity": "sha512-qioxe3Gw/khhrZXeF3tmJeChoq70prxGqVhJylsnGimxHbxjLo3i8Jo8Thi36GiGcOTYSeyF/2tMo9BW2t2vqA==", + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", "dev": true, - "dependencies": { - "chalk": "^4.1.2" - }, + "license": "Apache-2.0", "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@parcel/namer-default": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/namer-default/-/namer-default-2.15.2.tgz", - "integrity": "sha512-2JtJjqKlJEv34OsZdyfAiRtTwNB/ulsStokCSB/fNCkfJPMtgWHDLFz17O7evJbWIoS1gQbIsmeS5GiMBfWdFw==", + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "nullthrows": "^1.1.1" + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" }, "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, - "node_modules/@parcel/node-resolver-core": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/@parcel/node-resolver-core/-/node-resolver-core-3.6.2.tgz", - "integrity": "sha512-MOWpFAuKnVMSZSoXZ9OG1Z7BNSW9IVnDA3DM3c8UYrSR8My7Wng0aen0MyjC3s98N1FEwCodESGfu0+7PpZOIA==", - "dev": true, + "node_modules/@fluentui/date-time-utilities": { + "version": "8.6.11", + "resolved": "https://registry.npmjs.org/@fluentui/date-time-utilities/-/date-time-utilities-8.6.11.tgz", + "integrity": "sha512-zq49tveFzmzwgaJ73rVvxu9+rqhPBIAJSbevciIQnmvv6dlh2GzZcL14Zevk9QV+q6CWaF6yzvhT11E2TpAv8Q==", + "license": "MIT", "dependencies": { - "@mischnic/json-sourcemap": "^0.1.1", - "@parcel/diagnostic": "2.15.2", - "@parcel/fs": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/utils": "2.15.2", - "nullthrows": "^1.1.1", - "semver": "^7.7.1" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@fluentui/set-version": "^8.2.24", + "tslib": "^2.1.0" } }, - "node_modules/@parcel/optimizer-css": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-css/-/optimizer-css-2.15.2.tgz", - "integrity": "sha512-czLiJPe2T2QXuGO3xBIM1a1OnR/UhTwY1efCZzo7CofzklNRu33CDLZuWC2Re/JK1+dO4fYBOs0rdWmGFB5acg==", - "dev": true, + "node_modules/@fluentui/dom-utilities": { + "version": "2.3.10", + "resolved": "https://registry.npmjs.org/@fluentui/dom-utilities/-/dom-utilities-2.3.10.tgz", + "integrity": "sha512-6WDImiLqTOpkEtfUKSStcTDpzmJfL6ZammomcjawN9xH/8u8G3Hx72CIt2MNck9giw/oUlNLJFdWRAjeP3rmPQ==", + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/utils": "2.15.2", - "browserslist": "^4.24.5", - "lightningcss": "^1.30.1", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@fluentui/set-version": "^8.2.24", + "tslib": "^2.1.0" } }, - "node_modules/@parcel/optimizer-html": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-html/-/optimizer-html-2.15.2.tgz", - "integrity": "sha512-7jcvytsOfvdpXIehkZDD9nYzF5V8Dk6JULffDPA03deB8aiFhvPPXr2gr5h3hc/ZvO220dfAJ63Ie622y0BNrQ==", - "dev": true, + "node_modules/@fluentui/font-icons-mdl2": { + "version": "8.5.69", + "resolved": "https://registry.npmjs.org/@fluentui/font-icons-mdl2/-/font-icons-mdl2-8.5.69.tgz", + "integrity": "sha512-6pGvM9cvPFYbE3DkSTRegDPdyR0/+lkaSiac+oIXmStYpQ+qVBG2RHe11RFhkZVS2q7KkU3aOryNnXHoSSbydQ==", + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/utils": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@fluentui/set-version": "^8.2.24", + "@fluentui/style-utilities": "^8.13.5", + "@fluentui/utilities": "^8.17.1", + "tslib": "^2.1.0" } }, - "node_modules/@parcel/optimizer-image": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-image/-/optimizer-image-2.15.2.tgz", - "integrity": "sha512-KCm70vpyIPO9Ml1ZDp2zg8ghPFUDqZ5zu1ZwLwm3SpP/rZYIb6Y/hPTVz/D17yJp6m4bBUVPNLI6Nl2Li4rktg==", - "dev": true, + "node_modules/@fluentui/foundation-legacy": { + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/@fluentui/foundation-legacy/-/foundation-legacy-8.6.2.tgz", + "integrity": "sha512-HrAk2w/yOKQ4uSqYM4wu497uPxjyneVLqEeb2qWPwEBHHzhpHClfiCc4MKxArLdmknoq8gu0PeiXLsajz6TsYw==", + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/utils": "2.15.2", - "@parcel/workers": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@fluentui/merge-styles": "^8.6.14", + "@fluentui/set-version": "^8.2.24", + "@fluentui/style-utilities": "^8.13.5", + "@fluentui/utilities": "^8.17.1", + "tslib": "^2.1.0" }, "peerDependencies": { - "@parcel/core": "^2.15.2" + "@types/react": ">=16.8.0 <20.0.0", + "react": ">=16.8.0 <20.0.0" } }, - "node_modules/@parcel/optimizer-svg": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-svg/-/optimizer-svg-2.15.2.tgz", - "integrity": "sha512-qyOt5BliHB1Dvi8c9h/95qzC80+7gw3ygMRM+avzuhESLlsGimktBBMHi+L6S1TQFjcHsorCkpcTfu48Vx6hUw==", - "dev": true, + "node_modules/@fluentui/keyboard-key": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/@fluentui/keyboard-key/-/keyboard-key-0.4.23.tgz", + "integrity": "sha512-9GXeyUqNJUdg5JiQUZeGPiKnRzMRi9YEUn1l9zq6X/imYdMhxHrxpVZS12129cBfgvPyxt9ceJpywSfmLWqlKA==", + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/utils": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "tslib": "^2.1.0" } }, - "node_modules/@parcel/optimizer-swc": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/optimizer-swc/-/optimizer-swc-2.15.2.tgz", - "integrity": "sha512-Ej8Y0VkNRUl7jyX4Xd9C8vTHqHfPXH3kAaEndrc7K1ZfvGeIzw/7OytFJeyJ/KbEIW7XWWtd2r7KaFiEG/8SJA==", - "dev": true, + "node_modules/@fluentui/merge-styles": { + "version": "8.6.14", + "resolved": "https://registry.npmjs.org/@fluentui/merge-styles/-/merge-styles-8.6.14.tgz", + "integrity": "sha512-vghuHFAfQgS9WLIIs4kgDOCh/DHd5vGIddP4/bzposhlAVLZR6wUBqldm9AuCdY88r5LyCRMavVJLV+Up3xdvA==", + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/utils": "2.15.2", - "@swc/core": "^1.11.24", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@fluentui/set-version": "^8.2.24", + "tslib": "^2.1.0" } }, - "node_modules/@parcel/package-manager": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/package-manager/-/package-manager-2.15.2.tgz", - "integrity": "sha512-0n8QupNyXp9CJZV6LohBpAqopLecQrave4kHG/T9CeCeqlJcQnYs+N+zio4mPlv7jXpnJHy+CF96Ce2wy/n1+Q==", - "dev": true, + "node_modules/@fluentui/react": { + "version": "8.125.2", + "resolved": "https://registry.npmjs.org/@fluentui/react/-/react-8.125.2.tgz", + "integrity": "sha512-r/sm0jcvLCMRatoDaM/W65WDnUnqsUQxj2DNIwARXgQPkqM/oNuyLN4HAXnoj/9CvxUuQ/DLZ8EWkeMk0A0VMQ==", + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/fs": "2.15.2", - "@parcel/logger": "2.15.2", - "@parcel/node-resolver-core": "3.6.2", - "@parcel/types": "2.15.2", - "@parcel/utils": "2.15.2", - "@parcel/workers": "2.15.2", - "@swc/core": "^1.11.24", - "semver": "^7.7.1" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@fluentui/date-time-utilities": "^8.6.11", + "@fluentui/font-icons-mdl2": "^8.5.69", + "@fluentui/foundation-legacy": "^8.6.2", + "@fluentui/merge-styles": "^8.6.14", + "@fluentui/react-focus": "^8.10.2", + "@fluentui/react-hooks": "^8.10.1", + "@fluentui/react-portal-compat-context": "^9.0.15", + "@fluentui/react-window-provider": "^2.3.1", + "@fluentui/set-version": "^8.2.24", + "@fluentui/style-utilities": "^8.13.5", + "@fluentui/theme": "^2.7.1", + "@fluentui/utilities": "^8.17.1", + "@microsoft/load-themed-styles": "^1.10.26", + "tslib": "^2.1.0" }, "peerDependencies": { - "@parcel/core": "^2.15.2" + "@types/react": ">=16.8.0 <20.0.0", + "@types/react-dom": ">=16.8.0 <20.0.0", + "react": ">=16.8.0 <20.0.0", + "react-dom": ">=16.8.0 <20.0.0" } }, - "node_modules/@parcel/packager-css": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-css/-/packager-css-2.15.2.tgz", - "integrity": "sha512-LZrFXC8bj7isdfKZIPS8OhFUWgZNmGXZJVfl7KLUD4D8GfNX0yKxBb4wtdfuQjlr1KMyw0WluchTXads4oVcMg==", - "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/utils": "2.15.2", - "lightningcss": "^1.30.1", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/packager-html": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-html/-/packager-html-2.15.2.tgz", - "integrity": "sha512-+uvMAZW3r2h1IS+UD3QfCmcFwJb3pPPyQOGK/ks5pYcY0Bqxfvco+5vAbMBofZ6b6RS9YCUvBtJbe1FFx4A3Jw==", - "dev": true, + "node_modules/@fluentui/react-focus": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/@fluentui/react-focus/-/react-focus-8.10.2.tgz", + "integrity": "sha512-RZ/NQ02eoxwztj7LuDBalIxRURNzD8Ym0VOiZHiVdx6Xe0Sot+/vM00jbBsqczULcxe9CSUUth31GR4KiM1soQ==", + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/types": "2.15.2", - "@parcel/utils": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" + "@fluentui/keyboard-key": "^0.4.23", + "@fluentui/merge-styles": "^8.6.14", + "@fluentui/set-version": "^8.2.24", + "@fluentui/style-utilities": "^8.13.5", + "@fluentui/utilities": "^8.17.1", + "tslib": "^2.1.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "peerDependencies": { + "@types/react": ">=16.8.0 <20.0.0", + "react": ">=16.8.0 <20.0.0" } }, - "node_modules/@parcel/packager-js": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-js/-/packager-js-2.15.2.tgz", - "integrity": "sha512-kEXuKduZH/ynxm5zOUZSp6kV+/eyKbHn+zILXfFB7VeHuNyATfm8GTcSUhLYFHAoOncXorE51KI6KDMuKPejjA==", - "dev": true, + "node_modules/@fluentui/react-hooks": { + "version": "8.10.1", + "resolved": "https://registry.npmjs.org/@fluentui/react-hooks/-/react-hooks-8.10.1.tgz", + "integrity": "sha512-WbssJvJ0h7wDXoppkipdMXz9PGIH3DO27c11faCM1wiIcuxS6mDSXbAFSunHHWnB7ep47sbsG/QlUkRg6YxfSw==", + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/types": "2.15.2", - "@parcel/utils": "2.15.2", - "globals": "^13.24.0", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" + "@fluentui/react-window-provider": "^2.3.1", + "@fluentui/set-version": "^8.2.24", + "@fluentui/utilities": "^8.17.1", + "tslib": "^2.1.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "peerDependencies": { + "@types/react": ">=16.8.0 <20.0.0", + "react": ">=16.8.0 <20.0.0" } }, - "node_modules/@parcel/packager-raw": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-raw/-/packager-raw-2.15.2.tgz", - "integrity": "sha512-S4Gve8k9+qUj2c3wmbNmMQNqwsJ6E6o7ww/Z3CZ1M1i6UcegRVnK1usElw+6+j2L1sXdt/6pIUZvCg3DA9j3sA==", - "dev": true, + "node_modules/@fluentui/react-portal-compat-context": { + "version": "9.0.15", + "resolved": "https://registry.npmjs.org/@fluentui/react-portal-compat-context/-/react-portal-compat-context-9.0.15.tgz", + "integrity": "sha512-DpV+qtFvM3dmH1j8ZD+YcM5vaTvmQPHUAx6tQnnmIoYJWs2R0wU/L5p2EajXy7zSg74jrDbDRxzaziamoOaJdg==", + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" + "@swc/helpers": "^0.5.1" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "peerDependencies": { + "@types/react": ">=16.14.0 <20.0.0", + "react": ">=16.14.0 <20.0.0" } }, - "node_modules/@parcel/packager-svg": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-svg/-/packager-svg-2.15.2.tgz", - "integrity": "sha512-oTdoPl1mcJ0JeKPz5/ZZFlM+UM9YNsutRm8l6H2k6dcht2mbOt8e0OZQcRIiHmTcY8eEsF3bXmo/qXWB+PcihA==", - "dev": true, + "node_modules/@fluentui/react-window-provider": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@fluentui/react-window-provider/-/react-window-provider-2.3.1.tgz", + "integrity": "sha512-yzKYYnPEimNXU2YvgY/aCru997DnD6O4fg+NXVwtxHaOq/hSaAlSugs4elVzlwbYOBbdEcELL5Rx1bUhRMvq9Q==", + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/types": "2.15.2", - "@parcel/utils": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" + "@fluentui/set-version": "^8.2.24", + "tslib": "^2.1.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "peerDependencies": { + "@types/react": ">=16.8.0 <20.0.0", + "react": ">=16.8.0 <20.0.0" } }, - "node_modules/@parcel/packager-wasm": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/packager-wasm/-/packager-wasm-2.15.2.tgz", - "integrity": "sha512-LqDdXeC/cbjGc4qZjOJvpx4PmuQL0+kQVmO3AvnUIee+C2T2LgdTG7qhzJGJcihdvkvxZjKZI9fQgrjy9EFDuA==", - "dev": true, + "node_modules/@fluentui/set-version": { + "version": "8.2.24", + "resolved": "https://registry.npmjs.org/@fluentui/set-version/-/set-version-8.2.24.tgz", + "integrity": "sha512-8uNi2ThvNgF+6d3q2luFVVdk/wZV0AbRfJ85kkvf2+oSRY+f6QVK0w13vMorNhA5puumKcZniZoAfUF02w7NSg==", + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2" - }, - "engines": { - "node": ">=16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "tslib": "^2.1.0" } }, - "node_modules/@parcel/plugin": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/plugin/-/plugin-2.15.2.tgz", - "integrity": "sha512-5ii1OpD/lGdpvy5AS1jChpCwEZP0eFaucy8szOjmfl4oZIeaHRHbZ5R0/3O1Hy8tY1IJF87HUKd+XV0iyD48zA==", - "dev": true, + "node_modules/@fluentui/style-utilities": { + "version": "8.13.5", + "resolved": "https://registry.npmjs.org/@fluentui/style-utilities/-/style-utilities-8.13.5.tgz", + "integrity": "sha512-ozHe9iI7bYvuHMN4O4qvcuBjDslTdjedgBS08ljRYI/f+ijk5nvzVyOnX1dxlOv/9N7PBPI+3uUyvvzjqU7XXA==", + "license": "MIT", "dependencies": { - "@parcel/types": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@fluentui/merge-styles": "^8.6.14", + "@fluentui/set-version": "^8.2.24", + "@fluentui/theme": "^2.7.1", + "@fluentui/utilities": "^8.17.1", + "@microsoft/load-themed-styles": "^1.10.26", + "tslib": "^2.1.0" } }, - "node_modules/@parcel/profiler": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/profiler/-/profiler-2.15.2.tgz", - "integrity": "sha512-hLTI6TIRr/tGgjTbsCqW4Avl2x8FMAHLDlDhNYjivX6ccfZmilEJnIcdKr2QtdgcaSulfRLTd5bt6uJWJ2ecKg==", - "dev": true, + "node_modules/@fluentui/theme": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/@fluentui/theme/-/theme-2.7.1.tgz", + "integrity": "sha512-r3DONB0UtrfHx8qGaKdPT/kUOGUx3Rdfj5DNa7CuUbzKuHaI8LDd7MkmG2FBzL2iA0m3hdQ6j9bfn4Ya64wwNw==", + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/events": "2.15.2", - "@parcel/types-internal": "2.15.2", - "chrome-trace-event": "^1.0.2" - }, - "engines": { - "node": ">= 16.0.0" + "@fluentui/merge-styles": "^8.6.14", + "@fluentui/set-version": "^8.2.24", + "@fluentui/utilities": "^8.17.1", + "tslib": "^2.1.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "peerDependencies": { + "@types/react": ">=16.8.0 <20.0.0", + "react": ">=16.8.0 <20.0.0" } }, - "node_modules/@parcel/reporter-cli": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-cli/-/reporter-cli-2.15.2.tgz", - "integrity": "sha512-R2WuHr+0FafsR9WNibR8ssyX8bHwXzMA91OdmeLMaAG5Dc/xv6yTIZuvOCdlCAfbBkcRiMnLWTQ3hQI1bqkC4g==", - "dev": true, + "node_modules/@fluentui/utilities": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@fluentui/utilities/-/utilities-8.17.1.tgz", + "integrity": "sha512-foFe3QPDY+qaVX2kqJT6f4oWfGF0Hc4VOedr1e+j0RnMm4YL1DEeQwVl0tAqkbu0VZlcVNnjINjb77ATRprA8g==", + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/types": "2.15.2", - "@parcel/utils": "2.15.2", - "chalk": "^4.1.2", - "term-size": "^2.2.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" + "@fluentui/dom-utilities": "^2.3.10", + "@fluentui/merge-styles": "^8.6.14", + "@fluentui/react-window-provider": "^2.3.1", + "@fluentui/set-version": "^8.2.24", + "tslib": "^2.1.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "peerDependencies": { + "@types/react": ">=16.8.0 <20.0.0", + "react": ">=16.8.0 <20.0.0" } }, - "node_modules/@parcel/reporter-dev-server": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-dev-server/-/reporter-dev-server-2.15.2.tgz", - "integrity": "sha512-xJzb+IfcZfD2Ml4GYhHFovQ4vbWpFP/bd9cM9TuzyfCbaaf0NEN18uY3kRFCUDYOWs7aLOMzqL3eI5Hw6zh+Pw==", + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", "dev": true, - "dependencies": { - "@parcel/codeframe": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/utils": "2.15.2" - }, + "license": "Apache-2.0", "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=18.18.0" } }, - "node_modules/@parcel/reporter-tracer": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/reporter-tracer/-/reporter-tracer-2.15.2.tgz", - "integrity": "sha512-jtmNPMXVuuqO4WmIgYifAtKhMWblAZmRnqc5dVZfUBWPeqGKrbH2k89cYtZfvMbLon8/Glv6WDOt91oyDfjuKg==", + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/utils": "2.15.2", - "chrome-trace-event": "^1.0.3", - "nullthrows": "^1.1.1" + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" }, "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=18.18.0" } }, - "node_modules/@parcel/resolver-default": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/resolver-default/-/resolver-default-2.15.2.tgz", - "integrity": "sha512-CuCCPEu3jwyLplbLDrahq0CstmIHchKefmX0JGpqCJBJBVdO89SHV5hUr8Se7hfy8uamD41wW10d51oAmyjXMA==", + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, - "dependencies": { - "@parcel/node-resolver-core": "3.6.2", - "@parcel/plugin": "2.15.2" - }, + "license": "Apache-2.0", "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" + "node": ">=12.22" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@parcel/runtime-browser-hmr": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-browser-hmr/-/runtime-browser-hmr-2.15.2.tgz", - "integrity": "sha512-4QtuKAT3NphDrGpRVXyGOrG/gR6cjLIqPkqamTEuAVc13bmjK9XJ5Q4l1L3kjIIlQrRPg9MlHJcZ7VR3PuWWRQ==", + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, - "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/utils": "2.15.2" - }, + "license": "Apache-2.0", "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" + "node": ">=18.18" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@parcel/runtime-js": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-js/-/runtime-js-2.15.2.tgz", - "integrity": "sha512-5GGL/7rH6N54u7lAjX8mJKsumFiCyUcpz9wbygG4gkzMcRmGRnp+tctKI9f0GPfcMfKhdypOHfduc5SAuMX03w==", + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/utils": "2.15.2", - "nullthrows": "^1.1.1" - }, + "license": "MIT", "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "20 || >=22" } }, - "node_modules/@parcel/runtime-rsc": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-rsc/-/runtime-rsc-2.15.2.tgz", - "integrity": "sha512-k0cYvrPUXpvV+neplTkJ1P/LkJzQmtF4eU3js+/kzyOU3zhUSgrLNHJmj6ibuWVYHENW2QtasvpsXjvE2knqTg==", + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/utils": "2.15.2", - "nullthrows": "^1.1.1" + "@isaacs/balanced-match": "^4.0.1" }, "engines": { - "node": ">= 12.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": "20 || >=22" } }, - "node_modules/@parcel/runtime-service-worker": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/runtime-service-worker/-/runtime-service-worker-2.15.2.tgz", - "integrity": "sha512-5+nV46pqa+7xFscLr4NRSeyXR8i+PSOoECRUzrv4UJRVbeCeE4bfqMYXs+rMbSrBillOLZyydNUQUT56xo9W6A==", + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "license": "ISC", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/utils": "2.15.2", - "nullthrows": "^1.1.1" + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" }, "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=12" } }, - "node_modules/@parcel/rust": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust/-/rust-2.15.2.tgz", - "integrity": "sha512-6ZIVsSnkwxvDDVaxiYK4bWtVaJBYaFQuRvcxfCMQHEzFpWl9mdZVbCs3+g69Ere7a3e2sk87B41d/FIhoaz5xw==", + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 16.0.0" + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "@parcel/rust-darwin-arm64": "2.15.2", - "@parcel/rust-darwin-x64": "2.15.2", - "@parcel/rust-linux-arm-gnueabihf": "2.15.2", - "@parcel/rust-linux-arm64-gnu": "2.15.2", - "@parcel/rust-linux-arm64-musl": "2.15.2", - "@parcel/rust-linux-x64-gnu": "2.15.2", - "@parcel/rust-linux-x64-musl": "2.15.2", - "@parcel/rust-win32-x64-msvc": "2.15.2" - }, - "peerDependencies": { - "napi-wasm": "^1.1.2" - }, - "peerDependenciesMeta": { - "napi-wasm": { - "optional": true - } + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/@parcel/rust-darwin-arm64": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-darwin-arm64/-/rust-darwin-arm64-2.15.2.tgz", - "integrity": "sha512-IK5mo/7bNym1ODMWD92D2URGcAq2K/9BasRlfjWI/Gh74l3lH4EFadUfgM88L+MVCV3WTg8ht5ZA0Iyp+IQ1JQ==", - "cpu": [ - "arm64" - ], + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } + "license": "MIT" }, - "node_modules/@parcel/rust-darwin-x64": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-darwin-x64/-/rust-darwin-x64-2.15.2.tgz", - "integrity": "sha512-J30ukJXCzXsYNlYvYsaPEAEzfCZGXVIkXtPSVpWPwcaReqFUyT2bm4I8DHoeas0JwMNaeNlJhksaJA/iomqlwA==", - "cpu": [ - "x64" - ], + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, "engines": { - "node": ">= 10" + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@parcel/rust-linux-arm-gnueabihf": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-linux-arm-gnueabihf/-/rust-linux-arm-gnueabihf-2.15.2.tgz", - "integrity": "sha512-WpPddkviw8IkRRnT/dRyD3Uzvy6Yuoy5vvtDmpnrR2bJnEz5uQI3TlhMtQo7R+j6aIrDsGFJKBeo9Z0ga0ebNQ==", - "cpu": [ - "arm" - ], + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, "engines": { - "node": ">= 10" + "node": ">=12" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/@parcel/rust-linux-arm64-gnu": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-linux-arm64-gnu/-/rust-linux-arm64-gnu-2.15.2.tgz", - "integrity": "sha512-RzD7Gw0QqyUoWaVrtCU+v5J5pg6bybVNknqlEY4jfcJDgJHsM1V91DwJwxnI4ikG/uMedl0I40dl59x/Vo01Ow==", - "cpu": [ - "arm64" - ], + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" } }, - "node_modules/@parcel/rust-linux-arm64-musl": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-linux-arm64-musl/-/rust-linux-arm64-musl-2.15.2.tgz", - "integrity": "sha512-mWoL7kCITrEOO0GQ+LqGUylX+6b3nsV60Lzrz2N0Pgzz3EbGS0d4gDKkjxpi6BoR+h4KL7nLhj4hhbm0OHIc4A==", - "cpu": [ - "arm64" - ], + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">= 10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=6.0.0" } }, - "node_modules/@parcel/rust-linux-x64-gnu": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-linux-x64-gnu/-/rust-linux-x64-gnu-2.15.2.tgz", - "integrity": "sha512-aI8bKZTEZNYmgURiAfrgpmaoEArnMRvosfsOKnGykTjmHgsBxO/CGguFj5a4wlAZTVWcTGfs4krnUKtF9Hw6Rw==", - "cpu": [ - "x64" - ], + "node_modules/@jridgewell/source-map": { + "version": "0.3.11", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz", + "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25" } }, - "node_modules/@parcel/rust-linux-x64-musl": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-linux-x64-musl/-/rust-linux-x64-musl-2.15.2.tgz", - "integrity": "sha512-FpQOraPTjGfbHipjdbYpQLlMIRDoVL+Kl9ak+6mt0SbvP3QaXGosQXyhw0ZoNszqVLjIwC0OHEjAHdtcO6ZUvQ==", - "cpu": [ - "x64" - ], + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@parcel/rust-win32-x64-msvc": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/rust-win32-x64-msvc/-/rust-win32-x64-msvc-2.15.2.tgz", - "integrity": "sha512-aSXkPc+KYAT6MnYgw2urXuDvipPkD90uJBKtSn3MY+fGOfzEluK7j0F5NdH88oTzrGVhRQxnxfe3Fc+IRhsaFQ==", - "cpu": [ - "x64" - ], + "node_modules/@loaders.gl/core": { + "version": "2.3.13", + "resolved": "https://registry.npmjs.org/@loaders.gl/core/-/core-2.3.13.tgz", + "integrity": "sha512-Hjm8eJjS/OUnaHrOSgXtE+qDg5V4Do0jIpp2u0Dv3CMxPrtd2TpwkDfAyZWmmbZew9rzqPoAVMINejS/ItWUeg==", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.3.1", + "@loaders.gl/loader-utils": "2.3.13" } }, - "node_modules/@parcel/source-map": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@parcel/source-map/-/source-map-2.1.1.tgz", - "integrity": "sha512-Ejx1P/mj+kMjQb8/y5XxDUn4reGdr+WyKYloBljpppUy8gs42T+BNoEOuRYqDVdgPc6NxduzIDoJS9pOFfV5Ew==", + "node_modules/@loaders.gl/images": { + "version": "2.3.13", + "resolved": "https://registry.npmjs.org/@loaders.gl/images/-/images-2.3.13.tgz", + "integrity": "sha512-BBgLf17udhRnYwvsObAOM7jEeLBaeU3di1NyLhpTMa7WbG3jAnDlmy1BRue8wYfgVpWnmk18YubZtX6vCRrJnA==", "dev": true, + "license": "MIT", "dependencies": { - "detect-libc": "^1.0.3" - }, - "engines": { - "node": "^12.18.3 || >=14" + "@loaders.gl/loader-utils": "2.3.13" } }, - "node_modules/@parcel/transformer-babel": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-babel/-/transformer-babel-2.15.2.tgz", - "integrity": "sha512-9oGx0wJhKY+Lh6PLY05m36IS6r6oOxpAQZhna2S5AYcfcf10ZsL8afOJTE8JBXbfg35dp97jeB4iuSHYTXr6NA==", + "node_modules/@loaders.gl/loader-utils": { + "version": "2.3.13", + "resolved": "https://registry.npmjs.org/@loaders.gl/loader-utils/-/loader-utils-2.3.13.tgz", + "integrity": "sha512-vXzH5CWG8pWjUEb7hUr6CM4ERj4NVRpA60OxvVv/OaZZ7hNN63+9/tSUA5IXD9QArWPWrFBnKnvE+5gg4WNqTg==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/utils": "2.15.2", - "browserslist": "^4.24.5", - "json5": "^2.2.3", - "nullthrows": "^1.1.1", - "semver": "^7.7.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@babel/runtime": "^7.3.1", + "@probe.gl/stats": "^3.3.0" } }, - "node_modules/@parcel/transformer-css": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-css/-/transformer-css-2.15.2.tgz", - "integrity": "sha512-NlybdCOr8r0LiPc7FIkeZp0mjfVB0Ht9B9eM3gUf2rOA1iM9/KGZNlu1AKVInyLRerybFqrGwHgx/qMGmbL3JA==", + "node_modules/@luma.gl/constants": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@luma.gl/constants/-/constants-8.3.1.tgz", + "integrity": "sha512-3b2RScz7TSwsrHjRx1iYvyn46fKXtR/mOSyFOPiRx+15FOLBdkYL2DPpaJAZ5fU9Rx7ToazJiWW1Mzgn6z2d0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/@luma.gl/core": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@luma.gl/core/-/core-8.3.1.tgz", + "integrity": "sha512-QMVxS83HQpVQ8D/74/A20fl1Wz7qLuV5bQuVZhvQ6bkHb8A6gAZMWr4Y2gpWNJTStWJuDkzAL8pB3us1jWCg2Q==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/utils": "2.15.2", - "browserslist": "^4.24.5", - "lightningcss": "^1.30.1", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@babel/runtime": "^7.0.0", + "@luma.gl/constants": "8.3.1", + "@luma.gl/engine": "8.3.1", + "@luma.gl/shadertools": "8.3.1", + "@luma.gl/webgl": "8.3.1" } }, - "node_modules/@parcel/transformer-html": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-html/-/transformer-html-2.15.2.tgz", - "integrity": "sha512-P0xptyNVKTgXr6HovvL3kCUw7eA3s2aZpAdliOhnFfzXUCG6Na/XN8TW5TOiNo41bcxsYwLpfrZz0N20AVJ4qw==", + "node_modules/@luma.gl/engine": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@luma.gl/engine/-/engine-8.3.1.tgz", + "integrity": "sha512-oE7sNmSihLeMCCrGYx6hv3g1GZAcNUbL8XKAQQNxs7Bo4abGIURuHFEc9mpT90YtEtkQcg2OewykeZT9jD9mIg==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@babel/runtime": "^7.0.0", + "@luma.gl/constants": "8.3.1", + "@luma.gl/gltools": "8.3.1", + "@luma.gl/shadertools": "8.3.1", + "@luma.gl/webgl": "8.3.1", + "math.gl": "^3.3.0", + "probe.gl": "^3.2.1" + } + }, + "node_modules/@luma.gl/gltools": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@luma.gl/gltools/-/gltools-8.3.1.tgz", + "integrity": "sha512-l/mnVSG5ioW19eZHMJlOD6crR58fwmdLoEKooXhnHiHofZ37h9HNlRlDf0XZIJPe4H4KLUM+Vv9VK0hqRrZHqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.0.0", + "@luma.gl/constants": "8.3.1", + "probe.gl": "^3.2.1" } }, - "node_modules/@parcel/transformer-image": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-image/-/transformer-image-2.15.2.tgz", - "integrity": "sha512-5WpKkEDMppaO21MO/5Rikr+DDRjkh3mPalpnH/DQLNEv0fKOakSNWDRR7FuV5ozSVREeQurTvbb4tAFAxOQx1w==", + "node_modules/@luma.gl/shadertools": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@luma.gl/shadertools/-/shadertools-8.3.1.tgz", + "integrity": "sha512-y9s1R0Uv64QooGKROkNCvPKJd5CJDQ21wxJt5FH/E98F0z4IcJXzKWu1num/XG23eSJyQpIf7qsSqvXDBfm/fA==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/utils": "2.15.2", - "@parcel/workers": "2.15.2", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "peerDependencies": { - "@parcel/core": "^2.15.2" + "@babel/runtime": "^7.0.0", + "math.gl": "^3.3.0" } }, - "node_modules/@parcel/transformer-js": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-js/-/transformer-js-2.15.2.tgz", - "integrity": "sha512-zVDc5Pc3/Cbn3GGsGjj+k/WjQLJCdwsKlYfpYiTXvSuXDpb4FCcYgr6F+wbSHb+/VikYIVH1RwH4kjCuIuNtew==", + "node_modules/@luma.gl/webgl": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/@luma.gl/webgl/-/webgl-8.3.1.tgz", + "integrity": "sha512-lsGo5Pp/hPlKj1emErRAUvOBxztU/goltBh3hfhg7BoKdlEa6EJcfjqX+YkCmfc8bbp7QePM7mj+1ZsrzKhlgg==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/source-map": "^2.1.1", - "@parcel/utils": "2.15.2", - "@parcel/workers": "2.15.2", - "@swc/helpers": "^0.5.0", - "browserslist": "^4.24.5", - "nullthrows": "^1.1.1", - "regenerator-runtime": "^0.14.1", - "semver": "^7.7.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "peerDependencies": { - "@parcel/core": "^2.15.2" + "@babel/runtime": "^7.0.0", + "@luma.gl/constants": "8.3.1", + "@luma.gl/gltools": "8.3.1", + "probe.gl": "^3.2.1" } }, - "node_modules/@parcel/transformer-js/node_modules/regenerator-runtime": { - "version": "0.14.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", - "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "dev": true + "node_modules/@mapbox/tiny-sdf": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@mapbox/tiny-sdf/-/tiny-sdf-1.2.5.tgz", + "integrity": "sha512-cD8A/zJlm6fdJOk6DqPUV8mcpyJkRz2x2R+/fYcWDYG3oWbG7/L7Yl/WqQ1VZCjnL9OTIMAn6c+BC5Eru4sQEw==", + "dev": true, + "license": "BSD-2-Clause" }, - "node_modules/@parcel/transformer-json": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-json/-/transformer-json-2.15.2.tgz", - "integrity": "sha512-ycGhhk+DeipU0jtdGZesIx0X++h3qLkT77N6B2cTyD+BXAlKYUh++QIaLyDgTu7VwqSIt5msDg5jLWdamH7Rkw==", + "node_modules/@math.gl/core": { + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/@math.gl/core/-/core-3.6.3.tgz", + "integrity": "sha512-jBABmDkj5uuuE0dTDmwwss7Cup5ZwQ6Qb7h1pgvtkEutTrhkcv8SuItQNXmF45494yIHeoGue08NlyeY6wxq2A==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2", - "json5": "^2.2.3" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@babel/runtime": "^7.12.0", + "@math.gl/types": "3.6.3", + "gl-matrix": "^3.4.0" } }, - "node_modules/@parcel/transformer-node": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-node/-/transformer-node-2.15.2.tgz", - "integrity": "sha512-H3IsKE2nVSEnqQH0DtjHQTTPqRw3gdXv9dROlwkU53O3cAIAtHDJYWmmDLMqhLl68vOYTvlkDT03rGrjnk8rDg==", + "node_modules/@math.gl/polygon": { + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/@math.gl/polygon/-/polygon-3.6.3.tgz", + "integrity": "sha512-FivQ1ZnYcAss1wVifOkHP/ZnlfQy1IL/769uzNtiHxwUbW0kZG3yyOZ9I7fwyzR5Hvqt3ErJKHjSYZr0uVlz5g==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/plugin": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@math.gl/core": "3.6.3" } }, - "node_modules/@parcel/transformer-postcss": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-postcss/-/transformer-postcss-2.15.2.tgz", - "integrity": "sha512-3vLJqsFhOwsUS6lFnBZhU//OrfdLPM4uPBsm7XDLl45B2+FcW3T2H32uSGW6Ue1q1MawkVeNShuy293luh7gmA==", + "node_modules/@math.gl/types": { + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/@math.gl/types/-/types-3.6.3.tgz", + "integrity": "sha512-3uWLVXHY3jQxsXCr/UCNPSc2BG0hNUljhmOBt9l+lNFDp7zHgm0cK2Tw4kj2XfkJy4TgwZTBGwRDQgWEbLbdTA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@math.gl/web-mercator": { + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/@math.gl/web-mercator/-/web-mercator-3.6.3.tgz", + "integrity": "sha512-UVrkSOs02YLehKaehrxhAejYMurehIHPfFQvPFZmdJHglHOU4V2cCUApTVEwOksvCp161ypEqVp+9H6mGhTTcw==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/utils": "2.15.2", - "clone": "^2.1.2", - "nullthrows": "^1.1.1", - "postcss-value-parser": "^4.2.0", - "semver": "^7.7.1" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "@babel/runtime": "^7.12.0", + "gl-matrix": "^3.4.0" } }, - "node_modules/@parcel/transformer-posthtml": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-posthtml/-/transformer-posthtml-2.15.2.tgz", - "integrity": "sha512-khdk3IfQLnlryu695kEDQHsvw02jGSJsbgqHoOdIxEbMltxB1JMfJBOOiTm+JEXXQlgD1ttX59CQD4vC7sIT0Q==", - "dev": true, - "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/utils": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } + "node_modules/@microsoft/load-themed-styles": { + "version": "1.10.295", + "resolved": "https://registry.npmjs.org/@microsoft/load-themed-styles/-/load-themed-styles-1.10.295.tgz", + "integrity": "sha512-W+IzEBw8a6LOOfRJM02dTT7BDZijxm+Z7lhtOAz1+y9vQm1Kdz9jlAO+qCEKsfxtUOmKilW8DIRqFw2aUgKeGg==", + "license": "MIT" + }, + "node_modules/@msrvida/chart-recommender": { + "resolved": "packages/chart-recommender", + "link": true + }, + "node_modules/@msrvida/chart-types": { + "resolved": "packages/chart-types", + "link": true + }, + "node_modules/@msrvida/data-inference": { + "resolved": "packages/data-inference", + "link": true + }, + "node_modules/@msrvida/fluentui-icons": { + "resolved": "packages/fluentui-icons", + "link": true + }, + "node_modules/@msrvida/fluentui-react-cdn-typings": { + "resolved": "packages/fluentui-react-cdn-typings", + "link": true + }, + "node_modules/@msrvida/sanddance": { + "resolved": "packages/sanddance", + "link": true + }, + "node_modules/@msrvida/sanddance-app": { + "resolved": "packages/sanddance-app", + "link": true + }, + "node_modules/@msrvida/sanddance-embed": { + "resolved": "packages/sanddance-embed", + "link": true + }, + "node_modules/@msrvida/sanddance-explorer": { + "resolved": "packages/sanddance-explorer", + "link": true + }, + "node_modules/@msrvida/sanddance-react": { + "resolved": "packages/sanddance-react", + "link": true }, - "node_modules/@parcel/transformer-raw": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-raw/-/transformer-raw-2.15.2.tgz", - "integrity": "sha512-c/7rzEnpWJJmQbZiwFgL57ETUIIiiySBoVmtuF22yNjGQc1Znthg/ee8pT755UfE1hDCT6Kh/XLWv1Bt3C64CQ==", - "dev": true, - "dependencies": { - "@parcel/plugin": "2.15.2" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } + "node_modules/@msrvida/sanddance-specs": { + "resolved": "packages/sanddance-specs", + "link": true }, - "node_modules/@parcel/transformer-react-refresh-wrap": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-react-refresh-wrap/-/transformer-react-refresh-wrap-2.15.2.tgz", - "integrity": "sha512-ReH5qjJbT1Tj7ZYi1KIck2amNTiWqY6m31Ml3I6JeApg7djnz+EwbzPmbpKkcFmR+wxt82DtQdXO3Y7BOJsZDQ==", - "dev": true, - "dependencies": { - "@parcel/error-overlay": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/utils": "2.15.2", - "react-refresh": "^0.16.0" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } + "node_modules/@msrvida/search-expression": { + "resolved": "packages/search-expression", + "link": true }, - "node_modules/@parcel/transformer-sass": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-sass/-/transformer-sass-2.15.2.tgz", - "integrity": "sha512-9xvOXsLF6j+vqOZsR6vYfPP72DnZKJvLQ9LdhhMrdsIUtza3QdS60keBcE13hJNTuzkFPMr9un4n8ldL3nb6aA==", - "dev": true, - "dependencies": { - "@parcel/plugin": "2.15.2", - "@parcel/source-map": "^2.1.1", - "sass": "^1.88.0" - }, - "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } + "node_modules/@msrvida/vega-deck.gl": { + "resolved": "packages/vega-deck.gl", + "link": true + }, + "node_modules/@msrvida/vega-morphcharts": { + "resolved": "packages/vega-morphcharts", + "link": true }, - "node_modules/@parcel/transformer-svg": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/transformer-svg/-/transformer-svg-2.15.2.tgz", - "integrity": "sha512-R5Q0JgDtywSmojvqqa6TDmXDbKCfBBgu4tR0mzo3VicEObmiatRT49BFWHbdenfTf5tKpRplfH88leMPuDVVAg==", + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/plugin": "2.15.2", - "@parcel/rust": "2.15.2" + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" }, "engines": { - "node": ">= 16.0.0", - "parcel": "^2.15.2" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/@parcel/types": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/types/-/types-2.15.2.tgz", - "integrity": "sha512-APVvBVVG8RIMLN5hERa2POkPkEtrNUqRbQlKpoNYlIYZaYxKzb9+4MH4cVkmkGfYk3FGU3K5RnxSxMMWsu4tdw==", - "dev": true, - "dependencies": { - "@parcel/types-internal": "2.15.2", - "@parcel/workers": "2.15.2" + "node": ">= 8" } }, - "node_modules/@parcel/types-internal": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/types-internal/-/types-internal-2.15.2.tgz", - "integrity": "sha512-nmMpYeG4le49nvr8FsJYGEwhCZxcrm89tvkX8xGod1yXcShEZNWVVY9ezZLKxMrVMdBveqNUW8IZCij5iFDqdQ==", + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/feature-flags": "2.15.2", - "@parcel/source-map": "^2.1.1", - "utility-types": "^3.11.0" + "license": "MIT", + "engines": { + "node": ">= 8" } }, - "node_modules/@parcel/utils": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/utils/-/utils-2.15.2.tgz", - "integrity": "sha512-SQ77yZyeLZf5Teq5aMAViuXKoN7JRnYZ7Pdere1FD8ZuS7E34THA4jjJKxKu9Bqtezgm+gpN1gMbSKMBfbmIZA==", + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, + "license": "MIT", "dependencies": { - "@parcel/codeframe": "2.15.2", - "@parcel/diagnostic": "2.15.2", - "@parcel/logger": "2.15.2", - "@parcel/markdown-ansi": "2.15.2", - "@parcel/rust": "2.15.2", - "@parcel/source-map": "^2.1.1", - "chalk": "^4.1.2", - "nullthrows": "^1.1.1" + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" }, "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">= 8" } }, "node_modules/@parcel/watcher": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.0.tgz", - "integrity": "sha512-i0GV1yJnm2n3Yq1qw6QrUrd/LI9bE8WEBOTtOkpCXHHdyN3TAGgqAK/DAT05z4fq2x04cARXt2pDmjWjL92iTQ==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.1.tgz", + "integrity": "sha512-dfUnCxiN9H4ap84DvD2ubjw+3vUNpstxa0TneY/Paat8a3R4uQZDLSvWjmznAY/DoahqTHl9V46HF/Zs3F29pg==", "dev": true, "hasInstallScript": true, + "license": "MIT", + "optional": true, "dependencies": { "detect-libc": "^1.0.3", "is-glob": "^4.0.3", @@ -2736,29 +1721,30 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "@parcel/watcher-android-arm64": "2.5.0", - "@parcel/watcher-darwin-arm64": "2.5.0", - "@parcel/watcher-darwin-x64": "2.5.0", - "@parcel/watcher-freebsd-x64": "2.5.0", - "@parcel/watcher-linux-arm-glibc": "2.5.0", - "@parcel/watcher-linux-arm-musl": "2.5.0", - "@parcel/watcher-linux-arm64-glibc": "2.5.0", - "@parcel/watcher-linux-arm64-musl": "2.5.0", - "@parcel/watcher-linux-x64-glibc": "2.5.0", - "@parcel/watcher-linux-x64-musl": "2.5.0", - "@parcel/watcher-win32-arm64": "2.5.0", - "@parcel/watcher-win32-ia32": "2.5.0", - "@parcel/watcher-win32-x64": "2.5.0" + "@parcel/watcher-android-arm64": "2.5.1", + "@parcel/watcher-darwin-arm64": "2.5.1", + "@parcel/watcher-darwin-x64": "2.5.1", + "@parcel/watcher-freebsd-x64": "2.5.1", + "@parcel/watcher-linux-arm-glibc": "2.5.1", + "@parcel/watcher-linux-arm-musl": "2.5.1", + "@parcel/watcher-linux-arm64-glibc": "2.5.1", + "@parcel/watcher-linux-arm64-musl": "2.5.1", + "@parcel/watcher-linux-x64-glibc": "2.5.1", + "@parcel/watcher-linux-x64-musl": "2.5.1", + "@parcel/watcher-win32-arm64": "2.5.1", + "@parcel/watcher-win32-ia32": "2.5.1", + "@parcel/watcher-win32-x64": "2.5.1" } }, "node_modules/@parcel/watcher-android-arm64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.0.tgz", - "integrity": "sha512-qlX4eS28bUcQCdribHkg/herLe+0A9RyYC+mm2PXpncit8z5b3nSqGVzMNR3CmtAOgRutiZ02eIJJgP/b1iEFQ==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-android-arm64/-/watcher-android-arm64-2.5.1.tgz", + "integrity": "sha512-KF8+j9nNbUN8vzOFDpRMsaKBHZ/mcjEjMToVMJOhTozkDonQFFrRcfdLWn6yWKCmJKmdVxSgHiYvTCef4/qcBA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" @@ -2772,13 +1758,14 @@ } }, "node_modules/@parcel/watcher-darwin-arm64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.0.tgz", - "integrity": "sha512-hyZ3TANnzGfLpRA2s/4U1kbw2ZI4qGxaRJbBH2DCSREFfubMswheh8TeiC1sGZ3z2jUf3s37P0BBlrD3sjVTUw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-arm64/-/watcher-darwin-arm64-2.5.1.tgz", + "integrity": "sha512-eAzPv5osDmZyBhou8PoF4i6RQXAfeKL9tjb3QzYuccXFMQU0ruIc/POh30ePnaOyD1UXdlKguHBmsTs53tVoPw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -2792,13 +1779,14 @@ } }, "node_modules/@parcel/watcher-darwin-x64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.0.tgz", - "integrity": "sha512-9rhlwd78saKf18fT869/poydQK8YqlU26TMiNg7AIu7eBp9adqbJZqmdFOsbZ5cnLp5XvRo9wcFmNHgHdWaGYA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-darwin-x64/-/watcher-darwin-x64-2.5.1.tgz", + "integrity": "sha512-1ZXDthrnNmwv10A0/3AJNZ9JGlzrF82i3gNQcWOzd7nJ8aj+ILyW1MTxVk35Db0u91oD5Nlk9MBiujMlwmeXZg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" @@ -2812,13 +1800,14 @@ } }, "node_modules/@parcel/watcher-freebsd-x64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.0.tgz", - "integrity": "sha512-syvfhZzyM8kErg3VF0xpV8dixJ+RzbUaaGaeb7uDuz0D3FK97/mZ5AJQ3XNnDsXX7KkFNtyQyFrXZzQIcN49Tw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-freebsd-x64/-/watcher-freebsd-x64-2.5.1.tgz", + "integrity": "sha512-SI4eljM7Flp9yPuKi8W0ird8TI/JK6CSxju3NojVI6BjHsTyK7zxA9urjVjEKJ5MBYC+bLmMcbAWlZ+rFkLpJQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" @@ -2832,13 +1821,14 @@ } }, "node_modules/@parcel/watcher-linux-arm-glibc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.0.tgz", - "integrity": "sha512-0VQY1K35DQET3dVYWpOaPFecqOT9dbuCfzjxoQyif1Wc574t3kOSkKevULddcR9znz1TcklCE7Ht6NIxjvTqLA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-glibc/-/watcher-linux-arm-glibc-2.5.1.tgz", + "integrity": "sha512-RCdZlEyTs8geyBkkcnPWvtXLY44BCeZKmGYRtSgtwwnHR4dxfHRG3gR99XdMEdQ7KeiDdasJwwvNSF5jKtDwdA==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -2852,13 +1842,14 @@ } }, "node_modules/@parcel/watcher-linux-arm-musl": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.0.tgz", - "integrity": "sha512-6uHywSIzz8+vi2lAzFeltnYbdHsDm3iIB57d4g5oaB9vKwjb6N6dRIgZMujw4nm5r6v9/BQH0noq6DzHrqr2pA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm-musl/-/watcher-linux-arm-musl-2.5.1.tgz", + "integrity": "sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -2872,13 +1863,14 @@ } }, "node_modules/@parcel/watcher-linux-arm64-glibc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.0.tgz", - "integrity": "sha512-BfNjXwZKxBy4WibDb/LDCriWSKLz+jJRL3cM/DllnHH5QUyoiUNEp3GmL80ZqxeumoADfCCP19+qiYiC8gUBjA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-glibc/-/watcher-linux-arm64-glibc-2.5.1.tgz", + "integrity": "sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -2892,13 +1884,14 @@ } }, "node_modules/@parcel/watcher-linux-arm64-musl": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.0.tgz", - "integrity": "sha512-S1qARKOphxfiBEkwLUbHjCY9BWPdWnW9j7f7Hb2jPplu8UZ3nes7zpPOW9bkLbHRvWM0WDTsjdOTUgW0xLBN1Q==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-arm64-musl/-/watcher-linux-arm64-musl-2.5.1.tgz", + "integrity": "sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -2912,13 +1905,14 @@ } }, "node_modules/@parcel/watcher-linux-x64-glibc": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.0.tgz", - "integrity": "sha512-d9AOkusyXARkFD66S6zlGXyzx5RvY+chTP9Jp0ypSTC9d4lzyRs9ovGf/80VCxjKddcUvnsGwCHWuF2EoPgWjw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-glibc/-/watcher-linux-x64-glibc-2.5.1.tgz", + "integrity": "sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -2932,13 +1926,14 @@ } }, "node_modules/@parcel/watcher-linux-x64-musl": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.0.tgz", - "integrity": "sha512-iqOC+GoTDoFyk/VYSFHwjHhYrk8bljW6zOhPuhi5t9ulqiYq1togGJB5e3PwYVFFfeVgc6pbz3JdQyDoBszVaA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.1.tgz", + "integrity": "sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" @@ -2952,13 +1947,14 @@ } }, "node_modules/@parcel/watcher-win32-arm64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.0.tgz", - "integrity": "sha512-twtft1d+JRNkM5YbmexfcH/N4znDtjgysFaV9zvZmmJezQsKpkfLYJ+JFV3uygugK6AtIM2oADPkB2AdhBrNig==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-arm64/-/watcher-win32-arm64-2.5.1.tgz", + "integrity": "sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -2972,13 +1968,14 @@ } }, "node_modules/@parcel/watcher-win32-ia32": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.0.tgz", - "integrity": "sha512-+rgpsNRKwo8A53elqbbHXdOMtY/tAtTzManTWShB5Kk54N8Q9mzNWV7tV+IbGueCbcj826MfWGU3mprWtuf1TA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-ia32/-/watcher-win32-ia32-2.5.1.tgz", + "integrity": "sha512-c2KkcVN+NJmuA7CGlaGD1qJh1cLfDnQsHjE89E60vUEMlqduHGCdCLJCID5geFVM0dOtA3ZiIO8BoEQmzQVfpQ==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -2992,13 +1989,14 @@ } }, "node_modules/@parcel/watcher-win32-x64": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.0.tgz", - "integrity": "sha512-lPrxve92zEHdgeff3aiu4gDOIt4u7sJYha6wbdEZDCDUhtjTsOMiaJzG5lMY4GkWH8p0fMmO2Ppq5G5XXG+DQw==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@parcel/watcher-win32-x64/-/watcher-win32-x64-2.5.1.tgz", + "integrity": "sha512-9lHBdJITeNR++EvSQVUcaZoWupyHfXe1jZvGZ06O/5MflPcuPLtEphScIBL+AiCWBO46tDSHzWyD0uDmmZqsgA==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" @@ -3011,41 +2009,12 @@ "url": "https://opencollective.com/parcel" } }, - "node_modules/@parcel/workers": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/@parcel/workers/-/workers-2.15.2.tgz", - "integrity": "sha512-uQWM3Zzkk+vzFYrLQvU/oeM1LC6/EDPvpdgtvdwkUqYC6O1Oei+9cWz6Uv5UDCwizeJKt+3PyE2rB9idbEkmsQ==", - "dev": true, - "dependencies": { - "@parcel/diagnostic": "2.15.2", - "@parcel/logger": "2.15.2", - "@parcel/profiler": "2.15.2", - "@parcel/types-internal": "2.15.2", - "@parcel/utils": "2.15.2", - "nullthrows": "^1.1.1" - }, - "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "peerDependencies": { - "@parcel/core": "^2.15.2" - } - }, - "node_modules/@polka/url": { - "version": "1.0.0-next.28", - "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.28.tgz", - "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==", - "dev": true - }, "node_modules/@probe.gl/env": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/@probe.gl/env/-/env-3.6.0.tgz", "integrity": "sha512-4tTZYUg/8BICC3Yyb9rOeoKeijKbZHRXBEKObrfPmX4sQmYB15ZOUpoVBhAyJkOYVAM8EkPci6Uw5dLCwx2BEQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.0.0" } @@ -3055,6 +2024,7 @@ "resolved": "https://registry.npmjs.org/@probe.gl/log/-/log-3.6.0.tgz", "integrity": "sha512-hjpyenpEvOdowgZ1qMeCJxfRD4JkKdlXz0RC14m42Un62NtOT+GpWyKA4LssT0+xyLULCByRAtG2fzZorpIAcA==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.0.0", "@probe.gl/env": "3.6.0" @@ -3065,6 +2035,7 @@ "resolved": "https://registry.npmjs.org/@probe.gl/stats/-/stats-3.6.0.tgz", "integrity": "sha512-JdALQXB44OP4kUBN/UrQgzbJe4qokbVF4Y8lkIA8iVCFnjVowWIgkD/z/0QO65yELT54tTrtepw1jScjKB+rhQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/runtime": "^7.0.0" } @@ -3074,6 +2045,7 @@ "resolved": "https://registry.npmjs.org/@rollup/plugin-buble/-/plugin-buble-1.0.3.tgz", "integrity": "sha512-QYD9BKkJoof0FdCFeSYYhF6/Y8e0Mnf+098xGgmWOFJ4UPHlWujjqOYeVwEm2hJPOmlR5k7HPUdAjqtOWhN64Q==", "dev": true, + "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.0.1", "@types/buble": "^0.19.2", @@ -3092,10 +2064,11 @@ } }, "node_modules/@rollup/plugin-commonjs": { - "version": "28.0.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.2.tgz", - "integrity": "sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==", + "version": "29.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-29.0.0.tgz", + "integrity": "sha512-U2YHaxR2cU/yAiwKJtJRhnyLk7cifnQw0zUpISsocBDoHDJn+HTV74ABqnwr5bEgWUwFZC9oFL6wLe21lHu5eQ==", "dev": true, + "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.0.1", "commondir": "^1.0.1", @@ -3122,6 +2095,7 @@ "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", "dev": true, + "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.1.0" }, @@ -3138,10 +2112,11 @@ } }, "node_modules/@rollup/plugin-node-resolve": { - "version": "15.3.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz", - "integrity": "sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==", + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.3.tgz", + "integrity": "sha512-lUYM3UBGuM93CnMPG1YocWu7X802BrNF3jW2zny5gQyLQgRFJhV1Sq0Zi74+dh/6NBx1DxFC4b4GXg9wUCG5Qg==", "dev": true, + "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.0.1", "@types/resolve": "1.20.2", @@ -3166,15 +2141,17 @@ "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/@rollup/plugin-typescript": { - "version": "12.1.2", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.2.tgz", - "integrity": "sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==", + "version": "12.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.3.0.tgz", + "integrity": "sha512-7DP0/p7y3t67+NabT9f8oTBFE6gGkto4SA6Np2oudYmZE/m1dt8RB0SjL1msMxFpLo631qjRCcBlAbq1ml/Big==", "dev": true, + "license": "MIT", "dependencies": { "@rollup/pluginutils": "^5.1.0", "resolve": "^1.22.1" @@ -3197,10 +2174,11 @@ } }, "node_modules/@rollup/pluginutils": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", - "integrity": "sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.3.0.tgz", + "integrity": "sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==", "dev": true, + "license": "MIT", "dependencies": { "@types/estree": "^1.0.0", "estree-walker": "^2.0.2", @@ -3219,273 +2197,336 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.28.1.tgz", - "integrity": "sha512-2aZp8AES04KI2dy3Ss6/MDjXbwBzj+i0GqKtWXgw2/Ma6E4jJvujryO6gJAghIRVz7Vwr9Gtl/8na3nDUKpraQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", + "integrity": "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.28.1.tgz", - "integrity": "sha512-EbkK285O+1YMrg57xVA+Dp0tDBRB93/BZKph9XhMjezf6F4TpYjaUSuPt5J0fZXlSag0LmZAsTmdGGqPp4pQFA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz", + "integrity": "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "android" ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.28.1.tgz", - "integrity": "sha512-prduvrMKU6NzMq6nxzQw445zXgaDBbMQvmKSJaxpaZ5R1QDM8w+eGxo6Y/jhT/cLoCvnZI42oEqf9KQNYz1fqQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz", + "integrity": "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.28.1.tgz", - "integrity": "sha512-WsvbOunsUk0wccO/TV4o7IKgloJ942hVFK1CLatwv6TJspcCZb9umQkPdvB7FihmdxgaKR5JyxDjWpCOp4uZlQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz", + "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "darwin" ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.28.1.tgz", - "integrity": "sha512-HTDPdY1caUcU4qK23FeeGxCdJF64cKkqajU0iBnTVxS8F7H/7BewvYoG+va1KPSL63kQ1PGNyiwKOfReavzvNA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz", + "integrity": "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.28.1.tgz", - "integrity": "sha512-m/uYasxkUevcFTeRSM9TeLyPe2QDuqtjkeoTpP9SW0XxUWfcYrGDMkO/m2tTw+4NMAF9P2fU3Mw4ahNvo7QmsQ==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz", + "integrity": "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "freebsd" ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.28.1.tgz", - "integrity": "sha512-QAg11ZIt6mcmzpNE6JZBpKfJaKkqTm1A9+y9O+frdZJEuhQxiugM05gnCWiANHj4RmbgeVJpTdmKRmH/a+0QbA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz", + "integrity": "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.28.1.tgz", - "integrity": "sha512-dRP9PEBfolq1dmMcFqbEPSd9VlRuVWEGSmbxVEfiq2cs2jlZAl0YNxFzAQS2OrQmsLBLAATDMb3Z6MFv5vOcXg==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz", + "integrity": "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==", "cpu": [ "arm" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.28.1.tgz", - "integrity": "sha512-uGr8khxO+CKT4XU8ZUH1TTEUtlktK6Kgtv0+6bIFSeiSlnGJHG1tSFSjm41uQ9sAO/5ULx9mWOz70jYLyv1QkA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz", + "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.28.1.tgz", - "integrity": "sha512-QF54q8MYGAqMLrX2t7tNpi01nvq5RI59UBNx+3+37zoKX5KViPo/gk2QLhsuqok05sSCRluj0D00LzCwBikb0A==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz", + "integrity": "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.28.1.tgz", - "integrity": "sha512-vPul4uodvWvLhRco2w0GcyZcdyBfpfDRgNKU+p35AWEbJ/HPs1tOUrkSueVbBS0RQHAf/A+nNtDpvw95PeVKOA==", + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz", + "integrity": "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==", "cpu": [ "loong64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.28.1.tgz", - "integrity": "sha512-pTnTdBuC2+pt1Rmm2SV7JWRqzhYpEILML4PKODqLz+C7Ou2apEV52h19CR7es+u04KlqplggmN9sqZlekg3R1A==", + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz", + "integrity": "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==", "cpu": [ "ppc64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.28.1.tgz", - "integrity": "sha512-vWXy1Nfg7TPBSuAncfInmAI/WZDd5vOklyLJDdIRKABcZWojNDY0NJwruY2AcnCLnRJKSaBgf/GiJfauu8cQZA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz", + "integrity": "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz", + "integrity": "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==", "cpu": [ "riscv64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.28.1.tgz", - "integrity": "sha512-/yqC2Y53oZjb0yz8PVuGOQQNOTwxcizudunl/tFs1aLvObTclTwZ0JhXF2XcPT/zuaymemCDSuuUPXJJyqeDOg==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz", + "integrity": "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==", "cpu": [ "s390x" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.28.1.tgz", - "integrity": "sha512-fzgeABz7rrAlKYB0y2kSEiURrI0691CSL0+KXwKwhxvj92VULEDQLpBYLHpF49MSiPG4sq5CK3qHMnb9tlCjBw==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz", + "integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.28.1.tgz", - "integrity": "sha512-xQTDVzSGiMlSshpJCtudbWyRfLaNiVPXt1WgdWTwWz9n0U12cI2ZVtWe/Jgwyv/6wjL7b66uu61Vg0POWVfz4g==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz", + "integrity": "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "linux" ] }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz", + "integrity": "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.28.1.tgz", - "integrity": "sha512-wSXmDRVupJstFP7elGMgv+2HqXelQhuNf+IS4V+nUpNVi/GUiBgDmfwD0UGN3pcAnWsgKG3I52wMOBnk1VHr/A==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz", + "integrity": "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==", "cpu": [ "arm64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.28.1.tgz", - "integrity": "sha512-ZkyTJ/9vkgrE/Rk9vhMXhf8l9D+eAhbAVbsGsXKy2ohmJaWg0LPQLnIxRdRp/bKyr8tXuPlXhIoGlEB5XpJnGA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz", + "integrity": "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==", "cpu": [ "ia32" ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz", + "integrity": "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.28.1.tgz", - "integrity": "sha512-ZvK2jBafvttJjoIdKm/Q/Bh7IJ1Ose9IBOwpOXcOvW3ikGTQGmKDgxTC6oCAzW6PynbkKP8+um1du81XJHZ0JA==", + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", + "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", "cpu": [ "x64" ], "dev": true, + "license": "MIT", "optional": true, "os": [ "win32" ] }, "node_modules/@secretlint/config-creator": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/config-creator/-/config-creator-10.1.1.tgz", - "integrity": "sha512-TJ42CHZqqnEe9ORvIXVVMqdu3KAtyZRxLspjFexo6XgrwJ6CoFHQYzIihilqRjo2sJh9HMrpnYSj/5hopofGrA==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/config-creator/-/config-creator-10.2.2.tgz", + "integrity": "sha512-BynOBe7Hn3LJjb3CqCHZjeNB09s/vgf0baBaHVw67w7gHF0d25c3ZsZ5+vv8TgwSchRdUCRrbbcq5i2B1fJ2QQ==", "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/types": "^10.1.1" + "@secretlint/types": "^10.2.2" }, "engines": { "node": ">=20.0.0" } }, "node_modules/@secretlint/config-loader": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/config-loader/-/config-loader-10.1.1.tgz", - "integrity": "sha512-jBClVFmS6Yu/zI5ejBCRF5a5ASYsE4gOjogjB+WsaHbQHtGvnyY7I26Qtdg4ihCc/VPKYQg0LdM75pLTXzwsjg==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/config-loader/-/config-loader-10.2.2.tgz", + "integrity": "sha512-ndjjQNgLg4DIcMJp4iaRD6xb9ijWQZVbd9694Ol2IszBIbGPPkwZHzJYKICbTBmh6AH/pLr0CiCaWdGJU7RbpQ==", "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/profiler": "^10.1.1", - "@secretlint/resolver": "^10.1.1", - "@secretlint/types": "^10.1.1", + "@secretlint/profiler": "^10.2.2", + "@secretlint/resolver": "^10.2.2", + "@secretlint/types": "^10.2.2", "ajv": "^8.17.1", "debug": "^4.4.1", "rc-config-loader": "^4.1.3" @@ -3494,36 +2535,15 @@ "node": ">=20.0.0" } }, - "node_modules/@secretlint/config-loader/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/@secretlint/config-loader/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, "node_modules/@secretlint/core": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/core/-/core-10.1.1.tgz", - "integrity": "sha512-COLCxSoH/iVQdLeaZPVtBj0UWKOagO09SqYkCQgfFfZ+soGxKVK405dL317r4PnH9Pm8/s8xQC6OSY5rWTRObQ==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/core/-/core-10.2.2.tgz", + "integrity": "sha512-6rdwBwLP9+TO3rRjMVW1tX+lQeo5gBbxl1I5F8nh8bgGtKwdlCMhMKsBWzWg1ostxx/tIG7OjZI0/BxsP8bUgw==", "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/profiler": "^10.1.1", - "@secretlint/types": "^10.1.1", + "@secretlint/profiler": "^10.2.2", + "@secretlint/types": "^10.2.2", "debug": "^4.4.1", "structured-source": "^4.0.0" }, @@ -3532,39 +2552,54 @@ } }, "node_modules/@secretlint/formatter": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/formatter/-/formatter-10.1.1.tgz", - "integrity": "sha512-Gpd8gTPN121SJ0h/9e6nWlZU7PitfhXUiEzW7Kyswg6kNGs+bSqmgTgWFtbo1VQ4ygJYiveWPNT05RCImBexJw==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/formatter/-/formatter-10.2.2.tgz", + "integrity": "sha512-10f/eKV+8YdGKNQmoDUD1QnYL7TzhI2kzyx95vsJKbEa8akzLAR5ZrWIZ3LbcMmBLzxlSQMMccRmi05yDQ5YDA==", "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/resolver": "^10.1.1", - "@secretlint/types": "^10.1.1", - "@textlint/linter-formatter": "^14.8.4", - "@textlint/module-interop": "^14.8.4", - "@textlint/types": "^14.8.4", - "chalk": "^4.1.2", + "@secretlint/resolver": "^10.2.2", + "@secretlint/types": "^10.2.2", + "@textlint/linter-formatter": "^15.2.0", + "@textlint/module-interop": "^15.2.0", + "@textlint/types": "^15.2.0", + "chalk": "^5.4.1", "debug": "^4.4.1", "pluralize": "^8.0.0", - "strip-ansi": "^6.0.1", + "strip-ansi": "^7.1.0", "table": "^6.9.0", - "terminal-link": "^2.1.1" + "terminal-link": "^4.0.0" }, "engines": { "node": ">=20.0.0" } }, + "node_modules/@secretlint/formatter/node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, "node_modules/@secretlint/node": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/node/-/node-10.1.1.tgz", - "integrity": "sha512-AhN+IGqljVObm8a+B33b23FY79wihu5E61Nd3oYSoZV7SxUvMjpafqhLfpt4frNSY7Ghf/pirWu7JY7GMujFrA==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/node/-/node-10.2.2.tgz", + "integrity": "sha512-eZGJQgcg/3WRBwX1bRnss7RmHHK/YlP/l7zOQsrjexYt6l+JJa5YhUmHbuGXS94yW0++3YkEJp0kQGYhiw1DMQ==", "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/config-loader": "^10.1.1", - "@secretlint/core": "^10.1.1", - "@secretlint/formatter": "^10.1.1", - "@secretlint/profiler": "^10.1.1", - "@secretlint/source-creator": "^10.1.1", - "@secretlint/types": "^10.1.1", + "@secretlint/config-loader": "^10.2.2", + "@secretlint/core": "^10.2.2", + "@secretlint/formatter": "^10.2.2", + "@secretlint/profiler": "^10.2.2", + "@secretlint/source-creator": "^10.2.2", + "@secretlint/types": "^10.2.2", "debug": "^4.4.1", "p-map": "^7.0.3" }, @@ -3573,54 +2608,60 @@ } }, "node_modules/@secretlint/profiler": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/profiler/-/profiler-10.1.1.tgz", - "integrity": "sha512-kReI+Wr7IQz0LbVwYByzlnPbx4BEF2oEWJBc4Oa45g24alCjHu+jD9h9mzkTJqYUgMnVYD3o7HfzeqxFrV+9XA==", - "dev": true + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/profiler/-/profiler-10.2.2.tgz", + "integrity": "sha512-qm9rWfkh/o8OvzMIfY8a5bCmgIniSpltbVlUVl983zDG1bUuQNd1/5lUEeWx5o/WJ99bXxS7yNI4/KIXfHexig==", + "dev": true, + "license": "MIT" }, "node_modules/@secretlint/resolver": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/resolver/-/resolver-10.1.1.tgz", - "integrity": "sha512-GdQzxnBtdBRjBULvZ8ERkaRqDp0njVwXrzBCav1pb0XshVk76C1cjeDqtTqM4RJ1Awo/g5U5MIWYztYv67v5Gg==", - "dev": true + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/resolver/-/resolver-10.2.2.tgz", + "integrity": "sha512-3md0cp12e+Ae5V+crPQYGd6aaO7ahw95s28OlULGyclyyUtf861UoRGS2prnUrKh7MZb23kdDOyGCYb9br5e4w==", + "dev": true, + "license": "MIT" }, "node_modules/@secretlint/secretlint-formatter-sarif": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/secretlint-formatter-sarif/-/secretlint-formatter-sarif-10.1.1.tgz", - "integrity": "sha512-Dyq8nzy6domjSlZKX1E5PEzuWxeTqjQJWrlXBmVmOjwLBLfRZDlm5Vq+AduBmEk03KEIKIZi4cZQwsniuRPO9Q==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/secretlint-formatter-sarif/-/secretlint-formatter-sarif-10.2.2.tgz", + "integrity": "sha512-ojiF9TGRKJJw308DnYBucHxkpNovDNu1XvPh7IfUp0A12gzTtxuWDqdpuVezL7/IP8Ua7mp5/VkDMN9OLp1doQ==", "dev": true, + "license": "MIT", "dependencies": { - "node-sarif-builder": "^2.0.3" + "node-sarif-builder": "^3.2.0" } }, "node_modules/@secretlint/secretlint-rule-no-dotenv": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/secretlint-rule-no-dotenv/-/secretlint-rule-no-dotenv-10.1.1.tgz", - "integrity": "sha512-a3/sOUUtEHuw1HCadtxUjViNeomiiohfJj+rwtHxJkCq4pjITS3HSYhQBXnNvkctQNljKIzFm7JUA/4QJ6I4sQ==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/secretlint-rule-no-dotenv/-/secretlint-rule-no-dotenv-10.2.2.tgz", + "integrity": "sha512-KJRbIShA9DVc5Va3yArtJ6QDzGjg3PRa1uYp9As4RsyKtKSSZjI64jVca57FZ8gbuk4em0/0Jq+uy6485wxIdg==", "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/types": "^10.1.1" + "@secretlint/types": "^10.2.2" }, "engines": { "node": ">=20.0.0" } }, "node_modules/@secretlint/secretlint-rule-preset-recommend": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/secretlint-rule-preset-recommend/-/secretlint-rule-preset-recommend-10.1.1.tgz", - "integrity": "sha512-+GeISCXVgpnoeRZE4ZPsuO97+fm6z8Ge23LNq6LvR9ZJAq018maXVftkJhHj4hnvYB5URUAEerBBkPGNk5/Ong==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/secretlint-rule-preset-recommend/-/secretlint-rule-preset-recommend-10.2.2.tgz", + "integrity": "sha512-K3jPqjva8bQndDKJqctnGfwuAxU2n9XNCPtbXVI5JvC7FnQiNg/yWlQPbMUlBXtBoBGFYp08A94m6fvtc9v+zA==", "dev": true, + "license": "MIT", "engines": { "node": ">=20.0.0" } }, "node_modules/@secretlint/source-creator": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/source-creator/-/source-creator-10.1.1.tgz", - "integrity": "sha512-IWjvHcE0bhC/x88a9M9jbZlFRZGUEbBzujxrs2KzI5IQ2BXTBRBRhRSjE/BEpWqDHILB22c3mfam8X+UjukphA==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/source-creator/-/source-creator-10.2.2.tgz", + "integrity": "sha512-h6I87xJfwfUTgQ7irWq7UTdq/Bm1RuQ/fYhA3dtTIAop5BwSFmZyrchph4WcoEvbN460BWKmk4RYSvPElIIvxw==", "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/types": "^10.1.1", + "@secretlint/types": "^10.2.2", "istextorbinary": "^9.5.0" }, "engines": { @@ -3628,10 +2669,11 @@ } }, "node_modules/@secretlint/types": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/@secretlint/types/-/types-10.1.1.tgz", - "integrity": "sha512-/JGAvVkurVHkargk3AC7UxRy+Ymc+52AVBO/fZA5pShuLW2dX4O/rKc4n8cyhQiOb/3ym5ACSlLQuQ8apPfxrQ==", + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/types/-/types-10.2.2.tgz", + "integrity": "sha512-Nqc90v4lWCXyakD6xNyNACBJNJ0tNCwj2WNk/7ivyacYHxiITVgmLUFXTBOeCdy79iz6HtN9Y31uw/jbLrdOAg==", "dev": true, + "license": "MIT", "engines": { "node": ">=20.0.0" } @@ -3641,6 +2683,7 @@ "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", "dev": true, + "license": "MIT", "engines": { "node": ">=18" }, @@ -3648,247 +2691,37 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@swc/core": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.11.31.tgz", - "integrity": "sha512-mAby9aUnKRjMEA7v8cVZS9Ah4duoRBnX7X6r5qrhTxErx+68MoY1TPrVwj/66/SWN3Bl+jijqAqoB8Qx0QE34A==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "@swc/counter": "^0.1.3", - "@swc/types": "^0.1.21" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/swc" - }, - "optionalDependencies": { - "@swc/core-darwin-arm64": "1.11.31", - "@swc/core-darwin-x64": "1.11.31", - "@swc/core-linux-arm-gnueabihf": "1.11.31", - "@swc/core-linux-arm64-gnu": "1.11.31", - "@swc/core-linux-arm64-musl": "1.11.31", - "@swc/core-linux-x64-gnu": "1.11.31", - "@swc/core-linux-x64-musl": "1.11.31", - "@swc/core-win32-arm64-msvc": "1.11.31", - "@swc/core-win32-ia32-msvc": "1.11.31", - "@swc/core-win32-x64-msvc": "1.11.31" - }, - "peerDependencies": { - "@swc/helpers": ">=0.5.17" - }, - "peerDependenciesMeta": { - "@swc/helpers": { - "optional": true - } - } - }, - "node_modules/@swc/core-darwin-arm64": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.11.31.tgz", - "integrity": "sha512-NTEaYOts0OGSbJZc0O74xsji+64JrF1stmBii6D5EevWEtrY4wlZhm8SiP/qPrOB+HqtAihxWIukWkP2aSdGSQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-darwin-x64": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.11.31.tgz", - "integrity": "sha512-THSGaSwT96JwXDwuXQ6yFBbn+xDMdyw7OmBpnweAWsh5DhZmQkALEm1DgdQO3+rrE99MkmzwAfclc0UmYro/OA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.11.31.tgz", - "integrity": "sha512-laKtQFnW7KHgE57Hx32os2SNAogcuIDxYE+3DYIOmDMqD7/1DCfJe6Rln2N9WcOw6HuDbDpyQavIwZNfSAa8vQ==", - "cpu": [ - "arm" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.11.31.tgz", - "integrity": "sha512-T+vGw9aPE1YVyRxRr1n7NAdkbgzBzrXCCJ95xAZc/0+WUwmL77Z+js0J5v1KKTRxw4FvrslNCOXzMWrSLdwPSA==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.11.31.tgz", - "integrity": "sha512-Mztp5NZkyd5MrOAG+kl+QSn0lL4Uawd4CK4J7wm97Hs44N9DHGIG5nOz7Qve1KZo407Y25lTxi/PqzPKHo61zQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.11.31.tgz", - "integrity": "sha512-DDVE0LZcXOWwOqFU1Xi7gdtiUg3FHA0vbGb3trjWCuI1ZtDZHEQYL4M3/2FjqKZtIwASrDvO96w91okZbXhvMg==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-linux-x64-musl": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.11.31.tgz", - "integrity": "sha512-mJA1MzPPRIfaBUHZi0xJQ4vwL09MNWDeFtxXb0r4Yzpf0v5Lue9ymumcBPmw/h6TKWms+Non4+TDquAsweuKSw==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.11.31.tgz", - "integrity": "sha512-RdtakUkNVAb/FFIMw3LnfNdlH1/ep6KgiPDRlmyUfd0WdIQ3OACmeBegEFNFTzi7gEuzy2Yxg4LWf4IUVk8/bg==", - "cpu": [ - "arm64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.11.31.tgz", - "integrity": "sha512-hErXdCGsg7swWdG1fossuL8542I59xV+all751mYlBoZ8kOghLSKObGQTkBbuNvc0sUKWfWg1X0iBuIhAYar+w==", - "cpu": [ - "ia32" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.11.31", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.11.31.tgz", - "integrity": "sha512-5t7SGjUBMMhF9b5j17ml/f/498kiBJNf4vZFNM421UGUEETdtjPN9jZIuQrowBkoFGJTCVL/ECM4YRtTH30u/A==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=10" - } - }, - "node_modules/@swc/counter": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@swc/counter/-/counter-0.1.3.tgz", - "integrity": "sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==", - "dev": true - }, "node_modules/@swc/helpers": { "version": "0.5.17", "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz", "integrity": "sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A==", + "license": "Apache-2.0", "dependencies": { "tslib": "^2.8.0" } }, - "node_modules/@swc/types": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.22.tgz", - "integrity": "sha512-D13mY/ZA4PPEFSy6acki9eBT/3WgjMoRqNcdpIvjaYLQ44Xk5BdaL7UkDxAh6Z9UOe7tCCp67BVmZCojYp9owg==", - "dev": true, - "dependencies": { - "@swc/counter": "^0.1.3" - } - }, "node_modules/@textlint/ast-node-types": { - "version": "14.8.4", - "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-14.8.4.tgz", - "integrity": "sha512-+fI7miec/r9VeniFV9ppL4jRCmHNsTxieulTUf/4tvGII3db5hGriKHC4p/diq1SkQ9Sgs7kg6UyydxZtpTz1Q==", - "dev": true + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/@textlint/ast-node-types/-/ast-node-types-15.4.1.tgz", + "integrity": "sha512-XifMpBMdo0E1Fuh85YdcYAgy+okNg9WKBzIPIO4JUDnSWUVFihnogrM4cjDapeHkgzSgulwR8oJVJ17eyxI1bA==", + "dev": true, + "license": "MIT" }, "node_modules/@textlint/linter-formatter": { - "version": "14.8.4", - "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-14.8.4.tgz", - "integrity": "sha512-sZ0UfYRDBNHnfMVBqLqqYnqTB7Ec169ljlmo+SEHR1T+dHUPYy1/DZK4p7QREXlBSFL4cnkswETCbc9xRodm4Q==", + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/@textlint/linter-formatter/-/linter-formatter-15.4.1.tgz", + "integrity": "sha512-kAV7Sup3vwvqxKvBbf9lx/JaPHkRybQp/LLvA73U1AorPZE6XyfBAFG24BbMiCs4OX1ax4g7kXRuFPgMLWRf+g==", "dev": true, + "license": "MIT", "dependencies": { "@azu/format-text": "^1.0.2", "@azu/style-format": "^1.0.1", - "@textlint/module-interop": "14.8.4", - "@textlint/resolver": "14.8.4", - "@textlint/types": "14.8.4", + "@textlint/module-interop": "15.4.1", + "@textlint/resolver": "15.4.1", + "@textlint/types": "15.4.1", "chalk": "^4.1.2", - "debug": "^4.4.1", - "js-yaml": "^3.14.1", + "debug": "^4.4.3", + "js-yaml": "^4.1.0", "lodash": "^4.17.21", "pluralize": "^2.0.0", "string-width": "^4.2.3", @@ -3897,74 +2730,58 @@ "text-table": "^0.2.0" } }, - "node_modules/@textlint/linter-formatter/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/@textlint/linter-formatter/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/@textlint/linter-formatter/node_modules/js-yaml": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", - "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "node_modules/@textlint/linter-formatter/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "engines": { + "node": ">=8" } }, "node_modules/@textlint/linter-formatter/node_modules/pluralize": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-2.0.0.tgz", "integrity": "sha512-TqNZzQCD4S42De9IfnnBvILN7HAW7riLqsCyp8lgjXeysyPlX5HhqKAcJHHHb9XskE4/a+7VGC9zzx8Ls0jOAw==", - "dev": true + "dev": true, + "license": "MIT" }, - "node_modules/@textlint/linter-formatter/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "node_modules/@textlint/linter-formatter/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "ansi-regex": "^5.0.1" }, "engines": { "node": ">=8" } }, "node_modules/@textlint/module-interop": { - "version": "14.8.4", - "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-14.8.4.tgz", - "integrity": "sha512-1LdPYLAVpa27NOt6EqvuFO99s4XLB0c19Hw9xKSG6xQ1K82nUEyuWhzTQKb3KJ5Qx7qj14JlXZLfnEuL6A16Bw==", - "dev": true + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/@textlint/module-interop/-/module-interop-15.4.1.tgz", + "integrity": "sha512-jHtM2E5CR68P3z/+FGrEU5pml2fQVzEo2sez9FEjrVHSPCrHtqHcPaKfsYbQJjc9C48ObwaWrCzRNaL3KedNCQ==", + "dev": true, + "license": "MIT" }, "node_modules/@textlint/resolver": { - "version": "14.8.4", - "resolved": "https://registry.npmjs.org/@textlint/resolver/-/resolver-14.8.4.tgz", - "integrity": "sha512-nMDOgDAVwNU9ommh+Db0U+MCMNDPbQ/1HBNjbnHwxZkCpcT6hsAJwBe38CW/DtWVUv8yeR4R40IYNPT84srNwA==", - "dev": true + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/@textlint/resolver/-/resolver-15.4.1.tgz", + "integrity": "sha512-uVssyG3XXXKNY+O7NOajGvQZTyOuhPviwlq7Xek6ZT9K1eDQtA8074cPkAQoLMYhi/TUyOE5P5kpz42UF8Lmdw==", + "dev": true, + "license": "MIT" }, "node_modules/@textlint/types": { - "version": "14.8.4", - "resolved": "https://registry.npmjs.org/@textlint/types/-/types-14.8.4.tgz", - "integrity": "sha512-9nyY8vVXlr8hHKxa6+37omJhXWCwovMQcgMteuldYd4dOxGm14AK2nXdkgtKEUQnzLGaXy46xwLCfhQy7V7/YA==", + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/@textlint/types/-/types-15.4.1.tgz", + "integrity": "sha512-WByVZ3zblbvuI+voWQplUP7seSTKXI9z6TMVXEB3dY3JFrZCIXWKNfLbETX5lZV7fYkCMaDtILO1l6s11wdbQA==", "dev": true, + "license": "MIT", "dependencies": { - "@textlint/ast-node-types": "14.8.4" + "@textlint/ast-node-types": "15.4.1" } }, "node_modules/@tootallnate/once": { @@ -3972,6 +2789,7 @@ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 6" } @@ -3981,34 +2799,17 @@ "resolved": "https://registry.npmjs.org/@types/azdata/-/azdata-1.46.6.tgz", "integrity": "sha512-lOvRgMxrYuia+8l3EB+j5IaeGLHubmNf3RgGu9OmAxGAyXayjhZLoNAEjqNnVy/MmA35lwAXDpv2PDbNpCCnDA==", "dev": true, + "license": "MIT", "dependencies": { "@types/vscode": "*" } }, - "node_modules/@types/body-parser": { - "version": "1.19.5", - "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz", - "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==", - "dev": true, - "dependencies": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "node_modules/@types/bonjour": { - "version": "3.5.13", - "resolved": "https://registry.npmjs.org/@types/bonjour/-/bonjour-3.5.13.tgz", - "integrity": "sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/buble": { "version": "0.19.2", "resolved": "https://registry.npmjs.org/@types/buble/-/buble-0.19.2.tgz", "integrity": "sha512-uUD8zIfXMKThmFkahTXDGI3CthFH1kMg2dOm3KLi4GlC5cbARA64bEcUMbbWdWdE73eoc/iBB9PiTMqH0dNS2Q==", "dev": true, + "license": "MIT", "dependencies": { "magic-string": "^0.25.0" } @@ -4016,64 +2817,40 @@ "node_modules/@types/buble/node_modules/magic-string": { "version": "0.25.9", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", - "dev": true, - "dependencies": { - "sourcemap-codec": "^1.4.8" - } - }, - "node_modules/@types/command-line-args": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@types/command-line-args/-/command-line-args-5.2.0.tgz", - "integrity": "sha512-UuKzKpJJ/Ief6ufIaIzr3A/0XnluX7RvFgwkV89Yzvm77wCh1kFaFmqN8XEnGcN62EuHdedQjEMb8mYxFLGPyA==" - }, - "node_modules/@types/command-line-usage": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@types/command-line-usage/-/command-line-usage-5.0.2.tgz", - "integrity": "sha512-n7RlEEJ+4x4TS7ZQddTmNSxP+zziEG0TNsMfiRIxcIVXt71ENJ9ojeXmGO3wPoTdn7pJcU2xc3CJYMktNT6DPg==" - }, - "node_modules/@types/connect": { - "version": "3.4.38", - "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz", - "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/connect-history-api-fallback": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/@types/connect-history-api-fallback/-/connect-history-api-fallback-1.5.4.tgz", - "integrity": "sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", "dev": true, + "license": "MIT", "dependencies": { - "@types/express-serve-static-core": "*", - "@types/node": "*" + "sourcemap-codec": "^1.4.8" } }, "node_modules/@types/d3-color": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/d3-ease": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/d3-format": { "version": "1.4.5", "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-1.4.5.tgz", "integrity": "sha512-mLxrC1MSWupOSncXN/HOlWUAAIffAEBaI4+PKy2uMPsKe4FNZlk7qrbTjmzJXITQQqBHivaks4Td18azgqnotA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/d3-scale": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz", - "integrity": "sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ==", + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", "dev": true, + "license": "MIT", "dependencies": { "@types/d3-time": "*" } @@ -4082,13 +2859,15 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/eslint": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz", "integrity": "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==", "dev": true, + "license": "MIT", "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -4099,154 +2878,76 @@ "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.7.tgz", "integrity": "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==", "dev": true, + "license": "MIT", "dependencies": { "@types/eslint": "*", "@types/estree": "*" } }, "node_modules/@types/estree": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", - "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" - }, - "node_modules/@types/express": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz", - "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==", - "dev": true, - "dependencies": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.33", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "node_modules/@types/express-serve-static-core": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.2.tgz", - "integrity": "sha512-vluaspfvWEtE4vcSDlKRNer52DvOGrB2xv6diXy6UKyKW0lqZiWHGNApSyxOv+8DE5Z27IzVvE7hNkxg7EXIcg==", - "dev": true, - "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*", - "@types/send": "*" - } - }, - "node_modules/@types/express/node_modules/@types/express-serve-static-core": { - "version": "4.19.6", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz", - "integrity": "sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==", - "dev": true, - "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*", - "@types/send": "*" - } - }, - "node_modules/@types/flatbuffers": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/@types/flatbuffers/-/flatbuffers-1.10.3.tgz", - "integrity": "sha512-kwJQsAROanCiMXSLjcTLmYVBIJ9Qyuqs92SaDIcj2EII2KnDgZbiU7it1Z/JfZd1gmxw/lAahMysQ6ZM+j3Ryw==" + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" }, "node_modules/@types/geojson": { - "version": "7946.0.4", - "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.4.tgz", - "integrity": "sha512-MHmwBtCb7OCv1DSivz2UNJXPGU/1btAWRKlqJ2saEhVJkpkvqHMMaOpKg0v4sAbDWSQekHGvPVMM8nQ+Jen03Q==" + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" }, "node_modules/@types/hammerjs": { "version": "2.0.46", "resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.46.tgz", - "integrity": "sha512-ynRvcq6wvqexJ9brDMS4BnBLzmr0e14d6ZJTEShTBWKymQiHwlAyGu0ZPEFI2Fh1U53F7tN9ufClWM5KvqkKOw==" - }, - "node_modules/@types/http-errors": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz", - "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==", - "dev": true - }, - "node_modules/@types/http-proxy": { - "version": "1.17.15", - "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.15.tgz", - "integrity": "sha512-25g5atgiVNTIv0LBDTg1H74Hvayx0ajtJPLLcYE3whFv75J0pWNtOBzaXJQgDTmrX1bx5U9YC2w/n65BN1HwRQ==", - "dev": true, - "dependencies": { - "@types/node": "*" - } + "integrity": "sha512-ynRvcq6wvqexJ9brDMS4BnBLzmr0e14d6ZJTEShTBWKymQiHwlAyGu0ZPEFI2Fh1U53F7tN9ufClWM5KvqkKOw==", + "license": "MIT" }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, - "node_modules/@types/mime": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz", - "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==", - "dev": true - }, - "node_modules/@types/node": { - "version": "22.10.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", - "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", "dev": true, - "dependencies": { - "undici-types": "~6.20.0" - } + "license": "MIT" }, - "node_modules/@types/node-forge": { - "version": "1.3.11", - "resolved": "https://registry.npmjs.org/@types/node-forge/-/node-forge-1.3.11.tgz", - "integrity": "sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==", + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", "dev": true, + "license": "MIT", "dependencies": { - "@types/node": "*" + "undici-types": "~7.16.0" } }, "node_modules/@types/normalize-package-data": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", - "dev": true - }, - "node_modules/@types/pad-left": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@types/pad-left/-/pad-left-2.1.1.tgz", - "integrity": "sha512-Xd22WCRBydkGSApl5Bw0PhAOHKSVjNL3E3AwzKaps96IMraPqy5BvZIsBVK6JLwdybUzjHnuWVwpDd0JjTfHXA==" + "dev": true, + "license": "MIT" }, "node_modules/@types/prop-types": { - "version": "15.7.14", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz", - "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==" - }, - "node_modules/@types/qs": { - "version": "6.9.17", - "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.17.tgz", - "integrity": "sha512-rX4/bPcfmvxHDv0XjfJELTTr+iB+tn032nPILqHm5wbthUUUuVtNGGqzhya9XUxjTP8Fpr0qYgSZZKxGY++svQ==", - "dev": true - }, - "node_modules/@types/range-parser": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", - "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", - "dev": true + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "license": "MIT" }, "node_modules/@types/react": { - "version": "17.0.83", - "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.83.tgz", - "integrity": "sha512-l0m4ArKJvmFtR4e8UmKrj1pB4tUgOhJITf+mADyF/p69Ts1YAR/E+G9XEM0mHXKVRa1dQNHseyyDNzeuAXfXQw==", + "version": "17.0.90", + "resolved": "https://registry.npmjs.org/@types/react/-/react-17.0.90.tgz", + "integrity": "sha512-P9beVR/x06U9rCJzSxtENnOr4BrbJ6VrsrDTc+73TtHv9XHhryXKbjGRB+6oooB2r0G/pQkD/S4dHo/7jUfwFw==", + "license": "MIT", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "^0.16", - "csstype": "^3.0.2" + "csstype": "^3.2.2" } }, "node_modules/@types/react-dom": { "version": "17.0.26", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.26.tgz", "integrity": "sha512-Z+2VcYXJwOqQ79HreLU/1fyQ88eXSSFh6I3JdrEHQIfYSI0kCQpTGvOrbE6jFGGYXKsHuwY9tBa/w5Uo6KzrEg==", + "license": "MIT", "peerDependencies": { "@types/react": "^17.0.0" } @@ -4255,69 +2956,28 @@ "version": "1.20.2", "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", - "dev": true - }, - "node_modules/@types/retry": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.2.tgz", - "integrity": "sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/sarif": { "version": "2.1.7", "resolved": "https://registry.npmjs.org/@types/sarif/-/sarif-2.1.7.tgz", "integrity": "sha512-kRz0VEkJqWLf1LLVN4pT1cg1Z9wAuvI6L97V3m2f5B76Tg8d413ddvLBPTEHAZJlnn4XSvu0FkZtViCQGVyrXQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/scheduler": { "version": "0.16.8", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", - "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==" - }, - "node_modules/@types/send": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz", - "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==", - "dev": true, - "dependencies": { - "@types/mime": "^1", - "@types/node": "*" - } - }, - "node_modules/@types/serve-index": { - "version": "1.9.4", - "resolved": "https://registry.npmjs.org/@types/serve-index/-/serve-index-1.9.4.tgz", - "integrity": "sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==", - "dev": true, - "dependencies": { - "@types/express": "*" - } - }, - "node_modules/@types/serve-static": { - "version": "1.15.7", - "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz", - "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==", - "dev": true, - "dependencies": { - "@types/http-errors": "*", - "@types/node": "*", - "@types/send": "*" - } - }, - "node_modules/@types/sockjs": { - "version": "0.3.36", - "resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz", - "integrity": "sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==", - "dev": true, - "dependencies": { - "@types/node": "*" - } + "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==", + "license": "MIT" }, "node_modules/@types/temp-write": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/@types/temp-write/-/temp-write-3.3.0.tgz", "integrity": "sha512-RW+6TTQi6GVmOmpMoizl0Nfg8yhtPPGJQs8QtzW7eBH5XyoEM30GrUq4weYpEzITH2UrbGTd2Sn/5LRGlGPHrg==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*" } @@ -4326,13 +2986,15 @@ "version": "2.0.11", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/vfile": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/vfile/-/vfile-3.0.2.tgz", "integrity": "sha512-b3nLFGaGkJ9rzOcuXRfHkZMdjsawuDD0ENL9fzTophtBg8FJHSGbH7daXkEpcwy3v7Xol3pAvsmlYyFhR4pqJw==", "dev": true, + "license": "MIT", "dependencies": { "@types/node": "*", "@types/unist": "*", @@ -4340,46 +3002,41 @@ } }, "node_modules/@types/vfile-message": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@types/vfile-message/-/vfile-message-2.0.0.tgz", - "integrity": "sha512-GpTIuDpb9u4zIO165fUy9+fXcULdD8HFRNli04GehoMVbeNq7D6OBnqSmg3lxZnC+UvgUhEWKxdKiwYUkGltIw==", - "deprecated": "This is a stub types definition. vfile-message provides its own type definitions, so you do not need this installed.", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/vfile-message/-/vfile-message-1.0.1.tgz", + "integrity": "sha512-mlGER3Aqmq7bqR1tTTIVHq8KSAFFRyGbrxuM8C/H82g6k7r2fS+IMEkIu3D7JHzG10NvPdR8DNx0jr0pwpp4dA==", "dev": true, + "license": "MIT", "dependencies": { - "vfile-message": "*" + "@types/node": "*", + "@types/unist": "*" } }, "node_modules/@types/vscode": { - "version": "1.96.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.96.0.tgz", - "integrity": "sha512-qvZbSZo+K4ZYmmDuaodMbAa67Pl6VDQzLKFka6rq+3WUTY4Kro7Bwoi0CuZLO/wema0ygcmpwow7zZfPJTs5jg==", - "dev": true + "version": "1.106.1", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.106.1.tgz", + "integrity": "sha512-R/HV8u2h8CAddSbX8cjpdd7B8/GnE4UjgjpuGuHcbp1xV6yh4OeqU4L1pKjlwujCrSFS0MOpwJAIs/NexMB1fQ==", + "dev": true, + "license": "MIT" }, "node_modules/@types/webxr": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.4.0.tgz", - "integrity": "sha512-LQvrACV3Pj17GpkwHwXuTd733gfY+D7b9mKdrTmLdO7vo7P/o6209Qqtk63y/FCv/lspdmi0pWz6Qe/ull9kQg==" - }, - "node_modules/@types/ws": { - "version": "8.5.13", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", - "integrity": "sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==", - "dev": true, - "dependencies": { - "@types/node": "*" - } + "integrity": "sha512-LQvrACV3Pj17GpkwHwXuTd733gfY+D7b9mKdrTmLdO7vo7P/o6209Qqtk63y/FCv/lspdmi0pWz6Qe/ull9kQg==", + "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.33.1.tgz", - "integrity": "sha512-TDCXj+YxLgtvxvFlAvpoRv9MAncDLBV2oT9Bd7YBGC/b/sEURoOYuIwLI99rjWOfY3QtDzO+mk0n4AmdFExW8A==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.1.tgz", + "integrity": "sha512-X63hI1bxl5ohelzr0LY5coufyl0LJNthld+abwxpCoo6Gq+hSqhKwci7MUWkXo67mzgUK6YFByhmaHmUcuBJmA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.33.1", - "@typescript-eslint/type-utils": "8.33.1", - "@typescript-eslint/utils": "8.33.1", - "@typescript-eslint/visitor-keys": "8.33.1", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/type-utils": "8.48.1", + "@typescript-eslint/utils": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", @@ -4393,21 +3050,22 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.33.1", + "@typescript-eslint/parser": "^8.48.1", "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/parser": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.33.1.tgz", - "integrity": "sha512-qwxv6dq682yVvgKKp2qWwLgRbscDAYktPptK4JPojCwwi3R9cwrvIxS4lvBpzmcqzR4bdn54Z0IG1uHFskW4dA==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.1.tgz", + "integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "8.33.1", - "@typescript-eslint/types": "8.33.1", - "@typescript-eslint/typescript-estree": "8.33.1", - "@typescript-eslint/visitor-keys": "8.33.1", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", "debug": "^4.3.4" }, "engines": { @@ -4419,17 +3077,18 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.33.1.tgz", - "integrity": "sha512-DZR0efeNklDIHHGRpMpR5gJITQpu6tLr9lDJnKdONTC7vvzOlLAG/wcfxcdxEWrbiZApcoBCzXqU/Z458Za5Iw==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.1.tgz", + "integrity": "sha512-HQWSicah4s9z2/HifRPQ6b6R7G+SBx64JlFQpgSSHWPKdvCZX57XCbszg/bapbRsOEv42q5tayTYcEFpACcX1w==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.33.1", - "@typescript-eslint/types": "^8.33.1", + "@typescript-eslint/tsconfig-utils": "^8.48.1", + "@typescript-eslint/types": "^8.48.1", "debug": "^4.3.4" }, "engines": { @@ -4440,17 +3099,18 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.33.1.tgz", - "integrity": "sha512-dM4UBtgmzHR9bS0Rv09JST0RcHYearoEoo3pG5B6GoTR9XcyeqX87FEhPo+5kTvVfKCvfHaHrcgeJQc6mrDKrA==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.48.1.tgz", + "integrity": "sha512-rj4vWQsytQbLxC5Bf4XwZ0/CKd362DkWMUkviT7DCS057SK64D5lH74sSGzhI6PDD2HCEq02xAP9cX68dYyg1w==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.33.1", - "@typescript-eslint/visitor-keys": "8.33.1" + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4461,10 +3121,11 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.33.1.tgz", - "integrity": "sha512-STAQsGYbHCF0/e+ShUQ4EatXQ7ceh3fBCXkNU7/MZVKulrlq1usH7t2FhxvCpuCi5O5oi1vmVaAjrGeL71OK1g==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.1.tgz", + "integrity": "sha512-k0Jhs4CpEffIBm6wPaCXBAD7jxBtrHjrSgtfCjUvPp9AZ78lXKdTR8fxyZO5y4vWNlOvYXRtngSZNSn+H53Jkw==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -4473,17 +3134,19 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.33.1.tgz", - "integrity": "sha512-1cG37d9xOkhlykom55WVwG2QRNC7YXlxMaMzqw2uPeJixBFfKWZgaP/hjAObqMN/u3fr5BrTwTnc31/L9jQ2ww==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.48.1.tgz", + "integrity": "sha512-1jEop81a3LrJQLTf/1VfPQdhIY4PlGDBc/i67EVWObrtvcziysbLN3oReexHOM6N3jyXgCrkBsZpqwH0hiDOQg==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.33.1", - "@typescript-eslint/utils": "8.33.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/utils": "8.48.1", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, @@ -4496,14 +3159,15 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/types": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.33.1.tgz", - "integrity": "sha512-xid1WfizGhy/TKMTwhtVOgalHwPtV8T32MS9MaH50Cwvz6x6YqRIPdD2WvW0XaqOzTV9p5xdLY0h/ZusU5Lokg==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.1.tgz", + "integrity": "sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q==", "dev": true, + "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -4513,20 +3177,20 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.33.1.tgz", - "integrity": "sha512-+s9LYcT8LWjdYWu7IWs7FvUxpQ/DGkdjZeE/GGulHvv8rvYwQvVaUZ6DE+j5x/prADUgSbbCWZ2nPI3usuVeOA==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.1.tgz", + "integrity": "sha512-/9wQ4PqaefTK6POVTjJaYS0bynCgzh6ClJHGSBj06XEHjkfylzB+A3qvyaXnErEZSaxhIo4YdyBgq6j4RysxDg==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/project-service": "8.33.1", - "@typescript-eslint/tsconfig-utils": "8.33.1", - "@typescript-eslint/types": "8.33.1", - "@typescript-eslint/visitor-keys": "8.33.1", + "@typescript-eslint/project-service": "8.48.1", + "@typescript-eslint/tsconfig-utils": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", "debug": "^4.3.4", - "fast-glob": "^3.3.2", - "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", + "tinyglobby": "^0.2.15", "ts-api-utils": "^2.1.0" }, "engines": { @@ -4537,43 +3201,20 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "typescript": ">=4.8.4 <5.9.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/utils": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.33.1.tgz", - "integrity": "sha512-52HaBiEQUaRYqAXpfzWSR2U3gxk92Kw006+xZpElaPMg3C4PgM+A5LqwoQI1f9E5aZ/qlxAZxzm42WX+vn92SQ==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.48.1.tgz", + "integrity": "sha512-fAnhLrDjiVfey5wwFRwrweyRlCmdz5ZxXz2G/4cLn0YDLjTapmN4gcCsTBR1N2rWnZSDeWpYtgLDsJt+FpmcwA==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.33.1", - "@typescript-eslint/types": "8.33.1", - "@typescript-eslint/typescript-estree": "8.33.1" + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4584,17 +3225,18 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <5.9.0" + "typescript": ">=4.8.4 <6.0.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.33.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.33.1.tgz", - "integrity": "sha512-3i8NrFcZeeDHJ+7ZUuDkGT+UHq+XoFGsymNK2jZCOHcfEzRQ0BdpRtdpSx/Iyf3MHLWIcLS0COuOPibKQboIiQ==", + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.48.1.tgz", + "integrity": "sha512-BmxxndzEWhE4TIEEMBs8lP3MBWN3jFPs/p6gPm/wkv02o41hI6cq9AuSmGAaTTHPtA1FTi2jBre4A9rm5ZmX+Q==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.33.1", - "eslint-visitor-keys": "^4.2.0" + "@typescript-eslint/types": "8.48.1", + "eslint-visitor-keys": "^4.2.1" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -4605,10 +3247,11 @@ } }, "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -4617,17 +3260,18 @@ } }, "node_modules/@typespec/ts-http-runtime": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.2.3.tgz", - "integrity": "sha512-oRhjSzcVjX8ExyaF8hC0zzTqxlVuRlgMHL/Bh4w3xB9+wjbm0FpXylVU/lBrn+kgphwYTrOk3tp+AVShGmlYCg==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.2.tgz", + "integrity": "sha512-IlqQ/Gv22xUC1r/WQm4StLkYQmaaTsXAhUVsNE0+xiyf0yRFiH5++q78U3bw6bLKDCTmh0uqKB9eG9+Bt75Dkg==", "dev": true, + "license": "MIT", "dependencies": { "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.0", "tslib": "^2.6.2" }, "engines": { - "node": ">=18.0.0" + "node": ">=20.0.0" } }, "node_modules/@uifabric/merge-styles": { @@ -4635,6 +3279,7 @@ "resolved": "https://registry.npmjs.org/@uifabric/merge-styles/-/merge-styles-7.20.2.tgz", "integrity": "sha512-cJy8hW9smlWOKgz9xSDMCz/A0yMl4mdo466pcGlIOn84vz+e94grfA7OoTuTzg3Cl0Gj6ODBSf1o0ZwIXYL1Xg==", "dev": true, + "license": "MIT", "dependencies": { "@uifabric/set-version": "^7.0.24", "tslib": "^1.10.0" @@ -4644,13 +3289,15 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@uifabric/set-version": { "version": "7.0.24", "resolved": "https://registry.npmjs.org/@uifabric/set-version/-/set-version-7.0.24.tgz", "integrity": "sha512-t0Pt21dRqdC707/ConVJC0WvcQ/KF7tKLU8AZY7YdjgJpMHi1c0C427DB4jfUY19I92f60LOQyhJ4efH+KpFEg==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.10.0" } @@ -4659,13 +3306,15 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@uifabric/styling": { "version": "7.25.1", "resolved": "https://registry.npmjs.org/@uifabric/styling/-/styling-7.25.1.tgz", "integrity": "sha512-bd4QDYyb0AS0+KmzrB8VsAfOkxZg0dpEpF1YN5Ben10COmT8L1DoE4bEF5NvybHEaoTd3SKxpJ42m+ceNzehSw==", "dev": true, + "license": "MIT", "dependencies": { "@fluentui/theme": "^1.7.13", "@microsoft/load-themed-styles": "^1.10.26", @@ -4680,6 +3329,7 @@ "resolved": "https://registry.npmjs.org/@fluentui/theme/-/theme-1.7.13.tgz", "integrity": "sha512-/1ZDHZNzV7Wgohay47DL9TAH4uuib5+B2D6Rxoc3T6ULoWcFzwLeVb+VZB/WOCTUbG+NGTrmsWPBOz5+lbuOxA==", "dev": true, + "license": "MIT", "dependencies": { "@uifabric/merge-styles": "^7.20.2", "@uifabric/set-version": "^7.0.24", @@ -4697,13 +3347,15 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@uifabric/utilities": { "version": "7.38.2", "resolved": "https://registry.npmjs.org/@uifabric/utilities/-/utilities-7.38.2.tgz", "integrity": "sha512-5yM4sm142VEBg3/Q5SFheBXqnrZi9CNF5rjHNoex0GgGtG3AHPuS7U8gjm+/Io1MvbuCrn6lyyIw0MDvh1Ebkw==", "dev": true, + "license": "MIT", "dependencies": { "@fluentui/dom-utilities": "^1.1.2", "@uifabric/merge-styles": "^7.20.2", @@ -4723,6 +3375,7 @@ "resolved": "https://registry.npmjs.org/@fluentui/dom-utilities/-/dom-utilities-1.1.2.tgz", "integrity": "sha512-XqPS7l3YoMwxdNlaYF6S2Mp0K3FmVIOIy2K3YkMc+eRxu9wFK6emr2Q/3rBhtG5u/On37NExRT7/5CTLnoi9gw==", "dev": true, + "license": "MIT", "dependencies": { "@uifabric/set-version": "^7.0.24", "tslib": "^1.10.0" @@ -4732,19 +3385,21 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/@vscode/vsce": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.6.0.tgz", - "integrity": "sha512-u2ZoMfymRNJb14aHNawnXJtXHLXDVKc1oKZaH4VELKT/9iWKRVgtQOdwxCgtwSxJoqYvuK4hGlBWQJ05wxADhg==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-3.7.1.tgz", + "integrity": "sha512-OTm2XdMt2YkpSn2Nx7z2EJtSuhRHsTPYsSK59hr3v8jRArK+2UEoju4Jumn1CmpgoBLGI6ReHLJ/czYltNUW3g==", "dev": true, + "license": "MIT", "dependencies": { "@azure/identity": "^4.1.0", - "@secretlint/node": "^10.1.1", - "@secretlint/secretlint-formatter-sarif": "^10.1.1", - "@secretlint/secretlint-rule-no-dotenv": "^10.1.1", - "@secretlint/secretlint-rule-preset-recommend": "^10.1.1", + "@secretlint/node": "^10.1.2", + "@secretlint/secretlint-formatter-sarif": "^10.1.2", + "@secretlint/secretlint-rule-no-dotenv": "^10.1.2", + "@secretlint/secretlint-rule-preset-recommend": "^10.1.2", "@vscode/vsce-sign": "^2.0.0", "azure-devops-node-api": "^12.5.0", "chalk": "^4.1.2", @@ -4761,7 +3416,7 @@ "minimatch": "^3.0.3", "parse-semver": "^1.1.1", "read": "^1.0.7", - "secretlint": "^10.1.1", + "secretlint": "^10.1.2", "semver": "^7.5.2", "tmp": "^0.2.3", "typed-rest-client": "^1.8.4", @@ -4781,145 +3436,220 @@ } }, "node_modules/@vscode/vsce-sign": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.6.tgz", - "integrity": "sha512-j9Ashk+uOWCDHYDxgGsqzKq5FXW9b9MW7QqOIYZ8IYpneJclWTBeHZz2DJCSKQgo+JAqNcaRRE1hzIx0dswqAw==", + "version": "2.0.9", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.0.9.tgz", + "integrity": "sha512-8IvaRvtFyzUnGGl3f5+1Cnor3LqaUWvhaUjAYO8Y39OUYlOf3cRd+dowuQYLpZcP3uwSG+mURwjEBOSq4SOJ0g==", "dev": true, "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE.txt", "optionalDependencies": { - "@vscode/vsce-sign-alpine-arm64": "2.0.5", - "@vscode/vsce-sign-alpine-x64": "2.0.5", - "@vscode/vsce-sign-darwin-arm64": "2.0.5", - "@vscode/vsce-sign-darwin-x64": "2.0.5", - "@vscode/vsce-sign-linux-arm": "2.0.5", - "@vscode/vsce-sign-linux-arm64": "2.0.5", - "@vscode/vsce-sign-linux-x64": "2.0.5", - "@vscode/vsce-sign-win32-arm64": "2.0.5", - "@vscode/vsce-sign-win32-x64": "2.0.5" + "@vscode/vsce-sign-alpine-arm64": "2.0.6", + "@vscode/vsce-sign-alpine-x64": "2.0.6", + "@vscode/vsce-sign-darwin-arm64": "2.0.6", + "@vscode/vsce-sign-darwin-x64": "2.0.6", + "@vscode/vsce-sign-linux-arm": "2.0.6", + "@vscode/vsce-sign-linux-arm64": "2.0.6", + "@vscode/vsce-sign-linux-x64": "2.0.6", + "@vscode/vsce-sign-win32-arm64": "2.0.6", + "@vscode/vsce-sign-win32-x64": "2.0.6" } }, "node_modules/@vscode/vsce-sign-alpine-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.5.tgz", - "integrity": "sha512-XVmnF40APwRPXSLYA28Ye+qWxB25KhSVpF2eZVtVOs6g7fkpOxsVnpRU1Bz2xG4ySI79IRuapDJoAQFkoOgfdQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.6.tgz", + "integrity": "sha512-wKkJBsvKF+f0GfsUuGT0tSW0kZL87QggEiqNqK6/8hvqsXvpx8OsTEc3mnE1kejkh5r+qUyQ7PtF8jZYN0mo8Q==", "cpu": [ "arm64" ], "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "optional": true, "os": [ "alpine" ] }, "node_modules/@vscode/vsce-sign-alpine-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.5.tgz", - "integrity": "sha512-JuxY3xcquRsOezKq6PEHwCgd1rh1GnhyH6urVEWUzWn1c1PC4EOoyffMD+zLZtFuZF5qR1I0+cqDRNKyPvpK7Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.6.tgz", + "integrity": "sha512-YoAGlmdK39vKi9jA18i4ufBbd95OqGJxRvF3n6ZbCyziwy3O+JgOpIUPxv5tjeO6gQfx29qBivQ8ZZTUF2Ba0w==", "cpu": [ "x64" ], "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "optional": true, "os": [ "alpine" ] }, "node_modules/@vscode/vsce-sign-darwin-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.5.tgz", - "integrity": "sha512-z2Q62bk0ptADFz8a0vtPvnm6vxpyP3hIEYMU+i1AWz263Pj8Mc38cm/4sjzxu+LIsAfhe9HzvYNS49lV+KsatQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.6.tgz", + "integrity": "sha512-5HMHaJRIQuozm/XQIiJiA0W9uhdblwwl2ZNDSSAeXGO9YhB9MH5C4KIHOmvyjUnKy4UCuiP43VKpIxW1VWP4tQ==", "cpu": [ "arm64" ], "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "optional": true, "os": [ "darwin" ] }, "node_modules/@vscode/vsce-sign-darwin-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.5.tgz", - "integrity": "sha512-ma9JDC7FJ16SuPXlLKkvOD2qLsmW/cKfqK4zzM2iJE1PbckF3BlR08lYqHV89gmuoTpYB55+z8Y5Fz4wEJBVDA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.6.tgz", + "integrity": "sha512-25GsUbTAiNfHSuRItoQafXOIpxlYj+IXb4/qarrXu7kmbH94jlm5sdWSCKrrREs8+GsXF1b+l3OB7VJy5jsykw==", "cpu": [ "x64" ], "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "optional": true, "os": [ "darwin" ] }, "node_modules/@vscode/vsce-sign-linux-arm": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.5.tgz", - "integrity": "sha512-cdCwtLGmvC1QVrkIsyzv01+o9eR+wodMJUZ9Ak3owhcGxPRB53/WvrDHAFYA6i8Oy232nuen1YqWeEohqBuSzA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.6.tgz", + "integrity": "sha512-UndEc2Xlq4HsuMPnwu7420uqceXjs4yb5W8E2/UkaHBB9OWCwMd3/bRe/1eLe3D8kPpxzcaeTyXiK3RdzS/1CA==", "cpu": [ "arm" ], "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "optional": true, "os": [ "linux" ] }, "node_modules/@vscode/vsce-sign-linux-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.5.tgz", - "integrity": "sha512-Hr1o0veBymg9SmkCqYnfaiUnes5YK6k/lKFA5MhNmiEN5fNqxyPUCdRZMFs3Ajtx2OFW4q3KuYVRwGA7jdLo7Q==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.6.tgz", + "integrity": "sha512-cfb1qK7lygtMa4NUl2582nP7aliLYuDEVpAbXJMkDq1qE+olIw/es+C8j1LJwvcRq1I2yWGtSn3EkDp9Dq5FdA==", "cpu": [ "arm64" ], "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "optional": true, "os": [ "linux" ] }, "node_modules/@vscode/vsce-sign-linux-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.5.tgz", - "integrity": "sha512-XLT0gfGMcxk6CMRLDkgqEPTyG8Oa0OFe1tPv2RVbphSOjFWJwZgK3TYWx39i/7gqpDHlax0AP6cgMygNJrA6zg==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.6.tgz", + "integrity": "sha512-/olerl1A4sOqdP+hjvJ1sbQjKN07Y3DVnxO4gnbn/ahtQvFrdhUi0G1VsZXDNjfqmXw57DmPi5ASnj/8PGZhAA==", "cpu": [ "x64" ], "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", "optional": true, "os": [ "linux" ] }, - "node_modules/@vscode/vsce-sign-win32-arm64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.5.tgz", - "integrity": "sha512-hco8eaoTcvtmuPhavyCZhrk5QIcLiyAUhEso87ApAWDllG7djIrWiOCtqn48k4pHz+L8oCQlE0nwNHfcYcxOPw==", - "cpu": [ - "arm64" - ], + "node_modules/@vscode/vsce-sign-win32-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.6.tgz", + "integrity": "sha512-ivM/MiGIY0PJNZBoGtlRBM/xDpwbdlCWomUWuLmIxbi1Cxe/1nooYrEQoaHD8ojVRgzdQEUzMsRbyF5cJJgYOg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@vscode/vsce-sign-win32-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.6.tgz", + "integrity": "sha512-mgth9Kvze+u8CruYMmhHw6Zgy3GRX2S+Ed5oSokDEK5vPEwGGKnmuXua9tmFhomeAnhgJnL4DCna3TiNuGrBTQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@vscode/vsce/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@vscode/vsce/node_modules/glob": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", + "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.1.1", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@vscode/vsce/node_modules/glob/node_modules/minimatch": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", "dev": true, - "optional": true, - "os": [ - "win32" - ] + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } }, - "node_modules/@vscode/vsce-sign-win32-x64": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.5.tgz", - "integrity": "sha512-1ixKFGM2FwM+6kQS2ojfY3aAelICxjiCzeg4nTHpkeU1Tfs4RC+lVLrgq5NwcBC7ZLr6UfY3Ct3D6suPeOf7BQ==", - "cpu": [ - "x64" - ], + "node_modules/@vscode/vsce/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "optional": true, - "os": [ - "win32" - ] + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } }, "node_modules/@webassemblyjs/ast": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.14.1.tgz", "integrity": "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/helper-numbers": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2" @@ -4929,25 +3659,29 @@ "version": "1.13.2", "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.13.2.tgz", "integrity": "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-api-error": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.13.2.tgz", "integrity": "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-buffer": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.14.1.tgz", "integrity": "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.13.2.tgz", "integrity": "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.13.2", "@webassemblyjs/helper-api-error": "1.13.2", @@ -4958,13 +3692,15 @@ "version": "1.13.2", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.13.2.tgz", "integrity": "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/helper-wasm-section": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.14.1.tgz", "integrity": "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -4977,6 +3713,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.13.2.tgz", "integrity": "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==", "dev": true, + "license": "MIT", "dependencies": { "@xtuc/ieee754": "^1.2.0" } @@ -4986,6 +3723,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.13.2.tgz", "integrity": "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@xtuc/long": "4.2.2" } @@ -4994,13 +3732,15 @@ "version": "1.13.2", "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.13.2.tgz", "integrity": "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@webassemblyjs/wasm-edit": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.14.1.tgz", "integrity": "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -5017,6 +3757,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.14.1.tgz", "integrity": "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", @@ -5030,6 +3771,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.14.1.tgz", "integrity": "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", @@ -5042,6 +3784,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.14.1.tgz", "integrity": "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-api-error": "1.13.2", @@ -5056,6 +3799,7 @@ "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.14.1.tgz", "integrity": "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==", "dev": true, + "license": "MIT", "dependencies": { "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" @@ -5066,6 +3810,7 @@ "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", "dev": true, + "license": "MIT", "peerDependencies": { "webpack": "4.x.x || 5.x.x", "webpack-cli": "4.x.x" @@ -5076,6 +3821,7 @@ "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", "dev": true, + "license": "MIT", "dependencies": { "envinfo": "^7.7.3" }, @@ -5088,6 +3834,7 @@ "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", "dev": true, + "license": "MIT", "peerDependencies": { "webpack-cli": "4.x.x" }, @@ -5101,53 +3848,22 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true - }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dev": true, - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dev": true, - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/accepts/node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", "dev": true, - "engines": { - "node": ">= 0.6" - } + "license": "Apache-2.0" }, "node_modules/acorn": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", "integrity": "sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -5161,6 +3877,7 @@ "integrity": "sha512-d3OEjQV4ROpoflsnUA8HozoIR504TFxNivYEUi6uwz0IYhBkTDXGuWlNdMtybRt3nqVx/L6XqMt0FxkXuWKZhw==", "deprecated": "This is probably built in to whatever tool you're using. If you still need it... idk", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0" } @@ -5170,53 +3887,32 @@ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/acorn-walk": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", - "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "dev": true, - "dependencies": { - "acorn": "^8.11.0" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk/node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/agent-base": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", - "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 14" } }, "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -5228,6 +3924,7 @@ "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^8.0.0" }, @@ -5240,35 +3937,17 @@ } } }, - "node_modules/ajv-formats/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "fast-deep-equal": "^3.1.3" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-formats/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/ajv-keywords": { - "version": "3.5.2", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", - "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true, "peerDependencies": { - "ajv": "^6.9.1" + "ajv": "^8.8.2" } }, "node_modules/ansi-colors": { @@ -5276,56 +3955,38 @@ "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.2.0.tgz", + "integrity": "sha512-g6LhBsl+GBPRWGWsBtutpzBYuIIdBkLEvad5C/va/74Db018+5TZiyA26cZJAr3Rft5lprVqOIPxf5Vid6tqAw==", "dev": true, + "license": "MIT", "dependencies": { - "type-fest": "^0.21.3" + "environment": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-html-community": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/ansi-html-community/-/ansi-html-community-0.0.8.tgz", - "integrity": "sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==", - "dev": true, - "engines": [ - "node >= 0.8.0" - ], - "bin": { - "ansi-html": "bin/ansi-html" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, "node_modules/ansi-styles": { @@ -5333,6 +3994,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -5348,6 +4010,7 @@ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, + "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -5361,6 +4024,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8.6" }, @@ -5368,51 +4032,19 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/apache-arrow": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/apache-arrow/-/apache-arrow-11.0.0.tgz", - "integrity": "sha512-M8J4y+DimIyS44w2KOmVfzNHbTroR1oDpBKK6BYnlu8xVB41lxTz0yLmapo8/WJVAt5XcinAxMm14M771dm/rA==", - "dependencies": { - "@types/command-line-args": "5.2.0", - "@types/command-line-usage": "5.0.2", - "@types/flatbuffers": "*", - "@types/node": "18.7.23", - "@types/pad-left": "2.1.1", - "command-line-args": "5.2.1", - "command-line-usage": "6.1.3", - "flatbuffers": "2.0.4", - "json-bignum": "^0.0.3", - "pad-left": "^2.1.0", - "tslib": "^2.4.0" - }, - "bin": { - "arrow2csv": "bin/arrow2csv.js" - } - }, - "node_modules/apache-arrow/node_modules/@types/node": { - "version": "18.7.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.23.tgz", - "integrity": "sha512-DWNcCHolDq0ZKGizjx2DZjR/PqsYwAcYUJmfMWqtVU2MBMG5Mo+xFZrhGId5r/O5HOuMPyQEcM6KUBp5lBZZBg==" - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/array-back": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", - "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", - "engines": { - "node": ">=6" - } + "dev": true, + "license": "Python-2.0" }, "node_modules/array-buffer-byte-length": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", "dev": true, + "license": "MIT", "dependencies": { "call-bound": "^1.0.3", "is-array-buffer": "^3.0.5" @@ -5424,17 +4056,12 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", - "dev": true - }, "node_modules/array-includes": { "version": "3.1.9", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.9.tgz", "integrity": "sha512-FmeCCAenzH0KH381SPT5FZmiA/TmpndpcaShhfgEN9eCVjnFBqq3l1xrI42y8+PPLI6hypzou4GXw00WHmPBLQ==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.8", "call-bound": "^1.0.4", @@ -5457,6 +4084,7 @@ "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -5477,6 +4105,7 @@ "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", @@ -5495,6 +4124,7 @@ "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", @@ -5513,6 +4143,7 @@ "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1", @@ -5529,50 +4160,21 @@ "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", "dev": true, + "license": "MIT", "dependencies": { - "array-buffer-byte-length": "^1.0.1", - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "is-array-buffer": "^3.0.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", - "dev": true, - "dependencies": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", - "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", - "dev": true - }, - "node_modules/assert": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", - "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "is-nan": "^1.3.2", - "object-is": "^1.1.5", - "object.assign": "^4.1.4", - "util": "^0.12.5" + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/astral-regex": { @@ -5580,36 +4182,34 @@ "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", - "dev": true + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true - }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", "dev": true, - "engines": { - "node": ">= 4.0.0" - } + "license": "MIT" }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", "dev": true, + "license": "MIT", "dependencies": { "possible-typed-array-names": "^1.0.0" }, @@ -5629,6 +4229,7 @@ "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-12.5.0.tgz", "integrity": "sha512-R5eFskGvOm3U/GzeAuxRkUsAl0hrAwGgWn6zAd2KrZmrEhWZVqLew4OOupbQlXUuojUzpGtq62SmdhJ06N88og==", "dev": true, + "license": "MIT", "dependencies": { "tunnel": "0.0.6", "typed-rest-client": "^1.8.4" @@ -5639,6 +4240,7 @@ "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.5.tgz", "integrity": "sha512-xFbRxM1tahm08yHBP16MMjVUAvDaBMD38zsM9EMAUN61omwLmKlOpB/Zku5QkjZ8TZ4vn53pj+t518cH0S03RQ==", "dev": true, + "license": "MIT", "funding": { "type": "github", "url": "https://github.com/sponsors/wooorm" @@ -5648,16 +4250,8 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/base-x": { - "version": "3.0.11", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz", - "integrity": "sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==", "dev": true, - "dependencies": { - "safe-buffer": "^5.0.1" - } + "license": "MIT" }, "node_modules/base64-js": { "version": "1.5.1", @@ -5677,19 +4271,25 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, - "node_modules/batch": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", - "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==", - "dev": true + "node_modules/baseline-browser-mapping": { + "version": "2.9.3", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.3.tgz", + "integrity": "sha512-8QdH6czo+G7uBsNo0GiUfouPN1lRzKdJTGnKXwe12gkFbnnOUaUKGN55dMkfy+mnxmvjwl9zcI4VncczcVXDhA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } }, "node_modules/big-integer": { "version": "1.6.52", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.52.tgz", "integrity": "sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==", "dev": true, + "license": "Unlicense", "engines": { "node": ">=0.6" } @@ -5699,6 +4299,7 @@ "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", "integrity": "sha512-D4H1y5KYwpJgK8wk1Cue5LLPgmwHKYSChkbspQg5JtVuR5ulGckxfR62H3AE9UDkdMC8yyXlqYihuz3Aqg2XZg==", "dev": true, + "license": "MIT", "dependencies": { "buffers": "~0.1.1", "chainsaw": "~0.1.0" @@ -5712,6 +4313,7 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -5724,6 +4326,7 @@ "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-6.11.0.tgz", "integrity": "sha512-sXnYK/Ij80TO3lcqZVV2YgfKN5QjUWIRk/XSm2J/4bd/lPko3lvk0O4ZppH6m+6hB2/GTu+ptNwVFe1xh+QLQw==", "dev": true, + "license": "Artistic-2.0", "dependencies": { "editions": "^6.21.0" }, @@ -5739,6 +4342,7 @@ "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "dev": true, + "license": "MIT", "optional": true, "dependencies": { "buffer": "^5.5.0", @@ -5746,7 +4350,199 @@ "readable-stream": "^3.4.0" } }, - "node_modules/bl/node_modules/buffer": { + "node_modules/bluebird": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", + "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", + "dev": true, + "license": "ISC" + }, + "node_modules/boundary": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-2.0.0.tgz", + "integrity": "sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true, + "license": "ISC" + }, + "node_modules/browserslist": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.9.0", + "caniuse-lite": "^1.0.30001759", + "electron-to-chromium": "^1.5.263", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.2.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buble": { + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/buble/-/buble-0.20.0.tgz", + "integrity": "sha512-/1gnaMQE8xvd5qsNBl+iTuyjJ9XxeaVxAMF86dQ4EyxFJOZtsgOS8Ra+7WHgZTam5IFDtt4BguN0sH0tVTKrOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^6.4.1", + "acorn-dynamic-import": "^4.0.0", + "acorn-jsx": "^5.2.0", + "chalk": "^2.4.2", + "magic-string": "^0.25.7", + "minimist": "^1.2.5", + "regexpu-core": "4.5.4" + }, + "bin": { + "buble": "bin/buble" + } + }, + "node_modules/buble/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/buble/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/buble/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/buble/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" + }, + "node_modules/buble/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/buble/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/buble/node_modules/magic-string": { + "version": "0.25.9", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", + "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "sourcemap-codec": "^1.4.8" + } + }, + "node_modules/buble/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", @@ -5765,2343 +4561,2587 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "optional": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true, - "optional": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, + "license": "MIT" + }, + "node_modules/buffer-indexof-polyfill": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", + "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", + "dev": true, + "license": "MIT", "engines": { - "node": ">= 6" + "node": ">=0.10" } }, - "node_modules/bluebird": { - "version": "3.4.7", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.7.tgz", - "integrity": "sha512-iD3898SR7sWVRHbiQv+sHUtHnMvC1o3nW5rAcqnq3uOn07DSAppZYUkIGslDz6gXC7HfunPe7YVBgoEJASPcHA==", - "dev": true - }, - "node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", - "dev": true + "node_modules/buffers": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", + "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", + "dev": true, + "engines": { + "node": ">=0.2.0" + } }, - "node_modules/body-parser": { - "version": "1.20.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", - "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "node_modules/bundle-name": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", + "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", "dev": true, + "license": "MIT", "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.13.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" + "run-applescript": "^7.0.0" }, "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/call-bind": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", + "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.0.0" + "call-bind-apply-helpers": "^1.0.0", + "es-define-property": "^1.0.0", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/body-parser/node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "dev": true, + "license": "MIT", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, - "node_modules/body-parser/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/body-parser/node_modules/qs": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", - "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, + "license": "MIT", "dependencies": { - "side-channel": "^1.0.6" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { - "node": ">=0.6" + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/bonjour-service": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/bonjour-service/-/bonjour-service-1.3.0.tgz", - "integrity": "sha512-3YuAUiSkWykd+2Azjgyxei8OWf8thdn8AITIog2M4UICzoqfjlqr64WIjEXZllf/W6vK1goqleSR6brGomxQqA==", + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3", - "multicast-dns": "^7.2.5" + "license": "MIT", + "engines": { + "node": ">=6" } }, - "node_modules/boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true - }, - "node_modules/boundary": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/boundary/-/boundary-2.0.0.tgz", - "integrity": "sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "node_modules/caniuse-lite": { + "version": "1.0.30001759", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001759.tgz", + "integrity": "sha512-Pzfx9fOKoKvevQf8oCXoyNRQ5QyxJj+3O0Rqx2V5oxT61KGx8+n6hV/IUyJeifUci2clnmmKVpvtiqRzgiWjSw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chainsaw": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", + "integrity": "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==", "dev": true, + "license": "MIT/X11", "dependencies": { - "fill-range": "^7.1.1" + "traverse": ">=0.3.0 <0.4" }, "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", - "dev": true - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, + "license": "MIT", "dependencies": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "node_modules/cheerio": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.1.2.tgz", + "integrity": "sha512-IkxPpb5rS/d1IiLbHMgfPuS0FgiWTtFIm/Nj+2woXDLTZ7fOT2eqzgYbdMlLweqlHbsZjxEChoVK+7iph7jyQg==", "dev": true, + "license": "MIT", "dependencies": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" + "cheerio-select": "^2.1.0", + "dom-serializer": "^2.0.0", + "domhandler": "^5.0.3", + "domutils": "^3.2.2", + "encoding-sniffer": "^0.2.1", + "htmlparser2": "^10.0.0", + "parse5": "^7.3.0", + "parse5-htmlparser2-tree-adapter": "^7.1.0", + "parse5-parser-stream": "^7.1.2", + "undici": "^7.12.0", + "whatwg-mimetype": "^4.0.0" + }, + "engines": { + "node": ">=20.18.1" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" } }, - "node_modules/browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "node_modules/cheerio-select": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", + "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" + "boolbase": "^1.0.0", + "css-select": "^5.1.0", + "css-what": "^6.1.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" } }, - "node_modules/browserify-rsa": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.1.tgz", - "integrity": "sha512-YBjSAiTqM04ZVei6sXighu679a3SqWORA3qZTEqZImnlkDIFtKc6pNutpjyZ8RJTjQtuYfeetkxM11GwoYXMIQ==", + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", "dev": true, + "license": "MIT", "dependencies": { - "bn.js": "^5.2.1", - "randombytes": "^2.1.0", - "safe-buffer": "^5.2.1" + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" }, "engines": { - "node": ">= 0.10" + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" } }, - "node_modules/browserify-sign": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.3.tgz", - "integrity": "sha512-JWCZW6SKhfhjJxO8Tyiiy+XYB7cqd2S5/+WeYHsKdNKFlCBhKbblba1A/HN/90YwtxKc8tCErjffZl++UNmGiw==", + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "license": "ISC", "dependencies": { - "bn.js": "^5.2.1", - "browserify-rsa": "^4.1.0", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.5", - "hash-base": "~3.0", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.7", - "readable-stream": "^2.3.8", - "safe-buffer": "^5.2.1" + "is-glob": "^4.0.1" }, "engines": { - "node": ">= 0.12" + "node": ">= 6" } }, - "node_modules/browserify-sign/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true, + "license": "ISC", + "optional": true }, - "node_modules/browserify-sign/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "node_modules/chrome-trace-event": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", + "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" + "license": "MIT", + "engines": { + "node": ">=6.0" } }, - "node_modules/browserify-sign/node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/browserify-sign/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, + "license": "ISC", "dependencies": { - "safe-buffer": "~5.1.0" + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" } }, - "node_modules/browserify-sign/node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } }, - "node_modules/browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { - "pako": "~1.0.5" + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "node_modules/browserslist": { - "version": "4.25.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.25.0.tgz", - "integrity": "sha512-PJ8gYKeS5e/whHBh8xrwYK+dAvEj7JXtz6uTucnMRB8OiGTsKccFekoRrjajPBHV8oOY+2tI4uxeceSimKwMFA==", + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], + "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001718", - "electron-to-chromium": "^1.5.160", - "node-releases": "^2.0.19", - "update-browserslist-db": "^1.1.3" - }, - "bin": { - "browserslist": "cli.js" + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" }, "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + "node": ">=6" } }, - "node_modules/buble": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/buble/-/buble-0.20.0.tgz", - "integrity": "sha512-/1gnaMQE8xvd5qsNBl+iTuyjJ9XxeaVxAMF86dQ4EyxFJOZtsgOS8Ra+7WHgZTam5IFDtt4BguN0sH0tVTKrOw==", + "node_modules/clone-deep/node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, + "license": "MIT", "dependencies": { - "acorn": "^6.4.1", - "acorn-dynamic-import": "^4.0.0", - "acorn-jsx": "^5.2.0", - "chalk": "^2.4.2", - "magic-string": "^0.25.7", - "minimist": "^1.2.5", - "regexpu-core": "4.5.4" + "isobject": "^3.0.1" }, - "bin": { - "buble": "bin/buble" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/buble/node_modules/ansi-styles": { + "node_modules/cockatiel": { "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "resolved": "https://registry.npmjs.org/cockatiel/-/cockatiel-3.2.1.tgz", + "integrity": "sha512-gfrHV6ZPkquExvMh9IOkKsBzNDk6sDuZ6DdBGUBkvFnTCqCxzpuq48RySgP0AnaqQkw2zynOFj9yly6T1Q2G5Q==", "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=16" } }, - "node_modules/buble/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "color-name": "~1.1.4" }, "engines": { - "node": ">=4" + "node": ">=7.0.0" } }, - "node_modules/buble/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "1.1.3" + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" } }, - "node_modules/buble/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/buble/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.8.0" + "node": ">=18" } }, - "node_modules/buble/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "node_modules/common-backend": { + "resolved": "extensions/common-backend", + "link": true + }, + "node_modules/common-frontend": { + "resolved": "extensions/common-frontend", + "link": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/core-js": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz", + "integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw==", + "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", + "hasInstallScript": true, + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, "engines": { - "node": ">=4" + "node": ">= 8" } }, - "node_modules/buble/node_modules/magic-string": { - "version": "0.25.9", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", - "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", + "node_modules/css-select": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", + "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "sourcemap-codec": "^1.4.8" + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" } }, - "node_modules/buble/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/css-what": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", + "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, + "license": "BSD-2-Clause", "engines": { - "node": ">=4" + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" } }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" } }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "dev": true, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", "engines": { - "node": "*" + "node": ">=12" } }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", - "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", - "dev": true - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true + "node_modules/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", + "license": "ISC", + "dependencies": { + "delaunator": "5" + }, + "engines": { + "node": ">=12" + } }, - "node_modules/buffer-indexof-polyfill": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.2.tgz", - "integrity": "sha512-I7wzHwA3t1/lwXQh+A5PbNvJxgfo5r3xulgpYDB5zckTu/Z9oUK9biouBKQUjEqzaz3HnAT6TYoovmE+GqSf7A==", - "dev": true, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "license": "ISC", "engines": { - "node": ">=0.10" + "node": ">=12" } }, - "node_modules/buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", - "dev": true + "node_modules/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "license": "ISC", + "dependencies": { + "commander": "7", + "iconv-lite": "0.6", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json.js", + "csv2tsv": "bin/dsv2dsv.js", + "dsv2dsv": "bin/dsv2dsv.js", + "dsv2json": "bin/dsv2json.js", + "json2csv": "bin/json2dsv.js", + "json2dsv": "bin/json2dsv.js", + "json2tsv": "bin/json2dsv.js", + "tsv2csv": "bin/dsv2dsv.js", + "tsv2json": "bin/dsv2json.js" + }, + "engines": { + "node": ">=12" + } }, - "node_modules/buffers": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz", - "integrity": "sha512-9q/rDEGSb/Qsvv2qvzIzdluL5k7AaJOTrw23z9reQthrbF7is4CtlT0DXyO1oei2DCp4uojjzQ7igaSHp1kAEQ==", - "dev": true, + "node_modules/d3-dsv/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "license": "MIT", "engines": { - "node": ">=0.2.0" + "node": ">= 10" } }, - "node_modules/builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==", - "dev": true + "node_modules/d3-ease": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.7.tgz", + "integrity": "sha512-lx14ZPYkhNx0s/2HX5sLFUI3mbasHjSSpwO/KaaNACweVwxUruKyWVcb293wMv1RqTPZyZ8kSZ2NogUZNcLOFQ==", + "license": "BSD-3-Clause" }, - "node_modules/bundle-name": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz", - "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==", - "dev": true, + "node_modules/d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "license": "ISC", "dependencies": { - "run-applescript": "^7.0.0" + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" }, "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=12" } }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "dev": true, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "license": "ISC", "engines": { - "node": ">= 0.8" + "node": ">=12" } }, - "node_modules/call-bind": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", - "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", - "dev": true, + "node_modules/d3-geo": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", + "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", + "license": "ISC", "dependencies": { - "call-bind-apply-helpers": "^1.0.0", - "es-define-property": "^1.0.0", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.2" + "d3-array": "2.5.0 - 3" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=12" } }, - "node_modules/call-bind-apply-helpers": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", - "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", - "dev": true, + "node_modules/d3-geo-projection": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/d3-geo-projection/-/d3-geo-projection-4.0.0.tgz", + "integrity": "sha512-p0bK60CEzph1iqmnxut7d/1kyTmm3UWtPlwdkM31AU+LW+BXazd5zJdoCn7VFxNCHXRngPHRnsNn5uGjLRGndg==", + "license": "ISC", "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2" + "commander": "7", + "d3-array": "1 - 3", + "d3-geo": "1.12.0 - 3" + }, + "bin": { + "geo2svg": "bin/geo2svg.js", + "geograticule": "bin/geograticule.js", + "geoproject": "bin/geoproject.js", + "geoquantize": "bin/geoquantize.js", + "geostitch": "bin/geostitch.js" }, "engines": { - "node": ">= 0.4" + "node": ">=12" + } + }, + "node_modules/d3-geo-projection/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "license": "ISC", + "engines": { + "node": ">=12" } }, - "node_modules/call-bound": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", - "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", - "dev": true, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "get-intrinsic": "^1.3.0" + "d3-color": "1 - 3" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=12" } }, - "node_modules/callsites": { + "node_modules/d3-path": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", "engines": { - "node": ">=6" + "node": ">=12" } }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, + "node_modules/d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "license": "ISC", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=12" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001721", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001721.tgz", - "integrity": "sha512-cOuvmUVtKrtEaoKiO0rSc29jcjwMwX5tOHDy4MgVFEWiUXj4uBMJkwI8MDySkgXidpMiHUcviogAvFi4pA2hDQ==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ] - }, - "node_modules/chainsaw": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", - "integrity": "sha512-75kWfWt6MEKNC8xYXIdRpDehRYY/tNSgwKaJq+dbbDcxORuVrrQ+SEHoWsniVn9XPYfP4gmdWIeDk/4YNp1rNQ==", - "dev": true, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", "dependencies": { - "traverse": ">=0.3.0 <0.4" + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" }, "engines": { - "node": "*" + "node": ">=12" } }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, + "node_modules/d3-scale-chromatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", + "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", + "license": "ISC", "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "node": ">=12" } }, - "node_modules/cheerio": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.1.0.tgz", - "integrity": "sha512-+0hMx9eYhJvWbgpKV9hN7jg0JcwydpopZE4hgi+KvQtByZXPp04NiCWU0LzcAbP63abZckIHkTQaXVF52mX3xQ==", - "dev": true, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", "dependencies": { - "cheerio-select": "^2.1.0", - "dom-serializer": "^2.0.0", - "domhandler": "^5.0.3", - "domutils": "^3.2.2", - "encoding-sniffer": "^0.2.0", - "htmlparser2": "^10.0.0", - "parse5": "^7.3.0", - "parse5-htmlparser2-tree-adapter": "^7.1.0", - "parse5-parser-stream": "^7.1.2", - "undici": "^7.10.0", - "whatwg-mimetype": "^4.0.0" + "d3-path": "^3.1.0" }, "engines": { - "node": ">=18.17" - }, - "funding": { - "url": "https://github.com/cheeriojs/cheerio?sponsor=1" - } - }, - "node_modules/cheerio-select": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", - "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", - "dev": true, - "dependencies": { - "boolbase": "^1.0.0", - "css-select": "^5.1.0", - "css-what": "^6.1.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" + "node": ">=12" } }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "d3-array": "2 - 3" }, "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" + "node": ">=12" } }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", "dependencies": { - "is-glob": "^4.0.1" + "d3-time": "1 - 3" }, "engines": { - "node": ">= 6" + "node": ">=12" } }, - "node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "dev": true, - "optional": true - }, - "node_modules/chrome-trace-event": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz", - "integrity": "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==", - "dev": true, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", "engines": { - "node": ">=6.0" + "node": ">=12" } }, - "node_modules/cipher-base": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.6.tgz", - "integrity": "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw==", + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", "dev": true, + "license": "MIT", "dependencies": { - "inherits": "^2.0.4", - "safe-buffer": "^5.2.1" + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" }, "engines": { - "node": ">= 0.10" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "node": ">= 0.4" }, - "engines": { - "node": ">=8" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/cliui/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/clone": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", - "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", - "dev": true, - "engines": { - "node": ">=0.8" + "url": "https://github.com/sponsors/inspect-js" } }, - "node_modules/clone-deep": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", - "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", "dev": true, + "license": "MIT", "dependencies": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" }, "engines": { - "node": ">=6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/clone-deep/node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, + "license": "MIT", "dependencies": { - "isobject": "^3.0.1" + "ms": "^2.1.3" }, "engines": { - "node": ">=0.10.0" + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/cockatiel": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/cockatiel/-/cockatiel-3.2.1.tgz", - "integrity": "sha512-gfrHV6ZPkquExvMh9IOkKsBzNDk6sDuZ6DdBGUBkvFnTCqCxzpuq48RySgP0AnaqQkw2zynOFj9yly6T1Q2G5Q==", + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=16" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" + "node": ">=10" }, - "engines": { - "node": ">=7.0.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/colorette": { - "version": "2.0.20", - "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", - "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", - "dev": true - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "delayed-stream": "~1.0.0" + "mimic-response": "^3.1.0" }, "engines": { - "node": ">= 0.8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/command-line-args": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.2.1.tgz", - "integrity": "sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==", - "dependencies": { - "array-back": "^3.1.0", - "find-replace": "^3.0.0", - "lodash.camelcase": "^4.3.0", - "typical": "^4.0.0" - }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "license": "MIT", + "optional": true, "engines": { "node": ">=4.0.0" } }, - "node_modules/command-line-usage": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/command-line-usage/-/command-line-usage-6.1.3.tgz", - "integrity": "sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==", - "dependencies": { - "array-back": "^4.0.2", - "chalk": "^2.4.2", - "table-layout": "^1.0.2", - "typical": "^5.2.0" - }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/deepmerge": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz", + "integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==", + "license": "MIT", "engines": { - "node": ">=8.0.0" + "node": ">=0.10.0" } }, - "node_modules/command-line-usage/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "node_modules/default-browser": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.4.0.tgz", + "integrity": "sha512-XDuvSq38Hr1MdN47EDvYtx3U0MTqpCEn+F6ft8z2vYDzMrvQhVp0ui9oQdqW3MvK3vqUETglt1tVGgjLuJ5izg==", + "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^1.9.0" + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" }, "engines": { - "node": ">=4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/command-line-usage/node_modules/array-back": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", - "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", + "node_modules/default-browser-id": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz", + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=8" - } - }, - "node_modules/command-line-usage/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "node": ">=18" }, - "engines": { - "node": ">=4" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/command-line-usage/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/command-line-usage/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/command-line-usage/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, "engines": { - "node": ">=0.8.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/command-line-usage/node_modules/has-flag": { + "node_modules/define-lazy-prop": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/command-line-usage/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^3.0.0" + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" }, "engines": { - "node": ">=4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/command-line-usage/node_modules/typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "engines": { - "node": ">=8" + "node_modules/delaunator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz", + "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==", + "license": "ISC", + "dependencies": { + "robust-predicates": "^3.0.2" } }, - "node_modules/commander": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", - "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=18" + "node": ">=0.4.0" } }, - "node_modules/common-backend": { - "resolved": "extensions/common-backend", - "link": true - }, - "node_modules/common-frontend": { - "resolved": "extensions/common-frontend", - "link": true - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", - "dev": true - }, - "node_modules/compare-versions": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz", - "integrity": "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg==", - "dev": true - }, - "node_modules/compressible": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", - "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", "dev": true, - "dependencies": { - "mime-db": ">= 1.43.0 < 2" + "license": "Apache-2.0", + "optional": true, + "bin": { + "detect-libc": "bin/detect-libc.js" }, "engines": { - "node": ">= 0.6" + "node": ">=0.10" } }, - "node_modules/compression": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.8.1.tgz", - "integrity": "sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==", + "node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", "dev": true, - "license": "MIT", - "dependencies": { - "bytes": "3.1.2", - "compressible": "~2.0.18", - "debug": "2.6.9", - "negotiator": "~0.6.4", - "on-headers": "~1.1.0", - "safe-buffer": "5.2.1", - "vary": "~1.1.2" - }, + "license": "BSD-3-Clause", "engines": { - "node": ">= 0.8.0" + "node": ">=0.3.1" } }, - "node_modules/compression/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "ms": "2.0.0" + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" } }, - "node_modules/compression/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/connect-history-api-fallback": { + "node_modules/dom-serializer": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-2.0.0.tgz", - "integrity": "sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", "dev": true, - "engines": { - "node": ">=0.8" + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" } }, - "node_modules/console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", - "dev": true - }, - "node_modules/constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==", - "dev": true + "node_modules/domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", + "node_modules/domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "safe-buffer": "5.2.1" + "domelementtype": "^2.3.0" }, "engines": { - "node": ">= 0.6" + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" } }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "node_modules/domutils": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", + "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", "dev": true, - "engines": { - "node": ">= 0.6" + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" } }, - "node_modules/cookie": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", - "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, "engines": { - "node": ">= 0.6" + "node": ">= 0.4" } }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", - "dev": true - }, - "node_modules/copy-anything": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz", - "integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==", + "node_modules/duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "is-what": "^3.14.1" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" + "readable-stream": "^2.0.2" } }, - "node_modules/core-js": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz", - "integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw==", - "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", - "hasInstallScript": true - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true + "node_modules/duplexer2/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" }, - "node_modules/create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "node_modules/duplexer2/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, + "license": "MIT", "dependencies": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/create-ecdh/node_modules/bn.js": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", - "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", - "dev": true + "node_modules/duplexer2/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" }, - "node_modules/create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "node_modules/duplexer2/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, + "license": "MIT", "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" + "safe-buffer": "~5.1.0" } }, - "node_modules/create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "node_modules/earcut": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "safe-buffer": "^5.0.1" } }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "node_modules/editions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/editions/-/editions-6.22.0.tgz", + "integrity": "sha512-UgGlf8IW75je7HZjNDpJdCv4cGJWIi6yumFdZ0R7A8/CIhQiWUjyGLCxdHpd8bmyD1gnkfUNK0oeOXqUS2cpfQ==", "dev": true, + "license": "Artistic-2.0", "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" + "version-range": "^4.15.0" }, "engines": { - "node": ">= 8" + "ecmascript": ">= es5", + "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/crypto-browserify": { - "version": "3.12.1", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.1.tgz", - "integrity": "sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ==", + "node_modules/electron-to-chromium": { + "version": "1.5.266", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.266.tgz", + "integrity": "sha512-kgWEglXvkEfMH7rxP5OSZZwnaDWT7J9EoZCujhnpLbfi0bbNtRkgdX2E3gt0Uer11c61qCYktB3hwkAS325sJg==", + "dev": true, + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/encoding-sniffer": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", + "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", "dev": true, + "license": "MIT", "dependencies": { - "browserify-cipher": "^1.0.1", - "browserify-sign": "^4.2.3", - "create-ecdh": "^4.0.4", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "diffie-hellman": "^5.0.3", - "hash-base": "~3.0.4", - "inherits": "^2.0.4", - "pbkdf2": "^3.1.2", - "public-encrypt": "^4.0.3", - "randombytes": "^2.1.0", - "randomfill": "^1.0.4" - }, - "engines": { - "node": ">= 0.10" + "iconv-lite": "^0.6.3", + "whatwg-encoding": "^3.1.1" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" } }, - "node_modules/css-loader": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-7.1.2.tgz", - "integrity": "sha512-6WvYYn7l/XEGN8Xu2vWFt9nVzrCn39vKyTEFf/ExEyoksJjjSZV/0/35XPlMbpnr6VGhZIUg5yJrL8tGfes/FA==", + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "icss-utils": "^5.1.0", - "postcss": "^8.4.33", - "postcss-modules-extract-imports": "^3.1.0", - "postcss-modules-local-by-default": "^4.0.5", - "postcss-modules-scope": "^3.2.0", - "postcss-modules-values": "^4.0.0", - "postcss-value-parser": "^4.2.0", - "semver": "^7.5.4" - }, - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "@rspack/core": "0.x || 1.x", - "webpack": "^5.27.0" - }, - "peerDependenciesMeta": { - "@rspack/core": { - "optional": true - }, - "webpack": { - "optional": true - } + "once": "^1.4.0" } }, - "node_modules/css-select": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", - "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", + "node_modules/enhanced-resolve": { + "version": "5.18.3", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz", + "integrity": "sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww==", "dev": true, + "license": "MIT", "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" }, - "funding": { - "url": "https://github.com/sponsors/fb55" + "engines": { + "node": ">=10.13.0" } }, - "node_modules/css-what": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", - "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", "dev": true, + "license": "BSD-2-Clause", "engines": { - "node": ">= 6" + "node": ">=0.12" }, "funding": { - "url": "https://github.com/sponsors/fb55" + "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/cssesc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "node_modules/envinfo": { + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.21.0.tgz", + "integrity": "sha512-Lw7I8Zp5YKHFCXL7+Dz95g4CcbMEpgvqZNNq3AmlT5XAV6CgAAk6gyAMqn2zjw08K9BHfcNuKrMiCPLByGafow==", "dev": true, + "license": "MIT", "bin": { - "cssesc": "bin/cssesc" + "envinfo": "dist/cli.js" }, "engines": { "node": ">=4" } }, - "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" - }, - "node_modules/d3-array": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", - "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", - "dependencies": { - "internmap": "1 - 2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/d3-color": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", - "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "node_modules/environment": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz", + "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=12" - } - }, - "node_modules/d3-delaunay": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", - "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", - "dependencies": { - "delaunator": "5" + "node": ">=18" }, - "engines": { - "node": ">=12" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/d3-dispatch": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", - "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", - "engines": { - "node": ">=12" + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" } }, - "node_modules/d3-dsv": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", - "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "node_modules/es-abstract": { + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz", + "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", + "dev": true, + "license": "MIT", "dependencies": { - "commander": "7", - "iconv-lite": "0.6", - "rw": "1" - }, - "bin": { - "csv2json": "bin/dsv2json.js", - "csv2tsv": "bin/dsv2dsv.js", - "dsv2dsv": "bin/dsv2dsv.js", - "dsv2json": "bin/dsv2json.js", - "json2csv": "bin/json2dsv.js", - "json2dsv": "bin/json2dsv.js", - "json2tsv": "bin/json2dsv.js", - "tsv2csv": "bin/dsv2dsv.js", - "tsv2json": "bin/dsv2json.js" + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/d3-dsv/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", "engines": { - "node": ">= 10" + "node": ">= 0.4" } }, - "node_modules/d3-ease": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.7.tgz", - "integrity": "sha512-lx14ZPYkhNx0s/2HX5sLFUI3mbasHjSSpwO/KaaNACweVwxUruKyWVcb293wMv1RqTPZyZ8kSZ2NogUZNcLOFQ==" - }, - "node_modules/d3-force": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", - "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", - "dependencies": { - "d3-dispatch": "1 - 3", - "d3-quadtree": "1 - 3", - "d3-timer": "1 - 3" - }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=12" + "node": ">= 0.4" } }, - "node_modules/d3-format": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", - "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "node_modules/es-iterator-helpers": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.1.tgz", + "integrity": "sha512-uDn+FE1yrDzyC0pCo961B2IHbdM8y/ACZsKD4dG6WqrjV53BADjwa7D+1aom2rsNVfLyDgU/eigvlJGJ08OQ4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.0.3", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.6", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.4", + "safe-array-concat": "^1.1.3" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" } }, - "node_modules/d3-geo": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", - "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dev": true, + "license": "MIT", "dependencies": { - "d3-array": "2.5.0 - 3" + "es-errors": "^1.3.0" }, "engines": { - "node": ">=12" + "node": ">= 0.4" } }, - "node_modules/d3-geo-projection": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/d3-geo-projection/-/d3-geo-projection-4.0.0.tgz", - "integrity": "sha512-p0bK60CEzph1iqmnxut7d/1kyTmm3UWtPlwdkM31AU+LW+BXazd5zJdoCn7VFxNCHXRngPHRnsNn5uGjLRGndg==", + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", "dependencies": { - "commander": "7", - "d3-array": "1 - 3", - "d3-geo": "1.12.0 - 3" - }, - "bin": { - "geo2svg": "bin/geo2svg.js", - "geograticule": "bin/geograticule.js", - "geoproject": "bin/geoproject.js", - "geoquantize": "bin/geoquantize.js", - "geostitch": "bin/geostitch.js" + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, "engines": { - "node": ">=12" - } - }, - "node_modules/d3-geo-projection/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", - "engines": { - "node": ">= 10" + "node": ">= 0.4" } }, - "node_modules/d3-hierarchy": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", - "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" } }, - "node_modules/d3-interpolate": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", - "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "node_modules/es-to-primitive": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", + "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "dev": true, + "license": "MIT", "dependencies": { - "d3-color": "1 - 3" + "is-callable": "^1.2.7", + "is-date-object": "^1.0.5", + "is-symbol": "^1.0.4" }, "engines": { - "node": ">=12" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/d3-path": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", - "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, "engines": { - "node": ">=12" + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" } }, - "node_modules/d3-quadtree": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", - "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=6" } }, - "node_modules/d3-scale": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", - "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", - "dependencies": { - "d3-array": "2.10.0 - 3", - "d3-format": "1 - 3", - "d3-interpolate": "1.2.0 - 3", - "d3-time": "2.1.1 - 3", - "d3-time-format": "2 - 4" - }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=12" - } - }, - "node_modules/d3-scale-chromatic": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", - "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", - "dependencies": { - "d3-color": "1 - 3", - "d3-interpolate": "1 - 3" + "node": ">=10" }, - "engines": { - "node": ">=12" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/d3-shape": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", - "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "node_modules/eslint": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", + "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", + "dev": true, + "license": "MIT", "dependencies": { - "d3-path": "^3.1.0" + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.1", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" }, "engines": { - "node": ">=12" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, - "node_modules/d3-time": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", - "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "node_modules/eslint-plugin-react": { + "version": "7.37.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", + "integrity": "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==", + "dev": true, + "license": "MIT", "dependencies": { - "d3-array": "2 - 3" + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.9", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" }, "engines": { - "node": ">=12" + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" } }, - "node_modules/d3-time-format": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", - "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "node_modules/eslint-plugin-react/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", "dependencies": { - "d3-time": "1 - 3" - }, - "engines": { - "node": ">=12" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/d3-timer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", - "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "node_modules/eslint-plugin-react/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, "engines": { - "node": ">=12" + "node": "*" } }, - "node_modules/data-view-buffer": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", - "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "node_modules/eslint-plugin-react/node_modules/resolve": { + "version": "2.0.0-next.5", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", + "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.2" + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" }, - "engines": { - "node": ">= 0.4" + "bin": { + "resolve": "bin/resolve" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/data-view-byte-length": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", - "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, - "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/inspect-js" + "license": "ISC", + "bin": { + "semver": "bin/semver.js" } }, - "node_modules/data-view-byte-offset": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", - "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "is-data-view": "^1.0.1" + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": ">= 0.4" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/eslint" } }, - "node_modules/debounce": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", - "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", - "dev": true - }, - "node_modules/debug": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", - "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", "dev": true, - "dependencies": { - "ms": "^2.1.3" - }, + "license": "Apache-2.0", "engines": { - "node": ">=6.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "node_modules/eslint/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "engines": { - "node": ">=10" + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "mimic-response": "^3.1.0" - }, + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=10" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/eslint" } }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "node_modules/eslint/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=4.0.0" + "node": ">= 4" } }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true - }, - "node_modules/deepmerge": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-2.2.1.tgz", - "integrity": "sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==", - "engines": { - "node": ">=0.10.0" - } + "node_modules/eslint/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" }, - "node_modules/default-browser": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.2.1.tgz", - "integrity": "sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==", + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { - "bundle-name": "^4.1.0", - "default-browser-id": "^5.0.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "*" } }, - "node_modules/default-browser-id": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.0.tgz", - "integrity": "sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==", + "node_modules/esm": { + "version": "3.2.25", + "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", + "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=6" } }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" }, "engines": { - "node": ">= 0.4" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://opencollective.com/eslint" } }, - "node_modules/define-lazy-prop": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", - "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", + "node_modules/espree/node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, "engines": { - "node": ">=12" + "node": ">=0.4.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://opencollective.com/eslint" } }, - "node_modules/define-properties": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", - "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "define-data-property": "^1.0.1", - "has-property-descriptors": "^1.0.0", - "object-keys": "^1.1.1" + "estraverse": "^5.1.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10" } }, - "node_modules/delaunator": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz", - "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==", + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "robust-predicates": "^3.0.2" + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true, + "license": "MIT" + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "license": "BSD-2-Clause", "engines": { - "node": ">=0.4.0" + "node": ">=0.10.0" } }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.8" + "node": ">=0.8.x" } }, - "node_modules/des.js": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", - "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", + "node_modules/expand-template": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", + "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "license": "(MIT OR WTFPL)", + "optional": true, + "engines": { + "node": ">=6" } }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": ">=8.6.0" } }, - "node_modules/detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, - "bin": { - "detect-libc": "bin/detect-libc.js" + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" }, "engines": { - "node": ">=0.10" + "node": ">= 6" } }, - "node_modules/detect-node": { + "node_modules/fast-json-stable-stringify": { "version": "2.1.0", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", - "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", - "dev": true + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" }, - "node_modules/diff": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", - "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", + "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=0.3.1" + "node": ">= 4.9.1" } }, - "node_modules/diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", "dev": true, + "license": "ISC", "dependencies": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" + "reusify": "^1.0.4" } }, - "node_modules/diffie-hellman/node_modules/bn.js": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", - "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", - "dev": true - }, - "node_modules/dns-packet": { - "version": "5.6.1", - "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz", - "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==", + "node_modules/fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, + "license": "MIT", "dependencies": { - "@leichtgewicht/ip-codec": "^2.0.1" - }, + "pend": "~1.2.0" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, - "node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", "dev": true, + "license": "MIT", "dependencies": { - "esutils": "^2.0.2" + "flat-cache": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=16.0.0" } }, - "node_modules/dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, + "license": "MIT", "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" + "to-regex-range": "^5.0.1" }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + "engines": { + "node": ">=8" } }, - "node_modules/domain-browser": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-5.7.0.tgz", - "integrity": "sha512-edTFu0M/7wO1pXY6GDxVNVW086uqwWYIHP98txhcPyV995X21JIH2DtYp33sQJOupYoXKe9RwTw2Ya2vWaquTQ==", + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, "engines": { - "node": ">=4" + "node": ">=10" }, "funding": { - "url": "https://bevry.me/fund" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/domelementtype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ] + "license": "BSD-3-Clause", + "bin": { + "flat": "cli.js" + } }, - "node_modules/domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", "dev": true, + "license": "MIT", "dependencies": { - "domelementtype": "^2.3.0" + "flatted": "^3.2.9", + "keyv": "^4.5.4" }, "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" + "node": ">=16" } }, - "node_modules/domutils": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz", - "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==", + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", "dev": true, - "dependencies": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } + "license": "ISC" }, - "node_modules/dotenv": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz", - "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==", + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" }, "funding": { - "url": "https://dotenvx.com" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/dotenv-expand": { - "version": "11.0.7", - "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.7.tgz", - "integrity": "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==", + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", "dev": true, + "license": "ISC", "dependencies": { - "dotenv": "^16.4.5" + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" }, "engines": { - "node": ">=12" + "node": ">=14" }, "funding": { - "url": "https://dotenvx.com" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/dunder-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", - "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "es-errors": "^1.3.0", - "gopd": "^1.2.0" + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" }, "engines": { - "node": ">= 0.4" + "node": ">= 6" } }, - "node_modules/duplexer": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", - "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", - "dev": true - }, - "node_modules/duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha512-asLFVfWWtJ90ZyOUHMqk7/S2w2guQKxUI2itj3d92ADHhxUSbCMGi1f1cBcJ7xM1To+pE/Khbwo1yuNbMEPKeA==", + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "license": "MIT", "dependencies": { - "readable-stream": "^2.0.2" + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" } }, - "node_modules/duplexer2/node_modules/isarray": { + "node_modules/fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/duplexer2/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } + "license": "ISC" }, - "node_modules/duplexer2/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } }, - "node_modules/duplexer2/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "node_modules/fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "deprecated": "This package is no longer supported.", "dev": true, + "license": "ISC", "dependencies": { - "safe-buffer": "~5.1.0" + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "engines": { + "node": ">=0.6" } }, - "node_modules/earcut": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", - "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==", - "dev": true - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", - "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "node_modules/fstream/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { - "safe-buffer": "^5.0.1" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/editions": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/editions/-/editions-6.21.0.tgz", - "integrity": "sha512-ofkXJtn7z0urokN62DI3SBo/5xAtF0rR7tn+S/bSYV79Ka8pTajIIl+fFQ1q88DQEImymmo97M4azY3WX/nUdg==", + "node_modules/fstream/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { - "version-range": "^4.13.0" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=4" + "node": "*" }, "funding": { - "url": "https://bevry.me/fund" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", - "dev": true - }, - "node_modules/electron-to-chromium": { - "version": "1.5.165", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.165.tgz", - "integrity": "sha512-naiMx1Z6Nb2TxPU6fiFrUrDTjyPMLdTtaOd2oLmG8zVSg2hCWGkhPyxwk+qRmZ1ytwVqUv0u7ZcDA5+ALhaUtw==", - "dev": true - }, - "node_modules/elliptic": { - "version": "6.6.1", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", - "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "node_modules/fstream/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" } }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", - "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "node_modules/fstream/node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, - "license": "MIT" + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } }, - "node_modules/encodeurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", - "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, - "engines": { - "node": ">= 0.8" + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/encoding-sniffer": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz", - "integrity": "sha512-5gvq20T6vfpekVtqrYQsSCFZ1wEg5+wW0/QaZMWkFr6BqD3NfKs0rLCx4rrVlSWJeZb5NBJgVLswK/w2MWU+Gw==", + "node_modules/function.prototype.name": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", + "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", "dev": true, + "license": "MIT", "dependencies": { - "iconv-lite": "^0.6.3", - "whatwg-encoding": "^3.1.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "functions-have-names": "^1.2.3", + "hasown": "^2.0.2", + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/fb55/encoding-sniffer?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/end-of-stream": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", - "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "once": "^1.4.0" + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/enhanced-resolve": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz", - "integrity": "sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg==", + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", "dev": true, + "license": "MIT", "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" }, "engines": { - "node": ">=10.13.0" + "node": ">= 0.4" } }, - "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, "engines": { - "node": ">=0.12" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/envinfo": { - "version": "7.14.0", - "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.14.0.tgz", - "integrity": "sha512-CO40UI41xDQzhLB1hWyqUKgFhs250pNcGbyGKe1l/e4FSaI/+YE4IMG76GDt0In67WLPACIITC+sOi08x4wIvg==", + "node_modules/github-from-package": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", + "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", "dev": true, - "bin": { - "envinfo": "dist/cli.js" + "license": "MIT", + "optional": true + }, + "node_modules/github-slugger": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz", + "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==", + "dev": true, + "license": "ISC" + }, + "node_modules/gl-matrix": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.4.tgz", + "integrity": "sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==", + "license": "MIT" + }, + "node_modules/glob": { + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", + "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.1.1", + "minipass": "^7.1.2", + "path-scurry": "^2.0.0" }, "engines": { - "node": ">=4" + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/errno": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", - "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, - "optional": true, + "license": "ISC", "dependencies": { - "prr": "~1.0.1" + "is-glob": "^4.0.3" }, - "bin": { - "errno": "cli.js" + "engines": { + "node": ">=10.13.0" } }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dev": true, - "dependencies": { - "is-arrayish": "^0.2.1" - } + "license": "BSD-2-Clause" }, - "node_modules/es-abstract": { - "version": "1.24.0", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.0.tgz", - "integrity": "sha512-WSzPgsdLtTcQwm4CROfS5ju2Wa1QQcVeT37jFjYzdFz1r9ahadC8B8/a4qxJxM+09F18iumCdRmlr96ZYkQvEg==", + "node_modules/glob/node_modules/minimatch": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "array-buffer-byte-length": "^1.0.2", - "arraybuffer.prototype.slice": "^1.0.4", - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "data-view-buffer": "^1.0.2", - "data-view-byte-length": "^1.0.2", - "data-view-byte-offset": "^1.0.1", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "es-set-tostringtag": "^2.1.0", - "es-to-primitive": "^1.3.0", - "function.prototype.name": "^1.1.8", - "get-intrinsic": "^1.3.0", - "get-proto": "^1.0.1", - "get-symbol-description": "^1.1.0", - "globalthis": "^1.0.4", - "gopd": "^1.2.0", - "has-property-descriptors": "^1.0.2", - "has-proto": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "internal-slot": "^1.1.0", - "is-array-buffer": "^3.0.5", - "is-callable": "^1.2.7", - "is-data-view": "^1.0.2", - "is-negative-zero": "^2.0.3", - "is-regex": "^1.2.1", - "is-set": "^2.0.3", - "is-shared-array-buffer": "^1.0.4", - "is-string": "^1.1.1", - "is-typed-array": "^1.1.15", - "is-weakref": "^1.1.1", - "math-intrinsics": "^1.1.0", - "object-inspect": "^1.13.4", - "object-keys": "^1.1.1", - "object.assign": "^4.1.7", - "own-keys": "^1.0.1", - "regexp.prototype.flags": "^1.5.4", - "safe-array-concat": "^1.1.3", - "safe-push-apply": "^1.0.0", - "safe-regex-test": "^1.1.0", - "set-proto": "^1.0.0", - "stop-iteration-iterator": "^1.1.0", - "string.prototype.trim": "^1.2.10", - "string.prototype.trimend": "^1.0.9", - "string.prototype.trimstart": "^1.0.8", - "typed-array-buffer": "^1.0.3", - "typed-array-byte-length": "^1.0.3", - "typed-array-byte-offset": "^1.0.4", - "typed-array-length": "^1.0.7", - "unbox-primitive": "^1.1.0", - "which-typed-array": "^1.1.19" + "@isaacs/brace-expansion": "^5.0.0" }, "engines": { - "node": ">= 0.4" + "node": "20 || >=22" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/es-define-property": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", - "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-iterator-helpers": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.1.tgz", - "integrity": "sha512-uDn+FE1yrDzyC0pCo961B2IHbdM8y/ACZsKD4dG6WqrjV53BADjwa7D+1aom2rsNVfLyDgU/eigvlJGJ08OQ4w==", + "node_modules/globby": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.1.0.tgz", + "integrity": "sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.6", - "es-errors": "^1.3.0", - "es-set-tostringtag": "^2.0.3", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.6", - "globalthis": "^1.0.4", - "gopd": "^1.2.0", - "has-property-descriptors": "^1.0.2", - "has-proto": "^1.2.0", - "has-symbols": "^1.1.0", - "internal-slot": "^1.1.0", - "iterator.prototype": "^1.1.4", - "safe-array-concat": "^1.1.3" + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.3", + "ignore": "^7.0.3", + "path-type": "^6.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.3.0" }, "engines": { - "node": ">= 0.4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/es-module-lexer": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", - "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", - "dev": true - }, - "node_modules/es-object-atoms": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", - "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "node_modules/globby/node_modules/path-type": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-6.0.0.tgz", + "integrity": "sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==", "dev": true, - "dependencies": { - "es-errors": "^1.3.0" - }, + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/es-set-tostringtag": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", - "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "dev": true, - "dependencies": { - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" - }, + "license": "MIT", "engines": { "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-shim-unscopables": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", - "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", "dev": true, - "dependencies": { - "hasown": "^2.0.2" - }, + "license": "MIT" + }, + "node_modules/hammerjs": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ==", + "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=0.8.0" } }, - "node_modules/es-to-primitive": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.0.tgz", - "integrity": "sha512-w+5mJ3GuFL+NjVtJlvydShqE1eN3h3PbI7/5LAsYJP/2qtuMXjfL2LpHSRqo4b4eSF5K/DH1JXKUAHSB2UW50g==", + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", "dev": true, - "dependencies": { - "is-callable": "^1.2.7", - "is-date-object": "^1.0.5", - "is-symbol": "^1.0.4" - }, + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -8109,772 +7149,804 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=8" } }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", - "dev": true - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, - "engines": { - "node": ">=10" + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint": { - "version": "9.28.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.28.0.tgz", - "integrity": "sha512-ocgh41VhRlf9+fVpe7QKzwLj9c92fDiqOj8Y3Sd4/ZmVA4Btx4PlUYPq4pp9JDyupkf1upbEXecxL2mwNV7jPQ==", + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", "dev": true, + "license": "MIT", "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.20.0", - "@eslint/config-helpers": "^0.2.1", - "@eslint/core": "^0.14.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.28.0", - "@eslint/plugin-kit": "^0.3.1", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.2", - "@types/estree": "^1.0.6", - "@types/json-schema": "^7.0.15", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.3.0", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" + "dunder-proto": "^1.0.0" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">= 0.4" }, "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-powerbi-visuals": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-powerbi-visuals/-/eslint-plugin-powerbi-visuals-1.0.0.tgz", - "integrity": "sha512-7FtQJ3HcNFJfipaIJMG6DwWvtUl8PM1H3mJaTCbA6XWYyrosMxFRZd6QpVP3zrzKlP6o01ACE1MN4Bi7EF6UYw==", - "dev": true, - "dependencies": { - "@typescript-eslint/parser": "^8.8.0", - "globals": "^15.10.0" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-plugin-powerbi-visuals/node_modules/globals": { - "version": "15.14.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.14.0.tgz", - "integrity": "sha512-OkToC372DtlQeje9/zHIo5CT8lRP/FUgEOKBEhU4e0abL7J7CD24fD9ohiLN5hagG/kWCYj4K5oaxxtj2Z0Dig==", + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=18" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-plugin-react": { - "version": "7.37.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", - "integrity": "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==", + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "dev": true, + "license": "MIT", "dependencies": { - "array-includes": "^3.1.8", - "array.prototype.findlast": "^1.2.5", - "array.prototype.flatmap": "^1.3.3", - "array.prototype.tosorted": "^1.1.4", - "doctrine": "^2.1.0", - "es-iterator-helpers": "^1.2.1", - "estraverse": "^5.3.0", - "hasown": "^2.0.2", - "jsx-ast-utils": "^2.4.1 || ^3.0.0", - "minimatch": "^3.1.2", - "object.entries": "^1.1.9", - "object.fromentries": "^2.0.8", - "object.values": "^1.2.1", - "prop-types": "^15.8.1", - "resolve": "^2.0.0-next.5", - "semver": "^6.3.1", - "string.prototype.matchall": "^4.0.12", - "string.prototype.repeat": "^1.0.0" + "has-symbols": "^1.0.3" }, "engines": { - "node": ">=4" + "node": ">= 0.4" }, - "peerDependencies": { - "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eslint-plugin-react/node_modules/resolve": { - "version": "2.0.0-next.5", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", - "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, + "license": "MIT", "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" + "function-bind": "^1.1.2" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 0.4" } }, - "node_modules/eslint-plugin-react/node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true, + "license": "MIT", "bin": { - "semver": "bin/semver.js" + "he": "bin/he" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", "dev": true, + "license": "ISC", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "lru-cache": "^6.0.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=10" } }, - "node_modules/eslint-scope/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "node_modules/htmlparser2": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.0.0.tgz", + "integrity": "sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g==", "dev": true, - "engines": { - "node": ">=4.0" + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.3", + "domutils": "^3.2.1", + "entities": "^6.0.0" } }, - "node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "node_modules/htmlparser2/node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "dev": true, + "license": "BSD-2-Clause", "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": ">=0.12" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.3.0.tgz", - "integrity": "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ==", + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, + "license": "MIT", "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" + "agent-base": "^7.1.0", + "debug": "^4.3.4" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" + "node": ">= 14" } }, - "node_modules/eslint/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">= 14" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" }, - "funding": { - "url": "https://opencollective.com/eslint" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/eslint/node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } }, - "node_modules/esm": { - "version": "3.2.25", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz", - "integrity": "sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==", + "node_modules/immutable": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.1.4.tgz", + "integrity": "sha512-p6u1bG3YSnINT5RQmx/yRZBpenIl30kVxkTLDyHLIMk0gict704Q9n+thfDI7lTRm9vXdDYutVzXhzcThxTnXA==", "dev": true, - "engines": { - "node": ">=6" - } + "license": "MIT" }, - "node_modules/espree": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", - "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, + "license": "MIT", "dependencies": { - "acorn": "^8.14.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.0" + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" }, "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">=6" }, "funding": { - "url": "https://opencollective.com/eslint" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/espree/node_modules/acorn": { - "version": "8.14.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", - "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, "bin": { - "acorn": "bin/acorn" + "import-local-fixture": "fixtures/cli.js" }, "engines": { - "node": ">=0.4.0" + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", - "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, + "license": "MIT", "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + "node": ">=0.8.19" + } + }, + "node_modules/indefinitely-typed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/indefinitely-typed/-/indefinitely-typed-1.1.0.tgz", + "integrity": "sha512-giaI0hCj+wWZIZZLsmWHI+LrM4Hwc+rEZ/VrgCafKePcnE42fLnQTFt4xspqLin8fCjI5WnQr2fep/0EFqjaxw==", + "license": "MIT", + "dependencies": { + "fs-extra": "^7.0.0", + "minimist": "^1.2.5" }, - "funding": { - "url": "https://opencollective.com/eslint" + "bin": { + "indefinitely-typed": "bin/cli2.js" } }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "node_modules/index-to-position": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", + "integrity": "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==", "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/esquery": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", - "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, + "license": "ISC", "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" + "once": "^1.3.0", + "wrappy": "1" } }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", "dev": true, + "license": "MIT", "dependencies": { - "estraverse": "^5.2.0" + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" }, "engines": { - "node": ">=4.0" + "node": ">= 0.4" } }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=4.0" + "node": ">= 0.10" } }, - "node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true + "node_modules/inuitcss": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/inuitcss/-/inuitcss-6.0.0.tgz", + "integrity": "sha512-FnyXNy2WSzSli4INmgtrsFwkzDljabK583AoC7KZutB6m8bVrAzjZ7jadro4N4RcqQRpMlW88NwgHIWgD7CDrg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "sass-mq": "^3.3.2" + } }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", "dev": true, + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, "engines": { - "node": ">= 0.6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, "engines": { - "node": ">=6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", - "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", - "dev": true - }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, "engines": { - "node": ">=0.8.x" + "node": ">=8" } }, - "node_modules/evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", "dev": true, + "license": "MIT", "dependencies": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", "dev": true, - "optional": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=4" } }, - "node_modules/express": { - "version": "4.21.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", - "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", "dev": true, - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.3", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.7.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.3.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.3", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.12", - "proxy-addr": "~2.0.7", - "qs": "6.13.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.19.0", - "serve-static": "1.16.2", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, + "license": "MIT", "engines": { - "node": ">= 0.10.0" + "node": ">= 0.4" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/express" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/express/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.0.0" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/express/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/express/node_modules/qs": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", - "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", "dev": true, + "license": "MIT", "dependencies": { - "side-channel": "^1.0.6" + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" }, "engines": { - "node": ">=0.6" + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true - }, - "node_modules/extra-watch-webpack-plugin": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/extra-watch-webpack-plugin/-/extra-watch-webpack-plugin-1.0.3.tgz", - "integrity": "sha512-ZScQdMH6hNofRRN6QMQFg+aa5vqimfBgnPXmRDhdaLpttT6hrzpY9Oyren3Gh/FySPrgsvKCNbx/NFA7XNdIsg==", + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", "dev": true, + "license": "MIT", "dependencies": { - "glob": "^7.1.2", - "is-glob": "^4.0.0", - "lodash.uniq": "^4.5.0", - "schema-utils": "^0.4.0" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/extra-watch-webpack-plugin/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "license": "MIT", + "bin": { + "is-docker": "cli.js" }, "engines": { - "node": "*" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, + "license": "MIT", "engines": { - "node": ">=8.6.0" + "node": ">=0.10.0" } }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", "dev": true, + "license": "MIT", "dependencies": { - "is-glob": "^4.0.1" + "call-bound": "^1.0.3" }, "engines": { - "node": ">= 6" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true - }, - "node_modules/fast-uri": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.3.tgz", - "integrity": "sha512-aLrHthzCjH5He4Z2H9YZ+v6Ujb9ocRuW6ZzkJQOrTxleEijANq4v1TsaPaVG1PZcuurEzrLcWRyYBYXD5cEiaw==", - "dev": true + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/fastest-levenshtein": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz", - "integrity": "sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==", + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 4.9.1" + "node": ">=8" } }, - "node_modules/fastq": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", - "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", "dev": true, + "license": "MIT", "dependencies": { - "reusify": "^1.0.4" + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/faye-websocket": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", - "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", "dependencies": { - "websocket-driver": ">=0.5.1" + "is-extglob": "^2.1.1" }, "engines": { - "node": ">=0.8.0" + "node": ">=0.10.0" } }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", "dev": true, + "license": "MIT", "dependencies": { - "pend": "~1.2.0" + "is-docker": "^3.0.0" + }, + "bin": { + "is-inside-container": "cli.js" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fdir": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", - "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", "dev": true, - "peerDependencies": { - "picomatch": "^3 || ^4" + "license": "MIT", + "engines": { + "node": ">= 0.4" }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", "dev": true, - "dependencies": { - "flat-cache": "^4.0.0" - }, + "license": "MIT" + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=16.0.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=0.12.0" } }, - "node_modules/finalhandler": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", - "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", "dev": true, + "license": "MIT", "dependencies": { - "debug": "2.6.9", - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { - "node": ">= 0.8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", "dev": true, - "dependencies": { - "ms": "2.0.0" + "license": "MIT", + "engines": { + "node": ">=0.10.0" } }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true + "node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } }, - "node_modules/find-replace": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", - "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "license": "MIT", "dependencies": { - "array-back": "^3.0.1" - }, - "engines": { - "node": ">=4.0.0" + "@types/estree": "*" } }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", "dev": true, + "license": "MIT", "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", "dev": true, - "bin": { - "flat": "cli.js" + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", "dev": true, + "license": "MIT", "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" + "call-bound": "^1.0.3" }, "engines": { - "node": ">=16" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/flatbuffers": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/flatbuffers/-/flatbuffers-2.0.4.tgz", - "integrity": "sha512-4rUFVDPjSoP0tOII34oQf+72NKU7E088U5oX7kwICahft0UB2kOQ9wUzzCp+OHxByERIfxRDCgX5mP8Pjkfl0g==" - }, - "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", - "dev": true - }, - "node_modules/follow-redirects": { - "version": "1.15.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", - "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], + "license": "MIT", "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } + "node": ">=0.10.0" } }, - "node_modules/for-each": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", - "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", "dev": true, + "license": "MIT", "dependencies": { - "is-callable": "^1.2.7" + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -8883,133 +7955,91 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/foreground-child": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", - "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", "dev": true, + "license": "MIT", "dependencies": { - "cross-spawn": "^7.0.6", - "signal-exit": "^4.0.1" + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" }, "engines": { - "node": ">=14" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/form-data": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", - "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", "dev": true, "license": "MIT", "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "es-set-tostringtag": "^2.1.0", - "hasown": "^2.0.2", - "mime-types": "^2.1.12" + "which-typed-array": "^1.1.16" }, "engines": { - "node": ">= 6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true, - "optional": true - }, - "node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "node": ">= 0.4" }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/fstream": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", - "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", - "deprecated": "This package is no longer supported.", + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", "dev": true, + "license": "MIT", "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" + "call-bound": "^1.0.3" }, "engines": { - "node": ">=0.6" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/function.prototype.name": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.8.tgz", - "integrity": "sha512-e5iwyodOHhbMr/yNrc7fDYG4qlbIvI5gajyzPnb5TCwyhjApznQh1BMFou9b30SevY43gCJKXycoCBjMbsuW0Q==", + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", "call-bound": "^1.0.3", - "define-properties": "^1.2.1", - "functions-have-names": "^1.2.3", - "hasown": "^2.0.2", - "is-callable": "^1.2.7" + "get-intrinsic": "^1.2.6" }, "engines": { "node": ">= 0.4" @@ -9018,121 +8048,90 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functions-have-names": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", - "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "node_modules/is-wsl": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", + "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", "dev": true, + "license": "MIT", + "dependencies": { + "is-inside-container": "^1.0.0" + }, + "engines": { + "node": ">=16" + }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-caller-file": { + "node_modules/isarray": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } + "license": "MIT" }, - "node_modules/get-intrinsic": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", - "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true, - "dependencies": { - "call-bind-apply-helpers": "^1.0.2", - "es-define-property": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.1.1", - "function-bind": "^1.1.2", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "hasown": "^2.0.2", - "math-intrinsics": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "ISC" }, - "node_modules/get-port": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/get-port/-/get-port-4.2.0.tgz", - "integrity": "sha512-/b3jarXkH8KJoOMQc3uVGHASwGLPq3gSFJ7tgJm2diza+bydJPTGOibin2steecKeOylE8oY2JERlVWkAJO6yw==", + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=0.10.0" } }, - "node_modules/get-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", - "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "node_modules/istextorbinary": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-9.5.0.tgz", + "integrity": "sha512-5mbUj3SiZXCuRf9fT3ibzbSSEWiy63gFfksmGfdOzujPjW3k+z8WvIBxcJHBoQNlaZaiyB25deviif2+osLmLw==", "dev": true, + "license": "Artistic-2.0", "dependencies": { - "dunder-proto": "^1.0.1", - "es-object-atoms": "^1.0.0" + "binaryextensions": "^6.11.0", + "editions": "^6.21.0", + "textextensions": "^6.11.0" }, "engines": { - "node": ">= 0.4" + "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/get-symbol-description": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", - "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "node_modules/iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6" + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" }, "engines": { "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } - }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", - "dev": true, - "optional": true - }, - "node_modules/github-slugger": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz", - "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==", - "dev": true - }, - "node_modules/gl-matrix": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.4.3.tgz", - "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==" - }, - "node_modules/glob": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", - "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + }, + "node_modules/jackspeak": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", + "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.3.1", - "jackspeak": "^4.1.1", - "minimatch": "^10.1.1", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" + "@isaacs/cliui": "^8.0.2" }, "engines": { "node": "20 || >=22" @@ -9141,1115 +8140,1224 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "node_modules/jest-worker": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", + "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", "dev": true, + "license": "MIT", "dependencies": { - "is-glob": "^4.0.3" + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" }, "engines": { - "node": ">=10.13.0" + "node": ">= 10.13.0" } }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true - }, - "node_modules/glob/node_modules/minimatch": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", - "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, - "license": "BlueOak-1.0.0", + "license": "MIT", "dependencies": { - "@isaacs/brace-expansion": "^5.0.0" + "has-flag": "^4.0.0" }, "engines": { - "node": "20 || >=22" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", "dev": true, + "license": "MIT", "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" + "argparse": "^2.0.1" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/globalthis": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", - "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", "dev": true, - "dependencies": { - "define-properties": "^1.2.1", - "gopd": "^1.0.1" + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=6" } }, - "node_modules/globby": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-14.1.0.tgz", - "integrity": "sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA==", + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", "dev": true, + "license": "MIT", "dependencies": { - "@sindresorhus/merge-streams": "^2.1.0", - "fast-glob": "^3.3.3", - "ignore": "^7.0.3", - "path-type": "^6.0.0", - "slash": "^5.1.0", - "unicorn-magic": "^0.3.0" + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" }, "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=12", + "npm": ">=6" } }, - "node_modules/gopd": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", - "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", "dev": true, - "engines": { - "node": ">= 0.4" + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">=4.0" } }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "node_modules/just-compare": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/just-compare/-/just-compare-1.5.1.tgz", + "integrity": "sha512-xDEEFHNIyJNmN4uo/2RVeUcay9THtN/5ka/iw98Y/gsa8w9KXZQuyaf5eFUY6VlntA2+G+bdPmdhqqTs7T+BRw==", + "license": "MIT" }, - "node_modules/graphemer": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", - "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } }, - "node_modules/gzip-size": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-6.0.0.tgz", - "integrity": "sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==", + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", "dev": true, + "license": "MIT", "dependencies": { - "duplexer": "^0.1.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/keytar": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", + "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "dependencies": { + "node-addon-api": "^4.3.0", + "prebuild-install": "^7.0.1" + } + }, + "node_modules/keytar/node_modules/node-addon-api": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", + "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" } }, - "node_modules/hammerjs": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", - "integrity": "sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ==", + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.8.0" + "node": ">=0.10.0" } }, - "node_modules/handle-thing": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-2.0.1.tgz", - "integrity": "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==", - "dev": true - }, - "node_modules/has-bigints": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", - "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=6" } }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, "engines": { - "node": ">=8" + "node": ">= 0.8.0" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", "dev": true, + "license": "MIT", "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "uc.micro": "^2.0.0" } }, - "node_modules/has-proto": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", - "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "node_modules/listenercount": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", + "integrity": "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", "dev": true, + "license": "MIT", "dependencies": { - "dunder-proto": "^1.0.0" + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=4" } }, - "node_modules/has-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", - "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "node_modules/loader-runner": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz", + "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=6.11.5" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "node_modules/has-tostringtag": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", - "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", "dependencies": { - "has-symbols": "^1.0.3" + "p-locate": "^5.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/hash-base": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.5.tgz", - "integrity": "sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==", + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true, - "dependencies": { - "inherits": "^2.0.4", - "safe-buffer": "^5.2.1" - }, - "engines": { - "node": ">= 0.10" - } + "license": "MIT" }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } + "license": "MIT" }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", "dev": true, - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } + "license": "MIT" }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", "dev": true, - "bin": { - "he": "bin/he" - } + "license": "MIT" }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", "dev": true, - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/hoist-non-react-statics": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", - "integrity": "sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==", - "dependencies": { - "react-is": "^16.7.0" - } + "license": "MIT" }, - "node_modules/hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "engines": { - "node": ">=10" - } + "license": "MIT" }, - "node_modules/hpack.js": { - "version": "2.1.6", - "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", - "integrity": "sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==", + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", "dev": true, - "dependencies": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, - "node_modules/hpack.js/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true + "license": "MIT" }, - "node_modules/hpack.js/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/hpack.js/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "license": "MIT" }, - "node_modules/hpack.js/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "node_modules/html-tags": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/html-tags/-/html-tags-2.0.0.tgz", - "integrity": "sha512-+Il6N8cCo2wB/Vd3gqy/8TZhTD3QvcVeQLCnZiGkGCH3JP28IgGAY41giccp2W4R3jfyJPAP318FQTa1yU7K7g==", - "engines": { - "node": ">=4" - } + "license": "MIT" }, - "node_modules/htmlparser2": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.0.0.tgz", - "integrity": "sha512-TwAZM+zE5Tq3lrEHvOlvwgj1XLWQCtaaibSN11Q+gGBAS7Y1uZSWwXXRe4iF6OXnaq1riyQAPFOBtYc77Mxq0g==", + "node_modules/lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", "dev": true, - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.2.1", - "entities": "^6.0.0" - } + "license": "MIT" }, - "node_modules/htmlparser2/node_modules/entities": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", - "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, "engines": { - "node": ">=0.12" + "node": ">=10" }, "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/http-deceiver": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/http-deceiver/-/http-deceiver-1.2.7.tgz", - "integrity": "sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==", - "dev": true - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dev": true, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" + "js-tokens": "^3.0.0 || ^4.0.0" }, - "engines": { - "node": ">= 0.8" + "bin": { + "loose-envify": "cli.js" } }, - "node_modules/http-parser-js": { - "version": "0.5.8", - "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.8.tgz", - "integrity": "sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==", - "dev": true - }, - "node_modules/http-proxy": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", - "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, + "license": "ISC", "dependencies": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" + "yallist": "^4.0.0" }, "engines": { - "node": ">=8.0.0" + "node": ">=10" } }, - "node_modules/http-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", - "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", "dev": true, + "license": "MIT", "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" + "@jridgewell/sourcemap-codec": "^1.5.5" } }, - "node_modules/http-proxy-middleware": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/http-proxy-middleware/-/http-proxy-middleware-2.0.9.tgz", - "integrity": "sha512-c1IyJYLYppU574+YI7R4QyX2ystMtVXZwIdzazUIPIJsHuWNd+mho2j+bKoHftndicGj9yh+xjd+l0yj7VeT1Q==", + "node_modules/make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, "license": "MIT", "dependencies": { - "@types/http-proxy": "^1.17.8", - "http-proxy": "^1.18.1", - "is-glob": "^4.0.1", - "is-plain-obj": "^3.0.0", - "micromatch": "^4.0.2" + "pify": "^3.0.0" }, "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "@types/express": "^4.17.13" - }, - "peerDependenciesMeta": { - "@types/express": { - "optional": true - } + "node": ">=4" } }, - "node_modules/http-proxy-middleware/node_modules/is-plain-obj": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-3.0.0.tgz", - "integrity": "sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==", + "node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", "dev": true, - "engines": { - "node": ">=10" + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "bin": { + "markdown-it": "bin/markdown-it.mjs" } }, - "node_modules/https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==", - "dev": true - }, - "node_modules/https-proxy-agent": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", - "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", "dev": true, - "dependencies": { - "agent-base": "^7.1.2", - "debug": "4" + "license": "MIT", + "bin": { + "marked": "bin/marked.js" }, "engines": { - "node": ">= 14" + "node": ">= 12" } }, - "node_modules/hyperdyperid": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz", - "integrity": "sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==", + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", "dev": true, + "license": "MIT", "engines": { - "node": ">=10.18" + "node": ">= 0.4" } }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "node_modules/math.gl": { + "version": "3.6.3", + "resolved": "https://registry.npmjs.org/math.gl/-/math.gl-3.6.3.tgz", + "integrity": "sha512-Yq9CyECvSDox9+5ETi2+x1bGTY5WvGUGL3rJfC4KPoCZAM51MGfrCm6rIn4yOJUVfMPs2a5RwMD+yGS/n1g3gg==", + "dev": true, + "license": "MIT", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" + "@math.gl/core": "3.6.3" } }, - "node_modules/icss-utils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", - "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "node_modules/mdast-util-to-string": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", + "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", "dev": true, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "node_modules/mdast-util-toc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-toc/-/mdast-util-toc-3.1.0.tgz", + "integrity": "sha512-Za0hqL1PqWrvxGtA/3NH9D5nhGAUS9grMM4obEAz5+zsk1RIw/vWUchkaoDLNdrwk05A0CSC5eEXng36/1qE5w==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "license": "MIT", + "dependencies": { + "github-slugger": "^1.2.1", + "mdast-util-to-string": "^1.0.5", + "unist-util-is": "^2.1.2", + "unist-util-visit": "^1.1.0" + } }, - "node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", "dev": true, - "engines": { - "node": ">= 4" - } + "license": "MIT" }, - "node_modules/image-size": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", - "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==", + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", "dev": true, - "optional": true, - "bin": { - "image-size": "bin/image-size.js" - }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.10.0" } }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", - "dev": true - }, - "node_modules/immutable": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-5.0.3.tgz", - "integrity": "sha512-P8IdPQHq3lA1xVeBRi5VPqUm5HDgKnx0Ru51wZz5mjxHr5n3RWhjIpOFU7ybkUxfB+5IToy+OLaHYDBIWsv+uw==", - "dev": true - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", - "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true, - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "license": "MIT" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" } }, - "node_modules/import-local": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", - "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" + "braces": "^3.0.3", + "picomatch": "^2.3.1" }, "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8.6" } }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/indefinitely-typed": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/indefinitely-typed/-/indefinitely-typed-1.1.0.tgz", - "integrity": "sha512-giaI0hCj+wWZIZZLsmWHI+LrM4Hwc+rEZ/VrgCafKePcnE42fLnQTFt4xspqLin8fCjI5WnQr2fep/0EFqjaxw==", - "dependencies": { - "fs-extra": "^7.0.0", - "minimist": "^1.2.5" + "node": ">=8.6" }, - "bin": { - "indefinitely-typed": "bin/cli2.js" + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" } }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "dev": true, - "optional": true - }, - "node_modules/inline-source-map": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.3.tgz", - "integrity": "sha512-1aVsPEsJWMJq/pdMU61CDlm1URcW702MTB4w9/zUjMus6H/Py8o7g68Pr9D4I6QluWGt/KdmswuRhaA05xVR1w==", + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, - "dependencies": { - "source-map": "~0.5.3" + "license": "MIT", + "engines": { + "node": ">= 0.6" } }, - "node_modules/internal-slot": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", - "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, + "license": "MIT", "dependencies": { - "es-errors": "^1.3.0", - "hasown": "^2.0.2", - "side-channel": "^1.1.0" + "mime-db": "1.52.0" }, "engines": { - "node": ">= 0.4" + "node": ">= 0.6" } }, - "node_modules/internmap": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", - "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "license": "MIT", + "optional": true, "engines": { - "node": ">=12" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, "engines": { - "node": ">= 0.10" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/inuitcss": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/inuitcss/-/inuitcss-6.0.0.tgz", - "integrity": "sha512-FnyXNy2WSzSli4INmgtrsFwkzDljabK583AoC7KZutB6m8bVrAzjZ7jadro4N4RcqQRpMlW88NwgHIWgD7CDrg==", - "dev": true, - "dependencies": { - "sass-mq": "^3.3.2" + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/ipaddr.js": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-2.2.0.tgz", - "integrity": "sha512-Ag3wB2o37wslZS19hZqorUnrnzSkpOVy+IiiDEiTqNubEYpYuHWIf6K4psgN2ZWKExS4xhVCrRVfb/wfW8fWJA==", + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, + "license": "ISC", "engines": { - "node": ">= 10" + "node": ">=16 || 14 >=14.17" } }, - "node_modules/is-arguments": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", - "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", + "node_modules/mjolnir.js": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/mjolnir.js/-/mjolnir.js-2.7.3.tgz", + "integrity": "sha512-Z5z/+FzZqOSO3juSVKV3zcm4R2eAlWwlKMcqHmyFEJAaLILNcDKnIbnb4/kbcGyIuhtdWrzu8WOIR7uM6I34aw==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" + "@types/hammerjs": "^2.0.41", + "hammerjs": "^2.0.8" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 4", + "npm": ">= 3" } }, - "node_modules/is-array-buffer": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", - "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "get-intrinsic": "^1.2.6" - }, - "engines": { - "node": ">= 0.4" + "minimist": "^1.2.6" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "bin": { + "mkdirp": "bin/cmd.js" } }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true, + "license": "MIT", + "optional": true }, - "node_modules/is-async-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", - "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", + "node_modules/mocha": { + "version": "10.8.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", + "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", "dev": true, + "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", + "chokidar": "^3.5.3", + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" }, - "engines": { - "node": ">= 0.4" + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 14.0.0" } }, - "node_modules/is-bigint": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", - "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { - "has-bigints": "^1.0.2" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" }, "engines": { - "node": ">= 0.4" + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "node_modules/mocha/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, + "license": "ISC", "dependencies": { - "binary-extensions": "^2.0.0" + "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=8" + "node": ">=10" } }, - "node_modules/is-boolean-object": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.1.tgz", - "integrity": "sha512-l9qO6eFlUETHtuihLcYOaLKByJ1f+N4kthcU9YjHy3N+B3hWv0y/2Nd0mu/7lTFnRQHTrSdXF50HQ3bl5fEnng==", + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" + "has-flag": "^4.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/chalk/supports-color?sponsor=1" } }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "node_modules/morphcharts": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/morphcharts/-/morphcharts-1.3.2.tgz", + "integrity": "sha512-0T34Aryx8a6p0hzOzKu4x/3cK9NBoq4+59fOapEt3Iy8mpQpVg3KiicKroZRfOyaz4gNPvgK9DG/Q37Ecgf2ig==", + "license": "MIT", + "dependencies": { + "@types/webxr": "^0.4.0", + "gl-matrix": "^3.4.3" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true, + "license": "ISC" + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "dev": true, "funding": [ { "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" + "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, "engines": { - "node": ">=4" + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/is-callable": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", - "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "node_modules/napi-build-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", + "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "MIT", + "optional": true }, - "node_modules/is-core-module": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.0.tgz", - "integrity": "sha512-urTSINYfAYgcbLb0yDQ6egFm6h3Mo1DcF9EkyXSRjjzdHbsulg01qhwWuXdOoUBuTkbQ80KDboXa0vFJ+BDH+g==", + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", + "dev": true, + "license": "MIT" + }, + "node_modules/nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true, + "license": "MIT" + }, + "node_modules/node-abi": { + "version": "3.85.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.85.0.tgz", + "integrity": "sha512-zsFhmbkAzwhTft6nd3VxcG0cvJsT70rL+BIGHWVq5fi6MwGrHwzqKaxXE+Hl2GmnGItnDKPPkO5/LQqjVkIdFg==", + "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "hasown": "^2.0.2" + "semver": "^7.3.5" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=10" } }, - "node_modules/is-data-view": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", - "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "node_modules/node-addon-api": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", + "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-sarif-builder": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/node-sarif-builder/-/node-sarif-builder-3.3.1.tgz", + "integrity": "sha512-8z5dAbhpxmk/WRQHXlv4V0h+9Y4Ugk+w08lyhV/7E/CQX9yDdBc3025/EG+RSMJU2aPFh/IQ7XDV7Ti5TLt/TA==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "get-intrinsic": "^1.2.6", - "is-typed-array": "^1.1.13" + "@types/sarif": "^2.1.7", + "fs-extra": "^11.1.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=20" } }, - "node_modules/is-date-object": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", - "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "node_modules/node-sarif-builder/node_modules/fs-extra": { + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.2.tgz", + "integrity": "sha512-Xr9F6z6up6Ws+NjzMCZc6WXg2YFRlrLP9NQDO3VQrWrfiojdhS56TzueT88ze0uBdCTwEIhQ3ptnmKeWGFAe0A==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "has-tostringtag": "^1.0.2" + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=14.14" + } + }, + "node_modules/node-sarif-builder/node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "optionalDependencies": { + "graceful-fs": "^4.1.6" } }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "node_modules/node-sarif-builder/node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 10.0.0" } }, - "node_modules/is-finalizationregistry": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", - "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "call-bound": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" } }, - "node_modules/is-fullwidth-code-point": { + "node_modules/normalize-package-data/node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true, + "license": "ISC" + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/normalize-path": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "node_modules/npm-run-all": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", + "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", "dev": true, + "license": "MIT", "dependencies": { - "has-tostringtag": "^1.0.0" + "ansi-styles": "^3.2.1", + "chalk": "^2.4.1", + "cross-spawn": "^6.0.5", + "memorystream": "^0.3.1", + "minimatch": "^3.0.4", + "pidtree": "^0.3.0", + "read-pkg": "^3.0.0", + "shell-quote": "^1.6.1", + "string.prototype.padend": "^3.0.0" }, - "engines": { - "node": ">= 0.4" + "bin": { + "npm-run-all": "bin/npm-run-all/index.js", + "run-p": "bin/run-p/index.js", + "run-s": "bin/run-s/index.js" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 4" } }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "node_modules/npm-run-all/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, + "license": "MIT", "dependencies": { - "is-extglob": "^2.1.1" + "color-convert": "^1.9.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/is-inside-container": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", - "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", + "node_modules/npm-run-all/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { - "is-docker": "^3.0.0" - }, - "bin": { - "is-inside-container": "cli.js" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/is-inside-container/node_modules/is-docker": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", - "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", + "node_modules/npm-run-all/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, - "bin": { - "is-docker": "cli.js" + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=4" } }, - "node_modules/is-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", - "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "node_modules/npm-run-all/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" } }, - "node_modules/is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", - "dev": true + "node_modules/npm-run-all/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true, + "license": "MIT" }, - "node_modules/is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "node_modules/npm-run-all/node_modules/cross-spawn": { + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=4.8" } }, - "node_modules/is-negative-zero": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", - "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "node_modules/npm-run-all/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.8.0" } }, - "node_modules/is-network-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-network-error/-/is-network-error-1.1.0.tgz", - "integrity": "sha512-tUdRRAnhT+OtCZR/LxZelH/C7QtjtFrTu5tXCA8pl55eTUElUHT+GPYV8MBMBvea/j+NxQqVt3LbWMRir7Gx9g==", + "node_modules/npm-run-all/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=16" + "node": ">=4" + } + }, + "node_modules/npm-run-all/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": "*" } }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "node_modules/npm-run-all/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.12.0" + "node": ">=4" } }, - "node_modules/is-number-object": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", - "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "node_modules/npm-run-all/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/npm-run-all/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" + "shebang-regex": "^1.0.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "node_modules/npm-run-all/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, - "node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "node_modules/npm-run-all/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "node_modules/npm-run-all/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", "dev": true, + "license": "ISC", "dependencies": { - "@types/estree": "*" + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" } }, - "node_modules/is-regex": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", - "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "node_modules/nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "call-bound": "^1.0.2", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2", - "hasown": "^2.0.2" + "boolbase": "^1.0.0" }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -10257,25 +9365,29 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-set": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", - "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", - "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" }, "engines": { "node": ">= 0.4" @@ -10284,23 +9396,33 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "node_modules/object.entries": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", + "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.1" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, - "node_modules/is-string": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", - "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "has-tostringtag": "^1.0.2" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -10309,15 +9431,17 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-symbol": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", - "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "has-symbols": "^1.1.0", - "safe-regex-test": "^1.1.0" + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -10326,38 +9450,64 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-typed-array": { - "version": "1.1.15", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", - "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, + "license": "ISC", "dependencies": { - "which-typed-array": "^1.1.16" + "wrappy": "1" + } + }, + "node_modules/open": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz", + "integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "default-browser": "^5.2.1", + "define-lazy-prop": "^3.0.0", + "is-inside-container": "^1.0.0", + "wsl-utils": "^0.1.0" }, "engines": { - "node": ">= 0.4" + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, - "engines": { - "node": ">=10" + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "engines": { + "node": ">= 0.8.0" } }, - "node_modules/is-weakmap": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", - "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "node_modules/own-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", + "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.6", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, "engines": { "node": ">= 0.4" }, @@ -10365,1331 +9515,1237 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-weakref": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", - "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3" + "yocto-queue": "^0.1.0" }, "engines": { - "node": ">= 0.4" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-weakset": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", - "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "get-intrinsic": "^1.2.6" + "p-limit": "^3.0.2" }, "engines": { - "node": ">= 0.4" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-what": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz", - "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==", - "dev": true - }, - "node_modules/is-wsl": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.0.tgz", - "integrity": "sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==", + "node_modules/p-map": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz", + "integrity": "sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==", "dev": true, - "dependencies": { - "is-inside-container": "^1.0.0" - }, + "license": "MIT", "engines": { - "node": ">=16" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" }, - "node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/istextorbinary": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-9.5.0.tgz", - "integrity": "sha512-5mbUj3SiZXCuRf9fT3ibzbSSEWiy63gFfksmGfdOzujPjW3k+z8WvIBxcJHBoQNlaZaiyB25deviif2+osLmLw==", + "node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", "dev": true, + "license": "MIT", "dependencies": { - "binaryextensions": "^6.11.0", - "editions": "^6.21.0", - "textextensions": "^6.11.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" }, "engines": { "node": ">=4" - }, - "funding": { - "url": "https://bevry.me/fund" } }, - "node_modules/iterator.prototype": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", - "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "node_modules/parse-semver": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", + "integrity": "sha512-Eg1OuNntBMH0ojvEKSrvDSnwLmvVuUOSdylH/pSCPNMIspLlweJyIWXCE+k/5hm3cj/EBUYwmWkjhBALNP4LXQ==", "dev": true, + "license": "MIT", "dependencies": { - "define-data-property": "^1.1.4", - "es-object-atoms": "^1.0.0", - "get-intrinsic": "^1.2.6", - "get-proto": "^1.0.0", - "has-symbols": "^1.1.0", - "set-function-name": "^2.0.2" + "semver": "^5.1.0" + } + }, + "node_modules/parse-semver/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/parse5": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", + "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^6.0.0" }, - "engines": { - "node": ">= 0.4" + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/jackspeak": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", - "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", + "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", "dev": true, - "license": "BlueOak-1.0.0", + "license": "MIT", "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" + "domhandler": "^5.0.3", + "parse5": "^7.0.0" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/jest-worker": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", - "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", + "node_modules/parse5-parser-stream": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", + "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", "dev": true, + "license": "MIT", "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" + "parse5": "^7.0.0" }, - "engines": { - "node": ">= 10.13.0" + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "node_modules/parse5/node_modules/entities": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", + "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, + "license": "BSD-2-Clause", "engines": { - "node": ">=10" + "node": ">=0.12" }, "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/js-tokens": { + "node_modules/path-exists": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" - }, - "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" + "engines": { + "node": ">=8" } }, - "node_modules/jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==", + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, - "node_modules/json-bignum": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/json-bignum/-/json-bignum-0.0.3.tgz", - "integrity": "sha512-2WHyXj3OfHSgNyuzDbSxI1w2jgw5gkWSWhS7Qg4bWXx1nLk3jnbwfUeS0PSba3IzpTUWdHxBieELUzXRjQB2zg==", + "license": "MIT", "engines": { - "node": ">=0.8" + "node": ">=0.10.0" } }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true - }, - "node_modules/json-loader": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", - "integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==", - "dev": true - }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, - "bin": { - "json5": "lib/cli.js" - }, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=8" } }, - "node_modules/jsonc-parser": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", - "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", - "dev": true - }, - "node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" }, - "node_modules/jsonwebtoken": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz", - "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==", + "node_modules/path-scurry": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz", + "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "jws": "^3.2.2", - "lodash.includes": "^4.3.0", - "lodash.isboolean": "^3.0.3", - "lodash.isinteger": "^4.0.4", - "lodash.isnumber": "^3.0.3", - "lodash.isplainobject": "^4.0.6", - "lodash.isstring": "^4.0.1", - "lodash.once": "^4.0.0", - "ms": "^2.1.1", - "semver": "^7.5.4" + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" }, "engines": { - "node": ">=12", - "npm": ">=6" + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/jsx-ast-utils": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", - "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz", + "integrity": "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==", "dev": true, - "dependencies": { - "array-includes": "^3.1.6", - "array.prototype.flat": "^1.3.1", - "object.assign": "^4.1.4", - "object.values": "^1.1.6" - }, + "license": "BlueOak-1.0.0", "engines": { - "node": ">=4.0" + "node": "20 || >=22" } }, - "node_modules/jszip": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", - "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", "dev": true, + "license": "MIT", "dependencies": { - "lie": "~3.3.0", - "pako": "~1.0.2", - "readable-stream": "~2.3.6", - "setimmediate": "^1.0.5" + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "node_modules/jszip/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/jszip/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/jszip/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "license": "MIT" }, - "node_modules/jszip/node_modules/string_decoder": { + "node_modules/picocolors": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/just-compare": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/just-compare/-/just-compare-1.5.1.tgz", - "integrity": "sha512-xDEEFHNIyJNmN4uo/2RVeUcay9THtN/5ka/iw98Y/gsa8w9KXZQuyaf5eFUY6VlntA2+G+bdPmdhqqTs7T+BRw==" + "license": "ISC" }, - "node_modules/jwa": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.2.tgz", - "integrity": "sha512-eeH5JO+21J78qMvTIDdBXidBd6nG2kZjg5Ohz/1fpa28Z4CcsWUzJ1ZZyFq/3z3N17aZy+ZuBoHljASbL1WfOw==", + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, - "dependencies": { - "buffer-equal-constant-time": "^1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/jws": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", - "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "node_modules/pidtree": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", + "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", "dev": true, - "dependencies": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" + "license": "MIT", + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" } }, - "node_modules/keytar": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", - "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==", + "node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", "dev": true, - "hasInstallScript": true, - "optional": true, - "dependencies": { - "node-addon-api": "^4.3.0", - "prebuild-install": "^7.0.1" + "license": "MIT", + "engines": { + "node": ">=4" } }, - "node_modules/keytar/node_modules/node-addon-api": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", - "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", - "dev": true, - "optional": true - }, - "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, + "license": "MIT", "dependencies": { - "json-buffer": "3.0.1" + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/launch-editor": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.9.1.tgz", - "integrity": "sha512-Gcnl4Bd+hRO9P9icCP/RVVT2o8SFlPXofuCxvA2SaZuH45whSvf5p8x5oih5ftLiVhEI4sp5xDY+R+b3zJBh5w==", + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, + "license": "MIT", "dependencies": { - "picocolors": "^1.0.0", - "shell-quote": "^1.8.1" + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/less": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/less/-/less-4.2.1.tgz", - "integrity": "sha512-CasaJidTIhWmjcqv0Uj5vccMI7pJgfD9lMkKtlnTHAdJdYK/7l8pM9tumLyJ0zhbD4KJLo/YvTj+xznQd5NBhg==", + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, + "license": "MIT", "dependencies": { - "copy-anything": "^2.0.1", - "parse-node-version": "^1.0.1", - "tslib": "^2.3.0" - }, - "bin": { - "lessc": "bin/lessc" + "p-try": "^2.0.0" }, "engines": { "node": ">=6" }, - "optionalDependencies": { - "errno": "^0.1.1", - "graceful-fs": "^4.1.2", - "image-size": "~0.5.0", - "make-dir": "^2.1.0", - "mime": "^1.4.1", - "needle": "^3.1.0", - "source-map": "~0.6.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/less-loader": { - "version": "12.2.0", - "resolved": "https://registry.npmjs.org/less-loader/-/less-loader-12.2.0.tgz", - "integrity": "sha512-MYUxjSQSBUQmowc0l5nPieOYwMzGPUaTzB6inNW/bdPEG9zOL3eAAD1Qw5ZxSPk7we5dMojHwNODYMV1hq4EVg==", + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, - "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "@rspack/core": "0.x || 1.x", - "less": "^3.5.0 || ^4.0.0", - "webpack": "^5.0.0" + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" }, - "peerDependenciesMeta": { - "@rspack/core": { - "optional": true - }, - "webpack": { - "optional": true - } + "engines": { + "node": ">=8" } }, - "node_modules/less/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", "dev": true, - "optional": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=4" } }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">= 0.4" } }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" }, "engines": { - "node": ">= 0.8.0" + "node": "^10 || ^12 || >=14" } }, - "node_modules/lie": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", - "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", "dev": true, - "dependencies": { - "immediate": "~3.0.5" - } + "license": "MIT" + }, + "node_modules/powerbi": { + "resolved": "packages/powerbi", + "link": true }, - "node_modules/lightningcss": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.30.1.tgz", - "integrity": "sha512-xi6IyHML+c9+Q3W0S4fCQJOym42pyurFiJUHEcEyHS0CeKzia4yZDEsLlqOFykxOdHpNy0NmvVO31vcSqAxJCg==", + "node_modules/prebuild-install": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", + "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "detect-libc": "^2.0.3" - }, - "engines": { - "node": ">= 12.0.0" + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^2.0.0", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "bin": { + "prebuild-install": "bin.js" }, - "optionalDependencies": { - "lightningcss-darwin-arm64": "1.30.1", - "lightningcss-darwin-x64": "1.30.1", - "lightningcss-freebsd-x64": "1.30.1", - "lightningcss-linux-arm-gnueabihf": "1.30.1", - "lightningcss-linux-arm64-gnu": "1.30.1", - "lightningcss-linux-arm64-musl": "1.30.1", - "lightningcss-linux-x64-gnu": "1.30.1", - "lightningcss-linux-x64-musl": "1.30.1", - "lightningcss-win32-arm64-msvc": "1.30.1", - "lightningcss-win32-x64-msvc": "1.30.1" - } - }, - "node_modules/lightningcss-darwin-arm64": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.30.1.tgz", - "integrity": "sha512-c8JK7hyE65X1MHMN+Viq9n11RRC7hgin3HhYKhrMyaXflk5GVplZ60IxyoVtzILeKr+xAJwg6zK6sjTBJ0FKYQ==", - "cpu": [ - "arm64" - ], + "engines": { + "node": ">=10" + } + }, + "node_modules/prebuild-install/node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", "dev": true, + "license": "Apache-2.0", "optional": true, - "os": [ - "darwin" - ], "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=8" } }, - "node_modules/lightningcss-darwin-x64": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.30.1.tgz", - "integrity": "sha512-k1EvjakfumAQoTfcXUcHQZhSpLlkAuEkdMBsI/ivWw9hL+7FtilQc0Cy3hrx0AAQrVtQAbMI7YjCgYgvn37PzA==", - "cpu": [ - "x64" - ], + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/probe.gl": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/probe.gl/-/probe.gl-3.6.0.tgz", + "integrity": "sha512-19JydJWI7+DtR4feV+pu4Mn1I5TAc0xojuxVgZdXIyfmTLfUaFnk4OloWK1bKbPtkgGKLr2lnbnCXmpZEcEp9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.0.0", + "@probe.gl/env": "3.6.0", + "@probe.gl/log": "3.6.0", + "@probe.gl/stats": "3.6.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", "dev": true, - "optional": true, - "os": [ - "darwin" - ], + "license": "MIT", "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">= 0.6.0" } }, - "node_modules/lightningcss-freebsd-x64": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.30.1.tgz", - "integrity": "sha512-kmW6UGCGg2PcyUE59K5r0kWfKPAVy4SltVeut+umLCFoJ53RdCUWxcRDzO1eTaxf/7Q2H7LTquFHPL5R+Gjyig==", - "cpu": [ - "x64" - ], + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true, - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "license": "MIT" + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" } }, - "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.30.1.tgz", - "integrity": "sha512-MjxUShl1v8pit+6D/zSPq9S9dQ2NPFSQwGvxBCYaBYLPlCWuPh9/t1MRS8iUaR8i+a6w7aps+B4N0S1TYP/R+Q==", - "cpu": [ - "arm" - ], + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", "dev": true, + "license": "MIT", "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" } }, - "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.30.1.tgz", - "integrity": "sha512-gB72maP8rmrKsnKYy8XUuXi/4OctJiuQjcuqWNlJQ6jZiWqtPvqFziskH3hnajfvKB27ynbVCucKSm2rkQp4Bw==", - "cpu": [ - "arm64" - ], + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=6" } }, - "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.30.1.tgz", - "integrity": "sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==", - "cpu": [ - "arm64" - ], + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "MIT", "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=6" } }, - "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.30.1.tgz", - "integrity": "sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==", - "cpu": [ - "x64" - ], + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", "dev": true, - "optional": true, - "os": [ - "linux" - ], + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, "engines": { - "node": ">= 12.0.0" + "node": ">=0.6" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/lightningcss-linux-x64-musl": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.30.1.tgz", - "integrity": "sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==", - "cpu": [ - "x64" - ], + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", "dev": true, - "optional": true, - "os": [ - "linux" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" } }, - "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.30.1.tgz", - "integrity": "sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==", - "cpu": [ - "arm64" - ], + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "bin": { + "rc": "cli.js" } }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.30.1.tgz", - "integrity": "sha512-PVqXh48wh4T53F/1CCu8PIPCxLzWyCnn/9T5W1Jpmdy5h9Cwd+0YQS6/LwhHXSafuc61/xg9Lv5OrCby6a++jg==", - "cpu": [ - "x64" - ], + "node_modules/rc-config-loader": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-4.1.3.tgz", + "integrity": "sha512-kD7FqML7l800i6pS6pvLyIE2ncbk9Du8Q0gp/4hMPhJU6ZxApkoLcGD8ZeqgiAlfwZ6BlETq6qqe+12DUL207w==", "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "license": "MIT", + "dependencies": { + "debug": "^4.3.4", + "js-yaml": "^4.1.0", + "json5": "^2.2.2", + "require-from-string": "^2.0.2" } }, - "node_modules/lightningcss/node_modules/detect-libc": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", - "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", "dev": true, + "license": "MIT", + "optional": true, "engines": { - "node": ">=8" + "node": ">=0.10.0" } }, - "node_modules/lines-and-columns": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz", - "integrity": "sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A==", - "dev": true, + "node_modules/react": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", + "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" + }, "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=0.10.0" } }, - "node_modules/linkify-it": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", - "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", - "dev": true, + "node_modules/react-dom": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", + "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", + "license": "MIT", "dependencies": { - "uc.micro": "^2.0.0" + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1", + "scheduler": "^0.20.2" + }, + "peerDependencies": { + "react": "17.0.2" } }, - "node_modules/listenercount": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/listenercount/-/listenercount-1.0.1.tgz", - "integrity": "sha512-3mk/Zag0+IJxeDrxSgaDPy4zZ3w05PRZeJNnlWhzFz5OkX49J4krc+A8X2d2M69vGMBEX0uyl8M+W+8gH+kBqQ==", - "dev": true + "node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" }, - "node_modules/lmdb": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/lmdb/-/lmdb-2.8.5.tgz", - "integrity": "sha512-9bMdFfc80S+vSldBmG3HOuLVHnxRdNTlpzR6QDnzqCQtCzGUEAGTzBKYMeIM+I/sU4oZfgbcbS7X7F65/z/oxQ==", + "node_modules/read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", "dev": true, - "hasInstallScript": true, + "license": "ISC", "dependencies": { - "msgpackr": "^1.9.5", - "node-addon-api": "^6.1.0", - "node-gyp-build-optional-packages": "5.1.1", - "ordered-binary": "^1.4.1", - "weak-lru-cache": "^1.2.2" - }, - "bin": { - "download-lmdb-prebuilds": "bin/download-prebuilds.js" + "mute-stream": "~0.0.4" }, - "optionalDependencies": { - "@lmdb/lmdb-darwin-arm64": "2.8.5", - "@lmdb/lmdb-darwin-x64": "2.8.5", - "@lmdb/lmdb-linux-arm": "2.8.5", - "@lmdb/lmdb-linux-arm64": "2.8.5", - "@lmdb/lmdb-linux-x64": "2.8.5", - "@lmdb/lmdb-win32-x64": "2.8.5" + "engines": { + "node": ">=0.8" } }, - "node_modules/lmdb/node_modules/node-addon-api": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", - "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==", - "dev": true - }, - "node_modules/load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", "dev": true, + "license": "MIT", "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" }, "engines": { "node": ">=4" } }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" }, "engines": { - "node": ">=4" + "node": ">= 6" } }, - "node_modules/load-json-file/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, "engines": { - "node": ">=4" + "node": ">=8.10.0" } }, - "node_modules/loader-runner": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", - "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", + "node_modules/readdirp/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=6.11.5" + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", "dev": true, + "license": "MIT", "dependencies": { - "p-locate": "^5.0.0" + "resolve": "^1.9.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.10" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/lodash.camelcase": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", - "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" - }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", - "dev": true - }, - "node_modules/lodash.defaults": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", - "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", - "dev": true - }, - "node_modules/lodash.includes": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", - "dev": true - }, - "node_modules/lodash.isboolean": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", - "dev": true - }, - "node_modules/lodash.isequal": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", - "integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==", - "dev": true - }, - "node_modules/lodash.isinteger": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", - "dev": true - }, - "node_modules/lodash.ismatch": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", - "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", - "dev": true - }, - "node_modules/lodash.isnumber": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", - "dev": true - }, - "node_modules/lodash.isplainobject": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", - "dev": true - }, - "node_modules/lodash.isstring": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", - "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", - "dev": true - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true - }, - "node_modules/lodash.once": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", - "dev": true - }, - "node_modules/lodash.truncate": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", - "integrity": "sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw==", - "dev": true - }, - "node_modules/lodash.uniq": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", - "integrity": "sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==", - "dev": true - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", "dev": true, + "license": "MIT", "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" }, "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/loose-envify": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", - "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", - "dependencies": { - "js-tokens": "^3.0.0 || ^4.0.0" - }, - "bin": { - "loose-envify": "cli.js" - } + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true, + "license": "MIT" }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/regenerate-unicode-properties": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", "dev": true, + "license": "MIT", "dependencies": { - "yallist": "^4.0.0" + "regenerate": "^1.4.0" }, "engines": { - "node": ">=10" + "node": ">=4" } }, - "node_modules/magic-string": { - "version": "0.30.17", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", - "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "license": "MIT" + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "node_modules/regexpu-core": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", + "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "pify": "^4.0.1", - "semver": "^5.6.0" + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.0.2", + "regjsgen": "^0.5.0", + "regjsparser": "^0.6.0", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.1.0" }, "engines": { - "node": ">=6" + "node": ">=4" } }, - "node_modules/make-dir/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "node_modules/regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", "dev": true, - "optional": true, - "bin": { - "semver": "bin/semver" - } + "license": "MIT" }, - "node_modules/markdown-it": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", - "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "node_modules/regjsparser": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz", + "integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "argparse": "^2.0.1", - "entities": "^4.4.0", - "linkify-it": "^5.0.0", - "mdurl": "^2.0.0", - "punycode.js": "^2.3.1", - "uc.micro": "^2.1.0" + "jsesc": "~0.5.0" }, "bin": { - "markdown-it": "bin/markdown-it.mjs" + "regjsparser": "bin/parser" } }, - "node_modules/marked": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", - "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "node_modules/replace-ext": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", + "integrity": "sha512-vuNYXC7gG7IeVNBC1xUllqCcZKRbJoSPOBhnTEcAIiKCsbuef6zO3F0Rve3isPMMoNoQRWjQwbAgAjHUHniyEA==", "dev": true, - "bin": { - "marked": "bin/marked.js" - }, + "license": "MIT", "engines": { - "node": ">= 12" + "node": ">= 0.10" } }, - "node_modules/math-intrinsics": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", - "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=0.10.0" } }, - "node_modules/math.gl": { - "version": "3.6.3", - "resolved": "https://registry.npmjs.org/math.gl/-/math.gl-3.6.3.tgz", - "integrity": "sha512-Yq9CyECvSDox9+5ETi2+x1bGTY5WvGUGL3rJfC4KPoCZAM51MGfrCm6rIn4yOJUVfMPs2a5RwMD+yGS/n1g3gg==", + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", "dev": true, - "dependencies": { - "@math.gl/core": "3.6.3" + "license": "MIT", + "engines": { + "node": ">=0.10.0" } }, - "node_modules/md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", "dev": true, + "license": "MIT", "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/mdast-util-to-string": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz", - "integrity": "sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==", + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" } }, - "node_modules/mdast-util-toc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mdast-util-toc/-/mdast-util-toc-3.1.0.tgz", - "integrity": "sha512-Za0hqL1PqWrvxGtA/3NH9D5nhGAUS9grMM4obEAz5+zsk1RIw/vWUchkaoDLNdrwk05A0CSC5eEXng36/1qE5w==", + "node_modules/resolve-cwd/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true, - "dependencies": { - "github-slugger": "^1.2.1", - "mdast-util-to-string": "^1.0.5", - "unist-util-is": "^2.1.2", - "unist-util-visit": "^1.1.0" + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/mdurl": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", - "dev": true + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.6" + "iojs": ">=1.0.0", + "node": ">=0.10.0" } }, - "node_modules/memfs": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/memfs/-/memfs-4.15.0.tgz", - "integrity": "sha512-q9MmZXd2rRWHS6GU3WEm3HyiXZyyoA1DqdOhEq0lxPBmKb5S7IAOwX0RgUCwJfqjelDCySa5h8ujOy24LqsWcw==", + "node_modules/rimraf": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.1.2.tgz", + "integrity": "sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "@jsonjoy.com/json-pack": "^1.0.3", - "@jsonjoy.com/util": "^1.3.0", - "tree-dump": "^1.0.1", - "tslib": "^2.0.0" + "glob": "^13.0.0", + "package-json-from-dist": "^1.0.1" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" }, "engines": { - "node": ">= 4.0.0" + "node": "20 || >=22" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/streamich" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/memorystream": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", - "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "node_modules/robust-predicates": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", + "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==", + "license": "Unlicense" + }, + "node_modules/rollup": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.3.tgz", + "integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==", "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, "engines": { - "node": ">= 0.10.0" + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.53.3", + "@rollup/rollup-android-arm64": "4.53.3", + "@rollup/rollup-darwin-arm64": "4.53.3", + "@rollup/rollup-darwin-x64": "4.53.3", + "@rollup/rollup-freebsd-arm64": "4.53.3", + "@rollup/rollup-freebsd-x64": "4.53.3", + "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", + "@rollup/rollup-linux-arm-musleabihf": "4.53.3", + "@rollup/rollup-linux-arm64-gnu": "4.53.3", + "@rollup/rollup-linux-arm64-musl": "4.53.3", + "@rollup/rollup-linux-loong64-gnu": "4.53.3", + "@rollup/rollup-linux-ppc64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-musl": "4.53.3", + "@rollup/rollup-linux-s390x-gnu": "4.53.3", + "@rollup/rollup-linux-x64-gnu": "4.53.3", + "@rollup/rollup-linux-x64-musl": "4.53.3", + "@rollup/rollup-openharmony-arm64": "4.53.3", + "@rollup/rollup-win32-arm64-msvc": "4.53.3", + "@rollup/rollup-win32-ia32-msvc": "4.53.3", + "@rollup/rollup-win32-x64-gnu": "4.53.3", + "@rollup/rollup-win32-x64-msvc": "4.53.3", + "fsevents": "~2.3.2" } }, - "node_modules/merge-descriptors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", - "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "node_modules/run-applescript": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz", + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==", "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, - "engines": { - "node": ">= 8" + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" } }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "dev": true, - "engines": { - "node": ">= 0.6" - } + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", + "license": "BSD-3-Clause" }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "node_modules/safe-array-concat": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", + "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" + "call-bind": "^1.0.8", + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" }, "engines": { - "node": ">=8.6" + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/micromatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, "engines": { - "node": ">=8.6" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", "dev": true, + "license": "MIT", "dependencies": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" }, - "bin": { - "miller-rabin": "bin/miller-rabin" + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/miller-rabin/node_modules/bn.js": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", - "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", - "dev": true + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "dev": true, - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } + "node_modules/sanddance-test-es6": { + "resolved": "packages/sanddance-test-es6", + "link": true }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, - "engines": { - "node": ">= 0.6" - } + "node_modules/sanddance-test-umd": { + "resolved": "packages/sanddance-test-umd", + "link": true }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "node_modules/sass": { + "version": "1.94.2", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.94.2.tgz", + "integrity": "sha512-N+7WK20/wOr7CzA2snJcUSSNTCzeCGUTFY3OgeQP3mZ1aj9NMQ0mSTXwlrnd89j33zzQJGqIN52GIOmYrfq46A==", "dev": true, + "license": "MIT", "dependencies": { - "mime-db": "1.52.0" + "chokidar": "^4.0.0", + "immutable": "^5.0.2", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" }, "engines": { - "node": ">= 0.6" + "node": ">=14.0.0" + }, + "optionalDependencies": { + "@parcel/watcher": "^2.4.1" } }, - "node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "node_modules/sass-mq": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/sass-mq/-/sass-mq-3.3.2.tgz", + "integrity": "sha512-o+9Corbwt+S8m+Ijjx6NgHvg+AEEVtLc//Tan9raIycmcUR/e45SZAaSoY6N1AG+63xoFftSPfSJDy4RWQdOjw==", "dev": true, - "optional": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } + "license": "MIT" }, - "node_modules/mini-css-extract-plugin": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-2.9.2.tgz", - "integrity": "sha512-GJuACcS//jtq4kCtd5ii/M0SZf7OZRH+BxdqXZHaJfb8TJiVl+NgQRPwiYt2EuqeSkNydn/7vP+bcE27C5mb9w==", + "node_modules/sass/node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", "dev": true, + "license": "MIT", "dependencies": { - "schema-utils": "^4.0.0", - "tapable": "^2.2.1" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 12.13.0" + "node": ">= 14.16.0" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.0.0" + "url": "https://paulmillr.com/funding/" } }, - "node_modules/mini-css-extract-plugin/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "node_modules/sass/node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "license": "MIT", + "engines": { + "node": ">= 14.18.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "type": "individual", + "url": "https://paulmillr.com/funding/" } }, - "node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "node_modules/sax": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.3.tgz", + "integrity": "sha512-yqYn1JhPczigF94DMS+shiDMjDowYO6y9+wB/4WgO0Y19jWYk0lQ4tuG5KI7kj4FTp1wxPj5IFfcrz/s1c3jjQ==", "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/scheduler": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", + "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" + "loose-envify": "^1.1.0", + "object-assign": "^4.1.1" } }, - "node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/mini-css-extract-plugin/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", + "node_modules/schema-utils": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz", + "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==", "dev": true, + "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.9.0", @@ -11704,693 +10760,630 @@ "url": "https://opencollective.com/webpack" } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==", - "dev": true - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/secretlint": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/secretlint/-/secretlint-10.2.2.tgz", + "integrity": "sha512-xVpkeHV/aoWe4vP4TansF622nBEImzCY73y/0042DuJ29iKIaqgoJ8fGxre3rVSHHbxar4FdJobmTnLp9AU0eg==", "dev": true, + "license": "MIT", "dependencies": { - "brace-expansion": "^1.1.7" + "@secretlint/config-creator": "^10.2.2", + "@secretlint/formatter": "^10.2.2", + "@secretlint/node": "^10.2.2", + "@secretlint/profiler": "^10.2.2", + "debug": "^4.4.1", + "globby": "^14.1.0", + "read-pkg": "^9.0.1" }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/mjolnir.js": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/mjolnir.js/-/mjolnir.js-2.7.3.tgz", - "integrity": "sha512-Z5z/+FzZqOSO3juSVKV3zcm4R2eAlWwlKMcqHmyFEJAaLILNcDKnIbnb4/kbcGyIuhtdWrzu8WOIR7uM6I34aw==", - "dev": true, - "dependencies": { - "@types/hammerjs": "^2.0.41", - "hammerjs": "^2.0.8" + "bin": { + "secretlint": "bin/secretlint.js" }, "engines": { - "node": ">= 4", - "npm": ">= 3" + "node": ">=20.0.0" } }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "node_modules/secretlint/node_modules/hosted-git-info": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", + "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", "dev": true, + "license": "ISC", "dependencies": { - "minimist": "^1.2.6" + "lru-cache": "^10.0.1" }, - "bin": { - "mkdirp": "bin/cmd.js" + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "dev": true, - "optional": true - }, - "node_modules/mocha": { - "version": "10.8.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", - "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", + "node_modules/secretlint/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", "dev": true, - "dependencies": { - "ansi-colors": "^4.1.3", - "browser-stdout": "^1.3.1", - "chokidar": "^3.5.3", - "debug": "^4.3.5", - "diff": "^5.2.0", - "escape-string-regexp": "^4.0.0", - "find-up": "^5.0.0", - "glob": "^8.1.0", - "he": "^1.2.0", - "js-yaml": "^4.1.0", - "log-symbols": "^4.1.0", - "minimatch": "^5.1.6", - "ms": "^2.1.3", - "serialize-javascript": "^6.0.2", - "strip-json-comments": "^3.1.1", - "supports-color": "^8.1.1", - "workerpool": "^6.5.1", - "yargs": "^16.2.0", - "yargs-parser": "^20.2.9", - "yargs-unparser": "^2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": ">= 14.0.0" - } + "license": "ISC" }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "node_modules/secretlint/node_modules/normalize-package-data": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", + "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "balanced-match": "^1.0.0" + "hosted-git-info": "^7.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^16.14.0 || >=18.0.0" } }, - "node_modules/mocha/node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "node_modules/secretlint/node_modules/parse-json": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", + "integrity": "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==", "dev": true, + "license": "MIT", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "@babel/code-frame": "^7.26.2", + "index-to-position": "^1.1.0", + "type-fest": "^4.39.1" }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mocha/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "node_modules/secretlint/node_modules/read-pkg": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-9.0.1.tgz", + "integrity": "sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==", "dev": true, + "license": "MIT", "dependencies": { - "brace-expansion": "^2.0.1" + "@types/normalize-package-data": "^2.4.3", + "normalize-package-data": "^6.0.0", + "parse-json": "^8.0.0", + "type-fest": "^4.6.0", + "unicorn-magic": "^0.1.0" }, "engines": { - "node": ">=10" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mocha/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "node_modules/secretlint/node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, + "license": "(MIT OR CC0-1.0)", "engines": { - "node": ">=10" + "node": ">=16" }, "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/morphcharts": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/morphcharts/-/morphcharts-1.2.8.tgz", - "integrity": "sha512-3rhsvZy1yiNfbw411RQoiydDPr5gSkWYJLvA0o8/RASCWa/QqF7cC7087cPAWvcCr/NvrM0DvFo0Sx4MIlPu0g==", - "dependencies": { - "@types/webxr": "^0.4.0", - "gl-matrix": "^3.4.3" + "node_modules/secretlint/node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mrmime": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", - "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", - "dev": true, + "node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, "engines": { "node": ">=10" } }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/msgpackr": { - "version": "1.11.4", - "resolved": "https://registry.npmjs.org/msgpackr/-/msgpackr-1.11.4.tgz", - "integrity": "sha512-uaff7RG9VIC4jacFW9xzL3jc0iM32DNHe4jYVycBcjUePT/Klnfj7pqtWJt9khvDFizmjN2TlYniYmSS2LIaZg==", + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, - "optionalDependencies": { - "msgpackr-extract": "^3.0.2" + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" } }, - "node_modules/msgpackr-extract": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz", - "integrity": "sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA==", + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dev": true, - "hasInstallScript": true, - "optional": true, + "license": "MIT", "dependencies": { - "node-gyp-build-optional-packages": "5.2.2" - }, - "bin": { - "download-msgpackr-prebuilds": "bin/download-prebuilds.js" + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" }, - "optionalDependencies": { - "@msgpackr-extract/msgpackr-extract-darwin-arm64": "3.0.3", - "@msgpackr-extract/msgpackr-extract-darwin-x64": "3.0.3", - "@msgpackr-extract/msgpackr-extract-linux-arm": "3.0.3", - "@msgpackr-extract/msgpackr-extract-linux-arm64": "3.0.3", - "@msgpackr-extract/msgpackr-extract-linux-x64": "3.0.3", - "@msgpackr-extract/msgpackr-extract-win32-x64": "3.0.3" - } - }, - "node_modules/msgpackr-extract/node_modules/detect-libc": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", - "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", - "dev": true, - "optional": true, "engines": { - "node": ">=8" + "node": ">= 0.4" } }, - "node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz", - "integrity": "sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw==", + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "detect-libc": "^2.0.1" + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" }, - "bin": { - "node-gyp-build-optional-packages": "bin.js", - "node-gyp-build-optional-packages-optional": "optional.js", - "node-gyp-build-optional-packages-test": "build-test.js" + "engines": { + "node": ">= 0.4" } }, - "node_modules/multicast-dns": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-7.2.5.tgz", - "integrity": "sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==", + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", "dev": true, + "license": "MIT", "dependencies": { - "dns-packet": "^5.2.2", - "thunky": "^1.0.2" + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" }, - "bin": { - "multicast-dns": "cli.js" + "engines": { + "node": ">= 0.4" } }, - "node_modules/mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true, + "license": "MIT" }, - "node_modules/nanoid": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", - "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" }, "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + "node": ">=8" } }, - "node_modules/napi-build-utils": { + "node_modules/shebang-command": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", - "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", - "dev": true, - "optional": true - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true - }, - "node_modules/needle": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/needle/-/needle-3.3.1.tgz", - "integrity": "sha512-6k0YULvhpw+RoLNiQCRKOl09Rv1dPLr8hHnVjHqdolKwDrdNyk+Hmrthi4lIGPPz3r39dLx0hsF5s40sZ3Us4Q==", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "iconv-lite": "^0.6.3", - "sax": "^1.2.4" - }, - "bin": { - "needle": "bin/needle" + "shebang-regex": "^3.0.0" }, "engines": { - "node": ">= 4.4.x" + "node": ">=8" } }, - "node_modules/negotiator": { - "version": "0.6.4", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.4.tgz", - "integrity": "sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==", + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">=8" } }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true - }, - "node_modules/nice-try": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", - "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", - "dev": true + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/node-abi": { - "version": "3.75.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.75.0.tgz", - "integrity": "sha512-OhYaY5sDsIka7H7AtijtI9jwGYLyl29eQn/W623DiN/MIv5sUqc4g7BIDThX+gb7di9f6xK02nkp8sdfFWZLTg==", + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "semver": "^7.3.5" + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" }, "engines": { - "node": ">=10" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/node-addon-api": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", - "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", - "dev": true - }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dev": true, + "license": "MIT", "dependencies": { - "whatwg-url": "^5.0.0" + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" }, "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" + "node": ">= 0.4" }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/node-forge": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, "engines": { - "node": ">= 6.13.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/node-gyp-build-optional-packages": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.1.1.tgz", - "integrity": "sha512-+P72GAjVAbTxjjwUmwjVrqrdZROD4nf8KgpBoDxqXXTiYZZt/ud60dE5yvCSr9lRO8e8yv6kgJIC0K0PfZFVQw==", + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "dev": true, + "license": "MIT", "dependencies": { - "detect-libc": "^2.0.1" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, - "bin": { - "node-gyp-build-optional-packages": "bin.js", - "node-gyp-build-optional-packages-optional": "optional.js", - "node-gyp-build-optional-packages-test": "build-test.js" + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/node-gyp-build-optional-packages/node_modules/detect-libc": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", - "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, + "license": "ISC", "engines": { - "node": ">=8" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/node-releases": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", - "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", - "dev": true + "node_modules/simple-concat": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", + "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true }, - "node_modules/node-sarif-builder": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/node-sarif-builder/-/node-sarif-builder-2.0.3.tgz", - "integrity": "sha512-Pzr3rol8fvhG/oJjIq2NTVB0vmdNNlz22FENhhPojYRZ4/ee08CfK4YuKmuL54V9MLhI1kpzxfOJ/63LzmZzDg==", + "node_modules/simple-get": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", + "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true, "dependencies": { - "@types/sarif": "^2.1.4", - "fs-extra": "^10.0.0" - }, - "engines": { - "node": ">=14" + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" } }, - "node_modules/node-sarif-builder/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "node_modules/slash": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, + "license": "MIT", "engines": { - "node": ">=12" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/node-sarif-builder/node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", "dev": true, + "license": "MIT", "dependencies": { - "universalify": "^2.0.0" + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, - "node_modules/node-sarif-builder/node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", "dev": true, + "license": "BSD-3-Clause", "engines": { - "node": ">= 10.0.0" + "node": ">= 12" } }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "dev": true, - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" } }, - "node_modules/normalize-package-data/node_modules/hosted-git-info": { - "version": "2.8.9", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, - "bin": { - "semver": "bin/semver" + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } }, - "node_modules/npm-run-all": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", - "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==", + "node_modules/sourcemap-codec": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", + "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", + "deprecated": "Please use @jridgewell/sourcemap-codec instead", "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "chalk": "^2.4.1", - "cross-spawn": "^6.0.5", - "memorystream": "^0.3.1", - "minimatch": "^3.0.4", - "pidtree": "^0.3.0", - "read-pkg": "^3.0.0", - "shell-quote": "^1.6.1", - "string.prototype.padend": "^3.0.0" - }, - "bin": { - "npm-run-all": "bin/npm-run-all/index.js", - "run-p": "bin/run-p/index.js", - "run-s": "bin/run-s/index.js" - }, - "engines": { - "node": ">= 4" - } + "license": "MIT" }, - "node_modules/npm-run-all/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/npm-run-all/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } + "license": "CC-BY-3.0" }, - "node_modules/npm-run-all/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, + "license": "MIT", "dependencies": { - "color-name": "1.1.3" + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" } }, - "node_modules/npm-run-all/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "node_modules/spdx-license-ids": { + "version": "3.0.22", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.22.tgz", + "integrity": "sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==", + "dev": true, + "license": "CC0-1.0" }, - "node_modules/npm-run-all/node_modules/cross-spawn": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", - "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", "dev": true, + "license": "MIT", "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" }, "engines": { - "node": ">=4.8" - } - }, - "node_modules/npm-run-all/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "engines": { - "node": ">=0.8.0" + "node": ">= 0.4" } }, - "node_modules/npm-run-all/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, - "engines": { - "node": ">=4" + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" } }, - "node_modules/npm-run-all/node_modules/path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, "engines": { - "node": ">=4" - } - }, - "node_modules/npm-run-all/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "bin": { - "semver": "bin/semver" + "node": ">=8" } }, - "node_modules/npm-run-all/node_modules/shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { - "shebang-regex": "^1.0.0" + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/npm-run-all/node_modules/shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/npm-run-all/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^3.0.0" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">=4" + "node": ">=8" } }, - "node_modules/npm-run-all/node_modules/which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "node_modules/string-width/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/nth-check": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "node_modules/string-width/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { - "boolbase": "^1.0.0" + "ansi-regex": "^5.0.1" }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, - "node_modules/nullthrows": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/nullthrows/-/nullthrows-1.1.1.tgz", - "integrity": "sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==", - "dev": true - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "engines": { - "node": ">=0.10.0" + "node": ">=8" } }, - "node_modules/object-inspect": { - "version": "1.13.4", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", - "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "node_modules/string.prototype.matchall": { + "version": "4.0.12", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", + "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.6", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.3", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.0" + }, "engines": { "node": ">= 0.4" }, @@ -12398,14 +11391,17 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-is": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", - "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", + "node_modules/string.prototype.padend": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.6.tgz", + "integrity": "sha512-XZpspuSB7vJWhvJc9DLSlrXl1mcA2BdoY5jjnS135ydXqLoqhs96JjDtCkjJEQHvfqZIp9hBuBMgI589peyx9Q==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", - "define-properties": "^1.2.1" + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" }, "engines": { "node": ">= 0.4" @@ -12414,27 +11410,31 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "node_modules/string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", "dev": true, - "engines": { - "node": ">= 0.4" + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" } }, - "node_modules/object.assign": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", - "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "node_modules/string.prototype.trim": { + "version": "1.2.10", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", + "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.8", - "call-bound": "^1.0.3", + "call-bound": "^1.0.2", + "define-data-property": "^1.1.4", "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", "es-object-atoms": "^1.0.0", - "has-symbols": "^1.1.0", - "object-keys": "^1.1.1" + "has-property-descriptors": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -12443,30 +11443,16 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.entries": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", - "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", + "node_modules/string.prototype.trimend": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", + "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.fromentries": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", - "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", + "call-bound": "^1.0.2", "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", "es-object-atoms": "^1.0.0" }, "engines": { @@ -12476,14 +11462,14 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.values": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", - "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", + "call-bind": "^1.0.7", "define-properties": "^1.2.1", "es-object-atoms": "^1.0.0" }, @@ -12494,1808 +11480,1859 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/obuf": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/obuf/-/obuf-1.1.2.tgz", - "integrity": "sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==", - "dev": true + "node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { - "ee-first": "1.1.1" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">= 0.8" + "node": ">=8" } }, - "node_modules/on-headers": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz", - "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==", + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, "license": "MIT", "engines": { - "node": ">= 0.8" + "node": ">=8" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", "dev": true, - "dependencies": { - "wrappy": "1" + "license": "MIT", + "engines": { + "node": ">=4" } }, - "node_modules/open": { - "version": "10.1.2", - "resolved": "https://registry.npmjs.org/open/-/open-10.1.2.tgz", - "integrity": "sha512-cxN6aIDPz6rm8hbebcP7vrQNhvRcveZoJU72Y7vskh4oIm+BZwBECnx5nTmrlres1Qapvx27Qo1Auukpf8PKXw==", + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true, - "dependencies": { - "default-browser": "^5.2.1", - "define-lazy-prop": "^3.0.0", - "is-inside-container": "^1.0.0", - "is-wsl": "^3.1.0" - }, + "license": "MIT", "engines": { - "node": ">=18" + "node": ">=8" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/opener": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz", - "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==", + "node_modules/structured-source": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-4.0.0.tgz", + "integrity": "sha512-qGzRFNJDjFieQkl/sVOI2dUjHKRyL9dAJi2gCPGJLbJHBIkyOHxjuocpIEfbLioX+qSJpvbYdT49/YCdMznKxA==", "dev": true, - "bin": { - "opener": "bin/opener-bin.js" + "license": "BSD-2-Clause", + "dependencies": { + "boundary": "^2.0.0" } }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, + "license": "MIT", "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" + "has-flag": "^4.0.0" }, "engines": { - "node": ">= 0.8.0" + "node": ">=8" } }, - "node_modules/ordered-binary": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/ordered-binary/-/ordered-binary-1.5.3.tgz", - "integrity": "sha512-oGFr3T+pYdTGJ+YFEILMpS3es+GiIbs9h/XQrclBXUtd44ey7XwfsMzM31f64I1SQOawDoDr/D823kNCADI8TA==", - "dev": true - }, - "node_modules/os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha512-gjcpUc3clBf9+210TRaDWbf+rZZZEshZ+DlXMRCeAjp0xhTrnQsKHypIy1J3d5hKdUzj69t708EHtU8P6bUn0A==", - "dev": true - }, - "node_modules/own-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.1.tgz", - "integrity": "sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==", + "node_modules/supports-hyperlinks": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-3.2.0.tgz", + "integrity": "sha512-zFObLMyZeEwzAoKCyu1B91U79K2t7ApXuQfo8OuxwXLDgcKxuwM+YvcbIhm6QWqz7mHUH1TVytR1PwVVjEuMig==", "dev": true, + "license": "MIT", "dependencies": { - "get-intrinsic": "^1.2.6", - "object-keys": "^1.1.1", - "safe-push-apply": "^1.0.0" + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" }, "engines": { - "node": ">= 0.4" + "node": ">=14.18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/chalk/supports-hyperlinks?sponsor=1" } }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "node_modules/table": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz", + "integrity": "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "p-limit": "^3.0.2" + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=10.0.0" } }, - "node_modules/p-map": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz", - "integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==", + "node_modules/table/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/p-retry": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/p-retry/-/p-retry-6.2.1.tgz", - "integrity": "sha512-hEt02O4hUct5wtwg4H4KcWgDdm+l1bOaEy/hWzd8xtXB9BqxTWBBhb+2ImAtH4Cv4rPjV76xN3Zumqk3k3AhhQ==", + "node_modules/table/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { - "@types/retry": "0.12.2", - "is-network-error": "^1.0.0", - "retry": "^0.13.1" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">=16.17" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=8" } }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "node_modules/tapable": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz", + "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true + "node_modules/tar-fs": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } }, - "node_modules/pad-left": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pad-left/-/pad-left-2.1.0.tgz", - "integrity": "sha512-HJxs9K9AztdIQIAIa/OIazRAUW/L6B9hbQDxO4X07roW3eo9XqZc2ur9bn1StH9CnbbI9EgvejHQX7CBpCF1QA==", + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "repeat-string": "^1.5.4" + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true - }, - "node_modules/parcel": { - "version": "2.15.2", - "resolved": "https://registry.npmjs.org/parcel/-/parcel-2.15.2.tgz", - "integrity": "sha512-+ZFhK66uYSwEju8gd3d1qDrBO9JzUNjySnjVJHm9M2boHVDOJl0ZcMQNHTQD9Oyhcba6sf3yIQecjNK1+UvpWg==", - "dev": true, - "dependencies": { - "@parcel/config-default": "2.15.2", - "@parcel/core": "2.15.2", - "@parcel/diagnostic": "2.15.2", - "@parcel/events": "2.15.2", - "@parcel/feature-flags": "2.15.2", - "@parcel/fs": "2.15.2", - "@parcel/logger": "2.15.2", - "@parcel/package-manager": "2.15.2", - "@parcel/reporter-cli": "2.15.2", - "@parcel/reporter-dev-server": "2.15.2", - "@parcel/reporter-tracer": "2.15.2", - "@parcel/utils": "2.15.2", - "chalk": "^4.1.2", - "commander": "^12.1.0", - "get-port": "^4.2.0" - }, - "bin": { - "parcel": "lib/bin.js" - }, + "node_modules/temp-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", + "integrity": "sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ==", + "dev": true, + "license": "MIT", "engines": { - "node": ">= 16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" + "node": ">=4" } }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "node_modules/temp-write": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/temp-write/-/temp-write-3.4.0.tgz", + "integrity": "sha512-P8NK5aNqcGQBC37i/8pL/K9tFgx14CF2vdwluD/BA/dGWGD4T4E59TE7dAxPyb2wusts2FhMp36EiopBBsGJ2Q==", "dev": true, + "license": "MIT", "dependencies": { - "callsites": "^3.0.0" + "graceful-fs": "^4.1.2", + "is-stream": "^1.1.0", + "make-dir": "^1.0.0", + "pify": "^3.0.0", + "temp-dir": "^1.0.0", + "uuid": "^3.0.1" }, "engines": { - "node": ">=6" + "node": ">=4" } }, - "node_modules/parse-asn1": { - "version": "5.1.7", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.7.tgz", - "integrity": "sha512-CTM5kuWR3sx9IFamcl5ErfPl6ea/N8IYwiJ+vpeB2g+1iknv7zBl5uPwbMbRVznRVbrNY6lGuDoE5b30grmbqg==", + "node_modules/temp-write/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", "dev": true, - "dependencies": { - "asn1.js": "^4.10.1", - "browserify-aes": "^1.2.0", - "evp_bytestokey": "^1.0.3", - "hash-base": "~3.0", - "pbkdf2": "^3.1.2", - "safe-buffer": "^5.2.1" - }, - "engines": { - "node": ">= 0.10" + "license": "MIT", + "bin": { + "uuid": "bin/uuid" } }, - "node_modules/parse-json": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.1.tgz", - "integrity": "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw==", + "node_modules/terminal-link": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-4.0.0.tgz", + "integrity": "sha512-lk+vH+MccxNqgVqSnkMVKx4VLJfnLjDBGzH16JVZjKE2DoxP57s6/vt6JmXV5I3jBcfGrxNrYtC+mPtU7WJztA==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.21.4", - "error-ex": "^1.3.2", - "json-parse-even-better-errors": "^3.0.0", - "lines-and-columns": "^2.0.3", - "type-fest": "^3.8.0" + "ansi-escapes": "^7.0.0", + "supports-hyperlinks": "^3.2.0" }, "engines": { - "node": ">=16" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parse-json/node_modules/json-parse-even-better-errors": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz", - "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==", + "node_modules/terser": { + "version": "5.44.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.1.tgz", + "integrity": "sha512-t/R3R/n0MSwnnazuPpPNVO60LX0SKL45pyl9YlvxIdkH0Of7D5qM2EVe+yASRIlY5pZ73nclYJfNANGWPwFDZw==", "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.15.0", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" + }, + "bin": { + "terser": "bin/terser" + }, "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": ">=10" } }, - "node_modules/parse-json/node_modules/type-fest": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz", - "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==", + "node_modules/terser-webpack-plugin": { + "version": "5.3.15", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.15.tgz", + "integrity": "sha512-PGkOdpRFK+rb1TzVz+msVhw4YMRT9txLF4kRqvJhGhCM324xuR3REBSHALN+l+sAhKUmz0aotnjp5D+P83mLhQ==", "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.25", + "jest-worker": "^27.4.5", + "schema-utils": "^4.3.0", + "serialize-javascript": "^6.0.2", + "terser": "^5.31.1" + }, "engines": { - "node": ">=14.16" + "node": ">= 10.13.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "uglify-js": { + "optional": true + } } }, - "node_modules/parse-node-version": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", - "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", + "node_modules/terser/node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, "engines": { - "node": ">= 0.10" + "node": ">=0.4.0" } }, - "node_modules/parse-semver": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", - "integrity": "sha512-Eg1OuNntBMH0ojvEKSrvDSnwLmvVuUOSdylH/pSCPNMIspLlweJyIWXCE+k/5hm3cj/EBUYwmWkjhBALNP4LXQ==", + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true, - "dependencies": { - "semver": "^5.1.0" - } + "license": "MIT" }, - "node_modules/parse-semver/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true, - "bin": { - "semver": "bin/semver" - } + "license": "MIT" }, - "node_modules/parse5": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", - "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", + "node_modules/textextensions": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-6.11.0.tgz", + "integrity": "sha512-tXJwSr9355kFJI3lbCkPpUH5cP8/M0GGy2xLO34aZCjMXBaK3SoPnZwr/oWmo1FdCnELcs4npdCIOFtq9W3ruQ==", "dev": true, + "license": "Artistic-2.0", "dependencies": { - "entities": "^6.0.0" + "editions": "^6.21.0" }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/parse5-htmlparser2-tree-adapter": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", - "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", - "dev": true, - "dependencies": { - "domhandler": "^5.0.3", - "parse5": "^7.0.0" + "engines": { + "node": ">=4" }, "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" + "url": "https://bevry.me/fund" } }, - "node_modules/parse5-parser-stream": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5-parser-stream/-/parse5-parser-stream-7.1.2.tgz", - "integrity": "sha512-JyeQc9iwFLn5TbvvqACIF/VXG6abODeB3Fwmv/TGdLk2LfbWkaySGY72at4+Ty7EkPZj854u4CrICqNk2qIbow==", + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", "dev": true, + "license": "MIT", "dependencies": { - "parse5": "^7.0.0" + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" }, "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" + "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/parse5/node_modules/entities": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", - "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", + "node_modules/tmp": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", + "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" + "node": ">=14.14" } }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, "engines": { - "node": ">= 0.8" + "node": ">=8.0" } }, - "node_modules/path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true + "node_modules/topojson-client": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-3.1.0.tgz", + "integrity": "sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==", + "license": "ISC", + "dependencies": { + "commander": "2" + }, + "bin": { + "topo2geo": "bin/topo2geo", + "topomerge": "bin/topomerge", + "topoquantize": "bin/topoquantize" + } }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "node_modules/topojson-client/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, + "node_modules/traverse": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", + "integrity": "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==", "dev": true, + "license": "MIT/X11", "engines": { - "node": ">=8" + "node": "*" } }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "node_modules/trough": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", + "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-scurry": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz", - "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==", + "node_modules/ts-loader": { + "version": "9.5.4", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.4.tgz", + "integrity": "sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ==", "dev": true, - "license": "BlueOak-1.0.0", + "license": "MIT", "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" }, "engines": { - "node": "20 || >=22" + "node": ">=12.0.0" }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" } }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "11.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.2.tgz", - "integrity": "sha512-F9ODfyqML2coTIsQpSkRHnLSZMtkU8Q+mSfcaIyKwy58u+8k5nvAYeiNhsyMARvzNcXJ9QfWVrcPsC9e9rAxtg==", - "dev": true, - "license": "ISC", - "engines": { - "node": "20 || >=22" - } + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" }, - "node_modules/path-to-regexp": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", - "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", - "dev": true + "node_modules/tsx-create-element": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tsx-create-element/-/tsx-create-element-2.3.0.tgz", + "integrity": "sha512-BMRK11fA8dQSqufL7u5HpqVSIzHBrXJldT3VNKJ1677fJ9NwEWEL7vRfA1ue6rtRnkKA99dwiLk1TR6Ox+erJw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*" + } }, - "node_modules/path-type": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-6.0.0.tgz", - "integrity": "sha512-Vj7sf++t5pBD637NSfkxpHSMfWaeig5+DKWLhcqIYx6mWQz5hdJTGDVMQiJcw1ZYkhs7AazKDGpRVji1LJCZUQ==", + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, - "node_modules/pbkdf2": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.3.tgz", - "integrity": "sha512-wfRLBZ0feWRhCIkoMB6ete7czJcnNnqRpcoWQBLqatqXXmelSRqfdDK4F3u9T2s2cXas/hQJcryI/4lAL+XTlA==", + "node_modules/tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", "dev": true, + "license": "Apache-2.0", + "optional": true, "dependencies": { - "create-hash": "~1.1.3", - "create-hmac": "^1.1.7", - "ripemd160": "=2.0.1", - "safe-buffer": "^5.2.1", - "sha.js": "^2.4.11", - "to-buffer": "^1.2.0" + "safe-buffer": "^5.0.1" }, "engines": { - "node": ">=0.12" + "node": "*" } }, - "node_modules/pbkdf2/node_modules/create-hash": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.1.3.tgz", - "integrity": "sha512-snRpch/kwQhcdlnZKYanNF1m0RDlrCdSKQaH87w1FCFPVPNCQ/Il9QJKAX2jVBZddRdaHBMC+zXa9Gw9tmkNUA==", + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, + "license": "MIT", "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "sha.js": "^2.4.0" + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" } }, - "node_modules/pbkdf2/node_modules/hash-base": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-2.0.2.tgz", - "integrity": "sha512-0TROgQ1/SxE6KmxWSvXHvRj90/Xo1JvZShofnYF+f6ZsGtR4eES7WfrQzPalmyagfKZCXpVnitiRebZulWsbiw==", + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", "dev": true, + "license": "MIT", "dependencies": { - "inherits": "^2.0.1" + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" } }, - "node_modules/pbkdf2/node_modules/ripemd160": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.1.tgz", - "integrity": "sha512-J7f4wutN8mdbV08MJnXibYpCOPHR+yzy+iQ/AsjMv2j8cLavQ8VGagDFUwwTAdF8FmRKVeNpbTTEwNHCW1g94w==", + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", "dev": true, + "license": "MIT", "dependencies": { - "hash-base": "^2.0.0", - "inherits": "^2.0.1" - } - }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "dev": true - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true - }, - "node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", - "dev": true, + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, "engines": { - "node": ">=12" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/pidtree": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz", - "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==", + "node_modules/typed-array-byte-offset": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", + "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", "dev": true, - "bin": { - "pidtree": "bin/pidtree.js" + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.9" }, "engines": { - "node": ">=0.10" - } - }, - "node_modules/pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true, - "optional": true, - "engines": { - "node": ">=6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "node_modules/typed-array-length": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", + "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", "dev": true, + "license": "MIT", "dependencies": { - "find-up": "^4.0.0" + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "is-typed-array": "^1.1.13", + "possible-typed-array-names": "^1.0.0", + "reflect.getprototypeof": "^1.0.6" }, "engines": { - "node": ">=8" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "node_modules/typed-rest-client": { + "version": "1.8.11", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.8.11.tgz", + "integrity": "sha512-5UvfMpd1oelmUPRbbaVnq+rHP7ng2cE4qoQkQeAqxRL6PklkxsM0g32/HL0yfvruK6ojQ5x8EE+HF4YV6DtuCA==", "dev": true, + "license": "MIT", "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" + "qs": "^6.9.1", + "tunnel": "0.0.6", + "underscore": "^1.12.1" } }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, - "dependencies": { - "p-locate": "^4.1.0" + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">=8" + "node": ">=14.17" } }, - "node_modules/pkg-dir/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", "dev": true, + "license": "MIT", "dependencies": { - "p-try": "^2.0.0" + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" }, "engines": { - "node": ">=6" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/underscore": { + "version": "1.13.7", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", + "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==", "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, + "license": "MIT" + }, + "node_modules/undici": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz", + "integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=20.18.1" } }, - "node_modules/pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } }, - "node_modules/possible-typed-array-names": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", - "integrity": "sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==", + "node_modules/unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", "dev": true, + "license": "MIT", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + }, "engines": { - "node": ">= 0.4" + "node": ">=4" } }, - "node_modules/postcss": { - "version": "8.4.49", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", - "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "node_modules/unicode-match-property-value-ecmascript": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "nanoid": "^3.3.7", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >=14" + "node": ">=4" } }, - "node_modules/postcss-modules-extract-imports": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-3.1.0.tgz", - "integrity": "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==", + "node_modules/unicode-property-aliases-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", "dev": true, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" + "node": ">=4" } }, - "node_modules/postcss-modules-local-by-default": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-4.2.0.tgz", - "integrity": "sha512-5kcJm/zk+GJDSfw+V/42fJ5fhjL5YbFDl8nVdXkJPLLW+Vf9mTD5Xe0wqIaDnLuL2U6cDNpTr+UQ+v2HWIBhzw==", + "node_modules/unicorn-magic": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", + "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==", "dev": true, - "dependencies": { - "icss-utils": "^5.0.0", - "postcss-selector-parser": "^7.0.0", - "postcss-value-parser": "^4.1.0" - }, + "license": "MIT", "engines": { - "node": "^10 || ^12 || >= 14" + "node": ">=18" }, - "peerDependencies": { - "postcss": "^8.1.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/postcss-modules-scope": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-3.2.1.tgz", - "integrity": "sha512-m9jZstCVaqGjTAuny8MdgE88scJnCiQSlSrOWcTQgM2t32UBe+MUmFSO5t7VMSfAf/FJKImAxBav8ooCHJXCJA==", + "node_modules/unified": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/unified/-/unified-7.1.0.tgz", + "integrity": "sha512-lbk82UOIGuCEsZhPj8rNAkXSDXd6p0QLzIuSsCdxrqnqU56St4eyOB+AlXsVgVeRmetPTYydIuvFfpDIed8mqw==", "dev": true, + "license": "MIT", "dependencies": { - "postcss-selector-parser": "^7.0.0" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" + "@types/unist": "^2.0.0", + "@types/vfile": "^3.0.0", + "bail": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^1.1.0", + "trough": "^1.0.0", + "vfile": "^3.0.0", + "x-is-string": "^0.1.0" } }, - "node_modules/postcss-modules-values": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-4.0.0.tgz", - "integrity": "sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==", + "node_modules/unist-util-is": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.3.tgz", + "integrity": "sha512-4WbQX2iwfr/+PfM4U3zd2VNXY+dWtZsN1fLnWEi2QQXA4qyDYAZcDMfXUX0Cu6XZUHHAO9q4nyxxLT4Awk1qUA==", + "dev": true, + "license": "MIT" + }, + "node_modules/unist-util-stringify-position": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", + "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", "dev": true, + "license": "MIT" + }, + "node_modules/unist-util-visit": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", + "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "dev": true, + "license": "MIT", "dependencies": { - "icss-utils": "^5.0.0" - }, - "engines": { - "node": "^10 || ^12 || >= 14" - }, - "peerDependencies": { - "postcss": "^8.1.0" + "unist-util-visit-parents": "^2.0.0" } }, - "node_modules/postcss-selector-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-7.0.0.tgz", - "integrity": "sha512-9RbEr1Y7FFfptd/1eEdntyjMwLeghW1bHX9GWjXo19vx4ytPQhANltvVxDggzJl7mnWM+dX28kb6cyS/4iQjlQ==", + "node_modules/unist-util-visit-parents": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", + "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", "dev": true, + "license": "MIT", "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" + "unist-util-is": "^3.0.0" } }, - "node_modules/postcss-value-parser": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", - "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", - "dev": true + "node_modules/unist-util-visit-parents/node_modules/unist-util-is": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", + "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", + "dev": true, + "license": "MIT" }, - "node_modules/powerbi": { - "resolved": "packages/powerbi", - "link": true + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unzipper": { + "version": "0.10.14", + "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.14.tgz", + "integrity": "sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "big-integer": "^1.6.17", + "binary": "~0.3.0", + "bluebird": "~3.4.1", + "buffer-indexof-polyfill": "~1.0.0", + "duplexer2": "~0.1.4", + "fstream": "^1.0.12", + "graceful-fs": "^4.2.2", + "listenercount": "~1.0.1", + "readable-stream": "~2.3.6", + "setimmediate": "~1.0.4" + } }, - "node_modules/powerbi-models": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/powerbi-models/-/powerbi-models-1.15.2.tgz", - "integrity": "sha512-UcBLtBB2wa8pL412DxyVZvv/bKiUVJfLTCXAuGmIqnOkoA/EnYDUM3B8oS2piN1azyEN8pjN353rE9DeARCJtA==" + "node_modules/unzipper/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" }, - "node_modules/powerbi-visuals-api": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/powerbi-visuals-api/-/powerbi-visuals-api-5.11.0.tgz", - "integrity": "sha512-OWvhexc4Dqz4swiQiZLnGj+NWUoX84metePeRw5Or3wG3lN/0x6Yd3xqJwBH67uYyjqQ/eomuF7lvbryxCqTbQ==", + "node_modules/unzipper/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", "dependencies": { - "semver": "^7.6.0" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/powerbi-visuals-tools": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/powerbi-visuals-tools/-/powerbi-visuals-tools-5.6.0.tgz", - "integrity": "sha512-WfR3VWz+Kre0vRi2+Sm08fGiBLUIDSp4zyFGH/q0CztA8XIWJt5BD+31A/gkkN4aifdBz8dcKXh1UxIYNajwSA==", + "node_modules/unzipper/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/unzipper/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/parser": "^8.8.0", - "assert": "^2.1.0", - "async": "^3.2.6", - "browserify-zlib": "^0.2.0", - "buffer": "^6.0.3", - "chalk": "^5.3.0", - "commander": "^12.1.0", - "compare-versions": "^6.1.1", - "console-browserify": "^1.2.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.12.0", - "css-loader": "^7.1.2", - "domain-browser": "^5.7.0", - "eslint-plugin-powerbi-visuals": "^1.0.0", - "events": "^3.3.0", - "extra-watch-webpack-plugin": "^1.0.3", - "fs-extra": "^11.2.0", - "https-browserify": "^1.0.0", - "inline-source-map": "^0.6.3", - "json-loader": "0.5.7", - "jszip": "^3.10.1", - "less": "^4.2.0", - "less-loader": "^12.2.0", - "lodash.clonedeep": "4.5.0", - "lodash.defaults": "4.2.0", - "lodash.isequal": "4.5.0", - "lodash.ismatch": "^4.4.0", - "mini-css-extract-plugin": "^2.9.1", - "os-browserify": "^0.3.0", - "path-browserify": "^1.0.1", - "powerbi-visuals-webpack-plugin": "4.1.0", - "process": "^0.11.10", - "punycode": "^2.3.1", - "querystring-es3": "^0.2.1", - "readable-stream": "^4.5.2", - "stream-browserify": "^3.0.0", - "stream-http": "^3.2.0", - "string_decoder": "^1.3.0", - "terser-webpack-plugin": "^5.3.10", - "timers-browserify": "^2.0.12", - "ts-loader": "^9.5.1", - "tty-browserify": "^0.0.1", - "typescript": "^5.5.0", - "url": "^0.11.4", - "util": "^0.12.5", - "vm-browserify": "^1.1.2", - "webpack": "^5.95.0", - "webpack-bundle-analyzer": "4.10.2", - "webpack-dev-server": "^5.1.0" - }, - "bin": { - "pbiviz": "bin/pbiviz.js" - }, - "engines": { - "node": ">=18.0.0" - }, - "optionalDependencies": { - "fsevents": "*" + "safe-buffer": "~5.1.0" } }, - "node_modules/powerbi-visuals-tools/node_modules/chalk": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.0.tgz", - "integrity": "sha512-ZkD35Mx92acjB2yNJgziGqT9oKHEOxjTBTDRpOsRWtdecL/0jM3z5kM/CTzHWvHIen1GvkM85p6TuFfDGfc8/Q==", + "node_modules/update-browserslist-db": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.2.tgz", + "integrity": "sha512-E85pfNzMQ9jpKkA7+TJAi4TJN+tBCuWh5rUcS/sv6cFi+1q9LYDwDI5dpUL0u/73EElyQ8d3TEaeW4sPedBqYA==", "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" } }, - "node_modules/powerbi-visuals-tools/node_modules/fs-extra": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", - "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" + "punycode": "^2.1.0" } }, - "node_modules/powerbi-visuals-tools/node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } + "license": "MIT" }, - "node_modules/powerbi-visuals-tools/node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true, - "engines": { - "node": ">= 10.0.0" - } + "license": "MIT" }, - "node_modules/powerbi-visuals-utils-dataviewutils": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/powerbi-visuals-utils-dataviewutils/-/powerbi-visuals-utils-dataviewutils-6.1.0.tgz", - "integrity": "sha512-m/pcpaB5thXdwCSg+AKyaJxVibCPmwC5ezsgccoI0H5jpsvu78lxFRTf+Tzoi1IAbLaWHyJAfxJ0F56jmioTOg==", - "optionalDependencies": { - "fsevents": "*" + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" } }, - "node_modules/powerbi-visuals-webpack-plugin": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/powerbi-visuals-webpack-plugin/-/powerbi-visuals-webpack-plugin-4.1.0.tgz", - "integrity": "sha512-ttXVVsQYcs6VuoMNZ4SRaK9vdRaIZsU1S16sDSgcnnf5dlaXXiB/j411HACdYLMrU0YUR/vI4QTC7xq52hbMgw==", + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "ajv": "6.12.3", - "chalk": "^4.1.2", - "compare-versions": "^3.6.0", - "fs-extra": "9.0.1", - "jszip": "^3.10.1", - "lodash.clonedeep": "4.5.0", - "webpack-sources": "^3.2.3" - }, - "engines": { - "node": ">=12.0.0" + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" } }, - "node_modules/powerbi-visuals-webpack-plugin/node_modules/ajv": { - "version": "6.12.3", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.3.tgz", - "integrity": "sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA==", - "dev": true, + "node_modules/vega": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/vega/-/vega-6.2.0.tgz", + "integrity": "sha512-BIwalIcEGysJdQDjeVUmMWB3e50jPDNAMfLJscjEvpunU9bSt7X1OYnQxkg3uBwuRRI4nWfFZO9uIW910nLeGw==", + "license": "BSD-3-Clause", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "vega-crossfilter": "~5.1.0", + "vega-dataflow": "~6.1.0", + "vega-encode": "~5.1.0", + "vega-event-selector": "~4.0.0", + "vega-expression": "~6.1.0", + "vega-force": "~5.1.0", + "vega-format": "~2.1.0", + "vega-functions": "~6.1.0", + "vega-geo": "~5.1.0", + "vega-hierarchy": "~5.1.0", + "vega-label": "~2.1.0", + "vega-loader": "~5.1.0", + "vega-parser": "~7.1.0", + "vega-projection": "~2.1.0", + "vega-regression": "~2.1.0", + "vega-runtime": "~7.1.0", + "vega-scale": "~8.1.0", + "vega-scenegraph": "~5.1.0", + "vega-statistics": "~2.0.0", + "vega-time": "~3.1.0", + "vega-transforms": "~5.1.0", + "vega-typings": "~2.1.0", + "vega-util": "~2.1.0", + "vega-view": "~6.1.0", + "vega-view-transforms": "~5.1.0", + "vega-voronoi": "~5.1.0", + "vega-wordcloud": "~5.1.0" + }, + "funding": { + "url": "https://app.hubspot.com/payments/GyPC972GD9Rt" } }, - "node_modules/powerbi-visuals-webpack-plugin/node_modules/compare-versions": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", - "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", - "dev": true + "node_modules/vega-canvas": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vega-canvas/-/vega-canvas-2.0.0.tgz", + "integrity": "sha512-9x+4TTw/USYST5nx4yN272sy9WcqSRjAR0tkQYZJ4cQIeon7uVsnohvoPQK1JZu7K1QXGUqzj08z0u/UegBVMA==", + "license": "BSD-3-Clause" }, - "node_modules/powerbi-visuals-webpack-plugin/node_modules/fs-extra": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz", - "integrity": "sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==", - "dev": true, + "node_modules/vega-crossfilter": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-crossfilter/-/vega-crossfilter-5.1.0.tgz", + "integrity": "sha512-EmVhfP3p6AM7o/lPan/QAoqjblI19BxWUlvl2TSs0xjQd8KbaYYbS4Ixt3cmEvl0QjRdBMF6CdJJ/cy9DTS4Fw==", + "license": "BSD-3-Clause", "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^1.0.0" - }, - "engines": { - "node": ">=10" + "d3-array": "^3.2.4", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/powerbi-visuals-webpack-plugin/node_modules/jsonfile": { + "node_modules/vega-dataflow": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, + "resolved": "https://registry.npmjs.org/vega-dataflow/-/vega-dataflow-6.1.0.tgz", + "integrity": "sha512-JxumGlODtFbzoQ4c/jQK8Tb/68ih0lrexlCozcMfTAwQ12XhTqCvlafh7MAKKTMBizjOfaQTHm4Jkyb1H5CfyQ==", + "license": "BSD-3-Clause", "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" + "vega-format": "^2.1.0", + "vega-loader": "^5.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/powerbi-visuals-webpack-plugin/node_modules/jsonfile/node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "node_modules/vega-datasets": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/vega-datasets/-/vega-datasets-2.8.1.tgz", + "integrity": "sha512-RxFyrlIH3xWzHtBDxp2vsFNCxuzNNfAtEvyufFX25UczIORyNi1T336NbM62g67k4KbDkeXzWEZHwr71qQKF8w==", "dev": true, - "engines": { - "node": ">= 10.0.0" - } + "license": "BSD-3-Clause" }, - "node_modules/powerbi-visuals-webpack-plugin/node_modules/universalify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", - "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", - "dev": true, - "engines": { - "node": ">= 10.0.0" + "node_modules/vega-encode": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-encode/-/vega-encode-5.1.0.tgz", + "integrity": "sha512-q26oI7B+MBQYcTQcr5/c1AMsX3FvjZLQOBi7yI0vV+GEn93fElDgvhQiYrgeYSD4Exi/jBPeUXuN6p4bLz16kA==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-interpolate": "^3.0.1", + "vega-dataflow": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/prebuild-install": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", - "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", - "dev": true, - "optional": true, + "node_modules/vega-event-selector": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/vega-event-selector/-/vega-event-selector-4.0.0.tgz", + "integrity": "sha512-CcWF4m4KL/al1Oa5qSzZ5R776q8lRxCj3IafCHs5xipoEHrkgu1BWa7F/IH5HrDNXeIDnqOpSV1pFsAWRak4gQ==", + "license": "BSD-3-Clause" + }, + "node_modules/vega-expression": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vega-expression/-/vega-expression-6.1.0.tgz", + "integrity": "sha512-hHgNx/fQ1Vn1u6vHSamH7lRMsOa/yQeHGGcWVmh8fZafLdwdhCM91kZD9p7+AleNpgwiwzfGogtpATFaMmDFYg==", + "license": "BSD-3-Clause", "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^2.0.0", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=10" + "@types/estree": "^1.0.8", + "vega-util": "^2.1.0" } }, - "node_modules/prebuild-install/node_modules/detect-libc": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.4.tgz", - "integrity": "sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==", - "dev": true, - "optional": true, - "engines": { - "node": ">=8" + "node_modules/vega-force": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-force/-/vega-force-5.1.0.tgz", + "integrity": "sha512-wdnchOSeXpF9Xx8Yp0s6Do9F7YkFeOn/E/nENtsI7NOcyHpICJ5+UkgjUo9QaQ/Yu+dIDU+sP/4NXsUtq6SMaQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-force": "^3.0.0", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "engines": { - "node": ">= 0.8.0" + "node_modules/vega-format": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-format/-/vega-format-2.1.0.tgz", + "integrity": "sha512-i9Ht33IgqG36+S1gFDpAiKvXCPz+q+1vDhDGKK8YsgMxGOG4PzinKakI66xd7SdV4q97FgpR7odAXqtDN2wKqw==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-format": "^3.1.0", + "d3-time-format": "^4.1.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/probe.gl": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/probe.gl/-/probe.gl-3.6.0.tgz", - "integrity": "sha512-19JydJWI7+DtR4feV+pu4Mn1I5TAc0xojuxVgZdXIyfmTLfUaFnk4OloWK1bKbPtkgGKLr2lnbnCXmpZEcEp9g==", - "dev": true, + "node_modules/vega-functions": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vega-functions/-/vega-functions-6.1.0.tgz", + "integrity": "sha512-yooEbWt0FWMBNoohwLsl25lEh08WsWabTXbbS+q0IXZzWSpX4Cyi45+q7IFyy/2L4oaIfGIIV14dgn3srQQcGA==", + "license": "BSD-3-Clause", "dependencies": { - "@babel/runtime": "^7.0.0", - "@probe.gl/env": "3.6.0", - "@probe.gl/log": "3.6.0", - "@probe.gl/stats": "3.6.0" + "d3-array": "^3.2.4", + "d3-color": "^3.1.0", + "d3-geo": "^3.1.1", + "vega-dataflow": "^6.1.0", + "vega-expression": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-scenegraph": "^5.1.0", + "vega-selections": "^6.1.0", + "vega-statistics": "^2.0.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "dev": true, - "engines": { - "node": ">= 0.6.0" + "node_modules/vega-geo": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-geo/-/vega-geo-5.1.0.tgz", + "integrity": "sha512-H8aBBHfthc3rzDbz/Th18+Nvp00J73q3uXGAPDQqizioDm/CoXCK8cX4pMePydBY9S6ikBiGJrLKFDa80wI20g==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-color": "^3.1.0", + "d3-geo": "^3.1.1", + "vega-canvas": "^2.0.0", + "vega-dataflow": "^6.1.0", + "vega-projection": "^2.1.0", + "vega-statistics": "^2.0.0", + "vega-util": "^2.1.0" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "node_modules/prop-types": { - "version": "15.8.1", - "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", - "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "node_modules/vega-hierarchy": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-hierarchy/-/vega-hierarchy-5.1.0.tgz", + "integrity": "sha512-rZlU8QJNETlB6o73lGCPybZtw2fBBsRIRuFE77aCLFHdGsh6wIifhplVarqE9icBqjUHRRUOmcEYfzwVIPr65g==", + "license": "BSD-3-Clause", "dependencies": { - "loose-envify": "^1.4.0", - "object-assign": "^4.1.1", - "react-is": "^16.13.1" + "d3-hierarchy": "^3.1.2", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dev": true, + "node_modules/vega-label": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-label/-/vega-label-2.1.0.tgz", + "integrity": "sha512-/hgf+zoA3FViDBehrQT42Lta3t8In6YwtMnwjYlh72zNn1p3c7E3YUBwqmAqTM1x+tudgzMRGLYig+bX1ewZxQ==", + "license": "BSD-3-Clause", "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" + "vega-canvas": "^2.0.0", + "vega-dataflow": "^6.1.0", + "vega-scenegraph": "^5.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/proxy-addr/node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "dev": true, - "engines": { - "node": ">= 0.10" + "node_modules/vega-loader": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-loader/-/vega-loader-5.1.0.tgz", + "integrity": "sha512-GaY3BdSPbPNdtrBz8SYUBNmNd8mdPc3mtdZfdkFazQ0RD9m+Toz5oR8fKnTamNSk9fRTJX0Lp3uEqxrAlQVreg==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-dsv": "^3.0.1", + "topojson-client": "^3.1.0", + "vega-format": "^2.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", - "dev": true, - "optional": true + "node_modules/vega-morphcharts-test-es6": { + "resolved": "packages/vega-morphcharts-test-es6", + "link": true }, - "node_modules/public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dev": true, + "node_modules/vega-parser": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/vega-parser/-/vega-parser-7.1.0.tgz", + "integrity": "sha512-g0lrYxtmYVW8G6yXpIS4J3Uxt9OUSkc0bLu5afoYDo4rZmoOOdll3x3ebActp5LHPW+usZIE+p5nukRS2vEc7Q==", + "license": "BSD-3-Clause", "dependencies": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" + "vega-dataflow": "^6.1.0", + "vega-event-selector": "^4.0.0", + "vega-functions": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-util": "^2.1.0" + } + }, + "node_modules/vega-projection": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-projection/-/vega-projection-2.1.0.tgz", + "integrity": "sha512-EjRjVSoMR5ibrU7q8LaOQKP327NcOAM1+eZ+NO4ANvvAutwmbNVTmfA1VpPH+AD0AlBYc39ND/wnRk7SieDiXA==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-geo": "^3.1.1", + "d3-geo-projection": "^4.0.0", + "vega-scale": "^8.1.0" } }, - "node_modules/public-encrypt/node_modules/bn.js": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", - "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==", - "dev": true - }, - "node_modules/pump": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", - "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", - "dev": true, - "optional": true, + "node_modules/vega-regression": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-regression/-/vega-regression-2.1.0.tgz", + "integrity": "sha512-HzC7MuoEwG1rIxRaNTqgcaYF03z/ZxYkQR2D5BN0N45kLnHY1HJXiEcZkcffTsqXdspLjn47yLi44UoCwF5fxQ==", + "license": "BSD-3-Clause", "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" + "d3-array": "^3.2.4", + "vega-dataflow": "^6.1.0", + "vega-statistics": "^2.0.0", + "vega-util": "^2.1.0" } }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "engines": { - "node": ">=6" + "node_modules/vega-runtime": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/vega-runtime/-/vega-runtime-7.1.0.tgz", + "integrity": "sha512-mItI+WHimyEcZlZrQ/zYR3LwHVeyHCWwp7MKaBjkU8EwkSxEEGVceyGUY9X2YuJLiOgkLz/6juYDbMv60pfwYA==", + "license": "BSD-3-Clause", + "dependencies": { + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/punycode.js": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", - "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", - "dev": true, - "engines": { - "node": ">=6" + "node_modules/vega-scale": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/vega-scale/-/vega-scale-8.1.0.tgz", + "integrity": "sha512-VEgDuEcOec8+C8+FzLcnAmcXrv2gAJKqQifCdQhkgnsLa978vYUgVfCut/mBSMMHbH8wlUV1D0fKZTjRukA1+A==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-scale-chromatic": "^3.1.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/qs": { - "version": "6.13.1", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.1.tgz", - "integrity": "sha512-EJPeIn0CYrGu+hli1xilKAPXODtJ12T0sP63Ijx2/khC2JtuaN3JyNIpvmnkmaEtha9ocbG4A4cMcr+TvqvwQg==", - "dev": true, + "node_modules/vega-scenegraph": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-scenegraph/-/vega-scenegraph-5.1.0.tgz", + "integrity": "sha512-4gA89CFIxkZX+4Nvl8SZF2MBOqnlj9J5zgdPh/HPx+JOwtzSlUqIhxFpFj7GWYfwzr/PyZnguBLPihPw1Og/cA==", + "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.6" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "d3-path": "^3.1.0", + "d3-shape": "^3.2.0", + "vega-canvas": "^2.0.0", + "vega-loader": "^5.1.0", + "vega-scale": "^8.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==", - "dev": true, - "engines": { - "node": ">=0.4.x" + "node_modules/vega-selections": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/vega-selections/-/vega-selections-6.1.2.tgz", + "integrity": "sha512-xJ+V4qdd46nk2RBdwIRrQm2iSTMHdlu/omhLz1pqRL3jZDrkqNBXimrisci2kIKpH2WBpA1YVagwuZEKBmF2Qw==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "3.2.4", + "vega-expression": "^6.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] + "node_modules/vega-statistics": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vega-statistics/-/vega-statistics-2.0.0.tgz", + "integrity": "sha512-dGPfDXnBlgXbZF3oxtkb8JfeRXd5TYHx25Z/tIoaa9jWua4Vf/AoW2wwh8J1qmMy8J03/29aowkp1yk4DOPazQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "^3.2.4" + } }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, + "node_modules/vega-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/vega-time/-/vega-time-3.1.0.tgz", + "integrity": "sha512-G93mWzPwNa6UYQRkr8Ujur9uqxbBDjDT/WpXjbDY0yygdSkRT+zXF+Sb4gjhW0nPaqdiwkn0R6kZcSPMj1bMNA==", + "license": "BSD-3-Clause", "dependencies": { - "safe-buffer": "^5.1.0" + "d3-array": "^3.2.4", + "d3-time": "^3.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, + "node_modules/vega-transforms": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-transforms/-/vega-transforms-5.1.0.tgz", + "integrity": "sha512-mj/sO2tSuzzpiXX8JSl4DDlhEmVwM/46MTAzTNQUQzJPMI/n4ChCjr/SdEbfEyzlD4DPm1bjohZGjLc010yuMg==", + "license": "BSD-3-Clause", "dependencies": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" + "d3-array": "^3.2.4", + "vega-dataflow": "^6.1.0", + "vega-statistics": "^2.0.0", + "vega-time": "^3.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true, - "engines": { - "node": ">= 0.6" + "node_modules/vega-typings": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-typings/-/vega-typings-2.1.0.tgz", + "integrity": "sha512-zdis4Fg4gv37yEvTTSZEVMNhp8hwyEl7GZ4X4HHddRVRKxWFsbyKvZx/YW5Z9Ox4sjxVA2qHzEbod4Fdx+SEJA==", + "license": "BSD-3-Clause", + "dependencies": { + "@types/geojson": "7946.0.16", + "vega-event-selector": "^4.0.0", + "vega-expression": "^6.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "dev": true, + "node_modules/vega-util": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-util/-/vega-util-2.1.0.tgz", + "integrity": "sha512-PGfp0m0QCufDmcxKJCWQy4Ov23FoF8DSXmoJwSezi3itQaa2hbxK0+xwsTMP2vy4PR16Pu25HMzgMwXVW1+33w==", + "license": "BSD-3-Clause" + }, + "node_modules/vega-view": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vega-view/-/vega-view-6.1.0.tgz", + "integrity": "sha512-hmHDm/zC65lb23mb9Tr9Gx0wkxP0TMS31LpMPYxIZpvInxvUn7TYitkOtz1elr63k2YZrgmF7ztdGyQ4iCQ5fQ==", + "license": "BSD-3-Clause", "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" + "d3-array": "^3.2.4", + "d3-timer": "^3.0.1", + "vega-dataflow": "^6.1.0", + "vega-format": "^2.1.0", + "vega-functions": "^6.1.0", + "vega-runtime": "^7.1.0", + "vega-scenegraph": "^5.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/raw-body/node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, + "node_modules/vega-view-transforms": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-view-transforms/-/vega-view-transforms-5.1.0.tgz", + "integrity": "sha512-fpigh/xn/32t+An1ShoY3MLeGzNdlbAp2+HvFKzPpmpMTZqJEWkk/J/wHU7Swyc28Ta7W1z3fO+8dZkOYO5TWQ==", + "license": "BSD-3-Clause", "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" + "vega-dataflow": "^6.1.0", + "vega-scenegraph": "^5.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "optional": true, + "node_modules/vega-voronoi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-voronoi/-/vega-voronoi-5.1.0.tgz", + "integrity": "sha512-uKdsoR9x60mz7eYtVG+NhlkdQXeVdMr6jHNAHxs+W+i6kawkUp5S9jp1xf1FmW/uZvtO1eqinHQNwATcDRsiUg==", + "license": "BSD-3-Clause", "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" + "d3-delaunay": "^6.0.4", + "vega-dataflow": "^6.1.0", + "vega-util": "^2.1.0" } }, - "node_modules/rc-config-loader": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/rc-config-loader/-/rc-config-loader-4.1.3.tgz", - "integrity": "sha512-kD7FqML7l800i6pS6pvLyIE2ncbk9Du8Q0gp/4hMPhJU6ZxApkoLcGD8ZeqgiAlfwZ6BlETq6qqe+12DUL207w==", - "dev": true, + "node_modules/vega-wordcloud": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vega-wordcloud/-/vega-wordcloud-5.1.0.tgz", + "integrity": "sha512-sSdNmT8y2D7xXhM2h76dKyaYn3PA4eV49WUUkfYfqHz/vpcu10GSAoFxLhQQTkbZXR+q5ZB63tFUow9W2IFo6g==", + "license": "BSD-3-Clause", "dependencies": { - "debug": "^4.3.4", - "js-yaml": "^4.1.0", - "json5": "^2.2.2", - "require-from-string": "^2.0.2" + "vega-canvas": "^2.0.0", + "vega-dataflow": "^6.1.0", + "vega-scale": "^8.1.0", + "vega-statistics": "^2.0.0", + "vega-util": "^2.1.0" } }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "node_modules/version-range": { + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/version-range/-/version-range-4.15.0.tgz", + "integrity": "sha512-Ck0EJbAGxHwprkzFO966t4/5QkRuzh+/I1RxhLgUKKwEn+Cd8NwM60mE3AqBZg5gYODoXW0EFsQvbZjRlvdqbg==", "dev": true, - "optional": true, + "license": "Artistic-2.0", "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", - "integrity": "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==", - "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" + "node": ">=4" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/react-dom": { - "version": "17.0.2", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-17.0.2.tgz", - "integrity": "sha512-s4h96KtLDUQlsENhMn1ar8t2bEa+q/YAtj8pPPdIjPDGBDIVNsrD9aXNWqspUe6AzKCIG0C1HZZLqLV7qpOBGA==", + "node_modules/vfile": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz", + "integrity": "sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ==", + "dev": true, + "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "scheduler": "^0.20.2" - }, - "peerDependencies": { - "react": "17.0.2" + "is-buffer": "^2.0.0", + "replace-ext": "1.0.0", + "unist-util-stringify-position": "^1.0.0", + "vfile-message": "^1.0.0" } }, - "node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "node_modules/react-refresh": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.16.0.tgz", - "integrity": "sha512-FPvF2XxTSikpJxcr+bHut2H4gJ17+18Uy20D5/F+SKzFap62R3cM5wH6b8WN3LyGSYeQilLEcJcR1fjBSI2S1A==", + "node_modules/vfile-message": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", + "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "license": "MIT", + "dependencies": { + "unist-util-stringify-position": "^1.1.1" } }, - "node_modules/read": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "node_modules/vite": { + "version": "7.2.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.6.tgz", + "integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==", "dev": true, + "license": "MIT", "dependencies": { - "mute-stream": "~0.0.4" + "esbuild": "^0.25.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" }, "engines": { - "node": ">=0.8" + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } } }, - "node_modules/read-pkg": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", - "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "node_modules/vscode-sanddance": { + "resolved": "extensions/vscode-sanddance", + "link": true + }, + "node_modules/vscode-test": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz", + "integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==", + "deprecated": "This package has been renamed to @vscode/test-electron, please update to the new name", "dev": true, + "license": "MIT", "dependencies": { - "load-json-file": "^4.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^3.0.0" + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "rimraf": "^3.0.2", + "unzipper": "^0.10.11" }, "engines": { - "node": ">=4" + "node": ">=8.9.3" } }, - "node_modules/read-pkg/node_modules/path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "node_modules/vscode-test/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "dev": true, + "license": "MIT", "dependencies": { - "pify": "^3.0.0" + "debug": "4" }, "engines": { - "node": ">=4" - } - }, - "node_modules/read-pkg/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", - "dev": true, - "engines": { - "node": ">=4" + "node": ">= 6.0.0" } }, - "node_modules/readable-stream": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", - "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", + "node_modules/vscode-test/node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "node_modules/vscode-test/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { - "picomatch": "^2.2.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/readdirp/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" + "node": "*" }, "funding": { - "url": "https://github.com/sponsors/jonschlinkert" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "node_modules/vscode-test/node_modules/http-proxy-agent": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", + "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", "dev": true, + "license": "MIT", "dependencies": { - "resolve": "^1.9.0" + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" }, "engines": { - "node": ">= 0.10" - } - }, - "node_modules/reduce-flatten": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", - "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", - "engines": { - "node": ">=6" + "node": ">= 6" } }, - "node_modules/reflect.getprototypeof": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.9.tgz", - "integrity": "sha512-r0Ay04Snci87djAsI4U+WNRcSw5S4pOH7qFjd/veA5gC7TbqESR3tcj28ia95L/fYUDw11JKP7uqUKUAfVvV5Q==", + "node_modules/vscode-test/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "dunder-proto": "^1.0.1", - "es-abstract": "^1.23.6", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.6", - "gopd": "^1.2.0", - "which-builtin-type": "^1.2.1" + "agent-base": "6", + "debug": "4" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 6" } }, - "node_modules/regenerate": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", - "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", - "dev": true - }, - "node_modules/regenerate-unicode-properties": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", - "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", + "node_modules/vscode-test/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, + "license": "ISC", "dependencies": { - "regenerate": "^1.4.0" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=4" + "node": "*" } }, - "node_modules/regenerator-runtime": { - "version": "0.13.11", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", - "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" - }, - "node_modules/regexp.prototype.flags": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", - "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "node_modules/vscode-test/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { - "call-bind": "^1.0.8", - "define-properties": "^1.2.1", - "es-errors": "^1.3.0", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "set-function-name": "^2.0.2" + "glob": "^7.1.3" }, - "engines": { - "node": ">= 0.4" + "bin": { + "rimraf": "bin.js" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/regexpu-core": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz", - "integrity": "sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ==", + "node_modules/watchpack": { + "version": "2.4.4", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz", + "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==", "dev": true, + "license": "MIT", "dependencies": { - "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^8.0.2", - "regjsgen": "^0.5.0", - "regjsparser": "^0.6.0", - "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.1.0" + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" }, "engines": { - "node": ">=4" + "node": ">=10.13.0" } }, - "node_modules/regjsgen": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", - "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", - "dev": true - }, - "node_modules/regjsparser": { - "version": "0.6.9", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz", - "integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==", + "node_modules/webpack": { + "version": "5.103.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.103.0.tgz", + "integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==", "dev": true, + "license": "MIT", "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, - "node_modules/repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/replace-ext": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz", - "integrity": "sha512-vuNYXC7gG7IeVNBC1xUllqCcZKRbJoSPOBhnTEcAIiKCsbuef6zO3F0Rve3isPMMoNoQRWjQwbAgAjHUHniyEA==", - "dev": true, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true, + "@types/eslint-scope": "^3.7.7", + "@types/estree": "^1.0.8", + "@types/json-schema": "^7.0.15", + "@webassemblyjs/ast": "^1.14.1", + "@webassemblyjs/wasm-edit": "^1.14.1", + "@webassemblyjs/wasm-parser": "^1.14.1", + "acorn": "^8.15.0", + "acorn-import-phases": "^1.0.3", + "browserslist": "^4.26.3", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.17.3", + "es-module-lexer": "^1.2.1", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.11", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.3.1", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^4.3.3", + "tapable": "^2.3.0", + "terser-webpack-plugin": "^5.3.11", + "watchpack": "^2.4.4", + "webpack-sources": "^3.3.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, "engines": { - "node": ">=0.10.0" + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } } }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", - "dev": true - }, - "node_modules/resolve": { - "version": "1.22.9", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.9.tgz", - "integrity": "sha512-QxrmX1DzraFIi9PxdG5VkRfRwIgjwyud+z/iBwfRRrVmHc+P9Q7u2lSSpQ6bjr2gy5lrqIiU9vb6iAeGf2400A==", + "node_modules/webpack-cli": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", + "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", "dev": true, + "license": "MIT", "dependencies": { - "is-core-module": "^2.16.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.2.0", + "@webpack-cli/info": "^1.5.0", + "@webpack-cli/serve": "^1.7.0", + "colorette": "^2.0.14", + "commander": "^7.0.0", + "cross-spawn": "^7.0.3", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "webpack-merge": "^5.7.3" }, "bin": { - "resolve": "bin/resolve" + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "@webpack-cli/migrate": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } } }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "node_modules/webpack-cli/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", "dev": true, - "dependencies": { - "resolve-from": "^5.0.0" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 10" } }, - "node_modules/resolve-cwd/node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", "dev": true, + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, "engines": { - "node": ">=8" + "node": ">=10.0.0" } }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "node_modules/webpack-sources": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz", + "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=10.13.0" } }, - "node_modules/retry": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", - "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "node_modules/webpack/node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, "engines": { - "node": ">= 4" + "node": ">=0.4.0" } }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "node_modules/webpack/node_modules/acorn-import-phases": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz", + "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==", "dev": true, + "license": "MIT", "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" + "node": ">=10.13.0" + }, + "peerDependencies": { + "acorn": "^8.14.0" } }, - "node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", + "node_modules/webpack/node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "glob": "^7.1.3" + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" }, - "bin": { - "rimraf": "bin.js" + "engines": { + "node": ">=8.0.0" } }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "node_modules/webpack/node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, + "license": "BSD-2-Clause", "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">=4.0" } }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "node_modules/whatwg-encoding": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", + "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", "dev": true, + "license": "MIT", "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" + "iconv-lite": "0.6.3" + }, + "engines": { + "node": ">=18" } }, - "node_modules/robust-predicates": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", - "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==" + "node_modules/whatwg-mimetype": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", + "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } }, - "node_modules/rollup": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.28.1.tgz", - "integrity": "sha512-61fXYl/qNVinKmGSTHAZ6Yy8I3YIJC/r2m9feHo6SwVAVcLT5MPwOUFe7EuURA/4m0NR8lXG4BBXuo/IZEsjMg==", + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "license": "ISC", "dependencies": { - "@types/estree": "1.0.6" + "isexe": "^2.0.0" }, "bin": { - "rollup": "dist/bin/rollup" + "node-which": "bin/node-which" }, "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.28.1", - "@rollup/rollup-android-arm64": "4.28.1", - "@rollup/rollup-darwin-arm64": "4.28.1", - "@rollup/rollup-darwin-x64": "4.28.1", - "@rollup/rollup-freebsd-arm64": "4.28.1", - "@rollup/rollup-freebsd-x64": "4.28.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.28.1", - "@rollup/rollup-linux-arm-musleabihf": "4.28.1", - "@rollup/rollup-linux-arm64-gnu": "4.28.1", - "@rollup/rollup-linux-arm64-musl": "4.28.1", - "@rollup/rollup-linux-loongarch64-gnu": "4.28.1", - "@rollup/rollup-linux-powerpc64le-gnu": "4.28.1", - "@rollup/rollup-linux-riscv64-gnu": "4.28.1", - "@rollup/rollup-linux-s390x-gnu": "4.28.1", - "@rollup/rollup-linux-x64-gnu": "4.28.1", - "@rollup/rollup-linux-x64-musl": "4.28.1", - "@rollup/rollup-win32-arm64-msvc": "4.28.1", - "@rollup/rollup-win32-ia32-msvc": "4.28.1", - "@rollup/rollup-win32-x64-msvc": "4.28.1", - "fsevents": "~2.3.2" + "node": ">= 8" } }, - "node_modules/run-applescript": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.0.0.tgz", - "integrity": "sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==", + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, "engines": { - "node": ">=18" + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/rw": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", - "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==" - }, - "node_modules/safe-array-concat": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.3.tgz", - "integrity": "sha512-AURm5f0jYEOydBj7VQlVvDrjeFgthDdEF5H1dP+6mNpoXOMo1quQqJ4wvJDyRZ9+pO3kGWoOdmV08cSv2aJV6Q==", + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.2", - "get-intrinsic": "^1.2.6", - "has-symbols": "^1.1.0", - "isarray": "^2.0.5" + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" }, "engines": { - "node": ">=0.4" + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safe-push-apply": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", - "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", "dev": true, + "license": "MIT", "dependencies": { - "es-errors": "^1.3.0", - "isarray": "^2.0.5" + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" }, "engines": { "node": ">= 0.4" @@ -14304,15 +13341,20 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/safe-regex-test": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", - "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "node_modules/which-typed-array": { + "version": "1.1.19", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", + "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "is-regex": "^1.2.1" + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" }, "engines": { "node": ">= 0.4" @@ -14321,1703 +13363,1600 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + "node_modules/wildcard": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", + "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", + "dev": true, + "license": "MIT" }, - "node_modules/sanddance-test-es6": { - "resolved": "packages/sanddance-test-es6", - "link": true + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } }, - "node_modules/sanddance-test-umd": { - "resolved": "packages/sanddance-test-umd", - "link": true + "node_modules/workerpool": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", + "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", + "dev": true, + "license": "Apache-2.0" }, - "node_modules/sass": { - "version": "1.89.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.89.1.tgz", - "integrity": "sha512-eMLLkl+qz7tx/0cJ9wI+w09GQ2zodTkcE/aVfywwdlRcI3EO19xGnbmJwg/JMIm+5MxVJ6outddLZ4Von4E++Q==", + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { - "chokidar": "^4.0.0", - "immutable": "^5.0.2", - "source-map-js": ">=0.6.2 <2.0.0" - }, - "bin": { - "sass": "sass.js" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=14.0.0" + "node": ">=10" }, - "optionalDependencies": { - "@parcel/watcher": "^2.4.1" + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/sass-mq": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/sass-mq/-/sass-mq-3.3.2.tgz", - "integrity": "sha512-o+9Corbwt+S8m+Ijjx6NgHvg+AEEVtLc//Tan9raIycmcUR/e45SZAaSoY6N1AG+63xoFftSPfSJDy4RWQdOjw==", - "dev": true - }, - "node_modules/sass/node_modules/chokidar": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.2.tgz", - "integrity": "sha512-/b57FK+bblSU+dfewfFe0rT1YjVDfOmeLQwCAuC+vwvgLkXboATqqmy+Ipux6JrF6L5joe5CBnFOw+gLWH6yKg==", + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { - "readdirp": "^4.0.1" + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" }, "engines": { - "node": ">= 14.16.0" + "node": ">=10" }, "funding": { - "url": "https://paulmillr.com/funding/" + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/sass/node_modules/readdirp": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", - "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==", + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" + "node": ">=8" } }, - "node_modules/sax": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.4.1.tgz", - "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", - "dev": true - }, - "node_modules/scheduler": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.20.2.tgz", - "integrity": "sha512-2eWfGgAqqWFGqtdMmcL5zCMK1U8KlXv8SQFGglL3CEtd0aDVDWgeF/YoCmvln55m5zSk3J/20hTaSBeSObsQDQ==", + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "node_modules/schema-utils": { - "version": "0.4.7", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", - "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" + "ansi-regex": "^5.0.1" }, "engines": { - "node": ">= 4" + "node": ">=8" } }, - "node_modules/secretlint": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/secretlint/-/secretlint-10.1.1.tgz", - "integrity": "sha512-q50i+I9w6HH8P6o34LVq6M3hm5GZn2Eq5lYGHkEByOAbVqBHn8gsMGgyxjP1xSrSv1QjDtjxs/zKPm6JtkNzGw==", + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true, + "license": "ISC" + }, + "node_modules/wsl-utils": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.1.0.tgz", + "integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==", + "dev": true, + "license": "MIT", "dependencies": { - "@secretlint/config-creator": "^10.1.1", - "@secretlint/formatter": "^10.1.1", - "@secretlint/node": "^10.1.1", - "@secretlint/profiler": "^10.1.1", - "debug": "^4.4.1", - "globby": "^14.1.0", - "read-pkg": "^8.1.0" - }, - "bin": { - "secretlint": "bin/secretlint.js" + "is-wsl": "^3.1.0" }, "engines": { - "node": ">=20.0.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/secretlint/node_modules/hosted-git-info": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", - "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", + "node_modules/x-is-string": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", + "integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w==", + "dev": true + }, + "node_modules/xml2js": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", "dev": true, + "license": "MIT", "dependencies": { - "lru-cache": "^10.0.1" + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" }, "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">=4.0.0" } }, - "node_modules/secretlint/node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true + "node_modules/xmlbuilder": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", + "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0" + } }, - "node_modules/secretlint/node_modules/normalize-package-data": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-6.0.2.tgz", - "integrity": "sha512-V6gygoYb/5EmNI+MEGrWkC+e6+Rr7mTmfHrxDbLzxQogBkgzo76rkok0Am6thgSF7Mv2nLOajAJj5vDJZEFn7g==", + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, - "dependencies": { - "hosted-git-info": "^7.0.0", - "semver": "^7.3.5", - "validate-npm-package-license": "^3.0.4" - }, + "license": "ISC", "engines": { - "node": "^16.14.0 || >=18.0.0" + "node": ">=10" } }, - "node_modules/secretlint/node_modules/read-pkg": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-8.1.0.tgz", - "integrity": "sha512-PORM8AgzXeskHO/WEv312k9U03B8K9JSiWF/8N9sUuFjBa+9SF2u6K7VClzXwDXab51jCd8Nd36CNM+zR97ScQ==", + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, + "license": "MIT", "dependencies": { - "@types/normalize-package-data": "^2.4.1", - "normalize-package-data": "^6.0.0", - "parse-json": "^7.0.0", - "type-fest": "^4.2.0" + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" }, "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=10" } }, - "node_modules/secretlint/node_modules/type-fest": { - "version": "4.41.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", - "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, + "license": "ISC", "engines": { - "node": ">=16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=10" } }, - "node_modules/select-hose": { + "node_modules/yargs-unparser": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", - "integrity": "sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==", - "dev": true - }, - "node_modules/selfsigned": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", - "integrity": "sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, + "license": "MIT", "dependencies": { - "@types/node-forge": "^1.3.0", - "node-forge": "^1" + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" }, "engines": { "node": ">=10" } }, - "node_modules/semver": { - "version": "7.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", - "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", - "bin": { - "semver": "bin/semver.js" - }, + "node_modules/yargs-unparser/node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=8" } }, - "node_modules/send": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", - "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "node_modules/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, + "license": "MIT", "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" } }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/yazl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.0.0" + "buffer-crc32": "~0.2.3" } }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/send/node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.8" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, + "packages/chart-recommender": { + "name": "@msrvida/chart-recommender", + "version": "4.0.0", + "license": "MIT", "dependencies": { - "randombytes": "^2.1.0" + "@msrvida/chart-types": "^1", + "@msrvida/sanddance-specs": "^2" } }, - "node_modules/serve-index": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/serve-index/-/serve-index-1.9.1.tgz", - "integrity": "sha512-pXHfKNP4qujrtteMrSBb0rc8HJ9Ms/GrXwcUtUtD5s4ewDJI8bT3Cz2zTVRMKtri49pLx2e0Ya8ziP5Ya2pZZw==", - "dev": true, + "packages/chart-types": { + "name": "@msrvida/chart-types", + "version": "1.1.1", + "license": "MIT", "dependencies": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - }, - "engines": { - "node": ">= 0.8.0" + "vega-typings": "~2.1.0" } }, - "node_modules/serve-index/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, + "packages/data-inference": { + "name": "@msrvida/data-inference", + "version": "2.0.0", + "license": "MIT", "dependencies": { - "ms": "2.0.0" + "@msrvida/chart-types": "^1", + "d3-color": "^3.1.0", + "vega-typings": "~2.1.0" } }, - "node_modules/serve-index/node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==", - "dev": true, - "engines": { - "node": ">= 0.6" - } + "packages/fluentui-icons": { + "name": "@msrvida/fluentui-icons", + "version": "1.1.1", + "license": "MIT" }, - "node_modules/serve-index/node_modules/http-errors": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==", - "dev": true, + "packages/fluentui-react-cdn-typings": { + "name": "@msrvida/fluentui-react-cdn-typings", + "version": "2.1.0", + "license": "MIT", "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" + "@fluentui/react": "^8" }, - "engines": { - "node": ">= 0.6" + "peerDependencies": { + "@types/react": ">=16.8.0 <18.0.0" } }, - "node_modules/serve-index/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==", - "dev": true - }, - "node_modules/serve-index/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/serve-index/node_modules/setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", - "dev": true + "packages/powerbi": { + "dependencies": { + "@babel/runtime": "^7.26.10", + "@babel/runtime-corejs2": "^7.26.10", + "@fluentui/react": "^8", + "@msrvida/sanddance-explorer": "file:../sanddance-explorer", + "core-js": "3.2.1", + "powerbi": "file:", + "powerbi-models": "^2.0.1", + "powerbi-visuals-api": "~5.11.0", + "powerbi-visuals-utils-dataviewutils": "^6.1.0", + "react": ">=16.8.0 <18.0.0", + "react-dom": ">=16.8.0 <18.0.0", + "regenerator-runtime": "^0.13.3", + "vega": "^6.2.0" + }, + "devDependencies": { + "@msrvida/fluentui-react-cdn-typings": "file:../fluentui-react-cdn-typings", + "@types/react": ">=16.8.0 <18.0.0", + "@types/react-dom": ">=16.8.0 <18.0.0", + "powerbi-visuals-tools": "^5" + } }, - "node_modules/serve-index/node_modules/statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", - "dev": true, + "packages/powerbi/node_modules/@babel/runtime-corejs2": { + "version": "7.28.4", + "license": "MIT", + "dependencies": { + "core-js": "^2.6.12" + }, "engines": { - "node": ">= 0.6" + "node": ">=6.9.0" } }, - "node_modules/serve-static": { - "version": "1.16.2", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", - "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "packages/powerbi/node_modules/@babel/runtime-corejs2/node_modules/core-js": { + "version": "2.6.12", + "hasInstallScript": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/@jsonjoy.com/base64": { + "version": "1.1.2", "dev": true, - "dependencies": { - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.19.0" - }, + "license": "Apache-2.0", "engines": { - "node": ">= 0.8.0" + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" } }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "packages/powerbi/node_modules/@jsonjoy.com/buffers": { + "version": "1.2.1", "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" + "license": "Apache-2.0", + "engines": { + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" }, - "engines": { - "node": ">= 0.4" + "peerDependencies": { + "tslib": "2" } }, - "node_modules/set-function-name": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", - "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "packages/powerbi/node_modules/@jsonjoy.com/codegen": { + "version": "1.0.0", "dev": true, - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "functions-have-names": "^1.2.3", - "has-property-descriptors": "^1.0.2" - }, + "license": "Apache-2.0", "engines": { - "node": ">= 0.4" + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" } }, - "node_modules/set-proto": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", - "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "packages/powerbi/node_modules/@jsonjoy.com/json-pack": { + "version": "1.21.0", "dev": true, + "license": "Apache-2.0", "dependencies": { - "dunder-proto": "^1.0.1", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0" + "@jsonjoy.com/base64": "^1.1.2", + "@jsonjoy.com/buffers": "^1.2.0", + "@jsonjoy.com/codegen": "^1.0.0", + "@jsonjoy.com/json-pointer": "^1.0.2", + "@jsonjoy.com/util": "^1.9.0", + "hyperdyperid": "^1.2.0", + "thingies": "^2.5.0", + "tree-dump": "^1.1.0" }, "engines": { - "node": ">= 0.4" + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" } }, - "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", - "dev": true - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", - "dev": true - }, - "node_modules/sha.js": { - "version": "2.4.12", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", - "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", + "packages/powerbi/node_modules/@jsonjoy.com/json-pointer": { + "version": "1.0.2", "dev": true, - "license": "(MIT AND BSD-3-Clause)", + "license": "Apache-2.0", "dependencies": { - "inherits": "^2.0.4", - "safe-buffer": "^5.2.1", - "to-buffer": "^1.2.0" - }, - "bin": { - "sha.js": "bin.js" + "@jsonjoy.com/codegen": "^1.0.0", + "@jsonjoy.com/util": "^1.9.0" }, "engines": { - "node": ">= 0.10" + "node": ">=10.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" } }, - "node_modules/shallow-clone": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", - "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "packages/powerbi/node_modules/@jsonjoy.com/util": { + "version": "1.9.0", "dev": true, + "license": "Apache-2.0", "dependencies": { - "kind-of": "^6.0.2" + "@jsonjoy.com/buffers": "^1.0.0", + "@jsonjoy.com/codegen": "^1.0.0" }, "engines": { - "node": ">=8" + "node": ">=10.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" } }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "packages/powerbi/node_modules/@leichtgewicht/ip-codec": { + "version": "2.0.5", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/@polka/url": { + "version": "1.0.0-next.29", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/@types/body-parser": { + "version": "1.19.6", "dev": true, + "license": "MIT", "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" + "@types/connect": "*", + "@types/node": "*" } }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "packages/powerbi/node_modules/@types/bonjour": { + "version": "3.5.13", "dev": true, - "engines": { - "node": ">=8" + "license": "MIT", + "dependencies": { + "@types/node": "*" } }, - "node_modules/shell-quote": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.2.tgz", - "integrity": "sha512-AzqKpGKjrj7EM6rKVQEPpB288oCfnrEIuyoT9cyF4nmGa7V8Zk6f7RRqYisX8X9m+Q7bd632aZW4ky7EhbQztA==", + "packages/powerbi/node_modules/@types/connect": { + "version": "3.4.38", "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "license": "MIT", + "dependencies": { + "@types/node": "*" } }, - "node_modules/side-channel": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", - "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "packages/powerbi/node_modules/@types/connect-history-api-fallback": { + "version": "1.5.4", "dev": true, + "license": "MIT", "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3", - "side-channel-list": "^1.0.0", - "side-channel-map": "^1.0.1", - "side-channel-weakmap": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "@types/express-serve-static-core": "*", + "@types/node": "*" } }, - "node_modules/side-channel-list": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", - "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "packages/powerbi/node_modules/@types/express": { + "version": "4.17.25", "dev": true, + "license": "MIT", "dependencies": { - "es-errors": "^1.3.0", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.33", + "@types/qs": "*", + "@types/serve-static": "^1" } }, - "node_modules/side-channel-map": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", - "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "packages/powerbi/node_modules/@types/express-serve-static-core": { + "version": "4.19.7", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*", + "@types/send": "*" } }, - "node_modules/side-channel-weakmap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", - "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "packages/powerbi/node_modules/@types/http-errors": { + "version": "2.0.5", "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/@types/http-proxy": { + "version": "1.17.17", + "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.5", - "object-inspect": "^1.13.3", - "side-channel-map": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "@types/node": "*" } }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "packages/powerbi/node_modules/@types/mime": { + "version": "1.3.5", "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } + "license": "MIT" }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "packages/powerbi/node_modules/@types/node-forge": { + "version": "1.3.14", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "optional": true + "license": "MIT", + "dependencies": { + "@types/node": "*" + } }, - "node_modules/simple-get": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", + "packages/powerbi/node_modules/@types/qs": { + "version": "6.14.0", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "optional": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/@types/range-parser": { + "version": "1.2.7", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/@types/retry": { + "version": "0.12.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/@types/send": { + "version": "1.2.1", + "dev": true, + "license": "MIT", "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" + "@types/node": "*" } }, - "node_modules/sirv": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", - "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", + "packages/powerbi/node_modules/@types/serve-index": { + "version": "1.9.4", "dev": true, + "license": "MIT", "dependencies": { - "@polka/url": "^1.0.0-next.24", - "mrmime": "^2.0.0", - "totalist": "^3.0.0" - }, - "engines": { - "node": ">= 10" + "@types/express": "*" } }, - "node_modules/slash": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", - "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", + "packages/powerbi/node_modules/@types/serve-static": { + "version": "1.15.10", "dev": true, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "license": "MIT", + "dependencies": { + "@types/http-errors": "*", + "@types/node": "*", + "@types/send": "<1" } }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", - "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "packages/powerbi/node_modules/@types/serve-static/node_modules/@types/send": { + "version": "0.17.6", "dev": true, + "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" + "@types/mime": "^1", + "@types/node": "*" } }, - "node_modules/sockjs": { - "version": "0.3.24", - "resolved": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.24.tgz", - "integrity": "sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==", + "packages/powerbi/node_modules/@types/sockjs": { + "version": "0.3.36", "dev": true, + "license": "MIT", "dependencies": { - "faye-websocket": "^0.11.3", - "uuid": "^8.3.2", - "websocket-driver": "^0.7.4" + "@types/node": "*" } }, - "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "packages/powerbi/node_modules/@types/ws": { + "version": "8.18.1", "dev": true, - "engines": { - "node": ">=0.10.0" + "license": "MIT", + "dependencies": { + "@types/node": "*" } }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "packages/powerbi/node_modules/abort-controller": { + "version": "3.0.0", "dev": true, + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=6.5" } }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "packages/powerbi/node_modules/accepts": { + "version": "1.3.8", "dev": true, + "license": "MIT", "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" } }, - "node_modules/source-map-support/node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "packages/powerbi/node_modules/accepts/node_modules/negotiator": { + "version": "0.6.3", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.6" } }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "deprecated": "Please use @jridgewell/sourcemap-codec instead", - "dev": true + "packages/powerbi/node_modules/acorn": { + "version": "8.15.0", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } }, - "node_modules/spdx-correct": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", - "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "packages/powerbi/node_modules/acorn-walk": { + "version": "8.3.4", "dev": true, + "license": "MIT", "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" } }, - "node_modules/spdx-exceptions": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", - "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", - "dev": true - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", - "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "packages/powerbi/node_modules/ajv": { + "version": "6.12.6", "dev": true, + "license": "MIT", "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/spdx-license-ids": { - "version": "3.0.20", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz", - "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==", - "dev": true + "packages/powerbi/node_modules/ajv-keywords": { + "version": "3.5.2", + "dev": true, + "license": "MIT", + "peerDependencies": { + "ajv": "^6.9.1" + } }, - "node_modules/spdy": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/spdy/-/spdy-4.0.2.tgz", - "integrity": "sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==", + "packages/powerbi/node_modules/ansi-html-community": { + "version": "0.0.8", "dev": true, - "dependencies": { - "debug": "^4.1.0", - "handle-thing": "^2.0.0", - "http-deceiver": "^1.2.7", - "select-hose": "^2.0.0", - "spdy-transport": "^3.0.0" - }, - "engines": { - "node": ">=6.0.0" + "engines": [ + "node >= 0.8.0" + ], + "license": "Apache-2.0", + "bin": { + "ansi-html": "bin/ansi-html" } }, - "node_modules/spdy-transport": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/spdy-transport/-/spdy-transport-3.0.0.tgz", - "integrity": "sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==", + "packages/powerbi/node_modules/array-flatten": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/asn1.js": { + "version": "4.10.1", "dev": true, + "license": "MIT", "dependencies": { - "debug": "^4.1.0", - "detect-node": "^2.0.4", - "hpack.js": "^2.1.6", - "obuf": "^1.1.2", - "readable-stream": "^3.0.6", - "wbuf": "^1.7.3" + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" } }, - "node_modules/spdy-transport/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "packages/powerbi/node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.2", "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/assert": { + "version": "2.1.0", + "dev": true, + "license": "MIT", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true + "packages/powerbi/node_modules/async": { + "version": "3.2.6", + "dev": true, + "license": "MIT" }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "packages/powerbi/node_modules/at-least-node": { + "version": "1.0.0", "dev": true, + "license": "ISC", "engines": { - "node": ">= 0.8" + "node": ">= 4.0.0" } }, - "node_modules/stop-iteration-iterator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", - "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "packages/powerbi/node_modules/batch": { + "version": "0.6.1", "dev": true, - "dependencies": { - "es-errors": "^1.3.0", - "internal-slot": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - } + "license": "MIT" }, - "node_modules/stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", + "packages/powerbi/node_modules/bn.js": { + "version": "5.2.2", "dev": true, - "dependencies": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - } + "license": "MIT" }, - "node_modules/stream-browserify/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "packages/powerbi/node_modules/body-parser": { + "version": "1.20.3", "dev": true, + "license": "MIT", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" }, "engines": { - "node": ">= 6" + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/stream-http": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.2.0.tgz", - "integrity": "sha512-Oq1bLqisTyK3TSCXpPbT4sdeYNdmyZJv1LxpEm2vu1ZhK89kSE5YXwZc3cWk0MagGaKriBh9mCFbVGtO+vY29A==", + "packages/powerbi/node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", "dev": true, + "license": "MIT", "dependencies": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "xtend": "^4.0.2" + "ms": "2.0.0" } }, - "node_modules/stream-http/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "packages/powerbi/node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.4.24", "dev": true, + "license": "MIT", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { - "node": ">= 6" + "node": ">=0.10.0" } }, - "node_modules/streamlit-component-lib": { + "packages/powerbi/node_modules/body-parser/node_modules/ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/streamlit-component-lib/-/streamlit-component-lib-2.0.0.tgz", - "integrity": "sha512-ekLjskU4Cz+zSLkTC9jpppv2hb8jlA3z2h+TtwGUGuwMKrGLrvTpzLJI1ibPuI+bZ60mLHVI1GP/OyNb7K7UjA==", - "dependencies": { - "apache-arrow": "^11.0.0", - "hoist-non-react-statics": "^3.3.2", - "react": "^16.14.0", - "react-dom": "^16.14.0" - } + "dev": true, + "license": "MIT" }, - "node_modules/streamlit-component-lib/node_modules/react": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react/-/react-16.14.0.tgz", - "integrity": "sha512-0X2CImDkJGApiAlcf0ODKIneSwBPhqJawOa5wCtKbu7ZECrmS26NvtSILynQ66cgkT/RJ4LidJOc3bUESwmU8g==", + "packages/powerbi/node_modules/body-parser/node_modules/qs": { + "version": "6.13.0", + "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2" + "side-channel": "^1.0.6" }, "engines": { - "node": ">=0.10.0" + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/streamlit-component-lib/node_modules/react-dom": { - "version": "16.14.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-16.14.0.tgz", - "integrity": "sha512-1gCeQXDLoIqMgqD3IO2Ah9bnf0w9kzhwN5q4FGnHZ67hBm9yePzB5JJAIQCc8x3pFnNlwFq4RidZggNAAkzWWw==", + "packages/powerbi/node_modules/bonjour-service": { + "version": "1.3.0", + "dev": true, + "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1", - "prop-types": "^15.6.2", - "scheduler": "^0.19.1" - }, - "peerDependencies": { - "react": "^16.14.0" + "fast-deep-equal": "^3.1.3", + "multicast-dns": "^7.2.5" } }, - "node_modules/streamlit-component-lib/node_modules/scheduler": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.19.1.tgz", - "integrity": "sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA==", + "packages/powerbi/node_modules/brorand": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/browserify-aes": { + "version": "1.2.0", + "dev": true, + "license": "MIT", "dependencies": { - "loose-envify": "^1.1.0", - "object-assign": "^4.1.1" + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" } }, - "node_modules/streamlit-sanddance": { - "resolved": "streamlit/streamlit_sanddance/frontend", - "link": true + "packages/powerbi/node_modules/browserify-cipher": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "packages/powerbi/node_modules/browserify-des": { + "version": "1.0.2", "dev": true, + "license": "MIT", "dependencies": { - "safe-buffer": "~5.2.0" + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" } }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "packages/powerbi/node_modules/browserify-rsa": { + "version": "4.1.1", "dev": true, "license": "MIT", "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" + "bn.js": "^5.2.1", + "randombytes": "^2.1.0", + "safe-buffer": "^5.2.1" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.10" } }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "packages/powerbi/node_modules/browserify-sign": { + "version": "4.2.5", "dev": true, - "license": "MIT", + "license": "ISC", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "bn.js": "^5.2.2", + "browserify-rsa": "^4.1.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.6.1", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.9", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" }, "engines": { - "node": ">=8" + "node": ">= 0.10" } }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "packages/powerbi/node_modules/browserify-sign/node_modules/isarray": { + "version": "1.0.0", "dev": true, "license": "MIT" }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "packages/powerbi/node_modules/browserify-sign/node_modules/readable-stream": { + "version": "2.3.8", "dev": true, "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "packages/powerbi/node_modules/browserify-sign/node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/browserify-sign/node_modules/string_decoder": { + "version": "1.1.1", "dev": true, "license": "MIT", "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "safe-buffer": "~5.1.0" } }, - "node_modules/string.prototype.matchall": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.12.tgz", - "integrity": "sha512-6CC9uyBL+/48dYizRf7H7VAYCMCNTBeM78x/VTUe9bFEaxBepPJDa1Ow99LqI/1yF7kuy7Q3cQsYMrcjGUcskA==", + "packages/powerbi/node_modules/browserify-sign/node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", "dev": true, - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.3", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.6", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "get-intrinsic": "^1.2.6", - "gopd": "^1.2.0", - "has-symbols": "^1.1.0", - "internal-slot": "^1.1.0", - "regexp.prototype.flags": "^1.5.3", - "set-function-name": "^2.0.2", - "side-channel": "^1.1.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "MIT" }, - "node_modules/string.prototype.padend": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.6.tgz", - "integrity": "sha512-XZpspuSB7vJWhvJc9DLSlrXl1mcA2BdoY5jjnS135ydXqLoqhs96JjDtCkjJEQHvfqZIp9hBuBMgI589peyx9Q==", + "packages/powerbi/node_modules/browserify-zlib": { + "version": "0.2.0", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "pako": "~1.0.5" } }, - "node_modules/string.prototype.repeat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", - "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "packages/powerbi/node_modules/buffer": { + "version": "6.0.3", "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", "dependencies": { - "define-properties": "^1.1.3", - "es-abstract": "^1.17.5" + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "node_modules/string.prototype.trim": { - "version": "1.2.10", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.10.tgz", - "integrity": "sha512-Rs66F0P/1kedk5lyYyH9uBzuiI/kNRmwJAR9quK6VOtIpZ2G+hMZd+HQbbv25MgCA6gEffoMZYxlTod4WcdrKA==", + "packages/powerbi/node_modules/buffer-xor": { + "version": "1.0.3", "dev": true, - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.2", - "define-data-property": "^1.1.4", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.5", - "es-object-atoms": "^1.0.0", - "has-property-descriptors": "^1.0.2" - }, + "license": "MIT" + }, + "packages/powerbi/node_modules/builtin-status-codes": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/bytes": { + "version": "3.1.2", + "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.8" } }, - "node_modules/string.prototype.trimend": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.9.tgz", - "integrity": "sha512-G7Ok5C6E/j4SGfyLCloXTrngQIQU3PWtXGst3yM7Bea9FRURf1S42ZHlZZtsNque2FN2PoUhfZXYLNWwEr4dLQ==", + "packages/powerbi/node_modules/chalk": { + "version": "5.6.2", "dev": true, - "dependencies": { - "call-bind": "^1.0.8", - "call-bound": "^1.0.2", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" - }, + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": "^12.17.0 || ^14.13 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", - "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "packages/powerbi/node_modules/cipher-base": { + "version": "1.0.7", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.2" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.10" } }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "packages/powerbi/node_modules/compare-versions": { + "version": "6.1.1", "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/compressible": { + "version": "2.0.18", + "dev": true, + "license": "MIT", "dependencies": { - "ansi-regex": "^5.0.1" + "mime-db": ">= 1.43.0 < 2" }, "engines": { - "node": ">=8" + "node": ">= 0.6" } }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "packages/powerbi/node_modules/compression": { + "version": "1.8.1", "dev": true, "license": "MIT", "dependencies": { - "ansi-regex": "^5.0.1" + "bytes": "3.1.2", + "compressible": "~2.0.18", + "debug": "2.6.9", + "negotiator": "~0.6.4", + "on-headers": "~1.1.0", + "safe-buffer": "5.2.1", + "vary": "~1.1.2" }, "engines": { - "node": ">=8" + "node": ">= 0.8.0" } }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "packages/powerbi/node_modules/compression/node_modules/debug": { + "version": "2.6.9", "dev": true, - "engines": { - "node": ">=4" + "license": "MIT", + "dependencies": { + "ms": "2.0.0" } }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "packages/powerbi/node_modules/compression/node_modules/ms": { + "version": "2.0.0", "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/connect-history-api-fallback": { + "version": "2.0.0", + "dev": true, + "license": "MIT", "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=0.8" } }, - "node_modules/structured-source": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-4.0.0.tgz", - "integrity": "sha512-qGzRFNJDjFieQkl/sVOI2dUjHKRyL9dAJi2gCPGJLbJHBIkyOHxjuocpIEfbLioX+qSJpvbYdT49/YCdMznKxA==", + "packages/powerbi/node_modules/console-browserify": { + "version": "1.2.0", + "dev": true + }, + "packages/powerbi/node_modules/constants-browserify": { + "version": "1.0.0", "dev": true, - "dependencies": { - "boundary": "^2.0.0" - } + "license": "MIT" }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "packages/powerbi/node_modules/content-disposition": { + "version": "0.5.4", "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^4.0.0" + "safe-buffer": "5.2.1" }, "engines": { - "node": ">=8" + "node": ">= 0.6" } }, - "node_modules/supports-hyperlinks": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz", - "integrity": "sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==", + "packages/powerbi/node_modules/content-type": { + "version": "1.0.5", "dev": true, - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">= 0.6" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "packages/powerbi/node_modules/cookie": { + "version": "0.7.1", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.6" } }, - "node_modules/svg-tags": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/svg-tags/-/svg-tags-1.0.0.tgz", - "integrity": "sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==" + "packages/powerbi/node_modules/cookie-signature": { + "version": "1.0.6", + "dev": true, + "license": "MIT" }, - "node_modules/table": { - "version": "6.9.0", - "resolved": "https://registry.npmjs.org/table/-/table-6.9.0.tgz", - "integrity": "sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==", + "packages/powerbi/node_modules/copy-anything": { + "version": "2.0.6", "dev": true, + "license": "MIT", "dependencies": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" + "is-what": "^3.14.1" }, - "engines": { - "node": ">=10.0.0" + "funding": { + "url": "https://github.com/sponsors/mesqueeb" } }, - "node_modules/table-layout": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/table-layout/-/table-layout-1.0.2.tgz", - "integrity": "sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==", + "packages/powerbi/node_modules/create-ecdh": { + "version": "4.0.4", + "dev": true, + "license": "MIT", "dependencies": { - "array-back": "^4.0.1", - "deep-extend": "~0.6.0", - "typical": "^5.2.0", - "wordwrapjs": "^4.0.0" - }, - "engines": { - "node": ">=8.0.0" + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" } }, - "node_modules/table-layout/node_modules/array-back": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-4.0.2.tgz", - "integrity": "sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==", - "engines": { - "node": ">=8" + "packages/powerbi/node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/create-hash": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" } }, - "node_modules/table-layout/node_modules/typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", - "engines": { - "node": ">=8" + "packages/powerbi/node_modules/create-hmac": { + "version": "1.1.7", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" } }, - "node_modules/table/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "packages/powerbi/node_modules/crypto-browserify": { + "version": "3.12.1", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "browserify-cipher": "^1.0.1", + "browserify-sign": "^4.2.3", + "create-ecdh": "^4.0.4", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "diffie-hellman": "^5.0.3", + "hash-base": "~3.0.4", + "inherits": "^2.0.4", + "pbkdf2": "^3.1.2", + "public-encrypt": "^4.0.3", + "randombytes": "^2.1.0", + "randomfill": "^1.0.4" + }, + "engines": { + "node": ">= 0.10" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/table/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/table/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true - }, - "node_modules/table/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "packages/powerbi/node_modules/css-loader": { + "version": "7.1.2", "dev": true, + "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "icss-utils": "^5.1.0", + "postcss": "^8.4.33", + "postcss-modules-extract-imports": "^3.1.0", + "postcss-modules-local-by-default": "^4.0.5", + "postcss-modules-scope": "^3.2.0", + "postcss-modules-values": "^4.0.0", + "postcss-value-parser": "^4.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "@rspack/core": "0.x || 1.x", + "webpack": "^5.27.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "packages/powerbi/node_modules/cssesc": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" }, "engines": { - "node": ">=8" + "node": ">=4" } }, - "node_modules/tapable": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", + "packages/powerbi/node_modules/debounce": { + "version": "1.2.1", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/depd": { + "version": "2.0.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">= 0.8" } }, - "node_modules/tar-fs": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", - "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", + "packages/powerbi/node_modules/des.js": { + "version": "1.1.0", "dev": true, "license": "MIT", - "optional": true, "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" } }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "packages/powerbi/node_modules/destroy": { + "version": "1.2.0", "dev": true, - "optional": true, - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "packages/powerbi/node_modules/detect-node": { + "version": "2.1.0", "dev": true, - "optional": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/diffie-hellman": { + "version": "5.0.3", + "dev": true, + "license": "MIT", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "packages/powerbi/node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/dns-packet": { + "version": "5.6.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@leichtgewicht/ip-codec": "^2.0.1" }, "engines": { - "node": ">= 6" + "node": ">=6" } }, - "node_modules/temp-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", - "integrity": "sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ==", + "packages/powerbi/node_modules/domain-browser": { + "version": "5.7.0", "dev": true, + "license": "Artistic-2.0", "engines": { "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/temp-write": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/temp-write/-/temp-write-3.4.0.tgz", - "integrity": "sha512-P8NK5aNqcGQBC37i/8pL/K9tFgx14CF2vdwluD/BA/dGWGD4T4E59TE7dAxPyb2wusts2FhMp36EiopBBsGJ2Q==", + "packages/powerbi/node_modules/duplexer": { + "version": "0.1.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/ee-first": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/elliptic": { + "version": "6.6.1", "dev": true, + "license": "MIT", "dependencies": { - "graceful-fs": "^4.1.2", - "is-stream": "^1.1.0", - "make-dir": "^1.0.0", - "pify": "^3.0.0", - "temp-dir": "^1.0.0", - "uuid": "^3.0.1" - }, + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "packages/powerbi/node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/encodeurl": { + "version": "2.0.0", + "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">= 0.8" } }, - "node_modules/temp-write/node_modules/make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "packages/powerbi/node_modules/errno": { + "version": "0.1.8", "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "pify": "^3.0.0" + "prr": "~1.0.1" }, - "engines": { - "node": ">=4" + "bin": { + "errno": "cli.js" } }, - "node_modules/temp-write/node_modules/pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "packages/powerbi/node_modules/escape-html": { + "version": "1.0.3", "dev": true, - "engines": { - "node": ">=4" - } + "license": "MIT" }, - "node_modules/temp-write/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "packages/powerbi/node_modules/eslint-plugin-powerbi-visuals": { + "version": "1.1.0", "dev": true, - "bin": { - "uuid": "bin/uuid" + "license": "MIT", + "dependencies": { + "@typescript-eslint/parser": "^8.45.0", + "globals": "^16.4.0", + "path": "0.12.7" } }, - "node_modules/term-size": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", - "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", + "packages/powerbi/node_modules/eslint-plugin-powerbi-visuals/node_modules/globals": { + "version": "16.5.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/terminal-link": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz", - "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==", + "packages/powerbi/node_modules/etag": { + "version": "1.8.1", "dev": true, - "dependencies": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" - }, + "license": "MIT", "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">= 0.6" } }, - "node_modules/terser": { - "version": "5.37.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.37.0.tgz", - "integrity": "sha512-B8wRRkmre4ERucLM/uXx4MOV5cbnOlVAqUst+1+iLKPI0dOgFO28f84ptoQt9HEI537PMzfYa/d+GEPKTRXmYA==", + "packages/powerbi/node_modules/event-target-shim": { + "version": "5.0.1", "dev": true, - "dependencies": { - "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - }, - "bin": { - "terser": "bin/terser" - }, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=6" } }, - "node_modules/terser-webpack-plugin": { - "version": "5.3.11", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.11.tgz", - "integrity": "sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==", + "packages/powerbi/node_modules/eventemitter3": { + "version": "4.0.7", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/evp_bytestokey": { + "version": "1.0.3", "dev": true, + "license": "MIT", "dependencies": { - "@jridgewell/trace-mapping": "^0.3.25", - "jest-worker": "^27.4.5", - "schema-utils": "^4.3.0", - "serialize-javascript": "^6.0.2", - "terser": "^5.31.1" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "uglify-js": { - "optional": true - } + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" } }, - "node_modules/terser-webpack-plugin/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "packages/powerbi/node_modules/express": { + "version": "4.21.2", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.7.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.12", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" }, "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "type": "opencollective", + "url": "https://opencollective.com/express" } }, - "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "packages/powerbi/node_modules/express/node_modules/debug": { + "version": "2.6.9", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" + "ms": "2.0.0" } }, - "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "packages/powerbi/node_modules/express/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", + "packages/powerbi/node_modules/express/node_modules/qs": { + "version": "6.13.0", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" + "side-channel": "^1.0.6" }, "engines": { - "node": ">= 10.13.0" + "node": ">=0.6" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/terser/node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "packages/powerbi/node_modules/extra-watch-webpack-plugin": { + "version": "1.0.3", "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" + "license": "MIT", + "dependencies": { + "glob": "^7.1.2", + "is-glob": "^4.0.0", + "lodash.uniq": "^4.5.0", + "schema-utils": "^0.4.0" } }, - "node_modules/terser/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true - }, - "node_modules/textextensions": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-6.11.0.tgz", - "integrity": "sha512-tXJwSr9355kFJI3lbCkPpUH5cP8/M0GGy2xLO34aZCjMXBaK3SoPnZwr/oWmo1FdCnELcs4npdCIOFtq9W3ruQ==", + "packages/powerbi/node_modules/faye-websocket": { + "version": "0.11.4", "dev": true, + "license": "Apache-2.0", "dependencies": { - "editions": "^6.21.0" - }, - "engines": { - "node": ">=4" + "websocket-driver": ">=0.5.1" }, - "funding": { - "url": "https://bevry.me/fund" - } - }, - "node_modules/thingies": { - "version": "1.21.0", - "resolved": "https://registry.npmjs.org/thingies/-/thingies-1.21.0.tgz", - "integrity": "sha512-hsqsJsFMsV+aD4s3CWKk85ep/3I9XzYV/IXaSouJMYIoDlgyi11cBhsqYe9/geRfB0YIikBQg6raRaM+nIMP9g==", - "dev": true, "engines": { - "node": ">=10.18" - }, - "peerDependencies": { - "tslib": "^2" + "node": ">=0.8.0" } }, - "node_modules/thunky": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/thunky/-/thunky-1.1.0.tgz", - "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==", - "dev": true - }, - "node_modules/timers-browserify": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.12.tgz", - "integrity": "sha512-9phl76Cqm6FhSX9Xe1ZUAMLtm1BLkKj2Qd5ApyWkXzsMRaA7dgr81kf4wJmQf/hAvg8EEyJxDo3du/0KlhPiKQ==", + "packages/powerbi/node_modules/finalhandler": { + "version": "1.3.1", "dev": true, + "license": "MIT", "dependencies": { - "setimmediate": "^1.0.4" + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" }, "engines": { - "node": ">=0.6.0" + "node": ">= 0.8" } }, - "node_modules/tmp": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.4.tgz", - "integrity": "sha512-UdiSoX6ypifLmrfQ/XfiawN6hkjSBpCjhKxxZcWlUUmoXLaCKQU0bx4HF/tdDK2uzRuchf1txGvrWBzYREssoQ==", + "packages/powerbi/node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", "dev": true, "license": "MIT", - "engines": { - "node": ">=14.14" + "dependencies": { + "ms": "2.0.0" } }, - "node_modules/to-buffer": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.1.tgz", - "integrity": "sha512-tB82LpAIWjhLYbqjx3X4zEeHN6M8CiuOEy2JY8SEQVdYRe3CCHOFaqrBW1doLDrfpWhplcW7BL+bO3/6S3pcDQ==", + "packages/powerbi/node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", "dev": true, - "dependencies": { - "isarray": "^2.0.5", - "safe-buffer": "^5.2.1", - "typed-array-buffer": "^1.0.3" - }, + "license": "MIT" + }, + "packages/powerbi/node_modules/follow-redirects": { + "version": "1.15.11", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } } }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "packages/powerbi/node_modules/forwarded": { + "version": "0.2.0", "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, + "license": "MIT", "engines": { - "node": ">=8.0" + "node": ">= 0.6" } }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "packages/powerbi/node_modules/fresh": { + "version": "0.5.2", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.6" + "node": ">= 0.6" } }, - "node_modules/topojson-client": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-3.1.0.tgz", - "integrity": "sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==", + "packages/powerbi/node_modules/fs-extra": { + "version": "11.3.2", + "dev": true, + "license": "MIT", "dependencies": { - "commander": "2" + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" }, - "bin": { - "topo2geo": "bin/topo2geo", - "topomerge": "bin/topomerge", - "topoquantize": "bin/topoquantize" - } - }, - "node_modules/topojson-client/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, - "node_modules/totalist": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", - "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", - "dev": true, "engines": { - "node": ">=6" + "node": ">=14.14" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, - "node_modules/traverse": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", - "integrity": "sha512-iawgk0hLP3SxGKDfnDJf8wTz4p2qImnyihM5Hh/sGvQ3K37dPi/w8sRhdNIxYA1TwFwc5mDhIJq+O0RsvXBKdQ==", + "packages/powerbi/node_modules/glob": { + "version": "7.2.3", "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, "engines": { "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/tree-dump": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tree-dump/-/tree-dump-1.0.2.tgz", - "integrity": "sha512-dpev9ABuLWdEubk+cIaI9cHwRNNDjkBBLXTwI4UCUFdQ5xXKqNXoK4FEciw/vxf+NQ7Cb7sGUyeUtORvHIdRXQ==", + "packages/powerbi/node_modules/glob-to-regex.js": { + "version": "1.2.0", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10.0" }, @@ -16029,440 +14968,340 @@ "tslib": "2" } }, - "node_modules/trough": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", - "integrity": "sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==", + "packages/powerbi/node_modules/glob/node_modules/brace-expansion": { + "version": "1.1.12", "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/ts-api-utils": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", - "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "packages/powerbi/node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", "dev": true, - "engines": { - "node": ">=18.12" + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" }, - "peerDependencies": { - "typescript": ">=4.8.4" + "engines": { + "node": "*" } }, - "node_modules/ts-loader": { - "version": "9.5.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", - "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", + "packages/powerbi/node_modules/gzip-size": { + "version": "6.0.0", "dev": true, + "license": "MIT", "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" + "duplexer": "^0.1.2" }, "engines": { - "node": ">=12.0.0" + "node": ">=10" }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ts-loader/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "packages/powerbi/node_modules/handle-thing": { + "version": "2.0.1", "dev": true, - "engines": { - "node": ">= 8" - } - }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" - }, - "node_modules/tsx-create-element": { - "version": "2.2.9", - "resolved": "https://registry.npmjs.org/tsx-create-element/-/tsx-create-element-2.2.9.tgz", - "integrity": "sha512-js7JYdOGlGKvMnzsP02G+d0k3G1vxBJ61X7mgc2IUbntjf060fUCX/J2IQtK/vK4NO9LU4mwyw/eJH81hWW+xQ==", - "dependencies": { - "html-tags": "^2.0.0", - "svg-tags": "^1.0.0" - }, - "peerDependencies": { - "@types/react": "*" - } - }, - "node_modules/tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", - "dev": true + "license": "MIT" }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "packages/powerbi/node_modules/hash-base": { + "version": "3.0.5", "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + "node": ">= 0.10" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "packages/powerbi/node_modules/hash.js": { + "version": "1.1.7", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" } }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "packages/powerbi/node_modules/hmac-drbg": { + "version": "1.0.1", "dev": true, + "license": "MIT", "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, - "node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "packages/powerbi/node_modules/hpack.js": { + "version": "2.1.6", "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" } }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "packages/powerbi/node_modules/hpack.js/node_modules/isarray": { + "version": "1.0.0", "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/hpack.js/node_modules/readable-stream": { + "version": "2.3.8", + "dev": true, + "license": "MIT", "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/typed-array-buffer": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", - "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "packages/powerbi/node_modules/hpack.js/node_modules/safe-buffer": { + "version": "5.1.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/hpack.js/node_modules/string_decoder": { + "version": "1.1.1", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.3", - "es-errors": "^1.3.0", - "is-typed-array": "^1.1.14" - }, - "engines": { - "node": ">= 0.4" + "safe-buffer": "~5.1.0" } }, - "node_modules/typed-array-byte-length": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", - "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "packages/powerbi/node_modules/html-escaper": { + "version": "2.0.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/http-deceiver": { + "version": "1.2.7", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/http-errors": { + "version": "2.0.0", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.8", - "for-each": "^0.3.3", - "gopd": "^1.2.0", - "has-proto": "^1.2.0", - "is-typed-array": "^1.1.14" + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.8" } }, - "node_modules/typed-array-byte-offset": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.4.tgz", - "integrity": "sha512-bTlAFB/FBYMcuX81gbL4OcpH5PmlFHqlCCpAl8AlEzMz5k53oNDvN8p1PNOWLEmI2x4orp3raOFB51tv9X+MFQ==", + "packages/powerbi/node_modules/http-parser-js": { + "version": "0.5.10", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/http-proxy": { + "version": "1.18.1", "dev": true, + "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "for-each": "^0.3.3", - "gopd": "^1.2.0", - "has-proto": "^1.2.0", - "is-typed-array": "^1.1.15", - "reflect.getprototypeof": "^1.0.9" + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=8.0.0" } }, - "node_modules/typed-array-length": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.7.tgz", - "integrity": "sha512-3KS2b+kL7fsuk/eJZ7EQdnEmQoaho/r6KUef7hxvltNA5DR8NAUM+8wJMbJyZ4G9/7i3v5zPBIMN5aybAh2/Jg==", + "packages/powerbi/node_modules/http-proxy-middleware": { + "version": "2.0.9", "dev": true, + "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", - "for-each": "^0.3.3", - "gopd": "^1.0.1", - "is-typed-array": "^1.1.13", - "possible-typed-array-names": "^1.0.0", - "reflect.getprototypeof": "^1.0.6" + "@types/http-proxy": "^1.17.8", + "http-proxy": "^1.18.1", + "is-glob": "^4.0.1", + "is-plain-obj": "^3.0.0", + "micromatch": "^4.0.2" }, "engines": { - "node": ">= 0.4" + "node": ">=12.0.0" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "peerDependencies": { + "@types/express": "^4.17.13" + }, + "peerDependenciesMeta": { + "@types/express": { + "optional": true + } } }, - "node_modules/typed-rest-client": { - "version": "1.8.11", - "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.8.11.tgz", - "integrity": "sha512-5UvfMpd1oelmUPRbbaVnq+rHP7ng2cE4qoQkQeAqxRL6PklkxsM0g32/HL0yfvruK6ojQ5x8EE+HF4YV6DtuCA==", + "packages/powerbi/node_modules/https-browserify": { + "version": "1.0.0", "dev": true, - "dependencies": { - "qs": "^6.9.1", - "tunnel": "0.0.6", - "underscore": "^1.12.1" - } + "license": "MIT" }, - "node_modules/typescript": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", - "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "packages/powerbi/node_modules/hyperdyperid": { + "version": "1.2.0", "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, + "license": "MIT", "engines": { - "node": ">=14.17" + "node": ">=10.18" } }, - "node_modules/typical": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", - "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "packages/powerbi/node_modules/icss-utils": { + "version": "5.1.0", + "dev": true, + "license": "ISC", "engines": { - "node": ">=8" + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/uc.micro": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", - "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", - "dev": true - }, - "node_modules/unbox-primitive": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", - "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "packages/powerbi/node_modules/image-size": { + "version": "0.5.5", "dev": true, - "dependencies": { - "call-bound": "^1.0.3", - "has-bigints": "^1.0.2", - "has-symbols": "^1.1.0", - "which-boxed-primitive": "^1.1.1" + "license": "MIT", + "optional": true, + "bin": { + "image-size": "bin/image-size.js" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">=0.10.0" } }, - "node_modules/underscore": { - "version": "1.13.7", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.7.tgz", - "integrity": "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g==", - "dev": true + "packages/powerbi/node_modules/immediate": { + "version": "3.0.6", + "dev": true, + "license": "MIT" }, - "node_modules/undici": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.11.0.tgz", - "integrity": "sha512-heTSIac3iLhsmZhUCjyS3JQEkZELateufzZuBaVM5RHXdSBMb1LPMQf5x+FH7qjsZYDP0ttAc3nnVpUB+wYbOg==", + "packages/powerbi/node_modules/inline-source-map": { + "version": "0.6.3", "dev": true, - "engines": { - "node": ">=20.18.1" + "license": "MIT", + "dependencies": { + "source-map": "~0.5.3" } }, - "node_modules/undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", - "dev": true - }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", - "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "packages/powerbi/node_modules/ipaddr.js": { + "version": "2.3.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">= 10" } }, - "node_modules/unicode-match-property-ecmascript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", - "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "packages/powerbi/node_modules/is-arguments": { + "version": "1.2.0", "dev": true, + "license": "MIT", "dependencies": { - "unicode-canonical-property-names-ecmascript": "^1.0.4", - "unicode-property-aliases-ecmascript": "^1.0.4" + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" }, "engines": { - "node": ">=4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", - "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", + "packages/powerbi/node_modules/is-nan": { + "version": "1.3.2", "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, "engines": { - "node": ">=4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", - "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", + "packages/powerbi/node_modules/is-network-error": { + "version": "1.3.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/unicorn-magic": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.3.0.tgz", - "integrity": "sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==", + "packages/powerbi/node_modules/is-plain-obj": { + "version": "3.0.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=18" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/unified": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/unified/-/unified-7.1.0.tgz", - "integrity": "sha512-lbk82UOIGuCEsZhPj8rNAkXSDXd6p0QLzIuSsCdxrqnqU56St4eyOB+AlXsVgVeRmetPTYydIuvFfpDIed8mqw==", + "packages/powerbi/node_modules/is-what": { + "version": "3.14.1", "dev": true, - "dependencies": { - "@types/unist": "^2.0.0", - "@types/vfile": "^3.0.0", - "bail": "^1.0.0", - "extend": "^3.0.0", - "is-plain-obj": "^1.1.0", - "trough": "^1.0.0", - "vfile": "^3.0.0", - "x-is-string": "^0.1.0" - } - }, - "node_modules/unist-util-is": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.3.tgz", - "integrity": "sha512-4WbQX2iwfr/+PfM4U3zd2VNXY+dWtZsN1fLnWEi2QQXA4qyDYAZcDMfXUX0Cu6XZUHHAO9q4nyxxLT4Awk1qUA==", - "dev": true - }, - "node_modules/unist-util-stringify-position": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz", - "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==", - "dev": true + "license": "MIT" }, - "node_modules/unist-util-visit": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz", - "integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==", + "packages/powerbi/node_modules/json-loader": { + "version": "0.5.7", "dev": true, - "dependencies": { - "unist-util-visit-parents": "^2.0.0" - } + "license": "MIT" }, - "node_modules/unist-util-visit-parents": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz", - "integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==", + "packages/powerbi/node_modules/json-schema-traverse": { + "version": "0.4.1", "dev": true, - "dependencies": { - "unist-util-is": "^3.0.0" - } - }, - "node_modules/unist-util-visit-parents/node_modules/unist-util-is": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz", - "integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A==", - "dev": true - }, - "node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "engines": { - "node": ">= 4.0.0" - } + "license": "MIT" }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "packages/powerbi/node_modules/jsonfile": { + "version": "6.2.0", "dev": true, - "engines": { - "node": ">= 0.8" + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" } }, - "node_modules/unzipper": { - "version": "0.10.14", - "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.14.tgz", - "integrity": "sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==", + "packages/powerbi/node_modules/jszip": { + "version": "3.10.1", "dev": true, + "license": "(MIT OR GPL-3.0-or-later)", "dependencies": { - "big-integer": "^1.6.17", - "binary": "~0.3.0", - "bluebird": "~3.4.1", - "buffer-indexof-polyfill": "~1.0.0", - "duplexer2": "~0.1.4", - "fstream": "^1.0.12", - "graceful-fs": "^4.2.2", - "listenercount": "~1.0.1", + "lie": "~3.3.0", + "pako": "~1.0.2", "readable-stream": "~2.3.6", - "setimmediate": "~1.0.4" + "setimmediate": "^1.0.5" } }, - "node_modules/unzipper/node_modules/isarray": { + "packages/powerbi/node_modules/jszip/node_modules/isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true + "dev": true, + "license": "MIT" }, - "node_modules/unzipper/node_modules/readable-stream": { + "packages/powerbi/node_modules/jszip/node_modules/readable-stream": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", "dev": true, + "license": "MIT", "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -16473,1676 +15312,1698 @@ "util-deprecate": "~1.0.1" } }, - "node_modules/unzipper/node_modules/safe-buffer": { + "packages/powerbi/node_modules/jszip/node_modules/safe-buffer": { "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "dev": true, + "license": "MIT" }, - "node_modules/unzipper/node_modules/string_decoder": { + "packages/powerbi/node_modules/jszip/node_modules/string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "~5.1.0" } }, - "node_modules/update-browserslist-db": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", - "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", + "packages/powerbi/node_modules/launch-editor": { + "version": "2.12.0", "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], + "license": "MIT", "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" + "picocolors": "^1.1.1", + "shell-quote": "^1.8.3" + } + }, + "packages/powerbi/node_modules/less": { + "version": "4.4.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "copy-anything": "^2.0.1", + "parse-node-version": "^1.0.1", + "tslib": "^2.3.0" }, "bin": { - "update-browserslist-db": "cli.js" + "lessc": "bin/lessc" + }, + "engines": { + "node": ">=14" + }, + "optionalDependencies": { + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "make-dir": "^2.1.0", + "mime": "^1.4.1", + "needle": "^3.1.0", + "source-map": "~0.6.0" + } + }, + "packages/powerbi/node_modules/less-loader": { + "version": "12.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "browserslist": ">= 4.21.0" + "@rspack/core": "0.x || 1.x", + "less": "^3.5.0 || ^4.0.0", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "@rspack/core": { + "optional": true + }, + "webpack": { + "optional": true + } } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "packages/powerbi/node_modules/less/node_modules/source-map": { + "version": "0.6.1", "dev": true, - "dependencies": { - "punycode": "^2.1.0" + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" } }, - "node_modules/url": { - "version": "0.11.4", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.4.tgz", - "integrity": "sha512-oCwdVC7mTuWiPyjLUz/COz5TLk6wgp0RCsN+wHZ2Ekneac9w8uuV0njcbbie2ME+Vs+d6duwmYuR3HgQXs1fOg==", + "packages/powerbi/node_modules/lie": { + "version": "3.3.0", "dev": true, + "license": "MIT", "dependencies": { - "punycode": "^1.4.1", - "qs": "^6.12.3" - }, - "engines": { - "node": ">= 0.4" + "immediate": "~3.0.5" } }, - "node_modules/url-join": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", - "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", - "dev": true + "packages/powerbi/node_modules/lodash.clonedeep": { + "version": "4.5.0", + "dev": true, + "license": "MIT" }, - "node_modules/url/node_modules/punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", - "dev": true + "packages/powerbi/node_modules/lodash.defaults": { + "version": "4.2.0", + "dev": true, + "license": "MIT" }, - "node_modules/util": { - "version": "0.12.5", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", - "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", + "packages/powerbi/node_modules/lodash.isequal": { + "version": "4.5.0", "dev": true, - "dependencies": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "which-typed-array": "^1.1.2" - } + "license": "MIT" }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true + "packages/powerbi/node_modules/lodash.ismatch": { + "version": "4.4.0", + "dev": true, + "license": "MIT" }, - "node_modules/utility-types": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.11.0.tgz", - "integrity": "sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw==", + "packages/powerbi/node_modules/lodash.uniq": { + "version": "4.5.0", "dev": true, - "engines": { - "node": ">= 4" - } + "license": "MIT" }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "packages/powerbi/node_modules/make-dir": { + "version": "2.1.0", "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, "engines": { - "node": ">= 0.4.0" + "node": ">=6" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "packages/powerbi/node_modules/make-dir/node_modules/semver": { + "version": "5.7.2", "dev": true, + "license": "ISC", + "optional": true, "bin": { - "uuid": "dist/bin/uuid" + "semver": "bin/semver" } }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", - "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "packages/powerbi/node_modules/md5.js": { + "version": "1.3.5", "dev": true, + "license": "MIT", "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" } }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "packages/powerbi/node_modules/media-typer": { + "version": "0.3.0", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.8" - } - }, - "node_modules/vega": { - "version": "5.32.0", - "resolved": "https://registry.npmjs.org/vega/-/vega-5.32.0.tgz", - "integrity": "sha512-jANt/5+SpV7b7owB5u8+M1TZ/TrF1fK6WlcvKDW38tH3Gb6hM1nzIhv10E41w3GBmwF29BU/qH2ruNkaYKjI5g==", - "dependencies": { - "vega-crossfilter": "~4.1.3", - "vega-dataflow": "~5.7.7", - "vega-encode": "~4.10.2", - "vega-event-selector": "~3.0.1", - "vega-expression": "~5.2.0", - "vega-force": "~4.2.2", - "vega-format": "~1.1.3", - "vega-functions": "~5.17.0", - "vega-geo": "~4.4.3", - "vega-hierarchy": "~4.1.3", - "vega-label": "~1.3.1", - "vega-loader": "~4.5.3", - "vega-parser": "~6.5.0", - "vega-projection": "~1.6.2", - "vega-regression": "~1.3.1", - "vega-runtime": "~6.2.1", - "vega-scale": "~7.4.2", - "vega-scenegraph": "~4.13.1", - "vega-statistics": "~1.9.0", - "vega-time": "~2.1.3", - "vega-transforms": "~4.12.1", - "vega-typings": "~1.5.0", - "vega-util": "~1.17.2", - "vega-view": "~5.15.0", - "vega-view-transforms": "~4.6.1", - "vega-voronoi": "~4.2.4", - "vega-wordcloud": "~4.1.6" + "node": ">= 0.6" } }, - "node_modules/vega-canvas": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/vega-canvas/-/vega-canvas-1.2.7.tgz", - "integrity": "sha512-OkJ9CACVcN9R5Pi9uF6MZBF06pO6qFpDYHWSKBJsdHP5o724KrsgR6UvbnXFH82FdsiTOff/HqjuaG8C7FL+9Q==" - }, - "node_modules/vega-crossfilter": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/vega-crossfilter/-/vega-crossfilter-4.1.3.tgz", - "integrity": "sha512-nyPJAXAUABc3EocUXvAL1J/IWotZVsApIcvOeZaUdEQEtZ7bt8VtP2nj3CLbHBA8FZZVV+K6SmdwvCOaAD4wFQ==", + "packages/powerbi/node_modules/memfs": { + "version": "4.51.0", + "dev": true, + "license": "Apache-2.0", "dependencies": { - "d3-array": "^3.2.2", - "vega-dataflow": "^5.7.7", - "vega-util": "^1.17.3" + "@jsonjoy.com/json-pack": "^1.11.0", + "@jsonjoy.com/util": "^1.9.0", + "glob-to-regex.js": "^1.0.1", + "thingies": "^2.5.0", + "tree-dump": "^1.0.3", + "tslib": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/streamich" } }, - "node_modules/vega-dataflow": { - "version": "5.7.7", - "resolved": "https://registry.npmjs.org/vega-dataflow/-/vega-dataflow-5.7.7.tgz", - "integrity": "sha512-R2NX2HvgXL+u4E6u+L5lKvvRiCtnE6N6l+umgojfi53suhhkFP+zB+2UAQo4syxuZ4763H1csfkKc4xpqLzKnw==", - "dependencies": { - "vega-format": "^1.1.3", - "vega-loader": "^4.5.3", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/merge-descriptors": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/vega-datasets": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/vega-datasets/-/vega-datasets-2.8.1.tgz", - "integrity": "sha512-RxFyrlIH3xWzHtBDxp2vsFNCxuzNNfAtEvyufFX25UczIORyNi1T336NbM62g67k4KbDkeXzWEZHwr71qQKF8w==", - "dev": true + "packages/powerbi/node_modules/methods": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } }, - "node_modules/vega-encode": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/vega-encode/-/vega-encode-4.10.2.tgz", - "integrity": "sha512-fsjEY1VaBAmqwt7Jlpz0dpPtfQFiBdP9igEefvumSpy7XUxOJmDQcRDnT3Qh9ctkv3itfPfI9g8FSnGcv2b4jQ==", + "packages/powerbi/node_modules/miller-rabin": { + "version": "4.0.1", + "dev": true, + "license": "MIT", "dependencies": { - "d3-array": "^3.2.2", - "d3-interpolate": "^3.0.1", - "vega-dataflow": "^5.7.7", - "vega-scale": "^7.4.2", - "vega-util": "^1.17.3" + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" } }, - "node_modules/vega-event-selector": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/vega-event-selector/-/vega-event-selector-3.0.1.tgz", - "integrity": "sha512-K5zd7s5tjr1LiOOkjGpcVls8GsH/f2CWCrWcpKy74gTCp+llCdwz0Enqo013ZlGaRNjfgD/o1caJRt3GSaec4A==" + "packages/powerbi/node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.2", + "dev": true, + "license": "MIT" }, - "node_modules/vega-expression": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/vega-expression/-/vega-expression-5.2.1.tgz", - "integrity": "sha512-9KKbI2q9qTI55NSjD/dVWg3aeCtw+gwyWCiLMM47ha6iXrAN9pQ+EKRJfxOHuoDfCTlJJTaUfnnXgbqm0HEszg==", - "license": "BSD-3-Clause", + "packages/powerbi/node_modules/mini-css-extract-plugin": { + "version": "2.9.4", + "dev": true, + "license": "MIT", "dependencies": { - "@types/estree": "^1.0.0", - "vega-util": "^1.17.4" + "schema-utils": "^4.0.0", + "tapable": "^2.2.1" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" } }, - "node_modules/vega-force": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/vega-force/-/vega-force-4.2.2.tgz", - "integrity": "sha512-cHZVaY2VNNIG2RyihhSiWniPd2W9R9kJq0znxzV602CgUVgxEfTKtx/lxnVCn8nNrdKAYrGiqIsBzIeKG1GWHw==", + "packages/powerbi/node_modules/mini-css-extract-plugin/node_modules/ajv": { + "version": "8.17.1", + "dev": true, + "license": "MIT", "dependencies": { - "d3-force": "^3.0.0", - "vega-dataflow": "^5.7.7", - "vega-util": "^1.17.3" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/vega-format": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/vega-format/-/vega-format-1.1.3.tgz", - "integrity": "sha512-wQhw7KR46wKJAip28FF/CicW+oiJaPAwMKdrxlnTA0Nv8Bf7bloRlc+O3kON4b4H1iALLr9KgRcYTOeXNs2MOA==", + "packages/powerbi/node_modules/mini-css-extract-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "dev": true, + "license": "MIT", "dependencies": { - "d3-array": "^3.2.2", - "d3-format": "^3.1.0", - "d3-time-format": "^4.1.0", - "vega-time": "^2.1.3", - "vega-util": "^1.17.3" + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" } }, - "node_modules/vega-functions": { - "version": "5.17.0", - "resolved": "https://registry.npmjs.org/vega-functions/-/vega-functions-5.17.0.tgz", - "integrity": "sha512-EoGvdCtv1Y4M/hLy83Kf0HTs4qInUfrBoanrnhbguzRl00rx7orjcv+bNZFHbCe4HkfVpbOnTrYmz3K2ivaOLw==", - "dependencies": { - "d3-array": "^3.2.2", - "d3-color": "^3.1.0", - "d3-geo": "^3.1.0", - "vega-dataflow": "^5.7.7", - "vega-expression": "^5.2.0", - "vega-scale": "^7.4.2", - "vega-scenegraph": "^4.13.1", - "vega-selections": "^5.6.0", - "vega-statistics": "^1.9.0", - "vega-time": "^2.1.3", - "vega-util": "^1.17.3" - } + "packages/powerbi/node_modules/mini-css-extract-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "dev": true, + "license": "MIT" }, - "node_modules/vega-geo": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/vega-geo/-/vega-geo-4.4.3.tgz", - "integrity": "sha512-+WnnzEPKIU1/xTFUK3EMu2htN35gp9usNZcC0ZFg2up1/Vqu6JyZsX0PIO51oXSIeXn9bwk6VgzlOmJUcx92tA==", + "packages/powerbi/node_modules/mini-css-extract-plugin/node_modules/schema-utils": { + "version": "4.3.3", + "dev": true, + "license": "MIT", "dependencies": { - "d3-array": "^3.2.2", - "d3-color": "^3.1.0", - "d3-geo": "^3.1.0", - "vega-canvas": "^1.2.7", - "vega-dataflow": "^5.7.7", - "vega-projection": "^1.6.2", - "vega-statistics": "^1.9.0", - "vega-util": "^1.17.3" + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "node_modules/vega-hierarchy": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/vega-hierarchy/-/vega-hierarchy-4.1.3.tgz", - "integrity": "sha512-0Z+TYKRgOEo8XYXnJc2HWg1EGpcbNAhJ9Wpi9ubIbEyEHqIgjCIyFVN8d4nSfsJOcWDzsSmRqohBztxAhOCSaw==", - "dependencies": { - "d3-hierarchy": "^3.1.2", - "vega-dataflow": "^5.7.7", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/minimalistic-assert": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "packages/powerbi/node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/mrmime": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" } }, - "node_modules/vega-label": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/vega-label/-/vega-label-1.3.1.tgz", - "integrity": "sha512-Emx4b5s7pvuRj3fBkAJ/E2snCoZACfKAwxVId7f/4kYVlAYLb5Swq6W8KZHrH4M9Qds1XJRUYW9/Y3cceqzEFA==", + "packages/powerbi/node_modules/multicast-dns": { + "version": "7.2.5", + "dev": true, + "license": "MIT", "dependencies": { - "vega-canvas": "^1.2.7", - "vega-dataflow": "^5.7.7", - "vega-scenegraph": "^4.13.1", - "vega-util": "^1.17.3" + "dns-packet": "^5.2.2", + "thunky": "^1.0.2" + }, + "bin": { + "multicast-dns": "cli.js" } }, - "node_modules/vega-loader": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/vega-loader/-/vega-loader-4.5.3.tgz", - "integrity": "sha512-dUfIpxTLF2magoMaur+jXGvwMxjtdlDZaIS8lFj6N7IhUST6nIvBzuUlRM+zLYepI5GHtCLOnqdKU4XV0NggCA==", + "packages/powerbi/node_modules/needle": { + "version": "3.3.1", + "dev": true, + "license": "MIT", + "optional": true, "dependencies": { - "d3-dsv": "^3.0.1", - "node-fetch": "^2.6.7", - "topojson-client": "^3.1.0", - "vega-format": "^1.1.3", - "vega-util": "^1.17.3" + "iconv-lite": "^0.6.3", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" } }, - "node_modules/vega-morphcharts-test-es6": { - "resolved": "packages/vega-morphcharts-test-es6", - "link": true + "packages/powerbi/node_modules/negotiator": { + "version": "0.6.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } }, - "node_modules/vega-parser": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/vega-parser/-/vega-parser-6.5.0.tgz", - "integrity": "sha512-dPxFKn6IlDyWi6CgHGGv8htSPBAyLHWlJNNGD17eMXh+Kjn4hupSNOIboRcYb8gL5HYt1tYwS6oYZXK84Bc4tg==", - "dependencies": { - "vega-dataflow": "^5.7.7", - "vega-event-selector": "^3.0.1", - "vega-functions": "^5.17.0", - "vega-scale": "^7.4.2", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/node-forge": { + "version": "1.3.2", + "dev": true, + "license": "(BSD-3-Clause OR GPL-2.0)", + "engines": { + "node": ">= 6.13.0" } }, - "node_modules/vega-projection": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/vega-projection/-/vega-projection-1.6.2.tgz", - "integrity": "sha512-3pcVaQL9R3Zfk6PzopLX6awzrQUeYOXJzlfLGP2Xd93mqUepBa6m/reVrTUoSFXA3v9lfK4W/PS2AcVzD/MIcQ==", + "packages/powerbi/node_modules/object-is": { + "version": "1.1.6", + "dev": true, + "license": "MIT", "dependencies": { - "d3-geo": "^3.1.0", - "d3-geo-projection": "^4.0.0", - "vega-scale": "^7.4.2" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/vega-regression": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/vega-regression/-/vega-regression-1.3.1.tgz", - "integrity": "sha512-AmccF++Z9uw4HNZC/gmkQGe6JsRxTG/R4QpbcSepyMvQN1Rj5KtVqMcmVFP1r3ivM4dYGFuPlzMWvuqp0iKMkQ==", + "packages/powerbi/node_modules/obuf": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/on-finished": { + "version": "2.4.1", + "dev": true, + "license": "MIT", "dependencies": { - "d3-array": "^3.2.2", - "vega-dataflow": "^5.7.7", - "vega-statistics": "^1.9.0", - "vega-util": "^1.17.3" + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" } }, - "node_modules/vega-runtime": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/vega-runtime/-/vega-runtime-6.2.1.tgz", - "integrity": "sha512-b4eot3tWKCk++INWqot+6sLn3wDTj/HE+tRSbiaf8aecuniPMlwJEK7wWuhVGeW2Ae5n8fI/8TeTViaC94bNHA==", - "dependencies": { - "vega-dataflow": "^5.7.7", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/on-headers": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" } }, - "node_modules/vega-scale": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/vega-scale/-/vega-scale-7.4.2.tgz", - "integrity": "sha512-o6Hl76aU1jlCK7Q8DPYZ8OGsp4PtzLdzI6nGpLt8rxoE78QuB3GBGEwGAQJitp4IF7Lb2rL5oAXEl3ZP6xf9jg==", - "dependencies": { - "d3-array": "^3.2.2", - "d3-interpolate": "^3.0.1", - "d3-scale": "^4.0.2", - "d3-scale-chromatic": "^3.1.0", - "vega-time": "^2.1.3", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/opener": { + "version": "1.5.2", + "dev": true, + "license": "(WTFPL OR MIT)", + "bin": { + "opener": "bin/opener-bin.js" } }, - "node_modules/vega-scenegraph": { - "version": "4.13.1", - "resolved": "https://registry.npmjs.org/vega-scenegraph/-/vega-scenegraph-4.13.1.tgz", - "integrity": "sha512-LFY9+sLIxRfdDI9ZTKjLoijMkIAzPLBWHpPkwv4NPYgdyx+0qFmv+puBpAUGUY9VZqAZ736Uj5NJY9zw+/M3yQ==", - "dependencies": { - "d3-path": "^3.1.0", - "d3-shape": "^3.2.0", - "vega-canvas": "^1.2.7", - "vega-loader": "^4.5.3", - "vega-scale": "^7.4.2", - "vega-util": "^1.17.3" - } + "packages/powerbi/node_modules/os-browserify": { + "version": "0.3.0", + "dev": true, + "license": "MIT" }, - "node_modules/vega-selections": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/vega-selections/-/vega-selections-5.6.0.tgz", - "integrity": "sha512-UE2w78rUUbaV3Ph+vQbQDwh8eywIJYRxBiZdxEG/Tr/KtFMLdy2BDgNZuuDO1Nv8jImPJwONmqjNhNDYwM0VJQ==", + "packages/powerbi/node_modules/p-retry": { + "version": "6.2.1", + "dev": true, + "license": "MIT", "dependencies": { - "d3-array": "3.2.4", - "vega-expression": "^5.2.0", - "vega-util": "^1.17.3" + "@types/retry": "0.12.2", + "is-network-error": "^1.0.0", + "retry": "^0.13.1" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/vega-statistics": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/vega-statistics/-/vega-statistics-1.9.0.tgz", - "integrity": "sha512-GAqS7mkatpXcMCQKWtFu1eMUKLUymjInU0O8kXshWaQrVWjPIO2lllZ1VNhdgE0qGj4oOIRRS11kzuijLshGXQ==", + "packages/powerbi/node_modules/pako": { + "version": "1.0.11", + "dev": true, + "license": "(MIT AND Zlib)" + }, + "packages/powerbi/node_modules/parse-asn1": { + "version": "5.1.9", + "dev": true, + "license": "ISC", "dependencies": { - "d3-array": "^3.2.2" + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "pbkdf2": "^3.1.5", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" } }, - "node_modules/vega-time": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/vega-time/-/vega-time-2.1.3.tgz", - "integrity": "sha512-hFcWPdTV844IiY0m97+WUoMLADCp+8yUQR1NStWhzBzwDDA7QEGGwYGxALhdMOaDTwkyoNj3V/nox2rQAJD/vQ==", - "dependencies": { - "d3-array": "^3.2.2", - "d3-time": "^3.1.0", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/parse-node-version": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" } }, - "node_modules/vega-transforms": { - "version": "4.12.1", - "resolved": "https://registry.npmjs.org/vega-transforms/-/vega-transforms-4.12.1.tgz", - "integrity": "sha512-Qxo+xeEEftY1jYyKgzOGc9NuW4/MqGm1YPZ5WrL9eXg2G0410Ne+xL/MFIjHF4hRX+3mgFF4Io2hPpfy/thjLg==", - "dependencies": { - "d3-array": "^3.2.2", - "vega-dataflow": "^5.7.7", - "vega-statistics": "^1.9.0", - "vega-time": "^2.1.3", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/parseurl": { + "version": "1.3.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" } }, - "node_modules/vega-typings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/vega-typings/-/vega-typings-1.5.0.tgz", - "integrity": "sha512-tcZ2HwmiQEOXIGyBMP8sdCnoFoVqHn4KQ4H0MQiHwzFU1hb1EXURhfc+Uamthewk4h/9BICtAM3AFQMjBGpjQA==", + "packages/powerbi/node_modules/path": { + "version": "0.12.7", + "dev": true, + "license": "MIT", "dependencies": { - "@types/geojson": "7946.0.4", - "vega-event-selector": "^3.0.1", - "vega-expression": "^5.2.0", - "vega-util": "^1.17.3" + "process": "^0.11.1", + "util": "^0.10.3" } }, - "node_modules/vega-util": { - "version": "1.17.4", - "resolved": "https://registry.npmjs.org/vega-util/-/vega-util-1.17.4.tgz", - "integrity": "sha512-+y3ZW7dEqM8Ck+KRsd+jkMfxfE7MrQxUyIpNjkfhIpGEreym+aTn7XUw1DKXqclr8mqTQvbilPo16B3lnBr0wA==", - "license": "BSD-3-Clause" + "packages/powerbi/node_modules/path-browserify": { + "version": "1.0.1", + "dev": true, + "license": "MIT" }, - "node_modules/vega-view": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/vega-view/-/vega-view-5.15.0.tgz", - "integrity": "sha512-bm8STHPsI8BjVu2gYlWU8KEVOA2JyTzdtb9cJj8NW6HpN72UxTYsg5y22u9vfcLYjzjmolrlr0756VXR0uI1Cg==", - "dependencies": { - "d3-array": "^3.2.2", - "d3-timer": "^3.0.1", - "vega-dataflow": "^5.7.7", - "vega-format": "^1.1.3", - "vega-functions": "^5.17.0", - "vega-runtime": "^6.2.1", - "vega-scenegraph": "^4.13.1", - "vega-util": "^1.17.3" - } + "packages/powerbi/node_modules/path-to-regexp": { + "version": "0.1.12", + "dev": true, + "license": "MIT" }, - "node_modules/vega-view-transforms": { - "version": "4.6.1", - "resolved": "https://registry.npmjs.org/vega-view-transforms/-/vega-view-transforms-4.6.1.tgz", - "integrity": "sha512-RYlyMJu5kZV4XXjmyTQKADJWDB25SMHsiF+B1rbE1p+pmdQPlp5tGdPl9r5dUJOp3p8mSt/NGI8GPGucmPMxtw==", + "packages/powerbi/node_modules/path/node_modules/inherits": { + "version": "2.0.3", + "dev": true, + "license": "ISC" + }, + "packages/powerbi/node_modules/path/node_modules/util": { + "version": "0.10.4", + "dev": true, + "license": "MIT", "dependencies": { - "vega-dataflow": "^5.7.7", - "vega-scenegraph": "^4.13.1", - "vega-util": "^1.17.3" + "inherits": "2.0.3" } }, - "node_modules/vega-voronoi": { - "version": "4.2.4", - "resolved": "https://registry.npmjs.org/vega-voronoi/-/vega-voronoi-4.2.4.tgz", - "integrity": "sha512-lWNimgJAXGeRFu2Pz8axOUqVf1moYhD+5yhBzDSmckE9I5jLOyZc/XvgFTXwFnsVkMd1QW1vxJa+y9yfUblzYw==", + "packages/powerbi/node_modules/pbkdf2": { + "version": "3.1.5", + "dev": true, + "license": "MIT", "dependencies": { - "d3-delaunay": "^6.0.2", - "vega-dataflow": "^5.7.7", - "vega-util": "^1.17.3" + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "ripemd160": "^2.0.3", + "safe-buffer": "^5.2.1", + "sha.js": "^2.4.12", + "to-buffer": "^1.2.1" + }, + "engines": { + "node": ">= 0.10" } }, - "node_modules/vega-wordcloud": { - "version": "4.1.6", - "resolved": "https://registry.npmjs.org/vega-wordcloud/-/vega-wordcloud-4.1.6.tgz", - "integrity": "sha512-lFmF3u9/ozU0P+WqPjeThQfZm0PigdbXDwpIUCxczrCXKYJLYFmZuZLZR7cxtmpZ0/yuvRvAJ4g123LXbSZF8A==", - "dependencies": { - "vega-canvas": "^1.2.7", - "vega-dataflow": "^5.7.7", - "vega-scale": "^7.4.2", - "vega-statistics": "^1.9.0", - "vega-util": "^1.17.3" + "packages/powerbi/node_modules/pify": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" } }, - "node_modules/version-range": { - "version": "4.14.0", - "resolved": "https://registry.npmjs.org/version-range/-/version-range-4.14.0.tgz", - "integrity": "sha512-gjb0ARm9qlcBAonU4zPwkl9ecKkas+tC2CGwFfptTCWWIVTWY1YUbT2zZKsOAF1jR/tNxxyLwwG0cb42XlYcTg==", + "packages/powerbi/node_modules/postcss-modules-extract-imports": { + "version": "3.1.0", "dev": true, + "license": "ISC", "engines": { - "node": ">=4" + "node": "^10 || ^12 || >= 14" }, - "funding": { - "url": "https://bevry.me/fund" + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/vfile": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz", - "integrity": "sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ==", + "packages/powerbi/node_modules/postcss-modules-local-by-default": { + "version": "4.2.0", "dev": true, + "license": "MIT", "dependencies": { - "is-buffer": "^2.0.0", - "replace-ext": "1.0.0", - "unist-util-stringify-position": "^1.0.0", - "vfile-message": "^1.0.0" + "icss-utils": "^5.0.0", + "postcss-selector-parser": "^7.0.0", + "postcss-value-parser": "^4.1.0" + }, + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/vfile-message": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.2.tgz", - "integrity": "sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==", + "packages/powerbi/node_modules/postcss-modules-scope": { + "version": "3.2.1", "dev": true, + "license": "ISC", "dependencies": { - "@types/unist": "^3.0.0", - "unist-util-stringify-position": "^4.0.0" + "postcss-selector-parser": "^7.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/vfile-message/node_modules/@types/unist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", - "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", - "dev": true - }, - "node_modules/vfile-message/node_modules/unist-util-stringify-position": { + "packages/powerbi/node_modules/postcss-modules-values": { "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", - "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", "dev": true, + "license": "ISC", "dependencies": { - "@types/unist": "^3.0.0" + "icss-utils": "^5.0.0" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" + "engines": { + "node": "^10 || ^12 || >= 14" + }, + "peerDependencies": { + "postcss": "^8.1.0" } }, - "node_modules/vfile/node_modules/vfile-message": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.1.1.tgz", - "integrity": "sha512-1WmsopSGhWt5laNir+633LszXvZ+Z/lxveBf6yhGsqnQIhlhzooZae7zV6YVM1Sdkw68dtAW3ow0pOdPANugvA==", + "packages/powerbi/node_modules/postcss-selector-parser": { + "version": "7.1.1", "dev": true, + "license": "MIT", "dependencies": { - "unist-util-stringify-position": "^1.1.1" + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" } }, - "node_modules/vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", - "dev": true + "packages/powerbi/node_modules/powerbi-models": { + "version": "2.0.1", + "license": "MIT" }, - "node_modules/vscode-sanddance": { - "resolved": "extensions/vscode-sanddance", - "link": true + "packages/powerbi/node_modules/powerbi-visuals-api": { + "version": "5.11.0", + "license": "MIT", + "dependencies": { + "semver": "^7.6.0" + } }, - "node_modules/vscode-test": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.6.1.tgz", - "integrity": "sha512-086q88T2ca1k95mUzffvbzb7esqQNvJgiwY4h29ukPhFo8u+vXOOmelUoU5EQUHs3Of8+JuQ3oGdbVCqaxuTXA==", - "deprecated": "This package has been renamed to @vscode/test-electron, please update to the new name", + "packages/powerbi/node_modules/powerbi-visuals-tools": { + "version": "5.6.0", "dev": true, + "license": "MIT", "dependencies": { - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "rimraf": "^3.0.2", - "unzipper": "^0.10.11" + "@typescript-eslint/parser": "^8.8.0", + "assert": "^2.1.0", + "async": "^3.2.6", + "browserify-zlib": "^0.2.0", + "buffer": "^6.0.3", + "chalk": "^5.3.0", + "commander": "^12.1.0", + "compare-versions": "^6.1.1", + "console-browserify": "^1.2.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.12.0", + "css-loader": "^7.1.2", + "domain-browser": "^5.7.0", + "eslint-plugin-powerbi-visuals": "^1.0.0", + "events": "^3.3.0", + "extra-watch-webpack-plugin": "^1.0.3", + "fs-extra": "^11.2.0", + "https-browserify": "^1.0.0", + "inline-source-map": "^0.6.3", + "json-loader": "0.5.7", + "jszip": "^3.10.1", + "less": "^4.2.0", + "less-loader": "^12.2.0", + "lodash.clonedeep": "4.5.0", + "lodash.defaults": "4.2.0", + "lodash.isequal": "4.5.0", + "lodash.ismatch": "^4.4.0", + "mini-css-extract-plugin": "^2.9.1", + "os-browserify": "^0.3.0", + "path-browserify": "^1.0.1", + "powerbi-visuals-webpack-plugin": "4.1.0", + "process": "^0.11.10", + "punycode": "^2.3.1", + "querystring-es3": "^0.2.1", + "readable-stream": "^4.5.2", + "stream-browserify": "^3.0.0", + "stream-http": "^3.2.0", + "string_decoder": "^1.3.0", + "terser-webpack-plugin": "^5.3.10", + "timers-browserify": "^2.0.12", + "ts-loader": "^9.5.1", + "tty-browserify": "^0.0.1", + "typescript": "^5.5.0", + "url": "^0.11.4", + "util": "^0.12.5", + "vm-browserify": "^1.1.2", + "webpack": "^5.95.0", + "webpack-bundle-analyzer": "4.10.2", + "webpack-dev-server": "^5.1.0" + }, + "bin": { + "pbiviz": "bin/pbiviz.js" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "*" + } + }, + "packages/powerbi/node_modules/powerbi-visuals-utils-dataviewutils": { + "version": "6.1.0", + "license": "MIT", + "optionalDependencies": { + "fsevents": "*" + } + }, + "packages/powerbi/node_modules/powerbi-visuals-webpack-plugin": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "6.12.3", + "chalk": "^4.1.2", + "compare-versions": "^3.6.0", + "fs-extra": "9.0.1", + "jszip": "^3.10.1", + "lodash.clonedeep": "4.5.0", + "webpack-sources": "^3.2.3" }, "engines": { - "node": ">=8.9.3" + "node": ">=12.0.0" } }, - "node_modules/vscode-test/node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "packages/powerbi/node_modules/powerbi-visuals-webpack-plugin/node_modules/ajv": { + "version": "6.12.3", "dev": true, + "license": "MIT", "dependencies": { - "debug": "4" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, - "engines": { - "node": ">= 6.0.0" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/vscode-test/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "packages/powerbi/node_modules/powerbi-visuals-webpack-plugin/node_modules/chalk": { + "version": "4.1.2", "dev": true, + "license": "MIT", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" }, "engines": { - "node": "*" + "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/isaacs" + "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/vscode-test/node_modules/http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", + "packages/powerbi/node_modules/powerbi-visuals-webpack-plugin/node_modules/compare-versions": { + "version": "3.6.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/powerbi-visuals-webpack-plugin/node_modules/fs-extra": { + "version": "9.0.1", "dev": true, + "license": "MIT", "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^1.0.0" }, "engines": { - "node": ">= 6" + "node": ">=10" } }, - "node_modules/vscode-test/node_modules/https-proxy-agent": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", - "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "packages/powerbi/node_modules/powerbi-visuals-webpack-plugin/node_modules/supports-color": { + "version": "7.2.0", "dev": true, + "license": "MIT", "dependencies": { - "agent-base": "6", - "debug": "4" + "has-flag": "^4.0.0" }, "engines": { - "node": ">= 6" + "node": ">=8" } }, - "node_modules/vscode-test/node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", + "packages/powerbi/node_modules/powerbi-visuals-webpack-plugin/node_modules/universalify": { + "version": "1.0.0", "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "license": "MIT", + "engines": { + "node": ">= 10.0.0" } }, - "node_modules/watchpack": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz", - "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==", + "packages/powerbi/node_modules/proxy-addr": { + "version": "2.0.7", "dev": true, + "license": "MIT", "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" }, "engines": { - "node": ">=10.13.0" + "node": ">= 0.10" } }, - "node_modules/wbuf": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/wbuf/-/wbuf-1.7.3.tgz", - "integrity": "sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==", + "packages/powerbi/node_modules/proxy-addr/node_modules/ipaddr.js": { + "version": "1.9.1", "dev": true, - "dependencies": { - "minimalistic-assert": "^1.0.0" + "license": "MIT", + "engines": { + "node": ">= 0.10" } }, - "node_modules/weak-lru-cache": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/weak-lru-cache/-/weak-lru-cache-1.2.2.tgz", - "integrity": "sha512-DEAoo25RfSYMuTGc9vPJzZcZullwIqRDSI9LOy+fkCJPi6hykCnfKaXTuPBDuXAUcqHXyOgFtHNp/kB2FjYHbw==", - "dev": true - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "packages/powerbi/node_modules/prr": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "optional": true }, - "node_modules/webpack": { - "version": "5.97.1", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.97.1.tgz", - "integrity": "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==", + "packages/powerbi/node_modules/public-encrypt": { + "version": "4.0.3", "dev": true, + "license": "MIT", "dependencies": { - "@types/eslint-scope": "^3.7.7", - "@types/estree": "^1.0.6", - "@webassemblyjs/ast": "^1.14.1", - "@webassemblyjs/wasm-edit": "^1.14.1", - "@webassemblyjs/wasm-parser": "^1.14.1", - "acorn": "^8.14.0", - "browserslist": "^4.24.0", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.1", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.11", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.10", - "watchpack": "^2.4.1", - "webpack-sources": "^3.2.3" - }, - "bin": { - "webpack": "bin/webpack.js" - }, + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "packages/powerbi/node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/querystring-es3": { + "version": "0.2.1", + "dev": true, "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } + "node": ">=0.4.x" } }, - "node_modules/webpack-bundle-analyzer": { - "version": "4.10.2", - "resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-4.10.2.tgz", - "integrity": "sha512-vJptkMm9pk5si4Bv922ZbKLV8UTT4zib4FPgXMhgzUny0bfDDkLXAVQs3ly3fS4/TN9ROFtb0NFrm04UXFE/Vw==", + "packages/powerbi/node_modules/randomfill": { + "version": "1.0.4", "dev": true, + "license": "MIT", "dependencies": { - "@discoveryjs/json-ext": "0.5.7", - "acorn": "^8.0.4", - "acorn-walk": "^8.0.0", - "commander": "^7.2.0", - "debounce": "^1.2.1", - "escape-string-regexp": "^4.0.0", - "gzip-size": "^6.0.0", - "html-escaper": "^2.0.2", - "opener": "^1.5.2", - "picocolors": "^1.0.0", - "sirv": "^2.0.3", - "ws": "^7.3.1" - }, - "bin": { - "webpack-bundle-analyzer": "lib/bin/analyzer.js" - }, - "engines": { - "node": ">= 10.13.0" + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" } }, - "node_modules/webpack-bundle-analyzer/node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "packages/powerbi/node_modules/range-parser": { + "version": "1.2.1", "dev": true, - "bin": { - "acorn": "bin/acorn" - }, + "license": "MIT", "engines": { - "node": ">=0.4.0" + "node": ">= 0.6" } }, - "node_modules/webpack-bundle-analyzer/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "packages/powerbi/node_modules/raw-body": { + "version": "2.5.2", "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, "engines": { - "node": ">= 10" + "node": ">= 0.8" } }, - "node_modules/webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "packages/powerbi/node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.4.24", "dev": true, + "license": "MIT", "dependencies": { - "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", - "colorette": "^2.0.14", - "commander": "^7.0.0", - "cross-spawn": "^7.0.3", - "fastest-levenshtein": "^1.0.12", - "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", - "webpack-merge": "^5.7.3" - }, - "bin": { - "webpack-cli": "bin/cli.js" + "safer-buffer": ">= 2.1.2 < 3" }, "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "4.x.x || 5.x.x" + "node": ">=0.10.0" + } + }, + "packages/powerbi/node_modules/readable-stream": { + "version": "4.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" }, - "peerDependenciesMeta": { - "@webpack-cli/generators": { - "optional": true - }, - "@webpack-cli/migrate": { - "optional": true - }, - "webpack-bundle-analyzer": { - "optional": true - }, - "webpack-dev-server": { - "optional": true - } + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/webpack-cli/node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "packages/powerbi/node_modules/requires-port": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/retry": { + "version": "0.13.1", "dev": true, + "license": "MIT", "engines": { - "node": ">= 10" + "node": ">= 4" } }, - "node_modules/webpack-dev-middleware": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.4.2.tgz", - "integrity": "sha512-xOO8n6eggxnwYpy1NlzUKpvrjfJTvae5/D6WOK0S2LSo7vjmo5gCM1DbLUmFqrMTJP+W/0YZNctm7jasWvLuBA==", + "packages/powerbi/node_modules/ripemd160": { + "version": "2.0.3", "dev": true, + "license": "MIT", "dependencies": { - "colorette": "^2.0.10", - "memfs": "^4.6.0", - "mime-types": "^2.1.31", - "on-finished": "^2.4.1", - "range-parser": "^1.2.1", - "schema-utils": "^4.0.0" + "hash-base": "^3.1.2", + "inherits": "^2.0.4" }, "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.0.0" - }, - "peerDependenciesMeta": { - "webpack": { - "optional": true - } + "node": ">= 0.8" } }, - "node_modules/webpack-dev-middleware/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "packages/powerbi/node_modules/ripemd160/node_modules/hash-base": { + "version": "3.1.2", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "inherits": "^2.0.4", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.1" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">= 0.8" } }, - "node_modules/webpack-dev-middleware/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "packages/powerbi/node_modules/ripemd160/node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/ripemd160/node_modules/readable-stream": { + "version": "2.3.8", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, - "node_modules/webpack-dev-middleware/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "packages/powerbi/node_modules/ripemd160/node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "dev": true, + "license": "MIT" }, - "node_modules/webpack-dev-middleware/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", + "packages/powerbi/node_modules/ripemd160/node_modules/string_decoder": { + "version": "1.1.1", "dev": true, + "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "safe-buffer": "~5.1.0" } }, - "node_modules/webpack-dev-server": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/webpack-dev-server/-/webpack-dev-server-5.2.2.tgz", - "integrity": "sha512-QcQ72gh8a+7JO63TAx/6XZf/CWhgMzu5m0QirvPfGvptOusAxG12w2+aua1Jkjr7hzaWDnJ2n6JFeexMHI+Zjg==", + "packages/powerbi/node_modules/ripemd160/node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/schema-utils": { + "version": "0.4.7", "dev": true, "license": "MIT", "dependencies": { - "@types/bonjour": "^3.5.13", - "@types/connect-history-api-fallback": "^1.5.4", - "@types/express": "^4.17.21", - "@types/express-serve-static-core": "^4.17.21", - "@types/serve-index": "^1.9.4", - "@types/serve-static": "^1.15.5", - "@types/sockjs": "^0.3.36", - "@types/ws": "^8.5.10", - "ansi-html-community": "^0.0.8", - "bonjour-service": "^1.2.1", - "chokidar": "^3.6.0", - "colorette": "^2.0.10", - "compression": "^1.7.4", - "connect-history-api-fallback": "^2.0.0", - "express": "^4.21.2", - "graceful-fs": "^4.2.6", - "http-proxy-middleware": "^2.0.9", - "ipaddr.js": "^2.1.0", - "launch-editor": "^2.6.1", - "open": "^10.0.3", - "p-retry": "^6.2.0", - "schema-utils": "^4.2.0", - "selfsigned": "^2.4.1", - "serve-index": "^1.9.1", - "sockjs": "^0.3.24", - "spdy": "^4.0.2", - "webpack-dev-middleware": "^7.4.2", - "ws": "^8.18.0" - }, - "bin": { - "webpack-dev-server": "bin/webpack-dev-server.js" + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" }, "engines": { - "node": ">= 18.12.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.0.0" - }, - "peerDependenciesMeta": { - "webpack": { - "optional": true - }, - "webpack-cli": { - "optional": true - } + "node": ">= 4" } }, - "node_modules/webpack-dev-server/node_modules/@types/express-serve-static-core": { - "version": "4.19.6", - "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz", - "integrity": "sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==", + "packages/powerbi/node_modules/select-hose": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/selfsigned": { + "version": "2.4.1", "dev": true, "license": "MIT", "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*", - "@types/send": "*" + "@types/node-forge": "^1.3.0", + "node-forge": "^1" + }, + "engines": { + "node": ">=10" } }, - "node_modules/webpack-dev-server/node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "packages/powerbi/node_modules/send": { + "version": "0.19.0", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">= 0.8.0" } }, - "node_modules/webpack-dev-server/node_modules/ajv-keywords": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", - "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "packages/powerbi/node_modules/send/node_modules/debug": { + "version": "2.6.9", "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3" - }, - "peerDependencies": { - "ajv": "^8.8.2" + "ms": "2.0.0" } }, - "node_modules/webpack-dev-server/node_modules/json-schema-traverse": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", - "dev": true + "packages/powerbi/node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" }, - "node_modules/webpack-dev-server/node_modules/schema-utils": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.0.tgz", - "integrity": "sha512-Gf9qqc58SpCA/xdziiHz35F4GNIWYWZrEshUc/G/r5BnLph6xpKuLeoJoQuj5WfBIx/eQLf+hmVPYHaxJu7V2g==", + "packages/powerbi/node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "packages/powerbi/node_modules/serve-index": { + "version": "1.9.1", "dev": true, + "license": "MIT", "dependencies": { - "@types/json-schema": "^7.0.9", - "ajv": "^8.9.0", - "ajv-formats": "^2.1.1", - "ajv-keywords": "^5.1.0" + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" }, "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "node": ">= 0.8.0" + } + }, + "packages/powerbi/node_modules/serve-index/node_modules/debug": { + "version": "2.6.9", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" } }, - "node_modules/webpack-dev-server/node_modules/ws": { - "version": "8.18.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", - "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", + "packages/powerbi/node_modules/serve-index/node_modules/depd": { + "version": "1.1.2", "dev": true, + "license": "MIT", "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } + "node": ">= 0.6" } }, - "node_modules/webpack-merge": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", - "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "packages/powerbi/node_modules/serve-index/node_modules/http-errors": { + "version": "1.6.3", "dev": true, + "license": "MIT", "dependencies": { - "clone-deep": "^4.0.1", - "flat": "^5.0.2", - "wildcard": "^2.0.0" + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" }, "engines": { - "node": ">=10.0.0" + "node": ">= 0.6" } }, - "node_modules/webpack-sources": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", - "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "packages/powerbi/node_modules/serve-index/node_modules/inherits": { + "version": "2.0.3", + "dev": true, + "license": "ISC" + }, + "packages/powerbi/node_modules/serve-index/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/serve-index/node_modules/setprototypeof": { + "version": "1.1.0", + "dev": true, + "license": "ISC" + }, + "packages/powerbi/node_modules/serve-index/node_modules/statuses": { + "version": "1.5.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=10.13.0" + "node": ">= 0.6" } }, - "node_modules/webpack/node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "packages/powerbi/node_modules/serve-static": { + "version": "1.16.2", "dev": true, - "bin": { - "acorn": "bin/acorn" + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" }, "engines": { - "node": ">=0.4.0" + "node": ">= 0.8.0" } }, - "node_modules/webpack/node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", + "packages/powerbi/node_modules/setprototypeof": { + "version": "1.2.0", + "dev": true, + "license": "ISC" + }, + "packages/powerbi/node_modules/sha.js": { + "version": "2.4.12", "dev": true, + "license": "(MIT AND BSD-3-Clause)", "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1", + "to-buffer": "^1.2.0" + }, + "bin": { + "sha.js": "bin.js" }, "engines": { - "node": ">= 10.13.0" + "node": ">= 0.10" }, "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/websocket-driver": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", - "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "packages/powerbi/node_modules/sirv": { + "version": "2.0.4", "dev": true, + "license": "MIT", "dependencies": { - "http-parser-js": ">=0.5.1", - "safe-buffer": ">=5.1.0", - "websocket-extensions": ">=0.1.1" + "@polka/url": "^1.0.0-next.24", + "mrmime": "^2.0.0", + "totalist": "^3.0.0" }, "engines": { - "node": ">=0.8.0" + "node": ">= 10" } }, - "node_modules/websocket-extensions": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", - "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "packages/powerbi/node_modules/sockjs": { + "version": "0.3.24", "dev": true, - "engines": { - "node": ">=0.8.0" + "license": "MIT", + "dependencies": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" } }, - "node_modules/whatwg-encoding": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", - "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==", + "packages/powerbi/node_modules/source-map": { + "version": "0.5.7", "dev": true, - "dependencies": { - "iconv-lite": "0.6.3" - }, + "license": "BSD-3-Clause", "engines": { - "node": ">=18" + "node": ">=0.10.0" } }, - "node_modules/whatwg-mimetype": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz", - "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==", + "packages/powerbi/node_modules/spdy": { + "version": "4.0.2", "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, "engines": { - "node": ">=18" + "node": ">=6.0.0" } }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "packages/powerbi/node_modules/spdy-transport": { + "version": "3.0.0", + "dev": true, + "license": "MIT", "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "packages/powerbi/node_modules/spdy-transport/node_modules/readable-stream": { + "version": "3.6.2", "dev": true, + "license": "MIT", "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" }, "engines": { - "node": ">= 8" + "node": ">= 6" } }, - "node_modules/which-boxed-primitive": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", - "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "packages/powerbi/node_modules/statuses": { + "version": "2.0.1", "dev": true, - "dependencies": { - "is-bigint": "^1.1.0", - "is-boolean-object": "^1.2.1", - "is-number-object": "^1.1.1", - "is-string": "^1.1.1", - "is-symbol": "^1.1.1" - }, + "license": "MIT", "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 0.8" } }, - "node_modules/which-builtin-type": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", - "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "packages/powerbi/node_modules/stream-browserify": { + "version": "3.0.0", "dev": true, + "license": "MIT", "dependencies": { - "call-bound": "^1.0.2", - "function.prototype.name": "^1.1.6", - "has-tostringtag": "^1.0.2", - "is-async-function": "^2.0.0", - "is-date-object": "^1.1.0", - "is-finalizationregistry": "^1.1.0", - "is-generator-function": "^1.0.10", - "is-regex": "^1.2.1", - "is-weakref": "^1.0.2", - "isarray": "^2.0.5", - "which-boxed-primitive": "^1.1.0", - "which-collection": "^1.0.2", - "which-typed-array": "^1.1.16" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" } }, - "node_modules/which-collection": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", - "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "packages/powerbi/node_modules/stream-browserify/node_modules/readable-stream": { + "version": "3.6.2", "dev": true, + "license": "MIT", "dependencies": { - "is-map": "^2.0.3", - "is-set": "^2.0.3", - "is-weakmap": "^2.0.2", - "is-weakset": "^2.0.3" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" }, "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 6" } }, - "node_modules/which-typed-array": { - "version": "1.1.19", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz", - "integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==", + "packages/powerbi/node_modules/stream-http": { + "version": "3.2.0", "dev": true, + "license": "MIT", "dependencies": { - "available-typed-arrays": "^1.0.7", - "call-bind": "^1.0.8", - "call-bound": "^1.0.4", - "for-each": "^0.3.5", - "get-proto": "^1.0.1", - "gopd": "^1.2.0", - "has-tostringtag": "^1.0.2" + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "xtend": "^4.0.2" + } + }, + "packages/powerbi/node_modules/stream-http/node_modules/readable-stream": { + "version": "3.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" }, "engines": { - "node": ">= 0.4" + "node": ">= 6" + } + }, + "packages/powerbi/node_modules/thingies": { + "version": "2.5.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "^2" } }, - "node_modules/wildcard": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz", - "integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==", - "dev": true + "packages/powerbi/node_modules/thunky": { + "version": "1.1.0", + "dev": true, + "license": "MIT" }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "packages/powerbi/node_modules/timers-browserify": { + "version": "2.0.12", "dev": true, + "license": "MIT", + "dependencies": { + "setimmediate": "^1.0.4" + }, "engines": { - "node": ">=0.10.0" + "node": ">=0.6.0" } }, - "node_modules/wordwrapjs": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/wordwrapjs/-/wordwrapjs-4.0.1.tgz", - "integrity": "sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==", + "packages/powerbi/node_modules/to-buffer": { + "version": "1.2.2", + "dev": true, + "license": "MIT", "dependencies": { - "reduce-flatten": "^2.0.0", - "typical": "^5.2.0" + "isarray": "^2.0.5", + "safe-buffer": "^5.2.1", + "typed-array-buffer": "^1.0.3" }, "engines": { - "node": ">=8.0.0" + "node": ">= 0.4" } }, - "node_modules/wordwrapjs/node_modules/typical": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/typical/-/typical-5.2.0.tgz", - "integrity": "sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==", + "packages/powerbi/node_modules/toidentifier": { + "version": "1.0.1", + "dev": true, + "license": "MIT", "engines": { - "node": ">=8" + "node": ">=0.6" } }, - "node_modules/workerpool": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", - "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "packages/powerbi/node_modules/totalist": { + "version": "3.0.1", "dev": true, "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "node": ">=6" } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "packages/powerbi/node_modules/tree-dump": { + "version": "1.1.0", "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, + "license": "Apache-2.0", "engines": { - "node": ">=10" + "node": ">=10.0" }, "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "type": "github", + "url": "https://github.com/sponsors/streamich" + }, + "peerDependencies": { + "tslib": "2" } }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "packages/powerbi/node_modules/tty-browserify": { + "version": "0.0.1", "dev": true, "license": "MIT" }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "packages/powerbi/node_modules/type-is": { + "version": "1.6.18", "dev": true, "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "media-typer": "0.3.0", + "mime-types": "~2.1.24" }, "engines": { - "node": ">=8" + "node": ">= 0.6" } }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "packages/powerbi/node_modules/universalify": { + "version": "2.0.1", "dev": true, "license": "MIT", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" + "node": ">= 10.0.0" } }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "packages/powerbi/node_modules/unpipe": { + "version": "1.0.0", "dev": true, "license": "MIT", "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" + "node": ">= 0.8" } }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "packages/powerbi/node_modules/url": { + "version": "0.11.4", "dev": true, "license": "MIT", "dependencies": { - "ansi-regex": "^6.0.1" + "punycode": "^1.4.1", + "qs": "^6.12.3" }, "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" + "node": ">= 0.4" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "packages/powerbi/node_modules/url/node_modules/punycode": { + "version": "1.4.1", + "dev": true, + "license": "MIT" }, - "node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "packages/powerbi/node_modules/util": { + "version": "0.12.5", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "packages/powerbi/node_modules/utils-merge": { + "version": "1.0.1", "dev": true, + "license": "MIT", "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } + "node": ">= 0.4.0" } }, - "node_modules/x-is-string": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz", - "integrity": "sha512-GojqklwG8gpzOVEVki5KudKNoq7MbbjYZCbyWzEz7tyPA7eleiE0+ePwOWQQRb5fm86rD3S8Tc0tSFf3AOv50w==", - "dev": true + "packages/powerbi/node_modules/vary": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } }, - "node_modules/xml2js": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", - "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", + "packages/powerbi/node_modules/vm-browserify": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/wbuf": { + "version": "1.7.3", "dev": true, + "license": "MIT", "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - }, - "engines": { - "node": ">=4.0.0" + "minimalistic-assert": "^1.0.0" } }, - "node_modules/xmlbuilder": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", - "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", + "packages/powerbi/node_modules/webpack-bundle-analyzer": { + "version": "4.10.2", "dev": true, + "license": "MIT", + "dependencies": { + "@discoveryjs/json-ext": "0.5.7", + "acorn": "^8.0.4", + "acorn-walk": "^8.0.0", + "commander": "^7.2.0", + "debounce": "^1.2.1", + "escape-string-regexp": "^4.0.0", + "gzip-size": "^6.0.0", + "html-escaper": "^2.0.2", + "opener": "^1.5.2", + "picocolors": "^1.0.0", + "sirv": "^2.0.3", + "ws": "^7.3.1" + }, + "bin": { + "webpack-bundle-analyzer": "lib/bin/analyzer.js" + }, "engines": { - "node": ">=4.0" + "node": ">= 10.13.0" } }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "packages/powerbi/node_modules/webpack-bundle-analyzer/node_modules/commander": { + "version": "7.2.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.4" + "node": ">= 10" } }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "packages/powerbi/node_modules/webpack-dev-middleware": { + "version": "7.4.5", "dev": true, + "license": "MIT", + "dependencies": { + "colorette": "^2.0.10", + "memfs": "^4.43.1", + "mime-types": "^3.0.1", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "schema-utils": "^4.0.0" + }, "engines": { - "node": ">=10" + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + } } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "packages/powerbi/node_modules/webpack-dev-middleware/node_modules/ajv": { + "version": "8.17.1", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "packages/powerbi/node_modules/webpack-dev-middleware/node_modules/ajv-keywords": { + "version": "5.1.0", "dev": true, + "license": "MIT", "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "fast-deep-equal": "^3.1.3" }, - "engines": { - "node": ">=10" + "peerDependencies": { + "ajv": "^8.8.2" } }, - "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "packages/powerbi/node_modules/webpack-dev-middleware/node_modules/json-schema-traverse": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/webpack-dev-middleware/node_modules/mime-db": { + "version": "1.54.0", "dev": true, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">= 0.6" } }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "packages/powerbi/node_modules/webpack-dev-middleware/node_modules/mime-types": { + "version": "3.0.2", "dev": true, + "license": "MIT", "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" + "mime-db": "^1.54.0" }, "engines": { - "node": ">=10" + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, - "node_modules/yargs-unparser/node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "packages/powerbi/node_modules/webpack-dev-middleware/node_modules/schema-utils": { + "version": "4.3.3", "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, "engines": { - "node": ">=8" + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "packages/powerbi/node_modules/webpack-dev-server": { + "version": "5.2.2", "dev": true, + "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "@types/bonjour": "^3.5.13", + "@types/connect-history-api-fallback": "^1.5.4", + "@types/express": "^4.17.21", + "@types/express-serve-static-core": "^4.17.21", + "@types/serve-index": "^1.9.4", + "@types/serve-static": "^1.15.5", + "@types/sockjs": "^0.3.36", + "@types/ws": "^8.5.10", + "ansi-html-community": "^0.0.8", + "bonjour-service": "^1.2.1", + "chokidar": "^3.6.0", + "colorette": "^2.0.10", + "compression": "^1.7.4", + "connect-history-api-fallback": "^2.0.0", + "express": "^4.21.2", + "graceful-fs": "^4.2.6", + "http-proxy-middleware": "^2.0.9", + "ipaddr.js": "^2.1.0", + "launch-editor": "^2.6.1", + "open": "^10.0.3", + "p-retry": "^6.2.0", + "schema-utils": "^4.2.0", + "selfsigned": "^2.4.1", + "serve-index": "^1.9.1", + "sockjs": "^0.3.24", + "spdy": "^4.0.2", + "webpack-dev-middleware": "^7.4.2", + "ws": "^8.18.0" + }, + "bin": { + "webpack-dev-server": "bin/webpack-dev-server.js" }, "engines": { - "node": ">=8" + "node": ">= 18.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "webpack": { + "optional": true + }, + "webpack-cli": { + "optional": true + } } }, - "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "packages/powerbi/node_modules/webpack-dev-server/node_modules/ajv": { + "version": "8.17.1", "dev": true, + "license": "MIT", "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/yazl": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", - "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", + "packages/powerbi/node_modules/webpack-dev-server/node_modules/ajv-keywords": { + "version": "5.1.0", "dev": true, + "license": "MIT", "dependencies": { - "buffer-crc32": "~0.2.3" + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" } }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "packages/powerbi/node_modules/webpack-dev-server/node_modules/json-schema-traverse": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "packages/powerbi/node_modules/webpack-dev-server/node_modules/schema-utils": { + "version": "4.3.3", "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.9.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.1.0" + }, "engines": { - "node": ">=10" + "node": ">= 10.13.0" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "type": "opencollective", + "url": "https://opencollective.com/webpack" } }, - "packages/chart-recommender": { - "name": "@msrvida/chart-recommender", - "version": "3.2.1", + "packages/powerbi/node_modules/webpack-dev-server/node_modules/ws": { + "version": "8.18.3", + "dev": true, "license": "MIT", - "dependencies": { - "@msrvida/chart-types": "^1", - "@msrvida/sanddance-specs": "^1" + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, - "packages/chart-types": { - "name": "@msrvida/chart-types", - "version": "1.1.1", - "license": "MIT", + "packages/powerbi/node_modules/websocket-driver": { + "version": "0.7.4", + "dev": true, + "license": "Apache-2.0", "dependencies": { - "vega-typings": "~1.5.0" + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + }, + "engines": { + "node": ">=0.8.0" } }, - "packages/data-inference": { - "name": "@msrvida/data-inference", - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "@msrvida/chart-types": "^1", - "d3-color": "^3.1.0", - "vega-typings": "~1.5.0" + "packages/powerbi/node_modules/websocket-extensions": { + "version": "0.1.4", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=0.8.0" } }, - "packages/fluentui-icons": { - "name": "@msrvida/fluentui-icons", - "version": "1.1.1", - "license": "MIT" - }, - "packages/fluentui-react-cdn-typings": { - "name": "@msrvida/fluentui-react-cdn-typings", - "version": "2.1.0", + "packages/powerbi/node_modules/ws": { + "version": "7.5.10", + "dev": true, "license": "MIT", - "dependencies": { - "@fluentui/react": "^8" + "engines": { + "node": ">=8.3.0" }, "peerDependencies": { - "@types/react": ">=16.8.0 <18.0.0" + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, - "packages/powerbi": { - "dependencies": { - "@babel/runtime": "^7.26.10", - "@babel/runtime-corejs2": "^7.26.10", - "@fluentui/react": "^8", - "@msrvida/sanddance-explorer": "file:../sanddance-explorer", - "core-js": "3.2.1", - "powerbi": "file:", - "powerbi-models": "^1.15.2", - "powerbi-visuals-api": "~5.11.0", - "powerbi-visuals-utils-dataviewutils": "^6.1.0", - "react": ">=16.8.0 <18.0.0", - "react-dom": ">=16.8.0 <18.0.0", - "regenerator-runtime": "^0.13.3", - "vega": "5.32.0" - }, - "devDependencies": { - "@msrvida/fluentui-react-cdn-typings": "file:../fluentui-react-cdn-typings", - "@types/react": ">=16.8.0 <18.0.0", - "@types/react-dom": ">=16.8.0 <18.0.0", - "powerbi-visuals-tools": "^5" + "packages/powerbi/node_modules/xtend": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4" } }, "packages/sanddance": { @@ -18151,11 +17012,11 @@ "license": "MIT", "dependencies": { "@msrvida/chart-types": "^1", - "@msrvida/sanddance-specs": "^1", + "@msrvida/sanddance-specs": "^2", "@msrvida/search-expression": "^1", "@msrvida/vega-morphcharts": "^1", "d3-scale": "^4.0.2", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" }, "devDependencies": { "@types/d3-scale": "^4.0.2" @@ -18178,7 +17039,7 @@ "version": "4.1.8", "license": "MIT", "dependencies": { - "@msrvida/chart-recommender": "^3", + "@msrvida/chart-recommender": "^4", "@msrvida/fluentui-react-cdn-typings": "^2", "@msrvida/sanddance-react": "^4", "d3-format": "^1.3.2" @@ -18211,13 +17072,13 @@ }, "packages/sanddance-specs": { "name": "@msrvida/sanddance-specs", - "version": "1.8.1", + "version": "2.0.0", "license": "MIT", "dependencies": { "@msrvida/chart-types": "^1", - "@msrvida/data-inference": "^1", + "@msrvida/data-inference": "^2", "@msrvida/search-expression": "^1", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } }, "packages/sanddance-test-es6": { @@ -18232,7 +17093,7 @@ "license": "MIT", "dependencies": { "@msrvida/chart-types": "^1", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } }, "packages/vega-deck.gl": { @@ -18246,7 +17107,7 @@ "d3-ease": "^1.0.5", "deepmerge": "^2.1.1", "tsx-create-element": "^2.2.9", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } }, "packages/vega-morphcharts": { @@ -18261,7 +17122,7 @@ "is-plain-object": "^5.0.0", "morphcharts": "^1", "tsx-create-element": "^2.2.5", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } }, "packages/vega-morphcharts-test-es6": { @@ -18273,18 +17134,6 @@ "engines": { "node": ">=12" } - }, - "streamlit/streamlit_sanddance/frontend": { - "name": "streamlit-sanddance", - "version": "1.0.0", - "dependencies": { - "@fluentui/react": "^8", - "@msrvida/sanddance-explorer": "^4", - "react": ">=16.8.0 <18.0.0", - "react-dom": ">=16.8.0 <18.0.0", - "streamlit-component-lib": "^2.0.0", - "vega": "5.32.0" - } } } } diff --git a/package.json b/package.json index a986cb148..ee732c8e9 100644 --- a/package.json +++ b/package.json @@ -21,24 +21,15 @@ "build-test": "npm run build-test --workspaces --if-present", "watch-css": "npm run watch-css --workspaces --if-present", "watch-typescript": "npm run watch-typescript --workspaces --if-present", - "specs-message": "echo start jekyll then open http://localhost:4000/SandDance/tests/sanddance-specs/v1/", - "specs-watch-typescript": "npm run watch-typescript --workspace @msrvida/sanddance-specs", - "specs-watch": "npm run deploy-watch --workspace @msrvida/sanddance-specs", - "specs": "npm run specs-message && npm-run-all --parallel specs-watch-typescript specs-watch", - "serve-es6": "parcel serve ./test/sanddance-test-es6.html --port 8086 --open --no-autoinstall", - "start-es6": "npm-run-all --parallel watch-typescript watch-css serve-es6", - "serve-app": "parcel serve ./test/sanddance-app.html --port 8085 --open --no-autoinstall", - "streamlit-dev": "parcel serve ./test/streamlit_sanddance.html --port 8087 --open --no-autoinstall", - "data-inference-dev": "parcel serve ./test/data-inference.html --port 8088 --open --no-autoinstall", + "specs": "npm-run-all --parallel specs-watch-typescript specs-watch", + "serve-app": "npm run dev --workspace @msrvida/sanddance-app", "start": "npm-run-all --parallel watch-typescript watch-css serve-app", - "parcel": "npm run parcel --workspaces --if-present", "restore-dist": "git checkout -q -- ./packages/sanddance/dist/umd/sanddance.d.ts ./packages/sanddance-react/dist/umd/sanddance-react.d.ts ./packages/vega-deck.gl/dist/umd/vega-deck.gl.d.ts ./packages/vega-morphcharts/dist/umd/vega-morphcharts.d.ts ./packages/sanddance-specs/dist/umd/sanddance-specs.d.ts ./packages/data-inference/dist/umd/data-inference.d.ts", - "clean-parcel-cache": "rimraf ./.parcel-cache/ && rimraf ./packages/**/.cache/ && rimraf ./packages/**/.parcel-cache/", - "clean-build": "npm run clean-parcel-cache && rimraf ./packages/**/dist/", + "clean-build": "rimraf --glob ./packages/**/dist/", "clean": "npm run clean --workspaces --if-present && npm run clean-build && npm run restore-dist", - "remove-pem": "rimraf **/*.pem && rimraf **/*.key", + "remove-pem": "rimraf --glob **/*.pem && rimraf --glob **/*.key", "vega-upgrade": "npm run remove-vega --workspaces --if-present && git checkout -- \"**/package.json\" && node ./scripts/vega-version.mjs", - "deploy": "npm run clean-parcel-cache && npm run deploy --workspaces --if-present", + "deploy": "npm run deploy --workspaces --if-present", "test": "npm run eslint && npm run test --workspaces --if-present", "dev": "npm run dev --workspace dev --if-present", "pbiviz": "npm run start -w powerbi", @@ -59,12 +50,11 @@ "@deck.gl/layers": "8.3.7", "@fluentui/react": "^8", "@luma.gl/core": "8.3.1", - "@parcel/transformer-sass": "^2.15.2", "@rollup/plugin-buble": "^1.0.3", - "@rollup/plugin-commonjs": "^28.0.0", + "@rollup/plugin-commonjs": "^29.0.0", "@rollup/plugin-json": "^6.1.0", - "@rollup/plugin-node-resolve": "^15.3.0", - "@rollup/plugin-typescript": "^12.1.0", + "@rollup/plugin-node-resolve": "^16.0.3", + "@rollup/plugin-typescript": "^12.3.0", "@types/azdata": "^1.29.0", "@types/d3-color": "^3.1.0", "@types/d3-ease": "^3.0.0", @@ -86,7 +76,7 @@ "eslint-plugin-react": "^7.37.5", "esm": "^3.2.25", "fs-extra": "^7.0.1", - "glob": "^11.1.0", + "glob": "^13.0.0", "inuitcss": "^6.0.0", "is-plain-object": "^5.0.0", "just-compare": "^1.3.0", @@ -95,45 +85,30 @@ "mocha": "^10.1.0", "morphcharts": "^1", "npm-run-all": "^4.1.5", - "parcel": "^2.15.2", "process": "^0.11.10", "react": ">=16.8.0 <18.0.0", "react-dom": ">=16.8.0 <18.0.0", "regenerator-runtime": "^0.13.3", - "rimraf": "^2.6.2", - "rollup": "^4.22.5", - "sass": "^1.32.4", - "streamlit-component-lib": "^2.0.0", + "rimraf": "^6.1.2", + "rollup": "^4.53.3", + "sass": "^1.94.2", "temp-write": "^3.4.0", "ts-loader": "^9.3.1", "tsx-create-element": "^2.2.9", "typescript": "^5.7.2", "unified": "^7.0.2", - "vega": "^5.32.0", + "vega": "^6.2.0", "vega-datasets": "2.8.1", - "vega-typings": "^1.5.0", + "vega-typings": "^2.1.0", + "vite": "^7.2.6", "vscode-test": "^1.3.0", "webpack": "^5.52.0", "webpack-cli": "^4.8.0" }, - "babel": { - "presets": [ - "es2015" - ] - }, - "alias": { - "react": { - "global": "React" - }, - "react-dom": { - "global": "ReactDOM" - } - }, "workspaces": { "packages": [ "extensions/*", - "packages/*", - "streamlit/streamlit_sanddance/frontend" + "packages/*" ], "nohoist": [ "packages/powerbi/**", diff --git a/packages/chart-recommender/.mocharc.json b/packages/chart-recommender/.mocharc.json new file mode 100644 index 000000000..a6aa611c1 --- /dev/null +++ b/packages/chart-recommender/.mocharc.json @@ -0,0 +1,6 @@ +{ + "spec": "test/**/*.mjs", + "node-option": [ + "experimental-specifier-resolution=node" + ] +} diff --git a/packages/chart-recommender/package.json b/packages/chart-recommender/package.json index 005c880e6..8b04352a5 100644 --- a/packages/chart-recommender/package.json +++ b/packages/chart-recommender/package.json @@ -1,8 +1,9 @@ { "name": "@msrvida/chart-recommender", - "version": "3.2.1", + "version": "4.0.0", + "type": "module", "description": "Recommendation engine for SandDance charts", - "main": "dist/es5/index.js", + "main": "dist/es6/index.js", "repository": { "type": "git", "url": "https://github.com/microsoft/SandDance.git", @@ -13,16 +14,14 @@ ], "dependencies": { "@msrvida/chart-types": "^1", - "@msrvida/sanddance-specs": "^1" + "@msrvida/sanddance-specs": "^2" }, "scripts": { "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "test": "mocha", "build-typescript": "tsc -p .", "watch-typescript": "tsc -p . -w", - "build:04": "npm run build-typescript", - "remove-vega": "npm un vega", - "patch-after-vega-upgrade": "npm version patch" + "build:04": "npm run build-typescript" }, "author": "", "license": "MIT" diff --git a/packages/chart-recommender/src/barChart.ts b/packages/chart-recommender/src/barChart.ts index ca3cb79e3..be0385fa4 100644 --- a/packages/chart-recommender/src/barChart.ts +++ b/packages/chart-recommender/src/barChart.ts @@ -10,7 +10,7 @@ import { Recommendation, Recommender, Rule, -} from './recommender'; +} from './recommender.js'; const maxDistinctVal = 20; const minDistinctVal = 2; diff --git a/packages/chart-recommender/src/index.ts b/packages/chart-recommender/src/index.ts index 346bdbc61..0f213b630 100644 --- a/packages/chart-recommender/src/index.ts +++ b/packages/chart-recommender/src/index.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. */ -export * from './barChart'; -export * from './geo'; -export * from './scatterPlot'; -export * from './treemap'; -export * from './recommenderSummary'; +export * from './barChart.js'; +export * from './geo.js'; +export * from './scatterPlot.js'; +export * from './treemap.js'; +export * from './recommenderSummary.js'; diff --git a/packages/chart-recommender/src/recommenderSummary.ts b/packages/chart-recommender/src/recommenderSummary.ts index 4e0857416..7f48367bf 100644 --- a/packages/chart-recommender/src/recommenderSummary.ts +++ b/packages/chart-recommender/src/recommenderSummary.ts @@ -4,9 +4,9 @@ */ import { Column } from '@msrvida/chart-types'; -import { BarChartRecommenderSummary } from './barChart'; -import { Recommendation } from './recommender'; -import { ScatterPlotRecommenderSummary } from './scatterPlot'; +import { BarChartRecommenderSummary } from './barChart.js'; +import { Recommendation } from './recommender.js'; +import { ScatterPlotRecommenderSummary } from './scatterPlot.js'; export class RecommenderSummary { public rec: Recommendation; diff --git a/packages/chart-recommender/src/scatterPlot.ts b/packages/chart-recommender/src/scatterPlot.ts index 7a6bf697f..427f9dd10 100644 --- a/packages/chart-recommender/src/scatterPlot.ts +++ b/packages/chart-recommender/src/scatterPlot.ts @@ -4,8 +4,8 @@ */ import { Column } from '@msrvida/chart-types'; -import { defaultColorScheme, maxCategoricalColors, Recommendation } from './recommender'; -import { isLatitude, isLongitude } from './geo'; +import { defaultColorScheme, maxCategoricalColors, Recommendation } from './recommender.js'; +import { isLatitude, isLongitude } from './geo.js'; export class ScatterPlotRecommenderSummary { public best: Recommendation; diff --git a/packages/chart-recommender/src/treemap.ts b/packages/chart-recommender/src/treemap.ts index 48a894340..e8a76ba41 100644 --- a/packages/chart-recommender/src/treemap.ts +++ b/packages/chart-recommender/src/treemap.ts @@ -4,7 +4,7 @@ */ import { Column } from '@msrvida/chart-types'; -import { isGeo } from './geo'; +import { isGeo } from './geo.js'; export function preferredColumnForTreemapSize(columns: Column[], strict: boolean) { for (let i = 0; i < columns.length; i++) { diff --git a/packages/chart-recommender/test/recommend.js b/packages/chart-recommender/test/recommend.mjs similarity index 92% rename from packages/chart-recommender/test/recommend.js rename to packages/chart-recommender/test/recommend.mjs index 1acad2294..c086a7300 100644 --- a/packages/chart-recommender/test/recommend.js +++ b/packages/chart-recommender/test/recommend.mjs @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -var assert = require('assert'); -var recommender = require('../dist/es5'); -var fs = require('fs'); -var vega = require('vega'); -var { getColumnsFromData } = require('@msrvida/sanddance-specs/dist/umd/sanddance-specs'); +import assert from 'assert'; +import * as recommender from '../dist/es6/index.js'; +import fs from 'fs'; +import * as vega from 'vega'; +import { getColumnsFromData } from '@msrvida/sanddance-specs'; -var sampleDir = './test-data/'; +const sampleDir = './test-data/'; function GetDataAndColumns(sampleFile) { return new Promise((resolve, reject) => { diff --git a/packages/chart-recommender/tsconfig.json b/packages/chart-recommender/tsconfig.json index db5b06b45..1baf442af 100644 --- a/packages/chart-recommender/tsconfig.json +++ b/packages/chart-recommender/tsconfig.json @@ -5,9 +5,9 @@ "es2015" ], "moduleResolution": "node", - "outDir": "dist/es5", + "outDir": "dist/es6", "skipLibCheck": true, - "target": "es5" + "target": "es6" }, "include": [ "src" diff --git a/packages/chart-types/package.json b/packages/chart-types/package.json index 1f388a1fd..569fbfb00 100644 --- a/packages/chart-types/package.json +++ b/packages/chart-types/package.json @@ -14,7 +14,6 @@ ], "scripts": { "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", - "predocs": "rimraf ../../docs/docs/chart-types/v1", "watch-typescript": "tsc -p . -w", "build-typescript": "tsc -p .", "build:01": "npm run build-typescript", @@ -24,6 +23,6 @@ "author": "Dan Marshall", "license": "MIT", "dependencies": { - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } } \ No newline at end of file diff --git a/packages/chart-types/src/column.ts b/packages/chart-types/src/column.ts index 2df0c7173..920361e77 100644 --- a/packages/chart-types/src/column.ts +++ b/packages/chart-types/src/column.ts @@ -4,6 +4,7 @@ */ import { TypeInference } from 'vega-typings'; +import { ColumnStats } from './stats'; /** * Column information. @@ -36,53 +37,6 @@ export interface Column { stats?: ColumnStats; } -/** - * Metadata about a column. - */ -export interface ColumnStats { - - /*** - * Number of non-null values in this column. - */ - nonNull: number; - - /** - * Number of unique values in this column. - */ - distinctValueCount: number; - - /** - * Maximum value of data in this column, if column is numeric. - */ - max?: number; - - /** - * Mean value of data in this column, if column is numeric. - */ - mean?: number; - - /** - * Minimum value of data in this column, if column is numeric. - */ - min?: number; - - /** - * Optional flag to specify if the column data is sequential. - */ - isSequential?: boolean; - - /** - * Optional flag to specify if the column data contains negative numbers. - */ - hasNegative?: boolean; - - /** - * Optional flag to specify if the column data contains color data. - */ - hasColorData?: boolean; - -} - export interface ColumnTypeMap { [columnName: string]: TypeInference } diff --git a/packages/chart-types/src/index.ts b/packages/chart-types/src/index.ts index 1aa655796..a354b96ae 100644 --- a/packages/chart-types/src/index.ts +++ b/packages/chart-types/src/index.ts @@ -5,4 +5,5 @@ export * from './column'; export * from './dimensions'; +export * from './stats'; export * from './view'; diff --git a/packages/chart-types/src/stats.ts b/packages/chart-types/src/stats.ts new file mode 100644 index 000000000..c45297473 --- /dev/null +++ b/packages/chart-types/src/stats.ts @@ -0,0 +1,50 @@ +/*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ + +/** + * Metadata about a column. + */ +export interface ColumnStats { + + /*** + * Number of non-null values in this column. + */ + nonNull: number; + + /** + * Number of unique values in this column. + */ + distinctValueCount: number; + + /** + * Maximum value of data in this column, if column is numeric. + */ + max?: number; + + /** + * Mean value of data in this column, if column is numeric. + */ + mean?: number; + + /** + * Minimum value of data in this column, if column is numeric. + */ + min?: number; + + /** + * Optional flag to specify if the column data is sequential. + */ + isSequential?: boolean; + + /** + * Optional flag to specify if the column data contains negative numbers. + */ + hasNegative?: boolean; + + /** + * Optional flag to specify if the column data contains color data. + */ + hasColorData?: boolean; +} diff --git a/packages/data-inference/README.md b/packages/data-inference/README.md index 0182b9561..9754e2de7 100644 --- a/packages/data-inference/README.md +++ b/packages/data-inference/README.md @@ -1,8 +1,8 @@ # @msrvida/data-inference -Infer column types in tabular data. Inference is from [vega-loader's `inferTypes` function](https://github.com/vega/vega/tree/main/packages/vega-loader#inferTypes) (or similar function of your choice). This library enriches the column metadata with a [ColumnStats object](https://microsoft.github.io/SandDance/docs/chart-types/v1/interfaces/ColumnStats.html). +Infer column types in tabular data. Inference is from [vega-loader's `inferTypes` function](https://github.com/vega/vega/tree/main/packages/vega-loader#inferTypes) (or similar function of your choice). This library enriches the column metadata with a [ColumnStats object](https://github.com/microsoft/SandDance/blob/main/packages/chart-types/src/stats.ts). -[Demo](https://microsoft.github.io/SandDance/tests/data-inference/v1/) +[Demo](https://microsoft.github.io/SandDance/tests/data-inference/v2/) ## Usage @@ -44,7 +44,7 @@ console.log(columns); ### Pre-built library ```html - + + +
+ + + + + + + + \ No newline at end of file diff --git a/packages/sanddance-app/package.json b/packages/sanddance-app/package.json index 6ea269bab..a1063b42e 100644 --- a/packages/sanddance-app/package.json +++ b/packages/sanddance-app/package.json @@ -9,8 +9,8 @@ "watch-typescript": "tsc -p . -w", "build-css": "sass ./src/css/sanddance-app.scss ./dist/css/sanddance-app.css", "build:07": "npm run build-typescript && npm run bundle && npm run build-css", - "bundle": "parcel build ./dist/es6/index.js --no-autoinstall --no-cache", - "remove-vega": "npm un vega vega-typings" + "bundle": "vite build", + "dev": "vite --config vite.dev.config.js" }, "targets": { "main": false, diff --git a/packages/sanddance-app/vite.config.js b/packages/sanddance-app/vite.config.js new file mode 100644 index 000000000..a3126ff5c --- /dev/null +++ b/packages/sanddance-app/vite.config.js @@ -0,0 +1,29 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; + +export default defineConfig({ + define: { + 'process.env': process.env, + }, + build: { + lib: { + entry: resolve(__dirname, 'dist/es6/index.js'), + name: 'SandDanceApp', + formats: ['umd'], + fileName: () => 'sanddance-app.js', + }, + outDir: 'dist/umd', + emptyOutDir: true, + sourcemap: false, + minify: false, + rollupOptions: { + external: ['react', 'react-dom'], + output: { + globals: { + 'react': 'React', + 'react-dom': 'ReactDOM', + }, + }, + }, + }, +}); diff --git a/packages/sanddance-app/vite.dev.config.js b/packages/sanddance-app/vite.dev.config.js new file mode 100644 index 000000000..20d362318 --- /dev/null +++ b/packages/sanddance-app/vite.dev.config.js @@ -0,0 +1,9 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; + +export default defineConfig({ + publicDir: resolve(__dirname, '../../docs'), + server: { + open: true, + }, +}); diff --git a/packages/sanddance-embed/README.md b/packages/sanddance-embed/README.md index 2f5dc59b9..81147601f 100644 --- a/packages/sanddance-embed/README.md +++ b/packages/sanddance-embed/README.md @@ -90,7 +90,7 @@ Use `postMessage` to communicate with `embedIframe.contentWindow`. For all comma *Note that the `props` member is for initializing the instance of SandDance Explorer. A new dataset can be loaded with a subsequent load command, but `props` will be not be used.* - * The `insight` member, of type [Insight](https://microsoft.github.io/SandDance/docs/sanddance-specs/v1/interfaces/Insight.html), to specify a chart view: + * The `insight` member, of type [Insight](https://github.com/microsoft/SandDance/blob/main/packages/sanddance-specs/src/insight.ts), to specify a chart view: ```js const insight = { chart: 'barchartH', diff --git a/packages/sanddance-embed/package.json b/packages/sanddance-embed/package.json index 17b4e9fb5..2cbc0c7f5 100644 --- a/packages/sanddance-embed/package.json +++ b/packages/sanddance-embed/package.json @@ -17,9 +17,7 @@ "build-css": "sass ./src/css/sanddance-embed.scss ./dist/css/sanddance-embed.css", "build-typescript": "tsc -p .", "build-gen": "tsc -p ./src/gen", - "build:07": "npm run build-css && npm run build-typescript", - "remove-vega": "npm un vega", - "patch-after-vega-upgrade": "npm version patch" + "build:07": "npm run build-css && npm run build-typescript" }, "dependencies": { "@msrvida/sanddance-explorer": "^4" diff --git a/packages/sanddance-embed/src/deps.ts b/packages/sanddance-embed/src/deps.ts index 2f5aed1c8..a6e145865 100644 --- a/packages/sanddance-embed/src/deps.ts +++ b/packages/sanddance-embed/src/deps.ts @@ -39,7 +39,7 @@ namespace SandDanceEmbed { type: 'script', url: `${localDev ? '../../../../node_modules/vega' - : 'https://unpkg.com/vega@5.32' + : 'https://unpkg.com/vega@6.2' }/build/vega${minified ? '.min' : ''}.js`, }, { diff --git a/packages/sanddance-embed/src/types/message-request.d.ts b/packages/sanddance-embed/src/types/message-request.d.ts index 9c343f09a..ab0b6a0ea 100644 --- a/packages/sanddance-embed/src/types/message-request.d.ts +++ b/packages/sanddance-embed/src/types/message-request.d.ts @@ -10,28 +10,16 @@ interface MessageRequest_Init extends MessageRequestBase { action: 'init'; } -/** - * See https://microsoft.github.io/SandDance/docs/sanddance-explorer/v4/interfaces/DataFile.html - */ type DataToLoad = object[] | SandDanceExplorer.DataFile; interface MessageRequest_Load extends MessageRequestBase { action: 'load'; data: DataToLoad; - /** - * See https://microsoft.github.io/SandDance/docs/sanddance-specs/v1/interfaces/Insight.html - */ insight?: Partial; - /** - * See https://microsoft.github.io/SandDance/docs/sanddance-explorer/v4/interfaces/Props.html - */ props?: SandDanceExplorer.Props; - /** - * See https://microsoft.github.io/SandDance/docs/sanddance-explorer/v4/interfaces/Options.html - */ options?: SandDanceExplorer.Options; } diff --git a/packages/sanddance-embed/src/types/message-response.d.ts b/packages/sanddance-embed/src/types/message-response.d.ts index a968536f3..9ef6d293c 100644 --- a/packages/sanddance-embed/src/types/message-response.d.ts +++ b/packages/sanddance-embed/src/types/message-response.d.ts @@ -10,17 +10,11 @@ interface MessageResponse_GetData extends MessageResponseBase { interface MessageResponse_GetInsight extends MessageResponseBase { - /** - * See https://microsoft.github.io/SandDance/docs/sanddance-specs/v1/interfaces/Insight.html - */ insight: SandDanceExplorer.SandDance.types.Insight; } interface MessageResponse_GetSetup extends MessageResponseBase { - /** - * See https://microsoft.github.io/SandDance/docs/sanddance-explorer/v4/interfaces/SandDance.types.Setup.html - */ setup: SandDanceExplorer.SandDance.types.Setup; } diff --git a/packages/sanddance-explorer/README.md b/packages/sanddance-explorer/README.md index d68ef1f84..80dea2b55 100644 --- a/packages/sanddance-explorer/README.md +++ b/packages/sanddance-explorer/README.md @@ -14,7 +14,7 @@ Add these to the `dependencies` section of your `package.json`, then run `npm in ```json "@msrvida/sanddance-explorer": "^4", "@fluentui/react": "^8", -"vega": "^5.32" +"vega": "^6.2" ``` Import these in your JavaScript: diff --git a/packages/sanddance-explorer/package.json b/packages/sanddance-explorer/package.json index 8bd710e7a..cb525c84d 100644 --- a/packages/sanddance-explorer/package.json +++ b/packages/sanddance-explorer/package.json @@ -18,12 +18,10 @@ "watch-typescript": "tsc -p . -w", "build-css": "sass ./src/css/sanddance-explorer.scss ./dist/css/sanddance-explorer.css", "watch-css": "sass ./src/css/sanddance-explorer.scss ./dist/css/sanddance-explorer.css --watch", - "bundle": "parcel build ./bundle/umd.js --no-autoinstall --no-cache", + "bundle": "vite build", "deploy": "node ./scripts/deploy.js", "prebuild:06": "node ./scripts/prebuild.js", - "build:06": "npm run build-typescript && node ../../scripts/version.js && npm run bundle && npm run build-css", - "remove-vega": "npm un vega-typings", - "patch-after-vega-upgrade": "npm version patch" + "build:06": "npm run build-typescript && node ../../scripts/version.js && npm run bundle && npm run build-css" }, "targets": { "main": false, @@ -40,7 +38,7 @@ }, "umd": "./dist/umd/sanddance-explorer.js", "dependencies": { - "@msrvida/chart-recommender": "^3", + "@msrvida/chart-recommender": "^4", "@msrvida/fluentui-react-cdn-typings": "^2", "@msrvida/sanddance-react": "^4", "d3-format": "^1.3.2" diff --git a/packages/sanddance-explorer/src/controls/dataExporterHtml.ts b/packages/sanddance-explorer/src/controls/dataExporterHtml.ts index b9f7f12e2..81c28bf58 100644 --- a/packages/sanddance-explorer/src/controls/dataExporterHtml.ts +++ b/packages/sanddance-explorer/src/controls/dataExporterHtml.ts @@ -15,7 +15,7 @@ export const embedHtml = (title: string, embed: string) => ` - + diff --git a/packages/sanddance-explorer/vite.config.js b/packages/sanddance-explorer/vite.config.js new file mode 100644 index 000000000..a45576ace --- /dev/null +++ b/packages/sanddance-explorer/vite.config.js @@ -0,0 +1,26 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; + +export default defineConfig({ + build: { + lib: { + entry: resolve(__dirname, 'bundle/umd.js'), + name: 'SandDanceExplorer', + formats: ['umd'], + fileName: () => 'sanddance-explorer.js', + }, + outDir: 'dist/umd', + emptyOutDir: true, + sourcemap: false, + minify: false, + rollupOptions: { + external: ['react', 'react-dom'], + output: { + globals: { + 'react': 'React', + 'react-dom': 'ReactDOM', + }, + }, + }, + }, +}); diff --git a/packages/sanddance-react/README.md b/packages/sanddance-react/README.md index 83f1723c8..3b7e56c73 100644 --- a/packages/sanddance-react/README.md +++ b/packages/sanddance-react/README.md @@ -14,7 +14,7 @@ Add these to the `dependencies` section of your `package.json`, then run `npm in "@msrvida/sanddance-react": "^4", "react": "^17", "react-dom": "^17", -"vega": "^5.32" +"vega": "^6.2" ``` Import these in your JavaScript: diff --git a/packages/sanddance-react/package.json b/packages/sanddance-react/package.json index 25177cad2..013ac15f3 100644 --- a/packages/sanddance-react/package.json +++ b/packages/sanddance-react/package.json @@ -13,7 +13,6 @@ "dist" ], "scripts": { - "uitest": "parcel serve ./test/index.html --open --no-autoinstall --no-cache", "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "deploy": "node ./scripts/deploy.js", "watch-typescript": "tsc -p . -w", @@ -21,9 +20,7 @@ "build-css": "sass ./src/css/sanddance-react.scss ./dist/css/sanddance-react.css", "bundle": "rollup -c", "build:05": "npm run build-typescript && node ../../scripts/version.js && npm run build-css && npm run bundle", - "watch-css": "sass ./src/css/sanddance-react.scss ./dist/css/sanddance-react.css --watch", - "remove-vega": "npm un vega", - "patch-after-vega-upgrade": "npm version patch" + "watch-css": "sass ./src/css/sanddance-react.scss ./dist/css/sanddance-react.css --watch" }, "keywords": [], "author": "", diff --git a/packages/sanddance-specs/README.md b/packages/sanddance-specs/README.md index d145b1a27..e4643cdd8 100644 --- a/packages/sanddance-specs/README.md +++ b/packages/sanddance-specs/README.md @@ -4,7 +4,7 @@ ![image](https://user-images.githubusercontent.com/11507384/82498036-238d5380-9aa4-11ea-85b0-8fcb31522461.png) -[Demo](https://microsoft.github.io/SandDance/tests/sanddance-specs/v1/) +[Demo](https://microsoft.github.io/SandDance/tests/sanddance-specs/v2/) ## Usage diff --git a/packages/sanddance-specs/package.json b/packages/sanddance-specs/package.json index 1eae276e4..af31b8de5 100644 --- a/packages/sanddance-specs/package.json +++ b/packages/sanddance-specs/package.json @@ -1,6 +1,7 @@ { "name": "@msrvida/sanddance-specs", - "version": "1.8.1", + "type": "module", + "version": "2.0.0", "description": "SandDance Vega specification generator.", "main": "dist/es6/index.js", "repository": { @@ -14,25 +15,23 @@ ], "scripts": { "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", - "predocs": "rimraf ../../docs/docs/sanddance-specs/v1", "watch-typescript": "tsc -p . -w", "build-typescript": "tsc -p .", "build:03": "npm run build-typescript && npm run bundle", "bundle": "rollup -c", - "bundle-watch": "rollup -c -w -o ../../docs/tests/sanddance-specs/v1/js/sanddance-specs.js", "deploy": "tsc -p ./uitest/ && node ./scripts/deploy.js", "uitest-watch": "tsc -p ./uitest/ -w", "deploy-watch": "npm-run-all --parallel bundle-watch uitest-watch", "test2": "node -r esm ./test/perf.js", - "remove-vega": "npm un vega vega-typings", + "remove-vega": "npm un vega-typings", "patch-after-vega-upgrade": "npm version patch" }, "author": "", "license": "MIT", "dependencies": { "@msrvida/chart-types": "^1", - "@msrvida/data-inference": "^1", + "@msrvida/data-inference": "^2", "@msrvida/search-expression": "^1", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } } diff --git a/packages/sanddance-specs/scripts/deploy.js b/packages/sanddance-specs/scripts/deploy.js index f2672a32b..a647aee49 100644 --- a/packages/sanddance-specs/scripts/deploy.js +++ b/packages/sanddance-specs/scripts/deploy.js @@ -1,2 +1,2 @@ -const fs = require('fs'); -fs.copyFileSync('./dist/umd/sanddance-specs.js', '../../docs/tests/sanddance-specs/v1/js/sanddance-specs.js'); +import fs from 'fs'; +fs.copyFileSync('./dist/umd/sanddance-specs.js', '../../docs/tests/sanddance-specs/v2/js/sanddance-specs.js'); diff --git a/packages/sanddance-specs/src/axes.ts b/packages/sanddance-specs/src/axes.ts index e9e7c8809..5935a3bd3 100644 --- a/packages/sanddance-specs/src/axes.ts +++ b/packages/sanddance-specs/src/axes.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. */ -import { SignalNames } from './constants'; -import { axesLabelLimit, axesTitleLimit } from './defaults'; -import { GlobalScope } from './globalScope'; -import { AxisScale, AxisScales, GlobalScales } from './interfaces'; -import { addAxes, addScales } from './scope'; -import { SpecColumns, SpecViewOptions } from './types'; +import { SignalNames } from './constants.js'; +import { axesLabelLimit, axesTitleLimit } from './defaults.js'; +import { GlobalScope } from './globalScope.js'; +import { AxisScale, AxisScales, GlobalScales } from './interfaces.js'; +import { addAxes, addScales } from './scope.js'; +import { SpecColumns, SpecViewOptions } from './types.js'; import { Column, View } from '@msrvida/chart-types'; import { Axis, diff --git a/packages/sanddance-specs/src/bin.ts b/packages/sanddance-specs/src/bin.ts index 4a430db79..ce9803830 100644 --- a/packages/sanddance-specs/src/bin.ts +++ b/packages/sanddance-specs/src/bin.ts @@ -3,17 +3,17 @@ * Licensed under the MIT License. */ -import { FieldNames } from './constants'; -import { exprSafeFieldName, safeFieldName } from './expr'; -import { DiscreteColumn } from './interfaces'; +import { FieldNames } from './constants.js'; +import { exprSafeFieldName, safeFieldName } from './expr.js'; +import { DiscreteColumn } from './interfaces.js'; import { BinTransform, Data, Signal, Transforms, } from 'vega-typings'; -import { debounce } from './defaults'; -import { dataExtent } from './transforms'; +import { debounce } from './defaults.js'; +import { dataExtent } from './transforms.js'; import { Column } from '@msrvida/chart-types'; export interface BaseBinnable { diff --git a/packages/sanddance-specs/src/build.ts b/packages/sanddance-specs/src/build.ts index 8b25bba5f..a4de07542 100644 --- a/packages/sanddance-specs/src/build.ts +++ b/packages/sanddance-specs/src/build.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. */ -import { getSpecBuilderPropsForChart } from './charts'; -import { inferAll } from './inference'; -import { SpecContext } from './types'; -import { SpecResult } from './interfaces'; +import { getSpecBuilderPropsForChart } from './charts/index.js'; +import { inferAll } from './inference.js'; +import { SpecContext } from './types.js'; +import { SpecResult } from './interfaces.js'; import { ValuesData } from 'vega-typings'; -import { SpecBuilder } from './specBuilder'; +import { SpecBuilder } from './specBuilder.js'; export function build(specContext: SpecContext, currData: object[]): SpecResult { const { specColumns } = specContext; diff --git a/packages/sanddance-specs/src/charts/barchartH.ts b/packages/sanddance-specs/src/charts/barchartH.ts index 48ba4ad47..2eb36b517 100644 --- a/packages/sanddance-specs/src/charts/barchartH.ts +++ b/packages/sanddance-specs/src/charts/barchartH.ts @@ -3,18 +3,18 @@ * Licensed under the MIT License. */ -import { SignalNames } from '../constants'; -import { defaultBins, maxbins, minBarBandWidth } from '../defaults'; -import { AxisScale, AxisScales } from '../interfaces'; -import { AggregateContainerProps } from '../layouts/aggregateContainer'; -import { BandProps } from '../layouts/band'; -import { LayoutPair } from '../layouts/layout'; -import { SquareProps } from '../layouts/square'; -import { StripProps } from '../layouts/strip'; -import { TreemapProps } from '../layouts/treemap'; -import { allowNoneForSize } from '../size'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; +import { SignalNames } from '../constants.js'; +import { defaultBins, maxbins, minBarBandWidth } from '../defaults.js'; +import { AxisScale, AxisScales } from '../interfaces.js'; +import { AggregateContainerProps } from '../layouts/aggregateContainer.js'; +import { BandProps } from '../layouts/band.js'; +import { LayoutPair } from '../layouts/layout.js'; +import { SquareProps } from '../layouts/square.js'; +import { StripProps } from '../layouts/strip.js'; +import { TreemapProps } from '../layouts/treemap.js'; +import { allowNoneForSize } from '../size.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns, specViewOptions } = specContext; diff --git a/packages/sanddance-specs/src/charts/barchartV.ts b/packages/sanddance-specs/src/charts/barchartV.ts index e301be11a..68d4f5c68 100644 --- a/packages/sanddance-specs/src/charts/barchartV.ts +++ b/packages/sanddance-specs/src/charts/barchartV.ts @@ -3,18 +3,18 @@ * Licensed under the MIT License. */ -import { SignalNames } from '../constants'; -import { defaultBins, maxbins, minBarBandWidth } from '../defaults'; -import { AxisScale, AxisScales } from '../interfaces'; -import { AggregateContainerProps } from '../layouts/aggregateContainer'; -import { BandProps } from '../layouts/band'; -import { LayoutPair } from '../layouts/layout'; -import { SquareProps } from '../layouts/square'; -import { StripProps } from '../layouts/strip'; -import { TreemapProps } from '../layouts/treemap'; -import { allowNoneForSize } from '../size'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; +import { SignalNames } from '../constants.js'; +import { defaultBins, maxbins, minBarBandWidth } from '../defaults.js'; +import { AxisScale, AxisScales } from '../interfaces.js'; +import { AggregateContainerProps } from '../layouts/aggregateContainer.js'; +import { BandProps } from '../layouts/band.js'; +import { LayoutPair } from '../layouts/layout.js'; +import { SquareProps } from '../layouts/square.js'; +import { StripProps } from '../layouts/strip.js'; +import { TreemapProps } from '../layouts/treemap.js'; +import { allowNoneForSize } from '../size.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns, specViewOptions } = specContext; diff --git a/packages/sanddance-specs/src/charts/density.ts b/packages/sanddance-specs/src/charts/density.ts index 0a8e8074f..8cdf314a9 100644 --- a/packages/sanddance-specs/src/charts/density.ts +++ b/packages/sanddance-specs/src/charts/density.ts @@ -3,18 +3,18 @@ * Licensed under the MIT License. */ -import { SignalNames } from '../constants'; -import { defaultBins, maxbins, minBarBandWidth } from '../defaults'; -import { AxisScales } from '../interfaces'; -import { AggregateSquareProps } from '../layouts/aggregateSquare'; -import { BandProps } from '../layouts/band'; -import { LayoutPair } from '../layouts/layout'; -import { SquareProps } from '../layouts/square'; -import { StripProps } from '../layouts/strip'; -import { TreemapProps } from '../layouts/treemap'; -import { allowNoneForSize } from '../size'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; +import { SignalNames } from '../constants.js'; +import { defaultBins, maxbins, minBarBandWidth } from '../defaults.js'; +import { AxisScales } from '../interfaces.js'; +import { AggregateSquareProps } from '../layouts/aggregateSquare.js'; +import { BandProps } from '../layouts/band.js'; +import { LayoutPair } from '../layouts/layout.js'; +import { SquareProps } from '../layouts/square.js'; +import { StripProps } from '../layouts/strip.js'; +import { TreemapProps } from '../layouts/treemap.js'; +import { allowNoneForSize } from '../size.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns, specViewOptions } = specContext; diff --git a/packages/sanddance-specs/src/charts/grid.ts b/packages/sanddance-specs/src/charts/grid.ts index 7fecf16a9..a11075953 100644 --- a/packages/sanddance-specs/src/charts/grid.ts +++ b/packages/sanddance-specs/src/charts/grid.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. */ -import { AxisScales } from '../interfaces'; -import { SignalNames } from '../constants'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; -import { SquareProps } from '../layouts/square'; +import { AxisScales } from '../interfaces.js'; +import { SignalNames } from '../constants.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; +import { SquareProps } from '../layouts/square.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns } = specContext; diff --git a/packages/sanddance-specs/src/charts/index.ts b/packages/sanddance-specs/src/charts/index.ts index eb98966d4..b7d52a8c0 100644 --- a/packages/sanddance-specs/src/charts/index.ts +++ b/packages/sanddance-specs/src/charts/index.ts @@ -3,20 +3,20 @@ * Licensed under the MIT License. */ -import barchartH from './barchartH'; -import barchartV from './barchartV'; -import density from './density'; -import grid from './grid'; -import scatterplot from './scatterplot'; -import stacks from './stacks'; -import strips from './strips'; -import treemap from './treemap'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; -import { getFacetLayout } from '../facetLayout'; -import { DiscreteColumn } from '../interfaces'; -import { SignalNames } from '../constants'; -import { defaultBins, maxbins } from '../defaults'; +import barchartH from './barchartH.js'; +import barchartV from './barchartV.js'; +import density from './density.js'; +import grid from './grid.js'; +import scatterplot from './scatterplot.js'; +import stacks from './stacks.js'; +import strips from './strips.js'; +import treemap from './treemap.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; +import { getFacetLayout } from '../facetLayout.js'; +import { DiscreteColumn } from '../interfaces.js'; +import { SignalNames } from '../constants.js'; +import { defaultBins, maxbins } from '../defaults.js'; const map: { [chart: string]: (specContext: SpecContext) => SpecBuilderProps } = { barchart: barchartV, diff --git a/packages/sanddance-specs/src/charts/scatterplot.ts b/packages/sanddance-specs/src/charts/scatterplot.ts index e49ff2974..378bfaa39 100644 --- a/packages/sanddance-specs/src/charts/scatterplot.ts +++ b/packages/sanddance-specs/src/charts/scatterplot.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. */ -import { AxisScales } from '../interfaces'; -import { ScatterProps } from '../layouts/scatter'; -import { SignalNames } from '../constants'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; +import { AxisScales } from '../interfaces.js'; +import { ScatterProps } from '../layouts/scatter.js'; +import { SignalNames } from '../constants.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns, specViewOptions } = specContext; diff --git a/packages/sanddance-specs/src/charts/stacks.ts b/packages/sanddance-specs/src/charts/stacks.ts index cc23f305f..a1e1de053 100644 --- a/packages/sanddance-specs/src/charts/stacks.ts +++ b/packages/sanddance-specs/src/charts/stacks.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. */ -import { AxisScales } from '../interfaces'; -import { BandProps } from '../layouts/band'; -import { defaultBins, maxbins, minBarBandWidth } from '../defaults'; -import { SignalNames } from '../constants'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; -import { StackProps } from '../layouts/stack'; +import { AxisScales } from '../interfaces.js'; +import { BandProps } from '../layouts/band.js'; +import { defaultBins, maxbins, minBarBandWidth } from '../defaults.js'; +import { SignalNames } from '../constants.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; +import { StackProps } from '../layouts/stack.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns, specViewOptions } = specContext; diff --git a/packages/sanddance-specs/src/charts/strips.ts b/packages/sanddance-specs/src/charts/strips.ts index f0747d817..6ab1c96bc 100644 --- a/packages/sanddance-specs/src/charts/strips.ts +++ b/packages/sanddance-specs/src/charts/strips.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. */ -import { AggregateContainerProps } from '../layouts/aggregateContainer'; -import { AxisScales } from '../interfaces'; -import { LayoutPair } from '../layouts/layout'; -import { SignalNames } from '../constants'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; -import { StripProps } from '../layouts/strip'; +import { AggregateContainerProps } from '../layouts/aggregateContainer.js'; +import { AxisScales } from '../interfaces.js'; +import { LayoutPair } from '../layouts/layout.js'; +import { SignalNames } from '../constants.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; +import { StripProps } from '../layouts/strip.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns } = specContext; diff --git a/packages/sanddance-specs/src/charts/treemap.ts b/packages/sanddance-specs/src/charts/treemap.ts index b17c79688..29af04cae 100644 --- a/packages/sanddance-specs/src/charts/treemap.ts +++ b/packages/sanddance-specs/src/charts/treemap.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. */ -import { AxisScales } from '../interfaces'; -import { SignalNames } from '../constants'; -import { SpecBuilderProps } from '../specBuilder'; -import { SpecContext } from '../types'; -import { TreemapProps } from '../layouts/treemap'; -import { LayoutPair } from '../layouts/layout'; -import { AggregateContainerProps } from '../layouts/aggregateContainer'; +import { AxisScales } from '../interfaces.js'; +import { SignalNames } from '../constants.js'; +import { SpecBuilderProps } from '../specBuilder.js'; +import { SpecContext } from '../types.js'; +import { TreemapProps } from '../layouts/treemap.js'; +import { LayoutPair } from '../layouts/layout.js'; +import { AggregateContainerProps } from '../layouts/aggregateContainer.js'; export default function (specContext: SpecContext): SpecBuilderProps { const { insight, specColumns, specViewOptions } = specContext; diff --git a/packages/sanddance-specs/src/color.ts b/packages/sanddance-specs/src/color.ts index 3f973d00f..5ee0ebe8f 100644 --- a/packages/sanddance-specs/src/color.ts +++ b/packages/sanddance-specs/src/color.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. */ -import { addData, addScales, addSignals } from './scope'; -import { binnableColorScale } from './scales'; -import { colorBinCountSignal, colorReverseSignal } from './signals'; -import { ColorScaleNone, FieldNames } from './constants'; -import { getLegends } from './legends'; +import { addData, addScales, addSignals } from './scope.js'; +import { binnableColorScale } from './scales.js'; +import { colorBinCountSignal, colorReverseSignal } from './signals.js'; +import { ColorScaleNone, FieldNames } from './constants.js'; +import { getLegends } from './legends.js'; import { Scope } from 'vega-typings'; -import { SpecContext } from './types'; -import { topLookup } from './top'; +import { SpecContext } from './types.js'; +import { topLookup } from './top.js'; export interface Props { scope: Scope; diff --git a/packages/sanddance-specs/src/facetLayout.ts b/packages/sanddance-specs/src/facetLayout.ts index 08b001bb8..2da7626d1 100644 --- a/packages/sanddance-specs/src/facetLayout.ts +++ b/packages/sanddance-specs/src/facetLayout.ts @@ -3,17 +3,17 @@ * Licensed under the MIT License. */ -import { CrossProps } from './layouts/cross'; -import { DiscreteColumn } from './interfaces'; +import { CrossProps } from './layouts/cross.js'; +import { DiscreteColumn } from './interfaces.js'; import { facetPaddingBottom, facetPaddingLeft, facetPaddingRight, facetPaddingTop, -} from './defaults'; -import { FacetStyle } from './types'; -import { LayoutPair } from './layouts/layout'; -import { WrapProps } from './layouts/wrap'; +} from './defaults.js'; +import { FacetStyle } from './types.js'; +import { LayoutPair } from './layouts/layout.js'; +import { WrapProps } from './layouts/wrap.js'; export interface PlotPadding { x: number; diff --git a/packages/sanddance-specs/src/facetSearch.ts b/packages/sanddance-specs/src/facetSearch.ts index af638317e..68b1a5f9a 100644 --- a/packages/sanddance-specs/src/facetSearch.ts +++ b/packages/sanddance-specs/src/facetSearch.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { Binnable } from './bin'; +import { Binnable } from './bin.js'; export function displayBin(bin: Binnable) { const val = (index: number) => `datum[${JSON.stringify(bin.fields[index])}]`; diff --git a/packages/sanddance-specs/src/facetTitle.ts b/packages/sanddance-specs/src/facetTitle.ts index aa0041d92..3912b1654 100644 --- a/packages/sanddance-specs/src/facetTitle.ts +++ b/packages/sanddance-specs/src/facetTitle.ts @@ -3,16 +3,16 @@ * Licensed under the MIT License. */ -import { addData, addMarks, addScales } from './scope'; -import { AxesScopeMap } from './axes'; +import { addData, addMarks, addScales } from './scope.js'; +import { AxesScopeMap } from './axes.js'; import { Data, GroupMark, Scale, Scope, } from 'vega-typings'; -import { FieldNames, SignalNames } from './constants'; -import { InnerScope, SizeSignals, TitleSource } from './interfaces'; +import { FieldNames, SignalNames } from './constants.js'; +import { InnerScope, SizeSignals, TitleSource } from './interfaces.js'; export function addFacetColRowTitles(globalScope: Scope, colTitleSource: TitleSource, rowTitleSource: TitleSource, sizeSignals: SizeSignals, axisTextColor: string) { const titleSignal = `parent[${JSON.stringify(FieldNames.FacetTitle)}]`; diff --git a/packages/sanddance-specs/src/fill.ts b/packages/sanddance-specs/src/fill.ts index 06bdc52cc..047c9ea62 100644 --- a/packages/sanddance-specs/src/fill.ts +++ b/packages/sanddance-specs/src/fill.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -import { SignalNames } from './constants'; -import { safeFieldName } from './expr'; -import { SpecContext } from './types'; +import { SignalNames } from './constants.js'; +import { safeFieldName } from './expr.js'; +import { SpecContext } from './types.js'; import { ColorValueRef, NumericValueRef, ProductionRule } from 'vega-typings'; export function fill(context: SpecContext, colorFieldName: string, scale: string): ProductionRule { diff --git a/packages/sanddance-specs/src/globalScope.ts b/packages/sanddance-specs/src/globalScope.ts index 73e023d3c..2aebf5bb2 100644 --- a/packages/sanddance-specs/src/globalScope.ts +++ b/packages/sanddance-specs/src/globalScope.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. */ -import { SignalNames } from './constants'; -import { InnerScope } from './interfaces'; -import { LayoutOffsets, SizeSignals } from './interfaces'; -import { getDataByName } from './scope'; +import { SignalNames } from './constants.js'; +import { InnerScope } from './interfaces.js'; +import { LayoutOffsets, SizeSignals } from './interfaces.js'; +import { getDataByName } from './scope.js'; import { Data, GroupMark, diff --git a/packages/sanddance-specs/src/image.ts b/packages/sanddance-specs/src/image.ts index 6d4c77dd3..860165597 100644 --- a/packages/sanddance-specs/src/image.ts +++ b/packages/sanddance-specs/src/image.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. */ -import { BackgroundImage } from './types'; +import { BackgroundImage } from './types.js'; import { ImageMark } from 'vega-typings/types'; -import { GlobalScales } from './interfaces'; -import { bandScaleLinearSuffix } from './layouts/band'; +import { GlobalScales } from './interfaces.js'; +import { bandScaleLinearSuffix } from './layouts/band.js'; export function getImageMark(backgroundImage: BackgroundImage, allGlobalScales: GlobalScales[]): ImageMark { const xScale = allGlobalScales.filter(s => s.scales.x)[0].scales.x[0]; diff --git a/packages/sanddance-specs/src/index.ts b/packages/sanddance-specs/src/index.ts index 214fa04fd..fc3f5202f 100644 --- a/packages/sanddance-specs/src/index.ts +++ b/packages/sanddance-specs/src/index.ts @@ -3,8 +3,9 @@ * Licensed under the MIT License. */ -export * from './build'; -export * from './constants'; -export * from './inference'; -export * from './interfaces'; -export * from './types'; +export * from './build.js'; +export * from './constants.js'; +export * from './inference.js'; +export * from './insight.js'; +export * from './interfaces.js'; +export * from './types.js'; diff --git a/packages/sanddance-specs/src/inference.ts b/packages/sanddance-specs/src/inference.ts index 8b281e29b..c8a7c3616 100644 --- a/packages/sanddance-specs/src/inference.ts +++ b/packages/sanddance-specs/src/inference.ts @@ -4,7 +4,8 @@ */ import { Column } from '@msrvida/chart-types'; -import { Insight, SpecColumns } from './types'; +import { SpecColumns } from './types.js'; +import { Insight } from './insight.js'; export { getColumnsFromData, getStats, inferAll } from '@msrvida/data-inference'; diff --git a/packages/sanddance-specs/src/insight.ts b/packages/sanddance-specs/src/insight.ts new file mode 100644 index 000000000..ab213f291 --- /dev/null +++ b/packages/sanddance-specs/src/insight.ts @@ -0,0 +1,73 @@ +/*! +* Copyright (c) Microsoft Corporation. +* Licensed under the MIT License. +*/ + +import { Size, View } from '@msrvida/chart-types'; +import { Search } from '@msrvida/search-expression'; +import { Transforms } from 'vega-typings'; +import { BackgroundImage, Chart, ColorBin, FacetStyle, SignalValues, TotalStyle } from './types'; + +/** + * Options to designate a SandDance visualization. + */ +export interface Insight { + backgroundImage?: BackgroundImage; + chart: Chart; + size: Size; + columns: InsightColumns; + view?: View; + filter?: Search; + facetStyle?: FacetStyle; + totalStyle?: TotalStyle; + + /** + * Type of color binning to use on color scale. Only applicable when the column in the color role is quantitative. + */ + colorBin?: ColorBin; + + /** + * Name of the color scheme. See https://vega.github.io/vega/docs/schemes/ + */ + scheme?: string; + + /** + * Vega signal values for this insight. + */ + signalValues?: SignalValues; + + /** + * Optional flag to hide axes. + */ + hideAxes?: boolean; + + /** + * Optional flag to hide legend. + */ + hideLegend?: boolean; + + /** + * Optional flag to use CSS colors directly from data. + */ + directColor?: boolean; + + /** + * Optional array of Vega transforms to apply to the data. + */ + transform?: Transforms[]; +} + +export type InsightColumnRoles = 'uid' | 'x' | 'y' | 'z' | 'group' | 'size' | 'color' | 'facet' | 'facetV' | 'sort'; + +export interface InsightColumns { + uid?: string; + x?: string; + y?: string; + z?: string; + group?: string; + size?: string; + color?: string; + sort?: string; + facet?: string; + facetV?: string; +} diff --git a/packages/sanddance-specs/src/interfaces.ts b/packages/sanddance-specs/src/interfaces.ts index 6265ddf21..01c36cea8 100644 --- a/packages/sanddance-specs/src/interfaces.ts +++ b/packages/sanddance-specs/src/interfaces.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { SpecCapabilities, SpecContext } from './types'; +import { SpecCapabilities, SpecContext } from './types.js'; import { Column } from '@msrvida/chart-types'; import { AggregateOp, diff --git a/packages/sanddance-specs/src/layouts/aggregateContainer.ts b/packages/sanddance-specs/src/layouts/aggregateContainer.ts index 440ff583e..ffc334093 100644 --- a/packages/sanddance-specs/src/layouts/aggregateContainer.ts +++ b/packages/sanddance-specs/src/layouts/aggregateContainer.ts @@ -3,22 +3,22 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { FieldNames } from '../constants'; -import { safeFieldName } from '../expr'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { FieldNames } from '../constants.js'; +import { safeFieldName } from '../expr.js'; import { AxisScale, FieldOp, InnerScope, LayoutOffsets, -} from '../interfaces'; +} from '../interfaces.js'; import { addOffsets, addSignals, addTransforms, getGroupBy, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; import { Column } from '@msrvida/chart-types'; import { JoinAggregateTransform, LinearScale } from 'vega-typings'; diff --git a/packages/sanddance-specs/src/layouts/aggregateSquare.ts b/packages/sanddance-specs/src/layouts/aggregateSquare.ts index 4adb3ee01..35055f630 100644 --- a/packages/sanddance-specs/src/layouts/aggregateSquare.ts +++ b/packages/sanddance-specs/src/layouts/aggregateSquare.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { safeFieldName } from '../expr'; -import { InnerScope, LayoutOffsets } from '../interfaces'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { safeFieldName } from '../expr.js'; +import { InnerScope, LayoutOffsets } from '../interfaces.js'; import { addOffsets, addTransforms, getGroupBy, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; import { Column } from '@msrvida/chart-types'; import { JoinAggregateTransform } from 'vega-typings'; diff --git a/packages/sanddance-specs/src/layouts/band.ts b/packages/sanddance-specs/src/layouts/band.ts index b2d23f55d..0672575c3 100644 --- a/packages/sanddance-specs/src/layouts/band.ts +++ b/packages/sanddance-specs/src/layouts/band.ts @@ -3,27 +3,27 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { binnable, Binnable } from '../bin'; -import { safeFieldName } from '../expr'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { binnable, Binnable } from '../bin.js'; +import { safeFieldName } from '../expr.js'; import { DiscreteColumn, EncodingRule, InnerScope, LayoutOffsets, Orientation, -} from '../interfaces'; +} from '../interfaces.js'; import { addData, addOffsets, addScales, addSignals, addTransforms, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; -import { modifySignal } from '../signals'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; +import { modifySignal } from '../signals.js'; import { BandScale, RangeRawArray } from 'vega-typings'; -import { linearScale } from '../scales'; +import { linearScale } from '../scales.js'; export const bandScaleLinearSuffix = '_linear'; diff --git a/packages/sanddance-specs/src/layouts/cross.ts b/packages/sanddance-specs/src/layouts/cross.ts index fa03f5404..5732d45ff 100644 --- a/packages/sanddance-specs/src/layouts/cross.ts +++ b/packages/sanddance-specs/src/layouts/cross.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { Binnable, binnable } from '../bin'; -import { FieldNames, SignalNames } from '../constants'; -import { displayBin, serializeAsVegaExpression } from '../facetSearch'; -import { addFacetColRowTitles } from '../facetTitle'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { Binnable, binnable } from '../bin.js'; +import { FieldNames, SignalNames } from '../constants.js'; +import { displayBin, serializeAsVegaExpression } from '../facetSearch.js'; +import { addFacetColRowTitles } from '../facetTitle.js'; import { DiscreteColumn, InnerScope, @@ -15,16 +15,16 @@ import { SizeSignals, Titles, TitleSource, -} from '../interfaces'; -import { createOrdinals, ordinalScale } from '../ordinal'; +} from '../interfaces.js'; +import { createOrdinals, ordinalScale } from '../ordinal.js'; import { addData, addMarks, addScales, addSignals, addTransforms, -} from '../scope'; -import { modifySignal } from '../signals'; +} from '../scope.js'; +import { modifySignal } from '../signals.js'; import { Data, GroupMark, diff --git a/packages/sanddance-specs/src/layouts/index.ts b/packages/sanddance-specs/src/layouts/index.ts index 8c72aaa07..49b4ace70 100644 --- a/packages/sanddance-specs/src/layouts/index.ts +++ b/packages/sanddance-specs/src/layouts/index.ts @@ -3,17 +3,17 @@ * Licensed under the MIT License. */ -import { AggregateContainer } from './aggregateContainer'; -import { AggregateSquare } from './aggregateSquare'; -import { Band } from './band'; -import { Cross } from './cross'; -import { Layout } from './layout'; -import { Scatter } from './scatter'; -import { Square } from './square'; -import { Stack } from './stack'; -import { Strip } from './strip'; -import { Treemap } from './treemap'; -import { Wrap } from './wrap'; +import { AggregateContainer } from './aggregateContainer.js'; +import { AggregateSquare } from './aggregateSquare.js'; +import { Band } from './band.js'; +import { Cross } from './cross.js'; +import { Layout } from './layout.js'; +import { Scatter } from './scatter.js'; +import { Square } from './square.js'; +import { Stack } from './stack.js'; +import { Strip } from './strip.js'; +import { Treemap } from './treemap.js'; +import { Wrap } from './wrap.js'; export type LayoutType = 'AggregateContainer' | diff --git a/packages/sanddance-specs/src/layouts/layout.ts b/packages/sanddance-specs/src/layouts/layout.ts index 0ae2482e6..5484aedba 100644 --- a/packages/sanddance-specs/src/layouts/layout.ts +++ b/packages/sanddance-specs/src/layouts/layout.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. */ -import { LayoutType } from './index'; -import { GlobalScope } from '../globalScope'; +import { LayoutType } from './index.js'; +import { GlobalScope } from '../globalScope.js'; import { AxisScales, FieldOp, Grouping, InnerScope, -} from '../interfaces'; +} from '../interfaces.js'; export interface LayoutProps { } diff --git a/packages/sanddance-specs/src/layouts/scatter.ts b/packages/sanddance-specs/src/layouts/scatter.ts index d2099e4af..8e7ca0545 100644 --- a/packages/sanddance-specs/src/layouts/scatter.ts +++ b/packages/sanddance-specs/src/layouts/scatter.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { SignalNames } from '../constants'; -import { debounce, scatterSizedDiv } from '../defaults'; -import { safeFieldName } from '../expr'; -import { GlobalScales, InnerScope } from '../interfaces'; -import { linearScale, pointScale } from '../scales'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { SignalNames } from '../constants.js'; +import { debounce, scatterSizedDiv } from '../defaults.js'; +import { safeFieldName } from '../expr.js'; +import { GlobalScales, InnerScope } from '../interfaces.js'; +import { linearScale, pointScale } from '../scales.js'; import { addData, addMarks, @@ -16,8 +16,8 @@ import { addScales, addSignals, addTransforms, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; import { Column, Dimension3D, View } from '@msrvida/chart-types'; import { RectEncodeEntry, @@ -27,9 +27,9 @@ import { SignalRef, Transforms, } from 'vega-typings'; -import { Extents } from '../types'; -import { dataExtent } from '../transforms'; -import { outerExtentSignal, shouldBeIntegralBinStep } from '../bin'; +import { Extents } from '../types.js'; +import { dataExtent } from '../transforms.js'; +import { outerExtentSignal, shouldBeIntegralBinStep } from '../bin.js'; export interface ScatterProps extends LayoutProps { x: Column; diff --git a/packages/sanddance-specs/src/layouts/square.ts b/packages/sanddance-specs/src/layouts/square.ts index 085d095e0..cfa8373e0 100644 --- a/packages/sanddance-specs/src/layouts/square.ts +++ b/packages/sanddance-specs/src/layouts/square.ts @@ -3,18 +3,18 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { FieldNames } from '../constants'; -import { safeFieldName } from '../expr'; -import { InnerScope } from '../interfaces'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { FieldNames } from '../constants.js'; +import { safeFieldName } from '../expr.js'; +import { InnerScope } from '../interfaces.js'; import { addMarks, addOffsets, addTransforms, getGroupBy, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; -import { addZScale } from '../zBase'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; +import { addZScale } from '../zBase.js'; import { Column, View } from '@msrvida/chart-types'; import { FormulaTransform, RectMark } from 'vega-typings'; diff --git a/packages/sanddance-specs/src/layouts/stack.ts b/packages/sanddance-specs/src/layouts/stack.ts index cf7fd2ad9..a04ec2af2 100644 --- a/packages/sanddance-specs/src/layouts/stack.ts +++ b/packages/sanddance-specs/src/layouts/stack.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { safeFieldName } from '../expr'; -import { InnerScope, LayoutOffsets } from '../interfaces'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { safeFieldName } from '../expr.js'; +import { InnerScope, LayoutOffsets } from '../interfaces.js'; import { addData, addMarks, @@ -13,8 +13,8 @@ import { addSignals, addTransforms, getGroupBy, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; import { Column } from '@msrvida/chart-types'; import { LinearScale, RectMark } from 'vega-typings'; diff --git a/packages/sanddance-specs/src/layouts/strip.ts b/packages/sanddance-specs/src/layouts/strip.ts index 5a28b447d..bfce02f1e 100644 --- a/packages/sanddance-specs/src/layouts/strip.ts +++ b/packages/sanddance-specs/src/layouts/strip.ts @@ -3,18 +3,18 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { FieldNames } from '../constants'; -import { safeFieldName } from '../expr'; -import { InnerScope, LayoutOffsets, Orientation } from '../interfaces'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { FieldNames } from '../constants.js'; +import { safeFieldName } from '../expr.js'; +import { InnerScope, LayoutOffsets, Orientation } from '../interfaces.js'; import { addMarks, addOffsets, addTransforms, getGroupBy, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; -import { addZScale } from '../zBase'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; +import { addZScale } from '../zBase.js'; import { Column, View } from '@msrvida/chart-types'; import { LinearScale, diff --git a/packages/sanddance-specs/src/layouts/treemap.ts b/packages/sanddance-specs/src/layouts/treemap.ts index ec61acf44..a8e3e2220 100644 --- a/packages/sanddance-specs/src/layouts/treemap.ts +++ b/packages/sanddance-specs/src/layouts/treemap.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { SignalNames } from '../constants'; -import { safeFieldName } from '../expr'; -import { InnerScope, LayoutOffsets } from '../interfaces'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { SignalNames } from '../constants.js'; +import { safeFieldName } from '../expr.js'; +import { InnerScope, LayoutOffsets } from '../interfaces.js'; import { addData, addMarks, @@ -14,9 +14,9 @@ import { addSignals, addTransforms, getGroupBy, -} from '../scope'; -import { testForCollapseSelection } from '../selection'; -import { addZScale } from '../zBase'; +} from '../scope.js'; +import { testForCollapseSelection } from '../selection.js'; +import { addZScale } from '../zBase.js'; import { Column, View } from '@msrvida/chart-types'; import { Data, diff --git a/packages/sanddance-specs/src/layouts/wrap.ts b/packages/sanddance-specs/src/layouts/wrap.ts index a496df462..6c86aaae5 100644 --- a/packages/sanddance-specs/src/layouts/wrap.ts +++ b/packages/sanddance-specs/src/layouts/wrap.ts @@ -3,27 +3,27 @@ * Licensed under the MIT License. */ -import { Layout, LayoutBuildProps, LayoutProps } from './layout'; -import { binnable, Binnable } from '../bin'; -import { FieldNames, SignalNames } from '../constants'; -import { safeFieldName } from '../expr'; -import { displayBin, serializeAsVegaExpression } from '../facetSearch'; -import { addFacetCellTitles } from '../facetTitle'; +import { Layout, LayoutBuildProps, LayoutProps } from './layout.js'; +import { binnable, Binnable } from '../bin.js'; +import { FieldNames, SignalNames } from '../constants.js'; +import { safeFieldName } from '../expr.js'; +import { displayBin, serializeAsVegaExpression } from '../facetSearch.js'; +import { addFacetCellTitles } from '../facetTitle.js'; import { DiscreteColumn, InnerScope, LayoutOffsets, SizeSignals, -} from '../interfaces'; -import { createOrdinals } from '../ordinal'; +} from '../interfaces.js'; +import { createOrdinals } from '../ordinal.js'; import { addData, addMarks, addOffsets, addSignals, addTransforms, -} from '../scope'; -import { modifySignal } from '../signals'; +} from '../scope.js'; +import { modifySignal } from '../signals.js'; import { Data, GroupEncodeEntry, GroupMark } from 'vega-typings'; export interface WrapProps extends LayoutProps { diff --git a/packages/sanddance-specs/src/legends.ts b/packages/sanddance-specs/src/legends.ts index b8e45f717..676eea97e 100644 --- a/packages/sanddance-specs/src/legends.ts +++ b/packages/sanddance-specs/src/legends.ts @@ -4,7 +4,7 @@ */ import { Column } from '@msrvida/chart-types'; -import { SpecContext } from './types'; +import { SpecContext } from './types.js'; import { Legend } from 'vega-typings'; function legend(column: Column, fill: string) { diff --git a/packages/sanddance-specs/src/ordinal.ts b/packages/sanddance-specs/src/ordinal.ts index 0eed9b020..5a4743464 100644 --- a/packages/sanddance-specs/src/ordinal.ts +++ b/packages/sanddance-specs/src/ordinal.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. */ -import { FieldNames } from './constants'; -import { safeFieldName } from './expr'; +import { FieldNames } from './constants.js'; +import { safeFieldName } from './expr.js'; import { Data, OrdinalScale, SortOrder } from 'vega-typings'; export interface OrdinalResult { diff --git a/packages/sanddance-specs/src/scales.ts b/packages/sanddance-specs/src/scales.ts index 7b362b114..024f8b2f7 100644 --- a/packages/sanddance-specs/src/scales.ts +++ b/packages/sanddance-specs/src/scales.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -import { ColorScaleNone, SignalNames } from './constants'; -import { safeFieldName } from './expr'; -import { ColorBin } from './types'; +import { ColorScaleNone, SignalNames } from './constants.js'; +import { safeFieldName } from './expr.js'; +import { ColorBin } from './types.js'; import { LinearScale, PointScale, diff --git a/packages/sanddance-specs/src/scope.ts b/packages/sanddance-specs/src/scope.ts index 625455db4..c65713310 100644 --- a/packages/sanddance-specs/src/scope.ts +++ b/packages/sanddance-specs/src/scope.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { Grouping } from './interfaces'; +import { Grouping } from './interfaces.js'; import { Axis, Data, diff --git a/packages/sanddance-specs/src/selection.ts b/packages/sanddance-specs/src/selection.ts index 306b6d45b..06f16b49c 100644 --- a/packages/sanddance-specs/src/selection.ts +++ b/packages/sanddance-specs/src/selection.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { FieldNames } from './constants'; +import { FieldNames } from './constants.js'; export function testForCollapseSelection() { return `datum.${FieldNames.Collapsed}`; diff --git a/packages/sanddance-specs/src/signals.ts b/packages/sanddance-specs/src/signals.ts index 801ba70d0..3e50ff15e 100644 --- a/packages/sanddance-specs/src/signals.ts +++ b/packages/sanddance-specs/src/signals.ts @@ -4,9 +4,9 @@ */ import { NewSignal } from 'vega-typings/types'; -import { SignalNames } from './constants'; -import { debounce } from './defaults'; -import { SpecContext } from './types'; +import { SignalNames } from './constants.js'; +import { debounce } from './defaults.js'; +import { SpecContext } from './types.js'; export const defaultZProportion = 0.6; diff --git a/packages/sanddance-specs/src/size.ts b/packages/sanddance-specs/src/size.ts index 170c76d01..9e5c0e638 100644 --- a/packages/sanddance-specs/src/size.ts +++ b/packages/sanddance-specs/src/size.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. */ -import { SpecContext } from './types'; +import { SpecContext } from './types.js'; export function allowNoneForSize(specContext: SpecContext) { switch (specContext.insight.totalStyle) { diff --git a/packages/sanddance-specs/src/specBuilder.ts b/packages/sanddance-specs/src/specBuilder.ts index e43559f31..e56a971a8 100644 --- a/packages/sanddance-specs/src/specBuilder.ts +++ b/packages/sanddance-specs/src/specBuilder.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. */ -import { addGlobalAxes, AxesScopeMap } from './axes'; -import { addColor } from './color'; -import { FieldNames, ScaleNames, SignalNames } from './constants'; +import { addGlobalAxes, AxesScopeMap } from './axes.js'; +import { addColor } from './color.js'; +import { FieldNames, ScaleNames, SignalNames } from './constants.js'; import { axesOffsetX, axesOffsetY, @@ -15,12 +15,12 @@ import { axesTitlePaddingY, facetPaddingBottom, facetPaddingLeft, -} from './defaults'; -import { minFacetHeight, minFacetWidth } from './defaults'; -import { FacetLayout } from './facetLayout'; -import { addFacetAxesGroupMarks } from './facetTitle'; -import { fill, opacity } from './fill'; -import { GlobalScope, GlobalSignals } from './globalScope'; +} from './defaults.js'; +import { minFacetHeight, minFacetWidth } from './defaults.js'; +import { FacetLayout } from './facetLayout.js'; +import { addFacetAxesGroupMarks } from './facetTitle.js'; +import { fill, opacity } from './fill.js'; +import { GlobalScope, GlobalSignals } from './globalScope.js'; import { AxisScales, EncodingRule, @@ -28,21 +28,21 @@ import { Grouping, InnerScope, SpecResult, -} from './interfaces'; -import { LayoutBuildProps, LayoutPair, LayoutProps } from './layouts/layout'; +} from './interfaces.js'; +import { LayoutBuildProps, LayoutPair, LayoutProps } from './layouts/layout.js'; import { addData, addSignals, -} from './scope'; -import { textSignals } from './signals'; -import { SpecCapabilities, SpecContext } from './types'; +} from './scope.js'; +import { textSignals } from './signals.js'; +import { SpecCapabilities, SpecContext } from './types.js'; import { GroupMark, LinearScale, Spec, } from 'vega-typings'; -import { layoutClasses } from './layouts/index'; -import { getImageMark } from './image'; +import { layoutClasses } from './layouts/index.js'; +import { getImageMark } from './image.js'; export interface SpecBuilderProps { axisScales?: AxisScales; diff --git a/packages/sanddance-specs/src/top.ts b/packages/sanddance-specs/src/top.ts index b37cb6ea7..2a2e5c36c 100644 --- a/packages/sanddance-specs/src/top.ts +++ b/packages/sanddance-specs/src/top.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. */ -import { Other } from './constants'; -import { safeFieldName } from './expr'; +import { Other } from './constants.js'; +import { safeFieldName } from './expr.js'; import { Column } from '@msrvida/chart-types'; import { Data } from 'vega-typings'; diff --git a/packages/sanddance-specs/src/transforms.ts b/packages/sanddance-specs/src/transforms.ts index 052558cb5..b85a64956 100644 --- a/packages/sanddance-specs/src/transforms.ts +++ b/packages/sanddance-specs/src/transforms.ts @@ -5,7 +5,7 @@ import { Column } from '@msrvida/chart-types'; import { ExtentTransform } from 'vega-typings'; -import { safeFieldName } from './expr'; +import { safeFieldName } from './expr.js'; export function dataExtent(column: Column, signal: string): ExtentTransform { return { diff --git a/packages/sanddance-specs/src/types.ts b/packages/sanddance-specs/src/types.ts index b195f0577..771b455e3 100644 --- a/packages/sanddance-specs/src/types.ts +++ b/packages/sanddance-specs/src/types.ts @@ -3,9 +3,8 @@ * Licensed under the MIT License. */ -import { Column, Size, View } from '@msrvida/chart-types'; -import { Search } from '@msrvida/search-expression'; -import { Transforms } from 'vega-typings'; +import { Column, Size } from '@msrvida/chart-types'; +import { Insight, InsightColumnRoles } from './insight'; /** * Deprecated - use @msrvida/chart-types instead. @@ -63,70 +62,6 @@ export interface BackgroundImage { extents?: Extents; } -/** - * Options to designate a SandDance visualization. - */ -export interface Insight { - backgroundImage?: BackgroundImage; - chart: Chart; - size: Size; - columns: InsightColumns; - view?: View; - filter?: Search; - facetStyle?: FacetStyle; - totalStyle?: TotalStyle; - - /** - * Type of color binning to use on color scale. Only applicable when the column in the color role is quantitative. - */ - colorBin?: ColorBin; - - /** - * Name of the color scheme. See https://vega.github.io/vega/docs/schemes/ - */ - scheme?: string; - - /** - * Vega signal values for this insight. - */ - signalValues?: SignalValues; - - /** - * Optional flag to hide axes. - */ - hideAxes?: boolean; - - /** - * Optional flag to hide legend. - */ - hideLegend?: boolean; - - /** - * Optional flag to use CSS colors directly from data. - */ - directColor?: boolean; - - /** - * Optional array of Vega transforms to apply to the data. - */ - transform?: Transforms[]; -} - -export type InsightColumnRoles = 'uid' | 'x' | 'y' | 'z' | 'group' | 'size' | 'color' | 'facet' | 'facetV' | 'sort'; - -export interface InsightColumns { - uid?: string; - x?: string; - y?: string; - z?: string; - group?: string; - size?: string; - color?: string; - sort?: string; - facet?: string; - facetV?: string; -} - export interface SpecRoleCapabilities { role: InsightColumnRoles; excludeCategoric?: boolean; diff --git a/packages/sanddance-specs/src/zBase.ts b/packages/sanddance-specs/src/zBase.ts index 490c315ab..8d489c5ed 100644 --- a/packages/sanddance-specs/src/zBase.ts +++ b/packages/sanddance-specs/src/zBase.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. */ -import { SignalNames } from './constants'; -import { linearScale, pointScale } from './scales'; +import { SignalNames } from './constants.js'; +import { linearScale, pointScale } from './scales.js'; import { Column } from '@msrvida/chart-types'; import { RangeScheme } from 'vega-typings'; -import { safeFieldName } from './expr'; +import { safeFieldName } from './expr.js'; export function addZScale(z: Column, zSize: string, dataName: string, zScaleName: string) { if (z) { diff --git a/packages/sanddance-specs/uitest/tsconfig.json b/packages/sanddance-specs/uitest/tsconfig.json index 25da2d82d..9883a726a 100644 --- a/packages/sanddance-specs/uitest/tsconfig.json +++ b/packages/sanddance-specs/uitest/tsconfig.json @@ -3,7 +3,7 @@ "lib": [ "dom", "es2015" ], - "outDir": "../../../docs/tests/sanddance-specs/v1/js/", + "outDir": "../../../docs/tests/sanddance-specs/v2/js/", "removeComments": true, "skipLibCheck": true } diff --git a/packages/sanddance-test-es6/package.json b/packages/sanddance-test-es6/package.json index 2a423dd10..f62475607 100644 --- a/packages/sanddance-test-es6/package.json +++ b/packages/sanddance-test-es6/package.json @@ -5,9 +5,7 @@ "scripts": { "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "build:05": "tsc -p .", - "start": "parcel serve ./test/index.html --open", - "deploy": "parcel build ./src/sanddance-test-es6.ts --no-autoinstall --no-cache", - "remove-vega": "npm un vega vega-typings" + "deploy": "vite build" }, "umd": "../../docs/tests/v4/es6/js/sanddance-test-es6.js", "targets": { diff --git a/packages/sanddance-test-es6/vite.config.js b/packages/sanddance-test-es6/vite.config.js new file mode 100644 index 000000000..f0db53355 --- /dev/null +++ b/packages/sanddance-test-es6/vite.config.js @@ -0,0 +1,17 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; + +export default defineConfig({ + build: { + lib: { + entry: resolve(__dirname, 'src/sanddance-test-es6.ts'), + formats: ['umd'], + name: 'SandDanceTestES6', + fileName: () => 'sanddance-test-es6.js', + }, + outDir: '../../docs/tests/v4/es6/js', + emptyOutDir: false, + sourcemap: false, + minify: false, + }, +}); diff --git a/packages/sanddance/README-DEV.md b/packages/sanddance/README-DEV.md index 166df29c0..b4461e11b 100644 --- a/packages/sanddance/README-DEV.md +++ b/packages/sanddance/README-DEV.md @@ -6,8 +6,6 @@ The build of vega-deck.gl is meant to satisfy these constraints: Specifically, the use of base classes in Vega and Deck.gl which were declared using the `class` keyword, subclasses in vega-deck.gl must also use the `class` keyword when extending these. -Note that as of this writing, [the Parcel bundler has a bug](https://github.com/parcel-bundler/parcel/issues/839) that transpiles the `class` keyword to a `function`, resulting in a runtime error `Class constructor [extended class] cannot be invoked without 'new'`. This can be alleviated if the base classes in Vega and Deck.gl are also run through the bundler as ES6 modules. - 2. TypeScript We want to leverage TypeScript as much as possible. diff --git a/packages/sanddance/README.md b/packages/sanddance/README.md index 1bfa65fa1..6e9dee4f4 100644 --- a/packages/sanddance/README.md +++ b/packages/sanddance/README.md @@ -14,7 +14,7 @@ You will need to consider how to load the libraries that `sanddance` depends on, Load dependencies via ` + ``` @@ -30,7 +30,7 @@ Add these to the `dependencies` section of your `package.json`, then run `npm in ```json "@msrvida/sanddance": "^4", -"vega": "^5.32" +"vega": "^6.2" ``` Import these in your JavaScript, then call the `use()` function to pass the dependency libraries to `SandDance.VegaMorphCharts`: diff --git a/packages/sanddance/package.json b/packages/sanddance/package.json index 496316960..15e31dbb0 100644 --- a/packages/sanddance/package.json +++ b/packages/sanddance/package.json @@ -32,9 +32,9 @@ "dependencies": { "d3-scale": "^4.0.2", "@msrvida/chart-types": "^1", - "@msrvida/sanddance-specs": "^1", + "@msrvida/sanddance-specs": "^2", "@msrvida/search-expression": "^1", "@msrvida/vega-morphcharts": "^1", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } } diff --git a/packages/search-expression/package.json b/packages/search-expression/package.json index 9f81e8d18..9530a716f 100644 --- a/packages/search-expression/package.json +++ b/packages/search-expression/package.json @@ -24,6 +24,6 @@ "license": "MIT", "dependencies": { "@msrvida/chart-types": "^1", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } } diff --git a/packages/vega-deck.gl/README.md b/packages/vega-deck.gl/README.md index 78becb83f..e43f780bf 100644 --- a/packages/vega-deck.gl/README.md +++ b/packages/vega-deck.gl/README.md @@ -35,7 +35,7 @@ VegaDeckGl.use(vega, deck, deck, luma); ## Installation via Node.js -This option is for those who are using a script bundler such as [WebPack](https://webpack.js.org) or [Parcel](https://parceljs.org). +This option is for those who are using a script bundler. Add these to the `dependencies` section of your `package.json`, then run `npm install`: diff --git a/packages/vega-deck.gl/package.json b/packages/vega-deck.gl/package.json index 876cb74c4..fc172f2b7 100644 --- a/packages/vega-deck.gl/package.json +++ b/packages/vega-deck.gl/package.json @@ -12,15 +12,13 @@ "dist" ], "scripts": { - "vegatest": "parcel serve ./test/vegaspec/vega-deck.gl.test.html --port 8087 --open --no-hmr --no-autoinstall", - "cubetest": "parcel serve ./test/cubelayer/cubeTest.html --port 8087 --open --no-hmr", "x-deploy": "node ./scripts/deploy.js", "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "watch-typescript": "tsc -p . -w", "build-typescript": "tsc -p .", "bundle": "rollup -c", "x-build:02": "npm run build-typescript && npm run bundle", - "remove-vega": "npm un vega vega-typings", + "remove-vega": "npm un vega-typings", "patch-after-vega-upgrade": "npm version patch" }, "keywords": [ @@ -37,6 +35,6 @@ "d3-ease": "^1.0.5", "deepmerge": "^2.1.1", "tsx-create-element": "^2.2.9", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } } diff --git a/packages/vega-morphcharts-test-es6/package.json b/packages/vega-morphcharts-test-es6/package.json index 063a21e5e..66b189431 100644 --- a/packages/vega-morphcharts-test-es6/package.json +++ b/packages/vega-morphcharts-test-es6/package.json @@ -5,8 +5,7 @@ "scripts": { "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "build:03": "tsc -p .", - "deploy": "parcel build ./src/vega-morphcharts-test-es6.ts --no-autoinstall --no-cache", - "remove-vega": "npm un vega" + "deploy": "vite build" }, "umd": "../../docs/tests/v3/es6/js/vega-morphcharts-test-es6.js", "targets": { diff --git a/packages/vega-morphcharts-test-es6/vite.config.js b/packages/vega-morphcharts-test-es6/vite.config.js new file mode 100644 index 000000000..0087ad2a6 --- /dev/null +++ b/packages/vega-morphcharts-test-es6/vite.config.js @@ -0,0 +1,17 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; + +export default defineConfig({ + build: { + lib: { + entry: resolve(__dirname, 'src/vega-morphcharts-test-es6.ts'), + formats: ['umd'], + name: 'VegaMorphchartsTestES6', + fileName: () => 'vega-morphcharts-test-es6.js', + }, + outDir: '../../docs/tests/v4/es6/js', + emptyOutDir: false, + sourcemap: false, + minify: false, + }, +}); diff --git a/packages/vega-morphcharts/package.json b/packages/vega-morphcharts/package.json index 29772868c..a15e2aec6 100644 --- a/packages/vega-morphcharts/package.json +++ b/packages/vega-morphcharts/package.json @@ -6,15 +6,15 @@ "files": [ "dist" ], - "scripts": { - "vegatest": "parcel serve ./test/vegaspec/vega-morphcharts.test.html --open --no-hmr --no-autoinstall --no-cache", + "scripts": { + "vegatest": "vite --config vite.dev.config.js", "deploy": "node ./scripts/deploy.js", "eslint": "eslint -c ../../eslint.config.mjs --fix ./src/**/*.ts*", "watch-typescript": "tsc -p . -w", "build-typescript": "tsc -p .", "bundle": "rollup -c", "build:02": "npm run build-typescript && node ../../scripts/version.js && npm run bundle", - "remove-vega": "npm un vega vega-typings", + "remove-vega": "npm un vega-typings", "patch-after-vega-upgrade": "npm version patch" }, "keywords": [ @@ -31,6 +31,6 @@ "is-plain-object": "^5.0.0", "morphcharts": "^1", "tsx-create-element": "^2.2.5", - "vega-typings": "~1.5.0" + "vega-typings": "~2.1.0" } } diff --git a/packages/vega-morphcharts/vite.dev.config.js b/packages/vega-morphcharts/vite.dev.config.js new file mode 100644 index 000000000..e5074364d --- /dev/null +++ b/packages/vega-morphcharts/vite.dev.config.js @@ -0,0 +1,10 @@ +import { defineConfig } from 'vite'; +import { resolve } from 'path'; + +export default defineConfig({ + root: 'test/vegaspec', + server: { + open: true, + hmr: false, + }, +}); diff --git a/scripts/vega-version.mjs b/scripts/vega-version.mjs index 62649f695..775b11670 100644 --- a/scripts/vega-version.mjs +++ b/scripts/vega-version.mjs @@ -6,25 +6,25 @@ import { readFileSync, writeFileSync } from 'fs'; const oldVersion = { vega: { major: '5', - minor: '30', + minor: '32', patch: '0', }, typings: { major: '1', - minor: '3', - patch: '1', + minor: '5', + patch: '0', }, }; const newVersion = { vega: { - major: '5', - minor: '32', + major: '6', + minor: '2', patch: '0', }, typings: { - major: '1', - minor: '5', + major: '2', + minor: '1', patch: '0', }, }; @@ -45,7 +45,7 @@ const packages = { ], }, { - glob: 'docs/tests/{data-inference,sanddance-specs}/v1/index.html', + glob: 'docs/tests/{data-inference,sanddance-specs}/v2/index.html', pattern: ({ major, minor }) => [ `vega@^${major}.${minor}`, ], @@ -56,12 +56,6 @@ const packages = { `"vega": "${major}.${minor}${patch.length ? '.' : ''}${patch}"`, ], }, - { - glob: 'streamlit/streamlit_sanddance/frontend/package.json', - pattern: ({ major, minor, patch }) => [ - `"vega": "${major}.${minor}${patch.length ? '.' : ''}${patch}"`, - ], - }, { glob: 'packages/*/src/**/*.ts', pattern: ({ major, minor }) => [ diff --git a/streamlit/.gitignore b/streamlit/.gitignore deleted file mode 100644 index 378eac25d..000000000 --- a/streamlit/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/streamlit/LICENSE b/streamlit/LICENSE deleted file mode 100644 index d7e8cff74..000000000 --- a/streamlit/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2018-2021 Streamlit Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/streamlit/MANIFEST.in b/streamlit/MANIFEST.in deleted file mode 100644 index 9e8e9bab9..000000000 --- a/streamlit/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -recursive-include streamlit_sanddance/frontend/dist/umd * diff --git a/streamlit/README.md b/streamlit/README.md deleted file mode 100644 index cbb438020..000000000 --- a/streamlit/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# streamlit-sanddance - -Streamlit component that allows you to view a SandDance visualization of a dataframe. - -## Installation instructions - -```sh -pip install streamlit-sanddance -``` - -## Usage instructions - -```python -import streamlit as st - -from streamlit_sanddance import sanddance - -#sample random DataFrame -df = pd.DataFrame( - np.random.randn(20, 3), - columns=['a', 'b', 'c']) - -#make sure to use a key to prevent refreshing after an event -sdEvent = sanddance(df, key='sd1') - -#if sdEvent is not None and contains a cubeClick >= 0, display the data row -if sdEvent is not None and 'cubeClick' in sdEvent and sdEvent['cubeClick'] is not None and sdEvent['cubeClick'] >= 0: - st.write(df.iloc[sdEvent['cubeClick']]) -else: - st.write("No cubeClick event") - -``` -The return value is a dictionary of visual interaction events such as selections. - -## Dev Setup - -* Ensure you have [Python 3.6+](https://www.python.org/downloads/). -* Create a new Python virtual environment for the Streamlit component: -``` -$ cd streamlit -$ python3 -m venv venv # create venv -$ . venv/bin/activate # activate venv -$ pip install streamlit # install streamlit -``` -* Initialize and run the component frontend: -``` -$ cd .. # root of this repo -$ npm run start # Start the Webpack dev server -``` -* From a separate terminal, run the Streamlit app: -``` -$ cd streamlit -$ . venv/bin/activate # activate the venv you created earlier -$ pip uninstall streamlit-sanddance # remove production version of streamlit-sanddance package -$ pip install -e . # install streamlit-sanddance as editable package -$ streamlit run streamlit_sanddance/example.py # run the example -``` \ No newline at end of file diff --git a/streamlit/setup.py b/streamlit/setup.py deleted file mode 100644 index 6f3e98870..000000000 --- a/streamlit/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -from pathlib import Path - -import setuptools - -this_directory = Path(__file__).parent -long_description = (this_directory / "README.md").read_text() - -setuptools.setup( - name="streamlit-sanddance", - version="0.0.2", - author="Dan Marshall", - author_email="danmar@microsoft.com", - description="Streamlit component that allows you to view a SandDance visualization of a dataframe.", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://microsoft.github.io/SandDance", - packages=setuptools.find_packages(), - include_package_data=True, - classifiers=[], - python_requires=">=3.7", - install_requires=[ - # By definition, a Custom Component depends on Streamlit. - # If your component has other Python dependencies, list - # them here. - "streamlit >= 0.63", - ], - extras_require={ - "devel": [ - "wheel", - "pytest==7.4.0", - "playwright==1.36.0", - "requests==2.31.0", - "pytest-playwright-snapshot==1.0", - "pytest-rerunfailures==12.0", - ] - } -) diff --git a/streamlit/streamlit_sanddance/__init__.py b/streamlit/streamlit_sanddance/__init__.py deleted file mode 100644 index 129624e0a..000000000 --- a/streamlit/streamlit_sanddance/__init__.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -import os -import streamlit.components.v1 as components -import pandas as pd -from .types_insight import Insight -from .types_explorer import ExplorerProps - -from typing import Optional - -# Create a _RELEASE constant. We'll set this to False while we're developing -# the component, and True when we're ready to package and distribute it. -# (This is, of course, optional - there are innumerable ways to manage your -# release process.) -_RELEASE = False - -COMPONENT_NAME = "sanddance" - -# Declare a Streamlit component. `declare_component` returns a function -# that is used to create instances of the component. We're naming this -# function "_component_func", with an underscore prefix, because we don't want -# to expose it directly to users. Instead, we will create a custom wrapper -# function, below, that will serve as our component's public API. - -# It's worth noting that this call to `declare_component` is the -# *only thing* you need to do to create the binding between Streamlit and -# your component frontend. Everything else we do in this file is simply a -# best practice. - -if not _RELEASE: - _component_func = components.declare_component( - # We give the component a simple, descriptive name ("sanddance" - # does not fit this bill, so please choose something better for your - # own component :) - COMPONENT_NAME, - # Pass `url` here to tell Streamlit that the component will be served - # by the local dev server that you run via `npm run start`. - # (This is useful while your component is in development.) - url="http://localhost:8087", - ) -else: - # When we're distributing a production version of the component, we'll - # replace the `url` param with `path`, and point it to the component's - # build directory: - parent_dir = os.path.dirname(os.path.abspath(__file__)) - build_dir = os.path.join(parent_dir, "frontend/dist/umd") - _component_func = components.declare_component(COMPONENT_NAME, path=build_dir) - - -# Create a wrapper function for the component. This is an optional -# best practice - we could simply expose the component function returned by -# `declare_component` and call it done. The wrapper allows us to customize -# our component's API: we can pre-process its input args, post-process its -# output value, and add a docstring for users. - -def sanddance(df: pd.DataFrame, key: Optional[str] = None, insight: Optional[Insight] = None, explorerProps: Optional[ExplorerProps] = None, height: int = 700) -> int: - """Renders a SandDance visualization for a specified DataFrame. - - This function generates a SandDance visualization within a Streamlit app, using the provided DataFrame, insight, and explorer properties. - - Parameters: - df (pd.DataFrame): The DataFrame to visualize. This parameter can be provided as a positional argument. - key (str, optional): A unique key for the component. This will be autogenerated if not provided. - height (int, optional): The height of the component in pixels. If not provided, a default height of 700 will be used. - insight (Insight, optional): An optional Insight object to customize the visualization. - explorerProps (ExplorerProps, optional): An optional ExplorerProps object to further customize the visualization. - - Returns - ------- - SandDanceEvent or None - A dict containing the event data, or None if no event has occurred. - """ - - # Call through to our private component function. Arguments we pass here - # will be sent to the frontend, where they'll be available in an "args" - # dictionary. - component_value = _component_func(records=df.to_dict(orient='records'), key=key, default=None, insight=insight, explorerProps=explorerProps, height=height) - - # We could modify the value returned from the component if we wanted. - # There's no need to do this in our simple example - but it's an option. - return component_value diff --git a/streamlit/streamlit_sanddance/example.py b/streamlit/streamlit_sanddance/example.py deleted file mode 100644 index 750c65cd2..000000000 --- a/streamlit/streamlit_sanddance/example.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -import streamlit as st -from streamlit_sanddance import sanddance -import pandas as pd -from streamlit_sanddance.types_explorer import SandDanceEvent - -# Create a dictionary with some data -data = {'name': ['Alice', 'Bob', 'Charlie', 'David'], - 'age': [25, 32, 18, 47], - 'city': ['New York', 'Paris', 'London', 'San Francisco']} - -# Create a DataFrame from the dictionary -df = pd.DataFrame(data) - -# Add some test code to play with the component while it's in development. -# During development, we can run this just as we would any other Streamlit -# app: `$ streamlit run sanddance/example.py` - -st.subheader("SandDance component from Pandas DataFrame") - -# Create an instance of our SandDance component -sdEvent: SandDanceEvent = sanddance(df=df, explorerProps={"initialSidebarClosed": True}, insight={"chart": "treemap", "columns": {"color": "age"}, "scheme": "redyellowgreen"}) - -#if sdEvent is not None and contains a cubeClick >= 0, display the data row -if sdEvent is not None and 'cubeClick' in sdEvent and sdEvent['cubeClick'] is not None and sdEvent['cubeClick'] >= 0: - st.write(df.iloc[sdEvent['cubeClick']]) -else: - st.write("No cubeClick event") diff --git a/streamlit/streamlit_sanddance/frontend/.prettierrc b/streamlit/streamlit_sanddance/frontend/.prettierrc deleted file mode 100644 index 0735a4274..000000000 --- a/streamlit/streamlit_sanddance/frontend/.prettierrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "endOfLine": "lf", - "semi": false, - "trailingComma": "es5" -} diff --git a/streamlit/streamlit_sanddance/frontend/dist/umd/index.html b/streamlit/streamlit_sanddance/frontend/dist/umd/index.html deleted file mode 100644 index eee898389..000000000 --- a/streamlit/streamlit_sanddance/frontend/dist/umd/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - Document - - - - -
- - - - - - - - \ No newline at end of file diff --git a/streamlit/streamlit_sanddance/frontend/package.json b/streamlit/streamlit_sanddance/frontend/package.json deleted file mode 100644 index 140b61dd3..000000000 --- a/streamlit/streamlit_sanddance/frontend/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "streamlit-sanddance", - "version": "1.0.0", - "private": true, - "dependencies": { - "@fluentui/react": "^8", - "@msrvida/sanddance-explorer": "^4", - "react": ">=16.8.0 <18.0.0", - "react-dom": ">=16.8.0 <18.0.0", - "streamlit-component-lib": "^2.0.0", - "vega": "5.32.0" - }, - "scripts": { - "build:07": "npm run bundle", - "bundle": "parcel build ./src/index.tsx --no-autoinstall --no-cache" - }, - "eslintConfig": { - "extends": "react-app" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, - "homepage": ".", - "targets": { - "main": false, - "types": false, - "umd": { - "distDir": "./dist/umd", - "optimize": false, - "scopeHoist": false, - "sourceMap": false - } - }, - "umd": "./dist/umd/streamlit_sanddance.js", - "alias": { - "react": { - "global": "React" - }, - "react-dom": { - "global": "ReactDOM" - } - } -} \ No newline at end of file diff --git a/streamlit/streamlit_sanddance/frontend/src/StreamlitSandDance.css b/streamlit/streamlit_sanddance/frontend/src/StreamlitSandDance.css deleted file mode 100644 index 14da0ac43..000000000 --- a/streamlit/streamlit_sanddance/frontend/src/StreamlitSandDance.css +++ /dev/null @@ -1,32 +0,0 @@ -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -html, -body { - height: 100%; - margin: 0; -} - -body { - font-family: 'Segoe UI', sans-serif; -} - -select, -button, -input { - font-family: 'Segoe UI', sans-serif; -} - -#app { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; -} - -.sanddance-explorer { - height: 100%; -} diff --git a/streamlit/streamlit_sanddance/frontend/src/StreamlitSandDance.tsx b/streamlit/streamlit_sanddance/frontend/src/StreamlitSandDance.tsx deleted file mode 100644 index 2a5a8a0aa..000000000 --- a/streamlit/streamlit_sanddance/frontend/src/StreamlitSandDance.tsx +++ /dev/null @@ -1,101 +0,0 @@ -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -import { - Streamlit, - StreamlitComponentBase, - withStreamlitConnection, -} from "streamlit-component-lib" -import React, { ReactNode } from "react" -import { Explorer, Explorer_Class, getColorSettingsFromThemePalette, Props as ExplorerProps, SandDance, themePalettes, ViewerOptions } from "@msrvida/sanddance-explorer"; -import { fluentUI } from './fluentUIComponents'; - -import "@msrvida/sanddance-explorer/dist/css/sanddance-explorer.css" -import "./StreamlitSandDance.css" -import { SandDanceEvent } from "./event-types"; - -interface State { -} - -/** - * This is a React-based component template. The `render()` function is called - * automatically when your component should be re-rendered. - */ -class StreamlitSandDance extends StreamlitComponentBase { - public state: State = {} - - private _explorer?: Explorer_Class = undefined; - private _resizeHandler?: () => void; - - public componentDidMount = (): void => { - this._resizeHandler = () => { - this._explorer && this._explorer.resize(); - }; - window.addEventListener('resize', this._resizeHandler); - } - - public componentWillUnmount = (): void => { - this._explorer = undefined; - window.removeEventListener('resize', this._resizeHandler!); - } - - public render = (): ReactNode => { - // Arguments that are passed to the plugin in Python are accessible - // via `this.props.args`. Here, we access the "name" arg. - const records: object[] = this.props.args["records"] - const theme = this.props.theme?.base === "dark" ? 'dark-theme' : ''; - - const getPartialInsight: (columns: SandDance.types.Column[]) => Partial = (columns) => { - return this.props.args["insight"] || {}; - }; - - fluentUI.loadTheme({ palette: themePalettes[theme] }); - - const setHeight = this.props.args["height"]; - Streamlit.setFrameHeight(setHeight); - - const viewerOptions = getViewerOptions(theme, this.props.args["explorerProps"]?.viewerOptions); - - const explorerProps: ExplorerProps = { - compactUI: true, - mounted: e => { - this._explorer = e; - e.load(records, getPartialInsight); - }, - theme: this.props.theme?.base === "dark" ? 'dark-theme' : '', - ...this.props.args["explorerProps"], - viewerOptions, - }; - - return ( - - ) - } - -} - -export default withStreamlitConnection(StreamlitSandDance) - -function getViewerOptions(theme: string, viewerOptions: Partial): Partial { - return { - ...viewerOptions, - colors: getColorSettingsFromThemePalette(themePalettes[theme]), - onCanvasClick: () => { - const sandDanceEvent: SandDanceEvent = { - cubeClick: -1, - }; - Streamlit.setComponentValue(sandDanceEvent); - }, - onCubeClick: (e, cube) => { - const sandDanceEvent: SandDanceEvent = { - cubeClick: cube.ordinal, - }; - Streamlit.setComponentValue(sandDanceEvent); - }, - }; -} \ No newline at end of file diff --git a/streamlit/streamlit_sanddance/frontend/src/event-types.ts b/streamlit/streamlit_sanddance/frontend/src/event-types.ts deleted file mode 100644 index e8e8c1d5e..000000000 --- a/streamlit/streamlit_sanddance/frontend/src/event-types.ts +++ /dev/null @@ -1,9 +0,0 @@ -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -export interface SandDanceEvent { - selection?: string; - cubeClick?: number; -} diff --git a/streamlit/streamlit_sanddance/frontend/src/fluentUIComponents.ts b/streamlit/streamlit_sanddance/frontend/src/fluentUIComponents.ts deleted file mode 100644 index b94c7a503..000000000 --- a/streamlit/streamlit_sanddance/frontend/src/fluentUIComponents.ts +++ /dev/null @@ -1,61 +0,0 @@ -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -import { - ActionButton, - DefaultButton, - IconButton, - PrimaryButton, -} from '@fluentui/react/lib/Button'; -import { ChoiceGroup } from '@fluentui/react/lib/ChoiceGroup'; -import { ComboBox } from '@fluentui/react/lib/ComboBox'; -import { CommandBar } from '@fluentui/react/lib/CommandBar'; -import { ContextualMenuItemType } from '@fluentui/react/lib/ContextualMenu'; -import { Customizer } from '@fluentui/react/lib/Utilities'; -import { Dialog, DialogFooter, DialogType } from '@fluentui/react/lib/Dialog'; -import { Dropdown, DropdownMenuItemType } from '@fluentui/react/lib/Dropdown'; -import { FluentUIComponents } from '@msrvida/fluentui-react-cdn-typings'; -import { getFocusStyle, getTheme, loadTheme, registerIcons, unregisterIcons } from '@fluentui/react/lib/Styling'; -import { Icon } from '@fluentui/react/lib/Icon'; -import { initializeIcons, use } from '@msrvida/fluentui-icons'; -import { Label } from '@fluentui/react/lib/Label'; -import { Modal } from '@fluentui/react/lib/Modal'; -import { Slider } from '@fluentui/react/lib/Slider'; -import { Spinner, SpinnerSize } from '@fluentui/react/lib/Spinner'; -import { TextField } from '@fluentui/react/lib/TextField'; -import { Toggle } from '@fluentui/react/lib/Toggle'; - -use(registerIcons, unregisterIcons); -initializeIcons(); - -export const fluentUI: FluentUIComponents = { - ActionButton: ActionButton as any, - ChoiceGroup: ChoiceGroup as any, - ComboBox: ComboBox as any, - CommandBar: CommandBar as any, - ContextualMenuItemType, - Customizer: Customizer as any, - DefaultButton: DefaultButton as any, - Dialog: Dialog as any, - DialogFooter: DialogFooter as any, - DialogType, - Dropdown: Dropdown as any, - DropdownMenuItemType: DropdownMenuItemType as any, - Icon: Icon as any, - IconButton: IconButton as any, - getFocusStyle, - getTheme, - Label: Label as any, - loadTheme, - Modal: Modal as any, - PrimaryButton: PrimaryButton as any, - Slider: Slider as any, - Spinner: Spinner as any, - SpinnerSize, - TextField: TextField as any, - Toggle: Toggle as any, - registerIcons, - unregisterIcons, -}; diff --git a/streamlit/streamlit_sanddance/frontend/src/index.tsx b/streamlit/streamlit_sanddance/frontend/src/index.tsx deleted file mode 100644 index 9c2db4b46..000000000 --- a/streamlit/streamlit_sanddance/frontend/src/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -/*! -* Copyright (c) Microsoft Corporation. -* Licensed under the MIT License. -*/ - -import React from "react"; -import ReactDOM from "react-dom"; -import StreamlitSandDance from "./StreamlitSandDance"; -import { use } from "@msrvida/sanddance-explorer"; -import { fluentUI } from './fluentUIComponents'; -import * as vega from 'vega'; - -use(fluentUI, React, ReactDOM, vega); - -ReactDOM.render( - - - , - document.getElementById("app") -) diff --git a/streamlit/streamlit_sanddance/frontend/src/react-app-env.d.ts b/streamlit/streamlit_sanddance/frontend/src/react-app-env.d.ts deleted file mode 100644 index 6431bc5fc..000000000 --- a/streamlit/streamlit_sanddance/frontend/src/react-app-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/streamlit/streamlit_sanddance/frontend/tsconfig.json b/streamlit/streamlit_sanddance/frontend/tsconfig.json deleted file mode 100644 index af10394b4..000000000 --- a/streamlit/streamlit_sanddance/frontend/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react" - }, - "include": ["src"] -} diff --git a/streamlit/streamlit_sanddance/types_explorer.py b/streamlit/streamlit_sanddance/types_explorer.py deleted file mode 100644 index 86241eaab..000000000 --- a/streamlit/streamlit_sanddance/types_explorer.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -from typing import Any, Dict, List, Optional, Union - -class Snapshot: - name: str - data: str - -class SnapshotProps: - snapshots: List[Snapshot] - selectedSnapshotIndex: int - -class ExplorerProps: - compactUI: Union[None, bool] - hideSidebarControls: Union[None, bool] - logoClickUrl: Union[None, str] - logoClickTarget: Union[None, str] - bingSearchDisabled: Union[None, bool] - searchORDisabled: Union[None, bool] - theme: Union[None, str] - initialView: Union[None, str] - #topBarButtonProps would be cool to add, need an event handler - snapshotProps: Union[None, SnapshotProps] - initialRenderer: Union[None, Dict[str, Any]] - initialSidebarClosed: Union[None, bool] - initialSidebarPinned: Union[None, bool] - -class SandDanceEvent: - selection: Optional[str] - cubeClick: Optional[int] diff --git a/streamlit/streamlit_sanddance/types_insight.py b/streamlit/streamlit_sanddance/types_insight.py deleted file mode 100644 index 4652c05ed..000000000 --- a/streamlit/streamlit_sanddance/types_insight.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -from enum import Enum -from typing import Optional, List, Dict, Any - -class Chart(Enum): - BARCHART = 'barchart' - BARCHARTH = 'barchartH' - BARCHARTV = 'barchartV' - DENSITY = 'density' - GRID = 'grid' - SCATTERPLOT = 'scatterplot' - STACKS = 'stacks' - STRIPS = 'strips' - TREEMAP = 'treemap' - -class ColorBin(Enum): - CONTINUOUS = 'continuous' - QUANTIZE = 'quantize' - QUANTILE = 'quantile' - -class FacetStyle(Enum): - WRAP = 'wrap' - CROSS = 'cross' - -class TotalStyle(Enum): - COUNT_SQUARE = 'count-square' - COUNT_STRIP = 'count-strip' - SUM_STRIP = 'sum-strip' - SUM_STRIP_PERCENT = 'sum-strip-percent' - SUM_TREEMAP = 'sum-treemap' - -class Facets: - columns: int - rows: int - -class Extents: - bottom: int - left: int - right: int - top: int - -class Size: - height: int - width: int - -class BackgroundImage: - url: str - size: Size - extents: Optional[Extents] - -class InsightColumns: - uid: Optional[str] - x: Optional[str] - y: Optional[str] - z: Optional[str] - group: Optional[str] - size: Optional[str] - color: Optional[str] - sort: Optional[str] - facet: Optional[str] - facetV: Optional[str] - -class View(Enum): - _2D = '2d' - _3D = '3d' - -class Search: - pass # Placeholder for future definition - -class SignalValues: - key: Dict[str, Any] - -class Transforms: - pass # Placeholder for future definition - -class Insight: - backgroundImage: Optional[BackgroundImage] - chart: Chart - size: Size - columns: InsightColumns - view: Optional[View] - filter: Optional[Search] - facetStyle: Optional[FacetStyle] - totalStyle: Optional[TotalStyle] - colorBin: Optional[ColorBin] - scheme: Optional[str] - signalValues: Optional[SignalValues] - hideAxes: Optional[bool] - hideLegend: Optional[bool] - directColor: Optional[bool] - transform: Optional[List[Transforms]] diff --git a/test/data-inference.html b/test/data-inference.html index 6cbe9c398..b405ada55 100644 --- a/test/data-inference.html +++ b/test/data-inference.html @@ -6,7 +6,7 @@ Data-Inference test - + diff --git a/test/streamlit_sanddance.html b/test/streamlit_sanddance.html deleted file mode 100644 index b7bd51dad..000000000 --- a/test/streamlit_sanddance.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - Document - - - -
- - - - - - - - \ No newline at end of file